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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC","sourcesContent":["export * from './Button';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.7.1"
8
+ "packageVersion": "7.18.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var tslib_1 = /*#__PURE__*/require("tslib");
8
+
4
9
  tslib_1.__exportStar(require("./components/Button/index"), exports);
5
10
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"../src/","sources":["Button.tsx"],"names":[],"mappings":";;;AAAA,oEAA0C","sourcesContent":["export * from './components/Button/index';\n"]}
1
+ {"version":3,"sources":["../src/Button.tsx"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
@@ -0,0 +1 @@
1
+ export * from './components/CompoundButton/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/CompoundButton/index"), exports);
10
+ //# sourceMappingURL=CompoundButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/CompoundButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
@@ -0,0 +1 @@
1
+ export * from './components/MenuButton/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/MenuButton/index"), exports);
10
+ //# sourceMappingURL=MenuButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/MenuButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
@@ -0,0 +1 @@
1
+ export * from './components/SplitButton/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/SplitButton/index"), exports);
10
+ //# sourceMappingURL=SplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SplitButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
@@ -0,0 +1 @@
1
+ export * from './components/ToggleButton/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/ToggleButton/index"), exports);
10
+ //# sourceMappingURL=ToggleButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ToggleButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
@@ -1,2 +1,4 @@
1
- import { IsConformantOptions } from '@fluentui/react-conformance';
2
- export declare function isConformant(testInfo: Omit<IsConformantOptions, 'componentPath'>): void;
1
+ import type { IsConformantOptions } from '@fluentui/react-conformance';
2
+ export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
3
+ componentPath?: string;
4
+ }): void;
@@ -1,13 +1,24 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var react_conformance_1 = require("@fluentui/react-conformance");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isConformant = void 0;
7
+
8
+ var react_conformance_1 = /*#__PURE__*/require("@fluentui/react-conformance");
9
+
10
+ var react_conformance_make_styles_1 = /*#__PURE__*/require("@fluentui/react-conformance-make-styles");
11
+
4
12
  function isConformant(testInfo) {
5
- var defaultOptions = {
6
- asPropHandlesRef: true,
7
- componentPath: module.parent.filename.replace('.test', ''),
8
- disabledTests: ['has-docblock', 'kebab-aria-attributes'],
9
- };
10
- react_conformance_1.isConformant(defaultOptions, testInfo);
13
+ var defaultOptions = {
14
+ asPropHandlesRef: true,
15
+ componentPath: module.parent.filename.replace('.test', ''),
16
+ disabledTests: ['has-docblock', 'kebab-aria-attributes'],
17
+ extraTests: react_conformance_make_styles_1.default,
18
+ skipAsPropTests: true
19
+ };
20
+ react_conformance_1.isConformant(defaultOptions, testInfo);
11
21
  }
22
+
12
23
  exports.isConformant = isConformant;
13
24
  //# sourceMappingURL=isConformant.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isConformant.js","sourceRoot":"../src/","sources":["common/isConformant.ts"],"names":[],"mappings":";;AAAA,iEAAoG;AAEpG,SAAgB,YAAY,CAAC,QAAoD;IAC/E,IAAM,cAAc,GAAG;QACrB,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,MAAO,CAAC,MAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QAC5D,aAAa,EAAE,CAAC,cAAc,EAAE,uBAAuB,CAAC;KACzD,CAAC;IAEF,gCAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC;AARD,oCAQC","sourcesContent":["import { isConformant as baseIsConformant, IsConformantOptions } from '@fluentui/react-conformance';\n\nexport function isConformant(testInfo: Omit<IsConformantOptions, 'componentPath'>) {\n const defaultOptions = {\n asPropHandlesRef: true,\n componentPath: module!.parent!.filename.replace('.test', ''),\n disabledTests: ['has-docblock', 'kebab-aria-attributes'],\n };\n\n baseIsConformant(defaultOptions, testInfo);\n}\n"]}
1
+ {"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAEA,IAAA,+BAAA,gBAAA,OAAA,CAAA,yCAAA,CAAA;;AAEA,SAAgB,YAAhB,CACE,QADF,EAC2F;AAEzF,MAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,aAAa,EAAE,CAAC,cAAD,EAAiB,uBAAjB,CAH4C;AAI3D,IAAA,UAAU,EAAE,+BAAA,CAAA,OAJ+C;AAK3D,IAAA,eAAe,EAAE;AAL0C,GAA7D;AAQA,EAAA,mBAAA,CAAA,YAAA,CAAiB,cAAjB,EAAiC,QAAjC;AACD;;AAZD,OAAA,CAAA,YAAA,GAAA,YAAA","sourceRoot":""}
@@ -1,13 +1,6 @@
1
- import * as React from 'react';
1
+ import type { ButtonProps } from './Button.types';
2
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
2
3
  /**
3
- * Define a styled Button, using the `useButton` hook.
4
- * {@docCategory Button}
4
+ * Buttons give people a way to trigger an action.
5
5
  */
6
- export declare const Button: React.ForwardRefExoticComponent<import("@fluentui/react-utilities").ComponentProps & React.ButtonHTMLAttributes<HTMLElement> & {
7
- icon?: import("@fluentui/react-utilities").ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
8
- disabled?: boolean | undefined;
9
- iconOnly?: boolean | undefined;
10
- iconPosition?: "after" | "before" | undefined;
11
- primary?: boolean | undefined;
12
- size?: "small" | "large" | undefined;
13
- } & React.RefAttributes<HTMLElement>>;
6
+ export declare const Button: ForwardRefComponent<ButtonProps>;
@@ -1,26 +1,26 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var React = require("react");
4
- var useButton_1 = require("./useButton");
5
- var renderButton_1 = require("./renderButton");
6
- var useButtonStyles_1 = require("./useButtonStyles");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Button = void 0;
7
+
8
+ var React = /*#__PURE__*/require("react");
9
+
10
+ var renderButton_1 = /*#__PURE__*/require("./renderButton");
11
+
12
+ var useButton_1 = /*#__PURE__*/require("./useButton");
13
+
14
+ var useButtonStyles_1 = /*#__PURE__*/require("./useButtonStyles");
7
15
  /**
8
- * Define a styled Button, using the `useButton` hook.
9
- * {@docCategory Button}
16
+ * Buttons give people a way to trigger an action.
10
17
  */
11
- exports.Button = React.forwardRef(function (props, ref) {
12
- var _a, _b;
13
- var state = useButton_1.useButton(props, ref);
14
- var receivedChildren = !!((_a = state.children) === null || _a === void 0 ? void 0 : _a.children);
15
- var receivedIcon = !!((_b = state.icon) === null || _b === void 0 ? void 0 : _b.children);
16
- var styleSelectors = {
17
- disabled: state.disabled,
18
- primary: state.primary,
19
- iconOnly: receivedIcon && !receivedChildren,
20
- size: state.size,
21
- };
22
- useButtonStyles_1.useButtonStyles(state, styleSelectors);
23
- return renderButton_1.renderButton(state);
18
+
19
+
20
+ exports.Button = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
+ var state = useButton_1.useButton(props, ref);
22
+ useButtonStyles_1.useButtonStyles(state);
23
+ return renderButton_1.renderButton(state); // Casting is required due to lack of distributive union to support unions on @types/react
24
24
  });
25
25
  exports.Button.displayName = 'Button';
26
26
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"../src/","sources":["components/Button/Button.tsx"],"names":[],"mappings":";;AAAA,6BAA+B;AAC/B,yCAAwC;AAExC,+CAA8C;AAC9C,qDAAoD;AAEpD;;;GAGG;AACU,QAAA,MAAM,GAAG,KAAK,CAAC,UAAU,CAA2B,UAAC,KAAK,EAAE,GAAG;;IAC1E,IAAM,KAAK,GAAG,qBAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEpC,IAAM,gBAAgB,GAAG,CAAC,QAAC,KAAK,CAAC,QAAQ,0CAAE,QAAQ,CAAA,CAAC;IACpD,IAAM,YAAY,GAAG,CAAC,QAAC,KAAK,CAAC,IAAI,0CAAE,QAAQ,CAAA,CAAC;IAE5C,IAAM,cAAc,GAAyB;QAC3C,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,YAAY,IAAI,CAAC,gBAAgB;QAC3C,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;IAEF,iCAAe,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAEvC,OAAO,2BAAY,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC;AAEH,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
+ {"version":3,"sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,IAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,MAAA,gBAA2C,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AAClF,MAAM,KAAK,GAAG,WAAA,CAAA,SAAA,CAAU,KAAV,EAAiB,GAAjB,CAAd;AAEA,EAAA,iBAAA,CAAA,eAAA,CAAgB,KAAhB;AAEA,SAAO,cAAA,CAAA,YAAA,CAAa,KAAb,CAAP,CALkF,CAMlF;AACD,CAPuD,CAA3C;AASb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourceRoot":""}
@@ -1,65 +1,62 @@
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> & {
1
+ import { ARIAButtonShorthandProps } from '@fluentui/react-aria';
2
+ import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
3
+ export declare type ButtonSlots = {
5
4
  /**
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.
5
+ * Root of the component that renders as either a <button> tag.
9
6
  */
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;
7
+ root: ARIAButtonShorthandProps;
8
+ /**
9
+ * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.
10
+ */
11
+ icon?: IntrinsicShorthandProps<'span'>;
35
12
  };
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;
13
+ export declare type ButtonCommons = {
14
+ /**
15
+ * A button can have its content and borders styled for greater emphasis or to be subtle.
16
+ * - 'primary': Emphasizes the button as a primary action.
17
+ * - 'outline': Removes background styling.
18
+ * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
19
+ * - 'transparent': Removes background and border styling.
20
+ */
21
+ appearance?: 'primary' | 'outline' | 'subtle' | 'transparent';
22
+ /**
23
+ * A button can fill the width of its container.
24
+ * @default false
25
+ */
26
+ block: boolean;
27
+ /**
28
+ * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it
29
+ * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this
30
+ * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.
31
+ * @default false
32
+ */
33
+ disabledFocusable: boolean;
34
+ /**
35
+ * A button can show that it cannot be interacted with.
36
+ * @default false
37
+ */
38
+ disabled: boolean;
39
+ /**
40
+ * A button can format its icon to appear before or after its content.
41
+ * @default 'before'
42
+ */
43
+ iconPosition: 'before' | 'after';
44
+ /**
45
+ * A button can be rounded, circular, or square.
46
+ * @default 'rounded'
47
+ */
48
+ shape: 'rounded' | 'circular' | 'square';
49
+ /**
50
+ * A button supports different sizes.
51
+ * @default 'medium'
52
+ */
53
+ size: 'small' | 'medium' | 'large';
62
54
  };
63
- export declare type ButtonVariantTokens = {
64
- [variant in ButtonVariants]: Partial<ButtonTokens>;
55
+ export declare type ButtonProps = ComponentProps<ButtonSlots> & Partial<ButtonCommons>;
56
+ export declare type ButtonState = ComponentState<ButtonSlots> & ButtonCommons & {
57
+ /**
58
+ * A button can contain only an icon.
59
+ * @default false
60
+ */
61
+ iconOnly: boolean;
65
62
  };
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  //# sourceMappingURL=Button.types.js.map
@@ -1 +1 @@
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
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
@@ -1,6 +1,5 @@
1
- export * from './Button.types';
2
1
  export * from './Button';
2
+ export * from './Button.types';
3
3
  export * from './renderButton';
4
4
  export * from './useButton';
5
5
  export { useButtonStyles } from './useButtonStyles';
6
- export * from './useButtonState';
@@ -1,10 +1,26 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useButtonStyles = void 0;
7
+
8
+ var tslib_1 = /*#__PURE__*/require("tslib");
9
+
4
10
  tslib_1.__exportStar(require("./Button"), exports);
11
+
12
+ tslib_1.__exportStar(require("./Button.types"), exports);
13
+
5
14
  tslib_1.__exportStar(require("./renderButton"), exports);
15
+
6
16
  tslib_1.__exportStar(require("./useButton"), exports);
7
- var useButtonStyles_1 = require("./useButtonStyles");
8
- exports.useButtonStyles = useButtonStyles_1.useButtonStyles;
9
- tslib_1.__exportStar(require("./useButtonState"), exports);
17
+
18
+ var useButtonStyles_1 = /*#__PURE__*/require("./useButtonStyles");
19
+
20
+ Object.defineProperty(exports, "useButtonStyles", {
21
+ enumerable: true,
22
+ get: function () {
23
+ return useButtonStyles_1.useButtonStyles;
24
+ }
25
+ });
10
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Button/index.ts"],"names":[],"mappings":";;;AACA,mDAAyB;AACzB,yDAA+B;AAC/B,sDAA4B;AAC5B,qDAAoD;AAA3C,4CAAA,eAAe,CAAA;AACxB,2DAAiC","sourcesContent":["export * from './Button.types';\nexport * from './Button';\nexport * from './renderButton';\nexport * from './useButton';\nexport { useButtonStyles } from './useButtonStyles';\nexport * from './useButtonState';\n"]}
1
+ {"version":3,"sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,iBAAA,CAAA,eAAA;AAAe;AAAf,CAAA","sourceRoot":""}
@@ -1,5 +1,5 @@
1
- import { ButtonState } from './Button.types';
1
+ import type { ButtonState } from './Button.types';
2
2
  /**
3
- * Define the render function. Given the state of a button, renders it.
3
+ * Renders a Button component by passing the state defined props to the appropriate slots.
4
4
  */
5
5
  export declare const renderButton: (state: ButtonState) => JSX.Element;
@@ -1,18 +1,29 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- var React = require("react");
5
- var react_utilities_1 = require("@fluentui/react-utilities");
6
- var useButton_1 = require("./useButton");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renderButton = void 0;
7
+
8
+ var tslib_1 = /*#__PURE__*/require("tslib");
9
+
10
+ var React = /*#__PURE__*/require("react");
11
+
12
+ var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
7
13
  /**
8
- * Define the render function. Given the state of a button, renders it.
14
+ * Renders a Button component by passing the state defined props to the appropriate slots.
9
15
  */
10
- exports.renderButton = function (state) {
11
- var _a = react_utilities_1.getSlots(state, useButton_1.buttonShorthandProps), slots = _a.slots, slotProps = _a.slotProps;
12
- var /*loading,*/ iconPosition = state.iconPosition, iconOnly = state.iconOnly;
13
- return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
14
- iconPosition !== 'after' && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)),
15
- !iconOnly && React.createElement(slots.children, tslib_1.__assign({}, slotProps.children)),
16
- iconPosition === 'after' && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon))));
16
+
17
+
18
+ var renderButton = function (state) {
19
+ var _a = react_utilities_1.getSlots(state, ['root', 'icon']),
20
+ slots = _a.slots,
21
+ slotProps = _a.slotProps;
22
+
23
+ var iconOnly = state.iconOnly,
24
+ iconPosition = state.iconPosition;
25
+ return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), iconPosition !== 'after' && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)), !iconOnly && state.root.children, iconPosition === 'after' && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)));
17
26
  };
27
+
28
+ exports.renderButton = renderButton;
18
29
  //# sourceMappingURL=renderButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderButton.js","sourceRoot":"../src/","sources":["components/Button/renderButton.tsx"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,6DAAqD;AAErD,yCAAmD;AAEnD;;GAEG;AACU,QAAA,YAAY,GAAG,UAAC,KAAkB;IACvC,IAAA,wEAA4D,EAA1D,gBAAK,EAAE,wBAAmD,CAAC;IAC9C,IAAb,YAAY,CAAC,iCAAY,EAAE,yBAAQ,CAAW;IAEtD,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;QAE3B,YAAY,KAAK,OAAO,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;QAC9D,CAAC,QAAQ,IAAI,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI;QACvD,YAAY,KAAK,OAAO,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACpD,CACd,CAAC;AACJ,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
+ {"version":3,"sources":["../../../src/components/Button/renderButton.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,YAAY,GAAG,UAAC,KAAD,EAAmB;AACvC,MAAA,EAAA,GAAuB,iBAAA,CAAA,QAAA,CAAsB,KAAtB,EAA6B,CAAC,MAAD,EAAS,MAAT,CAA7B,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAAmB,KAAK,CAAxB,QAAR;AAAA,MAAU,YAAY,GAAK,KAAK,CAAV,YAAtB;AAER,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAD/B,EAEG,CAAC,QAAD,IAAa,KAAK,CAAC,IAAN,CAAW,QAF3B,EAGG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAH/B,CADF;AAOD,CAXM;;AAAM,OAAA,CAAA,YAAA,GAAY,YAAZ","sourceRoot":""}
@@ -1,10 +1,8 @@
1
1
  import * as React from 'react';
2
- import { ButtonProps, ButtonState } from './Button.types';
2
+ import type { ButtonProps, ButtonState } from './Button.types';
3
3
  /**
4
- * Consts listing which props are shorthand props.
4
+ * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
5
+ * @param props - User provided props to the Button component.
6
+ * @param ref - User provided ref to be passed to the Button component.
5
7
  */
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;
8
+ export declare const useButton: (props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) => ButtonState;
@@ -1,29 +1,64 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var React = require("react");
4
- var react_utilities_1 = require("@fluentui/react-utilities");
5
- var useButtonState_1 = require("./useButtonState");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useButton = void 0;
7
+
8
+ var react_aria_1 = /*#__PURE__*/require("@fluentui/react-aria");
9
+
10
+ var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
6
11
  /**
7
- * Consts listing which props are shorthand props.
12
+ * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
13
+ * @param props - User provided props to the Button component.
14
+ * @param ref - User provided ref to be passed to the Button component.
8
15
  */
9
- exports.buttonShorthandProps = ['icon', 'children'];
10
- var mergeProps = react_utilities_1.makeMergeProps({ deepMerge: exports.buttonShorthandProps });
11
- /**
12
- * Given user props, returns state and render function for a Button.
13
- */
14
- exports.useButton = function (props, ref, defaultProps) {
15
- // Ensure that the `ref` prop can be used by other things (like useFocusRects) to refer to the root.
16
- // NOTE: We are assuming refs should not mutate to undefined. Either they are passed or not.
17
- // eslint-disable-next-line react-hooks/rules-of-hooks
18
- var resolvedRef = ref || React.useRef();
19
- var state = mergeProps({
20
- ref: resolvedRef,
21
- as: 'button',
22
- icon: { as: 'span' },
23
- content: { as: 'span', children: props.children },
24
- loader: { as: 'span' },
25
- }, defaultProps, react_utilities_1.resolveShorthandProps(props, exports.buttonShorthandProps));
26
- useButtonState_1.useButtonState(state);
27
- return state;
16
+
17
+
18
+ var useButton = function (props, ref) {
19
+ var appearance = props.appearance,
20
+ as = props.as,
21
+ _a = props.block,
22
+ block = _a === void 0 ? false : _a,
23
+ _b = props.disabled,
24
+ disabled = _b === void 0 ? false : _b,
25
+ _c = props.disabledFocusable,
26
+ disabledFocusable = _c === void 0 ? false : _c,
27
+ icon = props.icon,
28
+ _d = props.iconPosition,
29
+ iconPosition = _d === void 0 ? 'before' : _d,
30
+ _e = props.shape,
31
+ shape = _e === void 0 ? 'rounded' : _e,
32
+ _f = props.size,
33
+ size = _f === void 0 ? 'medium' : _f;
34
+ var iconShorthand = react_utilities_1.resolveShorthand(icon);
35
+ return {
36
+ // Props passed at the top-level
37
+ appearance: appearance,
38
+ block: block,
39
+ disabled: disabled,
40
+ disabledFocusable: disabledFocusable,
41
+ iconPosition: iconPosition,
42
+ shape: shape,
43
+ size: size,
44
+ // State calculated from a set of props
45
+ iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !props.children),
46
+ // Slots definition
47
+ components: {
48
+ root: 'button',
49
+ icon: 'span'
50
+ },
51
+ root: react_utilities_1.getNativeElementProps(as || 'button', react_aria_1.useARIAButton(props, {
52
+ required: true,
53
+ defaultProps: {
54
+ // useARIAButton isn't working with React.Ref<HTMLButtonElement | HTMLAnchorElement>
55
+ ref: ref,
56
+ type: 'button'
57
+ }
58
+ })),
59
+ icon: iconShorthand
60
+ };
28
61
  };
62
+
63
+ exports.useButton = useButton;
29
64
  //# sourceMappingURL=useButton.js.map