@duskmoon-dev/components 0.3.1 → 0.4.0
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/README.md +61 -2
- package/dist/{chunk-r9wkv7xd.js → chunk-fwjzvsrx.js} +3 -3
- package/dist/classes/chat.d.ts +43 -0
- package/dist/classes/console-page.d.ts +16 -0
- package/dist/classes/dropdown.d.ts +5 -5
- package/dist/classes/fab.d.ts +11 -0
- package/dist/classes/index.d.ts +6 -0
- package/dist/classes/index.js +1443 -1210
- package/dist/classes/megamenu.d.ts +10 -0
- package/dist/classes/otp-input.d.ts +12 -0
- package/dist/classes/popover.d.ts +1 -3
- package/dist/classes/swap.d.ts +12 -0
- package/dist/classes/tree-select.d.ts +6 -6
- package/dist/components/anchor/index.js +2 -2
- package/dist/components/app/index.js +211 -151
- package/dist/components/avatar/Avatar.types.d.ts +1 -1
- package/dist/components/avatar/index.js +2 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/button/Button.d.ts +1 -1
- package/dist/components/button/Button.types.d.ts +8 -0
- package/dist/components/button/index.js +253 -24
- package/dist/components/calendar/index.js +44 -19
- package/dist/components/cascader/index.js +2 -2
- package/dist/components/chat/Chat.d.ts +22 -0
- package/dist/components/chat/Chat.types.d.ts +73 -0
- package/dist/components/chat/index.d.ts +2 -0
- package/dist/components/chat/index.js +309 -0
- package/dist/components/color-picker/ColorPicker.types.d.ts +2 -1
- package/dist/components/color-picker/index.js +210 -13
- package/dist/components/config-provider/index.js +2 -2
- package/dist/components/console-page/ConsolePage.d.ts +2 -0
- package/dist/components/console-page/ConsolePage.types.d.ts +29 -0
- package/dist/components/console-page/index.d.ts +2 -0
- package/dist/components/console-page/index.js +205 -0
- package/dist/components/date-picker/DatePicker.types.d.ts +1 -0
- package/dist/components/date-picker/index.js +537 -35
- package/dist/components/date-picker/usePickerDropdown.d.ts +17 -0
- package/dist/components/dm-breadcrumb/index.js +18 -18
- package/dist/components/dm-date-picker/index.js +635 -133
- package/dist/components/dm-drawer/index.js +269 -40
- package/dist/components/dm-layout/index.js +575 -208
- package/dist/components/dm-menu/index.js +399 -32
- package/dist/components/dm-message/index.js +18 -18
- package/dist/components/dm-page-header/index.js +537 -247
- package/dist/components/dm-pagination/index.js +39 -39
- package/dist/components/dm-pro-table/index.js +2374 -1559
- package/dist/components/dm-provider/index.js +94 -94
- package/dist/components/dm-query/DmQuery.types.d.ts +1 -1
- package/dist/components/dm-query/index.js +955 -210
- package/dist/components/dm-search/DmSearch.types.d.ts +4 -0
- package/dist/components/dm-search/index.js +937 -183
- package/dist/components/dm-splitter/index.js +32 -32
- package/dist/components/dm-status/index.js +25 -25
- package/dist/components/dm-table/index.js +1430 -676
- package/dist/components/dm-tabs/index.js +34 -34
- package/dist/components/dm-toolbar/index.js +423 -133
- package/dist/components/dm-tree/index.js +92 -92
- package/dist/components/dm-truncate/index.js +145 -65
- package/dist/components/dropdown/Dropdown.types.d.ts +1 -1
- package/dist/components/dropdown/index.js +467 -177
- package/dist/components/fab/Fab.d.ts +4 -0
- package/dist/components/fab/Fab.types.d.ts +25 -0
- package/dist/components/fab/index.d.ts +2 -0
- package/dist/components/fab/index.js +480 -0
- package/dist/components/form/Form.types.d.ts +1 -0
- package/dist/components/form/index.js +16 -5
- package/dist/components/grid/index.js +2 -2
- package/dist/components/input/index.js +4 -4
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/megamenu/Megamenu.d.ts +2 -0
- package/dist/components/megamenu/Megamenu.types.d.ts +32 -0
- package/dist/components/megamenu/index.d.ts +2 -0
- package/dist/components/megamenu/index.js +214 -0
- package/dist/components/message/index.js +5 -5
- package/dist/components/modal/index.js +128 -68
- package/dist/components/notification/index.js +2 -2
- package/dist/components/otp-input/OtpInput.d.ts +2 -0
- package/dist/components/otp-input/OtpInput.types.d.ts +16 -0
- package/dist/components/otp-input/index.d.ts +2 -0
- package/dist/components/otp-input/index.js +112 -0
- package/dist/components/popconfirm/index.js +297 -68
- package/dist/components/popover/index.js +24 -4
- package/dist/components/skeleton/index.js +5 -5
- package/dist/components/spin/index.js +2 -2
- package/dist/components/steps/index.js +2 -2
- package/dist/components/swap/Swap.d.ts +3 -0
- package/dist/components/swap/Swap.types.d.ts +22 -0
- package/dist/components/swap/index.d.ts +2 -0
- package/dist/components/swap/index.js +109 -0
- package/dist/components/table/index.js +2 -2
- package/dist/components/tabs/index.js +2 -2
- package/dist/components/tag/index.js +2 -2
- package/dist/components/time-picker/TimePicker.types.d.ts +1 -0
- package/dist/components/time-picker/index.js +167 -29
- package/dist/components/tooltip/Tooltip.types.d.ts +4 -0
- package/dist/components/tooltip/index.js +107 -27
- package/dist/components/tour/index.js +315 -86
- package/dist/components/tree-select/index.js +8 -8
- package/dist/components/typography/index.js +4 -4
- package/dist/components/upload/Upload.types.d.ts +1 -0
- package/dist/components/upload/index.js +7 -5
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4023 -2134
- package/dist/infrastructure.js +11 -11
- package/dist/styles.css +13677 -9811
- package/dist/theme/index.js +3 -3
- package/dist/utils/index.js +5 -5
- package/package.json +30 -6
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
// src/components/tour/Tour.tsx
|
|
4
|
+
import {
|
|
5
|
+
forwardRef,
|
|
6
|
+
useEffect,
|
|
7
|
+
useId,
|
|
8
|
+
useState
|
|
9
|
+
} from "react";
|
|
10
|
+
|
|
3
11
|
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
4
12
|
function r(e) {
|
|
5
13
|
var t, f, n = "";
|
|
@@ -25,6 +33,64 @@ function clsx() {
|
|
|
25
33
|
function cn(...inputs) {
|
|
26
34
|
return clsx(inputs);
|
|
27
35
|
}
|
|
36
|
+
// src/classes/tour.ts
|
|
37
|
+
var tourRootClass = "tour-root";
|
|
38
|
+
var tourOpenClass = "tour-open";
|
|
39
|
+
var tourMaskClass = "tour-mask";
|
|
40
|
+
var tourMaskHiddenClass = "tour-mask-hidden";
|
|
41
|
+
var tourTargetClass = "tour-target";
|
|
42
|
+
var tourPanelClass = "tour-panel popover";
|
|
43
|
+
var tourArrowClass = "tour-arrow popover-arrow";
|
|
44
|
+
var tourHeaderClass = "tour-header";
|
|
45
|
+
var tourTitleClass = "tour-title";
|
|
46
|
+
var tourCloseClass = "tour-close";
|
|
47
|
+
var tourBodyClass = "tour-body";
|
|
48
|
+
var tourCoverClass = "tour-cover";
|
|
49
|
+
var tourFooterClass = "tour-footer";
|
|
50
|
+
var tourIndicatorsClass = "tour-indicators";
|
|
51
|
+
var tourIndicatorClass = "tour-indicator";
|
|
52
|
+
var tourIndicatorActiveClass = "tour-indicator-active";
|
|
53
|
+
var tourActionsClass = "tour-actions";
|
|
54
|
+
var tourPlacementClasses = {
|
|
55
|
+
top: "popover-top tour-top",
|
|
56
|
+
bottom: "popover-bottom tour-bottom",
|
|
57
|
+
left: "popover-left tour-left",
|
|
58
|
+
right: "popover-right tour-right",
|
|
59
|
+
topLeft: "popover-top tour-top-left",
|
|
60
|
+
topRight: "popover-top tour-top-right",
|
|
61
|
+
bottomLeft: "popover-bottom tour-bottom-left",
|
|
62
|
+
bottomRight: "popover-bottom tour-bottom-right",
|
|
63
|
+
leftTop: "popover-left tour-left-top",
|
|
64
|
+
leftBottom: "popover-left tour-left-bottom",
|
|
65
|
+
rightTop: "popover-right tour-right-top",
|
|
66
|
+
rightBottom: "popover-right tour-right-bottom"
|
|
67
|
+
};
|
|
68
|
+
function getTourRootClasses({
|
|
69
|
+
open,
|
|
70
|
+
className
|
|
71
|
+
}) {
|
|
72
|
+
return cn(tourRootClass, open && tourOpenClass, className);
|
|
73
|
+
}
|
|
74
|
+
function getTourMaskClasses({
|
|
75
|
+
visible,
|
|
76
|
+
className
|
|
77
|
+
}) {
|
|
78
|
+
return cn(tourMaskClass, !visible && tourMaskHiddenClass, className);
|
|
79
|
+
}
|
|
80
|
+
function getTourPanelClasses({
|
|
81
|
+
placement = "bottom",
|
|
82
|
+
className
|
|
83
|
+
}) {
|
|
84
|
+
return cn(tourPanelClass, "popover-show", tourPlacementClasses[placement], className);
|
|
85
|
+
}
|
|
86
|
+
function getTourIndicatorClasses({ active }) {
|
|
87
|
+
return cn(tourIndicatorClass, active && tourIndicatorActiveClass);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/components/button/Button.tsx
|
|
91
|
+
import React from "react";
|
|
92
|
+
import { createPortal } from "react-dom";
|
|
93
|
+
|
|
28
94
|
// src/classes/button.ts
|
|
29
95
|
var buttonBaseClass = "btn";
|
|
30
96
|
var buttonColorClasses = {
|
|
@@ -48,7 +114,7 @@ var buttonAppearanceClasses = {
|
|
|
48
114
|
};
|
|
49
115
|
var buttonShapeClasses = {
|
|
50
116
|
rect: "",
|
|
51
|
-
circle: "btn-circle",
|
|
117
|
+
circle: "btn-circle btn-icon",
|
|
52
118
|
square: "btn-square"
|
|
53
119
|
};
|
|
54
120
|
var buttonSizeClasses = {
|
|
@@ -68,11 +134,14 @@ function getButtonClasses({
|
|
|
68
134
|
isLoading,
|
|
69
135
|
className
|
|
70
136
|
}) {
|
|
71
|
-
return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
|
|
137
|
+
return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], shape === "circle" && size === "xs" && "btn-icon-sm", shape === "circle" && size === "sm" && "btn-icon-sm", shape === "circle" && size === "lg" && "btn-icon-lg", block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
|
|
72
138
|
}
|
|
73
139
|
|
|
74
140
|
// src/components/button/Button.tsx
|
|
75
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
141
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
142
|
+
function isPromiseLike(value) {
|
|
143
|
+
return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
144
|
+
}
|
|
76
145
|
function Button({
|
|
77
146
|
color = "primary",
|
|
78
147
|
appearance = "filled",
|
|
@@ -86,8 +155,155 @@ function Button({
|
|
|
86
155
|
children,
|
|
87
156
|
disabled,
|
|
88
157
|
ref,
|
|
158
|
+
confirm,
|
|
159
|
+
onClick,
|
|
89
160
|
...props
|
|
90
161
|
}) {
|
|
162
|
+
const buttonRef = React.useRef(null);
|
|
163
|
+
const popoverRef = React.useRef(null);
|
|
164
|
+
const cancelRef = React.useRef(null);
|
|
165
|
+
const approvalRef = React.useRef("idle");
|
|
166
|
+
const pendingRef = React.useRef(false);
|
|
167
|
+
const actionRef = React.useRef(0);
|
|
168
|
+
const operationRef = React.useRef(0);
|
|
169
|
+
const mountedRef = React.useRef(false);
|
|
170
|
+
const [portalTarget, setPortalTarget] = React.useState(null);
|
|
171
|
+
const [confirmLoading, setConfirmLoading] = React.useState(false);
|
|
172
|
+
const [confirmError, setConfirmError] = React.useState(false);
|
|
173
|
+
const generatedId = React.useId().replace(/:/g, "");
|
|
174
|
+
const popoverId = `button-confirm-${generatedId}`;
|
|
175
|
+
const titleId = `${popoverId}-title`;
|
|
176
|
+
const descriptionId = `${popoverId}-description`;
|
|
177
|
+
const anchor = `--${popoverId}-anchor`;
|
|
178
|
+
const hasConfirm = Boolean(confirm);
|
|
179
|
+
const confirmation = confirm && typeof confirm === "object" ? confirm : undefined;
|
|
180
|
+
const title = confirmation ? confirmation.title : "Confirm action";
|
|
181
|
+
const hasTitle = title !== undefined && title !== null && title !== false && title !== "";
|
|
182
|
+
const content = confirmation?.component ?? confirmation?.message ?? confirmation?.description;
|
|
183
|
+
const hasContent = content !== undefined && content !== null && content !== false && content !== "";
|
|
184
|
+
const mergedRef = React.useCallback((node) => {
|
|
185
|
+
buttonRef.current = node;
|
|
186
|
+
if (!node) {
|
|
187
|
+
if (typeof ref === "function")
|
|
188
|
+
ref(null);
|
|
189
|
+
else if (ref)
|
|
190
|
+
ref.current = null;
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const cleanup = typeof ref === "function" ? ref(node) : undefined;
|
|
194
|
+
if (ref && typeof ref !== "function")
|
|
195
|
+
ref.current = node;
|
|
196
|
+
return () => {
|
|
197
|
+
buttonRef.current = null;
|
|
198
|
+
if (typeof cleanup === "function")
|
|
199
|
+
cleanup();
|
|
200
|
+
else if (typeof ref === "function")
|
|
201
|
+
ref(null);
|
|
202
|
+
else if (ref)
|
|
203
|
+
ref.current = null;
|
|
204
|
+
};
|
|
205
|
+
}, [ref]);
|
|
206
|
+
React.useEffect(() => {
|
|
207
|
+
mountedRef.current = true;
|
|
208
|
+
return () => {
|
|
209
|
+
mountedRef.current = false;
|
|
210
|
+
operationRef.current += 1;
|
|
211
|
+
};
|
|
212
|
+
}, []);
|
|
213
|
+
React.useEffect(() => {
|
|
214
|
+
operationRef.current += 1;
|
|
215
|
+
approvalRef.current = "idle";
|
|
216
|
+
setConfirmError(false);
|
|
217
|
+
setPortalTarget(hasConfirm ? document.body : null);
|
|
218
|
+
}, [hasConfirm]);
|
|
219
|
+
function closePopover() {
|
|
220
|
+
if (popoverRef.current?.matches(":popover-open")) {
|
|
221
|
+
popoverRef.current.hidePopover();
|
|
222
|
+
}
|
|
223
|
+
buttonRef.current?.focus();
|
|
224
|
+
}
|
|
225
|
+
function handleClick(event) {
|
|
226
|
+
if (!confirm) {
|
|
227
|
+
onClick?.(event);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (approvalRef.current === "native") {
|
|
231
|
+
approvalRef.current = "idle";
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (approvalRef.current === "action") {
|
|
235
|
+
approvalRef.current = "idle";
|
|
236
|
+
let result;
|
|
237
|
+
try {
|
|
238
|
+
result = onClick?.(event);
|
|
239
|
+
} catch {
|
|
240
|
+
event.preventDefault();
|
|
241
|
+
pendingRef.current = false;
|
|
242
|
+
setConfirmError(true);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (!isPromiseLike(result)) {
|
|
246
|
+
pendingRef.current = false;
|
|
247
|
+
closePopover();
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const userPreventedDefault = event.defaultPrevented;
|
|
251
|
+
event.preventDefault();
|
|
252
|
+
setConfirmLoading(true);
|
|
253
|
+
const action = actionRef.current;
|
|
254
|
+
const operation = operationRef.current;
|
|
255
|
+
Promise.resolve(result).then(() => {
|
|
256
|
+
if (!mountedRef.current || action !== actionRef.current)
|
|
257
|
+
return;
|
|
258
|
+
pendingRef.current = false;
|
|
259
|
+
setConfirmLoading(false);
|
|
260
|
+
if (operation !== operationRef.current)
|
|
261
|
+
return;
|
|
262
|
+
closePopover();
|
|
263
|
+
if (!userPreventedDefault && !buttonRef.current?.disabled) {
|
|
264
|
+
approvalRef.current = "native";
|
|
265
|
+
buttonRef.current?.click();
|
|
266
|
+
approvalRef.current = "idle";
|
|
267
|
+
}
|
|
268
|
+
}, () => {
|
|
269
|
+
if (!mountedRef.current || action !== actionRef.current)
|
|
270
|
+
return;
|
|
271
|
+
pendingRef.current = false;
|
|
272
|
+
setConfirmLoading(false);
|
|
273
|
+
if (operation !== operationRef.current)
|
|
274
|
+
return;
|
|
275
|
+
setConfirmError(true);
|
|
276
|
+
cancelRef.current?.focus();
|
|
277
|
+
});
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
event.preventDefault();
|
|
281
|
+
if (disabled || isLoading || pendingRef.current)
|
|
282
|
+
return;
|
|
283
|
+
if (popoverRef.current?.matches(":popover-open")) {
|
|
284
|
+
closePopover();
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
setConfirmError(false);
|
|
288
|
+
popoverRef.current?.showPopover();
|
|
289
|
+
cancelRef.current?.focus();
|
|
290
|
+
}
|
|
291
|
+
function handleConfirm(event) {
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
event.stopPropagation();
|
|
294
|
+
const trigger = buttonRef.current;
|
|
295
|
+
if (disabled || isLoading || pendingRef.current || !trigger || trigger.disabled || !event.currentTarget.matches(":popover-open"))
|
|
296
|
+
return;
|
|
297
|
+
setConfirmError(false);
|
|
298
|
+
pendingRef.current = true;
|
|
299
|
+
actionRef.current += 1;
|
|
300
|
+
approvalRef.current = "action";
|
|
301
|
+
trigger.click();
|
|
302
|
+
if (approvalRef.current === "action") {
|
|
303
|
+
approvalRef.current = "idle";
|
|
304
|
+
pendingRef.current = false;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
91
307
|
const classes = getButtonClasses({
|
|
92
308
|
color,
|
|
93
309
|
appearance,
|
|
@@ -97,94 +313,107 @@ function Button({
|
|
|
97
313
|
isLoading,
|
|
98
314
|
className
|
|
99
315
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
...props,
|
|
316
|
+
const confirmClasses = getButtonClasses({
|
|
317
|
+
color,
|
|
318
|
+
size: "sm",
|
|
319
|
+
isLoading: confirmLoading
|
|
320
|
+
});
|
|
321
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
107
322
|
children: [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
323
|
+
/* @__PURE__ */ jsxs("button", {
|
|
324
|
+
ref: confirm ? mergedRef : ref,
|
|
325
|
+
className: classes,
|
|
326
|
+
disabled: disabled || isLoading,
|
|
327
|
+
"aria-busy": isLoading,
|
|
328
|
+
"aria-disabled": disabled || isLoading,
|
|
329
|
+
...props,
|
|
330
|
+
style: confirm ? { ...props.style, anchorName: anchor } : props.style,
|
|
331
|
+
"aria-haspopup": confirm ? "dialog" : props["aria-haspopup"],
|
|
332
|
+
"aria-controls": confirm ? popoverId : props["aria-controls"],
|
|
333
|
+
onClick: confirm ? handleClick : onClick,
|
|
334
|
+
children: [
|
|
335
|
+
isLoading && /* @__PURE__ */ jsx("span", {
|
|
336
|
+
className: "btn-spinner"
|
|
337
|
+
}),
|
|
338
|
+
!isLoading && leftIcon && /* @__PURE__ */ jsx("span", {
|
|
339
|
+
className: "btn-icon-left",
|
|
340
|
+
children: leftIcon
|
|
341
|
+
}),
|
|
342
|
+
/* @__PURE__ */ jsx("span", {
|
|
343
|
+
className: "btn-content",
|
|
344
|
+
children
|
|
345
|
+
}),
|
|
346
|
+
!isLoading && rightIcon && /* @__PURE__ */ jsx("span", {
|
|
347
|
+
className: "btn-icon-right",
|
|
348
|
+
children: rightIcon
|
|
349
|
+
})
|
|
350
|
+
]
|
|
118
351
|
}),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
352
|
+
confirm && portalTarget && createPortal(/* @__PURE__ */ jsxs("form", {
|
|
353
|
+
id: popoverId,
|
|
354
|
+
ref: popoverRef,
|
|
355
|
+
popover: "auto",
|
|
356
|
+
role: "dialog",
|
|
357
|
+
"aria-labelledby": hasTitle ? titleId : undefined,
|
|
358
|
+
"aria-label": hasTitle ? undefined : "Confirm action",
|
|
359
|
+
"aria-describedby": hasContent ? descriptionId : undefined,
|
|
360
|
+
className: "popover popover-confirm popover-bottom",
|
|
361
|
+
style: { positionAnchor: anchor },
|
|
362
|
+
onSubmit: handleConfirm,
|
|
363
|
+
onClick: (event) => event.stopPropagation(),
|
|
364
|
+
onToggle: (event) => {
|
|
365
|
+
if (!event.currentTarget.matches(":popover-open")) {
|
|
366
|
+
operationRef.current += 1;
|
|
367
|
+
if (event.currentTarget.contains(document.activeElement) || document.activeElement === document.body) {
|
|
368
|
+
buttonRef.current?.focus();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
children: [
|
|
373
|
+
hasTitle && /* @__PURE__ */ jsx("div", {
|
|
374
|
+
className: "popover-header",
|
|
375
|
+
children: /* @__PURE__ */ jsx("h3", {
|
|
376
|
+
id: titleId,
|
|
377
|
+
className: "popover-title",
|
|
378
|
+
children: title
|
|
379
|
+
})
|
|
380
|
+
}),
|
|
381
|
+
hasContent && /* @__PURE__ */ jsx("div", {
|
|
382
|
+
id: descriptionId,
|
|
383
|
+
className: "popover-body",
|
|
384
|
+
children: content
|
|
385
|
+
}),
|
|
386
|
+
confirmError && /* @__PURE__ */ jsx("div", {
|
|
387
|
+
role: "alert",
|
|
388
|
+
className: "popover-body",
|
|
389
|
+
children: "The action failed. Please try again."
|
|
390
|
+
}),
|
|
391
|
+
/* @__PURE__ */ jsxs("div", {
|
|
392
|
+
className: "popover-footer",
|
|
393
|
+
children: [
|
|
394
|
+
/* @__PURE__ */ jsx("button", {
|
|
395
|
+
ref: cancelRef,
|
|
396
|
+
type: "button",
|
|
397
|
+
className: "btn btn-text btn-sm",
|
|
398
|
+
popoverTarget: popoverId,
|
|
399
|
+
popoverTargetAction: "hide",
|
|
400
|
+
disabled: confirmLoading,
|
|
401
|
+
children: confirmation?.cancelText ?? "Cancel"
|
|
402
|
+
}),
|
|
403
|
+
/* @__PURE__ */ jsx("button", {
|
|
404
|
+
type: "submit",
|
|
405
|
+
className: confirmClasses,
|
|
406
|
+
disabled: disabled || isLoading || confirmLoading,
|
|
407
|
+
"aria-busy": confirmLoading,
|
|
408
|
+
children: confirmation?.confirmText ?? "Confirm"
|
|
409
|
+
})
|
|
410
|
+
]
|
|
411
|
+
})
|
|
412
|
+
]
|
|
413
|
+
}), portalTarget)
|
|
123
414
|
]
|
|
124
415
|
});
|
|
125
416
|
}
|
|
126
|
-
// src/components/tour/Tour.tsx
|
|
127
|
-
import {
|
|
128
|
-
forwardRef,
|
|
129
|
-
useEffect,
|
|
130
|
-
useId,
|
|
131
|
-
useState
|
|
132
|
-
} from "react";
|
|
133
|
-
|
|
134
|
-
// src/classes/tour.ts
|
|
135
|
-
var tourRootClass = "tour-root";
|
|
136
|
-
var tourOpenClass = "tour-open";
|
|
137
|
-
var tourMaskClass = "tour-mask";
|
|
138
|
-
var tourMaskHiddenClass = "tour-mask-hidden";
|
|
139
|
-
var tourTargetClass = "tour-target";
|
|
140
|
-
var tourPanelClass = "tour-panel popover";
|
|
141
|
-
var tourArrowClass = "tour-arrow popover-arrow";
|
|
142
|
-
var tourHeaderClass = "tour-header";
|
|
143
|
-
var tourTitleClass = "tour-title";
|
|
144
|
-
var tourCloseClass = "tour-close";
|
|
145
|
-
var tourBodyClass = "tour-body";
|
|
146
|
-
var tourCoverClass = "tour-cover";
|
|
147
|
-
var tourFooterClass = "tour-footer";
|
|
148
|
-
var tourIndicatorsClass = "tour-indicators";
|
|
149
|
-
var tourIndicatorClass = "tour-indicator";
|
|
150
|
-
var tourIndicatorActiveClass = "tour-indicator-active";
|
|
151
|
-
var tourActionsClass = "tour-actions";
|
|
152
|
-
var tourPlacementClasses = {
|
|
153
|
-
top: "popover-top tour-top",
|
|
154
|
-
bottom: "popover-bottom tour-bottom",
|
|
155
|
-
left: "popover-left tour-left",
|
|
156
|
-
right: "popover-right tour-right",
|
|
157
|
-
topLeft: "popover-top tour-top-left",
|
|
158
|
-
topRight: "popover-top tour-top-right",
|
|
159
|
-
bottomLeft: "popover-bottom tour-bottom-left",
|
|
160
|
-
bottomRight: "popover-bottom tour-bottom-right",
|
|
161
|
-
leftTop: "popover-left tour-left-top",
|
|
162
|
-
leftBottom: "popover-left tour-left-bottom",
|
|
163
|
-
rightTop: "popover-right tour-right-top",
|
|
164
|
-
rightBottom: "popover-right tour-right-bottom"
|
|
165
|
-
};
|
|
166
|
-
function getTourRootClasses({
|
|
167
|
-
open,
|
|
168
|
-
className
|
|
169
|
-
}) {
|
|
170
|
-
return cn(tourRootClass, open && tourOpenClass, className);
|
|
171
|
-
}
|
|
172
|
-
function getTourMaskClasses({
|
|
173
|
-
visible,
|
|
174
|
-
className
|
|
175
|
-
}) {
|
|
176
|
-
return cn(tourMaskClass, !visible && tourMaskHiddenClass, className);
|
|
177
|
-
}
|
|
178
|
-
function getTourPanelClasses({
|
|
179
|
-
placement = "bottom",
|
|
180
|
-
className
|
|
181
|
-
}) {
|
|
182
|
-
return cn(tourPanelClass, "popover-show", tourPlacementClasses[placement], className);
|
|
183
|
-
}
|
|
184
|
-
function getTourIndicatorClasses({ active }) {
|
|
185
|
-
return cn(tourIndicatorClass, active && tourIndicatorActiveClass);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
417
|
// src/components/tour/Tour.tsx
|
|
189
418
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
190
419
|
var defaultCloseIcon = "x";
|
|
@@ -34,36 +34,36 @@ var treeSelectBaseClass = "tree-select";
|
|
|
34
34
|
var treeSelectOpenClass = "tree-select-open";
|
|
35
35
|
var treeSelectDisabledClass = "tree-select-disabled";
|
|
36
36
|
var treeSelectMultipleClass = "tree-select-multiple";
|
|
37
|
-
var treeSelectSelectionClass = "tree-select-selection";
|
|
37
|
+
var treeSelectSelectionClass = "tree-select-selection tree-select-value";
|
|
38
38
|
var treeSelectPlaceholderClass = "tree-select-placeholder";
|
|
39
39
|
var treeSelectTagClass = "tree-select-tag";
|
|
40
40
|
var treeSelectClearClass = "tree-select-clear";
|
|
41
|
-
var treeSelectIconClass = "tree-select-icon";
|
|
41
|
+
var treeSelectIconClass = "tree-select-icon tree-select-arrow";
|
|
42
42
|
var treeSelectDropdownClass = "tree-select-dropdown";
|
|
43
|
-
var treeSelectSearchClass = "tree-select-search";
|
|
44
|
-
var treeSelectListClass = "tree-select-list";
|
|
43
|
+
var treeSelectSearchClass = "tree-select-search-input";
|
|
44
|
+
var treeSelectListClass = "tree-select-list tree-select-options";
|
|
45
45
|
var treeSelectEmptyClass = "tree-select-empty";
|
|
46
46
|
var treeSelectNodeClass = "tree-select-node";
|
|
47
47
|
var treeSelectNodeSelectedClass = "tree-select-node-selected";
|
|
48
48
|
var treeSelectNodeCheckedClass = "tree-select-node-checked";
|
|
49
49
|
var treeSelectNodeExpandedClass = "tree-select-node-expanded";
|
|
50
50
|
var treeSelectNodeDisabledClass = "tree-select-node-disabled";
|
|
51
|
-
var treeSelectSwitcherClass = "tree-select-switcher";
|
|
51
|
+
var treeSelectSwitcherClass = "tree-select-switcher tree-select-node-toggle";
|
|
52
52
|
var treeSelectCheckboxClass = "tree-select-checkbox";
|
|
53
|
-
var treeSelectTitleClass = "tree-select-title";
|
|
53
|
+
var treeSelectTitleClass = "tree-select-title tree-select-node-label";
|
|
54
54
|
function getTreeSelectContainerClasses({
|
|
55
55
|
open,
|
|
56
56
|
disabled,
|
|
57
57
|
multiple,
|
|
58
58
|
className
|
|
59
59
|
}) {
|
|
60
|
-
return cn(treeSelectContainerClass, open && treeSelectOpenClass, disabled && treeSelectDisabledClass, multiple && treeSelectMultipleClass, className);
|
|
60
|
+
return cn(treeSelectContainerClass, treeSelectBaseClass, open && treeSelectOpenClass, disabled && treeSelectDisabledClass, multiple && treeSelectMultipleClass, className);
|
|
61
61
|
}
|
|
62
62
|
function getTreeSelectClasses({
|
|
63
63
|
disabled,
|
|
64
64
|
className
|
|
65
65
|
}) {
|
|
66
|
-
return cn(
|
|
66
|
+
return cn("tree-select-trigger", disabled && treeSelectDisabledClass, className);
|
|
67
67
|
}
|
|
68
68
|
function getTreeSelectNodeClasses({
|
|
69
69
|
selected,
|
|
@@ -34,6 +34,7 @@ export interface UploadRequestOption<T = unknown> {
|
|
|
34
34
|
export type UploadBeforeUploadResult = boolean | File | Blob | UploadListIgnore | Promise<boolean | File | Blob | UploadListIgnore>;
|
|
35
35
|
export type UploadListIgnore = symbol;
|
|
36
36
|
export interface UploadProps extends Omit<ComponentProps<"div">, "children" | "defaultValue" | "onChange"> {
|
|
37
|
+
inputProps?: ComponentProps<"input">;
|
|
37
38
|
accept?: string;
|
|
38
39
|
action?: string;
|
|
39
40
|
beforeUpload?: (file: File, fileList: File[]) => UploadBeforeUploadResult;
|
|
@@ -118,6 +118,7 @@ function UploadRoot({
|
|
|
118
118
|
disabled,
|
|
119
119
|
fileList,
|
|
120
120
|
listType = "text",
|
|
121
|
+
inputProps,
|
|
121
122
|
multiple,
|
|
122
123
|
onChange,
|
|
123
124
|
onPreview,
|
|
@@ -185,12 +186,12 @@ function UploadRoot({
|
|
|
185
186
|
}
|
|
186
187
|
const uploadFile = fileToUploadFile(sourceFile);
|
|
187
188
|
if (result === false) {
|
|
188
|
-
const
|
|
189
|
+
const nextFile = {
|
|
189
190
|
...uploadFile,
|
|
190
191
|
status: undefined,
|
|
191
192
|
percent: undefined
|
|
192
193
|
};
|
|
193
|
-
commitFileList([...currentFileListRef.current,
|
|
194
|
+
commitFileList([...currentFileListRef.current, nextFile], nextFile);
|
|
194
195
|
continue;
|
|
195
196
|
}
|
|
196
197
|
if (result instanceof File) {
|
|
@@ -200,9 +201,9 @@ function UploadRoot({
|
|
|
200
201
|
type: result.type || sourceFile.type
|
|
201
202
|
});
|
|
202
203
|
}
|
|
203
|
-
const
|
|
204
|
-
commitFileList([...currentFileListRef.current,
|
|
205
|
-
startRequest(
|
|
204
|
+
const nextFile = fileToUploadFile(uploadSource);
|
|
205
|
+
commitFileList([...currentFileListRef.current, nextFile], nextFile);
|
|
206
|
+
startRequest(nextFile, uploadSource);
|
|
206
207
|
continue;
|
|
207
208
|
}
|
|
208
209
|
const nextFile = fileToUploadFile(uploadSource);
|
|
@@ -302,6 +303,7 @@ function UploadRoot({
|
|
|
302
303
|
}),
|
|
303
304
|
children: [
|
|
304
305
|
/* @__PURE__ */ jsx("input", {
|
|
306
|
+
...inputProps,
|
|
305
307
|
ref: inputRef,
|
|
306
308
|
className: uploadInputClass,
|
|
307
309
|
type: "file",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.4.0";
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export type { Breakpoint } from "./components/grid";
|
|
|
8
8
|
export * from "./components/button";
|
|
9
9
|
export * from "./components/calendar";
|
|
10
10
|
export * from "./components/card";
|
|
11
|
+
export * from "./components/chat";
|
|
12
|
+
export * from "./components/console-page";
|
|
11
13
|
export * from "./components/carousel";
|
|
12
14
|
export * from "./components/cascader";
|
|
13
15
|
export * from "./components/badge";
|
|
@@ -53,6 +55,7 @@ export * from "./components/dropdown";
|
|
|
53
55
|
export * from "./components/empty";
|
|
54
56
|
export * from "./components/flex";
|
|
55
57
|
export * from "./components/float-button";
|
|
58
|
+
export * from "./components/fab";
|
|
56
59
|
export * from "./components/form";
|
|
57
60
|
export * from "./components/grid";
|
|
58
61
|
export * from "./components/image";
|
|
@@ -62,9 +65,11 @@ export * from "./components/layout";
|
|
|
62
65
|
export * from "./components/list";
|
|
63
66
|
export * from "./components/mentions";
|
|
64
67
|
export * from "./components/menu";
|
|
68
|
+
export * from "./components/megamenu";
|
|
65
69
|
export * from "./components/message";
|
|
66
70
|
export * from "./components/modal";
|
|
67
71
|
export * from "./components/notification";
|
|
72
|
+
export * from "./components/otp-input";
|
|
68
73
|
export * from "./components/pagination";
|
|
69
74
|
export * from "./components/popover";
|
|
70
75
|
export * from "./components/popconfirm";
|
|
@@ -84,6 +89,7 @@ export * from "./components/splitter";
|
|
|
84
89
|
export * from "./components/statistic";
|
|
85
90
|
export * from "./components/steps";
|
|
86
91
|
export * from "./components/switch";
|
|
92
|
+
export * from "./components/swap";
|
|
87
93
|
export * from "./components/tabs";
|
|
88
94
|
export * from "./components/tag";
|
|
89
95
|
export * from "./components/table";
|