@taiv/ui 1.11.0 → 1.13.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/dist/assets/assets.d.ts +5 -0
- package/dist/assets/assets.d.ts.map +1 -0
- package/dist/assets/assets.js +18 -0
- package/dist/assets/icons.d.ts +6 -0
- package/dist/assets/icons.d.ts.map +1 -0
- package/dist/assets/icons.js +57 -0
- package/dist/components/Info/Modals/Modal/Modal.stories.d.ts +7 -0
- package/dist/components/Info/Modals/Modal/Modal.stories.d.ts.map +1 -0
- package/dist/components/Info/Modals/Modal/Modal.stories.js +61 -0
- package/dist/components/Info/Modals/Modals.stories.d.ts +16 -0
- package/dist/components/Info/Modals/Modals.stories.d.ts.map +1 -0
- package/dist/components/Info/Modals/Modals.stories.js +101 -0
- package/dist/components/Info/Notifications/Notifications.stories.d.ts +10 -0
- package/dist/components/Info/Notifications/Notifications.stories.d.ts.map +1 -0
- package/dist/components/Info/Notifications/Notifications.stories.js +106 -0
- package/dist/components/Inputs/Buttons/Button/Button.stories.d.ts +1 -0
- package/dist/components/Inputs/Buttons/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/Button/Button.stories.js +50 -44
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.d.ts +26 -0
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.d.ts.map +1 -0
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.js +41 -0
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.stories.d.ts +13 -0
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.stories.d.ts.map +1 -0
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.stories.js +231 -0
- package/dist/components/Layout/AutoGrid/AutoGrid.stories.d.ts +7 -0
- package/dist/components/Layout/AutoGrid/AutoGrid.stories.d.ts.map +1 -0
- package/dist/components/Layout/AutoGrid/AutoGrid.stories.js +78 -0
- package/dist/components/Layout/Box/Box.d.ts +1 -3
- package/dist/components/Layout/Box/Box.d.ts.map +1 -1
- package/dist/components/Layout/Box/Box.js +2 -2
- package/dist/components/Layout/Box/Box.stories.d.ts +1 -2
- package/dist/components/Layout/Box/Box.stories.d.ts.map +1 -1
- package/dist/components/Layout/Box/Box.stories.js +27 -98
- package/dist/components/Layout/Card/Card.d.ts +1 -1
- package/dist/components/Layout/Card/Card.d.ts.map +1 -1
- package/dist/components/Layout/Card/Card.js +2 -2
- package/dist/components/Layout/Card/Card.stories.d.ts +10 -0
- package/dist/components/Layout/Card/Card.stories.d.ts.map +1 -0
- package/dist/components/Layout/Card/Card.stories.js +91 -0
- package/dist/components/Layout/Center/Center.d.ts +2 -3
- package/dist/components/Layout/Center/Center.d.ts.map +1 -1
- package/dist/components/Layout/Center/Center.js +2 -2
- package/dist/components/Layout/Center/Center.stories.d.ts +8 -0
- package/dist/components/Layout/Center/Center.stories.d.ts.map +1 -0
- package/dist/components/Layout/Center/Center.stories.js +69 -0
- package/dist/components/Layout/Divider/Divider.stories.d.ts +7 -0
- package/dist/components/Layout/Divider/Divider.stories.d.ts.map +1 -0
- package/dist/components/Layout/Divider/Divider.stories.js +67 -0
- package/dist/components/Layout/Frame/Frame.stories.d.ts +8 -0
- package/dist/components/Layout/Frame/Frame.stories.d.ts.map +1 -0
- package/dist/components/Layout/Frame/Frame.stories.js +77 -0
- package/dist/components/Layout/Grid/Grid.stories.d.ts +8 -0
- package/dist/components/Layout/Grid/Grid.stories.d.ts.map +1 -0
- package/dist/components/Layout/Grid/Grid.stories.js +71 -0
- package/dist/components/Layout/Group/Group.stories.d.ts +10 -0
- package/dist/components/Layout/Group/Group.stories.d.ts.map +1 -0
- package/dist/components/Layout/Group/Group.stories.js +113 -0
- package/dist/components/Layout/Loader/Loader.stories.d.ts +10 -0
- package/dist/components/Layout/Loader/Loader.stories.d.ts.map +1 -0
- package/dist/components/Layout/Loader/Loader.stories.js +67 -0
- package/dist/components/Layout/SectionCard/SectionCard.d.ts +3 -5
- package/dist/components/Layout/SectionCard/SectionCard.d.ts.map +1 -1
- package/dist/components/Layout/SectionCard/SectionCard.js +3 -8
- package/dist/components/Layout/SectionCard/SectionCard.stories.d.ts +9 -0
- package/dist/components/Layout/SectionCard/SectionCard.stories.d.ts.map +1 -0
- package/dist/components/Layout/SectionCard/SectionCard.stories.js +98 -0
- package/dist/components/Layout/Stack/Stack.stories.d.ts +1 -2
- package/dist/components/Layout/Stack/Stack.stories.d.ts.map +1 -1
- package/dist/components/Layout/Stack/Stack.stories.js +46 -66
- package/dist/components/Layout/Tabs/Tabs.d.ts +2 -4
- package/dist/components/Layout/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Layout/Tabs/Tabs.js +2 -2
- package/dist/components/Layout/Tabs/Tabs.stories.d.ts +9 -0
- package/dist/components/Layout/Tabs/Tabs.stories.d.ts.map +1 -0
- package/dist/components/Layout/Tabs/Tabs.stories.js +140 -0
- package/dist/components/Misc/IconBadge/IconBadge.stories.d.ts +7 -0
- package/dist/components/Misc/IconBadge/IconBadge.stories.d.ts.map +1 -0
- package/dist/components/Misc/IconBadge/IconBadge.stories.js +48 -0
- package/dist/components/Typography/Formula/Formula.js +2 -2
- package/dist/components/Typography/Formula/Formula.stories.d.ts +10 -0
- package/dist/components/Typography/Formula/Formula.stories.d.ts.map +1 -0
- package/dist/components/Typography/Formula/Formula.stories.js +85 -0
- package/dist/components/Typography/Fraction/Fraction.d.ts.map +1 -1
- package/dist/components/Typography/Fraction/Fraction.stories.d.ts +9 -0
- package/dist/components/Typography/Fraction/Fraction.stories.d.ts.map +1 -0
- package/dist/components/Typography/Fraction/Fraction.stories.js +86 -0
- package/dist/components/Typography/Text/Text.d.ts.map +1 -1
- package/dist/components/Typography/Text/Text.js +6 -0
- package/dist/components/Typography/Text/Text.stories.d.ts +10 -0
- package/dist/components/Typography/Text/Text.stories.d.ts.map +1 -0
- package/dist/components/Typography/Text/Text.stories.js +101 -0
- package/dist/components/Typography/Title/Title.stories.d.ts +9 -0
- package/dist/components/Typography/Title/Title.stories.d.ts.map +1 -0
- package/dist/components/Typography/Title/Title.stories.js +98 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/constants/colors.d.ts +1 -0
- package/dist/constants/colors.d.ts.map +1 -1
- package/dist/constants/colors.js +1 -0
- package/dist/docs/AIGeneratedBanner.d.ts +2 -0
- package/dist/docs/AIGeneratedBanner.d.ts.map +1 -0
- package/dist/docs/AIGeneratedBanner.js +5 -0
- package/dist/docs/design/Colors.stories.d.ts +7 -0
- package/dist/docs/design/Colors.stories.d.ts.map +1 -0
- package/dist/docs/design/Colors.stories.js +28 -0
- package/dist/docs/hooks/Copy.stories.d.ts +6 -0
- package/dist/docs/hooks/Copy.stories.d.ts.map +1 -0
- package/dist/docs/hooks/Copy.stories.js +61 -0
- package/package.json +6 -6
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { SegmentedControl } from './SegmentedControl';
|
|
3
|
+
declare const meta: Meta<typeof SegmentedControl>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Sizes: Story;
|
|
8
|
+
export declare const StringData: Story;
|
|
9
|
+
export declare const States: Story;
|
|
10
|
+
export declare const FullWidth: Story;
|
|
11
|
+
export declare const Orientation: Story;
|
|
12
|
+
export declare const CustomStyles: Story;
|
|
13
|
+
//# sourceMappingURL=SegmentedControl.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Controls/SegmentedControl/SegmentedControl.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAUtD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAkHvC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KA8BrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAenB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAWxB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAwBpB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAavB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAczB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KA2B1B,CAAC"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { SegmentedControl } from './SegmentedControl';
|
|
4
|
+
import { Group } from '../../../Layout/Group/Group';
|
|
5
|
+
import { Stack } from '../../../Layout/Stack/Stack';
|
|
6
|
+
const sampleData = [
|
|
7
|
+
{ label: 'React', value: 'react' },
|
|
8
|
+
{ label: 'Angular', value: 'ng' },
|
|
9
|
+
{ label: 'Vue', value: 'vue' },
|
|
10
|
+
];
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'Components/Inputs/Controls/SegmentedControl',
|
|
13
|
+
component: SegmentedControl,
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'centered',
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
size: {
|
|
19
|
+
control: { type: 'select' },
|
|
20
|
+
options: ['sm', 'md', 'lg'],
|
|
21
|
+
description: 'Controls segment padding and label font size',
|
|
22
|
+
table: {
|
|
23
|
+
type: { summary: "'sm' | 'md' | 'lg'" },
|
|
24
|
+
defaultValue: { summary: "'md'" },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
data: {
|
|
28
|
+
control: { type: 'object' },
|
|
29
|
+
description: 'Segments as strings or { value, label, disabled? } objects',
|
|
30
|
+
table: {
|
|
31
|
+
type: { summary: "string[] | SegmentedControlItem[]" },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
value: {
|
|
35
|
+
control: { type: 'text' },
|
|
36
|
+
description: 'Selected segment value (controlled)',
|
|
37
|
+
table: {
|
|
38
|
+
type: { summary: 'string' },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
defaultValue: {
|
|
42
|
+
control: { type: 'text' },
|
|
43
|
+
description: 'Default value when uncontrolled',
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: 'string' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
disabled: {
|
|
49
|
+
control: { type: 'boolean' },
|
|
50
|
+
description: 'Disables the entire control',
|
|
51
|
+
table: {
|
|
52
|
+
type: { summary: 'boolean' },
|
|
53
|
+
defaultValue: { summary: 'false' },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
fullWidth: {
|
|
57
|
+
control: { type: 'boolean' },
|
|
58
|
+
description: 'Stretch to 100% of the container width',
|
|
59
|
+
table: {
|
|
60
|
+
type: { summary: 'boolean' },
|
|
61
|
+
defaultValue: { summary: 'false' },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
orientation: {
|
|
65
|
+
control: { type: 'select' },
|
|
66
|
+
options: ['horizontal', 'vertical'],
|
|
67
|
+
description: 'Layout direction of segments',
|
|
68
|
+
table: {
|
|
69
|
+
type: { summary: "'horizontal' | 'vertical'" },
|
|
70
|
+
defaultValue: { summary: "'horizontal'" },
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
readOnly: {
|
|
74
|
+
control: { type: 'boolean' },
|
|
75
|
+
description: 'Non-interactive but not visually disabled',
|
|
76
|
+
table: {
|
|
77
|
+
type: { summary: 'boolean' },
|
|
78
|
+
defaultValue: { summary: 'false' },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
color: {
|
|
82
|
+
control: { type: 'color' },
|
|
83
|
+
description: 'Active segment color (Mantine color key or CSS color)',
|
|
84
|
+
table: {
|
|
85
|
+
type: { summary: 'MantineColor' },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
radius: {
|
|
89
|
+
control: { type: 'text' },
|
|
90
|
+
description: 'Border radius (theme key or CSS value)',
|
|
91
|
+
table: {
|
|
92
|
+
type: { summary: "MantineNumberSize" },
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
transitionDuration: {
|
|
96
|
+
control: { type: 'number' },
|
|
97
|
+
description: 'Transition duration in ms (0 to disable)',
|
|
98
|
+
table: {
|
|
99
|
+
type: { summary: 'number' },
|
|
100
|
+
defaultValue: { summary: '200' },
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
name: {
|
|
104
|
+
control: { type: 'text' },
|
|
105
|
+
description: 'Name attribute for the underlying radio group',
|
|
106
|
+
table: {
|
|
107
|
+
type: { summary: 'string' },
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
styles: {
|
|
111
|
+
control: { type: 'object' },
|
|
112
|
+
description: 'Custom styles object (Mantine Styles API)',
|
|
113
|
+
table: {
|
|
114
|
+
type: { summary: 'Record<string, CSSObject>' },
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
onChange: {
|
|
118
|
+
action: 'changed',
|
|
119
|
+
description: 'Called with the new value when selection changes',
|
|
120
|
+
table: {
|
|
121
|
+
type: { summary: '(value: string) => void' },
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
export default meta;
|
|
127
|
+
export const Default = {
|
|
128
|
+
render: (args) => {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
const [value, setValue] = useState((_a = args.value) !== null && _a !== void 0 ? _a : 'react');
|
|
131
|
+
return _jsx(SegmentedControl, { ...args, data: (_b = args.data) !== null && _b !== void 0 ? _b : sampleData, value: value, onChange: setValue });
|
|
132
|
+
},
|
|
133
|
+
args: {
|
|
134
|
+
data: sampleData,
|
|
135
|
+
size: 'md',
|
|
136
|
+
disabled: false,
|
|
137
|
+
fullWidth: false,
|
|
138
|
+
orientation: 'horizontal',
|
|
139
|
+
readOnly: false,
|
|
140
|
+
},
|
|
141
|
+
parameters: {
|
|
142
|
+
docs: {
|
|
143
|
+
source: {
|
|
144
|
+
code: `const [value, setValue] = useState('react');
|
|
145
|
+
|
|
146
|
+
<SegmentedControl
|
|
147
|
+
data={[
|
|
148
|
+
{ label: 'React', value: 'react' },
|
|
149
|
+
{ label: 'Angular', value: 'ng' },
|
|
150
|
+
{ label: 'Vue', value: 'vue' },
|
|
151
|
+
]}
|
|
152
|
+
value={value}
|
|
153
|
+
onChange={setValue}
|
|
154
|
+
/>`,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
export const Sizes = {
|
|
160
|
+
render: () => (_jsxs(Stack, { gap: "1.6rem", children: [_jsx(SegmentedControl, { size: "sm", data: sampleData, value: "react", onChange: () => { } }), _jsx(SegmentedControl, { size: "md", data: sampleData, value: "ng", onChange: () => { } }), _jsx(SegmentedControl, { size: "lg", data: sampleData, value: "vue", onChange: () => { } })] })),
|
|
161
|
+
parameters: {
|
|
162
|
+
docs: {
|
|
163
|
+
source: {
|
|
164
|
+
code: false,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
export const StringData = {
|
|
170
|
+
render: () => (_jsx(SegmentedControl, { data: ['Day', 'Week', 'Month', 'Year'], value: "Week", onChange: () => { } })),
|
|
171
|
+
parameters: {
|
|
172
|
+
docs: {
|
|
173
|
+
source: {
|
|
174
|
+
code: false,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
export const States = {
|
|
180
|
+
render: () => (_jsxs(Stack, { gap: "1.6rem", style: { minWidth: '28rem' }, children: [_jsx(SegmentedControl, { data: sampleData, value: "react", onChange: () => { } }), _jsx(SegmentedControl, { data: sampleData, value: "react", onChange: () => { }, disabled: true }), _jsx(SegmentedControl, { data: [
|
|
181
|
+
{ value: 'preview', label: 'Preview', disabled: true },
|
|
182
|
+
{ value: 'code', label: 'Code' },
|
|
183
|
+
{ value: 'export', label: 'Export' },
|
|
184
|
+
], value: "code", onChange: () => { } }), _jsx(SegmentedControl, { data: sampleData, value: "vue", onChange: () => { }, readOnly: true })] })),
|
|
185
|
+
parameters: {
|
|
186
|
+
docs: {
|
|
187
|
+
source: {
|
|
188
|
+
code: false,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
export const FullWidth = {
|
|
194
|
+
render: () => (_jsx("div", { style: { width: '36rem', maxWidth: '100%' }, children: _jsx(SegmentedControl, { fullWidth: true, data: sampleData, value: "react", onChange: () => { } }) })),
|
|
195
|
+
parameters: {
|
|
196
|
+
docs: {
|
|
197
|
+
source: {
|
|
198
|
+
code: false,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
export const Orientation = {
|
|
204
|
+
render: () => (_jsxs(Group, { gap: "3rem", align: "flex-start", children: [_jsx(SegmentedControl, { data: sampleData, value: "ng", onChange: () => { }, orientation: "horizontal" }), _jsx(SegmentedControl, { data: sampleData, value: "vue", onChange: () => { }, orientation: "vertical" })] })),
|
|
205
|
+
parameters: {
|
|
206
|
+
docs: {
|
|
207
|
+
source: {
|
|
208
|
+
code: false,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
export const CustomStyles = {
|
|
214
|
+
render: () => (_jsx(Group, { gap: "2rem", children: _jsx(SegmentedControl, { data: sampleData, value: "react", onChange: () => { }, styles: {
|
|
215
|
+
root: {
|
|
216
|
+
backgroundColor: '#f0f4f8',
|
|
217
|
+
},
|
|
218
|
+
label: {
|
|
219
|
+
'&:not([data-active])': {
|
|
220
|
+
color: '#495057',
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
} }) })),
|
|
224
|
+
parameters: {
|
|
225
|
+
docs: {
|
|
226
|
+
source: {
|
|
227
|
+
code: false,
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { AutoGrid } from './AutoGrid';
|
|
3
|
+
declare const meta: Meta<typeof AutoGrid>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
//# sourceMappingURL=AutoGrid.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoGrid.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/AutoGrid/AutoGrid.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAqD/B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAkBnC,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AutoGrid } from './AutoGrid';
|
|
3
|
+
import { Card } from '../Card/Card';
|
|
4
|
+
import { Title } from '../../Typography/Title/Title';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/Layout/AutoGrid',
|
|
7
|
+
component: AutoGrid,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: "[View Mantine Docs](https://v6.mantine.dev/core/simple-grid/)\n\nThe AutoGrid component is a responsive grid where each item takes an equal amount of space. It extends Mantine v6's SimpleGrid component and provides automatic column distribution with customizable spacing.",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
children: {
|
|
18
|
+
control: false,
|
|
19
|
+
description: 'Content for the AutoGrid - each child node is a grid item',
|
|
20
|
+
table: {
|
|
21
|
+
type: { summary: 'ReactNode' },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
cols: {
|
|
25
|
+
control: { type: 'number' },
|
|
26
|
+
description: 'Number of columns in each row',
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: 'number | ResponsiveObject' },
|
|
29
|
+
defaultValue: { summary: '1' },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
spacing: {
|
|
33
|
+
control: { type: 'select' },
|
|
34
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
35
|
+
description: 'Horizontal spacing between items',
|
|
36
|
+
table: {
|
|
37
|
+
type: { summary: "'xs' | 'sm' | 'md' | 'lg' | 'xl' | number" },
|
|
38
|
+
defaultValue: { summary: "'md'" },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
verticalSpacing: {
|
|
42
|
+
control: { type: 'select' },
|
|
43
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
44
|
+
description: 'Vertical spacing between items',
|
|
45
|
+
table: {
|
|
46
|
+
type: { summary: "'xs' | 'sm' | 'md' | 'lg' | 'xl' | number" },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
styles: {
|
|
50
|
+
control: { type: 'object' },
|
|
51
|
+
description: 'Custom styles to override with if necessary',
|
|
52
|
+
table: {
|
|
53
|
+
type: { summary: 'Record<string, CSSObject>' },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export default meta;
|
|
59
|
+
const SampleCard = ({ title, description }) => (_jsxs(Card, { animate: true, padding: "lg", children: [_jsx(Title, { variant: "cardHeader", children: title }), _jsx(Title, { variant: "cardSubheader", children: description })] }));
|
|
60
|
+
const items = [
|
|
61
|
+
{ id: 1, title: 'Item 1', description: 'Grid item content' },
|
|
62
|
+
{ id: 2, title: 'Item 2', description: 'Grid item content' },
|
|
63
|
+
{ id: 3, title: 'Item 3', description: 'Grid item content' },
|
|
64
|
+
{ id: 4, title: 'Item 4', description: 'Grid item content' },
|
|
65
|
+
{ id: 5, title: 'Item 5', description: 'Grid item content' },
|
|
66
|
+
{ id: 6, title: 'Item 6', description: 'Grid item content' },
|
|
67
|
+
];
|
|
68
|
+
export const Default = {
|
|
69
|
+
args: {
|
|
70
|
+
children: undefined,
|
|
71
|
+
cols: 3,
|
|
72
|
+
spacing: 'md',
|
|
73
|
+
},
|
|
74
|
+
decorators: [
|
|
75
|
+
(Story) => (_jsx("div", { style: { width: '700px' }, children: _jsx(Story, {}) })),
|
|
76
|
+
],
|
|
77
|
+
render: (args) => (_jsx(AutoGrid, { ...args, children: items.map((item) => (_jsx(SampleCard, { title: item.title, description: item.description }, item.id))) })),
|
|
78
|
+
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { BoxProps as MantineBoxProps } from '@mantine/core';
|
|
2
|
-
import { CSSObject } from '@mantine/styles';
|
|
3
2
|
interface BoxProps extends MantineBoxProps {
|
|
4
3
|
width?: string | number;
|
|
5
4
|
onClick?: () => void;
|
|
6
|
-
styles?: Record<string, CSSObject>;
|
|
7
5
|
}
|
|
8
|
-
declare const Box: ({ width,
|
|
6
|
+
declare const Box: ({ width, onClick, ...props }: BoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
7
|
export { Box };
|
|
10
8
|
//# sourceMappingURL=Box.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Box/Box.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqB,QAAQ,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Box/Box.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqB,QAAQ,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAE/E,UAAU,QAAS,SAAQ,eAAe;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,GAAG,GAAI,8BAA8B,QAAQ,4CAElD,CAAC;AAEF,OAAO,EAAE,GAAG,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box as MantineBox } from '@mantine/core';
|
|
3
|
-
const Box = ({ width,
|
|
4
|
-
return _jsx(MantineBox, { w: width,
|
|
3
|
+
const Box = ({ width, onClick, ...props }) => {
|
|
4
|
+
return _jsx(MantineBox, { w: width, onClick: onClick, ...props });
|
|
5
5
|
};
|
|
6
6
|
export { Box };
|
|
@@ -4,6 +4,5 @@ declare const meta: Meta<typeof Box>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const CustomStyling: Story;
|
|
7
|
+
export declare const BoxStyling: Story;
|
|
9
8
|
//# sourceMappingURL=Box.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Box/Box.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Box.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Box/Box.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAK5B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,GAAG,CAuB1B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAgBxB,CAAC"}
|
|
@@ -1,121 +1,50 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from './Box';
|
|
3
|
-
import {
|
|
3
|
+
import { Text } from '../../Typography/Text/Text';
|
|
4
|
+
import { neutral } from '../../../constants/colors';
|
|
4
5
|
const meta = {
|
|
5
|
-
title: '
|
|
6
|
+
title: 'Components/Layout/Box',
|
|
6
7
|
component: Box,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
7
11
|
argTypes: {
|
|
12
|
+
children: {
|
|
13
|
+
control: { type: 'text' },
|
|
14
|
+
description: 'Content to render inside the Box',
|
|
15
|
+
table: { type: { summary: 'ReactNode' } },
|
|
16
|
+
},
|
|
8
17
|
width: {
|
|
9
18
|
control: { type: 'text' },
|
|
10
19
|
description: 'Custom width',
|
|
11
|
-
table: {
|
|
12
|
-
type: { summary: 'string | number' },
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
styles: {
|
|
16
|
-
control: { type: 'object' },
|
|
17
|
-
description: 'Custom styles object',
|
|
18
|
-
table: {
|
|
19
|
-
type: { summary: 'Record<string, CSSObject>' },
|
|
20
|
-
},
|
|
20
|
+
table: { type: { summary: 'string | number' } },
|
|
21
21
|
},
|
|
22
22
|
onClick: {
|
|
23
23
|
action: 'clicked',
|
|
24
24
|
description: 'Click handler function',
|
|
25
|
-
table: {
|
|
26
|
-
type: { summary: '() => void' },
|
|
27
|
-
},
|
|
25
|
+
table: { type: { summary: '() => void' } },
|
|
28
26
|
},
|
|
29
27
|
},
|
|
30
28
|
};
|
|
31
29
|
export default meta;
|
|
32
30
|
export const Default = {
|
|
33
31
|
args: {
|
|
34
|
-
children: 'Box
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
code: `<Box
|
|
40
|
-
sx={(theme) => ({
|
|
41
|
-
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0],
|
|
42
|
-
textAlign: 'center',
|
|
43
|
-
padding: theme.spacing.xl,
|
|
44
|
-
borderRadius: theme.radius.md,
|
|
45
|
-
cursor: 'pointer',
|
|
46
|
-
'&:hover': {
|
|
47
|
-
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[1],
|
|
48
|
-
},
|
|
49
|
-
})}
|
|
50
|
-
>
|
|
51
|
-
Box lets you add inline styles with sx prop
|
|
52
|
-
</Box>`,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
export const Alignment = {
|
|
58
|
-
render: () => (_jsxs(Group, { gap: "2rem", children: [_jsx(Box, { sx: (theme) => ({
|
|
59
|
-
backgroundColor: theme.colors.blue[0],
|
|
60
|
-
padding: theme.spacing.md,
|
|
61
|
-
borderRadius: theme.radius.md,
|
|
62
|
-
textAlign: 'left',
|
|
63
|
-
border: `1px solid ${theme.colors.blue[3]}`,
|
|
64
|
-
}), children: "Left Aligned" }), _jsx(Box, { sx: (theme) => ({
|
|
65
|
-
backgroundColor: theme.colors.green[0],
|
|
66
|
-
padding: theme.spacing.md,
|
|
67
|
-
borderRadius: theme.radius.md,
|
|
68
|
-
textAlign: 'center',
|
|
69
|
-
border: `1px solid ${theme.colors.green[3]}`,
|
|
70
|
-
}), children: "Center Aligned" }), _jsx(Box, { sx: (theme) => ({
|
|
71
|
-
backgroundColor: theme.colors.orange[0],
|
|
72
|
-
padding: theme.spacing.md,
|
|
73
|
-
borderRadius: theme.radius.md,
|
|
74
|
-
textAlign: 'right',
|
|
75
|
-
border: `1px solid ${theme.colors.orange[3]}`,
|
|
76
|
-
}), children: "Right Aligned" })] })),
|
|
77
|
-
parameters: {
|
|
78
|
-
docs: {
|
|
79
|
-
source: {
|
|
80
|
-
code: `<Box
|
|
81
|
-
sx={(theme) => ({
|
|
82
|
-
textAlign: 'center',
|
|
83
|
-
padding: theme.spacing.md,
|
|
84
|
-
backgroundColor: theme.colors.blue[0],
|
|
85
|
-
})}
|
|
86
|
-
>
|
|
87
|
-
Center Aligned Content
|
|
88
|
-
</Box>`,
|
|
89
|
-
},
|
|
32
|
+
children: 'Box is a styled div — use it as a wrapper or for custom styling',
|
|
33
|
+
sx: {
|
|
34
|
+
backgroundColor: neutral[50],
|
|
35
|
+
padding: '2.4rem',
|
|
36
|
+
borderRadius: '8px',
|
|
90
37
|
},
|
|
91
38
|
},
|
|
92
39
|
};
|
|
93
|
-
export const
|
|
94
|
-
render: () => (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
boxShadow: theme.shadows.md,
|
|
101
|
-
'&:hover': {
|
|
102
|
-
transform: 'translateY(-2px)',
|
|
103
|
-
boxShadow: theme.shadows.lg,
|
|
104
|
-
},
|
|
105
|
-
}), children: "Custom Styled Box" }), _jsx(Box, { sx: (theme) => ({
|
|
106
|
-
background: `linear-gradient(45deg, ${theme.colors.violet[3]}, ${theme.colors.pink[3]})`,
|
|
107
|
-
color: 'white',
|
|
108
|
-
padding: theme.spacing.xl,
|
|
109
|
-
borderRadius: theme.radius.xl,
|
|
110
|
-
textAlign: 'center',
|
|
111
|
-
fontWeight: 600,
|
|
112
|
-
boxShadow: theme.shadows.xl,
|
|
113
|
-
}), children: "Gradient Box" })] })),
|
|
40
|
+
export const BoxStyling = {
|
|
41
|
+
render: () => (_jsx(Box, { sx: {
|
|
42
|
+
backgroundColor: neutral[25],
|
|
43
|
+
padding: '2.4rem',
|
|
44
|
+
borderRadius: '8px',
|
|
45
|
+
border: `1px dashed ${neutral[100]}`,
|
|
46
|
+
}, children: _jsx(Text, { weight: "semibold", children: "This is a box that has been styled" }) })),
|
|
114
47
|
parameters: {
|
|
115
|
-
docs: {
|
|
116
|
-
source: {
|
|
117
|
-
code: false,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
48
|
+
docs: { source: { code: false } },
|
|
120
49
|
},
|
|
121
50
|
};
|
|
@@ -4,5 +4,5 @@ export interface CardProps extends MantineCardProps {
|
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
animate?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare const Card: ({ children, animate, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const Card: ({ children, animate, p, radius, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAuB,SAAS,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEnF,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IACjD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,IAAI,GAAI,
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAuB,SAAS,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEnF,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IACjD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,IAAI,GAAI,4CAAoE,SAAS,4CAiBjG,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Card as MantineCard } from '@mantine/core';
|
|
3
|
-
export const Card = ({ children, animate = false, ...props }) => {
|
|
3
|
+
export const Card = ({ children, animate = false, p = "2.4rem", radius = "20px", ...props }) => {
|
|
4
4
|
const hoverAnimation = {
|
|
5
5
|
style: { transition: 'transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out' },
|
|
6
6
|
onMouseEnter: (e) => {
|
|
@@ -12,5 +12,5 @@ export const Card = ({ children, animate = false, ...props }) => {
|
|
|
12
12
|
e.currentTarget.style.boxShadow = 'none';
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
|
-
return (_jsx(MantineCard, { p:
|
|
15
|
+
return (_jsx(MantineCard, { p: p, radius: radius, withBorder: true, ...(animate ? hoverAnimation : {}), ...props, children: children }));
|
|
16
16
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Card } from './Card';
|
|
3
|
+
declare const meta: Meta<typeof Card>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Animation: Story;
|
|
8
|
+
export declare const WithAutoGrid: Story;
|
|
9
|
+
export declare const CustomStyling: Story;
|
|
10
|
+
//# sourceMappingURL=Card.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Card/Card.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAM9B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CA+C3B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KASvB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAa1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KA2B3B,CAAC"}
|