@fluentui/react-switch 9.74.7-experimental.cli-api.20261006-ccaa611d58.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +38 -12
  2. package/README.md +8 -0
  3. package/lib/components/Switch/Switch.js.map +1 -1
  4. package/lib/components/Switch/Switch.module.css +290 -0
  5. package/lib/components/Switch/Switch.types.js.map +1 -1
  6. package/lib/components/Switch/index.js.map +1 -1
  7. package/lib/components/Switch/renderSwitch.js +2 -2
  8. package/lib/components/Switch/renderSwitch.js.map +1 -1
  9. package/lib/components/Switch/useSwitch.js +1 -2
  10. package/lib/components/Switch/useSwitch.js.map +1 -1
  11. package/lib/components/Switch/useSwitchStyles.styles.css.js +18 -0
  12. package/lib/components/Switch/useSwitchStyles.styles.css.js.map +1 -0
  13. package/lib/components/Switch/useSwitchStyles.styles.raw.css.js +18 -0
  14. package/lib/components/Switch/useSwitchStyles.styles.raw.css.js.map +1 -0
  15. package/lib/components/Switch/useSwitchStyles.styles.raw.js.map +1 -1
  16. package/lib-commonjs/Switch.cjs +8 -8
  17. package/lib-commonjs/components/Switch/Switch.cjs.map +1 -1
  18. package/lib-commonjs/components/Switch/Switch.module.css +290 -0
  19. package/lib-commonjs/components/Switch/Switch.types.cjs.map +1 -1
  20. package/lib-commonjs/components/Switch/index.cjs +8 -8
  21. package/lib-commonjs/components/Switch/index.cjs.map +1 -1
  22. package/lib-commonjs/components/Switch/renderSwitch.cjs.map +1 -1
  23. package/lib-commonjs/components/Switch/useSwitch.cjs +4 -5
  24. package/lib-commonjs/components/Switch/useSwitch.cjs.map +1 -1
  25. package/lib-commonjs/components/Switch/useSwitchStyles.styles.cjs +4 -4
  26. package/lib-commonjs/components/Switch/useSwitchStyles.styles.cjs.map +1 -1
  27. package/lib-commonjs/components/Switch/useSwitchStyles.styles.css.cjs +40 -0
  28. package/lib-commonjs/components/Switch/useSwitchStyles.styles.css.cjs.map +1 -0
  29. package/lib-commonjs/components/Switch/useSwitchStyles.styles.raw.cjs +4 -4
  30. package/lib-commonjs/components/Switch/useSwitchStyles.styles.raw.cjs.map +1 -1
  31. package/lib-commonjs/components/Switch/useSwitchStyles.styles.raw.css.cjs +40 -0
  32. package/lib-commonjs/components/Switch/useSwitchStyles.styles.raw.css.cjs.map +1 -0
  33. package/lib-commonjs/index.cjs +8 -8
  34. package/package.json +15 -15
  35. package/dist/metadata/api/api-root.json +0 -1
  36. package/dist/metadata/index.json +0 -1
@@ -6,17 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  function _export(target, all) {
7
7
  for(var name in all)Object.defineProperty(target, name, {
8
8
  enumerable: true,
9
- get: all[name]
9
+ get: Object.getOwnPropertyDescriptor(all, name).get
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- switchClassName: function() {
13
+ get switchClassName () {
14
14
  return switchClassName;
15
15
  },
16
- switchClassNames: function() {
16
+ get switchClassNames () {
17
17
  return switchClassNames;
18
18
  },
19
- useSwitchStyles_unstable: function() {
19
+ get useSwitchStyles_unstable () {
20
20
  return useSwitchStyles_unstable;
21
21
  }
22
22
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Switch/useSwitchStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\n// Medium size dimensions\nconst trackHeightMedium = 20;\nconst trackWidthMedium = 40;\nconst thumbSizeMedium = trackHeightMedium - spaceBetweenThumbAndTrack;\n// Small size dimensions (from design mockup)\nconst trackHeightSmall = 16;\nconst trackWidthSmall = 32;\nconst thumbSizeSmall = trackHeightSmall - spaceBetweenThumbAndTrack;\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: '1px solid',\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSizeMedium}px`,\n height: `${trackHeightMedium}px`,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidthMedium}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '@media (forced-colors: active)': {\n color: 'CanvasText',\n '> i': {\n forcedColorAdjust: 'none',\n },\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0,\n },\n sizeSmall: {\n fontSize: `${thumbSizeSmall}px`,\n height: `${trackHeightSmall}px`,\n width: `${trackWidthSmall}px`,\n },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the switch.\n width: `calc(${trackWidthMedium}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidthMedium - thumbSizeMedium - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled, &[aria-disabled=\"true\"]': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked):not([aria-disabled=\"true\"])': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Enabled and checked\n ':enabled:checked:not([aria-disabled=\"true\"])': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorTransparentStroke,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked), &[aria-disabled=\"true\"]:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n // Disabled and checked\n ':disabled:checked, &[aria-disabled=\"true\"]:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled,\n },\n },\n\n '@media (forced-colors: active)': {\n ':disabled, &[aria-disabled=\"true\"]': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText',\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\n },\n ':hover': {\n color: 'CanvasText',\n },\n ':hover:active': {\n color: 'CanvasText',\n },\n ':enabled:checked:not([aria-disabled=\"true\"])': {\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n top: 0,\n },\n after: {\n left: 0,\n top: 0,\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeightMedium}px + ${tokens.spacingVerticalS})`,\n width: '100%',\n },\n sizeSmall: {\n width: `calc(${trackWidthSmall}px + 2 * ${tokens.spacingHorizontalS})`,\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidthSmall - thumbSizeSmall - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n },\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n cursor: 'pointer',\n\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeightMedium}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeightMedium}px - ${tokens.lineHeightBase300}) / 2)`,\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n },\n sizeSmall: {\n fontSize: tokens.fontSizeBase200,\n lineHeight: tokens.lineHeightBase200,\n marginBottom: `calc((${trackHeightSmall}px - ${tokens.lineHeightBase200}) / 2)`,\n marginTop: `calc((${trackHeightSmall}px - ${tokens.lineHeightBase200}) / 2)`,\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%',\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n\n const { label, labelPosition, size } = state;\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootBaseClassName,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorBaseClassName,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n size === 'small' && indicatorStyles.sizeSmall,\n state.indicator.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputBaseClassName,\n label && inputStyles[labelPosition],\n size === 'small' && inputStyles.sizeSmall,\n state.input.className,\n );\n\n if (state.label) {\n // eslint-disable-next-line react-hooks/immutability\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n size === 'small' && labelStyles.sizeSmall,\n state.label.className,\n );\n }\n\n return state;\n};\n"],"names":["createFocusOutlineStyle","tokens","makeResetStyles","makeStyles","mergeClasses","switchClassNames","root","indicator","input","label","switchClassName","spaceBetweenThumbAndTrack","trackHeightMedium","trackWidthMedium","thumbSizeMedium","trackHeightSmall","trackWidthSmall","thumbSizeSmall","useRootBaseClassName","alignItems","boxSizing","display","position","style","selector","useRootStyles","vertical","flexDirection","useIndicatorBaseClassName","borderRadius","borderRadiusCircular","border","lineHeight","fill","flexShrink","fontSize","height","margin","spacingVerticalS","spacingHorizontalS","pointerEvents","transitionDuration","durationNormal","transitionTimingFunction","curveEasyEase","transitionProperty","width","color","forcedColorAdjust","useIndicatorStyles","labelAbove","marginTop","sizeSmall","useInputBaseClassName","cursor","opacity","transform","colorNeutralForegroundDisabled","colorNeutralStrokeAccessible","borderColor","colorNeutralForeground1","colorNeutralStrokeAccessibleHover","colorNeutralStrokeAccessiblePressed","backgroundColor","colorCompoundBrandBackground","colorNeutralForegroundInverted","colorTransparentStroke","colorCompoundBrandBackgroundHover","colorTransparentStrokeInteractive","colorCompoundBrandBackgroundPressed","colorNeutralStrokeDisabled","colorNeutralBackgroundDisabled","colorTransparentStrokeDisabled","useInputStyles","before","right","top","after","left","above","bottom","useLabelStyles","base","marginBottom","lineHeightBase300","padding","fontSizeBase200","lineHeightBase200","paddingTop","spacingVerticalXS","paddingBottom","paddingLeft","spacingHorizontalXS","paddingRight","useSwitchStyles_unstable","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","size","className"],"mappings":"AAAA;;;;;;;;;;;;IAkBaU,eAAAA;;;oB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MAAMC,oBAAoB9E;IAC1B,MAAM+E,aAAaxE;IACnB,MAAMyE,yBAAyBtE;IAC/B,MAAMuE,kBAAkBlD;IACxB,MAAMmD,qBAAqB/C;IAC3B,MAAMgD,cAAc5B;IACpB,MAAM6B,cAAcrB;IAEpB,MAAM,EAAExE,KAAK,EAAE8F,aAAa,EAAEC,IAAI,EAAE,GAAGT;IAEvC,oDAAoD;IACpDA,MAAMzF,IAAI,CAACmG,SAAS,GAAGrG,uBAAAA,EACrBC,iBAAiBC,IAAI,EACrB0F,mBACAO,kBAAkB,WAAWN,WAAWvE,QAAQ,EAChDqE,MAAMzF,IAAI,CAACmG,SAAS;IAGtB,oDAAoD;IACpDV,MAAMxF,SAAS,CAACkG,SAAS,OAAGrG,mBAAAA,EAC1BC,iBAAiBE,SAAS,EAC1B2F,wBACAzF,SAAS8F,kBAAkB,WAAWJ,gBAAgBjD,UAAU,EAChEsD,SAAS,WAAWL,gBAAgB/C,SAAS,EAC7C2C,MAAMxF,SAAS,CAACkG,SAAS;IAG3B,oDAAoD;IACpDV,MAAMvF,KAAK,CAACiG,SAAS,OAAGrG,mBAAAA,EACtBC,iBAAiBG,KAAK,EACtB4F,oBACA3F,SAAS4F,WAAW,CAACE,cAAc,EACnCC,SAAS,WAAWH,YAAYjD,SAAS,EACzC2C,MAAMvF,KAAK,CAACiG,SAAS;IAGvB,IAAIV,MAAMtF,KAAK,EAAE;QACf,oDAAoD;QACpDsF,MAAMtF,KAAK,CAACgG,SAAS,OAAGrG,mBAAAA,EACtBC,iBAAiBI,KAAK,EACtB6F,YAAYpB,IAAI,EAChBoB,WAAW,CAACC,cAAc,EAC1BC,SAAS,WAAWF,YAAYlD,SAAS,EACzC2C,MAAMtF,KAAK,CAACgG,SAAS;IAEzB;IAEA,OAAOV;AACT,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/Switch/useSwitchStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\n// Medium size dimensions\nconst trackHeightMedium = 20;\nconst trackWidthMedium = 40;\nconst thumbSizeMedium = trackHeightMedium - spaceBetweenThumbAndTrack;\n// Small size dimensions (from design mockup)\nconst trackHeightSmall = 16;\nconst trackWidthSmall = 32;\nconst thumbSizeSmall = trackHeightSmall - spaceBetweenThumbAndTrack;\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: '1px solid',\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSizeMedium}px`,\n height: `${trackHeightMedium}px`,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidthMedium}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '@media (forced-colors: active)': {\n color: 'CanvasText',\n '> i': {\n forcedColorAdjust: 'none',\n },\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0,\n },\n sizeSmall: {\n fontSize: `${thumbSizeSmall}px`,\n height: `${trackHeightSmall}px`,\n width: `${trackWidthSmall}px`,\n },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the switch.\n width: `calc(${trackWidthMedium}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidthMedium - thumbSizeMedium - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled, &[aria-disabled=\"true\"]': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked):not([aria-disabled=\"true\"])': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Enabled and checked\n ':enabled:checked:not([aria-disabled=\"true\"])': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorTransparentStroke,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked), &[aria-disabled=\"true\"]:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n // Disabled and checked\n ':disabled:checked, &[aria-disabled=\"true\"]:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled,\n },\n },\n\n '@media (forced-colors: active)': {\n ':disabled, &[aria-disabled=\"true\"]': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText',\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\n },\n ':hover': {\n color: 'CanvasText',\n },\n ':hover:active': {\n color: 'CanvasText',\n },\n ':enabled:checked:not([aria-disabled=\"true\"])': {\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n top: 0,\n },\n after: {\n left: 0,\n top: 0,\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeightMedium}px + ${tokens.spacingVerticalS})`,\n width: '100%',\n },\n sizeSmall: {\n width: `calc(${trackWidthSmall}px + 2 * ${tokens.spacingHorizontalS})`,\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidthSmall - thumbSizeSmall - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n },\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n cursor: 'pointer',\n\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeightMedium}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeightMedium}px - ${tokens.lineHeightBase300}) / 2)`,\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n },\n sizeSmall: {\n fontSize: tokens.fontSizeBase200,\n lineHeight: tokens.lineHeightBase200,\n marginBottom: `calc((${trackHeightSmall}px - ${tokens.lineHeightBase200}) / 2)`,\n marginTop: `calc((${trackHeightSmall}px - ${tokens.lineHeightBase200}) / 2)`,\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%',\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n\n const { label, labelPosition, size } = state;\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootBaseClassName,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorBaseClassName,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n size === 'small' && indicatorStyles.sizeSmall,\n state.indicator.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputBaseClassName,\n label && inputStyles[labelPosition],\n size === 'small' && inputStyles.sizeSmall,\n state.input.className,\n );\n\n if (state.label) {\n // eslint-disable-next-line react-hooks/immutability\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n size === 'small' && labelStyles.sizeSmall,\n state.label.className,\n );\n }\n\n return state;\n};\n"],"names":["createFocusOutlineStyle","tokens","makeResetStyles","makeStyles","mergeClasses","switchClassNames","root","indicator","input","label","switchClassName","spaceBetweenThumbAndTrack","trackHeightMedium","trackWidthMedium","thumbSizeMedium","trackHeightSmall","trackWidthSmall","thumbSizeSmall","useRootBaseClassName","alignItems","boxSizing","display","position","style","selector","useRootStyles","vertical","flexDirection","useIndicatorBaseClassName","borderRadius","borderRadiusCircular","border","lineHeight","fill","flexShrink","fontSize","height","margin","spacingVerticalS","spacingHorizontalS","pointerEvents","transitionDuration","durationNormal","transitionTimingFunction","curveEasyEase","transitionProperty","width","color","forcedColorAdjust","useIndicatorStyles","labelAbove","marginTop","sizeSmall","useInputBaseClassName","cursor","opacity","transform","colorNeutralForegroundDisabled","colorNeutralStrokeAccessible","borderColor","colorNeutralForeground1","colorNeutralStrokeAccessibleHover","colorNeutralStrokeAccessiblePressed","backgroundColor","colorCompoundBrandBackground","colorNeutralForegroundInverted","colorTransparentStroke","colorCompoundBrandBackgroundHover","colorTransparentStrokeInteractive","colorCompoundBrandBackgroundPressed","colorNeutralStrokeDisabled","colorNeutralBackgroundDisabled","colorTransparentStrokeDisabled","useInputStyles","before","right","top","after","left","above","bottom","useLabelStyles","base","marginBottom","lineHeightBase300","padding","fontSizeBase200","lineHeightBase200","paddingTop","spacingVerticalXS","paddingBottom","paddingLeft","spacingHorizontalXS","paddingRight","useSwitchStyles_unstable","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","size","className"],"mappings":"AAAA;;;;;;;;;;;;QAkBaU;;;QAVAL;;;;eA2RAyF;;;8BAjS2B,0BAA0B;4BAC3C,wBAAwB;uBACW,iBAAiB;AAIpE,yBAAsD;IAC3DxF,MAAM;IACNC,WAAW;IACXC,OAAO;IACPC,OAAO;AACT,EAAE;AAKK,wBAAwBJ,iBAAiBC,IAAI,CAAC;AAErD,+CAA+C;AAC/C,MAAMK,4BAA4B;AAClC,yBAAyB;AACzB,MAAMC,oBAAoB;AAC1B,MAAMC,mBAAmB;AACzB,MAAMC,kBAAkBF,oBAAoBD;AAC5C,6CAA6C;AAC7C,MAAMI,mBAAmB;AACzB,MAAMC,kBAAkB;AACxB,MAAMC,iBAAiBF,mBAAmBJ;AAE1C,MAAMO,2BAAuBhB,sBAAAA,EAAgB;IAC3CiB,YAAY;IACZC,WAAW;IACXC,SAAS;IACTC,UAAU;IAEV,OAAGtB,qCAAAA,EAAwB;QAAEuB,OAAO,CAAC;QAAGC,UAAU;IAAe,EAAE;AACrE;AAEA,MAAMC,oBAAgBtB,iBAAAA,EAAW;IAC/BuB,UAAU;QACRC,eAAe;IACjB;AACF;AAEA,MAAMC,gCAA4B1B,sBAAAA,EAAgB;IAChD2B,cAAc5B,kBAAAA,CAAO6B,oBAAoB;IACzCC,QAAQ;IACRC,YAAY;IACZZ,WAAW;IACXa,MAAM;IACNC,YAAY;IACZC,UAAU,GAAGrB,gBAAgB,EAAE,CAAC;IAChCsB,QAAQ,GAAGxB,kBAAkB,EAAE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F,KAAK,CAACgG,SAAS,OAAGrG,mBAAAA,EACtBC,iBAAiBI,KAAK,EACtB6F,YAAYpB,IAAI,EAChBoB,WAAW,CAACC,cAAc,EAC1BC,SAAS,WAAWF,YAAYlD,SAAS,EACzC2C,MAAMtF,KAAK,CAACgG,SAAS;IAEzB;IAEA,OAAOV;AACT,EAAE"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get switchClassName () {
13
+ return switchClassName;
14
+ },
15
+ get switchClassNames () {
16
+ return switchClassNames;
17
+ },
18
+ get useSwitchStyles_unstable () {
19
+ return useSwitchStyles_unstable;
20
+ }
21
+ });
22
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
23
+ const _clsx = require("clsx");
24
+ const _Switchmodulecss = /*#__PURE__*/ _interop_require_default._(require("./Switch.module.css"));
25
+ const switchClassNames = {
26
+ root: 'fui-Switch',
27
+ indicator: 'fui-Switch__indicator',
28
+ input: 'fui-Switch__input',
29
+ label: 'fui-Switch__label'
30
+ };
31
+ const switchClassName = switchClassNames.root;
32
+ const useSwitchStyles_unstable = (state)=>{
33
+ state.root.className = (0, _clsx.clsx)(switchClassNames.root, _Switchmodulecss.default.root, _Switchmodulecss.default[state.labelPosition], _Switchmodulecss.default[state.size], state.label && _Switchmodulecss.default.withLabel, state.root.className);
34
+ state.indicator.className = (0, _clsx.clsx)(switchClassNames.indicator, _Switchmodulecss.default.indicator, state.indicator.className);
35
+ state.input.className = (0, _clsx.clsx)(switchClassNames.input, _Switchmodulecss.default.input, state.input.className);
36
+ if (state.label) {
37
+ state.label.className = (0, _clsx.clsx)(switchClassNames.label, _Switchmodulecss.default.label, state.label.className);
38
+ }
39
+ return state;
40
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Switch/useSwitchStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchState, SwitchSlots } from './Switch.types';\nimport styles from './Switch.module.css';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/** @deprecated Use `switchClassNames.root` instead. */\nexport const switchClassName = switchClassNames.root;\n\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n state.root.className = clsx(\n switchClassNames.root,\n styles.root,\n styles[state.labelPosition],\n styles[state.size],\n state.label && styles.withLabel,\n state.root.className,\n );\n state.indicator.className = clsx(switchClassNames.indicator, styles.indicator, state.indicator.className);\n state.input.className = clsx(switchClassNames.input, styles.input, state.input.className);\n if (state.label) {\n state.label.className = clsx(switchClassNames.label, styles.label, state.label.className);\n }\n return state;\n};\n"],"names":["clsx","styles","switchClassNames","root","indicator","input","label","switchClassName","useSwitchStyles_unstable","state","className","labelPosition","size","withLabel"],"mappings":";;;;;;;;;;;QAaaO;;;QARAL;;;QAUAM;;;;;sBAfQ,OAAO;0EAGT,sBAAsB;AAElC,yBAAsD;IAC3DL,MAAM;IACNC,WAAW;IACXC,OAAO;IACPC,OAAO;AACT,EAAE;AAGK,wBAAwBJ,iBAAiBC,IAAI,CAAC;AAE9C,iCAAiC,CAACM;IACvCA,MAAMN,IAAI,CAACO,SAAS,OAAGV,UAAAA,EACrBE,iBAAiBC,IAAI,EACrBF,wBAAAA,CAAOE,IAAI,EACXF,wBAAM,CAACQ,MAAME,aAAa,CAAC,EAC3BV,wBAAM,CAACQ,MAAMG,IAAI,CAAC,EAClBH,MAAMH,KAAK,IAAIL,wBAAAA,CAAOY,SAAS,EAC/BJ,MAAMN,IAAI,CAACO,SAAS;IAEtBD,MAAML,SAAS,CAACM,SAAS,OAAGV,UAAAA,EAAKE,iBAAiBE,SAAS,EAAEH,wBAAAA,CAAOG,SAAS,EAAEK,MAAML,SAAS,CAACM,SAAS;IACxGD,MAAMJ,KAAK,CAACK,SAAS,OAAGV,UAAAA,EAAKE,iBAAiBG,KAAK,EAAEJ,wBAAAA,CAAOI,KAAK,EAAEI,MAAMJ,KAAK,CAACK,SAAS;IACxF,IAAID,MAAMH,KAAK,EAAE;QACfG,MAAMH,KAAK,CAACI,SAAS,OAAGV,UAAAA,EAAKE,iBAAiBI,KAAK,EAAEL,wBAAAA,CAAOK,KAAK,EAAEG,MAAMH,KAAK,CAACI,SAAS;IAC1F;IACA,OAAOD;AACT,EAAE"}
@@ -5,29 +5,29 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- Switch: function() {
12
+ get Switch () {
13
13
  return _Switch.Switch;
14
14
  },
15
- renderSwitch_unstable: function() {
15
+ get renderSwitch_unstable () {
16
16
  return _Switch.renderSwitch_unstable;
17
17
  },
18
- switchClassName: function() {
18
+ get switchClassName () {
19
19
  return _Switch.switchClassName;
20
20
  },
21
- switchClassNames: function() {
21
+ get switchClassNames () {
22
22
  return _Switch.switchClassNames;
23
23
  },
24
- useSwitchBase_unstable: function() {
24
+ get useSwitchBase_unstable () {
25
25
  return _Switch.useSwitchBase_unstable;
26
26
  },
27
- useSwitchStyles_unstable: function() {
27
+ get useSwitchStyles_unstable () {
28
28
  return _Switch.useSwitchStyles_unstable;
29
29
  },
30
- useSwitch_unstable: function() {
30
+ get useSwitch_unstable () {
31
31
  return _Switch.useSwitch_unstable;
32
32
  }
33
33
  });
package/package.json CHANGED
@@ -1,27 +1,30 @@
1
1
  {
2
2
  "name": "@fluentui/react-switch",
3
- "version": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
3
+ "version": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
4
4
  "description": "Fluent UI React Switch component.",
5
5
  "main": "lib-commonjs/index.cjs",
6
6
  "module": "lib/index.js",
7
7
  "typings": "./dist/index.d.ts",
8
- "sideEffects": false,
8
+ "sideEffects": [
9
+ "**/*.css"
10
+ ],
9
11
  "repository": {
10
12
  "type": "git",
11
13
  "url": "https://github.com/microsoft/fluentui"
12
14
  },
13
15
  "license": "MIT",
14
16
  "dependencies": {
15
- "@fluentui/react-field": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
17
+ "@fluentui/react-field": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
16
18
  "@fluentui/react-icons": "^2.0.245",
17
- "@fluentui/react-jsx-runtime": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
18
- "@fluentui/react-label": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
19
- "@fluentui/react-shared-contexts": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
20
- "@fluentui/react-tabster": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
21
- "@fluentui/react-theme": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
22
- "@fluentui/react-utilities": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
19
+ "@fluentui/react-jsx-runtime": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
20
+ "@fluentui/react-label": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
21
+ "@fluentui/react-shared-contexts": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
22
+ "@fluentui/react-tabster": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
23
+ "@fluentui/react-theme": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
24
+ "@fluentui/react-utilities": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
23
25
  "@griffel/react": "^1.5.32",
24
- "@swc/helpers": "^0.5.1"
26
+ "@swc/helpers": "^0.5.1",
27
+ "clsx": "^2.1.1"
25
28
  },
26
29
  "peerDependencies": {
27
30
  "@types/react": ">=16.14.0 <20.0.0",
@@ -44,7 +47,6 @@
44
47
  "default": "./lib-commonjs/index.cjs"
45
48
  }
46
49
  },
47
- "./metadata.json": "./dist/metadata/index.json",
48
50
  "./package.json": "./package.json"
49
51
  },
50
52
  "files": [
@@ -52,9 +54,7 @@
52
54
  "dist/*.d.ts",
53
55
  "dist/*.d.cts",
54
56
  "lib",
55
- "lib-commonjs",
56
- "dist/metadata"
57
+ "lib-commonjs"
57
58
  ],
58
- "type": "module",
59
- "fluentuiCatalog": "./metadata.json"
59
+ "type": "module"
60
60
  }