@skeletonlabs/skeleton 0.99.5 → 0.132.4
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 -2
- package/actions/Filters/filter.js +6 -9
- package/components/Accordion/Accordion.svelte +34 -0
- package/components/Accordion/Accordion.svelte.d.ts +41 -0
- package/components/Accordion/AccordionItem.svelte +84 -39
- package/components/Accordion/AccordionItem.svelte.d.ts +24 -7
- package/components/AppBar/AppBar.svelte +36 -21
- package/components/AppBar/AppBar.svelte.d.ts +20 -1
- package/components/AppRail/AppRail.svelte +3 -2
- package/components/AppRail/AppRail.svelte.d.ts +13 -1
- package/components/AppRail/AppRailTile.svelte +10 -7
- package/components/AppRail/AppRailTile.svelte.d.ts +10 -4
- package/components/AppShell/AppShell.svelte +3 -2
- package/components/AppShell/AppShell.svelte.d.ts +11 -0
- package/components/Avatar/Avatar.svelte +9 -9
- package/components/Avatar/Avatar.svelte.d.ts +16 -5
- package/components/ConicGradient/ConicGradient.svelte +18 -8
- package/components/ConicGradient/ConicGradient.svelte.d.ts +11 -0
- package/components/ConicGradient/settings.d.ts +1 -5
- package/components/ConicGradient/settings.js +1 -2
- package/components/FileButton/FileButton.svelte +8 -6
- package/components/FileButton/FileButton.svelte.d.ts +3 -1
- package/components/FileDropzone/FileDropzone.svelte +43 -63
- package/components/FileDropzone/FileDropzone.svelte.d.ts +24 -8
- package/components/InputChip/InputChip.svelte +97 -52
- package/components/InputChip/InputChip.svelte.d.ts +28 -4
- package/components/ListBox/ListBox.svelte +13 -29
- package/components/ListBox/ListBox.svelte.d.ts +11 -10
- package/components/ListBox/ListBoxItem.svelte +60 -50
- package/components/ListBox/ListBoxItem.svelte.d.ts +12 -7
- package/components/Paginator/Paginator.svelte +4 -4
- package/components/Paginator/Paginator.svelte.d.ts +13 -2
- package/components/ProgressBar/ProgressBar.svelte +17 -24
- package/components/ProgressBar/ProgressBar.svelte.d.ts +9 -1
- package/components/ProgressRadial/ProgressRadial.svelte +6 -8
- package/components/ProgressRadial/ProgressRadial.svelte.d.ts +9 -2
- package/components/Radio/RadioGroup.svelte +13 -16
- package/components/Radio/RadioGroup.svelte.d.ts +15 -7
- package/components/Radio/RadioItem.svelte +25 -21
- package/components/Radio/RadioItem.svelte.d.ts +12 -7
- package/components/RangeSlider/RangeSlider.svelte +9 -17
- package/components/RangeSlider/RangeSlider.svelte.d.ts +11 -2
- package/components/SlideToggle/SlideToggle.svelte +10 -9
- package/components/SlideToggle/SlideToggle.svelte.d.ts +11 -3
- package/components/Stepper/Step.svelte +64 -107
- package/components/Stepper/Step.svelte.d.ts +17 -18
- package/components/Stepper/Stepper.svelte +58 -37
- package/components/Stepper/Stepper.svelte.d.ts +28 -14
- package/components/Tab/Tab.svelte +40 -38
- package/components/Tab/Tab.svelte.d.ts +20 -14
- package/components/Tab/TabGroup.svelte +28 -41
- package/components/Tab/TabGroup.svelte.d.ts +25 -9
- package/components/Table/Table.svelte.d.ts +9 -0
- package/components/TableOfContents/TableOfContents.svelte +3 -2
- package/components/TableOfContents/TableOfContents.svelte.d.ts +12 -0
- package/index.d.ts +5 -4
- package/index.js +10 -4
- package/package.json +24 -16
- package/styles/all.css +0 -3
- package/styles/elements/breadcrumbs.css +3 -4
- package/styles/elements/buttons.css +2 -4
- package/styles/elements/forms.css +265 -0
- package/styles/elements/lists.css +1 -1
- package/styles/elements/modals.css +15 -0
- package/styles/elements/popups.css +16 -0
- package/styles/elements.css +3 -2
- package/styles/typography.css +5 -5
- package/styles/variants.css +7 -7
- package/tailwind/core.cjs +1 -1
- package/tailwind/generated/intellisense-classes.cjs +1 -1
- package/tailwind/generated/intellisense-classes.d.cts +318 -404
- package/tailwind/intellisense.cjs +2 -2
- package/tailwind/skeleton.cjs +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/tailwind.d.ts +4 -0
- package/types/tailwind.js +2 -0
- package/utilities/CodeBlock/CodeBlock.svelte +14 -8
- package/utilities/CodeBlock/CodeBlock.svelte.d.ts +17 -1
- package/utilities/Drawer/Drawer.svelte +50 -37
- package/utilities/Drawer/Drawer.svelte.d.ts +20 -1
- package/utilities/Drawer/types.d.ts +8 -2
- package/utilities/LightSwitch/LightSwitch.svelte +43 -53
- package/utilities/LightSwitch/LightSwitch.svelte.d.ts +18 -2
- package/utilities/LightSwitch/lightswitch.d.ts +20 -0
- package/utilities/LightSwitch/lightswitch.js +71 -0
- package/utilities/LocalStorageStore/LocalStorageStore.js +1 -1
- package/utilities/Modal/Modal.svelte +96 -64
- package/utilities/Modal/Modal.svelte.d.ts +29 -0
- package/utilities/Modal/types.d.ts +9 -5
- package/utilities/Popup/popup.d.ts +7 -0
- package/utilities/Popup/popup.js +218 -0
- package/utilities/Popup/types.d.ts +32 -0
- package/utilities/Popup/types.js +3 -0
- package/utilities/Toast/Toast.svelte +17 -13
- package/utilities/Toast/Toast.svelte.d.ts +14 -0
- package/utilities/Toast/stores.js +9 -26
- package/utilities/Toast/types.d.ts +6 -1
- package/components/Accordion/AccordionGroup.svelte +0 -33
- package/components/Accordion/AccordionGroup.svelte.d.ts +0 -24
- package/components/SvgIcon/SvgIcon.svelte +0 -33
- package/components/SvgIcon/SvgIcon.svelte.d.ts +0 -26
- package/components/SvgIcon/icons.d.ts +0 -1
- package/components/SvgIcon/icons.js +0 -25
- package/styles/elements/menus.css +0 -29
- package/styles/elements/tooltips.css +0 -83
- package/styles/forms.css +0 -195
- package/utilities/LightSwitch/stores.d.ts +0 -2
- package/utilities/LightSwitch/stores.js +0 -5
- package/utilities/Menu/menu.d.ts +0 -18
- package/utilities/Menu/menu.js +0 -151
- package/utilities/Modal/examples/ModalExampleEmbed.svelte +0 -17
- package/utilities/Modal/examples/ModalExampleEmbed.svelte.d.ts +0 -17
- package/utilities/Modal/examples/ModalExampleForm.svelte +0 -41
- package/utilities/Modal/examples/ModalExampleForm.svelte.d.ts +0 -17
- package/utilities/Modal/examples/ModalExampleImage.svelte +0 -19
- package/utilities/Modal/examples/ModalExampleImage.svelte.d.ts +0 -16
- package/utilities/Modal/examples/ModalExampleList.svelte +0 -27
- package/utilities/Modal/examples/ModalExampleList.svelte.d.ts +0 -17
- package/utilities/Tooltip/tooltip.d.ts +0 -35
- package/utilities/Tooltip/tooltip.js +0 -94
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { type Writable } from 'svelte/store';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
/** Enable selection of multiple items.*/
|
|
6
|
+
multiple?: boolean | undefined;
|
|
7
|
+
/** Provide classs to set the vertical spacing style.*/
|
|
8
|
+
spacing?: string | undefined;
|
|
9
|
+
/** Provide classes to set the listbox box radius styles.*/
|
|
11
10
|
rounded?: string | undefined;
|
|
11
|
+
/** Provide classes to set the listbox item active background styles.*/
|
|
12
|
+
active?: string | undefined;
|
|
13
|
+
/** Provide classes to set the listbox item hover background styles.*/
|
|
12
14
|
hover?: string | undefined;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
labelId?: string | undefined;
|
|
15
|
+
/** Provide classes to set the listbox item padding styles.*/
|
|
16
|
+
padding?: string | undefined;
|
|
17
|
+
labelledby?: string | undefined;
|
|
17
18
|
};
|
|
18
19
|
events: {
|
|
19
20
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,72 +1,82 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
export let
|
|
3
|
-
|
|
4
|
-
export let
|
|
5
|
-
export let
|
|
6
|
-
export let padding = getContext("padding");
|
|
1
|
+
<script>import { getContext } from "svelte";
|
|
2
|
+
export let group;
|
|
3
|
+
export let name;
|
|
4
|
+
export let value;
|
|
5
|
+
export let multiple = getContext("multiple");
|
|
7
6
|
export let rounded = getContext("rounded");
|
|
7
|
+
export let active = getContext("active");
|
|
8
8
|
export let hover = getContext("hover");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
export let padding = getContext("padding");
|
|
10
|
+
const cBase = "px-4 py-2 cursor-pointer";
|
|
11
|
+
const cLabel = "flex space-x-4";
|
|
12
|
+
let checked;
|
|
13
|
+
let elemInput;
|
|
14
|
+
$:
|
|
15
|
+
if (multiple)
|
|
16
|
+
updateCheckbox(group);
|
|
17
|
+
$:
|
|
18
|
+
if (multiple)
|
|
19
|
+
updateGroup(checked);
|
|
20
|
+
function updateCheckbox(group2) {
|
|
21
|
+
checked = group2.indexOf(value) >= 0;
|
|
19
22
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
function updateGroup(checked2) {
|
|
24
|
+
const index = group.indexOf(value);
|
|
25
|
+
if (checked2) {
|
|
26
|
+
if (index < 0) {
|
|
27
|
+
group.push(value);
|
|
28
|
+
group = group;
|
|
29
|
+
}
|
|
26
30
|
} else {
|
|
27
|
-
|
|
31
|
+
if (index >= 0) {
|
|
32
|
+
group.splice(index, 1);
|
|
33
|
+
group = group;
|
|
34
|
+
}
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
37
|
function onKeyDown(event) {
|
|
31
|
-
dispatch("keydown", event);
|
|
32
38
|
if (["Enter", "Space"].includes(event.code)) {
|
|
33
39
|
event.preventDefault();
|
|
34
|
-
|
|
40
|
+
elemInput.click();
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
43
|
$:
|
|
38
|
-
|
|
39
|
-
if ($selected && $$props.value) {
|
|
40
|
-
return typeof $selected === "object" ? $selected.includes($$props.value) : $selected === $$props.value;
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
};
|
|
44
|
+
selected = multiple ? group.includes(value) : group === value;
|
|
44
45
|
$:
|
|
45
|
-
|
|
46
|
+
classesActive = selected ? active : hover;
|
|
46
47
|
$:
|
|
47
|
-
|
|
48
|
+
classesBase = `${cBase} ${rounded} ${padding} ${classesActive} ${$$props.class ?? ""}`;
|
|
48
49
|
$:
|
|
49
|
-
|
|
50
|
+
classesLabel = `${cLabel}`;
|
|
50
51
|
</script>
|
|
51
52
|
|
|
52
|
-
<!--
|
|
53
|
-
<
|
|
54
|
-
bind:this={elemItem}
|
|
53
|
+
<!-- WARNING: avoid click handlers on <label>; will fire twice -->
|
|
54
|
+
<label
|
|
55
55
|
class="listbox-item {classesBase}"
|
|
56
|
-
{id}
|
|
57
|
-
on:click={onClickHandler}
|
|
58
|
-
on:keydown={onKeyDown}
|
|
59
|
-
on:keyup
|
|
60
|
-
on:keypress
|
|
61
56
|
role="option"
|
|
62
|
-
aria-selected={
|
|
57
|
+
aria-selected={selected}
|
|
63
58
|
tabindex="0"
|
|
64
59
|
data-testid="listbox-item"
|
|
60
|
+
on:keydown={onKeyDown}
|
|
61
|
+
on:keydown
|
|
62
|
+
on:keyup
|
|
63
|
+
on:keypress
|
|
65
64
|
>
|
|
66
|
-
<!--
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
<!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
|
|
66
|
+
<div class="h-0 w-0 overflow-hidden">
|
|
67
|
+
{#if multiple}
|
|
68
|
+
<input bind:this={elemInput} type="checkbox" {name} {value} bind:checked tabindex="-1" on:click on:change />
|
|
69
|
+
{:else}
|
|
70
|
+
<input bind:this={elemInput} type="radio" bind:group {name} {value} tabindex="-1" on:click on:change />
|
|
71
|
+
{/if}
|
|
72
|
+
</div>
|
|
73
|
+
<!-- <slot /> -->
|
|
74
|
+
<div class="listbox-label {classesLabel}">
|
|
75
|
+
<!-- Slot: Lead -->
|
|
76
|
+
{#if $$slots.lead}<div class="listbox-label-lead"><slot name="lead" /></div>{/if}
|
|
77
|
+
<!-- Slot: Default -->
|
|
78
|
+
<div class="listbox-label-content flex-1"><slot /></div>
|
|
79
|
+
<!-- Slot: Trail -->
|
|
80
|
+
{#if $$slots.trail}<div class="listbox-label-trail"><slot name="trail" /></div>{/if}
|
|
81
|
+
</div>
|
|
82
|
+
</label>
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { Writable } from 'svelte/store';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
/** Set the radio group binding value.*/
|
|
6
|
+
group: any;
|
|
7
|
+
/** Set a unique name value for the input.*/
|
|
8
|
+
name: string;
|
|
9
|
+
/** Set the input's value.*/
|
|
10
|
+
value: any;
|
|
11
|
+
multiple?: string | undefined;
|
|
10
12
|
rounded?: string | undefined;
|
|
13
|
+
active?: string | undefined;
|
|
11
14
|
hover?: string | undefined;
|
|
15
|
+
padding?: string | undefined;
|
|
12
16
|
};
|
|
13
17
|
events: {
|
|
18
|
+
keydown: KeyboardEvent;
|
|
14
19
|
keyup: KeyboardEvent;
|
|
15
20
|
keypress: KeyboardEvent;
|
|
16
|
-
click:
|
|
17
|
-
|
|
21
|
+
click: MouseEvent;
|
|
22
|
+
change: Event;
|
|
18
23
|
} & {
|
|
19
24
|
[evt: string]: CustomEvent<any>;
|
|
20
25
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
2
|
const dispatch = createEventDispatcher();
|
|
3
3
|
export let settings = { offset: 0, limit: 5, size: 0, amounts: [1, 2, 5, 10] };
|
|
4
|
+
export let disabled = false;
|
|
5
|
+
export let select = "select min-w-[150px]";
|
|
4
6
|
export let justify = "justify-between";
|
|
5
7
|
export let text = "text-xs";
|
|
6
|
-
export let select = void 0;
|
|
7
|
-
export let disabled = false;
|
|
8
8
|
export let amountText = "Items";
|
|
9
9
|
export let buttonClasses = "btn-icon variant-filled";
|
|
10
10
|
export let buttonTextPrevious = "←";
|
|
@@ -48,10 +48,10 @@ $:
|
|
|
48
48
|
</span>
|
|
49
49
|
<!-- Arrows -->
|
|
50
50
|
<div class="paginator-arrows space-x-2">
|
|
51
|
-
<button class="{buttonClasses}" on:click={() => { onPrev() }} disabled={disabled || settings.offset === 0}>
|
|
51
|
+
<button type="button" class="{buttonClasses}" on:click={() => { onPrev() }} disabled={disabled || settings.offset === 0}>
|
|
52
52
|
{@html buttonTextPrevious}
|
|
53
53
|
</button>
|
|
54
|
-
<button class="{buttonClasses}" on:click={() => { onNext() }} disabled={disabled || (settings.offset + 1) * settings.limit >= settings.size}>
|
|
54
|
+
<button type="button" class="{buttonClasses}" on:click={() => { onNext() }} disabled={disabled || (settings.offset + 1) * settings.limit >= settings.size}>
|
|
55
55
|
{@html buttonTextNext}
|
|
56
56
|
</button>
|
|
57
57
|
</div>
|
|
@@ -3,18 +3,29 @@ import type { PaginationSettings } from './types';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
|
+
/** Pass the page setting object.*/
|
|
6
7
|
settings?: PaginationSettings | undefined;
|
|
8
|
+
/** Sets selection and buttons to disabled state on-demand.*/
|
|
9
|
+
disabled?: boolean | undefined;
|
|
10
|
+
/** Provide classes to style the select input.*/
|
|
11
|
+
select?: string | undefined;
|
|
12
|
+
/** Provide classes to set flexbox justification.*/
|
|
7
13
|
justify?: string | undefined;
|
|
14
|
+
/** Provide classes to style page info text.*/
|
|
8
15
|
text?: string | undefined;
|
|
9
|
-
|
|
10
|
-
disabled?: boolean | undefined;
|
|
16
|
+
/** Set the text for the amount selection input.*/
|
|
11
17
|
amountText?: string | undefined;
|
|
18
|
+
/** Provide abtitrary classes to the next/previous buttons.*/
|
|
12
19
|
buttonClasses?: string | undefined;
|
|
20
|
+
/** Set the text label for the Previous button.*/
|
|
13
21
|
buttonTextPrevious?: string | undefined;
|
|
22
|
+
/** Set the text label for the Next button.*/
|
|
14
23
|
buttonTextNext?: string | undefined;
|
|
15
24
|
};
|
|
16
25
|
events: {
|
|
26
|
+
/** {{ length: number }} amount - Fires when the amount selection input changes.*/
|
|
17
27
|
amount: CustomEvent<any>;
|
|
28
|
+
/** {{ offset: number }} page Fires when the next/back buttons are pressed.*/
|
|
18
29
|
page: CustomEvent<any>;
|
|
19
30
|
} & {
|
|
20
31
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,44 +1,37 @@
|
|
|
1
|
-
<script>export let
|
|
2
|
-
export let value = void 0;
|
|
1
|
+
<script>export let value = void 0;
|
|
3
2
|
export let min = 0;
|
|
4
3
|
export let max = 100;
|
|
5
4
|
export let height = "h-2";
|
|
6
5
|
export let rounded = "rounded-token";
|
|
7
|
-
export let meter = "bg-
|
|
8
|
-
export let track = "
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const cBaseMeterDeterminate = "h-full";
|
|
13
|
-
const cBaseMeterIndeterminate = "h-full w-full";
|
|
6
|
+
export let meter = "bg-surface-900-50-token";
|
|
7
|
+
export let track = "variant-glass";
|
|
8
|
+
export let labelledby = "";
|
|
9
|
+
const cTrack = "w-full overflow-hidden";
|
|
10
|
+
const cMeter = "h-full";
|
|
14
11
|
$:
|
|
15
12
|
fillPercent = value ? 100 * (value - min) / (max - min) : 0;
|
|
16
13
|
$:
|
|
17
|
-
|
|
14
|
+
indeterminate = value === void 0 || value < 0;
|
|
18
15
|
$:
|
|
19
|
-
|
|
16
|
+
classesIndterminate = indeterminate ? "animIndeterminate" : "";
|
|
17
|
+
$:
|
|
18
|
+
classesTrack = `${cTrack} ${height} ${rounded} ${track} ${$$props.class ?? ""}`;
|
|
19
|
+
$:
|
|
20
|
+
classesMeter = `${cMeter} ${rounded} ${classesIndterminate} ${meter}`;
|
|
20
21
|
</script>
|
|
21
22
|
|
|
23
|
+
<!-- Track -->
|
|
22
24
|
<div
|
|
23
|
-
class="progress-bar {
|
|
25
|
+
class="progress-bar {classesTrack}"
|
|
24
26
|
data-testid="progress-bar"
|
|
25
27
|
role="progressbar"
|
|
26
|
-
aria-
|
|
28
|
+
aria-labelledby={labelledby}
|
|
27
29
|
aria-valuenow={value}
|
|
28
30
|
aria-valuemin={min}
|
|
29
31
|
aria-valuemax={max - min}
|
|
30
32
|
>
|
|
31
|
-
<!--
|
|
32
|
-
|
|
33
|
-
<!-- Track -->
|
|
34
|
-
<div class="progress-bar-track {classesTrack}">
|
|
35
|
-
<!-- Meter - Determinate / Indeterminate -->
|
|
36
|
-
{#if value !== undefined && value >= 0}
|
|
37
|
-
<div class="progress-bar-meter {cBaseMeterDeterminate} {classesMeter}" style:width="{fillPercent}%" />
|
|
38
|
-
{:else}
|
|
39
|
-
<div class="progress-bar-meter {cBaseMeterIndeterminate} {classesMeter} animIndeterminate" />
|
|
40
|
-
{/if}
|
|
41
|
-
</div>
|
|
33
|
+
<!-- Meter -->
|
|
34
|
+
<div class="progress-bar-meter {classesMeter} {classesMeter}" style:width="{indeterminate ? 100 : fillPercent}%" />
|
|
42
35
|
</div>
|
|
43
36
|
|
|
44
37
|
<style>
|
|
@@ -2,14 +2,22 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
|
|
5
|
+
/** Specifies the amount completed. Indeterminate when `undefined`.*/
|
|
6
6
|
value?: number | undefined;
|
|
7
|
+
/** Minimum amount the bar represents.*/
|
|
7
8
|
min?: number | undefined;
|
|
9
|
+
/** Maximum amount the bar represents.*/
|
|
8
10
|
max?: number | undefined;
|
|
11
|
+
/** Provide classes to set track height.*/
|
|
9
12
|
height?: string | undefined;
|
|
13
|
+
/** Provide classes to set rounded styles.*/
|
|
10
14
|
rounded?: string | undefined;
|
|
15
|
+
/** Provide arbitrary classes to style the meter element.*/
|
|
11
16
|
meter?: string | undefined;
|
|
17
|
+
/** Provide arbitrary classes to style the track element.*/
|
|
12
18
|
track?: string | undefined;
|
|
19
|
+
/** Provide the ARIA labelledby value.*/
|
|
20
|
+
labelledby?: string | undefined;
|
|
13
21
|
};
|
|
14
22
|
events: {
|
|
15
23
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<!-- https://css-tricks.com/building-progress-ring-quickly/ -->
|
|
1
|
+
<!-- Reference: https://css-tricks.com/building-progress-ring-quickly/ -->
|
|
2
2
|
<script>import { afterUpdate } from "svelte";
|
|
3
3
|
export let value = void 0;
|
|
4
4
|
export let stroke = 20;
|
|
5
|
-
export let meter = "stroke-secondary-500";
|
|
6
|
-
export let track = "stroke-surface-200 dark:stroke-surface-700";
|
|
7
|
-
export let fill = "fill-token";
|
|
8
5
|
export let font = 56;
|
|
9
|
-
export let
|
|
6
|
+
export let meter = "stroke-surface-900 dark:stroke-surface-50";
|
|
7
|
+
export let track = "stroke-surface-500/30";
|
|
8
|
+
export let fill = "fill-token";
|
|
9
|
+
export let labelledby = "";
|
|
10
10
|
const cBase = "progress-radial relative overflow-hidden";
|
|
11
11
|
const cBaseTrack = "fill-transparent";
|
|
12
12
|
const cBaseMeter = "fill-transparent transition-[stroke-dashoffset] duration-200 -rotate-90 origin-[50%_50%]";
|
|
@@ -26,13 +26,11 @@ $:
|
|
|
26
26
|
classesBase = `${cBase} ${$$props.class ?? ""}`;
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
|
-
<!-- https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor -->
|
|
30
|
-
|
|
31
29
|
<figure
|
|
32
30
|
class="progress-radial {classesBase}"
|
|
33
31
|
data-testid="progress-radial"
|
|
34
32
|
role="meter"
|
|
35
|
-
aria-
|
|
33
|
+
aria-labelledby={labelledby}
|
|
36
34
|
aria-valuenow={value || 0}
|
|
37
35
|
aria-valuetext={value ? `${value}%` : 'Indeterminate Spinner'}
|
|
38
36
|
aria-valuemin={0}
|
|
@@ -2,13 +2,20 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
+
/** Set the meter fill amount. Shows as indeterminate when set `undefined`.*/
|
|
5
6
|
value?: number | undefined;
|
|
7
|
+
/** Sets the base stroke width. Scales responsively.*/
|
|
6
8
|
stroke?: number | undefined;
|
|
9
|
+
/** Sets the base font size. Scales responsively.*/
|
|
10
|
+
font?: number | undefined;
|
|
11
|
+
/** Provide classes to set meter color.*/
|
|
7
12
|
meter?: string | undefined;
|
|
13
|
+
/** Provide classes to set track color.*/
|
|
8
14
|
track?: string | undefined;
|
|
15
|
+
/** Provide classes to set the SVG text fill color.*/
|
|
9
16
|
fill?: string | undefined;
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
/** Provide the ARIA labelledby value.*/
|
|
18
|
+
labelledby?: string | undefined;
|
|
12
19
|
};
|
|
13
20
|
events: {
|
|
14
21
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { setContext } from "svelte";
|
|
3
|
-
export let selected = writable(void 0);
|
|
1
|
+
<script>import { setContext } from "svelte";
|
|
4
2
|
export let display = "inline-flex";
|
|
5
3
|
export let background = "bg-surface-200-700-token";
|
|
6
|
-
export let
|
|
7
|
-
export let
|
|
4
|
+
export let border = "border-token border-surface-400-500-token";
|
|
5
|
+
export let spacing = "space-x-1";
|
|
6
|
+
export let rounded = "rounded-token";
|
|
8
7
|
export let padding = "px-4 py-1";
|
|
9
|
-
export let
|
|
10
|
-
export let
|
|
11
|
-
export let color = "
|
|
8
|
+
export let active = "variant-filled";
|
|
9
|
+
export let hover = "hover:variant-soft";
|
|
10
|
+
export let color = "";
|
|
12
11
|
export let fill = "";
|
|
13
|
-
export let
|
|
14
|
-
|
|
15
|
-
setContext("selected", selected);
|
|
12
|
+
export let labelledby = "";
|
|
13
|
+
setContext("rounded", rounded);
|
|
16
14
|
setContext("padding", padding);
|
|
15
|
+
setContext("active", active);
|
|
17
16
|
setContext("hover", hover);
|
|
18
|
-
setContext("accent", accent);
|
|
19
17
|
setContext("color", color);
|
|
20
18
|
setContext("fill", fill);
|
|
21
|
-
|
|
22
|
-
let cBaseGroup = `items-center p-1 overflow-hidden space-x-1 rounded-token`;
|
|
19
|
+
const cBase = "p-1";
|
|
23
20
|
$:
|
|
24
|
-
|
|
21
|
+
classesBase = `${cBase} ${display} ${background} ${border} ${spacing} ${rounded} ${$$props.class ?? ""}`;
|
|
25
22
|
</script>
|
|
26
23
|
|
|
27
|
-
<div class="radio-group {
|
|
24
|
+
<div class="radio-group {classesBase}" data-testid="radio-group" role="radiogroup" aria-labelledby={labelledby}>
|
|
28
25
|
<slot />
|
|
29
26
|
</div>
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { type Writable } from 'svelte/store';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
6
|
-
|
|
5
|
+
/** Provide display classes. Set `flex` to stretch full width.*/
|
|
7
6
|
display?: string | undefined;
|
|
7
|
+
/** Provide classes to set the base background color.*/
|
|
8
8
|
background?: string | undefined;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/** Provide classes to set the border styles.*/
|
|
10
|
+
border?: string | undefined;
|
|
11
|
+
/** Provide classes horizontal spacing between items.*/
|
|
12
|
+
spacing?: string | undefined;
|
|
13
|
+
/** Provide classes to set the border radius.*/
|
|
14
|
+
rounded?: string | undefined;
|
|
15
|
+
/** Provide classes to set the RadioItem padding.*/
|
|
11
16
|
padding?: string | undefined;
|
|
17
|
+
/** Provide classes to set the active item color.*/
|
|
18
|
+
active?: string | undefined;
|
|
19
|
+
/** Provide classes to set the hover style.*/
|
|
12
20
|
hover?: string | undefined;
|
|
13
|
-
|
|
21
|
+
/** Provide classes to set the highlighted text color.*/
|
|
14
22
|
color?: string | undefined;
|
|
23
|
+
/** Provide classes to set the highlighted SVG fill color.*/
|
|
15
24
|
fill?: string | undefined;
|
|
16
|
-
|
|
17
|
-
label?: string | undefined;
|
|
25
|
+
labelledby?: string | undefined;
|
|
18
26
|
};
|
|
19
27
|
events: {
|
|
20
28
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,49 +1,53 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
|
|
3
|
-
export let
|
|
1
|
+
<script>import { getContext } from "svelte";
|
|
2
|
+
export let group;
|
|
3
|
+
export let name;
|
|
4
|
+
export let value;
|
|
4
5
|
export let label = "";
|
|
5
|
-
export let
|
|
6
|
+
export let rounded = getContext("rounded");
|
|
6
7
|
export let padding = getContext("padding");
|
|
8
|
+
export let active = getContext("active");
|
|
7
9
|
export let hover = getContext("hover");
|
|
8
|
-
export let accent = getContext("accent");
|
|
9
10
|
export let color = getContext("color");
|
|
10
11
|
export let fill = getContext("fill");
|
|
11
|
-
|
|
12
|
-
const
|
|
12
|
+
const cBase = "flex-auto text-base text-center cursor-pointer";
|
|
13
|
+
const cDisabled = "opacity-50 cursor-not-allowed";
|
|
14
|
+
let elemInput;
|
|
13
15
|
function onKeyDown(event) {
|
|
14
16
|
if (["Enter", "Space"].includes(event.code)) {
|
|
15
17
|
event.preventDefault();
|
|
16
|
-
|
|
17
|
-
event.target.children[0].click();
|
|
18
|
+
elemInput.click();
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
$:
|
|
21
|
-
checked = value ===
|
|
22
|
+
checked = value === group;
|
|
23
|
+
$:
|
|
24
|
+
classesActive = checked ? `${active} ${color} ${fill}` : hover;
|
|
22
25
|
$:
|
|
23
|
-
|
|
26
|
+
classesDisabled = $$props.disabled ? cDisabled : "";
|
|
24
27
|
$:
|
|
25
|
-
|
|
28
|
+
classesBase = `${cBase} ${padding} ${rounded} ${classesActive} ${classesDisabled}`;
|
|
26
29
|
function prunedRestProps() {
|
|
27
30
|
delete $$restProps.class;
|
|
28
31
|
return $$restProps;
|
|
29
32
|
}
|
|
30
33
|
</script>
|
|
31
34
|
|
|
32
|
-
<
|
|
33
|
-
|
|
35
|
+
<!-- WARNING: avoid click handlers on <label>; will fire twice -->
|
|
36
|
+
<label
|
|
37
|
+
class="radio-item {classesBase}"
|
|
34
38
|
role="radio"
|
|
35
39
|
aria-checked={checked}
|
|
36
40
|
aria-label={label}
|
|
37
|
-
{...prunedRestProps()}
|
|
38
41
|
tabindex="0"
|
|
39
42
|
data-testid="radio-item"
|
|
40
|
-
on:click
|
|
41
43
|
on:keydown={onKeyDown}
|
|
44
|
+
on:keydown
|
|
42
45
|
on:keyup
|
|
43
46
|
on:keypress
|
|
44
47
|
>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
</
|
|
49
|
-
|
|
48
|
+
<!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
|
|
49
|
+
<div class="h-0 w-0 overflow-hidden">
|
|
50
|
+
<input bind:this={elemInput} type="radio" bind:group {name} {value} {...prunedRestProps()} tabindex="-1" on:click on:change />
|
|
51
|
+
</div>
|
|
52
|
+
<slot />
|
|
53
|
+
</label>
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { Writable } from 'svelte/store';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
6
|
-
value
|
|
5
|
+
/** Set the radio group binding value.*/
|
|
6
|
+
group: any;
|
|
7
|
+
/** Set a unique name value for the input.*/
|
|
8
|
+
name: string;
|
|
9
|
+
/** Set the input's value.*/
|
|
10
|
+
value: any;
|
|
11
|
+
/** Defines a semantic ARIA label.*/
|
|
7
12
|
label?: string | undefined;
|
|
8
|
-
|
|
13
|
+
rounded?: string | undefined;
|
|
9
14
|
padding?: string | undefined;
|
|
15
|
+
active?: string | undefined;
|
|
10
16
|
hover?: string | undefined;
|
|
11
|
-
accent?: string | undefined;
|
|
12
17
|
color?: string | undefined;
|
|
13
18
|
fill?: string | undefined;
|
|
14
|
-
rounded?: string | undefined;
|
|
15
19
|
};
|
|
16
20
|
events: {
|
|
17
|
-
|
|
21
|
+
keydown: KeyboardEvent;
|
|
18
22
|
keyup: KeyboardEvent;
|
|
19
23
|
keypress: KeyboardEvent;
|
|
20
|
-
|
|
24
|
+
click: MouseEvent;
|
|
25
|
+
change: Event;
|
|
21
26
|
} & {
|
|
22
27
|
[evt: string]: CustomEvent<any>;
|
|
23
28
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script>import { afterUpdate } from "svelte";
|
|
2
|
+
export let name;
|
|
3
|
+
export let id = String(Math.random());
|
|
2
4
|
export let value = 0;
|
|
3
5
|
export let min = 0;
|
|
4
6
|
export let max = 100;
|
|
5
7
|
export let step = 1;
|
|
6
8
|
export let ticked = false;
|
|
7
9
|
export let accent = "accent-secondary-500";
|
|
8
|
-
export let id = crypto.randomUUID();
|
|
9
|
-
export let name = id;
|
|
10
10
|
export let label = "";
|
|
11
11
|
const cBase = "space-y-2";
|
|
12
12
|
const cBaseLabel = "";
|
|
@@ -31,18 +31,12 @@ function prunedRestProps() {
|
|
|
31
31
|
}
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class="range-slider {classesBase}"
|
|
37
|
-
data-testid="range-slider"
|
|
38
|
-
>
|
|
39
|
-
|
|
40
|
-
<!-- Slot: Default (label) -->
|
|
34
|
+
<div class="range-slider {classesBase}" data-testid="range-slider">
|
|
35
|
+
<!-- Slot: Default -->
|
|
41
36
|
{#if $$slots.default}<label class="range-slider-label {cBaseLabel}" for={id}><slot /></label>{/if}
|
|
42
37
|
|
|
43
38
|
<!-- Content -->
|
|
44
39
|
<div class="range-content {cBaseContent}">
|
|
45
|
-
|
|
46
40
|
<!-- Input -->
|
|
47
41
|
<input
|
|
48
42
|
type="range"
|
|
@@ -63,16 +57,14 @@ function prunedRestProps() {
|
|
|
63
57
|
|
|
64
58
|
<!-- Tickmarks -->
|
|
65
59
|
{#if ticked && tickmarks && tickmarks.length}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
<datalist id="tickmarks-{id}" class="range-slider-ticks">
|
|
61
|
+
{#each tickmarks as tm}
|
|
62
|
+
<option value={tm} label={tm} />
|
|
63
|
+
{/each}
|
|
64
|
+
</datalist>
|
|
71
65
|
{/if}
|
|
72
|
-
|
|
73
66
|
</div>
|
|
74
67
|
|
|
75
68
|
<!-- Slot: Trail -->
|
|
76
69
|
{#if $$slots.trail}<div class="range-slider-trail"><slot name="trail" /></div>{/if}
|
|
77
|
-
|
|
78
70
|
</div>
|