reshaped 3.8.8 → 3.9.0-canary.1

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 (191) hide show
  1. package/dist/bundle.css +1 -1
  2. package/dist/bundle.js +11 -11
  3. package/dist/components/Button/Button.module.css +1 -1
  4. package/dist/components/Card/Card.d.ts +1 -1
  5. package/dist/components/Divider/Divider.js +3 -3
  6. package/dist/components/Divider/Divider.module.css +1 -1
  7. package/dist/components/Divider/Divider.types.d.ts +6 -0
  8. package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
  9. package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +1 -1
  10. package/dist/components/Flyout/Flyout.constants.d.ts +1 -3
  11. package/dist/components/Flyout/Flyout.constants.js +1 -3
  12. package/dist/components/Flyout/Flyout.types.d.ts +2 -0
  13. package/dist/components/Flyout/FlyoutControlled.js +10 -11
  14. package/dist/components/Flyout/utilities/cooldown.js +1 -2
  15. package/dist/components/Icon/Icon.module.css +1 -1
  16. package/dist/components/Popover/Popover.types.d.ts +1 -1
  17. package/dist/components/Progress/Progress.module.css +1 -1
  18. package/dist/components/Select/Select.module.css +1 -1
  19. package/dist/components/Select/Select.types.d.ts +16 -11
  20. package/dist/components/Select/SelectCustomControlled.js +27 -10
  21. package/dist/components/Select/SelectGroup.d.ts +4 -0
  22. package/dist/components/Select/SelectGroup.js +10 -0
  23. package/dist/components/Select/SelectTrigger.js +1 -1
  24. package/dist/components/Select/index.d.ts +3 -2
  25. package/dist/components/Select/index.js +3 -2
  26. package/dist/components/Tabs/TabsContext.d.ts +1 -1
  27. package/dist/components/TextArea/TextArea.module.css +1 -1
  28. package/dist/components/TextArea/TextArea.types.d.ts +1 -1
  29. package/dist/components/TextField/TextField.module.css +1 -1
  30. package/dist/components/TextField/TextField.types.d.ts +1 -1
  31. package/dist/components/Tooltip/Tooltip.types.d.ts +1 -1
  32. package/dist/config/tailwind.d.ts +1 -1
  33. package/package.json +31 -30
  34. package/dist/components/Accordion/tests/Accordion.stories.d.ts +0 -44
  35. package/dist/components/Accordion/tests/Accordion.stories.js +0 -204
  36. package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +0 -40
  37. package/dist/components/ActionBar/tests/ActionBar.stories.js +0 -223
  38. package/dist/components/Actionable/tests/Actionable.stories.d.ts +0 -41
  39. package/dist/components/Actionable/tests/Actionable.stories.js +0 -220
  40. package/dist/components/Alert/tests/Alert.stories.d.ts +0 -24
  41. package/dist/components/Alert/tests/Alert.stories.js +0 -78
  42. package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +0 -32
  43. package/dist/components/Autocomplete/tests/Autocomplete.stories.js +0 -246
  44. package/dist/components/Avatar/tests/Avatar.stories.d.ts +0 -31
  45. package/dist/components/Avatar/tests/Avatar.stories.js +0 -176
  46. package/dist/components/Badge/tests/Badge.stories.d.ts +0 -55
  47. package/dist/components/Badge/tests/Badge.stories.js +0 -328
  48. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +0 -40
  49. package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +0 -187
  50. package/dist/components/Button/tests/Button.stories.d.ts +0 -79
  51. package/dist/components/Button/tests/Button.stories.js +0 -789
  52. package/dist/components/Calendar/tests/Calendar.stories.d.ts +0 -29
  53. package/dist/components/Calendar/tests/Calendar.stories.js +0 -255
  54. package/dist/components/Card/tests/Card.stories.d.ts +0 -52
  55. package/dist/components/Card/tests/Card.stories.js +0 -125
  56. package/dist/components/Carousel/tests/Carousel.stories.d.ts +0 -34
  57. package/dist/components/Carousel/tests/Carousel.stories.js +0 -224
  58. package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +0 -30
  59. package/dist/components/Checkbox/tests/Checkbox.stories.js +0 -171
  60. package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +0 -19
  61. package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +0 -83
  62. package/dist/components/Container/tests/Container.stories.d.ts +0 -24
  63. package/dist/components/Container/tests/Container.stories.js +0 -75
  64. package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +0 -26
  65. package/dist/components/ContextMenu/tests/ContextMenu.stories.js +0 -70
  66. package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +0 -25
  67. package/dist/components/Dismissible/tests/Dismissible.stories.js +0 -97
  68. package/dist/components/Divider/tests/Divider.stories.d.ts +0 -18
  69. package/dist/components/Divider/tests/Divider.stories.js +0 -94
  70. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +0 -53
  71. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +0 -278
  72. package/dist/components/FileUpload/tests/FileUpload.stories.d.ts +0 -31
  73. package/dist/components/FileUpload/tests/FileUpload.stories.js +0 -140
  74. package/dist/components/Flyout/tests/Flyout.stories.d.ts +0 -102
  75. package/dist/components/Flyout/tests/Flyout.stories.js +0 -708
  76. package/dist/components/FormControl/tests/FormControl.stories.d.ts +0 -31
  77. package/dist/components/FormControl/tests/FormControl.stories.js +0 -143
  78. package/dist/components/Grid/tests/Grid.stories.d.ts +0 -38
  79. package/dist/components/Grid/tests/Grid.stories.js +0 -245
  80. package/dist/components/Hidden/tests/Hidden.stories.d.ts +0 -16
  81. package/dist/components/Hidden/tests/Hidden.stories.js +0 -48
  82. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +0 -16
  83. package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +0 -28
  84. package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +0 -13
  85. package/dist/components/Hotkey/tests/Hotkey.stories.js +0 -53
  86. package/dist/components/Icon/tests/Icon.stories.d.ts +0 -25
  87. package/dist/components/Icon/tests/Icon.stories.js +0 -113
  88. package/dist/components/Image/tests/Image.stories.d.ts +0 -41
  89. package/dist/components/Image/tests/Image.stories.js +0 -196
  90. package/dist/components/Link/tests/Link.stories.d.ts +0 -42
  91. package/dist/components/Link/tests/Link.stories.js +0 -155
  92. package/dist/components/Loader/tests/Loader.stories.d.ts +0 -21
  93. package/dist/components/Loader/tests/Loader.stories.js +0 -68
  94. package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +0 -59
  95. package/dist/components/MenuItem/tests/MenuItem.stories.js +0 -236
  96. package/dist/components/Modal/tests/Modal.stories.d.ts +0 -64
  97. package/dist/components/Modal/tests/Modal.stories.js +0 -410
  98. package/dist/components/NumberField/tests/NumberField.stories.d.ts +0 -28
  99. package/dist/components/NumberField/tests/NumberField.stories.js +0 -258
  100. package/dist/components/Overlay/tests/Overlay.stories.d.ts +0 -28
  101. package/dist/components/Overlay/tests/Overlay.stories.js +0 -202
  102. package/dist/components/Pagination/tests/Pagination.stories.d.ts +0 -24
  103. package/dist/components/Pagination/tests/Pagination.stories.js +0 -105
  104. package/dist/components/PinField/tests/PinField.stories.d.ts +0 -34
  105. package/dist/components/PinField/tests/PinField.stories.js +0 -209
  106. package/dist/components/Popover/tests/Popover.stories.d.ts +0 -69
  107. package/dist/components/Popover/tests/Popover.stories.js +0 -340
  108. package/dist/components/Progress/tests/Progress.stories.d.ts +0 -30
  109. package/dist/components/Progress/tests/Progress.stories.js +0 -102
  110. package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.d.ts +0 -19
  111. package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +0 -92
  112. package/dist/components/Radio/tests/Radio.stories.d.ts +0 -35
  113. package/dist/components/Radio/tests/Radio.stories.js +0 -162
  114. package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +0 -19
  115. package/dist/components/RadioGroup/tests/RadioGroup.stories.js +0 -77
  116. package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +0 -34
  117. package/dist/components/Reshaped/tests/Reshaped.stories.js +0 -108
  118. package/dist/components/Resizable/tests/Resizable.stories.d.ts +0 -38
  119. package/dist/components/Resizable/tests/Resizable.stories.js +0 -185
  120. package/dist/components/Scrim/tests/Scrim.stories.d.ts +0 -20
  121. package/dist/components/Scrim/tests/Scrim.stories.js +0 -67
  122. package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +0 -37
  123. package/dist/components/ScrollArea/tests/ScrollArea.stories.js +0 -244
  124. package/dist/components/Select/SelectOptionGroup.d.ts +0 -4
  125. package/dist/components/Select/SelectOptionGroup.js +0 -9
  126. package/dist/components/Select/tests/Select.stories.d.ts +0 -47
  127. package/dist/components/Select/tests/Select.stories.js +0 -520
  128. package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +0 -20
  129. package/dist/components/Skeleton/tests/Skeleton.stories.js +0 -63
  130. package/dist/components/Slider/tests/Slider.stories.d.ts +0 -47
  131. package/dist/components/Slider/tests/Slider.stories.js +0 -279
  132. package/dist/components/Stepper/tests/Stepper.stories.d.ts +0 -31
  133. package/dist/components/Stepper/tests/Stepper.stories.js +0 -135
  134. package/dist/components/Switch/tests/Switch.stories.d.ts +0 -22
  135. package/dist/components/Switch/tests/Switch.stories.js +0 -137
  136. package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -13
  137. package/dist/components/Switch/tests/Switch.test.stories.js +0 -11
  138. package/dist/components/Table/tests/Table.stories.d.ts +0 -42
  139. package/dist/components/Table/tests/Table.stories.js +0 -348
  140. package/dist/components/Tabs/tests/Tabs.stories.d.ts +0 -62
  141. package/dist/components/Tabs/tests/Tabs.stories.js +0 -539
  142. package/dist/components/Text/tests/Text.stories.d.ts +0 -48
  143. package/dist/components/Text/tests/Text.stories.js +0 -201
  144. package/dist/components/TextArea/tests/TextArea.stories.d.ts +0 -53
  145. package/dist/components/TextArea/tests/TextArea.stories.js +0 -200
  146. package/dist/components/TextField/tests/TextField.stories.d.ts +0 -53
  147. package/dist/components/TextField/tests/TextField.stories.js +0 -237
  148. package/dist/components/Theme/tests/Theme.stories.d.ts +0 -25
  149. package/dist/components/Theme/tests/Theme.stories.js +0 -171
  150. package/dist/components/Timeline/tests/Timeline.stories.d.ts +0 -22
  151. package/dist/components/Timeline/tests/Timeline.stories.js +0 -86
  152. package/dist/components/Toast/tests/Toast.stories.d.ts +0 -41
  153. package/dist/components/Toast/tests/Toast.stories.js +0 -432
  154. package/dist/components/ToggleButton/tests/ToggleButton.stories.d.ts +0 -27
  155. package/dist/components/ToggleButton/tests/ToggleButton.stories.js +0 -97
  156. package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.d.ts +0 -27
  157. package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.js +0 -169
  158. package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +0 -28
  159. package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -182
  160. package/dist/components/View/tests/View.stories.d.ts +0 -141
  161. package/dist/components/View/tests/View.stories.js +0 -1329
  162. package/dist/components/_private/Portal/tests/Portal.stories.d.ts +0 -6
  163. package/dist/components/_private/Portal/tests/Portal.stories.js +0 -17
  164. package/dist/hooks/tests/useDrag.stories.d.ts +0 -31
  165. package/dist/hooks/tests/useDrag.stories.js +0 -147
  166. package/dist/hooks/tests/useElementId.stories.d.ts +0 -11
  167. package/dist/hooks/tests/useElementId.stories.js +0 -23
  168. package/dist/hooks/tests/useHandlerRef.stories.d.ts +0 -14
  169. package/dist/hooks/tests/useHandlerRef.stories.js +0 -44
  170. package/dist/hooks/tests/useHotkeys.stories.d.ts +0 -43
  171. package/dist/hooks/tests/useHotkeys.stories.js +0 -158
  172. package/dist/hooks/tests/useKeyboardArrowNavigation.stories.d.ts +0 -15
  173. package/dist/hooks/tests/useKeyboardArrowNavigation.stories.js +0 -128
  174. package/dist/hooks/tests/useKeyboardMode.stories.d.ts +0 -11
  175. package/dist/hooks/tests/useKeyboardMode.stories.js +0 -42
  176. package/dist/hooks/tests/useOnClickOutside.stories.d.ts +0 -23
  177. package/dist/hooks/tests/useOnClickOutside.stories.js +0 -111
  178. package/dist/hooks/tests/useRTL.stories.d.ts +0 -11
  179. package/dist/hooks/tests/useRTL.stories.js +0 -23
  180. package/dist/hooks/tests/useResponsiveClientValue.stories.d.ts +0 -18
  181. package/dist/hooks/tests/useResponsiveClientValue.stories.js +0 -30
  182. package/dist/hooks/tests/useScrollLock.stories.d.ts +0 -14
  183. package/dist/hooks/tests/useScrollLock.stories.js +0 -97
  184. package/dist/hooks/tests/useToggle.stories.d.ts +0 -13
  185. package/dist/hooks/tests/useToggle.stories.js +0 -59
  186. package/dist/tests/ShadowDOM.stories.d.ts +0 -6
  187. package/dist/tests/ShadowDOM.stories.js +0 -110
  188. package/dist/tests/themes.stories.d.ts +0 -16
  189. package/dist/tests/themes.stories.js +0 -327
  190. package/dist/utilities/a11y/tests/TrapFocus.stories.d.ts +0 -14
  191. package/dist/utilities/a11y/tests/TrapFocus.stories.js +0 -615
@@ -1,1329 +0,0 @@
1
- import React, { useEffect, useState } from "react";
2
- import { Placeholder, Example } from "../../../utilities/storybook/index.js";
3
- import View from "../index.js";
4
- import Hidden from "../../Hidden/index.js";
5
- import Text from "../../Text/index.js";
6
- import Tabs from "../../Tabs/index.js";
7
- import Avatar from "../../Avatar/index.js";
8
- import MenuItem from "../../MenuItem/index.js";
9
- import Button from "../../Button/index.js";
10
- import IconPlus from "../../../icons/Plus.js";
11
- import useToggle from "../../../hooks/useToggle.js";
12
- import { expect } from "storybook/test";
13
- export default {
14
- title: "Utility components/View",
15
- component: View,
16
- parameters: {
17
- iframe: {
18
- url: "https://reshaped.so/docs/components/view",
19
- },
20
- },
21
- };
22
- export const padding = {
23
- name: "padding",
24
- render: () => (<Example title="Border is used to highlight the padding value">
25
- <Example.Item title="padding: 4">
26
- <View padding={4} borderColor="neutral">
27
- <Placeholder />
28
- </View>
29
- </Example.Item>
30
- <Example.Item title="padding: 6">
31
- <View padding={6} borderColor="neutral">
32
- <Placeholder />
33
- </View>
34
- </Example.Item>
35
- <Example.Item title="padding: 0">
36
- <View padding={0} borderColor="neutral">
37
- <Placeholder />
38
- </View>
39
- </Example.Item>
40
- <Example.Item title="padding: vertical 2, horizontal 4">
41
- <View paddingInline={4} paddingBlock={2} borderColor="neutral">
42
- <Placeholder />
43
- </View>
44
- </Example.Item>
45
- <Example.Item title="paddingTop: 4">
46
- <View paddingTop={4} borderColor="neutral">
47
- <Placeholder />
48
- </View>
49
- </Example.Item>
50
- <Example.Item title="paddingBottom: 4">
51
- <View paddingBottom={4} borderColor="neutral">
52
- <Placeholder />
53
- </View>
54
- </Example.Item>
55
- <Example.Item title="paddingStart: 4">
56
- <View paddingStart={4} borderColor="neutral">
57
- <Placeholder />
58
- </View>
59
- </Example.Item>
60
- <Example.Item title="paddingEnd: 4">
61
- <View paddingEnd={4} borderColor="neutral">
62
- <Placeholder />
63
- </View>
64
- </Example.Item>
65
- <Example.Item title={[
66
- "responsive padding:",
67
- "[s] vertical 2, horizontal 4",
68
- "[m+] vertical 4, horizontal 8",
69
- ]}>
70
- <View paddingInline={{ s: 4, m: 8 }} paddingBlock={{ s: 2, m: 4 }} borderColor="neutral">
71
- <Placeholder />
72
- </View>
73
- </Example.Item>
74
- <Example.Item title={["responsive padding:", "[s] top 2, bottom 4", "[m+] top 4, bottom 0, start: 8"]}>
75
- <View paddingTop={{ s: 2, m: 4 }} paddingBottom={{ s: 4, m: 0 }} paddingStart={{ s: 0, m: 8 }} borderColor="neutral">
76
- <Placeholder />
77
- </View>
78
- </Example.Item>
79
- <Example.Item title="nested padding, child view should have no horizontal padding">
80
- <View paddingStart={4} borderColor="neutral">
81
- <View borderColor="primary" paddingBlock={4}>
82
- <Placeholder />
83
- </View>
84
- </View>
85
- </Example.Item>
86
- </Example>),
87
- };
88
- export const direction = {
89
- name: "direction",
90
- render: () => (<Example title="Item 1 is another component, Item 2 is View.Item, Item 3 is text">
91
- <Example.Item title="direction: column as default">
92
- <View gap={3}>
93
- <Placeholder>Item 1</Placeholder>
94
- <View.Item>
95
- <Placeholder>Item 2</Placeholder>
96
- </View.Item>
97
- Text item 3
98
- </View>
99
- </Example.Item>
100
- <Example.Item title="direction: column">
101
- <View gap={3} direction="column">
102
- <Placeholder>Item 1</Placeholder>
103
- <View.Item>
104
- <Placeholder>Item 2</Placeholder>
105
- </View.Item>
106
- Text item 3
107
- </View>
108
- </Example.Item>
109
- <Example.Item title="direction: column-reverse">
110
- <View gap={3} direction="column-reverse">
111
- <Placeholder>Item 1</Placeholder>
112
- <View.Item>
113
- <Placeholder>Item 2</Placeholder>
114
- </View.Item>
115
- Text item 3
116
- </View>
117
- </Example.Item>
118
- <Example.Item title="direction: row">
119
- <View gap={3} direction="row">
120
- <Placeholder>Item 1</Placeholder>
121
- <View.Item>
122
- <Placeholder>Item 2</Placeholder>
123
- </View.Item>
124
- Text item 3
125
- </View>
126
- </Example.Item>
127
- <Example.Item title="direction: row-reverse">
128
- <View gap={3} direction="row-reverse">
129
- <Placeholder>Item 1</Placeholder>
130
- <View.Item>
131
- <Placeholder>Item 2</Placeholder>
132
- </View.Item>
133
- Text item 3
134
- </View>
135
- </Example.Item>
136
- <Example.Item title={["responsive direction", "[s] column-reverse", "[m] row-reverse", "[l+] row"]}>
137
- <View direction={{ s: "column-reverse", m: "row-reverse", l: "row" }} gap={3}>
138
- <Placeholder>Item 1</Placeholder>
139
- <Placeholder>Item 2</Placeholder>
140
- </View>
141
- </Example.Item>
142
- </Example>),
143
- };
144
- export const gap = {
145
- name: "gap",
146
- render: () => (<Example>
147
- <Example.Item title="gap: 4, direction: row">
148
- <View direction="row" gap={4} divided>
149
- <Placeholder>Item 1</Placeholder>
150
- <Placeholder>Item 2</Placeholder>
151
- <Placeholder>Item 3</Placeholder>
152
- </View>
153
- </Example.Item>
154
- <Example.Item title="gap: 0, direction: row">
155
- <View direction="row" gap={0}>
156
- <Placeholder>Item 1</Placeholder>
157
- <Placeholder>Item 2</Placeholder>
158
- </View>
159
- </Example.Item>
160
- <Example.Item title={["responsive gap, direction: row", "[s] 4", "[m+] 8"]}>
161
- <View direction="row" gap={{ s: 4, m: 8 }}>
162
- <Placeholder>Item 1</Placeholder>
163
- <Placeholder>Item 2</Placeholder>
164
- </View>
165
- </Example.Item>
166
- <Example.Item title="gap: 4, direction: column">
167
- <View gap={4}>
168
- <Placeholder>Item 1</Placeholder>
169
- <Placeholder>Item 2</Placeholder>
170
- </View>
171
- </Example.Item>
172
- <Example.Item title="gap: 0, direction: column">
173
- <View gap={0}>
174
- <Placeholder>Item 1</Placeholder>
175
- <Placeholder>Item 2</Placeholder>
176
- </View>
177
- </Example.Item>
178
- <Example.Item title={["responsive gap, direction: column", "[s] 4", "[m+] 8"]}>
179
- <View gap={{ s: 4, m: 8 }}>
180
- <Placeholder>Item 1</Placeholder>
181
- <Placeholder>Item 2</Placeholder>
182
- </View>
183
- </Example.Item>
184
- </Example>),
185
- };
186
- export const divided = {
187
- name: "divided",
188
- render: () => (<Example>
189
- <Example.Item title="direction: row">
190
- <View divided direction="row" gap={3}>
191
- <Placeholder>Item 1</Placeholder>
192
- <Placeholder>Item 2</Placeholder>
193
- </View>
194
- </Example.Item>
195
- <Example.Item title="direction: column">
196
- <View divided gap={3}>
197
- <Placeholder>Item 1</Placeholder>
198
- <Placeholder>Item 2</Placeholder>
199
- </View>
200
- </Example.Item>
201
- <Example.Item title={["responsive divided", "[s] direction: row", "[m+] direction: column"]}>
202
- <View divided direction={{ s: "row", m: "column" }} gap={3}>
203
- <Placeholder />
204
- <Placeholder />
205
- </View>
206
- </Example.Item>
207
- <Example.Item title="direction: row, columns">
208
- <View divided gap={3} direction="row">
209
- <View.Item columns={2}>
210
- <Placeholder>Item 1</Placeholder>
211
- </View.Item>
212
- <View.Item columns={8}>
213
- <Placeholder>Item 2</Placeholder>
214
- </View.Item>
215
- <View.Item columns={2}>
216
- <Placeholder>Item 3</Placeholder>
217
- </View.Item>
218
- </View>
219
- </Example.Item>
220
- <Example.Item title="with React.Fragment">
221
- <View direction="row" gap={4} divided>
222
- <Placeholder>Item 1</Placeholder>
223
- <>
224
- <Placeholder>Item 2</Placeholder>
225
- <Placeholder>Item 3</Placeholder>
226
- </>
227
- </View>
228
- </Example.Item>
229
- </Example>),
230
- };
231
- export const bleed = {
232
- name: "bleed",
233
- render: () => (<Example title="Removes side borders and border radius when applied">
234
- <Example.Item title="bleed: 4">
235
- <View bleed={4} padding={4} borderColor="neutral">
236
- <Placeholder />
237
- </View>
238
- </Example.Item>
239
- <Example.Item title={["responsive bleed", "[s] 4", "[m+] 0"]}>
240
- <View bleed={{ s: 4, m: 0 }} padding={4} borderRadius="small" borderColor="neutral">
241
- <Placeholder />
242
- </View>
243
- </Example.Item>
244
- </Example>),
245
- };
246
- export const wrap = {
247
- name: "wrap",
248
- render: () => (<Example>
249
- <Example.Item title="wrap: false">
250
- <View direction="row" wrap={false} gap={3}>
251
- <Placeholder w={600} h={100}/>
252
- <Placeholder w={600} h={100}/>
253
- </View>
254
- </Example.Item>
255
- </Example>),
256
- };
257
- export const align = {
258
- name: "align",
259
- render: () => (<Example>
260
- <Example.Item title="align: start, direction: row">
261
- <View align="start" direction="row" gap={3}>
262
- <Placeholder />
263
- <Placeholder h={100}/>
264
- </View>
265
- </Example.Item>
266
- <Example.Item title="align: center, direction: row">
267
- <View align="center" direction="row" gap={3}>
268
- <Placeholder />
269
- <Placeholder h={100}/>
270
- </View>
271
- </Example.Item>
272
- <Example.Item title="align: end, direction: row">
273
- <View align="end" direction="row" gap={3}>
274
- <Placeholder />
275
- <Placeholder h={100}/>
276
- </View>
277
- </Example.Item>
278
- <Example.Item title={[
279
- "align: stretch, direction: row",
280
- "2nd item is stretched based on the 1st item height",
281
- ]}>
282
- <View align="stretch" direction="row" gap={3}>
283
- <Placeholder h={100}/>
284
- <Placeholder h="auto"/>
285
- </View>
286
- </Example.Item>
287
- <Example.Item title="align: baseline, direction: row">
288
- <View align="baseline" direction="row" gap={3}>
289
- <Placeholder />
290
- <Text variant="title-6">Content</Text>
291
- </View>
292
- </Example.Item>
293
-
294
- <Example.Item title="align: start, direction: column">
295
- <View align="start" direction="column" gap={3}>
296
- <Placeholder />
297
- <Placeholder w={100}/>
298
- </View>
299
- </Example.Item>
300
- <Example.Item title="align: center, direction: column">
301
- <View align="center" direction="column" gap={3}>
302
- <Placeholder />
303
- <Placeholder w={100}/>
304
- </View>
305
- </Example.Item>
306
- <Example.Item title="align: end, direction: row">
307
- <View align="end" direction="column" gap={3}>
308
- <Placeholder />
309
- <Placeholder w={100}/>
310
- </View>
311
- </Example.Item>
312
- <Example.Item title={[
313
- "align: stretch, direction: column",
314
- "1st item uses its own width, 2nd item is stretched to full width",
315
- ]}>
316
- <View align="stretch" direction="column" gap={3}>
317
- <Placeholder w={100}/>
318
- <Placeholder w="auto"/>
319
- </View>
320
- </Example.Item>
321
- </Example>),
322
- };
323
- export const justify = {
324
- name: "justify",
325
- render: () => (<Example>
326
- <Example.Item title="justify: start, direction: row">
327
- <View justify="start" direction="row" gap={3}>
328
- <Placeholder />
329
- <Placeholder />
330
- </View>
331
- </Example.Item>
332
- <Example.Item title="justify: center, direction: row">
333
- <View justify="center" direction="row" gap={3}>
334
- <Placeholder />
335
- <Placeholder />
336
- </View>
337
- </Example.Item>
338
- <Example.Item title="justify: end, direction: row">
339
- <View justify="end" direction="row" gap={3}>
340
- <Placeholder />
341
- <Placeholder />
342
- </View>
343
- </Example.Item>
344
- <Example.Item title="justify: space-between, direction: row">
345
- <View justify="space-between" direction="row" gap={3}>
346
- <Placeholder />
347
- <Placeholder />
348
- </View>
349
- </Example.Item>
350
-
351
- <Example.Item title="justify: start, direction: column, height: 200px">
352
- <View height="200px" justify="start" direction="column" gap={3}>
353
- <Placeholder />
354
- <Placeholder />
355
- </View>
356
- </Example.Item>
357
- <Example.Item title="justify: center, direction: column, height: 200px">
358
- <View height="200px" justify="center" direction="column" gap={3}>
359
- <Placeholder />
360
- <Placeholder />
361
- </View>
362
- </Example.Item>
363
- <Example.Item title="justify: end, direction: column, height: 200px">
364
- <View justify="end" height="200px" direction="column" gap={3}>
365
- <Placeholder />
366
- <Placeholder />
367
- </View>
368
- </Example.Item>
369
- <Example.Item title="justify: space-between, direction: column, height: 200px">
370
- <View justify="space-between" height="200px" direction="column" gap={3}>
371
- <Placeholder />
372
- <Placeholder />
373
- </View>
374
- </Example.Item>
375
- </Example>),
376
- };
377
- export const textAlign = {
378
- name: "textAlign",
379
- render: () => (<Example>
380
- <Example.Item title="textAlign: start">
381
- <View textAlign="start">Content</View>
382
- </Example.Item>
383
-
384
- <Example.Item title="textAlign: center">
385
- <View textAlign="center">Content</View>
386
- </Example.Item>
387
-
388
- <Example.Item title="textAlign: end">
389
- <View textAlign="end">Content</View>
390
- </Example.Item>
391
-
392
- <Example.Item title="textAlign: [s] start, [m+] end">
393
- <View textAlign={{ s: "start", m: "end" }}>Content</View>
394
- </Example.Item>
395
- </Example>),
396
- };
397
- export const size = {
398
- name: "size",
399
- render: () => (<Example>
400
- <Example.Item title="height: 100px, width: 100px">
401
- <View backgroundColor="neutral-faded" height="100px" width="100px"/>
402
- </Example.Item>
403
- <Example.Item title="height: 25, width: 25">
404
- <View backgroundColor="neutral-faded" height={25} width={25}/>
405
- </Example.Item>
406
- <Example.Item title={[
407
- "responsive height and width",
408
- "[s] height: 25, width: 25",
409
- "[m+] height: 200px, width: 200px",
410
- ]}>
411
- <View backgroundColor="neutral-faded" height={{ s: 25, m: "200px" }} width={{ s: 25, m: "200px" }}/>
412
- </Example.Item>
413
- </Example>),
414
- };
415
- export const ratio = {
416
- name: "aspectRatio",
417
- render: () => (<Example>
418
- <Example.Item title="ratio: 16 / 9">
419
- <View backgroundColor="neutral-faded" aspectRatio={16 / 9} width="200px"/>
420
- </Example.Item>
421
- <Example.Item title={["responsive ratio", "[s] 1/1", "[m+] 16/9"]}>
422
- <View backgroundColor="neutral-faded" aspectRatio={{ s: 1, m: 16 / 9 }} width="200px"/>
423
- </Example.Item>
424
- </Example>),
425
- };
426
- export const maxSize = {
427
- name: "width, height, maxWidth, maxHeight",
428
- render: () => (<Example>
429
- <Example.Item title="maxHeight: 150px, maxWidth: 150px, height: 300px">
430
- <View backgroundColor="neutral-faded" maxHeight="150px" maxWidth="150px" height="300px"/>
431
- </Example.Item>
432
- <Example.Item title="maxHeight: 25, maxWidth: 25, height: 50">
433
- <View backgroundColor="neutral-faded" maxHeight={25} maxWidth={25} height={50}/>
434
- </Example.Item>
435
- <Example.Item title={[
436
- "responsive maxHeight and maxWidth, height: 300",
437
- "[s] maxHeight: 25, maxWidth: 25",
438
- "[m+] maxHeight: 200px, maxWidth: 200px",
439
- ]}>
440
- <View backgroundColor="neutral-faded" maxHeight={{ s: 25, m: "200px" }} maxWidth={{ s: 25, m: "200px" }} height="300px"/>
441
- </Example.Item>
442
- </Example>),
443
- };
444
- export const minSize = {
445
- name: "width, height, minWidth, minHeight",
446
- render: () => (<Example>
447
- <Example.Item title="minHeight: 150px, minWidth: 150px, height: 50px, width: 50px">
448
- <View backgroundColor="neutral-faded" minHeight="150px" minWidth="150px" height="50px" width="50px"/>
449
- </Example.Item>
450
- <Example.Item title="minHeight: 25, minWidth: 25, height: 5, width: 5">
451
- <View backgroundColor="neutral-faded" minHeight={25} minWidth={25} height={5} width={5}/>
452
- </Example.Item>
453
- <Example.Item title={[
454
- "responsive minHeight and minWidth, height: 50px, width: 50px",
455
- "[s] minHeight: 25, minWidth: 25",
456
- "[m+] minHeight: 200px, minWidth: 200px",
457
- ]}>
458
- <View backgroundColor="neutral-faded" minHeight={{ s: 25, m: "200px" }} minWidth={{ s: 25, m: "200px" }} height="50px" width="50px"/>
459
- </Example.Item>
460
- </Example>),
461
- };
462
- export const background = {
463
- name: "backgroundColor",
464
- render: () => (<Example title="border is used to highlight the backround value when it's similar to the page background, text color changes based on the background">
465
- <Example.Item title="bg: page">
466
- <View backgroundColor="page" borderColor="neutral" padding={4}>
467
- Content
468
- </View>
469
- </Example.Item>
470
- <Example.Item title="bg: page-faded">
471
- <View backgroundColor="page-faded" padding={4}>
472
- Content
473
- </View>
474
- </Example.Item>
475
- <Example.Item title="bg: disabled">
476
- <View backgroundColor="disabled" padding={4}>
477
- Content
478
- </View>
479
- </Example.Item>
480
- <Example.Item title="bg: disabled-faded">
481
- <View backgroundColor="disabled-faded" padding={4}>
482
- Content
483
- </View>
484
- </Example.Item>
485
- <Example.Item title="bg: elevation-base">
486
- <View backgroundColor="elevation-base" borderColor="neutral" padding={4}>
487
- Content
488
- </View>
489
- </Example.Item>
490
- <Example.Item title="bg: elevation-raised">
491
- <View backgroundColor="elevation-raised" borderColor="neutral" padding={4}>
492
- Content
493
- </View>
494
- </Example.Item>
495
- <Example.Item title="bg: elevation-overlay">
496
- <View backgroundColor="elevation-overlay" borderColor="neutral" padding={4}>
497
- Content
498
- </View>
499
- </Example.Item>
500
- <Example.Item title="bg: neutral">
501
- <View backgroundColor="neutral" padding={4}>
502
- Content
503
- </View>
504
- </Example.Item>
505
- <Example.Item title="bg: neutral-faded">
506
- <View backgroundColor="neutral-faded" padding={4}>
507
- Content
508
- </View>
509
- </Example.Item>
510
- <Example.Item title="bg: primary">
511
- <View backgroundColor="primary" padding={4}>
512
- Content
513
- </View>
514
- </Example.Item>
515
- <Example.Item title="bg: primary-faded">
516
- <View backgroundColor="primary-faded" padding={4}>
517
- Content
518
- </View>
519
- </Example.Item>
520
- <Example.Item title="bg: critical">
521
- <View backgroundColor="critical" padding={4}>
522
- Content
523
- </View>
524
- </Example.Item>
525
- <Example.Item title="bg: critical-faded">
526
- <View backgroundColor="critical-faded" padding={4}>
527
- Content
528
- </View>
529
- </Example.Item>
530
- <Example.Item title="bg: warning">
531
- <View backgroundColor="warning" padding={4}>
532
- Content
533
- </View>
534
- </Example.Item>
535
- <Example.Item title="bg: warning-faded">
536
- <View backgroundColor="warning-faded" padding={4}>
537
- Content
538
- </View>
539
- </Example.Item>
540
- <Example.Item title="bg: positive">
541
- <View backgroundColor="positive" padding={4}>
542
- Content
543
- </View>
544
- </Example.Item>
545
- <Example.Item title="bg: positive-faded">
546
- <View backgroundColor="positive-faded" padding={4}>
547
- Content
548
- </View>
549
- </Example.Item>
550
- </Example>),
551
- };
552
- export const borderColor = {
553
- name: "borderColor",
554
- render: () => (<Example>
555
- <Example.Item title="border: neutral">
556
- <View borderColor="neutral" padding={4}>
557
- Content
558
- </View>
559
- </Example.Item>
560
-
561
- <Example.Item title="border: neutral-faded">
562
- <View borderColor="neutral-faded" padding={4}>
563
- Content
564
- </View>
565
- </Example.Item>
566
-
567
- <Example.Item title="border: primary">
568
- <View borderColor="primary" padding={4}>
569
- Content
570
- </View>
571
- </Example.Item>
572
-
573
- <Example.Item title="border: primary-faded">
574
- <View borderColor="primary-faded" padding={4}>
575
- Content
576
- </View>
577
- </Example.Item>
578
-
579
- <Example.Item title="border: critical">
580
- <View borderColor="critical" padding={4}>
581
- Content
582
- </View>
583
- </Example.Item>
584
-
585
- <Example.Item title="border: critical-faded">
586
- <View borderColor="critical-faded" padding={4}>
587
- Content
588
- </View>
589
- </Example.Item>
590
-
591
- <Example.Item title="border: warning">
592
- <View borderColor="warning" padding={4}>
593
- Content
594
- </View>
595
- </Example.Item>
596
-
597
- <Example.Item title="border: warning-faded">
598
- <View borderColor="warning-faded" padding={4}>
599
- Content
600
- </View>
601
- </Example.Item>
602
-
603
- <Example.Item title="border: positive">
604
- <View borderColor="positive" padding={4}>
605
- Content
606
- </View>
607
- </Example.Item>
608
-
609
- <Example.Item title="border: positive-faded">
610
- <View borderColor="positive-faded" padding={4}>
611
- Content
612
- </View>
613
- </Example.Item>
614
-
615
- <Example.Item title="border: transparent, background: primary-faded">
616
- <View borderColor="transparent" backgroundColor="primary-faded" padding={4}>
617
- Content
618
- </View>
619
- </Example.Item>
620
-
621
- <Example.Item title={["responsive", "[s] primary", "[m+] neutral"]}>
622
- <View borderColor={{ s: "primary", m: "neutral" }} padding={4}>
623
- Content
624
- </View>
625
- </Example.Item>
626
- </Example>),
627
- };
628
- export const border = {
629
- name: "border",
630
- render: () => (<Example>
631
- <Example.Item title="border: true">
632
- <View border borderColor="neutral" padding={4}>
633
- Content
634
- </View>
635
- </Example.Item>
636
-
637
- <Example.Item title="borderTop: true">
638
- <View borderTop borderColor="neutral" padding={4}>
639
- Content
640
- </View>
641
- </Example.Item>
642
-
643
- <Example.Item title="borderBottom: true">
644
- <View borderBottom borderColor="neutral" padding={4}>
645
- Content
646
- </View>
647
- </Example.Item>
648
-
649
- <Example.Item title="borderStart: true">
650
- <View borderStart borderColor="neutral" padding={4}>
651
- Content
652
- </View>
653
- </Example.Item>
654
-
655
- <Example.Item title="borderEnd: true">
656
- <View borderEnd borderColor="neutral" padding={4}>
657
- Content
658
- </View>
659
- </Example.Item>
660
-
661
- <Example.Item title="borderInline: true">
662
- <View borderInline borderColor="neutral" padding={4}>
663
- Content
664
- </View>
665
- </Example.Item>
666
-
667
- <Example.Item title="borderBlock: true">
668
- <View borderBlock borderColor="neutral" padding={4}>
669
- Content
670
- </View>
671
- </Example.Item>
672
-
673
- <Example.Item title="borderTop: true, borderStart: true, ">
674
- <View borderColor="neutral" borderTop borderStart padding={4}>
675
- Content
676
- </View>
677
- </Example.Item>
678
-
679
- <Example.Item title={[
680
- "responsive",
681
- "[s] borderTop: true, borderStart: true",
682
- "[m+] borderBottom: true, borderEnd: true",
683
- ]}>
684
- <View borderColor="neutral" borderTop={{ s: true, m: false }} borderStart={{ s: true, m: false }} borderBottom={{ s: false, m: true }} borderEnd={{ s: false, m: true }} padding={4}>
685
- Content
686
- </View>
687
- </Example.Item>
688
-
689
- <div style={{ height: 100 }}/>
690
- </Example>),
691
- };
692
- export const radius = {
693
- name: "borderRadius",
694
- render: () => (<Example>
695
- <Example.Item title="radius: small">
696
- <View borderRadius="small" borderColor="neutral" padding={4}>
697
- Content
698
- </View>
699
- </Example.Item>
700
-
701
- <Example.Item title="radius: medium">
702
- <View borderRadius="medium" borderColor="neutral" padding={4}>
703
- Content
704
- </View>
705
- </Example.Item>
706
-
707
- <Example.Item title="radius: large">
708
- <View borderRadius="large" borderColor="neutral" padding={4}>
709
- Content
710
- </View>
711
- </Example.Item>
712
-
713
- <Example.Item title="radius: circular">
714
- <View borderRadius="circular" borderColor="neutral" padding={4}>
715
- Content
716
- </View>
717
- </Example.Item>
718
- </Example>),
719
- };
720
- export const shadow = {
721
- name: "shadow",
722
- render: () => (<Example>
723
- <Example.Item title="shadow: raised, radius: medium">
724
- <View height="100px" width="100px" shadow="raised" borderRadius="medium" backgroundColor="elevation-raised"/>
725
- </Example.Item>
726
- <Example.Item title="shadow: overlay, radius: medium">
727
- <View height="100px" width="100px" shadow="overlay" borderRadius="medium" backgroundColor="elevation-overlay"/>
728
- </Example.Item>
729
- </Example>),
730
- };
731
- export const overflow = {
732
- name: "overflow",
733
- render: () => (<Example>
734
- <Example.Item title={["overflow: hidden, radius: medium", "child background should have radius"]}>
735
- <View height="100px" width="100px" shadow="raised" borderRadius="medium" overflow="hidden">
736
- <View backgroundColor="primary" height="100%" width="100%"/>
737
- </View>
738
- </Example.Item>
739
- </Example>),
740
- };
741
- export const positioning = {
742
- name: "position",
743
- render: () => (<Example>
744
- <Example.Item title="position: relative + absolute">
745
- <View borderColor="neutral" position="relative">
746
- <Placeholder />
747
- <View position="absolute" insetTop={0} insetEnd={0} backgroundColor="critical" zIndex={5} height={10} width={10}/>
748
- <View position="absolute" insetTop={0} insetEnd={0} backgroundColor="primary" height={15} width={15}/>
749
- </View>
750
- </Example.Item>
751
-
752
- <Example.Item title="position: sticky">
753
- <div style={{ overflow: "auto", height: 100 }} tabIndex={0}>
754
- <View position="sticky" borderColor="primary" insetTop={0}>
755
- Content
756
- </View>
757
- <Placeholder h={1000}/>
758
- </div>
759
- </Example.Item>
760
-
761
- <Example.Item title={["responsive", "[s] position: absolute", "[m+]: position: relative"]}>
762
- <div style={{ overflow: "auto", height: 100, position: "relative" }} tabIndex={0}>
763
- <View position={{ s: "absolute", m: "relative" }} borderColor="primary" insetTop={0}>
764
- Content
765
- </View>
766
- <Placeholder h={1000}/>
767
- </div>
768
- </Example.Item>
769
- </Example>),
770
- };
771
- export const inset = {
772
- name: "inset",
773
- render: () => (<Example>
774
- <Example.Item title="inset: 4">
775
- <View backgroundColor="neutral-faded" width={25} height={25}>
776
- <View backgroundColor="neutral" position="absolute" inset={4}/>
777
- </View>
778
- </Example.Item>
779
-
780
- <Example.Item title="insetTop: 4">
781
- <View backgroundColor="neutral-faded" width={25} height={25}>
782
- <View backgroundColor="neutral" position="absolute" insetTop={4} height={10} width={10}/>
783
- </View>
784
- </Example.Item>
785
-
786
- <Example.Item title="insetStart: 4">
787
- <View backgroundColor="neutral-faded" width={25} height={25}>
788
- <View backgroundColor="neutral" position="absolute" insetStart={4} height={10} width={10}/>
789
- </View>
790
- </Example.Item>
791
-
792
- <Example.Item title="insetEnd: 4">
793
- <View backgroundColor="neutral-faded" width={25} height={25}>
794
- <View backgroundColor="neutral" position="absolute" insetEnd={4} height={10} width={10}/>
795
- </View>
796
- </Example.Item>
797
-
798
- <Example.Item title="insetBottom: 4">
799
- <View backgroundColor="neutral-faded" width={25} height={25}>
800
- <View backgroundColor="neutral" position="absolute" insetBottom={4} height={10} width={10}/>
801
- </View>
802
- </Example.Item>
803
-
804
- <Example.Item title="responsive, [s] insetBottom: 4 [m+] insetEnd: 4">
805
- <View backgroundColor="neutral-faded" width={25} height={25}>
806
- <View backgroundColor="neutral" position="absolute" insetBottom={{ s: 4, m: "auto" }} insetEnd={{ s: "auto", m: 4 }} height={10} width={10}/>
807
- </View>
808
- </Example.Item>
809
- </Example>),
810
- };
811
- export const animated = {
812
- name: "animated",
813
- render: () => {
814
- const [background, setBackground] = React.useState("neutral");
815
- return (<View gap={3} align="start">
816
- <Button onClick={() => setBackground((prev) => (prev === "neutral" ? "primary" : "neutral"))}>
817
- Change background
818
- </Button>
819
- <View height="100px" width="100px" backgroundColor={background} align="center" justify="center" animated>
820
- Content
821
- </View>
822
- </View>);
823
- },
824
- };
825
- export const itemGapBefore = {
826
- name: "item, gapBefore",
827
- render: () => (<Example>
828
- <Example.Item title={["gap: 4, 3rd item gapBefore: 10, direction: row", "increased gap"]}>
829
- <View direction="row" gap={4}>
830
- <Placeholder />
831
- <Placeholder />
832
- <View.Item gapBefore={10}>
833
- <Placeholder />
834
- </View.Item>
835
- </View>
836
- </Example.Item>
837
- <Example.Item title={["gap: 10, 3rd item gapBefore: 4, direction: row", "reduced gap"]}>
838
- <View direction="row" gap={10}>
839
- <Placeholder />
840
- <Placeholder />
841
- <View.Item gapBefore={4}>
842
- <Placeholder />
843
- </View.Item>
844
- </View>
845
- </Example.Item>
846
- <Example.Item title={["gap: 10, 3rd item gapBefore: 0, direction: row", "removed gap"]}>
847
- <View direction="row" gap={10}>
848
- <Placeholder />
849
- <Placeholder />
850
- <View.Item gapBefore={0}>
851
- <Placeholder />
852
- </View.Item>
853
- </View>
854
- </Example.Item>
855
-
856
- <Example.Item title="gap: 4, direction: row, 2nd item gap: auto">
857
- <View direction="row" gap={4}>
858
- <Placeholder w={200}/>
859
- <View.Item gapBefore="auto">
860
- <Placeholder />
861
- </View.Item>
862
- </View>
863
- </Example.Item>
864
-
865
- <Example.Item title={["gap: 4, 3rd item gapBefore: 10, direction: column", "increased gap"]}>
866
- <View direction="column" gap={4}>
867
- <Placeholder />
868
- <Placeholder />
869
- <View.Item gapBefore={10}>
870
- <Placeholder />
871
- </View.Item>
872
- </View>
873
- </Example.Item>
874
- <Example.Item title={["gap: 10, 3rd item gapBefore: 4, direction: column", "reduced gap"]}>
875
- <View direction="column" gap={10}>
876
- <Placeholder />
877
- <Placeholder />
878
- <View.Item gapBefore={4}>
879
- <Placeholder />
880
- </View.Item>
881
- </View>
882
- </Example.Item>
883
- <Example.Item title={["gap: 10, 3rd item gapBefore: 0, direction: column", "removed gap"]}>
884
- <View direction="column" gap={10}>
885
- <Placeholder />
886
- <Placeholder />
887
- <View.Item gapBefore={0}>
888
- <Placeholder />
889
- </View.Item>
890
- </View>
891
- </Example.Item>
892
-
893
- <Example.Item title="gap: 4, direction: column, height: 200px, 2nd item gap: auto">
894
- <View height="200px" gap={4}>
895
- <Placeholder />
896
- <View.Item gapBefore="auto">
897
- <Placeholder />
898
- </View.Item>
899
- </View>
900
- </Example.Item>
901
-
902
- <Example.Item title={[
903
- "responsive item gap",
904
- "gap: 4, direction: row",
905
- "[s] 3rd item gapBefore: 10",
906
- "[m+] 3rd item gapBefore: 0",
907
- ]}>
908
- <View direction="row" gap={4}>
909
- <Placeholder />
910
- <Placeholder />
911
- <View.Item gapBefore={{ s: 10, m: 0 }}>
912
- <Placeholder />
913
- </View.Item>
914
- </View>
915
- </Example.Item>
916
- </Example>),
917
- };
918
- export const itemGrow = {
919
- name: "item, grow",
920
- render: () => (<Example>
921
- <Example.Item title="direction: row, 2nd item grow">
922
- <View direction="row" gap={3}>
923
- <Placeholder w={200}/>
924
- <View.Item grow>
925
- <Placeholder />
926
- </View.Item>
927
- </View>
928
- </Example.Item>
929
- <Example.Item title="direction: column, height: 200px, 2nd item grow">
930
- <View direction="column" gap={3} height="200px">
931
- <Placeholder />
932
- <View.Item grow>
933
- <Placeholder h="100%"/>
934
- </View.Item>
935
- </View>
936
- </Example.Item>
937
- <Example.Item title="direction: row, 2nd item grow, applied to View">
938
- <View direction="row" gap={3}>
939
- <Placeholder w={200}/>
940
- <View grow>
941
- <Placeholder />
942
- </View>
943
- </View>
944
- </Example.Item>
945
- <Example.Item title={[
946
- "responsive item grow, direction: row",
947
- "[s] 2nd item grow",
948
- "[m+] 2nd item doesn't grow",
949
- ]}>
950
- <View direction="row" gap={3}>
951
- <Placeholder w={200}/>
952
- <View.Item grow={{ s: true, m: false }}>
953
- <Placeholder />
954
- </View.Item>
955
- </View>
956
- </Example.Item>
957
- <Example.Item title={[
958
- "responsive item grow, direction: column, height: 200px",
959
- "[s] 2nd item grow",
960
- "[m+] 2nd item doesn't grow",
961
- ]}>
962
- <View direction="column" gap={3} height="200px">
963
- <Placeholder />
964
- <View.Item grow={{ s: true, m: false }}>
965
- <Placeholder h="100%"/>
966
- </View.Item>
967
- </View>
968
- </Example.Item>
969
- </Example>),
970
- };
971
- export const itemColumns = {
972
- name: "item, columns",
973
- render: () => (<Example>
974
- <Example.Item title="columns 6, 6, gap: 0">
975
- <View direction="row">
976
- <View.Item columns={6}>
977
- <Placeholder>Item 1</Placeholder>
978
- </View.Item>
979
- <View.Item columns={6}>
980
- <Placeholder>Item 2</Placeholder>
981
- </View.Item>
982
- </View>
983
- </Example.Item>
984
-
985
- <Example.Item title="columns 6, 6, gap: 4">
986
- <View direction="row" gap={4}>
987
- <View.Item columns={6}>
988
- <Placeholder>Item 1</Placeholder>
989
- </View.Item>
990
- <View.Item columns={6}>
991
- <Placeholder>Item 2</Placeholder>
992
- </View.Item>
993
- </View>
994
- </Example.Item>
995
-
996
- <Example.Item title="columns 3, 9, gap: 4">
997
- <View direction="row" gap={4}>
998
- <View.Item columns={3}>
999
- <Placeholder>Item 1</Placeholder>
1000
- </View.Item>
1001
- <View.Item columns={9}>
1002
- <Placeholder>Item 2</Placeholder>
1003
- </View.Item>
1004
- </View>
1005
- </Example.Item>
1006
-
1007
- <Example.Item title="columns 6, 6, 9, gap: 4">
1008
- <View direction="row" gap={4}>
1009
- <View.Item columns={6}>
1010
- <Placeholder>Item 1</Placeholder>
1011
- </View.Item>
1012
- <View.Item columns={6}>
1013
- <Placeholder>Item 2</Placeholder>
1014
- </View.Item>
1015
- <View.Item columns={9}>
1016
- <Placeholder>Item 3</Placeholder>
1017
- </View.Item>
1018
- </View>
1019
- </Example.Item>
1020
-
1021
- <Example.Item title={["responsive columns", "[s] columns 6, 6, 12, gap: 4", "[m+]: 4, 4, 4"]}>
1022
- <View direction="row" gap={4}>
1023
- <View.Item columns={{ s: 6, m: 4 }}>
1024
- <Placeholder>Item 1</Placeholder>
1025
- </View.Item>
1026
- <View.Item columns={{ s: 6, m: 4 }}>
1027
- <Placeholder>Item 2</Placeholder>
1028
- </View.Item>
1029
- <View.Item columns={{ s: 12, m: 4 }}>
1030
- <Placeholder>Item 3</Placeholder>
1031
- </View.Item>
1032
- </View>
1033
- </Example.Item>
1034
-
1035
- <Example.Item title="columns 6, 6, 9, gap: 4, 2nd item gapBefore: 20">
1036
- <View direction="row" gap={4}>
1037
- <View.Item columns={6}>
1038
- <Placeholder>Item 1</Placeholder>
1039
- </View.Item>
1040
- <View.Item columns={6} gapBefore={20}>
1041
- <Placeholder>Item 2</Placeholder>
1042
- </View.Item>
1043
- <View.Item columns={9}>
1044
- <Placeholder>Item 3</Placeholder>
1045
- </View.Item>
1046
- </View>
1047
- </Example.Item>
1048
- </Example>),
1049
- };
1050
- export const itemOrder = {
1051
- name: "item, order",
1052
- render: () => (<Example>
1053
- <Example.Item title="order: 1 3 2">
1054
- <View direction="row" gap={4}>
1055
- <View.Item columns={4}>
1056
- <Placeholder>Item 1</Placeholder>
1057
- </View.Item>
1058
- <View.Item columns={4} order={1}>
1059
- <Placeholder>Item 2</Placeholder>
1060
- </View.Item>
1061
- <View.Item columns={4}>
1062
- <Placeholder>Item 3</Placeholder>
1063
- </View.Item>
1064
- </View>
1065
- </Example.Item>
1066
- <Example.Item title={["responsive order", "[s] 1 2 3", "[m+] 1 3 2"]}>
1067
- <View direction="row" gap={4}>
1068
- <View.Item columns={4}>
1069
- <Placeholder>Item 1</Placeholder>
1070
- </View.Item>
1071
- <View.Item columns={4} order={{ s: 0, m: 1 }}>
1072
- <Placeholder>Item 2</Placeholder>
1073
- </View.Item>
1074
- <View.Item columns={4}>
1075
- <Placeholder>Item 3</Placeholder>
1076
- </View.Item>
1077
- </View>
1078
- </Example.Item>
1079
- <Example.Item title={[
1080
- "responsive order",
1081
- "[s]: 1 3 2, 2 is full width on second row",
1082
- "[m+]: 1 2 3, 2 has grow in the center of the first row",
1083
- ]}>
1084
- <View direction="row" gap={3}>
1085
- <View.Item columns={{ s: 6, m: "auto" }}>
1086
- <Placeholder>Item 1</Placeholder>
1087
- </View.Item>
1088
- <View.Item grow={{ s: false, m: true }} order={{ s: 1, m: 0 }} columns={{ s: 12, m: "auto" }}>
1089
- <Placeholder>Item 2</Placeholder>
1090
- </View.Item>
1091
- <View.Item columns={{ s: 6, m: "auto" }}>
1092
- <Placeholder>Item 3</Placeholder>
1093
- </View.Item>
1094
- </View>
1095
- </Example.Item>
1096
- </Example>),
1097
- };
1098
- export const hiddenItem = {
1099
- name: "composition, Hidden item",
1100
- render: () => (<Example>
1101
- <Example.Item title={[
1102
- "[s] 2nd item: visible, grow, 3rd item: !grow",
1103
- "[m+] 2nd item: hidden, 2nd item divider: hidden, 3rd item: grow",
1104
- ]}>
1105
- <View direction="row" divided gap={3}>
1106
- <Placeholder />
1107
- <Hidden hide={{ s: false, m: true }}>
1108
- <View.Item grow key="3">
1109
- <Placeholder />
1110
- </View.Item>
1111
- </Hidden>
1112
- <View.Item grow={{ s: false, m: true }}>
1113
- <Placeholder />
1114
- </View.Item>
1115
- </View>
1116
- </Example.Item>
1117
-
1118
- <Example.Item title={[
1119
- "[s] 2nd item: visible, grow, 3rd item: !grow",
1120
- "[m+] 2nd item: hidden, 2nd item: grow doesn't push 3rd item, 3rd item: grow",
1121
- ]}>
1122
- <View direction="row" gap={3}>
1123
- <Placeholder />
1124
- <Hidden hide={{ s: false, m: true }}>
1125
- <View.Item grow>
1126
- <Placeholder />
1127
- </View.Item>
1128
- </Hidden>
1129
- <View.Item grow={{ s: false, m: true }}>
1130
- <Placeholder />
1131
- </View.Item>
1132
- </View>
1133
- </Example.Item>
1134
- </Example>),
1135
- };
1136
- const KeyItem = (props) => {
1137
- const [timer, setTimer] = useState(0);
1138
- useEffect(() => {
1139
- const t = setInterval(() => setTimer((t) => t + 1), 500);
1140
- return () => clearInterval(t);
1141
- }, []);
1142
- return (<div>
1143
- {props.children}, timer: {timer}
1144
- </div>);
1145
- };
1146
- export const keys = {
1147
- name: "item, key",
1148
- render: () => {
1149
- const toggle = useToggle();
1150
- return (<View gap={2}>
1151
- <Button onClick={() => toggle.toggle()}>Toggle</Button>
1152
- <View.Item>Item 1</View.Item>
1153
- {toggle.active && <KeyItem>Item 2</KeyItem>}
1154
- <KeyItem>Item 3</KeyItem>
1155
- </View>);
1156
- },
1157
- };
1158
- export const nestedGaps = {
1159
- name: "composition, nested gap",
1160
- render: () => (<Example>
1161
- <Example.Item title={[
1162
- "direction: column, gap: 10",
1163
- "Child 1: direction: column, gap: 2",
1164
- "Child 2: direction column, gap: 6",
1165
- "Child 3: gapBefore: 0",
1166
- "Child 3 view: direction: row, gap: 2",
1167
- ]}>
1168
- <View gap={10}>
1169
- <View gap={2}>
1170
- <Placeholder>Child 1</Placeholder>
1171
- <Placeholder>Child 1</Placeholder>
1172
- </View>
1173
-
1174
- <View gap={6}>
1175
- <Placeholder>Child 2</Placeholder>
1176
- <Placeholder>Child 2</Placeholder>
1177
- </View>
1178
-
1179
- <View.Item gapBefore={0}>
1180
- <View direction="row" gap={2}>
1181
- <Placeholder>Child 3, very long text</Placeholder>
1182
- <Placeholder>Child 3, very long text</Placeholder>
1183
- <Placeholder>Child 3, very long text</Placeholder>
1184
- <Placeholder>Child 3, very long text</Placeholder>
1185
- <Placeholder>Child 3, very long text</Placeholder>
1186
- <Placeholder>Child 3, very long text</Placeholder>
1187
- </View>
1188
- </View.Item>
1189
- </View>
1190
- </Example.Item>
1191
- </Example>),
1192
- };
1193
- export const testComposition = {
1194
- name: "composition, edge cases",
1195
- render: () => (<Example>
1196
- <Example.Item>
1197
- <View direction="row" align="center" gap={4} padding={4}>
1198
- <View width="80px" height="60px" backgroundColor="neutral-faded" borderRadius="small"/>
1199
-
1200
- <View direction="row" align="center" gap={1} grow>
1201
- <View.Item shrink>
1202
- <Text>Text (like Jeff's Puzzles)</Text>
1203
- </View.Item>
1204
-
1205
- <View minWidth="auto" grow>
1206
- <Button size="small" color="neutral" icon={IconPlus}/>
1207
- </View>
1208
- </View>
1209
-
1210
- <Button color="primary" rounded>
1211
- Button
1212
- </Button>
1213
- </View>
1214
- </Example.Item>
1215
- <Example.Item title={[
1216
- "View.Item, MenuItem, Aspect ratio",
1217
- "ratio should increase height on viewport change",
1218
- ]}>
1219
- <View direction="row" gap={3}>
1220
- <View.Item>
1221
- <Placeholder />
1222
- </View.Item>
1223
- <MenuItem selected roundedCorners>
1224
- Menu
1225
- </MenuItem>
1226
- <View.Item grow>
1227
- <View aspectRatio={16 / 9}>
1228
- <Placeholder h="100%"/>
1229
- </View>
1230
- </View.Item>
1231
- </View>
1232
- </Example.Item>
1233
- <Example.Item title="Scrollable tabs inside View.Item with grow">
1234
- <View direction="row" align="center" gap={3}>
1235
- <Placeholder />
1236
- <View.Item grow>
1237
- <View padding={0} align="center">
1238
- <Tabs variant="pills">
1239
- <Tabs.List>
1240
- <Tabs.Item value="1">Very long item</Tabs.Item>
1241
- <Tabs.Item value="2">Very long item</Tabs.Item>
1242
- <Tabs.Item value="3">Very long item</Tabs.Item>
1243
- <Tabs.Item value="4">Very long item</Tabs.Item>
1244
- <Tabs.Item value="5">Very long item</Tabs.Item>
1245
- <Tabs.Item value="6">Very long item</Tabs.Item>
1246
- </Tabs.List>
1247
- {[1, 2, 3, 5, 6].map((i) => (<Tabs.Panel key={i} value={i.toString()}/>))}
1248
- </Tabs>
1249
- </View>
1250
- </View.Item>
1251
- <Placeholder />
1252
- </View>
1253
- </Example.Item>
1254
- <Example.Item title="2nd item has grow, Avatar stays circle">
1255
- <View direction="row" gap={3}>
1256
- <Avatar initials="DB"/>
1257
- <View.Item grow>
1258
- Veggies sunt bona vobis, proinde vos postulo esse magis grape pea sprouts horseradish
1259
- courgette maize spinach prairie turnip jícama coriander quandong gourd broccoli seakale
1260
- gumbo. Parsley corn lentil zucchini radicchio maize burdock avocado sea lettuce.
1261
- Garbanzo tigernut earthnut pea fennel.
1262
- </View.Item>
1263
- </View>
1264
- </Example.Item>
1265
- <Example.Item title={[
1266
- "item gapBefore from parent doesn't affect the child view",
1267
- "columns should take full width",
1268
- ]}>
1269
- <View>
1270
- <View.Item gapBefore={20}>
1271
- <View direction="row" gap={4}>
1272
- <View.Item columns={6}>
1273
- <Placeholder />
1274
- </View.Item>
1275
- <View.Item columns={6}>
1276
- <Placeholder />
1277
- </View.Item>
1278
- </View>
1279
- </View.Item>
1280
- </View>
1281
- </Example.Item>
1282
- <Example.Item title="View becomes flexbox if there is a child with grow">
1283
- <View height="300px" borderColor="neutral-faded">
1284
- <View height="50px"/>
1285
- <View grow backgroundColor="neutral-faded" padding={4}>
1286
- Grow
1287
- </View>
1288
- </View>
1289
- </Example.Item>
1290
- </Example>),
1291
- };
1292
- export const asProp = {
1293
- name: "as",
1294
- render: () => (<View as="ul">
1295
- <View.Item as="li">Content</View.Item>
1296
- </View>),
1297
- play: async ({ canvas }) => {
1298
- const list = canvas.getByRole("list");
1299
- const item = canvas.getByRole("listitem");
1300
- expect(list).toBeInTheDocument();
1301
- expect(item).toBeInTheDocument();
1302
- },
1303
- };
1304
- export const className = {
1305
- name: "className, attributes",
1306
- render: () => (<div data-testid="root">
1307
- <View className="test-classname" attributes={{ id: "test-id" }}>
1308
- Content
1309
- </View>
1310
- </div>),
1311
- play: async ({ canvas }) => {
1312
- const root = canvas.getByTestId("root").firstChild;
1313
- expect(root).toHaveClass("test-classname");
1314
- expect(root).toHaveAttribute("id", "test-id");
1315
- },
1316
- };
1317
- export const itemClassName = {
1318
- name: "item className, attributes",
1319
- render: () => (<div data-testid="root">
1320
- <View.Item className="test-classname" attributes={{ id: "test-id" }}>
1321
- Content
1322
- </View.Item>
1323
- </div>),
1324
- play: async ({ canvas }) => {
1325
- const root = canvas.getByTestId("root").firstChild;
1326
- expect(root).toHaveClass("test-classname");
1327
- expect(root).toHaveAttribute("id", "test-id");
1328
- },
1329
- };