@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
package/README.md CHANGED
@@ -2,124 +2,35 @@
2
2
 
3
3
  **Button components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
4
4
 
5
- **WARNING!** These components are still in active development, and the APIs may change before final release.
5
+ The Button component enables users to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation.
6
6
 
7
- To use the Button components:
7
+ ## STATUS: WIP 🚧
8
8
 
9
- ```js
10
- import { Button } from '@fluentui/react-button';
11
-
12
- const App = () => {
13
- return <Button content="hello, world!" />;
14
- };
15
- ```
16
-
17
- ## Migration guide
18
-
19
- The Button has been completely rewritten to be faster, smaller, and easier to customize compared to the version from `office-ui-fabric-react@7`. By default, Buttons now have no opinion about icons, menuing, or split button behavior, which has led to large bundle and performance hits for the most common cases in the past.
20
-
21
- ### Component renames
22
-
23
- Common buttons now all map to `Button`:
24
-
25
- | Old | New |
26
- | ------------------------------------------------ | ------------------------------------------------------------- |
27
- | `<DefaultButton text="Hello, world" />` | `<Button>Hello, world</Button>` |
28
- | `<PrimaryButton text="Hello, world" />` | `<Button primary>Hello, world</Button>` |
29
- | `<IconButton iconProps={{ iconName: 'Add' }} />` | `<Button iconOnly subtle icon={ <Icon iconName="Add" /> } />` |
30
-
31
- ### Toggle buttons
32
-
33
- The `ToggleButton` component is an extension of the `Button` and has been separated out to reduce bundle size and performance overhead. The `ToggleButton` respects a `checked` or `defaultChecked` flag.
34
-
35
- ```jsx
36
- const App = () => {
37
- const [isChecked, setChecked] = React.useState(false);
38
-
39
- return (
40
- <ToggleButton checked={checked} onClick={() => setChecked(!isChecked)}>
41
- {checked ? 'Pause' : 'Play'}
42
- </ToggleButton>
43
- );
44
- };
45
- ```
46
-
47
- ### Menu buttons
48
-
49
- The `MenuButton` component is an extension of the `Button` and has been separated out to reduce bundle size and performance overhead. The `MenuButton` takes in a `menu` prop to provide the menu:
50
-
51
- ```jsx
52
- const App = () => {
53
- const [ isChecked, setChecked ] = React.useState(false);
54
-
55
- return (
56
- <MenuButton
57
- iconOnly
58
- circular
59
- subtle
60
- icon={ <EllipsisIcon /> }
61
- menu={
62
- items: [
63
- { key: 'a', ... }
64
- ]
65
- }
66
- />
67
- );
68
- }
69
- ```
70
-
71
- ### Split menu buttons
72
-
73
- The `SplitButton` is now its own component, instead of being baked into the `Button` component itself. This helps to overall reduce the default `Button` complexity, runtime overhead, and bundle size:
9
+ These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
74
10
 
75
- Before:
76
-
77
- ```jsx
78
- <PrimaryButton split onClick={ () => alert('action')} menuProps={{ items: [ ... ] }} text="Hello, world" />
79
- ```
11
+ ## Usage
80
12
 
81
- After:
13
+ To import Button:
82
14
 
83
- ```jsx
84
- <SplitButton primary onClick={ () => alert('action')} menu={{ items: [ ... ] }} />
15
+ ```js
16
+ import { Button } from '@fluentui/react-button';
85
17
  ```
86
18
 
87
- Additional changes:
88
-
89
- - Now 2 tab targets rather than 1: The action part of the button and the menu part are now separate focus targets. This helps with predictability for users who want to either execute the action or expand the menu. It also helps with accessibility, as we can keep the action with a normal `button` role, and the menu with an `aria-haspopup` attribute, making it more clear for screen readers to differentiate from a typical menu button.
19
+ Once the Button component graduates to a production release, the component will be available at:
90
20
 
91
- ### Slots support
92
-
93
- Buttons now support slots. Slot support replaces `onRender*` and `*Props` props. The `iconProps` is an example of this. Before, you would provide the props directly. Now you can provide JSX, which lets the implementation own prop typing:
94
-
95
- Before:
96
-
97
- ```jsx
98
- <DefaultButton iconProps={{ iconName: 'Add' }}> />
21
+ ```js
22
+ import { Button } from '@fluentui/react-components';
99
23
  ```
100
24
 
101
- After:
25
+ ### Examples
102
26
 
103
27
  ```jsx
104
- <Button icon={<Icon iconName="Add" />} />
28
+ <Button>Text</Button>
29
+ <Button icon={<SVGIcon />} />
30
+ <Button icon={<SVGIcon />}>Text</Button>
31
+ <Button icon={<SVGIcon />} iconPosition="after">Text</Button>
32
+ <Button primary>Text</Button>
33
+ <Button disabled>Text</Button>
34
+ <Button size="small">Text</Button>
35
+ <Button size="large">Text</Button>
105
36
  ```
106
-
107
- This ensures that `Button` components work not just with Fluent UI icons, but with any other icon set.
108
-
109
- ### Additional button modifiers and enums
110
-
111
- These all apply to `Button`, `ToggleButton`, `MenuButton`, and `SplitButton`:
112
- | Modifier | Description |
113
- | ---------- | --------------------------------------------------------------------------------------- |
114
- | `block` | Stretches the button to the container width. |
115
- | `circular` | Make the button rounded on the edges (pill button.) |
116
- | `iconOnly` | Makes the width match the height. Can be combined with circular to make circle buttons. |
117
- | `subtle` | Makes the button inherit the background color. |
118
- | `primary` | Uses the brand color to indicate the button is a primary action. |
119
- | `size` | Controls the size of the button, based on an enum value: `smallest`, `smaller`, `small`, `regular`, `large`, `larger`, `largest`. Defaults to `regular`. |
120
-
121
- ### Styling changes
122
-
123
- - `vertical-align` is now set to `middle` to ensure they align correctly. See https://codesandbox.io/s/align-buttons-middle-6u5nu for an example of why this is important.
124
- - Focus rectangles have been adjusted to be more visible and consistent with our new focus styling approach (note that not everything has been updated to the 2px black border 1px inverted inner.)
125
- - Gaps between elements within the button were changed to margins rather than combo of padding/margin.
@@ -0,0 +1,71 @@
1
+ <!DOCTYPE html>
2
+ <html dir="ltr" lang="en-us">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" user-scalable="no" />
7
+ <title>Fluent UI React Examples</title>
8
+ </head>
9
+
10
+ <body>
11
+ <div id="content"></div>
12
+ <script type="text/javascript">
13
+ // @ts-check
14
+ window.FabricConfig = {
15
+ // Uncommenting this prevents the fontfaces from being registered.
16
+ // Alternatively you can specify a base url which contains the font/icon assets.
17
+ // fontBaseUrl: '',
18
+ // mergeStyles: {
19
+ // injectionMode: 2
20
+ // }
21
+ };
22
+
23
+ var isLocal = ['localhost', '[::]', '127.0.0.1'].indexOf(location.hostname) !== -1;
24
+
25
+ var isDev = getParameterByName('dev') === '1' || !!getParameterByName('strict');
26
+ var minParam = getParameterByName('min');
27
+ var useMinified =
28
+ !isDev && minParam !== '0' && (minParam === '1' || location.pathname === '/fabric-react/master/');
29
+
30
+ function loadScript(n) {
31
+ for (var i = 0; i < n.length; i++) {
32
+ var s = document.createElement('script');
33
+ s.src = n[i];
34
+ s.async = false;
35
+ document.body.appendChild(s);
36
+ }
37
+ }
38
+
39
+ const scripts = [];
40
+
41
+ if (isLocal) {
42
+ scripts.push('./react.development.js');
43
+ scripts.push('./react-dom.development.js');
44
+ } else {
45
+ const reactVersion = isDev ? 'development.js' : 'production.min.js';
46
+ scripts.push('//cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.' + reactVersion);
47
+ scripts.push('//cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.6/umd/react-dom.' + reactVersion);
48
+ }
49
+
50
+ if (useMinified) {
51
+ scripts.push('demo-app.min.js');
52
+ } else {
53
+ scripts.push('demo-app.js');
54
+ }
55
+
56
+ loadScript(scripts);
57
+
58
+ function getParameterByName(name, url) {
59
+ if (!url) {
60
+ url = location.href;
61
+ }
62
+ name = name.replace(/[\[\]]/g, '\\$&');
63
+ var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
64
+ results = regex.exec(url);
65
+ if (!results) return null;
66
+ if (!results[2]) return '';
67
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
68
+ }
69
+ </script>
70
+ </body>
71
+ </html>