@fluentui/react-button 9.72.9-experimental.component-base-hooks.20260122-49fc330360.0 → 9.74.3-experimental.esm.20260709-49ee7a20cf.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/CHANGELOG.md +116 -12
  2. package/dist/index.d.cts +331 -0
  3. package/dist/index.d.ts +50 -52
  4. package/lib/Button.js +1 -1
  5. package/lib/Button.js.map +1 -1
  6. package/lib/CompoundButton.js +1 -1
  7. package/lib/CompoundButton.js.map +1 -1
  8. package/lib/MenuButton.js +1 -1
  9. package/lib/MenuButton.js.map +1 -1
  10. package/lib/SplitButton.js +1 -1
  11. package/lib/SplitButton.js.map +1 -1
  12. package/lib/ToggleButton.js +1 -1
  13. package/lib/ToggleButton.js.map +1 -1
  14. package/lib/components/Button/Button.js +5 -5
  15. package/lib/components/Button/Button.js.map +1 -1
  16. package/lib/components/Button/Button.types.js.map +1 -1
  17. package/lib/components/Button/index.js +4 -5
  18. package/lib/components/Button/index.js.map +1 -1
  19. package/lib/components/Button/renderButton.js +1 -1
  20. package/lib/components/Button/renderButton.js.map +1 -1
  21. package/lib/components/Button/useButton.js +35 -6
  22. package/lib/components/Button/useButton.js.map +1 -1
  23. package/lib/components/Button/useButtonStyles.styles.js +6 -6
  24. package/lib/components/Button/useButtonStyles.styles.js.map +1 -1
  25. package/lib/components/Button/useButtonStyles.styles.raw.js +6 -5
  26. package/lib/components/Button/useButtonStyles.styles.raw.js.map +1 -1
  27. package/lib/components/CompoundButton/CompoundButton.js +5 -5
  28. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  29. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  30. package/lib/components/CompoundButton/index.js +4 -5
  31. package/lib/components/CompoundButton/index.js.map +1 -1
  32. package/lib/components/CompoundButton/renderCompoundButton.js +1 -1
  33. package/lib/components/CompoundButton/useCompoundButton.js +23 -11
  34. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  35. package/lib/components/CompoundButton/useCompoundButtonStyles.styles.js +7 -5
  36. package/lib/components/CompoundButton/useCompoundButtonStyles.styles.js.map +1 -1
  37. package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js +7 -4
  38. package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +1 -1
  39. package/lib/components/MenuButton/MenuButton.js +5 -5
  40. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  41. package/lib/components/MenuButton/MenuButton.types.js +3 -1
  42. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  43. package/lib/components/MenuButton/index.js +4 -5
  44. package/lib/components/MenuButton/index.js.map +1 -1
  45. package/lib/components/MenuButton/renderMenuButton.js +1 -1
  46. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  47. package/lib/components/MenuButton/useMenuButton.js +52 -14
  48. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  49. package/lib/components/MenuButton/useMenuButtonStyles.styles.js +7 -6
  50. package/lib/components/MenuButton/useMenuButtonStyles.styles.js.map +1 -1
  51. package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js +7 -5
  52. package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +1 -1
  53. package/lib/components/SplitButton/SplitButton.js +5 -5
  54. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  55. package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
  56. package/lib/components/SplitButton/index.js +4 -5
  57. package/lib/components/SplitButton/index.js.map +1 -1
  58. package/lib/components/SplitButton/renderSplitButton.js +1 -1
  59. package/lib/components/SplitButton/useSplitButton.js +53 -17
  60. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  61. package/lib/components/SplitButton/useSplitButtonStyles.styles.js +6 -5
  62. package/lib/components/SplitButton/useSplitButtonStyles.styles.js.map +1 -1
  63. package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js +6 -4
  64. package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +1 -1
  65. package/lib/components/ToggleButton/ToggleButton.js +5 -5
  66. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  67. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  68. package/lib/components/ToggleButton/index.js +4 -5
  69. package/lib/components/ToggleButton/index.js.map +1 -1
  70. package/lib/components/ToggleButton/renderToggleButton.js +1 -1
  71. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
  72. package/lib/components/ToggleButton/useToggleButton.js +16 -14
  73. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  74. package/lib/components/ToggleButton/useToggleButtonStyles.styles.js +65 -9
  75. package/lib/components/ToggleButton/useToggleButtonStyles.styles.js.map +1 -1
  76. package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js +58 -10
  77. package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +1 -1
  78. package/lib/contexts/ButtonContext.js +5 -3
  79. package/lib/contexts/ButtonContext.js.map +1 -1
  80. package/lib/contexts/index.js +1 -1
  81. package/lib/contexts/index.js.map +1 -1
  82. package/lib/index.js +7 -13
  83. package/lib/index.js.map +1 -1
  84. package/lib/utils/index.js +1 -1
  85. package/lib/utils/index.js.map +1 -1
  86. package/lib/utils/useToggleState.js +4 -3
  87. package/lib/utils/useToggleState.js.map +1 -1
  88. package/lib-commonjs/{Button.js → Button.cjs} +1 -1
  89. package/lib-commonjs/{Button.js.map → Button.cjs.map} +1 -1
  90. package/lib-commonjs/{CompoundButton.js → CompoundButton.cjs} +1 -4
  91. package/lib-commonjs/CompoundButton.cjs.map +1 -0
  92. package/lib-commonjs/{MenuButton.js → MenuButton.cjs} +1 -1
  93. package/lib-commonjs/{MenuButton.js.map → MenuButton.cjs.map} +1 -1
  94. package/lib-commonjs/{SplitButton.js → SplitButton.cjs} +1 -4
  95. package/lib-commonjs/SplitButton.cjs.map +1 -0
  96. package/lib-commonjs/{ToggleButton.js → ToggleButton.cjs} +1 -1
  97. package/lib-commonjs/{ToggleButton.js.map → ToggleButton.cjs.map} +1 -1
  98. package/lib-commonjs/components/Button/{Button.js → Button.cjs} +3 -3
  99. package/lib-commonjs/components/Button/{Button.js.map → Button.cjs.map} +1 -1
  100. package/lib-commonjs/components/Button/{Button.types.js.map → Button.types.cjs.map} +1 -1
  101. package/lib-commonjs/components/Button/{index.js → index.cjs} +5 -6
  102. package/lib-commonjs/components/Button/index.cjs.map +1 -0
  103. package/lib-commonjs/components/Button/renderButton.cjs.map +1 -0
  104. package/lib-commonjs/components/Button/useButton.cjs +58 -0
  105. package/lib-commonjs/components/Button/useButton.cjs.map +1 -0
  106. package/lib-commonjs/components/Button/{useButtonStyles.styles.js → useButtonStyles.styles.cjs} +2 -1
  107. package/lib-commonjs/components/Button/useButtonStyles.styles.cjs.map +1 -0
  108. package/lib-commonjs/components/Button/{useButtonStyles.styles.raw.js → useButtonStyles.styles.raw.cjs} +2 -1
  109. package/lib-commonjs/components/Button/{useButtonStyles.styles.raw.js.map → useButtonStyles.styles.raw.cjs.map} +1 -1
  110. package/lib-commonjs/components/CompoundButton/{CompoundButton.js → CompoundButton.cjs} +3 -3
  111. package/lib-commonjs/components/CompoundButton/{CompoundButton.js.map → CompoundButton.cjs.map} +1 -1
  112. package/lib-commonjs/components/CompoundButton/CompoundButton.types.cjs.map +1 -0
  113. package/lib-commonjs/components/CompoundButton/{index.js → index.cjs} +4 -8
  114. package/lib-commonjs/components/CompoundButton/index.cjs.map +1 -0
  115. package/lib-commonjs/components/CompoundButton/{useCompoundButtonBase.js → useCompoundButton.cjs} +6 -7
  116. package/lib-commonjs/components/CompoundButton/useCompoundButton.cjs.map +1 -0
  117. package/lib-commonjs/components/CompoundButton/{useCompoundButtonStyles.styles.js → useCompoundButtonStyles.styles.cjs} +5 -2
  118. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.cjs.map +1 -0
  119. package/lib-commonjs/components/CompoundButton/{useCompoundButtonStyles.styles.raw.js → useCompoundButtonStyles.styles.raw.cjs} +5 -2
  120. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.cjs.map +1 -0
  121. package/lib-commonjs/components/MenuButton/{MenuButton.js → MenuButton.cjs} +3 -3
  122. package/lib-commonjs/components/MenuButton/{MenuButton.js.map → MenuButton.cjs.map} +1 -1
  123. package/lib-commonjs/components/MenuButton/MenuButton.types.cjs +6 -0
  124. package/lib-commonjs/components/MenuButton/MenuButton.types.cjs.map +1 -0
  125. package/lib-commonjs/components/MenuButton/{index.js → index.cjs} +5 -6
  126. package/lib-commonjs/components/MenuButton/index.cjs.map +1 -0
  127. package/lib-commonjs/components/MenuButton/renderMenuButton.cjs.map +1 -0
  128. package/lib-commonjs/components/MenuButton/useMenuButton.cjs +65 -0
  129. package/lib-commonjs/components/MenuButton/useMenuButton.cjs.map +1 -0
  130. package/lib-commonjs/components/MenuButton/{useMenuButtonStyles.styles.js → useMenuButtonStyles.styles.cjs} +4 -2
  131. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.cjs.map +1 -0
  132. package/lib-commonjs/components/MenuButton/{useMenuButtonStyles.styles.raw.js → useMenuButtonStyles.styles.raw.cjs} +4 -2
  133. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.cjs.map +1 -0
  134. package/lib-commonjs/components/SplitButton/{SplitButton.js → SplitButton.cjs} +3 -3
  135. package/lib-commonjs/components/SplitButton/SplitButton.cjs.map +1 -0
  136. package/lib-commonjs/components/SplitButton/SplitButton.types.cjs.map +1 -0
  137. package/lib-commonjs/components/SplitButton/{index.js → index.cjs} +4 -8
  138. package/lib-commonjs/components/SplitButton/index.cjs.map +1 -0
  139. package/lib-commonjs/components/SplitButton/{useSplitButtonBase.js → useSplitButton.cjs} +21 -14
  140. package/lib-commonjs/components/SplitButton/useSplitButton.cjs.map +1 -0
  141. package/lib-commonjs/components/SplitButton/{useSplitButtonStyles.styles.js → useSplitButtonStyles.styles.cjs} +3 -1
  142. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.cjs.map +1 -0
  143. package/lib-commonjs/components/SplitButton/{useSplitButtonStyles.styles.raw.js → useSplitButtonStyles.styles.raw.cjs} +3 -1
  144. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.cjs.map +1 -0
  145. package/lib-commonjs/components/ToggleButton/{ToggleButton.js → ToggleButton.cjs} +3 -3
  146. package/lib-commonjs/components/ToggleButton/{ToggleButton.js.map → ToggleButton.cjs.map} +1 -1
  147. package/lib-commonjs/components/ToggleButton/ToggleButton.types.cjs.map +1 -0
  148. package/lib-commonjs/components/ToggleButton/{index.js → index.cjs} +5 -6
  149. package/lib-commonjs/components/ToggleButton/index.cjs.map +1 -0
  150. package/lib-commonjs/components/ToggleButton/{renderToggleButton.js → renderToggleButton.cjs} +1 -1
  151. package/lib-commonjs/components/ToggleButton/{renderToggleButton.js.map → renderToggleButton.cjs.map} +1 -1
  152. package/lib-commonjs/components/ToggleButton/useToggleButton.cjs +31 -0
  153. package/lib-commonjs/components/ToggleButton/useToggleButton.cjs.map +1 -0
  154. package/lib-commonjs/components/ToggleButton/{useToggleButtonStyles.styles.js → useToggleButtonStyles.styles.cjs} +119 -5
  155. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.cjs.map +1 -0
  156. package/lib-commonjs/components/ToggleButton/{useToggleButtonStyles.styles.raw.js → useToggleButtonStyles.styles.raw.cjs} +51 -6
  157. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.cjs.map +1 -0
  158. package/lib-commonjs/contexts/ButtonContext.cjs.map +1 -0
  159. package/lib-commonjs/contexts/{index.js → index.cjs} +1 -1
  160. package/lib-commonjs/contexts/{index.js.map → index.cjs.map} +1 -1
  161. package/lib-commonjs/{index.js → index.cjs} +7 -13
  162. package/lib-commonjs/index.cjs.map +1 -0
  163. package/lib-commonjs/utils/{index.js → index.cjs} +1 -1
  164. package/lib-commonjs/utils/{index.js.map → index.cjs.map} +1 -1
  165. package/lib-commonjs/utils/{useToggleState.js → useToggleState.cjs} +2 -1
  166. package/lib-commonjs/utils/useToggleState.cjs.map +1 -0
  167. package/package.json +20 -14
  168. package/lib/components/Button/useButtonBase.js +0 -34
  169. package/lib/components/Button/useButtonBase.js.map +0 -1
  170. package/lib/components/CompoundButton/useCompoundButtonBase.js +0 -31
  171. package/lib/components/CompoundButton/useCompoundButtonBase.js.map +0 -1
  172. package/lib/components/MenuButton/useMenuButtonBase.js +0 -27
  173. package/lib/components/MenuButton/useMenuButtonBase.js.map +0 -1
  174. package/lib/components/SplitButton/useSplitButtonBase.js +0 -57
  175. package/lib/components/SplitButton/useSplitButtonBase.js.map +0 -1
  176. package/lib/components/ToggleButton/useToggleButtonBase.js +0 -13
  177. package/lib/components/ToggleButton/useToggleButtonBase.js.map +0 -1
  178. package/lib-commonjs/CompoundButton.js.map +0 -1
  179. package/lib-commonjs/SplitButton.js.map +0 -1
  180. package/lib-commonjs/components/Button/index.js.map +0 -1
  181. package/lib-commonjs/components/Button/renderButton.js.map +0 -1
  182. package/lib-commonjs/components/Button/useButton.js +0 -27
  183. package/lib-commonjs/components/Button/useButton.js.map +0 -1
  184. package/lib-commonjs/components/Button/useButtonBase.js +0 -41
  185. package/lib-commonjs/components/Button/useButtonBase.js.map +0 -1
  186. package/lib-commonjs/components/Button/useButtonStyles.styles.js.map +0 -1
  187. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +0 -1
  188. package/lib-commonjs/components/CompoundButton/index.js.map +0 -1
  189. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +0 -26
  190. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +0 -1
  191. package/lib-commonjs/components/CompoundButton/useCompoundButtonBase.js.map +0 -1
  192. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.js.map +0 -1
  193. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +0 -1
  194. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +0 -1
  195. package/lib-commonjs/components/MenuButton/index.js.map +0 -1
  196. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +0 -1
  197. package/lib-commonjs/components/MenuButton/useMenuButton.js +0 -32
  198. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +0 -1
  199. package/lib-commonjs/components/MenuButton/useMenuButtonBase.js +0 -36
  200. package/lib-commonjs/components/MenuButton/useMenuButtonBase.js.map +0 -1
  201. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.js.map +0 -1
  202. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +0 -1
  203. package/lib-commonjs/components/SplitButton/SplitButton.js.map +0 -1
  204. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +0 -1
  205. package/lib-commonjs/components/SplitButton/index.js.map +0 -1
  206. package/lib-commonjs/components/SplitButton/useSplitButton.js +0 -36
  207. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +0 -1
  208. package/lib-commonjs/components/SplitButton/useSplitButtonBase.js.map +0 -1
  209. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.js.map +0 -1
  210. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +0 -1
  211. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +0 -4
  212. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +0 -1
  213. package/lib-commonjs/components/ToggleButton/index.js.map +0 -1
  214. package/lib-commonjs/components/ToggleButton/useToggleButton.js +0 -27
  215. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +0 -1
  216. package/lib-commonjs/components/ToggleButton/useToggleButtonBase.js +0 -19
  217. package/lib-commonjs/components/ToggleButton/useToggleButtonBase.js.map +0 -1
  218. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.js.map +0 -1
  219. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +0 -1
  220. package/lib-commonjs/contexts/ButtonContext.js.map +0 -1
  221. package/lib-commonjs/index.js.map +0 -1
  222. package/lib-commonjs/utils/useToggleState.js.map +0 -1
  223. /package/lib-commonjs/components/Button/{Button.types.js → Button.types.cjs} +0 -0
  224. /package/lib-commonjs/components/Button/{renderButton.js → renderButton.cjs} +0 -0
  225. /package/lib-commonjs/components/CompoundButton/{CompoundButton.types.js → CompoundButton.types.cjs} +0 -0
  226. /package/lib-commonjs/components/CompoundButton/{renderCompoundButton.js → renderCompoundButton.cjs} +0 -0
  227. /package/lib-commonjs/components/CompoundButton/{renderCompoundButton.js.map → renderCompoundButton.cjs.map} +0 -0
  228. /package/lib-commonjs/components/MenuButton/{renderMenuButton.js → renderMenuButton.cjs} +0 -0
  229. /package/lib-commonjs/components/{MenuButton/MenuButton.types.js → SplitButton/SplitButton.types.cjs} +0 -0
  230. /package/lib-commonjs/components/SplitButton/{renderSplitButton.js → renderSplitButton.cjs} +0 -0
  231. /package/lib-commonjs/components/SplitButton/{renderSplitButton.js.map → renderSplitButton.cjs.map} +0 -0
  232. /package/lib-commonjs/components/{SplitButton/SplitButton.types.js → ToggleButton/ToggleButton.types.cjs} +0 -0
  233. /package/lib-commonjs/contexts/{ButtonContext.js → ButtonContext.cjs} +0 -0
@@ -1,9 +1,9 @@
1
1
  'use client';
2
- import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';
3
- import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
4
- import { tokens } from '@fluentui/react-theme';
5
- import { shorthands, mergeClasses, makeStyles } from '@griffel/react';
6
- import { useButtonStyles_unstable } from '../Button/useButtonStyles.styles';
2
+ import { iconFilledClassName, iconRegularClassName } from "@fluentui/react-icons";
3
+ import { createCustomFocusIndicatorStyle } from "@fluentui/react-tabster";
4
+ import { tokens } from "@fluentui/react-theme";
5
+ import { shorthands, mergeClasses, makeStyles } from "@griffel/react";
6
+ import { useButtonStyles_unstable } from "../Button/useButtonStyles.styles.js";
7
7
  export const toggleButtonClassNames = {
8
8
  root: 'fui-ToggleButton',
9
9
  icon: 'fui-ToggleButton__icon'
@@ -118,6 +118,51 @@ const useRootCheckedStyles = makeStyles({
118
118
  }
119
119
  }
120
120
  });
121
+ const useCheckedAccessibleStyles = makeStyles({
122
+ // Base styles
123
+ base: {
124
+ backgroundColor: tokens.colorBrandBackground,
125
+ ...shorthands.borderColor('transparent'),
126
+ color: tokens.colorNeutralForegroundOnBrand,
127
+ ':hover': {
128
+ backgroundColor: tokens.colorBrandBackgroundHover,
129
+ ...shorthands.borderColor('transparent'),
130
+ color: tokens.colorNeutralForegroundOnBrand
131
+ },
132
+ ':hover:active,:active:focus-visible': {
133
+ backgroundColor: tokens.colorBrandBackgroundPressed,
134
+ ...shorthands.borderColor('transparent'),
135
+ color: tokens.colorNeutralForegroundOnBrand
136
+ }
137
+ },
138
+ // Appearance variations
139
+ outline: {
140
+ // There's no longer a reason to thicken the outline variant's border
141
+ ...shorthands.borderWidth(tokens.strokeWidthThin)
142
+ },
143
+ primary: {
144
+ // primary has an inner stroke for the checked style
145
+ outline: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralForegroundOnBrand}`,
146
+ outlineOffset: `calc(${tokens.strokeWidthThicker} * -1)`,
147
+ // need to not have the default focus style that removes the outline
148
+ ...createCustomFocusIndicatorStyle({
149
+ outline: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralForegroundOnBrand}`,
150
+ outlineOffset: `calc(${tokens.strokeWidthThickest} * -1)`
151
+ })
152
+ },
153
+ subtle: {
154
+ // override subtle-appearance-specific icon color on hover
155
+ ':hover': {
156
+ [`& .${toggleButtonClassNames.icon}`]: {
157
+ color: tokens.colorNeutralForegroundOnBrand
158
+ }
159
+ }
160
+ },
161
+ transparent: {
162
+ },
163
+ secondary: {
164
+ }
165
+ });
121
166
  const useRootDisabledStyles = makeStyles({
122
167
  // Base styles
123
168
  base: {
@@ -175,7 +220,7 @@ const useRootDisabledStyles = makeStyles({
175
220
  }
176
221
  });
177
222
  const useIconCheckedStyles = makeStyles({
178
- // Appearance variations
223
+ // Appearance variations with isAccessible=false
179
224
  subtleOrTransparent: {
180
225
  color: tokens.colorNeutralForeground2BrandSelected
181
226
  },
@@ -208,19 +253,22 @@ const usePrimaryHighContrastStyles = makeStyles({
208
253
  }
209
254
  });
210
255
  export const useToggleButtonStyles_unstable = (state)=>{
211
- 'use no memo';
212
256
  const rootCheckedStyles = useRootCheckedStyles();
257
+ const accessibleCheckedStyles = useCheckedAccessibleStyles();
213
258
  const rootDisabledStyles = useRootDisabledStyles();
214
259
  const iconCheckedStyles = useIconCheckedStyles();
215
260
  const primaryHighContrastStyles = usePrimaryHighContrastStyles();
216
- const { appearance, checked, disabled, disabledFocusable } = state;
261
+ const { appearance, checked, disabled, disabledFocusable, isAccessible } = state;
262
+ // eslint-disable-next-line react-hooks/immutability
217
263
  state.root.className = mergeClasses(toggleButtonClassNames.root, // Primary high contrast styles
218
264
  appearance === 'primary' && primaryHighContrastStyles.base, appearance === 'primary' && (disabled || disabledFocusable) && primaryHighContrastStyles.disabled, // Checked styles
219
- checked && rootCheckedStyles.base, checked && rootCheckedStyles.highContrast, appearance && checked && rootCheckedStyles[appearance], // Disabled styles
265
+ checked && rootCheckedStyles.base, checked && rootCheckedStyles.highContrast, appearance && checked && rootCheckedStyles[appearance], // Opt-in accessible checked styles
266
+ isAccessible && checked && accessibleCheckedStyles.base, isAccessible && appearance && checked && accessibleCheckedStyles[appearance], // Disabled styles
220
267
  (disabled || disabledFocusable) && rootDisabledStyles.base, appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance], // User provided class name
221
268
  state.root.className);
222
269
  if (state.icon) {
223
- state.icon.className = mergeClasses(toggleButtonClassNames.icon, checked && (appearance === 'subtle' || appearance === 'transparent') && iconCheckedStyles.subtleOrTransparent, iconCheckedStyles.highContrast, state.icon.className);
270
+ // eslint-disable-next-line react-hooks/immutability
271
+ state.icon.className = mergeClasses(toggleButtonClassNames.icon, checked && !isAccessible && (appearance === 'subtle' || appearance === 'transparent') && iconCheckedStyles.subtleOrTransparent, iconCheckedStyles.highContrast, state.icon.className);
224
272
  }
225
273
  useButtonStyles_unstable(state);
226
274
  return state;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ToggleButton/useToggleButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { 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.styles';\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,:active:focus-visible': {\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,:active:focus-visible': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n },\n\n ':focus': {\n border: '1px solid HighlightText',\n outlineColor: 'Highlight',\n },\n },\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,:active:focus-visible': {\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,:active:focus-visible': {\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,:active:focus-visible': {\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,:active:focus-visible': {\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,:active:focus-visible': {\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,:active:focus-visible': {\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,:active:focus-visible': {\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,:active:focus-visible': {\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 // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto',\n },\n },\n});\n\nconst usePrimaryHighContrastStyles = makeStyles({\n // Do not use primary variant high contrast styles for toggle buttons\n // otherwise there isn't enough difference between on/off states\n base: {\n '@media (forced-colors: active)': {\n backgroundColor: 'ButtonFace',\n ...shorthands.borderColor('ButtonBorder'),\n color: 'ButtonText',\n forcedColorAdjust: 'auto',\n },\n },\n\n disabled: {\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n color: 'GrayText',\n\n ':focus': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n },\n});\n\nexport const useToggleButtonStyles_unstable = (state: ToggleButtonState): ToggleButtonState => {\n 'use no memo';\n\n const rootCheckedStyles = useRootCheckedStyles();\n const rootDisabledStyles = useRootDisabledStyles();\n const iconCheckedStyles = useIconCheckedStyles();\n const primaryHighContrastStyles = usePrimaryHighContrastStyles();\n\n const { appearance, checked, disabled, disabledFocusable } = state;\n\n state.root.className = mergeClasses(\n toggleButtonClassNames.root,\n\n // Primary high contrast styles\n appearance === 'primary' && primaryHighContrastStyles.base,\n appearance === 'primary' && (disabled || disabledFocusable) && primaryHighContrastStyles.disabled,\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 checked && (appearance === 'subtle' || appearance === 'transparent') && iconCheckedStyles.subtleOrTransparent,\n iconCheckedStyles.highContrast,\n state.icon.className,\n );\n }\n\n useButtonStyles_unstable(state);\n\n return state;\n};\n"],"names":["iconFilledClassName","iconRegularClassName","createCustomFocusIndicatorStyle","tokens","shorthands","mergeClasses","makeStyles","useButtonStyles_unstable","toggleButtonClassNames","root","icon","useRootCheckedStyles","base","backgroundColor","colorNeutralBackground1Selected","borderColor","colorNeutralStroke1","color","colorNeutralForeground1Selected","borderWidth","strokeWidthThin","display","colorNeutralBackground1Hover","colorNeutralStroke1Hover","colorNeutralForeground1Hover","colorNeutralBackground1Pressed","colorNeutralStroke1Pressed","colorNeutralForeground1Pressed","highContrast","forcedColorAdjust","border","outlineColor","outline","colorTransparentBackgroundSelected","strokeWidthThicker","colorTransparentBackgroundHover","colorTransparentBackgroundPressed","primary","colorBrandBackgroundSelected","colorNeutralForegroundOnBrand","colorBrandBackgroundHover","colorBrandBackgroundPressed","secondary","subtle","colorSubtleBackgroundSelected","colorNeutralForeground2Selected","colorSubtleBackgroundHover","colorNeutralForeground2Hover","colorSubtleBackgroundPressed","colorNeutralForeground2Pressed","transparent","colorNeutralForeground2BrandSelected","colorNeutralForeground2BrandHover","colorNeutralForeground2BrandPressed","useRootDisabledStyles","colorNeutralBackgroundDisabled","colorNeutralStrokeDisabled","colorNeutralForegroundDisabled","colorTransparentBackground","useIconCheckedStyles","subtleOrTransparent","usePrimaryHighContrastStyles","disabled","useToggleButtonStyles_unstable","state","rootCheckedStyles","rootDisabledStyles","iconCheckedStyles","primaryHighContrastStyles","appearance","checked","disabledFocusable","className"],"mappings":"AAAA;AAEA,SAASA,mBAAmB,EAAEC,oBAAoB,QAAQ,wBAAwB;AAClF,SAASC,+BAA+B,QAAQ,0BAA0B;AAC1E,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,UAAU,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AACtE,SAASC,wBAAwB,QAAQ,mCAAmC;AAK5E,OAAO,MAAMC,yBAAsD;IACjEC,MAAM;IACNC,MAAM;AACR,EAAE;AAEF,MAAMC,uBAAuBL,WAAW;IACtC,cAAc;IACdM,MAAM;QACJC,iBAAiBV,OAAOW,+BAA+B;QACvD,GAAGV,WAAWW,WAAW,CAACZ,OAAO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;IAGtB,IAAIR,MAAMtD,IAAI,EAAE;QACdsD,MAAMtD,IAAI,CAAC8D,SAAS,GAAGnE,aACrBG,uBAAuBE,IAAI,EAC3B4D,WAAYD,CAAAA,eAAe,YAAYA,eAAe,aAAY,KAAMF,kBAAkBP,mBAAmB,EAC7GO,kBAAkBvC,YAAY,EAC9BoC,MAAMtD,IAAI,CAAC8D,SAAS;IAExB;IAEAjE,yBAAyByD;IAEzB,OAAOA;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/ToggleButton/useToggleButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { 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.styles';\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,:active:focus-visible': {\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,:active:focus-visible': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n },\n\n ':focus': {\n border: '1px solid HighlightText',\n outlineColor: 'Highlight',\n },\n },\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,:active:focus-visible': {\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,:active:focus-visible': {\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,:active:focus-visible': {\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,:active:focus-visible': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n});\n\nconst useCheckedAccessibleStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorBrandBackground,\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,:active:focus-visible': {\n backgroundColor: tokens.colorBrandBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n\n // Appearance variations\n outline: {\n // There's no longer a reason to thicken the outline variant's border\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n },\n\n primary: {\n // primary has an inner stroke for the checked style\n outline: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralForegroundOnBrand}`,\n outlineOffset: `calc(${tokens.strokeWidthThicker} * -1)`,\n\n // need to not have the default focus style that removes the outline\n ...createCustomFocusIndicatorStyle({\n outline: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralForegroundOnBrand}`,\n outlineOffset: `calc(${tokens.strokeWidthThickest} * -1)`,\n }),\n },\n\n subtle: {\n // override subtle-appearance-specific icon color on hover\n ':hover': {\n [`& .${toggleButtonClassNames.icon}`]: {\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n },\n\n transparent: {\n /* No styles */\n },\n\n secondary: {\n /* No styles */\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,:active:focus-visible': {\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,:active:focus-visible': {\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,:active:focus-visible': {\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,:active:focus-visible': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n },\n },\n});\n\nconst useIconCheckedStyles = makeStyles({\n // Appearance variations with isAccessible=false\n subtleOrTransparent: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto',\n },\n },\n});\n\nconst usePrimaryHighContrastStyles = makeStyles({\n // Do not use primary variant high contrast styles for toggle buttons\n // otherwise there isn't enough difference between on/off states\n base: {\n '@media (forced-colors: active)': {\n backgroundColor: 'ButtonFace',\n ...shorthands.borderColor('ButtonBorder'),\n color: 'ButtonText',\n forcedColorAdjust: 'auto',\n },\n },\n\n disabled: {\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n color: 'GrayText',\n\n ':focus': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n },\n});\n\nexport const useToggleButtonStyles_unstable = (state: ToggleButtonState): ToggleButtonState => {\n const rootCheckedStyles = useRootCheckedStyles();\n const accessibleCheckedStyles = useCheckedAccessibleStyles();\n const rootDisabledStyles = useRootDisabledStyles();\n const iconCheckedStyles = useIconCheckedStyles();\n const primaryHighContrastStyles = usePrimaryHighContrastStyles();\n\n const { appearance, checked, disabled, disabledFocusable, isAccessible } = state;\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n toggleButtonClassNames.root,\n\n // Primary high contrast styles\n appearance === 'primary' && primaryHighContrastStyles.base,\n appearance === 'primary' && (disabled || disabledFocusable) && primaryHighContrastStyles.disabled,\n\n // Checked styles\n checked && rootCheckedStyles.base,\n checked && rootCheckedStyles.highContrast,\n appearance && checked && rootCheckedStyles[appearance],\n\n // Opt-in accessible checked styles\n isAccessible && checked && accessibleCheckedStyles.base,\n isAccessible && appearance && checked && accessibleCheckedStyles[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 // eslint-disable-next-line react-hooks/immutability\n state.icon.className = mergeClasses(\n toggleButtonClassNames.icon,\n checked &&\n !isAccessible &&\n (appearance === 'subtle' || appearance === 'transparent') &&\n iconCheckedStyles.subtleOrTransparent,\n iconCheckedStyles.highContrast,\n state.icon.className,\n );\n }\n\n useButtonStyles_unstable(state);\n\n return state;\n};\n"],"names":["iconFilledClassName","iconRegularClassName","createCustomFocusIndicatorStyle","tokens","shorthands","mergeClasses","makeStyles","useButtonStyles_unstable","toggleButtonClassNames","root","icon","useRootCheckedStyles","base","backgroundColor","colorNeutralBackground1Selected","borderColor","colorNeutralStroke1","color","colorNeutralForeground1Selected","borderWidth","strokeWidthThin","display","colorNeutralBackground1Hover","colorNeutralStroke1Hover","colorNeutralForeground1Hover","colorNeutralBackground1Pressed","colorNeutralStroke1Pressed","colorNeutralForeground1Pressed","highContrast","forcedColorAdjust","border","outlineColor","outline","colorTransparentBackgroundSelected","strokeWidthThicker","colorTransparentBackgroundHover","colorTransparentBackgroundPressed","primary","colorBrandBackgroundSelected","colorNeutralForegroundOnBrand","colorBrandBackgroundHover","colorBrandBackgroundPressed","secondary","subtle","colorSubtleBackgroundSelected","colorNeutralForeground2Selected","colorSubtleBackgroundHover","colorNeutralForeground2Hover","colorSubtleBackgroundPressed","colorNeutralForeground2Pressed","transparent","colorNeutralForeground2BrandSelected","colorNeutralForeground2BrandHover","colorNeutralForeground2BrandPressed","useCheckedAccessibleStyles","colorBrandBackground","outlineOffset","strokeWidthThickest","useRootDisabledStyles","colorNeutralBackgroundDisabled","colorNeutralStrokeDisabled","colorNeutralForegroundDisabled","colorTransparentBackground","useIconCheckedStyles","subtleOrTransparent","usePrimaryHighContrastStyles","disabled","useToggleButtonStyles_unstable","state","rootCheckedStyles","accessibleCheckedStyles","rootDisabledStyles","iconCheckedStyles","primaryHighContrastStyles","appearance","checked","disabledFocusable","isAccessible","className"],"mappings":"AAAA;AAEA,SAASA,mBAAmB,EAAEC,oBAAoB,QAAQ,wBAAwB;AAClF,SAASC,+BAA+B,QAAQ,0BAA0B;AAC1E,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,UAAU,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AACtE,SAASC,wBAAwB,QAAQ,sCAAmC;AAK5E,OAAO,MAAMC,yBAAsD;IAC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AkB;IACjBR,CAAAA,YAAYU,iBAAgB,KAAML,mBAAmB3D,IAAI,EAC1D8D,cAAeR,CAAAA,YAAYU,iBAAgB,KAAML,kBAAkB,CAACG,WAAW,EAE/E,2BAA2B;IAC3BN,MAAM3D,IAAI,CAACqE,SAAS;IAGtB,IAAIV,MAAM1D,IAAI,EAAE;QACd,oDAAoD;QACpD0D,MAAM1D,IAAI,CAACoE,SAAS,GAAGzE,aACrBG,uBAAuBE,IAAI,EAC3BiE,WACE,CAACE,gBACAH,CAAAA,eAAe,YAAYA,eAAe,aAAY,KACvDF,kBAAkBR,mBAAmB,EACvCQ,kBAAkB5C,YAAY,EAC9BwC,MAAM1D,IAAI,CAACoE,SAAS;IAExB;IAEAvE,yBAAyB6D;IAEzB,OAAOA;AACT,EAAE"}
@@ -1,14 +1,16 @@
1
1
  'use client';
2
- import * as React from 'react';
2
+ import * as React from "react";
3
3
  const buttonContext = React.createContext(undefined);
4
4
  const buttonContextDefaultValue = {};
5
5
  /**
6
- * @internal
7
6
  * Internal context provider used to update default values between internal components
7
+ *
8
+ * @internal
8
9
  */ export const ButtonContextProvider = buttonContext.Provider;
9
10
  /**
10
- * @internal
11
11
  * Internal context hook used to update default values between internal components
12
+ *
13
+ * @internal
12
14
  */ export const useButtonContext = ()=>{
13
15
  var _React_useContext;
14
16
  return (_React_useContext = React.useContext(buttonContext)) !== null && _React_useContext !== void 0 ? _React_useContext : buttonContextDefaultValue;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/contexts/ButtonContext.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ButtonSize } from '../components/Button/Button.types';\n\nconst buttonContext = React.createContext<ButtonContextValue | undefined>(undefined);\n\n/**\n * @internal\n * Internal context value used to update default values between internal components\n */\nexport interface ButtonContextValue {\n size?: ButtonSize;\n}\n\nconst buttonContextDefaultValue: ButtonContextValue = {};\n\n/**\n * @internal\n * Internal context provider used to update default values between internal components\n */\nexport const ButtonContextProvider = buttonContext.Provider;\n\n/**\n * @internal\n * Internal context hook used to update default values between internal components\n */\nexport const useButtonContext = (): ButtonContextValue => {\n return React.useContext(buttonContext) ?? buttonContextDefaultValue;\n};\n"],"names":["React","buttonContext","createContext","undefined","buttonContextDefaultValue","ButtonContextProvider","Provider","useButtonContext","useContext"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAG/B,MAAMC,gBAAgBD,MAAME,aAAa,CAAiCC;AAU1E,MAAMC,4BAAgD,CAAC;AAEvD;;;CAGC,GACD,OAAO,MAAMC,wBAAwBJ,cAAcK,QAAQ,CAAC;AAE5D;;;CAGC,GACD,OAAO,MAAMC,mBAAmB;QACvBP;IAAP,OAAOA,CAAAA,oBAAAA,MAAMQ,UAAU,CAACP,4BAAjBD,+BAAAA,oBAAmCI;AAC5C,EAAE"}
1
+ {"version":3,"sources":["../src/contexts/ButtonContext.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ButtonSize } from '../components/Button/Button.types';\n\nconst buttonContext = React.createContext<ButtonContextValue | undefined>(undefined);\n\n/**\n * Internal context value used to update default values between internal components\n *\n * @internal\n */\nexport interface ButtonContextValue {\n size?: ButtonSize;\n}\n\nconst buttonContextDefaultValue: ButtonContextValue = {};\n\n/**\n * Internal context provider used to update default values between internal components\n *\n * @internal\n */\nexport const ButtonContextProvider = buttonContext.Provider;\n\n/**\n * Internal context hook used to update default values between internal components\n *\n * @internal\n */\nexport const useButtonContext = (): ButtonContextValue => {\n return React.useContext(buttonContext) ?? buttonContextDefaultValue;\n};\n"],"names":["React","buttonContext","createContext","undefined","buttonContextDefaultValue","ButtonContextProvider","Provider","useButtonContext","useContext"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAG/B,MAAMC,gBAAgBD,MAAME,aAAa,CAAiCC;AAW1E,MAAMC,4BAAgD,CAAC;AAEvD;;;;CAIC,GACD,OAAO,MAAMC,wBAAwBJ,cAAcK,QAAQ,CAAC;AAE5D;;;;CAIC,GACD,OAAO,MAAMC,mBAAmB;QACvBP;IAAP,OAAOA,CAAAA,oBAAAA,MAAMQ,UAAU,CAACP,4BAAjBD,+BAAAA,oBAAmCI;AAC5C,EAAE"}
@@ -1 +1 @@
1
- export { ButtonContextProvider, useButtonContext } from './ButtonContext';
1
+ export { ButtonContextProvider, useButtonContext } from "./ButtonContext.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export type { ButtonContextValue } from './ButtonContext';\nexport { ButtonContextProvider, useButtonContext } from './ButtonContext';\n"],"names":["ButtonContextProvider","useButtonContext"],"mappings":"AACA,SAASA,qBAAqB,EAAEC,gBAAgB,QAAQ,kBAAkB"}
1
+ {"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export type { ButtonContextValue } from './ButtonContext';\nexport { ButtonContextProvider, useButtonContext } from './ButtonContext';\n"],"names":["ButtonContextProvider","useButtonContext"],"mappings":"AACA,SAASA,qBAAqB,EAAEC,gBAAgB,QAAQ,qBAAkB"}
package/lib/index.js CHANGED
@@ -1,13 +1,7 @@
1
- export { Button, buttonClassNames, renderButton_unstable, useButtonStyles_unstable, useButton_unstable } from './Button';
2
- export { CompoundButton, compoundButtonClassNames, renderCompoundButton_unstable, useCompoundButtonStyles_unstable, useCompoundButton_unstable } from './CompoundButton';
3
- export { MenuButton, menuButtonClassNames, renderMenuButton_unstable, useMenuButtonStyles_unstable, useMenuButton_unstable } from './MenuButton';
4
- export { SplitButton, renderSplitButton_unstable, splitButtonClassNames, useSplitButtonStyles_unstable, useSplitButton_unstable } from './SplitButton';
5
- export { ToggleButton, renderToggleButton_unstable, toggleButtonClassNames, useToggleButtonStyles_unstable, useToggleButton_unstable } from './ToggleButton';
6
- export { useToggleState } from './utils/index';
7
- export { ButtonContextProvider, useButtonContext } from './contexts/index';
8
- // Experimental APIs - will be uncommented in the experimental release branch
9
- export { useButtonBase_unstable } from './Button';
10
- export { useCompoundButtonBase_unstable } from './CompoundButton';
11
- export { useMenuButtonBase_unstable } from './MenuButton';
12
- export { useSplitButtonBase_unstable } from './SplitButton';
13
- export { useToggleButtonBase_unstable } from './ToggleButton';
1
+ export { Button, buttonClassNames, renderButton_unstable, useButtonStyles_unstable, useButton_unstable, useButtonBase_unstable } from "./Button.js";
2
+ export { CompoundButton, compoundButtonClassNames, renderCompoundButton_unstable, useCompoundButtonStyles_unstable, useCompoundButton_unstable } from "./CompoundButton.js";
3
+ export { MenuButton, menuButtonClassNames, renderMenuButton_unstable, useMenuButtonStyles_unstable, useMenuButton_unstable, useMenuButtonBase_unstable } from "./MenuButton.js";
4
+ export { SplitButton, renderSplitButton_unstable, splitButtonClassNames, useSplitButtonStyles_unstable, useSplitButton_unstable } from "./SplitButton.js";
5
+ export { ToggleButton, renderToggleButton_unstable, toggleButtonClassNames, useToggleButtonStyles_unstable, useToggleButton_unstable, useToggleButtonBase_unstable } from "./ToggleButton.js";
6
+ export { useToggleState } from "./utils/index.js";
7
+ export { ButtonContextProvider, useButtonContext } from "./contexts/index.js";
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../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\nexport { ButtonContextProvider, useButtonContext } from './contexts/index';\nexport type { ButtonContextValue } from './contexts/index';\n\n// Experimental APIs - will be uncommented in the experimental release branch\nexport { useButtonBase_unstable } from './Button';\nexport type { ButtonBaseProps, ButtonBaseState } from './Button';\nexport { useCompoundButtonBase_unstable } from './CompoundButton';\nexport type { CompoundButtonBaseProps, CompoundButtonBaseState } from './CompoundButton';\nexport { useMenuButtonBase_unstable } from './MenuButton';\nexport type { MenuButtonBaseProps, MenuButtonBaseState } from './MenuButton';\nexport { useSplitButtonBase_unstable } from './SplitButton';\nexport type { SplitButtonBaseProps, SplitButtonBaseState } from './SplitButton';\nexport { useToggleButtonBase_unstable } from './ToggleButton';\nexport type { ToggleButtonBaseProps, ToggleButtonBaseState } from './ToggleButton';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable","CompoundButton","compoundButtonClassNames","renderCompoundButton_unstable","useCompoundButtonStyles_unstable","useCompoundButton_unstable","MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable","SplitButton","renderSplitButton_unstable","splitButtonClassNames","useSplitButtonStyles_unstable","useSplitButton_unstable","ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable","useToggleState","ButtonContextProvider","useButtonContext","useButtonBase_unstable","useCompoundButtonBase_unstable","useMenuButtonBase_unstable","useSplitButtonBase_unstable","useToggleButtonBase_unstable"],"mappings":"AAAA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,QACb,WAAW;AAElB,SACEC,cAAc,EACdC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,mBAAmB;AAE1B,SACEC,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,eAAe;AAEtB,SACEC,WAAW,EACXC,0BAA0B,EAC1BC,qBAAqB,EACrBC,6BAA6B,EAC7BC,uBAAuB,QAClB,gBAAgB;AAEvB,SACEC,YAAY,EACZC,2BAA2B,EAC3BC,sBAAsB,EACtBC,8BAA8B,EAC9BC,wBAAwB,QACnB,iBAAiB;AAGxB,SAASC,cAAc,QAAQ,gBAAgB;AAE/C,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,mBAAmB;AAG3E,6EAA6E;AAC7E,SAASC,sBAAsB,QAAQ,WAAW;AAElD,SAASC,8BAA8B,QAAQ,mBAAmB;AAElE,SAASC,0BAA0B,QAAQ,eAAe;AAE1D,SAASC,2BAA2B,QAAQ,gBAAgB;AAE5D,SAASC,4BAA4B,QAAQ,iBAAiB"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n useButtonBase_unstable,\n} from './Button';\nexport type { ButtonProps, ButtonSlots, ButtonState, ButtonBaseProps, ButtonBaseState } 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 useMenuButtonBase_unstable,\n} from './MenuButton';\nexport type {\n MenuButtonProps,\n MenuButtonSlots,\n MenuButtonState,\n MenuButtonBaseProps,\n MenuButtonBaseState,\n} 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 useToggleButtonBase_unstable,\n} from './ToggleButton';\nexport type {\n ToggleButtonProps,\n ToggleButtonState,\n ToggleButtonBaseProps,\n ToggleButtonBaseState,\n} from './ToggleButton';\n\nexport { useToggleState } from './utils/index';\n\nexport { ButtonContextProvider, useButtonContext } from './contexts/index';\nexport type { ButtonContextValue } from './contexts/index';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable","useButtonBase_unstable","CompoundButton","compoundButtonClassNames","renderCompoundButton_unstable","useCompoundButtonStyles_unstable","useCompoundButton_unstable","MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable","useMenuButtonBase_unstable","SplitButton","renderSplitButton_unstable","splitButtonClassNames","useSplitButtonStyles_unstable","useSplitButton_unstable","ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable","useToggleButtonBase_unstable","useToggleState","ButtonContextProvider","useButtonContext"],"mappings":"AAAA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,QACjB,cAAW;AAElB,SACEC,cAAc,EACdC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,sBAAmB;AAE1B,SACEC,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,EACtBC,0BAA0B,QACrB,kBAAe;AAQtB,SACEC,WAAW,EACXC,0BAA0B,EAC1BC,qBAAqB,EACrBC,6BAA6B,EAC7BC,uBAAuB,QAClB,mBAAgB;AAEvB,SACEC,YAAY,EACZC,2BAA2B,EAC3BC,sBAAsB,EACtBC,8BAA8B,EAC9BC,wBAAwB,EACxBC,4BAA4B,QACvB,oBAAiB;AAQxB,SAASC,cAAc,QAAQ,mBAAgB;AAE/C,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,sBAAmB"}
@@ -1 +1 @@
1
- export { useToggleState } from './useToggleState';
1
+ export { useToggleState } from "./useToggleState.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { useToggleState } from './useToggleState';\n"],"names":["useToggleState"],"mappings":"AAAA,SAASA,cAAc,QAAQ,mBAAmB"}
1
+ {"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { useToggleState } from './useToggleState';\n"],"names":["useToggleState"],"mappings":"AAAA,SAASA,cAAc,QAAQ,sBAAmB"}
@@ -1,8 +1,8 @@
1
1
  'use client';
2
- import * as React from 'react';
3
- import { mergeCallbacks, useControllableState, useEventCallback } from '@fluentui/react-utilities';
2
+ import * as React from "react";
3
+ import { mergeCallbacks, useControllableState, useEventCallback } from "@fluentui/react-utilities";
4
4
  export function useToggleState(props, state) {
5
- const { checked, defaultChecked, disabled, disabledFocusable } = props;
5
+ const { checked, defaultChecked, disabled, disabledFocusable, isAccessible = false } = props;
6
6
  const { onClick, role } = state.root;
7
7
  const [checkedValue, setCheckedValue] = useControllableState({
8
8
  state: checked,
@@ -26,6 +26,7 @@ export function useToggleState(props, state) {
26
26
  return {
27
27
  ...state,
28
28
  checked: checkedValue,
29
+ isAccessible,
29
30
  root: {
30
31
  ...state.root,
31
32
  [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/useToggleState.ts"],"sourcesContent":["'use client';\n\nimport * 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: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\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"],"names":["React","mergeCallbacks","useControllableState","useEventCallback","useToggleState","props","state","checked","defaultChecked","disabled","disabledFocusable","onClick","role","root","checkedValue","setCheckedValue","defaultState","initialState","isCheckboxTypeRole","onToggleClick","useCallback","ev","defaultPrevented"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,EAAEC,oBAAoB,EAAEC,gBAAgB,QAAQ,4BAA4B;AAInG,OAAO,SAASC,eAIdC,KAAyB,EAAEC,KAAmB;IAC9C,MAAM,EAAEC,OAAO,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,iBAAiB,EAAE,GAAGL;IACjE,MAAM,EAAEM,OAAO,EAAEC,IAAI,EAAE,GAAGN,MAAMO,IAAI;IAEpC,MAAM,CAACC,cAAcC,gBAAgB,GAAGb,qBAAqB;QAC3DI,OAAOC;QACPS,cAAcR;QACdS,cAAc;IAChB;IAEA,MAAMC,qBAAqBN,SAAS,sBAAsBA,SAAS;IAEnE,MAAMO,gBAAgBnB,MAAMoB,WAAW,CACrC,CAACC;QACC,IAAI,CAACZ,YAAY,CAACC,mBAAmB;YACnC,IAAIW,GAAGC,gBAAgB,EAAE;gBACvB;YACF;YAEAP,gBAAgB,CAACD;QACnB;IACF,GACA;QAACA;QAAcL;QAAUC;QAAmBK;KAAgB;IAG9D,OAAO;QACL,GAAGT,KAAK;QAERC,SAASO;QAETD,MAAM;YACJ,GAAGP,MAAMO,IAAI;YACb,CAACK,qBAAqB,iBAAiB,eAAe,EAAEJ;YACxDH,SAASR,iBACPF,eAAeU,SAA2EQ;QAE9F;IACF;AACF"}
1
+ {"version":3,"sources":["../src/utils/useToggleState.ts"],"sourcesContent":["'use client';\n\nimport * 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<\n ToggleButtonProps,\n 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable' | 'isAccessible'\n >,\n TButtonState extends Pick<ButtonState, 'root'>,\n TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root' | 'isAccessible'>,\n>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState {\n const { checked, defaultChecked, disabled, disabledFocusable, isAccessible = false } = 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: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\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 isAccessible,\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"],"names":["React","mergeCallbacks","useControllableState","useEventCallback","useToggleState","props","state","checked","defaultChecked","disabled","disabledFocusable","isAccessible","onClick","role","root","checkedValue","setCheckedValue","defaultState","initialState","isCheckboxTypeRole","onToggleClick","useCallback","ev","defaultPrevented"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,EAAEC,oBAAoB,EAAEC,gBAAgB,QAAQ,4BAA4B;AAInG,OAAO,SAASC,eAOdC,KAAyB,EAAEC,KAAmB;IAC9C,MAAM,EAAEC,OAAO,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,iBAAiB,EAAEC,eAAe,KAAK,EAAE,GAAGN;IACvF,MAAM,EAAEO,OAAO,EAAEC,IAAI,EAAE,GAAGP,MAAMQ,IAAI;IAEpC,MAAM,CAACC,cAAcC,gBAAgB,GAAGd,qBAAqB;QAC3DI,OAAOC;QACPU,cAAcT;QACdU,cAAc;IAChB;IAEA,MAAMC,qBAAqBN,SAAS,sBAAsBA,SAAS;IAEnE,MAAMO,gBAAgBpB,MAAMqB,WAAW,CACrC,CAACC;QACC,IAAI,CAACb,YAAY,CAACC,mBAAmB;YACnC,IAAIY,GAAGC,gBAAgB,EAAE;gBACvB;YACF;YAEAP,gBAAgB,CAACD;QACnB;IACF,GACA;QAACA;QAAcN;QAAUC;QAAmBM;KAAgB;IAG9D,OAAO;QACL,GAAGV,KAAK;QAERC,SAASQ;QAETJ;QAEAG,MAAM;YACJ,GAAGR,MAAMQ,IAAI;YACb,CAACK,qBAAqB,iBAAiB,eAAe,EAAEJ;YACxDH,SAAST,iBACPF,eAAeW,SAA2EQ;QAE9F;IACF;AACF"}
@@ -28,4 +28,4 @@ _export(exports, {
28
28
  return _index.useButton_unstable;
29
29
  }
30
30
  });
31
- const _index = require("./components/Button/index");
31
+ const _index = require("./components/Button/index.cjs");
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Button.tsx"],"sourcesContent":["export type {\n ButtonBaseProps,\n ButtonProps,\n ButtonSlots,\n ButtonBaseState,\n ButtonState,\n} from './components/Button/index';\nexport {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n useButtonBase_unstable,\n} from './components/Button/index';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable","useButtonBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,aAAM;;;eACNC,uBAAgB;;;eAChBC,4BAAqB;;;eAGrBG,6BAAsB;;;eAFtBF,+BAAwB;;;eACxBC,yBAAkB;;;uBAEb,4BAA4B"}
1
+ {"version":3,"sources":["../src/Button.tsx"],"sourcesContent":["export type {\n ButtonBaseProps,\n ButtonProps,\n ButtonSlots,\n ButtonBaseState,\n ButtonState,\n} from './components/Button/index';\nexport {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n useButtonBase_unstable,\n} from './components/Button/index';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable","useButtonBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,aAAM;;;eACNC,uBAAgB;;;eAChBC,4BAAqB;;;eAGrBG,6BAAsB;;;eAFtBF,+BAAwB;;;eACxBC,yBAAkB;;;uBAEb,+BAA4B"}
@@ -18,9 +18,6 @@ _export(exports, {
18
18
  renderCompoundButton_unstable: function() {
19
19
  return _index.renderCompoundButton_unstable;
20
20
  },
21
- useCompoundButtonBase_unstable: function() {
22
- return _index.useCompoundButtonBase_unstable;
23
- },
24
21
  useCompoundButtonStyles_unstable: function() {
25
22
  return _index.useCompoundButtonStyles_unstable;
26
23
  },
@@ -28,4 +25,4 @@ _export(exports, {
28
25
  return _index.useCompoundButton_unstable;
29
26
  }
30
27
  });
31
- const _index = require("./components/CompoundButton/index");
28
+ const _index = require("./components/CompoundButton/index.cjs");
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/CompoundButton.ts"],"sourcesContent":["export type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './components/CompoundButton/index';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './components/CompoundButton/index';\n"],"names":["CompoundButton","compoundButtonClassNames","renderCompoundButton_unstable","useCompoundButtonStyles_unstable","useCompoundButton_unstable"],"mappings":";;;;;;;;;;;;eAEEA,qBAAc;;;eACdC,+BAAwB;;;eACxBC,oCAA6B;;;eAC7BC,uCAAgC;;;eAChCC,iCAA0B;;;uBACrB,uCAAoC"}
@@ -28,4 +28,4 @@ _export(exports, {
28
28
  return _index.useMenuButton_unstable;
29
29
  }
30
30
  });
31
- const _index = require("./components/MenuButton/index");
31
+ const _index = require("./components/MenuButton/index.cjs");
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/MenuButton.ts"],"sourcesContent":["export type {\n MenuButtonBaseProps,\n MenuButtonProps,\n MenuButtonSlots,\n MenuButtonBaseState,\n MenuButtonState,\n} from './components/MenuButton/index';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n useMenuButtonBase_unstable,\n} from './components/MenuButton/index';\n"],"names":["MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable","useMenuButtonBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,iBAAU;;;eACVC,2BAAoB;;;eACpBC,gCAAyB;;;eAGzBG,iCAA0B;;;eAF1BF,mCAA4B;;;eAC5BC,6BAAsB;;;uBAEjB,gCAAgC"}
1
+ {"version":3,"sources":["../src/MenuButton.ts"],"sourcesContent":["export type {\n MenuButtonBaseProps,\n MenuButtonBaseState,\n MenuButtonProps,\n MenuButtonSlots,\n MenuButtonState,\n} from './components/MenuButton/index';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n useMenuButtonBase_unstable,\n} from './components/MenuButton/index';\n"],"names":["MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable","useMenuButtonBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,iBAAU;;;eACVC,2BAAoB;;;eACpBC,gCAAyB;;;eAGzBG,iCAA0B;;;eAF1BF,mCAA4B;;;eAC5BC,6BAAsB;;;uBAEjB,mCAAgC"}
@@ -18,9 +18,6 @@ _export(exports, {
18
18
  splitButtonClassNames: function() {
19
19
  return _index.splitButtonClassNames;
20
20
  },
21
- useSplitButtonBase_unstable: function() {
22
- return _index.useSplitButtonBase_unstable;
23
- },
24
21
  useSplitButtonStyles_unstable: function() {
25
22
  return _index.useSplitButtonStyles_unstable;
26
23
  },
@@ -28,4 +25,4 @@ _export(exports, {
28
25
  return _index.useSplitButton_unstable;
29
26
  }
30
27
  });
31
- const _index = require("./components/SplitButton/index");
28
+ const _index = require("./components/SplitButton/index.cjs");
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SplitButton.ts"],"sourcesContent":["export type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './components/SplitButton/index';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './components/SplitButton/index';\n"],"names":["SplitButton","renderSplitButton_unstable","splitButtonClassNames","useSplitButtonStyles_unstable","useSplitButton_unstable"],"mappings":";;;;;;;;;;;;eAEEA,kBAAW;;;eACXC,iCAA0B;;;eAC1BC,4BAAqB;;;eACrBC,oCAA6B;;;eAC7BC,8BAAuB;;;uBAClB,oCAAiC"}
@@ -28,4 +28,4 @@ _export(exports, {
28
28
  return _index.useToggleButton_unstable;
29
29
  }
30
30
  });
31
- const _index = require("./components/ToggleButton/index");
31
+ const _index = require("./components/ToggleButton/index.cjs");
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ToggleButton.ts"],"sourcesContent":["export type {\n ToggleButtonBaseProps,\n ToggleButtonProps,\n ToggleButtonBaseState,\n ToggleButtonState,\n} from './components/ToggleButton/index';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n useToggleButtonBase_unstable,\n} from './components/ToggleButton/index';\n"],"names":["ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable","useToggleButtonBase_unstable"],"mappings":";;;;;;;;;;;;eAOEA,mBAAY;;;eACZC,kCAA2B;;;eAC3BC,6BAAsB;;;eAGtBG,mCAA4B;;;eAF5BF,qCAA8B;;;eAC9BC,+BAAwB;;;uBAEnB,kCAAkC"}
1
+ {"version":3,"sources":["../src/ToggleButton.ts"],"sourcesContent":["export type {\n ToggleButtonBaseProps,\n ToggleButtonProps,\n ToggleButtonState,\n ToggleButtonBaseState,\n} from './components/ToggleButton/index';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n useToggleButtonBase_unstable,\n} from './components/ToggleButton/index';\n"],"names":["ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable","useToggleButtonBase_unstable"],"mappings":";;;;;;;;;;;;eAOEA,mBAAY;;;eACZC,kCAA2B;;;eAC3BC,6BAAsB;;;eAGtBG,mCAA4B;;;eAF5BF,qCAA8B;;;eAC9BC,+BAAwB;;;uBAEnB,qCAAkC"}
@@ -11,9 +11,9 @@ Object.defineProperty(exports, "Button", {
11
11
  });
12
12
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
13
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
- const _renderButton = require("./renderButton");
15
- const _useButton = require("./useButton");
16
- const _useButtonStylesstyles = require("./useButtonStyles.styles");
14
+ const _renderButton = require("./renderButton.cjs");
15
+ const _useButton = require("./useButton.cjs");
16
+ const _useButtonStylesstyles = require("./useButtonStyles.styles.cjs");
17
17
  const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
18
18
  const Button = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
19
19
  const state = (0, _useButton.useButton_unstable)(props, ref);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Button/Button.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { renderButton_unstable } from './renderButton';\nimport { useButton_unstable } from './useButton';\nimport { useButtonStyles_unstable } from './useButtonStyles.styles';\nimport type { ButtonProps } from './Button.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Buttons give people a way to trigger an action.\n */\nexport const Button: ForwardRefComponent<ButtonProps> = React.forwardRef((props, ref) => {\n const state = useButton_unstable(props, ref);\n\n useButtonStyles_unstable(state);\n\n useCustomStyleHook_unstable('useButtonStyles_unstable')(state);\n\n return renderButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<ButtonProps>;\n\nButton.displayName = 'Button';\n"],"names":["React","renderButton_unstable","useButton_unstable","useButtonStyles_unstable","useCustomStyleHook_unstable","Button","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;8BACO,iBAAiB;2BACpB,cAAc;uCACR,2BAA2B;qCAGxB,kCAAkC;AAKvE,MAAMK,SAAAA,WAAAA,GAA2CL,OAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,YAAQP,6BAAAA,EAAmBK,OAAOC;QAExCL,+CAAAA,EAAyBM;QAEzBL,gDAAAA,EAA4B,4BAA4BK;IAExD,WAAOR,mCAAAA,EAAsBQ;AAC7B,0FAA0F;AAC5F,GAAuC;AAEvCJ,OAAOK,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/Button/Button.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { renderButton_unstable } from './renderButton';\nimport { useButton_unstable } from './useButton';\nimport { useButtonStyles_unstable } from './useButtonStyles.styles';\nimport type { ButtonProps } from './Button.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Buttons give people a way to trigger an action.\n */\nexport const Button: ForwardRefComponent<ButtonProps> = React.forwardRef((props, ref) => {\n const state = useButton_unstable(props, ref);\n\n useButtonStyles_unstable(state);\n\n useCustomStyleHook_unstable('useButtonStyles_unstable')(state);\n\n return renderButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<ButtonProps>;\n\nButton.displayName = 'Button';\n"],"names":["React","renderButton_unstable","useButton_unstable","useButtonStyles_unstable","useCustomStyleHook_unstable","Button","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;8BACO,oBAAiB;2BACpB,iBAAc;uCACR,8BAA2B;qCAGxB,kCAAkC;AAKvE,MAAMK,SAAAA,WAAAA,GAA2CL,OAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,YAAQP,6BAAAA,EAAmBK,OAAOC;QAExCL,+CAAAA,EAAyBM;QAEzBL,gDAAAA,EAA4B,4BAA4BK;IAExD,WAAOR,mCAAAA,EAAsBQ;AAC7B,0FAA0F;AAC5F,GAAuC;AAEvCJ,OAAOK,WAAW,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Button/Button.types.ts"],"sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, DistributiveOmit, Slot } from '@fluentui/react-utilities';\n\nexport type ButtonSlots = {\n /**\n * Root of the component that renders as either a `<button>` tag or an `<a>` tag.\n */\n root: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;\n\n /**\n * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.\n */\n icon?: Slot<'span'>;\n};\n\n/**\n * A button supports different sizes.\n */\nexport type ButtonSize = 'small' | 'medium' | 'large';\n\nexport type ButtonProps = ComponentProps<ButtonSlots> & {\n /**\n * A button can have its content and borders styled for greater emphasis or to be subtle.\n * - 'secondary' (default): Gives emphasis to the button in such a way that it indicates a secondary action.\n * - 'primary': Emphasizes the button as a primary action.\n * - 'outline': Removes background styling.\n * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.\n * - 'transparent': Removes background and border styling.\n *\n * @default 'secondary'\n */\n appearance?: 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';\n\n /**\n * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it\n * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this\n * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.\n *\n * @default false\n */\n disabledFocusable?: boolean;\n\n /**\n * A button can show that it cannot be interacted with.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * A button can format its icon to appear before or after its content.\n *\n * @default 'before'\n */\n iconPosition?: 'before' | 'after';\n\n /**\n * A button can be rounded, circular, or square.\n *\n * @default 'rounded'\n */\n shape?: 'rounded' | 'circular' | 'square';\n\n /**\n * A button supports different sizes.\n *\n * @default 'medium'\n */\n size?: ButtonSize;\n};\n\n/**\n * Internal use only: lists prop names related to Button design for use within Button components.\n *\n * @internal\n */\nexport type ButtonDesignPropNames = 'appearance' | 'size' | 'shape';\n\nexport type ButtonBaseProps = DistributiveOmit<ButtonProps, ButtonDesignPropNames>;\n\nexport type ButtonState = ComponentState<ButtonSlots> &\n Required<Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>> & {\n /**\n * A button can contain only an icon.\n *\n * @default false\n */\n iconOnly: boolean;\n };\n\nexport type ButtonBaseState = DistributiveOmit<ButtonState, ButtonDesignPropNames>;\n"],"names":[],"mappings":""}
1
+ {"version":3,"sources":["../src/components/Button/Button.types.ts"],"sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, DistributiveOmit, Slot } from '@fluentui/react-utilities';\n\nexport type ButtonSlots = {\n /**\n * Root of the component that renders as either a `<button>` tag or an `<a>` tag.\n */\n root: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;\n\n /**\n * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.\n */\n icon?: Slot<'span'>;\n};\n\n/**\n * A button supports different sizes.\n */\nexport type ButtonSize = 'small' | 'medium' | 'large';\n\nexport type ButtonProps = ComponentProps<ButtonSlots> & {\n /**\n * A button can have its content and borders styled for greater emphasis or to be subtle.\n * - 'secondary' (default): Gives emphasis to the button in such a way that it indicates a secondary action.\n * - 'primary': Emphasizes the button as a primary action.\n * - 'outline': Removes background styling.\n * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.\n * - 'transparent': Removes background and border styling.\n *\n * @default 'secondary'\n */\n appearance?: 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';\n\n /**\n * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it\n * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this\n * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.\n *\n * @default false\n */\n disabledFocusable?: boolean;\n\n /**\n * A button can show that it cannot be interacted with.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * A button can format its icon to appear before or after its content.\n *\n * @default 'before'\n */\n iconPosition?: 'before' | 'after';\n\n /**\n * A button can be rounded, circular, or square.\n *\n * @default 'rounded'\n */\n shape?: 'rounded' | 'circular' | 'square';\n\n /**\n * A button supports different sizes.\n *\n * @default 'medium'\n */\n size?: ButtonSize;\n};\n\nexport type ButtonBaseProps = DistributiveOmit<ButtonProps, 'appearance' | 'size' | 'shape'>;\n\nexport type ButtonState = ComponentState<ButtonSlots> &\n Required<Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>> & {\n /**\n * A button can contain only an icon.\n *\n * @default false\n */\n iconOnly: boolean;\n };\n\nexport type ButtonBaseState = DistributiveOmit<ButtonState, 'appearance' | 'size' | 'shape'>;\n"],"names":[],"mappings":""}
@@ -19,7 +19,7 @@ _export(exports, {
19
19
  return _renderButton.renderButton_unstable;
20
20
  },
21
21
  useButtonBase_unstable: function() {
22
- return _useButtonBase.useButtonBase_unstable;
22
+ return _useButton.useButtonBase_unstable;
23
23
  },
24
24
  useButtonStyles_unstable: function() {
25
25
  return _useButtonStylesstyles.useButtonStyles_unstable;
@@ -28,8 +28,7 @@ _export(exports, {
28
28
  return _useButton.useButton_unstable;
29
29
  }
30
30
  });
31
- const _Button = require("./Button");
32
- const _renderButton = require("./renderButton");
33
- const _useButton = require("./useButton");
34
- const _useButtonBase = require("./useButtonBase");
35
- const _useButtonStylesstyles = require("./useButtonStyles.styles");
31
+ const _Button = require("./Button.cjs");
32
+ const _renderButton = require("./renderButton.cjs");
33
+ const _useButton = require("./useButton.cjs");
34
+ const _useButtonStylesstyles = require("./useButtonStyles.styles.cjs");
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Button/index.ts"],"sourcesContent":["export { Button } from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonBaseProps, ButtonProps, ButtonSlots, ButtonBaseState, ButtonState } from './Button.types';\nexport { renderButton_unstable } from './renderButton';\nexport { useButton_unstable, useButtonBase_unstable } from './useButton';\nexport { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles.styles';\n"],"names":["Button","renderButton_unstable","useButton_unstable","useButtonBase_unstable","buttonClassNames","useButtonStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,cAAM;;;eAKNI,uCAAgB;;;eAFhBH,mCAAqB;;;eACDE,iCAAsB;;;eACxBE,+CAAwB;;;eAD1CH,6BAAkB;;;wBAJJ,cAAW;8BAGI,oBAAiB;2BACI,iBAAc;uCACd,8BAA2B"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Button/renderButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nimport type { ButtonSlots, ButtonBaseState } from './Button.types';\n\n/**\n * Renders a Button component by passing the state defined props to the appropriate slots.\n */\nexport const renderButton_unstable = (state: ButtonBaseState): JSXElement => {\n assertSlots<ButtonSlots>(state);\n const { iconOnly, iconPosition } = state;\n\n return (\n <state.root>\n {iconPosition !== 'after' && state.icon && <state.icon />}\n {!iconOnly && state.root.children}\n {iconPosition === 'after' && state.icon && <state.icon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderButton_unstable","state","iconOnly","iconPosition","root","icon","children"],"mappings":";;;;+BAWaC;;;;;;4BAVb,iCAAiD;gCAErB,4BAA4B;AAQjD,8BAA8B,CAACC;QACpCF,2BAAAA,EAAyBE;IACzB,MAAM,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAGF;IAEnC,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMG,IAAI,EAAA;;YACRD,iBAAiB,WAAWF,MAAMI,IAAI,IAAA,WAAA,GAAI,mBAAA,EAACJ,MAAMI,IAAI,EAAA,CAAA;YACrD,CAACH,YAAYD,MAAMG,IAAI,CAACE,QAAQ;YAChCH,iBAAiB,WAAWF,MAAMI,IAAI,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,IAAI,EAAA,CAAA;;;AAG5D,EAAE"}
@@ -0,0 +1,58 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _export(target, all) {
7
+ for(var name in all)Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ useButtonBase_unstable: function() {
14
+ return useButtonBase_unstable;
15
+ },
16
+ useButton_unstable: function() {
17
+ return useButton_unstable;
18
+ }
19
+ });
20
+ const _ButtonContext = require("../../contexts/ButtonContext.cjs");
21
+ const _reactaria = require("@fluentui/react-aria");
22
+ const _reactutilities = require("@fluentui/react-utilities");
23
+ const useButton_unstable = (props, ref)=>{
24
+ const { size: contextSize } = (0, _ButtonContext.useButtonContext)();
25
+ const { appearance = 'secondary', shape = 'rounded', size = contextSize !== null && contextSize !== void 0 ? contextSize : 'medium', ...buttonProps } = props;
26
+ const state = useButtonBase_unstable(buttonProps, ref);
27
+ return {
28
+ appearance,
29
+ shape,
30
+ size,
31
+ ...state
32
+ };
33
+ };
34
+ const useButtonBase_unstable = (props, ref)=>{
35
+ const { icon, iconPosition = 'before', ...buttonProps } = props;
36
+ const iconShorthand = _reactutilities.slot.optional(icon, {
37
+ elementType: 'span'
38
+ });
39
+ var _props_disabled, _props_disabledFocusable;
40
+ return {
41
+ disabled: (_props_disabled = props.disabled) !== null && _props_disabled !== void 0 ? _props_disabled : false,
42
+ disabledFocusable: (_props_disabledFocusable = props.disabledFocusable) !== null && _props_disabledFocusable !== void 0 ? _props_disabledFocusable : false,
43
+ iconPosition,
44
+ iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !props.children),
45
+ components: {
46
+ root: 'button',
47
+ icon: 'span'
48
+ },
49
+ root: _reactutilities.slot.always((0, _reactaria.useARIAButtonProps)(buttonProps.as, buttonProps), {
50
+ elementType: 'button',
51
+ defaultProps: {
52
+ ref: ref,
53
+ type: props.as !== 'a' ? 'button' : undefined
54
+ }
55
+ }),
56
+ icon: iconShorthand
57
+ };
58
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Button/useButton.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useButtonContext } from '../../contexts/ButtonContext';\nimport type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { slot } from '@fluentui/react-utilities';\nimport type { ButtonBaseProps, ButtonBaseState, ButtonProps, ButtonState } from './Button.types';\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButton_unstable = (\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ButtonState => {\n const { size: contextSize } = useButtonContext();\n const { appearance = 'secondary', shape = 'rounded', size = contextSize ?? 'medium', ...buttonProps } = props;\n const state = useButtonBase_unstable(buttonProps, ref);\n\n return {\n appearance,\n shape,\n size,\n ...state,\n };\n};\n\n/**\n * Base hook for Button component, which manages state related to slots structure and ARIA attributes.\n *\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButtonBase_unstable = (\n props: ButtonBaseProps,\n ref?: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ButtonBaseState => {\n const { icon, iconPosition = 'before', ...buttonProps } = props;\n const iconShorthand = slot.optional(icon, { elementType: 'span' });\n\n return {\n disabled: props.disabled ?? false,\n disabledFocusable: props.disabledFocusable ?? false,\n iconPosition,\n iconOnly: Boolean(iconShorthand?.children && !props.children),\n components: { root: 'button', icon: 'span' },\n root: slot.always<ARIAButtonSlotProps<'a'>>(useARIAButtonProps(buttonProps.as, buttonProps), {\n elementType: 'button',\n defaultProps: {\n ref: ref as React.Ref<HTMLButtonElement & HTMLAnchorElement>,\n type: props.as !== 'a' ? 'button' : undefined,\n },\n }),\n icon: iconShorthand,\n };\n};\n"],"names":["useButtonContext","useARIAButtonProps","slot","useButton_unstable","props","ref","size","contextSize","appearance","shape","buttonProps","state","useButtonBase_unstable","icon","iconPosition","iconShorthand","optional","elementType","disabled","disabledFocusable","iconOnly","Boolean","children","components","root","always","as","defaultProps","type","undefined"],"mappings":"AAAA;;;;;;;;;;;;0BAoCaY;eAAAA;;sBAtBAT;;;;+BAXoB,kCAA+B;2BAE7B,uBAAuB;gCACrC,4BAA4B;AAQ1C,MAAMA,qBAAqB,CAChCC,OACAC;IAEA,MAAM,EAAEC,MAAMC,WAAW,EAAE,OAAGP,+BAAAA;IAC9B,MAAM,EAAEQ,aAAa,WAAW,EAAEC,QAAQ,SAAS,EAAEH,OAAOC,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,cAAe,QAAQ,EAAE,GAAGG,aAAa,GAAGN;IACxG,MAAMO,QAAQC,uBAAuBF,aAAaL;IAElD,OAAO;QACLG;QACAC;QACAH;QACA,GAAGK,KAAK;IACV;AACF,EAAE;AAQK,+BAA+B,CACpCP,OACAC;IAEA,MAAM,EAAEQ,IAAI,EAAEC,eAAe,QAAQ,EAAE,GAAGJ,aAAa,GAAGN;IAC1D,MAAMW,gBAAgBb,oBAAAA,CAAKc,QAAQ,CAACH,MAAM;QAAEI,aAAa;IAAO;QAGpDb,iBACSA;IAFrB,OAAO;QACLc,UAAUd,CAAAA,kBAAAA,MAAMc,QAAAA,AAAQ,MAAA,QAAdd,oBAAAA,KAAAA,IAAAA,kBAAkB;QAC5Be,mBAAmBf,CAAAA,2BAAAA,MAAMe,iBAAAA,AAAiB,MAAA,QAAvBf,6BAAAA,KAAAA,IAAAA,2BAA2B;QAC9CU;QACAM,UAAUC,QAAQN,CAAAA,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAeO,QAAAA,AAAQ,KAAI,CAAClB,MAAMkB,QAAQ;QAC5DC,YAAY;YAAEC,MAAM;YAAUX,MAAM;QAAO;QAC3CW,MAAMtB,oBAAAA,CAAKuB,MAAM,KAA2BxB,6BAAAA,EAAmBS,YAAYgB,EAAE,EAAEhB,cAAc;YAC3FO,aAAa;YACbU,cAAc;gBACZtB,KAAKA;gBACLuB,MAAMxB,MAAMsB,EAAE,KAAK,MAAM,WAAWG;YACtC;QACF;QACAhB,MAAME;IACR;AACF,EAAE"}
@@ -1080,7 +1080,6 @@ const useIconStyles = /*#__PURE__*/ (0, _react.__styles)({
1080
1080
  ]
1081
1081
  });
1082
1082
  const useButtonStyles_unstable = (state)=>{
1083
- 'use no memo';
1084
1083
  const rootBaseClassName = useRootBaseClassName();
1085
1084
  const iconBaseClassName = useIconBaseClassName();
1086
1085
  const rootStyles = useRootStyles();
@@ -1089,12 +1088,14 @@ const useButtonStyles_unstable = (state)=>{
1089
1088
  const rootIconOnlyStyles = useRootIconOnlyStyles();
1090
1089
  const iconStyles = useIconStyles();
1091
1090
  const { appearance, disabled, disabledFocusable, icon, iconOnly, iconPosition, shape, size } = state;
1091
+ // eslint-disable-next-line react-hooks/immutability
1092
1092
  state.root.className = (0, _react.mergeClasses)(buttonClassNames.root, rootBaseClassName, appearance && rootStyles[appearance], rootStyles[size], icon && size === 'small' && rootStyles.smallWithIcon, icon && size === 'large' && rootStyles.largeWithIcon, rootStyles[shape], // Disabled styles
1093
1093
  (disabled || disabledFocusable) && rootDisabledStyles.base, (disabled || disabledFocusable) && rootDisabledStyles.highContrast, appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance], // Focus styles
1094
1094
  appearance === 'primary' && rootFocusStyles.primary, rootFocusStyles[size], rootFocusStyles[shape], // Icon-only styles
1095
1095
  iconOnly && rootIconOnlyStyles[size], // User provided class name
1096
1096
  state.root.className);
1097
1097
  if (state.icon) {
1098
+ // eslint-disable-next-line react-hooks/immutability
1098
1099
  state.icon.className = (0, _react.mergeClasses)(buttonClassNames.icon, iconBaseClassName, !!state.root.children && iconStyles[iconPosition], iconStyles[size], state.icon.className);
1099
1100
  }
1100
1101
  return state;