@fluentui/react-button 9.5.3 → 9.6.1

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 (97) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/lib/Button.js.map +1 -1
  3. package/lib/CompoundButton.js.map +1 -1
  4. package/lib/MenuButton.js.map +1 -1
  5. package/lib/SplitButton.js.map +1 -1
  6. package/lib/ToggleButton.js.map +1 -1
  7. package/lib/components/Button/Button.js.map +1 -1
  8. package/lib/components/Button/Button.types.js.map +1 -1
  9. package/lib/components/Button/index.js.map +1 -1
  10. package/lib/components/Button/renderButton.js.map +1 -1
  11. package/lib/components/Button/useButton.js.map +1 -1
  12. package/lib/components/Button/useButtonStyles.styles.raw.js +488 -0
  13. package/lib/components/Button/useButtonStyles.styles.raw.js.map +1 -0
  14. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  15. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  16. package/lib/components/CompoundButton/index.js.map +1 -1
  17. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  18. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  19. package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js +241 -0
  20. package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +1 -0
  21. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  22. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  23. package/lib/components/MenuButton/index.js.map +1 -1
  24. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  25. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  26. package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js +112 -0
  27. package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +1 -0
  28. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  29. package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
  30. package/lib/components/SplitButton/index.js.map +1 -1
  31. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  32. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  33. package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js +158 -0
  34. package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +1 -0
  35. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  36. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  37. package/lib/components/ToggleButton/index.js.map +1 -1
  38. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
  39. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  40. package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js +226 -0
  41. package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +1 -0
  42. package/lib/contexts/ButtonContext.js.map +1 -1
  43. package/lib/contexts/index.js.map +1 -1
  44. package/lib/index.js.map +1 -1
  45. package/lib/utils/index.js.map +1 -1
  46. package/lib/utils/useToggleState.js.map +1 -1
  47. package/lib-commonjs/Button.js.map +1 -1
  48. package/lib-commonjs/CompoundButton.js.map +1 -1
  49. package/lib-commonjs/MenuButton.js.map +1 -1
  50. package/lib-commonjs/SplitButton.js.map +1 -1
  51. package/lib-commonjs/ToggleButton.js.map +1 -1
  52. package/lib-commonjs/components/Button/Button.js.map +1 -1
  53. package/lib-commonjs/components/Button/Button.types.js.map +1 -1
  54. package/lib-commonjs/components/Button/index.js.map +1 -1
  55. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  56. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  57. package/lib-commonjs/components/Button/useButtonStyles.styles.js.map +1 -1
  58. package/lib-commonjs/components/Button/useButtonStyles.styles.raw.js +495 -0
  59. package/lib-commonjs/components/Button/useButtonStyles.styles.raw.js.map +1 -0
  60. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  61. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
  62. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  63. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  64. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  65. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.js.map +1 -1
  66. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.js +253 -0
  67. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +1 -0
  68. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  69. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
  70. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  71. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  72. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  73. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.js.map +1 -1
  74. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.js +129 -0
  75. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +1 -0
  76. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  77. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
  78. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  79. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  80. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  81. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.js.map +1 -1
  82. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.js +174 -0
  83. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +1 -0
  84. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  85. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
  86. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  87. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  88. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  89. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.js.map +1 -1
  90. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.js +237 -0
  91. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +1 -0
  92. package/lib-commonjs/contexts/ButtonContext.js.map +1 -1
  93. package/lib-commonjs/contexts/index.js.map +1 -1
  94. package/lib-commonjs/index.js.map +1 -1
  95. package/lib-commonjs/utils/index.js.map +1 -1
  96. package/lib-commonjs/utils/useToggleState.js.map +1 -1
  97. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,12 +1,35 @@
1
1
  # Change Log - @fluentui/react-button
2
2
 
3
- This log was last generated on Fri, 27 Jun 2025 13:36:33 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 28 Jul 2025 18:44:12 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.6.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.6.1)
8
+
9
+ Mon, 28 Jul 2025 18:44:12 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.6.0..@fluentui/react-button_v9.6.1)
11
+
12
+ ### Patches
13
+
14
+ - Bump @fluentui/react-aria to v9.16.0 ([PR #34918](https://github.com/microsoft/fluentui/pull/34918) by beachball)
15
+ - Bump @fluentui/react-jsx-runtime to v9.1.3 ([PR #34918](https://github.com/microsoft/fluentui/pull/34918) by beachball)
16
+ - Bump @fluentui/react-tabster to v9.26.1 ([PR #34918](https://github.com/microsoft/fluentui/pull/34918) by beachball)
17
+ - Bump @fluentui/react-utilities to v9.23.0 ([PR #34918](https://github.com/microsoft/fluentui/pull/34918) by beachball)
18
+
19
+ ## [9.6.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.6.0)
20
+
21
+ Thu, 17 Jul 2025 13:49:35 GMT
22
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.5.3..@fluentui/react-button_v9.6.0)
23
+
24
+ ### Minor changes
25
+
26
+ - feat: enable griffel raw styles ([PR #34853](https://github.com/microsoft/fluentui/pull/34853) by martinhochel@microsoft.com)
27
+ - Bump @fluentui/react-aria to v9.15.4 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
28
+ - Bump @fluentui/react-tabster to v9.26.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
29
+
7
30
  ## [9.5.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.5.3)
8
31
 
9
- Fri, 27 Jun 2025 13:36:33 GMT
32
+ Fri, 27 Jun 2025 13:39:41 GMT
10
33
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.5.2..@fluentui/react-button_v9.5.3)
11
34
 
12
35
  ### Patches
package/lib/Button.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Button.tsx"],"sourcesContent":["export type { ButtonProps, ButtonSlots, ButtonState } from './components/Button/index';\nexport {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './components/Button/index';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable"],"rangeMappings":"","mappings":"AACA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,QACb,4BAA4B"}
1
+ {"version":3,"sources":["../src/Button.tsx"],"sourcesContent":["export type { ButtonProps, ButtonSlots, ButtonState } from './components/Button/index';\nexport {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './components/Button/index';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable"],"mappings":"AACA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,QACb,4BAA4B"}
@@ -1 +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"],"rangeMappings":"","mappings":"AACA,SACEA,cAAc,EACdC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,oCAAoC"}
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":"AACA,SACEA,cAAc,EACdC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,oCAAoC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/MenuButton.ts"],"sourcesContent":["export type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './components/MenuButton/index';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './components/MenuButton/index';\n"],"names":["MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable"],"rangeMappings":"","mappings":"AACA,SACEA,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,gCAAgC"}
1
+ {"version":3,"sources":["../src/MenuButton.ts"],"sourcesContent":["export type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './components/MenuButton/index';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './components/MenuButton/index';\n"],"names":["MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable"],"mappings":"AACA,SACEA,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,gCAAgC"}
@@ -1 +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"],"rangeMappings":"","mappings":"AACA,SACEA,WAAW,EACXC,0BAA0B,EAC1BC,qBAAqB,EACrBC,6BAA6B,EAC7BC,uBAAuB,QAClB,iCAAiC"}
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":"AACA,SACEA,WAAW,EACXC,0BAA0B,EAC1BC,qBAAqB,EACrBC,6BAA6B,EAC7BC,uBAAuB,QAClB,iCAAiC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ToggleButton.ts"],"sourcesContent":["export type { ToggleButtonProps, ToggleButtonState } from './components/ToggleButton/index';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './components/ToggleButton/index';\n"],"names":["ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable"],"rangeMappings":"","mappings":"AACA,SACEA,YAAY,EACZC,2BAA2B,EAC3BC,sBAAsB,EACtBC,8BAA8B,EAC9BC,wBAAwB,QACnB,kCAAkC"}
1
+ {"version":3,"sources":["../src/ToggleButton.ts"],"sourcesContent":["export type { ToggleButtonProps, ToggleButtonState } from './components/ToggleButton/index';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './components/ToggleButton/index';\n"],"names":["ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable"],"mappings":"AACA,SACEA,YAAY,EACZC,2BAA2B,EAC3BC,sBAAsB,EACtBC,8BAA8B,EAC9BC,wBAAwB,QACnB,kCAAkC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Button/Button.tsx"],"sourcesContent":["import * 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"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,wBAAwB,QAAQ,2BAA2B;AAGpE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,uBAA2CL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,QAAQP,mBAAmBK,OAAOC;IAExCL,yBAAyBM;IAEzBL,4BAA4B,4BAA4BK;IAExD,OAAOR,sBAAsBQ;AAC7B,0FAA0F;AAC5F,GAAuC;AAEvCJ,OAAOK,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/Button/Button.tsx"],"sourcesContent":["import * 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,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,wBAAwB,QAAQ,2BAA2B;AAGpE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,uBAA2CL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,QAAQP,mBAAmBK,OAAOC;IAExCL,yBAAyBM;IAEzBL,4BAA4B,4BAA4BK;IAExD,OAAOR,sBAAsBQ;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, 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 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"],"names":[],"rangeMappings":"","mappings":"AAuEA,WAQI"}
1
+ {"version":3,"sources":["../src/components/Button/Button.types.ts"],"sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, 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 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"],"names":[],"mappings":"AAuEA,WAQI"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Button/index.ts"],"sourcesContent":["export { Button } from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button.types';\nexport { renderButton_unstable } from './renderButton';\nexport { useButton_unstable } from './useButton';\nexport { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles.styles';\n"],"names":["Button","renderButton_unstable","useButton_unstable","buttonClassNames","useButtonStyles_unstable"],"rangeMappings":";;;","mappings":"AAAA,SAASA,MAAM,QAAQ,WAAW;AAGlC,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,gBAAgB,EAAEC,wBAAwB,QAAQ,2BAA2B"}
1
+ {"version":3,"sources":["../src/components/Button/index.ts"],"sourcesContent":["export { Button } from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button.types';\nexport { renderButton_unstable } from './renderButton';\nexport { useButton_unstable } from './useButton';\nexport { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles.styles';\n"],"names":["Button","renderButton_unstable","useButton_unstable","buttonClassNames","useButtonStyles_unstable"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAW;AAGlC,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,gBAAgB,EAAEC,wBAAwB,QAAQ,2BAA2B"}
@@ -1 +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 { ButtonSlots, ButtonState } 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: ButtonState) => {\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"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC;IACpCF,YAAyBE;IACzB,MAAM,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAGF;IAEnC,qBACE,MAACA,MAAMG,IAAI;;YACRD,iBAAiB,WAAWF,MAAMI,IAAI,kBAAI,KAACJ,MAAMI,IAAI;YACrD,CAACH,YAAYD,MAAMG,IAAI,CAACE,QAAQ;YAChCH,iBAAiB,WAAWF,MAAMI,IAAI,kBAAI,KAACJ,MAAMI,IAAI;;;AAG5D,EAAE"}
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 { ButtonSlots, ButtonState } 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: ButtonState) => {\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":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC;IACpCF,YAAyBE;IACzB,MAAM,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAGF;IAEnC,qBACE,MAACA,MAAMG,IAAI;;YACRD,iBAAiB,WAAWF,MAAMI,IAAI,kBAAI,KAACJ,MAAMI,IAAI;YACrD,CAACH,YAAYD,MAAMG,IAAI,CAACE,QAAQ;YAChCH,iBAAiB,WAAWF,MAAMI,IAAI,kBAAI,KAACJ,MAAMI,IAAI;;;AAG5D,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Button/useButton.ts"],"sourcesContent":["import * as React from 'react';\nimport { ARIAButtonSlotProps, useARIAButtonProps } from '@fluentui/react-aria';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useButtonContext } from '../../contexts/ButtonContext';\nimport type { 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 {\n appearance = 'secondary',\n as = 'button',\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n shape = 'rounded',\n size = contextSize ?? 'medium',\n } = props;\n const iconShorthand = slot.optional(icon, { elementType: 'span' });\n return {\n // Props passed at the top-level\n appearance,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size, // State calculated from a set of props\n iconOnly: Boolean(iconShorthand?.children && !props.children), // Slots definition\n components: { root: 'button', icon: 'span' },\n root: slot.always<ARIAButtonSlotProps<'a'>>(getIntrinsicElementProps(as, useARIAButtonProps(props.as, props)), {\n elementType: 'button',\n defaultProps: {\n ref: ref as React.Ref<HTMLButtonElement & HTMLAnchorElement>,\n type: as === 'button' ? 'button' : undefined,\n },\n }),\n icon: iconShorthand,\n };\n};\n"],"names":["React","useARIAButtonProps","getIntrinsicElementProps","slot","useButtonContext","useButton_unstable","props","ref","size","contextSize","appearance","as","disabled","disabledFocusable","icon","iconPosition","shape","iconShorthand","optional","elementType","iconOnly","Boolean","children","components","root","always","defaultProps","type","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAA8BC,kBAAkB,QAAQ,uBAAuB;AAC/E,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAC3E,SAASC,gBAAgB,QAAQ,+BAA+B;AAGhE;;;;CAIC,GACD,OAAO,MAAMC,qBAAqB,CAChCC,OACAC;IAEA,MAAM,EAAEC,MAAMC,WAAW,EAAE,GAAGL;IAC9B,MAAM,EACJM,aAAa,WAAW,EACxBC,KAAK,QAAQ,EACbC,WAAW,KAAK,EAChBC,oBAAoB,KAAK,EACzBC,IAAI,EACJC,eAAe,QAAQ,EACvBC,QAAQ,SAAS,EACjBR,OAAOC,wBAAAA,yBAAAA,cAAe,QAAQ,EAC/B,GAAGH;IACJ,MAAMW,gBAAgBd,KAAKe,QAAQ,CAACJ,MAAM;QAAEK,aAAa;IAAO;IAChE,OAAO;QACL,gCAAgC;QAChCT;QACAE;QACAC;QACAE;QACAC;QACAR;QACAY,UAAUC,QAAQJ,CAAAA,0BAAAA,oCAAAA,cAAeK,QAAQ,KAAI,CAAChB,MAAMgB,QAAQ;QAC5DC,YAAY;YAAEC,MAAM;YAAUV,MAAM;QAAO;QAC3CU,MAAMrB,KAAKsB,MAAM,CAA2BvB,yBAAyBS,IAAIV,mBAAmBK,MAAMK,EAAE,EAAEL,SAAS;YAC7Ga,aAAa;YACbO,cAAc;gBACZnB,KAAKA;gBACLoB,MAAMhB,OAAO,WAAW,WAAWiB;YACrC;QACF;QACAd,MAAMG;IACR;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/Button/useButton.ts"],"sourcesContent":["import * as React from 'react';\nimport { ARIAButtonSlotProps, useARIAButtonProps } from '@fluentui/react-aria';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useButtonContext } from '../../contexts/ButtonContext';\nimport type { 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 {\n appearance = 'secondary',\n as = 'button',\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n shape = 'rounded',\n size = contextSize ?? 'medium',\n } = props;\n const iconShorthand = slot.optional(icon, { elementType: 'span' });\n return {\n // Props passed at the top-level\n appearance,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size, // State calculated from a set of props\n iconOnly: Boolean(iconShorthand?.children && !props.children), // Slots definition\n components: { root: 'button', icon: 'span' },\n root: slot.always<ARIAButtonSlotProps<'a'>>(getIntrinsicElementProps(as, useARIAButtonProps(props.as, props)), {\n elementType: 'button',\n defaultProps: {\n ref: ref as React.Ref<HTMLButtonElement & HTMLAnchorElement>,\n type: as === 'button' ? 'button' : undefined,\n },\n }),\n icon: iconShorthand,\n };\n};\n"],"names":["React","useARIAButtonProps","getIntrinsicElementProps","slot","useButtonContext","useButton_unstable","props","ref","size","contextSize","appearance","as","disabled","disabledFocusable","icon","iconPosition","shape","iconShorthand","optional","elementType","iconOnly","Boolean","children","components","root","always","defaultProps","type","undefined"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAA8BC,kBAAkB,QAAQ,uBAAuB;AAC/E,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAC3E,SAASC,gBAAgB,QAAQ,+BAA+B;AAGhE;;;;CAIC,GACD,OAAO,MAAMC,qBAAqB,CAChCC,OACAC;IAEA,MAAM,EAAEC,MAAMC,WAAW,EAAE,GAAGL;IAC9B,MAAM,EACJM,aAAa,WAAW,EACxBC,KAAK,QAAQ,EACbC,WAAW,KAAK,EAChBC,oBAAoB,KAAK,EACzBC,IAAI,EACJC,eAAe,QAAQ,EACvBC,QAAQ,SAAS,EACjBR,OAAOC,wBAAAA,yBAAAA,cAAe,QAAQ,EAC/B,GAAGH;IACJ,MAAMW,gBAAgBd,KAAKe,QAAQ,CAACJ,MAAM;QAAEK,aAAa;IAAO;IAChE,OAAO;QACL,gCAAgC;QAChCT;QACAE;QACAC;QACAE;QACAC;QACAR;QACAY,UAAUC,QAAQJ,CAAAA,0BAAAA,oCAAAA,cAAeK,QAAQ,KAAI,CAAChB,MAAMgB,QAAQ;QAC5DC,YAAY;YAAEC,MAAM;YAAUV,MAAM;QAAO;QAC3CU,MAAMrB,KAAKsB,MAAM,CAA2BvB,yBAAyBS,IAAIV,mBAAmBK,MAAMK,EAAE,EAAEL,SAAS;YAC7Ga,aAAa;YACbO,cAAc;gBACZnB,KAAKA;gBACLoB,MAAMhB,OAAO,WAAW,WAAWiB;YACrC;QACF;QACAd,MAAMG;IACR;AACF,EAAE"}
@@ -0,0 +1,488 @@
1
+ import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';
2
+ import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
3
+ import { tokens } from '@fluentui/react-theme';
4
+ import { shorthands, makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';
5
+ export const buttonClassNames = {
6
+ root: 'fui-Button',
7
+ icon: 'fui-Button__icon'
8
+ };
9
+ const iconSpacingVar = '--fui-Button__icon--spacing';
10
+ const buttonSpacingSmall = '3px';
11
+ const buttonSpacingSmallWithIcon = '1px';
12
+ const buttonSpacingMedium = '5px';
13
+ const buttonSpacingLarge = '8px';
14
+ const buttonSpacingLargeWithIcon = '7px';
15
+ /* Firefox has box shadow sizing issue at some zoom levels
16
+ * this will ensure the inset boxShadow is always uniform
17
+ * without affecting other browser platforms
18
+ */ const boxShadowStrokeWidthThinMoz = `calc(${tokens.strokeWidthThin} + 0.25px)`;
19
+ const useRootBaseClassName = makeResetStyles({
20
+ alignItems: 'center',
21
+ boxSizing: 'border-box',
22
+ display: 'inline-flex',
23
+ justifyContent: 'center',
24
+ textDecorationLine: 'none',
25
+ verticalAlign: 'middle',
26
+ margin: 0,
27
+ overflow: 'hidden',
28
+ backgroundColor: tokens.colorNeutralBackground1,
29
+ color: tokens.colorNeutralForeground1,
30
+ border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,
31
+ fontFamily: tokens.fontFamilyBase,
32
+ outlineStyle: 'none',
33
+ ':hover': {
34
+ backgroundColor: tokens.colorNeutralBackground1Hover,
35
+ borderColor: tokens.colorNeutralStroke1Hover,
36
+ color: tokens.colorNeutralForeground1Hover,
37
+ cursor: 'pointer'
38
+ },
39
+ ':hover:active': {
40
+ backgroundColor: tokens.colorNeutralBackground1Pressed,
41
+ borderColor: tokens.colorNeutralStroke1Pressed,
42
+ color: tokens.colorNeutralForeground1Pressed,
43
+ outlineStyle: 'none'
44
+ },
45
+ padding: `${buttonSpacingMedium} ${tokens.spacingHorizontalM}`,
46
+ minWidth: '96px',
47
+ borderRadius: tokens.borderRadiusMedium,
48
+ fontSize: tokens.fontSizeBase300,
49
+ fontWeight: tokens.fontWeightSemibold,
50
+ lineHeight: tokens.lineHeightBase300,
51
+ // Transition styles
52
+ transitionDuration: tokens.durationFaster,
53
+ transitionProperty: 'background, border, color',
54
+ transitionTimingFunction: tokens.curveEasyEase,
55
+ '@media screen and (prefers-reduced-motion: reduce)': {
56
+ transitionDuration: '0.01ms'
57
+ },
58
+ // High contrast styles
59
+ '@media (forced-colors: active)': {
60
+ ':focus': {
61
+ borderColor: 'ButtonText'
62
+ },
63
+ ':hover': {
64
+ backgroundColor: 'HighlightText',
65
+ borderColor: 'Highlight',
66
+ color: 'Highlight',
67
+ forcedColorAdjust: 'none'
68
+ },
69
+ ':hover:active': {
70
+ backgroundColor: 'HighlightText',
71
+ borderColor: 'Highlight',
72
+ color: 'Highlight',
73
+ forcedColorAdjust: 'none'
74
+ }
75
+ },
76
+ // Focus styles
77
+ ...createCustomFocusIndicatorStyle({
78
+ borderColor: tokens.colorStrokeFocus2,
79
+ borderRadius: tokens.borderRadiusMedium,
80
+ borderWidth: '1px',
81
+ outline: `${tokens.strokeWidthThick} solid ${tokens.colorTransparentStroke}`,
82
+ boxShadow: `0 0 0 ${tokens.strokeWidthThin} ${tokens.colorStrokeFocus2}
83
+ inset
84
+ `,
85
+ zIndex: 1
86
+ }),
87
+ // BUGFIX: Mozilla specific styles (Mozilla BugID: 1857642)
88
+ '@supports (-moz-appearance:button)': {
89
+ ...createCustomFocusIndicatorStyle({
90
+ boxShadow: `0 0 0 ${boxShadowStrokeWidthThinMoz} ${tokens.colorStrokeFocus2}
91
+ inset
92
+ `
93
+ })
94
+ }
95
+ });
96
+ const useIconBaseClassName = makeResetStyles({
97
+ alignItems: 'center',
98
+ display: 'inline-flex',
99
+ justifyContent: 'center',
100
+ fontSize: '20px',
101
+ height: '20px',
102
+ width: '20px',
103
+ [iconSpacingVar]: tokens.spacingHorizontalSNudge
104
+ });
105
+ const useRootStyles = makeStyles({
106
+ // Appearance variations
107
+ outline: {
108
+ backgroundColor: tokens.colorTransparentBackground,
109
+ ':hover': {
110
+ backgroundColor: tokens.colorTransparentBackgroundHover
111
+ },
112
+ ':hover:active': {
113
+ backgroundColor: tokens.colorTransparentBackgroundPressed
114
+ }
115
+ },
116
+ primary: {
117
+ backgroundColor: tokens.colorBrandBackground,
118
+ ...shorthands.borderColor('transparent'),
119
+ color: tokens.colorNeutralForegroundOnBrand,
120
+ ':hover': {
121
+ backgroundColor: tokens.colorBrandBackgroundHover,
122
+ ...shorthands.borderColor('transparent'),
123
+ color: tokens.colorNeutralForegroundOnBrand
124
+ },
125
+ ':hover:active': {
126
+ backgroundColor: tokens.colorBrandBackgroundPressed,
127
+ ...shorthands.borderColor('transparent'),
128
+ color: tokens.colorNeutralForegroundOnBrand
129
+ },
130
+ '@media (forced-colors: active)': {
131
+ backgroundColor: 'Highlight',
132
+ ...shorthands.borderColor('HighlightText'),
133
+ color: 'HighlightText',
134
+ forcedColorAdjust: 'none',
135
+ ':hover': {
136
+ backgroundColor: 'HighlightText',
137
+ ...shorthands.borderColor('Highlight'),
138
+ color: 'Highlight'
139
+ },
140
+ ':hover:active': {
141
+ backgroundColor: 'HighlightText',
142
+ ...shorthands.borderColor('Highlight'),
143
+ color: 'Highlight'
144
+ }
145
+ }
146
+ },
147
+ secondary: {
148
+ },
149
+ subtle: {
150
+ backgroundColor: tokens.colorSubtleBackground,
151
+ ...shorthands.borderColor('transparent'),
152
+ color: tokens.colorNeutralForeground2,
153
+ ':hover': {
154
+ backgroundColor: tokens.colorSubtleBackgroundHover,
155
+ ...shorthands.borderColor('transparent'),
156
+ color: tokens.colorNeutralForeground2Hover,
157
+ [`& .${iconFilledClassName}`]: {
158
+ display: 'inline'
159
+ },
160
+ [`& .${iconRegularClassName}`]: {
161
+ display: 'none'
162
+ },
163
+ [`& .${buttonClassNames.icon}`]: {
164
+ color: tokens.colorNeutralForeground2BrandHover
165
+ }
166
+ },
167
+ ':hover:active': {
168
+ backgroundColor: tokens.colorSubtleBackgroundPressed,
169
+ ...shorthands.borderColor('transparent'),
170
+ color: tokens.colorNeutralForeground2Pressed,
171
+ [`& .${iconFilledClassName}`]: {
172
+ display: 'inline'
173
+ },
174
+ [`& .${iconRegularClassName}`]: {
175
+ display: 'none'
176
+ },
177
+ [`& .${buttonClassNames.icon}`]: {
178
+ color: tokens.colorNeutralForeground2BrandPressed
179
+ }
180
+ },
181
+ '@media (forced-colors: active)': {
182
+ ':hover': {
183
+ color: 'Highlight',
184
+ [`& .${buttonClassNames.icon}`]: {
185
+ color: 'Highlight'
186
+ }
187
+ },
188
+ ':hover:active': {
189
+ color: 'Highlight',
190
+ [`& .${buttonClassNames.icon}`]: {
191
+ color: 'Highlight'
192
+ }
193
+ }
194
+ }
195
+ },
196
+ transparent: {
197
+ backgroundColor: tokens.colorTransparentBackground,
198
+ ...shorthands.borderColor('transparent'),
199
+ color: tokens.colorNeutralForeground2,
200
+ ':hover': {
201
+ backgroundColor: tokens.colorTransparentBackgroundHover,
202
+ ...shorthands.borderColor('transparent'),
203
+ color: tokens.colorNeutralForeground2BrandHover,
204
+ [`& .${iconFilledClassName}`]: {
205
+ display: 'inline'
206
+ },
207
+ [`& .${iconRegularClassName}`]: {
208
+ display: 'none'
209
+ }
210
+ },
211
+ ':hover:active': {
212
+ backgroundColor: tokens.colorTransparentBackgroundPressed,
213
+ ...shorthands.borderColor('transparent'),
214
+ color: tokens.colorNeutralForeground2BrandPressed,
215
+ [`& .${iconFilledClassName}`]: {
216
+ display: 'inline'
217
+ },
218
+ [`& .${iconRegularClassName}`]: {
219
+ display: 'none'
220
+ }
221
+ },
222
+ '@media (forced-colors: active)': {
223
+ ':hover': {
224
+ backgroundColor: tokens.colorTransparentBackground,
225
+ color: 'Highlight'
226
+ },
227
+ ':hover:active': {
228
+ backgroundColor: tokens.colorTransparentBackground,
229
+ color: 'Highlight'
230
+ }
231
+ }
232
+ },
233
+ // Shape variations
234
+ circular: {
235
+ borderRadius: tokens.borderRadiusCircular
236
+ },
237
+ rounded: {
238
+ },
239
+ square: {
240
+ borderRadius: tokens.borderRadiusNone
241
+ },
242
+ // Size variations
243
+ small: {
244
+ minWidth: '64px',
245
+ padding: `${buttonSpacingSmall} ${tokens.spacingHorizontalS}`,
246
+ borderRadius: tokens.borderRadiusMedium,
247
+ fontSize: tokens.fontSizeBase200,
248
+ fontWeight: tokens.fontWeightRegular,
249
+ lineHeight: tokens.lineHeightBase200
250
+ },
251
+ smallWithIcon: {
252
+ paddingBottom: buttonSpacingSmallWithIcon,
253
+ paddingTop: buttonSpacingSmallWithIcon
254
+ },
255
+ medium: {
256
+ },
257
+ large: {
258
+ minWidth: '96px',
259
+ padding: `${buttonSpacingLarge} ${tokens.spacingHorizontalL}`,
260
+ borderRadius: tokens.borderRadiusMedium,
261
+ fontSize: tokens.fontSizeBase400,
262
+ fontWeight: tokens.fontWeightSemibold,
263
+ lineHeight: tokens.lineHeightBase400
264
+ },
265
+ largeWithIcon: {
266
+ paddingBottom: buttonSpacingLargeWithIcon,
267
+ paddingTop: buttonSpacingLargeWithIcon
268
+ }
269
+ });
270
+ const useRootDisabledStyles = makeStyles({
271
+ // Base styles
272
+ base: {
273
+ backgroundColor: tokens.colorNeutralBackgroundDisabled,
274
+ ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),
275
+ color: tokens.colorNeutralForegroundDisabled,
276
+ cursor: 'not-allowed',
277
+ [`& .${buttonClassNames.icon}`]: {
278
+ color: tokens.colorNeutralForegroundDisabled
279
+ },
280
+ ':hover': {
281
+ backgroundColor: tokens.colorNeutralBackgroundDisabled,
282
+ ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),
283
+ color: tokens.colorNeutralForegroundDisabled,
284
+ cursor: 'not-allowed',
285
+ [`& .${iconFilledClassName}`]: {
286
+ display: 'none'
287
+ },
288
+ [`& .${iconRegularClassName}`]: {
289
+ display: 'inline'
290
+ },
291
+ [`& .${buttonClassNames.icon}`]: {
292
+ color: tokens.colorNeutralForegroundDisabled
293
+ }
294
+ },
295
+ ':hover:active': {
296
+ backgroundColor: tokens.colorNeutralBackgroundDisabled,
297
+ ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),
298
+ color: tokens.colorNeutralForegroundDisabled,
299
+ cursor: 'not-allowed',
300
+ [`& .${iconFilledClassName}`]: {
301
+ display: 'none'
302
+ },
303
+ [`& .${iconRegularClassName}`]: {
304
+ display: 'inline'
305
+ },
306
+ [`& .${buttonClassNames.icon}`]: {
307
+ color: tokens.colorNeutralForegroundDisabled
308
+ }
309
+ }
310
+ },
311
+ // High contrast styles
312
+ highContrast: {
313
+ '@media (forced-colors: active)': {
314
+ backgroundColor: 'ButtonFace',
315
+ ...shorthands.borderColor('GrayText'),
316
+ color: 'GrayText',
317
+ [`& .${buttonClassNames.icon}`]: {
318
+ color: 'GrayText'
319
+ },
320
+ ':focus': {
321
+ ...shorthands.borderColor('GrayText')
322
+ },
323
+ ':hover': {
324
+ backgroundColor: 'ButtonFace',
325
+ ...shorthands.borderColor('GrayText'),
326
+ color: 'GrayText',
327
+ [`& .${buttonClassNames.icon}`]: {
328
+ color: 'GrayText'
329
+ }
330
+ },
331
+ ':hover:active': {
332
+ backgroundColor: 'ButtonFace',
333
+ ...shorthands.borderColor('GrayText'),
334
+ color: 'GrayText',
335
+ [`& .${buttonClassNames.icon}`]: {
336
+ color: 'GrayText'
337
+ }
338
+ }
339
+ }
340
+ },
341
+ // Appearance variations
342
+ outline: {
343
+ backgroundColor: tokens.colorTransparentBackground,
344
+ ':hover': {
345
+ backgroundColor: tokens.colorTransparentBackground
346
+ },
347
+ ':hover:active': {
348
+ backgroundColor: tokens.colorTransparentBackground
349
+ }
350
+ },
351
+ primary: {
352
+ ...shorthands.borderColor('transparent'),
353
+ ':hover': {
354
+ ...shorthands.borderColor('transparent')
355
+ },
356
+ ':hover:active': {
357
+ ...shorthands.borderColor('transparent')
358
+ }
359
+ },
360
+ secondary: {
361
+ },
362
+ subtle: {
363
+ backgroundColor: tokens.colorTransparentBackground,
364
+ ...shorthands.borderColor('transparent'),
365
+ ':hover': {
366
+ backgroundColor: tokens.colorTransparentBackground,
367
+ ...shorthands.borderColor('transparent')
368
+ },
369
+ ':hover:active': {
370
+ backgroundColor: tokens.colorTransparentBackground,
371
+ ...shorthands.borderColor('transparent')
372
+ }
373
+ },
374
+ transparent: {
375
+ backgroundColor: tokens.colorTransparentBackground,
376
+ ...shorthands.borderColor('transparent'),
377
+ ':hover': {
378
+ backgroundColor: tokens.colorTransparentBackground,
379
+ ...shorthands.borderColor('transparent')
380
+ },
381
+ ':hover:active': {
382
+ backgroundColor: tokens.colorTransparentBackground,
383
+ ...shorthands.borderColor('transparent')
384
+ }
385
+ }
386
+ });
387
+ const useRootFocusStyles = makeStyles({
388
+ // Shape variations
389
+ circular: createCustomFocusIndicatorStyle({
390
+ borderRadius: tokens.borderRadiusCircular
391
+ }),
392
+ rounded: {
393
+ },
394
+ square: createCustomFocusIndicatorStyle({
395
+ borderRadius: tokens.borderRadiusNone
396
+ }),
397
+ // Primary styles
398
+ primary: {
399
+ ...createCustomFocusIndicatorStyle({
400
+ ...shorthands.borderColor(tokens.colorStrokeFocus2),
401
+ boxShadow: `${tokens.shadow2}, 0 0 0 ${tokens.strokeWidthThin} ${tokens.colorStrokeFocus2} inset, 0 0 0 ${tokens.strokeWidthThick} ${tokens.colorNeutralForegroundOnBrand} inset`,
402
+ ':hover': {
403
+ boxShadow: `${tokens.shadow2}, 0 0 0 ${tokens.strokeWidthThin} ${tokens.colorStrokeFocus2} inset`,
404
+ ...shorthands.borderColor(tokens.colorStrokeFocus2)
405
+ }
406
+ }),
407
+ // BUGFIX: Mozilla specific styles (Mozilla BugID: 1857642)
408
+ '@supports (-moz-appearance:button)': {
409
+ ...createCustomFocusIndicatorStyle({
410
+ boxShadow: `${tokens.shadow2}, 0 0 0 ${boxShadowStrokeWidthThinMoz} ${tokens.colorStrokeFocus2} inset, 0 0 0 ${tokens.strokeWidthThick} ${tokens.colorNeutralForegroundOnBrand} inset`,
411
+ ':hover': {
412
+ boxShadow: `${tokens.shadow2}, 0 0 0 ${boxShadowStrokeWidthThinMoz} ${tokens.colorStrokeFocus2} inset`
413
+ }
414
+ })
415
+ }
416
+ },
417
+ // Size variations
418
+ small: createCustomFocusIndicatorStyle({
419
+ borderRadius: tokens.borderRadiusSmall
420
+ }),
421
+ medium: {
422
+ },
423
+ large: createCustomFocusIndicatorStyle({
424
+ borderRadius: tokens.borderRadiusLarge
425
+ })
426
+ });
427
+ const useRootIconOnlyStyles = makeStyles({
428
+ // Size variations
429
+ small: {
430
+ padding: buttonSpacingSmallWithIcon,
431
+ minWidth: '24px',
432
+ maxWidth: '24px'
433
+ },
434
+ medium: {
435
+ padding: buttonSpacingMedium,
436
+ minWidth: '32px',
437
+ maxWidth: '32px'
438
+ },
439
+ large: {
440
+ padding: buttonSpacingLargeWithIcon,
441
+ minWidth: '40px',
442
+ maxWidth: '40px'
443
+ }
444
+ });
445
+ const useIconStyles = makeStyles({
446
+ // Size variations
447
+ small: {
448
+ fontSize: '20px',
449
+ height: '20px',
450
+ width: '20px',
451
+ [iconSpacingVar]: tokens.spacingHorizontalXS
452
+ },
453
+ medium: {
454
+ },
455
+ large: {
456
+ fontSize: '24px',
457
+ height: '24px',
458
+ width: '24px',
459
+ [iconSpacingVar]: tokens.spacingHorizontalSNudge
460
+ },
461
+ // Icon position variations
462
+ before: {
463
+ marginRight: `var(${iconSpacingVar})`
464
+ },
465
+ after: {
466
+ marginLeft: `var(${iconSpacingVar})`
467
+ }
468
+ });
469
+ export const useButtonStyles_unstable = (state)=>{
470
+ 'use no memo';
471
+ const rootBaseClassName = useRootBaseClassName();
472
+ const iconBaseClassName = useIconBaseClassName();
473
+ const rootStyles = useRootStyles();
474
+ const rootDisabledStyles = useRootDisabledStyles();
475
+ const rootFocusStyles = useRootFocusStyles();
476
+ const rootIconOnlyStyles = useRootIconOnlyStyles();
477
+ const iconStyles = useIconStyles();
478
+ const { appearance, disabled, disabledFocusable, icon, iconOnly, iconPosition, shape, size } = state;
479
+ state.root.className = mergeClasses(buttonClassNames.root, rootBaseClassName, appearance && rootStyles[appearance], rootStyles[size], icon && size === 'small' && rootStyles.smallWithIcon, icon && size === 'large' && rootStyles.largeWithIcon, rootStyles[shape], // Disabled styles
480
+ (disabled || disabledFocusable) && rootDisabledStyles.base, (disabled || disabledFocusable) && rootDisabledStyles.highContrast, appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance], // Focus styles
481
+ appearance === 'primary' && rootFocusStyles.primary, rootFocusStyles[size], rootFocusStyles[shape], // Icon-only styles
482
+ iconOnly && rootIconOnlyStyles[size], // User provided class name
483
+ state.root.className);
484
+ if (state.icon) {
485
+ state.icon.className = mergeClasses(buttonClassNames.icon, iconBaseClassName, !!state.root.children && iconStyles[iconPosition], iconStyles[size], state.icon.className);
486
+ }
487
+ return state;
488
+ };