@crystallize/design-system 1.20.1 → 1.21.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/CHANGELOG.md +6 -0
- package/dist/index.css +83 -472
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +20 -20
- package/src/action-menu/action-menu.css +4 -0
- package/src/action-menu/action-menu.tsx +1 -1
- package/src/button/Button.stories.tsx +8 -1
- package/src/checkbox/checkbox.stories.tsx +13 -7
- package/src/colors/Colors.stories.tsx +37 -8
- package/src/dialog/Dialog.stories.tsx +4 -4
- package/src/dialog/confirm-dialog.tsx +1 -1
- package/src/dialog/dialog.css +10 -0
- package/src/dialog/dialog.tsx +1 -1
- package/src/dropdown-menu/DropdownMenu.stories.tsx +4 -4
- package/src/icon-button/IconButton.stories.tsx +9 -2
- package/src/iconography/Icon.stories.tsx +6 -3
- package/src/index.css +0 -11
- package/src/input-with-label/InputWithLabel.stories.tsx +1 -1
- package/src/popover/popover.stories.tsx +2 -2
- package/src/progress/progress.css +1 -1
- package/src/radio/radio.stories.tsx +75 -37
- package/src/rich-text-editor/plugins/DraggableBlockPlugin/index.css +1 -1
- package/src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.css +2 -1
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.css +6 -1
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +1 -1
- package/src/rich-text-editor/rich-text-editor.css +2 -1
- package/src/rich-text-editor/rich-text-editor.stories.tsx +9 -15
- package/src/rich-text-editor/tests/rich-text-editor-text-formats.test.tsx +11 -2
- package/src/rich-text-editor/themes/CrystallizeRTEditorTheme.css +8 -9
- package/src/select/select.css +2 -1
- package/src/select/select.stories.tsx +1 -1
- package/src/slider/Slider.stories.tsx +1 -1
- package/src/stack-icon/stack-icon.css +8 -0
- package/src/stack-icon/stack-icon.tsx +3 -5
- package/src/switch/Switch.stories.tsx +15 -9
- package/src/tag/tag.css +4 -0
- package/src/tag/tag.tsx +1 -1
- package/src/toast/toast.css +3 -1
- package/src/toast/toast.stories.tsx +2 -2
- package/src/tooltip/Tooltip.stories.tsx +20 -7
- package/src/tooltip/tooltip.css +2 -1
- package/tailwind.config.cjs +17 -1
|
@@ -14,21 +14,29 @@ export default meta;
|
|
|
14
14
|
|
|
15
15
|
type Story = StoryObj<typeof Radio.Group>;
|
|
16
16
|
|
|
17
|
+
const style = { display: 'flex', marginLeft: '0.5rem', alignItems: 'center' };
|
|
18
|
+
|
|
17
19
|
export const Example: Story = {
|
|
18
20
|
render: () => {
|
|
19
21
|
return (
|
|
20
22
|
<Radio.Group defaultValue="default">
|
|
21
|
-
<div
|
|
23
|
+
<div style={style}>
|
|
22
24
|
<Radio.Item value="default" id="example-r1" />
|
|
23
|
-
<Label htmlFor="example-r1">
|
|
25
|
+
<Label style={{ marginLeft: 4 }} htmlFor="example-r1">
|
|
26
|
+
Default
|
|
27
|
+
</Label>
|
|
24
28
|
</div>
|
|
25
|
-
<div
|
|
29
|
+
<div style={style}>
|
|
26
30
|
<Radio.Item value="comfortable" id="example-r2" />
|
|
27
|
-
<Label htmlFor="example-r2">
|
|
31
|
+
<Label style={{ marginLeft: 4 }} htmlFor="example-r2">
|
|
32
|
+
Comfortable
|
|
33
|
+
</Label>
|
|
28
34
|
</div>
|
|
29
|
-
<div
|
|
35
|
+
<div style={style}>
|
|
30
36
|
<Radio.Item value="compact" id="example-r3" />
|
|
31
|
-
<Label htmlFor="example-r3">
|
|
37
|
+
<Label style={{ marginLeft: 4 }} htmlFor="example-r3">
|
|
38
|
+
Compact
|
|
39
|
+
</Label>
|
|
32
40
|
</div>
|
|
33
41
|
</Radio.Group>
|
|
34
42
|
);
|
|
@@ -39,17 +47,23 @@ export const Uncontrolled: Story = {
|
|
|
39
47
|
render: () => {
|
|
40
48
|
return (
|
|
41
49
|
<Radio.Group defaultValue="default">
|
|
42
|
-
<div
|
|
50
|
+
<div style={style}>
|
|
43
51
|
<Radio.Item value="default" id="uncontrolled-r1" />
|
|
44
|
-
<Label htmlFor="uncontrolled-r1">
|
|
52
|
+
<Label style={{ marginLeft: 4 }} htmlFor="uncontrolled-r1">
|
|
53
|
+
Default
|
|
54
|
+
</Label>
|
|
45
55
|
</div>
|
|
46
|
-
<div
|
|
56
|
+
<div style={style}>
|
|
47
57
|
<Radio.Item value="comfortable" id="uncontrolled-r2" />
|
|
48
|
-
<Label htmlFor="uncontrolled-r2">
|
|
58
|
+
<Label style={{ marginLeft: 4 }} htmlFor="uncontrolled-r2">
|
|
59
|
+
Comfortable
|
|
60
|
+
</Label>
|
|
49
61
|
</div>
|
|
50
|
-
<div
|
|
62
|
+
<div style={style}>
|
|
51
63
|
<Radio.Item value="compact" id="uncontrolled-r3" />
|
|
52
|
-
<Label htmlFor="uncontrolled-r3">
|
|
64
|
+
<Label style={{ marginLeft: 4 }} htmlFor="uncontrolled-r3">
|
|
65
|
+
Compact
|
|
66
|
+
</Label>
|
|
53
67
|
</div>
|
|
54
68
|
</Radio.Group>
|
|
55
69
|
);
|
|
@@ -61,17 +75,23 @@ export const Controlled: Story = {
|
|
|
61
75
|
const [value, setValue] = useState('default');
|
|
62
76
|
return (
|
|
63
77
|
<Radio.Group value={value} onValueChange={v => setValue(v)}>
|
|
64
|
-
<div
|
|
78
|
+
<div style={style}>
|
|
65
79
|
<Radio.Item value="default" id="controlled-r1" />
|
|
66
|
-
<Label htmlFor="controlled-r1">
|
|
80
|
+
<Label style={{ marginLeft: 4 }} htmlFor="controlled-r1">
|
|
81
|
+
Default
|
|
82
|
+
</Label>
|
|
67
83
|
</div>
|
|
68
|
-
<div
|
|
84
|
+
<div style={style}>
|
|
69
85
|
<Radio.Item value="comfortable" id="controlled-r2" />
|
|
70
|
-
<Label htmlFor="controlled-r2">
|
|
86
|
+
<Label style={{ marginLeft: 4 }} htmlFor="controlled-r2">
|
|
87
|
+
Comfortable
|
|
88
|
+
</Label>
|
|
71
89
|
</div>
|
|
72
|
-
<div
|
|
90
|
+
<div style={style}>
|
|
73
91
|
<Radio.Item value="compact" id="controlled-r3" />
|
|
74
|
-
<Label htmlFor="controlled-r3">
|
|
92
|
+
<Label style={{ marginLeft: 4 }} htmlFor="controlled-r3">
|
|
93
|
+
Compact
|
|
94
|
+
</Label>
|
|
75
95
|
</div>
|
|
76
96
|
</Radio.Group>
|
|
77
97
|
);
|
|
@@ -81,18 +101,24 @@ export const Controlled: Story = {
|
|
|
81
101
|
export const Horizontal: Story = {
|
|
82
102
|
render: () => {
|
|
83
103
|
return (
|
|
84
|
-
<Radio.Group defaultValue="default" orientation="horizontal"
|
|
85
|
-
<div
|
|
104
|
+
<Radio.Group defaultValue="default" orientation="horizontal" style={{ display: 'flex' }}>
|
|
105
|
+
<div style={style}>
|
|
86
106
|
<Radio.Item value="default" id="horizontal-r1" />
|
|
87
|
-
<Label htmlFor="horizontal-r1">
|
|
107
|
+
<Label style={{ marginLeft: 4 }} htmlFor="horizontal-r1">
|
|
108
|
+
Default
|
|
109
|
+
</Label>
|
|
88
110
|
</div>
|
|
89
|
-
<div
|
|
111
|
+
<div style={{ ...style, margin: '0 1.5rem' }}>
|
|
90
112
|
<Radio.Item value="comfortable" id="horizontal-r2" />
|
|
91
|
-
<Label htmlFor="horizontal-r2">
|
|
113
|
+
<Label style={{ marginLeft: 4 }} htmlFor="horizontal-r2">
|
|
114
|
+
Comfortable
|
|
115
|
+
</Label>
|
|
92
116
|
</div>
|
|
93
|
-
<div
|
|
117
|
+
<div style={style}>
|
|
94
118
|
<Radio.Item value="compact" id="horizontal-r3" />
|
|
95
|
-
<Label htmlFor="horizontal-r3">
|
|
119
|
+
<Label style={{ marginLeft: 4 }} htmlFor="horizontal-r3">
|
|
120
|
+
Compact
|
|
121
|
+
</Label>
|
|
96
122
|
</div>
|
|
97
123
|
</Radio.Group>
|
|
98
124
|
);
|
|
@@ -103,17 +129,23 @@ export const NoLoop: Story = {
|
|
|
103
129
|
render: () => {
|
|
104
130
|
return (
|
|
105
131
|
<Radio.Group defaultValue="default" loop={false}>
|
|
106
|
-
<div
|
|
132
|
+
<div style={style}>
|
|
107
133
|
<Radio.Item value="default" id="noloop-r1" />
|
|
108
|
-
<Label htmlFor="noloop-r1">
|
|
134
|
+
<Label style={{ marginLeft: 4 }} htmlFor="noloop-r1">
|
|
135
|
+
Default
|
|
136
|
+
</Label>
|
|
109
137
|
</div>
|
|
110
|
-
<div
|
|
138
|
+
<div style={style}>
|
|
111
139
|
<Radio.Item value="comfortable" id="noloop-r2" />
|
|
112
|
-
<Label htmlFor="noloop-r2">
|
|
140
|
+
<Label style={{ marginLeft: 4 }} htmlFor="noloop-r2">
|
|
141
|
+
Comfortable
|
|
142
|
+
</Label>
|
|
113
143
|
</div>
|
|
114
|
-
<div
|
|
144
|
+
<div style={style}>
|
|
115
145
|
<Radio.Item value="compact" id="noloop-r3" />
|
|
116
|
-
<Label htmlFor="noloop-r3">
|
|
146
|
+
<Label style={{ marginLeft: 4 }} htmlFor="noloop-r3">
|
|
147
|
+
Compact
|
|
148
|
+
</Label>
|
|
117
149
|
</div>
|
|
118
150
|
</Radio.Group>
|
|
119
151
|
);
|
|
@@ -124,17 +156,23 @@ export const Disabled: Story = {
|
|
|
124
156
|
render: () => {
|
|
125
157
|
return (
|
|
126
158
|
<Radio.Group defaultValue="default">
|
|
127
|
-
<div
|
|
159
|
+
<div style={style}>
|
|
128
160
|
<Radio.Item value="default" id="disabled-r1" />
|
|
129
|
-
<Label htmlFor="disabled-r1">
|
|
161
|
+
<Label style={{ marginLeft: 4 }} htmlFor="disabled-r1">
|
|
162
|
+
Default
|
|
163
|
+
</Label>
|
|
130
164
|
</div>
|
|
131
|
-
<div
|
|
165
|
+
<div style={style}>
|
|
132
166
|
<Radio.Item value="comfortable" id="disabled-r2" disabled />
|
|
133
|
-
<Label htmlFor="disabled-r2">
|
|
167
|
+
<Label style={{ marginLeft: 4 }} htmlFor="disabled-r2">
|
|
168
|
+
Comfortable
|
|
169
|
+
</Label>
|
|
134
170
|
</div>
|
|
135
|
-
<div
|
|
171
|
+
<div style={style}>
|
|
136
172
|
<Radio.Item value="compact" id="disabled-r3" />
|
|
137
|
-
<Label htmlFor="disabled-r3">
|
|
173
|
+
<Label style={{ marginLeft: 4 }} htmlFor="disabled-r3">
|
|
174
|
+
Compact
|
|
175
|
+
</Label>
|
|
138
176
|
</div>
|
|
139
177
|
</Radio.Group>
|
|
140
178
|
);
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
@apply block overflow-hidden text-ellipsis whitespace-nowrap text-s-blue-600-300 no-underline;
|
|
22
22
|
|
|
23
23
|
&:hover {
|
|
24
|
-
|
|
24
|
+
/* Can not use underline - The `underline` class does not exist. If `underline` is a custom class, */
|
|
25
|
+
text-decoration-line: underline;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
}
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
&__block-format__icon {
|
|
41
|
+
@apply h-6 w-6 rounded-md border bg-[length:18px_18px] bg-center bg-no-repeat;
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
&__toggle-icon {
|
|
41
45
|
@apply h-6 w-6 border bg-[length:18px_18px] bg-center bg-no-repeat;
|
|
42
46
|
}
|
|
@@ -110,7 +114,8 @@
|
|
|
110
114
|
@apply items-center justify-between;
|
|
111
115
|
|
|
112
116
|
&__dimensions {
|
|
113
|
-
@apply grid
|
|
117
|
+
@apply grid-cols-[1fr_1px_1fr] rounded-md border border-solid border-gray-100-800 shadow-sm;
|
|
118
|
+
display: grid;
|
|
114
119
|
|
|
115
120
|
&__separator {
|
|
116
121
|
@apply h-full bg-gray-100-800;
|
|
@@ -252,7 +252,7 @@ function BlockFormatDropDown({
|
|
|
252
252
|
</DropdownMenu.Item>
|
|
253
253
|
<DropdownMenu.Item onClick={formatCode} data-testid="toggle-block-format-code">
|
|
254
254
|
<i
|
|
255
|
-
className={`icon c-rte-icon-code
|
|
255
|
+
className={`icon c-rte-icon-code c-rte-toolbar__block-format__icon ${
|
|
256
256
|
blockType === 'code' ? 'selected' : ''
|
|
257
257
|
}`}
|
|
258
258
|
/>
|
|
@@ -148,7 +148,8 @@
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
.c-rte-placeholder {
|
|
151
|
-
@apply pointer-events-none absolute left-6 right-10 top-0 inline-block select-none overflow-hidden text-ellipsis whitespace-nowrap text-[14px] font-normal
|
|
151
|
+
@apply pointer-events-none absolute left-6 right-10 top-0 inline-block select-none overflow-hidden text-ellipsis whitespace-nowrap text-[14px] font-normal text-gray-300-600;
|
|
152
|
+
font-style: italic;
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
@keyframes CursorBlink {
|
|
@@ -13,8 +13,15 @@ const meta: Meta<typeof RichTextEditor> = {
|
|
|
13
13
|
},
|
|
14
14
|
decorators: [
|
|
15
15
|
Story => (
|
|
16
|
-
<div
|
|
17
|
-
<div
|
|
16
|
+
<div style={{ backgroundColor: 'rgb(var(--c-color-gray-50-900)', padding: 40 }}>
|
|
17
|
+
<div
|
|
18
|
+
style={{
|
|
19
|
+
borderRadius: '0.375rem',
|
|
20
|
+
boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
|
|
21
|
+
maxWidth: '1100px',
|
|
22
|
+
backgroundColor: 'rgb(var(--c-color-elevate)',
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
18
25
|
<Story />
|
|
19
26
|
</div>
|
|
20
27
|
</div>
|
|
@@ -470,16 +477,3 @@ export const CustomTranslation: Story = {
|
|
|
470
477
|
},
|
|
471
478
|
},
|
|
472
479
|
};
|
|
473
|
-
|
|
474
|
-
export const Bug: Story = {
|
|
475
|
-
args: {
|
|
476
|
-
initialData: [
|
|
477
|
-
{
|
|
478
|
-
kind: 'inline',
|
|
479
|
-
type: null,
|
|
480
|
-
textContent:
|
|
481
|
-
'Krigsårene frem mot 1814 inneholder noen av de mest dramatiske begivenhetene i både dansk og norsk historie. I denne boken finner du for første gang en samlet fremstilling av krigsårene mellom 1807 og 1814 fra et felles dansk-norsk perspektiv.Dette verket er et sentralt bidrag i markeringen av 200-årsjubileet for grunnloven og den dansk-norske skilsmissen, skrevet av en dansk og en norsk historiker. I boken forteller de om krigsbegivenhetene både til lands og til sjøs, hvordan de ble opplevd blant ulike samfunnslag fra elitene i København, Christiania og Kiel, til husmenn i Østerdalen, bønder på Lolland-Falster og småhandelsfolk i Slesvig-Holstein.1814 var det moderne Norges fødsel. Norge ble selvstendig med en av Europas mest liberale grunnlover, og både selvstendigheten og grunnloven fikk leve videre selv om Norge mot slutten av året ble forent med Sverige i en løs union. Politisk sett gjorde dette Norge til en av Napoleonskrigenes vinnere, men ""mirakelåret"" 1814 ble født av et nederlag.',
|
|
482
|
-
},
|
|
483
|
-
],
|
|
484
|
-
},
|
|
485
|
-
};
|
|
@@ -34,7 +34,12 @@ describe('RichTextEditor text formats', () => {
|
|
|
34
34
|
|
|
35
35
|
const user = userEvent.setup();
|
|
36
36
|
|
|
37
|
-
await
|
|
37
|
+
await selectTextInElement({
|
|
38
|
+
element: screen.getByText('bold'),
|
|
39
|
+
startOffset: 0,
|
|
40
|
+
endOffset: 4,
|
|
41
|
+
});
|
|
42
|
+
|
|
38
43
|
await user.click(screen.getByTestId('toggle-format-bold'));
|
|
39
44
|
|
|
40
45
|
expect(onChange).toHaveBeenLastCalledWith([
|
|
@@ -120,7 +125,11 @@ describe('RichTextEditor text formats', () => {
|
|
|
120
125
|
|
|
121
126
|
const user = userEvent.setup();
|
|
122
127
|
|
|
123
|
-
await
|
|
128
|
+
await selectTextInElement({
|
|
129
|
+
element: screen.getByText('italic'),
|
|
130
|
+
startOffset: 0,
|
|
131
|
+
endOffset: 6,
|
|
132
|
+
});
|
|
124
133
|
await user.click(screen.getByTestId('toggle-format-emphasized'));
|
|
125
134
|
|
|
126
135
|
expect(onChange).toBeCalledTimes(1);
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
.CrystallizeRTEditorTheme__h1 {
|
|
32
32
|
font-size: 20px;
|
|
33
33
|
|
|
34
|
-
@apply m-0 mb-1 mt-2 font-medium leading-6
|
|
35
|
-
text-gray-800-100;
|
|
34
|
+
@apply m-0 mb-1 mt-2 font-medium leading-6 text-gray-800-100;
|
|
36
35
|
}
|
|
37
36
|
.CrystallizeRTEditorTheme__h2 {
|
|
38
37
|
font-size: 19px;
|
|
@@ -44,11 +43,11 @@
|
|
|
44
43
|
}
|
|
45
44
|
.CrystallizeRTEditorTheme__h4 {
|
|
46
45
|
font-size: 17px;
|
|
47
|
-
@apply m-0 mb-1 mt-2
|
|
46
|
+
@apply m-0 mb-1 mt-2 font-medium leading-6 text-gray-800-100;
|
|
48
47
|
}
|
|
49
48
|
.CrystallizeRTEditorTheme__h5 {
|
|
50
49
|
font-size: 16px;
|
|
51
|
-
@apply m-0 mb-1 mt-2
|
|
50
|
+
@apply m-0 mb-1 mt-2 font-medium leading-6 text-gray-800-100;
|
|
52
51
|
}
|
|
53
52
|
.CrystallizeRTEditorTheme__h6 {
|
|
54
53
|
font-size: 16px;
|
|
@@ -61,10 +60,10 @@
|
|
|
61
60
|
@apply font-bold;
|
|
62
61
|
}
|
|
63
62
|
.CrystallizeRTEditorTheme__textItalic {
|
|
64
|
-
|
|
63
|
+
font-style: italic;
|
|
65
64
|
}
|
|
66
65
|
.CrystallizeRTEditorTheme__textUnderline {
|
|
67
|
-
|
|
66
|
+
text-decoration-line: underline;
|
|
68
67
|
}
|
|
69
68
|
.CrystallizeRTEditorTheme__textStrikethrough {
|
|
70
69
|
@apply line-through;
|
|
@@ -97,13 +96,13 @@
|
|
|
97
96
|
cursor: pointer;
|
|
98
97
|
}
|
|
99
98
|
.CrystallizeRTEditorTheme__code {
|
|
100
|
-
@apply relative my-2
|
|
99
|
+
@apply relative mx-0 my-2 block overflow-x-auto rounded-md border border-solid border-gray-100-800 bg-purple-50-900 p-2 pl-14 text-sm leading-5;
|
|
101
100
|
font-family: Menlo, Consolas, Monaco, monospace;
|
|
102
101
|
font-size: 12px;
|
|
103
102
|
tab-size: 2;
|
|
104
103
|
}
|
|
105
104
|
.CrystallizeRTEditorTheme__code:before {
|
|
106
|
-
@apply absolute
|
|
105
|
+
@apply absolute left-0 top-0 border-0 border-r-[1px] border-solid border-gray-100-800 bg-purple-100-800 p-2 text-right text-gray-400-500;
|
|
107
106
|
content: attr(data-gutter);
|
|
108
107
|
white-space: pre-wrap;
|
|
109
108
|
min-width: 25px;
|
|
@@ -303,7 +302,7 @@
|
|
|
303
302
|
list-style-position: inside;
|
|
304
303
|
}
|
|
305
304
|
.CrystallizeRTEditorTheme__listItem {
|
|
306
|
-
@apply my-0
|
|
305
|
+
@apply mx-5 my-0 leading-6 text-gray-600-300;
|
|
307
306
|
}
|
|
308
307
|
.CrystallizeRTEditorTheme__listItemChecked,
|
|
309
308
|
.CrystallizeRTEditorTheme__listItemUnchecked {
|
package/src/select/select.css
CHANGED
|
@@ -50,7 +50,7 @@ export const WithLabel = () => {
|
|
|
50
50
|
const [value, setValue] = useState('react');
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
|
-
<div
|
|
53
|
+
<div style={{ display: 'flex', marginTop: '0.5rem', flexDirection: 'column', alignItems: 'flex-start' }}>
|
|
54
54
|
<Label htmlFor="with-label-c1">Select framework</Label>
|
|
55
55
|
<Select.Container id="with-label-c1" value={value} onValueChange={setValue}>
|
|
56
56
|
<Select.Item value="react">React</Select.Item>
|
|
@@ -46,7 +46,7 @@ export const Controlled: Story = {
|
|
|
46
46
|
const [value, setValue] = useState<number[]>([25]);
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
|
-
<div
|
|
49
|
+
<div>
|
|
50
50
|
<Slider aria-label="volume" step={1} max={100} onValueChange={setValue} value={value} />
|
|
51
51
|
<pre>{value}</pre>
|
|
52
52
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Icon } from '../iconography';
|
|
2
|
+
import './stack-icon.css';
|
|
2
3
|
|
|
3
4
|
type StackIconProps = {
|
|
4
5
|
type: 'create';
|
|
@@ -8,12 +9,9 @@ type StackIconProps = {
|
|
|
8
9
|
|
|
9
10
|
export function StackIcon({ type, children, size = 18 }: StackIconProps) {
|
|
10
11
|
return (
|
|
11
|
-
<span className="
|
|
12
|
+
<span className="c-stack-icon">
|
|
12
13
|
{type === 'create' && (
|
|
13
|
-
<span
|
|
14
|
-
style={{ width: size, height: size }}
|
|
15
|
-
className="absolute right-0 top-0 flex -translate-y-1/3 translate-x-1/3 items-center justify-center rounded border border-solid border-white bg-gray-50-900"
|
|
16
|
-
>
|
|
14
|
+
<span style={{ width: size, height: size }} className="c-stack-icon__icon">
|
|
17
15
|
<Icon.Add width={size - 4} height={size - 4} />
|
|
18
16
|
</span>
|
|
19
17
|
)}
|
|
@@ -4,6 +4,8 @@ import type { Meta } from '@storybook/react';
|
|
|
4
4
|
import { Switch } from '.';
|
|
5
5
|
import { Label } from '../label';
|
|
6
6
|
|
|
7
|
+
const style = { display: 'flex', paddingTop: '3rem', paddingBottom: '3rem', justifyContent: 'center', width: '25%' };
|
|
8
|
+
|
|
7
9
|
export default {
|
|
8
10
|
title: 'Components/Switch',
|
|
9
11
|
parameters: {
|
|
@@ -13,7 +15,7 @@ export default {
|
|
|
13
15
|
|
|
14
16
|
export function Example() {
|
|
15
17
|
return (
|
|
16
|
-
<div
|
|
18
|
+
<div style={style}>
|
|
17
19
|
<Switch />
|
|
18
20
|
</div>
|
|
19
21
|
);
|
|
@@ -21,7 +23,7 @@ export function Example() {
|
|
|
21
23
|
|
|
22
24
|
export const Uncontrolled = () => {
|
|
23
25
|
return (
|
|
24
|
-
<div
|
|
26
|
+
<div style={style}>
|
|
25
27
|
<Switch defaultChecked={true} />
|
|
26
28
|
</div>
|
|
27
29
|
);
|
|
@@ -31,7 +33,7 @@ export function Controlled() {
|
|
|
31
33
|
const [checked, setChecked] = useState(false);
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
|
-
<div
|
|
36
|
+
<div style={style}>
|
|
35
37
|
<Switch checked={checked} onCheckedChange={c => setChecked(c)} />
|
|
36
38
|
</div>
|
|
37
39
|
);
|
|
@@ -39,7 +41,7 @@ export function Controlled() {
|
|
|
39
41
|
|
|
40
42
|
export const WithLabel = () => {
|
|
41
43
|
return (
|
|
42
|
-
<div
|
|
44
|
+
<div style={{ display: 'flex', padding: '3rem', gap: '0.5rem', alignItems: 'center' }}>
|
|
43
45
|
<Switch id="with-label-c1" defaultChecked={true} />
|
|
44
46
|
<Label htmlFor="with-label-c1">Apply price list to all products</Label>
|
|
45
47
|
</div>
|
|
@@ -48,14 +50,18 @@ export const WithLabel = () => {
|
|
|
48
50
|
|
|
49
51
|
export const Disabled = () => {
|
|
50
52
|
return (
|
|
51
|
-
<div
|
|
52
|
-
<div
|
|
53
|
+
<div style={{ display: 'flex', padding: '3rem', gap: '0.5rem', alignItems: 'center' }}>
|
|
54
|
+
<div style={{ display: 'flex', marginBottom: '2.25rem', alignItems: 'center' }}>
|
|
53
55
|
<Switch id="disabled-c1" defaultChecked={true} disabled />
|
|
54
|
-
<Label htmlFor="disabled-c1">
|
|
56
|
+
<Label style={{ marginLeft: 4 }} htmlFor="disabled-c1">
|
|
57
|
+
Apply price list to all products
|
|
58
|
+
</Label>
|
|
55
59
|
</div>
|
|
56
|
-
<div
|
|
60
|
+
<div style={{ display: 'flex', marginBottom: '2.25rem', alignItems: 'center' }}>
|
|
57
61
|
<Switch id="disabled-c2" defaultChecked={false} disabled />
|
|
58
|
-
<Label htmlFor="disabled-c2">
|
|
62
|
+
<Label style={{ marginLeft: 4 }} htmlFor="disabled-c2">
|
|
63
|
+
Apply price list to all products
|
|
64
|
+
</Label>
|
|
59
65
|
</div>
|
|
60
66
|
</div>
|
|
61
67
|
);
|
package/src/tag/tag.css
CHANGED
package/src/tag/tag.tsx
CHANGED
|
@@ -44,7 +44,7 @@ export function Tag({ children, className, variant, size, prepend, onRemove, ...
|
|
|
44
44
|
}}
|
|
45
45
|
>
|
|
46
46
|
<Icon.Cancel width={12} height={12} />
|
|
47
|
-
<span className="
|
|
47
|
+
<span className="c-tag__remove-button-text">Remove</span>
|
|
48
48
|
</button>
|
|
49
49
|
)}
|
|
50
50
|
</div>
|
package/src/toast/toast.css
CHANGED
|
@@ -15,7 +15,7 @@ export const SimpleToast: Story = {
|
|
|
15
15
|
render: () => (
|
|
16
16
|
<>
|
|
17
17
|
<Toaster />
|
|
18
|
-
<div
|
|
18
|
+
<div style={{ display: 'flex', gap: '0.5rem', width: '50%' }}>
|
|
19
19
|
<Button onClick={() => toast({ title: 'You did something good' })}>Success toast</Button>
|
|
20
20
|
<Button onClick={() => toast({ title: 'You have been warned buddy', type: 'warning' })}>Warning toast</Button>
|
|
21
21
|
<Button onClick={() => toast({ title: 'There was a oopsie daisy ', type: 'error' })}>Error toast</Button>
|
|
@@ -89,7 +89,7 @@ export const TimeoutToast: Story = {
|
|
|
89
89
|
render: () => (
|
|
90
90
|
<>
|
|
91
91
|
<Toaster />
|
|
92
|
-
<div
|
|
92
|
+
<div style={{ display: 'flex', gap: '1rem', width: '100%' }}>
|
|
93
93
|
<Button onClick={() => toast({ title: 'Can you read this? ', timeout: 500, type: 'info' })}>Quick toast</Button>
|
|
94
94
|
|
|
95
95
|
<Button
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
|
|
13
13
|
export function Example() {
|
|
14
14
|
return (
|
|
15
|
-
<div
|
|
15
|
+
<div style={{ display: 'flex', paddingTop: '3rem', paddingBottom: '3rem', justifyContent: 'center', width: '25%' }}>
|
|
16
16
|
<Tooltip content="This has auto alignment">
|
|
17
17
|
<Button>Hover me for a basic tip</Button>
|
|
18
18
|
</Tooltip>
|
|
@@ -22,7 +22,18 @@ export function Example() {
|
|
|
22
22
|
|
|
23
23
|
export function DefinedSides() {
|
|
24
24
|
return (
|
|
25
|
-
<div
|
|
25
|
+
<div
|
|
26
|
+
style={{
|
|
27
|
+
display: 'flex',
|
|
28
|
+
paddingLeft: '1.5rem',
|
|
29
|
+
paddingRight: '1.5rem',
|
|
30
|
+
paddingTop: '3rem',
|
|
31
|
+
paddingBottom: '3rem',
|
|
32
|
+
gap: '1rem',
|
|
33
|
+
justifyContent: 'flex-start',
|
|
34
|
+
width: '100%',
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
26
37
|
<Tooltip content="I am a tip to the left" side="left">
|
|
27
38
|
<Button>Hot top to the left</Button>
|
|
28
39
|
</Tooltip>
|
|
@@ -41,19 +52,21 @@ export function DefinedSides() {
|
|
|
41
52
|
|
|
42
53
|
export function WithContent() {
|
|
43
54
|
return (
|
|
44
|
-
<div
|
|
55
|
+
<div style={{ display: 'flex', paddingTop: '3rem', paddingBottom: '3rem', justifyContent: 'flex-start' }}>
|
|
45
56
|
<Tooltip
|
|
57
|
+
side="left"
|
|
46
58
|
content={
|
|
47
|
-
<div
|
|
59
|
+
<div style={{ padding: '0.5rem', maxWidth: '20rem' }}>
|
|
48
60
|
<h3>Tooltip with content</h3>
|
|
49
|
-
<p
|
|
50
|
-
|
|
61
|
+
<p style={{ fontSize: '0.875rem', lineHeight: '1.25rem' }}>
|
|
62
|
+
In here you can add whatever kind of content you want. Even buttons
|
|
63
|
+
</p>
|
|
64
|
+
<div style={{ display: 'flex', gap: '0.5rem', justifyContent: 'flex-end' }}>
|
|
51
65
|
<Button intent="danger">Cancel</Button>
|
|
52
66
|
<Button intent="action">Done</Button>
|
|
53
67
|
</div>
|
|
54
68
|
</div>
|
|
55
69
|
}
|
|
56
|
-
side="left"
|
|
57
70
|
>
|
|
58
71
|
<Button>Hover me for extended tip with actions</Button>
|
|
59
72
|
</Tooltip>
|
package/src/tooltip/tooltip.css
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.c-tooltip-content {
|
|
2
|
-
@apply z-[100] select-none rounded-md px-4 py-2 text-xs font-medium
|
|
2
|
+
@apply z-[100] select-none rounded-md px-4 py-2 text-xs font-medium leading-none shadow-tooltip transition;
|
|
3
|
+
font-style: italic;
|
|
3
4
|
}
|
|
4
5
|
|
|
5
6
|
.c-tooltip-success {
|
package/tailwind.config.cjs
CHANGED
|
@@ -4,8 +4,24 @@ const colorsPlugin = require('./plugins/colors');
|
|
|
4
4
|
|
|
5
5
|
/** @type {import("tailwindcss").Config} */
|
|
6
6
|
module.exports = {
|
|
7
|
-
content: ['./src/**/*.tsx'],
|
|
7
|
+
content: ['./src/**/*.{tsx,ts}', '!./src/**/*.stories.tsx', '!./src/**/*.test.{tsx,ts}'],
|
|
8
8
|
safelist: ['c-dark'],
|
|
9
|
+
blocklist: [
|
|
10
|
+
'container',
|
|
11
|
+
'transform',
|
|
12
|
+
'table',
|
|
13
|
+
'grid',
|
|
14
|
+
'hidden',
|
|
15
|
+
'resize',
|
|
16
|
+
'italic',
|
|
17
|
+
'underline',
|
|
18
|
+
'static',
|
|
19
|
+
'inline',
|
|
20
|
+
'list-item',
|
|
21
|
+
'table-row',
|
|
22
|
+
'table-cell',
|
|
23
|
+
'table-caption',
|
|
24
|
+
],
|
|
9
25
|
experimental: {
|
|
10
26
|
optimizeUniversalDefaults: true,
|
|
11
27
|
},
|