@fluentui/react-button 9.1.12 → 9.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. package/CHANGELOG.json +54 -1
  2. package/CHANGELOG.md +15 -2
  3. package/lib/components/Button/Button.js +3 -2
  4. package/lib/components/Button/Button.js.map +1 -1
  5. package/lib/components/Button/renderButton.js +6 -4
  6. package/lib/components/Button/renderButton.js.map +1 -1
  7. package/lib/components/Button/useButton.js +0 -1
  8. package/lib/components/Button/useButton.js.map +1 -1
  9. package/lib/components/Button/useButtonStyles.js +309 -315
  10. package/lib/components/Button/useButtonStyles.js.map +1 -1
  11. package/lib/components/CompoundButton/CompoundButton.js +3 -2
  12. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  13. package/lib/components/CompoundButton/renderCompoundButton.js +10 -6
  14. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  15. package/lib/components/CompoundButton/useCompoundButton.js +4 -5
  16. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  17. package/lib/components/CompoundButton/useCompoundButtonStyles.js +124 -129
  18. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  19. package/lib/components/MenuButton/MenuButton.js +3 -2
  20. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  21. package/lib/components/MenuButton/renderMenuButton.js +6 -4
  22. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  23. package/lib/components/MenuButton/useMenuButton.js +2 -3
  24. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  25. package/lib/components/MenuButton/useMenuButtonStyles.js +61 -67
  26. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  27. package/lib/components/SplitButton/SplitButton.js +3 -2
  28. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  29. package/lib/components/SplitButton/renderSplitButton.js +6 -4
  30. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  31. package/lib/components/SplitButton/useSplitButton.js +2 -4
  32. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  33. package/lib/components/SplitButton/useSplitButtonStyles.js +56 -62
  34. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  35. package/lib/components/ToggleButton/ToggleButton.js +3 -2
  36. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  37. package/lib/components/ToggleButton/useToggleButton.js +0 -1
  38. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  39. package/lib/components/ToggleButton/useToggleButtonStyles.js +246 -249
  40. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib/utils/useToggleState.js +4 -3
  43. package/lib/utils/useToggleState.js.map +1 -1
  44. package/lib-commonjs/Button.js +0 -2
  45. package/lib-commonjs/Button.js.map +1 -1
  46. package/lib-commonjs/CompoundButton.js +0 -2
  47. package/lib-commonjs/CompoundButton.js.map +1 -1
  48. package/lib-commonjs/MenuButton.js +0 -2
  49. package/lib-commonjs/MenuButton.js.map +1 -1
  50. package/lib-commonjs/SplitButton.js +0 -2
  51. package/lib-commonjs/SplitButton.js.map +1 -1
  52. package/lib-commonjs/ToggleButton.js +0 -2
  53. package/lib-commonjs/ToggleButton.js.map +1 -1
  54. package/lib-commonjs/components/Button/Button.js +3 -7
  55. package/lib-commonjs/components/Button/Button.js.map +1 -1
  56. package/lib-commonjs/components/Button/Button.types.js.map +1 -1
  57. package/lib-commonjs/components/Button/index.js +0 -6
  58. package/lib-commonjs/components/Button/index.js.map +1 -1
  59. package/lib-commonjs/components/Button/renderButton.js +6 -8
  60. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  61. package/lib-commonjs/components/Button/useButton.js +0 -5
  62. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  63. package/lib-commonjs/components/Button/useButtonStyles.js +309 -321
  64. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  65. package/lib-commonjs/components/CompoundButton/CompoundButton.js +3 -7
  66. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  67. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
  68. package/lib-commonjs/components/CompoundButton/index.js +0 -7
  69. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  70. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +10 -10
  71. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  72. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +4 -9
  73. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  74. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +124 -134
  75. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  76. package/lib-commonjs/components/MenuButton/MenuButton.js +3 -7
  77. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  78. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
  79. package/lib-commonjs/components/MenuButton/index.js +0 -7
  80. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  81. package/lib-commonjs/components/MenuButton/renderMenuButton.js +6 -8
  82. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  83. package/lib-commonjs/components/MenuButton/useMenuButton.js +2 -9
  84. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  85. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +61 -73
  86. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  87. package/lib-commonjs/components/SplitButton/SplitButton.js +3 -7
  88. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  89. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
  90. package/lib-commonjs/components/SplitButton/index.js +0 -7
  91. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  92. package/lib-commonjs/components/SplitButton/renderSplitButton.js +6 -8
  93. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  94. package/lib-commonjs/components/SplitButton/useSplitButton.js +2 -9
  95. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  96. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +56 -67
  97. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  98. package/lib-commonjs/components/ToggleButton/ToggleButton.js +3 -7
  99. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  100. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
  101. package/lib-commonjs/components/ToggleButton/index.js +0 -7
  102. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  103. package/lib-commonjs/components/ToggleButton/renderToggleButton.js +0 -2
  104. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  105. package/lib-commonjs/components/ToggleButton/useToggleButton.js +0 -5
  106. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  107. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +246 -256
  108. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  109. package/lib-commonjs/index.js +0 -12
  110. package/lib-commonjs/index.js.map +1 -1
  111. package/lib-commonjs/utils/index.js +0 -2
  112. package/lib-commonjs/utils/index.js.map +1 -1
  113. package/lib-commonjs/utils/useToggleState.js +4 -7
  114. package/lib-commonjs/utils/useToggleState.js.map +1 -1
  115. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-button/src/components/ToggleButton/useToggleButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAKa,OAAA,CAAA,sBAAA,GAAsD;EACjE,IAAI,EAAE,kBAD2D;EA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AV,IAAiD,kBAAkB,CAAC,UAAD,CAV9C,EAYrB;EACA,KAAK,CAAC,IAAN,CAAW,SAbU,CAAvB;;EAgBA,IAAI,KAAK,CAAC,IAAV,EAAgB;IACd,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,sBAAA,CAAuB,IADF,EAErB,CAAC,UAAU,KAAK,QAAf,IAA2B,UAAU,KAAK,aAA3C,KAA6D,iBAAiB,CAAC,mBAF1D,EAGrB,KAAK,CAAC,IAAN,CAAW,SAHU,CAAvB;EAKD;;EAED,iBAAA,CAAA,wBAAA,CAAyB,KAAzB;EAEA,OAAO,KAAP;AACD,CAlCM;;AAAM,OAAA,CAAA,8BAAA,GAA8B,8BAA9B","sourcesContent":["import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ButtonSlots } from '../Button/Button.types';\nimport type { ToggleButtonState } from './ToggleButton.types';\n\nexport const toggleButtonClassNames: SlotClassNames<ButtonSlots> = {\n root: 'fui-ToggleButton',\n icon: 'fui-ToggleButton__icon',\n};\n\nconst useRootCheckedStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n color: tokens.colorNeutralForeground1Selected,\n\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n color: tokens.colorNeutralForeground1Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n color: tokens.colorNeutralForeground1Pressed,\n },\n },\n\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n backgroundColor: 'Highlight',\n ...shorthands.borderColor('Highlight'),\n color: 'HighlightText',\n forcedColorAdjust: 'none',\n\n ':hover': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n },\n\n ':hover:active': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n },\n\n ':focus': {\n ...shorthands.borderColor('Highlight'),\n },\n },\n },\n highContrastFocusStyles: createCustomFocusIndicatorStyle({\n ...shorthands.border('1px', 'solid', 'HighlightText'),\n outlineColor: 'Highlight',\n }),\n\n // Appearance variations\n outline: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n ...shorthands.borderWidth(tokens.strokeWidthThicker),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n },\n\n ...createCustomFocusIndicatorStyle({\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n }),\n },\n primary: {\n backgroundColor: tokens.colorBrandBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n\n ':hover': {\n backgroundColor: tokens.colorBrandBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorBrandBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Selected,\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandSelected,\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n});\n\nconst useRootDisabledStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n ...shorthands.borderColor('transparent'),\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n },\n },\n});\n\nconst useIconCheckedStyles = makeStyles({\n // Appearance variations\n subtleOrTransparent: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\nexport const useToggleButtonStyles_unstable = (state: ToggleButtonState): ToggleButtonState => {\n const rootCheckedStyles = useRootCheckedStyles();\n const rootDisabledStyles = useRootDisabledStyles();\n const iconCheckedStyles = useIconCheckedStyles();\n\n const { appearance, checked, disabled, disabledFocusable } = state;\n\n state.root.className = mergeClasses(\n toggleButtonClassNames.root,\n\n // Checked styles\n checked && rootCheckedStyles.base,\n checked && rootCheckedStyles.highContrast,\n appearance && checked && rootCheckedStyles[appearance],\n\n // Disabled styles\n (disabled || disabledFocusable) && rootDisabledStyles.base,\n appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance],\n\n // User provided class name\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n toggleButtonClassNames.icon,\n (appearance === 'subtle' || appearance === 'transparent') && iconCheckedStyles.subtleOrTransparent,\n state.icon.className,\n );\n }\n\n useButtonStyles_unstable(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AAKaA,8BAAsB,GAAgC;EACjEC,IAAI,EAAE,kBAAkB;EACxBC,IAAI,EAAE;CACP;AAED,MAAMC,oBAAoB,gBAAGC,gBAAU;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;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ACjCJ,8BAAsB,CAACE,IAAI,EAC3B,CAACU,UAAU,KAAK,QAAQ,IAAIA,UAAU,KAAK,aAAa,KAAKD,iBAAiB,CAACQ,mBAAmB,EAClGX,KAAK,CAACN,IAAI,CAACc,SAAS,CACrB;;EAGHI,0CAAwB,CAACZ,KAAK,CAAC;EAE/B,OAAOA,KAAK;AACd,CAAC;AAlCYR,sCAA8B","names":["exports","root","icon","useRootCheckedStyles","react_1","useRootDisabledStyles","useIconCheckedStyles","useToggleButtonStyles_unstable","state","rootCheckedStyles","rootDisabledStyles","iconCheckedStyles","appearance","checked","disabled","disabledFocusable","className","base","highContrast","subtleOrTransparent","useButtonStyles_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-button/src/components/ToggleButton/useToggleButtonStyles.ts"],"sourcesContent":["import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ButtonSlots } from '../Button/Button.types';\nimport type { ToggleButtonState } from './ToggleButton.types';\n\nexport const toggleButtonClassNames: SlotClassNames<ButtonSlots> = {\n root: 'fui-ToggleButton',\n icon: 'fui-ToggleButton__icon',\n};\n\nconst useRootCheckedStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n color: tokens.colorNeutralForeground1Selected,\n\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n color: tokens.colorNeutralForeground1Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n color: tokens.colorNeutralForeground1Pressed,\n },\n },\n\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n backgroundColor: 'Highlight',\n ...shorthands.borderColor('Highlight'),\n color: 'HighlightText',\n forcedColorAdjust: 'none',\n\n ':hover': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n },\n\n ':hover:active': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n },\n\n ':focus': {\n ...shorthands.borderColor('Highlight'),\n },\n },\n },\n highContrastFocusStyles: createCustomFocusIndicatorStyle({\n ...shorthands.border('1px', 'solid', 'HighlightText'),\n outlineColor: 'Highlight',\n }),\n\n // Appearance variations\n outline: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n ...shorthands.borderWidth(tokens.strokeWidthThicker),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n },\n\n ...createCustomFocusIndicatorStyle({\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n }),\n },\n primary: {\n backgroundColor: tokens.colorBrandBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n\n ':hover': {\n backgroundColor: tokens.colorBrandBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorBrandBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Selected,\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandSelected,\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n});\n\nconst useRootDisabledStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n ...shorthands.borderColor('transparent'),\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n },\n },\n});\n\nconst useIconCheckedStyles = makeStyles({\n // Appearance variations\n subtleOrTransparent: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\nexport const useToggleButtonStyles_unstable = (state: ToggleButtonState): ToggleButtonState => {\n const rootCheckedStyles = useRootCheckedStyles();\n const rootDisabledStyles = useRootDisabledStyles();\n const iconCheckedStyles = useIconCheckedStyles();\n\n const { appearance, checked, disabled, disabledFocusable } = state;\n\n state.root.className = mergeClasses(\n toggleButtonClassNames.root,\n\n // Checked styles\n checked && rootCheckedStyles.base,\n checked && rootCheckedStyles.highContrast,\n appearance && checked && rootCheckedStyles[appearance],\n\n // Disabled styles\n (disabled || disabledFocusable) && rootDisabledStyles.base,\n appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance],\n\n // User provided class name\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n toggleButtonClassNames.icon,\n (appearance === 'subtle' || appearance === 'transparent') && iconCheckedStyles.subtleOrTransparent,\n state.icon.className,\n );\n }\n\n useButtonStyles_unstable(state);\n\n return state;\n};\n"]}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useToggleState = exports.useToggleButton_unstable = exports.useToggleButtonStyles_unstable = exports.toggleButtonClassNames = exports.renderToggleButton_unstable = exports.ToggleButton = exports.useSplitButton_unstable = exports.useSplitButtonStyles_unstable = exports.splitButtonClassNames = exports.renderSplitButton_unstable = exports.SplitButton = exports.useMenuButton_unstable = exports.useMenuButtonStyles_unstable = exports.renderMenuButton_unstable = exports.menuButtonClassNames = exports.MenuButton = exports.useCompoundButton_unstable = exports.useCompoundButtonStyles_unstable = exports.renderCompoundButton_unstable = exports.compoundButtonClassNames = exports.CompoundButton = exports.useButton_unstable = exports.useButtonStyles_unstable = exports.renderButton_unstable = exports.buttonClassNames = exports.Button = void 0;
7
-
8
7
  var Button_1 = /*#__PURE__*/require("./Button");
9
-
10
8
  Object.defineProperty(exports, "Button", {
11
9
  enumerable: true,
12
10
  get: function () {
@@ -37,9 +35,7 @@ Object.defineProperty(exports, "useButton_unstable", {
37
35
  return Button_1.useButton_unstable;
38
36
  }
39
37
  });
40
-
41
38
  var CompoundButton_1 = /*#__PURE__*/require("./CompoundButton");
42
-
43
39
  Object.defineProperty(exports, "CompoundButton", {
44
40
  enumerable: true,
45
41
  get: function () {
@@ -70,9 +66,7 @@ Object.defineProperty(exports, "useCompoundButton_unstable", {
70
66
  return CompoundButton_1.useCompoundButton_unstable;
71
67
  }
72
68
  });
73
-
74
69
  var MenuButton_1 = /*#__PURE__*/require("./MenuButton");
75
-
76
70
  Object.defineProperty(exports, "MenuButton", {
77
71
  enumerable: true,
78
72
  get: function () {
@@ -103,9 +97,7 @@ Object.defineProperty(exports, "useMenuButton_unstable", {
103
97
  return MenuButton_1.useMenuButton_unstable;
104
98
  }
105
99
  });
106
-
107
100
  var SplitButton_1 = /*#__PURE__*/require("./SplitButton");
108
-
109
101
  Object.defineProperty(exports, "SplitButton", {
110
102
  enumerable: true,
111
103
  get: function () {
@@ -136,9 +128,7 @@ Object.defineProperty(exports, "useSplitButton_unstable", {
136
128
  return SplitButton_1.useSplitButton_unstable;
137
129
  }
138
130
  });
139
-
140
131
  var ToggleButton_1 = /*#__PURE__*/require("./ToggleButton");
141
-
142
132
  Object.defineProperty(exports, "ToggleButton", {
143
133
  enumerable: true,
144
134
  get: function () {
@@ -169,9 +159,7 @@ Object.defineProperty(exports, "useToggleButton_unstable", {
169
159
  return ToggleButton_1.useToggleButton_unstable;
170
160
  }
171
161
  });
172
-
173
162
  var index_1 = /*#__PURE__*/require("./utils/index");
174
-
175
163
  Object.defineProperty(exports, "useToggleState", {
176
164
  enumerable: true,
177
165
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-button/src/index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,QAAA,gBAAA,OAAA,CAAA,UAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,QAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,QAAA,CAAA,MAAA;EAAM;AAAN,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,QAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,uBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,QAAA,CAAA,qBAAA;EAAqB;AAArB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,0BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,QAAA,CAAA,wBAAA;EAAwB;AAAxB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,QAAA,CAAA,kBAAA;EAAkB;AAAlB,CAAA;;AAGF,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,gBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,gBAAA,CAAA,cAAA;EAAc;AAAd,CAAA;AACA,MAAA,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AA,CAAA,OAAA,EAAA,6BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,cAAA,CAAA,2BAAA;EAA2B;AAA3B,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,cAAA,CAAA,sBAAA;EAAsB;AAAtB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,gCAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,cAAA,CAAA,8BAAA;EAA8B;AAA9B,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,0BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,cAAA,CAAA,wBAAA;EAAwB;AAAxB,CAAA;;AAIF,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,gBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,cAAA;EAAc;AAAd,CAAA","sourcesContent":["export {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './Button';\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './CompoundButton';\nexport type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './CompoundButton';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './MenuButton';\nexport type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './MenuButton';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './SplitButton';\nexport type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './SplitButton';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './ToggleButton';\nexport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton';\n\nexport { useToggleState } from './utils/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACEA;EAAAC;EAAAC;IAAA,sBAAM;EAAA;AAAA;AACNF;EAAAC;EAAAC;IAAA,gCAAgB;EAAA;AAAA;AAChBF;EAAAC;EAAAC;IAAA,qCAAqB;EAAA;AAAA;AACrBF;EAAAC;EAAAC;IAAA,wCAAwB;EAAA;AAAA;AACxBF;EAAAC;EAAAC;IAAA,kCAAkB;EAAA;AAAA;AAGpB;AACEF;EAAAC;EAAAC;IAAA,sCAAc;EAAA;AAAA;AACdF;EAAAC;EAAAC;IAAA,gDAAwB;EAAA;AAAA;AACxBF;EAAAC;EAAAC;IAAA,qDAA6B;EAAA;AAAA;AAC7BF;EAAAC;EAAAC;IAAA,wDAAgC;EAAA;AAAA;AAChCF;EAAAC;EAAAC;IAAA,kDAA0B;EAAA;AAAA;AAG5B;AACEF;EAAAC;EAAAC;IAAA,8BAAU;EAAA;AAAA;AACVF;EAAAC;EAAAC;IAAA,wCAAoB;EAAA;AAAA;AACpBF;EAAAC;EAAAC;IAAA,6CAAyB;EAAA;AAAA;AACzBF;EAAAC;EAAAC;IAAA,gDAA4B;EAAA;AAAA;AAC5BF;EAAAC;EAAAC;IAAA,0CAAsB;EAAA;AAAA;AAGxB;AACEF;EAAAC;EAAAC;IAAA,gCAAW;EAAA;AAAA;AACXF;EAAAC;EAAAC;IAAA,+CAA0B;EAAA;AAAA;AAC1BF;EAAAC;EAAAC;IAAA,0CAAqB;EAAA;AAAA;AACrBF;EAAAC;EAAAC;IAAA,kDAA6B;EAAA;AAAA;AAC7BF;EAAAC;EAAAC;IAAA,4CAAuB;EAAA;AAAA;AAGzB;AACEF;EAAAC;EAAAC;IAAA,kCAAY;EAAA;AAAA;AACZF;EAAAC;EAAAC;IAAA,iDAA2B;EAAA;AAAA;AAC3BF;EAAAC;EAAAC;IAAA,4CAAsB;EAAA;AAAA;AACtBF;EAAAC;EAAAC;IAAA,oDAA8B;EAAA;AAAA;AAC9BF;EAAAC;EAAAC;IAAA,8CAAwB;EAAA;AAAA;AAI1B;AAASF;EAAAC;EAAAC;IAAA,6BAAc;EAAA;AAAA","names":["Object","enumerable","get"],"sourceRoot":"../src/","sources":["packages/react-components/react-button/src/index.ts"],"sourcesContent":["export {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './Button';\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './CompoundButton';\nexport type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './CompoundButton';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './MenuButton';\nexport type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './MenuButton';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './SplitButton';\nexport type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './SplitButton';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './ToggleButton';\nexport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton';\n\nexport { useToggleState } from './utils/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./useToggleState"), exports);
10
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-button/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './useToggleState';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-button/src/utils/index.ts"],"sourcesContent":["export * from './useToggleState';\n"]}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useToggleState = void 0;
7
-
8
7
  const React = /*#__PURE__*/require("react");
9
-
10
8
  const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
-
12
9
  function useToggleState(props, state) {
13
10
  const {
14
11
  checked,
@@ -31,18 +28,18 @@ function useToggleState(props, state) {
31
28
  if (ev.defaultPrevented) {
32
29
  return;
33
30
  }
34
-
35
31
  setCheckedValue(!checkedValue);
36
32
  }
37
33
  }, [checkedValue, disabled, disabledFocusable, setCheckedValue]);
38
- return { ...state,
34
+ return {
35
+ ...state,
39
36
  checked: checkedValue,
40
- root: { ...state.root,
37
+ root: {
38
+ ...state.root,
41
39
  [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,
42
40
  onClick: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(onClick, onToggleClick))
43
41
  }
44
42
  };
45
43
  }
46
-
47
44
  exports.useToggleState = useToggleState;
48
45
  //# sourceMappingURL=useToggleState.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-button/src/utils/useToggleState.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAIA,SAAgB,cAAhB,CAIE,KAJF,EAI6B,KAJ7B,EAIgD;EAC9C,MAAM;IAAE,OAAF;IAAW,cAAX;IAA2B,QAA3B;IAAqC;EAArC,IAA2D,KAAjE;EACA,MAAM;IAAE,OAAF;IAAW;EAAX,IAAoB,KAAK,CAAC,IAAhC;EAEA,MAAM,CAAC,YAAD,EAAe,eAAf,IAAkC,iBAAA,CAAA,oBAAA,CAAqB;IAC3D,KAAK,EAAE,OADoD;IAE3D,YAAY,EAAE,cAF6C;IAG3D,YAAY,EAAE;EAH6C,CAArB,CAAxC;EAMA,MAAM,kBAAkB,GAAG,IAAI,KAAK,kBAAT,IAA+B,IAAI,KAAK,UAAnE;EAEA,MAAM,aAAa,GAAG,KAAK,CAAC,WAAN,CACpB,EAAE,IAAG;IACH,IAAI,CAAC,QAAD,IAAa,CAAC,iBAAlB,EAAqC;MACnC,IAAI,EAAE,CAAC,gBAAP,EAAyB;QACvB;MACD;;MAED,eAAe,CAAC,CAAC,YAAF,CAAf;IACD;EACF,CATmB,EAUpB,CAAC,YAAD,EAAe,QAAf,EAAyB,iBAAzB,EAA4C,eAA5C,CAVoB,CAAtB;EAaA,OAAO,EACL,GAAG,KADE;IAGL,OAAO,EAAE,YAHJ;IAKL,IAAI,EAAE,EACJ,GAAG,KAAK,CAAC,IADL;MAEJ,CAAC,kBAAkB,GAAG,cAAH,GAAoB,cAAvC,GAAwD,YAFpD;MAGJ,OAAO,EAAE,iBAAA,CAAA,gBAAA,CACP,iBAAA,CAAA,cAAA,CAAe,OAAf,EAA0F,aAA1F,CADO;IAHL;EALD,CAAP;AAaD;;AA1CD,OAAA,CAAA,cAAA,GAAA,cAAA","sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport type { ButtonState } from '../Button';\nimport type { ToggleButtonProps, ToggleButtonState } from '../ToggleButton';\n\nexport function useToggleState<\n TToggleButtonProps extends Pick<ToggleButtonProps, 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable'>,\n TButtonState extends Pick<ButtonState, 'root'>,\n TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root'>\n>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState {\n const { checked, defaultChecked, disabled, disabledFocusable } = props;\n const { onClick, role } = state.root;\n\n const [checkedValue, setCheckedValue] = useControllableState({\n state: checked,\n defaultState: defaultChecked,\n initialState: false,\n });\n\n const isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';\n\n const onToggleClick = React.useCallback(\n ev => {\n if (!disabled && !disabledFocusable) {\n if (ev.defaultPrevented) {\n return;\n }\n\n setCheckedValue(!checkedValue);\n }\n },\n [checkedValue, disabled, disabledFocusable, setCheckedValue],\n );\n\n return {\n ...state,\n\n checked: checkedValue,\n\n root: {\n ...state.root,\n [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,\n onClick: useEventCallback(\n mergeCallbacks(onClick as React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>, onToggleClick),\n ),\n },\n } as TToggleButtonState;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AAIA,SAAgBA,cAAc,CAI5BC,KAAyB,EAAEC,KAAmB;EAC9C,MAAM;IAAEC,OAAO;IAAEC,cAAc;IAAEC,QAAQ;IAAEC;EAAiB,CAAE,GAAGL,KAAK;EACtE,MAAM;IAAEM,OAAO;IAAEC;EAAI,CAAE,GAAGN,KAAK,CAACO,IAAI;EAEpC,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGC,sCAAoB,CAAC;IAC3DV,KAAK,EAAEC,OAAO;IACdU,YAAY,EAAET,cAAc;IAC5BU,YAAY,EAAE;GACf,CAAC;EAEF,MAAMC,kBAAkB,GAAGP,IAAI,KAAK,kBAAkB,IAAIA,IAAI,KAAK,UAAU;EAE7E,MAAMQ,aAAa,GAAGC,KAAK,CAACC,WAAW,CACrCC,EAAE,IAAG;IACH,IAAI,CAACd,QAAQ,IAAI,CAACC,iBAAiB,EAAE;MACnC,IAAIa,EAAE,CAACC,gBAAgB,EAAE;QACvB;;MAGFT,eAAe,CAAC,CAACD,YAAY,CAAC;;EAElC,CAAC,EACD,CAACA,YAAY,EAAEL,QAAQ,EAAEC,iBAAiB,EAAEK,eAAe,CAAC,CAC7D;EAED,OAAO;IACL,GAAGT,KAAK;IAERC,OAAO,EAAEO,YAAY;IAErBD,IAAI,EAAE;MACJ,GAAGP,KAAK,CAACO,IAAI;MACb,CAACM,kBAAkB,GAAG,cAAc,GAAG,cAAc,GAAGL,YAAY;MACpEH,OAAO,EAAEK,kCAAgB,CACvBA,gCAAc,CAACL,OAAyE,EAAES,aAAa,CAAC;;GAGvF;AACzB;AA1CAK","names":["useToggleState","props","state","checked","defaultChecked","disabled","disabledFocusable","onClick","role","root","checkedValue","setCheckedValue","react_utilities_1","defaultState","initialState","isCheckboxTypeRole","onToggleClick","React","useCallback","ev","defaultPrevented","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-button/src/utils/useToggleState.ts"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport type { ButtonState } from '../Button';\nimport type { ToggleButtonProps, ToggleButtonState } from '../ToggleButton';\n\nexport function useToggleState<\n TToggleButtonProps extends Pick<ToggleButtonProps, 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable'>,\n TButtonState extends Pick<ButtonState, 'root'>,\n TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root'>\n>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState {\n const { checked, defaultChecked, disabled, disabledFocusable } = props;\n const { onClick, role } = state.root;\n\n const [checkedValue, setCheckedValue] = useControllableState({\n state: checked,\n defaultState: defaultChecked,\n initialState: false,\n });\n\n const isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';\n\n const onToggleClick = React.useCallback(\n ev => {\n if (!disabled && !disabledFocusable) {\n if (ev.defaultPrevented) {\n return;\n }\n\n setCheckedValue(!checkedValue);\n }\n },\n [checkedValue, disabled, disabledFocusable, setCheckedValue],\n );\n\n return {\n ...state,\n\n checked: checkedValue,\n\n root: {\n ...state.root,\n [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,\n onClick: useEventCallback(\n mergeCallbacks(onClick as React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>, onToggleClick),\n ),\n },\n } as TToggleButtonState;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-button",
3
- "version": "9.1.12",
3
+ "version": "9.1.13",
4
4
  "description": "Fluent UI React Button component.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -28,17 +28,17 @@
28
28
  "@fluentui/a11y-testing": "^0.1.0",
29
29
  "@fluentui/eslint-plugin": "*",
30
30
  "@fluentui/react-conformance": "*",
31
- "@fluentui/react-conformance-griffel": "9.0.0-beta.18",
32
- "@fluentui/scripts": "^1.0.0"
31
+ "@fluentui/react-conformance-griffel": "9.0.0-beta.19",
32
+ "@fluentui/scripts": "*"
33
33
  },
34
34
  "dependencies": {
35
35
  "@fluentui/keyboard-keys": "^9.0.1",
36
- "@fluentui/react-aria": "^9.3.3",
36
+ "@fluentui/react-aria": "^9.3.4",
37
37
  "@fluentui/react-icons": "^2.0.175",
38
- "@fluentui/react-tabster": "^9.3.4",
38
+ "@fluentui/react-tabster": "^9.3.5",
39
39
  "@fluentui/react-theme": "^9.1.5",
40
- "@fluentui/react-utilities": "^9.3.0",
41
- "@griffel/react": "^1.4.2",
40
+ "@fluentui/react-utilities": "^9.3.1",
41
+ "@griffel/react": "^1.5.2",
42
42
  "tslib": "^2.1.0"
43
43
  },
44
44
  "peerDependencies": {