@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,102 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { normalizeProps, useMachine } from '@zag-js/svelte';
|
|
3
|
-
import * as zagSwitch from '@zag-js/switch';
|
|
4
|
-
import type { SwitchProps } from './types.js';
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
compact = false,
|
|
8
|
-
// Root (Track)
|
|
9
|
-
base = 'inline-flex items-center gap-4',
|
|
10
|
-
classes = '',
|
|
11
|
-
// State
|
|
12
|
-
stateFocused = 'data-[focus-visible]:focused',
|
|
13
|
-
// Control
|
|
14
|
-
controlBase = 'cursor-pointer transition duration-200',
|
|
15
|
-
controlInactive = 'preset-filled-surface-200-800',
|
|
16
|
-
controlActive = 'preset-filled-primary-500',
|
|
17
|
-
controlDisabled = 'opacity-50 cursor-not-allowed',
|
|
18
|
-
controlWidth = 'w-10',
|
|
19
|
-
controlHeight = 'h-6',
|
|
20
|
-
controlPadding = 'p-0.5',
|
|
21
|
-
controlRounded = 'rounded-full',
|
|
22
|
-
controlHover = 'hover:brightness-90 dark:hover:brightness-110',
|
|
23
|
-
controlClasses = '',
|
|
24
|
-
// Thumb
|
|
25
|
-
thumbBase = 'right-0 aspect-square h-full flex justify-center items-center text-right cursor-pointer',
|
|
26
|
-
thumbInactive = 'preset-filled-surface-50-950',
|
|
27
|
-
thumbActive = 'bg-surface-50 text-surface-contrast-50',
|
|
28
|
-
thumbRounded = 'rounded-full',
|
|
29
|
-
thumbTranslateX = 'translate-x-4 rtl:-translate-x-4',
|
|
30
|
-
thumbTransition = 'transition',
|
|
31
|
-
thumbEase = 'ease-in-out',
|
|
32
|
-
thumbDuration = 'duration-200',
|
|
33
|
-
thumbClasses = '',
|
|
34
|
-
// Label
|
|
35
|
-
labelBase = '',
|
|
36
|
-
labelClasses = '',
|
|
37
|
-
// Icons
|
|
38
|
-
iconInactiveBase = 'pointer-events-none',
|
|
39
|
-
iconActiveBase = 'pointer-events-none',
|
|
40
|
-
// Snippets
|
|
41
|
-
children,
|
|
42
|
-
inactiveChild,
|
|
43
|
-
activeChild,
|
|
44
|
-
// ZagProps
|
|
45
|
-
...zagProps
|
|
46
|
-
}: SwitchProps = $props();
|
|
47
|
-
|
|
48
|
-
// Zag
|
|
49
|
-
const id = $props.id();
|
|
50
|
-
const service = useMachine(zagSwitch.machine, () => ({
|
|
51
|
-
id: id,
|
|
52
|
-
...zagProps
|
|
53
|
-
}));
|
|
54
|
-
const api = $derived(zagSwitch.connect(service, normalizeProps));
|
|
55
|
-
|
|
56
|
-
const rxControlBase = $derived(compact ? thumbBase : controlBase);
|
|
57
|
-
const rxControlHeight = $derived(compact ? '' : controlHeight);
|
|
58
|
-
const rxControlPadding = $derived(compact ? '' : controlPadding);
|
|
59
|
-
const rxThumbInactive = $derived(compact ? controlInactive : thumbInactive);
|
|
60
|
-
const rxThumbActive = $derived(compact ? controlActive : thumbActive);
|
|
61
|
-
const rxThumbTranslateX = $derived(compact ? '' : thumbTranslateX);
|
|
62
|
-
|
|
63
|
-
const rxTrackState = $derived(api.checked ? controlActive : controlInactive);
|
|
64
|
-
const rxThumbState = $derived(api.checked ? `${rxThumbActive} ${rxThumbTranslateX}` : rxThumbInactive);
|
|
65
|
-
const rxDisabled = $derived(api.disabled ? controlDisabled : '');
|
|
66
|
-
const rxFocused = $derived(api.focused ? stateFocused : '');
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<!-- @component A control for toggling between checked states. -->
|
|
70
|
-
|
|
71
|
-
<label {...api.getRootProps()} class="{base} {classes}" data-testid="switch">
|
|
72
|
-
<!-- Input -->
|
|
73
|
-
<input {...api.getHiddenInputProps()} data-testid="switch-input" />
|
|
74
|
-
<!-- Control -->
|
|
75
|
-
<span
|
|
76
|
-
{...api.getControlProps()}
|
|
77
|
-
class="{rxControlBase} {rxTrackState} {rxFocused} {controlWidth} {rxControlHeight} {rxControlPadding} {controlRounded} {controlHover} {rxDisabled} {controlClasses}"
|
|
78
|
-
data-testid="switch-control"
|
|
79
|
-
>
|
|
80
|
-
<!-- Thumb -->
|
|
81
|
-
<span
|
|
82
|
-
{...api.getThumbProps()}
|
|
83
|
-
class="{thumbBase} {rxThumbState} {thumbRounded} {thumbTransition} {thumbEase} {thumbDuration} {thumbClasses}"
|
|
84
|
-
data-testid="switch-thumb"
|
|
85
|
-
>
|
|
86
|
-
<!-- Icon: Inactive -->
|
|
87
|
-
{#if !api.checked && inactiveChild}
|
|
88
|
-
<span class={iconInactiveBase} data-testid="switch-icon-inactive">{@render inactiveChild()}</span>
|
|
89
|
-
{/if}
|
|
90
|
-
<!-- Icon: Active -->
|
|
91
|
-
{#if api.checked && activeChild}
|
|
92
|
-
<span class={iconActiveBase} data-testid="switch-icon-active">{@render activeChild()}</span>
|
|
93
|
-
{/if}
|
|
94
|
-
</span>
|
|
95
|
-
</span>
|
|
96
|
-
<!-- Label -->
|
|
97
|
-
{#if children}
|
|
98
|
-
<span {...api.getLabelProps()} class="{labelBase} {labelClasses}" data-testid="switch-label">
|
|
99
|
-
{@render children()}
|
|
100
|
-
</span>
|
|
101
|
-
{/if}
|
|
102
|
-
</label>
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as zagSwitch from '@zag-js/switch';
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
export interface SwitchProps extends Omit<zagSwitch.Props, 'id'> {
|
|
4
|
-
/** Set the compact display mode. */
|
|
5
|
-
compact?: boolean;
|
|
6
|
-
/** Set base classes for the root element. */
|
|
7
|
-
base?: string;
|
|
8
|
-
/** Provide arbitrary classes to the root element. */
|
|
9
|
-
classes?: string;
|
|
10
|
-
/** Set classes for the focus state. */
|
|
11
|
-
stateFocused?: string;
|
|
12
|
-
/** Set base classes for the control element. */
|
|
13
|
-
controlBase?: string;
|
|
14
|
-
/** Set inactive state classes for the control element. */
|
|
15
|
-
controlInactive?: string;
|
|
16
|
-
/** Set active state classes for the control element. */
|
|
17
|
-
controlActive?: string;
|
|
18
|
-
/** Set disabled state classes for the control element. */
|
|
19
|
-
controlDisabled?: string;
|
|
20
|
-
/** Set width classes for the control element. */
|
|
21
|
-
controlWidth?: string;
|
|
22
|
-
/** Set height classes for the control element. */
|
|
23
|
-
controlHeight?: string;
|
|
24
|
-
/** Set padding classes for the control element. */
|
|
25
|
-
controlPadding?: string;
|
|
26
|
-
/** Set rounded classes for the control element. */
|
|
27
|
-
controlRounded?: string;
|
|
28
|
-
/** Set hover classes for the control element. */
|
|
29
|
-
controlHover?: string;
|
|
30
|
-
/** Provide arbitrary classes to the control element. */
|
|
31
|
-
controlClasses?: string;
|
|
32
|
-
/** Set base classes for the thumb element. */
|
|
33
|
-
thumbBase?: string;
|
|
34
|
-
/** Set inactive classes for the thumb element. */
|
|
35
|
-
thumbInactive?: string;
|
|
36
|
-
/** Set active classes for the thumb element. */
|
|
37
|
-
thumbActive?: string;
|
|
38
|
-
/** Set rounded classes for the thumb element. */
|
|
39
|
-
thumbRounded?: string;
|
|
40
|
-
/** Set animation X-axis translate classes for the thumb element. */
|
|
41
|
-
thumbTranslateX?: string;
|
|
42
|
-
/** Set animation transition classes for the thumb element. */
|
|
43
|
-
thumbTransition?: string;
|
|
44
|
-
/** Set animation easing classes for the thumb element. */
|
|
45
|
-
thumbEase?: string;
|
|
46
|
-
/** Set animation duration classes for the thumb element. */
|
|
47
|
-
thumbDuration?: string;
|
|
48
|
-
/** Provide arbitrary classes to the thumb element. */
|
|
49
|
-
thumbClasses?: string;
|
|
50
|
-
/** Set base classes for the label element. */
|
|
51
|
-
labelBase?: string;
|
|
52
|
-
/** Provide arbitrary classes to the label element. */
|
|
53
|
-
labelClasses?: string;
|
|
54
|
-
/** Set base classes for the inactive icon child. */
|
|
55
|
-
iconInactiveBase?: string;
|
|
56
|
-
/** Set base classes for the active icon child. */
|
|
57
|
-
iconActiveBase?: string;
|
|
58
|
-
/** The default children snippet. */
|
|
59
|
-
children?: Snippet;
|
|
60
|
-
/** The inactive state snippet. */
|
|
61
|
-
inactiveChild?: Snippet;
|
|
62
|
-
/** The active state snippet. */
|
|
63
|
-
activeChild?: Snippet;
|
|
64
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as zagSwitch from '@zag-js/switch';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import * as tabs from '@zag-js/tabs';
|
|
3
|
-
import { useMachine, normalizeProps } from '@zag-js/svelte';
|
|
4
|
-
import type { TabsProps } from './types.js';
|
|
5
|
-
import { setTabContext } from './context.js';
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
fluid = false,
|
|
9
|
-
// Root
|
|
10
|
-
base = 'w-full',
|
|
11
|
-
classes = '',
|
|
12
|
-
// List
|
|
13
|
-
listBase = 'flex',
|
|
14
|
-
listJustify = 'justify-start',
|
|
15
|
-
listBorder = 'border-b-[1px] border-surface-200-800',
|
|
16
|
-
listMargin = 'mb-4',
|
|
17
|
-
listGap = 'gap-2',
|
|
18
|
-
listClasses = '',
|
|
19
|
-
// Content
|
|
20
|
-
contentBase = '',
|
|
21
|
-
contentClasses = '',
|
|
22
|
-
// Snippets
|
|
23
|
-
list,
|
|
24
|
-
content,
|
|
25
|
-
// Zag
|
|
26
|
-
...zagProps
|
|
27
|
-
}: TabsProps = $props();
|
|
28
|
-
|
|
29
|
-
// Zag
|
|
30
|
-
const id = $props.id();
|
|
31
|
-
const service = useMachine(tabs.machine, () => ({
|
|
32
|
-
id: id,
|
|
33
|
-
...zagProps
|
|
34
|
-
}));
|
|
35
|
-
const api = $derived(tabs.connect(service, normalizeProps));
|
|
36
|
-
|
|
37
|
-
// Set Context
|
|
38
|
-
setTabContext({
|
|
39
|
-
get api() {
|
|
40
|
-
return api;
|
|
41
|
-
},
|
|
42
|
-
get fluid() {
|
|
43
|
-
return fluid;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
<!-- @component Use tabs to quickly switch between different views and pages. -->
|
|
49
|
-
|
|
50
|
-
<div {...api.getRootProps()} class="{base} {classes}" data-testid="tabs">
|
|
51
|
-
<!-- List -->
|
|
52
|
-
<div {...api.getListProps()} class="{listBase} {listJustify} {listBorder} {listMargin} {listGap} {listClasses}" data-testid="tabs-list">
|
|
53
|
-
{@render list?.()}
|
|
54
|
-
</div>
|
|
55
|
-
<!-- Content -->
|
|
56
|
-
<div class="{contentBase} {contentClasses}" data-testid="tabs-content">
|
|
57
|
-
{@render content?.()}
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { getTabContext } from './context.js';
|
|
3
|
-
import type { TabsControlProps } from './types.js';
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
// Root
|
|
7
|
-
base = 'border-b-[1px] border-transparent',
|
|
8
|
-
padding = 'pb-2',
|
|
9
|
-
translateX = 'translate-y-[1px]',
|
|
10
|
-
classes = '',
|
|
11
|
-
// Label
|
|
12
|
-
labelBase = 'btn hover:preset-tonal-primary',
|
|
13
|
-
labelClasses = '',
|
|
14
|
-
// State
|
|
15
|
-
stateInactive = '[&:not(:hover)]:opacity-50',
|
|
16
|
-
stateActive = 'border-b-surface-950-50 opacity-100',
|
|
17
|
-
stateLabelInactive = '',
|
|
18
|
-
stateLabelActive = '',
|
|
19
|
-
// Snippets
|
|
20
|
-
lead,
|
|
21
|
-
children,
|
|
22
|
-
// Zag
|
|
23
|
-
...zagProps
|
|
24
|
-
}: TabsControlProps = $props();
|
|
25
|
-
|
|
26
|
-
// Get Context
|
|
27
|
-
const ctx = getTabContext();
|
|
28
|
-
const state = $derived(ctx.api.getTriggerState(zagProps));
|
|
29
|
-
|
|
30
|
-
// Reactive
|
|
31
|
-
const rxActive = $derived(state.selected ? stateActive : stateInactive);
|
|
32
|
-
const rxLabelActive = $derived(state.selected ? stateLabelActive : stateLabelInactive);
|
|
33
|
-
|
|
34
|
-
// Styles
|
|
35
|
-
const commonWidth = $derived(ctx.fluid ? '100%' : '');
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<!-- @component A individual tab trigger element. -->
|
|
39
|
-
|
|
40
|
-
<button
|
|
41
|
-
{...ctx.api.getTriggerProps(zagProps)}
|
|
42
|
-
class="{base} {padding} {translateX} {rxActive} {classes}"
|
|
43
|
-
style:width={commonWidth}
|
|
44
|
-
data-testid="tabs-control"
|
|
45
|
-
>
|
|
46
|
-
<!-- Label -->
|
|
47
|
-
<div class="{labelBase} {rxLabelActive} {labelClasses}" style:width={commonWidth} data-testid="tabs-control-label">
|
|
48
|
-
{#if lead}<span>{@render lead()}</span>{/if}
|
|
49
|
-
<span>{@render children?.()}</span>
|
|
50
|
-
</div>
|
|
51
|
-
</button>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { getTabContext } from './context.js';
|
|
3
|
-
import type { TabsPanelProps } from './types.js';
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
// Root
|
|
7
|
-
base = '',
|
|
8
|
-
classes = '',
|
|
9
|
-
// Children
|
|
10
|
-
children,
|
|
11
|
-
// Zag
|
|
12
|
-
...zagProps
|
|
13
|
-
}: TabsPanelProps = $props();
|
|
14
|
-
|
|
15
|
-
// Get Context
|
|
16
|
-
const ctx = getTabContext();
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<!-- @component A individual tab panel of content. -->
|
|
20
|
-
|
|
21
|
-
<div {...ctx.api.getContentProps(zagProps)} class="{base} {classes}" data-testid="tabs-panel">
|
|
22
|
-
{@render children?.()}
|
|
23
|
-
</div>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare const _default: import("svelte").Component<import("./types").TabsProps, {}, ""> & {
|
|
2
|
-
Control: import("svelte").Component<import("./types").TabsControlProps, {}, "">;
|
|
3
|
-
Panel: import("svelte").Component<import("./types").TabsPanelProps, {}, "">;
|
|
4
|
-
};
|
|
5
|
-
export default _default;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import * as tabs from '@zag-js/tabs';
|
|
3
|
-
export interface TabsContextState {
|
|
4
|
-
fluid: boolean;
|
|
5
|
-
api: ReturnType<typeof tabs.connect>;
|
|
6
|
-
}
|
|
7
|
-
export interface TabsProps extends Omit<tabs.Props, 'id' | 'orientation'> {
|
|
8
|
-
/** Set tabs to stretch to fill the available width. */
|
|
9
|
-
fluid?: boolean;
|
|
10
|
-
/** Set base classes for the root element. */
|
|
11
|
-
base?: string;
|
|
12
|
-
/** Provide arbitrary classes for the root element. */
|
|
13
|
-
classes?: string;
|
|
14
|
-
/** Set base classes for the list element. */
|
|
15
|
-
listBase?: string;
|
|
16
|
-
/** Set justify classes for the list element. */
|
|
17
|
-
listJustify?: string;
|
|
18
|
-
/** Set border classes for the list element. */
|
|
19
|
-
listBorder?: string;
|
|
20
|
-
/** Set margin classes for the list element. */
|
|
21
|
-
listMargin?: string;
|
|
22
|
-
/** Set gap classes for the list element. */
|
|
23
|
-
listGap?: string;
|
|
24
|
-
/** Provide arbitrary classes for the list element. */
|
|
25
|
-
listClasses?: string;
|
|
26
|
-
/** Set base classes for the panel group element. */
|
|
27
|
-
contentBase?: string;
|
|
28
|
-
/** Provide arbitrary classes for the panel group element. */
|
|
29
|
-
contentClasses?: string;
|
|
30
|
-
/** Slot containing the list of tab controls. */
|
|
31
|
-
list?: Snippet;
|
|
32
|
-
/** Slot containing the list of panels. */
|
|
33
|
-
content?: Snippet;
|
|
34
|
-
}
|
|
35
|
-
export interface TabsControlProps extends tabs.TriggerProps {
|
|
36
|
-
/** Set base classes for the control element. */
|
|
37
|
-
base?: string;
|
|
38
|
-
/** Set padding classes for the control element. */
|
|
39
|
-
padding?: string;
|
|
40
|
-
/** Set x-axis translate classes for the control element. */
|
|
41
|
-
translateX?: string;
|
|
42
|
-
/** Provide arbitrary classes for the control element. */
|
|
43
|
-
classes?: string;
|
|
44
|
-
/** Set base classes for the label element. */
|
|
45
|
-
labelBase?: string;
|
|
46
|
-
/** Provide arbitrary classes for the label element. */
|
|
47
|
-
labelClasses?: string;
|
|
48
|
-
/** Set inactive classes for the control element. */
|
|
49
|
-
stateInactive?: string;
|
|
50
|
-
/** Set active classes for the control element. */
|
|
51
|
-
stateActive?: string;
|
|
52
|
-
/** Set inactive classes for the label element. */
|
|
53
|
-
stateLabelInactive?: string;
|
|
54
|
-
/** Set active classes for the label element. */
|
|
55
|
-
stateLabelActive?: string;
|
|
56
|
-
/** The lead slot. */
|
|
57
|
-
lead?: Snippet;
|
|
58
|
-
/** The default child slot. */
|
|
59
|
-
children?: Snippet;
|
|
60
|
-
}
|
|
61
|
-
export interface TabsPanelProps extends tabs.ContentProps {
|
|
62
|
-
/** Set base classes for the panel element. */
|
|
63
|
-
base?: string;
|
|
64
|
-
/** Provide arbitrary classes for the panel element. */
|
|
65
|
-
classes?: string;
|
|
66
|
-
/** The default child slot. */
|
|
67
|
-
children?: Snippet;
|
|
68
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as tabs from '@zag-js/tabs';
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import * as tagsInput from '@zag-js/tags-input';
|
|
3
|
-
import { useMachine, normalizeProps } from '@zag-js/svelte';
|
|
4
|
-
import type { TagsInputProps } from './types.js';
|
|
5
|
-
|
|
6
|
-
// Props
|
|
7
|
-
const {
|
|
8
|
-
placeholder = '',
|
|
9
|
-
// Root
|
|
10
|
-
base = 'grid input !h-auto',
|
|
11
|
-
gap = 'gap-2',
|
|
12
|
-
padding = 'p-3',
|
|
13
|
-
classes = '',
|
|
14
|
-
// Input: Add
|
|
15
|
-
inputBase = 'input-ghost',
|
|
16
|
-
inputClasses = '',
|
|
17
|
-
// Tag List
|
|
18
|
-
tagListBase = 'flex flex-wrap gap-1',
|
|
19
|
-
tagListClasses = '',
|
|
20
|
-
// Tag
|
|
21
|
-
tagBase = 'chip',
|
|
22
|
-
tagBackground = 'preset-filled',
|
|
23
|
-
tagClasses = '',
|
|
24
|
-
// Input: Edit
|
|
25
|
-
tagEditInputBase = 'input',
|
|
26
|
-
tagEditInputClasses = '',
|
|
27
|
-
// Delete Button
|
|
28
|
-
buttonDeleteBase = '',
|
|
29
|
-
buttonDeleteClasses = '',
|
|
30
|
-
// State
|
|
31
|
-
stateDisabled = 'disabled',
|
|
32
|
-
// Snippets
|
|
33
|
-
buttonDelete,
|
|
34
|
-
// Zag
|
|
35
|
-
...zagProps
|
|
36
|
-
}: TagsInputProps = $props();
|
|
37
|
-
|
|
38
|
-
// Zag
|
|
39
|
-
const id = $props.id();
|
|
40
|
-
const service = useMachine(tagsInput.machine, () => ({
|
|
41
|
-
id: id,
|
|
42
|
-
...zagProps
|
|
43
|
-
}));
|
|
44
|
-
const api = $derived(tagsInput.connect(service, normalizeProps));
|
|
45
|
-
|
|
46
|
-
// Reactive
|
|
47
|
-
const rxDisabled = $derived(service.prop('disabled') ? stateDisabled : '');
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
<!-- @component Capture a set of values from users via input and suggestions. -->
|
|
51
|
-
|
|
52
|
-
<div {...api.getRootProps()} class="{base} {padding} {gap} {rxDisabled} {classes}" data-testid="tags">
|
|
53
|
-
<!-- Input -->
|
|
54
|
-
<input {...api.getInputProps()} {placeholder} class="{inputBase} {inputClasses}" data-testid="tags-input-add" />
|
|
55
|
-
<!-- Hidden Input -->
|
|
56
|
-
<input {...api.getHiddenInputProps()} data-testid="tags-input" />
|
|
57
|
-
<!-- Tag List -->
|
|
58
|
-
{#if api.value.length > 0}
|
|
59
|
-
<div class="{tagListBase} {tagListClasses}" data-testid="tags-list">
|
|
60
|
-
{#each api.value as value, index (value)}
|
|
61
|
-
{@const itemState = api.getItemState({ index, value })}
|
|
62
|
-
<!-- Tag -->
|
|
63
|
-
<div {...api.getItemProps({ value, index })} data-testid="tags-tag">
|
|
64
|
-
<!-- Display -->
|
|
65
|
-
<div
|
|
66
|
-
{...api.getItemPreviewProps({ index, value })}
|
|
67
|
-
class="{tagBase} {tagBackground} {tagClasses}"
|
|
68
|
-
style:display={itemState.editing ? 'none' : ''}
|
|
69
|
-
data-testid="tag-display"
|
|
70
|
-
>
|
|
71
|
-
<span>{value}</span>
|
|
72
|
-
<!-- Delete Button -->
|
|
73
|
-
<button
|
|
74
|
-
{...api.getItemDeleteTriggerProps({ index, value })}
|
|
75
|
-
class="{buttonDeleteBase} {buttonDeleteClasses}"
|
|
76
|
-
data-testid="tag-delete"
|
|
77
|
-
>
|
|
78
|
-
{#if buttonDelete}
|
|
79
|
-
{@render buttonDelete()}
|
|
80
|
-
{:else}
|
|
81
|
-
<strong>×</strong>
|
|
82
|
-
{/if}
|
|
83
|
-
</button>
|
|
84
|
-
</div>
|
|
85
|
-
<!-- Editing -->
|
|
86
|
-
<input
|
|
87
|
-
{...api.getItemInputProps({ index, value })}
|
|
88
|
-
class="{tagEditInputBase} {tagEditInputClasses}"
|
|
89
|
-
style:display={itemState.editing ? '' : 'none'}
|
|
90
|
-
data-testid="tags-input-edit"
|
|
91
|
-
/>
|
|
92
|
-
</div>
|
|
93
|
-
{/each}
|
|
94
|
-
</div>
|
|
95
|
-
{/if}
|
|
96
|
-
</div>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { TagsInputProps } from './types.js';
|
|
2
|
-
/** Capture a set of values from users via input and suggestions. */
|
|
3
|
-
declare const TagsInput: import("svelte").Component<TagsInputProps, {}, "">;
|
|
4
|
-
type TagsInput = ReturnType<typeof TagsInput>;
|
|
5
|
-
export default TagsInput;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as tagsInput from '@zag-js/tags-input';
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
export interface TagsInputProps extends Omit<tagsInput.Props, 'id'> {
|
|
4
|
-
/** Set the add tag input placeholder. */
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
/** Set base classes for the root. */
|
|
7
|
-
base?: string;
|
|
8
|
-
/** Set gap classes for the root. */
|
|
9
|
-
gap?: string;
|
|
10
|
-
/** Set padding classes for the root. */
|
|
11
|
-
padding?: string;
|
|
12
|
-
/** Provide arbitrary classes to the root. */
|
|
13
|
-
classes?: string;
|
|
14
|
-
/** Set base classes for the add tag input. */
|
|
15
|
-
inputBase?: string;
|
|
16
|
-
/** Provide arbitrary classes to the add tag input. */
|
|
17
|
-
inputClasses?: string;
|
|
18
|
-
/** Set base classes for the tag list. */
|
|
19
|
-
tagListBase?: string;
|
|
20
|
-
/** Provide arbitrary classes to the tag list. */
|
|
21
|
-
tagListClasses?: string;
|
|
22
|
-
/** Set base classes for each tag. */
|
|
23
|
-
tagBase?: string;
|
|
24
|
-
/** Set background classes for each tag. */
|
|
25
|
-
tagBackground?: string;
|
|
26
|
-
/** Provide arbitrary classes to each tag. */
|
|
27
|
-
tagClasses?: string;
|
|
28
|
-
/** Set base classes for the edit tag input. */
|
|
29
|
-
tagEditInputBase?: string;
|
|
30
|
-
/** Provide arbitrary classes to the edit tag input. */
|
|
31
|
-
tagEditInputClasses?: string;
|
|
32
|
-
/** Set base classes for the delete button. */
|
|
33
|
-
buttonDeleteBase?: string;
|
|
34
|
-
/** Provide arbitrary classes to the delete button. */
|
|
35
|
-
buttonDeleteClasses?: string;
|
|
36
|
-
/** Set the component disabled state. */
|
|
37
|
-
stateDisabled?: string;
|
|
38
|
-
/** The delete button label snippet. */
|
|
39
|
-
buttonDelete?: Snippet;
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as tagsInput from '@zag-js/tags-input';
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import * as toast from '@zag-js/toast';
|
|
3
|
-
import type { ToastProps } from './types.js';
|
|
4
|
-
import { normalizeProps, useMachine } from '@zag-js/svelte';
|
|
5
|
-
|
|
6
|
-
const props: ToastProps = $props();
|
|
7
|
-
const service = useMachine(toast.machine, () => ({
|
|
8
|
-
...props.toast,
|
|
9
|
-
parent: props.parent,
|
|
10
|
-
index: props.index
|
|
11
|
-
}));
|
|
12
|
-
const api = $derived(toast.connect(service, normalizeProps));
|
|
13
|
-
const rxState = $derived.by(() => {
|
|
14
|
-
switch (api.type) {
|
|
15
|
-
case 'success':
|
|
16
|
-
return props.stateSuccess;
|
|
17
|
-
case 'warning':
|
|
18
|
-
return props.stateWarning;
|
|
19
|
-
case 'error':
|
|
20
|
-
return props.stateError;
|
|
21
|
-
default:
|
|
22
|
-
return props.stateInfo;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<div
|
|
28
|
-
class="{props.base} {props.width} {props.padding} {props.rounded} {rxState} {props.classes}"
|
|
29
|
-
{...api.getRootProps()}
|
|
30
|
-
data-testid="toast-root"
|
|
31
|
-
>
|
|
32
|
-
<!-- Text -->
|
|
33
|
-
<div class="{props.messageBase} {props.messageClasses}" data-testid="toast-message">
|
|
34
|
-
<!-- Title -->
|
|
35
|
-
<span class="{props.titleBase} {props.titleClasses}" {...api.getTitleProps()} data-testid="toast-title">{api.title}</span>
|
|
36
|
-
<!-- Description -->
|
|
37
|
-
<span class="{props.descriptionBase} {props.descriptionClasses}" {...api.getDescriptionProps()} data-testid="toast-description"
|
|
38
|
-
>{api.description}</span
|
|
39
|
-
>
|
|
40
|
-
</div>
|
|
41
|
-
{#if api.closable}
|
|
42
|
-
<!-- Dismiss Button -->
|
|
43
|
-
<button
|
|
44
|
-
class="{props.btnDismissBase} {props.btnDismissClasses}"
|
|
45
|
-
title={props.btnDismissTitle}
|
|
46
|
-
aria-label={props.btnDismissAriaLabel}
|
|
47
|
-
{...api.getCloseTriggerProps()}
|
|
48
|
-
data-testid="toast-dismiss">×</button
|
|
49
|
-
>
|
|
50
|
-
{/if}
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<style>
|
|
54
|
-
[data-part='root'] {
|
|
55
|
-
translate: var(--x) var(--y);
|
|
56
|
-
scale: var(--scale);
|
|
57
|
-
z-index: var(--z-index);
|
|
58
|
-
height: var(--height);
|
|
59
|
-
opacity: var(--opacity);
|
|
60
|
-
will-change: translate, opacity, scale;
|
|
61
|
-
}
|
|
62
|
-
[data-part='root'] {
|
|
63
|
-
transition:
|
|
64
|
-
translate 400ms,
|
|
65
|
-
scale 400ms,
|
|
66
|
-
opacity 400ms;
|
|
67
|
-
transition-timing-function: cubic-bezier(0.21, 1.02, 0.73, 1);
|
|
68
|
-
}
|
|
69
|
-
[data-part='root'][data-state='closed'] {
|
|
70
|
-
transition:
|
|
71
|
-
translate 400ms,
|
|
72
|
-
scale 400ms,
|
|
73
|
-
opacity 200ms;
|
|
74
|
-
transition-timing-function: cubic-bezier(0.06, 0.71, 0.55, 1);
|
|
75
|
-
}
|
|
76
|
-
</style>
|