@skeletonlabs/skeleton 0.99.5 → 0.132.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/actions/Filters/filter.js +6 -9
- package/components/Accordion/Accordion.svelte +34 -0
- package/components/Accordion/Accordion.svelte.d.ts +41 -0
- package/components/Accordion/AccordionItem.svelte +84 -39
- package/components/Accordion/AccordionItem.svelte.d.ts +24 -7
- package/components/AppBar/AppBar.svelte +36 -21
- package/components/AppBar/AppBar.svelte.d.ts +20 -1
- package/components/AppRail/AppRail.svelte +3 -2
- package/components/AppRail/AppRail.svelte.d.ts +13 -1
- package/components/AppRail/AppRailTile.svelte +10 -7
- package/components/AppRail/AppRailTile.svelte.d.ts +10 -4
- package/components/AppShell/AppShell.svelte +3 -2
- package/components/AppShell/AppShell.svelte.d.ts +11 -0
- package/components/Avatar/Avatar.svelte +9 -9
- package/components/Avatar/Avatar.svelte.d.ts +16 -5
- package/components/ConicGradient/ConicGradient.svelte +18 -8
- package/components/ConicGradient/ConicGradient.svelte.d.ts +11 -0
- package/components/ConicGradient/settings.d.ts +1 -5
- package/components/ConicGradient/settings.js +1 -2
- package/components/FileButton/FileButton.svelte +8 -6
- package/components/FileButton/FileButton.svelte.d.ts +3 -1
- package/components/FileDropzone/FileDropzone.svelte +43 -63
- package/components/FileDropzone/FileDropzone.svelte.d.ts +24 -8
- package/components/InputChip/InputChip.svelte +97 -52
- package/components/InputChip/InputChip.svelte.d.ts +28 -4
- package/components/ListBox/ListBox.svelte +13 -29
- package/components/ListBox/ListBox.svelte.d.ts +11 -10
- package/components/ListBox/ListBoxItem.svelte +60 -50
- package/components/ListBox/ListBoxItem.svelte.d.ts +12 -7
- package/components/Paginator/Paginator.svelte +4 -4
- package/components/Paginator/Paginator.svelte.d.ts +13 -2
- package/components/ProgressBar/ProgressBar.svelte +17 -24
- package/components/ProgressBar/ProgressBar.svelte.d.ts +9 -1
- package/components/ProgressRadial/ProgressRadial.svelte +6 -8
- package/components/ProgressRadial/ProgressRadial.svelte.d.ts +9 -2
- package/components/Radio/RadioGroup.svelte +13 -16
- package/components/Radio/RadioGroup.svelte.d.ts +15 -7
- package/components/Radio/RadioItem.svelte +25 -21
- package/components/Radio/RadioItem.svelte.d.ts +12 -7
- package/components/RangeSlider/RangeSlider.svelte +9 -17
- package/components/RangeSlider/RangeSlider.svelte.d.ts +11 -2
- package/components/SlideToggle/SlideToggle.svelte +10 -9
- package/components/SlideToggle/SlideToggle.svelte.d.ts +11 -3
- package/components/Stepper/Step.svelte +64 -107
- package/components/Stepper/Step.svelte.d.ts +17 -18
- package/components/Stepper/Stepper.svelte +58 -37
- package/components/Stepper/Stepper.svelte.d.ts +28 -14
- package/components/Tab/Tab.svelte +40 -38
- package/components/Tab/Tab.svelte.d.ts +20 -14
- package/components/Tab/TabGroup.svelte +28 -41
- package/components/Tab/TabGroup.svelte.d.ts +25 -9
- package/components/Table/Table.svelte.d.ts +9 -0
- package/components/TableOfContents/TableOfContents.svelte +3 -2
- package/components/TableOfContents/TableOfContents.svelte.d.ts +12 -0
- package/index.d.ts +5 -4
- package/index.js +10 -4
- package/package.json +24 -16
- package/styles/all.css +0 -3
- package/styles/elements/breadcrumbs.css +3 -4
- package/styles/elements/buttons.css +2 -4
- package/styles/elements/forms.css +265 -0
- package/styles/elements/lists.css +1 -1
- package/styles/elements/modals.css +15 -0
- package/styles/elements/popups.css +16 -0
- package/styles/elements.css +3 -2
- package/styles/typography.css +5 -5
- package/styles/variants.css +7 -7
- package/tailwind/core.cjs +1 -1
- package/tailwind/generated/intellisense-classes.cjs +1 -1
- package/tailwind/generated/intellisense-classes.d.cts +318 -404
- package/tailwind/intellisense.cjs +2 -2
- package/tailwind/skeleton.cjs +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/tailwind.d.ts +4 -0
- package/types/tailwind.js +2 -0
- package/utilities/CodeBlock/CodeBlock.svelte +14 -8
- package/utilities/CodeBlock/CodeBlock.svelte.d.ts +17 -1
- package/utilities/Drawer/Drawer.svelte +50 -37
- package/utilities/Drawer/Drawer.svelte.d.ts +20 -1
- package/utilities/Drawer/types.d.ts +8 -2
- package/utilities/LightSwitch/LightSwitch.svelte +43 -53
- package/utilities/LightSwitch/LightSwitch.svelte.d.ts +18 -2
- package/utilities/LightSwitch/lightswitch.d.ts +20 -0
- package/utilities/LightSwitch/lightswitch.js +71 -0
- package/utilities/LocalStorageStore/LocalStorageStore.js +1 -1
- package/utilities/Modal/Modal.svelte +96 -64
- package/utilities/Modal/Modal.svelte.d.ts +29 -0
- package/utilities/Modal/types.d.ts +9 -5
- package/utilities/Popup/popup.d.ts +7 -0
- package/utilities/Popup/popup.js +218 -0
- package/utilities/Popup/types.d.ts +32 -0
- package/utilities/Popup/types.js +3 -0
- package/utilities/Toast/Toast.svelte +17 -13
- package/utilities/Toast/Toast.svelte.d.ts +14 -0
- package/utilities/Toast/stores.js +9 -26
- package/utilities/Toast/types.d.ts +6 -1
- package/components/Accordion/AccordionGroup.svelte +0 -33
- package/components/Accordion/AccordionGroup.svelte.d.ts +0 -24
- package/components/SvgIcon/SvgIcon.svelte +0 -33
- package/components/SvgIcon/SvgIcon.svelte.d.ts +0 -26
- package/components/SvgIcon/icons.d.ts +0 -1
- package/components/SvgIcon/icons.js +0 -25
- package/styles/elements/menus.css +0 -29
- package/styles/elements/tooltips.css +0 -83
- package/styles/forms.css +0 -195
- package/utilities/LightSwitch/stores.d.ts +0 -2
- package/utilities/LightSwitch/stores.js +0 -5
- package/utilities/Menu/menu.d.ts +0 -18
- package/utilities/Menu/menu.js +0 -151
- package/utilities/Modal/examples/ModalExampleEmbed.svelte +0 -17
- package/utilities/Modal/examples/ModalExampleEmbed.svelte.d.ts +0 -17
- package/utilities/Modal/examples/ModalExampleForm.svelte +0 -41
- package/utilities/Modal/examples/ModalExampleForm.svelte.d.ts +0 -17
- package/utilities/Modal/examples/ModalExampleImage.svelte +0 -19
- package/utilities/Modal/examples/ModalExampleImage.svelte.d.ts +0 -16
- package/utilities/Modal/examples/ModalExampleList.svelte +0 -27
- package/utilities/Modal/examples/ModalExampleList.svelte.d.ts +0 -17
- package/utilities/Tooltip/tooltip.d.ts +0 -35
- package/utilities/Tooltip/tooltip.js +0 -94
|
@@ -2,17 +2,28 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
+
/** Initials only - Provide up to two text characters.*/
|
|
6
|
+
initials?: string | undefined;
|
|
7
|
+
/** Initials only - Provide classes to set the SVG text fill color.*/
|
|
8
|
+
fill?: string | undefined;
|
|
9
|
+
/** Provide the avatar image element source.*/
|
|
10
|
+
src?: string | undefined;
|
|
11
|
+
/** Image only. Provide an Svelte action reference, such as `filter`.*/
|
|
12
|
+
action?: any;
|
|
13
|
+
/** Image only. Provide Svelte action params, such as Apollo.*/
|
|
14
|
+
actionParams?: string | undefined;
|
|
15
|
+
/** Provide classes to set background styles.*/
|
|
5
16
|
background?: string | undefined;
|
|
17
|
+
/** Provide classes to set avatar width.*/
|
|
6
18
|
width?: string | undefined;
|
|
19
|
+
/** Provide classes to set border styles.*/
|
|
7
20
|
border?: string | undefined;
|
|
21
|
+
/** Provide classes to set rounded style.*/
|
|
8
22
|
rounded?: string | undefined;
|
|
23
|
+
/** Provide classes to set shadow styles.*/
|
|
9
24
|
shadow?: string | undefined;
|
|
25
|
+
/** Provide classes to set cursor styles.*/
|
|
10
26
|
cursor?: string | undefined;
|
|
11
|
-
initials?: string | undefined;
|
|
12
|
-
fill?: string | undefined;
|
|
13
|
-
src?: string | undefined;
|
|
14
|
-
action?: any;
|
|
15
|
-
actionParams?: string | undefined;
|
|
16
27
|
};
|
|
17
28
|
events: {
|
|
18
29
|
click: MouseEvent;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { afterUpdate } from "svelte";
|
|
2
|
+
import { tailwindDefaultColors } from "./settings";
|
|
2
3
|
export let stops = [{ color: ["neutral", 500], start: 0, end: 100 }];
|
|
3
4
|
export let legend = false;
|
|
4
5
|
export let spin = false;
|
|
5
6
|
export let width = "w-full";
|
|
6
7
|
export let hover = "bg-primary-hover-token";
|
|
8
|
+
export let regionCaption = "";
|
|
9
|
+
export let regionCone = "";
|
|
10
|
+
export let regionLegend = "";
|
|
7
11
|
let cone;
|
|
8
12
|
let generatedLegendList;
|
|
9
13
|
const cBase = "flex flex-col items-center space-y-4";
|
|
10
14
|
const cCaption = "text-center";
|
|
11
15
|
const cCone = "block aspect-square rounded-full";
|
|
12
|
-
const
|
|
16
|
+
const cLegend = "text-sm w-full";
|
|
13
17
|
const cSwatch = "block aspect-square bg-black w-5 rounded-full mr-2";
|
|
14
18
|
function setColorValue(color) {
|
|
15
19
|
if (typeof color === "string")
|
|
@@ -32,26 +36,32 @@ function genLegend() {
|
|
|
32
36
|
};
|
|
33
37
|
});
|
|
34
38
|
}
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
afterUpdate(() => {
|
|
40
|
+
genConicGradient();
|
|
41
|
+
genLegend();
|
|
42
|
+
});
|
|
37
43
|
$:
|
|
38
44
|
classesBase = `${cBase} ${$$props.class ?? ""}`;
|
|
39
45
|
$:
|
|
40
|
-
|
|
46
|
+
classesCaption = `${cCaption} ${regionCaption}`;
|
|
47
|
+
$:
|
|
48
|
+
classesCone = `${cCone} ${width} ${regionCone}`;
|
|
49
|
+
$:
|
|
50
|
+
classesLegend = `${cLegend} ${regionLegend}`;
|
|
41
51
|
</script>
|
|
42
52
|
|
|
43
53
|
<figure class="conic-gradient {classesBase}" data-testid="conic-gradient">
|
|
44
54
|
<!-- Label -->
|
|
45
55
|
{#if $$slots.default}
|
|
46
|
-
<figcaption class="conic-caption {
|
|
56
|
+
<figcaption class="conic-caption {classesCaption}"><slot /></figcaption>
|
|
47
57
|
{/if}
|
|
48
58
|
<!-- Conic Gradient -->
|
|
49
59
|
{#if cone}
|
|
50
|
-
<div class="
|
|
60
|
+
<div class="conic-cone {classesCone}" class:animate-spin={spin} style:background={cone} />
|
|
51
61
|
{/if}
|
|
52
62
|
<!-- Legend -->
|
|
53
63
|
{#if legend && generatedLegendList}
|
|
54
|
-
<ul class="conic-list list {
|
|
64
|
+
<ul class="conic-list list {classesLegend}">
|
|
55
65
|
{#each generatedLegendList as { color, label, value }}
|
|
56
66
|
<li class="conic-item {hover}" on:click on:keydown on:keyup on:keypress>
|
|
57
67
|
<span class="conic-swatch {cSwatch}" style:background={color} />
|
|
@@ -3,11 +3,22 @@ import type { ConicStop } from './types';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
|
+
/** Provide a data set of color stops and labels.*/
|
|
6
7
|
stops?: ConicStop[] | undefined;
|
|
8
|
+
/** Allows for automatic generation of a legend below the conic gradient.*/
|
|
7
9
|
legend?: boolean | undefined;
|
|
10
|
+
/** When enabled, the conic gradient will spin.*/
|
|
8
11
|
spin?: boolean | undefined;
|
|
12
|
+
/** Provided classes to style the conic gradient width.*/
|
|
9
13
|
width?: string | undefined;
|
|
14
|
+
/** Provided classes to style the legend hover effect.*/
|
|
10
15
|
hover?: string | undefined;
|
|
16
|
+
/** Provide abitrary classes to the caption region above the gradient.*/
|
|
17
|
+
regionCaption?: string | undefined;
|
|
18
|
+
/** Provide abitrary classes to the conic gradient region.*/
|
|
19
|
+
regionCone?: string | undefined;
|
|
20
|
+
/** Provide abitrary classes to the legend region below the gradient.*/
|
|
21
|
+
regionLegend?: string | undefined;
|
|
11
22
|
};
|
|
12
23
|
events: {
|
|
13
24
|
click: MouseEvent;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
export type TailwindNumbers = typeof tailwindNumbers[number];
|
|
2
|
-
export declare const tailwindNumbers: readonly ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"];
|
|
3
|
-
export type SemanticNames = typeof semanticNames[number];
|
|
4
|
-
export declare const semanticNames: readonly ["primary", "secondary", "tertiary", "success", "warning", "error", "surface"];
|
|
5
1
|
export type HexRgb = {
|
|
6
2
|
hex: string;
|
|
7
3
|
rgb: string;
|
|
8
4
|
};
|
|
9
5
|
export type TailwindColorObject = {
|
|
10
6
|
label: string;
|
|
11
|
-
shades: Record<
|
|
7
|
+
shades: Record<string, HexRgb>;
|
|
12
8
|
};
|
|
13
9
|
export declare const tailwindDefaultColors: TailwindColorObject[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export const semanticNames = ['primary', 'secondary', 'tertiary', 'success', 'warning', 'error', 'surface'];
|
|
1
|
+
// Provides the full set of Tailwind colors via Javascript
|
|
3
2
|
// https://tailwindcss.com/docs/customizing-colors#default-color-palette
|
|
4
3
|
export const tailwindDefaultColors = [
|
|
5
4
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<script>export let
|
|
2
|
-
export let button = "variant-filled
|
|
1
|
+
<script>export let name;
|
|
2
|
+
export let button = "variant-filled";
|
|
3
3
|
let elemFileInput;
|
|
4
4
|
function onButtonClick() {
|
|
5
5
|
elemFileInput.click();
|
|
@@ -11,18 +11,20 @@ function prunedRestProps() {
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<div class="file-button {$$props.class ?? ''}" data-testid="file-button">
|
|
14
|
-
<!--
|
|
15
|
-
<
|
|
14
|
+
<!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
|
|
15
|
+
<div class="h-0 overflow-hidden">
|
|
16
|
+
<input type="file" bind:this={elemFileInput} {name} {...prunedRestProps()} on:change />
|
|
17
|
+
</div>
|
|
16
18
|
<!-- Button -->
|
|
17
19
|
<button
|
|
18
|
-
class="file-button-btn btn {button}"
|
|
19
20
|
type="button"
|
|
21
|
+
class="file-button-btn btn {button}"
|
|
20
22
|
disabled={$$restProps.disabled}
|
|
21
23
|
on:click={onButtonClick}
|
|
22
24
|
on:keydown
|
|
23
25
|
on:keyup
|
|
24
26
|
on:keypress
|
|
25
27
|
>
|
|
26
|
-
<slot
|
|
28
|
+
<slot>Select a File</slot>
|
|
27
29
|
</button>
|
|
28
30
|
</div>
|
|
@@ -2,7 +2,9 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
|
|
5
|
+
/** Required. Set a unique name for the file input.*/
|
|
6
|
+
name: string;
|
|
7
|
+
/** Provide a button variant or other class styles.*/
|
|
6
8
|
button?: string | undefined;
|
|
7
9
|
};
|
|
8
10
|
events: {
|
|
@@ -1,75 +1,55 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
export let
|
|
4
|
-
export let
|
|
5
|
-
export let
|
|
6
|
-
export let
|
|
7
|
-
export let
|
|
8
|
-
export let
|
|
9
|
-
export let
|
|
10
|
-
const cBase = "relative";
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
let elemIcon;
|
|
14
|
-
function onDragOver(event) {
|
|
15
|
-
dispatch("dragover", event);
|
|
16
|
-
elemIcon?.classList.add("animate-bounce");
|
|
17
|
-
}
|
|
18
|
-
function onDragLeave(event) {
|
|
19
|
-
dispatch("dragleave", event);
|
|
20
|
-
elemIcon?.classList.remove("animate-bounce");
|
|
21
|
-
}
|
|
22
|
-
function onDrop(event) {
|
|
23
|
-
dispatch("drop", event);
|
|
24
|
-
elemIcon?.classList.remove("animate-bounce");
|
|
25
|
-
}
|
|
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 flex justify-center items-center";
|
|
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";
|
|
26
13
|
$:
|
|
27
|
-
classesBase = `${cBase} ${
|
|
14
|
+
classesBase = `${cBase} ${border} ${padding} ${rounded} ${$$props.class ?? ""}`;
|
|
28
15
|
$:
|
|
29
|
-
|
|
16
|
+
classesInput = `${cInput}`;
|
|
30
17
|
$:
|
|
31
|
-
|
|
18
|
+
classesInterface = `${cInterface}`;
|
|
32
19
|
function prunedRestProps() {
|
|
33
20
|
delete $$restProps.class;
|
|
34
21
|
return $$restProps;
|
|
35
22
|
}
|
|
36
23
|
</script>
|
|
37
24
|
|
|
38
|
-
<div
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
</
|
|
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>
|
|
63
50
|
</div>
|
|
64
|
-
|
|
51
|
+
<!-- Meta Text -->
|
|
52
|
+
{#if $$slots.meta}<small class="dropzone-meta {slotMeta}"><slot name="meta" /></small>{/if}
|
|
53
|
+
</div>
|
|
65
54
|
</div>
|
|
66
|
-
<!-- Input: File -->
|
|
67
|
-
<input bind:files type="file" {...prunedRestProps()} class="file-dropzone-input {classesInput}" on:change />
|
|
68
55
|
</div>
|
|
69
|
-
|
|
70
|
-
<style>
|
|
71
|
-
/* Hide Input:File Content */
|
|
72
|
-
::file-selector-button {
|
|
73
|
-
display: none
|
|
74
|
-
}
|
|
75
|
-
</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,77 +1,122 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte/internal";
|
|
2
|
+
import { fly, scale } from "svelte/transition";
|
|
3
|
+
import { flip } from "svelte/animate";
|
|
2
4
|
const dispatch = createEventDispatcher();
|
|
3
|
-
export let
|
|
5
|
+
export let name;
|
|
4
6
|
export let value = [];
|
|
5
7
|
export let whitelist = [];
|
|
8
|
+
export let max = -1;
|
|
9
|
+
export let minlength = -1;
|
|
10
|
+
export let maxlength = -1;
|
|
6
11
|
export let allowUpperCase = false;
|
|
7
|
-
export let allowDuplicates =
|
|
12
|
+
export let allowDuplicates = false;
|
|
8
13
|
export let validation = () => true;
|
|
9
|
-
export let
|
|
14
|
+
export let duration = 150;
|
|
15
|
+
export let required = false;
|
|
16
|
+
export let chips = "variant-filled";
|
|
17
|
+
export let invalid = "input-error";
|
|
10
18
|
export let padding = "p-2";
|
|
11
19
|
export let rounded = "rounded-container-token";
|
|
12
|
-
|
|
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";
|
|
13
24
|
let inputValue = "";
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
25
|
+
let inputValid = true;
|
|
26
|
+
function onInputHandler() {
|
|
27
|
+
inputValid = true;
|
|
28
|
+
}
|
|
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;
|
|
20
45
|
}
|
|
21
46
|
function addChip(event) {
|
|
22
47
|
event.preventDefault();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (whitelist.length > 0 && !whitelist.includes(inputValue)) {
|
|
28
|
-
inputValueValid = false;
|
|
48
|
+
inputValid = validate();
|
|
49
|
+
if (inputValid === false)
|
|
29
50
|
return;
|
|
30
|
-
}
|
|
31
|
-
if (allowDuplicates === false && value.includes(inputValue)) {
|
|
32
|
-
inputValueValid = false;
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
51
|
inputValue = inputValue.trim();
|
|
36
52
|
inputValue = allowUpperCase ? inputValue : inputValue.toLowerCase();
|
|
37
53
|
value = [...value, inputValue];
|
|
54
|
+
dispatch("add", { event, chipIndex: value.length - 1, chipValue: inputValue });
|
|
38
55
|
inputValue = "";
|
|
39
|
-
dispatch("add", event);
|
|
40
56
|
}
|
|
41
|
-
function removeChip(chipIndex) {
|
|
57
|
+
function removeChip(event, chipIndex, chipValue) {
|
|
58
|
+
if ($$restProps.disabled)
|
|
59
|
+
return;
|
|
42
60
|
value = value.filter((_, i) => i !== chipIndex);
|
|
43
|
-
dispatch("remove", chipIndex);
|
|
44
|
-
}
|
|
45
|
-
function prunedRestProps() {
|
|
46
|
-
delete $$restProps.class;
|
|
47
|
-
return $$restProps;
|
|
61
|
+
dispatch("remove", { event, chipIndex, chipValue });
|
|
48
62
|
}
|
|
49
63
|
$:
|
|
50
|
-
|
|
64
|
+
classesInvalid = inputValid === false ? invalid : "";
|
|
65
|
+
$:
|
|
66
|
+
classesBase = `${cBase} ${padding} ${rounded} ${$$props.class ?? ""} ${classesInvalid}`;
|
|
67
|
+
$:
|
|
68
|
+
classesInterface = `${cInterface}`;
|
|
51
69
|
$:
|
|
52
|
-
|
|
70
|
+
classesChipList = `${cChipList}`;
|
|
53
71
|
$:
|
|
54
|
-
|
|
72
|
+
classesInputField = `${cInputField}`;
|
|
55
73
|
</script>
|
|
56
74
|
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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} tabindex="-1">
|
|
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
|
+
<button
|
|
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
|
+
</button>
|
|
117
|
+
</div>
|
|
118
|
+
{/each}
|
|
119
|
+
</div>
|
|
120
|
+
{/if}
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
@@ -2,19 +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
|
-
|
|
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.*/
|
|
12
32
|
padding?: string | undefined;
|
|
33
|
+
/** Provide classes to set border radius styles.*/
|
|
13
34
|
rounded?: string | undefined;
|
|
14
|
-
ring?: string | undefined;
|
|
15
35
|
};
|
|
16
36
|
events: {
|
|
37
|
+
input: Event;
|
|
38
|
+
click: MouseEvent;
|
|
17
39
|
keypress: KeyboardEvent;
|
|
40
|
+
keydown: KeyboardEvent;
|
|
41
|
+
keyup: KeyboardEvent;
|
|
18
42
|
} & {
|
|
19
43
|
[evt: string]: CustomEvent<any>;
|
|
20
44
|
};
|
|
@@ -1,37 +1,21 @@
|
|
|
1
1
|
<script>import { setContext } from "svelte";
|
|
2
|
-
|
|
3
|
-
export let
|
|
4
|
-
export let space = "space-y-1";
|
|
5
|
-
export let height = "";
|
|
6
|
-
export let accent = "!bg-primary-active-token";
|
|
7
|
-
export let padding = "px-4 py-3";
|
|
2
|
+
export let multiple = false;
|
|
3
|
+
export let spacing = `space-y-1`;
|
|
8
4
|
export let rounded = "rounded-token";
|
|
9
|
-
export let
|
|
10
|
-
export let
|
|
11
|
-
export let
|
|
12
|
-
export let
|
|
13
|
-
|
|
14
|
-
setContext("selected", selected);
|
|
15
|
-
setContext("accent", accent);
|
|
16
|
-
setContext("padding", padding);
|
|
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);
|
|
17
10
|
setContext("rounded", rounded);
|
|
11
|
+
setContext("active", active);
|
|
18
12
|
setContext("hover", hover);
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const cListBox = "list-none overflow-y-auto";
|
|
22
|
-
$:
|
|
23
|
-
classesBase = `${cBase} ${$$props.class ?? ""}`;
|
|
24
|
-
$:
|
|
25
|
-
classesLabel = `${cLabel}`;
|
|
13
|
+
setContext("padding", padding);
|
|
14
|
+
const cBase = "cursor-pointer -outline-offset-[3px]";
|
|
26
15
|
$:
|
|
27
|
-
|
|
16
|
+
classesBase = `${cBase} ${spacing} ${rounded} ${$$props.class ?? ""}`;
|
|
28
17
|
</script>
|
|
29
18
|
|
|
30
|
-
<div class="listbox {classesBase}" data-testid="listbox
|
|
31
|
-
|
|
32
|
-
{#if label}<span class="listbox-label {classesLabel} {regionLabel}" id={labelId}>{label}</span>{/if}
|
|
33
|
-
<!-- Listbox -->
|
|
34
|
-
<ul class="listbox-list {classesListBox} {regionList}" role="listbox" aria-labelledby={labelId}>
|
|
35
|
-
<slot />
|
|
36
|
-
</ul>
|
|
19
|
+
<div class="listbox {classesBase}" role="listbox" aria-labelledby={labelledby} data-testid="listbox">
|
|
20
|
+
<slot />
|
|
37
21
|
</div>
|