@skeletonlabs/skeleton-svelte 0.0.0 → 1.0.0-next.1
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/LICENSE +21 -0
- package/README.md +22 -0
- package/dist/components/Accordion/Accordion.svelte +60 -0
- package/dist/components/Accordion/Accordion.svelte.d.ts +18 -0
- package/dist/components/Accordion/AccordionItem.svelte +75 -0
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +16 -0
- package/dist/components/Accordion/types.d.ts +76 -0
- package/dist/components/Accordion/types.js +1 -0
- package/dist/components/AppBar/AppBar.svelte +69 -0
- package/dist/components/AppBar/AppBar.svelte.d.ts +16 -0
- package/dist/components/AppBar/types.d.ts +61 -0
- package/dist/components/AppBar/types.js +1 -0
- package/dist/components/Avatar/Avatar.svelte +30 -0
- package/dist/components/Avatar/Avatar.svelte.d.ts +16 -0
- package/dist/components/Avatar/types.d.ts +31 -0
- package/dist/components/Avatar/types.js +1 -0
- package/dist/components/Progress/Progress.svelte +41 -0
- package/dist/components/Progress/Progress.svelte.d.ts +16 -0
- package/dist/components/Progress/types.d.ts +32 -0
- package/dist/components/Progress/types.js +1 -0
- package/dist/components/Tab/Tabs.svelte +30 -0
- package/dist/components/Tab/Tabs.svelte.d.ts +16 -0
- package/dist/components/Tab/TabsControl.svelte +127 -0
- package/dist/components/Tab/TabsControl.svelte.d.ts +16 -0
- package/dist/components/Tab/TabsPanel.svelte +20 -0
- package/dist/components/Tab/TabsPanel.svelte.d.ts +16 -0
- package/dist/components/Tab/index.d.ts +8 -0
- package/dist/components/Tab/index.js +4 -0
- package/dist/components/Tab/types.d.ts +105 -0
- package/dist/components/Tab/types.js +1 -0
- package/dist/components/Test/Test.svelte +7 -0
- package/dist/components/Test/Test.svelte.d.ts +14 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/utils.svelte.d.ts +5 -0
- package/dist/utils.svelte.js +10 -0
- package/package.json +70 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Skeleton Labs, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Skeleton-Svelte
|
|
2
|
+
|
|
3
|
+
Provides all Svelte features for [Skeleton](https://skeleton.dev/).
|
|
4
|
+
|
|
5
|
+
## Project
|
|
6
|
+
|
|
7
|
+
This project has been created using a [SvelteKit](https://kit.svelte.dev/) project library.
|
|
8
|
+
|
|
9
|
+
## Exports
|
|
10
|
+
|
|
11
|
+
Library exports are contained within `/src/lib/index.ts`
|
|
12
|
+
|
|
13
|
+
## Dev
|
|
14
|
+
|
|
15
|
+
To run locally, follow the following instructions:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
pnpm i
|
|
19
|
+
pnpm dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Then point your browser at http://localhost:5173/
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts" context="module">const accordionCtxKey = Symbol();
|
|
2
|
+
export const getAccordionCtx = () => getContext(accordionCtxKey);
|
|
3
|
+
export const setAccordionCtx = (ctx) => setContext(accordionCtxKey, ctx);
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<script lang="ts">import { getContext, setContext } from "svelte";
|
|
7
|
+
let {
|
|
8
|
+
multiple = false,
|
|
9
|
+
value = $bindable([]),
|
|
10
|
+
animDuration = 200,
|
|
11
|
+
// Root
|
|
12
|
+
base = "",
|
|
13
|
+
padding = "",
|
|
14
|
+
spaceY = "space-y-2",
|
|
15
|
+
rounded = "rounded",
|
|
16
|
+
width = "w-full",
|
|
17
|
+
classes = "",
|
|
18
|
+
// Snippets
|
|
19
|
+
children,
|
|
20
|
+
iconOpen,
|
|
21
|
+
iconClosed
|
|
22
|
+
} = $props();
|
|
23
|
+
function open(id) {
|
|
24
|
+
value = multiple ? [...value, id] : [id];
|
|
25
|
+
}
|
|
26
|
+
function close(id) {
|
|
27
|
+
value = value.filter((_id) => _id !== id);
|
|
28
|
+
}
|
|
29
|
+
function toggle(id) {
|
|
30
|
+
isOpen(id) ? close(id) : open(id);
|
|
31
|
+
}
|
|
32
|
+
function isOpen(id) {
|
|
33
|
+
return value.includes(id);
|
|
34
|
+
}
|
|
35
|
+
setAccordionCtx({
|
|
36
|
+
open,
|
|
37
|
+
close,
|
|
38
|
+
toggle,
|
|
39
|
+
isOpen,
|
|
40
|
+
get animDuration() {
|
|
41
|
+
return animDuration;
|
|
42
|
+
},
|
|
43
|
+
get iconOpen() {
|
|
44
|
+
return iconOpen;
|
|
45
|
+
},
|
|
46
|
+
get iconClosed() {
|
|
47
|
+
return iconClosed;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
$effect(() => {
|
|
51
|
+
if (!multiple && value.length > 1)
|
|
52
|
+
value = [value[0]];
|
|
53
|
+
});
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<!-- @component An Accordion parent component. -->
|
|
57
|
+
|
|
58
|
+
<div class="{base} {padding} {spaceY} {rounded} {width} {classes}" data-testid="accordion">
|
|
59
|
+
{@render children()}
|
|
60
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
export declare const getAccordionCtx: () => AccordionContext;
|
|
3
|
+
export declare const setAccordionCtx: (ctx: AccordionContext) => AccordionContext;
|
|
4
|
+
import type { AccordionContext, AccordionProps } from './types.js';
|
|
5
|
+
declare const __propDef: {
|
|
6
|
+
props: AccordionProps;
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
type AccordionProps_ = typeof __propDef.props;
|
|
13
|
+
export { AccordionProps_ as AccordionProps };
|
|
14
|
+
export type AccordionEvents = typeof __propDef.events;
|
|
15
|
+
export type AccordionSlots = typeof __propDef.slots;
|
|
16
|
+
/** An Accordion parent component. */
|
|
17
|
+
export default class Accordion extends SvelteComponent<AccordionProps_, AccordionEvents, AccordionSlots> {
|
|
18
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">import { getAccordionCtx } from "./Accordion.svelte";
|
|
2
|
+
import { slide } from "svelte/transition";
|
|
3
|
+
let {
|
|
4
|
+
id = "",
|
|
5
|
+
disabled = false,
|
|
6
|
+
// Root
|
|
7
|
+
base = "",
|
|
8
|
+
spaceY = "",
|
|
9
|
+
classes = "",
|
|
10
|
+
// Control
|
|
11
|
+
controlBase = "flex text-start items-center space-x-4 w-full",
|
|
12
|
+
controlHover = "hover:preset-tonal-primary",
|
|
13
|
+
controlPadding = "py-2 px-4",
|
|
14
|
+
controlRounded = "rounded",
|
|
15
|
+
controlClasses = "",
|
|
16
|
+
// Icons
|
|
17
|
+
iconsBase = "",
|
|
18
|
+
// Panel
|
|
19
|
+
panelBase = "",
|
|
20
|
+
panelPadding = "py-2 px-4",
|
|
21
|
+
panelRounded = "",
|
|
22
|
+
panelClasses = "",
|
|
23
|
+
// Events
|
|
24
|
+
onclick = () => {
|
|
25
|
+
},
|
|
26
|
+
// Snippets
|
|
27
|
+
control,
|
|
28
|
+
controlLead,
|
|
29
|
+
panel
|
|
30
|
+
} = $props();
|
|
31
|
+
function clickHandler(event) {
|
|
32
|
+
ctx.toggle(id);
|
|
33
|
+
onclick(event);
|
|
34
|
+
}
|
|
35
|
+
const ctx = getAccordionCtx();
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<!-- @component An Accordion child item. -->
|
|
39
|
+
|
|
40
|
+
<div class="{base} {spaceY} {classes}" data-testid="accordion-item">
|
|
41
|
+
<!-- Control -->
|
|
42
|
+
<button
|
|
43
|
+
type="button"
|
|
44
|
+
{id}
|
|
45
|
+
class="{controlBase} {controlHover} {controlPadding} {controlRounded} {controlClasses}"
|
|
46
|
+
aria-expanded={ctx.isOpen(id)}
|
|
47
|
+
aria-controls="accordion-panel-{id}"
|
|
48
|
+
onclick={clickHandler}
|
|
49
|
+
{disabled}
|
|
50
|
+
>
|
|
51
|
+
<!-- Lead -->
|
|
52
|
+
{#if controlLead}<div>{@render controlLead()}</div>{/if}
|
|
53
|
+
<!-- Content -->
|
|
54
|
+
<div class="flex-1">{@render control()}</div>
|
|
55
|
+
<!-- Icons -->
|
|
56
|
+
<div class={iconsBase}>
|
|
57
|
+
{#if ctx.isOpen(id)}
|
|
58
|
+
{#if ctx.iconOpen}{@render ctx.iconOpen()}{:else}−{/if}
|
|
59
|
+
{:else if ctx.iconClosed}{@render ctx.iconClosed()}{:else}+{/if}
|
|
60
|
+
</div>
|
|
61
|
+
</button>
|
|
62
|
+
<!-- Panel -->
|
|
63
|
+
{#if panel && ctx.isOpen(id)}
|
|
64
|
+
<div
|
|
65
|
+
class="{panelBase} {panelPadding} {panelRounded} {panelClasses}"
|
|
66
|
+
transition:slide={{ duration: ctx.animDuration }}
|
|
67
|
+
id="accordion-panel-{id}"
|
|
68
|
+
role="region"
|
|
69
|
+
aria-hidden={ctx.isOpen(id)}
|
|
70
|
+
aria-labelledby={id}
|
|
71
|
+
>
|
|
72
|
+
{@render panel()}
|
|
73
|
+
</div>
|
|
74
|
+
{/if}
|
|
75
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { AccordionItemProps } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: AccordionItemProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type AccordionItemProps_ = typeof __propDef.props;
|
|
11
|
+
export { AccordionItemProps_ as AccordionItemProps };
|
|
12
|
+
export type AccordionItemEvents = typeof __propDef.events;
|
|
13
|
+
export type AccordionItemSlots = typeof __propDef.slots;
|
|
14
|
+
/** An Accordion child item. */
|
|
15
|
+
export default class AccordionItem extends SvelteComponent<AccordionItemProps_, AccordionItemEvents, AccordionItemSlots> {
|
|
16
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
export interface AccordionContext {
|
|
3
|
+
open: (id: string) => void;
|
|
4
|
+
close: (id: string) => void;
|
|
5
|
+
toggle: (id: string) => void;
|
|
6
|
+
isOpen: (id: string) => boolean;
|
|
7
|
+
animDuration: number;
|
|
8
|
+
iconOpen?: Snippet;
|
|
9
|
+
iconClosed?: Snippet;
|
|
10
|
+
}
|
|
11
|
+
export interface AccordionProps {
|
|
12
|
+
/** Enables opening multiple items at once. */
|
|
13
|
+
multiple?: boolean;
|
|
14
|
+
/** Takes an array list of open items. */
|
|
15
|
+
value?: string[];
|
|
16
|
+
/** The slide animation duration in milliseconds. */
|
|
17
|
+
animDuration?: number;
|
|
18
|
+
/** Sets base styles. */
|
|
19
|
+
base?: string;
|
|
20
|
+
/** Set padding styles. */
|
|
21
|
+
padding?: string;
|
|
22
|
+
/** Set vertical spacing styles. */
|
|
23
|
+
spaceY?: string;
|
|
24
|
+
/** Set border radius styles. */
|
|
25
|
+
rounded?: string;
|
|
26
|
+
/** Set the width styles. */
|
|
27
|
+
width?: string;
|
|
28
|
+
/** Provide arbitrary CSS classes. */
|
|
29
|
+
classes?: string;
|
|
30
|
+
/** The default child slot. */
|
|
31
|
+
children: Snippet;
|
|
32
|
+
/** Set the open state icon. */
|
|
33
|
+
iconOpen?: Snippet;
|
|
34
|
+
/** Set the closed state icon. */
|
|
35
|
+
iconClosed?: Snippet;
|
|
36
|
+
}
|
|
37
|
+
export interface AccordionItemProps {
|
|
38
|
+
/** Set a unique ID for the item. */
|
|
39
|
+
id: string;
|
|
40
|
+
/** Set a disabled state for the item. */
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/** Sets base styles. */
|
|
43
|
+
base?: string;
|
|
44
|
+
/** Set vertical spacing styles. */
|
|
45
|
+
spaceY?: string;
|
|
46
|
+
/** Provide arbitrary CSS classes. */
|
|
47
|
+
classes?: string;
|
|
48
|
+
/** Triggers on item open or close. */
|
|
49
|
+
onclick?: (event: MouseEvent) => void;
|
|
50
|
+
/** Sets control's base styles. */
|
|
51
|
+
controlBase?: string;
|
|
52
|
+
/** Sets control's the hover styles. */
|
|
53
|
+
controlHover?: string;
|
|
54
|
+
/** Sets control's the padding styles. */
|
|
55
|
+
controlPadding?: string;
|
|
56
|
+
/** Sets control's the border radius styles. */
|
|
57
|
+
controlRounded?: string;
|
|
58
|
+
/** Provide arbitrary CSS classes to the control. */
|
|
59
|
+
controlClasses?: string;
|
|
60
|
+
/** Set the base styles for the state icons. */
|
|
61
|
+
iconsBase?: string;
|
|
62
|
+
/** Set the panel's base styles. */
|
|
63
|
+
panelBase?: string;
|
|
64
|
+
/** Set the panel's padding styles. */
|
|
65
|
+
panelPadding?: string;
|
|
66
|
+
/** Set the panel's border-radius styles. */
|
|
67
|
+
panelRounded?: string;
|
|
68
|
+
/** Provide arbitrary CSS classes to the panel. */
|
|
69
|
+
panelClasses?: string;
|
|
70
|
+
/** The control's default slot. */
|
|
71
|
+
control: Snippet;
|
|
72
|
+
/** The control's lead icon slot. */
|
|
73
|
+
controlLead?: Snippet;
|
|
74
|
+
/** The panels's default slot. */
|
|
75
|
+
panel?: Snippet;
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {} from 'svelte';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script lang="ts">let {
|
|
2
|
+
// Root
|
|
3
|
+
base = "w-full flex flex-col",
|
|
4
|
+
background = "bg-surface-100-900",
|
|
5
|
+
spaceY = "space-y-4",
|
|
6
|
+
border = "",
|
|
7
|
+
padding = "p-4",
|
|
8
|
+
shadow = "",
|
|
9
|
+
classes = "",
|
|
10
|
+
// Toolbar
|
|
11
|
+
toolbarBase = "flex justify-between",
|
|
12
|
+
toolbarGridCols = "grid-cols-[auto_1fr_auto]",
|
|
13
|
+
toolbarGap = "gap-4",
|
|
14
|
+
toolbarClasses = "",
|
|
15
|
+
// Lead
|
|
16
|
+
leadBase = "flex",
|
|
17
|
+
leadSpaceX = "space-x-4 rtl:space-x-reverse",
|
|
18
|
+
leadPadding = "",
|
|
19
|
+
leadClasses = "",
|
|
20
|
+
// Center
|
|
21
|
+
centerBase = "grow",
|
|
22
|
+
centerAlign = "text-center",
|
|
23
|
+
centerPadding = "",
|
|
24
|
+
centerClasses = "",
|
|
25
|
+
// Trail
|
|
26
|
+
trailBase = "flex",
|
|
27
|
+
trailSpaceX = "space-x-4 rtl:space-x-reverse",
|
|
28
|
+
trailPadding = "",
|
|
29
|
+
trailClasses = "",
|
|
30
|
+
// Headline
|
|
31
|
+
headlineBase = "w-full",
|
|
32
|
+
headlineClasses = "",
|
|
33
|
+
// Snippets
|
|
34
|
+
children,
|
|
35
|
+
lead,
|
|
36
|
+
trail,
|
|
37
|
+
headline
|
|
38
|
+
} = $props();
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<!-- @component A header element for the top of a page layout. -->
|
|
42
|
+
|
|
43
|
+
<header class="{base} {background} {spaceY} {border} {padding} {shadow} {classes}" role="toolbar" data-testid="app-bar">
|
|
44
|
+
<section class="{toolbarBase} {toolbarGridCols} {toolbarGap} {toolbarClasses}">
|
|
45
|
+
{#if lead}
|
|
46
|
+
<div class="{leadBase} {leadSpaceX} {leadPadding} {leadClasses}">
|
|
47
|
+
{@render lead()}
|
|
48
|
+
</div>
|
|
49
|
+
{/if}
|
|
50
|
+
|
|
51
|
+
{#if children}
|
|
52
|
+
<div class="{centerBase} {centerAlign} {centerPadding} {centerClasses}">
|
|
53
|
+
{@render children()}
|
|
54
|
+
</div>
|
|
55
|
+
{/if}
|
|
56
|
+
|
|
57
|
+
{#if trail}
|
|
58
|
+
<div class="{trailBase} {trailSpaceX} {trailPadding} {trailClasses}">
|
|
59
|
+
{@render trail()}
|
|
60
|
+
</div>
|
|
61
|
+
{/if}
|
|
62
|
+
</section>
|
|
63
|
+
|
|
64
|
+
{#if headline}
|
|
65
|
+
<section class="{headlineBase} {headlineClasses}">
|
|
66
|
+
{@render headline()}
|
|
67
|
+
</section>
|
|
68
|
+
{/if}
|
|
69
|
+
</header>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { AppBarProps } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: AppBarProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type AppBarProps_ = typeof __propDef.props;
|
|
11
|
+
export { AppBarProps_ as AppBarProps };
|
|
12
|
+
export type AppBarEvents = typeof __propDef.events;
|
|
13
|
+
export type AppBarSlots = typeof __propDef.slots;
|
|
14
|
+
/** A header element for the top of a page layout. */
|
|
15
|
+
export default class AppBar extends SvelteComponent<AppBarProps_, AppBarEvents, AppBarSlots> {
|
|
16
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export interface AppBarProps {
|
|
3
|
+
/** Set base styles. */
|
|
4
|
+
base?: string;
|
|
5
|
+
/** Set background styles. */
|
|
6
|
+
background?: string;
|
|
7
|
+
/** Set vertical spacing styles. */
|
|
8
|
+
spaceY?: string;
|
|
9
|
+
/** Set border styles. */
|
|
10
|
+
border?: string;
|
|
11
|
+
/** Set padding styles. */
|
|
12
|
+
padding?: string;
|
|
13
|
+
/** Set shadow styles. */
|
|
14
|
+
shadow?: string;
|
|
15
|
+
/** Provide arbitrary CSS classes. */
|
|
16
|
+
classes?: string;
|
|
17
|
+
/** Sets toolbar's base styles. */
|
|
18
|
+
toolbarBase?: string;
|
|
19
|
+
/** Sets toolbar's grid columns styles. */
|
|
20
|
+
toolbarGridCols?: string;
|
|
21
|
+
/** Sets toolbar's gap styles. */
|
|
22
|
+
toolbarGap?: string;
|
|
23
|
+
/** Provide arbitrary CSS classes to the toolbar. */
|
|
24
|
+
toolbarClasses?: string;
|
|
25
|
+
/** Sets the lead snippet element's base styles. */
|
|
26
|
+
leadBase?: string;
|
|
27
|
+
/** Sets the lead snippet element's horizontal spacing styles. */
|
|
28
|
+
leadSpaceX?: string;
|
|
29
|
+
/** Sets the lead snippet element's padding styles. */
|
|
30
|
+
leadPadding?: string;
|
|
31
|
+
/** Provide arbitrary CSS classes to the lead snippet. */
|
|
32
|
+
leadClasses?: string;
|
|
33
|
+
/** Sets the center snippet element's base styles. */
|
|
34
|
+
centerBase?: string;
|
|
35
|
+
/** Sets the center snippet element's alignment styles. */
|
|
36
|
+
centerAlign?: string;
|
|
37
|
+
/** Sets the center snippet element's padding styles. */
|
|
38
|
+
centerPadding?: string;
|
|
39
|
+
/** Provide arbitrary CSS classes to the center snippet. */
|
|
40
|
+
centerClasses?: string;
|
|
41
|
+
/** Sets the trail snippet element's base styles. */
|
|
42
|
+
trailBase?: string;
|
|
43
|
+
/** Sets the trail snippet element's horizontal spacing styles. */
|
|
44
|
+
trailSpaceX?: string;
|
|
45
|
+
/** Sets the trail snippet element's padding styles. */
|
|
46
|
+
trailPadding?: string;
|
|
47
|
+
/** Provide arbitrary CSS classes to the trail snippet. */
|
|
48
|
+
trailClasses?: string;
|
|
49
|
+
/** Sets the headline snippet element's base styles. */
|
|
50
|
+
headlineBase?: string;
|
|
51
|
+
/** Provide arbitrary CSS classes to the headline snippet. */
|
|
52
|
+
headlineClasses?: string;
|
|
53
|
+
/** The center slot. */
|
|
54
|
+
children?: Snippet;
|
|
55
|
+
/** The lead slot. */
|
|
56
|
+
lead?: Snippet;
|
|
57
|
+
/** The trail slot. */
|
|
58
|
+
trail?: Snippet;
|
|
59
|
+
/** The headline slot. */
|
|
60
|
+
headline?: Snippet;
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">let {
|
|
2
|
+
src = "",
|
|
3
|
+
alt = "",
|
|
4
|
+
filter = "",
|
|
5
|
+
// Root
|
|
6
|
+
base = "overflow-hidden isolate",
|
|
7
|
+
background = "bg-surface-400-600",
|
|
8
|
+
size = "size-16",
|
|
9
|
+
font = "",
|
|
10
|
+
border = "",
|
|
11
|
+
rounded = "rounded-full",
|
|
12
|
+
shadow = "",
|
|
13
|
+
classes = "",
|
|
14
|
+
// Image
|
|
15
|
+
imageBase = "w-full object-cover",
|
|
16
|
+
imageClasses = "",
|
|
17
|
+
// Snippets
|
|
18
|
+
children
|
|
19
|
+
} = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<!-- @component An image with a fallback for representing the user. -->
|
|
23
|
+
|
|
24
|
+
<figure class="{base} {background} {size} {font} {border} {rounded} {shadow} {classes}" data-testId="avatar">
|
|
25
|
+
{#if src}
|
|
26
|
+
<img class="{imageBase} {imageClasses}" {src} {alt} style:filter={filter && `url(${filter})`} />
|
|
27
|
+
{:else if children}
|
|
28
|
+
{@render children()}
|
|
29
|
+
{/if}
|
|
30
|
+
</figure>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { AvatarProps } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: AvatarProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type AvatarProps_ = typeof __propDef.props;
|
|
11
|
+
export { AvatarProps_ as AvatarProps };
|
|
12
|
+
export type AvatarEvents = typeof __propDef.events;
|
|
13
|
+
export type AvatarSlots = typeof __propDef.slots;
|
|
14
|
+
/** An image with a fallback for representing the user. */
|
|
15
|
+
export default class Avatar extends SvelteComponent<AvatarProps_, AvatarEvents, AvatarSlots> {
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export interface AvatarProps {
|
|
3
|
+
/** Set avatar image source URL. */
|
|
4
|
+
src?: string;
|
|
5
|
+
/** Set avatar image Alt text. */
|
|
6
|
+
alt?: string;
|
|
7
|
+
/** Set avatar image filter name. such as "#Apollo". */
|
|
8
|
+
filter?: string;
|
|
9
|
+
/** Set base styles. */
|
|
10
|
+
base?: string;
|
|
11
|
+
/** Set background styles. */
|
|
12
|
+
background?: string;
|
|
13
|
+
/** Set size styles. */
|
|
14
|
+
size?: string;
|
|
15
|
+
/** Set font styles. */
|
|
16
|
+
font?: string;
|
|
17
|
+
/** Set border styles. */
|
|
18
|
+
border?: string;
|
|
19
|
+
/** Set border radius styles. */
|
|
20
|
+
rounded?: string;
|
|
21
|
+
/** Set shadow styles. */
|
|
22
|
+
shadow?: string;
|
|
23
|
+
/** Provide arbitrary CSS classes. */
|
|
24
|
+
classes?: string;
|
|
25
|
+
/** Set avatar image base styles. */
|
|
26
|
+
imageBase?: string;
|
|
27
|
+
/** Provide avatar image arbitrary CSS classes. */
|
|
28
|
+
imageClasses?: string;
|
|
29
|
+
/** The default child slot. */
|
|
30
|
+
children?: Snippet;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">let {
|
|
2
|
+
value,
|
|
3
|
+
max = 100,
|
|
4
|
+
labelledBy = "",
|
|
5
|
+
// Root
|
|
6
|
+
base = "overflow-x-hidden",
|
|
7
|
+
bg = "bg-surface-200-800",
|
|
8
|
+
width = "w-full",
|
|
9
|
+
height = "h-2",
|
|
10
|
+
rounded = "rounded",
|
|
11
|
+
classes = "",
|
|
12
|
+
// Meter
|
|
13
|
+
meterBase = "h-full",
|
|
14
|
+
meterBg = "bg-surface-950-50",
|
|
15
|
+
meterRounded = "rounded",
|
|
16
|
+
meterTransition = "transition-[width]",
|
|
17
|
+
meterAnimate = "animate-indeterminate",
|
|
18
|
+
meterClasses = ""
|
|
19
|
+
} = $props();
|
|
20
|
+
$effect(() => {
|
|
21
|
+
if (max < 0) {
|
|
22
|
+
console.warn("The max prop should be greater than or equal to 0");
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const indeterminate = $derived(value === void 0);
|
|
26
|
+
const fillPercentage = $derived(`${indeterminate ? 50 : (value - 0) / (max - 0) * 100}%`);
|
|
27
|
+
const rxIndeterminate = $derived(indeterminate ? meterAnimate : "");
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<!-- @component An indicator showing the progress or completion of a task -->
|
|
31
|
+
|
|
32
|
+
<div
|
|
33
|
+
role="progressbar"
|
|
34
|
+
aria-labelledby={labelledBy}
|
|
35
|
+
aria-valuenow={value}
|
|
36
|
+
aria-valuemin={0}
|
|
37
|
+
aria-valuemax={max}
|
|
38
|
+
class="{base} {bg} {width} {height} {rounded} {classes}"
|
|
39
|
+
>
|
|
40
|
+
<div class="{meterBase} {meterBg} {meterRounded} {meterTransition} {rxIndeterminate} {meterClasses}" style:width={fillPercentage}></div>
|
|
41
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ProgressProps } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: ProgressProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type ProgressProps_ = typeof __propDef.props;
|
|
11
|
+
export { ProgressProps_ as ProgressProps };
|
|
12
|
+
export type ProgressEvents = typeof __propDef.events;
|
|
13
|
+
export type ProgressSlots = typeof __propDef.slots;
|
|
14
|
+
/** An indicator showing the progress or completion of a task */
|
|
15
|
+
export default class Progress extends SvelteComponent<ProgressProps_, ProgressEvents, ProgressSlots> {
|
|
16
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ProgressProps {
|
|
2
|
+
/** Set the value */
|
|
3
|
+
value?: number;
|
|
4
|
+
/** Set the maximum value */
|
|
5
|
+
max?: number;
|
|
6
|
+
/** Set the aria-labelledby */
|
|
7
|
+
labelledBy?: string;
|
|
8
|
+
/** Set root base classes */
|
|
9
|
+
base?: string;
|
|
10
|
+
/** Set root background classes */
|
|
11
|
+
bg?: string;
|
|
12
|
+
/** Set root width classes */
|
|
13
|
+
width?: string;
|
|
14
|
+
/** Set root height classes */
|
|
15
|
+
height?: string;
|
|
16
|
+
/** Set root rounded classes */
|
|
17
|
+
rounded?: string;
|
|
18
|
+
/** Set root arbitrary classes */
|
|
19
|
+
classes?: string;
|
|
20
|
+
/** Set meter base classes. */
|
|
21
|
+
meterBase?: string;
|
|
22
|
+
/** Set meter bg classes */
|
|
23
|
+
meterBg?: string;
|
|
24
|
+
/** Set meter rounded classes. */
|
|
25
|
+
meterRounded?: string;
|
|
26
|
+
/** Set meter transition classes. */
|
|
27
|
+
meterTransition?: string;
|
|
28
|
+
/** Set meter animation classes for indeterminate (value === undefined) */
|
|
29
|
+
meterAnimate?: string;
|
|
30
|
+
/** Set meter arbitrary classes. */
|
|
31
|
+
meterClasses?: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">let {
|
|
2
|
+
id,
|
|
3
|
+
// Root
|
|
4
|
+
base = "w-full",
|
|
5
|
+
spaceY = "space-y-4",
|
|
6
|
+
classes = "",
|
|
7
|
+
// Tab List
|
|
8
|
+
listBase = "flex",
|
|
9
|
+
listJustify = "justify-start",
|
|
10
|
+
listGap = "gap-2",
|
|
11
|
+
listBorder = "border-b-[1px] border-surface-200-800",
|
|
12
|
+
listClasses = "",
|
|
13
|
+
// Snippets
|
|
14
|
+
list,
|
|
15
|
+
panels
|
|
16
|
+
} = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<!-- @component A Tab parent component. -->
|
|
20
|
+
|
|
21
|
+
<div {id} class="{base} {spaceY} {classes}" data-testid="tabs">
|
|
22
|
+
{#if list}
|
|
23
|
+
<div class="{listBase} {listGap} {listJustify} {listBorder} {listClasses}" role="tablist">
|
|
24
|
+
{@render list()}
|
|
25
|
+
</div>
|
|
26
|
+
{/if}
|
|
27
|
+
{#if panels}
|
|
28
|
+
{@render panels()}
|
|
29
|
+
{/if}
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { TabsProps } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: TabsProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type TabsProps_ = typeof __propDef.props;
|
|
11
|
+
export { TabsProps_ as TabsProps };
|
|
12
|
+
export type TabsEvents = typeof __propDef.events;
|
|
13
|
+
export type TabsSlots = typeof __propDef.slots;
|
|
14
|
+
/** A Tab parent component. */
|
|
15
|
+
export default class Tabs extends SvelteComponent<TabsProps_, TabsEvents, TabsSlots> {
|
|
16
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script lang="ts">let {
|
|
2
|
+
id,
|
|
3
|
+
name,
|
|
4
|
+
group = $bindable(),
|
|
5
|
+
title,
|
|
6
|
+
// A11y
|
|
7
|
+
label = "",
|
|
8
|
+
controls = "",
|
|
9
|
+
// Root
|
|
10
|
+
base = "group",
|
|
11
|
+
width = "",
|
|
12
|
+
active = "text-surface-950-50 border-surface-950-50",
|
|
13
|
+
inactive = "text-surface-600-400 border-transparent",
|
|
14
|
+
flex = "flex justify-center items-center",
|
|
15
|
+
background = "",
|
|
16
|
+
border = "border-b-[1px]",
|
|
17
|
+
text = "type-scale-3",
|
|
18
|
+
padding = "pb-2",
|
|
19
|
+
rounded = "",
|
|
20
|
+
gap = "gap-1",
|
|
21
|
+
cursor = "cursor-pointer",
|
|
22
|
+
classes = "",
|
|
23
|
+
// Content
|
|
24
|
+
contentBase = "w-full",
|
|
25
|
+
contentFlex = "flex justify-center items-center",
|
|
26
|
+
contentGap = "gap-2",
|
|
27
|
+
contentBg = "group-hover:preset-tonal-primary",
|
|
28
|
+
contentPadding = "p-2 px-4",
|
|
29
|
+
contentRounded = "rounded-container",
|
|
30
|
+
contentClasses = "",
|
|
31
|
+
// Events
|
|
32
|
+
onclick = () => {
|
|
33
|
+
},
|
|
34
|
+
onkeypress = () => {
|
|
35
|
+
},
|
|
36
|
+
onkeydown = () => {
|
|
37
|
+
},
|
|
38
|
+
onkeyup = () => {
|
|
39
|
+
},
|
|
40
|
+
onchange = () => {
|
|
41
|
+
},
|
|
42
|
+
// Snippets
|
|
43
|
+
children
|
|
44
|
+
} = $props();
|
|
45
|
+
const selected = $derived(group === name);
|
|
46
|
+
const rxActive = $derived(selected ? active : inactive);
|
|
47
|
+
let elemInput;
|
|
48
|
+
function onKeyDownHandler(event) {
|
|
49
|
+
onkeydown(event);
|
|
50
|
+
if (!["ArrowRight", "ArrowLeft", "Home", "End"].includes(event.code))
|
|
51
|
+
return;
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
const currTab = elemInput.closest('[role="tab"]');
|
|
54
|
+
if (!currTab)
|
|
55
|
+
return;
|
|
56
|
+
const tabList = elemInput.closest('[role="tablist"]');
|
|
57
|
+
if (!tabList)
|
|
58
|
+
return;
|
|
59
|
+
const isRTL = getComputedStyle(tabList).direction === "rtl";
|
|
60
|
+
const tabs = Array.from(tabList.querySelectorAll('[role="tab"]'));
|
|
61
|
+
const currIndex = tabs.indexOf(currTab);
|
|
62
|
+
let nextIndex = -1;
|
|
63
|
+
switch (event.code) {
|
|
64
|
+
case "ArrowRight":
|
|
65
|
+
if (isRTL) {
|
|
66
|
+
nextIndex = currIndex - 1 < 0 ? tabs.length - 1 : currIndex - 1;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
nextIndex = currIndex + 1 >= tabs.length ? 0 : currIndex + 1;
|
|
70
|
+
break;
|
|
71
|
+
case "ArrowLeft":
|
|
72
|
+
if (isRTL) {
|
|
73
|
+
nextIndex = currIndex + 1 >= tabs.length ? 0 : currIndex + 1;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
nextIndex = currIndex - 1 < 0 ? tabs.length - 1 : currIndex - 1;
|
|
77
|
+
break;
|
|
78
|
+
case "Home":
|
|
79
|
+
nextIndex = 0;
|
|
80
|
+
break;
|
|
81
|
+
case "End":
|
|
82
|
+
nextIndex = tabs.length - 1;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
if (nextIndex < 0)
|
|
86
|
+
return;
|
|
87
|
+
const nextTab = tabs[nextIndex];
|
|
88
|
+
const nextTabInput = nextTab?.querySelector("input");
|
|
89
|
+
if (nextTabInput) {
|
|
90
|
+
nextTabInput.click();
|
|
91
|
+
nextTab.focus();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<!-- @component A Tab Control component. -->
|
|
97
|
+
|
|
98
|
+
<label
|
|
99
|
+
{id}
|
|
100
|
+
class="{base} {width} {rxActive} {flex} {background} {border} {text} {padding} {rounded} {gap} {cursor} {classes}"
|
|
101
|
+
aria-label={label}
|
|
102
|
+
{title}
|
|
103
|
+
>
|
|
104
|
+
<!-- NOTE: do not add additional classes to this <div> -->
|
|
105
|
+
<div
|
|
106
|
+
class="size-full"
|
|
107
|
+
role="tab"
|
|
108
|
+
aria-controls={controls}
|
|
109
|
+
aria-selected={selected}
|
|
110
|
+
data-testid="tabs-control"
|
|
111
|
+
tabindex={selected ? 0 : -1}
|
|
112
|
+
onkeydown={onKeyDownHandler}
|
|
113
|
+
{onkeypress}
|
|
114
|
+
{onkeyup}
|
|
115
|
+
>
|
|
116
|
+
<!-- Keep these classes on wrapping element -->
|
|
117
|
+
<div class="h-0 w-0 flex-none overflow-hidden">
|
|
118
|
+
<input bind:group bind:this={elemInput} type="radio" {name} value={name} onchange={() => onchange(group)} {onclick} tabindex="-1" />
|
|
119
|
+
</div>
|
|
120
|
+
<!-- Content -->
|
|
121
|
+
{#if children}
|
|
122
|
+
<div class="{contentBase} {contentFlex} {contentGap} {contentBg} {contentPadding} {contentRounded} {contentClasses}">
|
|
123
|
+
{@render children()}
|
|
124
|
+
</div>
|
|
125
|
+
{/if}
|
|
126
|
+
</div>
|
|
127
|
+
</label>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { TabsControlProps } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: TabsControlProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type TabsControlProps_ = typeof __propDef.props;
|
|
11
|
+
export { TabsControlProps_ as TabsControlProps };
|
|
12
|
+
export type TabsControlEvents = typeof __propDef.events;
|
|
13
|
+
export type TabsControlSlots = typeof __propDef.slots;
|
|
14
|
+
/** A Tab Control component. */
|
|
15
|
+
export default class TabsControl extends SvelteComponent<TabsControlProps_, TabsControlEvents, TabsControlSlots> {
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">let {
|
|
2
|
+
id,
|
|
3
|
+
value,
|
|
4
|
+
group = $bindable(),
|
|
5
|
+
// A11y
|
|
6
|
+
labelledBy,
|
|
7
|
+
// Root
|
|
8
|
+
classes = "",
|
|
9
|
+
// Snippets
|
|
10
|
+
children
|
|
11
|
+
} = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<!-- @component A Tab Panel component. -->
|
|
15
|
+
|
|
16
|
+
{#if value === group && children}
|
|
17
|
+
<div {id} role="tabpanel" tabindex="0" aria-labelledby={labelledBy} class={classes}>
|
|
18
|
+
{@render children()}
|
|
19
|
+
</div>
|
|
20
|
+
{/if}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { TabsPanelProps } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: TabsPanelProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type TabsPanelProps_ = typeof __propDef.props;
|
|
11
|
+
export { TabsPanelProps_ as TabsPanelProps };
|
|
12
|
+
export type TabsPanelEvents = typeof __propDef.events;
|
|
13
|
+
export type TabsPanelSlots = typeof __propDef.slots;
|
|
14
|
+
/** A Tab Panel component. */
|
|
15
|
+
export default class TabsPanel extends SvelteComponent<TabsPanelProps_, TabsPanelEvents, TabsPanelSlots> {
|
|
16
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export interface TabsProps {
|
|
3
|
+
/** Provide a unique ID. */
|
|
4
|
+
id?: string;
|
|
5
|
+
/** Sets base styles. */
|
|
6
|
+
base?: string;
|
|
7
|
+
/** Set vertical spacing between list and panels. */
|
|
8
|
+
spaceY?: string;
|
|
9
|
+
/** Provide arbitrary CSS classes. */
|
|
10
|
+
classes?: string;
|
|
11
|
+
/** Sets the list snippet element's base styles. */
|
|
12
|
+
listBase?: string;
|
|
13
|
+
/** Sets the list snippet element's justification styles. */
|
|
14
|
+
listJustify?: string;
|
|
15
|
+
/** Sets the list snippet element's gap spacing. */
|
|
16
|
+
listGap?: string;
|
|
17
|
+
/** Sets the list snippet element's border styles. */
|
|
18
|
+
listBorder?: string;
|
|
19
|
+
/** Provide arbitrary CSS classes to the list snippet. */
|
|
20
|
+
listClasses?: string;
|
|
21
|
+
/** The tab list slot. */
|
|
22
|
+
list?: Snippet;
|
|
23
|
+
/** The tab panel slot. */
|
|
24
|
+
panels?: Snippet;
|
|
25
|
+
}
|
|
26
|
+
export interface TabsControlProps {
|
|
27
|
+
/** Provide a unique ID. */
|
|
28
|
+
id?: string;
|
|
29
|
+
/** Provide the tab control name. */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Provide the tab control radio group. */
|
|
32
|
+
group: string;
|
|
33
|
+
/** Provide a hoverable title attribute. */
|
|
34
|
+
title?: string;
|
|
35
|
+
/** Sets the A11y label. */
|
|
36
|
+
label?: string;
|
|
37
|
+
/** Sets ARIA controls value to define which panel this tab controls. */
|
|
38
|
+
controls?: string;
|
|
39
|
+
/** Sets base styles. */
|
|
40
|
+
base?: string;
|
|
41
|
+
/** Sets width styles. */
|
|
42
|
+
width?: string;
|
|
43
|
+
/** Sets the active control styles. */
|
|
44
|
+
active?: string;
|
|
45
|
+
/** Sets the inactive control styles. */
|
|
46
|
+
inactive?: string;
|
|
47
|
+
/** Sets flex styles. */
|
|
48
|
+
flex?: string;
|
|
49
|
+
/** Sets background styles. */
|
|
50
|
+
background?: string;
|
|
51
|
+
/** Sets border styles. */
|
|
52
|
+
border?: string;
|
|
53
|
+
/** Sets text size styles. */
|
|
54
|
+
text?: string;
|
|
55
|
+
/** Sets padding styles. */
|
|
56
|
+
padding?: string;
|
|
57
|
+
/** Sets rounded styles. */
|
|
58
|
+
rounded?: string;
|
|
59
|
+
/** Sets vertical gap styles. */
|
|
60
|
+
gap?: string;
|
|
61
|
+
/** Sets cursor styles. */
|
|
62
|
+
cursor?: string;
|
|
63
|
+
/** Provide arbitrary CSS classes. */
|
|
64
|
+
classes?: string;
|
|
65
|
+
/** Sets tab content base styles. */
|
|
66
|
+
contentBase?: string;
|
|
67
|
+
/** Sets tab content flex styles. */
|
|
68
|
+
contentFlex?: string;
|
|
69
|
+
/** Sets the tab content gap styles. */
|
|
70
|
+
contentGap?: string;
|
|
71
|
+
/** Sets the tab content background styles. */
|
|
72
|
+
contentBg?: string;
|
|
73
|
+
/** Sets the tab content padding styles. */
|
|
74
|
+
contentPadding?: string;
|
|
75
|
+
/** Sets the tab content rounded styles. */
|
|
76
|
+
contentRounded?: string;
|
|
77
|
+
/** Provide arbitrary CSS classes for the tab content. */
|
|
78
|
+
contentClasses?: string;
|
|
79
|
+
/** Triggers on Tab Control click. */
|
|
80
|
+
onclick?: (event: MouseEvent) => void;
|
|
81
|
+
/** Triggers on Tab Control key press. */
|
|
82
|
+
onkeypress?: (event: KeyboardEvent) => void;
|
|
83
|
+
/** Triggers on Tab Control key down. */
|
|
84
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
85
|
+
/** Triggers on Tab Control key up. */
|
|
86
|
+
onkeyup?: (event: KeyboardEvent) => void;
|
|
87
|
+
/** Triggers on Tab Control group change. */
|
|
88
|
+
onchange?: (group: string) => void;
|
|
89
|
+
/** The default child slot. */
|
|
90
|
+
children?: Snippet;
|
|
91
|
+
}
|
|
92
|
+
export interface TabsPanelProps {
|
|
93
|
+
/** Provide a unique ID. */
|
|
94
|
+
id?: string;
|
|
95
|
+
/** Provide the tab panel value. */
|
|
96
|
+
value: string;
|
|
97
|
+
/** Provide the tab control radio group. */
|
|
98
|
+
group: string;
|
|
99
|
+
/** Sets the A11y labelledby. */
|
|
100
|
+
labelledBy?: string;
|
|
101
|
+
/** Provide arbitrary CSS classes. */
|
|
102
|
+
classes?: string;
|
|
103
|
+
/** The default child slot. */
|
|
104
|
+
children?: Snippet;
|
|
105
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type TestProps = typeof __propDef.props;
|
|
10
|
+
export type TestEvents = typeof __propDef.events;
|
|
11
|
+
export type TestSlots = typeof __propDef.slots;
|
|
12
|
+
export default class Test extends SvelteComponent<TestProps, TestEvents, TestSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Test } from './components/Test/Test.svelte';
|
|
2
|
+
export { default as Accordion } from './components/Accordion/Accordion.svelte';
|
|
3
|
+
export { default as AccordionItem } from './components/Accordion/AccordionItem.svelte';
|
|
4
|
+
export { default as Avatar } from './components/Avatar/Avatar.svelte';
|
|
5
|
+
export { default as AppBar } from './components/AppBar/AppBar.svelte';
|
|
6
|
+
export { default as Tabs } from './components/Tab/index.js';
|
|
7
|
+
export { default as Progress } from './components/Progress/Progress.svelte';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Exports for skeleton-svelte package
|
|
2
|
+
export { default as Test } from './components/Test/Test.svelte';
|
|
3
|
+
export { default as Accordion } from './components/Accordion/Accordion.svelte';
|
|
4
|
+
export { default as AccordionItem } from './components/Accordion/AccordionItem.svelte';
|
|
5
|
+
export { default as Avatar } from './components/Avatar/Avatar.svelte';
|
|
6
|
+
export { default as AppBar } from './components/AppBar/AppBar.svelte';
|
|
7
|
+
export { default as Tabs } from './components/Tab/index.js';
|
|
8
|
+
export { default as Progress } from './components/Progress/Progress.svelte';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Common Utility Features
|
|
2
|
+
// TODO: utilize this until Svelte provides a first-class solution.
|
|
3
|
+
// https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACo2SMW-DMBCF_4plVSKoCDoTglRl6toOHUoHapzEKZwt-wipEP-9wg7Eadqoo---ez69dz3diJobmr71FMqG05Q-KkUjil9qfJgDr5HTiBrZajZWMsO0UJgXUKBolNRIemI4riUgPyIZyEbLhgRuMlhecC9YIp-RODHjO3ZovDcX9Hon6mom7Sv2RKHAmiPRZedEV-TOqi0eQqvCJBgknS6V4tWEAO_cDicKCty0wFBIIALYIiT9WCtwkr2_X7qCLxQfyrqdWoOTOTuwCKbhIJrXczv5kC8YRBeLjnCWnH2G7KNFlEAksFqwz1UvgA35EzDNGw6YJa7vWOdbktOINrISG8ErmqJu-RDNGVvmvyl7-W1v5gyOds57wWx_8yZc-vSPnLZ_GXVtjcqfy47Y6FPST_JDlqjcdl_d-ExcB2nZW275V3o2bW98w_jRWsTq0pjTmdtTsj-cjzOcT1O3DKVeCBAoyno-PNwJE09Dp-Z0Z8P1ku_DN0HaHf7CAwAA
|
|
4
|
+
/** Provide reactive state for Context API */
|
|
5
|
+
export class State {
|
|
6
|
+
value = $state();
|
|
7
|
+
constructor(initial) {
|
|
8
|
+
this.value = initial;
|
|
9
|
+
}
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,76 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skeletonlabs/skeleton-svelte",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
"version": "1.0.0-next.1",
|
|
4
|
+
"description": "The Svelte package for Skeleton.",
|
|
5
|
+
"author": "endigo9740 <chris@skeletonlabs.dev>",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"svelte": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
12
13
|
},
|
|
14
|
+
"files": [
|
|
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"
|
|
23
|
+
],
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"svelte": "^5.0.0-next.136"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@playwright/test": "^1.42.1",
|
|
29
|
+
"@sveltejs/adapter-auto": "^3.2.0",
|
|
30
|
+
"@sveltejs/kit": "^2.5.5",
|
|
31
|
+
"@sveltejs/package": "^2.3.1",
|
|
32
|
+
"@sveltejs/vite-plugin-svelte": "^3.0.2",
|
|
33
|
+
"@tailwindcss/forms": "^0.5.7",
|
|
34
|
+
"@testing-library/jest-dom": "^6.4.2",
|
|
35
|
+
"@testing-library/svelte": "^4.1.0",
|
|
36
|
+
"@types/eslint": "8.56.0",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
38
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
39
|
+
"autoprefixer": "^10.4.19",
|
|
40
|
+
"eslint": "^8.57.0",
|
|
41
|
+
"eslint-config-prettier": "^9.1.0",
|
|
42
|
+
"eslint-plugin-svelte": "2.36.0-next.5",
|
|
43
|
+
"jsdom": "^24.0.0",
|
|
44
|
+
"postcss": "^8.4.38",
|
|
45
|
+
"postcss-load-config": "^5.0.3",
|
|
46
|
+
"prettier": "^3.2.5",
|
|
47
|
+
"prettier-plugin-svelte": "^3.2.2",
|
|
48
|
+
"prettier-plugin-tailwindcss": "^0.5.13",
|
|
49
|
+
"publint": "^0.1.16",
|
|
50
|
+
"svelte": "5.0.0-next.94",
|
|
51
|
+
"svelte-check": "^3.6.9",
|
|
52
|
+
"tailwindcss": "^3.4.3",
|
|
53
|
+
"tslib": "^2.6.2",
|
|
54
|
+
"typescript": "^5.4.4",
|
|
55
|
+
"vite": "^5.2.8",
|
|
56
|
+
"vitest": "^1.4.0",
|
|
57
|
+
"@skeletonlabs/skeleton": "3.0.0-next.0",
|
|
58
|
+
"vite-plugin-tw-plugin-watcher": "0.0.0"
|
|
59
|
+
},
|
|
60
|
+
"type": "module",
|
|
13
61
|
"scripts": {
|
|
14
|
-
"
|
|
62
|
+
"dev": "vite dev",
|
|
63
|
+
"build": "vite build && npm run package",
|
|
64
|
+
"preview": "vite preview",
|
|
65
|
+
"package": "svelte-kit sync && svelte-package && publint",
|
|
66
|
+
"package:watch": "svelte-package --watch",
|
|
67
|
+
"test": "npm run test:integration && npm run test:unit",
|
|
68
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
69
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
70
|
+
"lint": "prettier --check . && eslint .",
|
|
71
|
+
"format": "prettier --write .",
|
|
72
|
+
"test:integration": "playwright test",
|
|
73
|
+
"test:unit": "vitest",
|
|
74
|
+
"sk-sync": "svelte-kit sync"
|
|
15
75
|
}
|
|
16
76
|
}
|