@pibit.ai/cure-design-system 0.6.57 → 0.6.58
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/code-editor/chrome.d.ts +3 -3
- package/dist/code-editor/chrome.d.ts.map +1 -1
- package/dist/code-editor/chrome.js +6 -6
- package/dist/patterns/confirm-dialog/confirm-dialog.d.ts.map +1 -1
- package/dist/patterns/confirm-dialog/confirm-dialog.js +63 -73
- package/dist/primitives/hierarchical-select/HierarchicalSelect.d.ts.map +1 -1
- package/dist/primitives/hierarchical-select/HierarchicalSelect.js +65 -65
- package/dist/primitives/hierarchical-select/components/HierarchicalSearchInput.d.ts +19 -0
- package/dist/primitives/hierarchical-select/components/HierarchicalSearchInput.d.ts.map +1 -0
- package/dist/primitives/hierarchical-select/components/HierarchicalSearchInput.js +60 -0
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HighlightStyle } from '@codemirror/language';
|
|
2
2
|
export declare const PRIMARY_TEXT = "var(--color-text-primary)";
|
|
3
|
-
export declare const SYNTAX_KEY = "
|
|
4
|
-
export declare const SYNTAX_BOOL = "
|
|
5
|
-
export declare const SYNTAX_NUMBER = "
|
|
3
|
+
export declare const SYNTAX_KEY = "#D97706";
|
|
4
|
+
export declare const SYNTAX_BOOL = "#2563EB";
|
|
5
|
+
export declare const SYNTAX_NUMBER = "#059669";
|
|
6
6
|
export declare const MONOSPACE_STACK = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace";
|
|
7
7
|
export declare const codeSyntaxHighlight: HighlightStyle;
|
|
8
8
|
export declare const codeEditorChromeTheme: import('@codemirror/state').Extension;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../src/code-editor/chrome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../src/code-editor/chrome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAWtD,eAAO,MAAM,YAAY,8BAA8B,CAAC;AACxD,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,eAAO,MAAM,eAAe,qEACwC,CAAC;AAErE,eAAO,MAAM,mBAAmB,gBA0B9B,CAAC;AAEH,eAAO,MAAM,qBAAqB,uCAsChC,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { HighlightStyle as
|
|
1
|
+
import { HighlightStyle as c } from "@codemirror/language";
|
|
2
2
|
import { EditorView as e } from "@codemirror/view";
|
|
3
3
|
import { tags as o } from "@lezer/highlight";
|
|
4
|
-
const r = "var(--color-text-primary)", t = "
|
|
4
|
+
const r = "var(--color-text-primary)", t = "#D97706", a = "#2563EB", l = "#059669", i = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", p = c.define([
|
|
5
5
|
{ tag: o.propertyName, color: t },
|
|
6
6
|
{ tag: o.definition(o.propertyName), color: t },
|
|
7
7
|
{ tag: o.string, color: t },
|
|
8
8
|
{ tag: o.special(o.string), color: t },
|
|
9
9
|
{ tag: o.attributeValue, color: t },
|
|
10
|
-
{ tag: o.bool, color:
|
|
11
|
-
{ tag: o.null, color:
|
|
10
|
+
{ tag: o.bool, color: a },
|
|
11
|
+
{ tag: o.null, color: a },
|
|
12
12
|
{ tag: o.number, color: l },
|
|
13
13
|
{ tag: o.keyword, color: r },
|
|
14
14
|
{ tag: o.controlKeyword, color: r },
|
|
@@ -67,9 +67,9 @@ const r = "var(--color-text-primary)", t = "var(--color-utility-warning-600)", c
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
export {
|
|
70
|
-
|
|
70
|
+
i as MONOSPACE_STACK,
|
|
71
71
|
r as PRIMARY_TEXT,
|
|
72
|
-
|
|
72
|
+
a as SYNTAX_BOOL,
|
|
73
73
|
t as SYNTAX_KEY,
|
|
74
74
|
l as SYNTAX_NUMBER,
|
|
75
75
|
d as codeEditorChromeTheme,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../../src/patterns/confirm-dialog/confirm-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../../src/patterns/confirm-dialog/confirm-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAevC,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,CAAC;AA0BtE,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,2EAA2E;IAC3E,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,uEAAuE;IACvE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+FAA+F;IAC/F,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC1B,uEAAuE;IACvE,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,kEAAkE;IAClE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,4BAA4B,CAAC;IAC/C,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,wFAAwF;IACxF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,aAAa,GAAI,0NAkB3B,kBAAkB,4CAwFpB,CAAC"}
|
|
@@ -1,133 +1,123 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const U = {
|
|
1
|
+
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { InfoCircle as I, AlertTriangle as j, AlertCircle as $, XClose as M } from "@untitledui/icons";
|
|
3
|
+
import { ButtonUtility as T } from "../../primitives/button/button-utility.js";
|
|
4
|
+
import { cx as a } from "../../utils/cn.js";
|
|
5
|
+
import { ModalWrapper as U } from "../modal/modal-wrapper.js";
|
|
6
|
+
import { Button as o } from "../../primitives/button/button.js";
|
|
7
|
+
const W = {
|
|
9
8
|
destructive: {
|
|
10
|
-
Icon:
|
|
9
|
+
Icon: $,
|
|
11
10
|
iconBox: "bg-warning-secondary",
|
|
12
11
|
icon: "text-featured-icon-light-fg-warning",
|
|
13
12
|
confirmColor: "primary-destructive"
|
|
14
13
|
},
|
|
15
14
|
warning: {
|
|
16
|
-
Icon:
|
|
15
|
+
Icon: j,
|
|
17
16
|
iconBox: "bg-warning-secondary",
|
|
18
17
|
icon: "text-fg-warning-primary",
|
|
19
18
|
confirmColor: "primary"
|
|
20
19
|
},
|
|
21
20
|
primary: {
|
|
22
|
-
Icon:
|
|
21
|
+
Icon: I,
|
|
23
22
|
iconBox: "bg-brand-secondary",
|
|
24
23
|
icon: "text-fg-brand-secondary",
|
|
25
24
|
confirmColor: "primary"
|
|
26
25
|
}
|
|
27
|
-
},
|
|
28
|
-
isOpen:
|
|
26
|
+
}, H = ({
|
|
27
|
+
isOpen: b,
|
|
29
28
|
onClose: s,
|
|
30
|
-
title:
|
|
31
|
-
description:
|
|
32
|
-
confirmLabel:
|
|
33
|
-
cancelLabel:
|
|
34
|
-
onConfirm:
|
|
29
|
+
title: c,
|
|
30
|
+
description: n,
|
|
31
|
+
confirmLabel: y,
|
|
32
|
+
cancelLabel: u = "Cancel",
|
|
33
|
+
onConfirm: g,
|
|
35
34
|
isLoading: r = !1,
|
|
36
|
-
isConfirmDisabled:
|
|
37
|
-
size:
|
|
38
|
-
tone:
|
|
39
|
-
icon:
|
|
40
|
-
secondaryAction:
|
|
41
|
-
testIdPrefix:
|
|
42
|
-
isDismissable:
|
|
43
|
-
ignoreClickAway:
|
|
44
|
-
"data-testid":
|
|
35
|
+
isConfirmDisabled: d = !1,
|
|
36
|
+
size: h = "default",
|
|
37
|
+
tone: m = "primary",
|
|
38
|
+
icon: v,
|
|
39
|
+
secondaryAction: i,
|
|
40
|
+
testIdPrefix: f,
|
|
41
|
+
isDismissable: C = !0,
|
|
42
|
+
ignoreClickAway: w = !1,
|
|
43
|
+
"data-testid": N
|
|
45
44
|
}) => {
|
|
46
|
-
const { Icon:
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
const o = requestAnimationFrame(() => {
|
|
50
|
-
var g, h;
|
|
51
|
-
(h = (g = y.current) == null ? void 0 : g.querySelector("[data-confirm-dialog-cancel]")) == null || h.focus();
|
|
52
|
-
});
|
|
53
|
-
return () => cancelAnimationFrame(o);
|
|
54
|
-
}, [l]), /* @__PURE__ */ e(
|
|
55
|
-
T,
|
|
45
|
+
const { Icon: z, iconBox: B, icon: D, confirmColor: p } = W[m], t = (k) => f ? `${f}-${k}` : void 0, x = () => s(!1);
|
|
46
|
+
return /* @__PURE__ */ e(
|
|
47
|
+
U,
|
|
56
48
|
{
|
|
57
|
-
isOpen:
|
|
49
|
+
isOpen: b,
|
|
58
50
|
onClose: s,
|
|
59
|
-
isDismissable:
|
|
60
|
-
ignoreClickAway:
|
|
61
|
-
"data-testid":
|
|
62
|
-
children: /* @__PURE__ */
|
|
51
|
+
isDismissable: C && !r,
|
|
52
|
+
ignoreClickAway: w,
|
|
53
|
+
"data-testid": N,
|
|
54
|
+
children: /* @__PURE__ */ l(
|
|
63
55
|
"div",
|
|
64
56
|
{
|
|
65
|
-
|
|
66
|
-
className: c(
|
|
57
|
+
className: a(
|
|
67
58
|
"relative max-w-[90vw] rounded-2xl bg-primary p-5",
|
|
68
|
-
|
|
59
|
+
h === "wide" ? "w-lg" : i ? "w-[520px]" : "w-[400px]"
|
|
69
60
|
),
|
|
70
61
|
children: [
|
|
71
62
|
/* @__PURE__ */ e(
|
|
72
|
-
|
|
63
|
+
T,
|
|
73
64
|
{
|
|
74
65
|
color: "tertiary",
|
|
75
66
|
className: "absolute right-2 top-2",
|
|
76
67
|
icon: /* @__PURE__ */ e(M, { size: 24 }),
|
|
77
68
|
isDisabled: r,
|
|
78
|
-
onClick:
|
|
79
|
-
"data-testid":
|
|
69
|
+
onClick: x,
|
|
70
|
+
"data-testid": t("close")
|
|
80
71
|
}
|
|
81
72
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */ e("div", { className:
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-primary", children:
|
|
86
|
-
|
|
73
|
+
/* @__PURE__ */ l("div", { className: "flex flex-col gap-5", children: [
|
|
74
|
+
/* @__PURE__ */ e("div", { className: a("flex size-12 shrink-0 items-center justify-center rounded-xl p-3", B), children: v ?? /* @__PURE__ */ e(z, { size: 24, "aria-label": c, className: D }) }),
|
|
75
|
+
/* @__PURE__ */ l("div", { className: "flex flex-col gap-2", children: [
|
|
76
|
+
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-primary", children: c }),
|
|
77
|
+
n != null && /* @__PURE__ */ e("div", { className: "text-sm leading-6 text-tertiary", children: n })
|
|
87
78
|
] }),
|
|
88
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ l("div", { className: "flex gap-3", children: [
|
|
89
80
|
/* @__PURE__ */ e(
|
|
90
|
-
|
|
81
|
+
o,
|
|
91
82
|
{
|
|
92
83
|
type: "button",
|
|
93
84
|
size: "md",
|
|
94
85
|
color: "secondary",
|
|
95
86
|
className: "flex-1",
|
|
96
87
|
isDisabled: r,
|
|
97
|
-
onClick:
|
|
98
|
-
"data-testid":
|
|
99
|
-
|
|
100
|
-
children: C
|
|
88
|
+
onClick: x,
|
|
89
|
+
"data-testid": t("cancel"),
|
|
90
|
+
children: u
|
|
101
91
|
}
|
|
102
92
|
),
|
|
103
|
-
|
|
104
|
-
|
|
93
|
+
i && /* @__PURE__ */ e(
|
|
94
|
+
o,
|
|
105
95
|
{
|
|
106
96
|
type: "button",
|
|
107
97
|
size: "md",
|
|
108
98
|
color: "secondary",
|
|
109
99
|
className: "flex-1",
|
|
110
100
|
isDisabled: r,
|
|
111
|
-
onClick:
|
|
112
|
-
"data-testid":
|
|
113
|
-
children:
|
|
101
|
+
onClick: i.onAction,
|
|
102
|
+
"data-testid": t("secondary"),
|
|
103
|
+
children: i.label
|
|
114
104
|
}
|
|
115
105
|
),
|
|
116
106
|
/* @__PURE__ */ e(
|
|
117
|
-
|
|
107
|
+
o,
|
|
118
108
|
{
|
|
119
109
|
type: "button",
|
|
120
110
|
size: "md",
|
|
121
|
-
color:
|
|
122
|
-
className:
|
|
111
|
+
color: p,
|
|
112
|
+
className: a(
|
|
123
113
|
"flex-1",
|
|
124
|
-
|
|
114
|
+
d && !r && p === "primary-destructive" && "disabled:bg-error-solid disabled:text-white disabled:opacity-50 disabled:ring-transparent"
|
|
125
115
|
),
|
|
126
116
|
isLoading: r,
|
|
127
|
-
isDisabled: r ||
|
|
128
|
-
onClick: () => void
|
|
129
|
-
"data-testid":
|
|
130
|
-
children:
|
|
117
|
+
isDisabled: r || d,
|
|
118
|
+
onClick: () => void g(),
|
|
119
|
+
"data-testid": t("submit"),
|
|
120
|
+
children: y ?? (m === "destructive" ? "Delete" : "Confirm")
|
|
131
121
|
}
|
|
132
122
|
)
|
|
133
123
|
] })
|
|
@@ -139,5 +129,5 @@ const U = {
|
|
|
139
129
|
);
|
|
140
130
|
};
|
|
141
131
|
export {
|
|
142
|
-
|
|
132
|
+
H as ConfirmDialog
|
|
143
133
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchicalSelect.d.ts","sourceRoot":"","sources":["../../../src/primitives/hierarchical-select/HierarchicalSelect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAgD,MAAM,SAAS,CAAC;AAuBrG,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,EAClC,IAAW,EACX,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,eAAe,EACf,QAAQ,EACR,iBAA8C,EAC9C,SAAe,EACf,SAAS,EACT,aAAoB,EACpB,eAAe,GAClB,EAAE,uBAAuB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"HierarchicalSelect.d.ts","sourceRoot":"","sources":["../../../src/primitives/hierarchical-select/HierarchicalSelect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAgD,MAAM,SAAS,CAAC;AAuBrG,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,EAClC,IAAW,EACX,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,eAAe,EACf,QAAQ,EACR,iBAA8C,EAC9C,SAAe,EACf,SAAS,EACT,aAAoB,EACpB,eAAe,GAClB,EAAE,uBAAuB,CAAC,CAAC,CAAC,2CA2O5B;yBAvPe,kBAAkB"}
|
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
import { jsxs as T, jsx as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as T, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as L, useMemo as a, useEffect as P, useCallback as S } from "react";
|
|
3
3
|
import { HierarchicalItem as U } from "./components/HierarchicalItem.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
4
|
+
import { HierarchicalSearchInput as W } from "./components/HierarchicalSearchInput.js";
|
|
5
|
+
import { getAllParentIds as X, toggleSelection as Y, getVisibleLeafIds as Z, getSelectAllState as z, toggleSelectAll as K, getSelectionState as ee } from "./utils/selection.js";
|
|
6
|
+
import { searchTree as te } from "./utils/search.js";
|
|
7
|
+
import { cx as f } from "../../utils/cn.js";
|
|
8
8
|
import { Icon as se } from "../icon/icon.js";
|
|
9
|
-
import { Checkbox as
|
|
9
|
+
import { Checkbox as le } from "../checkbox/checkbox.js";
|
|
10
10
|
const y = {
|
|
11
11
|
xs: "text-xs",
|
|
12
12
|
sm: "text-sm",
|
|
13
13
|
md: "text-md",
|
|
14
14
|
lg: "text-lg"
|
|
15
15
|
};
|
|
16
|
-
function
|
|
16
|
+
function re({
|
|
17
17
|
size: d = "md",
|
|
18
18
|
data: h,
|
|
19
19
|
selectionKey: m,
|
|
20
20
|
transformData: E,
|
|
21
21
|
reconstructData: v,
|
|
22
22
|
onChange: I,
|
|
23
|
-
searchPlaceholder:
|
|
23
|
+
searchPlaceholder: R = "Search objects or fields",
|
|
24
24
|
maxHeight: N = 400,
|
|
25
|
-
className:
|
|
26
|
-
showSelectAll:
|
|
25
|
+
className: $,
|
|
26
|
+
showSelectAll: D = !0,
|
|
27
27
|
childCountLabel: Q
|
|
28
28
|
}) {
|
|
29
|
-
const [u, V] =
|
|
30
|
-
|
|
31
|
-
w(new Set(
|
|
29
|
+
const [u, V] = L(""), [C, w] = L(() => /* @__PURE__ */ new Set()), t = a(() => E(h, m), [h, m, E]), g = a(() => X(t), [t]), q = a(() => Array.from(g).sort().join("\0"), [g]);
|
|
30
|
+
P(() => {
|
|
31
|
+
w(new Set(g));
|
|
32
32
|
}, [q]);
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const r = a(() => te(t, u), [t, u]), n = !!u.trim();
|
|
34
|
+
P(() => {
|
|
35
|
+
n && w((e) => {
|
|
36
36
|
const s = new Set(e);
|
|
37
|
-
return
|
|
38
|
-
let o = t.parentMap.get(
|
|
37
|
+
return r.visibleIds.forEach((l) => {
|
|
38
|
+
let o = t.parentMap.get(l);
|
|
39
39
|
for (; o; )
|
|
40
40
|
s.add(o), o = t.parentMap.get(o) ?? null;
|
|
41
41
|
}), s;
|
|
42
42
|
});
|
|
43
|
-
}, [
|
|
43
|
+
}, [n, r.visibleIds, t]);
|
|
44
44
|
const B = S(
|
|
45
45
|
(e) => {
|
|
46
|
-
const
|
|
47
|
-
V(e),
|
|
46
|
+
const l = u.trim().length > 0 && e.trim().length === 0;
|
|
47
|
+
V(e), l && w(new Set(g));
|
|
48
48
|
},
|
|
49
|
-
[u,
|
|
50
|
-
), p = a(() =>
|
|
49
|
+
[u, g]
|
|
50
|
+
), p = a(() => n ? r.visibleIds : void 0, [n, r.visibleIds]), _ = S(
|
|
51
51
|
(e) => {
|
|
52
|
-
const s =
|
|
52
|
+
const s = n ? r.visibleIds : void 0, l = Y(e, t, s), o = v(l, h, m);
|
|
53
53
|
I(o);
|
|
54
54
|
},
|
|
55
|
-
[t,
|
|
56
|
-
), F = a(() =>
|
|
57
|
-
if (
|
|
58
|
-
const e =
|
|
55
|
+
[t, n, r.visibleIds, v, h, m, I]
|
|
56
|
+
), F = a(() => Z(t, p).length, [t, p]), j = a(() => z(t, p), [t, p]), b = F === 0, M = S(() => {
|
|
57
|
+
if (b) return;
|
|
58
|
+
const e = K(t, p), s = v(e, h, m);
|
|
59
59
|
I(s);
|
|
60
|
-
}, [
|
|
60
|
+
}, [b, t, p, v, h, m, I]), G = S((e) => {
|
|
61
61
|
w((s) => {
|
|
62
|
-
const
|
|
63
|
-
return
|
|
62
|
+
const l = new Set(s);
|
|
63
|
+
return l.has(e) ? l.delete(e) : l.add(e), l;
|
|
64
64
|
});
|
|
65
65
|
}, []), A = a(() => {
|
|
66
|
-
const e = [], s = (
|
|
67
|
-
(
|
|
68
|
-
if (
|
|
66
|
+
const e = [], s = (l) => {
|
|
67
|
+
(l === null ? t.rootIds : t.childrenMap.get(l) || []).forEach((c) => {
|
|
68
|
+
if (n && !r.visibleIds.has(c))
|
|
69
69
|
return;
|
|
70
70
|
const x = t.items.get(c);
|
|
71
71
|
x && (e.push({
|
|
72
72
|
id: c,
|
|
73
73
|
item: x,
|
|
74
|
-
isMatched:
|
|
74
|
+
isMatched: r.matchedIds.has(c)
|
|
75
75
|
}), x.hasChildren && C.has(c) && s(c));
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
return s(null), e;
|
|
79
|
-
}, [t,
|
|
79
|
+
}, [t, n, r.visibleIds, r.matchedIds, C]), J = S(
|
|
80
80
|
(e) => {
|
|
81
|
-
if (!
|
|
82
|
-
const s =
|
|
81
|
+
if (!n) return null;
|
|
82
|
+
const s = r.resultCounts.get(e);
|
|
83
83
|
return s === void 0 ? null : `${s} ${s === 1 ? "result" : "results"}`;
|
|
84
84
|
},
|
|
85
|
-
[
|
|
86
|
-
), k = t.items.size > 0, O =
|
|
87
|
-
return /* @__PURE__ */ T("div", { className:
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
85
|
+
[n, r.resultCounts]
|
|
86
|
+
), k = t.items.size > 0, O = D && k && (!n || A.length > 0), H = n ? "Select all results" : "Select All";
|
|
87
|
+
return /* @__PURE__ */ T("div", { className: f("flex flex-col border border-primary rounded-lg bg-primary overflow-hidden", $), children: [
|
|
88
|
+
/* @__PURE__ */ i(
|
|
89
|
+
W,
|
|
90
90
|
{
|
|
91
91
|
size: d == "xs" ? "sm" : d,
|
|
92
92
|
value: u,
|
|
93
93
|
onChange: B,
|
|
94
|
-
placeholder:
|
|
94
|
+
placeholder: R
|
|
95
95
|
}
|
|
96
|
-
)
|
|
96
|
+
),
|
|
97
97
|
O && /* @__PURE__ */ T(
|
|
98
98
|
"div",
|
|
99
99
|
{
|
|
100
|
-
className:
|
|
100
|
+
className: f(
|
|
101
101
|
"flex shrink-0 items-center gap-2 border-b border-secondary px-3 py-2.5",
|
|
102
|
-
|
|
102
|
+
b ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-secondary_subtle transition-colors"
|
|
103
103
|
),
|
|
104
104
|
onClick: M,
|
|
105
|
-
"aria-disabled":
|
|
105
|
+
"aria-disabled": b,
|
|
106
106
|
children: [
|
|
107
|
-
j === "indeterminate" ? /* @__PURE__ */
|
|
107
|
+
j === "indeterminate" ? /* @__PURE__ */ i(se, { name: "MinusSquare", className: "size-4 text-utility-brand-600" }) : /* @__PURE__ */ i(
|
|
108
108
|
"span",
|
|
109
109
|
{
|
|
110
110
|
onClick: (e) => e.stopPropagation(),
|
|
111
|
-
children: /* @__PURE__ */
|
|
112
|
-
|
|
111
|
+
children: /* @__PURE__ */ i(
|
|
112
|
+
le,
|
|
113
113
|
{
|
|
114
114
|
isSelected: j === "selected",
|
|
115
|
-
isDisabled:
|
|
115
|
+
isDisabled: b,
|
|
116
116
|
onChange: M,
|
|
117
|
-
"aria-label":
|
|
117
|
+
"aria-label": H
|
|
118
118
|
}
|
|
119
119
|
)
|
|
120
120
|
}
|
|
121
121
|
),
|
|
122
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ i("span", { className: f("font-medium text-primary", y[d]), children: H })
|
|
123
123
|
]
|
|
124
124
|
}
|
|
125
125
|
),
|
|
126
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ i(
|
|
127
127
|
"div",
|
|
128
128
|
{
|
|
129
129
|
className: "overflow-y-auto",
|
|
130
130
|
style: { maxHeight: typeof N == "number" ? `${N}px` : N },
|
|
131
131
|
role: "listbox",
|
|
132
132
|
"aria-multiselectable": "true",
|
|
133
|
-
children: k ? A.length === 0 ? /* @__PURE__ */
|
|
134
|
-
const o = s.depth === 0 ? J(e) : null, c =
|
|
135
|
-
return /* @__PURE__ */
|
|
136
|
-
/* @__PURE__ */
|
|
133
|
+
children: k ? A.length === 0 ? /* @__PURE__ */ i("div", { className: f("flex items-center justify-center py-8 text-tertiary", y[d]), children: "No results found" }) : A.map(({ id: e, item: s, isMatched: l }) => {
|
|
134
|
+
const o = s.depth === 0 ? J(e) : null, c = ee(e, t), x = s.disabled === !0;
|
|
135
|
+
return /* @__PURE__ */ i("div", { children: /* @__PURE__ */ T("div", { className: "flex items-center", children: [
|
|
136
|
+
/* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
|
|
137
137
|
U,
|
|
138
138
|
{
|
|
139
139
|
size: d,
|
|
140
140
|
item: s,
|
|
141
141
|
selectionState: c,
|
|
142
|
-
isMatched:
|
|
142
|
+
isMatched: l,
|
|
143
143
|
searchQuery: u,
|
|
144
144
|
onToggle: _,
|
|
145
145
|
isExpandable: s.hasChildren,
|
|
@@ -149,14 +149,14 @@ function le({
|
|
|
149
149
|
childCountLabel: Q
|
|
150
150
|
}
|
|
151
151
|
) }),
|
|
152
|
-
o && /* @__PURE__ */
|
|
152
|
+
o && /* @__PURE__ */ i("span", { className: f("text-tertiary pr-3 whitespace-nowrap", y[d]), children: o })
|
|
153
153
|
] }) }, e);
|
|
154
|
-
}) : /* @__PURE__ */
|
|
154
|
+
}) : /* @__PURE__ */ i("div", { className: f("flex items-center justify-center py-8 text-tertiary", y[d]), children: "No items available" })
|
|
155
155
|
}
|
|
156
156
|
)
|
|
157
157
|
] });
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
re.displayName = "HierarchicalSelect";
|
|
160
160
|
export {
|
|
161
|
-
|
|
161
|
+
re as HierarchicalSelect
|
|
162
162
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HierarchicalSearchInput
|
|
3
|
+
* The tree's header search: a borderless input on the panel's top edge, with a clear button.
|
|
4
|
+
* Frozen to platform-ui's base/hierarchical-select SearchInput; the Select SearchInput is a
|
|
5
|
+
* bordered field and renders a taller row with smaller text.
|
|
6
|
+
*/
|
|
7
|
+
interface HierarchicalSearchInputProps {
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
9
|
+
value: string;
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const HierarchicalSearchInput: {
|
|
15
|
+
({ value, onChange, placeholder, className, size, }: HierarchicalSearchInputProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=HierarchicalSearchInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HierarchicalSearchInput.d.ts","sourceRoot":"","sources":["../../../../src/primitives/hierarchical-select/components/HierarchicalSearchInput.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,UAAU,4BAA4B;IAClC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAgBD,eAAO,MAAM,uBAAuB;yDAMjC,4BAA4B;;CAqC9B,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as s } from "react";
|
|
3
|
+
import { SearchMd as x, XClose as h } from "@untitledui/icons";
|
|
4
|
+
import { cx as c } from "../../../utils/cn.js";
|
|
5
|
+
const l = {
|
|
6
|
+
xs: 12,
|
|
7
|
+
sm: 14,
|
|
8
|
+
md: 16,
|
|
9
|
+
lg: 18
|
|
10
|
+
}, u = {
|
|
11
|
+
xs: "text-xs",
|
|
12
|
+
sm: "text-sm",
|
|
13
|
+
md: "text-md",
|
|
14
|
+
lg: "text-lg"
|
|
15
|
+
}, b = ({
|
|
16
|
+
value: a,
|
|
17
|
+
onChange: e,
|
|
18
|
+
placeholder: o = "Search...",
|
|
19
|
+
className: n,
|
|
20
|
+
size: r = "md"
|
|
21
|
+
}) => {
|
|
22
|
+
const i = s(
|
|
23
|
+
(p) => {
|
|
24
|
+
e(p.target.value);
|
|
25
|
+
},
|
|
26
|
+
[e]
|
|
27
|
+
), m = s(() => {
|
|
28
|
+
e("");
|
|
29
|
+
}, [e]);
|
|
30
|
+
return /* @__PURE__ */ d("div", { className: c("flex items-center gap-2 px-3 py-2 border-b border-secondary", n), children: [
|
|
31
|
+
/* @__PURE__ */ t(x, { size: l[r], className: "text-tertiary shrink-0" }),
|
|
32
|
+
/* @__PURE__ */ t(
|
|
33
|
+
"input",
|
|
34
|
+
{
|
|
35
|
+
type: "text",
|
|
36
|
+
value: a,
|
|
37
|
+
onChange: i,
|
|
38
|
+
placeholder: o,
|
|
39
|
+
className: c(
|
|
40
|
+
"flex-1 bg-transparent outline-none placeholder:text-placeholder text-primary",
|
|
41
|
+
u[r]
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
a && /* @__PURE__ */ t(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
onClick: m,
|
|
50
|
+
className: "p-0.5 rounded hover:bg-secondary_subtle transition-colors",
|
|
51
|
+
"aria-label": "Clear search",
|
|
52
|
+
children: /* @__PURE__ */ t(h, { size: l[r], className: "text-tertiary" })
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] });
|
|
56
|
+
};
|
|
57
|
+
b.displayName = "HierarchicalSearchInput";
|
|
58
|
+
export {
|
|
59
|
+
b as HierarchicalSearchInput
|
|
60
|
+
};
|