reshaped 3.3.10 → 3.3.12

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 (284) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/bundle.css +1 -1
  3. package/dist/bundle.js +10 -10
  4. package/dist/cjs/themes/_generator/utilities/generateColors.d.ts +1 -1
  5. package/dist/cjs/themes/_generator/utilities/generateColors.js +3 -2
  6. package/dist/cjs/themes/_generator/utilities/tests/color.test.js +32 -31
  7. package/dist/cjs/themes/slate/theme.css +1 -1
  8. package/dist/components/Accordion/tests/Accordion.stories.d.ts +30 -8
  9. package/dist/components/Accordion/tests/Accordion.stories.js +172 -119
  10. package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +12 -3
  11. package/dist/components/ActionBar/tests/ActionBar.stories.js +51 -36
  12. package/dist/components/ActionBar/tests/ActionBar.test.stories.d.ts +15 -0
  13. package/dist/components/ActionBar/tests/ActionBar.test.stories.js +26 -0
  14. package/dist/components/Actionable/Actionable.js +1 -1
  15. package/dist/components/Actionable/Actionable.types.d.ts +3 -3
  16. package/dist/components/Actionable/tests/Actionable.stories.d.ts +19 -5
  17. package/dist/components/Actionable/tests/Actionable.stories.js +88 -63
  18. package/dist/components/Actionable/tests/Actionable.test.stories.d.ts +32 -0
  19. package/dist/components/Actionable/tests/Actionable.test.stories.js +130 -0
  20. package/dist/components/Alert/Alert.js +1 -1
  21. package/dist/components/Alert/tests/Alert.stories.d.ts +12 -3
  22. package/dist/components/Alert/tests/Alert.stories.js +51 -86
  23. package/dist/components/Alert/tests/Alert.test.stories.d.ts +15 -0
  24. package/dist/components/Alert/tests/Alert.test.stories.js +26 -0
  25. package/dist/components/Autocomplete/Autocomplete.js +9 -2
  26. package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +6 -2
  27. package/dist/components/Autocomplete/tests/Autocomplete.stories.js +94 -111
  28. package/dist/components/Autocomplete/tests/Autocomplete.test.stories.d.ts +23 -0
  29. package/dist/components/Autocomplete/tests/Autocomplete.test.stories.js +86 -0
  30. package/dist/components/Avatar/Avatar.js +1 -1
  31. package/dist/components/Avatar/tests/Avatar.stories.d.ts +14 -4
  32. package/dist/components/Avatar/tests/Avatar.stories.js +94 -80
  33. package/dist/components/Avatar/tests/Avatar.test.stories.d.ts +17 -0
  34. package/dist/components/Avatar/tests/Avatar.test.stories.js +39 -0
  35. package/dist/components/Badge/tests/Badge.stories.d.ts +33 -8
  36. package/dist/components/Badge/tests/Badge.stories.js +238 -212
  37. package/dist/components/Badge/tests/Badge.test.stories.d.ts +20 -0
  38. package/dist/components/Badge/tests/Badge.test.stories.js +44 -0
  39. package/dist/components/Breadcrumbs/Breadcrumbs.js +2 -2
  40. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +1 -0
  41. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +24 -5
  42. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +114 -95
  43. package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.d.ts +23 -0
  44. package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.js +76 -0
  45. package/dist/components/Button/Button.js +5 -2
  46. package/dist/components/Button/Button.module.css +1 -1
  47. package/dist/components/Button/Button.types.d.ts +1 -0
  48. package/dist/components/Button/tests/Button.stories.d.ts +2 -2
  49. package/dist/components/Button/tests/Button.stories.js +77 -74
  50. package/dist/components/Button/tests/Button.test.stories.d.ts +27 -0
  51. package/dist/components/Button/tests/Button.test.stories.js +112 -0
  52. package/dist/components/Calendar/tests/Calendar.test.stories.d.ts +26 -0
  53. package/dist/components/Calendar/tests/Calendar.test.stories.js +161 -0
  54. package/dist/components/Card/Card.d.ts +3 -3
  55. package/dist/components/Card/Card.types.d.ts +1 -1
  56. package/dist/components/Card/tests/Card.stories.d.ts +3 -4
  57. package/dist/components/Card/tests/Card.stories.js +0 -11
  58. package/dist/components/Card/tests/Card.test.stories.d.ts +35 -0
  59. package/dist/components/Card/tests/Card.test.stories.js +54 -0
  60. package/dist/components/Carousel/Carousel.types.d.ts +1 -1
  61. package/dist/components/Carousel/CarouselControl.js +1 -1
  62. package/dist/components/Carousel/tests/Carousel.stories.d.ts +3 -0
  63. package/dist/components/Carousel/tests/Carousel.stories.js +5 -1
  64. package/dist/components/Carousel/tests/Carousel.test.stories.d.ts +17 -0
  65. package/dist/components/Carousel/tests/Carousel.test.stories.js +52 -0
  66. package/dist/components/Checkbox/tests/Checkbox.test.stories.d.ts +25 -0
  67. package/dist/components/Checkbox/tests/Checkbox.test.stories.js +104 -0
  68. package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.d.ts +22 -0
  69. package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.js +78 -0
  70. package/dist/components/Container/Container.module.css +1 -1
  71. package/dist/components/Container/tests/Container.stories.d.ts +12 -3
  72. package/dist/components/Container/tests/Container.stories.js +50 -31
  73. package/dist/components/Container/tests/Container.test.stories.d.ts +15 -0
  74. package/dist/components/Container/tests/Container.test.stories.js +26 -0
  75. package/dist/components/ContextMenu/ContextMenu.js +13 -9
  76. package/dist/components/ContextMenu/tests/ContextMenu.stories.js +2 -3
  77. package/dist/components/ContextMenu/tests/ContextMenu.test.stories.d.ts +26 -0
  78. package/dist/components/ContextMenu/tests/ContextMenu.test.stories.js +53 -0
  79. package/dist/components/Dismissible/Dismissible.js +1 -1
  80. package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +10 -3
  81. package/dist/components/Dismissible/tests/Dismissible.stories.js +51 -34
  82. package/dist/components/Dismissible/tests/Dismissible.test.stories.d.ts +19 -0
  83. package/dist/components/Dismissible/tests/Dismissible.test.stories.js +42 -0
  84. package/dist/components/Divider/tests/Divider.test.stories.d.ts +18 -0
  85. package/dist/components/Divider/tests/Divider.test.stories.js +47 -0
  86. package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
  87. package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +37 -0
  88. package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.js +117 -0
  89. package/dist/components/FileUpload/tests/FileUpload.test.stories.d.ts +22 -0
  90. package/dist/components/FileUpload/tests/FileUpload.test.stories.js +52 -0
  91. package/dist/components/FormControl/FormControl.context.d.ts +12 -0
  92. package/dist/components/FormControl/FormControlCaption.js +1 -1
  93. package/dist/components/FormControl/FormControlLabel.js +1 -1
  94. package/dist/components/FormControl/tests/FormControl.stories.d.ts +11 -5
  95. package/dist/components/FormControl/tests/FormControl.stories.js +78 -73
  96. package/dist/components/FormControl/tests/FormControl.test.stories.d.ts +20 -0
  97. package/dist/components/FormControl/tests/FormControl.test.stories.js +49 -0
  98. package/dist/components/Grid/Grid.d.ts +2 -2
  99. package/dist/components/Grid/Grid.types.d.ts +3 -2
  100. package/dist/components/Grid/tests/Grid.stories.d.ts +22 -7
  101. package/dist/components/Grid/tests/Grid.stories.js +164 -149
  102. package/dist/components/Grid/tests/Grid.test.stories.d.ts +19 -0
  103. package/dist/components/Grid/tests/Grid.test.stories.js +42 -0
  104. package/dist/components/Hidden/Hidden.types.d.ts +1 -1
  105. package/dist/components/Hidden/tests/Hidden.stories.d.ts +4 -1
  106. package/dist/components/Hidden/tests/Hidden.stories.js +28 -25
  107. package/dist/components/Hidden/tests/Hidden.test.stories.d.ts +15 -0
  108. package/dist/components/Hidden/tests/Hidden.test.stories.js +20 -0
  109. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +4 -1
  110. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +8 -5
  111. package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.d.ts +15 -0
  112. package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.js +20 -0
  113. package/dist/components/Hotkey/tests/Hotkey.test.stories.d.ts +15 -0
  114. package/dist/components/Hotkey/tests/Hotkey.test.stories.js +26 -0
  115. package/dist/components/Icon/tests/Icon.stories.d.ts +12 -3
  116. package/dist/components/Icon/tests/Icon.stories.js +69 -60
  117. package/dist/components/Icon/tests/Icon.test.stories.d.ts +16 -0
  118. package/dist/components/Icon/tests/Icon.test.stories.js +35 -0
  119. package/dist/components/Image/tests/Image.stories.d.ts +24 -5
  120. package/dist/components/Image/tests/Image.stories.js +95 -75
  121. package/dist/components/Image/tests/Image.test.stories.d.ts +25 -0
  122. package/dist/components/Image/tests/Image.test.stories.js +80 -0
  123. package/dist/components/Link/tests/Link.test.stories.d.ts +29 -0
  124. package/dist/components/Link/tests/Link.test.stories.js +87 -0
  125. package/dist/components/Loader/Loader.js +1 -1
  126. package/dist/components/Loader/Loader.types.d.ts +1 -0
  127. package/dist/components/Loader/tests/Loader.stories.js +8 -8
  128. package/dist/components/Loader/tests/Loader.test.stories.d.ts +16 -0
  129. package/dist/components/Loader/tests/Loader.test.stories.js +32 -0
  130. package/dist/components/MenuItem/tests/MenuItem.test.stories.d.ts +26 -0
  131. package/dist/components/MenuItem/tests/MenuItem.test.stories.js +100 -0
  132. package/dist/components/Modal/Modal.types.d.ts +1 -1
  133. package/dist/components/Modal/tests/Modal.test.stories.d.ts +32 -0
  134. package/dist/components/Modal/tests/Modal.test.stories.js +149 -0
  135. package/dist/components/Overlay/Overlay.types.d.ts +1 -1
  136. package/dist/components/Overlay/tests/Overlay.stories.d.ts +4 -2
  137. package/dist/components/Overlay/tests/Overlay.stories.js +53 -53
  138. package/dist/components/Overlay/tests/Overlay.test.stories.d.ts +28 -0
  139. package/dist/components/Overlay/tests/Overlay.test.stories.js +146 -0
  140. package/dist/components/Pagination/tests/Pagination.test.stories.d.ts +23 -0
  141. package/dist/components/Pagination/tests/Pagination.test.stories.js +86 -0
  142. package/dist/components/PinField/tests/PinField.stories.d.ts +0 -1
  143. package/dist/components/PinField/tests/PinField.stories.js +10 -19
  144. package/dist/components/PinField/tests/PinField.test.stories.d.ts +29 -0
  145. package/dist/components/PinField/tests/PinField.test.stories.js +177 -0
  146. package/dist/components/Popover/tests/Popover.test.stories.d.ts +40 -0
  147. package/dist/components/Popover/tests/Popover.test.stories.js +167 -0
  148. package/dist/components/Progress/Progress.js +2 -2
  149. package/dist/components/Progress/Progress.types.d.ts +1 -0
  150. package/dist/components/Progress/tests/Progress.stories.js +10 -10
  151. package/dist/components/Progress/tests/Progress.test.stories.d.ts +16 -0
  152. package/dist/components/Progress/tests/Progress.test.stories.js +35 -0
  153. package/dist/components/Radio/tests/Radio.test.stories.d.ts +30 -0
  154. package/dist/components/Radio/tests/Radio.test.stories.js +118 -0
  155. package/dist/components/RadioGroup/tests/RadioGroup.test.stories.d.ts +22 -0
  156. package/dist/components/RadioGroup/tests/RadioGroup.test.stories.js +78 -0
  157. package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +33 -0
  158. package/dist/components/Reshaped/tests/Reshaped.stories.js +88 -0
  159. package/dist/components/Resizable/Resizable.js +4 -1
  160. package/dist/components/Resizable/Resizable.types.d.ts +2 -2
  161. package/dist/components/Resizable/tests/Resizable.stories.d.ts +3 -0
  162. package/dist/components/Resizable/tests/Resizable.stories.js +4 -0
  163. package/dist/components/Resizable/tests/Resizable.test.stories.d.ts +19 -0
  164. package/dist/components/Resizable/tests/Resizable.test.stories.js +25 -0
  165. package/dist/components/Scrim/tests/Scrim.test.stories.d.ts +15 -0
  166. package/dist/components/Scrim/tests/Scrim.test.stories.js +25 -0
  167. package/dist/components/ScrollArea/ScrollArea.js +1 -1
  168. package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
  169. package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +17 -4
  170. package/dist/components/ScrollArea/tests/ScrollArea.stories.js +114 -139
  171. package/dist/components/ScrollArea/tests/ScrollArea.test.stories.d.ts +23 -0
  172. package/dist/components/ScrollArea/tests/ScrollArea.test.stories.js +66 -0
  173. package/dist/components/Select/tests/Select.stories.d.ts +1 -1
  174. package/dist/components/Select/tests/Select.stories.js +5 -12
  175. package/dist/components/Select/tests/Select.test.stories.d.ts +27 -0
  176. package/dist/components/Select/tests/Select.test.stories.js +132 -0
  177. package/dist/components/Skeleton/tests/Skeleton.test.stories.d.ts +15 -0
  178. package/dist/components/Skeleton/tests/Skeleton.test.stories.js +23 -0
  179. package/dist/components/Slider/Slider.types.d.ts +1 -1
  180. package/dist/components/Slider/tests/Slider.stories.d.ts +0 -1
  181. package/dist/components/Slider/tests/Slider.stories.js +8 -9
  182. package/dist/components/Slider/tests/Slider.test.stories.d.ts +38 -0
  183. package/dist/components/Slider/tests/Slider.test.stories.js +150 -0
  184. package/dist/components/Stepper/Stepper.js +1 -1
  185. package/dist/components/Stepper/tests/Stepper.stories.js +0 -3
  186. package/dist/components/Stepper/tests/Stepper.test.stories.d.ts +18 -0
  187. package/dist/components/Stepper/tests/Stepper.test.stories.js +28 -0
  188. package/dist/components/Switch/tests/Switch.test.stories.d.ts +23 -0
  189. package/dist/components/Switch/tests/Switch.test.stories.js +79 -0
  190. package/dist/components/Table/tests/Table.test.stories.d.ts +25 -0
  191. package/dist/components/Table/tests/Table.test.stories.js +93 -0
  192. package/dist/components/Tabs/Tabs.types.d.ts +3 -3
  193. package/dist/components/Tabs/TabsContext.d.ts +3 -3
  194. package/dist/components/Tabs/TabsItem.js +1 -1
  195. package/dist/components/Tabs/tests/Tabs.stories.js +4 -4
  196. package/dist/components/Tabs/tests/Tabs.test.stories.d.ts +28 -0
  197. package/dist/components/Tabs/tests/Tabs.test.stories.js +128 -0
  198. package/dist/components/Text/Text.d.ts +1 -1
  199. package/dist/components/Text/Text.types.d.ts +1 -1
  200. package/dist/components/Text/tests/Text.stories.d.ts +29 -8
  201. package/dist/components/Text/tests/Text.stories.js +148 -125
  202. package/dist/components/Text/tests/Text.test.stories.d.ts +18 -0
  203. package/dist/components/Text/tests/Text.test.stories.js +49 -0
  204. package/dist/components/TextArea/TextArea.module.css +1 -1
  205. package/dist/components/TextArea/tests/TextArea.stories.js +1 -1
  206. package/dist/components/TextArea/tests/TextArea.test.stories.d.ts +29 -0
  207. package/dist/components/TextArea/tests/TextArea.test.stories.js +99 -0
  208. package/dist/components/TextField/TextField.js +3 -1
  209. package/dist/components/TextField/tests/TextField.stories.js +1 -1
  210. package/dist/components/TextField/tests/TextField.test.stories.d.ts +29 -0
  211. package/dist/components/TextField/tests/TextField.test.stories.js +99 -0
  212. package/dist/components/Theme/Theme.types.d.ts +2 -2
  213. package/dist/components/Theme/tests/Theme.test.stories.d.ts +24 -0
  214. package/dist/components/Theme/tests/Theme.test.stories.js +133 -0
  215. package/dist/components/Timeline/tests/Timeline.test.stories.d.ts +18 -0
  216. package/dist/components/Timeline/tests/Timeline.test.stories.js +32 -0
  217. package/dist/components/Toast/ToastContainer.js +1 -1
  218. package/dist/components/Toast/tests/Toast.test.stories.d.ts +16 -0
  219. package/dist/components/Toast/tests/Toast.test.stories.js +101 -0
  220. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  221. package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +1 -1
  222. package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -14
  223. package/dist/components/Tooltip/tests/Tooltip.test.stories.d.ts +19 -0
  224. package/dist/components/Tooltip/tests/Tooltip.test.stories.js +40 -0
  225. package/dist/components/View/View.d.ts +2 -2
  226. package/dist/components/View/View.js +4 -4
  227. package/dist/components/View/View.types.d.ts +2 -2
  228. package/dist/components/View/tests/View.stories.d.ts +114 -30
  229. package/dist/components/View/tests/View.stories.js +1092 -1012
  230. package/dist/components/View/tests/View.test.stories.d.ts +20 -0
  231. package/dist/components/View/tests/View.test.stories.js +50 -0
  232. package/dist/components/_private/Flyout/Flyout.types.d.ts +6 -6
  233. package/dist/components/_private/Flyout/FlyoutContent.js +1 -1
  234. package/dist/components/_private/Flyout/FlyoutControlled.js +5 -3
  235. package/dist/components/_private/Flyout/tests/Flyout.stories.js +5 -5
  236. package/dist/components/_private/Flyout/tests/Flyout.test.stories.d.ts +28 -0
  237. package/dist/components/_private/Flyout/tests/Flyout.test.stories.js +205 -0
  238. package/dist/components/_private/Flyout/useFlyout.d.ts +3 -3
  239. package/dist/components/_private/Portal/Portal.types.d.ts +3 -3
  240. package/dist/components/_private/Portal/tests/Portal.stories.js +1 -1
  241. package/dist/hooks/_private/useIsDismissible.d.ts +1 -1
  242. package/dist/hooks/_private/useOnClickOutside.d.ts +1 -1
  243. package/dist/hooks/_private/useSingletonHotkeys.d.ts +3 -3
  244. package/dist/hooks/_private/useSingletonHotkeys.js +1 -1
  245. package/dist/hooks/tests/useDrag.stories.js +1 -0
  246. package/dist/hooks/tests/useDrag.test.stories.d.ts +26 -0
  247. package/dist/hooks/tests/useDrag.test.stories.js +120 -0
  248. package/dist/hooks/tests/useElementId.stories.d.ts +6 -0
  249. package/dist/hooks/tests/useElementId.stories.js +19 -0
  250. package/dist/hooks/tests/useHotkeys.test.stories.d.ts +39 -0
  251. package/dist/hooks/tests/useHotkeys.test.stories.js +119 -0
  252. package/dist/hooks/tests/useRTL.stories.d.ts +6 -0
  253. package/dist/hooks/tests/useRTL.stories.js +25 -0
  254. package/dist/hooks/tests/useResponsiveClientValue.stories.d.ts +9 -1
  255. package/dist/hooks/tests/useResponsiveClientValue.stories.js +22 -9
  256. package/dist/hooks/tests/useScrollLock.stories.d.ts +6 -0
  257. package/dist/hooks/tests/useScrollLock.stories.js +22 -0
  258. package/dist/hooks/tests/useToggle.stories.d.ts +8 -0
  259. package/dist/hooks/tests/useToggle.stories.js +54 -0
  260. package/dist/hooks/useDrag.d.ts +3 -3
  261. package/dist/hooks/useHotkeys.d.ts +2 -2
  262. package/dist/hooks/useHotkeys.js +3 -1
  263. package/dist/hooks/useScrollLock.d.ts +2 -1
  264. package/dist/hooks/useScrollLock.js +7 -3
  265. package/dist/tests/ShadowDOM.stories.js +1 -1
  266. package/dist/themes/_generator/tests/themes.stories.d.ts +3 -0
  267. package/dist/themes/_generator/tests/themes.stories.js +7 -11
  268. package/dist/themes/_generator/utilities/generateColors.d.ts +1 -1
  269. package/dist/themes/_generator/utilities/generateColors.js +3 -2
  270. package/dist/themes/slate/theme.css +1 -1
  271. package/dist/types/global.d.ts +1 -1
  272. package/dist/utilities/helpers.d.ts +1 -0
  273. package/dist/utilities/helpers.js +3 -0
  274. package/dist/utilities/scroll/lock.d.ts +1 -0
  275. package/dist/utilities/scroll/lock.js +3 -3
  276. package/dist/utilities/scroll/lockSafari.d.ts +1 -1
  277. package/dist/utilities/scroll/lockSafari.js +4 -5
  278. package/dist/utilities/scroll/lockStandard.d.ts +4 -1
  279. package/dist/utilities/scroll/lockStandard.js +7 -2
  280. package/dist/utilities/storybook/Example.js +1 -2
  281. package/package.json +22 -21
  282. package/dist/components/Theme/tests/Theme.stories.d.ts +0 -13
  283. package/dist/components/Theme/tests/Theme.stories.js +0 -80
  284. package/dist/utilities/storybook/Example.module.css +0 -1
@@ -13,64 +13,73 @@ export default {
13
13
  },
14
14
  },
15
15
  };
16
- export const size = () => (<Example>
17
- <Example.Item title="size: 4">
18
- <Icon svg={IconZap} size={4}/>
19
- </Example.Item>
20
- <Example.Item title="size: 8">
21
- <Icon svg={IconZap} size={8}/>
22
- </Example.Item>
23
- <Example.Item title="size: 100%">
24
- <View width={25} height={25}>
25
- <Icon svg={IconZap} size="100%"/>
26
- </View>
27
- </Example.Item>
28
- <Example.Item title={["responsive size", "[s] 5", "[m]: 10"]}>
29
- <Icon svg={IconZap} size={{ s: 5, m: 10 }}/>
30
- </Example.Item>
31
- <Example.Item title="size: inherit from font">
32
- <Text variant="title-6">
33
- <View direction="row" align="center" gap={2}>
34
- <Icon svg={IconZap}/>
35
- <View.Item>Reshaped</View.Item>
16
+ export const size = {
17
+ name: "size",
18
+ render: () => (<Example>
19
+ <Example.Item title="size: 4">
20
+ <Icon svg={IconZap} size={4}/>
21
+ </Example.Item>
22
+ <Example.Item title="size: 8">
23
+ <Icon svg={IconZap} size={8}/>
24
+ </Example.Item>
25
+ <Example.Item title="size: 100%">
26
+ <View width={25} height={25}>
27
+ <Icon svg={IconZap} size="100%"/>
36
28
  </View>
37
- </Text>
38
- </Example.Item>
39
- </Example>);
40
- export const color = () => (<Example>
41
- <Example.Item title="color: neutral">
42
- <Icon svg={IconZap} color="neutral"/>
43
- </Example.Item>
44
- <Example.Item title="color: neutral-faded">
45
- <Icon svg={IconZap} color="neutral-faded"/>
46
- </Example.Item>
47
- <Example.Item title="color: primary">
48
- <Icon svg={IconZap} color="primary"/>
49
- </Example.Item>
50
- <Example.Item title="color: critical">
51
- <Icon svg={IconZap} color="critical"/>
52
- </Example.Item>
53
- <Example.Item title="color: positive">
54
- <Icon svg={IconZap} color="positive"/>
55
- </Example.Item>
56
- <Example.Item title="color: disabled">
57
- <Icon svg={IconZap} color="disabled"/>
58
- </Example.Item>
59
- <Example.Item title="color: inherit">
60
- <div style={{ color: "tomato" }}>
61
- <Icon svg={IconZap}/>
62
- </div>
63
- </Example.Item>
64
- </Example>);
65
- export const autoWidth = () => (<Example>
66
- <Example.Item title="square boundaries">
67
- <div style={{ background: "var(--rs-color-background-neutral)", display: "inline-block" }}>
68
- <Icon svg={IconMic} size={10}/>
69
- </div>
70
- </Example.Item>
71
- <Example.Item title="auto width boundaries">
72
- <div style={{ background: "var(--rs-color-background-neutral)", display: "inline-block" }}>
73
- <Icon svg={IconMic} size={10} autoWidth/>
74
- </div>
75
- </Example.Item>
76
- </Example>);
29
+ </Example.Item>
30
+ <Example.Item title={["responsive size", "[s] 5", "[m]: 10"]}>
31
+ <Icon svg={IconZap} size={{ s: 5, m: 10 }}/>
32
+ </Example.Item>
33
+ <Example.Item title="size: inherit from font">
34
+ <Text variant="title-6">
35
+ <View direction="row" align="center" gap={2}>
36
+ <Icon svg={IconZap}/>
37
+ <View.Item>Reshaped</View.Item>
38
+ </View>
39
+ </Text>
40
+ </Example.Item>
41
+ </Example>),
42
+ };
43
+ export const color = {
44
+ name: "color",
45
+ render: () => (<Example>
46
+ <Example.Item title="color: neutral">
47
+ <Icon svg={IconZap} color="neutral"/>
48
+ </Example.Item>
49
+ <Example.Item title="color: neutral-faded">
50
+ <Icon svg={IconZap} color="neutral-faded"/>
51
+ </Example.Item>
52
+ <Example.Item title="color: primary">
53
+ <Icon svg={IconZap} color="primary"/>
54
+ </Example.Item>
55
+ <Example.Item title="color: critical">
56
+ <Icon svg={IconZap} color="critical"/>
57
+ </Example.Item>
58
+ <Example.Item title="color: positive">
59
+ <Icon svg={IconZap} color="positive"/>
60
+ </Example.Item>
61
+ <Example.Item title="color: disabled">
62
+ <Icon svg={IconZap} color="disabled"/>
63
+ </Example.Item>
64
+ <Example.Item title="color: inherit">
65
+ <div style={{ color: "tomato" }}>
66
+ <Icon svg={IconZap}/>
67
+ </div>
68
+ </Example.Item>
69
+ </Example>),
70
+ };
71
+ export const autoWidth = {
72
+ name: "autoWidth",
73
+ render: () => (<Example>
74
+ <Example.Item title="square boundaries">
75
+ <div style={{ background: "var(--rs-color-background-neutral)", display: "inline-block" }}>
76
+ <Icon svg={IconMic} size={10}/>
77
+ </div>
78
+ </Example.Item>
79
+ <Example.Item title="auto width boundaries">
80
+ <div style={{ background: "var(--rs-color-background-neutral)", display: "inline-block" }}>
81
+ <Icon svg={IconMic} size={10} autoWidth/>
82
+ </div>
83
+ </Example.Item>
84
+ </Example>),
85
+ };
@@ -0,0 +1,16 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ declare const _default: {
3
+ title: string;
4
+ component: (props: import("./..").IconProps) => import("react").JSX.Element;
5
+ parameters: {
6
+ iframe: {
7
+ url: string;
8
+ };
9
+ chromatic: {
10
+ disableSnapshot: boolean;
11
+ };
12
+ };
13
+ };
14
+ export default _default;
15
+ export declare const render: StoryObj;
16
+ export declare const className: StoryObj;
@@ -0,0 +1,35 @@
1
+ import { expect } from "@storybook/test";
2
+ import Icon from "../index.js";
3
+ import IconZap from "../../../icons/Zap.js";
4
+ export default {
5
+ title: "Utilities/Icon/tests",
6
+ component: Icon,
7
+ parameters: {
8
+ iframe: {
9
+ url: "https://reshaped.so/docs/utilities/icon",
10
+ },
11
+ chromatic: { disableSnapshot: true },
12
+ },
13
+ };
14
+ export const render = {
15
+ name: "render, hidden from sr",
16
+ render: () => (<div data-testid="root">
17
+ <Icon svg={IconZap}/>
18
+ </div>),
19
+ play: ({ canvas }) => {
20
+ const root = canvas.getByTestId("root").firstChild;
21
+ expect(root).toBeInTheDocument();
22
+ expect(root).toHaveAttribute("aria-hidden");
23
+ },
24
+ };
25
+ export const className = {
26
+ name: "className, attributes",
27
+ render: () => (<div data-testid="root">
28
+ <Icon svg={IconZap} className="test-classname" attributes={{ id: "test-id" }}/>
29
+ </div>),
30
+ play: async ({ canvas }) => {
31
+ const root = canvas.getByTestId("root").firstChild;
32
+ expect(root).toHaveClass("test-classname");
33
+ expect(root).toHaveAttribute("id", "test-id");
34
+ },
35
+ };
@@ -8,8 +8,27 @@ declare const _default: {
8
8
  };
9
9
  };
10
10
  export default _default;
11
- export declare const size: () => import("react").JSX.Element;
12
- export declare const radius: () => import("react").JSX.Element;
13
- export declare const displayMode: () => import("react").JSX.Element;
14
- export declare const ratio: () => import("react").JSX.Element;
15
- export declare const fallback: () => import("react").JSX.Element;
11
+ export declare const base: {
12
+ name: string;
13
+ render: () => import("react").JSX.Element;
14
+ };
15
+ export declare const size: {
16
+ name: string;
17
+ render: () => import("react").JSX.Element;
18
+ };
19
+ export declare const radius: {
20
+ name: string;
21
+ render: () => import("react").JSX.Element;
22
+ };
23
+ export declare const displayMode: {
24
+ name: string;
25
+ render: () => import("react").JSX.Element;
26
+ };
27
+ export declare const ratio: {
28
+ name: string;
29
+ render: () => import("react").JSX.Element;
30
+ };
31
+ export declare const fallback: {
32
+ name: string;
33
+ render: () => import("react").JSX.Element;
34
+ };
@@ -13,85 +13,105 @@ export default {
13
13
  },
14
14
  };
15
15
  const imgUrl = "https://images.unsplash.com/photo-1536880756060-98a6a140f0a7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80";
16
- export const size = () => (<Example>
17
- <Example.Item title="size: auto">
18
- <Image src={imgUrl} alt="Image alt"/>
19
- </Example.Item>
20
- <Example.Item title="width: 200px">
21
- <Image src={imgUrl} width="200px"/>
22
- </Example.Item>
23
- <Example.Item title="height: 200px">
24
- <Image src={imgUrl} height="200px"/>
25
- </Example.Item>
26
- <Example.Item title={["responsive width", "[s] 200px", "[m+] 300px"]}>
27
- <Image src={imgUrl} width={{ s: "200px", m: "300px" }}/>
28
- </Example.Item>
29
- </Example>);
30
- export const radius = () => (<Example>
31
- <Example.Item title="radius: small">
32
- <View width="300px">
33
- <Image src={imgUrl} borderRadius="small"/>
34
- </View>
35
- </Example.Item>
36
- <Example.Item title="radius: medium">
37
- <View width="300px">
38
- <Image src={imgUrl} borderRadius="medium"/>
39
- </View>
40
- </Example.Item>
41
- <Example.Item title="radius: large">
42
- <View width="300px">
43
- <Image src={imgUrl} borderRadius="large"/>
44
- </View>
45
- </Example.Item>
46
- </Example>);
47
- export const displayMode = () => (<Example>
48
- <Example.Item title="mode: cover">
49
- <Image src={imgUrl} height="200px" width="100%" displayMode="cover"/>
50
- </Example.Item>
51
- <Example.Item title="mode: contain">
52
- <Image src={imgUrl} height="200px" width="100%" displayMode="contain"/>
53
- </Example.Item>
54
- </Example>);
55
- export const ratio = () => (<Example>
56
- <Example.Item title="ratio: 16/9">
57
- <View aspectRatio={16 / 9}>
58
- <Image src={imgUrl}/>
59
- </View>
60
- </Example.Item>
61
- <Example.Item title="ratio: 16/9, displayMode: contain">
62
- <View aspectRatio={16 / 9}>
63
- <Image src={imgUrl} displayMode="contain"/>
64
- </View>
65
- </Example.Item>
66
- </Example>);
67
- export const fallback = () => (<Example>
68
- <Example.Item title="fallback, background, on error">
69
- <View width="300px">
16
+ export const base = {
17
+ name: "base",
18
+ render: () => (<Example>
19
+ <Example.Item title="base">
20
+ <Image src={imgUrl} alt="Image alt"/>
21
+ </Example.Item>
22
+ </Example>),
23
+ };
24
+ export const size = {
25
+ name: "width, height",
26
+ render: () => (<Example>
27
+ <Example.Item title="width: 200px">
28
+ <Image src={imgUrl} width="200px"/>
29
+ </Example.Item>
30
+ <Example.Item title="height: 200px">
31
+ <Image src={imgUrl} height="200px"/>
32
+ </Example.Item>
33
+ <Example.Item title={["responsive width", "[s] 200px", "[m+] 300px"]}>
34
+ <Image src={imgUrl} width={{ s: "200px", m: "300px" }}/>
35
+ </Example.Item>
36
+ </Example>),
37
+ };
38
+ export const radius = {
39
+ name: "borderRadius",
40
+ render: () => (<Example>
41
+ <Example.Item title="radius: small">
42
+ <View width="300px">
43
+ <Image src={imgUrl} borderRadius="small"/>
44
+ </View>
45
+ </Example.Item>
46
+ <Example.Item title="radius: medium">
47
+ <View width="300px">
48
+ <Image src={imgUrl} borderRadius="medium"/>
49
+ </View>
50
+ </Example.Item>
51
+ <Example.Item title="radius: large">
52
+ <View width="300px">
53
+ <Image src={imgUrl} borderRadius="large"/>
54
+ </View>
55
+ </Example.Item>
56
+ </Example>),
57
+ };
58
+ export const displayMode = {
59
+ name: "displayMode",
60
+ render: () => (<Example>
61
+ <Example.Item title="mode: cover">
62
+ <Image src={imgUrl} height="200px" width="100%" displayMode="cover"/>
63
+ </Example.Item>
64
+ <Example.Item title="mode: contain">
65
+ <Image src={imgUrl} height="200px" width="100%" displayMode="contain"/>
66
+ </Example.Item>
67
+ </Example>),
68
+ };
69
+ export const ratio = {
70
+ name: "composition, aspectRatio",
71
+ render: () => (<Example>
72
+ <Example.Item title="ratio: 16/9">
70
73
  <View aspectRatio={16 / 9}>
71
- <Image src="error" fallback/>
74
+ <Image src={imgUrl}/>
72
75
  </View>
73
- </View>
74
- </Example.Item>
75
- <Example.Item title="fallback, image, on error">
76
- <View width="300px">
76
+ </Example.Item>
77
+ <Example.Item title="ratio: 16/9, displayMode: contain">
77
78
  <View aspectRatio={16 / 9}>
78
- <Image src="error" fallback={imgUrl}/>
79
+ <Image src={imgUrl} displayMode="contain"/>
79
80
  </View>
80
- </View>
81
- </Example.Item>
81
+ </Example.Item>
82
+ </Example>),
83
+ };
84
+ export const fallback = {
85
+ name: "fallback",
86
+ render: () => (<Example>
87
+ <Example.Item title="fallback, background, on error">
88
+ <View width="300px">
89
+ <View aspectRatio={16 / 9}>
90
+ <Image src="error" fallback/>
91
+ </View>
92
+ </View>
93
+ </Example.Item>
94
+ <Example.Item title="fallback, image, on error">
95
+ <View width="300px">
96
+ <View aspectRatio={16 / 9}>
97
+ <Image src="error" fallback={imgUrl}/>
98
+ </View>
99
+ </View>
100
+ </Example.Item>
82
101
 
83
- <Example.Item title="fallback, icon, on error">
84
- <View width="300px">
85
- <View aspectRatio={16 / 9}>
86
- <Image src="error" fallback={<Icon svg={IconZap} size={10}/>}/>
102
+ <Example.Item title="fallback, icon, on error">
103
+ <View width="300px">
104
+ <View aspectRatio={16 / 9}>
105
+ <Image src="error" fallback={<Icon svg={IconZap} size={10}/>}/>
106
+ </View>
87
107
  </View>
88
- </View>
89
- </Example.Item>
90
- <Example.Item title="fallback, icon, no url">
91
- <View width="300px">
92
- <View aspectRatio={16 / 9}>
93
- <Image fallback={<Icon svg={IconZap} size={10}/>}/>
108
+ </Example.Item>
109
+ <Example.Item title="fallback, icon, no url">
110
+ <View width="300px">
111
+ <View aspectRatio={16 / 9}>
112
+ <Image fallback={<Icon svg={IconZap} size={10}/>}/>
113
+ </View>
94
114
  </View>
95
- </View>
96
- </Example.Item>
97
- </Example>);
115
+ </Example.Item>
116
+ </Example>),
117
+ };
@@ -0,0 +1,25 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ import { fn } from "@storybook/test";
3
+ declare const _default: {
4
+ title: string;
5
+ component: (props: import("./..").ImageProps) => import("react").JSX.Element;
6
+ parameters: {
7
+ iframe: {
8
+ url: string;
9
+ };
10
+ chromatic: {
11
+ disableSnapshot: boolean;
12
+ };
13
+ };
14
+ };
15
+ export default _default;
16
+ export declare const src: StoryObj;
17
+ export declare const ariaLabel: StoryObj;
18
+ export declare const onLoad: StoryObj<{
19
+ handleLoad: ReturnType<typeof fn>;
20
+ }>;
21
+ export declare const onError: StoryObj<{
22
+ handleError: ReturnType<typeof fn>;
23
+ }>;
24
+ export declare const className: StoryObj;
25
+ export declare const imageAttributes: StoryObj;
@@ -0,0 +1,80 @@
1
+ import { expect, fn, waitFor } from "@storybook/test";
2
+ import Image from "../index.js";
3
+ export default {
4
+ title: "Utilities/Image/tests",
5
+ component: Image,
6
+ parameters: {
7
+ iframe: {
8
+ url: "https://reshaped.so/docs/utilities/image",
9
+ },
10
+ chromatic: { disableSnapshot: true },
11
+ },
12
+ };
13
+ const imgUrl = "https://images.unsplash.com/photo-1536880756060-98a6a140f0a7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80";
14
+ export const src = {
15
+ name: "src, presentation",
16
+ render: () => <Image src={imgUrl}/>,
17
+ play: ({ canvas }) => {
18
+ const img = canvas.getByRole("presentation");
19
+ expect(img).toHaveAttribute("src", imgUrl);
20
+ },
21
+ };
22
+ export const ariaLabel = {
23
+ name: "src, alt",
24
+ render: () => <Image src={imgUrl} alt="photo"/>,
25
+ play: ({ canvas }) => {
26
+ const img = canvas.getByRole("img");
27
+ expect(img).toHaveAccessibleName("photo");
28
+ },
29
+ };
30
+ export const onLoad = {
31
+ name: "onLoad",
32
+ args: {
33
+ handleLoad: fn(),
34
+ },
35
+ render: (args) => <Image src={imgUrl} alt="photo" onLoad={args.handleLoad}/>,
36
+ play: async ({ canvas, args }) => {
37
+ const { handleLoad } = args;
38
+ const img = canvas.getByRole("img");
39
+ await waitFor(() => {
40
+ expect(handleLoad).toHaveBeenCalledTimes(1);
41
+ expect(handleLoad).toHaveBeenCalledWith(expect.objectContaining({ target: img, type: "load" }));
42
+ });
43
+ },
44
+ };
45
+ export const onError = {
46
+ name: "onError",
47
+ args: {
48
+ handleError: fn(),
49
+ },
50
+ render: (args) => <Image src="/invalid.png" alt="photo" onError={args.handleError}/>,
51
+ play: async ({ canvas, args }) => {
52
+ const { handleError } = args;
53
+ const img = canvas.getByRole("img");
54
+ await waitFor(() => {
55
+ expect(handleError).toHaveBeenCalledTimes(1);
56
+ expect(handleError).toHaveBeenCalledWith(expect.objectContaining({ target: img, type: "error" }));
57
+ });
58
+ },
59
+ };
60
+ export const className = {
61
+ name: "className, attributes",
62
+ render: () => (<div data-testid="root">
63
+ <Image src={imgUrl} className="test-classname" attributes={{ id: "test-id" }}/>
64
+ </div>),
65
+ play: async ({ canvas }) => {
66
+ const root = canvas.getByTestId("root").firstChild;
67
+ expect(root).toHaveClass("test-classname");
68
+ expect(root).toHaveAttribute("id", "test-id");
69
+ },
70
+ };
71
+ export const imageAttributes = {
72
+ name: "imageAttributes",
73
+ render: () => (<div data-testid="root">
74
+ <Image src={imgUrl} alt="photo" attributes={{ id: "test-id" }} imageAttributes={{ id: "test-img-id" }}/>
75
+ </div>),
76
+ play: async ({ canvas }) => {
77
+ const img = canvas.getByRole("img");
78
+ expect(img).toHaveAttribute("id", "test-img-id");
79
+ },
80
+ };
@@ -0,0 +1,29 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ import { fn } from "@storybook/test";
3
+ declare const _default: {
4
+ title: string;
5
+ component: import("react").ForwardRefExoticComponent<Pick<import("../../Actionable").ActionableProps, "children" | "disabled" | "className" | "attributes" | "type" | "onClick" | "href" | "stopPropagation"> & {
6
+ icon?: import("../../Icon").IconProps["svg"];
7
+ color?: "inherit" | "critical" | "primary" | "positive" | "warning";
8
+ variant?: "plain" | "underline";
9
+ } & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
10
+ parameters: {
11
+ iframe: {
12
+ url: string;
13
+ };
14
+ chromatic: {
15
+ disableSnapshot: boolean;
16
+ };
17
+ };
18
+ };
19
+ export default _default;
20
+ export declare const children: StoryObj;
21
+ export declare const href: StoryObj;
22
+ export declare const onClick: StoryObj<{
23
+ handleClick: ReturnType<typeof fn>;
24
+ }>;
25
+ export declare const hrefOnClick: StoryObj<{
26
+ handleClick: ReturnType<typeof fn>;
27
+ }>;
28
+ export declare const disabled: StoryObj;
29
+ export declare const className: StoryObj;
@@ -0,0 +1,87 @@
1
+ import { userEvent, expect, fn } from "@storybook/test";
2
+ import Link from "../index.js";
3
+ export default {
4
+ title: "Components/Link/tests",
5
+ component: Link,
6
+ parameters: {
7
+ iframe: {
8
+ url: "https://reshaped.so/docs/components/breadcrumbs",
9
+ },
10
+ chromatic: { disableSnapshot: true },
11
+ },
12
+ };
13
+ export const children = {
14
+ name: "children",
15
+ render: () => <Link>Trigger</Link>,
16
+ play: async ({ canvas }) => {
17
+ const el = canvas.getByText("Trigger");
18
+ expect(el).toBeInTheDocument();
19
+ expect(el.tagName).toBe("SPAN");
20
+ },
21
+ };
22
+ export const href = {
23
+ name: "href",
24
+ render: () => <Link href="https://reshaped.so">Trigger</Link>,
25
+ play: async ({ canvas }) => {
26
+ const el = canvas.getByRole("link");
27
+ expect(el).toHaveAttribute("href", "https://reshaped.so");
28
+ },
29
+ };
30
+ export const onClick = {
31
+ name: "onClick",
32
+ args: {
33
+ handleClick: fn(),
34
+ },
35
+ render: (args) => <Link onClick={args.handleClick}>Trigger</Link>,
36
+ play: async ({ canvas, args }) => {
37
+ const { handleClick } = args;
38
+ const el = canvas.getAllByRole("button")[0];
39
+ await userEvent.click(el);
40
+ expect(el).toHaveAttribute("type", "button");
41
+ expect(handleClick).toHaveBeenCalledTimes(1);
42
+ expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
43
+ },
44
+ };
45
+ export const hrefOnClick = {
46
+ name: "href + onClick",
47
+ args: {
48
+ handleClick: fn(),
49
+ },
50
+ render: (args) => (<Link onClick={(e) => {
51
+ e.preventDefault();
52
+ args.handleClick(e);
53
+ }} href="https://reshaped.so">
54
+ Trigger
55
+ </Link>),
56
+ play: async ({ canvas, args }) => {
57
+ const { handleClick } = args;
58
+ const el = canvas.getByRole("link");
59
+ await userEvent.click(el);
60
+ expect(el).toHaveAttribute("href", "https://reshaped.so");
61
+ expect(handleClick).toHaveBeenCalledTimes(1);
62
+ expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
63
+ },
64
+ };
65
+ export const disabled = {
66
+ name: "disabled",
67
+ render: () => (<Link disabled onClick={() => { }}>
68
+ Trigger
69
+ </Link>),
70
+ play: async ({ canvas }) => {
71
+ const el = canvas.getAllByRole("button")[0];
72
+ expect(el).toBeDisabled();
73
+ },
74
+ };
75
+ export const className = {
76
+ name: "className, attributes",
77
+ render: () => (<div data-testid="root">
78
+ <Link className="test-classname" attributes={{ id: "test-id" }}>
79
+ Trigger
80
+ </Link>
81
+ </div>),
82
+ play: async ({ canvas }) => {
83
+ const root = canvas.getByTestId("root").firstChild;
84
+ expect(root).toHaveClass("test-classname");
85
+ expect(root).toHaveAttribute("id", "test-id");
86
+ },
87
+ };
@@ -3,7 +3,7 @@ import { classNames, responsiveClassNames } from "../../utilities/helpers.js";
3
3
  import s from "./Loader.module.css";
4
4
  const Loader = (props) => {
5
5
  const { size = "small", color = "primary", className, attributes } = props;
6
- const ariaLabel = attributes?.["aria-label"];
6
+ const ariaLabel = props.ariaLabel || attributes?.["aria-label"];
7
7
  const rootClassNames = classNames(s.root, className, responsiveClassNames(s, "--size", size), color && s[`--color-${color}`]);
8
8
  return (_jsx("span", { ...attributes, role: "progressbar", "aria-live": ariaLabel ? "assertive" : undefined, "aria-label": ariaLabel, className: rootClassNames, children: _jsx("span", { className: s.inner }) }));
9
9
  };
@@ -2,6 +2,7 @@ import type * as G from "../../types/global";
2
2
  export type Props = {
3
3
  size?: G.Responsive<"small" | "medium" | "large">;
4
4
  color?: "primary" | "critical" | "positive" | "inherit";
5
+ ariaLabel?: string;
5
6
  className?: G.ClassName;
6
7
  attributes?: G.Attributes<"span">;
7
8
  };