seblify 0.2.1 → 0.4.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/README.md +145 -49
- package/dist/components/AppShell.svelte +1 -1
- package/dist/components/Banner.svelte +3 -3
- package/dist/components/Button.svelte +4 -4
- package/dist/components/action/button/button/Button.svelte +1041 -0
- package/dist/components/action/button/button/Button.svelte.d.ts +28 -0
- package/dist/components/action/button/button-group/ButtonGroup.svelte +146 -0
- package/dist/components/action/button/button-group/ButtonGroup.svelte.d.ts +14 -0
- package/dist/components/action/button/floating-action-button/FloatingActionButton.svelte +1102 -0
- package/dist/components/action/button/floating-action-button/FloatingActionButton.svelte.d.ts +26 -0
- package/dist/components/action/button/icon-button/IconButton.svelte +954 -0
- package/dist/components/action/button/icon-button/IconButton.svelte.d.ts +22 -0
- package/dist/components/action/button/timed-button/TimedButton.svelte +1143 -0
- package/dist/components/action/button/timed-button/TimedButton.svelte.d.ts +32 -0
- package/dist/components/action/button/toggle-button/ToggleButton.svelte +1109 -0
- package/dist/components/action/button/toggle-button/ToggleButton.svelte.d.ts +28 -0
- package/dist/components/action/button/toggle-button-group/ToggleButtonGroup.svelte +242 -0
- package/dist/components/action/button/toggle-button-group/ToggleButtonGroup.svelte.d.ts +19 -0
- package/dist/components/action/button/toggle-button-group/ToggleButtonGroup.test.svelte +36 -0
- package/dist/components/action/button/toggle-button-group/ToggleButtonGroup.test.svelte.d.ts +11 -0
- package/dist/components/action/button/toggle-button-group/context.d.ts +8 -0
- package/dist/components/action/button/toggle-button-group/context.js +8 -0
- package/dist/components/action/input/field/pin-input/PinInput.svelte +4 -4
- package/dist/components/action/input/select/checkbox/Checkbox.svelte +4704 -25
- package/dist/components/action/input/select/checkbox/Checkbox.svelte.d.ts +28 -0
- package/dist/components/action/input/select/checkbox/checkbox-relations.svelte.d.ts +46 -0
- package/dist/components/action/input/select/checkbox/checkbox-relations.svelte.js +202 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/bounce.d.ts +1 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/bounce.html +27 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/bounce.js +13 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/bump.d.ts +1 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/bump.html +12 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/bump.js +13 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/draw.d.ts +1 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/draw.html +12 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/draw.js +12 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/fade.d.ts +1 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/fade.html +12 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/fade.js +12 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/pop.d.ts +1 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/pop.html +12 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/pop.js +13 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/rise.d.ts +1 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/rise.html +27 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/rise.js +13 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/scale.d.ts +1 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/scale.html +27 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/scale.js +13 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/visual-state.d.ts +1 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/visual-state.html +12 -0
- package/dist/components/action/input/select/checkbox/tests/visual-fixtures/visual-state.js +278 -0
- package/dist/components/action/input/select/{theme-switch/ThemeSwitch.svelte → color-mode-switch/ColorModeSwitch.svelte} +8 -8
- package/dist/components/action/input/select/color-mode-switch/ColorModeSwitch.svelte.d.ts +10 -0
- package/dist/components/action/input/select/segment-control/SegmentControl.svelte +2 -2
- package/dist/components/action/input/select/slider/Slider.svelte +1 -1
- package/dist/components/action/input/select/switch/Switch.svelte +1004 -99
- package/dist/components/action/input/select/switch/Switch.svelte.d.ts +8 -3
- package/dist/components/display/annotation/badge/Badge.svelte +732 -63
- package/dist/components/display/annotation/badge/Badge.svelte.d.ts +1 -1
- package/dist/components/display/annotation/tag/Tag.svelte +670 -58
- package/dist/components/display/annotation/tag/Tag.svelte.d.ts +3 -1
- package/dist/components/display/data-display/metric/date-time/DateTimeValue.svelte +59 -0
- package/dist/components/display/data-display/metric/date-time/DateTimeValue.svelte.d.ts +13 -0
- package/dist/components/display/data-display/metric/date-time/DateValue.svelte +52 -0
- package/dist/components/display/data-display/metric/date-time/DateValue.svelte.d.ts +11 -0
- package/dist/components/display/data-display/metric/date-time/TimeValue.svelte +55 -0
- package/dist/components/display/data-display/metric/date-time/TimeValue.svelte.d.ts +12 -0
- package/dist/components/display/data-display/metric/duration/Duration.svelte +64 -0
- package/dist/components/display/data-display/metric/duration/Duration.svelte.d.ts +16 -0
- package/dist/components/display/data-display/metric/relative-time/RelativeTime.svelte +121 -0
- package/dist/components/display/data-display/metric/relative-time/RelativeTime.svelte.d.ts +21 -0
- package/dist/components/display/data-display/metric/timestamp-card/TimestampCard.svelte +121 -0
- package/dist/components/display/data-display/metric/timestamp-card/TimestampCard.svelte.d.ts +25 -0
- package/dist/components/display/data-display/visual/timeline/TimelineItem.svelte +660 -51
- package/dist/components/display/data-display/visual/timeline/context.d.ts +1 -1
- package/dist/components/display/feedback/loading/loading-dots/LoadingDots.svelte +657 -48
- package/dist/components/display/feedback/loading/loading-dots/LoadingDots.svelte.d.ts +1 -1
- package/dist/components/display/feedback/loading/spinner/Spinner.svelte +657 -48
- package/dist/components/display/feedback/loading/spinner/Spinner.svelte.d.ts +1 -1
- package/dist/components/display/motion/collapse/Collapse.svelte +115 -0
- package/dist/components/display/motion/collapse/Collapse.svelte.d.ts +17 -0
- package/dist/components/display/typography/accordion/Accordion.svelte +347 -0
- package/dist/components/display/typography/accordion/Accordion.svelte.d.ts +13 -0
- package/dist/components/display/typography/accordion/AccordionGroup.svelte +132 -0
- package/dist/components/display/typography/accordion/AccordionGroup.svelte.d.ts +11 -0
- package/dist/components/display/typography/accordion/context.d.ts +8 -0
- package/dist/components/display/typography/accordion/context.js +8 -0
- package/dist/components/display/typography/code-snippet/CodeSnippet.svelte +3 -3
- package/dist/components/display/typography/eyebrow/Eyebrow.svelte +2 -2
- package/dist/components/display/typography/highlight/Highlight.svelte +719 -59
- package/dist/components/display/typography/highlight/Highlight.svelte.d.ts +1 -1
- package/dist/components/framework/layout/container/app-shell/AppShell.svelte +16 -2
- package/dist/components/framework/navigation/context/breadcrumb/Breadcrumb.svelte +1 -1
- package/dist/components/framework/navigation/sidebar/sidebar/Sidebar.svelte +35 -10
- package/dist/components/framework/navigation/sidebar/sidenav/Sidenav.svelte +5 -5
- package/dist/components/framework/overlay/tooltip/Tooltip.svelte +1011 -0
- package/dist/components/framework/overlay/tooltip/Tooltip.svelte.d.ts +31 -0
- package/dist/components/framework/surface/paper/Paper.svelte +730 -87
- package/dist/components/framework/surface/paper/Paper.svelte.d.ts +1 -1
- package/dist/components/utility/format/date-time/formatDateTime.d.ts +23 -0
- package/dist/components/utility/format/date-time/formatDateTime.js +33 -0
- package/dist/components/utility/format/duration/formatDuration.d.ts +15 -0
- package/dist/components/utility/format/duration/formatDuration.js +218 -0
- package/dist/components/utility/format/relative-time/formatRelativeTime.d.ts +42 -0
- package/dist/components/utility/format/relative-time/formatRelativeTime.js +530 -0
- package/dist/design-system/inheritance/tokens.js +6 -0
- package/dist/design-system/reserved-props/allowed-options.d.ts +9 -4
- package/dist/design-system/theme/tokens.d.ts +72 -2
- package/dist/design-system/theme/tokens.js +173 -134
- package/dist/icons/generated/check-thick.svelte +16 -0
- package/dist/icons/generated/check-thick.svelte.d.ts +7 -0
- package/dist/icons/generated/check.svelte +16 -0
- package/dist/icons/generated/check.svelte.d.ts +7 -0
- package/dist/icons/generated/close-thick.svelte +16 -0
- package/dist/icons/generated/close-thick.svelte.d.ts +7 -0
- package/dist/icons/generated/close.svelte +16 -0
- package/dist/icons/generated/close.svelte.d.ts +7 -0
- package/dist/icons/generated/index.d.ts +4 -0
- package/dist/icons/generated/index.js +4 -0
- package/dist/icons/generated/manifest.js +28 -0
- package/dist/index.d.ts +22 -2
- package/dist/index.js +22 -2
- package/dist/styles/tone-context.css +656 -46
- package/dist/theme.css +1 -161
- package/dist/themes/canopy.css +373 -0
- package/dist/themes/cobalt.css +373 -0
- package/dist/themes/iris.css +373 -0
- package/dist/themes/lumen.css +373 -0
- package/dist/themes/mono.css +373 -0
- package/dist/themes/moss.css +373 -0
- package/dist/themes/noir.css +373 -0
- package/dist/themes/plain.css +373 -0
- package/dist/themes/pulse.css +373 -0
- package/dist/themes/signal.css +373 -0
- package/dist/themes/slate.css +373 -0
- package/dist/themes/solar.css +373 -0
- package/dist/themes/sorbet.css +373 -0
- package/dist/themes/studio.css +369 -0
- package/dist/themes/vesper.css +373 -0
- package/package.json +32 -4
- package/dist/components/action/input/select/theme-switch/ThemeSwitch.svelte.d.ts +0 -10
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { mount } from 'svelte';
|
|
2
|
+
import '../../../../../../../theme.css';
|
|
3
|
+
import Checkbox from '../../Checkbox.svelte';
|
|
4
|
+
function createSection(className) {
|
|
5
|
+
const section = document.createElement('div');
|
|
6
|
+
section.className = className;
|
|
7
|
+
document.getElementById('checkbox-root').append(section);
|
|
8
|
+
return section;
|
|
9
|
+
}
|
|
10
|
+
mount(Checkbox, {
|
|
11
|
+
target: createSection('direct-checkbox'),
|
|
12
|
+
props: {
|
|
13
|
+
animation: 'fade',
|
|
14
|
+
checked: true,
|
|
15
|
+
label: 'Direct checkbox',
|
|
16
|
+
size: 'xl',
|
|
17
|
+
tone: 'primary',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
mount(Checkbox, {
|
|
21
|
+
target: createSection('indirect-checkbox'),
|
|
22
|
+
props: {
|
|
23
|
+
animation: 'fade',
|
|
24
|
+
checked: true,
|
|
25
|
+
label: 'Indirect checkbox',
|
|
26
|
+
size: 'xl',
|
|
27
|
+
tone: 'primary',
|
|
28
|
+
visualState: 'indirect',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
mount(Checkbox, {
|
|
32
|
+
target: createSection('intermediate-checkbox'),
|
|
33
|
+
props: {
|
|
34
|
+
animation: 'fade',
|
|
35
|
+
indeterminate: true,
|
|
36
|
+
label: 'Intermediate checkbox',
|
|
37
|
+
size: 'xl',
|
|
38
|
+
tone: 'primary',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
mount(Checkbox, {
|
|
42
|
+
target: createSection('overflow-checkbox'),
|
|
43
|
+
props: {
|
|
44
|
+
animation: 'fade',
|
|
45
|
+
checked: true,
|
|
46
|
+
label: 'Overflow checkbox',
|
|
47
|
+
size: 'xl',
|
|
48
|
+
tone: 'primary',
|
|
49
|
+
variant: 'overflow',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
mount(Checkbox, {
|
|
53
|
+
target: createSection('overflow-small-checkbox'),
|
|
54
|
+
props: {
|
|
55
|
+
animation: 'fade',
|
|
56
|
+
checked: true,
|
|
57
|
+
label: 'Small overflow checkbox',
|
|
58
|
+
size: '10px',
|
|
59
|
+
tone: 'primary',
|
|
60
|
+
variant: 'overflow',
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
mount(Checkbox, {
|
|
64
|
+
target: createSection('overflow-large-checkbox'),
|
|
65
|
+
props: {
|
|
66
|
+
animation: 'fade',
|
|
67
|
+
checked: true,
|
|
68
|
+
label: 'Large overflow checkbox',
|
|
69
|
+
size: '40px',
|
|
70
|
+
tone: 'primary',
|
|
71
|
+
variant: 'overflow',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
mount(Checkbox, {
|
|
75
|
+
target: createSection('overflow-indirect-checkbox'),
|
|
76
|
+
props: {
|
|
77
|
+
animation: 'fade',
|
|
78
|
+
checked: true,
|
|
79
|
+
label: 'Indirect overflow checkbox',
|
|
80
|
+
size: 'xl',
|
|
81
|
+
tone: 'primary',
|
|
82
|
+
variant: 'overflow',
|
|
83
|
+
visualState: 'indirect',
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
mount(Checkbox, {
|
|
87
|
+
target: createSection('small-label-alignment-checkbox'),
|
|
88
|
+
props: {
|
|
89
|
+
label: 'Small label alignment checkbox',
|
|
90
|
+
size: '10px',
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
mount(Checkbox, {
|
|
94
|
+
target: createSection('small-description-alignment-checkbox'),
|
|
95
|
+
props: {
|
|
96
|
+
description: 'The small checkbox should align with the label line.',
|
|
97
|
+
label: 'Small description alignment checkbox',
|
|
98
|
+
size: '10px',
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
mount(Checkbox, {
|
|
102
|
+
target: createSection('top-aligned-description-checkbox'),
|
|
103
|
+
props: {
|
|
104
|
+
description: 'The text block is taller than this checkbox.',
|
|
105
|
+
label: 'Top aligned description checkbox',
|
|
106
|
+
size: 'xl',
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
mount(Checkbox, {
|
|
110
|
+
target: createSection('large-description-alignment-checkbox'),
|
|
111
|
+
props: {
|
|
112
|
+
description: 'The text block should center inside this tall checkbox.',
|
|
113
|
+
label: 'Large description alignment checkbox',
|
|
114
|
+
size: '64px',
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
mount(Checkbox, {
|
|
118
|
+
target: createSection('blank-checkbox'),
|
|
119
|
+
props: {
|
|
120
|
+
checked: true,
|
|
121
|
+
label: 'Blank checkbox',
|
|
122
|
+
size: 'xl',
|
|
123
|
+
tone: 'primary',
|
|
124
|
+
variant: 'blank',
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
mount(Checkbox, {
|
|
128
|
+
target: createSection('inset-checkbox'),
|
|
129
|
+
props: {
|
|
130
|
+
checked: true,
|
|
131
|
+
duration: 1000,
|
|
132
|
+
label: 'Inset checkbox',
|
|
133
|
+
size: 'xl',
|
|
134
|
+
tone: 'primary',
|
|
135
|
+
variant: 'inset',
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
for (const variant of ['blank', 'inset']) {
|
|
139
|
+
mount(Checkbox, {
|
|
140
|
+
target: createSection(`${variant}-intermediate-checkbox`),
|
|
141
|
+
props: {
|
|
142
|
+
indeterminate: true,
|
|
143
|
+
label: `${variant} intermediate checkbox`,
|
|
144
|
+
size: 'xl',
|
|
145
|
+
tone: 'primary',
|
|
146
|
+
variant,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
mount(Checkbox, {
|
|
150
|
+
target: createSection(`${variant}-indirect-checkbox`),
|
|
151
|
+
props: {
|
|
152
|
+
checked: true,
|
|
153
|
+
label: `${variant} indirect checkbox`,
|
|
154
|
+
size: 'xl',
|
|
155
|
+
tone: 'primary',
|
|
156
|
+
variant,
|
|
157
|
+
visualState: 'indirect',
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
mount(Checkbox, {
|
|
161
|
+
target: createSection(`${variant}-indirect-intermediate-checkbox`),
|
|
162
|
+
props: {
|
|
163
|
+
indeterminate: true,
|
|
164
|
+
label: `${variant} indirect intermediate checkbox`,
|
|
165
|
+
size: 'xl',
|
|
166
|
+
tone: 'primary',
|
|
167
|
+
variant,
|
|
168
|
+
visualState: 'indirect',
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
for (const animation of ['scale', 'draw', 'rise']) {
|
|
173
|
+
mount(Checkbox, {
|
|
174
|
+
target: createSection(`blank-${animation}-checkbox`),
|
|
175
|
+
props: {
|
|
176
|
+
animation,
|
|
177
|
+
duration: animation === 'scale' ? 1000 : undefined,
|
|
178
|
+
label: `Blank ${animation} checkbox`,
|
|
179
|
+
size: 'xl',
|
|
180
|
+
tone: 'primary',
|
|
181
|
+
variant: 'blank',
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
mount(Checkbox, {
|
|
185
|
+
target: createSection(`inset-${animation}-checkbox`),
|
|
186
|
+
props: {
|
|
187
|
+
animation,
|
|
188
|
+
duration: animation === 'scale' ? 1000 : undefined,
|
|
189
|
+
label: `Inset ${animation} checkbox`,
|
|
190
|
+
size: 'xl',
|
|
191
|
+
tone: 'primary',
|
|
192
|
+
variant: 'inset',
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
for (const variant of ['outline', 'inset', 'overflow']) {
|
|
197
|
+
mount(Checkbox, {
|
|
198
|
+
target: createSection(`${variant}-bump-checkbox`),
|
|
199
|
+
props: {
|
|
200
|
+
animation: 'bump',
|
|
201
|
+
duration: 600,
|
|
202
|
+
label: `${variant} bump checkbox`,
|
|
203
|
+
size: 'xl',
|
|
204
|
+
tone: 'primary',
|
|
205
|
+
variant,
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
for (const animation of ['bump', 'pop']) {
|
|
210
|
+
mount(Checkbox, {
|
|
211
|
+
target: createSection(`blank-${animation}-checkbox`),
|
|
212
|
+
props: {
|
|
213
|
+
animation,
|
|
214
|
+
duration: 600,
|
|
215
|
+
label: `Blank ${animation} checkbox`,
|
|
216
|
+
size: 'xl',
|
|
217
|
+
tone: 'primary',
|
|
218
|
+
variant: 'blank',
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
mount(Checkbox, {
|
|
223
|
+
target: createSection('plain-bump-checkbox'),
|
|
224
|
+
props: {
|
|
225
|
+
animation: 'bump',
|
|
226
|
+
duration: 600,
|
|
227
|
+
label: 'Plain bump checkbox',
|
|
228
|
+
size: 'xl',
|
|
229
|
+
tone: 'primary',
|
|
230
|
+
variant: 'plain',
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
mount(Checkbox, {
|
|
234
|
+
target: createSection('direct-neutral-checkbox'),
|
|
235
|
+
props: {
|
|
236
|
+
animation: 'fade',
|
|
237
|
+
checked: true,
|
|
238
|
+
label: 'Direct neutral checkbox',
|
|
239
|
+
size: 'xl',
|
|
240
|
+
tone: 'neutral',
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
mount(Checkbox, {
|
|
244
|
+
target: createSection('indirect-neutral-checkbox'),
|
|
245
|
+
props: {
|
|
246
|
+
animation: 'fade',
|
|
247
|
+
checked: true,
|
|
248
|
+
label: 'Indirect neutral checkbox',
|
|
249
|
+
size: 'xl',
|
|
250
|
+
tone: 'neutral',
|
|
251
|
+
visualState: 'indirect',
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
for (const variant of ['soft', 'tint', 'outline', 'plain']) {
|
|
255
|
+
mount(Checkbox, {
|
|
256
|
+
target: createSection(`direct-neutral-${variant}-checkbox`),
|
|
257
|
+
props: {
|
|
258
|
+
animation: 'fade',
|
|
259
|
+
checked: true,
|
|
260
|
+
label: `Direct neutral ${variant} checkbox`,
|
|
261
|
+
size: 'xl',
|
|
262
|
+
tone: 'neutral',
|
|
263
|
+
variant,
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
mount(Checkbox, {
|
|
267
|
+
target: createSection(`indirect-neutral-${variant}-checkbox`),
|
|
268
|
+
props: {
|
|
269
|
+
animation: 'fade',
|
|
270
|
+
checked: true,
|
|
271
|
+
label: `Indirect neutral ${variant} checkbox`,
|
|
272
|
+
size: 'xl',
|
|
273
|
+
tone: 'neutral',
|
|
274
|
+
variant,
|
|
275
|
+
visualState: 'indirect',
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import type { SeblifyProps } from 'seblify';
|
|
3
3
|
import SegmentControl from '../segment-control/SegmentControl.svelte';
|
|
4
4
|
|
|
5
|
-
type
|
|
5
|
+
type ColorMode = 'system' | 'light' | 'dark';
|
|
6
6
|
|
|
7
7
|
type Props = SeblifyProps<{
|
|
8
|
-
value?:
|
|
8
|
+
value?: ColorMode;
|
|
9
9
|
label?: string;
|
|
10
10
|
description?: string;
|
|
11
11
|
name?: string;
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
let {
|
|
16
16
|
value = $bindable('system'),
|
|
17
|
-
label = '
|
|
18
|
-
description = 'Choose how Seblify
|
|
19
|
-
name = 'seblify-
|
|
17
|
+
label = 'Color mode',
|
|
18
|
+
description = 'Choose how Seblify resolves light and dark colors.',
|
|
19
|
+
name = 'seblify-color-mode',
|
|
20
20
|
applyToDocument = true,
|
|
21
21
|
}: Props = $props();
|
|
22
22
|
|
|
23
|
-
const options: { value:
|
|
23
|
+
const options: { value: ColorMode; label: string }[] = [
|
|
24
24
|
{ value: 'system', label: 'System' },
|
|
25
25
|
{ value: 'light', label: 'Light' },
|
|
26
26
|
{ value: 'dark', label: 'Dark' },
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (value === 'system') {
|
|
35
|
-
delete document.documentElement.dataset.
|
|
35
|
+
delete document.documentElement.dataset.colorMode;
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
document.documentElement.dataset.
|
|
39
|
+
document.documentElement.dataset.colorMode = value;
|
|
40
40
|
});
|
|
41
41
|
</script>
|
|
42
42
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type ColorMode = 'system' | 'light' | 'dark';
|
|
2
|
+
declare const ColorModeSwitch: import("svelte").Component<{
|
|
3
|
+
value?: ColorMode | undefined;
|
|
4
|
+
label?: string | undefined;
|
|
5
|
+
description?: string | undefined;
|
|
6
|
+
name?: string | undefined;
|
|
7
|
+
applyToDocument?: boolean | undefined;
|
|
8
|
+
}, {}, "value">;
|
|
9
|
+
type ColorModeSwitch = ReturnType<typeof ColorModeSwitch>;
|
|
10
|
+
export default ColorModeSwitch;
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
top: 3px;
|
|
197
197
|
bottom: 3px;
|
|
198
198
|
border-radius: 999px;
|
|
199
|
-
background: var(--seblify-color-fill
|
|
199
|
+
background: var(--seblify-color-primary-fill, #146a6f);
|
|
200
200
|
transition:
|
|
201
201
|
left 220ms cubic-bezier(0.22, 1, 0.36, 1),
|
|
202
202
|
width 220ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
input:checked + .option-content {
|
|
258
|
-
color: var(--seblify-color-fill-
|
|
258
|
+
color: var(--seblify-color-primary-fill-text, #ffffff);
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
label:has(input:focus-visible) .option-content {
|