@x-plat/design-system 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/index.cjs +908 -18
- package/dist/components/Accordion/index.js +908 -18
- package/dist/components/Avatar/index.css +1 -0
- package/dist/components/CheckBox/index.cjs +1 -1
- package/dist/components/CheckBox/index.css +13 -1
- package/dist/components/CheckBox/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +75 -5
- package/dist/components/DatePicker/index.css +20 -2
- package/dist/components/DatePicker/index.d.cts +245 -4
- package/dist/components/DatePicker/index.d.ts +245 -4
- package/dist/components/DatePicker/index.js +75 -5
- package/dist/components/Drawer/index.cjs +111 -0
- package/dist/components/Drawer/index.css +70 -0
- package/dist/components/Drawer/index.d.cts +14 -0
- package/dist/components/Drawer/index.d.ts +14 -0
- package/dist/components/Drawer/index.js +74 -0
- package/dist/components/Dropdown/index.cjs +185 -0
- package/dist/components/Dropdown/index.css +54 -0
- package/dist/components/Dropdown/index.d.cts +17 -0
- package/dist/components/Dropdown/index.d.ts +17 -0
- package/dist/components/Dropdown/index.js +148 -0
- package/dist/components/EmptyState/index.cjs +60 -0
- package/dist/components/EmptyState/index.css +32 -0
- package/dist/components/EmptyState/index.d.cts +12 -0
- package/dist/components/EmptyState/index.d.ts +12 -0
- package/dist/components/EmptyState/index.js +33 -0
- package/dist/components/FileUpload/index.cjs +1039 -0
- package/dist/components/FileUpload/index.css +42 -0
- package/dist/components/FileUpload/index.d.cts +14 -0
- package/dist/components/FileUpload/index.d.ts +14 -0
- package/dist/components/FileUpload/index.js +1002 -0
- package/dist/components/Pagination/index.cjs +913 -7
- package/dist/components/Pagination/index.js +913 -7
- package/dist/components/Radio/index.css +1 -1
- package/dist/components/Steps/index.cjs +1105 -0
- package/dist/components/Steps/index.css +918 -0
- package/dist/components/Steps/index.d.cts +134 -0
- package/dist/components/Steps/index.d.ts +134 -0
- package/dist/components/Steps/index.js +1078 -0
- package/dist/components/Tag/index.cjs +1090 -0
- package/dist/components/Tag/index.css +498 -0
- package/dist/components/Tag/index.d.cts +131 -0
- package/dist/components/Tag/index.d.ts +131 -0
- package/dist/components/Tag/index.js +1063 -0
- package/dist/components/Toast/index.cjs +150 -0
- package/dist/components/Toast/index.css +111 -0
- package/dist/components/Toast/index.d.cts +15 -0
- package/dist/components/Toast/index.d.ts +15 -0
- package/dist/components/Toast/index.js +112 -0
- package/dist/components/Tooltip/index.css +3 -0
- package/dist/components/index.cjs +1651 -1182
- package/dist/components/index.css +5771 -4005
- package/dist/components/index.d.cts +7 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.js +1619 -1158
- package/dist/index.cjs +2674 -2241
- package/dist/index.css +5771 -4005
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2742 -2317
- package/package.json +2 -2
|
@@ -0,0 +1,185 @@
|
|
|
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/Dropdown/index.ts
|
|
31
|
+
var Dropdown_exports = {};
|
|
32
|
+
__export(Dropdown_exports, {
|
|
33
|
+
Dropdown: () => Dropdown_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(Dropdown_exports);
|
|
36
|
+
|
|
37
|
+
// src/components/Dropdown/Dropdown.tsx
|
|
38
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
39
|
+
|
|
40
|
+
// src/tokens/hooks/useAutoPosition.ts
|
|
41
|
+
var import_react = __toESM(require("react"), 1);
|
|
42
|
+
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
43
|
+
const [position, setPosition] = import_react.default.useState({
|
|
44
|
+
position: {},
|
|
45
|
+
direction: "bottom"
|
|
46
|
+
});
|
|
47
|
+
const calculatePosition = import_react.default.useCallback(() => {
|
|
48
|
+
if (!triggerRef.current || !popRef.current) return;
|
|
49
|
+
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
50
|
+
const popRect = popRef.current.getBoundingClientRect();
|
|
51
|
+
const viewportWidth = window.innerWidth;
|
|
52
|
+
const viewportHeight = window.innerHeight;
|
|
53
|
+
const position2 = {};
|
|
54
|
+
let direction = "bottom";
|
|
55
|
+
if (triggerRect.bottom + popRect.height > viewportHeight) {
|
|
56
|
+
direction = "top";
|
|
57
|
+
}
|
|
58
|
+
if (triggerRect.left + popRect.width > viewportWidth) {
|
|
59
|
+
position2["right"] = 10;
|
|
60
|
+
}
|
|
61
|
+
if (triggerRect.left < 0) {
|
|
62
|
+
position2["left"] = 10;
|
|
63
|
+
}
|
|
64
|
+
setPosition({
|
|
65
|
+
position: position2,
|
|
66
|
+
direction
|
|
67
|
+
});
|
|
68
|
+
}, [triggerRef, popRef]);
|
|
69
|
+
import_react.default.useEffect(() => {
|
|
70
|
+
calculatePosition();
|
|
71
|
+
window.addEventListener("resize", calculatePosition);
|
|
72
|
+
return () => window.removeEventListener("resize", calculatePosition);
|
|
73
|
+
}, [calculatePosition, enabled]);
|
|
74
|
+
return position;
|
|
75
|
+
};
|
|
76
|
+
var useAutoPosition_default = useAutoPosition;
|
|
77
|
+
|
|
78
|
+
// src/tokens/hooks/useClickOutside.ts
|
|
79
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
80
|
+
var useClickOutside = (refs, handler, enabled = true) => {
|
|
81
|
+
import_react2.default.useEffect(() => {
|
|
82
|
+
if (!enabled) return;
|
|
83
|
+
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
84
|
+
const listener = (event) => {
|
|
85
|
+
const target = event.target;
|
|
86
|
+
const isInside = refArray.some(
|
|
87
|
+
(ref) => ref.current && ref.current.contains(target)
|
|
88
|
+
);
|
|
89
|
+
if (!isInside) {
|
|
90
|
+
handler();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
document.addEventListener("mousedown", listener);
|
|
94
|
+
document.addEventListener("touchstart", listener);
|
|
95
|
+
return () => {
|
|
96
|
+
document.removeEventListener("mousedown", listener);
|
|
97
|
+
document.removeEventListener("touchstart", listener);
|
|
98
|
+
};
|
|
99
|
+
}, [refs, handler, enabled]);
|
|
100
|
+
};
|
|
101
|
+
var useClickOutside_default = useClickOutside;
|
|
102
|
+
|
|
103
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
104
|
+
function r(e) {
|
|
105
|
+
var t, f, n = "";
|
|
106
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
107
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
108
|
+
var o = e.length;
|
|
109
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
110
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
111
|
+
return n;
|
|
112
|
+
}
|
|
113
|
+
function clsx() {
|
|
114
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
115
|
+
return n;
|
|
116
|
+
}
|
|
117
|
+
var clsx_default = clsx;
|
|
118
|
+
|
|
119
|
+
// src/components/Dropdown/Dropdown.tsx
|
|
120
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
121
|
+
var Dropdown = (props) => {
|
|
122
|
+
const { items, children, className } = props;
|
|
123
|
+
const [isOpen, setIsOpen] = import_react3.default.useState(false);
|
|
124
|
+
const [mounted, setMounted] = import_react3.default.useState(false);
|
|
125
|
+
const [visible, setVisible] = import_react3.default.useState(false);
|
|
126
|
+
const triggerRef = import_react3.default.useRef(null);
|
|
127
|
+
const menuRef = import_react3.default.useRef(null);
|
|
128
|
+
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, isOpen);
|
|
129
|
+
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false));
|
|
130
|
+
import_react3.default.useEffect(() => {
|
|
131
|
+
if (isOpen) {
|
|
132
|
+
setMounted(true);
|
|
133
|
+
const t2 = setTimeout(() => setVisible(true), 1);
|
|
134
|
+
return () => clearTimeout(t2);
|
|
135
|
+
}
|
|
136
|
+
setVisible(false);
|
|
137
|
+
const t = setTimeout(() => setMounted(false), 150);
|
|
138
|
+
return () => clearTimeout(t);
|
|
139
|
+
}, [isOpen]);
|
|
140
|
+
const handleItemClick = (item) => {
|
|
141
|
+
if (item.disabled) return;
|
|
142
|
+
item.onClick?.();
|
|
143
|
+
setIsOpen(false);
|
|
144
|
+
};
|
|
145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: clsx_default("lib-xplat-dropdown", className), children: [
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
ref: triggerRef,
|
|
150
|
+
className: "dropdown-trigger",
|
|
151
|
+
onClick: () => setIsOpen((prev) => !prev),
|
|
152
|
+
children
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
ref: menuRef,
|
|
159
|
+
className: clsx_default("dropdown-menu", direction, { visible }),
|
|
160
|
+
style: { top: position.top, left: position.left },
|
|
161
|
+
role: "menu",
|
|
162
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
163
|
+
"button",
|
|
164
|
+
{
|
|
165
|
+
className: clsx_default("dropdown-item", {
|
|
166
|
+
disabled: item.disabled,
|
|
167
|
+
danger: item.danger
|
|
168
|
+
}),
|
|
169
|
+
role: "menuitem",
|
|
170
|
+
disabled: item.disabled,
|
|
171
|
+
onClick: () => handleItemClick(item),
|
|
172
|
+
children: item.label
|
|
173
|
+
},
|
|
174
|
+
item.key
|
|
175
|
+
))
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
] });
|
|
179
|
+
};
|
|
180
|
+
Dropdown.displayName = "Dropdown";
|
|
181
|
+
var Dropdown_default = Dropdown;
|
|
182
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
183
|
+
0 && (module.exports = {
|
|
184
|
+
Dropdown
|
|
185
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* src/components/Dropdown/dropdown.scss */
|
|
2
|
+
.lib-xplat-dropdown {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
}
|
|
6
|
+
.lib-xplat-dropdown .dropdown-trigger {
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
.lib-xplat-dropdown .dropdown-menu {
|
|
10
|
+
position: absolute;
|
|
11
|
+
z-index: 100;
|
|
12
|
+
min-width: 160px;
|
|
13
|
+
background: #FFFFFF;
|
|
14
|
+
border: 1px solid #E5E5E5;
|
|
15
|
+
border-radius: 0.5rem;
|
|
16
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
|
17
|
+
padding: 4px 0;
|
|
18
|
+
opacity: 0;
|
|
19
|
+
transform: translateY(-4px);
|
|
20
|
+
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
21
|
+
}
|
|
22
|
+
.lib-xplat-dropdown .dropdown-menu.bottom {
|
|
23
|
+
transform: translateY(4px);
|
|
24
|
+
}
|
|
25
|
+
.lib-xplat-dropdown .dropdown-menu.visible {
|
|
26
|
+
opacity: 1;
|
|
27
|
+
transform: translateY(0);
|
|
28
|
+
}
|
|
29
|
+
.lib-xplat-dropdown .dropdown-item {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
width: 100%;
|
|
33
|
+
padding: 0.5rem 0.875rem;
|
|
34
|
+
border: none;
|
|
35
|
+
background: none;
|
|
36
|
+
font-size: 14px;
|
|
37
|
+
color: #262626;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
text-align: left;
|
|
40
|
+
transition: background-color 0.15s;
|
|
41
|
+
}
|
|
42
|
+
.lib-xplat-dropdown .dropdown-item:hover:not(:disabled) {
|
|
43
|
+
background-color: #FAFAFA;
|
|
44
|
+
}
|
|
45
|
+
.lib-xplat-dropdown .dropdown-item.danger {
|
|
46
|
+
color: #F80409;
|
|
47
|
+
}
|
|
48
|
+
.lib-xplat-dropdown .dropdown-item.danger:hover:not(:disabled) {
|
|
49
|
+
background-color: #FFF0F0;
|
|
50
|
+
}
|
|
51
|
+
.lib-xplat-dropdown .dropdown-item:disabled {
|
|
52
|
+
color: #A1A1A1;
|
|
53
|
+
cursor: not-allowed;
|
|
54
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface DropdownItem {
|
|
4
|
+
key: string;
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
danger?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface DropdownProps {
|
|
11
|
+
items: DropdownItem[];
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const Dropdown: React.FC<DropdownProps>;
|
|
16
|
+
|
|
17
|
+
export { Dropdown };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface DropdownItem {
|
|
4
|
+
key: string;
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
danger?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface DropdownProps {
|
|
11
|
+
items: DropdownItem[];
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const Dropdown: React.FC<DropdownProps>;
|
|
16
|
+
|
|
17
|
+
export { Dropdown };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// src/components/Dropdown/Dropdown.tsx
|
|
2
|
+
import React3 from "react";
|
|
3
|
+
|
|
4
|
+
// src/tokens/hooks/useAutoPosition.ts
|
|
5
|
+
import React from "react";
|
|
6
|
+
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
7
|
+
const [position, setPosition] = React.useState({
|
|
8
|
+
position: {},
|
|
9
|
+
direction: "bottom"
|
|
10
|
+
});
|
|
11
|
+
const calculatePosition = React.useCallback(() => {
|
|
12
|
+
if (!triggerRef.current || !popRef.current) return;
|
|
13
|
+
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
14
|
+
const popRect = popRef.current.getBoundingClientRect();
|
|
15
|
+
const viewportWidth = window.innerWidth;
|
|
16
|
+
const viewportHeight = window.innerHeight;
|
|
17
|
+
const position2 = {};
|
|
18
|
+
let direction = "bottom";
|
|
19
|
+
if (triggerRect.bottom + popRect.height > viewportHeight) {
|
|
20
|
+
direction = "top";
|
|
21
|
+
}
|
|
22
|
+
if (triggerRect.left + popRect.width > viewportWidth) {
|
|
23
|
+
position2["right"] = 10;
|
|
24
|
+
}
|
|
25
|
+
if (triggerRect.left < 0) {
|
|
26
|
+
position2["left"] = 10;
|
|
27
|
+
}
|
|
28
|
+
setPosition({
|
|
29
|
+
position: position2,
|
|
30
|
+
direction
|
|
31
|
+
});
|
|
32
|
+
}, [triggerRef, popRef]);
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
calculatePosition();
|
|
35
|
+
window.addEventListener("resize", calculatePosition);
|
|
36
|
+
return () => window.removeEventListener("resize", calculatePosition);
|
|
37
|
+
}, [calculatePosition, enabled]);
|
|
38
|
+
return position;
|
|
39
|
+
};
|
|
40
|
+
var useAutoPosition_default = useAutoPosition;
|
|
41
|
+
|
|
42
|
+
// src/tokens/hooks/useClickOutside.ts
|
|
43
|
+
import React2 from "react";
|
|
44
|
+
var useClickOutside = (refs, handler, enabled = true) => {
|
|
45
|
+
React2.useEffect(() => {
|
|
46
|
+
if (!enabled) return;
|
|
47
|
+
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
48
|
+
const listener = (event) => {
|
|
49
|
+
const target = event.target;
|
|
50
|
+
const isInside = refArray.some(
|
|
51
|
+
(ref) => ref.current && ref.current.contains(target)
|
|
52
|
+
);
|
|
53
|
+
if (!isInside) {
|
|
54
|
+
handler();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
document.addEventListener("mousedown", listener);
|
|
58
|
+
document.addEventListener("touchstart", listener);
|
|
59
|
+
return () => {
|
|
60
|
+
document.removeEventListener("mousedown", listener);
|
|
61
|
+
document.removeEventListener("touchstart", listener);
|
|
62
|
+
};
|
|
63
|
+
}, [refs, handler, enabled]);
|
|
64
|
+
};
|
|
65
|
+
var useClickOutside_default = useClickOutside;
|
|
66
|
+
|
|
67
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
68
|
+
function r(e) {
|
|
69
|
+
var t, f, n = "";
|
|
70
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
71
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
72
|
+
var o = e.length;
|
|
73
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
74
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
75
|
+
return n;
|
|
76
|
+
}
|
|
77
|
+
function clsx() {
|
|
78
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
79
|
+
return n;
|
|
80
|
+
}
|
|
81
|
+
var clsx_default = clsx;
|
|
82
|
+
|
|
83
|
+
// src/components/Dropdown/Dropdown.tsx
|
|
84
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
85
|
+
var Dropdown = (props) => {
|
|
86
|
+
const { items, children, className } = props;
|
|
87
|
+
const [isOpen, setIsOpen] = React3.useState(false);
|
|
88
|
+
const [mounted, setMounted] = React3.useState(false);
|
|
89
|
+
const [visible, setVisible] = React3.useState(false);
|
|
90
|
+
const triggerRef = React3.useRef(null);
|
|
91
|
+
const menuRef = React3.useRef(null);
|
|
92
|
+
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, isOpen);
|
|
93
|
+
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false));
|
|
94
|
+
React3.useEffect(() => {
|
|
95
|
+
if (isOpen) {
|
|
96
|
+
setMounted(true);
|
|
97
|
+
const t2 = setTimeout(() => setVisible(true), 1);
|
|
98
|
+
return () => clearTimeout(t2);
|
|
99
|
+
}
|
|
100
|
+
setVisible(false);
|
|
101
|
+
const t = setTimeout(() => setMounted(false), 150);
|
|
102
|
+
return () => clearTimeout(t);
|
|
103
|
+
}, [isOpen]);
|
|
104
|
+
const handleItemClick = (item) => {
|
|
105
|
+
if (item.disabled) return;
|
|
106
|
+
item.onClick?.();
|
|
107
|
+
setIsOpen(false);
|
|
108
|
+
};
|
|
109
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-dropdown", className), children: [
|
|
110
|
+
/* @__PURE__ */ jsx(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
ref: triggerRef,
|
|
114
|
+
className: "dropdown-trigger",
|
|
115
|
+
onClick: () => setIsOpen((prev) => !prev),
|
|
116
|
+
children
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
mounted && /* @__PURE__ */ jsx(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
ref: menuRef,
|
|
123
|
+
className: clsx_default("dropdown-menu", direction, { visible }),
|
|
124
|
+
style: { top: position.top, left: position.left },
|
|
125
|
+
role: "menu",
|
|
126
|
+
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
127
|
+
"button",
|
|
128
|
+
{
|
|
129
|
+
className: clsx_default("dropdown-item", {
|
|
130
|
+
disabled: item.disabled,
|
|
131
|
+
danger: item.danger
|
|
132
|
+
}),
|
|
133
|
+
role: "menuitem",
|
|
134
|
+
disabled: item.disabled,
|
|
135
|
+
onClick: () => handleItemClick(item),
|
|
136
|
+
children: item.label
|
|
137
|
+
},
|
|
138
|
+
item.key
|
|
139
|
+
))
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
] });
|
|
143
|
+
};
|
|
144
|
+
Dropdown.displayName = "Dropdown";
|
|
145
|
+
var Dropdown_default = Dropdown;
|
|
146
|
+
export {
|
|
147
|
+
Dropdown_default as Dropdown
|
|
148
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
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/EmptyState/index.ts
|
|
21
|
+
var EmptyState_exports = {};
|
|
22
|
+
__export(EmptyState_exports, {
|
|
23
|
+
EmptyState: () => EmptyState_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(EmptyState_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/EmptyState/EmptyState.tsx
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
var EmptyState = (props) => {
|
|
46
|
+
const { icon, title = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4", description, action, className } = props;
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: clsx_default("lib-xplat-empty-state", className), children: [
|
|
48
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "empty-icon", children: icon }),
|
|
49
|
+
!icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "empty-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z" }) }) }),
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "empty-title", children: title }),
|
|
51
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "empty-description", children: description }),
|
|
52
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "empty-action", children: action })
|
|
53
|
+
] });
|
|
54
|
+
};
|
|
55
|
+
EmptyState.displayName = "EmptyState";
|
|
56
|
+
var EmptyState_default = EmptyState;
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
EmptyState
|
|
60
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* src/components/EmptyState/emptystate.scss */
|
|
2
|
+
.lib-xplat-empty-state {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
padding: 3rem 1.5rem;
|
|
8
|
+
text-align: center;
|
|
9
|
+
}
|
|
10
|
+
.lib-xplat-empty-state .empty-icon {
|
|
11
|
+
color: #D4D4D4;
|
|
12
|
+
margin-bottom: 1rem;
|
|
13
|
+
}
|
|
14
|
+
.lib-xplat-empty-state .empty-icon svg {
|
|
15
|
+
width: 48px;
|
|
16
|
+
height: 48px;
|
|
17
|
+
}
|
|
18
|
+
.lib-xplat-empty-state .empty-title {
|
|
19
|
+
font-size: 15px;
|
|
20
|
+
font-weight: 500;
|
|
21
|
+
color: #525252;
|
|
22
|
+
margin: 0;
|
|
23
|
+
}
|
|
24
|
+
.lib-xplat-empty-state .empty-description {
|
|
25
|
+
font-size: 13px;
|
|
26
|
+
color: #A1A1A1;
|
|
27
|
+
margin: 0.375rem 0 0;
|
|
28
|
+
max-width: 320px;
|
|
29
|
+
}
|
|
30
|
+
.lib-xplat-empty-state .empty-action {
|
|
31
|
+
margin-top: 1.25rem;
|
|
32
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface EmptyStateProps {
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
action?: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const EmptyState: React.FC<EmptyStateProps>;
|
|
11
|
+
|
|
12
|
+
export { EmptyState };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface EmptyStateProps {
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
action?: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const EmptyState: React.FC<EmptyStateProps>;
|
|
11
|
+
|
|
12
|
+
export { EmptyState };
|
|
@@ -0,0 +1,33 @@
|
|
|
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/EmptyState/EmptyState.tsx
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
var EmptyState = (props) => {
|
|
20
|
+
const { icon, title = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4", description, action, className } = props;
|
|
21
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-empty-state", className), children: [
|
|
22
|
+
icon && /* @__PURE__ */ jsx("div", { className: "empty-icon", children: icon }),
|
|
23
|
+
!icon && /* @__PURE__ */ jsx("div", { className: "empty-icon", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z" }) }) }),
|
|
24
|
+
/* @__PURE__ */ jsx("p", { className: "empty-title", children: title }),
|
|
25
|
+
description && /* @__PURE__ */ jsx("p", { className: "empty-description", children: description }),
|
|
26
|
+
action && /* @__PURE__ */ jsx("div", { className: "empty-action", children: action })
|
|
27
|
+
] });
|
|
28
|
+
};
|
|
29
|
+
EmptyState.displayName = "EmptyState";
|
|
30
|
+
var EmptyState_default = EmptyState;
|
|
31
|
+
export {
|
|
32
|
+
EmptyState_default as EmptyState
|
|
33
|
+
};
|