@skeletonlabs/skeleton 0.92.2 → 0.124.2
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 +0 -1
- package/actions/Filters/filter.js +6 -9
- package/components/Accordion/Accordion.svelte +30 -0
- package/components/Accordion/Accordion.svelte.d.ts +37 -0
- package/components/Accordion/AccordionItem.svelte +83 -63
- package/components/Accordion/AccordionItem.svelte.d.ts +20 -6
- package/components/AppBar/AppBar.svelte +48 -49
- package/components/AppBar/AppBar.svelte.d.ts +20 -1
- package/components/AppRail/AppRail.svelte +20 -40
- package/components/AppRail/AppRail.svelte.d.ts +13 -1
- package/components/AppRail/AppRailTile.svelte +32 -43
- package/components/AppRail/AppRailTile.svelte.d.ts +10 -4
- package/components/AppShell/AppShell.svelte +30 -39
- package/components/AppShell/AppShell.svelte.d.ts +11 -0
- package/components/Avatar/Avatar.svelte +18 -35
- package/components/Avatar/Avatar.svelte.d.ts +16 -5
- package/components/ConicGradient/ConicGradient.svelte +43 -49
- package/components/ConicGradient/ConicGradient.svelte.d.ts +11 -0
- package/components/ConicGradient/settings.d.ts +2 -4
- package/components/ConicGradient/settings.js +2 -2
- package/components/FileButton/FileButton.svelte +19 -14
- package/components/FileButton/FileButton.svelte.d.ts +3 -1
- package/components/FileDropzone/FileDropzone.svelte +48 -88
- package/components/FileDropzone/FileDropzone.svelte.d.ts +24 -8
- package/components/InputChip/InputChip.svelte +111 -96
- package/components/InputChip/InputChip.svelte.d.ts +28 -5
- package/components/ListBox/ListBox.svelte +18 -54
- package/components/ListBox/ListBox.svelte.d.ts +11 -10
- package/components/ListBox/ListBoxItem.svelte +69 -75
- package/components/ListBox/ListBoxItem.svelte.d.ts +11 -7
- package/components/Paginator/Paginator.svelte +27 -43
- package/components/Paginator/Paginator.svelte.d.ts +13 -2
- package/components/ProgressBar/ProgressBar.svelte +25 -44
- package/components/ProgressBar/ProgressBar.svelte.d.ts +9 -1
- package/components/ProgressRadial/ProgressRadial.svelte +20 -40
- package/components/ProgressRadial/ProgressRadial.svelte.d.ts +9 -2
- package/components/Radio/RadioGroup.svelte +22 -44
- package/components/Radio/RadioGroup.svelte.d.ts +15 -7
- package/components/Radio/RadioItem.svelte +37 -45
- package/components/Radio/RadioItem.svelte.d.ts +10 -6
- package/components/RangeSlider/RangeSlider.svelte +26 -57
- package/components/RangeSlider/RangeSlider.svelte.d.ts +11 -2
- package/components/SlideToggle/SlideToggle.svelte +43 -54
- package/components/SlideToggle/SlideToggle.svelte.d.ts +11 -3
- package/components/Stepper/Step.svelte +69 -120
- package/components/Stepper/Step.svelte.d.ts +17 -18
- package/components/Stepper/Stepper.svelte +61 -61
- package/components/Stepper/Stepper.svelte.d.ts +28 -14
- package/components/Tab/Tab.svelte +48 -61
- package/components/Tab/Tab.svelte.d.ts +19 -14
- package/components/Tab/TabGroup.svelte +35 -66
- package/components/Tab/TabGroup.svelte.d.ts +25 -9
- package/components/Table/Table.svelte +20 -36
- package/components/Table/Table.svelte.d.ts +9 -0
- package/components/TableOfContents/TableOfContents.svelte +63 -94
- package/components/TableOfContents/TableOfContents.svelte.d.ts +12 -0
- package/index.d.ts +2 -6
- package/index.js +1 -6
- package/package.json +39 -29
- package/styles/all.css +3 -3
- package/styles/core.css +11 -2
- package/styles/elements/alerts.css +2 -28
- package/styles/elements/badges.css +0 -25
- package/styles/elements/breadcrumbs.css +2 -3
- package/styles/elements/buttons.css +33 -120
- package/styles/elements/cards.css +2 -29
- package/styles/elements/chips.css +9 -58
- package/styles/elements/forms.css +269 -0
- package/styles/elements/lists.css +5 -4
- package/styles/elements/logo-clouds.css +2 -4
- package/styles/elements/tables.css +14 -10
- package/styles/elements.css +1 -0
- package/styles/tailwind.css +7 -3
- package/styles/typography.css +46 -62
- package/styles/variants.css +154 -0
- package/tailwind/core.cjs +37 -0
- package/tailwind/core.d.cts +5 -0
- package/tailwind/generated/intellisense-classes.cjs +1 -0
- package/tailwind/generated/{allComponents.d.cts → intellisense-classes.d.cts} +886 -1029
- package/tailwind/intellisense.cjs +21 -0
- package/tailwind/intellisense.d.cts +5 -0
- package/tailwind/settings.cjs +16 -16
- package/tailwind/skeleton.cjs +13 -44
- package/tailwind/skeleton.d.cts +4 -2
- package/tailwind/theme/colors.cjs +7 -7
- package/tailwind/tokens/backgrounds.cjs +28 -30
- package/tailwind/tokens/border-radius.cjs +15 -15
- package/tailwind/tokens/borders.cjs +14 -14
- package/tailwind/tokens/fills.cjs +14 -14
- package/tailwind/tokens/rings.cjs +40 -32
- package/tailwind/tokens/rings.d.cts +5 -0
- package/tailwind/tokens/text.cjs +24 -26
- package/themes/theme-skeleton.css +6 -6
- package/utilities/CodeBlock/CodeBlock.svelte +28 -40
- package/utilities/CodeBlock/CodeBlock.svelte.d.ts +8 -0
- package/utilities/DataTable/DataTable.js +1 -1
- package/utilities/Drawer/Drawer.svelte +82 -105
- package/utilities/Drawer/Drawer.svelte.d.ts +13 -0
- package/utilities/LightSwitch/LightSwitch.svelte +32 -50
- package/utilities/LightSwitch/LightSwitch.svelte.d.ts +3 -1
- package/utilities/Modal/Modal.svelte +58 -93
- package/utilities/Modal/Modal.svelte.d.ts +18 -0
- package/utilities/Modal/examples/ModalExampleEmbed.svelte +3 -6
- package/utilities/Modal/examples/ModalExampleForm.svelte +16 -22
- package/utilities/Modal/examples/ModalExampleImage.svelte +19 -0
- package/utilities/Modal/examples/ModalExampleImage.svelte.d.ts +16 -0
- package/utilities/Modal/examples/ModalExampleList.svelte +11 -15
- package/utilities/Toast/Toast.svelte +65 -87
- package/utilities/Toast/Toast.svelte.d.ts +12 -0
- package/utilities/Toast/stores.js +13 -4
- package/components/Accordion/AccordionGroup.svelte +0 -46
- package/components/Accordion/AccordionGroup.svelte.d.ts +0 -24
- package/components/Alert/Alert.svelte +0 -65
- package/components/Alert/Alert.svelte.d.ts +0 -30
- package/components/Breadcrumb/Breadcrumb.svelte +0 -24
- package/components/Breadcrumb/Breadcrumb.svelte.d.ts +0 -21
- package/components/Breadcrumb/Crumb.svelte +0 -37
- package/components/Breadcrumb/Crumb.svelte.d.ts +0 -26
- package/components/Divider/Divider.svelte +0 -21
- package/components/Divider/Divider.svelte.d.ts +0 -22
- package/components/GradientHeading/GradientHeading.svelte +0 -21
- package/components/GradientHeading/GradientHeading.svelte.d.ts +0 -22
- package/components/SvgIcon/SvgIcon.svelte +0 -45
- 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/forms.css +0 -178
- package/tailwind/generated/allComponents.cjs +0 -1
|
@@ -1,95 +1,55 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/** Provide styles to set the dropzone height. */
|
|
20
|
-
export let height = 'h-24';
|
|
21
|
-
/** Provide styles to set the dropzone padding. */
|
|
22
|
-
export let padding = 'p-4';
|
|
23
|
-
/** Provide styles to set the dropzone text color. */
|
|
24
|
-
export let color = '';
|
|
25
|
-
// Classes
|
|
26
|
-
const cBase = 'relative';
|
|
27
|
-
const cMessage = 'absolute top-0 left-0 right-0 bottom-0 z-[1] max-w-[480px] mx-auto flex justify-center items-center !pointer-events-none';
|
|
28
|
-
const cInput = '!border-2 border-dashed cursor-pointer !text-transparent !rounded-container-token';
|
|
29
|
-
// Local
|
|
30
|
-
let elemIcon;
|
|
31
|
-
// Drag and Drop Event Handlers
|
|
32
|
-
// Handles icon animation and passes events up
|
|
33
|
-
function onDragOver(event) {
|
|
34
|
-
/** @event {{ event: DragEvent }} dragover - When a file is dragged over the component. */
|
|
35
|
-
dispatch('dragover', event);
|
|
36
|
-
elemIcon?.classList.add('animate-bounce');
|
|
37
|
-
}
|
|
38
|
-
function onDragLeave(event) {
|
|
39
|
-
/** @event {{ event: DragEvent }} dragleave - When a file is dragged out off the component. */
|
|
40
|
-
dispatch('dragleave', event);
|
|
41
|
-
elemIcon?.classList.remove('animate-bounce');
|
|
42
|
-
}
|
|
43
|
-
function onDrop(event) {
|
|
44
|
-
/** @event {{ event: DragEvent }} drop - When a file is dropped on the component. */
|
|
45
|
-
dispatch('drop', event);
|
|
46
|
-
elemIcon?.classList.remove('animate-bounce');
|
|
47
|
-
}
|
|
48
|
-
// Reactive
|
|
49
|
-
$: classesBase = `${cBase} ${width} ${$$props.class ?? ''}`;
|
|
50
|
-
$: classesMessage = `${cMessage} ${color} ${height} ${padding}`;
|
|
51
|
-
$: classesInput = `${cInput} ${height} ${padding}`;
|
|
52
|
-
// Prune $$restProps to avoid overwriting $$props.class
|
|
1
|
+
<script>export let name;
|
|
2
|
+
export let border = "border-2 border-dashed";
|
|
3
|
+
export let padding = "p-4 py-8";
|
|
4
|
+
export let rounded = "rounded-container-token";
|
|
5
|
+
export let regionInterface = "";
|
|
6
|
+
export let regionInterfaceText = "";
|
|
7
|
+
export let slotLead = "mb-4";
|
|
8
|
+
export let slotMessage = "";
|
|
9
|
+
export let slotMeta = "opacity-75";
|
|
10
|
+
const cBase = "textarea relative";
|
|
11
|
+
const cInput = "absolute top-0 left-0 right-0 bottom-0 z-[1] opacity-0 disabled:!opacity-0 cursor-pointer";
|
|
12
|
+
const cInterface = "flex justify-center items-center text-center";
|
|
13
|
+
$:
|
|
14
|
+
classesBase = `${cBase} ${border} ${padding} ${rounded} ${$$props.class ?? ""}`;
|
|
15
|
+
$:
|
|
16
|
+
classesInput = `${cInput}`;
|
|
17
|
+
$:
|
|
18
|
+
classesInterface = `${cInterface}`;
|
|
53
19
|
function prunedRestProps() {
|
|
54
|
-
|
|
55
|
-
|
|
20
|
+
delete $$restProps.class;
|
|
21
|
+
return $$restProps;
|
|
56
22
|
}
|
|
57
23
|
</script>
|
|
58
24
|
|
|
59
|
-
<div
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
</
|
|
25
|
+
<div class="dropzone {classesBase}" class:opacity-50={$$restProps.disabled} data-testid="file-dropzone">
|
|
26
|
+
<!-- Input: File (hidden) -->
|
|
27
|
+
<input
|
|
28
|
+
type="file"
|
|
29
|
+
{name}
|
|
30
|
+
class="dropzone-input {classesInput}"
|
|
31
|
+
{...prunedRestProps()}
|
|
32
|
+
on:change
|
|
33
|
+
on:dragenter
|
|
34
|
+
on:dragover
|
|
35
|
+
on:dragleave
|
|
36
|
+
on:drop
|
|
37
|
+
on:click
|
|
38
|
+
on:keydown
|
|
39
|
+
on:keyup
|
|
40
|
+
on:keypress
|
|
41
|
+
/>
|
|
42
|
+
<!-- Interface -->
|
|
43
|
+
<div class="dropzone-interface {classesInterface} {regionInterface}">
|
|
44
|
+
<div class="dropzone-interface-text {regionInterfaceText}">
|
|
45
|
+
<!-- Lead -->
|
|
46
|
+
{#if $$slots.lead}<div class="dropzone-lead {slotLead}"><slot name="lead" /></div>{/if}
|
|
47
|
+
<!-- Message -->
|
|
48
|
+
<div class="dropzone-message {slotMessage}">
|
|
49
|
+
<slot name="message"><strong>Upload a file</strong> or drag and drop</slot>
|
|
84
50
|
</div>
|
|
85
|
-
|
|
51
|
+
<!-- Meta Text -->
|
|
52
|
+
{#if $$slots.meta}<small class="dropzone-meta {slotMeta}"><slot name="meta" /></small>{/if}
|
|
53
|
+
</div>
|
|
86
54
|
</div>
|
|
87
|
-
<!-- Input: File -->
|
|
88
|
-
<input bind:files type="file" {...prunedRestProps()} class="file-dropzone-input {classesInput}" on:change />
|
|
89
55
|
</div>
|
|
90
|
-
|
|
91
|
-
<style>
|
|
92
|
-
/* Hide Input:File Content */
|
|
93
|
-
::file-selector-button {
|
|
94
|
-
display: none
|
|
95
|
-
}</style>
|
|
@@ -2,26 +2,42 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
/** Required. Set a unique name for the file input.*/
|
|
6
|
+
name: string;
|
|
7
|
+
/** Provide classes to set the border styles.*/
|
|
8
|
+
border?: string | undefined;
|
|
9
|
+
/** Provide classes to set the padding styles.*/
|
|
10
10
|
padding?: string | undefined;
|
|
11
|
-
|
|
11
|
+
/** Provide classes to set the box radius styles.*/
|
|
12
|
+
rounded?: string | undefined;
|
|
13
|
+
/** Provide abitrary styles for the UI region.*/
|
|
14
|
+
regionInterface?: string | undefined;
|
|
15
|
+
/** Provide abitrary styles for the UI text region.*/
|
|
16
|
+
regionInterfaceText?: string | undefined;
|
|
17
|
+
/** Provide abitrary styles for lead slot container.*/
|
|
18
|
+
slotLead?: string | undefined;
|
|
19
|
+
/** Provide abitrary styles for message slot container.*/
|
|
20
|
+
slotMessage?: string | undefined;
|
|
21
|
+
/** Provide abitrary styles for meta text slot container.*/
|
|
22
|
+
slotMeta?: string | undefined;
|
|
12
23
|
};
|
|
13
24
|
events: {
|
|
25
|
+
change: Event;
|
|
14
26
|
dragenter: DragEvent;
|
|
27
|
+
dragover: DragEvent;
|
|
28
|
+
dragleave: DragEvent;
|
|
29
|
+
drop: DragEvent;
|
|
15
30
|
click: MouseEvent;
|
|
16
31
|
keydown: KeyboardEvent;
|
|
17
32
|
keyup: KeyboardEvent;
|
|
18
33
|
keypress: KeyboardEvent;
|
|
19
|
-
change: Event;
|
|
20
34
|
} & {
|
|
21
35
|
[evt: string]: CustomEvent<any>;
|
|
22
36
|
};
|
|
23
37
|
slots: {
|
|
24
|
-
|
|
38
|
+
lead: {};
|
|
39
|
+
message: {};
|
|
40
|
+
meta: {};
|
|
25
41
|
};
|
|
26
42
|
};
|
|
27
43
|
export type FileDropzoneProps = typeof __propDef.props;
|
|
@@ -1,107 +1,122 @@
|
|
|
1
|
-
<script>import { createEventDispatcher } from
|
|
2
|
-
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte/internal";
|
|
2
|
+
import { fly, scale } from "svelte/transition";
|
|
3
|
+
import { flip } from "svelte/animate";
|
|
3
4
|
const dispatch = createEventDispatcher();
|
|
4
|
-
|
|
5
|
-
/** Optionally provide an semantic label. */
|
|
6
|
-
export let label = '';
|
|
7
|
-
/** Optionally provide an input placeholder. */
|
|
5
|
+
export let name;
|
|
8
6
|
export let value = [];
|
|
9
|
-
/**
|
|
10
|
-
* Provide a whitelist of accepted values.
|
|
11
|
-
* @type {string[]}
|
|
12
|
-
*/
|
|
13
7
|
export let whitelist = [];
|
|
14
|
-
|
|
8
|
+
export let max = -1;
|
|
9
|
+
export let minlength = -1;
|
|
10
|
+
export let maxlength = -1;
|
|
15
11
|
export let allowUpperCase = false;
|
|
16
|
-
|
|
17
|
-
export let allowDuplicates = true;
|
|
18
|
-
/**
|
|
19
|
-
* Provide a custom validation function.
|
|
20
|
-
* @type {function}
|
|
21
|
-
*/
|
|
12
|
+
export let allowDuplicates = false;
|
|
22
13
|
export let validation = () => true;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export let
|
|
26
|
-
|
|
27
|
-
export let
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// Classes
|
|
38
|
-
const cBase = 'unstyled border-token flex flex-wrap gap-2 items-center';
|
|
39
|
-
const cLabel = 'unstyled w-full md:w-auto mr-2';
|
|
40
|
-
const cInput = 'unstyled flex-auto border-transparent bg-transparent text-base px-1 py-0 focus:border-transparent min-h-[30px]';
|
|
41
|
-
function resetValiadtionClass() {
|
|
42
|
-
inputValueValid = true;
|
|
14
|
+
export let duration = 150;
|
|
15
|
+
export let required = false;
|
|
16
|
+
export let chips = "variant-filled";
|
|
17
|
+
export let invalid = "input-error";
|
|
18
|
+
export let padding = "p-2";
|
|
19
|
+
export let rounded = "rounded-container-token";
|
|
20
|
+
const cBase = "textarea cursor-pointer";
|
|
21
|
+
const cInterface = "space-y-4";
|
|
22
|
+
const cChipList = "flex flex-wrap gap-2";
|
|
23
|
+
const cInputField = "unstyled bg-transparent border-0 !ring-0 p-0 w-full";
|
|
24
|
+
let inputValue = "";
|
|
25
|
+
let inputValid = true;
|
|
26
|
+
function onInputHandler() {
|
|
27
|
+
inputValid = true;
|
|
43
28
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
// Format: trim value
|
|
62
|
-
inputValue = inputValue.trim();
|
|
63
|
-
// Format: to lowercase (if enabled)
|
|
64
|
-
inputValue = allowUpperCase ? inputValue : inputValue.toLowerCase();
|
|
65
|
-
// Append value
|
|
66
|
-
value = [...value, inputValue];
|
|
67
|
-
// Clear input value
|
|
68
|
-
inputValue = '';
|
|
69
|
-
/** @event {{ event: KeyboardEvent }} add - When a chip is added. */
|
|
70
|
-
dispatch('add', event);
|
|
29
|
+
function validate() {
|
|
30
|
+
if (!inputValue)
|
|
31
|
+
return false;
|
|
32
|
+
if (validation !== void 0 && !validation(inputValue))
|
|
33
|
+
return false;
|
|
34
|
+
if (max !== -1 && value.length >= max)
|
|
35
|
+
return false;
|
|
36
|
+
if (minlength !== -1 && inputValue.length < minlength)
|
|
37
|
+
return false;
|
|
38
|
+
if (maxlength !== -1 && inputValue.length > maxlength)
|
|
39
|
+
return false;
|
|
40
|
+
if (whitelist.length > 0 && !whitelist.includes(inputValue))
|
|
41
|
+
return false;
|
|
42
|
+
if (allowDuplicates === false && value.includes(inputValue))
|
|
43
|
+
return false;
|
|
44
|
+
return true;
|
|
71
45
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
46
|
+
function addChip(event) {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
inputValid = validate();
|
|
49
|
+
if (inputValid === false)
|
|
50
|
+
return;
|
|
51
|
+
inputValue = inputValue.trim();
|
|
52
|
+
inputValue = allowUpperCase ? inputValue : inputValue.toLowerCase();
|
|
53
|
+
value = [...value, inputValue];
|
|
54
|
+
dispatch("add", { event, chipIndex: value.length - 1, chipValue: inputValue });
|
|
55
|
+
inputValue = "";
|
|
76
56
|
}
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
return
|
|
57
|
+
function removeChip(event, chipIndex, chipValue) {
|
|
58
|
+
if ($$restProps.disabled)
|
|
59
|
+
return;
|
|
60
|
+
value = value.filter((_, i) => i !== chipIndex);
|
|
61
|
+
dispatch("remove", { event, chipIndex, chipValue });
|
|
80
62
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
$:
|
|
84
|
-
|
|
63
|
+
$:
|
|
64
|
+
classesInvalid = inputValid === false ? invalid : "";
|
|
65
|
+
$:
|
|
66
|
+
classesBase = `${cBase} ${padding} ${rounded} ${$$props.class ?? ""} ${classesInvalid}`;
|
|
67
|
+
$:
|
|
68
|
+
classesInterface = `${cInterface}`;
|
|
69
|
+
$:
|
|
70
|
+
classesChipList = `${cChipList}`;
|
|
71
|
+
$:
|
|
72
|
+
classesInputField = `${cInputField}`;
|
|
85
73
|
</script>
|
|
86
74
|
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
75
|
+
<div class="input-chip {classesBase}" class:opacity-50={$$restProps.disabled}>
|
|
76
|
+
<!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
|
|
77
|
+
<div class="h-0 overflow-hidden">
|
|
78
|
+
<select bind:value {name} multiple {required}>
|
|
79
|
+
<!-- NOTE: options are required! -->
|
|
80
|
+
{#each value as option}<option value={option}>{option}</option>{/each}
|
|
81
|
+
</select>
|
|
82
|
+
</div>
|
|
83
|
+
<!-- Interface -->
|
|
84
|
+
<div class="input-chip-interface {classesInterface}">
|
|
85
|
+
<!-- Input Field -->
|
|
86
|
+
<form on:submit={addChip}>
|
|
87
|
+
<input
|
|
88
|
+
type="text"
|
|
89
|
+
bind:value={inputValue}
|
|
90
|
+
placeholder={$$restProps.placeholder ?? 'Enter values...'}
|
|
91
|
+
class="input-chip-field {classesInputField}"
|
|
92
|
+
on:input={onInputHandler}
|
|
93
|
+
on:input
|
|
94
|
+
disabled={$$restProps.disabled}
|
|
95
|
+
/>
|
|
96
|
+
</form>
|
|
97
|
+
<!-- Chip List -->
|
|
98
|
+
{#if value.length}
|
|
99
|
+
<div class="input-chip-list {classesChipList}" transition:fly|local={{ duration, opacity: 0, y: -20 }}>
|
|
100
|
+
{#each value as c, i (c)}
|
|
101
|
+
<!-- Wrapping div required for FLIP animation -->
|
|
102
|
+
<div animate:flip={{ duration }}>
|
|
103
|
+
<span
|
|
104
|
+
class="chip {chips}"
|
|
105
|
+
on:click={(e) => {
|
|
106
|
+
removeChip(e, i, c);
|
|
107
|
+
}}
|
|
108
|
+
on:click
|
|
109
|
+
on:keypress
|
|
110
|
+
on:keydown
|
|
111
|
+
on:keyup
|
|
112
|
+
transition:scale|local={{ duration, opacity: 0 }}
|
|
113
|
+
>
|
|
114
|
+
<span>{c}</span>
|
|
115
|
+
<span>✕</span>
|
|
116
|
+
</span>
|
|
117
|
+
</div>
|
|
118
|
+
{/each}
|
|
119
|
+
</div>
|
|
120
|
+
{/if}
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
@@ -2,20 +2,43 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** Set a unique select input name.*/
|
|
6
|
+
name: string;
|
|
7
|
+
/** An array of values.*/
|
|
8
|
+
value?: any[] | undefined;
|
|
9
|
+
/** Provide a whitelist of accepted values.*/
|
|
7
10
|
whitelist?: string[] | undefined;
|
|
11
|
+
/** Maximum number of chips. Set -1 to disable.*/
|
|
12
|
+
max?: number | undefined;
|
|
13
|
+
/** Set the minimum character length.*/
|
|
14
|
+
minlength?: number | undefined;
|
|
15
|
+
/** Set the maximum character length.*/
|
|
16
|
+
maxlength?: number | undefined;
|
|
17
|
+
/** When enabled, allows for uppercase values.*/
|
|
8
18
|
allowUpperCase?: boolean | undefined;
|
|
19
|
+
/** When enabled, allows for duplicate values.*/
|
|
9
20
|
allowDuplicates?: boolean | undefined;
|
|
21
|
+
/** Provide a custom validation function.*/
|
|
10
22
|
validation?: ((...args: any[]) => boolean) | undefined;
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
/** The duration of the animated fly effect.*/
|
|
24
|
+
duration?: number | undefined;
|
|
25
|
+
/** Set the required state for this input field.*/
|
|
26
|
+
required?: boolean | undefined;
|
|
27
|
+
/** Provide classes or a variant to style the chips.*/
|
|
28
|
+
chips?: string | undefined;
|
|
29
|
+
/** Provide classes used to indicate invalid state.*/
|
|
30
|
+
invalid?: string | undefined;
|
|
31
|
+
/** Provide classes to set padding styles.*/
|
|
13
32
|
padding?: string | undefined;
|
|
33
|
+
/** Provide classes to set border radius styles.*/
|
|
14
34
|
rounded?: string | undefined;
|
|
15
|
-
ring?: string | undefined;
|
|
16
35
|
};
|
|
17
36
|
events: {
|
|
37
|
+
input: Event;
|
|
38
|
+
click: MouseEvent;
|
|
18
39
|
keypress: KeyboardEvent;
|
|
40
|
+
keydown: KeyboardEvent;
|
|
41
|
+
keyup: KeyboardEvent;
|
|
19
42
|
} & {
|
|
20
43
|
[evt: string]: CustomEvent<any>;
|
|
21
44
|
};
|
|
@@ -1,57 +1,21 @@
|
|
|
1
|
-
<script>import { setContext } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/** Provide classes to set the item border radius styles. */
|
|
18
|
-
export let rounded = 'rounded-token';
|
|
19
|
-
/** Provide classes to set the item hover background color. */
|
|
20
|
-
export let hover = 'bg-primary-hover-token';
|
|
21
|
-
// Props (regions)
|
|
22
|
-
/** Provide arbitrary classes to the label element. */
|
|
23
|
-
export let regionLabel = '';
|
|
24
|
-
/** Provide arbitrary classes to the scrollable listbox element. */
|
|
25
|
-
export let regionList = '';
|
|
26
|
-
// Props (a11y)
|
|
27
|
-
/** Define a semantic ARIA label. */
|
|
28
|
-
export let label = '';
|
|
29
|
-
/**
|
|
30
|
-
* Set automatically based on the label text, but can be overwritten.
|
|
31
|
-
* @type {string}
|
|
32
|
-
*/
|
|
33
|
-
export let labelId = label?.toLowerCase().replace(' ', '-'); //AUDIT this doesn't seem to be consistently applied across Skeleton
|
|
34
|
-
// Context
|
|
35
|
-
setContext('selected', selected);
|
|
36
|
-
setContext('accent', accent);
|
|
37
|
-
setContext('padding', padding);
|
|
38
|
-
setContext('rounded', rounded);
|
|
39
|
-
setContext('hover', hover);
|
|
40
|
-
// Base Classes
|
|
41
|
-
const cBase = 'space-y-4';
|
|
42
|
-
const cLabel = 'font-bold text-lg';
|
|
43
|
-
const cListBox = 'list-none overflow-y-auto';
|
|
44
|
-
// Reactive
|
|
45
|
-
$: classesBase = `${cBase} ${$$props.class ?? ''}`;
|
|
46
|
-
$: classesLabel = `${cLabel}`;
|
|
47
|
-
$: classesListBox = `${cListBox} ${height} ${space}`;
|
|
1
|
+
<script>import { setContext } from "svelte";
|
|
2
|
+
export let multiple = false;
|
|
3
|
+
export let spacing = `space-y-1`;
|
|
4
|
+
export let rounded = "rounded-token";
|
|
5
|
+
export let active = "variant-filled";
|
|
6
|
+
export let hover = "hover:variant-soft";
|
|
7
|
+
export let padding = "px-4 py-2";
|
|
8
|
+
export let labelledby = "";
|
|
9
|
+
setContext("multiple", multiple);
|
|
10
|
+
setContext("rounded", rounded);
|
|
11
|
+
setContext("active", active);
|
|
12
|
+
setContext("hover", hover);
|
|
13
|
+
setContext("padding", padding);
|
|
14
|
+
const cBase = "cursor-pointer -outline-offset-[3px]";
|
|
15
|
+
$:
|
|
16
|
+
classesBase = `${cBase} ${spacing} ${rounded} ${$$props.class ?? ""}`;
|
|
48
17
|
</script>
|
|
49
18
|
|
|
50
|
-
<div class="listbox {classesBase}" data-testid="listbox
|
|
51
|
-
|
|
52
|
-
{#if label}<span class="listbox-label {classesLabel} {regionLabel}" id={labelId}>{label}</span>{/if}
|
|
53
|
-
<!-- Listbox -->
|
|
54
|
-
<ul class="listbox-list {classesListBox} {regionList}" role="listbox" aria-labelledby={labelId}>
|
|
55
|
-
<slot />
|
|
56
|
-
</ul>
|
|
19
|
+
<div class="listbox {classesBase}" role="listbox" aria-labelledby={labelledby} data-testid="listbox">
|
|
20
|
+
<slot />
|
|
57
21
|
</div>
|
|
@@ -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>;
|