@pibit.ai/cure-design-system 0.3.23 → 0.3.24
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 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +157 -140
- package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
- package/dist/patterns/table/TableWrapper.js +236 -233
- package/dist/patterns/table/index.d.ts +4 -1
- package/dist/patterns/table/index.d.ts.map +1 -1
- package/dist/patterns/table/integrateTableUndoRedo.d.ts +41 -0
- package/dist/patterns/table/integrateTableUndoRedo.d.ts.map +1 -0
- package/dist/patterns/table/integrateTableUndoRedo.js +63 -0
- package/dist/patterns/table/storyHelpers/useMockTableState.d.ts +3 -1
- package/dist/patterns/table/storyHelpers/useMockTableState.d.ts.map +1 -1
- package/dist/patterns/table/table.d.ts +2 -1
- package/dist/patterns/table/table.d.ts.map +1 -1
- package/dist/patterns/table/table.js +181 -155
- package/dist/patterns/table/tableUndoRedo.d.ts +38 -0
- package/dist/patterns/table/tableUndoRedo.d.ts.map +1 -0
- package/dist/patterns/table/tableUndoRedo.js +147 -0
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts +4 -0
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.js +81 -77
- package/dist/patterns/table/toolbar/TableToolbar.d.ts +11 -2
- package/dist/patterns/table/toolbar/TableToolbar.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/TableToolbar.js +163 -114
- package/dist/patterns/table/toolbar/index.d.ts +1 -1
- package/dist/patterns/table/toolbar/index.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/useUndoRedoShortcuts.d.ts +9 -0
- package/dist/patterns/table/toolbar/useUndoRedoShortcuts.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/useUndoRedoShortcuts.js +21 -0
- package/dist/patterns/table/types.d.ts +4 -1
- package/dist/patterns/table/types.d.ts.map +1 -1
- package/dist/patterns/table/useTableUndoRedo.d.ts +41 -0
- package/dist/patterns/table/useTableUndoRedo.d.ts.map +1 -0
- package/dist/patterns/table/useTableUndoRedo.js +168 -0
- package/dist/primitives/badge/badge.js +5 -5
- package/dist/primitives/input/input.d.ts +1 -1
- package/dist/primitives/input/input.d.ts.map +1 -1
- package/dist/primitives/input/input.js +63 -62
- package/dist/primitives/select/ExpandableSearchInput.d.ts +1 -1
- package/dist/primitives/select/ExpandableSearchInput.d.ts.map +1 -1
- package/dist/primitives/select/SearchInput.d.ts +2 -2
- package/dist/primitives/select/SearchInput.d.ts.map +1 -1
- package/dist/primitives/select/SearchInput.js +38 -37
- package/dist/primitives/select/combobox.d.ts.map +1 -1
- package/dist/primitives/select/combobox.js +48 -47
- package/dist/primitives/select/multi-select.d.ts.map +1 -1
- package/dist/primitives/select/multi-select.js +50 -49
- package/dist/styles/components.css +1 -1
- package/dist/utils/keyboard-shortcut.d.ts +4 -0
- package/dist/utils/keyboard-shortcut.d.ts.map +1 -0
- package/dist/utils/keyboard-shortcut.js +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { useRef as y, useState as X, useCallback as f, useEffect as A, useMemo as M, createElement as q, createContext as D, useContext as J } from "react";
|
|
2
|
+
import { captureTableUndoSnapshot as Q, applyTableUndoSnapshot as O } from "./tableUndoRedo.js";
|
|
3
|
+
import { wrapColumnHeaderActionWithUndoRedo as I, wrapEditChromeWithUndoRedo as rr, wrapRowActionsWithUndoRedo as er, wrapSummaryFooterWithUndoRedo as tr, wrapToolbarWithUndoRedo as nr } from "./tableUndoRedo.js";
|
|
4
|
+
const j = D(null);
|
|
5
|
+
function V(t) {
|
|
6
|
+
if (!(t instanceof HTMLElement)) return !1;
|
|
7
|
+
const n = t.tagName;
|
|
8
|
+
return !!(n === "INPUT" || n === "TEXTAREA" || n === "SELECT" || t.isContentEditable);
|
|
9
|
+
}
|
|
10
|
+
function Y() {
|
|
11
|
+
return J(j);
|
|
12
|
+
}
|
|
13
|
+
function $({
|
|
14
|
+
children: t,
|
|
15
|
+
shortcuts: n = !0,
|
|
16
|
+
isDisabled: C = !1
|
|
17
|
+
}) {
|
|
18
|
+
const a = y(/* @__PURE__ */ new Map()), c = y([]), s = y([]), [S, E] = X(0), u = f(() => {
|
|
19
|
+
E((e) => e + 1);
|
|
20
|
+
}, []), U = f(
|
|
21
|
+
(e) => {
|
|
22
|
+
a.current.delete(e), c.current = c.current.filter((r) => r !== e), s.current = s.current.filter((r) => r !== e), u();
|
|
23
|
+
},
|
|
24
|
+
[u]
|
|
25
|
+
), i = f(
|
|
26
|
+
(e) => (a.current.set(e.tableId, e), u(), () => U(e.tableId)),
|
|
27
|
+
[u, U]
|
|
28
|
+
), l = f(
|
|
29
|
+
(e) => {
|
|
30
|
+
c.current = [...c.current, e], s.current = [], u();
|
|
31
|
+
},
|
|
32
|
+
[u]
|
|
33
|
+
), d = f(() => {
|
|
34
|
+
for (; c.current.length > 0; ) {
|
|
35
|
+
const e = c.current[c.current.length - 1];
|
|
36
|
+
c.current = c.current.slice(0, -1);
|
|
37
|
+
const r = a.current.get(e);
|
|
38
|
+
if (r != null && r.canUndo) {
|
|
39
|
+
r.undo(), s.current = [...s.current, e], u();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
u();
|
|
44
|
+
}, [u]), T = f(() => {
|
|
45
|
+
for (; s.current.length > 0; ) {
|
|
46
|
+
const e = s.current[s.current.length - 1];
|
|
47
|
+
s.current = s.current.slice(0, -1);
|
|
48
|
+
const r = a.current.get(e);
|
|
49
|
+
if (r != null && r.canRedo) {
|
|
50
|
+
r.redo(), c.current = [...c.current, e], u();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
u();
|
|
55
|
+
}, [u]), R = c.current.some((e) => {
|
|
56
|
+
var r;
|
|
57
|
+
return (r = a.current.get(e)) == null ? void 0 : r.canUndo;
|
|
58
|
+
}), w = s.current.some((e) => {
|
|
59
|
+
var r;
|
|
60
|
+
return (r = a.current.get(e)) == null ? void 0 : r.canRedo;
|
|
61
|
+
});
|
|
62
|
+
A(() => {
|
|
63
|
+
if (!n || C) return;
|
|
64
|
+
const e = (r) => {
|
|
65
|
+
if (V(r.target) || !(r.metaKey || r.ctrlKey) || r.altKey) return;
|
|
66
|
+
const g = r.key.toLowerCase(), m = g === "z" && !r.shiftKey, h = g === "z" && r.shiftKey || g === "y";
|
|
67
|
+
m && R ? (r.preventDefault(), r.stopPropagation(), d()) : h && w && (r.preventDefault(), r.stopPropagation(), T());
|
|
68
|
+
};
|
|
69
|
+
return window.addEventListener("keydown", e, { capture: !0 }), () => window.removeEventListener("keydown", e, { capture: !0 });
|
|
70
|
+
}, [n, C, R, w, d, T]);
|
|
71
|
+
const o = M(
|
|
72
|
+
() => ({
|
|
73
|
+
canUndo: R,
|
|
74
|
+
canRedo: w,
|
|
75
|
+
undo: d,
|
|
76
|
+
redo: T,
|
|
77
|
+
recordCommit: l,
|
|
78
|
+
registerTable: i,
|
|
79
|
+
unregisterTable: U
|
|
80
|
+
}),
|
|
81
|
+
[R, w, d, T, l, i, U, S]
|
|
82
|
+
);
|
|
83
|
+
return q(j.Provider, { value: o }, t);
|
|
84
|
+
}
|
|
85
|
+
function F({
|
|
86
|
+
enabled: t = !1,
|
|
87
|
+
tableId: n,
|
|
88
|
+
sharedUndoGroup: C,
|
|
89
|
+
toolbar: a,
|
|
90
|
+
columnAlignments: c,
|
|
91
|
+
summaryFooterProps: s,
|
|
92
|
+
appliedFilterConditions: S,
|
|
93
|
+
data: E,
|
|
94
|
+
getData: u,
|
|
95
|
+
onDataRestore: U
|
|
96
|
+
}) {
|
|
97
|
+
const i = y([]), l = y([]), d = y(!1), [T, R] = X(0), w = Y(), o = C === void 0 ? w : C, e = !!(t && n && o), r = o == null ? void 0 : o.recordCommit, x = o == null ? void 0 : o.registerTable, g = o == null ? void 0 : o.unregisterTable, m = M(
|
|
98
|
+
() => ({
|
|
99
|
+
toolbar: a,
|
|
100
|
+
columnAlignments: c,
|
|
101
|
+
summaryFooterProps: s,
|
|
102
|
+
appliedFilterConditions: S,
|
|
103
|
+
data: E,
|
|
104
|
+
getData: u,
|
|
105
|
+
onDataRestore: U
|
|
106
|
+
}),
|
|
107
|
+
[a, c, s, S, E, u, U]
|
|
108
|
+
), h = f(() => Q(m), [m]), P = f(() => {
|
|
109
|
+
!t || d.current || (i.current = [...i.current.slice(-49), h()], l.current = [], n && r && r(n), R((p) => p + 1));
|
|
110
|
+
}, [t, h, r, n]), v = f(() => {
|
|
111
|
+
if (!(!t || i.current.length === 0)) {
|
|
112
|
+
d.current = !0;
|
|
113
|
+
try {
|
|
114
|
+
const p = h(), W = i.current.pop();
|
|
115
|
+
l.current = [p, ...l.current], O(W, m);
|
|
116
|
+
} finally {
|
|
117
|
+
d.current = !1, R((p) => p + 1);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, [t, h, m]), K = f(() => {
|
|
121
|
+
if (!(!t || l.current.length === 0)) {
|
|
122
|
+
d.current = !0;
|
|
123
|
+
try {
|
|
124
|
+
const p = h(), W = l.current.shift();
|
|
125
|
+
i.current = [...i.current, p], O(W, m);
|
|
126
|
+
} finally {
|
|
127
|
+
d.current = !1, R((p) => p + 1);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}, [t, h, m]), k = t && i.current.length > 0, L = t && l.current.length > 0;
|
|
131
|
+
A(() => {
|
|
132
|
+
!t || !n || !x || x({
|
|
133
|
+
tableId: n,
|
|
134
|
+
canUndo: k,
|
|
135
|
+
canRedo: L,
|
|
136
|
+
undo: v,
|
|
137
|
+
redo: K
|
|
138
|
+
});
|
|
139
|
+
}, [t, n, x, k, L, v, K]), A(() => {
|
|
140
|
+
if (!(!n || !g))
|
|
141
|
+
return () => g(n);
|
|
142
|
+
}, [n, g]);
|
|
143
|
+
const z = e ? o.canUndo : k, B = e ? o.canRedo : L, H = e ? o.undo : v, N = e ? o.redo : K;
|
|
144
|
+
return M(
|
|
145
|
+
() => ({
|
|
146
|
+
canUndo: z,
|
|
147
|
+
canRedo: B,
|
|
148
|
+
undo: H,
|
|
149
|
+
redo: N,
|
|
150
|
+
commitBeforeMutation: P,
|
|
151
|
+
shortcut: e ? !1 : void 0
|
|
152
|
+
}),
|
|
153
|
+
// revision drives canUndo/canRedo updates after history mutations
|
|
154
|
+
[z, B, H, N, P, e, T]
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
$ as TableUndoRedoProvider,
|
|
159
|
+
O as applyTableUndoSnapshot,
|
|
160
|
+
Q as captureTableUndoSnapshot,
|
|
161
|
+
F as useTableUndoRedo,
|
|
162
|
+
Y as useTableUndoRedoScope,
|
|
163
|
+
I as wrapColumnHeaderActionWithUndoRedo,
|
|
164
|
+
rr as wrapEditChromeWithUndoRedo,
|
|
165
|
+
er as wrapRowActionsWithUndoRedo,
|
|
166
|
+
tr as wrapSummaryFooterWithUndoRedo,
|
|
167
|
+
nr as wrapToolbarWithUndoRedo
|
|
168
|
+
};
|
|
@@ -15,27 +15,27 @@ const y = {
|
|
|
15
15
|
addonButton: "hover:bg-utility-gray-100 text-utility-gray-400 hover:text-utility-gray-500"
|
|
16
16
|
},
|
|
17
17
|
brand: {
|
|
18
|
-
root: "bg-utility-brand-50 text-utility-brand-
|
|
18
|
+
root: "bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-50",
|
|
19
19
|
addon: "text-utility-brand-500",
|
|
20
20
|
addonButton: "hover:bg-utility-brand-100 text-utility-brand-400 hover:text-utility-brand-500"
|
|
21
21
|
},
|
|
22
22
|
error: {
|
|
23
|
-
root: "bg-utility-error-
|
|
23
|
+
root: "bg-utility-error-50 text-utility-error-700 ring-utility-error-50",
|
|
24
24
|
addon: "text-utility-error-500",
|
|
25
25
|
addonButton: "hover:bg-utility-error-100 text-utility-error-400 hover:text-utility-error-500"
|
|
26
26
|
},
|
|
27
27
|
warning: {
|
|
28
|
-
root: "bg-utility-warning-
|
|
28
|
+
root: "bg-utility-warning-50 text-utility-warning-700 ring-utility-warning-50",
|
|
29
29
|
addon: "text-utility-warning-500",
|
|
30
30
|
addonButton: "hover:bg-utility-warning-100 text-utility-warning-400 hover:text-utility-warning-500"
|
|
31
31
|
},
|
|
32
32
|
success: {
|
|
33
|
-
root: "bg-utility-success-
|
|
33
|
+
root: "bg-utility-success-50 text-utility-success-700 ring-utility-success-50",
|
|
34
34
|
addon: "text-utility-success-500",
|
|
35
35
|
addonButton: "hover:bg-utility-success-100 text-utility-success-400 hover:text-utility-success-500"
|
|
36
36
|
},
|
|
37
37
|
"gray-blue": {
|
|
38
|
-
root: "bg-utility-gray-blue-100 text-utility-gray-blue-
|
|
38
|
+
root: "bg-utility-gray-blue-100 text-utility-gray-blue-500 ring-utility-gray-blue-100",
|
|
39
39
|
addon: "text-utility-gray-blue-500",
|
|
40
40
|
addonButton: "hover:bg-utility-gray-blue-100 text-utility-gray-blue-400 hover:text-utility-gray-blue-500"
|
|
41
41
|
},
|
|
@@ -20,7 +20,7 @@ export interface InputBaseProps extends TextFieldProps {
|
|
|
20
20
|
wrapperClassName?: string;
|
|
21
21
|
/** Class name for the tooltip. */
|
|
22
22
|
tooltipClassName?: string;
|
|
23
|
-
/** Keyboard shortcut to display. */
|
|
23
|
+
/** Keyboard shortcut to display. When `true`, shows the platform-specific primary shortcut hint (⌘K on Apple platforms, Ctrl+K elsewhere). */
|
|
24
24
|
shortcut?: string | boolean;
|
|
25
25
|
ref?: Ref<HTMLInputElement>;
|
|
26
26
|
groupRef?: Ref<HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/primitives/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,IAAI,kBAAkB,EACrC,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,E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TextField as Z, Group as A, Input as W } from "react-aria-components";
|
|
3
3
|
import { cx as i, sortCx as D } from "../../utils/cn.js";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as O, createContext as ee, useContext as re, useEffect as ae } from "react";
|
|
5
5
|
import { HintText as V } from "./hint-text.js";
|
|
6
|
-
import { EyeOff as te, Eye as ie, XClose as
|
|
6
|
+
import { EyeOff as te, Eye as ie, XClose as le, HelpCircle as se, InfoCircle as ne } from "@untitledui/icons";
|
|
7
7
|
import { Label as oe } from "./label.js";
|
|
8
8
|
import { Tooltip as de, TooltipTrigger as pe } from "../tooltip/tooltip.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getPlatformShortcutLabel as ue } from "../../utils/keyboard-shortcut.js";
|
|
10
|
+
import { Badge as ge } from "../badge/badge.js";
|
|
10
11
|
const G = {
|
|
11
12
|
sm: "text-xs",
|
|
12
13
|
md: "text-sm",
|
|
13
14
|
lg: "text-md"
|
|
14
|
-
},
|
|
15
|
+
}, me = {
|
|
15
16
|
sm: "text-xs",
|
|
16
17
|
md: "text-xs",
|
|
17
18
|
lg: "text-sm"
|
|
18
19
|
}, I = ({
|
|
19
20
|
ref: d,
|
|
20
21
|
isReadOnly: c,
|
|
21
|
-
tooltip:
|
|
22
|
+
tooltip: h,
|
|
22
23
|
shortcut: N,
|
|
23
24
|
groupRef: C,
|
|
24
25
|
size: _ = "sm",
|
|
25
|
-
isInvalid:
|
|
26
|
+
isInvalid: y,
|
|
26
27
|
isDisabled: o,
|
|
27
28
|
icon: b,
|
|
28
29
|
iconTrailing: v,
|
|
29
30
|
placeholder: B,
|
|
30
|
-
wrapperClassName:
|
|
31
|
+
wrapperClassName: R,
|
|
31
32
|
tooltipClassName: j,
|
|
32
33
|
inputClassName: k,
|
|
33
34
|
iconClassName: L,
|
|
@@ -39,7 +40,7 @@ const G = {
|
|
|
39
40
|
customStyles: E,
|
|
40
41
|
...F
|
|
41
42
|
}) => {
|
|
42
|
-
const z =
|
|
43
|
+
const z = h || y || v || T, q = b, [f, p] = O([]), [x, w] = O(""), e = re(X), l = (e == null ? void 0 : e.size) || _, s = D({
|
|
43
44
|
sm: {
|
|
44
45
|
root: i(
|
|
45
46
|
"p-2 h-8",
|
|
@@ -85,15 +86,15 @@ const G = {
|
|
|
85
86
|
tag: "rounded-md bg-primary border border-secondary p-2.5",
|
|
86
87
|
wrapper: "rounded-lg"
|
|
87
88
|
}
|
|
88
|
-
}),
|
|
89
|
+
}), P = () => {
|
|
89
90
|
var t;
|
|
90
91
|
const a = x.trim();
|
|
91
92
|
a && ((t = e == null ? void 0 : e.onChange) == null || t.call(
|
|
92
93
|
e,
|
|
93
94
|
e != null && e.value ? (e == null ? void 0 : e.value) + "," + a : a
|
|
94
|
-
), p((
|
|
95
|
+
), p((n) => [...n, a]), w(""));
|
|
95
96
|
}, M = (a) => {
|
|
96
|
-
var t,
|
|
97
|
+
var t, n, $;
|
|
97
98
|
if (m === "tag") {
|
|
98
99
|
if (a.key === "Enter" || a.key === ",") {
|
|
99
100
|
a.preventDefault();
|
|
@@ -101,22 +102,22 @@ const G = {
|
|
|
101
102
|
u && ((t = e == null ? void 0 : e.onChange) == null || t.call(
|
|
102
103
|
e,
|
|
103
104
|
e != null && e.value ? (e == null ? void 0 : e.value) + "," + u : u
|
|
104
|
-
), p((
|
|
105
|
+
), p((K) => [...K, u]), w(""));
|
|
105
106
|
}
|
|
106
107
|
if (a.key === "Backspace" && !x)
|
|
107
108
|
if (e != null && e.value) {
|
|
108
|
-
const u = e.value.split(",").map((
|
|
109
|
-
u.pop(), (
|
|
109
|
+
const u = e.value.split(",").map((K) => K.trim()).filter(Boolean);
|
|
110
|
+
u.pop(), (n = e.onChange) == null || n.call(e, u.join(", "));
|
|
110
111
|
} else
|
|
111
|
-
(
|
|
112
|
+
($ = e == null ? void 0 : e.onChange) == null || $.call(e, "");
|
|
112
113
|
}
|
|
113
114
|
}, Q = (a) => {
|
|
114
115
|
const t = a.target.value;
|
|
115
116
|
m === "tag" && w(t);
|
|
116
117
|
}, U = (a) => {
|
|
117
|
-
var
|
|
118
|
-
const t = f.filter((
|
|
119
|
-
p(t), (
|
|
118
|
+
var n;
|
|
119
|
+
const t = f.filter(($, u) => u !== a);
|
|
120
|
+
p(t), (n = e == null ? void 0 : e.onChange) == null || n.call(e, t.join(", "));
|
|
120
121
|
};
|
|
121
122
|
return ae(() => {
|
|
122
123
|
if (m === "tag")
|
|
@@ -125,27 +126,27 @@ const G = {
|
|
|
125
126
|
p(a);
|
|
126
127
|
} else
|
|
127
128
|
p([]);
|
|
128
|
-
}, [e == null ? void 0 : e.value]), /* @__PURE__ */
|
|
129
|
+
}, [e == null ? void 0 : e.value]), /* @__PURE__ */ S(
|
|
129
130
|
A,
|
|
130
131
|
{
|
|
131
132
|
isDisabled: o,
|
|
132
|
-
isInvalid:
|
|
133
|
+
isInvalid: y,
|
|
133
134
|
ref: C,
|
|
134
|
-
className: ({ isFocusWithin: a, isDisabled: t, isInvalid:
|
|
135
|
+
className: ({ isFocusWithin: a, isDisabled: t, isInvalid: n }) => i(
|
|
135
136
|
"relative flex w-full flex-row place-content-center place-items-center bg-primary border border-secondary duration-100 ease-linear",
|
|
136
137
|
a && !t && !c && "ring-1 ring-brand",
|
|
137
138
|
// Disabled state styles
|
|
138
139
|
t && "cursor-not-allowed bg-disabled_subtle ring-disabled",
|
|
139
140
|
"group-disabled:cursor-not-allowed group-disabled:bg-disabled_subtle group-disabled:ring-disabled",
|
|
140
141
|
// Invalid state styles
|
|
141
|
-
|
|
142
|
+
n && "ring-error_subtle",
|
|
142
143
|
"group-invalid:ring-error_subtle",
|
|
143
144
|
// Invalid state with focus-within styles
|
|
144
|
-
|
|
145
|
+
n && a && "ring-2 ring-error",
|
|
145
146
|
a && "group-invalid:ring-2 group-invalid:ring-error",
|
|
146
147
|
e == null ? void 0 : e.wrapperClassName,
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
R,
|
|
149
|
+
s[l].wrapper
|
|
149
150
|
),
|
|
150
151
|
children: [
|
|
151
152
|
b && /* @__PURE__ */ r(
|
|
@@ -154,13 +155,13 @@ const G = {
|
|
|
154
155
|
className: i(
|
|
155
156
|
"pointer-events-none absolute size-5 text-fg-quaternary",
|
|
156
157
|
o && "text-fg-disabled",
|
|
157
|
-
|
|
158
|
+
s[l].iconLeading,
|
|
158
159
|
e == null ? void 0 : e.iconClassName,
|
|
159
160
|
L
|
|
160
161
|
)
|
|
161
162
|
}
|
|
162
163
|
),
|
|
163
|
-
m === "tag" && /* @__PURE__ */
|
|
164
|
+
m === "tag" && /* @__PURE__ */ S(
|
|
164
165
|
"div",
|
|
165
166
|
{
|
|
166
167
|
className: i(
|
|
@@ -170,10 +171,10 @@ const G = {
|
|
|
170
171
|
children: [
|
|
171
172
|
f.map((a, t) => (
|
|
172
173
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
173
|
-
/* @__PURE__ */ r("div", { onClick: (
|
|
174
|
+
/* @__PURE__ */ r("div", { onClick: (n) => n.stopPropagation(), children: /* @__PURE__ */ S(ge, { className: "rounded-md bg-primary border border-secondary px-2 py-1 pointer-events-auto!", children: [
|
|
174
175
|
a,
|
|
175
176
|
/* @__PURE__ */ r(
|
|
176
|
-
|
|
177
|
+
le,
|
|
177
178
|
{
|
|
178
179
|
className: "size-4 cursor-pointer text-fg-quaternary hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover",
|
|
179
180
|
onClick: () => U(t)
|
|
@@ -190,12 +191,12 @@ const G = {
|
|
|
190
191
|
onKeyDown: M,
|
|
191
192
|
placeholder: f.length === 0 ? B : "",
|
|
192
193
|
disabled: o,
|
|
193
|
-
onBlur:
|
|
194
|
+
onBlur: P,
|
|
194
195
|
className: i(
|
|
195
196
|
"bg-transparent outline-none flex-1 min-w-[50px] w-full text-primary placeholder:text-placeholder_subtle",
|
|
196
197
|
o && "cursor-not-allowed text-disabled",
|
|
197
|
-
|
|
198
|
-
G[
|
|
198
|
+
s[l].root,
|
|
199
|
+
G[l],
|
|
199
200
|
k
|
|
200
201
|
)
|
|
201
202
|
}
|
|
@@ -212,8 +213,8 @@ const G = {
|
|
|
212
213
|
className: i(
|
|
213
214
|
"m-0 w-full bg-transparent text-primary ring-0 outline-hidden placeholder:text-placeholder_subtle autofill:rounded-lg autofill:text-primary",
|
|
214
215
|
o && "cursor-not-allowed text-disabled",
|
|
215
|
-
|
|
216
|
-
G[
|
|
216
|
+
s[l].root,
|
|
217
|
+
G[l],
|
|
217
218
|
e == null ? void 0 : e.inputClassName,
|
|
218
219
|
k
|
|
219
220
|
),
|
|
@@ -225,30 +226,30 @@ const G = {
|
|
|
225
226
|
{
|
|
226
227
|
className: i(
|
|
227
228
|
"absolute flex items-center justify-center",
|
|
228
|
-
|
|
229
|
-
|
|
229
|
+
s[l].iconTrailing,
|
|
230
|
+
s[l].trailingIconCount
|
|
230
231
|
),
|
|
231
232
|
children: T
|
|
232
233
|
}
|
|
233
234
|
),
|
|
234
|
-
|
|
235
|
+
h && !y && /* @__PURE__ */ r(de, { title: h, placement: "top", children: /* @__PURE__ */ r(
|
|
235
236
|
pe,
|
|
236
237
|
{
|
|
237
238
|
className: i(
|
|
238
239
|
"absolute cursor-pointer text-fg-quaternary transition duration-200 hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover",
|
|
239
|
-
|
|
240
|
+
s[l].iconTrailing,
|
|
240
241
|
e == null ? void 0 : e.tooltipClassName,
|
|
241
242
|
j
|
|
242
243
|
),
|
|
243
|
-
children: /* @__PURE__ */ r(
|
|
244
|
+
children: /* @__PURE__ */ r(se, { className: "size-4" })
|
|
244
245
|
}
|
|
245
246
|
) }),
|
|
246
|
-
|
|
247
|
-
|
|
247
|
+
y && /* @__PURE__ */ r(
|
|
248
|
+
ne,
|
|
248
249
|
{
|
|
249
250
|
className: i(
|
|
250
251
|
"pointer-events-none absolute size-4 text-fg-error-secondary",
|
|
251
|
-
|
|
252
|
+
s[l].iconTrailing,
|
|
252
253
|
e == null ? void 0 : e.tooltipClassName,
|
|
253
254
|
j
|
|
254
255
|
)
|
|
@@ -259,7 +260,7 @@ const G = {
|
|
|
259
260
|
{
|
|
260
261
|
className: i(
|
|
261
262
|
"pointer-events-none absolute inset-y-0.5 right-0.5 z-10 flex items-center rounded-r-[inherit] bg-linear-to-r from-transparent pl-8",
|
|
262
|
-
|
|
263
|
+
s[l].shortcut
|
|
263
264
|
),
|
|
264
265
|
children: /* @__PURE__ */ r(
|
|
265
266
|
"span",
|
|
@@ -269,7 +270,7 @@ const G = {
|
|
|
269
270
|
o && "bg-transparent text-disabled"
|
|
270
271
|
),
|
|
271
272
|
"aria-hidden": "true",
|
|
272
|
-
children: typeof N == "string" ? N : "
|
|
273
|
+
children: typeof N == "string" ? N : ue(["meta"], "K")
|
|
273
274
|
}
|
|
274
275
|
)
|
|
275
276
|
}
|
|
@@ -280,7 +281,7 @@ const G = {
|
|
|
280
281
|
className: i(
|
|
281
282
|
"pointer-events-none absolute size-5 text-fg-quaternary",
|
|
282
283
|
o && "text-fg-disabled",
|
|
283
|
-
|
|
284
|
+
s[l].iconTrailing,
|
|
284
285
|
e == null ? void 0 : e.iconClassName,
|
|
285
286
|
L
|
|
286
287
|
)
|
|
@@ -296,26 +297,26 @@ const X = ee({}), J = ({ className: d, ...c }) => /* @__PURE__ */ r(X.Provider,
|
|
|
296
297
|
{
|
|
297
298
|
...c,
|
|
298
299
|
"data-input-wrapper": !0,
|
|
299
|
-
className: (
|
|
300
|
+
className: (h) => i(
|
|
300
301
|
"group flex h-max w-full flex-col items-start justify-start gap-1.5",
|
|
301
|
-
typeof d == "function" ? d(
|
|
302
|
+
typeof d == "function" ? d(h) : d
|
|
302
303
|
)
|
|
303
304
|
}
|
|
304
305
|
) });
|
|
305
306
|
J.displayName = "TextField";
|
|
306
|
-
const
|
|
307
|
+
const fe = ({
|
|
307
308
|
size: d = "sm",
|
|
308
309
|
placeholder: c,
|
|
309
|
-
icon:
|
|
310
|
+
icon: h,
|
|
310
311
|
iconTrailing: N,
|
|
311
312
|
label: C,
|
|
312
313
|
supportingText: _,
|
|
313
|
-
hint:
|
|
314
|
+
hint: y,
|
|
314
315
|
shortcut: o,
|
|
315
316
|
hideRequiredIndicator: b,
|
|
316
317
|
className: v,
|
|
317
318
|
ref: B,
|
|
318
|
-
groupRef:
|
|
319
|
+
groupRef: R,
|
|
319
320
|
tooltip: j,
|
|
320
321
|
iconClassName: k,
|
|
321
322
|
inputClassName: L,
|
|
@@ -329,7 +330,7 @@ const me = ({
|
|
|
329
330
|
mode: q,
|
|
330
331
|
...f
|
|
331
332
|
}) => {
|
|
332
|
-
const [p, x] =
|
|
333
|
+
const [p, x] = O(!1), w = m === "password", e = w ? p ? "text" : "password" : m, l = f == null ? void 0 : f.isReadOnly;
|
|
333
334
|
return /* @__PURE__ */ r(
|
|
334
335
|
J,
|
|
335
336
|
{
|
|
@@ -337,12 +338,12 @@ const me = ({
|
|
|
337
338
|
"aria-label": C ? void 0 : c,
|
|
338
339
|
...f,
|
|
339
340
|
className: v,
|
|
340
|
-
children: ({ isRequired:
|
|
341
|
+
children: ({ isRequired: s, isInvalid: P }) => /* @__PURE__ */ S(Y, { children: [
|
|
341
342
|
C && /* @__PURE__ */ r(
|
|
342
343
|
oe,
|
|
343
344
|
{
|
|
344
|
-
className: i("color-text-label",
|
|
345
|
-
isRequired: b ? !b :
|
|
345
|
+
className: i("color-text-label", me[d]),
|
|
346
|
+
isRequired: b ? !b : s,
|
|
346
347
|
children: C
|
|
347
348
|
}
|
|
348
349
|
),
|
|
@@ -351,11 +352,11 @@ const me = ({
|
|
|
351
352
|
I,
|
|
352
353
|
{
|
|
353
354
|
ref: B,
|
|
354
|
-
groupRef:
|
|
355
|
+
groupRef: R,
|
|
355
356
|
size: d,
|
|
356
357
|
placeholder: c,
|
|
357
|
-
isReadOnly:
|
|
358
|
-
icon:
|
|
358
|
+
isReadOnly: l,
|
|
359
|
+
icon: h,
|
|
359
360
|
iconTrailing: N,
|
|
360
361
|
shortcut: o,
|
|
361
362
|
iconClassName: k,
|
|
@@ -378,14 +379,14 @@ const me = ({
|
|
|
378
379
|
trailingIconCount: z
|
|
379
380
|
}
|
|
380
381
|
),
|
|
381
|
-
|
|
382
|
+
y && /* @__PURE__ */ r(V, { size: d, isInvalid: P, children: y })
|
|
382
383
|
] })
|
|
383
384
|
}
|
|
384
385
|
);
|
|
385
386
|
};
|
|
386
|
-
|
|
387
|
+
fe.displayName = "Input";
|
|
387
388
|
export {
|
|
388
|
-
|
|
389
|
+
fe as Input,
|
|
389
390
|
I as InputBase,
|
|
390
391
|
J as TextField
|
|
391
392
|
};
|
|
@@ -12,7 +12,7 @@ export interface ExpandableSearchInputProps {
|
|
|
12
12
|
"aria-label"?: string;
|
|
13
13
|
/** When false, the search field stays expanded. Default true. */
|
|
14
14
|
collapsible?: boolean;
|
|
15
|
-
/** When true, registers
|
|
15
|
+
/** When true, registers the platform-specific primary shortcut to expand and focus the search input. */
|
|
16
16
|
shortcut?: boolean;
|
|
17
17
|
/** When true, the control is greyed out and can't be expanded or typed in. */
|
|
18
18
|
isDisabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandableSearchInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/ExpandableSearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,
|
|
1
|
+
{"version":3,"file":"ExpandableSearchInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/ExpandableSearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wGAAwG;IACxG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAKD,eAAO,MAAM,qBAAqB,GAAI,2JAcnC,0BAA0B,4CAqJ5B,CAAC"}
|
|
@@ -13,9 +13,9 @@ interface SearchInputProps {
|
|
|
13
13
|
isDisabled?: boolean;
|
|
14
14
|
isRequired?: boolean;
|
|
15
15
|
isInvalid?: boolean;
|
|
16
|
-
/** When true, shows
|
|
16
|
+
/** When true, shows the platform-specific primary keyboard shortcut hint (⌘K on Apple platforms, Ctrl+K elsewhere). */
|
|
17
17
|
shortcut?: boolean;
|
|
18
|
-
/** When true, registers
|
|
18
|
+
/** When true, registers the platform-specific primary shortcut to focus the input. Defaults to `shortcut`. */
|
|
19
19
|
registerShortcut?: boolean;
|
|
20
20
|
shortcutClassName?: string;
|
|
21
21
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/SearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/SearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AAYf,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uHAAuH;IACvH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8GAA8G;IAC9G,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3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