asterui 0.12.73 → 0.12.75
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/Alert.d.ts +6 -0
- package/dist/components/Alert.js +42 -26
- package/dist/components/Alert.js.map +1 -1
- package/dist/components/Button.d.ts +9 -1
- package/dist/components/Button.js +130 -94
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Typography.d.ts +3 -2
- package/dist/components/Typography.js +56 -43
- package/dist/components/Typography.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
export interface ClosableType {
|
|
3
|
+
onClose?: () => void;
|
|
4
|
+
closeIcon?: React.ReactNode;
|
|
5
|
+
afterClose?: () => void;
|
|
6
|
+
}
|
|
2
7
|
export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
8
|
children: React.ReactNode;
|
|
4
9
|
type?: 'info' | 'success' | 'warning' | 'error';
|
|
@@ -6,6 +11,7 @@ export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
6
11
|
dash?: boolean;
|
|
7
12
|
soft?: boolean;
|
|
8
13
|
vertical?: boolean;
|
|
14
|
+
closable?: boolean | ClosableType;
|
|
9
15
|
/** Test ID for testing */
|
|
10
16
|
'data-testid'?: string;
|
|
11
17
|
}
|
package/dist/components/Alert.js
CHANGED
|
@@ -1,31 +1,47 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as h, jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g } from "react";
|
|
3
|
+
const j = "alert", v = "alert-info", x = "alert-success", I = "alert-warning", S = "alert-error", k = "alert-outline", w = "alert-dash", N = "alert-soft", V = "alert-vertical", O = ({
|
|
4
|
+
children: r,
|
|
5
|
+
className: n = "",
|
|
6
|
+
type: s,
|
|
7
|
+
outline: a = !1,
|
|
8
|
+
dash: c = !1,
|
|
9
|
+
soft: i = !1,
|
|
10
|
+
vertical: f = !1,
|
|
11
|
+
closable: e = !1,
|
|
12
|
+
...d
|
|
11
13
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
info:
|
|
16
|
-
success:
|
|
17
|
-
warning:
|
|
18
|
-
error:
|
|
19
|
-
}[
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
].filter(Boolean).join(" ")
|
|
26
|
-
|
|
14
|
+
const [u, C] = g(!0), A = [
|
|
15
|
+
j,
|
|
16
|
+
s && {
|
|
17
|
+
info: v,
|
|
18
|
+
success: x,
|
|
19
|
+
warning: I,
|
|
20
|
+
error: S
|
|
21
|
+
}[s],
|
|
22
|
+
a && k,
|
|
23
|
+
c && w,
|
|
24
|
+
i && N,
|
|
25
|
+
f && V,
|
|
26
|
+
n
|
|
27
|
+
].filter(Boolean).join(" "), b = e !== !1, t = typeof e == "object" ? e : {}, l = t.onClose, o = t.afterClose, m = t.closeIcon, p = () => {
|
|
28
|
+
l && l(), C(!1), o && o();
|
|
29
|
+
};
|
|
30
|
+
return u ? /* @__PURE__ */ h("div", { role: "alert", className: A, ...d, children: [
|
|
31
|
+
r,
|
|
32
|
+
b && /* @__PURE__ */ y(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
type: "button",
|
|
36
|
+
className: "btn btn-sm btn-circle ml-auto opacity-70 hover:opacity-100",
|
|
37
|
+
onClick: p,
|
|
38
|
+
"aria-label": "Close",
|
|
39
|
+
children: m || "✕"
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] }) : null;
|
|
27
43
|
};
|
|
28
44
|
export {
|
|
29
|
-
|
|
45
|
+
O as Alert
|
|
30
46
|
};
|
|
31
47
|
//# sourceMappingURL=Alert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../../src/components/Alert.tsx"],"sourcesContent":["import React from 'react'\n\n// DaisyUI classes\nconst dAlert = 'alert'\nconst dAlertInfo = 'alert-info'\nconst dAlertSuccess = 'alert-success'\nconst dAlertWarning = 'alert-warning'\nconst dAlertError = 'alert-error'\nconst dAlertOutline = 'alert-outline'\nconst dAlertDash = 'alert-dash'\nconst dAlertSoft = 'alert-soft'\nconst dAlertVertical = 'alert-vertical'\n\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n type?: 'info' | 'success' | 'warning' | 'error'\n outline?: boolean\n dash?: boolean\n soft?: boolean\n vertical?: boolean\n /** Test ID for testing */\n 'data-testid'?: string\n}\n\nexport const Alert: React.FC<AlertProps> = ({\n children,\n className = '',\n type,\n outline = false,\n dash = false,\n soft = false,\n vertical = false,\n ...rest\n}) => {\n const typeClasses = {\n info: dAlertInfo,\n success: dAlertSuccess,\n warning: dAlertWarning,\n error: dAlertError,\n }\n\n const classes = [\n dAlert,\n type && typeClasses[type],\n outline && dAlertOutline,\n dash && dAlertDash,\n soft && dAlertSoft,\n vertical && dAlertVertical,\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div role=\"alert\" className={classes} {...rest}>\n {children}\n </div>\n )\n}\n"],"names":["dAlert","dAlertInfo","dAlertSuccess","dAlertWarning","dAlertError","dAlertOutline","dAlertDash","dAlertSoft","dAlertVertical","Alert","children","className","type","outline","dash","soft","vertical","rest","classes","jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../../src/components/Alert.tsx"],"sourcesContent":["import React, { useState } from 'react'\n\n// DaisyUI classes\nconst dAlert = 'alert'\nconst dAlertInfo = 'alert-info'\nconst dAlertSuccess = 'alert-success'\nconst dAlertWarning = 'alert-warning'\nconst dAlertError = 'alert-error'\nconst dAlertOutline = 'alert-outline'\nconst dAlertDash = 'alert-dash'\nconst dAlertSoft = 'alert-soft'\nconst dAlertVertical = 'alert-vertical'\n\nexport interface ClosableType {\n onClose?: () => void\n closeIcon?: React.ReactNode\n afterClose?: () => void\n}\n\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n type?: 'info' | 'success' | 'warning' | 'error'\n outline?: boolean\n dash?: boolean\n soft?: boolean\n vertical?: boolean\n closable?: boolean | ClosableType\n /** Test ID for testing */\n 'data-testid'?: string\n}\n\nexport const Alert: React.FC<AlertProps> = ({\n children,\n className = '',\n type,\n outline = false,\n dash = false,\n soft = false,\n vertical = false,\n closable = false,\n ...rest\n}) => {\n const [visible, setVisible] = useState(true)\n\n const typeClasses = {\n info: dAlertInfo,\n success: dAlertSuccess,\n warning: dAlertWarning,\n error: dAlertError,\n }\n\n const classes = [\n dAlert,\n type && typeClasses[type],\n outline && dAlertOutline,\n dash && dAlertDash,\n soft && dAlertSoft,\n vertical && dAlertVertical,\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n // Determine close config from props\n const isClosable = closable !== false\n const closableConfig = typeof closable === 'object' ? closable : {}\n const handleClose = closableConfig.onClose\n const afterClose = closableConfig.afterClose\n const closeIcon = closableConfig.closeIcon\n\n const handleCloseClick = () => {\n if (handleClose) {\n handleClose()\n }\n setVisible(false)\n if (afterClose) {\n afterClose()\n }\n }\n\n if (!visible) {\n return null\n }\n\n return (\n <div role=\"alert\" className={classes} {...rest}>\n {children}\n {isClosable && (\n <button\n type=\"button\"\n className=\"btn btn-sm btn-circle ml-auto opacity-70 hover:opacity-100\"\n onClick={handleCloseClick}\n aria-label=\"Close\"\n >\n {closeIcon || '✕'}\n </button>\n )}\n </div>\n )\n}\n"],"names":["dAlert","dAlertInfo","dAlertSuccess","dAlertWarning","dAlertError","dAlertOutline","dAlertDash","dAlertSoft","dAlertVertical","Alert","children","className","type","outline","dash","soft","vertical","closable","rest","visible","setVisible","useState","classes","isClosable","closableConfig","handleClose","afterClose","closeIcon","handleCloseClick","jsx"],"m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@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
type BaseButtonProps = {
|
|
3
|
+
/** Syntactic sugar for setting variant and color together. Will be overridden by explicit variant & color props. */
|
|
4
|
+
type?: 'primary' | 'default' | 'dashed' | 'link' | 'text';
|
|
3
5
|
/** Button color */
|
|
4
6
|
color?: 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | 'neutral';
|
|
5
7
|
/** Button style variant */
|
|
6
|
-
variant?: 'solid' | 'outline' | 'dash' | 'soft' | 'ghost' | 'link';
|
|
8
|
+
variant?: 'solid' | 'outline' | 'dash' | 'soft' | 'ghost' | 'link' | 'text';
|
|
7
9
|
/** Button size */
|
|
8
10
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
11
|
/** Active/pressed visual state */
|
|
@@ -12,6 +14,10 @@ type BaseButtonProps = {
|
|
|
12
14
|
loading?: boolean;
|
|
13
15
|
/** Button shape */
|
|
14
16
|
shape?: 'square' | 'circle' | 'wide' | 'block' | 'round';
|
|
17
|
+
/** Make the button full width */
|
|
18
|
+
block?: boolean;
|
|
19
|
+
/** Make background transparent and invert text and border colors */
|
|
20
|
+
ghost?: boolean;
|
|
15
21
|
/** Disable click animation */
|
|
16
22
|
noAnimation?: boolean;
|
|
17
23
|
/** Icon element to display */
|
|
@@ -24,6 +30,8 @@ type BaseButtonProps = {
|
|
|
24
30
|
danger?: boolean;
|
|
25
31
|
/** Toggle button pressed state (sets aria-pressed) */
|
|
26
32
|
pressed?: boolean;
|
|
33
|
+
/** Accessible label for icon-only buttons */
|
|
34
|
+
'aria-label'?: string;
|
|
27
35
|
/** Test ID for testing */
|
|
28
36
|
'data-testid'?: string;
|
|
29
37
|
};
|
|
@@ -1,124 +1,160 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { SizeProvider as
|
|
4
|
-
import { useConfig as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as o, jsxs as U, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Z } from "react";
|
|
3
|
+
import { SizeProvider as _ } from "../contexts/SizeContext.js";
|
|
4
|
+
import { useConfig as tt } from "../providers/ConfigProvider.js";
|
|
5
|
+
const nt = "btn", st = "btn-primary", et = "btn-secondary", at = "btn-accent", ot = "btn-info", it = "btn-success", rt = "btn-warning", ct = "btn-error", dt = "btn-neutral", lt = "btn-outline", bt = "btn-dash", mt = "btn-soft", N = "btn-ghost", ft = "btn-link", ut = "btn-xs", Bt = "btn-sm", ht = "btn-md", kt = "btn-lg", pt = "btn-xl", vt = "btn-active", yt = "btn-square", gt = "btn-circle", xt = "btn-wide", Ct = "btn-block", St = "loading", wt = "loading-spinner", Dt = Z(
|
|
6
6
|
({
|
|
7
|
-
children:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
children: i,
|
|
8
|
+
type: m,
|
|
9
|
+
color: f,
|
|
10
|
+
variant: u,
|
|
11
|
+
size: P,
|
|
12
|
+
active: l = !1,
|
|
12
13
|
loading: t = !1,
|
|
13
|
-
shape:
|
|
14
|
-
|
|
14
|
+
shape: B,
|
|
15
|
+
block: K = !1,
|
|
16
|
+
ghost: j = !1,
|
|
17
|
+
noAnimation: q = !1,
|
|
15
18
|
icon: r,
|
|
16
|
-
iconPlacement:
|
|
17
|
-
iconPosition:
|
|
18
|
-
danger:
|
|
19
|
-
pressed:
|
|
20
|
-
className:
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
iconPlacement: L,
|
|
20
|
+
iconPosition: T,
|
|
21
|
+
danger: $ = !1,
|
|
22
|
+
pressed: c,
|
|
23
|
+
className: A = "",
|
|
24
|
+
"aria-label": h,
|
|
25
|
+
"data-testid": k,
|
|
26
|
+
...d
|
|
27
|
+
}, p) => {
|
|
28
|
+
const { componentSize: E } = tt(), b = P ?? E ?? "md";
|
|
29
|
+
let n = u, v = f;
|
|
30
|
+
if (m && !u && !f)
|
|
31
|
+
switch (m) {
|
|
32
|
+
case "primary":
|
|
33
|
+
n = "solid", v = "primary";
|
|
34
|
+
break;
|
|
35
|
+
case "default":
|
|
36
|
+
n = "outline";
|
|
37
|
+
break;
|
|
38
|
+
case "dashed":
|
|
39
|
+
n = "dash";
|
|
40
|
+
break;
|
|
41
|
+
case "link":
|
|
42
|
+
n = "link";
|
|
43
|
+
break;
|
|
44
|
+
case "text":
|
|
45
|
+
n = "text";
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
const y = $ ? "error" : v, g = j && !n ? "ghost" : n, s = L ?? T ?? "start", x = K && !B ? "block" : B, I = {
|
|
49
|
+
primary: st,
|
|
50
|
+
secondary: et,
|
|
51
|
+
accent: at,
|
|
52
|
+
info: ot,
|
|
53
|
+
success: it,
|
|
54
|
+
warning: rt,
|
|
55
|
+
error: ct,
|
|
56
|
+
neutral: dt
|
|
57
|
+
}, V = {
|
|
34
58
|
solid: "",
|
|
35
59
|
// default, no extra class needed
|
|
36
|
-
outline:
|
|
37
|
-
dash:
|
|
38
|
-
soft:
|
|
39
|
-
ghost:
|
|
40
|
-
link:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
outline: lt,
|
|
61
|
+
dash: bt,
|
|
62
|
+
soft: mt,
|
|
63
|
+
ghost: N,
|
|
64
|
+
link: ft,
|
|
65
|
+
text: N
|
|
66
|
+
// text variant uses ghost styling
|
|
67
|
+
}, W = {
|
|
68
|
+
xs: ut,
|
|
69
|
+
sm: Bt,
|
|
70
|
+
md: ht,
|
|
71
|
+
lg: kt,
|
|
72
|
+
xl: pt
|
|
73
|
+
}, X = {
|
|
74
|
+
square: yt,
|
|
75
|
+
circle: gt,
|
|
76
|
+
wide: xt,
|
|
77
|
+
block: Ct,
|
|
52
78
|
round: "rounded-full"
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
].filter(Boolean).join(" "),
|
|
63
|
-
xs:
|
|
64
|
-
sm:
|
|
65
|
-
md:
|
|
66
|
-
lg:
|
|
67
|
-
xl:
|
|
68
|
-
}[
|
|
69
|
-
t && /* @__PURE__ */ o("span", { className: `${
|
|
70
|
-
!t && r &&
|
|
71
|
-
|
|
72
|
-
!t && r &&
|
|
79
|
+
}, C = [
|
|
80
|
+
nt,
|
|
81
|
+
y && I[y],
|
|
82
|
+
g && V[g],
|
|
83
|
+
W[b],
|
|
84
|
+
l && vt,
|
|
85
|
+
x && X[x],
|
|
86
|
+
q && "no-animation",
|
|
87
|
+
A
|
|
88
|
+
].filter(Boolean).join(" "), F = i != null && i !== "" ? {
|
|
89
|
+
xs: s === "start" ? "mr-1" : "ml-1",
|
|
90
|
+
sm: s === "start" ? "mr-1" : "ml-1",
|
|
91
|
+
md: s === "start" ? "mr-1.5" : "ml-1.5",
|
|
92
|
+
lg: s === "start" ? "mr-2" : "ml-2",
|
|
93
|
+
xl: s === "start" ? "mr-2" : "ml-2"
|
|
94
|
+
}[b] : "", S = r && /* @__PURE__ */ o(_, { size: b, children: /* @__PURE__ */ o("span", { className: `inline-flex items-center ${F}`, "aria-hidden": "true", children: r }) }), w = /* @__PURE__ */ U(Y, { children: [
|
|
95
|
+
t && /* @__PURE__ */ o("span", { className: `${St} ${wt}`, "aria-hidden": "true" }),
|
|
96
|
+
!t && r && s === "start" && S,
|
|
97
|
+
i,
|
|
98
|
+
!t && r && s === "end" && S
|
|
73
99
|
] });
|
|
74
|
-
if ("href" in
|
|
75
|
-
const { href:
|
|
100
|
+
if ("href" in d && d.href !== void 0) {
|
|
101
|
+
const { href: O, disabled: R, onKeyDown: H, onClick: J, ...Q } = d, a = R || t;
|
|
76
102
|
return /* @__PURE__ */ o(
|
|
77
103
|
"a",
|
|
78
104
|
{
|
|
79
|
-
ref:
|
|
80
|
-
href:
|
|
105
|
+
ref: p,
|
|
106
|
+
href: a ? void 0 : O,
|
|
81
107
|
role: "button",
|
|
82
|
-
className:
|
|
83
|
-
"aria-disabled":
|
|
108
|
+
className: C,
|
|
109
|
+
"aria-disabled": a || void 0,
|
|
84
110
|
"aria-busy": t || void 0,
|
|
85
|
-
"aria-pressed":
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
111
|
+
"aria-pressed": c,
|
|
112
|
+
"aria-label": h,
|
|
113
|
+
tabIndex: a ? -1 : 0,
|
|
114
|
+
onKeyDown: (e) => {
|
|
115
|
+
e.key === " " && !a && (e.preventDefault(), e.currentTarget.click()), H?.(e);
|
|
89
116
|
},
|
|
90
|
-
onClick: (
|
|
91
|
-
if (
|
|
92
|
-
|
|
117
|
+
onClick: (e) => {
|
|
118
|
+
if (a) {
|
|
119
|
+
e.preventDefault();
|
|
93
120
|
return;
|
|
94
121
|
}
|
|
95
|
-
|
|
122
|
+
J?.(e);
|
|
96
123
|
},
|
|
97
|
-
"data-testid":
|
|
98
|
-
|
|
99
|
-
|
|
124
|
+
"data-testid": k,
|
|
125
|
+
"data-state-loading": t || void 0,
|
|
126
|
+
"data-state-disabled": a || void 0,
|
|
127
|
+
"data-state-active": l || void 0,
|
|
128
|
+
"data-state-pressed": c,
|
|
129
|
+
...Q,
|
|
130
|
+
children: w
|
|
100
131
|
}
|
|
101
132
|
);
|
|
102
133
|
}
|
|
103
|
-
const { htmlType:
|
|
134
|
+
const { htmlType: G, ...D } = d, M = G ?? "button", z = t || D.disabled;
|
|
104
135
|
return /* @__PURE__ */ o(
|
|
105
136
|
"button",
|
|
106
137
|
{
|
|
107
|
-
ref:
|
|
108
|
-
type:
|
|
109
|
-
className:
|
|
138
|
+
ref: p,
|
|
139
|
+
type: M,
|
|
140
|
+
className: C,
|
|
110
141
|
"aria-busy": t || void 0,
|
|
111
|
-
"aria-pressed":
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
142
|
+
"aria-pressed": c,
|
|
143
|
+
"aria-label": h,
|
|
144
|
+
disabled: z,
|
|
145
|
+
"data-testid": k,
|
|
146
|
+
"data-state-loading": t || void 0,
|
|
147
|
+
"data-state-disabled": z || void 0,
|
|
148
|
+
"data-state-active": l || void 0,
|
|
149
|
+
"data-state-pressed": c,
|
|
150
|
+
...D,
|
|
151
|
+
children: w
|
|
116
152
|
}
|
|
117
153
|
);
|
|
118
154
|
}
|
|
119
155
|
);
|
|
120
|
-
|
|
156
|
+
Dt.displayName = "Button";
|
|
121
157
|
export {
|
|
122
|
-
|
|
158
|
+
Dt as Button
|
|
123
159
|
};
|
|
124
160
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../src/components/Button.tsx"],"sourcesContent":["import React, { forwardRef } from 'react'\nimport { SizeProvider } from '../contexts/SizeContext'\nimport { useConfig } from '../providers/ConfigProvider'\n\n// DaisyUI classes\nconst dBtn = 'btn'\nconst dBtnPrimary = 'btn-primary'\nconst dBtnSecondary = 'btn-secondary'\nconst dBtnAccent = 'btn-accent'\nconst dBtnInfo = 'btn-info'\nconst dBtnSuccess = 'btn-success'\nconst dBtnWarning = 'btn-warning'\nconst dBtnError = 'btn-error'\nconst dBtnNeutral = 'btn-neutral'\nconst dBtnOutline = 'btn-outline'\nconst dBtnDash = 'btn-dash'\nconst dBtnSoft = 'btn-soft'\nconst dBtnGhost = 'btn-ghost'\nconst dBtnLink = 'btn-link'\nconst dBtnXs = 'btn-xs'\nconst dBtnSm = 'btn-sm'\nconst dBtnMd = 'btn-md'\nconst dBtnLg = 'btn-lg'\nconst dBtnXl = 'btn-xl'\nconst dBtnActive = 'btn-active'\nconst dBtnSquare = 'btn-square'\nconst dBtnCircle = 'btn-circle'\nconst dBtnWide = 'btn-wide'\nconst dBtnBlock = 'btn-block'\nconst dLoading = 'loading'\nconst dLoadingSpinner = 'loading-spinner'\n\ntype BaseButtonProps = {\n /** Button color */\n color?: 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | 'neutral'\n /** Button style variant */\n variant?: 'solid' | 'outline' | 'dash' | 'soft' | 'ghost' | 'link'\n /** Button size */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /** Active/pressed visual state */\n active?: boolean\n /** Show loading spinner and disable button */\n loading?: boolean\n /** Button shape */\n shape?: 'square' | 'circle' | 'wide' | 'block' | 'round'\n /** Disable click animation */\n noAnimation?: boolean\n /** Icon element to display */\n icon?: React.ReactNode\n /** Position of the icon */\n iconPlacement?: 'start' | 'end'\n /** @deprecated Use iconPlacement instead */\n iconPosition?: 'start' | 'end'\n /** Applies error/danger styling (shorthand for color=\"error\") */\n danger?: boolean\n /** Toggle button pressed state (sets aria-pressed) */\n pressed?: boolean\n /** Test ID for testing */\n 'data-testid'?: string\n}\n\ntype ButtonAsButton = BaseButtonProps &\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> & {\n href?: undefined\n htmlType?: 'button' | 'submit' | 'reset'\n }\n\ntype ButtonAsAnchor = BaseButtonProps &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'type'> & {\n href: string\n htmlType?: undefined\n /** Disable the link button */\n disabled?: boolean\n }\n\nexport type ButtonProps = ButtonAsButton | ButtonAsAnchor\n\nexport const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(\n (\n {\n children,\n color,\n variant,\n size,\n active = false,\n loading = false,\n shape,\n noAnimation = false,\n icon,\n iconPlacement,\n iconPosition,\n danger = false,\n pressed,\n className = '',\n 'data-testid': testId,\n ...props\n },\n ref\n ) => {\n const { componentSize } = useConfig()\n const effectiveSize = size ?? componentSize ?? 'md'\n // danger prop is a shorthand for color=\"error\"\n const effectiveColor = danger ? 'error' : color\n // iconPlacement takes precedence over deprecated iconPosition\n const effectiveIconPlacement = iconPlacement ?? iconPosition ?? 'start'\n\n const colorClasses = {\n primary: dBtnPrimary,\n secondary: dBtnSecondary,\n accent: dBtnAccent,\n info: dBtnInfo,\n success: dBtnSuccess,\n warning: dBtnWarning,\n error: dBtnError,\n neutral: dBtnNeutral,\n }\n\n const variantClasses = {\n solid: '', // default, no extra class needed\n outline: dBtnOutline,\n dash: dBtnDash,\n soft: dBtnSoft,\n ghost: dBtnGhost,\n link: dBtnLink,\n }\n\n const sizeClasses = {\n xs: dBtnXs,\n sm: dBtnSm,\n md: dBtnMd,\n lg: dBtnLg,\n xl: dBtnXl,\n }\n\n const shapeClasses = {\n square: dBtnSquare,\n circle: dBtnCircle,\n wide: dBtnWide,\n block: dBtnBlock,\n round: 'rounded-full',\n }\n\n const classes = [\n dBtn,\n effectiveColor && colorClasses[effectiveColor],\n variant && variantClasses[variant],\n sizeClasses[effectiveSize],\n active && dBtnActive,\n shape && shapeClasses[shape],\n noAnimation && 'no-animation',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n // Determine icon spacing based on whether there's text content and button size\n const hasChildren = children !== undefined && children !== null && children !== ''\n const spacingBySize = {\n xs: effectiveIconPlacement === 'start' ? 'mr-1' : 'ml-1',\n sm: effectiveIconPlacement === 'start' ? 'mr-1' : 'ml-1',\n md: effectiveIconPlacement === 'start' ? 'mr-1.5' : 'ml-1.5',\n lg: effectiveIconPlacement === 'start' ? 'mr-2' : 'ml-2',\n xl: effectiveIconPlacement === 'start' ? 'mr-2' : 'ml-2',\n }\n const iconSpacing = hasChildren ? spacingBySize[effectiveSize] : ''\n\n const iconElement = icon && (\n <SizeProvider size={effectiveSize}>\n <span className={`inline-flex items-center ${iconSpacing}`} aria-hidden=\"true\">\n {icon}\n </span>\n </SizeProvider>\n )\n\n const content = (\n <>\n {loading && <span className={`${dLoading} ${dLoadingSpinner}`} aria-hidden=\"true\"></span>}\n {!loading && icon && effectiveIconPlacement === 'start' && iconElement}\n {children}\n {!loading && icon && effectiveIconPlacement === 'end' && iconElement}\n </>\n )\n\n if ('href' in props && props.href !== undefined) {\n const { href, disabled, onKeyDown, onClick, ...anchorProps } = props as ButtonAsAnchor & {\n onKeyDown?: React.KeyboardEventHandler<HTMLAnchorElement>\n onClick?: React.MouseEventHandler<HTMLAnchorElement>\n }\n const isDisabled = disabled || loading\n\n // Handle Space key for anchor buttons (links only respond to Enter natively)\n const handleKeyDown = (event: React.KeyboardEvent<HTMLAnchorElement>) => {\n if (event.key === ' ' && !isDisabled) {\n event.preventDefault()\n event.currentTarget.click()\n }\n onKeyDown?.(event)\n }\n\n // Prevent click when disabled\n const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\n if (isDisabled) {\n event.preventDefault()\n return\n }\n onClick?.(event)\n }\n\n return (\n <a\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={isDisabled ? undefined : href}\n role=\"button\"\n className={classes}\n aria-disabled={isDisabled || undefined}\n aria-busy={loading || undefined}\n aria-pressed={pressed}\n tabIndex={isDisabled ? -1 : 0}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n data-testid={testId}\n {...anchorProps}\n >\n {content}\n </a>\n )\n }\n\n const { htmlType, ...buttonProps } = props as Omit<ButtonAsButton, keyof BaseButtonProps>\n const buttonType: 'button' | 'submit' | 'reset' = htmlType ?? 'button'\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type={buttonType}\n className={classes}\n aria-busy={loading || undefined}\n aria-pressed={pressed}\n disabled={loading || buttonProps.disabled}\n data-testid={testId}\n {...buttonProps}\n >\n {content}\n </button>\n )\n }\n)\n\nButton.displayName = 'Button'\n"],"names":["dBtn","dBtnPrimary","dBtnSecondary","dBtnAccent","dBtnInfo","dBtnSuccess","dBtnWarning","dBtnError","dBtnNeutral","dBtnOutline","dBtnDash","dBtnSoft","dBtnGhost","dBtnLink","dBtnXs","dBtnSm","dBtnMd","dBtnLg","dBtnXl","dBtnActive","dBtnSquare","dBtnCircle","dBtnWide","dBtnBlock","dLoading","dLoadingSpinner","Button","forwardRef","children","color","variant","size","active","loading","shape","noAnimation","icon","iconPlacement","iconPosition","danger","pressed","className","testId","props","ref","componentSize","useConfig","effectiveSize","effectiveColor","effectiveIconPlacement","colorClasses","variantClasses","sizeClasses","shapeClasses","classes","iconSpacing","iconElement","jsx","SizeProvider","content","jsxs","Fragment","href","disabled","onKeyDown","onClick","anchorProps","isDisabled","event","htmlType","buttonProps"],"mappings":";;;;AAKA,MAAMA,IAAO,OACPC,IAAc,eACdC,IAAgB,iBAChBC,IAAa,cACbC,IAAW,YACXC,IAAc,eACdC,IAAc,eACdC,IAAY,aACZC,IAAc,eACdC,IAAc,eACdC,KAAW,YACXC,KAAW,YACXC,KAAY,aACZC,KAAW,YACXC,KAAS,UACTC,KAAS,UACTC,KAAS,UACTC,KAAS,UACTC,KAAS,UACTC,KAAa,cACbC,KAAa,cACbC,KAAa,cACbC,KAAW,YACXC,KAAY,aACZC,KAAW,WACXC,KAAkB,mBA+CXC,KAASC;AAAA,EACpB,CACE;AAAA,IACE,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,SAAAC,IAAU;AAAA,IACV,OAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,MAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,SAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,eAAeC;AAAA,IACf,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAM,EAAE,eAAAC,EAAA,IAAkBC,EAAA,GACpBC,IAAgBhB,KAAQc,KAAiB,MAEzCG,IAAiBT,IAAS,UAAUV,GAEpCoB,IAAyBZ,KAAiBC,KAAgB,SAE1DY,IAAe;A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AcO;AAAA,QACd,UAAUP,KAAWqC,EAAY;AAAA,QACjC,eAAa5B;AAAA,QACZ,GAAG4B;AAAA,QAEH,UAAAX;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAjC,GAAO,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../src/components/Button.tsx"],"sourcesContent":["import React, { forwardRef } from 'react'\nimport { SizeProvider } from '../contexts/SizeContext'\nimport { useConfig } from '../providers/ConfigProvider'\n\n// DaisyUI classes\nconst dBtn = 'btn'\nconst dBtnPrimary = 'btn-primary'\nconst dBtnSecondary = 'btn-secondary'\nconst dBtnAccent = 'btn-accent'\nconst dBtnInfo = 'btn-info'\nconst dBtnSuccess = 'btn-success'\nconst dBtnWarning = 'btn-warning'\nconst dBtnError = 'btn-error'\nconst dBtnNeutral = 'btn-neutral'\nconst dBtnOutline = 'btn-outline'\nconst dBtnDash = 'btn-dash'\nconst dBtnSoft = 'btn-soft'\nconst dBtnGhost = 'btn-ghost'\nconst dBtnLink = 'btn-link'\nconst dBtnXs = 'btn-xs'\nconst dBtnSm = 'btn-sm'\nconst dBtnMd = 'btn-md'\nconst dBtnLg = 'btn-lg'\nconst dBtnXl = 'btn-xl'\nconst dBtnActive = 'btn-active'\nconst dBtnSquare = 'btn-square'\nconst dBtnCircle = 'btn-circle'\nconst dBtnWide = 'btn-wide'\nconst dBtnBlock = 'btn-block'\nconst dLoading = 'loading'\nconst dLoadingSpinner = 'loading-spinner'\n\ntype BaseButtonProps = {\n /** Syntactic sugar for setting variant and color together. Will be overridden by explicit variant & color props. */\n type?: 'primary' | 'default' | 'dashed' | 'link' | 'text'\n /** Button color */\n color?: 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | 'neutral'\n /** Button style variant */\n variant?: 'solid' | 'outline' | 'dash' | 'soft' | 'ghost' | 'link' | 'text'\n /** Button size */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /** Active/pressed visual state */\n active?: boolean\n /** Show loading spinner and disable button */\n loading?: boolean\n /** Button shape */\n shape?: 'square' | 'circle' | 'wide' | 'block' | 'round'\n /** Make the button full width */\n block?: boolean\n /** Make background transparent and invert text and border colors */\n ghost?: boolean\n /** Disable click animation */\n noAnimation?: boolean\n /** Icon element to display */\n icon?: React.ReactNode\n /** Position of the icon */\n iconPlacement?: 'start' | 'end'\n /** @deprecated Use iconPlacement instead */\n iconPosition?: 'start' | 'end'\n /** Applies error/danger styling (shorthand for color=\"error\") */\n danger?: boolean\n /** Toggle button pressed state (sets aria-pressed) */\n pressed?: boolean\n /** Accessible label for icon-only buttons */\n 'aria-label'?: string\n /** Test ID for testing */\n 'data-testid'?: string\n}\n\ntype ButtonAsButton = BaseButtonProps &\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> & {\n href?: undefined\n htmlType?: 'button' | 'submit' | 'reset'\n }\n\ntype ButtonAsAnchor = BaseButtonProps &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'type'> & {\n href: string\n htmlType?: undefined\n /** Disable the link button */\n disabled?: boolean\n }\n\nexport type ButtonProps = ButtonAsButton | ButtonAsAnchor\n\nexport const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(\n (\n {\n children,\n type,\n color,\n variant,\n size,\n active = false,\n loading = false,\n shape,\n block = false,\n ghost = false,\n noAnimation = false,\n icon,\n iconPlacement,\n iconPosition,\n danger = false,\n pressed,\n className = '',\n 'aria-label': ariaLabel,\n 'data-testid': testId,\n ...props\n },\n ref\n ) => {\n const { componentSize } = useConfig()\n const effectiveSize = size ?? componentSize ?? 'md'\n\n // Apply type prop (syntactic sugar) - explicit variant/color takes precedence\n let derivedVariant = variant\n let derivedColor = color\n if (type && !variant && !color) {\n switch (type) {\n case 'primary':\n derivedVariant = 'solid'\n derivedColor = 'primary'\n break\n case 'default':\n derivedVariant = 'outline'\n break\n case 'dashed':\n derivedVariant = 'dash'\n break\n case 'link':\n derivedVariant = 'link'\n break\n case 'text':\n derivedVariant = 'text'\n break\n }\n }\n\n // danger prop is a shorthand for color=\"error\"\n const effectiveColor = danger ? 'error' : derivedColor\n const effectiveVariant = ghost && !derivedVariant ? 'ghost' : derivedVariant\n // iconPlacement takes precedence over deprecated iconPosition\n const effectiveIconPlacement = iconPlacement ?? iconPosition ?? 'start'\n // block prop is a shorthand for shape=\"block\"\n const effectiveShape = block && !shape ? 'block' : shape\n\n const colorClasses = {\n primary: dBtnPrimary,\n secondary: dBtnSecondary,\n accent: dBtnAccent,\n info: dBtnInfo,\n success: dBtnSuccess,\n warning: dBtnWarning,\n error: dBtnError,\n neutral: dBtnNeutral,\n }\n\n const variantClasses = {\n solid: '', // default, no extra class needed\n outline: dBtnOutline,\n dash: dBtnDash,\n soft: dBtnSoft,\n ghost: dBtnGhost,\n link: dBtnLink,\n text: dBtnGhost, // text variant uses ghost styling\n }\n\n const sizeClasses = {\n xs: dBtnXs,\n sm: dBtnSm,\n md: dBtnMd,\n lg: dBtnLg,\n xl: dBtnXl,\n }\n\n const shapeClasses = {\n square: dBtnSquare,\n circle: dBtnCircle,\n wide: dBtnWide,\n block: dBtnBlock,\n round: 'rounded-full',\n }\n\n const classes = [\n dBtn,\n effectiveColor && colorClasses[effectiveColor],\n effectiveVariant && variantClasses[effectiveVariant],\n sizeClasses[effectiveSize],\n active && dBtnActive,\n effectiveShape && shapeClasses[effectiveShape],\n noAnimation && 'no-animation',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n // Determine icon spacing based on whether there's text content and button size\n const hasChildren = children !== undefined && children !== null && children !== ''\n const spacingBySize = {\n xs: effectiveIconPlacement === 'start' ? 'mr-1' : 'ml-1',\n sm: effectiveIconPlacement === 'start' ? 'mr-1' : 'ml-1',\n md: effectiveIconPlacement === 'start' ? 'mr-1.5' : 'ml-1.5',\n lg: effectiveIconPlacement === 'start' ? 'mr-2' : 'ml-2',\n xl: effectiveIconPlacement === 'start' ? 'mr-2' : 'ml-2',\n }\n const iconSpacing = hasChildren ? spacingBySize[effectiveSize] : ''\n\n const iconElement = icon && (\n <SizeProvider size={effectiveSize}>\n <span className={`inline-flex items-center ${iconSpacing}`} aria-hidden=\"true\">\n {icon}\n </span>\n </SizeProvider>\n )\n\n const content = (\n <>\n {loading && <span className={`${dLoading} ${dLoadingSpinner}`} aria-hidden=\"true\"></span>}\n {!loading && icon && effectiveIconPlacement === 'start' && iconElement}\n {children}\n {!loading && icon && effectiveIconPlacement === 'end' && iconElement}\n </>\n )\n\n if ('href' in props && props.href !== undefined) {\n const { href, disabled, onKeyDown, onClick, ...anchorProps } = props as ButtonAsAnchor & {\n onKeyDown?: React.KeyboardEventHandler<HTMLAnchorElement>\n onClick?: React.MouseEventHandler<HTMLAnchorElement>\n }\n const isDisabled = disabled || loading\n\n // Handle Space key for anchor buttons (links only respond to Enter natively)\n const handleKeyDown = (event: React.KeyboardEvent<HTMLAnchorElement>) => {\n if (event.key === ' ' && !isDisabled) {\n event.preventDefault()\n event.currentTarget.click()\n }\n onKeyDown?.(event)\n }\n\n // Prevent click when disabled\n const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\n if (isDisabled) {\n event.preventDefault()\n return\n }\n onClick?.(event)\n }\n\n return (\n <a\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={isDisabled ? undefined : href}\n role=\"button\"\n className={classes}\n aria-disabled={isDisabled || undefined}\n aria-busy={loading || undefined}\n aria-pressed={pressed}\n aria-label={ariaLabel}\n tabIndex={isDisabled ? -1 : 0}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n data-testid={testId}\n data-state-loading={loading || undefined}\n data-state-disabled={isDisabled || undefined}\n data-state-active={active || undefined}\n data-state-pressed={pressed}\n {...anchorProps}\n >\n {content}\n </a>\n )\n }\n\n const { htmlType, ...buttonProps } = props as Omit<ButtonAsButton, keyof BaseButtonProps>\n const buttonType: 'button' | 'submit' | 'reset' = htmlType ?? 'button'\n const isDisabled = loading || buttonProps.disabled\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type={buttonType}\n className={classes}\n aria-busy={loading || undefined}\n aria-pressed={pressed}\n aria-label={ariaLabel}\n disabled={isDisabled}\n data-testid={testId}\n data-state-loading={loading || undefined}\n data-state-disabled={isDisabled || undefined}\n data-state-active={active || undefined}\n data-state-pressed={pressed}\n {...buttonProps}\n >\n {content}\n </button>\n )\n }\n)\n\nButton.displayName = 'Button'\n"],"names":["dBtn","dBtnPrimary","dBtnSecondary","dBtnAccent","dBtnInfo","dBtnSuccess","dBtnWarning","dBtnError","dBtnNeutral","dBtnOutline","dBtnDash","dBtnSoft","dBtnGhost","dBtnLink","dBtnXs","dBtnSm","dBtnMd","dBtnLg","dBtnXl","dBtnActive","dBtnSquare","dBtnCircle","dBtnWide","dBtnBlock","dLoading","dLoadingSpinner","Button","forwardRef","children","type","color","variant","size","active","loading","shape","block","ghost","noAnimation","icon","iconPlacement","iconPosition","danger","pressed","className","ariaLabel","testId","props","ref","componentSize","useConfig","effectiveSize","derivedVariant","derivedColor","effectiveColor","effectiveVariant","effectiveIconPlacement","effectiveShape","colorClasses","variantClasses","sizeClasses","shapeClasses","classes","iconSpacing","iconElement","jsx","SizeProvider","content","jsxs","Fragment","href","disabled","onKeyDown","onClick","anchorProps","isDisabled","event","htmlType","buttonProps","buttonType"],"mappings":";;;;AAKA,MAAMA,KAAO,OACPC,KAAc,eACdC,KAAgB,iBAChBC,KAAa,cACbC,KAAW,YACXC,KAAc,eACdC,KAAc,eACdC,KAAY,aACZC,KAAc,eACdC,KAAc,eACdC,KAAW,YACXC,KAAW,YACXC,IAAY,aACZC,KAAW,YACXC,KAAS,UACTC,KAAS,UACTC,KAAS,UACTC,KAAS,UACTC,KAAS,UACTC,KAAa,cACbC,KAAa,cACbC,KAAa,cACbC,KAAW,YACXC,KAAY,aACZC,KAAW,WACXC,KAAkB,mBAuDXC,KAASC;AAAA,EACpB,CACE;AAAA,IACE,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA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BAAoBZ,KAAW;AAAA,QAC/B,uBAAqByC,KAAc;AAAA,QACnC,qBAAmB1C,KAAU;AAAA,QAC7B,sBAAoBU;AAAA,QACnB,GAAGmC;AAAA,QAEH,UAAAX;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAzC,GAAO,cAAc;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
export type TypographySize = 'sm' | 'base' | 'lg' | 'xl' | '2xl';
|
|
2
|
+
export type TypographySize = 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl';
|
|
3
3
|
export type TitleLevel = 1 | 2 | 3 | 4 | 5;
|
|
4
4
|
export interface TypographyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
children: React.ReactNode;
|
|
@@ -34,6 +34,7 @@ export interface TextProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
34
34
|
underline?: boolean;
|
|
35
35
|
delete?: boolean;
|
|
36
36
|
type?: 'default' | 'secondary' | 'success' | 'warning' | 'error';
|
|
37
|
+
size?: TypographySize;
|
|
37
38
|
copyable?: boolean;
|
|
38
39
|
'data-testid'?: string;
|
|
39
40
|
}
|
|
@@ -47,7 +48,7 @@ export interface TypographyLinkProps extends React.AnchorHTMLAttributes<HTMLAnch
|
|
|
47
48
|
declare function TypographyRoot({ children, size, className, 'data-testid': testId, ...rest }: TypographyProps): import("react/jsx-runtime").JSX.Element;
|
|
48
49
|
declare function Title({ level, children, copyable, ellipsis, className, id, 'data-testid': testId, ...rest }: TitleProps): import("react/jsx-runtime").JSX.Element;
|
|
49
50
|
declare function Paragraph({ children, ellipsis, copyable, size, align, className, 'data-testid': testId, ...rest }: ParagraphProps): import("react/jsx-runtime").JSX.Element;
|
|
50
|
-
declare function Text({ children, code, mark, strong, italic, underline, delete: del, type, copyable, className, 'data-testid': testId, ...rest }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
declare function Text({ children, code, mark, strong, italic, underline, delete: del, type, size, copyable, className, 'data-testid': testId, ...rest }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
51
52
|
declare function Link({ href, children, target, external, size, className, 'data-testid': testId, ...rest }: TypographyLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
52
53
|
export declare const Typography: typeof TypographyRoot & {
|
|
53
54
|
Title: typeof Title;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as t, jsxs as g, Fragment as w } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const [d, o] =
|
|
2
|
+
import { useState as N } from "react";
|
|
3
|
+
const k = "btn", $ = "btn-ghost", B = "btn-xs", T = "link", j = "link-primary";
|
|
4
|
+
function C({ text: a, "data-testid": e }) {
|
|
5
|
+
const [d, o] = N(!1);
|
|
6
6
|
return /* @__PURE__ */ t(
|
|
7
7
|
"button",
|
|
8
8
|
{
|
|
@@ -13,7 +13,7 @@ function y({ text: a, "data-testid": e }) {
|
|
|
13
13
|
console.error("Failed to copy:", x);
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
className: `${
|
|
16
|
+
className: `${k} ${$} ${B} ml-2 opacity-0 group-hover:opacity-100 transition-opacity`,
|
|
17
17
|
title: "Copy to clipboard",
|
|
18
18
|
"data-testid": e,
|
|
19
19
|
children: d ? /* @__PURE__ */ t("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ t(
|
|
@@ -37,6 +37,7 @@ function M({ children: a, size: e = "base", className: d = "", "data-testid": o,
|
|
|
37
37
|
// Fallback styles (always apply)
|
|
38
38
|
"text-base-content leading-relaxed",
|
|
39
39
|
{
|
|
40
|
+
xs: "prose-xs text-xs",
|
|
40
41
|
sm: "prose-sm text-sm",
|
|
41
42
|
base: "prose-base text-base",
|
|
42
43
|
lg: "prose-lg text-lg",
|
|
@@ -47,30 +48,30 @@ function M({ children: a, size: e = "base", className: d = "", "data-testid": o,
|
|
|
47
48
|
].filter(Boolean).join(" ");
|
|
48
49
|
return /* @__PURE__ */ t("div", { className: s, "data-testid": o, ...l, children: a });
|
|
49
50
|
}
|
|
50
|
-
function L({ level: a = 1, children: e, copyable: d, ellipsis: o, className: l = "", id: x, "data-testid": s, ...
|
|
51
|
-
const
|
|
51
|
+
function L({ level: a = 1, children: e, copyable: d, ellipsis: o, className: l = "", id: x, "data-testid": s, ...r }) {
|
|
52
|
+
const n = typeof e == "string" ? e : "", i = x || (n ? n.toLowerCase().replace(/\s+/g, "-") : void 0), u = (b) => s ? `${s}-${b}` : void 0, p = {
|
|
52
53
|
1: "text-4xl font-bold mb-4",
|
|
53
54
|
2: "text-3xl font-bold mb-3",
|
|
54
55
|
3: "text-2xl font-semibold mb-3",
|
|
55
56
|
4: "text-xl font-semibold mb-2",
|
|
56
57
|
5: "text-lg font-semibold mb-2"
|
|
57
|
-
}, f = o ? "truncate" : "",
|
|
58
|
+
}, f = o ? "truncate" : "", m = `group ${p[a]} ${f} ${l}`.trim(), h = /* @__PURE__ */ g(w, { children: [
|
|
58
59
|
e,
|
|
59
|
-
d && /* @__PURE__ */ t(
|
|
60
|
+
d && /* @__PURE__ */ t(C, { text: n, "data-testid": u("copy") })
|
|
60
61
|
] });
|
|
61
62
|
switch (a) {
|
|
62
63
|
case 1:
|
|
63
|
-
return /* @__PURE__ */ t("h1", { id:
|
|
64
|
+
return /* @__PURE__ */ t("h1", { id: i, className: m, "data-testid": s, ...r, children: h });
|
|
64
65
|
case 2:
|
|
65
|
-
return /* @__PURE__ */ t("h2", { id:
|
|
66
|
+
return /* @__PURE__ */ t("h2", { id: i, className: m, "data-testid": s, ...r, children: h });
|
|
66
67
|
case 3:
|
|
67
|
-
return /* @__PURE__ */ t("h3", { id:
|
|
68
|
+
return /* @__PURE__ */ t("h3", { id: i, className: m, "data-testid": s, ...r, children: h });
|
|
68
69
|
case 4:
|
|
69
|
-
return /* @__PURE__ */ t("h4", { id:
|
|
70
|
+
return /* @__PURE__ */ t("h4", { id: i, className: m, "data-testid": s, ...r, children: h });
|
|
70
71
|
case 5:
|
|
71
|
-
return /* @__PURE__ */ t("h5", { id:
|
|
72
|
+
return /* @__PURE__ */ t("h5", { id: i, className: m, "data-testid": s, ...r, children: h });
|
|
72
73
|
default:
|
|
73
|
-
return /* @__PURE__ */ t("h1", { id:
|
|
74
|
+
return /* @__PURE__ */ t("h1", { id: i, className: m, "data-testid": s, ...r, children: h });
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
const E = {
|
|
@@ -81,11 +82,11 @@ const E = {
|
|
|
81
82
|
5: "line-clamp-5",
|
|
82
83
|
6: "line-clamp-6"
|
|
83
84
|
};
|
|
84
|
-
function H({ children: a, ellipsis: e, copyable: d, size: o, align: l, className: x = "", "data-testid": s, ...
|
|
85
|
-
const [
|
|
85
|
+
function H({ children: a, ellipsis: e, copyable: d, size: o, align: l, className: x = "", "data-testid": s, ...r }) {
|
|
86
|
+
const [n, i] = N(!1), u = typeof a == "string" ? a : "", p = (v) => s ? `${s}-${v}` : void 0, f = typeof e == "object", m = f && e.rows || 3, h = f ? e.expandable : !1, b = Math.min(Math.max(m, 1), 6), y = [
|
|
86
87
|
"group",
|
|
87
88
|
"mb-4",
|
|
88
|
-
e && !
|
|
89
|
+
e && !n ? E[b] : "",
|
|
89
90
|
o === "sm" && "text-sm",
|
|
90
91
|
o === "base" && "text-base",
|
|
91
92
|
o === "lg" && "text-lg",
|
|
@@ -96,19 +97,19 @@ function H({ children: a, ellipsis: e, copyable: d, size: o, align: l, className
|
|
|
96
97
|
l === "right" && "text-right",
|
|
97
98
|
x
|
|
98
99
|
].filter(Boolean).join(" ");
|
|
99
|
-
return /* @__PURE__ */ g("div", { "data-testid": s, ...
|
|
100
|
-
/* @__PURE__ */ g("p", { className:
|
|
100
|
+
return /* @__PURE__ */ g("div", { "data-testid": s, ...r, children: [
|
|
101
|
+
/* @__PURE__ */ g("p", { className: y, "data-testid": p("text"), children: [
|
|
101
102
|
a,
|
|
102
|
-
d && /* @__PURE__ */ t(
|
|
103
|
+
d && /* @__PURE__ */ t(C, { text: u, "data-testid": p("copy") })
|
|
103
104
|
] }),
|
|
104
|
-
|
|
105
|
+
h && e && /* @__PURE__ */ t(
|
|
105
106
|
"button",
|
|
106
107
|
{
|
|
107
108
|
onClick: () => {
|
|
108
|
-
|
|
109
|
+
i(!n), f && e.onExpand && e.onExpand();
|
|
109
110
|
},
|
|
110
111
|
className: "text-primary text-sm hover:underline",
|
|
111
|
-
children:
|
|
112
|
+
children: n ? "Show less" : "Show more"
|
|
112
113
|
}
|
|
113
114
|
)
|
|
114
115
|
] });
|
|
@@ -121,29 +122,41 @@ function R({
|
|
|
121
122
|
italic: l,
|
|
122
123
|
underline: x,
|
|
123
124
|
delete: s,
|
|
124
|
-
type:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
"
|
|
128
|
-
|
|
125
|
+
type: r = "default",
|
|
126
|
+
size: n,
|
|
127
|
+
copyable: i,
|
|
128
|
+
className: u = "",
|
|
129
|
+
"data-testid": p,
|
|
130
|
+
...f
|
|
129
131
|
}) {
|
|
130
|
-
const
|
|
132
|
+
const m = typeof a == "string" ? a : "", h = (v) => p ? `${p}-${v}` : void 0, b = {
|
|
131
133
|
default: "",
|
|
132
134
|
secondary: "text-base-content/70",
|
|
133
135
|
success: "text-success",
|
|
134
136
|
warning: "text-warning",
|
|
135
137
|
error: "text-error"
|
|
136
138
|
};
|
|
137
|
-
let
|
|
138
|
-
e && (
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
let c = a;
|
|
140
|
+
e && (c = /* @__PURE__ */ t("code", { className: "px-1.5 py-0.5 bg-base-200 rounded text-sm font-mono", children: c })), d && (c = /* @__PURE__ */ t("mark", { className: "bg-warning/30 px-1", children: c })), o && (c = /* @__PURE__ */ t("strong", { className: "font-bold", children: c })), l && (c = /* @__PURE__ */ t("em", { className: "italic", children: c })), x && (c = /* @__PURE__ */ t("u", { className: "underline", children: c })), s && (c = /* @__PURE__ */ t("del", { className: "line-through opacity-70", children: c }));
|
|
141
|
+
const y = [
|
|
142
|
+
"group",
|
|
143
|
+
"inline",
|
|
144
|
+
b[r],
|
|
145
|
+
n === "xs" && "text-xs",
|
|
146
|
+
n === "sm" && "text-sm",
|
|
147
|
+
n === "base" && "text-base",
|
|
148
|
+
n === "lg" && "text-lg",
|
|
149
|
+
n === "xl" && "text-xl",
|
|
150
|
+
n === "2xl" && "text-2xl",
|
|
151
|
+
u
|
|
152
|
+
].filter(Boolean).join(" ");
|
|
153
|
+
return /* @__PURE__ */ g("span", { className: y, "data-testid": p, ...f, children: [
|
|
154
|
+
c,
|
|
155
|
+
i && /* @__PURE__ */ t(C, { text: m, "data-testid": h("copy") })
|
|
143
156
|
] });
|
|
144
157
|
}
|
|
145
|
-
function V({ href: a = "#", children: e, target: d, external: o, size: l, className: x = "", "data-testid": s, ...
|
|
146
|
-
const
|
|
158
|
+
function V({ href: a = "#", children: e, target: d, external: o, size: l, className: x = "", "data-testid": s, ...r }) {
|
|
159
|
+
const n = o || a && a.startsWith("http"), i = d || (n ? "_blank" : void 0), u = n ? "noopener noreferrer" : void 0, p = [
|
|
147
160
|
T,
|
|
148
161
|
j,
|
|
149
162
|
l === "sm" && "text-sm",
|
|
@@ -157,14 +170,14 @@ function V({ href: a = "#", children: e, target: d, external: o, size: l, classN
|
|
|
157
170
|
"a",
|
|
158
171
|
{
|
|
159
172
|
href: a,
|
|
160
|
-
target:
|
|
161
|
-
rel:
|
|
162
|
-
className:
|
|
173
|
+
target: i,
|
|
174
|
+
rel: u,
|
|
175
|
+
className: p,
|
|
163
176
|
"data-testid": s,
|
|
164
|
-
...
|
|
177
|
+
...r,
|
|
165
178
|
children: [
|
|
166
179
|
e,
|
|
167
|
-
|
|
180
|
+
n && /* @__PURE__ */ g("svg", { className: "w-3 h-3 inline-block ml-1", fill: "currentColor", viewBox: "0 0 20 20", children: [
|
|
168
181
|
/* @__PURE__ */ t("path", { d: "M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z" }),
|
|
169
182
|
/* @__PURE__ */ t("path", { d: "M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z" })
|
|
170
183
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typography.js","sources":["../../src/components/Typography.tsx"],"sourcesContent":["import React, { useState } from 'react'\n\n// DaisyUI classes\nconst dBtn = 'btn'\nconst dBtnGhost = 'btn-ghost'\nconst dBtnXs = 'btn-xs'\nconst dLink = 'link'\nconst dLinkPrimary = 'link-primary'\n\nexport type TypographySize = 'sm' | 'base' | 'lg' | 'xl' | '2xl'\nexport type TitleLevel = 1 | 2 | 3 | 4 | 5\n\nexport interface TypographyProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n size?: TypographySize\n 'data-testid'?: string\n}\n\nexport interface TitleProps extends Omit<React.HTMLAttributes<HTMLHeadingElement>, 'title'> {\n level?: TitleLevel\n children: React.ReactNode\n copyable?: boolean\n ellipsis?: boolean\n 'data-testid'?: string\n}\n\nexport interface ParagraphProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n ellipsis?: boolean | { rows?: number; expandable?: boolean; onExpand?: () => void }\n copyable?: boolean\n size?: TypographySize\n align?: 'left' | 'center' | 'right'\n 'data-testid'?: string\n}\n\nexport interface TextProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode\n code?: boolean\n mark?: boolean\n strong?: boolean\n italic?: boolean\n underline?: boolean\n delete?: boolean\n type?: 'default' | 'secondary' | 'success' | 'warning' | 'error'\n copyable?: boolean\n 'data-testid'?: string\n}\n\nexport interface TypographyLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n href?: string\n children: React.ReactNode\n external?: boolean\n size?: TypographySize\n 'data-testid'?: string\n}\n\nfunction CopyButton({ text, 'data-testid': testId }: { text: string; 'data-testid'?: string }) {\n const [copied, setCopied] = useState(false)\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(text)\n setCopied(true)\n setTimeout(() => setCopied(false), 2000)\n } catch (err) {\n console.error('Failed to copy:', err)\n }\n }\n\n return (\n <button\n onClick={handleCopy}\n className={`${dBtn} ${dBtnGhost} ${dBtnXs} ml-2 opacity-0 group-hover:opacity-100 transition-opacity`}\n title=\"Copy to clipboard\"\n data-testid={testId}\n >\n {copied ? (\n <svg className=\"w-4 h-4\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\n <path\n fillRule=\"evenodd\"\n d=\"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z\"\n clipRule=\"evenodd\"\n />\n </svg>\n ) : (\n <svg className=\"w-4 h-4\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\n <path d=\"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z\" />\n <path d=\"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z\" />\n </svg>\n )}\n </button>\n )\n}\n\nfunction TypographyRoot({ children, size = 'base', className = '', 'data-testid': testId, ...rest }: TypographyProps) {\n const sizeClasses = {\n sm: 'prose-sm text-sm',\n base: 'prose-base text-base',\n lg: 'prose-lg text-lg',\n xl: 'prose-xl text-xl',\n '2xl': 'prose-2xl text-2xl',\n }\n\n const classes = [\n // Prose classes (only apply if @tailwindcss/typography is installed)\n 'prose dark:prose-invert max-w-none',\n // Fallback styles (always apply)\n 'text-base-content leading-relaxed',\n sizeClasses[size],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return <div className={classes} data-testid={testId} {...rest}>{children}</div>\n}\n\nfunction Title({ level = 1, children, copyable, ellipsis, className = '', id, 'data-testid': testId, ...rest }: TitleProps) {\n const textContent = typeof children === 'string' ? children : ''\n const generatedId = id || (textContent ? textContent.toLowerCase().replace(/\\s+/g, '-') : undefined)\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n const levelClasses = {\n 1: 'text-4xl font-bold mb-4',\n 2: 'text-3xl font-bold mb-3',\n 3: 'text-2xl font-semibold mb-3',\n 4: 'text-xl font-semibold mb-2',\n 5: 'text-lg font-semibold mb-2',\n }\n\n const ellipsisClass = ellipsis ? 'truncate' : ''\n const classes = `group ${levelClasses[level]} ${ellipsisClass} ${className}`.trim()\n\n const content = (\n <>\n {children}\n {copyable && <CopyButton text={textContent} data-testid={getTestId('copy')} />}\n </>\n )\n\n switch (level) {\n case 1:\n return <h1 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h1>\n case 2:\n return <h2 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h2>\n case 3:\n return <h3 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h3>\n case 4:\n return <h4 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h4>\n case 5:\n return <h5 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h5>\n default:\n return <h1 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h1>\n }\n}\n\nconst lineClampClasses = {\n 1: 'line-clamp-1',\n 2: 'line-clamp-2',\n 3: 'line-clamp-3',\n 4: 'line-clamp-4',\n 5: 'line-clamp-5',\n 6: 'line-clamp-6',\n} as const\n\nfunction Paragraph({ children, ellipsis, copyable, size, align, className = '', 'data-testid': testId, ...rest }: ParagraphProps) {\n const [expanded, setExpanded] = useState(false)\n const textContent = typeof children === 'string' ? children : ''\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n const isEllipsisObject = typeof ellipsis === 'object'\n const rows = isEllipsisObject ? ellipsis.rows || 3 : 3\n const expandable = isEllipsisObject ? ellipsis.expandable : false\n\n const clampedRows = Math.min(Math.max(rows, 1), 6) as 1 | 2 | 3 | 4 | 5 | 6\n const ellipsisClass =\n ellipsis && !expanded ? lineClampClasses[clampedRows] : ''\n\n const classes = [\n 'group',\n 'mb-4',\n ellipsisClass,\n size === 'sm' && 'text-sm',\n size === 'base' && 'text-base',\n size === 'lg' && 'text-lg',\n size === 'xl' && 'text-xl',\n size === '2xl' && 'text-2xl',\n align === 'left' && 'text-left',\n align === 'center' && 'text-center',\n align === 'right' && 'text-right',\n className,\n ].filter(Boolean).join(' ')\n\n return (\n <div data-testid={testId} {...rest}>\n <p className={classes} data-testid={getTestId('text')}>\n {children}\n {copyable && <CopyButton text={textContent} data-testid={getTestId('copy')} />}\n </p>\n {expandable && ellipsis && (\n <button\n onClick={() => {\n setExpanded(!expanded)\n if (isEllipsisObject && ellipsis.onExpand) {\n ellipsis.onExpand()\n }\n }}\n className=\"text-primary text-sm hover:underline\"\n >\n {expanded ? 'Show less' : 'Show more'}\n </button>\n )}\n </div>\n )\n}\n\nfunction Text({\n children,\n code,\n mark,\n strong,\n italic,\n underline,\n delete: del,\n type = 'default',\n copyable,\n className = '',\n 'data-testid': testId,\n ...rest\n}: TextProps) {\n const textContent = typeof children === 'string' ? children : ''\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n const typeClasses = {\n default: '',\n secondary: 'text-base-content/70',\n success: 'text-success',\n warning: 'text-warning',\n error: 'text-error',\n }\n\n let content = children\n\n if (code) {\n content = (\n <code className=\"px-1.5 py-0.5 bg-base-200 rounded text-sm font-mono\">{content}</code>\n )\n }\n\n if (mark) {\n content = <mark className=\"bg-warning/30 px-1\">{content}</mark>\n }\n\n if (strong) {\n content = <strong className=\"font-bold\">{content}</strong>\n }\n\n if (italic) {\n content = <em className=\"italic\">{content}</em>\n }\n\n if (underline) {\n content = <u className=\"underline\">{content}</u>\n }\n\n if (del) {\n content = <del className=\"line-through opacity-70\">{content}</del>\n }\n\n const classes = `group inline ${typeClasses[type]} ${className}`.trim()\n\n return (\n <span className={classes} data-testid={testId} {...rest}>\n {content}\n {copyable && <CopyButton text={textContent} data-testid={getTestId('copy')} />}\n </span>\n )\n}\n\nfunction Link({ href = '#', children, target, external, size, className = '', 'data-testid': testId, ...rest }: TypographyLinkProps) {\n const isExternal = external || (href && href.startsWith('http'))\n const linkTarget = target || (isExternal ? '_blank' : undefined)\n const rel = isExternal ? 'noopener noreferrer' : undefined\n\n const classes = [\n dLink,\n dLinkPrimary,\n size === 'sm' && 'text-sm',\n size === 'base' && 'text-base',\n size === 'lg' && 'text-lg',\n size === 'xl' && 'text-xl',\n size === '2xl' && 'text-2xl',\n className,\n ].filter(Boolean).join(' ')\n\n return (\n <a\n href={href}\n target={linkTarget}\n rel={rel}\n className={classes}\n data-testid={testId}\n {...rest}\n >\n {children}\n {isExternal && (\n <svg className=\"w-3 h-3 inline-block ml-1\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\n <path d=\"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z\" />\n <path d=\"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z\" />\n </svg>\n )}\n </a>\n )\n}\n\nexport const Typography = Object.assign(TypographyRoot, {\n Title,\n Paragraph,\n Text,\n Link,\n})\n\nexport default Typography\n"],"names":["dBtn","dBtnGhost","dBtnXs","dLink","dLinkPrimary","CopyButton","text","testId","copied","setCopied","useState","jsx","err","jsxs","TypographyRoot","children","size","className","rest","classes","Title","level","copyable","ellipsis","id","textContent","generatedId","getTestId","suffix","levelClasses","ellipsisClass","content","Fragment","lineClampClasses","Paragraph","align","expanded","setExpanded","isEllipsisObject","rows","expandable","clampedRows","Text","code","mark","strong","italic","underline","del","type","typeClasses","Link","href","target","external","isExternal","linkTarget","rel","Typography"],"mappings":";;AAGA,MAAMA,IAAO,OACPC,IA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gBAAAJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAAuC;AAAA,MACA,QAAQI;AAAA,MACR,KAAAC;AAAA,MACA,WAAWtC;AAAA,MACX,eAAaZ;AAAA,MACZ,GAAGW;AAAA,MAEH,UAAA;AAAA,QAAAH;AAAA,QACAwC,uBACE,OAAA,EAAI,WAAU,6BAA4B,MAAK,gBAAe,SAAQ,aACrE,UAAA;AAAA,UAAA,gBAAA5C,EAAC,QAAA,EAAK,GAAE,qGAAA,CAAqG;AAAA,UAC7G,gBAAAA,EAAC,QAAA,EAAK,GAAE,uFAAA,CAAuF;AAAA,QAAA,EAAA,CACjG;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;AAEO,MAAM+C,IAAa,OAAO,OAAO5C,GAAgB;AAAA,EACtD,OAAAM;AAAA,EACA,WAAAc;AAAA,EACA,MAAAQ;AAAA,EACA,MAAAS;AACF,CAAC;"}
|
|
1
|
+
{"version":3,"file":"Typography.js","sources":["../../src/components/Typography.tsx"],"sourcesContent":["import React, { useState } from 'react'\n\n// DaisyUI classes\nconst dBtn = 'btn'\nconst dBtnGhost = 'btn-ghost'\nconst dBtnXs = 'btn-xs'\nconst dLink = 'link'\nconst dLinkPrimary = 'link-primary'\n\nexport type TypographySize = 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl'\nexport type TitleLevel = 1 | 2 | 3 | 4 | 5\n\nexport interface TypographyProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n size?: TypographySize\n 'data-testid'?: string\n}\n\nexport interface TitleProps extends Omit<React.HTMLAttributes<HTMLHeadingElement>, 'title'> {\n level?: TitleLevel\n children: React.ReactNode\n copyable?: boolean\n ellipsis?: boolean\n 'data-testid'?: string\n}\n\nexport interface ParagraphProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n ellipsis?: boolean | { rows?: number; expandable?: boolean; onExpand?: () => void }\n copyable?: boolean\n size?: TypographySize\n align?: 'left' | 'center' | 'right'\n 'data-testid'?: string\n}\n\nexport interface TextProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode\n code?: boolean\n mark?: boolean\n strong?: boolean\n italic?: boolean\n underline?: boolean\n delete?: boolean\n type?: 'default' | 'secondary' | 'success' | 'warning' | 'error'\n size?: TypographySize\n copyable?: boolean\n 'data-testid'?: string\n}\n\nexport interface TypographyLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n href?: string\n children: React.ReactNode\n external?: boolean\n size?: TypographySize\n 'data-testid'?: string\n}\n\nfunction CopyButton({ text, 'data-testid': testId }: { text: string; 'data-testid'?: string }) {\n const [copied, setCopied] = useState(false)\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(text)\n setCopied(true)\n setTimeout(() => setCopied(false), 2000)\n } catch (err) {\n console.error('Failed to copy:', err)\n }\n }\n\n return (\n <button\n onClick={handleCopy}\n className={`${dBtn} ${dBtnGhost} ${dBtnXs} ml-2 opacity-0 group-hover:opacity-100 transition-opacity`}\n title=\"Copy to clipboard\"\n data-testid={testId}\n >\n {copied ? (\n <svg className=\"w-4 h-4\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\n <path\n fillRule=\"evenodd\"\n d=\"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z\"\n clipRule=\"evenodd\"\n />\n </svg>\n ) : (\n <svg className=\"w-4 h-4\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\n <path d=\"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z\" />\n <path d=\"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z\" />\n </svg>\n )}\n </button>\n )\n}\n\nfunction TypographyRoot({ children, size = 'base', className = '', 'data-testid': testId, ...rest }: TypographyProps) {\n const sizeClasses = {\n xs: 'prose-xs text-xs',\n sm: 'prose-sm text-sm',\n base: 'prose-base text-base',\n lg: 'prose-lg text-lg',\n xl: 'prose-xl text-xl',\n '2xl': 'prose-2xl text-2xl',\n }\n\n const classes = [\n // Prose classes (only apply if @tailwindcss/typography is installed)\n 'prose dark:prose-invert max-w-none',\n // Fallback styles (always apply)\n 'text-base-content leading-relaxed',\n sizeClasses[size],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return <div className={classes} data-testid={testId} {...rest}>{children}</div>\n}\n\nfunction Title({ level = 1, children, copyable, ellipsis, className = '', id, 'data-testid': testId, ...rest }: TitleProps) {\n const textContent = typeof children === 'string' ? children : ''\n const generatedId = id || (textContent ? textContent.toLowerCase().replace(/\\s+/g, '-') : undefined)\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n const levelClasses = {\n 1: 'text-4xl font-bold mb-4',\n 2: 'text-3xl font-bold mb-3',\n 3: 'text-2xl font-semibold mb-3',\n 4: 'text-xl font-semibold mb-2',\n 5: 'text-lg font-semibold mb-2',\n }\n\n const ellipsisClass = ellipsis ? 'truncate' : ''\n const classes = `group ${levelClasses[level]} ${ellipsisClass} ${className}`.trim()\n\n const content = (\n <>\n {children}\n {copyable && <CopyButton text={textContent} data-testid={getTestId('copy')} />}\n </>\n )\n\n switch (level) {\n case 1:\n return <h1 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h1>\n case 2:\n return <h2 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h2>\n case 3:\n return <h3 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h3>\n case 4:\n return <h4 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h4>\n case 5:\n return <h5 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h5>\n default:\n return <h1 id={generatedId} className={classes} data-testid={testId} {...rest}>{content}</h1>\n }\n}\n\nconst lineClampClasses = {\n 1: 'line-clamp-1',\n 2: 'line-clamp-2',\n 3: 'line-clamp-3',\n 4: 'line-clamp-4',\n 5: 'line-clamp-5',\n 6: 'line-clamp-6',\n} as const\n\nfunction Paragraph({ children, ellipsis, copyable, size, align, className = '', 'data-testid': testId, ...rest }: ParagraphProps) {\n const [expanded, setExpanded] = useState(false)\n const textContent = typeof children === 'string' ? children : ''\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n const isEllipsisObject = typeof ellipsis === 'object'\n const rows = isEllipsisObject ? ellipsis.rows || 3 : 3\n const expandable = isEllipsisObject ? ellipsis.expandable : false\n\n const clampedRows = Math.min(Math.max(rows, 1), 6) as 1 | 2 | 3 | 4 | 5 | 6\n const ellipsisClass =\n ellipsis && !expanded ? lineClampClasses[clampedRows] : ''\n\n const classes = [\n 'group',\n 'mb-4',\n ellipsisClass,\n size === 'sm' && 'text-sm',\n size === 'base' && 'text-base',\n size === 'lg' && 'text-lg',\n size === 'xl' && 'text-xl',\n size === '2xl' && 'text-2xl',\n align === 'left' && 'text-left',\n align === 'center' && 'text-center',\n align === 'right' && 'text-right',\n className,\n ].filter(Boolean).join(' ')\n\n return (\n <div data-testid={testId} {...rest}>\n <p className={classes} data-testid={getTestId('text')}>\n {children}\n {copyable && <CopyButton text={textContent} data-testid={getTestId('copy')} />}\n </p>\n {expandable && ellipsis && (\n <button\n onClick={() => {\n setExpanded(!expanded)\n if (isEllipsisObject && ellipsis.onExpand) {\n ellipsis.onExpand()\n }\n }}\n className=\"text-primary text-sm hover:underline\"\n >\n {expanded ? 'Show less' : 'Show more'}\n </button>\n )}\n </div>\n )\n}\n\nfunction Text({\n children,\n code,\n mark,\n strong,\n italic,\n underline,\n delete: del,\n type = 'default',\n size,\n copyable,\n className = '',\n 'data-testid': testId,\n ...rest\n}: TextProps) {\n const textContent = typeof children === 'string' ? children : ''\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n const typeClasses = {\n default: '',\n secondary: 'text-base-content/70',\n success: 'text-success',\n warning: 'text-warning',\n error: 'text-error',\n }\n\n let content = children\n\n if (code) {\n content = (\n <code className=\"px-1.5 py-0.5 bg-base-200 rounded text-sm font-mono\">{content}</code>\n )\n }\n\n if (mark) {\n content = <mark className=\"bg-warning/30 px-1\">{content}</mark>\n }\n\n if (strong) {\n content = <strong className=\"font-bold\">{content}</strong>\n }\n\n if (italic) {\n content = <em className=\"italic\">{content}</em>\n }\n\n if (underline) {\n content = <u className=\"underline\">{content}</u>\n }\n\n if (del) {\n content = <del className=\"line-through opacity-70\">{content}</del>\n }\n\n const classes = [\n 'group',\n 'inline',\n typeClasses[type],\n size === 'xs' && 'text-xs',\n size === 'sm' && 'text-sm',\n size === 'base' && 'text-base',\n size === 'lg' && 'text-lg',\n size === 'xl' && 'text-xl',\n size === '2xl' && 'text-2xl',\n className,\n ].filter(Boolean).join(' ')\n\n return (\n <span className={classes} data-testid={testId} {...rest}>\n {content}\n {copyable && <CopyButton text={textContent} data-testid={getTestId('copy')} />}\n </span>\n )\n}\n\nfunction Link({ href = '#', children, target, external, size, className = '', 'data-testid': testId, ...rest }: TypographyLinkProps) {\n const isExternal = external || (href && href.startsWith('http'))\n const linkTarget = target || (isExternal ? '_blank' : undefined)\n const rel = isExternal ? 'noopener noreferrer' : undefined\n\n const classes = [\n dLink,\n dLinkPrimary,\n size === 'sm' && 'text-sm',\n size === 'base' && 'text-base',\n size === 'lg' && 'text-lg',\n size === 'xl' && 'text-xl',\n size === '2xl' && 'text-2xl',\n className,\n ].filter(Boolean).join(' ')\n\n return (\n <a\n href={href}\n target={linkTarget}\n rel={rel}\n className={classes}\n data-testid={testId}\n {...rest}\n >\n {children}\n {isExternal && (\n <svg className=\"w-3 h-3 inline-block ml-1\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\n <path d=\"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z\" />\n <path d=\"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z\" />\n </svg>\n )}\n </a>\n )\n}\n\nexport const Typography = Object.assign(TypographyRoot, {\n Title,\n Paragraph,\n Text,\n Link,\n})\n\nexport default Typography\n"],"names":["dBtn","dBtnGhost","dBtnXs","dLink","dLinkPrimary","CopyButton","text","testId","copied","setCopied","useState","jsx","err","jsxs","TypographyRoot","children","size","className","rest","classes","Title","level","copyable","ellipsis","id","textContent","generatedId","getTestId","suffix","levelClasses","ellipsisClass","content","Fragment","lineClampClasses","Paragraph","align","expanded","setExpanded","isEllipsisObject","rows","expandable","clampedRows","Text","code","mark","strong","italic","underline","del","type","typeClasses","Link","href","target","external","isExternal","linkTarget","rel","Typography"],"mappings":";;AAGA,MAAMA,IAAO,OACPC,IAAY,aACZC,IAAS,UACTC,IAAQ,QACRC,IAAe;AAkDrB,SAASC,EAAW,EAAE,MAAAC,GAAM,eAAeC,KAAoD;AAC7F,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK;AAY1C,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAZe,YAAY;AAC7B,YAAI;AACF,gBAAM,UAAU,UAAU,UAAUL,CAAI,GACxCG,EAAU,EAAI,GACd,WAAW,MAAMA,EAAU,EAAK,GAAG,GAAI;AAAA,QACzC,SAASG,GAAK;AACZ,kBAAQ,MAAM,mBAAmBA,CAAG;AAAA,QACtC;AAAA,MACF;AAAA,MAKI,WAAW,GAAGZ,CAAI,IAAIC,CAAS,IAAIC,CAAM;AAAA,MACzC,OAAM;AAAA,MACN,eAAaK;AAAA,MAEZ,UAAAC,sBACE,OAAA,EAAI,WAAU,WAAU,MAAK,gBAAe,SAAQ,aACnD,UAAA,gBAAAG;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,UAAS;AAAA,UACT,GAAE;AAAA,UACF,UAAS;AAAA,QAAA;AAAA,MAAA,EACX,CACF,IAEA,gBAAAE,EAAC,OAAA,EAAI,WAAU,WAAU,MA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