@skeletonlabs/skeleton 0.76.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/LICENSE +21 -0
- package/README.md +33 -0
- package/actions/Clipboard/clipboard.d.ts +4 -0
- package/actions/Clipboard/clipboard.js +37 -0
- package/actions/Filters/filter.d.ts +3 -0
- package/actions/Filters/filter.js +23 -0
- package/actions/Filters/svg-filters/Apollo.svelte +13 -0
- package/actions/Filters/svg-filters/Apollo.svelte.d.ts +19 -0
- package/actions/Filters/svg-filters/BlueNight.svelte +12 -0
- package/actions/Filters/svg-filters/BlueNight.svelte.d.ts +19 -0
- package/actions/Filters/svg-filters/Emerald.svelte +23 -0
- package/actions/Filters/svg-filters/Emerald.svelte.d.ts +19 -0
- package/actions/Filters/svg-filters/GreenFall.svelte +18 -0
- package/actions/Filters/svg-filters/GreenFall.svelte.d.ts +19 -0
- package/actions/Filters/svg-filters/Noir.svelte +11 -0
- package/actions/Filters/svg-filters/Noir.svelte.d.ts +19 -0
- package/actions/Filters/svg-filters/NoirLight.svelte +10 -0
- package/actions/Filters/svg-filters/NoirLight.svelte.d.ts +19 -0
- package/actions/Filters/svg-filters/Rustic.svelte +14 -0
- package/actions/Filters/svg-filters/Rustic.svelte.d.ts +19 -0
- package/actions/Filters/svg-filters/Summer84.svelte +12 -0
- package/actions/Filters/svg-filters/Summer84.svelte.d.ts +19 -0
- package/actions/Filters/svg-filters/XPro.svelte +12 -0
- package/actions/Filters/svg-filters/XPro.svelte.d.ts +19 -0
- package/actions/FocusTrap/focusTrap.d.ts +4 -0
- package/actions/FocusTrap/focusTrap.js +42 -0
- package/components/Accordion/AccordionGroup.svelte +47 -0
- package/components/Accordion/AccordionGroup.svelte.d.ts +24 -0
- package/components/Accordion/AccordionItem.svelte +70 -0
- package/components/Accordion/AccordionItem.svelte.d.ts +35 -0
- package/components/Alert/Alert.svelte +65 -0
- package/components/Alert/Alert.svelte.d.ts +30 -0
- package/components/AppBar/AppBar.svelte +54 -0
- package/components/AppBar/AppBar.svelte.d.ts +30 -0
- package/components/AppRail/AppRail.svelte +48 -0
- package/components/AppRail/AppRail.svelte.d.ts +31 -0
- package/components/AppRail/AppRailTile.svelte +51 -0
- package/components/AppRail/AppRailTile.svelte.d.ts +33 -0
- package/components/AppShell/AppShell.svelte +80 -0
- package/components/AppShell/AppShell.svelte.d.ts +31 -0
- package/components/Avatar/Avatar.svelte +46 -0
- package/components/Avatar/Avatar.svelte.d.ts +32 -0
- package/components/Breadcrumb/Breadcrumb.svelte +24 -0
- package/components/Breadcrumb/Breadcrumb.svelte.d.ts +21 -0
- package/components/Breadcrumb/Crumb.svelte +29 -0
- package/components/Breadcrumb/Crumb.svelte.d.ts +21 -0
- package/components/ConicGradient/ConicGradient.svelte +80 -0
- package/components/ConicGradient/ConicGradient.svelte.d.ts +24 -0
- package/components/ConicGradient/types.d.ts +10 -0
- package/components/ConicGradient/types.js +2 -0
- package/components/Divider/Divider.svelte +21 -0
- package/components/Divider/Divider.svelte.d.ts +22 -0
- package/components/FileButton/FileButton.svelte +25 -0
- package/components/FileButton/FileButton.svelte.d.ts +22 -0
- package/components/FileDropzone/FileDropzone.svelte +83 -0
- package/components/FileDropzone/FileDropzone.svelte.d.ts +27 -0
- package/components/GradientHeading/GradientHeading.svelte +21 -0
- package/components/GradientHeading/GradientHeading.svelte.d.ts +22 -0
- package/components/ListBox/ListBox.svelte +54 -0
- package/components/ListBox/ListBox.svelte.d.ts +30 -0
- package/components/ListBox/ListBoxItem.svelte +87 -0
- package/components/ListBox/ListBoxItem.svelte.d.ts +30 -0
- package/components/Paginator/Paginator.svelte +62 -0
- package/components/Paginator/Paginator.svelte.d.ts +25 -0
- package/components/Paginator/types.d.ts +10 -0
- package/components/Paginator/types.js +2 -0
- package/components/ProgressBar/ProgressBar.svelte +57 -0
- package/components/ProgressBar/ProgressBar.svelte.d.ts +23 -0
- package/components/ProgressRadial/ProgressRadial.svelte +81 -0
- package/components/ProgressRadial/ProgressRadial.svelte.d.ts +25 -0
- package/components/Radio/RadioGroup.svelte +45 -0
- package/components/Radio/RadioGroup.svelte.d.ts +30 -0
- package/components/Radio/RadioItem.svelte +40 -0
- package/components/Radio/RadioItem.svelte.d.ts +29 -0
- package/components/RangeSlider/RangeSlider.svelte +95 -0
- package/components/RangeSlider/RangeSlider.svelte.d.ts +32 -0
- package/components/SlideToggle/SlideToggle.svelte +77 -0
- package/components/SlideToggle/SlideToggle.svelte.d.ts +31 -0
- package/components/Stepper/Step.svelte +94 -0
- package/components/Stepper/Step.svelte.d.ts +31 -0
- package/components/Stepper/Stepper.svelte +42 -0
- package/components/Stepper/Stepper.svelte.d.ts +27 -0
- package/components/SvgIcon/SvgIcon.svelte +45 -0
- package/components/SvgIcon/SvgIcon.svelte.d.ts +26 -0
- package/components/SvgIcon/icons.d.ts +1 -0
- package/components/SvgIcon/icons.js +171 -0
- package/components/Tab/Tab.svelte +54 -0
- package/components/Tab/Tab.svelte.d.ts +32 -0
- package/components/Tab/TabGroup.svelte +69 -0
- package/components/Tab/TabGroup.svelte.d.ts +30 -0
- package/components/Table/Table.svelte +102 -0
- package/components/Table/Table.svelte.d.ts +27 -0
- package/components/Table/types.d.ts +10 -0
- package/components/Table/types.js +1 -0
- package/components/Table/utils.d.ts +7 -0
- package/components/Table/utils.js +33 -0
- package/index.d.ts +59 -0
- package/index.js +68 -0
- package/package.json +147 -0
- package/styles/all.css +20 -0
- package/styles/core.css +53 -0
- package/styles/elements/badges.css +29 -0
- package/styles/elements/buttons.css +162 -0
- package/styles/elements/cards.css +34 -0
- package/styles/elements/lists.css +47 -0
- package/styles/elements/logo-clouds.css +31 -0
- package/styles/elements/menus.css +26 -0
- package/styles/elements/placeholders.css +17 -0
- package/styles/elements/tables.css +97 -0
- package/styles/elements/tooltips.css +83 -0
- package/styles/elements.css +15 -0
- package/styles/forms.css +154 -0
- package/styles/highlight-js.css +116 -0
- package/styles/tailwind.css +12 -0
- package/styles/tokens.css +171 -0
- package/styles/typography.css +115 -0
- package/tailwind/colors.d.ts +13 -0
- package/tailwind/colors.js +335 -0
- package/tailwind/theme.cjs +45 -0
- package/tailwind/theme.d.cts +5 -0
- package/themes/legacy/theme-skeleton.css +93 -0
- package/themes/theme-crimson.css +70 -0
- package/themes/theme-gold-nouveau.css +142 -0
- package/themes/theme-hamlindigo.css +82 -0
- package/themes/theme-modern.css +78 -0
- package/themes/theme-rocket.css +80 -0
- package/themes/theme-sahara.css +83 -0
- package/themes/theme-seafoam.css +81 -0
- package/themes/theme-seasonal.css +69 -0
- package/themes/theme-skeleton.css +99 -0
- package/themes/theme-vintage.css +80 -0
- package/utilities/CodeBlock/CodeBlock.svelte +63 -0
- package/utilities/CodeBlock/CodeBlock.svelte.d.ts +23 -0
- package/utilities/CodeBlock/stores.d.ts +2 -0
- package/utilities/CodeBlock/stores.js +3 -0
- package/utilities/DataTable/DataTable.d.ts +14 -0
- package/utilities/DataTable/DataTable.js +98 -0
- package/utilities/DataTable/actions.d.ts +8 -0
- package/utilities/DataTable/actions.js +114 -0
- package/utilities/DataTable/types.d.ts +15 -0
- package/utilities/DataTable/types.js +2 -0
- package/utilities/Drawer/Drawer.svelte +135 -0
- package/utilities/Drawer/Drawer.svelte.d.ts +36 -0
- package/utilities/LightSwitch/LightSwitch.svelte +70 -0
- package/utilities/LightSwitch/LightSwitch.svelte.d.ts +16 -0
- package/utilities/LightSwitch/stores.d.ts +3 -0
- package/utilities/LightSwitch/stores.js +5 -0
- package/utilities/LocalStorageStore/LocalStorageStore.d.ts +10 -0
- package/utilities/LocalStorageStore/LocalStorageStore.js +44 -0
- package/utilities/Menu/menu.d.ts +18 -0
- package/utilities/Menu/menu.js +100 -0
- package/utilities/Modal/Modal.d.ts +1 -0
- package/utilities/Modal/Modal.js +44 -0
- package/utilities/Modal/Modal.svelte +182 -0
- package/utilities/Modal/Modal.svelte.d.ts +33 -0
- package/utilities/Modal/examples/ModalExampleEmbed.svelte +20 -0
- package/utilities/Modal/examples/ModalExampleEmbed.svelte.d.ts +17 -0
- package/utilities/Modal/examples/ModalExampleForm.svelte +46 -0
- package/utilities/Modal/examples/ModalExampleForm.svelte.d.ts +17 -0
- package/utilities/Modal/examples/ModalExampleList.svelte +32 -0
- package/utilities/Modal/examples/ModalExampleList.svelte.d.ts +17 -0
- package/utilities/Modal/stores.d.ts +1 -0
- package/utilities/Modal/stores.js +22 -0
- package/utilities/Modal/types.d.ts +26 -0
- package/utilities/Modal/types.js +2 -0
- package/utilities/Toast/Toast.svelte +117 -0
- package/utilities/Toast/Toast.svelte.d.ts +28 -0
- package/utilities/Toast/stores.d.ts +10 -0
- package/utilities/Toast/stores.js +44 -0
- package/utilities/Toast/types.d.ts +21 -0
- package/utilities/Toast/types.js +2 -0
- package/utilities/Tooltip/tooltip.d.ts +35 -0
- package/utilities/Tooltip/tooltip.js +94 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
color?: string | undefined;
|
|
6
|
+
separator?: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
lead: {};
|
|
13
|
+
default: {};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type CrumbProps = typeof __propDef.props;
|
|
17
|
+
export type CrumbEvents = typeof __propDef.events;
|
|
18
|
+
export type CrumbSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Crumb extends SvelteComponentTyped<CrumbProps, CrumbEvents, CrumbSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script>import { tailwindDefaultColors } from '../../tailwind/colors';
|
|
2
|
+
// Props
|
|
3
|
+
/**
|
|
4
|
+
* Provide a data set of color stops and labels.
|
|
5
|
+
* @type {ConicStop[]}
|
|
6
|
+
*/
|
|
7
|
+
export let stops = [{ color: ['neutral', 500], start: 0, end: 100 }];
|
|
8
|
+
/** Allows for automatic generation of a legend below the conic gradient. */
|
|
9
|
+
export let legend = false;
|
|
10
|
+
/** When enabled, the conic gradient will spin. */
|
|
11
|
+
export let spin = false;
|
|
12
|
+
/** Provided classes to style the conic gradient width. */
|
|
13
|
+
export let width = 'w-full';
|
|
14
|
+
/** Provided classes to style the legend hover effect. */
|
|
15
|
+
export let hover = 'bg-hover-token';
|
|
16
|
+
// Local
|
|
17
|
+
let cone;
|
|
18
|
+
let generatedLegendList;
|
|
19
|
+
// Styles
|
|
20
|
+
const cBase = 'flex flex-col items-center space-y-4';
|
|
21
|
+
const cCaption = 'text-center';
|
|
22
|
+
const cCone = 'block aspect-square rounded-full';
|
|
23
|
+
const cLabel = 'text-sm w-full';
|
|
24
|
+
const cSwatch = 'block aspect-square bg-black w-5 rounded-full mr-2';
|
|
25
|
+
// Set Color
|
|
26
|
+
function setColorValue(color) {
|
|
27
|
+
// If string, keep as is
|
|
28
|
+
if (typeof color === 'string')
|
|
29
|
+
return color;
|
|
30
|
+
// If object, provide default Tailwind color
|
|
31
|
+
const colorSet = tailwindDefaultColors.find((c) => c.label === color[0]);
|
|
32
|
+
return colorSet?.shades[color[1]].hex;
|
|
33
|
+
}
|
|
34
|
+
// Generate Conic Gradient style
|
|
35
|
+
function genConicGradient() {
|
|
36
|
+
let d = stops.map((v) => `${setColorValue(v.color)} ${v.start}% ${v.end}%`);
|
|
37
|
+
cone = `conic-gradient(${d.join(', ')})`;
|
|
38
|
+
}
|
|
39
|
+
// Generate Legend
|
|
40
|
+
function genLegend() {
|
|
41
|
+
if (!legend)
|
|
42
|
+
return;
|
|
43
|
+
generatedLegendList = stops.map((v) => {
|
|
44
|
+
return {
|
|
45
|
+
label: v.label,
|
|
46
|
+
color: setColorValue(v.color),
|
|
47
|
+
value: v.end - v.start
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Lifecycle (on init)
|
|
52
|
+
genConicGradient();
|
|
53
|
+
genLegend();
|
|
54
|
+
// Reactive
|
|
55
|
+
$: classesBase = `${cBase} ${$$props.class ?? ''}`;
|
|
56
|
+
$: classesCone = `${cCone} ${width}`;
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<figure class="conic-gradient {classesBase}" data-testid="conic-gradient">
|
|
60
|
+
<!-- Label -->
|
|
61
|
+
{#if $$slots.default}
|
|
62
|
+
<figcaption class="conic-caption {cCaption}"><slot /></figcaption>
|
|
63
|
+
{/if}
|
|
64
|
+
<!-- Conic Gradient -->
|
|
65
|
+
{#if cone}
|
|
66
|
+
<div class="concic-cone {classesCone}" class:animate-spin={spin} style:background={cone} />
|
|
67
|
+
{/if}
|
|
68
|
+
<!-- Legend -->
|
|
69
|
+
{#if legend && generatedLegendList}
|
|
70
|
+
<ul class="conic-list list {cLabel}">
|
|
71
|
+
{#each generatedLegendList as { color, label, value }}
|
|
72
|
+
<li class="conic-item {hover}">
|
|
73
|
+
<span class="conic-swatch {cSwatch}" style:background={color} />
|
|
74
|
+
<span class="conic-label flex-auto">{label}</span>
|
|
75
|
+
<strong class="conic-value">{value}%</strong>
|
|
76
|
+
</li>
|
|
77
|
+
{/each}
|
|
78
|
+
</ul>
|
|
79
|
+
{/if}
|
|
80
|
+
</figure>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ConicStop } from './types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
stops?: ConicStop[] | undefined;
|
|
7
|
+
legend?: boolean | undefined;
|
|
8
|
+
spin?: boolean | undefined;
|
|
9
|
+
width?: string | undefined;
|
|
10
|
+
hover?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {
|
|
16
|
+
default: {};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type ConicGradientProps = typeof __propDef.props;
|
|
20
|
+
export type ConicGradientEvents = typeof __propDef.events;
|
|
21
|
+
export type ConicGradientSlots = typeof __propDef.slots;
|
|
22
|
+
export default class ConicGradient extends SvelteComponentTyped<ConicGradientProps, ConicGradientEvents, ConicGradientSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script>// Props
|
|
2
|
+
/** When enabled, sets the width to zero and height to full. */
|
|
3
|
+
export let vertical = false;
|
|
4
|
+
/** Provide classes to set the border width. */
|
|
5
|
+
export let borderWidth = 'border-t';
|
|
6
|
+
/** Provide classes to set the border style. */
|
|
7
|
+
export let borderStyle = 'border-solid';
|
|
8
|
+
/** Provide classes to set the border color. */
|
|
9
|
+
export let borderColor = 'border-surface-300-600-token';
|
|
10
|
+
/** Provide classes to set the margin. */
|
|
11
|
+
export let margin = 'm-0';
|
|
12
|
+
/** Provide classes to set opacity. */
|
|
13
|
+
export let opacity = 'opacity-full';
|
|
14
|
+
// Base Classes
|
|
15
|
+
const cBaseDivider = `block`;
|
|
16
|
+
// Reactive Classes
|
|
17
|
+
$: classesOrientation = vertical === true ? 'w-0 h-full min-h-[24px]' : 'w-full h-0';
|
|
18
|
+
$: classesDivider = `${cBaseDivider} ${classesOrientation} ${borderWidth} ${borderStyle} ${borderColor} ${margin} ${opacity} ${$$props.class ?? ''}`;
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<hr class="divider {classesDivider}" data-testid="divider" />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
vertical?: boolean | undefined;
|
|
6
|
+
borderWidth?: string | undefined;
|
|
7
|
+
borderStyle?: string | undefined;
|
|
8
|
+
borderColor?: string | undefined;
|
|
9
|
+
margin?: string | undefined;
|
|
10
|
+
opacity?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export type DividerProps = typeof __propDef.props;
|
|
18
|
+
export type DividerEvents = typeof __propDef.events;
|
|
19
|
+
export type DividerSlots = typeof __propDef.slots;
|
|
20
|
+
export default class Divider extends SvelteComponentTyped<DividerProps, DividerEvents, DividerSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script>/**
|
|
2
|
+
* Bind your file data for the file input.
|
|
3
|
+
* @type {FileList}
|
|
4
|
+
*/
|
|
5
|
+
export let files;
|
|
6
|
+
/** Provide a button variant or other class styles. */
|
|
7
|
+
export let button = 'btn-filled-accent';
|
|
8
|
+
let elemFileInput;
|
|
9
|
+
function onButtonClick() {
|
|
10
|
+
elemFileInput.click();
|
|
11
|
+
}
|
|
12
|
+
function prunedRestProps() {
|
|
13
|
+
delete $$restProps.class;
|
|
14
|
+
return $$restProps;
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div class="file-button {$$props.class ?? ''}" data-testid="file-button">
|
|
19
|
+
<!-- Input: File -->
|
|
20
|
+
<input bind:this={elemFileInput} bind:files type="file" {...prunedRestProps()} class="file-button-input hidden" on:change />
|
|
21
|
+
<!-- Button -->
|
|
22
|
+
<button class="file-button-btn btn {button}" on:click={onButtonClick}>
|
|
23
|
+
<slot />
|
|
24
|
+
</button>
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
files: FileList;
|
|
6
|
+
button?: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
change: Event;
|
|
10
|
+
} & {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {
|
|
14
|
+
default: {};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type FileButtonProps = typeof __propDef.props;
|
|
18
|
+
export type FileButtonEvents = typeof __propDef.events;
|
|
19
|
+
export type FileButtonSlots = typeof __propDef.slots;
|
|
20
|
+
export default class FileButton extends SvelteComponentTyped<FileButtonProps, FileButtonEvents, FileButtonSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from 'svelte/internal';
|
|
2
|
+
// Event Dispatcher
|
|
3
|
+
const dispatch = createEventDispatcher();
|
|
4
|
+
// Props
|
|
5
|
+
/**
|
|
6
|
+
* Bind this to your form data, represents the "files" data from the input.
|
|
7
|
+
* @type {FileList}
|
|
8
|
+
*/
|
|
9
|
+
export let files;
|
|
10
|
+
/** Provided additional notes or information. */
|
|
11
|
+
export let notes = '';
|
|
12
|
+
// Props (Styles)
|
|
13
|
+
/** Provide styles to set the dropzone width. */
|
|
14
|
+
export let width = 'w-full';
|
|
15
|
+
/** Provide styles to set the dropzone height. */
|
|
16
|
+
export let height = 'h-24';
|
|
17
|
+
/** Provide styles to set the dropzone padding. */
|
|
18
|
+
export let padding = 'p-4';
|
|
19
|
+
/** Provide styles to set the dropzone text color. */
|
|
20
|
+
export let color = '';
|
|
21
|
+
// Classes
|
|
22
|
+
const cBase = 'relative';
|
|
23
|
+
const cMessage = 'absolute top-0 left-0 right-0 bottom-0 z-[1] max-w-[480px] mx-auto flex justify-center items-center !pointer-events-none';
|
|
24
|
+
const cInput = '!border-2 border-dashed cursor-pointer';
|
|
25
|
+
// Local
|
|
26
|
+
let elemIcon;
|
|
27
|
+
// Drag and Drop Event Handlers
|
|
28
|
+
// Handles icon animation and passes events up
|
|
29
|
+
function onDragOver(event) {
|
|
30
|
+
/** @event {{ event: DragEvent }} dragover - When a file is dragged over the component. */
|
|
31
|
+
dispatch('dragover', event);
|
|
32
|
+
elemIcon?.classList.add('animate-bounce');
|
|
33
|
+
}
|
|
34
|
+
function onDragLeave(event) {
|
|
35
|
+
/** @event {{ event: DragEvent }} dragleave - When a file is dragged out off the component. */
|
|
36
|
+
dispatch('dragleave', event);
|
|
37
|
+
elemIcon?.classList.remove('animate-bounce');
|
|
38
|
+
}
|
|
39
|
+
function onDrop(event) {
|
|
40
|
+
/** @event {{ event: DragEvent }} drop - When a file is dropped on the component. */
|
|
41
|
+
dispatch('drop', event);
|
|
42
|
+
elemIcon?.classList.remove('animate-bounce');
|
|
43
|
+
}
|
|
44
|
+
// Reactive
|
|
45
|
+
$: classesBase = `${cBase} ${width} ${$$props.class ?? ''}`;
|
|
46
|
+
$: classesMessage = `${cMessage} ${color} ${height} ${padding}`;
|
|
47
|
+
$: classesInput = `${cInput} ${height} ${padding}`;
|
|
48
|
+
// Prune $$restProps to avoid overwriting $$props.class
|
|
49
|
+
function prunedRestProps() {
|
|
50
|
+
delete $$restProps.class;
|
|
51
|
+
return $$restProps;
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<div class="file-dropzone {classesBase}" data-testid="file-dropzone" on:dragenter on:dragover={onDragOver} on:dragleave={onDragLeave} on:drop={onDrop}>
|
|
56
|
+
<!-- Message -->
|
|
57
|
+
<div class="file-dropzone-message {classesMessage}">
|
|
58
|
+
<!-- Slot: Default -->
|
|
59
|
+
<slot>
|
|
60
|
+
<!-- Default Message -->
|
|
61
|
+
<div class="grid grid-cols-[auto_1fr] gap-4">
|
|
62
|
+
<!-- Icon -->
|
|
63
|
+
<div class="text-4xl flex justify-center items-center" bind:this={elemIcon}>↓</div>
|
|
64
|
+
<!-- Text -->
|
|
65
|
+
<div class="flex flex-col justify-center items-start space-y-0">
|
|
66
|
+
<div class="text-base font-bold">Drop {$$restProps.multiple ? 'files' : 'a file'} or click to select.</div>
|
|
67
|
+
{#if notes}<div class="text-sm opacity-70">{@html notes}</div>{/if}
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</slot>
|
|
71
|
+
</div>
|
|
72
|
+
<!-- Input: File -->
|
|
73
|
+
<input bind:files type="file" {...prunedRestProps()} class="file-dropzone-input {classesInput}" on:change />
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<style>
|
|
77
|
+
/* Hide Input:File Content */
|
|
78
|
+
input[type='file'] {
|
|
79
|
+
color: transparent
|
|
80
|
+
}
|
|
81
|
+
::file-selector-button {
|
|
82
|
+
display: none
|
|
83
|
+
}</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
files: FileList;
|
|
6
|
+
notes?: string | undefined;
|
|
7
|
+
width?: string | undefined;
|
|
8
|
+
height?: string | undefined;
|
|
9
|
+
padding?: string | undefined;
|
|
10
|
+
color?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
dragenter: DragEvent;
|
|
14
|
+
change: Event;
|
|
15
|
+
} & {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
};
|
|
18
|
+
slots: {
|
|
19
|
+
default: {};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type FileDropzoneProps = typeof __propDef.props;
|
|
23
|
+
export type FileDropzoneEvents = typeof __propDef.events;
|
|
24
|
+
export type FileDropzoneSlots = typeof __propDef.slots;
|
|
25
|
+
export default class FileDropzone extends SvelteComponentTyped<FileDropzoneProps, FileDropzoneEvents, FileDropzoneSlots> {
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script>/** Define the semantic element tag. */
|
|
2
|
+
export let tag = 'h1';
|
|
3
|
+
/** Provide classes to set gradient direction. */
|
|
4
|
+
export let direction = 'bg-gradient-to-r';
|
|
5
|
+
/** Provide classes to set "from" gradient color. */
|
|
6
|
+
export let from = 'from-primary-500';
|
|
7
|
+
/** Provide classes to set "to" gradient color. */
|
|
8
|
+
export let to = 'to-accent-500';
|
|
9
|
+
// Base Clases
|
|
10
|
+
let cBaseHeading = 'bg-clip-text text-transparent box-decoration-clone';
|
|
11
|
+
// Reactive
|
|
12
|
+
$: classesBase = `${$$props.class ?? ''}`;
|
|
13
|
+
$: clasesText = `${cBaseHeading} ${direction} ${from} ${to}`;
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<!-- svelte-ignore a11y-role-has-required-aria-props-->
|
|
17
|
+
<svelte:element this={tag} class="gradient-heading {classesBase}" data-testid="gradient-heading" role="heading">
|
|
18
|
+
<span class="gradient-heading-text {clasesText}">
|
|
19
|
+
<slot />
|
|
20
|
+
</span>
|
|
21
|
+
</svelte:element>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
tag?: string | undefined;
|
|
6
|
+
direction?: String | undefined;
|
|
7
|
+
from?: string | undefined;
|
|
8
|
+
to?: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {
|
|
14
|
+
default: {};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type GradientHeadingProps = typeof __propDef.props;
|
|
18
|
+
export type GradientHeadingEvents = typeof __propDef.events;
|
|
19
|
+
export type GradientHeadingSlots = typeof __propDef.slots;
|
|
20
|
+
export default class GradientHeading extends SvelteComponentTyped<GradientHeadingProps, GradientHeadingEvents, GradientHeadingSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script>import { setContext } from 'svelte';
|
|
2
|
+
import { writable } from 'svelte/store';
|
|
3
|
+
// Props (Listbox)
|
|
4
|
+
/** Provide a writable store to maintain list selection.
|
|
5
|
+
* @type {writeable(any) | writable(any[])}
|
|
6
|
+
*/
|
|
7
|
+
export let selected = writable(undefined);
|
|
8
|
+
/** Provide classes to set vertical item spacing. */
|
|
9
|
+
export let space = 'space-y-1';
|
|
10
|
+
/** Provide to set scrollable listbox region height. */
|
|
11
|
+
export let height = '';
|
|
12
|
+
// Props (Item)
|
|
13
|
+
/** Provide classes to set the item selected background. '!' recommended. */
|
|
14
|
+
export let accent = '!bg-active-token'; //
|
|
15
|
+
/** Provide classes to set the item padding styles. */
|
|
16
|
+
export let padding = 'px-4 py-3';
|
|
17
|
+
/** Provide classes to set the item border radius styles. */
|
|
18
|
+
export let rounded = 'rounded-token';
|
|
19
|
+
/** Provide classes to set the item hover background color. */
|
|
20
|
+
export let hover = 'bg-hover-token';
|
|
21
|
+
// Props (regions)
|
|
22
|
+
/** Provide arbitrary classes to the label element. */
|
|
23
|
+
export let regionLabel = '';
|
|
24
|
+
/** Provide arbitrary classes to the scrollable listbox element. */
|
|
25
|
+
export let regionList = '';
|
|
26
|
+
// Props (a11y)
|
|
27
|
+
/** Define a semantic ARIA label. */
|
|
28
|
+
export let label = '';
|
|
29
|
+
/** Set automatically based on the label text, but can be overwritten. */
|
|
30
|
+
export let labelId = label?.toLowerCase().replace(' ', '-'); //AUDIT this doesn't seem to be consistently applied across Skeleton
|
|
31
|
+
// Context
|
|
32
|
+
setContext('selected', selected);
|
|
33
|
+
setContext('accent', accent);
|
|
34
|
+
setContext('padding', padding);
|
|
35
|
+
setContext('rounded', rounded);
|
|
36
|
+
setContext('hover', hover);
|
|
37
|
+
// Base Classes
|
|
38
|
+
const cBase = 'space-y-4';
|
|
39
|
+
const cLabel = 'font-bold text-lg';
|
|
40
|
+
const cListBox = 'list-none overflow-y-auto';
|
|
41
|
+
// Reactive
|
|
42
|
+
$: classesBase = `${cBase} ${$$props.class ?? ''}`;
|
|
43
|
+
$: classesLabel = `${cLabel}`;
|
|
44
|
+
$: classesListBox = `${cListBox} ${height} ${space}`;
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<div class="listbox {classesBase}" data-testid="listbox-area">
|
|
48
|
+
<!-- Label -->
|
|
49
|
+
{#if label}<span class="listbox-label {classesLabel} {regionLabel}" id={labelId}>{label}</span>{/if}
|
|
50
|
+
<!-- Listbox -->
|
|
51
|
+
<ul class="listbox-list {classesListBox} {regionList}" role="listbox" aria-labelledby={labelId}>
|
|
52
|
+
<slot />
|
|
53
|
+
</ul>
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { type Writable } from 'svelte/store';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
selected?: Writable<any> | undefined;
|
|
7
|
+
space?: string | undefined;
|
|
8
|
+
height?: string | undefined;
|
|
9
|
+
accent?: string | undefined;
|
|
10
|
+
padding?: string | undefined;
|
|
11
|
+
rounded?: string | undefined;
|
|
12
|
+
hover?: string | undefined;
|
|
13
|
+
regionLabel?: string | undefined;
|
|
14
|
+
regionList?: string | undefined;
|
|
15
|
+
label?: string | undefined;
|
|
16
|
+
labelId?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {
|
|
22
|
+
default: {};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type ListBoxProps = typeof __propDef.props;
|
|
26
|
+
export type ListBoxEvents = typeof __propDef.events;
|
|
27
|
+
export type ListBoxSlots = typeof __propDef.slots;
|
|
28
|
+
export default class ListBox extends SvelteComponentTyped<ListBoxProps, ListBoxEvents, ListBoxSlots> {
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script>// Slots
|
|
2
|
+
/**
|
|
3
|
+
* @slot lead - Positioned on the left of each row item.
|
|
4
|
+
* @slot trail - Positioned on the right of each row item.
|
|
5
|
+
*/
|
|
6
|
+
import { createEventDispatcher, getContext } from 'svelte';
|
|
7
|
+
// Props (a11y)
|
|
8
|
+
/** Define a unique and semantic identifier for the item. */
|
|
9
|
+
export let id = '';
|
|
10
|
+
// Event Handler
|
|
11
|
+
const dispatch = createEventDispatcher();
|
|
12
|
+
// Context
|
|
13
|
+
export let selected = getContext('selected');
|
|
14
|
+
export let accent = getContext('accent');
|
|
15
|
+
export let padding = getContext('padding');
|
|
16
|
+
export let rounded = getContext('rounded');
|
|
17
|
+
export let hover = getContext('hover');
|
|
18
|
+
// Base Classes
|
|
19
|
+
const cBase = 'flex items-center space-x-4 whitespace-nowrap cursor-pointer';
|
|
20
|
+
// Local
|
|
21
|
+
let elemItem;
|
|
22
|
+
// Input Handler
|
|
23
|
+
function onClickHandler(event) {
|
|
24
|
+
/** @event {{ event }} click - Fires when the component is clicked. */
|
|
25
|
+
dispatch('click', event);
|
|
26
|
+
if (!$selected || !$$props.value) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
typeof $selected === 'object' ? handleMultiSelect() : handleSingleSelect();
|
|
30
|
+
}
|
|
31
|
+
// Selection Handlers
|
|
32
|
+
function handleSingleSelect() {
|
|
33
|
+
selected.set($$props.value);
|
|
34
|
+
}
|
|
35
|
+
function handleMultiSelect() {
|
|
36
|
+
const v = $$props.value;
|
|
37
|
+
const local = $selected;
|
|
38
|
+
// Add
|
|
39
|
+
if (local.includes(v)) {
|
|
40
|
+
local.splice(local.indexOf(v), 1);
|
|
41
|
+
selected.set(local);
|
|
42
|
+
}
|
|
43
|
+
// Remove
|
|
44
|
+
else {
|
|
45
|
+
selected.set([...local, v]);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// A11y Key Down Handler
|
|
49
|
+
function onKeyDown(event) {
|
|
50
|
+
/** @event {{ event: KeyboardEvent }} keydown - Fires when the component is focused and key is pressed. */
|
|
51
|
+
dispatch('keydown', event);
|
|
52
|
+
if (['Enter', 'Space'].includes(event.code)) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
elemItem.click();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Reactive
|
|
58
|
+
$: selectionMatch = () => {
|
|
59
|
+
if ($selected && $$props.value) {
|
|
60
|
+
return typeof $selected === 'object' ? $selected.includes($$props.value) : $selected === $$props.value;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
};
|
|
64
|
+
$: isSelected = selectionMatch() ? true : false;
|
|
65
|
+
$: classesHighlight = isSelected ? `${accent}` : `${hover}`;
|
|
66
|
+
$: classesBase = `${cBase} ${padding} ${rounded} ${classesHighlight} ${$$props.class ?? ''}`;
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<!-- prettier-ignore -->
|
|
70
|
+
<li
|
|
71
|
+
bind:this={elemItem}
|
|
72
|
+
class="listbox-item {classesBase}"
|
|
73
|
+
{id}
|
|
74
|
+
on:click={onClickHandler}
|
|
75
|
+
on:keydown={onKeyDown}
|
|
76
|
+
role="option"
|
|
77
|
+
aria-selected={isSelected}
|
|
78
|
+
tabindex="0"
|
|
79
|
+
data-testid="listbox-item"
|
|
80
|
+
>
|
|
81
|
+
<!-- Slot: Lead -->
|
|
82
|
+
{#if $$slots.lead}<span class="listbox-item-lead"><slot name="lead" /></span>{/if}
|
|
83
|
+
<!-- Slot: Default -->
|
|
84
|
+
<div class="listbox-item-content flex-1"><slot /></div>
|
|
85
|
+
<!-- Slot: Trail -->
|
|
86
|
+
{#if $$slots.trail}<span class="listbox-item-trail"><slot name="trail" /></span>{/if}
|
|
87
|
+
</li>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { Writable } from 'svelte/store';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
id?: string | undefined;
|
|
7
|
+
selected?: Writable<any> | undefined;
|
|
8
|
+
accent?: string | undefined;
|
|
9
|
+
padding?: string | undefined;
|
|
10
|
+
rounded?: string | undefined;
|
|
11
|
+
hover?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
events: {
|
|
14
|
+
click: CustomEvent<any>;
|
|
15
|
+
keydown: CustomEvent<any>;
|
|
16
|
+
} & {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
};
|
|
19
|
+
slots: {
|
|
20
|
+
lead: {};
|
|
21
|
+
default: {};
|
|
22
|
+
trail: {};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type ListBoxItemProps = typeof __propDef.props;
|
|
26
|
+
export type ListBoxItemEvents = typeof __propDef.events;
|
|
27
|
+
export type ListBoxItemSlots = typeof __propDef.slots;
|
|
28
|
+
export default class ListBoxItem extends SvelteComponentTyped<ListBoxItemProps, ListBoxItemEvents, ListBoxItemSlots> {
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
+
const dispatch = createEventDispatcher();
|
|
3
|
+
// Props
|
|
4
|
+
/**
|
|
5
|
+
* Pass the page setting object.
|
|
6
|
+
* @type {PaginationSettings}
|
|
7
|
+
*/
|
|
8
|
+
export let settings = { offset: 0, limit: 5, size: 0, amounts: [1, 2, 5, 10] };
|
|
9
|
+
// Props (design)
|
|
10
|
+
/** Provide classes to set flexbox justification. */
|
|
11
|
+
export let justify = 'justify-between';
|
|
12
|
+
/** Provide classes to style page info text. */
|
|
13
|
+
export let text = 'text-xs';
|
|
14
|
+
/** Provide arbitrary classes to style the select input. */
|
|
15
|
+
export let select = undefined;
|
|
16
|
+
// Props (buttons)
|
|
17
|
+
/** Provide a button variant class or any abitrary CSS class. */
|
|
18
|
+
export let buttons = 'btn-filled';
|
|
19
|
+
// Base Classes
|
|
20
|
+
const cBase = 'flex flex-col md:flex-row items-center space-y-4 md:space-y-0 md:space-x-4';
|
|
21
|
+
const cLabel = 'w-full md:w-auto';
|
|
22
|
+
const cPageText = 'whitespace-nowrap';
|
|
23
|
+
// Functionality
|
|
24
|
+
function onChangeLength() {
|
|
25
|
+
settings.offset = 0;
|
|
26
|
+
/** @event {{ length: number }} amount - Fires when the amount selection input changes. */
|
|
27
|
+
dispatch('amount', length);
|
|
28
|
+
}
|
|
29
|
+
function onPrev() {
|
|
30
|
+
settings.offset--;
|
|
31
|
+
/** @event {{ offset: number }} page Fires when the next/back buttons are pressed. */
|
|
32
|
+
dispatch('page', settings.offset);
|
|
33
|
+
}
|
|
34
|
+
function onNext() {
|
|
35
|
+
settings.offset++;
|
|
36
|
+
dispatch('page', settings.offset);
|
|
37
|
+
}
|
|
38
|
+
// Reactive Classes
|
|
39
|
+
$: classesBase = `${cBase} ${justify} ${$$props.class ?? ''}`;
|
|
40
|
+
$: classesLabel = `${cLabel}`;
|
|
41
|
+
$: classesSelect = `${select}`;
|
|
42
|
+
$: classesPageText = `${cPageText} ${text}`;
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<!-- prettier-ignore -->
|
|
46
|
+
<div class="paginator {classesBase}" data-testid="paginator">
|
|
47
|
+
<!-- Select Amount -->
|
|
48
|
+
<label class="paginator-label {classesLabel}">
|
|
49
|
+
<select bind:value={settings.limit} on:change={() => { onChangeLength() }} class="paginator-select {classesSelect}" aria-label="Select Amount">
|
|
50
|
+
{#each settings.amounts as amount}<option value={amount}>Show {amount}</option>{/each}
|
|
51
|
+
</select>
|
|
52
|
+
</label>
|
|
53
|
+
<!-- Details -->
|
|
54
|
+
<span class="paginator-details {classesPageText}">
|
|
55
|
+
{settings.offset * settings.limit + 1} to {Math.min(settings.offset * settings.limit + settings.limit, settings.size)} <span class="opacity-50 px-2">/</span> <strong>{settings.size}</strong>
|
|
56
|
+
</span>
|
|
57
|
+
<!-- Arrows -->
|
|
58
|
+
<div class="paginator-arrows space-x-2">
|
|
59
|
+
<button class="btn-icon {buttons}" on:click={() => { onPrev() }} disabled={settings.offset === 0}>←</button>
|
|
60
|
+
<button class="btn-icon {buttons}" on:click={() => { onNext() }} disabled={(settings.offset + 1) * settings.limit >= settings.size}>→</button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|