@skeletonlabs/skeleton-react 1.5.0-next.0 → 2.0.0-next.2

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.
Files changed (192) hide show
  1. package/dist/components/accordion/anatomy/accordion-content.d.ts +9 -0
  2. package/dist/components/accordion/anatomy/accordion-content.js +24 -0
  3. package/dist/components/accordion/anatomy/accordion-heading.d.ts +16 -0
  4. package/dist/components/accordion/anatomy/accordion-heading.js +17 -0
  5. package/dist/components/accordion/anatomy/accordion-indicator.d.ts +9 -0
  6. package/dist/components/accordion/anatomy/accordion-indicator.js +21 -0
  7. package/dist/components/accordion/anatomy/accordion-item-context.d.ts +10 -0
  8. package/dist/components/accordion/anatomy/accordion-item-context.js +11 -0
  9. package/dist/components/accordion/anatomy/accordion-item.d.ts +10 -0
  10. package/dist/components/accordion/anatomy/accordion-item.js +28 -0
  11. package/dist/components/accordion/anatomy/accordion-root-context.d.ts +10 -0
  12. package/dist/components/accordion/anatomy/accordion-root-context.js +11 -0
  13. package/dist/components/accordion/anatomy/accordion-root.d.ts +10 -0
  14. package/dist/components/accordion/anatomy/accordion-root.js +28 -0
  15. package/dist/components/accordion/anatomy/accordion-trigger.d.ts +9 -0
  16. package/dist/components/accordion/anatomy/accordion-trigger.js +21 -0
  17. package/dist/components/accordion/index.js +3 -0
  18. package/dist/components/accordion/modules/accordion-anatomy.d.ts +21 -0
  19. package/dist/components/accordion/modules/accordion-anatomy.js +22 -0
  20. package/dist/components/accordion/modules/accordion-item-context.d.ts +10 -0
  21. package/dist/components/accordion/modules/accordion-item-context.js +7 -0
  22. package/dist/components/accordion/modules/accordion-root-context.d.ts +9 -0
  23. package/dist/components/accordion/modules/accordion-root-context.js +7 -0
  24. package/dist/components/avatar/anatomy/avatar-fallback.d.ts +9 -0
  25. package/dist/components/avatar/anatomy/avatar-fallback.js +22 -0
  26. package/dist/components/avatar/anatomy/avatar-image.d.ts +9 -0
  27. package/dist/components/avatar/anatomy/avatar-image.js +19 -0
  28. package/dist/components/avatar/anatomy/avatar-root-context.d.ts +10 -0
  29. package/dist/components/avatar/anatomy/avatar-root-context.js +11 -0
  30. package/dist/components/avatar/anatomy/avatar-root.d.ts +10 -0
  31. package/dist/components/avatar/anatomy/avatar-root.js +31 -0
  32. package/dist/components/avatar/index.js +3 -0
  33. package/dist/components/avatar/modules/avatar-anatomy.d.ts +13 -0
  34. package/dist/components/avatar/modules/avatar-anatomy.js +14 -0
  35. package/dist/components/avatar/modules/avatar-root-context.d.ts +9 -0
  36. package/dist/components/avatar/modules/avatar-root-context.js +7 -0
  37. package/dist/components/rating-group/anatomy/rating-group-control.d.ts +9 -0
  38. package/dist/components/rating-group/anatomy/rating-group-control.js +19 -0
  39. package/dist/components/rating-group/anatomy/rating-group-hidden-input.d.ts +9 -0
  40. package/dist/components/rating-group/anatomy/rating-group-hidden-input.js +16 -0
  41. package/dist/components/rating-group/anatomy/rating-group-item-context.d.ts +10 -0
  42. package/dist/components/rating-group/anatomy/rating-group-item-context.js +11 -0
  43. package/dist/components/rating-group/anatomy/rating-group-item.d.ts +29 -0
  44. package/dist/components/rating-group/anatomy/rating-group-item.js +29 -0
  45. package/dist/components/rating-group/anatomy/rating-group-label.d.ts +9 -0
  46. package/dist/components/rating-group/anatomy/rating-group-label.js +19 -0
  47. package/dist/components/rating-group/anatomy/rating-group-root-context.d.ts +10 -0
  48. package/dist/components/rating-group/anatomy/rating-group-root-context.js +11 -0
  49. package/dist/components/rating-group/anatomy/rating-group-root.d.ts +10 -0
  50. package/dist/components/rating-group/anatomy/rating-group-root.js +28 -0
  51. package/dist/components/rating-group/index.js +3 -0
  52. package/dist/components/rating-group/modules/rating-group-anatomy.d.ts +19 -0
  53. package/dist/components/rating-group/modules/rating-group-anatomy.js +20 -0
  54. package/dist/components/rating-group/modules/rating-group-item-context.d.ts +9 -0
  55. package/dist/components/rating-group/modules/rating-group-item-context.js +7 -0
  56. package/dist/components/rating-group/modules/rating-group-root-context.d.ts +9 -0
  57. package/dist/components/rating-group/modules/rating-group-root-context.js +7 -0
  58. package/dist/components/tabs/anatomy/tabs-content.d.ts +10 -0
  59. package/dist/components/tabs/anatomy/tabs-content.js +21 -0
  60. package/dist/components/tabs/anatomy/tabs-indicator.d.ts +9 -0
  61. package/dist/components/tabs/anatomy/tabs-indicator.js +16 -0
  62. package/dist/components/tabs/anatomy/tabs-list.d.ts +9 -0
  63. package/dist/components/tabs/anatomy/tabs-list.js +19 -0
  64. package/dist/components/tabs/anatomy/tabs-root-context.d.ts +10 -0
  65. package/dist/components/tabs/anatomy/tabs-root-context.js +11 -0
  66. package/dist/components/tabs/anatomy/tabs-root.d.ts +10 -0
  67. package/dist/components/tabs/anatomy/tabs-root.js +28 -0
  68. package/dist/components/tabs/anatomy/tabs-trigger.d.ts +10 -0
  69. package/dist/components/tabs/anatomy/tabs-trigger.js +21 -0
  70. package/dist/components/tabs/index.js +3 -0
  71. package/dist/components/tabs/modules/tabs-anatomy.d.ts +17 -0
  72. package/dist/components/tabs/modules/tabs-anatomy.js +18 -0
  73. package/dist/components/tabs/modules/tabs-root-context.d.ts +9 -0
  74. package/dist/components/tabs/modules/tabs-root-context.js +7 -0
  75. package/dist/index.css +2 -0
  76. package/dist/index.d.ts +36 -17
  77. package/dist/index.js +10 -17
  78. package/dist/internal/components/star-empty.js +22 -0
  79. package/dist/internal/components/star-full.js +20 -0
  80. package/dist/internal/components/star-half.js +36 -0
  81. package/dist/internal/props-with-element.d.ts +13 -0
  82. package/package.json +30 -33
  83. package/dist/components/Accordion/Accordion.d.ts +0 -7
  84. package/dist/components/Accordion/Accordion.js +0 -62
  85. package/dist/components/Accordion/context.d.ts +0 -4
  86. package/dist/components/Accordion/context.js +0 -10
  87. package/dist/components/Accordion/types.d.ts +0 -73
  88. package/dist/components/Accordion/types.js +0 -2
  89. package/dist/components/AppBar/AppBar.d.ts +0 -9
  90. package/dist/components/AppBar/AppBar.js +0 -52
  91. package/dist/components/AppBar/types.d.ts +0 -63
  92. package/dist/components/AppBar/types.js +0 -1
  93. package/dist/components/Avatar/Avatar.d.ts +0 -3
  94. package/dist/components/Avatar/Avatar.js +0 -28
  95. package/dist/components/Avatar/types.d.ts +0 -36
  96. package/dist/components/Avatar/types.js +0 -1
  97. package/dist/components/FileUpload/FileUpload.d.ts +0 -3
  98. package/dist/components/FileUpload/FileUpload.js +0 -41
  99. package/dist/components/FileUpload/types.d.ts +0 -73
  100. package/dist/components/FileUpload/types.js +0 -1
  101. package/dist/components/Navigation/Navigation.d.ts +0 -10
  102. package/dist/components/Navigation/Navigation.js +0 -92
  103. package/dist/components/Navigation/context.d.ts +0 -2
  104. package/dist/components/Navigation/context.js +0 -7
  105. package/dist/components/Navigation/types.d.ts +0 -132
  106. package/dist/components/Navigation/types.js +0 -2
  107. package/dist/components/Pagination/Pagination.d.ts +0 -3
  108. package/dist/components/Pagination/Pagination.js +0 -39
  109. package/dist/components/Pagination/types.d.ts +0 -56
  110. package/dist/components/Pagination/types.js +0 -1
  111. package/dist/components/Progress/Progress.d.ts +0 -3
  112. package/dist/components/Progress/Progress.js +0 -28
  113. package/dist/components/Progress/types.d.ts +0 -44
  114. package/dist/components/Progress/types.js +0 -1
  115. package/dist/components/ProgressRing/ProgressRing.d.ts +0 -3
  116. package/dist/components/ProgressRing/ProgressRing.js +0 -34
  117. package/dist/components/ProgressRing/types.d.ts +0 -53
  118. package/dist/components/ProgressRing/types.js +0 -1
  119. package/dist/components/Rating/Rating.d.ts +0 -3
  120. package/dist/components/Rating/Rating.js +0 -50
  121. package/dist/components/Rating/types.d.ts +0 -36
  122. package/dist/components/Rating/types.js +0 -1
  123. package/dist/components/Segment/Segment.d.ts +0 -5
  124. package/dist/components/Segment/Segment.js +0 -58
  125. package/dist/components/Segment/context.d.ts +0 -2
  126. package/dist/components/Segment/context.js +0 -5
  127. package/dist/components/Segment/types.d.ts +0 -59
  128. package/dist/components/Segment/types.js +0 -2
  129. package/dist/components/Slider/Slider.d.ts +0 -3
  130. package/dist/components/Slider/Slider.js +0 -39
  131. package/dist/components/Slider/types.d.ts +0 -66
  132. package/dist/components/Slider/types.js +0 -1
  133. package/dist/components/Switch/Switch.d.ts +0 -3
  134. package/dist/components/Switch/Switch.js +0 -40
  135. package/dist/components/Switch/types.d.ts +0 -62
  136. package/dist/components/Switch/types.js +0 -1
  137. package/dist/components/Tabs/Tabs.d.ts +0 -12
  138. package/dist/components/Tabs/Tabs.js +0 -80
  139. package/dist/components/Tabs/context.d.ts +0 -2
  140. package/dist/components/Tabs/context.js +0 -5
  141. package/dist/components/Tabs/types.d.ts +0 -64
  142. package/dist/components/Tabs/types.js +0 -1
  143. package/dist/components/TagsInput/TagsInput.d.ts +0 -3
  144. package/dist/components/TagsInput/TagsInput.js +0 -39
  145. package/dist/components/TagsInput/types.d.ts +0 -40
  146. package/dist/components/TagsInput/types.js +0 -1
  147. package/dist/components/Toast/Toast.d.ts +0 -2
  148. package/dist/components/Toast/Toast.js +0 -49
  149. package/dist/components/Toast/Toaster.d.ts +0 -2
  150. package/dist/components/Toast/Toaster.js +0 -28
  151. package/dist/components/Toast/create-toaster.d.ts +0 -2
  152. package/dist/components/Toast/create-toaster.js +0 -4
  153. package/dist/components/Toast/types.d.ts +0 -46
  154. package/dist/components/Toast/types.js +0 -1
  155. package/dist/composed/accordion/anatomy/accordion-content.d.ts +0 -2
  156. package/dist/composed/accordion/anatomy/accordion-content.js +0 -15
  157. package/dist/composed/accordion/anatomy/accordion-heading.d.ts +0 -2
  158. package/dist/composed/accordion/anatomy/accordion-heading.js +0 -11
  159. package/dist/composed/accordion/anatomy/accordion-indicator.d.ts +0 -2
  160. package/dist/composed/accordion/anatomy/accordion-indicator.js +0 -14
  161. package/dist/composed/accordion/anatomy/accordion-item.d.ts +0 -2
  162. package/dist/composed/accordion/anatomy/accordion-item.js +0 -16
  163. package/dist/composed/accordion/anatomy/accordion-root.d.ts +0 -2
  164. package/dist/composed/accordion/anatomy/accordion-root.js +0 -20
  165. package/dist/composed/accordion/anatomy/accordion-trigger.d.ts +0 -2
  166. package/dist/composed/accordion/anatomy/accordion-trigger.js +0 -15
  167. package/dist/composed/accordion/index.d.ts +0 -2
  168. package/dist/composed/accordion/index.js +0 -2
  169. package/dist/composed/accordion/modules/anatomy.d.ts +0 -14
  170. package/dist/composed/accordion/modules/anatomy.js +0 -14
  171. package/dist/composed/accordion/modules/context.d.ts +0 -4
  172. package/dist/composed/accordion/modules/context.js +0 -5
  173. package/dist/composed/accordion/modules/types.d.ts +0 -28
  174. package/dist/composed/accordion/modules/types.js +0 -1
  175. package/dist/composed/avatar/anatomy/avatar-fallback.d.ts +0 -2
  176. package/dist/composed/avatar/anatomy/avatar-fallback.js +0 -14
  177. package/dist/composed/avatar/anatomy/avatar-image.d.ts +0 -2
  178. package/dist/composed/avatar/anatomy/avatar-image.js +0 -14
  179. package/dist/composed/avatar/anatomy/avatar-root.d.ts +0 -2
  180. package/dist/composed/avatar/anatomy/avatar-root.js +0 -20
  181. package/dist/composed/avatar/index.d.ts +0 -2
  182. package/dist/composed/avatar/index.js +0 -2
  183. package/dist/composed/avatar/modules/anatomy.d.ts +0 -8
  184. package/dist/composed/avatar/modules/anatomy.js +0 -8
  185. package/dist/composed/avatar/modules/context.d.ts +0 -3
  186. package/dist/composed/avatar/modules/context.js +0 -3
  187. package/dist/composed/avatar/modules/types.d.ts +0 -13
  188. package/dist/composed/avatar/modules/types.js +0 -1
  189. package/dist/composed/index.d.ts +0 -2
  190. package/dist/composed/index.js +0 -2
  191. package/dist/internal/props-with-child.d.ts +0 -7
  192. package/dist/internal/props-with-child.js +0 -1
@@ -0,0 +1,20 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+
3
+ //#region src/internal/components/star-full.tsx
4
+ function star_full_default() {
5
+ return /* @__PURE__ */ jsx("svg", {
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ viewBox: "0 0 24 24",
8
+ height: "24",
9
+ width: "24",
10
+ fill: "currentColor",
11
+ children: /* @__PURE__ */ jsx("path", {
12
+ fillRule: "evenodd",
13
+ clipRule: "evenodd",
14
+ d: "M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 \n 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 \n 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 \n 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273 \n -4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 \n 2.082-5.005Z"
15
+ })
16
+ });
17
+ }
18
+
19
+ //#endregion
20
+ export { star_full_default as default };
@@ -0,0 +1,36 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+
3
+ //#region src/internal/components/star-half.tsx
4
+ function star_half_default() {
5
+ return /* @__PURE__ */ jsxs("svg", {
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ viewBox: "0 0 24 24",
8
+ height: "24",
9
+ width: "24",
10
+ fill: "none",
11
+ stroke: "currentColor",
12
+ strokeWidth: "1.5",
13
+ children: [/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", {
14
+ id: "half-fill",
15
+ x1: "0%",
16
+ y1: "0%",
17
+ x2: "100%",
18
+ y2: "0%",
19
+ children: [/* @__PURE__ */ jsx("stop", {
20
+ offset: "50%",
21
+ stopColor: "currentColor"
22
+ }), /* @__PURE__ */ jsx("stop", {
23
+ offset: "50%",
24
+ stopColor: "transparent"
25
+ })]
26
+ }) }), /* @__PURE__ */ jsx("path", {
27
+ fill: "url(#half-fill)",
28
+ strokeLinecap: "round",
29
+ strokeLinejoin: "round",
30
+ d: "M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345\n l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557\n l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0\n L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557\n l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345\n L11.48 3.5Z"
31
+ })]
32
+ });
33
+ }
34
+
35
+ //#endregion
36
+ export { star_half_default as default };
@@ -0,0 +1,13 @@
1
+ import { JSX } from "react";
2
+
3
+ //#region src/internal/props-with-element.d.ts
4
+ interface PropsWithElement {
5
+ /**
6
+ * Render the element yourself
7
+ */
8
+ element?: (arg: {
9
+ attributes: Record<string, unknown>;
10
+ }) => JSX.Element | null;
11
+ }
12
+ //#endregion
13
+ export { PropsWithElement };
package/package.json CHANGED
@@ -1,59 +1,56 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton-react",
3
- "version": "1.5.0-next.0",
3
+ "version": "2.0.0-next.2",
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
- "default": "./dist/index.js"
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.18.3",
22
- "@zag-js/avatar": "^1.18.3",
23
- "@zag-js/file-upload": "^1.18.3",
24
- "@zag-js/pagination": "^1.18.3",
25
- "@zag-js/progress": "^1.18.3",
26
- "@zag-js/radio-group": "^1.18.3",
27
- "@zag-js/rating-group": "^1.18.3",
28
- "@zag-js/react": "^1.18.3",
29
- "@zag-js/slider": "^1.18.3",
30
- "@zag-js/switch": "^1.18.3",
31
- "@zag-js/tabs": "^1.18.3",
32
- "@zag-js/tags-input": "^1.18.3",
33
- "@zag-js/toast": "^1.18.3",
34
- "@skeletonlabs/skeleton-common": "0.0.1-next.0"
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.2"
35
32
  },
36
33
  "peerDependencies": {
37
34
  "react": "^18.0.0 || ^19.0.0",
38
35
  "react-dom": "^18.0.0 || ^19.0.0"
39
36
  },
40
37
  "devDependencies": {
41
- "@testing-library/jest-dom": "^6.6.3",
38
+ "@testing-library/jest-dom": "^6.8.0",
42
39
  "@testing-library/react": "^16.3.0",
43
- "@testing-library/user-event": "^14.6.1",
44
- "@types/react": "^19.1.8",
45
- "@types/react-dom": "^19.1.6",
46
- "@vitejs/plugin-react": "^4.6.0",
40
+ "@types/react": "^19.1.12",
41
+ "@types/react-dom": "^19.1.9",
42
+ "@vitejs/plugin-react": "^5.0.2",
47
43
  "jsdom": "^26.1.0",
48
- "react": "^19.1.0",
49
- "react-dom": "^19.1.0",
50
- "typescript": "^5.8.3",
51
- "vite": "^7.0.4",
44
+ "react": "^19.1.1",
45
+ "react-dom": "^19.1.1",
46
+ "tsdown": "^0.14.2",
47
+ "typescript": "^5.9.2",
48
+ "vite": "^7.1.3",
52
49
  "vitest": "^3.2.4"
53
50
  },
54
51
  "scripts": {
55
- "build": "tsc",
56
- "dev": "tsc --watch",
52
+ "build": "tsdown",
53
+ "dev": "tsdown --watch",
57
54
  "test": "vitest run",
58
55
  "test:watch": "vitest run --watch"
59
56
  }
@@ -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,10 +0,0 @@
1
- import { createContext } from 'react';
2
- export const AccordionContext = createContext({
3
- iconOpen: '-',
4
- iconClosed: '+',
5
- api: {}
6
- });
7
- export const AccordionItemContext = createContext({
8
- value: '',
9
- disabled: false
10
- });
@@ -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,2 +0,0 @@
1
- import React, {} from 'react';
2
- import * as accordion from '@zag-js/accordion';
@@ -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
- });
@@ -1,63 +0,0 @@
1
- import React from 'react';
2
- export interface AppBarProps extends React.PropsWithChildren {
3
- /** Set base styles. */
4
- base?: string;
5
- /** Set background styles. */
6
- background?: string;
7
- /** Set vertical spacing styles. */
8
- spaceY?: string;
9
- /** Set border styles. */
10
- border?: string;
11
- /** Set padding styles. */
12
- padding?: string;
13
- /** Set shadow styles. */
14
- shadow?: string;
15
- /** Provide arbitrary CSS classes. */
16
- classes?: string;
17
- }
18
- export interface ToolBarProps extends React.PropsWithChildren {
19
- /** Sets the toolbar component's base styles. */
20
- base?: string;
21
- /** Sets the toolbar component's grid columns styles. */
22
- gridCols?: string;
23
- /** Sets the toolbar component's gap styles. */
24
- gap?: string;
25
- /** Provide arbitrary CSS classes to the toolbar component. */
26
- classes?: string;
27
- }
28
- export interface ToolbarLeadProps extends React.PropsWithChildren {
29
- /** Sets the lead component's base styles. */
30
- base?: string;
31
- /** Sets the lead component's horizontal spacing styles. */
32
- spaceX?: string;
33
- /** Sets the lead component's padding styles. */
34
- padding?: string;
35
- /** Provide arbitrary CSS classes to the lead component. */
36
- classes?: string;
37
- }
38
- export interface ToolbarCenterProps extends React.PropsWithChildren {
39
- /** Sets the center component's base styles. */
40
- base?: string;
41
- /** Sets the center component's alignment styles. */
42
- align?: string;
43
- /** Sets the center component's padding styles. */
44
- padding?: string;
45
- /** Provide arbitrary CSS classes to the center component. */
46
- classes?: string;
47
- }
48
- export interface ToolbarTrailProps extends React.PropsWithChildren {
49
- /** Sets the trail component's base styles. */
50
- base?: string;
51
- /** Sets the trail component's horizontal spacing styles. */
52
- spaceX?: string;
53
- /** Sets the trail component's padding styles. */
54
- padding?: string;
55
- /** Provide arbitrary CSS classes to the trail component. */
56
- classes?: string;
57
- }
58
- export interface AppBarHeadlineProps extends React.PropsWithChildren {
59
- /** Sets the headline component's base styles. */
60
- base?: string;
61
- /** Provide arbitrary CSS classes to the headline component. */
62
- classes?: string;
63
- }
@@ -1 +0,0 @@
1
- import React from 'react';
@@ -1,3 +0,0 @@
1
- import { type FC } from 'react';
2
- import type { AvatarProps } from './types.js';
3
- export declare const Avatar: FC<AvatarProps>;
@@ -1,28 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useId } from 'react';
4
- import * as avatar from '@zag-js/avatar';
5
- import { useMachine, normalizeProps } from '@zag-js/react';
6
- export const Avatar = ({ src, srcSet, name, initials = [0, -1],
7
- // Root
8
- base = 'overflow-hidden isolate', background = 'bg-surface-400-600', size = 'size-16', font = '', border = '', rounded = 'rounded-full', shadow = '', classes = '',
9
- // Image
10
- imageBase = 'w-full object-cover', imageClasses = '', style,
11
- // Fallback
12
- fallbackBase = 'w-full h-full flex justify-center items-center', fallbackClasses = '',
13
- // Children
14
- children,
15
- // Zag
16
- ...zagProps }) => {
17
- // Zag
18
- const service = useMachine(avatar.machine, {
19
- id: useId(),
20
- ...zagProps
21
- });
22
- const api = avatar.connect(service, normalizeProps);
23
- function getInitials() {
24
- const lettersArr = initials.map((index) => name.split(' ').at(index)?.charAt(0).toUpperCase());
25
- return lettersArr.join('');
26
- }
27
- return (_jsxs("figure", { ...api.getRootProps(), className: `${base} ${background} ${size} ${font} ${border} ${rounded} ${shadow} ${classes}`, style: style, "data-testid": "avatar", children: [(src || srcSet) && (_jsx("img", { src: src, srcSet: srcSet, alt: name, className: `${imageBase} ${imageClasses}`, "data-testid": "avatar-image", ...api.getImageProps() })), _jsx("span", { ...api.getFallbackProps(), className: `${fallbackBase} ${fallbackClasses}`, "data-testid": "avatar-fallback", children: children ? children : getInitials() })] }));
28
- };
@@ -1,36 +0,0 @@
1
- import type { HTMLAttributes } from 'react';
2
- import type * as avatar from '@zag-js/avatar';
3
- export interface AvatarProps extends Omit<avatar.Props, 'id'>, React.PropsWithChildren, Pick<HTMLAttributes<HTMLElement>, 'style'> {
4
- /** The source of the avatar image. */
5
- src?: string;
6
- /** The source set of the avatar image. */
7
- srcSet?: string;
8
- /** Provide a name or username for the avatar. */
9
- name: string;
10
- /** Initials will be generated based on the name and this index array. */
11
- initials?: number[];
12
- /** Set base styles. */
13
- base?: string;
14
- /** Set background styles. */
15
- background?: string;
16
- /** Set size styles. */
17
- size?: string;
18
- /** Set font styles. */
19
- font?: string;
20
- /** Set border styles. */
21
- border?: string;
22
- /** Set border radius styles. */
23
- rounded?: string;
24
- /** Set shadow styles. */
25
- shadow?: string;
26
- /** Provide arbitrary CSS classes. */
27
- classes?: string;
28
- /** Set avatar image base styles. */
29
- imageBase?: string;
30
- /** Provide avatar image arbitrary CSS classes. */
31
- imageClasses?: string;
32
- /** Set base classes for the fallback element. */
33
- fallbackBase?: string;
34
- /** Provide arbitrary CSS classes to fallback element. */
35
- fallbackClasses?: string;
36
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- import { type FC } from 'react';
2
- import type { FileUploadProps } from './types.js';
3
- export declare const FileUpload: FC<FileUploadProps>;
@@ -1,41 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useId } from 'react';
4
- import * as fileUpload from '@zag-js/file-upload';
5
- import { normalizeProps, useMachine } from '@zag-js/react';
6
- export const FileUpload = ({ label = `Select file or drag here`, subtext = '',
7
- // Root
8
- base = '', classes = '',
9
- // Interface
10
- interfaceBase = 'flex flex-col items-center gap-2 hover:cursor-pointer', interfaceBg = 'hover:preset-tonal', interfaceBorder = 'border-[1px] border-dashed', interfaceBorderColor = 'border-surface-200-800', interfacePadding = 'p-4 py-10', interfaceRounded = 'rounded-container', interfaceClasses = '',
11
- // Interface (content)
12
- interfaceIcon = '', interfaceText = '', interfaceSubtext = 'text-xs opacity-60',
13
- // Files List
14
- filesListBase = 'mt-2 space-y-2', filesListClasses = '',
15
- // File
16
- fileBase = 'grid grid-cols-[auto_1fr_auto] rtl:grid-cols-[1fr_auto_auto] items-center', fileBg = 'preset-tonal', fileGap = 'gap-4 px-4', filePadding = 'py-2', fileRounded = 'rounded-base', fileClasses = '',
17
- // File (content)
18
- fileIcon = '', fileName = 'text-sm flex items-center gap-4', fileSize = 'text-xs opacity-60', fileButton = '',
19
- // State
20
- stateInvalid = 'border-error-500', stateDisabled = 'disabled', stateDragging = 'preset-filled-primary-500',
21
- // Children
22
- children, iconInterface, iconFile, iconFileRemove,
23
- // Zag
24
- ...zagProps }) => {
25
- // Zag
26
- const service = useMachine(fileUpload.machine, {
27
- id: useId(),
28
- ...zagProps
29
- });
30
- const api = fileUpload.connect(service, normalizeProps);
31
- useEffect(() => {
32
- zagProps.onApiReady?.(api);
33
- }, [zagProps, api]);
34
- // Reactive
35
- const rxDisabled = service.prop('disabled') ? stateDisabled : '';
36
- const rxInvalid = api.rejectedFiles.length > 0 ? stateInvalid : interfaceBorderColor;
37
- const rxDragging = api.dragging && !children ? stateDragging : '';
38
- return (_jsxs("div", { ...api.getRootProps(), className: `${base} ${rxDisabled} ${classes}`, style: { display: children ? 'inline-block' : 'block' }, "data-testid": "uploader", children: [_jsxs("div", { ...api.getDropzoneProps(), children: [_jsx("input", { ...api.getHiddenInputProps(), "data-testid": "uploader-input" }), children ?? (_jsxs("div", { className: `${interfaceBase} ${interfaceBg} ${interfaceBorder} ${interfacePadding} ${interfaceRounded} ${rxInvalid} ${rxDragging} ${interfaceClasses}`, "data-testid": "uploader-interface", children: [iconInterface && (_jsx("span", { className: interfaceIcon, "data-testid": "uploader-interface-icon", children: iconInterface })), label && (_jsx("p", { className: interfaceText, "data-testid": "uploader-interface-text", children: label })), subtext && (_jsx("small", { className: interfaceSubtext, "data-testid": "uploader-interface-subtext", children: subtext }))] }))] }), !children && (_jsx("ul", { ...api.getItemGroupProps(), className: `${filesListBase} ${filesListClasses}`, "data-testid": "uploader-files-list", children: api.acceptedFiles.map((file) => (
39
- // File
40
- _jsxs("li", { ...api.getItemProps({ file }), className: `${fileBase} ${fileBg} ${fileGap} ${filePadding} ${fileRounded} ${fileClasses}`, "data-testid": "uploader-file", children: [_jsxs("p", { ...api.getItemNameProps({ file }), className: fileName, "data-testid": "uploader-file-name", children: [iconFile ?? (_jsx("span", { className: fileIcon, "data-testid": "uploader-file-icon", children: iconFile })), _jsx("span", { children: file.name })] }), _jsx("p", { ...api.getItemNameProps({ file }), className: fileSize, "data-testid": "uploader-file-size", children: api.getFileSize(file) }), _jsx("button", { ...api.getItemDeleteTriggerProps({ file }), className: fileButton, "data-testid": "uploader-file-button", children: iconFileRemove ?? _jsx("span", { children: "\u2715" }) })] }, file.name))) }))] }));
41
- };