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,69 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./drawer-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
import { fade } from "svelte/transition";
|
|
5
|
+
import { portal } from "../actions/portal.js";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
style: styleProp,
|
|
9
|
+
theme: themeProp,
|
|
10
|
+
position = "left",
|
|
11
|
+
open = $bindable(false),
|
|
12
|
+
children,
|
|
13
|
+
onclose,
|
|
14
|
+
...rest
|
|
15
|
+
} = $props();
|
|
16
|
+
|
|
17
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
18
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
19
|
+
const styleClass = $derived(`s-drawer-${style}`);
|
|
20
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
21
|
+
|
|
22
|
+
function handleClose() {
|
|
23
|
+
open = false;
|
|
24
|
+
onclose?.();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function handleBackdrop(e) {
|
|
28
|
+
if (e.target === e.currentTarget) handleClose();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Custom slide transition per position
|
|
32
|
+
function slideTransition(node) {
|
|
33
|
+
const rect = node.getBoundingClientRect();
|
|
34
|
+
let x = 0, y = 0;
|
|
35
|
+
|
|
36
|
+
switch (position) {
|
|
37
|
+
case "left": x = -rect.width; break;
|
|
38
|
+
case "right": x = rect.width; break;
|
|
39
|
+
case "top": y = -rect.height; break;
|
|
40
|
+
case "bottom": y = rect.height; break;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
duration: 300,
|
|
45
|
+
easing: (t) => 1 - Math.pow(1 - t, 3),
|
|
46
|
+
css: (t, u) => `transform: translate(${x * u}px, ${y * u}px); opacity: ${1 - u * 0.3};`
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
{#if open}
|
|
52
|
+
<div
|
|
53
|
+
use:portal
|
|
54
|
+
class="s-drawer-overlay"
|
|
55
|
+
transition:fade={{ duration: 200 }}
|
|
56
|
+
onclick={handleBackdrop}
|
|
57
|
+
role="presentation"
|
|
58
|
+
{...rest}
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
class="s-drawer {styleClass} {themeClass} drawer-{position}"
|
|
62
|
+
transition:slideTransition
|
|
63
|
+
role="dialog"
|
|
64
|
+
aria-modal="true"
|
|
65
|
+
>
|
|
66
|
+
{@render children?.()}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
{/if}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default Drawer;
|
|
2
|
+
type Drawer = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Drawer: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
position?: string;
|
|
10
|
+
open?: boolean;
|
|
11
|
+
children: any;
|
|
12
|
+
onclose: any;
|
|
13
|
+
} & Record<string, any>, {}, "open">;
|
|
14
|
+
type $$ComponentProps = {
|
|
15
|
+
style: any;
|
|
16
|
+
theme: any;
|
|
17
|
+
position?: string;
|
|
18
|
+
open?: boolean;
|
|
19
|
+
children: any;
|
|
20
|
+
onclose: any;
|
|
21
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./dropdown-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
import { fly } from "svelte/transition";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
style: styleProp,
|
|
8
|
+
theme: themeProp,
|
|
9
|
+
variant = "filled",
|
|
10
|
+
color = "primary",
|
|
11
|
+
children,
|
|
12
|
+
items = [],
|
|
13
|
+
position = "bottom",
|
|
14
|
+
align = "left",
|
|
15
|
+
...rest
|
|
16
|
+
} = $props();
|
|
17
|
+
|
|
18
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
19
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
20
|
+
const styleClass = $derived(`s-dropdown-${style}`);
|
|
21
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
22
|
+
const variantClass = $derived(`dropdown-${color}`);
|
|
23
|
+
|
|
24
|
+
let open = $state(false);
|
|
25
|
+
let menuEl = $state(null);
|
|
26
|
+
let triggerEl = $state(null);
|
|
27
|
+
|
|
28
|
+
function toggle() {
|
|
29
|
+
open = !open;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function close() {
|
|
33
|
+
open = false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function handleItemClick(item) {
|
|
37
|
+
item.onclick?.();
|
|
38
|
+
close();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Click outside to close
|
|
42
|
+
$effect(() => {
|
|
43
|
+
if (!open) return;
|
|
44
|
+
const handler = (e) => {
|
|
45
|
+
if (menuEl && !menuEl.contains(e.target) && triggerEl && !triggerEl.contains(e.target)) {
|
|
46
|
+
close();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
// Escape key
|
|
50
|
+
const keyHandler = (e) => {
|
|
51
|
+
if (e.key === "Escape") close();
|
|
52
|
+
};
|
|
53
|
+
document.addEventListener("pointerdown", handler);
|
|
54
|
+
document.addEventListener("keydown", keyHandler);
|
|
55
|
+
return () => {
|
|
56
|
+
document.removeEventListener("pointerdown", handler);
|
|
57
|
+
document.removeEventListener("keydown", keyHandler);
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<div
|
|
63
|
+
class="s-dropdown {styleClass} {themeClass} dropdown-{align}"
|
|
64
|
+
class:open
|
|
65
|
+
{...rest}
|
|
66
|
+
>
|
|
67
|
+
<div
|
|
68
|
+
bind:this={triggerEl}
|
|
69
|
+
class="s-dropdown-trigger {variantClass}"
|
|
70
|
+
onclick={toggle}
|
|
71
|
+
role="button"
|
|
72
|
+
tabindex="0"
|
|
73
|
+
aria-expanded={open}
|
|
74
|
+
onkeydown={(e) => { if (e.key === "Enter" || e.key === " ") toggle(); }}
|
|
75
|
+
>
|
|
76
|
+
{@render children?.()}
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
{#if open}
|
|
80
|
+
<div
|
|
81
|
+
bind:this={menuEl}
|
|
82
|
+
class="s-dropdown-menu dropdown-{position}"
|
|
83
|
+
transition:fly={{
|
|
84
|
+
y: position === "bottom" ? -8 : 8,
|
|
85
|
+
duration: 150,
|
|
86
|
+
opacity: 0
|
|
87
|
+
}}
|
|
88
|
+
role="menu"
|
|
89
|
+
>
|
|
90
|
+
{#each items as item}
|
|
91
|
+
{#if item.divider}
|
|
92
|
+
<div class="s-dropdown-divider"></div>
|
|
93
|
+
{:else}
|
|
94
|
+
<button
|
|
95
|
+
class="s-dropdown-item"
|
|
96
|
+
class:active={item.active}
|
|
97
|
+
disabled={item.disabled}
|
|
98
|
+
onclick={() => handleItemClick(item)}
|
|
99
|
+
role="menuitem"
|
|
100
|
+
>
|
|
101
|
+
{#if item.icon}
|
|
102
|
+
<span class="s-dropdown-item-icon">{item.icon}</span>
|
|
103
|
+
{/if}
|
|
104
|
+
<span class="s-dropdown-item-label">{item.label}</span>
|
|
105
|
+
{#if item.shortcut}
|
|
106
|
+
<span class="s-dropdown-item-shortcut">{item.shortcut}</span>
|
|
107
|
+
{/if}
|
|
108
|
+
</button>
|
|
109
|
+
{/if}
|
|
110
|
+
{/each}
|
|
111
|
+
</div>
|
|
112
|
+
{/if}
|
|
113
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default DropdownMenu;
|
|
2
|
+
type DropdownMenu = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const DropdownMenu: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
variant?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
children: any;
|
|
12
|
+
items?: any[];
|
|
13
|
+
position?: string;
|
|
14
|
+
align?: string;
|
|
15
|
+
} & Record<string, any>, {}, "">;
|
|
16
|
+
type $$ComponentProps = {
|
|
17
|
+
style: any;
|
|
18
|
+
theme: any;
|
|
19
|
+
variant?: string;
|
|
20
|
+
color?: string;
|
|
21
|
+
children: any;
|
|
22
|
+
items?: any[];
|
|
23
|
+
position?: string;
|
|
24
|
+
align?: string;
|
|
25
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./fab-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
children,
|
|
9
|
+
position = "bottom-right",
|
|
10
|
+
onclick,
|
|
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-fab-${style}`);
|
|
18
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<button
|
|
22
|
+
class="s-fab {styleClass} {themeClass} fab-{position}"
|
|
23
|
+
{onclick}
|
|
24
|
+
{...rest}
|
|
25
|
+
>
|
|
26
|
+
{@render children?.()}
|
|
27
|
+
</button>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default FAB;
|
|
2
|
+
type FAB = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const FAB: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
children: any;
|
|
10
|
+
position?: string;
|
|
11
|
+
onclick: any;
|
|
12
|
+
} & Record<string, any>, {}, "">;
|
|
13
|
+
type $$ComponentProps = {
|
|
14
|
+
style: any;
|
|
15
|
+
theme: any;
|
|
16
|
+
children: any;
|
|
17
|
+
position?: string;
|
|
18
|
+
onclick: any;
|
|
19
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./fileupload-styles.css";
|
|
3
|
+
import { defaults } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
accept = "",
|
|
9
|
+
multiple = false,
|
|
10
|
+
disabled = false,
|
|
11
|
+
label = "Drop files or click to upload",
|
|
12
|
+
...rest
|
|
13
|
+
} = $props();
|
|
14
|
+
|
|
15
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
16
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
17
|
+
|
|
18
|
+
const styleClass = $derived(`s-fileupload-${style}`);
|
|
19
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
20
|
+
|
|
21
|
+
let files = $state([]);
|
|
22
|
+
let dragging = $state(false);
|
|
23
|
+
|
|
24
|
+
function handleChange(e) {
|
|
25
|
+
files = Array.from(e.target.files);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function handleDrop(e) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
dragging = false;
|
|
31
|
+
files = Array.from(e.dataTransfer.files);
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div
|
|
36
|
+
class="s-fileupload {styleClass} {themeClass}"
|
|
37
|
+
class:dragging
|
|
38
|
+
class:disabled
|
|
39
|
+
ondragover={(e) => {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
dragging = true;
|
|
42
|
+
}}
|
|
43
|
+
ondragleave={() => (dragging = false)}
|
|
44
|
+
ondrop={handleDrop}
|
|
45
|
+
{...rest}
|
|
46
|
+
>
|
|
47
|
+
<input
|
|
48
|
+
type="file"
|
|
49
|
+
{accept}
|
|
50
|
+
{multiple}
|
|
51
|
+
{disabled}
|
|
52
|
+
onchange={handleChange}
|
|
53
|
+
class="s-fileupload-input"
|
|
54
|
+
/>
|
|
55
|
+
<div class="s-fileupload-content">
|
|
56
|
+
<svg
|
|
57
|
+
class="s-fileupload-icon"
|
|
58
|
+
width="32"
|
|
59
|
+
height="32"
|
|
60
|
+
viewBox="0 0 24 24"
|
|
61
|
+
fill="none"
|
|
62
|
+
stroke="#64748b"
|
|
63
|
+
stroke-width="2"
|
|
64
|
+
>
|
|
65
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><polyline
|
|
66
|
+
points="17 8 12 3 7 8"
|
|
67
|
+
/><line x1="12" y1="3" x2="12" y2="15" />
|
|
68
|
+
</svg>
|
|
69
|
+
<span class="s-fileupload-label">{label}</span>
|
|
70
|
+
{#if files.length}
|
|
71
|
+
<span class="s-fileupload-hint"
|
|
72
|
+
>{files.length} file{files.length > 1 ? "s" : ""} selected</span
|
|
73
|
+
>
|
|
74
|
+
{/if}
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default FileUpload;
|
|
2
|
+
type FileUpload = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const FileUpload: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
accept?: string;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
label?: string;
|
|
13
|
+
} & Record<string, any>, {}, "">;
|
|
14
|
+
type $$ComponentProps = {
|
|
15
|
+
style: any;
|
|
16
|
+
theme: any;
|
|
17
|
+
accept?: string;
|
|
18
|
+
multiple?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
label?: string;
|
|
21
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./grid-styles.css";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
columns = 1,
|
|
6
|
+
gap = "8px",
|
|
7
|
+
rows = undefined,
|
|
8
|
+
fill = false,
|
|
9
|
+
align = "stretch",
|
|
10
|
+
justify = "start",
|
|
11
|
+
minColumnWidth = undefined,
|
|
12
|
+
class: className = "",
|
|
13
|
+
children,
|
|
14
|
+
...rest
|
|
15
|
+
} = $props();
|
|
16
|
+
|
|
17
|
+
// columns: number → repeat(n, 1fr); "auto"/"auto-fill" + minColumnWidth →
|
|
18
|
+
// responsive auto-fill grid; any other string used verbatim.
|
|
19
|
+
const alignItems = {
|
|
20
|
+
start: "flex-start",
|
|
21
|
+
center: "center",
|
|
22
|
+
end: "flex-end",
|
|
23
|
+
stretch: "stretch",
|
|
24
|
+
baseline: "baseline",
|
|
25
|
+
};
|
|
26
|
+
const justifyItems = {
|
|
27
|
+
start: "start",
|
|
28
|
+
center: "center",
|
|
29
|
+
end: "end",
|
|
30
|
+
stretch: "stretch",
|
|
31
|
+
between: "space-between",
|
|
32
|
+
around: "space-around",
|
|
33
|
+
evenly: "space-evenly",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const templateColumns = $derived(
|
|
37
|
+
minColumnWidth && (columns === "auto" || columns === "auto-fill")
|
|
38
|
+
? `repeat(auto-fill, minmax(${minColumnWidth}, 1fr))`
|
|
39
|
+
: typeof columns === "number"
|
|
40
|
+
? `repeat(${columns}, 1fr)`
|
|
41
|
+
: columns
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const styleStr = $derived(
|
|
45
|
+
`display:grid;grid-template-columns:${templateColumns};${rows ? `grid-template-rows:${rows};` : ""}gap:${gap};align-items:${alignItems[align] ?? align};justify-items:${justifyItems[justify] ?? justify};${fill ? "width:100%;" : ""}`
|
|
46
|
+
);
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<div class="s-grid {className}" style={styleStr} {...rest}>
|
|
50
|
+
{@render children?.()}
|
|
51
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Grid;
|
|
2
|
+
type Grid = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Grid: import("svelte").Component<{
|
|
7
|
+
columns?: number;
|
|
8
|
+
gap?: string;
|
|
9
|
+
rows?: any;
|
|
10
|
+
fill?: boolean;
|
|
11
|
+
align?: string;
|
|
12
|
+
justify?: string;
|
|
13
|
+
minColumnWidth?: any;
|
|
14
|
+
class?: string;
|
|
15
|
+
children: any;
|
|
16
|
+
} & Record<string, any>, {}, "">;
|
|
17
|
+
type $$ComponentProps = {
|
|
18
|
+
columns?: number;
|
|
19
|
+
gap?: string;
|
|
20
|
+
rows?: any;
|
|
21
|
+
fill?: boolean;
|
|
22
|
+
align?: string;
|
|
23
|
+
justify?: string;
|
|
24
|
+
minColumnWidth?: any;
|
|
25
|
+
class?: string;
|
|
26
|
+
children: any;
|
|
27
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./iconbutton-styles.css";
|
|
3
|
+
import { defaults, iconClass } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
variant = "filled",
|
|
9
|
+
size = "md",
|
|
10
|
+
disabled = false,
|
|
11
|
+
icon,
|
|
12
|
+
children,
|
|
13
|
+
onclick,
|
|
14
|
+
ariaLabel = "",
|
|
15
|
+
...rest
|
|
16
|
+
} = $props();
|
|
17
|
+
|
|
18
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
19
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
20
|
+
|
|
21
|
+
const styleClass = $derived(`s-iconbtn-${style}`);
|
|
22
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
23
|
+
const variantClass = $derived(`ibtn-${variant}`);
|
|
24
|
+
const sizeClass = $derived(`ibtn-${size}`);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<button
|
|
28
|
+
class="s-iconbtn {styleClass} {themeClass} {variantClass} {sizeClass}"
|
|
29
|
+
{disabled}
|
|
30
|
+
{onclick}
|
|
31
|
+
aria-label={ariaLabel}
|
|
32
|
+
{...rest}
|
|
33
|
+
>
|
|
34
|
+
{#if icon}
|
|
35
|
+
<span class="{iconClass}">{icon}</span>
|
|
36
|
+
{:else}
|
|
37
|
+
{@render children?.()}
|
|
38
|
+
{/if}
|
|
39
|
+
</button>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default IconButton;
|
|
2
|
+
type IconButton = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const IconButton: import("svelte").Component<{
|
|
7
|
+
style: any;
|
|
8
|
+
theme: any;
|
|
9
|
+
variant?: string;
|
|
10
|
+
size?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
icon: any;
|
|
13
|
+
children: any;
|
|
14
|
+
onclick: any;
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
} & Record<string, any>, {}, "">;
|
|
17
|
+
type $$ComponentProps = {
|
|
18
|
+
style: any;
|
|
19
|
+
theme: any;
|
|
20
|
+
variant?: string;
|
|
21
|
+
size?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
icon: any;
|
|
24
|
+
children: any;
|
|
25
|
+
onclick: any;
|
|
26
|
+
ariaLabel?: string;
|
|
27
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "./input-styles.css";
|
|
3
|
+
import { defaults, iconClass } from "../config.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
style: styleProp,
|
|
7
|
+
theme: themeProp,
|
|
8
|
+
type = "text",
|
|
9
|
+
value = $bindable(""),
|
|
10
|
+
placeholder = "",
|
|
11
|
+
label = "",
|
|
12
|
+
disabled = false,
|
|
13
|
+
iconStart = undefined,
|
|
14
|
+
iconEnd = undefined,
|
|
15
|
+
readonly = false,
|
|
16
|
+
required = false,
|
|
17
|
+
name = "",
|
|
18
|
+
id = "",
|
|
19
|
+
min = undefined,
|
|
20
|
+
max = undefined,
|
|
21
|
+
minlength = undefined,
|
|
22
|
+
maxlength = undefined,
|
|
23
|
+
step = undefined,
|
|
24
|
+
pattern = undefined,
|
|
25
|
+
autocomplete = undefined,
|
|
26
|
+
autofocus = false,
|
|
27
|
+
multiple = false,
|
|
28
|
+
accept = undefined,
|
|
29
|
+
list = undefined,
|
|
30
|
+
size = undefined,
|
|
31
|
+
tabindex = undefined,
|
|
32
|
+
title = undefined,
|
|
33
|
+
form = undefined,
|
|
34
|
+
inputmode = undefined,
|
|
35
|
+
spellcheck = undefined,
|
|
36
|
+
...rest
|
|
37
|
+
} = $props();
|
|
38
|
+
|
|
39
|
+
const style = $derived(styleProp ?? defaults.style);
|
|
40
|
+
const theme = $derived(themeProp ?? defaults.theme);
|
|
41
|
+
|
|
42
|
+
let focused = $state(false);
|
|
43
|
+
let hasValue = $derived(
|
|
44
|
+
value !== "" && value !== null && value !== undefined,
|
|
45
|
+
);
|
|
46
|
+
let floated = $derived(focused || hasValue);
|
|
47
|
+
|
|
48
|
+
const hasIconStart = $derived(!!iconStart);
|
|
49
|
+
const hasIconEnd = $derived(!!iconEnd);
|
|
50
|
+
|
|
51
|
+
const styleClass = $derived(`s-input-${style}`);
|
|
52
|
+
const themeClass = $derived(`theme-${theme}`);
|
|
53
|
+
const uid = Math.random().toString(36).slice(2, 9);
|
|
54
|
+
const internalId = $derived(id || `input-${uid}`);
|
|
55
|
+
|
|
56
|
+
const floatingStyles = [
|
|
57
|
+
"material",
|
|
58
|
+
"material3",
|
|
59
|
+
"fluent",
|
|
60
|
+
"carbon",
|
|
61
|
+
"bootstrap",
|
|
62
|
+
"legacy-ios",
|
|
63
|
+
];
|
|
64
|
+
const hasFloatingLabel = $derived(
|
|
65
|
+
floatingStyles.includes(style) && (label || placeholder),
|
|
66
|
+
);
|
|
67
|
+
const displayLabel = $derived(label || placeholder);
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<div
|
|
71
|
+
class="s-input-wrapper {styleClass} {themeClass}"
|
|
72
|
+
class:disabled
|
|
73
|
+
class:focused
|
|
74
|
+
class:has-value={hasValue}
|
|
75
|
+
class:floated
|
|
76
|
+
class:has-icon-start={hasIconStart}
|
|
77
|
+
class:has-icon-end={hasIconEnd}
|
|
78
|
+
>
|
|
79
|
+
{#if iconStart}
|
|
80
|
+
<span class="s-input-icon s-input-icon-start {iconClass}">{iconStart}</span>
|
|
81
|
+
{/if}
|
|
82
|
+
{#if hasFloatingLabel}
|
|
83
|
+
<label class="s-input-floating-label" for={internalId}>{displayLabel}</label>
|
|
84
|
+
{/if}
|
|
85
|
+
<input
|
|
86
|
+
{type}
|
|
87
|
+
bind:value
|
|
88
|
+
placeholder={hasFloatingLabel ? "" : placeholder}
|
|
89
|
+
{disabled}
|
|
90
|
+
{readonly}
|
|
91
|
+
{required}
|
|
92
|
+
{name}
|
|
93
|
+
id={internalId}
|
|
94
|
+
{min}
|
|
95
|
+
{max}
|
|
96
|
+
{minlength}
|
|
97
|
+
{maxlength}
|
|
98
|
+
{step}
|
|
99
|
+
{pattern}
|
|
100
|
+
{autocomplete}
|
|
101
|
+
{autofocus}
|
|
102
|
+
{multiple}
|
|
103
|
+
{accept}
|
|
104
|
+
{list}
|
|
105
|
+
{size}
|
|
106
|
+
{tabindex}
|
|
107
|
+
{title}
|
|
108
|
+
{form}
|
|
109
|
+
{inputmode}
|
|
110
|
+
{spellcheck}
|
|
111
|
+
onfocus={() => (focused = true)}
|
|
112
|
+
onblur={() => (focused = false)}
|
|
113
|
+
{...rest}
|
|
114
|
+
/>
|
|
115
|
+
{#if iconEnd}
|
|
116
|
+
<span class="s-input-icon s-input-icon-end {iconClass}">{iconEnd}</span>
|
|
117
|
+
{/if}
|
|
118
|
+
{#if style === "fluent"}
|
|
119
|
+
<span class="s-input-fluent-border-indicator"></span>
|
|
120
|
+
{/if}
|
|
121
|
+
</div>
|