@skeletonlabs/skeleton-react 1.4.0 → 2.0.0-next.1
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/index.css +2 -0
- package/dist/index.d.ts +85 -17
- package/dist/index.js +162 -17
- package/package.json +30 -31
- package/dist/components/Accordion/Accordion.d.ts +0 -7
- package/dist/components/Accordion/Accordion.js +0 -62
- package/dist/components/Accordion/context.d.ts +0 -4
- package/dist/components/Accordion/context.js +0 -10
- package/dist/components/Accordion/types.d.ts +0 -73
- package/dist/components/Accordion/types.js +0 -2
- package/dist/components/AppBar/AppBar.d.ts +0 -9
- package/dist/components/AppBar/AppBar.js +0 -52
- package/dist/components/AppBar/types.d.ts +0 -63
- package/dist/components/AppBar/types.js +0 -1
- package/dist/components/Avatar/Avatar.d.ts +0 -3
- package/dist/components/Avatar/Avatar.js +0 -28
- package/dist/components/Avatar/types.d.ts +0 -36
- package/dist/components/Avatar/types.js +0 -1
- package/dist/components/FileUpload/FileUpload.d.ts +0 -3
- package/dist/components/FileUpload/FileUpload.js +0 -41
- package/dist/components/FileUpload/types.d.ts +0 -73
- package/dist/components/FileUpload/types.js +0 -1
- package/dist/components/Navigation/Navigation.d.ts +0 -10
- package/dist/components/Navigation/Navigation.js +0 -92
- package/dist/components/Navigation/context.d.ts +0 -2
- package/dist/components/Navigation/context.js +0 -7
- package/dist/components/Navigation/types.d.ts +0 -132
- package/dist/components/Navigation/types.js +0 -2
- package/dist/components/Pagination/Pagination.d.ts +0 -3
- package/dist/components/Pagination/Pagination.js +0 -39
- package/dist/components/Pagination/types.d.ts +0 -56
- package/dist/components/Pagination/types.js +0 -1
- package/dist/components/Progress/Progress.d.ts +0 -3
- package/dist/components/Progress/Progress.js +0 -28
- package/dist/components/Progress/types.d.ts +0 -44
- package/dist/components/Progress/types.js +0 -1
- package/dist/components/ProgressRing/ProgressRing.d.ts +0 -3
- package/dist/components/ProgressRing/ProgressRing.js +0 -34
- package/dist/components/ProgressRing/types.d.ts +0 -53
- package/dist/components/ProgressRing/types.js +0 -1
- package/dist/components/Rating/Rating.d.ts +0 -3
- package/dist/components/Rating/Rating.js +0 -50
- package/dist/components/Rating/types.d.ts +0 -36
- package/dist/components/Rating/types.js +0 -1
- package/dist/components/Segment/Segment.d.ts +0 -5
- package/dist/components/Segment/Segment.js +0 -58
- package/dist/components/Segment/context.d.ts +0 -2
- package/dist/components/Segment/context.js +0 -5
- package/dist/components/Segment/types.d.ts +0 -59
- package/dist/components/Segment/types.js +0 -2
- package/dist/components/Slider/Slider.d.ts +0 -3
- package/dist/components/Slider/Slider.js +0 -39
- package/dist/components/Slider/types.d.ts +0 -66
- package/dist/components/Slider/types.js +0 -1
- package/dist/components/Switch/Switch.d.ts +0 -3
- package/dist/components/Switch/Switch.js +0 -40
- package/dist/components/Switch/types.d.ts +0 -62
- package/dist/components/Switch/types.js +0 -1
- package/dist/components/Tabs/Tabs.d.ts +0 -12
- package/dist/components/Tabs/Tabs.js +0 -80
- package/dist/components/Tabs/context.d.ts +0 -2
- package/dist/components/Tabs/context.js +0 -5
- package/dist/components/Tabs/types.d.ts +0 -64
- package/dist/components/Tabs/types.js +0 -1
- package/dist/components/TagsInput/TagsInput.d.ts +0 -3
- package/dist/components/TagsInput/TagsInput.js +0 -39
- package/dist/components/TagsInput/types.d.ts +0 -40
- package/dist/components/TagsInput/types.js +0 -1
- package/dist/components/Toast/Toast.d.ts +0 -2
- package/dist/components/Toast/Toast.js +0 -49
- package/dist/components/Toast/Toaster.d.ts +0 -2
- package/dist/components/Toast/Toaster.js +0 -28
- package/dist/components/Toast/create-toaster.d.ts +0 -2
- package/dist/components/Toast/create-toaster.js +0 -4
- package/dist/components/Toast/types.d.ts +0 -46
- package/dist/components/Toast/types.js +0 -1
- package/dist/composed/accordion/anatomy/accordion-content.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-content.js +0 -14
- package/dist/composed/accordion/anatomy/accordion-heading.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-heading.js +0 -6
- package/dist/composed/accordion/anatomy/accordion-indicator.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-indicator.js +0 -11
- package/dist/composed/accordion/anatomy/accordion-item.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-item.js +0 -13
- package/dist/composed/accordion/anatomy/accordion-root.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-root.js +0 -19
- package/dist/composed/accordion/anatomy/accordion-trigger.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-trigger.js +0 -14
- package/dist/composed/accordion/index.d.ts +0 -2
- package/dist/composed/accordion/index.js +0 -2
- package/dist/composed/accordion/modules/anatomy.d.ts +0 -14
- package/dist/composed/accordion/modules/anatomy.js +0 -14
- package/dist/composed/accordion/modules/context.d.ts +0 -4
- package/dist/composed/accordion/modules/context.js +0 -5
- package/dist/composed/accordion/modules/types.d.ts +0 -28
- package/dist/composed/accordion/modules/types.js +0 -1
- package/dist/composed/avatar/anatomy/avatar-fallback.d.ts +0 -2
- package/dist/composed/avatar/anatomy/avatar-fallback.js +0 -13
- package/dist/composed/avatar/anatomy/avatar-image.d.ts +0 -2
- package/dist/composed/avatar/anatomy/avatar-image.js +0 -13
- package/dist/composed/avatar/anatomy/avatar-root.d.ts +0 -2
- package/dist/composed/avatar/anatomy/avatar-root.js +0 -19
- package/dist/composed/avatar/index.d.ts +0 -2
- package/dist/composed/avatar/index.js +0 -2
- package/dist/composed/avatar/modules/anatomy.d.ts +0 -8
- package/dist/composed/avatar/modules/anatomy.js +0 -8
- package/dist/composed/avatar/modules/context.d.ts +0 -3
- package/dist/composed/avatar/modules/context.js +0 -3
- package/dist/composed/avatar/modules/types.d.ts +0 -13
- package/dist/composed/avatar/modules/types.js +0 -1
- package/dist/composed/index.d.ts +0 -2
- package/dist/composed/index.js +0 -2
- package/dist/internal/props-with-child.d.ts +0 -7
- package/dist/internal/props-with-child.js +0 -1
package/dist/index.css
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import * as accordion from "@zag-js/accordion";
|
|
2
|
+
import * as react2 from "react";
|
|
3
|
+
import { ComponentProps, JSX, PropsWithChildren } from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import * as avatar from "@zag-js/avatar";
|
|
6
|
+
|
|
7
|
+
//#region src/internal/props-with-child.d.ts
|
|
8
|
+
interface PropsWithElement {
|
|
9
|
+
element?: (...args: [{
|
|
10
|
+
attributes: Record<string, unknown>;
|
|
11
|
+
}]) => JSX.Element | null;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/components/accordion/modules/types.d.ts
|
|
15
|
+
interface AccordionRootProps extends PropsWithChildren, PropsWithElement, Omit<accordion.Props, 'id'>, Omit<ComponentProps<'div'>, 'id' | 'defaultValue' | 'dir'> {}
|
|
16
|
+
interface AccordionItemProps extends PropsWithChildren, PropsWithElement, accordion.ItemProps, ComponentProps<'div'> {}
|
|
17
|
+
interface AccordionTriggerProps extends PropsWithChildren, PropsWithElement, ComponentProps<'button'> {}
|
|
18
|
+
interface AccordionHeadingProps extends PropsWithChildren, PropsWithElement, ComponentProps<'h3'> {
|
|
19
|
+
/**
|
|
20
|
+
* The level of the heading. This is used to determine the heading level for accessibility purposes.
|
|
21
|
+
*
|
|
22
|
+
* @defaultValue 3
|
|
23
|
+
*/
|
|
24
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
25
|
+
}
|
|
26
|
+
interface AccordionIndicatorProps extends PropsWithChildren, PropsWithElement, ComponentProps<'div'> {}
|
|
27
|
+
interface AccordionContentProps extends PropsWithChildren, PropsWithElement, ComponentProps<'div'> {}
|
|
28
|
+
interface AccordionContext {
|
|
29
|
+
api: accordion.Api;
|
|
30
|
+
}
|
|
31
|
+
interface AccordionItemContext {
|
|
32
|
+
itemProps: accordion.ItemProps;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/components/accordion/anatomy/accordion-root.d.ts
|
|
36
|
+
declare function export_default$3(props: AccordionRootProps): react_jsx_runtime0.JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/accordion/anatomy/accordion-item.d.ts
|
|
39
|
+
declare function export_default$4(props: AccordionItemProps): react_jsx_runtime0.JSX.Element;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/accordion/anatomy/accordion-heading.d.ts
|
|
42
|
+
declare function export_default$5(props: AccordionHeadingProps): JSX.Element | null;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/components/accordion/anatomy/accordion-trigger.d.ts
|
|
45
|
+
declare function export_default$6(props: AccordionTriggerProps): react2.JSX.Element | null;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/components/accordion/anatomy/accordion-indicator.d.ts
|
|
48
|
+
declare function export_default$7(props: AccordionIndicatorProps): react2.JSX.Element | null;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/components/accordion/anatomy/accordion-content.d.ts
|
|
51
|
+
declare function export_default$8(props: AccordionContentProps): react2.JSX.Element | null;
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/components/accordion/modules/anatomy.d.ts
|
|
54
|
+
declare const Accordion: typeof export_default$3 & {
|
|
55
|
+
Item: typeof export_default$4;
|
|
56
|
+
Heading: typeof export_default$5;
|
|
57
|
+
Trigger: typeof export_default$6;
|
|
58
|
+
Indicator: typeof export_default$7;
|
|
59
|
+
Content: typeof export_default$8;
|
|
60
|
+
};
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/components/avatar/modules/types.d.ts
|
|
63
|
+
interface AvatarRootProps extends PropsWithChildren, PropsWithElement, Omit<avatar.Props, 'id'>, Omit<ComponentProps<'div'>, 'id' | 'dir'> {}
|
|
64
|
+
interface AvatarImageProps extends PropsWithElement, ComponentProps<'img'> {}
|
|
65
|
+
interface AvatarFallbackProps extends PropsWithChildren, PropsWithElement, ComponentProps<'span'> {}
|
|
66
|
+
interface AvatarRootContext {
|
|
67
|
+
api: avatar.Api;
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/components/avatar/anatomy/avatar-root.d.ts
|
|
71
|
+
declare function export_default(props: AvatarRootProps): react_jsx_runtime0.JSX.Element;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/components/avatar/anatomy/avatar-image.d.ts
|
|
74
|
+
declare function export_default$1(props: AvatarImageProps): react2.JSX.Element | null;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/components/avatar/anatomy/avatar-fallback.d.ts
|
|
77
|
+
declare function export_default$2(props: AvatarFallbackProps): react2.JSX.Element | null;
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/components/avatar/modules/anatomy.d.ts
|
|
80
|
+
declare const Avatar: typeof export_default & {
|
|
81
|
+
Image: typeof export_default$1;
|
|
82
|
+
Fallback: typeof export_default$2;
|
|
83
|
+
};
|
|
84
|
+
//#endregion
|
|
85
|
+
export { Accordion, type AccordionContentProps, type AccordionContext, type AccordionHeadingProps, type AccordionIndicatorProps, type AccordionItemContext, type AccordionItemProps, type AccordionRootProps, type AccordionTriggerProps, Avatar, type AvatarFallbackProps, type AvatarImageProps, type AvatarRootContext, type AvatarRootProps };
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,162 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import * as accordion from "@zag-js/accordion";
|
|
2
|
+
import { createContext, useContext, useId } from "react";
|
|
3
|
+
import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
|
|
4
|
+
import { classesAccordion, classesAvatar } from "@skeletonlabs/skeleton-common";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import * as avatar from "@zag-js/avatar";
|
|
7
|
+
|
|
8
|
+
//#region src/components/accordion/modules/context.ts
|
|
9
|
+
const AccordionRootContext = createContext(null);
|
|
10
|
+
const AccordionItemContext = createContext(null);
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/accordion/anatomy/accordion-root.tsx
|
|
14
|
+
function accordion_root_default(props) {
|
|
15
|
+
const [machineProps, componentProps] = accordion.splitProps(props);
|
|
16
|
+
const { element, children,...restAttributes } = componentProps;
|
|
17
|
+
const service = useMachine(accordion.machine, {
|
|
18
|
+
id: useId(),
|
|
19
|
+
...machineProps
|
|
20
|
+
});
|
|
21
|
+
const api = accordion.connect(service, normalizeProps);
|
|
22
|
+
const attributes = mergeProps(api.getRootProps(), { className: classesAccordion.root }, restAttributes);
|
|
23
|
+
return /* @__PURE__ */ jsx(AccordionRootContext.Provider, {
|
|
24
|
+
value: { api },
|
|
25
|
+
children: element ? element({ attributes }) : /* @__PURE__ */ jsx("div", {
|
|
26
|
+
...attributes,
|
|
27
|
+
children
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/accordion/anatomy/accordion-item.tsx
|
|
34
|
+
function accordion_item_default(props) {
|
|
35
|
+
const rootContext = useContext(AccordionRootContext);
|
|
36
|
+
const [itemProps, componentProps] = accordion.splitItemProps(props);
|
|
37
|
+
const { element, children,...restAttributes } = componentProps;
|
|
38
|
+
const attributes = mergeProps(rootContext.api.getItemProps(itemProps), { className: classesAccordion.item }, restAttributes);
|
|
39
|
+
return /* @__PURE__ */ jsx(AccordionItemContext.Provider, {
|
|
40
|
+
value: { itemProps },
|
|
41
|
+
children: element ? element({ attributes }) : /* @__PURE__ */ jsx("div", {
|
|
42
|
+
...attributes,
|
|
43
|
+
children
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/components/accordion/anatomy/accordion-heading.tsx
|
|
50
|
+
function accordion_heading_default(props) {
|
|
51
|
+
const { level = 3, element, children,...restAttributes } = props;
|
|
52
|
+
const Tag = `h${level}`;
|
|
53
|
+
const attributes = mergeProps({ className: classesAccordion.heading }, restAttributes);
|
|
54
|
+
return element ? element({ attributes }) : /* @__PURE__ */ jsx(Tag, {
|
|
55
|
+
...attributes,
|
|
56
|
+
children
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/components/accordion/anatomy/accordion-trigger.tsx
|
|
62
|
+
function accordion_trigger_default(props) {
|
|
63
|
+
const rootContext = useContext(AccordionRootContext);
|
|
64
|
+
const itemContext = useContext(AccordionItemContext);
|
|
65
|
+
const { element, children,...restAttributes } = props;
|
|
66
|
+
const attributes = mergeProps(rootContext.api.getItemTriggerProps(itemContext.itemProps), { className: classesAccordion.trigger }, restAttributes);
|
|
67
|
+
return element ? element({ attributes }) : /* @__PURE__ */ jsx("button", {
|
|
68
|
+
...attributes,
|
|
69
|
+
children
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/components/accordion/anatomy/accordion-indicator.tsx
|
|
75
|
+
function accordion_indicator_default(props) {
|
|
76
|
+
const rootContext = useContext(AccordionRootContext);
|
|
77
|
+
const itemContext = useContext(AccordionItemContext);
|
|
78
|
+
const { element, children,...restAttributes } = props;
|
|
79
|
+
const attributes = mergeProps(rootContext.api.getItemIndicatorProps(itemContext.itemProps), { className: classesAccordion.indicator }, restAttributes);
|
|
80
|
+
return element ? element({ attributes }) : /* @__PURE__ */ jsx("div", {
|
|
81
|
+
...attributes,
|
|
82
|
+
children
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/components/accordion/anatomy/accordion-content.tsx
|
|
88
|
+
function accordion_content_default(props) {
|
|
89
|
+
const rootContext = useContext(AccordionRootContext);
|
|
90
|
+
const itemContext = useContext(AccordionItemContext);
|
|
91
|
+
const { element, children,...restAttributes } = props;
|
|
92
|
+
const attributes = mergeProps(rootContext.api.getItemContentProps(itemContext.itemProps), { className: classesAccordion.content }, restAttributes);
|
|
93
|
+
return element ? element({ attributes }) : /* @__PURE__ */ jsx("div", {
|
|
94
|
+
...attributes,
|
|
95
|
+
children
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/components/accordion/modules/anatomy.ts
|
|
101
|
+
const Accordion = Object.assign(accordion_root_default, {
|
|
102
|
+
Item: accordion_item_default,
|
|
103
|
+
Heading: accordion_heading_default,
|
|
104
|
+
Trigger: accordion_trigger_default,
|
|
105
|
+
Indicator: accordion_indicator_default,
|
|
106
|
+
Content: accordion_content_default
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/components/avatar/modules/context.ts
|
|
111
|
+
const AvatarRootContext = createContext(null);
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/components/avatar/anatomy/avatar-root.tsx
|
|
115
|
+
function avatar_root_default(props) {
|
|
116
|
+
const [machineProps, componentProps] = avatar.splitProps(props);
|
|
117
|
+
const { element, children,...restAttributes } = componentProps;
|
|
118
|
+
const service = useMachine(avatar.machine, {
|
|
119
|
+
id: useId(),
|
|
120
|
+
...machineProps
|
|
121
|
+
});
|
|
122
|
+
const api = avatar.connect(service, normalizeProps);
|
|
123
|
+
const attributes = mergeProps(api.getRootProps(), { className: classesAvatar.root }, restAttributes);
|
|
124
|
+
return /* @__PURE__ */ jsx(AvatarRootContext.Provider, {
|
|
125
|
+
value: { api },
|
|
126
|
+
children: element ? element({ attributes }) : /* @__PURE__ */ jsx("div", {
|
|
127
|
+
...attributes,
|
|
128
|
+
children
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/components/avatar/anatomy/avatar-image.tsx
|
|
135
|
+
function avatar_image_default(props) {
|
|
136
|
+
const rootContext = useContext(AvatarRootContext);
|
|
137
|
+
const { element,...restAttributes } = props;
|
|
138
|
+
const attributes = mergeProps(rootContext.api.getImageProps(), { className: classesAvatar.image }, restAttributes);
|
|
139
|
+
return element ? element({ attributes }) : /* @__PURE__ */ jsx("img", { ...attributes });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/components/avatar/anatomy/avatar-fallback.tsx
|
|
144
|
+
function avatar_fallback_default(props) {
|
|
145
|
+
const rootContext = useContext(AvatarRootContext);
|
|
146
|
+
const { element, children,...restAttributes } = props;
|
|
147
|
+
const attributes = mergeProps(rootContext.api.getFallbackProps(), { className: classesAvatar.fallback }, restAttributes);
|
|
148
|
+
return element ? element({ attributes }) : /* @__PURE__ */ jsx("span", {
|
|
149
|
+
...attributes,
|
|
150
|
+
children
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/components/avatar/modules/anatomy.ts
|
|
156
|
+
const Avatar = Object.assign(avatar_root_default, {
|
|
157
|
+
Image: avatar_image_default,
|
|
158
|
+
Fallback: avatar_fallback_default
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
//#endregion
|
|
162
|
+
export { Accordion, Avatar };
|
package/package.json
CHANGED
|
@@ -1,58 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skeletonlabs/skeleton-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-next.1",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
5
6
|
"types": "./dist/index.d.ts",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"./composed": {
|
|
12
|
-
"types": "./dist/composed/index.d.ts",
|
|
13
|
-
"default": "./dist/composed/index.js"
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"style": "./dist/index.css"
|
|
14
12
|
}
|
|
15
13
|
},
|
|
16
14
|
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
"!dist/**/*.test.*"
|
|
15
|
+
"dist"
|
|
19
16
|
],
|
|
20
17
|
"dependencies": {
|
|
21
|
-
"@zag-js/accordion": "^1.
|
|
22
|
-
"@zag-js/avatar": "^1.
|
|
23
|
-
"@zag-js/file-upload": "^1.
|
|
24
|
-
"@zag-js/pagination": "^1.
|
|
25
|
-
"@zag-js/progress": "^1.
|
|
26
|
-
"@zag-js/radio-group": "^1.
|
|
27
|
-
"@zag-js/rating-group": "^1.
|
|
28
|
-
"@zag-js/react": "^1.
|
|
29
|
-
"@zag-js/slider": "^1.
|
|
30
|
-
"@zag-js/switch": "^1.
|
|
31
|
-
"@zag-js/tabs": "^1.
|
|
32
|
-
"@zag-js/tags-input": "^1.
|
|
33
|
-
"@zag-js/toast": "^1.
|
|
18
|
+
"@zag-js/accordion": "^1.22.1",
|
|
19
|
+
"@zag-js/avatar": "^1.22.1",
|
|
20
|
+
"@zag-js/file-upload": "^1.22.1",
|
|
21
|
+
"@zag-js/pagination": "^1.22.1",
|
|
22
|
+
"@zag-js/progress": "^1.22.1",
|
|
23
|
+
"@zag-js/radio-group": "^1.22.1",
|
|
24
|
+
"@zag-js/rating-group": "^1.22.1",
|
|
25
|
+
"@zag-js/react": "^1.22.1",
|
|
26
|
+
"@zag-js/slider": "^1.22.1",
|
|
27
|
+
"@zag-js/switch": "^1.22.1",
|
|
28
|
+
"@zag-js/tabs": "^1.22.1",
|
|
29
|
+
"@zag-js/tags-input": "^1.22.1",
|
|
30
|
+
"@zag-js/toast": "^1.22.1",
|
|
31
|
+
"@skeletonlabs/skeleton-common": "1.0.0-next.1"
|
|
34
32
|
},
|
|
35
33
|
"peerDependencies": {
|
|
36
34
|
"react": "^18.0.0 || ^19.0.0",
|
|
37
35
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
38
36
|
},
|
|
39
37
|
"devDependencies": {
|
|
40
|
-
"@testing-library/jest-dom": "^6.
|
|
38
|
+
"@testing-library/jest-dom": "^6.8.0",
|
|
41
39
|
"@testing-library/react": "^16.3.0",
|
|
42
40
|
"@testing-library/user-event": "^14.6.1",
|
|
43
|
-
"@types/react": "^19.1.
|
|
44
|
-
"@types/react-dom": "^19.1.
|
|
45
|
-
"@vitejs/plugin-react": "^
|
|
41
|
+
"@types/react": "^19.1.12",
|
|
42
|
+
"@types/react-dom": "^19.1.9",
|
|
43
|
+
"@vitejs/plugin-react": "^5.0.2",
|
|
46
44
|
"jsdom": "^26.1.0",
|
|
47
|
-
"react": "^19.1.
|
|
48
|
-
"react-dom": "^19.1.
|
|
49
|
-
"
|
|
50
|
-
"
|
|
45
|
+
"react": "^19.1.1",
|
|
46
|
+
"react-dom": "^19.1.1",
|
|
47
|
+
"tsdown": "^0.14.2",
|
|
48
|
+
"typescript": "^5.9.2",
|
|
49
|
+
"vite": "^7.1.3",
|
|
51
50
|
"vitest": "^3.2.4"
|
|
52
51
|
},
|
|
53
52
|
"scripts": {
|
|
54
|
-
"build": "
|
|
55
|
-
"dev": "
|
|
53
|
+
"build": "tsdown",
|
|
54
|
+
"dev": "tsdown --watch",
|
|
56
55
|
"test": "vitest run",
|
|
57
56
|
"test:watch": "vitest run --watch"
|
|
58
57
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
import type { AccordionControlProps, AccordionItemProps, AccordionPanelProps, AccordionProps } from './types.js';
|
|
3
|
-
export declare const Accordion: FC<AccordionProps> & {
|
|
4
|
-
Item: FC<AccordionItemProps>;
|
|
5
|
-
Control: FC<AccordionControlProps>;
|
|
6
|
-
Panel: FC<AccordionPanelProps>;
|
|
7
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useContext, useId } from 'react';
|
|
4
|
-
import * as accordion from '@zag-js/accordion';
|
|
5
|
-
import { useMachine, normalizeProps } from '@zag-js/react';
|
|
6
|
-
import { AccordionContext, AccordionItemContext } from './context.js';
|
|
7
|
-
// Components ---
|
|
8
|
-
const AccordionRoot = ({
|
|
9
|
-
// Root
|
|
10
|
-
base = '', padding = '', spaceY = 'space-y-2', rounded = 'rounded-base', width = 'w-full', classes = '',
|
|
11
|
-
// Icons
|
|
12
|
-
iconOpen = '-', iconClosed = '+',
|
|
13
|
-
// Children
|
|
14
|
-
children,
|
|
15
|
-
// Zag
|
|
16
|
-
...zagProps }) => {
|
|
17
|
-
// Zag
|
|
18
|
-
const service = useMachine(accordion.machine, {
|
|
19
|
-
id: useId(),
|
|
20
|
-
...zagProps
|
|
21
|
-
});
|
|
22
|
-
const api = accordion.connect(service, normalizeProps);
|
|
23
|
-
return (_jsx("div", { className: `${base} ${padding} ${spaceY} ${rounded} ${width} ${classes}`, ...api.getRootProps(), "data-testid": "accordion", children: _jsx(AccordionContext.Provider, { value: { iconOpen, iconClosed, api }, children: children }) }));
|
|
24
|
-
};
|
|
25
|
-
const AccordionItem = ({ base = '', spaceY = '', classes = '',
|
|
26
|
-
// Children
|
|
27
|
-
children, ...zagProps }) => {
|
|
28
|
-
const ctx = useContext(AccordionContext);
|
|
29
|
-
return (_jsx(AccordionItemContext.Provider, { value: zagProps, children: _jsx("div", { className: `${base} ${spaceY} ${classes}`, ...ctx?.api.getItemProps(zagProps), "data-testid": "accordion-item", children: children }) }));
|
|
30
|
-
};
|
|
31
|
-
const AccordionControl = ({ headingLevel = 3,
|
|
32
|
-
// Control
|
|
33
|
-
base = 'flex text-start items-center space-x-4 w-full', hover = 'hover:preset-tonal-primary', padding = 'py-2 px-4', rounded = 'rounded-base', classes = '',
|
|
34
|
-
// Lead
|
|
35
|
-
leadBase = '', leadClasses = '',
|
|
36
|
-
// Content
|
|
37
|
-
contentBase = 'flex-1', contentClasses = '',
|
|
38
|
-
// Indicator
|
|
39
|
-
indicatorBase = '', indicatorClasses = '',
|
|
40
|
-
// Icons
|
|
41
|
-
lead,
|
|
42
|
-
// Children
|
|
43
|
-
children }) => {
|
|
44
|
-
const ctx = useContext(AccordionContext);
|
|
45
|
-
const itemCtx = useContext(AccordionItemContext);
|
|
46
|
-
const HeadingElement = `h${headingLevel}`;
|
|
47
|
-
return (_jsx(HeadingElement, { children: _jsxs("button", { className: `${base} ${hover} ${padding} ${rounded} ${classes}`, ...ctx.api.getItemTriggerProps(itemCtx), "data-testid": "accordion-control", children: [lead && (_jsx("div", { className: `${leadBase} ${leadClasses}`, "data-testid": "accordion-lead", children: lead })), _jsx("div", { className: `${contentBase} ${contentClasses}`, "data-testid": "accordion-content", children: children }), _jsx("div", { className: `${indicatorBase} ${indicatorClasses}`, "data-testid": "accordion-indicator", children: ctx.api.value.includes(itemCtx.value) ? ctx.iconOpen : ctx.iconClosed })] }) }));
|
|
48
|
-
};
|
|
49
|
-
const AccordionPanel = ({
|
|
50
|
-
// Panel
|
|
51
|
-
base = '', padding = 'py-2 px-4', rounded = '', classes = '',
|
|
52
|
-
// Children
|
|
53
|
-
children }) => {
|
|
54
|
-
const ctx = useContext(AccordionContext);
|
|
55
|
-
const itemCtx = useContext(AccordionItemContext);
|
|
56
|
-
return (ctx.api.value.includes(itemCtx.value) && (_jsx("div", { ...ctx.api.getItemContentProps(itemCtx), className: `${base} ${padding} ${rounded} ${classes}`, "data-testid": "accordion-panel", children: children })));
|
|
57
|
-
};
|
|
58
|
-
export const Accordion = /* @__PURE__ */ Object.assign(AccordionRoot, {
|
|
59
|
-
Item: AccordionItem,
|
|
60
|
-
Control: AccordionControl,
|
|
61
|
-
Panel: AccordionPanel
|
|
62
|
-
});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { AccordionContextState } from './types.js';
|
|
2
|
-
import type * as accordion from '@zag-js/accordion';
|
|
3
|
-
export declare const AccordionContext: import("react").Context<AccordionContextState>;
|
|
4
|
-
export declare const AccordionItemContext: import("react").Context<accordion.ItemProps>;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React, { type ReactNode } from 'react';
|
|
2
|
-
import * as accordion from '@zag-js/accordion';
|
|
3
|
-
export interface AccordionContextState extends Pick<AccordionProps, 'iconOpen' | 'iconClosed'> {
|
|
4
|
-
api: ReturnType<typeof accordion.connect>;
|
|
5
|
-
}
|
|
6
|
-
export interface AccordionItemContextState {
|
|
7
|
-
id: string;
|
|
8
|
-
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
9
|
-
}
|
|
10
|
-
export interface AccordionProps extends React.PropsWithChildren, Omit<accordion.Props, 'id' | 'orientation'> {
|
|
11
|
-
/** Set the open state icon. */
|
|
12
|
-
iconOpen?: ReactNode;
|
|
13
|
-
/** Set the closed state icon. */
|
|
14
|
-
iconClosed?: ReactNode;
|
|
15
|
-
/** Sets base styles. */
|
|
16
|
-
base?: string;
|
|
17
|
-
/** Set padding styles. */
|
|
18
|
-
padding?: string;
|
|
19
|
-
/** Set vertical spacing styles. */
|
|
20
|
-
spaceY?: string;
|
|
21
|
-
/** Set border radius styles. */
|
|
22
|
-
rounded?: string;
|
|
23
|
-
/** Set the width styles. */
|
|
24
|
-
width?: string;
|
|
25
|
-
/** Provide arbitrary CSS classes. */
|
|
26
|
-
classes?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface AccordionItemProps extends React.PropsWithChildren, accordion.ItemProps {
|
|
29
|
-
/** Sets base styles. */
|
|
30
|
-
base?: string;
|
|
31
|
-
/** Set vertical spacing styles. */
|
|
32
|
-
spaceY?: string;
|
|
33
|
-
/** Provide arbitrary CSS classes. */
|
|
34
|
-
classes?: string;
|
|
35
|
-
}
|
|
36
|
-
export interface AccordionControlProps extends React.PropsWithChildren {
|
|
37
|
-
/** The heading level. */
|
|
38
|
-
headingLevel?: number;
|
|
39
|
-
/** Sets control's base styles. */
|
|
40
|
-
base?: string;
|
|
41
|
-
/** Sets control's the hover styles. */
|
|
42
|
-
hover?: string;
|
|
43
|
-
/** Sets control's the padding styles. */
|
|
44
|
-
padding?: string;
|
|
45
|
-
/** Sets control's the border radius styles. */
|
|
46
|
-
rounded?: string;
|
|
47
|
-
/** Provide arbitrary CSS classes to the control. */
|
|
48
|
-
classes?: string;
|
|
49
|
-
/** Sets the lead's base styles */
|
|
50
|
-
leadBase?: string;
|
|
51
|
-
/** Provide arbitrary CSS classes to the lead. */
|
|
52
|
-
leadClasses?: string;
|
|
53
|
-
/** Sets the lead's base styles */
|
|
54
|
-
contentBase?: string;
|
|
55
|
-
/** Provide arbitrary CSS classes to the content. */
|
|
56
|
-
contentClasses?: string;
|
|
57
|
-
/** Sets the lead's base styles */
|
|
58
|
-
indicatorBase?: string;
|
|
59
|
-
/** Provide arbitrary CSS classes to the indicator. */
|
|
60
|
-
indicatorClasses?: string;
|
|
61
|
-
/** The lead child slot for the control. */
|
|
62
|
-
lead?: ReactNode;
|
|
63
|
-
}
|
|
64
|
-
export interface AccordionPanelProps extends React.PropsWithChildren {
|
|
65
|
-
/** Set the panel's base styles. */
|
|
66
|
-
base?: string;
|
|
67
|
-
/** Set the panel's padding styles. */
|
|
68
|
-
padding?: string;
|
|
69
|
-
/** Set the panel's border-radius styles. */
|
|
70
|
-
rounded?: string;
|
|
71
|
-
/** Provide arbitrary CSS classes to the panel. */
|
|
72
|
-
classes?: string;
|
|
73
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
import type { ToolbarCenterProps, AppBarHeadlineProps, ToolbarLeadProps, AppBarProps, ToolBarProps, ToolbarTrailProps } from './types.js';
|
|
3
|
-
export declare const AppBar: FC<AppBarProps> & {
|
|
4
|
-
Toolbar: FC<ToolBarProps>;
|
|
5
|
-
ToolbarLead: FC<ToolbarLeadProps>;
|
|
6
|
-
ToolbarCenter: FC<ToolbarCenterProps>;
|
|
7
|
-
ToolbarTrail: FC<ToolbarTrailProps>;
|
|
8
|
-
Headline: FC<AppBarHeadlineProps>;
|
|
9
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
// Components ---
|
|
4
|
-
const AppBarRoot = ({
|
|
5
|
-
// Root
|
|
6
|
-
base = 'w-full flex flex-col', background = 'bg-surface-100-900', spaceY = 'space-y-4', border = '', padding = 'p-4', shadow = '', classes = '',
|
|
7
|
-
// Children
|
|
8
|
-
children }) => {
|
|
9
|
-
return (_jsx("div", { className: `${base} ${background} ${spaceY} ${border} ${padding} ${shadow} ${classes}`, "data-testid": "app-bar", children: children }));
|
|
10
|
-
};
|
|
11
|
-
const Toolbar = ({
|
|
12
|
-
// Toolbar
|
|
13
|
-
base = 'flex justify-between', gridCols = 'grid-cols-[auto_1fr_auto]', gap = 'gap-4', classes = '',
|
|
14
|
-
// Children
|
|
15
|
-
children }) => {
|
|
16
|
-
return (_jsx("div", { className: `${base} ${gridCols} ${gap} ${classes}`, "data-testid": "app-bar-toolbar", children: children }));
|
|
17
|
-
};
|
|
18
|
-
const ToolbarLead = ({
|
|
19
|
-
// Lead
|
|
20
|
-
base = 'flex', spaceX = 'space-x-4 rtl:space-x-reverse', padding = '', classes = '',
|
|
21
|
-
// Children
|
|
22
|
-
children }) => {
|
|
23
|
-
return (_jsx("div", { className: `${base} ${spaceX} ${padding} ${classes}`, "data-testid": "app-bar-toolbar-lead", children: children }));
|
|
24
|
-
};
|
|
25
|
-
const ToolbarCenter = ({
|
|
26
|
-
// Center
|
|
27
|
-
base = 'grow', align = 'text-center', padding = '', classes = '',
|
|
28
|
-
// Children
|
|
29
|
-
children }) => {
|
|
30
|
-
return (_jsx("div", { className: `${base} ${align} ${padding} ${classes}`, "data-testid": "app-bar-toolbar-center", children: children }));
|
|
31
|
-
};
|
|
32
|
-
const ToolbarTrail = ({
|
|
33
|
-
// Trail
|
|
34
|
-
base = 'flex', spaceX = 'space-x-4 rtl:space-x-reverse', padding = '', classes = '',
|
|
35
|
-
// Children
|
|
36
|
-
children }) => {
|
|
37
|
-
return (_jsx("div", { className: `${base} ${spaceX} ${padding} ${classes}`, "data-testid": "app-bar-toolbar-trail", children: children }));
|
|
38
|
-
};
|
|
39
|
-
const AppBarHeadline = ({
|
|
40
|
-
// Headline
|
|
41
|
-
base = 'w-full', classes = '',
|
|
42
|
-
// Children
|
|
43
|
-
children }) => {
|
|
44
|
-
return (_jsx("div", { className: `${base} ${classes}`, "data-testid": "app-bar-headline", children: children }));
|
|
45
|
-
};
|
|
46
|
-
export const AppBar = /* @__PURE__ */ Object.assign(AppBarRoot, {
|
|
47
|
-
Toolbar: Toolbar,
|
|
48
|
-
ToolbarLead: ToolbarLead,
|
|
49
|
-
ToolbarCenter: ToolbarCenter,
|
|
50
|
-
ToolbarTrail: ToolbarTrail,
|
|
51
|
-
Headline: AppBarHeadline
|
|
52
|
-
});
|