@reshape-biotech/design-system 0.0.45 → 0.0.48
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/app.css +43 -31
- package/dist/components/activity/Activity.stories.svelte +100 -0
- package/dist/components/activity/Activity.stories.svelte.d.ts +19 -0
- package/dist/components/activity/Activity.svelte +80 -0
- package/dist/components/activity/Activity.svelte.d.ts +18 -0
- package/dist/components/activity/index.d.ts +1 -0
- package/dist/components/activity/index.js +1 -0
- package/dist/components/avatar/Avatar.svelte +3 -3
- package/dist/components/banner/Banner.svelte +2 -2
- package/dist/components/button/Button.svelte +94 -7
- package/dist/components/button/Button.svelte.d.ts +8 -5
- package/dist/components/collapsible/Collapsible.stories.svelte +40 -0
- package/dist/components/collapsible/Collapsible.stories.svelte.d.ts +19 -0
- package/dist/components/collapsible/components/collapsible-content.svelte +26 -0
- package/dist/components/collapsible/components/collapsible-content.svelte.d.ts +10 -0
- package/dist/components/collapsible/components/collapsible-trigger.svelte +36 -0
- package/dist/components/collapsible/components/collapsible-trigger.svelte.d.ts +4 -0
- package/dist/components/collapsible/index.d.ts +5 -0
- package/dist/components/collapsible/index.js +4 -0
- package/dist/components/collapsible/types.d.ts +9 -0
- package/dist/components/collapsible/types.js +1 -0
- package/dist/components/combobox/Combobox.stories.svelte +119 -0
- package/dist/components/combobox/Combobox.stories.svelte.d.ts +19 -0
- package/dist/components/combobox/components/combobox-add.svelte +30 -0
- package/dist/components/combobox/components/combobox-add.svelte.d.ts +8 -0
- package/dist/components/combobox/components/combobox-content.svelte +137 -0
- package/dist/components/combobox/components/combobox-content.svelte.d.ts +4 -0
- package/dist/components/combobox/components/combobox-indicator.svelte +5 -0
- package/dist/components/combobox/components/combobox-indicator.svelte.d.ts +18 -0
- package/dist/components/combobox/index.d.ts +14 -0
- package/dist/components/combobox/index.js +15 -0
- package/dist/components/combobox/types.d.ts +20 -0
- package/dist/components/combobox/types.js +1 -0
- package/dist/components/datepicker/DatePicker.svelte +158 -97
- package/dist/components/divider/Divider.svelte +1 -1
- package/dist/components/drawer/Drawer.svelte +1 -1
- package/dist/components/drawer/DrawerLabel.svelte +2 -2
- package/dist/components/dropdown/components/DropdownContent.svelte +4 -1
- package/dist/components/dropdown/components/DropdownMenu.svelte +1 -1
- package/dist/components/dropdown/components/DropdownTrigger.svelte +4 -2
- package/dist/components/dropdown/components/DropdownTrigger.svelte.d.ts +1 -0
- package/dist/components/dropdown/components/OutlinedButton.svelte +2 -2
- package/dist/components/empty-content/EmptyContent.svelte +19 -0
- package/dist/components/empty-content/EmptyContent.svelte.d.ts +8 -0
- package/dist/components/graphs/chart/Chart.stories.svelte +128 -0
- package/dist/components/graphs/chart/Chart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/chart/Chart.svelte +145 -0
- package/dist/components/graphs/chart/Chart.svelte.d.ts +17 -0
- package/dist/components/graphs/index.d.ts +4 -0
- package/dist/components/graphs/index.js +4 -0
- package/dist/components/graphs/line/LineChart.stories.svelte +73 -0
- package/dist/components/graphs/line/LineChart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/line/LineChart.svelte +102 -0
- package/dist/components/graphs/line/LineChart.svelte.d.ts +18 -0
- package/dist/components/graphs/multiline/MultiLineChart.stories.svelte +77 -0
- package/dist/components/graphs/multiline/MultiLineChart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/multiline/MultiLineChart.svelte +108 -0
- package/dist/components/graphs/multiline/MultiLineChart.svelte.d.ts +22 -0
- package/dist/components/graphs/scatterplot/Scatterplot.stories.svelte +78 -0
- package/dist/components/graphs/scatterplot/Scatterplot.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/scatterplot/Scatterplot.svelte +67 -0
- package/dist/components/graphs/scatterplot/Scatterplot.svelte.d.ts +16 -0
- package/dist/components/icon-button/IconButton.svelte +18 -5
- package/dist/components/icon-button/IconButton.svelte.d.ts +2 -2
- package/dist/components/icons/AnalysisIcon.stories.svelte +38 -0
- package/dist/components/icons/AnalysisIcon.stories.svelte.d.ts +27 -0
- package/dist/components/icons/AnalysisIcon.svelte +110 -0
- package/dist/components/icons/AnalysisIcon.svelte.d.ts +10 -0
- package/dist/components/icons/Icon.svelte +23 -0
- package/dist/components/icons/Icon.svelte.d.ts +4 -0
- package/dist/components/icons/custom/Halo.svelte +32 -0
- package/dist/components/icons/custom/Halo.svelte.d.ts +26 -0
- package/dist/components/icons/custom/Well.svelte +26 -0
- package/dist/components/icons/custom/Well.svelte.d.ts +26 -0
- package/dist/components/icons/index.d.ts +17 -0
- package/dist/components/icons/index.js +21 -0
- package/dist/components/icons/types.d.ts +0 -0
- package/dist/components/icons/types.js +1 -0
- package/dist/components/image/Image.svelte +5 -6
- package/dist/components/input/Input.svelte +63 -41
- package/dist/components/input/Input.svelte.d.ts +7 -4
- package/dist/components/list/List.svelte +4 -10
- package/dist/components/logo/Logo.svelte +8 -5
- package/dist/components/logo/Logo.svelte.d.ts +1 -0
- package/dist/components/modal/Modal.svelte +1 -1
- package/dist/components/notification-popup/NotificationPopup.stories.svelte +2 -2
- package/dist/components/notification-popup/NotificationPopup.svelte +4 -2
- package/dist/components/segmented-control-buttons/ControlButton.svelte +2 -4
- package/dist/components/select/Select.svelte +7 -4
- package/dist/components/skeleton-loader/StatcardSkeleton.svelte +2 -5
- package/dist/components/slider/Slider.svelte +32 -23
- package/dist/components/slider/Slider.svelte.d.ts +2 -0
- package/dist/components/stat-card/StatCard.svelte +6 -6
- package/dist/components/table/Table.svelte +1 -1
- package/dist/components/table/components/Th.svelte +1 -1
- package/dist/components/tag/Tag.svelte +3 -5
- package/dist/components/tag/Tag.svelte.d.ts +5 -4
- package/dist/components/toggle/Toggle.svelte.d.ts +3 -2
- package/dist/fonts/afAnotherSans-Medium.woff2 +0 -0
- package/dist/fonts/afAnotherSans-Regular.woff2 +0 -0
- package/dist/fonts/afAnotherSans-SemiBold.woff2 +0 -0
- package/dist/fonts/afAnotherSans.woff2 +0 -0
- package/dist/fonts/index.d.ts +1 -3
- package/dist/fonts/index.js +2 -6
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/tailwind-safelist.js +1 -1
- package/dist/tailwind.preset.d.ts +19 -6
- package/dist/tailwind.preset.js +5 -4
- package/dist/tokens.d.ts +39 -11
- package/dist/tokens.js +34 -16
- package/package.json +18 -15
- package/dist/fonts/MDSystem-Medium.woff +0 -0
- package/dist/fonts/MDSystem-Medium.woff2 +0 -0
- package/dist/fonts/MDSystem-Regular.woff +0 -0
- package/dist/fonts/MDSystem-Regular.woff2 +0 -0
- package/dist/fonts/MDSystem-Semibold.woff +0 -0
- package/dist/fonts/MDSystem-Semibold.woff2 +0 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { DateTime, type MonthNumbers } from 'luxon';
|
|
5
5
|
import { CaretLeft, CaretRight } from 'phosphor-svelte';
|
|
6
|
+
import IconButton from '../icon-button/IconButton.svelte';
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
8
9
|
selectedDate: DateTime | undefined;
|
|
@@ -93,17 +94,13 @@
|
|
|
93
94
|
<div class="calendar">
|
|
94
95
|
<div class="calendar-header">
|
|
95
96
|
<div class="month-year">
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<button class="btn-custom p-2" onclick={nextMonth} aria-label="calendar forward">
|
|
104
|
-
<CaretRight class="text-secondary" weight="bold" size="0.75rem" />
|
|
105
|
-
</button>
|
|
106
|
-
</div>
|
|
97
|
+
<IconButton onclick={previousMonth}
|
|
98
|
+
><CaretLeft class="text-secondary" weight="bold" size="0.75rem" /></IconButton
|
|
99
|
+
>
|
|
100
|
+
<h5>{DateTime.local(shownYear, shownMonth).toFormat('MMM yyyy')}</h5>
|
|
101
|
+
<IconButton onclick={nextMonth}
|
|
102
|
+
><CaretRight class="text-secondary" weight="bold" size="0.75rem" /></IconButton
|
|
103
|
+
>
|
|
107
104
|
</div>
|
|
108
105
|
</div>
|
|
109
106
|
<div class="calendar-body">
|
|
@@ -164,120 +161,184 @@
|
|
|
164
161
|
|
|
165
162
|
<style>
|
|
166
163
|
.calendar-container {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
|
|
165
|
+
display: flex;
|
|
166
|
+
|
|
167
|
+
width: 312px
|
|
168
|
+
}
|
|
170
169
|
|
|
171
170
|
.calendar {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
171
|
+
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
|
|
174
|
+
border-radius: 0.5rem;
|
|
175
|
+
|
|
176
|
+
--tw-bg-opacity: 1;
|
|
177
|
+
|
|
178
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
179
|
+
|
|
180
|
+
padding: 1rem;
|
|
181
|
+
|
|
182
|
+
--tw-shadow: 0 4px 20px 0 rgba(18, 25, 42, 0.06), 0 0 0 0.5px rgba(18, 25, 42, 0.08);
|
|
183
|
+
|
|
184
|
+
--tw-shadow-colored: 0 4px 20px 0 var(--tw-shadow-color), 0 0 0 0.5px var(--tw-shadow-color);
|
|
185
|
+
|
|
186
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
180
187
|
}
|
|
181
188
|
|
|
182
189
|
.month-year {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
190
|
+
|
|
191
|
+
display: flex;
|
|
192
|
+
|
|
193
|
+
align-items: center;
|
|
194
|
+
|
|
195
|
+
justify-content: space-between
|
|
196
|
+
}
|
|
187
197
|
|
|
188
198
|
.month-year .btn-custom {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
199
|
+
|
|
200
|
+
border-style: none;
|
|
201
|
+
|
|
202
|
+
background-image: none
|
|
203
|
+
}
|
|
192
204
|
|
|
193
205
|
.calendar-body {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
206
|
+
|
|
207
|
+
display: flex;
|
|
208
|
+
|
|
209
|
+
align-items: center;
|
|
210
|
+
|
|
211
|
+
justify-content: space-between;
|
|
212
|
+
|
|
213
|
+
overflow-x: auto;
|
|
214
|
+
|
|
215
|
+
padding-top: 22px
|
|
216
|
+
}
|
|
200
217
|
|
|
201
218
|
table {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
219
|
+
|
|
220
|
+
margin: 0px;
|
|
221
|
+
|
|
222
|
+
width: 100%;
|
|
223
|
+
|
|
224
|
+
border-collapse: collapse;
|
|
225
|
+
|
|
226
|
+
--tw-border-spacing-x: 0px;
|
|
227
|
+
|
|
228
|
+
--tw-border-spacing-y: 0px;
|
|
229
|
+
|
|
230
|
+
border-spacing: var(--tw-border-spacing-x) var(--tw-border-spacing-y);
|
|
231
|
+
|
|
232
|
+
padding: 0px
|
|
233
|
+
}
|
|
208
234
|
|
|
209
235
|
table thead th p {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
236
|
+
|
|
237
|
+
text-align: center;
|
|
238
|
+
|
|
239
|
+
font-size: 0.75rem;
|
|
240
|
+
|
|
241
|
+
line-height: 1rem;
|
|
242
|
+
|
|
243
|
+
font-weight: 500;
|
|
244
|
+
|
|
245
|
+
--tw-text-opacity: 1;
|
|
246
|
+
|
|
247
|
+
color: rgb(136 140 148 / var(--tw-text-opacity, 1))
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
tr {
|
|
251
|
+
|
|
252
|
+
height: 2.5rem;
|
|
253
|
+
|
|
254
|
+
border-style: none
|
|
216
255
|
}
|
|
217
256
|
|
|
218
|
-
td {
|
|
219
|
-
width: 40px;
|
|
220
|
-
height: 40px;
|
|
221
|
-
}
|
|
222
257
|
table th,
|
|
223
258
|
table td {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
259
|
+
|
|
260
|
+
margin: 0px;
|
|
261
|
+
|
|
262
|
+
border-style: none;
|
|
263
|
+
|
|
264
|
+
padding: 0px
|
|
265
|
+
}
|
|
228
266
|
|
|
229
267
|
.date-container {
|
|
230
|
-
position: relative;
|
|
231
|
-
}
|
|
232
268
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
top: 20px;
|
|
236
|
-
left: 18px;
|
|
237
|
-
}
|
|
269
|
+
position: relative
|
|
270
|
+
}
|
|
238
271
|
|
|
239
272
|
.date {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
273
|
+
|
|
274
|
+
display: flex;
|
|
275
|
+
|
|
276
|
+
height: 2.5rem;
|
|
277
|
+
|
|
278
|
+
width: 2.5rem;
|
|
279
|
+
|
|
280
|
+
cursor: pointer;
|
|
281
|
+
|
|
282
|
+
align-items: center;
|
|
283
|
+
|
|
284
|
+
justify-content: center;
|
|
285
|
+
|
|
286
|
+
border-radius: 0.5rem;
|
|
287
|
+
|
|
288
|
+
font-size: 0.875rem;
|
|
289
|
+
|
|
290
|
+
line-height: 1.25rem;
|
|
291
|
+
|
|
292
|
+
transition-duration: 150ms
|
|
247
293
|
}
|
|
248
294
|
|
|
249
|
-
.date
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
295
|
+
.date:hover {
|
|
296
|
+
|
|
297
|
+
background-color: #5750ee1A
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.date:focus {
|
|
301
|
+
|
|
302
|
+
--tw-bg-opacity: 1;
|
|
303
|
+
|
|
304
|
+
background-color: rgb(87 80 238 / var(--tw-bg-opacity, 1));
|
|
305
|
+
|
|
306
|
+
--tw-text-opacity: 1;
|
|
307
|
+
|
|
308
|
+
color: rgb(255 255 255 / var(--tw-text-opacity, 1))
|
|
263
309
|
}
|
|
264
310
|
|
|
265
311
|
.selected-date {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
312
|
+
|
|
313
|
+
--tw-bg-opacity: 1;
|
|
314
|
+
|
|
315
|
+
background-color: rgb(87 80 238 / var(--tw-bg-opacity, 1));
|
|
316
|
+
|
|
317
|
+
--tw-text-opacity: 1;
|
|
318
|
+
|
|
319
|
+
color: rgb(255 255 255 / var(--tw-text-opacity, 1))
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.selected-date:hover {
|
|
323
|
+
|
|
324
|
+
--tw-bg-opacity: 1;
|
|
325
|
+
|
|
326
|
+
background-color: rgb(87 80 238 / var(--tw-bg-opacity, 1))
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.current-date-indicator {
|
|
330
|
+
|
|
331
|
+
position: absolute;
|
|
332
|
+
|
|
333
|
+
left: 18px;
|
|
334
|
+
|
|
335
|
+
top: 2rem
|
|
277
336
|
}
|
|
278
337
|
|
|
279
338
|
.date button {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
339
|
+
|
|
340
|
+
border-style: none;
|
|
341
|
+
|
|
342
|
+
background-image: none
|
|
343
|
+
}
|
|
283
344
|
</style>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
</div>
|
|
35
35
|
<div class="drawer-side" inert={controlled ? !open : false}>
|
|
36
36
|
<label for={id} aria-label="close sidebar" class="drawer-overlay"></label>
|
|
37
|
-
<div class="h-screen bg-
|
|
37
|
+
<div class="h-screen bg-surface sm:w-[460px]">
|
|
38
38
|
{@render content()}
|
|
39
39
|
</div>
|
|
40
40
|
</div>
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
|
|
42
42
|
color: rgb(18 25 42 / var(--tw-text-opacity, 1));
|
|
43
43
|
|
|
44
|
-
--tw-shadow:
|
|
44
|
+
--tw-shadow: 0 1px 4px 0 rgba(18, 25, 42, 0.04);
|
|
45
45
|
|
|
46
|
-
--tw-shadow-colored:
|
|
46
|
+
--tw-shadow-colored: 0 1px 4px 0 var(--tw-shadow-color);
|
|
47
47
|
|
|
48
48
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
49
49
|
}
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
23
23
|
<!-- DaisyUI have a bug wit safari dropdown. Requires tabindex=0-->
|
|
24
|
-
<div
|
|
24
|
+
<div
|
|
25
|
+
class={`dropdown-content z-[1] mb-2 rounded-md p-1 shadow-2xl ${variantClass} ${className}`}
|
|
26
|
+
tabindex="0"
|
|
27
|
+
>
|
|
25
28
|
{@render children?.()}
|
|
26
29
|
</div>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
<ul
|
|
13
13
|
tabIndex="0"
|
|
14
|
-
class={`menu dropdown-content menu-md z-[1] rounded-
|
|
14
|
+
class={`menu dropdown-content menu-md z-[1] rounded-lg bg-surface p-1 shadow-menu ${className}`}
|
|
15
15
|
>
|
|
16
16
|
{@render children?.()}
|
|
17
17
|
</ul>
|
|
@@ -6,19 +6,21 @@
|
|
|
6
6
|
variant?: Color;
|
|
7
7
|
children?: Snippet;
|
|
8
8
|
noPadding?: boolean;
|
|
9
|
+
iconButton?: boolean;
|
|
9
10
|
}
|
|
10
11
|
let {
|
|
11
12
|
size = 'md',
|
|
12
13
|
class: className = '',
|
|
13
14
|
variant = 'primary',
|
|
14
15
|
children,
|
|
15
|
-
noPadding = false
|
|
16
|
+
noPadding = false,
|
|
17
|
+
iconButton = false
|
|
16
18
|
}: Props = $props();
|
|
17
19
|
|
|
18
20
|
type Color = 'primary' | 'secondary' | 'transparent' | 'danger';
|
|
19
21
|
|
|
20
22
|
const sizes = $derived({
|
|
21
|
-
sm: `h-8 ${noPadding ? 'px-0' : 'px-3'} ${noPadding ? 'py-0' : 'py-2'}`,
|
|
23
|
+
sm: `h-8 ${noPadding ? 'px-0' : iconButton ? 'px-2' : 'px-3'} ${noPadding ? 'py-0' : iconButton ? 'py-2' : 'py-3'}`,
|
|
22
24
|
md: 'h-10 px-5 py-3',
|
|
23
25
|
lg: 'h-12 px-6 py-4'
|
|
24
26
|
});
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
|
|
41
41
|
color: rgb(18 25 42 / var(--tw-text-opacity, 1));
|
|
42
42
|
|
|
43
|
-
--tw-shadow:
|
|
43
|
+
--tw-shadow: 0 1px 4px 0 rgba(18, 25, 42, 0.04);
|
|
44
44
|
|
|
45
|
-
--tw-shadow-colored:
|
|
45
|
+
--tw-shadow-colored: 0 1px 4px 0 var(--tw-shadow-color);
|
|
46
46
|
|
|
47
47
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
48
48
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
icon: Snippet;
|
|
6
|
+
children: Snippet;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const { icon, children }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div class="flex w-full justify-center">
|
|
13
|
+
<div class="flex max-w-[180px] flex-col items-center justify-center gap-5 py-5 text-tertiary">
|
|
14
|
+
{@render icon()}
|
|
15
|
+
<div class="flex w-full flex-col items-center justify-center gap-2">
|
|
16
|
+
{@render children()}
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script lang="ts" context="module">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Chart from './Chart.svelte';
|
|
4
|
+
import { colors } from '../../../tokens';
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
component: Chart,
|
|
8
|
+
title: 'Design System/Graphs/Chart',
|
|
9
|
+
tags: ['autodocs']
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
const baseOptions = {
|
|
15
|
+
xAxis: { type: 'value' as const },
|
|
16
|
+
yAxis: { type: 'value' as const },
|
|
17
|
+
series: [
|
|
18
|
+
{
|
|
19
|
+
type: 'scatter' as const,
|
|
20
|
+
data: [
|
|
21
|
+
[10, 8.04],
|
|
22
|
+
[8.07, 6.95],
|
|
23
|
+
[13.0, 7.58]
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const lineOptions = {
|
|
30
|
+
xAxis: { type: 'category' as const, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] },
|
|
31
|
+
yAxis: { type: 'value' as const },
|
|
32
|
+
series: [
|
|
33
|
+
{
|
|
34
|
+
type: 'line' as const,
|
|
35
|
+
data: [150, 230, 224, 218, 135]
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
function handleClick(params: any) {
|
|
41
|
+
console.log('Clicked:', params);
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<!-- Basic Usage -->
|
|
46
|
+
<Story name="Default">
|
|
47
|
+
<Chart options={baseOptions} />
|
|
48
|
+
</Story>
|
|
49
|
+
|
|
50
|
+
<!-- Custom Size -->
|
|
51
|
+
<Story name="Custom Size">
|
|
52
|
+
<Chart options={baseOptions} width="600px" height="400px" />
|
|
53
|
+
</Story>
|
|
54
|
+
|
|
55
|
+
<!-- Loading State -->
|
|
56
|
+
<Story name="Loading State">
|
|
57
|
+
<Chart options={baseOptions} loading={true} />
|
|
58
|
+
</Story>
|
|
59
|
+
|
|
60
|
+
<!-- With Events -->
|
|
61
|
+
<Story name="With Click Events">
|
|
62
|
+
<Chart
|
|
63
|
+
options={baseOptions}
|
|
64
|
+
onitemclick={handleClick}
|
|
65
|
+
onmouseover={(params) => console.log('Hover:', params)}
|
|
66
|
+
/>
|
|
67
|
+
</Story>
|
|
68
|
+
|
|
69
|
+
<!-- Different Chart Types -->
|
|
70
|
+
<Story name="Line Chart">
|
|
71
|
+
<Chart options={lineOptions} />
|
|
72
|
+
</Story>
|
|
73
|
+
|
|
74
|
+
<!-- Theme Example -->
|
|
75
|
+
<Story name="Dark Theme">
|
|
76
|
+
<div style="background: #333; padding: 20px;">
|
|
77
|
+
<Chart
|
|
78
|
+
options={{
|
|
79
|
+
...baseOptions,
|
|
80
|
+
backgroundColor: '#333',
|
|
81
|
+
textStyle: { color: '#fff' }
|
|
82
|
+
}}
|
|
83
|
+
theme={{
|
|
84
|
+
textStyle: { color: '#fff' },
|
|
85
|
+
color: [colors.blue[5].default]
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
</Story>
|
|
90
|
+
|
|
91
|
+
<!-- Responsive Example -->
|
|
92
|
+
<Story name="Responsive">
|
|
93
|
+
<div
|
|
94
|
+
style="resize: both; overflow: auto; min-width: 300px; min-height: 200px; border: 1px solid #ccc;"
|
|
95
|
+
>
|
|
96
|
+
<Chart options={baseOptions} autoResize={true} />
|
|
97
|
+
</div>
|
|
98
|
+
</Story>
|
|
99
|
+
|
|
100
|
+
<!-- Multiple Series -->
|
|
101
|
+
<Story name="Multiple Series">
|
|
102
|
+
<Chart
|
|
103
|
+
options={{
|
|
104
|
+
...baseOptions,
|
|
105
|
+
series: [
|
|
106
|
+
{
|
|
107
|
+
type: 'scatter' as const,
|
|
108
|
+
data: [
|
|
109
|
+
[10, 8.04],
|
|
110
|
+
[8.07, 6.95],
|
|
111
|
+
[13.0, 7.58]
|
|
112
|
+
],
|
|
113
|
+
name: 'Series 1'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: 'scatter' as const,
|
|
117
|
+
data: [
|
|
118
|
+
[9, 7.5],
|
|
119
|
+
[7.5, 6.3],
|
|
120
|
+
[12.5, 7.0]
|
|
121
|
+
],
|
|
122
|
+
name: 'Series 2'
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
legend: { data: ['Series 1', 'Series 2'] }
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
</Story>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Chart from './Chart.svelte';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Chart: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Chart = InstanceType<typeof Chart>;
|
|
19
|
+
export default Chart;
|