@skeletonlabs/skeleton-svelte 2.0.0-next.3 → 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 +9 -7
- package/dist/components/accordion/anatomy/content.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/heading.svelte +9 -5
- package/dist/components/accordion/anatomy/heading.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/indicator.svelte +7 -9
- package/dist/components/accordion/anatomy/indicator.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/item.svelte +13 -16
- package/dist/components/accordion/anatomy/item.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/root-context.svelte +6 -4
- package/dist/components/accordion/anatomy/root-context.svelte.d.ts +2 -2
- 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 +17 -19
- package/dist/components/accordion/anatomy/root.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/trigger.svelte +9 -7
- package/dist/components/accordion/anatomy/trigger.svelte.d.ts +2 -2
- package/dist/components/accordion/index.d.ts +2 -3
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/accordion/modules/anatomy.d.ts +1 -1
- package/dist/components/accordion/modules/anatomy.js +2 -2
- package/dist/components/accordion/modules/item-context.d.ts +3 -7
- package/dist/components/accordion/modules/use-accordion.svelte.js +7 -0
- package/dist/components/avatar/anatomy/fallback.svelte +10 -6
- package/dist/components/avatar/anatomy/fallback.svelte.d.ts +2 -2
- package/dist/components/avatar/anatomy/image.svelte +10 -6
- package/dist/components/avatar/anatomy/image.svelte.d.ts +2 -2
- package/dist/components/avatar/anatomy/root-context.svelte +6 -4
- package/dist/components/avatar/anatomy/root-context.svelte.d.ts +2 -2
- 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 +17 -16
- package/dist/components/avatar/anatomy/root.svelte.d.ts +2 -2
- package/dist/components/avatar/index.d.ts +2 -1
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/avatar/modules/anatomy.d.ts +1 -0
- package/dist/components/avatar/modules/anatomy.js +2 -0
- package/dist/components/avatar/modules/use-avatar.svelte.js +7 -0
- package/dist/components/progress-linear/anatomy/label.svelte +8 -12
- package/dist/components/progress-linear/anatomy/label.svelte.d.ts +2 -2
- package/dist/components/progress-linear/anatomy/range.svelte +8 -12
- package/dist/components/progress-linear/anatomy/range.svelte.d.ts +2 -2
- package/dist/components/progress-linear/anatomy/root-context.svelte +6 -4
- package/dist/components/progress-linear/anatomy/root-context.svelte.d.ts +2 -2
- 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 +14 -25
- package/dist/components/progress-linear/anatomy/root.svelte.d.ts +2 -2
- package/dist/components/progress-linear/anatomy/track.svelte +10 -6
- package/dist/components/progress-linear/anatomy/track.svelte.d.ts +2 -2
- package/dist/components/progress-linear/index.d.ts +2 -1
- package/dist/components/progress-linear/index.js +1 -0
- package/dist/components/progress-linear/modules/use-progress-linear.svelte.js +7 -0
- package/dist/components/rating-group/anatomy/control.svelte +13 -7
- package/dist/components/rating-group/anatomy/control.svelte.d.ts +2 -2
- package/dist/components/rating-group/anatomy/hidden-input.svelte +10 -8
- package/dist/components/rating-group/anatomy/hidden-input.svelte.d.ts +2 -2
- package/dist/components/rating-group/anatomy/item.svelte +11 -17
- package/dist/components/rating-group/anatomy/item.svelte.d.ts +2 -2
- package/dist/components/rating-group/anatomy/label.svelte +13 -7
- package/dist/components/rating-group/anatomy/label.svelte.d.ts +2 -2
- package/dist/components/rating-group/anatomy/root-context.svelte +6 -4
- package/dist/components/rating-group/anatomy/root-context.svelte.d.ts +2 -2
- 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 +18 -23
- package/dist/components/rating-group/anatomy/root.svelte.d.ts +3 -3
- package/dist/components/rating-group/index.d.ts +2 -3
- package/dist/components/rating-group/index.js +1 -0
- package/dist/components/rating-group/modules/anatomy.d.ts +1 -1
- package/dist/components/rating-group/modules/anatomy.js +2 -2
- 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/{rating-group/modules/item-context.js → switch/modules/root-context.js} +1 -1
- package/dist/components/switch/modules/use-switch.svelte.js +7 -0
- package/dist/components/tabs/anatomy/content.svelte +10 -6
- package/dist/components/tabs/anatomy/content.svelte.d.ts +2 -2
- package/dist/components/tabs/anatomy/indicator.svelte +10 -6
- package/dist/components/tabs/anatomy/indicator.svelte.d.ts +2 -2
- package/dist/components/tabs/anatomy/list.svelte +10 -6
- package/dist/components/tabs/anatomy/list.svelte.d.ts +2 -2
- package/dist/components/tabs/anatomy/root-context.svelte +6 -4
- package/dist/components/tabs/anatomy/root-context.svelte.d.ts +2 -2
- 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 +16 -19
- package/dist/components/tabs/anatomy/root.svelte.d.ts +2 -2
- package/dist/components/tabs/anatomy/trigger.svelte +10 -6
- package/dist/components/tabs/anatomy/trigger.svelte.d.ts +2 -2
- 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 +1 -0
- package/dist/components/tabs/modules/anatomy.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 +2 -0
- package/dist/index.js +2 -0
- 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 +19 -19
- 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/accordion/modules/root-context.d.ts +0 -9
- package/dist/components/avatar/modules/root-context.d.ts +0 -9
- package/dist/components/progress-linear/modules/root-context.d.ts +0 -9
- 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/components/rating-group/modules/root-context.d.ts +0 -9
- package/dist/components/tabs/modules/root-context.d.ts +0 -9
- package/dist/internal/test-utils.d.ts +0 -3
- package/dist/internal/test-utils.js +0 -9
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { useAvatar } from '../modules/use-avatar.svelte';
|
|
4
|
+
export interface AvatarRootProviderProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
5
|
+
value: ReturnType<typeof useAvatar>;
|
|
6
|
+
}
|
|
7
|
+
declare const RootProvider: import("svelte").Component<AvatarRootProviderProps, {}, "">;
|
|
8
|
+
type RootProvider = ReturnType<typeof RootProvider>;
|
|
9
|
+
export default RootProvider;
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
3
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
4
|
import type { Props } from '@zag-js/avatar';
|
|
5
5
|
|
|
6
|
-
export interface AvatarRootProps extends
|
|
6
|
+
export interface AvatarRootProps extends Omit<Props, 'id'>, PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {}
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<script lang="ts">
|
|
10
|
-
import {
|
|
10
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
11
11
|
import { classesAvatar } from '@skeletonlabs/skeleton-common';
|
|
12
12
|
import { AvatarRootContext } from '../modules/root-context';
|
|
13
|
-
import {
|
|
13
|
+
import { splitProps } from '@zag-js/avatar';
|
|
14
|
+
import { useAvatar } from '../modules/use-avatar.svelte';
|
|
14
15
|
|
|
15
16
|
const props: AvatarRootProps = $props();
|
|
16
|
-
|
|
17
|
-
const
|
|
17
|
+
|
|
18
|
+
const [avatarProps, componentProps] = $derived(splitProps(props));
|
|
19
|
+
const { element, children, ...rest } = $derived(componentProps);
|
|
18
20
|
|
|
19
21
|
const id = $props.id();
|
|
20
|
-
const
|
|
22
|
+
const avatar = useAvatar(() => ({
|
|
21
23
|
id: id,
|
|
22
|
-
...
|
|
24
|
+
...avatarProps
|
|
23
25
|
}));
|
|
24
|
-
const api = $derived(connect(service, normalizeProps));
|
|
25
26
|
|
|
26
|
-
const attributes = $derived(
|
|
27
|
+
const attributes = $derived(
|
|
28
|
+
mergeProps(avatar().getRootProps(), rest, {
|
|
29
|
+
class: classesAvatar.root
|
|
30
|
+
})
|
|
31
|
+
);
|
|
27
32
|
|
|
28
|
-
AvatarRootContext.provide(
|
|
29
|
-
get api() {
|
|
30
|
-
return api;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
+
AvatarRootContext.provide(() => avatar());
|
|
33
34
|
</script>
|
|
34
35
|
|
|
35
36
|
{#if element}
|
|
36
|
-
{@render element(
|
|
37
|
+
{@render element(attributes)}
|
|
37
38
|
{:else}
|
|
38
39
|
<div {...attributes}>
|
|
39
40
|
{@render children?.()}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { HTMLAttributes } from '
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
2
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
3
|
import type { Props } from '@zag-js/avatar';
|
|
4
|
-
export interface AvatarRootProps extends
|
|
4
|
+
export interface AvatarRootProps extends Omit<Props, 'id'>, PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
5
5
|
}
|
|
6
6
|
declare const Root: import("svelte").Component<AvatarRootProps, {}, "">;
|
|
7
7
|
type Root = ReturnType<typeof Root>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Avatar } from './modules/anatomy';
|
|
2
|
+
export { useAvatar } from './modules/use-avatar.svelte';
|
|
2
3
|
export type { AvatarRootProps } from './anatomy/root.svelte';
|
|
4
|
+
export type { AvatarRootProviderProps } from './anatomy/root-provider.svelte';
|
|
3
5
|
export type { AvatarRootContextProps } from './anatomy/root-context.svelte';
|
|
4
6
|
export type { AvatarImageProps } from './anatomy/image.svelte';
|
|
5
7
|
export type { AvatarFallbackProps } from './anatomy/fallback.svelte';
|
|
6
|
-
export type { AvatarRootContextType as AvatarRootContext } from './modules/root-context';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const Avatar: import("svelte").Component<import("../anatomy/root.svelte").AvatarRootProps, {}, ""> & {
|
|
2
|
+
Provider: import("svelte").Component<import("../anatomy/root-provider.svelte").AvatarRootProviderProps, {}, "">;
|
|
2
3
|
Context: import("svelte").Component<import("../anatomy/root-context.svelte").AvatarRootContextProps, {}, "">;
|
|
3
4
|
Image: import("svelte").Component<import("../anatomy/image.svelte").AvatarImageProps, {}, "">;
|
|
4
5
|
Fallback: import("svelte").Component<import("../anatomy/fallback.svelte").AvatarFallbackProps, {}, "">;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import Root from '../anatomy/root.svelte';
|
|
2
|
+
import RootProvider from '../anatomy/root-provider.svelte';
|
|
2
3
|
import RootContext from '../anatomy/root-context.svelte';
|
|
3
4
|
import Image from '../anatomy/image.svelte';
|
|
4
5
|
import Fallback from '../anatomy/fallback.svelte';
|
|
5
6
|
export const Avatar = Object.assign(Root, {
|
|
7
|
+
Provider: RootProvider,
|
|
6
8
|
Context: RootContext,
|
|
7
9
|
Image: Image,
|
|
8
10
|
Fallback: Fallback
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { connect, machine } from '@zag-js/avatar';
|
|
2
|
+
import { useMachine, normalizeProps } from '@zag-js/svelte';
|
|
3
|
+
export function useAvatar(props) {
|
|
4
|
+
const service = useMachine(machine, props);
|
|
5
|
+
const avatar = $derived(connect(service, normalizeProps));
|
|
6
|
+
return () => avatar;
|
|
7
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
-
import type { HTMLAttributes } from '
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
4
|
|
|
5
|
-
export interface ProgressLinearLabelProps extends PropsWithElement
|
|
5
|
+
export interface ProgressLinearLabelProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
@@ -12,23 +12,19 @@
|
|
|
12
12
|
|
|
13
13
|
const props: ProgressLinearLabelProps = $props();
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const progressLinear = ProgressLinearRootContext.consume();
|
|
16
16
|
|
|
17
|
-
const { element, children, ...
|
|
17
|
+
const { element, children, ...rest } = $derived(props);
|
|
18
18
|
|
|
19
19
|
const attributes = $derived(
|
|
20
|
-
mergeProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class: classesProgressLinear.label
|
|
24
|
-
},
|
|
25
|
-
restAttributes
|
|
26
|
-
)
|
|
20
|
+
mergeProps(progressLinear().getLabelProps(), rest, {
|
|
21
|
+
class: classesProgressLinear.label
|
|
22
|
+
})
|
|
27
23
|
);
|
|
28
24
|
</script>
|
|
29
25
|
|
|
30
26
|
{#if element}
|
|
31
|
-
{@render element(
|
|
27
|
+
{@render element(attributes)}
|
|
32
28
|
{:else}
|
|
33
29
|
<div {...attributes}>
|
|
34
30
|
{@render children?.()}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
3
|
-
export interface ProgressLinearLabelProps extends PropsWithElement
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
export interface ProgressLinearLabelProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {
|
|
4
4
|
}
|
|
5
5
|
declare const Label: import("svelte").Component<ProgressLinearLabelProps, {}, "">;
|
|
6
6
|
type Label = ReturnType<typeof Label>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
-
import type { HTMLAttributes } from '
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
4
|
|
|
5
|
-
export interface ProgressLinearRangeProps extends PropsWithElement
|
|
5
|
+
export interface ProgressLinearRangeProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
@@ -12,23 +12,19 @@
|
|
|
12
12
|
|
|
13
13
|
const props: ProgressLinearRangeProps = $props();
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const progressLinear = ProgressLinearRootContext.consume();
|
|
16
16
|
|
|
17
|
-
const { element, children, ...
|
|
17
|
+
const { element, children, ...rest } = $derived(props);
|
|
18
18
|
|
|
19
19
|
const attributes = $derived(
|
|
20
|
-
mergeProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class: classesProgressLinear.range
|
|
24
|
-
},
|
|
25
|
-
restAttributes
|
|
26
|
-
)
|
|
20
|
+
mergeProps(progressLinear().getRangeProps(), rest, {
|
|
21
|
+
class: classesProgressLinear.range
|
|
22
|
+
})
|
|
27
23
|
);
|
|
28
24
|
</script>
|
|
29
25
|
|
|
30
26
|
{#if element}
|
|
31
|
-
{@render element(
|
|
27
|
+
{@render element(attributes)}
|
|
32
28
|
{:else}
|
|
33
29
|
<div {...attributes}>
|
|
34
30
|
{@render children?.()}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
3
|
-
export interface ProgressLinearRangeProps extends PropsWithElement
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
export interface ProgressLinearRangeProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {
|
|
4
4
|
}
|
|
5
5
|
declare const Range: import("svelte").Component<ProgressLinearRangeProps, {}, "">;
|
|
6
6
|
type Range = ReturnType<typeof Range>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type {
|
|
3
|
+
import type { useProgressLinear } from '../modules/use-progress-linear.svelte';
|
|
4
4
|
|
|
5
5
|
export interface ProgressLinearRootContextProps {
|
|
6
|
-
children: Snippet<[
|
|
6
|
+
children: Snippet<[ReturnType<typeof useProgressLinear>]>;
|
|
7
7
|
}
|
|
8
8
|
</script>
|
|
9
9
|
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
const props: ProgressLinearRootContextProps = $props();
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const progressLinear = ProgressLinearRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { children } = $derived(props);
|
|
16
18
|
</script>
|
|
17
19
|
|
|
18
|
-
{@render
|
|
20
|
+
{@render children(progressLinear)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type {
|
|
2
|
+
import type { useProgressLinear } from '../modules/use-progress-linear.svelte';
|
|
3
3
|
export interface ProgressLinearRootContextProps {
|
|
4
|
-
children: Snippet<[
|
|
4
|
+
children: Snippet<[ReturnType<typeof useProgressLinear>]>;
|
|
5
5
|
}
|
|
6
6
|
declare const RootContext: import("svelte").Component<ProgressLinearRootContextProps, {}, "">;
|
|
7
7
|
type RootContext = ReturnType<typeof RootContext>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
import { useProgressLinear } from '../modules/use-progress-linear.svelte';
|
|
5
|
+
|
|
6
|
+
export interface ProgressLinearRootProviderProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
7
|
+
value: ReturnType<typeof useProgressLinear>;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
13
|
+
import { classesProgressLinear } from '@skeletonlabs/skeleton-common';
|
|
14
|
+
import { ProgressLinearRootContext } from '../modules/root-context';
|
|
15
|
+
|
|
16
|
+
const props: ProgressLinearRootProviderProps = $props();
|
|
17
|
+
|
|
18
|
+
const { element, children, value: avatar, ...rest } = $derived(props);
|
|
19
|
+
|
|
20
|
+
const attributes = $derived(
|
|
21
|
+
mergeProps(avatar().getRootProps(), rest, {
|
|
22
|
+
class: classesProgressLinear.root
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
ProgressLinearRootContext.provide(() => avatar());
|
|
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 { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import { useProgressLinear } from '../modules/use-progress-linear.svelte';
|
|
4
|
+
export interface ProgressLinearRootProviderProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
5
|
+
value: ReturnType<typeof useProgressLinear>;
|
|
6
|
+
}
|
|
7
|
+
declare const RootProvider: import("svelte").Component<ProgressLinearRootProviderProps, {}, "">;
|
|
8
|
+
type RootProvider = ReturnType<typeof RootProvider>;
|
|
9
|
+
export default RootProvider;
|
|
@@ -1,51 +1,40 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
3
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
4
|
import type { Props } from '@zag-js/progress';
|
|
5
5
|
|
|
6
|
-
export interface ProgressLinearRootProps
|
|
7
|
-
extends PropsWithElement,
|
|
8
|
-
Omit<Props, 'id'>,
|
|
9
|
-
Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'dir'> {}
|
|
6
|
+
export interface ProgressLinearRootProps extends Omit<Props, 'id'>, PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {}
|
|
10
7
|
</script>
|
|
11
8
|
|
|
12
9
|
<script lang="ts">
|
|
13
|
-
import { splitProps
|
|
14
|
-
import { mergeProps
|
|
10
|
+
import { splitProps } from '@zag-js/progress';
|
|
11
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
15
12
|
import { classesProgressLinear } from '@skeletonlabs/skeleton-common';
|
|
16
13
|
import { ProgressLinearRootContext } from '../modules/root-context';
|
|
14
|
+
import { useProgressLinear } from '../modules/use-progress-linear.svelte';
|
|
17
15
|
|
|
18
16
|
const props: ProgressLinearRootProps = $props();
|
|
19
17
|
|
|
20
|
-
const [
|
|
21
|
-
const { element, children, ...
|
|
18
|
+
const [progressLinearProps, componentProps] = $derived(splitProps(props));
|
|
19
|
+
const { element, children, ...rest } = $derived(componentProps);
|
|
22
20
|
|
|
23
21
|
const id = $props.id();
|
|
24
|
-
const
|
|
22
|
+
const avatar = useProgressLinear(() => ({
|
|
25
23
|
id,
|
|
26
|
-
...
|
|
24
|
+
...progressLinearProps
|
|
27
25
|
}));
|
|
28
|
-
const api = $derived(connect(service, normalizeProps));
|
|
29
26
|
|
|
30
27
|
const attributes = $derived(
|
|
31
|
-
mergeProps(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class: classesProgressLinear.root
|
|
35
|
-
},
|
|
36
|
-
restAttributes
|
|
37
|
-
)
|
|
28
|
+
mergeProps(avatar().getRootProps(), rest, {
|
|
29
|
+
class: classesProgressLinear.root
|
|
30
|
+
})
|
|
38
31
|
);
|
|
39
32
|
|
|
40
|
-
ProgressLinearRootContext.provide(
|
|
41
|
-
get api() {
|
|
42
|
-
return api;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
33
|
+
ProgressLinearRootContext.provide(() => avatar());
|
|
45
34
|
</script>
|
|
46
35
|
|
|
47
36
|
{#if element}
|
|
48
|
-
{@render element(
|
|
37
|
+
{@render element(attributes)}
|
|
49
38
|
{:else}
|
|
50
39
|
<div {...attributes}>
|
|
51
40
|
{@render children?.()}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { HTMLAttributes } from '
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
2
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
3
|
import type { Props } from '@zag-js/progress';
|
|
4
|
-
export interface ProgressLinearRootProps extends
|
|
4
|
+
export interface ProgressLinearRootProps extends Omit<Props, 'id'>, PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
5
5
|
}
|
|
6
6
|
declare const Root: import("svelte").Component<ProgressLinearRootProps, {}, "">;
|
|
7
7
|
type Root = ReturnType<typeof Root>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
-
import type { HTMLAttributes } from '
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
4
|
|
|
5
|
-
export interface ProgressLinearTrackProps extends PropsWithElement
|
|
5
|
+
export interface ProgressLinearTrackProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
@@ -12,15 +12,19 @@
|
|
|
12
12
|
|
|
13
13
|
const props: ProgressLinearTrackProps = $props();
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const progressLinear = ProgressLinearRootContext.consume();
|
|
16
16
|
|
|
17
|
-
const { element, children, ...
|
|
17
|
+
const { element, children, ...rest } = $derived(props);
|
|
18
18
|
|
|
19
|
-
const attributes = $derived(
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(progressLinear().getTrackProps(), rest, {
|
|
21
|
+
class: classesProgressLinear.track
|
|
22
|
+
})
|
|
23
|
+
);
|
|
20
24
|
</script>
|
|
21
25
|
|
|
22
26
|
{#if element}
|
|
23
|
-
{@render element(
|
|
27
|
+
{@render element(attributes)}
|
|
24
28
|
{:else}
|
|
25
29
|
<div {...attributes}>
|
|
26
30
|
{@render children?.()}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
3
|
-
export interface ProgressLinearTrackProps extends PropsWithElement
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
export interface ProgressLinearTrackProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {
|
|
4
4
|
}
|
|
5
5
|
declare const Track: import("svelte").Component<ProgressLinearTrackProps, {}, "">;
|
|
6
6
|
type Track = ReturnType<typeof Track>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { ProgressLinear } from './modules/anatomy';
|
|
2
|
+
export { useProgressLinear } from './modules/use-progress-linear.svelte';
|
|
2
3
|
export type { ProgressLinearRootProps } from './anatomy/root.svelte';
|
|
4
|
+
export type { ProgressLinearRootProviderProps } from './anatomy/root-provider.svelte';
|
|
3
5
|
export type { ProgressLinearRootContextProps } from './anatomy/root-context.svelte';
|
|
4
6
|
export type { ProgressLinearLabelProps } from './anatomy/label.svelte';
|
|
5
7
|
export type { ProgressLinearTrackProps } from './anatomy/track.svelte';
|
|
6
8
|
export type { ProgressLinearRangeProps } from './anatomy/range.svelte';
|
|
7
|
-
export type { ProgressLinearRootContextType as ProgressLinearRootContext } from './modules/root-context';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { connect, machine } from '@zag-js/progress';
|
|
2
|
+
import { useMachine, normalizeProps } from '@zag-js/svelte';
|
|
3
|
+
export function useProgressLinear(props) {
|
|
4
|
+
const service = useMachine(machine, props);
|
|
5
|
+
const progressLinear = $derived(connect(service, normalizeProps));
|
|
6
|
+
return () => progressLinear;
|
|
7
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
3
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
4
|
|
|
5
|
-
export interface RatingGroupControlProps extends PropsWithElement
|
|
5
|
+
export interface RatingGroupControlProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
@@ -12,15 +12,21 @@
|
|
|
12
12
|
|
|
13
13
|
const props: RatingGroupControlProps = $props();
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const ratingGroup = RatingGroupRootContext.consume();
|
|
16
16
|
|
|
17
|
-
const { element, children, ...
|
|
17
|
+
const { element, children, ...rest } = $derived(props);
|
|
18
18
|
|
|
19
|
-
const attributes = $derived(
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(ratingGroup().getControlProps(), rest, {
|
|
21
|
+
class: classesRatingGroup.control
|
|
22
|
+
})
|
|
23
|
+
);
|
|
20
24
|
</script>
|
|
21
25
|
|
|
22
26
|
{#if element}
|
|
23
|
-
{@render element(
|
|
27
|
+
{@render element(attributes)}
|
|
24
28
|
{:else}
|
|
25
|
-
<div {...attributes}>
|
|
29
|
+
<div {...attributes}>
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
</div>
|
|
26
32
|
{/if}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { HTMLAttributes } from '
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
2
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
-
export interface RatingGroupControlProps extends PropsWithElement
|
|
3
|
+
export interface RatingGroupControlProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
4
4
|
}
|
|
5
5
|
declare const Control: import("svelte").Component<RatingGroupControlProps, {}, "">;
|
|
6
6
|
type Control = ReturnType<typeof Control>;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
2
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
4
|
|
|
5
|
-
export interface RatingGroupHiddenInputProps
|
|
6
|
-
extends PropsWithElement,
|
|
7
|
-
Omit<HTMLInputAttributes, 'id' | 'defaultValue' | 'dir' | 'children'> {}
|
|
5
|
+
export interface RatingGroupHiddenInputProps extends PropsWithElement<'input'>, HTMLAttributes<'input'> {}
|
|
8
6
|
</script>
|
|
9
7
|
|
|
10
8
|
<script lang="ts">
|
|
@@ -14,15 +12,19 @@
|
|
|
14
12
|
|
|
15
13
|
const props: RatingGroupHiddenInputProps = $props();
|
|
16
14
|
|
|
17
|
-
const
|
|
15
|
+
const ratingGroup = RatingGroupRootContext.consume();
|
|
18
16
|
|
|
19
|
-
const { element, ...
|
|
17
|
+
const { element, ...rest } = $derived(props);
|
|
20
18
|
|
|
21
|
-
const attributes = $derived(
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(ratingGroup().getHiddenInputProps(), rest, {
|
|
21
|
+
class: classesRatingGroup.hiddenInput
|
|
22
|
+
})
|
|
23
|
+
);
|
|
22
24
|
</script>
|
|
23
25
|
|
|
24
26
|
{#if element}
|
|
25
|
-
{@render element(
|
|
27
|
+
{@render element(attributes)}
|
|
26
28
|
{:else}
|
|
27
29
|
<input {...attributes} />
|
|
28
30
|
{/if}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
1
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
-
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
export interface RatingGroupHiddenInputProps extends PropsWithElement<'input'>, HTMLAttributes<'input'> {
|
|
4
4
|
}
|
|
5
5
|
declare const HiddenInput: import("svelte").Component<RatingGroupHiddenInputProps, {}, "">;
|
|
6
6
|
type HiddenInput = ReturnType<typeof HiddenInput>;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
3
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
4
|
import type { ItemProps } from '@zag-js/rating-group';
|
|
5
5
|
|
|
6
|
-
export interface RatingGroupItemProps
|
|
7
|
-
extends PropsWithElement,
|
|
8
|
-
ItemProps,
|
|
9
|
-
Omit<HTMLAttributes<HTMLSpanElement>, 'id' | 'defaultValue' | 'dir'> {
|
|
6
|
+
export interface RatingGroupItemProps extends ItemProps, PropsWithElement<'span'>, HTMLAttributes<'span', 'id' | 'dir'> {
|
|
10
7
|
/**
|
|
11
8
|
* The content to render when the item is in the empty state.
|
|
12
9
|
*
|
|
@@ -33,7 +30,6 @@
|
|
|
33
30
|
import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
|
|
34
31
|
import { splitItemProps } from '@zag-js/rating-group';
|
|
35
32
|
import { RatingGroupRootContext } from '../modules/root-context';
|
|
36
|
-
import { RatingGroupItemContext } from '../modules/item-context';
|
|
37
33
|
import StarFull from '../../../internal/components/star-full.svelte';
|
|
38
34
|
import StarEmpty from '../../../internal/components/star-empty.svelte';
|
|
39
35
|
import StarHalf from '../../../internal/components/star-half.svelte';
|
|
@@ -41,20 +37,18 @@
|
|
|
41
37
|
|
|
42
38
|
const props: RatingGroupItemProps = $props();
|
|
43
39
|
|
|
44
|
-
const
|
|
40
|
+
const ratingGroup = RatingGroupRootContext.consume();
|
|
45
41
|
|
|
46
42
|
const [itemProps, componentProps] = $derived(splitItemProps(props));
|
|
47
|
-
const { element, children, empty = starEmpty, half = starHalf, full = starFull, ...
|
|
43
|
+
const { element, children, empty = starEmpty, half = starHalf, full = starFull, ...rest } = $derived(componentProps);
|
|
48
44
|
|
|
49
|
-
const itemState = $derived(
|
|
45
|
+
const itemState = $derived(ratingGroup().getItemState(itemProps));
|
|
50
46
|
|
|
51
|
-
const attributes = $derived(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
});
|
|
47
|
+
const attributes = $derived(
|
|
48
|
+
mergeProps(ratingGroup().getItemProps(itemProps), rest, {
|
|
49
|
+
class: classesRatingGroup.item
|
|
50
|
+
})
|
|
51
|
+
);
|
|
58
52
|
</script>
|
|
59
53
|
|
|
60
54
|
{#snippet starEmpty()}
|
|
@@ -70,7 +64,7 @@
|
|
|
70
64
|
{/snippet}
|
|
71
65
|
|
|
72
66
|
{#if element}
|
|
73
|
-
{@render element(
|
|
67
|
+
{@render element(attributes)}
|
|
74
68
|
{:else}
|
|
75
69
|
<div {...attributes}>
|
|
76
70
|
{#if children}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { HTMLAttributes } from '
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
2
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
3
|
import type { ItemProps } from '@zag-js/rating-group';
|
|
4
|
-
export interface RatingGroupItemProps extends
|
|
4
|
+
export interface RatingGroupItemProps extends ItemProps, PropsWithElement<'span'>, HTMLAttributes<'span', 'id' | 'dir'> {
|
|
5
5
|
/**
|
|
6
6
|
* The content to render when the item is in the empty state.
|
|
7
7
|
*
|