@skeletonlabs/skeleton-svelte 2.0.0-next.2 → 2.0.0-next.4
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 +34 -0
- package/dist/components/accordion/anatomy/content.svelte.d.ts +7 -0
- package/dist/components/accordion/anatomy/{accordion-heading.svelte → heading.svelte} +12 -13
- package/dist/components/accordion/anatomy/heading.svelte.d.ts +13 -0
- package/dist/components/accordion/anatomy/indicator.svelte +30 -0
- package/dist/components/accordion/anatomy/indicator.svelte.d.ts +7 -0
- package/dist/components/accordion/anatomy/item.svelte +38 -0
- package/dist/components/accordion/anatomy/item.svelte.d.ts +8 -0
- package/dist/components/accordion/anatomy/root-context.svelte +20 -0
- package/dist/components/accordion/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/accordion/anatomy/root-provider.svelte +31 -0
- package/dist/components/accordion/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/accordion/anatomy/root.svelte +42 -0
- package/dist/components/accordion/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/accordion/anatomy/trigger.svelte +34 -0
- package/dist/components/accordion/anatomy/trigger.svelte.d.ts +7 -0
- package/dist/components/accordion/index.d.ts +10 -11
- package/dist/components/accordion/index.js +2 -1
- package/dist/components/accordion/modules/anatomy.d.ts +9 -0
- package/dist/components/accordion/modules/anatomy.js +17 -0
- package/dist/components/accordion/modules/item-context.d.ts +6 -0
- package/dist/components/accordion/modules/item-context.js +2 -0
- package/dist/components/accordion/modules/root-context.js +2 -0
- package/dist/components/accordion/modules/use-accordion.svelte.js +7 -0
- package/dist/components/avatar/anatomy/fallback.svelte +32 -0
- package/dist/components/avatar/anatomy/fallback.svelte.d.ts +7 -0
- package/dist/components/avatar/anatomy/image.svelte +30 -0
- package/dist/components/avatar/anatomy/image.svelte.d.ts +7 -0
- package/dist/components/avatar/anatomy/root-context.svelte +20 -0
- package/dist/components/avatar/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/avatar/anatomy/root-provider.svelte +35 -0
- package/dist/components/avatar/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/avatar/anatomy/root.svelte +42 -0
- package/dist/components/avatar/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/avatar/index.d.ts +7 -6
- package/dist/components/avatar/index.js +2 -1
- package/dist/components/avatar/modules/anatomy.d.ts +6 -0
- package/dist/components/avatar/modules/anatomy.js +11 -0
- package/dist/components/avatar/modules/root-context.js +2 -0
- package/dist/components/avatar/modules/use-avatar.svelte.js +7 -0
- package/dist/components/progress-linear/anatomy/label.svelte +32 -0
- package/dist/components/progress-linear/anatomy/label.svelte.d.ts +7 -0
- package/dist/components/progress-linear/anatomy/range.svelte +32 -0
- package/dist/components/progress-linear/anatomy/range.svelte.d.ts +7 -0
- package/dist/components/progress-linear/anatomy/root-context.svelte +20 -0
- package/dist/components/progress-linear/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/progress-linear/anatomy/root-provider.svelte +35 -0
- package/dist/components/progress-linear/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/progress-linear/anatomy/root.svelte +42 -0
- package/dist/components/progress-linear/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/progress-linear/anatomy/track.svelte +32 -0
- package/dist/components/progress-linear/anatomy/track.svelte.d.ts +7 -0
- package/dist/components/progress-linear/index.d.ts +8 -0
- package/dist/components/progress-linear/index.js +2 -0
- package/dist/components/progress-linear/modules/anatomy.d.ts +6 -0
- package/dist/components/progress-linear/modules/anatomy.js +11 -0
- package/dist/components/{accordion/modules/accordion-item-context.js → progress-linear/modules/root-context.js} +1 -1
- package/dist/components/progress-linear/modules/use-progress-linear.svelte.js +7 -0
- package/dist/components/rating-group/anatomy/control.svelte +32 -0
- package/dist/components/rating-group/anatomy/control.svelte.d.ts +7 -0
- package/dist/components/rating-group/anatomy/hidden-input.svelte +30 -0
- package/dist/components/rating-group/anatomy/hidden-input.svelte.d.ts +7 -0
- package/dist/components/rating-group/anatomy/{rating-group-item.svelte → item.svelte} +15 -24
- package/dist/components/rating-group/anatomy/{rating-group-item.svelte.d.ts → item.svelte.d.ts} +6 -6
- package/dist/components/rating-group/anatomy/label.svelte +32 -0
- package/dist/components/rating-group/anatomy/label.svelte.d.ts +7 -0
- package/dist/components/rating-group/anatomy/root-context.svelte +20 -0
- package/dist/components/rating-group/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/rating-group/anatomy/root-provider.svelte +35 -0
- package/dist/components/rating-group/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/rating-group/anatomy/root.svelte +42 -0
- package/dist/components/rating-group/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/rating-group/index.d.ts +9 -10
- package/dist/components/rating-group/index.js +2 -1
- package/dist/components/rating-group/modules/anatomy.d.ts +8 -0
- package/dist/components/rating-group/modules/anatomy.js +15 -0
- package/dist/components/rating-group/modules/root-context.js +2 -0
- package/dist/components/rating-group/modules/use-rating-group.svelte.js +7 -0
- package/dist/components/switch/anatomy/control.svelte +32 -0
- package/dist/components/switch/anatomy/control.svelte.d.ts +7 -0
- package/dist/components/switch/anatomy/hidden-input.svelte +30 -0
- package/dist/components/switch/anatomy/hidden-input.svelte.d.ts +7 -0
- package/dist/components/switch/anatomy/label.svelte +32 -0
- package/dist/components/switch/anatomy/label.svelte.d.ts +7 -0
- package/dist/components/switch/anatomy/root-context.svelte +20 -0
- package/dist/components/switch/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/switch/anatomy/root-provider.svelte +35 -0
- package/dist/components/switch/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/switch/anatomy/root.svelte +42 -0
- package/dist/components/switch/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/switch/anatomy/thumb.svelte +32 -0
- package/dist/components/switch/anatomy/thumb.svelte.d.ts +7 -0
- package/dist/components/switch/index.d.ts +9 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/switch/modules/anatomy.d.ts +8 -0
- package/dist/components/switch/modules/anatomy.js +15 -0
- package/dist/components/switch/modules/root-context.js +2 -0
- package/dist/components/switch/modules/use-switch.svelte.js +7 -0
- package/dist/components/tabs/anatomy/{tabs-content.svelte → content.svelte} +13 -14
- package/dist/components/tabs/anatomy/content.svelte.d.ts +8 -0
- package/dist/components/tabs/anatomy/indicator.svelte +30 -0
- package/dist/components/tabs/anatomy/indicator.svelte.d.ts +7 -0
- package/dist/components/tabs/anatomy/list.svelte +32 -0
- package/dist/components/tabs/anatomy/list.svelte.d.ts +7 -0
- package/dist/components/tabs/anatomy/root-context.svelte +20 -0
- package/dist/components/tabs/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/tabs/anatomy/root-provider.svelte +34 -0
- package/dist/components/tabs/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/tabs/anatomy/root.svelte +41 -0
- package/dist/components/tabs/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/tabs/anatomy/{tabs-trigger.svelte → trigger.svelte} +13 -14
- package/dist/components/tabs/anatomy/trigger.svelte.d.ts +8 -0
- package/dist/components/tabs/index.d.ts +9 -1
- package/dist/components/tabs/index.js +2 -1
- package/dist/components/tabs/modules/anatomy.d.ts +8 -0
- package/dist/components/tabs/modules/anatomy.js +15 -0
- package/dist/components/tabs/modules/root-context.js +2 -0
- package/dist/components/tabs/modules/use-tabs.svelte.js +7 -0
- package/dist/components/toast/anatomy/action-trigger.svelte +32 -0
- package/dist/components/toast/anatomy/action-trigger.svelte.d.ts +7 -0
- package/dist/components/toast/anatomy/close-trigger.svelte +37 -0
- package/dist/components/toast/anatomy/close-trigger.svelte.d.ts +7 -0
- package/dist/components/toast/anatomy/description.svelte +32 -0
- package/dist/components/toast/anatomy/description.svelte.d.ts +7 -0
- package/dist/components/toast/anatomy/group.svelte +47 -0
- package/dist/components/toast/anatomy/group.svelte.d.ts +11 -0
- package/dist/components/toast/anatomy/message.svelte +29 -0
- package/dist/components/toast/anatomy/message.svelte.d.ts +7 -0
- package/dist/components/toast/anatomy/root-context.svelte +20 -0
- package/dist/components/toast/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/toast/anatomy/root.svelte +74 -0
- package/dist/components/toast/anatomy/root.svelte.d.ts +9 -0
- package/dist/components/toast/anatomy/title.svelte +32 -0
- package/dist/components/toast/anatomy/title.svelte.d.ts +7 -0
- package/dist/components/toast/index.d.ts +9 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toast/modules/anatomy.d.ts +9 -0
- package/dist/components/toast/modules/anatomy.js +17 -0
- package/dist/components/toast/modules/group-context.d.ts +6 -0
- package/dist/components/toast/modules/group-context.js +2 -0
- package/dist/components/toast/modules/root-context.d.ts +6 -0
- package/dist/components/toast/modules/root-context.js +2 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +7 -4
- package/dist/internal/components/x.svelte +14 -0
- package/dist/internal/components/x.svelte.d.ts +26 -0
- package/dist/internal/html-attributes.d.ts +2 -0
- package/dist/internal/html-attributes.js +1 -0
- package/dist/internal/props-with-element.d.ts +4 -4
- package/package.json +20 -20
- package/dist/components/accordion/anatomy/accordion-content.svelte +0 -35
- package/dist/components/accordion/anatomy/accordion-content.svelte.d.ts +0 -7
- package/dist/components/accordion/anatomy/accordion-heading.svelte.d.ts +0 -13
- package/dist/components/accordion/anatomy/accordion-indicator.svelte +0 -35
- package/dist/components/accordion/anatomy/accordion-indicator.svelte.d.ts +0 -7
- package/dist/components/accordion/anatomy/accordion-item-context.svelte +0 -17
- package/dist/components/accordion/anatomy/accordion-item-context.svelte.d.ts +0 -9
- package/dist/components/accordion/anatomy/accordion-item.svelte +0 -45
- package/dist/components/accordion/anatomy/accordion-item.svelte.d.ts +0 -8
- package/dist/components/accordion/anatomy/accordion-root-context.svelte +0 -17
- package/dist/components/accordion/anatomy/accordion-root-context.svelte.d.ts +0 -9
- package/dist/components/accordion/anatomy/accordion-root.svelte +0 -49
- package/dist/components/accordion/anatomy/accordion-root.svelte.d.ts +0 -8
- package/dist/components/accordion/anatomy/accordion-trigger.svelte +0 -35
- package/dist/components/accordion/anatomy/accordion-trigger.svelte.d.ts +0 -7
- package/dist/components/accordion/modules/accordion-anatomy.d.ts +0 -9
- package/dist/components/accordion/modules/accordion-anatomy.js +0 -17
- package/dist/components/accordion/modules/accordion-item-context.d.ts +0 -10
- package/dist/components/accordion/modules/accordion-root-context.d.ts +0 -9
- package/dist/components/accordion/modules/accordion-root-context.js +0 -2
- package/dist/components/avatar/anatomy/avatar-fallback.svelte +0 -33
- package/dist/components/avatar/anatomy/avatar-fallback.svelte.d.ts +0 -7
- package/dist/components/avatar/anatomy/avatar-image.svelte +0 -31
- package/dist/components/avatar/anatomy/avatar-image.svelte.d.ts +0 -7
- package/dist/components/avatar/anatomy/avatar-root-context.svelte +0 -17
- package/dist/components/avatar/anatomy/avatar-root-context.svelte.d.ts +0 -9
- package/dist/components/avatar/anatomy/avatar-root.svelte +0 -46
- package/dist/components/avatar/anatomy/avatar-root.svelte.d.ts +0 -8
- package/dist/components/avatar/modules/avatar-anatomy.d.ts +0 -5
- package/dist/components/avatar/modules/avatar-anatomy.js +0 -9
- package/dist/components/avatar/modules/avatar-root-context.d.ts +0 -9
- package/dist/components/avatar/modules/avatar-root-context.js +0 -2
- package/dist/components/rating-group/anatomy/rating-group-control.svelte +0 -31
- package/dist/components/rating-group/anatomy/rating-group-control.svelte.d.ts +0 -7
- package/dist/components/rating-group/anatomy/rating-group-hidden-input.svelte +0 -33
- package/dist/components/rating-group/anatomy/rating-group-hidden-input.svelte.d.ts +0 -7
- package/dist/components/rating-group/anatomy/rating-group-item-context.svelte +0 -17
- package/dist/components/rating-group/anatomy/rating-group-item-context.svelte.d.ts +0 -9
- package/dist/components/rating-group/anatomy/rating-group-label.svelte +0 -31
- package/dist/components/rating-group/anatomy/rating-group-label.svelte.d.ts +0 -7
- package/dist/components/rating-group/anatomy/rating-group-root-context.svelte +0 -17
- package/dist/components/rating-group/anatomy/rating-group-root-context.svelte.d.ts +0 -9
- package/dist/components/rating-group/anatomy/rating-group-root.svelte +0 -52
- package/dist/components/rating-group/anatomy/rating-group-root.svelte.d.ts +0 -8
- package/dist/components/rating-group/modules/rating-group-anatomy.d.ts +0 -8
- package/dist/components/rating-group/modules/rating-group-anatomy.js +0 -15
- package/dist/components/rating-group/modules/rating-group-item-context.d.ts +0 -9
- package/dist/components/rating-group/modules/rating-group-item-context.js +0 -2
- package/dist/components/rating-group/modules/rating-group-root-context.d.ts +0 -9
- package/dist/components/rating-group/modules/rating-group-root-context.js +0 -2
- package/dist/components/tabs/anatomy/tabs-content.svelte.d.ts +0 -8
- package/dist/components/tabs/anatomy/tabs-indicator.svelte +0 -31
- package/dist/components/tabs/anatomy/tabs-indicator.svelte.d.ts +0 -7
- package/dist/components/tabs/anatomy/tabs-list.svelte +0 -33
- package/dist/components/tabs/anatomy/tabs-list.svelte.d.ts +0 -7
- package/dist/components/tabs/anatomy/tabs-root-context.svelte +0 -17
- package/dist/components/tabs/anatomy/tabs-root-context.svelte.d.ts +0 -9
- package/dist/components/tabs/anatomy/tabs-root.svelte +0 -49
- package/dist/components/tabs/anatomy/tabs-root.svelte.d.ts +0 -8
- package/dist/components/tabs/anatomy/tabs-trigger.svelte.d.ts +0 -8
- package/dist/components/tabs/modules/tabs-anatomy.d.ts +0 -7
- package/dist/components/tabs/modules/tabs-anatomy.js +0 -13
- package/dist/components/tabs/modules/tabs-root-context.d.ts +0 -9
- package/dist/components/tabs/modules/tabs-root-context.js +0 -2
- package/dist/internal/test-utils.d.ts +0 -3
- package/dist/internal/test-utils.js +0 -9
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { useRatingGroup } from '../modules/use-rating-group.svelte';
|
|
4
|
+
|
|
5
|
+
export interface RatingGroupRootContextProps {
|
|
6
|
+
children: Snippet<[ReturnType<typeof useRatingGroup>]>;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { RatingGroupRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: RatingGroupRootContextProps = $props();
|
|
14
|
+
|
|
15
|
+
const ratingGroup = RatingGroupRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { children } = $derived(props);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
{@render children(ratingGroup)}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { useRatingGroup } from '../modules/use-rating-group.svelte';
|
|
3
|
+
export interface RatingGroupRootContextProps {
|
|
4
|
+
children: Snippet<[ReturnType<typeof useRatingGroup>]>;
|
|
5
|
+
}
|
|
6
|
+
declare const RootContext: import("svelte").Component<RatingGroupRootContextProps, {}, "">;
|
|
7
|
+
type RootContext = ReturnType<typeof RootContext>;
|
|
8
|
+
export default RootContext;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
import type { useRatingGroup } from '../modules/use-rating-group.svelte';
|
|
5
|
+
|
|
6
|
+
export interface RatingGroupRootProviderProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
7
|
+
value: ReturnType<typeof useRatingGroup>;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
13
|
+
import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
|
|
14
|
+
import { RatingGroupRootContext } from '../modules/root-context';
|
|
15
|
+
|
|
16
|
+
const props: RatingGroupRootProviderProps = $props();
|
|
17
|
+
|
|
18
|
+
const { element, children, value: ratingGroup, ...rest } = $derived(props);
|
|
19
|
+
|
|
20
|
+
const attributes = $derived(
|
|
21
|
+
mergeProps(ratingGroup().getRootProps(), rest, {
|
|
22
|
+
class: classesRatingGroup.root
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
RatingGroupRootContext.provide(() => ratingGroup());
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#if element}
|
|
30
|
+
{@render element(attributes)}
|
|
31
|
+
{:else}
|
|
32
|
+
<div {...attributes}>
|
|
33
|
+
{@render children?.()}
|
|
34
|
+
</div>
|
|
35
|
+
{/if}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { useRatingGroup } from '../modules/use-rating-group.svelte';
|
|
4
|
+
export interface RatingGroupRootProviderProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
5
|
+
value: ReturnType<typeof useRatingGroup>;
|
|
6
|
+
}
|
|
7
|
+
declare const RootProvider: import("svelte").Component<RatingGroupRootProviderProps, {}, "">;
|
|
8
|
+
type RootProvider = ReturnType<typeof RootProvider>;
|
|
9
|
+
export default RootProvider;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Props } from '@zag-js/rating-group';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
5
|
+
|
|
6
|
+
export interface RatingGroupRootProps extends Omit<Props, 'id'>, PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {}
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
11
|
+
import { splitProps } from '@zag-js/rating-group';
|
|
12
|
+
import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
|
|
13
|
+
import { RatingGroupRootContext } from '../modules/root-context';
|
|
14
|
+
import { useRatingGroup } from '../modules/use-rating-group.svelte';
|
|
15
|
+
|
|
16
|
+
const props: RatingGroupRootProps = $props();
|
|
17
|
+
|
|
18
|
+
const [ratingGroupProps, componentProps] = $derived(splitProps(props));
|
|
19
|
+
const { element, children, ...rest } = $derived(componentProps);
|
|
20
|
+
|
|
21
|
+
const id = $props.id();
|
|
22
|
+
const ratingGroup = useRatingGroup(() => ({
|
|
23
|
+
id: id,
|
|
24
|
+
...ratingGroupProps
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
const attributes = $derived(
|
|
28
|
+
mergeProps(ratingGroup().getRootProps(), rest, {
|
|
29
|
+
class: classesRatingGroup.root
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
RatingGroupRootContext.provide(() => ratingGroup());
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
{#if element}
|
|
37
|
+
{@render element(attributes)}
|
|
38
|
+
{:else}
|
|
39
|
+
<div {...attributes}>
|
|
40
|
+
{@render children?.()}
|
|
41
|
+
</div>
|
|
42
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Props } from '@zag-js/rating-group';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
export interface RatingGroupRootProps extends Omit<Props, 'id'>, PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
5
|
+
}
|
|
6
|
+
declare const Root: import("svelte").Component<RatingGroupRootProps, {}, "">;
|
|
7
|
+
type Root = ReturnType<typeof Root>;
|
|
8
|
+
export default Root;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
export { RatingGroup } from './modules/
|
|
2
|
-
export
|
|
3
|
-
export type {
|
|
4
|
-
export type {
|
|
5
|
-
export type {
|
|
6
|
-
export type {
|
|
7
|
-
export type {
|
|
8
|
-
export type {
|
|
9
|
-
export type {
|
|
10
|
-
export type { RatingGroupItemContextType as RatingGroupItemContext } from './modules/rating-group-item-context.js';
|
|
1
|
+
export { RatingGroup } from './modules/anatomy';
|
|
2
|
+
export { useRatingGroup } from './modules/use-rating-group.svelte';
|
|
3
|
+
export type { RatingGroupRootProps } from './anatomy/root.svelte';
|
|
4
|
+
export type { RatingGroupRootProviderProps } from './anatomy/root-provider.svelte';
|
|
5
|
+
export type { RatingGroupRootContextProps } from './anatomy/root-context.svelte';
|
|
6
|
+
export type { RatingGroupLabelProps } from './anatomy/label.svelte';
|
|
7
|
+
export type { RatingGroupControlProps } from './anatomy/control.svelte';
|
|
8
|
+
export type { RatingGroupItemProps } from './anatomy/item.svelte';
|
|
9
|
+
export type { RatingGroupHiddenInputProps } from './anatomy/hidden-input.svelte';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { RatingGroup } from './modules/
|
|
1
|
+
export { RatingGroup } from './modules/anatomy';
|
|
2
|
+
export { useRatingGroup } from './modules/use-rating-group.svelte';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const RatingGroup: import("svelte").Component<import("../anatomy/root.svelte").RatingGroupRootProps, {}, ""> & {
|
|
2
|
+
Provider: import("svelte").Component<import("../anatomy/root-provider.svelte").RatingGroupRootProviderProps, {}, "">;
|
|
3
|
+
Context: import("svelte").Component<import("../anatomy/root-context.svelte").RatingGroupRootContextProps, {}, "">;
|
|
4
|
+
Label: import("svelte").Component<import("../anatomy/label.svelte").RatingGroupLabelProps, {}, "">;
|
|
5
|
+
Control: import("svelte").Component<import("../anatomy/control.svelte").RatingGroupControlProps, {}, "">;
|
|
6
|
+
Item: import("svelte").Component<import("../anatomy/item.svelte").RatingGroupItemProps, {}, "">;
|
|
7
|
+
HiddenInput: import("svelte").Component<import("../anatomy/hidden-input.svelte").RatingGroupHiddenInputProps, {}, "">;
|
|
8
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Root from '../anatomy/root.svelte';
|
|
2
|
+
import RootProvider from '../anatomy/root-provider.svelte';
|
|
3
|
+
import RootContext from '../anatomy/root-context.svelte';
|
|
4
|
+
import Label from '../anatomy/label.svelte';
|
|
5
|
+
import Control from '../anatomy/control.svelte';
|
|
6
|
+
import Item from '../anatomy/item.svelte';
|
|
7
|
+
import HiddenInput from '../anatomy/hidden-input.svelte';
|
|
8
|
+
export const RatingGroup = Object.assign(Root, {
|
|
9
|
+
Provider: RootProvider,
|
|
10
|
+
Context: RootContext,
|
|
11
|
+
Label: Label,
|
|
12
|
+
Control: Control,
|
|
13
|
+
Item: Item,
|
|
14
|
+
HiddenInput: HiddenInput
|
|
15
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { connect, machine } from '@zag-js/rating-group';
|
|
2
|
+
import { useMachine, normalizeProps } 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,32 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
|
|
5
|
+
export interface SwitchControlProps extends PropsWithElement<'span'>, HTMLAttributes<'span'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: SwitchControlProps = $props();
|
|
14
|
+
|
|
15
|
+
const switch_ = SwitchRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, children, ...rest } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(switch_().getControlProps(), rest, {
|
|
21
|
+
class: classesSwitch.control
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#if element}
|
|
27
|
+
{@render element(attributes)}
|
|
28
|
+
{:else}
|
|
29
|
+
<span {...attributes}>
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
</span>
|
|
32
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
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;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
|
|
5
|
+
export interface SwitchHiddenInputProps extends PropsWithElement<'input'>, HTMLAttributes<'input', 'children'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: SwitchHiddenInputProps = $props();
|
|
14
|
+
|
|
15
|
+
const switch_ = SwitchRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, ...rest } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(switch_().getHiddenInputProps(), rest, {
|
|
21
|
+
class: classesSwitch.hiddenInput
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#if element}
|
|
27
|
+
{@render element(attributes)}
|
|
28
|
+
{:else}
|
|
29
|
+
<input {...attributes} />
|
|
30
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
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;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
|
|
5
|
+
export interface SwitchLabelProps extends PropsWithElement<'span'>, HTMLAttributes<'span'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: SwitchLabelProps = $props();
|
|
14
|
+
|
|
15
|
+
const switch_ = SwitchRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, children, ...rest } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(switch_().getLabelProps(), rest, {
|
|
21
|
+
class: classesSwitch.label
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#if element}
|
|
27
|
+
{@render element(attributes)}
|
|
28
|
+
{:else}
|
|
29
|
+
<span {...attributes}>
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
</span>
|
|
32
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
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;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { useSwitch } from '../modules/use-switch.svelte';
|
|
4
|
+
|
|
5
|
+
export interface SwitchRootContextProps {
|
|
6
|
+
children: Snippet<[ReturnType<typeof useSwitch>]>;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: SwitchRootContextProps = $props();
|
|
14
|
+
|
|
15
|
+
const switch_ = SwitchRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { children } = $derived(props);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
{@render children(switch_)}
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
import type { useSwitch } from '../modules/use-switch.svelte';
|
|
5
|
+
|
|
6
|
+
export interface SwitchRootProviderProps extends PropsWithElement<'label'>, HTMLAttributes<'label', 'id' | 'dir' | 'form'> {
|
|
7
|
+
value: ReturnType<typeof useSwitch>;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
13
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
14
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
15
|
+
|
|
16
|
+
const props: SwitchRootProviderProps = $props();
|
|
17
|
+
|
|
18
|
+
const { element, children, value: switch_, ...rest } = $derived(props);
|
|
19
|
+
|
|
20
|
+
const attributes = $derived(
|
|
21
|
+
mergeProps(switch_().getRootProps(), rest, {
|
|
22
|
+
class: classesSwitch.root
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
SwitchRootContext.provide(() => switch_());
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#if element}
|
|
30
|
+
{@render element(attributes)}
|
|
31
|
+
{:else}
|
|
32
|
+
<label {...attributes}>
|
|
33
|
+
{@render children?.()}
|
|
34
|
+
</label>
|
|
35
|
+
{/if}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
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;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Props } from '@zag-js/switch';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
5
|
+
|
|
6
|
+
export interface SwitchRootProps extends Omit<Props, 'id'>, PropsWithElement<'label'>, HTMLAttributes<'label', 'id' | 'dir' | 'form'> {}
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
11
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
12
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
13
|
+
import { splitProps } from '@zag-js/switch';
|
|
14
|
+
import { useSwitch } from '../modules/use-switch.svelte';
|
|
15
|
+
|
|
16
|
+
const props: SwitchRootProps = $props();
|
|
17
|
+
|
|
18
|
+
const [switchProps, componentProps] = $derived(splitProps(props));
|
|
19
|
+
const { element, children, ...rest } = $derived(componentProps);
|
|
20
|
+
|
|
21
|
+
const id = $props.id();
|
|
22
|
+
const switch_ = useSwitch(() => ({
|
|
23
|
+
id: id,
|
|
24
|
+
...switchProps
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
const attributes = $derived(
|
|
28
|
+
mergeProps(switch_().getRootProps(), rest, {
|
|
29
|
+
class: classesSwitch.root
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
SwitchRootContext.provide(() => switch_());
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
{#if element}
|
|
37
|
+
{@render element(attributes)}
|
|
38
|
+
{:else}
|
|
39
|
+
<label {...attributes}>
|
|
40
|
+
{@render children?.()}
|
|
41
|
+
</label>
|
|
42
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Props } from '@zag-js/switch';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
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;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
|
|
5
|
+
export interface SwitchThumbProps extends PropsWithElement<'span'>, HTMLAttributes<'span'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesSwitch } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { SwitchRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: SwitchThumbProps = $props();
|
|
14
|
+
|
|
15
|
+
const switch_ = SwitchRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, children, ...rest } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(switch_().getThumbProps(), rest, {
|
|
21
|
+
class: classesSwitch.thumb
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#if element}
|
|
27
|
+
{@render element(attributes)}
|
|
28
|
+
{:else}
|
|
29
|
+
<span {...attributes}>
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
</span>
|
|
32
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Switch } from './modules/anatomy';
|
|
2
|
+
export { useSwitch } from './modules/use-switch.svelte';
|
|
3
|
+
export type { SwitchRootProps } from './anatomy/root.svelte';
|
|
4
|
+
export type { SwitchRootProviderProps } from './anatomy/root-provider.svelte';
|
|
5
|
+
export type { SwitchRootContextProps } from './anatomy/root-context.svelte';
|
|
6
|
+
export type { SwitchHiddenInputProps } from './anatomy/hidden-input.svelte';
|
|
7
|
+
export type { SwitchControlProps } from './anatomy/control.svelte';
|
|
8
|
+
export type { SwitchThumbProps } from './anatomy/thumb.svelte';
|
|
9
|
+
export type { SwitchLabelProps } from './anatomy/label.svelte';
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Root from '../anatomy/root.svelte';
|
|
2
|
+
import RootProvider from '../anatomy/root-provider.svelte';
|
|
3
|
+
import RootContext from '../anatomy/root-context.svelte';
|
|
4
|
+
import Control from '../anatomy/control.svelte';
|
|
5
|
+
import Thumb from '../anatomy/thumb.svelte';
|
|
6
|
+
import Label from '../anatomy/label.svelte';
|
|
7
|
+
import HiddenInput from '../anatomy/hidden-input.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,7 @@
|
|
|
1
|
+
import { connect, machine } from '@zag-js/switch';
|
|
2
|
+
import { useMachine, normalizeProps } from '@zag-js/svelte';
|
|
3
|
+
export function useSwitch(props) {
|
|
4
|
+
const service = useMachine(machine, props);
|
|
5
|
+
const switch_ = $derived(connect(service, normalizeProps));
|
|
6
|
+
return () => switch_;
|
|
7
|
+
}
|
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { ContentProps } from '@zag-js/tabs';
|
|
3
|
-
import type { HTMLAttributes } from '
|
|
4
|
-
import type { PropsWithElement } from '../../../internal/props-with-element
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
5
5
|
|
|
6
|
-
export interface TabsContentProps extends ContentProps, PropsWithElement
|
|
6
|
+
export interface TabsContentProps extends ContentProps, PropsWithElement<'div'>, HTMLAttributes<'div'> {}
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<script lang="ts">
|
|
10
|
-
import { TabsRootContext } from '../modules/
|
|
10
|
+
import { TabsRootContext } from '../modules/root-context';
|
|
11
11
|
import { mergeProps } from '@zag-js/svelte';
|
|
12
12
|
import { classesTabs } from '@skeletonlabs/skeleton-common';
|
|
13
13
|
import { splitContentProps } from '@zag-js/tabs';
|
|
14
14
|
|
|
15
15
|
const props: TabsContentProps = $props();
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
const tabs = TabsRootContext.consume();
|
|
18
|
+
|
|
17
19
|
const [contentProps, componentProps] = $derived(splitContentProps(props));
|
|
18
|
-
const { element, children, ...
|
|
20
|
+
const { element, children, ...rest } = $derived(componentProps);
|
|
21
|
+
|
|
19
22
|
const attributes = $derived(
|
|
20
|
-
mergeProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class: classesTabs.content
|
|
24
|
-
},
|
|
25
|
-
restAttributes
|
|
26
|
-
)
|
|
23
|
+
mergeProps(tabs().getContentProps(contentProps), rest, {
|
|
24
|
+
class: classesTabs.content
|
|
25
|
+
})
|
|
27
26
|
);
|
|
28
27
|
</script>
|
|
29
28
|
|
|
30
29
|
{#if element}
|
|
31
|
-
{@render element(
|
|
30
|
+
{@render element(attributes)}
|
|
32
31
|
{:else}
|
|
33
32
|
<div {...attributes}>
|
|
34
33
|
{@render children?.()}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ContentProps } from '@zag-js/tabs';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
export interface TabsContentProps extends ContentProps, PropsWithElement<'div'>, HTMLAttributes<'div'> {
|
|
5
|
+
}
|
|
6
|
+
declare const Content: import("svelte").Component<TabsContentProps, {}, "">;
|
|
7
|
+
type Content = ReturnType<typeof Content>;
|
|
8
|
+
export default Content;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 TabsIndicatorProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'children'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { TabsRootContext } from '../modules/root-context';
|
|
10
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
11
|
+
import { classesTabs } from '@skeletonlabs/skeleton-common';
|
|
12
|
+
|
|
13
|
+
const props: TabsIndicatorProps = $props();
|
|
14
|
+
|
|
15
|
+
const tabs = TabsRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, ...rest } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(tabs().getIndicatorProps(), rest, {
|
|
21
|
+
class: classesTabs.indicator
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#if element}
|
|
27
|
+
{@render element(attributes)}
|
|
28
|
+
{:else}
|
|
29
|
+
<div {...attributes}></div>
|
|
30
|
+
{/if}
|