laif-ds 0.2.42 → 0.2.44

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,5 +1,5 @@
1
1
  "use client";
2
- import { jsxs as f, jsx as r } from "react/jsx-runtime";
2
+ import { jsxs as f, jsx as n } from "react/jsx-runtime";
3
3
  import { useState as k } from "react";
4
4
  import { Button as b } from "../../../button.js";
5
5
  import { Icon as C } from "../../../icon.js";
@@ -20,20 +20,20 @@ function U({
20
20
  T(!1), u({ section: null, position: -1, itemId: null });
21
21
  }, A = (e) => {
22
22
  const t = e.currentTarget, i = Array.from(t.querySelectorAll("[data-column-item]")), o = e.clientY;
23
- for (let n = 0; n < i.length; n++) {
24
- const a = i[n].getBoundingClientRect(), l = a.top + a.height / 2;
23
+ for (let r = 0; r < i.length; r++) {
24
+ const a = i[r].getBoundingClientRect(), l = a.top + a.height / 2;
25
25
  if (o < l)
26
- return n;
26
+ return r;
27
27
  }
28
28
  return i.length;
29
29
  }, w = (e, t, i) => {
30
30
  const o = m?.getColumn?.(e);
31
31
  if (!o || D(o))
32
32
  return;
33
- const n = o.getIsVisible(), s = t === "visible" ? g : N;
33
+ const r = o.getIsVisible(), s = t === "visible" ? g : N;
34
34
  if (t === "visible" && i === 0)
35
35
  return;
36
- (t === "visible" && !n || t === "hidden" && n) && o.toggleVisibility(t === "visible");
36
+ (t === "visible" && !r || t === "hidden" && r) && o.toggleVisibility(t === "visible");
37
37
  const a = V(), l = s.map(d), p = a.indexOf(e);
38
38
  if (p === -1) return;
39
39
  const h = [...a];
@@ -49,7 +49,7 @@ function U({
49
49
  h.splice(v, 0, e), m.setColumnOrder(h);
50
50
  }, S = (e, t, i, o) => {
51
51
  e.preventDefault(), e.stopPropagation(), e.dataTransfer.dropEffect = "move";
52
- const n = e.currentTarget.getBoundingClientRect(), s = e.clientY, a = n.top + n.height / 2, l = s < a ? o : o + 1;
52
+ const r = e.currentTarget.getBoundingClientRect(), s = e.clientY, a = r.top + r.height / 2, l = s < a ? o : o + 1;
53
53
  u({
54
54
  section: t,
55
55
  position: l,
@@ -80,7 +80,7 @@ function U({
80
80
  return i !== void 0 ? i : Number.MAX_SAFE_INTEGER;
81
81
  }, g = [...L].filter((e) => !D(e)).sort((e, t) => y(d(e)) - y(d(t))), N = [...Y].filter((e) => !D(e)).sort((e, t) => y(d(e)) - y(d(t)));
82
82
  return /* @__PURE__ */ f(R, { children: [
83
- /* @__PURE__ */ r(H, { asChild: !0, children: /* @__PURE__ */ r(
83
+ /* @__PURE__ */ n(H, { asChild: !0, children: /* @__PURE__ */ n(
84
84
  b,
85
85
  {
86
86
  className: "h-6 w-6",
@@ -89,7 +89,7 @@ function U({
89
89
  variant: "ghost"
90
90
  }
91
91
  ) }),
92
- /* @__PURE__ */ f(K, { className: "flex flex-col gap-2 px-3 py-2", children: [
92
+ /* @__PURE__ */ f(K, { className: "flex flex-col gap-2 px-3 py-2", align: "end", children: [
93
93
  g.length > 0 && /* @__PURE__ */ f(
94
94
  "div",
95
95
  {
@@ -98,8 +98,8 @@ function U({
98
98
  onDrop: M("visible"),
99
99
  children: [
100
100
  /* @__PURE__ */ f("div", { className: "flex flex-row items-center justify-between gap-2", children: [
101
- /* @__PURE__ */ r("div", { className: "text-d-foreground text-sm", children: x.columnVisibility.visibleColumns }),
102
- /* @__PURE__ */ r(
101
+ /* @__PURE__ */ n("div", { className: "text-d-foreground text-sm", children: x.columnVisibility.visibleColumns }),
102
+ /* @__PURE__ */ n(
103
103
  b,
104
104
  {
105
105
  variant: "ghost",
@@ -109,8 +109,8 @@ function U({
109
109
  m.setColumnVisibility(() => {
110
110
  const e = [...g, ...N], t = d(g[0] ?? e[0]);
111
111
  return e.reduce(
112
- (o, n) => {
113
- const s = d(n);
112
+ (o, r) => {
113
+ const s = d(r);
114
114
  return s && (o[s] = s === t), o;
115
115
  },
116
116
  {}
@@ -121,17 +121,17 @@ function U({
121
121
  }
122
122
  )
123
123
  ] }),
124
- /* @__PURE__ */ r("div", { className: "border-d-border flex min-h-0 flex-1 flex-col overflow-y-auto border-b", children: g.map((e, t) => {
125
- const i = d(e), o = t === 0, n = D(e), s = c.section === "visible" && c.position === t && t > 0, a = c.section === "visible" && c.position === t + 1;
124
+ /* @__PURE__ */ n("div", { className: "border-d-border flex min-h-0 flex-1 flex-col overflow-y-auto border-b", children: g.map((e, t) => {
125
+ const i = d(e), o = t === 0, r = D(e), s = c.section === "visible" && c.position === t && t > 0, a = c.section === "visible" && c.position === t + 1;
126
126
  return /* @__PURE__ */ f("div", { className: "relative", children: [
127
- s && /* @__PURE__ */ r("div", { className: "bg-d-primary absolute -top-1 right-0 left-0 z-10 h-0.5 rounded-full" }),
128
- /* @__PURE__ */ r(
127
+ s && /* @__PURE__ */ n("div", { className: "bg-d-primary absolute -top-1 right-0 left-0 z-10 h-0.5 rounded-full" }),
128
+ /* @__PURE__ */ n(
129
129
  "div",
130
130
  {
131
131
  "data-column-item": !0,
132
- draggable: !o && !n,
132
+ draggable: !o && !r,
133
133
  onDragStart: (l) => {
134
- if (o || n) {
134
+ if (o || r) {
135
135
  l.preventDefault();
136
136
  return;
137
137
  }
@@ -158,19 +158,19 @@ function U({
158
158
  itemId: null
159
159
  });
160
160
  },
161
- className: `rounded transition-all duration-150 ${o || n ? "cursor-not-allowed opacity-60" : O && c.itemId === i ? "scale-95 opacity-50" : "hover:bg-d-foreground/5"}`,
162
- children: /* @__PURE__ */ r(
161
+ className: `rounded transition-all duration-150 ${o || r ? "cursor-not-allowed opacity-60" : O && c.itemId === i ? "scale-95 opacity-50" : "hover:bg-d-foreground/5"}`,
162
+ children: /* @__PURE__ */ n(
163
163
  b,
164
164
  {
165
165
  variant: "ghost",
166
166
  className: "w-full cursor-grab justify-start",
167
167
  iconLeft: "GripVertical",
168
168
  onClick: () => {
169
- n || e.toggleVisibility();
169
+ r || e.toggleVisibility();
170
170
  },
171
- disabled: i === d(g[0]) || n,
171
+ disabled: i === d(g[0]) || r,
172
172
  children: /* @__PURE__ */ f("div", { className: "flex w-full flex-row items-center justify-between gap-1", children: [
173
- /* @__PURE__ */ r(
173
+ /* @__PURE__ */ n(
174
174
  C,
175
175
  {
176
176
  name: z(
@@ -179,15 +179,15 @@ function U({
179
179
  className: "h-4 w-4"
180
180
  }
181
181
  ),
182
- /* @__PURE__ */ r("div", { className: "flex flex-1", children: e.columnDef.header?.toString() }),
183
- /* @__PURE__ */ r(C, { name: "Eye" })
182
+ /* @__PURE__ */ n("div", { className: "flex flex-1", children: e.columnDef.header?.toString() }),
183
+ /* @__PURE__ */ n(C, { name: "Eye" })
184
184
  ] })
185
185
  },
186
186
  i
187
187
  )
188
188
  }
189
189
  ),
190
- a && /* @__PURE__ */ r("div", { className: "bg-d-primary absolute right-0 -bottom-1 left-0 z-10 h-0.5 rounded-full" })
190
+ a && /* @__PURE__ */ n("div", { className: "bg-d-primary absolute right-0 -bottom-1 left-0 z-10 h-0.5 rounded-full" })
191
191
  ] }, i);
192
192
  }) })
193
193
  ]
@@ -201,8 +201,8 @@ function U({
201
201
  onDrop: M("hidden"),
202
202
  children: [
203
203
  /* @__PURE__ */ f("div", { className: "flex flex-row items-center justify-between gap-2", children: [
204
- /* @__PURE__ */ r("div", { className: "text-d-foreground text-sm", children: x.columnVisibility.hiddenColumns }),
205
- /* @__PURE__ */ r(
204
+ /* @__PURE__ */ n("div", { className: "text-d-foreground text-sm", children: x.columnVisibility.hiddenColumns }),
205
+ /* @__PURE__ */ n(
206
206
  b,
207
207
  {
208
208
  variant: "ghost",
@@ -213,11 +213,11 @@ function U({
213
213
  }
214
214
  )
215
215
  ] }),
216
- /* @__PURE__ */ r("div", { className: "border-d-border flex min-h-0 flex-1 flex-col overflow-y-auto border-b", children: N.map((e, t) => {
217
- const i = d(e), o = c.section === "hidden" && c.position === t, n = c.section === "hidden" && c.position === t + 1;
216
+ /* @__PURE__ */ n("div", { className: "border-d-border flex min-h-0 flex-1 flex-col overflow-y-auto border-b", children: N.map((e, t) => {
217
+ const i = d(e), o = c.section === "hidden" && c.position === t, r = c.section === "hidden" && c.position === t + 1;
218
218
  return /* @__PURE__ */ f("div", { className: "relative", children: [
219
- o && /* @__PURE__ */ r("div", { className: "bg-d-primary absolute -top-1 right-0 left-0 z-10 h-0.5 rounded-full" }),
220
- /* @__PURE__ */ r(
219
+ o && /* @__PURE__ */ n("div", { className: "bg-d-primary absolute -top-1 right-0 left-0 z-10 h-0.5 rounded-full" }),
220
+ /* @__PURE__ */ n(
221
221
  "div",
222
222
  {
223
223
  "data-column-item": !0,
@@ -235,7 +235,7 @@ function U({
235
235
  });
236
236
  },
237
237
  className: `rounded transition-all duration-150 ${O && c.itemId === i ? "scale-95 opacity-50" : "hover:bg-d-foreground/5"}`,
238
- children: /* @__PURE__ */ r(
238
+ children: /* @__PURE__ */ n(
239
239
  b,
240
240
  {
241
241
  variant: "ghost",
@@ -243,7 +243,7 @@ function U({
243
243
  iconLeft: "GripVertical",
244
244
  onClick: () => e.toggleVisibility(),
245
245
  children: /* @__PURE__ */ f("div", { className: "flex w-full flex-row items-center justify-between gap-1", children: [
246
- /* @__PURE__ */ r(
246
+ /* @__PURE__ */ n(
247
247
  C,
248
248
  {
249
249
  name: z(
@@ -252,15 +252,15 @@ function U({
252
252
  className: "h-4 w-4"
253
253
  }
254
254
  ),
255
- /* @__PURE__ */ r("div", { className: "flex flex-1", children: e.columnDef.header?.toString() }),
256
- /* @__PURE__ */ r(C, { name: "EyeOff" })
255
+ /* @__PURE__ */ n("div", { className: "flex flex-1", children: e.columnDef.header?.toString() }),
256
+ /* @__PURE__ */ n(C, { name: "EyeOff" })
257
257
  ] })
258
258
  },
259
259
  i
260
260
  )
261
261
  }
262
262
  ),
263
- n && /* @__PURE__ */ r("div", { className: "bg-d-primary absolute right-0 -bottom-1 left-0 z-10 h-0.5 rounded-full" })
263
+ r && /* @__PURE__ */ n("div", { className: "bg-d-primary absolute right-0 -bottom-1 left-0 z-10 h-0.5 rounded-full" })
264
264
  ] }, i);
265
265
  }) })
266
266
  ]
@@ -110,7 +110,7 @@ function se({
110
110
  ]
111
111
  }
112
112
  ) }),
113
- /* @__PURE__ */ o(D, { className: "w-[800px]", children: /* @__PURE__ */ o(
113
+ /* @__PURE__ */ o(D, { className: "w-[800px]", align: "start", children: /* @__PURE__ */ o(
114
114
  R,
115
115
  {
116
116
  columns: h,
@@ -145,7 +145,7 @@ function se({
145
145
  ]
146
146
  }
147
147
  ) }),
148
- /* @__PURE__ */ p(D, { children: [
148
+ /* @__PURE__ */ p(D, { align: "start", children: [
149
149
  e.columnType === "string" && /* @__PURE__ */ o(
150
150
  z,
151
151
  {
@@ -240,7 +240,7 @@ function se({
240
240
  ]
241
241
  }
242
242
  ) }),
243
- /* @__PURE__ */ p(D, { className: "p-2", children: [
243
+ /* @__PURE__ */ p(D, { className: "p-2", align: "start", children: [
244
244
  /* @__PURE__ */ o(
245
245
  E,
246
246
  {
@@ -12,7 +12,9 @@ function P({
12
12
  debounceMs: d = 300,
13
13
  initialValue: t
14
14
  }) {
15
- const [c, s] = p(t || ""), [f, a] = p(!!(t && t.length > 0)), S = "search_input_" + Math.random().toString(36).substring(2, 9), h = x(null), n = x(null);
15
+ const [c, s] = p(t || ""), [f, a] = p(
16
+ !!(t && t.length > 0)
17
+ ), S = "search_input_" + Math.random().toString(36).substring(2, 9), h = x(null), n = x(null);
16
18
  v(() => {
17
19
  t && t.length > 0 ? (s(t), a(!0)) : (t === "" || t === void 0) && (s(""), a(!1));
18
20
  }, [t]), v(() => (u && (n.current && clearTimeout(n.current), n.current = setTimeout(() => {
@@ -54,6 +56,7 @@ function P({
54
56
  {
55
57
  className: "flex max-h-24 min-h-0 flex-col gap-0 px-2 py-1.5",
56
58
  variant: "card",
59
+ align: "end",
57
60
  children: [
58
61
  /* @__PURE__ */ o("div", { className: "text-d-foreground/90 text-xs", children: i.searchTooltipLabel }),
59
62
  /* @__PURE__ */ o("ul", { className: "flex flex-col gap-0 overflow-auto", children: b.map((e) => /* @__PURE__ */ l("li", { className: "text-d-foreground/75 text-xs", children: [
@@ -1,58 +1,58 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
+ import { jsxs as a, jsx as l } from "react/jsx-runtime";
3
3
  import { AppSelect as h } from "../../../app-select.js";
4
4
  import { Badge as S } from "../../../badge.js";
5
5
  import { Button as f } from "../../../button.js";
6
6
  import { Icon as z } from "../../../icon.js";
7
7
  import { Popover as C, PopoverTrigger as k, PopoverContent as A } from "../../../popover.js";
8
8
  function T({
9
- table: a,
9
+ table: c,
10
10
  sortedColumns: g = [],
11
11
  sortableColumns: d,
12
- i18n: l,
12
+ i18n: o,
13
13
  maxSortedColumns: m = 3
14
14
  }) {
15
- const r = a.getState().sorting || [], p = new Set(r.map((n) => n.id)), u = (n, t) => {
15
+ const r = c.getState().sorting || [], p = new Set(r.map((n) => n.id)), u = (n, t) => {
16
16
  const e = r[n], s = r.map(
17
17
  (i, N) => N === n ? { id: t, desc: e?.desc ?? !1 } : i
18
18
  );
19
- a.setSorting(s);
19
+ c.setSorting(s);
20
20
  }, x = (n, t) => {
21
21
  const e = r.map(
22
22
  (s, i) => i === n ? { ...s, desc: t === "desc" } : s
23
23
  );
24
- a.setSorting(e);
24
+ c.setSorting(e);
25
25
  }, v = () => {
26
26
  if (r.length >= m) return;
27
27
  const n = new Set(r.map((i) => i.id)), e = (d.find((i) => !n.has(i.column.id)) ?? d[0])?.column.id;
28
28
  if (!e) return;
29
29
  const s = [...r, { id: e, desc: !1 }];
30
- a.setSorting(s);
30
+ c.setSorting(s);
31
31
  }, w = (n) => {
32
32
  const t = r.filter((e, s) => s !== n);
33
- a.setSorting(t);
33
+ c.setSorting(t);
34
34
  };
35
- return /* @__PURE__ */ c(C, { children: [
36
- /* @__PURE__ */ o(k, { asChild: !0, children: /* @__PURE__ */ c(
35
+ return /* @__PURE__ */ a(C, { children: [
36
+ /* @__PURE__ */ l(k, { asChild: !0, children: /* @__PURE__ */ a(
37
37
  S,
38
38
  {
39
39
  variant: g.length > 0 ? "default" : "ghost",
40
40
  className: "hover:border-d-border cursor-pointer hover:border",
41
41
  children: [
42
- /* @__PURE__ */ o(z, { name: "ArrowUpDown" }),
43
- l.sorting.sort
42
+ /* @__PURE__ */ l(z, { name: "ArrowUpDown" }),
43
+ o.sorting.sort
44
44
  ]
45
45
  }
46
46
  ) }),
47
- /* @__PURE__ */ c(A, { className: "flex w-[400px] flex-col gap-2", children: [
48
- /* @__PURE__ */ o("div", { className: "text-d-foreground text-md font-semibold", children: l.sorting.sorting }),
49
- g.length > 0 && /* @__PURE__ */ c("div", { className: "flex flex-col gap-2", children: [
50
- /* @__PURE__ */ c("div", { className: "flex w-full flex-row gap-1 pr-9 text-sm", children: [
51
- /* @__PURE__ */ o("div", { className: "flex flex-1", children: l.sorting.column }),
52
- /* @__PURE__ */ o("div", { className: "flex flex-1", children: l.sorting.order })
47
+ /* @__PURE__ */ a(A, { className: "flex w-[400px] flex-col gap-2", align: "start", children: [
48
+ /* @__PURE__ */ l("div", { className: "text-d-foreground text-md font-semibold", children: o.sorting.sorting }),
49
+ g.length > 0 && /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
50
+ /* @__PURE__ */ a("div", { className: "flex w-full flex-row gap-1 pr-9 text-sm", children: [
51
+ /* @__PURE__ */ l("div", { className: "flex flex-1", children: o.sorting.column }),
52
+ /* @__PURE__ */ l("div", { className: "flex flex-1", children: o.sorting.order })
53
53
  ] }),
54
- g.map((n, t) => /* @__PURE__ */ c("div", { className: "flex w-full flex-row items-end gap-1", children: [
55
- /* @__PURE__ */ o(
54
+ g.map((n, t) => /* @__PURE__ */ a("div", { className: "flex w-full flex-row items-end gap-1", children: [
55
+ /* @__PURE__ */ l(
56
56
  h,
57
57
  {
58
58
  size: "sm",
@@ -70,14 +70,14 @@ function T({
70
70
  }
71
71
  }
72
72
  ),
73
- /* @__PURE__ */ o(
73
+ /* @__PURE__ */ l(
74
74
  h,
75
75
  {
76
76
  size: "sm",
77
77
  wrpClassName: "flex flex-1",
78
78
  options: [
79
- { value: "asc", label: l.sorting.ascending },
80
- { value: "desc", label: l.sorting.descending }
79
+ { value: "asc", label: o.sorting.ascending },
80
+ { value: "desc", label: o.sorting.descending }
81
81
  ],
82
82
  value: r?.[t]?.desc ? "desc" : "asc",
83
83
  onValueChange: (e) => {
@@ -85,7 +85,7 @@ function T({
85
85
  }
86
86
  }
87
87
  ),
88
- /* @__PURE__ */ o(
88
+ /* @__PURE__ */ l(
89
89
  f,
90
90
  {
91
91
  variant: "ghost-destructive",
@@ -96,19 +96,19 @@ function T({
96
96
  )
97
97
  ] }, t))
98
98
  ] }),
99
- /* @__PURE__ */ c("div", { className: "flex w-full gap-2", children: [
100
- /* @__PURE__ */ o(
99
+ /* @__PURE__ */ a("div", { className: "flex w-full gap-2", children: [
100
+ /* @__PURE__ */ l(
101
101
  f,
102
102
  {
103
103
  className: "flex flex-1",
104
104
  variant: "ghost-destructive",
105
105
  size: "sm",
106
- onClick: () => a.resetSorting(),
106
+ onClick: () => c.resetSorting(),
107
107
  disabled: r.length === 0 || d.length === 0,
108
- children: l.sorting.resetSorting
108
+ children: o.sorting.resetSorting
109
109
  }
110
110
  ),
111
- /* @__PURE__ */ o(
111
+ /* @__PURE__ */ l(
112
112
  f,
113
113
  {
114
114
  className: "flex flex-1",
@@ -116,7 +116,7 @@ function T({
116
116
  size: "sm",
117
117
  onClick: v,
118
118
  disabled: d.length === 0 || r.length >= m,
119
- children: l.sorting.addSort
119
+ children: o.sorting.addSort
120
120
  }
121
121
  )
122
122
  ] })