ui-ingredients 0.0.42 → 0.0.43
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/dist/file-upload/create-file-upload.svelte.js +1 -0
- package/dist/file-upload/root.svelte +1 -0
- package/dist/floating-panel/create-floating-panel.svelte.d.ts +6 -0
- package/dist/floating-panel/create-floating-panel.svelte.js +18 -0
- package/dist/portal/root.svelte +32 -32
- 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/create-tour.svelte.d.ts +7 -0
- package/dist/tour/create-tour.svelte.js +18 -0
- package/package.json +46 -46
- package/dist/floating-panel/.gitkeep +0 -0
- package/dist/tour/.gitkeep +0 -0
package/README.md
CHANGED
@@ -59,6 +59,7 @@ npm install ui-ingredients
|
|
59
59
|
- [PinInput](https://github.com/calvo-jp/ui-ingredients/blob/main/docs/pin-input.md)
|
60
60
|
- [Popover](https://github.com/calvo-jp/ui-ingredients/blob/main/docs/popover.md)
|
61
61
|
- [Portal](https://github.com/calvo-jp/ui-ingredients/blob/main/docs/portal.md)
|
62
|
+
- [Presence](https://github.com/calvo-jp/ui-ingredients/blob/main/docs/presence.md)
|
62
63
|
- [Progress](https://github.com/calvo-jp/ui-ingredients/blob/main/docs/progress.md)
|
63
64
|
- [QrCode](https://github.com/calvo-jp/ui-ingredients/blob/main/docs/qr-code.md)
|
64
65
|
- [RadioGroup](https://github.com/calvo-jp/ui-ingredients/blob/main/docs/radio-group.md)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import * as floatingPanel from '@zag-js/floating-panel';
|
2
|
+
export interface CreateFloatingPanelProps extends Omit<floatingPanel.Context, 'dir' | 'getRootNode'> {
|
3
|
+
}
|
4
|
+
export interface CreateFloatingPanelReturn extends floatingPanel.Api<any> {
|
5
|
+
}
|
6
|
+
export declare function createFloatingPanel(props: CreateFloatingPanelProps): CreateFloatingPanelReturn;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
|
2
|
+
import { getLocaleContext } from '../locale-provider/context.svelte.js';
|
3
|
+
import * as floatingPanel from '@zag-js/floating-panel';
|
4
|
+
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
5
|
+
import { uid } from 'uid';
|
6
|
+
export function createFloatingPanel(props) {
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
|
+
const id = uid();
|
10
|
+
const context = $derived(reflect(() => ({
|
11
|
+
id: props.id ?? id,
|
12
|
+
dir: locale?.dir,
|
13
|
+
getRootNode: environment?.getRootNode,
|
14
|
+
})));
|
15
|
+
const [state, send] = useMachine(floatingPanel.machine(context), { context });
|
16
|
+
const api = $derived(reflect(() => floatingPanel.connect(state, send, normalizeProps)));
|
17
|
+
return api;
|
18
|
+
}
|
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>
|
@@ -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)}
|
@@ -1,39 +1,39 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {HtmlIngredientProps} from '../types.js';
|
3
|
-
import type {CreateToastReturn} from './create-toast.svelte.js';
|
4
|
-
import type {CreateToasterReturn} from './create-toaster.svelte.js';
|
5
|
-
|
6
|
-
export interface ToasterProps
|
7
|
-
extends HtmlIngredientProps<'div', CreateToastReturn> {
|
8
|
-
toaster: CreateToasterReturn;
|
9
|
-
}
|
10
|
-
</script>
|
11
|
-
|
12
|
-
<script lang="ts">
|
13
|
-
import {mergeProps} from '../merge-props.js';
|
14
|
-
import {Portal} from '../portal/index.js';
|
15
|
-
import {normalizeProps, useMachine} from '@zag-js/svelte';
|
16
|
-
import * as toast from '@zag-js/toast';
|
17
|
-
import ToastActor from './actor.svelte';
|
18
|
-
|
19
|
-
let {toaster, children, ...props}: ToasterProps = $props();
|
20
|
-
|
21
|
-
let [snapshot, send] = useMachine(toaster.machine);
|
22
|
-
|
23
|
-
let placement = $derived(snapshot.context.placement);
|
24
|
-
let api = $derived(toast.group.connect(snapshot, send, normalizeProps));
|
25
|
-
let toasts = $derived(api.getToastsByPlacement(placement));
|
26
|
-
let mergedProps = $derived(mergeProps(props, api.getGroupProps({placement})));
|
27
|
-
</script>
|
28
|
-
|
29
|
-
<Portal>
|
30
|
-
<div {...mergedProps}>
|
31
|
-
{#each toasts as toast (toast.id)}
|
32
|
-
<ToastActor actor={toast}>
|
33
|
-
{#snippet children$(ctx)}
|
34
|
-
{@render children?.(ctx)}
|
35
|
-
{/snippet}
|
36
|
-
</ToastActor>
|
37
|
-
{/each}
|
38
|
-
</div>
|
39
|
-
</Portal>
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {CreateToastReturn} from './create-toast.svelte.js';
|
4
|
+
import type {CreateToasterReturn} from './create-toaster.svelte.js';
|
5
|
+
|
6
|
+
export interface ToasterProps
|
7
|
+
extends HtmlIngredientProps<'div', CreateToastReturn> {
|
8
|
+
toaster: CreateToasterReturn;
|
9
|
+
}
|
10
|
+
</script>
|
11
|
+
|
12
|
+
<script lang="ts">
|
13
|
+
import {mergeProps} from '../merge-props.js';
|
14
|
+
import {Portal} from '../portal/index.js';
|
15
|
+
import {normalizeProps, useMachine} from '@zag-js/svelte';
|
16
|
+
import * as toast from '@zag-js/toast';
|
17
|
+
import ToastActor from './actor.svelte';
|
18
|
+
|
19
|
+
let {toaster, children, ...props}: ToasterProps = $props();
|
20
|
+
|
21
|
+
let [snapshot, send] = useMachine(toaster.machine);
|
22
|
+
|
23
|
+
let placement = $derived(snapshot.context.placement);
|
24
|
+
let api = $derived(toast.group.connect(snapshot, send, normalizeProps));
|
25
|
+
let toasts = $derived(api.getToastsByPlacement(placement));
|
26
|
+
let mergedProps = $derived(mergeProps(props, api.getGroupProps({placement})));
|
27
|
+
</script>
|
28
|
+
|
29
|
+
<Portal>
|
30
|
+
<div {...mergedProps}>
|
31
|
+
{#each toasts as toast (toast.id)}
|
32
|
+
<ToastActor actor={toast}>
|
33
|
+
{#snippet children$(ctx)}
|
34
|
+
{@render children?.(ctx)}
|
35
|
+
{/snippet}
|
36
|
+
</ToastActor>
|
37
|
+
{/each}
|
38
|
+
</div>
|
39
|
+
</Portal>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import * as tour from '@zag-js/tour';
|
2
|
+
export interface CreateTourProps extends Omit<tour.Context, 'id' | 'dir' | 'getRootNode'> {
|
3
|
+
id?: string | null;
|
4
|
+
}
|
5
|
+
export interface CreateTourReturn extends tour.Api<any> {
|
6
|
+
}
|
7
|
+
export declare function createTour(props: CreateTourProps): CreateTourReturn;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
|
2
|
+
import { getLocaleContext } from '../locale-provider/context.svelte.js';
|
3
|
+
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
4
|
+
import * as tour from '@zag-js/tour';
|
5
|
+
import { uid } from 'uid';
|
6
|
+
export function createTour(props) {
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
|
+
const id = uid();
|
10
|
+
const context = $derived(reflect(() => ({
|
11
|
+
id: props.id ?? id,
|
12
|
+
dir: locale?.dir,
|
13
|
+
getRootNode: environment?.getRootNode,
|
14
|
+
})));
|
15
|
+
const [state, send] = useMachine(tour.machine(context), { context });
|
16
|
+
const api = $derived(reflect(() => tour.connect(state, send, normalizeProps)));
|
17
|
+
return api;
|
18
|
+
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "ui-ingredients",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.43",
|
5
5
|
"packageManager": "pnpm@9.7.0",
|
6
6
|
"svelte": "./dist/index.js",
|
7
7
|
"types": "./dist/index.d.ts",
|
@@ -85,50 +85,50 @@
|
|
85
85
|
"release": "release-it"
|
86
86
|
},
|
87
87
|
"dependencies": {
|
88
|
-
"@zag-js/accordion": "0.
|
89
|
-
"@zag-js/anatomy": "0.
|
90
|
-
"@zag-js/avatar": "0.
|
91
|
-
"@zag-js/carousel": "0.
|
92
|
-
"@zag-js/checkbox": "0.
|
93
|
-
"@zag-js/clipboard": "0.
|
94
|
-
"@zag-js/collapsible": "0.
|
95
|
-
"@zag-js/color-picker": "0.
|
96
|
-
"@zag-js/combobox": "0.
|
97
|
-
"@zag-js/date-picker": "0.
|
98
|
-
"@zag-js/dialog": "0.
|
99
|
-
"@zag-js/dom-query": "0.
|
100
|
-
"@zag-js/editable": "0.
|
101
|
-
"@zag-js/file-upload": "0.
|
102
|
-
"@zag-js/floating-panel": "0.
|
103
|
-
"@zag-js/hover-card": "0.
|
104
|
-
"@zag-js/i18n-utils": "0.
|
105
|
-
"@zag-js/menu": "0.
|
106
|
-
"@zag-js/number-input": "0.
|
107
|
-
"@zag-js/pagination": "0.
|
108
|
-
"@zag-js/pin-input": "0.
|
109
|
-
"@zag-js/popover": "0.
|
110
|
-
"@zag-js/presence": "0.
|
111
|
-
"@zag-js/progress": "0.
|
112
|
-
"@zag-js/qr-code": "0.
|
113
|
-
"@zag-js/radio-group": "0.
|
114
|
-
"@zag-js/rating-group": "0.
|
115
|
-
"@zag-js/select": "0.
|
116
|
-
"@zag-js/signature-pad": "0.
|
117
|
-
"@zag-js/slider": "0.
|
118
|
-
"@zag-js/splitter": "0.
|
119
|
-
"@zag-js/steps": "0.
|
120
|
-
"@zag-js/svelte": "0.
|
121
|
-
"@zag-js/switch": "0.
|
122
|
-
"@zag-js/tabs": "0.
|
123
|
-
"@zag-js/tags-input": "0.
|
124
|
-
"@zag-js/time-picker": "0.
|
125
|
-
"@zag-js/timer": "0.
|
126
|
-
"@zag-js/toast": "0.
|
127
|
-
"@zag-js/toggle-group": "0.
|
128
|
-
"@zag-js/tooltip": "0.
|
129
|
-
"@zag-js/tour": "0.
|
130
|
-
"@zag-js/tree-view": "0.
|
131
|
-
"@zag-js/utils": "0.
|
88
|
+
"@zag-js/accordion": "0.67.0",
|
89
|
+
"@zag-js/anatomy": "0.67.0",
|
90
|
+
"@zag-js/avatar": "0.67.0",
|
91
|
+
"@zag-js/carousel": "0.67.0",
|
92
|
+
"@zag-js/checkbox": "0.67.0",
|
93
|
+
"@zag-js/clipboard": "0.67.0",
|
94
|
+
"@zag-js/collapsible": "0.67.0",
|
95
|
+
"@zag-js/color-picker": "0.67.0",
|
96
|
+
"@zag-js/combobox": "0.67.0",
|
97
|
+
"@zag-js/date-picker": "0.67.0",
|
98
|
+
"@zag-js/dialog": "0.67.0",
|
99
|
+
"@zag-js/dom-query": "0.67.0",
|
100
|
+
"@zag-js/editable": "0.67.0",
|
101
|
+
"@zag-js/file-upload": "0.67.0",
|
102
|
+
"@zag-js/floating-panel": "0.67.0",
|
103
|
+
"@zag-js/hover-card": "0.67.0",
|
104
|
+
"@zag-js/i18n-utils": "0.67.0",
|
105
|
+
"@zag-js/menu": "0.67.0",
|
106
|
+
"@zag-js/number-input": "0.67.0",
|
107
|
+
"@zag-js/pagination": "0.67.0",
|
108
|
+
"@zag-js/pin-input": "0.67.0",
|
109
|
+
"@zag-js/popover": "0.67.0",
|
110
|
+
"@zag-js/presence": "0.67.0",
|
111
|
+
"@zag-js/progress": "0.67.0",
|
112
|
+
"@zag-js/qr-code": "0.67.0",
|
113
|
+
"@zag-js/radio-group": "0.67.0",
|
114
|
+
"@zag-js/rating-group": "0.67.0",
|
115
|
+
"@zag-js/select": "0.67.0",
|
116
|
+
"@zag-js/signature-pad": "0.67.0",
|
117
|
+
"@zag-js/slider": "0.67.0",
|
118
|
+
"@zag-js/splitter": "0.67.0",
|
119
|
+
"@zag-js/steps": "0.67.0",
|
120
|
+
"@zag-js/svelte": "0.67.0",
|
121
|
+
"@zag-js/switch": "0.67.0",
|
122
|
+
"@zag-js/tabs": "0.67.0",
|
123
|
+
"@zag-js/tags-input": "0.67.0",
|
124
|
+
"@zag-js/time-picker": "0.67.0",
|
125
|
+
"@zag-js/timer": "0.67.0",
|
126
|
+
"@zag-js/toast": "0.67.0",
|
127
|
+
"@zag-js/toggle-group": "0.67.0",
|
128
|
+
"@zag-js/tooltip": "0.67.0",
|
129
|
+
"@zag-js/tour": "0.67.0",
|
130
|
+
"@zag-js/tree-view": "0.67.0",
|
131
|
+
"@zag-js/utils": "0.67.0",
|
132
132
|
"uid": "2.0.2"
|
133
133
|
},
|
134
134
|
"peerDependencies": {
|
@@ -150,7 +150,7 @@
|
|
150
150
|
"tailwind-merge": "2.5.2",
|
151
151
|
"tailwind-variants": "0.2.1",
|
152
152
|
"tailwindcss": "3.4.10",
|
153
|
-
"typescript": "5.
|
153
|
+
"typescript": "5.6.2",
|
154
154
|
"vite": "5.4.3",
|
155
155
|
"vitest": "2.0.5",
|
156
156
|
"vitest-axe": "0.1.0"
|
File without changes
|
package/dist/tour/.gitkeep
DELETED
File without changes
|