@skeletonlabs/skeleton-svelte 1.0.0-next.9 → 1.1.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/README.md +1 -1
- package/dist/components/Accordion/Accordion.svelte +49 -52
- package/dist/components/Accordion/Accordion.svelte.d.ts +2 -14
- package/dist/components/Accordion/AccordionItem.svelte +43 -37
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +2 -14
- package/dist/components/Accordion/context.js +2 -1
- package/dist/components/Accordion/index.d.ts +4 -0
- package/dist/components/Accordion/index.js +1 -1
- package/dist/components/Accordion/types.d.ts +7 -9
- package/dist/components/AppBar/AppBar.svelte +43 -40
- package/dist/components/AppBar/AppBar.svelte.d.ts +2 -14
- package/dist/components/Avatar/Avatar.svelte +56 -44
- package/dist/components/Avatar/Avatar.svelte.d.ts +2 -14
- package/dist/components/Avatar/types.d.ts +3 -3
- package/dist/components/Combobox/Combobox.svelte +144 -0
- package/dist/components/Combobox/Combobox.svelte.d.ts +18 -0
- package/dist/components/Combobox/types.d.ts +64 -0
- package/dist/components/Combobox/types.js +1 -0
- package/dist/components/FileUpload/FileUpload.svelte +70 -63
- package/dist/components/FileUpload/FileUpload.svelte.d.ts +2 -14
- package/dist/components/FileUpload/types.d.ts +3 -4
- package/dist/components/Modal/Modal.svelte +87 -0
- package/dist/components/Modal/Modal.svelte.d.ts +4 -0
- package/dist/components/Modal/types.d.ts +57 -0
- package/dist/components/Modal/types.js +1 -0
- package/dist/components/Navigation/NavBar.svelte +48 -0
- package/dist/components/Navigation/NavBar.svelte.d.ts +5 -0
- package/dist/components/Navigation/NavRail.svelte +90 -0
- package/dist/components/Navigation/NavRail.svelte.d.ts +5 -0
- package/dist/components/Navigation/NavTile.svelte +87 -0
- package/dist/components/Navigation/NavTile.svelte.d.ts +5 -0
- package/dist/components/Navigation/context.js +7 -0
- package/dist/components/Navigation/index.d.ts +6 -0
- package/dist/components/{Nav → Navigation}/index.js +1 -1
- package/dist/components/{Nav → Navigation}/types.d.ts +5 -3
- package/dist/components/Pagination/Pagination.svelte +58 -67
- package/dist/components/Pagination/Pagination.svelte.d.ts +2 -14
- package/dist/components/Pagination/types.d.ts +15 -15
- package/dist/components/Popover/Popover.svelte +78 -0
- package/dist/components/Popover/Popover.svelte.d.ts +4 -0
- package/dist/components/Popover/types.d.ts +42 -0
- package/dist/components/Popover/types.js +1 -0
- package/dist/components/Progress/Progress.svelte +44 -38
- package/dist/components/Progress/Progress.svelte.d.ts +2 -14
- package/dist/components/Progress/types.d.ts +1 -1
- package/dist/components/ProgressRing/ProgressRing.svelte +58 -46
- package/dist/components/ProgressRing/ProgressRing.svelte.d.ts +2 -14
- package/dist/components/ProgressRing/types.d.ts +3 -1
- package/dist/components/Rating/Rating.svelte +101 -57
- package/dist/components/Rating/Rating.svelte.d.ts +2 -14
- package/dist/components/Rating/types.d.ts +1 -5
- package/dist/components/Segment/Segment.svelte +59 -61
- package/dist/components/Segment/Segment.svelte.d.ts +3 -15
- package/dist/components/Segment/SegmentItem.svelte +28 -21
- package/dist/components/Segment/SegmentItem.svelte.d.ts +2 -14
- package/dist/components/Segment/context.js +3 -2
- package/dist/components/Segment/index.d.ts +4 -0
- package/dist/components/Segment/index.js +1 -1
- package/dist/components/Segment/types.d.ts +8 -10
- package/dist/components/Slider/Slider.svelte +67 -72
- package/dist/components/Slider/Slider.svelte.d.ts +2 -14
- package/dist/components/Slider/types.d.ts +5 -9
- package/dist/components/Switch/Switch.svelte +75 -90
- package/dist/components/Switch/Switch.svelte.d.ts +2 -14
- package/dist/components/Switch/types.d.ts +2 -8
- package/dist/components/Tabs/Tabs.svelte +59 -0
- package/dist/components/Tabs/Tabs.svelte.d.ts +5 -0
- package/dist/components/Tabs/TabsControl.svelte +51 -0
- package/dist/components/Tabs/TabsControl.svelte.d.ts +5 -0
- package/dist/components/Tabs/TabsPanel.svelte +23 -0
- package/dist/components/Tabs/TabsPanel.svelte.d.ts +5 -0
- package/dist/components/{Tab → Tabs}/context.js +3 -2
- package/dist/components/Tabs/index.d.ts +5 -0
- package/dist/components/{Tab → Tabs}/index.js +1 -1
- package/dist/components/{Tab → Tabs}/types.d.ts +1 -3
- package/dist/components/TagsInput/TagsInput.svelte +48 -54
- package/dist/components/TagsInput/TagsInput.svelte.d.ts +2 -14
- package/dist/components/TagsInput/types.d.ts +3 -7
- package/dist/components/Toast/Toast.svelte +68 -0
- package/dist/components/Toast/Toast.svelte.d.ts +4 -0
- package/dist/components/Toast/Toaster.svelte +68 -0
- package/dist/components/Toast/Toaster.svelte.d.ts +4 -0
- package/dist/components/Toast/create-toaster.d.ts +2 -0
- package/dist/components/Toast/create-toaster.js +5 -0
- package/dist/components/Toast/types.d.ts +43 -0
- package/dist/components/Toast/types.js +1 -0
- package/dist/components/Tooltip/Tooltip.svelte +79 -0
- package/dist/components/Tooltip/Tooltip.svelte.d.ts +4 -0
- package/dist/components/Tooltip/types.d.ts +44 -0
- package/dist/components/Tooltip/types.js +1 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +12 -3
- package/dist/internal/create-context.d.ts +6 -0
- package/dist/internal/create-context.js +3 -3
- package/dist/internal/test-utils.d.ts +3 -0
- package/dist/internal/test-utils.js +9 -0
- package/package.json +43 -54
- package/dist/components/Accordion/Accordion.svelte.spec.d.ts +0 -1
- package/dist/components/Accordion/Accordion.svelte.spec.js +0 -4
- package/dist/components/Nav/NavBar.svelte +0 -45
- package/dist/components/Nav/NavBar.svelte.d.ts +0 -17
- package/dist/components/Nav/NavRail.svelte +0 -79
- package/dist/components/Nav/NavRail.svelte.d.ts +0 -17
- package/dist/components/Nav/NavTile.svelte +0 -76
- package/dist/components/Nav/NavTile.svelte.d.ts +0 -17
- package/dist/components/Nav/context.js +0 -7
- package/dist/components/Tab/Tabs.svelte +0 -65
- package/dist/components/Tab/Tabs.svelte.d.ts +0 -17
- package/dist/components/Tab/TabsControl.svelte +0 -42
- package/dist/components/Tab/TabsControl.svelte.d.ts +0 -17
- package/dist/components/Tab/TabsPanel.svelte +0 -18
- package/dist/components/Tab/TabsPanel.svelte.d.ts +0 -17
- package/dist/internal/noop.d.ts +0 -1
- package/dist/internal/noop.js +0 -2
- package/dist/internal/snippets.d.ts +0 -3
- package/dist/internal/snippets.js +0 -45
- package/dist/internal/use-id.d.ts +0 -2
- package/dist/internal/use-id.js +0 -5
- /package/dist/components/{Nav → Navigation}/context.d.ts +0 -0
- /package/dist/components/{Nav → Navigation}/types.js +0 -0
- /package/dist/components/{Tab → Tabs}/context.d.ts +0 -0
- /package/dist/components/{Tab → Tabs}/types.js +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import * as tooltip from '@zag-js/tooltip';
|
|
3
|
+
export interface TooltipProps extends Omit<tooltip.Props, 'id'> {
|
|
4
|
+
/** Enable display of the popover arrow. */
|
|
5
|
+
arrow?: boolean;
|
|
6
|
+
/** Set z-index for the positioner. */
|
|
7
|
+
zIndex?: string;
|
|
8
|
+
/** Set base classes for the root element. */
|
|
9
|
+
base?: string;
|
|
10
|
+
/** Provide arbitrary classes for the root element. */
|
|
11
|
+
classes?: string;
|
|
12
|
+
/** Set base styles for the trigger. */
|
|
13
|
+
triggerBase?: string;
|
|
14
|
+
/** Set background styles for the trigger. */
|
|
15
|
+
triggerBackground?: string;
|
|
16
|
+
/** Provide arbitrary styles for the trigger. */
|
|
17
|
+
triggerClasses?: string;
|
|
18
|
+
/** Set the aria-label for the trigger. */
|
|
19
|
+
triggerAriaLabel?: string;
|
|
20
|
+
/** Set base classes for the positioner. */
|
|
21
|
+
positionerBase?: string;
|
|
22
|
+
/** Provide arbitrary classes for the positioner. */
|
|
23
|
+
positionerClasses?: string;
|
|
24
|
+
/** Set base styles for the content. */
|
|
25
|
+
contentBase?: string;
|
|
26
|
+
/** Set background styles for the content. */
|
|
27
|
+
contentBackground?: string;
|
|
28
|
+
/** Provide arbitrary styles for the content. */
|
|
29
|
+
contentClasses?: string;
|
|
30
|
+
/** Set base classes for the arrow. */
|
|
31
|
+
arrowBase?: string;
|
|
32
|
+
/** Set background classes for the arrow. */
|
|
33
|
+
arrowBackground?: string;
|
|
34
|
+
/** Provide arbitrary classes for the arrow. */
|
|
35
|
+
arrowClasses?: string;
|
|
36
|
+
/** Provide the template contents inside the trigger button. */
|
|
37
|
+
trigger?: Snippet;
|
|
38
|
+
/** Provide the template contents of the tooltip itself. */
|
|
39
|
+
content?: Snippet;
|
|
40
|
+
/** Handle the tooltip button hover event. */
|
|
41
|
+
onmouseover?: () => void;
|
|
42
|
+
/** Handle the tooltip button click event. */
|
|
43
|
+
onclick?: () => void;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import * as tooltip from '@zag-js/tooltip';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,17 @@ export { default as FileUpload } from './components/FileUpload/FileUpload.svelte
|
|
|
5
5
|
export { default as Pagination } from './components/Pagination/Pagination.svelte';
|
|
6
6
|
export { default as Progress } from './components/Progress/Progress.svelte';
|
|
7
7
|
export { default as ProgressRing } from './components/ProgressRing/ProgressRing.svelte';
|
|
8
|
-
export { default as
|
|
8
|
+
export { default as Navigation } from './components/Navigation/index.js';
|
|
9
9
|
export { default as Segment } from './components/Segment/index.js';
|
|
10
10
|
export { default as Slider } from './components/Slider/Slider.svelte';
|
|
11
11
|
export { default as Switch } from './components/Switch/Switch.svelte';
|
|
12
|
-
export { default as Tabs } from './components/
|
|
12
|
+
export { default as Tabs } from './components/Tabs/index.js';
|
|
13
13
|
export { default as TagsInput } from './components/TagsInput/TagsInput.svelte';
|
|
14
|
+
export { default as Toaster } from './components/Toast/Toaster.svelte';
|
|
15
|
+
export { createToaster } from './components/Toast/create-toaster.js';
|
|
14
16
|
export { default as Rating } from './components/Rating/index.js';
|
|
15
17
|
export type { FileUploadApi } from './components/FileUpload/types.js';
|
|
18
|
+
export { default as Combobox } from './components/Combobox/Combobox.svelte';
|
|
19
|
+
export { default as Popover } from './components/Popover/Popover.svelte';
|
|
20
|
+
export { default as Tooltip } from './components/Tooltip/Tooltip.svelte';
|
|
21
|
+
export { default as Modal } from './components/Modal/Modal.svelte';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Exports for skeleton-svelte package
|
|
2
2
|
// REMINDER
|
|
3
3
|
// Do not export parent/child components. Use the dot-notation composition pattern:
|
|
4
|
-
// https://
|
|
4
|
+
// https://skeleton.dev/docs/resources/contribute/components#dot-notation-syntax
|
|
5
5
|
// (See Accordion, Nav, and Tabs for examples)
|
|
6
6
|
// Components
|
|
7
7
|
export { default as Accordion } from './components/Accordion/index.js';
|
|
@@ -11,10 +11,19 @@ export { default as FileUpload } from './components/FileUpload/FileUpload.svelte
|
|
|
11
11
|
export { default as Pagination } from './components/Pagination/Pagination.svelte';
|
|
12
12
|
export { default as Progress } from './components/Progress/Progress.svelte';
|
|
13
13
|
export { default as ProgressRing } from './components/ProgressRing/ProgressRing.svelte';
|
|
14
|
-
export { default as
|
|
14
|
+
export { default as Navigation } from './components/Navigation/index.js';
|
|
15
15
|
export { default as Segment } from './components/Segment/index.js';
|
|
16
16
|
export { default as Slider } from './components/Slider/Slider.svelte';
|
|
17
17
|
export { default as Switch } from './components/Switch/Switch.svelte';
|
|
18
|
-
export { default as Tabs } from './components/
|
|
18
|
+
export { default as Tabs } from './components/Tabs/index.js';
|
|
19
19
|
export { default as TagsInput } from './components/TagsInput/TagsInput.svelte';
|
|
20
|
+
export { default as Toaster } from './components/Toast/Toaster.svelte';
|
|
21
|
+
export { createToaster } from './components/Toast/create-toaster.js';
|
|
20
22
|
export { default as Rating } from './components/Rating/index.js';
|
|
23
|
+
// Temporary Features ---
|
|
24
|
+
// The following will be removed or replaced in the future.
|
|
25
|
+
// Popvers
|
|
26
|
+
export { default as Combobox } from './components/Combobox/Combobox.svelte';
|
|
27
|
+
export { default as Popover } from './components/Popover/Popover.svelte';
|
|
28
|
+
export { default as Tooltip } from './components/Tooltip/Tooltip.svelte';
|
|
29
|
+
export { default as Modal } from './components/Modal/Modal.svelte';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a context with a default value
|
|
3
|
+
* @param defaultValue The default value that will be returned if the context is not set
|
|
4
|
+
* @returns [set, get, key] The setter, getter and key for the context, the getter returns the default value if the context is not set
|
|
5
|
+
*/
|
|
6
|
+
export declare function createContext<T>(defaultValue: T): readonly [(value: T) => T, () => T, symbol];
|
|
@@ -5,8 +5,8 @@ import { getContext, setContext } from 'svelte';
|
|
|
5
5
|
* @returns [set, get, key] The setter, getter and key for the context, the getter returns the default value if the context is not set
|
|
6
6
|
*/
|
|
7
7
|
export function createContext(defaultValue) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
var key = Symbol();
|
|
9
|
+
var set = function (value) { return setContext(key, value); };
|
|
10
|
+
var get = function () { var _a; return (_a = getContext(key)) !== null && _a !== void 0 ? _a : defaultValue; };
|
|
11
11
|
return [set, get, key];
|
|
12
12
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRawSnippet } from 'svelte';
|
|
2
|
+
/** Use `mockSnippet(value)` to create `<span>{value}</span>` snippet content. */
|
|
3
|
+
export function mockSnippet(key) {
|
|
4
|
+
return createRawSnippet(function () {
|
|
5
|
+
return {
|
|
6
|
+
render: function () { return "<span>".concat(key, "</span>"); }
|
|
7
|
+
};
|
|
8
|
+
});
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skeletonlabs/skeleton-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "The Svelte package for Skeleton.",
|
|
5
5
|
"author": "endigo9740 <chris@skeletonlabs.dev>",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,67 +13,56 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
-
"!dist/**/*.test.*"
|
|
17
|
-
"!dist/**/*.spec.*",
|
|
18
|
-
"./dist/**/*.svelte",
|
|
19
|
-
"./dist/**/*.js",
|
|
20
|
-
"./dist/**/*.d.ts",
|
|
21
|
-
"./dist/**/*.cjs",
|
|
22
|
-
"./dist/**/*.d.cts"
|
|
16
|
+
"!dist/**/*.test.*"
|
|
23
17
|
],
|
|
24
18
|
"dependencies": {
|
|
25
|
-
"@zag-js/accordion": "^
|
|
26
|
-
"@zag-js/avatar": "^
|
|
27
|
-
"@zag-js/
|
|
28
|
-
"@zag-js/
|
|
29
|
-
"@zag-js/
|
|
30
|
-
"@zag-js/
|
|
31
|
-
"@zag-js/
|
|
32
|
-
"@zag-js/
|
|
33
|
-
"@zag-js/
|
|
34
|
-
"@zag-js/
|
|
35
|
-
"@zag-js/
|
|
36
|
-
"@zag-js/
|
|
19
|
+
"@zag-js/accordion": "^1.7.0",
|
|
20
|
+
"@zag-js/avatar": "^1.7.0",
|
|
21
|
+
"@zag-js/combobox": "^1.7.0",
|
|
22
|
+
"@zag-js/dialog": "^1.7.0",
|
|
23
|
+
"@zag-js/file-upload": "^1.7.0",
|
|
24
|
+
"@zag-js/pagination": "^1.7.0",
|
|
25
|
+
"@zag-js/popover": "^1.7.0",
|
|
26
|
+
"@zag-js/progress": "^1.7.0",
|
|
27
|
+
"@zag-js/radio-group": "^1.7.0",
|
|
28
|
+
"@zag-js/rating-group": "^1.7.0",
|
|
29
|
+
"@zag-js/slider": "^1.7.0",
|
|
30
|
+
"@zag-js/svelte": "^1.7.0",
|
|
31
|
+
"@zag-js/switch": "^1.7.0",
|
|
32
|
+
"@zag-js/tabs": "^1.7.0",
|
|
33
|
+
"@zag-js/tags-input": "^1.7.0",
|
|
34
|
+
"@zag-js/toast": "^1.7.0",
|
|
35
|
+
"@zag-js/tooltip": "^1.7.0"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
39
|
-
"svelte": "^5.
|
|
38
|
+
"svelte": "^5.20.0"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@sveltejs/
|
|
44
|
-
"@sveltejs/
|
|
45
|
-
"@sveltejs/
|
|
46
|
-
"@
|
|
47
|
-
"@tailwindcss/
|
|
48
|
-
"@testing-library/jest-dom": "^6.
|
|
49
|
-
"@testing-library/svelte": "^
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"typescript": "^5.5.4",
|
|
61
|
-
"vite": "^5.3.4",
|
|
62
|
-
"vitest": "^1.6.0",
|
|
63
|
-
"vite-plugin-tw-plugin-watcher": "0.0.1-next.0",
|
|
64
|
-
"@skeletonlabs/skeleton": "3.0.0-next.4"
|
|
41
|
+
"@sveltejs/adapter-auto": "^5.0.0",
|
|
42
|
+
"@sveltejs/kit": "^2.20.2",
|
|
43
|
+
"@sveltejs/package": "^2.3.10",
|
|
44
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
45
|
+
"@tailwindcss/forms": "^0.5.10",
|
|
46
|
+
"@tailwindcss/vite": "^4.0.17",
|
|
47
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
48
|
+
"@testing-library/svelte": "^5.2.7",
|
|
49
|
+
"jsdom": "^26.0.0",
|
|
50
|
+
"publint": "^0.3.9",
|
|
51
|
+
"svelte": "^5.25.3",
|
|
52
|
+
"svelte-check": "^4.1.5",
|
|
53
|
+
"tailwindcss": "^4.0.17",
|
|
54
|
+
"tslib": "^2.8.1",
|
|
55
|
+
"typescript": "^5.8.2",
|
|
56
|
+
"vite": "^6.2.4",
|
|
57
|
+
"vitest": "3.1.1",
|
|
58
|
+
"@skeletonlabs/skeleton": "3.1.2"
|
|
65
59
|
},
|
|
66
60
|
"type": "module",
|
|
67
61
|
"scripts": {
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
74
|
-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
75
|
-
"test": "pnpm run \"/test:/\"",
|
|
76
|
-
"test:unit": "vitest",
|
|
77
|
-
"sync": "svelte-kit sync"
|
|
62
|
+
"build": "svelte-package --input src --output dist",
|
|
63
|
+
"dev": "svelte-package --input src --output dist --watch",
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:watch": "vitest run --watch",
|
|
66
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
|
|
78
67
|
}
|
|
79
68
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { setNavigationContext } from "./context.js";
|
|
2
|
-
let {
|
|
3
|
-
value = $bindable(""),
|
|
4
|
-
// Root
|
|
5
|
-
base = "h-full flex flex-col",
|
|
6
|
-
background = "preset-filled-surface-100-900",
|
|
7
|
-
width = "min-w-[320px] w-full",
|
|
8
|
-
height = "h-20",
|
|
9
|
-
padding = "p-1",
|
|
10
|
-
classes = "",
|
|
11
|
-
// Tiles
|
|
12
|
-
tilesBase = "flex-1 flex",
|
|
13
|
-
tilesFlexDirection = "",
|
|
14
|
-
tilesJustify = "justify-center",
|
|
15
|
-
tilesItems = "items-center",
|
|
16
|
-
tilesGap = "gap-1",
|
|
17
|
-
tilesClasses = "",
|
|
18
|
-
// Events
|
|
19
|
-
onchange,
|
|
20
|
-
// Snippets
|
|
21
|
-
children
|
|
22
|
-
} = $props();
|
|
23
|
-
function onSelectionHandler(id) {
|
|
24
|
-
value = id;
|
|
25
|
-
if (onchange) onchange(id);
|
|
26
|
-
}
|
|
27
|
-
setNavigationContext({
|
|
28
|
-
parent: "bar",
|
|
29
|
-
get value() {
|
|
30
|
-
return value;
|
|
31
|
-
},
|
|
32
|
-
expanded: false,
|
|
33
|
-
onSelectionHandler
|
|
34
|
-
});
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<!-- @component Provides a horizontal navigation interface. -->
|
|
38
|
-
|
|
39
|
-
<aside class="{base} {background} {width} {height} {padding} {classes}" data-testid="nav-bar">
|
|
40
|
-
{#if children}
|
|
41
|
-
<nav class="{tilesBase} {tilesFlexDirection} {tilesJustify} {tilesItems} {tilesGap} {tilesClasses}">
|
|
42
|
-
{@render children()}
|
|
43
|
-
</nav>
|
|
44
|
-
{/if}
|
|
45
|
-
</aside>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { NavBarProps } from './types.js';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports;
|
|
10
|
-
z_$$bindings?: Bindings;
|
|
11
|
-
}
|
|
12
|
-
/** Provides a horizontal navigation interface. */
|
|
13
|
-
declare const NavBar: $$__sveltets_2_IsomorphicComponent<NavBarProps, {
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
}, {}, {}, "value">;
|
|
16
|
-
type NavBar = InstanceType<typeof NavBar>;
|
|
17
|
-
export default NavBar;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { setNavigationContext } from "./context.js";
|
|
2
|
-
let {
|
|
3
|
-
value = $bindable(""),
|
|
4
|
-
expanded = false,
|
|
5
|
-
// Root
|
|
6
|
-
base = "h-full flex flex-col",
|
|
7
|
-
background = "preset-filled-surface-100-900",
|
|
8
|
-
padding = "p-1",
|
|
9
|
-
width = "w-24",
|
|
10
|
-
widthExpanded = "w-64",
|
|
11
|
-
height = "h-full",
|
|
12
|
-
classes = "",
|
|
13
|
-
// Header
|
|
14
|
-
headerBase = "flex",
|
|
15
|
-
headerFlexDirection = "flex-col",
|
|
16
|
-
headerJustify = "justify-center",
|
|
17
|
-
headerItems = "items-center",
|
|
18
|
-
headerGap = "gap-1",
|
|
19
|
-
headerClasses = "",
|
|
20
|
-
// Tiles
|
|
21
|
-
tilesBase = "flex-1 flex",
|
|
22
|
-
tilesFlexDirection = "flex-col",
|
|
23
|
-
tilesJustify = "justify-center",
|
|
24
|
-
tilesItems = "items-center",
|
|
25
|
-
tilesGap = "gap-1",
|
|
26
|
-
tilesClasses = "",
|
|
27
|
-
// Footer
|
|
28
|
-
footerBase = "flex",
|
|
29
|
-
footerFlexDirection = "flex-col",
|
|
30
|
-
footerJustify = "justify-center",
|
|
31
|
-
footerItems = "items-center",
|
|
32
|
-
footerGap = "gap-1",
|
|
33
|
-
footerClasses = "",
|
|
34
|
-
// Events
|
|
35
|
-
onchange,
|
|
36
|
-
// Snippets
|
|
37
|
-
header,
|
|
38
|
-
tiles,
|
|
39
|
-
footer
|
|
40
|
-
} = $props();
|
|
41
|
-
function onSelectionHandler(id) {
|
|
42
|
-
value = id;
|
|
43
|
-
if (onchange) onchange(id);
|
|
44
|
-
}
|
|
45
|
-
setNavigationContext({
|
|
46
|
-
parent: "rail",
|
|
47
|
-
get value() {
|
|
48
|
-
return value;
|
|
49
|
-
},
|
|
50
|
-
get expanded() {
|
|
51
|
-
return expanded;
|
|
52
|
-
},
|
|
53
|
-
onSelectionHandler
|
|
54
|
-
});
|
|
55
|
-
let rxWidth = $derived(expanded ? widthExpanded : width);
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<!-- @component Provides a vertical navigation interface. -->
|
|
59
|
-
|
|
60
|
-
<aside class="{base} {background} {height} {padding} {rxWidth} {classes}" data-testid="nav-rail">
|
|
61
|
-
<!-- Header -->
|
|
62
|
-
{#if header}
|
|
63
|
-
<header class="{headerBase} {headerFlexDirection} {headerJustify} {headerItems} {headerGap} {headerClasses}">
|
|
64
|
-
{@render header()}
|
|
65
|
-
</header>
|
|
66
|
-
{/if}
|
|
67
|
-
<!-- Tiles -->
|
|
68
|
-
{#if tiles}
|
|
69
|
-
<nav class="{tilesBase} {tilesFlexDirection} {tilesJustify} {tilesItems} {tilesGap} {tilesClasses}">
|
|
70
|
-
{@render tiles()}
|
|
71
|
-
</nav>
|
|
72
|
-
{/if}
|
|
73
|
-
<!-- Footer -->
|
|
74
|
-
{#if footer}
|
|
75
|
-
<footer class="{footerBase} {footerFlexDirection} {footerJustify} {footerItems} {footerGap} {footerClasses}">
|
|
76
|
-
{@render footer()}
|
|
77
|
-
</footer>
|
|
78
|
-
{/if}
|
|
79
|
-
</aside>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { NavRailProps } from './types.js';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports;
|
|
10
|
-
z_$$bindings?: Bindings;
|
|
11
|
-
}
|
|
12
|
-
/** Provides a vertical navigation interface. */
|
|
13
|
-
declare const NavRail: $$__sveltets_2_IsomorphicComponent<NavRailProps, {
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
}, {}, {}, "value">;
|
|
16
|
-
type NavRail = InstanceType<typeof NavRail>;
|
|
17
|
-
export default NavRail;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { getNavigationContext } from "./context.js";
|
|
2
|
-
let {
|
|
3
|
-
id,
|
|
4
|
-
href,
|
|
5
|
-
target,
|
|
6
|
-
label,
|
|
7
|
-
labelExpanded,
|
|
8
|
-
title,
|
|
9
|
-
selected = false,
|
|
10
|
-
// Root
|
|
11
|
-
base = "flex items-center",
|
|
12
|
-
width = "w-full",
|
|
13
|
-
aspect = "aspect-square",
|
|
14
|
-
background = "",
|
|
15
|
-
hover = "hover:preset-filled-surface-50-950",
|
|
16
|
-
active = "preset-filled-primary-500",
|
|
17
|
-
padding = "p-2",
|
|
18
|
-
gap = "gap-1",
|
|
19
|
-
rounded = "rounded-container",
|
|
20
|
-
classes = "flex-col justify-center",
|
|
21
|
-
// Expanded
|
|
22
|
-
expandedPadding = "py-3 px-4",
|
|
23
|
-
expandedGap = "gap-4",
|
|
24
|
-
expandedClasses = "",
|
|
25
|
-
// Label (base)
|
|
26
|
-
labelBase = "type-scale-1",
|
|
27
|
-
labelClasses = "",
|
|
28
|
-
// Label (expanded)
|
|
29
|
-
labelExpandedBase = "",
|
|
30
|
-
labelExpandedClasses = "",
|
|
31
|
-
// Events
|
|
32
|
-
onclick,
|
|
33
|
-
// Snippets
|
|
34
|
-
children
|
|
35
|
-
} = $props();
|
|
36
|
-
const ctx = getNavigationContext();
|
|
37
|
-
const element = $derived(href ? "a" : "button");
|
|
38
|
-
const type = $derived(href ? void 0 : "button");
|
|
39
|
-
const role = $derived(href ? void 0 : "button");
|
|
40
|
-
const rxSize = $derived(ctx.parent === "bar" ? `h-full` : `${aspect}`);
|
|
41
|
-
const classesCollapsed = $derived(`${rxSize} ${padding} ${gap} ${classes}`);
|
|
42
|
-
const classesExtended = $derived(`${expandedPadding} ${expandedGap} ${expandedClasses}`);
|
|
43
|
-
const rxMode = $derived(ctx.expanded ? classesExtended : classesCollapsed);
|
|
44
|
-
const rxBackground = $derived(selected || ctx.value === id ? active : `${background} ${hover}`);
|
|
45
|
-
function onClickHandler() {
|
|
46
|
-
if (onclick && !id) throw new Error("No ID was provided");
|
|
47
|
-
if (onclick && id) onclick(id);
|
|
48
|
-
if (ctx.onSelectionHandler && id) ctx.onSelectionHandler(id);
|
|
49
|
-
}
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
<!-- @component An individual Navgiation component tile. -->
|
|
53
|
-
|
|
54
|
-
<svelte:element
|
|
55
|
-
this={element}
|
|
56
|
-
class="{base} {width} {rounded} {rxBackground} {rxMode}"
|
|
57
|
-
{href}
|
|
58
|
-
{target}
|
|
59
|
-
{type}
|
|
60
|
-
{title}
|
|
61
|
-
{role}
|
|
62
|
-
onclick={onClickHandler}
|
|
63
|
-
tabindex="0"
|
|
64
|
-
data-testid="nav-tile"
|
|
65
|
-
>
|
|
66
|
-
<!-- Icon -->
|
|
67
|
-
{#if children}<div>{@render children()}</div>{/if}
|
|
68
|
-
<!-- Label (base) -->
|
|
69
|
-
{#if label && !ctx.expanded}
|
|
70
|
-
<div class="{labelBase} {labelClasses}">{label}</div>
|
|
71
|
-
{/if}
|
|
72
|
-
<!-- Label (expanded) -->
|
|
73
|
-
{#if labelExpanded && ctx.expanded}
|
|
74
|
-
<div class="{labelExpandedBase} {labelExpandedClasses}">{labelExpanded}</div>
|
|
75
|
-
{/if}
|
|
76
|
-
</svelte:element>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { NavTileProps } from './types.js';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports;
|
|
10
|
-
z_$$bindings?: Bindings;
|
|
11
|
-
}
|
|
12
|
-
/** An individual Navgiation component tile. */
|
|
13
|
-
declare const NavTile: $$__sveltets_2_IsomorphicComponent<NavTileProps, {
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
}, {}, {}, "">;
|
|
16
|
-
type NavTile = InstanceType<typeof NavTile>;
|
|
17
|
-
export default NavTile;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import * as tabs from "@zag-js/tabs";
|
|
2
|
-
import { useMachine, normalizeProps } from "@zag-js/svelte";
|
|
3
|
-
import { setTabContext } from "./context.js";
|
|
4
|
-
import { useId } from "../../internal/use-id.js";
|
|
5
|
-
let {
|
|
6
|
-
value = $bindable(""),
|
|
7
|
-
fluid = false,
|
|
8
|
-
// Root
|
|
9
|
-
base = "w-full",
|
|
10
|
-
classes = "",
|
|
11
|
-
// List
|
|
12
|
-
listBase = "flex",
|
|
13
|
-
listJustify = "justify-start",
|
|
14
|
-
listBorder = "border-b border-surface-200-800",
|
|
15
|
-
listMargin = "mb-4",
|
|
16
|
-
listGap = "gap-2",
|
|
17
|
-
listClasses = "",
|
|
18
|
-
// Content
|
|
19
|
-
contentBase = "",
|
|
20
|
-
contentClasses = "",
|
|
21
|
-
// Snippets
|
|
22
|
-
list,
|
|
23
|
-
content,
|
|
24
|
-
// Zag
|
|
25
|
-
...zagProps
|
|
26
|
-
} = $props();
|
|
27
|
-
const [snapshot, send] = useMachine(
|
|
28
|
-
tabs.machine({
|
|
29
|
-
id: useId(),
|
|
30
|
-
onValueChange(details) {
|
|
31
|
-
value = details.value;
|
|
32
|
-
}
|
|
33
|
-
}),
|
|
34
|
-
{
|
|
35
|
-
context: {
|
|
36
|
-
...zagProps,
|
|
37
|
-
get value() {
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
const api = $derived(tabs.connect(snapshot, send, normalizeProps));
|
|
44
|
-
setTabContext({
|
|
45
|
-
get api() {
|
|
46
|
-
return api;
|
|
47
|
-
},
|
|
48
|
-
get fluid() {
|
|
49
|
-
return fluid;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<!-- @component Use tabs to quickly switch between different views and pages. -->
|
|
55
|
-
|
|
56
|
-
<div {...api.getRootProps()} class="{base} {classes}" data-testid="tabs">
|
|
57
|
-
<!-- List -->
|
|
58
|
-
<div {...api.getListProps()} class="{listBase} {listJustify} {listBorder} {listMargin} {listGap} {listClasses}" data-testid="tabs-list">
|
|
59
|
-
{@render list?.()}
|
|
60
|
-
</div>
|
|
61
|
-
<!-- Content -->
|
|
62
|
-
<div class="{contentBase} {contentClasses}" data-testid="tabs-content">
|
|
63
|
-
{@render content?.()}
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { TabsProps } from './types.js';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports;
|
|
10
|
-
z_$$bindings?: Bindings;
|
|
11
|
-
}
|
|
12
|
-
/** Use tabs to quickly switch between different views and pages. */
|
|
13
|
-
declare const Tabs: $$__sveltets_2_IsomorphicComponent<TabsProps, {
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
}, {}, {}, "value">;
|
|
16
|
-
type Tabs = InstanceType<typeof Tabs>;
|
|
17
|
-
export default Tabs;
|