ui-ingredients 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +75 -75
- package/dist/accordion/item-content.svelte +22 -13
- package/dist/accordion/item-indicator.svelte +22 -13
- package/dist/accordion/item-trigger.svelte +22 -13
- package/dist/accordion/item.svelte +35 -24
- package/dist/accordion/root.svelte +61 -40
- package/dist/avatar/fallback.svelte +21 -12
- package/dist/avatar/image.svelte +19 -10
- package/dist/avatar/root.svelte +46 -29
- package/dist/carousel/indicator-group.svelte +21 -12
- package/dist/carousel/indicator.svelte +31 -20
- package/dist/carousel/item-group.svelte +21 -12
- package/dist/carousel/item.svelte +22 -12
- package/dist/carousel/next-trigger.svelte +21 -12
- package/dist/carousel/prev-trigger.svelte +21 -12
- package/dist/carousel/root.svelte +58 -40
- package/dist/carousel/viewport.svelte +21 -12
- package/dist/checkbox/control.svelte +21 -12
- package/dist/checkbox/hidden-input.svelte +19 -10
- package/dist/checkbox/indicator.svelte +21 -12
- package/dist/checkbox/label.svelte +21 -12
- package/dist/checkbox/root.svelte +62 -44
- package/dist/clipboard/control.svelte +21 -12
- package/dist/clipboard/indicator.svelte +23 -12
- package/dist/clipboard/input.svelte +19 -10
- package/dist/clipboard/label.svelte +21 -12
- package/dist/clipboard/root.svelte +51 -30
- package/dist/clipboard/trigger.svelte +21 -12
- package/dist/collapsible/content.svelte +21 -12
- package/dist/collapsible/root.svelte +57 -36
- package/dist/collapsible/trigger.svelte +19 -12
- package/dist/combobox/clear-trigger.svelte +21 -12
- package/dist/combobox/content.svelte +21 -12
- package/dist/combobox/control.svelte +21 -12
- package/dist/combobox/input.svelte +19 -10
- package/dist/combobox/item-group-label.svelte +29 -20
- package/dist/combobox/item-group.svelte +26 -14
- package/dist/combobox/item-indicator.svelte +22 -13
- package/dist/combobox/item-text.svelte +26 -17
- package/dist/combobox/item.svelte +35 -24
- package/dist/combobox/label.svelte +21 -12
- package/dist/combobox/list.svelte +21 -12
- package/dist/combobox/positioner.svelte +21 -12
- package/dist/combobox/root.svelte +122 -104
- package/dist/combobox/trigger.svelte +21 -12
- package/dist/dialog/backdrop.svelte +21 -12
- package/dist/dialog/close-trigger.svelte +21 -12
- package/dist/dialog/content.svelte +21 -12
- package/dist/dialog/description.svelte +21 -12
- package/dist/dialog/positioner.svelte +21 -12
- package/dist/dialog/root.svelte +22 -10
- package/dist/dialog/title.svelte +21 -12
- package/dist/dialog/trigger.svelte +21 -12
- package/dist/hover-card/arrow-tip.svelte +21 -12
- package/dist/hover-card/arrow.svelte +21 -12
- package/dist/hover-card/content.svelte +21 -12
- package/dist/hover-card/positioner.svelte +21 -12
- package/dist/hover-card/root.svelte +25 -10
- package/dist/hover-card/trigger.svelte +21 -12
- package/dist/number-input/control.svelte +21 -12
- package/dist/number-input/decrement-trigger.svelte +22 -12
- package/dist/number-input/increment-trigger.svelte +22 -12
- package/dist/number-input/input.svelte +19 -10
- package/dist/number-input/label.svelte +21 -12
- package/dist/number-input/root.svelte +93 -72
- package/dist/number-input/scrubber.svelte +21 -12
- package/dist/pagination/ellipsis.svelte +23 -12
- package/dist/pagination/item.svelte +31 -20
- package/dist/pagination/next-trigger.svelte +21 -12
- package/dist/pagination/prev-trigger.svelte +21 -12
- package/dist/pagination/root.svelte +63 -42
- package/dist/pin-input/clear-trigger.svelte +25 -17
- package/dist/pin-input/hidden-input.svelte +19 -10
- package/dist/pin-input/input.svelte +20 -10
- package/dist/pin-input/label.svelte +21 -12
- package/dist/pin-input/root.svelte +82 -64
- package/dist/popover/arrow-tip.svelte +21 -12
- package/dist/popover/arrow.svelte +21 -12
- package/dist/popover/close-trigger.svelte +21 -12
- package/dist/popover/content.svelte +21 -12
- package/dist/popover/description.svelte +21 -12
- package/dist/popover/positioner.svelte +21 -12
- package/dist/popover/root.svelte +22 -10
- package/dist/popover/title.svelte +21 -12
- package/dist/popover/trigger.svelte +21 -12
- package/dist/portal/root.svelte +20 -10
- package/dist/presence/root.svelte +39 -27
- package/dist/progress/circle-range.svelte +21 -12
- package/dist/progress/circle-track.svelte +21 -12
- package/dist/progress/circle.svelte +21 -12
- package/dist/progress/label.svelte +21 -12
- package/dist/progress/range.svelte +21 -12
- package/dist/progress/root.svelte +54 -36
- package/dist/progress/track.svelte +21 -12
- package/dist/progress/value-text.svelte +25 -16
- package/dist/radio-group/indicator.svelte +21 -12
- package/dist/radio-group/item-control.svelte +22 -13
- package/dist/radio-group/item-hidden-input.svelte +20 -11
- package/dist/radio-group/item-text.svelte +22 -13
- package/dist/radio-group/item.svelte +37 -26
- package/dist/radio-group/label.svelte +21 -12
- package/dist/radio-group/root.svelte +61 -40
- package/dist/select/clear-trigger.svelte +21 -12
- package/dist/select/content.svelte +21 -12
- package/dist/select/control.svelte +21 -12
- package/dist/select/hidden-select.svelte +21 -12
- package/dist/select/indicator.svelte +21 -12
- package/dist/select/item-group-label.svelte +24 -15
- package/dist/select/item-group.svelte +26 -14
- package/dist/select/item-indicator.svelte +22 -13
- package/dist/select/item-text.svelte +26 -17
- package/dist/select/item.svelte +35 -24
- package/dist/select/label.svelte +21 -12
- package/dist/select/list.svelte +21 -12
- package/dist/select/positioner.svelte +21 -12
- package/dist/select/root.svelte +96 -78
- package/dist/select/trigger.svelte +21 -12
- package/dist/select/value-text.svelte +27 -18
- package/dist/slider/control.svelte +21 -12
- package/dist/slider/hidden-input.svelte +20 -11
- package/dist/slider/label.svelte +21 -12
- package/dist/slider/marker-group.svelte +21 -12
- package/dist/slider/marker.svelte +29 -19
- package/dist/slider/range.svelte +21 -12
- package/dist/slider/root.svelte +84 -66
- package/dist/slider/thumb.svelte +35 -24
- package/dist/slider/track.svelte +21 -12
- package/dist/slider/value-text.svelte +25 -16
- package/dist/steps/content.svelte +22 -12
- package/dist/steps/indicator.svelte +22 -13
- package/dist/steps/item.svelte +24 -13
- package/dist/steps/list.svelte +21 -12
- package/dist/steps/next-trigger.svelte +21 -12
- package/dist/steps/prev-trigger.svelte +21 -12
- package/dist/steps/progress.svelte +21 -12
- package/dist/steps/root.svelte +56 -38
- package/dist/steps/separator.svelte +22 -13
- package/dist/steps/trigger.svelte +22 -13
- package/dist/switch/control.svelte +21 -12
- package/dist/switch/hidden-input.svelte +19 -10
- package/dist/switch/label.svelte +21 -12
- package/dist/switch/root.svelte +64 -46
- package/dist/switch/thumb.svelte +21 -12
- package/dist/tabs/content.svelte +22 -12
- package/dist/tabs/list.svelte +21 -12
- package/dist/tabs/root.svelte +57 -42
- package/dist/tabs/trigger.svelte +22 -12
- package/dist/toast/action-trigger.svelte +21 -12
- package/dist/toast/actor.svelte +22 -11
- package/dist/toast/close-trigger.svelte +21 -12
- package/dist/toast/description.svelte +25 -16
- package/dist/toast/root.svelte +25 -16
- package/dist/toast/title.svelte +25 -16
- package/dist/toast/toaster.svelte +40 -25
- package/dist/toggle-group/item.svelte +22 -12
- package/dist/toggle-group/root.svelte +61 -40
- package/dist/tooltip/arrow-tip.svelte +21 -12
- package/dist/tooltip/arrow.svelte +21 -12
- package/dist/tooltip/content.svelte +21 -12
- package/dist/tooltip/positioner.svelte +21 -12
- package/dist/tooltip/root.svelte +22 -10
- package/dist/tooltip/trigger.svelte +21 -12
- package/package.json +6 -14
@@ -1,16 +1,25 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
|
4
|
+
export interface ToastDescriptionProps extends Assign<SvelteHTMLElements['div'], {}> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '@zag-js/svelte';
|
9
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
10
|
+
import {useToastContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: ToastDescriptionProps = $props();
|
13
|
+
|
14
|
+
let context = useToastContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getDescriptionProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<div {...attrs}>
|
20
|
+
{#if children}
|
21
|
+
{@render children?.()}
|
22
|
+
{:else}
|
23
|
+
{context.description}
|
24
|
+
{/if}
|
25
|
+
</div>
|
package/dist/toast/root.svelte
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
|
4
|
+
export interface ToastProps extends Assign<SvelteHTMLElements['div'], {}> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '@zag-js/svelte';
|
9
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
10
|
+
import {useToastContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: ToastProps = $props();
|
13
|
+
|
14
|
+
let context = useToastContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getRootProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<div {...attrs}>
|
20
|
+
<div {...context.getGhostBeforeProps()}></div>
|
21
|
+
|
22
|
+
{@render children?.()}
|
23
|
+
|
24
|
+
<div {...context.getGhostAfterProps()}></div>
|
25
|
+
</div>
|
package/dist/toast/title.svelte
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
|
4
|
+
export interface ToastTitleProps extends Assign<SvelteHTMLElements['div'], {}> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '@zag-js/svelte';
|
9
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
10
|
+
import {useToastContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: ToastTitleProps = $props();
|
13
|
+
|
14
|
+
let context = useToastContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getTitleProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<div {...attrs}>
|
20
|
+
{#if children}
|
21
|
+
{@render children?.()}
|
22
|
+
{:else}
|
23
|
+
{context.title}
|
24
|
+
{/if}
|
25
|
+
</div>
|
@@ -1,25 +1,40 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
import {
|
5
|
-
import
|
6
|
-
import
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {WithoutChildren} from '../types.js';
|
3
|
+
import type {Snippet} from 'svelte';
|
4
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
5
|
+
import type {CreateToastContextReturn} from './context.svelte.js';
|
6
|
+
import type {CreateToasterReturn} from './create-toaster.svelte.js';
|
7
|
+
|
8
|
+
export interface ToasterProps extends WithoutChildren<SvelteHTMLElements['div']> {
|
9
|
+
toaster: CreateToasterReturn;
|
10
|
+
children: Snippet<[CreateToastContextReturn]>;
|
11
|
+
}
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script lang="ts">
|
15
|
+
import {Portal} from '../portal/index.js';
|
16
|
+
import {mergeProps, normalizeProps, useMachine} from '@zag-js/svelte';
|
17
|
+
import * as toast from '@zag-js/toast';
|
18
|
+
import ToastActor from './actor.svelte';
|
19
|
+
|
20
|
+
let {toaster, children, ...props}: ToasterProps = $props();
|
21
|
+
|
22
|
+
let [state, send] = useMachine(toaster.machine);
|
23
|
+
|
24
|
+
let placement = $derived(state.context.placement);
|
25
|
+
let api = $derived(toast.group.connect(state, send, normalizeProps));
|
26
|
+
let toasts = $derived(api.getToastsByPlacement(placement));
|
27
|
+
let attrs = $derived(mergeProps(props, api.getGroupProps({placement})));
|
28
|
+
</script>
|
29
|
+
|
30
|
+
<Portal>
|
31
|
+
<div {...attrs}>
|
32
|
+
{#each toasts as toast (toast.id)}
|
33
|
+
<ToastActor actor={toast}>
|
34
|
+
{#snippet children$(ctx)}
|
35
|
+
{@render children(ctx)}
|
36
|
+
{/snippet}
|
37
|
+
</ToastActor>
|
38
|
+
{/each}
|
39
|
+
</div>
|
40
|
+
</Portal>
|
@@ -1,12 +1,22 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
{
|
12
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
4
|
+
|
5
|
+
export interface ToggleGroupItemProps extends Assign<SvelteHTMLElements['button'], ItemProps> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import type {ItemProps} from '@zag-js/toggle-group';
|
11
|
+
import {useToggleGroupContext} from './context.svelte.js';
|
12
|
+
|
13
|
+
let {value, disabled, children, ...props}: ToggleGroupItemProps = $props();
|
14
|
+
|
15
|
+
let context = useToggleGroupContext();
|
16
|
+
|
17
|
+
let attrs = $derived(mergeProps(props, context.getItemProps({value, disabled})));
|
18
|
+
</script>
|
19
|
+
|
20
|
+
<button type="button" {...attrs}>
|
21
|
+
{@render children?.()}
|
22
|
+
</button>
|
@@ -1,40 +1,61 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign, OptionalId, WithoutChildren} from '../types.js';
|
3
|
+
import type {Snippet} from 'svelte';
|
4
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
5
|
+
import type {
|
6
|
+
CreateToggleGroupContextProps,
|
7
|
+
CreateToggleGroupContextReturn,
|
8
|
+
} from './context.svelte.js';
|
9
|
+
|
10
|
+
export interface ToggleGroupProps
|
11
|
+
extends Assign<
|
12
|
+
WithoutChildren<SvelteHTMLElements['div']>,
|
13
|
+
OptionalId<CreateToggleGroupContextProps>
|
14
|
+
> {
|
15
|
+
children?: Snippet<[CreateToggleGroupContextReturn]>;
|
16
|
+
}
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<script lang="ts">
|
20
|
+
import {uuid} from '../utils.svelte.js';
|
21
|
+
import {mergeProps} from '@zag-js/svelte';
|
22
|
+
import {createToggleGroupContext, setToggleGroupContext} from './context.svelte.js';
|
23
|
+
|
24
|
+
let {
|
25
|
+
id = uuid(),
|
26
|
+
ids,
|
27
|
+
dir,
|
28
|
+
value,
|
29
|
+
disabled,
|
30
|
+
multiple,
|
31
|
+
loopFocus,
|
32
|
+
rovingFocus,
|
33
|
+
orientation,
|
34
|
+
onValueChange,
|
35
|
+
getRootNode,
|
36
|
+
children,
|
37
|
+
...props
|
38
|
+
}: ToggleGroupProps = $props();
|
39
|
+
|
40
|
+
let context = createToggleGroupContext({
|
41
|
+
id,
|
42
|
+
ids,
|
43
|
+
dir,
|
44
|
+
value: $state.snapshot(value),
|
45
|
+
disabled,
|
46
|
+
multiple,
|
47
|
+
loopFocus,
|
48
|
+
rovingFocus,
|
49
|
+
orientation,
|
50
|
+
onValueChange,
|
51
|
+
getRootNode,
|
52
|
+
});
|
53
|
+
|
54
|
+
let attrs = $derived(mergeProps(props, context.getRootProps()));
|
55
|
+
|
56
|
+
setToggleGroupContext(context);
|
57
|
+
</script>
|
58
|
+
|
59
|
+
<div {...attrs}>
|
60
|
+
{@render children?.(context)}
|
61
|
+
</div>
|
@@ -1,12 +1,21 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
4
|
+
|
5
|
+
export interface TooltipArrowTipProps extends Assign<SvelteHTMLElements['div'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useTooltipContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: TooltipArrowTipProps = $props();
|
13
|
+
|
14
|
+
let context = useTooltipContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getArrowTipProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<div {...attrs}>
|
20
|
+
{@render children?.()}
|
21
|
+
</div>
|
@@ -1,12 +1,21 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
4
|
+
|
5
|
+
export interface TooltipArrowProps extends Assign<SvelteHTMLElements['div'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useTooltipContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: TooltipArrowProps = $props();
|
13
|
+
|
14
|
+
let context = useTooltipContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getArrowProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<div {...attrs}>
|
20
|
+
{@render children?.()}
|
21
|
+
</div>
|
@@ -1,12 +1,21 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
4
|
+
|
5
|
+
export interface TooltipContentProps extends Assign<SvelteHTMLElements['div'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useTooltipContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: TooltipContentProps = $props();
|
13
|
+
|
14
|
+
let context = useTooltipContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getContentProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<div {...attrs}>
|
20
|
+
{@render children?.()}
|
21
|
+
</div>
|
@@ -1,12 +1,21 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
4
|
+
|
5
|
+
export interface TooltipPositionerProps extends Assign<SvelteHTMLElements['div'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useTooltipContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: TooltipPositionerProps = $props();
|
13
|
+
|
14
|
+
let context = useTooltipContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getPositionerProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<div {...attrs}>
|
20
|
+
{@render children?.()}
|
21
|
+
</div>
|
package/dist/tooltip/root.svelte
CHANGED
@@ -1,10 +1,22 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {OptionalId} from '../types.js';
|
3
|
+
import type {Snippet} from 'svelte';
|
4
|
+
import type {CreateTooltipContextProps, CreateTooltipContextReturn} from './context.svelte.js';
|
5
|
+
|
6
|
+
export interface TooltipProps extends OptionalId<CreateTooltipContextProps> {
|
7
|
+
children?: Snippet<[CreateTooltipContextReturn]>;
|
8
|
+
}
|
9
|
+
</script>
|
10
|
+
|
11
|
+
<script lang="ts">
|
12
|
+
import {uuid} from '../utils.svelte.js';
|
13
|
+
import {createTooltipContext, setTooltipContext} from './context.svelte.js';
|
14
|
+
|
15
|
+
let {id = uuid(), children, ...props}: TooltipProps = $props();
|
16
|
+
|
17
|
+
let context = createTooltipContext({id, ...props});
|
18
|
+
|
19
|
+
setTooltipContext(context);
|
20
|
+
</script>
|
21
|
+
|
22
|
+
{@render children?.(context)}
|
@@ -1,12 +1,21 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
4
|
+
|
5
|
+
export interface TooltipTriggerProps extends Assign<SvelteHTMLElements['button'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useTooltipContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: TooltipTriggerProps = $props();
|
13
|
+
|
14
|
+
let context = useTooltipContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getTriggerProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<button type="button" {...attrs}>
|
20
|
+
{@render children?.()}
|
21
|
+
</button>
|
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.7",
|
5
5
|
"packageManager": "pnpm@9.7.0",
|
6
6
|
"svelte": "./dist/index.js",
|
7
7
|
"types": "./dist/index.d.ts",
|
@@ -22,7 +22,8 @@
|
|
22
22
|
},
|
23
23
|
"repository": {
|
24
24
|
"type": "git",
|
25
|
-
"url": "git+https://github.com/calvo-jp/ui-ingredients.git"
|
25
|
+
"url": "git+https://github.com/calvo-jp/ui-ingredients.git",
|
26
|
+
"directory": "packages/ui-ingredients"
|
26
27
|
},
|
27
28
|
"bugs": {
|
28
29
|
"url": "https://github.com/calvo-jp/ui-ingredients/issues",
|
@@ -81,8 +82,6 @@
|
|
81
82
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
82
83
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
83
84
|
"test": "vitest",
|
84
|
-
"lint": "prettier --check . && eslint .",
|
85
|
-
"format": "prettier --write .",
|
86
85
|
"release": "release-it"
|
87
86
|
},
|
88
87
|
"dependencies": {
|
@@ -125,29 +124,22 @@
|
|
125
124
|
"nanoid": "5.0.7"
|
126
125
|
},
|
127
126
|
"peerDependencies": {
|
128
|
-
"svelte": "
|
127
|
+
"svelte": "^5.0.0-next.1"
|
129
128
|
},
|
130
129
|
"devDependencies": {
|
131
130
|
"@sveltejs/adapter-vercel": "5.4.3",
|
132
|
-
"@sveltejs/kit": "2.5.
|
131
|
+
"@sveltejs/kit": "2.5.24",
|
133
132
|
"@sveltejs/package": "2.3.4",
|
134
|
-
"@sveltejs/vite-plugin-svelte": "
|
135
|
-
"@types/eslint": "9.6.0",
|
133
|
+
"@sveltejs/vite-plugin-svelte": "4.0.0-next.6",
|
136
134
|
"autoprefixer": "10.4.20",
|
137
|
-
"eslint": "9.9.0",
|
138
|
-
"eslint-config-prettier": "9.1.0",
|
139
|
-
"eslint-plugin-svelte": "2.43.0",
|
140
135
|
"globals": "15.9.0",
|
141
136
|
"postcss": "8.4.41",
|
142
|
-
"prettier": "3.3.3",
|
143
|
-
"prettier-plugin-svelte": "3.2.6",
|
144
137
|
"publint": "0.2.10",
|
145
138
|
"release-it": "17.6.0",
|
146
139
|
"svelte": "5.0.0-next.225",
|
147
140
|
"svelte-check": "3.8.5",
|
148
141
|
"tailwindcss": "3.4.10",
|
149
142
|
"typescript": "5.5.4",
|
150
|
-
"typescript-eslint": "8.1.0",
|
151
143
|
"vite": "5.4.1",
|
152
144
|
"vitest": "2.0.5"
|
153
145
|
},
|