@boxcustodia/library 2.0.0-alpha.12 → 2.0.0-alpha.14
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.
- package/dist/index.cjs.js +1 -138
- package/dist/index.d.ts +1087 -720
- package/dist/index.es.js +7011 -56097
- package/dist/theme.css +1 -1
- package/package.json +34 -26
- package/src/__doc__/Examples.tsx +1 -1
- package/src/__doc__/Intro.mdx +3 -3
- package/src/__doc__/Tabs.mdx +112 -0
- package/src/__doc__/V2.mdx +1246 -0
- package/src/components/accordion/accordion.stories.tsx +143 -0
- package/src/components/accordion/accordion.tsx +135 -0
- package/src/components/accordion/index.ts +1 -0
- package/src/components/alert/alert.stories.tsx +24 -4
- package/src/components/alert/alert.tsx +17 -9
- package/src/components/alert-dialog/alert-dialog.stories.tsx +24 -0
- package/src/components/alert-dialog/alert-dialog.test.tsx +1 -1
- package/src/components/alert-dialog/alert-dialog.tsx +58 -10
- package/src/components/auto-complete/auto-complete.stories.tsx +616 -200
- package/src/components/auto-complete/auto-complete.tsx +420 -68
- package/src/components/auto-complete/index.ts +0 -1
- package/src/components/avatar/avatar.stories.tsx +162 -21
- package/src/components/avatar/avatar.tsx +79 -20
- package/src/components/button/button.stories.tsx +219 -294
- package/src/components/button/button.test.tsx +10 -17
- package/src/components/button/button.tsx +78 -19
- package/src/components/button/components/base-button.tsx +30 -53
- package/src/components/button/index.ts +0 -1
- package/src/components/calendar/calendar.stories.tsx +1 -1
- package/src/components/calendar/calendar.tsx +4 -4
- package/src/components/card/card.stories.tsx +141 -69
- package/src/components/card/card.tsx +155 -54
- package/src/components/center/center.stories.tsx +22 -39
- package/src/components/checkbox/checkbox.stories.tsx +25 -5
- package/src/components/checkbox/checkbox.tsx +76 -15
- package/src/components/checkbox-group/checkbox-group.stories.tsx +116 -28
- package/src/components/checkbox-group/checkbox-group.tsx +84 -3
- package/src/components/combobox/combobox.stories.tsx +33 -23
- package/src/components/combobox/combobox.tsx +99 -77
- package/src/components/date-picker/date-input.stories.tsx +14 -6
- package/src/components/date-picker/date-input.tsx +2 -2
- package/src/components/date-picker/date-picker.model.ts +13 -4
- package/src/components/date-picker/date-picker.stories.tsx +38 -12
- package/src/components/date-picker/date-picker.tsx +28 -14
- package/src/components/dialog/dialog.stories.tsx +18 -0
- package/src/components/dialog/dialog.test.tsx +1 -1
- package/src/components/dialog/dialog.tsx +51 -20
- package/src/components/divider/divider.stories.tsx +126 -51
- package/src/components/divider/divider.tsx +16 -16
- package/src/components/dropzone/dropzone.stories.tsx +71 -90
- package/src/components/dropzone/dropzone.tsx +383 -105
- package/src/components/dropzone/index.ts +0 -1
- package/src/components/empty/empty.stories.tsx +165 -0
- package/src/components/empty/empty.tsx +156 -0
- package/src/components/empty/index.ts +1 -0
- package/src/components/field/field.stories.tsx +227 -4
- package/src/components/field/field.tsx +77 -42
- package/src/components/form/form.stories.tsx +320 -197
- package/src/components/form/form.tsx +3 -23
- package/src/components/index.ts +2 -6
- package/src/components/input/input.stories.tsx +5 -5
- package/src/components/input/input.tsx +4 -4
- package/src/components/kbd/kbd.stories.tsx +1 -0
- package/src/components/label/label.stories.tsx +16 -0
- package/src/components/label/label.tsx +13 -2
- package/src/components/loader/loader.stories.tsx +7 -5
- package/src/components/loader/loader.tsx +8 -3
- package/src/components/menu/menu-primitives.tsx +207 -196
- package/src/components/menu/menu.stories.tsx +276 -146
- package/src/components/menu/menu.tsx +146 -54
- package/src/components/number-input/number-input.stories.tsx +27 -4
- package/src/components/number-input/number-input.test.tsx +2 -2
- package/src/components/number-input/number-input.tsx +31 -33
- package/src/components/otp/index.ts +1 -0
- package/src/components/otp/otp.stories.tsx +209 -0
- package/src/components/otp/otp.tsx +100 -0
- package/src/components/pagination/index.ts +1 -0
- package/src/components/pagination/pagination.model.ts +2 -0
- package/src/components/pagination/pagination.stories.tsx +154 -59
- package/src/components/pagination/pagination.test.tsx +122 -57
- package/src/components/pagination/pagination.tsx +575 -77
- package/src/components/password/password.stories.tsx +18 -3
- package/src/components/password/password.tsx +29 -9
- package/src/components/popover/popover.stories.tsx +26 -5
- package/src/components/popover/popover.tsx +15 -23
- package/src/components/progress/progress.stories.tsx +1 -0
- package/src/components/radio-group/index.ts +1 -0
- package/src/components/radio-group/radio-group.stories.tsx +251 -0
- package/src/components/radio-group/radio-group.tsx +212 -0
- package/src/components/scroll-area/scroll-area.stories.tsx +1 -0
- package/src/components/select/select.stories.tsx +118 -19
- package/src/components/select/select.tsx +67 -62
- package/src/components/skeleton/skeleton.stories.tsx +1 -0
- package/src/components/stack/stack.stories.tsx +179 -89
- package/src/components/stack/stack.tsx +2 -2
- package/src/components/stepper/index.ts +1 -1
- package/src/components/stepper/stepper.stories.tsx +767 -83
- package/src/components/stepper/stepper.test.tsx +18 -18
- package/src/components/stepper/stepper.tsx +554 -0
- package/src/components/switch/switch.stories.tsx +15 -1
- package/src/components/switch/switch.tsx +17 -4
- package/src/components/table/index.ts +0 -2
- package/src/components/table/table.stories.tsx +131 -18
- package/src/components/table/table.test.tsx +1 -1
- package/src/components/table/table.tsx +183 -77
- package/src/components/tabs/tabs.stories.tsx +373 -155
- package/src/components/tabs/tabs.test.tsx +12 -12
- package/src/components/tabs/tabs.tsx +72 -149
- package/src/components/tag/index.ts +0 -1
- package/src/components/tag/tag.stories.tsx +155 -120
- package/src/components/tag/tag.tsx +47 -95
- package/src/components/textarea/textarea.stories.tsx +8 -22
- package/src/components/textarea/textarea.tsx +17 -79
- package/src/components/timeline/timeline.stories.tsx +323 -42
- package/src/components/timeline/timeline.tsx +359 -132
- package/src/components/toast/toast.stories.tsx +1 -0
- package/src/components/tooltip/tooltip.tsx +11 -9
- package/src/components/tree/index.ts +0 -1
- package/src/components/tree/tree.stories.tsx +365 -408
- package/src/components/tree/tree.test.tsx +163 -0
- package/src/components/tree/tree.tsx +212 -36
- package/src/hooks/useAsync/__doc__/useAsync.stories.tsx +5 -5
- package/src/hooks/useClipboard/__doc__/useClipboard.stories.tsx +1 -3
- package/src/hooks/useDebounceCallback/__doc__/useDebouncedCallback.stories.tsx +6 -6
- package/src/hooks/useDocumentTitle/__doc__/useDocumentTitle.stories.tsx +1 -1
- package/src/hooks/useEventListener/__test__/useEventListener.test.tsx +1 -1
- package/src/hooks/useLocalStorage/__doc__/useLocalStorage.stories.tsx +1 -1
- package/src/hooks/usePagination/usePagination.tsx +36 -24
- package/src/styles/theme.css +1 -1
- package/src/utils/form.tsx +67 -37
- package/src/utils/index.ts +1 -1
- package/src/__doc__/Migration.mdx +0 -475
- package/src/components/auto-complete/auto-complete-primitives.tsx +0 -155
- package/src/components/background-image/background-image.stories.tsx +0 -21
- package/src/components/background-image/background-image.test.tsx +0 -29
- package/src/components/background-image/background-image.tsx +0 -23
- package/src/components/background-image/index.ts +0 -1
- package/src/components/button/button.variants.ts +0 -44
- package/src/components/button/components/loader-overlay.tsx +0 -21
- package/src/components/button/components/loading-icon.tsx +0 -47
- package/src/components/dropzone/upload-primitives.tsx +0 -310
- package/src/components/dropzone/use-dropzone.ts +0 -122
- package/src/components/empty-state/empty-state.stories.tsx +0 -56
- package/src/components/empty-state/empty-state.tsx +0 -39
- package/src/components/empty-state/index.ts +0 -1
- package/src/components/heading/heading.stories.tsx +0 -74
- package/src/components/heading/heading.tsx +0 -28
- package/src/components/heading/heading.variants.ts +0 -27
- package/src/components/heading/index.ts +0 -1
- package/src/components/kbd/kbd.variants.ts +0 -26
- package/src/components/menu/util/render-menu-item.tsx +0 -54
- package/src/components/multi-select/hooks/use-multi-select.ts +0 -66
- package/src/components/multi-select/index.ts +0 -1
- package/src/components/multi-select/multi-select.stories.tsx +0 -294
- package/src/components/multi-select/multi-select.tsx +0 -300
- package/src/components/multi-select/multi-select.variants.ts +0 -22
- package/src/components/pagination/components/pagination-option.tsx +0 -27
- package/src/components/show/index.ts +0 -1
- package/src/components/show/show.stories.tsx +0 -197
- package/src/components/show/show.test.tsx +0 -41
- package/src/components/show/show.tsx +0 -16
- package/src/components/stepper/Stepper.tsx +0 -190
- package/src/components/stepper/context/stepper-context.tsx +0 -11
- package/src/components/table/table-primitives.tsx +0 -122
- package/src/components/table/table.model.ts +0 -20
- package/src/components/table-pagination/index.ts +0 -2
- package/src/components/table-pagination/table-pagination.model.ts +0 -2
- package/src/components/table-pagination/table-pagination.stories.tsx +0 -23
- package/src/components/table-pagination/table-pagination.test.tsx +0 -32
- package/src/components/table-pagination/table-pagination.tsx +0 -108
- package/src/components/tabs/context/tabs-context.tsx +0 -14
- package/src/components/tag/tag.variants.ts +0 -31
- package/src/components/timeline/timeline-status.ts +0 -5
- package/src/components/tree/hooks/use-controllable-tree-state.ts +0 -80
- package/src/components/tree/tree-primitives.tsx +0 -126
|
@@ -6,17 +6,26 @@ import { Label } from "../label";
|
|
|
6
6
|
import { Stack } from ".";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Layout primitive that
|
|
10
|
-
*
|
|
11
|
-
* `reverse`
|
|
12
|
-
* `grow`
|
|
9
|
+
* Layout primitive that arranges children along a horizontal or vertical axis using flexbox.
|
|
10
|
+
* Polymorphic via `as` for semantic HTML (`ul`, `nav`, `section`, ...).
|
|
11
|
+
* `reverse` flips the axis without exposing raw CSS values.
|
|
12
|
+
* `grow` applies `flex: 1` to fill remaining space.
|
|
13
|
+
* `inline` switches the container to `inline-flex` for flowing with surrounding text.
|
|
13
14
|
*/
|
|
14
15
|
const meta: Meta<typeof Stack> = {
|
|
15
16
|
title: "Components/Stack",
|
|
16
17
|
component: Stack,
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: "centered",
|
|
20
|
+
},
|
|
17
21
|
args: {
|
|
18
22
|
gap: 8,
|
|
19
23
|
},
|
|
24
|
+
argTypes: {
|
|
25
|
+
as: { control: false },
|
|
26
|
+
className: { control: false },
|
|
27
|
+
children: { control: false },
|
|
28
|
+
},
|
|
20
29
|
};
|
|
21
30
|
|
|
22
31
|
export default meta;
|
|
@@ -25,11 +34,15 @@ type Story = StoryObj<typeof Stack>;
|
|
|
25
34
|
export const Default: Story = {
|
|
26
35
|
args: {
|
|
27
36
|
align: "center",
|
|
37
|
+
gap: 12,
|
|
28
38
|
},
|
|
29
39
|
render: (args) => (
|
|
30
40
|
<Stack {...args}>
|
|
31
41
|
<Avatar src="https://i.pravatar.cc/150?img=12" alt="Sara Lane" />
|
|
32
|
-
<
|
|
42
|
+
<Stack direction="vertical" gap={2}>
|
|
43
|
+
<span className="font-semibold text-sm">Sara Lane</span>
|
|
44
|
+
<span className="text-xs text-muted-foreground">Product Designer</span>
|
|
45
|
+
</Stack>
|
|
33
46
|
</Stack>
|
|
34
47
|
),
|
|
35
48
|
};
|
|
@@ -37,52 +50,154 @@ export const Default: Story = {
|
|
|
37
50
|
export const Vertical: Story = {
|
|
38
51
|
args: {
|
|
39
52
|
direction: "vertical",
|
|
53
|
+
gap: 6,
|
|
40
54
|
},
|
|
41
55
|
render: (args) => (
|
|
42
|
-
<Stack {...args}>
|
|
56
|
+
<Stack {...args} className="w-72">
|
|
43
57
|
<Label>Username</Label>
|
|
44
58
|
<Input type="text" placeholder="Enter your username" />
|
|
45
59
|
</Stack>
|
|
46
60
|
),
|
|
47
61
|
};
|
|
48
62
|
|
|
63
|
+
/**
|
|
64
|
+
* `inline` swaps `flex` for `inline-flex` so the Stack flows with surrounding inline content
|
|
65
|
+
* instead of breaking onto a new line.
|
|
66
|
+
*/
|
|
67
|
+
export const Inline: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<p className="text-sm max-w-sm leading-7">
|
|
70
|
+
Press{" "}
|
|
71
|
+
<Stack
|
|
72
|
+
inline
|
|
73
|
+
align="center"
|
|
74
|
+
gap={4}
|
|
75
|
+
className="px-2 py-0.5 rounded border bg-muted text-xs font-medium"
|
|
76
|
+
>
|
|
77
|
+
<span>⌘</span>
|
|
78
|
+
<span>K</span>
|
|
79
|
+
</Stack>{" "}
|
|
80
|
+
to open the command palette from anywhere in the app.
|
|
81
|
+
</p>
|
|
82
|
+
),
|
|
83
|
+
};
|
|
84
|
+
|
|
49
85
|
/**
|
|
50
86
|
* `reverse` flips the axis direction without needing to know the underlying CSS value
|
|
51
87
|
* (`row-reverse` or `column-reverse`).
|
|
52
88
|
*/
|
|
53
89
|
export const Reverse: Story = {
|
|
54
90
|
render: () => (
|
|
55
|
-
<Stack direction="vertical" gap={16}>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
91
|
+
<Stack direction="vertical" gap={16} className="w-[420px]">
|
|
92
|
+
{(
|
|
93
|
+
[
|
|
94
|
+
{ label: "horizontal", reverse: false },
|
|
95
|
+
{ label: "reverse", reverse: true },
|
|
96
|
+
] as const
|
|
97
|
+
).map(({ label, reverse }) => (
|
|
98
|
+
<Stack key={label} direction="vertical" gap={6}>
|
|
99
|
+
<span className="text-xs text-muted-foreground uppercase tracking-wide">
|
|
100
|
+
{label}
|
|
101
|
+
</span>
|
|
102
|
+
<Stack
|
|
103
|
+
reverse={reverse}
|
|
104
|
+
gap={8}
|
|
105
|
+
className="border rounded-lg p-3 bg-muted/30"
|
|
106
|
+
>
|
|
107
|
+
<Button size="sm">First</Button>
|
|
108
|
+
<Button size="sm" variant="secondary">
|
|
109
|
+
Second
|
|
110
|
+
</Button>
|
|
111
|
+
<Button size="sm" variant="outline">
|
|
112
|
+
Third
|
|
113
|
+
</Button>
|
|
114
|
+
</Stack>
|
|
62
115
|
</Stack>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
116
|
+
))}
|
|
117
|
+
</Stack>
|
|
118
|
+
),
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* `justify` maps to `justify-content`. Controls distribution along the main axis.
|
|
123
|
+
*/
|
|
124
|
+
export const Justify: Story = {
|
|
125
|
+
render: () => (
|
|
126
|
+
<Stack direction="vertical" gap={10} className="w-[420px]">
|
|
127
|
+
{(
|
|
128
|
+
[
|
|
129
|
+
"flex-start",
|
|
130
|
+
"center",
|
|
131
|
+
"flex-end",
|
|
132
|
+
"space-between",
|
|
133
|
+
"space-evenly",
|
|
134
|
+
] as const
|
|
135
|
+
).map((value) => (
|
|
136
|
+
<Stack key={value} direction="vertical" gap={4}>
|
|
137
|
+
<span className="text-xs text-muted-foreground font-mono">
|
|
138
|
+
{value}
|
|
139
|
+
</span>
|
|
140
|
+
<Stack justify={value} className="border rounded-lg p-3 bg-muted/30">
|
|
141
|
+
<Button size="sm">A</Button>
|
|
142
|
+
<Button size="sm" variant="secondary">
|
|
143
|
+
B
|
|
144
|
+
</Button>
|
|
145
|
+
</Stack>
|
|
70
146
|
</Stack>
|
|
71
|
-
|
|
147
|
+
))}
|
|
148
|
+
</Stack>
|
|
149
|
+
),
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* `align` maps to `align-items`. Controls placement along the cross axis.
|
|
154
|
+
*/
|
|
155
|
+
export const Align: Story = {
|
|
156
|
+
render: () => (
|
|
157
|
+
<Stack direction="vertical" gap={10} className="w-[420px]">
|
|
158
|
+
{(["flex-start", "center", "flex-end", "stretch"] as const).map(
|
|
159
|
+
(value) => (
|
|
160
|
+
<Stack key={value} direction="vertical" gap={4}>
|
|
161
|
+
<span className="text-xs text-muted-foreground font-mono">
|
|
162
|
+
{value}
|
|
163
|
+
</span>
|
|
164
|
+
<Stack
|
|
165
|
+
align={value}
|
|
166
|
+
gap={8}
|
|
167
|
+
className="border rounded-lg p-3 bg-muted/30 h-20"
|
|
168
|
+
>
|
|
169
|
+
<Button size="sm">A</Button>
|
|
170
|
+
<Button size="sm" variant="secondary">
|
|
171
|
+
B
|
|
172
|
+
</Button>
|
|
173
|
+
</Stack>
|
|
174
|
+
</Stack>
|
|
175
|
+
),
|
|
176
|
+
)}
|
|
72
177
|
</Stack>
|
|
73
178
|
),
|
|
74
179
|
};
|
|
75
180
|
|
|
76
181
|
/**
|
|
77
182
|
* `wrap` enables `flex-wrap` so children overflow onto the next line instead of shrinking.
|
|
78
|
-
* Useful for tag lists, badge groups, and responsive
|
|
183
|
+
* Useful for tag lists, badge groups, and responsive chip rows.
|
|
79
184
|
*/
|
|
80
185
|
export const Wrap: Story = {
|
|
81
186
|
render: () => (
|
|
82
|
-
<Stack wrap
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
|
|
187
|
+
<Stack wrap gap={8} className="max-w-[320px]">
|
|
188
|
+
{[
|
|
189
|
+
"React",
|
|
190
|
+
"TypeScript",
|
|
191
|
+
"Vite",
|
|
192
|
+
"Tailwind",
|
|
193
|
+
"Storybook",
|
|
194
|
+
"Base UI",
|
|
195
|
+
"Bun",
|
|
196
|
+
"Vitest",
|
|
197
|
+
"Playwright",
|
|
198
|
+
].map((tag) => (
|
|
199
|
+
<Button key={tag} size="sm" variant="outline">
|
|
200
|
+
{tag}
|
|
86
201
|
</Button>
|
|
87
202
|
))}
|
|
88
203
|
</Stack>
|
|
@@ -90,23 +205,28 @@ export const Wrap: Story = {
|
|
|
90
205
|
};
|
|
91
206
|
|
|
92
207
|
/**
|
|
93
|
-
* `grow` applies `flex: 1`
|
|
208
|
+
* `grow` applies `flex: 1` so the Stack fills the remaining space of its parent.
|
|
94
209
|
* Useful for sidebars, split panes, and full-height layouts.
|
|
95
210
|
*/
|
|
96
211
|
export const Grow: Story = {
|
|
97
212
|
render: () => (
|
|
98
|
-
<Stack className="h-[
|
|
99
|
-
<
|
|
213
|
+
<Stack gap={8} className="h-32 w-[420px] border rounded-lg p-2 bg-muted/30">
|
|
214
|
+
<Stack
|
|
215
|
+
align="center"
|
|
216
|
+
justify="center"
|
|
217
|
+
className="w-20 rounded-md bg-background border text-xs font-medium"
|
|
218
|
+
>
|
|
100
219
|
Fixed
|
|
101
|
-
</
|
|
220
|
+
</Stack>
|
|
102
221
|
<Stack
|
|
103
222
|
grow
|
|
104
223
|
direction="vertical"
|
|
105
|
-
|
|
106
|
-
|
|
224
|
+
justify="center"
|
|
225
|
+
gap={2}
|
|
226
|
+
className="rounded-md bg-background border px-3"
|
|
107
227
|
>
|
|
108
228
|
<span className="text-xs font-medium">Grows to fill</span>
|
|
109
|
-
<span className="text-xs text-muted-foreground">flex: 1</span>
|
|
229
|
+
<span className="text-xs text-muted-foreground font-mono">flex: 1</span>
|
|
110
230
|
</Stack>
|
|
111
231
|
</Stack>
|
|
112
232
|
),
|
|
@@ -118,73 +238,43 @@ export const Grow: Story = {
|
|
|
118
238
|
*/
|
|
119
239
|
export const As: Story = {
|
|
120
240
|
render: () => (
|
|
121
|
-
<Stack
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
"flex-start",
|
|
135
|
-
"center",
|
|
136
|
-
"flex-end",
|
|
137
|
-
"space-between",
|
|
138
|
-
"space-evenly",
|
|
139
|
-
] as const
|
|
140
|
-
).map((value) => (
|
|
141
|
-
<Stack key={value} direction="vertical" gap={4}>
|
|
142
|
-
<span className="text-xs text-muted-foreground">{value}</span>
|
|
143
|
-
<Stack justify={value} className="border rounded p-2">
|
|
144
|
-
<Button size="sm">A</Button>
|
|
145
|
-
<Button size="sm" variant="secondary">
|
|
146
|
-
B
|
|
147
|
-
</Button>
|
|
148
|
-
</Stack>
|
|
149
|
-
</Stack>
|
|
150
|
-
))}
|
|
151
|
-
</Stack>
|
|
152
|
-
),
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export const Align: Story = {
|
|
156
|
-
render: () => (
|
|
157
|
-
<Stack direction="vertical" gap={12} className="w-fit">
|
|
158
|
-
{(["flex-start", "center", "flex-end"] as const).map((value) => (
|
|
159
|
-
<Stack key={value} direction="vertical" gap={4}>
|
|
160
|
-
<span className="text-xs text-muted-foreground">{value}</span>
|
|
161
|
-
<Stack align={value} className="border rounded p-2 h-20">
|
|
162
|
-
<Button size="sm">A</Button>
|
|
163
|
-
<Button size="sm" variant="secondary">
|
|
164
|
-
B
|
|
165
|
-
</Button>
|
|
166
|
-
</Stack>
|
|
167
|
-
</Stack>
|
|
241
|
+
<Stack
|
|
242
|
+
as="ul"
|
|
243
|
+
direction="vertical"
|
|
244
|
+
gap={4}
|
|
245
|
+
className="list-none p-0 m-0 w-64"
|
|
246
|
+
>
|
|
247
|
+
{["Dashboard", "Projects", "Team", "Settings"].map((item) => (
|
|
248
|
+
<li
|
|
249
|
+
key={item}
|
|
250
|
+
className="px-3 py-2 rounded-md hover:bg-muted text-sm cursor-pointer"
|
|
251
|
+
>
|
|
252
|
+
{item}
|
|
253
|
+
</li>
|
|
168
254
|
))}
|
|
169
255
|
</Stack>
|
|
170
256
|
),
|
|
171
257
|
};
|
|
172
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Stacks compose freely. Nest a vertical Stack inside a horizontal one to build
|
|
261
|
+
* media objects, list items, and card headers without bespoke layout components.
|
|
262
|
+
*/
|
|
263
|
+
/**
|
|
264
|
+
* `gap` accepts any `CSSProperties["gap"]` value — numbers (treated as `px`),
|
|
265
|
+
* unit strings (`"1rem"`, `"0.5em"`), percentages, or `calc()` expressions.
|
|
266
|
+
*/
|
|
173
267
|
export const Nested: Story = {
|
|
174
|
-
|
|
175
|
-
align
|
|
176
|
-
gap: 16,
|
|
177
|
-
},
|
|
178
|
-
render: (args) => (
|
|
179
|
-
<Stack {...args}>
|
|
268
|
+
render: () => (
|
|
269
|
+
<Stack align="center" gap="1rem" className="w-[420px]">
|
|
180
270
|
<Avatar
|
|
181
271
|
className="w-16 h-16"
|
|
182
272
|
src="https://i.pravatar.cc/150?img=12"
|
|
183
273
|
alt="Sara Lane"
|
|
184
274
|
/>
|
|
185
|
-
<Stack direction="vertical" gap=
|
|
186
|
-
<span className="font-semibold text-
|
|
187
|
-
<span className="text-sm text-muted-foreground
|
|
275
|
+
<Stack direction="vertical" gap="0.25rem" grow>
|
|
276
|
+
<span className="font-semibold text-base">Sara Lane</span>
|
|
277
|
+
<span className="text-sm text-muted-foreground">
|
|
188
278
|
Senior product designer with 8 years of experience building design
|
|
189
279
|
systems and component libraries for cross-functional teams.
|
|
190
280
|
</span>
|
|
@@ -9,7 +9,7 @@ interface StackProps extends ComponentProps<"div"> {
|
|
|
9
9
|
justify?: CSSProperties["justifyContent"];
|
|
10
10
|
align?: CSSProperties["alignItems"];
|
|
11
11
|
gap?: CSSProperties["gap"];
|
|
12
|
-
wrap?: CSSProperties["flexWrap"];
|
|
12
|
+
wrap?: CSSProperties["flexWrap"] | boolean;
|
|
13
13
|
grow?: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -42,7 +42,7 @@ export const Stack = ({
|
|
|
42
42
|
justifyContent: justify,
|
|
43
43
|
alignItems: align,
|
|
44
44
|
gap,
|
|
45
|
-
flexWrap: wrap,
|
|
45
|
+
flexWrap: wrap === true ? "wrap" : wrap === false ? undefined : wrap,
|
|
46
46
|
...style,
|
|
47
47
|
}}
|
|
48
48
|
data-slot="stack"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./stepper";
|