@skeletonlabs/skeleton-svelte 2.0.0-next.3 → 2.0.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/anatomy/content.svelte +12 -9
- package/dist/components/accordion/anatomy/content.svelte.d.ts +3 -2
- package/dist/components/accordion/anatomy/content.svelte.d.ts.map +1 -0
- package/dist/components/accordion/anatomy/heading.svelte +10 -6
- package/dist/components/accordion/anatomy/heading.svelte.d.ts +3 -2
- package/dist/components/accordion/anatomy/heading.svelte.d.ts.map +1 -0
- package/dist/components/accordion/anatomy/indicator.svelte +10 -11
- package/dist/components/accordion/anatomy/indicator.svelte.d.ts +3 -2
- package/dist/components/accordion/anatomy/indicator.svelte.d.ts.map +1 -0
- package/dist/components/accordion/anatomy/item.svelte +19 -20
- package/dist/components/accordion/anatomy/item.svelte.d.ts +4 -3
- package/dist/components/accordion/anatomy/item.svelte.d.ts.map +1 -0
- package/dist/components/accordion/anatomy/root-context.svelte +7 -4
- package/dist/components/accordion/anatomy/root-context.svelte.d.ts +3 -2
- package/dist/components/accordion/anatomy/root-context.svelte.d.ts.map +1 -0
- package/dist/components/accordion/anatomy/root-provider.svelte +33 -0
- package/dist/components/accordion/anatomy/root-provider.svelte.d.ts +10 -0
- package/dist/components/accordion/anatomy/root-provider.svelte.d.ts.map +1 -0
- package/dist/components/accordion/anatomy/root.svelte +19 -19
- package/dist/components/accordion/anatomy/root.svelte.d.ts +3 -2
- package/dist/components/accordion/anatomy/root.svelte.d.ts.map +1 -0
- package/dist/components/accordion/anatomy/trigger.svelte +12 -9
- package/dist/components/accordion/anatomy/trigger.svelte.d.ts +3 -2
- package/dist/components/accordion/anatomy/trigger.svelte.d.ts.map +1 -0
- package/dist/components/accordion/index.d.ts +8 -8
- package/dist/components/accordion/index.d.ts.map +1 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/accordion/modules/anatomy.d.ts +2 -1
- package/dist/components/accordion/modules/anatomy.d.ts.map +1 -0
- package/dist/components/accordion/modules/anatomy.js +7 -7
- package/dist/components/accordion/modules/item-context.d.ts +4 -7
- package/dist/components/accordion/modules/item-context.d.ts.map +1 -0
- package/dist/components/accordion/modules/root-context.d.ts +3 -6
- package/dist/components/accordion/modules/root-context.d.ts.map +1 -0
- package/dist/components/accordion/modules/use-accordion.svelte.d.ts +3 -0
- package/dist/components/accordion/modules/use-accordion.svelte.d.ts.map +1 -0
- package/dist/components/accordion/modules/use-accordion.svelte.js +7 -0
- package/dist/components/avatar/anatomy/fallback.svelte +12 -7
- package/dist/components/avatar/anatomy/fallback.svelte.d.ts +3 -2
- package/dist/components/avatar/anatomy/fallback.svelte.d.ts.map +1 -0
- package/dist/components/avatar/anatomy/image.svelte +12 -7
- package/dist/components/avatar/anatomy/image.svelte.d.ts +3 -2
- package/dist/components/avatar/anatomy/image.svelte.d.ts.map +1 -0
- package/dist/components/avatar/anatomy/root-context.svelte +7 -4
- package/dist/components/avatar/anatomy/root-context.svelte.d.ts +3 -2
- package/dist/components/avatar/anatomy/root-context.svelte.d.ts.map +1 -0
- package/dist/components/avatar/anatomy/root-provider.svelte +37 -0
- package/dist/components/avatar/anatomy/root-provider.svelte.d.ts +10 -0
- package/dist/components/avatar/anatomy/root-provider.svelte.d.ts.map +1 -0
- package/dist/components/avatar/anatomy/root.svelte +20 -17
- package/dist/components/avatar/anatomy/root.svelte.d.ts +4 -3
- package/dist/components/avatar/anatomy/root.svelte.d.ts.map +1 -0
- package/dist/components/avatar/index.d.ts +6 -4
- package/dist/components/avatar/index.d.ts.map +1 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/avatar/modules/anatomy.d.ts +2 -0
- package/dist/components/avatar/modules/anatomy.d.ts.map +1 -0
- package/dist/components/avatar/modules/anatomy.js +5 -3
- package/dist/components/avatar/modules/root-context.d.ts +3 -6
- package/dist/components/avatar/modules/root-context.d.ts.map +1 -0
- package/dist/components/avatar/modules/use-avatar.svelte.d.ts +3 -0
- package/dist/components/avatar/modules/use-avatar.svelte.d.ts.map +1 -0
- package/dist/components/avatar/modules/use-avatar.svelte.js +7 -0
- package/dist/components/progress-linear/anatomy/label.svelte +10 -13
- package/dist/components/progress-linear/anatomy/label.svelte.d.ts +3 -2
- package/dist/components/progress-linear/anatomy/label.svelte.d.ts.map +1 -0
- package/dist/components/progress-linear/anatomy/range.svelte +10 -13
- package/dist/components/progress-linear/anatomy/range.svelte.d.ts +3 -2
- package/dist/components/progress-linear/anatomy/range.svelte.d.ts.map +1 -0
- package/dist/components/progress-linear/anatomy/root-context.svelte +7 -4
- package/dist/components/progress-linear/anatomy/root-context.svelte.d.ts +3 -2
- package/dist/components/progress-linear/anatomy/root-context.svelte.d.ts.map +1 -0
- package/dist/components/progress-linear/anatomy/root-provider.svelte +37 -0
- package/dist/components/progress-linear/anatomy/root-provider.svelte.d.ts +10 -0
- package/dist/components/progress-linear/anatomy/root-provider.svelte.d.ts.map +1 -0
- package/dist/components/progress-linear/anatomy/root.svelte +17 -26
- package/dist/components/progress-linear/anatomy/root.svelte.d.ts +4 -3
- package/dist/components/progress-linear/anatomy/root.svelte.d.ts.map +1 -0
- package/dist/components/progress-linear/anatomy/track.svelte +12 -7
- package/dist/components/progress-linear/anatomy/track.svelte.d.ts +3 -2
- package/dist/components/progress-linear/anatomy/track.svelte.d.ts.map +1 -0
- package/dist/components/progress-linear/index.d.ts +6 -4
- package/dist/components/progress-linear/index.d.ts.map +1 -0
- package/dist/components/progress-linear/index.js +1 -0
- package/dist/components/progress-linear/modules/anatomy.d.ts +1 -0
- package/dist/components/progress-linear/modules/anatomy.d.ts.map +1 -0
- package/dist/components/progress-linear/modules/anatomy.js +3 -3
- package/dist/components/progress-linear/modules/root-context.d.ts +3 -6
- package/dist/components/progress-linear/modules/root-context.d.ts.map +1 -0
- package/dist/components/progress-linear/modules/use-progress-linear.svelte.d.ts +3 -0
- package/dist/components/progress-linear/modules/use-progress-linear.svelte.d.ts.map +1 -0
- package/dist/components/progress-linear/modules/use-progress-linear.svelte.js +7 -0
- package/dist/components/rating-group/anatomy/control.svelte +15 -8
- package/dist/components/rating-group/anatomy/control.svelte.d.ts +3 -2
- package/dist/components/rating-group/anatomy/control.svelte.d.ts.map +1 -0
- package/dist/components/rating-group/anatomy/hidden-input.svelte +12 -9
- package/dist/components/rating-group/anatomy/hidden-input.svelte.d.ts +3 -2
- package/dist/components/rating-group/anatomy/hidden-input.svelte.d.ts.map +1 -0
- package/dist/components/rating-group/anatomy/item.svelte +19 -22
- package/dist/components/rating-group/anatomy/item.svelte.d.ts +4 -3
- package/dist/components/rating-group/anatomy/item.svelte.d.ts.map +1 -0
- package/dist/components/rating-group/anatomy/label.svelte +15 -8
- package/dist/components/rating-group/anatomy/label.svelte.d.ts +3 -2
- package/dist/components/rating-group/anatomy/label.svelte.d.ts.map +1 -0
- package/dist/components/rating-group/anatomy/root-context.svelte +7 -4
- package/dist/components/rating-group/anatomy/root-context.svelte.d.ts +3 -2
- package/dist/components/rating-group/anatomy/root-context.svelte.d.ts.map +1 -0
- package/dist/components/rating-group/anatomy/root-provider.svelte +37 -0
- package/dist/components/rating-group/anatomy/root-provider.svelte.d.ts +10 -0
- package/dist/components/rating-group/anatomy/root-provider.svelte.d.ts.map +1 -0
- package/dist/components/rating-group/anatomy/root.svelte +20 -23
- package/dist/components/rating-group/anatomy/root.svelte.d.ts +4 -3
- package/dist/components/rating-group/anatomy/root.svelte.d.ts.map +1 -0
- package/dist/components/rating-group/index.d.ts +8 -8
- package/dist/components/rating-group/index.d.ts.map +1 -0
- package/dist/components/rating-group/index.js +1 -0
- package/dist/components/rating-group/modules/anatomy.d.ts +2 -1
- package/dist/components/rating-group/modules/anatomy.d.ts.map +1 -0
- package/dist/components/rating-group/modules/anatomy.js +7 -7
- package/dist/components/rating-group/modules/root-context.d.ts +3 -6
- package/dist/components/rating-group/modules/root-context.d.ts.map +1 -0
- package/dist/components/rating-group/modules/use-rating-group.svelte.d.ts +3 -0
- package/dist/components/rating-group/modules/use-rating-group.svelte.d.ts.map +1 -0
- package/dist/components/rating-group/modules/use-rating-group.svelte.js +7 -0
- package/dist/components/switch/anatomy/control.svelte +33 -0
- package/dist/components/switch/anatomy/control.svelte.d.ts +8 -0
- package/dist/components/switch/anatomy/control.svelte.d.ts.map +1 -0
- package/dist/components/switch/anatomy/hidden-input.svelte +31 -0
- package/dist/components/switch/anatomy/hidden-input.svelte.d.ts +8 -0
- package/dist/components/switch/anatomy/hidden-input.svelte.d.ts.map +1 -0
- package/dist/components/switch/anatomy/label.svelte +33 -0
- package/dist/components/switch/anatomy/label.svelte.d.ts +8 -0
- package/dist/components/switch/anatomy/label.svelte.d.ts.map +1 -0
- package/dist/components/switch/anatomy/root-context.svelte +21 -0
- package/dist/components/switch/anatomy/root-context.svelte.d.ts +9 -0
- package/dist/components/switch/anatomy/root-context.svelte.d.ts.map +1 -0
- package/dist/components/switch/anatomy/root-provider.svelte +37 -0
- package/dist/components/switch/anatomy/root-provider.svelte.d.ts +10 -0
- package/dist/components/switch/anatomy/root-provider.svelte.d.ts.map +1 -0
- package/dist/components/switch/anatomy/root.svelte +44 -0
- package/dist/components/switch/anatomy/root.svelte.d.ts +9 -0
- package/dist/components/switch/anatomy/root.svelte.d.ts.map +1 -0
- package/dist/components/switch/anatomy/thumb.svelte +33 -0
- package/dist/components/switch/anatomy/thumb.svelte.d.ts +8 -0
- package/dist/components/switch/anatomy/thumb.svelte.d.ts.map +1 -0
- package/dist/components/switch/index.d.ts +10 -0
- package/dist/components/switch/index.d.ts.map +1 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/switch/modules/anatomy.d.ts +9 -0
- package/dist/components/switch/modules/anatomy.d.ts.map +1 -0
- package/dist/components/switch/modules/anatomy.js +15 -0
- package/dist/components/switch/modules/root-context.d.ts +6 -0
- package/dist/components/switch/modules/root-context.d.ts.map +1 -0
- package/dist/components/{rating-group/modules/item-context.js → switch/modules/root-context.js} +1 -1
- package/dist/components/switch/modules/use-switch.svelte.d.ts +3 -0
- package/dist/components/switch/modules/use-switch.svelte.d.ts.map +1 -0
- package/dist/components/switch/modules/use-switch.svelte.js +7 -0
- package/dist/components/tabs/anatomy/content.svelte +14 -8
- package/dist/components/tabs/anatomy/content.svelte.d.ts +3 -2
- package/dist/components/tabs/anatomy/content.svelte.d.ts.map +1 -0
- package/dist/components/tabs/anatomy/indicator.svelte +13 -8
- package/dist/components/tabs/anatomy/indicator.svelte.d.ts +3 -2
- package/dist/components/tabs/anatomy/indicator.svelte.d.ts.map +1 -0
- package/dist/components/tabs/anatomy/list.svelte +13 -8
- package/dist/components/tabs/anatomy/list.svelte.d.ts +3 -2
- package/dist/components/tabs/anatomy/list.svelte.d.ts.map +1 -0
- package/dist/components/tabs/anatomy/root-context.svelte +7 -4
- package/dist/components/tabs/anatomy/root-context.svelte.d.ts +3 -2
- package/dist/components/tabs/anatomy/root-context.svelte.d.ts.map +1 -0
- package/dist/components/tabs/anatomy/root-provider.svelte +36 -0
- package/dist/components/tabs/anatomy/root-provider.svelte.d.ts +10 -0
- package/dist/components/tabs/anatomy/root-provider.svelte.d.ts.map +1 -0
- package/dist/components/tabs/anatomy/root.svelte +18 -19
- package/dist/components/tabs/anatomy/root.svelte.d.ts +3 -2
- package/dist/components/tabs/anatomy/root.svelte.d.ts.map +1 -0
- package/dist/components/tabs/anatomy/trigger.svelte +14 -8
- package/dist/components/tabs/anatomy/trigger.svelte.d.ts +3 -2
- package/dist/components/tabs/anatomy/trigger.svelte.d.ts.map +1 -0
- package/dist/components/tabs/index.d.ts +10 -1
- package/dist/components/tabs/index.d.ts.map +1 -0
- package/dist/components/tabs/index.js +2 -1
- package/dist/components/tabs/modules/anatomy.d.ts +2 -0
- package/dist/components/tabs/modules/anatomy.d.ts.map +1 -0
- package/dist/components/tabs/modules/anatomy.js +6 -4
- package/dist/components/tabs/modules/root-context.d.ts +3 -6
- package/dist/components/tabs/modules/root-context.d.ts.map +1 -0
- package/dist/components/tabs/modules/use-tabs.svelte.d.ts +3 -0
- package/dist/components/tabs/modules/use-tabs.svelte.d.ts.map +1 -0
- package/dist/components/tabs/modules/use-tabs.svelte.js +7 -0
- package/dist/components/toast/anatomy/action-trigger.svelte +33 -0
- package/dist/components/toast/anatomy/action-trigger.svelte.d.ts +8 -0
- package/dist/components/toast/anatomy/action-trigger.svelte.d.ts.map +1 -0
- package/dist/components/toast/anatomy/close-trigger.svelte +39 -0
- package/dist/components/toast/anatomy/close-trigger.svelte.d.ts +8 -0
- package/dist/components/toast/anatomy/close-trigger.svelte.d.ts.map +1 -0
- package/dist/components/toast/anatomy/description.svelte +33 -0
- package/dist/components/toast/anatomy/description.svelte.d.ts +8 -0
- package/dist/components/toast/anatomy/description.svelte.d.ts.map +1 -0
- package/dist/components/toast/anatomy/group.svelte +49 -0
- package/dist/components/toast/anatomy/group.svelte.d.ts +12 -0
- package/dist/components/toast/anatomy/group.svelte.d.ts.map +1 -0
- package/dist/components/toast/anatomy/message.svelte +29 -0
- package/dist/components/toast/anatomy/message.svelte.d.ts +8 -0
- package/dist/components/toast/anatomy/message.svelte.d.ts.map +1 -0
- package/dist/components/toast/anatomy/root-context.svelte +20 -0
- package/dist/components/toast/anatomy/root-context.svelte.d.ts +9 -0
- package/dist/components/toast/anatomy/root-context.svelte.d.ts.map +1 -0
- package/dist/components/toast/anatomy/root.svelte +76 -0
- package/dist/components/toast/anatomy/root.svelte.d.ts +10 -0
- package/dist/components/toast/anatomy/root.svelte.d.ts.map +1 -0
- package/dist/components/toast/anatomy/title.svelte +33 -0
- package/dist/components/toast/anatomy/title.svelte.d.ts +8 -0
- package/dist/components/toast/anatomy/title.svelte.d.ts.map +1 -0
- package/dist/components/toast/index.d.ts +10 -0
- package/dist/components/toast/index.d.ts.map +1 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toast/modules/anatomy.d.ts +10 -0
- package/dist/components/toast/modules/anatomy.d.ts.map +1 -0
- package/dist/components/toast/modules/anatomy.js +17 -0
- package/dist/components/toast/modules/group-context.d.ts +7 -0
- package/dist/components/toast/modules/group-context.d.ts.map +1 -0
- package/dist/components/toast/modules/group-context.js +2 -0
- package/dist/components/toast/modules/root-context.d.ts +7 -0
- package/dist/components/toast/modules/root-context.d.ts.map +1 -0
- package/dist/components/toast/modules/root-context.js +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/internal/components/star-empty.svelte.d.ts +1 -0
- package/dist/internal/components/star-empty.svelte.d.ts.map +1 -0
- package/dist/internal/components/star-full.svelte.d.ts +1 -0
- package/dist/internal/components/star-full.svelte.d.ts.map +1 -0
- package/dist/internal/components/star-half.svelte.d.ts +1 -0
- package/dist/internal/components/star-half.svelte.d.ts.map +1 -0
- package/dist/internal/components/x.svelte +14 -0
- package/dist/internal/components/x.svelte.d.ts +27 -0
- package/dist/internal/components/x.svelte.d.ts.map +1 -0
- package/dist/internal/create-context.d.ts +1 -0
- package/dist/internal/create-context.d.ts.map +1 -0
- package/dist/internal/create-context.js +1 -1
- package/dist/internal/html-attributes.d.ts +3 -0
- package/dist/internal/html-attributes.d.ts.map +1 -0
- package/dist/internal/html-attributes.js +1 -0
- package/dist/internal/props-with-children.d.ts +1 -0
- package/dist/internal/props-with-children.d.ts.map +1 -0
- package/dist/internal/props-with-element.d.ts +5 -4
- package/dist/internal/props-with-element.d.ts.map +1 -0
- package/package.json +18 -22
- package/dist/components/accordion/anatomy/item-context.svelte +0 -18
- package/dist/components/accordion/anatomy/item-context.svelte.d.ts +0 -8
- package/dist/components/rating-group/anatomy/item-context.svelte +0 -18
- package/dist/components/rating-group/anatomy/item-context.svelte.d.ts +0 -8
- package/dist/components/rating-group/modules/item-context.d.ts +0 -9
- package/dist/internal/test-utils.d.ts +0 -3
- package/dist/internal/test-utils.js +0 -9
|
@@ -1,45 +1,42 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
2
|
import type { Props } from '@zag-js/rating-group';
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
5
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
6
|
+
|
|
7
|
+
export interface RatingGroupRootProps extends Omit<Props, 'id'>, PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {}
|
|
10
8
|
</script>
|
|
11
9
|
|
|
12
10
|
<script lang="ts">
|
|
13
|
-
import { mergeProps, normalizeProps, useMachine } from '@zag-js/svelte';
|
|
14
|
-
import { splitProps, machine, connect } from '@zag-js/rating-group';
|
|
15
11
|
import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
|
|
12
|
+
import { splitProps } from '@zag-js/rating-group';
|
|
13
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
14
|
+
|
|
16
15
|
import { RatingGroupRootContext } from '../modules/root-context';
|
|
16
|
+
import { useRatingGroup } from '../modules/use-rating-group.svelte';
|
|
17
17
|
|
|
18
18
|
const props: RatingGroupRootProps = $props();
|
|
19
|
-
|
|
20
|
-
const [
|
|
21
|
-
|
|
22
|
-
const { element, children, ...restAttributes } = $derived(componentProps);
|
|
19
|
+
|
|
20
|
+
const [ratingGroupProps, componentProps] = $derived(splitProps(props));
|
|
21
|
+
const { element, children, ...rest } = $derived(componentProps);
|
|
23
22
|
|
|
24
23
|
const id = $props.id();
|
|
25
|
-
const
|
|
26
|
-
// @ts-expect-error - https://github.com/chakra-ui/zag/issues/2672
|
|
24
|
+
const ratingGroup = useRatingGroup(() => ({
|
|
27
25
|
id: id,
|
|
28
|
-
...
|
|
26
|
+
...ratingGroupProps,
|
|
29
27
|
}));
|
|
30
|
-
const api = $derived(connect(service, normalizeProps));
|
|
31
28
|
|
|
32
|
-
const attributes = $derived(
|
|
29
|
+
const attributes = $derived(
|
|
30
|
+
mergeProps(ratingGroup().getRootProps(), rest, {
|
|
31
|
+
class: classesRatingGroup.root,
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
33
34
|
|
|
34
|
-
RatingGroupRootContext.provide(
|
|
35
|
-
get api() {
|
|
36
|
-
return api;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
35
|
+
RatingGroupRootContext.provide(() => ratingGroup());
|
|
39
36
|
</script>
|
|
40
37
|
|
|
41
38
|
{#if element}
|
|
42
|
-
{@render element(
|
|
39
|
+
{@render element(attributes)}
|
|
43
40
|
{:else}
|
|
44
41
|
<div {...attributes}>
|
|
45
42
|
{@render children?.()}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
-
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
1
|
import type { Props } from '@zag-js/rating-group';
|
|
4
|
-
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
export interface RatingGroupRootProps extends Omit<Props, 'id'>, PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
5
5
|
}
|
|
6
6
|
declare const Root: import("svelte").Component<RatingGroupRootProps, {}, "">;
|
|
7
7
|
type Root = ReturnType<typeof Root>;
|
|
8
8
|
export default Root;
|
|
9
|
+
//# sourceMappingURL=root.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/rating-group/anatomy/root.svelte.ts"],"names":[],"mappings":"AAGC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC,KAAK,EAAE,IAAI,GAAG,KAAK,CAAC;CAAG;AAkDjI,QAAA,MAAM,IAAI,0DAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { RatingGroup } from './modules/anatomy';
|
|
2
|
-
export type { RatingGroupRootProps } from './anatomy/root.svelte';
|
|
3
|
-
export type { RatingGroupRootContextProps } from './anatomy/root-context.svelte';
|
|
4
|
-
export type { RatingGroupLabelProps } from './anatomy/label.svelte';
|
|
5
1
|
export type { RatingGroupControlProps } from './anatomy/control.svelte';
|
|
6
|
-
export type { RatingGroupItemProps } from './anatomy/item.svelte';
|
|
7
|
-
export type { RatingGroupItemContextProps } from './anatomy/item-context.svelte';
|
|
8
2
|
export type { RatingGroupHiddenInputProps } from './anatomy/hidden-input.svelte';
|
|
9
|
-
export type {
|
|
10
|
-
export type {
|
|
3
|
+
export type { RatingGroupItemProps } from './anatomy/item.svelte';
|
|
4
|
+
export type { RatingGroupLabelProps } from './anatomy/label.svelte';
|
|
5
|
+
export type { RatingGroupRootProps } from './anatomy/root.svelte';
|
|
6
|
+
export type { RatingGroupRootContextProps } from './anatomy/root-context.svelte';
|
|
7
|
+
export type { RatingGroupRootProviderProps } from './anatomy/root-provider.svelte';
|
|
8
|
+
export { RatingGroup } from './modules/anatomy';
|
|
9
|
+
export { useRatingGroup } from './modules/use-rating-group.svelte';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/rating-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,YAAY,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,YAAY,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,YAAY,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare const RatingGroup: import("svelte").Component<import("../anatomy/root.svelte").RatingGroupRootProps, {}, ""> & {
|
|
2
|
+
Provider: import("svelte").Component<import("../anatomy/root-provider.svelte").RatingGroupRootProviderProps, {}, "">;
|
|
2
3
|
Context: import("svelte").Component<import("../anatomy/root-context.svelte").RatingGroupRootContextProps, {}, "">;
|
|
3
4
|
Label: import("svelte").Component<import("../anatomy/label.svelte").RatingGroupLabelProps, {}, "">;
|
|
4
5
|
Control: import("svelte").Component<import("../anatomy/control.svelte").RatingGroupControlProps, {}, "">;
|
|
5
6
|
Item: import("svelte").Component<import("../anatomy/item.svelte").RatingGroupItemProps, {}, "">;
|
|
6
|
-
ItemContext: import("svelte").Component<import("../anatomy/item-context.svelte").RatingGroupItemContextProps, {}, "">;
|
|
7
7
|
HiddenInput: import("svelte").Component<import("../anatomy/hidden-input.svelte").RatingGroupHiddenInputProps, {}, "">;
|
|
8
8
|
};
|
|
9
|
+
//# sourceMappingURL=anatomy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anatomy.d.ts","sourceRoot":"","sources":["../../../../src/components/rating-group/modules/anatomy.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW;;;;;;;CAOtB,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import Root from '../anatomy/root.svelte';
|
|
2
|
-
import RootContext from '../anatomy/root-context.svelte';
|
|
3
|
-
import Label from '../anatomy/label.svelte';
|
|
4
1
|
import Control from '../anatomy/control.svelte';
|
|
5
|
-
import Item from '../anatomy/item.svelte';
|
|
6
|
-
import ItemContext from '../anatomy/item-context.svelte';
|
|
7
2
|
import HiddenInput from '../anatomy/hidden-input.svelte';
|
|
3
|
+
import Item from '../anatomy/item.svelte';
|
|
4
|
+
import Label from '../anatomy/label.svelte';
|
|
5
|
+
import Root from '../anatomy/root.svelte';
|
|
6
|
+
import RootContext from '../anatomy/root-context.svelte';
|
|
7
|
+
import RootProvider from '../anatomy/root-provider.svelte';
|
|
8
8
|
export const RatingGroup = Object.assign(Root, {
|
|
9
|
+
Provider: RootProvider,
|
|
9
10
|
Context: RootContext,
|
|
10
11
|
Label: Label,
|
|
11
12
|
Control: Control,
|
|
12
13
|
Item: Item,
|
|
13
|
-
|
|
14
|
-
HiddenInput: HiddenInput
|
|
14
|
+
HiddenInput: HiddenInput,
|
|
15
15
|
});
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type { Api } from '@zag-js/rating-group';
|
|
2
|
-
export interface RatingGroupRootContextType {
|
|
3
|
-
api: Api;
|
|
4
|
-
}
|
|
5
1
|
export declare const RatingGroupRootContext: {
|
|
6
2
|
key: symbol;
|
|
7
|
-
consume():
|
|
8
|
-
provide(value:
|
|
3
|
+
consume(): () => import("@zag-js/rating-group").Api;
|
|
4
|
+
provide(value: () => import("@zag-js/rating-group").Api): () => import("@zag-js/rating-group").Api;
|
|
9
5
|
};
|
|
6
|
+
//# sourceMappingURL=root-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-context.d.ts","sourceRoot":"","sources":["../../../../src/components/rating-group/modules/root-context.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB;;;;CAAqD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-rating-group.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/rating-group/modules/use-rating-group.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAoB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG9E,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,MAAM,GAAG,CAItE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { connect, machine } from '@zag-js/rating-group';
|
|
2
|
+
import { normalizeProps, useMachine } from '@zag-js/svelte';
|
|
3
|
+
export function useRatingGroup(props) {
|
|
4
|
+
const service = useMachine(machine, props);
|
|
5
|
+
const ratingGroup = $derived(connect(service, normalizeProps));
|
|
6
|
+
return () => ratingGroup;
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
|
|
5
|
+
export interface SwitchControlProps extends PropsWithElement<'span'>, HTMLAttributes<'span'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
10
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
11
|
+
|
|
12
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
13
|
+
|
|
14
|
+
const props: SwitchControlProps = $props();
|
|
15
|
+
|
|
16
|
+
const switch_ = SwitchRootContext.consume();
|
|
17
|
+
|
|
18
|
+
const { element, children, ...rest } = $derived(props);
|
|
19
|
+
|
|
20
|
+
const attributes = $derived(
|
|
21
|
+
mergeProps(switch_().getControlProps(), rest, {
|
|
22
|
+
class: classesSwitch.control,
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#if element}
|
|
28
|
+
{@render element(attributes)}
|
|
29
|
+
{:else}
|
|
30
|
+
<span {...attributes}>
|
|
31
|
+
{@render children?.()}
|
|
32
|
+
</span>
|
|
33
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
export interface SwitchControlProps extends PropsWithElement<'span'>, HTMLAttributes<'span'> {
|
|
4
|
+
}
|
|
5
|
+
declare const Control: import("svelte").Component<SwitchControlProps, {}, "">;
|
|
6
|
+
type Control = ReturnType<typeof Control>;
|
|
7
|
+
export default Control;
|
|
8
|
+
//# sourceMappingURL=control.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/anatomy/control.svelte.ts"],"names":[],"mappings":"AAGC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC;CAAG;AAuChG,QAAA,MAAM,OAAO,wDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
|
|
5
|
+
export interface SwitchHiddenInputProps extends PropsWithElement<'input'>, HTMLAttributes<'input', 'children'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
10
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
11
|
+
|
|
12
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
13
|
+
|
|
14
|
+
const props: SwitchHiddenInputProps = $props();
|
|
15
|
+
|
|
16
|
+
const switch_ = SwitchRootContext.consume();
|
|
17
|
+
|
|
18
|
+
const { element, ...rest } = $derived(props);
|
|
19
|
+
|
|
20
|
+
const attributes = $derived(
|
|
21
|
+
mergeProps(switch_().getHiddenInputProps(), rest, {
|
|
22
|
+
class: classesSwitch.hiddenInput,
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#if element}
|
|
28
|
+
{@render element(attributes)}
|
|
29
|
+
{:else}
|
|
30
|
+
<input {...attributes} />
|
|
31
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
export interface SwitchHiddenInputProps extends PropsWithElement<'input'>, HTMLAttributes<'input', 'children'> {
|
|
4
|
+
}
|
|
5
|
+
declare const HiddenInput: import("svelte").Component<SwitchHiddenInputProps, {}, "">;
|
|
6
|
+
type HiddenInput = ReturnType<typeof HiddenInput>;
|
|
7
|
+
export default HiddenInput;
|
|
8
|
+
//# sourceMappingURL=hidden-input.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden-input.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/anatomy/hidden-input.svelte.ts"],"names":[],"mappings":"AAGC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC;CAAG;AAqClH,QAAA,MAAM,WAAW,4DAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
|
|
5
|
+
export interface SwitchLabelProps extends PropsWithElement<'span'>, HTMLAttributes<'span'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
10
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
11
|
+
|
|
12
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
13
|
+
|
|
14
|
+
const props: SwitchLabelProps = $props();
|
|
15
|
+
|
|
16
|
+
const switch_ = SwitchRootContext.consume();
|
|
17
|
+
|
|
18
|
+
const { element, children, ...rest } = $derived(props);
|
|
19
|
+
|
|
20
|
+
const attributes = $derived(
|
|
21
|
+
mergeProps(switch_().getLabelProps(), rest, {
|
|
22
|
+
class: classesSwitch.label,
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#if element}
|
|
28
|
+
{@render element(attributes)}
|
|
29
|
+
{:else}
|
|
30
|
+
<span {...attributes}>
|
|
31
|
+
{@render children?.()}
|
|
32
|
+
</span>
|
|
33
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
export interface SwitchLabelProps extends PropsWithElement<'span'>, HTMLAttributes<'span'> {
|
|
4
|
+
}
|
|
5
|
+
declare const Label: import("svelte").Component<SwitchLabelProps, {}, "">;
|
|
6
|
+
type Label = ReturnType<typeof Label>;
|
|
7
|
+
export default Label;
|
|
8
|
+
//# sourceMappingURL=label.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/anatomy/label.svelte.ts"],"names":[],"mappings":"AAGC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC;CAAG;AAuC9F,QAAA,MAAM,KAAK,sDAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
import type { useSwitch } from '../modules/use-switch.svelte';
|
|
5
|
+
|
|
6
|
+
export interface SwitchRootContextProps {
|
|
7
|
+
children: Snippet<[ReturnType<typeof useSwitch>]>;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
13
|
+
|
|
14
|
+
const props: SwitchRootContextProps = $props();
|
|
15
|
+
|
|
16
|
+
const switch_ = SwitchRootContext.consume();
|
|
17
|
+
|
|
18
|
+
const { children } = $derived(props);
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
{@render children(switch_)}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { useSwitch } from '../modules/use-switch.svelte';
|
|
3
|
+
export interface SwitchRootContextProps {
|
|
4
|
+
children: Snippet<[ReturnType<typeof useSwitch>]>;
|
|
5
|
+
}
|
|
6
|
+
declare const RootContext: import("svelte").Component<SwitchRootContextProps, {}, "">;
|
|
7
|
+
type RootContext = ReturnType<typeof RootContext>;
|
|
8
|
+
export default RootContext;
|
|
9
|
+
//# sourceMappingURL=root-context.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-context.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/anatomy/root-context.svelte.ts"],"names":[],"mappings":"AAGC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACtC,QAAQ,EAAE,OAAO,CAAC,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;CAClD;AAqBF,QAAA,MAAM,WAAW,4DAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
|
|
5
|
+
import type { useSwitch } from '../modules/use-switch.svelte';
|
|
6
|
+
|
|
7
|
+
export interface SwitchRootProviderProps extends PropsWithElement<'label'>, HTMLAttributes<'label', 'id' | 'dir' | 'form'> {
|
|
8
|
+
value: ReturnType<typeof useSwitch>;
|
|
9
|
+
}
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
14
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
15
|
+
|
|
16
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
17
|
+
|
|
18
|
+
const props: SwitchRootProviderProps = $props();
|
|
19
|
+
|
|
20
|
+
const { element, children, value: switch_, ...rest } = $derived(props);
|
|
21
|
+
|
|
22
|
+
const attributes = $derived(
|
|
23
|
+
mergeProps(switch_().getRootProps(), rest, {
|
|
24
|
+
class: classesSwitch.root,
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
SwitchRootContext.provide(() => switch_());
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
{#if element}
|
|
32
|
+
{@render element(attributes)}
|
|
33
|
+
{:else}
|
|
34
|
+
<label {...attributes}>
|
|
35
|
+
{@render children?.()}
|
|
36
|
+
</label>
|
|
37
|
+
{/if}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { useSwitch } from '../modules/use-switch.svelte';
|
|
4
|
+
export interface SwitchRootProviderProps extends PropsWithElement<'label'>, HTMLAttributes<'label', 'id' | 'dir' | 'form'> {
|
|
5
|
+
value: ReturnType<typeof useSwitch>;
|
|
6
|
+
}
|
|
7
|
+
declare const RootProvider: import("svelte").Component<SwitchRootProviderProps, {}, "">;
|
|
8
|
+
type RootProvider = ReturnType<typeof RootProvider>;
|
|
9
|
+
export default RootProvider;
|
|
10
|
+
//# sourceMappingURL=root-provider.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-provider.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/anatomy/root-provider.svelte.ts"],"names":[],"mappings":"AAGC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;IACzH,KAAK,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;CACpC;AAuCF,QAAA,MAAM,YAAY,6DAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Props } from '@zag-js/switch';
|
|
3
|
+
|
|
4
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
5
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
6
|
+
|
|
7
|
+
export interface SwitchRootProps extends Omit<Props, 'id'>, PropsWithElement<'label'>, HTMLAttributes<'label', 'id' | 'dir' | 'form'> {}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
12
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
13
|
+
import { splitProps } from '@zag-js/switch';
|
|
14
|
+
|
|
15
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
16
|
+
import { useSwitch } from '../modules/use-switch.svelte';
|
|
17
|
+
|
|
18
|
+
const props: SwitchRootProps = $props();
|
|
19
|
+
|
|
20
|
+
const [switchProps, componentProps] = $derived(splitProps(props));
|
|
21
|
+
const { element, children, ...rest } = $derived(componentProps);
|
|
22
|
+
|
|
23
|
+
const id = $props.id();
|
|
24
|
+
const switch_ = useSwitch(() => ({
|
|
25
|
+
id: id,
|
|
26
|
+
...switchProps,
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
const attributes = $derived(
|
|
30
|
+
mergeProps(switch_().getRootProps(), rest, {
|
|
31
|
+
class: classesSwitch.root,
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
SwitchRootContext.provide(() => switch_());
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
{#if element}
|
|
39
|
+
{@render element(attributes)}
|
|
40
|
+
{:else}
|
|
41
|
+
<label {...attributes}>
|
|
42
|
+
{@render children?.()}
|
|
43
|
+
</label>
|
|
44
|
+
{/if}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Props } from '@zag-js/switch';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
export interface SwitchRootProps extends Omit<Props, 'id'>, PropsWithElement<'label'>, HTMLAttributes<'label', 'id' | 'dir' | 'form'> {
|
|
5
|
+
}
|
|
6
|
+
declare const Root: import("svelte").Component<SwitchRootProps, {}, "">;
|
|
7
|
+
type Root = ReturnType<typeof Root>;
|
|
8
|
+
export default Root;
|
|
9
|
+
//# sourceMappingURL=root.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/anatomy/root.svelte.ts"],"names":[],"mappings":"AAGC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;CAAG;AAkDzI,QAAA,MAAM,IAAI,qDAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
|
|
5
|
+
export interface SwitchThumbProps extends PropsWithElement<'span'>, HTMLAttributes<'span'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
10
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
11
|
+
|
|
12
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
13
|
+
|
|
14
|
+
const props: SwitchThumbProps = $props();
|
|
15
|
+
|
|
16
|
+
const switch_ = SwitchRootContext.consume();
|
|
17
|
+
|
|
18
|
+
const { element, children, ...rest } = $derived(props);
|
|
19
|
+
|
|
20
|
+
const attributes = $derived(
|
|
21
|
+
mergeProps(switch_().getThumbProps(), rest, {
|
|
22
|
+
class: classesSwitch.thumb,
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#if element}
|
|
28
|
+
{@render element(attributes)}
|
|
29
|
+
{:else}
|
|
30
|
+
<span {...attributes}>
|
|
31
|
+
{@render children?.()}
|
|
32
|
+
</span>
|
|
33
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
export interface SwitchThumbProps extends PropsWithElement<'span'>, HTMLAttributes<'span'> {
|
|
4
|
+
}
|
|
5
|
+
declare const Thumb: import("svelte").Component<SwitchThumbProps, {}, "">;
|
|
6
|
+
type Thumb = ReturnType<typeof Thumb>;
|
|
7
|
+
export default Thumb;
|
|
8
|
+
//# sourceMappingURL=thumb.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thumb.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/anatomy/thumb.svelte.ts"],"names":[],"mappings":"AAGC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC;CAAG;AAuC9F,QAAA,MAAM,KAAK,sDAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { SwitchControlProps } from './anatomy/control.svelte';
|
|
2
|
+
export type { SwitchHiddenInputProps } from './anatomy/hidden-input.svelte';
|
|
3
|
+
export type { SwitchLabelProps } from './anatomy/label.svelte';
|
|
4
|
+
export type { SwitchRootProps } from './anatomy/root.svelte';
|
|
5
|
+
export type { SwitchRootContextProps } from './anatomy/root-context.svelte';
|
|
6
|
+
export type { SwitchRootProviderProps } from './anatomy/root-provider.svelte';
|
|
7
|
+
export type { SwitchThumbProps } from './anatomy/thumb.svelte';
|
|
8
|
+
export { Switch } from './modules/anatomy';
|
|
9
|
+
export { useSwitch } from './modules/use-switch.svelte';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/switch/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,YAAY,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,YAAY,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,YAAY,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const Switch: import("svelte").Component<import("../anatomy/root.svelte").SwitchRootProps, {}, ""> & {
|
|
2
|
+
Provider: import("svelte").Component<import("../anatomy/root-provider.svelte").SwitchRootProviderProps, {}, "">;
|
|
3
|
+
Context: import("svelte").Component<import("../anatomy/root-context.svelte").SwitchRootContextProps, {}, "">;
|
|
4
|
+
Control: import("svelte").Component<import("../anatomy/control.svelte").SwitchControlProps, {}, "">;
|
|
5
|
+
Thumb: import("svelte").Component<import("../anatomy/thumb.svelte").SwitchThumbProps, {}, "">;
|
|
6
|
+
Label: import("svelte").Component<import("../anatomy/label.svelte").SwitchLabelProps, {}, "">;
|
|
7
|
+
HiddenInput: import("svelte").Component<import("../anatomy/hidden-input.svelte").SwitchHiddenInputProps, {}, "">;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=anatomy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anatomy.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/modules/anatomy.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM;;;;;;;CAOjB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Control from '../anatomy/control.svelte';
|
|
2
|
+
import HiddenInput from '../anatomy/hidden-input.svelte';
|
|
3
|
+
import Label from '../anatomy/label.svelte';
|
|
4
|
+
import Root from '../anatomy/root.svelte';
|
|
5
|
+
import RootContext from '../anatomy/root-context.svelte';
|
|
6
|
+
import RootProvider from '../anatomy/root-provider.svelte';
|
|
7
|
+
import Thumb from '../anatomy/thumb.svelte';
|
|
8
|
+
export const Switch = Object.assign(Root, {
|
|
9
|
+
Provider: RootProvider,
|
|
10
|
+
Context: RootContext,
|
|
11
|
+
Control: Control,
|
|
12
|
+
Thumb: Thumb,
|
|
13
|
+
Label: Label,
|
|
14
|
+
HiddenInput: HiddenInput,
|
|
15
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-context.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/modules/root-context.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB;;;;CAAgD,CAAC"}
|
package/dist/components/{rating-group/modules/item-context.js → switch/modules/root-context.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createContext } from '../../../internal/create-context';
|
|
2
|
-
export const
|
|
2
|
+
export const SwitchRootContext = createContext();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-switch.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/modules/use-switch.svelte.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAoB,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAExE,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,MAAM,GAAG,CAIjE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { normalizeProps, useMachine } from '@zag-js/svelte';
|
|
2
|
+
import { connect, machine } from '@zag-js/switch';
|
|
3
|
+
export function useSwitch(props) {
|
|
4
|
+
const service = useMachine(machine, props);
|
|
5
|
+
const switch_ = $derived(connect(service, normalizeProps));
|
|
6
|
+
return () => switch_;
|
|
7
|
+
}
|