@kalink-ui/seedly 0.1.2 → 0.2.0
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/.storybook/main.mts +16 -0
- package/.storybook/preview.ts +27 -0
- package/.storybook/theme/ref.css.ts +63 -0
- package/.storybook/theme/sprinkles.css.ts +40 -0
- package/.storybook/theme/theme.css.ts +293 -0
- package/.turbo/turbo-lint.log +82 -0
- package/.turbo/turbo-tsc.log +227 -0
- package/CHANGELOG.md +25 -0
- package/dist/utils.types.d.mts +9 -0
- package/dist/utils.types.d.ts +9 -0
- package/dist/utils.types.js +19 -0
- package/dist/utils.types.js.map +1 -0
- package/dist/utils.types.mjs +1 -0
- package/dist/utils.types.mjs.map +1 -0
- package/eslint.config.mts +3 -0
- package/package.json +14 -17
- package/tsconfig.json +14 -0
- package/tsup.config.ts +18 -0
- package/turbo/generators/config.ts +35 -0
- package/turbo/generators/templates/component.hbs +21 -0
- package/turbo/generators/templates/export.hbs +5 -0
- package/turbo/generators/templates/style.hbs +3 -0
- package/vite.config.mts +9 -0
- package/src/.npmignore +0 -7
- package/src/components/.DS_Store +0 -0
- package/src/components/box/box.stories.tsx +0 -29
- package/src/components/button/button.stories.tsx +0 -31
- package/src/components/center/.DS_Store +0 -0
- package/src/components/center/center.stories.tsx +0 -31
- package/src/components/cluster/.DS_Store +0 -0
- package/src/components/cluster/cluster.stories.tsx +0 -37
- package/src/components/cover/.DS_Store +0 -0
- package/src/components/cover/cover.stories.tsx +0 -45
- package/src/components/frame/.DS_Store +0 -0
- package/src/components/frame/frame.stories.tsx +0 -39
- package/src/components/grid/.DS_Store +0 -0
- package/src/components/grid/grid.stories.tsx +0 -50
- package/src/components/layout.mdx +0 -206
- package/src/components/sidebar/.DS_Store +0 -0
- package/src/components/sidebar/sidebar.stories.tsx +0 -60
- package/src/components/stack/.DS_Store +0 -0
- package/src/components/stack/stack.stories.tsx +0 -72
- package/src/components/switcher/.DS_Store +0 -0
- package/src/components/switcher/switcher.stories.tsx +0 -66
- package/src/styles/seed/.DS_Store +0 -0
- package/src/styles/seed/seed.stories.tsx +0 -52
- package/src/styles/styles.mdx +0 -98
- package/src/utils/__tests__/extract-sprinkles-props.test.ts +0 -101
- package/src/utils/__tests__/is-object.test.ts +0 -24
- package/src/utils/__tests__/map-contract-vars.test.ts +0 -34
- package/src/utils/arg-types/.DS_Store +0 -0
- package/src/utils/arg-types/arg-types-from-recipe.ts +0 -37
- package/src/utils/arg-types/arg-types-from-sprinkles.ts +0 -43
- package/src/utils/arg-types/common/composable.ts +0 -13
- package/src/utils/arg-types/common/index.ts +0 -4
- package/src/utils/arg-types/common/polymorphic.ts +0 -14
- package/src/utils/arg-types/common/referable.ts +0 -10
- package/src/utils/arg-types/common/stylable.ts +0 -14
- package/src/utils/arg-types/common-args.ts +0 -26
- package/src/utils/arg-types/index.ts +0 -3
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { argTypesFromRecipe, CommonArgs, commonArgs } from '@/utils/arg-types';
|
|
2
|
-
|
|
3
|
-
import { Cover } from './cover';
|
|
4
|
-
import { coverRecipe } from './cover.css';
|
|
5
|
-
|
|
6
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Layout/Cover',
|
|
10
|
-
component: Cover,
|
|
11
|
-
tags: ['autodocs'],
|
|
12
|
-
argTypes: {
|
|
13
|
-
...argTypesFromRecipe(coverRecipe),
|
|
14
|
-
|
|
15
|
-
...commonArgs([
|
|
16
|
-
CommonArgs.COMPOSABLE,
|
|
17
|
-
CommonArgs.POLYMORPHIC,
|
|
18
|
-
CommonArgs.STYLABLE,
|
|
19
|
-
CommonArgs.REFERABLE,
|
|
20
|
-
]),
|
|
21
|
-
|
|
22
|
-
minSize: {
|
|
23
|
-
table: {
|
|
24
|
-
category: 'Recipe props',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
args: {
|
|
29
|
-
minSize: '30vh',
|
|
30
|
-
|
|
31
|
-
children: (
|
|
32
|
-
<>
|
|
33
|
-
<div>Cover element one</div>
|
|
34
|
-
<div data-cover-center>Cover element two</div>
|
|
35
|
-
<div>Cover element three</div>
|
|
36
|
-
</>
|
|
37
|
-
),
|
|
38
|
-
},
|
|
39
|
-
} satisfies Meta<typeof Cover>;
|
|
40
|
-
|
|
41
|
-
export default meta;
|
|
42
|
-
|
|
43
|
-
type Story = StoryObj<typeof Cover>;
|
|
44
|
-
|
|
45
|
-
export const Default: Story = {};
|
|
Binary file
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { argTypesFromRecipe, CommonArgs, commonArgs } from '@/utils/arg-types';
|
|
2
|
-
|
|
3
|
-
import { Frame } from './frame';
|
|
4
|
-
import { frameRecipe } from './frame.css';
|
|
5
|
-
|
|
6
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Layout/Frame',
|
|
10
|
-
component: Frame,
|
|
11
|
-
tags: ['autodocs'],
|
|
12
|
-
argTypes: {
|
|
13
|
-
...argTypesFromRecipe(frameRecipe),
|
|
14
|
-
|
|
15
|
-
...commonArgs([
|
|
16
|
-
CommonArgs.COMPOSABLE,
|
|
17
|
-
CommonArgs.POLYMORPHIC,
|
|
18
|
-
CommonArgs.STYLABLE,
|
|
19
|
-
CommonArgs.REFERABLE,
|
|
20
|
-
]),
|
|
21
|
-
|
|
22
|
-
ratio: {
|
|
23
|
-
table: {
|
|
24
|
-
category: 'Recipe props',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
args: {
|
|
29
|
-
ratio: '16:9',
|
|
30
|
-
|
|
31
|
-
children: <div>Frame element</div>,
|
|
32
|
-
},
|
|
33
|
-
} satisfies Meta<typeof Frame>;
|
|
34
|
-
|
|
35
|
-
export default meta;
|
|
36
|
-
|
|
37
|
-
type Story = StoryObj<typeof Frame>;
|
|
38
|
-
|
|
39
|
-
export const Default: Story = {};
|
|
Binary file
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { argTypesFromRecipe, CommonArgs, commonArgs } from '@/utils/arg-types';
|
|
2
|
-
|
|
3
|
-
import { Grid } from './grid';
|
|
4
|
-
import { gridRecipe } from './grid.css';
|
|
5
|
-
|
|
6
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Layout/Grid',
|
|
10
|
-
component: Grid,
|
|
11
|
-
tags: ['autodocs'],
|
|
12
|
-
argTypes: {
|
|
13
|
-
...argTypesFromRecipe(gridRecipe),
|
|
14
|
-
|
|
15
|
-
...commonArgs([
|
|
16
|
-
CommonArgs.COMPOSABLE,
|
|
17
|
-
CommonArgs.POLYMORPHIC,
|
|
18
|
-
CommonArgs.STYLABLE,
|
|
19
|
-
CommonArgs.REFERABLE,
|
|
20
|
-
]),
|
|
21
|
-
|
|
22
|
-
minSize: {
|
|
23
|
-
table: {
|
|
24
|
-
category: 'Recipe props',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
args: {
|
|
29
|
-
minSize: '250px',
|
|
30
|
-
|
|
31
|
-
children: (
|
|
32
|
-
<>
|
|
33
|
-
<div>Grid cell one</div>
|
|
34
|
-
<div>Grid cell two</div>
|
|
35
|
-
<div>Grid cell three</div>
|
|
36
|
-
<div>Grid cell four</div>
|
|
37
|
-
<div>Grid cell five</div>
|
|
38
|
-
<div>Grid cell six</div>
|
|
39
|
-
<div>Grid cell seven</div>
|
|
40
|
-
<div>Grid cell eight</div>
|
|
41
|
-
</>
|
|
42
|
-
),
|
|
43
|
-
},
|
|
44
|
-
} satisfies Meta<typeof Grid>;
|
|
45
|
-
|
|
46
|
-
export default meta;
|
|
47
|
-
|
|
48
|
-
type Story = StoryObj<typeof Grid>;
|
|
49
|
-
|
|
50
|
-
export const Default: Story = {};
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/addon-docs';
|
|
2
|
-
|
|
3
|
-
<Meta title="Layout/Layout Components" />
|
|
4
|
-
|
|
5
|
-
# Layout Components
|
|
6
|
-
|
|
7
|
-
This section provides implementations of various layout components inspired by [Every Layout](https://every-layout.dev/). These components are designed to create responsive, adaptable, and minimal CSS layouts, solving common design problems with composable and flexible solutions.
|
|
8
|
-
|
|
9
|
-
## The Box
|
|
10
|
-
|
|
11
|
-
The Box layout provides a simple way to add padding and a border to its content, useful for creating visually distinct sections. It's a fundamental building block for creating consistent spacing and visual separation in your designs.
|
|
12
|
-
|
|
13
|
-
Use cases:
|
|
14
|
-
|
|
15
|
-
- Creating card-like components
|
|
16
|
-
- Highlighting important content
|
|
17
|
-
- Separating sections in a form
|
|
18
|
-
|
|
19
|
-
[Box documentation page](?path=/docs/layout-box--docs)
|
|
20
|
-
|
|
21
|
-
```jsx
|
|
22
|
-
import { Box } from '@kalink-studio/ui/layout';
|
|
23
|
-
|
|
24
|
-
<Box padding="md" variant="plain">
|
|
25
|
-
<p>This is a box.</p>
|
|
26
|
-
</Box>;
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## The Stack
|
|
30
|
-
|
|
31
|
-
The Stack layout arranges its children vertically with a consistent gap between them. It's perfect for creating a vertical flow of elements, eliminating the need for manual margin management between elements.
|
|
32
|
-
|
|
33
|
-
Use cases:
|
|
34
|
-
|
|
35
|
-
- Organizing form fields
|
|
36
|
-
- Creating a vertical list of articles or comments
|
|
37
|
-
- Structuring content in a sidebar
|
|
38
|
-
|
|
39
|
-
[Stack documentation page](?path=/docs/layout-stack--docs)
|
|
40
|
-
|
|
41
|
-
```jsx
|
|
42
|
-
import { Stack } from '@kalink-studio/ui/layout';
|
|
43
|
-
|
|
44
|
-
<Stack spacing="md" recursive>
|
|
45
|
-
<div>Item 1</div>
|
|
46
|
-
<div>Item 2</div>
|
|
47
|
-
<div>
|
|
48
|
-
<div>Nested item 2.1</div>
|
|
49
|
-
<div>Nested item 2.2</div>
|
|
50
|
-
</div>
|
|
51
|
-
<div>Item 3</div>
|
|
52
|
-
</Stack>;
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## The Center
|
|
56
|
-
|
|
57
|
-
The Center layout is designed to center its content both horizontally and optionally vertically. It's particularly useful for creating visually balanced layouts and focusing attention on specific content.
|
|
58
|
-
|
|
59
|
-
Use cases:
|
|
60
|
-
|
|
61
|
-
- Creating hero sections
|
|
62
|
-
- Creating a centered column of content
|
|
63
|
-
- Designing error pages or "empty state" screens
|
|
64
|
-
|
|
65
|
-
[Center documentation page](?path=/docs/layout-center--docs)
|
|
66
|
-
|
|
67
|
-
```jsx
|
|
68
|
-
import { Center } from '@kalink-studio/ui/layout';
|
|
69
|
-
|
|
70
|
-
<Center gutters="md" intrinsic>
|
|
71
|
-
<p>This content is centered.</p>
|
|
72
|
-
</Center>;
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## The Cluster
|
|
76
|
-
|
|
77
|
-
The Cluster layout arranges elements in a flexible row that wraps to accommodate available space. It's ideal for layouts that need to manage many small items while maintaining consistent spacing and alignment.
|
|
78
|
-
|
|
79
|
-
Use cases:
|
|
80
|
-
|
|
81
|
-
- Displaying tags or categories
|
|
82
|
-
- Creating a flexible navigation menu
|
|
83
|
-
- Showing a group of action buttons
|
|
84
|
-
|
|
85
|
-
[Cluster documentation page](?path=/docs/layout-cluster--docs)
|
|
86
|
-
|
|
87
|
-
```jsx
|
|
88
|
-
import { Cluster } from '@kalink-studio/ui/layout';
|
|
89
|
-
|
|
90
|
-
<Cluster spacing="md" justify="center">
|
|
91
|
-
<div>Item 1</div>
|
|
92
|
-
<div>Item 2</div>
|
|
93
|
-
<div>Item 3</div>
|
|
94
|
-
<div>Item 4</div>
|
|
95
|
-
</Cluster>;
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## The Sidebar
|
|
99
|
-
|
|
100
|
-
The Sidebar layout divides content into a main section and a sidebar, which can be positioned on either side and resized according to the layout requirements. It's crucial for creating responsive layouts that adapt to different screen sizes.
|
|
101
|
-
|
|
102
|
-
Use cases:
|
|
103
|
-
|
|
104
|
-
- Creating a layout with a navigation sidebar
|
|
105
|
-
- Displaying additional information alongside main content
|
|
106
|
-
- Building dashboard layouts
|
|
107
|
-
|
|
108
|
-
[Sidebar documentation page](?path=/docs/layout-sidebar--docs)
|
|
109
|
-
|
|
110
|
-
```jsx
|
|
111
|
-
import { Sidebar } from '@kalink-studio/ui/layout';
|
|
112
|
-
|
|
113
|
-
<Sidebar sideWidth="250px" contentMinWidth="300px" spacing="md" side="left">
|
|
114
|
-
<div>Sidebar content</div>
|
|
115
|
-
<div>Main content</div>
|
|
116
|
-
</Sidebar>;
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## The Switcher
|
|
120
|
-
|
|
121
|
-
The Switcher layout allows elements to switch between a horizontal and vertical arrangement based on the available space. It's ideal for responsive design scenarios where content needs to adapt to different screen sizes seamlessly.
|
|
122
|
-
|
|
123
|
-
Use cases:
|
|
124
|
-
|
|
125
|
-
- Creating responsive navigation menus
|
|
126
|
-
- Designing flexible card layouts
|
|
127
|
-
- Building adaptable form layouts
|
|
128
|
-
|
|
129
|
-
[Switcher documentation page](?path=/docs/layout-switcher--docs)
|
|
130
|
-
|
|
131
|
-
```jsx
|
|
132
|
-
import { Switcher } from '@kalink-studio/ui/layout';
|
|
133
|
-
|
|
134
|
-
<Switcher threshold="300px" spacing="md">
|
|
135
|
-
<div>Item 1</div>
|
|
136
|
-
<div>Item 2</div>
|
|
137
|
-
<div>Item 3</div>
|
|
138
|
-
</Switcher>;
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## The Cover
|
|
142
|
-
|
|
143
|
-
The Cover layout helps create a vertically centered layout with a header, main content, and footer, ensuring that the main content stays centered. It's particularly useful for creating full-page layouts or sections that need to utilize the full viewport height.
|
|
144
|
-
|
|
145
|
-
Use cases:
|
|
146
|
-
|
|
147
|
-
- Designing landing pages
|
|
148
|
-
- Creating login or signup screens
|
|
149
|
-
- Building "coming soon" pages
|
|
150
|
-
|
|
151
|
-
[Cover documentation page](?path=/docs/layout-cover--docs)
|
|
152
|
-
|
|
153
|
-
```jsx
|
|
154
|
-
import { Cover } from '@kalink-studio/ui/layout';
|
|
155
|
-
|
|
156
|
-
<Cover minSize="60vh" spacing="md" noPad>
|
|
157
|
-
<header>Header</header>
|
|
158
|
-
<main>Main content</main>
|
|
159
|
-
<footer>Footer</footer>
|
|
160
|
-
</Cover>;
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## The Grid
|
|
164
|
-
|
|
165
|
-
The Grid layout provides a responsive grid system that adapts the number of columns based on available space, with defined gaps between columns and rows. It's perfect for creating complex, responsive layouts without the need for media queries.
|
|
166
|
-
|
|
167
|
-
Use cases:
|
|
168
|
-
|
|
169
|
-
- Displaying a gallery of images
|
|
170
|
-
- Creating a responsive product listing
|
|
171
|
-
- Organizing dashboard widgets
|
|
172
|
-
|
|
173
|
-
[Grid documentation page](?path=/docs/layout-grid--docs)
|
|
174
|
-
|
|
175
|
-
```jsx
|
|
176
|
-
import { Grid } from '@kalink-studio/ui/layout';
|
|
177
|
-
|
|
178
|
-
<Grid minSize="200px" spacing="md">
|
|
179
|
-
<div>Item 1</div>
|
|
180
|
-
<div>Item 2</div>
|
|
181
|
-
<div>Item 3</div>
|
|
182
|
-
<div>Item 4</div>
|
|
183
|
-
</Grid>;
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## The Frame
|
|
187
|
-
|
|
188
|
-
The Frame layout is used to maintain aspect ratios of embedded content, such as videos or iframes, ensuring that content scales appropriately while preserving its aspect ratio. It's crucial for responsive design and preventing layout shifts.
|
|
189
|
-
|
|
190
|
-
Use cases:
|
|
191
|
-
|
|
192
|
-
- Embedding responsive videos
|
|
193
|
-
- Displaying images with consistent aspect ratios
|
|
194
|
-
- Creating responsive data visualizations
|
|
195
|
-
|
|
196
|
-
[Frame documentation page](?path=/docs/layout-frame--docs)
|
|
197
|
-
|
|
198
|
-
```jsx
|
|
199
|
-
import { Frame } from '@kalink-studio/ui/layout';
|
|
200
|
-
|
|
201
|
-
<Frame ratio="16:9">
|
|
202
|
-
<img src="...">
|
|
203
|
-
</Frame>;
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
Each of these components is designed to solve specific layout challenges while promoting responsive and adaptable designs. By combining these layout primitives, you can create complex, flexible layouts that work across various screen sizes and devices, all while minimizing the amount of custom CSS required.
|
|
Binary file
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { argTypesFromRecipe, CommonArgs, commonArgs } from '@/utils/arg-types';
|
|
2
|
-
|
|
3
|
-
import { Sidebar } from './sidebar';
|
|
4
|
-
import { sidebarRecipe } from './sidebar.css';
|
|
5
|
-
|
|
6
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Layout/Sidebar',
|
|
10
|
-
component: Sidebar,
|
|
11
|
-
tags: ['autodocs'],
|
|
12
|
-
args: {
|
|
13
|
-
children: (
|
|
14
|
-
<>
|
|
15
|
-
<div>Sidebar</div>
|
|
16
|
-
<div>Main content</div>
|
|
17
|
-
</>
|
|
18
|
-
),
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
...argTypesFromRecipe(sidebarRecipe),
|
|
22
|
-
|
|
23
|
-
...commonArgs([
|
|
24
|
-
CommonArgs.COMPOSABLE,
|
|
25
|
-
CommonArgs.POLYMORPHIC,
|
|
26
|
-
CommonArgs.STYLABLE,
|
|
27
|
-
CommonArgs.REFERABLE,
|
|
28
|
-
]),
|
|
29
|
-
|
|
30
|
-
sideWidth: {
|
|
31
|
-
table: {
|
|
32
|
-
category: 'Recipe props',
|
|
33
|
-
},
|
|
34
|
-
control: { type: 'range', min: 1, max: 100, step: 1 },
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
contentMinWidth: {
|
|
38
|
-
table: {
|
|
39
|
-
category: 'Recipe props',
|
|
40
|
-
},
|
|
41
|
-
control: { type: 'range', min: 1, max: 100, step: 1 },
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
render: ({ sideWidth, contentMinWidth, ...args }) => (
|
|
46
|
-
<Sidebar
|
|
47
|
-
{...{
|
|
48
|
-
...(sideWidth && { sideWidth: `${sideWidth}%` }),
|
|
49
|
-
...(contentMinWidth && { contentMinWidth: `${contentMinWidth}%` }),
|
|
50
|
-
}}
|
|
51
|
-
{...args}
|
|
52
|
-
/>
|
|
53
|
-
),
|
|
54
|
-
} satisfies Meta<typeof Sidebar>;
|
|
55
|
-
|
|
56
|
-
export default meta;
|
|
57
|
-
|
|
58
|
-
type Story = StoryObj<typeof Sidebar>;
|
|
59
|
-
|
|
60
|
-
export const Default: Story = {};
|
|
Binary file
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { argTypesFromRecipe, CommonArgs, commonArgs } from '@/utils/arg-types';
|
|
2
|
-
|
|
3
|
-
import { Stack } from './stack';
|
|
4
|
-
import { stackRecipe } from './stack.css';
|
|
5
|
-
|
|
6
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Layout/Stack',
|
|
10
|
-
component: Stack,
|
|
11
|
-
tags: ['autodocs'],
|
|
12
|
-
parameters: {
|
|
13
|
-
layout: 'fullscreen',
|
|
14
|
-
},
|
|
15
|
-
args: {
|
|
16
|
-
children: (
|
|
17
|
-
<>
|
|
18
|
-
<div>Stack element one</div>
|
|
19
|
-
<div>Stack element two</div>
|
|
20
|
-
<div>Stack element three</div>
|
|
21
|
-
</>
|
|
22
|
-
),
|
|
23
|
-
},
|
|
24
|
-
argTypes: {
|
|
25
|
-
...argTypesFromRecipe(stackRecipe),
|
|
26
|
-
|
|
27
|
-
...commonArgs([
|
|
28
|
-
CommonArgs.COMPOSABLE,
|
|
29
|
-
CommonArgs.POLYMORPHIC,
|
|
30
|
-
CommonArgs.STYLABLE,
|
|
31
|
-
CommonArgs.REFERABLE,
|
|
32
|
-
]),
|
|
33
|
-
},
|
|
34
|
-
} satisfies Meta<typeof Stack>;
|
|
35
|
-
|
|
36
|
-
export default meta;
|
|
37
|
-
|
|
38
|
-
type Story = StoryObj<typeof Stack>;
|
|
39
|
-
|
|
40
|
-
export const Default: Story = {};
|
|
41
|
-
|
|
42
|
-
export const Nested: Story = {
|
|
43
|
-
args: {
|
|
44
|
-
recursive: true,
|
|
45
|
-
spacing: 4,
|
|
46
|
-
children: (
|
|
47
|
-
<>
|
|
48
|
-
<div>Stack element one</div>
|
|
49
|
-
<div>
|
|
50
|
-
<div>Stack element two</div>
|
|
51
|
-
<div>Stack element three</div>
|
|
52
|
-
</div>
|
|
53
|
-
<div>Stack element four</div>
|
|
54
|
-
</>
|
|
55
|
-
),
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const AsList: Story = {
|
|
60
|
-
args: {
|
|
61
|
-
spacing: 4,
|
|
62
|
-
use: 'ol',
|
|
63
|
-
children: (
|
|
64
|
-
<>
|
|
65
|
-
<li>Stack element one</li>
|
|
66
|
-
<li>Stack element two</li>
|
|
67
|
-
<li>Stack element three</li>
|
|
68
|
-
<li>Stack element four</li>
|
|
69
|
-
</>
|
|
70
|
-
),
|
|
71
|
-
},
|
|
72
|
-
};
|
|
Binary file
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import { argTypesFromRecipe, CommonArgs, commonArgs } from '@/utils/arg-types';
|
|
4
|
-
|
|
5
|
-
import { Switcher } from './switcher';
|
|
6
|
-
import { switcherRecipe } from './switcher.css';
|
|
7
|
-
|
|
8
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
9
|
-
|
|
10
|
-
type StoryArgs = ComponentPropsWithoutRef<typeof Switcher> & {
|
|
11
|
-
childCount: number;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const meta = {
|
|
15
|
-
title: 'Layout/Switcher',
|
|
16
|
-
component: Switcher,
|
|
17
|
-
tags: ['autodocs'],
|
|
18
|
-
argTypes: {
|
|
19
|
-
...argTypesFromRecipe(switcherRecipe),
|
|
20
|
-
|
|
21
|
-
...commonArgs([
|
|
22
|
-
CommonArgs.COMPOSABLE,
|
|
23
|
-
CommonArgs.POLYMORPHIC,
|
|
24
|
-
CommonArgs.STYLABLE,
|
|
25
|
-
CommonArgs.REFERABLE,
|
|
26
|
-
]),
|
|
27
|
-
|
|
28
|
-
threshold: {
|
|
29
|
-
table: {
|
|
30
|
-
category: 'Recipe props',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
limit: {
|
|
35
|
-
table: {
|
|
36
|
-
category: 'Recipe props',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
childCount: {
|
|
41
|
-
control: { type: 'range', min: 1, max: 10, step: 1 },
|
|
42
|
-
table: {
|
|
43
|
-
category: 'Story args',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
args: {
|
|
49
|
-
childCount: 4,
|
|
50
|
-
},
|
|
51
|
-
render: ({ childCount, ...args }) => {
|
|
52
|
-
return (
|
|
53
|
-
<Switcher {...args}>
|
|
54
|
-
{new Array(childCount).fill('').map((_, index) => (
|
|
55
|
-
<div key={index}>{`Block ${index + 1}`}</div>
|
|
56
|
-
))}
|
|
57
|
-
</Switcher>
|
|
58
|
-
);
|
|
59
|
-
},
|
|
60
|
-
} satisfies Meta<StoryArgs>;
|
|
61
|
-
|
|
62
|
-
export default meta;
|
|
63
|
-
|
|
64
|
-
type Story = StoryObj<StoryArgs>;
|
|
65
|
-
|
|
66
|
-
export const Default: Story = {};
|
|
Binary file
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { sprinkles, sprinklesProps } from '@/storybook/theme/sprinkles.css';
|
|
2
|
-
import {
|
|
3
|
-
CommonArgs,
|
|
4
|
-
commonArgs,
|
|
5
|
-
argTypesFromSprinkles,
|
|
6
|
-
} from '@/utils/arg-types';
|
|
7
|
-
|
|
8
|
-
import { plantSeed } from './seed';
|
|
9
|
-
|
|
10
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
11
|
-
|
|
12
|
-
const Sprout = plantSeed({ sprinkles });
|
|
13
|
-
|
|
14
|
-
const meta = {
|
|
15
|
-
title: 'Styles/Sprout',
|
|
16
|
-
component: Sprout,
|
|
17
|
-
tags: ['autodocs'],
|
|
18
|
-
args: {
|
|
19
|
-
children: 'Box content',
|
|
20
|
-
},
|
|
21
|
-
argTypes: {
|
|
22
|
-
...argTypesFromSprinkles({ props: sprinklesProps }),
|
|
23
|
-
|
|
24
|
-
...commonArgs([
|
|
25
|
-
CommonArgs.COMPOSABLE,
|
|
26
|
-
CommonArgs.POLYMORPHIC,
|
|
27
|
-
CommonArgs.STYLABLE,
|
|
28
|
-
CommonArgs.REFERABLE,
|
|
29
|
-
]),
|
|
30
|
-
},
|
|
31
|
-
} satisfies Meta<typeof Sprout>;
|
|
32
|
-
|
|
33
|
-
export default meta;
|
|
34
|
-
|
|
35
|
-
type Story = StoryObj<typeof Sprout>;
|
|
36
|
-
|
|
37
|
-
export const Default: Story = {};
|
|
38
|
-
|
|
39
|
-
export const WithSprinklesProps: Story = {
|
|
40
|
-
args: {
|
|
41
|
-
padding: 'medium',
|
|
42
|
-
backgroundColor: 'blue',
|
|
43
|
-
color: 'white',
|
|
44
|
-
textAlign: 'center',
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const UseElement: Story = {
|
|
49
|
-
args: {
|
|
50
|
-
use: 'h1',
|
|
51
|
-
},
|
|
52
|
-
};
|
package/src/styles/styles.mdx
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/addon-docs';
|
|
2
|
-
|
|
3
|
-
<Meta title="Styles/Styles Documentation" />
|
|
4
|
-
|
|
5
|
-
# Styles Documentation
|
|
6
|
-
|
|
7
|
-
This document provides an overview of two important files in our styling system: `contract.css.ts` and `seed.tsx`.
|
|
8
|
-
|
|
9
|
-
## contract.css.ts
|
|
10
|
-
|
|
11
|
-
The `contract.css.ts` file defines the type contract for our design system's typography. It establishes a consistent structure for different text styles across various sizes.
|
|
12
|
-
|
|
13
|
-
### Structure
|
|
14
|
-
|
|
15
|
-
The type contract is organized into the following categories:
|
|
16
|
-
|
|
17
|
-
- `display`
|
|
18
|
-
- `headline`
|
|
19
|
-
- `title`
|
|
20
|
-
- `label`
|
|
21
|
-
- `body`
|
|
22
|
-
|
|
23
|
-
Each category has three size variants:
|
|
24
|
-
|
|
25
|
-
- `large`
|
|
26
|
-
- `medium`
|
|
27
|
-
- `small`
|
|
28
|
-
|
|
29
|
-
### Usage
|
|
30
|
-
|
|
31
|
-
This contract ensures that all typography in the application follows a consistent structure. It can be used to create theme variations and maintain a coherent typographic scale across the entire design system.
|
|
32
|
-
|
|
33
|
-
Example of the structure:
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
type: {
|
|
37
|
-
display: {
|
|
38
|
-
large: typeContract,
|
|
39
|
-
medium: typeContract,
|
|
40
|
-
small: typeContract,
|
|
41
|
-
},
|
|
42
|
-
// ... other categories
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## seed.tsx
|
|
47
|
-
|
|
48
|
-
The `seed.tsx` file provides a foundation for creating flexible, polymorphic components with built-in support for design system styles.
|
|
49
|
-
|
|
50
|
-
### Key Features
|
|
51
|
-
|
|
52
|
-
1. **Polymorphic Components**: Allows components to change their root HTML element.
|
|
53
|
-
2. **Sprinkles Integration**: Incorporates the Sprinkles CSS-in-JS solution for applying atomic styles.
|
|
54
|
-
3. **Type Safety**: Ensures type safety for props and element types.
|
|
55
|
-
|
|
56
|
-
### Main Functions
|
|
57
|
-
|
|
58
|
-
#### `plantSeed`
|
|
59
|
-
|
|
60
|
-
This function creates a base component (Seed) that can be used to build other components in the design system.
|
|
61
|
-
|
|
62
|
-
Parameters:
|
|
63
|
-
|
|
64
|
-
- `sprinkles`: A Sprinkles function for applying atomic styles.
|
|
65
|
-
- `defaultClassName`: An optional default class name for the component.
|
|
66
|
-
|
|
67
|
-
Usage:
|
|
68
|
-
|
|
69
|
-
```jsx
|
|
70
|
-
import { plantSeed } from './seed';
|
|
71
|
-
import { sprinkles } from './your-sprinkles-file';
|
|
72
|
-
|
|
73
|
-
const Sprout = plantSeed({ sprinkles });
|
|
74
|
-
|
|
75
|
-
// Use Sprout as a base for other components
|
|
76
|
-
const Box = (props) => <Sprout {...props} />;
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Types
|
|
80
|
-
|
|
81
|
-
#### `SeedProps`
|
|
82
|
-
|
|
83
|
-
This type combines polymorphic component props with Sprinkles props:
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
type SeedProps<
|
|
87
|
-
TUse extends ElementType,
|
|
88
|
-
TSprinklesFn extends SprinklesFnBase,
|
|
89
|
-
> = PolymorphicComponentProps<TUse> & GetSprinkles<TSprinklesFn>;
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Benefits
|
|
93
|
-
|
|
94
|
-
- **Consistency**: Ensures all components built with `plantSeed` have consistent prop interfaces.
|
|
95
|
-
- **Flexibility**: Allows easy creation of new components with full access to design system styles.
|
|
96
|
-
- **Performance**: Leverages Sprinkles for efficient CSS generation and application.
|
|
97
|
-
|
|
98
|
-
By using `contract.css.ts` and `seed.tsx` together, you can create a robust, type-safe, and flexible foundation for your design system components.
|