asterui 0.12.14 → 0.12.16
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/README.md +1 -1
- package/dist/components/Autocomplete.d.ts +22 -2
- package/dist/components/Button.d.ts +10 -5
- package/dist/components/Form.d.ts +11 -1
- package/dist/components/HoverGallery.d.ts +10 -0
- package/dist/components/Rating.d.ts +12 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +156 -154
- package/dist/index.js.map +1 -1
- package/dist/index100.js +11 -43
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +44 -11
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +10 -12
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +14 -7
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +7 -12
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +11 -29
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +29 -16
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +21 -0
- package/dist/index107.js.map +1 -0
- package/dist/index21.js +1 -1
- package/dist/index34.js +133 -119
- package/dist/index34.js.map +1 -1
- package/dist/index37.js +15 -120
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +119 -37
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +40 -398
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +390 -89
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +90 -215
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +211 -135
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +155 -15
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +15 -17
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +17 -21
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +18 -134
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +134 -10
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +13 -35
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +35 -34
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +161 -80
- package/dist/index5.js.map +1 -1
- package/dist/index50.js +34 -81
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +71 -166
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +167 -144
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +152 -11
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +10 -20
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +22 -14
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +14 -7
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +6 -333
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +334 -47
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +47 -122
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +120 -108
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +107 -167
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +167 -29
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +30 -120
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +116 -80
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +85 -19
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +19 -73
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +71 -54
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +56 -44
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +42 -49
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +52 -62
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +118 -102
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +107 -41
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +41 -68
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +66 -19
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +18 -55
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +55 -251
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +254 -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 +30 -93
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +89 -324
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +322 -73
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +79 -39
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +40 -23
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +21 -93
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +87 -148
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +147 -152
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +159 -63
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +65 -35
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +35 -234
- package/dist/index89.js.map +1 -1
- package/dist/index9.js +55 -53
- package/dist/index9.js.map +1 -1
- package/dist/index90.js +231 -31
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +34 -210
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +195 -198
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +159 -241
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +283 -166
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +173 -253
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +258 -14
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +12 -31
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +32 -5
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +5 -13
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
package/dist/index44.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return /* @__PURE__ */ e("kbd", { className: b, ...o, children: d });
|
|
16
|
-
};
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import n from "react";
|
|
3
|
+
function f({ children: o, direction: t = "horizontal", className: s = "", ...r }) {
|
|
4
|
+
const a = ["join", t === "vertical" && "join-vertical", s].filter(Boolean).join(" "), l = n.Children.map(o, (e) => {
|
|
5
|
+
if (n.isValidElement(e)) {
|
|
6
|
+
const i = e.props.className || "", m = i ? `join-item ${i}` : "join-item";
|
|
7
|
+
return n.cloneElement(e, {
|
|
8
|
+
className: m
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return e;
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ c("div", { className: a, ...r, children: l });
|
|
14
|
+
}
|
|
17
15
|
export {
|
|
18
|
-
|
|
16
|
+
f as Join
|
|
19
17
|
};
|
|
20
18
|
//# sourceMappingURL=index44.js.map
|
package/dist/index44.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index44.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index44.js","sources":["../src/components/Join.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface JoinProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n direction?: 'horizontal' | 'vertical'\n}\n\nexport function Join({ children, direction = 'horizontal', className = '', ...rest }: JoinProps) {\n const classes = ['join', direction === 'vertical' && 'join-vertical', className].filter(Boolean).join(' ')\n\n // Automatically add join-item class to all children\n const childrenWithJoinItem = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n const existingClassName = (child.props as any).className || ''\n const newClassName = existingClassName ? `join-item ${existingClassName}` : 'join-item'\n\n return React.cloneElement(child as React.ReactElement<any>, {\n className: newClassName,\n })\n }\n return child\n })\n\n return <div className={classes} {...rest}>{childrenWithJoinItem}</div>\n}\n"],"names":["Join","children","direction","className","rest","classes","childrenWithJoinItem","React","child","existingClassName","newClassName"],"mappings":";;AAOO,SAASA,EAAK,EAAE,UAAAC,GAAU,WAAAC,IAAY,cAAc,WAAAC,IAAY,IAAI,GAAGC,KAAmB;AAC/F,QAAMC,IAAU,CAAC,QAAQH,MAAc,cAAc,iBAAiBC,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAGnGG,IAAuBC,EAAM,SAAS,IAAIN,GAAU,CAACO,MAAU;AACnE,QAAID,EAAM,eAAeC,CAAK,GAAG;AAC/B,YAAMC,IAAqBD,EAAM,MAAc,aAAa,IACtDE,IAAeD,IAAoB,aAAaA,CAAiB,KAAK;AAE5E,aAAOF,EAAM,aAAaC,GAAkC;AAAA,QAC1D,WAAWE;AAAA,MAAA,CACZ;AAAA,IACH;AACA,WAAOF;AAAA,EACT,CAAC;AAED,2BAAQ,OAAA,EAAI,WAAWH,GAAU,GAAGD,GAAO,UAAAE,GAAqB;AAClE;"}
|
package/dist/index45.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
const m = Object.assign(c, {
|
|
19
|
-
Floating: r
|
|
20
|
-
});
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
const k = {
|
|
3
|
+
xs: "kbd-xs",
|
|
4
|
+
sm: "kbd-sm",
|
|
5
|
+
md: "kbd-md",
|
|
6
|
+
lg: "kbd-lg",
|
|
7
|
+
xl: "kbd-xl"
|
|
8
|
+
}, t = ({
|
|
9
|
+
size: s,
|
|
10
|
+
children: d,
|
|
11
|
+
className: l = "",
|
|
12
|
+
...o
|
|
13
|
+
}) => {
|
|
14
|
+
const b = ["kbd", s ? k[s] : "", l].filter(Boolean).join(" ");
|
|
15
|
+
return /* @__PURE__ */ e("kbd", { className: b, ...o, children: d });
|
|
16
|
+
};
|
|
21
17
|
export {
|
|
22
|
-
|
|
18
|
+
t as Kbd
|
|
23
19
|
};
|
|
24
20
|
//# sourceMappingURL=index45.js.map
|
package/dist/index45.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index45.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index45.js","sources":["../src/components/Kbd.tsx"],"sourcesContent":["import React from 'react'\n\nexport type KbdSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\nexport interface KbdProps extends React.HTMLAttributes<HTMLElement> {\n /** Size of the kbd */\n size?: KbdSize\n /** Key content */\n children?: React.ReactNode\n}\n\nconst sizeClasses: Record<KbdSize, string> = {\n xs: 'kbd-xs',\n sm: 'kbd-sm',\n md: 'kbd-md',\n lg: 'kbd-lg',\n xl: 'kbd-xl',\n}\n\nexport const Kbd: React.FC<KbdProps> = ({\n size,\n children,\n className = '',\n ...rest\n}) => {\n const classes = ['kbd', size ? sizeClasses[size] : '', className]\n .filter(Boolean)\n .join(' ')\n\n return (\n <kbd className={classes} {...rest}>\n {children}\n </kbd>\n )\n}\n"],"names":["sizeClasses","Kbd","size","children","className","rest","classes"],"mappings":";AAWA,MAAMA,IAAuC;AAAA,EAC3C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEaC,IAA0B,CAAC;AAAA,EACtC,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAU,CAAC,OAAOJ,IAAOF,EAAYE,CAAI,IAAI,IAAIE,CAAS,EAC7D,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,2BACG,OAAA,EAAI,WAAWE,GAAU,GAAGD,GAC1B,UAAAF,GACH;AAEJ;"}
|
package/dist/index46.js
CHANGED
|
@@ -1,140 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function Q() {
|
|
5
|
-
return M(L);
|
|
1
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
function c({ children: l, className: n = "", ...s }) {
|
|
3
|
+
return /* @__PURE__ */ a("span", { className: `label ${n}`, ...s, children: l });
|
|
6
4
|
}
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return d.cloneElement(t, {
|
|
20
|
-
className: `flex-1 ${i}`.trim()
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
}) : n;
|
|
25
|
-
return /* @__PURE__ */ o("div", { className: m, style: a, children: r });
|
|
5
|
+
function r({ children: l, label: n, size: s, className: e = "", ...t }) {
|
|
6
|
+
const i = ["floating-label", s && {
|
|
7
|
+
xs: "input-xs",
|
|
8
|
+
sm: "input-sm",
|
|
9
|
+
md: "input-md",
|
|
10
|
+
lg: "input-lg",
|
|
11
|
+
xl: "input-xl"
|
|
12
|
+
}[s], e].filter(Boolean).join(" ");
|
|
13
|
+
return /* @__PURE__ */ o("label", { className: i, ...t, children: [
|
|
14
|
+
l,
|
|
15
|
+
/* @__PURE__ */ a("span", { children: n })
|
|
16
|
+
] });
|
|
26
17
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const e = [
|
|
30
|
-
"flex",
|
|
31
|
-
"items-center",
|
|
32
|
-
"px-6",
|
|
33
|
-
"h-16",
|
|
34
|
-
"bg-base-300",
|
|
35
|
-
"flex-shrink-0",
|
|
36
|
-
s
|
|
37
|
-
].filter(Boolean).join(" ");
|
|
38
|
-
return /* @__PURE__ */ o("header", { className: e, style: a, children: n });
|
|
39
|
-
}
|
|
40
|
-
function I({ children: n, className: s = "", style: a }) {
|
|
41
|
-
const e = [
|
|
42
|
-
"px-6",
|
|
43
|
-
"py-4",
|
|
44
|
-
"text-center",
|
|
45
|
-
"bg-base-300",
|
|
46
|
-
"flex-shrink-0",
|
|
47
|
-
s
|
|
48
|
-
].filter(Boolean).join(" ");
|
|
49
|
-
return /* @__PURE__ */ o("footer", { className: e, style: a, children: n });
|
|
50
|
-
}
|
|
51
|
-
function O({ children: n, className: s = "", style: a }) {
|
|
52
|
-
const e = ["flex-1", "min-h-0", "overflow-auto", s].filter(Boolean).join(" ");
|
|
53
|
-
return /* @__PURE__ */ o("main", { className: e, style: a, children: n });
|
|
54
|
-
}
|
|
55
|
-
const T = {
|
|
56
|
-
sm: "(max-width: 639px)",
|
|
57
|
-
md: "(max-width: 767px)",
|
|
58
|
-
lg: "(max-width: 1023px)",
|
|
59
|
-
xl: "(max-width: 1279px)",
|
|
60
|
-
"2xl": "(max-width: 1535px)"
|
|
61
|
-
};
|
|
62
|
-
function v({
|
|
63
|
-
children: n,
|
|
64
|
-
width: s = 200,
|
|
65
|
-
collapsedWidth: a = 80,
|
|
66
|
-
collapsed: e,
|
|
67
|
-
defaultCollapsed: f = !1,
|
|
68
|
-
collapsible: m = !1,
|
|
69
|
-
onCollapse: r,
|
|
70
|
-
trigger: t,
|
|
71
|
-
breakpoint: i,
|
|
72
|
-
onBreakpoint: p,
|
|
73
|
-
className: w = "",
|
|
74
|
-
style: g
|
|
75
|
-
}) {
|
|
76
|
-
const [j, N] = C(f), [b, k] = C(!1), l = e ?? j;
|
|
77
|
-
$(() => {
|
|
78
|
-
if (!i) return;
|
|
79
|
-
const c = window.matchMedia(T[i]), y = (R) => {
|
|
80
|
-
const u = R.matches;
|
|
81
|
-
k(u), p?.(u), e === void 0 && N(u), u !== b && r?.(u);
|
|
82
|
-
};
|
|
83
|
-
return y(c), c.addEventListener("change", y), () => c.removeEventListener("change", y);
|
|
84
|
-
}, [i, p, e, r, b]);
|
|
85
|
-
const S = F(() => {
|
|
86
|
-
const c = !l;
|
|
87
|
-
e === void 0 && N(c), r?.(c);
|
|
88
|
-
}, [l, e, r]), x = l ? a : s, B = [
|
|
89
|
-
"flex",
|
|
90
|
-
"flex-col",
|
|
91
|
-
"bg-base-200",
|
|
92
|
-
"flex-shrink-0",
|
|
93
|
-
"transition-all",
|
|
94
|
-
"duration-200",
|
|
95
|
-
w
|
|
96
|
-
].filter(Boolean).join(" "), E = m && t !== null && /* @__PURE__ */ o(
|
|
97
|
-
"button",
|
|
98
|
-
{
|
|
99
|
-
onClick: S,
|
|
100
|
-
className: "flex items-center justify-center h-10 w-full bg-base-300 hover:bg-base-content/10 transition-colors",
|
|
101
|
-
"aria-label": l ? "Expand sidebar" : "Collapse sidebar",
|
|
102
|
-
children: /* @__PURE__ */ o(
|
|
103
|
-
"svg",
|
|
104
|
-
{
|
|
105
|
-
className: `w-4 h-4 transition-transform ${l ? "rotate-180" : ""}`,
|
|
106
|
-
fill: "none",
|
|
107
|
-
viewBox: "0 0 24 24",
|
|
108
|
-
stroke: "currentColor",
|
|
109
|
-
children: /* @__PURE__ */ o("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" })
|
|
110
|
-
}
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
return /* @__PURE__ */ o(L.Provider, { value: { collapsed: l, collapsedWidth: a, width: s }, children: /* @__PURE__ */ A(
|
|
115
|
-
"aside",
|
|
116
|
-
{
|
|
117
|
-
className: B,
|
|
118
|
-
style: {
|
|
119
|
-
width: typeof x == "number" ? `${x}px` : x,
|
|
120
|
-
...g
|
|
121
|
-
},
|
|
122
|
-
children: [
|
|
123
|
-
/* @__PURE__ */ o("div", { className: "flex-1 overflow-auto", children: n }),
|
|
124
|
-
t !== null && (t ?? E)
|
|
125
|
-
]
|
|
126
|
-
}
|
|
127
|
-
) });
|
|
128
|
-
}
|
|
129
|
-
v.displayName = "LayoutSider";
|
|
130
|
-
const W = Object.assign(h, {
|
|
131
|
-
Header: H,
|
|
132
|
-
Footer: I,
|
|
133
|
-
Content: O,
|
|
134
|
-
Sider: v
|
|
18
|
+
const m = Object.assign(c, {
|
|
19
|
+
Floating: r
|
|
135
20
|
});
|
|
136
21
|
export {
|
|
137
|
-
|
|
138
|
-
Q as useSiderContext
|
|
22
|
+
m as Label
|
|
139
23
|
};
|
|
140
24
|
//# sourceMappingURL=index46.js.map
|
package/dist/index46.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index46.js","sources":["../src/components/Layout.tsx"],"sourcesContent":["import React, { createContext, useContext, useState, useCallback, useEffect } from 'react'\n\nexport interface LayoutProps {\n children: React.ReactNode\n className?: string\n style?: React.CSSProperties\n}\n\nexport interface LayoutHeaderProps {\n children: React.ReactNode\n className?: string\n style?: React.CSSProperties\n}\n\nexport interface LayoutFooterProps {\n children: React.ReactNode\n className?: string\n style?: React.CSSProperties\n}\n\nexport interface LayoutContentProps {\n children: React.ReactNode\n className?: string\n style?: React.CSSProperties\n}\n\nexport interface LayoutSiderProps {\n children: React.ReactNode\n width?: number | string\n collapsedWidth?: number | string\n collapsed?: boolean\n defaultCollapsed?: boolean\n collapsible?: boolean\n onCollapse?: (collapsed: boolean) => void\n trigger?: React.ReactNode | null\n breakpoint?: 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n onBreakpoint?: (broken: boolean) => void\n className?: string\n style?: React.CSSProperties\n}\n\ninterface SiderContextValue {\n collapsed: boolean\n collapsedWidth: number | string\n width: number | string\n}\n\nconst SiderContext = createContext<SiderContextValue | null>(null)\n\nexport function useSiderContext() {\n return useContext(SiderContext)\n}\n\nfunction LayoutRoot({ children, className = '', style }: LayoutProps) {\n // Check if any child is a Sider to determine flex direction\n const childArray = React.Children.toArray(children)\n const hasSider = childArray.some(\n (child) => React.isValidElement(child) && (child.type as any).displayName === 'LayoutSider'\n )\n\n const layoutClasses = [\n 'flex',\n 'min-h-0',\n hasSider ? 'flex-row' : 'flex-col',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n // If we have a Sider, auto-add flex-1 to non-Sider Layout children\n const processedChildren = hasSider\n ? childArray.map((child) => {\n if (\n React.isValidElement(child) &&\n (child.type === LayoutRoot || (child.type as any).displayName === 'LayoutRoot') &&\n (child.type as any).displayName !== 'LayoutSider'\n ) {\n // Clone the Layout child and add flex-1 if not already present\n const existingClassName = (child.props as any).className || ''\n if (!existingClassName.includes('flex-1')) {\n return React.cloneElement(child as React.ReactElement<any>, {\n className: `flex-1 ${existingClassName}`.trim(),\n })\n }\n }\n return child\n })\n : children\n\n return (\n <div className={layoutClasses} style={style}>\n {processedChildren}\n </div>\n )\n}\n\nLayoutRoot.displayName = 'LayoutRoot'\n\nfunction LayoutHeader({ children, className = '', style }: LayoutHeaderProps) {\n const headerClasses = [\n 'flex',\n 'items-center',\n 'px-6',\n 'h-16',\n 'bg-base-300',\n 'flex-shrink-0',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <header className={headerClasses} style={style}>\n {children}\n </header>\n )\n}\n\nfunction LayoutFooter({ children, className = '', style }: LayoutFooterProps) {\n const footerClasses = [\n 'px-6',\n 'py-4',\n 'text-center',\n 'bg-base-300',\n 'flex-shrink-0',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <footer className={footerClasses} style={style}>\n {children}\n </footer>\n )\n}\n\nfunction LayoutContent({ children, className = '', style }: LayoutContentProps) {\n // flex-1 by default so Content fills available space\n const contentClasses = ['flex-1', 'min-h-0', 'overflow-auto', className].filter(Boolean).join(' ')\n\n return (\n <main className={contentClasses} style={style}>\n {children}\n </main>\n )\n}\n\nconst BREAKPOINT_MAP: Record<string, string> = {\n sm: '(max-width: 639px)',\n md: '(max-width: 767px)',\n lg: '(max-width: 1023px)',\n xl: '(max-width: 1279px)',\n '2xl': '(max-width: 1535px)',\n}\n\nfunction LayoutSider({\n children,\n width = 200,\n collapsedWidth = 80,\n collapsed: controlledCollapsed,\n defaultCollapsed = false,\n collapsible = false,\n onCollapse,\n trigger,\n breakpoint,\n onBreakpoint,\n className = '',\n style,\n}: LayoutSiderProps) {\n const [internalCollapsed, setInternalCollapsed] = useState(defaultCollapsed)\n const [broken, setBroken] = useState(false)\n\n const collapsed = controlledCollapsed ?? internalCollapsed\n\n // Handle responsive breakpoint\n useEffect(() => {\n if (!breakpoint) return\n\n const mediaQuery = window.matchMedia(BREAKPOINT_MAP[breakpoint])\n\n const handleChange = (e: MediaQueryListEvent | MediaQueryList) => {\n const isBroken = e.matches\n setBroken(isBroken)\n onBreakpoint?.(isBroken)\n\n // Auto-collapse when breakpoint is crossed\n if (controlledCollapsed === undefined) {\n setInternalCollapsed(isBroken)\n }\n if (isBroken !== broken) {\n onCollapse?.(isBroken)\n }\n }\n\n // Check initial state\n handleChange(mediaQuery)\n\n // Listen for changes\n mediaQuery.addEventListener('change', handleChange)\n return () => mediaQuery.removeEventListener('change', handleChange)\n }, [breakpoint, onBreakpoint, controlledCollapsed, onCollapse, broken])\n\n const handleCollapse = useCallback(() => {\n const newCollapsed = !collapsed\n if (controlledCollapsed === undefined) {\n setInternalCollapsed(newCollapsed)\n }\n onCollapse?.(newCollapsed)\n }, [collapsed, controlledCollapsed, onCollapse])\n\n const currentWidth = collapsed ? collapsedWidth : width\n\n const siderClasses = [\n 'flex',\n 'flex-col',\n 'bg-base-200',\n 'flex-shrink-0',\n 'transition-all',\n 'duration-200',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const defaultTrigger = collapsible && trigger !== null && (\n <button\n onClick={handleCollapse}\n className=\"flex items-center justify-center h-10 w-full bg-base-300 hover:bg-base-content/10 transition-colors\"\n aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n >\n <svg\n className={`w-4 h-4 transition-transform ${collapsed ? 'rotate-180' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M15 19l-7-7 7-7\" />\n </svg>\n </button>\n )\n\n return (\n <SiderContext.Provider value={{ collapsed, collapsedWidth, width }}>\n <aside\n className={siderClasses}\n style={{\n width: typeof currentWidth === 'number' ? `${currentWidth}px` : currentWidth,\n ...style,\n }}\n >\n <div className=\"flex-1 overflow-auto\">{children}</div>\n {trigger !== null && (trigger ?? defaultTrigger)}\n </aside>\n </SiderContext.Provider>\n )\n}\n\nLayoutSider.displayName = 'LayoutSider'\n\nexport const Layout = Object.assign(LayoutRoot, {\n Header: LayoutHeader,\n Footer: LayoutFooter,\n Content: LayoutContent,\n Sider: LayoutSider,\n})\n"],"names":["SiderContext","createContext","useSiderContext","useContext","LayoutRoot","children","className","style","childArray","React","hasSider","child","layoutClasses","processedChildren","existingClassName","jsx","LayoutHeader","headerClasses","LayoutFooter","footerClasses","LayoutContent","contentClasses","BREAKPOINT_MAP","LayoutSider","width","collapsedWidth","controlledCollapsed","defaultCollapsed","collapsible","onCollapse","trigger","breakpoint","onBreakpoint","internalCollapsed","setInternalCollapsed","useState","broken","setBroken","collapsed","useEffect","mediaQuery","handleChange","e","isBroken","handleCollapse","useCallback","newCollapsed","currentWidth","siderClasses","defaultTrigger","jsxs","Layout"],"mappings":";;AA+CA,MAAMA,IAAeC,EAAwC,IAAI;AAE1D,SAASC,IAAkB;AAChC,SAAOC,EAAWH,CAAY;AAChC;AAEA,SAASI,EAAW,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,OAAAC,KAAsB;AAEpE,QAAMC,IAAaC,EAAM,SAAS,QAAQJ,CAAQ,GAC5CK,IAAWF,EAAW;AAAA,IAC1B,CAACG,MAAUF,EAAM,eAAeE,CAAK,KAAMA,EAAM,KAAa,gBAAgB;AAAA,EAAA,GAG1EC,IAAgB;AAAA,IACpB;AAAA,IACA;AAAA,IACAF,IAAW,aAAa;AAAA,IACxBJ;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG,GAGLO,IAAoBH,IACtBF,EAAW,IAAI,CAACG,MAAU;AACxB,QACEF,EAAM,eAAeE,CAAK,MACzBA,EAAM,SAASP,KAAeO,EAAM,KAAa,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B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA1C;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG,GAEL2C,IAAiBrB,KAAeE,MAAY,QAChD,gBAAAf;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS6B;AAAA,MACT,WAAU;AAAA,MACV,cAAYN,IAAY,mBAAmB;AAAA,MAE3C,UAAA,gBAAAvB;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW,gCAAgCuB,IAAY,eAAe,EAAE;AAAA,UACxE,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,QAAO;AAAA,UAEP,UAAA,gBAAAvB,EAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,aAAa,GAAG,GAAE,kBAAA,CAAkB;AAAA,QAAA;AAAA,MAAA;AAAA,IACzF;AAAA,EAAA;AAIJ,SACE,gBAAAA,EAACf,EAAa,UAAb,EAAsB,OAAO,EAAE,WAAAsC,GAAW,gBAAAb,GAAgB,OAAAD,KACzD,UAAA,gBAAA0B;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWF;AAAA,MACX,OAAO;AAAA,QACL,OAAO,OAAOD,KAAiB,WAAW,GAAGA,CAAY,OAAOA;AAAA,QAChE,GAAGxC;AAAA,MAAA;AAAA,MAGL,UAAA;AAAA,QAAA,gBAAAQ,EAAC,OAAA,EAAI,WAAU,wBAAwB,UAAAV,EAAA,CAAS;AAAA,QAC/CyB,MAAY,SAASA,KAAWmB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAErC;AAEJ;AAEA1B,EAAY,cAAc;AAEnB,MAAM4B,IAAS,OAAO,OAAO/C,GAAY;AAAA,EAC9C,QAAQY;AAAA,EACR,QAAQE;AAAA,EACR,SAASE;AAAA,EACT,OAAOG;AACT,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index46.js","sources":["../src/components/Label.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface LabelProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode\n}\n\nexport interface FloatingLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n children: React.ReactNode\n label: string\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n}\n\nfunction LabelRoot({ children, className = '', ...rest }: LabelProps) {\n return <span className={`label ${className}`} {...rest}>{children}</span>\n}\n\nfunction FloatingLabel({ children, label, size, className = '', ...rest }: FloatingLabelProps) {\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 classes = ['floating-label', size && sizeClasses[size], className].filter(Boolean).join(' ')\n\n return (\n <label className={classes} {...rest}>\n {children}\n <span>{label}</span>\n </label>\n )\n}\n\nexport const Label = Object.assign(LabelRoot, {\n Floating: FloatingLabel,\n})\n"],"names":["LabelRoot","children","className","rest","jsx","FloatingLabel","label","size","classes","jsxs","Label"],"mappings":";AAYA,SAASA,EAAU,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,GAAGC,KAAoB;AACpE,SAAO,gBAAAC,EAAC,UAAK,WAAW,SAASF,CAAS,IAAK,GAAGC,GAAO,UAAAF,GAAS;AACpE;AAEA,SAASI,EAAc,EAAE,UAAAJ,GAAU,OAAAK,GAAO,MAAAC,GAAM,WAAAL,IAAY,IAAI,GAAGC,KAA4B;AAS7F,QAAMK,IAAU,CAAC,kBAAkBD,KARf;AAAA,IAClB,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EAAA,EAGiDA,CAAI,GAAGL,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAEjG,SACE,gBAAAO,EAAC,SAAA,EAAM,WAAWD,GAAU,GAAGL,GAC5B,UAAA;AAAA,IAAAF;AAAA,IACD,gBAAAG,EAAC,UAAM,UAAAE,EAAA,CAAM;AAAA,EAAA,GACf;AAEJ;AAEO,MAAMI,IAAQ,OAAO,OAAOV,GAAW;AAAA,EAC5C,UAAUK;AACZ,CAAC;"}
|
package/dist/index47.js
CHANGED
|
@@ -1,16 +1,140 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as o, jsxs as A } from "react/jsx-runtime";
|
|
2
|
+
import d, { useContext as M, createContext as P, useState as C, useEffect as $, useCallback as F } from "react";
|
|
3
|
+
const L = P(null);
|
|
4
|
+
function Q() {
|
|
5
|
+
return M(L);
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
function h({ children: n, className: s = "", style: a }) {
|
|
8
|
+
const e = d.Children.toArray(n), f = e.some(
|
|
9
|
+
(t) => d.isValidElement(t) && t.type.displayName === "LayoutSider"
|
|
10
|
+
), m = [
|
|
11
|
+
"flex",
|
|
12
|
+
"min-h-0",
|
|
13
|
+
f ? "flex-row" : "flex-col",
|
|
14
|
+
s
|
|
15
|
+
].filter(Boolean).join(" "), r = f ? e.map((t) => {
|
|
16
|
+
if (d.isValidElement(t) && (t.type === h || t.type.displayName === "LayoutRoot") && t.type.displayName !== "LayoutSider") {
|
|
17
|
+
const i = t.props.className || "";
|
|
18
|
+
if (!i.includes("flex-1"))
|
|
19
|
+
return d.cloneElement(t, {
|
|
20
|
+
className: `flex-1 ${i}`.trim()
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
}) : n;
|
|
25
|
+
return /* @__PURE__ */ o("div", { className: m, style: a, children: r });
|
|
9
26
|
}
|
|
10
|
-
|
|
11
|
-
|
|
27
|
+
h.displayName = "LayoutRoot";
|
|
28
|
+
function H({ children: n, className: s = "", style: a }) {
|
|
29
|
+
const e = [
|
|
30
|
+
"flex",
|
|
31
|
+
"items-center",
|
|
32
|
+
"px-6",
|
|
33
|
+
"h-16",
|
|
34
|
+
"bg-base-300",
|
|
35
|
+
"flex-shrink-0",
|
|
36
|
+
s
|
|
37
|
+
].filter(Boolean).join(" ");
|
|
38
|
+
return /* @__PURE__ */ o("header", { className: e, style: a, children: n });
|
|
39
|
+
}
|
|
40
|
+
function I({ children: n, className: s = "", style: a }) {
|
|
41
|
+
const e = [
|
|
42
|
+
"px-6",
|
|
43
|
+
"py-4",
|
|
44
|
+
"text-center",
|
|
45
|
+
"bg-base-300",
|
|
46
|
+
"flex-shrink-0",
|
|
47
|
+
s
|
|
48
|
+
].filter(Boolean).join(" ");
|
|
49
|
+
return /* @__PURE__ */ o("footer", { className: e, style: a, children: n });
|
|
50
|
+
}
|
|
51
|
+
function O({ children: n, className: s = "", style: a }) {
|
|
52
|
+
const e = ["flex-1", "min-h-0", "overflow-auto", s].filter(Boolean).join(" ");
|
|
53
|
+
return /* @__PURE__ */ o("main", { className: e, style: a, children: n });
|
|
54
|
+
}
|
|
55
|
+
const T = {
|
|
56
|
+
sm: "(max-width: 639px)",
|
|
57
|
+
md: "(max-width: 767px)",
|
|
58
|
+
lg: "(max-width: 1023px)",
|
|
59
|
+
xl: "(max-width: 1279px)",
|
|
60
|
+
"2xl": "(max-width: 1535px)"
|
|
61
|
+
};
|
|
62
|
+
function v({
|
|
63
|
+
children: n,
|
|
64
|
+
width: s = 200,
|
|
65
|
+
collapsedWidth: a = 80,
|
|
66
|
+
collapsed: e,
|
|
67
|
+
defaultCollapsed: f = !1,
|
|
68
|
+
collapsible: m = !1,
|
|
69
|
+
onCollapse: r,
|
|
70
|
+
trigger: t,
|
|
71
|
+
breakpoint: i,
|
|
72
|
+
onBreakpoint: p,
|
|
73
|
+
className: w = "",
|
|
74
|
+
style: g
|
|
75
|
+
}) {
|
|
76
|
+
const [j, N] = C(f), [b, k] = C(!1), l = e ?? j;
|
|
77
|
+
$(() => {
|
|
78
|
+
if (!i) return;
|
|
79
|
+
const c = window.matchMedia(T[i]), y = (R) => {
|
|
80
|
+
const u = R.matches;
|
|
81
|
+
k(u), p?.(u), e === void 0 && N(u), u !== b && r?.(u);
|
|
82
|
+
};
|
|
83
|
+
return y(c), c.addEventListener("change", y), () => c.removeEventListener("change", y);
|
|
84
|
+
}, [i, p, e, r, b]);
|
|
85
|
+
const S = F(() => {
|
|
86
|
+
const c = !l;
|
|
87
|
+
e === void 0 && N(c), r?.(c);
|
|
88
|
+
}, [l, e, r]), x = l ? a : s, B = [
|
|
89
|
+
"flex",
|
|
90
|
+
"flex-col",
|
|
91
|
+
"bg-base-200",
|
|
92
|
+
"flex-shrink-0",
|
|
93
|
+
"transition-all",
|
|
94
|
+
"duration-200",
|
|
95
|
+
w
|
|
96
|
+
].filter(Boolean).join(" "), E = m && t !== null && /* @__PURE__ */ o(
|
|
97
|
+
"button",
|
|
98
|
+
{
|
|
99
|
+
onClick: S,
|
|
100
|
+
className: "flex items-center justify-center h-10 w-full bg-base-300 hover:bg-base-content/10 transition-colors",
|
|
101
|
+
"aria-label": l ? "Expand sidebar" : "Collapse sidebar",
|
|
102
|
+
children: /* @__PURE__ */ o(
|
|
103
|
+
"svg",
|
|
104
|
+
{
|
|
105
|
+
className: `w-4 h-4 transition-transform ${l ? "rotate-180" : ""}`,
|
|
106
|
+
fill: "none",
|
|
107
|
+
viewBox: "0 0 24 24",
|
|
108
|
+
stroke: "currentColor",
|
|
109
|
+
children: /* @__PURE__ */ o("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" })
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
return /* @__PURE__ */ o(L.Provider, { value: { collapsed: l, collapsedWidth: a, width: s }, children: /* @__PURE__ */ A(
|
|
115
|
+
"aside",
|
|
116
|
+
{
|
|
117
|
+
className: B,
|
|
118
|
+
style: {
|
|
119
|
+
width: typeof x == "number" ? `${x}px` : x,
|
|
120
|
+
...g
|
|
121
|
+
},
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ o("div", { className: "flex-1 overflow-auto", children: n }),
|
|
124
|
+
t !== null && (t ?? E)
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
) });
|
|
128
|
+
}
|
|
129
|
+
v.displayName = "LayoutSider";
|
|
130
|
+
const W = Object.assign(h, {
|
|
131
|
+
Header: H,
|
|
132
|
+
Footer: I,
|
|
133
|
+
Content: O,
|
|
134
|
+
Sider: v
|
|
12
135
|
});
|
|
13
136
|
export {
|
|
14
|
-
|
|
137
|
+
W as Layout,
|
|
138
|
+
Q as useSiderContext
|
|
15
139
|
};
|
|
16
140
|
//# sourceMappingURL=index47.js.map
|
package/dist/index47.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index47.js","sources":["../src/components/List.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface ListProps extends React.HTMLAttributes<HTMLUListElement> {\n children: React.ReactNode\n}\n\nexport interface ListRowProps extends React.LiHTMLAttributes<HTMLLIElement> {\n children: React.ReactNode\n}\n\nfunction ListRoot({ children, className = '', ...rest }: ListProps) {\n const classes = ['list', className].filter(Boolean).join(' ')\n return <ul className={classes} {...rest}>{children}</ul>\n}\n\nfunction ListRow({ children, className = '', ...rest }: ListRowProps) {\n const classes = ['list-row', className].filter(Boolean).join(' ')\n return <li className={classes} {...rest}>{children}</li>\n}\n\nexport const List = Object.assign(ListRoot, {\n Row: ListRow,\n})\n"],"names":["ListRoot","children","className","rest","classes","ListRow","List"],"mappings":";AAUA,SAASA,EAAS,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,GAAGC,KAAmB;AAClE,QAAMC,IAAU,CAAC,QAAQF,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAC5D,2BAAQ,MAAA,EAAG,WAAWE,GAAU,GAAGD,GAAO,UAAAF,GAAS;AACrD;AAEA,SAASI,EAAQ,EAAE,UAAAJ,GAAU,WAAAC,IAAY,IAAI,GAAGC,KAAsB;AACpE,QAAMC,IAAU,CAAC,YAAYF,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAChE,2BAAQ,MAAA,EAAG,WAAWE,GAAU,GAAGD,GAAO,UAAAF,GAAS;AACrD;AAEO,MAAMK,IAAO,OAAO,OAAON,GAAU;AAAA,EAC1C,KAAKK;AACP,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index47.js","sources":["../src/components/Layout.tsx"],"sourcesContent":["import React, { createContext, useContext, useState, useCallback, useEffect } from 'react'\n\nexport interface LayoutProps {\n children: React.ReactNode\n className?: string\n style?: React.CSSProperties\n}\n\nexport interface LayoutHeaderProps {\n children: React.ReactNode\n className?: string\n style?: React.CSSProperties\n}\n\nexport interface LayoutFooterProps {\n children: React.ReactNode\n className?: string\n style?: React.CSSProperties\n}\n\nexport interface LayoutContentProps {\n children: React.ReactNode\n className?: string\n style?: React.CSSProperties\n}\n\nexport interface LayoutSiderProps {\n children: React.ReactNode\n width?: number | string\n collapsedWidth?: number | string\n collapsed?: boolean\n defaultCollapsed?: boolean\n collapsible?: boolean\n onCollapse?: (collapsed: boolean) => void\n trigger?: React.ReactNode | null\n breakpoint?: 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n onBreakpoint?: (broken: boolean) => void\n className?: string\n style?: React.CSSProperties\n}\n\ninterface SiderContextValue {\n collapsed: boolean\n collapsedWidth: number | string\n width: number | string\n}\n\nconst SiderContext = createContext<SiderContextValue | null>(null)\n\nexport function useSiderContext() {\n return useContext(SiderContext)\n}\n\nfunction LayoutRoot({ children, className = '', style }: LayoutProps) {\n // Check if any child is a Sider to determine flex direction\n const childArray = React.Children.toArray(children)\n const hasSider = childArray.some(\n (child) => React.isValidElement(child) && (child.type as any).displayName === 'LayoutSider'\n )\n\n const layoutClasses = [\n 'flex',\n 'min-h-0',\n hasSider ? 'flex-row' : 'flex-col',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n // If we have a Sider, auto-add flex-1 to non-Sider Layout children\n const processedChildren = hasSider\n ? childArray.map((child) => {\n if (\n React.isValidElement(child) &&\n (child.type === LayoutRoot || (child.type as any).displayName === 'LayoutRoot') &&\n (child.type as any).displayName !== 'LayoutSider'\n ) {\n // Clone the Layout child and add flex-1 if not already present\n const existingClassName = (child.props as any).className || ''\n if (!existingClassName.includes('flex-1')) {\n return React.cloneElement(child as React.ReactElement<any>, {\n className: `flex-1 ${existingClassName}`.trim(),\n })\n }\n }\n return child\n })\n : children\n\n return (\n <div className={layoutClasses} style={style}>\n {processedChildren}\n </div>\n )\n}\n\nLayoutRoot.displayName = 'LayoutRoot'\n\nfunction LayoutHeader({ children, className = '', style }: LayoutHeaderProps) {\n const headerClasses = [\n 'flex',\n 'items-center',\n 'px-6',\n 'h-16',\n 'bg-base-300',\n 'flex-shrink-0',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <header className={headerClasses} style={style}>\n {children}\n </header>\n )\n}\n\nfunction LayoutFooter({ children, className = '', style }: LayoutFooterProps) {\n const footerClasses = [\n 'px-6',\n 'py-4',\n 'text-center',\n 'bg-base-300',\n 'flex-shrink-0',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <footer className={footerClasses} style={style}>\n {children}\n </footer>\n )\n}\n\nfunction LayoutContent({ children, className = '', style }: LayoutContentProps) {\n // flex-1 by default so Content fills available space\n const contentClasses = ['flex-1', 'min-h-0', 'overflow-auto', className].filter(Boolean).join(' ')\n\n return (\n <main className={contentClasses} style={style}>\n {children}\n </main>\n )\n}\n\nconst BREAKPOINT_MAP: Record<string, string> = {\n sm: '(max-width: 639px)',\n md: '(max-width: 767px)',\n lg: '(max-width: 1023px)',\n xl: '(max-width: 1279px)',\n '2xl': '(max-width: 1535px)',\n}\n\nfunction LayoutSider({\n children,\n width = 200,\n collapsedWidth = 80,\n collapsed: controlledCollapsed,\n defaultCollapsed = false,\n collapsible = false,\n onCollapse,\n trigger,\n breakpoint,\n onBreakpoint,\n className = '',\n style,\n}: LayoutSiderProps) {\n const [internalCollapsed, setInternalCollapsed] = useState(defaultCollapsed)\n const [broken, setBroken] = useState(false)\n\n const collapsed = controlledCollapsed ?? internalCollapsed\n\n // Handle responsive breakpoint\n useEffect(() => {\n if (!breakpoint) return\n\n const mediaQuery = window.matchMedia(BREAKPOINT_MAP[breakpoint])\n\n const handleChange = (e: MediaQueryListEvent | MediaQueryList) => {\n const isBroken = e.matches\n setBroken(isBroken)\n onBreakpoint?.(isBroken)\n\n // Auto-collapse when breakpoint is crossed\n if (controlledCollapsed === undefined) {\n setInternalCollapsed(isBroken)\n }\n if (isBroken !== broken) {\n onCollapse?.(isBroken)\n }\n }\n\n // Check initial state\n handleChange(mediaQuery)\n\n // Listen for changes\n mediaQuery.addEventListener('change', handleChange)\n return () => mediaQuery.removeEventListener('change', handleChange)\n }, [breakpoint, onBreakpoint, controlledCollapsed, onCollapse, broken])\n\n const handleCollapse = useCallback(() => {\n const newCollapsed = !collapsed\n if (controlledCollapsed === undefined) {\n setInternalCollapsed(newCollapsed)\n }\n onCollapse?.(newCollapsed)\n }, [collapsed, controlledCollapsed, onCollapse])\n\n const currentWidth = collapsed ? collapsedWidth : width\n\n const siderClasses = [\n 'flex',\n 'flex-col',\n 'bg-base-200',\n 'flex-shrink-0',\n 'transition-all',\n 'duration-200',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const defaultTrigger = collapsible && trigger !== null && (\n <button\n onClick={handleCollapse}\n className=\"flex items-center justify-center h-10 w-full bg-base-300 hover:bg-base-content/10 transition-colors\"\n aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n >\n <svg\n className={`w-4 h-4 transition-transform ${collapsed ? 'rotate-180' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M15 19l-7-7 7-7\" />\n </svg>\n </button>\n )\n\n return (\n <SiderContext.Provider value={{ collapsed, collapsedWidth, width }}>\n <aside\n className={siderClasses}\n style={{\n width: typeof currentWidth === 'number' ? `${currentWidth}px` : currentWidth,\n ...style,\n }}\n >\n <div className=\"flex-1 overflow-auto\">{children}</div>\n {trigger !== null && (trigger ?? defaultTrigger)}\n </aside>\n </SiderContext.Provider>\n )\n}\n\nLayoutSider.displayName = 'LayoutSider'\n\nexport const Layout = Object.assign(LayoutRoot, {\n Header: LayoutHeader,\n Footer: LayoutFooter,\n Content: LayoutContent,\n Sider: LayoutSider,\n})\n"],"names":["SiderContext","createContext","useSiderContext","useContext","LayoutRoot","children","className","style","childArray","React","hasSider","child","layoutClasses","processedChildren","existingClassName","jsx","LayoutHeader","headerClasses","LayoutFooter","footerClasses","LayoutContent","contentClasses","BREAKPOINT_MAP","LayoutSider","width","collapsedWidth","controlledCollapsed","defaultCollapsed","collapsible","onCollapse","trigger","breakpoint","onBreakpoint","internalCollapsed","setInternalCollapsed","useState","broken","setBroken","collapsed","useEffect","mediaQuery","handleChange","e","isBroken","handleCollapse","useCallback","newCollapsed","currentWidth","siderClasses","defaultTrigger","jsxs","Layout"],"mappings":";;AA+CA,MAAMA,IAAeC,EAAwC,IAAI;AAE1D,SAASC,IAAkB;AAChC,SAAOC,EAAWH,CAAY;AAChC;AAEA,SAASI,EAAW,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,OAAAC,KAAsB;AAEpE,QAAMC,IAAaC,EAAM,SAAS,QAAQJ,CAAQ,GAC5CK,IAAWF,EAAW;AAAA,IAC1B,CAACG,MAAUF,EAAM,eAAeE,CAAK,KAAMA,EAAM,KAAa,gBAAgB;AAAA,EAAA,GAG1EC,IAAgB;AAAA,IACpB;AAAA,IACA;AAAA,IACAF,IAAW,aAAa;AAAA,IACxBJ;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG,GAGLO,IAAoBH,IACtBF,EAAW,IAAI,CAACG,MAAU;AACxB,QACEF,EAAM,eAAeE,CAAK,MACzBA,EAAM,SAASP,KAAeO,EAAM,KAAa,gBAAgB,iBACjEA,EAAM,KAAa,gBAAgB,eACpC;AAEA,YAAMG,IAAqBH,EAA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|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
sm: "loading-sm",
|
|
14
|
-
md: "loading-md",
|
|
15
|
-
lg: "loading-lg"
|
|
16
|
-
}, o = ["loading", {
|
|
17
|
-
spinner: "loading-spinner",
|
|
18
|
-
dots: "loading-dots",
|
|
19
|
-
ring: "loading-ring",
|
|
20
|
-
ball: "loading-ball",
|
|
21
|
-
bars: "loading-bars",
|
|
22
|
-
infinity: "loading-infinity"
|
|
23
|
-
}[t], c[r], d].filter(Boolean).join(" ");
|
|
24
|
-
return n ? /* @__PURE__ */ a("div", { className: "relative", ...i, children: [
|
|
25
|
-
l && /* @__PURE__ */ a("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-base-100/50 backdrop-blur-sm z-10", children: [
|
|
26
|
-
/* @__PURE__ */ s("span", { className: o }),
|
|
27
|
-
e && /* @__PURE__ */ s("p", { className: "mt-2 text-sm", children: e })
|
|
28
|
-
] }),
|
|
29
|
-
/* @__PURE__ */ s("div", { className: l ? "pointer-events-none" : "", children: n })
|
|
30
|
-
] }) : l ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center gap-2", ...i, children: [
|
|
31
|
-
/* @__PURE__ */ s("span", { className: o }),
|
|
32
|
-
e && /* @__PURE__ */ s("p", { className: "text-sm", children: e })
|
|
33
|
-
] }) : null;
|
|
34
|
-
};
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
function e({ children: s, className: o = "", ...t }) {
|
|
3
|
+
const i = ["list", o].filter(Boolean).join(" ");
|
|
4
|
+
return /* @__PURE__ */ n("ul", { className: i, ...t, children: s });
|
|
5
|
+
}
|
|
6
|
+
function l({ children: s, className: o = "", ...t }) {
|
|
7
|
+
const i = ["list-row", o].filter(Boolean).join(" ");
|
|
8
|
+
return /* @__PURE__ */ n("li", { className: i, ...t, children: s });
|
|
9
|
+
}
|
|
10
|
+
const r = Object.assign(e, {
|
|
11
|
+
Row: l
|
|
12
|
+
});
|
|
35
13
|
export {
|
|
36
|
-
|
|
14
|
+
r as List
|
|
37
15
|
};
|
|
38
16
|
//# sourceMappingURL=index48.js.map
|
package/dist/index48.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index48.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index48.js","sources":["../src/components/List.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface ListProps extends React.HTMLAttributes<HTMLUListElement> {\n children: React.ReactNode\n}\n\nexport interface ListRowProps extends React.LiHTMLAttributes<HTMLLIElement> {\n children: React.ReactNode\n}\n\nfunction ListRoot({ children, className = '', ...rest }: ListProps) {\n const classes = ['list', className].filter(Boolean).join(' ')\n return <ul className={classes} {...rest}>{children}</ul>\n}\n\nfunction ListRow({ children, className = '', ...rest }: ListRowProps) {\n const classes = ['list-row', className].filter(Boolean).join(' ')\n return <li className={classes} {...rest}>{children}</li>\n}\n\nexport const List = Object.assign(ListRoot, {\n Row: ListRow,\n})\n"],"names":["ListRoot","children","className","rest","classes","ListRow","List"],"mappings":";AAUA,SAASA,EAAS,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,GAAGC,KAAmB;AAClE,QAAMC,IAAU,CAAC,QAAQF,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAC5D,2BAAQ,MAAA,EAAG,WAAWE,GAAU,GAAGD,GAAO,UAAAF,GAAS;AACrD;AAEA,SAASI,EAAQ,EAAE,UAAAJ,GAAU,WAAAC,IAAY,IAAI,GAAGC,KAAsB;AACpE,QAAMC,IAAU,CAAC,YAAYF,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAChE,2BAAQ,MAAA,EAAG,WAAWE,GAAU,GAAGD,GAAO,UAAAF,GAAS;AACrD;AAEO,MAAMK,IAAO,OAAO,OAAON,GAAU;AAAA,EAC1C,KAAKK;AACP,CAAC;"}
|