@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
package/utilities/Menu/menu.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
// Action: Menu
|
|
2
|
-
// https://svelte.dev/repl/0ace7a508bd843b798ae599940a91783?version=3.16.7
|
|
3
|
-
// prettier-ignore
|
|
4
|
-
export function menu(node, args) {
|
|
5
|
-
const elemMenu = document.querySelector(`[data-menu="${args.menu}"]`);
|
|
6
|
-
if (!elemMenu)
|
|
7
|
-
return;
|
|
8
|
-
const elemWhitelist = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])';
|
|
9
|
-
let activeFocusIdx;
|
|
10
|
-
let focusableElems;
|
|
11
|
-
const onInit = () => {
|
|
12
|
-
autoUpdateOrigin();
|
|
13
|
-
// Apply a11y attributes
|
|
14
|
-
elemMenu.setAttribute('role', 'menu');
|
|
15
|
-
};
|
|
16
|
-
// Menu States ---
|
|
17
|
-
const menuOpen = (openWithFocus = false) => {
|
|
18
|
-
elemMenu.style.display = 'block';
|
|
19
|
-
stateEventHandler(true);
|
|
20
|
-
// Create array of all focusable elements, so that we can iterate through them
|
|
21
|
-
focusableElems = Array.from(elemMenu.querySelectorAll(elemWhitelist));
|
|
22
|
-
// reset the focus index
|
|
23
|
-
activeFocusIdx = -1;
|
|
24
|
-
if (openWithFocus) {
|
|
25
|
-
// Automatically focus the element if openWithFocus is true (for example if
|
|
26
|
-
// the menu was opened with Enter instead of with a click
|
|
27
|
-
activeFocusIdx = 0;
|
|
28
|
-
focusableElems[0]?.focus();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const menuClose = () => {
|
|
32
|
-
elemMenu.style.display = 'none';
|
|
33
|
-
stateEventHandler(false);
|
|
34
|
-
};
|
|
35
|
-
const stateEventHandler = (state) => {
|
|
36
|
-
if (args.state)
|
|
37
|
-
args.state({ menu: args.menu, state });
|
|
38
|
-
};
|
|
39
|
-
// Click Handlers ---
|
|
40
|
-
const toggleMenu = () => {
|
|
41
|
-
// When the node is clicked, open the menu if it is closed, otherwise close it
|
|
42
|
-
if (elemMenu.style.display != 'block') {
|
|
43
|
-
autoUpdateOrigin();
|
|
44
|
-
menuOpen();
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
menuClose();
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const onWindowClick = (event) => {
|
|
51
|
-
args.interactive === true ? interactiveClickHandler(event) : standardClickHandler(event);
|
|
52
|
-
};
|
|
53
|
-
// Interactive FALSE - any click closes the menu
|
|
54
|
-
const standardClickHandler = (event) => {
|
|
55
|
-
// Any click outside the node closes the menu, but a click inside the node toggles the menu.
|
|
56
|
-
const outsideNode = node && !node.contains(event.target);
|
|
57
|
-
if (outsideNode) {
|
|
58
|
-
menuClose();
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
toggleMenu();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
// Interactive TRUE - clicks outside close menu
|
|
65
|
-
const interactiveClickHandler = (event) => {
|
|
66
|
-
const outsideNode = node && !node.contains(event.target);
|
|
67
|
-
const outsideMenu = elemMenu && !elemMenu.contains(event.target);
|
|
68
|
-
if (!outsideNode) {
|
|
69
|
-
toggleMenu();
|
|
70
|
-
}
|
|
71
|
-
else if (outsideNode && outsideMenu) {
|
|
72
|
-
menuClose();
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
// Menu - Set auto origin ---
|
|
76
|
-
const autoUpdateOrigin = () => {
|
|
77
|
-
if (!args.fixed && !elemMenu.classList.contains('hidden')) {
|
|
78
|
-
// Get the Menu's bounds
|
|
79
|
-
const elemTriggerBounds = node.getBoundingClientRect();
|
|
80
|
-
// Determine vertical and horizontal values
|
|
81
|
-
const vert = elemTriggerBounds.y < window.innerHeight / 2 ? 't' : 'b'; // top/bottom
|
|
82
|
-
const horz = elemTriggerBounds.x < window.innerWidth / 2 ? 'l' : 'r'; // left/right
|
|
83
|
-
// Strip and apply only the relevant class
|
|
84
|
-
elemMenu.classList.remove('menu-tl', 'menu-tr', 'menu-bl', 'menu-br');
|
|
85
|
-
elemMenu.classList.add(`menu-${vert}${horz}`);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
// A11y Input Handlers ---
|
|
89
|
-
const onTriggerKeyDown = (event) => {
|
|
90
|
-
const key = event.key;
|
|
91
|
-
if (key === 'Enter' || key === 'Space') {
|
|
92
|
-
event.preventDefault();
|
|
93
|
-
// Toggle menu
|
|
94
|
-
toggleMenu();
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const onWindowKeyDown = (event) => {
|
|
98
|
-
const key = event.key;
|
|
99
|
-
if (elemMenu.style.display === 'none')
|
|
100
|
-
return;
|
|
101
|
-
if (key === 'Escape' || key === 'Tab') {
|
|
102
|
-
// Close the menu
|
|
103
|
-
event.preventDefault();
|
|
104
|
-
menuClose();
|
|
105
|
-
node.focus();
|
|
106
|
-
}
|
|
107
|
-
else if (key === 'ArrowDown') {
|
|
108
|
-
event.preventDefault();
|
|
109
|
-
if (activeFocusIdx < focusableElems.length - 1) {
|
|
110
|
-
// Move down the menu
|
|
111
|
-
activeFocusIdx += 1;
|
|
112
|
-
focusableElems[activeFocusIdx]?.focus();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else if (key === 'ArrowUp') {
|
|
116
|
-
event.preventDefault();
|
|
117
|
-
if (activeFocusIdx > 0) {
|
|
118
|
-
// Move up the menu
|
|
119
|
-
activeFocusIdx -= 1;
|
|
120
|
-
focusableElems[activeFocusIdx]?.focus();
|
|
121
|
-
}
|
|
122
|
-
else if (focusableElems.length && activeFocusIdx === -1) {
|
|
123
|
-
// Start at the bottom of the menu if first key is arrow up key
|
|
124
|
-
event.preventDefault();
|
|
125
|
-
activeFocusIdx = focusableElems.length - 1;
|
|
126
|
-
focusableElems[activeFocusIdx]?.focus();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
// On Action Init
|
|
131
|
-
onInit();
|
|
132
|
-
// Window Events
|
|
133
|
-
window.addEventListener('resize', autoUpdateOrigin, true);
|
|
134
|
-
window.addEventListener('click', onWindowClick, true);
|
|
135
|
-
window.addEventListener('keydown', onWindowKeyDown, true);
|
|
136
|
-
// Trigger Node Events
|
|
137
|
-
node.addEventListener('keydown', onTriggerKeyDown);
|
|
138
|
-
node.addEventListener('change', (e) => {
|
|
139
|
-
console.log(e);
|
|
140
|
-
});
|
|
141
|
-
// Lifecycle
|
|
142
|
-
return {
|
|
143
|
-
update: (newArgs) => { args = newArgs; },
|
|
144
|
-
destroy: () => {
|
|
145
|
-
window.removeEventListener('resize', onWindowClick, true);
|
|
146
|
-
window.removeEventListener('click', onWindowClick, true);
|
|
147
|
-
window.removeEventListener('keydown', onWindowKeyDown, true);
|
|
148
|
-
node.removeEventListener('keydown', onTriggerKeyDown);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script>export let parent;
|
|
2
|
-
const cBase = "relative";
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<!-- @component This example creates an embedded video modal. -->
|
|
6
|
-
|
|
7
|
-
<div class="modal-example-form {cBase}">
|
|
8
|
-
<button class="absolute -top-4 -right-4 z-1 btn-icon variant-filled" on:click={parent.onClose}>✕</button>
|
|
9
|
-
<iframe
|
|
10
|
-
class="w-full aspect-video rounded-container-token overflow-hidden"
|
|
11
|
-
src="https://www.youtube.com/embed/vOGhAV-84iI"
|
|
12
|
-
title="YouTube video player"
|
|
13
|
-
frameborder="0"
|
|
14
|
-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
15
|
-
allowfullscreen
|
|
16
|
-
/>
|
|
17
|
-
</div>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
/** Exposes parent props to this component. */ parent: any;
|
|
5
|
-
};
|
|
6
|
-
events: {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {};
|
|
10
|
-
};
|
|
11
|
-
export type ModalExampleEmbedProps = typeof __propDef.props;
|
|
12
|
-
export type ModalExampleEmbedEvents = typeof __propDef.events;
|
|
13
|
-
export type ModalExampleEmbedSlots = typeof __propDef.slots;
|
|
14
|
-
/** This example creates an embedded video modal. */
|
|
15
|
-
export default class ModalExampleEmbed extends SvelteComponentTyped<ModalExampleEmbedProps, ModalExampleEmbedEvents, ModalExampleEmbedSlots> {
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<script>export let parent;
|
|
2
|
-
import { modalStore } from "../../../index.ts";
|
|
3
|
-
const formData = {
|
|
4
|
-
name: "Jane Doe",
|
|
5
|
-
tel: "214-555-1234",
|
|
6
|
-
email: "jdoe@email.com"
|
|
7
|
-
};
|
|
8
|
-
function onFormSubmit() {
|
|
9
|
-
if ($modalStore[0].response)
|
|
10
|
-
$modalStore[0].response(formData);
|
|
11
|
-
modalStore.close();
|
|
12
|
-
}
|
|
13
|
-
const cBase = "space-y-4";
|
|
14
|
-
const cForm = "border border-surface-500 p-4 space-y-4 rounded-container-token";
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<!-- @component This example creates a simple form modal. -->
|
|
18
|
-
|
|
19
|
-
<div class="modal-example-form {cBase}">
|
|
20
|
-
<!-- Enable for debugging: -->
|
|
21
|
-
<!-- <pre>{JSON.stringify(formData, null, 2)}</pre> -->
|
|
22
|
-
<form class="modal-form {cForm}">
|
|
23
|
-
<label class="input-label">
|
|
24
|
-
<span>Name</span>
|
|
25
|
-
<input type="text" bind:value={formData.name} placeholder="Enter name..." />
|
|
26
|
-
</label>
|
|
27
|
-
<label class="input-label">
|
|
28
|
-
<span>Phone Number</span>
|
|
29
|
-
<input type="tel" bind:value={formData.tel} placeholder="Enter phone..." />
|
|
30
|
-
</label>
|
|
31
|
-
<label class="input-label">
|
|
32
|
-
<span>Email</span>
|
|
33
|
-
<input type="email" bind:value={formData.email} placeholder="Enter email address..." />
|
|
34
|
-
</label>
|
|
35
|
-
</form>
|
|
36
|
-
<!-- prettier-ignore -->
|
|
37
|
-
<footer class="modal-footer {parent.regionFooter}">
|
|
38
|
-
<button class="btn {parent.buttonNeutral}" on:click={parent.onClose}>{parent.buttonTextCancel}</button>
|
|
39
|
-
<button class="btn {parent.buttonPositive}" on:click={onFormSubmit}>Submit Form</button>
|
|
40
|
-
</footer>
|
|
41
|
-
</div>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
/** Exposes parent props to this component. */ parent: any;
|
|
5
|
-
};
|
|
6
|
-
events: {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {};
|
|
10
|
-
};
|
|
11
|
-
export type ModalExampleFormProps = typeof __propDef.props;
|
|
12
|
-
export type ModalExampleFormEvents = typeof __propDef.events;
|
|
13
|
-
export type ModalExampleFormSlots = typeof __propDef.slots;
|
|
14
|
-
/** This example creates a simple form modal. */
|
|
15
|
-
export default class ModalExampleForm extends SvelteComponentTyped<ModalExampleFormProps, ModalExampleFormEvents, ModalExampleFormSlots> {
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script>import { fade } from "svelte/transition";
|
|
2
|
-
import { modalStore } from "../../../index.ts";
|
|
3
|
-
export let parent;
|
|
4
|
-
const cButton = "fixed top-4 right-4 z-50 font-bold";
|
|
5
|
-
const cImage = "";
|
|
6
|
-
let showButton = false;
|
|
7
|
-
setTimeout(() => {
|
|
8
|
-
showButton = true;
|
|
9
|
-
}, 500);
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<div>
|
|
13
|
-
<!-- Button -->
|
|
14
|
-
{#if showButton}
|
|
15
|
-
<button class="btn-icon btn-icon-lg variant-filled {cButton}" on:click={parent.onClose} transition:fade|local>×</button>
|
|
16
|
-
{/if}
|
|
17
|
-
<!-- Image -->
|
|
18
|
-
<img src={$modalStore[0]?.meta.src} class={cImage} alt="Example" />
|
|
19
|
-
</div>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
parent: any;
|
|
5
|
-
};
|
|
6
|
-
events: {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {};
|
|
10
|
-
};
|
|
11
|
-
export type ModalExampleImageProps = typeof __propDef.props;
|
|
12
|
-
export type ModalExampleImageEvents = typeof __propDef.events;
|
|
13
|
-
export type ModalExampleImageSlots = typeof __propDef.slots;
|
|
14
|
-
export default class ModalExampleImage extends SvelteComponentTyped<ModalExampleImageProps, ModalExampleImageEvents, ModalExampleImageSlots> {
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script>import { writable } from "svelte/store";
|
|
2
|
-
import { ListBox, ListBoxItem, modalStore } from "../../../index.ts";
|
|
3
|
-
export let parent;
|
|
4
|
-
const storeFlavor = writable("chocolate");
|
|
5
|
-
function onFormSubmit() {
|
|
6
|
-
if ($modalStore[0].response)
|
|
7
|
-
$modalStore[0].response($storeFlavor);
|
|
8
|
-
modalStore.close();
|
|
9
|
-
}
|
|
10
|
-
const cBase = "space-y-4";
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<!-- @component This example creates a simple form modal. -->
|
|
14
|
-
|
|
15
|
-
<div class="modal-example-form {cBase}">
|
|
16
|
-
<ListBox selected={storeFlavor} regionList="border border-surface-500 p-4 rounded-container-token">
|
|
17
|
-
<ListBoxItem value="chocolate">Chocolate</ListBoxItem>
|
|
18
|
-
<ListBoxItem value="vanilla">Vanilla</ListBoxItem>
|
|
19
|
-
<ListBoxItem value="strawberry">Strawberry</ListBoxItem>
|
|
20
|
-
<ListBoxItem value="peach">Peach</ListBoxItem>
|
|
21
|
-
</ListBox>
|
|
22
|
-
<!-- prettier-ignore -->
|
|
23
|
-
<footer class="modal-footer {parent.regionFooter}">
|
|
24
|
-
<button class="btn {parent.buttonNeutral}" on:click={parent.onClose}>{parent.buttonTextCancel}</button>
|
|
25
|
-
<button class="btn {parent.buttonPositive}" on:click={onFormSubmit}>Select Flavors</button>
|
|
26
|
-
</footer>
|
|
27
|
-
</div>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
/** Exposes parent props to this component. */ parent: any;
|
|
5
|
-
};
|
|
6
|
-
events: {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {};
|
|
10
|
-
};
|
|
11
|
-
export type ModalExampleListProps = typeof __propDef.props;
|
|
12
|
-
export type ModalExampleListEvents = typeof __propDef.events;
|
|
13
|
-
export type ModalExampleListSlots = typeof __propDef.slots;
|
|
14
|
-
/** This example creates a simple form modal. */
|
|
15
|
-
export default class ModalExampleList extends SvelteComponentTyped<ModalExampleListProps, ModalExampleListEvents, ModalExampleListSlots> {
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export interface ArgsTooltip {
|
|
2
|
-
/** The HTML content of the tooltip. */
|
|
3
|
-
content: string;
|
|
4
|
-
/** Provide a value of: top | bottom | left | right */
|
|
5
|
-
position?: string;
|
|
6
|
-
/** Sets the wrapping element to be either inline or block */
|
|
7
|
-
inline?: boolean;
|
|
8
|
-
/** Provide an optional callback function to handle open/close state changes. */
|
|
9
|
-
state?: (e: {
|
|
10
|
-
trigger: HTMLElement;
|
|
11
|
-
state: boolean;
|
|
12
|
-
}) => void;
|
|
13
|
-
/** Provide a class to set the background color. */
|
|
14
|
-
background?: string;
|
|
15
|
-
/** Provide a class to set the text color. */
|
|
16
|
-
color?: string;
|
|
17
|
-
/** Provide a class to set the width. */
|
|
18
|
-
width?: string;
|
|
19
|
-
/** Provide a class to set the padding. */
|
|
20
|
-
padding?: string;
|
|
21
|
-
/** Provide a class to set the box shadow. */
|
|
22
|
-
shadow?: string;
|
|
23
|
-
/** Provide a class to set the border radius. */
|
|
24
|
-
rounded?: string;
|
|
25
|
-
/** Provide arbitrary classes to the container element. */
|
|
26
|
-
regionContainer?: string;
|
|
27
|
-
/** Provide arbitrary classes to the tooltip element. */
|
|
28
|
-
regionTooltip?: string;
|
|
29
|
-
/** Provide arbitrary classes to the tooltip arrow element. */
|
|
30
|
-
regionArrow?: string;
|
|
31
|
-
}
|
|
32
|
-
export declare function tooltip(node: HTMLElement, args: ArgsTooltip): {
|
|
33
|
-
update(newArgs: ArgsTooltip): void;
|
|
34
|
-
destroy(): void;
|
|
35
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
// Action: Tooltip
|
|
2
|
-
export function tooltip(node, args) {
|
|
3
|
-
const animDuration = 150;
|
|
4
|
-
let elemTooltip;
|
|
5
|
-
// Map the Args and provide default values
|
|
6
|
-
// prettier-ignore
|
|
7
|
-
const { content = '(tooltip)', position = 'top', inline = true,
|
|
8
|
-
// Regions
|
|
9
|
-
regionContainer = 'regionContainer', regionTooltip = 'regionTooltip', regionArrow = 'regionArrow' } = args;
|
|
10
|
-
// Create a wrapping element, set relative positioning
|
|
11
|
-
const createElemContainer = () => {
|
|
12
|
-
const elemContainer = document.createElement(inline ? 'span' : 'div');
|
|
13
|
-
elemContainer.classList.add('tooltip-container', 'relative', regionContainer);
|
|
14
|
-
node.parentNode?.insertBefore(elemContainer, node);
|
|
15
|
-
elemContainer.appendChild(node);
|
|
16
|
-
};
|
|
17
|
-
createElemContainer();
|
|
18
|
-
// Create the tooltip element
|
|
19
|
-
// prettier-ignore
|
|
20
|
-
const createElemTooltip = () => {
|
|
21
|
-
elemTooltip = document.createElement('div');
|
|
22
|
-
elemTooltip.classList.add('tooltip', `tooltip-${position}`, 'hidden', regionTooltip);
|
|
23
|
-
if (args.background) {
|
|
24
|
-
elemTooltip.classList.add(args.background);
|
|
25
|
-
}
|
|
26
|
-
if (args.color)
|
|
27
|
-
elemTooltip.classList.add(args.color);
|
|
28
|
-
if (args.width)
|
|
29
|
-
elemTooltip.classList.add(args.width);
|
|
30
|
-
if (args.padding)
|
|
31
|
-
elemTooltip.classList.add(args.padding);
|
|
32
|
-
if (args.shadow)
|
|
33
|
-
elemTooltip.classList.add(args.shadow);
|
|
34
|
-
if (args.rounded)
|
|
35
|
-
elemTooltip.classList.add(args.rounded);
|
|
36
|
-
elemTooltip.setAttribute('role', 'tooltip');
|
|
37
|
-
elemTooltip.setAttribute('data-testid', 'tooltip');
|
|
38
|
-
elemTooltip.innerHTML = content;
|
|
39
|
-
node.parentNode?.insertBefore(elemTooltip, node);
|
|
40
|
-
};
|
|
41
|
-
createElemTooltip();
|
|
42
|
-
// Create the tooltip arrow
|
|
43
|
-
// prettier-ignore
|
|
44
|
-
const createElemArrow = () => {
|
|
45
|
-
const elemArrow = document.createElement('div');
|
|
46
|
-
elemArrow.classList.add(`tooltip-arrow-${position}`, regionArrow);
|
|
47
|
-
if (args.background)
|
|
48
|
-
elemArrow.classList.add(args.background);
|
|
49
|
-
elemTooltip.append(elemArrow);
|
|
50
|
-
};
|
|
51
|
-
createElemArrow();
|
|
52
|
-
// -- State
|
|
53
|
-
// On mouse over - show the tooltip
|
|
54
|
-
const onMouseEnter = () => {
|
|
55
|
-
elemTooltip.classList.remove('hidden');
|
|
56
|
-
setTimeout(() => {
|
|
57
|
-
elemTooltip.classList.add('!opacity-100');
|
|
58
|
-
}, animDuration);
|
|
59
|
-
stateEventHandler(true);
|
|
60
|
-
};
|
|
61
|
-
// On mouse out - hide the tooltip
|
|
62
|
-
const onMouseLeave = () => {
|
|
63
|
-
elemTooltip.classList.remove('!opacity-100');
|
|
64
|
-
setTimeout(() => {
|
|
65
|
-
elemTooltip.classList.add('hidden');
|
|
66
|
-
}, animDuration);
|
|
67
|
-
stateEventHandler(false);
|
|
68
|
-
};
|
|
69
|
-
const stateEventHandler = (state) => {
|
|
70
|
-
if (args.state)
|
|
71
|
-
args.state({ trigger: node, state });
|
|
72
|
-
};
|
|
73
|
-
// Ally ---
|
|
74
|
-
// A11y Input Handler
|
|
75
|
-
const onWindowKeyDown = (event) => {
|
|
76
|
-
if (event.code === 'Escape')
|
|
77
|
-
onMouseLeave();
|
|
78
|
-
};
|
|
79
|
-
// Event Listners ---
|
|
80
|
-
node.addEventListener('mouseenter', onMouseEnter);
|
|
81
|
-
node.addEventListener('mouseleave', onMouseLeave);
|
|
82
|
-
window.addEventListener('keydown', onWindowKeyDown);
|
|
83
|
-
// Lifecycle
|
|
84
|
-
return {
|
|
85
|
-
update(newArgs) {
|
|
86
|
-
args = newArgs;
|
|
87
|
-
},
|
|
88
|
-
destroy() {
|
|
89
|
-
node.removeEventListener('mouseenter', onMouseEnter);
|
|
90
|
-
node.removeEventListener('mouseleave', onMouseLeave);
|
|
91
|
-
window.removeEventListener('keydown', onWindowKeyDown);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|