@pibit.ai/cure-design-system 0.6.60 → 0.6.62

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,5 +1,5 @@
1
1
  import { Children as p } from "react";
2
- import { r as y } from "../../../../_virtual/index.js";
2
+ import { r as y } from "../../../../_virtual/index2.js";
3
3
  import { isNullish as m } from "./DataUtils.js";
4
4
  import { get as f } from "../../../es-toolkit/dist/compat/object/get.js";
5
5
  var u = (r) => typeof r == "string" ? r : r ? r.displayName || r.name || "Component" : "", l = null, n = null, o = (r) => {
@@ -1,4 +1,4 @@
1
- import { __module as r } from "../../../_virtual/index2.js";
1
+ import { __module as r } from "../../../_virtual/index.js";
2
2
  import { __require as o } from "../cjs/use-sync-external-store-shim.production.js";
3
3
  import { __require as i } from "../cjs/use-sync-external-store-shim.development.js";
4
4
  var e;
@@ -0,0 +1,23 @@
1
+ export interface ChecklistItemProps {
2
+ label: string;
3
+ /** Secondary text under the label, clamped to four lines; over 100 characters it also gets a tooltip. */
4
+ hint: string;
5
+ isActive: boolean;
6
+ /** Locked selection. The row stays highlighted when active and does not toggle. */
7
+ isDisabled?: boolean;
8
+ /** Shown when hovering the checkbox of a locked row. */
9
+ disabledTooltip?: string;
10
+ /** A short count or note in a pill on the right. */
11
+ stats?: string | null;
12
+ onChange?: (isSelected: boolean) => void;
13
+ }
14
+ /**
15
+ * A selectable card row: checkbox, label, hint and an optional stats pill. The
16
+ * whole row is the checkbox (click, Enter or Space toggles it).
17
+ *
18
+ * Frozen to platform-ui's CheckListItem. Its four hex colours are the nearest
19
+ * tokens: the active background brand-50 (exact), the stats pill bg-secondary and
20
+ * border gray-cool-200, and the active stats text brand-600.
21
+ */
22
+ export declare const ChecklistItem: ({ label, hint, isActive, isDisabled, disabledTooltip, stats, onChange, }: ChecklistItemProps) => import("react/jsx-runtime").JSX.Element;
23
+ //# sourceMappingURL=checklist-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checklist-item.d.ts","sourceRoot":"","sources":["../../../src/patterns/checklist-item/checklist-item.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,yGAAyG;IACzG,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,mFAAmF;IACnF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,0EAQ3B,kBAAkB,4CAkEpB,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { cx as l } from "../../utils/cn.js";
3
+ import { Tooltip as m, TooltipTrigger as p } from "../../primitives/tooltip/tooltip.js";
4
+ import { Checkbox as f } from "../../primitives/checkbox/checkbox.js";
5
+ import { createEllipsisContent as u } from "../../primitives/tooltip/ellipsis-content.js";
6
+ const k = ({
7
+ label: x,
8
+ hint: n,
9
+ isActive: r,
10
+ isDisabled: t = !1,
11
+ disabledTooltip: i,
12
+ stats: c,
13
+ onChange: d
14
+ }) => {
15
+ const s = () => {
16
+ t || d == null || d(!r);
17
+ };
18
+ return /* @__PURE__ */ a(
19
+ "div",
20
+ {
21
+ role: "checkbox",
22
+ "aria-checked": r,
23
+ "aria-disabled": t,
24
+ tabIndex: t ? -1 : 0,
25
+ className: l(
26
+ "flex items-center justify-between rounded-xl border-2 py-2 pr-2 pl-3",
27
+ t ? "cursor-not-allowed" : "cursor-pointer",
28
+ r ? "border-brand bg-utility-brand-25" : "border-secondary bg-primary"
29
+ ),
30
+ onMouseDownCapture: (o) => o.preventDefault(),
31
+ onClick: s,
32
+ onKeyDown: (o) => {
33
+ t || (o.key === "Enter" || o.key === " ") && (o.preventDefault(), s());
34
+ },
35
+ children: [
36
+ /* @__PURE__ */ a("div", { className: "flex items-start gap-4 overflow-hidden", children: [
37
+ t && i ? /* @__PURE__ */ e(m, { title: i, children: /* @__PURE__ */ e(p, { className: "inline-flex shrink-0 cursor-not-allowed opacity-50 [&_*]:cursor-not-allowed", children: /* @__PURE__ */ e(f, { isSelected: r, size: "sm", "aria-hidden": !0 }) }) }) : /* @__PURE__ */ e(
38
+ "span",
39
+ {
40
+ className: l(
41
+ "inline-flex shrink-0",
42
+ t ? "cursor-not-allowed opacity-50 [&_*]:cursor-not-allowed" : "pointer-events-none"
43
+ ),
44
+ children: /* @__PURE__ */ e(f, { isSelected: r, size: "sm", "aria-hidden": !0 })
45
+ }
46
+ ),
47
+ /* @__PURE__ */ a("div", { className: "pointer-events-none max-w-full overflow-hidden", children: [
48
+ /* @__PURE__ */ e("p", { className: "overflow-hidden text-sm font-medium text-primary", children: u(x) }),
49
+ /* @__PURE__ */ e(m, { title: n.length > 100 ? n : void 0, children: /* @__PURE__ */ e(p, { className: "max-w-full overflow-hidden truncate text-start", children: /* @__PURE__ */ e("div", { className: "line-clamp-4 text-xs font-medium text-wrap text-tertiary", children: n }) }) })
50
+ ] })
51
+ ] }),
52
+ c && /* @__PURE__ */ e(
53
+ "div",
54
+ {
55
+ className: l(
56
+ "flex items-center rounded-full border border-gray-cool-200 bg-secondary px-2 py-1",
57
+ r && "border-brand-50 bg-brand-50"
58
+ ),
59
+ children: /* @__PURE__ */ e("span", { className: l("text-xs font-medium text-gray-500", r && "text-brand-600"), children: c })
60
+ }
61
+ )
62
+ ]
63
+ }
64
+ );
65
+ };
66
+ export {
67
+ k as ChecklistItem
68
+ };
@@ -0,0 +1,2 @@
1
+ export { ChecklistItem, type ChecklistItemProps } from './checklist-item';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/checklist-item/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { ReactElement } from 'react';
2
+ export interface DisabledReasonTooltipProps {
3
+ /** Why the wrapped control is disabled. With no reason, the control renders alone. */
4
+ reason: string | null | undefined;
5
+ /** Accessible name of the wrapped control, e.g. its visible label. */
6
+ label: string;
7
+ children: ReactElement;
8
+ }
9
+ /**
10
+ * Explains why a control is disabled, in a tooltip on hover and keyboard focus.
11
+ *
12
+ * A disabled button gets no hover or focus, so it can't trigger its own tooltip.
13
+ * While there is a reason, a focusable `role="button" aria-disabled` span stands in
14
+ * for it: it takes the hover, the single tab stop and the tooltip's description.
15
+ * The real button stays inside, hidden from assistive tech and pointer events, so
16
+ * the DOM has no nested buttons. (Wrapping a control in TooltipTrigger instead
17
+ * nests one button in another.)
18
+ */
19
+ export declare const DisabledReasonTooltip: ({ reason, label, children }: DisabledReasonTooltipProps) => import("react/jsx-runtime").JSX.Element;
20
+ //# sourceMappingURL=disabled-reason-tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disabled-reason-tooltip.d.ts","sourceRoot":"","sources":["../../../src/patterns/disabled-reason-tooltip/disabled-reason-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,MAAM,WAAW,0BAA0B;IACzC,sFAAsF;IACtF,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,GAAI,6BAA6B,0BAA0B,4CAoB5F,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { Focusable as n } from "react-aria-components";
3
+ import { Tooltip as t } from "../../primitives/tooltip/tooltip.js";
4
+ const u = ({ reason: i, label: l, children: o }) => i ? /* @__PURE__ */ e(t, { title: i, placement: "top", children: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(
5
+ "span",
6
+ {
7
+ role: "button",
8
+ "aria-disabled": "true",
9
+ "aria-label": l,
10
+ tabIndex: 0,
11
+ className: "inline-flex cursor-not-allowed rounded-lg outline-hidden focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring",
12
+ children: /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "pointer-events-none inline-flex", children: o })
13
+ }
14
+ ) }) }) : o;
15
+ export {
16
+ u as DisabledReasonTooltip
17
+ };
@@ -0,0 +1,2 @@
1
+ export { DisabledReasonTooltip, type DisabledReasonTooltipProps } from './disabled-reason-tooltip';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/disabled-reason-tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,22 +1,34 @@
1
1
  export type TablePaginationConfig = {
2
2
  currentPage: number;
3
3
  pageSize: number;
4
- totalPages: number;
5
- totalItems: number;
4
+ /** Omitted: the page control falls back to its own default. */
5
+ totalPages?: number;
6
+ /** Omitted: the "Total rows" count is not shown. */
7
+ totalItems?: number;
6
8
  onPageChange: (page: number) => void;
7
- onPageSizeChange: (size: number | string) => void;
9
+ onPageSizeChange: (size: number) => void;
8
10
  /** Whether pagination should actually render. Default: true. */
9
11
  showPagination?: boolean;
10
12
  };
11
13
  export interface TablePaginationProps extends TablePaginationConfig {
12
14
  loading?: boolean;
13
15
  rootClassName?: string;
16
+ /** Render nothing when `totalItems` is 0. Default: true. */
17
+ hideWhenEmpty?: boolean;
18
+ /**
19
+ * Wait this long after a page-size pick before calling `onPageSizeChange`, so
20
+ * a burst of picks makes one change (and one request). Default: 0, immediate.
21
+ * The select keeps showing `pageSize` until the parent passes the new one.
22
+ */
23
+ pageSizeChangeDelayMs?: number;
24
+ /** data-testid for the "Total rows" text. */
25
+ totalRowsTestId?: string;
14
26
  }
15
27
  /**
16
28
  * Table footer pagination — page-size select, total count, and page controls.
17
29
  * Matches the `TableWrapperPaginationConfig` contract used in platform-ui.
18
30
  */
19
- export declare function TablePagination({ currentPage, pageSize, totalPages, totalItems, onPageChange, onPageSizeChange, showPagination, loading, rootClassName, }: TablePaginationProps): import("react/jsx-runtime").JSX.Element | null;
31
+ export declare function TablePagination({ currentPage, pageSize, totalPages, totalItems, onPageChange, onPageSizeChange, showPagination, loading, rootClassName, hideWhenEmpty, pageSizeChangeDelayMs, totalRowsTestId, }: TablePaginationProps): import("react/jsx-runtime").JSX.Element | null;
20
32
  export declare namespace TablePagination {
21
33
  var displayName: string;
22
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TablePagination.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/TablePagination.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAClD,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AASD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,QAAQ,EACR,UAAU,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,cAAqB,EACrB,OAAe,EACf,aAAa,GACd,EAAE,oBAAoB,kDAwCtB;yBAlDe,eAAe"}
1
+ {"version":3,"file":"TablePagination.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/TablePagination.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6CAA6C;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AASD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,QAAQ,EACR,UAAU,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,cAAqB,EACrB,OAAe,EACf,aAAa,EACb,aAAoB,EACpB,qBAAyB,EACzB,eAAe,GAChB,EAAE,oBAAoB,kDA0EtB;yBAvFe,eAAe"}
@@ -1,60 +1,82 @@
1
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
- import { cn as x } from "../../utils/cn.js";
3
- import { PaginationCardDefault as f } from "./pagination-card.js";
4
- import { Select as i } from "../../primitives/select/select.js";
5
- const b = [
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import { useRef as c, useEffect as g } from "react";
3
+ import { cn as v } from "../../utils/cn.js";
4
+ import { PaginationCardDefault as y } from "./pagination-card.js";
5
+ import { Select as d } from "../../primitives/select/select.js";
6
+ const R = [
6
7
  { label: "10", id: "10" },
7
8
  { label: "20", id: "20" },
8
9
  { label: "50", id: "50" },
9
10
  { label: "100", id: "100" }
10
11
  ];
11
- function h({
12
- currentPage: n,
13
- pageSize: s,
14
- totalPages: o,
15
- totalItems: l,
16
- onPageChange: m,
17
- onPageSizeChange: c,
18
- showPagination: d = !0,
19
- loading: r = !1,
20
- rootClassName: p
12
+ function E({
13
+ currentPage: x,
14
+ pageSize: l,
15
+ totalPages: p,
16
+ totalItems: a,
17
+ onPageChange: b,
18
+ onPageSizeChange: i,
19
+ showPagination: N = !0,
20
+ loading: o = !1,
21
+ rootClassName: h,
22
+ hideWhenEmpty: w = !0,
23
+ pageSizeChangeDelayMs: u = 0,
24
+ totalRowsTestId: S
21
25
  }) {
22
- return !d || l === 0 ? null : /* @__PURE__ */ a("div", { className: x("flex items-center justify-between border-t border-secondary pt-2", p), children: [
23
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
24
- /* @__PURE__ */ e("p", { className: "text-xs font-normal text-tertiary", children: "Show rows per page" }),
25
- /* @__PURE__ */ e(
26
- i,
26
+ const e = c(null), m = c(l), f = c(i);
27
+ if (m.current = l, f.current = i, g(
28
+ () => () => {
29
+ e.current && clearTimeout(e.current);
30
+ },
31
+ []
32
+ ), !N || w && a === 0) return null;
33
+ const T = (n) => {
34
+ const r = Number(n);
35
+ if (!(n == null || !Number.isFinite(r) || r <= 0) && (e.current && (clearTimeout(e.current), e.current = null), r !== l)) {
36
+ if (u <= 0) {
37
+ i(r);
38
+ return;
39
+ }
40
+ e.current = setTimeout(() => {
41
+ e.current = null, r !== m.current && f.current(r);
42
+ }, u);
43
+ }
44
+ };
45
+ return /* @__PURE__ */ s("div", { className: v("flex items-center justify-between border-t border-secondary pt-2", h), children: [
46
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
47
+ /* @__PURE__ */ t("p", { className: "text-xs font-normal text-tertiary", children: "Show rows per page" }),
48
+ /* @__PURE__ */ t(
49
+ d,
27
50
  {
28
- isDisabled: r,
51
+ "aria-label": "Rows per page",
52
+ isDisabled: o,
29
53
  size: "sm",
30
- value: s.toString(),
31
- items: b,
32
- onSelectionChange: (t) => {
33
- t != null && c(t);
34
- },
54
+ value: l.toString(),
55
+ items: R,
56
+ onSelectionChange: T,
35
57
  className: "w-auto min-w-10",
36
58
  popoverClassName: "w-20",
37
59
  textStyles: "text-xs align-center",
38
- children: (t) => /* @__PURE__ */ e(i.Item, { id: t.id, textStyles: "text-xs font-normal", children: t.label })
60
+ children: (n) => /* @__PURE__ */ t(d.Item, { id: n.id, textStyles: "text-xs font-normal", children: n.label })
39
61
  }
40
62
  ),
41
- /* @__PURE__ */ a("p", { className: "ml-4 text-xs", children: [
42
- /* @__PURE__ */ e("span", { className: "font-normal text-tertiary", children: "Total rows " }),
43
- /* @__PURE__ */ e("span", { className: "font-medium text-primary", children: l.toLocaleString() })
63
+ a != null && /* @__PURE__ */ s("p", { className: "ml-4 text-xs", "data-testid": S, children: [
64
+ /* @__PURE__ */ t("span", { className: "font-normal text-tertiary", children: "Total rows " }),
65
+ /* @__PURE__ */ t("span", { className: "font-medium text-primary", children: a.toLocaleString() })
44
66
  ] })
45
67
  ] }),
46
- /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
47
- f,
68
+ /* @__PURE__ */ t("div", { className: "relative", children: /* @__PURE__ */ t(
69
+ y,
48
70
  {
49
- loading: r,
50
- page: n,
51
- total: o,
52
- onPageChange: m
71
+ loading: o,
72
+ page: x,
73
+ total: p,
74
+ onPageChange: b
53
75
  }
54
76
  ) })
55
77
  ] });
56
78
  }
57
- h.displayName = "TablePagination";
79
+ E.displayName = "TablePagination";
58
80
  export {
59
- h as TablePagination
81
+ E as TablePagination
60
82
  };