@pibit.ai/cure-design-system 0.6.26 → 0.6.28

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 (30) hide show
  1. package/dist/hooks/use-escape-layer.d.ts +10 -0
  2. package/dist/hooks/use-escape-layer.d.ts.map +1 -0
  3. package/dist/hooks/use-escape-layer.js +35 -0
  4. package/dist/patterns/alert/alert.d.ts +1 -2
  5. package/dist/patterns/alert/alert.d.ts.map +1 -1
  6. package/dist/patterns/alert/alert.js +22 -22
  7. package/dist/patterns/drawer/drawer.d.ts.map +1 -1
  8. package/dist/patterns/drawer/drawer.js +104 -93
  9. package/dist/patterns/empty-state/empty-state.d.ts +2 -1
  10. package/dist/patterns/empty-state/empty-state.d.ts.map +1 -1
  11. package/dist/patterns/empty-state/empty-state.js +16 -16
  12. package/dist/patterns/expandable-drawer/expandable-drawer.d.ts.map +1 -1
  13. package/dist/patterns/expandable-drawer/expandable-drawer.js +43 -40
  14. package/dist/patterns/filters/checklist-select.js +36 -36
  15. package/dist/patterns/filters/filter-list-section.d.ts.map +1 -1
  16. package/dist/patterns/filters/filter-list-section.js +30 -30
  17. package/dist/patterns/filters/status-filter-dropdown.d.ts.map +1 -1
  18. package/dist/patterns/filters/status-filter-dropdown.js +83 -74
  19. package/dist/patterns/modal/modal-wrapper.d.ts.map +1 -1
  20. package/dist/patterns/modal/modal-wrapper.js +32 -46
  21. package/dist/patterns/sub-sidebar/sub-sidebar.d.ts.map +1 -1
  22. package/dist/patterns/sub-sidebar/sub-sidebar.js +93 -86
  23. package/dist/patterns/tabs/tabs.d.ts.map +1 -1
  24. package/dist/patterns/tabs/tabs.js +33 -36
  25. package/dist/patterns/tree-view/indented-tree.d.ts.map +1 -1
  26. package/dist/patterns/tree-view/indented-tree.js +136 -118
  27. package/dist/primitives/featured-icon/featured-icon.d.ts +2 -1
  28. package/dist/primitives/featured-icon/featured-icon.d.ts.map +1 -1
  29. package/dist/styles/components.css +1 -1
  30. package/package.json +1 -1
@@ -1,44 +1,45 @@
1
1
  import { jsx as n, jsxs as b } from "react/jsx-runtime";
2
- import { useRef as I, useMemo as $ } from "react";
3
- import { ChevronRight as P } from "@untitledui/icons";
4
- import { motion as A } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
5
- import { AnimatePresence as D } from "../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js";
6
- const _ = ({
7
- tree: s,
8
- onToggle: p,
9
- CustomNode: x,
2
+ import { useRef as S, useState as j, useMemo as C, useId as M } from "react";
3
+ import { ChevronRight as _ } from "@untitledui/icons";
4
+ import { motion as D } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
5
+ import { AnimatePresence as B } from "../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js";
6
+ const q = ({
7
+ tree: r,
8
+ onToggle: d,
9
+ CustomNode: v,
10
10
  onNodeClick: c,
11
- selectedNodeId: v,
12
- keyboardNavigation: e,
13
- canSelectNode: d,
14
- "aria-label": m
11
+ selectedNodeId: w,
12
+ keyboardNavigation: t,
13
+ canSelectNode: h,
14
+ "aria-label": f
15
15
  }) => {
16
- const f = I(null), l = $(() => {
17
- const t = [];
18
- function i(a, r = "", h) {
19
- a.forEach((u, g) => {
20
- const O = r ? `${r}-${g}` : String(g);
21
- t.push({ node: u, path: O, parentId: h }), u.isOpen && i(u.children, O, u.id);
16
+ var O;
17
+ const m = S(null), [u, $] = j(null), l = C(() => {
18
+ const i = [];
19
+ function e(s, o = "", A) {
20
+ s.forEach((p, E) => {
21
+ const P = o ? `${o}-${E}` : String(E);
22
+ i.push({ node: p, path: P, parentId: A }), p.isOpen && e(p.children, P, p.id);
22
23
  });
23
24
  }
24
- return i(s), t;
25
- }, [s]);
26
- function o(t) {
27
- var a;
28
- const i = (a = f.current) == null ? void 0 : a.querySelector(
29
- `[data-tree-node-id="${CSS.escape(t)}"]`
25
+ return e(r), i;
26
+ }, [r]);
27
+ function a(i) {
28
+ var s;
29
+ const e = (s = m.current) == null ? void 0 : s.querySelector(
30
+ `[data-tree-node-id="${CSS.escape(i)}"]`
30
31
  );
31
- i == null || i.focus({ preventScroll: !0 }), i == null || i.scrollIntoView({ block: "nearest", behavior: "instant" });
32
+ e == null || e.focus({ preventScroll: !0 }), e == null || e.scrollIntoView({ block: "nearest", behavior: "instant" });
32
33
  }
33
- function w(t) {
34
- if (!e || t.nativeEvent.isComposing) return;
35
- const i = t.target.closest(
34
+ function x(i) {
35
+ if (!t || i.nativeEvent.isComposing) return;
36
+ const e = i.target.closest(
36
37
  "[data-tree-node-id]"
37
- ), a = l.findIndex(
38
- ({ node: g }) => g.id === (i == null ? void 0 : i.dataset.treeNodeId)
38
+ ), s = l.findIndex(
39
+ ({ node: E }) => E.id === (e == null ? void 0 : e.dataset.treeNodeId)
39
40
  );
40
- if (a < 0) return;
41
- const { node: r, path: h, parentId: u } = l[a];
41
+ if (s < 0) return;
42
+ const { node: o, path: A, parentId: p } = l[s];
42
43
  if ([
43
44
  "ArrowDown",
44
45
  "ArrowUp",
@@ -48,111 +49,119 @@ const _ = ({
48
49
  "End",
49
50
  "Enter",
50
51
  " "
51
- ].includes(t.key) && !((t.key === "Enter" || t.key === " ") && t.target.closest("button")))
52
- switch (t.preventDefault(), t.stopPropagation(), t.key) {
52
+ ].includes(i.key) && !((i.key === "Enter" || i.key === " ") && i.target.closest("button")))
53
+ switch (i.preventDefault(), i.stopPropagation(), i.key) {
53
54
  case "ArrowDown":
54
- o(l[(a + 1) % l.length].node.id);
55
+ a(l[Math.min(s + 1, l.length - 1)].node.id);
55
56
  break;
56
57
  case "ArrowUp":
57
- o(
58
- l[(a - 1 + l.length) % l.length].node.id
59
- );
58
+ a(l[Math.max(s - 1, 0)].node.id);
60
59
  break;
61
60
  case "Home":
62
- o(l[0].node.id);
61
+ a(l[0].node.id);
63
62
  break;
64
63
  case "End":
65
- o(l[l.length - 1].node.id);
64
+ a(l[l.length - 1].node.id);
66
65
  break;
67
66
  case "ArrowRight":
68
- r.children.length && !r.isOpen ? p(h) : r.children.length && o(r.children[0].id);
67
+ o.children.length && !o.isOpen ? d(A) : o.children.length && a(o.children[0].id);
69
68
  break;
70
69
  case "ArrowLeft":
71
- r.children.length && r.isOpen ? p(h) : u && o(u);
70
+ o.children.length && o.isOpen ? d(A) : p && a(p);
72
71
  break;
73
72
  default:
74
- (!d || d(r)) && (c == null || c(r));
73
+ (!h || h(o)) && (c == null || c(o));
75
74
  }
76
75
  }
76
+ const I = u && l.some(({ node: i }) => i.id === u) ? u : (O = l[0]) == null ? void 0 : O.node.id;
77
+ function g(i) {
78
+ var s;
79
+ const e = (s = i.target.closest("[data-tree-node-id]")) == null ? void 0 : s.dataset.treeNodeId;
80
+ e && $(e);
81
+ }
77
82
  return /* @__PURE__ */ n(
78
83
  "div",
79
84
  {
80
- ref: f,
81
- role: e ? "tree" : void 0,
82
- "aria-label": e ? m : void 0,
83
- onKeyDown: w,
84
- children: /* @__PURE__ */ n("div", { className: "flex flex-col gap-2", children: s.map((t, i) => /* @__PURE__ */ n(
85
- E,
85
+ ref: m,
86
+ role: t ? "tree" : void 0,
87
+ "aria-label": t ? f : void 0,
88
+ onKeyDown: x,
89
+ onFocus: t ? g : void 0,
90
+ children: /* @__PURE__ */ n("div", { className: "flex flex-col gap-2", children: r.map((i, e) => /* @__PURE__ */ n(
91
+ R,
86
92
  {
87
- node: t,
88
- path: String(i),
89
- onToggle: p,
93
+ node: i,
94
+ path: String(e),
95
+ onToggle: d,
90
96
  onNodeClick: c,
91
- CustomNode: x,
92
- keyboardNavigation: e,
93
- selectedNodeId: v,
94
- canSelectNode: d,
97
+ CustomNode: v,
98
+ keyboardNavigation: t,
99
+ selectedNodeId: w,
100
+ canSelectNode: h,
101
+ tabStopId: I,
95
102
  level: 1,
96
- position: i + 1,
97
- siblingCount: s.length
103
+ position: e + 1,
104
+ siblingCount: r.length
98
105
  },
99
- t.id || i
106
+ i.id || e
100
107
  )) })
101
108
  }
102
109
  );
103
- }, E = ({
104
- node: s,
105
- path: p,
106
- onToggle: x,
110
+ }, R = ({
111
+ node: r,
112
+ path: d,
113
+ onToggle: v,
107
114
  onNodeClick: c,
108
- CustomNode: v,
109
- keyboardNavigation: e,
110
- selectedNodeId: d,
111
- canSelectNode: m,
112
- level: f,
113
- position: l,
114
- siblingCount: o
115
+ CustomNode: w,
116
+ keyboardNavigation: t,
117
+ selectedNodeId: h,
118
+ canSelectNode: f,
119
+ tabStopId: m,
120
+ level: u,
121
+ position: $,
122
+ siblingCount: l
115
123
  }) => {
116
- const w = s.children.length > 0, t = d != null && s.id === d, i = (r) => {
117
- r.stopPropagation(), x(p);
118
- }, a = (r) => {
119
- r.stopPropagation(), c == null || c(s);
124
+ const a = r.children.length > 0, x = M(), I = t && a && !!r.isOpen, g = h != null && r.id === h, O = (e) => {
125
+ e.stopPropagation(), v(d);
126
+ }, i = (e) => {
127
+ e.stopPropagation(), c == null || c(r);
120
128
  };
121
129
  return /* @__PURE__ */ b("div", { className: "relative", children: [
122
130
  /* @__PURE__ */ b(
123
131
  "div",
124
132
  {
125
- className: `flex items-center gap-2 py-0.5 ${e ? "rounded-md outline-none hover:bg-primary_hover focus:bg-primary_hover" : ""}`,
126
- "data-tree-node-id": s.id,
127
- role: e ? "treeitem" : void 0,
128
- tabIndex: e ? f === 1 && l === 1 ? 0 : -1 : void 0,
129
- "aria-label": e ? s.label : void 0,
130
- "aria-level": e ? f : void 0,
131
- "aria-posinset": e ? l : void 0,
132
- "aria-setsize": e ? o : void 0,
133
- "aria-expanded": e && w ? !!s.isOpen : void 0,
134
- "aria-selected": e && (!m || m(s)) ? t : void 0,
133
+ className: `flex items-center gap-2 py-0.5 ${t ? "rounded-md outline-none hover:bg-primary_hover focus:bg-primary_hover" : ""}`,
134
+ "data-tree-node-id": r.id,
135
+ role: t ? "treeitem" : void 0,
136
+ tabIndex: t ? r.id === m ? 0 : -1 : void 0,
137
+ "aria-owns": I ? x : void 0,
138
+ "aria-label": t ? r.label : void 0,
139
+ "aria-level": t ? u : void 0,
140
+ "aria-posinset": t ? $ : void 0,
141
+ "aria-setsize": t ? l : void 0,
142
+ "aria-expanded": t && a ? !!r.isOpen : void 0,
143
+ "aria-selected": t && (!f || f(r)) ? g : void 0,
135
144
  children: [
136
145
  /* @__PURE__ */ n(
137
146
  "div",
138
147
  {
139
148
  className: "w-4 h-4 flex-shrink-0",
140
- onClick: (r) => r.stopPropagation(),
141
- children: w && /* @__PURE__ */ n(
149
+ onClick: (e) => e.stopPropagation(),
150
+ children: a && /* @__PURE__ */ n(
142
151
  "button",
143
152
  {
144
153
  type: "button",
145
- tabIndex: e ? -1 : void 0,
146
- onClick: i,
154
+ tabIndex: t ? -1 : void 0,
155
+ onClick: O,
147
156
  className: "cursor-pointer hover:bg-secondary_subtle rounded p-0.5 transition-colors flex items-center justify-center",
148
- "aria-label": s.isOpen ? "Collapse" : "Expand",
157
+ "aria-label": r.isOpen ? "Collapse" : "Expand",
149
158
  children: /* @__PURE__ */ n(
150
- A.div,
159
+ D.div,
151
160
  {
152
161
  initial: !1,
153
- animate: { rotate: s.isOpen ? 90 : 0 },
162
+ animate: { rotate: r.isOpen ? 90 : 0 },
154
163
  transition: { duration: 0.2, ease: "easeOut" },
155
- children: /* @__PURE__ */ n(P, { className: "w-4 h-4 text-[var(--color-gray-400)]" })
164
+ children: /* @__PURE__ */ n(_, { className: "w-4 h-4 text-[var(--color-gray-400)]" })
156
165
  }
157
166
  )
158
167
  }
@@ -162,28 +171,28 @@ const _ = ({
162
171
  /* @__PURE__ */ n(
163
172
  "div",
164
173
  {
165
- onClick: a,
174
+ onClick: i,
166
175
  className: "flex-1 min-w-0 cursor-pointer",
167
- children: /* @__PURE__ */ n(v, { node: s, isSelected: t })
176
+ children: /* @__PURE__ */ n(w, { node: r, isSelected: g })
168
177
  }
169
178
  )
170
179
  ]
171
180
  }
172
181
  ),
173
- /* @__PURE__ */ n(D, { initial: !1, children: w && s.isOpen && /* @__PURE__ */ n(
174
- A.div,
182
+ /* @__PURE__ */ n(B, { initial: !1, children: a && r.isOpen && /* @__PURE__ */ n(
183
+ D.div,
175
184
  {
176
- initial: e ? !1 : { opacity: 0, height: 0 },
185
+ initial: t ? !1 : { opacity: 0, height: 0 },
177
186
  animate: {
178
187
  opacity: 1,
179
188
  height: "auto",
180
189
  transition: {
181
190
  height: {
182
- duration: e ? 0 : 0.1,
191
+ duration: t ? 0 : 0.1,
183
192
  ease: "easeOut"
184
193
  },
185
194
  opacity: {
186
- duration: e ? 0 : 0.1,
195
+ duration: t ? 0 : 0.1,
187
196
  ease: "easeOut"
188
197
  }
189
198
  }
@@ -193,11 +202,11 @@ const _ = ({
193
202
  height: 0,
194
203
  transition: {
195
204
  height: {
196
- duration: e ? 0 : 0.3,
205
+ duration: t ? 0 : 0.3,
197
206
  ease: "easeIn"
198
207
  },
199
208
  opacity: {
200
- duration: e ? 0 : 0.2,
209
+ duration: t ? 0 : 0.2,
201
210
  ease: "easeIn"
202
211
  }
203
212
  }
@@ -205,28 +214,37 @@ const _ = ({
205
214
  style: { overflow: "clip" },
206
215
  children: /* @__PURE__ */ b("div", { className: "ml-6 relative", children: [
207
216
  /* @__PURE__ */ n("div", { className: "absolute left-[-17px] top-[-6px] bottom-0 w-px bg-[var(--color-gray-200)]" }),
208
- /* @__PURE__ */ n("div", { className: "flex flex-col gap-2", children: s.children.map((r, h) => /* @__PURE__ */ n(
209
- E,
217
+ /* @__PURE__ */ n(
218
+ "div",
210
219
  {
211
- node: r,
212
- path: `${p}-${h}`,
213
- onToggle: x,
214
- onNodeClick: c,
215
- CustomNode: v,
216
- keyboardNavigation: e,
217
- selectedNodeId: d,
218
- canSelectNode: m,
219
- level: f + 1,
220
- position: h + 1,
221
- siblingCount: s.children.length
222
- },
223
- r.id || `${p}-${h}`
224
- )) })
220
+ id: I ? x : void 0,
221
+ role: t ? "group" : void 0,
222
+ className: "flex flex-col gap-2",
223
+ children: r.children.map((e, s) => /* @__PURE__ */ n(
224
+ R,
225
+ {
226
+ node: e,
227
+ path: `${d}-${s}`,
228
+ onToggle: v,
229
+ onNodeClick: c,
230
+ CustomNode: w,
231
+ keyboardNavigation: t,
232
+ selectedNodeId: h,
233
+ canSelectNode: f,
234
+ tabStopId: m,
235
+ level: u + 1,
236
+ position: s + 1,
237
+ siblingCount: r.children.length
238
+ },
239
+ e.id || `${d}-${s}`
240
+ ))
241
+ }
242
+ )
225
243
  ] })
226
244
  }
227
245
  ) })
228
246
  ] });
229
247
  };
230
248
  export {
231
- _ as IndentedTree
249
+ q as IndentedTree
232
250
  };
@@ -7,7 +7,8 @@ export interface FeaturedIconProps {
7
7
  className?: string;
8
8
  }> | ReactNode;
9
9
  size?: "sm" | "md" | "lg" | "xl";
10
- color: "brand" | "gray" | "success" | "warning" | "error";
10
+ /** @default "brand" */
11
+ color?: "brand" | "gray" | "success" | "warning" | "error";
11
12
  theme?: "light" | "gradient" | "dark" | "outline" | "modern" | "modern-neue";
12
13
  }
13
14
  export declare const FeaturedIcon: (props: FeaturedIconProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"featured-icon.d.ts","sourceRoot":"","sources":["../../../src/primitives/featured-icon/featured-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AA6HhD,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,EAAE,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IAC9C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC1D,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;CAC9E;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,4CAwBpD,CAAC"}
1
+ {"version":3,"file":"featured-icon.d.ts","sourceRoot":"","sources":["../../../src/primitives/featured-icon/featured-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AA6HhD,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,EAAE,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IAC9C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,uBAAuB;IACvB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC3D,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;CAC9E;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,4CAwBpD,CAAC"}