@skeletonlabs/skeleton 1.9.0-dev.81ab2306 → 1.9.0-dev.a8e05465
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/Ratings/Ratings.svelte +25 -15
- package/dist/components/TreeView/TreeView.svelte +31 -0
- package/dist/components/TreeView/TreeView.svelte.d.ts +43 -0
- package/dist/components/TreeView/TreeViewItem.svelte +76 -0
- package/dist/components/TreeView/TreeViewItem.svelte.d.ts +48 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/utilities/Popup/popup.js +4 -1
- package/package.json +1 -1
|
@@ -13,11 +13,13 @@ function iconClick(index) {
|
|
|
13
13
|
index: index + 1
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
+
function isFull(value2, index) {
|
|
17
|
+
return Math.floor(value2) >= index + 1;
|
|
18
|
+
}
|
|
19
|
+
function isHalf(value2, index) {
|
|
20
|
+
return value2 === index + 0.5;
|
|
21
|
+
}
|
|
16
22
|
const cBase = "w-full flex";
|
|
17
|
-
$:
|
|
18
|
-
elemInteractive = interactive ? "button" : "span";
|
|
19
|
-
$:
|
|
20
|
-
attrInteractive = interactive ? { type: "button" } : {};
|
|
21
23
|
$:
|
|
22
24
|
classesBase = `${cBase} ${text} ${fill} ${justify} ${spacing} ${$$props.class ?? ""}`;
|
|
23
25
|
</script>
|
|
@@ -25,18 +27,26 @@ $:
|
|
|
25
27
|
<div class="ratings {classesBase}" data-testid="rating-bar">
|
|
26
28
|
<!-- eslint-disable-next-line @typescript-eslint/no-unused-vars -->
|
|
27
29
|
{#each Array(max) as _, i}
|
|
28
|
-
{#if
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
{#if interactive}
|
|
31
|
+
<button class="rating-icon {regionIcon}" type="button" on:click={() => iconClick(i)}>
|
|
32
|
+
{#if isFull(value, i)}
|
|
33
|
+
<slot name="full" />
|
|
34
|
+
{:else if isHalf(value, i)}
|
|
35
|
+
<slot name="half" />
|
|
36
|
+
{:else}
|
|
37
|
+
<slot name="empty" />
|
|
38
|
+
{/if}
|
|
39
|
+
</button>
|
|
36
40
|
{:else}
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
<span class="rating-icon {regionIcon}">
|
|
42
|
+
{#if isFull(value, i)}
|
|
43
|
+
<slot name="full" />
|
|
44
|
+
{:else if isHalf(value, i)}
|
|
45
|
+
<slot name="half" />
|
|
46
|
+
{:else}
|
|
47
|
+
<slot name="empty" />
|
|
48
|
+
{/if}
|
|
49
|
+
</span>
|
|
40
50
|
{/if}
|
|
41
51
|
{/each}
|
|
42
52
|
</div>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script>import { setContext } from "svelte";
|
|
2
|
+
export let width = "w-full";
|
|
3
|
+
export let spacing = "space-y-1";
|
|
4
|
+
export let padding = "py-4 px-4";
|
|
5
|
+
export let indent = "ml-4";
|
|
6
|
+
export let hover = "hover:variant-soft";
|
|
7
|
+
export let rounded = "rounded-container-token";
|
|
8
|
+
export let caretOpen = "rotate-180";
|
|
9
|
+
export let caretClosed = "";
|
|
10
|
+
export let hyphenOpacity = "opacity-10";
|
|
11
|
+
export let regionSummary = "";
|
|
12
|
+
export let regionSymbol = "";
|
|
13
|
+
export let regionChildren = "";
|
|
14
|
+
export let labelledby = "";
|
|
15
|
+
setContext("padding", padding);
|
|
16
|
+
setContext("indent", indent);
|
|
17
|
+
setContext("hover", hover);
|
|
18
|
+
setContext("rounded", rounded);
|
|
19
|
+
setContext("caretOpen", caretOpen);
|
|
20
|
+
setContext("caretClosed", caretClosed);
|
|
21
|
+
setContext("hyphenOpacity", hyphenOpacity);
|
|
22
|
+
setContext("regionSummary", regionSummary);
|
|
23
|
+
setContext("regionSymbol", regionSymbol);
|
|
24
|
+
setContext("regionChildren", regionChildren);
|
|
25
|
+
$:
|
|
26
|
+
classesBase = `${width} ${spacing} ${$$props.class ?? ""}`;
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<div class="tree {classesBase}" data-testid="tree" role="tree" aria-multiselectable="true" aria-label={labelledby}>
|
|
30
|
+
<slot />
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
/** Provide classes to set the tree width.*/
|
|
6
|
+
width?: string | undefined;
|
|
7
|
+
/** Provide classes to set the vertical spacing between items.*/
|
|
8
|
+
spacing?: string | undefined;
|
|
9
|
+
/** Provide classes to set the tree item padding styles.*/
|
|
10
|
+
padding?: string | undefined;
|
|
11
|
+
/** Provide classes to set the tree children indentation*/
|
|
12
|
+
indent?: string | undefined;
|
|
13
|
+
/** Provide classes to set the tree item hover styles.*/
|
|
14
|
+
hover?: string | undefined;
|
|
15
|
+
/** Provide classes to set the tree item rounded styles.*/
|
|
16
|
+
rounded?: string | undefined;
|
|
17
|
+
/** Set the rotation of the item caret in the open state.*/
|
|
18
|
+
caretOpen?: string | undefined;
|
|
19
|
+
/** Set the rotation of the item caret in the closed state.*/
|
|
20
|
+
caretClosed?: string | undefined;
|
|
21
|
+
hyphenOpacity?: string | undefined;
|
|
22
|
+
/** Provide arbitrary classes to the tree item summary region.*/
|
|
23
|
+
regionSummary?: string | undefined;
|
|
24
|
+
/** Provide arbitrary classes to the symbol icon region.*/
|
|
25
|
+
regionSymbol?: string | undefined;
|
|
26
|
+
/** Provide arbitrary classes to the children region.*/
|
|
27
|
+
regionChildren?: string | undefined;
|
|
28
|
+
/** Provide the ARIA labelledby value.*/
|
|
29
|
+
labelledby?: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
events: {
|
|
32
|
+
[evt: string]: CustomEvent<any>;
|
|
33
|
+
};
|
|
34
|
+
slots: {
|
|
35
|
+
default: {};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type TreeViewProps = typeof __propDef.props;
|
|
39
|
+
export type TreeViewEvents = typeof __propDef.events;
|
|
40
|
+
export type TreeViewSlots = typeof __propDef.slots;
|
|
41
|
+
export default class TreeView extends SvelteComponentTyped<TreeViewProps, TreeViewEvents, TreeViewSlots> {
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script>import { getContext, createEventDispatcher } from "svelte";
|
|
2
|
+
export let open = false;
|
|
3
|
+
export let spacing = "space-x-4";
|
|
4
|
+
export let padding = getContext("padding");
|
|
5
|
+
export let indent = getContext("indent");
|
|
6
|
+
export let hover = getContext("hover");
|
|
7
|
+
export let rounded = getContext("rounded");
|
|
8
|
+
export let caretOpen = getContext("caretOpen");
|
|
9
|
+
export let caretClosed = getContext("caretClosed");
|
|
10
|
+
export let hyphenOpacity = getContext("hyphenOpacity");
|
|
11
|
+
export let regionSummary = "";
|
|
12
|
+
export let regionSymbol = getContext("regionSymbol");
|
|
13
|
+
export let regionChildren = getContext("regionChildren");
|
|
14
|
+
const dispatch = createEventDispatcher();
|
|
15
|
+
$:
|
|
16
|
+
dispatch("toggle", { open });
|
|
17
|
+
const cBase = "";
|
|
18
|
+
const cSummary = "list-none flex items-center cursor-pointer";
|
|
19
|
+
const cSymbol = "fill-current w-3 text-center transition-transform duration-[200ms]";
|
|
20
|
+
const cChildren = "";
|
|
21
|
+
$:
|
|
22
|
+
classesCaretState = open ? caretOpen : caretClosed;
|
|
23
|
+
$:
|
|
24
|
+
classesBase = `${cBase} ${$$props.class ?? ""}`;
|
|
25
|
+
$:
|
|
26
|
+
classesSummary = `${cSummary} ${spacing} ${rounded} ${padding} ${hover} ${regionSummary}`;
|
|
27
|
+
$:
|
|
28
|
+
classesSymbol = `${cSymbol} ${classesCaret} ${regionSymbol}`;
|
|
29
|
+
$:
|
|
30
|
+
classesCaret = `${classesCaretState}`;
|
|
31
|
+
$:
|
|
32
|
+
classesHyphen = `${hyphenOpacity}`;
|
|
33
|
+
$:
|
|
34
|
+
classesChildren = `${cChildren} ${indent} ${regionChildren}`;
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<details bind:open class="tree-item {classesBase}" data-testid="tree-item">
|
|
38
|
+
<summary
|
|
39
|
+
class="tree-item-summary {classesSummary}"
|
|
40
|
+
role="treeitem"
|
|
41
|
+
aria-selected="false"
|
|
42
|
+
aria-expanded={$$slots.children ? open : undefined}
|
|
43
|
+
on:click
|
|
44
|
+
on:keydown
|
|
45
|
+
on:keyup
|
|
46
|
+
>
|
|
47
|
+
<!-- Symbol -->
|
|
48
|
+
<div class="tree-summary-symbol {classesSymbol}">
|
|
49
|
+
{#if $$slots.children}
|
|
50
|
+
<!-- SVG Caret -->
|
|
51
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
|
52
|
+
<path
|
|
53
|
+
d="M201.4 374.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 306.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"
|
|
54
|
+
/>
|
|
55
|
+
</svg>
|
|
56
|
+
{:else}
|
|
57
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="w-3 {classesHyphen}">
|
|
58
|
+
<path d="M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z" />
|
|
59
|
+
</svg>
|
|
60
|
+
{/if}
|
|
61
|
+
</div>
|
|
62
|
+
<!-- Slot: Lead -->
|
|
63
|
+
{#if $$slots.lead}
|
|
64
|
+
<div class="tree-item-lead">
|
|
65
|
+
<slot name="lead" />
|
|
66
|
+
</div>
|
|
67
|
+
{/if}
|
|
68
|
+
<!-- Slot: Content -->
|
|
69
|
+
<div class="tree-item-content">
|
|
70
|
+
<slot />
|
|
71
|
+
</div>
|
|
72
|
+
</summary>
|
|
73
|
+
<div class="tree-item-children {classesChildren}" role="group">
|
|
74
|
+
<slot name="children" />
|
|
75
|
+
</div>
|
|
76
|
+
</details>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
/** Set open by default on load.*/
|
|
6
|
+
open?: boolean | undefined;
|
|
7
|
+
/** Provide classes to set the horizontal spacing.*/
|
|
8
|
+
spacing?: string | undefined;
|
|
9
|
+
/** Provide classes to set the tree item padding styles.*/
|
|
10
|
+
padding?: string | undefined;
|
|
11
|
+
/** Provide classes to set the tree children indentation*/
|
|
12
|
+
indent?: string | undefined;
|
|
13
|
+
/** Provide classes to set the tree item hover styles.*/
|
|
14
|
+
hover?: string | undefined;
|
|
15
|
+
/** Provide classes to set the tree item rounded styles.*/
|
|
16
|
+
rounded?: string | undefined;
|
|
17
|
+
/** Set the rotation of the item caret in the open state.*/
|
|
18
|
+
caretOpen?: string | undefined;
|
|
19
|
+
/** Set the rotation of the item caret in the closed state.*/
|
|
20
|
+
caretClosed?: string | undefined;
|
|
21
|
+
hyphenOpacity?: string | undefined;
|
|
22
|
+
/** Provide arbitrary classes to the tree item summary region.*/
|
|
23
|
+
regionSummary?: string | undefined;
|
|
24
|
+
/** Provide arbitrary classes to the symbol icon region.*/
|
|
25
|
+
regionSymbol?: string | undefined;
|
|
26
|
+
/** Provide arbitrary classes to the children region.*/
|
|
27
|
+
regionChildren?: string | undefined;
|
|
28
|
+
};
|
|
29
|
+
events: {
|
|
30
|
+
click: MouseEvent;
|
|
31
|
+
keydown: KeyboardEvent;
|
|
32
|
+
keyup: KeyboardEvent;
|
|
33
|
+
toggle: CustomEvent<any>;
|
|
34
|
+
} & {
|
|
35
|
+
[evt: string]: CustomEvent<any>;
|
|
36
|
+
};
|
|
37
|
+
slots: {
|
|
38
|
+
lead: {};
|
|
39
|
+
default: {};
|
|
40
|
+
children: {};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type TreeViewItemProps = typeof __propDef.props;
|
|
44
|
+
export type TreeViewItemEvents = typeof __propDef.events;
|
|
45
|
+
export type TreeViewItemSlots = typeof __propDef.slots;
|
|
46
|
+
export default class TreeViewItem extends SvelteComponentTyped<TreeViewItemProps, TreeViewItemEvents, TreeViewItemSlots> {
|
|
47
|
+
}
|
|
48
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export { default as TabGroup } from './components/Tab/TabGroup.svelte';
|
|
|
53
53
|
export { default as Tab } from './components/Tab/Tab.svelte';
|
|
54
54
|
export { default as TabAnchor } from './components/Tab/TabAnchor.svelte';
|
|
55
55
|
export { default as TableOfContents } from './components/TableOfContents/TableOfContents.svelte';
|
|
56
|
+
export { default as TreeView } from './components/TreeView/TreeView.svelte';
|
|
57
|
+
export { default as TreeViewItem } from './components/TreeView/TreeViewItem.svelte';
|
|
56
58
|
export { default as CodeBlock } from './utilities/CodeBlock/CodeBlock.svelte';
|
|
57
59
|
export { default as Modal } from './utilities/Modal/Modal.svelte';
|
|
58
60
|
export { default as Drawer } from './utilities/Drawer/Drawer.svelte';
|
package/dist/index.js
CHANGED
|
@@ -59,6 +59,8 @@ export { default as TabGroup } from './components/Tab/TabGroup.svelte';
|
|
|
59
59
|
export { default as Tab } from './components/Tab/Tab.svelte';
|
|
60
60
|
export { default as TabAnchor } from './components/Tab/TabAnchor.svelte';
|
|
61
61
|
export { default as TableOfContents } from './components/TableOfContents/TableOfContents.svelte';
|
|
62
|
+
export { default as TreeView } from './components/TreeView/TreeView.svelte';
|
|
63
|
+
export { default as TreeViewItem } from './components/TreeView/TreeViewItem.svelte';
|
|
62
64
|
// Utility Components
|
|
63
65
|
export { default as CodeBlock } from './utilities/CodeBlock/CodeBlock.svelte';
|
|
64
66
|
export { default as Modal } from './utilities/Modal/Modal.svelte';
|
|
@@ -108,6 +108,8 @@ export function popup(triggerNode, args) {
|
|
|
108
108
|
elemPopup.style.display = 'block';
|
|
109
109
|
elemPopup.style.opacity = '1';
|
|
110
110
|
elemPopup.style.pointerEvents = 'auto';
|
|
111
|
+
// enable popup interactions
|
|
112
|
+
elemPopup.removeAttribute('inert');
|
|
111
113
|
// Trigger Floating UI autoUpdate (open only)
|
|
112
114
|
// https://floating-ui.com/docs/autoUpdate
|
|
113
115
|
popupState.autoUpdateCleanup = autoUpdate(triggerNode, elemPopup, render);
|
|
@@ -127,7 +129,8 @@ export function popup(triggerNode, args) {
|
|
|
127
129
|
args.state({ state: popupState.open });
|
|
128
130
|
// Update the DOM
|
|
129
131
|
elemPopup.style.opacity = '0';
|
|
130
|
-
|
|
132
|
+
// disable popup interactions
|
|
133
|
+
elemPopup.setAttribute('inert', '');
|
|
131
134
|
// Cleanup Floating UI autoUpdate (close only)
|
|
132
135
|
if (popupState.autoUpdateCleanup)
|
|
133
136
|
popupState.autoUpdateCleanup();
|