@x-plat/design-system 0.1.2 → 0.1.3
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/Accordion/index.cjs +131 -0
- package/dist/components/Accordion/index.css +51 -0
- package/dist/components/Accordion/index.d.cts +16 -0
- package/dist/components/Accordion/index.d.ts +16 -0
- package/dist/components/Accordion/index.js +94 -0
- package/dist/components/Alert/index.cjs +72 -0
- package/dist/components/Alert/index.css +60 -0
- package/dist/components/Alert/index.d.cts +12 -0
- package/dist/components/Alert/index.d.ts +12 -0
- package/dist/components/Alert/index.js +45 -0
- package/dist/components/Avatar/index.cjs +196 -0
- package/dist/components/Avatar/index.css +321 -0
- package/dist/components/Avatar/index.d.cts +133 -0
- package/dist/components/Avatar/index.d.ts +133 -0
- package/dist/components/Avatar/index.js +169 -0
- package/dist/components/Badge/index.cjs +200 -0
- package/dist/components/Badge/index.css +307 -0
- package/dist/components/Badge/index.d.cts +133 -0
- package/dist/components/Badge/index.d.ts +133 -0
- package/dist/components/Badge/index.js +173 -0
- package/dist/components/Breadcrumb/index.cjs +60 -0
- package/dist/components/Breadcrumb/index.css +37 -0
- package/dist/components/Breadcrumb/index.d.cts +15 -0
- package/dist/components/Breadcrumb/index.d.ts +15 -0
- package/dist/components/Breadcrumb/index.js +33 -0
- package/dist/components/Chart/index.cjs +6 -3
- package/dist/components/Chart/index.js +6 -3
- package/dist/components/DatePicker/index.cjs +2 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/Divider/index.cjs +61 -0
- package/dist/components/Divider/index.css +15 -0
- package/dist/components/Divider/index.d.cts +10 -0
- package/dist/components/Divider/index.d.ts +10 -0
- package/dist/components/Divider/index.js +34 -0
- package/dist/components/ImageSelector/index.cjs +9 -3
- package/dist/components/ImageSelector/index.js +9 -3
- package/dist/components/Modal/index.cjs +2 -0
- package/dist/components/Modal/index.js +2 -0
- package/dist/components/Pagination/index.cjs +261 -0
- package/dist/components/Pagination/index.css +325 -0
- package/dist/components/Pagination/index.d.cts +133 -0
- package/dist/components/Pagination/index.d.ts +133 -0
- package/dist/components/Pagination/index.js +234 -0
- package/dist/components/Progress/index.cjs +218 -0
- package/dist/components/Progress/index.css +313 -0
- package/dist/components/Progress/index.d.cts +133 -0
- package/dist/components/Progress/index.d.ts +133 -0
- package/dist/components/Progress/index.js +191 -0
- package/dist/components/Skeleton/index.cjs +65 -0
- package/dist/components/Skeleton/index.css +27 -0
- package/dist/components/Skeleton/index.d.cts +12 -0
- package/dist/components/Skeleton/index.d.ts +12 -0
- package/dist/components/Skeleton/index.js +38 -0
- package/dist/components/Spinner/index.cjs +222 -0
- package/dist/components/Spinner/index.css +317 -0
- package/dist/components/Spinner/index.d.cts +130 -0
- package/dist/components/Spinner/index.d.ts +130 -0
- package/dist/components/Spinner/index.js +195 -0
- package/dist/components/index.cjs +1014 -592
- package/dist/components/index.css +4290 -2507
- package/dist/components/index.d.cts +12 -2
- package/dist/components/index.d.ts +12 -2
- package/dist/components/index.js +1003 -591
- package/dist/index.cjs +2010 -1588
- package/dist/index.css +4289 -2506
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +1999 -1587
- package/package.json +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/Accordion/index.ts
|
|
31
|
+
var Accordion_exports = {};
|
|
32
|
+
__export(Accordion_exports, {
|
|
33
|
+
Accordion: () => Accordion_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(Accordion_exports);
|
|
36
|
+
|
|
37
|
+
// src/components/Accordion/Accordion.tsx
|
|
38
|
+
var import_react = __toESM(require("react"), 1);
|
|
39
|
+
|
|
40
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
41
|
+
function r(e) {
|
|
42
|
+
var t, f, n = "";
|
|
43
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
44
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
45
|
+
var o = e.length;
|
|
46
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
47
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
48
|
+
return n;
|
|
49
|
+
}
|
|
50
|
+
function clsx() {
|
|
51
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
52
|
+
return n;
|
|
53
|
+
}
|
|
54
|
+
var clsx_default = clsx;
|
|
55
|
+
|
|
56
|
+
// src/components/Accordion/Accordion.tsx
|
|
57
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
58
|
+
var AccordionItem = ({ item, isOpen, onToggle }) => {
|
|
59
|
+
const bodyRef = import_react.default.useRef(null);
|
|
60
|
+
const [height, setHeight] = import_react.default.useState(0);
|
|
61
|
+
import_react.default.useEffect(() => {
|
|
62
|
+
if (bodyRef.current) {
|
|
63
|
+
setHeight(bodyRef.current.scrollHeight);
|
|
64
|
+
}
|
|
65
|
+
}, [isOpen, item.content]);
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: clsx_default("accordion-item", { open: isOpen }), children: [
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
68
|
+
"button",
|
|
69
|
+
{
|
|
70
|
+
className: "accordion-header",
|
|
71
|
+
onClick: onToggle,
|
|
72
|
+
"aria-expanded": isOpen,
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "title", children: item.title }),
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
|
+
"svg",
|
|
77
|
+
{
|
|
78
|
+
className: "chevron",
|
|
79
|
+
viewBox: "0 0 24 24",
|
|
80
|
+
fill: "currentColor",
|
|
81
|
+
width: "20",
|
|
82
|
+
height: "20",
|
|
83
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z" })
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
ref: bodyRef,
|
|
93
|
+
className: "accordion-body",
|
|
94
|
+
style: { maxHeight: isOpen ? height : 0 },
|
|
95
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "accordion-content", children: item.content })
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] });
|
|
99
|
+
};
|
|
100
|
+
var Accordion = (props) => {
|
|
101
|
+
const { items, multiple = false, defaultActiveKeys = [], className } = props;
|
|
102
|
+
const [activeKeys, setActiveKeys] = import_react.default.useState(
|
|
103
|
+
new Set(defaultActiveKeys)
|
|
104
|
+
);
|
|
105
|
+
const toggle = (key) => {
|
|
106
|
+
setActiveKeys((prev) => {
|
|
107
|
+
const next = new Set(multiple ? prev : []);
|
|
108
|
+
if (prev.has(key)) {
|
|
109
|
+
next.delete(key);
|
|
110
|
+
} else {
|
|
111
|
+
next.add(key);
|
|
112
|
+
}
|
|
113
|
+
return next;
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: clsx_default("lib-xplat-accordion", className), children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
|
+
AccordionItem,
|
|
118
|
+
{
|
|
119
|
+
item,
|
|
120
|
+
isOpen: activeKeys.has(item.key),
|
|
121
|
+
onToggle: () => toggle(item.key)
|
|
122
|
+
},
|
|
123
|
+
item.key
|
|
124
|
+
)) });
|
|
125
|
+
};
|
|
126
|
+
Accordion.displayName = "Accordion";
|
|
127
|
+
var Accordion_default = Accordion;
|
|
128
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
+
0 && (module.exports = {
|
|
130
|
+
Accordion
|
|
131
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* src/components/Accordion/accordion.scss */
|
|
2
|
+
.lib-xplat-accordion {
|
|
3
|
+
border: 1px solid #E5E5E5;
|
|
4
|
+
border-radius: 0.5rem;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
}
|
|
7
|
+
.lib-xplat-accordion .accordion-item {
|
|
8
|
+
border-bottom: 1px solid #E5E5E5;
|
|
9
|
+
}
|
|
10
|
+
.lib-xplat-accordion .accordion-item:last-child {
|
|
11
|
+
border-bottom: none;
|
|
12
|
+
}
|
|
13
|
+
.lib-xplat-accordion .accordion-header {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
width: 100%;
|
|
18
|
+
padding: 0.875rem 1rem;
|
|
19
|
+
background: none;
|
|
20
|
+
border: none;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
font-weight: 500;
|
|
24
|
+
color: #171717;
|
|
25
|
+
text-align: left;
|
|
26
|
+
transition: background-color 0.2s;
|
|
27
|
+
}
|
|
28
|
+
.lib-xplat-accordion .accordion-header:hover {
|
|
29
|
+
background-color: #FAFAFA;
|
|
30
|
+
}
|
|
31
|
+
.lib-xplat-accordion .accordion-header .chevron {
|
|
32
|
+
width: 20px;
|
|
33
|
+
height: 20px;
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
transition: transform 0.25s ease;
|
|
36
|
+
color: #737373;
|
|
37
|
+
}
|
|
38
|
+
.lib-xplat-accordion .accordion-body {
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
max-height: 0;
|
|
41
|
+
transition: max-height 0.25s ease;
|
|
42
|
+
}
|
|
43
|
+
.lib-xplat-accordion .accordion-content {
|
|
44
|
+
padding: 0 1rem 0.875rem;
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
color: #525252;
|
|
47
|
+
line-height: 1.6;
|
|
48
|
+
}
|
|
49
|
+
.lib-xplat-accordion .accordion-item.open .chevron {
|
|
50
|
+
transform: rotate(180deg);
|
|
51
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface AccordionItemData {
|
|
4
|
+
key: string;
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
content: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
interface AccordionProps {
|
|
9
|
+
items: AccordionItemData[];
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
defaultActiveKeys?: string[];
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const Accordion: React.FC<AccordionProps>;
|
|
15
|
+
|
|
16
|
+
export { Accordion };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface AccordionItemData {
|
|
4
|
+
key: string;
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
content: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
interface AccordionProps {
|
|
9
|
+
items: AccordionItemData[];
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
defaultActiveKeys?: string[];
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const Accordion: React.FC<AccordionProps>;
|
|
15
|
+
|
|
16
|
+
export { Accordion };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/components/Accordion/Accordion.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
5
|
+
function r(e) {
|
|
6
|
+
var t, f, n = "";
|
|
7
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
8
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
9
|
+
var o = e.length;
|
|
10
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
11
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
12
|
+
return n;
|
|
13
|
+
}
|
|
14
|
+
function clsx() {
|
|
15
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
16
|
+
return n;
|
|
17
|
+
}
|
|
18
|
+
var clsx_default = clsx;
|
|
19
|
+
|
|
20
|
+
// src/components/Accordion/Accordion.tsx
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
var AccordionItem = ({ item, isOpen, onToggle }) => {
|
|
23
|
+
const bodyRef = React.useRef(null);
|
|
24
|
+
const [height, setHeight] = React.useState(0);
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
if (bodyRef.current) {
|
|
27
|
+
setHeight(bodyRef.current.scrollHeight);
|
|
28
|
+
}
|
|
29
|
+
}, [isOpen, item.content]);
|
|
30
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx_default("accordion-item", { open: isOpen }), children: [
|
|
31
|
+
/* @__PURE__ */ jsxs(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
className: "accordion-header",
|
|
35
|
+
onClick: onToggle,
|
|
36
|
+
"aria-expanded": isOpen,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: "title", children: item.title }),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
"svg",
|
|
41
|
+
{
|
|
42
|
+
className: "chevron",
|
|
43
|
+
viewBox: "0 0 24 24",
|
|
44
|
+
fill: "currentColor",
|
|
45
|
+
width: "20",
|
|
46
|
+
height: "20",
|
|
47
|
+
children: /* @__PURE__ */ jsx("path", { d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z" })
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
ref: bodyRef,
|
|
57
|
+
className: "accordion-body",
|
|
58
|
+
style: { maxHeight: isOpen ? height : 0 },
|
|
59
|
+
children: /* @__PURE__ */ jsx("div", { className: "accordion-content", children: item.content })
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] });
|
|
63
|
+
};
|
|
64
|
+
var Accordion = (props) => {
|
|
65
|
+
const { items, multiple = false, defaultActiveKeys = [], className } = props;
|
|
66
|
+
const [activeKeys, setActiveKeys] = React.useState(
|
|
67
|
+
new Set(defaultActiveKeys)
|
|
68
|
+
);
|
|
69
|
+
const toggle = (key) => {
|
|
70
|
+
setActiveKeys((prev) => {
|
|
71
|
+
const next = new Set(multiple ? prev : []);
|
|
72
|
+
if (prev.has(key)) {
|
|
73
|
+
next.delete(key);
|
|
74
|
+
} else {
|
|
75
|
+
next.add(key);
|
|
76
|
+
}
|
|
77
|
+
return next;
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
return /* @__PURE__ */ jsx("div", { className: clsx_default("lib-xplat-accordion", className), children: items.map((item) => /* @__PURE__ */ jsx(
|
|
81
|
+
AccordionItem,
|
|
82
|
+
{
|
|
83
|
+
item,
|
|
84
|
+
isOpen: activeKeys.has(item.key),
|
|
85
|
+
onToggle: () => toggle(item.key)
|
|
86
|
+
},
|
|
87
|
+
item.key
|
|
88
|
+
)) });
|
|
89
|
+
};
|
|
90
|
+
Accordion.displayName = "Accordion";
|
|
91
|
+
var Accordion_default = Accordion;
|
|
92
|
+
export {
|
|
93
|
+
Accordion_default as Accordion
|
|
94
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Alert/index.ts
|
|
21
|
+
var Alert_exports = {};
|
|
22
|
+
__export(Alert_exports, {
|
|
23
|
+
Alert: () => Alert_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Alert_exports);
|
|
26
|
+
|
|
27
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
28
|
+
function r(e) {
|
|
29
|
+
var t, f, n = "";
|
|
30
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
31
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
32
|
+
var o = e.length;
|
|
33
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
34
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
35
|
+
return n;
|
|
36
|
+
}
|
|
37
|
+
function clsx() {
|
|
38
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
39
|
+
return n;
|
|
40
|
+
}
|
|
41
|
+
var clsx_default = clsx;
|
|
42
|
+
|
|
43
|
+
// src/components/Alert/Alert.tsx
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
var Alert = (props) => {
|
|
46
|
+
const { type = "info", children, onClose, className } = props;
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: clsx_default("lib-xplat-alert", type, className),
|
|
51
|
+
role: "alert",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "content", children }),
|
|
54
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
className: "close-btn",
|
|
58
|
+
onClick: onClose,
|
|
59
|
+
"aria-label": "\uB2EB\uAE30",
|
|
60
|
+
children: "\xD7"
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
Alert.displayName = "Alert";
|
|
68
|
+
var Alert_default = Alert;
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
Alert
|
|
72
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* src/components/Alert/alert.scss */
|
|
2
|
+
.lib-xplat-alert {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: flex-start;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
padding: 0.75rem 1rem;
|
|
7
|
+
border-radius: 0.5rem;
|
|
8
|
+
font-size: 14px;
|
|
9
|
+
line-height: 1.5;
|
|
10
|
+
border: 1px solid;
|
|
11
|
+
}
|
|
12
|
+
.lib-xplat-alert .content {
|
|
13
|
+
flex: 1;
|
|
14
|
+
}
|
|
15
|
+
.lib-xplat-alert .close-btn {
|
|
16
|
+
background: none;
|
|
17
|
+
border: none;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
font-size: 18px;
|
|
20
|
+
line-height: 1;
|
|
21
|
+
margin-left: 0.5rem;
|
|
22
|
+
padding: 0;
|
|
23
|
+
opacity: 0.6;
|
|
24
|
+
transition: opacity 0.2s;
|
|
25
|
+
}
|
|
26
|
+
.lib-xplat-alert .close-btn:hover {
|
|
27
|
+
opacity: 1;
|
|
28
|
+
}
|
|
29
|
+
.lib-xplat-alert.info {
|
|
30
|
+
background-color: #EEFAFF;
|
|
31
|
+
border-color: #BBEDFF;
|
|
32
|
+
color: #1280E3;
|
|
33
|
+
}
|
|
34
|
+
.lib-xplat-alert.info .close-btn {
|
|
35
|
+
color: #1280E3;
|
|
36
|
+
}
|
|
37
|
+
.lib-xplat-alert.success {
|
|
38
|
+
background-color: #E5F6EA;
|
|
39
|
+
border-color: #98D8AC;
|
|
40
|
+
color: #009143;
|
|
41
|
+
}
|
|
42
|
+
.lib-xplat-alert.success .close-btn {
|
|
43
|
+
color: #009143;
|
|
44
|
+
}
|
|
45
|
+
.lib-xplat-alert.warning {
|
|
46
|
+
background-color: #FFFDE7;
|
|
47
|
+
border-color: #FFF186;
|
|
48
|
+
color: #A66002;
|
|
49
|
+
}
|
|
50
|
+
.lib-xplat-alert.warning .close-btn {
|
|
51
|
+
color: #A66002;
|
|
52
|
+
}
|
|
53
|
+
.lib-xplat-alert.error {
|
|
54
|
+
background-color: #FFF0F0;
|
|
55
|
+
border-color: #FFC1C2;
|
|
56
|
+
color: #D40105;
|
|
57
|
+
}
|
|
58
|
+
.lib-xplat-alert.error .close-btn {
|
|
59
|
+
color: #D40105;
|
|
60
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type AlertType = "info" | "success" | "warning" | "error";
|
|
4
|
+
interface AlertProps {
|
|
5
|
+
type?: AlertType;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Alert: React.FC<AlertProps>;
|
|
11
|
+
|
|
12
|
+
export { Alert };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type AlertType = "info" | "success" | "warning" | "error";
|
|
4
|
+
interface AlertProps {
|
|
5
|
+
type?: AlertType;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Alert: React.FC<AlertProps>;
|
|
11
|
+
|
|
12
|
+
export { Alert };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
2
|
+
function r(e) {
|
|
3
|
+
var t, f, n = "";
|
|
4
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
5
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
6
|
+
var o = e.length;
|
|
7
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
8
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
9
|
+
return n;
|
|
10
|
+
}
|
|
11
|
+
function clsx() {
|
|
12
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
13
|
+
return n;
|
|
14
|
+
}
|
|
15
|
+
var clsx_default = clsx;
|
|
16
|
+
|
|
17
|
+
// src/components/Alert/Alert.tsx
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
var Alert = (props) => {
|
|
20
|
+
const { type = "info", children, onClose, className } = props;
|
|
21
|
+
return /* @__PURE__ */ jsxs(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: clsx_default("lib-xplat-alert", type, className),
|
|
25
|
+
role: "alert",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx("div", { className: "content", children }),
|
|
28
|
+
onClose && /* @__PURE__ */ jsx(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
className: "close-btn",
|
|
32
|
+
onClick: onClose,
|
|
33
|
+
"aria-label": "\uB2EB\uAE30",
|
|
34
|
+
children: "\xD7"
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
Alert.displayName = "Alert";
|
|
42
|
+
var Alert_default = Alert;
|
|
43
|
+
export {
|
|
44
|
+
Alert_default as Alert
|
|
45
|
+
};
|