svelte-multistyle-ui 0.0.1-alpha
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/LICENSE +201 -0
- package/README.md +183 -0
- package/dist/actions/portal.d.ts +20 -0
- package/dist/actions/portal.js +32 -0
- package/dist/components/Accordion.svelte +64 -0
- package/dist/components/Accordion.svelte.d.ts +19 -0
- package/dist/components/Alert.svelte +61 -0
- package/dist/components/Alert.svelte.d.ts +23 -0
- package/dist/components/Avatar.svelte +31 -0
- package/dist/components/Avatar.svelte.d.ts +21 -0
- package/dist/components/Breadcrumb.svelte +35 -0
- package/dist/components/Breadcrumb.svelte.d.ts +15 -0
- package/dist/components/Button.svelte +34 -0
- package/dist/components/Button.svelte.d.ts +25 -0
- package/dist/components/ButtonGroup.svelte +45 -0
- package/dist/components/ButtonGroup.svelte.d.ts +23 -0
- package/dist/components/Card.svelte +29 -0
- package/dist/components/Card.svelte.d.ts +21 -0
- package/dist/components/Carousel.svelte +111 -0
- package/dist/components/Carousel.svelte.d.ts +23 -0
- package/dist/components/Checkbox.svelte +64 -0
- package/dist/components/Checkbox.svelte.d.ts +21 -0
- package/dist/components/Chip.svelte +43 -0
- package/dist/components/Chip.svelte.d.ts +27 -0
- package/dist/components/Column.svelte +38 -0
- package/dist/components/Column.svelte.d.ts +21 -0
- package/dist/components/CommandPalette.svelte +207 -0
- package/dist/components/CommandPalette.svelte.d.ts +19 -0
- package/dist/components/DatePicker.svelte +365 -0
- package/dist/components/DatePicker.svelte.d.ts +31 -0
- package/dist/components/Divider.svelte +32 -0
- package/dist/components/Divider.svelte.d.ts +17 -0
- package/dist/components/Drawer.svelte +69 -0
- package/dist/components/Drawer.svelte.d.ts +21 -0
- package/dist/components/DropdownMenu.svelte +113 -0
- package/dist/components/DropdownMenu.svelte.d.ts +25 -0
- package/dist/components/FAB.svelte +27 -0
- package/dist/components/FAB.svelte.d.ts +19 -0
- package/dist/components/FileUpload.svelte +76 -0
- package/dist/components/FileUpload.svelte.d.ts +21 -0
- package/dist/components/Grid.svelte +51 -0
- package/dist/components/Grid.svelte.d.ts +27 -0
- package/dist/components/IconButton.svelte +39 -0
- package/dist/components/IconButton.svelte.d.ts +27 -0
- package/dist/components/Input.svelte +121 -0
- package/dist/components/Input.svelte.d.ts +69 -0
- package/dist/components/Modal.svelte +57 -0
- package/dist/components/Modal.svelte.d.ts +23 -0
- package/dist/components/MultiSelect.svelte +125 -0
- package/dist/components/MultiSelect.svelte.d.ts +23 -0
- package/dist/components/Pagination.svelte +52 -0
- package/dist/components/Pagination.svelte.d.ts +19 -0
- package/dist/components/Popover.svelte +114 -0
- package/dist/components/Popover.svelte.d.ts +23 -0
- package/dist/components/ProgressBar.svelte +72 -0
- package/dist/components/ProgressBar.svelte.d.ts +21 -0
- package/dist/components/Radio.svelte +39 -0
- package/dist/components/Radio.svelte.d.ts +21 -0
- package/dist/components/Rating.svelte +102 -0
- package/dist/components/Rating.svelte.d.ts +25 -0
- package/dist/components/Row.svelte +39 -0
- package/dist/components/Row.svelte.d.ts +23 -0
- package/dist/components/Select.svelte +80 -0
- package/dist/components/Select.svelte.d.ts +23 -0
- package/dist/components/Skeleton.svelte +26 -0
- package/dist/components/Skeleton.svelte.d.ts +19 -0
- package/dist/components/Slider.svelte +46 -0
- package/dist/components/Slider.svelte.d.ts +25 -0
- package/dist/components/Spinner.svelte +27 -0
- package/dist/components/Spinner.svelte.d.ts +15 -0
- package/dist/components/Stepper.svelte +34 -0
- package/dist/components/Stepper.svelte.d.ts +17 -0
- package/dist/components/Table.svelte +59 -0
- package/dist/components/Table.svelte.d.ts +19 -0
- package/dist/components/Tabs.svelte +32 -0
- package/dist/components/Tabs.svelte.d.ts +17 -0
- package/dist/components/Textarea.svelte +86 -0
- package/dist/components/Textarea.svelte.d.ts +31 -0
- package/dist/components/Toast.svelte +90 -0
- package/dist/components/Toast.svelte.d.ts +19 -0
- package/dist/components/Toggle.svelte +46 -0
- package/dist/components/Toggle.svelte.d.ts +21 -0
- package/dist/components/Tooltip.svelte +35 -0
- package/dist/components/Tooltip.svelte.d.ts +19 -0
- package/dist/components/accordion-styles.css +89 -0
- package/dist/components/alert-styles.css +66 -0
- package/dist/components/avatar-styles.css +50 -0
- package/dist/components/breadcrumb-styles.css +73 -0
- package/dist/components/button-styles.css +272 -0
- package/dist/components/buttongroup-styles.css +118 -0
- package/dist/components/card-styles.css +101 -0
- package/dist/components/carousel-styles.css +145 -0
- package/dist/components/charts/BarChart.svelte +5 -0
- package/dist/components/charts/BarChart.svelte.d.ts +29 -0
- package/dist/components/charts/BubbleChart.svelte +5 -0
- package/dist/components/charts/BubbleChart.svelte.d.ts +29 -0
- package/dist/components/charts/Chart.svelte +186 -0
- package/dist/components/charts/Chart.svelte.d.ts +37 -0
- package/dist/components/charts/ComboChart.svelte +5 -0
- package/dist/components/charts/ComboChart.svelte.d.ts +29 -0
- package/dist/components/charts/DoughnutChart.svelte +5 -0
- package/dist/components/charts/DoughnutChart.svelte.d.ts +29 -0
- package/dist/components/charts/LineChart.svelte +5 -0
- package/dist/components/charts/LineChart.svelte.d.ts +29 -0
- package/dist/components/charts/PieChart.svelte +5 -0
- package/dist/components/charts/PieChart.svelte.d.ts +29 -0
- package/dist/components/charts/PolarAreaChart.svelte +5 -0
- package/dist/components/charts/PolarAreaChart.svelte.d.ts +29 -0
- package/dist/components/charts/RadarChart.svelte +5 -0
- package/dist/components/charts/RadarChart.svelte.d.ts +29 -0
- package/dist/components/charts/ScatterChart.svelte +5 -0
- package/dist/components/charts/ScatterChart.svelte.d.ts +29 -0
- package/dist/components/charts/StackedBarChart.svelte +18 -0
- package/dist/components/charts/StackedBarChart.svelte.d.ts +29 -0
- package/dist/components/charts/StackedLineChart.svelte +21 -0
- package/dist/components/charts/StackedLineChart.svelte.d.ts +29 -0
- package/dist/components/charts/chart-config.d.ts +102 -0
- package/dist/components/charts/chart-config.js +616 -0
- package/dist/components/charts/chart-styles.css +159 -0
- package/dist/components/checkbox-styles.css +125 -0
- package/dist/components/chip-styles.css +107 -0
- package/dist/components/column-styles.css +6 -0
- package/dist/components/commandpalette-styles.css +162 -0
- package/dist/components/datepicker-styles.css +1011 -0
- package/dist/components/divider-styles.css +56 -0
- package/dist/components/drawer-styles.css +83 -0
- package/dist/components/dropdown-styles.css +128 -0
- package/dist/components/fab-styles.css +61 -0
- package/dist/components/fileupload-styles.css +125 -0
- package/dist/components/grid-styles.css +6 -0
- package/dist/components/iconbutton-styles.css +146 -0
- package/dist/components/input-styles.css +436 -0
- package/dist/components/modal-styles.css +103 -0
- package/dist/components/multiselect-styles.css +202 -0
- package/dist/components/pagination-styles.css +63 -0
- package/dist/components/popover-styles.css +122 -0
- package/dist/components/progressbar-styles.css +106 -0
- package/dist/components/radio-styles.css +120 -0
- package/dist/components/rating-styles.css +68 -0
- package/dist/components/row-styles.css +6 -0
- package/dist/components/select-styles.css +218 -0
- package/dist/components/skeleton-styles.css +48 -0
- package/dist/components/slider-styles.css +85 -0
- package/dist/components/spinner-styles.css +52 -0
- package/dist/components/stepper-styles.css +93 -0
- package/dist/components/table-styles.css +114 -0
- package/dist/components/tabs-styles.css +74 -0
- package/dist/components/textarea-styles.css +224 -0
- package/dist/components/theme-base.css +64 -0
- package/dist/components/theme.css +440 -0
- package/dist/components/toast-styles.css +106 -0
- package/dist/components/toggle-styles.css +131 -0
- package/dist/components/tooltip-styles.css +56 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +9 -0
- package/dist/config.svelte.d.ts +25 -0
- package/dist/config.svelte.js +41 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +69 -0
- package/package.json +65 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./rating-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
value = $bindable(0),
|
|
9
|
+
max = 5,
|
|
10
|
+
precision = "full",
|
|
11
|
+
size = "md",
|
|
12
|
+
readonly = false,
|
|
13
|
+
showValue = false,
|
|
14
|
+
...rest
|
|
15
|
+
} = $props();
|
|
16
|
+
|
|
17
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
18
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
19
|
+
const styleClass = $derived(`s-rating-${style}`);
|
|
20
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
21
|
+
const stars = $derived(Array.from({ length: max }, (_, i) => i + 1));
|
|
22
|
+
|
|
23
|
+
let isHovering = $state(0);
|
|
24
|
+
|
|
25
|
+
function getFillClass(star) {
|
|
26
|
+
if (isHovering > 0) {
|
|
27
|
+
if (star <= isHovering) return "star-filled";
|
|
28
|
+
if (precision === "half" && isHovering < star && isHovering >= star - 0.5) return "star-half";
|
|
29
|
+
return "star-empty";
|
|
30
|
+
}
|
|
31
|
+
if (star <= value) return "star-filled";
|
|
32
|
+
if (precision === "half" && value < star && value >= star - 0.5) return "star-half";
|
|
33
|
+
return "star-empty";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function updateValue(star, event) {
|
|
37
|
+
if (readonly) return;
|
|
38
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
39
|
+
if (precision === "half") {
|
|
40
|
+
const x = event.clientX - rect.left;
|
|
41
|
+
const half = x < rect.width / 2;
|
|
42
|
+
value = half ? star - 0.5 : star;
|
|
43
|
+
} else {
|
|
44
|
+
value = precision === "quarter"
|
|
45
|
+
? Math.round((star - (1 - (event.clientX - rect.left) / rect.width)) * 4) / 4
|
|
46
|
+
: star;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function handleHover(star, event) {
|
|
51
|
+
if (readonly) return;
|
|
52
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
53
|
+
if (precision === "half") {
|
|
54
|
+
const x = event.clientX - rect.left;
|
|
55
|
+
isHovering = x < rect.width / 2 ? star - 0.5 : star;
|
|
56
|
+
} else {
|
|
57
|
+
isHovering = star;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function leaveHover() {
|
|
62
|
+
if (!readonly) isHovering = 0;
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<div
|
|
67
|
+
class="s-rating {styleClass} {themeClass} rating-{size}"
|
|
68
|
+
role="radiogroup"
|
|
69
|
+
aria-label="Rating"
|
|
70
|
+
{...rest}
|
|
71
|
+
>
|
|
72
|
+
{#each stars as star}
|
|
73
|
+
<span
|
|
74
|
+
class="s-rating-star {getFillClass(star)}"
|
|
75
|
+
class:clickable={!readonly}
|
|
76
|
+
onclick={(e) => updateValue(star, e)}
|
|
77
|
+
onkeydown={(e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); if (!readonly) value = star; } }}
|
|
78
|
+
onmousemove={(e) => handleHover(star, e)}
|
|
79
|
+
onmouseleave={leaveHover}
|
|
80
|
+
role="radio"
|
|
81
|
+
aria-checked={star <= value}
|
|
82
|
+
tabindex={readonly ? -1 : 0}
|
|
83
|
+
>
|
|
84
|
+
{#if getFillClass(star) === "star-half"}
|
|
85
|
+
<!-- Half star: filled left half + empty right half -->
|
|
86
|
+
<svg width="100%" height="100%" viewBox="0 0 24 24" style="clip-path:inset(0 50% 0 0)" fill="currentColor">
|
|
87
|
+
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
|
|
88
|
+
</svg>
|
|
89
|
+
<svg width="100%" height="100%" viewBox="0 0 24 24" style="clip-path:inset(0 0 0 50%);position:absolute;top:0;left:0" fill="color-mix(in srgb, #eab308 30%, transparent 70%)">
|
|
90
|
+
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
|
|
91
|
+
</svg>
|
|
92
|
+
{:else}
|
|
93
|
+
<svg width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor">
|
|
94
|
+
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
|
|
95
|
+
</svg>
|
|
96
|
+
{/if}
|
|
97
|
+
</span>
|
|
98
|
+
{/each}
|
|
99
|
+
{#if showValue}
|
|
100
|
+
<span class="s-rating-value">{value.toFixed(precision === "full" ? 0 : 1)}</span>
|
|
101
|
+
{/if}
|
|
102
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default Rating;
|
|
2
|
+
type Rating = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Rating: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
value?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
precision?: string;
|
|
12
|
+
size?: string;
|
|
13
|
+
readonly?: boolean;
|
|
14
|
+
showValue?: boolean;
|
|
15
|
+
} & Record<string, any>, {}, "value">;
|
|
16
|
+
type $$ComponentProps = {
|
|
17
|
+
style: any;
|
|
18
|
+
theme: any;
|
|
19
|
+
value?: number;
|
|
20
|
+
max?: number;
|
|
21
|
+
precision?: string;
|
|
22
|
+
size?: string;
|
|
23
|
+
readonly?: boolean;
|
|
24
|
+
showValue?: boolean;
|
|
25
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./row-styles.css";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
gap = "8px",
|
|
6
|
+
align = "stretch",
|
|
7
|
+
justify = "start",
|
|
8
|
+
fill = false,
|
|
9
|
+
wrap = false,
|
|
10
|
+
class: className = "",
|
|
11
|
+
children,
|
|
12
|
+
...rest
|
|
13
|
+
} = $props();
|
|
14
|
+
|
|
15
|
+
// align = cross-axis (align-items), justify = main-axis (justify-content)
|
|
16
|
+
const alignItems = {
|
|
17
|
+
start: "flex-start",
|
|
18
|
+
center: "center",
|
|
19
|
+
end: "flex-end",
|
|
20
|
+
stretch: "stretch",
|
|
21
|
+
baseline: "baseline",
|
|
22
|
+
};
|
|
23
|
+
const justifyContent = {
|
|
24
|
+
start: "flex-start",
|
|
25
|
+
center: "center",
|
|
26
|
+
end: "flex-end",
|
|
27
|
+
between: "space-between",
|
|
28
|
+
around: "space-around",
|
|
29
|
+
evenly: "space-evenly",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const styleStr = $derived(
|
|
33
|
+
`display:flex;flex-direction:row;gap:${gap};align-items:${alignItems[align] ?? align};justify-content:${justifyContent[justify] ?? justify};${fill ? "width:100%;" : ""}${wrap ? "flex-wrap:wrap;" : ""}`
|
|
34
|
+
);
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div class="s-row {className}" style={styleStr} {...rest}>
|
|
38
|
+
{@render children?.()}
|
|
39
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default Row;
|
|
2
|
+
type Row = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Row: import("svelte").Component<{
|
|
7
|
+
gap?: string;
|
|
8
|
+
align?: string;
|
|
9
|
+
justify?: string;
|
|
10
|
+
fill?: boolean;
|
|
11
|
+
wrap?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
children: any;
|
|
14
|
+
} & Record<string, any>, {}, "">;
|
|
15
|
+
type $$ComponentProps = {
|
|
16
|
+
gap?: string;
|
|
17
|
+
align?: string;
|
|
18
|
+
justify?: string;
|
|
19
|
+
fill?: boolean;
|
|
20
|
+
wrap?: boolean;
|
|
21
|
+
class?: string;
|
|
22
|
+
children: any;
|
|
23
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./select-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
value = $bindable(""),
|
|
9
|
+
options = [],
|
|
10
|
+
placeholder = "Select...",
|
|
11
|
+
label = "",
|
|
12
|
+
disabled = false,
|
|
13
|
+
...rest
|
|
14
|
+
} = $props();
|
|
15
|
+
|
|
16
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
17
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
18
|
+
|
|
19
|
+
let focused = $state(false);
|
|
20
|
+
let hasValue = $derived(
|
|
21
|
+
value !== "" && value !== null && value !== undefined,
|
|
22
|
+
);
|
|
23
|
+
let floated = $derived(focused || hasValue);
|
|
24
|
+
|
|
25
|
+
const styleClass = $derived(`s-select-${style}`);
|
|
26
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
27
|
+
const uid = Math.random().toString(36).slice(2, 9);
|
|
28
|
+
const internalId = `select-${uid}`;
|
|
29
|
+
|
|
30
|
+
const floatingStyles = [
|
|
31
|
+
"material",
|
|
32
|
+
"material3",
|
|
33
|
+
"fluent",
|
|
34
|
+
"carbon",
|
|
35
|
+
"bootstrap",
|
|
36
|
+
"legacy-ios",
|
|
37
|
+
];
|
|
38
|
+
const hasFloatingLabel = $derived(
|
|
39
|
+
floatingStyles.includes(style) && (label || placeholder),
|
|
40
|
+
);
|
|
41
|
+
const displayLabel = $derived(label || placeholder);
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<div
|
|
45
|
+
class="s-select-wrapper {styleClass} {themeClass}"
|
|
46
|
+
class:disabled
|
|
47
|
+
class:focused
|
|
48
|
+
class:has-value={hasValue}
|
|
49
|
+
class:floated
|
|
50
|
+
>
|
|
51
|
+
{#if hasFloatingLabel}
|
|
52
|
+
<label class="s-select-floating-label" for={internalId}>{displayLabel}</label>
|
|
53
|
+
{/if}
|
|
54
|
+
<select
|
|
55
|
+
bind:value
|
|
56
|
+
{disabled}
|
|
57
|
+
id={internalId}
|
|
58
|
+
onfocus={() => (focused = true)}
|
|
59
|
+
onblur={() => (focused = false)}
|
|
60
|
+
{...rest}
|
|
61
|
+
>
|
|
62
|
+
{#if placeholder && !hasFloatingLabel}
|
|
63
|
+
<option value="" disabled selected>{placeholder}</option>
|
|
64
|
+
{/if}
|
|
65
|
+
{#each options as opt}
|
|
66
|
+
<option value={opt.value}>{opt.label}</option>
|
|
67
|
+
{/each}
|
|
68
|
+
</select>
|
|
69
|
+
<span class="s-select-arrow">
|
|
70
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
71
|
+
<path
|
|
72
|
+
d="M2.5 4.5L6 8L9.5 4.5"
|
|
73
|
+
stroke="#64748b"
|
|
74
|
+
stroke-width="1.5"
|
|
75
|
+
stroke-linecap="round"
|
|
76
|
+
stroke-linejoin="round"
|
|
77
|
+
/>
|
|
78
|
+
</svg>
|
|
79
|
+
</span>
|
|
80
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default Select;
|
|
2
|
+
type Select = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Select: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
value?: string;
|
|
10
|
+
options?: any[];
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
} & Record<string, any>, {}, "value">;
|
|
15
|
+
type $$ComponentProps = {
|
|
16
|
+
style: any;
|
|
17
|
+
theme: any;
|
|
18
|
+
value?: string;
|
|
19
|
+
options?: any[];
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
label?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./skeleton-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
variant = "text",
|
|
9
|
+
width = "100%",
|
|
10
|
+
height = "",
|
|
11
|
+
...rest
|
|
12
|
+
} = $props();
|
|
13
|
+
|
|
14
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
15
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
16
|
+
|
|
17
|
+
const styleClass = $derived(`s-skeleton-${style}`);
|
|
18
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
class="s-skeleton {styleClass} {themeClass} skeleton-{variant}"
|
|
23
|
+
style="width: {width}; {height ? `height: ${height}` : ''}"
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
{...rest}
|
|
26
|
+
></div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default Skeleton;
|
|
2
|
+
type Skeleton = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Skeleton: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
variant?: string;
|
|
10
|
+
width?: string;
|
|
11
|
+
height?: string;
|
|
12
|
+
} & Record<string, any>, {}, "">;
|
|
13
|
+
type $$ComponentProps = {
|
|
14
|
+
style: any;
|
|
15
|
+
theme: any;
|
|
16
|
+
variant?: string;
|
|
17
|
+
width?: string;
|
|
18
|
+
height?: string;
|
|
19
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./slider-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
value = $bindable(0),
|
|
9
|
+
min = 0,
|
|
10
|
+
max = 100,
|
|
11
|
+
step = 1,
|
|
12
|
+
disabled = false,
|
|
13
|
+
label = "",
|
|
14
|
+
...rest
|
|
15
|
+
} = $props();
|
|
16
|
+
|
|
17
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
18
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
19
|
+
|
|
20
|
+
const styleClass = $derived(`s-slider-${style}`);
|
|
21
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
22
|
+
const percent = $derived(((value - min) / (max - min)) * 100);
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div
|
|
26
|
+
class="s-slider-wrapper {styleClass} {themeClass}"
|
|
27
|
+
class:disabled
|
|
28
|
+
{...rest}
|
|
29
|
+
>
|
|
30
|
+
{#if label}
|
|
31
|
+
<label class="s-slider-label" for={`slider-${Math.random().toString(36).slice(2, 9)}`}>{label}: {value}</label>
|
|
32
|
+
{/if}
|
|
33
|
+
<div class="s-slider-track-wrapper">
|
|
34
|
+
<input
|
|
35
|
+
id={`slider-${Math.random().toString(36).slice(2, 9)}`}
|
|
36
|
+
type="range"
|
|
37
|
+
class="s-slider"
|
|
38
|
+
bind:value
|
|
39
|
+
{min}
|
|
40
|
+
{max}
|
|
41
|
+
{step}
|
|
42
|
+
{disabled}
|
|
43
|
+
style="--percent: {percent}%"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default Slider;
|
|
2
|
+
type Slider = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Slider: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
value?: number;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
step?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
label?: string;
|
|
15
|
+
} & Record<string, any>, {}, "value">;
|
|
16
|
+
type $$ComponentProps = {
|
|
17
|
+
style: any;
|
|
18
|
+
theme: any;
|
|
19
|
+
value?: number;
|
|
20
|
+
min?: number;
|
|
21
|
+
max?: number;
|
|
22
|
+
step?: number;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
label?: string;
|
|
25
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./spinner-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
size = "md",
|
|
9
|
+
...rest
|
|
10
|
+
} = $props();
|
|
11
|
+
|
|
12
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
13
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
14
|
+
|
|
15
|
+
const styleClass = $derived(`s-spinner-${style}`);
|
|
16
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
17
|
+
const sizeClass = $derived(`spinner-${size}`);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
class="s-spinner {styleClass} {themeClass} {sizeClass}"
|
|
22
|
+
role="status"
|
|
23
|
+
aria-label="Loading"
|
|
24
|
+
{...rest}
|
|
25
|
+
>
|
|
26
|
+
<div class="s-spinner-circle"></div>
|
|
27
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default Spinner;
|
|
2
|
+
type Spinner = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Spinner: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
size?: string;
|
|
10
|
+
} & Record<string, any>, {}, "">;
|
|
11
|
+
type $$ComponentProps = {
|
|
12
|
+
style: any;
|
|
13
|
+
theme: any;
|
|
14
|
+
size?: string;
|
|
15
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./stepper-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
steps = [],
|
|
9
|
+
current = 0,
|
|
10
|
+
...rest
|
|
11
|
+
} = $props();
|
|
12
|
+
|
|
13
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
14
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
15
|
+
|
|
16
|
+
const styleClass = $derived(`s-stepper-${style}`);
|
|
17
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div class="s-stepper {styleClass} {themeClass}" {...rest}>
|
|
21
|
+
{#each steps as step, i}
|
|
22
|
+
<div
|
|
23
|
+
class="s-stepper-step"
|
|
24
|
+
class:completed={i < current}
|
|
25
|
+
class:active={i === current}
|
|
26
|
+
>
|
|
27
|
+
<div class="s-stepper-circle">{i + 1}</div>
|
|
28
|
+
<span class="s-stepper-label">{step.label}</span>
|
|
29
|
+
</div>
|
|
30
|
+
{#if i < steps.length - 1}
|
|
31
|
+
<div class="s-stepper-connector" class:completed={i < current - 1}></div>
|
|
32
|
+
{/if}
|
|
33
|
+
{/each}
|
|
34
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default Stepper;
|
|
2
|
+
type Stepper = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Stepper: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
steps?: any[];
|
|
10
|
+
current?: number;
|
|
11
|
+
} & Record<string, any>, {}, "">;
|
|
12
|
+
type $$ComponentProps = {
|
|
13
|
+
style: any;
|
|
14
|
+
theme: any;
|
|
15
|
+
steps?: any[];
|
|
16
|
+
current?: number;
|
|
17
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./table-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
data = null,
|
|
9
|
+
variant = "plain",
|
|
10
|
+
caption: summary,
|
|
11
|
+
...rest
|
|
12
|
+
} = $props();
|
|
13
|
+
|
|
14
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
15
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
16
|
+
|
|
17
|
+
const styleClass = $derived(`s-table-${style}`);
|
|
18
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
19
|
+
const variantClass = $derived(`s-table-variant-${variant}`);
|
|
20
|
+
|
|
21
|
+
// Derive column headers from the keys of the first data row
|
|
22
|
+
const columns = $derived(
|
|
23
|
+
data && data.length > 0
|
|
24
|
+
? Object.keys(data[0]).map((key) => ({
|
|
25
|
+
key,
|
|
26
|
+
label: key
|
|
27
|
+
}))
|
|
28
|
+
: []
|
|
29
|
+
);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<div
|
|
33
|
+
class="s-table-wrapper {styleClass} {themeClass} {variantClass}"
|
|
34
|
+
{...rest}
|
|
35
|
+
>
|
|
36
|
+
<div class="s-table-scroll">
|
|
37
|
+
<table class="s-table">
|
|
38
|
+
{#if summary}
|
|
39
|
+
<caption class="s-table-caption">{summary}</caption>
|
|
40
|
+
{/if}
|
|
41
|
+
<thead>
|
|
42
|
+
<tr>
|
|
43
|
+
{#each columns as col}
|
|
44
|
+
<th>{col.label}</th>
|
|
45
|
+
{/each}
|
|
46
|
+
</tr>
|
|
47
|
+
</thead>
|
|
48
|
+
<tbody>
|
|
49
|
+
{#each data ?? [] as row}
|
|
50
|
+
<tr>
|
|
51
|
+
{#each columns as col}
|
|
52
|
+
<td>{row[col.key] ?? ""}</td>
|
|
53
|
+
{/each}
|
|
54
|
+
</tr>
|
|
55
|
+
{/each}
|
|
56
|
+
</tbody>
|
|
57
|
+
</table>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default Table;
|
|
2
|
+
type Table = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Table: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
data?: any;
|
|
10
|
+
variant?: string;
|
|
11
|
+
caption: any;
|
|
12
|
+
} & Record<string, any>, {}, "">;
|
|
13
|
+
type $$ComponentProps = {
|
|
14
|
+
style: any;
|
|
15
|
+
theme: any;
|
|
16
|
+
data?: any;
|
|
17
|
+
variant?: string;
|
|
18
|
+
caption: any;
|
|
19
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./tabs-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
tabs = [],
|
|
9
|
+
active = $bindable(""),
|
|
10
|
+
...rest
|
|
11
|
+
} = $props();
|
|
12
|
+
|
|
13
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
14
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
15
|
+
|
|
16
|
+
const styleClass = $derived(`s-tabs-${style}`);
|
|
17
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div class="s-tabs {styleClass} {themeClass}" role="tablist" {...rest}>
|
|
21
|
+
{#each tabs as tab}
|
|
22
|
+
<button
|
|
23
|
+
class="s-tab"
|
|
24
|
+
class:active={active === tab.id}
|
|
25
|
+
role="tab"
|
|
26
|
+
aria-selected={active === tab.id}
|
|
27
|
+
onclick={() => (active = tab.id)}
|
|
28
|
+
>
|
|
29
|
+
{tab.label}
|
|
30
|
+
</button>
|
|
31
|
+
{/each}
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default Tabs;
|
|
2
|
+
type Tabs = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Tabs: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
tabs?: any[];
|
|
10
|
+
active?: string;
|
|
11
|
+
} & Record<string, any>, {}, "active">;
|
|
12
|
+
type $$ComponentProps = {
|
|
13
|
+
style: any;
|
|
14
|
+
theme: any;
|
|
15
|
+
tabs?: any[];
|
|
16
|
+
active?: string;
|
|
17
|
+
} & Record<string, any>;
|