asterui 0.12.13 → 0.12.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button.d.ts +4 -0
- package/dist/components/Drawer.d.ts +47 -6
- package/dist/components/Dropdown.d.ts +65 -9
- package/dist/components/Input.d.ts +15 -1
- package/dist/components/Modal.d.ts +5 -1
- package/dist/components/Navbar.d.ts +15 -1
- package/dist/components/SidebarDrawer.d.ts +21 -0
- package/dist/components/Tabs.d.ts +30 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +169 -167
- package/dist/index.js.map +1 -1
- package/dist/index100.js +44 -11
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +10 -12
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +14 -7
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +7 -12
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +11 -29
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +29 -16
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +21 -0
- package/dist/index106.js.map +1 -0
- package/dist/index21.js +1 -1
- package/dist/index26.js +171 -40
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +41 -17
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +17 -33
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +33 -52
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +50 -61
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +60 -181
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +184 -18
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +15 -217
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +216 -1083
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +1086 -16
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +16 -121
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +119 -37
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +34 -208
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +390 -89
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +93 -158
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +211 -135
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +146 -15
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +15 -17
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +17 -21
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +18 -134
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +134 -10
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +13 -35
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +35 -34
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +34 -81
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +71 -166
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +167 -144
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +152 -11
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +10 -20
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +22 -14
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +14 -7
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +6 -310
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +334 -17
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +47 -122
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +120 -108
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +107 -167
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +167 -29
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +30 -120
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +116 -80
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +85 -19
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +19 -73
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +71 -54
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +56 -44
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +42 -49
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +52 -62
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +56 -101
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +107 -41
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +41 -68
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +66 -19
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +18 -55
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +55 -251
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +254 -22
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +22 -31
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +30 -93
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +89 -324
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +323 -50
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +79 -39
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +40 -23
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +21 -93
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +87 -148
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +147 -152
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +159 -63
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +65 -35
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +35 -234
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +231 -31
- package/dist/index89.js.map +1 -1
- package/dist/index9.js +69 -44
- package/dist/index9.js.map +1 -1
- package/dist/index90.js +34 -210
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +195 -198
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +159 -241
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +283 -166
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +173 -253
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +258 -14
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +12 -31
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +32 -5
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +5 -13
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +11 -43
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
package/dist/index40.js
CHANGED
|
@@ -1,165 +1,100 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return e === "#" ? /\d/.test(n) : e === "A" ? /[a-zA-Z]/.test(n) : e === "*" ? /[a-zA-Z0-9]/.test(n) : !1;
|
|
21
|
-
}
|
|
22
|
-
function q(n, e) {
|
|
23
|
-
for (let r = e; r < n.length; r++)
|
|
24
|
-
if (n[r] === "#" || n[r] === "A" || n[r] === "*")
|
|
25
|
-
return r;
|
|
26
|
-
return n.length;
|
|
27
|
-
}
|
|
28
|
-
const Y = U(
|
|
29
|
-
({
|
|
30
|
-
type: n = "text",
|
|
31
|
-
size: e,
|
|
32
|
-
color: r,
|
|
33
|
-
ghost: i = !1,
|
|
34
|
-
bordered: l = !0,
|
|
35
|
-
className: x = "",
|
|
36
|
-
mask: t,
|
|
37
|
-
maskPlaceholder: R = "_",
|
|
38
|
-
value: g,
|
|
39
|
-
defaultValue: N,
|
|
40
|
-
onChange: d,
|
|
41
|
-
onKeyDown: A,
|
|
42
|
-
...z
|
|
43
|
-
}, B) => {
|
|
44
|
-
const D = {
|
|
45
|
-
xs: "input-xs",
|
|
46
|
-
sm: "input-sm",
|
|
47
|
-
md: "input-md",
|
|
48
|
-
lg: "input-lg",
|
|
49
|
-
xl: "input-xl"
|
|
50
|
-
}, F = {
|
|
51
|
-
neutral: "input-neutral",
|
|
52
|
-
primary: "input-primary",
|
|
53
|
-
secondary: "input-secondary",
|
|
54
|
-
accent: "input-accent",
|
|
55
|
-
info: "input-info",
|
|
56
|
-
success: "input-success",
|
|
57
|
-
warning: "input-warning",
|
|
58
|
-
error: "input-error"
|
|
59
|
-
}, S = [
|
|
60
|
-
"input",
|
|
61
|
-
!l && "border-0",
|
|
62
|
-
i && "input-ghost",
|
|
63
|
-
e && D[e],
|
|
64
|
-
r && F[r],
|
|
65
|
-
x
|
|
66
|
-
].filter(Boolean).join(" "), G = W(null), C = B || G, H = M(() => t ? j(g ?? N ?? "", t) : "", [t, g, N]), [b, v] = _(H), [I, E] = _(null);
|
|
67
|
-
P(() => {
|
|
68
|
-
t && g !== void 0 && v(j(g, t));
|
|
69
|
-
}, [t, g]), P(() => {
|
|
70
|
-
I !== null && C.current && (C.current.setSelectionRange(I, I), E(null));
|
|
71
|
-
}, [I, C]);
|
|
72
|
-
const J = M(
|
|
73
|
-
(s) => {
|
|
74
|
-
if (!t) {
|
|
75
|
-
d?.(s);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const f = s.target, y = f.value, h = j(y, t);
|
|
79
|
-
let p = "", a = 0;
|
|
80
|
-
for (let c = 0; c < t.length && a < h.length; c++) {
|
|
81
|
-
const o = t[c];
|
|
82
|
-
(o === "#" || o === "A" || o === "*") && (X(h[a], o) && (p += h[a]), a++);
|
|
83
|
-
}
|
|
84
|
-
v(p);
|
|
85
|
-
const V = T(p, t, R);
|
|
86
|
-
let u = q(t, 0), w = 0;
|
|
87
|
-
for (let c = 0; c < t.length; c++) {
|
|
88
|
-
const o = t[c];
|
|
89
|
-
(o === "#" || o === "A" || o === "*") && w < p.length && (w++, u = c + 1);
|
|
90
|
-
}
|
|
91
|
-
u = q(t, u), u > t.length && (u = t.length), E(u);
|
|
92
|
-
const Q = {
|
|
93
|
-
...s,
|
|
94
|
-
target: { ...f, value: V },
|
|
95
|
-
currentTarget: { ...f, value: V }
|
|
96
|
-
};
|
|
97
|
-
d?.(Q);
|
|
98
|
-
},
|
|
99
|
-
[t, R, d]
|
|
100
|
-
), L = M(
|
|
101
|
-
(s) => {
|
|
102
|
-
if (!t) {
|
|
103
|
-
A?.(s);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (s.key === "Backspace") {
|
|
107
|
-
s.preventDefault();
|
|
108
|
-
const f = b.slice(0, -1);
|
|
109
|
-
v(f);
|
|
110
|
-
let y = 0, h = 0;
|
|
111
|
-
for (let u = 0; u < t.length; u++) {
|
|
112
|
-
const w = t[u];
|
|
113
|
-
if (w === "#" || w === "A" || w === "*")
|
|
114
|
-
if (h < f.length)
|
|
115
|
-
h++, y = u + 1;
|
|
116
|
-
else {
|
|
117
|
-
y = u;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
1
|
+
import { jsxs as e, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
const r = () => /* @__PURE__ */ a(
|
|
3
|
+
"svg",
|
|
4
|
+
{
|
|
5
|
+
width: "184",
|
|
6
|
+
height: "152",
|
|
7
|
+
viewBox: "0 0 184 152",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
className: "mx-auto",
|
|
10
|
+
children: /* @__PURE__ */ e("g", { fill: "none", fillRule: "evenodd", children: [
|
|
11
|
+
/* @__PURE__ */ e("g", { transform: "translate(24 31.67)", children: [
|
|
12
|
+
/* @__PURE__ */ a(
|
|
13
|
+
"ellipse",
|
|
14
|
+
{
|
|
15
|
+
className: "fill-base-300",
|
|
16
|
+
cx: "67.797",
|
|
17
|
+
cy: "106.89",
|
|
18
|
+
rx: "67.797",
|
|
19
|
+
ry: "12.668"
|
|
120
20
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
21
|
+
),
|
|
22
|
+
/* @__PURE__ */ a(
|
|
23
|
+
"path",
|
|
24
|
+
{
|
|
25
|
+
className: "fill-base-200",
|
|
26
|
+
d: "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ a(
|
|
30
|
+
"path",
|
|
31
|
+
{
|
|
32
|
+
className: "fill-base-100",
|
|
33
|
+
d: "M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",
|
|
34
|
+
transform: "translate(13.56)"
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
/* @__PURE__ */ a(
|
|
38
|
+
"ellipse",
|
|
39
|
+
{
|
|
40
|
+
className: "fill-base-300",
|
|
41
|
+
cx: "67.797",
|
|
42
|
+
cy: "106.89",
|
|
43
|
+
rx: "67.797",
|
|
44
|
+
ry: "12.668"
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ a(
|
|
48
|
+
"path",
|
|
49
|
+
{
|
|
50
|
+
className: "fill-base-200",
|
|
51
|
+
d: "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ a(
|
|
55
|
+
"path",
|
|
56
|
+
{
|
|
57
|
+
className: "fill-base-content opacity-10",
|
|
58
|
+
d: "M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ a(
|
|
62
|
+
"path",
|
|
63
|
+
{
|
|
64
|
+
className: "fill-base-100",
|
|
65
|
+
d: "M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ a(
|
|
70
|
+
"path",
|
|
135
71
|
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
className: S,
|
|
139
|
-
value: g,
|
|
140
|
-
defaultValue: N,
|
|
141
|
-
onChange: d,
|
|
142
|
-
onKeyDown: A,
|
|
143
|
-
...z
|
|
72
|
+
className: "fill-base-content opacity-10",
|
|
73
|
+
d: "M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"
|
|
144
74
|
}
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
type: "text",
|
|
152
|
-
className: S,
|
|
153
|
-
value: O,
|
|
154
|
-
onChange: J,
|
|
155
|
-
onKeyDown: L,
|
|
156
|
-
...z
|
|
157
|
-
}
|
|
158
|
-
);
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ e("g", { className: "fill-base-100", transform: "translate(149.65 15.383)", children: [
|
|
77
|
+
/* @__PURE__ */ a("ellipse", { cx: "20.654", cy: "3.167", rx: "2.849", ry: "2.815" }),
|
|
78
|
+
/* @__PURE__ */ a("path", { d: "M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z" })
|
|
79
|
+
] })
|
|
80
|
+
] })
|
|
159
81
|
}
|
|
160
|
-
)
|
|
161
|
-
|
|
82
|
+
), o = ({
|
|
83
|
+
children: l,
|
|
84
|
+
className: t = "",
|
|
85
|
+
description: s = "No Data",
|
|
86
|
+
image: c,
|
|
87
|
+
imageStyle: i,
|
|
88
|
+
...h
|
|
89
|
+
}) => {
|
|
90
|
+
const n = ["flex flex-col items-center justify-center py-8 px-4", t].filter(Boolean).join(" ");
|
|
91
|
+
return /* @__PURE__ */ e("div", { className: n, ...h, children: [
|
|
92
|
+
/* @__PURE__ */ a("div", { className: "mb-2", style: i, children: c === void 0 ? /* @__PURE__ */ a(r, {}) : c }),
|
|
93
|
+
s && /* @__PURE__ */ a("div", { className: "text-base-content/60 text-sm mb-4", children: s }),
|
|
94
|
+
l && /* @__PURE__ */ a("div", { className: "mt-2", children: l })
|
|
95
|
+
] });
|
|
96
|
+
};
|
|
162
97
|
export {
|
|
163
|
-
|
|
98
|
+
o as Empty
|
|
164
99
|
};
|
|
165
100
|
//# sourceMappingURL=index40.js.map
|
package/dist/index40.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index40.js","sources":["../src/components/Input.tsx"],"sourcesContent":["import React, { forwardRef, useState, useCallback, useRef, useEffect } from 'react'\n\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {\n type?: 'text' | 'password' | 'email' | 'number' | 'date' | 'datetime-local' | 'week' | 'month' | 'tel' | 'url' | 'search' | 'time'\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'\n ghost?: boolean\n bordered?: boolean\n className?: string\n /** Input mask pattern. Use # for digits, A for letters, * for alphanumeric */\n mask?: string\n /** Placeholder character shown in mask (default: _) */\n maskPlaceholder?: string\n}\n\n// Helper to apply mask to raw value\nfunction applyMask(raw: string, mask: string, placeholder: string): string {\n let result = ''\n let rawIndex = 0\n\n for (let i = 0; i < mask.length && rawIndex <= raw.length; i++) {\n const maskChar = mask[i]\n if (maskChar === '#' || maskChar === 'A' || maskChar === '*') {\n if (rawIndex < raw.length) {\n result += raw[rawIndex]\n rawIndex++\n } else {\n result += placeholder\n }\n } else {\n result += maskChar\n }\n }\n\n return result\n}\n\n// Extract raw value from masked input\nfunction extractRaw(value: string, mask: string): string {\n let raw = ''\n for (let i = 0; i < value.length && i < mask.length; i++) {\n const maskChar = mask[i]\n if ((maskChar === '#' || maskChar === 'A' || maskChar === '*') && value[i] !== '_') {\n raw += value[i]\n }\n }\n return raw\n}\n\n// Check if character is valid for mask position\nfunction isValidChar(char: string, maskChar: string): boolean {\n if (maskChar === '#') return /\\d/.test(char)\n if (maskChar === 'A') return /[a-zA-Z]/.test(char)\n if (maskChar === '*') return /[a-zA-Z0-9]/.test(char)\n return false\n}\n\n// Find next input position in mask\nfunction findNextInputPosition(mask: string, fromIndex: number): number {\n for (let i = fromIndex; i < mask.length; i++) {\n if (mask[i] === '#' || mask[i] === 'A' || mask[i] === '*') {\n return i\n }\n }\n return mask.length\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\n (\n {\n type = 'text',\n size,\n color,\n ghost = false,\n bordered = true,\n className = '',\n mask,\n maskPlaceholder = '_',\n value,\n defaultValue,\n onChange,\n onKeyDown,\n ...props\n },\n ref\n ) => {\n const sizeClasses = {\n xs: 'input-xs',\n sm: 'input-sm',\n md: 'input-md',\n lg: 'input-lg',\n xl: 'input-xl',\n }\n\n const colorClasses = {\n neutral: 'input-neutral',\n primary: 'input-primary',\n secondary: 'input-secondary',\n accent: 'input-accent',\n info: 'input-info',\n success: 'input-success',\n warning: 'input-warning',\n error: 'input-error',\n }\n\n const inputClasses = [\n 'input',\n !bordered && 'border-0',\n ghost && 'input-ghost',\n size && sizeClasses[size],\n color && colorClasses[color],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n // Mask handling\n const innerRef = useRef<HTMLInputElement>(null)\n const inputRef = (ref as React.RefObject<HTMLInputElement>) || innerRef\n\n const getInitialRaw = useCallback(() => {\n if (!mask) return ''\n const initial = (value ?? defaultValue ?? '') as string\n return extractRaw(initial, mask)\n }, [mask, value, defaultValue])\n\n const [rawValue, setRawValue] = useState(getInitialRaw)\n const [cursorPos, setCursorPos] = useState<number | null>(null)\n\n // Sync with controlled value\n useEffect(() => {\n if (mask && value !== undefined) {\n setRawValue(extractRaw(value as string, mask))\n }\n }, [mask, value])\n\n // Set cursor position after render\n useEffect(() => {\n if (cursorPos !== null && inputRef.current) {\n inputRef.current.setSelectionRange(cursorPos, cursorPos)\n setCursorPos(null)\n }\n }, [cursorPos, inputRef])\n\n const handleMaskedChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (!mask) {\n onChange?.(e)\n return\n }\n\n const input = e.target\n const inputValue = input.value\n\n // Extract what the user is trying to type\n const newRaw = extractRaw(inputValue, mask)\n\n // Filter to only valid characters\n let filteredRaw = ''\n let rawIdx = 0\n for (let i = 0; i < mask.length && rawIdx < newRaw.length; i++) {\n const maskChar = mask[i]\n if (maskChar === '#' || maskChar === 'A' || maskChar === '*') {\n if (isValidChar(newRaw[rawIdx], maskChar)) {\n filteredRaw += newRaw[rawIdx]\n }\n rawIdx++\n }\n }\n\n setRawValue(filteredRaw)\n\n // Calculate new cursor position\n const maskedValue = applyMask(filteredRaw, mask, maskPlaceholder)\n let newCursor = findNextInputPosition(mask, 0)\n let charsPlaced = 0\n for (let i = 0; i < mask.length; i++) {\n const maskChar = mask[i]\n if (maskChar === '#' || maskChar === 'A' || maskChar === '*') {\n if (charsPlaced < filteredRaw.length) {\n charsPlaced++\n newCursor = i + 1\n }\n }\n }\n // Skip to next input position if we're on a literal\n newCursor = findNextInputPosition(mask, newCursor)\n if (newCursor > mask.length) newCursor = mask.length\n\n setCursorPos(newCursor)\n\n // Create synthetic event with masked value\n const syntheticEvent = {\n ...e,\n target: { ...input, value: maskedValue },\n currentTarget: { ...input, value: maskedValue },\n } as React.ChangeEvent<HTMLInputElement>\n\n onChange?.(syntheticEvent)\n },\n [mask, maskPlaceholder, onChange]\n )\n\n const handleMaskedKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (!mask) {\n onKeyDown?.(e)\n return\n }\n\n if (e.key === 'Backspace') {\n e.preventDefault()\n const newRaw = rawValue.slice(0, -1)\n setRawValue(newRaw)\n\n // Calculate cursor position\n let newCursor = 0\n let charsPlaced = 0\n for (let i = 0; i < mask.length; i++) {\n const maskChar = mask[i]\n if (maskChar === '#' || maskChar === 'A' || maskChar === '*') {\n if (charsPlaced < newRaw.length) {\n charsPlaced++\n newCursor = i + 1\n } else {\n newCursor = i\n break\n }\n }\n }\n setCursorPos(newCursor)\n\n const maskedValue = applyMask(newRaw, mask, maskPlaceholder)\n const input = e.currentTarget\n const syntheticEvent = {\n target: { ...input, value: maskedValue },\n currentTarget: { ...input, value: maskedValue },\n } as unknown as React.ChangeEvent<HTMLInputElement>\n\n onChange?.(syntheticEvent)\n }\n\n onKeyDown?.(e)\n },\n [mask, maskPlaceholder, rawValue, onChange, onKeyDown]\n )\n\n // If no mask, render simple input\n if (!mask) {\n return (\n <input\n ref={ref}\n type={type}\n className={inputClasses}\n value={value}\n defaultValue={defaultValue}\n onChange={onChange}\n onKeyDown={onKeyDown}\n {...props}\n />\n )\n }\n\n // Render masked input\n const maskedValue = applyMask(rawValue, mask, maskPlaceholder)\n\n return (\n <input\n ref={inputRef}\n type=\"text\"\n className={inputClasses}\n value={maskedValue}\n onChange={handleMaskedChange}\n onKeyDown={handleMaskedKeyDown}\n {...props}\n />\n )\n }\n)\n\nInput.displayName = 'Input'\n"],"names":["applyMask","raw","mask","placeholder","result","rawIndex","i","maskChar","extractRaw","value","isValidChar","char","findNextInputPosition","fromIndex","Input","forwardRef","type","size","color","ghost","bordered","className","maskPlaceholder","defaultValue","onChange","onKeyDown","props","ref","sizeClasses","colorClasses","inputClasses","innerRef","useRef","inputRef","getInitialRaw","useCallback","rawValue","setRawValue","useState","cursorPos","setCursorPos","useEffect","handleMaskedChange","e","input","inputValue","newRaw","filteredRaw","rawIdx","maskedValue","newCursor","charsPlaced","syntheticEvent","handleMaskedKeyDown","jsx"],"mappings":";;AAgBA,SAASA,EAAUC,GAAaC,GAAcC,GAA6B;AACzE,MAAIC,IAAS,IACTC,IAAW;AAEf,WAASC,IAAI,GAAGA,IAAIJ,EAAK,UAAUG,KAAYJ,EAAI,QAAQK,KAAK;AAC9D,UAAMC,IAAWL,EAAKI,CAAC;AACvB,IAAIC,MAAa,OAAOA,MAAa,OAAOA,MAAa,MACnDF,IAAWJ,EAAI,UACjBG,KAAUH,EAAII,CAAQ,GACtBA,OAEAD,KAAUD,IAGZC,KAAUG;AAAA,EAEd;AAEA,SAAOH;AACT;AAGA,SAASI,EAAWC,GAAeP,GAAsB;AACvD,MAAID,IAAM;AACV,WAAS,IAAI,GAAG,IAAIQ,EAAM,UAAU,IAAIP,EAAK,QAAQ,KAAK;AACxD,UAAMK,IAAWL,EAAK,CAAC;AACvB,KAAKK,MAAa,OAAOA,MAAa,OAAOA,MAAa,QAAQE,EAAM,CAAC,MAAM,QAC7ER,KAAOQ,EAAM,CAAC;AAAA,EAElB;AACA,SAAOR;AACT;AAGA,SAASS,EAAYC,GAAcJ,GAA2B;AAC5D,SAAIA,MAAa,MAAY,KAAK,KAAKI,CAAI,IACvCJ,MAAa,MAAY,WAAW,KAAKI,CAAI,IAC7CJ,MAAa,MAAY,cAAc,KAAKI,CAAI,IAC7C;AACT;AAGA,SAASC,EAAsBV,GAAcW,GAA2B;AACtE,WAASP,IAAIO,GAAWP,IAAIJ,EAAK,QAAQI;AACvC,Q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C,KAAA3B;AAAA,UACA,MAAAX;AAAA,UACA,WAAWc;AAAA,UACX,OAAArB;AAAA,UACA,cAAAc;AAAA,UACA,UAAAC;AAAA,UACA,WAAAC;AAAA,UACC,GAAGC;AAAA,QAAA;AAAA,MAAA;AAMV,UAAMuB,IAAcjD,EAAUoC,GAAUlC,GAAMoB,CAAe;AAE7D,WACE,gBAAAgC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKrB;AAAA,QACL,MAAK;AAAA,QACL,WAAWH;AAAA,QACX,OAAOmB;AAAA,QACP,UAAUP;AAAA,QACV,WAAWW;AAAA,QACV,GAAG3B;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAZ,EAAM,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index40.js","sources":["../src/components/Empty.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface EmptyProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode\n description?: React.ReactNode\n image?: React.ReactNode\n imageStyle?: React.CSSProperties\n}\n\nconst DefaultEmptyImage: React.FC = () => (\n <svg\n width=\"184\"\n height=\"152\"\n viewBox=\"0 0 184 152\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"mx-auto\"\n >\n <g fill=\"none\" fillRule=\"evenodd\">\n <g transform=\"translate(24 31.67)\">\n <ellipse\n className=\"fill-base-300\"\n cx=\"67.797\"\n cy=\"106.89\"\n rx=\"67.797\"\n ry=\"12.668\"\n />\n <path\n className=\"fill-base-200\"\n d=\"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z\"\n />\n <path\n className=\"fill-base-100\"\n d=\"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z\"\n transform=\"translate(13.56)\"\n />\n <ellipse\n className=\"fill-base-300\"\n cx=\"67.797\"\n cy=\"106.89\"\n rx=\"67.797\"\n ry=\"12.668\"\n />\n <path\n className=\"fill-base-200\"\n d=\"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z\"\n />\n <path\n className=\"fill-base-content opacity-10\"\n d=\"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z\"\n />\n <path\n className=\"fill-base-100\"\n d=\"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z\"\n />\n </g>\n <path\n className=\"fill-base-content opacity-10\"\n d=\"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z\"\n />\n <g className=\"fill-base-100\" transform=\"translate(149.65 15.383)\">\n <ellipse cx=\"20.654\" cy=\"3.167\" rx=\"2.849\" ry=\"2.815\" />\n <path d=\"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z\" />\n </g>\n </g>\n </svg>\n)\n\nexport const Empty: React.FC<EmptyProps> = ({\n children,\n className = '',\n description = 'No Data',\n image,\n imageStyle,\n ...rest\n}) => {\n const classes = ['flex flex-col items-center justify-center py-8 px-4', className]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div className={classes} {...rest}>\n <div className=\"mb-2\" style={imageStyle}>\n {image === undefined ? <DefaultEmptyImage /> : image}\n </div>\n {description && (\n <div className=\"text-base-content/60 text-sm mb-4\">{description}</div>\n )}\n {children && <div className=\"mt-2\">{children}</div>}\n </div>\n )\n}\n"],"names":["DefaultEmptyImage","jsx","jsxs","Empty","children","className","description","image","imageStyle","rest","classes"],"mappings":";AASA,MAAMA,IAA8B,MAClC,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,OAAM;AAAA,IACN,WAAU;AAAA,IAEV,UAAA,gBAAAC,EAAC,KAAA,EAAE,MAAK,QAAO,UAAS,WACtB,UAAA;AAAA,MAAA,gBAAAA,EAAC,KAAA,EAAE,WAAU,uBACX,UAAA;AAAA,QAAA,gBAAAD;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAG;AAAA,YACH,IAAG;AAAA,YACH,IAAG;AAAA,YACH,IAAG;AAAA,UAAA;AAAA,QAAA;AAAA,QAEL,gBAAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,GAAE;AAAA,UAAA;AAAA,QAAA;AAAA,QAEJ,gBAAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,GAAE;AAAA,YACF,WAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAEZ,gBAAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAG;AAAA,YACH,IAAG;AAAA,YACH,IAAG;AAAA,YACH,IAAG;AAAA,UAAA;AAA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AY;AAAA,IAEjEF,KAAY,gBAAAH,EAAC,OAAA,EAAI,WAAU,QAAQ,UAAAG,EAAA,CAAS;AAAA,EAAA,GAC/C;AAEJ;"}
|
package/dist/index41.js
CHANGED
|
@@ -1,149 +1,225 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
|
|
1
|
+
import { jsx as y, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as at, useRef as ft, useCallback as z, useState as G, useEffect as H } from "react";
|
|
3
|
+
function S(e, r, c) {
|
|
4
|
+
let l = "", s = 0;
|
|
5
|
+
for (let p = 0; p < r.length && s <= e.length; p++) {
|
|
6
|
+
const b = r[p];
|
|
7
|
+
b === "#" || b === "A" || b === "*" ? s < e.length ? (l += e[s], s++) : l += c : l += b;
|
|
8
|
+
}
|
|
9
|
+
return l;
|
|
10
|
+
}
|
|
11
|
+
function J(e, r, c) {
|
|
12
|
+
let l = "";
|
|
13
|
+
for (let s = 0; s < e.length && s < r.length; s++) {
|
|
14
|
+
const p = r[s];
|
|
15
|
+
(p === "#" || p === "A" || p === "*") && e[s] !== c && (l += e[s]);
|
|
16
|
+
}
|
|
17
|
+
return l;
|
|
18
|
+
}
|
|
19
|
+
function pt(e, r) {
|
|
20
|
+
return r === "#" ? /\d/.test(e) : r === "A" ? /[a-zA-Z]/.test(e) : r === "*" ? /[a-zA-Z0-9]/.test(e) : !1;
|
|
21
|
+
}
|
|
22
|
+
function k(e, r) {
|
|
23
|
+
for (let c = r; c < e.length; c++)
|
|
24
|
+
if (e[c] === "#" || e[c] === "A" || e[c] === "*")
|
|
25
|
+
return c;
|
|
26
|
+
return e.length;
|
|
27
|
+
}
|
|
28
|
+
const dt = ({ onClick: e, className: r }) => /* @__PURE__ */ y(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
type: "button",
|
|
32
|
+
onClick: e,
|
|
33
|
+
className: `flex items-center justify-center opacity-50 hover:opacity-100 transition-opacity ${r || ""}`,
|
|
34
|
+
"aria-label": "Clear input",
|
|
35
|
+
tabIndex: -1,
|
|
36
|
+
children: /* @__PURE__ */ y("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ y("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
37
|
+
}
|
|
38
|
+
), gt = at(
|
|
4
39
|
({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
type: e = "text",
|
|
41
|
+
size: r,
|
|
42
|
+
color: c,
|
|
43
|
+
status: l,
|
|
44
|
+
ghost: s = !1,
|
|
45
|
+
bordered: p = !0,
|
|
46
|
+
className: b = "",
|
|
47
|
+
mask: t,
|
|
48
|
+
maskPlaceholder: u = "_",
|
|
49
|
+
allowClear: R,
|
|
50
|
+
onClear: O,
|
|
51
|
+
prefix: B,
|
|
52
|
+
suffix: A,
|
|
53
|
+
errorId: Q,
|
|
54
|
+
value: i,
|
|
55
|
+
defaultValue: N,
|
|
56
|
+
onChange: a,
|
|
57
|
+
onKeyDown: V,
|
|
58
|
+
disabled: Z,
|
|
59
|
+
required: W,
|
|
60
|
+
...U
|
|
61
|
+
}, tt) => {
|
|
62
|
+
const et = {
|
|
63
|
+
xs: "input-xs",
|
|
64
|
+
sm: "input-sm",
|
|
65
|
+
md: "input-md",
|
|
66
|
+
lg: "input-lg",
|
|
67
|
+
xl: "input-xl"
|
|
68
|
+
}, nt = l ? {
|
|
69
|
+
error: "input-error",
|
|
70
|
+
warning: "input-warning"
|
|
71
|
+
}[l] : c ? {
|
|
72
|
+
neutral: "input-neutral",
|
|
73
|
+
primary: "input-primary",
|
|
74
|
+
secondary: "input-secondary",
|
|
75
|
+
accent: "input-accent",
|
|
76
|
+
info: "input-info",
|
|
77
|
+
success: "input-success",
|
|
78
|
+
warning: "input-warning",
|
|
79
|
+
error: "input-error"
|
|
80
|
+
}[c] : "", _ = [
|
|
81
|
+
"input",
|
|
82
|
+
!p && "border-0",
|
|
83
|
+
s && "input-ghost",
|
|
84
|
+
r && et[r],
|
|
85
|
+
nt,
|
|
86
|
+
b
|
|
87
|
+
].filter(Boolean).join(" "), rt = ft(null), d = tt || rt, it = z(() => t ? J(i ?? N ?? "", t, u) : "", [t, i, N, u]), [j, E] = G(it), [T, $] = G(null);
|
|
88
|
+
H(() => {
|
|
89
|
+
t && i !== void 0 && E(J(i, t, u));
|
|
90
|
+
}, [t, i, u]), H(() => {
|
|
91
|
+
T !== null && d.current && (d.current.setSelectionRange(T, T), $(null));
|
|
92
|
+
}, [T, d]);
|
|
93
|
+
const X = z(
|
|
94
|
+
(n) => {
|
|
95
|
+
if (!t) {
|
|
96
|
+
a?.(n);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const f = n.target, w = f.value, I = J(w, t, u);
|
|
100
|
+
let x = "", v = 0;
|
|
101
|
+
for (let g = 0; g < t.length && v < I.length; g++) {
|
|
102
|
+
const h = t[g];
|
|
103
|
+
(h === "#" || h === "A" || h === "*") && (pt(I[v], h) && (x += I[v]), v++);
|
|
104
|
+
}
|
|
105
|
+
E(x);
|
|
106
|
+
const L = S(x, t, u);
|
|
107
|
+
let o = k(t, 0), C = 0;
|
|
108
|
+
for (let g = 0; g < t.length; g++) {
|
|
109
|
+
const h = t[g];
|
|
110
|
+
(h === "#" || h === "A" || h === "*") && C < x.length && (C++, o = g + 1);
|
|
111
|
+
}
|
|
112
|
+
o = k(t, o), o > t.length && (o = t.length), $(o);
|
|
113
|
+
const ut = {
|
|
114
|
+
...n,
|
|
115
|
+
target: { ...f, value: L },
|
|
116
|
+
currentTarget: { ...f, value: L }
|
|
117
|
+
};
|
|
118
|
+
a?.(ut);
|
|
119
|
+
},
|
|
120
|
+
[t, u, a]
|
|
121
|
+
), Y = z(
|
|
122
|
+
(n) => {
|
|
123
|
+
if (!t) {
|
|
124
|
+
V?.(n);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (n.key === "Backspace") {
|
|
128
|
+
n.preventDefault();
|
|
129
|
+
const f = j.slice(0, -1);
|
|
130
|
+
E(f);
|
|
131
|
+
let w = 0, I = 0;
|
|
132
|
+
for (let o = 0; o < t.length; o++) {
|
|
133
|
+
const C = t[o];
|
|
134
|
+
if (C === "#" || C === "A" || C === "*")
|
|
135
|
+
if (I < f.length)
|
|
136
|
+
I++, w = o + 1;
|
|
137
|
+
else {
|
|
138
|
+
w = o;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
$(w);
|
|
143
|
+
const x = S(f, t, u), v = n.currentTarget, L = {
|
|
144
|
+
target: { ...v, value: x },
|
|
145
|
+
currentTarget: { ...v, value: x }
|
|
146
|
+
};
|
|
147
|
+
a?.(L);
|
|
148
|
+
}
|
|
149
|
+
V?.(n);
|
|
150
|
+
},
|
|
151
|
+
[t, u, j, a, V]
|
|
152
|
+
), [q, D] = G(i ?? N ?? "");
|
|
153
|
+
H(() => {
|
|
154
|
+
i !== void 0 && D(i);
|
|
155
|
+
}, [i]);
|
|
156
|
+
const ct = z((n) => {
|
|
157
|
+
D(n.target.value), a?.(n);
|
|
158
|
+
}, [a]), st = z(() => {
|
|
159
|
+
if (D(""), E(""), O?.(), a && d.current) {
|
|
160
|
+
const n = {
|
|
161
|
+
target: { ...d.current, value: "" },
|
|
162
|
+
currentTarget: { ...d.current, value: "" }
|
|
163
|
+
};
|
|
164
|
+
a(n);
|
|
38
165
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (l) return;
|
|
43
|
-
u((n ?? 0) + p);
|
|
44
|
-
}, y = () => {
|
|
45
|
-
if (l) return;
|
|
46
|
-
u((n ?? 0) - p);
|
|
47
|
-
}, M = (t) => {
|
|
48
|
-
const e = L(t.target.value);
|
|
49
|
-
e !== null ? u(e) : t.target.value === "" && u(null);
|
|
50
|
-
}, $ = (t) => {
|
|
51
|
-
l || (t.key === "ArrowUp" ? (t.preventDefault(), g()) : t.key === "ArrowDown" && (t.preventDefault(), y()));
|
|
52
|
-
}, F = () => {
|
|
53
|
-
n !== null && (n < i || n > c) && u(b(n));
|
|
54
|
-
}, R = [
|
|
166
|
+
}, [O, a, d]), F = R && (t ? j : q) && !Z, ot = typeof R == "object" && R.clearIcon ? R.clearIcon : null, M = {};
|
|
167
|
+
l === "error" && (M["aria-invalid"] = !0), Q && (M["aria-describedby"] = Q), W && (M["aria-required"] = !0);
|
|
168
|
+
const K = B || A || R, P = (n, f, w) => /* @__PURE__ */ y(
|
|
55
169
|
"input",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
170
|
+
{
|
|
171
|
+
ref: d,
|
|
172
|
+
type: t ? "text" : e,
|
|
173
|
+
className: n,
|
|
174
|
+
value: f ?? i,
|
|
175
|
+
defaultValue: !f && !i ? N : void 0,
|
|
176
|
+
onChange: w ?? a,
|
|
177
|
+
onKeyDown: t ? Y : V,
|
|
178
|
+
disabled: Z,
|
|
179
|
+
required: W,
|
|
180
|
+
...M,
|
|
181
|
+
...U
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
if (!t && !K)
|
|
185
|
+
return P(_);
|
|
186
|
+
if (t && !K) {
|
|
187
|
+
const n = S(j, t, u);
|
|
188
|
+
return P(_, n, X);
|
|
189
|
+
}
|
|
190
|
+
const lt = t ? S(j, t, u) : void 0;
|
|
191
|
+
return /* @__PURE__ */ m("div", { className: "relative flex items-center", children: [
|
|
192
|
+
B && /* @__PURE__ */ y("span", { className: "absolute left-3 flex items-center text-base-content/70 pointer-events-none z-10", children: B }),
|
|
193
|
+
/* @__PURE__ */ y(
|
|
70
194
|
"input",
|
|
71
195
|
{
|
|
72
|
-
ref:
|
|
73
|
-
type: "text",
|
|
74
|
-
className:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
196
|
+
ref: d,
|
|
197
|
+
type: t ? "text" : e,
|
|
198
|
+
className: [
|
|
199
|
+
_,
|
|
200
|
+
"w-full",
|
|
201
|
+
B && "pl-10",
|
|
202
|
+
(A || F) && "pr-10"
|
|
203
|
+
].filter(Boolean).join(" "),
|
|
204
|
+
value: lt ?? (i !== void 0 ? i : q),
|
|
205
|
+
defaultValue: i === void 0 && !t ? N : void 0,
|
|
206
|
+
onChange: t ? X : ct,
|
|
207
|
+
onKeyDown: t ? Y : V,
|
|
208
|
+
disabled: Z,
|
|
209
|
+
required: W,
|
|
210
|
+
...M,
|
|
211
|
+
...U
|
|
81
212
|
}
|
|
82
213
|
),
|
|
83
|
-
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
type: "button",
|
|
88
|
-
className: `btn ${N} btn-ghost px-1 min-h-0 h-3.5`,
|
|
89
|
-
onClick: g,
|
|
90
|
-
disabled: l || n !== null && n >= c,
|
|
91
|
-
tabIndex: -1,
|
|
92
|
-
children: /* @__PURE__ */ r(
|
|
93
|
-
"svg",
|
|
94
|
-
{
|
|
95
|
-
className: "w-3 h-3",
|
|
96
|
-
fill: "none",
|
|
97
|
-
viewBox: "0 0 24 24",
|
|
98
|
-
stroke: "currentColor",
|
|
99
|
-
children: /* @__PURE__ */ r(
|
|
100
|
-
"path",
|
|
101
|
-
{
|
|
102
|
-
strokeLinecap: "round",
|
|
103
|
-
strokeLinejoin: "round",
|
|
104
|
-
strokeWidth: 2,
|
|
105
|
-
d: "M5 15l7-7 7 7"
|
|
106
|
-
}
|
|
107
|
-
)
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
),
|
|
112
|
-
/* @__PURE__ */ r(
|
|
113
|
-
"button",
|
|
114
|
-
{
|
|
115
|
-
type: "button",
|
|
116
|
-
className: `btn ${N} btn-ghost px-1 min-h-0 h-3.5`,
|
|
117
|
-
onClick: y,
|
|
118
|
-
disabled: l || n !== null && n <= i,
|
|
119
|
-
tabIndex: -1,
|
|
120
|
-
children: /* @__PURE__ */ r(
|
|
121
|
-
"svg",
|
|
122
|
-
{
|
|
123
|
-
className: "w-3 h-3",
|
|
124
|
-
fill: "none",
|
|
125
|
-
viewBox: "0 0 24 24",
|
|
126
|
-
stroke: "currentColor",
|
|
127
|
-
children: /* @__PURE__ */ r(
|
|
128
|
-
"path",
|
|
129
|
-
{
|
|
130
|
-
strokeLinecap: "round",
|
|
131
|
-
strokeLinejoin: "round",
|
|
132
|
-
strokeWidth: 2,
|
|
133
|
-
d: "M19 9l-7 7-7-7"
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
)
|
|
214
|
+
(A || F) && /* @__PURE__ */ m("span", { className: "absolute right-3 flex items-center gap-1 z-10", children: [
|
|
215
|
+
F && (ot || /* @__PURE__ */ y(dt, { onClick: st })),
|
|
216
|
+
A && /* @__PURE__ */ y("span", { className: "text-base-content/70", children: A })
|
|
140
217
|
] })
|
|
141
218
|
] });
|
|
142
219
|
}
|
|
143
220
|
);
|
|
144
|
-
|
|
221
|
+
gt.displayName = "Input";
|
|
145
222
|
export {
|
|
146
|
-
|
|
147
|
-
H as default
|
|
223
|
+
gt as Input
|
|
148
224
|
};
|
|
149
225
|
//# sourceMappingURL=index41.js.map
|