@iclips/ui 4.1.4 → 4.3.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.
@@ -1,17 +1,17 @@
1
- import { jsxs as u, jsx as r, Fragment as T } from "react/jsx-runtime";
2
- import z from "react";
3
- import { cn as N } from "../utils.js";
4
- import { Button as c } from "../primitives/button.js";
5
- import { Plus as X, Search as Y, X as L } from "lucide-react";
6
- import { Popover as S, PopoverTrigger as _, PopoverContent as C } from "../overlays/popover.js";
7
- import { Badge as G } from "../primitives/badge.js";
8
- import { Input as O } from "../forms/input.js";
9
- import { Checkbox as J } from "../forms/checkbox.js";
10
- import { Label as V } from "../primitives/label.js";
11
- import { DatePicker as K } from "../forms/date-picker.js";
12
- import { DateRangePicker as Q } from "../forms/date-range-picker.js";
13
- import { MonthRangePicker as W } from "../forms/month-range-picker.js";
14
- const $ = [
1
+ import { jsxs as c, jsx as r, Fragment as L } from "react/jsx-runtime";
2
+ import w from "react";
3
+ import { cn as S } from "../utils.js";
4
+ import { Button as f } from "../primitives/button.js";
5
+ import { Plus as W, Search as Z, X as j } from "lucide-react";
6
+ import { Popover as A, PopoverTrigger as P, PopoverContent as k, PopoverAnchor as U } from "../overlays/popover.js";
7
+ import { Badge as F } from "../primitives/badge.js";
8
+ import { Input as E } from "../forms/input.js";
9
+ import { Checkbox as ee } from "../forms/checkbox.js";
10
+ import { Label as X } from "../primitives/label.js";
11
+ import { DatePicker as ae } from "../forms/date-picker.js";
12
+ import { DateRangePicker as le } from "../forms/date-range-picker.js";
13
+ import { MonthRangePicker as re } from "../forms/month-range-picker.js";
14
+ const C = [
15
15
  { value: "is", label: "é", multiSelect: !1 },
16
16
  { value: "is_not", label: "não é", multiSelect: !1 },
17
17
  { value: "is_any_of", label: "é qualquer um de", multiSelect: !0 },
@@ -25,76 +25,91 @@ const $ = [
25
25
  { value: "between", label: "está entre", multiSelect: !1 },
26
26
  { value: "is_empty", label: "está vazio", multiSelect: !1 },
27
27
  { value: "is_not_empty", label: "não está vazio", multiSelect: !1 }
28
- ], k = "between";
29
- function I(a) {
28
+ ], Y = "between";
29
+ function G(a) {
30
+ var o;
31
+ return $(a) ? C.filter((s) => s.value === Y) : (o = a == null ? void 0 : a.operators) != null && o.length ? a.operators.map((s) => C.find((u) => u.value === s)).filter((s) => !!s) : C.filter((s) => s.value !== Y);
32
+ }
33
+ function M(a) {
34
+ var o;
35
+ return ((o = G(a)[0]) == null ? void 0 : o.value) ?? "is";
36
+ }
37
+ function H(a, o, s) {
38
+ const u = new Set(o.filter((i) => i.id !== s).map((i) => i.field));
39
+ return a.filter((i) => !(i.unique && u.has(i.value)));
40
+ }
41
+ function $(a) {
30
42
  return (a == null ? void 0 : a.type) === "dateRange" || (a == null ? void 0 : a.type) === "monthRange";
31
43
  }
32
- function A(a) {
33
- const v = String(a.getMonth() + 1).padStart(2, "0"), d = String(a.getDate()).padStart(2, "0");
34
- return `${a.getFullYear()}-${v}-${d}`;
44
+ function D(a) {
45
+ const o = String(a.getMonth() + 1).padStart(2, "0"), s = String(a.getDate()).padStart(2, "0");
46
+ return `${a.getFullYear()}-${o}-${s}`;
35
47
  }
36
- function R(a) {
48
+ function z(a) {
37
49
  return /* @__PURE__ */ new Date(`${a}T00:00:00`);
38
50
  }
39
- function ce({
51
+ function be({
40
52
  conditions: a,
41
- onConditionsChange: v,
42
- fields: d,
43
- className: o
53
+ onConditionsChange: o,
54
+ fields: s,
55
+ className: u
44
56
  }) {
45
- const P = () => {
46
- var m;
47
- const s = {
57
+ const i = H(s, a).find(
58
+ (m) => !a.some((h) => h.field === m.value)
59
+ ) ?? H(s, a)[0], l = () => {
60
+ if (!i) return;
61
+ const m = {
48
62
  id: Math.random().toString(36).substr(2, 9),
49
- field: ((m = d[0]) == null ? void 0 : m.value) || "",
50
- operator: "is",
51
- value: ""
63
+ field: i.value,
64
+ operator: M(i),
65
+ value: i.multiSelect || $(i) ? [] : ""
52
66
  };
53
- v([...a, s]);
54
- }, l = (s) => {
55
- v(a.filter((m) => m.id !== s));
56
- }, h = (s, m) => {
57
- v(
58
- a.map((p) => p.id === s ? { ...p, ...m } : p)
67
+ o([...a, m]);
68
+ }, d = (m) => {
69
+ o(a.filter((h) => h.id !== m));
70
+ }, v = (m, h) => {
71
+ o(
72
+ a.map((g) => g.id === m ? { ...g, ...h } : g)
59
73
  );
60
74
  };
61
- return /* @__PURE__ */ u("div", { className: N("space-y-3", o), children: [
62
- a.length === 0 ? /* @__PURE__ */ r("div", { className: "text-center py-8 text-muted-foreground text-sm", children: 'Nenhuma condição de filtro. Clique em "Adicionar condição" para começar.' }) : a.map((s, m) => /* @__PURE__ */ r(
63
- Z,
75
+ return /* @__PURE__ */ c("div", { className: S("space-y-3", u), children: [
76
+ a.length === 0 ? /* @__PURE__ */ r("div", { className: "text-center py-8 text-muted-foreground text-sm", children: 'Nenhuma condição de filtro. Clique em "Adicionar condição" para começar.' }) : a.map((m, h) => /* @__PURE__ */ r(
77
+ te,
64
78
  {
65
- condition: s,
66
- fields: d,
67
- index: m,
68
- onUpdate: (p) => h(s.id, p),
69
- onRemove: () => l(s.id)
79
+ condition: m,
80
+ fields: H(s, a, m.id),
81
+ index: h,
82
+ onUpdate: (g) => v(m.id, g),
83
+ onRemove: () => d(m.id)
70
84
  },
71
- s.id
85
+ m.id
72
86
  )),
73
- /* @__PURE__ */ u(
74
- c,
87
+ /* @__PURE__ */ c(
88
+ f,
75
89
  {
76
90
  type: "button",
77
91
  variant: "outline",
78
92
  size: "sm",
79
- onClick: P,
93
+ onClick: l,
94
+ disabled: !i,
80
95
  className: "gap-2",
81
96
  children: [
82
- /* @__PURE__ */ r(X, { className: "h-4 w-4" }),
97
+ /* @__PURE__ */ r(W, { className: "h-4 w-4" }),
83
98
  "Adicionar condição"
84
99
  ]
85
100
  }
86
101
  )
87
102
  ] });
88
103
  }
89
- function Z({
104
+ function te({
90
105
  condition: a,
91
- fields: v,
92
- index: d,
93
- onUpdate: o,
94
- onRemove: P
106
+ fields: o,
107
+ index: s,
108
+ onUpdate: u,
109
+ onRemove: i
95
110
  }) {
96
- var M;
97
- const l = v.find((e) => e.value === a.field), h = $.find((e) => e.value === a.operator), s = (l == null ? void 0 : l.multiSelect) || (h == null ? void 0 : h.multiSelect) || !1, m = !["is_empty", "is_not_empty"].includes(a.operator), p = I(l), j = p ? $.filter((e) => e.value === k) : $.filter((e) => e.value !== k), g = Array.isArray(a.value) ? a.value : [], [y, q] = z.useState(""), b = z.useMemo(() => l != null && l.groups ? l.groups.flatMap((e) => [
111
+ var B;
112
+ const l = o.find((e) => e.value === a.field), d = C.find((e) => e.value === a.operator), v = (l == null ? void 0 : l.multiSelect) || (d == null ? void 0 : d.multiSelect) || !1, m = !["is_empty", "is_not_empty"].includes(a.operator), h = $(l), g = G(l), x = Array.isArray(a.value) ? a.value : [], [_, O] = w.useState(""), T = w.useRef(null), [I, J] = w.useState(null), N = w.useMemo(() => l != null && l.groups ? l.groups.flatMap((e) => [
98
113
  {
99
114
  value: e.value ?? `__label__${e.label}`,
100
115
  label: e.label,
@@ -113,38 +128,38 @@ function Z({
113
128
  label: e.label,
114
129
  isHeader: !1,
115
130
  selecionavel: !0
116
- })), [l == null ? void 0 : l.options, l == null ? void 0 : l.groups]), H = z.useMemo(() => {
117
- if (!y) return b;
118
- const e = y.toLowerCase(), t = (i) => i.label.toLowerCase().includes(e) || i.value.toLowerCase().includes(e);
119
- if (!(l != null && l.groups)) return b.filter(t);
131
+ })), [l == null ? void 0 : l.options, l == null ? void 0 : l.groups]), V = w.useMemo(() => {
132
+ if (!_) return N;
133
+ const e = _.toLowerCase(), t = (p) => p.label.toLowerCase().includes(e) || p.value.toLowerCase().includes(e);
134
+ if (!(l != null && l.groups)) return N.filter(t);
120
135
  const n = [];
121
- let f = null, D = !1, w = !1;
122
- for (const i of b) {
123
- if (i.isHeader) {
124
- f = i, D = t(i), w = !1, D && (n.push(i), w = !0);
136
+ let b = null, q = !1, R = !1;
137
+ for (const p of N) {
138
+ if (p.isHeader) {
139
+ b = p, q = t(p), R = !1, q && (n.push(p), R = !0);
125
140
  continue;
126
141
  }
127
- (D || t(i)) && (!w && f && (n.push(f), w = !0), n.push(i));
142
+ (q || t(p)) && (!R && b && (n.push(b), R = !0), n.push(p));
128
143
  }
129
144
  return n;
130
- }, [b, y, l == null ? void 0 : l.groups]), x = Array.isArray(a.value) ? a.value : a.value ? [a.value] : [], B = (e) => {
131
- if (!s) {
132
- o({ value: e });
145
+ }, [N, _, l == null ? void 0 : l.groups]), y = Array.isArray(a.value) ? a.value : a.value ? [a.value] : [], K = (e) => {
146
+ if (!v) {
147
+ u({ value: e });
133
148
  return;
134
149
  }
135
- const t = Array.isArray(a.value) ? a.value : [], n = t.includes(e) ? t.filter((f) => f !== e) : [...t, e];
136
- o({ value: n });
137
- }, E = (e) => {
138
- if (!s) return;
150
+ const t = Array.isArray(a.value) ? a.value : [], n = t.includes(e) ? t.filter((b) => b !== e) : [...t, e];
151
+ u({ value: n });
152
+ }, Q = (e) => {
153
+ if (!v) return;
139
154
  const t = Array.isArray(a.value) ? a.value : [];
140
- o({ value: t.filter((n) => n !== e) });
155
+ u({ value: t.filter((n) => n !== e) });
141
156
  };
142
- return /* @__PURE__ */ u("div", { className: "flex items-start gap-2 group", children: [
143
- /* @__PURE__ */ r("div", { className: "flex items-center h-9 px-2 text-sm text-muted-foreground", children: d === 0 ? "Onde" : "E" }),
144
- /* @__PURE__ */ u("div", { className: "flex-1 flex items-center gap-2 flex-wrap p-2 border rounded-lg bg-background", children: [
145
- /* @__PURE__ */ u(S, { children: [
146
- /* @__PURE__ */ r(_, { asChild: !0, children: /* @__PURE__ */ r(
147
- c,
157
+ return /* @__PURE__ */ c("div", { className: "flex items-start gap-2 group", children: [
158
+ /* @__PURE__ */ r("div", { className: "flex items-center h-9 px-2 text-sm text-muted-foreground", children: s === 0 ? "Onde" : "E" }),
159
+ /* @__PURE__ */ c("div", { className: "flex-1 flex items-center gap-2 flex-wrap p-2 border rounded-lg bg-background", children: [
160
+ /* @__PURE__ */ c(A, { children: [
161
+ /* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(
162
+ f,
148
163
  {
149
164
  variant: "ghost",
150
165
  size: "sm",
@@ -152,46 +167,49 @@ function Z({
152
167
  children: (l == null ? void 0 : l.label) || "Selecionar campo"
153
168
  }
154
169
  ) }),
155
- /* @__PURE__ */ r(C, { className: "w-[200px] p-2", align: "start", children: /* @__PURE__ */ r("div", { className: "space-y-1", children: v.map((e) => /* @__PURE__ */ r(
156
- c,
170
+ /* @__PURE__ */ r(k, { className: "w-[200px] p-2", align: "start", children: /* @__PURE__ */ r("div", { className: "space-y-1", children: o.map((e) => /* @__PURE__ */ r(
171
+ f,
157
172
  {
158
173
  variant: "ghost",
159
174
  size: "sm",
160
- className: N(
175
+ className: S(
161
176
  "w-full justify-start",
162
177
  a.field === e.value && "bg-muted"
163
178
  ),
164
- onClick: () => o({
165
- field: e.value,
166
- // Campo de período só tem "está entre"; ao sair dele, volta ao operador padrão
167
- ...I(e) ? { operator: k } : a.operator === k ? { operator: "is" } : {},
168
- value: e.multiSelect || I(e) ? [] : ""
169
- }),
179
+ onClick: () => {
180
+ var t;
181
+ return u({
182
+ field: e.value,
183
+ // O operador volta ao inicial do novo campo (restrito por `operators` ou período)
184
+ operator: M(e),
185
+ value: e.multiSelect || $(e) || (t = C.find((n) => n.value === M(e))) != null && t.multiSelect ? [] : ""
186
+ });
187
+ },
170
188
  children: e.label
171
189
  },
172
190
  e.value
173
191
  )) }) })
174
192
  ] }),
175
- /* @__PURE__ */ u(S, { children: [
176
- /* @__PURE__ */ r(_, { asChild: !0, children: /* @__PURE__ */ r(
177
- c,
193
+ /* @__PURE__ */ c(A, { children: [
194
+ /* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(
195
+ f,
178
196
  {
179
197
  variant: "ghost",
180
198
  size: "sm",
181
199
  className: "h-7 px-2 font-normal hover:bg-muted text-muted-foreground",
182
- children: (h == null ? void 0 : h.label) || "is"
200
+ children: (d == null ? void 0 : d.label) || "is"
183
201
  }
184
202
  ) }),
185
- /* @__PURE__ */ r(C, { className: "w-[200px] p-2", align: "start", children: /* @__PURE__ */ r("div", { className: "space-y-1", children: j.map((e) => /* @__PURE__ */ r(
186
- c,
203
+ /* @__PURE__ */ r(k, { className: "w-[200px] p-2", align: "start", children: /* @__PURE__ */ r("div", { className: "space-y-1", children: g.map((e) => /* @__PURE__ */ r(
204
+ f,
187
205
  {
188
206
  variant: "ghost",
189
207
  size: "sm",
190
- className: N(
208
+ className: S(
191
209
  "w-full justify-start",
192
210
  a.operator === e.value && "bg-muted"
193
211
  ),
194
- onClick: () => o({
212
+ onClick: () => u({
195
213
  operator: e.value,
196
214
  value: e.multiSelect ? [] : ""
197
215
  }),
@@ -200,136 +218,150 @@ function Z({
200
218
  e.value
201
219
  )) }) })
202
220
  ] }),
203
- m && /* @__PURE__ */ u(T, { children: [
204
- p ? (l == null ? void 0 : l.type) === "monthRange" ? /* @__PURE__ */ r(
205
- W,
221
+ m && /* @__PURE__ */ c(L, { children: [
222
+ h ? (l == null ? void 0 : l.type) === "monthRange" ? /* @__PURE__ */ r(
223
+ re,
206
224
  {
207
- value: g.length === 2 ? { from: R(g[0]), to: R(g[1]) } : void 0,
208
- onChange: (e) => o({ value: e ? [A(e.from), A(e.to)] : [] }),
225
+ value: x.length === 2 ? { from: z(x[0]), to: z(x[1]) } : void 0,
226
+ onChange: (e) => u({ value: e ? [D(e.from), D(e.to)] : [] }),
209
227
  className: "h-7 text-sm"
210
228
  }
211
229
  ) : /* @__PURE__ */ r(
212
- Q,
230
+ le,
213
231
  {
214
- value: g.length === 2 ? { from: R(g[0]), to: R(g[1]) } : void 0,
215
- onChange: (e) => o({
216
- value: e != null && e.from && (e != null && e.to) ? [A(e.from), A(e.to)] : []
232
+ value: x.length === 2 ? { from: z(x[0]), to: z(x[1]) } : void 0,
233
+ onChange: (e) => u({
234
+ value: e != null && e.from && (e != null && e.to) ? [D(e.from), D(e.to)] : []
217
235
  }),
218
236
  className: "h-7 text-sm"
219
237
  }
220
238
  ) : l != null && l.options || l != null && l.groups ? (
221
239
  // Select field with options
222
- /* @__PURE__ */ u(S, { onOpenChange: (e) => !e && q(""), children: [
223
- /* @__PURE__ */ r(_, { asChild: !0, children: /* @__PURE__ */ r(
224
- c,
225
- {
226
- variant: "ghost",
227
- size: "sm",
228
- className: "h-7 px-2 font-normal hover:bg-muted",
229
- children: s && x.length > 0 ? /* @__PURE__ */ u("span", { className: "flex items-center gap-1", children: [
230
- x.length,
231
- " selecionado",
232
- x.length > 1 ? "s" : ""
233
- ] }) : !s && a.value && ((M = b.find((e) => e.value === a.value)) == null ? void 0 : M.label) || "Selecionar valor"
234
- }
235
- ) }),
236
- /* @__PURE__ */ r(
237
- C,
238
- {
239
- className: "w-80 max-w-[calc(100vw-2rem)] p-3",
240
- align: "start",
241
- collisionPadding: 8,
242
- children: /* @__PURE__ */ u("div", { className: "space-y-2", children: [
243
- /* @__PURE__ */ r(V, { className: "text-xs text-muted-foreground", children: s ? "Selecionar valores" : "Selecionar valor" }),
244
- /* @__PURE__ */ u("div", { className: "relative", children: [
245
- /* @__PURE__ */ r(Y, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
246
- /* @__PURE__ */ r(
247
- O,
248
- {
249
- type: "text",
250
- placeholder: "Buscar...",
251
- value: y,
252
- onChange: (e) => q(e.target.value),
253
- className: "h-9 pl-8",
254
- autoFocus: !0
255
- }
256
- )
257
- ] }),
258
- /* @__PURE__ */ r("div", { className: "space-y-2 max-h-[320px] overflow-y-auto overflow-x-hidden", children: H.length === 0 ? /* @__PURE__ */ r("div", { className: "text-sm text-muted-foreground text-center py-4", children: "Nenhum resultado encontrado" }) : H.map((e) => {
259
- if (e.isHeader && !e.selecionavel)
260
- return /* @__PURE__ */ r(
261
- "div",
262
- {
263
- title: e.label,
264
- className: "truncate pt-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",
265
- children: e.label
266
- },
267
- e.value
268
- );
269
- const t = s ? x.includes(e.value) : a.value === e.value;
270
- return /* @__PURE__ */ r(
271
- "div",
272
- {
273
- className: N(
274
- "flex min-w-0 items-center space-x-2",
275
- e.isFilho && "pl-4"
276
- ),
277
- children: s ? /* @__PURE__ */ u(T, { children: [
278
- /* @__PURE__ */ r(
279
- J,
280
- {
281
- id: `${a.id}-${e.value}`,
282
- checked: t,
283
- onCheckedChange: () => B(e.value)
284
- }
285
- ),
286
- /* @__PURE__ */ r(
287
- "label",
240
+ /* @__PURE__ */ c(
241
+ A,
242
+ {
243
+ onOpenChange: (e) => {
244
+ var n;
245
+ e || O("");
246
+ const t = (n = T.current) == null ? void 0 : n.closest('[data-slot="popover-content"]');
247
+ e && J(t ? { current: t } : null);
248
+ },
249
+ children: [
250
+ I && /* @__PURE__ */ r(U, { virtualRef: I }),
251
+ /* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(
252
+ f,
253
+ {
254
+ ref: T,
255
+ variant: "ghost",
256
+ size: "sm",
257
+ className: "h-7 px-2 font-normal hover:bg-muted",
258
+ children: v && y.length > 0 ? /* @__PURE__ */ c("span", { className: "flex items-center gap-1", children: [
259
+ y.length,
260
+ " selecionado",
261
+ y.length > 1 ? "s" : ""
262
+ ] }) : !v && a.value && ((B = N.find((e) => e.value === a.value)) == null ? void 0 : B.label) || "Selecionar valor"
263
+ }
264
+ ) }),
265
+ /* @__PURE__ */ r(
266
+ k,
267
+ {
268
+ className: "w-80 max-w-[calc(100vw-2rem)] p-3 data-[state=closed]:pointer-events-none",
269
+ align: "start",
270
+ collisionPadding: 8,
271
+ ...I ? { side: "right", sideOffset: 8 } : {},
272
+ children: /* @__PURE__ */ c("div", { className: "space-y-2", children: [
273
+ /* @__PURE__ */ r(X, { className: "text-xs text-muted-foreground", children: v ? "Selecionar valores" : "Selecionar valor" }),
274
+ /* @__PURE__ */ c("div", { className: "relative", children: [
275
+ /* @__PURE__ */ r(Z, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
276
+ /* @__PURE__ */ r(
277
+ E,
278
+ {
279
+ type: "text",
280
+ placeholder: "Buscar...",
281
+ value: _,
282
+ onChange: (e) => O(e.target.value),
283
+ className: "h-9 pl-8",
284
+ autoFocus: !0
285
+ }
286
+ )
287
+ ] }),
288
+ /* @__PURE__ */ r("div", { className: "space-y-2 max-h-[320px] overflow-y-auto overflow-x-hidden", children: V.length === 0 ? /* @__PURE__ */ r("div", { className: "text-sm text-muted-foreground text-center py-4", children: "Nenhum resultado encontrado" }) : V.map((e) => {
289
+ if (e.isHeader && !e.selecionavel)
290
+ return /* @__PURE__ */ r(
291
+ "div",
288
292
  {
289
- htmlFor: `${a.id}-${e.value}`,
290
293
  title: e.label,
291
- className: N(
292
- "min-w-0 flex-1 cursor-pointer truncate text-sm",
293
- e.isHeader && "font-semibold uppercase tracking-wide"
294
- ),
294
+ className: "truncate pt-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",
295
295
  children: e.label
296
- }
297
- )
298
- ] }) : /* @__PURE__ */ r(
299
- c,
296
+ },
297
+ e.value
298
+ );
299
+ const t = v ? y.includes(e.value) : a.value === e.value;
300
+ return /* @__PURE__ */ r(
301
+ "div",
300
302
  {
301
- variant: "ghost",
302
- size: "sm",
303
- title: e.label,
304
- className: N(
305
- "w-full min-w-0 justify-start",
306
- e.isHeader && "font-semibold uppercase tracking-wide",
307
- t && "bg-muted"
303
+ className: S(
304
+ "flex min-w-0 items-center space-x-2",
305
+ e.isFilho && "pl-4"
308
306
  ),
309
- onClick: () => o({ value: e.value }),
310
- children: /* @__PURE__ */ r("span", { className: "truncate", children: e.label })
311
- }
312
- )
313
- },
314
- e.value
315
- );
316
- }) })
317
- ] })
318
- }
319
- )
320
- ] })
307
+ children: v ? /* @__PURE__ */ c(L, { children: [
308
+ /* @__PURE__ */ r(
309
+ ee,
310
+ {
311
+ id: `${a.id}-${e.value}`,
312
+ checked: t,
313
+ onCheckedChange: () => K(e.value)
314
+ }
315
+ ),
316
+ /* @__PURE__ */ r(
317
+ "label",
318
+ {
319
+ htmlFor: `${a.id}-${e.value}`,
320
+ title: e.label,
321
+ className: S(
322
+ "min-w-0 flex-1 cursor-pointer truncate text-sm",
323
+ e.isHeader && "font-semibold uppercase tracking-wide"
324
+ ),
325
+ children: e.label
326
+ }
327
+ )
328
+ ] }) : /* @__PURE__ */ r(
329
+ f,
330
+ {
331
+ variant: "ghost",
332
+ size: "sm",
333
+ title: e.label,
334
+ className: S(
335
+ "w-full min-w-0 justify-start",
336
+ e.isHeader && "font-semibold uppercase tracking-wide",
337
+ t && "bg-muted"
338
+ ),
339
+ onClick: () => u({ value: e.value }),
340
+ children: /* @__PURE__ */ r("span", { className: "truncate", children: e.label })
341
+ }
342
+ )
343
+ },
344
+ e.value
345
+ );
346
+ }) })
347
+ ] })
348
+ }
349
+ )
350
+ ]
351
+ }
352
+ )
321
353
  ) : (l == null ? void 0 : l.type) === "date" ? (
322
354
  // Date picker
323
355
  /* @__PURE__ */ r(
324
- K,
356
+ ae,
325
357
  {
326
358
  value: a.value ? /* @__PURE__ */ new Date(a.value + "T00:00:00") : void 0,
327
359
  onChange: (e) => {
328
360
  if (e) {
329
361
  const t = e.toISOString().split("T")[0];
330
- o({ value: t });
362
+ u({ value: t });
331
363
  } else
332
- o({ value: "" });
364
+ u({ value: "" });
333
365
  },
334
366
  placeholder: "Selecionar data",
335
367
  className: "h-7 text-sm"
@@ -337,9 +369,9 @@ function Z({
337
369
  )
338
370
  ) : (
339
371
  // Text/Number input
340
- /* @__PURE__ */ u(S, { children: [
341
- /* @__PURE__ */ r(_, { asChild: !0, children: /* @__PURE__ */ r(
342
- c,
372
+ /* @__PURE__ */ c(A, { children: [
373
+ /* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(
374
+ f,
343
375
  {
344
376
  variant: "ghost",
345
377
  size: "sm",
@@ -347,14 +379,14 @@ function Z({
347
379
  children: a.value || "Inserir valor"
348
380
  }
349
381
  ) }),
350
- /* @__PURE__ */ r(C, { className: "w-[240px] p-3", align: "start", children: /* @__PURE__ */ u("div", { className: "space-y-2", children: [
351
- /* @__PURE__ */ r(V, { className: "text-xs text-muted-foreground", children: "Inserir valor" }),
382
+ /* @__PURE__ */ r(k, { className: "w-[240px] p-3", align: "start", children: /* @__PURE__ */ c("div", { className: "space-y-2", children: [
383
+ /* @__PURE__ */ r(X, { className: "text-xs text-muted-foreground", children: "Inserir valor" }),
352
384
  /* @__PURE__ */ r(
353
- O,
385
+ E,
354
386
  {
355
387
  type: (l == null ? void 0 : l.type) === "number" ? "number" : "text",
356
388
  value: Array.isArray(a.value) ? "" : a.value,
357
- onChange: (e) => o({ value: e.target.value }),
389
+ onChange: (e) => u({ value: e.target.value }),
358
390
  placeholder: "Digite o valor...",
359
391
  autoFocus: !0
360
392
  }
@@ -362,11 +394,11 @@ function Z({
362
394
  ] }) })
363
395
  ] })
364
396
  ),
365
- s && x.length > 0 && /* @__PURE__ */ r("div", { className: "flex items-center gap-1 flex-wrap", children: x.map((e) => {
397
+ v && y.length > 0 && /* @__PURE__ */ r("div", { className: "flex items-center gap-1 flex-wrap", children: y.map((e) => {
366
398
  var n;
367
- const t = ((n = b.find((f) => f.value === e)) == null ? void 0 : n.label) || e;
368
- return /* @__PURE__ */ u(
369
- G,
399
+ const t = ((n = N.find((b) => b.value === e)) == null ? void 0 : n.label) || e;
400
+ return /* @__PURE__ */ c(
401
+ F,
370
402
  {
371
403
  variant: "secondary",
372
404
  className: "gap-1 h-6 text-xs",
@@ -376,10 +408,10 @@ function Z({
376
408
  "button",
377
409
  {
378
410
  type: "button",
379
- onClick: () => E(e),
411
+ onClick: () => Q(e),
380
412
  className: "ml-1 rounded-sm hover:bg-muted p-0.5 transition-colors",
381
413
  "aria-label": `Remover ${t}`,
382
- children: /* @__PURE__ */ r(L, { className: "h-3 w-3" })
414
+ children: /* @__PURE__ */ r(j, { className: "h-3 w-3" })
383
415
  }
384
416
  )
385
417
  ]
@@ -390,20 +422,20 @@ function Z({
390
422
  ] })
391
423
  ] }),
392
424
  /* @__PURE__ */ r(
393
- c,
425
+ f,
394
426
  {
395
427
  type: "button",
396
428
  variant: "ghost",
397
429
  size: "sm",
398
- onClick: P,
430
+ onClick: i,
399
431
  className: "h-9 w-9 p-0 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100 transition-opacity",
400
432
  "aria-label": "Remover condição",
401
- children: /* @__PURE__ */ r(L, { className: "h-4 w-4" })
433
+ children: /* @__PURE__ */ r(j, { className: "h-4 w-4" })
402
434
  }
403
435
  )
404
436
  ] });
405
437
  }
406
438
  export {
407
- ce as FilterBuilder
439
+ be as FilterBuilder
408
440
  };
409
441
  //# sourceMappingURL=filter-builder.js.map