@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,12 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/components/
|
|
4
|
-
import {
|
|
5
|
-
forwardRef,
|
|
6
|
-
useImperativeHandle,
|
|
7
|
-
useRef,
|
|
8
|
-
useState
|
|
9
|
-
} from "react";
|
|
3
|
+
// src/components/dm-tree/DmTree.tsx
|
|
4
|
+
import { useMemo as useMemo2, useState as useState5 } from "react";
|
|
10
5
|
|
|
11
6
|
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
12
7
|
function r(e) {
|
|
@@ -33,6 +28,49 @@ function clsx() {
|
|
|
33
28
|
function cn(...inputs) {
|
|
34
29
|
return clsx(inputs);
|
|
35
30
|
}
|
|
31
|
+
// src/classes/dm-tree.ts
|
|
32
|
+
var dmTreeBaseClass = "dm-tree";
|
|
33
|
+
var dmTreeAutoWidthClass = "dm-tree-auto-width";
|
|
34
|
+
var dmTreeContentClass = "dm-tree-content";
|
|
35
|
+
var dmTreeToolbarClass = "dm-tree-toolbar";
|
|
36
|
+
var dmTreeIconToolbarClass = "dm-tree-icon-toolbar";
|
|
37
|
+
var dmTreeAllButtonClass = "dm-tree-all-button";
|
|
38
|
+
var dmTreeAllButtonSelectedClass = "dm-tree-all-button-selected";
|
|
39
|
+
var dmTreeSearchClass = "dm-tree-search";
|
|
40
|
+
var dmTreeBodyClass = "dm-tree-body";
|
|
41
|
+
var dmTreeNodeTitleClass = "dm-tree-node-title";
|
|
42
|
+
var dmTreeNodePrefixClass = "dm-tree-node-prefix";
|
|
43
|
+
var dmTreeItemToolbarClass = "dm-tree-item-toolbar";
|
|
44
|
+
var dmTreeItemToolbarVisibleClass = "dm-tree-item-toolbar-visible";
|
|
45
|
+
var dmTreeOptionClass = "dm-tree-option";
|
|
46
|
+
function getDmTreeClasses({
|
|
47
|
+
autoWidth,
|
|
48
|
+
optionTree,
|
|
49
|
+
className
|
|
50
|
+
}) {
|
|
51
|
+
return cn(dmTreeBaseClass, autoWidth && dmTreeAutoWidthClass, optionTree && dmTreeOptionClass, className);
|
|
52
|
+
}
|
|
53
|
+
function getDmTreeAllButtonClasses({
|
|
54
|
+
selected,
|
|
55
|
+
className
|
|
56
|
+
}) {
|
|
57
|
+
return cn(dmTreeAllButtonClass, selected && dmTreeAllButtonSelectedClass, className);
|
|
58
|
+
}
|
|
59
|
+
function getDmTreeItemToolbarClasses({
|
|
60
|
+
alwaysShow,
|
|
61
|
+
className
|
|
62
|
+
}) {
|
|
63
|
+
return cn(dmTreeItemToolbarClass, alwaysShow && dmTreeItemToolbarVisibleClass, className);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/components/input/Input.tsx
|
|
67
|
+
import {
|
|
68
|
+
forwardRef,
|
|
69
|
+
useImperativeHandle,
|
|
70
|
+
useRef,
|
|
71
|
+
useState
|
|
72
|
+
} from "react";
|
|
73
|
+
|
|
36
74
|
// src/classes/input.ts
|
|
37
75
|
var inputBaseClass = "input";
|
|
38
76
|
var inputWrapperClass = "input-wrapper";
|
|
@@ -343,6 +381,27 @@ var Input = Object.assign(InputRoot, {
|
|
|
343
381
|
TextArea,
|
|
344
382
|
Group
|
|
345
383
|
});
|
|
384
|
+
// src/components/dm-status/DmStatus.tsx
|
|
385
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
386
|
+
|
|
387
|
+
// src/classes/dm-status.ts
|
|
388
|
+
var dmStatusBaseClass = "dm-status";
|
|
389
|
+
var dmStatusLoadingClass = "dm-status-loading";
|
|
390
|
+
var dmStatusContentClass = "dm-status-content";
|
|
391
|
+
var dmStatusImageClass = "dm-status-image";
|
|
392
|
+
var dmStatusTypeClasses = {
|
|
393
|
+
empty: "dm-status-empty",
|
|
394
|
+
loading: "dm-status-loading-state",
|
|
395
|
+
error: "dm-status-error",
|
|
396
|
+
success: "dm-status-success"
|
|
397
|
+
};
|
|
398
|
+
function getDmStatusClasses({
|
|
399
|
+
status,
|
|
400
|
+
className
|
|
401
|
+
}) {
|
|
402
|
+
return cn(dmStatusBaseClass, dmStatusTypeClasses[status], className);
|
|
403
|
+
}
|
|
404
|
+
|
|
346
405
|
// src/components/empty/Empty.tsx
|
|
347
406
|
import { forwardRef as forwardRef2 } from "react";
|
|
348
407
|
|
|
@@ -469,8 +528,8 @@ function useDelayedSpinning(spinning, delay) {
|
|
|
469
528
|
return;
|
|
470
529
|
}
|
|
471
530
|
if (!spinning) {
|
|
472
|
-
const
|
|
473
|
-
return () => window.clearTimeout(
|
|
531
|
+
const resetTimer = window.setTimeout(() => setDelayedActive(false), 0);
|
|
532
|
+
return () => window.clearTimeout(resetTimer);
|
|
474
533
|
}
|
|
475
534
|
const resetTimer = window.setTimeout(() => setDelayedActive(false), 0);
|
|
476
535
|
const showTimer = window.setTimeout(() => setDelayedActive(true), delay);
|
|
@@ -537,27 +596,6 @@ var SpinBase = forwardRef3(({
|
|
|
537
596
|
SpinBase.displayName = "Spin";
|
|
538
597
|
var Spin = SpinBase;
|
|
539
598
|
Spin.setDefaultIndicator = setDefaultIndicator;
|
|
540
|
-
// src/components/dm-status/DmStatus.tsx
|
|
541
|
-
import { forwardRef as forwardRef4 } from "react";
|
|
542
|
-
|
|
543
|
-
// src/classes/dm-status.ts
|
|
544
|
-
var dmStatusBaseClass = "dm-status";
|
|
545
|
-
var dmStatusLoadingClass = "dm-status-loading";
|
|
546
|
-
var dmStatusContentClass = "dm-status-content";
|
|
547
|
-
var dmStatusImageClass = "dm-status-image";
|
|
548
|
-
var dmStatusTypeClasses = {
|
|
549
|
-
empty: "dm-status-empty",
|
|
550
|
-
loading: "dm-status-loading-state",
|
|
551
|
-
error: "dm-status-error",
|
|
552
|
-
success: "dm-status-success"
|
|
553
|
-
};
|
|
554
|
-
function getDmStatusClasses({
|
|
555
|
-
status,
|
|
556
|
-
className
|
|
557
|
-
}) {
|
|
558
|
-
return cn(dmStatusBaseClass, dmStatusTypeClasses[status], className);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
599
|
// src/components/dm-status/DmStatus.tsx
|
|
562
600
|
import { jsx as jsx4, jsxs as jsxs4, Fragment } from "react/jsx-runtime";
|
|
563
601
|
var defaultDescriptions = {
|
|
@@ -682,6 +720,30 @@ var DmStatus = forwardRef4(({
|
|
|
682
720
|
});
|
|
683
721
|
});
|
|
684
722
|
DmStatus.displayName = "DmStatus";
|
|
723
|
+
// src/components/dm-tabs/DmTabs.tsx
|
|
724
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
725
|
+
|
|
726
|
+
// src/classes/dm-tabs.ts
|
|
727
|
+
var dmTabsShellClass = "dm-tabs-shell";
|
|
728
|
+
var dmTabsLineHorizontalClass = "dm-line-horizontal-tabs";
|
|
729
|
+
var dmTabsLineVerticalClass = "dm-line-vertical-tabs";
|
|
730
|
+
var dmTabsCardClass = "dm-card-tabs";
|
|
731
|
+
var dmTabsCardTransparentClass = "dm-card-transparent-tabs";
|
|
732
|
+
var dmTabsOptionTreeClass = "dm-option-tree-tabs";
|
|
733
|
+
function getDmTabsShellClasses({ className }) {
|
|
734
|
+
return cn(dmTabsShellClass, className);
|
|
735
|
+
}
|
|
736
|
+
function getDmTabsClasses({
|
|
737
|
+
type = "line",
|
|
738
|
+
tabPosition = "top",
|
|
739
|
+
transparentCard,
|
|
740
|
+
optionTree,
|
|
741
|
+
className
|
|
742
|
+
}) {
|
|
743
|
+
const isVerticalLine = type === "line" && (tabPosition === "left" || tabPosition === "right");
|
|
744
|
+
return cn(type === "line" && (isVerticalLine ? dmTabsLineVerticalClass : dmTabsLineHorizontalClass), type !== "line" && (transparentCard ? dmTabsCardTransparentClass : dmTabsCardClass), optionTree && dmTabsOptionTreeClass, className);
|
|
745
|
+
}
|
|
746
|
+
|
|
685
747
|
// src/components/tabs/Tabs.tsx
|
|
686
748
|
import {
|
|
687
749
|
Children,
|
|
@@ -1010,30 +1072,6 @@ TabsBase.displayName = "Tabs";
|
|
|
1010
1072
|
var Tabs = Object.assign(TabsBase, {
|
|
1011
1073
|
TabPane
|
|
1012
1074
|
});
|
|
1013
|
-
// src/components/dm-tabs/DmTabs.tsx
|
|
1014
|
-
import { forwardRef as forwardRef6 } from "react";
|
|
1015
|
-
|
|
1016
|
-
// src/classes/dm-tabs.ts
|
|
1017
|
-
var dmTabsShellClass = "dm-tabs-shell";
|
|
1018
|
-
var dmTabsLineHorizontalClass = "dm-line-horizontal-tabs";
|
|
1019
|
-
var dmTabsLineVerticalClass = "dm-line-vertical-tabs";
|
|
1020
|
-
var dmTabsCardClass = "dm-card-tabs";
|
|
1021
|
-
var dmTabsCardTransparentClass = "dm-card-transparent-tabs";
|
|
1022
|
-
var dmTabsOptionTreeClass = "dm-option-tree-tabs";
|
|
1023
|
-
function getDmTabsShellClasses({ className }) {
|
|
1024
|
-
return cn(dmTabsShellClass, className);
|
|
1025
|
-
}
|
|
1026
|
-
function getDmTabsClasses({
|
|
1027
|
-
type = "line",
|
|
1028
|
-
tabPosition = "top",
|
|
1029
|
-
transparentCard,
|
|
1030
|
-
optionTree,
|
|
1031
|
-
className
|
|
1032
|
-
}) {
|
|
1033
|
-
const isVerticalLine = type === "line" && (tabPosition === "left" || tabPosition === "right");
|
|
1034
|
-
return cn(type === "line" && (isVerticalLine ? dmTabsLineVerticalClass : dmTabsLineHorizontalClass), type !== "line" && (transparentCard ? dmTabsCardTransparentClass : dmTabsCardClass), optionTree && dmTabsOptionTreeClass, className);
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
1075
|
// src/components/dm-tabs/DmTabs.tsx
|
|
1038
1076
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1039
1077
|
var DmTabs = forwardRef6(({
|
|
@@ -1476,44 +1514,6 @@ var Tree = TreeBase;
|
|
|
1476
1514
|
Tree.TreeNode = TreeNodeComponent;
|
|
1477
1515
|
Tree.DirectoryTree = DirectoryTree;
|
|
1478
1516
|
Tree.displayName = "Tree";
|
|
1479
|
-
// src/components/dm-tree/DmTree.tsx
|
|
1480
|
-
import { useMemo as useMemo2, useState as useState5 } from "react";
|
|
1481
|
-
|
|
1482
|
-
// src/classes/dm-tree.ts
|
|
1483
|
-
var dmTreeBaseClass = "dm-tree";
|
|
1484
|
-
var dmTreeAutoWidthClass = "dm-tree-auto-width";
|
|
1485
|
-
var dmTreeContentClass = "dm-tree-content";
|
|
1486
|
-
var dmTreeToolbarClass = "dm-tree-toolbar";
|
|
1487
|
-
var dmTreeIconToolbarClass = "dm-tree-icon-toolbar";
|
|
1488
|
-
var dmTreeAllButtonClass = "dm-tree-all-button";
|
|
1489
|
-
var dmTreeAllButtonSelectedClass = "dm-tree-all-button-selected";
|
|
1490
|
-
var dmTreeSearchClass = "dm-tree-search";
|
|
1491
|
-
var dmTreeBodyClass = "dm-tree-body";
|
|
1492
|
-
var dmTreeNodeTitleClass = "dm-tree-node-title";
|
|
1493
|
-
var dmTreeNodePrefixClass = "dm-tree-node-prefix";
|
|
1494
|
-
var dmTreeItemToolbarClass = "dm-tree-item-toolbar";
|
|
1495
|
-
var dmTreeItemToolbarVisibleClass = "dm-tree-item-toolbar-visible";
|
|
1496
|
-
var dmTreeOptionClass = "dm-tree-option";
|
|
1497
|
-
function getDmTreeClasses({
|
|
1498
|
-
autoWidth,
|
|
1499
|
-
optionTree,
|
|
1500
|
-
className
|
|
1501
|
-
}) {
|
|
1502
|
-
return cn(dmTreeBaseClass, autoWidth && dmTreeAutoWidthClass, optionTree && dmTreeOptionClass, className);
|
|
1503
|
-
}
|
|
1504
|
-
function getDmTreeAllButtonClasses({
|
|
1505
|
-
selected,
|
|
1506
|
-
className
|
|
1507
|
-
}) {
|
|
1508
|
-
return cn(dmTreeAllButtonClass, selected && dmTreeAllButtonSelectedClass, className);
|
|
1509
|
-
}
|
|
1510
|
-
function getDmTreeItemToolbarClasses({
|
|
1511
|
-
alwaysShow,
|
|
1512
|
-
className
|
|
1513
|
-
}) {
|
|
1514
|
-
return cn(dmTreeItemToolbarClass, alwaysShow && dmTreeItemToolbarVisibleClass, className);
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
1517
|
// src/components/dm-tree/DmTree.tsx
|
|
1518
1518
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1519
1519
|
var defaultFieldNames = {
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/components/
|
|
4
|
-
import {
|
|
3
|
+
// src/components/dm-truncate/DmTruncate.tsx
|
|
4
|
+
import {
|
|
5
|
+
forwardRef as forwardRef2,
|
|
6
|
+
useCallback,
|
|
7
|
+
useEffect as useEffect2,
|
|
8
|
+
useLayoutEffect,
|
|
9
|
+
useMemo,
|
|
10
|
+
useRef as useRef2,
|
|
11
|
+
useState as useState2
|
|
12
|
+
} from "react";
|
|
5
13
|
|
|
6
14
|
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
7
15
|
function r(e) {
|
|
@@ -28,11 +36,33 @@ function clsx() {
|
|
|
28
36
|
function cn(...inputs) {
|
|
29
37
|
return clsx(inputs);
|
|
30
38
|
}
|
|
39
|
+
// src/classes/dm-truncate.ts
|
|
40
|
+
var dmTruncateBaseClass = "dm-truncate";
|
|
41
|
+
var dmTruncateContentClass = "dm-truncate-content";
|
|
42
|
+
var dmTruncateTextClass = "dm-truncate-text";
|
|
43
|
+
var dmTruncateMultilineClass = "dm-truncate-multiline";
|
|
44
|
+
var dmTruncateOverflowClass = "dm-truncate-overflow";
|
|
45
|
+
var dmTruncateOverflowTagClass = "dm-truncate-overflow-tag";
|
|
46
|
+
var dmTruncateCopyClass = "dm-truncate-copy";
|
|
47
|
+
var dmTruncateMeasureClass = "dm-truncate-measure";
|
|
48
|
+
function getDmTruncateClasses(className) {
|
|
49
|
+
return cn(dmTruncateBaseClass, className);
|
|
50
|
+
}
|
|
51
|
+
function getDmTruncateTextClasses({
|
|
52
|
+
multiline,
|
|
53
|
+
overflow,
|
|
54
|
+
className
|
|
55
|
+
}) {
|
|
56
|
+
return cn(dmTruncateTextClass, multiline && dmTruncateMultilineClass, overflow && dmTruncateOverflowClass, className);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/components/tooltip/Tooltip.tsx
|
|
60
|
+
import React, { forwardRef, useEffect, useId, useRef, useState } from "react";
|
|
61
|
+
|
|
31
62
|
// src/classes/tooltip.ts
|
|
32
63
|
var tooltipWrapperClass = "tooltip-wrapper";
|
|
33
64
|
var tooltipBaseClass = "tooltip";
|
|
34
65
|
var tooltipShowClass = "tooltip-show";
|
|
35
|
-
var tooltipArrowClass = "tooltip-arrow";
|
|
36
66
|
var tooltipNoArrowClass = "tooltip-no-arrow";
|
|
37
67
|
var tooltipPlacementClasses = {
|
|
38
68
|
top: "tooltip-top",
|
|
@@ -62,10 +92,12 @@ var Tooltip = forwardRef(({
|
|
|
62
92
|
placement = "top",
|
|
63
93
|
open,
|
|
64
94
|
defaultOpen,
|
|
95
|
+
onOpenChange,
|
|
65
96
|
arrow = true,
|
|
66
97
|
size = "md",
|
|
67
98
|
className,
|
|
68
99
|
children,
|
|
100
|
+
style,
|
|
69
101
|
onBlur,
|
|
70
102
|
onFocus,
|
|
71
103
|
onMouseEnter,
|
|
@@ -75,90 +107,138 @@ var Tooltip = forwardRef(({
|
|
|
75
107
|
const [internalOpen, setInternalOpen] = useState(Boolean(defaultOpen));
|
|
76
108
|
const isControlled = open !== undefined;
|
|
77
109
|
const visible = isControlled ? open : internalOpen;
|
|
78
|
-
const
|
|
110
|
+
const reactId = useId();
|
|
111
|
+
const tooltipId = props.id !== undefined ? `${props.id}-tooltip` : `${reactId}-tooltip`;
|
|
112
|
+
const anchor = `--tooltip-${reactId.replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
113
|
+
const surfaceRef = useRef(null);
|
|
114
|
+
const hoveredRef = useRef(false);
|
|
115
|
+
const focusedRef = useRef(false);
|
|
116
|
+
const interactionOpenRef = useRef(false);
|
|
117
|
+
const visibleRef = useRef(visible);
|
|
118
|
+
const controlledRef = useRef(isControlled);
|
|
119
|
+
const onOpenChangeRef = useRef(onOpenChange);
|
|
120
|
+
visibleRef.current = visible;
|
|
121
|
+
controlledRef.current = isControlled;
|
|
122
|
+
onOpenChangeRef.current = onOpenChange;
|
|
123
|
+
const hasTitle = Boolean(title);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const surface = surfaceRef.current;
|
|
126
|
+
if (!surface)
|
|
127
|
+
return;
|
|
128
|
+
const tooltipSurface = surface;
|
|
129
|
+
function handleToggle(event) {
|
|
130
|
+
if (event.newState !== "closed" || !visibleRef.current || isControlled || isControlled !== controlledRef.current || tooltipSurface.matches(":popover-open")) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
hoveredRef.current = false;
|
|
134
|
+
focusedRef.current = false;
|
|
135
|
+
interactionOpenRef.current = false;
|
|
136
|
+
onOpenChangeRef.current?.(false);
|
|
137
|
+
setInternalOpen(false);
|
|
138
|
+
}
|
|
139
|
+
surface.addEventListener("toggle", handleToggle);
|
|
140
|
+
return () => surface.removeEventListener("toggle", handleToggle);
|
|
141
|
+
}, [hasTitle, isControlled]);
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
const surface = surfaceRef.current;
|
|
144
|
+
if (!surface)
|
|
145
|
+
return;
|
|
146
|
+
if (visible && !surface.matches(":popover-open")) {
|
|
147
|
+
surface.showPopover();
|
|
148
|
+
} else if (!visible && surface.matches(":popover-open")) {
|
|
149
|
+
surface.hidePopover();
|
|
150
|
+
}
|
|
151
|
+
}, [visible, hasTitle, isControlled]);
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (!isControlled || !visible || !hasTitle)
|
|
154
|
+
return;
|
|
155
|
+
const wrapper = surfaceRef.current?.parentElement;
|
|
156
|
+
if (!wrapper)
|
|
157
|
+
return;
|
|
158
|
+
const tooltipWrapper = wrapper;
|
|
159
|
+
function requestDismiss() {
|
|
160
|
+
hoveredRef.current = false;
|
|
161
|
+
focusedRef.current = false;
|
|
162
|
+
interactionOpenRef.current = false;
|
|
163
|
+
onOpenChangeRef.current?.(false);
|
|
164
|
+
}
|
|
165
|
+
function handlePointerDown(event) {
|
|
166
|
+
if (!tooltipWrapper.contains(event.target))
|
|
167
|
+
requestDismiss();
|
|
168
|
+
}
|
|
169
|
+
function handleKeyDown(event) {
|
|
170
|
+
if (event.key === "Escape")
|
|
171
|
+
requestDismiss();
|
|
172
|
+
}
|
|
173
|
+
document.addEventListener("pointerdown", handlePointerDown, true);
|
|
174
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
175
|
+
return () => {
|
|
176
|
+
document.removeEventListener("pointerdown", handlePointerDown, true);
|
|
177
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
178
|
+
};
|
|
179
|
+
}, [isControlled, visible, hasTitle]);
|
|
180
|
+
function updateInteraction() {
|
|
181
|
+
const next = hoveredRef.current || focusedRef.current;
|
|
182
|
+
if (next === interactionOpenRef.current)
|
|
183
|
+
return;
|
|
184
|
+
interactionOpenRef.current = next;
|
|
185
|
+
onOpenChange?.(next);
|
|
186
|
+
if (!isControlled)
|
|
187
|
+
setInternalOpen(next);
|
|
188
|
+
}
|
|
79
189
|
function showTooltip(event) {
|
|
80
190
|
onMouseEnter?.(event);
|
|
81
|
-
|
|
82
|
-
|
|
191
|
+
hoveredRef.current = true;
|
|
192
|
+
updateInteraction();
|
|
83
193
|
}
|
|
84
194
|
function hideTooltip(event) {
|
|
85
195
|
onMouseLeave?.(event);
|
|
86
|
-
|
|
87
|
-
|
|
196
|
+
hoveredRef.current = false;
|
|
197
|
+
updateInteraction();
|
|
88
198
|
}
|
|
89
199
|
function focusTooltip(event) {
|
|
90
200
|
onFocus?.(event);
|
|
91
|
-
|
|
92
|
-
|
|
201
|
+
focusedRef.current = true;
|
|
202
|
+
updateInteraction();
|
|
93
203
|
}
|
|
94
204
|
function blurTooltip(event) {
|
|
95
205
|
onBlur?.(event);
|
|
96
|
-
if (
|
|
97
|
-
|
|
206
|
+
if (event.currentTarget.contains(event.relatedTarget))
|
|
207
|
+
return;
|
|
208
|
+
focusedRef.current = false;
|
|
209
|
+
updateInteraction();
|
|
210
|
+
}
|
|
211
|
+
let trigger = children;
|
|
212
|
+
if (hasTitle && React.isValidElement(children) && children.type !== React.Fragment) {
|
|
213
|
+
trigger = React.cloneElement(children, {
|
|
214
|
+
"aria-describedby": [children.props["aria-describedby"], tooltipId].filter(Boolean).join(" ")
|
|
215
|
+
});
|
|
98
216
|
}
|
|
99
217
|
return /* @__PURE__ */ jsxs("span", {
|
|
100
218
|
...props,
|
|
101
219
|
ref,
|
|
102
220
|
className: tooltipWrapperClass,
|
|
103
|
-
|
|
221
|
+
style: { ...style, anchorName: anchor },
|
|
222
|
+
"aria-describedby": hasTitle && trigger === children ? [props["aria-describedby"], tooltipId].filter(Boolean).join(" ") : props["aria-describedby"],
|
|
104
223
|
onMouseEnter: showTooltip,
|
|
105
224
|
onMouseLeave: hideTooltip,
|
|
106
225
|
onFocus: focusTooltip,
|
|
107
226
|
onBlur: blurTooltip,
|
|
108
227
|
children: [
|
|
109
|
-
|
|
110
|
-
|
|
228
|
+
trigger,
|
|
229
|
+
hasTitle ? /* @__PURE__ */ jsx("span", {
|
|
230
|
+
ref: surfaceRef,
|
|
111
231
|
id: tooltipId,
|
|
112
232
|
role: "tooltip",
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
arrow,
|
|
118
|
-
className
|
|
119
|
-
}),
|
|
120
|
-
children: [
|
|
121
|
-
title,
|
|
122
|
-
arrow ? /* @__PURE__ */ jsx("span", {
|
|
123
|
-
className: tooltipArrowClass
|
|
124
|
-
}) : null
|
|
125
|
-
]
|
|
233
|
+
popover: isControlled ? "manual" : "hint",
|
|
234
|
+
style: { positionAnchor: anchor },
|
|
235
|
+
className: getTooltipClasses({ placement, size, arrow, className }),
|
|
236
|
+
children: title
|
|
126
237
|
}) : null
|
|
127
238
|
]
|
|
128
239
|
});
|
|
129
240
|
});
|
|
130
241
|
Tooltip.displayName = "Tooltip";
|
|
131
|
-
// src/components/dm-truncate/DmTruncate.tsx
|
|
132
|
-
import {
|
|
133
|
-
forwardRef as forwardRef2,
|
|
134
|
-
useCallback,
|
|
135
|
-
useEffect,
|
|
136
|
-
useLayoutEffect,
|
|
137
|
-
useMemo,
|
|
138
|
-
useRef,
|
|
139
|
-
useState as useState2
|
|
140
|
-
} from "react";
|
|
141
|
-
|
|
142
|
-
// src/classes/dm-truncate.ts
|
|
143
|
-
var dmTruncateBaseClass = "dm-truncate";
|
|
144
|
-
var dmTruncateContentClass = "dm-truncate-content";
|
|
145
|
-
var dmTruncateTextClass = "dm-truncate-text";
|
|
146
|
-
var dmTruncateMultilineClass = "dm-truncate-multiline";
|
|
147
|
-
var dmTruncateOverflowClass = "dm-truncate-overflow";
|
|
148
|
-
var dmTruncateOverflowTagClass = "dm-truncate-overflow-tag";
|
|
149
|
-
var dmTruncateCopyClass = "dm-truncate-copy";
|
|
150
|
-
var dmTruncateMeasureClass = "dm-truncate-measure";
|
|
151
|
-
function getDmTruncateClasses(className) {
|
|
152
|
-
return cn(dmTruncateBaseClass, className);
|
|
153
|
-
}
|
|
154
|
-
function getDmTruncateTextClasses({
|
|
155
|
-
multiline,
|
|
156
|
-
overflow,
|
|
157
|
-
className
|
|
158
|
-
}) {
|
|
159
|
-
return cn(dmTruncateTextClass, multiline && dmTruncateMultilineClass, overflow && dmTruncateOverflowClass, className);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
242
|
// src/components/dm-truncate/DmTruncate.tsx
|
|
163
243
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
164
244
|
function toPlainText(value) {
|
|
@@ -217,10 +297,10 @@ var DmTruncate = forwardRef2(({
|
|
|
217
297
|
onCopy,
|
|
218
298
|
...props
|
|
219
299
|
}, ref) => {
|
|
220
|
-
const wrapperRef =
|
|
221
|
-
const textRef =
|
|
222
|
-
const measureRef =
|
|
223
|
-
const copyTimerRef =
|
|
300
|
+
const wrapperRef = useRef2(null);
|
|
301
|
+
const textRef = useRef2(null);
|
|
302
|
+
const measureRef = useRef2(null);
|
|
303
|
+
const copyTimerRef = useRef2(null);
|
|
224
304
|
const [overflow, setOverflow] = useState2(false);
|
|
225
305
|
const [copied, setCopied] = useState2(false);
|
|
226
306
|
const textValue = toPlainText(children);
|
|
@@ -276,14 +356,14 @@ var DmTruncate = forwardRef2(({
|
|
|
276
356
|
useLayoutEffect(() => {
|
|
277
357
|
measure();
|
|
278
358
|
}, [measure, textValue]);
|
|
279
|
-
|
|
359
|
+
useEffect2(() => {
|
|
280
360
|
if (typeof window === "undefined") {
|
|
281
361
|
return;
|
|
282
362
|
}
|
|
283
363
|
window.addEventListener("resize", measure);
|
|
284
364
|
return () => window.removeEventListener("resize", measure);
|
|
285
365
|
}, [measure]);
|
|
286
|
-
|
|
366
|
+
useEffect2(() => {
|
|
287
367
|
return () => {
|
|
288
368
|
if (copyTimerRef.current) {
|
|
289
369
|
window.clearTimeout(copyTimerRef.current);
|
|
@@ -34,7 +34,7 @@ export interface DropdownProps extends Omit<ComponentProps<"span">, "menu"> {
|
|
|
34
34
|
onOpenChange?: (open: boolean) => void;
|
|
35
35
|
children: ReactNode;
|
|
36
36
|
}
|
|
37
|
-
export type DropdownButtonProps = Omit<DropdownProps, "children" | "onClick" | keyof ButtonProps> & Omit<ButtonProps, "children" | "onClick"> & {
|
|
37
|
+
export type DropdownButtonProps = Omit<DropdownProps, "children" | "onClick" | keyof ButtonProps> & Omit<ButtonProps, "children" | "onClick" | "ref"> & {
|
|
38
38
|
buttonsRender?: (buttons: ReactNode[]) => ReactNode[];
|
|
39
39
|
children?: ReactNode;
|
|
40
40
|
onClick?: ButtonProps["onClick"];
|