@skeletonlabs/skeleton 1.0.0 → 1.2.0
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/{actions → dist/actions}/FocusTrap/focusTrap.js +3 -3
- package/{components → dist/components}/Accordion/AccordionItem.svelte.d.ts +1 -1
- package/{components → dist/components}/AppBar/AppBar.svelte +1 -1
- package/{components → dist/components}/AppRail/AppRailTile.svelte +3 -3
- package/{components → dist/components}/AppRail/AppRailTile.svelte.d.ts +2 -2
- package/dist/components/Autocomplete/Autocomplete.svelte +86 -0
- package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +48 -0
- package/dist/components/Autocomplete/types.d.ts +10 -0
- package/dist/components/Autocomplete/types.js +2 -0
- package/{components → dist/components}/Avatar/Avatar.svelte +6 -2
- package/{components → dist/components}/FileButton/FileButton.svelte +3 -2
- package/{components → dist/components}/FileButton/FileButton.svelte.d.ts +2 -0
- package/{components → dist/components}/InputChip/InputChip.svelte +33 -18
- package/{components → dist/components}/InputChip/InputChip.svelte.d.ts +3 -0
- package/{components → dist/components}/ListBox/ListBox.svelte +1 -1
- package/{components → dist/components}/ListBox/ListBoxItem.svelte +31 -29
- package/{components → dist/components}/Radio/RadioItem.svelte +20 -18
- package/{components → dist/components}/RangeSlider/RangeSlider.svelte +4 -2
- package/{components → dist/components}/RangeSlider/RangeSlider.svelte.d.ts +1 -1
- package/{components → dist/components}/SlideToggle/SlideToggle.svelte.d.ts +1 -1
- package/{components → dist/components}/Stepper/Step.svelte +3 -1
- package/{components → dist/components}/Tab/Tab.svelte +24 -22
- package/{components → dist/components}/Table/Table.svelte +4 -2
- package/{components → dist/components}/Table/Table.svelte.d.ts +4 -0
- package/{components → dist/components}/TableOfContents/TableOfContents.svelte +3 -3
- package/{index.d.ts → dist/index.d.ts} +2 -0
- package/{index.js → dist/index.js} +1 -0
- package/{utilities → dist/utilities}/Drawer/Drawer.svelte +4 -3
- package/{utilities → dist/utilities}/Drawer/Drawer.svelte.d.ts +2 -0
- package/{utilities → dist/utilities}/LightSwitch/lightswitch.js +3 -3
- package/{utilities → dist/utilities}/Modal/Modal.svelte +20 -9
- package/{utilities → dist/utilities}/Modal/Modal.svelte.d.ts +2 -0
- package/{utilities → dist/utilities}/Popup/popup.d.ts +1 -1
- package/{utilities → dist/utilities}/Popup/popup.js +87 -29
- package/{utilities → dist/utilities}/Popup/types.d.ts +1 -1
- package/{utilities → dist/utilities}/Toast/Toast.svelte +3 -2
- package/{utilities → dist/utilities}/Toast/Toast.svelte.d.ts +2 -0
- package/{utilities → dist/utilities}/Toast/stores.js +15 -9
- package/{utilities → dist/utilities}/Toast/types.d.ts +2 -0
- package/package.json +108 -167
- package/{styles → src/lib/styles}/elements/buttons.css +7 -3
- package/{styles → src/lib/styles}/elements/forms.css +1 -1
- package/{styles → src/lib/styles}/elements/lists.css +5 -1
- package/src/lib/tailwind/.DS_Store +0 -0
- package/src/lib/tailwind/generated/intellisense-classes.cjs +1 -0
- package/{tailwind → src/lib/tailwind}/intellisense.cjs +1 -1
- package/{tailwind → src/lib/tailwind}/tokens/rings.cjs +2 -2
- package/{themes → src/lib/themes}/theme-gold-nouveau.css +0 -1
- package/{themes → src/lib/themes}/theme-hamlindigo.css +1 -3
- package/{themes → src/lib/themes}/theme-modern.css +0 -1
- package/{themes → src/lib/themes}/theme-rocket.css +1 -4
- package/{themes → src/lib/themes}/theme-sahara.css +4 -7
- package/{themes → src/lib/themes}/theme-seafoam.css +1 -2
- package/{themes → src/lib/themes}/theme-seasonal.css +0 -1
- package/{themes → src/lib/themes}/theme-skeleton.css +0 -3
- package/src/lib/themes/theme-test.css +96 -0
- package/{themes → src/lib/themes}/theme-vintage.css +2 -4
- package/tailwind/core.d.cts +0 -5
- package/tailwind/generated/intellisense-classes.cjs +0 -1
- package/tailwind/generated/intellisense-classes.d.cts +0 -1979
- package/tailwind/intellisense.d.cts +0 -5
- package/tailwind/settings.d.cts +0 -6
- package/tailwind/skeleton.d.cts +0 -7
- package/tailwind/theme/colors.d.cts +0 -2
- package/tailwind/tokens/backgrounds.d.cts +0 -2
- package/tailwind/tokens/border-radius.d.cts +0 -33
- package/tailwind/tokens/borders.d.cts +0 -6
- package/tailwind/tokens/fills.d.cts +0 -15
- package/tailwind/tokens/rings.d.cts +0 -22
- package/tailwind/tokens/text.d.cts +0 -21
- package/{actions → dist/actions}/Clipboard/clipboard.d.ts +0 -0
- package/{actions → dist/actions}/Clipboard/clipboard.js +0 -0
- package/{actions → dist/actions}/Filters/filter.d.ts +0 -0
- package/{actions → dist/actions}/Filters/filter.js +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Apollo.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Apollo.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/BlueNight.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/BlueNight.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Emerald.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Emerald.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/GreenFall.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/GreenFall.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Noir.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Noir.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/NoirLight.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/NoirLight.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Rustic.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Rustic.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Summer84.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Summer84.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/XPro.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/XPro.svelte.d.ts +0 -0
- package/{actions → dist/actions}/FocusTrap/focusTrap.d.ts +0 -0
- package/{components → dist/components}/Accordion/Accordion.svelte +0 -0
- package/{components → dist/components}/Accordion/Accordion.svelte.d.ts +0 -0
- package/{components → dist/components}/Accordion/AccordionItem.svelte +0 -0
- package/{components → dist/components}/AppBar/AppBar.svelte.d.ts +0 -0
- package/{components → dist/components}/AppRail/AppRail.svelte +0 -0
- package/{components → dist/components}/AppRail/AppRail.svelte.d.ts +0 -0
- package/{components → dist/components}/AppShell/AppShell.svelte +0 -0
- package/{components → dist/components}/AppShell/AppShell.svelte.d.ts +0 -0
- package/{components → dist/components}/Avatar/Avatar.svelte.d.ts +0 -0
- package/{components → dist/components}/ConicGradient/ConicGradient.svelte +0 -0
- package/{components → dist/components}/ConicGradient/ConicGradient.svelte.d.ts +0 -0
- package/{components → dist/components}/ConicGradient/settings.d.ts +0 -0
- package/{components → dist/components}/ConicGradient/settings.js +0 -0
- package/{components → dist/components}/ConicGradient/types.d.ts +0 -0
- package/{components → dist/components}/ConicGradient/types.js +0 -0
- package/{components → dist/components}/FileDropzone/FileDropzone.svelte +0 -0
- package/{components → dist/components}/FileDropzone/FileDropzone.svelte.d.ts +0 -0
- package/{components → dist/components}/ListBox/ListBox.svelte.d.ts +0 -0
- package/{components → dist/components}/ListBox/ListBoxItem.svelte.d.ts +0 -0
- package/{components → dist/components}/Paginator/Paginator.svelte +0 -0
- package/{components → dist/components}/Paginator/Paginator.svelte.d.ts +0 -0
- package/{components → dist/components}/Paginator/types.d.ts +0 -0
- package/{components → dist/components}/Paginator/types.js +0 -0
- package/{components → dist/components}/ProgressBar/ProgressBar.svelte +0 -0
- package/{components → dist/components}/ProgressBar/ProgressBar.svelte.d.ts +0 -0
- package/{components → dist/components}/ProgressRadial/ProgressRadial.svelte +0 -0
- package/{components → dist/components}/ProgressRadial/ProgressRadial.svelte.d.ts +0 -0
- package/{components → dist/components}/Radio/RadioGroup.svelte +0 -0
- package/{components → dist/components}/Radio/RadioGroup.svelte.d.ts +0 -0
- package/{components → dist/components}/Radio/RadioItem.svelte.d.ts +0 -0
- package/{components → dist/components}/SlideToggle/SlideToggle.svelte +0 -0
- package/{components → dist/components}/Stepper/Step.svelte.d.ts +0 -0
- package/{components → dist/components}/Stepper/Stepper.svelte +0 -0
- package/{components → dist/components}/Stepper/Stepper.svelte.d.ts +0 -0
- package/{components → dist/components}/Tab/Tab.svelte.d.ts +1 -1
- package/{components → dist/components}/Tab/TabGroup.svelte +0 -0
- package/{components → dist/components}/Tab/TabGroup.svelte.d.ts +0 -0
- package/{components → dist/components}/Table/types.d.ts +0 -0
- package/{components → dist/components}/Table/types.js +0 -0
- package/{components → dist/components}/Table/utils.d.ts +0 -0
- package/{components → dist/components}/Table/utils.js +0 -0
- package/{components → dist/components}/TableOfContents/TableOfContents.svelte.d.ts +0 -0
- package/{types → dist/types}/index.d.ts +0 -0
- package/{types → dist/types}/index.js +0 -0
- package/{types → dist/types}/tailwind.d.ts +0 -0
- package/{types → dist/types}/tailwind.js +0 -0
- package/{utilities → dist/utilities}/CodeBlock/CodeBlock.svelte +0 -0
- package/{utilities → dist/utilities}/CodeBlock/CodeBlock.svelte.d.ts +0 -0
- package/{utilities → dist/utilities}/CodeBlock/stores.d.ts +0 -0
- package/{utilities → dist/utilities}/CodeBlock/stores.js +0 -0
- package/{utilities → dist/utilities}/DataTable/DataTable.d.ts +0 -0
- package/{utilities → dist/utilities}/DataTable/DataTable.js +0 -0
- package/{utilities → dist/utilities}/DataTable/actions.d.ts +0 -0
- package/{utilities → dist/utilities}/DataTable/actions.js +0 -0
- package/{utilities → dist/utilities}/DataTable/types.d.ts +0 -0
- package/{utilities → dist/utilities}/DataTable/types.js +0 -0
- package/{utilities → dist/utilities}/Drawer/stores.d.ts +0 -0
- package/{utilities → dist/utilities}/Drawer/stores.js +0 -0
- package/{utilities → dist/utilities}/Drawer/types.d.ts +0 -0
- package/{utilities → dist/utilities}/Drawer/types.js +0 -0
- package/{utilities → dist/utilities}/LightSwitch/LightSwitch.svelte +0 -0
- package/{utilities → dist/utilities}/LightSwitch/LightSwitch.svelte.d.ts +0 -0
- package/{utilities → dist/utilities}/LightSwitch/lightswitch.d.ts +0 -0
- package/{utilities → dist/utilities}/LocalStorageStore/LocalStorageStore.d.ts +0 -0
- package/{utilities → dist/utilities}/LocalStorageStore/LocalStorageStore.js +0 -0
- package/{utilities → dist/utilities}/Modal/stores.d.ts +0 -0
- package/{utilities → dist/utilities}/Modal/stores.js +0 -0
- package/{utilities → dist/utilities}/Modal/types.d.ts +0 -0
- package/{utilities → dist/utilities}/Modal/types.js +0 -0
- package/{utilities → dist/utilities}/Popup/types.js +0 -0
- package/{utilities → dist/utilities}/Toast/stores.d.ts +0 -0
- package/{utilities → dist/utilities}/Toast/types.js +0 -0
- package/{styles → src/lib/styles}/all.css +0 -0
- package/{styles → src/lib/styles}/core.css +0 -0
- package/{styles → src/lib/styles}/elements/alerts.css +0 -0
- package/{styles → src/lib/styles}/elements/badges.css +0 -0
- package/{styles → src/lib/styles}/elements/breadcrumbs.css +0 -0
- package/{styles → src/lib/styles}/elements/cards.css +0 -0
- package/{styles → src/lib/styles}/elements/chips.css +0 -0
- package/{styles → src/lib/styles}/elements/logo-clouds.css +0 -0
- package/{styles → src/lib/styles}/elements/modals.css +0 -0
- package/{styles → src/lib/styles}/elements/placeholders.css +0 -0
- package/{styles → src/lib/styles}/elements/popups.css +0 -0
- package/{styles → src/lib/styles}/elements/tables.css +2 -2
- /package/{styles → src/lib/styles}/elements.css +0 -0
- /package/{styles → src/lib/styles}/highlight-js.css +0 -0
- /package/{styles → src/lib/styles}/tailwind.css +0 -0
- /package/{styles → src/lib/styles}/typography.css +0 -0
- /package/{styles → src/lib/styles}/variants.css +0 -0
- /package/{tailwind → src/lib/tailwind}/core.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/settings.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/skeleton.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/theme/colors.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/tokens/backgrounds.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/tokens/border-radius.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/tokens/borders.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/tokens/fills.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/tokens/text.cjs +0 -0
- /package/{themes → src/lib/themes}/theme-crimson.css +0 -0
|
@@ -34,7 +34,7 @@ export function focusTrap(node, enabled) {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
onInit();
|
|
37
|
-
function
|
|
37
|
+
function onDestroy() {
|
|
38
38
|
if (elemFirst)
|
|
39
39
|
elemFirst.removeEventListener('keydown', onFirstElemKeydown);
|
|
40
40
|
if (elemLast)
|
|
@@ -44,10 +44,10 @@ export function focusTrap(node, enabled) {
|
|
|
44
44
|
return {
|
|
45
45
|
update(newArgs) {
|
|
46
46
|
enabled = newArgs;
|
|
47
|
-
newArgs ? onInit() :
|
|
47
|
+
newArgs ? onInit() : onDestroy();
|
|
48
48
|
},
|
|
49
49
|
destroy() {
|
|
50
|
-
|
|
50
|
+
onDestroy();
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
}
|
|
@@ -12,7 +12,7 @@ export let slotDefault = "";
|
|
|
12
12
|
export let slotTrail = "";
|
|
13
13
|
export let label = "";
|
|
14
14
|
export let labelledby = "";
|
|
15
|
-
const cBase = "flex flex-col
|
|
15
|
+
const cBase = "flex flex-col";
|
|
16
16
|
const cRowMain = "grid items-center";
|
|
17
17
|
const cRowHeadline = "";
|
|
18
18
|
const cSlotLead = "flex-none flex justify-between items-center";
|
|
@@ -11,13 +11,13 @@ export let hover = getContext("hover");
|
|
|
11
11
|
const cBase = "unstyled grid place-content-center place-items-center w-full aspect-square space-y-1.5 cursor-pointer";
|
|
12
12
|
const cLabel = "font-bold text-xs text-center";
|
|
13
13
|
function onClickHandler(event) {
|
|
14
|
-
if (
|
|
14
|
+
if (!String($selected) || !String(value))
|
|
15
15
|
return;
|
|
16
16
|
$selected = value;
|
|
17
17
|
dispatch("click", event);
|
|
18
18
|
}
|
|
19
19
|
$:
|
|
20
|
-
classesActive = $selected && value && $selected === value ? `${active}` : "";
|
|
20
|
+
classesActive = String($selected) && String(value) && $selected === value ? `${active}` : "";
|
|
21
21
|
$:
|
|
22
22
|
classesBase = `${cBase} ${hover} ${classesActive} ${$$props.class || ""}`;
|
|
23
23
|
$:
|
|
@@ -30,7 +30,7 @@ function prunedRestProps() {
|
|
|
30
30
|
|
|
31
31
|
<!-- @component A navigation tile for the App Rail component. -->
|
|
32
32
|
|
|
33
|
-
<div on:click={onClickHandler} on:
|
|
33
|
+
<div on:click={onClickHandler} on:keydown on:keyup on:keypress>
|
|
34
34
|
<!-- IMPORTANT: avoid forwarding events on <svelte:element> tags per: -->
|
|
35
35
|
<!-- https://github.com/skeletonlabs/skeleton/issues/727#issuecomment-1356859261 -->
|
|
36
36
|
<svelte:element this={tag} {...prunedRestProps()} class="app-rail-tile {classesBase}">
|
|
@@ -18,11 +18,11 @@ declare const __propDef: {
|
|
|
18
18
|
hover?: Writable<string> | undefined;
|
|
19
19
|
};
|
|
20
20
|
events: {
|
|
21
|
-
/** {{ event }} click - Fires when the component is clicked.*/
|
|
22
|
-
click: CustomEvent<any>;
|
|
23
21
|
keydown: KeyboardEvent;
|
|
24
22
|
keyup: KeyboardEvent;
|
|
25
23
|
keypress: KeyboardEvent;
|
|
24
|
+
/** {{ event }} click - Fires when the component is clicked.*/
|
|
25
|
+
click: CustomEvent<MouseEvent>;
|
|
26
26
|
} & {
|
|
27
27
|
[evt: string]: CustomEvent<any>;
|
|
28
28
|
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { slide } from "svelte/transition";
|
|
3
|
+
import { flip } from "svelte/animate";
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
5
|
+
export let input = void 0;
|
|
6
|
+
export let options = [];
|
|
7
|
+
export let allowlist = [];
|
|
8
|
+
export let denylist = [];
|
|
9
|
+
export let emptyState = "No Results Found.";
|
|
10
|
+
export let duration = 200;
|
|
11
|
+
export let regionNav = "";
|
|
12
|
+
export let regionList = "list-nav";
|
|
13
|
+
export let regionItem = "";
|
|
14
|
+
export let regionButton = "w-full";
|
|
15
|
+
export let regionEmpty = "text-center";
|
|
16
|
+
export let whitelist = [];
|
|
17
|
+
export let blacklist = [];
|
|
18
|
+
const deprecated = [whitelist, blacklist];
|
|
19
|
+
let listedOptions = options;
|
|
20
|
+
function filterByAllowed() {
|
|
21
|
+
if (allowlist.length) {
|
|
22
|
+
listedOptions = [...options].filter((option) => allowlist.includes(option.value));
|
|
23
|
+
} else {
|
|
24
|
+
listedOptions = [...options];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function filterByDenied() {
|
|
28
|
+
if (denylist.length) {
|
|
29
|
+
const denySet = new Set(denylist);
|
|
30
|
+
listedOptions = [...options].filter((option) => !denySet.has(option.value));
|
|
31
|
+
} else {
|
|
32
|
+
listedOptions = [...options];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function filterOptions() {
|
|
36
|
+
let _options = [...listedOptions];
|
|
37
|
+
_options = _options.filter((option) => {
|
|
38
|
+
const inputFormatted = String(input).toLowerCase().trim();
|
|
39
|
+
let optionFormatted = JSON.stringify([option.label, option.value, option.keywords]).toLowerCase();
|
|
40
|
+
if (optionFormatted.includes(inputFormatted))
|
|
41
|
+
return option;
|
|
42
|
+
});
|
|
43
|
+
return _options;
|
|
44
|
+
}
|
|
45
|
+
function onSelection(option) {
|
|
46
|
+
dispatch("selection", option);
|
|
47
|
+
}
|
|
48
|
+
$:
|
|
49
|
+
if (allowlist)
|
|
50
|
+
filterByAllowed();
|
|
51
|
+
$:
|
|
52
|
+
if (denylist)
|
|
53
|
+
filterByDenied();
|
|
54
|
+
$:
|
|
55
|
+
optionsFiltered = input ? filterOptions() : listedOptions;
|
|
56
|
+
$:
|
|
57
|
+
classsesBase = `${$$props.class ?? ""}`;
|
|
58
|
+
$:
|
|
59
|
+
classesNav = `${regionNav}`;
|
|
60
|
+
$:
|
|
61
|
+
classesList = `${regionList}`;
|
|
62
|
+
$:
|
|
63
|
+
classesItem = `${regionItem}`;
|
|
64
|
+
$:
|
|
65
|
+
classesButton = `${regionButton}`;
|
|
66
|
+
$:
|
|
67
|
+
classesEmtpy = `${regionEmpty}`;
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<div class="autocomplete {classsesBase}" data-testid="autocomplete">
|
|
71
|
+
{#if optionsFiltered.length > 0}
|
|
72
|
+
<nav class="autocomplete-nav {classesNav}">
|
|
73
|
+
<ul class="autocomplete-list {classesList}">
|
|
74
|
+
{#each optionsFiltered as option, i (option)}
|
|
75
|
+
<li class="autocomplete-item {classesItem}" animate:flip={{ duration }} transition:slide|local={{ duration }}>
|
|
76
|
+
<button class="autocomplete-button {classesButton}" type="button" on:click={() => onSelection(option)} on:click on:keypress>
|
|
77
|
+
{@html option.label}
|
|
78
|
+
</button>
|
|
79
|
+
</li>
|
|
80
|
+
{/each}
|
|
81
|
+
</ul>
|
|
82
|
+
</nav>
|
|
83
|
+
{:else}
|
|
84
|
+
<div class="autocomplete-empty {classesEmtpy}">{emptyState}</div>
|
|
85
|
+
{/if}
|
|
86
|
+
</div>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { AutocompleteOption } from './types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
/** Bind the input value.*/
|
|
7
|
+
input?: unknown;
|
|
8
|
+
/** Define values for the list*/
|
|
9
|
+
options?: AutocompleteOption[] | undefined;
|
|
10
|
+
/** Provide allowlist values*/
|
|
11
|
+
allowlist?: unknown[] | undefined;
|
|
12
|
+
/** Provide denylist values*/
|
|
13
|
+
denylist?: unknown[] | undefined;
|
|
14
|
+
/** Provide a HTML markup to display when no match is found.*/
|
|
15
|
+
emptyState?: string | undefined;
|
|
16
|
+
/** Set the animation duration. Use zero to disable.*/
|
|
17
|
+
duration?: number | undefined;
|
|
18
|
+
/** Provide arbitrary classes to nav element.*/
|
|
19
|
+
regionNav?: string | undefined;
|
|
20
|
+
/** Provide arbitrary classes to each list.*/
|
|
21
|
+
regionList?: string | undefined;
|
|
22
|
+
/** Provide arbitrary classes to each list item.*/
|
|
23
|
+
regionItem?: string | undefined;
|
|
24
|
+
/** Provide arbitrary classes to each button.*/
|
|
25
|
+
regionButton?: string | undefined;
|
|
26
|
+
/** Provide arbitrary classes to empty message.*/
|
|
27
|
+
regionEmpty?: string | undefined;
|
|
28
|
+
/** DEPRECATED: replace with allowlist*/
|
|
29
|
+
whitelist?: unknown[] | undefined;
|
|
30
|
+
/** DEPRECATED: replace with denylist*/
|
|
31
|
+
blacklist?: unknown[] | undefined;
|
|
32
|
+
};
|
|
33
|
+
events: {
|
|
34
|
+
click: MouseEvent;
|
|
35
|
+
keypress: KeyboardEvent;
|
|
36
|
+
/** {AutocompleteOption} selection - Fire on option select.*/
|
|
37
|
+
selection: CustomEvent<any>;
|
|
38
|
+
} & {
|
|
39
|
+
[evt: string]: CustomEvent<any>;
|
|
40
|
+
};
|
|
41
|
+
slots: {};
|
|
42
|
+
};
|
|
43
|
+
export type AutocompleteProps = typeof __propDef.props;
|
|
44
|
+
export type AutocompleteEvents = typeof __propDef.events;
|
|
45
|
+
export type AutocompleteSlots = typeof __propDef.slots;
|
|
46
|
+
export default class Autocomplete extends SvelteComponentTyped<AutocompleteProps, AutocompleteEvents, AutocompleteSlots> {
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface AutocompleteOption {
|
|
2
|
+
/** provide a unique display label per option. Supports HTML. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** Provide a unique option value. */
|
|
5
|
+
value: unknown;
|
|
6
|
+
/** Provide a comma seperated list of keywords. */
|
|
7
|
+
keywords?: any;
|
|
8
|
+
/** Pass arbitrary data per option. */
|
|
9
|
+
meta?: any;
|
|
10
|
+
}
|
|
@@ -14,14 +14,18 @@ let cBase = "flex aspect-square text-surface-50 font-semibold justify-center ite
|
|
|
14
14
|
let cImage = "w-full h-full object-cover";
|
|
15
15
|
$:
|
|
16
16
|
classesBase = `${cBase} ${background} ${width} ${border} ${rounded} ${shadow} ${cursor} ${$$props.class ?? ""}`;
|
|
17
|
+
function prunedRestProps() {
|
|
18
|
+
delete $$restProps.class;
|
|
19
|
+
return $$restProps;
|
|
20
|
+
}
|
|
17
21
|
</script>
|
|
18
22
|
|
|
19
23
|
<figure class="avatar {classesBase}" data-testid="avatar" on:click on:keydown on:keyup on:keypress>
|
|
20
24
|
{#if src}
|
|
21
|
-
<img class="avatar-image {cImage}" style={$$props.style ?? ''} {src} alt={$$props.alt || ''} use:action={actionParams} />
|
|
25
|
+
<img class="avatar-image {cImage}" style={$$props.style ?? ''} {src} alt={$$props.alt || ''} use:action={actionParams} {...prunedRestProps()} />
|
|
22
26
|
{:else}
|
|
23
27
|
<svg class="avatar-initials w-full h-full" viewBox="0 0 512 512">
|
|
24
|
-
<text x="50%" y="50%" dominant-baseline="
|
|
28
|
+
<text x="50%" y="50%" dominant-baseline="central" text-anchor="middle" font-weight="bold" font-size={150} class="avatar-text {fill}">
|
|
25
29
|
{String(initials).substring(0, 2).toUpperCase()}
|
|
26
30
|
</text>
|
|
27
31
|
</svg>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script>export let
|
|
1
|
+
<script>export let files = void 0;
|
|
2
|
+
export let name;
|
|
2
3
|
export let width = "";
|
|
3
4
|
export let button = "variant-filled";
|
|
4
5
|
const cButton = "btn";
|
|
@@ -19,7 +20,7 @@ $:
|
|
|
19
20
|
<div class="file-button {classesBase}" data-testid="file-button">
|
|
20
21
|
<!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
|
|
21
22
|
<div class="w-0 h-0 overflow-hidden">
|
|
22
|
-
<input type="file" bind:this={elemFileInput} {name} {...prunedRestProps()} on:change />
|
|
23
|
+
<input type="file" bind:this={elemFileInput} bind:files {name} {...prunedRestProps()} on:change />
|
|
23
24
|
</div>
|
|
24
25
|
<!-- Button -->
|
|
25
26
|
<button
|
|
@@ -2,6 +2,8 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
+
/** Bind FileList to the file input.*/
|
|
6
|
+
files?: FileList | undefined;
|
|
5
7
|
/** Required. Set a unique name for the file input.*/
|
|
6
8
|
name: string;
|
|
7
9
|
/** Provide classes to set the width.*/
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { fly, scale } from "svelte/transition";
|
|
3
3
|
import { flip } from "svelte/animate";
|
|
4
4
|
const dispatch = createEventDispatcher();
|
|
5
|
+
export let input = "";
|
|
5
6
|
export let name;
|
|
6
7
|
export let value = [];
|
|
7
8
|
export let whitelist = [];
|
|
@@ -21,25 +22,28 @@ const cBase = "textarea cursor-pointer";
|
|
|
21
22
|
const cInterface = "space-y-4";
|
|
22
23
|
const cChipList = "flex flex-wrap gap-2";
|
|
23
24
|
const cInputField = "unstyled bg-transparent border-0 !ring-0 p-0 w-full";
|
|
24
|
-
let inputValue = "";
|
|
25
25
|
let inputValid = true;
|
|
26
|
+
let chipValues = value.map((val) => {
|
|
27
|
+
return { val, id: Math.random() };
|
|
28
|
+
});
|
|
26
29
|
function onInputHandler() {
|
|
27
30
|
inputValid = true;
|
|
28
31
|
}
|
|
29
32
|
function validate() {
|
|
30
|
-
if (!
|
|
33
|
+
if (!input)
|
|
31
34
|
return false;
|
|
32
|
-
|
|
35
|
+
input = input.trim();
|
|
36
|
+
if (validation !== void 0 && !validation(input))
|
|
33
37
|
return false;
|
|
34
38
|
if (max !== -1 && value.length >= max)
|
|
35
39
|
return false;
|
|
36
|
-
if (minlength !== -1 &&
|
|
40
|
+
if (minlength !== -1 && input.length < minlength)
|
|
37
41
|
return false;
|
|
38
|
-
if (maxlength !== -1 &&
|
|
42
|
+
if (maxlength !== -1 && input.length > maxlength)
|
|
39
43
|
return false;
|
|
40
|
-
if (whitelist.length > 0 && !whitelist.includes(
|
|
44
|
+
if (whitelist.length > 0 && !whitelist.includes(input))
|
|
41
45
|
return false;
|
|
42
|
-
if (allowDuplicates === false && value.includes(
|
|
46
|
+
if (allowDuplicates === false && value.includes(input))
|
|
43
47
|
return false;
|
|
44
48
|
return true;
|
|
45
49
|
}
|
|
@@ -48,16 +52,21 @@ function addChip(event) {
|
|
|
48
52
|
inputValid = validate();
|
|
49
53
|
if (inputValid === false)
|
|
50
54
|
return;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
value =
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
input = allowUpperCase ? input : input.toLowerCase();
|
|
56
|
+
value.push(input);
|
|
57
|
+
value = value;
|
|
58
|
+
chipValues.push({ val: input, id: Math.random() });
|
|
59
|
+
chipValues = chipValues;
|
|
60
|
+
dispatch("add", { event, chipIndex: value.length - 1, chipValue: input });
|
|
61
|
+
input = "";
|
|
56
62
|
}
|
|
57
63
|
function removeChip(event, chipIndex, chipValue) {
|
|
58
64
|
if ($$restProps.disabled)
|
|
59
65
|
return;
|
|
60
|
-
value
|
|
66
|
+
value.splice(chipIndex, 1);
|
|
67
|
+
value = value;
|
|
68
|
+
chipValues.splice(chipIndex, 1);
|
|
69
|
+
chipValues = chipValues;
|
|
61
70
|
dispatch("remove", { event, chipIndex, chipValue });
|
|
62
71
|
}
|
|
63
72
|
$:
|
|
@@ -70,6 +79,12 @@ $:
|
|
|
70
79
|
classesChipList = `${cChipList}`;
|
|
71
80
|
$:
|
|
72
81
|
classesInputField = `${cInputField}`;
|
|
82
|
+
$:
|
|
83
|
+
chipValues = value.map((val, i) => {
|
|
84
|
+
if (chipValues[i]?.val === val)
|
|
85
|
+
return chipValues[i];
|
|
86
|
+
return { id: Math.random(), val };
|
|
87
|
+
});
|
|
73
88
|
</script>
|
|
74
89
|
|
|
75
90
|
<div class="input-chip {classesBase}" class:opacity-50={$$restProps.disabled}>
|
|
@@ -86,7 +101,7 @@ $:
|
|
|
86
101
|
<form on:submit={addChip}>
|
|
87
102
|
<input
|
|
88
103
|
type="text"
|
|
89
|
-
bind:value={
|
|
104
|
+
bind:value={input}
|
|
90
105
|
placeholder={$$restProps.placeholder ?? 'Enter values...'}
|
|
91
106
|
class="input-chip-field {classesInputField}"
|
|
92
107
|
on:input={onInputHandler}
|
|
@@ -95,16 +110,16 @@ $:
|
|
|
95
110
|
/>
|
|
96
111
|
</form>
|
|
97
112
|
<!-- Chip List -->
|
|
98
|
-
{#if
|
|
113
|
+
{#if chipValues.length}
|
|
99
114
|
<div class="input-chip-list {classesChipList}" transition:fly|local={{ duration, opacity: 0, y: -20 }}>
|
|
100
|
-
{#each
|
|
115
|
+
{#each chipValues as { id, val }, i (id)}
|
|
101
116
|
<!-- Wrapping div required for FLIP animation -->
|
|
102
117
|
<div animate:flip={{ duration }}>
|
|
103
118
|
<button
|
|
104
119
|
type="button"
|
|
105
120
|
class="chip {chips}"
|
|
106
121
|
on:click={(e) => {
|
|
107
|
-
removeChip(e, i,
|
|
122
|
+
removeChip(e, i, val);
|
|
108
123
|
}}
|
|
109
124
|
on:click
|
|
110
125
|
on:keypress
|
|
@@ -112,7 +127,7 @@ $:
|
|
|
112
127
|
on:keyup
|
|
113
128
|
transition:scale|local={{ duration, opacity: 0 }}
|
|
114
129
|
>
|
|
115
|
-
<span>{
|
|
130
|
+
<span>{val}</span>
|
|
116
131
|
<span>✕</span>
|
|
117
132
|
</button>
|
|
118
133
|
</div>
|
|
@@ -2,6 +2,8 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
+
/** Bind the input value.*/
|
|
6
|
+
input?: string | undefined;
|
|
5
7
|
/** Set a unique select input name.*/
|
|
6
8
|
name: string;
|
|
7
9
|
/** An array of values.*/
|
|
@@ -34,6 +36,7 @@ declare const __propDef: {
|
|
|
34
36
|
rounded?: string | undefined;
|
|
35
37
|
};
|
|
36
38
|
events: {
|
|
39
|
+
/** Bind the input value.*/
|
|
37
40
|
input: Event;
|
|
38
41
|
click: MouseEvent;
|
|
39
42
|
keypress: KeyboardEvent;
|
|
@@ -11,7 +11,7 @@ setContext("rounded", rounded);
|
|
|
11
11
|
setContext("active", active);
|
|
12
12
|
setContext("hover", hover);
|
|
13
13
|
setContext("padding", padding);
|
|
14
|
-
const cBase = "
|
|
14
|
+
const cBase = "";
|
|
15
15
|
$:
|
|
16
16
|
classesBase = `${cBase} ${spacing} ${rounded} ${$$props.class ?? ""}`;
|
|
17
17
|
</script>
|
|
@@ -7,7 +7,7 @@ export let rounded = getContext("rounded");
|
|
|
7
7
|
export let active = getContext("active");
|
|
8
8
|
export let hover = getContext("hover");
|
|
9
9
|
export let padding = getContext("padding");
|
|
10
|
-
const cBase = "
|
|
10
|
+
const cBase = "cursor-pointer -outline-offset-[3px]";
|
|
11
11
|
const cLabel = "flex space-x-4";
|
|
12
12
|
let checked;
|
|
13
13
|
let elemInput;
|
|
@@ -50,33 +50,35 @@ $:
|
|
|
50
50
|
classesLabel = `${cLabel}`;
|
|
51
51
|
</script>
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
<label
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
53
|
+
<label>
|
|
54
|
+
<!-- A11y attributes are not allowed on <label> -->
|
|
55
|
+
<div
|
|
56
|
+
class="listbox-item {classesBase}"
|
|
57
|
+
data-testid="listbox-item"
|
|
58
|
+
role="option"
|
|
59
|
+
aria-selected={selected}
|
|
60
|
+
tabindex="0"
|
|
61
|
+
on:keydown={onKeyDown}
|
|
62
|
+
on:keydown
|
|
63
|
+
on:keyup
|
|
64
|
+
on:keypress
|
|
65
|
+
>
|
|
66
|
+
<!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
|
|
67
|
+
<div class="h-0 w-0 overflow-hidden">
|
|
68
|
+
{#if multiple}
|
|
69
|
+
<input bind:this={elemInput} type="checkbox" {name} {value} bind:checked tabindex="-1" on:click on:change />
|
|
70
|
+
{:else}
|
|
71
|
+
<input bind:this={elemInput} type="radio" bind:group {name} {value} tabindex="-1" on:click on:change />
|
|
72
|
+
{/if}
|
|
73
|
+
</div>
|
|
74
|
+
<!-- <slot /> -->
|
|
75
|
+
<div class="listbox-label {classesLabel}">
|
|
76
|
+
<!-- Slot: Lead -->
|
|
77
|
+
{#if $$slots.lead}<div class="listbox-label-lead"><slot name="lead" /></div>{/if}
|
|
78
|
+
<!-- Slot: Default -->
|
|
79
|
+
<div class="listbox-label-content flex-1"><slot /></div>
|
|
80
|
+
<!-- Slot: Trail -->
|
|
81
|
+
{#if $$slots.trail}<div class="listbox-label-trail"><slot name="trail" /></div>{/if}
|
|
82
|
+
</div>
|
|
81
83
|
</div>
|
|
82
84
|
</label>
|
|
@@ -33,23 +33,25 @@ function prunedRestProps() {
|
|
|
33
33
|
}
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
<label
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<
|
|
36
|
+
<label>
|
|
37
|
+
<!-- A11y attributes are not allowed on <label> -->
|
|
38
|
+
<div
|
|
39
|
+
class="radio-item {classesBase}"
|
|
40
|
+
data-testid="radio-item"
|
|
41
|
+
role="radio"
|
|
42
|
+
aria-checked={checked}
|
|
43
|
+
aria-label={label}
|
|
44
|
+
tabindex="0"
|
|
45
|
+
{title}
|
|
46
|
+
on:keydown={onKeyDown}
|
|
47
|
+
on:keydown
|
|
48
|
+
on:keyup
|
|
49
|
+
on:keypress
|
|
50
|
+
>
|
|
51
|
+
<!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
|
|
52
|
+
<div class="h-0 w-0 overflow-hidden">
|
|
53
|
+
<input bind:this={elemInput} type="radio" bind:group {name} {value} {...prunedRestProps()} tabindex="-1" on:click on:change />
|
|
54
|
+
</div>
|
|
55
|
+
<slot />
|
|
53
56
|
</div>
|
|
54
|
-
<slot />
|
|
55
57
|
</label>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { afterUpdate } from "svelte";
|
|
1
|
+
<script>import { afterUpdate, tick } from "svelte";
|
|
2
2
|
export let name;
|
|
3
3
|
export let id = String(Math.random());
|
|
4
4
|
export let value = 0;
|
|
@@ -16,8 +16,10 @@ let tickmarks;
|
|
|
16
16
|
function setTicks() {
|
|
17
17
|
if (ticked == false)
|
|
18
18
|
return;
|
|
19
|
-
tickmarks = Array.from({ length: max - min + 1 }, (_, i) => i +
|
|
19
|
+
tickmarks = Array.from({ length: max - min + 1 }, (_, i) => i + min);
|
|
20
20
|
}
|
|
21
|
+
if (ticked)
|
|
22
|
+
setTicks();
|
|
21
23
|
afterUpdate(() => {
|
|
22
24
|
setTicks();
|
|
23
25
|
});
|
|
@@ -2,7 +2,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
/** Required. Set a unique name for the
|
|
5
|
+
/** Required. Set a unique name for the input.*/
|
|
6
6
|
name: string;
|
|
7
7
|
/** Provide a unique input id. Auto-generated by default*/
|
|
8
8
|
id?: string | undefined;
|
|
@@ -2,7 +2,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
/** Required. Set a unique name for the
|
|
5
|
+
/** Required. Set a unique name for the input.*/
|
|
6
6
|
name: string;
|
|
7
7
|
/** The checked state of the input element.*/
|
|
8
8
|
checked?: boolean | undefined;
|
|
@@ -81,7 +81,9 @@ onDestroy(() => {
|
|
|
81
81
|
<span>{@html buttonNextLabel}</span>
|
|
82
82
|
</button>
|
|
83
83
|
{:else}
|
|
84
|
-
<button type={buttonCompleteType} class="btn {buttonComplete}" on:click={onComplete}
|
|
84
|
+
<button type={buttonCompleteType} class="btn {buttonComplete}" on:click={onComplete} disabled={locked}>
|
|
85
|
+
{@html buttonCompleteLabel}
|
|
86
|
+
</button>
|
|
85
87
|
{/if}
|
|
86
88
|
</div>
|
|
87
89
|
{/if}
|