asterui 0.12.26 → 0.12.28

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 (166) hide show
  1. package/dist/components/Collapse.d.ts +40 -20
  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/Timeline.d.ts +62 -7
  8. package/dist/index.d.ts +4 -6
  9. package/dist/index.js +148 -150
  10. package/dist/index.js.map +1 -1
  11. package/dist/index10.js +1 -1
  12. package/dist/index100.js +5 -32
  13. package/dist/index100.js.map +1 -1
  14. package/dist/index101.js +13 -5
  15. package/dist/index101.js.map +1 -1
  16. package/dist/index102.js +43 -11
  17. package/dist/index102.js.map +1 -1
  18. package/dist/index103.js +11 -44
  19. package/dist/index103.js.map +1 -1
  20. package/dist/index104.js +12 -10
  21. package/dist/index104.js.map +1 -1
  22. package/dist/index105.js +7 -14
  23. package/dist/index105.js.map +1 -1
  24. package/dist/index106.js +12 -7
  25. package/dist/index106.js.map +1 -1
  26. package/dist/index107.js +29 -11
  27. package/dist/index107.js.map +1 -1
  28. package/dist/index108.js +16 -29
  29. package/dist/index108.js.map +1 -1
  30. package/dist/index109.js +31 -16
  31. package/dist/index109.js.map +1 -1
  32. package/dist/index110.js +517 -30
  33. package/dist/index110.js.map +1 -1
  34. package/dist/index111.js +45 -515
  35. package/dist/index111.js.map +1 -1
  36. package/dist/index18.js +105 -64
  37. package/dist/index18.js.map +1 -1
  38. package/dist/index22.js +1 -1
  39. package/dist/index23.js +127 -93
  40. package/dist/index23.js.map +1 -1
  41. package/dist/index39.js +162 -115
  42. package/dist/index39.js.map +1 -1
  43. package/dist/index40.js +398 -40
  44. package/dist/index40.js.map +1 -1
  45. package/dist/index41.js +132 -389
  46. package/dist/index41.js.map +1 -1
  47. package/dist/index42.js +252 -91
  48. package/dist/index42.js.map +1 -1
  49. package/dist/index43.js +143 -247
  50. package/dist/index43.js.map +1 -1
  51. package/dist/index44.js +15 -154
  52. package/dist/index44.js.map +1 -1
  53. package/dist/index45.js +17 -15
  54. package/dist/index45.js.map +1 -1
  55. package/dist/index46.js +136 -16
  56. package/dist/index46.js.map +1 -1
  57. package/dist/index47.js +118 -133
  58. package/dist/index47.js.map +1 -1
  59. package/dist/index48.js +35 -13
  60. package/dist/index48.js.map +1 -1
  61. package/dist/index49.js +34 -35
  62. package/dist/index49.js.map +1 -1
  63. package/dist/index50.js +81 -34
  64. package/dist/index50.js.map +1 -1
  65. package/dist/index51.js +166 -71
  66. package/dist/index51.js.map +1 -1
  67. package/dist/index52.js +144 -167
  68. package/dist/index52.js.map +1 -1
  69. package/dist/index53.js +11 -152
  70. package/dist/index53.js.map +1 -1
  71. package/dist/index54.js +55 -10
  72. package/dist/index54.js.map +1 -1
  73. package/dist/index55.js +12 -55
  74. package/dist/index55.js.map +1 -1
  75. package/dist/index56.js +7 -14
  76. package/dist/index56.js.map +1 -1
  77. package/dist/index57.js +333 -6
  78. package/dist/index57.js.map +1 -1
  79. package/dist/index58.js +47 -334
  80. package/dist/index58.js.map +1 -1
  81. package/dist/index59.js +122 -47
  82. package/dist/index59.js.map +1 -1
  83. package/dist/index60.js +108 -120
  84. package/dist/index60.js.map +1 -1
  85. package/dist/index61.js +167 -107
  86. package/dist/index61.js.map +1 -1
  87. package/dist/index62.js +29 -167
  88. package/dist/index62.js.map +1 -1
  89. package/dist/index63.js +120 -30
  90. package/dist/index63.js.map +1 -1
  91. package/dist/index64.js +80 -116
  92. package/dist/index64.js.map +1 -1
  93. package/dist/index65.js +19 -85
  94. package/dist/index65.js.map +1 -1
  95. package/dist/index66.js +73 -19
  96. package/dist/index66.js.map +1 -1
  97. package/dist/index67.js +54 -71
  98. package/dist/index67.js.map +1 -1
  99. package/dist/index68.js +44 -56
  100. package/dist/index68.js.map +1 -1
  101. package/dist/index69.js +49 -42
  102. package/dist/index69.js.map +1 -1
  103. package/dist/index70.js +121 -50
  104. package/dist/index70.js.map +1 -1
  105. package/dist/index71.js +102 -118
  106. package/dist/index71.js.map +1 -1
  107. package/dist/index72.js +72 -105
  108. package/dist/index72.js.map +1 -1
  109. package/dist/index73.js +67 -73
  110. package/dist/index73.js.map +1 -1
  111. package/dist/index74.js +19 -66
  112. package/dist/index74.js.map +1 -1
  113. package/dist/index75.js +55 -18
  114. package/dist/index75.js.map +1 -1
  115. package/dist/index76.js +251 -55
  116. package/dist/index76.js.map +1 -1
  117. package/dist/index77.js +22 -254
  118. package/dist/index77.js.map +1 -1
  119. package/dist/index78.js +31 -22
  120. package/dist/index78.js.map +1 -1
  121. package/dist/index79.js +93 -30
  122. package/dist/index79.js.map +1 -1
  123. package/dist/index80.js +626 -86
  124. package/dist/index80.js.map +1 -1
  125. package/dist/index81.js +73 -322
  126. package/dist/index81.js.map +1 -1
  127. package/dist/index82.js +39 -79
  128. package/dist/index82.js.map +1 -1
  129. package/dist/index83.js +23 -40
  130. package/dist/index83.js.map +1 -1
  131. package/dist/index84.js +207 -23
  132. package/dist/index84.js.map +1 -1
  133. package/dist/index85.js +148 -199
  134. package/dist/index85.js.map +1 -1
  135. package/dist/index86.js +152 -147
  136. package/dist/index86.js.map +1 -1
  137. package/dist/index87.js +143 -156
  138. package/dist/index87.js.map +1 -1
  139. package/dist/index88.js +35 -65
  140. package/dist/index88.js.map +1 -1
  141. package/dist/index89.js +234 -35
  142. package/dist/index89.js.map +1 -1
  143. package/dist/index90.js +31 -231
  144. package/dist/index90.js.map +1 -1
  145. package/dist/index91.js +210 -34
  146. package/dist/index91.js.map +1 -1
  147. package/dist/index92.js +418 -187
  148. package/dist/index92.js.map +1 -1
  149. package/dist/index93.js +686 -376
  150. package/dist/index93.js.map +1 -1
  151. package/dist/index94.js +165 -738
  152. package/dist/index94.js.map +1 -1
  153. package/dist/index95.js +253 -173
  154. package/dist/index95.js.map +1 -1
  155. package/dist/index96.js +64 -256
  156. package/dist/index96.js.map +1 -1
  157. package/dist/index97.js +121 -61
  158. package/dist/index97.js.map +1 -1
  159. package/dist/index98.js +14 -126
  160. package/dist/index98.js.map +1 -1
  161. package/dist/index99.js +31 -12
  162. package/dist/index99.js.map +1 -1
  163. package/package.json +1 -1
  164. package/dist/components/Indicator.d.ts +0 -7
  165. package/dist/index112.js +0 -53
  166. package/dist/index112.js.map +0 -1
package/dist/index94.js CHANGED
@@ -1,754 +1,181 @@
1
- import { jsx as v, jsxs as z } from "react/jsx-runtime";
2
- import rn, { forwardRef as sn, useId as on, useState as F, useRef as be, useMemo as oe, useCallback as T, useEffect as ve } from "react";
3
- const cn = "SHOW_ALL", ln = "SHOW_PARENT", an = "SHOW_CHILD";
4
- function u(r, d, p) {
5
- if (d === "title") {
6
- const l = p?.label || "title";
7
- return r[l];
8
- }
9
- if (d === "key") {
10
- const l = p?.value || "key";
11
- return r[l];
12
- }
13
- if (d === "children") {
14
- const l = p?.children || "children";
15
- return r[l];
16
- }
17
- }
18
- function Me(r, d = [], p) {
19
- const l = [];
20
- return r.forEach((f) => {
21
- const b = u(f, "title", p), g = u(f, "children", p), k = [...d, b];
22
- l.push({ node: f, path: k }), g && l.push(...Me(g, k, p));
23
- }), l;
24
- }
25
- function un(r, d) {
26
- const p = [], l = (f) => {
27
- f.forEach((b) => {
28
- const g = u(b, "key", d), k = u(b, "children", d);
29
- p.push(g), k && l(k);
30
- });
31
- };
32
- return l(r), p;
33
- }
34
- function $(r, d, p) {
35
- for (const l of r) {
36
- const f = u(l, "key", p), b = u(l, "children", p);
37
- if (f === d) return l;
38
- if (b) {
39
- const g = $(b, d, p);
40
- if (g) return g;
1
+ import { jsx as e, jsxs as u, Fragment as C } from "react/jsx-runtime";
2
+ import { useState as g } from "react";
3
+ function f({ text: a }) {
4
+ const [t, r] = g(!1);
5
+ return /* @__PURE__ */ e(
6
+ "button",
7
+ {
8
+ onClick: async () => {
9
+ try {
10
+ await navigator.clipboard.writeText(a), r(!0), setTimeout(() => r(!1), 2e3);
11
+ } catch (s) {
12
+ console.error("Failed to copy:", s);
13
+ }
14
+ },
15
+ className: "btn btn-ghost btn-xs ml-2 opacity-0 group-hover:opacity-100 transition-opacity",
16
+ title: "Copy to clipboard",
17
+ children: t ? /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e(
18
+ "path",
19
+ {
20
+ fillRule: "evenodd",
21
+ d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
22
+ clipRule: "evenodd"
23
+ }
24
+ ) }) : /* @__PURE__ */ u("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: [
25
+ /* @__PURE__ */ e("path", { d: "M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z" }),
26
+ /* @__PURE__ */ e("path", { d: "M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z" })
27
+ ] })
41
28
  }
42
- }
43
- return null;
29
+ );
44
30
  }
45
- function Oe(r, d) {
46
- const p = [], l = (f) => {
47
- const b = u(f, "children", d);
48
- b && b.forEach((g) => {
49
- const k = u(g, "key", d);
50
- p.push(k), l(g);
51
- });
52
- };
53
- return l(r), p;
31
+ function v({ children: a, size: t = "base", className: r = "", ...l }) {
32
+ const m = [
33
+ // Prose classes (only apply if @tailwindcss/typography is installed)
34
+ "prose dark:prose-invert max-w-none",
35
+ // Fallback styles (always apply)
36
+ "text-base-content leading-relaxed",
37
+ {
38
+ sm: "prose-sm text-sm",
39
+ base: "prose-base text-base",
40
+ lg: "prose-lg text-lg",
41
+ xl: "prose-xl text-xl",
42
+ "2xl": "prose-2xl text-2xl"
43
+ }[t],
44
+ r
45
+ ].filter(Boolean).join(" ");
46
+ return /* @__PURE__ */ e("div", { className: m, ...l, children: a });
54
47
  }
55
- function ge(r, d, p, l = []) {
56
- for (const f of r) {
57
- const b = u(f, "key", p), g = u(f, "children", p);
58
- if (b === d) return l;
59
- if (g) {
60
- const k = ge(g, d, p, [...l, b]);
61
- if (k) return k;
62
- }
48
+ function N({ level: a = 1, children: t, copyable: r, ellipsis: l, className: s = "", id: m, ...c }) {
49
+ const o = typeof t == "string" ? t : "", i = m || (o ? o.toLowerCase().replace(/\s+/g, "-") : void 0), h = {
50
+ 1: "text-4xl font-bold mb-4",
51
+ 2: "text-3xl font-bold mb-3",
52
+ 3: "text-2xl font-semibold mb-3",
53
+ 4: "text-xl font-semibold mb-2",
54
+ 5: "text-lg font-semibold mb-2"
55
+ }, p = l ? "truncate" : "", x = `group ${h[a]} ${p} ${s}`.trim(), d = /* @__PURE__ */ u(C, { children: [
56
+ t,
57
+ r && /* @__PURE__ */ e(f, { text: o })
58
+ ] });
59
+ switch (a) {
60
+ case 1:
61
+ return /* @__PURE__ */ e("h1", { id: i, className: x, ...c, children: d });
62
+ case 2:
63
+ return /* @__PURE__ */ e("h2", { id: i, className: x, ...c, children: d });
64
+ case 3:
65
+ return /* @__PURE__ */ e("h3", { id: i, className: x, ...c, children: d });
66
+ case 4:
67
+ return /* @__PURE__ */ e("h4", { id: i, className: x, ...c, children: d });
68
+ case 5:
69
+ return /* @__PURE__ */ e("h5", { id: i, className: x, ...c, children: d });
70
+ default:
71
+ return /* @__PURE__ */ e("h1", { id: i, className: x, ...c, children: d });
63
72
  }
64
- return null;
65
73
  }
66
- function dn({
67
- node: r,
68
- level: d,
69
- expanded: p,
70
- selected: l,
71
- checked: f,
72
- indeterminate: b,
73
- treeCheckable: g,
74
- treeLine: k,
75
- treeIcon: V,
76
- focused: H,
77
- loading: ce,
78
- baseTestId: U,
79
- id: le,
80
- fieldNames: q,
81
- switcherIcon: L,
82
- onToggle: X,
83
- onSelect: Y,
84
- onCheck: M,
85
- renderChildren: Z
74
+ const w = {
75
+ 1: "line-clamp-1",
76
+ 2: "line-clamp-2",
77
+ 3: "line-clamp-3",
78
+ 4: "line-clamp-4",
79
+ 5: "line-clamp-5",
80
+ 6: "line-clamp-6"
81
+ };
82
+ function k({ children: a, ellipsis: t, copyable: r, size: l, align: s, className: m = "", ...c }) {
83
+ const [o, i] = g(!1), h = typeof a == "string" ? a : "", p = typeof t == "object", x = p && t.rows || 3, d = p ? t.expandable : !1, n = Math.min(Math.max(x, 1), 6), y = [
84
+ "group",
85
+ "mb-4",
86
+ t && !o ? w[n] : "",
87
+ l === "sm" && "text-sm",
88
+ l === "base" && "text-base",
89
+ l === "lg" && "text-lg",
90
+ l === "xl" && "text-xl",
91
+ l === "2xl" && "text-2xl",
92
+ s === "left" && "text-left",
93
+ s === "center" && "text-center",
94
+ s === "right" && "text-right",
95
+ m
96
+ ].filter(Boolean).join(" ");
97
+ return /* @__PURE__ */ u("div", { ...c, children: [
98
+ /* @__PURE__ */ u("p", { className: y, children: [
99
+ a,
100
+ r && /* @__PURE__ */ e(f, { text: h })
101
+ ] }),
102
+ d && t && /* @__PURE__ */ e(
103
+ "button",
104
+ {
105
+ onClick: () => {
106
+ i(!o), p && t.onExpand && t.onExpand();
107
+ },
108
+ className: "text-primary text-sm hover:underline",
109
+ children: o ? "Show less" : "Show more"
110
+ }
111
+ )
112
+ ] });
113
+ }
114
+ function j({
115
+ children: a,
116
+ code: t,
117
+ mark: r,
118
+ strong: l,
119
+ italic: s,
120
+ underline: m,
121
+ delete: c,
122
+ type: o = "default",
123
+ copyable: i,
124
+ className: h = "",
125
+ ...p
86
126
  }) {
87
- const C = u(r, "children", q), P = u(r, "title", q), W = u(r, "key", q), D = r.icon, G = C && C.length > 0, E = r.isLeaf ?? !G, B = (K) => {
88
- K.stopPropagation(), E || X(W);
89
- }, m = () => {
90
- r.disabled || (g ? M(W, r) : Y(W, r));
91
- }, j = (K) => {
92
- K.stopPropagation(), r.disabled || M(W, r);
93
- }, J = (K) => {
94
- (K.key === "Enter" || K.key === " ") && (K.preventDefault(), m());
95
- }, N = () => ce ? /* @__PURE__ */ v("span", { className: "loading loading-spinner loading-xs" }) : L ? typeof L == "function" ? L({ expanded: p }) : L : /* @__PURE__ */ v(
96
- "svg",
97
- {
98
- className: `w-3 h-3 transition-transform ${p ? "rotate-90" : ""}`,
99
- fill: "none",
100
- viewBox: "0 0 24 24",
101
- stroke: "currentColor",
102
- "aria-hidden": "true",
103
- children: /* @__PURE__ */ v("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
104
- }
105
- );
106
- return /* @__PURE__ */ z(
107
- "div",
127
+ const x = typeof a == "string" ? a : "", d = {
128
+ default: "",
129
+ secondary: "text-base-content/70",
130
+ success: "text-success",
131
+ warning: "text-warning",
132
+ error: "text-error"
133
+ };
134
+ let n = a;
135
+ t && (n = /* @__PURE__ */ e("code", { className: "px-1.5 py-0.5 bg-base-200 rounded text-sm font-mono", children: n })), r && (n = /* @__PURE__ */ e("mark", { className: "bg-warning/30 px-1", children: n })), l && (n = /* @__PURE__ */ e("strong", { className: "font-bold", children: n })), s && (n = /* @__PURE__ */ e("em", { className: "italic", children: n })), m && (n = /* @__PURE__ */ e("u", { className: "underline", children: n })), c && (n = /* @__PURE__ */ e("del", { className: "line-through opacity-70", children: n }));
136
+ const b = `group inline ${d[o]} ${h}`.trim();
137
+ return /* @__PURE__ */ u("span", { className: b, ...p, children: [
138
+ n,
139
+ i && /* @__PURE__ */ e(f, { text: x })
140
+ ] });
141
+ }
142
+ function B({ href: a = "#", children: t, target: r, external: l, size: s, className: m = "", ...c }) {
143
+ const o = l || a && a.startsWith("http"), i = r || (o ? "_blank" : void 0), h = o ? "noopener noreferrer" : void 0, p = [
144
+ "link",
145
+ "link-primary",
146
+ s === "sm" && "text-sm",
147
+ s === "base" && "text-base",
148
+ s === "lg" && "text-lg",
149
+ s === "xl" && "text-xl",
150
+ s === "2xl" && "text-2xl",
151
+ m
152
+ ].filter(Boolean).join(" ");
153
+ return /* @__PURE__ */ u(
154
+ "a",
108
155
  {
109
- className: "tree-select-node",
110
- role: "treeitem",
111
- id: le,
112
- "aria-selected": l || f,
113
- "aria-expanded": G ? p : void 0,
114
- "data-testid": `${U}-option-${W}`,
115
- "data-state": l || f ? "selected" : "unselected",
116
- "data-disabled": r.disabled || void 0,
156
+ href: a,
157
+ target: i,
158
+ rel: h,
159
+ className: p,
160
+ ...c,
117
161
  children: [
118
- /* @__PURE__ */ z(
119
- "div",
120
- {
121
- className: [
122
- "flex items-center py-1.5 px-2 cursor-pointer hover:bg-base-200 transition-colors outline-none",
123
- (l || f) && "bg-primary/10 text-primary",
124
- r.disabled && "opacity-50 cursor-not-allowed",
125
- H && "ring-2 ring-primary ring-inset",
126
- k && d > 0 && "border-l border-base-300 ml-2"
127
- ].filter(Boolean).join(" "),
128
- style: { paddingLeft: `${d * 16 + 8}px` },
129
- onClick: m,
130
- onKeyDown: J,
131
- tabIndex: -1,
132
- children: [
133
- /* @__PURE__ */ v(
134
- "span",
135
- {
136
- className: [
137
- "w-4 h-4 flex items-center justify-center flex-shrink-0 mr-1",
138
- !E && "cursor-pointer"
139
- ].filter(Boolean).join(" "),
140
- onClick: B,
141
- "aria-hidden": "true",
142
- children: !E && N()
143
- }
144
- ),
145
- g && /* @__PURE__ */ v("span", { className: "mr-2 flex-shrink-0", onClick: j, children: /* @__PURE__ */ v(
146
- "input",
147
- {
148
- type: "checkbox",
149
- className: "checkbox checkbox-sm checkbox-primary",
150
- checked: f,
151
- ref: (K) => {
152
- K && (K.indeterminate = b);
153
- },
154
- disabled: r.disabled,
155
- onChange: m,
156
- "aria-label": typeof P == "string" ? P : void 0,
157
- tabIndex: -1
158
- }
159
- ) }),
160
- V && D && /* @__PURE__ */ v("span", { className: "mr-1.5 flex-shrink-0 flex items-center", children: D }),
161
- /* @__PURE__ */ v("span", { className: "flex-1 truncate select-none text-sm", children: P })
162
- ]
163
- }
164
- ),
165
- G && p && /* @__PURE__ */ v("div", { role: "group", children: Z(C, d + 1) })
162
+ t,
163
+ o && /* @__PURE__ */ u("svg", { className: "w-3 h-3 inline-block ml-1", fill: "currentColor", viewBox: "0 0 20 20", children: [
164
+ /* @__PURE__ */ e("path", { d: "M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z" }),
165
+ /* @__PURE__ */ e("path", { d: "M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z" })
166
+ ] })
166
167
  ]
167
168
  }
168
169
  );
169
170
  }
170
- const fn = {
171
- xs: "min-h-6 text-xs",
172
- sm: "min-h-8 text-sm",
173
- md: "min-h-10 text-base",
174
- lg: "min-h-12 text-lg",
175
- xl: "min-h-14 text-xl"
176
- }, hn = {
177
- primary: "border-primary focus-within:border-primary",
178
- secondary: "border-secondary focus-within:border-secondary",
179
- accent: "border-accent focus-within:border-accent",
180
- neutral: "border-neutral focus-within:border-neutral",
181
- info: "border-info focus-within:border-info",
182
- success: "border-success focus-within:border-success",
183
- warning: "border-warning focus-within:border-warning",
184
- error: "border-error focus-within:border-error"
185
- }, pn = {
186
- error: "border-error focus-within:border-error",
187
- warning: "border-warning focus-within:border-warning"
188
- }, bn = {
189
- outlined: "border border-base-300",
190
- filled: "bg-base-200 border-transparent",
191
- borderless: "border-transparent"
192
- }, Pe = sn(
193
- ({
194
- treeData: r,
195
- value: d,
196
- defaultValue: p = [],
197
- onChange: l,
198
- multiple: f = !1,
199
- treeCheckable: b = !1,
200
- treeCheckStrictly: g = !1,
201
- showCheckedStrategy: k = "SHOW_ALL",
202
- showSearch: V = !1,
203
- searchValue: H,
204
- onSearch: ce,
205
- filterTreeNode: U,
206
- placeholder: le = "Please select",
207
- allowClear: q = !0,
208
- disabled: L = !1,
209
- treeDefaultExpandAll: X = !1,
210
- treeDefaultExpandedKeys: Y = [],
211
- treeExpandedKeys: M,
212
- onTreeExpand: Z,
213
- size: C = "md",
214
- color: P,
215
- status: W,
216
- variant: D = "outlined",
217
- ghost: G = !1,
218
- maxTagCount: E,
219
- maxTagPlaceholder: B,
220
- maxCount: m,
221
- labelInValue: j = !1,
222
- tagRender: J,
223
- treeLine: N = !1,
224
- treeIcon: K = !1,
225
- loadData: ae,
226
- fieldNames: i,
227
- open: ue,
228
- onDropdownVisibleChange: ye,
229
- suffixIcon: Be,
230
- switcherIcon: we,
231
- notFoundContent: Re = "No results found",
232
- dropdownRender: xe,
233
- popupClassName: Fe = "",
234
- className: Te = "",
235
- "data-testid": ze,
236
- ...Ve
237
- }, ee) => {
238
- const _ = ze ?? "treeselect", ne = on(), ke = `${ne}-listbox`, [Ue, qe] = F(!1), [Ce, te] = F(""), [w, I] = F(null), [Le, me] = F(/* @__PURE__ */ new Set()), de = be(null), fe = be(null), re = be(null), Q = H ?? Ce, y = ue ?? Ue, Ke = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map((n) => typeof n == "object" && n !== null ? n.value : n) : typeof e == "object" && e !== null ? [e.value] : [e], Ge = Ke(p), [Je, se] = F(Ge), h = d !== void 0 ? Ke(d) : Je, Qe = oe(() => X ? un(r, i) : Y, [r, X, Y, i]), [Xe, Ye] = F(Qe), A = M ?? Xe, S = oe(() => {
239
- const e = [], n = (c) => {
240
- c.forEach((t) => {
241
- const o = u(t, "key", i), s = u(t, "children", i);
242
- e.push({ key: o, node: t }), s && A.includes(o) && n(s);
243
- });
244
- };
245
- return n(r), e;
246
- }, [r, A, i]), O = T(
247
- (e) => {
248
- ue === void 0 && qe(e), ye?.(e);
249
- },
250
- [ue, ye]
251
- );
252
- ve(() => {
253
- const e = (n) => {
254
- de.current && !de.current.contains(n.target) && (O(!1), H === void 0 && te(""));
255
- };
256
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
257
- }, [O, H]), ve(() => {
258
- y && V && fe.current ? fe.current.focus() : y && re.current && re.current.focus();
259
- }, [y, V]), ve(() => {
260
- y && S.length > 0 ? h.length > 0 ? I(h[0]) : I(S[0].key) : y || I(null);
261
- }, [y, S, h]);
262
- const $e = oe(() => {
263
- if (!Q) return r;
264
- const e = Me(r, [], i), n = /* @__PURE__ */ new Set();
265
- e.forEach(({ node: t }) => {
266
- const o = u(t, "title", i), s = u(t, "key", i);
267
- let a = !1;
268
- U ? a = U(Q, t) : a = (typeof o == "string" ? o : String(o)).toLowerCase().includes(Q.toLowerCase()), a && n.add(s);
269
- });
270
- const c = (t) => t.map((o) => {
271
- const s = u(o, "children", i), a = u(o, "key", i), x = s && c(s).length > 0;
272
- return n.has(a) || x ? {
273
- ...o,
274
- children: s ? c(s) : void 0
275
- } : null;
276
- }).filter(Boolean);
277
- return c(r);
278
- }, [r, Q, U, i]), ie = T(
279
- async (e) => {
280
- const n = $(r, e, i);
281
- if (ae && n) {
282
- const t = u(n, "children", i);
283
- if (!t || t.length === 0) {
284
- me((o) => new Set(o).add(e));
285
- try {
286
- await ae(n);
287
- } finally {
288
- me((o) => {
289
- const s = new Set(o);
290
- return s.delete(e), s;
291
- });
292
- }
293
- }
294
- }
295
- const c = A.includes(e) ? A.filter((t) => t !== e) : [...A, e];
296
- M === void 0 && Ye(c), Z?.(c);
297
- },
298
- [A, M, Z, ae, r, i]
299
- ), he = T(
300
- (e, n) => {
301
- let c;
302
- if (f)
303
- if (h.includes(e))
304
- c = h.filter((o) => o !== e);
305
- else {
306
- if (m !== void 0 && h.length >= m)
307
- return;
308
- c = [...h, e];
309
- }
310
- else
311
- c = [e], O(!1), H === void 0 && te("");
312
- d === void 0 && se(c);
313
- const t = c.map((o) => {
314
- const s = $(r, o, i);
315
- return s ? u(s, "title", i) : o;
316
- });
317
- if (j) {
318
- const o = c.map((s) => {
319
- const a = $(r, s, i);
320
- return {
321
- value: s,
322
- label: a ? u(a, "title", i) : s
323
- };
324
- });
325
- l?.(
326
- f ? o : o[0] || { value: "", label: "" },
327
- t,
328
- { triggerValue: e, triggerNode: n }
329
- );
330
- } else
331
- l?.(f ? c : c[0] || "", t, { triggerValue: e, triggerNode: n });
332
- },
333
- [
334
- h,
335
- f,
336
- m,
337
- d,
338
- l,
339
- r,
340
- O,
341
- H,
342
- i,
343
- j
344
- ]
345
- ), pe = T(
346
- (e, n) => {
347
- const c = h.includes(e);
348
- let t = [...h];
349
- if (g)
350
- if (c)
351
- t = t.filter((s) => s !== e);
352
- else {
353
- if (m !== void 0 && h.length >= m)
354
- return;
355
- t.push(e);
356
- }
357
- else {
358
- const s = Oe(n, i);
359
- if (c)
360
- t = t.filter((a) => a !== e && !s.includes(a));
361
- else {
362
- const a = [e, ...s.filter((x) => !t.includes(x))];
363
- if (m !== void 0 && t.length + a.length > m) {
364
- const x = m - t.length;
365
- if (x <= 0) return;
366
- a.slice(0, x).forEach((R) => t.push(R));
367
- } else
368
- t.push(e), s.forEach((x) => {
369
- t.includes(x) || t.push(x);
370
- });
371
- }
372
- }
373
- d === void 0 && se(t);
374
- const o = t.map((s) => {
375
- const a = $(r, s, i);
376
- return a ? u(a, "title", i) : s;
377
- });
378
- if (j) {
379
- const s = t.map((a) => {
380
- const x = $(r, a, i);
381
- return {
382
- value: a,
383
- label: x ? u(x, "title", i) : a
384
- };
385
- });
386
- l?.(s, o, { triggerValue: e, triggerNode: n });
387
- } else
388
- l?.(t, o, { triggerValue: e, triggerNode: n });
389
- },
390
- [h, d, l, r, g, i, m, j]
391
- ), Ze = (e) => {
392
- e.stopPropagation();
393
- const n = [];
394
- d === void 0 && se(n), j ? l?.(f || b ? [] : { value: "", label: "" }, []) : l?.(f || b ? n : "", []);
395
- }, Se = (e, n) => {
396
- n.stopPropagation();
397
- const c = h.filter((o) => o !== e);
398
- d === void 0 && se(c);
399
- const t = c.map((o) => {
400
- const s = $(r, o, i);
401
- return s ? u(s, "title", i) : o;
402
- });
403
- if (j) {
404
- const o = c.map((s) => {
405
- const a = $(r, s, i);
406
- return {
407
- value: s,
408
- label: a ? u(a, "title", i) : s
409
- };
410
- });
411
- l?.(
412
- f || b ? o : o[0] || { value: "", label: "" },
413
- t
414
- );
415
- } else
416
- l?.(f || b ? c : c[0] || "", t);
417
- }, De = (e) => {
418
- const n = e.target.value;
419
- H === void 0 && te(n), ce?.(n);
420
- }, Ne = (e) => {
421
- if (!L)
422
- switch (e.key) {
423
- case "Enter":
424
- case " ":
425
- if (!y)
426
- e.preventDefault(), O(!0);
427
- else if (w) {
428
- e.preventDefault();
429
- const n = $(r, w, i);
430
- n && !n.disabled && (b ? pe(w, n) : he(w, n));
431
- }
432
- break;
433
- case "Escape":
434
- e.preventDefault(), O(!1), H === void 0 && te(""), re.current?.focus();
435
- break;
436
- case "ArrowDown":
437
- if (e.preventDefault(), !y)
438
- O(!0);
439
- else {
440
- const n = S.findIndex((t) => t.key === w), c = n < S.length - 1 ? n + 1 : 0;
441
- I(S[c]?.key || null);
442
- }
443
- break;
444
- case "ArrowUp":
445
- if (e.preventDefault(), y) {
446
- const n = S.findIndex((t) => t.key === w), c = n > 0 ? n - 1 : S.length - 1;
447
- I(S[c]?.key || null);
448
- }
449
- break;
450
- case "ArrowRight":
451
- if (y && w) {
452
- e.preventDefault();
453
- const n = $(r, w, i), c = n ? u(n, "children", i) : void 0;
454
- c && c.length > 0 && !A.includes(w) && ie(w);
455
- }
456
- break;
457
- case "ArrowLeft":
458
- if (y && w)
459
- if (e.preventDefault(), A.includes(w))
460
- ie(w);
461
- else {
462
- const n = ge(r, w, i);
463
- n && n.length > 0 && I(n[n.length - 1]);
464
- }
465
- break;
466
- case "Home":
467
- y && (e.preventDefault(), I(S[0]?.key || null));
468
- break;
469
- case "End":
470
- y && (e.preventDefault(), I(S[S.length - 1]?.key || null));
471
- break;
472
- }
473
- }, Ee = T(
474
- (e) => {
475
- const n = u(e, "key", i), c = u(e, "children", i);
476
- if (g)
477
- return { checked: h.includes(n), indeterminate: !1 };
478
- if (!c || c.length === 0)
479
- return { checked: h.includes(n), indeterminate: !1 };
480
- const t = Oe(e, i), o = t.filter((s) => h.includes(s));
481
- return o.length === 0 ? { checked: h.includes(n), indeterminate: !1 } : o.length === t.length ? { checked: !0, indeterminate: !1 } : { checked: !1, indeterminate: !0 };
482
- },
483
- [h, g, i]
484
- ), _e = T(
485
- (e, n) => e.map((c) => {
486
- const t = u(c, "key", i), { checked: o, indeterminate: s } = Ee(c);
487
- return /* @__PURE__ */ v(
488
- dn,
489
- {
490
- node: c,
491
- level: n,
492
- expanded: A.includes(t),
493
- selected: h.includes(t),
494
- checked: o,
495
- indeterminate: s,
496
- treeCheckable: b,
497
- treeLine: N,
498
- treeIcon: K,
499
- focused: w === t,
500
- loading: Le.has(t),
501
- baseTestId: _,
502
- id: `${ne}-option-${t}`,
503
- fieldNames: i,
504
- switcherIcon: we,
505
- onToggle: ie,
506
- onSelect: he,
507
- onCheck: pe,
508
- renderChildren: _e
509
- },
510
- t
511
- );
512
- }),
513
- [
514
- A,
515
- h,
516
- b,
517
- N,
518
- K,
519
- w,
520
- Le,
521
- _,
522
- ne,
523
- i,
524
- we,
525
- ie,
526
- he,
527
- pe,
528
- Ee
529
- ]
530
- ), en = oe(() => {
531
- if (h.length === 0) return null;
532
- let e = h;
533
- if ((b || f) && k !== "SHOW_ALL" && (k === "SHOW_PARENT" ? e = h.filter((t) => {
534
- const o = ge(r, t, i);
535
- return o ? !o.some((s) => h.includes(s)) : !0;
536
- }) : k === "SHOW_CHILD" && (e = h.filter((t) => {
537
- const o = $(r, t, i);
538
- if (!o) return !0;
539
- const s = u(o, "children", i);
540
- return !s || s.length === 0;
541
- }))), f || b) {
542
- let t = e, o = 0;
543
- E !== void 0 && E !== "responsive" && e.length > E && (t = e.slice(0, E), o = e.length - E);
544
- const s = t.map((a) => {
545
- const x = $(r, a, i), R = x ? u(x, "title", i) : a, We = R, je = !L, tn = () => {
546
- Se(a, { stopPropagation: () => {
547
- } });
548
- };
549
- return J ? /* @__PURE__ */ v(rn.Fragment, { children: J({ label: We, value: a, closable: je, onClose: tn }) }, a) : /* @__PURE__ */ z(
550
- "span",
551
- {
552
- className: "inline-flex items-center gap-1 px-2 py-0.5 bg-base-200 rounded text-sm mr-1 mb-1",
553
- "data-testid": `${_}-tag-${a}`,
554
- children: [
555
- We,
556
- je && /* @__PURE__ */ v(
557
- "button",
558
- {
559
- type: "button",
560
- className: "hover:text-error",
561
- onClick: (Ie) => Se(a, Ie),
562
- "aria-label": `Remove ${typeof R == "string" ? R : a}`,
563
- children: /* @__PURE__ */ v(
564
- "svg",
565
- {
566
- className: "w-3 h-3",
567
- fill: "none",
568
- viewBox: "0 0 24 24",
569
- stroke: "currentColor",
570
- "aria-hidden": "true",
571
- children: /* @__PURE__ */ v(
572
- "path",
573
- {
574
- strokeLinecap: "round",
575
- strokeLinejoin: "round",
576
- strokeWidth: 2,
577
- d: "M6 18L18 6M6 6l12 12"
578
- }
579
- )
580
- }
581
- )
582
- }
583
- )
584
- ]
585
- },
586
- a
587
- );
588
- });
589
- if (o > 0) {
590
- const a = e.slice(E), x = typeof B == "function" ? B(a) : B || `+${o} more`;
591
- s.push(
592
- /* @__PURE__ */ v(
593
- "span",
594
- {
595
- className: "inline-flex items-center px-2 py-0.5 bg-base-200 rounded text-sm mr-1 mb-1",
596
- children: x
597
- },
598
- "__more__"
599
- )
600
- );
601
- }
602
- return s;
603
- }
604
- const n = $(r, h[0], i);
605
- return n ? u(n, "title", i) : h[0];
606
- }, [
607
- h,
608
- r,
609
- f,
610
- b,
611
- k,
612
- E,
613
- B,
614
- _,
615
- i,
616
- L,
617
- J
618
- ]), Ae = W ? pn[W] : P ? hn[P] : "", nn = G ? "bg-transparent border-transparent" : bn[D], He = /* @__PURE__ */ v("div", { className: "py-1", role: "tree", "aria-label": "Tree options", children: $e.length > 0 ? _e($e, 0) : /* @__PURE__ */ v(
619
- "div",
620
- {
621
- className: "px-4 py-2 text-base-content/50 text-sm text-center",
622
- "data-testid": `${_}-empty`,
623
- children: Re
624
- }
625
- ) });
626
- return /* @__PURE__ */ z(
627
- "div",
628
- {
629
- ref: (e) => {
630
- de.current = e, typeof ee == "function" ? ee(e) : ee && (ee.current = e);
631
- },
632
- className: `relative ${Te}`,
633
- "data-testid": _,
634
- "data-state": y ? "open" : "closed",
635
- "data-disabled": L || void 0,
636
- onKeyDown: Ne,
637
- ...Ve,
638
- children: [
639
- /* @__PURE__ */ z(
640
- "div",
641
- {
642
- ref: re,
643
- role: "combobox",
644
- "aria-expanded": y,
645
- "aria-haspopup": "tree",
646
- "aria-owns": y ? ke : void 0,
647
- "aria-activedescendant": y && w ? `${ne}-option-${w}` : void 0,
648
- "aria-disabled": L,
649
- tabIndex: L ? -1 : 0,
650
- className: [
651
- "input flex items-center gap-2 cursor-pointer flex-wrap",
652
- fn[C],
653
- nn,
654
- Ae,
655
- L && "input-disabled opacity-50 cursor-not-allowed",
656
- y && !Ae && "border-primary"
657
- ].filter(Boolean).join(" "),
658
- onClick: () => !L && O(!y),
659
- "data-testid": `${_}-trigger`,
660
- children: [
661
- /* @__PURE__ */ v("div", { className: "flex-1 flex flex-wrap items-center gap-1 min-w-0", children: en || /* @__PURE__ */ v("span", { className: "text-base-content/50", children: le }) }),
662
- q && h.length > 0 && !L && /* @__PURE__ */ v(
663
- "button",
664
- {
665
- type: "button",
666
- className: "hover:text-error flex-shrink-0",
667
- onClick: Ze,
668
- "aria-label": "Clear selection",
669
- "data-testid": `${_}-clear`,
670
- children: /* @__PURE__ */ v(
671
- "svg",
672
- {
673
- className: "w-4 h-4",
674
- fill: "none",
675
- viewBox: "0 0 24 24",
676
- stroke: "currentColor",
677
- "aria-hidden": "true",
678
- children: /* @__PURE__ */ v(
679
- "path",
680
- {
681
- strokeLinecap: "round",
682
- strokeLinejoin: "round",
683
- strokeWidth: 2,
684
- d: "M6 18L18 6M6 6l12 12"
685
- }
686
- )
687
- }
688
- )
689
- }
690
- ),
691
- Be || /* @__PURE__ */ v(
692
- "svg",
693
- {
694
- className: `w-4 h-4 flex-shrink-0 transition-transform ${y ? "rotate-180" : ""}`,
695
- fill: "none",
696
- viewBox: "0 0 24 24",
697
- stroke: "currentColor",
698
- "aria-hidden": "true",
699
- children: /* @__PURE__ */ v(
700
- "path",
701
- {
702
- strokeLinecap: "round",
703
- strokeLinejoin: "round",
704
- strokeWidth: 2,
705
- d: "M19 9l-7 7-7-7"
706
- }
707
- )
708
- }
709
- )
710
- ]
711
- }
712
- ),
713
- y && /* @__PURE__ */ z(
714
- "div",
715
- {
716
- id: ke,
717
- className: `absolute z-50 mt-1 w-full bg-base-100 border border-base-300 rounded-lg shadow-lg max-h-64 overflow-auto ${Fe}`,
718
- "data-testid": `${_}-dropdown`,
719
- children: [
720
- V && /* @__PURE__ */ v("div", { className: "p-2 border-b border-base-300", children: /* @__PURE__ */ v(
721
- "input",
722
- {
723
- ref: fe,
724
- type: "text",
725
- className: "input input-sm w-full",
726
- placeholder: "Search...",
727
- value: Q,
728
- onChange: De,
729
- onClick: (e) => e.stopPropagation(),
730
- "aria-label": "Search tree options",
731
- "data-testid": `${_}-search`
732
- }
733
- ) }),
734
- xe ? xe(He) : He
735
- ]
736
- }
737
- )
738
- ]
739
- }
740
- );
741
- }
742
- );
743
- Pe.displayName = "TreeSelect";
744
- const yn = Object.assign(Pe, {
745
- SHOW_ALL: cn,
746
- SHOW_PARENT: ln,
747
- SHOW_CHILD: an
171
+ const E = Object.assign(v, {
172
+ Title: N,
173
+ Paragraph: k,
174
+ Text: j,
175
+ Link: B
748
176
  });
749
177
  export {
750
- Pe as TreeSelect,
751
- yn as TreeSelectComponent,
752
- yn as default
178
+ E as Typography,
179
+ E as default
753
180
  };
754
181
  //# sourceMappingURL=index94.js.map