@skeletonlabs/skeleton 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{actions → dist/actions}/FocusTrap/focusTrap.js +3 -3
- package/{components → dist/components}/Accordion/AccordionItem.svelte.d.ts +1 -1
- package/{components → dist/components}/AppBar/AppBar.svelte +1 -1
- package/{components → dist/components}/AppRail/AppRailTile.svelte +3 -3
- package/{components → dist/components}/AppRail/AppRailTile.svelte.d.ts +2 -2
- package/dist/components/Autocomplete/Autocomplete.svelte +86 -0
- package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +48 -0
- package/dist/components/Autocomplete/types.d.ts +10 -0
- package/dist/components/Autocomplete/types.js +2 -0
- package/{components → dist/components}/Avatar/Avatar.svelte +6 -2
- package/{components → dist/components}/FileButton/FileButton.svelte +3 -2
- package/{components → dist/components}/FileButton/FileButton.svelte.d.ts +2 -0
- package/{components → dist/components}/InputChip/InputChip.svelte +33 -18
- package/{components → dist/components}/InputChip/InputChip.svelte.d.ts +3 -0
- package/{components → dist/components}/ListBox/ListBox.svelte +1 -1
- package/{components → dist/components}/ListBox/ListBoxItem.svelte +31 -29
- package/{components → dist/components}/Radio/RadioItem.svelte +20 -18
- package/{components → dist/components}/RangeSlider/RangeSlider.svelte +4 -2
- package/{components → dist/components}/RangeSlider/RangeSlider.svelte.d.ts +1 -1
- package/{components → dist/components}/SlideToggle/SlideToggle.svelte.d.ts +1 -1
- package/{components → dist/components}/Stepper/Step.svelte +3 -1
- package/{components → dist/components}/Tab/Tab.svelte +24 -22
- package/{components → dist/components}/Table/Table.svelte +4 -2
- package/{components → dist/components}/Table/Table.svelte.d.ts +4 -0
- package/{components → dist/components}/TableOfContents/TableOfContents.svelte +3 -3
- package/{index.d.ts → dist/index.d.ts} +2 -0
- package/{index.js → dist/index.js} +1 -0
- package/{utilities → dist/utilities}/Drawer/Drawer.svelte +4 -3
- package/{utilities → dist/utilities}/Drawer/Drawer.svelte.d.ts +2 -0
- package/{utilities → dist/utilities}/LightSwitch/lightswitch.js +3 -3
- package/{utilities → dist/utilities}/Modal/Modal.svelte +20 -9
- package/{utilities → dist/utilities}/Modal/Modal.svelte.d.ts +2 -0
- package/{utilities → dist/utilities}/Popup/popup.d.ts +1 -1
- package/{utilities → dist/utilities}/Popup/popup.js +87 -29
- package/{utilities → dist/utilities}/Popup/types.d.ts +1 -1
- package/{utilities → dist/utilities}/Toast/Toast.svelte +3 -2
- package/{utilities → dist/utilities}/Toast/Toast.svelte.d.ts +2 -0
- package/{utilities → dist/utilities}/Toast/stores.js +15 -9
- package/{utilities → dist/utilities}/Toast/types.d.ts +2 -0
- package/package.json +108 -167
- package/{styles → src/lib/styles}/elements/buttons.css +7 -3
- package/{styles → src/lib/styles}/elements/forms.css +1 -1
- package/{styles → src/lib/styles}/elements/lists.css +5 -1
- package/src/lib/tailwind/.DS_Store +0 -0
- package/src/lib/tailwind/generated/intellisense-classes.cjs +1 -0
- package/{tailwind → src/lib/tailwind}/intellisense.cjs +1 -1
- package/{tailwind → src/lib/tailwind}/tokens/rings.cjs +2 -2
- package/{themes → src/lib/themes}/theme-gold-nouveau.css +0 -1
- package/{themes → src/lib/themes}/theme-hamlindigo.css +1 -3
- package/{themes → src/lib/themes}/theme-modern.css +0 -1
- package/{themes → src/lib/themes}/theme-rocket.css +1 -4
- package/{themes → src/lib/themes}/theme-sahara.css +4 -7
- package/{themes → src/lib/themes}/theme-seafoam.css +1 -2
- package/{themes → src/lib/themes}/theme-seasonal.css +0 -1
- package/{themes → src/lib/themes}/theme-skeleton.css +0 -3
- package/src/lib/themes/theme-test.css +96 -0
- package/{themes → src/lib/themes}/theme-vintage.css +2 -4
- package/tailwind/core.d.cts +0 -5
- package/tailwind/generated/intellisense-classes.cjs +0 -1
- package/tailwind/generated/intellisense-classes.d.cts +0 -1979
- package/tailwind/intellisense.d.cts +0 -5
- package/tailwind/settings.d.cts +0 -6
- package/tailwind/skeleton.d.cts +0 -7
- package/tailwind/theme/colors.d.cts +0 -2
- package/tailwind/tokens/backgrounds.d.cts +0 -2
- package/tailwind/tokens/border-radius.d.cts +0 -33
- package/tailwind/tokens/borders.d.cts +0 -6
- package/tailwind/tokens/fills.d.cts +0 -15
- package/tailwind/tokens/rings.d.cts +0 -22
- package/tailwind/tokens/text.d.cts +0 -21
- package/{actions → dist/actions}/Clipboard/clipboard.d.ts +0 -0
- package/{actions → dist/actions}/Clipboard/clipboard.js +0 -0
- package/{actions → dist/actions}/Filters/filter.d.ts +0 -0
- package/{actions → dist/actions}/Filters/filter.js +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Apollo.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Apollo.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/BlueNight.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/BlueNight.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Emerald.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Emerald.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/GreenFall.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/GreenFall.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Noir.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Noir.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/NoirLight.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/NoirLight.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Rustic.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Rustic.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Summer84.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/Summer84.svelte.d.ts +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/XPro.svelte +0 -0
- package/{actions → dist/actions}/Filters/svg-filters/XPro.svelte.d.ts +0 -0
- package/{actions → dist/actions}/FocusTrap/focusTrap.d.ts +0 -0
- package/{components → dist/components}/Accordion/Accordion.svelte +0 -0
- package/{components → dist/components}/Accordion/Accordion.svelte.d.ts +0 -0
- package/{components → dist/components}/Accordion/AccordionItem.svelte +0 -0
- package/{components → dist/components}/AppBar/AppBar.svelte.d.ts +0 -0
- package/{components → dist/components}/AppRail/AppRail.svelte +0 -0
- package/{components → dist/components}/AppRail/AppRail.svelte.d.ts +0 -0
- package/{components → dist/components}/AppShell/AppShell.svelte +0 -0
- package/{components → dist/components}/AppShell/AppShell.svelte.d.ts +0 -0
- package/{components → dist/components}/Avatar/Avatar.svelte.d.ts +0 -0
- package/{components → dist/components}/ConicGradient/ConicGradient.svelte +0 -0
- package/{components → dist/components}/ConicGradient/ConicGradient.svelte.d.ts +0 -0
- package/{components → dist/components}/ConicGradient/settings.d.ts +0 -0
- package/{components → dist/components}/ConicGradient/settings.js +0 -0
- package/{components → dist/components}/ConicGradient/types.d.ts +0 -0
- package/{components → dist/components}/ConicGradient/types.js +0 -0
- package/{components → dist/components}/FileDropzone/FileDropzone.svelte +0 -0
- package/{components → dist/components}/FileDropzone/FileDropzone.svelte.d.ts +0 -0
- package/{components → dist/components}/ListBox/ListBox.svelte.d.ts +0 -0
- package/{components → dist/components}/ListBox/ListBoxItem.svelte.d.ts +0 -0
- package/{components → dist/components}/Paginator/Paginator.svelte +0 -0
- package/{components → dist/components}/Paginator/Paginator.svelte.d.ts +0 -0
- package/{components → dist/components}/Paginator/types.d.ts +0 -0
- package/{components → dist/components}/Paginator/types.js +0 -0
- package/{components → dist/components}/ProgressBar/ProgressBar.svelte +0 -0
- package/{components → dist/components}/ProgressBar/ProgressBar.svelte.d.ts +0 -0
- package/{components → dist/components}/ProgressRadial/ProgressRadial.svelte +0 -0
- package/{components → dist/components}/ProgressRadial/ProgressRadial.svelte.d.ts +0 -0
- package/{components → dist/components}/Radio/RadioGroup.svelte +0 -0
- package/{components → dist/components}/Radio/RadioGroup.svelte.d.ts +0 -0
- package/{components → dist/components}/Radio/RadioItem.svelte.d.ts +0 -0
- package/{components → dist/components}/SlideToggle/SlideToggle.svelte +0 -0
- package/{components → dist/components}/Stepper/Step.svelte.d.ts +0 -0
- package/{components → dist/components}/Stepper/Stepper.svelte +0 -0
- package/{components → dist/components}/Stepper/Stepper.svelte.d.ts +0 -0
- package/{components → dist/components}/Tab/Tab.svelte.d.ts +1 -1
- package/{components → dist/components}/Tab/TabGroup.svelte +0 -0
- package/{components → dist/components}/Tab/TabGroup.svelte.d.ts +0 -0
- package/{components → dist/components}/Table/types.d.ts +0 -0
- package/{components → dist/components}/Table/types.js +0 -0
- package/{components → dist/components}/Table/utils.d.ts +0 -0
- package/{components → dist/components}/Table/utils.js +0 -0
- package/{components → dist/components}/TableOfContents/TableOfContents.svelte.d.ts +0 -0
- package/{types → dist/types}/index.d.ts +0 -0
- package/{types → dist/types}/index.js +0 -0
- package/{types → dist/types}/tailwind.d.ts +0 -0
- package/{types → dist/types}/tailwind.js +0 -0
- package/{utilities → dist/utilities}/CodeBlock/CodeBlock.svelte +0 -0
- package/{utilities → dist/utilities}/CodeBlock/CodeBlock.svelte.d.ts +0 -0
- package/{utilities → dist/utilities}/CodeBlock/stores.d.ts +0 -0
- package/{utilities → dist/utilities}/CodeBlock/stores.js +0 -0
- package/{utilities → dist/utilities}/DataTable/DataTable.d.ts +0 -0
- package/{utilities → dist/utilities}/DataTable/DataTable.js +0 -0
- package/{utilities → dist/utilities}/DataTable/actions.d.ts +0 -0
- package/{utilities → dist/utilities}/DataTable/actions.js +0 -0
- package/{utilities → dist/utilities}/DataTable/types.d.ts +0 -0
- package/{utilities → dist/utilities}/DataTable/types.js +0 -0
- package/{utilities → dist/utilities}/Drawer/stores.d.ts +0 -0
- package/{utilities → dist/utilities}/Drawer/stores.js +0 -0
- package/{utilities → dist/utilities}/Drawer/types.d.ts +0 -0
- package/{utilities → dist/utilities}/Drawer/types.js +0 -0
- package/{utilities → dist/utilities}/LightSwitch/LightSwitch.svelte +0 -0
- package/{utilities → dist/utilities}/LightSwitch/LightSwitch.svelte.d.ts +0 -0
- package/{utilities → dist/utilities}/LightSwitch/lightswitch.d.ts +0 -0
- package/{utilities → dist/utilities}/LocalStorageStore/LocalStorageStore.d.ts +0 -0
- package/{utilities → dist/utilities}/LocalStorageStore/LocalStorageStore.js +0 -0
- package/{utilities → dist/utilities}/Modal/stores.d.ts +0 -0
- package/{utilities → dist/utilities}/Modal/stores.js +0 -0
- package/{utilities → dist/utilities}/Modal/types.d.ts +0 -0
- package/{utilities → dist/utilities}/Modal/types.js +0 -0
- package/{utilities → dist/utilities}/Popup/types.js +0 -0
- package/{utilities → dist/utilities}/Toast/stores.d.ts +0 -0
- package/{utilities → dist/utilities}/Toast/types.js +0 -0
- package/{styles → src/lib/styles}/all.css +0 -0
- package/{styles → src/lib/styles}/core.css +0 -0
- package/{styles → src/lib/styles}/elements/alerts.css +0 -0
- package/{styles → src/lib/styles}/elements/badges.css +0 -0
- package/{styles → src/lib/styles}/elements/breadcrumbs.css +0 -0
- package/{styles → src/lib/styles}/elements/cards.css +0 -0
- package/{styles → src/lib/styles}/elements/chips.css +0 -0
- package/{styles → src/lib/styles}/elements/logo-clouds.css +0 -0
- package/{styles → src/lib/styles}/elements/modals.css +0 -0
- package/{styles → src/lib/styles}/elements/placeholders.css +0 -0
- package/{styles → src/lib/styles}/elements/popups.css +0 -0
- package/{styles → src/lib/styles}/elements/tables.css +2 -2
- /package/{styles → src/lib/styles}/elements.css +0 -0
- /package/{styles → src/lib/styles}/highlight-js.css +0 -0
- /package/{styles → src/lib/styles}/tailwind.css +0 -0
- /package/{styles → src/lib/styles}/typography.css +0 -0
- /package/{styles → src/lib/styles}/variants.css +0 -0
- /package/{tailwind → src/lib/tailwind}/core.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/settings.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/skeleton.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/theme/colors.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/tokens/backgrounds.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/tokens/border-radius.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/tokens/borders.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/tokens/fills.cjs +0 -0
- /package/{tailwind → src/lib/tailwind}/tokens/text.cjs +0 -0
- /package/{themes → src/lib/themes}/theme-crimson.css +0 -0
|
@@ -12,7 +12,7 @@ export let spacing = getContext("spacing");
|
|
|
12
12
|
const cBase = "text-center cursor-pointer transition-colors duration-100";
|
|
13
13
|
const cInterface = "";
|
|
14
14
|
let elemInput;
|
|
15
|
-
function
|
|
15
|
+
function onKeyDown(event) {
|
|
16
16
|
if (["Enter", "Space"].includes(event.code)) {
|
|
17
17
|
event.preventDefault();
|
|
18
18
|
elemInput.click();
|
|
@@ -32,26 +32,28 @@ function prunedRestProps() {
|
|
|
32
32
|
}
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
<label
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
35
|
+
<label>
|
|
36
|
+
<!-- A11y attributes are not allowed on <label> -->
|
|
37
|
+
<div
|
|
38
|
+
class="tab {classesBase}"
|
|
39
|
+
data-testid="tab"
|
|
40
|
+
role="tab"
|
|
41
|
+
aria-controls={controls}
|
|
42
|
+
aria-selected={selected}
|
|
43
|
+
tabindex="0"
|
|
44
|
+
on:keydown={onKeyDown}
|
|
45
|
+
on:keydown
|
|
46
|
+
on:keyup
|
|
47
|
+
on:keypress
|
|
48
|
+
>
|
|
49
|
+
<!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
|
|
50
|
+
<div class="h-0 w-0 overflow-hidden">
|
|
51
|
+
<input bind:this={elemInput} type="radio" bind:group {name} {value} {...prunedRestProps()} tabindex="-1" on:click on:change />
|
|
52
|
+
</div>
|
|
53
|
+
<!-- Interface -->
|
|
54
|
+
<div class="tab-interface {classesInterface}">
|
|
55
|
+
{#if $$slots.lead}<div class="tab-lead"><slot name="lead" /></div>{/if}
|
|
56
|
+
<div class="tab-label"><slot /></div>
|
|
57
|
+
</div>
|
|
56
58
|
</div>
|
|
57
59
|
</label>
|
|
@@ -7,9 +7,11 @@ export let element = "table";
|
|
|
7
7
|
export let text = "";
|
|
8
8
|
export let color = "";
|
|
9
9
|
export let regionHead = "";
|
|
10
|
+
export let regionHeadCell = "";
|
|
10
11
|
export let regionBody = "";
|
|
11
12
|
export let regionCell = "";
|
|
12
13
|
export let regionFoot = "";
|
|
14
|
+
export let regionFootCell = "";
|
|
13
15
|
function onRowClick(event, rowIndex) {
|
|
14
16
|
if (!interactive)
|
|
15
17
|
return;
|
|
@@ -42,7 +44,7 @@ $:
|
|
|
42
44
|
<thead class="table-head {regionHead}">
|
|
43
45
|
<tr>
|
|
44
46
|
{#each source.head as heading }
|
|
45
|
-
<th>{@html heading}</th>
|
|
47
|
+
<th class="{regionHeadCell}">{@html heading}</th>
|
|
46
48
|
{/each}
|
|
47
49
|
</tr>
|
|
48
50
|
</thead>
|
|
@@ -76,7 +78,7 @@ $:
|
|
|
76
78
|
<tfoot class="table-foot {regionFoot}">
|
|
77
79
|
<tr>
|
|
78
80
|
{#each source.foot as cell }
|
|
79
|
-
<td>{@html cell}</td>
|
|
81
|
+
<td class="{regionFootCell}">{@html cell}</td>
|
|
80
82
|
{/each}
|
|
81
83
|
</tr>
|
|
82
84
|
</tfoot>
|
|
@@ -15,12 +15,16 @@ declare const __propDef: {
|
|
|
15
15
|
color?: string | undefined;
|
|
16
16
|
/** Provide arbitrary classes for the table head.*/
|
|
17
17
|
regionHead?: string | undefined;
|
|
18
|
+
/** Provide arbitrary classes for the table head cells.*/
|
|
19
|
+
regionHeadCell?: string | undefined;
|
|
18
20
|
/** Provide arbitrary classes for the table body.*/
|
|
19
21
|
regionBody?: string | undefined;
|
|
20
22
|
/** Provide arbitrary classes for the table cells.*/
|
|
21
23
|
regionCell?: string | undefined;
|
|
22
24
|
/** Provide arbitrary classes for the table foot.*/
|
|
23
25
|
regionFoot?: string | undefined;
|
|
26
|
+
/** Provide arbitrary classes for the table foot cells.*/
|
|
27
|
+
regionFootCell?: string | undefined;
|
|
24
28
|
};
|
|
25
29
|
events: {
|
|
26
30
|
/** {rowMetaData} selected - Fires when a table row is clicked.*/
|
|
@@ -31,9 +31,9 @@ function generateHeadingList() {
|
|
|
31
31
|
let newId = elem.innerText.replaceAll(/[^a-zA-Z0-9 ]/g, "").replaceAll(" ", "-").toLowerCase();
|
|
32
32
|
elem.id = `${newId}`;
|
|
33
33
|
}
|
|
34
|
-
if (elem.querySelector(".permalink"))
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
if (!elem.querySelector(".permalink")) {
|
|
35
|
+
elem.innerHTML += `<a href="#${elem.id}" class="permalink">\u{1F517}</a>`;
|
|
36
|
+
}
|
|
37
37
|
filteredHeadingsList.push(elem);
|
|
38
38
|
});
|
|
39
39
|
filteredHeadingsList = [...filteredHeadingsList];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { AutocompleteOption } from './components/Autocomplete/types';
|
|
1
2
|
export type { ConicStop } from './components/ConicGradient/types';
|
|
2
3
|
export type { DrawerSettings } from './utilities/Drawer/types';
|
|
3
4
|
export type { ModalSettings, ModalComponent } from './utilities/Modal/types';
|
|
@@ -24,6 +25,7 @@ export { default as AppBar } from './components/AppBar/AppBar.svelte';
|
|
|
24
25
|
export { default as AppRail } from './components/AppRail/AppRail.svelte';
|
|
25
26
|
export { default as AppRailTile } from './components/AppRail/AppRailTile.svelte';
|
|
26
27
|
export { default as AppShell } from './components/AppShell/AppShell.svelte';
|
|
28
|
+
export { default as Autocomplete } from './components/Autocomplete/Autocomplete.svelte';
|
|
27
29
|
export { default as Avatar } from './components/Avatar/Avatar.svelte';
|
|
28
30
|
export { default as ConicGradient } from './components/ConicGradient/ConicGradient.svelte';
|
|
29
31
|
export { default as FileButton } from './components/FileButton/FileButton.svelte';
|
|
@@ -35,6 +35,7 @@ export { default as AppBar } from './components/AppBar/AppBar.svelte';
|
|
|
35
35
|
export { default as AppRail } from './components/AppRail/AppRail.svelte';
|
|
36
36
|
export { default as AppRailTile } from './components/AppRail/AppRailTile.svelte';
|
|
37
37
|
export { default as AppShell } from './components/AppShell/AppShell.svelte';
|
|
38
|
+
export { default as Autocomplete } from './components/Autocomplete/Autocomplete.svelte';
|
|
38
39
|
export { default as Avatar } from './components/Avatar/Avatar.svelte';
|
|
39
40
|
export { default as ConicGradient } from './components/ConicGradient/ConicGradient.svelte';
|
|
40
41
|
export { default as FileButton } from './components/FileButton/FileButton.svelte';
|
|
@@ -14,6 +14,7 @@ export let rounded = "";
|
|
|
14
14
|
export let shadow = "shadow-xl";
|
|
15
15
|
export let width = "";
|
|
16
16
|
export let height = "";
|
|
17
|
+
export let zIndex = "z-40";
|
|
17
18
|
export let regionBackdrop = "";
|
|
18
19
|
export let regionDrawer = "";
|
|
19
20
|
export let labelledby = "";
|
|
@@ -24,8 +25,8 @@ const presets = {
|
|
|
24
25
|
left: { alignment: "justify-start", width: "w-[90%]", height: "h-full", rounded: "rounded-tr-container-token rounded-br-container-token" },
|
|
25
26
|
right: { alignment: "justify-end", width: "w-[90%]", height: "h-full", rounded: "rounded-tl-container-token rounded-bl-container-token" }
|
|
26
27
|
};
|
|
27
|
-
const cBackdrop = "fixed top-0 left-0 right-0 bottom-0
|
|
28
|
-
const cDrawer = "
|
|
28
|
+
const cBackdrop = "fixed top-0 left-0 right-0 bottom-0 flex";
|
|
29
|
+
const cDrawer = "overflow-y-auto transition-transform";
|
|
29
30
|
let elemBackdrop;
|
|
30
31
|
let elemDrawer;
|
|
31
32
|
let anim = { x: 0, y: 0 };
|
|
@@ -110,7 +111,7 @@ $:
|
|
|
110
111
|
$:
|
|
111
112
|
classesRounded = rounded ? rounded : presets[position].rounded;
|
|
112
113
|
$:
|
|
113
|
-
classesBackdrop = `${cBackdrop} ${bgBackdrop} ${padding} ${blur} ${classesPosition} ${regionBackdrop} ${$$props.class ?? ""}`;
|
|
114
|
+
classesBackdrop = `${cBackdrop} ${bgBackdrop} ${padding} ${blur} ${classesPosition} ${regionBackdrop} ${zIndex} ${$$props.class ?? ""}`;
|
|
114
115
|
$:
|
|
115
116
|
classesDrawer = `${cDrawer} ${bgDrawer} ${border} ${rounded} ${shadow} ${classesWidth} ${classesHeight} ${classesRounded} ${regionDrawer}`;
|
|
116
117
|
</script>
|
|
@@ -24,6 +24,8 @@ declare const __propDef: {
|
|
|
24
24
|
width?: string | undefined;
|
|
25
25
|
/** Drawer - Provide classes to override the height.*/
|
|
26
26
|
height?: string | undefined;
|
|
27
|
+
/** Provide a class to override the z-index*/
|
|
28
|
+
zIndex?: string | undefined;
|
|
27
29
|
/** Provide arbitrary classes to the backdrop region.*/
|
|
28
30
|
regionBackdrop?: string | undefined;
|
|
29
31
|
/** Provide arbitrary classes to the drawer region.*/
|
|
@@ -44,11 +44,11 @@ export function setModeCurrent(value) {
|
|
|
44
44
|
export function setInitialClassState() {
|
|
45
45
|
const elemHtmlClasses = document.documentElement.classList;
|
|
46
46
|
// Conditions
|
|
47
|
-
const
|
|
48
|
-
const
|
|
47
|
+
const condLocalStorageUserPrefs = localStorage.getItem('modeUserPrefers') === 'false';
|
|
48
|
+
const condLocalStorageUserPrefsExists = !('modeUserPrefers' in localStorage);
|
|
49
49
|
const condMatchMedia = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
50
50
|
// Add/remove `.dark` class to HTML element
|
|
51
|
-
if (
|
|
51
|
+
if (condLocalStorageUserPrefs || (condLocalStorageUserPrefsExists && condMatchMedia)) {
|
|
52
52
|
elemHtmlClasses.add('dark');
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
@@ -16,6 +16,7 @@ export let padding = "p-4";
|
|
|
16
16
|
export let spacing = "space-y-4";
|
|
17
17
|
export let rounded = "rounded-container-token";
|
|
18
18
|
export let shadow = "shadow-xl";
|
|
19
|
+
export let zIndex = "z-[999]";
|
|
19
20
|
export let buttonNeutral = "variant-ghost-surface";
|
|
20
21
|
export let buttonPositive = "variant-filled";
|
|
21
22
|
export let buttonTextCancel = "Cancel";
|
|
@@ -25,7 +26,7 @@ export let regionBackdrop = "bg-surface-backdrop-token";
|
|
|
25
26
|
export let regionHeader = "text-2xl font-bold";
|
|
26
27
|
export let regionBody = "max-h-[200px] overflow-hidden";
|
|
27
28
|
export let regionFooter = "flex justify-end space-x-2";
|
|
28
|
-
const cBackdrop = "fixed top-0 left-0 right-0 bottom-0
|
|
29
|
+
const cBackdrop = "fixed top-0 left-0 right-0 bottom-0";
|
|
29
30
|
const cTransitionLayer = "w-full h-full p-4 overflow-y-auto flex justify-center";
|
|
30
31
|
const cModal = "block";
|
|
31
32
|
const cModalImage = "w-full h-auto";
|
|
@@ -49,11 +50,13 @@ modalStore.subscribe((modals) => {
|
|
|
49
50
|
function onBackdropInteraction(event) {
|
|
50
51
|
if (!(event.target instanceof Element))
|
|
51
52
|
return;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
const classList = event.target.classList;
|
|
54
|
+
if (classList.contains("modal-backdrop") || classList.contains("modal-transition")) {
|
|
55
|
+
if ($modalStore[0].response)
|
|
56
|
+
$modalStore[0].response(void 0);
|
|
57
|
+
modalStore.close();
|
|
58
|
+
dispatch("backdrop", event);
|
|
59
|
+
}
|
|
57
60
|
}
|
|
58
61
|
function onClose() {
|
|
59
62
|
if ($modalStore[0].response)
|
|
@@ -65,7 +68,8 @@ function onConfirm() {
|
|
|
65
68
|
$modalStore[0].response(true);
|
|
66
69
|
modalStore.close();
|
|
67
70
|
}
|
|
68
|
-
function onPromptSubmit() {
|
|
71
|
+
function onPromptSubmit(event) {
|
|
72
|
+
event.preventDefault();
|
|
69
73
|
if ($modalStore[0].response)
|
|
70
74
|
$modalStore[0].response(promptValue);
|
|
71
75
|
modalStore.close();
|
|
@@ -79,7 +83,7 @@ function onKeyDown(event) {
|
|
|
79
83
|
$:
|
|
80
84
|
cPosition = $modalStore[0]?.position ?? position;
|
|
81
85
|
$:
|
|
82
|
-
classesBackdrop = `${cBackdrop} ${regionBackdrop} ${$$props.class ?? ""} ${$modalStore[0]?.backdropClasses ?? ""}`;
|
|
86
|
+
classesBackdrop = `${cBackdrop} ${regionBackdrop} ${zIndex} ${$$props.class ?? ""} ${$modalStore[0]?.backdropClasses ?? ""}`;
|
|
83
87
|
$:
|
|
84
88
|
classesTransitionLayer = `${cTransitionLayer} ${cPosition ?? ""}`;
|
|
85
89
|
$:
|
|
@@ -87,10 +91,12 @@ $:
|
|
|
87
91
|
$:
|
|
88
92
|
parent = {
|
|
89
93
|
position,
|
|
94
|
+
// ---
|
|
90
95
|
duration,
|
|
91
96
|
flyOpacity,
|
|
92
97
|
flyX,
|
|
93
98
|
flyY,
|
|
99
|
+
// ---
|
|
94
100
|
background,
|
|
95
101
|
width,
|
|
96
102
|
height,
|
|
@@ -98,15 +104,18 @@ $:
|
|
|
98
104
|
spacing,
|
|
99
105
|
rounded,
|
|
100
106
|
shadow,
|
|
107
|
+
// ---
|
|
101
108
|
buttonNeutral,
|
|
102
109
|
buttonPositive,
|
|
103
110
|
buttonTextCancel,
|
|
104
111
|
buttonTextConfirm,
|
|
105
112
|
buttonTextSubmit,
|
|
113
|
+
// ---
|
|
106
114
|
regionBackdrop,
|
|
107
115
|
regionHeader,
|
|
108
116
|
regionBody,
|
|
109
117
|
regionFooter,
|
|
118
|
+
// ---
|
|
110
119
|
onClose
|
|
111
120
|
};
|
|
112
121
|
</script>
|
|
@@ -182,7 +191,9 @@ $:
|
|
|
182
191
|
aria-label={$modalStore[0].title ?? ''}
|
|
183
192
|
>
|
|
184
193
|
<svelte:component this={currentComponent?.ref} {...currentComponent?.props} {parent}>
|
|
185
|
-
{
|
|
194
|
+
{#if currentComponent?.slot}
|
|
195
|
+
{@html currentComponent?.slot}
|
|
196
|
+
{/if}
|
|
186
197
|
</svelte:component>
|
|
187
198
|
</div>
|
|
188
199
|
{/if}
|
|
@@ -29,6 +29,8 @@ declare const __propDef: {
|
|
|
29
29
|
rounded?: string | undefined;
|
|
30
30
|
/** Provide classes to style modal box shadow.*/
|
|
31
31
|
shadow?: string | undefined;
|
|
32
|
+
/** Provide a class to override the z-index*/
|
|
33
|
+
zIndex?: string | undefined;
|
|
32
34
|
/** Provide classes for neutral buttons, such as Cancel.*/
|
|
33
35
|
buttonNeutral?: string | undefined;
|
|
34
36
|
/** Provide classes for positive actions, such as Confirm or Submit.*/
|
|
@@ -2,6 +2,6 @@ import { type Writable } from 'svelte/store';
|
|
|
2
2
|
import type { PopupSettings } from './types';
|
|
3
3
|
export declare const storePopup: Writable<any>;
|
|
4
4
|
export declare function popup(node: HTMLElement, args: PopupSettings): {
|
|
5
|
-
update(newArgs:
|
|
5
|
+
update(newArgs: PopupSettings): void;
|
|
6
6
|
destroy(): void;
|
|
7
7
|
} | undefined;
|
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
import { get, writable } from 'svelte/store';
|
|
2
2
|
// Store
|
|
3
3
|
export const storePopup = writable(undefined);
|
|
4
|
+
function isNode(node) {
|
|
5
|
+
return node instanceof Node;
|
|
6
|
+
}
|
|
4
7
|
// Action
|
|
5
8
|
export function popup(node, args) {
|
|
6
|
-
|
|
7
|
-
const { event = 'click', target, placement, closeQuery = 'a[href], button', middleware, state } = args;
|
|
8
|
-
if (!event || !target)
|
|
9
|
+
if (!args.event || !args.target)
|
|
9
10
|
return;
|
|
10
11
|
// Local
|
|
11
12
|
const { computePosition, autoUpdate, flip, shift, offset, arrow } = get(storePopup);
|
|
12
|
-
const elemPopup = document.querySelector(`[data-popup="${target}"]`);
|
|
13
|
+
const elemPopup = document.querySelector(`[data-popup="${args.target}"]`);
|
|
13
14
|
const elemArrow = elemPopup?.querySelector(`.arrow`) ?? null;
|
|
14
15
|
let isVisible = false;
|
|
15
16
|
let autoUpdateCleanup;
|
|
16
17
|
// Local A11y Variables
|
|
17
|
-
const elemWhitelist = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])';
|
|
18
|
+
const elemWhitelist = ':is(a[href], button, input, textarea, select, details, [tabindex]):not([tabindex="-1"])';
|
|
18
19
|
let activeFocusIdx;
|
|
19
20
|
let focusableElems;
|
|
20
21
|
// On Init (floating ui)
|
|
21
22
|
function render() {
|
|
22
23
|
if (!elemPopup || !computePosition)
|
|
23
24
|
return;
|
|
24
|
-
// Construct
|
|
25
|
+
// Construct Middleware
|
|
25
26
|
// Note the order: https://floating-ui.com/docs/middleware#ordering
|
|
26
|
-
const
|
|
27
|
+
const genMiddleware = [];
|
|
27
28
|
// https://floating-ui.com/docs/offset
|
|
28
29
|
if (offset)
|
|
29
|
-
|
|
30
|
+
genMiddleware.push(offset(args.middleware?.offset ?? 8));
|
|
30
31
|
// https://floating-ui.com/docs/shift
|
|
31
32
|
if (shift)
|
|
32
|
-
|
|
33
|
+
genMiddleware.push(shift(args.middleware?.shift ?? { padding: 8 }));
|
|
33
34
|
// https://floating-ui.com/docs/flip
|
|
34
35
|
if (flip)
|
|
35
|
-
|
|
36
|
+
genMiddleware.push(flip(args.middleware?.flip));
|
|
36
37
|
// https://floating-ui.com/docs/arrow
|
|
37
38
|
if (arrow && elemArrow)
|
|
38
|
-
|
|
39
|
+
genMiddleware.push(arrow(args.middleware?.arrow ?? { element: elemArrow }));
|
|
39
40
|
// https://floating-ui.com/docs/computePosition
|
|
40
41
|
computePosition(node, elemPopup, {
|
|
41
|
-
placement: placement ?? 'bottom',
|
|
42
|
-
middleware:
|
|
42
|
+
placement: args.placement ?? 'bottom',
|
|
43
|
+
middleware: genMiddleware
|
|
43
44
|
}).then(({ x, y, placement, middlewareData }) => {
|
|
44
45
|
Object.assign(elemPopup.style, {
|
|
45
46
|
left: `${x}px`,
|
|
@@ -79,7 +80,22 @@ export function popup(node, args) {
|
|
|
79
80
|
// Automatically focus the element if openWithFocus is true (for example if
|
|
80
81
|
// the menu was opened with Enter instead of with a click
|
|
81
82
|
activeFocusIdx = 0;
|
|
82
|
-
|
|
83
|
+
// if the popup was triggered via focus, we don't want to move that focus
|
|
84
|
+
if (args.event !== 'focus' && args.event !== 'focus-click') {
|
|
85
|
+
focusableElems[0]?.focus();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Close popup if element matching closeQuery is clicked
|
|
89
|
+
function closeOnQueryClick(clickedEl) {
|
|
90
|
+
if (!clickedEl)
|
|
91
|
+
return;
|
|
92
|
+
const interactiveMenuElems = elemPopup?.querySelectorAll(args.closeQuery || 'a[href], button');
|
|
93
|
+
if (!interactiveMenuElems?.length)
|
|
94
|
+
return;
|
|
95
|
+
interactiveMenuElems.forEach((elem) => {
|
|
96
|
+
if (elem.contains(clickedEl))
|
|
97
|
+
close();
|
|
98
|
+
});
|
|
83
99
|
}
|
|
84
100
|
// Window Click Handler
|
|
85
101
|
const onWindowClick = (event) => {
|
|
@@ -97,14 +113,7 @@ export function popup(node, args) {
|
|
|
97
113
|
close();
|
|
98
114
|
}
|
|
99
115
|
else {
|
|
100
|
-
|
|
101
|
-
const interactiveMenuElems = elemPopup?.querySelectorAll(closeQuery);
|
|
102
|
-
if (!interactiveMenuElems.length)
|
|
103
|
-
return;
|
|
104
|
-
interactiveMenuElems.forEach((elem) => {
|
|
105
|
-
if (elem.contains(event.target))
|
|
106
|
-
close();
|
|
107
|
-
});
|
|
116
|
+
closeOnQueryClick(event.target);
|
|
108
117
|
}
|
|
109
118
|
}
|
|
110
119
|
};
|
|
@@ -119,7 +128,31 @@ export function popup(node, args) {
|
|
|
119
128
|
isVisible = false;
|
|
120
129
|
stateEventHandler(false);
|
|
121
130
|
};
|
|
122
|
-
//
|
|
131
|
+
// Focus Handlers
|
|
132
|
+
function onFocusIn() {
|
|
133
|
+
if (!isVisible)
|
|
134
|
+
node.focus();
|
|
135
|
+
}
|
|
136
|
+
function onFocusOut(e) {
|
|
137
|
+
// if the focus is within the popup, or on the trigger node, do nothing
|
|
138
|
+
if (e.relatedTarget instanceof Element && (elemPopup?.contains(e.relatedTarget) || node.isSameNode(e.relatedTarget)))
|
|
139
|
+
return;
|
|
140
|
+
close();
|
|
141
|
+
}
|
|
142
|
+
function onMouseDown(e) {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
if (isNode(document.activeElement)) {
|
|
145
|
+
if (!node.isSameNode(document.activeElement)) {
|
|
146
|
+
node.focus();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (isVisible)
|
|
150
|
+
close();
|
|
151
|
+
else
|
|
152
|
+
show();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Visibility
|
|
123
156
|
function show() {
|
|
124
157
|
if (!elemPopup)
|
|
125
158
|
return;
|
|
@@ -150,8 +183,8 @@ export function popup(node, args) {
|
|
|
150
183
|
}
|
|
151
184
|
// State Handler
|
|
152
185
|
const stateEventHandler = (value) => {
|
|
153
|
-
if (state)
|
|
154
|
-
state({ state: value });
|
|
186
|
+
if (args.state)
|
|
187
|
+
args.state({ state: value });
|
|
155
188
|
};
|
|
156
189
|
// A11y Keydown Handler
|
|
157
190
|
const onWindowKeyDown = (event) => {
|
|
@@ -191,30 +224,55 @@ export function popup(node, args) {
|
|
|
191
224
|
};
|
|
192
225
|
// On Init
|
|
193
226
|
render();
|
|
194
|
-
// Event
|
|
195
|
-
if (event === 'click') {
|
|
227
|
+
// Event Listeners
|
|
228
|
+
if (args.event === 'click') {
|
|
196
229
|
window.addEventListener('click', onWindowClick, true);
|
|
197
230
|
}
|
|
198
|
-
if (event === 'hover') {
|
|
231
|
+
if (args.event === 'hover') {
|
|
199
232
|
node.addEventListener('mouseover', show, true);
|
|
200
233
|
node.addEventListener('mouseout', close, true);
|
|
201
234
|
}
|
|
202
|
-
if (event === 'hover-click') {
|
|
235
|
+
if (args.event === 'hover-click') {
|
|
203
236
|
node.addEventListener('mouseover', show, true);
|
|
204
237
|
window.addEventListener('click', onWindowClick, true);
|
|
205
238
|
}
|
|
239
|
+
if (args.event === 'focus' || args.event === 'focus-click') {
|
|
240
|
+
if (!elemPopup)
|
|
241
|
+
return;
|
|
242
|
+
node.addEventListener('focusin', show, true);
|
|
243
|
+
node.addEventListener('focusout', onFocusOut, true);
|
|
244
|
+
// if we tab into a closed popup, we will tab into the last element of any focusable element in elemPopup
|
|
245
|
+
// so we add an event listener to move the focus back to the node the `use:popup` directive is on
|
|
246
|
+
elemPopup.addEventListener('focusin', onFocusIn, true);
|
|
247
|
+
// when we focus off the end of the list, close the popup
|
|
248
|
+
elemPopup.addEventListener('focusout', onFocusOut, true);
|
|
249
|
+
// when an element inside the popup is clicked, close the popup if the element matches the closeQuery
|
|
250
|
+
elemPopup.addEventListener('click', onWindowClick, true);
|
|
251
|
+
}
|
|
252
|
+
if (args.event === 'focus-click') {
|
|
253
|
+
// we must use mousedown instead of click because click fires after focusin, meaning isVisible would always be true
|
|
254
|
+
// if the active element (one with current focus) is the same as the node (the element with the use:popup directive),
|
|
255
|
+
// then the user clicked on the node, so we should toggle the state of the popup
|
|
256
|
+
node.addEventListener('mousedown', onMouseDown, true);
|
|
257
|
+
}
|
|
206
258
|
// A11y Event Listeners
|
|
207
259
|
window.addEventListener('keydown', onWindowKeyDown, true);
|
|
208
260
|
// Lifecycle
|
|
209
261
|
return {
|
|
210
262
|
update(newArgs) {
|
|
211
263
|
args = newArgs;
|
|
264
|
+
render();
|
|
212
265
|
},
|
|
213
266
|
destroy() {
|
|
214
267
|
// ---
|
|
215
268
|
window.removeEventListener('click', onWindowClick, true);
|
|
216
269
|
node.removeEventListener('mouseover', onMouseOver, true);
|
|
217
270
|
node.removeEventListener('mouseout', onMouseOut, true);
|
|
271
|
+
node.removeEventListener('focusin', show, true);
|
|
272
|
+
node.removeEventListener('focusout', onFocusOut, true);
|
|
273
|
+
node.removeEventListener('mousedown', onMouseDown, true);
|
|
274
|
+
elemPopup?.removeEventListener('focusin', onFocusIn, true);
|
|
275
|
+
elemPopup?.removeEventListener('focusout', onFocusOut, true);
|
|
218
276
|
// ---
|
|
219
277
|
window.removeEventListener('keydown', onWindowKeyDown, true);
|
|
220
278
|
}
|
|
@@ -15,7 +15,7 @@ interface Middlware {
|
|
|
15
15
|
}
|
|
16
16
|
export interface PopupSettings {
|
|
17
17
|
/** Provide the event type. */
|
|
18
|
-
event: 'click' | 'hover' | 'hover-click';
|
|
18
|
+
event: 'click' | 'hover' | 'hover-click' | 'focus' | 'focus-click';
|
|
19
19
|
/** Match the popup data value `[data-popup]="targetNameHere"` */
|
|
20
20
|
target: string;
|
|
21
21
|
/** Set the placement position. Defaults 'bottom'. */
|
|
@@ -11,10 +11,11 @@ export let padding = "p-4";
|
|
|
11
11
|
export let spacing = "space-x-4";
|
|
12
12
|
export let rounded = "rounded-container-token";
|
|
13
13
|
export let shadow = "shadow-lg";
|
|
14
|
+
export let zIndex = "z-[888]";
|
|
14
15
|
export let buttonAction = "btn variant-filled";
|
|
15
16
|
export let buttonDismiss = "btn-icon btn-icon-sm variant-filled";
|
|
16
17
|
export let buttonDismissLabel = "\u2715";
|
|
17
|
-
const cWrapper = "flex fixed top-0 left-0 right-0 bottom-0
|
|
18
|
+
const cWrapper = "flex fixed top-0 left-0 right-0 bottom-0 pointer-events-none";
|
|
18
19
|
const cSnackbar = "flex flex-col space-y-2";
|
|
19
20
|
const cToast = "flex justify-between items-center pointer-events-auto";
|
|
20
21
|
const cToastActions = "flex items-center space-x-2";
|
|
@@ -68,7 +69,7 @@ function onAction(index) {
|
|
|
68
69
|
toastStore.close($toastStore[index].id);
|
|
69
70
|
}
|
|
70
71
|
$:
|
|
71
|
-
classesWrapper = `${cWrapper} ${cPosition} ${$$props.class || ""}`;
|
|
72
|
+
classesWrapper = `${cWrapper} ${cPosition} ${zIndex} ${$$props.class || ""}`;
|
|
72
73
|
$:
|
|
73
74
|
classesSnackbar = `${cSnackbar} ${cAlign} ${padding}`;
|
|
74
75
|
$:
|
|
@@ -22,6 +22,8 @@ declare const __propDef: {
|
|
|
22
22
|
rounded?: string | undefined;
|
|
23
23
|
/** Provide classes to set the border box shadow.*/
|
|
24
24
|
shadow?: string | undefined;
|
|
25
|
+
/** Provide a class to override the z-index*/
|
|
26
|
+
zIndex?: string | undefined;
|
|
25
27
|
/** Provide styles for the action button.*/
|
|
26
28
|
buttonAction?: string | undefined;
|
|
27
29
|
/** Provide styles for the dismiss button.*/
|
|
@@ -9,7 +9,7 @@ function randomUUID() {
|
|
|
9
9
|
// If toast should auto-hide, wait X time, then close by ID
|
|
10
10
|
function handleAutoHide(toast) {
|
|
11
11
|
if (toast.autohide === true) {
|
|
12
|
-
setTimeout(() => {
|
|
12
|
+
return setTimeout(() => {
|
|
13
13
|
toastStore.close(toast.id);
|
|
14
14
|
}, toast.timeout);
|
|
15
15
|
}
|
|
@@ -24,11 +24,12 @@ function toastService() {
|
|
|
24
24
|
// Trigger Callback
|
|
25
25
|
if (toast && toast.callback)
|
|
26
26
|
toast.callback({ id, status: 'queued' });
|
|
27
|
-
// Merge
|
|
27
|
+
// Merge with defaults
|
|
28
28
|
const tMerged = { ...toastDefaults, ...toast, id };
|
|
29
|
-
tStore.push(tMerged);
|
|
30
29
|
// Handle auto-hide, if needed
|
|
31
|
-
handleAutoHide(tMerged);
|
|
30
|
+
tMerged.timeoutId = handleAutoHide(tMerged);
|
|
31
|
+
// Push into store
|
|
32
|
+
tStore.push(tMerged);
|
|
32
33
|
// Return
|
|
33
34
|
return tStore;
|
|
34
35
|
}),
|
|
@@ -36,12 +37,17 @@ function toastService() {
|
|
|
36
37
|
close: (id) => update((tStore) => {
|
|
37
38
|
if (tStore.length > 0) {
|
|
38
39
|
const index = tStore.findIndex((t) => t.id === id);
|
|
39
|
-
// Trigger Callback
|
|
40
40
|
const selectedToast = tStore[index];
|
|
41
|
-
if (selectedToast
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
if (selectedToast) {
|
|
42
|
+
// Trigger Callback
|
|
43
|
+
if (selectedToast.callback)
|
|
44
|
+
selectedToast.callback({ id, status: 'closed' });
|
|
45
|
+
// Clear timeout
|
|
46
|
+
if (selectedToast.timeoutId)
|
|
47
|
+
clearTimeout(selectedToast.timeoutId);
|
|
48
|
+
// Remove
|
|
49
|
+
tStore.splice(index, 1);
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
return tStore;
|
|
47
53
|
}),
|
|
@@ -25,4 +25,6 @@ export interface ToastSettings {
|
|
|
25
25
|
export interface Toast extends ToastSettings {
|
|
26
26
|
/** A UUID will be auto-assigned on `.trigger()`. */
|
|
27
27
|
id: string;
|
|
28
|
+
/** The id of the `setTimeout` if `autohide` is enabled */
|
|
29
|
+
timeoutId?: ReturnType<typeof setTimeout>;
|
|
28
30
|
}
|