asterui 0.12.2 → 0.12.4
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/Kbd.d.ts +2 -1
- package/dist/components/Modal.d.ts +7 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +196 -201
- package/dist/index.js.map +1 -1
- package/dist/index100.js +11 -44
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +12 -10
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +7 -14
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +12 -7
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +29 -11
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +16 -29
- package/dist/index105.js.map +1 -1
- package/dist/index13.js +95 -35
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +153 -90
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +146 -154
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +5 -150
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +71 -5
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +17 -71
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +96 -15
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +105 -89
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +177 -107
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +107 -181
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +19 -110
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +41 -17
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +32 -43
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +41 -32
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +12 -41
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +33 -12
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +63 -33
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +77 -60
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +18 -80
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +217 -15
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +1078 -216
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +17 -1081
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +121 -17
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +37 -119
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +182 -31
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +97 -191
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +158 -93
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +139 -155
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +15 -146
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +17 -15
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +21 -18
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +116 -18
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +10 -116
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +35 -13
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +34 -35
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +116 -10
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +174 -114
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +136 -165
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +11 -146
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +20 -10
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +14 -22
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +7 -14
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +268 -6
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +17 -266
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +122 -17
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +108 -120
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +167 -107
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +29 -167
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +120 -30
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +80 -116
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +19 -85
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +73 -19
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +54 -71
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +44 -56
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +49 -42
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +62 -52
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +101 -56
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +41 -107
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +68 -41
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +19 -66
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +43 -18
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +132 -44
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +50 -132
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +21 -51
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +31 -22
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +22 -31
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +327 -20
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +50 -323
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +40 -56
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +23 -40
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +93 -21
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +123 -88
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +154 -123
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +63 -159
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +35 -65
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +234 -35
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +31 -231
- package/dist/index89.js.map +1 -1
- package/dist/index90.js +210 -34
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +198 -195
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +241 -159
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +166 -283
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +253 -173
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +14 -258
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +31 -12
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +5 -32
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +13 -5
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +43 -11
- package/dist/index99.js.map +1 -1
- package/package.json +11 -5
- package/dist/components/Calendar.d.ts +0 -23
- package/dist/index.css +0 -1
- package/dist/index106.js +0 -21
- package/dist/index106.js.map +0 -1
- package/dist/index107.js +0 -177
- package/dist/index107.js.map +0 -1
- package/dist/index109.js +0 -10796
- package/dist/index109.js.map +0 -1
- package/dist/index110.js +0 -8
- package/dist/index110.js.map +0 -1
- package/dist/index111.js +0 -45
- package/dist/index111.js.map +0 -1
- package/dist/index112.js +0 -5
- package/dist/index112.js.map +0 -1
- package/dist/index113.js +0 -10
- package/dist/index113.js.map +0 -1
- package/dist/index114.js +0 -155
- package/dist/index114.js.map +0 -1
- package/dist/index115.js +0 -33
- package/dist/index115.js.map +0 -1
- package/dist/index116.js +0 -33
- package/dist/index116.js.map +0 -1
- package/dist/index117.js +0 -5
- package/dist/index117.js.map +0 -1
- package/dist/index118.js +0 -75
- package/dist/index118.js.map +0 -1
- package/dist/index119.js +0 -42
- package/dist/index119.js.map +0 -1
- package/dist/index120.js +0 -29
- package/dist/index120.js.map +0 -1
- package/dist/index121.js +0 -24
- package/dist/index121.js.map +0 -1
- package/dist/index122.js +0 -27
- package/dist/index122.js.map +0 -1
- package/dist/index123.js +0 -23
- package/dist/index123.js.map +0 -1
- package/dist/index124.js +0 -103
- package/dist/index124.js.map +0 -1
- package/dist/index125.js +0 -363
- package/dist/index125.js.map +0 -1
- package/dist/index126.js +0 -28
- package/dist/index126.js.map +0 -1
- package/dist/index127.js +0 -76
- package/dist/index127.js.map +0 -1
- package/dist/index128.js +0 -19
- package/dist/index128.js.map +0 -1
- package/dist/index129.js +0 -69
- package/dist/index129.js.map +0 -1
- package/dist/index130.js +0 -147
- package/dist/index130.js.map +0 -1
- package/dist/index131.js +0 -5
- package/dist/index131.js.map +0 -1
- package/dist/index132.js +0 -59
- package/dist/index132.js.map +0 -1
- package/dist/index133.js +0 -5
- package/dist/index133.js.map +0 -1
- package/dist/index134.js +0 -5
- package/dist/index134.js.map +0 -1
- package/dist/index135.js +0 -5
- package/dist/index135.js.map +0 -1
- package/dist/index136.js +0 -5
- package/dist/index136.js.map +0 -1
- package/dist/index137.js +0 -5
- package/dist/index137.js.map +0 -1
- package/dist/index138.js +0 -5
- package/dist/index138.js.map +0 -1
- package/dist/index139.js +0 -5
- package/dist/index139.js.map +0 -1
- package/dist/index140.js +0 -5
- package/dist/index140.js.map +0 -1
- package/dist/index141.js +0 -35
- package/dist/index141.js.map +0 -1
- package/dist/index142.js +0 -5
- package/dist/index142.js.map +0 -1
- package/dist/index143.js +0 -11
- package/dist/index143.js.map +0 -1
- package/dist/index144.js +0 -5
- package/dist/index144.js.map +0 -1
- package/dist/index145.js +0 -5
- package/dist/index145.js.map +0 -1
- package/dist/index146.js +0 -24
- package/dist/index146.js.map +0 -1
- package/dist/index147.js +0 -5
- package/dist/index147.js.map +0 -1
- package/dist/index148.js +0 -27
- package/dist/index148.js.map +0 -1
- package/dist/index149.js +0 -74
- package/dist/index149.js.map +0 -1
- package/dist/index150.js +0 -24
- package/dist/index150.js.map +0 -1
- package/dist/index151.js +0 -37
- package/dist/index151.js.map +0 -1
- package/dist/index152.js +0 -73
- package/dist/index152.js.map +0 -1
- package/dist/index153.js +0 -5
- package/dist/index153.js.map +0 -1
- package/dist/index154.js +0 -25
- package/dist/index154.js.map +0 -1
- package/dist/index155.js +0 -5
- package/dist/index155.js.map +0 -1
- package/dist/index156.js +0 -5
- package/dist/index156.js.map +0 -1
- package/dist/index157.js +0 -5
- package/dist/index157.js.map +0 -1
- package/dist/index158.js +0 -5
- package/dist/index158.js.map +0 -1
- package/dist/index159.js +0 -7
- package/dist/index159.js.map +0 -1
package/dist/index30.js
CHANGED
|
@@ -1,66 +1,83 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useEffect as v } from "react";
|
|
3
|
+
const k = {
|
|
4
|
+
left: "tooltip-left",
|
|
5
|
+
right: "tooltip-right",
|
|
6
|
+
top: "tooltip-top",
|
|
7
|
+
bottom: "tooltip-bottom"
|
|
8
|
+
}, f = ({
|
|
9
|
+
children: s,
|
|
10
|
+
onClick: n,
|
|
11
|
+
type: d = "default",
|
|
12
|
+
shape: p = "circle",
|
|
13
|
+
position: l = "bottom-right",
|
|
14
|
+
offset: e = 24,
|
|
15
|
+
className: h = "",
|
|
16
|
+
tooltip: r,
|
|
17
|
+
tooltipPlacement: u = "left",
|
|
18
|
+
...i
|
|
16
19
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
20
|
+
const c = [
|
|
21
|
+
"btn",
|
|
22
|
+
"btn-lg",
|
|
23
|
+
"shadow-lg",
|
|
24
|
+
p === "circle" ? "btn-circle" : "btn-square",
|
|
25
|
+
{
|
|
26
|
+
default: "btn-neutral",
|
|
27
|
+
primary: "btn-primary",
|
|
28
|
+
secondary: "btn-secondary",
|
|
29
|
+
accent: "btn-accent"
|
|
30
|
+
}[d],
|
|
31
|
+
h
|
|
32
|
+
].filter(Boolean).join(" "), a = {
|
|
33
|
+
position: "fixed",
|
|
34
|
+
zIndex: 1e3,
|
|
35
|
+
...l.includes("bottom") ? { bottom: e } : { top: e },
|
|
36
|
+
...l.includes("right") ? { right: e } : { left: e }
|
|
37
|
+
}, o = /* @__PURE__ */ t("button", { className: c, onClick: n, style: a, ...i, children: s || /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) }) });
|
|
38
|
+
return r ? /* @__PURE__ */ t("div", { className: `tooltip ${k[u]}`, "data-tip": r, style: a, children: /* @__PURE__ */ t("button", { className: c, onClick: n, style: { position: "static" }, ...i, children: s || /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) }) }) }) : o;
|
|
39
|
+
}, x = ({
|
|
40
|
+
visibilityHeight: s = 400,
|
|
41
|
+
target: n,
|
|
42
|
+
onClick: d,
|
|
43
|
+
children: p,
|
|
44
|
+
position: l = "bottom-right",
|
|
45
|
+
offset: e = 24,
|
|
46
|
+
className: h = "",
|
|
47
|
+
...r
|
|
48
|
+
}) => {
|
|
49
|
+
const [u, i] = g(!1);
|
|
50
|
+
v(() => {
|
|
51
|
+
const o = n ? n() : window, m = () => {
|
|
52
|
+
const b = o instanceof Window ? window.scrollY : o.scrollTop;
|
|
53
|
+
i(b >= s);
|
|
54
|
+
};
|
|
55
|
+
return o.addEventListener("scroll", m), m(), () => o.removeEventListener("scroll", m);
|
|
56
|
+
}, [n, s]);
|
|
57
|
+
const w = () => {
|
|
58
|
+
d?.();
|
|
59
|
+
const o = n ? n() : window;
|
|
60
|
+
o instanceof Window ? window.scrollTo({ top: 0, behavior: "smooth" }) : o.scrollTo({ top: 0, behavior: "smooth" });
|
|
61
|
+
};
|
|
62
|
+
if (!u) return null;
|
|
63
|
+
const c = [
|
|
64
|
+
"btn",
|
|
65
|
+
"btn-lg",
|
|
66
|
+
"btn-circle",
|
|
67
|
+
"btn-neutral",
|
|
68
|
+
"shadow-lg",
|
|
69
|
+
"transition-opacity",
|
|
70
|
+
h
|
|
71
|
+
].filter(Boolean).join(" "), a = {
|
|
72
|
+
position: "fixed",
|
|
73
|
+
zIndex: 1e3,
|
|
74
|
+
bottom: e,
|
|
75
|
+
...l.includes("right") ? { right: e } : { left: e }
|
|
60
76
|
};
|
|
61
|
-
return /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ t("button", { className: c, onClick: w, style: a, ...r, children: p || /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 10l7-7m0 0l7 7m-7-7v18" }) }) });
|
|
62
78
|
};
|
|
79
|
+
f.BackTop = x;
|
|
63
80
|
export {
|
|
64
|
-
|
|
81
|
+
f as FloatButton
|
|
65
82
|
};
|
|
66
83
|
//# sourceMappingURL=index30.js.map
|
package/dist/index30.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index30.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index30.js","sources":["../src/components/FloatButton.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react'\n\nexport interface FloatButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {\n /** Button content (icon or text) */\n children?: React.ReactNode\n /** Button type/color */\n type?: 'default' | 'primary' | 'secondary' | 'accent'\n /** Button shape */\n shape?: 'circle' | 'square'\n /** Position on screen */\n position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'\n /** Distance from edge in pixels */\n offset?: number\n /** Tooltip text */\n tooltip?: string\n /** Tooltip placement */\n tooltipPlacement?: 'left' | 'right' | 'top' | 'bottom'\n}\n\nexport interface BackTopProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'onClick'> {\n /** Scroll threshold to show button (pixels) */\n visibilityHeight?: number\n /** Scroll target (default: window) */\n target?: () => HTMLElement | Window\n /** Click handler (called before scrolling) */\n onClick?: () => void\n /** Custom content */\n children?: React.ReactNode\n /** Position on screen */\n position?: 'bottom-right' | 'bottom-left'\n /** Distance from edge in pixels */\n offset?: number\n}\n\nconst tooltipPlacementClasses = {\n left: 'tooltip-left',\n right: 'tooltip-right',\n top: 'tooltip-top',\n bottom: 'tooltip-bottom',\n}\n\nexport const FloatButton: React.FC<FloatButtonProps> & { BackTop: React.FC<BackTopProps> } = ({\n children,\n onClick,\n type = 'default',\n shape = 'circle',\n position = 'bottom-right',\n offset = 24,\n className = '',\n tooltip,\n tooltipPlacement = 'left',\n ...rest\n}) => {\n const typeClasses = {\n default: 'btn-neutral',\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n accent: 'btn-accent',\n }\n\n const buttonClasses = [\n 'btn',\n 'btn-lg',\n 'shadow-lg',\n shape === 'circle' ? 'btn-circle' : 'btn-square',\n typeClasses[type],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const style: React.CSSProperties = {\n position: 'fixed',\n zIndex: 1000,\n ...(position.includes('bottom') ? { bottom: offset } : { top: offset }),\n ...(position.includes('right') ? { right: offset } : { left: offset }),\n }\n\n const button = (\n <button className={buttonClasses} onClick={onClick} style={style} {...rest}>\n {children || (\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-6 w-6\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M12 4v16m8-8H4\" />\n </svg>\n )}\n </button>\n )\n\n if (tooltip) {\n return (\n <div className={`tooltip ${tooltipPlacementClasses[tooltipPlacement]}`} data-tip={tooltip} style={style}>\n <button className={buttonClasses} onClick={onClick} style={{ position: 'static' }} {...rest}>\n {children || (\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-6 w-6\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M12 4v16m8-8H4\" />\n </svg>\n )}\n </button>\n </div>\n )\n }\n\n return button\n}\n\nconst BackTop: React.FC<BackTopProps> = ({\n visibilityHeight = 400,\n target,\n onClick,\n children,\n position = 'bottom-right',\n offset = 24,\n className = '',\n ...rest\n}) => {\n const [visible, setVisible] = useState(false)\n\n useEffect(() => {\n const scrollTarget = target ? target() : window\n\n const handleScroll = () => {\n const scrollTop =\n scrollTarget instanceof Window\n ? window.scrollY\n : (scrollTarget as HTMLElement).scrollTop\n\n setVisible(scrollTop >= visibilityHeight)\n }\n\n scrollTarget.addEventListener('scroll', handleScroll)\n handleScroll()\n\n return () => scrollTarget.removeEventListener('scroll', handleScroll)\n }, [target, visibilityHeight])\n\n const handleClick = () => {\n onClick?.()\n const scrollTarget = target ? target() : window\n if (scrollTarget instanceof Window) {\n window.scrollTo({ top: 0, behavior: 'smooth' })\n } else {\n (scrollTarget as HTMLElement).scrollTo({ top: 0, behavior: 'smooth' })\n }\n }\n\n if (!visible) return null\n\n const buttonClasses = [\n 'btn',\n 'btn-lg',\n 'btn-circle',\n 'btn-neutral',\n 'shadow-lg',\n 'transition-opacity',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const style: React.CSSProperties = {\n position: 'fixed',\n zIndex: 1000,\n bottom: offset,\n ...(position.includes('right') ? { right: offset } : { left: offset }),\n }\n\n return (\n <button className={buttonClasses} onClick={handleClick} style={style} {...rest}>\n {children || (\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-6 w-6\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M5 10l7-7m0 0l7 7m-7-7v18\" />\n </svg>\n )}\n </button>\n )\n}\n\nFloatButton.BackTop = BackTop\n"],"names":["tooltipPlacementClasses","FloatButton","children","onClick","type","shape","position","offset","className","tooltip","tooltipPlacement","rest","buttonClasses","style","button","jsx","BackTop","visibilityHeight","target","visible","setVisible","useState","useEffect","scrollTarget","handleScroll","scrollTop","handleClick"],"mappings":"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"}
|
package/dist/index31.js
CHANGED
|
@@ -1,83 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
...i
|
|
19
|
-
}) => {
|
|
20
|
-
const c = [
|
|
21
|
-
"btn",
|
|
22
|
-
"btn-lg",
|
|
23
|
-
"shadow-lg",
|
|
24
|
-
p === "circle" ? "btn-circle" : "btn-square",
|
|
25
|
-
{
|
|
26
|
-
default: "btn-neutral",
|
|
27
|
-
primary: "btn-primary",
|
|
28
|
-
secondary: "btn-secondary",
|
|
29
|
-
accent: "btn-accent"
|
|
30
|
-
}[d],
|
|
31
|
-
h
|
|
32
|
-
].filter(Boolean).join(" "), a = {
|
|
33
|
-
position: "fixed",
|
|
34
|
-
zIndex: 1e3,
|
|
35
|
-
...l.includes("bottom") ? { bottom: e } : { top: e },
|
|
36
|
-
...l.includes("right") ? { right: e } : { left: e }
|
|
37
|
-
}, o = /* @__PURE__ */ t("button", { className: c, onClick: n, style: a, ...i, children: s || /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) }) });
|
|
38
|
-
return r ? /* @__PURE__ */ t("div", { className: `tooltip ${k[u]}`, "data-tip": r, style: a, children: /* @__PURE__ */ t("button", { className: c, onClick: n, style: { position: "static" }, ...i, children: s || /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) }) }) }) : o;
|
|
39
|
-
}, x = ({
|
|
40
|
-
visibilityHeight: s = 400,
|
|
41
|
-
target: n,
|
|
42
|
-
onClick: d,
|
|
43
|
-
children: p,
|
|
44
|
-
position: l = "bottom-right",
|
|
45
|
-
offset: e = 24,
|
|
46
|
-
className: h = "",
|
|
47
|
-
...r
|
|
48
|
-
}) => {
|
|
49
|
-
const [u, i] = g(!1);
|
|
50
|
-
v(() => {
|
|
51
|
-
const o = n ? n() : window, m = () => {
|
|
52
|
-
const b = o instanceof Window ? window.scrollY : o.scrollTop;
|
|
53
|
-
i(b >= s);
|
|
54
|
-
};
|
|
55
|
-
return o.addEventListener("scroll", m), m(), () => o.removeEventListener("scroll", m);
|
|
56
|
-
}, [n, s]);
|
|
57
|
-
const w = () => {
|
|
58
|
-
d?.();
|
|
59
|
-
const o = n ? n() : window;
|
|
60
|
-
o instanceof Window ? window.scrollTo({ top: 0, behavior: "smooth" }) : o.scrollTo({ top: 0, behavior: "smooth" });
|
|
61
|
-
};
|
|
62
|
-
if (!u) return null;
|
|
63
|
-
const c = [
|
|
64
|
-
"btn",
|
|
65
|
-
"btn-lg",
|
|
66
|
-
"btn-circle",
|
|
67
|
-
"btn-neutral",
|
|
68
|
-
"shadow-lg",
|
|
69
|
-
"transition-opacity",
|
|
70
|
-
h
|
|
71
|
-
].filter(Boolean).join(" "), a = {
|
|
72
|
-
position: "fixed",
|
|
73
|
-
zIndex: 1e3,
|
|
74
|
-
bottom: e,
|
|
75
|
-
...l.includes("right") ? { right: e } : { left: e }
|
|
76
|
-
};
|
|
77
|
-
return /* @__PURE__ */ t("button", { className: c, onClick: w, style: a, ...r, children: p || /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 10l7-7m0 0l7 7m-7-7v18" }) }) });
|
|
78
|
-
};
|
|
79
|
-
f.BackTop = x;
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
function a({ children: o, className: e = "", center: t = !1, horizontal: s = !1, vertical: f = !1, ...l }) {
|
|
3
|
+
const n = [
|
|
4
|
+
"footer",
|
|
5
|
+
t && "footer-center",
|
|
6
|
+
s && "footer-horizontal",
|
|
7
|
+
f && "footer-vertical",
|
|
8
|
+
e
|
|
9
|
+
].filter(Boolean).join(" ");
|
|
10
|
+
return /* @__PURE__ */ r("footer", { className: n, ...l, children: o });
|
|
11
|
+
}
|
|
12
|
+
function i({ children: o, className: e = "", ...t }) {
|
|
13
|
+
return /* @__PURE__ */ r("h6", { className: `footer-title ${e}`, ...t, children: o });
|
|
14
|
+
}
|
|
15
|
+
const m = Object.assign(a, {
|
|
16
|
+
Title: i
|
|
17
|
+
});
|
|
80
18
|
export {
|
|
81
|
-
|
|
19
|
+
m as Footer
|
|
82
20
|
};
|
|
83
21
|
//# sourceMappingURL=index31.js.map
|
package/dist/index31.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index31.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index31.js","sources":["../src/components/Footer.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface FooterProps extends React.HTMLAttributes<HTMLElement> {\n children: React.ReactNode\n center?: boolean\n horizontal?: boolean\n vertical?: boolean\n}\n\nexport interface FooterTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n children: React.ReactNode\n}\n\nfunction FooterRoot({ children, className = '', center = false, horizontal = false, vertical = false, ...rest }: FooterProps) {\n const classes = [\n 'footer',\n center && 'footer-center',\n horizontal && 'footer-horizontal',\n vertical && 'footer-vertical',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return <footer className={classes} {...rest}>{children}</footer>\n}\n\nfunction FooterTitle({ children, className = '', ...rest }: FooterTitleProps) {\n return <h6 className={`footer-title ${className}`} {...rest}>{children}</h6>\n}\n\nexport const Footer = Object.assign(FooterRoot, {\n Title: FooterTitle,\n})\n"],"names":["FooterRoot","children","className","center","horizontal","vertical","rest","classes","FooterTitle","jsx","Footer"],"mappings":";AAaA,SAASA,EAAW,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,QAAAC,IAAS,IAAO,YAAAC,IAAa,IAAO,UAAAC,IAAW,IAAO,GAAGC,KAAqB;AAC5H,QAAMC,IAAU;AAAA,IACd;AAAA,IACAJ,KAAU;AAAA,IACVC,KAAc;AAAA,IACdC,KAAY;AAAA,IACZH;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,2BAAQ,UAAA,EAAO,WAAWK,GAAU,GAAGD,GAAO,UAAAL,GAAS;AACzD;AAEA,SAASO,EAAY,EAAE,UAAAP,GAAU,WAAAC,IAAY,IAAI,GAAGI,KAA0B;AAC5E,SAAO,gBAAAG,EAAC,QAAG,WAAW,gBAAgBP,CAAS,IAAK,GAAGI,GAAO,UAAAL,GAAS;AACzE;AAEO,MAAMS,IAAS,OAAO,OAAOV,GAAY;AAAA,EAC9C,OAAOQ;AACT,CAAC;"}
|
package/dist/index32.js
CHANGED
|
@@ -1,21 +1,223 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as t, jsxs as L } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ae, useId as J, useEffect as H, useRef as K, isValidElement as U, cloneElement as ie, useContext as le } from "react";
|
|
3
|
+
import { useForm as Y, useFieldArray as ce, useWatch as ue, Controller as me } from "react-hook-form";
|
|
4
|
+
const P = ae(void 0), M = {
|
|
5
|
+
email: {
|
|
6
|
+
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
|
|
7
|
+
message: "Please enter a valid email address"
|
|
8
|
+
},
|
|
9
|
+
url: {
|
|
10
|
+
value: /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/,
|
|
11
|
+
message: "Please enter a valid URL"
|
|
12
|
+
},
|
|
13
|
+
number: {
|
|
14
|
+
value: /^-?\d+(\.\d+)?$/,
|
|
15
|
+
message: "Please enter a valid number"
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
function z() {
|
|
19
|
+
const r = le(P);
|
|
20
|
+
if (!r)
|
|
21
|
+
throw new Error("Form compound components must be used within Form");
|
|
22
|
+
return r;
|
|
23
|
+
}
|
|
24
|
+
function de({
|
|
25
|
+
form: r,
|
|
26
|
+
onFinish: o,
|
|
27
|
+
initialValues: s,
|
|
28
|
+
layout: u = "vertical",
|
|
29
|
+
labelWidth: m = 60,
|
|
30
|
+
size: y,
|
|
31
|
+
children: h,
|
|
32
|
+
className: l = "",
|
|
33
|
+
noValidate: i = !0,
|
|
34
|
+
...g
|
|
35
|
+
}) {
|
|
36
|
+
const p = Y({
|
|
37
|
+
defaultValues: s
|
|
38
|
+
}), v = r || p, c = ($) => {
|
|
39
|
+
$.preventDefault(), o && v.handleSubmit(o)($);
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ t(P.Provider, { value: { form: v, layout: u, labelWidth: m, size: y }, children: /* @__PURE__ */ t("form", { onSubmit: c, className: l, noValidate: i, ...g, children: h }) });
|
|
42
|
+
}
|
|
43
|
+
function fe({
|
|
44
|
+
name: r,
|
|
45
|
+
label: o,
|
|
46
|
+
help: s,
|
|
47
|
+
required: u = !1,
|
|
48
|
+
rules: m,
|
|
49
|
+
valuePropName: y = "value",
|
|
50
|
+
inline: h = !1,
|
|
51
|
+
className: l = "",
|
|
52
|
+
children: i,
|
|
53
|
+
tooltip: g,
|
|
54
|
+
extra: p,
|
|
55
|
+
hasFeedback: v = !1,
|
|
56
|
+
dependencies: c,
|
|
57
|
+
validateTrigger: $ = "onChange",
|
|
58
|
+
initialValue: B,
|
|
59
|
+
hidden: S = !1
|
|
60
|
+
}) {
|
|
61
|
+
const { form: d, size: R, listName: q, layout: W, labelWidth: G } = z(), T = J(), C = J();
|
|
62
|
+
if (!r)
|
|
63
|
+
return /* @__PURE__ */ t("div", { className: `form-control ${h ? "w-auto" : "w-full"} ${l}`, style: S ? { display: "none" } : void 0, children: i });
|
|
64
|
+
let f;
|
|
65
|
+
Array.isArray(r) ? f = (q ? [q, ...r] : r).join(".") : f = r, H(() => {
|
|
66
|
+
B !== void 0 && d.getValues(f) === void 0 && d.setValue(f, B);
|
|
67
|
+
}, []);
|
|
68
|
+
const j = ue({
|
|
69
|
+
control: d.control,
|
|
70
|
+
name: c,
|
|
71
|
+
disabled: !c || c.length === 0
|
|
72
|
+
}), Z = K(d);
|
|
73
|
+
Z.current = d;
|
|
74
|
+
const E = K(void 0);
|
|
75
|
+
H(() => {
|
|
76
|
+
if (!c || c.length === 0) return;
|
|
77
|
+
if (E.current === void 0) {
|
|
78
|
+
E.current = JSON.stringify(j);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const e = JSON.stringify(j);
|
|
82
|
+
E.current !== e && (E.current = e, Z.current.trigger(f));
|
|
83
|
+
}, [j, c, f]);
|
|
84
|
+
const w = ((e) => {
|
|
85
|
+
const n = e.split(".");
|
|
86
|
+
let a = d.formState.errors;
|
|
87
|
+
for (const V of n) {
|
|
88
|
+
if (!a) break;
|
|
89
|
+
a = a[V];
|
|
90
|
+
}
|
|
91
|
+
return a;
|
|
92
|
+
})(f), N = w?.message, Q = m ? Array.isArray(m) ? m : [m] : [], k = {}, A = [], I = [];
|
|
93
|
+
u && (k.required = "This field is required");
|
|
94
|
+
for (const e of Q) {
|
|
95
|
+
if (e.required && (k.required = typeof e.required == "string" ? e.required : e.message || "This field is required"), e.type && M[e.type] && A.push({
|
|
96
|
+
pattern: M[e.type].value,
|
|
97
|
+
message: e.message || M[e.type].message
|
|
98
|
+
}), e.min !== void 0) {
|
|
99
|
+
const n = typeof e.min == "object" ? e.min.value : e.min, a = typeof e.min == "object" ? e.min.message : e.message || `Minimum length is ${n} characters`;
|
|
100
|
+
k.minLength = { value: n, message: a };
|
|
101
|
+
}
|
|
102
|
+
if (e.max !== void 0) {
|
|
103
|
+
const n = typeof e.max == "object" ? e.max.value : e.max, a = typeof e.max == "object" ? e.max.message : e.message || `Maximum length is ${n} characters`;
|
|
104
|
+
k.maxLength = { value: n, message: a };
|
|
105
|
+
}
|
|
106
|
+
if (e.pattern) {
|
|
107
|
+
const n = e.pattern instanceof RegExp ? e.pattern : e.pattern.value, a = e.pattern instanceof RegExp ? e.message || "Invalid format" : e.pattern.message;
|
|
108
|
+
A.push({ pattern: n, message: a });
|
|
109
|
+
}
|
|
110
|
+
e.validate && I.push(e.validate);
|
|
111
|
+
}
|
|
112
|
+
(A.length > 0 || I.length > 0) && (k.validate = async (e) => {
|
|
113
|
+
if (!e && !k.required) return !0;
|
|
114
|
+
for (const { pattern: n, message: a } of A)
|
|
115
|
+
if (e && !n.test(e))
|
|
116
|
+
return a;
|
|
117
|
+
for (const n of I) {
|
|
118
|
+
const a = await n(e);
|
|
119
|
+
if (a !== !0)
|
|
120
|
+
return a;
|
|
121
|
+
}
|
|
122
|
+
return !0;
|
|
123
|
+
});
|
|
124
|
+
const D = Array.isArray($) ? $ : [$], O = D.includes("onChange"), X = D.includes("onBlur"), ee = ({ hasError: e, isValidating: n }) => n ? /* @__PURE__ */ t("span", { className: "loading loading-spinner loading-xs text-base-content/50" }) : e ? /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-error", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-success", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), te = () => /* @__PURE__ */ t("div", { className: "tooltip tooltip-top ml-1", "data-tip": g, children: /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-base-content/50 cursor-help", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) });
|
|
125
|
+
return /* @__PURE__ */ t(
|
|
126
|
+
me,
|
|
127
|
+
{
|
|
128
|
+
name: f,
|
|
129
|
+
control: d.control,
|
|
130
|
+
rules: k,
|
|
131
|
+
render: ({ field: e, fieldState: n }) => {
|
|
132
|
+
const { value: a, onChange: V, onBlur: re, ref: se } = e, oe = n.isTouched && d.formState.isValidating, x = {
|
|
133
|
+
id: T,
|
|
134
|
+
ref: se,
|
|
135
|
+
"aria-invalid": w ? !0 : void 0,
|
|
136
|
+
"aria-describedby": w ? C : void 0
|
|
137
|
+
};
|
|
138
|
+
x.onBlur = () => {
|
|
139
|
+
re(), X && d.trigger(f);
|
|
140
|
+
}, y === "checked" ? (x.checked = a, x.onChange = (F) => {
|
|
141
|
+
V(F.target.checked), O && d.trigger(f);
|
|
142
|
+
}) : (x.value = a || "", x.onChange = (F) => {
|
|
143
|
+
F && F.target !== void 0 ? V(F.target.value) : V(F), O && d.trigger(f);
|
|
144
|
+
}), R && U(i) && (i.props.size || (x.size = R)), w && (x.color = "error", x["aria-invalid"] = !0);
|
|
145
|
+
const ne = U(i) ? ie(i, x) : i, b = W === "horizontal", _ = W === "inline";
|
|
146
|
+
return /* @__PURE__ */ L("div", { className: `form-control ${h ? "w-auto" : "w-full"} ${b ? "mb-4" : ""} ${_ ? "inline-flex mr-4" : ""} ${l}`, style: S ? { display: "none" } : void 0, children: [
|
|
147
|
+
/* @__PURE__ */ L("div", { className: b ? "flex items-center gap-4" : "", children: [
|
|
148
|
+
o && /* @__PURE__ */ t(
|
|
149
|
+
"label",
|
|
150
|
+
{
|
|
151
|
+
htmlFor: T,
|
|
152
|
+
className: `label ${b ? "flex-shrink-0 justify-end py-0" : ""} ${!b && !_ ? "pb-1" : ""}`,
|
|
153
|
+
style: b ? { width: G } : void 0,
|
|
154
|
+
children: /* @__PURE__ */ L("span", { className: "label-text flex items-center", children: [
|
|
155
|
+
o,
|
|
156
|
+
u && /* @__PURE__ */ t("span", { className: "text-error ml-1", children: "*" }),
|
|
157
|
+
g && /* @__PURE__ */ t(te, {})
|
|
158
|
+
] })
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ L("div", { className: `${b ? "flex-1" : ""} ${v ? "relative" : ""}`, children: [
|
|
162
|
+
ne,
|
|
163
|
+
v && n.isTouched && /* @__PURE__ */ t("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ t(ee, { hasError: !!w, isValidating: oe }) })
|
|
164
|
+
] })
|
|
165
|
+
] }),
|
|
166
|
+
!b && !h && /* @__PURE__ */ t("p", { id: C, className: `validator-hint ${N ? "!visible text-error" : ""} min-h-[1.25rem]`, role: N ? "alert" : void 0, children: N || s && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: s }) || " " }),
|
|
167
|
+
b && (N || s) && /* @__PURE__ */ t("p", { id: C, className: `validator-hint ${N ? "!visible text-error" : ""} min-h-[1.25rem]`, role: N ? "alert" : void 0, children: N || s && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: s }) }),
|
|
168
|
+
p && /* @__PURE__ */ t("div", { className: "text-sm text-base-content/60 mt-1", children: p })
|
|
169
|
+
] });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
function he({
|
|
175
|
+
name: r,
|
|
176
|
+
children: o
|
|
177
|
+
}) {
|
|
178
|
+
const { form: s, layout: u, size: m } = z(), { fields: y, append: h, remove: l, move: i } = ce({
|
|
179
|
+
control: s.control,
|
|
180
|
+
name: r
|
|
181
|
+
}), g = y.map((p, v) => ({
|
|
182
|
+
...p,
|
|
183
|
+
name: v
|
|
184
|
+
}));
|
|
185
|
+
return /* @__PURE__ */ t(P.Provider, { value: { form: s, layout: u, size: m, listName: r }, children: o(g, {
|
|
186
|
+
add: h,
|
|
187
|
+
remove: l,
|
|
188
|
+
move: i
|
|
189
|
+
}) });
|
|
190
|
+
}
|
|
191
|
+
function ge() {
|
|
192
|
+
const r = Y(), o = r;
|
|
193
|
+
return o.setFieldValue = r.setValue, o.getFieldValue = (s) => r.getValues(s), o.getFieldsValue = r.getValues, o.setFieldsValue = (s) => {
|
|
194
|
+
Object.keys(s).forEach((u) => {
|
|
195
|
+
r.setValue(u, s[u]);
|
|
196
|
+
});
|
|
197
|
+
}, o.validateFields = r.trigger, o.resetFields = r.reset, o.isFieldTouched = (s) => !!r.formState.touchedFields[s], o.getFieldError = (s) => r.formState.errors[s]?.message, o;
|
|
11
198
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
199
|
+
function pe({ fields: r, className: o = "" }) {
|
|
200
|
+
const { form: s } = z(), { errors: u } = s.formState, m = (l, i = "") => {
|
|
201
|
+
const g = [];
|
|
202
|
+
for (const p in l) {
|
|
203
|
+
const v = i ? `${i}.${p}` : p, c = l[p];
|
|
204
|
+
c?.message ? g.push({ field: v, message: c.message }) : typeof c == "object" && c !== null && g.push(...m(c, v));
|
|
205
|
+
}
|
|
206
|
+
return g;
|
|
207
|
+
}, y = m(u), h = r ? y.filter((l) => r.includes(l.field)) : y;
|
|
208
|
+
return h.length === 0 ? null : /* @__PURE__ */ t("ul", { className: `text-error text-sm space-y-1 ${o}`, role: "alert", children: h.map((l, i) => /* @__PURE__ */ L("li", { className: "flex items-start gap-2", children: [
|
|
209
|
+
/* @__PURE__ */ t("svg", { className: "w-4 h-4 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
210
|
+
/* @__PURE__ */ t("span", { children: l.message })
|
|
211
|
+
] }, `${l.field}-${i}`)) });
|
|
14
212
|
}
|
|
15
|
-
const
|
|
16
|
-
|
|
213
|
+
const Ne = Object.assign(de, {
|
|
214
|
+
Item: fe,
|
|
215
|
+
List: he,
|
|
216
|
+
ErrorList: pe,
|
|
217
|
+
useForm: ge
|
|
17
218
|
});
|
|
18
219
|
export {
|
|
19
|
-
|
|
220
|
+
Ne as Form,
|
|
221
|
+
ge as useFormInstance
|
|
20
222
|
};
|
|
21
223
|
//# sourceMappingURL=index32.js.map
|