@fluentui/react-button 0.0.0-nightlyebf02572f720211207.1 → 0.0.0-nightlyf3017f159620220222.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. package/CHANGELOG.json +245 -23
  2. package/CHANGELOG.md +60 -13
  3. package/dist/react-button.d.ts +31 -36
  4. package/lib/Button.js.map +1 -1
  5. package/lib/CompoundButton.js.map +1 -1
  6. package/lib/MenuButton.js.map +1 -1
  7. package/lib/SplitButton.js.map +1 -1
  8. package/lib/ToggleButton.js.map +1 -1
  9. package/lib/components/Button/Button.js +6 -6
  10. package/lib/components/Button/Button.js.map +1 -1
  11. package/lib/components/Button/Button.types.d.ts +5 -5
  12. package/lib/components/Button/Button.types.js.map +1 -1
  13. package/lib/components/Button/index.d.ts +2 -2
  14. package/lib/components/Button/index.js +1 -2
  15. package/lib/components/Button/index.js.map +1 -1
  16. package/lib/components/Button/renderButton.d.ts +1 -1
  17. package/lib/components/Button/renderButton.js +6 -3
  18. package/lib/components/Button/renderButton.js.map +1 -1
  19. package/lib/components/Button/useButton.d.ts +1 -1
  20. package/lib/components/Button/useButton.js +3 -2
  21. package/lib/components/Button/useButton.js.map +1 -1
  22. package/lib/components/Button/useButtonStyles.d.ts +1 -9
  23. package/lib/components/Button/useButtonStyles.js +9 -18
  24. package/lib/components/Button/useButtonStyles.js.map +1 -1
  25. package/lib/components/CompoundButton/CompoundButton.js +6 -6
  26. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  27. package/lib/components/CompoundButton/CompoundButton.types.d.ts +4 -4
  28. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  29. package/lib/components/CompoundButton/index.d.ts +1 -1
  30. package/lib/components/CompoundButton/index.js +1 -1
  31. package/lib/components/CompoundButton/index.js.map +1 -1
  32. package/lib/components/CompoundButton/renderCompoundButton.d.ts +1 -1
  33. package/lib/components/CompoundButton/renderCompoundButton.js +8 -3
  34. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  35. package/lib/components/CompoundButton/useCompoundButton.d.ts +1 -1
  36. package/lib/components/CompoundButton/useCompoundButton.js +3 -3
  37. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  38. package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +1 -1
  39. package/lib/components/CompoundButton/useCompoundButtonStyles.js +12 -12
  40. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  41. package/lib/components/MenuButton/MenuButton.js +6 -6
  42. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  43. package/lib/components/MenuButton/MenuButton.types.d.ts +3 -8
  44. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  45. package/lib/components/MenuButton/index.d.ts +1 -1
  46. package/lib/components/MenuButton/index.js +1 -1
  47. package/lib/components/MenuButton/index.js.map +1 -1
  48. package/lib/components/MenuButton/renderMenuButton.d.ts +1 -1
  49. package/lib/components/MenuButton/renderMenuButton.js +6 -3
  50. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  51. package/lib/components/MenuButton/useMenuButton.d.ts +1 -1
  52. package/lib/components/MenuButton/useMenuButton.js +5 -5
  53. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  54. package/lib/components/MenuButton/useMenuButtonStyles.d.ts +1 -1
  55. package/lib/components/MenuButton/useMenuButtonStyles.js +4 -4
  56. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  57. package/lib/components/SplitButton/SplitButton.js +6 -6
  58. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  59. package/lib/components/SplitButton/SplitButton.types.d.ts +6 -4
  60. package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
  61. package/lib/components/SplitButton/index.d.ts +1 -1
  62. package/lib/components/SplitButton/index.js +1 -1
  63. package/lib/components/SplitButton/index.js.map +1 -1
  64. package/lib/components/SplitButton/renderSplitButton.d.ts +1 -1
  65. package/lib/components/SplitButton/renderSplitButton.js +6 -3
  66. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  67. package/lib/components/SplitButton/useSplitButton.d.ts +1 -1
  68. package/lib/components/SplitButton/useSplitButton.js +17 -5
  69. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  70. package/lib/components/SplitButton/useSplitButtonStyles.d.ts +1 -1
  71. package/lib/components/SplitButton/useSplitButtonStyles.js +3 -2
  72. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  73. package/lib/components/ToggleButton/ToggleButton.js +6 -6
  74. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  75. package/lib/components/ToggleButton/ToggleButton.types.d.ts +2 -1
  76. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  77. package/lib/components/ToggleButton/index.d.ts +1 -1
  78. package/lib/components/ToggleButton/index.js +1 -1
  79. package/lib/components/ToggleButton/index.js.map +1 -1
  80. package/lib/components/ToggleButton/renderToggleButton.d.ts +1 -1
  81. package/lib/components/ToggleButton/renderToggleButton.js +1 -1
  82. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
  83. package/lib/components/ToggleButton/useToggleButton.d.ts +1 -1
  84. package/lib/components/ToggleButton/useToggleButton.js +13 -9
  85. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  86. package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +1 -1
  87. package/lib/components/ToggleButton/useToggleButtonStyles.js +5 -4
  88. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  89. package/lib/index.js.map +1 -1
  90. package/lib-commonjs/Button.js.map +1 -1
  91. package/lib-commonjs/CompoundButton.js.map +1 -1
  92. package/lib-commonjs/MenuButton.js.map +1 -1
  93. package/lib-commonjs/SplitButton.js.map +1 -1
  94. package/lib-commonjs/ToggleButton.js.map +1 -1
  95. package/lib-commonjs/components/Button/Button.js +3 -3
  96. package/lib-commonjs/components/Button/Button.js.map +1 -1
  97. package/lib-commonjs/components/Button/Button.types.d.ts +5 -5
  98. package/lib-commonjs/components/Button/Button.types.js.map +1 -1
  99. package/lib-commonjs/components/Button/index.d.ts +2 -2
  100. package/lib-commonjs/components/Button/index.js +3 -5
  101. package/lib-commonjs/components/Button/index.js.map +1 -1
  102. package/lib-commonjs/components/Button/renderButton.d.ts +1 -1
  103. package/lib-commonjs/components/Button/renderButton.js +8 -5
  104. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  105. package/lib-commonjs/components/Button/useButton.d.ts +1 -1
  106. package/lib-commonjs/components/Button/useButton.js +5 -4
  107. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  108. package/lib-commonjs/components/Button/useButtonStyles.d.ts +1 -9
  109. package/lib-commonjs/components/Button/useButtonStyles.js +18 -26
  110. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  111. package/lib-commonjs/components/CompoundButton/CompoundButton.js +3 -3
  112. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  113. package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +4 -4
  114. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
  115. package/lib-commonjs/components/CompoundButton/index.d.ts +1 -1
  116. package/lib-commonjs/components/CompoundButton/index.js +3 -3
  117. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  118. package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +1 -1
  119. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +10 -5
  120. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  121. package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +1 -1
  122. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +4 -4
  123. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  124. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +1 -1
  125. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +23 -22
  126. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  127. package/lib-commonjs/components/MenuButton/MenuButton.js +3 -3
  128. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  129. package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +3 -8
  130. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
  131. package/lib-commonjs/components/MenuButton/index.d.ts +1 -1
  132. package/lib-commonjs/components/MenuButton/index.js +3 -3
  133. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  134. package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +1 -1
  135. package/lib-commonjs/components/MenuButton/renderMenuButton.js +8 -5
  136. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  137. package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +1 -1
  138. package/lib-commonjs/components/MenuButton/useMenuButton.js +5 -5
  139. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  140. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +1 -1
  141. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +8 -8
  142. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  143. package/lib-commonjs/components/SplitButton/SplitButton.js +3 -3
  144. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  145. package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +6 -4
  146. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
  147. package/lib-commonjs/components/SplitButton/index.d.ts +1 -1
  148. package/lib-commonjs/components/SplitButton/index.js +3 -3
  149. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  150. package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +1 -1
  151. package/lib-commonjs/components/SplitButton/renderSplitButton.js +8 -5
  152. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  153. package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +1 -1
  154. package/lib-commonjs/components/SplitButton/useSplitButton.js +18 -6
  155. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  156. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +1 -1
  157. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +11 -9
  158. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  159. package/lib-commonjs/components/ToggleButton/ToggleButton.js +3 -3
  160. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  161. package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +2 -1
  162. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
  163. package/lib-commonjs/components/ToggleButton/index.d.ts +1 -1
  164. package/lib-commonjs/components/ToggleButton/index.js +3 -3
  165. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  166. package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +1 -1
  167. package/lib-commonjs/components/ToggleButton/renderToggleButton.js +3 -3
  168. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  169. package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +1 -1
  170. package/lib-commonjs/components/ToggleButton/useToggleButton.js +14 -10
  171. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  172. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +1 -1
  173. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +10 -8
  174. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  175. package/lib-commonjs/index.js.map +1 -1
  176. package/package.json +9 -11
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAEA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGa,OAAA,CAAA,mBAAA,GAAsB,gBAAtB;;AAEb,MAAM,iBAAiB,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,OAAA,CAAA,YAAA,CAAa,cAAc,CAAC,KAAK,CAAC,IAAP,CAA3B,EAAyC,KAAK,CAAC,QAAN,CAAe,SAAxD,CAA3B;AACD;;AAED,EAAA,iBAAA,CAAA,wBAAA,CAAyB,KAAzB;AAEA,SAAO,KAAP;AACD,CAZM;;AAAM,OAAA,CAAA,4BAAA,GAA4B,4BAA5B","sourcesContent":["import { mergeClasses, makeStyles } from '@griffel/react';\nimport { ButtonState } from '../Button/Button.types';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles';\nimport type { MenuButtonState } from './MenuButton.types';\n\nexport const menuButtonClassName = 'fui-MenuButton';\n\nconst useMenuIconStyles = makeStyles({\n // Size appearance\n small: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n medium: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n large: {\n fontSize: '24px',\n height: '24px',\n width: '24px',\n },\n});\n\nexport const useMenuButtonStyles_unstable = (state: MenuButtonState): MenuButtonState => {\n const menuIconStyles = useMenuIconStyles();\n\n state.root.className = mergeClasses(menuButtonClassName, state.root.className);\n\n if (state.menuIcon) {\n state.menuIcon.className = mergeClasses(menuIconStyles[state.size], state.menuIcon.className);\n }\n\n useButtonStyles_unstable(state as ButtonState);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -19,9 +19,9 @@ const useSplitButtonStyles_1 = /*#__PURE__*/require("./useSplitButtonStyles");
19
19
 
20
20
 
21
21
  exports.SplitButton = /*#__PURE__*/React.forwardRef((props, ref) => {
22
- const state = useSplitButton_1.useSplitButton(props, ref);
23
- useSplitButtonStyles_1.useSplitButtonStyles(state);
24
- return renderSplitButton_1.renderSplitButton(state); // Casting is required due to lack of distributive union to support unions on @types/react
22
+ const state = useSplitButton_1.useSplitButton_unstable(props, ref);
23
+ useSplitButtonStyles_1.useSplitButtonStyles_unstable(state);
24
+ return renderSplitButton_1.renderSplitButton_unstable(state); // Casting is required due to lack of distributive union to support unions on @types/react
25
25
  });
26
26
  exports.SplitButton.displayName = 'SplitButton';
27
27
  //# sourceMappingURL=SplitButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/SplitButton/SplitButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAIA;;;AAGG;;;AACU,OAAA,CAAA,WAAA,gBAAqD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAChG,QAAM,KAAK,GAAG,gBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,GAAtB,CAAd;AAEA,EAAA,sBAAA,CAAA,oBAAA,CAAqB,KAArB;AAEA,SAAO,mBAAA,CAAA,iBAAA,CAAkB,KAAlB,CAAP,CALgG,CAMhG;AACD,CAPiE,CAArD;AASb,OAAA,CAAA,WAAA,CAAY,WAAZ,GAA0B,aAA1B","sourceRoot":""}
1
+ {"version":3,"sources":["components/SplitButton/SplitButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAIA;;;AAGG;;;AACU,OAAA,CAAA,WAAA,gBAAqD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAChG,QAAM,KAAK,GAAG,gBAAA,CAAA,uBAAA,CAAwB,KAAxB,EAA+B,GAA/B,CAAd;AAEA,EAAA,sBAAA,CAAA,6BAAA,CAA8B,KAA9B;AAEA,SAAO,mBAAA,CAAA,0BAAA,CAA2B,KAA3B,CAAP,CALgG,CAMhG;AACD,CAPiE,CAArD;AASb,OAAA,CAAA,WAAA,CAAY,WAAZ,GAA0B,aAA1B","sourcesContent":["import * as React from 'react';\nimport { renderSplitButton_unstable } from './renderSplitButton';\nimport { useSplitButton_unstable } from './useSplitButton';\nimport { useSplitButtonStyles_unstable } from './useSplitButtonStyles';\nimport type { SplitButtonProps } from './SplitButton.types';\nimport { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary\n * action, while interacting with the second one opens a menu with secondary actions.\n */\nexport const SplitButton: ForwardRefComponent<SplitButtonProps> = React.forwardRef((props, ref) => {\n const state = useSplitButton_unstable(props, ref);\n\n useSplitButtonStyles_unstable(state);\n\n return renderSplitButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<SplitButtonProps>;\n\nSplitButton.displayName = 'SplitButton';\n"],"sourceRoot":"../src/"}
@@ -1,19 +1,21 @@
1
- import type { ComponentProps, ComponentState, IntrinsicShorthandProps, ObjectShorthandProps } from '@fluentui/react-utilities';
1
+ import { Button } from '../Button/Button';
2
+ import { MenuButton } from '../MenuButton/MenuButton';
3
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
2
4
  import type { ButtonProps, ButtonState } from '../Button/Button.types';
3
5
  import type { MenuButtonProps, MenuButtonState } from '../MenuButton/MenuButton.types';
4
6
  export declare type SplitButtonSlots = {
5
7
  /**
6
8
  * Root of the component that wraps the primary action button and menu button.
7
9
  */
8
- root: IntrinsicShorthandProps<'div'>;
10
+ root: Slot<'div'>;
9
11
  /**
10
12
  * Button that opens menu with secondary actions in SplitButton.
11
13
  */
12
- menuButton?: ObjectShorthandProps<MenuButtonProps>;
14
+ menuButton?: Slot<typeof MenuButton>;
13
15
  /**
14
16
  * Button to perform primary action in SplitButton.
15
17
  */
16
- primaryActionButton?: ObjectShorthandProps<ButtonProps>;
18
+ primaryActionButton?: Slot<typeof Button>;
17
19
  };
18
20
  export declare type SplitButtonProps = ComponentProps<SplitButtonSlots> & Omit<ButtonProps, 'root'> & Omit<MenuButtonProps, 'root'>;
19
21
  export declare type SplitButtonState = ComponentState<SplitButtonSlots> & Omit<ButtonState, 'components' | 'iconOnly' | 'root'> & Omit<MenuButtonState, 'components' | 'iconOnly' | 'root'>;
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -2,4 +2,4 @@ export * from './SplitButton';
2
2
  export * from './SplitButton.types';
3
3
  export * from './renderSplitButton';
4
4
  export * from './useSplitButton';
5
- export { splitButtonClassName, useSplitButtonStyles } from './useSplitButtonStyles';
5
+ export { splitButtonClassName, useSplitButtonStyles_unstable } from './useSplitButtonStyles';
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useSplitButtonStyles = exports.splitButtonClassName = void 0;
6
+ exports.useSplitButtonStyles_unstable = exports.splitButtonClassName = void 0;
7
7
 
8
8
  const tslib_1 = /*#__PURE__*/require("tslib");
9
9
 
@@ -23,10 +23,10 @@ Object.defineProperty(exports, "splitButtonClassName", {
23
23
  return useSplitButtonStyles_1.splitButtonClassName;
24
24
  }
25
25
  });
26
- Object.defineProperty(exports, "useSplitButtonStyles", {
26
+ Object.defineProperty(exports, "useSplitButtonStyles_unstable", {
27
27
  enumerable: true,
28
28
  get: function () {
29
- return useSplitButtonStyles_1.useSplitButtonStyles;
29
+ return useSplitButtonStyles_1.useSplitButtonStyles_unstable;
30
30
  }
31
31
  });
32
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/SplitButton/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,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AA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,sBAAA,CAAA,6BAAA;AAA6B;AAA7B,CAAA","sourcesContent":["export * from './SplitButton';\nexport * from './SplitButton.types';\nexport * from './renderSplitButton';\nexport * from './useSplitButton';\nexport { splitButtonClassName, useSplitButtonStyles_unstable } from './useSplitButtonStyles';\n"],"sourceRoot":"../src/"}
@@ -2,4 +2,4 @@ import type { SplitButtonState } from './SplitButton.types';
2
2
  /**
3
3
  * Renders a SplitButton component by passing the state defined props to the appropriate slots.
4
4
  */
5
- export declare const renderSplitButton: (state: SplitButtonState) => JSX.Element;
5
+ export declare const renderSplitButton_unstable: (state: SplitButtonState) => JSX.Element;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.renderSplitButton = void 0;
6
+ exports.renderSplitButton_unstable = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
9
 
@@ -13,13 +13,16 @@ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
13
13
  */
14
14
 
15
15
 
16
- const renderSplitButton = state => {
16
+ const renderSplitButton_unstable = state => {
17
17
  const {
18
18
  slots,
19
19
  slotProps
20
- } = react_utilities_1.getSlots(state, ['root', 'menuButton', 'primaryActionButton']);
21
- return React.createElement(slots.root, Object.assign({}, slotProps.root), React.createElement(slots.primaryActionButton, Object.assign({}, slotProps.primaryActionButton)), React.createElement(slots.menuButton, Object.assign({}, slotProps.menuButton)));
20
+ } = react_utilities_1.getSlots(state);
21
+ return React.createElement(slots.root, { ...slotProps.root
22
+ }, slots.primaryActionButton && React.createElement(slots.primaryActionButton, { ...slotProps.primaryActionButton
23
+ }), slots.menuButton && React.createElement(slots.menuButton, { ...slotProps.menuButton
24
+ }));
22
25
  };
23
26
 
24
- exports.renderSplitButton = renderSplitButton;
27
+ exports.renderSplitButton_unstable = renderSplitButton_unstable;
25
28
  //# sourceMappingURL=renderSplitButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/SplitButton/renderSplitButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,iBAAiB,GAAI,KAAD,IAA4B;AAC3D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAA2B,KAA3B,EAAkC,CAAC,MAAD,EAAS,YAAT,EAAuB,qBAAvB,CAAlC,CAA7B;AAEA,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,mBAAP,EAA0B,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,mBAAf,CAA1B,CADF,EAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,UAAP,EAAiB,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,UAAf,CAAjB,CAFF,CADF;AAMD,CATM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourceRoot":""}
1
+ {"version":3,"sources":["components/SplitButton/renderSplitButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,0BAA0B,GAAI,KAAD,IAA4B;AACpE,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAA2B,KAA3B,CAA7B;AAEA,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,mBAAN,IAA6B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,mBAAP,EAA0B,EAAA,GAAK,SAAS,CAAC;AAAf,GAA1B,CADhC,EAEG,KAAK,CAAC,UAAN,IAAoB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,UAAP,EAAiB,EAAA,GAAK,SAAS,CAAC;AAAf,GAAjB,CAFvB,CADF;AAMD,CATM;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';\n\n/**\n * Renders a SplitButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderSplitButton_unstable = (state: SplitButtonState) => {\n const { slots, slotProps } = getSlots<SplitButtonSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.primaryActionButton && <slots.primaryActionButton {...slotProps.primaryActionButton} />}\n {slots.menuButton && <slots.menuButton {...slotProps.menuButton} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -5,4 +5,4 @@ import type { SplitButtonProps, SplitButtonState } from './SplitButton.types';
5
5
  * @param props - User provided props to the SplitButton component.
6
6
  * @param ref - User provided ref to be passed to the SplitButton component.
7
7
  */
8
- export declare const useSplitButton: (props: SplitButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) => SplitButtonState;
8
+ export declare const useSplitButton_unstable: (props: SplitButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) => SplitButtonState;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useSplitButton = void 0;
6
+ exports.useSplitButton_unstable = void 0;
7
7
 
8
8
  const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
9
 
@@ -17,7 +17,7 @@ const MenuButton_1 = /*#__PURE__*/require("../MenuButton/MenuButton");
17
17
  */
18
18
 
19
19
 
20
- const useSplitButton = (props, ref) => {
20
+ const useSplitButton_unstable = (props, ref) => {
21
21
  const {
22
22
  appearance,
23
23
  block = false,
@@ -27,18 +27,22 @@ const useSplitButton = (props, ref) => {
27
27
  icon,
28
28
  iconPosition = 'before',
29
29
  menuButton,
30
+ menuIcon,
30
31
  primaryActionButton,
31
32
  shape = 'rounded',
32
33
  size = 'medium'
33
34
  } = props;
35
+ const baseId = react_utilities_1.useId('splitButton-');
34
36
  const menuButtonShorthand = react_utilities_1.resolveShorthand(menuButton, {
35
37
  defaultProps: {
36
38
  appearance,
37
39
  disabled,
38
40
  disabledFocusable,
41
+ menuIcon,
39
42
  shape,
40
43
  size
41
- }
44
+ },
45
+ required: true
42
46
  });
43
47
  const primaryActionButtonShorthand = react_utilities_1.resolveShorthand(primaryActionButton, {
44
48
  defaultProps: {
@@ -49,10 +53,18 @@ const useSplitButton = (props, ref) => {
49
53
  disabledFocusable,
50
54
  icon,
51
55
  iconPosition,
56
+ id: baseId + '__primaryActionButton',
52
57
  shape,
53
58
  size
54
- }
55
- });
59
+ },
60
+ required: true
61
+ }); // Resolve menu button's aria-labelledby to be labelled by the primary action button if not a label was not provided
62
+ // by the user.
63
+
64
+ if (menuButtonShorthand && primaryActionButtonShorthand && !menuButtonShorthand['aria-label'] && !menuButtonShorthand['aria-labelledby']) {
65
+ menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;
66
+ }
67
+
56
68
  return {
57
69
  // Props passed at the top-level
58
70
  appearance,
@@ -77,5 +89,5 @@ const useSplitButton = (props, ref) => {
77
89
  };
78
90
  };
79
91
 
80
- exports.useSplitButton = useSplitButton;
92
+ exports.useSplitButton_unstable = useSplitButton_unstable;
81
93
  //# sourceMappingURL=useSplitButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/SplitButton/useSplitButton.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA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A,QAAM,4BAA4B,GAAG,iBAAA,CAAA,gBAAA,CAAiB,mBAAjB,EAAsC;AACzE,IAAA,YAAY,EAAE;AACZ,MAAA,UADY;AAEZ,MAAA,KAFY;AAGZ,MAAA,QAHY;AAIZ,MAAA,QAJY;AAKZ,MAAA,iBALY;AAMZ,MAAA,IANY;AAOZ,MAAA,YAPY;AAQZ,MAAA,EAAE,EAAE,MAAM,GAAG,uBARD;AASZ,MAAA,KATY;AAUZ,MAAA;AAVY,KAD2D;AAazE,IAAA,QAAQ,EAAE;AAb+D,GAAtC,CAArC,CA9BoB,CA8CpB;AACA;;AACA,MACE,mBAAmB,IACnB,4BADA,IAEA,CAAC,mBAAmB,CAAC,YAAD,CAFpB,IAGA,CAAC,mBAAmB,CAAC,iBAAD,CAJtB,EAKE;AACA,IAAA,mBAAmB,CAAC,iBAAD,CAAnB,GAAyC,4BAA4B,CAAC,EAAtE;AACD;;AAED,SAAO;AACL;AACA,IAAA,UAFK;AAGL,IAAA,KAHK;AAIL,IAAA,QAJK;AAKL,IAAA,iBALK;AAML,IAAA,YANK;AAOL,IAAA,KAPK;AAQL,IAAA,IARK;AAUL;AACA,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,KADI;AAEV,MAAA,UAAU,EAAE,YAAA,CAAA,UAFF;AAGV,MAAA,mBAAmB,EAAE,QAAA,CAAA;AAHX,KAXP;AAiBL,IAAA,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B;AAAE,MAAA,GAAF;AAAO,SAAG;AAAV,KAA7B,CAjBD;AAkBL,IAAA,UAAU,EAAE,mBAlBP;AAmBL,IAAA,mBAAmB,EAAE;AAnBhB,GAAP;AAqBD,CAjFM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\nimport type { SplitButtonProps, SplitButtonState } from './SplitButton.types';\n\n/**\n * Given user props, defines default props for the SplitButton and returns processed state.\n * @param props - User provided props to the SplitButton component.\n * @param ref - User provided ref to be passed to the SplitButton component.\n */\nexport const useSplitButton_unstable = (\n props: SplitButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): SplitButtonState => {\n const {\n appearance,\n block = false,\n children,\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n menuButton,\n menuIcon,\n primaryActionButton,\n shape = 'rounded',\n size = 'medium',\n } = props;\n\n const baseId = useId('splitButton-');\n\n const menuButtonShorthand = resolveShorthand(menuButton, {\n defaultProps: {\n appearance,\n disabled,\n disabledFocusable,\n menuIcon,\n shape,\n size,\n },\n required: true,\n });\n\n const primaryActionButtonShorthand = resolveShorthand(primaryActionButton, {\n defaultProps: {\n appearance,\n block,\n children,\n disabled,\n disabledFocusable,\n icon,\n iconPosition,\n id: baseId + '__primaryActionButton',\n shape,\n size,\n },\n required: true,\n });\n\n // Resolve menu button's aria-labelledby to be labelled by the primary action button if not a label was not provided\n // by the user.\n if (\n menuButtonShorthand &&\n primaryActionButtonShorthand &&\n !menuButtonShorthand['aria-label'] &&\n !menuButtonShorthand['aria-labelledby']\n ) {\n menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;\n }\n\n return {\n // Props passed at the top-level\n appearance,\n block,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size,\n\n // Slots definition\n components: {\n root: 'div',\n menuButton: MenuButton,\n primaryActionButton: Button,\n },\n\n root: getNativeElementProps('div', { ref, ...props }),\n menuButton: menuButtonShorthand,\n primaryActionButton: primaryActionButtonShorthand,\n };\n};\n"],"sourceRoot":"../src/"}
@@ -1,3 +1,3 @@
1
1
  import type { SplitButtonState } from './SplitButton.types';
2
2
  export declare const splitButtonClassName = "fui-SplitButton";
3
- export declare const useSplitButtonStyles: (state: SplitButtonState) => SplitButtonState;
3
+ export declare const useSplitButtonStyles_unstable: (state: SplitButtonState) => SplitButtonState;
@@ -3,19 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useSplitButtonStyles = exports.splitButtonClassName = void 0;
6
+ exports.useSplitButtonStyles_unstable = exports.splitButtonClassName = void 0;
7
7
 
8
- const react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
8
+ const react_1 = /*#__PURE__*/require("@griffel/react");
9
9
 
10
10
  const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
11
11
 
12
+ const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
13
+
12
14
  exports.splitButtonClassName = 'fui-SplitButton';
13
15
  const SplitButtonClassNames = {
14
16
  primaryActionButton: `${exports.splitButtonClassName}-primaryActionButton`,
15
17
  menuButton: `${exports.splitButtonClassName}-menuButton`
16
18
  };
17
19
 
18
- const useFocusStyles = /*#__PURE__*/react_make_styles_1.__styles({
20
+ const useFocusStyles = /*#__PURE__*/react_1.__styles({
19
21
  "primaryActionButton": {
20
22
  "B486eqv": "f2hkw1w",
21
23
  "Bmrpcm6": ["fub8a6s", "f1g41uvt"],
@@ -32,7 +34,7 @@ const useFocusStyles = /*#__PURE__*/react_make_styles_1.__styles({
32
34
  "d": ["[data-keyboard-nav] .fub8a6s:focus{border-top-right-radius:0;}", "[data-keyboard-nav] .f1g41uvt:focus{border-top-left-radius:0;}", "[data-keyboard-nav] .f58hr3h:focus{border-bottom-right-radius:0;}", "[data-keyboard-nav] .f1u1mnrj:focus{border-bottom-left-radius:0;}", "[data-keyboard-nav] .fy9hclh:focus{border-left-width:0;}", "[data-keyboard-nav] .f549e1y:focus{border-right-width:0;}"]
33
35
  });
34
36
 
35
- const useRootStyles = /*#__PURE__*/react_make_styles_1.__styles({
37
+ const useRootStyles = /*#__PURE__*/react_1.__styles({
36
38
  "base": {
37
39
  "mc9l5x": "ftuwxu6",
38
40
  "Brf1p80": "fsxf2b5",
@@ -77,7 +79,7 @@ const useRootStyles = /*#__PURE__*/react_make_styles_1.__styles({
77
79
  "a": [".fnmoi2n:active .fui-SplitButton-primaryActionButton{border-right-color:var(--colorNeutralForegroundInverted);}", ".f1l3povx:active .fui-SplitButton-primaryActionButton{border-left-color:var(--colorNeutralForegroundInverted);}", ".fjmcta:active .fui-SplitButton-primaryActionButton{border-right-color:var(--colorNeutralStroke1Hover);}", ".fm99moz:active .fui-SplitButton-primaryActionButton{border-left-color:var(--colorNeutralStroke1Hover);}", ".f1lpnjjp:active .fui-SplitButton-primaryActionButton{border-right-color:var(--colorNeutralStrokeDisabled);}", ".f8nirj0:active .fui-SplitButton-primaryActionButton{border-left-color:var(--colorNeutralStrokeDisabled);}"]
78
80
  });
79
81
 
80
- const useSplitButtonStyles = state => {
82
+ const useSplitButtonStyles_unstable = state => {
81
83
  const rootStyles = useRootStyles();
82
84
  const focusStyles = useFocusStyles();
83
85
  const {
@@ -86,18 +88,18 @@ const useSplitButtonStyles = state => {
86
88
  disabled,
87
89
  disabledFocusable
88
90
  } = state;
89
- state.root.className = react_make_styles_1.mergeClasses(exports.splitButtonClassName, rootStyles.base, block && rootStyles.block, appearance && rootStyles[appearance], (disabled || disabledFocusable) && rootStyles.disabled, state.root.className);
91
+ state.root.className = react_1.mergeClasses(exports.splitButtonClassName, rootStyles.base, block && rootStyles.block, appearance && rootStyles[appearance], (disabled || disabledFocusable) && rootStyles.disabled, state.root.className);
90
92
 
91
93
  if (state.menuButton) {
92
- state.menuButton.className = react_make_styles_1.mergeClasses(SplitButtonClassNames.menuButton, focusStyles.menuButton, state.menuButton.className);
94
+ state.menuButton.className = react_1.mergeClasses(SplitButtonClassNames.menuButton, focusStyles.menuButton, state.menuButton.className);
93
95
  }
94
96
 
95
97
  if (state.primaryActionButton) {
96
- state.primaryActionButton.className = react_make_styles_1.mergeClasses(SplitButtonClassNames.primaryActionButton, focusStyles.primaryActionButton, state.primaryActionButton.className);
98
+ state.primaryActionButton.className = react_1.mergeClasses(SplitButtonClassNames.primaryActionButton, focusStyles.primaryActionButton, state.primaryActionButton.className);
97
99
  }
98
100
 
99
101
  return state;
100
102
  };
101
103
 
102
- exports.useSplitButtonStyles = useSplitButtonStyles;
104
+ exports.useSplitButtonStyles_unstable = useSplitButtonStyles_unstable;
103
105
  //# sourceMappingURL=useSplitButtonStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/SplitButton/useSplitButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AAGa,OAAA,CAAA,oBAAA,GAAuB,iBAAvB;AAEb,MAAM,qBAAqB,GAAG;AAC5B,EAAA,mBAAmB,EAAE,GAAG,OAAA,CAAA,oBAAoB,sBADhB;AAE5B,EAAA,UAAU,EAAE,GAAG,OAAA,CAAA,oBAAoB;AAFP,CAA9B;;AAKA,MAAM,cAAc,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAvB;;AAaA,MAAM,aAAa,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAtB;;AAgHO,MAAM,oBAAoB,GAAI,KAAD,IAA8C;AAChF,QAAM,UAAU,GAAG,aAAa,EAAhC;AACA,QAAM,WAAW,GAAG,cAAc,EAAlC;AAEA,QAAM;AAAE,IAAA,UAAF;AAAc,IAAA,KAAd;AAAqB,IAAA,QAArB;AAA+B,IAAA;AAA/B,MAAq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AAC,mBAAN,CAA0B,SAA1B,GAAsC,OAAA,CAAA,YAAA,CACpC,qBAAqB,CAAC,mBADc,EAEpC,WAAW,CAAC,mBAFwB,EAGpC,KAAK,CAAC,mBAAN,CAA0B,SAHU,CAAtC;AAKD;;AAED,SAAO,KAAP;AACD,CAhCM;;AAAM,OAAA,CAAA,6BAAA,GAA6B,6BAA7B","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SplitButtonState } from './SplitButton.types';\n\nexport const splitButtonClassName = 'fui-SplitButton';\n\nconst SplitButtonClassNames = {\n primaryActionButton: `${splitButtonClassName}-primaryActionButton`,\n menuButton: `${splitButtonClassName}-menuButton`,\n};\n\nconst useFocusStyles = makeStyles({\n primaryActionButton: createCustomFocusIndicatorStyle({\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n }),\n\n menuButton: createCustomFocusIndicatorStyle({\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n }),\n});\n\nconst useRootStyles = makeStyles({\n // Base rootStyles\n base: {\n display: 'inline-flex',\n justifyContent: 'stretch',\n position: 'relative',\n verticalAlign: 'middle',\n\n // Use classnames to increase specificy of rootStyles and avoid collisions.\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n // Use classnames to increase specificy of rootStyles and avoid collisions.\n [`& .${SplitButtonClassNames.menuButton}`]: {\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n },\n },\n\n // Block rootStyles\n block: {\n width: '100%',\n },\n\n // Appearance variations\n outline: {\n /* No rootStyles */\n },\n primary: {\n // Use classnames to increase specificy of rootStyles and avoid collisions.\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundInverted,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundInverted,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundInverted,\n },\n },\n },\n subtle: {\n // Use classnames to increase specificy of rootStyles and avoid collisions.\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n },\n transparent: {\n // Use classnames to increase specificy of rootStyles and avoid collisions.\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n },\n\n // Shape variations\n circular: {},\n rounded: {},\n square: {},\n\n // Disabled rootStyles\n disabled: {\n // Use classnames to increase specificy of rootStyles and avoid collisions.\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n },\n});\n\nexport const useSplitButtonStyles_unstable = (state: SplitButtonState): SplitButtonState => {\n const rootStyles = useRootStyles();\n const focusStyles = useFocusStyles();\n\n const { appearance, block, disabled, disabledFocusable } = state;\n\n state.root.className = mergeClasses(\n splitButtonClassName,\n rootStyles.base,\n block && rootStyles.block,\n appearance && rootStyles[appearance],\n (disabled || disabledFocusable) && rootStyles.disabled,\n state.root.className,\n );\n\n if (state.menuButton) {\n state.menuButton.className = mergeClasses(\n SplitButtonClassNames.menuButton,\n focusStyles.menuButton,\n state.menuButton.className,\n );\n }\n\n if (state.primaryActionButton) {\n state.primaryActionButton.className = mergeClasses(\n SplitButtonClassNames.primaryActionButton,\n focusStyles.primaryActionButton,\n state.primaryActionButton.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -18,9 +18,9 @@ const useToggleButtonStyles_1 = /*#__PURE__*/require("./useToggleButtonStyles");
18
18
 
19
19
 
20
20
  exports.ToggleButton = /*#__PURE__*/React.forwardRef((props, ref) => {
21
- const state = useToggleButton_1.useToggleButton(props, ref);
22
- useToggleButtonStyles_1.useToggleButtonStyles(state);
23
- return renderToggleButton_1.renderToggleButton(state); // Casting is required due to lack of distributive union to support unions on @types/react
21
+ const state = useToggleButton_1.useToggleButton_unstable(props, ref);
22
+ useToggleButtonStyles_1.useToggleButtonStyles_unstable(state);
23
+ return renderToggleButton_1.renderToggleButton_unstable(state); // Casting is required due to lack of distributive union to support unions on @types/react
24
24
  });
25
25
  exports.ToggleButton.displayName = 'ToggleButton';
26
26
  //# sourceMappingURL=ToggleButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ToggleButton/ToggleButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,oBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,YAAA,gBAAuD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAClG,QAAM,KAAK,GAAG,iBAAA,CAAA,eAAA,CAAgB,KAAhB,EAAuB,GAAvB,CAAd;AAEA,EAAA,uBAAA,CAAA,qBAAA,CAAsB,KAAtB;AAEA,SAAO,oBAAA,CAAA,kBAAA,CAAmB,KAAnB,CAAP,CALkG,CAMlG;AACD,CAPmE,CAAvD;AASb,OAAA,CAAA,YAAA,CAAa,WAAb,GAA2B,cAA3B","sourceRoot":""}
1
+ {"version":3,"sources":["components/ToggleButton/ToggleButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,oBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,YAAA,gBAAuD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAClG,QAAM,KAAK,GAAG,iBAAA,CAAA,wBAAA,CAAyB,KAAzB,EAAgC,GAAhC,CAAd;AAEA,EAAA,uBAAA,CAAA,8BAAA,CAA+B,KAA/B;AAEA,SAAO,oBAAA,CAAA,2BAAA,CAA4B,KAA5B,CAAP,CALkG,CAMlG;AACD,CAPmE,CAAvD;AASb,OAAA,CAAA,YAAA,CAAa,WAAb,GAA2B,cAA3B","sourcesContent":["import * as React from 'react';\nimport { renderToggleButton_unstable } from './renderToggleButton';\nimport { useToggleButton_unstable } from './useToggleButton';\nimport { useToggleButtonStyles_unstable } from './useToggleButtonStyles';\nimport type { ToggleButtonProps } from './ToggleButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * ToggleButtons are buttons that toggle between two defined states when triggered.\n */\nexport const ToggleButton: ForwardRefComponent<ToggleButtonProps> = React.forwardRef((props, ref) => {\n const state = useToggleButton_unstable(props, ref);\n\n useToggleButtonStyles_unstable(state);\n\n return renderToggleButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<ToggleButtonProps>;\n\nToggleButton.displayName = 'ToggleButton';\n"],"sourceRoot":"../src/"}
@@ -1,5 +1,5 @@
1
1
  import type { ButtonProps, ButtonState } from '../Button/Button.types';
2
- export declare type ToggleButtonCommons = {
2
+ declare type ToggleButtonCommons = {
3
3
  /**
4
4
  * Defines the controlled checked state of the `ToggleButton`.
5
5
  * If passed, `ToggleButton` ignores the `defaultChecked` property.
@@ -17,3 +17,4 @@ export declare type ToggleButtonProps = ButtonProps & Partial<ToggleButtonCommon
17
17
  defaultChecked?: boolean;
18
18
  };
19
19
  export declare type ToggleButtonState = ButtonState & ToggleButtonCommons;
20
+ export {};
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -2,4 +2,4 @@ export * from './ToggleButton';
2
2
  export * from './ToggleButton.types';
3
3
  export * from './renderToggleButton';
4
4
  export * from './useToggleButton';
5
- export { toggleButtonClassName, useToggleButtonStyles } from './useToggleButtonStyles';
5
+ export { toggleButtonClassName, useToggleButtonStyles_unstable } from './useToggleButtonStyles';
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useToggleButtonStyles = exports.toggleButtonClassName = void 0;
6
+ exports.useToggleButtonStyles_unstable = exports.toggleButtonClassName = void 0;
7
7
 
8
8
  const tslib_1 = /*#__PURE__*/require("tslib");
9
9
 
@@ -23,10 +23,10 @@ Object.defineProperty(exports, "toggleButtonClassName", {
23
23
  return useToggleButtonStyles_1.toggleButtonClassName;
24
24
  }
25
25
  });
26
- Object.defineProperty(exports, "useToggleButtonStyles", {
26
+ Object.defineProperty(exports, "useToggleButtonStyles_unstable", {
27
27
  enumerable: true,
28
28
  get: function () {
29
- return useToggleButtonStyles_1.useToggleButtonStyles;
29
+ return useToggleButtonStyles_1.useToggleButtonStyles_unstable;
30
30
  }
31
31
  });
32
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ToggleButton/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,IAAA,uBAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,uBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,uBAAA,CAAA,qBAAA;AAAqB;AAArB,CAAA;AAAuB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,uBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,uBAAA,CAAA,qBAAA;AAAqB;AAArB,CAAA","sourceRoot":""}
1
+ {"version":3,"sources":["components/ToggleButton/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,IAAA,uBAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,uBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,uBAAA,CAAA,qBAAA;AAAqB;AAArB,CAAA;AAAuB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,gCAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,uBAAA,CAAA,8BAAA;AAA8B;AAA9B,CAAA","sourcesContent":["export * from './ToggleButton';\nexport * from './ToggleButton.types';\nexport * from './renderToggleButton';\nexport * from './useToggleButton';\nexport { toggleButtonClassName, useToggleButtonStyles_unstable } from './useToggleButtonStyles';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- export { renderButton as renderToggleButton } from '../Button/renderButton';
1
+ export { renderButton_unstable as renderToggleButton_unstable } from '../Button/renderButton';
@@ -3,14 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.renderToggleButton = void 0;
6
+ exports.renderToggleButton_unstable = void 0;
7
7
 
8
8
  var renderButton_1 = /*#__PURE__*/require("../Button/renderButton");
9
9
 
10
- Object.defineProperty(exports, "renderToggleButton", {
10
+ Object.defineProperty(exports, "renderToggleButton_unstable", {
11
11
  enumerable: true,
12
12
  get: function () {
13
- return renderButton_1.renderButton;
13
+ return renderButton_1.renderButton_unstable;
14
14
  }
15
15
  });
16
16
  //# sourceMappingURL=renderToggleButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ToggleButton/renderToggleButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,cAAA,CAAA,YAAA;AAAY;AAAZ,CAAA","sourceRoot":""}
1
+ {"version":3,"sources":["components/ToggleButton/renderToggleButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,6BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,cAAA,CAAA,qBAAA;AAAqB;AAArB,CAAA","sourcesContent":["export { renderButton_unstable as renderToggleButton_unstable } from '../Button/renderButton';\n"],"sourceRoot":"../src/"}
@@ -6,4 +6,4 @@ import type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types'
6
6
  * @param props - User provided props to the ToggleButton component.
7
7
  * @param ref - User provided ref to be passed to the ToggleButton component.
8
8
  */
9
- export declare const useToggleButton: ({ checked, defaultChecked, ...props }: ToggleButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) => ToggleButtonState;
9
+ export declare const useToggleButton_unstable: ({ checked, defaultChecked, ...props }: ToggleButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) => ToggleButtonState;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useToggleButton = void 0;
6
+ exports.useToggleButton_unstable = void 0;
7
7
 
8
8
  const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
9
 
@@ -18,12 +18,16 @@ const useButton_1 = /*#__PURE__*/require("../Button/useButton");
18
18
  */
19
19
 
20
20
 
21
- const useToggleButton = ({
21
+ const useToggleButton_unstable = ({
22
22
  checked,
23
23
  defaultChecked,
24
24
  ...props
25
25
  }, ref) => {
26
- const buttonState = useButton_1.useButton(props, ref);
26
+ const {
27
+ disabled,
28
+ disabledFocusable
29
+ } = props;
30
+ const buttonState = useButton_1.useButton_unstable(props, ref);
27
31
  const {
28
32
  role,
29
33
  onClick
@@ -40,21 +44,21 @@ const useToggleButton = ({
40
44
  checked: checkedValue,
41
45
  // Slots definition
42
46
  root: { ...buttonState.root,
43
- [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: !!checkedValue,
47
+ [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,
44
48
  onClick: React.useCallback(ev => {
45
- if (onClick) {
46
- onClick(ev);
49
+ if (!disabled && !disabledFocusable) {
50
+ onClick === null || onClick === void 0 ? void 0 : onClick(ev);
47
51
 
48
52
  if (ev.defaultPrevented) {
49
53
  return;
50
54
  }
51
- }
52
55
 
53
- setCheckedValue(!checkedValue);
54
- }, [checkedValue, setCheckedValue, onClick])
56
+ setCheckedValue(!checkedValue);
57
+ }
58
+ }, [checkedValue, disabled, disabledFocusable, setCheckedValue, onClick])
55
59
  }
56
60
  };
57
61
  };
58
62
 
59
- exports.useToggleButton = useToggleButton;
63
+ exports.useToggleButton_unstable = useToggleButton_unstable;
60
64
  //# sourceMappingURL=useToggleButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;AAGA;;;;;AAKG;;;AACI,MAAM,eAAe,GAAG,CAC7B;AAAE,EAAA,OAAF;AAAW,EAAA,cAAX;AAA2B,KAAG;AAA9B,CAD6B,EAE7B,GAF6B,KAGR;AACrB,QAAM,WAAW,GAAG,WAAA,CAAA,SAAA,CAAU,KAAV,EAAiB,GAAjB,CAApB;AACA,QAAM;AAAE,IAAA,IAAF;AAAQ,IAAA;AAAR,MAAoB,WAAW,CAAC,IAAtC;AAEA,QAAM,CAAC,YAAD,EAAe,eAAf,IAAkC,iBAAA,CAAA,oBAAA,CAAqB;AAC3D,IAAA,KA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IAAA,IAAF;AAAQ,IAAA;AAAR,MAAoB,WAAW,CAAC,IAAtC;AAEA,QAAM,CAAC,YAAD,EAAe,eAAf,IAAkC,iBAAA,CAAA,oBAAA,CAAqB;AAC3D,IAAA,KAAK,EAAE,OADoD;AAE3D,IAAA,YAAY,EAAE,cAF6C;AAG3D,IAAA,YAAY,EAAE;AAH6C,GAArB,CAAxC;AAMA,QAAM,kBAAkB,GAAG,IAAI,KAAK,kBAAT,IAA+B,IAAI,KAAK,UAAnE;AAEA,SAAO,EACL;AACA,OAAG,WAFE;AAIL;AACA,IAAA,OAAO,EAAE,YALJ;AAOL;AACA,IAAA,IAAI,EAAE,EACJ,GAAG,WAAW,CAAC,IADX;AAEJ,OAAC,kBAAkB,GAAG,cAAH,GAAoB,cAAvC,GAAwD,YAFpD;AAGJ,MAAA,OAAO,EAAE,KAAK,CAAC,WAAN,CACP,EAAE,IAAG;AACH,YAAI,CAAC,QAAD,IAAa,CAAC,iBAAlB,EAAqC;AACnC,UAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAG,EAAH,CAAP;;AAEA,cAAI,EAAE,CAAC,gBAAP,EAAyB;AACvB;AACD;;AAED,UAAA,eAAe,CAAC,CAAC,YAAF,CAAf;AACD;AACF,OAXM,EAYP,CAAC,YAAD,EAAe,QAAf,EAAyB,iBAAzB,EAA4C,eAA5C,EAA6D,OAA7D,CAZO;AAHL;AARD,GAAP;AA2BD,CA3CM;;AAAM,OAAA,CAAA,wBAAA,GAAwB,wBAAxB","sourcesContent":["import { useControllableState } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useButton_unstable } from '../Button/useButton';\nimport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';\n\n/**\n * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the ToggleButton component.\n * @param ref - User provided ref to be passed to the ToggleButton component.\n */\nexport const useToggleButton_unstable = (\n { checked, defaultChecked, ...props }: ToggleButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToggleButtonState => {\n const { disabled, disabledFocusable } = props;\n const buttonState = useButton_unstable(props, ref);\n const { role, onClick } = buttonState.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 return {\n // Button state\n ...buttonState,\n\n // State calculated from a set of props\n checked: checkedValue,\n\n // Slots definition\n root: {\n ...buttonState.root,\n [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,\n onClick: React.useCallback(\n ev => {\n if (!disabled && !disabledFocusable) {\n onClick?.(ev);\n\n if (ev.defaultPrevented) {\n return;\n }\n\n setCheckedValue(!checkedValue);\n }\n },\n [checkedValue, disabled, disabledFocusable, setCheckedValue, onClick],\n ),\n },\n };\n};\n"],"sourceRoot":"../src/"}
@@ -1,3 +1,3 @@
1
1
  import type { ToggleButtonState } from './ToggleButton.types';
2
2
  export declare const toggleButtonClassName = "fui-ToggleButton";
3
- export declare const useToggleButtonStyles: (state: ToggleButtonState) => ToggleButtonState;
3
+ export declare const useToggleButtonStyles_unstable: (state: ToggleButtonState) => ToggleButtonState;
@@ -3,15 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useToggleButtonStyles = exports.toggleButtonClassName = void 0;
6
+ exports.useToggleButtonStyles_unstable = exports.toggleButtonClassName = void 0;
7
7
 
8
- const react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
8
+ const react_1 = /*#__PURE__*/require("@griffel/react");
9
+
10
+ const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
9
11
 
10
12
  const useButtonStyles_1 = /*#__PURE__*/require("../Button/useButtonStyles");
11
13
 
12
14
  exports.toggleButtonClassName = 'fui-ToggleButton';
13
15
 
14
- const useCheckedStyles = /*#__PURE__*/react_make_styles_1.__styles({
16
+ const useCheckedStyles = /*#__PURE__*/react_1.__styles({
15
17
  "base": {
16
18
  "De3pzq": "f1nfm20t",
17
19
  "g2u3we": "fj3muxo",
@@ -107,7 +109,7 @@ const useCheckedStyles = /*#__PURE__*/react_make_styles_1.__styles({
107
109
  "a": [".fb40n2d:active{background-color:var(--colorNeutralBackground1Pressed);}", ".fvs00aa:active{border-top-color:var(--colorNeutralStroke1Pressed);}", ".f1assf6x:active{border-right-color:var(--colorNeutralStroke1Pressed);}", ".f4ruux4:active{border-left-color:var(--colorNeutralStroke1Pressed);}", ".fumykes:active{border-bottom-color:var(--colorNeutralStroke1Pressed);}", ".f1r2dosr:active{color:var(--colorNeutralForeground1);}", ".fophhak:active{background-color:var(--colorTransparentBackgroundPressed);}", ".fsp1bjw:active{background-color:var(--colorBrandBackgroundPressed);}", ".ff472gp:active{border-top-color:transparent;}", ".f4yyc7m:active{border-right-color:transparent;}", ".ft2aflc:active{border-left-color:transparent;}", ".fggejwh:active{border-bottom-color:transparent;}", ".f18otbis:active{color:var(--colorNeutralForegroundOnBrand);}", ".f1wfn5kd:active{background-color:var(--colorSubtleBackgroundPressed);}", ".f19au66r:active{color:var(--colorNeutralForeground2BrandPressed);}"]
108
110
  });
109
111
 
110
- const useDisabledStyles = /*#__PURE__*/react_make_styles_1.__styles({
112
+ const useDisabledStyles = /*#__PURE__*/react_1.__styles({
111
113
  "base": {
112
114
  "De3pzq": "f1bg9a2p",
113
115
  "g2u3we": "f1jj8ep1",
@@ -183,7 +185,7 @@ const useDisabledStyles = /*#__PURE__*/react_make_styles_1.__styles({
183
185
  "a": [".f1ryyzvn:active{background-color:var(--colorNeutralBackgroundDisabled);}", ".fdi4vxw:active{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f4ryxzl:active{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fkdgpbx:active{border-left-color:var(--colorNeutralStrokeDisabled);}", ".fcmhn06:active{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".f19wldhg:active{color:var(--colorNeutralForegroundDisabled);}", ".ff472gp:active{border-top-color:transparent;}", ".f4yyc7m:active{border-right-color:transparent;}", ".ft2aflc:active{border-left-color:transparent;}", ".fggejwh:active{border-bottom-color:transparent;}", ".f1rot6hk:active{background-color:transparent;}"]
184
186
  });
185
187
 
186
- const useToggleButtonStyles = state => {
188
+ const useToggleButtonStyles_unstable = state => {
187
189
  const checkedStyles = useCheckedStyles();
188
190
  const disabledStyles = useDisabledStyles();
189
191
  const {
@@ -192,13 +194,13 @@ const useToggleButtonStyles = state => {
192
194
  disabled,
193
195
  disabledFocusable
194
196
  } = state;
195
- state.root.className = react_make_styles_1.mergeClasses(exports.toggleButtonClassName, // Checked styles
197
+ state.root.className = react_1.mergeClasses(exports.toggleButtonClassName, // Checked styles
196
198
  checked && checkedStyles.base, appearance && checked && checkedStyles[appearance], // Disabled styles
197
199
  (disabled || disabledFocusable) && disabledStyles.base, appearance && (disabled || disabledFocusable) && disabledStyles[appearance], // User provided class name
198
200
  state.root.className);
199
- useButtonStyles_1.useButtonStyles(state);
201
+ useButtonStyles_1.useButtonStyles_unstable(state);
200
202
  return state;
201
203
  };
202
204
 
203
- exports.useToggleButtonStyles = useToggleButtonStyles;
205
+ exports.useToggleButtonStyles_unstable = useToggleButtonStyles_unstable;
204
206
  //# sourceMappingURL=useToggleButtonStyles.js.map