Private
Public Access
1
0

feat: Fluent UI Outlook Lite + connections mockup

This commit is contained in:
2026-04-14 18:52:25 +00:00
parent 1199eff6c3
commit dfa4010406
34820 changed files with 1003813 additions and 205 deletions

View File

@@ -0,0 +1,24 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "MenuItemSwitch", {
enumerable: true,
get: function() {
return MenuItemSwitch;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const _useMenuItemSwitch = require("./useMenuItemSwitch");
const _renderMenuItemSwitch = require("./renderMenuItemSwitch");
const _useMenuItemSwitchStylesstyles = require("./useMenuItemSwitchStyles.styles");
const MenuItemSwitch = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useMenuItemSwitch.useMenuItemSwitch_unstable)(props, ref);
(0, _useMenuItemSwitchStylesstyles.useMenuItemSwitchStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useMenuItemSwitchStyles_unstable')(state);
return (0, _renderMenuItemSwitch.renderMenuItemSwitch_unstable)(state);
});
MenuItemSwitch.displayName = 'MenuItemSwitch';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/MenuItemSwitch/MenuItemSwitch.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useMenuItemSwitch_unstable } from './useMenuItemSwitch';\nimport { renderMenuItemSwitch_unstable } from './renderMenuItemSwitch';\nimport { useMenuItemSwitchStyles_unstable } from './useMenuItemSwitchStyles.styles';\nimport type { MenuItemSwitchProps } from './MenuItemSwitch.types';\n\nexport const MenuItemSwitch: ForwardRefComponent<MenuItemSwitchProps> = React.forwardRef((props, ref) => {\n const state = useMenuItemSwitch_unstable(props, ref);\n\n useMenuItemSwitchStyles_unstable(state);\n useCustomStyleHook_unstable('useMenuItemSwitchStyles_unstable')(state);\n return renderMenuItemSwitch_unstable(state);\n});\n\nMenuItemSwitch.displayName = 'MenuItemSwitch';\n"],"names":["React","useCustomStyleHook_unstable","useMenuItemSwitch_unstable","renderMenuItemSwitch_unstable","useMenuItemSwitchStyles_unstable","MenuItemSwitch","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;qCAEa,kCAAkC;mCACnC,sBAAsB;sCACnB,yBAAyB;+CACtB,mCAAmC;AAG7E,MAAMK,iBAAAA,WAAAA,GAA2DL,OAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,YAAQP,6CAAAA,EAA2BK,OAAOC;QAEhDJ,+DAAAA,EAAiCK;QACjCR,gDAAAA,EAA4B,oCAAoCQ;IAChE,WAAON,mDAAAA,EAA8BM;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}

View File

@@ -0,0 +1,6 @@
/**
* State used in rendering MenuItemSwitch
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/MenuItemSwitch/MenuItemSwitch.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { MenuItemSlots } from '../MenuItem/MenuItem.types';\nimport { MenuItemSelectableState } from '../../selectable/types';\nimport { MenuItemCheckboxProps } from '../MenuItemCheckbox/MenuItemCheckbox.types';\n\nexport type MenuItemSwitchSlots = Pick<MenuItemSlots, 'root' | 'content' | 'secondaryContent' | 'icon' | 'subText'> & {\n switchIndicator?: Slot<'span'>;\n};\n\n/**\n * MenuItemSwitch Props\n */\nexport type MenuItemSwitchProps = ComponentProps<MenuItemSwitchSlots> &\n Pick<MenuItemCheckboxProps, 'disabled' | 'persistOnClick' | 'name' | 'value'>;\n\n/**\n * State used in rendering MenuItemSwitch\n */\nexport type MenuItemSwitchState = ComponentState<MenuItemSwitchSlots> &\n MenuItemSelectableState &\n Required<Pick<MenuItemSwitchProps, 'disabled'>>;\n"],"names":[],"mappings":"AAeA;;CAEC,GACD,WAEkD"}

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
MenuItemSwitch: function() {
return _MenuItemSwitch.MenuItemSwitch;
},
circleFilledClassName: function() {
return _useMenuItemSwitchStylesstyles.circleFilledClassName;
},
menuItemSwitchClassNames: function() {
return _useMenuItemSwitchStylesstyles.menuItemSwitchClassNames;
},
renderMenuItemSwitch_unstable: function() {
return _renderMenuItemSwitch.renderMenuItemSwitch_unstable;
},
useMenuItemSwitchBase_unstable: function() {
return _useMenuItemSwitch.useMenuItemSwitchBase_unstable;
},
useMenuItemSwitchStyles_unstable: function() {
return _useMenuItemSwitchStylesstyles.useMenuItemSwitchStyles_unstable;
},
useMenuItemSwitch_unstable: function() {
return _useMenuItemSwitch.useMenuItemSwitch_unstable;
}
});
const _MenuItemSwitch = require("./MenuItemSwitch");
const _renderMenuItemSwitch = require("./renderMenuItemSwitch");
const _useMenuItemSwitch = require("./useMenuItemSwitch");
const _useMenuItemSwitchStylesstyles = require("./useMenuItemSwitchStyles.styles");

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/MenuItemSwitch/index.ts"],"sourcesContent":["export { MenuItemSwitch } from './MenuItemSwitch';\nexport type { MenuItemSwitchProps, MenuItemSwitchSlots, MenuItemSwitchState } from './MenuItemSwitch.types';\nexport { renderMenuItemSwitch_unstable } from './renderMenuItemSwitch';\nexport { useMenuItemSwitch_unstable, useMenuItemSwitchBase_unstable } from './useMenuItemSwitch';\nexport {\n circleFilledClassName,\n menuItemSwitchClassNames,\n useMenuItemSwitchStyles_unstable,\n} from './useMenuItemSwitchStyles.styles';\n"],"names":["MenuItemSwitch","renderMenuItemSwitch_unstable","useMenuItemSwitch_unstable","useMenuItemSwitchBase_unstable","circleFilledClassName","menuItemSwitchClassNames","useMenuItemSwitchStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,8BAAc;;;eAKrBI,oDAAqB;;;eACrBC,uDAAwB;;;eAJjBJ,mDAA6B;;;eACDE,iDAA8B;;;eAIjEG,+DAAgC;;;eAJzBJ,6CAA0B;;;gCAHJ,mBAAmB;sCAEJ,yBAAyB;mCACI,sBAAsB;+CAK1F,mCAAmC"}

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderMenuItemSwitch_unstable", {
enumerable: true,
get: function() {
return renderMenuItemSwitch_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderMenuItemSwitch_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
children: [
state.icon && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.icon, {}),
state.content && /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.content, {
children: [
state.content.children,
state.subText && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.subText, {})
]
}),
state.secondaryContent && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.secondaryContent, {}),
state.switchIndicator && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.switchIndicator, {})
]
});
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/MenuItemSwitch/renderMenuItemSwitch.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { MenuItemSwitchSlots, MenuItemSwitchState } from './MenuItemSwitch.types';\n\n/**\n * Function that renders the final JSX of the component\n */\nexport const renderMenuItemSwitch_unstable = (state: MenuItemSwitchState): JSXElement => {\n assertSlots<MenuItemSwitchSlots>(state);\n\n return (\n <state.root>\n {state.icon && <state.icon />}\n {state.content && (\n <state.content>\n {state.content.children}\n {state.subText && <state.subText />}\n </state.content>\n )}\n {state.secondaryContent && <state.secondaryContent />}\n {state.switchIndicator && <state.switchIndicator />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderMenuItemSwitch_unstable","state","root","icon","content","children","subText","secondaryContent","switchIndicator"],"mappings":";;;;+BASaC;;;;;;4BARb,iCAAiD;gCACrB,4BAA4B;AAOjD,sCAAsC,CAACC;QAC5CF,2BAAAA,EAAiCE;IAEjC,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAME,IAAI,IAAA,WAAA,OAAI,eAAA,EAACF,MAAME,IAAI,EAAA,CAAA;YACzBF,MAAMG,OAAO,IAAA,WAAA,OACZ,gBAAA,EAACH,MAAMG,OAAO,EAAA;;oBACXH,MAAMG,OAAO,CAACC,QAAQ;oBACtBJ,MAAMK,OAAO,IAAA,WAAA,OAAI,eAAA,EAACL,MAAMK,OAAO,EAAA,CAAA;;;YAGnCL,MAAMM,gBAAgB,IAAA,WAAA,OAAI,eAAA,EAACN,MAAMM,gBAAgB,EAAA,CAAA;YACjDN,MAAMO,eAAe,IAAA,WAAA,OAAI,eAAA,EAACP,MAAMO,eAAe,EAAA,CAAA;;;AAGtD,EAAE"}

View File

@@ -0,0 +1,52 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
useMenuItemSwitchBase_unstable: function() {
return useMenuItemSwitchBase_unstable;
},
useMenuItemSwitch_unstable: function() {
return useMenuItemSwitch_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _useMenuItemCheckbox = require("../MenuItemCheckbox/useMenuItemCheckbox");
const _reacticons = require("@fluentui/react-icons");
const _useMenuItemSwitchStylesstyles = require("./useMenuItemSwitchStyles.styles");
const useMenuItemSwitch_unstable = (props, ref)=>{
const state = useMenuItemSwitchBase_unstable(props, ref);
// Set default icon for switch indicator
if (state.switchIndicator) {
var _state_switchIndicator;
var _children;
(_children = (_state_switchIndicator = state.switchIndicator).children) !== null && _children !== void 0 ? _children : _state_switchIndicator.children = /*#__PURE__*/ _react.createElement(_reacticons.CircleFilled, {
className: _useMenuItemSwitchStylesstyles.circleFilledClassName
});
}
return state;
};
const useMenuItemSwitchBase_unstable = (props, ref)=>{
const baseState = (0, _useMenuItemCheckbox.useMenuItemCheckboxBase_unstable)(props, ref);
return {
...baseState,
switchIndicator: _reactutilities.slot.optional(props.switchIndicator, {
renderByDefault: true,
elementType: 'span'
}),
components: {
// eslint-disable-next-line @typescript-eslint/no-deprecated
...baseState.components,
switchIndicator: 'span'
}
};
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/MenuItemSwitch/useMenuItemSwitch.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport type { MenuItemSwitchProps, MenuItemSwitchState } from './MenuItemSwitch.types';\nimport { useMenuItemCheckboxBase_unstable } from '../MenuItemCheckbox/useMenuItemCheckbox';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { circleFilledClassName } from './useMenuItemSwitchStyles.styles';\n\n/**\n * Create the state required to render MenuItemSwitch.\n *\n * The returned state can be modified with hooks such as useMenuItemSwitchStyles_unstable,\n * before being passed to renderMenuItemSwitch_unstable.\n *\n * @param props - props from this instance of MenuItemSwitch\n * @param ref - reference to root HTMLDivElement of MenuItemSwitch\n */\nexport const useMenuItemSwitch_unstable = (\n props: MenuItemSwitchProps,\n ref: React.Ref<HTMLDivElement>,\n): MenuItemSwitchState => {\n const state = useMenuItemSwitchBase_unstable(props, ref);\n\n // Set default icon for switch indicator\n if (state.switchIndicator) {\n state.switchIndicator.children ??= <CircleFilled className={circleFilledClassName} />;\n }\n\n return state;\n};\n\n/**\n * Base hook for MenuItemSwitch component, produces state required to render the component.\n * It doesn't set any design-related props specific to MenuItemSwitch.\n *\n * @internal\n * @param props - props from this instance of MenuItemSwitch\n * @param ref - reference to root HTMLDivElement of MenuItemSwitch\n */\nexport const useMenuItemSwitchBase_unstable = (\n props: MenuItemSwitchProps,\n ref: React.Ref<HTMLDivElement>,\n): MenuItemSwitchState => {\n const baseState = useMenuItemCheckboxBase_unstable(props, ref);\n return {\n ...baseState,\n switchIndicator: slot.optional(props.switchIndicator, {\n renderByDefault: true,\n elementType: 'span',\n }),\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...baseState.components,\n switchIndicator: 'span',\n },\n };\n};\n"],"names":["React","slot","useMenuItemCheckboxBase_unstable","CircleFilled","circleFilledClassName","useMenuItemSwitch_unstable","props","ref","state","useMenuItemSwitchBase_unstable","switchIndicator","children","className","baseState","optional","renderByDefault","elementType","components"],"mappings":"AAAA;;;;;;;;;;;;IAwCaS,8BAAAA;;;8BAtBAJ;;;;;iEAhBU,QAAQ;gCACV,4BAA4B;qCAEA,0CAA0C;4BAC9D,wBAAwB;+CACf,mCAAmC;AAWlE,MAAMA,6BAA6B,CACxCC,OACAC;IAEA,MAAMC,QAAQC,+BAA+BH,OAAOC;IAEpD,wCAAwC;IACxC,IAAIC,MAAME,eAAe,EAAE;YACzBF;;QAAAA,CAAAA,YAAAA,CAAAA,yBAAAA,MAAME,eAAAA,AAAe,EAACC,QAAAA,MAAAA,QAAAA,cAAAA,KAAAA,IAAAA,YAAtBH,uBAAsBG,QAAAA,GAAAA,WAAAA,GAAa,OAAA,aAAA,CAACR,wBAAAA,EAAAA;YAAaS,WAAWR,oDAAAA;;IAC9D;IAEA,OAAOI;AACT,EAAE;AAUK,uCAAuC,CAC5CF,OACAC;IAEA,MAAMM,gBAAYX,qDAAAA,EAAiCI,OAAOC;IAC1D,OAAO;QACL,GAAGM,SAAS;QACZH,iBAAiBT,oBAAAA,CAAKa,QAAQ,CAACR,MAAMI,eAAe,EAAE;YACpDK,iBAAiB;YACjBC,aAAa;QACf;QACAC,YAAY;YACV,4DAA4D;YAC5D,GAAGJ,UAAUI,UAAU;YACvBP,iBAAiB;QACnB;IACF;AACF,EAAE"}

View File

@@ -0,0 +1,172 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
circleFilledClassName: function() {
return circleFilledClassName;
},
menuItemSwitchClassNames: function() {
return menuItemSwitchClassNames;
},
useMenuItemSwitchStyles_unstable: function() {
return useMenuItemSwitchStyles_unstable;
}
});
const _react = require("@griffel/react");
const _useMenuItemStylesstyles = require("../MenuItem/useMenuItemStyles.styles");
const menuItemSwitchClassNames = {
root: 'fui-MenuItemSwitch',
icon: 'fui-MenuItemSwitch__icon',
content: 'fui-MenuItemSwitch__content',
secondaryContent: 'fui-MenuItemSwitch__secondaryContent',
switchIndicator: 'fui-MenuItemSwitch__switchIndicator',
subText: 'fui-MenuItemSwitch__subText'
};
const circleFilledClassName = 'fui-MenuItemSwitch__switchIndicator__circleFilled';
// Thumb and track sizes used by the component.
const spaceBetweenThumbAndTrack = 2;
const trackHeight = 20;
const trackWidth = 40;
const thumbSize = trackHeight - spaceBetweenThumbAndTrack;
const useSwitchIndicatorBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r1x31n8g", "rsmcm5v", {
r: [
".r1x31n8g{border-radius:var(--borderRadiusCircular);border:var(--strokeWidthThin) solid var(--colorNeutralStrokeAccessible);line-height:0;box-sizing:border-box;fill:currentColor;flex-shrink:0;font-size:18px;height:20px;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;margin-right:var(--spacingHorizontalXS);color:var(--colorNeutralStrokeAccessible);}",
".r1x31n8g:hover{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}",
".r1x31n8g:hover:active{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}",
".r1x31n8g .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}",
".rsmcm5v{border-radius:var(--borderRadiusCircular);border:var(--strokeWidthThin) solid var(--colorNeutralStrokeAccessible);line-height:0;box-sizing:border-box;fill:currentColor;flex-shrink:0;font-size:18px;height:20px;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;margin-left:var(--spacingHorizontalXS);color:var(--colorNeutralStrokeAccessible);}",
".rsmcm5v:hover{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}",
".rsmcm5v:hover:active{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}",
".rsmcm5v .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}"
],
s: [
"@media screen and (prefers-reduced-motion: reduce){.r1x31n8g{transition-duration:0.01ms;}}",
"@media screen and (prefers-reduced-motion: reduce){.r1x31n8g .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:0.01ms;}}",
"@media screen and (prefers-reduced-motion: reduce){.rsmcm5v{transition-duration:0.01ms;}}",
"@media screen and (prefers-reduced-motion: reduce){.rsmcm5v .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:0.01ms;}}"
]
});
const useSwitchIndicatorStyles = /*#__PURE__*/ (0, _react.__styles)({
checked: {
G4r02d: [
"fdca5i2",
"fk0rr1z"
],
De3pzq: "ftywsgz",
sj55zd: "fqpbvvt",
g2u3we: "fghlq4f",
h3c5rm: [
"f1gn591s",
"fjscplz"
],
B9xav0g: "fb073pr",
zhjwy3: [
"fjscplz",
"f1gn591s"
],
Bi91k9c: "fz46y8r",
Jwef8y: "f1kjrvvj",
Bgoe8wy: "fpa59ij",
Bwzppfd: [
"f1rhln42",
"f1l1ogpg"
],
oetu4i: "fz67qlh",
gg5e9n: [
"f1l1ogpg",
"f1rhln42"
],
B2d53fq: "frlnr8d",
iro3zm: "fle2s0s",
b661bw: "f1j8ziw4",
Bk6r4ia: [
"f1xzu9i0",
"f1jlpvxk"
],
B9zn80p: "f1i1ccxp",
Bpld233: [
"f1jlpvxk",
"f1xzu9i0"
]
}
}, {
d: [
".fdca5i2 .fui-MenuItemSwitch__switchIndicator__circleFilled{transform:translateX(20px);}",
".fk0rr1z .fui-MenuItemSwitch__switchIndicator__circleFilled{transform:translateX(-20px);}",
".ftywsgz{background-color:var(--colorCompoundBrandBackground);}",
".fqpbvvt{color:var(--colorNeutralForegroundInverted);}",
".fghlq4f{border-top-color:var(--colorTransparentStroke);}",
".f1gn591s{border-right-color:var(--colorTransparentStroke);}",
".fjscplz{border-left-color:var(--colorTransparentStroke);}",
".fb073pr{border-bottom-color:var(--colorTransparentStroke);}"
],
h: [
".fz46y8r:hover{color:var(--colorNeutralForegroundInverted);}",
".f1kjrvvj:hover{background-color:var(--colorCompoundBrandBackgroundHover);}",
".fpa59ij:hover{border-top-color:var(--colorTransparentStrokeInteractive);}",
".f1rhln42:hover{border-right-color:var(--colorTransparentStrokeInteractive);}",
".f1l1ogpg:hover{border-left-color:var(--colorTransparentStrokeInteractive);}",
".fz67qlh:hover{border-bottom-color:var(--colorTransparentStrokeInteractive);}",
".frlnr8d:hover:active{color:var(--colorNeutralForegroundInverted);}",
".fle2s0s:hover:active{background-color:var(--colorCompoundBrandBackgroundPressed);}",
".f1j8ziw4:hover:active{border-top-color:var(--colorTransparentStrokeInteractive);}",
".f1xzu9i0:hover:active{border-right-color:var(--colorTransparentStrokeInteractive);}",
".f1jlpvxk:hover:active{border-left-color:var(--colorTransparentStrokeInteractive);}",
".f1i1ccxp:hover:active{border-bottom-color:var(--colorTransparentStrokeInteractive);}"
]
});
const useMultilineStyles = /*#__PURE__*/ (0, _react.__styles)({
"switch": {
qb2dma: "f7nlbp4"
}
}, {
d: [
".f7nlbp4{align-self:center;}"
]
});
const useMenuItemSwitchStyles_unstable = (state)=>{
'use no memo';
const { checked, subText } = state;
const multiline = !!subText;
const switchIndicatorStyles = useSwitchIndicatorStyles();
const switchIndicatorBaseStyles = useSwitchIndicatorBaseClassName();
const multilineStyles = useMultilineStyles();
state.root.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.root, state.root.className);
if (state.content) {
state.content.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.content, state.content.className);
}
if (state.secondaryContent) {
state.secondaryContent.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.secondaryContent, state.secondaryContent.className);
}
if (state.icon) {
state.icon.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.icon, state.icon.className);
}
if (state.subText) {
state.subText.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.subText, state.subText.className);
}
if (state.switchIndicator) {
state.switchIndicator.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, state.switchIndicator.className, multiline && multilineStyles.switch);
}
(0, _useMenuItemStylesstyles.useMenuItemStyles_unstable)({
...state,
components: {
// eslint-disable-next-line @typescript-eslint/no-deprecated
...state.components,
checkmark: 'span',
submenuIndicator: 'span'
},
checkmark: undefined,
submenuIndicator: undefined,
hasSubmenu: false,
persistOnClick: true
});
return state;
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,137 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
circleFilledClassName: function() {
return circleFilledClassName;
},
menuItemSwitchClassNames: function() {
return menuItemSwitchClassNames;
},
useMenuItemSwitchStyles_unstable: function() {
return useMenuItemSwitchStyles_unstable;
}
});
const _react = require("@griffel/react");
const _reacttheme = require("@fluentui/react-theme");
const _useMenuItemStylesstyles = require("../MenuItem/useMenuItemStyles.styles");
const menuItemSwitchClassNames = {
root: 'fui-MenuItemSwitch',
icon: 'fui-MenuItemSwitch__icon',
content: 'fui-MenuItemSwitch__content',
secondaryContent: 'fui-MenuItemSwitch__secondaryContent',
switchIndicator: 'fui-MenuItemSwitch__switchIndicator',
subText: 'fui-MenuItemSwitch__subText'
};
const circleFilledClassName = 'fui-MenuItemSwitch__switchIndicator__circleFilled';
// Thumb and track sizes used by the component.
const spaceBetweenThumbAndTrack = 2;
const trackHeight = 20;
const trackWidth = 40;
const thumbSize = trackHeight - spaceBetweenThumbAndTrack;
const useSwitchIndicatorBaseClassName = (0, _react.makeResetStyles)({
borderRadius: _reacttheme.tokens.borderRadiusCircular,
border: `${_reacttheme.tokens.strokeWidthThin} solid ${_reacttheme.tokens.colorNeutralStrokeAccessible}`,
lineHeight: 0,
boxSizing: 'border-box',
fill: 'currentColor',
flexShrink: 0,
fontSize: `${thumbSize}px`,
height: `${trackHeight}px`,
transitionDuration: _reacttheme.tokens.durationNormal,
transitionTimingFunction: _reacttheme.tokens.curveEasyEase,
transitionProperty: 'background, border, color',
width: `${trackWidth}px`,
marginRight: _reacttheme.tokens.spacingHorizontalXS,
'@media screen and (prefers-reduced-motion: reduce)': {
transitionDuration: '0.01ms'
},
color: _reacttheme.tokens.colorNeutralStrokeAccessible,
':hover': {
color: _reacttheme.tokens.colorNeutralStrokeAccessibleHover,
borderColor: _reacttheme.tokens.colorNeutralStrokeAccessibleHover
},
':hover:active': {
color: _reacttheme.tokens.colorNeutralStrokeAccessiblePressed,
borderColor: _reacttheme.tokens.colorNeutralStrokeAccessiblePressed
},
[`& .${circleFilledClassName}`]: {
transitionDuration: _reacttheme.tokens.durationNormal,
transitionTimingFunction: _reacttheme.tokens.curveEasyEase,
transitionProperty: 'transform',
'@media screen and (prefers-reduced-motion: reduce)': {
transitionDuration: '0.01ms'
}
}
});
const useSwitchIndicatorStyles = (0, _react.makeStyles)({
checked: {
[`& .${circleFilledClassName}`]: {
transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`
},
backgroundColor: _reacttheme.tokens.colorCompoundBrandBackground,
color: _reacttheme.tokens.colorNeutralForegroundInverted,
..._react.shorthands.borderColor(_reacttheme.tokens.colorTransparentStroke),
':hover': {
color: _reacttheme.tokens.colorNeutralForegroundInverted,
backgroundColor: _reacttheme.tokens.colorCompoundBrandBackgroundHover,
..._react.shorthands.borderColor(_reacttheme.tokens.colorTransparentStrokeInteractive)
},
':hover:active': {
color: _reacttheme.tokens.colorNeutralForegroundInverted,
backgroundColor: _reacttheme.tokens.colorCompoundBrandBackgroundPressed,
..._react.shorthands.borderColor(_reacttheme.tokens.colorTransparentStrokeInteractive)
}
}
});
const useMultilineStyles = (0, _react.makeStyles)({
switch: {
alignSelf: 'center'
}
});
const useMenuItemSwitchStyles_unstable = (state)=>{
'use no memo';
const { checked, subText } = state;
const multiline = !!subText;
const switchIndicatorStyles = useSwitchIndicatorStyles();
const switchIndicatorBaseStyles = useSwitchIndicatorBaseClassName();
const multilineStyles = useMultilineStyles();
state.root.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.root, state.root.className);
if (state.content) {
state.content.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.content, state.content.className);
}
if (state.secondaryContent) {
state.secondaryContent.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.secondaryContent, state.secondaryContent.className);
}
if (state.icon) {
state.icon.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.icon, state.icon.className);
}
if (state.subText) {
state.subText.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.subText, state.subText.className);
}
if (state.switchIndicator) {
state.switchIndicator.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, state.switchIndicator.className, multiline && multilineStyles.switch);
}
(0, _useMenuItemStylesstyles.useMenuItemStyles_unstable)({
...state,
components: {
// eslint-disable-next-line @typescript-eslint/no-deprecated
...state.components,
checkmark: 'span',
submenuIndicator: 'span'
},
checkmark: undefined,
submenuIndicator: undefined,
hasSubmenu: false,
persistOnClick: true
});
return state;
};

File diff suppressed because one or more lines are too long