@skeletonlabs/skeleton-svelte 2.0.0-next.1 → 2.0.0-next.3
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 +32 -0
- package/dist/components/accordion/anatomy/content.svelte.d.ts +7 -0
- package/dist/components/accordion/anatomy/heading.svelte +33 -0
- package/dist/components/accordion/anatomy/heading.svelte.d.ts +13 -0
- package/dist/components/accordion/anatomy/indicator.svelte +32 -0
- package/dist/components/accordion/anatomy/indicator.svelte.d.ts +7 -0
- package/dist/components/accordion/anatomy/item-context.svelte +18 -0
- package/dist/components/accordion/anatomy/item-context.svelte.d.ts +8 -0
- package/dist/components/accordion/anatomy/item.svelte +41 -0
- package/dist/components/accordion/anatomy/item.svelte.d.ts +8 -0
- package/dist/components/accordion/anatomy/root-context.svelte +18 -0
- package/dist/components/accordion/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/accordion/anatomy/root.svelte +44 -0
- package/dist/components/accordion/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/accordion/anatomy/trigger.svelte +32 -0
- package/dist/components/accordion/anatomy/trigger.svelte.d.ts +7 -0
- package/dist/components/accordion/index.d.ts +11 -2
- package/dist/components/accordion/index.js +1 -2
- package/dist/components/accordion/modules/anatomy.d.ts +8 -7
- package/dist/components/accordion/modules/anatomy.js +16 -13
- package/dist/components/accordion/modules/item-context.d.ts +10 -0
- package/dist/components/accordion/modules/item-context.js +2 -0
- package/dist/components/accordion/modules/root-context.d.ts +9 -0
- package/dist/components/accordion/modules/root-context.js +2 -0
- package/dist/components/avatar/anatomy/fallback.svelte +28 -0
- package/dist/components/avatar/anatomy/fallback.svelte.d.ts +7 -0
- package/dist/components/avatar/anatomy/image.svelte +26 -0
- package/dist/components/avatar/anatomy/image.svelte.d.ts +7 -0
- package/dist/components/avatar/anatomy/root-context.svelte +18 -0
- package/dist/components/avatar/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/avatar/anatomy/root.svelte +41 -0
- package/dist/components/avatar/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/avatar/index.d.ts +6 -2
- package/dist/components/avatar/index.js +1 -2
- package/dist/components/avatar/modules/anatomy.d.ts +4 -4
- package/dist/components/avatar/modules/anatomy.js +8 -7
- package/dist/components/avatar/modules/root-context.d.ts +9 -0
- package/dist/components/avatar/modules/root-context.js +2 -0
- package/dist/components/progress-linear/anatomy/label.svelte +36 -0
- package/dist/components/progress-linear/anatomy/label.svelte.d.ts +7 -0
- package/dist/components/progress-linear/anatomy/range.svelte +36 -0
- package/dist/components/progress-linear/anatomy/range.svelte.d.ts +7 -0
- package/dist/components/progress-linear/anatomy/root-context.svelte +18 -0
- package/dist/components/progress-linear/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/progress-linear/anatomy/root.svelte +53 -0
- package/dist/components/progress-linear/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/progress-linear/anatomy/track.svelte +28 -0
- package/dist/components/progress-linear/anatomy/track.svelte.d.ts +7 -0
- package/dist/components/progress-linear/index.d.ts +7 -0
- package/dist/components/progress-linear/index.js +1 -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/progress-linear/modules/root-context.d.ts +9 -0
- package/dist/components/progress-linear/modules/root-context.js +2 -0
- package/dist/components/rating-group/anatomy/control.svelte +26 -0
- package/dist/components/rating-group/anatomy/control.svelte.d.ts +7 -0
- package/dist/components/rating-group/anatomy/hidden-input.svelte +28 -0
- package/dist/components/rating-group/anatomy/hidden-input.svelte.d.ts +7 -0
- package/dist/components/rating-group/anatomy/item-context.svelte +18 -0
- package/dist/components/rating-group/anatomy/item-context.svelte.d.ts +8 -0
- package/dist/components/rating-group/anatomy/item.svelte +86 -0
- package/dist/components/rating-group/anatomy/item.svelte.d.ts +27 -0
- package/dist/components/rating-group/anatomy/label.svelte +26 -0
- package/dist/components/rating-group/anatomy/label.svelte.d.ts +7 -0
- package/dist/components/rating-group/anatomy/root-context.svelte +18 -0
- package/dist/components/rating-group/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/rating-group/anatomy/root.svelte +47 -0
- package/dist/components/rating-group/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/rating-group/index.d.ts +10 -0
- package/dist/components/rating-group/index.js +1 -0
- 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/item-context.d.ts +9 -0
- package/dist/components/rating-group/modules/item-context.js +2 -0
- package/dist/components/rating-group/modules/root-context.d.ts +9 -0
- package/dist/components/rating-group/modules/root-context.js +2 -0
- package/dist/components/tabs/anatomy/content.svelte +31 -0
- package/dist/components/tabs/anatomy/content.svelte.d.ts +8 -0
- package/dist/components/tabs/anatomy/indicator.svelte +26 -0
- package/dist/components/tabs/anatomy/indicator.svelte.d.ts +7 -0
- package/dist/components/tabs/anatomy/list.svelte +28 -0
- package/dist/components/tabs/anatomy/list.svelte.d.ts +7 -0
- package/dist/components/tabs/anatomy/root-context.svelte +18 -0
- package/dist/components/tabs/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/tabs/anatomy/root.svelte +44 -0
- package/dist/components/tabs/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/tabs/anatomy/trigger.svelte +31 -0
- package/dist/components/tabs/anatomy/trigger.svelte.d.ts +8 -0
- package/dist/components/tabs/index.d.ts +1 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/tabs/modules/anatomy.d.ts +7 -0
- package/dist/components/tabs/modules/anatomy.js +13 -0
- package/dist/components/tabs/modules/root-context.d.ts +9 -0
- package/dist/components/tabs/modules/root-context.js +2 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -2
- package/dist/internal/components/star-empty.svelte +12 -0
- package/dist/internal/components/star-empty.svelte.d.ts +26 -0
- package/dist/internal/components/star-full.svelte +12 -0
- package/dist/internal/components/star-full.svelte.d.ts +26 -0
- package/dist/internal/components/star-half.svelte +19 -0
- package/dist/internal/components/star-half.svelte.d.ts +26 -0
- package/dist/internal/create-context.d.ts +5 -6
- package/dist/internal/create-context.js +10 -9
- package/dist/internal/props-with-element.d.ts +3 -0
- package/package.json +3 -4
- package/dist/components/accordion/anatomy/accordion-content.svelte +0 -28
- package/dist/components/accordion/anatomy/accordion-content.svelte.d.ts +0 -4
- package/dist/components/accordion/anatomy/accordion-heading.svelte +0 -25
- package/dist/components/accordion/anatomy/accordion-heading.svelte.d.ts +0 -4
- package/dist/components/accordion/anatomy/accordion-indicator.svelte +0 -28
- package/dist/components/accordion/anatomy/accordion-indicator.svelte.d.ts +0 -4
- package/dist/components/accordion/anatomy/accordion-item.svelte +0 -34
- package/dist/components/accordion/anatomy/accordion-item.svelte.d.ts +0 -4
- package/dist/components/accordion/anatomy/accordion-root.svelte +0 -39
- package/dist/components/accordion/anatomy/accordion-root.svelte.d.ts +0 -4
- package/dist/components/accordion/anatomy/accordion-trigger.svelte +0 -28
- package/dist/components/accordion/anatomy/accordion-trigger.svelte.d.ts +0 -4
- package/dist/components/accordion/modules/context.d.ts +0 -12
- package/dist/components/accordion/modules/context.js +0 -4
- package/dist/components/accordion/modules/types.d.ts +0 -29
- package/dist/components/accordion/modules/types.js +0 -1
- package/dist/components/avatar/anatomy/avatar-fallback.svelte +0 -27
- package/dist/components/avatar/anatomy/avatar-fallback.svelte.d.ts +0 -4
- package/dist/components/avatar/anatomy/avatar-image.svelte +0 -25
- package/dist/components/avatar/anatomy/avatar-image.svelte.d.ts +0 -4
- package/dist/components/avatar/anatomy/avatar-root.svelte +0 -39
- package/dist/components/avatar/anatomy/avatar-root.svelte.d.ts +0 -4
- package/dist/components/avatar/modules/context.d.ts +0 -7
- package/dist/components/avatar/modules/context.js +0 -3
- package/dist/components/avatar/modules/types.d.ts +0 -14
- package/dist/components/avatar/modules/types.js +0 -1
- package/dist/internal/create-context-new.d.ts +0 -5
- package/dist/internal/create-context-new.js +0 -13
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import Root from '../anatomy/root.svelte';
|
|
2
|
+
import RootContext from '../anatomy/root-context.svelte';
|
|
3
|
+
import Image from '../anatomy/image.svelte';
|
|
4
|
+
import Fallback from '../anatomy/fallback.svelte';
|
|
5
|
+
export const Avatar = Object.assign(Root, {
|
|
6
|
+
Context: RootContext,
|
|
7
|
+
Image: Image,
|
|
8
|
+
Fallback: Fallback
|
|
7
9
|
});
|
|
8
|
-
export { Avatar };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Api } from '@zag-js/avatar';
|
|
2
|
+
export interface AvatarRootContextType {
|
|
3
|
+
api: Api;
|
|
4
|
+
}
|
|
5
|
+
export declare const AvatarRootContext: {
|
|
6
|
+
key: symbol;
|
|
7
|
+
consume(): AvatarRootContextType;
|
|
8
|
+
provide(value: AvatarRootContextType): AvatarRootContextType;
|
|
9
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
export interface ProgressLinearLabelProps extends PropsWithElement, HTMLAttributes<HTMLDivElement> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesProgressLinear } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { ProgressLinearRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: ProgressLinearLabelProps = $props();
|
|
14
|
+
|
|
15
|
+
const rootContext = ProgressLinearRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, children, ...restAttributes } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(
|
|
21
|
+
rootContext.api.getLabelProps(),
|
|
22
|
+
{
|
|
23
|
+
class: classesProgressLinear.label
|
|
24
|
+
},
|
|
25
|
+
restAttributes
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
{#if element}
|
|
31
|
+
{@render element({ attributes })}
|
|
32
|
+
{:else}
|
|
33
|
+
<div {...attributes}>
|
|
34
|
+
{@render children?.()}
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
export interface ProgressLinearLabelProps extends PropsWithElement, HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
}
|
|
5
|
+
declare const Label: import("svelte").Component<ProgressLinearLabelProps, {}, "">;
|
|
6
|
+
type Label = ReturnType<typeof Label>;
|
|
7
|
+
export default Label;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
export interface ProgressLinearRangeProps extends PropsWithElement, HTMLAttributes<HTMLDivElement> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesProgressLinear } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { ProgressLinearRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: ProgressLinearRangeProps = $props();
|
|
14
|
+
|
|
15
|
+
const rootContext = ProgressLinearRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, children, ...restAttributes } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(
|
|
21
|
+
rootContext.api.getRangeProps(),
|
|
22
|
+
{
|
|
23
|
+
class: classesProgressLinear.range
|
|
24
|
+
},
|
|
25
|
+
restAttributes
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
{#if element}
|
|
31
|
+
{@render element({ attributes })}
|
|
32
|
+
{:else}
|
|
33
|
+
<div {...attributes}>
|
|
34
|
+
{@render children?.()}
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
export interface ProgressLinearRangeProps extends PropsWithElement, HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
}
|
|
5
|
+
declare const Range: import("svelte").Component<ProgressLinearRangeProps, {}, "">;
|
|
6
|
+
type Range = ReturnType<typeof Range>;
|
|
7
|
+
export default Range;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ProgressLinearRootContextType } from '../modules/root-context';
|
|
4
|
+
|
|
5
|
+
export interface ProgressLinearRootContextProps {
|
|
6
|
+
children: Snippet<[ProgressLinearRootContextType]>;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { ProgressLinearRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: ProgressLinearRootContextProps = $props();
|
|
14
|
+
|
|
15
|
+
const rootContext = ProgressLinearRootContext.consume();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{@render props.children(rootContext)}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ProgressLinearRootContextType } from '../modules/root-context';
|
|
3
|
+
export interface ProgressLinearRootContextProps {
|
|
4
|
+
children: Snippet<[ProgressLinearRootContextType]>;
|
|
5
|
+
}
|
|
6
|
+
declare const RootContext: import("svelte").Component<ProgressLinearRootContextProps, {}, "">;
|
|
7
|
+
type RootContext = ReturnType<typeof RootContext>;
|
|
8
|
+
export default RootContext;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
import type { Props } from '@zag-js/progress';
|
|
5
|
+
|
|
6
|
+
export interface ProgressLinearRootProps
|
|
7
|
+
extends PropsWithElement,
|
|
8
|
+
Omit<Props, 'id'>,
|
|
9
|
+
Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'dir'> {}
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import { splitProps, machine, connect } from '@zag-js/progress';
|
|
14
|
+
import { mergeProps, normalizeProps, useMachine } from '@zag-js/svelte';
|
|
15
|
+
import { classesProgressLinear } from '@skeletonlabs/skeleton-common';
|
|
16
|
+
import { ProgressLinearRootContext } from '../modules/root-context';
|
|
17
|
+
|
|
18
|
+
const props: ProgressLinearRootProps = $props();
|
|
19
|
+
|
|
20
|
+
const [machineProps, componentProps] = $derived(splitProps(props));
|
|
21
|
+
const { element, children, ...restAttributes } = $derived(componentProps);
|
|
22
|
+
|
|
23
|
+
const id = $props.id();
|
|
24
|
+
const service = useMachine(machine, () => ({
|
|
25
|
+
id,
|
|
26
|
+
...machineProps
|
|
27
|
+
}));
|
|
28
|
+
const api = $derived(connect(service, normalizeProps));
|
|
29
|
+
|
|
30
|
+
const attributes = $derived(
|
|
31
|
+
mergeProps(
|
|
32
|
+
api.getRootProps(),
|
|
33
|
+
{
|
|
34
|
+
class: classesProgressLinear.root
|
|
35
|
+
},
|
|
36
|
+
restAttributes
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
ProgressLinearRootContext.provide({
|
|
41
|
+
get api() {
|
|
42
|
+
return api;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
{#if element}
|
|
48
|
+
{@render element({ attributes })}
|
|
49
|
+
{:else}
|
|
50
|
+
<div {...attributes}>
|
|
51
|
+
{@render children?.()}
|
|
52
|
+
</div>
|
|
53
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { Props } from '@zag-js/progress';
|
|
4
|
+
export interface ProgressLinearRootProps extends PropsWithElement, Omit<Props, 'id'>, Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'dir'> {
|
|
5
|
+
}
|
|
6
|
+
declare const Root: import("svelte").Component<ProgressLinearRootProps, {}, "">;
|
|
7
|
+
type Root = ReturnType<typeof Root>;
|
|
8
|
+
export default Root;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
export interface ProgressLinearTrackProps extends PropsWithElement, HTMLAttributes<HTMLDivElement> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesProgressLinear } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { ProgressLinearRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: ProgressLinearTrackProps = $props();
|
|
14
|
+
|
|
15
|
+
const rootContext = ProgressLinearRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, children, ...restAttributes } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(mergeProps(rootContext.api.getTrackProps(), { class: classesProgressLinear.track }, restAttributes));
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
{#if element}
|
|
23
|
+
{@render element({ attributes })}
|
|
24
|
+
{:else}
|
|
25
|
+
<div {...attributes}>
|
|
26
|
+
{@render children?.()}
|
|
27
|
+
</div>
|
|
28
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
export interface ProgressLinearTrackProps extends PropsWithElement, HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
}
|
|
5
|
+
declare const Track: import("svelte").Component<ProgressLinearTrackProps, {}, "">;
|
|
6
|
+
type Track = ReturnType<typeof Track>;
|
|
7
|
+
export default Track;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ProgressLinear } from './modules/anatomy';
|
|
2
|
+
export type { ProgressLinearRootProps } from './anatomy/root.svelte';
|
|
3
|
+
export type { ProgressLinearRootContextProps } from './anatomy/root-context.svelte';
|
|
4
|
+
export type { ProgressLinearLabelProps } from './anatomy/label.svelte';
|
|
5
|
+
export type { ProgressLinearTrackProps } from './anatomy/track.svelte';
|
|
6
|
+
export type { ProgressLinearRangeProps } from './anatomy/range.svelte';
|
|
7
|
+
export type { ProgressLinearRootContextType as ProgressLinearRootContext } from './modules/root-context';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressLinear } from './modules/anatomy';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const ProgressLinear: import("svelte").Component<import("../anatomy/root.svelte").ProgressLinearRootProps, {}, ""> & {
|
|
2
|
+
Context: import("svelte").Component<import("../anatomy/root-context.svelte").ProgressLinearRootContextProps, {}, "">;
|
|
3
|
+
Label: import("svelte").Component<import("../anatomy/label.svelte").ProgressLinearLabelProps, {}, "">;
|
|
4
|
+
Track: import("svelte").Component<import("../anatomy/track.svelte").ProgressLinearTrackProps, {}, "">;
|
|
5
|
+
Range: import("svelte").Component<import("../anatomy/range.svelte").ProgressLinearRangeProps, {}, "">;
|
|
6
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Root from '../anatomy/root.svelte';
|
|
2
|
+
import RootContext from '../anatomy/root-context.svelte';
|
|
3
|
+
import Label from '../anatomy/label.svelte';
|
|
4
|
+
import Track from '../anatomy/track.svelte';
|
|
5
|
+
import Range from '../anatomy/range.svelte';
|
|
6
|
+
export const ProgressLinear = Object.assign(Root, {
|
|
7
|
+
Context: RootContext,
|
|
8
|
+
Label: Label,
|
|
9
|
+
Track: Track,
|
|
10
|
+
Range: Range
|
|
11
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Api } from '@zag-js/progress';
|
|
2
|
+
export interface ProgressLinearRootContextType {
|
|
3
|
+
api: Api;
|
|
4
|
+
}
|
|
5
|
+
export declare const ProgressLinearRootContext: {
|
|
6
|
+
key: symbol;
|
|
7
|
+
consume(): ProgressLinearRootContextType;
|
|
8
|
+
provide(value: ProgressLinearRootContextType): ProgressLinearRootContextType;
|
|
9
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
|
|
5
|
+
export interface RatingGroupControlProps extends PropsWithElement, Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'defaultValue' | 'dir'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { RatingGroupRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: RatingGroupControlProps = $props();
|
|
14
|
+
|
|
15
|
+
const rootContext = RatingGroupRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, children, ...restAttributes } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(mergeProps(rootContext.api.getControlProps(), { class: classesRatingGroup.control }, restAttributes));
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
{#if element}
|
|
23
|
+
{@render element({ attributes })}
|
|
24
|
+
{:else}
|
|
25
|
+
<div {...attributes}>{@render children?.()}</div>
|
|
26
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
export interface RatingGroupControlProps extends PropsWithElement, Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'defaultValue' | 'dir'> {
|
|
4
|
+
}
|
|
5
|
+
declare const Control: import("svelte").Component<RatingGroupControlProps, {}, "">;
|
|
6
|
+
type Control = ReturnType<typeof Control>;
|
|
7
|
+
export default Control;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
|
|
5
|
+
export interface RatingGroupHiddenInputProps
|
|
6
|
+
extends PropsWithElement,
|
|
7
|
+
Omit<HTMLInputAttributes, 'id' | 'defaultValue' | 'dir' | 'children'> {}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
12
|
+
import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
|
|
13
|
+
import { RatingGroupRootContext } from '../modules/root-context';
|
|
14
|
+
|
|
15
|
+
const props: RatingGroupHiddenInputProps = $props();
|
|
16
|
+
|
|
17
|
+
const rootContext = RatingGroupRootContext.consume();
|
|
18
|
+
|
|
19
|
+
const { element, ...restAttributes } = $derived(props);
|
|
20
|
+
|
|
21
|
+
const attributes = $derived(mergeProps(rootContext.api.getHiddenInputProps(), { class: classesRatingGroup.hiddenInput }, restAttributes));
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
{#if element}
|
|
25
|
+
{@render element({ attributes })}
|
|
26
|
+
{:else}
|
|
27
|
+
<input {...attributes} />
|
|
28
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
export interface RatingGroupHiddenInputProps extends PropsWithElement, Omit<HTMLInputAttributes, 'id' | 'defaultValue' | 'dir' | 'children'> {
|
|
4
|
+
}
|
|
5
|
+
declare const HiddenInput: import("svelte").Component<RatingGroupHiddenInputProps, {}, "">;
|
|
6
|
+
type HiddenInput = ReturnType<typeof HiddenInput>;
|
|
7
|
+
export default HiddenInput;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { RatingGroupItemContextType } from '../modules/item-context';
|
|
4
|
+
|
|
5
|
+
export interface RatingGroupItemContextProps {
|
|
6
|
+
children: Snippet<[RatingGroupItemContextType]>;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { RatingGroupItemContext } from '../modules/item-context';
|
|
12
|
+
|
|
13
|
+
const props: RatingGroupItemContextProps = $props();
|
|
14
|
+
|
|
15
|
+
const itemContext = RatingGroupItemContext.consume();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{@render props.children(itemContext)}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { RatingGroupItemContextType } from '../modules/item-context';
|
|
3
|
+
export interface RatingGroupItemContextProps {
|
|
4
|
+
children: Snippet<[RatingGroupItemContextType]>;
|
|
5
|
+
}
|
|
6
|
+
declare const ItemContext: import("svelte").Component<RatingGroupItemContextProps, {}, "">;
|
|
7
|
+
type ItemContext = ReturnType<typeof ItemContext>;
|
|
8
|
+
export default ItemContext;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
import type { ItemProps } from '@zag-js/rating-group';
|
|
5
|
+
|
|
6
|
+
export interface RatingGroupItemProps
|
|
7
|
+
extends PropsWithElement,
|
|
8
|
+
ItemProps,
|
|
9
|
+
Omit<HTMLAttributes<HTMLSpanElement>, 'id' | 'defaultValue' | 'dir'> {
|
|
10
|
+
/**
|
|
11
|
+
* The content to render when the item is in the empty state.
|
|
12
|
+
*
|
|
13
|
+
* @default StarEmpty (SVG)
|
|
14
|
+
*/
|
|
15
|
+
empty?: Snippet;
|
|
16
|
+
/**
|
|
17
|
+
* The content to render when the item is in the half state.
|
|
18
|
+
*
|
|
19
|
+
* @default StarHalf (SVG)
|
|
20
|
+
*/
|
|
21
|
+
half?: Snippet;
|
|
22
|
+
/**
|
|
23
|
+
* The content to render when the item is in the full state.
|
|
24
|
+
*
|
|
25
|
+
* @default StarFull (SVG)
|
|
26
|
+
*/
|
|
27
|
+
full?: Snippet;
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<script lang="ts">
|
|
32
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
33
|
+
import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
|
|
34
|
+
import { splitItemProps } from '@zag-js/rating-group';
|
|
35
|
+
import { RatingGroupRootContext } from '../modules/root-context';
|
|
36
|
+
import { RatingGroupItemContext } from '../modules/item-context';
|
|
37
|
+
import StarFull from '../../../internal/components/star-full.svelte';
|
|
38
|
+
import StarEmpty from '../../../internal/components/star-empty.svelte';
|
|
39
|
+
import StarHalf from '../../../internal/components/star-half.svelte';
|
|
40
|
+
import type { Snippet } from 'svelte';
|
|
41
|
+
|
|
42
|
+
const props: RatingGroupItemProps = $props();
|
|
43
|
+
|
|
44
|
+
const rootContext = RatingGroupRootContext.consume();
|
|
45
|
+
|
|
46
|
+
const [itemProps, componentProps] = $derived(splitItemProps(props));
|
|
47
|
+
const { element, children, empty = starEmpty, half = starHalf, full = starFull, ...restAttributes } = $derived(componentProps);
|
|
48
|
+
|
|
49
|
+
const itemState = $derived(rootContext.api.getItemState(itemProps));
|
|
50
|
+
|
|
51
|
+
const attributes = $derived(mergeProps(rootContext.api.getItemProps(itemProps), { class: classesRatingGroup.item }, restAttributes));
|
|
52
|
+
|
|
53
|
+
RatingGroupItemContext.provide({
|
|
54
|
+
get itemState() {
|
|
55
|
+
return itemState;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
{#snippet starEmpty()}
|
|
61
|
+
<StarEmpty />
|
|
62
|
+
{/snippet}
|
|
63
|
+
|
|
64
|
+
{#snippet starHalf()}
|
|
65
|
+
<StarHalf />
|
|
66
|
+
{/snippet}
|
|
67
|
+
|
|
68
|
+
{#snippet starFull()}
|
|
69
|
+
<StarFull />
|
|
70
|
+
{/snippet}
|
|
71
|
+
|
|
72
|
+
{#if element}
|
|
73
|
+
{@render element({ attributes })}
|
|
74
|
+
{:else}
|
|
75
|
+
<div {...attributes}>
|
|
76
|
+
{#if children}
|
|
77
|
+
{@render children()}
|
|
78
|
+
{:else if !itemState.highlighted}
|
|
79
|
+
{@render empty?.()}
|
|
80
|
+
{:else if itemState.half}
|
|
81
|
+
{@render half?.()}
|
|
82
|
+
{:else}
|
|
83
|
+
{@render full?.()}
|
|
84
|
+
{/if}
|
|
85
|
+
</div>
|
|
86
|
+
{/if}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { ItemProps } from '@zag-js/rating-group';
|
|
4
|
+
export interface RatingGroupItemProps extends PropsWithElement, ItemProps, Omit<HTMLAttributes<HTMLSpanElement>, 'id' | 'defaultValue' | 'dir'> {
|
|
5
|
+
/**
|
|
6
|
+
* The content to render when the item is in the empty state.
|
|
7
|
+
*
|
|
8
|
+
* @default StarEmpty (SVG)
|
|
9
|
+
*/
|
|
10
|
+
empty?: Snippet;
|
|
11
|
+
/**
|
|
12
|
+
* The content to render when the item is in the half state.
|
|
13
|
+
*
|
|
14
|
+
* @default StarHalf (SVG)
|
|
15
|
+
*/
|
|
16
|
+
half?: Snippet;
|
|
17
|
+
/**
|
|
18
|
+
* The content to render when the item is in the full state.
|
|
19
|
+
*
|
|
20
|
+
* @default StarFull (SVG)
|
|
21
|
+
*/
|
|
22
|
+
full?: Snippet;
|
|
23
|
+
}
|
|
24
|
+
import type { Snippet } from 'svelte';
|
|
25
|
+
declare const Item: import("svelte").Component<RatingGroupItemProps, {}, "">;
|
|
26
|
+
type Item = ReturnType<typeof Item>;
|
|
27
|
+
export default Item;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
|
|
5
|
+
export interface RatingGroupLabelProps extends PropsWithElement, Omit<HTMLAttributes<HTMLLabelElement>, 'id' | 'defaultValue' | 'dir'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { RatingGroupRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: RatingGroupLabelProps = $props();
|
|
14
|
+
|
|
15
|
+
const rootContext = RatingGroupRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, children, ...restAttributes } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(mergeProps(rootContext.api.getControlProps(), { class: classesRatingGroup.label }, restAttributes));
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
{#if element}
|
|
23
|
+
{@render element({ attributes })}
|
|
24
|
+
{:else}
|
|
25
|
+
<label {...attributes}>{@render children?.()}</label>
|
|
26
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
export interface RatingGroupLabelProps extends PropsWithElement, Omit<HTMLAttributes<HTMLLabelElement>, 'id' | 'defaultValue' | 'dir'> {
|
|
4
|
+
}
|
|
5
|
+
declare const Label: import("svelte").Component<RatingGroupLabelProps, {}, "">;
|
|
6
|
+
type Label = ReturnType<typeof Label>;
|
|
7
|
+
export default Label;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { RatingGroupRootContextType } from '../modules/root-context';
|
|
4
|
+
|
|
5
|
+
export interface RatingGroupRootContextProps {
|
|
6
|
+
children: Snippet<[RatingGroupRootContextType]>;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { RatingGroupRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: RatingGroupRootContextProps = $props();
|
|
14
|
+
|
|
15
|
+
const rootContext = RatingGroupRootContext.consume();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{@render props.children(rootContext)}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { RatingGroupRootContextType } from '../modules/root-context';
|
|
3
|
+
export interface RatingGroupRootContextProps {
|
|
4
|
+
children: Snippet<[RatingGroupRootContextType]>;
|
|
5
|
+
}
|
|
6
|
+
declare const RootContext: import("svelte").Component<RatingGroupRootContextProps, {}, "">;
|
|
7
|
+
type RootContext = ReturnType<typeof RootContext>;
|
|
8
|
+
export default RootContext;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
import type { Props } from '@zag-js/rating-group';
|
|
5
|
+
|
|
6
|
+
export interface RatingGroupRootProps
|
|
7
|
+
extends PropsWithElement,
|
|
8
|
+
Omit<Props, 'id'>,
|
|
9
|
+
Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'defaultValue' | 'dir'> {}
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import { mergeProps, normalizeProps, useMachine } from '@zag-js/svelte';
|
|
14
|
+
import { splitProps, machine, connect } from '@zag-js/rating-group';
|
|
15
|
+
import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
|
|
16
|
+
import { RatingGroupRootContext } from '../modules/root-context';
|
|
17
|
+
|
|
18
|
+
const props: RatingGroupRootProps = $props();
|
|
19
|
+
// @ts-expect-error - https://github.com/chakra-ui/zag/issues/2672
|
|
20
|
+
const [machineProps, componentProps] = $derived(splitProps(props));
|
|
21
|
+
// @ts-expect-error - https://github.com/chakra-ui/zag/issues/2672
|
|
22
|
+
const { element, children, ...restAttributes } = $derived(componentProps);
|
|
23
|
+
|
|
24
|
+
const id = $props.id();
|
|
25
|
+
const service = useMachine(machine, () => ({
|
|
26
|
+
// @ts-expect-error - https://github.com/chakra-ui/zag/issues/2672
|
|
27
|
+
id: id,
|
|
28
|
+
...machineProps
|
|
29
|
+
}));
|
|
30
|
+
const api = $derived(connect(service, normalizeProps));
|
|
31
|
+
|
|
32
|
+
const attributes = $derived(mergeProps(api.getRootProps(), { class: classesRatingGroup.root }, restAttributes));
|
|
33
|
+
|
|
34
|
+
RatingGroupRootContext.provide({
|
|
35
|
+
get api() {
|
|
36
|
+
return api;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
{#if element}
|
|
42
|
+
{@render element({ attributes })}
|
|
43
|
+
{:else}
|
|
44
|
+
<div {...attributes}>
|
|
45
|
+
{@render children?.()}
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { Props } from '@zag-js/rating-group';
|
|
4
|
+
export interface RatingGroupRootProps extends PropsWithElement, Omit<Props, 'id'>, Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'defaultValue' | 'dir'> {
|
|
5
|
+
}
|
|
6
|
+
declare const Root: import("svelte").Component<RatingGroupRootProps, {}, "">;
|
|
7
|
+
type Root = ReturnType<typeof Root>;
|
|
8
|
+
export default Root;
|