@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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const megamenuClass = "megamenu";
|
|
2
|
+
export declare const megamenuBarClass = "megamenu-bar";
|
|
3
|
+
export declare const megamenuItemClass = "megamenu-item";
|
|
4
|
+
export declare const megamenuTriggerClass = "megamenu-trigger";
|
|
5
|
+
export declare const megamenuPanelClass = "megamenu-panel";
|
|
6
|
+
export declare const megamenuGridClass = "megamenu-grid";
|
|
7
|
+
export declare const megamenuGroupClass = "megamenu-group";
|
|
8
|
+
export declare const megamenuHeadingClass = "megamenu-heading";
|
|
9
|
+
export declare const megamenuSupportingClass = "megamenu-supporting";
|
|
10
|
+
export declare const megamenuMobileClass = "megamenu-mobile";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OtpInputColor, OtpInputSize, OtpInputVariant } from "../components/otp-input/OtpInput.types";
|
|
2
|
+
export declare const otpInputBaseClass = "otp-input";
|
|
3
|
+
export declare const otpInputCodeClass = "otp-code";
|
|
4
|
+
export declare function getOtpInputClasses({ size, variant, color, wrapperClassName, }: {
|
|
5
|
+
size?: OtpInputSize;
|
|
6
|
+
variant?: OtpInputVariant;
|
|
7
|
+
color?: OtpInputColor;
|
|
8
|
+
wrapperClassName?: string;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function getOtpInputCodeClasses({ className }: {
|
|
11
|
+
className?: string;
|
|
12
|
+
}): string;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { PopoverPlacement } from "../components/popover/Popover.types";
|
|
2
2
|
export declare const popoverWrapperClass = "popover-wrapper";
|
|
3
3
|
export declare const popoverBaseClass = "popover";
|
|
4
|
-
export declare const popoverShowClass = "popover-show";
|
|
5
4
|
export declare const popoverArrowClass = "popover-arrow";
|
|
6
5
|
export declare const popoverNoArrowClass = "popover-no-arrow";
|
|
7
6
|
export declare const popoverPlacementClasses: Record<PopoverPlacement, string>;
|
|
8
|
-
export declare function getPopoverClasses({ placement,
|
|
7
|
+
export declare function getPopoverClasses({ placement, arrow, className, }: {
|
|
9
8
|
placement?: PopoverPlacement;
|
|
10
|
-
open?: boolean;
|
|
11
9
|
arrow?: boolean;
|
|
12
10
|
className?: string;
|
|
13
11
|
}): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const swapBaseClass = "swap";
|
|
2
|
+
export declare const swapInputClass = "swap-input";
|
|
3
|
+
export declare const swapOffClass = "swap-off";
|
|
4
|
+
export declare const swapOnClass = "swap-on";
|
|
5
|
+
export declare const swapRotateClass = "swap-rotate";
|
|
6
|
+
export declare function getSwapClasses({ rotate, wrapperClassName, }: {
|
|
7
|
+
rotate?: boolean;
|
|
8
|
+
wrapperClassName?: string;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function getSwapInputClasses({ className }: {
|
|
11
|
+
className?: string;
|
|
12
|
+
}): string;
|
|
@@ -3,23 +3,23 @@ export declare const treeSelectBaseClass = "tree-select";
|
|
|
3
3
|
export declare const treeSelectOpenClass = "tree-select-open";
|
|
4
4
|
export declare const treeSelectDisabledClass = "tree-select-disabled";
|
|
5
5
|
export declare const treeSelectMultipleClass = "tree-select-multiple";
|
|
6
|
-
export declare const treeSelectSelectionClass = "tree-select-selection";
|
|
6
|
+
export declare const treeSelectSelectionClass = "tree-select-selection tree-select-value";
|
|
7
7
|
export declare const treeSelectPlaceholderClass = "tree-select-placeholder";
|
|
8
8
|
export declare const treeSelectTagClass = "tree-select-tag";
|
|
9
9
|
export declare const treeSelectClearClass = "tree-select-clear";
|
|
10
|
-
export declare const treeSelectIconClass = "tree-select-icon";
|
|
10
|
+
export declare const treeSelectIconClass = "tree-select-icon tree-select-arrow";
|
|
11
11
|
export declare const treeSelectDropdownClass = "tree-select-dropdown";
|
|
12
|
-
export declare const treeSelectSearchClass = "tree-select-search";
|
|
13
|
-
export declare const treeSelectListClass = "tree-select-list";
|
|
12
|
+
export declare const treeSelectSearchClass = "tree-select-search-input";
|
|
13
|
+
export declare const treeSelectListClass = "tree-select-list tree-select-options";
|
|
14
14
|
export declare const treeSelectEmptyClass = "tree-select-empty";
|
|
15
15
|
export declare const treeSelectNodeClass = "tree-select-node";
|
|
16
16
|
export declare const treeSelectNodeSelectedClass = "tree-select-node-selected";
|
|
17
17
|
export declare const treeSelectNodeCheckedClass = "tree-select-node-checked";
|
|
18
18
|
export declare const treeSelectNodeExpandedClass = "tree-select-node-expanded";
|
|
19
19
|
export declare const treeSelectNodeDisabledClass = "tree-select-node-disabled";
|
|
20
|
-
export declare const treeSelectSwitcherClass = "tree-select-switcher";
|
|
20
|
+
export declare const treeSelectSwitcherClass = "tree-select-switcher tree-select-node-toggle";
|
|
21
21
|
export declare const treeSelectCheckboxClass = "tree-select-checkbox";
|
|
22
|
-
export declare const treeSelectTitleClass = "tree-select-title";
|
|
22
|
+
export declare const treeSelectTitleClass = "tree-select-title tree-select-node-label";
|
|
23
23
|
export declare function getTreeSelectContainerClasses({ open, disabled, multiple, className, }: {
|
|
24
24
|
open?: boolean;
|
|
25
25
|
disabled?: boolean;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/components/
|
|
4
|
-
import
|
|
3
|
+
// src/components/app/App.tsx
|
|
4
|
+
import {
|
|
5
|
+
createContext,
|
|
6
|
+
forwardRef as forwardRef2,
|
|
7
|
+
useContext,
|
|
8
|
+
useEffect as useEffect3,
|
|
9
|
+
useMemo as useMemo2
|
|
10
|
+
} from "react";
|
|
5
11
|
|
|
6
12
|
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
7
13
|
function r(e) {
|
|
@@ -28,6 +34,20 @@ function clsx() {
|
|
|
28
34
|
function cn(...inputs) {
|
|
29
35
|
return clsx(inputs);
|
|
30
36
|
}
|
|
37
|
+
// src/classes/app.ts
|
|
38
|
+
var appClass = "app";
|
|
39
|
+
var appRootClass = "app-root";
|
|
40
|
+
var appHolderClass = "app-holder";
|
|
41
|
+
function getAppClasses({ className }) {
|
|
42
|
+
return cn(appClass, className);
|
|
43
|
+
}
|
|
44
|
+
function getAppRootClasses({ className }) {
|
|
45
|
+
return cn(appRootClass, className);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/components/message/Message.tsx
|
|
49
|
+
import React, { useSyncExternalStore } from "react";
|
|
50
|
+
|
|
31
51
|
// src/classes/message.ts
|
|
32
52
|
var messageHolderClass = "message-holder";
|
|
33
53
|
var messageBaseClass = "message";
|
|
@@ -154,13 +174,13 @@ function config(nextConfig) {
|
|
|
154
174
|
emit();
|
|
155
175
|
}
|
|
156
176
|
function MessageHolder({ className }) {
|
|
157
|
-
const
|
|
177
|
+
const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
158
178
|
return /* @__PURE__ */ jsx("div", {
|
|
159
179
|
className: getMessageHolderClasses({
|
|
160
|
-
placement:
|
|
180
|
+
placement: snapshot.config.placement,
|
|
161
181
|
className
|
|
162
182
|
}),
|
|
163
|
-
children:
|
|
183
|
+
children: snapshot.messages.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
164
184
|
className: getMessageClasses({
|
|
165
185
|
type: item.type,
|
|
166
186
|
className: item.className
|
|
@@ -204,27 +224,18 @@ import {
|
|
|
204
224
|
forwardRef,
|
|
205
225
|
useCallback,
|
|
206
226
|
useEffect,
|
|
227
|
+
useId,
|
|
207
228
|
useRef,
|
|
208
229
|
useState
|
|
209
230
|
} from "react";
|
|
210
231
|
|
|
211
232
|
// src/classes/modal.ts
|
|
212
|
-
var modalBackdropClass = "modal-backdrop";
|
|
213
|
-
var modalOpenClass = "modal-open";
|
|
214
|
-
var modalBackdropCenterClass = "modal-backdrop-center";
|
|
215
233
|
var modalClass = "modal";
|
|
216
234
|
var modalHeaderClass = "modal-header";
|
|
217
235
|
var modalTitleClass = "modal-title";
|
|
218
236
|
var modalCloseClass = "modal-close";
|
|
219
237
|
var modalBodyClass = "modal-body";
|
|
220
238
|
var modalFooterClass = "modal-footer";
|
|
221
|
-
function getModalBackdropClasses({
|
|
222
|
-
open: open2,
|
|
223
|
-
centered,
|
|
224
|
-
className
|
|
225
|
-
}) {
|
|
226
|
-
return cn(modalBackdropClass, open2 && modalOpenClass, centered && modalBackdropCenterClass, className);
|
|
227
|
-
}
|
|
228
239
|
function getModalClasses({ className }) {
|
|
229
240
|
return cn(modalClass, className);
|
|
230
241
|
}
|
|
@@ -233,8 +244,8 @@ function getModalClasses({ className }) {
|
|
|
233
244
|
import { jsx as jsx2, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
|
|
234
245
|
var defaultCloseIcon = "x";
|
|
235
246
|
var serviceHandles = new Set;
|
|
236
|
-
function createServiceHandle(
|
|
237
|
-
let currentConfig =
|
|
247
|
+
function createServiceHandle(config) {
|
|
248
|
+
let currentConfig = config;
|
|
238
249
|
const handle = {
|
|
239
250
|
destroy: () => {
|
|
240
251
|
serviceHandles.delete(handle);
|
|
@@ -255,8 +266,15 @@ function getModalStyle({
|
|
|
255
266
|
...width !== undefined ? { width } : undefined
|
|
256
267
|
};
|
|
257
268
|
}
|
|
269
|
+
function showNativeModal(dialog) {
|
|
270
|
+
if (!dialog.isConnected || dialog.matches(":modal"))
|
|
271
|
+
return;
|
|
272
|
+
if (dialog.open)
|
|
273
|
+
dialog.close();
|
|
274
|
+
dialog.showModal();
|
|
275
|
+
}
|
|
258
276
|
var ModalBase = forwardRef(({
|
|
259
|
-
open
|
|
277
|
+
open,
|
|
260
278
|
defaultOpen = false,
|
|
261
279
|
title,
|
|
262
280
|
children,
|
|
@@ -277,15 +295,41 @@ var ModalBase = forwardRef(({
|
|
|
277
295
|
maskClassName,
|
|
278
296
|
closeIcon = defaultCloseIcon,
|
|
279
297
|
style,
|
|
280
|
-
role
|
|
298
|
+
role,
|
|
281
299
|
...props
|
|
282
300
|
}, ref) => {
|
|
283
|
-
const controlled =
|
|
301
|
+
const controlled = open !== undefined;
|
|
284
302
|
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
285
|
-
const mergedOpen = controlled ? Boolean(
|
|
303
|
+
const mergedOpen = controlled ? Boolean(open) : innerOpen;
|
|
286
304
|
const previousOpen = useRef(mergedOpen);
|
|
305
|
+
const desiredOpen = useRef(mergedOpen);
|
|
306
|
+
desiredOpen.current = mergedOpen;
|
|
307
|
+
const dialogRef = useRef(null);
|
|
308
|
+
const cancelRequestRef = useRef(null);
|
|
309
|
+
const programmaticClose = useRef(false);
|
|
310
|
+
const titleId = useId();
|
|
311
|
+
const surfaceWidth = width ?? style?.width;
|
|
312
|
+
const callerNamed = props["aria-label"] != null || props["aria-labelledby"] != null;
|
|
287
313
|
const showClose = closable && closeIcon !== null && closeIcon !== false;
|
|
288
314
|
const body = children ?? content;
|
|
315
|
+
useEffect(() => {
|
|
316
|
+
const dialog = dialogRef.current;
|
|
317
|
+
if (!dialog)
|
|
318
|
+
return;
|
|
319
|
+
if (mergedOpen) {
|
|
320
|
+
programmaticClose.current = false;
|
|
321
|
+
showNativeModal(dialog);
|
|
322
|
+
} else if (dialog.open) {
|
|
323
|
+
programmaticClose.current = true;
|
|
324
|
+
dialog.close();
|
|
325
|
+
}
|
|
326
|
+
return () => {
|
|
327
|
+
if (dialog.open) {
|
|
328
|
+
programmaticClose.current = true;
|
|
329
|
+
dialog.close();
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
}, [mergedOpen]);
|
|
289
333
|
useEffect(() => {
|
|
290
334
|
if (previousOpen.current === mergedOpen) {
|
|
291
335
|
return;
|
|
@@ -302,73 +346,109 @@ var ModalBase = forwardRef(({
|
|
|
302
346
|
const handleOk = useCallback((event) => {
|
|
303
347
|
onOk?.(event);
|
|
304
348
|
}, [onOk]);
|
|
305
|
-
const
|
|
306
|
-
|
|
349
|
+
const requestCancel = useCallback(() => {
|
|
350
|
+
cancelRequestRef.current?.click();
|
|
351
|
+
}, []);
|
|
352
|
+
const handleNativeClose = useCallback(() => {
|
|
353
|
+
const dialog = dialogRef.current;
|
|
354
|
+
if (!dialog || dialog.open || programmaticClose.current) {
|
|
355
|
+
programmaticClose.current = false;
|
|
307
356
|
return;
|
|
308
357
|
}
|
|
309
|
-
|
|
310
|
-
|
|
358
|
+
if (desiredOpen.current) {
|
|
359
|
+
requestCancel();
|
|
360
|
+
if (controlled) {
|
|
361
|
+
queueMicrotask(() => {
|
|
362
|
+
if (desiredOpen.current) {
|
|
363
|
+
showNativeModal(dialog);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}, [controlled, requestCancel]);
|
|
311
369
|
if (!mergedOpen && destroyOnClose) {
|
|
312
370
|
return null;
|
|
313
371
|
}
|
|
314
|
-
return /* @__PURE__ */
|
|
315
|
-
|
|
316
|
-
role: "
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
children: footer !== undefined ? footer : /* @__PURE__ */ jsxs2(Fragment, {
|
|
372
|
+
return /* @__PURE__ */ jsxs2("dialog", {
|
|
373
|
+
ref: dialogRef,
|
|
374
|
+
role: role === "alertdialog" ? role : undefined,
|
|
375
|
+
"aria-label": props["aria-label"] ?? (!callerNamed && title == null ? "Modal" : undefined),
|
|
376
|
+
"aria-labelledby": props["aria-labelledby"] ?? (!callerNamed && title != null ? titleId : undefined),
|
|
377
|
+
"aria-describedby": props["aria-describedby"],
|
|
378
|
+
className: getModalClasses({ className: cn(maskClassName, centered ? "modal-middle" : "modal-top") }),
|
|
379
|
+
style: surfaceWidth !== undefined ? { width: surfaceWidth, maxWidth: surfaceWidth } : undefined,
|
|
380
|
+
onCancel: (event) => {
|
|
381
|
+
event.preventDefault();
|
|
382
|
+
requestCancel();
|
|
383
|
+
},
|
|
384
|
+
onClose: handleNativeClose,
|
|
385
|
+
onMouseDown: (event) => {
|
|
386
|
+
if (!maskClosable || event.target !== event.currentTarget)
|
|
387
|
+
return;
|
|
388
|
+
const { left, right, top, bottom } = event.currentTarget.getBoundingClientRect();
|
|
389
|
+
if (event.clientX < left || event.clientX > right || event.clientY < top || event.clientY > bottom) {
|
|
390
|
+
requestCancel();
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
children: [
|
|
394
|
+
/* @__PURE__ */ jsx2("button", {
|
|
395
|
+
ref: cancelRequestRef,
|
|
396
|
+
type: "button",
|
|
397
|
+
hidden: true,
|
|
398
|
+
tabIndex: -1,
|
|
399
|
+
"aria-hidden": "true",
|
|
400
|
+
onClick: close
|
|
401
|
+
}),
|
|
402
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
403
|
+
...props,
|
|
404
|
+
ref,
|
|
405
|
+
role,
|
|
406
|
+
className: cn("modal-box", "react-modal-box", className),
|
|
407
|
+
style: getModalStyle({ width, style }),
|
|
408
|
+
children: [
|
|
409
|
+
title !== undefined || showClose ? /* @__PURE__ */ jsxs2("div", {
|
|
410
|
+
className: modalHeaderClass,
|
|
354
411
|
children: [
|
|
355
|
-
/* @__PURE__ */ jsx2("
|
|
412
|
+
title !== undefined ? /* @__PURE__ */ jsx2("h2", {
|
|
413
|
+
id: titleId,
|
|
414
|
+
className: modalTitleClass,
|
|
415
|
+
children: title
|
|
416
|
+
}) : null,
|
|
417
|
+
showClose ? /* @__PURE__ */ jsx2("button", {
|
|
356
418
|
type: "button",
|
|
419
|
+
className: modalCloseClass,
|
|
420
|
+
"aria-label": "Close",
|
|
357
421
|
onClick: close,
|
|
358
|
-
children:
|
|
359
|
-
})
|
|
360
|
-
/* @__PURE__ */ jsx2("button", {
|
|
361
|
-
type: "button",
|
|
362
|
-
"aria-busy": confirmLoading,
|
|
363
|
-
disabled: confirmLoading,
|
|
364
|
-
onClick: handleOk,
|
|
365
|
-
children: okText
|
|
366
|
-
})
|
|
422
|
+
children: closeIcon
|
|
423
|
+
}) : null
|
|
367
424
|
]
|
|
425
|
+
}) : null,
|
|
426
|
+
/* @__PURE__ */ jsx2("div", {
|
|
427
|
+
className: modalBodyClass,
|
|
428
|
+
children: body
|
|
429
|
+
}),
|
|
430
|
+
footer === null ? null : /* @__PURE__ */ jsx2("div", {
|
|
431
|
+
className: modalFooterClass,
|
|
432
|
+
children: footer !== undefined ? footer : /* @__PURE__ */ jsxs2(Fragment, {
|
|
433
|
+
children: [
|
|
434
|
+
/* @__PURE__ */ jsx2("button", {
|
|
435
|
+
type: "button",
|
|
436
|
+
onClick: close,
|
|
437
|
+
children: cancelText
|
|
438
|
+
}),
|
|
439
|
+
/* @__PURE__ */ jsx2("button", {
|
|
440
|
+
type: "button",
|
|
441
|
+
"aria-busy": confirmLoading,
|
|
442
|
+
disabled: confirmLoading,
|
|
443
|
+
onClick: handleOk,
|
|
444
|
+
children: okText
|
|
445
|
+
})
|
|
446
|
+
]
|
|
447
|
+
})
|
|
368
448
|
})
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
449
|
+
]
|
|
450
|
+
})
|
|
451
|
+
]
|
|
372
452
|
});
|
|
373
453
|
});
|
|
374
454
|
ModalBase.displayName = "Modal";
|
|
@@ -425,10 +505,10 @@ function getNotificationHolderClasses({
|
|
|
425
505
|
}
|
|
426
506
|
function getNotificationNoticeClasses({
|
|
427
507
|
type = "info",
|
|
428
|
-
open
|
|
508
|
+
open = true,
|
|
429
509
|
className
|
|
430
510
|
}) {
|
|
431
|
-
return cn("toast", "alert", notificationNoticeClass, notificationTypeClasses[type],
|
|
511
|
+
return cn("toast", "alert", notificationNoticeClass, notificationTypeClasses[type], open && "toast-show", open && notificationNoticeOpenClass, className);
|
|
432
512
|
}
|
|
433
513
|
|
|
434
514
|
// src/components/notification/Notification.tsx
|
|
@@ -457,11 +537,11 @@ function getKey(key) {
|
|
|
457
537
|
globalCounter += 1;
|
|
458
538
|
return `notification-${globalCounter}`;
|
|
459
539
|
}
|
|
460
|
-
function getDuration(
|
|
461
|
-
return
|
|
540
|
+
function getDuration(config, holderConfig) {
|
|
541
|
+
return config.duration ?? holderConfig.duration ?? defaultConfig.duration;
|
|
462
542
|
}
|
|
463
|
-
function getPlacement(
|
|
464
|
-
return
|
|
543
|
+
function getPlacement(config, holderConfig) {
|
|
544
|
+
return config.placement ?? holderConfig.placement ?? defaultConfig.placement;
|
|
465
545
|
}
|
|
466
546
|
function applyMaxCount(notices, maxCount) {
|
|
467
547
|
if (!maxCount || notices.length <= maxCount) {
|
|
@@ -539,42 +619,42 @@ function destroyGlobal(key) {
|
|
|
539
619
|
globalNotices = [];
|
|
540
620
|
emitGlobal();
|
|
541
621
|
}
|
|
542
|
-
function openGlobal(
|
|
543
|
-
const key = getKey(
|
|
622
|
+
function openGlobal(config) {
|
|
623
|
+
const key = getKey(config.key);
|
|
544
624
|
const notice = {
|
|
545
|
-
...
|
|
625
|
+
...config,
|
|
546
626
|
key,
|
|
547
|
-
placement: getPlacement(
|
|
548
|
-
type:
|
|
627
|
+
placement: getPlacement(config, globalConfig2),
|
|
628
|
+
type: config.type ?? "info"
|
|
549
629
|
};
|
|
550
630
|
clearTimer2(key);
|
|
551
631
|
globalNotices = applyMaxCount([...globalNotices.filter((item) => item.key !== key), notice], globalConfig2.maxCount);
|
|
552
|
-
const duration = getDuration(
|
|
632
|
+
const duration = getDuration(config, globalConfig2);
|
|
553
633
|
if (duration && duration > 0) {
|
|
554
634
|
globalTimers.set(key, setTimeout(() => closeGlobal(key), duration * 1000));
|
|
555
635
|
}
|
|
556
636
|
emitGlobal();
|
|
557
637
|
}
|
|
558
|
-
function withType(type,
|
|
559
|
-
openGlobal({ ...
|
|
638
|
+
function withType(type, config) {
|
|
639
|
+
openGlobal({ ...config, type });
|
|
560
640
|
}
|
|
561
641
|
var globalApi = {
|
|
562
642
|
open: openGlobal,
|
|
563
|
-
success: (
|
|
564
|
-
info: (
|
|
565
|
-
warning: (
|
|
566
|
-
error: (
|
|
643
|
+
success: (config) => withType("success", config),
|
|
644
|
+
info: (config) => withType("info", config),
|
|
645
|
+
warning: (config) => withType("warning", config),
|
|
646
|
+
error: (config) => withType("error", config),
|
|
567
647
|
close: closeGlobal,
|
|
568
648
|
destroy: destroyGlobal,
|
|
569
|
-
config: (
|
|
570
|
-
globalConfig2 = { ...globalConfig2, ...
|
|
649
|
+
config: (config) => {
|
|
650
|
+
globalConfig2 = { ...globalConfig2, ...config };
|
|
571
651
|
emitGlobal();
|
|
572
652
|
},
|
|
573
653
|
useNotification
|
|
574
654
|
};
|
|
575
655
|
function NotificationHolder({
|
|
576
656
|
notices,
|
|
577
|
-
config
|
|
657
|
+
config,
|
|
578
658
|
onClose
|
|
579
659
|
}) {
|
|
580
660
|
const groups = groupByPlacement(notices);
|
|
@@ -583,7 +663,7 @@ function NotificationHolder({
|
|
|
583
663
|
if (group.length === 0) {
|
|
584
664
|
return null;
|
|
585
665
|
}
|
|
586
|
-
const offsetStyle = placement.startsWith("bottom") &&
|
|
666
|
+
const offsetStyle = placement.startsWith("bottom") && config.bottom !== undefined ? { bottom: config.bottom } : config.top !== undefined ? { top: config.top } : undefined;
|
|
587
667
|
return /* @__PURE__ */ jsx3("div", {
|
|
588
668
|
className: getNotificationHolderClasses({
|
|
589
669
|
placement
|
|
@@ -591,7 +671,7 @@ function NotificationHolder({
|
|
|
591
671
|
style: offsetStyle,
|
|
592
672
|
children: group.map((notice) => /* @__PURE__ */ jsx3(NotificationNotice, {
|
|
593
673
|
notice,
|
|
594
|
-
fallbackCloseIcon:
|
|
674
|
+
fallbackCloseIcon: config.closeIcon,
|
|
595
675
|
onClose
|
|
596
676
|
}, notice.key))
|
|
597
677
|
}, placement);
|
|
@@ -678,30 +758,30 @@ function createScopedApi({
|
|
|
678
758
|
return current.filter((item) => item.key !== key);
|
|
679
759
|
});
|
|
680
760
|
}
|
|
681
|
-
function
|
|
682
|
-
const key = getKey(
|
|
761
|
+
function open(config) {
|
|
762
|
+
const key = getKey(config.key);
|
|
683
763
|
const notice = {
|
|
684
|
-
...
|
|
764
|
+
...config,
|
|
685
765
|
key,
|
|
686
|
-
placement: getPlacement(
|
|
687
|
-
type:
|
|
766
|
+
placement: getPlacement(config, holderConfig),
|
|
767
|
+
type: config.type ?? "info"
|
|
688
768
|
};
|
|
689
769
|
clearScopedTimer(key);
|
|
690
770
|
setNotices((current) => applyMaxCount([...current.filter((item) => item.key !== key), notice], holderConfig.maxCount));
|
|
691
|
-
const duration = getDuration(
|
|
771
|
+
const duration = getDuration(config, holderConfig);
|
|
692
772
|
if (duration && duration > 0) {
|
|
693
773
|
timerMap.set(key, setTimeout(() => close(key), duration * 1000));
|
|
694
774
|
}
|
|
695
775
|
}
|
|
696
|
-
function typed(type,
|
|
697
|
-
|
|
776
|
+
function typed(type, config) {
|
|
777
|
+
open({ ...config, type });
|
|
698
778
|
}
|
|
699
779
|
return {
|
|
700
|
-
open
|
|
701
|
-
success: (
|
|
702
|
-
info: (
|
|
703
|
-
warning: (
|
|
704
|
-
error: (
|
|
780
|
+
open,
|
|
781
|
+
success: (config) => typed("success", config),
|
|
782
|
+
info: (config) => typed("info", config),
|
|
783
|
+
warning: (config) => typed("warning", config),
|
|
784
|
+
error: (config) => typed("error", config),
|
|
705
785
|
close,
|
|
706
786
|
destroy: (key) => {
|
|
707
787
|
if (key !== undefined) {
|
|
@@ -720,24 +800,24 @@ function createScopedApi({
|
|
|
720
800
|
}
|
|
721
801
|
};
|
|
722
802
|
}
|
|
723
|
-
function useNotification(
|
|
803
|
+
function useNotification(config = {}) {
|
|
724
804
|
const holderConfig = useMemo(() => ({
|
|
725
805
|
...defaultConfig,
|
|
726
|
-
bottom:
|
|
727
|
-
closeIcon:
|
|
728
|
-
duration:
|
|
729
|
-
getContainer:
|
|
730
|
-
maxCount:
|
|
731
|
-
placement:
|
|
732
|
-
top:
|
|
806
|
+
bottom: config.bottom,
|
|
807
|
+
closeIcon: config.closeIcon,
|
|
808
|
+
duration: config.duration ?? defaultConfig.duration,
|
|
809
|
+
getContainer: config.getContainer,
|
|
810
|
+
maxCount: config.maxCount,
|
|
811
|
+
placement: config.placement ?? defaultConfig.placement,
|
|
812
|
+
top: config.top
|
|
733
813
|
}), [
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
814
|
+
config.bottom,
|
|
815
|
+
config.closeIcon,
|
|
816
|
+
config.duration,
|
|
817
|
+
config.getContainer,
|
|
818
|
+
config.maxCount,
|
|
819
|
+
config.placement,
|
|
820
|
+
config.top
|
|
741
821
|
]);
|
|
742
822
|
const [notices, setNotices] = useState2([]);
|
|
743
823
|
const [timerMap] = useState2(() => new Map);
|
|
@@ -772,26 +852,6 @@ function useNotification(config2 = {}) {
|
|
|
772
852
|
];
|
|
773
853
|
}
|
|
774
854
|
var notification = globalApi;
|
|
775
|
-
// src/components/app/App.tsx
|
|
776
|
-
import {
|
|
777
|
-
createContext,
|
|
778
|
-
forwardRef as forwardRef2,
|
|
779
|
-
useContext,
|
|
780
|
-
useEffect as useEffect3,
|
|
781
|
-
useMemo as useMemo2
|
|
782
|
-
} from "react";
|
|
783
|
-
|
|
784
|
-
// src/classes/app.ts
|
|
785
|
-
var appClass = "app";
|
|
786
|
-
var appRootClass = "app-root";
|
|
787
|
-
var appHolderClass = "app-holder";
|
|
788
|
-
function getAppClasses({ className }) {
|
|
789
|
-
return cn(appClass, className);
|
|
790
|
-
}
|
|
791
|
-
function getAppRootClasses({ className }) {
|
|
792
|
-
return cn(appRootClass, className);
|
|
793
|
-
}
|
|
794
|
-
|
|
795
855
|
// src/components/app/App.tsx
|
|
796
856
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
797
857
|
var fallbackContext = {
|
|
@@ -877,7 +937,7 @@ function AppRoot({ className, ...props }) {
|
|
|
877
937
|
});
|
|
878
938
|
}
|
|
879
939
|
export {
|
|
880
|
-
|
|
940
|
+
App,
|
|
881
941
|
AppContext,
|
|
882
|
-
|
|
942
|
+
AppRoot
|
|
883
943
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps } from "react";
|
|
2
|
-
export type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
2
|
+
export type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
3
3
|
export type AvatarShape = "circle" | "square";
|
|
4
4
|
export interface AvatarProps extends ComponentProps<"span"> {
|
|
5
5
|
size?: AvatarSize;
|