@fluentui/react-button 9.0.0-alpha.10 → 9.0.0-alpha.100

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. package/CHANGELOG.json +2418 -1
  2. package/CHANGELOG.md +920 -2
  3. package/README.md +19 -108
  4. package/dist/demo/index.html +71 -0
  5. package/dist/demo/react-dom.development.js +21413 -0
  6. package/dist/demo/react.development.js +3155 -0
  7. package/dist/react-button.d.ts +204 -82
  8. package/lib/Button.js.map +1 -1
  9. package/lib/CompoundButton.d.ts +1 -0
  10. package/lib/CompoundButton.js +2 -0
  11. package/lib/CompoundButton.js.map +1 -0
  12. package/lib/MenuButton.d.ts +1 -0
  13. package/lib/MenuButton.js +2 -0
  14. package/lib/MenuButton.js.map +1 -0
  15. package/lib/SplitButton.d.ts +1 -0
  16. package/lib/SplitButton.js +2 -0
  17. package/lib/SplitButton.js.map +1 -0
  18. package/lib/ToggleButton.d.ts +1 -0
  19. package/lib/ToggleButton.js +2 -0
  20. package/lib/ToggleButton.js.map +1 -0
  21. package/lib/common/isConformant.d.ts +4 -2
  22. package/lib/common/isConformant.js +9 -6
  23. package/lib/common/isConformant.js.map +1 -1
  24. package/lib/components/Button/Button.d.ts +4 -11
  25. package/lib/components/Button/Button.js +7 -16
  26. package/lib/components/Button/Button.js.map +1 -1
  27. package/lib/components/Button/Button.types.d.ts +57 -60
  28. package/lib/components/Button/Button.types.js +1 -0
  29. package/lib/components/Button/Button.types.js.map +1 -1
  30. package/lib/components/Button/index.d.ts +1 -2
  31. package/lib/components/Button/index.js +1 -1
  32. package/lib/components/Button/index.js.map +1 -1
  33. package/lib/components/Button/renderButton.d.ts +2 -2
  34. package/lib/components/Button/renderButton.js +9 -8
  35. package/lib/components/Button/renderButton.js.map +1 -1
  36. package/lib/components/Button/useButton.d.ts +5 -7
  37. package/lib/components/Button/useButton.js +49 -23
  38. package/lib/components/Button/useButton.js.map +1 -1
  39. package/lib/components/Button/useButtonStyles.d.ts +10 -4
  40. package/lib/components/Button/useButtonStyles.js +350 -378
  41. package/lib/components/Button/useButtonStyles.js.map +1 -1
  42. package/lib/components/CompoundButton/CompoundButton.d.ts +6 -0
  43. package/lib/components/CompoundButton/CompoundButton.js +15 -0
  44. package/lib/components/CompoundButton/CompoundButton.js.map +1 -0
  45. package/lib/components/CompoundButton/CompoundButton.types.d.ts +14 -0
  46. package/lib/components/CompoundButton/CompoundButton.types.js +2 -0
  47. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -0
  48. package/lib/components/CompoundButton/index.d.ts +5 -0
  49. package/lib/components/CompoundButton/index.js +6 -0
  50. package/lib/components/CompoundButton/index.js.map +1 -0
  51. package/lib/components/CompoundButton/renderCompoundButton.d.ts +5 -0
  52. package/lib/components/CompoundButton/renderCompoundButton.js +17 -0
  53. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -0
  54. package/lib/components/CompoundButton/useCompoundButton.d.ts +8 -0
  55. package/lib/components/CompoundButton/useCompoundButton.js +29 -0
  56. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -0
  57. package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +2 -0
  58. package/lib/components/CompoundButton/useCompoundButtonStyles.js +164 -0
  59. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
  60. package/lib/components/MenuButton/MenuButton.d.ts +6 -0
  61. package/lib/components/MenuButton/MenuButton.js +15 -0
  62. package/lib/components/MenuButton/MenuButton.js.map +1 -0
  63. package/lib/components/MenuButton/MenuButton.types.d.ts +11 -0
  64. package/lib/components/MenuButton/MenuButton.types.js +2 -0
  65. package/lib/components/MenuButton/MenuButton.types.js.map +1 -0
  66. package/lib/components/MenuButton/index.d.ts +5 -0
  67. package/lib/components/MenuButton/index.js +6 -0
  68. package/lib/components/MenuButton/index.js.map +1 -0
  69. package/lib/components/MenuButton/renderMenuButton.d.ts +5 -0
  70. package/lib/components/MenuButton/renderMenuButton.js +17 -0
  71. package/lib/components/MenuButton/renderMenuButton.js.map +1 -0
  72. package/lib/components/MenuButton/useMenuButton.d.ts +6 -0
  73. package/lib/components/MenuButton/useMenuButton.js +32 -0
  74. package/lib/components/MenuButton/useMenuButton.js.map +1 -0
  75. package/lib/components/MenuButton/useMenuButtonStyles.d.ts +2 -0
  76. package/lib/components/MenuButton/useMenuButtonStyles.js +34 -0
  77. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -0
  78. package/lib/components/SplitButton/SplitButton.d.ts +7 -0
  79. package/lib/components/SplitButton/SplitButton.js +16 -0
  80. package/lib/components/SplitButton/SplitButton.js.map +1 -0
  81. package/lib/components/SplitButton/SplitButton.types.d.ts +19 -0
  82. package/lib/components/SplitButton/SplitButton.types.js +2 -0
  83. package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
  84. package/lib/components/SplitButton/index.d.ts +5 -0
  85. package/lib/components/SplitButton/index.js +6 -0
  86. package/lib/components/SplitButton/index.js.map +1 -0
  87. package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
  88. package/lib/components/SplitButton/renderSplitButton.js +15 -0
  89. package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
  90. package/lib/components/SplitButton/useSplitButton.d.ts +8 -0
  91. package/lib/components/SplitButton/useSplitButton.js +73 -0
  92. package/lib/components/SplitButton/useSplitButton.js.map +1 -0
  93. package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  94. package/lib/components/SplitButton/useSplitButtonStyles.js +77 -0
  95. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  96. package/lib/components/ToggleButton/ToggleButton.d.ts +6 -0
  97. package/lib/components/ToggleButton/ToggleButton.js +15 -0
  98. package/lib/components/ToggleButton/ToggleButton.js.map +1 -0
  99. package/lib/components/ToggleButton/ToggleButton.types.d.ts +19 -0
  100. package/lib/components/ToggleButton/ToggleButton.types.js +2 -0
  101. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -0
  102. package/lib/components/ToggleButton/index.d.ts +5 -0
  103. package/lib/components/ToggleButton/index.js +6 -0
  104. package/lib/components/ToggleButton/index.js.map +1 -0
  105. package/lib/components/ToggleButton/renderToggleButton.d.ts +1 -0
  106. package/lib/components/ToggleButton/renderToggleButton.js +2 -0
  107. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -0
  108. package/lib/components/ToggleButton/useToggleButton.d.ts +9 -0
  109. package/lib/components/ToggleButton/useToggleButton.js +50 -0
  110. package/lib/components/ToggleButton/useToggleButton.js.map +1 -0
  111. package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +2 -0
  112. package/lib/components/ToggleButton/useToggleButtonStyles.js +190 -0
  113. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
  114. package/lib/index.d.ts +4 -0
  115. package/lib/index.js +4 -0
  116. package/lib/index.js.map +1 -1
  117. package/lib/tsdoc-metadata.json +1 -1
  118. package/lib-commonjs/Button.js +7 -2
  119. package/lib-commonjs/Button.js.map +1 -1
  120. package/lib-commonjs/CompoundButton.d.ts +1 -0
  121. package/lib-commonjs/CompoundButton.js +10 -0
  122. package/lib-commonjs/CompoundButton.js.map +1 -0
  123. package/lib-commonjs/MenuButton.d.ts +1 -0
  124. package/lib-commonjs/MenuButton.js +10 -0
  125. package/lib-commonjs/MenuButton.js.map +1 -0
  126. package/lib-commonjs/SplitButton.d.ts +1 -0
  127. package/lib-commonjs/SplitButton.js +10 -0
  128. package/lib-commonjs/SplitButton.js.map +1 -0
  129. package/lib-commonjs/ToggleButton.d.ts +1 -0
  130. package/lib-commonjs/ToggleButton.js +10 -0
  131. package/lib-commonjs/ToggleButton.js.map +1 -0
  132. package/lib-commonjs/common/isConformant.d.ts +4 -2
  133. package/lib-commonjs/common/isConformant.js +19 -8
  134. package/lib-commonjs/common/isConformant.js.map +1 -1
  135. package/lib-commonjs/components/Button/Button.d.ts +4 -11
  136. package/lib-commonjs/components/Button/Button.js +20 -20
  137. package/lib-commonjs/components/Button/Button.js.map +1 -1
  138. package/lib-commonjs/components/Button/Button.types.d.ts +57 -60
  139. package/lib-commonjs/components/Button/Button.types.js +4 -1
  140. package/lib-commonjs/components/Button/Button.types.js.map +1 -1
  141. package/lib-commonjs/components/Button/index.d.ts +1 -2
  142. package/lib-commonjs/components/Button/index.js +21 -5
  143. package/lib-commonjs/components/Button/index.js.map +1 -1
  144. package/lib-commonjs/components/Button/renderButton.d.ts +2 -2
  145. package/lib-commonjs/components/Button/renderButton.js +24 -13
  146. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  147. package/lib-commonjs/components/Button/useButton.d.ts +5 -7
  148. package/lib-commonjs/components/Button/useButton.js +59 -24
  149. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  150. package/lib-commonjs/components/Button/useButtonStyles.d.ts +10 -4
  151. package/lib-commonjs/components/Button/useButtonStyles.js +360 -379
  152. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  153. package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +6 -0
  154. package/lib-commonjs/components/CompoundButton/CompoundButton.js +26 -0
  155. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -0
  156. package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +14 -0
  157. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js +6 -0
  158. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -0
  159. package/lib-commonjs/components/CompoundButton/index.d.ts +5 -0
  160. package/lib-commonjs/components/CompoundButton/index.js +26 -0
  161. package/lib-commonjs/components/CompoundButton/index.js.map +1 -0
  162. package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +5 -0
  163. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +29 -0
  164. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -0
  165. package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +8 -0
  166. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +41 -0
  167. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -0
  168. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +2 -0
  169. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +175 -0
  170. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
  171. package/lib-commonjs/components/MenuButton/MenuButton.d.ts +6 -0
  172. package/lib-commonjs/components/MenuButton/MenuButton.js +26 -0
  173. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -0
  174. package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +11 -0
  175. package/lib-commonjs/components/MenuButton/MenuButton.types.js +6 -0
  176. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -0
  177. package/lib-commonjs/components/MenuButton/index.d.ts +5 -0
  178. package/lib-commonjs/components/MenuButton/index.js +26 -0
  179. package/lib-commonjs/components/MenuButton/index.js.map +1 -0
  180. package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +5 -0
  181. package/lib-commonjs/components/MenuButton/renderMenuButton.js +29 -0
  182. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -0
  183. package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +6 -0
  184. package/lib-commonjs/components/MenuButton/useMenuButton.js +46 -0
  185. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -0
  186. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +2 -0
  187. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +44 -0
  188. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -0
  189. package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
  190. package/lib-commonjs/components/SplitButton/SplitButton.js +27 -0
  191. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
  192. package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +19 -0
  193. package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
  194. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
  195. package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
  196. package/lib-commonjs/components/SplitButton/index.js +26 -0
  197. package/lib-commonjs/components/SplitButton/index.js.map +1 -0
  198. package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
  199. package/lib-commonjs/components/SplitButton/renderSplitButton.js +27 -0
  200. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
  201. package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +8 -0
  202. package/lib-commonjs/components/SplitButton/useSplitButton.js +86 -0
  203. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
  204. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  205. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +88 -0
  206. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  207. package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +6 -0
  208. package/lib-commonjs/components/ToggleButton/ToggleButton.js +26 -0
  209. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -0
  210. package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +19 -0
  211. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +6 -0
  212. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -0
  213. package/lib-commonjs/components/ToggleButton/index.d.ts +5 -0
  214. package/lib-commonjs/components/ToggleButton/index.js +26 -0
  215. package/lib-commonjs/components/ToggleButton/index.js.map +1 -0
  216. package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +1 -0
  217. package/lib-commonjs/components/ToggleButton/renderToggleButton.js +16 -0
  218. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -0
  219. package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +9 -0
  220. package/lib-commonjs/components/ToggleButton/useToggleButton.js +63 -0
  221. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -0
  222. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +2 -0
  223. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +200 -0
  224. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
  225. package/lib-commonjs/index.d.ts +4 -0
  226. package/lib-commonjs/index.js +15 -2
  227. package/lib-commonjs/index.js.map +1 -1
  228. package/package.json +21 -14
  229. package/config/api-extractor.json +0 -3
  230. package/config/pre-copy.json +0 -9
  231. package/config/tests.js +0 -6
  232. package/etc/react-button.api.md +0 -104
  233. package/just.config.ts +0 -3
  234. package/lib/components/Button/useButtonState.d.ts +0 -6
  235. package/lib/components/Button/useButtonState.js +0 -45
  236. package/lib/components/Button/useButtonState.js.map +0 -1
  237. package/lib-amd/Button.d.ts +0 -1
  238. package/lib-amd/Button.js +0 -6
  239. package/lib-amd/Button.js.map +0 -1
  240. package/lib-amd/common/isConformant.d.ts +0 -2
  241. package/lib-amd/common/isConformant.js +0 -14
  242. package/lib-amd/common/isConformant.js.map +0 -1
  243. package/lib-amd/components/Button/Button.d.ts +0 -13
  244. package/lib-amd/components/Button/Button.js +0 -24
  245. package/lib-amd/components/Button/Button.js.map +0 -1
  246. package/lib-amd/components/Button/Button.types.d.ts +0 -65
  247. package/lib-amd/components/Button/Button.types.js +0 -5
  248. package/lib-amd/components/Button/Button.types.js.map +0 -1
  249. package/lib-amd/components/Button/index.d.ts +0 -6
  250. package/lib-amd/components/Button/index.js +0 -10
  251. package/lib-amd/components/Button/index.js.map +0 -1
  252. package/lib-amd/components/Button/renderButton.d.ts +0 -5
  253. package/lib-amd/components/Button/renderButton.js +0 -16
  254. package/lib-amd/components/Button/renderButton.js.map +0 -1
  255. package/lib-amd/components/Button/useButton.d.ts +0 -10
  256. package/lib-amd/components/Button/useButton.js +0 -28
  257. package/lib-amd/components/Button/useButton.js.map +0 -1
  258. package/lib-amd/components/Button/useButtonState.d.ts +0 -6
  259. package/lib-amd/components/Button/useButtonState.js +0 -48
  260. package/lib-amd/components/Button/useButtonState.js.map +0 -1
  261. package/lib-amd/components/Button/useButtonStyles.d.ts +0 -4
  262. package/lib-amd/components/Button/useButtonStyles.js +0 -385
  263. package/lib-amd/components/Button/useButtonStyles.js.map +0 -1
  264. package/lib-amd/index.d.ts +0 -1
  265. package/lib-amd/index.js +0 -6
  266. package/lib-amd/index.js.map +0 -1
  267. package/lib-commonjs/components/Button/useButtonState.d.ts +0 -6
  268. package/lib-commonjs/components/Button/useButtonState.js +0 -47
  269. package/lib-commonjs/components/Button/useButtonState.js.map +0 -1
  270. package/src/components/Button/Button.types.ts +0 -120
@@ -1,24 +0,0 @@
1
- define(["require", "exports", "react", "./useButton", "./renderButton", "./useButtonStyles"], function (require, exports, React, useButton_1, renderButton_1, useButtonStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * Define a styled Button, using the `useButton` hook.
6
- * {@docCategory Button}
7
- */
8
- exports.Button = React.forwardRef(function (props, ref) {
9
- var _a, _b;
10
- var state = useButton_1.useButton(props, ref);
11
- var receivedChildren = !!((_a = state.children) === null || _a === void 0 ? void 0 : _a.children);
12
- var receivedIcon = !!((_b = state.icon) === null || _b === void 0 ? void 0 : _b.children);
13
- var styleSelectors = {
14
- disabled: state.disabled,
15
- primary: state.primary,
16
- iconOnly: receivedIcon && !receivedChildren,
17
- size: state.size,
18
- };
19
- useButtonStyles_1.useButtonStyles(state, styleSelectors);
20
- return renderButton_1.renderButton(state);
21
- });
22
- exports.Button.displayName = 'Button';
23
- });
24
- //# sourceMappingURL=Button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"../src/","sources":["components/Button/Button.tsx"],"names":[],"mappings":";;;IAMA;;;OAGG;IACU,QAAA,MAAM,GAAG,KAAK,CAAC,UAAU,CAA2B,UAAC,KAAK,EAAE,GAAG;;QAC1E,IAAM,KAAK,GAAG,qBAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEpC,IAAM,gBAAgB,GAAG,CAAC,QAAC,KAAK,CAAC,QAAQ,0CAAE,QAAQ,CAAA,CAAC;QACpD,IAAM,YAAY,GAAG,CAAC,QAAC,KAAK,CAAC,IAAI,0CAAE,QAAQ,CAAA,CAAC;QAE5C,IAAM,cAAc,GAAyB;YAC3C,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,QAAQ,EAAE,YAAY,IAAI,CAAC,gBAAgB;YAC3C,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC;QAEF,iCAAe,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QAEvC,OAAO,2BAAY,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,cAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import * as React from 'react';\nimport { useButton } from './useButton';\nimport { ButtonProps, ButtonStyleSelectors } from './Button.types';\nimport { renderButton } from './renderButton';\nimport { useButtonStyles } from './useButtonStyles';\n\n/**\n * Define a styled Button, using the `useButton` hook.\n * {@docCategory Button}\n */\nexport const Button = React.forwardRef<HTMLElement, ButtonProps>((props, ref) => {\n const state = useButton(props, ref);\n\n const receivedChildren = !!state.children?.children;\n const receivedIcon = !!state.icon?.children;\n\n const styleSelectors: ButtonStyleSelectors = {\n disabled: state.disabled,\n primary: state.primary,\n iconOnly: receivedIcon && !receivedChildren,\n size: state.size,\n };\n\n useButtonStyles(state, styleSelectors);\n\n return renderButton(state);\n});\n\nButton.displayName = 'Button';\n"]}
@@ -1,65 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentProps, ShorthandProps } from '@fluentui/react-utilities';
3
- import { ObjectShorthandProps } from '@fluentui/react-utilities';
4
- export declare type ButtonProps = ComponentProps & React.ButtonHTMLAttributes<HTMLElement> & {
5
- /**
6
- * Shorthand icon. A shorthand prop can be a literal, object, or
7
- * JSX. The `children` prop of the object can be a render function,
8
- * taking in the original slot component and props.
9
- */
10
- icon?: ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
11
- /** A button can show that it cannot be interacted with. */
12
- disabled?: boolean;
13
- /** A button can contain only an icon. */
14
- iconOnly?: boolean;
15
- /** An icon button can format its icon to appear before or after its content. */
16
- iconPosition?: 'before' | 'after';
17
- /** A button can emphasize that it represents the primary action. */
18
- primary?: boolean;
19
- /** A button can be sized. */
20
- size?: 'small' | 'large';
21
- };
22
- /**
23
- * {@docCategory Button}
24
- */
25
- export interface ButtonState extends ButtonProps {
26
- ref: React.RefObject<HTMLButtonElement>;
27
- icon?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
28
- children?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
29
- }
30
- export declare type ButtonStyleSelectors = {
31
- disabled?: boolean;
32
- iconOnly?: boolean;
33
- primary?: boolean;
34
- size?: string;
35
- };
36
- export declare type ButtonVariants = 'base' | 'disabled' | 'iconOnly' | 'primary' | 'small' | 'large' | 'primaryDisabled' | 'iconOnlySmall' | 'iconOnlyLarge';
37
- export declare type ButtonTokens = {
38
- height: string;
39
- paddingX: string;
40
- paddingY: string;
41
- minWidth: string;
42
- maxWidth: string;
43
- fontSize: string;
44
- fontWeight: number;
45
- lineHeight: string;
46
- iconWidth: string;
47
- iconHeight: string;
48
- iconSpacing: string;
49
- color: string;
50
- content2Color: string;
51
- background: string;
52
- backgroundHover: string;
53
- backgroundPressed: string;
54
- backgroundActive: string;
55
- borderColor: string;
56
- borderColorHover: string;
57
- borderColorActive: string;
58
- borderWidth: string;
59
- borderRadius: string;
60
- shadow: string;
61
- shadowPressed: string;
62
- };
63
- export declare type ButtonVariantTokens = {
64
- [variant in ButtonVariants]: Partial<ButtonTokens>;
65
- };
@@ -1,5 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- });
5
- //# sourceMappingURL=Button.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.types.js","sourceRoot":"../src/","sources":["components/Button/Button.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ComponentProps, ShorthandProps } from '@fluentui/react-utilities';\nimport { ObjectShorthandProps } from '@fluentui/react-utilities';\n\nexport type ButtonProps = ComponentProps &\n React.ButtonHTMLAttributes<HTMLElement> & {\n /**\n * Shorthand icon. A shorthand prop can be a literal, object, or\n * JSX. The `children` prop of the object can be a render function,\n * taking in the original slot component and props.\n */\n icon?: ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;\n\n // TODO: children needs a new typing to handle render functions along with hook updates for children functionality\n // children?: ???;\n\n // /** A button can appear circular. */\n // circular?: boolean;\n\n /** A button can show that it cannot be interacted with. */\n disabled?: boolean;\n\n // /**\n // eslint-disable-next-line @fluentui/max-len\n // * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it is\n // * important to keep a consistent tab order for screen reader and keyboard users.\n // * @defaultvalue false\n // */\n // disabledFocusable?: boolean;\n\n // /** A button can fill the width of its container. */\n // block?: boolean;\n\n /** A button can contain only an icon. */\n iconOnly?: boolean;\n\n /** An icon button can format its icon to appear before or after its content. */\n iconPosition?: 'before' | 'after';\n\n // /** A button can show a loading indicator. */\n // loading?: boolean;\n\n /** A button can emphasize that it represents the primary action. */\n primary?: boolean;\n\n // /** A button can blend into its background to become less emphasized. */\n // subtle?: boolean;\n\n // /** A button can have no background styling and just be emphasized through its content styling. */\n // transparent?: boolean;\n\n /** A button can be sized. */\n size?: 'small' | 'large';\n };\n\n/**\n * {@docCategory Button}\n */\nexport interface ButtonState extends ButtonProps {\n ref: React.RefObject<HTMLButtonElement>;\n\n icon?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;\n children?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;\n}\n\nexport type ButtonStyleSelectors = {\n disabled?: boolean;\n iconOnly?: boolean;\n primary?: boolean;\n size?: string;\n};\n\nexport type ButtonVariants =\n | 'base'\n | 'disabled'\n | 'iconOnly'\n | 'primary'\n | 'small'\n | 'large'\n // TODO: get rid of these combinations, use individual variants in matchers\n | 'primaryDisabled'\n | 'iconOnlySmall'\n | 'iconOnlyLarge';\n\nexport type ButtonTokens = {\n height: string;\n paddingX: string;\n paddingY: string;\n minWidth: string;\n maxWidth: string;\n\n fontSize: string;\n fontWeight: number;\n lineHeight: string;\n\n iconWidth: string;\n iconHeight: string;\n iconSpacing: string;\n\n color: string;\n content2Color: string;\n\n background: string;\n backgroundHover: string;\n backgroundPressed: string;\n backgroundActive: string;\n\n borderColor: string;\n borderColorHover: string;\n borderColorActive: string;\n borderWidth: string;\n borderRadius: string;\n\n shadow: string;\n shadowPressed: string;\n};\n\nexport type ButtonVariantTokens = {\n [variant in ButtonVariants]: Partial<ButtonTokens>;\n};\n"]}
@@ -1,6 +0,0 @@
1
- export * from './Button.types';
2
- export * from './Button';
3
- export * from './renderButton';
4
- export * from './useButton';
5
- export { useButtonStyles } from './useButtonStyles';
6
- export * from './useButtonState';
@@ -1,10 +0,0 @@
1
- define(["require", "exports", "tslib", "./Button", "./renderButton", "./useButton", "./useButtonStyles", "./useButtonState"], function (require, exports, tslib_1, Button_1, renderButton_1, useButton_1, useButtonStyles_1, useButtonState_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(Button_1, exports);
5
- tslib_1.__exportStar(renderButton_1, exports);
6
- tslib_1.__exportStar(useButton_1, exports);
7
- exports.useButtonStyles = useButtonStyles_1.useButtonStyles;
8
- tslib_1.__exportStar(useButtonState_1, exports);
9
- });
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Button/index.ts"],"names":[],"mappings":";;;IACA,wCAAyB;IACzB,8CAA+B;IAC/B,2CAA4B;IACnB,4CAAA,eAAe,CAAA;IACxB,gDAAiC","sourcesContent":["export * from './Button.types';\nexport * from './Button';\nexport * from './renderButton';\nexport * from './useButton';\nexport { useButtonStyles } from './useButtonStyles';\nexport * from './useButtonState';\n"]}
@@ -1,5 +0,0 @@
1
- import { ButtonState } from './Button.types';
2
- /**
3
- * Define the render function. Given the state of a button, renders it.
4
- */
5
- export declare const renderButton: (state: ButtonState) => JSX.Element;
@@ -1,16 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "./useButton"], function (require, exports, tslib_1, React, react_utilities_1, useButton_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * Define the render function. Given the state of a button, renders it.
6
- */
7
- exports.renderButton = function (state) {
8
- var _a = react_utilities_1.getSlots(state, useButton_1.buttonShorthandProps), slots = _a.slots, slotProps = _a.slotProps;
9
- var /*loading,*/ iconPosition = state.iconPosition, iconOnly = state.iconOnly;
10
- return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
11
- iconPosition !== 'after' && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)),
12
- !iconOnly && React.createElement(slots.children, tslib_1.__assign({}, slotProps.children)),
13
- iconPosition === 'after' && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon))));
14
- };
15
- });
16
- //# sourceMappingURL=renderButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderButton.js","sourceRoot":"../src/","sources":["components/Button/renderButton.tsx"],"names":[],"mappings":";;;IAKA;;OAEG;IACU,QAAA,YAAY,GAAG,UAAC,KAAkB;QACvC,IAAA,wEAA4D,EAA1D,gBAAK,EAAE,wBAAmD,CAAC;QAC9C,IAAb,YAAY,CAAC,iCAAY,EAAE,yBAAQ,CAAW;QAEtD,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAE3B,YAAY,KAAK,OAAO,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;YAC9D,CAAC,QAAQ,IAAI,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI;YACvD,YAAY,KAAK,OAAO,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACpD,CACd,CAAC;IACJ,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { ButtonState } from './Button.types';\nimport { buttonShorthandProps } from './useButton';\n\n/**\n * Define the render function. Given the state of a button, renders it.\n */\nexport const renderButton = (state: ButtonState) => {\n const { slots, slotProps } = getSlots(state, buttonShorthandProps);\n const { /*loading,*/ iconPosition, iconOnly } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {/*{loading && <slots.loader {...slotProps.loader} />}*/}\n {iconPosition !== 'after' && <slots.icon {...slotProps.icon} />}\n {!iconOnly && <slots.children {...slotProps.children} />}\n {iconPosition === 'after' && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"]}
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import { ButtonProps, ButtonState } from './Button.types';
3
- /**
4
- * Consts listing which props are shorthand props.
5
- */
6
- export declare const buttonShorthandProps: string[];
7
- /**
8
- * Given user props, returns state and render function for a Button.
9
- */
10
- export declare const useButton: (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps | undefined) => ButtonState;
@@ -1,28 +0,0 @@
1
- define(["require", "exports", "react", "@fluentui/react-utilities", "./useButtonState"], function (require, exports, React, react_utilities_1, useButtonState_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * Consts listing which props are shorthand props.
6
- */
7
- exports.buttonShorthandProps = ['icon', 'children'];
8
- var mergeProps = react_utilities_1.makeMergeProps({ deepMerge: exports.buttonShorthandProps });
9
- /**
10
- * Given user props, returns state and render function for a Button.
11
- */
12
- exports.useButton = function (props, ref, defaultProps) {
13
- // Ensure that the `ref` prop can be used by other things (like useFocusRects) to refer to the root.
14
- // NOTE: We are assuming refs should not mutate to undefined. Either they are passed or not.
15
- // eslint-disable-next-line react-hooks/rules-of-hooks
16
- var resolvedRef = ref || React.useRef();
17
- var state = mergeProps({
18
- ref: resolvedRef,
19
- as: 'button',
20
- icon: { as: 'span' },
21
- content: { as: 'span', children: props.children },
22
- loader: { as: 'span' },
23
- }, defaultProps, react_utilities_1.resolveShorthandProps(props, exports.buttonShorthandProps));
24
- useButtonState_1.useButtonState(state);
25
- return state;
26
- };
27
- });
28
- //# sourceMappingURL=useButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useButton.js","sourceRoot":"../src/","sources":["components/Button/useButton.ts"],"names":[],"mappings":";;;IAKA;;OAEG;IACU,QAAA,oBAAoB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAEzD,IAAM,UAAU,GAAG,gCAAc,CAAc,EAAE,SAAS,EAAE,4BAAoB,EAAE,CAAC,CAAC;IAEpF;;OAEG;IACU,QAAA,SAAS,GAAG,UAAC,KAAkB,EAAE,GAA2B,EAAE,YAA0B;QACnG,oGAAoG;QACpG,4FAA4F;QAC5F,sDAAsD;QACtD,IAAM,WAAW,GAAG,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAC1C,IAAM,KAAK,GAAG,UAAU,CACtB;YACE,GAAG,EAAE,WAAW;YAChB,EAAE,EAAE,QAAQ;YACZ,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YACpB,OAAO,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;YACjD,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;SACvB,EACD,YAAY,EACZ,uCAAqB,CAAC,KAAK,EAAE,4BAAoB,CAAC,CACnD,CAAC;QAEF,+BAAc,CAAC,KAAK,CAAC,CAAC;QAEtB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { ButtonProps, ButtonState } from './Button.types';\nimport { useButtonState } from './useButtonState';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const buttonShorthandProps = ['icon', 'children'];\n\nconst mergeProps = makeMergeProps<ButtonState>({ deepMerge: buttonShorthandProps });\n\n/**\n * Given user props, returns state and render function for a Button.\n */\nexport const useButton = (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps): ButtonState => {\n // Ensure that the `ref` prop can be used by other things (like useFocusRects) to refer to the root.\n // NOTE: We are assuming refs should not mutate to undefined. Either they are passed or not.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const resolvedRef = ref || React.useRef();\n const state = mergeProps(\n {\n ref: resolvedRef,\n as: 'button',\n icon: { as: 'span' },\n content: { as: 'span', children: props.children },\n loader: { as: 'span' },\n },\n defaultProps,\n resolveShorthandProps(props, buttonShorthandProps),\n );\n\n useButtonState(state);\n\n return state;\n};\n"]}
@@ -1,6 +0,0 @@
1
- import { ButtonState } from './Button.types';
2
- /**
3
- * The useButton hook processes the Button draft state.
4
- * @param draftState - Button draft state to mutate.
5
- */
6
- export declare const useButtonState: (draftState: ButtonState) => void;
@@ -1,48 +0,0 @@
1
- define(["require", "exports", "@fluentui/keyboard-key"], function (require, exports, keyboard_key_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * The useButton hook processes the Button draft state.
6
- * @param draftState - Button draft state to mutate.
7
- */
8
- exports.useButtonState = function (draftState) {
9
- if (draftState.as !== 'button') {
10
- draftState.role = 'button';
11
- if (draftState.as !== 'a') {
12
- var onClickCallback_1 = draftState.onClick, onKeyDownCallback_1 = draftState.onKeyDown;
13
- draftState.tabIndex = 0;
14
- draftState.onKeyDown = function (ev) {
15
- if (onKeyDownCallback_1) {
16
- onKeyDownCallback_1(ev);
17
- }
18
- var keyCode = keyboard_key_1.getCode(ev);
19
- if (!ev.defaultPrevented && onClickCallback_1 && (keyCode === keyboard_key_1.EnterKey || keyCode === keyboard_key_1.SpacebarKey)) {
20
- // Translate the keydown enter/space to a click.
21
- ev.preventDefault();
22
- ev.stopPropagation();
23
- ev.target.click();
24
- }
25
- };
26
- }
27
- }
28
- // Disallow click and keyboard events when component is disabled and eat events when disabledFocusable is set to true.
29
- var disabled = draftState.disabled, /* disabledFocusable, */ onKeyDown = draftState.onKeyDown;
30
- if (disabled) {
31
- draftState.onClick = undefined;
32
- }
33
- draftState.onKeyDown = function (ev) {
34
- var _a;
35
- var keyCode = keyboard_key_1.getCode(ev);
36
- if (disabled && (keyCode === keyboard_key_1.EnterKey || keyCode === keyboard_key_1.SpacebarKey)) {
37
- ev.preventDefault();
38
- ev.stopPropagation();
39
- }
40
- else {
41
- (_a = onKeyDown) === null || _a === void 0 ? void 0 : _a(ev);
42
- }
43
- };
44
- draftState['aria-disabled'] = disabled /* || disabledFocusable*/;
45
- draftState.disabled = draftState.as === 'button' ? disabled /* && !disabledFocusable */ : undefined;
46
- };
47
- });
48
- //# sourceMappingURL=useButtonState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useButtonState.js","sourceRoot":"../src/","sources":["components/Button/useButtonState.ts"],"names":[],"mappings":";;;IAIA;;;OAGG;IACU,QAAA,cAAc,GAAG,UAAC,UAAuB;QACpD,IAAI,UAAU,CAAC,EAAE,KAAK,QAAQ,EAAE;YAC9B,UAAU,CAAC,IAAI,GAAG,QAAQ,CAAC;YAE3B,IAAI,UAAU,CAAC,EAAE,KAAK,GAAG,EAAE;gBACjB,IAAA,sCAAwB,EAAE,0CAA4B,CAAgB;gBAE9E,UAAU,CAAC,QAAQ,GAAG,CAAC,CAAC;gBAExB,UAAU,CAAC,SAAS,GAAG,UAAC,EAAoC;oBAC1D,IAAI,mBAAiB,EAAE;wBACrB,mBAAiB,CAAC,EAAE,CAAC,CAAC;qBACvB;oBAED,IAAM,OAAO,GAAG,sBAAO,CAAC,EAAE,CAAC,CAAC;oBAC5B,IAAI,CAAC,EAAE,CAAC,gBAAgB,IAAI,iBAAe,IAAI,CAAC,OAAO,KAAK,uBAAQ,IAAI,OAAO,KAAK,0BAAW,CAAC,EAAE;wBAChG,gDAAgD;wBAChD,EAAE,CAAC,cAAc,EAAE,CAAC;wBACpB,EAAE,CAAC,eAAe,EAAE,CAAC;wBAEpB,EAAE,CAAC,MAAsB,CAAC,KAAK,EAAE,CAAC;qBACpC;gBACH,CAAC,CAAC;aACH;SACF;QAED,sHAAsH;QAC9G,IAAA,8BAAQ,EAAE,wBAAwB,CAAC,gCAAS,CAAgB;QACpE,IAAI,QAAQ,EAAE;YACZ,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC;SAChC;QACD,UAAU,CAAC,SAAS,GAAG,UAAC,EAAoC;;YAC1D,IAAM,OAAO,GAAG,sBAAO,CAAC,EAAE,CAAC,CAAC;YAC5B,IAAI,QAAQ,IAAI,CAAC,OAAO,KAAK,uBAAQ,IAAI,OAAO,KAAK,0BAAW,CAAC,EAAE;gBACjE,EAAE,CAAC,cAAc,EAAE,CAAC;gBACpB,EAAE,CAAC,eAAe,EAAE,CAAC;aACtB;iBAAM;gBACL,MAAA,SAAS,0CAAG,EAAE,EAAE;aACjB;QACH,CAAC,CAAC;QAEF,UAAU,CAAC,eAAe,CAAC,GAAG,QAAQ,CAAC,yBAAyB,CAAC;QACjE,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,CAAC,SAAS,CAAC;IACtG,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { getCode, EnterKey, SpacebarKey } from '@fluentui/keyboard-key';\nimport { ButtonState } from './Button.types';\n\n/**\n * The useButton hook processes the Button draft state.\n * @param draftState - Button draft state to mutate.\n */\nexport const useButtonState = (draftState: ButtonState) => {\n if (draftState.as !== 'button') {\n draftState.role = 'button';\n\n if (draftState.as !== 'a') {\n const { onClick: onClickCallback, onKeyDown: onKeyDownCallback } = draftState;\n\n draftState.tabIndex = 0;\n\n draftState.onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n if (onKeyDownCallback) {\n onKeyDownCallback(ev);\n }\n\n const keyCode = getCode(ev);\n if (!ev.defaultPrevented && onClickCallback && (keyCode === EnterKey || keyCode === SpacebarKey)) {\n // Translate the keydown enter/space to a click.\n ev.preventDefault();\n ev.stopPropagation();\n\n (ev.target as HTMLElement).click();\n }\n };\n }\n }\n\n // Disallow click and keyboard events when component is disabled and eat events when disabledFocusable is set to true.\n const { disabled, /* disabledFocusable, */ onKeyDown } = draftState;\n if (disabled) {\n draftState.onClick = undefined;\n }\n draftState.onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n const keyCode = getCode(ev);\n if (disabled && (keyCode === EnterKey || keyCode === SpacebarKey)) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onKeyDown?.(ev);\n }\n };\n\n draftState['aria-disabled'] = disabled /* || disabledFocusable*/;\n draftState.disabled = draftState.as === 'button' ? disabled /* && !disabledFocusable */ : undefined;\n};\n"]}
@@ -1,4 +0,0 @@
1
- import { ButtonState, ButtonStyleSelectors, ButtonVariantTokens } from './Button.types';
2
- import { Theme } from '@fluentui/react-theme';
3
- export declare const makeButtonTokens: (theme: Theme) => ButtonVariantTokens;
4
- export declare const useButtonStyles: (state: ButtonState, selectors: ButtonStyleSelectors) => void;