reshaped 3.8.0-canary.7 → 3.8.0-canary.9

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 (214) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/bundle.css +1 -1
  3. package/dist/bundle.js +9 -9
  4. package/dist/components/Accordion/AccordionControlled.js +1 -0
  5. package/dist/components/Actionable/Actionable.js +1 -0
  6. package/dist/components/Actionable/Actionable.module.css +1 -1
  7. package/dist/components/Alert/tests/Alert.stories.d.ts +6 -5
  8. package/dist/components/Alert/tests/Alert.stories.js +15 -2
  9. package/dist/components/Badge/Badge.module.css +1 -1
  10. package/dist/components/Badge/tests/Badge.stories.d.ts +5 -0
  11. package/dist/components/Badge/tests/Badge.stories.js +34 -0
  12. package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -0
  13. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +8 -4
  14. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +57 -1
  15. package/dist/components/Button/tests/Button.stories.d.ts +54 -12
  16. package/dist/components/Button/tests/Button.stories.js +725 -588
  17. package/dist/components/Calendar/CalendarMonth.js +1 -0
  18. package/dist/components/Card/Card.module.css +1 -1
  19. package/dist/components/Card/tests/Card.stories.d.ts +28 -6
  20. package/dist/components/Card/tests/Card.stories.js +110 -65
  21. package/dist/components/Carousel/Carousel.js +1 -0
  22. package/dist/components/Carousel/Carousel.module.css +1 -1
  23. package/dist/components/Checkbox/Checkbox.module.css +1 -1
  24. package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +20 -4
  25. package/dist/components/Checkbox/tests/Checkbox.stories.js +150 -79
  26. package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +9 -2
  27. package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +67 -35
  28. package/dist/components/Container/tests/Container.stories.d.ts +2 -0
  29. package/dist/components/Container/tests/Container.stories.js +14 -0
  30. package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +10 -1
  31. package/dist/components/ContextMenu/tests/ContextMenu.stories.js +57 -13
  32. package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +5 -0
  33. package/dist/components/Dismissible/tests/Dismissible.stories.js +30 -1
  34. package/dist/components/Divider/tests/Divider.stories.d.ts +8 -3
  35. package/dist/components/Divider/tests/Divider.stories.js +71 -41
  36. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +35 -6
  37. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +222 -115
  38. package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +0 -15
  39. package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.js +0 -106
  40. package/dist/components/FileUpload/FileUpload.module.css +1 -1
  41. package/dist/components/Flyout/Flyout.module.css +1 -1
  42. package/dist/components/Flyout/FlyoutContent.js +3 -0
  43. package/dist/components/Flyout/FlyoutControlled.js +6 -1
  44. package/dist/components/Flyout/utilities/flyout.js +0 -1
  45. package/dist/components/FormControl/FormControl.context.d.ts +1 -1
  46. package/dist/components/FormControl/tests/FormControl.stories.d.ts +2 -0
  47. package/dist/components/FormControl/tests/FormControl.stories.js +35 -0
  48. package/dist/components/Hidden/tests/Hidden.stories.d.ts +2 -0
  49. package/dist/components/Hidden/tests/Hidden.stories.js +9 -0
  50. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +2 -0
  51. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +9 -0
  52. package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +2 -0
  53. package/dist/components/Hotkey/tests/Hotkey.stories.js +15 -0
  54. package/dist/components/Icon/tests/Icon.stories.d.ts +3 -0
  55. package/dist/components/Icon/tests/Icon.stories.js +23 -0
  56. package/dist/components/Link/tests/Link.stories.d.ts +28 -5
  57. package/dist/components/Link/tests/Link.stories.js +141 -58
  58. package/dist/components/Link/tests/Link.test.stories.d.ts +0 -13
  59. package/dist/components/Link/tests/Link.test.stories.js +0 -85
  60. package/dist/components/Loader/tests/Loader.stories.d.ts +11 -2
  61. package/dist/components/Loader/tests/Loader.stories.js +52 -25
  62. package/dist/components/Loader/tests/Loader.test.stories.d.ts +0 -3
  63. package/dist/components/Loader/tests/Loader.test.stories.js +0 -21
  64. package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +37 -7
  65. package/dist/components/MenuItem/tests/MenuItem.stories.js +218 -112
  66. package/dist/components/Modal/Modal.js +1 -1
  67. package/dist/components/Modal/Modal.module.css +1 -1
  68. package/dist/components/Modal/tests/Modal.stories.d.ts +53 -10
  69. package/dist/components/Modal/tests/Modal.stories.js +366 -214
  70. package/dist/components/Overlay/Overlay.js +1 -0
  71. package/dist/components/Overlay/tests/Overlay.stories.d.ts +15 -1
  72. package/dist/components/Overlay/tests/Overlay.stories.js +135 -1
  73. package/dist/components/Pagination/tests/Pagination.stories.d.ts +14 -1
  74. package/dist/components/Pagination/tests/Pagination.stories.js +93 -15
  75. package/dist/components/PinField/tests/PinField.stories.d.ts +1 -1
  76. package/dist/components/PinField/tests/PinField.stories.js +1 -1
  77. package/dist/components/Popover/Popover.module.css +1 -1
  78. package/dist/components/Progress/tests/Progress.stories.d.ts +19 -4
  79. package/dist/components/Progress/tests/Progress.stories.js +85 -49
  80. package/dist/components/Radio/Radio.module.css +1 -1
  81. package/dist/components/Radio/tests/Radio.stories.d.ts +25 -4
  82. package/dist/components/Radio/tests/Radio.stories.js +147 -65
  83. package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +9 -2
  84. package/dist/components/RadioGroup/tests/RadioGroup.stories.js +64 -38
  85. package/dist/components/Reshaped/Reshaped.css +1 -1
  86. package/dist/components/Scrim/tests/Scrim.stories.d.ts +10 -2
  87. package/dist/components/Scrim/tests/Scrim.stories.js +51 -31
  88. package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
  89. package/dist/components/Select/Select.module.css +1 -1
  90. package/dist/components/Select/Select.types.d.ts +38 -11
  91. package/dist/components/Select/SelectCustom.js +2 -1
  92. package/dist/components/Select/SelectCustomControlled.js +24 -9
  93. package/dist/components/Select/SelectCustomUncontrolled.js +10 -7
  94. package/dist/components/Select/SelectTrigger.js +1 -1
  95. package/dist/components/Select/tests/Select.stories.d.ts +3 -0
  96. package/dist/components/Select/tests/Select.stories.js +91 -34
  97. package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +10 -2
  98. package/dist/components/Skeleton/tests/Skeleton.stories.js +46 -28
  99. package/dist/components/Slider/Slider.module.css +1 -1
  100. package/dist/components/Stepper/tests/Stepper.stories.d.ts +18 -4
  101. package/dist/components/Stepper/tests/Stepper.stories.js +99 -70
  102. package/dist/components/Switch/Switch.module.css +1 -1
  103. package/dist/components/Switch/tests/Switch.stories.d.ts +10 -2
  104. package/dist/components/Switch/tests/Switch.stories.js +77 -23
  105. package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -10
  106. package/dist/components/Switch/tests/Switch.test.stories.js +0 -68
  107. package/dist/components/Table/Table.module.css +1 -1
  108. package/dist/components/Table/tests/Table.stories.d.ts +25 -5
  109. package/dist/components/Table/tests/Table.stories.js +274 -177
  110. package/dist/components/Table/tests/Table.test.stories.d.ts +0 -5
  111. package/dist/components/Table/tests/Table.test.stories.js +0 -82
  112. package/dist/components/Tabs/Tabs.module.css +1 -1
  113. package/dist/components/Tabs/TabsControlled.js +1 -0
  114. package/dist/components/TextArea/TextArea.module.css +1 -1
  115. package/dist/components/TextArea/tests/TextArea.stories.d.ts +41 -9
  116. package/dist/components/TextArea/tests/TextArea.stories.js +179 -93
  117. package/dist/components/TextField/TextField.js +1 -1
  118. package/dist/components/TextField/TextField.module.css +1 -1
  119. package/dist/components/TextField/tests/TextField.stories.d.ts +41 -11
  120. package/dist/components/TextField/tests/TextField.stories.js +206 -132
  121. package/dist/components/TextField/tests/TextField.test.stories.d.ts +0 -13
  122. package/dist/components/TextField/tests/TextField.test.stories.js +0 -88
  123. package/dist/components/Theme/Theme.module.css +1 -1
  124. package/dist/components/Timeline/tests/Timeline.stories.d.ts +10 -2
  125. package/dist/components/Timeline/tests/Timeline.stories.js +69 -42
  126. package/dist/components/Timeline/tests/Timeline.test.stories.d.ts +0 -2
  127. package/dist/components/Timeline/tests/Timeline.test.stories.js +0 -21
  128. package/dist/components/Toast/ToastContainer.js +1 -0
  129. package/dist/components/Toast/ToastRegion.js +1 -0
  130. package/dist/components/Toast/tests/Toast.stories.d.ts +32 -8
  131. package/dist/components/Toast/tests/Toast.stories.js +111 -37
  132. package/dist/components/ToggleButtonGroup/ToggleButtonGroupControlled.js +1 -0
  133. package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +18 -4
  134. package/dist/components/Tooltip/tests/Tooltip.stories.js +139 -107
  135. package/dist/components/Tooltip/tests/Tooltip.test.stories.d.ts +0 -6
  136. package/dist/components/Tooltip/tests/Tooltip.test.stories.js +0 -29
  137. package/dist/components/View/View.js +1 -0
  138. package/dist/components/View/tests/View.stories.d.ts +4 -0
  139. package/dist/components/View/tests/View.stories.js +39 -0
  140. package/dist/components/_private/Expandable/Expandable.js +3 -1
  141. package/dist/components/_private/Portal/Portal.js +4 -1
  142. package/dist/hooks/_private/usePrevious.js +1 -0
  143. package/dist/hooks/tests/useDrag.stories.js +1 -1
  144. package/dist/styles/resolvers/align/align.css +1 -1
  145. package/dist/styles/resolvers/aspectRatio/aspectRatio.css +1 -1
  146. package/dist/styles/resolvers/bleed/bleed.module.css +1 -1
  147. package/dist/styles/resolvers/justify/justify.css +1 -1
  148. package/dist/styles/resolvers/maxHeight/maxHeight.module.css +1 -1
  149. package/dist/styles/resolvers/maxWidth/maxWidth.module.css +1 -1
  150. package/dist/styles/resolvers/minHeight/minHeight.module.css +1 -1
  151. package/dist/styles/resolvers/minWidth/minWidth.module.css +1 -1
  152. package/dist/styles/resolvers/position/position.css +1 -1
  153. package/dist/styles/resolvers/textAlign/textAlign.css +1 -1
  154. package/dist/styles/resolvers/width/width.module.css +1 -1
  155. package/dist/utilities/scroll/disable.js +2 -2
  156. package/package.json +21 -21
  157. package/dist/components/Alert/tests/Alert.test.stories.d.ts +0 -15
  158. package/dist/components/Alert/tests/Alert.test.stories.js +0 -26
  159. package/dist/components/Badge/tests/Badge.test.stories.d.ts +0 -20
  160. package/dist/components/Badge/tests/Badge.test.stories.js +0 -46
  161. package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.d.ts +0 -23
  162. package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.js +0 -76
  163. package/dist/components/Button/tests/Button.test.stories.d.ts +0 -28
  164. package/dist/components/Button/tests/Button.test.stories.js +0 -135
  165. package/dist/components/Card/tests/Card.test.stories.d.ts +0 -35
  166. package/dist/components/Card/tests/Card.test.stories.js +0 -54
  167. package/dist/components/Checkbox/tests/Checkbox.test.stories.d.ts +0 -25
  168. package/dist/components/Checkbox/tests/Checkbox.test.stories.js +0 -104
  169. package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.d.ts +0 -22
  170. package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.js +0 -78
  171. package/dist/components/Container/tests/Container.test.stories.d.ts +0 -15
  172. package/dist/components/Container/tests/Container.test.stories.js +0 -26
  173. package/dist/components/ContextMenu/tests/ContextMenu.test.stories.d.ts +0 -25
  174. package/dist/components/ContextMenu/tests/ContextMenu.test.stories.js +0 -53
  175. package/dist/components/Dismissible/tests/Dismissible.test.stories.d.ts +0 -19
  176. package/dist/components/Dismissible/tests/Dismissible.test.stories.js +0 -42
  177. package/dist/components/Divider/tests/Divider.test.stories.d.ts +0 -18
  178. package/dist/components/Divider/tests/Divider.test.stories.js +0 -47
  179. package/dist/components/FormControl/tests/FormControl.test.stories.d.ts +0 -20
  180. package/dist/components/FormControl/tests/FormControl.test.stories.js +0 -49
  181. package/dist/components/Hidden/tests/Hidden.test.stories.d.ts +0 -15
  182. package/dist/components/Hidden/tests/Hidden.test.stories.js +0 -20
  183. package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.d.ts +0 -15
  184. package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.js +0 -20
  185. package/dist/components/Hotkey/tests/Hotkey.test.stories.d.ts +0 -15
  186. package/dist/components/Hotkey/tests/Hotkey.test.stories.js +0 -26
  187. package/dist/components/Icon/tests/Icon.test.stories.d.ts +0 -16
  188. package/dist/components/Icon/tests/Icon.test.stories.js +0 -35
  189. package/dist/components/MenuItem/tests/MenuItem.test.stories.d.ts +0 -27
  190. package/dist/components/MenuItem/tests/MenuItem.test.stories.js +0 -116
  191. package/dist/components/Modal/tests/Modal.test.stories.d.ts +0 -31
  192. package/dist/components/Modal/tests/Modal.test.stories.js +0 -149
  193. package/dist/components/Overlay/tests/Overlay.test.stories.d.ts +0 -28
  194. package/dist/components/Overlay/tests/Overlay.test.stories.js +0 -148
  195. package/dist/components/Pagination/tests/Pagination.test.stories.d.ts +0 -23
  196. package/dist/components/Pagination/tests/Pagination.test.stories.js +0 -86
  197. package/dist/components/Progress/tests/Progress.test.stories.d.ts +0 -16
  198. package/dist/components/Progress/tests/Progress.test.stories.js +0 -35
  199. package/dist/components/Radio/tests/Radio.test.stories.d.ts +0 -30
  200. package/dist/components/Radio/tests/Radio.test.stories.js +0 -118
  201. package/dist/components/RadioGroup/tests/RadioGroup.test.stories.d.ts +0 -22
  202. package/dist/components/RadioGroup/tests/RadioGroup.test.stories.js +0 -78
  203. package/dist/components/Scrim/tests/Scrim.test.stories.d.ts +0 -15
  204. package/dist/components/Scrim/tests/Scrim.test.stories.js +0 -25
  205. package/dist/components/Skeleton/tests/Skeleton.test.stories.d.ts +0 -15
  206. package/dist/components/Skeleton/tests/Skeleton.test.stories.js +0 -23
  207. package/dist/components/Stepper/tests/Stepper.test.stories.d.ts +0 -20
  208. package/dist/components/Stepper/tests/Stepper.test.stories.js +0 -28
  209. package/dist/components/TextArea/tests/TextArea.test.stories.d.ts +0 -28
  210. package/dist/components/TextArea/tests/TextArea.test.stories.js +0 -99
  211. package/dist/components/Toast/tests/Toast.test.stories.d.ts +0 -16
  212. package/dist/components/Toast/tests/Toast.test.stories.js +0 -101
  213. package/dist/components/View/tests/View.test.stories.d.ts +0 -24
  214. package/dist/components/View/tests/View.test.stories.js +0 -50
@@ -5,6 +5,7 @@ import Image from "../../Image/index.js";
5
5
  import Avatar from "../../Avatar/index.js";
6
6
  import Hotkey from "../../Hotkey/index.js";
7
7
  import IconZap from "../../../icons/Zap.js";
8
+ import { expect, fn, userEvent } from "storybook/test";
8
9
  export default {
9
10
  title: "Components/Button",
10
11
  component: Button,
@@ -15,638 +16,774 @@ export default {
15
16
  },
16
17
  };
17
18
  const imgUrl = "https://images.unsplash.com/photo-1632502361954-0dd92ce797db?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1625&q=80";
18
- export const variantAndColor = () => (<Example>
19
- <Example.Item title="variant: solid">
20
- <View gap={4} direction="row">
21
- <Button onClick={() => { }}>Button</Button>
22
- <Button onClick={() => { }} color="primary">
23
- Button
24
- </Button>
25
- <Button onClick={() => { }} color="critical">
26
- Button
27
- </Button>
28
- <Button onClick={() => { }} color="positive">
29
- Button
30
- </Button>
31
- </View>
32
- </Example.Item>
33
- <Example.Item title="variant: faded">
34
- <View direction="row" gap={4}>
35
- <Button onClick={() => { }} variant="faded">
36
- Button
37
- </Button>
38
- <Button onClick={() => { }} color="primary" variant="faded">
39
- Button
40
- </Button>
41
- <Button onClick={() => { }} color="critical" variant="faded">
42
- Button
43
- </Button>
44
- <Button onClick={() => { }} color="positive" variant="faded">
45
- Button
46
- </Button>
47
- <View padding={4} borderRadius="medium" attributes={{ style: { color: "#029CFD" } }}>
48
- <Button onClick={() => { }} color="inherit" variant="faded">
49
- Inherit
19
+ export const variantAndColor = {
20
+ name: "variant, color",
21
+ render: () => (<Example>
22
+ <Example.Item title="variant: solid">
23
+ <View gap={4} direction="row">
24
+ <Button onClick={() => { }}>Button</Button>
25
+ <Button onClick={() => { }} color="primary">
26
+ Button
50
27
  </Button>
51
- </View>
52
-
53
- <View padding={4} backgroundColor="black" borderRadius="medium">
54
- <Button onClick={() => { }} color="inherit" variant="faded">
55
- Inherit
28
+ <Button onClick={() => { }} color="critical">
29
+ Button
56
30
  </Button>
57
- </View>
58
- <View padding={4} backgroundColor="white" borderRadius="medium">
59
- <Button onClick={() => { }} color="inherit" variant="faded">
60
- Inherit
31
+ <Button onClick={() => { }} color="positive">
32
+ Button
61
33
  </Button>
62
34
  </View>
63
- </View>
64
- </Example.Item>
65
- <Example.Item title="variant: outline">
66
- <View direction="row" gap={4}>
67
- <Button onClick={() => { }} variant="outline">
68
- Button
69
- </Button>
70
- <Button onClick={() => { }} color="primary" variant="outline">
71
- Button
72
- </Button>
73
- <Button onClick={() => { }} color="critical" variant="outline">
74
- Button
75
- </Button>
76
- <Button onClick={() => { }} color="positive" variant="outline">
77
- Button
78
- </Button>
79
-
80
- <View padding={4} borderRadius="medium" attributes={{ style: { color: "#029CFD" } }}>
81
- <Button onClick={() => { }} color="inherit" variant="outline">
82
- Inherit
35
+ </Example.Item>
36
+ <Example.Item title="variant: faded">
37
+ <View direction="row" gap={4}>
38
+ <Button onClick={() => { }} variant="faded">
39
+ Button
83
40
  </Button>
84
- </View>
85
-
86
- <View padding={4} backgroundColor="black" borderRadius="medium">
87
- <Button onClick={() => { }} color="inherit" variant="outline">
88
- Inherit
41
+ <Button onClick={() => { }} color="primary" variant="faded">
42
+ Button
89
43
  </Button>
90
- </View>
91
- <View padding={4} backgroundColor="white" borderRadius="medium">
92
- <Button onClick={() => { }} color="inherit" variant="outline">
93
- Inherit
44
+ <Button onClick={() => { }} color="critical" variant="faded">
45
+ Button
94
46
  </Button>
95
- </View>
96
- </View>
97
- </Example.Item>
98
- <Example.Item title="variant: ghost">
99
- <View direction="row" gap={4}>
100
- <Button onClick={() => { }} variant="ghost">
101
- Button
102
- </Button>
103
- <Button onClick={() => { }} color="primary" variant="ghost">
104
- Button
105
- </Button>
106
- <Button onClick={() => { }} color="critical" variant="ghost">
107
- Button
108
- </Button>
109
- <Button onClick={() => { }} color="positive" variant="ghost">
110
- Button
111
- </Button>
112
- <View padding={4} borderRadius="medium" attributes={{ style: { color: "#029CFD" } }}>
113
- <Button onClick={() => { }} color="inherit" variant="ghost">
114
- Inherit
47
+ <Button onClick={() => { }} color="positive" variant="faded">
48
+ Button
115
49
  </Button>
116
- </View>
50
+ <View padding={4} borderRadius="medium" attributes={{ style: { color: "#029CFD" } }}>
51
+ <Button onClick={() => { }} color="inherit" variant="faded">
52
+ Inherit
53
+ </Button>
54
+ </View>
117
55
 
118
- <View padding={4} backgroundColor="black" borderRadius="medium">
119
- <Button onClick={() => { }} color="inherit" variant="ghost">
120
- Inherit
121
- </Button>
56
+ <View padding={4} backgroundColor="black" borderRadius="medium">
57
+ <Button onClick={() => { }} color="inherit" variant="faded">
58
+ Inherit
59
+ </Button>
60
+ </View>
61
+ <View padding={4} backgroundColor="white" borderRadius="medium">
62
+ <Button onClick={() => { }} color="inherit" variant="faded">
63
+ Inherit
64
+ </Button>
65
+ </View>
122
66
  </View>
123
- <View padding={4} backgroundColor="white" borderRadius="medium">
124
- <Button onClick={() => { }} color="inherit" variant="ghost">
125
- Inherit
67
+ </Example.Item>
68
+ <Example.Item title="variant: outline">
69
+ <View direction="row" gap={4}>
70
+ <Button onClick={() => { }} variant="outline">
71
+ Button
72
+ </Button>
73
+ <Button onClick={() => { }} color="primary" variant="outline">
74
+ Button
75
+ </Button>
76
+ <Button onClick={() => { }} color="critical" variant="outline">
77
+ Button
78
+ </Button>
79
+ <Button onClick={() => { }} color="positive" variant="outline">
80
+ Button
126
81
  </Button>
127
- </View>
128
- </View>
129
- </Example.Item>
130
- <Example.Item title="color: media">
131
- <View backgroundColor="primary" borderRadius="medium" padding={4} direction="row" gap={4}>
132
- <Button onClick={() => { }} color="media">
133
- Button
134
- </Button>
135
82
 
136
- <Button onClick={() => { }} color="media" variant="faded">
137
- Button
138
- </Button>
139
- </View>
140
- </Example.Item>
141
- </Example>);
142
- export const icon = () => (<Example>
143
- <Example.Item title="icon">
144
- <Button onClick={() => { }} icon={IconZap}>
145
- Button
146
- </Button>
147
- </Example.Item>
83
+ <View padding={4} borderRadius="medium" attributes={{ style: { color: "#029CFD" } }}>
84
+ <Button onClick={() => { }} color="inherit" variant="outline">
85
+ Inherit
86
+ </Button>
87
+ </View>
148
88
 
149
- <Example.Item title="endIcon">
150
- <Button onClick={() => { }} endIcon={IconZap}>
151
- Button
152
- </Button>
153
- </Example.Item>
89
+ <View padding={4} backgroundColor="black" borderRadius="medium">
90
+ <Button onClick={() => { }} color="inherit" variant="outline">
91
+ Inherit
92
+ </Button>
93
+ </View>
94
+ <View padding={4} backgroundColor="white" borderRadius="medium">
95
+ <Button onClick={() => { }} color="inherit" variant="outline">
96
+ Inherit
97
+ </Button>
98
+ </View>
99
+ </View>
100
+ </Example.Item>
101
+ <Example.Item title="variant: ghost">
102
+ <View direction="row" gap={4}>
103
+ <Button onClick={() => { }} variant="ghost">
104
+ Button
105
+ </Button>
106
+ <Button onClick={() => { }} color="primary" variant="ghost">
107
+ Button
108
+ </Button>
109
+ <Button onClick={() => { }} color="critical" variant="ghost">
110
+ Button
111
+ </Button>
112
+ <Button onClick={() => { }} color="positive" variant="ghost">
113
+ Button
114
+ </Button>
115
+ <View padding={4} borderRadius="medium" attributes={{ style: { color: "#029CFD" } }}>
116
+ <Button onClick={() => { }} color="inherit" variant="ghost">
117
+ Inherit
118
+ </Button>
119
+ </View>
154
120
 
155
- <Example.Item title="icon, endIcon">
156
- <Button onClick={() => { }} icon={IconZap} endIcon={IconZap}>
157
- Button
158
- </Button>
159
- </Example.Item>
121
+ <View padding={4} backgroundColor="black" borderRadius="medium">
122
+ <Button onClick={() => { }} color="inherit" variant="ghost">
123
+ Inherit
124
+ </Button>
125
+ </View>
126
+ <View padding={4} backgroundColor="white" borderRadius="medium">
127
+ <Button onClick={() => { }} color="inherit" variant="ghost">
128
+ Inherit
129
+ </Button>
130
+ </View>
131
+ </View>
132
+ </Example.Item>
133
+ <Example.Item title="color: media">
134
+ <View backgroundColor="primary" borderRadius="medium" padding={4} direction="row" gap={4}>
135
+ <Button onClick={() => { }} color="media">
136
+ Button
137
+ </Button>
160
138
 
161
- <Example.Item title="icon only">
162
- <Button onClick={() => { }} icon={IconZap} attributes={{ "aria-label": "Action" }}/>
163
- </Example.Item>
164
- </Example>);
165
- export const size = () => (<Example>
166
- <Example.Item title="size: small">
167
- <View gap={4} direction="row">
168
- <Button size="small" icon={IconZap}>
169
- Button
170
- </Button>
171
- <Button size="small" variant="outline" icon={IconZap}>
172
- Button
173
- </Button>
174
- <Button size="small" variant="ghost" icon={IconZap}>
139
+ <Button onClick={() => { }} color="media" variant="faded">
140
+ Button
141
+ </Button>
142
+ </View>
143
+ </Example.Item>
144
+ </Example>),
145
+ };
146
+ export const icon = {
147
+ name: "icon",
148
+ render: () => (<Example>
149
+ <Example.Item title="icon">
150
+ <Button onClick={() => { }} icon={IconZap}>
175
151
  Button
176
152
  </Button>
177
- </View>
178
- </Example.Item>
153
+ </Example.Item>
179
154
 
180
- <Example.Item title="size: medium">
181
- <View gap={4} direction="row">
182
- <Button icon={IconZap}>Button</Button>
183
- <Button variant="outline" icon={IconZap}>
184
- Button
185
- </Button>
186
- <Button variant="ghost" icon={IconZap}>
155
+ <Example.Item title="endIcon">
156
+ <Button onClick={() => { }} endIcon={IconZap}>
187
157
  Button
188
158
  </Button>
189
- </View>
190
- </Example.Item>
159
+ </Example.Item>
191
160
 
192
- <Example.Item title="size: large">
193
- <View gap={4} direction="row">
194
- <Button size="large" icon={IconZap}>
195
- Button
196
- </Button>
197
- <Button size="large" variant="outline" icon={IconZap}>
161
+ <Example.Item title="icon, endIcon">
162
+ <Button onClick={() => { }} icon={IconZap} endIcon={IconZap}>
198
163
  Button
199
164
  </Button>
200
- <Button size="large" variant="ghost" icon={IconZap}>
201
- Button
202
- </Button>
203
- </View>
204
- </Example.Item>
165
+ </Example.Item>
205
166
 
206
- <Example.Item title="size: xlarge">
207
- <View gap={4} direction="row">
208
- <Button size="xlarge" icon={IconZap}>
209
- Button
210
- </Button>
211
- <Button size="xlarge" variant="outline" icon={IconZap}>
212
- Button
213
- </Button>
214
- <Button size="xlarge" variant="ghost" icon={IconZap}>
215
- Button
216
- </Button>
217
- </View>
218
- </Example.Item>
167
+ <Example.Item title="icon only">
168
+ <Button onClick={() => { }} icon={IconZap} attributes={{ "aria-label": "Action" }}/>
169
+ </Example.Item>
170
+ </Example>),
171
+ };
172
+ export const size = {
173
+ name: "size",
174
+ render: () => (<Example>
175
+ <Example.Item title="size: small">
176
+ <View gap={4} direction="row">
177
+ <Button size="small" icon={IconZap}>
178
+ Button
179
+ </Button>
180
+ <Button size="small" variant="outline" icon={IconZap}>
181
+ Button
182
+ </Button>
183
+ <Button size="small" variant="ghost" icon={IconZap}>
184
+ Button
185
+ </Button>
186
+ </View>
187
+ </Example.Item>
219
188
 
220
- <Example.Item title="size: large, [m+] medium">
221
- <Button size={{ s: "large", m: "medium" }} icon={IconZap}>
222
- Responsive
223
- </Button>
224
- </Example.Item>
225
- </Example>);
226
- export const elevated = () => (<Example>
227
- <Example.Item title="elevated, color: neutral">
228
- <View direction="row" gap={4}>
229
- <Button elevated onClick={() => { }}>
230
- Button
231
- </Button>
232
- <Button elevated variant="outline" onClick={() => { }}>
233
- Button
234
- </Button>
235
- </View>
236
- </Example.Item>
189
+ <Example.Item title="size: medium">
190
+ <View gap={4} direction="row">
191
+ <Button icon={IconZap}>Button</Button>
192
+ <Button variant="outline" icon={IconZap}>
193
+ Button
194
+ </Button>
195
+ <Button variant="ghost" icon={IconZap}>
196
+ Button
197
+ </Button>
198
+ </View>
199
+ </Example.Item>
237
200
 
238
- <Example.Item title="elevated, color">
239
- <View direction="row" gap={4}>
240
- <Button elevated color="primary">
241
- Button
242
- </Button>
243
- <Button elevated variant="outline" color="primary">
244
- Button
245
- </Button>
246
- <View backgroundColor="primary" padding={4} borderRadius="medium">
247
- <Button color="media" elevated>
201
+ <Example.Item title="size: large">
202
+ <View gap={4} direction="row">
203
+ <Button size="large" icon={IconZap}>
204
+ Button
205
+ </Button>
206
+ <Button size="large" variant="outline" icon={IconZap}>
207
+ Button
208
+ </Button>
209
+ <Button size="large" variant="ghost" icon={IconZap}>
248
210
  Button
249
211
  </Button>
250
212
  </View>
251
- </View>
252
- </Example.Item>
253
- </Example>);
254
- export const rounded = () => (<Example>
255
- <Example.Item title="rounded, size: small, all variants">
256
- <View gap={3} direction="row">
257
- <Button rounded size="small" icon={IconZap}>
258
- Button
259
- </Button>
260
- <Button rounded variant="outline" size="small" icon={IconZap}>
261
- Button
262
- </Button>
263
- <Button rounded variant="ghost" size="small" icon={IconZap}>
264
- Button
265
- </Button>
266
- </View>
267
- </Example.Item>
268
- <Example.Item title="rounded, size: medium, all variants">
269
- <View gap={3} direction="row">
270
- <Button rounded icon={IconZap}>
271
- Button
272
- </Button>
273
- <Button rounded variant="outline" icon={IconZap}>
274
- Button
275
- </Button>
276
- <Button rounded variant="ghost" icon={IconZap}>
277
- Button
278
- </Button>
279
- </View>
280
- </Example.Item>
281
- <Example.Item title="rounded, size: large, all variants">
282
- <View gap={3} direction="row">
283
- <Button rounded size="large" icon={IconZap}>
284
- Button
285
- </Button>
286
- <Button rounded variant="outline" size="large" icon={IconZap}>
287
- Button
288
- </Button>
289
- <Button rounded variant="ghost" size="large" icon={IconZap}>
290
- Button
291
- </Button>
292
- </View>
293
- </Example.Item>
294
- <Example.Item title="rounded, icon only, all sizes">
295
- <View gap={3} direction="row">
296
- <Button rounded size="small" icon={IconZap}/>
297
- <Button rounded icon={IconZap}/>
298
- <Button rounded size="large" icon={IconZap}/>
299
- </View>
300
- </Example.Item>
301
- </Example>);
302
- export const fullWidth = () => (<Example>
303
- <Example.Item title="fullWidth, all variants">
304
- <View gap={3}>
305
- <Button fullWidth>Neutral</Button>
306
- <Button fullWidth variant="faded">
307
- Faded
308
- </Button>
309
- <Button fullWidth variant="outline">
310
- Outline
311
- </Button>
312
- <Button fullWidth variant="ghost">
313
- Ghost
314
- </Button>
315
- </View>
316
- </Example.Item>
213
+ </Example.Item>
317
214
 
318
- <Example.Item title={["responsive fullWidth", "[s] true", "[m+] false"]}>
319
- <Button fullWidth={{ s: true, m: false }}>Button</Button>
320
- </Example.Item>
321
- </Example>);
322
- export const loading = () => (<Example>
323
- <Example.Item title="loading, color: neutral, all variants">
324
- <View gap={3} direction="row">
325
- <Button loading loadingAriaLabel="Loading">
326
- Button
327
- </Button>
328
- <Button loading loadingAriaLabel="Loading" variant="faded">
329
- Button
330
- </Button>
331
- <Button loading loadingAriaLabel="Loading" variant="outline">
332
- Button
333
- </Button>
334
- <Button loading loadingAriaLabel="Loading" variant="ghost">
335
- Button
336
- </Button>
337
- </View>
338
- </Example.Item>
339
- <Example.Item title="loading, color critical, all variants">
340
- <View gap={3} direction="row">
341
- <Button loading loadingAriaLabel="Loading" color="critical">
342
- Button
343
- </Button>
344
- <Button loading loadingAriaLabel="Loading" color="critical" variant="faded">
345
- Button
346
- </Button>
347
- <Button loading loadingAriaLabel="Loading" color="critical" variant="outline">
348
- Button
349
- </Button>
350
- <Button loading loadingAriaLabel="Loading" color="critical" variant="ghost">
351
- Button
352
- </Button>
353
- </View>
354
- </Example.Item>
355
- <Example.Item title="loading, color positive, all variants">
356
- <View gap={3} direction="row">
357
- <Button loading loadingAriaLabel="Loading" color="positive">
358
- Button
359
- </Button>
360
- <Button loading loadingAriaLabel="Loading" color="positive" variant="faded">
361
- Button
362
- </Button>
363
- <Button loading loadingAriaLabel="Loading" color="positive" variant="outline">
364
- Button
365
- </Button>
366
- <Button loading loadingAriaLabel="Loading" color="positive" variant="ghost">
367
- Button
368
- </Button>
369
- </View>
370
- </Example.Item>
215
+ <Example.Item title="size: xlarge">
216
+ <View gap={4} direction="row">
217
+ <Button size="xlarge" icon={IconZap}>
218
+ Button
219
+ </Button>
220
+ <Button size="xlarge" variant="outline" icon={IconZap}>
221
+ Button
222
+ </Button>
223
+ <Button size="xlarge" variant="ghost" icon={IconZap}>
224
+ Button
225
+ </Button>
226
+ </View>
227
+ </Example.Item>
371
228
 
372
- <Example.Item title="loading, color: media">
373
- <View aspectRatio={16 / 9}>
374
- <Image src={imgUrl}/>
229
+ <Example.Item title="size: large, [m+] medium">
230
+ <Button size={{ s: "large", m: "medium" }} icon={IconZap}>
231
+ Responsive
232
+ </Button>
233
+ </Example.Item>
234
+ </Example>),
235
+ };
236
+ export const elevated = {
237
+ name: "elevated",
238
+ render: () => (<Example>
239
+ <Example.Item title="elevated, color: neutral">
240
+ <View direction="row" gap={4}>
241
+ <Button elevated onClick={() => { }}>
242
+ Button
243
+ </Button>
244
+ <Button elevated variant="outline" onClick={() => { }}>
245
+ Button
246
+ </Button>
247
+ </View>
248
+ </Example.Item>
375
249
 
376
- <div style={{ position: "absolute", top: 16, left: 16 }}>
377
- <View gap={3} direction="row">
378
- <Button color="media" loading loadingAriaLabel="Loading">
379
- Button
380
- </Button>
381
- <Button color="media" variant="faded" loading loadingAriaLabel="Loading">
250
+ <Example.Item title="elevated, color">
251
+ <View direction="row" gap={4}>
252
+ <Button elevated color="primary">
253
+ Button
254
+ </Button>
255
+ <Button elevated variant="outline" color="primary">
256
+ Button
257
+ </Button>
258
+ <View backgroundColor="primary" padding={4} borderRadius="medium">
259
+ <Button color="media" elevated>
382
260
  Button
383
261
  </Button>
384
262
  </View>
385
- </div>
386
- </View>
387
- </Example.Item>
263
+ </View>
264
+ </Example.Item>
265
+ </Example>),
266
+ };
267
+ export const rounded = {
268
+ name: "rounded",
269
+ render: () => (<Example>
270
+ <Example.Item title="rounded, size: small, all variants">
271
+ <View gap={3} direction="row">
272
+ <Button rounded size="small" icon={IconZap}>
273
+ Button
274
+ </Button>
275
+ <Button rounded variant="outline" size="small" icon={IconZap}>
276
+ Button
277
+ </Button>
278
+ <Button rounded variant="ghost" size="small" icon={IconZap}>
279
+ Button
280
+ </Button>
281
+ </View>
282
+ </Example.Item>
283
+ <Example.Item title="rounded, size: medium, all variants">
284
+ <View gap={3} direction="row">
285
+ <Button rounded icon={IconZap}>
286
+ Button
287
+ </Button>
288
+ <Button rounded variant="outline" icon={IconZap}>
289
+ Button
290
+ </Button>
291
+ <Button rounded variant="ghost" icon={IconZap}>
292
+ Button
293
+ </Button>
294
+ </View>
295
+ </Example.Item>
296
+ <Example.Item title="rounded, size: large, all variants">
297
+ <View gap={3} direction="row">
298
+ <Button rounded size="large" icon={IconZap}>
299
+ Button
300
+ </Button>
301
+ <Button rounded variant="outline" size="large" icon={IconZap}>
302
+ Button
303
+ </Button>
304
+ <Button rounded variant="ghost" size="large" icon={IconZap}>
305
+ Button
306
+ </Button>
307
+ </View>
308
+ </Example.Item>
309
+ <Example.Item title="rounded, icon only, all sizes">
310
+ <View gap={3} direction="row">
311
+ <Button rounded size="small" icon={IconZap}/>
312
+ <Button rounded icon={IconZap}/>
313
+ <Button rounded size="large" icon={IconZap}/>
314
+ </View>
315
+ </Example.Item>
316
+ </Example>),
317
+ };
318
+ export const fullWidth = {
319
+ name: "fullWidth",
320
+ render: () => (<Example>
321
+ <Example.Item title="fullWidth, all variants">
322
+ <View gap={3}>
323
+ <Button fullWidth>Neutral</Button>
324
+ <Button fullWidth variant="faded">
325
+ Faded
326
+ </Button>
327
+ <Button fullWidth variant="outline">
328
+ Outline
329
+ </Button>
330
+ <Button fullWidth variant="ghost">
331
+ Ghost
332
+ </Button>
333
+ </View>
334
+ </Example.Item>
388
335
 
389
- <Example.Item title={["loading, long button text", "button size should stay the same"]}>
390
- <Button loading loadingAriaLabel="Loading" color="primary">
391
- Long button text
392
- </Button>
393
- </Example.Item>
336
+ <Example.Item title={["responsive fullWidth", "[s] true", "[m+] false"]}>
337
+ <Button fullWidth={{ s: true, m: false }}>Button</Button>
338
+ </Example.Item>
339
+ </Example>),
340
+ };
341
+ export const loading = {
342
+ name: "loading",
343
+ render: () => (<Example>
344
+ <Example.Item title="loading, color: neutral, all variants">
345
+ <View gap={3} direction="row">
346
+ <Button loading loadingAriaLabel="Loading">
347
+ Button
348
+ </Button>
349
+ <Button loading loadingAriaLabel="Loading" variant="faded">
350
+ Button
351
+ </Button>
352
+ <Button loading loadingAriaLabel="Loading" variant="outline">
353
+ Button
354
+ </Button>
355
+ <Button loading loadingAriaLabel="Loading" variant="ghost">
356
+ Button
357
+ </Button>
358
+ </View>
359
+ </Example.Item>
360
+ <Example.Item title="loading, color critical, all variants">
361
+ <View gap={3} direction="row">
362
+ <Button loading loadingAriaLabel="Loading" color="critical">
363
+ Button
364
+ </Button>
365
+ <Button loading loadingAriaLabel="Loading" color="critical" variant="faded">
366
+ Button
367
+ </Button>
368
+ <Button loading loadingAriaLabel="Loading" color="critical" variant="outline">
369
+ Button
370
+ </Button>
371
+ <Button loading loadingAriaLabel="Loading" color="critical" variant="ghost">
372
+ Button
373
+ </Button>
374
+ </View>
375
+ </Example.Item>
376
+ <Example.Item title="loading, color positive, all variants">
377
+ <View gap={3} direction="row">
378
+ <Button loading loadingAriaLabel="Loading" color="positive">
379
+ Button
380
+ </Button>
381
+ <Button loading loadingAriaLabel="Loading" color="positive" variant="faded">
382
+ Button
383
+ </Button>
384
+ <Button loading loadingAriaLabel="Loading" color="positive" variant="outline">
385
+ Button
386
+ </Button>
387
+ <Button loading loadingAriaLabel="Loading" color="positive" variant="ghost">
388
+ Button
389
+ </Button>
390
+ </View>
391
+ </Example.Item>
394
392
 
395
- <Example.Item title={["loading, icon only", "button keep square 1/1 ratio"]}>
396
- <Button icon={IconZap} rounded loading loadingAriaLabel="Loading"/>
397
- </Example.Item>
398
- </Example>);
399
- export const highlighted = () => (<Example>
400
- <Example.Item title="highlighted, color: neutral, all variants">
401
- <View gap={3} direction="row">
402
- <Button highlighted icon={IconZap}>
403
- Button
404
- </Button>
405
- <Button highlighted variant="faded" icon={IconZap}>
406
- Button
407
- </Button>
408
- <Button highlighted variant="outline" icon={IconZap}>
409
- Button
410
- </Button>
411
- <Button highlighted variant="ghost" icon={IconZap}>
412
- Button
413
- </Button>
414
- </View>
415
- </Example.Item>
416
- <Example.Item title="highlighted, color: critical, all variants">
417
- <View gap={3} direction="row">
418
- <Button highlighted color="critical" icon={IconZap}>
419
- Button
420
- </Button>
421
- <Button highlighted color="critical" variant="faded" icon={IconZap}>
422
- Button
423
- </Button>
424
- <Button highlighted color="critical" variant="outline" icon={IconZap}>
425
- Button
426
- </Button>
427
- <Button highlighted color="critical" variant="ghost" icon={IconZap}>
428
- Button
429
- </Button>
430
- </View>
431
- </Example.Item>
432
- <Example.Item title="highlighted, color: positive, all variants">
433
- <View gap={3} direction="row">
434
- <Button highlighted color="positive" icon={IconZap}>
435
- Button
436
- </Button>
437
- <Button highlighted color="positive" variant="faded" icon={IconZap}>
438
- Button
439
- </Button>
440
- <Button highlighted color="positive" variant="outline" icon={IconZap}>
441
- Button
442
- </Button>
443
- <Button highlighted color="positive" variant="ghost" icon={IconZap}>
444
- Button
445
- </Button>
446
- </View>
447
- </Example.Item>
448
- </Example>);
449
- export const disabled = () => (<Example>
450
- <Example.Item title="disabled, color: neutral, all variants">
451
- <View gap={3} direction="row">
452
- <Button disabled icon={IconZap}>
453
- Button
454
- </Button>
455
- <Button disabled variant="faded" icon={IconZap}>
456
- Button
457
- </Button>
458
- <Button disabled variant="outline" icon={IconZap}>
459
- Button
460
- </Button>
461
- <Button disabled variant="ghost" icon={IconZap}>
462
- Button
463
- </Button>
464
- </View>
465
- </Example.Item>
466
- <Example.Item title="disabled, color: critical, all variants">
467
- <View gap={3} direction="row">
468
- <Button disabled color="critical" icon={IconZap}>
469
- Button
470
- </Button>
471
- <Button disabled color="critical" variant="faded" icon={IconZap}>
472
- Button
473
- </Button>
474
- <Button disabled color="critical" variant="outline" icon={IconZap}>
475
- Button
476
- </Button>
477
- <Button disabled color="critical" variant="ghost" icon={IconZap}>
478
- Button
479
- </Button>
480
- </View>
481
- </Example.Item>
482
- <Example.Item title="disabled, color: positive, all variants">
483
- <View gap={3} direction="row">
484
- <Button disabled color="positive" icon={IconZap}>
485
- Button
486
- </Button>
487
- <Button disabled color="positive" variant="faded" icon={IconZap}>
488
- Button
489
- </Button>
490
- <Button disabled color="positive" variant="outline" icon={IconZap}>
491
- Button
492
- </Button>
493
- <Button disabled color="positive" variant="ghost" icon={IconZap}>
494
- Button
393
+ <Example.Item title="loading, color: media">
394
+ <View aspectRatio={16 / 9}>
395
+ <Image src={imgUrl}/>
396
+
397
+ <div style={{ position: "absolute", top: 16, left: 16 }}>
398
+ <View gap={3} direction="row">
399
+ <Button color="media" loading loadingAriaLabel="Loading">
400
+ Button
401
+ </Button>
402
+ <Button color="media" variant="faded" loading loadingAriaLabel="Loading">
403
+ Button
404
+ </Button>
405
+ </View>
406
+ </div>
407
+ </View>
408
+ </Example.Item>
409
+
410
+ <Example.Item title={["loading, long button text", "button size should stay the same"]}>
411
+ <Button loading loadingAriaLabel="Loading" color="primary">
412
+ Long button text
495
413
  </Button>
496
- </View>
497
- </Example.Item>
414
+ </Example.Item>
498
415
 
499
- <Example.Item title="disabled, color: media">
500
- <View aspectRatio={16 / 9}>
501
- <Image src={imgUrl}/>
416
+ <Example.Item title={["loading, icon only", "button keep square 1/1 ratio"]}>
417
+ <Button icon={IconZap} rounded loading loadingAriaLabel="Loading"/>
418
+ </Example.Item>
419
+ </Example>),
420
+ };
421
+ export const highlighted = {
422
+ name: "highlighted",
423
+ render: () => (<Example>
424
+ <Example.Item title="highlighted, color: neutral, all variants">
425
+ <View gap={3} direction="row">
426
+ <Button highlighted icon={IconZap}>
427
+ Button
428
+ </Button>
429
+ <Button highlighted variant="faded" icon={IconZap}>
430
+ Button
431
+ </Button>
432
+ <Button highlighted variant="outline" icon={IconZap}>
433
+ Button
434
+ </Button>
435
+ <Button highlighted variant="ghost" icon={IconZap}>
436
+ Button
437
+ </Button>
438
+ </View>
439
+ </Example.Item>
440
+ <Example.Item title="highlighted, color: critical, all variants">
441
+ <View gap={3} direction="row">
442
+ <Button highlighted color="critical" icon={IconZap}>
443
+ Button
444
+ </Button>
445
+ <Button highlighted color="critical" variant="faded" icon={IconZap}>
446
+ Button
447
+ </Button>
448
+ <Button highlighted color="critical" variant="outline" icon={IconZap}>
449
+ Button
450
+ </Button>
451
+ <Button highlighted color="critical" variant="ghost" icon={IconZap}>
452
+ Button
453
+ </Button>
454
+ </View>
455
+ </Example.Item>
456
+ <Example.Item title="highlighted, color: positive, all variants">
457
+ <View gap={3} direction="row">
458
+ <Button highlighted color="positive" icon={IconZap}>
459
+ Button
460
+ </Button>
461
+ <Button highlighted color="positive" variant="faded" icon={IconZap}>
462
+ Button
463
+ </Button>
464
+ <Button highlighted color="positive" variant="outline" icon={IconZap}>
465
+ Button
466
+ </Button>
467
+ <Button highlighted color="positive" variant="ghost" icon={IconZap}>
468
+ Button
469
+ </Button>
470
+ </View>
471
+ </Example.Item>
472
+ </Example>),
473
+ };
474
+ export const disabled = {
475
+ name: "disabled",
476
+ render: () => (<Example>
477
+ <Example.Item title="disabled, color: neutral, all variants">
478
+ <View gap={3} direction="row">
479
+ <Button disabled icon={IconZap} onClick={() => { }}>
480
+ Button
481
+ </Button>
482
+ <Button disabled variant="faded" icon={IconZap}>
483
+ Button
484
+ </Button>
485
+ <Button disabled variant="outline" icon={IconZap}>
486
+ Button
487
+ </Button>
488
+ <Button disabled variant="ghost" icon={IconZap}>
489
+ Button
490
+ </Button>
491
+ </View>
492
+ </Example.Item>
493
+ <Example.Item title="disabled, color: critical, all variants">
494
+ <View gap={3} direction="row">
495
+ <Button disabled color="critical" icon={IconZap}>
496
+ Button
497
+ </Button>
498
+ <Button disabled color="critical" variant="faded" icon={IconZap}>
499
+ Button
500
+ </Button>
501
+ <Button disabled color="critical" variant="outline" icon={IconZap}>
502
+ Button
503
+ </Button>
504
+ <Button disabled color="critical" variant="ghost" icon={IconZap}>
505
+ Button
506
+ </Button>
507
+ </View>
508
+ </Example.Item>
509
+ <Example.Item title="disabled, color: positive, all variants">
510
+ <View gap={3} direction="row">
511
+ <Button disabled color="positive" icon={IconZap}>
512
+ Button
513
+ </Button>
514
+ <Button disabled color="positive" variant="faded" icon={IconZap}>
515
+ Button
516
+ </Button>
517
+ <Button disabled color="positive" variant="outline" icon={IconZap}>
518
+ Button
519
+ </Button>
520
+ <Button disabled color="positive" variant="ghost" icon={IconZap}>
521
+ Button
522
+ </Button>
523
+ </View>
524
+ </Example.Item>
502
525
 
503
- <div style={{ position: "absolute", top: 16, left: 16 }}>
504
- <View gap={3} direction="row">
505
- <Button color="media" disabled>
506
- Button
507
- </Button>
508
- <Button color="media" variant="faded" disabled>
509
- Button
510
- </Button>
511
- </View>
512
- </div>
513
- </View>
514
- </Example.Item>
515
- </Example>);
516
- export const group = () => (<Example>
517
- <Example.Item title="with icon">
518
- <Button.Group>
519
- <Button rounded>Submit</Button>
520
- <Button rounded icon={IconZap}/>
521
- </Button.Group>
522
- </Example.Item>
523
- <Example.Item title="variant: solid">
524
- <View gap={2}>
525
- {["neutral", "primary", "critical", "positive", "media"].map((color) => (<Button.Group key={color}>
526
- <Button color={color}>One</Button>
527
- <Button color={color}>Two</Button>
528
- <Button color={color}>Three</Button>
529
- </Button.Group>))}
530
- </View>
531
- </Example.Item>
532
- <Example.Item title="variant: outline">
533
- <View gap={2}>
534
- {["neutral", "primary", "critical", "positive", "media"].map((color) => (<Button.Group key={color}>
535
- <Button color={color} variant="outline">
536
- One
537
- </Button>
538
- <Button color={color} variant="outline">
539
- Two
540
- </Button>
541
- <Button color={color} variant="outline">
542
- Three
543
- </Button>
544
- </Button.Group>))}
545
- </View>
546
- </Example.Item>
547
- <Example.Item title="variant: faded">
548
- <View gap={2}>
549
- {["neutral", "primary", "critical", "positive", "media"].map((color) => (<Button.Group key={color}>
550
- <Button color={color} variant="faded">
551
- One
552
- </Button>
553
- <Button color={color} variant="faded">
554
- Two
555
- </Button>
556
- <Button color={color} variant="faded">
557
- Three
558
- </Button>
559
- </Button.Group>))}
560
- </View>
561
- </Example.Item>
526
+ <Example.Item title="disabled, color: media">
527
+ <View aspectRatio={16 / 9}>
528
+ <Image src={imgUrl}/>
562
529
 
563
- <Example.Item title="variant: ghost">
564
- <View gap={2}>
565
- {["neutral", "primary", "critical", "positive"].map((color) => (<Button.Group key={color}>
566
- <Button color={color} variant="ghost">
567
- One
568
- </Button>
569
- <Button color={color} variant="ghost">
570
- Two
571
- </Button>
572
- <Button color={color} variant="ghost">
573
- Three
574
- </Button>
575
- </Button.Group>))}
576
- </View>
577
- </Example.Item>
578
- </Example>);
579
- export const aligner = () => (<Example>
580
- <Example.Item title="aligner: all">
581
- <View padding={4} borderColor="neutral-faded" direction="row" gap={2}>
582
- <View.Item grow>Content</View.Item>
583
- <Button.Aligner>
584
- <Button icon={IconZap} variant="ghost"/>
585
- </Button.Aligner>
586
- </View>
587
- </Example.Item>
530
+ <div style={{ position: "absolute", top: 16, left: 16 }}>
531
+ <View gap={3} direction="row">
532
+ <Button color="media" disabled>
533
+ Button
534
+ </Button>
535
+ <Button color="media" variant="faded" disabled>
536
+ Button
537
+ </Button>
538
+ </View>
539
+ </div>
540
+ </View>
541
+ </Example.Item>
542
+ </Example>),
543
+ play: ({ canvas }) => {
544
+ const el = canvas.getAllByRole("button")[0];
545
+ expect(el).toBeDisabled();
546
+ },
547
+ };
548
+ export const aligner = {
549
+ name: "aligner",
550
+ render: () => (<Example>
551
+ <Example.Item title="aligner: all">
552
+ <View padding={4} borderColor="neutral-faded" direction="row" gap={2}>
553
+ <View.Item grow>Content</View.Item>
554
+ <Button.Aligner>
555
+ <Button icon={IconZap} variant="ghost"/>
556
+ </Button.Aligner>
557
+ </View>
558
+ </Example.Item>
588
559
 
589
- <Example.Item title="aligner: top">
590
- <View padding={4} borderColor="neutral-faded" direction="row" gap={2}>
591
- <View.Item grow>
592
- <Placeholder />
593
- </View.Item>
594
- <Button.Aligner side="top">
595
- <Button icon={IconZap} variant="ghost"/>
596
- </Button.Aligner>
597
- </View>
598
- </Example.Item>
560
+ <Example.Item title="aligner: top">
561
+ <View padding={4} borderColor="neutral-faded" direction="row" gap={2}>
562
+ <View.Item grow>
563
+ <Placeholder />
564
+ </View.Item>
565
+ <Button.Aligner side="top">
566
+ <Button icon={IconZap} variant="ghost"/>
567
+ </Button.Aligner>
568
+ </View>
569
+ </Example.Item>
599
570
 
600
- <Example.Item title="aligner: top and end">
601
- <View padding={4} borderColor="neutral-faded" direction="row" gap={2}>
602
- <View.Item grow>
603
- <Placeholder />
604
- </View.Item>
605
- <Button.Aligner side={["top", "end"]}>
606
- <Button icon={IconZap} variant="ghost"/>
607
- </Button.Aligner>
608
- </View>
609
- </Example.Item>
571
+ <Example.Item title="aligner: top and end">
572
+ <View padding={4} borderColor="neutral-faded" direction="row" gap={2}>
573
+ <View.Item grow>
574
+ <Placeholder />
575
+ </View.Item>
576
+ <Button.Aligner side={["top", "end"]}>
577
+ <Button icon={IconZap} variant="ghost"/>
578
+ </Button.Aligner>
579
+ </View>
580
+ </Example.Item>
610
581
 
611
- <Example.Item title="aligner: bottom">
612
- <View padding={4} borderColor="neutral-faded" direction="row" gap={2} align="end">
613
- <View.Item grow>
614
- <Placeholder />
615
- </View.Item>
616
- <Button.Aligner side="bottom">
617
- <Button icon={IconZap} variant="ghost"/>
618
- </Button.Aligner>
619
- </View>
620
- </Example.Item>
582
+ <Example.Item title="aligner: bottom">
583
+ <View padding={4} borderColor="neutral-faded" direction="row" gap={2} align="end">
584
+ <View.Item grow>
585
+ <Placeholder />
586
+ </View.Item>
587
+ <Button.Aligner side="bottom">
588
+ <Button icon={IconZap} variant="ghost"/>
589
+ </Button.Aligner>
590
+ </View>
591
+ </Example.Item>
621
592
 
622
- <Example.Item title="aligner: start">
623
- <View padding={4} borderColor="neutral-faded" gap={2} align="start">
624
- <View.Item grow>
625
- <Placeholder />
626
- </View.Item>
627
- <Button.Aligner side="start">
628
- <Button icon={IconZap} variant="ghost"/>
629
- </Button.Aligner>
630
- </View>
631
- </Example.Item>
593
+ <Example.Item title="aligner: start">
594
+ <View padding={4} borderColor="neutral-faded" gap={2} align="start">
595
+ <View.Item grow>
596
+ <Placeholder />
597
+ </View.Item>
598
+ <Button.Aligner side="start">
599
+ <Button icon={IconZap} variant="ghost"/>
600
+ </Button.Aligner>
601
+ </View>
602
+ </Example.Item>
632
603
 
633
- <Example.Item title="aligner: end">
634
- <View padding={4} borderColor="neutral-faded" gap={2} align="end">
635
- <View.Item grow>
636
- <Placeholder />
637
- </View.Item>
638
- <Button.Aligner side="end">
639
- <Button icon={IconZap} variant="ghost"/>
640
- </Button.Aligner>
641
- </View>
642
- </Example.Item>
643
- </Example>);
644
- export const composition = () => (<Example>
645
- <Example.Item title="slot gap">
646
- <Button variant="outline">
647
- <Avatar size={6} initials="RS"/>
648
- Label
649
- <Hotkey>B</Hotkey>
604
+ <Example.Item title="aligner: end">
605
+ <View padding={4} borderColor="neutral-faded" gap={2} align="end">
606
+ <View.Item grow>
607
+ <Placeholder />
608
+ </View.Item>
609
+ <Button.Aligner side="end">
610
+ <Button icon={IconZap} variant="ghost"/>
611
+ </Button.Aligner>
612
+ </View>
613
+ </Example.Item>
614
+ </Example>),
615
+ };
616
+ export const composition = {
617
+ name: "test: composition",
618
+ render: () => (<Example>
619
+ <Example.Item title="slot gap">
620
+ <Button variant="outline">
621
+ <Avatar size={6} initials="RS"/>
622
+ Label
623
+ <Hotkey>B</Hotkey>
624
+ </Button>
625
+ </Example.Item>
626
+ </Example>),
627
+ };
628
+ export const href = {
629
+ name: "href",
630
+ render: () => <Button href="https://reshaped.so">Trigger</Button>,
631
+ play: async ({ canvas }) => {
632
+ const el = canvas.getByRole("link");
633
+ expect(el).toHaveAttribute("href", "https://reshaped.so");
634
+ },
635
+ };
636
+ export const onClick = {
637
+ name: "onClick",
638
+ args: {
639
+ handleClick: fn(),
640
+ },
641
+ render: (args) => <Button onClick={args.handleClick}>Trigger</Button>,
642
+ play: async ({ canvas, args }) => {
643
+ const { handleClick } = args;
644
+ const el = canvas.getAllByRole("button")[0];
645
+ await userEvent.click(el);
646
+ expect(el).toHaveAttribute("type", "button");
647
+ expect(handleClick).toHaveBeenCalledTimes(1);
648
+ expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
649
+ },
650
+ };
651
+ export const hrefOnClick = {
652
+ name: "href, onClick",
653
+ args: {
654
+ handleClick: fn(),
655
+ },
656
+ render: (args) => (<Button onClick={(e) => {
657
+ e.preventDefault();
658
+ args.handleClick(e);
659
+ }} href="https://reshaped.so">
660
+ Trigger
661
+ </Button>),
662
+ play: async ({ canvas, args }) => {
663
+ const { handleClick } = args;
664
+ const el = canvas.getByRole("link");
665
+ await userEvent.click(el);
666
+ expect(el).toHaveAttribute("href", "https://reshaped.so");
667
+ expect(handleClick).toHaveBeenCalledTimes(1);
668
+ expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
669
+ },
670
+ };
671
+ export const as = {
672
+ name: "as",
673
+ render: () => (<Example>
674
+ <Example.Item title="as: span">
675
+ <Button onClick={() => { }} as="span">
676
+ Trigger
677
+ </Button>
678
+ </Example.Item>
679
+ <Example.Item title="render, disabled">
680
+ <Button disabled onClick={() => { }} render={(props) => <section {...props}/>} attributes={{ "data-testid": "render-el" }}>
681
+ Trigger
682
+ </Button>
683
+ </Example.Item>
684
+ </Example>),
685
+ play: ({ canvas }) => {
686
+ const [asEl] = canvas.getAllByText("Trigger");
687
+ const renderEl = canvas.getByTestId("render-el");
688
+ expect(asEl.tagName).toBe("SPAN");
689
+ expect(renderEl.tagName).toBe("SECTION");
690
+ expect(renderEl).toHaveAttribute("aria-disabled", "true");
691
+ },
692
+ };
693
+ export const className = {
694
+ name: "className, attributes",
695
+ render: () => (<div data-testid="root">
696
+ <Button className="test-classname" attributes={{ id: "test-id" }}>
697
+ Trigger
650
698
  </Button>
651
- </Example.Item>
652
- </Example>);
699
+ </div>),
700
+ play: async ({ canvas }) => {
701
+ const root = canvas.getByTestId("root").firstChild;
702
+ expect(root).toHaveClass("test-classname");
703
+ expect(root).toHaveAttribute("id", "test-id");
704
+ },
705
+ };
706
+ export const group = {
707
+ name: "group",
708
+ render: () => (<Example>
709
+ <Example.Item title="with icon">
710
+ <Button.Group>
711
+ <Button rounded>Submit</Button>
712
+ <Button rounded icon={IconZap}/>
713
+ </Button.Group>
714
+ </Example.Item>
715
+ <Example.Item title="variant: solid">
716
+ <View gap={2}>
717
+ {["neutral", "primary", "critical", "positive", "media"].map((color) => (<Button.Group key={color}>
718
+ <Button color={color}>One</Button>
719
+ <Button color={color}>Two</Button>
720
+ <Button color={color}>Three</Button>
721
+ </Button.Group>))}
722
+ </View>
723
+ </Example.Item>
724
+ <Example.Item title="variant: outline">
725
+ <View gap={2}>
726
+ {["neutral", "primary", "critical", "positive", "media"].map((color) => (<Button.Group key={color}>
727
+ <Button color={color} variant="outline">
728
+ One
729
+ </Button>
730
+ <Button color={color} variant="outline">
731
+ Two
732
+ </Button>
733
+ <Button color={color} variant="outline">
734
+ Three
735
+ </Button>
736
+ </Button.Group>))}
737
+ </View>
738
+ </Example.Item>
739
+ <Example.Item title="variant: faded">
740
+ <View gap={2}>
741
+ {["neutral", "primary", "critical", "positive", "media"].map((color) => (<Button.Group key={color}>
742
+ <Button color={color} variant="faded">
743
+ One
744
+ </Button>
745
+ <Button color={color} variant="faded">
746
+ Two
747
+ </Button>
748
+ <Button color={color} variant="faded">
749
+ Three
750
+ </Button>
751
+ </Button.Group>))}
752
+ </View>
753
+ </Example.Item>
754
+
755
+ <Example.Item title="variant: ghost">
756
+ <View gap={2}>
757
+ {["neutral", "primary", "critical", "positive"].map((color) => (<Button.Group key={color}>
758
+ <Button color={color} variant="ghost">
759
+ One
760
+ </Button>
761
+ <Button color={color} variant="ghost">
762
+ Two
763
+ </Button>
764
+ <Button color={color} variant="ghost">
765
+ Three
766
+ </Button>
767
+ </Button.Group>))}
768
+ </View>
769
+ </Example.Item>
770
+ </Example>),
771
+ play: async ({ canvas }) => {
772
+ const [el] = canvas.getAllByRole("group");
773
+ expect(el).toBeInTheDocument();
774
+ expect(el.childElementCount).toEqual(2);
775
+ },
776
+ };
777
+ export const groupClassName = {
778
+ name: "group className, attributes",
779
+ render: () => (<div data-testid="root">
780
+ <Button.Group className="test-classname" attributes={{ id: "test-id" }}>
781
+ <Button>Trigger</Button>
782
+ </Button.Group>
783
+ </div>),
784
+ play: async ({ canvas }) => {
785
+ const root = canvas.getByTestId("root").firstChild;
786
+ expect(root).toHaveClass("test-classname");
787
+ expect(root).toHaveAttribute("id", "test-id");
788
+ },
789
+ };