@pibit.ai/cure-design-system 0.6.61 → 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.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +181 -177
- package/dist/patterns/checklist-item/checklist-item.d.ts +23 -0
- package/dist/patterns/checklist-item/checklist-item.d.ts.map +1 -0
- package/dist/patterns/checklist-item/checklist-item.js +68 -0
- package/dist/patterns/checklist-item/index.d.ts +2 -0
- package/dist/patterns/checklist-item/index.d.ts.map +1 -0
- package/dist/patterns/disabled-reason-tooltip/disabled-reason-tooltip.d.ts +20 -0
- package/dist/patterns/disabled-reason-tooltip/disabled-reason-tooltip.d.ts.map +1 -0
- package/dist/patterns/disabled-reason-tooltip/disabled-reason-tooltip.js +17 -0
- package/dist/patterns/disabled-reason-tooltip/index.d.ts +2 -0
- package/dist/patterns/disabled-reason-tooltip/index.d.ts.map +1 -0
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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"}
|