@skeletonlabs/skeleton 0.92.2 → 0.99.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Accordion/AccordionGroup.svelte +22 -35
- package/components/Accordion/AccordionItem.svelte +24 -40
- package/components/AppBar/AppBar.svelte +22 -38
- package/components/AppRail/AppRail.svelte +18 -39
- package/components/AppRail/AppRailTile.svelte +23 -37
- package/components/AppShell/AppShell.svelte +28 -38
- package/components/Avatar/Avatar.svelte +16 -33
- package/components/ConicGradient/ConicGradient.svelte +28 -44
- package/components/FileButton/FileButton.svelte +14 -11
- package/components/FileDropzone/FileDropzone.svelte +26 -46
- package/components/InputChip/InputChip.svelte +39 -69
- package/components/InputChip/InputChip.svelte.d.ts +0 -1
- package/components/ListBox/ListBox.svelte +27 -47
- package/components/ListBox/ListBoxItem.svelte +36 -52
- package/components/Paginator/Paginator.svelte +25 -41
- package/components/ProgressBar/ProgressBar.svelte +18 -30
- package/components/ProgressRadial/ProgressRadial.svelte +18 -36
- package/components/Radio/RadioGroup.svelte +23 -42
- package/components/Radio/RadioItem.svelte +24 -36
- package/components/RangeSlider/RangeSlider.svelte +17 -40
- package/components/SlideToggle/SlideToggle.svelte +42 -54
- package/components/Stepper/Step.svelte +57 -65
- package/components/Stepper/Stepper.svelte +30 -51
- package/components/SvgIcon/SvgIcon.svelte +11 -23
- package/components/Tab/Tab.svelte +30 -45
- package/components/Tab/TabGroup.svelte +30 -48
- package/components/Table/Table.svelte +20 -36
- package/components/TableOfContents/TableOfContents.svelte +62 -94
- package/index.d.ts +0 -5
- package/index.js +0 -5
- package/package.json +26 -25
- package/styles/all.css +3 -0
- package/styles/core.css +11 -2
- package/styles/elements/alerts.css +2 -28
- package/styles/elements/badges.css +0 -25
- package/styles/elements/breadcrumbs.css +3 -3
- package/styles/elements/buttons.css +32 -117
- package/styles/elements/cards.css +2 -29
- package/styles/elements/chips.css +9 -58
- package/styles/elements/lists.css +4 -3
- package/styles/elements/logo-clouds.css +2 -4
- package/styles/elements/tables.css +14 -10
- package/styles/forms.css +130 -113
- package/styles/tailwind.css +7 -3
- package/styles/typography.css +46 -62
- package/styles/variants.css +154 -0
- package/tailwind/core.cjs +37 -0
- package/tailwind/core.d.cts +5 -0
- package/tailwind/generated/intellisense-classes.cjs +1 -0
- package/tailwind/generated/{allComponents.d.cts → intellisense-classes.d.cts} +731 -931
- package/tailwind/intellisense.cjs +21 -0
- package/tailwind/intellisense.d.cts +5 -0
- package/tailwind/settings.cjs +16 -16
- package/tailwind/skeleton.cjs +13 -44
- package/tailwind/skeleton.d.cts +4 -2
- package/tailwind/theme/colors.cjs +7 -7
- package/tailwind/tokens/backgrounds.cjs +28 -30
- package/tailwind/tokens/border-radius.cjs +15 -15
- package/tailwind/tokens/borders.cjs +14 -14
- package/tailwind/tokens/fills.cjs +14 -14
- package/tailwind/tokens/rings.cjs +40 -32
- package/tailwind/tokens/rings.d.cts +5 -0
- package/tailwind/tokens/text.cjs +24 -26
- package/themes/theme-skeleton.css +6 -6
- package/utilities/CodeBlock/CodeBlock.svelte +26 -40
- package/utilities/DataTable/DataTable.js +1 -1
- package/utilities/Drawer/Drawer.svelte +82 -105
- package/utilities/LightSwitch/LightSwitch.svelte +32 -50
- package/utilities/LightSwitch/LightSwitch.svelte.d.ts +1 -1
- package/utilities/Modal/Modal.svelte +57 -92
- package/utilities/Modal/examples/ModalExampleEmbed.svelte +3 -6
- package/utilities/Modal/examples/ModalExampleForm.svelte +13 -19
- package/utilities/Modal/examples/ModalExampleImage.svelte +19 -0
- package/utilities/Modal/examples/ModalExampleImage.svelte.d.ts +16 -0
- package/utilities/Modal/examples/ModalExampleList.svelte +7 -10
- package/utilities/Toast/Toast.svelte +64 -86
- package/utilities/Toast/stores.js +13 -4
- package/components/Alert/Alert.svelte +0 -65
- package/components/Alert/Alert.svelte.d.ts +0 -30
- package/components/Breadcrumb/Breadcrumb.svelte +0 -24
- package/components/Breadcrumb/Breadcrumb.svelte.d.ts +0 -21
- package/components/Breadcrumb/Crumb.svelte +0 -37
- package/components/Breadcrumb/Crumb.svelte.d.ts +0 -26
- package/components/Divider/Divider.svelte +0 -21
- package/components/Divider/Divider.svelte.d.ts +0 -22
- package/components/GradientHeading/GradientHeading.svelte +0 -21
- package/components/GradientHeading/GradientHeading.svelte.d.ts +0 -22
- package/tailwind/generated/allComponents.cjs +0 -1
|
@@ -1,58 +1,37 @@
|
|
|
1
|
-
<script>import { createEventDispatcher } from
|
|
2
|
-
// Event Dispatcher
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte/internal";
|
|
3
2
|
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
3
|
export let files;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export let
|
|
14
|
-
|
|
15
|
-
export let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/** Provide styles to set the dropzone height. */
|
|
20
|
-
export let height = 'h-24';
|
|
21
|
-
/** Provide styles to set the dropzone padding. */
|
|
22
|
-
export let padding = 'p-4';
|
|
23
|
-
/** Provide styles to set the dropzone text color. */
|
|
24
|
-
export let color = '';
|
|
25
|
-
// Classes
|
|
26
|
-
const cBase = 'relative';
|
|
27
|
-
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';
|
|
28
|
-
const cInput = '!border-2 border-dashed cursor-pointer !text-transparent !rounded-container-token';
|
|
29
|
-
// Local
|
|
4
|
+
export let title = "Drop files or click to select.";
|
|
5
|
+
export let notes = "";
|
|
6
|
+
export let width = "w-full";
|
|
7
|
+
export let height = "h-24";
|
|
8
|
+
export let padding = "p-4";
|
|
9
|
+
export let color = "";
|
|
10
|
+
const cBase = "relative";
|
|
11
|
+
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";
|
|
12
|
+
const cInput = "!border-2 border-dashed cursor-pointer !text-transparent !rounded-container-token";
|
|
30
13
|
let elemIcon;
|
|
31
|
-
// Drag and Drop Event Handlers
|
|
32
|
-
// Handles icon animation and passes events up
|
|
33
14
|
function onDragOver(event) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
elemIcon?.classList.add('animate-bounce');
|
|
15
|
+
dispatch("dragover", event);
|
|
16
|
+
elemIcon?.classList.add("animate-bounce");
|
|
37
17
|
}
|
|
38
18
|
function onDragLeave(event) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
elemIcon?.classList.remove('animate-bounce');
|
|
19
|
+
dispatch("dragleave", event);
|
|
20
|
+
elemIcon?.classList.remove("animate-bounce");
|
|
42
21
|
}
|
|
43
22
|
function onDrop(event) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
elemIcon?.classList.remove('animate-bounce');
|
|
23
|
+
dispatch("drop", event);
|
|
24
|
+
elemIcon?.classList.remove("animate-bounce");
|
|
47
25
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
$:
|
|
51
|
-
|
|
52
|
-
|
|
26
|
+
$:
|
|
27
|
+
classesBase = `${cBase} ${width} ${$$props.class ?? ""}`;
|
|
28
|
+
$:
|
|
29
|
+
classesMessage = `${cMessage} ${color} ${height} ${padding}`;
|
|
30
|
+
$:
|
|
31
|
+
classesInput = `${cInput} ${height} ${padding}`;
|
|
53
32
|
function prunedRestProps() {
|
|
54
|
-
|
|
55
|
-
|
|
33
|
+
delete $$restProps.class;
|
|
34
|
+
return $$restProps;
|
|
56
35
|
}
|
|
57
36
|
</script>
|
|
58
37
|
|
|
@@ -92,4 +71,5 @@ function prunedRestProps() {
|
|
|
92
71
|
/* Hide Input:File Content */
|
|
93
72
|
::file-selector-button {
|
|
94
73
|
display: none
|
|
95
|
-
}
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
@@ -1,87 +1,57 @@
|
|
|
1
|
-
<script>import { createEventDispatcher } from
|
|
2
|
-
// Event Dispatcher
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte/internal";
|
|
3
2
|
const dispatch = createEventDispatcher();
|
|
4
|
-
|
|
5
|
-
/** Optionally provide an semantic label. */
|
|
6
|
-
export let label = '';
|
|
7
|
-
/** Optionally provide an input placeholder. */
|
|
3
|
+
export let label = "";
|
|
8
4
|
export let value = [];
|
|
9
|
-
/**
|
|
10
|
-
* Provide a whitelist of accepted values.
|
|
11
|
-
* @type {string[]}
|
|
12
|
-
*/
|
|
13
5
|
export let whitelist = [];
|
|
14
|
-
/** When enabled, allows for uppercase values. */
|
|
15
6
|
export let allowUpperCase = false;
|
|
16
|
-
/** When enabled, allows for duplicate values. */
|
|
17
7
|
export let allowDuplicates = true;
|
|
18
|
-
/**
|
|
19
|
-
* Provide a custom validation function.
|
|
20
|
-
* @type {function}
|
|
21
|
-
*/
|
|
22
8
|
export let validation = () => true;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export let
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/** Set the input padding styles. */
|
|
29
|
-
export let padding = 'p-3';
|
|
30
|
-
/** Set the input border radius styles. */
|
|
31
|
-
export let rounded = 'rounded-container-token';
|
|
32
|
-
/** Set the input focus ring styles. */
|
|
33
|
-
export let ring = 'focus:ring-transparent';
|
|
34
|
-
// Local
|
|
35
|
-
let inputValue = '';
|
|
9
|
+
export let chip = `variant-filled-primary`;
|
|
10
|
+
export let padding = "p-2";
|
|
11
|
+
export let rounded = "rounded-container-token";
|
|
12
|
+
export let ring = "focus:ring-transparent";
|
|
13
|
+
let inputValue = "";
|
|
36
14
|
let inputValueValid = true;
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const cInput = 'unstyled flex-auto border-transparent bg-transparent text-base px-1 py-0 focus:border-transparent min-h-[30px]';
|
|
15
|
+
const cBase = "unstyled input-cell border-token flex flex-wrap gap-2 items-center";
|
|
16
|
+
const cLabel = "unstyled w-full md:w-auto mr-2";
|
|
17
|
+
const cInput = "unstyled flex-auto border-transparent bg-transparent text-base px-1 py-0 focus:border-transparent min-h-[30px]";
|
|
41
18
|
function resetValiadtionClass() {
|
|
42
|
-
|
|
19
|
+
inputValueValid = true;
|
|
43
20
|
}
|
|
44
21
|
function addChip(event) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// Format: to lowercase (if enabled)
|
|
64
|
-
inputValue = allowUpperCase ? inputValue : inputValue.toLowerCase();
|
|
65
|
-
// Append value
|
|
66
|
-
value = [...value, inputValue];
|
|
67
|
-
// Clear input value
|
|
68
|
-
inputValue = '';
|
|
69
|
-
/** @event {{ event: KeyboardEvent }} add - When a chip is added. */
|
|
70
|
-
dispatch('add', event);
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
if (validation !== void 0 && !validation(inputValue)) {
|
|
24
|
+
inputValueValid = false;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (whitelist.length > 0 && !whitelist.includes(inputValue)) {
|
|
28
|
+
inputValueValid = false;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (allowDuplicates === false && value.includes(inputValue)) {
|
|
32
|
+
inputValueValid = false;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
inputValue = inputValue.trim();
|
|
36
|
+
inputValue = allowUpperCase ? inputValue : inputValue.toLowerCase();
|
|
37
|
+
value = [...value, inputValue];
|
|
38
|
+
inputValue = "";
|
|
39
|
+
dispatch("add", event);
|
|
71
40
|
}
|
|
72
41
|
function removeChip(chipIndex) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
dispatch('remove', chipIndex);
|
|
42
|
+
value = value.filter((_, i) => i !== chipIndex);
|
|
43
|
+
dispatch("remove", chipIndex);
|
|
76
44
|
}
|
|
77
45
|
function prunedRestProps() {
|
|
78
|
-
|
|
79
|
-
|
|
46
|
+
delete $$restProps.class;
|
|
47
|
+
return $$restProps;
|
|
80
48
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
$:
|
|
84
|
-
|
|
49
|
+
$:
|
|
50
|
+
classesBase = `${cBase} ${padding} ${rounded}`;
|
|
51
|
+
$:
|
|
52
|
+
classesChip = `${chip}`;
|
|
53
|
+
$:
|
|
54
|
+
classesInput = `${cInput} ${ring}`;
|
|
85
55
|
</script>
|
|
86
56
|
|
|
87
57
|
<label class="input-chip {classesBase}">
|
|
@@ -9,7 +9,6 @@ declare const __propDef: {
|
|
|
9
9
|
allowDuplicates?: boolean | undefined;
|
|
10
10
|
validation?: ((...args: any[]) => boolean) | undefined;
|
|
11
11
|
chip?: string | undefined;
|
|
12
|
-
hover?: string | undefined;
|
|
13
12
|
padding?: string | undefined;
|
|
14
13
|
rounded?: string | undefined;
|
|
15
14
|
ring?: string | undefined;
|
|
@@ -1,50 +1,30 @@
|
|
|
1
|
-
<script>import { setContext } from
|
|
2
|
-
import { writable } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export let
|
|
8
|
-
|
|
9
|
-
export let
|
|
10
|
-
|
|
11
|
-
export let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export let label = '';
|
|
29
|
-
/**
|
|
30
|
-
* Set automatically based on the label text, but can be overwritten.
|
|
31
|
-
* @type {string}
|
|
32
|
-
*/
|
|
33
|
-
export let labelId = label?.toLowerCase().replace(' ', '-'); //AUDIT this doesn't seem to be consistently applied across Skeleton
|
|
34
|
-
// Context
|
|
35
|
-
setContext('selected', selected);
|
|
36
|
-
setContext('accent', accent);
|
|
37
|
-
setContext('padding', padding);
|
|
38
|
-
setContext('rounded', rounded);
|
|
39
|
-
setContext('hover', hover);
|
|
40
|
-
// Base Classes
|
|
41
|
-
const cBase = 'space-y-4';
|
|
42
|
-
const cLabel = 'font-bold text-lg';
|
|
43
|
-
const cListBox = 'list-none overflow-y-auto';
|
|
44
|
-
// Reactive
|
|
45
|
-
$: classesBase = `${cBase} ${$$props.class ?? ''}`;
|
|
46
|
-
$: classesLabel = `${cLabel}`;
|
|
47
|
-
$: classesListBox = `${cListBox} ${height} ${space}`;
|
|
1
|
+
<script>import { setContext } from "svelte";
|
|
2
|
+
import { writable } from "svelte/store";
|
|
3
|
+
export let selected = writable(void 0);
|
|
4
|
+
export let space = "space-y-1";
|
|
5
|
+
export let height = "";
|
|
6
|
+
export let accent = "!bg-primary-active-token";
|
|
7
|
+
export let padding = "px-4 py-3";
|
|
8
|
+
export let rounded = "rounded-token";
|
|
9
|
+
export let hover = "bg-primary-hover-token";
|
|
10
|
+
export let regionLabel = "";
|
|
11
|
+
export let regionList = "";
|
|
12
|
+
export let label = "";
|
|
13
|
+
export let labelId = label?.toLowerCase().replace(" ", "-");
|
|
14
|
+
setContext("selected", selected);
|
|
15
|
+
setContext("accent", accent);
|
|
16
|
+
setContext("padding", padding);
|
|
17
|
+
setContext("rounded", rounded);
|
|
18
|
+
setContext("hover", hover);
|
|
19
|
+
const cBase = "space-y-4";
|
|
20
|
+
const cLabel = "font-bold text-lg";
|
|
21
|
+
const cListBox = "list-none overflow-y-auto";
|
|
22
|
+
$:
|
|
23
|
+
classesBase = `${cBase} ${$$props.class ?? ""}`;
|
|
24
|
+
$:
|
|
25
|
+
classesLabel = `${cLabel}`;
|
|
26
|
+
$:
|
|
27
|
+
classesListBox = `${cListBox} ${height} ${space}`;
|
|
48
28
|
</script>
|
|
49
29
|
|
|
50
30
|
<div class="listbox {classesBase}" data-testid="listbox-area">
|
|
@@ -1,68 +1,52 @@
|
|
|
1
|
-
<script
|
|
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
|
|
1
|
+
<script>import { createEventDispatcher, getContext } from "svelte";
|
|
2
|
+
export let id = "";
|
|
11
3
|
const dispatch = createEventDispatcher();
|
|
12
|
-
|
|
13
|
-
export let
|
|
14
|
-
export let
|
|
15
|
-
export let
|
|
16
|
-
export let
|
|
17
|
-
|
|
18
|
-
// Base Classes
|
|
19
|
-
const cBase = 'flex items-center space-x-4 whitespace-nowrap cursor-pointer -outline-offset-[3px]';
|
|
20
|
-
// Local
|
|
4
|
+
export let selected = getContext("selected");
|
|
5
|
+
export let accent = getContext("accent");
|
|
6
|
+
export let padding = getContext("padding");
|
|
7
|
+
export let rounded = getContext("rounded");
|
|
8
|
+
export let hover = getContext("hover");
|
|
9
|
+
const cBase = "flex items-center space-x-4 whitespace-nowrap cursor-pointer -outline-offset-[3px]";
|
|
21
10
|
let elemItem;
|
|
22
|
-
// Input Handler
|
|
23
11
|
function onClickHandler(event) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
dispatch('click', event);
|
|
12
|
+
if (!$$props.value)
|
|
13
|
+
return;
|
|
14
|
+
Array.isArray($selected) === true ? handleMultiSelect() : handleSingleSelect();
|
|
15
|
+
dispatch("click", event);
|
|
29
16
|
}
|
|
30
|
-
// Selection Handlers
|
|
31
17
|
function handleSingleSelect() {
|
|
32
|
-
|
|
18
|
+
selected.set($$props.value);
|
|
33
19
|
}
|
|
34
20
|
function handleMultiSelect() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
else {
|
|
44
|
-
selected.set([...local, v]);
|
|
45
|
-
}
|
|
21
|
+
const v = $$props.value;
|
|
22
|
+
const local = $selected;
|
|
23
|
+
if (local.includes(v)) {
|
|
24
|
+
local.splice(local.indexOf(v), 1);
|
|
25
|
+
selected.set(local);
|
|
26
|
+
} else {
|
|
27
|
+
selected.set([...local, v]);
|
|
28
|
+
}
|
|
46
29
|
}
|
|
47
|
-
// A11y Key Down Handler
|
|
48
30
|
function onKeyDown(event) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
31
|
+
dispatch("keydown", event);
|
|
32
|
+
if (["Enter", "Space"].includes(event.code)) {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
elemItem.click();
|
|
35
|
+
}
|
|
55
36
|
}
|
|
56
|
-
|
|
57
|
-
|
|
37
|
+
$:
|
|
38
|
+
selectionMatch = () => {
|
|
58
39
|
if ($selected && $$props.value) {
|
|
59
|
-
|
|
40
|
+
return typeof $selected === "object" ? $selected.includes($$props.value) : $selected === $$props.value;
|
|
60
41
|
}
|
|
61
42
|
return false;
|
|
62
|
-
};
|
|
63
|
-
$:
|
|
64
|
-
|
|
65
|
-
$:
|
|
43
|
+
};
|
|
44
|
+
$:
|
|
45
|
+
isSelected = selectionMatch() ? true : false;
|
|
46
|
+
$:
|
|
47
|
+
classesHighlight = isSelected ? `${accent}` : `${hover}`;
|
|
48
|
+
$:
|
|
49
|
+
classesBase = `${cBase} ${padding} ${rounded} ${classesHighlight} ${$$props.class ?? ""}`;
|
|
66
50
|
</script>
|
|
67
51
|
|
|
68
52
|
<!-- prettier-ignore -->
|
|
@@ -1,53 +1,37 @@
|
|
|
1
|
-
<script>import { createEventDispatcher } from
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
2
|
const dispatch = createEventDispatcher();
|
|
3
|
-
// Props
|
|
4
|
-
/**
|
|
5
|
-
* Pass the page setting object.
|
|
6
|
-
* @type {PaginationSettings}
|
|
7
|
-
*/
|
|
8
3
|
export let settings = { offset: 0, limit: 5, size: 0, amounts: [1, 2, 5, 10] };
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export let
|
|
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
|
-
/** Sets selection and buttons to disabled state on-demand. */
|
|
4
|
+
export let justify = "justify-between";
|
|
5
|
+
export let text = "text-xs";
|
|
6
|
+
export let select = void 0;
|
|
17
7
|
export let disabled = false;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/** Set the text label for the Next button. */
|
|
26
|
-
export let buttonTextNext = '→';
|
|
27
|
-
// Base Classes
|
|
28
|
-
const cBase = 'flex flex-col md:flex-row items-center space-y-4 md:space-y-0 md:space-x-4';
|
|
29
|
-
const cLabel = 'w-full md:w-auto';
|
|
30
|
-
const cPageText = 'whitespace-nowrap';
|
|
31
|
-
// Functionality
|
|
8
|
+
export let amountText = "Items";
|
|
9
|
+
export let buttonClasses = "btn-icon variant-filled";
|
|
10
|
+
export let buttonTextPrevious = "←";
|
|
11
|
+
export let buttonTextNext = "→";
|
|
12
|
+
const cBase = "flex flex-col md:flex-row items-center space-y-4 md:space-y-0 md:space-x-4";
|
|
13
|
+
const cLabel = "w-full md:w-auto";
|
|
14
|
+
const cPageText = "whitespace-nowrap";
|
|
32
15
|
function onChangeLength() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
dispatch('amount', settings.limit);
|
|
16
|
+
settings.offset = 0;
|
|
17
|
+
dispatch("amount", settings.limit);
|
|
36
18
|
}
|
|
37
19
|
function onPrev() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
dispatch('page', settings.offset);
|
|
20
|
+
settings.offset--;
|
|
21
|
+
dispatch("page", settings.offset);
|
|
41
22
|
}
|
|
42
23
|
function onNext() {
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
settings.offset++;
|
|
25
|
+
dispatch("page", settings.offset);
|
|
45
26
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
$:
|
|
49
|
-
|
|
50
|
-
$:
|
|
27
|
+
$:
|
|
28
|
+
classesBase = `${cBase} ${justify} ${$$props.class ?? ""}`;
|
|
29
|
+
$:
|
|
30
|
+
classesLabel = `${cLabel}`;
|
|
31
|
+
$:
|
|
32
|
+
classesSelect = `${select}`;
|
|
33
|
+
$:
|
|
34
|
+
classesPageText = `${cPageText} ${text}`;
|
|
51
35
|
</script>
|
|
52
36
|
|
|
53
37
|
<!-- prettier-ignore -->
|
|
@@ -1,35 +1,22 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
export let label = '';
|
|
4
|
-
/**
|
|
5
|
-
* Specifies the amount completed. Indeterminate when `undefined`
|
|
6
|
-
* @type {number}
|
|
7
|
-
*/
|
|
8
|
-
export let value = undefined;
|
|
9
|
-
/** Minimum amount the bar represents. */
|
|
1
|
+
<script>export let label = "";
|
|
2
|
+
export let value = void 0;
|
|
10
3
|
export let min = 0;
|
|
11
|
-
/** Maximum amount the bar represents. */
|
|
12
4
|
export let max = 100;
|
|
13
|
-
|
|
14
|
-
export let
|
|
15
|
-
|
|
16
|
-
export let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export let meter = 'bg-secondary-500';
|
|
20
|
-
/** Provide arbitrary classes to style the track element. */
|
|
21
|
-
export let track = 'bg-surface-200-700-token';
|
|
22
|
-
// Base Classes
|
|
23
|
-
const cBase = 'w-full';
|
|
24
|
-
const cBaseLabel = 'block text-sm mb-2';
|
|
5
|
+
export let height = "h-2";
|
|
6
|
+
export let rounded = "rounded-token";
|
|
7
|
+
export let meter = "bg-secondary-500";
|
|
8
|
+
export let track = "bg-surface-200-700-token";
|
|
9
|
+
const cBase = "w-full";
|
|
10
|
+
const cBaseLabel = "block text-sm mb-2";
|
|
25
11
|
const cBaseTrack = `w-full overflow-hidden`;
|
|
26
|
-
const cBaseMeterDeterminate =
|
|
27
|
-
const cBaseMeterIndeterminate =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
$:
|
|
12
|
+
const cBaseMeterDeterminate = "h-full";
|
|
13
|
+
const cBaseMeterIndeterminate = "h-full w-full";
|
|
14
|
+
$:
|
|
15
|
+
fillPercent = value ? 100 * (value - min) / (max - min) : 0;
|
|
16
|
+
$:
|
|
17
|
+
classesTrack = `${cBaseTrack} ${height} ${rounded} ${track} ${$$props.class ?? ""}`;
|
|
18
|
+
$:
|
|
19
|
+
classesMeter = `${rounded} ${meter}`;
|
|
33
20
|
</script>
|
|
34
21
|
|
|
35
22
|
<div
|
|
@@ -64,4 +51,5 @@ $: classesMeter = `${rounded} ${meter}`;
|
|
|
64
51
|
0% { transform: translateX(0) scaleX(0); }
|
|
65
52
|
40% { transform: translateX(0) scaleX(0.4); }
|
|
66
53
|
100% { transform: translateX(100%) scaleX(0.5); }
|
|
67
|
-
}
|
|
54
|
+
}
|
|
55
|
+
</style>
|
|
@@ -1,47 +1,29 @@
|
|
|
1
1
|
<!-- https://css-tricks.com/building-progress-ring-quickly/ -->
|
|
2
|
-
<script>import { afterUpdate } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export let
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export let track = 'stroke-surface-200 dark:stroke-surface-700';
|
|
15
|
-
/** Provide classes to set the SVG text fill color. */
|
|
16
|
-
export let fill = 'fill-token';
|
|
17
|
-
/** Sets the base font size. Scales responsively. */
|
|
18
|
-
export let font = 56; // px
|
|
19
|
-
// Props (a11y)
|
|
20
|
-
/** A semantic ARIA label. */
|
|
21
|
-
export let label = '';
|
|
22
|
-
// Base Classes
|
|
23
|
-
const cBase = 'progress-radial relative overflow-hidden';
|
|
24
|
-
const cBaseTrack = 'fill-transparent';
|
|
25
|
-
const cBaseMeter = 'fill-transparent transition-[stroke-dashoffset] duration-200 -rotate-90 origin-[50%_50%]';
|
|
26
|
-
// Calculated Values
|
|
27
|
-
const baseSize = 512; // px
|
|
2
|
+
<script>import { afterUpdate } from "svelte";
|
|
3
|
+
export let value = void 0;
|
|
4
|
+
export let stroke = 20;
|
|
5
|
+
export let meter = "stroke-secondary-500";
|
|
6
|
+
export let track = "stroke-surface-200 dark:stroke-surface-700";
|
|
7
|
+
export let fill = "fill-token";
|
|
8
|
+
export let font = 56;
|
|
9
|
+
export let label = "";
|
|
10
|
+
const cBase = "progress-radial relative overflow-hidden";
|
|
11
|
+
const cBaseTrack = "fill-transparent";
|
|
12
|
+
const cBaseMeter = "fill-transparent transition-[stroke-dashoffset] duration-200 -rotate-90 origin-[50%_50%]";
|
|
13
|
+
const baseSize = 512;
|
|
28
14
|
const radius = baseSize / 2;
|
|
29
15
|
let circumference = radius;
|
|
30
16
|
let dashoffset;
|
|
31
|
-
// Set Progress Amount
|
|
32
17
|
function setProgress(percent) {
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
circumference = radius * 2 * Math.PI;
|
|
19
|
+
dashoffset = circumference - percent / 100 * circumference;
|
|
35
20
|
}
|
|
36
|
-
// On Init
|
|
37
21
|
setProgress(0);
|
|
38
|
-
// Reactive
|
|
39
22
|
afterUpdate(() => {
|
|
40
|
-
|
|
41
|
-
setProgress(value === undefined ? 25 : value);
|
|
23
|
+
setProgress(value === void 0 ? 25 : value);
|
|
42
24
|
});
|
|
43
|
-
|
|
44
|
-
|
|
25
|
+
$:
|
|
26
|
+
classesBase = `${cBase} ${$$props.class ?? ""}`;
|
|
45
27
|
</script>
|
|
46
28
|
|
|
47
29
|
<!-- https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor -->
|
|
@@ -74,7 +56,7 @@ $: classesBase = `${cBase} ${$$props.class ?? ''}`;
|
|
|
74
56
|
/>
|
|
75
57
|
|
|
76
58
|
<!-- Center Text -->
|
|
77
|
-
{#if value && value >= 0 && $$slots.default}
|
|
59
|
+
{#if value != undefined && value >= 0 && $$slots.default}
|
|
78
60
|
<text
|
|
79
61
|
x="50%"
|
|
80
62
|
y="50%"
|