@skeletonlabs/skeleton 2.10.0 → 3.0.0-next.1
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/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -0
- package/dist/plugin/index.cjs +431 -0
- package/dist/plugin/index.cjs.map +1 -0
- package/dist/plugin/index.d.ts +270 -0
- package/dist/themes/index.d.ts +1117 -0
- package/dist/themes/index.js +935 -0
- package/dist/themes/index.js.map +1 -0
- package/package.json +32 -51
- package/README.md +0 -38
- package/dist/actions/Clipboard/clipboard.d.ts +0 -11
- package/dist/actions/Clipboard/clipboard.js +0 -64
- package/dist/actions/Filters/filter.d.ts +0 -6
- package/dist/actions/Filters/filter.js +0 -16
- package/dist/actions/Filters/svg-filters/Apollo.svelte +0 -13
- package/dist/actions/Filters/svg-filters/Apollo.svelte.d.ts +0 -23
- package/dist/actions/Filters/svg-filters/BlueNight.svelte +0 -12
- package/dist/actions/Filters/svg-filters/BlueNight.svelte.d.ts +0 -23
- package/dist/actions/Filters/svg-filters/Emerald.svelte +0 -23
- package/dist/actions/Filters/svg-filters/Emerald.svelte.d.ts +0 -23
- package/dist/actions/Filters/svg-filters/GreenFall.svelte +0 -27
- package/dist/actions/Filters/svg-filters/GreenFall.svelte.d.ts +0 -23
- package/dist/actions/Filters/svg-filters/Noir.svelte +0 -17
- package/dist/actions/Filters/svg-filters/Noir.svelte.d.ts +0 -23
- package/dist/actions/Filters/svg-filters/NoirLight.svelte +0 -19
- package/dist/actions/Filters/svg-filters/NoirLight.svelte.d.ts +0 -23
- package/dist/actions/Filters/svg-filters/Rustic.svelte +0 -14
- package/dist/actions/Filters/svg-filters/Rustic.svelte.d.ts +0 -23
- package/dist/actions/Filters/svg-filters/Summer84.svelte +0 -12
- package/dist/actions/Filters/svg-filters/Summer84.svelte.d.ts +0 -23
- package/dist/actions/Filters/svg-filters/XPro.svelte +0 -12
- package/dist/actions/Filters/svg-filters/XPro.svelte.d.ts +0 -23
- package/dist/actions/FocusTrap/focusTrap.d.ts +0 -4
- package/dist/actions/FocusTrap/focusTrap.js +0 -89
- package/dist/components/Accordion/Accordion.svelte +0 -49
- package/dist/components/Accordion/Accordion.svelte.d.ts +0 -56
- package/dist/components/Accordion/AccordionItem.svelte +0 -126
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +0 -73
- package/dist/components/AppBar/AppBar.svelte +0 -53
- package/dist/components/AppBar/AppBar.svelte.d.ts +0 -49
- package/dist/components/AppRail/AppRail.svelte +0 -41
- package/dist/components/AppRail/AppRail.svelte.d.ts +0 -45
- package/dist/components/AppRail/AppRailAnchor.svelte +0 -47
- package/dist/components/AppRail/AppRailAnchor.svelte.d.ts +0 -38
- package/dist/components/AppRail/AppRailTile.svelte +0 -60
- package/dist/components/AppRail/AppRailTile.svelte.d.ts +0 -45
- package/dist/components/AppShell/AppShell.svelte +0 -72
- package/dist/components/AppShell/AppShell.svelte.d.ts +0 -44
- package/dist/components/Autocomplete/Autocomplete.svelte +0 -98
- package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +0 -58
- package/dist/components/Autocomplete/types.d.ts +0 -10
- package/dist/components/Autocomplete/types.js +0 -2
- package/dist/components/Avatar/Avatar.svelte +0 -52
- package/dist/components/Avatar/Avatar.svelte.d.ts +0 -45
- package/dist/components/ConicGradient/ConicGradient.svelte +0 -75
- package/dist/components/ConicGradient/ConicGradient.svelte.d.ts +0 -37
- package/dist/components/ConicGradient/settings.d.ts +0 -9
- package/dist/components/ConicGradient/settings.js +0 -334
- package/dist/components/ConicGradient/types.d.ts +0 -10
- package/dist/components/ConicGradient/types.js +0 -2
- package/dist/components/FileButton/FileButton.svelte +0 -37
- package/dist/components/FileButton/FileButton.svelte.d.ts +0 -33
- package/dist/components/FileDropzone/FileDropzone.svelte +0 -63
- package/dist/components/FileDropzone/FileDropzone.svelte.d.ts +0 -55
- package/dist/components/InputChip/InputChip.svelte +0 -203
- package/dist/components/InputChip/InputChip.svelte.d.ts +0 -114
- package/dist/components/ListBox/ListBox.svelte +0 -29
- package/dist/components/ListBox/ListBox.svelte.d.ts +0 -40
- package/dist/components/ListBox/ListBoxItem.svelte +0 -117
- package/dist/components/ListBox/ListBoxItem.svelte.d.ts +0 -41
- package/dist/components/Paginator/Paginator.svelte +0 -190
- package/dist/components/Paginator/Paginator.svelte.d.ts +0 -68
- package/dist/components/Paginator/icons.d.ts +0 -4
- package/dist/components/Paginator/icons.js +0 -4
- package/dist/components/Paginator/types.d.ts +0 -10
- package/dist/components/Paginator/types.js +0 -2
- package/dist/components/ProgressBar/ProgressBar.svelte +0 -50
- package/dist/components/ProgressBar/ProgressBar.svelte.d.ts +0 -36
- package/dist/components/ProgressRadial/ProgressRadial.svelte +0 -73
- package/dist/components/ProgressRadial/ProgressRadial.svelte.d.ts +0 -38
- package/dist/components/Radio/RadioGroup.svelte +0 -29
- package/dist/components/Radio/RadioGroup.svelte.d.ts +0 -44
- package/dist/components/Radio/RadioItem.svelte +0 -61
- package/dist/components/Radio/RadioItem.svelte.d.ts +0 -41
- package/dist/components/RangeSlider/RangeSlider.svelte +0 -72
- package/dist/components/RangeSlider/RangeSlider.svelte.d.ts +0 -41
- package/dist/components/Ratings/Ratings.svelte +0 -52
- package/dist/components/Ratings/Ratings.svelte.d.ts +0 -41
- package/dist/components/SlideToggle/SlideToggle.svelte +0 -91
- package/dist/components/SlideToggle/SlideToggle.svelte.d.ts +0 -44
- package/dist/components/Stepper/Step.svelte +0 -97
- package/dist/components/Stepper/Step.svelte.d.ts +0 -56
- package/dist/components/Stepper/Stepper.svelte +0 -107
- package/dist/components/Stepper/Stepper.svelte.d.ts +0 -85
- package/dist/components/Stepper/types.d.ts +0 -25
- package/dist/components/Stepper/types.js +0 -1
- package/dist/components/Tab/Tab.svelte +0 -95
- package/dist/components/Tab/Tab.svelte.d.ts +0 -49
- package/dist/components/Tab/TabAnchor.svelte +0 -45
- package/dist/components/Tab/TabAnchor.svelte.d.ts +0 -44
- package/dist/components/Tab/TabGroup.svelte +0 -42
- package/dist/components/Tab/TabGroup.svelte.d.ts +0 -43
- package/dist/components/Table/Table.svelte +0 -86
- package/dist/components/Table/Table.svelte.d.ts +0 -42
- package/dist/components/Table/actions.d.ts +0 -8
- package/dist/components/Table/actions.js +0 -114
- package/dist/components/Table/types.d.ts +0 -10
- package/dist/components/Table/types.js +0 -1
- package/dist/components/Table/utils.d.ts +0 -7
- package/dist/components/Table/utils.js +0 -33
- package/dist/components/TreeView/RecursiveTreeView.svelte +0 -64
- package/dist/components/TreeView/RecursiveTreeView.svelte.d.ts +0 -63
- package/dist/components/TreeView/RecursiveTreeViewItem.svelte +0 -141
- package/dist/components/TreeView/RecursiveTreeViewItem.svelte.d.ts +0 -38
- package/dist/components/TreeView/TreeView.svelte +0 -68
- package/dist/components/TreeView/TreeView.svelte.d.ts +0 -55
- package/dist/components/TreeView/TreeViewItem.svelte +0 -319
- package/dist/components/TreeView/TreeViewItem.svelte.d.ts +0 -145
- package/dist/components/TreeView/types.d.ts +0 -17
- package/dist/components/TreeView/types.js +0 -1
- package/dist/index.d.ts +0 -75
- package/dist/index.js +0 -79
- package/dist/internal/transitions.d.ts +0 -10
- package/dist/internal/transitions.js +0 -11
- package/dist/transitions/crossfade.d.ts +0 -1
- package/dist/transitions/crossfade.js +0 -21
- package/dist/types.d.ts +0 -8
- package/dist/types.js +0 -1
- package/dist/utilities/CodeBlock/CodeBlock.svelte +0 -70
- package/dist/utilities/CodeBlock/CodeBlock.svelte.d.ts +0 -43
- package/dist/utilities/CodeBlock/stores.d.ts +0 -2
- package/dist/utilities/CodeBlock/stores.js +0 -3
- package/dist/utilities/Drawer/Drawer.svelte +0 -182
- package/dist/utilities/Drawer/Drawer.svelte.d.ts +0 -62
- package/dist/utilities/Drawer/stores.d.ts +0 -34
- package/dist/utilities/Drawer/stores.js +0 -50
- package/dist/utilities/Drawer/types.d.ts +0 -42
- package/dist/utilities/Drawer/types.js +0 -2
- package/dist/utilities/LightSwitch/LightSwitch.svelte +0 -78
- package/dist/utilities/LightSwitch/LightSwitch.svelte.d.ts +0 -39
- package/dist/utilities/LightSwitch/lightswitch.d.ts +0 -21
- package/dist/utilities/LightSwitch/lightswitch.js +0 -72
- package/dist/utilities/LocalStorageStore/LocalStorageStore.d.ts +0 -12
- package/dist/utilities/LocalStorageStore/LocalStorageStore.js +0 -49
- package/dist/utilities/Modal/Modal.svelte +0 -247
- package/dist/utilities/Modal/Modal.svelte.d.ts +0 -72
- package/dist/utilities/Modal/ModalTest.svelte +0 -8
- package/dist/utilities/Modal/ModalTest.svelte.d.ts +0 -17
- package/dist/utilities/Modal/stores.d.ts +0 -36
- package/dist/utilities/Modal/stores.js +0 -54
- package/dist/utilities/Modal/types.d.ts +0 -41
- package/dist/utilities/Modal/types.js +0 -2
- package/dist/utilities/Popup/popup.d.ts +0 -7
- package/dist/utilities/Popup/popup.js +0 -240
- package/dist/utilities/Popup/types.d.ts +0 -40
- package/dist/utilities/Popup/types.js +0 -2
- package/dist/utilities/PrefersReducedMotion/PrefersReducedMotion.d.ts +0 -7
- package/dist/utilities/PrefersReducedMotion/PrefersReducedMotion.js +0 -26
- package/dist/utilities/TableOfContents/TableOfContents.svelte +0 -56
- package/dist/utilities/TableOfContents/TableOfContents.svelte.d.ts +0 -34
- package/dist/utilities/TableOfContents/crawler.d.ts +0 -16
- package/dist/utilities/TableOfContents/crawler.js +0 -78
- package/dist/utilities/TableOfContents/stores.d.ts +0 -6
- package/dist/utilities/TableOfContents/stores.js +0 -5
- package/dist/utilities/TableOfContents/types.d.ts +0 -5
- package/dist/utilities/TableOfContents/types.js +0 -2
- package/dist/utilities/Toast/Toast.svelte +0 -150
- package/dist/utilities/Toast/Toast.svelte.d.ts +0 -55
- package/dist/utilities/Toast/ToastTest.svelte +0 -16
- package/dist/utilities/Toast/ToastTest.svelte.d.ts +0 -20
- package/dist/utilities/Toast/stores.d.ts +0 -37
- package/dist/utilities/Toast/stores.js +0 -107
- package/dist/utilities/Toast/types.d.ts +0 -35
- package/dist/utilities/Toast/types.js +0 -2
- package/dist/utilities/index.d.ts +0 -18
- package/dist/utilities/index.js +0 -25
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
/** Bind FileList to the file input.*/
|
|
6
|
-
files?: FileList | undefined;
|
|
7
|
-
/** File input reference.*/
|
|
8
|
-
fileInput?: HTMLInputElement | undefined;
|
|
9
|
-
/** Required. Set a unique name for the file input.*/
|
|
10
|
-
name: string;
|
|
11
|
-
/** Provide classes to set the border styles.*/
|
|
12
|
-
border?: string | undefined;
|
|
13
|
-
/** Provide classes to set the padding styles.*/
|
|
14
|
-
padding?: string | undefined;
|
|
15
|
-
/** Provide classes to set the box radius styles.*/
|
|
16
|
-
rounded?: string | undefined;
|
|
17
|
-
/** Provide arbitrary styles for the UI region.*/
|
|
18
|
-
regionInterface?: string | undefined;
|
|
19
|
-
/** Provide arbitrary styles for the UI text region.*/
|
|
20
|
-
regionInterfaceText?: string | undefined;
|
|
21
|
-
/** Provide arbitrary styles for lead slot container.*/
|
|
22
|
-
slotLead?: string | undefined;
|
|
23
|
-
/** Provide arbitrary styles for message slot container.*/
|
|
24
|
-
slotMessage?: string | undefined;
|
|
25
|
-
/** Provide arbitrary styles for meta text slot container.*/
|
|
26
|
-
slotMeta?: string | undefined;
|
|
27
|
-
};
|
|
28
|
-
events: {
|
|
29
|
-
change: Event;
|
|
30
|
-
dragenter: DragEvent;
|
|
31
|
-
dragover: DragEvent;
|
|
32
|
-
dragleave: DragEvent;
|
|
33
|
-
drop: DragEvent;
|
|
34
|
-
click: MouseEvent;
|
|
35
|
-
keydown: KeyboardEvent;
|
|
36
|
-
keyup: KeyboardEvent;
|
|
37
|
-
keypress: KeyboardEvent;
|
|
38
|
-
focus: FocusEvent;
|
|
39
|
-
focusin: FocusEvent;
|
|
40
|
-
focusout: FocusEvent;
|
|
41
|
-
} & {
|
|
42
|
-
[evt: string]: CustomEvent<any>;
|
|
43
|
-
};
|
|
44
|
-
slots: {
|
|
45
|
-
lead: {};
|
|
46
|
-
message: {};
|
|
47
|
-
meta: {};
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
export type FileDropzoneProps = typeof __propDef.props;
|
|
51
|
-
export type FileDropzoneEvents = typeof __propDef.events;
|
|
52
|
-
export type FileDropzoneSlots = typeof __propDef.slots;
|
|
53
|
-
export default class FileDropzone extends SvelteComponentTyped<FileDropzoneProps, FileDropzoneEvents, FileDropzoneSlots> {
|
|
54
|
-
}
|
|
55
|
-
export {};
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
<script context="module">import { fly, scale } from "svelte/transition";
|
|
2
|
-
import { prefersReducedMotionStore } from "../../index.js";
|
|
3
|
-
import { dynamicTransition } from "../../internal/transitions.js";
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<script
|
|
7
|
-
|
|
8
|
-
generics="ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition"
|
|
9
|
-
>import { createEventDispatcher, onMount } from "svelte";
|
|
10
|
-
import { flip } from "svelte/animate";
|
|
11
|
-
const dispatch = createEventDispatcher();
|
|
12
|
-
export let input = "";
|
|
13
|
-
export let name;
|
|
14
|
-
export let value = [];
|
|
15
|
-
export let whitelist = [];
|
|
16
|
-
export let max = -1;
|
|
17
|
-
export let minlength = -1;
|
|
18
|
-
export let maxlength = -1;
|
|
19
|
-
export let allowUpperCase = false;
|
|
20
|
-
export let allowDuplicates = false;
|
|
21
|
-
export let validation = () => true;
|
|
22
|
-
export let duration = 150;
|
|
23
|
-
export let required = false;
|
|
24
|
-
export let chips = "variant-filled";
|
|
25
|
-
export let invalid = "input-error";
|
|
26
|
-
export let padding = "p-2";
|
|
27
|
-
export let rounded = "rounded-container-token";
|
|
28
|
-
export let regionChipWrapper = "";
|
|
29
|
-
export let regionChipList = "";
|
|
30
|
-
export let regionInput = "";
|
|
31
|
-
export let label = "Chips select";
|
|
32
|
-
export let transitions = !$prefersReducedMotionStore;
|
|
33
|
-
export let listTransitionIn = fly;
|
|
34
|
-
export let listTransitionInParams = { duration: 150, opacity: 0, y: -20 };
|
|
35
|
-
export let listTransitionOut = fly;
|
|
36
|
-
export let listTransitionOutParams = { duration: 150, opacity: 0, y: -20 };
|
|
37
|
-
export let chipTransitionIn = scale;
|
|
38
|
-
export let chipTransitionInParams = { duration: 150, opacity: 0 };
|
|
39
|
-
export let chipTransitionOut = scale;
|
|
40
|
-
export let chipTransitionOutParams = { duration: 150, opacity: 0 };
|
|
41
|
-
const cBase = "textarea cursor-pointer";
|
|
42
|
-
const cChipWrapper = "space-y-4";
|
|
43
|
-
const cChipList = "flex flex-wrap gap-2";
|
|
44
|
-
const cInputField = "unstyled bg-transparent border-0 !ring-0 p-0 w-full";
|
|
45
|
-
let inputValid = true;
|
|
46
|
-
let chipValues = value?.map((val) => {
|
|
47
|
-
return { val, id: Math.random() };
|
|
48
|
-
}) || [];
|
|
49
|
-
function resetFormHandler() {
|
|
50
|
-
value = [];
|
|
51
|
-
}
|
|
52
|
-
let selectElement;
|
|
53
|
-
onMount(() => {
|
|
54
|
-
if (!selectElement.form)
|
|
55
|
-
return;
|
|
56
|
-
const externalForm = selectElement.form;
|
|
57
|
-
externalForm.addEventListener("reset", resetFormHandler);
|
|
58
|
-
return () => {
|
|
59
|
-
externalForm.removeEventListener("reset", resetFormHandler);
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
function onInputHandler() {
|
|
63
|
-
inputValid = true;
|
|
64
|
-
}
|
|
65
|
-
function validateCustom(chip) {
|
|
66
|
-
return validation === void 0 || validation(chip);
|
|
67
|
-
}
|
|
68
|
-
function validateCount() {
|
|
69
|
-
return max === -1 || value.length < max;
|
|
70
|
-
}
|
|
71
|
-
function validateLength(chip) {
|
|
72
|
-
return (minlength === -1 || chip.length >= minlength) && (maxlength === -1 || chip.length <= maxlength);
|
|
73
|
-
}
|
|
74
|
-
function validateWhiteList(chip) {
|
|
75
|
-
return whitelist.length === 0 || whitelist.includes(chip);
|
|
76
|
-
}
|
|
77
|
-
function validateDuplicates(chip) {
|
|
78
|
-
return allowDuplicates || !value.includes(chip);
|
|
79
|
-
}
|
|
80
|
-
function validate(chip = "") {
|
|
81
|
-
if (!chip && !input)
|
|
82
|
-
return false;
|
|
83
|
-
chip = chip !== "" ? chip.trim() : input.trim();
|
|
84
|
-
return validateCustom(chip) && validateCount() && validateLength(chip) && validateWhiteList(chip) && validateDuplicates(chip);
|
|
85
|
-
}
|
|
86
|
-
function addChipCommon(chip) {
|
|
87
|
-
chip = allowUpperCase ? chip : chip.toLowerCase();
|
|
88
|
-
value.push(chip);
|
|
89
|
-
value = value;
|
|
90
|
-
chipValues.push({ val: chip, id: Math.random() });
|
|
91
|
-
chipValues = chipValues;
|
|
92
|
-
}
|
|
93
|
-
function removeChipCommon(chip) {
|
|
94
|
-
let chipIndex = value.indexOf(chip);
|
|
95
|
-
value.splice(chipIndex, 1);
|
|
96
|
-
value = value;
|
|
97
|
-
chipValues.splice(chipIndex, 1);
|
|
98
|
-
chipValues = chipValues;
|
|
99
|
-
}
|
|
100
|
-
function addChipInternally(event) {
|
|
101
|
-
event.preventDefault();
|
|
102
|
-
inputValid = validate();
|
|
103
|
-
if (inputValid === false) {
|
|
104
|
-
dispatch("invalid", { event, input });
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
addChipCommon(input);
|
|
108
|
-
dispatch("add", { event, chipIndex: value.length - 1, chipValue: input });
|
|
109
|
-
input = "";
|
|
110
|
-
}
|
|
111
|
-
function removeChipInternally(event, chipIndex, chipValue) {
|
|
112
|
-
if ($$restProps.disabled)
|
|
113
|
-
return;
|
|
114
|
-
removeChipCommon(chipValue);
|
|
115
|
-
dispatch("remove", { event, chipIndex, chipValue });
|
|
116
|
-
}
|
|
117
|
-
export function addChip(chip) {
|
|
118
|
-
inputValid = validate(chip);
|
|
119
|
-
if (inputValid === false) {
|
|
120
|
-
dispatch("invalidManually", { input: chip });
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
addChipCommon(chip);
|
|
124
|
-
dispatch("addManually", { chipIndex: value.length - 1, chipValue: chip });
|
|
125
|
-
}
|
|
126
|
-
export function removeChip(chip) {
|
|
127
|
-
if ($$restProps.disabled)
|
|
128
|
-
return;
|
|
129
|
-
removeChipCommon(chip);
|
|
130
|
-
dispatch("removeManually", { chipValue: chip });
|
|
131
|
-
}
|
|
132
|
-
$:
|
|
133
|
-
classesInvalid = inputValid === false ? invalid : "";
|
|
134
|
-
$:
|
|
135
|
-
classesBase = `${cBase} ${padding} ${rounded} ${$$props.class ?? ""} ${classesInvalid}`;
|
|
136
|
-
$:
|
|
137
|
-
classesChipWrapper = `${cChipWrapper} ${regionChipWrapper}`;
|
|
138
|
-
$:
|
|
139
|
-
classesChipList = `${cChipList} ${regionChipList}`;
|
|
140
|
-
$:
|
|
141
|
-
classesInput = `${cInputField} ${regionInput}`;
|
|
142
|
-
$:
|
|
143
|
-
chipValues = value?.map((val, i) => {
|
|
144
|
-
if (chipValues[i]?.val === val)
|
|
145
|
-
return chipValues[i];
|
|
146
|
-
return { id: Math.random(), val };
|
|
147
|
-
}) || [];
|
|
148
|
-
</script>
|
|
149
|
-
|
|
150
|
-
<div class="input-chip {classesBase}" class:opacity-50={$$restProps.disabled}>
|
|
151
|
-
<!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
|
|
152
|
-
<div class="h-0 overflow-hidden">
|
|
153
|
-
<select bind:this={selectElement} bind:value {name} multiple {required} aria-label={label} tabindex="-1">
|
|
154
|
-
<!-- NOTE: options are required! -->
|
|
155
|
-
{#each value as option}<option value={option}>{option}</option>{/each}
|
|
156
|
-
</select>
|
|
157
|
-
</div>
|
|
158
|
-
<!-- Chip Wrapper -->
|
|
159
|
-
<div class="input-chip-wrapper {classesChipWrapper}">
|
|
160
|
-
<!-- Input Field -->
|
|
161
|
-
<form on:submit={addChipInternally}>
|
|
162
|
-
<input
|
|
163
|
-
type="text"
|
|
164
|
-
bind:value={input}
|
|
165
|
-
placeholder={$$restProps.placeholder ?? 'Enter values...'}
|
|
166
|
-
class="input-chip-field {classesInput}"
|
|
167
|
-
on:input={onInputHandler}
|
|
168
|
-
on:input
|
|
169
|
-
on:focus
|
|
170
|
-
on:blur
|
|
171
|
-
disabled={$$restProps.disabled}
|
|
172
|
-
/>
|
|
173
|
-
</form>
|
|
174
|
-
<!-- Chip List -->
|
|
175
|
-
{#if chipValues.length}
|
|
176
|
-
<div
|
|
177
|
-
class="input-chip-list {classesChipList}"
|
|
178
|
-
in:dynamicTransition|local={{ transition: listTransitionIn, params: listTransitionInParams, enabled: transitions }}
|
|
179
|
-
out:dynamicTransition|local={{ transition: listTransitionOut, params: listTransitionOutParams, enabled: transitions }}
|
|
180
|
-
>
|
|
181
|
-
{#each chipValues as { id, val }, i (id)}
|
|
182
|
-
<!-- Wrapping div required for FLIP animation -->
|
|
183
|
-
<div animate:flip={{ duration }}>
|
|
184
|
-
<button
|
|
185
|
-
type="button"
|
|
186
|
-
class="chip {chips}"
|
|
187
|
-
on:click={(e) => removeChipInternally(e, i, val)}
|
|
188
|
-
on:click
|
|
189
|
-
on:keypress
|
|
190
|
-
on:keydown
|
|
191
|
-
on:keyup
|
|
192
|
-
in:dynamicTransition|local={{ transition: chipTransitionIn, params: chipTransitionInParams, enabled: transitions }}
|
|
193
|
-
out:dynamicTransition|local={{ transition: chipTransitionOut, params: chipTransitionOutParams, enabled: transitions }}
|
|
194
|
-
>
|
|
195
|
-
<span>{val}</span>
|
|
196
|
-
<span>✕</span>
|
|
197
|
-
</button>
|
|
198
|
-
</div>
|
|
199
|
-
{/each}
|
|
200
|
-
</div>
|
|
201
|
-
{/if}
|
|
202
|
-
</div>
|
|
203
|
-
</div>
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { fly, scale } from 'svelte/transition';
|
|
3
|
-
import { type Transition, type TransitionParams } from '../../index.js';
|
|
4
|
-
type FlyTransition = typeof fly;
|
|
5
|
-
type ScaleTransition = typeof scale;
|
|
6
|
-
declare class __sveltets_Render<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> {
|
|
7
|
-
props(): {
|
|
8
|
-
[x: string]: any;
|
|
9
|
-
/** Bind the input value.*/
|
|
10
|
-
input?: string | undefined;
|
|
11
|
-
/** Set a unique select input name.*/
|
|
12
|
-
name: string;
|
|
13
|
-
/** An array of values.*/
|
|
14
|
-
value?: any[] | undefined;
|
|
15
|
-
/** Provide a whitelist of accepted values.*/
|
|
16
|
-
whitelist?: string[] | undefined;
|
|
17
|
-
/** Maximum number of chips. Set -1 to disable.*/
|
|
18
|
-
max?: number | undefined;
|
|
19
|
-
/** Set the minimum character length.*/
|
|
20
|
-
minlength?: number | undefined;
|
|
21
|
-
/** Set the maximum character length.*/
|
|
22
|
-
maxlength?: number | undefined;
|
|
23
|
-
/** When enabled, allows for uppercase values.*/
|
|
24
|
-
allowUpperCase?: boolean | undefined;
|
|
25
|
-
/** When enabled, allows for duplicate values.*/
|
|
26
|
-
allowDuplicates?: boolean | undefined;
|
|
27
|
-
/** Provide a custom validator function.*/
|
|
28
|
-
validation?: ((...args: any[]) => boolean) | undefined;
|
|
29
|
-
/** The duration of the flip (first, last, invert, play) animation.*/
|
|
30
|
-
duration?: number | undefined;
|
|
31
|
-
/** Set the required state for this input field.*/
|
|
32
|
-
required?: boolean | undefined;
|
|
33
|
-
/** Provide classes or a variant to style the chips.*/
|
|
34
|
-
chips?: string | undefined;
|
|
35
|
-
/** {{ event: Event, input: any }} invalid - Fires when the input value is invalid.*/
|
|
36
|
-
invalid?: string | undefined;
|
|
37
|
-
/** Provide classes to set padding styles.*/
|
|
38
|
-
padding?: string | undefined;
|
|
39
|
-
/** Provide classes to set border radius styles.*/
|
|
40
|
-
rounded?: string | undefined;
|
|
41
|
-
/** Provide arbitrary classes to style the chip wrapper region.*/
|
|
42
|
-
regionChipWrapper?: string | undefined;
|
|
43
|
-
/** Provide arbitrary classes to style the chip list region.*/
|
|
44
|
-
regionChipList?: string | undefined;
|
|
45
|
-
/** Provide arbitrary classes to style the input field region.*/
|
|
46
|
-
regionInput?: string | undefined;
|
|
47
|
-
/** Provide the ARIA label for the select input.*/
|
|
48
|
-
label?: string | undefined;
|
|
49
|
-
/** Enable/Disable transitions*/
|
|
50
|
-
transitions?: boolean | undefined;
|
|
51
|
-
/** Provide the transition used in list on entry.*/
|
|
52
|
-
listTransitionIn?: ListTransitionIn | undefined;
|
|
53
|
-
/** Transition params provided to `ListTransitionIn`.*/
|
|
54
|
-
listTransitionInParams?: TransitionParams<ListTransitionIn> | undefined;
|
|
55
|
-
/** Provide the transition used in list on exit.*/
|
|
56
|
-
listTransitionOut?: ListTransitionOut | undefined;
|
|
57
|
-
/** Transition params provided to `ListTransitionOut`.*/
|
|
58
|
-
listTransitionOutParams?: TransitionParams<ListTransitionOut> | undefined;
|
|
59
|
-
/** Provide the transition used in chip on entry.*/
|
|
60
|
-
chipTransitionIn?: ChipTransitionIn | undefined;
|
|
61
|
-
/** Transition params provided to `ChipTransitionIn`.*/
|
|
62
|
-
chipTransitionInParams?: TransitionParams<ChipTransitionIn> | undefined;
|
|
63
|
-
/** Provide the transition used in chip on exit.*/
|
|
64
|
-
chipTransitionOut?: ChipTransitionOut | undefined;
|
|
65
|
-
/** Transition params provided to `ChipTransitionOut`.*/
|
|
66
|
-
chipTransitionOutParams?: TransitionParams<ChipTransitionOut> | undefined;
|
|
67
|
-
addChip?: ((chip: string) => void) | undefined;
|
|
68
|
-
removeChip?: ((chip: string) => void) | undefined;
|
|
69
|
-
};
|
|
70
|
-
events(): {
|
|
71
|
-
input: Event;
|
|
72
|
-
focus: FocusEvent;
|
|
73
|
-
blur: FocusEvent;
|
|
74
|
-
click: MouseEvent;
|
|
75
|
-
keypress: KeyboardEvent;
|
|
76
|
-
keydown: KeyboardEvent;
|
|
77
|
-
keyup: KeyboardEvent;
|
|
78
|
-
add: CustomEvent<{
|
|
79
|
-
event: SubmitEvent;
|
|
80
|
-
chipIndex: number;
|
|
81
|
-
chipValue: string;
|
|
82
|
-
}>;
|
|
83
|
-
remove: CustomEvent<{
|
|
84
|
-
event: MouseEvent;
|
|
85
|
-
chipIndex: number;
|
|
86
|
-
chipValue: string;
|
|
87
|
-
}>;
|
|
88
|
-
addManually: CustomEvent<{
|
|
89
|
-
chipIndex: number;
|
|
90
|
-
chipValue: string;
|
|
91
|
-
}>;
|
|
92
|
-
removeManually: CustomEvent<{
|
|
93
|
-
chipValue: string;
|
|
94
|
-
}>;
|
|
95
|
-
invalid: CustomEvent<{
|
|
96
|
-
event: SubmitEvent;
|
|
97
|
-
input: string;
|
|
98
|
-
}>;
|
|
99
|
-
invalidManually: CustomEvent<{
|
|
100
|
-
input: string;
|
|
101
|
-
}>;
|
|
102
|
-
} & {
|
|
103
|
-
[evt: string]: CustomEvent<any>;
|
|
104
|
-
};
|
|
105
|
-
slots(): {};
|
|
106
|
-
}
|
|
107
|
-
export type InputChipProps<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> = ReturnType<__sveltets_Render<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>['props']>;
|
|
108
|
-
export type InputChipEvents<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> = ReturnType<__sveltets_Render<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>['events']>;
|
|
109
|
-
export type InputChipSlots<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> = ReturnType<__sveltets_Render<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>['slots']>;
|
|
110
|
-
export default class InputChip<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> extends SvelteComponentTyped<InputChipProps<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>, InputChipEvents<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>, InputChipSlots<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>> {
|
|
111
|
-
get addChip(): (chip: string) => void;
|
|
112
|
-
get removeChip(): (chip: string) => void;
|
|
113
|
-
}
|
|
114
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<script>import { setContext } from "svelte";
|
|
2
|
-
export let multiple = false;
|
|
3
|
-
export let disabled = false;
|
|
4
|
-
export let spacing = "space-y-1";
|
|
5
|
-
export let rounded = "rounded-token";
|
|
6
|
-
export let active = "variant-filled";
|
|
7
|
-
export let hover = "hover:variant-soft";
|
|
8
|
-
export let padding = "px-4 py-2";
|
|
9
|
-
export let regionLead = "";
|
|
10
|
-
export let regionDefault = "";
|
|
11
|
-
export let regionTrail = "";
|
|
12
|
-
export let labelledby = "";
|
|
13
|
-
setContext("disabled", disabled);
|
|
14
|
-
setContext("multiple", multiple);
|
|
15
|
-
setContext("rounded", rounded);
|
|
16
|
-
setContext("active", active);
|
|
17
|
-
setContext("hover", hover);
|
|
18
|
-
setContext("padding", padding);
|
|
19
|
-
setContext("regionLead", regionLead);
|
|
20
|
-
setContext("regionDefault", regionDefault);
|
|
21
|
-
setContext("regionTrail", regionTrail);
|
|
22
|
-
const cBase = "";
|
|
23
|
-
$:
|
|
24
|
-
classesBase = `${cBase} ${spacing} ${rounded} ${$$props.class ?? ""}`;
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<div class="listbox {classesBase}" role="listbox" aria-labelledby={labelledby} data-testid="listbox">
|
|
28
|
-
<slot />
|
|
29
|
-
</div>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
/** Enable selection of multiple items.*/
|
|
6
|
-
multiple?: boolean | undefined;
|
|
7
|
-
/** Disables selection of items.*/
|
|
8
|
-
disabled?: boolean | undefined;
|
|
9
|
-
/** Provide class to set the vertical spacing style.*/
|
|
10
|
-
spacing?: string | undefined;
|
|
11
|
-
/** Provide classes to set the listbox box radius styles.*/
|
|
12
|
-
rounded?: string | undefined;
|
|
13
|
-
/** Provide classes to set the listbox item active background styles.*/
|
|
14
|
-
active?: string | undefined;
|
|
15
|
-
/** Provide classes to set the listbox item hover background styles.*/
|
|
16
|
-
hover?: string | undefined;
|
|
17
|
-
/** Provide classes to set the listbox item padding styles.*/
|
|
18
|
-
padding?: string | undefined;
|
|
19
|
-
/** Provide arbitrary classes to style the lead region.*/
|
|
20
|
-
regionLead?: string | undefined;
|
|
21
|
-
/** Provide arbitrary classes to the default region.*/
|
|
22
|
-
regionDefault?: string | undefined;
|
|
23
|
-
/** Provide arbitrary classes to the trail region.*/
|
|
24
|
-
regionTrail?: string | undefined;
|
|
25
|
-
/** Provide the ARIA labelledby value.*/
|
|
26
|
-
labelledby?: string | undefined;
|
|
27
|
-
};
|
|
28
|
-
events: {
|
|
29
|
-
[evt: string]: CustomEvent<any>;
|
|
30
|
-
};
|
|
31
|
-
slots: {
|
|
32
|
-
default: {};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export type ListBoxProps = typeof __propDef.props;
|
|
36
|
-
export type ListBoxEvents = typeof __propDef.events;
|
|
37
|
-
export type ListBoxSlots = typeof __propDef.slots;
|
|
38
|
-
export default class ListBox extends SvelteComponentTyped<ListBoxProps, ListBoxEvents, ListBoxSlots> {
|
|
39
|
-
}
|
|
40
|
-
export {};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
<script>import { getContext } from "svelte";
|
|
2
|
-
export let group;
|
|
3
|
-
export let name;
|
|
4
|
-
export let value;
|
|
5
|
-
export let disabled = getContext("disabled");
|
|
6
|
-
export let multiple = getContext("multiple");
|
|
7
|
-
export let rounded = getContext("rounded");
|
|
8
|
-
export let active = getContext("active");
|
|
9
|
-
export let hover = getContext("hover");
|
|
10
|
-
export let padding = getContext("padding");
|
|
11
|
-
export let regionLead = getContext("regionLead");
|
|
12
|
-
export let regionDefault = getContext("regionDefault");
|
|
13
|
-
export let regionTrail = getContext("regionTrail");
|
|
14
|
-
const cBase = "cursor-pointer -outline-offset-[3px]";
|
|
15
|
-
const cDisabled = "opacity-50 !cursor-default";
|
|
16
|
-
const cLabel = "flex items-center space-x-4";
|
|
17
|
-
let checked;
|
|
18
|
-
let elemInput;
|
|
19
|
-
function areDeeplyEqual(param1, param2) {
|
|
20
|
-
if (param1 === param2)
|
|
21
|
-
return true;
|
|
22
|
-
if (!(param1 instanceof Object) || !(param2 instanceof Object))
|
|
23
|
-
return false;
|
|
24
|
-
const keys1 = Object.keys(param1);
|
|
25
|
-
const keys2 = Object.keys(param2);
|
|
26
|
-
if (keys1.length !== keys2.length)
|
|
27
|
-
return false;
|
|
28
|
-
for (const key of keys1) {
|
|
29
|
-
const value1 = param1[key];
|
|
30
|
-
const value2 = param2[key];
|
|
31
|
-
if (!areDeeplyEqual(value1, value2))
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
$:
|
|
37
|
-
if (multiple)
|
|
38
|
-
updateCheckbox(group);
|
|
39
|
-
$:
|
|
40
|
-
if (multiple)
|
|
41
|
-
updateGroup(checked);
|
|
42
|
-
function updateCheckbox(group2) {
|
|
43
|
-
checked = group2.indexOf(value) >= 0;
|
|
44
|
-
}
|
|
45
|
-
function updateGroup(checked2) {
|
|
46
|
-
const index = group.indexOf(value);
|
|
47
|
-
if (checked2) {
|
|
48
|
-
if (index < 0) {
|
|
49
|
-
group.push(value);
|
|
50
|
-
group = group;
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
if (index >= 0) {
|
|
54
|
-
group.splice(index, 1);
|
|
55
|
-
group = group;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function onKeyDown(event) {
|
|
60
|
-
if (["Enter", "Space"].includes(event.code)) {
|
|
61
|
-
event.preventDefault();
|
|
62
|
-
elemInput.click();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const cRegionLead = "";
|
|
66
|
-
const cRegionDefault = "flex-1";
|
|
67
|
-
const cRegionTrail = "";
|
|
68
|
-
$:
|
|
69
|
-
selected = multiple ? group.some((groupVal) => areDeeplyEqual(value, groupVal)) : areDeeplyEqual(group, value);
|
|
70
|
-
$:
|
|
71
|
-
classesActive = selected ? active : !disabled ? hover : "";
|
|
72
|
-
$:
|
|
73
|
-
classesDisabled = disabled ? cDisabled : "";
|
|
74
|
-
$:
|
|
75
|
-
classesBase = `${cBase} ${classesDisabled} ${rounded} ${padding} ${classesActive} ${$$props.class ?? ""}`;
|
|
76
|
-
$:
|
|
77
|
-
classesLabel = `${cLabel}`;
|
|
78
|
-
$:
|
|
79
|
-
classesRegionLead = `${cRegionLead} ${regionLead}`;
|
|
80
|
-
$:
|
|
81
|
-
classesRegionDefault = `${cRegionDefault} ${regionDefault}`;
|
|
82
|
-
$:
|
|
83
|
-
classesRegionTrail = `${cRegionTrail} ${regionTrail}`;
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<label>
|
|
87
|
-
<!-- A11y attributes are not allowed on <label> -->
|
|
88
|
-
<div
|
|
89
|
-
class="listbox-item {classesBase}"
|
|
90
|
-
data-testid="listbox-item"
|
|
91
|
-
role="option"
|
|
92
|
-
aria-selected={selected}
|
|
93
|
-
tabindex="0"
|
|
94
|
-
on:keydown={onKeyDown}
|
|
95
|
-
on:keydown
|
|
96
|
-
on:keyup
|
|
97
|
-
on:keypress
|
|
98
|
-
>
|
|
99
|
-
<!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
|
|
100
|
-
<div class="h-0 w-0 overflow-hidden">
|
|
101
|
-
{#if multiple}
|
|
102
|
-
<input {disabled} bind:this={elemInput} type="checkbox" {name} {value} bind:checked tabindex="-1" on:click on:change />
|
|
103
|
-
{:else}
|
|
104
|
-
<input {disabled} bind:this={elemInput} type="radio" bind:group {name} {value} tabindex="-1" on:click on:change />
|
|
105
|
-
{/if}
|
|
106
|
-
</div>
|
|
107
|
-
<!-- <slot /> -->
|
|
108
|
-
<div class="listbox-label {classesLabel}">
|
|
109
|
-
<!-- Slot: Lead -->
|
|
110
|
-
{#if $$slots.lead}<div class="listbox-label-lead {classesRegionLead}"><slot name="lead" /></div>{/if}
|
|
111
|
-
<!-- Slot: Default -->
|
|
112
|
-
<div class="listbox-label-content {classesRegionDefault}"><slot /></div>
|
|
113
|
-
<!-- Slot: Trail -->
|
|
114
|
-
{#if $$slots.trail}<div class="listbox-label-trail {classesRegionTrail}"><slot name="trail" /></div>{/if}
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
</label>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
[x: string]: any;
|
|
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
|
-
disabled?: boolean | undefined;
|
|
12
|
-
multiple?: string | undefined;
|
|
13
|
-
rounded?: string | undefined;
|
|
14
|
-
active?: string | undefined;
|
|
15
|
-
hover?: string | undefined;
|
|
16
|
-
padding?: string | undefined;
|
|
17
|
-
regionLead?: string | undefined;
|
|
18
|
-
regionDefault?: string | undefined;
|
|
19
|
-
regionTrail?: string | undefined;
|
|
20
|
-
};
|
|
21
|
-
events: {
|
|
22
|
-
keydown: KeyboardEvent;
|
|
23
|
-
keyup: KeyboardEvent;
|
|
24
|
-
keypress: KeyboardEvent;
|
|
25
|
-
click: MouseEvent;
|
|
26
|
-
change: Event;
|
|
27
|
-
} & {
|
|
28
|
-
[evt: string]: CustomEvent<any>;
|
|
29
|
-
};
|
|
30
|
-
slots: {
|
|
31
|
-
lead: {};
|
|
32
|
-
default: {};
|
|
33
|
-
trail: {};
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export type ListBoxItemProps = typeof __propDef.props;
|
|
37
|
-
export type ListBoxItemEvents = typeof __propDef.events;
|
|
38
|
-
export type ListBoxItemSlots = typeof __propDef.slots;
|
|
39
|
-
export default class ListBoxItem extends SvelteComponentTyped<ListBoxItemProps, ListBoxItemEvents, ListBoxItemSlots> {
|
|
40
|
-
}
|
|
41
|
-
export {};
|