@skeletonlabs/skeleton 2.1.0 → 2.2.0-dev.2457bc93
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/actions/Clipboard/clipboard.d.ts +1 -1
- package/dist/actions/Clipboard/clipboard.js +4 -0
- package/dist/actions/FocusTrap/focusTrap.js +1 -1
- package/dist/components/Accordion/Accordion.svelte.d.ts +17 -0
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +18 -0
- package/dist/components/AppShell/AppShell.svelte +1 -1
- package/dist/components/Autocomplete/Autocomplete.svelte +6 -2
- package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +26 -10
- package/dist/components/Autocomplete/types.d.ts +5 -5
- package/dist/components/InputChip/InputChip.svelte.d.ts +25 -0
- package/dist/components/Stepper/Step.svelte +1 -1
- package/dist/components/Stepper/Step.svelte.d.ts +8 -0
- package/dist/components/Stepper/Stepper.svelte.d.ts +23 -0
- package/dist/components/TreeView/RecursiveTreeView.svelte +56 -0
- package/dist/components/TreeView/RecursiveTreeView.svelte.d.ts +62 -0
- package/dist/components/TreeView/RecursiveTreeViewItem.svelte +114 -0
- package/dist/components/TreeView/RecursiveTreeViewItem.svelte.d.ts +35 -0
- package/dist/components/TreeView/TreeView.svelte +1 -7
- package/dist/components/TreeView/TreeView.svelte.d.ts +0 -9
- package/dist/components/TreeView/TreeViewItem.svelte +51 -14
- package/dist/components/TreeView/TreeViewItem.svelte.d.ts +5 -1
- package/dist/components/TreeView/types.d.ts +2 -8
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/utilities/CodeBlock/CodeBlock.svelte +2 -0
- package/dist/utilities/Modal/Modal.svelte +6 -4
- package/dist/utilities/Modal/Modal.svelte.d.ts +24 -0
- package/dist/utilities/Toast/Toast.svelte.d.ts +18 -0
- package/package.json +1 -1
- package/dist/components/TreeView/TreeViewDataDrivenItem.svelte +0 -90
- package/dist/components/TreeView/TreeViewDataDrivenItem.svelte.d.ts +0 -27
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export function clipboard(node, args) {
|
|
2
|
+
if (!window.isSecureContext) {
|
|
3
|
+
console.error('Clipboard action failed: app not running in secure context, see: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard');
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
2
6
|
const fireCopyCompleteEvent = () => {
|
|
3
7
|
node.dispatchEvent(new CustomEvent('copyComplete'));
|
|
4
8
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Action: Focus Trap
|
|
2
2
|
export function focusTrap(node, enabled) {
|
|
3
|
-
const elemWhitelist = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])';
|
|
3
|
+
const elemWhitelist = 'a[href]:not([tabindex="-1"]), button:not([tabindex="-1"]), input:not([tabindex="-1"]), textarea:not([tabindex="-1"]), select:not([tabindex="-1"]), details:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])';
|
|
4
4
|
let elemFirst;
|
|
5
5
|
let elemLast;
|
|
6
6
|
// When the first element is selected, shift+tab pressed, jump to the last selectable item.
|
|
@@ -5,22 +5,39 @@ type SlideTransition = typeof slide;
|
|
|
5
5
|
declare class __sveltets_Render<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> {
|
|
6
6
|
props(): {
|
|
7
7
|
[x: string]: any;
|
|
8
|
+
/** Set the auto-collapse mode.*/
|
|
8
9
|
autocollapse?: boolean | undefined;
|
|
10
|
+
/** Provide classes to set the accordion width.*/
|
|
9
11
|
width?: string | undefined;
|
|
12
|
+
/** Provide classes to set the vertical spacing between items.*/
|
|
10
13
|
spacing?: string | undefined;
|
|
14
|
+
/** Set the accordion disabled state for all items.*/
|
|
11
15
|
disabled?: boolean | undefined;
|
|
16
|
+
/** Provide classes to set the accordion item padding styles.*/
|
|
12
17
|
padding?: string | undefined;
|
|
18
|
+
/** Provide classes to set the accordion item hover styles.*/
|
|
13
19
|
hover?: string | undefined;
|
|
20
|
+
/** Provide classes to set the accordion item rounded styles.*/
|
|
14
21
|
rounded?: string | undefined;
|
|
22
|
+
/** Set the rotation of the item caret in the open state.*/
|
|
15
23
|
caretOpen?: string | undefined;
|
|
24
|
+
/** Set the rotation of the item caret in the closed state.*/
|
|
16
25
|
caretClosed?: string | undefined;
|
|
26
|
+
/** Provide arbitrary classes to the trigger button region.*/
|
|
17
27
|
regionControl?: string | undefined;
|
|
28
|
+
/** Provide arbitrary classes to the content panel region.*/
|
|
18
29
|
regionPanel?: string | undefined;
|
|
30
|
+
/** Provide arbitrary classes to the caret icon region.*/
|
|
19
31
|
regionCaret?: string | undefined;
|
|
32
|
+
/** Enable/Disable transitions*/
|
|
20
33
|
transitions?: boolean | undefined;
|
|
34
|
+
/** Provide the transition to used on entry.*/
|
|
21
35
|
transitionIn?: TransitionIn | undefined;
|
|
36
|
+
/** Transition params provided to `transitionIn`.*/
|
|
22
37
|
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
38
|
+
/** Provide the transition to used on exit.*/
|
|
23
39
|
transitionOut?: TransitionOut | undefined;
|
|
40
|
+
/** Transition params provided to `transitionOut`.*/
|
|
24
41
|
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
25
42
|
};
|
|
26
43
|
events(): {} & {
|
|
@@ -4,23 +4,41 @@ import type { Transition, TransitionParams } from '../../index.js';
|
|
|
4
4
|
declare class __sveltets_Render<TransitionIn extends Transition, TransitionOut extends Transition> {
|
|
5
5
|
props(): {
|
|
6
6
|
[x: string]: any;
|
|
7
|
+
/** Set open by default on load.*/
|
|
7
8
|
open?: boolean | undefined;
|
|
9
|
+
/** Provide a unique input id. Auto-generated by default*/
|
|
8
10
|
id?: string | undefined;
|
|
11
|
+
/** Set the auto-collapse mode.*/
|
|
9
12
|
autocollapse?: boolean | undefined;
|
|
13
|
+
/** The writable store that houses the auto-collapse active item UUID.*/
|
|
10
14
|
active?: Writable<string | null> | undefined;
|
|
15
|
+
/** Set the disabled state for this item.*/
|
|
11
16
|
disabled?: boolean | undefined;
|
|
17
|
+
/** Provide classes to set the accordion item padding styles.*/
|
|
12
18
|
padding?: string | undefined;
|
|
19
|
+
/** Provide classes to set the accordion item hover styles.*/
|
|
13
20
|
hover?: string | undefined;
|
|
21
|
+
/** Provide classes to set the accordion item rounded styles.*/
|
|
14
22
|
rounded?: string | undefined;
|
|
23
|
+
/** Provide arbitrary classes to the trigger button region.*/
|
|
15
24
|
caretOpen?: string | undefined;
|
|
25
|
+
/** Provide arbitrary classes to content panel region.*/
|
|
16
26
|
caretClosed?: string | undefined;
|
|
27
|
+
/** Provide arbitrary classes to the trigger button region.*/
|
|
17
28
|
regionControl?: string | undefined;
|
|
29
|
+
/** Provide arbitrary classes to content panel region.*/
|
|
18
30
|
regionPanel?: string | undefined;
|
|
31
|
+
/** Provide arbitrary classes caret icon region.*/
|
|
19
32
|
regionCaret?: string | undefined;
|
|
33
|
+
/** Enable/Disable transitions*/
|
|
20
34
|
transitions?: boolean | undefined;
|
|
35
|
+
/** Provide the transition to used on entry.*/
|
|
21
36
|
transitionIn?: TransitionIn | undefined;
|
|
37
|
+
/** Transition params provided to `transitionIn`.*/
|
|
22
38
|
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
39
|
+
/** Provide the transition to used on exit.*/
|
|
23
40
|
transitionOut?: TransitionOut | undefined;
|
|
41
|
+
/** Transition params provided to `transitionOut`.*/
|
|
24
42
|
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
25
43
|
};
|
|
26
44
|
events(): {
|
|
@@ -44,7 +44,7 @@ $:
|
|
|
44
44
|
{/if}
|
|
45
45
|
|
|
46
46
|
<!-- Page -->
|
|
47
|
-
<div id="page" class="{regionPage} {cPage}" style:scrollbarGutter on:scroll>
|
|
47
|
+
<div id="page" class="{regionPage} {cPage}" style:scrollbar-gutter={scrollbarGutter} on:scroll>
|
|
48
48
|
<!-- Slot: Page Header -->
|
|
49
49
|
{#if $$slots.pageHeader}
|
|
50
50
|
<header id="page-header" class="flex-none {classesPageHeader}"><slot name="pageHeader">(slot:header)</slot></header>
|
|
@@ -3,7 +3,11 @@ import { prefersReducedMotionStore } from "../../index.js";
|
|
|
3
3
|
import { dynamicTransition } from "../../internal/transitions.js";
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
<script
|
|
6
|
+
<script
|
|
7
|
+
|
|
8
|
+
generics="Value = unknown, Meta = unknown,
|
|
9
|
+
TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition"
|
|
10
|
+
>import { createEventDispatcher } from "svelte";
|
|
7
11
|
const dispatch = createEventDispatcher();
|
|
8
12
|
export let input = void 0;
|
|
9
13
|
export let options = [];
|
|
@@ -54,7 +58,7 @@ $:
|
|
|
54
58
|
$:
|
|
55
59
|
optionsFiltered = input ? filterOptions() : listedOptions;
|
|
56
60
|
$:
|
|
57
|
-
sliceLimit = limit
|
|
61
|
+
sliceLimit = limit ?? optionsFiltered.length;
|
|
58
62
|
$:
|
|
59
63
|
classesBase = `${$$props.class ?? ""}`;
|
|
60
64
|
$:
|
|
@@ -3,38 +3,54 @@ import { slide } from 'svelte/transition';
|
|
|
3
3
|
import { type Transition, type TransitionParams } from '../../index.js';
|
|
4
4
|
type SlideTransition = typeof slide;
|
|
5
5
|
import type { AutocompleteOption } from './types.js';
|
|
6
|
-
declare class __sveltets_Render<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> {
|
|
6
|
+
declare class __sveltets_Render<Value = unknown, Meta = unknown, TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> {
|
|
7
7
|
props(): {
|
|
8
8
|
[x: string]: any;
|
|
9
|
-
input
|
|
10
|
-
|
|
9
|
+
/** Bind the input value.*/
|
|
10
|
+
input?: Value | undefined;
|
|
11
|
+
/** Define values for the list.*/
|
|
12
|
+
options?: AutocompleteOption<Value, Meta>[] | undefined;
|
|
13
|
+
/** Limit the total number of suggestions.*/
|
|
11
14
|
limit?: number | undefined;
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
/** Provide allowlist values.*/
|
|
16
|
+
allowlist?: Value[] | undefined;
|
|
17
|
+
/** Provide denylist values.*/
|
|
18
|
+
denylist?: Value[] | undefined;
|
|
19
|
+
/** Provide a HTML markup to display when no match is found.*/
|
|
14
20
|
emptyState?: string | undefined;
|
|
21
|
+
/** Provide arbitrary classes to nav element.*/
|
|
15
22
|
regionNav?: string | undefined;
|
|
23
|
+
/** Provide arbitrary classes to each list.*/
|
|
16
24
|
regionList?: string | undefined;
|
|
25
|
+
/** Provide arbitrary classes to each list item.*/
|
|
17
26
|
regionItem?: string | undefined;
|
|
27
|
+
/** Provide arbitrary classes to each button.*/
|
|
18
28
|
regionButton?: string | undefined;
|
|
29
|
+
/** Provide arbitrary classes to empty message.*/
|
|
19
30
|
regionEmpty?: string | undefined;
|
|
31
|
+
/** Enable/Disable transitions*/
|
|
20
32
|
transitions?: boolean | undefined;
|
|
33
|
+
/** Provide the transition used on entry.*/
|
|
21
34
|
transitionIn?: TransitionIn | undefined;
|
|
35
|
+
/** Transition params provided to `transitionIn`.*/
|
|
22
36
|
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
37
|
+
/** Provide the transition used on exit.*/
|
|
23
38
|
transitionOut?: TransitionOut | undefined;
|
|
39
|
+
/** Transition params provided to `transitionOut`.*/
|
|
24
40
|
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
25
41
|
};
|
|
26
42
|
events(): {
|
|
27
43
|
click: MouseEvent;
|
|
28
44
|
keypress: KeyboardEvent;
|
|
29
|
-
selection: CustomEvent<AutocompleteOption
|
|
45
|
+
selection: CustomEvent<AutocompleteOption<Value, Meta>>;
|
|
30
46
|
} & {
|
|
31
47
|
[evt: string]: CustomEvent<any>;
|
|
32
48
|
};
|
|
33
49
|
slots(): {};
|
|
34
50
|
}
|
|
35
|
-
export type AutocompleteProps<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['props']>;
|
|
36
|
-
export type AutocompleteEvents<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['events']>;
|
|
37
|
-
export type AutocompleteSlots<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['slots']>;
|
|
38
|
-
export default class Autocomplete<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> extends SvelteComponentTyped<AutocompleteProps<TransitionIn, TransitionOut>, AutocompleteEvents<TransitionIn, TransitionOut>, AutocompleteSlots<TransitionIn, TransitionOut>> {
|
|
51
|
+
export type AutocompleteProps<Value = unknown, Meta = unknown, TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<Value, Meta, TransitionIn, TransitionOut>['props']>;
|
|
52
|
+
export type AutocompleteEvents<Value = unknown, Meta = unknown, TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<Value, Meta, TransitionIn, TransitionOut>['events']>;
|
|
53
|
+
export type AutocompleteSlots<Value = unknown, Meta = unknown, TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<Value, Meta, TransitionIn, TransitionOut>['slots']>;
|
|
54
|
+
export default class Autocomplete<Value = unknown, Meta = unknown, TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> extends SvelteComponentTyped<AutocompleteProps<Value, Meta, TransitionIn, TransitionOut>, AutocompleteEvents<Value, Meta, TransitionIn, TransitionOut>, AutocompleteSlots<Value, Meta, TransitionIn, TransitionOut>> {
|
|
39
55
|
}
|
|
40
56
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export interface AutocompleteOption {
|
|
2
|
-
/**
|
|
1
|
+
export interface AutocompleteOption<Value = unknown, Meta = unknown> {
|
|
2
|
+
/** Provide a unique display label per option. Supports HTML. */
|
|
3
3
|
label: string;
|
|
4
4
|
/** Provide a unique option value. */
|
|
5
|
-
value:
|
|
5
|
+
value: Value;
|
|
6
6
|
/** Provide a comma separated list of keywords. */
|
|
7
|
-
keywords?:
|
|
7
|
+
keywords?: string;
|
|
8
8
|
/** Pass arbitrary data per option. */
|
|
9
|
-
meta?:
|
|
9
|
+
meta?: Meta;
|
|
10
10
|
}
|
|
@@ -6,30 +6,55 @@ type ScaleTransition = typeof scale;
|
|
|
6
6
|
declare class __sveltets_Render<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> {
|
|
7
7
|
props(): {
|
|
8
8
|
[x: string]: any;
|
|
9
|
+
/** Bind the input value.*/
|
|
9
10
|
input?: string | undefined;
|
|
11
|
+
/** Set a unique select input name.*/
|
|
10
12
|
name: string;
|
|
13
|
+
/** An array of values.*/
|
|
11
14
|
value?: any[] | undefined;
|
|
15
|
+
/** Provide a whitelist of accepted values.*/
|
|
12
16
|
whitelist?: string[] | undefined;
|
|
17
|
+
/** Maximum number of chips. Set -1 to disable.*/
|
|
13
18
|
max?: number | undefined;
|
|
19
|
+
/** Set the minimum character length.*/
|
|
14
20
|
minlength?: number | undefined;
|
|
21
|
+
/** Set the maximum character length.*/
|
|
15
22
|
maxlength?: number | undefined;
|
|
23
|
+
/** When enabled, allows for uppercase values.*/
|
|
16
24
|
allowUpperCase?: boolean | undefined;
|
|
25
|
+
/** When enabled, allows for duplicate values.*/
|
|
17
26
|
allowDuplicates?: boolean | undefined;
|
|
27
|
+
/** Provide a custom validator function.*/
|
|
18
28
|
validation?: ((...args: any[]) => boolean) | undefined;
|
|
29
|
+
/** The duration of the flip (first, last, invert, play) animation.*/
|
|
19
30
|
duration?: number | undefined;
|
|
31
|
+
/** Set the required state for this input field.*/
|
|
20
32
|
required?: boolean | undefined;
|
|
33
|
+
/** Provide classes or a variant to style the chips.*/
|
|
21
34
|
chips?: string | undefined;
|
|
35
|
+
/** {{ event: Event, input: any }} invalid - Fires when the input value is invalid.*/
|
|
22
36
|
invalid?: string | undefined;
|
|
37
|
+
/** Provide classes to set padding styles.*/
|
|
23
38
|
padding?: string | undefined;
|
|
39
|
+
/** Provide classes to set border radius styles.*/
|
|
24
40
|
rounded?: string | undefined;
|
|
41
|
+
/** Enable/Disable transitions*/
|
|
25
42
|
transitions?: boolean | undefined;
|
|
43
|
+
/** Provide the transition used in list on entry.*/
|
|
26
44
|
listTransitionIn?: ListTransitionIn | undefined;
|
|
45
|
+
/** Transition params provided to `ListTransitionIn`.*/
|
|
27
46
|
listTransitionInParams?: TransitionParams<ListTransitionIn> | undefined;
|
|
47
|
+
/** Provide the transition used in list on exit.*/
|
|
28
48
|
listTransitionOut?: ListTransitionOut | undefined;
|
|
49
|
+
/** Transition params provided to `ListTransitionOut`.*/
|
|
29
50
|
listTransitionOutParams?: TransitionParams<ListTransitionOut> | undefined;
|
|
51
|
+
/** Provide the transition used in chip on entry.*/
|
|
30
52
|
chipTransitionIn?: ChipTransitionIn | undefined;
|
|
53
|
+
/** Transition params provided to `ChipTransitionIn`.*/
|
|
31
54
|
chipTransitionInParams?: TransitionParams<ChipTransitionIn> | undefined;
|
|
55
|
+
/** Provide the transition used in chip on exit.*/
|
|
32
56
|
chipTransitionOut?: ChipTransitionOut | undefined;
|
|
57
|
+
/** Transition params provided to `ChipTransitionOut`.*/
|
|
33
58
|
chipTransitionOutParams?: TransitionParams<ChipTransitionOut> | undefined;
|
|
34
59
|
};
|
|
35
60
|
events(): {
|
|
@@ -91,7 +91,7 @@ onDestroy(() => {
|
|
|
91
91
|
<!-- Button: Next -->
|
|
92
92
|
<button type={buttonNextType} class="btn {buttonNext}" on:click={onNext} disabled={locked}>
|
|
93
93
|
{#if locked}
|
|
94
|
-
<svg class="w-3 aspect-square" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
|
94
|
+
<svg class="w-3 aspect-square fill-current" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
|
95
95
|
<path
|
|
96
96
|
d="M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z"
|
|
97
97
|
/>
|
|
@@ -6,8 +6,11 @@ declare class __sveltets_Render<TransitionIn extends Transition, TransitionOut e
|
|
|
6
6
|
props(): {
|
|
7
7
|
[x: string]: any;
|
|
8
8
|
locked?: boolean | undefined;
|
|
9
|
+
/** Provide arbitrary classes to the step header region.*/
|
|
9
10
|
regionHeader?: string | undefined;
|
|
11
|
+
/** Provide arbitrary classes to the step content region.*/
|
|
10
12
|
regionContent?: string | undefined;
|
|
13
|
+
/** Provide arbitrary classes to the step navigation region.*/
|
|
11
14
|
regionNavigation?: string | undefined;
|
|
12
15
|
state?: Writable<StepperState> | undefined;
|
|
13
16
|
dispatchParent?: StepperEventDispatcher | undefined;
|
|
@@ -23,10 +26,15 @@ declare class __sveltets_Render<TransitionIn extends Transition, TransitionOut e
|
|
|
23
26
|
buttonComplete?: string | undefined;
|
|
24
27
|
buttonCompleteType?: "button" | "reset" | "submit" | undefined;
|
|
25
28
|
buttonCompleteLabel?: string | undefined;
|
|
29
|
+
/** Enable/Disable transitions*/
|
|
26
30
|
transitions?: boolean | undefined;
|
|
31
|
+
/** Provide the transition to used on entry.*/
|
|
27
32
|
transitionIn?: TransitionIn | undefined;
|
|
33
|
+
/** Transition params provided to `transitionIn`.*/
|
|
28
34
|
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
35
|
+
/** Provide the transition to used on exit.*/
|
|
29
36
|
transitionOut?: TransitionOut | undefined;
|
|
37
|
+
/** Transition params provided to `transitionOut`.*/
|
|
30
38
|
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
31
39
|
};
|
|
32
40
|
events(): {} & {
|
|
@@ -6,28 +6,51 @@ import type { StepperButton, StepperState } from './types.js';
|
|
|
6
6
|
declare class __sveltets_Render<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> {
|
|
7
7
|
props(): {
|
|
8
8
|
[x: string]: any;
|
|
9
|
+
/** Provide classes to style the stepper header gap.*/
|
|
9
10
|
gap?: string | undefined;
|
|
11
|
+
/** Provide the verbiage that represents "Step".*/
|
|
10
12
|
stepTerm?: string | undefined;
|
|
13
|
+
/** Provide classes to style the stepper header badges.*/
|
|
11
14
|
badge?: string | undefined;
|
|
15
|
+
/** Provide classes to style the stepper header active step badge.*/
|
|
12
16
|
active?: string | undefined;
|
|
17
|
+
/** Provide classes to style the stepper header border.*/
|
|
13
18
|
border?: string | undefined;
|
|
19
|
+
/** Provide the initially selected step*/
|
|
14
20
|
start?: number | undefined;
|
|
21
|
+
/** Set the justification for the step navigation buttons.*/
|
|
15
22
|
justify?: string | undefined;
|
|
23
|
+
/** Provide arbitrary classes to style the back button.*/
|
|
16
24
|
buttonBack?: string | undefined;
|
|
25
|
+
/** Set the type of the back button.*/
|
|
17
26
|
buttonBackType?: StepperButton | undefined;
|
|
27
|
+
/** Provide the HTML label content for the back button.*/
|
|
18
28
|
buttonBackLabel?: string | undefined;
|
|
29
|
+
/** Provide arbitrary classes to style the next button.*/
|
|
19
30
|
buttonNext?: string | undefined;
|
|
31
|
+
/** Set the type of the next button.*/
|
|
20
32
|
buttonNextType?: StepperButton | undefined;
|
|
33
|
+
/** Provide the HTML label content for the next button.*/
|
|
21
34
|
buttonNextLabel?: string | undefined;
|
|
35
|
+
/** Provide arbitrary classes to style the complete button.*/
|
|
22
36
|
buttonComplete?: string | undefined;
|
|
37
|
+
/** Set the type of the complete button.*/
|
|
23
38
|
buttonCompleteType?: StepperButton | undefined;
|
|
39
|
+
/** Provide the HTML label content for the complete button.*/
|
|
24
40
|
buttonCompleteLabel?: string | undefined;
|
|
41
|
+
/** Provide arbitrary classes to the stepper header region.*/
|
|
25
42
|
regionHeader?: string | undefined;
|
|
43
|
+
/** Provide arbitrary classes to the stepper content region.*/
|
|
26
44
|
regionContent?: string | undefined;
|
|
45
|
+
/** Enable/Disable transitions*/
|
|
27
46
|
transitions?: boolean | undefined;
|
|
47
|
+
/** Provide the transition to used on entry.*/
|
|
28
48
|
transitionIn?: TransitionIn | undefined;
|
|
49
|
+
/** Transition params provided to `transitionIn`.*/
|
|
29
50
|
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
51
|
+
/** Provide the transition to used on exit.*/
|
|
30
52
|
transitionOut?: TransitionOut | undefined;
|
|
53
|
+
/** Transition params provided to `transitionOut`.*/
|
|
31
54
|
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
32
55
|
};
|
|
33
56
|
events(): {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script>import { setContext } from "svelte";
|
|
2
|
+
import RecursiveTreeViewItem from "./RecursiveTreeViewItem.svelte";
|
|
3
|
+
export let selection = false;
|
|
4
|
+
export let multiple = false;
|
|
5
|
+
export let relational = false;
|
|
6
|
+
export let nodes = [];
|
|
7
|
+
export let expandedNodes = [];
|
|
8
|
+
export let disabledNodes = [];
|
|
9
|
+
export let checkedNodes = [];
|
|
10
|
+
export let indeterminateNodes = [];
|
|
11
|
+
export let width = "w-full";
|
|
12
|
+
export let spacing = "space-y-1";
|
|
13
|
+
export let open = false;
|
|
14
|
+
export let disabled = false;
|
|
15
|
+
export let padding = "py-4 px-4";
|
|
16
|
+
export let indent = "ml-4";
|
|
17
|
+
export let hover = "hover:variant-soft";
|
|
18
|
+
export let rounded = "rounded-container-token";
|
|
19
|
+
export let caretOpen = "rotate-180";
|
|
20
|
+
export let caretClosed = "";
|
|
21
|
+
export let hyphenOpacity = "opacity-10";
|
|
22
|
+
export let regionSummary = "";
|
|
23
|
+
export let regionSymbol = "";
|
|
24
|
+
export let regionChildren = "";
|
|
25
|
+
export let labelledby = "";
|
|
26
|
+
setContext("open", open);
|
|
27
|
+
setContext("selection", selection);
|
|
28
|
+
setContext("multiple", multiple);
|
|
29
|
+
setContext("relational", relational);
|
|
30
|
+
setContext("disabled", disabled);
|
|
31
|
+
setContext("padding", padding);
|
|
32
|
+
setContext("indent", indent);
|
|
33
|
+
setContext("hover", hover);
|
|
34
|
+
setContext("rounded", rounded);
|
|
35
|
+
setContext("caretOpen", caretOpen);
|
|
36
|
+
setContext("caretClosed", caretClosed);
|
|
37
|
+
setContext("hyphenOpacity", hyphenOpacity);
|
|
38
|
+
setContext("regionSummary", regionSummary);
|
|
39
|
+
setContext("regionSymbol", regionSymbol);
|
|
40
|
+
setContext("regionChildren", regionChildren);
|
|
41
|
+
$:
|
|
42
|
+
classesBase = `${width} ${spacing} ${$$props.class ?? ""}`;
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<div
|
|
46
|
+
class="tree {classesBase}"
|
|
47
|
+
data-testid="tree"
|
|
48
|
+
role="tree"
|
|
49
|
+
aria-multiselectable={multiple}
|
|
50
|
+
aria-label={labelledby}
|
|
51
|
+
aria-disabled={disabled}
|
|
52
|
+
>
|
|
53
|
+
{#if nodes && nodes.length > 0}
|
|
54
|
+
<RecursiveTreeViewItem {nodes} bind:expandedNodes bind:disabledNodes bind:checkedNodes bind:indeterminateNodes />
|
|
55
|
+
{/if}
|
|
56
|
+
</div>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { TreeViewNode } from '../../index.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
/** Enable tree-view selection.*/
|
|
7
|
+
selection?: boolean | undefined;
|
|
8
|
+
/** Enable selection of multiple items.*/
|
|
9
|
+
multiple?: boolean | undefined;
|
|
10
|
+
/** Enable relational checking.*/
|
|
11
|
+
relational?: boolean | undefined;
|
|
12
|
+
/** Provide data-driven nodes.*/
|
|
13
|
+
nodes?: TreeViewNode[] | undefined;
|
|
14
|
+
/** provides id's of expanded nodes*/
|
|
15
|
+
expandedNodes?: string[] | undefined;
|
|
16
|
+
/** provides id's of disabled nodes*/
|
|
17
|
+
disabledNodes?: string[] | undefined;
|
|
18
|
+
/** provides id's of checked nodes*/
|
|
19
|
+
checkedNodes?: string[] | undefined;
|
|
20
|
+
/** provides id's of indeterminate nodes*/
|
|
21
|
+
indeterminateNodes?: string[] | undefined;
|
|
22
|
+
/** Provide classes to set the tree width.*/
|
|
23
|
+
width?: string | undefined;
|
|
24
|
+
/** Provide classes to set the vertical spacing between items.*/
|
|
25
|
+
spacing?: string | undefined;
|
|
26
|
+
/** Set open by default on load.*/
|
|
27
|
+
open?: boolean | undefined;
|
|
28
|
+
/** Set the tree disabled state*/
|
|
29
|
+
disabled?: boolean | undefined;
|
|
30
|
+
/** Provide classes to set the tree item padding styles.*/
|
|
31
|
+
padding?: string | undefined;
|
|
32
|
+
/** Provide classes to set the tree children indentation*/
|
|
33
|
+
indent?: string | undefined;
|
|
34
|
+
/** Provide classes to set the tree item hover styles.*/
|
|
35
|
+
hover?: string | undefined;
|
|
36
|
+
/** Provide classes to set the tree item rounded styles.*/
|
|
37
|
+
rounded?: string | undefined;
|
|
38
|
+
/** Set the rotation of the item caret in the open state.*/
|
|
39
|
+
caretOpen?: string | undefined;
|
|
40
|
+
/** Set the rotation of the item caret in the closed state.*/
|
|
41
|
+
caretClosed?: string | undefined;
|
|
42
|
+
hyphenOpacity?: string | undefined;
|
|
43
|
+
/** Provide arbitrary classes to the tree item summary region.*/
|
|
44
|
+
regionSummary?: string | undefined;
|
|
45
|
+
/** Provide arbitrary classes to the symbol icon region.*/
|
|
46
|
+
regionSymbol?: string | undefined;
|
|
47
|
+
/** Provide arbitrary classes to the children region.*/
|
|
48
|
+
regionChildren?: string | undefined;
|
|
49
|
+
/** Provide the ARIA labelledby value.*/
|
|
50
|
+
labelledby?: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
events: {
|
|
53
|
+
[evt: string]: CustomEvent<any>;
|
|
54
|
+
};
|
|
55
|
+
slots: {};
|
|
56
|
+
};
|
|
57
|
+
export type RecursiveTreeViewProps = typeof __propDef.props;
|
|
58
|
+
export type RecursiveTreeViewEvents = typeof __propDef.events;
|
|
59
|
+
export type RecursiveTreeViewSlots = typeof __propDef.slots;
|
|
60
|
+
export default class RecursiveTreeView extends SvelteComponentTyped<RecursiveTreeViewProps, RecursiveTreeViewEvents, RecursiveTreeViewSlots> {
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<script>import TreeViewItem from "./TreeViewItem.svelte";
|
|
2
|
+
import RecursiveTreeViewItem from "./RecursiveTreeViewItem.svelte";
|
|
3
|
+
import { getContext, onMount, tick } from "svelte";
|
|
4
|
+
export let nodes = [];
|
|
5
|
+
export let expandedNodes = [];
|
|
6
|
+
export let disabledNodes = [];
|
|
7
|
+
export let checkedNodes = [];
|
|
8
|
+
export let indeterminateNodes = [];
|
|
9
|
+
let selection = getContext("selection");
|
|
10
|
+
let multiple = getContext("multiple");
|
|
11
|
+
let relational = getContext("relational");
|
|
12
|
+
let tempCheckedNodes = [];
|
|
13
|
+
let group;
|
|
14
|
+
let name = "";
|
|
15
|
+
function toggleNode(node, open) {
|
|
16
|
+
if (!node.children?.length)
|
|
17
|
+
return;
|
|
18
|
+
if (open) {
|
|
19
|
+
if (!expandedNodes.includes(node.id)) {
|
|
20
|
+
expandedNodes.push(node.id);
|
|
21
|
+
expandedNodes = expandedNodes;
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
if (expandedNodes.includes(node.id)) {
|
|
25
|
+
expandedNodes.splice(expandedNodes.indexOf(node.id), 1);
|
|
26
|
+
expandedNodes = expandedNodes;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function checkNode(node, checked, indeterminate) {
|
|
31
|
+
if (checked) {
|
|
32
|
+
if (!checkedNodes.includes(node.id)) {
|
|
33
|
+
checkedNodes.push(node.id);
|
|
34
|
+
checkedNodes = checkedNodes;
|
|
35
|
+
}
|
|
36
|
+
if (!indeterminate && indeterminateNodes.includes(node.id)) {
|
|
37
|
+
indeterminateNodes.splice(indeterminateNodes.indexOf(node.id), 1);
|
|
38
|
+
indeterminateNodes = indeterminateNodes;
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
if (checkedNodes.includes(node.id)) {
|
|
42
|
+
checkedNodes.splice(checkedNodes.indexOf(node.id), 1);
|
|
43
|
+
checkedNodes = checkedNodes;
|
|
44
|
+
}
|
|
45
|
+
if (indeterminate && !indeterminateNodes.includes(node.id)) {
|
|
46
|
+
indeterminateNodes.push(node.id);
|
|
47
|
+
indeterminateNodes = indeterminateNodes;
|
|
48
|
+
} else if (!indeterminate && indeterminateNodes.includes(node.id)) {
|
|
49
|
+
indeterminateNodes.splice(indeterminateNodes.indexOf(node.id), 1);
|
|
50
|
+
indeterminateNodes = indeterminateNodes;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
tempCheckedNodes = [...checkedNodes];
|
|
55
|
+
onMount(async () => {
|
|
56
|
+
if (selection) {
|
|
57
|
+
name = String(Math.random());
|
|
58
|
+
if (group === void 0) {
|
|
59
|
+
if (multiple) {
|
|
60
|
+
group = [];
|
|
61
|
+
nodes.forEach((node) => {
|
|
62
|
+
if (checkedNodes.includes(node.id) && Array.isArray(group))
|
|
63
|
+
group.push(node.id);
|
|
64
|
+
});
|
|
65
|
+
group = group;
|
|
66
|
+
} else if (!nodes.some((node) => checkedNodes.includes(node.id))) {
|
|
67
|
+
group = "";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (!relational)
|
|
71
|
+
treeItems = [];
|
|
72
|
+
checkedNodes = [];
|
|
73
|
+
await tick();
|
|
74
|
+
checkedNodes = [...tempCheckedNodes];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
export let treeItems = [];
|
|
78
|
+
let children = [];
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
{#if nodes && nodes.length > 0}
|
|
82
|
+
{#each nodes as node, i}
|
|
83
|
+
<TreeViewItem
|
|
84
|
+
bind:this={treeItems[i]}
|
|
85
|
+
bind:children={children[i]}
|
|
86
|
+
bind:group
|
|
87
|
+
bind:name
|
|
88
|
+
bind:value={node.id}
|
|
89
|
+
hideLead={!node.lead}
|
|
90
|
+
hideChildren={!node.children || node.children.length === 0}
|
|
91
|
+
open={expandedNodes.includes(node.id)}
|
|
92
|
+
disabled={disabledNodes.includes(node.id)}
|
|
93
|
+
checked={checkedNodes.includes(node.id)}
|
|
94
|
+
indeterminate={indeterminateNodes.includes(node.id)}
|
|
95
|
+
on:toggle={(e) => toggleNode(node, e.detail.open)}
|
|
96
|
+
on:groupChange={(e) => checkNode(node, e.detail.checked, e.detail.indeterminate)}
|
|
97
|
+
>
|
|
98
|
+
{@html node.content}
|
|
99
|
+
<svelte:fragment slot="lead">
|
|
100
|
+
{@html node.lead}
|
|
101
|
+
</svelte:fragment>
|
|
102
|
+
<svelte:fragment slot="children">
|
|
103
|
+
<RecursiveTreeViewItem
|
|
104
|
+
nodes={node.children}
|
|
105
|
+
bind:expandedNodes
|
|
106
|
+
bind:disabledNodes
|
|
107
|
+
bind:checkedNodes
|
|
108
|
+
bind:indeterminateNodes
|
|
109
|
+
bind:treeItems={children[i]}
|
|
110
|
+
/>
|
|
111
|
+
</svelte:fragment>
|
|
112
|
+
</TreeViewItem>
|
|
113
|
+
{/each}
|
|
114
|
+
{/if}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* provides id's of expanded nodes
|
|
9
|
+
* @type {string[]}
|
|
10
|
+
*/ expandedNodes?: string[] | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* provides id's of disabled nodes
|
|
13
|
+
* @type {string[]}
|
|
14
|
+
*/ disabledNodes?: string[] | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* provides id's of checked nodes
|
|
17
|
+
* @type {string[]}
|
|
18
|
+
*/ checkedNodes?: string[] | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* provides id's of indeterminate nodes
|
|
21
|
+
* @type {string[]}
|
|
22
|
+
*/ indeterminateNodes?: string[] | undefined;
|
|
23
|
+
treeItems?: TreeViewItem[] | undefined;
|
|
24
|
+
};
|
|
25
|
+
events: {
|
|
26
|
+
[evt: string]: CustomEvent<any>;
|
|
27
|
+
};
|
|
28
|
+
slots: {};
|
|
29
|
+
};
|
|
30
|
+
export type RecursiveTreeViewItemProps = typeof __propDef.props;
|
|
31
|
+
export type RecursiveTreeViewItemEvents = typeof __propDef.events;
|
|
32
|
+
export type RecursiveTreeViewItemSlots = typeof __propDef.slots;
|
|
33
|
+
export default class RecursiveTreeViewItem extends SvelteComponentTyped<RecursiveTreeViewItemProps, RecursiveTreeViewItemEvents, RecursiveTreeViewItemSlots> {
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<script>import { setContext } from "svelte";
|
|
2
|
-
import TreeViewDataDrivenItem from "./TreeViewDataDrivenItem.svelte";
|
|
3
2
|
export let selection = false;
|
|
4
3
|
export let multiple = false;
|
|
5
|
-
export let nodes = [];
|
|
6
4
|
export let width = "w-full";
|
|
7
5
|
export let spacing = "space-y-1";
|
|
8
6
|
export let open = false;
|
|
@@ -66,9 +64,5 @@ let tree;
|
|
|
66
64
|
aria-label={labelledby}
|
|
67
65
|
aria-disabled={disabled}
|
|
68
66
|
>
|
|
69
|
-
|
|
70
|
-
<TreeViewDataDrivenItem bind:nodes on:change on:click on:toggle on:keydown on:keyup />
|
|
71
|
-
{:else}
|
|
72
|
-
<slot />
|
|
73
|
-
{/if}
|
|
67
|
+
<slot />
|
|
74
68
|
</div>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { TreeViewNode } from '../../index.js';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
@@ -7,8 +6,6 @@ declare const __propDef: {
|
|
|
7
6
|
selection?: boolean | undefined;
|
|
8
7
|
/** Enable selection of multiple items.*/
|
|
9
8
|
multiple?: boolean | undefined;
|
|
10
|
-
/** Provide data-driven nodes.*/
|
|
11
|
-
nodes?: TreeViewNode[] | undefined;
|
|
12
9
|
/** Provide classes to set the tree width.*/
|
|
13
10
|
width?: string | undefined;
|
|
14
11
|
/** Provide classes to set the vertical spacing between items.*/
|
|
@@ -42,12 +39,6 @@ declare const __propDef: {
|
|
|
42
39
|
collapseAll?: (() => void) | undefined;
|
|
43
40
|
};
|
|
44
41
|
events: {
|
|
45
|
-
change: Event;
|
|
46
|
-
click: MouseEvent;
|
|
47
|
-
toggle: CustomEvent<any>;
|
|
48
|
-
keydown: KeyboardEvent;
|
|
49
|
-
keyup: KeyboardEvent;
|
|
50
|
-
} & {
|
|
51
42
|
[evt: string]: CustomEvent<any>;
|
|
52
43
|
};
|
|
53
44
|
slots: {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<!-- To access props and events using reference -->
|
|
2
2
|
<svelte:options accessors />
|
|
3
3
|
|
|
4
|
-
<script>import { getContext, createEventDispatcher } from "svelte";
|
|
4
|
+
<script>import { getContext, createEventDispatcher, onMount } from "svelte";
|
|
5
5
|
export let group = void 0;
|
|
6
6
|
export let name = void 0;
|
|
7
7
|
export let value = void 0;
|
|
8
|
+
export let checked = false;
|
|
8
9
|
export let children = [];
|
|
9
10
|
export let spacing = "space-x-4";
|
|
10
11
|
export let open = getContext("open");
|
|
@@ -24,7 +25,6 @@ export let regionSymbol = getContext("regionSymbol");
|
|
|
24
25
|
export let regionChildren = getContext("regionChildren");
|
|
25
26
|
export let hideLead = false;
|
|
26
27
|
export let hideChildren = false;
|
|
27
|
-
let checked = false;
|
|
28
28
|
let treeItem;
|
|
29
29
|
let childrenDiv;
|
|
30
30
|
function onSummaryClick(event) {
|
|
@@ -33,16 +33,29 @@ function onSummaryClick(event) {
|
|
|
33
33
|
}
|
|
34
34
|
$:
|
|
35
35
|
if (multiple)
|
|
36
|
-
updateCheckbox(group);
|
|
36
|
+
updateCheckbox(group, indeterminate);
|
|
37
37
|
$:
|
|
38
38
|
if (multiple)
|
|
39
|
-
updateGroup(checked);
|
|
40
|
-
|
|
39
|
+
updateGroup(checked, indeterminate);
|
|
40
|
+
$:
|
|
41
|
+
if (!multiple)
|
|
42
|
+
updateRadio(group);
|
|
43
|
+
$:
|
|
44
|
+
if (!multiple)
|
|
45
|
+
updateRadioGroup(checked);
|
|
46
|
+
let initUpdate = true;
|
|
47
|
+
function updateCheckbox(group2, indeterminate2) {
|
|
41
48
|
if (!Array.isArray(group2))
|
|
42
49
|
return;
|
|
43
50
|
checked = group2.indexOf(value) >= 0;
|
|
51
|
+
dispatch("groupChange", { checked, indeterminate: indeterminate2 });
|
|
52
|
+
dispatch("childChange");
|
|
53
|
+
if (initUpdate) {
|
|
54
|
+
onParentChange();
|
|
55
|
+
initUpdate = false;
|
|
56
|
+
}
|
|
44
57
|
}
|
|
45
|
-
function updateGroup(checked2) {
|
|
58
|
+
function updateGroup(checked2, indeterminate2) {
|
|
46
59
|
if (!Array.isArray(group))
|
|
47
60
|
return;
|
|
48
61
|
const index = group.indexOf(value);
|
|
@@ -50,14 +63,28 @@ function updateGroup(checked2) {
|
|
|
50
63
|
if (index < 0) {
|
|
51
64
|
group.push(value);
|
|
52
65
|
group = group;
|
|
66
|
+
onParentChange();
|
|
53
67
|
}
|
|
54
68
|
} else {
|
|
55
69
|
if (index >= 0) {
|
|
56
70
|
group.splice(index, 1);
|
|
57
71
|
group = group;
|
|
72
|
+
onParentChange();
|
|
58
73
|
}
|
|
59
74
|
}
|
|
60
75
|
}
|
|
76
|
+
function updateRadio(group2) {
|
|
77
|
+
checked = group2 === value;
|
|
78
|
+
dispatch("groupChange", { checked, indeterminate: false });
|
|
79
|
+
if (group2)
|
|
80
|
+
dispatch("childChange");
|
|
81
|
+
}
|
|
82
|
+
function updateRadioGroup(checked2) {
|
|
83
|
+
if (checked2 && group !== value)
|
|
84
|
+
group = value;
|
|
85
|
+
else if (!checked2 && group === value)
|
|
86
|
+
group = "";
|
|
87
|
+
}
|
|
61
88
|
function onChildValueChange() {
|
|
62
89
|
if (multiple) {
|
|
63
90
|
if (!Array.isArray(group))
|
|
@@ -67,6 +94,10 @@ function onChildValueChange() {
|
|
|
67
94
|
const index = group.indexOf(value);
|
|
68
95
|
if (children.some((c) => c.indeterminate)) {
|
|
69
96
|
indeterminate = true;
|
|
97
|
+
if (index >= 0) {
|
|
98
|
+
group.splice(index, 1);
|
|
99
|
+
group = group;
|
|
100
|
+
}
|
|
70
101
|
} else if (childrenValues.every((c) => Array.isArray(childrenGroup) && childrenGroup.includes(c))) {
|
|
71
102
|
indeterminate = false;
|
|
72
103
|
if (index < 0) {
|
|
@@ -75,6 +106,10 @@ function onChildValueChange() {
|
|
|
75
106
|
}
|
|
76
107
|
} else if (childrenValues.some((c) => Array.isArray(childrenGroup) && childrenGroup.includes(c))) {
|
|
77
108
|
indeterminate = true;
|
|
109
|
+
if (index >= 0) {
|
|
110
|
+
group.splice(index, 1);
|
|
111
|
+
group = group;
|
|
112
|
+
}
|
|
78
113
|
} else {
|
|
79
114
|
indeterminate = false;
|
|
80
115
|
if (index >= 0) {
|
|
@@ -83,11 +118,13 @@ function onChildValueChange() {
|
|
|
83
118
|
}
|
|
84
119
|
}
|
|
85
120
|
} else {
|
|
86
|
-
if (group !== value) {
|
|
121
|
+
if (group !== value && children.some((c) => c.checked)) {
|
|
87
122
|
group = value;
|
|
123
|
+
} else if (group === value && !children.some((c) => c.checked)) {
|
|
124
|
+
group = "";
|
|
88
125
|
}
|
|
89
126
|
}
|
|
90
|
-
dispatch("
|
|
127
|
+
dispatch("childChange");
|
|
91
128
|
}
|
|
92
129
|
export function onParentChange() {
|
|
93
130
|
if (!multiple || !children || children.length === 0)
|
|
@@ -115,16 +152,18 @@ export function onParentChange() {
|
|
|
115
152
|
}
|
|
116
153
|
};
|
|
117
154
|
children.forEach((child) => {
|
|
155
|
+
if (!child)
|
|
156
|
+
return;
|
|
118
157
|
index >= 0 ? checkChild(child) : uncheckChild(child);
|
|
119
158
|
child.onParentChange();
|
|
120
159
|
});
|
|
121
160
|
}
|
|
122
161
|
$:
|
|
123
|
-
if (!multiple && group) {
|
|
162
|
+
if (!multiple && group !== void 0) {
|
|
124
163
|
if (group !== value) {
|
|
125
164
|
children.forEach((child) => {
|
|
126
165
|
if (child)
|
|
127
|
-
child.group =
|
|
166
|
+
child.group = "";
|
|
128
167
|
});
|
|
129
168
|
}
|
|
130
169
|
}
|
|
@@ -134,7 +173,7 @@ $:
|
|
|
134
173
|
$:
|
|
135
174
|
children.forEach((child) => {
|
|
136
175
|
if (child)
|
|
137
|
-
child.$on("
|
|
176
|
+
child.$on("childChange", onChildValueChange);
|
|
138
177
|
});
|
|
139
178
|
function onKeyDown(event) {
|
|
140
179
|
function getRootTree() {
|
|
@@ -260,12 +299,10 @@ $:
|
|
|
260
299
|
{value}
|
|
261
300
|
bind:checked
|
|
262
301
|
bind:indeterminate
|
|
263
|
-
on:click
|
|
264
|
-
on:change
|
|
265
302
|
on:change={onParentChange}
|
|
266
303
|
/>
|
|
267
304
|
{:else}
|
|
268
|
-
<input class="radio tree-item-radio" type="radio" bind:group {name} {value}
|
|
305
|
+
<input class="radio tree-item-radio" type="radio" bind:group {name} {value} />
|
|
269
306
|
{/if}
|
|
270
307
|
{/if}
|
|
271
308
|
|
|
@@ -9,6 +9,8 @@ declare const __propDef: {
|
|
|
9
9
|
name?: string | undefined;
|
|
10
10
|
/** Set the input's value.*/
|
|
11
11
|
value?: unknown;
|
|
12
|
+
/** Set the input's check state*/
|
|
13
|
+
checked?: boolean | undefined;
|
|
12
14
|
/** Provide children references to support relational checking.*/
|
|
13
15
|
children?: TreeViewItem[] | undefined;
|
|
14
16
|
/** Provide classes to set the horizontal spacing.*/
|
|
@@ -52,7 +54,6 @@ declare const __propDef: {
|
|
|
52
54
|
click: MouseEvent;
|
|
53
55
|
keydown: KeyboardEvent;
|
|
54
56
|
keyup: KeyboardEvent;
|
|
55
|
-
change: Event;
|
|
56
57
|
toggle: CustomEvent<any>;
|
|
57
58
|
} & {
|
|
58
59
|
[evt: string]: CustomEvent<any>;
|
|
@@ -77,6 +78,9 @@ export default class TreeViewItem extends SvelteComponentTyped<TreeViewItemProps
|
|
|
77
78
|
get value(): unknown;
|
|
78
79
|
/**accessor*/
|
|
79
80
|
set value(_: unknown);
|
|
81
|
+
get checked(): boolean | undefined;
|
|
82
|
+
/**accessor*/
|
|
83
|
+
set checked(_: boolean | undefined);
|
|
80
84
|
get children(): TreeViewItem[] | undefined;
|
|
81
85
|
/**accessor*/
|
|
82
86
|
set children(_: TreeViewItem[] | undefined);
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
export interface TreeViewNode {
|
|
2
|
+
/** Nodes Unique ID */
|
|
3
|
+
id: string;
|
|
2
4
|
/** Main content. accepts HTML. */
|
|
3
5
|
content: string;
|
|
4
6
|
/** Lead content. accepts HTML. */
|
|
5
7
|
lead?: string;
|
|
6
|
-
/** Set open by default on load. */
|
|
7
|
-
open?: boolean;
|
|
8
|
-
/** Set the tree disabled state. */
|
|
9
|
-
disabled?: boolean;
|
|
10
8
|
/** children nodes. */
|
|
11
9
|
children?: TreeViewNode[];
|
|
12
10
|
/** Set the input's value. */
|
|
13
11
|
value?: unknown;
|
|
14
|
-
/** input checked */
|
|
15
|
-
checked?: boolean;
|
|
16
|
-
/** input is set to indeterminate, only availabe in multiple selection mode. */
|
|
17
|
-
indeterminate?: boolean;
|
|
18
12
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -56,7 +56,8 @@ export { default as Tab } from './components/Tab/Tab.svelte';
|
|
|
56
56
|
export { default as TabAnchor } from './components/Tab/TabAnchor.svelte';
|
|
57
57
|
export { default as TreeView } from './components/TreeView/TreeView.svelte';
|
|
58
58
|
export { default as TreeViewItem } from './components/TreeView/TreeViewItem.svelte';
|
|
59
|
-
export { default as
|
|
59
|
+
export { default as RecursiveTreeView } from './components/TreeView/RecursiveTreeView.svelte';
|
|
60
|
+
export { default as RecursiveTreeViewItem } from './components/TreeView/RecursiveTreeViewItem.svelte';
|
|
60
61
|
export { default as CodeBlock } from './utilities/CodeBlock/CodeBlock.svelte';
|
|
61
62
|
export { default as Modal } from './utilities/Modal/Modal.svelte';
|
|
62
63
|
export { default as Drawer } from './utilities/Drawer/Drawer.svelte';
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,8 @@ export { default as Tab } from './components/Tab/Tab.svelte';
|
|
|
58
58
|
export { default as TabAnchor } from './components/Tab/TabAnchor.svelte';
|
|
59
59
|
export { default as TreeView } from './components/TreeView/TreeView.svelte';
|
|
60
60
|
export { default as TreeViewItem } from './components/TreeView/TreeViewItem.svelte';
|
|
61
|
-
export { default as
|
|
61
|
+
export { default as RecursiveTreeView } from './components/TreeView/RecursiveTreeView.svelte';
|
|
62
|
+
export { default as RecursiveTreeViewItem } from './components/TreeView/RecursiveTreeViewItem.svelte';
|
|
62
63
|
// Utility Components
|
|
63
64
|
export { default as CodeBlock } from './utilities/CodeBlock/CodeBlock.svelte';
|
|
64
65
|
export { default as Modal } from './utilities/Modal/Modal.svelte';
|
|
@@ -202,11 +202,13 @@ $:
|
|
|
202
202
|
aria-modal="true"
|
|
203
203
|
aria-label={$modalStore[0].title ?? ''}
|
|
204
204
|
>
|
|
205
|
-
|
|
206
|
-
{
|
|
205
|
+
{#if currentComponent?.slot}
|
|
206
|
+
<svelte:component this={currentComponent?.ref} {...currentComponent?.props} {parent}>
|
|
207
207
|
{@html currentComponent?.slot}
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
</svelte:component>
|
|
209
|
+
{:else}
|
|
210
|
+
<svelte:component this={currentComponent?.ref} {...currentComponent?.props} {parent} />
|
|
211
|
+
{/if}
|
|
210
212
|
</div>
|
|
211
213
|
{/if}
|
|
212
214
|
</div>
|
|
@@ -6,29 +6,53 @@ import type { ModalComponent } from './types.js';
|
|
|
6
6
|
declare class __sveltets_Render<TransitionIn extends Transition = FlyTransition, TransitionOut extends Transition = FlyTransition> {
|
|
7
7
|
props(): {
|
|
8
8
|
[x: string]: any;
|
|
9
|
+
/** Set the modal position within the backdrop container*/
|
|
9
10
|
position?: string | undefined;
|
|
11
|
+
/** Register a list of reusable component modals.*/
|
|
10
12
|
components?: Record<string, ModalComponent> | undefined;
|
|
13
|
+
/** Provide classes to style the modal background.*/
|
|
11
14
|
background?: string | undefined;
|
|
15
|
+
/** Provide classes to style the modal width.*/
|
|
12
16
|
width?: string | undefined;
|
|
17
|
+
/** Provide classes to style the modal height.*/
|
|
13
18
|
height?: string | undefined;
|
|
19
|
+
/** Provide classes to style the modal padding.*/
|
|
14
20
|
padding?: string | undefined;
|
|
21
|
+
/** Provide classes to style the modal spacing.*/
|
|
15
22
|
spacing?: string | undefined;
|
|
23
|
+
/** Provide classes to style the modal border radius.*/
|
|
16
24
|
rounded?: string | undefined;
|
|
25
|
+
/** Provide classes to style modal box shadow.*/
|
|
17
26
|
shadow?: string | undefined;
|
|
27
|
+
/** Provide a class to override the z-index*/
|
|
18
28
|
zIndex?: string | undefined;
|
|
29
|
+
/** Provide classes for neutral buttons, such as Cancel.*/
|
|
19
30
|
buttonNeutral?: string | undefined;
|
|
31
|
+
/** Provide classes for positive actions, such as Confirm or Submit.*/
|
|
20
32
|
buttonPositive?: string | undefined;
|
|
33
|
+
/** Override the text for the Cancel button.*/
|
|
21
34
|
buttonTextCancel?: string | undefined;
|
|
35
|
+
/** Override the text for the Confirm button.*/
|
|
22
36
|
buttonTextConfirm?: string | undefined;
|
|
37
|
+
/** Override the text for the Submit button.*/
|
|
23
38
|
buttonTextSubmit?: string | undefined;
|
|
39
|
+
/** Provide classes to style the backdrop.*/
|
|
24
40
|
regionBackdrop?: string | undefined;
|
|
41
|
+
/** Provide arbitrary classes to modal header region.*/
|
|
25
42
|
regionHeader?: string | undefined;
|
|
43
|
+
/** Provide arbitrary classes to modal body region.*/
|
|
26
44
|
regionBody?: string | undefined;
|
|
45
|
+
/** Provide arbitrary classes to modal footer region.*/
|
|
27
46
|
regionFooter?: string | undefined;
|
|
47
|
+
/** Enable/Disable transitions*/
|
|
28
48
|
transitions?: boolean | undefined;
|
|
49
|
+
/** Provide the transition used on entry.*/
|
|
29
50
|
transitionIn?: TransitionIn | undefined;
|
|
51
|
+
/** Transition params provided to `TransitionIn`.*/
|
|
30
52
|
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
53
|
+
/** Provide the transition used on exit.*/
|
|
31
54
|
transitionOut?: TransitionOut | undefined;
|
|
55
|
+
/** Transition params provided to `TransitionOut`.*/
|
|
32
56
|
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
33
57
|
};
|
|
34
58
|
events(): {
|
|
@@ -5,23 +5,41 @@ type FlyTransition = typeof fly;
|
|
|
5
5
|
declare class __sveltets_Render<TransitionIn extends Transition = FlyTransition, TransitionOut extends Transition = FlyTransition> {
|
|
6
6
|
props(): {
|
|
7
7
|
[x: string]: any;
|
|
8
|
+
/** Set the toast position.*/
|
|
8
9
|
position?: "b" | "br" | "tr" | "t" | "l" | "r" | "tl" | "bl" | undefined;
|
|
10
|
+
/** Maximum toasts that can show at once.*/
|
|
9
11
|
max?: number | undefined;
|
|
12
|
+
/** Provide classes to set the background color.*/
|
|
10
13
|
background?: string | undefined;
|
|
14
|
+
/** Provide classes to set width styles.*/
|
|
11
15
|
width?: string | undefined;
|
|
16
|
+
/** Provide classes to set the text color.*/
|
|
12
17
|
color?: string | undefined;
|
|
18
|
+
/** Provide classes to set the padding.*/
|
|
13
19
|
padding?: string | undefined;
|
|
20
|
+
/** Provide classes to set toast horizontal spacing.*/
|
|
14
21
|
spacing?: string | undefined;
|
|
22
|
+
/** Provide classes to set the border radius styles.*/
|
|
15
23
|
rounded?: string | undefined;
|
|
24
|
+
/** Provide classes to set the border box shadow.*/
|
|
16
25
|
shadow?: string | undefined;
|
|
26
|
+
/** Provide a class to override the z-index*/
|
|
17
27
|
zIndex?: string | undefined;
|
|
28
|
+
/** Provide styles for the action button.*/
|
|
18
29
|
buttonAction?: string | undefined;
|
|
30
|
+
/** Provide styles for the dismiss button.*/
|
|
19
31
|
buttonDismiss?: string | undefined;
|
|
32
|
+
/** The button label text.*/
|
|
20
33
|
buttonDismissLabel?: string | undefined;
|
|
34
|
+
/** Enable/Disable transitions*/
|
|
21
35
|
transitions?: boolean | undefined;
|
|
36
|
+
/** Provide the transition to used on entry.*/
|
|
22
37
|
transitionIn?: TransitionIn | undefined;
|
|
38
|
+
/** Transition params provided to `transitionIn`.*/
|
|
23
39
|
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
40
|
+
/** Provide the transition to used on exit.*/
|
|
24
41
|
transitionOut?: TransitionOut | undefined;
|
|
42
|
+
/** Transition params provided to `transitionOut`.*/
|
|
25
43
|
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
26
44
|
};
|
|
27
45
|
events(): {} & {
|
package/package.json
CHANGED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<script>import { getContext, onMount } from "svelte";
|
|
2
|
-
import TreeViewDataDrivenItem from "./TreeViewDataDrivenItem.svelte";
|
|
3
|
-
import TreeViewItem from "./TreeViewItem.svelte";
|
|
4
|
-
export let nodes = [];
|
|
5
|
-
export let selection = getContext("selection");
|
|
6
|
-
export let multiple = getContext("multiple");
|
|
7
|
-
let group;
|
|
8
|
-
let name = "";
|
|
9
|
-
onMount(() => {
|
|
10
|
-
name = String(Math.random());
|
|
11
|
-
if (selection) {
|
|
12
|
-
group = multiple ? [] : "";
|
|
13
|
-
if (multiple) {
|
|
14
|
-
nodes.forEach((node) => {
|
|
15
|
-
if (!Array.isArray(group))
|
|
16
|
-
return;
|
|
17
|
-
if (node.children && node.children.length > 0) {
|
|
18
|
-
if (node.children.some((c) => c.indeterminate)) {
|
|
19
|
-
node.indeterminate = true;
|
|
20
|
-
} else if (node.children.every((c) => c.checked)) {
|
|
21
|
-
node.indeterminate = false;
|
|
22
|
-
group.push(node.value);
|
|
23
|
-
group = group;
|
|
24
|
-
} else if (node.children.some((c) => c.checked)) {
|
|
25
|
-
node.indeterminate = true;
|
|
26
|
-
} else {
|
|
27
|
-
node.indeterminate = false;
|
|
28
|
-
node.checked = false;
|
|
29
|
-
}
|
|
30
|
-
} else if (node.checked) {
|
|
31
|
-
group.push(node.value);
|
|
32
|
-
group = group;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
} else {
|
|
36
|
-
nodes.forEach((node) => {
|
|
37
|
-
if (!node.checked)
|
|
38
|
-
return;
|
|
39
|
-
group = node.value;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
function onGroupChange() {
|
|
45
|
-
if (multiple) {
|
|
46
|
-
nodes.forEach((node) => {
|
|
47
|
-
if (!Array.isArray(group))
|
|
48
|
-
return;
|
|
49
|
-
node.checked = group.includes(node.value);
|
|
50
|
-
});
|
|
51
|
-
} else {
|
|
52
|
-
nodes.forEach((node) => {
|
|
53
|
-
node.checked = node.value === group;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export let treeItems = [];
|
|
58
|
-
let children = [];
|
|
59
|
-
</script>
|
|
60
|
-
|
|
61
|
-
{#if nodes && nodes.length > 0}
|
|
62
|
-
{#each nodes as node, i}
|
|
63
|
-
<TreeViewItem
|
|
64
|
-
bind:this={treeItems[i]}
|
|
65
|
-
bind:open={node.open}
|
|
66
|
-
hideLead={!node.lead}
|
|
67
|
-
hideChildren={!node.children || node.children.length === 0}
|
|
68
|
-
bind:disabled={node.disabled}
|
|
69
|
-
bind:group
|
|
70
|
-
bind:name
|
|
71
|
-
bind:indeterminate={node.indeterminate}
|
|
72
|
-
bind:value={node.value}
|
|
73
|
-
bind:children={children[i]}
|
|
74
|
-
on:change={onGroupChange}
|
|
75
|
-
on:change
|
|
76
|
-
on:click
|
|
77
|
-
on:toggle
|
|
78
|
-
on:keydown
|
|
79
|
-
on:keyup
|
|
80
|
-
>
|
|
81
|
-
{@html node.content}
|
|
82
|
-
<svelte:fragment slot="lead">
|
|
83
|
-
{@html node.lead}
|
|
84
|
-
</svelte:fragment>
|
|
85
|
-
<svelte:fragment slot="children">
|
|
86
|
-
<TreeViewDataDrivenItem bind:nodes={node.children} bind:treeItems={children[i]} />
|
|
87
|
-
</svelte:fragment>
|
|
88
|
-
</TreeViewItem>
|
|
89
|
-
{/each}
|
|
90
|
-
{/if}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
treeItems?: TreeViewItem[] | undefined;
|
|
10
|
-
};
|
|
11
|
-
events: {
|
|
12
|
-
change: Event;
|
|
13
|
-
click: MouseEvent;
|
|
14
|
-
toggle: CustomEvent<any>;
|
|
15
|
-
keydown: KeyboardEvent;
|
|
16
|
-
keyup: KeyboardEvent;
|
|
17
|
-
} & {
|
|
18
|
-
[evt: string]: CustomEvent<any>;
|
|
19
|
-
};
|
|
20
|
-
slots: {};
|
|
21
|
-
};
|
|
22
|
-
export type TreeViewDataDrivenItemProps = typeof __propDef.props;
|
|
23
|
-
export type TreeViewDataDrivenItemEvents = typeof __propDef.events;
|
|
24
|
-
export type TreeViewDataDrivenItemSlots = typeof __propDef.slots;
|
|
25
|
-
export default class TreeViewDataDrivenItem extends SvelteComponentTyped<TreeViewDataDrivenItemProps, TreeViewDataDrivenItemEvents, TreeViewDataDrivenItemSlots> {
|
|
26
|
-
}
|
|
27
|
-
export {};
|