asterui 0.12.72 → 0.12.74
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/Dropdown.js +268 -246
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/Modal.js +0 -2
- package/dist/components/Modal.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 +4 -4
|
@@ -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","af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