ui-ingredients 0.0.5 → 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/context.svelte.js +1 -1
- 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/context.svelte.js +3 -3
- 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/context.svelte.js +1 -1
- 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/context.svelte.js +3 -3
- 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/context.svelte.js +1 -1
- 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
package/README.md
CHANGED
@@ -1,75 +1,75 @@
|
|
1
|
-
# UI Ingredients
|
2
|
-
|
3
|
-
Headless component library for [Svelte](https://svelte.dev/) powered by [zag](https://zagjs.com/)
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
```bash
|
8
|
-
npm install ui-ingredients
|
9
|
-
```
|
10
|
-
|
11
|
-
## Usage
|
12
|
-
|
13
|
-
```svelte
|
14
|
-
<script>
|
15
|
-
import {Clipboard} from 'ui-ingredients';
|
16
|
-
|
17
|
-
let {data} = $props();
|
18
|
-
</script>
|
19
|
-
|
20
|
-
<Clipboard.Root value={data.token}>
|
21
|
-
<Clipboard.Label>Token</Clipboard.Label>
|
22
|
-
<Clipboard.Control>
|
23
|
-
<Clipboard.Input />
|
24
|
-
<Clipboard.Trigger>
|
25
|
-
<Clipboard.Indicator copied>
|
26
|
-
<CheckIcon />
|
27
|
-
</Clipboard.Indicator>
|
28
|
-
<Clipboard.Indicator>
|
29
|
-
<CopyIcon />
|
30
|
-
</Clipboard.Indicator>
|
31
|
-
</Clipboard.Trigger>
|
32
|
-
</Clipboard.Control>
|
33
|
-
</Clipboard.Root>
|
34
|
-
```
|
35
|
-
|
36
|
-
## Components
|
37
|
-
|
38
|
-
- 🟢 Accordion
|
39
|
-
- 🟢 Avatar
|
40
|
-
- 🟢 Carousel
|
41
|
-
- 🟢 Checkbox
|
42
|
-
- 🟢 Clipboard
|
43
|
-
- 🟢 Collapsible
|
44
|
-
- ⚪ ColorPicker
|
45
|
-
- 🟢 Combobox
|
46
|
-
- 🟡 DatePicker
|
47
|
-
- 🟢 Dialog
|
48
|
-
- ⚪ Editable
|
49
|
-
- ⚪ FileUpload
|
50
|
-
- 🟢 HoverCard
|
51
|
-
- 🟡 Menu
|
52
|
-
- 🟢 NumberInput
|
53
|
-
- 🟢 Pagination
|
54
|
-
- 🟢 PinInput
|
55
|
-
- 🟢 Popover
|
56
|
-
- 🟢 Portal
|
57
|
-
- 🟢 Presence
|
58
|
-
- 🟢 Progress
|
59
|
-
- ⚪ QRCode
|
60
|
-
- 🟢 RadioGroup
|
61
|
-
- ⚪ RatingGroup
|
62
|
-
- 🟢 Select
|
63
|
-
- ⚪ SignaturePad
|
64
|
-
- 🟢 Slider
|
65
|
-
- ⚪ Splitter
|
66
|
-
- 🟢 Steps
|
67
|
-
- 🟢 Switch
|
68
|
-
- 🟢 Tabs
|
69
|
-
- 🟡 TagsInput
|
70
|
-
- ⚪ Timer
|
71
|
-
- 🟢 Toast
|
72
|
-
- 🟢 ToggleGroup
|
73
|
-
- 🟢 Tooltip
|
74
|
-
|
75
|
-
View components demo [here](https://ui-ingredients.vercel.app/)
|
1
|
+
# UI Ingredients
|
2
|
+
|
3
|
+
Headless component library for [Svelte](https://svelte.dev/) powered by [zag](https://zagjs.com/)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```bash
|
8
|
+
npm install ui-ingredients
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
```svelte
|
14
|
+
<script>
|
15
|
+
import {Clipboard} from 'ui-ingredients';
|
16
|
+
|
17
|
+
let {data} = $props();
|
18
|
+
</script>
|
19
|
+
|
20
|
+
<Clipboard.Root value={data.token}>
|
21
|
+
<Clipboard.Label>Token</Clipboard.Label>
|
22
|
+
<Clipboard.Control>
|
23
|
+
<Clipboard.Input />
|
24
|
+
<Clipboard.Trigger>
|
25
|
+
<Clipboard.Indicator copied>
|
26
|
+
<CheckIcon />
|
27
|
+
</Clipboard.Indicator>
|
28
|
+
<Clipboard.Indicator>
|
29
|
+
<CopyIcon />
|
30
|
+
</Clipboard.Indicator>
|
31
|
+
</Clipboard.Trigger>
|
32
|
+
</Clipboard.Control>
|
33
|
+
</Clipboard.Root>
|
34
|
+
```
|
35
|
+
|
36
|
+
## Components
|
37
|
+
|
38
|
+
- 🟢 Accordion
|
39
|
+
- 🟢 Avatar
|
40
|
+
- 🟢 Carousel
|
41
|
+
- 🟢 Checkbox
|
42
|
+
- 🟢 Clipboard
|
43
|
+
- 🟢 Collapsible
|
44
|
+
- ⚪ ColorPicker
|
45
|
+
- 🟢 Combobox
|
46
|
+
- 🟡 DatePicker
|
47
|
+
- 🟢 Dialog
|
48
|
+
- ⚪ Editable
|
49
|
+
- ⚪ FileUpload
|
50
|
+
- 🟢 HoverCard
|
51
|
+
- 🟡 Menu
|
52
|
+
- 🟢 NumberInput
|
53
|
+
- 🟢 Pagination
|
54
|
+
- 🟢 PinInput
|
55
|
+
- 🟢 Popover
|
56
|
+
- 🟢 Portal
|
57
|
+
- 🟢 Presence
|
58
|
+
- 🟢 Progress
|
59
|
+
- ⚪ QRCode
|
60
|
+
- 🟢 RadioGroup
|
61
|
+
- ⚪ RatingGroup
|
62
|
+
- 🟢 Select
|
63
|
+
- ⚪ SignaturePad
|
64
|
+
- 🟢 Slider
|
65
|
+
- ⚪ Splitter
|
66
|
+
- 🟢 Steps
|
67
|
+
- 🟢 Switch
|
68
|
+
- 🟢 Tabs
|
69
|
+
- 🟡 TagsInput
|
70
|
+
- ⚪ Timer
|
71
|
+
- 🟢 Toast
|
72
|
+
- 🟢 ToggleGroup
|
73
|
+
- 🟢 Tooltip
|
74
|
+
|
75
|
+
View components demo [here](https://ui-ingredients.vercel.app/)
|
@@ -13,7 +13,7 @@ export function useAccordionContext() {
|
|
13
13
|
return getContext('Accordion');
|
14
14
|
}
|
15
15
|
export function setAccordionItemContext(value) {
|
16
|
-
setContext('AccordionItem',
|
16
|
+
setContext('AccordionItem', value);
|
17
17
|
}
|
18
18
|
export function useAccordionItemContext() {
|
19
19
|
return getContext('AccordionItem');
|
@@ -1,13 +1,22 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
{
|
13
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
4
|
+
|
5
|
+
export interface AccordionItemContentProps extends Assign<SvelteHTMLElements['div'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useAccordionContext, useAccordionItemContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: AccordionItemContentProps = $props();
|
13
|
+
|
14
|
+
let context = useAccordionContext();
|
15
|
+
let itemContext = useAccordionItemContext();
|
16
|
+
|
17
|
+
let attrs = $derived(mergeProps(props, context.getItemContentProps(itemContext)));
|
18
|
+
</script>
|
19
|
+
|
20
|
+
<div {...attrs}>
|
21
|
+
{@render children?.()}
|
22
|
+
</div>
|
@@ -1,13 +1,22 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
{
|
13
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
4
|
+
|
5
|
+
export interface AccordionIndicatorProps extends Assign<SvelteHTMLElements['span'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useAccordionContext, useAccordionItemContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: AccordionIndicatorProps = $props();
|
13
|
+
|
14
|
+
let context = useAccordionContext();
|
15
|
+
let itemContext = useAccordionItemContext();
|
16
|
+
|
17
|
+
let attrs = $derived(mergeProps(props, context.getItemIndicatorProps(itemContext)));
|
18
|
+
</script>
|
19
|
+
|
20
|
+
<span {...attrs}>
|
21
|
+
{@render children?.()}
|
22
|
+
</span>
|
@@ -1,13 +1,22 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
{
|
13
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
4
|
+
|
5
|
+
export interface AccordionItemTriggerProps extends Assign<SvelteHTMLElements['button'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useAccordionContext, useAccordionItemContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: AccordionItemTriggerProps = $props();
|
13
|
+
|
14
|
+
let context = useAccordionContext();
|
15
|
+
let itemContext = useAccordionItemContext();
|
16
|
+
|
17
|
+
let attrs = $derived(mergeProps(props, context.getItemTriggerProps(itemContext)));
|
18
|
+
</script>
|
19
|
+
|
20
|
+
<button type="button" {...attrs}>
|
21
|
+
{@render children?.()}
|
22
|
+
</button>
|
@@ -1,24 +1,35 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
);
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {ItemProps} from '@zag-js/accordion';
|
4
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
5
|
+
|
6
|
+
export interface AccordionItemProps extends Assign<SvelteHTMLElements['div'], ItemProps> {}
|
7
|
+
</script>
|
8
|
+
|
9
|
+
<script lang="ts">
|
10
|
+
import {mergeProps} from '@zag-js/svelte';
|
11
|
+
import {setAccordionItemContext, useAccordionContext} from './context.svelte.js';
|
12
|
+
|
13
|
+
let {value, disabled, children, ...props}: AccordionItemProps = $props();
|
14
|
+
|
15
|
+
let context = useAccordionContext();
|
16
|
+
|
17
|
+
let attrs = $derived(
|
18
|
+
mergeProps(
|
19
|
+
props,
|
20
|
+
context.getItemProps({
|
21
|
+
value,
|
22
|
+
disabled,
|
23
|
+
}),
|
24
|
+
),
|
25
|
+
);
|
26
|
+
|
27
|
+
setAccordionItemContext({
|
28
|
+
value,
|
29
|
+
disabled,
|
30
|
+
});
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div {...attrs}>
|
34
|
+
{@render children?.()}
|
35
|
+
</div>
|
@@ -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
|
+
CreateAccordionContextProps,
|
7
|
+
CreateAccordionContextReturn,
|
8
|
+
} from './context.svelte.js';
|
9
|
+
|
10
|
+
export interface AccordionProps
|
11
|
+
extends Assign<
|
12
|
+
WithoutChildren<SvelteHTMLElements['div']>,
|
13
|
+
OptionalId<CreateAccordionContextProps>
|
14
|
+
> {
|
15
|
+
children?: Snippet<[CreateAccordionContextReturn]>;
|
16
|
+
}
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<script lang="ts">
|
20
|
+
import {uuid} from '../utils.svelte.js';
|
21
|
+
import {mergeProps} from '@zag-js/svelte';
|
22
|
+
import {createAccordionContext, setAccordionContext} from './context.svelte.js';
|
23
|
+
|
24
|
+
let {
|
25
|
+
id = uuid(),
|
26
|
+
ids,
|
27
|
+
dir,
|
28
|
+
value,
|
29
|
+
disabled,
|
30
|
+
multiple,
|
31
|
+
orientation,
|
32
|
+
collapsible,
|
33
|
+
onFocusChange,
|
34
|
+
onValueChange,
|
35
|
+
getRootNode,
|
36
|
+
children,
|
37
|
+
...props
|
38
|
+
}: AccordionProps = $props();
|
39
|
+
|
40
|
+
let context = createAccordionContext({
|
41
|
+
id,
|
42
|
+
ids,
|
43
|
+
dir,
|
44
|
+
value: $state.snapshot(value),
|
45
|
+
multiple,
|
46
|
+
disabled,
|
47
|
+
collapsible,
|
48
|
+
orientation,
|
49
|
+
onFocusChange,
|
50
|
+
onValueChange,
|
51
|
+
getRootNode,
|
52
|
+
});
|
53
|
+
|
54
|
+
let attrs = $derived(mergeProps(props, context.getRootProps()));
|
55
|
+
|
56
|
+
setAccordionContext(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 AvatarFallbackProps extends Assign<SvelteHTMLElements['div'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useAvatarContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: AvatarFallbackProps = $props();
|
13
|
+
|
14
|
+
let context = useAvatarContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getFallbackProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<div {...attrs}>
|
20
|
+
{@render children?.()}
|
21
|
+
</div>
|
package/dist/avatar/image.svelte
CHANGED
@@ -1,10 +1,19 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
4
|
+
|
5
|
+
export interface AvatarImageProps extends Assign<SvelteHTMLElements['img'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useAvatarContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {...props}: AvatarImageProps = $props();
|
13
|
+
|
14
|
+
let context = useAvatarContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getImageProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<img {...attrs} />
|
package/dist/avatar/root.svelte
CHANGED
@@ -1,29 +1,46 @@
|
|
1
|
-
<script lang="ts" context="module">
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
-
|
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 CreateAvatarContextProps, type CreateAvatarContextReturn} from './context.svelte.js';
|
6
|
+
|
7
|
+
export interface AvatarProps
|
8
|
+
extends Assign<
|
9
|
+
WithoutChildren<SvelteHTMLElements['div']>,
|
10
|
+
OptionalId<CreateAvatarContextProps>
|
11
|
+
> {
|
12
|
+
children?: Snippet<[CreateAvatarContextReturn]>;
|
13
|
+
}
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<script lang="ts">
|
17
|
+
import {uuid} from '../utils.svelte.js';
|
18
|
+
import {mergeProps} from '@zag-js/svelte';
|
19
|
+
import {createAvatarContext, setAvatarContext} from './context.svelte.js';
|
20
|
+
|
21
|
+
let {
|
22
|
+
id = uuid(),
|
23
|
+
ids,
|
24
|
+
dir,
|
25
|
+
getRootNode,
|
26
|
+
onStatusChange,
|
27
|
+
children,
|
28
|
+
...props
|
29
|
+
}: AvatarProps = $props();
|
30
|
+
|
31
|
+
let context = createAvatarContext({
|
32
|
+
id,
|
33
|
+
ids,
|
34
|
+
dir,
|
35
|
+
getRootNode,
|
36
|
+
onStatusChange,
|
37
|
+
});
|
38
|
+
|
39
|
+
let attrs = $derived(mergeProps(props, context.getRootProps()));
|
40
|
+
|
41
|
+
setAvatarContext(context);
|
42
|
+
</script>
|
43
|
+
|
44
|
+
<div {...attrs}>
|
45
|
+
{@render children?.(context)}
|
46
|
+
</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 CarouselIndicatorGroupProps extends Assign<SvelteHTMLElements['div'], {}> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useCarouselContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: CarouselIndicatorGroupProps = $props();
|
13
|
+
|
14
|
+
let context = useCarouselContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getIndicatorGroupProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<div {...attrs}>
|
20
|
+
{@render children?.()}
|
21
|
+
</div>
|
@@ -1,20 +1,31 @@
|
|
1
|
-
<script lang="ts" context="module"
|
2
|
-
|
3
|
-
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign} from '../types.js';
|
3
|
+
import type {IndicatorProps} from '@zag-js/carousel';
|
4
|
+
import type {SvelteHTMLElements} from 'svelte/elements';
|
5
|
+
|
6
|
+
export interface CarouselIndicatorProps
|
7
|
+
extends Assign<SvelteHTMLElements['button'], IndicatorProps> {}
|
8
|
+
</script>
|
9
|
+
|
10
|
+
<script lang="ts">
|
11
|
+
import {mergeProps} from '@zag-js/svelte';
|
12
|
+
import {useCarouselContext} from './context.svelte.js';
|
13
|
+
|
14
|
+
let {index, readOnly, children, ...props}: CarouselIndicatorProps = $props();
|
15
|
+
|
16
|
+
let context = useCarouselContext();
|
17
|
+
|
18
|
+
let attrs = $derived(
|
19
|
+
mergeProps(
|
20
|
+
props,
|
21
|
+
context.getIndicatorProps({
|
22
|
+
index,
|
23
|
+
readOnly,
|
24
|
+
}),
|
25
|
+
),
|
26
|
+
);
|
27
|
+
</script>
|
28
|
+
|
29
|
+
<button type="button" {...attrs}>
|
30
|
+
{@render children?.()}
|
31
|
+
</button>
|