@fluentui/react-button 9.1.8 → 9.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. package/CHANGELOG.json +36 -1
  2. package/CHANGELOG.md +13 -2
  3. package/lib/Button.js.map +1 -1
  4. package/lib/CompoundButton.js.map +1 -1
  5. package/lib/MenuButton.js.map +1 -1
  6. package/lib/SplitButton.js.map +1 -1
  7. package/lib/ToggleButton.js.map +1 -1
  8. package/lib/components/Button/Button.js.map +1 -1
  9. package/lib/components/Button/Button.types.js.map +1 -1
  10. package/lib/components/Button/index.js.map +1 -1
  11. package/lib/components/Button/renderButton.js.map +1 -1
  12. package/lib/components/Button/useButton.js.map +1 -1
  13. package/lib/components/Button/useButtonStyles.js.map +1 -1
  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.js.map +1 -1
  20. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  21. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  22. package/lib/components/MenuButton/index.js.map +1 -1
  23. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  24. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  25. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  26. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  27. package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
  28. package/lib/components/SplitButton/index.js.map +1 -1
  29. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  30. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  31. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  32. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  33. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  34. package/lib/components/ToggleButton/index.js.map +1 -1
  35. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
  36. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  37. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  38. package/lib/index.js.map +1 -1
  39. package/lib/utils/index.js.map +1 -1
  40. package/lib/utils/useToggleState.js.map +1 -1
  41. package/lib-amd/Button.js +6 -0
  42. package/lib-amd/Button.js.map +1 -0
  43. package/lib-amd/CompoundButton.js +6 -0
  44. package/lib-amd/CompoundButton.js.map +1 -0
  45. package/lib-amd/MenuButton.js +6 -0
  46. package/lib-amd/MenuButton.js.map +1 -0
  47. package/lib-amd/SplitButton.js +6 -0
  48. package/lib-amd/SplitButton.js.map +1 -0
  49. package/lib-amd/ToggleButton.js +6 -0
  50. package/lib-amd/ToggleButton.js.map +1 -0
  51. package/lib-amd/components/Button/Button.js +16 -0
  52. package/lib-amd/components/Button/Button.js.map +1 -0
  53. package/lib-amd/components/Button/Button.types.js +5 -0
  54. package/lib-amd/components/Button/Button.types.js.map +1 -0
  55. package/lib-amd/components/Button/index.js +11 -0
  56. package/lib-amd/components/Button/index.js.map +1 -0
  57. package/lib-amd/components/Button/renderButton.js +18 -0
  58. package/lib-amd/components/Button/renderButton.js.map +1 -0
  59. package/lib-amd/components/Button/useButton.js +40 -0
  60. package/lib-amd/components/Button/useButton.js.map +1 -0
  61. package/lib-amd/components/Button/useButtonStyles.js +187 -0
  62. package/lib-amd/components/Button/useButtonStyles.js.map +1 -0
  63. package/lib-amd/components/CompoundButton/CompoundButton.js +16 -0
  64. package/lib-amd/components/CompoundButton/CompoundButton.js.map +1 -0
  65. package/lib-amd/components/CompoundButton/CompoundButton.types.js +5 -0
  66. package/lib-amd/components/CompoundButton/CompoundButton.types.js.map +1 -0
  67. package/lib-amd/components/CompoundButton/index.js +12 -0
  68. package/lib-amd/components/CompoundButton/index.js.map +1 -0
  69. package/lib-amd/components/CompoundButton/renderCompoundButton.js +20 -0
  70. package/lib-amd/components/CompoundButton/renderCompoundButton.js.map +1 -0
  71. package/lib-amd/components/CompoundButton/useCompoundButton.js +27 -0
  72. package/lib-amd/components/CompoundButton/useCompoundButton.js.map +1 -0
  73. package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js +211 -0
  74. package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
  75. package/lib-amd/components/MenuButton/MenuButton.js +17 -0
  76. package/lib-amd/components/MenuButton/MenuButton.js.map +1 -0
  77. package/lib-amd/components/MenuButton/MenuButton.types.js +5 -0
  78. package/lib-amd/components/MenuButton/MenuButton.types.js.map +1 -0
  79. package/lib-amd/components/MenuButton/index.js +12 -0
  80. package/lib-amd/components/MenuButton/index.js.map +1 -0
  81. package/lib-amd/components/MenuButton/renderMenuButton.js +18 -0
  82. package/lib-amd/components/MenuButton/renderMenuButton.js.map +1 -0
  83. package/lib-amd/components/MenuButton/useMenuButton.js +30 -0
  84. package/lib-amd/components/MenuButton/useMenuButton.js.map +1 -0
  85. package/lib-amd/components/MenuButton/useMenuButtonStyles.js +97 -0
  86. package/lib-amd/components/MenuButton/useMenuButtonStyles.js.map +1 -0
  87. package/lib-amd/components/SplitButton/SplitButton.js +17 -0
  88. package/lib-amd/components/SplitButton/SplitButton.js.map +1 -0
  89. package/lib-amd/components/SplitButton/SplitButton.types.js +5 -0
  90. package/lib-amd/components/SplitButton/SplitButton.types.js.map +1 -0
  91. package/lib-amd/components/SplitButton/index.js +12 -0
  92. package/lib-amd/components/SplitButton/index.js.map +1 -0
  93. package/lib-amd/components/SplitButton/renderSplitButton.js +16 -0
  94. package/lib-amd/components/SplitButton/renderSplitButton.js.map +1 -0
  95. package/lib-amd/components/SplitButton/useSplitButton.js +67 -0
  96. package/lib-amd/components/SplitButton/useSplitButton.js.map +1 -0
  97. package/lib-amd/components/SplitButton/useSplitButtonStyles.js +147 -0
  98. package/lib-amd/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  99. package/lib-amd/components/ToggleButton/ToggleButton.js +16 -0
  100. package/lib-amd/components/ToggleButton/ToggleButton.js.map +1 -0
  101. package/lib-amd/components/ToggleButton/ToggleButton.types.js +5 -0
  102. package/lib-amd/components/ToggleButton/ToggleButton.types.js.map +1 -0
  103. package/lib-amd/components/ToggleButton/index.js +12 -0
  104. package/lib-amd/components/ToggleButton/index.js.map +1 -0
  105. package/lib-amd/components/ToggleButton/renderToggleButton.js +7 -0
  106. package/lib-amd/components/ToggleButton/renderToggleButton.js.map +1 -0
  107. package/lib-amd/components/ToggleButton/useToggleButton.js +17 -0
  108. package/lib-amd/components/ToggleButton/useToggleButton.js.map +1 -0
  109. package/lib-amd/components/ToggleButton/useToggleButtonStyles.js +75 -0
  110. package/lib-amd/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
  111. package/lib-amd/index.js +32 -0
  112. package/lib-amd/index.js.map +1 -0
  113. package/lib-amd/utils/index.js +6 -0
  114. package/lib-amd/utils/index.js.map +1 -0
  115. package/lib-amd/utils/useToggleState.js +27 -0
  116. package/lib-amd/utils/useToggleState.js.map +1 -0
  117. package/lib-commonjs/Button.js.map +1 -1
  118. package/lib-commonjs/CompoundButton.js.map +1 -1
  119. package/lib-commonjs/MenuButton.js.map +1 -1
  120. package/lib-commonjs/SplitButton.js.map +1 -1
  121. package/lib-commonjs/ToggleButton.js.map +1 -1
  122. package/lib-commonjs/components/Button/Button.js.map +1 -1
  123. package/lib-commonjs/components/Button/index.js.map +1 -1
  124. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  125. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  126. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  127. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  128. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  129. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  130. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  131. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  132. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  133. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  134. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  135. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  136. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  137. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  138. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  139. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  140. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  141. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  142. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  143. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  144. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  145. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  146. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  147. package/lib-commonjs/index.js.map +1 -1
  148. package/lib-commonjs/utils/index.js.map +1 -1
  149. package/lib-commonjs/utils/useToggleState.js.map +1 -1
  150. package/package.json +6 -7
@@ -0,0 +1,12 @@
1
+ define(["require", "exports", "tslib", "./SplitButton", "./SplitButton.types", "./renderSplitButton", "./useSplitButton", "./useSplitButtonStyles"], function (require, exports, tslib_1, SplitButton_1, SplitButton_types_1, renderSplitButton_1, useSplitButton_1, useSplitButtonStyles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useSplitButtonStyles_unstable = exports.splitButtonClassNames = void 0;
5
+ tslib_1.__exportStar(SplitButton_1, exports);
6
+ tslib_1.__exportStar(SplitButton_types_1, exports);
7
+ tslib_1.__exportStar(renderSplitButton_1, exports);
8
+ tslib_1.__exportStar(useSplitButton_1, exports);
9
+ Object.defineProperty(exports, "splitButtonClassNames", { enumerable: true, get: function () { return useSplitButtonStyles_1.splitButtonClassNames; } });
10
+ Object.defineProperty(exports, "useSplitButtonStyles_unstable", { enumerable: true, get: function () { return useSplitButtonStyles_1.useSplitButtonStyles_unstable; } });
11
+ });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/index.ts"],"names":[],"mappings":";;;;IAAA,6CAA8B;IAC9B,mDAAoC;IACpC,mDAAoC;IACpC,gDAAiC;IACxB,6HAAA,qBAAqB,OAAA;IAAE,qIAAA,6BAA6B,OAAA","sourcesContent":["export * from './SplitButton';\nexport * from './SplitButton.types';\nexport * from './renderSplitButton';\nexport * from './useSplitButton';\nexport { splitButtonClassNames, useSplitButtonStyles_unstable } from './useSplitButtonStyles';\n"]}
@@ -0,0 +1,16 @@
1
+ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.renderSplitButton_unstable = void 0;
5
+ /**
6
+ * Renders a SplitButton component by passing the state defined props to the appropriate slots.
7
+ */
8
+ var renderSplitButton_unstable = function (state) {
9
+ var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
10
+ return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
11
+ slots.primaryActionButton && React.createElement(slots.primaryActionButton, tslib_1.__assign({}, slotProps.primaryActionButton)),
12
+ slots.menuButton && React.createElement(slots.menuButton, tslib_1.__assign({}, slotProps.menuButton))));
13
+ };
14
+ exports.renderSplitButton_unstable = renderSplitButton_unstable;
15
+ });
16
+ //# sourceMappingURL=renderSplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderSplitButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/renderSplitButton.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,0BAA0B,GAAG,UAAC,KAAuB;QAC1D,IAAA,KAAuB,0BAAQ,CAAmB,KAAK,CAAC,EAAtD,KAAK,WAAA,EAAE,SAAS,eAAsC,CAAC;QAE/D,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,KAAK,CAAC,mBAAmB,IAAI,oBAAC,KAAK,CAAC,mBAAmB,uBAAK,SAAS,CAAC,mBAAmB,EAAI;YAC7F,KAAK,CAAC,UAAU,IAAI,oBAAC,KAAK,CAAC,UAAU,uBAAK,SAAS,CAAC,UAAU,EAAI,CACxD,CACd,CAAC;IACJ,CAAC,CAAC;IATW,QAAA,0BAA0B,8BASrC","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"]}
@@ -0,0 +1,67 @@
1
+ define(["require", "exports", "tslib", "@fluentui/react-utilities", "../Button/Button", "../MenuButton/MenuButton"], function (require, exports, tslib_1, react_utilities_1, Button_1, MenuButton_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useSplitButton_unstable = void 0;
5
+ /**
6
+ * Given user props, defines default props for the SplitButton and returns processed state.
7
+ * @param props - User provided props to the SplitButton component.
8
+ * @param ref - User provided ref to be passed to the SplitButton component.
9
+ */
10
+ var useSplitButton_unstable = function (props, ref) {
11
+ var _a = props.appearance, appearance = _a === void 0 ? 'secondary' : _a, children = props.children, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.disabledFocusable, disabledFocusable = _c === void 0 ? false : _c, icon = props.icon, _d = props.iconPosition, iconPosition = _d === void 0 ? 'before' : _d, menuButton = props.menuButton, menuIcon = props.menuIcon, primaryActionButton = props.primaryActionButton, _e = props.shape, shape = _e === void 0 ? 'rounded' : _e, _f = props.size, size = _f === void 0 ? 'medium' : _f;
12
+ var baseId = react_utilities_1.useId('splitButton-');
13
+ var menuButtonShorthand = react_utilities_1.resolveShorthand(menuButton, {
14
+ defaultProps: {
15
+ appearance: appearance,
16
+ disabled: disabled,
17
+ disabledFocusable: disabledFocusable,
18
+ menuIcon: menuIcon,
19
+ shape: shape,
20
+ size: size,
21
+ },
22
+ required: true,
23
+ });
24
+ var primaryActionButtonShorthand = react_utilities_1.resolveShorthand(primaryActionButton, {
25
+ defaultProps: {
26
+ appearance: appearance,
27
+ children: children,
28
+ disabled: disabled,
29
+ disabledFocusable: disabledFocusable,
30
+ icon: icon,
31
+ iconPosition: iconPosition,
32
+ id: baseId + '__primaryActionButton',
33
+ shape: shape,
34
+ size: size,
35
+ },
36
+ required: true,
37
+ });
38
+ // Resolve menu button's aria-labelledby to be labelled by the primary action button if not a label was not provided
39
+ // by the user.
40
+ if (menuButtonShorthand &&
41
+ primaryActionButtonShorthand &&
42
+ !menuButtonShorthand['aria-label'] &&
43
+ !menuButtonShorthand['aria-labelledby']) {
44
+ menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;
45
+ }
46
+ return {
47
+ // Props passed at the top-level
48
+ appearance: appearance,
49
+ disabled: disabled,
50
+ disabledFocusable: disabledFocusable,
51
+ iconPosition: iconPosition,
52
+ shape: shape,
53
+ size: size,
54
+ // Slots definition
55
+ components: {
56
+ root: 'div',
57
+ menuButton: MenuButton_1.MenuButton,
58
+ primaryActionButton: Button_1.Button,
59
+ },
60
+ root: react_utilities_1.getNativeElementProps('div', tslib_1.__assign({ ref: ref }, props)),
61
+ menuButton: menuButtonShorthand,
62
+ primaryActionButton: primaryActionButtonShorthand,
63
+ };
64
+ };
65
+ exports.useSplitButton_unstable = useSplitButton_unstable;
66
+ });
67
+ //# sourceMappingURL=useSplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSplitButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/useSplitButton.ts"],"names":[],"mappings":";;;;IAMA;;;;OAIG;IACI,IAAM,uBAAuB,GAAG,UACrC,KAAuB,EACvB,GAAqD;QAGnD,IAAA,KAWE,KAAK,WAXiB,EAAxB,UAAU,mBAAG,WAAW,KAAA,EACxB,QAAQ,GAUN,KAAK,SAVC,EACR,KASE,KAAK,SATS,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,KAQE,KAAK,kBARkB,EAAzB,iBAAiB,mBAAG,KAAK,KAAA,EACzB,IAAI,GAOF,KAAK,KAPH,EACJ,KAME,KAAK,aANgB,EAAvB,YAAY,mBAAG,QAAQ,KAAA,EACvB,UAAU,GAKR,KAAK,WALG,EACV,QAAQ,GAIN,KAAK,SAJC,EACR,mBAAmB,GAGjB,KAAK,oBAHY,EACnB,KAEE,KAAK,MAFU,EAAjB,KAAK,mBAAG,SAAS,KAAA,EACjB,KACE,KAAK,KADQ,EAAf,IAAI,mBAAG,QAAQ,KAAA,CACP;QAEV,IAAM,MAAM,GAAG,uBAAK,CAAC,cAAc,CAAC,CAAC;QAErC,IAAM,mBAAmB,GAAG,kCAAgB,CAAC,UAAU,EAAE;YACvD,YAAY,EAAE;gBACZ,UAAU,YAAA;gBACV,QAAQ,UAAA;gBACR,iBAAiB,mBAAA;gBACjB,QAAQ,UAAA;gBACR,KAAK,OAAA;gBACL,IAAI,MAAA;aACL;YACD,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,IAAM,4BAA4B,GAAG,kCAAgB,CAAC,mBAAmB,EAAE;YACzE,YAAY,EAAE;gBACZ,UAAU,YAAA;gBACV,QAAQ,UAAA;gBACR,QAAQ,UAAA;gBACR,iBAAiB,mBAAA;gBACjB,IAAI,MAAA;gBACJ,YAAY,cAAA;gBACZ,EAAE,EAAE,MAAM,GAAG,uBAAuB;gBACpC,KAAK,OAAA;gBACL,IAAI,MAAA;aACL;YACD,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,oHAAoH;QACpH,eAAe;QACf,IACE,mBAAmB;YACnB,4BAA4B;YAC5B,CAAC,mBAAmB,CAAC,YAAY,CAAC;YAClC,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,EACvC;YACA,mBAAmB,CAAC,iBAAiB,CAAC,GAAG,4BAA4B,CAAC,EAAE,CAAC;SAC1E;QAED,OAAO;YACL,gCAAgC;YAChC,UAAU,YAAA;YACV,QAAQ,UAAA;YACR,iBAAiB,mBAAA;YACjB,YAAY,cAAA;YACZ,KAAK,OAAA;YACL,IAAI,MAAA;YAEJ,mBAAmB;YACnB,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK;gBACX,UAAU,EAAE,uBAAU;gBACtB,mBAAmB,EAAE,eAAM;aAC5B;YAED,IAAI,EAAE,uCAAqB,CAAC,KAAK,qBAAI,GAAG,KAAA,IAAK,KAAK,EAAG;YACrD,UAAU,EAAE,mBAAmB;YAC/B,mBAAmB,EAAE,4BAA4B;SAClD,CAAC;IACJ,CAAC,CAAC;IA9EW,QAAA,uBAAuB,2BA8ElC","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 = 'secondary',\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 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 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"]}
@@ -0,0 +1,147 @@
1
+ define(["require", "exports", "@griffel/react", "@fluentui/react-tabster", "@fluentui/react-theme"], function (require, exports, react_1, react_tabster_1, react_theme_1) {
2
+ "use strict";
3
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.useSplitButtonStyles_unstable = exports.splitButtonClassNames = void 0;
6
+ exports.splitButtonClassNames = {
7
+ root: 'fui-SplitButton',
8
+ menuButton: 'fui-SplitButton__menuButton',
9
+ primaryActionButton: 'fui-SplitButton__primaryActionButton',
10
+ };
11
+ var useFocusStyles = react_1.makeStyles({
12
+ primaryActionButton: react_tabster_1.createCustomFocusIndicatorStyle({
13
+ borderTopRightRadius: 0,
14
+ borderBottomRightRadius: 0,
15
+ }),
16
+ menuButton: react_tabster_1.createCustomFocusIndicatorStyle({
17
+ borderLeftWidth: 0,
18
+ borderTopLeftRadius: 0,
19
+ borderBottomLeftRadius: 0,
20
+ }),
21
+ });
22
+ var useRootStyles = react_1.makeStyles({
23
+ // Base styles
24
+ base: (_a = {
25
+ display: 'inline-flex',
26
+ justifyContent: 'stretch',
27
+ position: 'relative',
28
+ verticalAlign: 'middle'
29
+ },
30
+ _a["& ." + exports.splitButtonClassNames.primaryActionButton] = {
31
+ borderTopRightRadius: 0,
32
+ borderBottomRightRadius: 0,
33
+ },
34
+ _a["& ." + exports.splitButtonClassNames.menuButton] = {
35
+ borderLeftWidth: 0,
36
+ borderTopLeftRadius: 0,
37
+ borderBottomLeftRadius: 0,
38
+ minWidth: 0,
39
+ },
40
+ _a),
41
+ // Appearance variations
42
+ outline: {
43
+ /* No styles */
44
+ },
45
+ primary: (_b = {},
46
+ _b["& ." + exports.splitButtonClassNames.primaryActionButton] = {
47
+ borderRightColor: react_theme_1.tokens.colorNeutralForegroundOnBrand,
48
+ },
49
+ _b[':hover'] = (_c = {},
50
+ _c["& ." + exports.splitButtonClassNames.primaryActionButton] = {
51
+ borderRightColor: react_theme_1.tokens.colorNeutralForegroundOnBrand,
52
+ },
53
+ _c),
54
+ _b[':hover:active'] = (_d = {},
55
+ _d["& ." + exports.splitButtonClassNames.primaryActionButton] = {
56
+ borderRightColor: react_theme_1.tokens.colorNeutralForegroundOnBrand,
57
+ },
58
+ _d),
59
+ _b),
60
+ secondary: {
61
+ /* The secondary styles are exactly the same as the base styles. */
62
+ },
63
+ subtle: (_e = {},
64
+ _e["& ." + exports.splitButtonClassNames.primaryActionButton] = {
65
+ borderRightColor: react_theme_1.tokens.colorNeutralStroke1,
66
+ },
67
+ _e[':hover'] = (_f = {},
68
+ _f["& ." + exports.splitButtonClassNames.primaryActionButton] = {
69
+ borderRightColor: react_theme_1.tokens.colorNeutralStroke1Hover,
70
+ },
71
+ _f),
72
+ _e[':hover:active'] = (_g = {},
73
+ _g["& ." + exports.splitButtonClassNames.primaryActionButton] = {
74
+ borderRightColor: react_theme_1.tokens.colorNeutralStroke1Pressed,
75
+ },
76
+ _g),
77
+ _e),
78
+ transparent: (_h = {},
79
+ _h["& ." + exports.splitButtonClassNames.primaryActionButton] = {
80
+ borderRightColor: react_theme_1.tokens.colorNeutralStroke1,
81
+ },
82
+ _h[':hover'] = (_j = {},
83
+ _j["& ." + exports.splitButtonClassNames.primaryActionButton] = {
84
+ borderRightColor: react_theme_1.tokens.colorNeutralStroke1Hover,
85
+ },
86
+ _j),
87
+ _h[':hover:active'] = (_k = {},
88
+ _k["& ." + exports.splitButtonClassNames.primaryActionButton] = {
89
+ borderRightColor: react_theme_1.tokens.colorNeutralStroke1Pressed,
90
+ },
91
+ _k),
92
+ _h),
93
+ // Shape variations
94
+ circular: {},
95
+ rounded: {},
96
+ square: {},
97
+ // Disabled styles
98
+ disabled: (_l = {},
99
+ _l["& ." + exports.splitButtonClassNames.primaryActionButton] = {
100
+ borderRightColor: react_theme_1.tokens.colorNeutralStrokeDisabled,
101
+ },
102
+ _l[':hover'] = (_m = {},
103
+ _m["& ." + exports.splitButtonClassNames.primaryActionButton] = {
104
+ borderRightColor: react_theme_1.tokens.colorNeutralStrokeDisabled,
105
+ },
106
+ _m),
107
+ _l[':hover:active'] = (_o = {},
108
+ _o["& ." + exports.splitButtonClassNames.primaryActionButton] = {
109
+ borderRightColor: react_theme_1.tokens.colorNeutralStrokeDisabled,
110
+ },
111
+ _o),
112
+ _l),
113
+ // Disabled high contrast styles
114
+ disabledHighContrast: {
115
+ '@media (forced-colors: active)': (_p = {},
116
+ _p["& ." + exports.splitButtonClassNames.primaryActionButton] = {
117
+ borderRightColor: 'GrayText',
118
+ },
119
+ _p[':hover'] = (_q = {},
120
+ _q["& ." + exports.splitButtonClassNames.primaryActionButton] = {
121
+ borderRightColor: 'GrayText',
122
+ },
123
+ _q),
124
+ _p[':hover:active'] = (_r = {},
125
+ _r["& ." + exports.splitButtonClassNames.primaryActionButton] = {
126
+ borderRightColor: 'GrayText',
127
+ },
128
+ _r),
129
+ _p),
130
+ },
131
+ });
132
+ var useSplitButtonStyles_unstable = function (state) {
133
+ var rootStyles = useRootStyles();
134
+ var focusStyles = useFocusStyles();
135
+ var appearance = state.appearance, disabled = state.disabled, disabledFocusable = state.disabledFocusable;
136
+ state.root.className = react_1.mergeClasses(exports.splitButtonClassNames.root, rootStyles.base, appearance && rootStyles[appearance], (disabled || disabledFocusable) && rootStyles.disabled, (disabled || disabledFocusable) && rootStyles.disabledHighContrast, state.root.className);
137
+ if (state.menuButton) {
138
+ state.menuButton.className = react_1.mergeClasses(exports.splitButtonClassNames.menuButton, focusStyles.menuButton, state.menuButton.className);
139
+ }
140
+ if (state.primaryActionButton) {
141
+ state.primaryActionButton.className = react_1.mergeClasses(exports.splitButtonClassNames.primaryActionButton, focusStyles.primaryActionButton, state.primaryActionButton.className);
142
+ }
143
+ return state;
144
+ };
145
+ exports.useSplitButtonStyles_unstable = useSplitButtonStyles_unstable;
146
+ });
147
+ //# sourceMappingURL=useSplitButtonStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSplitButtonStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/useSplitButtonStyles.ts"],"names":[],"mappings":";;;;;IAMa,QAAA,qBAAqB,GAAqC;QACrE,IAAI,EAAE,iBAAiB;QACvB,UAAU,EAAE,6BAA6B;QACzC,mBAAmB,EAAE,sCAAsC;KAC5D,CAAC;IAEF,IAAM,cAAc,GAAG,kBAAU,CAAC;QAChC,mBAAmB,EAAE,+CAA+B,CAAC;YACnD,oBAAoB,EAAE,CAAC;YACvB,uBAAuB,EAAE,CAAC;SAC3B,CAAC;QAEF,UAAU,EAAE,+CAA+B,CAAC;YAC1C,eAAe,EAAE,CAAC;YA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AG,UAAC,KAAuB;QACnE,IAAM,UAAU,GAAG,aAAa,EAAE,CAAC;QACnC,IAAM,WAAW,GAAG,cAAc,EAAE,CAAC;QAE7B,IAAA,UAAU,GAAkC,KAAK,WAAvC,EAAE,QAAQ,GAAwB,KAAK,SAA7B,EAAE,iBAAiB,GAAK,KAAK,kBAAV,CAAW;QAE1D,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CACjC,6BAAqB,CAAC,IAAI,EAC1B,UAAU,CAAC,IAAI,EACf,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC,EACpC,CAAC,QAAQ,IAAI,iBAAiB,CAAC,IAAI,UAAU,CAAC,QAAQ,EACtD,CAAC,QAAQ,IAAI,iBAAiB,CAAC,IAAI,UAAU,CAAC,oBAAoB,EAClE,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;QAEF,IAAI,KAAK,CAAC,UAAU,EAAE;YACpB,KAAK,CAAC,UAAU,CAAC,SAAS,GAAG,oBAAY,CACvC,6BAAqB,CAAC,UAAU,EAChC,WAAW,CAAC,UAAU,EACtB,KAAK,CAAC,UAAU,CAAC,SAAS,CAC3B,CAAC;SACH;QAED,IAAI,KAAK,CAAC,mBAAmB,EAAE;YAC7B,KAAK,CAAC,mBAAmB,CAAC,SAAS,GAAG,oBAAY,CAChD,6BAAqB,CAAC,mBAAmB,EACzC,WAAW,CAAC,mBAAmB,EAC/B,KAAK,CAAC,mBAAmB,CAAC,SAAS,CACpC,CAAC;SACH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAhCW,QAAA,6BAA6B,iCAgCxC","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';\n\nexport const splitButtonClassNames: SlotClassNames<SplitButtonSlots> = {\n root: 'fui-SplitButton',\n menuButton: 'fui-SplitButton__menuButton',\n primaryActionButton: 'fui-SplitButton__primaryActionButton',\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 styles\n base: {\n display: 'inline-flex',\n justifyContent: 'stretch',\n position: 'relative',\n verticalAlign: 'middle',\n\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n [`& .${splitButtonClassNames.menuButton}`]: {\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n minWidth: 0,\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundOnBrand,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundOnBrand,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundOnBrand,\n },\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n },\n transparent: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n },\n\n // Shape variations\n circular: {},\n rounded: {},\n square: {},\n\n // Disabled styles\n disabled: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n },\n\n // Disabled high contrast styles\n disabledHighContrast: {\n '@media (forced-colors: active)': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n },\n },\n },\n});\n\nexport const useSplitButtonStyles_unstable = (state: SplitButtonState): SplitButtonState => {\n const rootStyles = useRootStyles();\n const focusStyles = useFocusStyles();\n\n const { appearance, disabled, disabledFocusable } = state;\n\n state.root.className = mergeClasses(\n splitButtonClassNames.root,\n rootStyles.base,\n appearance && rootStyles[appearance],\n (disabled || disabledFocusable) && rootStyles.disabled,\n (disabled || disabledFocusable) && rootStyles.disabledHighContrast,\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"]}
@@ -0,0 +1,16 @@
1
+ define(["require", "exports", "react", "./renderToggleButton", "./useToggleButton", "./useToggleButtonStyles"], function (require, exports, React, renderToggleButton_1, useToggleButton_1, useToggleButtonStyles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ToggleButton = void 0;
5
+ /**
6
+ * ToggleButtons are buttons that toggle between two defined states when triggered.
7
+ */
8
+ exports.ToggleButton = React.forwardRef(function (props, ref) {
9
+ var state = useToggleButton_1.useToggleButton_unstable(props, ref);
10
+ useToggleButtonStyles_1.useToggleButtonStyles_unstable(state);
11
+ return renderToggleButton_1.renderToggleButton_unstable(state);
12
+ // Casting is required due to lack of distributive union to support unions on @types/react
13
+ });
14
+ exports.ToggleButton.displayName = 'ToggleButton';
15
+ });
16
+ //# sourceMappingURL=ToggleButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToggleButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/ToggleButton/ToggleButton.tsx"],"names":[],"mappings":";;;;IAOA;;OAEG;IACU,QAAA,YAAY,GAA2C,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAC9F,IAAM,KAAK,GAAG,0CAAwB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEnD,sDAA8B,CAAC,KAAK,CAAC,CAAC;QAEtC,OAAO,gDAA2B,CAAC,KAAK,CAAC,CAAC;QAC1C,0FAA0F;IAC5F,CAAC,CAA2C,CAAC;IAE7C,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAC","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"]}
@@ -0,0 +1,5 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
5
+ //# sourceMappingURL=ToggleButton.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToggleButton.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/ToggleButton/ToggleButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonProps, ButtonState } from '../Button/Button.types';\n\nexport type ToggleButtonProps = ButtonProps & {\n /**\n * Defines whether the `ToggleButton` is initially in a checked state or not when rendered.\n *\n * @default false\n */\n defaultChecked?: boolean;\n\n /**\n * Defines the controlled checked state of the `ToggleButton`.\n * If passed, `ToggleButton` ignores the `defaultChecked` property.\n * This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the\n * correct value based on handling `onClick` events and re-rendering.\n *\n * @default false\n */\n checked?: boolean;\n};\n\nexport type ToggleButtonState = ButtonState & Required<Pick<ToggleButtonProps, 'checked'>>;\n"]}
@@ -0,0 +1,12 @@
1
+ define(["require", "exports", "tslib", "./ToggleButton", "./ToggleButton.types", "./renderToggleButton", "./useToggleButton", "./useToggleButtonStyles"], function (require, exports, tslib_1, ToggleButton_1, ToggleButton_types_1, renderToggleButton_1, useToggleButton_1, useToggleButtonStyles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useToggleButtonStyles_unstable = exports.toggleButtonClassNames = void 0;
5
+ tslib_1.__exportStar(ToggleButton_1, exports);
6
+ tslib_1.__exportStar(ToggleButton_types_1, exports);
7
+ tslib_1.__exportStar(renderToggleButton_1, exports);
8
+ tslib_1.__exportStar(useToggleButton_1, exports);
9
+ Object.defineProperty(exports, "toggleButtonClassNames", { enumerable: true, get: function () { return useToggleButtonStyles_1.toggleButtonClassNames; } });
10
+ Object.defineProperty(exports, "useToggleButtonStyles_unstable", { enumerable: true, get: function () { return useToggleButtonStyles_1.useToggleButtonStyles_unstable; } });
11
+ });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/ToggleButton/index.ts"],"names":[],"mappings":";;;;IAAA,8CAA+B;IAC/B,oDAAqC;IACrC,oDAAqC;IACrC,iDAAkC;IACzB,+HAAA,sBAAsB,OAAA;IAAE,uIAAA,8BAA8B,OAAA","sourcesContent":["export * from './ToggleButton';\nexport * from './ToggleButton.types';\nexport * from './renderToggleButton';\nexport * from './useToggleButton';\nexport { toggleButtonClassNames, useToggleButtonStyles_unstable } from './useToggleButtonStyles';\n"]}
@@ -0,0 +1,7 @@
1
+ define(["require", "exports", "../Button/renderButton"], function (require, exports, renderButton_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.renderToggleButton_unstable = void 0;
5
+ Object.defineProperty(exports, "renderToggleButton_unstable", { enumerable: true, get: function () { return renderButton_1.renderButton_unstable; } });
6
+ });
7
+ //# sourceMappingURL=renderToggleButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderToggleButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/ToggleButton/renderToggleButton.tsx"],"names":[],"mappings":";;;;IAAS,2HAAA,qBAAqB,OAA+B","sourcesContent":["export { renderButton_unstable as renderToggleButton_unstable } from '../Button/renderButton';\n"]}
@@ -0,0 +1,17 @@
1
+ define(["require", "exports", "../../utils/useToggleState", "../Button/useButton"], function (require, exports, useToggleState_1, useButton_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useToggleButton_unstable = void 0;
5
+ /**
6
+ * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
7
+ * processed state.
8
+ * @param props - User provided props to the ToggleButton component.
9
+ * @param ref - User provided ref to be passed to the ToggleButton component.
10
+ */
11
+ var useToggleButton_unstable = function (props, ref) {
12
+ var buttonState = useButton_1.useButton_unstable(props, ref);
13
+ return useToggleState_1.useToggleState(props, buttonState);
14
+ };
15
+ exports.useToggleButton_unstable = useToggleButton_unstable;
16
+ });
17
+ //# sourceMappingURL=useToggleButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToggleButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":";;;;IAKA;;;;;OAKG;IACI,IAAM,wBAAwB,GAAG,UACtC,KAAwB,EACxB,GAAqD;QAErD,IAAM,WAAW,GAAG,8BAAkB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEnD,OAAO,+BAAc,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC,CAAC;IAPW,QAAA,wBAAwB,4BAOnC","sourcesContent":["import * as React from 'react';\nimport { useToggleState } from '../../utils/useToggleState';\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 props: ToggleButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToggleButtonState => {\n const buttonState = useButton_unstable(props, ref);\n\n return useToggleState(props, buttonState);\n};\n"]}
@@ -0,0 +1,75 @@
1
+ define(["require", "exports", "tslib", "@fluentui/react-icons", "@fluentui/react-tabster", "@fluentui/react-theme", "@griffel/react", "../Button/useButtonStyles"], function (require, exports, tslib_1, react_icons_1, react_tabster_1, react_theme_1, react_1, useButtonStyles_1) {
2
+ "use strict";
3
+ var _a;
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.useToggleButtonStyles_unstable = exports.toggleButtonClassNames = void 0;
6
+ exports.toggleButtonClassNames = {
7
+ root: 'fui-ToggleButton',
8
+ icon: 'fui-ToggleButton__icon',
9
+ };
10
+ var useRootCheckedStyles = react_1.makeStyles({
11
+ // Base styles
12
+ base: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground1Selected }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1)), { color: react_theme_1.tokens.colorNeutralForeground1Selected }), react_1.shorthands.borderWidth(react_theme_1.tokens.strokeWidthThin)), (_a = {}, _a["& ." + react_icons_1.iconFilledClassName] = {
13
+ display: 'inline',
14
+ }, _a["& ." + react_icons_1.iconRegularClassName] = {
15
+ display: 'none',
16
+ }, _a[':hover'] = tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground1Hover }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Hover)), { color: react_theme_1.tokens.colorNeutralForeground1Hover }), _a[':hover:active'] = tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground1Pressed }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Pressed)), { color: react_theme_1.tokens.colorNeutralForeground1Pressed }), _a)),
17
+ // High contrast styles
18
+ highContrast: {
19
+ '@media (forced-colors: active)': tslib_1.__assign(tslib_1.__assign({ backgroundColor: 'Highlight' }, react_1.shorthands.borderColor('Highlight')), { color: 'HighlightText', forcedColorAdjust: 'none', ':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: 'HighlightText' }, react_1.shorthands.borderColor('Highlight')), { color: 'Highlight' }), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: 'HighlightText' }, react_1.shorthands.borderColor('Highlight')), { color: 'Highlight' }), ':focus': tslib_1.__assign({}, react_1.shorthands.borderColor('Highlight')) }),
20
+ },
21
+ highContrastFocusStyles: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.border('1px', 'solid', 'HighlightText')), { outlineColor: 'Highlight' })),
22
+ // Appearance variations
23
+ outline: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundSelected }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1)), react_1.shorthands.borderWidth(react_theme_1.tokens.strokeWidthThicker)), { ':hover': {
24
+ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundHover,
25
+ }, ':hover:active': {
26
+ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundPressed,
27
+ } }), react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1)))),
28
+ primary: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorBrandBackgroundSelected }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForegroundOnBrand, ':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorBrandBackgroundHover }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForegroundOnBrand }), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorBrandBackgroundPressed }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForegroundOnBrand }) }),
29
+ secondary: {
30
+ /* The secondary styles are exactly the same as the base styles. */
31
+ },
32
+ subtle: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundSelected }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForeground2Selected, ':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundHover }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForeground2Hover }), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundPressed }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForeground2Pressed }) }),
33
+ transparent: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundSelected }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForeground2BrandSelected, ':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundHover }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForeground2BrandHover }), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundPressed }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForeground2BrandPressed }) }),
34
+ });
35
+ var useRootDisabledStyles = react_1.makeStyles({
36
+ // Base styles
37
+ base: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackgroundDisabled }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), { color: react_theme_1.tokens.colorNeutralForegroundDisabled, ':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackgroundDisabled }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), { color: react_theme_1.tokens.colorNeutralForegroundDisabled }), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackgroundDisabled }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), { color: react_theme_1.tokens.colorNeutralForegroundDisabled }) }),
38
+ // Appearance variations
39
+ outline: {
40
+ /* No styles */
41
+ },
42
+ primary: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor('transparent')), { ':hover': tslib_1.__assign({}, react_1.shorthands.borderColor('transparent')), ':hover:active': tslib_1.__assign({}, react_1.shorthands.borderColor('transparent')) }),
43
+ secondary: {
44
+ /* The secondary styles are exactly the same as the base styles. */
45
+ },
46
+ subtle: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor('transparent')), { ':hover': tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundHover }, react_1.shorthands.borderColor('transparent')), ':hover:active': tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundPressed }, react_1.shorthands.borderColor('transparent')) }),
47
+ transparent: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor('transparent')), { ':hover': tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundHover }, react_1.shorthands.borderColor('transparent')), ':hover:active': tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundPressed }, react_1.shorthands.borderColor('transparent')) }),
48
+ });
49
+ var useIconCheckedStyles = react_1.makeStyles({
50
+ // Appearance variations
51
+ subtleOrTransparent: {
52
+ color: react_theme_1.tokens.colorNeutralForeground2BrandSelected,
53
+ },
54
+ });
55
+ var useToggleButtonStyles_unstable = function (state) {
56
+ var rootCheckedStyles = useRootCheckedStyles();
57
+ var rootDisabledStyles = useRootDisabledStyles();
58
+ var iconCheckedStyles = useIconCheckedStyles();
59
+ var appearance = state.appearance, checked = state.checked, disabled = state.disabled, disabledFocusable = state.disabledFocusable;
60
+ state.root.className = react_1.mergeClasses(exports.toggleButtonClassNames.root,
61
+ // Checked styles
62
+ checked && rootCheckedStyles.base, checked && rootCheckedStyles.highContrast, appearance && checked && rootCheckedStyles[appearance],
63
+ // Disabled styles
64
+ (disabled || disabledFocusable) && rootDisabledStyles.base, appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance],
65
+ // User provided class name
66
+ state.root.className);
67
+ if (state.icon) {
68
+ state.icon.className = react_1.mergeClasses(exports.toggleButtonClassNames.icon, (appearance === 'subtle' || appearance === 'transparent') && iconCheckedStyles.subtleOrTransparent, state.icon.className);
69
+ }
70
+ useButtonStyles_1.useButtonStyles_unstable(state);
71
+ return state;
72
+ };
73
+ exports.useToggleButtonStyles_unstable = useToggleButtonStyles_unstable;
74
+ });
75
+ //# sourceMappingURL=useToggleButtonStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToggleButtonStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/ToggleButton/useToggleButtonStyles.ts"],"names":[],"mappings":";;;;;IASa,QAAA,sBAAsB,GAAgC;QACjE,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,wBAAwB;KAC/B,CAAC;IAEF,IAAM,oBAAoB,GAAG,kBAAU,CAAC;QACtC,cAAc;QACd,IAAI,wEACF,eAAe,EAAE,oBAAM,CAAC,+BAA+B,IACpD,kBAAU,CAAC,WAAW,CAAC,oBAAM,CAAC,mBAAmB,CAAC,KACrD,KAAK,EAAE,oBAAM,CAAC,+BAA+B,KAE1C,kBAAU,CAAC,WAAW,CAAC,oBAAM,CAAC,eAAe,CAAC,gBAEhD,QAAM,iCAAqB,IAAG;YAC7B,OAAO,EAAE,QAAQ;SAClB,KACA,QAAM,kCAAsB,IAAG;YAC9B,OAAO,EAAE,MAAM;SAChB,EAED,YAAQ,uCACN,eAAe,EAAE,oBAAM,CAAC,4BAA4B,IACjD,kBAAU,CAAC,WAAW,CAAC,oBAAM,CAAC,wBAAwB,CAAC,KAC1D,KAAK,EAAE,oBAAM,CAAC,4BAA4B,KAG5C,mBAAe,uCACb,eAAe,EAAE,oBAAM,CAAC,8BAA8B,IACnD,kBAAU,CAAC,WAAW,CAAC,oBAAM,CAAC,0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C;QAEhC,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAlCW,QAAA,8BAA8B,kCAkCzC","sourcesContent":["import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ButtonSlots } from '../Button/Button.types';\nimport type { ToggleButtonState } from './ToggleButton.types';\n\nexport const toggleButtonClassNames: SlotClassNames<ButtonSlots> = {\n root: 'fui-ToggleButton',\n icon: 'fui-ToggleButton__icon',\n};\n\nconst useRootCheckedStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n color: tokens.colorNeutralForeground1Selected,\n\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n color: tokens.colorNeutralForeground1Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n color: tokens.colorNeutralForeground1Pressed,\n },\n },\n\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n backgroundColor: 'Highlight',\n ...shorthands.borderColor('Highlight'),\n color: 'HighlightText',\n forcedColorAdjust: 'none',\n\n ':hover': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n },\n\n ':hover:active': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n },\n\n ':focus': {\n ...shorthands.borderColor('Highlight'),\n },\n },\n },\n highContrastFocusStyles: createCustomFocusIndicatorStyle({\n ...shorthands.border('1px', 'solid', 'HighlightText'),\n outlineColor: 'Highlight',\n }),\n\n // Appearance variations\n outline: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n ...shorthands.borderWidth(tokens.strokeWidthThicker),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n },\n\n ...createCustomFocusIndicatorStyle({\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n }),\n },\n primary: {\n backgroundColor: tokens.colorBrandBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n\n ':hover': {\n backgroundColor: tokens.colorBrandBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorBrandBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Selected,\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandSelected,\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n});\n\nconst useRootDisabledStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n ...shorthands.borderColor('transparent'),\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n },\n },\n});\n\nconst useIconCheckedStyles = makeStyles({\n // Appearance variations\n subtleOrTransparent: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\nexport const useToggleButtonStyles_unstable = (state: ToggleButtonState): ToggleButtonState => {\n const rootCheckedStyles = useRootCheckedStyles();\n const rootDisabledStyles = useRootDisabledStyles();\n const iconCheckedStyles = useIconCheckedStyles();\n\n const { appearance, checked, disabled, disabledFocusable } = state;\n\n state.root.className = mergeClasses(\n toggleButtonClassNames.root,\n\n // Checked styles\n checked && rootCheckedStyles.base,\n checked && rootCheckedStyles.highContrast,\n appearance && checked && rootCheckedStyles[appearance],\n\n // Disabled styles\n (disabled || disabledFocusable) && rootDisabledStyles.base,\n appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance],\n\n // User provided class name\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n toggleButtonClassNames.icon,\n (appearance === 'subtle' || appearance === 'transparent') && iconCheckedStyles.subtleOrTransparent,\n state.icon.className,\n );\n }\n\n useButtonStyles_unstable(state);\n\n return state;\n};\n"]}
@@ -0,0 +1,32 @@
1
+ define(["require", "exports", "./Button", "./CompoundButton", "./MenuButton", "./SplitButton", "./ToggleButton", "./utils/index"], function (require, exports, Button_1, CompoundButton_1, MenuButton_1, SplitButton_1, ToggleButton_1, index_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useToggleState = exports.useToggleButton_unstable = exports.useToggleButtonStyles_unstable = exports.toggleButtonClassNames = exports.renderToggleButton_unstable = exports.ToggleButton = exports.useSplitButton_unstable = exports.useSplitButtonStyles_unstable = exports.splitButtonClassNames = exports.renderSplitButton_unstable = exports.SplitButton = exports.useMenuButton_unstable = exports.useMenuButtonStyles_unstable = exports.renderMenuButton_unstable = exports.menuButtonClassNames = exports.MenuButton = exports.useCompoundButton_unstable = exports.useCompoundButtonStyles_unstable = exports.renderCompoundButton_unstable = exports.compoundButtonClassNames = exports.CompoundButton = exports.useButton_unstable = exports.useButtonStyles_unstable = exports.renderButton_unstable = exports.buttonClassNames = exports.Button = void 0;
5
+ Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return Button_1.Button; } });
6
+ Object.defineProperty(exports, "buttonClassNames", { enumerable: true, get: function () { return Button_1.buttonClassNames; } });
7
+ Object.defineProperty(exports, "renderButton_unstable", { enumerable: true, get: function () { return Button_1.renderButton_unstable; } });
8
+ Object.defineProperty(exports, "useButtonStyles_unstable", { enumerable: true, get: function () { return Button_1.useButtonStyles_unstable; } });
9
+ Object.defineProperty(exports, "useButton_unstable", { enumerable: true, get: function () { return Button_1.useButton_unstable; } });
10
+ Object.defineProperty(exports, "CompoundButton", { enumerable: true, get: function () { return CompoundButton_1.CompoundButton; } });
11
+ Object.defineProperty(exports, "compoundButtonClassNames", { enumerable: true, get: function () { return CompoundButton_1.compoundButtonClassNames; } });
12
+ Object.defineProperty(exports, "renderCompoundButton_unstable", { enumerable: true, get: function () { return CompoundButton_1.renderCompoundButton_unstable; } });
13
+ Object.defineProperty(exports, "useCompoundButtonStyles_unstable", { enumerable: true, get: function () { return CompoundButton_1.useCompoundButtonStyles_unstable; } });
14
+ Object.defineProperty(exports, "useCompoundButton_unstable", { enumerable: true, get: function () { return CompoundButton_1.useCompoundButton_unstable; } });
15
+ Object.defineProperty(exports, "MenuButton", { enumerable: true, get: function () { return MenuButton_1.MenuButton; } });
16
+ Object.defineProperty(exports, "menuButtonClassNames", { enumerable: true, get: function () { return MenuButton_1.menuButtonClassNames; } });
17
+ Object.defineProperty(exports, "renderMenuButton_unstable", { enumerable: true, get: function () { return MenuButton_1.renderMenuButton_unstable; } });
18
+ Object.defineProperty(exports, "useMenuButtonStyles_unstable", { enumerable: true, get: function () { return MenuButton_1.useMenuButtonStyles_unstable; } });
19
+ Object.defineProperty(exports, "useMenuButton_unstable", { enumerable: true, get: function () { return MenuButton_1.useMenuButton_unstable; } });
20
+ Object.defineProperty(exports, "SplitButton", { enumerable: true, get: function () { return SplitButton_1.SplitButton; } });
21
+ Object.defineProperty(exports, "renderSplitButton_unstable", { enumerable: true, get: function () { return SplitButton_1.renderSplitButton_unstable; } });
22
+ Object.defineProperty(exports, "splitButtonClassNames", { enumerable: true, get: function () { return SplitButton_1.splitButtonClassNames; } });
23
+ Object.defineProperty(exports, "useSplitButtonStyles_unstable", { enumerable: true, get: function () { return SplitButton_1.useSplitButtonStyles_unstable; } });
24
+ Object.defineProperty(exports, "useSplitButton_unstable", { enumerable: true, get: function () { return SplitButton_1.useSplitButton_unstable; } });
25
+ Object.defineProperty(exports, "ToggleButton", { enumerable: true, get: function () { return ToggleButton_1.ToggleButton; } });
26
+ Object.defineProperty(exports, "renderToggleButton_unstable", { enumerable: true, get: function () { return ToggleButton_1.renderToggleButton_unstable; } });
27
+ Object.defineProperty(exports, "toggleButtonClassNames", { enumerable: true, get: function () { return ToggleButton_1.toggleButtonClassNames; } });
28
+ Object.defineProperty(exports, "useToggleButtonStyles_unstable", { enumerable: true, get: function () { return ToggleButton_1.useToggleButtonStyles_unstable; } });
29
+ Object.defineProperty(exports, "useToggleButton_unstable", { enumerable: true, get: function () { return ToggleButton_1.useToggleButton_unstable; } });
30
+ Object.defineProperty(exports, "useToggleState", { enumerable: true, get: function () { return index_1.useToggleState; } });
31
+ });
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-button/src/index.ts"],"names":[],"mappings":";;;;IACE,gGAAA,MAAM,OAAA;IACN,0GAAA,gBAAgB,OAAA;IAChB,+GAAA,qBAAqB,OAAA;IACrB,kHAAA,wBAAwB,OAAA;IACxB,4GAAA,kBAAkB,OAAA;IAIlB,gHAAA,cAAc,OAAA;IACd,0HAAA,wBAAwB,OAAA;IACxB,+HAAA,6BAA6B,OAAA;IAC7B,kIAAA,gCAAgC,OAAA;IAChC,4HAAA,0BAA0B,OAAA;IAI1B,wGAAA,UAAU,OAAA;IACV,kHAAA,oBAAoB,OAAA;IACpB,uHAAA,yBAAyB,OAAA;IACzB,0HAAA,4BAA4B,OAAA;IAC5B,oHAAA,sBAAsB,OAAA;IAItB,0GAAA,WAAW,OAAA;IACX,yHAAA,0BAA0B,OAAA;IAC1B,oHAAA,qBAAqB,OAAA;IACrB,4HAAA,6BAA6B,OAAA;IAC7B,sHAAA,uBAAuB,OAAA;IAIvB,4GAAA,YAAY,OAAA;IACZ,2HAAA,2BAA2B,OAAA;IAC3B,sHAAA,sBAAsB,OAAA;IACtB,8HAAA,8BAA8B,OAAA;IAC9B,wHAAA,wBAAwB,OAAA;IAIjB,uGAAA,cAAc,OAAA","sourcesContent":["export {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './Button';\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './CompoundButton';\nexport type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './CompoundButton';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './MenuButton';\nexport type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './MenuButton';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './SplitButton';\nexport type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './SplitButton';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './ToggleButton';\nexport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton';\n\nexport { useToggleState } from './utils/index';\n"]}
@@ -0,0 +1,6 @@
1
+ define(["require", "exports", "tslib", "./useToggleState"], function (require, exports, tslib_1, useToggleState_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(useToggleState_1, exports);
5
+ });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-button/src/utils/index.ts"],"names":[],"mappings":";;;IAAA,gDAAiC","sourcesContent":["export * from './useToggleState';\n"]}
@@ -0,0 +1,27 @@
1
+ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useToggleState = void 0;
5
+ function useToggleState(props, state) {
6
+ var _a;
7
+ var checked = props.checked, defaultChecked = props.defaultChecked, disabled = props.disabled, disabledFocusable = props.disabledFocusable;
8
+ var _b = state.root, onClick = _b.onClick, role = _b.role;
9
+ var _c = react_utilities_1.useControllableState({
10
+ state: checked,
11
+ defaultState: defaultChecked,
12
+ initialState: false,
13
+ }), checkedValue = _c[0], setCheckedValue = _c[1];
14
+ var isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';
15
+ var onToggleClick = React.useCallback(function (ev) {
16
+ if (!disabled && !disabledFocusable) {
17
+ if (ev.defaultPrevented) {
18
+ return;
19
+ }
20
+ setCheckedValue(!checkedValue);
21
+ }
22
+ }, [checkedValue, disabled, disabledFocusable, setCheckedValue]);
23
+ return tslib_1.__assign(tslib_1.__assign({}, state), { checked: checkedValue, root: tslib_1.__assign(tslib_1.__assign({}, state.root), (_a = {}, _a[isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed'] = checkedValue, _a.onClick = react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(onClick, onToggleClick)), _a)) });
24
+ }
25
+ exports.useToggleState = useToggleState;
26
+ });
27
+ //# sourceMappingURL=useToggleState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToggleState.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-button/src/utils/useToggleState.ts"],"names":[],"mappings":";;;;IAKA,SAAgB,cAAc,CAI5B,KAAyB,EAAE,KAAmB;;QACtC,IAAA,OAAO,GAAkD,KAAK,QAAvD,EAAE,cAAc,GAAkC,KAAK,eAAvC,EAAE,QAAQ,GAAwB,KAAK,SAA7B,EAAE,iBAAiB,GAAK,KAAK,kBAAV,CAAW;QACjE,IAAA,KAAoB,KAAK,CAAC,IAAI,EAA5B,OAAO,aAAA,EAAE,IAAI,UAAe,CAAC;QAE/B,IAAA,KAAkC,sCAAoB,CAAC;YAC3D,KAAK,EAAE,OAAO;YACd,YAAY,EAAE,cAAc;YAC5B,YAAY,EAAE,KAAK;SACpB,CAAC,EAJK,YAAY,QAAA,EAAE,eAAe,QAIlC,CAAC;QAEH,IAAM,kBAAkB,GAAG,IAAI,KAAK,kBAAkB,IAAI,IAAI,KAAK,UAAU,CAAC;QAE9E,IAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CACrC,UAAA,EAAE;YACA,IAAI,CAAC,QAAQ,IAAI,CAAC,iBAAiB,EAAE;gBACnC,IAAI,EAAE,CAAC,gBAAgB,EAAE;oBACvB,OAAO;iBACR;gBAED,eAAe,CAAC,CAAC,YAAY,CAAC,CAAC;aAChC;QACH,CAAC,EACD,CAAC,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,eAAe,CAAC,CAC7D,CAAC;QAEF,OAAO,sCACF,KAAK,KAER,OAAO,EAAE,YAAY,EAErB,IAAI,wCACC,KAAK,CAAC,IAAI,gBACZ,kBAAkB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,IAAG,YAAY,EACpE,UAAO,GAAE,kCAAgB,CACvB,gCAAc,CAAC,OAAyE,EAAE,aAAa,CAAC,CACzG,SAEkB,CAAC;IAC1B,CAAC;IA1CD,wCA0CC","sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport type { ButtonState } from '../Button';\nimport type { ToggleButtonProps, ToggleButtonState } from '../ToggleButton';\n\nexport function useToggleState<\n TToggleButtonProps extends Pick<ToggleButtonProps, 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable'>,\n TButtonState extends Pick<ButtonState, 'root'>,\n TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root'>\n>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState {\n const { checked, defaultChecked, disabled, disabledFocusable } = props;\n const { onClick, role } = state.root;\n\n const [checkedValue, setCheckedValue] = useControllableState({\n state: checked,\n defaultState: defaultChecked,\n initialState: false,\n });\n\n const isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';\n\n const onToggleClick = React.useCallback(\n ev => {\n if (!disabled && !disabledFocusable) {\n if (ev.defaultPrevented) {\n return;\n }\n\n setCheckedValue(!checkedValue);\n }\n },\n [checkedValue, disabled, disabledFocusable, setCheckedValue],\n );\n\n return {\n ...state,\n\n checked: checkedValue,\n\n root: {\n ...state.root,\n [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,\n onClick: useEventCallback(\n mergeCallbacks(onClick as React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>, onToggleClick),\n ),\n },\n } as TToggleButtonState;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Button.tsx"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Button/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-button/src/Button.tsx"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Button/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["CompoundButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/CompoundButton/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-button/src/CompoundButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/CompoundButton/index';\n"],"sourceRoot":"../src/"}