@skeletonlabs/skeleton 1.11.0 → 2.0.0-rc.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/dist/components/Accordion/Accordion.svelte +15 -3
- package/dist/components/Accordion/Accordion.svelte.d.ts +17 -23
- package/dist/components/Accordion/AccordionItem.svelte +8 -3
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +15 -25
- package/dist/components/AppRail/AppRailTile.svelte +1 -1
- package/dist/components/Autocomplete/Autocomplete.svelte +24 -15
- package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +17 -27
- package/dist/components/Avatar/Avatar.svelte +1 -1
- package/dist/components/ConicGradient/ConicGradient.svelte +1 -1
- package/dist/components/InputChip/InputChip.svelte +25 -10
- package/dist/components/InputChip/InputChip.svelte.d.ts +22 -27
- package/dist/components/Paginator/Paginator.svelte +18 -16
- package/dist/components/Paginator/Paginator.svelte.d.ts +2 -2
- package/dist/components/Paginator/types.d.ts +2 -2
- package/dist/components/Radio/RadioGroup.svelte +2 -0
- package/dist/components/Radio/RadioGroup.svelte.d.ts +2 -0
- package/dist/components/Radio/RadioItem.svelte +8 -4
- package/dist/components/Radio/RadioItem.svelte.d.ts +1 -0
- package/dist/components/Ratings/Ratings.svelte +1 -1
- package/dist/components/Stepper/Step.svelte +11 -2
- package/dist/components/Stepper/Step.svelte.d.ts +15 -12
- package/dist/components/Stepper/Stepper.svelte +21 -3
- package/dist/components/Stepper/Stepper.svelte.d.ts +17 -27
- package/dist/components/Tab/TabGroup.svelte +1 -1
- package/dist/components/Table/Table.svelte +1 -1
- package/dist/components/TreeView/TreeView.svelte +71 -2
- package/dist/components/TreeView/TreeView.svelte.d.ts +19 -0
- package/dist/components/TreeView/TreeViewDataDrivenItem.svelte +70 -0
- package/dist/components/TreeView/TreeViewDataDrivenItem.svelte.d.ts +25 -0
- package/dist/components/TreeView/TreeViewItem.svelte +198 -10
- package/dist/components/TreeView/TreeViewItem.svelte.d.ts +90 -2
- package/dist/components/TreeView/types.d.ts +18 -0
- package/dist/components/TreeView/types.js +1 -0
- package/dist/index.d.ts +12 -9
- package/dist/index.js +11 -12
- package/dist/internal/transitions.d.ts +10 -0
- package/dist/internal/transitions.js +11 -0
- package/dist/transitions/crossfade.d.ts +1 -0
- package/dist/transitions/crossfade.js +21 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.js +1 -0
- package/dist/utilities/Drawer/Drawer.svelte +33 -12
- package/dist/utilities/Drawer/Drawer.svelte.d.ts +4 -2
- package/dist/utilities/Drawer/stores.d.ts +20 -1
- package/dist/utilities/Drawer/stores.js +27 -2
- package/dist/utilities/Drawer/types.d.ts +2 -0
- package/dist/utilities/Modal/Modal.svelte +21 -23
- package/dist/utilities/Modal/Modal.svelte.d.ts +17 -37
- package/dist/utilities/Modal/stores.d.ts +20 -1
- package/dist/utilities/Modal/stores.js +27 -1
- package/dist/utilities/PrefersReducedMotion/PrefersReducedMotion.d.ts +7 -0
- package/dist/utilities/PrefersReducedMotion/PrefersReducedMotion.js +26 -0
- package/dist/utilities/TableOfContents/TableOfContents.svelte +56 -0
- package/dist/utilities/TableOfContents/TableOfContents.svelte.d.ts +34 -0
- package/dist/utilities/TableOfContents/crawler.d.ts +14 -0
- package/dist/utilities/TableOfContents/crawler.js +76 -0
- package/dist/utilities/TableOfContents/stores.d.ts +6 -0
- package/dist/utilities/TableOfContents/stores.js +5 -0
- package/dist/utilities/TableOfContents/types.d.ts +5 -0
- package/dist/utilities/TableOfContents/types.js +2 -0
- package/dist/utilities/Toast/Toast.svelte +24 -23
- package/dist/utilities/Toast/Toast.svelte.d.ts +17 -24
- package/dist/utilities/Toast/stores.d.ts +23 -5
- package/dist/utilities/Toast/stores.js +56 -29
- package/dist/utilities/index.d.ts +18 -0
- package/dist/utilities/index.js +25 -0
- package/package.json +3 -16
- package/dist/components/TableOfContents/TableOfContents.svelte +0 -111
- package/dist/components/TableOfContents/TableOfContents.svelte.d.ts +0 -44
- package/dist/styles/all.css +0 -30
- package/dist/styles/elements/alerts.css +0 -17
- package/dist/styles/elements/badges.css +0 -31
- package/dist/styles/elements/breadcrumbs.css +0 -36
- package/dist/styles/elements/buttons.css +0 -109
- package/dist/styles/elements/cards.css +0 -32
- package/dist/styles/elements/chips.css +0 -22
- package/dist/styles/elements/codeblocks.css +0 -16
- package/dist/styles/elements/forms.css +0 -283
- package/dist/styles/elements/lists.css +0 -51
- package/dist/styles/elements/logo-clouds.css +0 -29
- package/dist/styles/elements/modals.css +0 -15
- package/dist/styles/elements/placeholders.css +0 -17
- package/dist/styles/elements/popups.css +0 -16
- package/dist/styles/elements/tables.css +0 -102
- package/dist/styles/partials/core.css +0 -66
- package/dist/styles/partials/elements.css +0 -20
- package/dist/styles/partials/tailwind.css +0 -16
- package/dist/styles/partials/typography-next.css +0 -99
- package/dist/styles/partials/typography-prose.css +0 -49
- package/dist/styles/partials/typography.css +0 -99
- package/dist/styles/partials/variants.css +0 -204
- package/dist/styles/skeleton-minimal.css +0 -30
- package/dist/styles/skeleton.css +0 -30
- package/dist/tailwind/core.cjs +0 -37
- package/dist/tailwind/core.d.cts +0 -5
- package/dist/tailwind/generated/intellisense-classes.cjs +0 -1
- package/dist/tailwind/generated/intellisense-classes.d.cts +0 -2729
- package/dist/tailwind/intellisense.cjs +0 -21
- package/dist/tailwind/intellisense.d.cts +0 -5
- package/dist/tailwind/settings.cjs +0 -20
- package/dist/tailwind/settings.d.cts +0 -6
- package/dist/tailwind/skeleton.cjs +0 -19
- package/dist/tailwind/skeleton.d.cts +0 -7
- package/dist/tailwind/theme/colors.cjs +0 -18
- package/dist/tailwind/theme/colors.d.cts +0 -2
- package/dist/tailwind/tokens/backgrounds.cjs +0 -39
- package/dist/tailwind/tokens/backgrounds.d.cts +0 -2
- package/dist/tailwind/tokens/border-radius.cjs +0 -21
- package/dist/tailwind/tokens/border-radius.d.cts +0 -33
- package/dist/tailwind/tokens/borders.cjs +0 -20
- package/dist/tailwind/tokens/borders.d.cts +0 -6
- package/dist/tailwind/tokens/fills.cjs +0 -20
- package/dist/tailwind/tokens/fills.d.cts +0 -15
- package/dist/tailwind/tokens/rings.cjs +0 -50
- package/dist/tailwind/tokens/rings.d.cts +0 -22
- package/dist/tailwind/tokens/text.cjs +0 -31
- package/dist/tailwind/tokens/text.d.cts +0 -21
- package/dist/themes/theme-crimson.css +0 -100
- package/dist/themes/theme-gold-nouveau.css +0 -143
- package/dist/themes/theme-hamlindigo.css +0 -109
- package/dist/themes/theme-modern.css +0 -134
- package/dist/themes/theme-rocket.css +0 -120
- package/dist/themes/theme-sahara.css +0 -133
- package/dist/themes/theme-seafoam.css +0 -128
- package/dist/themes/theme-seasonal.css +0 -114
- package/dist/themes/theme-skeleton.css +0 -119
- package/dist/themes/theme-test.css +0 -96
- package/dist/themes/theme-vintage.css +0 -131
- package/dist/utilities/DataTable/DataTable.d.ts +0 -19
- package/dist/utilities/DataTable/DataTable.js +0 -137
- package/dist/utilities/DataTable/types.d.ts +0 -33
- package/dist/utilities/DataTable/types.js +0 -2
- /package/dist/{utilities/DataTable → components/Table}/actions.d.ts +0 -0
- /package/dist/{utilities/DataTable → components/Table}/actions.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { PaginationSettings } from '
|
|
2
|
+
import type { PaginationSettings } from './types.js';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
@@ -53,7 +53,7 @@ declare const __propDef: {
|
|
|
53
53
|
events: {
|
|
54
54
|
/** {{ length: number }} amount - Fires when the amount selection input changes.*/
|
|
55
55
|
amount: CustomEvent<number>;
|
|
56
|
-
/** {{
|
|
56
|
+
/** {{ page: number }} page Fires when the next/back buttons are pressed.*/
|
|
57
57
|
page: CustomEvent<number>;
|
|
58
58
|
} & {
|
|
59
59
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface PaginationSettings {
|
|
2
|
-
/** Index of the
|
|
3
|
-
|
|
2
|
+
/** Index of the current page to display. */
|
|
3
|
+
page: number;
|
|
4
4
|
/** Current number of items to display. */
|
|
5
5
|
limit: number;
|
|
6
6
|
/** The total size (length) of your source content. */
|
|
@@ -9,6 +9,7 @@ export let active = "variant-filled";
|
|
|
9
9
|
export let hover = "hover:variant-soft";
|
|
10
10
|
export let color = "";
|
|
11
11
|
export let fill = "";
|
|
12
|
+
export let regionLabel = "";
|
|
12
13
|
export let labelledby = "";
|
|
13
14
|
setContext("rounded", rounded);
|
|
14
15
|
setContext("padding", padding);
|
|
@@ -16,6 +17,7 @@ setContext("active", active);
|
|
|
16
17
|
setContext("hover", hover);
|
|
17
18
|
setContext("color", color);
|
|
18
19
|
setContext("fill", fill);
|
|
20
|
+
setContext("regionLabel", regionLabel);
|
|
19
21
|
const cBase = "p-1";
|
|
20
22
|
$:
|
|
21
23
|
spacing = `${display.includes("flex-col") ? "" : "space-x-1"}`;
|
|
@@ -22,6 +22,8 @@ declare const __propDef: {
|
|
|
22
22
|
color?: string | undefined;
|
|
23
23
|
/** Provide classes to set the highlighted SVG fill color.*/
|
|
24
24
|
fill?: string | undefined;
|
|
25
|
+
/** Provide classes for the label region.*/
|
|
26
|
+
regionLabel?: string | undefined;
|
|
25
27
|
/** Provide the ARIA labelledby value.*/
|
|
26
28
|
labelledby?: string | undefined;
|
|
27
29
|
};
|
|
@@ -10,7 +10,9 @@ export let active = getContext("active");
|
|
|
10
10
|
export let hover = getContext("hover");
|
|
11
11
|
export let color = getContext("color");
|
|
12
12
|
export let fill = getContext("fill");
|
|
13
|
-
|
|
13
|
+
export let regionLabel = getContext("regionLabel");
|
|
14
|
+
const cBase = "flex-auto";
|
|
15
|
+
const cWrapper = "text-base text-center cursor-pointer";
|
|
14
16
|
const cDisabled = "opacity-50 cursor-not-allowed";
|
|
15
17
|
let elemInput;
|
|
16
18
|
function onKeyDown(event) {
|
|
@@ -26,17 +28,19 @@ $:
|
|
|
26
28
|
$:
|
|
27
29
|
classesDisabled = $$props.disabled ? cDisabled : "";
|
|
28
30
|
$:
|
|
29
|
-
|
|
31
|
+
classsBase = `${cBase}`;
|
|
32
|
+
$:
|
|
33
|
+
classesWrapper = `${cWrapper} ${padding} ${rounded} ${classesActive} ${classesDisabled} ${$$props.class ?? ""}`;
|
|
30
34
|
function prunedRestProps() {
|
|
31
35
|
delete $$restProps.class;
|
|
32
36
|
return $$restProps;
|
|
33
37
|
}
|
|
34
38
|
</script>
|
|
35
39
|
|
|
36
|
-
<label>
|
|
40
|
+
<label class="radio-label {classsBase} {regionLabel}">
|
|
37
41
|
<!-- A11y attributes are not allowed on <label> -->
|
|
38
42
|
<div
|
|
39
|
-
class="radio-item {
|
|
43
|
+
class="radio-item {classesWrapper}"
|
|
40
44
|
data-testid="radio-item"
|
|
41
45
|
role="radio"
|
|
42
46
|
aria-checked={checked}
|
|
@@ -26,7 +26,7 @@ $:
|
|
|
26
26
|
|
|
27
27
|
<div class="ratings {classesBase}" data-testid="rating-bar">
|
|
28
28
|
<!-- eslint-disable-next-line @typescript-eslint/no-unused-vars -->
|
|
29
|
-
{#each
|
|
29
|
+
{#each { length: max } as _, i}
|
|
30
30
|
{#if interactive}
|
|
31
31
|
<button class="rating-icon {regionIcon}" type="button" on:click={() => iconClick(i)}>
|
|
32
32
|
{#if isFull(value, i)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Reference: https://dribbble.com/shots/16221169-Figma-Material-Ui-components-Steppers-and-sliders -->
|
|
2
2
|
<script>import { getContext, onDestroy } from "svelte";
|
|
3
|
-
import {
|
|
3
|
+
import { dynamicTransition } from "../../internal/transitions.js";
|
|
4
4
|
export let locked = false;
|
|
5
5
|
export let regionHeader = "";
|
|
6
6
|
export let regionContent = "";
|
|
@@ -19,6 +19,11 @@ export let buttonNextLabel = getContext("buttonNextLabel");
|
|
|
19
19
|
export let buttonComplete = getContext("buttonComplete");
|
|
20
20
|
export let buttonCompleteType = getContext("buttonCompleteType");
|
|
21
21
|
export let buttonCompleteLabel = getContext("buttonCompleteLabel");
|
|
22
|
+
export let transitions = getContext("transitions");
|
|
23
|
+
export let transitionIn = getContext("transitionIn");
|
|
24
|
+
export let transitionInParams = getContext("transitionInParams");
|
|
25
|
+
export let transitionOut = getContext("transitionOut");
|
|
26
|
+
export let transitionOutParams = getContext("transitionOutParams");
|
|
22
27
|
const stepIndex = $state.total;
|
|
23
28
|
$state.total++;
|
|
24
29
|
const cBase = "space-y-4";
|
|
@@ -66,7 +71,11 @@ onDestroy(() => {
|
|
|
66
71
|
</div>
|
|
67
72
|
<!-- Navigation -->
|
|
68
73
|
{#if $state.total > 1}
|
|
69
|
-
<div
|
|
74
|
+
<div
|
|
75
|
+
class="step-navigation {classesNavigation}"
|
|
76
|
+
in:dynamicTransition|local={{ transition: transitionIn, params: transitionInParams, enabled: transitions }}
|
|
77
|
+
out:dynamicTransition|local={{ transition: transitionOut, params: transitionOutParams, enabled: transitions }}
|
|
78
|
+
>
|
|
70
79
|
{#if stepIndex === 0 && $$slots.navigation}
|
|
71
80
|
<!-- Slot: Navigation -->
|
|
72
81
|
<div class="step-navigation-slot">
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { Writable } from 'svelte/store';
|
|
3
3
|
import type { StepperEventDispatcher, StepperState } from './types.js';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import type { Transition, TransitionParams } from '../../index.js';
|
|
5
|
+
declare class __sveltets_Render<TransitionIn extends Transition, TransitionOut extends Transition> {
|
|
6
|
+
props(): {
|
|
6
7
|
[x: string]: any;
|
|
7
8
|
locked?: boolean | undefined;
|
|
8
|
-
/** Provide arbitrary classes to the step header region.*/
|
|
9
9
|
regionHeader?: string | undefined;
|
|
10
|
-
/** Provide arbitrary classes to the step content region.*/
|
|
11
10
|
regionContent?: string | undefined;
|
|
12
|
-
/** Provide arbitrary classes to the step navigation region.*/
|
|
13
11
|
regionNavigation?: string | undefined;
|
|
14
12
|
state?: Writable<StepperState> | undefined;
|
|
15
13
|
dispatchParent?: StepperEventDispatcher | undefined;
|
|
@@ -25,19 +23,24 @@ declare const __propDef: {
|
|
|
25
23
|
buttonComplete?: string | undefined;
|
|
26
24
|
buttonCompleteType?: "button" | "reset" | "submit" | undefined;
|
|
27
25
|
buttonCompleteLabel?: string | undefined;
|
|
26
|
+
transitions?: boolean | undefined;
|
|
27
|
+
transitionIn?: TransitionIn | undefined;
|
|
28
|
+
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
29
|
+
transitionOut?: TransitionOut | undefined;
|
|
30
|
+
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
28
31
|
};
|
|
29
|
-
events: {
|
|
32
|
+
events(): {} & {
|
|
30
33
|
[evt: string]: CustomEvent<any>;
|
|
31
34
|
};
|
|
32
|
-
slots: {
|
|
35
|
+
slots(): {
|
|
33
36
|
header: {};
|
|
34
37
|
default: {};
|
|
35
38
|
navigation: {};
|
|
36
39
|
};
|
|
37
|
-
}
|
|
38
|
-
export type StepProps =
|
|
39
|
-
export type StepEvents =
|
|
40
|
-
export type StepSlots =
|
|
41
|
-
export default class Step extends SvelteComponentTyped<StepProps, StepEvents, StepSlots
|
|
40
|
+
}
|
|
41
|
+
export type StepProps<TransitionIn extends Transition, TransitionOut extends Transition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['props']>;
|
|
42
|
+
export type StepEvents<TransitionIn extends Transition, TransitionOut extends Transition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['events']>;
|
|
43
|
+
export type StepSlots<TransitionIn extends Transition, TransitionOut extends Transition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['slots']>;
|
|
44
|
+
export default class Step<TransitionIn extends Transition, TransitionOut extends Transition> extends SvelteComponentTyped<StepProps<TransitionIn, TransitionOut>, StepEvents<TransitionIn, TransitionOut>, StepSlots<TransitionIn, TransitionOut>> {
|
|
42
45
|
}
|
|
43
46
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script context="module">import { fade } from "svelte/transition";
|
|
2
|
+
import { prefersReducedMotionStore } from "../../index.js";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script generics="TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition">import { createEventDispatcher, setContext } from "svelte";
|
|
2
6
|
import { writable } from "svelte/store";
|
|
3
|
-
import {
|
|
7
|
+
import { dynamicTransition } from "../../internal/transitions.js";
|
|
4
8
|
const dispatch = createEventDispatcher();
|
|
5
9
|
export let gap = "gap-4";
|
|
6
10
|
export let stepTerm = "Step";
|
|
@@ -20,6 +24,11 @@ export let buttonCompleteType = "button";
|
|
|
20
24
|
export let buttonCompleteLabel = "Complete";
|
|
21
25
|
export let regionHeader = "";
|
|
22
26
|
export let regionContent = "";
|
|
27
|
+
export let transitions = !$prefersReducedMotionStore;
|
|
28
|
+
export let transitionIn = fade;
|
|
29
|
+
export let transitionInParams = { duration: 100 };
|
|
30
|
+
export let transitionOut = fade;
|
|
31
|
+
export let transitionOutParams = { duration: 100 };
|
|
23
32
|
let state = writable({ current: start, total: 0 });
|
|
24
33
|
setContext("state", state);
|
|
25
34
|
setContext("dispatchParent", dispatch);
|
|
@@ -35,6 +44,11 @@ setContext("buttonNextLabel", buttonNextLabel);
|
|
|
35
44
|
setContext("buttonComplete", buttonComplete);
|
|
36
45
|
setContext("buttonCompleteType", buttonCompleteType);
|
|
37
46
|
setContext("buttonCompleteLabel", buttonCompleteLabel);
|
|
47
|
+
setContext("transitions", transitions);
|
|
48
|
+
setContext("transitionIn", transitionIn);
|
|
49
|
+
setContext("transitionInParams", transitionInParams);
|
|
50
|
+
setContext("transitionOut", transitionOut);
|
|
51
|
+
setContext("transitionOutParams", transitionOutParams);
|
|
38
52
|
const cBase = "space-y-4";
|
|
39
53
|
const cHeader = "flex items-center border-t mt-[15px]";
|
|
40
54
|
const cHeaderStep = "-mt-[15px] transition-all duration-300";
|
|
@@ -56,7 +70,11 @@ $:
|
|
|
56
70
|
<div class="stepper {classesBase}" data-testid="stepper">
|
|
57
71
|
<!-- Header -->
|
|
58
72
|
{#if $state.total}
|
|
59
|
-
<header
|
|
73
|
+
<header
|
|
74
|
+
class="stepper-header {classesHeader}"
|
|
75
|
+
in:dynamicTransition|local={{ transition: transitionIn, params: transitionInParams, enabled: transitions }}
|
|
76
|
+
out:dynamicTransition|local={{ transition: transitionOut, params: transitionOutParams, enabled: transitions }}
|
|
77
|
+
>
|
|
60
78
|
{#each Array.from(Array($state.total).keys()) as step}
|
|
61
79
|
<div class="stepper-header-step {classesHeaderStep}" class:flex-1={isActive(step)}>
|
|
62
80
|
<span class="badge {classesBadge(step)}">{isActive(step) ? `${stepTerm} ${step + 1}` : step + 1}</span>
|
|
@@ -1,46 +1,36 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { fade } from 'svelte/transition';
|
|
3
|
+
import { type Transition, type TransitionParams } from '../../index.js';
|
|
4
|
+
type FadeTransition = typeof fade;
|
|
2
5
|
import type { StepperButton, StepperState } from './types.js';
|
|
3
|
-
declare
|
|
4
|
-
props: {
|
|
6
|
+
declare class __sveltets_Render<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> {
|
|
7
|
+
props(): {
|
|
5
8
|
[x: string]: any;
|
|
6
|
-
/** Provide classes to style the stepper header gap.*/
|
|
7
9
|
gap?: string | undefined;
|
|
8
|
-
/** Provide the verbiage that represents "Step".*/
|
|
9
10
|
stepTerm?: string | undefined;
|
|
10
|
-
/** Provide classes to style the stepper header badges.*/
|
|
11
11
|
badge?: string | undefined;
|
|
12
|
-
/** Provide classes to style the stepper header active step badge.*/
|
|
13
12
|
active?: string | undefined;
|
|
14
|
-
/** Provide classes to style the stepper header border.*/
|
|
15
13
|
border?: string | undefined;
|
|
16
|
-
/** Provide the initially selected step*/
|
|
17
14
|
start?: number | undefined;
|
|
18
|
-
/** Set the justification for the step navigation buttons.*/
|
|
19
15
|
justify?: string | undefined;
|
|
20
|
-
/** Provide arbitrary classes to style the back button.*/
|
|
21
16
|
buttonBack?: string | undefined;
|
|
22
|
-
/** Set the type of the back button.*/
|
|
23
17
|
buttonBackType?: StepperButton | undefined;
|
|
24
|
-
/** Provide the HTML label content for the back button.*/
|
|
25
18
|
buttonBackLabel?: string | undefined;
|
|
26
|
-
/** Provide arbitrary classes to style the next button.*/
|
|
27
19
|
buttonNext?: string | undefined;
|
|
28
|
-
/** Set the type of the next button.*/
|
|
29
20
|
buttonNextType?: StepperButton | undefined;
|
|
30
|
-
/** Provide the HTML label content for the next button.*/
|
|
31
21
|
buttonNextLabel?: string | undefined;
|
|
32
|
-
/** Provide arbitrary classes to style the complete button.*/
|
|
33
22
|
buttonComplete?: string | undefined;
|
|
34
|
-
/** Set the type of the complete button.*/
|
|
35
23
|
buttonCompleteType?: StepperButton | undefined;
|
|
36
|
-
/** Provide the HTML label content for the complete button.*/
|
|
37
24
|
buttonCompleteLabel?: string | undefined;
|
|
38
|
-
/** Provide arbitrary classes to the stepper header region.*/
|
|
39
25
|
regionHeader?: string | undefined;
|
|
40
|
-
/** Provide arbitrary classes to the stepper content region.*/
|
|
41
26
|
regionContent?: string | undefined;
|
|
27
|
+
transitions?: boolean | undefined;
|
|
28
|
+
transitionIn?: TransitionIn | undefined;
|
|
29
|
+
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
30
|
+
transitionOut?: TransitionOut | undefined;
|
|
31
|
+
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
42
32
|
};
|
|
43
|
-
events: {
|
|
33
|
+
events(): {
|
|
44
34
|
next: CustomEvent<{
|
|
45
35
|
step: number;
|
|
46
36
|
state: StepperState;
|
|
@@ -60,13 +50,13 @@ declare const __propDef: {
|
|
|
60
50
|
} & {
|
|
61
51
|
[evt: string]: CustomEvent<any>;
|
|
62
52
|
};
|
|
63
|
-
slots: {
|
|
53
|
+
slots(): {
|
|
64
54
|
default: {};
|
|
65
55
|
};
|
|
66
|
-
}
|
|
67
|
-
export type StepperProps =
|
|
68
|
-
export type StepperEvents =
|
|
69
|
-
export type StepperSlots =
|
|
70
|
-
export default class Stepper extends SvelteComponentTyped<StepperProps, StepperEvents, StepperSlots
|
|
56
|
+
}
|
|
57
|
+
export type StepperProps<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['props']>;
|
|
58
|
+
export type StepperEvents<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['events']>;
|
|
59
|
+
export type StepperSlots<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['slots']>;
|
|
60
|
+
export default class Stepper<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> extends SvelteComponentTyped<StepperProps<TransitionIn, TransitionOut>, StepperEvents<TransitionIn, TransitionOut>, StepperSlots<TransitionIn, TransitionOut>> {
|
|
71
61
|
}
|
|
72
62
|
export {};
|
|
@@ -28,7 +28,7 @@ $:
|
|
|
28
28
|
classesPanel = `${cPanel} ${regionPanel}`;
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
|
-
<!--
|
|
31
|
+
<!-- FIXME: resolve a11y warnings -->
|
|
32
32
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
33
33
|
<div class="tab-group {classesBase}" data-testid="tab-group" on:click on:keypress on:keydown on:keyup>
|
|
34
34
|
<!-- Tab List -->
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<script>import { setContext } from "svelte";
|
|
2
|
+
import TreeViewDataDrivenItem from "./TreeViewDataDrivenItem.svelte";
|
|
3
|
+
export let selection = false;
|
|
4
|
+
export let multiple = false;
|
|
5
|
+
export let nodes = [];
|
|
2
6
|
export let width = "w-full";
|
|
3
7
|
export let spacing = "space-y-1";
|
|
8
|
+
export let open = false;
|
|
9
|
+
export let disabled = false;
|
|
4
10
|
export let padding = "py-4 px-4";
|
|
5
11
|
export let indent = "ml-4";
|
|
6
12
|
export let hover = "hover:variant-soft";
|
|
@@ -12,6 +18,56 @@ export let regionSummary = "";
|
|
|
12
18
|
export let regionSymbol = "";
|
|
13
19
|
export let regionChildren = "";
|
|
14
20
|
export let labelledby = "";
|
|
21
|
+
export function expandAll() {
|
|
22
|
+
const detailsElements = [...tree.querySelectorAll("details.tree-item")];
|
|
23
|
+
detailsElements.forEach((details) => {
|
|
24
|
+
if (!details.open) {
|
|
25
|
+
const summary = details.querySelector("summary.tree-item-summary");
|
|
26
|
+
if (summary)
|
|
27
|
+
summary.click();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export function collapseAll() {
|
|
32
|
+
const detailsElements = [...tree.querySelectorAll("details.tree-item")];
|
|
33
|
+
detailsElements.forEach((details) => {
|
|
34
|
+
if (details.open) {
|
|
35
|
+
const summary = details.querySelector("summary.tree-item-summary");
|
|
36
|
+
if (summary)
|
|
37
|
+
summary.click();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export function selectAll() {
|
|
42
|
+
const detailsElements = [...tree.querySelectorAll("details.tree-item")];
|
|
43
|
+
detailsElements.forEach((details) => {
|
|
44
|
+
const input = details.querySelector('input[type="checkbox"].tree-item-checkbox');
|
|
45
|
+
if (!input)
|
|
46
|
+
return;
|
|
47
|
+
if (!input.checked) {
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
input.click();
|
|
50
|
+
}, 5);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export function deselectAll() {
|
|
55
|
+
const detailsElements = [...tree.querySelectorAll("details.tree-item")];
|
|
56
|
+
detailsElements.forEach((details) => {
|
|
57
|
+
const input = details.querySelector('input[type="checkbox"].tree-item-checkbox');
|
|
58
|
+
if (!input)
|
|
59
|
+
return;
|
|
60
|
+
if (input.checked) {
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
input.click();
|
|
63
|
+
}, 5);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
setContext("open", open);
|
|
68
|
+
setContext("selection", selection);
|
|
69
|
+
setContext("multiple", multiple);
|
|
70
|
+
setContext("disabled", disabled);
|
|
15
71
|
setContext("padding", padding);
|
|
16
72
|
setContext("indent", indent);
|
|
17
73
|
setContext("hover", hover);
|
|
@@ -24,8 +80,21 @@ setContext("regionSymbol", regionSymbol);
|
|
|
24
80
|
setContext("regionChildren", regionChildren);
|
|
25
81
|
$:
|
|
26
82
|
classesBase = `${width} ${spacing} ${$$props.class ?? ""}`;
|
|
83
|
+
let tree;
|
|
27
84
|
</script>
|
|
28
85
|
|
|
29
|
-
<div
|
|
30
|
-
|
|
86
|
+
<div
|
|
87
|
+
bind:this={tree}
|
|
88
|
+
class="tree {classesBase}"
|
|
89
|
+
data-testid="tree"
|
|
90
|
+
role="tree"
|
|
91
|
+
aria-multiselectable={multiple}
|
|
92
|
+
aria-label={labelledby}
|
|
93
|
+
aria-disabled={disabled}
|
|
94
|
+
>
|
|
95
|
+
{#if nodes && nodes.length > 0}
|
|
96
|
+
<TreeViewDataDrivenItem bind:nodes />
|
|
97
|
+
{:else}
|
|
98
|
+
<slot />
|
|
99
|
+
{/if}
|
|
31
100
|
</div>
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { TreeViewNode } from '../../index.js';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
[x: string]: any;
|
|
6
|
+
/** Enable tree-view selection.*/
|
|
7
|
+
selection?: boolean | undefined;
|
|
8
|
+
/** Enable selection of multiple items.*/
|
|
9
|
+
multiple?: boolean | undefined;
|
|
10
|
+
/** Provide data-driven nodes.*/
|
|
11
|
+
nodes?: TreeViewNode[] | undefined;
|
|
5
12
|
/** Provide classes to set the tree width.*/
|
|
6
13
|
width?: string | undefined;
|
|
7
14
|
/** Provide classes to set the vertical spacing between items.*/
|
|
8
15
|
spacing?: string | undefined;
|
|
16
|
+
/** Set open by default on load.*/
|
|
17
|
+
open?: boolean | undefined;
|
|
18
|
+
/** Set the tree disabled state*/
|
|
19
|
+
disabled?: boolean | undefined;
|
|
9
20
|
/** Provide classes to set the tree item padding styles.*/
|
|
10
21
|
padding?: string | undefined;
|
|
11
22
|
/** Provide classes to set the tree children indentation*/
|
|
@@ -27,6 +38,10 @@ declare const __propDef: {
|
|
|
27
38
|
regionChildren?: string | undefined;
|
|
28
39
|
/** Provide the ARIA labelledby value.*/
|
|
29
40
|
labelledby?: string | undefined;
|
|
41
|
+
expandAll?: (() => void) | undefined;
|
|
42
|
+
collapseAll?: (() => void) | undefined;
|
|
43
|
+
selectAll?: (() => void) | undefined;
|
|
44
|
+
deselectAll?: (() => void) | undefined;
|
|
30
45
|
};
|
|
31
46
|
events: {
|
|
32
47
|
[evt: string]: CustomEvent<any>;
|
|
@@ -39,5 +54,9 @@ export type TreeViewProps = typeof __propDef.props;
|
|
|
39
54
|
export type TreeViewEvents = typeof __propDef.events;
|
|
40
55
|
export type TreeViewSlots = typeof __propDef.slots;
|
|
41
56
|
export default class TreeView extends SvelteComponentTyped<TreeViewProps, TreeViewEvents, TreeViewSlots> {
|
|
57
|
+
get expandAll(): () => void;
|
|
58
|
+
get collapseAll(): () => void;
|
|
59
|
+
get selectAll(): () => void;
|
|
60
|
+
get deselectAll(): () => void;
|
|
42
61
|
}
|
|
43
62
|
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script>import { createEventDispatcher, getContext, onMount } from "svelte";
|
|
2
|
+
import TreeViewDataDrivenItem from "./TreeViewDataDrivenItem.svelte";
|
|
3
|
+
import TreeViewItem from "./TreeViewItem.svelte";
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
5
|
+
export let nodes = [];
|
|
6
|
+
export let selection = getContext("selection");
|
|
7
|
+
export let multiple = getContext("multiple");
|
|
8
|
+
let group;
|
|
9
|
+
let name = "";
|
|
10
|
+
onMount(() => {
|
|
11
|
+
name = String(Math.random());
|
|
12
|
+
if (selection) {
|
|
13
|
+
group = multiple ? [] : "";
|
|
14
|
+
nodes.forEach((node) => {
|
|
15
|
+
if (!node.checked)
|
|
16
|
+
return;
|
|
17
|
+
if (multiple) {
|
|
18
|
+
if (!Array.isArray(group))
|
|
19
|
+
return;
|
|
20
|
+
group.push(node.value);
|
|
21
|
+
} else {
|
|
22
|
+
group = node.value;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
function onCheckChange() {
|
|
28
|
+
nodes.forEach((node) => {
|
|
29
|
+
if (multiple) {
|
|
30
|
+
if (!Array.isArray(group))
|
|
31
|
+
return;
|
|
32
|
+
node.checked = group.includes(node.value);
|
|
33
|
+
} else {
|
|
34
|
+
node.checked = group === node.value;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
nodes = nodes;
|
|
38
|
+
dispatch("change");
|
|
39
|
+
}
|
|
40
|
+
export let parents = [];
|
|
41
|
+
let children = [];
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
{#if nodes && nodes.length > 0}
|
|
45
|
+
{#each nodes as node, i}
|
|
46
|
+
<TreeViewItem
|
|
47
|
+
bind:this={parents[i]}
|
|
48
|
+
bind:open={node.open}
|
|
49
|
+
hideLead={!node.lead}
|
|
50
|
+
hideChildren={!node.children || node.children.length === 0}
|
|
51
|
+
bind:disabled={node.disabled}
|
|
52
|
+
bind:group
|
|
53
|
+
bind:name
|
|
54
|
+
bind:indeterminate={node.indeterminate}
|
|
55
|
+
bind:value={node.value}
|
|
56
|
+
bind:children={children[i]}
|
|
57
|
+
on:change={onCheckChange}
|
|
58
|
+
on:click
|
|
59
|
+
on:toggle
|
|
60
|
+
>
|
|
61
|
+
{@html node.content}
|
|
62
|
+
<svelte:fragment slot="lead">
|
|
63
|
+
{@html node.lead}
|
|
64
|
+
</svelte:fragment>
|
|
65
|
+
<svelte:fragment slot="children">
|
|
66
|
+
<TreeViewDataDrivenItem nodes={node.children} on:change={onCheckChange} bind:parents={children[i]} />
|
|
67
|
+
</svelte:fragment>
|
|
68
|
+
</TreeViewItem>
|
|
69
|
+
{/each}
|
|
70
|
+
{/if}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import TreeViewItem from './TreeViewItem.svelte';
|
|
3
|
+
import type { TreeViewNode } from './types.js';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
/** Provide data-driven nodes. */ nodes?: TreeViewNode[] | undefined;
|
|
7
|
+
/** Enable tree-view selection */ selection?: boolean | undefined;
|
|
8
|
+
/** Enable selection of multiple items. */ multiple?: boolean | undefined;
|
|
9
|
+
parents?: TreeViewItem[] | undefined;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
click: MouseEvent;
|
|
13
|
+
toggle: CustomEvent<any>;
|
|
14
|
+
change: CustomEvent<any>;
|
|
15
|
+
} & {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
};
|
|
18
|
+
slots: {};
|
|
19
|
+
};
|
|
20
|
+
export type TreeViewDataDrivenItemProps = typeof __propDef.props;
|
|
21
|
+
export type TreeViewDataDrivenItemEvents = typeof __propDef.events;
|
|
22
|
+
export type TreeViewDataDrivenItemSlots = typeof __propDef.slots;
|
|
23
|
+
export default class TreeViewDataDrivenItem extends SvelteComponentTyped<TreeViewDataDrivenItemProps, TreeViewDataDrivenItemEvents, TreeViewDataDrivenItemSlots> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|