ui-ingredients 0.0.42 → 0.0.44
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -0
- package/dist/file-upload/create-file-upload.svelte.js +1 -0
- package/dist/file-upload/root.svelte +1 -0
- package/dist/floating-panel/body.svelte +24 -0
- package/dist/floating-panel/body.svelte.d.ts +18 -0
- package/dist/floating-panel/close-trigger.svelte +27 -0
- package/dist/floating-panel/close-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/content.svelte +36 -0
- package/dist/floating-panel/content.svelte.d.ts +18 -0
- package/dist/floating-panel/context.svelte.d.ts +2 -0
- package/dist/floating-panel/context.svelte.js +2 -0
- package/dist/floating-panel/create-floating-panel.svelte.d.ts +7 -0
- package/dist/floating-panel/create-floating-panel.svelte.js +19 -0
- package/dist/floating-panel/drag-trigger.svelte +27 -0
- package/dist/floating-panel/drag-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/floating-panel.d.ts +13 -0
- package/dist/floating-panel/floating-panel.js +13 -0
- package/dist/floating-panel/header.svelte +25 -0
- package/dist/floating-panel/header.svelte.d.ts +18 -0
- package/dist/floating-panel/index.d.ts +16 -0
- package/dist/floating-panel/index.js +3 -0
- package/dist/floating-panel/maximize-trigger.svelte +28 -0
- package/dist/floating-panel/maximize-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/minimize-trigger.svelte +28 -0
- package/dist/floating-panel/minimize-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/positioner.svelte +35 -0
- package/dist/floating-panel/positioner.svelte.d.ts +18 -0
- package/dist/floating-panel/resize-trigger.svelte +36 -0
- package/dist/floating-panel/resize-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/restore-trigger.svelte +28 -0
- package/dist/floating-panel/restore-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/root.svelte +50 -0
- package/dist/floating-panel/root.svelte.d.ts +18 -0
- package/dist/floating-panel/title.svelte +25 -0
- package/dist/floating-panel/title.svelte.d.ts +18 -0
- package/dist/floating-panel/trigger.svelte +27 -0
- package/dist/floating-panel/trigger.svelte.d.ts +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/is-object.d.ts +2 -0
- package/dist/is-object.js +4 -0
- package/dist/merge-props.js +1 -4
- package/dist/portal/root.svelte +32 -32
- package/dist/presence/root.svelte +5 -1
- package/dist/switch/control.svelte +24 -24
- package/dist/switch/hidden-input.svelte +23 -23
- package/dist/switch/label.svelte +24 -24
- package/dist/switch/root.svelte +54 -54
- package/dist/switch/thumb.svelte +24 -24
- package/dist/toast/actor.svelte +19 -19
- package/dist/toast/toaster.svelte +39 -39
- package/dist/tour/arrow-tip.svelte +24 -0
- package/dist/tour/arrow-tip.svelte.d.ts +18 -0
- package/dist/tour/arrow.svelte +24 -0
- package/dist/tour/arrow.svelte.d.ts +18 -0
- package/dist/tour/close-trigger.svelte +25 -0
- package/dist/tour/close-trigger.svelte.d.ts +18 -0
- package/dist/tour/content.svelte +30 -0
- package/dist/tour/content.svelte.d.ts +18 -0
- package/dist/tour/context.svelte.d.ts +2 -0
- package/dist/tour/context.svelte.js +3 -0
- package/dist/tour/create-tour.svelte.d.ts +7 -0
- package/dist/tour/create-tour.svelte.js +19 -0
- package/dist/tour/description.svelte +24 -0
- package/dist/tour/description.svelte.d.ts +18 -0
- package/dist/tour/index.d.ts +17 -0
- package/dist/tour/index.js +3 -0
- package/dist/tour/next-trigger.svelte +24 -0
- package/dist/tour/next-trigger.svelte.d.ts +18 -0
- package/dist/tour/overlay.svelte +43 -0
- package/dist/tour/overlay.svelte.d.ts +18 -0
- package/dist/tour/positioner.svelte +30 -0
- package/dist/tour/positioner.svelte.d.ts +18 -0
- package/dist/tour/prev-trigger.svelte +24 -0
- package/dist/tour/prev-trigger.svelte.d.ts +18 -0
- package/dist/tour/progress-text.svelte +28 -0
- package/dist/tour/progress-text.svelte.d.ts +18 -0
- package/dist/tour/root.svelte +52 -0
- package/dist/tour/root.svelte.d.ts +18 -0
- package/dist/tour/skip-trigger.svelte +24 -0
- package/dist/tour/skip-trigger.svelte.d.ts +18 -0
- package/dist/tour/spotlight.svelte +24 -0
- package/dist/tour/spotlight.svelte.d.ts +18 -0
- package/dist/tour/title.svelte +24 -0
- package/dist/tour/title.svelte.d.ts +18 -0
- package/dist/tour/tour.d.ts +14 -0
- package/dist/tour/tour.js +14 -0
- package/dist/types.d.ts +10 -16
- package/package.json +46 -46
- package/dist/floating-panel/.gitkeep +0 -0
- package/dist/tour/.gitkeep +0 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
+
import type {Snippet} from 'svelte';
|
4
|
+
import type {
|
5
|
+
CreateFloatingPanelProps,
|
6
|
+
CreateFloatingPanelReturn,
|
7
|
+
} from './create-floating-panel.svelte.js';
|
8
|
+
|
9
|
+
export interface FloatingPanelProps
|
10
|
+
extends CreateFloatingPanelProps,
|
11
|
+
PresenceStrategyProps {
|
12
|
+
children?: Snippet<[CreateFloatingPanelReturn]>;
|
13
|
+
}
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<script lang="ts">
|
17
|
+
import {setPresenceContext} from '../presence/context.svelte.js';
|
18
|
+
import {createPresence} from '../presence/create-presence.svelte.js';
|
19
|
+
import {reflect} from '@zag-js/svelte';
|
20
|
+
import {createSplitProps} from '@zag-js/utils';
|
21
|
+
import {setFloatingPanelContext} from './context.svelte.js';
|
22
|
+
import {createFloatingPanel} from './create-floating-panel.svelte.js';
|
23
|
+
|
24
|
+
let {children, ...props}: FloatingPanelProps = $props();
|
25
|
+
|
26
|
+
let [presenceStrategyProps, floatingPanelProps] = $derived(
|
27
|
+
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
28
|
+
props,
|
29
|
+
),
|
30
|
+
);
|
31
|
+
|
32
|
+
let floatingPanel = createFloatingPanel(reflect(() => floatingPanelProps));
|
33
|
+
|
34
|
+
let presence = createPresence({
|
35
|
+
get present() {
|
36
|
+
return floatingPanel.open;
|
37
|
+
},
|
38
|
+
get lazyMount() {
|
39
|
+
return presenceStrategyProps.lazyMount;
|
40
|
+
},
|
41
|
+
get keepMounted() {
|
42
|
+
return presenceStrategyProps.keepMounted;
|
43
|
+
},
|
44
|
+
});
|
45
|
+
|
46
|
+
setFloatingPanelContext(floatingPanel);
|
47
|
+
setPresenceContext(presence);
|
48
|
+
</script>
|
49
|
+
|
50
|
+
{@render children?.(floatingPanel)}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
3
|
+
$$bindings?: Bindings;
|
4
|
+
} & Exports;
|
5
|
+
(internal: unknown, props: Props & {
|
6
|
+
$$events?: Events;
|
7
|
+
$$slots?: Slots;
|
8
|
+
}): Exports & {
|
9
|
+
$set?: any;
|
10
|
+
$on?: any;
|
11
|
+
};
|
12
|
+
z_$$bindings?: Bindings;
|
13
|
+
}
|
14
|
+
declare const Root: $$__sveltets_2_IsomorphicComponent<FloatingPanelProps, {
|
15
|
+
[evt: string]: CustomEvent<any>;
|
16
|
+
}, {}, {}, "">;
|
17
|
+
type Root = InstanceType<typeof Root>;
|
18
|
+
export default Root;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface FloatingPanelTitleProps
|
5
|
+
extends HtmlIngredientProps<'span'> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '../merge-props.js';
|
10
|
+
import {getFloatingPanelContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {asChild, children, ...props}: FloatingPanelTitleProps = $props();
|
13
|
+
|
14
|
+
let floatingPanel = getFloatingPanelContext();
|
15
|
+
|
16
|
+
let mergedProps = $derived(mergeProps(props, floatingPanel.getTitleProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
{#if asChild}
|
20
|
+
{@render asChild(mergedProps)}
|
21
|
+
{:else}
|
22
|
+
<span {...mergedProps}>
|
23
|
+
{@render children?.()}
|
24
|
+
</span>
|
25
|
+
{/if}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
3
|
+
$$bindings?: Bindings;
|
4
|
+
} & Exports;
|
5
|
+
(internal: unknown, props: Props & {
|
6
|
+
$$events?: Events;
|
7
|
+
$$slots?: Slots;
|
8
|
+
}): Exports & {
|
9
|
+
$set?: any;
|
10
|
+
$on?: any;
|
11
|
+
};
|
12
|
+
z_$$bindings?: Bindings;
|
13
|
+
}
|
14
|
+
declare const Title: $$__sveltets_2_IsomorphicComponent<FloatingPanelTitleProps, {
|
15
|
+
[evt: string]: CustomEvent<any>;
|
16
|
+
}, {}, {}, "">;
|
17
|
+
type Title = InstanceType<typeof Title>;
|
18
|
+
export default Title;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface FloatingPanelTriggerProps
|
5
|
+
extends HtmlIngredientProps<'button'> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '../merge-props.js';
|
10
|
+
import {getFloatingPanelContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {asChild, children, ...props}: FloatingPanelTriggerProps = $props();
|
13
|
+
|
14
|
+
let floatingPanel = getFloatingPanelContext();
|
15
|
+
|
16
|
+
let mergedProps = $derived(
|
17
|
+
mergeProps(props, floatingPanel.getTriggerProps()),
|
18
|
+
);
|
19
|
+
</script>
|
20
|
+
|
21
|
+
{#if asChild}
|
22
|
+
{@render asChild(mergedProps)}
|
23
|
+
{:else}
|
24
|
+
<button type="button" {...mergedProps}>
|
25
|
+
{@render children?.()}
|
26
|
+
</button>
|
27
|
+
{/if}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
3
|
+
$$bindings?: Bindings;
|
4
|
+
} & Exports;
|
5
|
+
(internal: unknown, props: Props & {
|
6
|
+
$$events?: Events;
|
7
|
+
$$slots?: Slots;
|
8
|
+
}): Exports & {
|
9
|
+
$set?: any;
|
10
|
+
$on?: any;
|
11
|
+
};
|
12
|
+
z_$$bindings?: Bindings;
|
13
|
+
}
|
14
|
+
declare const Trigger: $$__sveltets_2_IsomorphicComponent<FloatingPanelTriggerProps, {
|
15
|
+
[evt: string]: CustomEvent<any>;
|
16
|
+
}, {}, {}, "">;
|
17
|
+
type Trigger = InstanceType<typeof Trigger>;
|
18
|
+
export default Trigger;
|
package/dist/index.d.ts
CHANGED
@@ -12,6 +12,7 @@ export * from './editable/index.js';
|
|
12
12
|
export * from './environment-provider/index.js';
|
13
13
|
export * from './field/index.js';
|
14
14
|
export * from './file-upload/index.js';
|
15
|
+
export * from './floating-panel/index.js';
|
15
16
|
export * from './hover-card/index.js';
|
16
17
|
export * from './locale-provider/index.js';
|
17
18
|
export * from './menu/index.js';
|
@@ -39,4 +40,5 @@ export * from './timer/index.js';
|
|
39
40
|
export * from './toast/index.js';
|
40
41
|
export * from './toggle-group/index.js';
|
41
42
|
export * from './tooltip/index.js';
|
43
|
+
export * from './tour/index.js';
|
42
44
|
export * from './tree-view/index.js';
|
package/dist/index.js
CHANGED
@@ -12,6 +12,7 @@ export * from './editable/index.js';
|
|
12
12
|
export * from './environment-provider/index.js';
|
13
13
|
export * from './field/index.js';
|
14
14
|
export * from './file-upload/index.js';
|
15
|
+
export * from './floating-panel/index.js';
|
15
16
|
export * from './hover-card/index.js';
|
16
17
|
export * from './locale-provider/index.js';
|
17
18
|
export * from './menu/index.js';
|
@@ -39,4 +40,5 @@ export * from './timer/index.js';
|
|
39
40
|
export * from './toast/index.js';
|
40
41
|
export * from './toggle-group/index.js';
|
41
42
|
export * from './tooltip/index.js';
|
43
|
+
export * from './tour/index.js';
|
42
44
|
export * from './tree-view/index.js';
|
package/dist/merge-props.js
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
import { mergeProps as fn } from '@zag-js/svelte';
|
2
|
-
|
3
|
-
return (Object.prototype.toString.call(value) === '[object Object]' &&
|
4
|
-
value === Object(value));
|
5
|
-
}
|
2
|
+
import { isObject } from './is-object.js';
|
6
3
|
export function mergeProps(...args) {
|
7
4
|
const r = fn(...args);
|
8
5
|
const i = 'style';
|
package/dist/portal/root.svelte
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
<script module lang="ts">
|
2
|
-
import {type Snippet} from 'svelte';
|
3
|
-
|
4
|
-
export interface PortalProps {
|
5
|
-
container?: HTMLElement;
|
6
|
-
disabled?: boolean;
|
7
|
-
children: Snippet;
|
8
|
-
[x: `data-${string}`]: string | number | boolean | null | undefined;
|
9
|
-
}
|
10
|
-
</script>
|
11
|
-
|
12
|
-
<script lang="ts">
|
13
|
-
import {getEnvironmentContext} from '../environment-provider/index.js';
|
14
|
-
import {portal} from '@zag-js/svelte';
|
15
|
-
|
16
|
-
let {container, disabled, children, ...props}: PortalProps = $props();
|
17
|
-
|
18
|
-
let environment = getEnvironmentContext();
|
19
|
-
</script>
|
20
|
-
|
21
|
-
<div
|
22
|
-
use:portal={{
|
23
|
-
disabled,
|
24
|
-
container,
|
25
|
-
getRootNode: environment?.getRootNode,
|
26
|
-
}}
|
27
|
-
data-scope="portal"
|
28
|
-
data-part="root"
|
29
|
-
{...props}
|
30
|
-
>
|
31
|
-
{@render children?.()}
|
32
|
-
</div>
|
1
|
+
<script module lang="ts">
|
2
|
+
import {type Snippet} from 'svelte';
|
3
|
+
|
4
|
+
export interface PortalProps {
|
5
|
+
container?: HTMLElement;
|
6
|
+
disabled?: boolean;
|
7
|
+
children: Snippet;
|
8
|
+
[x: `data-${string}`]: string | number | boolean | null | undefined;
|
9
|
+
}
|
10
|
+
</script>
|
11
|
+
|
12
|
+
<script lang="ts">
|
13
|
+
import {getEnvironmentContext} from '../environment-provider/index.js';
|
14
|
+
import {portal} from '@zag-js/svelte';
|
15
|
+
|
16
|
+
let {container, disabled, children, ...props}: PortalProps = $props();
|
17
|
+
|
18
|
+
let environment = getEnvironmentContext();
|
19
|
+
</script>
|
20
|
+
|
21
|
+
<div
|
22
|
+
use:portal={{
|
23
|
+
disabled,
|
24
|
+
container,
|
25
|
+
getRootNode: environment?.getRootNode,
|
26
|
+
}}
|
27
|
+
data-scope="portal"
|
28
|
+
data-part="root"
|
29
|
+
{...props}
|
30
|
+
>
|
31
|
+
{@render children?.()}
|
32
|
+
</div>
|
@@ -19,7 +19,11 @@
|
|
19
19
|
let {asChild, children, ...props}: PresenceProps = $props();
|
20
20
|
|
21
21
|
let [presenceProps, otherProps] = $derived(
|
22
|
-
createSplitProps<CreatePresenceProps>([
|
22
|
+
createSplitProps<CreatePresenceProps>([
|
23
|
+
'present',
|
24
|
+
'lazyMount',
|
25
|
+
'keepMounted',
|
26
|
+
])(props),
|
23
27
|
);
|
24
28
|
|
25
29
|
let presence = createPresence(reflect(() => presenceProps));
|
@@ -1,24 +1,24 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {HtmlIngredientProps} from '../types.js';
|
3
|
-
|
4
|
-
export interface SwitchControlProps extends HtmlIngredientProps<'div'> {}
|
5
|
-
</script>
|
6
|
-
|
7
|
-
<script lang="ts">
|
8
|
-
import {mergeProps} from '../merge-props.js';
|
9
|
-
import {getSwitchContext} from './context.svelte.js';
|
10
|
-
|
11
|
-
let {asChild, children, ...props}: SwitchControlProps = $props();
|
12
|
-
|
13
|
-
let switch$ = getSwitchContext();
|
14
|
-
|
15
|
-
let mergedProps = $derived(mergeProps(props, switch$.getControlProps()));
|
16
|
-
</script>
|
17
|
-
|
18
|
-
{#if asChild}
|
19
|
-
{@render asChild(mergedProps)}
|
20
|
-
{:else}
|
21
|
-
<div {...mergedProps}>
|
22
|
-
{@render children?.()}
|
23
|
-
</div>
|
24
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface SwitchControlProps extends HtmlIngredientProps<'div'> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '../merge-props.js';
|
9
|
+
import {getSwitchContext} from './context.svelte.js';
|
10
|
+
|
11
|
+
let {asChild, children, ...props}: SwitchControlProps = $props();
|
12
|
+
|
13
|
+
let switch$ = getSwitchContext();
|
14
|
+
|
15
|
+
let mergedProps = $derived(mergeProps(props, switch$.getControlProps()));
|
16
|
+
</script>
|
17
|
+
|
18
|
+
{#if asChild}
|
19
|
+
{@render asChild(mergedProps)}
|
20
|
+
{:else}
|
21
|
+
<div {...mergedProps}>
|
22
|
+
{@render children?.()}
|
23
|
+
</div>
|
24
|
+
{/if}
|
@@ -1,23 +1,23 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {HtmlIngredientProps} from '../types.js';
|
3
|
-
|
4
|
-
export interface SwitchHiddenInputProps
|
5
|
-
extends HtmlIngredientProps<'input'> {}
|
6
|
-
</script>
|
7
|
-
|
8
|
-
<script lang="ts">
|
9
|
-
import {mergeProps} from '../merge-props.js';
|
10
|
-
import {getSwitchContext} from './context.svelte.js';
|
11
|
-
|
12
|
-
let {asChild, ...props}: SwitchHiddenInputProps = $props();
|
13
|
-
|
14
|
-
let switch$ = getSwitchContext();
|
15
|
-
|
16
|
-
let mergedProps = $derived(mergeProps(props, switch$.getHiddenInputProps()));
|
17
|
-
</script>
|
18
|
-
|
19
|
-
{#if asChild}
|
20
|
-
{@render asChild(mergedProps)}
|
21
|
-
{:else}
|
22
|
-
<input {...mergedProps} />
|
23
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface SwitchHiddenInputProps
|
5
|
+
extends HtmlIngredientProps<'input'> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '../merge-props.js';
|
10
|
+
import {getSwitchContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {asChild, ...props}: SwitchHiddenInputProps = $props();
|
13
|
+
|
14
|
+
let switch$ = getSwitchContext();
|
15
|
+
|
16
|
+
let mergedProps = $derived(mergeProps(props, switch$.getHiddenInputProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
{#if asChild}
|
20
|
+
{@render asChild(mergedProps)}
|
21
|
+
{:else}
|
22
|
+
<input {...mergedProps} />
|
23
|
+
{/if}
|
package/dist/switch/label.svelte
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {HtmlIngredientProps} from '../types.js';
|
3
|
-
|
4
|
-
export interface SwitchLabelProps extends HtmlIngredientProps<'span'> {}
|
5
|
-
</script>
|
6
|
-
|
7
|
-
<script lang="ts">
|
8
|
-
import {mergeProps} from '../merge-props.js';
|
9
|
-
import {getSwitchContext} from './context.svelte.js';
|
10
|
-
|
11
|
-
let {asChild, children, ...props}: SwitchLabelProps = $props();
|
12
|
-
|
13
|
-
let switch$ = getSwitchContext();
|
14
|
-
|
15
|
-
let mergedProps = $derived(mergeProps(props, switch$.getLabelProps()));
|
16
|
-
</script>
|
17
|
-
|
18
|
-
{#if asChild}
|
19
|
-
{@render asChild(mergedProps)}
|
20
|
-
{:else}
|
21
|
-
<span {...mergedProps}>
|
22
|
-
{@render children?.()}
|
23
|
-
</span>
|
24
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface SwitchLabelProps extends HtmlIngredientProps<'span'> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '../merge-props.js';
|
9
|
+
import {getSwitchContext} from './context.svelte.js';
|
10
|
+
|
11
|
+
let {asChild, children, ...props}: SwitchLabelProps = $props();
|
12
|
+
|
13
|
+
let switch$ = getSwitchContext();
|
14
|
+
|
15
|
+
let mergedProps = $derived(mergeProps(props, switch$.getLabelProps()));
|
16
|
+
</script>
|
17
|
+
|
18
|
+
{#if asChild}
|
19
|
+
{@render asChild(mergedProps)}
|
20
|
+
{:else}
|
21
|
+
<span {...mergedProps}>
|
22
|
+
{@render children?.()}
|
23
|
+
</span>
|
24
|
+
{/if}
|
package/dist/switch/root.svelte
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
-
import type {
|
4
|
-
CreateSwitchProps,
|
5
|
-
CreateSwitchReturn,
|
6
|
-
} from './create-switch.svelte.js';
|
7
|
-
|
8
|
-
export interface SwitchProps
|
9
|
-
extends Assign<
|
10
|
-
HtmlIngredientProps<'label', CreateSwitchReturn>,
|
11
|
-
CreateSwitchProps
|
12
|
-
> {}
|
13
|
-
</script>
|
14
|
-
|
15
|
-
<script lang="ts">
|
16
|
-
import {mergeProps} from '../merge-props.js';
|
17
|
-
import {reflect} from '@zag-js/svelte';
|
18
|
-
import {createSplitProps} from '@zag-js/utils';
|
19
|
-
import {setSwitchContext} from './context.svelte.js';
|
20
|
-
import {createSwitch} from './create-switch.svelte.js';
|
21
|
-
|
22
|
-
let {asChild, children, ...props}: SwitchProps = $props();
|
23
|
-
|
24
|
-
let [switchProps, otherProps] = $derived(
|
25
|
-
createSplitProps<CreateSwitchProps>([
|
26
|
-
'id',
|
27
|
-
'ids',
|
28
|
-
'form',
|
29
|
-
'name',
|
30
|
-
'label',
|
31
|
-
'value',
|
32
|
-
'checked',
|
33
|
-
'invalid',
|
34
|
-
'disabled',
|
35
|
-
'readOnly',
|
36
|
-
'required',
|
37
|
-
'onCheckedChange',
|
38
|
-
])(props),
|
39
|
-
);
|
40
|
-
|
41
|
-
let switch$ = createSwitch(reflect(() => switchProps));
|
42
|
-
|
43
|
-
let mergedProps = $derived(mergeProps(otherProps, switch$.getRootProps()));
|
44
|
-
|
45
|
-
setSwitchContext(switch$);
|
46
|
-
</script>
|
47
|
-
|
48
|
-
{#if asChild}
|
49
|
-
{@render asChild(mergedProps, switch$)}
|
50
|
-
{:else}
|
51
|
-
<label {...mergedProps}>
|
52
|
-
{@render children?.(switch$)}
|
53
|
-
</label>
|
54
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {
|
4
|
+
CreateSwitchProps,
|
5
|
+
CreateSwitchReturn,
|
6
|
+
} from './create-switch.svelte.js';
|
7
|
+
|
8
|
+
export interface SwitchProps
|
9
|
+
extends Assign<
|
10
|
+
HtmlIngredientProps<'label', CreateSwitchReturn>,
|
11
|
+
CreateSwitchProps
|
12
|
+
> {}
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script lang="ts">
|
16
|
+
import {mergeProps} from '../merge-props.js';
|
17
|
+
import {reflect} from '@zag-js/svelte';
|
18
|
+
import {createSplitProps} from '@zag-js/utils';
|
19
|
+
import {setSwitchContext} from './context.svelte.js';
|
20
|
+
import {createSwitch} from './create-switch.svelte.js';
|
21
|
+
|
22
|
+
let {asChild, children, ...props}: SwitchProps = $props();
|
23
|
+
|
24
|
+
let [switchProps, otherProps] = $derived(
|
25
|
+
createSplitProps<CreateSwitchProps>([
|
26
|
+
'id',
|
27
|
+
'ids',
|
28
|
+
'form',
|
29
|
+
'name',
|
30
|
+
'label',
|
31
|
+
'value',
|
32
|
+
'checked',
|
33
|
+
'invalid',
|
34
|
+
'disabled',
|
35
|
+
'readOnly',
|
36
|
+
'required',
|
37
|
+
'onCheckedChange',
|
38
|
+
])(props),
|
39
|
+
);
|
40
|
+
|
41
|
+
let switch$ = createSwitch(reflect(() => switchProps));
|
42
|
+
|
43
|
+
let mergedProps = $derived(mergeProps(otherProps, switch$.getRootProps()));
|
44
|
+
|
45
|
+
setSwitchContext(switch$);
|
46
|
+
</script>
|
47
|
+
|
48
|
+
{#if asChild}
|
49
|
+
{@render asChild(mergedProps, switch$)}
|
50
|
+
{:else}
|
51
|
+
<label {...mergedProps}>
|
52
|
+
{@render children?.(switch$)}
|
53
|
+
</label>
|
54
|
+
{/if}
|
package/dist/switch/thumb.svelte
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {HtmlIngredientProps} from '../types.js';
|
3
|
-
|
4
|
-
export interface SwitchThumbProps extends HtmlIngredientProps<'div'> {}
|
5
|
-
</script>
|
6
|
-
|
7
|
-
<script lang="ts">
|
8
|
-
import {mergeProps} from '../merge-props.js';
|
9
|
-
import {getSwitchContext} from './context.svelte.js';
|
10
|
-
|
11
|
-
let {asChild, children, ...props}: SwitchThumbProps = $props();
|
12
|
-
|
13
|
-
let switch$ = getSwitchContext();
|
14
|
-
|
15
|
-
let mergedProps = $derived(mergeProps(props, switch$.getThumbProps()));
|
16
|
-
</script>
|
17
|
-
|
18
|
-
{#if asChild}
|
19
|
-
{@render asChild(mergedProps)}
|
20
|
-
{:else}
|
21
|
-
<div {...mergedProps}>
|
22
|
-
{@render children?.()}
|
23
|
-
</div>
|
24
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface SwitchThumbProps extends HtmlIngredientProps<'div'> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '../merge-props.js';
|
9
|
+
import {getSwitchContext} from './context.svelte.js';
|
10
|
+
|
11
|
+
let {asChild, children, ...props}: SwitchThumbProps = $props();
|
12
|
+
|
13
|
+
let switch$ = getSwitchContext();
|
14
|
+
|
15
|
+
let mergedProps = $derived(mergeProps(props, switch$.getThumbProps()));
|
16
|
+
</script>
|
17
|
+
|
18
|
+
{#if asChild}
|
19
|
+
{@render asChild(mergedProps)}
|
20
|
+
{:else}
|
21
|
+
<div {...mergedProps}>
|
22
|
+
{@render children?.()}
|
23
|
+
</div>
|
24
|
+
{/if}
|
package/dist/toast/actor.svelte
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
<script lang="ts">
|
2
|
-
import * as toast$ from '@zag-js/toast';
|
3
|
-
import type {Snippet} from 'svelte';
|
4
|
-
import {setToastContext} from './context.svelte.js';
|
5
|
-
import {createToast, type CreateToastReturn} from './create-toast.svelte.js';
|
6
|
-
|
7
|
-
interface Props {
|
8
|
-
actor: toast$.Service;
|
9
|
-
children$: Snippet<[toast: CreateToastReturn]>;
|
10
|
-
}
|
11
|
-
|
12
|
-
let {actor, children$}: Props = $props();
|
13
|
-
|
14
|
-
let toast = createToast(actor);
|
15
|
-
|
16
|
-
setToastContext(toast);
|
17
|
-
</script>
|
18
|
-
|
19
|
-
{@render children$(toast)}
|
1
|
+
<script lang="ts">
|
2
|
+
import * as toast$ from '@zag-js/toast';
|
3
|
+
import type {Snippet} from 'svelte';
|
4
|
+
import {setToastContext} from './context.svelte.js';
|
5
|
+
import {createToast, type CreateToastReturn} from './create-toast.svelte.js';
|
6
|
+
|
7
|
+
interface Props {
|
8
|
+
actor: toast$.Service;
|
9
|
+
children$: Snippet<[toast: CreateToastReturn]>;
|
10
|
+
}
|
11
|
+
|
12
|
+
let {actor, children$}: Props = $props();
|
13
|
+
|
14
|
+
let toast = createToast(actor);
|
15
|
+
|
16
|
+
setToastContext(toast);
|
17
|
+
</script>
|
18
|
+
|
19
|
+
{@render children$(toast)}
|