@makolabs/ripple 0.0.1-dev.24 → 0.0.1-dev.27
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 +1 -1
- package/dist/charts/Chart.svelte +11 -5
- package/dist/drawer/drawer.js +3 -3
- package/dist/elements/alert/Alert.svelte +2 -2
- package/dist/elements/progress/Progress.svelte +3 -3
- package/dist/forms/Checkbox.svelte +2 -2
- package/dist/forms/DateRange.svelte +21 -21
- package/dist/forms/Input.svelte +2 -2
- package/dist/forms/NumberInput.svelte +1 -1
- package/dist/forms/RadioInputs.svelte +3 -3
- package/dist/forms/Tags.svelte +5 -5
- package/dist/forms/Toggle.svelte +3 -3
- package/dist/forms/slider.js +4 -4
- package/dist/index.d.ts +53 -47
- package/dist/layout/card/StatsCard.svelte +4 -3
- package/dist/layout/card/StatsCard.svelte.d.ts +1 -1
- package/dist/layout/card/stats-card.d.ts +0 -15
- package/dist/layout/card/stats-card.js +1 -1
- package/dist/layout/sidebar/NavGroup.svelte +1 -1
- package/dist/layout/sidebar/NavItem.svelte +2 -2
- package/dist/layout/sidebar/Sidebar.svelte +5 -5
- package/dist/modal/modal.js +3 -3
- package/package.json +1 -1
- package/dist/header/pageheaders.d.ts +0 -10
- package/dist/header/pageheaders.js +0 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ Paste the following CSS import code in `app.css`
|
|
|
41
41
|
@source "../node_modules/@makolabs/ripple";
|
|
42
42
|
|
|
43
43
|
@theme {
|
|
44
|
-
/* Default (
|
|
44
|
+
/* Default (default) */
|
|
45
45
|
--color-default-50: oklch(0.984 0.003 247.858);
|
|
46
46
|
--color-default-100: oklch(0.96 0.006 247.858);
|
|
47
47
|
--color-default-200: oklch(0.91 0.008 247.858);
|
package/dist/charts/Chart.svelte
CHANGED
|
@@ -99,6 +99,13 @@
|
|
|
99
99
|
// Check if we have a pie/donut chart
|
|
100
100
|
const hasPieChart = $derived(series.some((s) => s.type === 'pie'));
|
|
101
101
|
|
|
102
|
+
// Check if we should show axis lines based on config or auto-detect from series type
|
|
103
|
+
const shouldShowAxisLines = $derived.by(() => {
|
|
104
|
+
if (config.showAxisLines !== undefined) return config.showAxisLines;
|
|
105
|
+
// Auto-detect: show for bar charts, hide for line charts
|
|
106
|
+
return series.some((s) => s.type === 'bar' || s.type === 'horizontal-bar');
|
|
107
|
+
});
|
|
108
|
+
|
|
102
109
|
let chartContainer: HTMLDivElement;
|
|
103
110
|
// @ts-expect-error - ECharts types are not available
|
|
104
111
|
let chart: echarts.ECharts;
|
|
@@ -422,7 +429,6 @@
|
|
|
422
429
|
}),
|
|
423
430
|
formatter: xAxis.format || '{value}'
|
|
424
431
|
},
|
|
425
|
-
// If all series are lines, no gap. If any bar, gap.
|
|
426
432
|
boundaryGap: series.every((s) => s.type === 'line')
|
|
427
433
|
? false
|
|
428
434
|
: series.some((s) => s.type === 'bar' || s.type === 'horizontal-bar')
|
|
@@ -435,9 +441,9 @@
|
|
|
435
441
|
show: grid.vertical || false
|
|
436
442
|
},
|
|
437
443
|
axisLine: {
|
|
438
|
-
show:
|
|
444
|
+
show: xAxis.showAxisLine ?? shouldShowAxisLines,
|
|
439
445
|
lineStyle: {
|
|
440
|
-
color: '
|
|
446
|
+
color: 'rgba(0, 0, 0, 0.1)'
|
|
441
447
|
}
|
|
442
448
|
}
|
|
443
449
|
},
|
|
@@ -452,9 +458,9 @@
|
|
|
452
458
|
min: axis.min,
|
|
453
459
|
max: axis.max,
|
|
454
460
|
axisLine: {
|
|
455
|
-
show:
|
|
461
|
+
show: axis.showAxisLine ?? (shouldShowAxisLines && index === 0),
|
|
456
462
|
lineStyle: {
|
|
457
|
-
color: '
|
|
463
|
+
color: 'rgba(0, 0, 0, 0.1)'
|
|
458
464
|
}
|
|
459
465
|
},
|
|
460
466
|
axisLabel: {
|
package/dist/drawer/drawer.js
CHANGED
|
@@ -5,11 +5,11 @@ export const drawer = tv({
|
|
|
5
5
|
backdrop: 'fixed inset-0 transition-opacity bg-black/50',
|
|
6
6
|
contentWrapper: 'absolute flex flex-col transform transition-transform',
|
|
7
7
|
content: 'flex flex-col h-full w-full overflow-y-auto bg-white',
|
|
8
|
-
header: 'flex items-center justify-between px-4 py-3 border-b border-
|
|
8
|
+
header: 'flex items-center justify-between px-4 py-3 border-b border-default-200',
|
|
9
9
|
body: 'flex-1 overflow-y-auto p-4',
|
|
10
|
-
footer: 'flex justify-end border-t border-
|
|
10
|
+
footer: 'flex justify-end border-t border-default-200 p-4',
|
|
11
11
|
title: 'text-default-900 leading-6 text-base font-semibold',
|
|
12
|
-
closeButton: 'text-
|
|
12
|
+
closeButton: 'text-default-400 hover:text-default-500 rounded-md cursor-pointer'
|
|
13
13
|
},
|
|
14
14
|
variants: {
|
|
15
15
|
open: {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const colorClasses = {
|
|
19
|
-
[Color.DEFAULT]: 'bg-
|
|
19
|
+
[Color.DEFAULT]: 'bg-default-50 border-default-200 text-default-800',
|
|
20
20
|
[Color.PRIMARY]: 'bg-primary-50 border-primary-200 text-primary-800',
|
|
21
21
|
[Color.SUCCESS]: 'bg-success-50 border-success-200 text-success-800',
|
|
22
22
|
[Color.WARNING]: 'bg-warning-50 border-warning-200 text-warning-800',
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
{#if onclose}
|
|
37
37
|
<button
|
|
38
38
|
type="button"
|
|
39
|
-
class="flex-shrink-0 cursor-pointer rounded-md p-1 hover:bg-
|
|
39
|
+
class="flex-shrink-0 cursor-pointer rounded-md p-1 hover:bg-default-200/20"
|
|
40
40
|
onclick={handleClose}
|
|
41
41
|
aria-label="Close alert"
|
|
42
42
|
>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
[Color.DANGER]: 'bg-danger-600',
|
|
32
32
|
[Color.WARNING]: 'bg-warning-600',
|
|
33
33
|
[Color.INFO]: 'bg-info-600',
|
|
34
|
-
[Color.DEFAULT]: 'bg-
|
|
34
|
+
[Color.DEFAULT]: 'bg-default-600'
|
|
35
35
|
};
|
|
36
36
|
return colorMap[color] || colorMap[Color.PRIMARY];
|
|
37
37
|
}
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
);
|
|
66
66
|
|
|
67
67
|
const progressClass = $derived(
|
|
68
|
-
cn('w-full rounded-full bg-
|
|
68
|
+
cn('w-full rounded-full bg-default-200', {
|
|
69
69
|
'h-1.5': size === Size.XS,
|
|
70
70
|
'h-2': size === Size.SM,
|
|
71
71
|
'h-2.5': size === Size.BASE,
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
|
|
88
88
|
const labelTextClass = $derived(
|
|
89
89
|
cn(
|
|
90
|
-
'text-
|
|
90
|
+
'text-default-500',
|
|
91
91
|
getSizeTextClass(size),
|
|
92
92
|
{
|
|
93
93
|
'order-1': !segments && labelPosition === 'top',
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}: CheckboxProps = $props();
|
|
14
14
|
|
|
15
15
|
const checkboxClass = $derived(
|
|
16
|
-
cn('w-4 h-4 rounded text-primary-600 border-
|
|
16
|
+
cn('w-4 h-4 rounded text-primary-600 border-default-300 focus:ring-primary-500', {
|
|
17
17
|
'opacity-50 cursor-not-allowed': disabled,
|
|
18
18
|
'accent-danger-500': errors.length
|
|
19
19
|
})
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
const labelClass = $derived(
|
|
23
23
|
cn('text-sm font-medium', {
|
|
24
|
-
'text-
|
|
24
|
+
'text-default-700': !errors.length,
|
|
25
25
|
'text-danger-600': errors.length
|
|
26
26
|
})
|
|
27
27
|
);
|
|
@@ -245,24 +245,24 @@
|
|
|
245
245
|
{id}
|
|
246
246
|
type="button"
|
|
247
247
|
class={cn(
|
|
248
|
-
'flex w-full items-center justify-between rounded-md border border-
|
|
248
|
+
'flex w-full items-center justify-between rounded-md border border-default-300 bg-white px-3 py-2 text-sm shadow-sm',
|
|
249
249
|
disabled
|
|
250
|
-
? 'cursor-not-allowed bg-
|
|
251
|
-
: 'focus:border-primary-500 focus:ring-primary-500 hover:border-
|
|
250
|
+
? 'cursor-not-allowed bg-default-100 text-default-400'
|
|
251
|
+
: 'focus:border-primary-500 focus:ring-primary-500 hover:border-default-400 focus:ring-2'
|
|
252
252
|
)}
|
|
253
253
|
onclick={toggleDatepicker}
|
|
254
254
|
aria-haspopup="true"
|
|
255
255
|
aria-expanded={isOpen}
|
|
256
256
|
{disabled}
|
|
257
257
|
>
|
|
258
|
-
<span class={startDate && endDate ? 'text-
|
|
258
|
+
<span class={startDate && endDate ? 'text-default-900' : 'text-default-500'}>
|
|
259
259
|
{startDate && endDate
|
|
260
260
|
? `${formatDate(startDate)} - ${formatDate(endDate)}`
|
|
261
261
|
: startDate
|
|
262
262
|
? `${formatDate(startDate)} - Select end date`
|
|
263
263
|
: placeholder}
|
|
264
264
|
</span>
|
|
265
|
-
<svg class="h-5 w-5 text-
|
|
265
|
+
<svg class="h-5 w-5 text-default-400" viewBox="0 0 20 20" fill="currentColor">
|
|
266
266
|
<path
|
|
267
267
|
fill-rule="evenodd"
|
|
268
268
|
d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
{#if startDate || endDate}
|
|
275
275
|
<button
|
|
276
276
|
type="button"
|
|
277
|
-
class="absolute top-1/2 right-10 -translate-y-1/2 text-
|
|
277
|
+
class="absolute top-1/2 right-10 -translate-y-1/2 text-default-400 hover:text-default-500"
|
|
278
278
|
onclick={clearDates}
|
|
279
279
|
aria-label="Clear dates"
|
|
280
280
|
>
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
<button
|
|
299
299
|
type="button"
|
|
300
300
|
aria-label="Previous month"
|
|
301
|
-
class="inline-flex items-center rounded-md p-1 text-sm text-
|
|
301
|
+
class="inline-flex items-center rounded-md p-1 text-sm text-default-500 hover:bg-default-100"
|
|
302
302
|
onclick={prevMonth}
|
|
303
303
|
>
|
|
304
304
|
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
</button>
|
|
312
312
|
<button
|
|
313
313
|
type="button"
|
|
314
|
-
class="inline-flex items-center rounded-md px-2 py-1 text-sm font-medium text-
|
|
314
|
+
class="inline-flex items-center rounded-md px-2 py-1 text-sm font-medium text-default-700 hover:bg-default-100"
|
|
315
315
|
onclick={showMonths}
|
|
316
316
|
>
|
|
317
317
|
{getMonthName(viewDate.getMonth())}
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
<button
|
|
321
321
|
type="button"
|
|
322
322
|
aria-label="Next month"
|
|
323
|
-
class="inline-flex items-center rounded-md p-1 text-sm text-
|
|
323
|
+
class="inline-flex items-center rounded-md p-1 text-sm text-default-500 hover:bg-default-100"
|
|
324
324
|
onclick={nextMonth}
|
|
325
325
|
>
|
|
326
326
|
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
@@ -335,7 +335,7 @@
|
|
|
335
335
|
<button
|
|
336
336
|
type="button"
|
|
337
337
|
aria-label="Previous year"
|
|
338
|
-
class="inline-flex items-center rounded-md p-1 text-sm text-
|
|
338
|
+
class="inline-flex items-center rounded-md p-1 text-sm text-default-500 hover:bg-default-100"
|
|
339
339
|
onclick={() =>
|
|
340
340
|
(viewDate = new Date(viewDate.getFullYear() - 1, viewDate.getMonth(), 1))}
|
|
341
341
|
>
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
<button
|
|
351
351
|
type="button"
|
|
352
352
|
aria-label="Current year"
|
|
353
|
-
class="inline-flex items-center rounded-md px-2 py-1 text-sm font-medium text-
|
|
353
|
+
class="inline-flex items-center rounded-md px-2 py-1 text-sm font-medium text-default-700"
|
|
354
354
|
onclick={showYears}
|
|
355
355
|
>
|
|
356
356
|
{viewDate.getFullYear()}
|
|
@@ -358,7 +358,7 @@
|
|
|
358
358
|
<button
|
|
359
359
|
type="button"
|
|
360
360
|
aria-label="Next year"
|
|
361
|
-
class="inline-flex items-center rounded-md p-1 text-sm text-
|
|
361
|
+
class="inline-flex items-center rounded-md p-1 text-sm text-default-500 hover:bg-default-100"
|
|
362
362
|
onclick={() =>
|
|
363
363
|
(viewDate = new Date(viewDate.getFullYear() + 1, viewDate.getMonth(), 1))}
|
|
364
364
|
>
|
|
@@ -374,7 +374,7 @@
|
|
|
374
374
|
<button
|
|
375
375
|
type="button"
|
|
376
376
|
aria-label="Previous year"
|
|
377
|
-
class="inline-flex items-center rounded-md p-1 text-sm text-
|
|
377
|
+
class="inline-flex items-center rounded-md p-1 text-sm text-default-500 hover:bg-default-100"
|
|
378
378
|
onclick={() =>
|
|
379
379
|
(viewDate = new Date(viewDate.getFullYear() - 12, viewDate.getMonth(), 1))}
|
|
380
380
|
>
|
|
@@ -389,14 +389,14 @@
|
|
|
389
389
|
<button
|
|
390
390
|
type="button"
|
|
391
391
|
aria-label="Current year range"
|
|
392
|
-
class="inline-flex items-center rounded-md px-2 py-1 text-sm font-medium text-
|
|
392
|
+
class="inline-flex items-center rounded-md px-2 py-1 text-sm font-medium text-default-700"
|
|
393
393
|
>
|
|
394
394
|
{viewDate.getFullYear() - 6} - {viewDate.getFullYear() + 5}
|
|
395
395
|
</button>
|
|
396
396
|
<button
|
|
397
397
|
type="button"
|
|
398
398
|
aria-label="Next year"
|
|
399
|
-
class="inline-flex items-center rounded-md p-1 text-sm text-
|
|
399
|
+
class="inline-flex items-center rounded-md p-1 text-sm text-default-500 hover:bg-default-100"
|
|
400
400
|
onclick={() =>
|
|
401
401
|
(viewDate = new Date(viewDate.getFullYear() + 12, viewDate.getMonth(), 1))}
|
|
402
402
|
>
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
</div>
|
|
413
413
|
|
|
414
414
|
{#if viewMode === 'days'}
|
|
415
|
-
<div class="mb-1 grid grid-cols-7 gap-1 text-center text-xs font-medium text-
|
|
415
|
+
<div class="mb-1 grid grid-cols-7 gap-1 text-center text-xs font-medium text-default-500">
|
|
416
416
|
<div>Su</div>
|
|
417
417
|
<div>Mo</div>
|
|
418
418
|
<div>Tu</div>
|
|
@@ -427,10 +427,10 @@
|
|
|
427
427
|
type="button"
|
|
428
428
|
class={cn(
|
|
429
429
|
'flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium',
|
|
430
|
-
isDisabled ? 'cursor-not-allowed text-
|
|
430
|
+
isDisabled ? 'cursor-not-allowed text-default-300' : 'hover:bg-default-100',
|
|
431
431
|
isSelected ? 'bg-primary-500 hover:bg-primary-600 text-white' : '',
|
|
432
432
|
isInRange && !isSelected ? 'bg-primary-100 text-primary-800' : '',
|
|
433
|
-
!isCurrentMonth && !isSelected && !isInRange ? 'text-
|
|
433
|
+
!isCurrentMonth && !isSelected && !isInRange ? 'text-default-400' : '',
|
|
434
434
|
isToday && !isSelected ? 'border-primary-500 border' : ''
|
|
435
435
|
)}
|
|
436
436
|
onclick={() => handleDateClick(date)}
|
|
@@ -450,7 +450,7 @@
|
|
|
450
450
|
'flex items-center justify-center rounded-md px-2 py-1 text-sm font-medium',
|
|
451
451
|
viewDate.getMonth() === month
|
|
452
452
|
? 'bg-primary-500 text-white'
|
|
453
|
-
: 'text-
|
|
453
|
+
: 'text-default-700 hover:bg-default-100'
|
|
454
454
|
)}
|
|
455
455
|
onclick={() => selectMonth(month)}
|
|
456
456
|
>
|
|
@@ -468,7 +468,7 @@
|
|
|
468
468
|
'flex items-center justify-center rounded-md px-2 py-1 text-sm font-medium',
|
|
469
469
|
viewDate.getFullYear() === year
|
|
470
470
|
? 'bg-primary-500 text-white'
|
|
471
|
-
: 'text-
|
|
471
|
+
: 'text-default-700 hover:bg-default-100'
|
|
472
472
|
)}
|
|
473
473
|
onclick={() => selectYear(year)}
|
|
474
474
|
>
|
|
@@ -479,7 +479,7 @@
|
|
|
479
479
|
{/if}
|
|
480
480
|
|
|
481
481
|
{#if startDate || endDate}
|
|
482
|
-
<div class="mt-4 flex justify-between border-t border-
|
|
482
|
+
<div class="mt-4 flex justify-between border-t border-default-200 pt-3 text-xs text-default-500">
|
|
483
483
|
<div>
|
|
484
484
|
{startDate ? `${startLabel}: ${formatDate(startDate)}` : ''}
|
|
485
485
|
</div>
|
package/dist/forms/Input.svelte
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
'h-12 text-lg': size === Size.LG
|
|
35
35
|
}
|
|
36
36
|
: {}),
|
|
37
|
-
'border-
|
|
37
|
+
'border-default-300 focus:border-primary-500 focus:ring-primary-500': !errors.length
|
|
38
38
|
},
|
|
39
39
|
className
|
|
40
40
|
)
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
class={cn(
|
|
77
77
|
'block w-full text-sm font-medium',
|
|
78
78
|
{
|
|
79
|
-
'text-
|
|
79
|
+
'text-default-700': !errors.length,
|
|
80
80
|
'text-red-600': errors.length
|
|
81
81
|
},
|
|
82
82
|
extraClass
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
|
|
80
80
|
<div class="space-y-1">
|
|
81
81
|
{#if label}
|
|
82
|
-
<label for={name} class="block text-sm font-medium text-
|
|
82
|
+
<label for={name} class="block text-sm font-medium text-default-700">{label}</label>
|
|
83
83
|
{/if}
|
|
84
84
|
<div class={containerClass} bind:this={containerRef}>
|
|
85
85
|
<svg
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
const containerClass = $derived(cn('space-y-2', className));
|
|
17
17
|
|
|
18
18
|
const radioClass = $derived(
|
|
19
|
-
cn('w-4 h-4 text-primary-600 border-
|
|
19
|
+
cn('w-4 h-4 text-primary-600 border-default-300 focus:ring-primary-500', {
|
|
20
20
|
'opacity-50 cursor-not-allowed': disabled,
|
|
21
21
|
'border-red-300 focus:ring-red-500': errors.length
|
|
22
22
|
})
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
const labelClass = $derived(
|
|
26
26
|
cn('block text-sm font-medium', {
|
|
27
|
-
'text-
|
|
27
|
+
'text-default-700': !errors.length,
|
|
28
28
|
'text-red-600': errors.length
|
|
29
29
|
})
|
|
30
30
|
);
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
{required}
|
|
49
49
|
aria-describedby={errors.length ? `${name}-errors` : undefined}
|
|
50
50
|
/>
|
|
51
|
-
<label for={`${name}-${option.value}`} class="text-sm text-
|
|
51
|
+
<label for={`${name}-${option.value}`} class="text-sm text-default-700">
|
|
52
52
|
{option.label}
|
|
53
53
|
</label>
|
|
54
54
|
</div>
|
package/dist/forms/Tags.svelte
CHANGED
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
const containerClass = $derived(
|
|
107
107
|
cn(
|
|
108
108
|
'relative flex flex-wrap gap-2 rounded-lg border bg-white shadow-sm px-3 py-2',
|
|
109
|
-
'border-
|
|
109
|
+
'border-default-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500 focus-within:ring-offset-2',
|
|
110
110
|
{
|
|
111
111
|
'border-red-300 focus-within:border-red-500 focus-within:ring-red-500': errors?.length
|
|
112
112
|
},
|
|
@@ -116,21 +116,21 @@
|
|
|
116
116
|
|
|
117
117
|
const suggestionClass = $derived(
|
|
118
118
|
cn(
|
|
119
|
-
'absolute top-[calc(100%+8px)] right-0 left-0 z-50 max-h-[200px] overflow-auto rounded-lg border border-
|
|
119
|
+
'absolute top-[calc(100%+8px)] right-0 left-0 z-50 max-h-[200px] overflow-auto rounded-lg border border-default-300 bg-white shadow-lg'
|
|
120
120
|
)
|
|
121
121
|
);
|
|
122
122
|
|
|
123
123
|
const suggestionItemClass = $derived((isHighlighted: boolean) =>
|
|
124
124
|
cn(
|
|
125
125
|
'flex w-full cursor-pointer items-center px-3 py-2 text-sm transition-colors',
|
|
126
|
-
isHighlighted && 'bg-
|
|
126
|
+
isHighlighted && 'bg-default-50'
|
|
127
127
|
)
|
|
128
128
|
);
|
|
129
129
|
</script>
|
|
130
130
|
|
|
131
131
|
<div class="space-y-1">
|
|
132
132
|
{#if label}
|
|
133
|
-
<label for={name} class="block text-sm font-medium text-
|
|
133
|
+
<label for={name} class="block text-sm font-medium text-default-700">{label}</label>
|
|
134
134
|
{/if}
|
|
135
135
|
<div class={containerClass} onfocusout={handleFocusOut}>
|
|
136
136
|
{#each value as tag}
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
{name}
|
|
145
145
|
id={name}
|
|
146
146
|
{placeholder}
|
|
147
|
-
class={cn('min-w-[120px] flex-1 bg-transparent outline-none placeholder:text-
|
|
147
|
+
class={cn('min-w-[120px] flex-1 bg-transparent outline-none placeholder:text-default-400', {
|
|
148
148
|
'text-sm': size === Size.SM,
|
|
149
149
|
'text-base': size === Size.BASE,
|
|
150
150
|
'text-lg': size === Size.LG
|
package/dist/forms/Toggle.svelte
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
color = Color.PRIMARY,
|
|
14
14
|
value = $bindable(false),
|
|
15
15
|
errors = [],
|
|
16
|
-
offColor = 'bg-
|
|
16
|
+
offColor = 'bg-default-200',
|
|
17
17
|
onColor,
|
|
18
18
|
...restProps
|
|
19
19
|
}: ToggleProps = $props();
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
[Color.DANGER]: 'bg-red-500',
|
|
28
28
|
[Color.WARNING]: 'bg-yellow-500',
|
|
29
29
|
[Color.INFO]: 'bg-blue-500',
|
|
30
|
-
[Color.DEFAULT]: 'bg-
|
|
30
|
+
[Color.DEFAULT]: 'bg-default-800'
|
|
31
31
|
}[color]
|
|
32
32
|
);
|
|
33
33
|
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
|
|
81
81
|
const labelClasses = $derived(
|
|
82
82
|
cn('text-sm font-medium', {
|
|
83
|
-
'text-
|
|
83
|
+
'text-default-700': !errors.length,
|
|
84
84
|
'text-red-600': errors.length,
|
|
85
85
|
'opacity-50': disabled
|
|
86
86
|
})
|
package/dist/forms/slider.js
CHANGED
|
@@ -3,16 +3,16 @@ import { Color, Size } from '../variants.js';
|
|
|
3
3
|
export const slider = tv({
|
|
4
4
|
slots: {
|
|
5
5
|
base: 'relative w-full',
|
|
6
|
-
track: 'absolute h-2 w-full rounded-full bg-
|
|
6
|
+
track: 'absolute h-2 w-full rounded-full bg-default-200 cursor-pointer',
|
|
7
7
|
range: 'absolute h-full rounded-full bg-primary-500',
|
|
8
8
|
thumb: [
|
|
9
9
|
'absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-white border-2 border-primary-500',
|
|
10
10
|
'focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2',
|
|
11
11
|
'hover:scale-110 transition-transform cursor-pointer'
|
|
12
12
|
],
|
|
13
|
-
mark: 'absolute text-sm text-
|
|
14
|
-
label: 'mb-2 block text-sm font-medium text-
|
|
15
|
-
value: 'mt-1 text-sm text-
|
|
13
|
+
mark: 'absolute text-sm text-default-500 -translate-x-1/2',
|
|
14
|
+
label: 'mb-2 block text-sm font-medium text-default-700',
|
|
15
|
+
value: 'mt-1 text-sm text-default-500'
|
|
16
16
|
},
|
|
17
17
|
variants: {
|
|
18
18
|
size: {
|
package/dist/index.d.ts
CHANGED
|
@@ -152,8 +152,8 @@ export type AlertProps = {
|
|
|
152
152
|
onclose?: () => void;
|
|
153
153
|
};
|
|
154
154
|
export type StatsCardProps = {
|
|
155
|
-
label
|
|
156
|
-
value
|
|
155
|
+
label?: string;
|
|
156
|
+
value?: string | number;
|
|
157
157
|
previousValue?: string | number;
|
|
158
158
|
previousValuePrefix?: string;
|
|
159
159
|
trend?: number;
|
|
@@ -345,28 +345,29 @@ export type ChartColors = {
|
|
|
345
345
|
};
|
|
346
346
|
export type ChartType = 'line' | 'bar' | 'horizontal-bar' | 'pie';
|
|
347
347
|
export type ChartColorString = `#${string}` | keyof ChartColors;
|
|
348
|
-
export
|
|
349
|
-
dataKey: keyof T
|
|
348
|
+
export type XAxisConfig<T> = {
|
|
349
|
+
dataKey: keyof T;
|
|
350
350
|
label?: string;
|
|
351
|
-
unit?: string;
|
|
352
|
-
min?: number;
|
|
353
|
-
max?: number;
|
|
354
|
-
position?: 'left' | 'right';
|
|
355
351
|
format?: (value: any) => string;
|
|
356
|
-
color?: ChartColorString;
|
|
357
|
-
}
|
|
358
|
-
export interface XAxisConfig<T> {
|
|
359
|
-
dataKey: keyof T & string;
|
|
360
|
-
label?: string;
|
|
361
352
|
tick?: {
|
|
362
353
|
fontSize?: number;
|
|
363
354
|
rotate?: number;
|
|
364
|
-
interval?: number | 'auto' |
|
|
355
|
+
interval?: number | 'auto' | Function;
|
|
365
356
|
};
|
|
357
|
+
showAxisLine?: boolean;
|
|
358
|
+
};
|
|
359
|
+
export type YAxisConfig<T> = {
|
|
360
|
+
dataKey: keyof T;
|
|
361
|
+
label?: string;
|
|
366
362
|
format?: (value: any) => string;
|
|
367
|
-
|
|
363
|
+
unit?: string;
|
|
364
|
+
position?: 'left' | 'right';
|
|
365
|
+
min?: number;
|
|
366
|
+
max?: number;
|
|
367
|
+
showAxisLine?: boolean;
|
|
368
|
+
};
|
|
368
369
|
export interface SeriesConfig<T> {
|
|
369
|
-
dataKey: keyof T
|
|
370
|
+
dataKey: keyof T;
|
|
370
371
|
name?: string;
|
|
371
372
|
type?: ChartType;
|
|
372
373
|
color?: ChartColorString;
|
|
@@ -391,40 +392,45 @@ export interface SeriesConfig<T> {
|
|
|
391
392
|
radius?: [string, string];
|
|
392
393
|
centerText?: string;
|
|
393
394
|
}
|
|
394
|
-
export interface
|
|
395
|
+
export interface GridConfig {
|
|
396
|
+
horizontal?: boolean;
|
|
397
|
+
vertical?: boolean;
|
|
398
|
+
containLabel?: boolean;
|
|
399
|
+
top?: number | string;
|
|
400
|
+
right?: number | string;
|
|
401
|
+
bottom?: number | string;
|
|
402
|
+
left?: number | string;
|
|
403
|
+
}
|
|
404
|
+
export interface LegendConfig {
|
|
405
|
+
show?: boolean;
|
|
406
|
+
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
407
|
+
orient?: 'horizontal' | 'vertical';
|
|
408
|
+
}
|
|
409
|
+
export interface TooltipConfig {
|
|
410
|
+
show?: boolean;
|
|
411
|
+
trigger?: 'item' | 'axis' | 'none';
|
|
412
|
+
formatter?: string | ((params: any) => string);
|
|
413
|
+
}
|
|
414
|
+
export interface ToolboxConfig {
|
|
415
|
+
show?: boolean;
|
|
416
|
+
features?: {
|
|
417
|
+
saveAsImage?: boolean;
|
|
418
|
+
dataView?: boolean;
|
|
419
|
+
dataZoom?: boolean;
|
|
420
|
+
magicType?: boolean;
|
|
421
|
+
restore?: boolean;
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
export type ChartConfig<T> = {
|
|
395
425
|
xAxis: XAxisConfig<T>;
|
|
396
426
|
yAxis: YAxisConfig<T>[];
|
|
397
427
|
series: SeriesConfig<T>[];
|
|
398
|
-
grid?:
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
bottom?: number | string;
|
|
405
|
-
left?: number | string;
|
|
406
|
-
};
|
|
407
|
-
legend?: {
|
|
408
|
-
show?: boolean;
|
|
409
|
-
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
410
|
-
orient?: 'horizontal' | 'vertical';
|
|
411
|
-
};
|
|
412
|
-
tooltip?: {
|
|
413
|
-
show?: boolean;
|
|
414
|
-
trigger?: 'item' | 'axis' | 'none';
|
|
415
|
-
formatter?: string | ((params: any) => string);
|
|
416
|
-
};
|
|
417
|
-
toolbox?: {
|
|
418
|
-
show?: boolean;
|
|
419
|
-
features?: {
|
|
420
|
-
saveAsImage?: boolean;
|
|
421
|
-
dataView?: boolean;
|
|
422
|
-
dataZoom?: boolean;
|
|
423
|
-
magicType?: boolean;
|
|
424
|
-
restore?: boolean;
|
|
425
|
-
};
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
+
grid?: GridConfig;
|
|
429
|
+
legend?: LegendConfig;
|
|
430
|
+
tooltip?: TooltipConfig;
|
|
431
|
+
toolbox?: ToolboxConfig;
|
|
432
|
+
showAxisLines?: boolean;
|
|
433
|
+
};
|
|
428
434
|
export interface PointClickType<T> {
|
|
429
435
|
detail: {
|
|
430
436
|
seriesIndex: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn } from '../../helper/cls.js';
|
|
3
|
-
import { statsCard
|
|
3
|
+
import { statsCard } from './stats-card.js';
|
|
4
4
|
import { onMount } from 'svelte';
|
|
5
5
|
import * as echarts from 'echarts/core';
|
|
6
6
|
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// @ts-expect-error - ECharts types are not available
|
|
13
13
|
import { SVGRenderer } from 'echarts/renderers';
|
|
14
14
|
import { Color } from '../../variants.js';
|
|
15
|
+
import type { StatsCardProps } from '../../index.js';
|
|
15
16
|
|
|
16
17
|
// @ts-expect-error - ECharts types are not available
|
|
17
18
|
echarts.use([LineChart, GridComponent, SVGRenderer]);
|
|
@@ -134,7 +135,7 @@
|
|
|
134
135
|
const labelClasses = $derived(cn(labelSlot(), 'text-sm font-medium mb-1'));
|
|
135
136
|
const valueClasses = $derived(cn(valueSlot(), 'text-4xl font-bold'));
|
|
136
137
|
const trendClasses = $derived(cn(trendSlot(), 'text-sm font-medium ml-2'));
|
|
137
|
-
const previousValueClasses = $derived(cn(previousValueSlot(), 'text-sm text-
|
|
138
|
+
const previousValueClasses = $derived(cn(previousValueSlot(), 'text-sm text-default-500 mt-1'));
|
|
138
139
|
|
|
139
140
|
const trendFormatted = $derived.by(() => {
|
|
140
141
|
if (trend === undefined || trend === null) return '';
|
|
@@ -221,7 +222,7 @@
|
|
|
221
222
|
<div
|
|
222
223
|
class={cn(
|
|
223
224
|
base(),
|
|
224
|
-
'@container flex flex-col rounded-lg border border-
|
|
225
|
+
'@container flex flex-col rounded-lg border border-default-200 bg-white p-6 shadow-sm',
|
|
225
226
|
className
|
|
226
227
|
)}
|
|
227
228
|
>
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { VariantColors } from '../../index.js';
|
|
4
1
|
import { Color } from '../../variants.js';
|
|
5
2
|
export declare const statsCard: import("tailwind-variants").TVReturnType<{
|
|
6
3
|
color: {
|
|
@@ -192,15 +189,3 @@ export declare const statsCard: import("tailwind-variants").TVReturnType<{
|
|
|
192
189
|
previousValue: string;
|
|
193
190
|
unit: string;
|
|
194
191
|
}, undefined, unknown, unknown, undefined>>;
|
|
195
|
-
export type StatsCardProps = {
|
|
196
|
-
label?: string;
|
|
197
|
-
value?: string | number;
|
|
198
|
-
previousValue?: string | number;
|
|
199
|
-
previousValuePrefix?: string;
|
|
200
|
-
trend?: number;
|
|
201
|
-
color?: VariantColors;
|
|
202
|
-
chartData?: number[];
|
|
203
|
-
children?: Snippet;
|
|
204
|
-
class?: ClassValue;
|
|
205
|
-
formatLargeNumbers?: boolean;
|
|
206
|
-
};
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
const navGroupClasses = $derived(
|
|
30
30
|
cn(
|
|
31
|
-
`items-center gap-x-3 p-1.5 rounded-md w-full cursor-pointer text-
|
|
31
|
+
`items-center gap-x-3 p-1.5 rounded-md w-full cursor-pointer text-default-400 text-sm/6 text-left font-medium`,
|
|
32
32
|
{
|
|
33
33
|
'font-semibold ': isActive,
|
|
34
34
|
hidden: menubar.collapsed,
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
const navItemClasses = $derived(
|
|
12
12
|
cn([
|
|
13
|
-
'group flex gap-x-3 p-2 rounded-md text-
|
|
14
|
-
{ 'bg-
|
|
13
|
+
'group flex gap-x-3 p-2 rounded-md text-default-400 text-sm/6',
|
|
14
|
+
{ 'bg-default-950 font-semibold': active, 'hover:bg-default-950': !active },
|
|
15
15
|
className
|
|
16
16
|
])
|
|
17
17
|
);
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
const sidebarClasses = $derived(
|
|
55
55
|
clsx(
|
|
56
56
|
`flex min-h-screen max-h-screen overflow-y-auto flex-col gap-y-1 overflow-y-auto
|
|
57
|
-
border-r border-
|
|
57
|
+
border-r border-default-800 bg-default-900 px-3 duration-300 sticky top-0`,
|
|
58
58
|
{
|
|
59
59
|
'w-16': menubar.collapsed,
|
|
60
60
|
'w-16 xl:w-72 shrink-0': !menubar.collapsed
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
<ul role="list" class="flex flex-1 flex-col gap-y-1">
|
|
92
92
|
{#each navigationItems as item, index (index)}
|
|
93
93
|
{#if 'type' in item && item.type === 'horizontal-divider'}
|
|
94
|
-
<li class="my-3 border-t border-
|
|
94
|
+
<li class="my-3 border-t border-default-700"></li>
|
|
95
95
|
{:else if 'children' in item}
|
|
96
96
|
<NavGroup active={item.active}>
|
|
97
97
|
{#snippet labelArea(classes)}
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<NavItem href={child.href} active={child.active}>
|
|
102
102
|
{#if child.Icon}
|
|
103
103
|
{@const Icon = child.Icon}
|
|
104
|
-
<Icon class="size-6 shrink-0 text-
|
|
104
|
+
<Icon class="size-6 shrink-0 text-default-600" />
|
|
105
105
|
{/if}
|
|
106
106
|
<span class="truncate">{child.label}</span>
|
|
107
107
|
</NavItem>
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
{#snippet children(classes)}
|
|
113
113
|
{#if item.Icon}
|
|
114
114
|
{@const Icon = item.Icon}
|
|
115
|
-
<Icon class="size-6 shrink-0 text-
|
|
115
|
+
<Icon class="size-6 shrink-0 text-default-600" />
|
|
116
116
|
{/if}
|
|
117
117
|
<span class={cn(classes)}>{item.label}</span>
|
|
118
118
|
{/snippet}
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
</nav>
|
|
124
124
|
</div>
|
|
125
125
|
|
|
126
|
-
{#snippet ToggleIcon(classes = 'size-6 shrink-0 text-
|
|
126
|
+
{#snippet ToggleIcon(classes = 'size-6 shrink-0 text-default-600')}
|
|
127
127
|
<svg
|
|
128
128
|
xmlns="http://www.w3.org/2000/svg"
|
|
129
129
|
width="0.8em"
|
package/dist/modal/modal.js
CHANGED
|
@@ -5,10 +5,10 @@ export const modal = tv({
|
|
|
5
5
|
backdrop: 'fixed inset-0 transition-opacity bg-black/50',
|
|
6
6
|
contentWrapper: 'absolute transform overflow-hidden transition-all px-2',
|
|
7
7
|
content: 'bg-white overflow-hidden rounded-lg',
|
|
8
|
-
header: 'px-4 py-3 flex items-center justify-between border-b border-
|
|
8
|
+
header: 'px-4 py-3 flex items-center justify-between border-b border-default-200',
|
|
9
9
|
body: 'px-3 py-2 max-h-[70dvh] overflow-y-auto',
|
|
10
10
|
title: 'text-default-900 leading-6 text-base font-semibold',
|
|
11
|
-
closeButton: 'text-
|
|
11
|
+
closeButton: 'text-default-400 hover:text-default-500 rounded-md cursor-pointer'
|
|
12
12
|
},
|
|
13
13
|
variants: {
|
|
14
14
|
open: {
|
|
@@ -65,7 +65,7 @@ export const modal = tv({
|
|
|
65
65
|
content: 'border-0'
|
|
66
66
|
},
|
|
67
67
|
default: {
|
|
68
|
-
content: 'border border-
|
|
68
|
+
content: 'border border-default-200'
|
|
69
69
|
},
|
|
70
70
|
colored: {
|
|
71
71
|
content: 'border'
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type ClassValue } from 'tailwind-variants';
|
|
2
|
-
import type { BreadcrumbItem } from '../index.js';
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
4
|
-
export type PageHeaderProps = {
|
|
5
|
-
title: string;
|
|
6
|
-
breadcrumbs?: BreadcrumbItem[];
|
|
7
|
-
children?: Snippet;
|
|
8
|
-
class?: ClassValue;
|
|
9
|
-
titleclass?: ClassValue;
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {} from 'tailwind-variants';
|