@pibit.ai/cure-design-system 0.3.33 → 0.3.35
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HideFieldsDropdown.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/HideFieldsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAU1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,gBAAgB,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACxD,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"HideFieldsDropdown.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/HideFieldsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAU1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,gBAAgB,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACxD,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAmED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAuL1D,CAAC"}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { jsxs as d, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { useState as g, useEffect as j, useMemo as
|
|
2
|
+
import { useState as g, useEffect as j, useMemo as u } from "react";
|
|
3
3
|
import { EyeOff as q, Eye as K } from "@untitledui/icons";
|
|
4
4
|
import _ from "../../../primitives/select/SearchInput.js";
|
|
5
5
|
import { cx as I } from "../../../utils/cn.js";
|
|
6
6
|
import { TOOLBAR_ICONS as $ } from "../toolbar-icons.js";
|
|
7
|
-
import { resolveColumnLabel as
|
|
7
|
+
import { resolveColumnLabel as G } from "./tableToolbarHelpers.js";
|
|
8
8
|
import { Dropdown as H } from "../../../primitives/dropdown/dropdown.js";
|
|
9
9
|
import { Button as z } from "../../../primitives/button/button.js";
|
|
10
|
-
import { useDragControls as
|
|
11
|
-
import { Toggle as
|
|
10
|
+
import { useDragControls as M } from "../../../node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js";
|
|
11
|
+
import { Toggle as F } from "../../../primitives/toggle/toggle.js";
|
|
12
12
|
import { ReorderGroup as J } from "../../../node_modules/framer-motion/dist/es/components/Reorder/Group.js";
|
|
13
13
|
import { ReorderItem as Q } from "../../../node_modules/framer-motion/dist/es/components/Reorder/Item.js";
|
|
14
|
-
const U = ({
|
|
15
|
-
|
|
14
|
+
const U = ({
|
|
15
|
+
columnKey: a,
|
|
16
|
+
label: o,
|
|
17
|
+
isHidden: p,
|
|
18
|
+
isDisabled: i,
|
|
19
|
+
onToggle: x
|
|
20
|
+
}) => {
|
|
21
|
+
const l = M();
|
|
16
22
|
return /* @__PURE__ */ d(
|
|
17
23
|
Q,
|
|
18
24
|
{
|
|
@@ -31,12 +37,12 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
|
|
|
31
37
|
transition: { type: "spring", stiffness: 300, damping: 25 },
|
|
32
38
|
children: [
|
|
33
39
|
/* @__PURE__ */ s(
|
|
34
|
-
|
|
40
|
+
F,
|
|
35
41
|
{
|
|
36
42
|
"aria-label": `Toggle visibility of ${o}`,
|
|
37
43
|
isSelected: !p,
|
|
38
44
|
isDisabled: i,
|
|
39
|
-
onChange:
|
|
45
|
+
onChange: x,
|
|
40
46
|
size: "sm",
|
|
41
47
|
slim: !0
|
|
42
48
|
}
|
|
@@ -44,7 +50,10 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
|
|
|
44
50
|
/* @__PURE__ */ s(
|
|
45
51
|
"span",
|
|
46
52
|
{
|
|
47
|
-
className: I(
|
|
53
|
+
className: I(
|
|
54
|
+
"flex-1 truncate text-xs",
|
|
55
|
+
p ? "text-tertiary" : "text-secondary"
|
|
56
|
+
),
|
|
48
57
|
title: o,
|
|
49
58
|
children: o
|
|
50
59
|
}
|
|
@@ -56,7 +65,14 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
|
|
|
56
65
|
className: "shrink-0 cursor-grab text-fg-quaternary hover:text-fg-secondary touch-none select-none",
|
|
57
66
|
"aria-label": `Drag ${o}`,
|
|
58
67
|
title: "Drag to reorder",
|
|
59
|
-
children: /* @__PURE__ */ s(
|
|
68
|
+
children: /* @__PURE__ */ s(
|
|
69
|
+
"img",
|
|
70
|
+
{
|
|
71
|
+
src: $.reorderDots,
|
|
72
|
+
alt: "",
|
|
73
|
+
className: "h-4 w-4 pointer-events-none"
|
|
74
|
+
}
|
|
75
|
+
)
|
|
60
76
|
}
|
|
61
77
|
)
|
|
62
78
|
]
|
|
@@ -67,38 +83,47 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
|
|
|
67
83
|
hiddenColumns: o,
|
|
68
84
|
setHiddenColumns: p,
|
|
69
85
|
columnOrder: i,
|
|
70
|
-
setColumnOrder:
|
|
86
|
+
setColumnOrder: x,
|
|
71
87
|
labelMeta: l,
|
|
72
88
|
isDisabled: v
|
|
73
89
|
}) => {
|
|
74
|
-
const [y, D] = g(!1), [b, R] = g(""), [
|
|
90
|
+
const [y, D] = g(!1), [b, R] = g(""), [m, w] = g(
|
|
91
|
+
() => new Set(o)
|
|
92
|
+
), [N, f] = g(() => [
|
|
93
|
+
...i
|
|
94
|
+
]);
|
|
75
95
|
j(() => {
|
|
76
|
-
y && (w(new Set(o)),
|
|
96
|
+
y && (w(new Set(o)), f([...i]), R(""));
|
|
77
97
|
}, [y, o, i]);
|
|
78
|
-
const c =
|
|
98
|
+
const c = u(() => {
|
|
79
99
|
const e = /* @__PURE__ */ new Map();
|
|
80
|
-
for (const r of a)
|
|
100
|
+
for (const r of a)
|
|
101
|
+
e.set(r.value, G(r, l));
|
|
81
102
|
return e;
|
|
82
|
-
}, [a, l]), n =
|
|
103
|
+
}, [a, l]), n = u(() => {
|
|
83
104
|
const e = /* @__PURE__ */ new Set(), r = [];
|
|
84
105
|
for (const t of N)
|
|
85
106
|
c.has(t) && !e.has(t) && (e.add(t), r.push(t));
|
|
86
107
|
for (const t of a)
|
|
87
108
|
e.has(t.value) || (e.add(t.value), r.push(t.value));
|
|
88
109
|
return r;
|
|
89
|
-
}, [N, a, c]), h =
|
|
110
|
+
}, [N, a, c]), h = u(() => {
|
|
90
111
|
const e = b.trim().toLowerCase();
|
|
91
|
-
return e ? n.filter(
|
|
112
|
+
return e ? n.filter(
|
|
113
|
+
(r) => (c.get(r) ?? r).toLowerCase().includes(e)
|
|
114
|
+
) : n;
|
|
92
115
|
}, [n, b, c]), T = (e) => {
|
|
93
116
|
if (e.length === n.length) {
|
|
94
|
-
|
|
117
|
+
f(e);
|
|
95
118
|
return;
|
|
96
119
|
}
|
|
97
|
-
const r = new Set(h), t = [...e], C = n.map(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
120
|
+
const r = new Set(h), t = [...e], C = n.map(
|
|
121
|
+
(L) => r.has(L) ? t.shift() : L
|
|
122
|
+
);
|
|
123
|
+
f(C);
|
|
124
|
+
}, A = u(
|
|
125
|
+
() => n.filter((e) => !m.has(e)).length,
|
|
126
|
+
[n, m]
|
|
102
127
|
), P = (e) => {
|
|
103
128
|
w((r) => {
|
|
104
129
|
const t = new Set(r);
|
|
@@ -112,9 +137,9 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
|
|
|
112
137
|
return t;
|
|
113
138
|
});
|
|
114
139
|
}, B = () => {
|
|
115
|
-
w(/* @__PURE__ */ new Set()),
|
|
140
|
+
w(/* @__PURE__ */ new Set()), f(a.map((e) => e.value));
|
|
116
141
|
}, E = () => {
|
|
117
|
-
p(new Set(
|
|
142
|
+
p(new Set(m)), x([...N]), D(!1);
|
|
118
143
|
}, O = o.size, S = O > 0;
|
|
119
144
|
return /* @__PURE__ */ d(H.Root, { isOpen: y, onOpenChange: D, children: [
|
|
120
145
|
/* @__PURE__ */ d(
|
|
@@ -128,7 +153,7 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
|
|
|
128
153
|
S && "ring-1 ring-brand-600 bg-brand-primary text-brand-600 hover:bg-brand-primary hover:text-brand-600"
|
|
129
154
|
),
|
|
130
155
|
children: [
|
|
131
|
-
"Hide
|
|
156
|
+
"Hide Columns",
|
|
132
157
|
S && /* @__PURE__ */ s("span", { className: "text-xs font-semibold text-brand-600 ml-1", children: O })
|
|
133
158
|
]
|
|
134
159
|
}
|
|
@@ -138,13 +163,13 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
|
|
|
138
163
|
_,
|
|
139
164
|
{
|
|
140
165
|
size: "sm",
|
|
141
|
-
placeholder: "Search
|
|
166
|
+
placeholder: "Search columns",
|
|
142
167
|
value: b,
|
|
143
168
|
onChange: (e) => R(e),
|
|
144
169
|
className: "w-full ring-0 outline-hidden bg-secondary rounded-lg"
|
|
145
170
|
}
|
|
146
171
|
),
|
|
147
|
-
/* @__PURE__ */ s("div", { className: "max-h-[40vh] overflow-y-auto scrollbar-hide pr-0.5", children: h.length === 0 ? /* @__PURE__ */ s("p", { className: "px-2 py-3 text-xs text-tertiary", children: "No
|
|
172
|
+
/* @__PURE__ */ s("div", { className: "max-h-[40vh] overflow-y-auto scrollbar-hide pr-0.5", children: h.length === 0 ? /* @__PURE__ */ s("p", { className: "px-2 py-3 text-xs text-tertiary", children: "No columns match." }) : /* @__PURE__ */ s(
|
|
148
173
|
J,
|
|
149
174
|
{
|
|
150
175
|
as: "div",
|
|
@@ -153,7 +178,7 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
|
|
|
153
178
|
onReorder: T,
|
|
154
179
|
className: "flex flex-col gap-0.5",
|
|
155
180
|
children: h.map((e) => {
|
|
156
|
-
const r =
|
|
181
|
+
const r = m.has(e);
|
|
157
182
|
return /* @__PURE__ */ s(
|
|
158
183
|
U,
|
|
159
184
|
{
|
|
@@ -169,8 +194,26 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
|
|
|
169
194
|
}
|
|
170
195
|
) }),
|
|
171
196
|
/* @__PURE__ */ d("div", { className: "flex gap-2 pt-1 px-2 pb-2", children: [
|
|
172
|
-
/* @__PURE__ */ s(
|
|
173
|
-
|
|
197
|
+
/* @__PURE__ */ s(
|
|
198
|
+
z,
|
|
199
|
+
{
|
|
200
|
+
color: "secondary",
|
|
201
|
+
size: "xs",
|
|
202
|
+
onClick: B,
|
|
203
|
+
className: "flex-1",
|
|
204
|
+
children: "Reset"
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
/* @__PURE__ */ s(
|
|
208
|
+
z,
|
|
209
|
+
{
|
|
210
|
+
color: "primary",
|
|
211
|
+
size: "xs",
|
|
212
|
+
onClick: E,
|
|
213
|
+
className: "flex-1",
|
|
214
|
+
children: "Apply"
|
|
215
|
+
}
|
|
216
|
+
)
|
|
174
217
|
] })
|
|
175
218
|
] }) })
|
|
176
219
|
] });
|