@skeletonlabs/skeleton 1.2.0 → 1.2.5
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/actions/Clipboard/clipboard.js +1 -1
- package/dist/actions/Filters/svg-filters/Emerald.svelte +1 -1
- package/dist/components/Accordion/Accordion.svelte +2 -0
- package/dist/components/Accordion/Accordion.svelte.d.ts +2 -0
- package/dist/components/Accordion/AccordionItem.svelte +2 -0
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +3 -1
- package/dist/components/AppRail/AppRailTile.svelte.d.ts +1 -1
- package/dist/components/AppShell/AppShell.svelte +2 -2
- package/dist/components/AppShell/AppShell.svelte.d.ts +8 -8
- package/dist/components/Autocomplete/Autocomplete.svelte +8 -9
- package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +2 -2
- package/dist/components/Autocomplete/types.d.ts +1 -1
- package/dist/components/InputChip/InputChip.svelte +5 -1
- package/dist/components/InputChip/InputChip.svelte.d.ts +4 -2
- package/dist/components/ListBox/ListBox.svelte.d.ts +1 -1
- package/dist/components/Paginator/Paginator.svelte.d.ts +1 -1
- package/dist/components/ProgressBar/ProgressBar.svelte +2 -2
- package/dist/components/Stepper/Step.svelte +2 -1
- package/dist/components/Tab/TabGroup.svelte +1 -1
- package/dist/components/TableOfContents/TableOfContents.svelte +2 -2
- package/dist/utilities/DataTable/actions.js +1 -1
- package/dist/utilities/Popup/popup.js +5 -6
- package/dist/utilities/Popup/types.d.ts +2 -2
- package/dist/utilities/Toast/Toast.svelte +20 -4
- package/package.json +2 -2
- package/src/lib/styles/core.css +1 -0
- package/src/lib/styles/elements/buttons.css +1 -1
- package/src/lib/styles/tailwind.css +1 -1
- package/src/lib/styles/variants.css +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- Emerald: `filter: url(#Emerald)` -->
|
|
2
2
|
<svg id="svg-filter-emerald" class="hidden">
|
|
3
3
|
<filter id="Emerald" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
4
|
-
<!-- RGB, RGB, RGB,
|
|
4
|
+
<!-- RGB, RGB, RGB, Opacity -->
|
|
5
5
|
<feColorMatrix
|
|
6
6
|
type="matrix"
|
|
7
7
|
in="SourceGraphic"
|
|
@@ -3,6 +3,7 @@ import { setContext } from "svelte";
|
|
|
3
3
|
export let autocollapse = false;
|
|
4
4
|
export let duration = 200;
|
|
5
5
|
export let spacing = "space-y-1";
|
|
6
|
+
export let disabled = false;
|
|
6
7
|
export let padding = "py-2 px-4";
|
|
7
8
|
export let hover = "hover:bg-primary-hover-token";
|
|
8
9
|
export let rounded = "rounded-container-token";
|
|
@@ -15,6 +16,7 @@ const active = writable(null);
|
|
|
15
16
|
setContext("active", active);
|
|
16
17
|
setContext("autocollapse", autocollapse);
|
|
17
18
|
setContext("duration", duration);
|
|
19
|
+
setContext("disabled", disabled);
|
|
18
20
|
setContext("padding", padding);
|
|
19
21
|
setContext("hover", hover);
|
|
20
22
|
setContext("rounded", rounded);
|
|
@@ -8,6 +8,8 @@ declare const __propDef: {
|
|
|
8
8
|
duration?: number | undefined;
|
|
9
9
|
/** Provide classes to set the vertical spacing between items.*/
|
|
10
10
|
spacing?: string | undefined;
|
|
11
|
+
/** Set the accordion disabled state for all items.*/
|
|
12
|
+
disabled?: boolean | undefined;
|
|
11
13
|
/** Provide classes to set the accordion item padding styles.*/
|
|
12
14
|
padding?: string | undefined;
|
|
13
15
|
/** Provide classes to set the accordion item hover styles.*/
|
|
@@ -11,6 +11,7 @@ const cPanel = "";
|
|
|
11
11
|
export let autocollapse = getContext("autocollapse");
|
|
12
12
|
export let active = getContext("active");
|
|
13
13
|
export let duration = getContext("duration");
|
|
14
|
+
export let disabled = getContext("disabled");
|
|
14
15
|
export let padding = getContext("padding");
|
|
15
16
|
export let hover = getContext("hover");
|
|
16
17
|
export let rounded = getContext("rounded");
|
|
@@ -65,6 +66,7 @@ $:
|
|
|
65
66
|
on:keypress
|
|
66
67
|
aria-expanded={openState}
|
|
67
68
|
aria-controls="accordion-panel-{id}"
|
|
69
|
+
{disabled}
|
|
68
70
|
>
|
|
69
71
|
<!-- Lead -->
|
|
70
72
|
{#if $$slots.lead}
|
|
@@ -13,6 +13,8 @@ declare const __propDef: {
|
|
|
13
13
|
active?: Writable<string | null> | undefined;
|
|
14
14
|
/** Set the drawer animation duration.*/
|
|
15
15
|
duration?: number | undefined;
|
|
16
|
+
/** Set the disabled state for this item.*/
|
|
17
|
+
disabled?: boolean | undefined;
|
|
16
18
|
/** Provide classes to set the accordion item padding styles.*/
|
|
17
19
|
padding?: string | undefined;
|
|
18
20
|
/** Provide classes to set the accordion item hover styles.*/
|
|
@@ -38,7 +40,7 @@ declare const __propDef: {
|
|
|
38
40
|
} & {
|
|
39
41
|
[evt: string]: CustomEvent<any>;
|
|
40
42
|
};
|
|
41
|
-
|
|
43
|
+
slots: {
|
|
42
44
|
lead: {};
|
|
43
45
|
summary: {};
|
|
44
46
|
content: {};
|
|
@@ -7,7 +7,7 @@ declare const __propDef: {
|
|
|
7
7
|
value?: any | undefined;
|
|
8
8
|
/** Provide the element tag. Button or Anchor recommended.*/
|
|
9
9
|
tag?: string | undefined;
|
|
10
|
-
/** Provide the
|
|
10
|
+
/** Provide the visible text label.*/
|
|
11
11
|
label?: string | undefined;
|
|
12
12
|
/** Provide arbitrary classes to style the icon region.*/
|
|
13
13
|
regionIcon?: string | undefined;
|
|
@@ -14,7 +14,7 @@ const cSidebarRight = "flex-none overflow-x-hidden overflow-y-auto";
|
|
|
14
14
|
$:
|
|
15
15
|
classesBase = `${cBaseAppShell} ${$$props.class ?? ""}`;
|
|
16
16
|
$:
|
|
17
|
-
|
|
17
|
+
classesHeader = `${slotHeader}`;
|
|
18
18
|
$:
|
|
19
19
|
classesSidebarLeft = `${cSidebarLeft} ${slotSidebarLeft}`;
|
|
20
20
|
$:
|
|
@@ -32,7 +32,7 @@ $:
|
|
|
32
32
|
<div id="appShell" class={classesBase} data-testid="app-shell">
|
|
33
33
|
<!-- Slot: Header -->
|
|
34
34
|
{#if $$slots.header}
|
|
35
|
-
<header id="shell-header" class="flex-none {
|
|
35
|
+
<header id="shell-header" class="flex-none {classesHeader}"><slot name="header" /></header>
|
|
36
36
|
{/if}
|
|
37
37
|
|
|
38
38
|
<!-- Content Area -->
|
|
@@ -2,21 +2,21 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
/** Apply arbitrary
|
|
5
|
+
/** Apply arbitrary classes to the entire `#page` region.*/
|
|
6
6
|
regionPage?: string | undefined;
|
|
7
|
-
/** Apply arbitrary
|
|
7
|
+
/** Apply arbitrary classes to the `header` slot container element*/
|
|
8
8
|
slotHeader?: string | undefined;
|
|
9
|
-
/** Apply arbitrary
|
|
9
|
+
/** Apply arbitrary classes to the `sidebarLeft` slot container element*/
|
|
10
10
|
slotSidebarLeft?: string | undefined;
|
|
11
|
-
/** Apply arbitrary
|
|
11
|
+
/** Apply arbitrary classes to the `sidebarRight` slot container element*/
|
|
12
12
|
slotSidebarRight?: string | undefined;
|
|
13
|
-
/** Apply arbitrary
|
|
13
|
+
/** Apply arbitrary classes to the `pageHeader` slot container element*/
|
|
14
14
|
slotPageHeader?: string | undefined;
|
|
15
|
-
/** Apply arbitrary
|
|
15
|
+
/** Apply arbitrary classes to the `pageContent` slot container element*/
|
|
16
16
|
slotPageContent?: string | undefined;
|
|
17
|
-
/** Apply arbitrary
|
|
17
|
+
/** Apply arbitrary classes to the `pageFooter` slot container element*/
|
|
18
18
|
slotPageFooter?: string | undefined;
|
|
19
|
-
/** Apply arbitrary
|
|
19
|
+
/** Apply arbitrary classes to the `footer` slot container element*/
|
|
20
20
|
slotFooter?: string | undefined;
|
|
21
21
|
};
|
|
22
22
|
events: {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
-
import { slide } from "svelte/transition";
|
|
3
|
-
import { flip } from "svelte/animate";
|
|
4
2
|
const dispatch = createEventDispatcher();
|
|
5
3
|
export let input = void 0;
|
|
6
4
|
export let options = [];
|
|
7
5
|
export let allowlist = [];
|
|
8
6
|
export let denylist = [];
|
|
9
7
|
export let emptyState = "No Results Found.";
|
|
10
|
-
export let duration = 200;
|
|
11
8
|
export let regionNav = "";
|
|
12
9
|
export let regionList = "list-nav";
|
|
13
10
|
export let regionItem = "";
|
|
@@ -15,7 +12,8 @@ export let regionButton = "w-full";
|
|
|
15
12
|
export let regionEmpty = "text-center";
|
|
16
13
|
export let whitelist = [];
|
|
17
14
|
export let blacklist = [];
|
|
18
|
-
|
|
15
|
+
export let duration = 200;
|
|
16
|
+
const deprecated = [whitelist, blacklist, duration];
|
|
19
17
|
let listedOptions = options;
|
|
20
18
|
function filterByAllowed() {
|
|
21
19
|
if (allowlist.length) {
|
|
@@ -54,7 +52,7 @@ $:
|
|
|
54
52
|
$:
|
|
55
53
|
optionsFiltered = input ? filterOptions() : listedOptions;
|
|
56
54
|
$:
|
|
57
|
-
|
|
55
|
+
classesBase = `${$$props.class ?? ""}`;
|
|
58
56
|
$:
|
|
59
57
|
classesNav = `${regionNav}`;
|
|
60
58
|
$:
|
|
@@ -64,15 +62,16 @@ $:
|
|
|
64
62
|
$:
|
|
65
63
|
classesButton = `${regionButton}`;
|
|
66
64
|
$:
|
|
67
|
-
|
|
65
|
+
classesEmpty = `${regionEmpty}`;
|
|
68
66
|
</script>
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
<!-- animate:flip={{ duration }} transition:slide|local={{ duration }} -->
|
|
69
|
+
<div class="autocomplete {classesBase}" data-testid="autocomplete">
|
|
71
70
|
{#if optionsFiltered.length > 0}
|
|
72
71
|
<nav class="autocomplete-nav {classesNav}">
|
|
73
72
|
<ul class="autocomplete-list {classesList}">
|
|
74
73
|
{#each optionsFiltered as option, i (option)}
|
|
75
|
-
<li class="autocomplete-item {classesItem}"
|
|
74
|
+
<li class="autocomplete-item {classesItem}">
|
|
76
75
|
<button class="autocomplete-button {classesButton}" type="button" on:click={() => onSelection(option)} on:click on:keypress>
|
|
77
76
|
{@html option.label}
|
|
78
77
|
</button>
|
|
@@ -81,6 +80,6 @@ $:
|
|
|
81
80
|
</ul>
|
|
82
81
|
</nav>
|
|
83
82
|
{:else}
|
|
84
|
-
<div class="autocomplete-empty {
|
|
83
|
+
<div class="autocomplete-empty {classesEmpty}">{emptyState}</div>
|
|
85
84
|
{/if}
|
|
86
85
|
</div>
|
|
@@ -13,8 +13,6 @@ declare const __propDef: {
|
|
|
13
13
|
denylist?: unknown[] | undefined;
|
|
14
14
|
/** Provide a HTML markup to display when no match is found.*/
|
|
15
15
|
emptyState?: string | undefined;
|
|
16
|
-
/** Set the animation duration. Use zero to disable.*/
|
|
17
|
-
duration?: number | undefined;
|
|
18
16
|
/** Provide arbitrary classes to nav element.*/
|
|
19
17
|
regionNav?: string | undefined;
|
|
20
18
|
/** Provide arbitrary classes to each list.*/
|
|
@@ -29,6 +27,8 @@ declare const __propDef: {
|
|
|
29
27
|
whitelist?: unknown[] | undefined;
|
|
30
28
|
/** DEPRECATED: replace with denylist*/
|
|
31
29
|
blacklist?: unknown[] | undefined;
|
|
30
|
+
/** DEPRECATED: Set the animation duration. Use zero to disable.*/
|
|
31
|
+
duration?: number | undefined;
|
|
32
32
|
};
|
|
33
33
|
events: {
|
|
34
34
|
click: MouseEvent;
|
|
@@ -3,7 +3,7 @@ export interface AutocompleteOption {
|
|
|
3
3
|
label: string;
|
|
4
4
|
/** Provide a unique option value. */
|
|
5
5
|
value: unknown;
|
|
6
|
-
/** Provide a comma
|
|
6
|
+
/** Provide a comma separated list of keywords. */
|
|
7
7
|
keywords?: any;
|
|
8
8
|
/** Pass arbitrary data per option. */
|
|
9
9
|
meta?: any;
|
|
@@ -50,8 +50,10 @@ function validate() {
|
|
|
50
50
|
function addChip(event) {
|
|
51
51
|
event.preventDefault();
|
|
52
52
|
inputValid = validate();
|
|
53
|
-
if (inputValid === false)
|
|
53
|
+
if (inputValid === false) {
|
|
54
|
+
dispatch("invalid", { event, input });
|
|
54
55
|
return;
|
|
56
|
+
}
|
|
55
57
|
input = allowUpperCase ? input : input.toLowerCase();
|
|
56
58
|
value.push(input);
|
|
57
59
|
value = value;
|
|
@@ -106,6 +108,8 @@ $:
|
|
|
106
108
|
class="input-chip-field {classesInputField}"
|
|
107
109
|
on:input={onInputHandler}
|
|
108
110
|
on:input
|
|
111
|
+
on:focus
|
|
112
|
+
on:blur
|
|
109
113
|
disabled={$$restProps.disabled}
|
|
110
114
|
/>
|
|
111
115
|
</form>
|
|
@@ -20,7 +20,7 @@ declare const __propDef: {
|
|
|
20
20
|
allowUpperCase?: boolean | undefined;
|
|
21
21
|
/** When enabled, allows for duplicate values.*/
|
|
22
22
|
allowDuplicates?: boolean | undefined;
|
|
23
|
-
/** Provide a custom
|
|
23
|
+
/** Provide a custom validator function.*/
|
|
24
24
|
validation?: ((...args: any[]) => boolean) | undefined;
|
|
25
25
|
/** The duration of the animated fly effect.*/
|
|
26
26
|
duration?: number | undefined;
|
|
@@ -28,7 +28,7 @@ declare const __propDef: {
|
|
|
28
28
|
required?: boolean | undefined;
|
|
29
29
|
/** Provide classes or a variant to style the chips.*/
|
|
30
30
|
chips?: string | undefined;
|
|
31
|
-
/**
|
|
31
|
+
/** {{ event: Event, input: any }} invalid - Fires when the input value is invalid.*/
|
|
32
32
|
invalid?: string | undefined;
|
|
33
33
|
/** Provide classes to set padding styles.*/
|
|
34
34
|
padding?: string | undefined;
|
|
@@ -38,6 +38,8 @@ declare const __propDef: {
|
|
|
38
38
|
events: {
|
|
39
39
|
/** Bind the input value.*/
|
|
40
40
|
input: Event;
|
|
41
|
+
focus: FocusEvent;
|
|
42
|
+
blur: FocusEvent;
|
|
41
43
|
click: MouseEvent;
|
|
42
44
|
keypress: KeyboardEvent;
|
|
43
45
|
keydown: KeyboardEvent;
|
|
@@ -4,7 +4,7 @@ declare const __propDef: {
|
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
/** Enable selection of multiple items.*/
|
|
6
6
|
multiple?: boolean | undefined;
|
|
7
|
-
/** Provide
|
|
7
|
+
/** Provide class to set the vertical spacing style.*/
|
|
8
8
|
spacing?: string | undefined;
|
|
9
9
|
/** Provide classes to set the listbox box radius styles.*/
|
|
10
10
|
rounded?: string | undefined;
|
|
@@ -15,7 +15,7 @@ declare const __propDef: {
|
|
|
15
15
|
text?: string | undefined;
|
|
16
16
|
/** Set the text for the amount selection input.*/
|
|
17
17
|
amountText?: string | undefined;
|
|
18
|
-
/** Provide
|
|
18
|
+
/** Provide arbitrary classes to the next/previous buttons.*/
|
|
19
19
|
buttonClasses?: string | undefined;
|
|
20
20
|
/** Set the text label for the Previous button.*/
|
|
21
21
|
buttonTextPrevious?: string | undefined;
|
|
@@ -13,11 +13,11 @@ $:
|
|
|
13
13
|
$:
|
|
14
14
|
indeterminate = value === void 0 || value < 0;
|
|
15
15
|
$:
|
|
16
|
-
|
|
16
|
+
classesIndeterminate = indeterminate ? "animIndeterminate" : "";
|
|
17
17
|
$:
|
|
18
18
|
classesTrack = `${cTrack} ${height} ${rounded} ${track} ${$$props.class ?? ""}`;
|
|
19
19
|
$:
|
|
20
|
-
classesMeter = `${cMeter} ${rounded} ${
|
|
20
|
+
classesMeter = `${cMeter} ${rounded} ${classesIndeterminate} ${meter}`;
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<!-- Track -->
|
|
@@ -25,7 +25,8 @@ const cBase = "space-y-4";
|
|
|
25
25
|
const cHeader = "text-2xl font-bold";
|
|
26
26
|
const cContent = "space-y-4";
|
|
27
27
|
const cNavigation = "flex";
|
|
28
|
-
function onNext() {
|
|
28
|
+
async function onNext() {
|
|
29
|
+
await new Promise((resolve) => setTimeout(resolve));
|
|
29
30
|
if (locked)
|
|
30
31
|
return;
|
|
31
32
|
$state.current++;
|
|
@@ -18,7 +18,7 @@ setContext("padding", padding);
|
|
|
18
18
|
setContext("rounded", rounded);
|
|
19
19
|
setContext("spacing", spacing);
|
|
20
20
|
const cBase = "space-y-4";
|
|
21
|
-
const cList = "flex overflow-x-auto hide-
|
|
21
|
+
const cList = "flex overflow-x-auto hide-scrollbar";
|
|
22
22
|
const cPanel = "";
|
|
23
23
|
$:
|
|
24
24
|
classesBase = `${cBase} ${$$props.class ?? ""}`;
|
|
@@ -54,12 +54,12 @@ function scrollToHeading(headingElem) {
|
|
|
54
54
|
elemTarget.scrollIntoView({ behavior: "smooth" });
|
|
55
55
|
}
|
|
56
56
|
function pageScrollHandler() {
|
|
57
|
-
const
|
|
57
|
+
const headingSizeThreshold = 40;
|
|
58
58
|
let visibleHeadings = [];
|
|
59
59
|
allowedHeadingsList?.forEach((header) => {
|
|
60
60
|
const scrollableTop = elemScrollParent?.getBoundingClientRect().top || 0;
|
|
61
61
|
const headerBoundTop = header.getBoundingClientRect().top;
|
|
62
|
-
const offsetTop = headerBoundTop - scrollableTop +
|
|
62
|
+
const offsetTop = headerBoundTop - scrollableTop + headingSizeThreshold;
|
|
63
63
|
if (offsetTop >= 0)
|
|
64
64
|
visibleHeadings.push(header);
|
|
65
65
|
});
|
|
@@ -89,7 +89,8 @@ export function popup(node, args) {
|
|
|
89
89
|
function closeOnQueryClick(clickedEl) {
|
|
90
90
|
if (!clickedEl)
|
|
91
91
|
return;
|
|
92
|
-
const
|
|
92
|
+
const elemsCloseQuery = !args.closeQuery || args.closeQuery === '' ? 'a[href], button' : args.closeQuery;
|
|
93
|
+
const interactiveMenuElems = elemPopup?.querySelectorAll(elemsCloseQuery);
|
|
93
94
|
if (!interactiveMenuElems?.length)
|
|
94
95
|
return;
|
|
95
96
|
interactiveMenuElems.forEach((elem) => {
|
|
@@ -159,7 +160,6 @@ export function popup(node, args) {
|
|
|
159
160
|
render(); // update
|
|
160
161
|
elemPopup.style.display = 'block';
|
|
161
162
|
elemPopup.style.opacity = '1';
|
|
162
|
-
elemPopup.style.pointerEvents = 'initial';
|
|
163
163
|
isVisible = true;
|
|
164
164
|
stateEventHandler(true);
|
|
165
165
|
// Utilize autoUpdate ONLY when the popup is.
|
|
@@ -172,8 +172,7 @@ export function popup(node, args) {
|
|
|
172
172
|
elemPopup.style.opacity = '0';
|
|
173
173
|
const cssTransitionDuration = parseFloat(window.getComputedStyle(elemPopup).transitionDuration.replace('s', '')) * 1000;
|
|
174
174
|
setTimeout(() => {
|
|
175
|
-
elemPopup.style.display = '
|
|
176
|
-
elemPopup.style.pointerEvents = 'none';
|
|
175
|
+
elemPopup.style.display = 'none';
|
|
177
176
|
isVisible = false;
|
|
178
177
|
stateEventHandler(false);
|
|
179
178
|
}, cssTransitionDuration);
|
|
@@ -192,8 +191,8 @@ export function popup(node, args) {
|
|
|
192
191
|
return;
|
|
193
192
|
// Handle keys
|
|
194
193
|
const key = event.key;
|
|
195
|
-
//
|
|
196
|
-
if (key === 'Escape') {
|
|
194
|
+
// Handle keyboard interaction
|
|
195
|
+
if (key === 'Escape' || (document.activeElement === node && key === 'Tab')) {
|
|
197
196
|
event.preventDefault();
|
|
198
197
|
close();
|
|
199
198
|
node.focus();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type Direction = 'top' | 'bottom' | 'left' | 'right';
|
|
2
2
|
/** Placement https://floating-ui.com/docs/computePosition#placement */
|
|
3
3
|
type Placement = Direction | `${Direction}-start` | `${Direction}-end`;
|
|
4
|
-
interface
|
|
4
|
+
interface Middleware {
|
|
5
5
|
/** Offset options: https://floating-ui.com/docs/offset */
|
|
6
6
|
offset?: number | Record<string, any>;
|
|
7
7
|
/** Shift options: https://floating-ui.com/docs/shift */
|
|
@@ -23,7 +23,7 @@ export interface PopupSettings {
|
|
|
23
23
|
/** Query list of elements that will close the popup. Default: `'a[href], button'`. */
|
|
24
24
|
closeQuery?: string;
|
|
25
25
|
/** Provide additional options and middleware settings. */
|
|
26
|
-
middleware?:
|
|
26
|
+
middleware?: Middleware;
|
|
27
27
|
/** Provide an optional callback function to monitor open/close state. */
|
|
28
28
|
state?: (event: {
|
|
29
29
|
state: boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { crossfade } from "svelte/transition";
|
|
2
|
+
import { cubicInOut } from "svelte/easing";
|
|
2
3
|
import { flip } from "svelte/animate";
|
|
3
4
|
import { toastStore } from "./stores";
|
|
4
5
|
export let position = "b";
|
|
5
6
|
export let max = 3;
|
|
6
|
-
export let duration =
|
|
7
|
+
export let duration = 250;
|
|
7
8
|
export let background = "variant-filled-secondary";
|
|
8
9
|
export let width = "max-w-[640px]";
|
|
9
10
|
export let color = "";
|
|
@@ -76,15 +77,30 @@ $:
|
|
|
76
77
|
classesToast = `${cToast} ${width} ${color} ${padding} ${spacing} ${rounded} ${shadow}`;
|
|
77
78
|
$:
|
|
78
79
|
filteredToasts = Array.from($toastStore).slice(0, max);
|
|
80
|
+
const [send, receive] = crossfade({
|
|
81
|
+
duration: (d) => Math.sqrt(d * duration),
|
|
82
|
+
fallback(node) {
|
|
83
|
+
const style = getComputedStyle(node);
|
|
84
|
+
const transform = style.transform === "none" ? "" : style.transform;
|
|
85
|
+
return {
|
|
86
|
+
duration,
|
|
87
|
+
easing: cubicInOut,
|
|
88
|
+
css: (t, u) => `
|
|
89
|
+
transform: ${transform} scale(${t}) translate(${u * animAxis.x}%, ${u * animAxis.y}%);
|
|
90
|
+
opacity: ${t}
|
|
91
|
+
`
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
79
95
|
</script>
|
|
80
96
|
|
|
81
97
|
{#if $toastStore.length}
|
|
82
98
|
<!-- Wrapper -->
|
|
83
99
|
<div class="snackbar-wrapper {classesWrapper}" data-testid="snackbar-wrapper">
|
|
84
100
|
<!-- List -->
|
|
85
|
-
<div class="snackbar {classesSnackbar}"
|
|
101
|
+
<div class="snackbar {classesSnackbar}" >
|
|
86
102
|
{#each filteredToasts as t, i (t)}
|
|
87
|
-
<div animate:flip={{ duration }}>
|
|
103
|
+
<div animate:flip={{ duration }} in:receive="{{key: t.id}}" out:send="{{key: t.id}}">
|
|
88
104
|
<!-- Toast -->
|
|
89
105
|
<div class="toast {classesToast} {t.background ?? background} {t.classes}" role="alert" aria-live="polite" data-testid="toast">
|
|
90
106
|
<div class="text-base">{@html t.message}</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skeletonlabs/skeleton",
|
|
3
|
-
"version": "v1.2.
|
|
3
|
+
"version": "v1.2.5",
|
|
4
4
|
"description": "A SvelteKit component library.",
|
|
5
5
|
"author": "endigo9740 <chris@skeletonlabs.dev>",
|
|
6
6
|
"scripts": {
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@vercel/analytics": "^0.1.11",
|
|
54
54
|
"autoprefixer": "^10.4.14",
|
|
55
55
|
"c8": "^7.13.0",
|
|
56
|
+
"cspell": "^6.31.1",
|
|
56
57
|
"eslint": "^8.37.0",
|
|
57
58
|
"eslint-config-prettier": "^8.8.0",
|
|
58
59
|
"eslint-plugin-svelte3": "^4.0.0",
|
|
@@ -99,7 +100,6 @@
|
|
|
99
100
|
"./src/lib/themes/*",
|
|
100
101
|
"!./dist/**/*.test.*"
|
|
101
102
|
],
|
|
102
|
-
"svelte": "./dist/index.js",
|
|
103
103
|
"typesVersions": {
|
|
104
104
|
">4.0": {
|
|
105
105
|
"index": [
|
package/src/lib/styles/core.css
CHANGED
|
@@ -7,7 +7,7 @@ IMPORTANT:
|
|
|
7
7
|
Be sure to remove these directives from your global CSS stylesheet.
|
|
8
8
|
|
|
9
9
|
Tailwind directives should only be included ONCE per project.
|
|
10
|
-
These directives should
|
|
10
|
+
These directives should precede ALL Skeleton stylesheets.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
@tailwind base;
|