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