asterui 0.12.25 → 0.12.27

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.
Files changed (167) hide show
  1. package/dist/components/Cascader.d.ts +2 -0
  2. package/dist/components/Descriptions.d.ts +35 -3
  3. package/dist/components/Empty.d.ts +10 -1
  4. package/dist/components/Image.d.ts +13 -1
  5. package/dist/components/List.d.ts +74 -8
  6. package/dist/components/Table.d.ts +64 -10
  7. package/dist/components/Tag.d.ts +16 -4
  8. package/dist/components/Timeline.d.ts +62 -7
  9. package/dist/components/Tree.d.ts +2 -0
  10. package/dist/index.d.ts +6 -8
  11. package/dist/index.js +151 -152
  12. package/dist/index.js.map +1 -1
  13. package/dist/index10.js +1 -1
  14. package/dist/index100.js +5 -32
  15. package/dist/index100.js.map +1 -1
  16. package/dist/index101.js +13 -5
  17. package/dist/index101.js.map +1 -1
  18. package/dist/index102.js +43 -11
  19. package/dist/index102.js.map +1 -1
  20. package/dist/index103.js +11 -44
  21. package/dist/index103.js.map +1 -1
  22. package/dist/index104.js +12 -10
  23. package/dist/index104.js.map +1 -1
  24. package/dist/index105.js +7 -14
  25. package/dist/index105.js.map +1 -1
  26. package/dist/index106.js +12 -7
  27. package/dist/index106.js.map +1 -1
  28. package/dist/index107.js +29 -11
  29. package/dist/index107.js.map +1 -1
  30. package/dist/index108.js +16 -29
  31. package/dist/index108.js.map +1 -1
  32. package/dist/index109.js +31 -16
  33. package/dist/index109.js.map +1 -1
  34. package/dist/index110.js +517 -30
  35. package/dist/index110.js.map +1 -1
  36. package/dist/index111.js +45 -515
  37. package/dist/index111.js.map +1 -1
  38. package/dist/index15.js.map +1 -1
  39. package/dist/index22.js +1 -1
  40. package/dist/index23.js +127 -93
  41. package/dist/index23.js.map +1 -1
  42. package/dist/index39.js +162 -115
  43. package/dist/index39.js.map +1 -1
  44. package/dist/index40.js +398 -40
  45. package/dist/index40.js.map +1 -1
  46. package/dist/index41.js +132 -389
  47. package/dist/index41.js.map +1 -1
  48. package/dist/index42.js +252 -91
  49. package/dist/index42.js.map +1 -1
  50. package/dist/index43.js +143 -247
  51. package/dist/index43.js.map +1 -1
  52. package/dist/index44.js +15 -154
  53. package/dist/index44.js.map +1 -1
  54. package/dist/index45.js +17 -15
  55. package/dist/index45.js.map +1 -1
  56. package/dist/index46.js +136 -16
  57. package/dist/index46.js.map +1 -1
  58. package/dist/index47.js +118 -133
  59. package/dist/index47.js.map +1 -1
  60. package/dist/index48.js +35 -13
  61. package/dist/index48.js.map +1 -1
  62. package/dist/index49.js +34 -35
  63. package/dist/index49.js.map +1 -1
  64. package/dist/index50.js +81 -34
  65. package/dist/index50.js.map +1 -1
  66. package/dist/index51.js +166 -71
  67. package/dist/index51.js.map +1 -1
  68. package/dist/index52.js +144 -167
  69. package/dist/index52.js.map +1 -1
  70. package/dist/index53.js +11 -152
  71. package/dist/index53.js.map +1 -1
  72. package/dist/index54.js +55 -10
  73. package/dist/index54.js.map +1 -1
  74. package/dist/index55.js +12 -55
  75. package/dist/index55.js.map +1 -1
  76. package/dist/index56.js +7 -14
  77. package/dist/index56.js.map +1 -1
  78. package/dist/index57.js +333 -6
  79. package/dist/index57.js.map +1 -1
  80. package/dist/index58.js +47 -334
  81. package/dist/index58.js.map +1 -1
  82. package/dist/index59.js +122 -47
  83. package/dist/index59.js.map +1 -1
  84. package/dist/index60.js +108 -120
  85. package/dist/index60.js.map +1 -1
  86. package/dist/index61.js +167 -107
  87. package/dist/index61.js.map +1 -1
  88. package/dist/index62.js +29 -167
  89. package/dist/index62.js.map +1 -1
  90. package/dist/index63.js +120 -30
  91. package/dist/index63.js.map +1 -1
  92. package/dist/index64.js +80 -116
  93. package/dist/index64.js.map +1 -1
  94. package/dist/index65.js +19 -85
  95. package/dist/index65.js.map +1 -1
  96. package/dist/index66.js +73 -19
  97. package/dist/index66.js.map +1 -1
  98. package/dist/index67.js +54 -71
  99. package/dist/index67.js.map +1 -1
  100. package/dist/index68.js +44 -56
  101. package/dist/index68.js.map +1 -1
  102. package/dist/index69.js +49 -42
  103. package/dist/index69.js.map +1 -1
  104. package/dist/index70.js +121 -50
  105. package/dist/index70.js.map +1 -1
  106. package/dist/index71.js +102 -118
  107. package/dist/index71.js.map +1 -1
  108. package/dist/index72.js +72 -105
  109. package/dist/index72.js.map +1 -1
  110. package/dist/index73.js +67 -73
  111. package/dist/index73.js.map +1 -1
  112. package/dist/index74.js +19 -66
  113. package/dist/index74.js.map +1 -1
  114. package/dist/index75.js +55 -18
  115. package/dist/index75.js.map +1 -1
  116. package/dist/index76.js +251 -55
  117. package/dist/index76.js.map +1 -1
  118. package/dist/index77.js +22 -254
  119. package/dist/index77.js.map +1 -1
  120. package/dist/index78.js +31 -22
  121. package/dist/index78.js.map +1 -1
  122. package/dist/index79.js +93 -30
  123. package/dist/index79.js.map +1 -1
  124. package/dist/index80.js +626 -86
  125. package/dist/index80.js.map +1 -1
  126. package/dist/index81.js +73 -322
  127. package/dist/index81.js.map +1 -1
  128. package/dist/index82.js +39 -79
  129. package/dist/index82.js.map +1 -1
  130. package/dist/index83.js +23 -40
  131. package/dist/index83.js.map +1 -1
  132. package/dist/index84.js +207 -23
  133. package/dist/index84.js.map +1 -1
  134. package/dist/index85.js +149 -122
  135. package/dist/index85.js.map +1 -1
  136. package/dist/index86.js +152 -147
  137. package/dist/index86.js.map +1 -1
  138. package/dist/index87.js +143 -156
  139. package/dist/index87.js.map +1 -1
  140. package/dist/index88.js +35 -65
  141. package/dist/index88.js.map +1 -1
  142. package/dist/index89.js +234 -35
  143. package/dist/index89.js.map +1 -1
  144. package/dist/index90.js +31 -231
  145. package/dist/index90.js.map +1 -1
  146. package/dist/index91.js +210 -34
  147. package/dist/index91.js.map +1 -1
  148. package/dist/index92.js +418 -187
  149. package/dist/index92.js.map +1 -1
  150. package/dist/index93.js +686 -376
  151. package/dist/index93.js.map +1 -1
  152. package/dist/index94.js +165 -738
  153. package/dist/index94.js.map +1 -1
  154. package/dist/index95.js +253 -173
  155. package/dist/index95.js.map +1 -1
  156. package/dist/index96.js +64 -256
  157. package/dist/index96.js.map +1 -1
  158. package/dist/index97.js +121 -61
  159. package/dist/index97.js.map +1 -1
  160. package/dist/index98.js +14 -126
  161. package/dist/index98.js.map +1 -1
  162. package/dist/index99.js +31 -12
  163. package/dist/index99.js.map +1 -1
  164. package/package.json +1 -1
  165. package/dist/components/Indicator.d.ts +0 -7
  166. package/dist/index112.js +0 -53
  167. package/dist/index112.js.map +0 -1
package/dist/index80.js CHANGED
@@ -1,97 +1,637 @@
1
- import { jsx as a, jsxs as b } from "react/jsx-runtime";
2
- import y from "react";
3
- const j = {
4
- neutral: "step-neutral",
5
- primary: "step-primary",
6
- secondary: "step-secondary",
7
- accent: "step-accent",
8
- info: "step-info",
9
- success: "step-success",
10
- warning: "step-warning",
11
- error: "step-error"
1
+ import { jsx as a, jsxs as m } from "react/jsx-runtime";
2
+ import Ge, { forwardRef as Je, useState as I, useMemo as W, useCallback as S, useId as Qe } from "react";
3
+ const qe = {
4
+ xs: "table-xs",
5
+ sm: "table-sm",
6
+ md: "",
7
+ lg: "table-lg",
8
+ xl: "table-xl"
12
9
  };
13
- function N({
14
- children: i,
15
- items: l,
16
- current: e,
17
- direction: p,
18
- vertical: d = !1,
19
- onChange: t,
20
- className: c = "",
21
- ...f
10
+ function Xe({
11
+ filters: d,
12
+ selectedValues: k,
13
+ onChange: K,
14
+ locale: H,
15
+ testId: F
22
16
  }) {
23
- const n = ["steps", (p === "vertical" || d) && "steps-vertical", c].filter(Boolean).join(" ");
24
- if (l && l.length > 0)
25
- return /* @__PURE__ */ a("ul", { className: n, ...f, children: l.map((s, o) => {
26
- const C = e !== void 0 && o < e, r = e !== void 0 && o === e, v = s.color || (C || r ? "primary" : void 0);
27
- return /* @__PURE__ */ a(
28
- k,
29
- {
30
- color: v,
31
- icon: s.icon,
32
- title: s.title,
33
- description: s.description,
34
- disabled: s.disabled,
35
- _index: o,
36
- _clickable: !!t && !s.disabled,
37
- _onClick: t,
38
- "aria-current": r ? "step" : void 0
39
- },
40
- s.key ?? o
41
- );
42
- }) });
43
- const u = e !== void 0 ? y.Children.map(i, (s, o) => {
44
- if (y.isValidElement(s)) {
45
- const C = o < e, r = o === e, v = s.props.color || (C || r ? "primary" : void 0);
46
- return y.cloneElement(s, {
47
- color: v,
48
- _index: o,
49
- _clickable: !!t && !s.props.disabled,
50
- _onClick: t,
51
- "aria-current": r ? "step" : void 0
52
- });
53
- }
54
- return s;
55
- }) : i;
56
- return /* @__PURE__ */ a("ul", { className: n, ...f, children: u });
17
+ const [V, B] = I(!1), A = Qe(), _ = (i) => {
18
+ const y = k.includes(i) ? k.filter((w) => w !== i) : [...k, i];
19
+ K(y);
20
+ }, U = () => {
21
+ K([]), B(!1);
22
+ };
23
+ return /* @__PURE__ */ m("div", { className: "dropdown dropdown-end", onKeyDown: (i) => {
24
+ i.key === "Escape" && B(!1);
25
+ }, children: [
26
+ /* @__PURE__ */ a(
27
+ "button",
28
+ {
29
+ type: "button",
30
+ className: `btn btn-ghost btn-xs ${k.length > 0 ? "text-primary" : ""}`,
31
+ onClick: () => B(!V),
32
+ "aria-label": "Filter column",
33
+ "aria-expanded": V,
34
+ "aria-haspopup": "listbox",
35
+ "aria-controls": A,
36
+ "data-testid": `${F}-filter-button`,
37
+ children: /* @__PURE__ */ a("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" }) })
38
+ }
39
+ ),
40
+ V && /* @__PURE__ */ m(
41
+ "div",
42
+ {
43
+ id: A,
44
+ role: "listbox",
45
+ "aria-multiselectable": "true",
46
+ className: "dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52 border border-base-content/10",
47
+ "data-testid": `${F}-filter-dropdown`,
48
+ children: [
49
+ /* @__PURE__ */ a("div", { className: "space-y-2", children: d.map((i) => /* @__PURE__ */ m(
50
+ "label",
51
+ {
52
+ className: "flex items-center gap-2 cursor-pointer p-2 hover:bg-base-200 rounded",
53
+ role: "option",
54
+ "aria-selected": k.includes(i.value),
55
+ children: [
56
+ /* @__PURE__ */ a(
57
+ "input",
58
+ {
59
+ type: "checkbox",
60
+ className: "checkbox checkbox-xs checkbox-primary",
61
+ checked: k.includes(i.value),
62
+ onChange: () => _(i.value),
63
+ "data-testid": `${F}-filter-${String(i.value)}`
64
+ }
65
+ ),
66
+ /* @__PURE__ */ a("span", { className: "text-sm", children: i.text })
67
+ ]
68
+ },
69
+ String(i.value)
70
+ )) }),
71
+ /* @__PURE__ */ a("div", { className: "divider my-1" }),
72
+ /* @__PURE__ */ a(
73
+ "button",
74
+ {
75
+ type: "button",
76
+ className: "btn btn-ghost btn-xs w-full",
77
+ onClick: U,
78
+ "data-testid": `${F}-filter-reset`,
79
+ children: H?.filterReset ?? "Clear"
80
+ }
81
+ )
82
+ ]
83
+ }
84
+ )
85
+ ] });
57
86
  }
58
- function k({
59
- children: i,
60
- title: l,
61
- description: e,
62
- icon: p,
63
- color: d,
64
- dataContent: t,
65
- disabled: c = !1,
66
- className: f = "",
67
- _index: m,
68
- _clickable: n,
69
- _onClick: u,
70
- ...s
71
- }) {
72
- const o = ["step", d && j[d], c && "step-disabled", f].filter(Boolean).join(" ");
73
- return /* @__PURE__ */ b(
74
- "li",
87
+ function Ye({ expanded: d, onExpand: k }) {
88
+ return /* @__PURE__ */ a(
89
+ "button",
75
90
  {
76
- className: o,
77
- "data-content": t,
78
- onClick: () => {
79
- n && u && m !== void 0 && !c && u(m);
91
+ type: "button",
92
+ className: "btn btn-ghost btn-xs btn-square",
93
+ onClick: (K) => {
94
+ K.stopPropagation(), k();
80
95
  },
81
- style: n && !c ? { cursor: "pointer" } : void 0,
82
- ...s,
83
- children: [
84
- p && /* @__PURE__ */ a("span", { className: "step-icon", children: p }),
85
- l ?? i,
86
- e && /* @__PURE__ */ a("span", { className: "text-xs opacity-70 block", children: e })
87
- ]
96
+ "aria-label": d ? "Collapse row" : "Expand row",
97
+ "aria-expanded": d,
98
+ children: /* @__PURE__ */ a(
99
+ "svg",
100
+ {
101
+ className: `w-4 h-4 transition-transform ${d ? "rotate-90" : ""}`,
102
+ fill: "none",
103
+ stroke: "currentColor",
104
+ viewBox: "0 0 24 24",
105
+ "aria-hidden": "true",
106
+ children: /* @__PURE__ */ a("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
107
+ }
108
+ )
88
109
  }
89
110
  );
90
111
  }
91
- const S = Object.assign(N, {
92
- Step: k
93
- });
112
+ function He({
113
+ columns: d,
114
+ dataSource: k,
115
+ rowKey: K = "id",
116
+ loading: H = !1,
117
+ size: F = "md",
118
+ bordered: V = !1,
119
+ hoverable: B = !0,
120
+ striped: A = !1,
121
+ pinRows: _ = !1,
122
+ pinCols: U = !1,
123
+ pagination: o,
124
+ rowSelection: i,
125
+ expandable: y,
126
+ scroll: w,
127
+ className: ge = "",
128
+ onRow: me,
129
+ onChange: z,
130
+ onSortChange: le,
131
+ onFilterChange: ie,
132
+ locale: Z,
133
+ "data-testid": ve,
134
+ "aria-label": ke,
135
+ ...we
136
+ }, Ce) {
137
+ const p = ve ?? "table", Ne = 10, [N, G] = I(
138
+ o !== !1 && o?.current ? o.current : 1
139
+ ), [$e, Se] = I(
140
+ o !== !1 && o?.pageSize ? o.pageSize : Ne
141
+ ), C = o !== !1 && o?.pageSize !== void 0 ? o.pageSize : $e, [oe, Ke] = I(() => {
142
+ const e = d.find((s) => s.sortOrder !== void 0);
143
+ if (e)
144
+ return {
145
+ columnKey: e.key,
146
+ order: e.sortOrder ?? null
147
+ };
148
+ const t = d.find((s) => s.defaultSortOrder);
149
+ return {
150
+ columnKey: t?.key || null,
151
+ order: t?.defaultSortOrder || null
152
+ };
153
+ }), [de, ze] = I(() => {
154
+ const e = {};
155
+ return d.forEach((t) => {
156
+ t.filteredValue !== void 0 ? e[t.key] = t.filteredValue : t.defaultFilteredValue && (e[t.key] = t.defaultFilteredValue);
157
+ }), e;
158
+ }), [Ee, ee] = I(
159
+ i?.selectedRowKeys || []
160
+ ), [Re, je] = I(
161
+ y?.expandedRowKeys ?? y?.defaultExpandedRowKeys ?? []
162
+ ), J = d.some((e) => e.sortOrder !== void 0), Q = d.some((e) => e.filteredValue !== void 0), te = y?.expandedRowKeys !== void 0, O = i?.selectedRowKeys !== void 0, h = W(() => {
163
+ if (J) {
164
+ const e = d.find((t) => t.sortOrder !== void 0 && t.sortOrder !== null);
165
+ return {
166
+ columnKey: e?.key ?? null,
167
+ order: e?.sortOrder ?? null
168
+ };
169
+ }
170
+ return oe;
171
+ }, [J, d, oe]), E = W(() => {
172
+ if (Q) {
173
+ const e = {};
174
+ return d.forEach((t) => {
175
+ t.filteredValue !== void 0 && (e[t.key] = t.filteredValue);
176
+ }), e;
177
+ }
178
+ return de;
179
+ }, [Q, d, de]), D = O ? i.selectedRowKeys : Ee, M = te ? y.expandedRowKeys : Re, q = o !== !1, b = W(() => d.filter((e) => !e.hidden), [d]), $ = S((e, t) => {
180
+ if (typeof K == "function")
181
+ return K(e);
182
+ const s = e[K];
183
+ return String(s !== void 0 ? s : t);
184
+ }, [K]), X = W(() => {
185
+ let e = [...k];
186
+ return Object.entries(E).forEach(([t, s]) => {
187
+ if (s && s.length > 0) {
188
+ const n = d.find((r) => r.key === t);
189
+ n?.onFilter && (e = e.filter(
190
+ (r) => s.some((l) => n.onFilter(l, r))
191
+ ));
192
+ }
193
+ }), e;
194
+ }, [k, E, d]), v = W(() => {
195
+ if (!h.columnKey || !h.order)
196
+ return X;
197
+ const e = d.find((s) => s.key === h.columnKey);
198
+ if (!e?.sorter)
199
+ return X;
200
+ const t = [...X];
201
+ return t.sort((s, n) => {
202
+ let r = 0;
203
+ if (typeof e.sorter == "function")
204
+ r = e.sorter(s, n);
205
+ else if (e.dataIndex) {
206
+ const l = s[e.dataIndex], g = n[e.dataIndex];
207
+ if (l == null) return 1;
208
+ if (g == null) return -1;
209
+ l < g && (r = -1), l > g && (r = 1);
210
+ }
211
+ return h.order === "ascend" ? r : -r;
212
+ }), t;
213
+ }, [X, h, d]), R = o !== !1 && o?.total !== void 0 ? o.total : v.length, j = Math.ceil(R / C), se = (N - 1) * C, ce = se + C, P = q ? v.slice(se, ce) : v, Y = S((e) => {
214
+ if (G(e), o !== !1 && o?.onChange && o.onChange(e, C), z) {
215
+ const t = {
216
+ column: d.find((s) => s.key === h.columnKey),
217
+ order: h.order,
218
+ field: h.columnKey ?? void 0
219
+ };
220
+ z(
221
+ { current: e, pageSize: C, total: R },
222
+ E,
223
+ t,
224
+ { currentDataSource: v, action: "paginate" }
225
+ );
226
+ }
227
+ }, [o, C, z, d, h, E, v, R]), Pe = S((e) => {
228
+ Se(e), G(1), o !== !1 && o?.onShowSizeChange && o.onShowSizeChange(1, e), o !== !1 && o?.onChange && o.onChange(1, e);
229
+ }, [o]), fe = S((e) => {
230
+ const t = d.find((r) => r.key === e);
231
+ let s = "ascend";
232
+ h.columnKey === e && (h.order === "ascend" ? s = "descend" : h.order === "descend" && (s = null)), J || Ke({ columnKey: s ? e : null, order: s }), G(1);
233
+ const n = {
234
+ column: t,
235
+ order: s,
236
+ field: e
237
+ };
238
+ le?.(n), z && z(
239
+ { current: 1, pageSize: C, total: R },
240
+ E,
241
+ n,
242
+ { currentDataSource: v, action: "sort" }
243
+ );
244
+ }, [d, h, J, C, R, E, v, le, z]), Ie = S((e, t) => {
245
+ const s = {
246
+ ...E,
247
+ [e]: t
248
+ };
249
+ if (Q || ze(s), G(1), ie?.(s), z) {
250
+ const n = {
251
+ column: d.find((r) => r.key === h.columnKey),
252
+ order: h.order,
253
+ field: h.columnKey ?? void 0
254
+ };
255
+ z(
256
+ { current: 1, pageSize: C, total: R },
257
+ s,
258
+ n,
259
+ { currentDataSource: v, action: "filter" }
260
+ );
261
+ }
262
+ }, [E, Q, d, h, C, R, v, ie, z]), Fe = S((e) => {
263
+ const t = e ? P.map((s, n) => $(s, n)) : [];
264
+ if (O || ee(t), i?.onChange) {
265
+ const s = e ? P : [];
266
+ i.onChange(t, s);
267
+ }
268
+ }, [P, $, O, i]), Oe = S((e, t, s) => {
269
+ const n = $(e, t);
270
+ if (i?.type === "radio") {
271
+ const l = s ? [n] : [];
272
+ O || ee(l), i?.onChange && i.onChange(l, s ? [e] : []);
273
+ return;
274
+ }
275
+ const r = s ? [...D, n] : D.filter((l) => l !== n);
276
+ if (O || ee(r), i?.onChange) {
277
+ const l = v.filter(
278
+ (g, c) => r.includes($(g, c))
279
+ );
280
+ i.onChange(r, l);
281
+ }
282
+ }, [$, i, O, D, v]), ae = S((e, t) => {
283
+ const s = $(e, t), n = M.includes(s), r = n ? M.filter((l) => l !== s) : [...M, s];
284
+ te || je(r), y?.onExpand?.(!n, e), y?.onExpandedRowsChange?.(r);
285
+ }, [$, M, te, y]), De = S((e, t, s) => {
286
+ if (e.render)
287
+ return e.render(
288
+ e.dataIndex ? t[e.dataIndex] : void 0,
289
+ t,
290
+ s
291
+ );
292
+ if (e.dataIndex) {
293
+ const n = t[e.dataIndex];
294
+ return n != null ? String(n) : "";
295
+ }
296
+ return "";
297
+ }, []), he = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", ue = S((e, t = !1) => {
298
+ const s = b[e];
299
+ if (!s?.fixed) return { className: "" };
300
+ const n = ["sticky", "bg-base-100"];
301
+ let r = 0;
302
+ const l = {
303
+ boxSizing: "border-box"
304
+ };
305
+ if (s.fixed === "left") {
306
+ for (let c = 0; c < e; c++)
307
+ if (b[c].fixed === "left" && b[c].width) {
308
+ const u = b[c].width, x = typeof u == "number" ? u : parseInt(String(u));
309
+ isNaN(x) || (r += x);
310
+ }
311
+ r === 0 ? n.push("left-0") : l.left = `${r}px`, n.push(t ? "z-30" : "z-20");
312
+ let g = -1;
313
+ for (let c = b.length - 1; c >= 0; c--)
314
+ if (b[c].fixed === "left") {
315
+ g = c;
316
+ break;
317
+ }
318
+ e === g && (l.boxShadow = "2px 0 4px rgba(0, 0, 0, 0.1)");
319
+ }
320
+ if (s.fixed === "right") {
321
+ for (let c = e + 1; c < b.length; c++)
322
+ if (b[c].fixed === "right" && b[c].width) {
323
+ const u = b[c].width, x = typeof u == "number" ? u : parseInt(String(u));
324
+ isNaN(x) || (r += x);
325
+ }
326
+ r === 0 ? n.push("right-0") : l.right = `${r}px`, n.push(t ? "z-30" : "z-20"), e === b.findIndex((c) => c.fixed === "right") && (l.boxShadow = "-2px 0 4px rgba(0, 0, 0, 0.1)");
327
+ }
328
+ return {
329
+ className: n.filter(Boolean).join(" "),
330
+ style: Object.keys(l).length > 0 ? l : void 0
331
+ };
332
+ }, [b]), Le = [
333
+ "table",
334
+ "bg-base-100",
335
+ qe[F],
336
+ A && "table-zebra",
337
+ _ && "table-pin-rows",
338
+ U && "table-pin-cols",
339
+ ge
340
+ ].filter(Boolean).join(" "), Ve = b.some((e) => e.fixed), L = y !== void 0, T = {};
341
+ w?.x && (T.overflowX = "auto", T.maxWidth = typeof w.x == "number" ? `${w.x}px` : w.x), w?.y && (T.overflowY = "auto", T.maxHeight = typeof w.y == "number" ? `${w.y}px` : w.y);
342
+ const Be = [
343
+ (!_ || Ve || w?.x) && "overflow-x-auto",
344
+ V && "rounded-box border border-base-content/5 bg-base-100"
345
+ ].filter(Boolean).join(" ");
346
+ if (H)
347
+ return /* @__PURE__ */ a("div", { className: "flex justify-center items-center p-8", "data-testid": `${p}-loading`, children: /* @__PURE__ */ a("span", { className: "loading loading-spinner loading-lg", "aria-label": "Loading" }) });
348
+ const pe = P.length > 0 && P.every((e, t) => D.includes($(e, t))), Me = P.some((e, t) => D.includes($(e, t))), Te = Z?.emptyText ?? "No data", be = (i ? 1 : 0) + (L ? 1 : 0), ye = () => {
349
+ if (!q || j <= 1 || typeof o == "boolean") return null;
350
+ const e = o ?? {}, t = e.position ?? "bottomRight", s = e.showSizeChanger, n = e.showQuickJumper, r = e.showTotal, l = e.pageSizeOptions ?? [10, 20, 50, 100], g = t.includes("Left") ? "justify-start" : t.includes("Center") ? "justify-center" : "justify-end";
351
+ return /* @__PURE__ */ m("div", { className: `flex items-center gap-4 ${g}`, "data-testid": `${p}-pagination`, children: [
352
+ r && /* @__PURE__ */ a("span", { className: "text-sm text-base-content/70", children: r(R, [se + 1, Math.min(ce, R)]) }),
353
+ s && /* @__PURE__ */ a(
354
+ "select",
355
+ {
356
+ className: "select select-sm select-bordered",
357
+ value: C,
358
+ onChange: (u) => Pe(Number(u.target.value)),
359
+ "aria-label": "Page size",
360
+ "data-testid": `${p}-page-size`,
361
+ children: l.map((u) => /* @__PURE__ */ m("option", { value: u, children: [
362
+ u,
363
+ " / page"
364
+ ] }, u))
365
+ }
366
+ ),
367
+ /* @__PURE__ */ m("div", { className: "join", children: [
368
+ /* @__PURE__ */ a(
369
+ "button",
370
+ {
371
+ type: "button",
372
+ className: "join-item btn btn-sm",
373
+ onClick: () => Y(N - 1),
374
+ disabled: N === 1,
375
+ "aria-label": "Previous page",
376
+ "data-testid": `${p}-prev`,
377
+ children: "«"
378
+ }
379
+ ),
380
+ Array.from({ length: Math.min(j, 7) }, (u, x) => {
381
+ let f;
382
+ return j <= 7 || N <= 4 ? f = x + 1 : N >= j - 3 ? f = j - 6 + x : f = N - 3 + x, /* @__PURE__ */ a(
383
+ "button",
384
+ {
385
+ type: "button",
386
+ className: `join-item btn btn-sm ${N === f ? "btn-active" : ""}`,
387
+ onClick: () => Y(f),
388
+ "aria-label": `Page ${f}`,
389
+ "aria-current": N === f ? "page" : void 0,
390
+ "data-testid": `${p}-page-${f}`,
391
+ children: f
392
+ },
393
+ f
394
+ );
395
+ }),
396
+ /* @__PURE__ */ a(
397
+ "button",
398
+ {
399
+ type: "button",
400
+ className: "join-item btn btn-sm",
401
+ onClick: () => Y(N + 1),
402
+ disabled: N === j,
403
+ "aria-label": "Next page",
404
+ "data-testid": `${p}-next`,
405
+ children: "»"
406
+ }
407
+ )
408
+ ] }),
409
+ n && /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
410
+ /* @__PURE__ */ a("span", { className: "text-sm", children: "Go to" }),
411
+ /* @__PURE__ */ a(
412
+ "input",
413
+ {
414
+ type: "number",
415
+ className: "input input-sm input-bordered w-16",
416
+ min: 1,
417
+ max: j,
418
+ onKeyDown: (u) => {
419
+ if (u.key === "Enter") {
420
+ const x = parseInt(u.target.value);
421
+ x >= 1 && x <= j && Y(x);
422
+ }
423
+ },
424
+ "aria-label": "Go to page",
425
+ "data-testid": `${p}-jumper`
426
+ }
427
+ )
428
+ ] })
429
+ ] });
430
+ }, re = o && typeof o != "boolean" ? o.position : void 0, We = q && re?.startsWith("top") ? ye() : null, Ae = q && (!re || re.startsWith("bottom")) ? ye() : null;
431
+ return /* @__PURE__ */ m("div", { className: "space-y-4", "data-testid": p, ...we, children: [
432
+ We,
433
+ /* @__PURE__ */ a("div", { className: Be, style: T, children: /* @__PURE__ */ m(
434
+ "table",
435
+ {
436
+ ref: Ce,
437
+ className: Le,
438
+ style: { borderCollapse: "separate", borderSpacing: 0, tableLayout: "fixed" },
439
+ role: "grid",
440
+ "aria-label": ke,
441
+ "aria-rowcount": v.length,
442
+ "data-testid": `${p}-table`,
443
+ children: [
444
+ /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ m("tr", { role: "row", children: [
445
+ L && /* @__PURE__ */ a("th", { style: { width: 50 }, className: "sticky left-0 z-20 bg-base-100", role: "columnheader", children: /* @__PURE__ */ a("span", { className: "sr-only", children: "Expand" }) }),
446
+ i && /* @__PURE__ */ a(
447
+ "th",
448
+ {
449
+ style: { width: 50 },
450
+ className: `sticky ${L ? "" : "left-0"} z-20 bg-base-100`,
451
+ role: "columnheader",
452
+ children: i.type !== "radio" && /* @__PURE__ */ a(
453
+ "input",
454
+ {
455
+ type: "checkbox",
456
+ className: "checkbox checkbox-sm checkbox-primary",
457
+ checked: pe,
458
+ ref: (e) => {
459
+ e && (e.indeterminate = Me && !pe);
460
+ },
461
+ onChange: (e) => Fe(e.target.checked),
462
+ "aria-label": Z?.selectAll ?? "Select all rows",
463
+ "data-testid": `${p}-select-all`
464
+ }
465
+ )
466
+ }
467
+ ),
468
+ b.map((e, t) => {
469
+ const s = ue(t, !0), r = h.columnKey === e.key ? h.order : null;
470
+ return /* @__PURE__ */ a(
471
+ "th",
472
+ {
473
+ className: `${he(e.align)} ${s.className}`,
474
+ style: {
475
+ ...e.width ? { width: e.width } : {},
476
+ ...s.style
477
+ },
478
+ role: "columnheader",
479
+ "aria-sort": r === "ascend" ? "ascending" : r === "descend" ? "descending" : void 0,
480
+ "data-testid": `${p}-header-${e.key}`,
481
+ children: /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
482
+ /* @__PURE__ */ a(
483
+ "span",
484
+ {
485
+ className: e.sorter ? "cursor-pointer select-none hover:text-primary" : "",
486
+ onClick: () => e.sorter && fe(e.key),
487
+ onKeyDown: (l) => {
488
+ e.sorter && (l.key === "Enter" || l.key === " ") && (l.preventDefault(), fe(e.key));
489
+ },
490
+ tabIndex: e.sorter ? 0 : void 0,
491
+ role: e.sorter ? "button" : void 0,
492
+ "aria-label": e.sorter ? `Sort by ${e.title}` : void 0,
493
+ children: e.title
494
+ }
495
+ ),
496
+ e.sorter && /* @__PURE__ */ m("div", { className: "flex flex-col", "aria-hidden": "true", children: [
497
+ /* @__PURE__ */ a(
498
+ "svg",
499
+ {
500
+ className: `w-3 h-3 ${r === "ascend" ? "text-primary" : "text-base-content/30"}`,
501
+ fill: "currentColor",
502
+ viewBox: "0 0 20 20",
503
+ children: /* @__PURE__ */ a("path", { d: "M5.293 9.707a1 1 0 010-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 01-1.414 1.414L11 7.414V15a1 1 0 11-2 0V7.414L6.707 9.707a1 1 0 01-1.414 0z" })
504
+ }
505
+ ),
506
+ /* @__PURE__ */ a(
507
+ "svg",
508
+ {
509
+ className: `w-3 h-3 -mt-1 ${r === "descend" ? "text-primary" : "text-base-content/30"}`,
510
+ fill: "currentColor",
511
+ viewBox: "0 0 20 20",
512
+ children: /* @__PURE__ */ a("path", { d: "M14.707 10.293a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 111.414-1.414L9 12.586V5a1 1 0 012 0v7.586l2.293-2.293a1 1 0 011.414 0z" })
513
+ }
514
+ )
515
+ ] }),
516
+ e.filters && /* @__PURE__ */ a(
517
+ Xe,
518
+ {
519
+ filters: e.filters,
520
+ selectedValues: E[e.key] || [],
521
+ onChange: (l) => Ie(e.key, l),
522
+ locale: Z,
523
+ testId: `${p}-${e.key}`
524
+ }
525
+ )
526
+ ] })
527
+ },
528
+ e.key
529
+ );
530
+ })
531
+ ] }) }),
532
+ /* @__PURE__ */ a("tbody", { children: P.length === 0 ? /* @__PURE__ */ a("tr", { role: "row", children: /* @__PURE__ */ a(
533
+ "td",
534
+ {
535
+ colSpan: b.length + be,
536
+ className: "text-center py-8 text-base-content/50",
537
+ role: "gridcell",
538
+ "data-testid": `${p}-empty`,
539
+ children: Te
540
+ }
541
+ ) }) : P.map((e, t) => {
542
+ const s = me?.(e, t) || {}, n = $(e, t), r = D.includes(n), l = M.includes(n), g = y?.rowExpandable ? y.rowExpandable(e) : !0, c = [
543
+ B && "hover:bg-base-200",
544
+ r && "bg-primary/10"
545
+ ].filter(Boolean).join(" "), u = i?.getCheckboxProps?.(e) || {}, x = (f) => {
546
+ s.onClick?.(f), y?.expandRowByClick && g && ae(e, t);
547
+ };
548
+ return /* @__PURE__ */ m(Ge.Fragment, { children: [
549
+ /* @__PURE__ */ m(
550
+ "tr",
551
+ {
552
+ className: c,
553
+ role: "row",
554
+ "aria-selected": r,
555
+ "data-testid": `${p}-row-${t}`,
556
+ "data-state": r ? "selected" : void 0,
557
+ ...s,
558
+ onClick: x,
559
+ children: [
560
+ L && /* @__PURE__ */ a("td", { className: "sticky left-0 z-10 bg-base-100", role: "gridcell", children: g && (y.expandIcon ? y.expandIcon({
561
+ expanded: l,
562
+ onExpand: () => ae(e, t),
563
+ record: e
564
+ }) : /* @__PURE__ */ a(
565
+ Ye,
566
+ {
567
+ expanded: l,
568
+ onExpand: () => ae(e, t)
569
+ }
570
+ )) }),
571
+ i && /* @__PURE__ */ a(
572
+ "td",
573
+ {
574
+ className: `sticky ${L ? "" : "left-0"} z-10 bg-base-100`,
575
+ role: "gridcell",
576
+ children: /* @__PURE__ */ a(
577
+ "input",
578
+ {
579
+ type: i.type === "radio" ? "radio" : "checkbox",
580
+ className: i.type === "radio" ? "radio radio-sm radio-primary" : "checkbox checkbox-sm checkbox-primary",
581
+ checked: r,
582
+ onChange: (f) => Oe(e, t, f.target.checked),
583
+ "aria-label": `Select row ${t + 1}`,
584
+ "data-testid": `${p}-row-${t}-select`,
585
+ ...u
586
+ }
587
+ )
588
+ }
589
+ ),
590
+ b.map((f, _e) => {
591
+ const xe = ue(_e, !1), ne = De(f, e, t);
592
+ return /* @__PURE__ */ a(
593
+ "td",
594
+ {
595
+ className: `${he(f.align)} ${xe.className} ${f.ellipsis ? "truncate max-w-0" : ""}`,
596
+ style: xe.style,
597
+ role: "gridcell",
598
+ title: f.ellipsis && typeof ne == "string" ? ne : void 0,
599
+ "data-testid": `${p}-row-${t}-${f.key}`,
600
+ children: ne
601
+ },
602
+ f.key
603
+ );
604
+ })
605
+ ]
606
+ }
607
+ ),
608
+ L && l && /* @__PURE__ */ a(
609
+ "tr",
610
+ {
611
+ className: "bg-base-200/50",
612
+ role: "row",
613
+ "data-testid": `${p}-row-${t}-expanded`,
614
+ children: /* @__PURE__ */ a(
615
+ "td",
616
+ {
617
+ colSpan: b.length + be,
618
+ className: "p-4",
619
+ role: "gridcell",
620
+ children: y.expandedRowRender(e, t, l)
621
+ }
622
+ )
623
+ }
624
+ )
625
+ ] }, n);
626
+ }) })
627
+ ]
628
+ }
629
+ ) }),
630
+ Ae
631
+ ] });
632
+ }
633
+ const et = Je(He);
94
634
  export {
95
- S as Steps
635
+ et as Table
96
636
  };
97
637
  //# sourceMappingURL=index80.js.map