@fluentui/react-switch 9.1.4 → 9.1.5

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 (64) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +76 -1
  3. package/CHANGELOG.md +21 -2
  4. package/lib/Switch.js.map +1 -1
  5. package/lib/SwitchField.js.map +1 -1
  6. package/lib/components/Switch/Switch.js.map +1 -1
  7. package/lib/components/Switch/Switch.types.js +1 -1
  8. package/lib/components/Switch/Switch.types.js.map +1 -1
  9. package/lib/components/Switch/index.js.map +1 -1
  10. package/lib/components/Switch/renderSwitch.js +1 -11
  11. package/lib/components/Switch/renderSwitch.js.map +1 -1
  12. package/lib/components/Switch/useSwitch.js +5 -3
  13. package/lib/components/Switch/useSwitch.js.map +1 -1
  14. package/lib/components/Switch/useSwitchStyles.js +1 -1
  15. package/lib/components/Switch/useSwitchStyles.js.map +1 -1
  16. package/lib/components/SwitchField/SwitchField.js +1 -2
  17. package/lib/components/SwitchField/SwitchField.js.map +1 -1
  18. package/lib/components/SwitchField/index.js.map +1 -1
  19. package/lib/index.js.map +1 -1
  20. package/lib-commonjs/Switch.js +5 -4
  21. package/lib-commonjs/Switch.js.map +1 -1
  22. package/lib-commonjs/SwitchField.js +5 -4
  23. package/lib-commonjs/SwitchField.js.map +1 -1
  24. package/lib-commonjs/components/Switch/Switch.js +19 -20
  25. package/lib-commonjs/components/Switch/Switch.js.map +1 -1
  26. package/lib-commonjs/components/Switch/Switch.types.js +5 -2
  27. package/lib-commonjs/components/Switch/Switch.types.js.map +1 -1
  28. package/lib-commonjs/components/Switch/index.js +9 -8
  29. package/lib-commonjs/components/Switch/index.js.map +1 -1
  30. package/lib-commonjs/components/Switch/renderSwitch.js +14 -29
  31. package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
  32. package/lib-commonjs/components/Switch/useSwitch.js +78 -85
  33. package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
  34. package/lib-commonjs/components/Switch/useSwitchStyles.js +176 -89
  35. package/lib-commonjs/components/Switch/useSwitchStyles.js.map +1 -1
  36. package/lib-commonjs/components/SwitchField/SwitchField.js +17 -11
  37. package/lib-commonjs/components/SwitchField/SwitchField.js.map +1 -1
  38. package/lib-commonjs/components/SwitchField/index.js +5 -4
  39. package/lib-commonjs/components/SwitchField/index.js.map +1 -1
  40. package/lib-commonjs/index.js +23 -56
  41. package/lib-commonjs/index.js.map +1 -1
  42. package/package.json +12 -11
  43. package/lib-amd/Switch.js +0 -6
  44. package/lib-amd/Switch.js.map +0 -1
  45. package/lib-amd/SwitchField.js +0 -6
  46. package/lib-amd/SwitchField.js.map +0 -1
  47. package/lib-amd/components/Switch/Switch.js +0 -17
  48. package/lib-amd/components/Switch/Switch.js.map +0 -1
  49. package/lib-amd/components/Switch/Switch.types.js +0 -5
  50. package/lib-amd/components/Switch/Switch.types.js.map +0 -1
  51. package/lib-amd/components/Switch/index.js +0 -10
  52. package/lib-amd/components/Switch/index.js.map +0 -1
  53. package/lib-amd/components/Switch/renderSwitch.js +0 -19
  54. package/lib-amd/components/Switch/renderSwitch.js.map +0 -1
  55. package/lib-amd/components/Switch/useSwitch.js +0 -63
  56. package/lib-amd/components/Switch/useSwitch.js.map +0 -1
  57. package/lib-amd/components/Switch/useSwitchStyles.js +0 -211
  58. package/lib-amd/components/Switch/useSwitchStyles.js.map +0 -1
  59. package/lib-amd/components/SwitchField/SwitchField.js +0 -10
  60. package/lib-amd/components/SwitchField/SwitchField.js.map +0 -1
  61. package/lib-amd/components/SwitchField/index.js +0 -6
  62. package/lib-amd/components/SwitchField/index.js.map +0 -1
  63. package/lib-amd/index.js +0 -15
  64. package/lib-amd/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["react_tabster_1","require","react_theme_1","react_1","exports","switchClassNames","root","indicator","input","label","switchClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","__resetStyles","useRootStyles","__styles","vertical","Beiy3e4","d","useIndicatorBaseClassName","useIndicatorStyles","labelAbove","B6of3ja","useInputBaseClassName","useInputStyles","before","j35jbq","Bhzewxz","after","oyh7mz","above","B5kzvoi","Bqenvij","a9b677","useLabelStyles","base","Bceei9c","jrapky","z8tnut","z189sj","Byoj8tv","uwmqm3","useSwitchStyles_unstable","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className","mergeClasses"],"sources":["../src/packages/react-components/react-switch/src/components/Switch/useSwitchStyles.ts"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } 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;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - 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: `${thumbSize}px`,\n height: `${trackHeight}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: `${trackWidth}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\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});\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(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\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)': {\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': {\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)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled,\n },\n },\n\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText',\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\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(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%',\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((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\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 } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootBaseClassName,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorBaseClassName,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputBaseClassName,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"mappings":";;;;;;AAAA,MAAAA,eAAA,gBAAAC,OAAA;AACA,MAAAC,aAAA,gBAAAD,OAAA;AACA,MAAAE,OAAA,gBAAAF,OAAA;AAIaG,OAAA,CAAAC,gBAAgB,GAAgC;EAC3DC,IAAI,EAAE,YAAY;EAClBC,SAAS,EAAE,uBAAuB;EAClCC,KAAK,EAAE,mBAAmB;EAC1BC,KAAK,EAAE;CACR;AAED;;;AAGaL,OAAA,CAAAM,eAAe,GAAGN,OAAA,CAAAC,gBAAgB,CA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KAAK,CAACrC,KAAK,CAAC8C,SAAS,CACtB;;EAGH,OAAOT,KAAK;AACd,CAAC;AA1CY1C,OAAA,CAAAyC,wBAAwB,GAAAA,wBAAA"}
1
+ {"version":3,"sources":["../../../lib/components/Switch/useSwitchStyles.js"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';\nexport const switchClassNames = {\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.\n */\nexport const switchClassName = switchClassNames.root;\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r1u7w45w\", \"rlzel8d\", [\".r1u7w45w{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}\", \".r1u7w45w:focus{outline-style:none;}\", \".r1u7w45w:focus-visible{outline-style:none;}\", \".r1u7w45w[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}\", \".r1u7w45w[data-fui-focus-within]:focus-within::after{content:\\\"\\\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:2px;border-right-width:2px;border-bottom-width:2px;border-left-width:2px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);top:-2px;bottom:-2px;left:-2px;right:-2px;}\", \".rlzel8d{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}\", \".rlzel8d:focus{outline-style:none;}\", \".rlzel8d:focus-visible{outline-style:none;}\", \".rlzel8d[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}\", \".rlzel8d[data-fui-focus-within]:focus-within::after{content:\\\"\\\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-width:2px;border-left-width:2px;border-bottom-width:2px;border-right-width:2px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);top:-2px;bottom:-2px;right:-2px;left:-2px;}\"]);\nconst useRootStyles = /*#__PURE__*/__styles({\n vertical: {\n Beiy3e4: \"f1vx9l62\"\n }\n}, {\n d: [\".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}\"]\n});\nconst useIndicatorBaseClassName = /*#__PURE__*/__resetStyles(\"r13wlxb8\", null, [\".r13wlxb8{border-radius:var(--borderRadiusCircular);border:1px solid;line-height:0;box-sizing:border-box;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;font-size:18px;height:20px;margin:var(--spacingVerticalS) var(--spacingHorizontalS);pointer-events:none;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;}\", \"@media screen and (prefers-reduced-motion: reduce){.r13wlxb8{transition-duration:0.01ms;}}\", \".r13wlxb8>*{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}\", \"@media screen and (prefers-reduced-motion: reduce){.r13wlxb8>*{transition-duration:0.01ms;}}\"]);\nconst useIndicatorStyles = /*#__PURE__*/__styles({\n labelAbove: {\n B6of3ja: \"f1hu3pq6\"\n }\n}, {\n d: [\".f1hu3pq6{margin-top:0;}\"]\n});\nconst useInputBaseClassName = /*#__PURE__*/__resetStyles(\"rw4brat\", \"r1f4bxyr\", [\".rw4brat{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}\", \".rw4brat:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(20px);-moz-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px);}\", \".rw4brat:disabled{cursor:default;}\", \".rw4brat:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}\", \".rw4brat:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}\", \".rw4brat:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}\", \".rw4brat:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}\", \".rw4brat:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}\", \".rw4brat:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}\", \".rw4brat:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}\", \".rw4brat:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}\", \".rw4brat:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}\", \".rw4brat:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}\", \".rw4brat:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}\", \"@media (forced-colors: active){.rw4brat:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.rw4brat:disabled~.fui-Switch__label{color:GrayText;}.rw4brat:enabled:checked:hover~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.rw4brat:enabled:checked~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}}\", \".r1f4bxyr{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}\", \".r1f4bxyr:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(-20px);-moz-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px);}\", \".r1f4bxyr:disabled{cursor:default;}\", \".r1f4bxyr:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}\", \".r1f4bxyr:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}\", \".r1f4bxyr:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}\", \".r1f4bxyr:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}\", \".r1f4bxyr:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}\", \".r1f4bxyr:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}\", \".r1f4bxyr:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}\", \".r1f4bxyr:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}\", \".r1f4bxyr:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}\", \".r1f4bxyr:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}\", \".r1f4bxyr:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}\", \"@media (forced-colors: active){.r1f4bxyr:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.r1f4bxyr:disabled~.fui-Switch__label{color:GrayText;}.r1f4bxyr:enabled:checked:hover~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.r1f4bxyr:enabled:checked~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}}\"]);\nconst useInputStyles = /*#__PURE__*/__styles({\n before: {\n j35jbq: [\"f1e31b4d\", \"f1vgc2s3\"],\n Bhzewxz: \"f15twtuk\"\n },\n after: {\n oyh7mz: [\"f1vgc2s3\", \"f1e31b4d\"],\n Bhzewxz: \"f15twtuk\"\n },\n above: {\n B5kzvoi: \"f1yab3r1\",\n Bqenvij: \"f1aar7gd\",\n a9b677: \"fly5x3f\"\n }\n}, {\n d: [\".f1e31b4d{right:0;}\", \".f1vgc2s3{left:0;}\", \".f15twtuk{top:0;}\", \".f1yab3r1{bottom:0;}\", \".f1aar7gd{height:calc(20px + var(--spacingVerticalS));}\", \".fly5x3f{width:100%;}\"]\n});\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = /*#__PURE__*/__styles({\n base: {\n Bceei9c: \"f1k6fduh\",\n jrapky: \"f49ad5g\",\n B6of3ja: \"f1xlvstr\",\n z8tnut: \"f1kwiid1\",\n z189sj: [\"f1vdfbxk\", \"f1f5gg8d\"],\n Byoj8tv: \"f5b47ha\",\n uwmqm3: [\"f1f5gg8d\", \"f1vdfbxk\"]\n },\n above: {\n z8tnut: \"f1ywm7hm\",\n Byoj8tv: \"f14wxoun\",\n a9b677: \"fly5x3f\"\n },\n after: {\n uwmqm3: [\"fruq291\", \"f7x41pl\"]\n },\n before: {\n z189sj: [\"f7x41pl\", \"fruq291\"]\n }\n}, {\n d: [\".f1k6fduh{cursor:pointer;}\", \".f49ad5g{margin-bottom:calc((20px - var(--lineHeightBase300)) / 2);}\", \".f1xlvstr{margin-top:calc((20px - var(--lineHeightBase300)) / 2);}\", \".f1kwiid1{padding-top:var(--spacingVerticalS);}\", \".f1vdfbxk{padding-right:var(--spacingHorizontalS);}\", \".f1f5gg8d{padding-left:var(--spacingHorizontalS);}\", \".f5b47ha{padding-bottom:var(--spacingVerticalS);}\", \".f1ywm7hm{padding-top:var(--spacingVerticalXS);}\", \".f14wxoun{padding-bottom:var(--spacingVerticalXS);}\", \".fly5x3f{width:100%;}\", \".fruq291{padding-left:var(--spacingHorizontalXS);}\", \".f7x41pl{padding-right:var(--spacingHorizontalXS);}\"]\n});\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = state => {\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 const {\n label,\n labelPosition\n } = state;\n state.root.className = mergeClasses(switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);\n state.indicator.className = mergeClasses(switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);\n state.input.className = mergeClasses(switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);\n if (state.label) {\n state.label.className = mergeClasses(switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);\n }\n return state;\n};\n//# sourceMappingURL=useSwitchStyles.js.map"],"names":["switchClassNames","switchClassName","useSwitchStyles_unstable","root","indicator","input","label","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","__resetStyles","useRootStyles","__styles","vertical","Beiy3e4","d","useIndicatorBaseClassName","useIndicatorStyles","labelAbove","B6of3ja","useInputBaseClassName","useInputStyles","before","j35jbq","Bhzewxz","after","oyh7mz","above","B5kzvoi","Bqenvij","a9b677","useLabelStyles","base","Bceei9c","jrapky","z8tnut","z189sj","Byoj8tv","uwmqm3","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className","mergeClasses"],"mappings":";;;;;;;;;;;IAGaA,gBAAgB,MAAhBA;IASAC,eAAe,MAAfA;IAoEAC,wBAAwB,MAAxBA;;uBA9EqD;AAC3D,MAAMF,mBAAmB;IAC9BG,MAAM;IACNC,WAAW;IACXC,OAAO;IACPC,OAAO;AACT;AAIO,MAAML,kBAAkBD,iBAAiBG,IAAI;AACpD,+CAA+C;AAC/C,MAAMI,4BAA4B;AAClC,MAAMC,cAAc;AACpB,MAAMC,aAAa;AACnB,MAAMC,YAAYF,cAAcD;AAChC,MAAMI,uBAAuB,WAAW,GAAEC,IAAAA,uBAAa,EAAC,YAAY,WAAW;IAAC;IAA0Q;IAAwC;IAAgD;IAA6K;IAAutB;IAAyQ;IAAuC;IAA+C;IAA4K;CAAqtB;AACthF,MAAMC,gBAAgB,WAAW,GAAEC,IAAAA,kBAAQ,EAAC;IAC1CC,UAAU;QACRC,SAAS;IACX;AACF,GAAG;IACDC,GAAG;QAAC;KAA4F;AAClG;AACA,MAAMC,4BAA4B,WAAW,GAAEN,IAAAA,uBAAa,EAAC,YAAY,IAAI,EAAE;IAAC;IAAib;IAA8F;IAAyI;CAA+F;AACv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sD;AACvnB;AAIO,MAAMf,2BAA2BuC,CAAAA,QAAS;IAC/C,MAAMC,oBAAoB/B;IAC1B,MAAMgC,aAAa9B;IACnB,MAAM+B,yBAAyB1B;IAC/B,MAAM2B,kBAAkB1B;IACxB,MAAM2B,qBAAqBxB;IAC3B,MAAMyB,cAAcxB;IACpB,MAAMyB,cAAcf;IACpB,MAAM,EACJ3B,MAAK,EACL2C,cAAa,EACd,GAAGR;IACJA,MAAMtC,IAAI,CAAC+C,SAAS,GAAGC,IAAAA,mBAAY,EAACnD,iBAAiBG,IAAI,EAAEuC,mBAAmBO,kBAAkB,WAAWN,WAAW5B,QAAQ,EAAE0B,MAAMtC,IAAI,CAAC+C,SAAS;IACpJT,MAAMrC,SAAS,CAAC8C,SAAS,GAAGC,IAAAA,mBAAY,EAACnD,iBAAiBI,SAAS,EAAEwC,wBAAwBtC,SAAS2C,kBAAkB,WAAWJ,gBAAgBzB,UAAU,EAAEqB,MAAMrC,SAAS,CAAC8C,SAAS;IACxLT,MAAMpC,KAAK,CAAC6C,SAAS,GAAGC,IAAAA,mBAAY,EAACnD,iBAAiBK,KAAK,EAAEyC,oBAAoBxC,SAASyC,WAAW,CAACE,cAAc,EAAER,MAAMpC,KAAK,CAAC6C,SAAS;IAC3I,IAAIT,MAAMnC,KAAK,EAAE;QACfmC,MAAMnC,KAAK,CAAC4C,SAAS,GAAGC,IAAAA,mBAAY,EAACnD,iBAAiBM,KAAK,EAAE0C,YAAYd,IAAI,EAAEc,WAAW,CAACC,cAAc,EAAER,MAAMnC,KAAK,CAAC4C,SAAS;IAClI,CAAC;IACD,OAAOT;AACT,GACA,2CAA2C"}
@@ -1,14 +1,20 @@
1
- "use strict";
2
-
1
+ /* eslint-disable deprecation/deprecation */ "use strict";
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ switchFieldClassNames: ()=>switchFieldClassNames,
13
+ SwitchField: ()=>SwitchField
5
14
  });
6
- exports.SwitchField = exports.switchFieldClassNames = void 0;
7
- /* eslint-disable deprecation/deprecation */
8
- const react_field_1 = /*#__PURE__*/require("@fluentui/react-field");
9
- const Switch_1 = /*#__PURE__*/require("../../Switch");
10
- /** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */
11
- exports.switchFieldClassNames = /*#__PURE__*/react_field_1.getDeprecatedFieldClassNames(Switch_1.switchClassNames.root);
12
- /** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */
13
- exports.SwitchField = /*#__PURE__*/react_field_1.makeDeprecatedField(Switch_1.Switch);
15
+ const _reactField = require("@fluentui/react-field");
16
+ const _switch = require("../../Switch");
17
+ const switchFieldClassNames = /*#__PURE__*/ (0, _reactField.getDeprecatedFieldClassNames)(_switch.switchClassNames.root);
18
+ const SwitchField = /*#__PURE__*/ (0, _reactField.makeDeprecatedField)(_switch.Switch); //# sourceMappingURL=SwitchField.js.map
19
+
14
20
  //# sourceMappingURL=SwitchField.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["react_field_1","require","Switch_1","exports","switchFieldClassNames","getDeprecatedFieldClassNames","switchClassNames","root","SwitchField","makeDeprecatedField","Switch"],"sources":["../src/packages/react-components/react-switch/src/components/SwitchField/SwitchField.tsx"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport { DeprecatedFieldProps, getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { Switch, switchClassNames, SwitchProps } from '../../Switch';\n\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport type SwitchFieldProps = DeprecatedFieldProps<SwitchProps>;\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport const switchFieldClassNames = getDeprecatedFieldClassNames(switchClassNames.root);\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport const SwitchField: ForwardRefComponent<SwitchFieldProps> = makeDeprecatedField(Switch);\n"],"mappings":";;;;;;AAAA;AACA,MAAAA,aAAA,gBAAAC,OAAA;AAEA,MAAAC,QAAA,gBAAAD,OAAA;AAIA;AACaE,OAAA,CAAAC,qBAAqB,gBAAGJ,aAAA,CAAAK,4BAA4B,CAACH,QAAA,CAAAI,gBAAgB,CAACC,IAAI,CAAC;AACxF;AACaJ,OAAA,CAAAK,WAAW,gBAA0CR,aAAA,CAAAS,mBAAmB,CAACP,QAAA,CAAAQ,MAAM,CAAC"}
1
+ {"version":3,"sources":["../../../lib/components/SwitchField/SwitchField.js"],"sourcesContent":["/* eslint-disable deprecation/deprecation */import { getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';\nimport { Switch, switchClassNames } from '../../Switch';\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport const switchFieldClassNames = /*#__PURE__*/getDeprecatedFieldClassNames(switchClassNames.root);\n/** @deprecated Use Field with Switch: `<Field><Switch /></Field>` */\nexport const SwitchField = /*#__PURE__*/makeDeprecatedField(Switch);\n//# sourceMappingURL=SwitchField.js.map"],"names":["switchFieldClassNames","SwitchField","getDeprecatedFieldClassNames","switchClassNames","root","makeDeprecatedField","Switch"],"mappings":"AAAA,0CAA0C;;;;;;;;;;;IAG7BA,qBAAqB,MAArBA;IAEAC,WAAW,MAAXA;;4BALiG;wBACrE;AAElC,MAAMD,wBAAwB,WAAW,GAAEE,IAAAA,wCAA4B,EAACC,wBAAgB,CAACC,IAAI;AAE7F,MAAMH,cAAc,WAAW,GAAEI,IAAAA,+BAAmB,EAACC,cAAM,GAClE,uCAAuC"}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./SwitchField"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./SwitchField"), exports);
7
+ //# sourceMappingURL=index.js.map
8
+
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-switch/src/components/SwitchField/index.ts"],"sourcesContent":["export * from './SwitchField';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,mBAAAC,OAAA"}
1
+ {"version":3,"sources":["../../../lib/components/SwitchField/index.js"],"sourcesContent":["export * from './SwitchField';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,iCAAiC"}
@@ -1,59 +1,26 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.switchFieldClassNames = exports.SwitchField_unstable = exports.useSwitch_unstable = exports.useSwitchStyles_unstable = exports.switchClassNames = exports.switchClassName = exports.renderSwitch_unstable = exports.Switch = void 0;
7
- var Switch_1 = /*#__PURE__*/require("./Switch");
8
- Object.defineProperty(exports, "Switch", {
9
- enumerable: true,
10
- get: function () {
11
- return Switch_1.Switch;
12
- }
13
- });
14
- Object.defineProperty(exports, "renderSwitch_unstable", {
15
- enumerable: true,
16
- get: function () {
17
- return Switch_1.renderSwitch_unstable;
18
- }
19
- });
20
- // eslint-disable-next-line deprecation/deprecation
21
- Object.defineProperty(exports, "switchClassName", {
22
- enumerable: true,
23
- get: function () {
24
- return Switch_1.switchClassName;
25
- }
26
- });
27
- Object.defineProperty(exports, "switchClassNames", {
28
- enumerable: true,
29
- get: function () {
30
- return Switch_1.switchClassNames;
31
- }
32
- });
33
- Object.defineProperty(exports, "useSwitchStyles_unstable", {
34
- enumerable: true,
35
- get: function () {
36
- return Switch_1.useSwitchStyles_unstable;
37
- }
38
- });
39
- Object.defineProperty(exports, "useSwitch_unstable", {
40
- enumerable: true,
41
- get: function () {
42
- return Switch_1.useSwitch_unstable;
43
- }
44
- });
45
- // eslint-disable-next-line deprecation/deprecation
46
- var SwitchField_1 = /*#__PURE__*/require("./SwitchField");
47
- Object.defineProperty(exports, "SwitchField_unstable", {
48
- enumerable: true,
49
- get: function () {
50
- return SwitchField_1.SwitchField;
51
- }
52
- });
53
- Object.defineProperty(exports, "switchFieldClassNames", {
54
- enumerable: true,
55
- get: function () {
56
- return SwitchField_1.switchFieldClassNames;
57
- }
58
- });
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ Switch: ()=>_switch.Switch,
13
+ renderSwitch_unstable: ()=>_switch.renderSwitch_unstable,
14
+ // eslint-disable-next-line deprecation/deprecation
15
+ switchClassName: ()=>_switch.switchClassName,
16
+ switchClassNames: ()=>_switch.switchClassNames,
17
+ useSwitchStyles_unstable: ()=>_switch.useSwitchStyles_unstable,
18
+ useSwitch_unstable: ()=>_switch.useSwitch_unstable,
19
+ SwitchField_unstable: ()=>_switchField.SwitchField,
20
+ switchFieldClassNames: ()=>_switchField.switchFieldClassNames
21
+ });
22
+ const _switch = require("./Switch");
23
+ const _switchField = require("./SwitchField");
24
+ //# sourceMappingURL=index.js.map
25
+
59
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Switch_1","require","Object","defineProperty","exports","enumerable","get","Switch","renderSwitch_unstable","switchClassName","switchClassNames","useSwitchStyles_unstable","useSwitch_unstable","SwitchField_1","SwitchField","switchFieldClassNames"],"sources":["../src/packages/react-components/react-switch/src/index.ts"],"sourcesContent":["export {\n Switch,\n renderSwitch_unstable,\n // eslint-disable-next-line deprecation/deprecation\n switchClassName,\n switchClassNames,\n useSwitchStyles_unstable,\n useSwitch_unstable,\n} from './Switch';\nexport type { SwitchOnChangeData, SwitchProps, SwitchSlots, SwitchState } from './Switch';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { SwitchField as SwitchField_unstable, switchFieldClassNames } from './SwitchField';\n// eslint-disable-next-line deprecation/deprecation\nexport type { SwitchFieldProps as SwitchFieldProps_unstable } from './SwitchField';\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,gBAAAC,OAAA;AACEC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,QAAA,CAAAO,MAAM;EAAA;AAAA;AACNL,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,QAAA,CAAAQ,qBAAqB;EAAA;AAAA;AACrB;AACAN,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,QAAA,CAAAS,eAAe;EAAA;AAAA;AACfP,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,QAAA,CAAAU,gBAAgB;EAAA;AAAA;AAChBR,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,QAAA,CAAAW,wBAAwB;EAAA;AAAA;AACxBT,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,QAAA,CAAAY,kBAAkB;EAAA;AAAA;AAIpB;AACA,IAAAC,aAAA,gBAAAZ,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAO,aAAA,CAAAC,WAAW;EAAA;AAAA;AAA0BZ,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAO,aAAA,CAAAE,qBAAqB;EAAA;AAAA"}
1
+ {"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { Switch, renderSwitch_unstable,\n// eslint-disable-next-line deprecation/deprecation\nswitchClassName, switchClassNames, useSwitchStyles_unstable, useSwitch_unstable } from './Switch';\n// eslint-disable-next-line deprecation/deprecation\nexport { SwitchField as SwitchField_unstable, switchFieldClassNames } from './SwitchField';\n//# sourceMappingURL=index.js.map"],"names":["Switch","renderSwitch_unstable","switchClassName","switchClassNames","useSwitchStyles_unstable","useSwitch_unstable","SwitchField_unstable","SwitchField","switchFieldClassNames"],"mappings":";;;;;;;;;;;IAASA,MAAM,MAANA,cAAM;IAAEC,qBAAqB,MAArBA,6BAAqB;IACtC,mDAAmD;IACnDC,eAAe,MAAfA,uBAAe;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,wBAAwB,MAAxBA,gCAAwB;IAAEC,kBAAkB,MAAlBA,0BAAkB;IAEvDC,oBAAoB,MAAnCC,wBAAW;IAA0BC,qBAAqB,MAArBA,kCAAqB;;wBAFoB;6BAEZ;CAC3E,iCAAiC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-switch",
3
- "version": "9.1.4",
3
+ "version": "9.1.5",
4
4
  "description": "Fluent UI React Switch component.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -22,25 +22,25 @@
22
22
  "test": "jest --passWithNoTests",
23
23
  "storybook": "start-storybook",
24
24
  "type-check": "tsc -b tsconfig.json",
25
- "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
25
+ "generate-api": "just-scripts generate-api"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@fluentui/eslint-plugin": "*",
29
29
  "@fluentui/react-conformance": "*",
30
- "@fluentui/react-conformance-griffel": "9.0.0-beta.19",
30
+ "@fluentui/react-conformance-griffel": "9.0.0-beta.20",
31
31
  "@fluentui/scripts-api-extractor": "*",
32
32
  "@fluentui/scripts-tasks": "*"
33
33
  },
34
34
  "dependencies": {
35
- "@fluentui/react-field": "9.0.0-alpha.26",
36
- "@fluentui/react-icons": "^2.0.175",
37
- "@fluentui/react-label": "^9.1.4",
38
- "@fluentui/react-shared-contexts": "^9.3.1",
39
- "@fluentui/react-tabster": "^9.6.0",
40
- "@fluentui/react-theme": "^9.1.6",
41
- "@fluentui/react-utilities": "^9.7.1",
35
+ "@fluentui/react-field": "9.0.0-alpha.27",
36
+ "@fluentui/react-icons": "^2.0.196",
37
+ "@fluentui/react-label": "^9.1.5",
38
+ "@fluentui/react-shared-contexts": "^9.3.2",
39
+ "@fluentui/react-tabster": "^9.6.1",
40
+ "@fluentui/react-theme": "^9.1.7",
41
+ "@fluentui/react-utilities": "^9.7.2",
42
42
  "@griffel/react": "^1.5.2",
43
- "tslib": "^2.1.0"
43
+ "@swc/helpers": "^0.4.14"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@types/react": ">=16.8.0 <19.0.0",
@@ -57,6 +57,7 @@
57
57
  "exports": {
58
58
  ".": {
59
59
  "types": "./dist/index.d.ts",
60
+ "node": "./lib-commonjs/index.js",
60
61
  "import": "./lib/index.js",
61
62
  "require": "./lib-commonjs/index.js"
62
63
  },
package/lib-amd/Switch.js DELETED
@@ -1,6 +0,0 @@
1
- define(["require", "exports", "tslib", "./components/Switch/index"], function (require, exports, tslib_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(index_1, exports);
5
- });
6
- //# sourceMappingURL=Switch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-switch/src/Switch.ts"],"names":[],"mappings":";;;IAAA,uCAA0C","sourcesContent":["export * from './components/Switch/index';\n"]}
@@ -1,6 +0,0 @@
1
- define(["require", "exports", "tslib", "./components/SwitchField/index"], function (require, exports, tslib_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(index_1, exports);
5
- });
6
- //# sourceMappingURL=SwitchField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwitchField.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-switch/src/SwitchField.ts"],"names":[],"mappings":";;;IAAA,uCAA+C","sourcesContent":["export * from './components/SwitchField/index';\n"]}
@@ -1,17 +0,0 @@
1
- define(["require", "exports", "react", "./useSwitch", "./renderSwitch", "./useSwitchStyles", "@fluentui/react-shared-contexts"], function (require, exports, React, useSwitch_1, renderSwitch_1, useSwitchStyles_1, react_shared_contexts_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Switch = void 0;
5
- /**
6
- * Switches enable users to trigger an option on or off through pressing the component.
7
- */
8
- exports.Switch = React.forwardRef(function (props, ref) {
9
- var state = useSwitch_1.useSwitch_unstable(props, ref);
10
- useSwitchStyles_1.useSwitchStyles_unstable(state);
11
- var useCustomStyles = react_shared_contexts_1.useCustomStyleHooks_unstable().useSwitchStyles_unstable;
12
- useCustomStyles(state);
13
- return renderSwitch_1.renderSwitch_unstable(state);
14
- });
15
- exports.Switch.displayName = 'Switch';
16
- });
17
- //# sourceMappingURL=Switch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/Switch/Switch.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IACU,QAAA,MAAM,GAAqC,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAClF,IAAM,KAAK,GAAG,8BAAkB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE7C,0CAAwB,CAAC,KAAK,CAAC,CAAC;QAExB,IAA0B,eAAe,GAAK,oDAA4B,EAAE,yBAAnC,CAAoC;QACrF,eAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,oCAAqB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,cAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import * as React from 'react';\nimport { useSwitch_unstable } from './useSwitch';\nimport { renderSwitch_unstable } from './renderSwitch';\nimport { useSwitchStyles_unstable } from './useSwitchStyles';\nimport type { SwitchProps } from './Switch.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Switches enable users to trigger an option on or off through pressing the component.\n */\nexport const Switch: ForwardRefComponent<SwitchProps> = React.forwardRef((props, ref) => {\n const state = useSwitch_unstable(props, ref);\n\n useSwitchStyles_unstable(state);\n\n const { useSwitchStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderSwitch_unstable(state);\n});\n\nSwitch.displayName = 'Switch';\n"]}
@@ -1,5 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- });
5
- //# sourceMappingURL=Switch.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Switch.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/Switch/Switch.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type SwitchSlots = {\n /**\n * The root element of the Switch.\n *\n * The root slot receives the `className` and `style` specified directly on the `<Switch>` tag.\n * All other native props will be applied to the primary slot: `input`.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * The track and the thumb sliding over it indicating the on and off status of the Switch.\n */\n indicator: NonNullable<Slot<'div'>>;\n\n /**\n * Hidden input that handles the Switch's functionality.\n *\n * This is the PRIMARY slot: all native properties specified directly on the `<Switch>` tag will be applied to this\n * slot, except `className` and `style`, which remain on the root slot.\n */\n input: NonNullable<Slot<'input'>>;\n\n /**\n * The Switch's label.\n */\n label?: Slot<typeof Label>;\n};\n\nexport type SwitchOnChangeData = {\n checked: boolean;\n};\n\n/**\n * Switch Props\n */\nexport type SwitchProps = Omit<\n ComponentProps<Partial<SwitchSlots>, 'input'>,\n 'checked' | 'defaultChecked' | 'onChange'\n> & {\n /**\n * Defines the controlled checked state of the Switch.\n * If passed, Switch ignores the `defaultChecked` property.\n * This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the\n * correct value based on handling `onChange` events and re-rendering.\n *\n * @default false\n */\n checked?: boolean;\n\n /**\n * Defines whether the Switch is initially in a checked state or not when rendered.\n *\n * @default false\n */\n defaultChecked?: boolean;\n\n /**\n * The position of the label relative to the Switch.\n *\n * @default after\n */\n labelPosition?: 'above' | 'after' | 'before';\n\n /**\n * Callback to be called when the checked state value changes.\n */\n onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SwitchOnChangeData) => void;\n};\n\n/**\n * State used in rendering Switch\n */\nexport type SwitchState = ComponentState<SwitchSlots> & Required<Pick<SwitchProps, 'labelPosition'>>;\n"]}
@@ -1,10 +0,0 @@
1
- define(["require", "exports", "tslib", "./Switch", "./Switch.types", "./renderSwitch", "./useSwitch", "./useSwitchStyles"], function (require, exports, tslib_1, Switch_1, Switch_types_1, renderSwitch_1, useSwitch_1, useSwitchStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(Switch_1, exports);
5
- tslib_1.__exportStar(Switch_types_1, exports);
6
- tslib_1.__exportStar(renderSwitch_1, exports);
7
- tslib_1.__exportStar(useSwitch_1, exports);
8
- tslib_1.__exportStar(useSwitchStyles_1, exports);
9
- });
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/Switch/index.ts"],"names":[],"mappings":";;;IAAA,wCAAyB;IACzB,8CAA+B;IAC/B,8CAA+B;IAC/B,2CAA4B;IAC5B,iDAAkC","sourcesContent":["export * from './Switch';\nexport * from './Switch.types';\nexport * from './renderSwitch';\nexport * from './useSwitch';\nexport * from './useSwitchStyles';\n"]}
@@ -1,19 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.renderSwitch_unstable = void 0;
5
- /**
6
- * Render a Switch component by passing the state defined props to the appropriate slots.
7
- */
8
- var renderSwitch_unstable = function (state) {
9
- var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
10
- var labelPosition = state.labelPosition;
11
- return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
12
- React.createElement(slots.input, tslib_1.__assign({}, slotProps.input)),
13
- labelPosition !== 'after' && slots.label && React.createElement(slots.label, tslib_1.__assign({}, slotProps.label)),
14
- React.createElement(slots.indicator, tslib_1.__assign({}, slotProps.indicator)),
15
- labelPosition === 'after' && slots.label && React.createElement(slots.label, tslib_1.__assign({}, slotProps.label))));
16
- };
17
- exports.renderSwitch_unstable = renderSwitch_unstable;
18
- });
19
- //# sourceMappingURL=renderSwitch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderSwitch.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/Switch/renderSwitch.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,qBAAqB,GAAG,UAAC,KAAkB;QAChD,IAAA,KAAuB,0BAAQ,CAAc,KAAK,CAAC,EAAjD,KAAK,WAAA,EAAE,SAAS,eAAiC,CAAC;QAClD,IAAA,aAAa,GAAK,KAAK,cAAV,CAAW;QAEhC,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC5B,oBAAC,KAAK,CAAC,KAAK,uBAAK,SAAS,CAAC,KAAK,EAAI;YACnC,aAAa,KAAK,OAAO,IAAI,KAAK,CAAC,KAAK,IAAI,oBAAC,KAAK,CAAC,KAAK,uBAAK,SAAS,CAAC,KAAK,EAAI;YACjF,oBAAC,KAAK,CAAC,SAAS,uBAAK,SAAS,CAAC,SAAS,EAAI;YAC3C,aAAa,KAAK,OAAO,IAAI,KAAK,CAAC,KAAK,IAAI,oBAAC,KAAK,CAAC,KAAK,uBAAK,SAAS,CAAC,KAAK,EAAI,CACtE,CACd,CAAC;IACJ,CAAC,CAAC;IAZW,QAAA,qBAAqB,yBAYhC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SwitchState, SwitchSlots } from './Switch.types';\n\n/**\n * Render a Switch component by passing the state defined props to the appropriate slots.\n */\nexport const renderSwitch_unstable = (state: SwitchState) => {\n const { slots, slotProps } = getSlots<SwitchSlots>(state);\n const { labelPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n <slots.input {...slotProps.input} />\n {labelPosition !== 'after' && slots.label && <slots.label {...slotProps.label} />}\n <slots.indicator {...slotProps.indicator} />\n {labelPosition === 'after' && slots.label && <slots.label {...slotProps.label} />}\n </slots.root>\n );\n};\n"]}
@@ -1,63 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-icons", "@fluentui/react-label", "@fluentui/react-tabster", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_icons_1, react_label_1, react_tabster_1, react_utilities_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useSwitch_unstable = void 0;
5
- /**
6
- * Create the state required to render Switch.
7
- *
8
- * The returned state can be modified with hooks such as useSwitchStyles_unstable,
9
- * before being passed to renderSwitch_unstable.
10
- *
11
- * @param props - props from this instance of Switch
12
- * @param ref - reference to `<input>` element of Switch
13
- */
14
- var useSwitch_unstable = function (props, ref) {
15
- var checked = props.checked, defaultChecked = props.defaultChecked, disabled = props.disabled, _a = props.labelPosition, labelPosition = _a === void 0 ? 'after' : _a, onChange = props.onChange, required = props.required;
16
- var nativeProps = react_utilities_1.getPartitionedNativeProps({
17
- props: props,
18
- primarySlotTagName: 'input',
19
- excludedPropNames: ['checked', 'defaultChecked', 'onChange'],
20
- });
21
- var id = react_utilities_1.useId('switch-', nativeProps.primary.id);
22
- var root = react_utilities_1.resolveShorthand(props.root, {
23
- defaultProps: tslib_1.__assign({ ref: react_tabster_1.useFocusWithin() }, nativeProps.root),
24
- required: true,
25
- });
26
- var indicator = react_utilities_1.resolveShorthand(props.indicator, {
27
- defaultProps: {
28
- 'aria-hidden': true,
29
- children: React.createElement(react_icons_1.CircleFilled, null),
30
- },
31
- required: true,
32
- });
33
- var input = react_utilities_1.resolveShorthand(props.input, {
34
- defaultProps: tslib_1.__assign({ checked: checked, defaultChecked: defaultChecked, id: id, ref: ref, role: 'switch', type: 'checkbox' }, nativeProps.primary),
35
- required: true,
36
- });
37
- input.onChange = react_utilities_1.mergeCallbacks(input.onChange, function (ev) { return onChange === null || onChange === void 0 ? void 0 : onChange(ev, { checked: ev.currentTarget.checked }); });
38
- var label = react_utilities_1.resolveShorthand(props.label, {
39
- defaultProps: {
40
- disabled: disabled,
41
- htmlFor: id,
42
- required: required,
43
- size: 'medium',
44
- },
45
- });
46
- return {
47
- labelPosition: labelPosition,
48
- //Slots definition
49
- components: {
50
- root: 'div',
51
- indicator: 'div',
52
- input: 'input',
53
- label: react_label_1.Label,
54
- },
55
- root: root,
56
- indicator: indicator,
57
- input: input,
58
- label: label,
59
- };
60
- };
61
- exports.useSwitch_unstable = useSwitch_unstable;
62
- });
63
- //# sourceMappingURL=useSwitch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSwitch.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/Switch/useSwitch.tsx"],"names":[],"mappings":";;;;IAOA;;;;;;;;OAQG;IACI,IAAM,kBAAkB,GAAG,UAAC,KAAkB,EAAE,GAAgC;QAC7E,IAAA,OAAO,GAA4E,KAAK,QAAjF,EAAE,cAAc,GAA4D,KAAK,eAAjE,EAAE,QAAQ,GAAkD,KAAK,SAAvD,EAAE,KAAgD,KAAK,cAA9B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C;QAE7G,IAAM,KAAK,GAAG,kCAAgB,CAAC,KAAK,CAAC,KAAK,EAAE;YAC1C,YAAY,EAAE;gBACZ,QAAQ,UAAA;gBACR,OAAO,EAAE,EAAE;gBACX,QAAQ,UAAA;gBACR,IAAI,EAAE,QAAQ;aACf;SACF,CAAC,CAAC;QAEH,OAAO;YACL,aAAa,eAAA;YAEb,kBAAkB;YAClB,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK;gBACX,SAAS,EAAE,KAAK;gBAChB,KAAK,EAAE,OAAO;gBACd,KAAK,EAAE,mBAAK;aACb;YAED,IAAI,MAAA;YACJ,SAAS,WAAA;YACT,KAAK,OAAA;YACL,KAAK,OAAA;SACN,CAAC;IACJ,CAAC,CAAC;IA/DW,QAAA,kBAAkB,sBA+D7B","sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport type { SwitchProps, SwitchState } from './Switch.types';\n\n/**\n * Create the state required to render Switch.\n *\n * The returned state can be modified with hooks such as useSwitchStyles_unstable,\n * before being passed to renderSwitch_unstable.\n *\n * @param props - props from this instance of Switch\n * @param ref - reference to `<input>` element of Switch\n */\nexport const useSwitch_unstable = (props: SwitchProps, ref: React.Ref<HTMLInputElement>): SwitchState => {\n const { checked, defaultChecked, disabled, labelPosition = 'after', onChange, required } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange'],\n });\n\n const id = useId('switch-', nativeProps.primary.id);\n\n const root = resolveShorthand(props.root, {\n defaultProps: { ref: useFocusWithin<HTMLDivElement>(), ...nativeProps.root },\n required: true,\n });\n\n const indicator = resolveShorthand(props.indicator, {\n defaultProps: {\n 'aria-hidden': true,\n children: <CircleFilled />,\n },\n required: true,\n });\n\n const input = resolveShorthand(props.input, {\n defaultProps: {\n checked,\n defaultChecked,\n id,\n ref,\n role: 'switch',\n type: 'checkbox',\n ...nativeProps.primary,\n },\n required: true,\n });\n input.onChange = mergeCallbacks(input.onChange, ev => onChange?.(ev, { checked: ev.currentTarget.checked }));\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n disabled,\n htmlFor: id,\n required,\n size: 'medium',\n },\n });\n\n return {\n labelPosition,\n\n //Slots definition\n components: {\n root: 'div',\n indicator: 'div',\n input: 'input',\n label: Label,\n },\n\n root,\n indicator,\n input,\n label,\n };\n};\n"]}