@x-plat/design-system 0.1.1 → 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 +6 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// src/tokens/colors.ts
|
|
2
|
+
var colors = {
|
|
3
|
+
xplat: {
|
|
4
|
+
red: {
|
|
5
|
+
50: "#FFF0F0",
|
|
6
|
+
100: "#FFDDDE",
|
|
7
|
+
200: "#FFC1C2",
|
|
8
|
+
300: "#FF9698",
|
|
9
|
+
400: "#FF5A5D",
|
|
10
|
+
500: "#FF272B",
|
|
11
|
+
600: "#F80409",
|
|
12
|
+
700: "#D40105",
|
|
13
|
+
800: "#AE0609",
|
|
14
|
+
900: "#900C0F"
|
|
15
|
+
},
|
|
16
|
+
green: {
|
|
17
|
+
50: "#E5F6EA",
|
|
18
|
+
100: "#C1E7CC",
|
|
19
|
+
200: "#98D8AC",
|
|
20
|
+
300: "#6CCA8B",
|
|
21
|
+
400: "#47BE72",
|
|
22
|
+
500: "#10B259",
|
|
23
|
+
600: "#00A34F",
|
|
24
|
+
700: "#009143",
|
|
25
|
+
800: "#007F38",
|
|
26
|
+
900: "#006024"
|
|
27
|
+
},
|
|
28
|
+
orange: {
|
|
29
|
+
50: "#FFF8EC",
|
|
30
|
+
100: "#FFF0D3",
|
|
31
|
+
200: "#FFDDA5",
|
|
32
|
+
300: "#FFC46D",
|
|
33
|
+
400: "#FF9F32",
|
|
34
|
+
500: "#FF820A",
|
|
35
|
+
600: "#FF6900",
|
|
36
|
+
700: "#CC4B02",
|
|
37
|
+
800: "#A13A0B",
|
|
38
|
+
900: "#82320C"
|
|
39
|
+
},
|
|
40
|
+
yellow: {
|
|
41
|
+
50: "#FFFDE7",
|
|
42
|
+
100: "#FFFAC1",
|
|
43
|
+
200: "#FFF186",
|
|
44
|
+
300: "#FFE041",
|
|
45
|
+
400: "#FFCC0D",
|
|
46
|
+
500: "#F0B100",
|
|
47
|
+
600: "#D18800",
|
|
48
|
+
700: "#A66002",
|
|
49
|
+
800: "#894B0A",
|
|
50
|
+
900: "#743D0F"
|
|
51
|
+
},
|
|
52
|
+
blue: {
|
|
53
|
+
50: "#F1F4FD",
|
|
54
|
+
100: "#DFE7FA",
|
|
55
|
+
200: "#C5D4F8",
|
|
56
|
+
300: "#9EB8F2",
|
|
57
|
+
400: "#7093EA",
|
|
58
|
+
500: "#4D6DE3",
|
|
59
|
+
600: "#3950D7",
|
|
60
|
+
700: "#303EC5",
|
|
61
|
+
800: "#2D35A0",
|
|
62
|
+
900: "#29317F"
|
|
63
|
+
},
|
|
64
|
+
lightblue: {
|
|
65
|
+
50: "#EEFAFF",
|
|
66
|
+
100: "#D9F4FF",
|
|
67
|
+
200: "#BBEDFF",
|
|
68
|
+
300: "#8DE3FF",
|
|
69
|
+
400: "#57D0FF",
|
|
70
|
+
500: "#30B6FF",
|
|
71
|
+
600: "#1999F7",
|
|
72
|
+
700: "#1280E3",
|
|
73
|
+
800: "#1566B8",
|
|
74
|
+
900: "#175791"
|
|
75
|
+
},
|
|
76
|
+
purple: {
|
|
77
|
+
50: "#FBF6FE",
|
|
78
|
+
100: "#F5EAFD",
|
|
79
|
+
200: "#EDD8FC",
|
|
80
|
+
300: "#E0BAF8",
|
|
81
|
+
400: "#CD8DF3",
|
|
82
|
+
500: "#B961EB",
|
|
83
|
+
600: "#A541DC",
|
|
84
|
+
700: "#9230C5",
|
|
85
|
+
800: "#782B9E",
|
|
86
|
+
900: "#62247F"
|
|
87
|
+
},
|
|
88
|
+
pink: {
|
|
89
|
+
50: "#FFF4FE",
|
|
90
|
+
100: "#FFE7FD",
|
|
91
|
+
200: "#FFCFFA",
|
|
92
|
+
300: "#FEA9F1",
|
|
93
|
+
400: "#FD75E7",
|
|
94
|
+
500: "#F553DA",
|
|
95
|
+
600: "#D821B6",
|
|
96
|
+
700: "#B31892",
|
|
97
|
+
800: "#921676",
|
|
98
|
+
900: "#781761"
|
|
99
|
+
},
|
|
100
|
+
neutral: {
|
|
101
|
+
50: "#FAFAFA",
|
|
102
|
+
100: "#F5F5F5",
|
|
103
|
+
200: "#E5E5E5",
|
|
104
|
+
300: "#D4D4D4",
|
|
105
|
+
400: "#A1A1A1",
|
|
106
|
+
500: "#737373",
|
|
107
|
+
600: "#525252",
|
|
108
|
+
700: "#404040",
|
|
109
|
+
800: "#262626",
|
|
110
|
+
900: "#171717"
|
|
111
|
+
},
|
|
112
|
+
black: "#000000",
|
|
113
|
+
white: "#FFFFFF"
|
|
114
|
+
},
|
|
115
|
+
test: {
|
|
116
|
+
default: "#ffffff"
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// src/util/getColor.ts
|
|
121
|
+
var getColorClass = (namespace, palette, shade) => {
|
|
122
|
+
const namespaceMap = colors[namespace];
|
|
123
|
+
const paletteMap = namespaceMap[palette];
|
|
124
|
+
const hasShade = paletteMap && typeof paletteMap === "object" && shade !== void 0 && shade in paletteMap;
|
|
125
|
+
return `${String(namespace)}-${String(palette)}${hasShade ? `-${String(shade)}` : ""}`;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
129
|
+
function r(e) {
|
|
130
|
+
var t, f, n = "";
|
|
131
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
132
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
133
|
+
var o = e.length;
|
|
134
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
135
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
136
|
+
return n;
|
|
137
|
+
}
|
|
138
|
+
function clsx() {
|
|
139
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
140
|
+
return n;
|
|
141
|
+
}
|
|
142
|
+
var clsx_default = clsx;
|
|
143
|
+
|
|
144
|
+
// src/components/Badge/Badge.tsx
|
|
145
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
146
|
+
var Badge = (props) => {
|
|
147
|
+
const {
|
|
148
|
+
children,
|
|
149
|
+
count,
|
|
150
|
+
maxCount = 99,
|
|
151
|
+
dot = false,
|
|
152
|
+
colorNamespace = "xplat",
|
|
153
|
+
color = "red",
|
|
154
|
+
colorDepth,
|
|
155
|
+
className
|
|
156
|
+
} = props;
|
|
157
|
+
const colorClass = getColorClass(
|
|
158
|
+
colorNamespace,
|
|
159
|
+
color,
|
|
160
|
+
colorDepth ?? 500
|
|
161
|
+
);
|
|
162
|
+
const showBadge = dot || count !== void 0 && count > 0;
|
|
163
|
+
const displayCount = count !== void 0 && count > maxCount ? `${maxCount}+` : count;
|
|
164
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-badge", className), children: [
|
|
165
|
+
children,
|
|
166
|
+
showBadge && /* @__PURE__ */ jsx("span", { className: clsx_default("badge-indicator", colorClass, { dot }), children: !dot && displayCount })
|
|
167
|
+
] });
|
|
168
|
+
};
|
|
169
|
+
Badge.displayName = "Badge";
|
|
170
|
+
var Badge_default = Badge;
|
|
171
|
+
export {
|
|
172
|
+
Badge_default as Badge
|
|
173
|
+
};
|
|
@@ -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/Breadcrumb/index.ts
|
|
21
|
+
var Breadcrumb_exports = {};
|
|
22
|
+
__export(Breadcrumb_exports, {
|
|
23
|
+
Breadcrumb: () => Breadcrumb_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Breadcrumb_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/Breadcrumb/Breadcrumb.tsx
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
var Breadcrumb = (props) => {
|
|
46
|
+
const { items, separator = "/", className } = props;
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { className: clsx_default("lib-xplat-breadcrumb", className), "aria-label": "\uACBD\uB85C", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { children: items.map((item, index) => {
|
|
48
|
+
const isLast = index === items.length - 1;
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
|
|
50
|
+
isLast ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "current", "aria-current": "page", children: item.label }) : item.href ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: item.href, className: "link", children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "link", onClick: item.onClick, children: item.label }),
|
|
51
|
+
!isLast && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "separator", children: separator })
|
|
52
|
+
] }, index);
|
|
53
|
+
}) }) });
|
|
54
|
+
};
|
|
55
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
56
|
+
var Breadcrumb_default = Breadcrumb;
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
Breadcrumb
|
|
60
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* src/components/Breadcrumb/breadcrumb.scss */
|
|
2
|
+
.lib-xplat-breadcrumb ol {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
list-style: none;
|
|
6
|
+
margin: 0;
|
|
7
|
+
padding: 0;
|
|
8
|
+
gap: 4px;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
}
|
|
11
|
+
.lib-xplat-breadcrumb li {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: 4px;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
}
|
|
17
|
+
.lib-xplat-breadcrumb .link {
|
|
18
|
+
color: #737373;
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
background: none;
|
|
21
|
+
border: none;
|
|
22
|
+
padding: 0;
|
|
23
|
+
font-size: inherit;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
transition: color 0.2s;
|
|
26
|
+
}
|
|
27
|
+
.lib-xplat-breadcrumb .link:hover {
|
|
28
|
+
color: #262626;
|
|
29
|
+
}
|
|
30
|
+
.lib-xplat-breadcrumb .current {
|
|
31
|
+
color: #171717;
|
|
32
|
+
font-weight: 500;
|
|
33
|
+
}
|
|
34
|
+
.lib-xplat-breadcrumb .separator {
|
|
35
|
+
color: #A1A1A1;
|
|
36
|
+
user-select: none;
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface BreadcrumbItem {
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
}
|
|
8
|
+
interface BreadcrumbProps {
|
|
9
|
+
items: BreadcrumbItem[];
|
|
10
|
+
separator?: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const Breadcrumb: React.FC<BreadcrumbProps>;
|
|
14
|
+
|
|
15
|
+
export { Breadcrumb };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface BreadcrumbItem {
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
}
|
|
8
|
+
interface BreadcrumbProps {
|
|
9
|
+
items: BreadcrumbItem[];
|
|
10
|
+
separator?: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const Breadcrumb: React.FC<BreadcrumbProps>;
|
|
14
|
+
|
|
15
|
+
export { Breadcrumb };
|
|
@@ -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/Breadcrumb/Breadcrumb.tsx
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
var Breadcrumb = (props) => {
|
|
20
|
+
const { items, separator = "/", className } = props;
|
|
21
|
+
return /* @__PURE__ */ jsx("nav", { className: clsx_default("lib-xplat-breadcrumb", className), "aria-label": "\uACBD\uB85C", children: /* @__PURE__ */ jsx("ol", { children: items.map((item, index) => {
|
|
22
|
+
const isLast = index === items.length - 1;
|
|
23
|
+
return /* @__PURE__ */ jsxs("li", { children: [
|
|
24
|
+
isLast ? /* @__PURE__ */ jsx("span", { className: "current", "aria-current": "page", children: item.label }) : item.href ? /* @__PURE__ */ jsx("a", { href: item.href, className: "link", children: item.label }) : /* @__PURE__ */ jsx("button", { className: "link", onClick: item.onClick, children: item.label }),
|
|
25
|
+
!isLast && /* @__PURE__ */ jsx("span", { className: "separator", children: separator })
|
|
26
|
+
] }, index);
|
|
27
|
+
}) }) });
|
|
28
|
+
};
|
|
29
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
30
|
+
var Breadcrumb_default = Breadcrumb;
|
|
31
|
+
export {
|
|
32
|
+
Breadcrumb_default as Breadcrumb
|
|
33
|
+
};
|
|
@@ -303,8 +303,11 @@ import_chart.Chart.register(
|
|
|
303
303
|
);
|
|
304
304
|
var Chart = (props) => {
|
|
305
305
|
const { type, data, labels } = props;
|
|
306
|
-
const
|
|
306
|
+
const chartInstanceRef = import_react.default.useRef(null);
|
|
307
307
|
const containerRef = import_react.default.useRef(null);
|
|
308
|
+
const chartRef = import_react.default.useCallback((instance) => {
|
|
309
|
+
chartInstanceRef.current = instance ?? null;
|
|
310
|
+
}, []);
|
|
308
311
|
const datasets = import_react.default.useMemo(() => {
|
|
309
312
|
const pallette = getChartColorPreset(type);
|
|
310
313
|
return Object.entries(data).map(([key, values], index) => {
|
|
@@ -374,10 +377,10 @@ var Chart = (props) => {
|
|
|
374
377
|
}
|
|
375
378
|
}, [chartData, options, type]);
|
|
376
379
|
import_react.default.useEffect(() => {
|
|
377
|
-
if (!containerRef.current || !
|
|
380
|
+
if (!containerRef.current || !chartInstanceRef.current) return;
|
|
378
381
|
const observer = new ResizeObserver(() => {
|
|
379
382
|
requestAnimationFrame(() => {
|
|
380
|
-
|
|
383
|
+
chartInstanceRef.current?.resize();
|
|
381
384
|
});
|
|
382
385
|
});
|
|
383
386
|
observer.observe(containerRef.current);
|
|
@@ -278,8 +278,11 @@ ChartJS.register(
|
|
|
278
278
|
);
|
|
279
279
|
var Chart = (props) => {
|
|
280
280
|
const { type, data, labels } = props;
|
|
281
|
-
const
|
|
281
|
+
const chartInstanceRef = React.useRef(null);
|
|
282
282
|
const containerRef = React.useRef(null);
|
|
283
|
+
const chartRef = React.useCallback((instance) => {
|
|
284
|
+
chartInstanceRef.current = instance ?? null;
|
|
285
|
+
}, []);
|
|
283
286
|
const datasets = React.useMemo(() => {
|
|
284
287
|
const pallette = getChartColorPreset(type);
|
|
285
288
|
return Object.entries(data).map(([key, values], index) => {
|
|
@@ -349,10 +352,10 @@ var Chart = (props) => {
|
|
|
349
352
|
}
|
|
350
353
|
}, [chartData, options, type]);
|
|
351
354
|
React.useEffect(() => {
|
|
352
|
-
if (!containerRef.current || !
|
|
355
|
+
if (!containerRef.current || !chartInstanceRef.current) return;
|
|
353
356
|
const observer = new ResizeObserver(() => {
|
|
354
357
|
requestAnimationFrame(() => {
|
|
355
|
-
|
|
358
|
+
chartInstanceRef.current?.resize();
|
|
356
359
|
});
|
|
357
360
|
});
|
|
358
361
|
observer.observe(containerRef.current);
|
|
@@ -0,0 +1,61 @@
|
|
|
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/Divider/index.ts
|
|
21
|
+
var Divider_exports = {};
|
|
22
|
+
__export(Divider_exports, {
|
|
23
|
+
Divider: () => Divider_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Divider_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/Divider/Divider.tsx
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
var Divider = (props) => {
|
|
46
|
+
const { orientation = "horizontal", className } = props;
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: clsx_default("lib-xplat-divider", orientation, className),
|
|
51
|
+
role: "separator",
|
|
52
|
+
"aria-orientation": orientation
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
Divider.displayName = "Divider";
|
|
57
|
+
var Divider_default = Divider;
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
Divider
|
|
61
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* src/components/Divider/divider.scss */
|
|
2
|
+
.lib-xplat-divider {
|
|
3
|
+
border: none;
|
|
4
|
+
flex-shrink: 0;
|
|
5
|
+
}
|
|
6
|
+
.lib-xplat-divider.horizontal {
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 1px;
|
|
9
|
+
background-color: #E5E5E5;
|
|
10
|
+
}
|
|
11
|
+
.lib-xplat-divider.vertical {
|
|
12
|
+
width: 1px;
|
|
13
|
+
align-self: stretch;
|
|
14
|
+
background-color: #E5E5E5;
|
|
15
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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/Divider/Divider.tsx
|
|
18
|
+
import { jsx } from "react/jsx-runtime";
|
|
19
|
+
var Divider = (props) => {
|
|
20
|
+
const { orientation = "horizontal", className } = props;
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: clsx_default("lib-xplat-divider", orientation, className),
|
|
25
|
+
role: "separator",
|
|
26
|
+
"aria-orientation": orientation
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
Divider.displayName = "Divider";
|
|
31
|
+
var Divider_default = Divider;
|
|
32
|
+
export {
|
|
33
|
+
Divider_default as Divider
|
|
34
|
+
};
|
|
@@ -1017,9 +1017,15 @@ var import_jsx_runtime294 = require("react/jsx-runtime");
|
|
|
1017
1017
|
var import_jsx_runtime295 = require("react/jsx-runtime");
|
|
1018
1018
|
var ImageSelector = (props) => {
|
|
1019
1019
|
const { value, label, onChange } = props;
|
|
1020
|
-
const previewUrl = import_react.default.
|
|
1021
|
-
|
|
1022
|
-
|
|
1020
|
+
const [previewUrl, setPreviewUrl] = import_react.default.useState();
|
|
1021
|
+
import_react.default.useEffect(() => {
|
|
1022
|
+
if (!value) {
|
|
1023
|
+
setPreviewUrl(void 0);
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
const url = URL.createObjectURL(value);
|
|
1027
|
+
setPreviewUrl(url);
|
|
1028
|
+
return () => URL.revokeObjectURL(url);
|
|
1023
1029
|
}, [value]);
|
|
1024
1030
|
const inputRef = import_react.default.useRef(null);
|
|
1025
1031
|
const handleFileChange = (e) => {
|
|
@@ -981,9 +981,15 @@ import { jsx as jsx294 } from "react/jsx-runtime";
|
|
|
981
981
|
import { jsx as jsx295, jsxs as jsxs189 } from "react/jsx-runtime";
|
|
982
982
|
var ImageSelector = (props) => {
|
|
983
983
|
const { value, label, onChange } = props;
|
|
984
|
-
const previewUrl = React.
|
|
985
|
-
|
|
986
|
-
|
|
984
|
+
const [previewUrl, setPreviewUrl] = React.useState();
|
|
985
|
+
React.useEffect(() => {
|
|
986
|
+
if (!value) {
|
|
987
|
+
setPreviewUrl(void 0);
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
const url = URL.createObjectURL(value);
|
|
991
|
+
setPreviewUrl(url);
|
|
992
|
+
return () => URL.revokeObjectURL(url);
|
|
987
993
|
}, [value]);
|
|
988
994
|
const inputRef = React.useRef(null);
|
|
989
995
|
const handleFileChange = (e) => {
|