@stackone/malachite 2.86.0 → 2.88.0
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/COMPONENTS.md +5 -4
- package/dist/components/Accordion.js +206 -179
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/Button.js +118 -81
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.js +128 -75
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Chat/ChatModelPicker.js +70 -67
- package/dist/components/Chat/ChatModelPicker.js.map +1 -1
- package/dist/components/FilterSearch.js +237 -232
- package/dist/components/FilterSearch.js.map +1 -1
- package/dist/components/FrameHeader.js +36 -0
- package/dist/components/FrameHeader.js.map +1 -0
- package/dist/components/LoadingBar.js +5 -5
- package/dist/components/LoadingBar.js.map +1 -1
- package/dist/components/MultiSelect.js +438 -388
- package/dist/components/MultiSelect.js.map +1 -1
- package/dist/components/PinnedCornerCap.js +32 -19
- package/dist/components/PinnedCornerCap.js.map +1 -1
- package/dist/components/QueryInput.js +95 -92
- package/dist/components/QueryInput.js.map +1 -1
- package/dist/components/SplitButton.js +62 -61
- package/dist/components/SplitButton.js.map +1 -1
- package/dist/components/Surface.js +98 -94
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/Table/Table.js +630 -606
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/TimeBarChart/TimeBarChart.js +241 -0
- package/dist/components/TimeBarChart/TimeBarChart.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartAxes.js +49 -0
- package/dist/components/TimeBarChart/TimeBarChartAxes.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartBars.js +58 -0
- package/dist/components/TimeBarChart/TimeBarChartBars.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartLegend.js +29 -0
- package/dist/components/TimeBarChart/TimeBarChartLegend.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartTable.js +33 -0
- package/dist/components/TimeBarChart/TimeBarChartTable.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartTooltip.js +77 -0
- package/dist/components/TimeBarChart/TimeBarChartTooltip.js.map +1 -0
- package/dist/components/TimeBarChart/stackLayout.js +25 -0
- package/dist/components/TimeBarChart/stackLayout.js.map +1 -0
- package/dist/components/TimeBarChart/timeBuckets.js +133 -0
- package/dist/components/TimeBarChart/timeBuckets.js.map +1 -0
- package/dist/components/TimeBarChart/tones.js +10 -0
- package/dist/components/TimeBarChart/tones.js.map +1 -0
- package/dist/components/Tooltip.js +93 -90
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/activeElement.js +5 -1
- package/dist/components/activeElement.js.map +1 -1
- package/dist/components/dateMath.js +1 -0
- package/dist/components/dateMath.js.map +1 -1
- package/dist/components/filterSearchModel.js +53 -45
- package/dist/components/filterSearchModel.js.map +1 -1
- package/dist/components/frameStyles.js +14 -0
- package/dist/components/frameStyles.js.map +1 -0
- package/dist/components/headerContent.js +10 -0
- package/dist/components/headerContent.js.map +1 -0
- package/dist/components/useFollowTrigger.js +28 -0
- package/dist/components/useFollowTrigger.js.map +1 -0
- package/dist/index.d.ts +131 -9
- package/dist/index.js +24 -22
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/dist/theme.js +340 -340
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import { jsxs as f, Fragment as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { CONTROL_TEXT_SIZE_CLASS as
|
|
10
|
-
import { controlWidthStyle as
|
|
11
|
-
import { getTriggerVisual as
|
|
12
|
-
import { pushEscapeLayer as
|
|
13
|
-
import { orderSelections as
|
|
14
|
-
import { ensureFilterSearchStyles as
|
|
15
|
-
import { measureMenuGeometry as
|
|
16
|
-
import { FOCUS_RING as
|
|
17
|
-
import { usePopupLayer as
|
|
18
|
-
import { useTopLayer as
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { jsxs as f, Fragment as V, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useId as Xe, useState as O, useRef as R, useMemo as H, useEffect as q, useCallback as B, useLayoutEffect as ke, useInsertionEffect as qe } from "react";
|
|
3
|
+
import { createPortal as Be } from "react-dom";
|
|
4
|
+
import Ve from "./CustomIcons/CaretDownIcon.js";
|
|
5
|
+
import Ze from "./CustomIcons/CheckmarkIcon.js";
|
|
6
|
+
import Se from "./CustomIcons/DismissIcon.js";
|
|
7
|
+
import Ke from "./CustomIcons/SearchIcon.js";
|
|
8
|
+
import Qe from "./Spinner.js";
|
|
9
|
+
import { CONTROL_TEXT_SIZE_CLASS as ee, CONTROL_TEXT_SIZE as Ye } from "./controlTextSize.js";
|
|
10
|
+
import { controlWidthStyle as Je } from "./controlWidth.js";
|
|
11
|
+
import { getTriggerVisual as et, DROPDOWN_TRIGGER_ATTR as tt } from "./dropdownTriggerStyle.js";
|
|
12
|
+
import { pushEscapeLayer as rt } from "./escapeLayers.js";
|
|
13
|
+
import { orderSelections as nt, resolveMode as it, openFilterOf as ot, filterRows as Re, searchRows as lt, chipText as at, removeFilter as st, clearAll as ct, selectAll as pt, deselectAll as dt, toggleValue as ut } from "./filterSearchModel.js";
|
|
14
|
+
import { ensureFilterSearchStyles as mt, FILTER_SEARCH_CLASS as D } from "./filterSearchStyles.js";
|
|
15
|
+
import { measureMenuGeometry as ft, MENU_MAX_HEIGHT_PX as ht, MENU_SPECS as P } from "./floatingMenuGeometry.js";
|
|
16
|
+
import { FOCUS_RING as te } from "./focusRing.js";
|
|
17
|
+
import { usePopupLayer as gt } from "./overlayLayers.js";
|
|
18
|
+
import { useTopLayer as xt } from "./topLayer.js";
|
|
19
|
+
import { useFollowTrigger as bt } from "./useFollowTrigger.js";
|
|
20
|
+
import { useLatestRef as vt } from "./useLatestRef.js";
|
|
21
|
+
const yt = {
|
|
22
|
+
small: `min-h-[var(--malachite-control-height-small,28px)] gap-1 px-2.5 py-[2px] ${ee.small} rounded-[var(--malachite-radius-10,10px)]`,
|
|
23
|
+
medium: `min-h-[var(--malachite-control-height-medium,32px)] gap-1 px-3 py-[3px] ${ee.medium} rounded-xl`,
|
|
24
|
+
large: `min-h-[var(--malachite-control-height-large,42px)] gap-1.5 px-4 py-[6px] ${ee.large} rounded-[var(--malachite-radius-xxl,14px)]`
|
|
25
|
+
}, wt = {
|
|
25
26
|
small: "gap-1",
|
|
26
27
|
medium: "gap-1",
|
|
27
28
|
large: "gap-1.5"
|
|
28
|
-
},
|
|
29
|
+
}, re = {
|
|
29
30
|
resting: "bg-[var(--malachite-tag-default-background,rgba(123,123,123,0.1))] text-[var(--malachite-text-primary,rgb(10,10,10))]",
|
|
30
31
|
active: "bg-[var(--malachite-accent-background,rgb(0,175,102))] text-[var(--malachite-card-background,rgb(255,255,255))]"
|
|
31
|
-
},
|
|
32
|
-
for (let
|
|
33
|
-
if (
|
|
32
|
+
}, kt = 5, ne = (i) => !!i && !(i.kind === "item" && i.row.item.disabled), St = (i, h) => {
|
|
33
|
+
for (let a = Math.max(h, 0); a < i.length; a++)
|
|
34
|
+
if (ne(i[a])) return a;
|
|
34
35
|
return -1;
|
|
35
|
-
},
|
|
36
|
+
}, Rt = {
|
|
36
37
|
display: "flex",
|
|
37
38
|
alignItems: "center",
|
|
38
39
|
gap: 8,
|
|
@@ -45,33 +46,33 @@ const gt = {
|
|
|
45
46
|
font: "inherit",
|
|
46
47
|
cursor: "pointer",
|
|
47
48
|
minWidth: 0
|
|
48
|
-
},
|
|
49
|
+
}, Ce = {
|
|
49
50
|
borderRadius: 6,
|
|
50
51
|
padding: "2px 6px",
|
|
51
52
|
flexShrink: 0,
|
|
52
53
|
whiteSpace: "nowrap"
|
|
53
|
-
},
|
|
54
|
+
}, Z = {
|
|
54
55
|
overflow: "hidden",
|
|
55
56
|
textOverflow: "ellipsis",
|
|
56
57
|
whiteSpace: "nowrap",
|
|
57
58
|
minWidth: 0
|
|
58
|
-
},
|
|
59
|
+
}, Ee = { ...Z, marginLeft: "auto", flexShrink: 1 }, Ne = (i) => i.preventDefault(), Ct = (i) => {
|
|
59
60
|
i.preventDefault(), i.stopPropagation();
|
|
60
|
-
},
|
|
61
|
+
}, Et = ({ row: i, showFilter: h }) => {
|
|
61
62
|
if (i.kind === "filter")
|
|
62
|
-
return /* @__PURE__ */ f(
|
|
63
|
-
/* @__PURE__ */ l("span", { className:
|
|
64
|
-
i.filter.info && /* @__PURE__ */ l("span", { style:
|
|
65
|
-
i.filter.example && /* @__PURE__ */ l("span", { className:
|
|
63
|
+
return /* @__PURE__ */ f(V, { children: [
|
|
64
|
+
/* @__PURE__ */ l("span", { className: D.pill, style: Ce, children: i.filter.label }),
|
|
65
|
+
i.filter.info && /* @__PURE__ */ l("span", { style: Z, children: i.filter.info }),
|
|
66
|
+
i.filter.example && /* @__PURE__ */ l("span", { className: D.hint, style: Ee, children: i.filter.example })
|
|
66
67
|
] });
|
|
67
68
|
if (i.kind === "toggle")
|
|
68
69
|
return /* @__PURE__ */ l("span", { style: { color: "var(--malachite-text-primary, rgb(10, 10, 10))" }, children: i.toggle === "select" ? "Select All" : "Deselect All" });
|
|
69
|
-
const { item:
|
|
70
|
-
return /* @__PURE__ */ f(
|
|
71
|
-
|
|
72
|
-
/* @__PURE__ */ l("span", { style:
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
const { item: a, filter: T, selected: L } = i.row;
|
|
71
|
+
return /* @__PURE__ */ f(V, { children: [
|
|
72
|
+
h && /* @__PURE__ */ l("span", { className: D.pill, style: Ce, children: T.label }),
|
|
73
|
+
/* @__PURE__ */ l("span", { style: Z, children: a.label }),
|
|
74
|
+
L ? /* @__PURE__ */ l(
|
|
75
|
+
Ze,
|
|
75
76
|
{
|
|
76
77
|
size: 16,
|
|
77
78
|
style: {
|
|
@@ -80,34 +81,35 @@ const gt = {
|
|
|
80
81
|
color: "var(--malachite-accent-background, rgb(0, 175, 102))"
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
|
-
) :
|
|
84
|
+
) : h && T.info && /* @__PURE__ */ l("span", { className: D.hint, style: Ee, children: T.info })
|
|
84
85
|
] });
|
|
85
|
-
},
|
|
86
|
+
}, Bt = ({
|
|
86
87
|
filters: i,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
searchFilters: h,
|
|
89
|
+
value: a,
|
|
90
|
+
onChange: T,
|
|
91
|
+
onClear: L,
|
|
92
|
+
onActiveFilterChange: Ie,
|
|
91
93
|
placeholder: K = "Search",
|
|
92
94
|
size: Q = "medium",
|
|
93
|
-
width:
|
|
94
|
-
loading:
|
|
95
|
+
width: De,
|
|
96
|
+
loading: d = !1,
|
|
95
97
|
disabled: u = !1,
|
|
96
|
-
clearable:
|
|
97
|
-
maxVisibleChips:
|
|
98
|
-
className:
|
|
98
|
+
clearable: Te = !1,
|
|
99
|
+
maxVisibleChips: Ae = 4,
|
|
100
|
+
className: $e = "",
|
|
99
101
|
style: Le,
|
|
100
|
-
id:
|
|
101
|
-
"aria-label":
|
|
102
|
-
"aria-labelledby":
|
|
102
|
+
id: Me,
|
|
103
|
+
"aria-label": ie,
|
|
104
|
+
"aria-labelledby": oe
|
|
103
105
|
}) => {
|
|
104
|
-
var
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const
|
|
106
|
+
var we;
|
|
107
|
+
const le = Xe(), ae = `${le}-listbox`, se = (e) => `${le}-option-${e}`, [s, Y] = O(!1), [x, y] = O(""), [c, _e] = O(null), [ce, m] = O(0), [p, pe] = O(null), C = R(null), M = R(null), w = R(null), z = R(null), de = R([]);
|
|
108
|
+
xt(w, s);
|
|
109
|
+
const Fe = gt("multiselect", s, w), ue = R(/* @__PURE__ */ new Map()), _ = H(() => {
|
|
108
110
|
var t;
|
|
109
|
-
const e = new Map(
|
|
110
|
-
for (const r of i) {
|
|
111
|
+
const e = new Map(ue.current);
|
|
112
|
+
for (const r of [...h ?? [], ...i]) {
|
|
111
113
|
const n = ((t = e.get(r.value)) == null ? void 0 : t.items) ?? /* @__PURE__ */ new Map();
|
|
112
114
|
e.set(r.value, {
|
|
113
115
|
label: r.label,
|
|
@@ -118,54 +120,57 @@ const gt = {
|
|
|
118
120
|
});
|
|
119
121
|
}
|
|
120
122
|
return e;
|
|
121
|
-
}, [i]);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}, [
|
|
125
|
-
const
|
|
126
|
-
() =>
|
|
127
|
-
[
|
|
123
|
+
}, [i, h]);
|
|
124
|
+
q(() => {
|
|
125
|
+
ue.current = _;
|
|
126
|
+
}, [_]);
|
|
127
|
+
const me = R([]), F = H(
|
|
128
|
+
() => nt(a, me.current, c),
|
|
129
|
+
[a, c]
|
|
128
130
|
);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}, [
|
|
132
|
-
const
|
|
131
|
+
q(() => {
|
|
132
|
+
me.current = F;
|
|
133
|
+
}, [F]);
|
|
134
|
+
const g = it(c, x), J = h ?? i, E = H(
|
|
135
|
+
() => ot(c, i, h, a),
|
|
136
|
+
[c, i, h, a]
|
|
137
|
+
), fe = R(c), W = vt(Ie), k = B(
|
|
133
138
|
(e) => {
|
|
134
139
|
var t;
|
|
135
|
-
|
|
140
|
+
fe.current !== e && (fe.current = e, _e(e), (t = W.current) == null || t.call(W, e));
|
|
136
141
|
},
|
|
137
|
-
[
|
|
138
|
-
), b =
|
|
139
|
-
if (
|
|
140
|
-
if (
|
|
141
|
-
const { toggle: e, items: t } =
|
|
142
|
+
[W]
|
|
143
|
+
), b = H(() => {
|
|
144
|
+
if (d) return [];
|
|
145
|
+
if (g === "filters") return i.map((r) => ({ kind: "filter", filter: r }));
|
|
146
|
+
const { toggle: e, items: t } = g === "items" ? Re(E, a, x) : lt(J, a, x);
|
|
142
147
|
return [
|
|
143
148
|
...e ? [{ kind: "toggle", toggle: e }] : [],
|
|
144
149
|
...t.map((r) => ({ kind: "item", row: r }))
|
|
145
150
|
];
|
|
146
|
-
}, [
|
|
147
|
-
const e = new Map(
|
|
148
|
-
const o =
|
|
151
|
+
}, [d, g, i, J, E, a, x]), G = H(() => {
|
|
152
|
+
const e = new Map(a.map((n) => [n.filter, n.items])), t = (n) => {
|
|
153
|
+
const o = _.get(n), v = e.get(n);
|
|
149
154
|
if (!v)
|
|
150
155
|
return n === c ? [{ filter: n, text: (o == null ? void 0 : o.label) ?? n }] : [];
|
|
151
|
-
if (!o &&
|
|
152
|
-
const
|
|
153
|
-
return [{ filter: n, text:
|
|
154
|
-
}, r = c !== null && !
|
|
155
|
-
return [...
|
|
156
|
-
}, [
|
|
156
|
+
if (!o && d) return [];
|
|
157
|
+
const I = v.map((S) => (o == null ? void 0 : o.items.get(S)) ?? S);
|
|
158
|
+
return [{ filter: n, text: at((o == null ? void 0 : o.label) ?? n, I) }];
|
|
159
|
+
}, r = c !== null && !F.includes(c);
|
|
160
|
+
return [...F, ...r ? [c] : []].flatMap(t);
|
|
161
|
+
}, [F, a, _, d, c]), he = G.slice(0, Ae), ge = G.length - he.length, j = B(
|
|
157
162
|
({ next: e, changes: t }) => {
|
|
158
|
-
t.length > 0 &&
|
|
163
|
+
t.length > 0 && T(e, t);
|
|
159
164
|
},
|
|
160
|
-
[
|
|
161
|
-
),
|
|
162
|
-
Y(!1), y(""), k(null),
|
|
163
|
-
}, [k]),
|
|
164
|
-
u ||
|
|
165
|
-
},
|
|
166
|
-
const e =
|
|
167
|
-
e &&
|
|
168
|
-
|
|
165
|
+
[T]
|
|
166
|
+
), N = B(() => {
|
|
167
|
+
Y(!1), y(""), k(null), pe(null);
|
|
168
|
+
}, [k]), U = () => {
|
|
169
|
+
u || s || (m(0), Y(!0));
|
|
170
|
+
}, A = B(() => {
|
|
171
|
+
const e = C.current;
|
|
172
|
+
e && pe(
|
|
173
|
+
ft(w.current, {
|
|
169
174
|
triggerRect: e.getBoundingClientRect(),
|
|
170
175
|
preset: "standard",
|
|
171
176
|
viewportWidth: window.innerWidth,
|
|
@@ -173,158 +178,158 @@ const gt = {
|
|
|
173
178
|
})
|
|
174
179
|
);
|
|
175
180
|
}, []);
|
|
176
|
-
|
|
177
|
-
u &&
|
|
178
|
-
}, [u,
|
|
179
|
-
if (!
|
|
181
|
+
bt(s, C, A, N), q(() => {
|
|
182
|
+
u && s && N();
|
|
183
|
+
}, [u, s, N]), q(() => {
|
|
184
|
+
if (!s) return;
|
|
180
185
|
const e = (o) => {
|
|
181
|
-
const v = o.composedPath(),
|
|
182
|
-
(!
|
|
186
|
+
const v = o.composedPath(), I = C.current, S = w.current;
|
|
187
|
+
(!I || !v.includes(I)) && (!S || !v.includes(S)) && N();
|
|
183
188
|
};
|
|
184
189
|
let t = null;
|
|
185
190
|
const r = () => {
|
|
186
191
|
t === null && (t = requestAnimationFrame(() => {
|
|
187
|
-
t = null,
|
|
192
|
+
t = null, A();
|
|
188
193
|
}));
|
|
189
|
-
}, n =
|
|
190
|
-
return document.addEventListener("mousedown", e), window.addEventListener("
|
|
191
|
-
document.removeEventListener("mousedown", e), window.removeEventListener("
|
|
194
|
+
}, n = rt(N);
|
|
195
|
+
return document.addEventListener("mousedown", e), window.addEventListener("resize", r), () => {
|
|
196
|
+
document.removeEventListener("mousedown", e), window.removeEventListener("resize", r), t !== null && cancelAnimationFrame(t), n();
|
|
192
197
|
};
|
|
193
|
-
}, [
|
|
194
|
-
if (!
|
|
195
|
-
const e = new ResizeObserver(() =>
|
|
196
|
-
return w.current && e.observe(w.current),
|
|
197
|
-
}, [
|
|
198
|
-
|
|
199
|
-
}, [
|
|
200
|
-
|
|
201
|
-
}, [
|
|
202
|
-
const
|
|
198
|
+
}, [s, N, A]), ke(() => {
|
|
199
|
+
if (!s || (A(), typeof ResizeObserver > "u")) return;
|
|
200
|
+
const e = new ResizeObserver(() => A());
|
|
201
|
+
return w.current && e.observe(w.current), C.current && e.observe(C.current), () => e.disconnect();
|
|
202
|
+
}, [s, A]), ke(() => {
|
|
203
|
+
z.current && (z.current.scrollTop = 0);
|
|
204
|
+
}, [g, c, x]), qe(() => {
|
|
205
|
+
s && mt();
|
|
206
|
+
}, [s]);
|
|
207
|
+
const xe = (e) => {
|
|
203
208
|
requestAnimationFrame(() => {
|
|
204
|
-
const t = de.current[e], r =
|
|
209
|
+
const t = de.current[e], r = z.current;
|
|
205
210
|
if (!t || !r) return;
|
|
206
211
|
const n = t.offsetTop, o = n + t.offsetHeight;
|
|
207
212
|
o > r.scrollTop + r.clientHeight ? r.scrollTop = o - r.clientHeight : n < r.scrollTop && (r.scrollTop = n);
|
|
208
213
|
});
|
|
209
|
-
},
|
|
214
|
+
}, be = (e) => {
|
|
210
215
|
if (e.kind === "filter") {
|
|
211
216
|
k(e.filter.value), y(""), m(0);
|
|
212
217
|
return;
|
|
213
218
|
}
|
|
214
219
|
if (e.kind === "toggle") {
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
e.toggle === "select" ?
|
|
220
|
+
const X = g === "items" && E ? [E] : J;
|
|
221
|
+
j(
|
|
222
|
+
e.toggle === "select" ? pt(X, a, x) : dt(X, a, x)
|
|
218
223
|
), y(""), m(0);
|
|
219
224
|
return;
|
|
220
225
|
}
|
|
221
226
|
const { item: t, filter: r } = e.row;
|
|
222
227
|
if (t.disabled) return;
|
|
223
|
-
const n =
|
|
224
|
-
if (
|
|
228
|
+
const n = ut(a, r.value, t.value);
|
|
229
|
+
if (j(n), y(""), g !== "items") {
|
|
225
230
|
m(0);
|
|
226
231
|
return;
|
|
227
232
|
}
|
|
228
|
-
const { toggle: o, items: v } =
|
|
229
|
-
m(S),
|
|
230
|
-
},
|
|
233
|
+
const { toggle: o, items: v } = Re(r, n.next, ""), I = v.findIndex((X) => X.item.value === t.value), S = I < 0 ? 0 : I + (o ? 1 : 0);
|
|
234
|
+
m(S), xe(S);
|
|
235
|
+
}, Oe = (e) => {
|
|
231
236
|
if (b.length === 0) return;
|
|
232
|
-
let t =
|
|
237
|
+
let t = $ < 0 ? ce : $;
|
|
233
238
|
for (let r = 0; r < b.length; r++)
|
|
234
|
-
if (t = (t + e + b.length) % b.length,
|
|
235
|
-
m(t),
|
|
239
|
+
if (t = (t + e + b.length) % b.length, ne(b[t])) {
|
|
240
|
+
m(t), xe(t);
|
|
236
241
|
return;
|
|
237
242
|
}
|
|
238
|
-
},
|
|
239
|
-
e === c && k(null),
|
|
240
|
-
},
|
|
243
|
+
}, ve = (e) => {
|
|
244
|
+
e === c && k(null), j(st(a, e));
|
|
245
|
+
}, He = (e) => {
|
|
241
246
|
var t;
|
|
242
|
-
u ||
|
|
243
|
-
},
|
|
247
|
+
u || d || (k(e), y(""), m(0), Y(!0), (t = M.current) == null || t.focus());
|
|
248
|
+
}, Pe = (e) => {
|
|
244
249
|
if (!(e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229))
|
|
245
250
|
switch (e.key) {
|
|
246
251
|
case "ArrowDown":
|
|
247
252
|
case "ArrowUp": {
|
|
248
|
-
if (e.preventDefault(), !
|
|
249
|
-
|
|
253
|
+
if (e.preventDefault(), !s) {
|
|
254
|
+
U();
|
|
250
255
|
return;
|
|
251
256
|
}
|
|
252
|
-
|
|
257
|
+
Oe(e.key === "ArrowDown" ? 1 : -1);
|
|
253
258
|
return;
|
|
254
259
|
}
|
|
255
260
|
case "Enter": {
|
|
256
|
-
if (e.preventDefault(), !
|
|
257
|
-
|
|
261
|
+
if (e.preventDefault(), !s) {
|
|
262
|
+
U();
|
|
258
263
|
return;
|
|
259
264
|
}
|
|
260
|
-
const t = b[
|
|
261
|
-
|
|
265
|
+
const t = b[$];
|
|
266
|
+
ne(t) && be(t);
|
|
262
267
|
return;
|
|
263
268
|
}
|
|
264
269
|
case "Backspace": {
|
|
265
270
|
if (x !== "") return;
|
|
266
|
-
if (c !== null && !
|
|
271
|
+
if (c !== null && !a.some((o) => o.filter === c)) {
|
|
267
272
|
e.preventDefault(), k(null), m(0);
|
|
268
273
|
return;
|
|
269
274
|
}
|
|
270
|
-
const r =
|
|
275
|
+
const r = G.filter((o) => a.some((v) => v.filter === o.filter)), n = r[r.length - 1];
|
|
271
276
|
if (!n) return;
|
|
272
|
-
e.preventDefault(),
|
|
277
|
+
e.preventDefault(), ve(n.filter);
|
|
273
278
|
return;
|
|
274
279
|
}
|
|
275
280
|
}
|
|
276
|
-
},
|
|
277
|
-
e.stopPropagation(),
|
|
278
|
-
},
|
|
281
|
+
}, ze = (e) => {
|
|
282
|
+
e.stopPropagation(), j(ct(a)), k(null), y(""), L == null || L();
|
|
283
|
+
}, We = () => {
|
|
279
284
|
k(null), y(""), m(0);
|
|
280
|
-
},
|
|
285
|
+
}, ye = Te && a.length > 0 && !u && !d, $ = s ? St(b, ce) : -1, Ge = et({ disabled: u, open: s }), je = g === "filters" ? "No filters available" : "No matching values", Ue = {
|
|
281
286
|
position: "fixed",
|
|
282
|
-
top: (
|
|
283
|
-
left: (
|
|
284
|
-
width:
|
|
285
|
-
background:
|
|
286
|
-
border:
|
|
287
|
-
borderRadius:
|
|
288
|
-
boxShadow:
|
|
289
|
-
padding:
|
|
287
|
+
top: (p == null ? void 0 : p.top) ?? 0,
|
|
288
|
+
left: (p == null ? void 0 : p.left) ?? 0,
|
|
289
|
+
width: p == null ? void 0 : p.width,
|
|
290
|
+
background: P.standard.background,
|
|
291
|
+
border: P.standard.border,
|
|
292
|
+
borderRadius: P.standard.radius,
|
|
293
|
+
boxShadow: P.standard.shadow,
|
|
294
|
+
padding: P.standard.padding,
|
|
290
295
|
display: "flex",
|
|
291
296
|
flexDirection: "column",
|
|
292
297
|
gap: 4,
|
|
293
|
-
maxHeight: (
|
|
294
|
-
fontSize:
|
|
295
|
-
visibility:
|
|
296
|
-
opacity:
|
|
298
|
+
maxHeight: (p == null ? void 0 : p.maxHeight) ?? ht,
|
|
299
|
+
fontSize: Ye[Q],
|
|
300
|
+
visibility: p ? "visible" : "hidden",
|
|
301
|
+
opacity: p ? 1 : 0
|
|
297
302
|
};
|
|
298
|
-
return /* @__PURE__ */ f(
|
|
303
|
+
return /* @__PURE__ */ f(V, { children: [
|
|
299
304
|
/* @__PURE__ */ f(
|
|
300
305
|
"div",
|
|
301
306
|
{
|
|
302
|
-
className: `relative min-w-0 ${
|
|
303
|
-
style: { ...
|
|
307
|
+
className: `relative min-w-0 ${$e}`,
|
|
308
|
+
style: { ...Je(De), ...Le },
|
|
304
309
|
children: [
|
|
305
310
|
/* @__PURE__ */ f(
|
|
306
311
|
"div",
|
|
307
312
|
{
|
|
308
|
-
ref:
|
|
309
|
-
[
|
|
310
|
-
"data-open":
|
|
313
|
+
ref: C,
|
|
314
|
+
[tt]: "",
|
|
315
|
+
"data-open": s || void 0,
|
|
311
316
|
onBlur: (e) => {
|
|
312
317
|
var r, n;
|
|
313
318
|
const t = e.relatedTarget;
|
|
314
|
-
t && ((r =
|
|
319
|
+
t && ((r = C.current) != null && r.contains(t) || (n = w.current) != null && n.contains(t)) || N();
|
|
315
320
|
},
|
|
316
321
|
onMouseDown: (e) => {
|
|
317
322
|
var t;
|
|
318
|
-
u || (e.target !==
|
|
323
|
+
u || (e.target !== M.current && e.preventDefault(), (t = M.current) == null || t.focus(), U());
|
|
319
324
|
},
|
|
320
325
|
style: {
|
|
321
326
|
transition: "border-color 0.15s ease, box-shadow 0.15s ease",
|
|
322
|
-
...
|
|
327
|
+
...Ge
|
|
323
328
|
},
|
|
324
|
-
className: `w-full min-w-0 flex items-center border border-solid font-normal ${
|
|
329
|
+
className: `w-full min-w-0 flex items-center border border-solid font-normal ${yt[Q]} ${u ? "cursor-not-allowed" : "cursor-text"}`,
|
|
325
330
|
children: [
|
|
326
331
|
/* @__PURE__ */ l(
|
|
327
|
-
|
|
332
|
+
Ke,
|
|
328
333
|
{
|
|
329
334
|
size: 13,
|
|
330
335
|
className: "shrink-0 mr-1",
|
|
@@ -334,15 +339,15 @@ const gt = {
|
|
|
334
339
|
/* @__PURE__ */ f(
|
|
335
340
|
"div",
|
|
336
341
|
{
|
|
337
|
-
className: `flex flex-1 min-w-0 flex-wrap items-center ${
|
|
342
|
+
className: `flex flex-1 min-w-0 flex-wrap items-center ${wt[Q]} ${ye ? "pr-[18px]" : ""}`,
|
|
338
343
|
children: [
|
|
339
|
-
|
|
340
|
-
const t =
|
|
344
|
+
he.map((e) => {
|
|
345
|
+
const t = s && e.filter === c;
|
|
341
346
|
return /* @__PURE__ */ f(
|
|
342
347
|
"span",
|
|
343
348
|
{
|
|
344
|
-
onMouseDown:
|
|
345
|
-
className: `inline-flex items-center gap-1 max-w-[max(60px,calc(100%-64px))] min-w-0 h-[22px] pl-1.5 pr-1 rounded-md text-xs ${t ?
|
|
349
|
+
onMouseDown: Ct,
|
|
350
|
+
className: `inline-flex items-center gap-1 max-w-[max(60px,calc(100%-64px))] min-w-0 h-[22px] pl-1.5 pr-1 rounded-md text-xs ${t ? re.active : re.resting}`,
|
|
346
351
|
children: [
|
|
347
352
|
/* @__PURE__ */ l(
|
|
348
353
|
"button",
|
|
@@ -351,8 +356,8 @@ const gt = {
|
|
|
351
356
|
disabled: u,
|
|
352
357
|
title: e.text,
|
|
353
358
|
"aria-label": `Edit filter ${e.text}`,
|
|
354
|
-
onClick: () =>
|
|
355
|
-
className: `truncate min-w-0 bg-transparent border-none p-0 text-[length:inherit] text-current ${u ||
|
|
359
|
+
onClick: () => He(e.filter),
|
|
360
|
+
className: `truncate min-w-0 bg-transparent border-none p-0 text-[length:inherit] text-current ${u || d ? "cursor-default" : "cursor-pointer"} ${te}`,
|
|
356
361
|
children: e.text
|
|
357
362
|
}
|
|
358
363
|
),
|
|
@@ -363,10 +368,10 @@ const gt = {
|
|
|
363
368
|
"aria-label": `Remove filter ${e.text}`,
|
|
364
369
|
onClick: (r) => {
|
|
365
370
|
var n;
|
|
366
|
-
r.stopPropagation(),
|
|
371
|
+
r.stopPropagation(), ve(e.filter), (n = M.current) == null || n.focus();
|
|
367
372
|
},
|
|
368
|
-
className: `flex items-center justify-center shrink-0 bg-transparent border-none p-0 text-current opacity-70 hover:opacity-100 cursor-pointer ${
|
|
369
|
-
children: /* @__PURE__ */ l(
|
|
373
|
+
className: `flex items-center justify-center shrink-0 bg-transparent border-none p-0 text-current opacity-70 hover:opacity-100 cursor-pointer ${te}`,
|
|
374
|
+
children: /* @__PURE__ */ l(Se, { size: 10 })
|
|
370
375
|
}
|
|
371
376
|
)
|
|
372
377
|
]
|
|
@@ -374,82 +379,82 @@ const gt = {
|
|
|
374
379
|
e.filter
|
|
375
380
|
);
|
|
376
381
|
}),
|
|
377
|
-
|
|
382
|
+
ge > 0 && /* @__PURE__ */ f(
|
|
378
383
|
"span",
|
|
379
384
|
{
|
|
380
|
-
className: `inline-flex items-center h-[22px] px-1.5 rounded-md text-xs ${
|
|
385
|
+
className: `inline-flex items-center h-[22px] px-1.5 rounded-md text-xs ${re.resting}`,
|
|
381
386
|
children: [
|
|
382
387
|
"+",
|
|
383
|
-
|
|
388
|
+
ge
|
|
384
389
|
]
|
|
385
390
|
}
|
|
386
391
|
),
|
|
387
392
|
/* @__PURE__ */ l(
|
|
388
393
|
"input",
|
|
389
394
|
{
|
|
390
|
-
ref:
|
|
391
|
-
id:
|
|
395
|
+
ref: M,
|
|
396
|
+
id: Me,
|
|
392
397
|
type: "text",
|
|
393
398
|
role: "combobox",
|
|
394
399
|
value: x,
|
|
395
400
|
disabled: u,
|
|
396
|
-
placeholder:
|
|
401
|
+
placeholder: G.length === 0 ? K : "",
|
|
397
402
|
autoComplete: "off",
|
|
398
403
|
spellCheck: !1,
|
|
399
|
-
"aria-label":
|
|
400
|
-
"aria-labelledby":
|
|
404
|
+
"aria-label": oe ? void 0 : ie ?? K,
|
|
405
|
+
"aria-labelledby": oe,
|
|
401
406
|
"aria-haspopup": "listbox",
|
|
402
407
|
"aria-autocomplete": "list",
|
|
403
|
-
"aria-expanded":
|
|
404
|
-
"aria-controls":
|
|
405
|
-
"aria-activedescendant":
|
|
406
|
-
"aria-busy":
|
|
408
|
+
"aria-expanded": s,
|
|
409
|
+
"aria-controls": s ? ae : void 0,
|
|
410
|
+
"aria-activedescendant": $ >= 0 ? se($) : void 0,
|
|
411
|
+
"aria-busy": d || void 0,
|
|
407
412
|
onChange: (e) => {
|
|
408
|
-
y(e.target.value), m(0),
|
|
413
|
+
y(e.target.value), m(0), U();
|
|
409
414
|
},
|
|
410
|
-
onKeyDown:
|
|
415
|
+
onKeyDown: Pe,
|
|
411
416
|
className: "flex-1 min-w-[60px] border-none outline-none bg-transparent p-0 text-[length:inherit] text-[var(--malachite-text-primary,rgb(10,10,10))] placeholder:text-[var(--malachite-text-placeholder,rgb(187,187,187))] disabled:cursor-not-allowed"
|
|
412
417
|
}
|
|
413
418
|
)
|
|
414
419
|
]
|
|
415
420
|
}
|
|
416
421
|
),
|
|
417
|
-
/* @__PURE__ */ l("span", { className: "flex items-center justify-center shrink-0 size-[14px] ml-1", children:
|
|
418
|
-
|
|
422
|
+
/* @__PURE__ */ l("span", { className: "flex items-center justify-center shrink-0 size-[14px] ml-1", children: d ? /* @__PURE__ */ l(Qe, { size: "xxxsmall" }) : /* @__PURE__ */ l(
|
|
423
|
+
Ve,
|
|
419
424
|
{
|
|
420
425
|
size: 13,
|
|
421
426
|
style: {
|
|
422
|
-
color:
|
|
427
|
+
color: s ? "var(--malachite-text-primary, rgb(10, 10, 10))" : "var(--malachite-text-placeholder, rgb(187, 187, 187))",
|
|
423
428
|
transition: "transform 0.2s ease, color 0.2s ease",
|
|
424
|
-
transform:
|
|
429
|
+
transform: s ? "rotate(180deg)" : "rotate(0deg)"
|
|
425
430
|
}
|
|
426
431
|
}
|
|
427
432
|
) })
|
|
428
433
|
]
|
|
429
434
|
}
|
|
430
435
|
),
|
|
431
|
-
|
|
436
|
+
ye && /* @__PURE__ */ l(
|
|
432
437
|
"button",
|
|
433
438
|
{
|
|
434
439
|
type: "button",
|
|
435
440
|
"aria-label": "Clear filters",
|
|
436
|
-
onMouseDown:
|
|
437
|
-
onClick:
|
|
438
|
-
className: `absolute top-0 bottom-0 right-[30px] flex items-center justify-center px-[2px] bg-transparent border-none text-[var(--malachite-text-placeholder)] hover:text-[var(--malachite-text-primary)] cursor-pointer ${
|
|
439
|
-
children: /* @__PURE__ */ l(
|
|
441
|
+
onMouseDown: Ne,
|
|
442
|
+
onClick: ze,
|
|
443
|
+
className: `absolute top-0 bottom-0 right-[30px] flex items-center justify-center px-[2px] bg-transparent border-none text-[var(--malachite-text-placeholder)] hover:text-[var(--malachite-text-primary)] cursor-pointer ${te}`,
|
|
444
|
+
children: /* @__PURE__ */ l(Se, { size: 10 })
|
|
440
445
|
}
|
|
441
446
|
)
|
|
442
447
|
]
|
|
443
448
|
}
|
|
444
449
|
),
|
|
445
|
-
|
|
450
|
+
s && Be(
|
|
446
451
|
/* @__PURE__ */ f(
|
|
447
452
|
"div",
|
|
448
453
|
{
|
|
449
454
|
ref: w,
|
|
450
|
-
...
|
|
451
|
-
style:
|
|
452
|
-
onMouseDown:
|
|
455
|
+
...Fe,
|
|
456
|
+
style: Ue,
|
|
457
|
+
onMouseDown: Ne,
|
|
453
458
|
children: [
|
|
454
459
|
/* @__PURE__ */ l(
|
|
455
460
|
"div",
|
|
@@ -461,14 +466,14 @@ const gt = {
|
|
|
461
466
|
gap: 4,
|
|
462
467
|
minWidth: 0
|
|
463
468
|
},
|
|
464
|
-
children:
|
|
469
|
+
children: g === "items" ? /* @__PURE__ */ f(V, { children: [
|
|
465
470
|
/* @__PURE__ */ l(
|
|
466
471
|
"button",
|
|
467
472
|
{
|
|
468
473
|
type: "button",
|
|
469
474
|
tabIndex: -1,
|
|
470
|
-
onClick:
|
|
471
|
-
className:
|
|
475
|
+
onClick: We,
|
|
476
|
+
className: D.crumb,
|
|
472
477
|
style: {
|
|
473
478
|
background: "none",
|
|
474
479
|
border: "none",
|
|
@@ -479,19 +484,19 @@ const gt = {
|
|
|
479
484
|
children: "Filters"
|
|
480
485
|
}
|
|
481
486
|
),
|
|
482
|
-
/* @__PURE__ */ l("span", { style:
|
|
487
|
+
/* @__PURE__ */ l("span", { style: Z, children: `> ${(E == null ? void 0 : E.label) ?? ((we = _.get(c ?? "")) == null ? void 0 : we.label) ?? ""}` })
|
|
483
488
|
] }) : "Filters"
|
|
484
489
|
}
|
|
485
490
|
),
|
|
486
491
|
/* @__PURE__ */ f(
|
|
487
492
|
"div",
|
|
488
493
|
{
|
|
489
|
-
ref:
|
|
490
|
-
id:
|
|
494
|
+
ref: z,
|
|
495
|
+
id: ae,
|
|
491
496
|
role: "listbox",
|
|
492
|
-
"aria-multiselectable":
|
|
493
|
-
"aria-label":
|
|
494
|
-
"aria-busy":
|
|
497
|
+
"aria-multiselectable": g !== "filters",
|
|
498
|
+
"aria-label": ie ?? K,
|
|
499
|
+
"aria-busy": d || void 0,
|
|
495
500
|
style: {
|
|
496
501
|
display: "flex",
|
|
497
502
|
flexDirection: "column",
|
|
@@ -503,11 +508,11 @@ const gt = {
|
|
|
503
508
|
scrollbarWidth: "thin"
|
|
504
509
|
},
|
|
505
510
|
children: [
|
|
506
|
-
|
|
511
|
+
d && Array.from({ length: kt }, (e, t) => /* @__PURE__ */ l(
|
|
507
512
|
"div",
|
|
508
513
|
{
|
|
509
514
|
role: "presentation",
|
|
510
|
-
className:
|
|
515
|
+
className: D.loading,
|
|
511
516
|
style: {
|
|
512
517
|
height: 24,
|
|
513
518
|
margin: "4px 10px",
|
|
@@ -517,7 +522,7 @@ const gt = {
|
|
|
517
522
|
},
|
|
518
523
|
t
|
|
519
524
|
)),
|
|
520
|
-
!
|
|
525
|
+
!d && b.length === 0 && /* @__PURE__ */ l(
|
|
521
526
|
"div",
|
|
522
527
|
{
|
|
523
528
|
role: "presentation",
|
|
@@ -525,7 +530,7 @@ const gt = {
|
|
|
525
530
|
padding: "6px 10px",
|
|
526
531
|
color: "var(--malachite-text-secondary, rgb(123, 123, 123))"
|
|
527
532
|
},
|
|
528
|
-
children:
|
|
533
|
+
children: je
|
|
529
534
|
}
|
|
530
535
|
),
|
|
531
536
|
b.map((e, t) => {
|
|
@@ -533,7 +538,7 @@ const gt = {
|
|
|
533
538
|
return /* @__PURE__ */ l(
|
|
534
539
|
"button",
|
|
535
540
|
{
|
|
536
|
-
id:
|
|
541
|
+
id: se(t),
|
|
537
542
|
ref: (o) => {
|
|
538
543
|
de.current[t] = o;
|
|
539
544
|
},
|
|
@@ -542,15 +547,15 @@ const gt = {
|
|
|
542
547
|
role: "option",
|
|
543
548
|
"aria-selected": e.kind === "item" ? e.row.selected : !1,
|
|
544
549
|
"aria-disabled": n || void 0,
|
|
545
|
-
"data-highlighted": t ===
|
|
550
|
+
"data-highlighted": t === $,
|
|
546
551
|
"data-disabled": n,
|
|
547
|
-
className:
|
|
552
|
+
className: D.row,
|
|
548
553
|
onMouseEnter: () => {
|
|
549
554
|
n || m(t);
|
|
550
555
|
},
|
|
551
|
-
onClick: () =>
|
|
552
|
-
style:
|
|
553
|
-
children: /* @__PURE__ */ l(
|
|
556
|
+
onClick: () => be(e),
|
|
557
|
+
style: Rt,
|
|
558
|
+
children: /* @__PURE__ */ l(Et, { row: e, showFilter: g === "search" })
|
|
554
559
|
},
|
|
555
560
|
r
|
|
556
561
|
);
|
|
@@ -566,7 +571,7 @@ const gt = {
|
|
|
566
571
|
] });
|
|
567
572
|
};
|
|
568
573
|
export {
|
|
569
|
-
|
|
570
|
-
|
|
574
|
+
Bt as FilterSearch,
|
|
575
|
+
Bt as default
|
|
571
576
|
};
|
|
572
577
|
//# sourceMappingURL=FilterSearch.js.map
|