@skeletonlabs/skeleton-svelte 1.5.1 → 2.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/dist/{composed → components}/accordion/anatomy/accordion-content.svelte +2 -1
- package/dist/{composed → components}/accordion/anatomy/accordion-heading.svelte +12 -2
- package/dist/{composed → components}/accordion/anatomy/accordion-indicator.svelte +10 -1
- package/dist/{composed → components}/accordion/anatomy/accordion-item.svelte +2 -1
- package/dist/{composed → components}/accordion/anatomy/accordion-root.svelte +2 -1
- package/dist/{composed → components}/accordion/anatomy/accordion-trigger.svelte +2 -2
- package/dist/{composed → components}/avatar/anatomy/avatar-fallback.svelte +2 -1
- package/dist/{composed → components}/avatar/anatomy/avatar-image.svelte +2 -1
- package/dist/{composed → components}/avatar/anatomy/avatar-root.svelte +2 -1
- package/dist/index.css +2 -0
- package/dist/index.d.ts +2 -21
- package/dist/index.js +2 -29
- package/package.json +31 -38
- package/dist/components/Accordion/Accordion.svelte +0 -55
- package/dist/components/Accordion/Accordion.svelte.d.ts +0 -5
- package/dist/components/Accordion/AccordionItem.svelte +0 -90
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +0 -5
- package/dist/components/Accordion/context.d.ts +0 -2
- package/dist/components/Accordion/context.js +0 -3
- package/dist/components/Accordion/index.d.ts +0 -4
- package/dist/components/Accordion/index.js +0 -3
- package/dist/components/Accordion/types.d.ts +0 -74
- package/dist/components/AppBar/AppBar.svelte +0 -72
- package/dist/components/AppBar/AppBar.svelte.d.ts +0 -5
- package/dist/components/AppBar/types.d.ts +0 -61
- package/dist/components/AppBar/types.js +0 -1
- package/dist/components/Avatar/Avatar.svelte +0 -68
- package/dist/components/Avatar/Avatar.svelte.d.ts +0 -5
- package/dist/components/Avatar/types.d.ts +0 -39
- package/dist/components/Avatar/types.js +0 -1
- package/dist/components/Combobox/Combobox.svelte +0 -154
- package/dist/components/Combobox/Combobox.svelte.d.ts +0 -18
- package/dist/components/Combobox/types.d.ts +0 -66
- package/dist/components/Combobox/types.js +0 -1
- package/dist/components/FileUpload/FileUpload.svelte +0 -132
- package/dist/components/FileUpload/FileUpload.svelte.d.ts +0 -5
- package/dist/components/FileUpload/types.d.ts +0 -74
- package/dist/components/FileUpload/types.js +0 -1
- package/dist/components/Modal/Modal.svelte +0 -87
- package/dist/components/Modal/Modal.svelte.d.ts +0 -4
- package/dist/components/Modal/types.d.ts +0 -58
- package/dist/components/Modal/types.js +0 -1
- package/dist/components/Navigation/NavBar.svelte +0 -48
- package/dist/components/Navigation/NavBar.svelte.d.ts +0 -5
- package/dist/components/Navigation/NavRail.svelte +0 -90
- package/dist/components/Navigation/NavRail.svelte.d.ts +0 -5
- package/dist/components/Navigation/NavTile.svelte +0 -87
- package/dist/components/Navigation/NavTile.svelte.d.ts +0 -5
- package/dist/components/Navigation/context.d.ts +0 -2
- package/dist/components/Navigation/context.js +0 -6
- package/dist/components/Navigation/index.d.ts +0 -6
- package/dist/components/Navigation/index.js +0 -4
- package/dist/components/Navigation/types.d.ts +0 -132
- package/dist/components/Navigation/types.js +0 -1
- package/dist/components/Pagination/Pagination.svelte +0 -146
- package/dist/components/Pagination/Pagination.svelte.d.ts +0 -4
- package/dist/components/Pagination/types.d.ts +0 -56
- package/dist/components/Pagination/types.js +0 -1
- package/dist/components/Popover/Popover.svelte +0 -74
- package/dist/components/Popover/Popover.svelte.d.ts +0 -4
- package/dist/components/Popover/types.d.ts +0 -45
- package/dist/components/Popover/types.js +0 -1
- package/dist/components/Progress/Progress.svelte +0 -63
- package/dist/components/Progress/Progress.svelte.d.ts +0 -5
- package/dist/components/Progress/types.d.ts +0 -44
- package/dist/components/Progress/types.js +0 -1
- package/dist/components/ProgressRing/ProgressRing.svelte +0 -98
- package/dist/components/ProgressRing/ProgressRing.svelte.d.ts +0 -5
- package/dist/components/ProgressRing/types.d.ts +0 -56
- package/dist/components/ProgressRing/types.js +0 -1
- package/dist/components/Rating/Rating.svelte +0 -135
- package/dist/components/Rating/Rating.svelte.d.ts +0 -5
- package/dist/components/Rating/index.d.ts +0 -2
- package/dist/components/Rating/index.js +0 -2
- package/dist/components/Rating/types.d.ts +0 -36
- package/dist/components/Rating/types.js +0 -1
- package/dist/components/Segment/Segment.svelte +0 -77
- package/dist/components/Segment/Segment.svelte.d.ts +0 -5
- package/dist/components/Segment/SegmentItem.svelte +0 -40
- package/dist/components/Segment/SegmentItem.svelte.d.ts +0 -5
- package/dist/components/Segment/context.d.ts +0 -2
- package/dist/components/Segment/context.js +0 -6
- package/dist/components/Segment/index.d.ts +0 -4
- package/dist/components/Segment/index.js +0 -3
- package/dist/components/Segment/types.d.ts +0 -64
- package/dist/components/Segment/types.js +0 -1
- package/dist/components/Slider/Slider.svelte +0 -105
- package/dist/components/Slider/Slider.svelte.d.ts +0 -4
- package/dist/components/Slider/types.d.ts +0 -68
- package/dist/components/Slider/types.js +0 -1
- package/dist/components/Switch/Switch.svelte +0 -102
- package/dist/components/Switch/Switch.svelte.d.ts +0 -5
- package/dist/components/Switch/types.d.ts +0 -64
- package/dist/components/Switch/types.js +0 -1
- package/dist/components/Tabs/Tabs.svelte +0 -59
- package/dist/components/Tabs/Tabs.svelte.d.ts +0 -5
- package/dist/components/Tabs/TabsControl.svelte +0 -51
- package/dist/components/Tabs/TabsControl.svelte.d.ts +0 -5
- package/dist/components/Tabs/TabsPanel.svelte +0 -23
- package/dist/components/Tabs/TabsPanel.svelte.d.ts +0 -5
- package/dist/components/Tabs/context.d.ts +0 -2
- package/dist/components/Tabs/context.js +0 -6
- package/dist/components/Tabs/index.d.ts +0 -5
- package/dist/components/Tabs/index.js +0 -4
- package/dist/components/Tabs/types.d.ts +0 -68
- package/dist/components/Tabs/types.js +0 -1
- package/dist/components/TagsInput/TagsInput.svelte +0 -96
- package/dist/components/TagsInput/TagsInput.svelte.d.ts +0 -5
- package/dist/components/TagsInput/types.d.ts +0 -40
- package/dist/components/TagsInput/types.js +0 -1
- package/dist/components/Toast/Toast.svelte +0 -76
- package/dist/components/Toast/Toast.svelte.d.ts +0 -4
- package/dist/components/Toast/Toaster.svelte +0 -72
- package/dist/components/Toast/Toaster.svelte.d.ts +0 -4
- package/dist/components/Toast/create-toaster.d.ts +0 -2
- package/dist/components/Toast/create-toaster.js +0 -4
- package/dist/components/Toast/types.d.ts +0 -47
- package/dist/components/Toast/types.js +0 -1
- package/dist/components/Tooltip/Tooltip.svelte +0 -78
- package/dist/components/Tooltip/Tooltip.svelte.d.ts +0 -4
- package/dist/components/Tooltip/types.d.ts +0 -47
- package/dist/components/Tooltip/types.js +0 -1
- package/dist/composed/accordion/modules/types.js +0 -1
- package/dist/composed/index.d.ts +0 -2
- package/dist/composed/index.js +0 -2
- /package/dist/{composed → components}/accordion/anatomy/accordion-content.svelte.d.ts +0 -0
- /package/dist/{composed → components}/accordion/anatomy/accordion-heading.svelte.d.ts +0 -0
- /package/dist/{composed → components}/accordion/anatomy/accordion-indicator.svelte.d.ts +0 -0
- /package/dist/{composed → components}/accordion/anatomy/accordion-item.svelte.d.ts +0 -0
- /package/dist/{composed → components}/accordion/anatomy/accordion-root.svelte.d.ts +0 -0
- /package/dist/{composed → components}/accordion/anatomy/accordion-trigger.svelte.d.ts +0 -0
- /package/dist/{composed → components}/accordion/index.d.ts +0 -0
- /package/dist/{composed → components}/accordion/index.js +0 -0
- /package/dist/{composed → components}/accordion/modules/anatomy.d.ts +0 -0
- /package/dist/{composed → components}/accordion/modules/anatomy.js +0 -0
- /package/dist/{composed → components}/accordion/modules/context.d.ts +0 -0
- /package/dist/{composed → components}/accordion/modules/context.js +0 -0
- /package/dist/{composed → components}/accordion/modules/types.d.ts +0 -0
- /package/dist/components/{Accordion → accordion/modules}/types.js +0 -0
- /package/dist/{composed → components}/avatar/anatomy/avatar-fallback.svelte.d.ts +0 -0
- /package/dist/{composed → components}/avatar/anatomy/avatar-image.svelte.d.ts +0 -0
- /package/dist/{composed → components}/avatar/anatomy/avatar-root.svelte.d.ts +0 -0
- /package/dist/{composed → components}/avatar/index.d.ts +0 -0
- /package/dist/{composed → components}/avatar/index.js +0 -0
- /package/dist/{composed → components}/avatar/modules/anatomy.d.ts +0 -0
- /package/dist/{composed → components}/avatar/modules/anatomy.js +0 -0
- /package/dist/{composed → components}/avatar/modules/context.d.ts +0 -0
- /package/dist/{composed → components}/avatar/modules/context.js +0 -0
- /package/dist/{composed → components}/avatar/modules/types.d.ts +0 -0
- /package/dist/{composed → components}/avatar/modules/types.js +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import * as avatar from '@zag-js/avatar';
|
|
3
|
-
import { useMachine, normalizeProps } from '@zag-js/svelte';
|
|
4
|
-
import type { AvatarProps } from './types.js';
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
src,
|
|
8
|
-
srcset,
|
|
9
|
-
name,
|
|
10
|
-
initials = [0, -1],
|
|
11
|
-
// Root
|
|
12
|
-
base = 'overflow-hidden isolate',
|
|
13
|
-
background = 'bg-surface-400-600',
|
|
14
|
-
size = 'size-16',
|
|
15
|
-
font = '',
|
|
16
|
-
border = '',
|
|
17
|
-
rounded = 'rounded-full',
|
|
18
|
-
shadow = '',
|
|
19
|
-
classes = '',
|
|
20
|
-
// Image
|
|
21
|
-
imageBase = 'w-full object-cover',
|
|
22
|
-
imageClasses = '',
|
|
23
|
-
style = '',
|
|
24
|
-
// Fallback
|
|
25
|
-
fallbackBase = 'w-full h-full flex justify-center items-center',
|
|
26
|
-
fallbackClasses = '',
|
|
27
|
-
// Snippets
|
|
28
|
-
children,
|
|
29
|
-
// Zag
|
|
30
|
-
...zagProps
|
|
31
|
-
}: AvatarProps = $props();
|
|
32
|
-
|
|
33
|
-
// Zag
|
|
34
|
-
const id = $props.id();
|
|
35
|
-
const service = useMachine(avatar.machine, () => ({
|
|
36
|
-
id: id,
|
|
37
|
-
...zagProps
|
|
38
|
-
}));
|
|
39
|
-
const api = $derived(avatar.connect(service, normalizeProps));
|
|
40
|
-
|
|
41
|
-
// Generate Initials
|
|
42
|
-
function getInitials() {
|
|
43
|
-
const lettersArr = initials.map((index) => name.split(' ').at(index)?.charAt(0).toUpperCase());
|
|
44
|
-
return lettersArr.join('');
|
|
45
|
-
}
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
<!-- @component An image with a fallback for representing a single user. -->
|
|
49
|
-
|
|
50
|
-
<figure
|
|
51
|
-
{...api.getRootProps()}
|
|
52
|
-
class="{base} {background} {size} {font} {border} {rounded} {shadow} {classes}"
|
|
53
|
-
{style}
|
|
54
|
-
data-testid="avatar"
|
|
55
|
-
>
|
|
56
|
-
<!-- Fallback -->
|
|
57
|
-
<span {...api.getFallbackProps()} class="{fallbackBase} {fallbackClasses}" data-testid="avatar-fallback">
|
|
58
|
-
{#if children}
|
|
59
|
-
{@render children()}
|
|
60
|
-
{:else}
|
|
61
|
-
{getInitials()}
|
|
62
|
-
{/if}
|
|
63
|
-
</span>
|
|
64
|
-
<!-- Image -->
|
|
65
|
-
{#if src || srcset}
|
|
66
|
-
<img {...api.getImageProps()} {src} {srcset} alt={name} class="{imageBase} {imageClasses}" data-testid="avatar-image" />
|
|
67
|
-
{/if}
|
|
68
|
-
</figure>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import type * as avatar from '@zag-js/avatar';
|
|
4
|
-
export interface AvatarProps extends Omit<avatar.Props, 'id'>, Pick<HTMLAttributes<HTMLElement>, 'style'> {
|
|
5
|
-
/** Set avatar image source URL. */
|
|
6
|
-
src?: string;
|
|
7
|
-
/** The source set of the avatar image. */
|
|
8
|
-
srcset?: string;
|
|
9
|
-
/** Provide a name or username for the avatar. */
|
|
10
|
-
name: string;
|
|
11
|
-
/** Initials will be generated based on the name and this index array. */
|
|
12
|
-
initials?: number[];
|
|
13
|
-
/** Set base styles. */
|
|
14
|
-
base?: string;
|
|
15
|
-
/** Set background styles. */
|
|
16
|
-
background?: string;
|
|
17
|
-
/** Set size styles. */
|
|
18
|
-
size?: string;
|
|
19
|
-
/** Set font styles. */
|
|
20
|
-
font?: string;
|
|
21
|
-
/** Set border styles. */
|
|
22
|
-
border?: string;
|
|
23
|
-
/** Set border radius styles. */
|
|
24
|
-
rounded?: string;
|
|
25
|
-
/** Set shadow styles. */
|
|
26
|
-
shadow?: string;
|
|
27
|
-
/** Provide arbitrary CSS classes. */
|
|
28
|
-
classes?: string;
|
|
29
|
-
/** Set avatar image base styles. */
|
|
30
|
-
imageBase?: string;
|
|
31
|
-
/** Provide avatar image arbitrary CSS classes. */
|
|
32
|
-
imageClasses?: string;
|
|
33
|
-
/** Set base classes for the fallback element. */
|
|
34
|
-
fallbackBase?: string;
|
|
35
|
-
/** Provide arbitrary CSS classes to fallback element. */
|
|
36
|
-
fallbackClasses?: string;
|
|
37
|
-
/** The default child slot. */
|
|
38
|
-
children?: Snippet;
|
|
39
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends ComboboxItem">
|
|
2
|
-
import { fade } from 'svelte/transition';
|
|
3
|
-
import * as combobox from '@zag-js/combobox';
|
|
4
|
-
import { useMachine, normalizeProps, mergeProps } from '@zag-js/svelte';
|
|
5
|
-
import type { ComboboxProps, ComboboxItem } from './types.js';
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
data = [],
|
|
9
|
-
label = '',
|
|
10
|
-
zIndex = 'auto',
|
|
11
|
-
// Base
|
|
12
|
-
base = '',
|
|
13
|
-
width = '',
|
|
14
|
-
classes = '',
|
|
15
|
-
// Label
|
|
16
|
-
labelBase = 'label',
|
|
17
|
-
labelText = 'label-text',
|
|
18
|
-
labelClasses = '',
|
|
19
|
-
// Input
|
|
20
|
-
inputGroupBase = 'input-group grid-cols-[1fr_auto]',
|
|
21
|
-
inputGroupInput = 'ig-input',
|
|
22
|
-
inputGroupButton = 'ig-btn hover:preset-tonal',
|
|
23
|
-
inputGroupArrow = '',
|
|
24
|
-
inputGroupClasses = '',
|
|
25
|
-
// Positioner
|
|
26
|
-
positionerBase = '',
|
|
27
|
-
positionerClasses = '',
|
|
28
|
-
// Content
|
|
29
|
-
contentBase = 'card p-2 overflow-y-auto',
|
|
30
|
-
contentBackground = 'preset-outlined-surface-200-800 bg-surface-50-950',
|
|
31
|
-
contentSpaceY = 'space-y-1',
|
|
32
|
-
contentMaxHeight = 'max-h-80',
|
|
33
|
-
contentClasses = '',
|
|
34
|
-
// Option
|
|
35
|
-
optionBase = 'btn justify-start w-full',
|
|
36
|
-
optionHover = 'hover:preset-tonal',
|
|
37
|
-
optionActive = 'preset-filled-primary-500',
|
|
38
|
-
optionClasses = '',
|
|
39
|
-
// Snippets
|
|
40
|
-
arrow,
|
|
41
|
-
item,
|
|
42
|
-
// Events
|
|
43
|
-
onclick,
|
|
44
|
-
// Zag ---
|
|
45
|
-
...zagProps
|
|
46
|
-
}: ComboboxProps<T> = $props();
|
|
47
|
-
|
|
48
|
-
// Zag
|
|
49
|
-
let options = $derived(data);
|
|
50
|
-
|
|
51
|
-
const collection = $derived(
|
|
52
|
-
combobox.collection({
|
|
53
|
-
items: options,
|
|
54
|
-
// Map data structure
|
|
55
|
-
itemToValue: (item) => item.value,
|
|
56
|
-
itemToString: (item) => item.label
|
|
57
|
-
})
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
const id = $props.id();
|
|
61
|
-
const service = useMachine(combobox.machine, () => ({
|
|
62
|
-
id: id,
|
|
63
|
-
get collection() {
|
|
64
|
-
return collection;
|
|
65
|
-
},
|
|
66
|
-
...zagProps,
|
|
67
|
-
async onOpenChange(event) {
|
|
68
|
-
if (zagProps.onOpenChange) {
|
|
69
|
-
zagProps.onOpenChange(event);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
options = data;
|
|
73
|
-
},
|
|
74
|
-
async onInputValueChange(event) {
|
|
75
|
-
if (zagProps.onInputValueChange) {
|
|
76
|
-
zagProps.onInputValueChange(event);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const filtered = data.filter((item) => item.label.toLowerCase().includes(event.inputValue.toLowerCase()));
|
|
80
|
-
options = filtered;
|
|
81
|
-
}
|
|
82
|
-
}));
|
|
83
|
-
|
|
84
|
-
const api = $derived(combobox.connect(service, normalizeProps));
|
|
85
|
-
const triggerProps = $derived(mergeProps(api.getTriggerProps(), { onclick }));
|
|
86
|
-
</script>
|
|
87
|
-
|
|
88
|
-
<span {...api.getRootProps()} class="{base} {width} {classes}" data-testid="combobox">
|
|
89
|
-
<!-- Label -->
|
|
90
|
-
<label {...api.getLabelProps()} class="{labelBase} {labelClasses}">
|
|
91
|
-
{#if label}<span class={labelText}>{label}</span>{/if}
|
|
92
|
-
<!-- Input Group -->
|
|
93
|
-
<div {...api.getControlProps()} class="{inputGroupBase} {inputGroupClasses}">
|
|
94
|
-
<!-- Input -->
|
|
95
|
-
<input {...api.getInputProps()} class={inputGroupInput} />
|
|
96
|
-
<!-- Arrow -->
|
|
97
|
-
<button {...triggerProps} class={inputGroupButton}>
|
|
98
|
-
{#if arrow}
|
|
99
|
-
{@render arrow()}
|
|
100
|
-
{:else}
|
|
101
|
-
<svg
|
|
102
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
103
|
-
width="16"
|
|
104
|
-
height="16"
|
|
105
|
-
viewBox="0 0 24 24"
|
|
106
|
-
fill="none"
|
|
107
|
-
stroke="currentColor"
|
|
108
|
-
stroke-width="2"
|
|
109
|
-
stroke-linecap="round"
|
|
110
|
-
stroke-linejoin="round"
|
|
111
|
-
style="opacity: 0.5"
|
|
112
|
-
class={inputGroupArrow}
|
|
113
|
-
>
|
|
114
|
-
<path d="m6 9 6 6 6-6" />
|
|
115
|
-
</svg>
|
|
116
|
-
{/if}
|
|
117
|
-
</button>
|
|
118
|
-
</div>
|
|
119
|
-
</label>
|
|
120
|
-
<!-- Menu -->
|
|
121
|
-
{#if api.open}
|
|
122
|
-
<div {...api.getPositionerProps()} transition:fade={{ duration: 100 }} class="{positionerBase} {positionerClasses}">
|
|
123
|
-
{#if options.length > 0}
|
|
124
|
-
<!-- Content (list) -->
|
|
125
|
-
<nav
|
|
126
|
-
{...api.getContentProps()}
|
|
127
|
-
class="{contentBase} {contentBackground} {contentSpaceY} {contentClasses} {contentMaxHeight}"
|
|
128
|
-
style="z-index: {zIndex}"
|
|
129
|
-
>
|
|
130
|
-
{#each options as option (option.label)}
|
|
131
|
-
{@const isChecked = api.getItemProps({ item: option })['data-state'] === 'checked'}
|
|
132
|
-
{@const displayClass = isChecked ? optionActive : optionHover}
|
|
133
|
-
<!-- Option -->
|
|
134
|
-
<!-- ZagJs should have set button type to "button" here. -->
|
|
135
|
-
<!-- See https://github.com/skeletonlabs/skeleton/pull/2998#discussion_r1855511385 -->
|
|
136
|
-
<button {...api.getItemProps({ item: option })} class="{optionBase} {displayClass} {optionClasses}" type="button">
|
|
137
|
-
{#if item}
|
|
138
|
-
{@render item(option)}
|
|
139
|
-
{:else}
|
|
140
|
-
{option.label}
|
|
141
|
-
{/if}
|
|
142
|
-
</button>
|
|
143
|
-
{/each}
|
|
144
|
-
</nav>
|
|
145
|
-
{/if}
|
|
146
|
-
</div>
|
|
147
|
-
{/if}
|
|
148
|
-
</span>
|
|
149
|
-
|
|
150
|
-
<style>
|
|
151
|
-
[data-part='item'][data-highlighted]:not([data-state='checked']) {
|
|
152
|
-
background-color: var(--color-surface-200-800);
|
|
153
|
-
}
|
|
154
|
-
</style>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ComboboxProps, ComboboxItem } from './types.js';
|
|
2
|
-
declare class __sveltets_Render<T extends ComboboxItem> {
|
|
3
|
-
props(): ComboboxProps<T>;
|
|
4
|
-
events(): {};
|
|
5
|
-
slots(): {};
|
|
6
|
-
bindings(): "";
|
|
7
|
-
exports(): {};
|
|
8
|
-
}
|
|
9
|
-
interface $$IsomorphicComponent {
|
|
10
|
-
new <T extends ComboboxItem>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
11
|
-
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
12
|
-
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
13
|
-
<T extends ComboboxItem>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
14
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
15
|
-
}
|
|
16
|
-
declare const Combobox: $$IsomorphicComponent;
|
|
17
|
-
type Combobox<T extends ComboboxItem> = InstanceType<typeof Combobox<T>>;
|
|
18
|
-
export default Combobox;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import * as combobox from '@zag-js/combobox';
|
|
3
|
-
export interface ComboboxProps<T extends ComboboxItem> extends Omit<combobox.Props, 'id' | 'collection'> {
|
|
4
|
-
/** Provide the list of label and value data */
|
|
5
|
-
data?: T[];
|
|
6
|
-
/** Set the label to display. */
|
|
7
|
-
label?: string;
|
|
8
|
-
/** Set a positioner style for z-index, ex: "10" */
|
|
9
|
-
zIndex?: string;
|
|
10
|
-
/** Set base classes for the root element. */
|
|
11
|
-
base?: string;
|
|
12
|
-
/** Set width classes for the root element. */
|
|
13
|
-
width?: string;
|
|
14
|
-
/** Provide arbitrary classes for the root element. */
|
|
15
|
-
classes?: string;
|
|
16
|
-
/** Set base classes for the label. */
|
|
17
|
-
labelBase?: string;
|
|
18
|
-
/** Set text and font classes for the label. */
|
|
19
|
-
labelText?: string;
|
|
20
|
-
/** Provide arbitrary classes for the label. */
|
|
21
|
-
labelClasses?: string;
|
|
22
|
-
/** Set base classes for the input group. */
|
|
23
|
-
inputGroupBase?: string;
|
|
24
|
-
/** Set input classes for the input group. */
|
|
25
|
-
inputGroupInput?: string;
|
|
26
|
-
/** Set button classes for the input group. */
|
|
27
|
-
inputGroupButton?: string;
|
|
28
|
-
/** Set arrow classes for the input group. */
|
|
29
|
-
inputGroupArrow?: string;
|
|
30
|
-
/** Provide arbitrary classes for the input group. */
|
|
31
|
-
inputGroupClasses?: string;
|
|
32
|
-
/** Set base classes for the positioner. */
|
|
33
|
-
positionerBase?: string;
|
|
34
|
-
/** Provide arbitrary classes for the positioner. */
|
|
35
|
-
positionerClasses?: string;
|
|
36
|
-
/** Set base classes for the content. */
|
|
37
|
-
contentBase?: string;
|
|
38
|
-
/** Set background classes for the content. */
|
|
39
|
-
contentBackground?: string;
|
|
40
|
-
/** Set space-y classes for the content. */
|
|
41
|
-
contentSpaceY?: string;
|
|
42
|
-
/** Set max-h classes for the content. */
|
|
43
|
-
contentMaxHeight?: string;
|
|
44
|
-
/** Provide arbitrary classes for the content. */
|
|
45
|
-
contentClasses?: string;
|
|
46
|
-
/** Set base classes for the option. */
|
|
47
|
-
optionBase?: string;
|
|
48
|
-
/** Set focus classes for the option. */
|
|
49
|
-
optionFocus?: string;
|
|
50
|
-
/** Set hover classes for the option. */
|
|
51
|
-
optionHover?: string;
|
|
52
|
-
/** Set active classes for the option. */
|
|
53
|
-
optionActive?: string;
|
|
54
|
-
/** Provide arbitrary classes for the option. */
|
|
55
|
-
optionClasses?: string;
|
|
56
|
-
/** Provide a custom arrow icon. */
|
|
57
|
-
arrow?: Snippet;
|
|
58
|
-
/** Provide a custom template for the option. */
|
|
59
|
-
item?: Snippet<[T]>;
|
|
60
|
-
/** Handle the combobox dropdown button click event. */
|
|
61
|
-
onclick?: (event: Event) => void;
|
|
62
|
-
}
|
|
63
|
-
export interface ComboboxItem {
|
|
64
|
-
label: string;
|
|
65
|
-
value: string;
|
|
66
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as combobox from '@zag-js/combobox';
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import * as fileUpload from '@zag-js/file-upload';
|
|
3
|
-
import { useMachine, normalizeProps } from '@zag-js/svelte';
|
|
4
|
-
|
|
5
|
-
import type { FileUploadProps } from './types.js';
|
|
6
|
-
|
|
7
|
-
// Props
|
|
8
|
-
const {
|
|
9
|
-
label = `Select file or drag here`,
|
|
10
|
-
subtext = '',
|
|
11
|
-
// Root
|
|
12
|
-
base = '',
|
|
13
|
-
classes = '',
|
|
14
|
-
// Interface
|
|
15
|
-
interfaceBase = 'flex flex-col items-center gap-2 hover:cursor-pointer',
|
|
16
|
-
interfaceBg = 'hover:preset-tonal',
|
|
17
|
-
interfaceBorder = 'border-[1px] border-dashed',
|
|
18
|
-
interfaceBorderColor = 'border-surface-200-800',
|
|
19
|
-
interfacePadding = 'p-4 py-10',
|
|
20
|
-
interfaceRounded = 'rounded-container',
|
|
21
|
-
interfaceClasses = '',
|
|
22
|
-
// Interface (content)
|
|
23
|
-
interfaceIcon = '',
|
|
24
|
-
interfaceText = '',
|
|
25
|
-
interfaceSubtext = 'text-xs opacity-60',
|
|
26
|
-
// Files List
|
|
27
|
-
filesListBase = 'mt-2 space-y-2',
|
|
28
|
-
filesListClasses = '',
|
|
29
|
-
// File
|
|
30
|
-
fileBase = 'grid grid-cols-[auto_1fr_auto] rtl:grid-cols-[1fr_auto_auto] items-center',
|
|
31
|
-
fileBg = 'preset-tonal',
|
|
32
|
-
fileGap = 'gap-4 px-4',
|
|
33
|
-
filePadding = 'py-2',
|
|
34
|
-
fileRounded = 'rounded-base',
|
|
35
|
-
fileClasses = '',
|
|
36
|
-
// File (content)
|
|
37
|
-
fileIcon = '',
|
|
38
|
-
fileName = 'text-sm flex items-center gap-4',
|
|
39
|
-
fileSize = 'text-xs opacity-60',
|
|
40
|
-
fileButton = '',
|
|
41
|
-
// State
|
|
42
|
-
stateInvalid = 'border-error-500',
|
|
43
|
-
stateDisabled = 'disabled',
|
|
44
|
-
stateDragging = 'preset-filled-primary-500',
|
|
45
|
-
// Children
|
|
46
|
-
children,
|
|
47
|
-
iconInterface,
|
|
48
|
-
iconFile,
|
|
49
|
-
iconFileRemove,
|
|
50
|
-
// Zag
|
|
51
|
-
...zagProps
|
|
52
|
-
}: FileUploadProps = $props();
|
|
53
|
-
|
|
54
|
-
// Zag
|
|
55
|
-
const id = $props.id();
|
|
56
|
-
const service = useMachine(fileUpload.machine, () => ({
|
|
57
|
-
id: id,
|
|
58
|
-
...zagProps
|
|
59
|
-
}));
|
|
60
|
-
const api = $derived(fileUpload.connect(service, normalizeProps));
|
|
61
|
-
|
|
62
|
-
$effect.pre(() => {
|
|
63
|
-
zagProps.onApiReady?.(api);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// Reactive
|
|
67
|
-
const rxDisabled = $derived(service.prop('disabled') ? stateDisabled : '');
|
|
68
|
-
const rxInvalid = $derived(api.rejectedFiles.length > 0 ? stateInvalid : interfaceBorderColor);
|
|
69
|
-
const rxDragging = $derived(api.dragging && !children ? stateDragging : '');
|
|
70
|
-
</script>
|
|
71
|
-
|
|
72
|
-
<!-- @component A form component for handling file uploads. -->
|
|
73
|
-
|
|
74
|
-
<div
|
|
75
|
-
{...api.getRootProps()}
|
|
76
|
-
class="{base} {rxDisabled} {classes}"
|
|
77
|
-
style:display={children ? 'inline-block' : 'block'}
|
|
78
|
-
data-testid="uploader"
|
|
79
|
-
>
|
|
80
|
-
<div {...api.getDropzoneProps()}>
|
|
81
|
-
<!-- Hidden Input -->
|
|
82
|
-
<input {...api.getHiddenInputProps()} data-testid="uploader-input" />
|
|
83
|
-
<!-- Interface -->
|
|
84
|
-
{#if children}
|
|
85
|
-
{@render children()}
|
|
86
|
-
{:else}
|
|
87
|
-
<div
|
|
88
|
-
class="{interfaceBase} {interfaceBg} {interfaceBorder} {interfacePadding} {interfaceRounded} {rxInvalid} {rxDragging} {interfaceClasses}"
|
|
89
|
-
data-testid="uploader-interface"
|
|
90
|
-
>
|
|
91
|
-
<!-- Icon -->
|
|
92
|
-
{#if iconInterface}<span class={interfaceIcon} data-testid="uploader-interface-icon">{@render iconInterface()}</span>{/if}
|
|
93
|
-
<!-- Label -->
|
|
94
|
-
{#if label}<p class={interfaceText} data-testid="uploader-interface-label">{label}</p>{/if}
|
|
95
|
-
<!-- Subtext -->
|
|
96
|
-
{#if subtext}<small class={interfaceSubtext} data-testid="uploader-interface-subtext">{subtext}</small>{/if}
|
|
97
|
-
</div>
|
|
98
|
-
{/if}
|
|
99
|
-
</div>
|
|
100
|
-
<!-- Files (list) -->
|
|
101
|
-
{#if !children}
|
|
102
|
-
<ul {...api.getItemGroupProps()} class="{filesListBase} {filesListClasses}" data-testid="uploader-files-list">
|
|
103
|
-
<!-- Loop Files -->
|
|
104
|
-
{#each api.acceptedFiles as file (file)}
|
|
105
|
-
<!-- File -->
|
|
106
|
-
<li
|
|
107
|
-
{...api.getItemProps({ file })}
|
|
108
|
-
class="{fileBase} {fileBg} {fileGap} {filePadding} {fileRounded} {fileClasses}"
|
|
109
|
-
data-testid="uploader-file"
|
|
110
|
-
>
|
|
111
|
-
<!-- Name -->
|
|
112
|
-
<p {...api.getItemNameProps({ file })} class={fileName} data-testid="uploader-file-name">
|
|
113
|
-
{#if iconFile}<span class={fileIcon} data-testid="uploader-file-icon">{@render iconFile()}</span>{/if}
|
|
114
|
-
<span>{file.name}</span>
|
|
115
|
-
</p>
|
|
116
|
-
<!-- Size -->
|
|
117
|
-
<p {...api.getItemNameProps({ file })} class={fileSize} data-testid="uploader-file-size">
|
|
118
|
-
{api.getFileSize(file)}
|
|
119
|
-
</p>
|
|
120
|
-
<!-- Button -->
|
|
121
|
-
<button {...api.getItemDeleteTriggerProps({ file })} class={fileButton} data-testid="uploader-file-button">
|
|
122
|
-
{#if iconFileRemove}
|
|
123
|
-
{@render iconFileRemove()}
|
|
124
|
-
{:else}
|
|
125
|
-
<span>✕</span>
|
|
126
|
-
{/if}
|
|
127
|
-
</button>
|
|
128
|
-
</li>
|
|
129
|
-
{/each}
|
|
130
|
-
</ul>
|
|
131
|
-
{/if}
|
|
132
|
-
</div>
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import * as fileUpload from '@zag-js/file-upload';
|
|
3
|
-
import type { PropTypes } from '@zag-js/svelte';
|
|
4
|
-
export type FileUploadApi = fileUpload.Api<PropTypes>;
|
|
5
|
-
export interface FileUploadProps extends Omit<fileUpload.Props, 'id'> {
|
|
6
|
-
/** Set the interface text value. */
|
|
7
|
-
label?: string;
|
|
8
|
-
/** Set the interface subtext value. */
|
|
9
|
-
subtext?: string;
|
|
10
|
-
/** Set root base classes */
|
|
11
|
-
base?: string;
|
|
12
|
-
/** Set root arbitrary classes */
|
|
13
|
-
classes?: string;
|
|
14
|
-
/** Set interface base classes */
|
|
15
|
-
interfaceBase?: string;
|
|
16
|
-
/** Set interface background classes */
|
|
17
|
-
interfaceBg?: string;
|
|
18
|
-
/** Set interface border classes */
|
|
19
|
-
interfaceBorder?: string;
|
|
20
|
-
/** Set interface border color classes */
|
|
21
|
-
interfaceBorderColor?: string;
|
|
22
|
-
/** Set interface border classes */
|
|
23
|
-
interfacePadding?: string;
|
|
24
|
-
/** Set interface border radius classes */
|
|
25
|
-
interfaceRounded?: string;
|
|
26
|
-
/** Set interface arbitrary classes */
|
|
27
|
-
interfaceClasses?: string;
|
|
28
|
-
/** Set interface icon classes */
|
|
29
|
-
interfaceIcon?: string;
|
|
30
|
-
/** Set interface text classes */
|
|
31
|
-
interfaceText?: string;
|
|
32
|
-
/** Set interface subtext classes */
|
|
33
|
-
interfaceSubtext?: string;
|
|
34
|
-
/** Set file list base classes */
|
|
35
|
-
filesListBase?: string;
|
|
36
|
-
/** Set file list arbitrary classes */
|
|
37
|
-
filesListClasses?: string;
|
|
38
|
-
/** Set file base classes */
|
|
39
|
-
fileBase?: string;
|
|
40
|
-
/** Set file background classes */
|
|
41
|
-
fileBg?: string;
|
|
42
|
-
/** Set file gap classes */
|
|
43
|
-
fileGap?: string;
|
|
44
|
-
/** Set file padding classes */
|
|
45
|
-
filePadding?: string;
|
|
46
|
-
/** Set file border-radius classes */
|
|
47
|
-
fileRounded?: string;
|
|
48
|
-
/** Set file arbitrary classes */
|
|
49
|
-
fileClasses?: string;
|
|
50
|
-
/** Set file icon classes */
|
|
51
|
-
fileIcon?: string;
|
|
52
|
-
/** Set file name classes */
|
|
53
|
-
fileName?: string;
|
|
54
|
-
/** Set file size classes */
|
|
55
|
-
fileSize?: string;
|
|
56
|
-
/** Set file button classes */
|
|
57
|
-
fileButton?: string;
|
|
58
|
-
/** Set disabled state classes for the root. */
|
|
59
|
-
stateDisabled?: string;
|
|
60
|
-
/** Set invalid state classes for the interface. */
|
|
61
|
-
stateInvalid?: string;
|
|
62
|
-
/** Set dragging state classes for the interface. */
|
|
63
|
-
stateDragging?: string;
|
|
64
|
-
/** The default children content. */
|
|
65
|
-
children?: Snippet;
|
|
66
|
-
/** Provide an icon for the interface. */
|
|
67
|
-
iconInterface?: Snippet;
|
|
68
|
-
/** Provide an icon proceeding each file. */
|
|
69
|
-
iconFile?: Snippet;
|
|
70
|
-
/** Provide an icon for the remove file action. */
|
|
71
|
-
iconFileRemove?: Snippet;
|
|
72
|
-
/** Binds the Zag API for external use. */
|
|
73
|
-
onApiReady?: (api: FileUploadApi) => void;
|
|
74
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as fileUpload from '@zag-js/file-upload';
|