@pibit.ai/cure-design-system 0.6.19 → 0.6.20

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.
@@ -1,41 +1,39 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import b, { useState as h } from "react";
3
- import { Breadcrumbs as g } from "react-aria-components";
4
- import { cx as o } from "../../utils/cn.js";
5
- import { BreadcrumbItem as n } from "./breadcrumb-item.js";
6
- import { BreadcrumbsContext as x } from "./context.js";
7
- const B = {
2
+ import h, { useState as g } from "react";
3
+ import { Breadcrumbs as x } from "react-aria-components";
4
+ import { cx as n } from "../../utils/cn.js";
5
+ import { BreadcrumbItem as l } from "./breadcrumb-item.js";
6
+ import { BreadcrumbsContext as B } from "./context.js";
7
+ const v = {
8
8
  text: "gap-0.5 md:gap-0.5",
9
9
  "text-line": "pl-2 gap-1.25 md:gap-1.25 py-2 after:pointer-events-none after:absolute after:inset-0 after:border-b after:border-t after:border-secondary",
10
10
  button: "gap-0.5 md:gap-0.5"
11
- }, v = ({
12
- children: l,
11
+ }, C = ({
12
+ children: c,
13
13
  divider: a = "slash",
14
14
  type: s = "text",
15
- className: c,
15
+ className: i,
16
16
  maxVisibleItems: r = 4
17
17
  }) => {
18
- const [i, m] = h(!1), d = (() => {
19
- const e = b.Children.toArray(l);
20
- if (!r || e.length <= r || i)
18
+ const [m, d] = g(!1), p = (() => {
19
+ const e = h.Children.toArray(c);
20
+ if (!r || e.length <= r || m)
21
21
  return e;
22
- const p = e.slice(0, Math.ceil(r / 2)), f = e.slice(
23
- -Math.floor((r - 1) / 2)
24
- ), u = /* @__PURE__ */ t(
25
- n,
22
+ const f = e.slice(0, Math.ceil(r / 2)), o = Math.floor((r - 1) / 2), u = o > 0 ? e.slice(-o) : [], b = /* @__PURE__ */ t(
23
+ l,
26
24
  {
27
25
  isEllipsis: !0,
28
26
  divider: a,
29
27
  type: s,
30
- onClick: () => m(!0)
28
+ onClick: () => d(!0)
31
29
  },
32
30
  "ellipsis"
33
31
  );
34
- return [...p, u, ...f];
32
+ return [...f, b, ...u];
35
33
  })();
36
- return /* @__PURE__ */ t("nav", { "aria-label": "Breadcrumbs", className: o("min-w-0", c), children: /* @__PURE__ */ t(x.Provider, { value: { divider: a, type: s }, children: /* @__PURE__ */ t(g, { className: o("relative flex", B[s]), children: d }) }) });
34
+ return /* @__PURE__ */ t("nav", { "aria-label": "Breadcrumbs", className: n("min-w-0", i), children: /* @__PURE__ */ t(B.Provider, { value: { divider: a, type: s }, children: /* @__PURE__ */ t(x, { className: n("relative flex", v[s]), children: p }) }) });
37
35
  };
38
- v.Item = n;
36
+ C.Item = l;
39
37
  export {
40
- v as Breadcrumbs
38
+ C as Breadcrumbs
41
39
  };
@@ -1,6 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SubSidebarConfig, SubSidebarGuard, SubSidebarLinkProps } from './types';
3
3
  export interface SubSidebarProps {
4
+ /**
5
+ * Keep it stable (memoize it): a group holding the active link re-opens whenever `config.sections` changes
6
+ * identity, so an inline config re-opens it on every parent render.
7
+ */
4
8
  config: SubSidebarConfig;
5
9
  /** The current location's path, e.g. `useLocation().pathname`. */
6
10
  currentPath: string;
@@ -1 +1 @@
1
- {"version":3,"file":"sub-sidebar.d.ts","sourceRoot":"","sources":["../../../src/patterns/sub-sidebar/sub-sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAQf,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAEf,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAajB,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,sDAAsD;IACtD,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;IACvD,yFAAyF;IACzF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAcD,eAAO,MAAM,UAAU,GAAI,wFAQxB,eAAe,4CA8YjB,CAAC"}
1
+ {"version":3,"file":"sub-sidebar.d.ts","sourceRoot":"","sources":["../../../src/patterns/sub-sidebar/sub-sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAQf,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAEf,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAajB,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,MAAM,EAAE,gBAAgB,CAAC;IACzB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,sDAAsD;IACtD,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;IACvD,yFAAyF;IACzF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAcD,eAAO,MAAM,UAAU,GAAI,wFAQxB,eAAe,4CAmZjB,CAAC"}
@@ -1,26 +1,26 @@
1
1
  import { jsxs as o, jsx as r, Fragment as S } from "react/jsx-runtime";
2
- import { useState as A, useEffect as z, Fragment as m } from "react";
2
+ import { useState as A, useEffect as z, Fragment as u } from "react";
3
3
  import { Minus as F, Plus as I } from "@untitledui/icons";
4
4
  import { CollapseLeft as D } from "../../primitives/custom-icon/icons/collapse-left.js";
5
5
  import { CollapseRight as H } from "../../primitives/custom-icon/icons/collapse-right.js";
6
6
  import { cx as n } from "../../utils/cn.js";
7
7
  import { ButtonUtility as K } from "../../primitives/button/button-utility.js";
8
- const q = ({
8
+ const T = ({
9
9
  href: i,
10
10
  className: c,
11
- children: p
12
- }) => /* @__PURE__ */ r("a", { href: i, className: c, children: p }), B = (i, c) => c, W = ({
11
+ children: d
12
+ }) => /* @__PURE__ */ r("a", { href: i, className: c, children: d }), $ = (i, c) => c, U = ({
13
13
  config: i,
14
14
  currentPath: c,
15
- isCollapsed: p,
15
+ isCollapsed: d,
16
16
  onCollapsedChange: k,
17
- renderLink: x = q,
18
- guard: h = B,
17
+ renderLink: x = T,
18
+ guard: h = $,
19
19
  className: C
20
20
  }) => {
21
- const [E, b] = A(/* @__PURE__ */ new Set()), y = (a) => c === a || c.startsWith(a + "/"), u = (a) => a.map((t) => t.href).filter((t) => !!t).filter(y).sort((t, l) => l.length - t.length)[0] ?? null, w = () => {
21
+ const [E, b] = A(/* @__PURE__ */ new Set()), y = (a) => c === a || c.startsWith(a + "/"), m = (a) => a.map((t) => t.href).filter((t) => !!t).filter(y).sort((t, l) => l.length - t.length)[0] ?? null, w = () => {
22
22
  var e;
23
- const a = !p;
23
+ const a = !d;
24
24
  k(a), (e = i.onToggleCollapse) == null || e.call(i, a);
25
25
  };
26
26
  z(() => {
@@ -28,9 +28,9 @@ const q = ({
28
28
  i.sections.forEach((e) => {
29
29
  e.items.forEach((t) => {
30
30
  var l;
31
- if ((l = t.items) != null && l.length && u(t.items) !== null) {
32
- const d = t.href || t.label;
33
- a.add(d);
31
+ if ((l = t.items) != null && l.length && m(t.items) !== null) {
32
+ const p = t.href || t.label;
33
+ a.add(p);
34
34
  }
35
35
  });
36
36
  }), b((e) => {
@@ -46,18 +46,18 @@ const q = ({
46
46
  });
47
47
  }, v = (a) => {
48
48
  var e;
49
- return (e = a.items) != null && e.length && u(a.items) !== null ? !0 : a.href ? y(a.href) : !1;
50
- }, j = (a, e) => u(e) === a;
49
+ return (e = a.items) != null && e.length && m(a.items) !== null ? !0 : a.href ? y(a.href) : !1;
50
+ }, j = (a, e) => m(e) === a;
51
51
  return /* @__PURE__ */ o(
52
52
  "div",
53
53
  {
54
54
  className: n(
55
55
  "h-full flex-shrink-0 bg-white border-r border-[#EDEFF4] relative transition-all duration-300 ease-in-out",
56
- p ? "w-0 border-r-0" : i.width || "w-[296px]",
56
+ d ? "w-0 border-r-0" : i.width || "w-[296px]",
57
57
  C
58
58
  ),
59
59
  children: [
60
- i.collapsible !== !1 && p && /* @__PURE__ */ r(
60
+ i.collapsible !== !1 && d && /* @__PURE__ */ r(
61
61
  "button",
62
62
  {
63
63
  onClick: w,
@@ -77,8 +77,9 @@ const q = ({
77
77
  {
78
78
  className: n(
79
79
  "pl-4 h-full flex flex-col overflow-hidden transition-opacity duration-300",
80
- p ? "opacity-0 pointer-events-none" : "opacity-100"
80
+ d ? "opacity-0 pointer-events-none" : "opacity-100"
81
81
  ),
82
+ inert: d,
82
83
  children: [
83
84
  i.title && /* @__PURE__ */ o("div", { className: "pt-6 pb-4 relative flex-shrink-0 flex items-center justify-between", children: [
84
85
  /* @__PURE__ */ r("h2", { className: "pl-1.5 text-primary font-semibold text-md leading-7 whitespace-nowrap", children: i.title }),
@@ -98,13 +99,13 @@ const q = ({
98
99
  }
99
100
  )
100
101
  ] }),
101
- /* @__PURE__ */ r("nav", { className: "flex-1 pb-4 pr-2 overflow-y-auto overflow-x-hidden", children: i.sections.map((a) => /* @__PURE__ */ r(m, { children: h(
102
+ /* @__PURE__ */ r("nav", { className: "flex-1 pb-4 pr-2 overflow-y-auto overflow-x-hidden", children: i.sections.map((a) => /* @__PURE__ */ r(u, { children: h(
102
103
  (a == null ? void 0 : a.permissions) || [],
103
104
  /* @__PURE__ */ o("div", { className: n("mb-6"), children: [
104
105
  /* @__PURE__ */ r("div", { className: "py-0.5 px-2", children: /* @__PURE__ */ r("p", { className: "font-medium text-[10px] text-[var(--color-text-tertiary)] uppercase tracking-[1.3px] whitespace-nowrap", children: a.label }) }),
105
106
  /* @__PURE__ */ r("ul", { className: "space-y-1", children: a.items.map((e) => {
106
- const t = e.href || e.label, l = E.has(t), N = e.items && e.items.length > 0, d = v(e);
107
- return N ? /* @__PURE__ */ r(m, { children: h(
107
+ const t = e.href || e.label, l = E.has(t), N = e.items && e.items.length > 0, p = v(e);
108
+ return N ? /* @__PURE__ */ r(u, { children: h(
108
109
  e.permissions || [],
109
110
  /* @__PURE__ */ o(
110
111
  "li",
@@ -119,7 +120,7 @@ const q = ({
119
120
  {
120
121
  className: n(
121
122
  "flex items-center justify-between px-1 py-2 rounded-md transition-colors cursor-pointer",
122
- d ? "bg-active text-primary font-medium" : "text-primary hover:bg-active",
123
+ p ? "bg-active text-primary font-medium" : "text-primary hover:bg-active",
123
124
  e.disabled ? "cursor-not-allowed" : ""
124
125
  ),
125
126
  role: "button",
@@ -130,7 +131,7 @@ const q = ({
130
131
  s.stopPropagation(), !e.disabled && f(e);
131
132
  },
132
133
  onKeyDown: (s) => {
133
- if (s.key === "Enter" || s.key === " ") {
134
+ if (s.target === s.currentTarget && (s.key === "Enter" || s.key === " ")) {
134
135
  if (s.stopPropagation(), e.disabled) return;
135
136
  f(e);
136
137
  }
@@ -148,6 +149,7 @@ const q = ({
148
149
  e.disabled ? "cursor-not-allowed" : ""
149
150
  ),
150
151
  size: "xs",
152
+ "aria-label": `${l ? "Collapse" : "Expand"} ${e.label}`,
151
153
  icon: l ? /* @__PURE__ */ r(F, { size: 12 }) : /* @__PURE__ */ r(I, { size: 12 })
152
154
  }
153
155
  )
@@ -163,7 +165,7 @@ const q = ({
163
165
  s.href,
164
166
  e.items
165
167
  );
166
- return /* @__PURE__ */ r(m, { children: h(
168
+ return /* @__PURE__ */ r(u, { children: h(
167
169
  s.permissions || [],
168
170
  /* @__PURE__ */ r("li", { className: "relative", children: x({
169
171
  href: s.href,
@@ -194,7 +196,7 @@ const q = ({
194
196
  }
195
197
  ),
196
198
  null
197
- ) }, t) : /* @__PURE__ */ r(m, { children: h(
199
+ ) }, t) : /* @__PURE__ */ r(u, { children: h(
198
200
  e.permissions || [],
199
201
  /* @__PURE__ */ r(
200
202
  "li",
@@ -208,7 +210,7 @@ const q = ({
208
210
  {
209
211
  className: n(
210
212
  "flex items-center justify-between px-2 py-2 rounded-md transition-colors cursor-not-allowed",
211
- d ? "bg-active text-primary" : "text-primary"
213
+ p ? "bg-active text-primary" : "text-primary"
212
214
  ),
213
215
  "aria-disabled": "true",
214
216
  children: /* @__PURE__ */ r("span", { className: "whitespace-nowrap font-medium", children: e.label })
@@ -217,7 +219,7 @@ const q = ({
217
219
  href: e.href,
218
220
  className: n(
219
221
  "flex items-center justify-between px-2 py-2 rounded-md transition-colors",
220
- d ? "bg-active text-primary" : "text-primary hover:bg-active",
222
+ p ? "bg-active text-primary" : "text-primary hover:bg-active",
221
223
  e.disabled ? "opacity-30 cursor-not-allowed" : ""
222
224
  ),
223
225
  children: /* @__PURE__ */ r("span", { className: "whitespace-nowrap font-medium", children: e.label })
@@ -230,7 +232,7 @@ const q = ({
230
232
  },
231
233
  className: n(
232
234
  "w-full flex items-center justify-between px-2 py-2 rounded-md text-sm transition-colors cursor-pointer",
233
- d ? "bg-active text-primary font-medium" : "text-primary hover:bg-active",
235
+ p ? "bg-active text-primary font-medium" : "text-primary hover:bg-active",
234
236
  e.disabled ? "opacity-30 cursor-not-allowed" : ""
235
237
  ),
236
238
  children: /* @__PURE__ */ r("span", { className: "whitespace-nowrap", children: e.label })
@@ -243,7 +245,7 @@ const q = ({
243
245
  {
244
246
  className: n(
245
247
  "flex items-center justify-between opacity-30 px-2 py-2 rounded-md transition-colors cursor-not-allowed text-xs whitespace-nowrap font-medium",
246
- d ? "bg-active text-primary" : "text-primary"
248
+ p ? "bg-active text-primary" : "text-primary"
247
249
  ),
248
250
  "aria-disabled": "true",
249
251
  children: e.label
@@ -279,5 +281,5 @@ const q = ({
279
281
  );
280
282
  };
281
283
  export {
282
- W as SubSidebar
284
+ U as SubSidebar
283
285
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pibit.ai/cure-design-system",
3
- "version": "0.6.19",
3
+ "version": "0.6.20",
4
4
  "description": "CURE Design System - React component library",
5
5
  "author": "Pibit",
6
6
  "license": "MIT",