@nexus-cross/design-system 1.0.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/cursor-rules/nexus-project-setup.mdc +292 -0
- package/cursor-rules/nexus-ui-api.mdc +698 -0
- package/cursor-rules/nexus-ui-components.mdc +136 -0
- package/dist/accordion.d.mts +28 -0
- package/dist/accordion.d.ts +28 -0
- package/dist/accordion.js +28 -0
- package/dist/accordion.mjs +3 -0
- package/dist/avatar.d.mts +17 -0
- package/dist/avatar.d.ts +17 -0
- package/dist/avatar.js +16 -0
- package/dist/avatar.mjs +3 -0
- package/dist/button.d.mts +17 -0
- package/dist/button.d.ts +17 -0
- package/dist/button.js +16 -0
- package/dist/button.mjs +3 -0
- package/dist/carousel.d.mts +36 -0
- package/dist/carousel.d.ts +36 -0
- package/dist/carousel.js +32 -0
- package/dist/carousel.mjs +3 -0
- package/dist/checkbox.d.mts +21 -0
- package/dist/checkbox.d.ts +21 -0
- package/dist/checkbox.js +20 -0
- package/dist/checkbox.mjs +3 -0
- package/dist/chip.d.mts +16 -0
- package/dist/chip.d.ts +16 -0
- package/dist/chip.js +16 -0
- package/dist/chip.mjs +3 -0
- package/dist/chunks/chunk-22ULI3BF.js +21 -0
- package/dist/chunks/chunk-26BUGBOY.mjs +57 -0
- package/dist/chunks/chunk-2JTPRBHZ.mjs +36 -0
- package/dist/chunks/chunk-2MC7XJSE.js +98 -0
- package/dist/chunks/chunk-2RPRCWKV.mjs +139 -0
- package/dist/chunks/chunk-2ZXDXO4I.js +166 -0
- package/dist/chunks/chunk-33UFQJIO.mjs +135 -0
- package/dist/chunks/chunk-3HHJORN7.mjs +137 -0
- package/dist/chunks/chunk-3PCNRCTB.js +61 -0
- package/dist/chunks/chunk-3VFBPFZF.mjs +640 -0
- package/dist/chunks/chunk-4J3GCZ7W.mjs +102 -0
- package/dist/chunks/chunk-54IA2P2Z.mjs +40 -0
- package/dist/chunks/chunk-54RBL7J4.mjs +179 -0
- package/dist/chunks/chunk-5JHJNN2K.js +83 -0
- package/dist/chunks/chunk-5JHN4FCY.mjs +58 -0
- package/dist/chunks/chunk-6FMDO6TT.mjs +114 -0
- package/dist/chunks/chunk-6H7V2I3X.mjs +270 -0
- package/dist/chunks/chunk-7AISZYWL.js +7 -0
- package/dist/chunks/chunk-7G65JBTN.js +133 -0
- package/dist/chunks/chunk-ADO7PDLY.mjs +66 -0
- package/dist/chunks/chunk-AFSEYJZT.js +267 -0
- package/dist/chunks/chunk-AOXXE5UQ.mjs +14 -0
- package/dist/chunks/chunk-AZ2URLDD.js +39 -0
- package/dist/chunks/chunk-B6G5TJRO.js +116 -0
- package/dist/chunks/chunk-BLGQHR3M.js +56 -0
- package/dist/chunks/chunk-BPUQ2CO2.mjs +48 -0
- package/dist/chunks/chunk-BSZ2LN6E.js +129 -0
- package/dist/chunks/chunk-CA3SOLI3.mjs +78 -0
- package/dist/chunks/chunk-CSJDDREF.js +90 -0
- package/dist/chunks/chunk-CVYXRSXT.mjs +8 -0
- package/dist/chunks/chunk-CZC76ZD5.js +10 -0
- package/dist/chunks/chunk-D6FII7HW.js +202 -0
- package/dist/chunks/chunk-DLFV7ZZV.js +112 -0
- package/dist/chunks/chunk-DO6VK2QQ.mjs +108 -0
- package/dist/chunks/chunk-ECVAVQUY.mjs +243 -0
- package/dist/chunks/chunk-EHAUUUWB.mjs +120 -0
- package/dist/chunks/chunk-EVOOTSY5.js +59 -0
- package/dist/chunks/chunk-GX6GSWX3.mjs +38 -0
- package/dist/chunks/chunk-HHXDOKXY.js +108 -0
- package/dist/chunks/chunk-HNLI646G.mjs +325 -0
- package/dist/chunks/chunk-HUPAHDJ7.js +273 -0
- package/dist/chunks/chunk-I252NERB.mjs +21 -0
- package/dist/chunks/chunk-IE4DGLMH.js +75 -0
- package/dist/chunks/chunk-INP2AH3B.js +27 -0
- package/dist/chunks/chunk-IOSIQLZL.js +70 -0
- package/dist/chunks/chunk-J5ZKGPBY.js +132 -0
- package/dist/chunks/chunk-JNMCYWGY.js +10 -0
- package/dist/chunks/chunk-LI7SFBUQ.mjs +89 -0
- package/dist/chunks/chunk-LMMON5AU.mjs +81 -0
- package/dist/chunks/chunk-LOQXCHKL.js +74 -0
- package/dist/chunks/chunk-MA2VCCIY.js +71 -0
- package/dist/chunks/chunk-MCKOWMLS.mjs +8 -0
- package/dist/chunks/chunk-MRRKW5QN.mjs +108 -0
- package/dist/chunks/chunk-MTX7GD3H.js +80 -0
- package/dist/chunks/chunk-NFIPQZ4O.js +100 -0
- package/dist/chunks/chunk-NHDGKOAM.js +104 -0
- package/dist/chunks/chunk-OMN5YQCE.js +143 -0
- package/dist/chunks/chunk-OTGS6BDQ.mjs +25 -0
- package/dist/chunks/chunk-P2T72N62.mjs +34 -0
- package/dist/chunks/chunk-P3DZKXG4.js +116 -0
- package/dist/chunks/chunk-QK6NCII4.js +36 -0
- package/dist/chunks/chunk-QZ4QR3XV.mjs +142 -0
- package/dist/chunks/chunk-RS3SBY3I.js +163 -0
- package/dist/chunks/chunk-RX5UKRYK.mjs +76 -0
- package/dist/chunks/chunk-SGNRVYYQ.mjs +99 -0
- package/dist/chunks/chunk-SJMCPSVH.mjs +76 -0
- package/dist/chunks/chunk-T2IY2TSR.js +43 -0
- package/dist/chunks/chunk-U53UA76K.js +653 -0
- package/dist/chunks/chunk-U56AGSLE.mjs +106 -0
- package/dist/chunks/chunk-ULGYTBCT.mjs +47 -0
- package/dist/chunks/chunk-V5OTJP6H.mjs +5 -0
- package/dist/chunks/chunk-VGO4Z2WH.js +336 -0
- package/dist/chunks/chunk-VIGRCJAE.mjs +37 -0
- package/dist/chunks/chunk-VVXQZ4XH.mjs +93 -0
- package/dist/chunks/chunk-W4GG5A7K.mjs +51 -0
- package/dist/chunks/chunk-WKCXACMZ.js +99 -0
- package/dist/chunks/chunk-WR55D4ZS.js +80 -0
- package/dist/chunks/chunk-X2SHTVZQ.js +89 -0
- package/dist/chunks/chunk-XEHFB62A.js +82 -0
- package/dist/chunks/chunk-XG6QG65W.mjs +63 -0
- package/dist/chunks/chunk-YB5ZKHVB.js +64 -0
- package/dist/chunks/chunk-YCG4FZC3.js +167 -0
- package/dist/chunks/chunk-YEWKPWK3.mjs +80 -0
- package/dist/chunks/chunk-YLO4UKSC.mjs +48 -0
- package/dist/chunks/chunk-YZV6FWE7.js +160 -0
- package/dist/chunks/chunk-ZWSIIGA3.mjs +58 -0
- package/dist/client-only.d.mts +13 -0
- package/dist/client-only.d.ts +13 -0
- package/dist/client-only.js +11 -0
- package/dist/client-only.mjs +2 -0
- package/dist/countdown.d.mts +27 -0
- package/dist/countdown.d.ts +27 -0
- package/dist/countdown.js +16 -0
- package/dist/countdown.mjs +3 -0
- package/dist/counter.d.mts +15 -0
- package/dist/counter.d.ts +15 -0
- package/dist/counter.js +11 -0
- package/dist/counter.mjs +2 -0
- package/dist/data-list.d.mts +33 -0
- package/dist/data-list.d.ts +33 -0
- package/dist/data-list.js +14 -0
- package/dist/data-list.mjs +5 -0
- package/dist/divider.d.mts +14 -0
- package/dist/divider.d.ts +14 -0
- package/dist/divider.js +16 -0
- package/dist/divider.mjs +3 -0
- package/dist/drawer.d.mts +42 -0
- package/dist/drawer.d.ts +42 -0
- package/dist/drawer.js +44 -0
- package/dist/drawer.mjs +3 -0
- package/dist/ellipsis.d.mts +16 -0
- package/dist/ellipsis.d.ts +16 -0
- package/dist/ellipsis.js +12 -0
- package/dist/ellipsis.mjs +3 -0
- package/dist/error-boundary.d.mts +20 -0
- package/dist/error-boundary.d.ts +20 -0
- package/dist/error-boundary.js +11 -0
- package/dist/error-boundary.mjs +2 -0
- package/dist/hooks/useCheckDevice.d.mts +47 -0
- package/dist/hooks/useCheckDevice.d.ts +47 -0
- package/dist/hooks/useCheckDevice.js +8 -0
- package/dist/hooks/useCheckDevice.mjs +2 -0
- package/dist/hooks/useClickOutside.d.mts +12 -0
- package/dist/hooks/useClickOutside.d.ts +12 -0
- package/dist/hooks/useClickOutside.js +8 -0
- package/dist/hooks/useClickOutside.mjs +2 -0
- package/dist/hooks/useDraggableBottomSheet.d.mts +24 -0
- package/dist/hooks/useDraggableBottomSheet.d.ts +24 -0
- package/dist/hooks/useDraggableBottomSheet.js +11 -0
- package/dist/hooks/useDraggableBottomSheet.mjs +2 -0
- package/dist/hooks/useDraggableWindow.d.mts +21 -0
- package/dist/hooks/useDraggableWindow.d.ts +21 -0
- package/dist/hooks/useDraggableWindow.js +11 -0
- package/dist/hooks/useDraggableWindow.mjs +2 -0
- package/dist/hooks/useInView.d.mts +14 -0
- package/dist/hooks/useInView.d.ts +14 -0
- package/dist/hooks/useInView.js +17 -0
- package/dist/hooks/useInView.mjs +2 -0
- package/dist/hooks/useModal.d.mts +2 -0
- package/dist/hooks/useModal.d.ts +2 -0
- package/dist/hooks/useModal.js +11 -0
- package/dist/hooks/useModal.mjs +2 -0
- package/dist/index.d.mts +76 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +746 -0
- package/dist/index.mjs +328 -0
- package/dist/infinite-scroll.d.mts +26 -0
- package/dist/infinite-scroll.d.ts +26 -0
- package/dist/infinite-scroll.js +12 -0
- package/dist/infinite-scroll.mjs +3 -0
- package/dist/marquee.d.mts +12 -0
- package/dist/marquee.d.ts +12 -0
- package/dist/marquee.js +12 -0
- package/dist/marquee.mjs +3 -0
- package/dist/modal/index.d.mts +87 -0
- package/dist/modal/index.d.ts +87 -0
- package/dist/modal/index.js +54 -0
- package/dist/modal/index.mjs +9 -0
- package/dist/number-input.d.mts +38 -0
- package/dist/number-input.d.ts +38 -0
- package/dist/number-input.js +20 -0
- package/dist/number-input.mjs +3 -0
- package/dist/pagination.d.mts +22 -0
- package/dist/pagination.d.ts +22 -0
- package/dist/pagination.js +20 -0
- package/dist/pagination.mjs +3 -0
- package/dist/popover.d.mts +25 -0
- package/dist/popover.d.ts +25 -0
- package/dist/popover.js +32 -0
- package/dist/popover.mjs +3 -0
- package/dist/radio-group.d.mts +29 -0
- package/dist/radio-group.d.ts +29 -0
- package/dist/radio-group.js +24 -0
- package/dist/radio-group.mjs +3 -0
- package/dist/schemas/_all.json +2250 -0
- package/dist/schemas/accordion.json +101 -0
- package/dist/schemas/avatar.json +55 -0
- package/dist/schemas/button.json +71 -0
- package/dist/schemas/carousel.json +32 -0
- package/dist/schemas/carouselButton.json +20 -0
- package/dist/schemas/carouselDots.json +17 -0
- package/dist/schemas/carouselSlide.json +20 -0
- package/dist/schemas/checkBox.json +57 -0
- package/dist/schemas/chip.json +49 -0
- package/dist/schemas/clientOnly.json +19 -0
- package/dist/schemas/countdown.json +58 -0
- package/dist/schemas/counter.json +57 -0
- package/dist/schemas/dataList.json +56 -0
- package/dist/schemas/divider.json +40 -0
- package/dist/schemas/drawer.json +27 -0
- package/dist/schemas/drawerContent.json +50 -0
- package/dist/schemas/ellipsis.json +49 -0
- package/dist/schemas/errorBoundary.json +22 -0
- package/dist/schemas/infiniteScroll.json +65 -0
- package/dist/schemas/marquee.json +46 -0
- package/dist/schemas/modalCall.json +21 -0
- package/dist/schemas/modalTemplate.json +123 -0
- package/dist/schemas/numberInput.json +77 -0
- package/dist/schemas/pagination.json +50 -0
- package/dist/schemas/popover.json +67 -0
- package/dist/schemas/radioGroup.json +61 -0
- package/dist/schemas/radioItem.json +35 -0
- package/dist/schemas/select.json +62 -0
- package/dist/schemas/selectItem.json +31 -0
- package/dist/schemas/skeleton.json +48 -0
- package/dist/schemas/spinner.json +27 -0
- package/dist/schemas/switch.json +41 -0
- package/dist/schemas/tab.json +89 -0
- package/dist/schemas/table.json +75 -0
- package/dist/schemas/tableRow.json +32 -0
- package/dist/schemas/tdColumn.json +107 -0
- package/dist/schemas/textArea.json +44 -0
- package/dist/schemas/textInput.json +67 -0
- package/dist/schemas/themeProvider.json +65 -0
- package/dist/schemas/toaster.json +31 -0
- package/dist/schemas/tooltip.json +67 -0
- package/dist/schemas/virtualGrid.json +59 -0
- package/dist/schemas/virtualList.json +54 -0
- package/dist/schemas.d.mts +1263 -0
- package/dist/schemas.d.ts +1263 -0
- package/dist/schemas.js +513 -0
- package/dist/schemas.mjs +469 -0
- package/dist/select.d.mts +31 -0
- package/dist/select.d.ts +31 -0
- package/dist/select.js +24 -0
- package/dist/select.mjs +3 -0
- package/dist/skeleton.d.mts +15 -0
- package/dist/skeleton.d.ts +15 -0
- package/dist/skeleton.js +12 -0
- package/dist/skeleton.mjs +3 -0
- package/dist/spinner.d.mts +9 -0
- package/dist/spinner.d.ts +9 -0
- package/dist/spinner.js +12 -0
- package/dist/spinner.mjs +3 -0
- package/dist/styles/layer.d.mts +3 -0
- package/dist/styles/layer.d.ts +3 -0
- package/dist/styles/layer.js +18 -0
- package/dist/styles/layer.mjs +16 -0
- package/dist/styles.css +2401 -0
- package/dist/styles.d.mts +3 -0
- package/dist/styles.d.ts +3 -0
- package/dist/styles.js +16 -0
- package/dist/styles.layered.css +2404 -0
- package/dist/styles.mjs +14 -0
- package/dist/switch.d.mts +15 -0
- package/dist/switch.d.ts +15 -0
- package/dist/switch.js +16 -0
- package/dist/switch.mjs +3 -0
- package/dist/tab.d.mts +36 -0
- package/dist/tab.d.ts +36 -0
- package/dist/tab.js +20 -0
- package/dist/tab.mjs +3 -0
- package/dist/table.d.mts +80 -0
- package/dist/table.d.ts +80 -0
- package/dist/table.js +33 -0
- package/dist/table.mjs +4 -0
- package/dist/text-area.d.mts +15 -0
- package/dist/text-area.d.ts +15 -0
- package/dist/text-area.js +16 -0
- package/dist/text-area.mjs +3 -0
- package/dist/text-input.d.mts +21 -0
- package/dist/text-input.d.ts +21 -0
- package/dist/text-input.js +16 -0
- package/dist/text-input.mjs +3 -0
- package/dist/theme-provider.d.mts +25 -0
- package/dist/theme-provider.d.ts +25 -0
- package/dist/theme-provider.js +15 -0
- package/dist/theme-provider.mjs +2 -0
- package/dist/toast.d.mts +42 -0
- package/dist/toast.d.ts +42 -0
- package/dist/toast.js +20 -0
- package/dist/toast.mjs +3 -0
- package/dist/tooltip.d.mts +24 -0
- package/dist/tooltip.d.ts +24 -0
- package/dist/tooltip.js +20 -0
- package/dist/tooltip.mjs +3 -0
- package/dist/useModal-BsGIcP8t.d.mts +128 -0
- package/dist/useModal-BsGIcP8t.d.ts +128 -0
- package/dist/utils/cn.d.mts +5 -0
- package/dist/utils/cn.d.ts +5 -0
- package/dist/utils/cn.js +11 -0
- package/dist/utils/cn.mjs +2 -0
- package/dist/utils/scroll.d.mts +4 -0
- package/dist/utils/scroll.d.ts +4 -0
- package/dist/utils/scroll.js +15 -0
- package/dist/utils/scroll.mjs +2 -0
- package/dist/virtual-scroll.d.mts +34 -0
- package/dist/virtual-scroll.d.ts +34 -0
- package/dist/virtual-scroll.js +16 -0
- package/dist/virtual-scroll.mjs +3 -0
- package/package.json +291 -0
- package/scripts/setup-cursor-rules.cjs +92 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { Skeleton } from './chunk-P2T72N62.mjs';
|
|
2
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
3
|
+
import { orderBy } from 'lodash-es';
|
|
4
|
+
import React, { createContext, useContext, useState, useCallback, useMemo, Children, isValidElement, Fragment } from 'react';
|
|
5
|
+
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
var TableHighlightContext = createContext({
|
|
9
|
+
highlightValue: null,
|
|
10
|
+
setHighlightValue: () => {
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var useTableHighlight = () => useContext(TableHighlightContext);
|
|
14
|
+
var TableHighlightProvider = ({ children }) => {
|
|
15
|
+
const [highlightValue, setHighlightValue] = useState(null);
|
|
16
|
+
return /* @__PURE__ */ jsx(TableHighlightContext.Provider, { value: { highlightValue, setHighlightValue }, children });
|
|
17
|
+
};
|
|
18
|
+
var ALIGN_CLASSES = {
|
|
19
|
+
center: "nexus-td--center",
|
|
20
|
+
left: "nexus-td--left",
|
|
21
|
+
right: "nexus-td--right"
|
|
22
|
+
};
|
|
23
|
+
var TEXT_OVERFLOW_CLASSES = {
|
|
24
|
+
auto: "nexus-td--nowrap",
|
|
25
|
+
truncate: "nexus-td--truncate",
|
|
26
|
+
wrap: "nexus-td--wrap",
|
|
27
|
+
"break-all": "nexus-td--break-all"
|
|
28
|
+
};
|
|
29
|
+
var TdColumn = ({
|
|
30
|
+
className = "",
|
|
31
|
+
children,
|
|
32
|
+
fieldId,
|
|
33
|
+
size,
|
|
34
|
+
colSpan,
|
|
35
|
+
rowSpan,
|
|
36
|
+
align = "left",
|
|
37
|
+
textOverflow = "truncate",
|
|
38
|
+
highlightKey
|
|
39
|
+
}) => {
|
|
40
|
+
const { highlightValue, setHighlightValue } = useTableHighlight();
|
|
41
|
+
const isHighlighted = !!highlightKey && !!highlightValue && highlightKey === highlightValue;
|
|
42
|
+
const handleMouseEnter = useCallback(() => {
|
|
43
|
+
if (highlightKey) setHighlightValue(highlightKey);
|
|
44
|
+
}, [highlightKey, setHighlightValue]);
|
|
45
|
+
const handleMouseLeave = useCallback(() => {
|
|
46
|
+
if (highlightKey) setHighlightValue(null);
|
|
47
|
+
}, [highlightKey, setHighlightValue]);
|
|
48
|
+
const sizeStyle = size ? { width: typeof size === "number" ? `${size}px` : size, flex: `0 0 ${typeof size === "number" ? `${size}px` : size}` } : void 0;
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
"td",
|
|
51
|
+
{
|
|
52
|
+
className: cn("nexus-td", fieldId, className),
|
|
53
|
+
title: textOverflow === "truncate" && typeof children === "string" ? children : void 0,
|
|
54
|
+
colSpan,
|
|
55
|
+
rowSpan,
|
|
56
|
+
style: sizeStyle,
|
|
57
|
+
onMouseEnter: handleMouseEnter,
|
|
58
|
+
onMouseLeave: handleMouseLeave,
|
|
59
|
+
children: /* @__PURE__ */ jsx(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: cn(
|
|
63
|
+
typeof children !== "string" && "nexus-td__inner--flex",
|
|
64
|
+
TEXT_OVERFLOW_CLASSES[textOverflow],
|
|
65
|
+
ALIGN_CLASSES[align],
|
|
66
|
+
"nexus-td__inner",
|
|
67
|
+
isHighlighted && "nexus-td__inner--highlight"
|
|
68
|
+
),
|
|
69
|
+
children
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
TdColumn.displayName = "TdColumn";
|
|
76
|
+
var tableRowVariants = cva("nexus-table-row", {
|
|
77
|
+
variants: {
|
|
78
|
+
variant: {
|
|
79
|
+
default: "nexus-table-row--default",
|
|
80
|
+
accent: "nexus-table-row--accent"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
defaultVariants: { variant: "default" }
|
|
84
|
+
});
|
|
85
|
+
var TableRow = ({ className = "", children, onClick, variant = "default" }) => {
|
|
86
|
+
const columnList = useMemo(() => {
|
|
87
|
+
const getChildren = (childArray) => {
|
|
88
|
+
return childArray.flatMap((child) => {
|
|
89
|
+
if (!React.isValidElement(child)) return [];
|
|
90
|
+
const childType = child.type;
|
|
91
|
+
if (childType?.displayName === "TdColumn") {
|
|
92
|
+
return child;
|
|
93
|
+
}
|
|
94
|
+
const childProps = child.props;
|
|
95
|
+
if (Array.isArray(childProps?.children)) {
|
|
96
|
+
return getChildren(childProps.children);
|
|
97
|
+
}
|
|
98
|
+
return [];
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
const childList = Array.isArray(children) ? children : [children];
|
|
102
|
+
return getChildren(childList);
|
|
103
|
+
}, [children]);
|
|
104
|
+
return /* @__PURE__ */ jsx("tr", { className: cn(tableRowVariants({ variant }), className), onClick, children: columnList });
|
|
105
|
+
};
|
|
106
|
+
TableRow.displayName = "TableRow";
|
|
107
|
+
var DefaultSortIcon = ({ direction }) => /* @__PURE__ */ jsxs("svg", { className: "nexus-table-sort-icon", viewBox: "0 0 16 16", fill: "currentColor", children: [
|
|
108
|
+
direction === "asc" && /* @__PURE__ */ jsx("path", { d: "M8 4l4 5H4z" }),
|
|
109
|
+
direction === "desc" && /* @__PURE__ */ jsx("path", { d: "M8 12l4-5H4z" }),
|
|
110
|
+
direction === "default" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
111
|
+
/* @__PURE__ */ jsx("path", { d: "M8 4l3 3.5H5z", opacity: 0.3 }),
|
|
112
|
+
/* @__PURE__ */ jsx("path", { d: "M8 12l3-3.5H5z", opacity: 0.3 })
|
|
113
|
+
] })
|
|
114
|
+
] });
|
|
115
|
+
var findTdColumns = (children) => {
|
|
116
|
+
let result = [];
|
|
117
|
+
Children.forEach(children, (child) => {
|
|
118
|
+
if (isValidElement(child)) {
|
|
119
|
+
if (child.type === Fragment) {
|
|
120
|
+
result = [...result, ...findTdColumns(child.props.children)];
|
|
121
|
+
} else if (child.type === TdColumn || child.type?.displayName === "TdColumn") {
|
|
122
|
+
result.push(child);
|
|
123
|
+
} else {
|
|
124
|
+
result = [...result, ...findTdColumns(child?.props?.children)];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return result;
|
|
129
|
+
};
|
|
130
|
+
var findTrRow = (children) => {
|
|
131
|
+
let result = null;
|
|
132
|
+
Children.forEach(children, (child) => {
|
|
133
|
+
if (isValidElement(child)) {
|
|
134
|
+
if (child.type === TableRow || child.type?.displayName === "TableRow") {
|
|
135
|
+
result = child;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return result;
|
|
140
|
+
};
|
|
141
|
+
var ALIGN_CLASSES2 = {
|
|
142
|
+
center: "nexus-td--center",
|
|
143
|
+
left: "nexus-td--left",
|
|
144
|
+
right: "nexus-td--right"
|
|
145
|
+
};
|
|
146
|
+
var DefaultNoData = () => /* @__PURE__ */ jsx("div", { className: "nexus-table-center nexus-table-nodata", children: "No data available." });
|
|
147
|
+
var DefaultLoading = () => /* @__PURE__ */ jsx("div", { className: "nexus-table-center", children: /* @__PURE__ */ jsx("div", { className: "nexus-table-loading-icon" }) });
|
|
148
|
+
function Table({
|
|
149
|
+
className = "",
|
|
150
|
+
theadClassName = "",
|
|
151
|
+
list,
|
|
152
|
+
children,
|
|
153
|
+
loadingElement,
|
|
154
|
+
noDataMsg,
|
|
155
|
+
hideThead,
|
|
156
|
+
sortUpElement = /* @__PURE__ */ jsx(DefaultSortIcon, { direction: "asc" }),
|
|
157
|
+
sortDownElement = /* @__PURE__ */ jsx(DefaultSortIcon, { direction: "desc" }),
|
|
158
|
+
loadingType = "skeleton",
|
|
159
|
+
loading,
|
|
160
|
+
skeletonCount = 10,
|
|
161
|
+
notification
|
|
162
|
+
}) {
|
|
163
|
+
const [isSorting, setIsSorting] = useState(false);
|
|
164
|
+
const [orderData, setOrderData] = useState(null);
|
|
165
|
+
const tdColumns = useMemo(() => {
|
|
166
|
+
const item = (list || []).length > 0 ? list?.[0] : {};
|
|
167
|
+
return findTdColumns(children({ item, index: 0 }));
|
|
168
|
+
}, [children, list]);
|
|
169
|
+
const trRow = useMemo(() => {
|
|
170
|
+
const item = (list || []).length > 0 ? list?.[0] : {};
|
|
171
|
+
return findTrRow(children({ item, index: 0 }));
|
|
172
|
+
}, [children, list]);
|
|
173
|
+
const thRowData = useMemo(() => {
|
|
174
|
+
const thRows = tdColumns?.map((column) => {
|
|
175
|
+
const component = column;
|
|
176
|
+
const tdClassName = component?.props?.className;
|
|
177
|
+
const widthClassName = tdClassName?.match(
|
|
178
|
+
/(fold:|mobile-sm:|tablet:|desktop-sm:|desktop:|desktop-lg:|wide-desktop:|xs:|sm:|md:|lg:|xl:|2xl:)?(w-\[[0-9]+(\.[0-9]+)?px\]|w-full|w-\d+\/\d+|w-\d+|min-w-[^\s"]+|max-w-[^\s"]+)/g
|
|
179
|
+
);
|
|
180
|
+
return {
|
|
181
|
+
className: component.props?.className ?? "",
|
|
182
|
+
label: component.props?.label ?? "",
|
|
183
|
+
fieldId: component.props?.fieldId,
|
|
184
|
+
enableSorting: typeof component.props?.sortValue !== "undefined" || !!component.props?.handleClickSort,
|
|
185
|
+
handleClickSort: component.props?.handleClickSort,
|
|
186
|
+
thColSpan: component.props?.thColSpan,
|
|
187
|
+
thRowSpan: component.props?.thRowSpan,
|
|
188
|
+
rowSpan: component.props?.rowSpan,
|
|
189
|
+
colSpan: component.props?.colSpan,
|
|
190
|
+
size: component.props?.size,
|
|
191
|
+
widthClassName: widthClassName && widthClassName.join(" "),
|
|
192
|
+
align: component.props?.align ?? "left",
|
|
193
|
+
order: component.props?.order ?? ""
|
|
194
|
+
};
|
|
195
|
+
});
|
|
196
|
+
if (thRows) {
|
|
197
|
+
return thRows.filter((th) => typeof th.label !== "undefined").map((th) => {
|
|
198
|
+
if (!orderData?.fieldId) return th;
|
|
199
|
+
return {
|
|
200
|
+
...th,
|
|
201
|
+
order: orderData.fieldId === th.fieldId ? orderData.order : ""
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return [];
|
|
206
|
+
}, [tdColumns, orderData]);
|
|
207
|
+
const skeletonRows = useMemo(() => {
|
|
208
|
+
const trRowComponent = trRow;
|
|
209
|
+
return Array.from({ length: skeletonCount }, (_, trIndex) => /* @__PURE__ */ jsx(
|
|
210
|
+
"tr",
|
|
211
|
+
{
|
|
212
|
+
className: cn(trRowComponent?.props?.className, "nexus-table-skeleton-row"),
|
|
213
|
+
children: thRowData?.map((thData, tdIndex) => /* @__PURE__ */ jsx(
|
|
214
|
+
"td",
|
|
215
|
+
{
|
|
216
|
+
className: cn(thData.widthClassName, "nexus-table-skeleton-td"),
|
|
217
|
+
style: thData.size ? {
|
|
218
|
+
width: typeof thData.size === "number" ? `${thData.size}px` : thData.size,
|
|
219
|
+
flex: `0 0 ${typeof thData.size === "number" ? `${thData.size}px` : thData.size}`
|
|
220
|
+
} : void 0,
|
|
221
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: "nexus-table-skeleton-bar" })
|
|
222
|
+
},
|
|
223
|
+
`skeleton-td-${tdIndex}`
|
|
224
|
+
))
|
|
225
|
+
},
|
|
226
|
+
`skeleton-tr-${trIndex}`
|
|
227
|
+
));
|
|
228
|
+
}, [skeletonCount, thRowData, trRow]);
|
|
229
|
+
const tableRows = useMemo(() => {
|
|
230
|
+
const { fieldId: orderTargetFieldId, order } = orderData ?? {};
|
|
231
|
+
if (!order) return list;
|
|
232
|
+
const componentList = list?.map(
|
|
233
|
+
(item, index) => Children.map(
|
|
234
|
+
children({ item, index }),
|
|
235
|
+
(child) => {
|
|
236
|
+
if (isValidElement(child)) {
|
|
237
|
+
if (child.type === TdColumn) return child;
|
|
238
|
+
return Children.toArray(child.props.children);
|
|
239
|
+
}
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
);
|
|
244
|
+
const sortValueList = componentList?.reduce((acc, cur) => {
|
|
245
|
+
const columns = cur;
|
|
246
|
+
const target = columns?.find((col) => col?.props?.fieldId === orderTargetFieldId);
|
|
247
|
+
acc.push(target?.props?.sortValue ?? 0);
|
|
248
|
+
return acc;
|
|
249
|
+
}, []);
|
|
250
|
+
return orderBy(
|
|
251
|
+
list?.map((item, index) => ({ ...item, sortValue: sortValueList?.[index] })),
|
|
252
|
+
["sortValue"],
|
|
253
|
+
[order]
|
|
254
|
+
);
|
|
255
|
+
}, [list, orderData, children]);
|
|
256
|
+
const handleThSorting = async (thData) => {
|
|
257
|
+
let newOrder = "desc";
|
|
258
|
+
const { order, index, fieldId, enableSorting, handleClickSort } = thData;
|
|
259
|
+
if (!enableSorting || isSorting) return;
|
|
260
|
+
if (order === "desc") newOrder = "asc";
|
|
261
|
+
else if (order === "asc") newOrder = "";
|
|
262
|
+
const newOrderData = { index, order: newOrder, fieldId: fieldId ?? "" };
|
|
263
|
+
setOrderData(newOrderData);
|
|
264
|
+
if (handleClickSort) {
|
|
265
|
+
try {
|
|
266
|
+
setIsSorting(true);
|
|
267
|
+
await handleClickSort(newOrderData);
|
|
268
|
+
} finally {
|
|
269
|
+
setIsSorting(false);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
return /* @__PURE__ */ jsx(TableHighlightProvider, { children: /* @__PURE__ */ jsx("div", { className: cn("nexus-table-wrap", className), children: /* @__PURE__ */ jsxs("table", { className: "nexus-table", children: [
|
|
274
|
+
!hideThead && /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { className: cn("nexus-table-thead", theadClassName), children: thRowData.map((thData, index) => /* @__PURE__ */ jsx(
|
|
275
|
+
"th",
|
|
276
|
+
{
|
|
277
|
+
rowSpan: thData.thRowSpan ?? thData.rowSpan,
|
|
278
|
+
colSpan: thData.thColSpan ?? thData.colSpan,
|
|
279
|
+
className: cn(
|
|
280
|
+
"nexus-table-th",
|
|
281
|
+
thData.enableSorting && "nexus-table-th--sortable",
|
|
282
|
+
ALIGN_CLASSES2[thData.align ?? "left"],
|
|
283
|
+
thData.widthClassName
|
|
284
|
+
),
|
|
285
|
+
style: thData.size ? {
|
|
286
|
+
width: typeof thData.size === "number" ? `${thData.size}px` : thData.size,
|
|
287
|
+
flex: `0 0 ${typeof thData.size === "number" ? `${thData.size}px` : thData.size}`
|
|
288
|
+
} : void 0,
|
|
289
|
+
children: thData.enableSorting ? /* @__PURE__ */ jsxs(
|
|
290
|
+
"button",
|
|
291
|
+
{
|
|
292
|
+
type: "button",
|
|
293
|
+
className: "nexus-table-th__sort-btn",
|
|
294
|
+
onClick: () => handleThSorting({ ...thData, index }),
|
|
295
|
+
onKeyDown: (e) => {
|
|
296
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
297
|
+
e.preventDefault();
|
|
298
|
+
handleThSorting({ ...thData, index });
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
"aria-label": `Sort by ${thData.label}${thData.order === "asc" ? ", ascending" : thData.order === "desc" ? ", descending" : ""}`,
|
|
302
|
+
children: [
|
|
303
|
+
thData.label,
|
|
304
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
305
|
+
thData.order !== "desc" && thData.order !== "asc" && /* @__PURE__ */ jsx(DefaultSortIcon, { direction: "default" }),
|
|
306
|
+
thData.order === "desc" && sortDownElement,
|
|
307
|
+
thData.order === "asc" && sortUpElement
|
|
308
|
+
] })
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
) : thData.label
|
|
312
|
+
},
|
|
313
|
+
`th-${thData.fieldId ?? index}`
|
|
314
|
+
)) }) }),
|
|
315
|
+
notification && /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: thRowData.length || 1, children: notification }) }) }),
|
|
316
|
+
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
317
|
+
(!list || isSorting || loading) && (loadingType === "loading" ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: thRowData.length, children: /* @__PURE__ */ jsx("div", { children: loadingElement ?? /* @__PURE__ */ jsx(DefaultLoading, {}) }) }) }) : /* @__PURE__ */ jsx(Fragment, { children: skeletonRows })),
|
|
318
|
+
!!list && !loading && !isSorting && (list.length > 0 ? tableRows?.map(
|
|
319
|
+
(item, index) => children({ item, index })
|
|
320
|
+
) : /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: thRowData.length, children: noDataMsg && typeof noDataMsg === "object" ? noDataMsg : /* @__PURE__ */ jsx(DefaultNoData, {}) }) }))
|
|
321
|
+
] })
|
|
322
|
+
] }) }) });
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export { Table, TableHighlightProvider, TableRow, TdColumn, tableRowVariants, useTableHighlight };
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var lodashEs = require('lodash-es');
|
|
5
|
+
|
|
6
|
+
// src/hooks/useModal.ts
|
|
7
|
+
|
|
8
|
+
// src/modal/constants.ts
|
|
9
|
+
var defaultModalOption = {
|
|
10
|
+
animation: { name: "pop-fade", duration: 300 },
|
|
11
|
+
dimCloseEnable: true
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/modal/Modal.ts
|
|
15
|
+
var Modal = class {
|
|
16
|
+
constructor() {
|
|
17
|
+
this._modalList = [];
|
|
18
|
+
this.defaultOption = { ...defaultModalOption };
|
|
19
|
+
this.observeFunction = null;
|
|
20
|
+
this.enableKeyDownEvent = true;
|
|
21
|
+
this.handleKeyPressEvent = (e) => {
|
|
22
|
+
if (e.code === "Escape" && this.enableKeyDownEvent) {
|
|
23
|
+
const lastModal = this.modalList[this.modalList.length - 1];
|
|
24
|
+
if (!lastModal.props.disableEscapeKeyPress) {
|
|
25
|
+
this.closeModal(lastModal.id, true);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
set modalList(value) {
|
|
31
|
+
const newModalList = [...value];
|
|
32
|
+
this._modalList = newModalList;
|
|
33
|
+
this.observeFunction?.(newModalList);
|
|
34
|
+
if (newModalList.length === 1) {
|
|
35
|
+
window.addEventListener("keyup", this.handleKeyPressEvent);
|
|
36
|
+
} else if (newModalList.length === 0) {
|
|
37
|
+
window.removeEventListener("keyup", this.handleKeyPressEvent);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
get modalList() {
|
|
41
|
+
return this._modalList;
|
|
42
|
+
}
|
|
43
|
+
checkModal(params) {
|
|
44
|
+
const { onlyLastCheck } = params;
|
|
45
|
+
const modalLength = this.modalList.length;
|
|
46
|
+
if ("componentName" in params) {
|
|
47
|
+
const { componentName } = params;
|
|
48
|
+
if (onlyLastCheck) {
|
|
49
|
+
return modalLength > 0 && !!componentName ? this.modalList[modalLength - 1].props.componentName === componentName : false;
|
|
50
|
+
}
|
|
51
|
+
return this.modalList.some(
|
|
52
|
+
(m) => m.props.componentName === componentName
|
|
53
|
+
);
|
|
54
|
+
} else {
|
|
55
|
+
const { modalId } = params;
|
|
56
|
+
if (onlyLastCheck) {
|
|
57
|
+
return modalLength > 0 && !!modalId ? this.modalList[modalLength - 1].props.id === modalId : false;
|
|
58
|
+
}
|
|
59
|
+
return this.modalList.some((m) => m.props.id === modalId);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
deleteModal(id) {
|
|
63
|
+
const findModal = this.modalList.find((m) => m.id === id);
|
|
64
|
+
if (!findModal) return;
|
|
65
|
+
const newModalList = this.modalList.filter((m) => m.id !== id);
|
|
66
|
+
this.modalList = newModalList;
|
|
67
|
+
findModal.props.onClose?.();
|
|
68
|
+
}
|
|
69
|
+
closeModal(id, isAnimation = true) {
|
|
70
|
+
const findModal = this.modalList.find((m) => m.id === id);
|
|
71
|
+
if (findModal) {
|
|
72
|
+
if (findModal.close) {
|
|
73
|
+
findModal.close(findModal.id, isAnimation);
|
|
74
|
+
} else {
|
|
75
|
+
this.deleteModal(id);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
resolveModal({
|
|
80
|
+
modal: modal2,
|
|
81
|
+
result,
|
|
82
|
+
useClose
|
|
83
|
+
}) {
|
|
84
|
+
modal2.resolve(result);
|
|
85
|
+
if (useClose) {
|
|
86
|
+
this.closeModal(modal2.id);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
resetModal() {
|
|
90
|
+
this.modalList = [];
|
|
91
|
+
}
|
|
92
|
+
makeProps(props) {
|
|
93
|
+
return {
|
|
94
|
+
...props || {},
|
|
95
|
+
animation: {
|
|
96
|
+
...this.defaultOption.animation,
|
|
97
|
+
...props?.animation || {}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
handleToggle(modal2) {
|
|
102
|
+
const modalList = [...this.modalList];
|
|
103
|
+
const findModal = modalList.find(
|
|
104
|
+
(m) => m.component.name === modal2.component.name
|
|
105
|
+
);
|
|
106
|
+
if (findModal) {
|
|
107
|
+
if (findModal.close) {
|
|
108
|
+
findModal.close(findModal.id, true);
|
|
109
|
+
} else {
|
|
110
|
+
this.deleteModal(findModal.id);
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return [...modalList, modal2];
|
|
115
|
+
}
|
|
116
|
+
handleToggleOnlyOne(modal2) {
|
|
117
|
+
const modalList = [...this.modalList];
|
|
118
|
+
const findModal = modalList.find(
|
|
119
|
+
(m) => m.component.name === modal2.component.name
|
|
120
|
+
);
|
|
121
|
+
if (findModal) {
|
|
122
|
+
if (findModal.close) {
|
|
123
|
+
findModal.close(findModal.id, true);
|
|
124
|
+
} else {
|
|
125
|
+
this.deleteModal(findModal.id);
|
|
126
|
+
}
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
return [modal2];
|
|
130
|
+
}
|
|
131
|
+
openModal({
|
|
132
|
+
component,
|
|
133
|
+
props
|
|
134
|
+
}) {
|
|
135
|
+
return new Promise((resolve, reject) => {
|
|
136
|
+
const modal2 = {
|
|
137
|
+
id: "",
|
|
138
|
+
props: props ?? {},
|
|
139
|
+
component,
|
|
140
|
+
resolve,
|
|
141
|
+
reject
|
|
142
|
+
};
|
|
143
|
+
const prevModalList = [...this.modalList];
|
|
144
|
+
const componentName = props?.componentName ?? component.displayName ?? component.name;
|
|
145
|
+
modal2.id = props?.id || props?.portalId || lodashEs.uniqueId();
|
|
146
|
+
modal2.props = this.makeProps({
|
|
147
|
+
...props ?? {},
|
|
148
|
+
componentName
|
|
149
|
+
});
|
|
150
|
+
let newModalList = [...prevModalList, modal2];
|
|
151
|
+
if (modal2.props.isToggle && modal2.props.isAlone) {
|
|
152
|
+
newModalList = this.handleToggleOnlyOne(modal2);
|
|
153
|
+
} else if (modal2.props.isToggle) {
|
|
154
|
+
newModalList = this.handleToggle(modal2);
|
|
155
|
+
} else if (modal2.props.isAlone) {
|
|
156
|
+
newModalList = [modal2];
|
|
157
|
+
}
|
|
158
|
+
if (!modal2.props.isToggle && !modal2.props.isAlone) {
|
|
159
|
+
let duplicate = props?.id || props?.portalId ? this.checkModal({ modalId: modal2.id, onlyLastCheck: true }) : this.checkModal({ componentName, onlyLastCheck: true });
|
|
160
|
+
if (props?.duplicateCheck) {
|
|
161
|
+
duplicate = props?.id || props?.portalId ? this.checkModal({ modalId: modal2.id }) : this.checkModal({ componentName });
|
|
162
|
+
}
|
|
163
|
+
if (duplicate) return;
|
|
164
|
+
}
|
|
165
|
+
if (newModalList) {
|
|
166
|
+
this.enableKeyDownEvent = false;
|
|
167
|
+
this.modalList = newModalList;
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
this.enableKeyDownEvent = true;
|
|
170
|
+
}, 500);
|
|
171
|
+
}
|
|
172
|
+
if (modal2.props.onOpen) {
|
|
173
|
+
modal2.props.onOpen({ ...modal2 });
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
getDefaultOption() {
|
|
178
|
+
return this.defaultOption;
|
|
179
|
+
}
|
|
180
|
+
observe({
|
|
181
|
+
options = {},
|
|
182
|
+
observeFunction
|
|
183
|
+
}) {
|
|
184
|
+
this.defaultOption = { ...defaultModalOption, ...options };
|
|
185
|
+
this.observeFunction = observeFunction;
|
|
186
|
+
if (this._modalList.length > 0) {
|
|
187
|
+
this.observeFunction(this._modalList);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
unobserve() {
|
|
191
|
+
this.observeFunction = null;
|
|
192
|
+
this.defaultOption = {};
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var modal = new Modal();
|
|
196
|
+
var Modal_default = modal;
|
|
197
|
+
|
|
198
|
+
// src/hooks/useModal.ts
|
|
199
|
+
function callOpenModal(params, extraOptions) {
|
|
200
|
+
const { component, props = {}, options = {} } = params;
|
|
201
|
+
return Modal_default.openModal({
|
|
202
|
+
component,
|
|
203
|
+
props: {
|
|
204
|
+
...props,
|
|
205
|
+
...options,
|
|
206
|
+
...extraOptions
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function useModal() {
|
|
211
|
+
const modal2 = react.useMemo(() => {
|
|
212
|
+
const fn = ((params) => callOpenModal(params));
|
|
213
|
+
fn.close = (id, isAnimation) => {
|
|
214
|
+
Modal_default.closeModal(id, isAnimation);
|
|
215
|
+
};
|
|
216
|
+
fn.check = (params) => {
|
|
217
|
+
return Modal_default.checkModal(params);
|
|
218
|
+
};
|
|
219
|
+
fn.reset = () => {
|
|
220
|
+
Modal_default.resetModal();
|
|
221
|
+
};
|
|
222
|
+
return fn;
|
|
223
|
+
}, []);
|
|
224
|
+
const toggleModal = react.useCallback(
|
|
225
|
+
(params) => {
|
|
226
|
+
return callOpenModal(params, {
|
|
227
|
+
scrollEnable: params.options?.scrollEnable ?? true,
|
|
228
|
+
isToggle: true
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
[]
|
|
232
|
+
);
|
|
233
|
+
const toggleOneModal = react.useCallback(
|
|
234
|
+
(params) => {
|
|
235
|
+
return callOpenModal(params, {
|
|
236
|
+
scrollEnable: params.options?.scrollEnable ?? true,
|
|
237
|
+
isToggle: true,
|
|
238
|
+
isAlone: true
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
[]
|
|
242
|
+
);
|
|
243
|
+
const scrollModal = react.useCallback(
|
|
244
|
+
(params) => {
|
|
245
|
+
return callOpenModal(params, { scrollEnable: true });
|
|
246
|
+
},
|
|
247
|
+
[]
|
|
248
|
+
);
|
|
249
|
+
const closeModal = react.useCallback((id, isAnimation) => {
|
|
250
|
+
Modal_default.closeModal(id, isAnimation);
|
|
251
|
+
}, []);
|
|
252
|
+
const checkModal = react.useCallback(
|
|
253
|
+
(params) => {
|
|
254
|
+
return Modal_default.checkModal(params);
|
|
255
|
+
},
|
|
256
|
+
[]
|
|
257
|
+
);
|
|
258
|
+
const resetModal = react.useCallback(() => {
|
|
259
|
+
Modal_default.resetModal();
|
|
260
|
+
}, []);
|
|
261
|
+
return {
|
|
262
|
+
modal: modal2,
|
|
263
|
+
toggleModal,
|
|
264
|
+
toggleOneModal,
|
|
265
|
+
scrollModal,
|
|
266
|
+
closeModal,
|
|
267
|
+
checkModal,
|
|
268
|
+
resetModal
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
exports.Modal_default = Modal_default;
|
|
273
|
+
exports.useModal = useModal;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __require } from './chunk-CVYXRSXT.mjs';
|
|
2
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var ThemeProvider = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
|
|
5
|
+
var useTheme = () => ({
|
|
6
|
+
theme: void 0,
|
|
7
|
+
setTheme: () => {
|
|
8
|
+
},
|
|
9
|
+
resolvedTheme: void 0,
|
|
10
|
+
themes: [],
|
|
11
|
+
systemTheme: void 0,
|
|
12
|
+
forcedTheme: void 0
|
|
13
|
+
});
|
|
14
|
+
try {
|
|
15
|
+
const nextThemes = __require("next-themes");
|
|
16
|
+
ThemeProvider = nextThemes.ThemeProvider;
|
|
17
|
+
useTheme = nextThemes.useTheme;
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { ThemeProvider, useTheme };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
|
|
4
|
+
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
5
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
27
|
+
|
|
28
|
+
var tooltipContentVariants = classVarianceAuthority.cva("nexus-tooltip-content", {
|
|
29
|
+
variants: {
|
|
30
|
+
variant: {
|
|
31
|
+
light: "nexus-tooltip--light",
|
|
32
|
+
dark: "nexus-tooltip--dark"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: { variant: "dark" }
|
|
36
|
+
});
|
|
37
|
+
var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
38
|
+
var Tooltip = ({
|
|
39
|
+
children,
|
|
40
|
+
content,
|
|
41
|
+
side = "top",
|
|
42
|
+
align = "center",
|
|
43
|
+
delayDuration = 200,
|
|
44
|
+
disabled = false,
|
|
45
|
+
variant = "dark",
|
|
46
|
+
triggerClassName = "",
|
|
47
|
+
className = ""
|
|
48
|
+
}) => {
|
|
49
|
+
if (disabled) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipPrimitive__namespace.Root, { children: [
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Trigger, { asChild: true, className: chunkCZC76ZD5_js.cn("nexus-tooltip-trigger", triggerClassName), children: /* @__PURE__ */ jsxRuntime.jsx("span", { children }) }),
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
53
|
+
TooltipPrimitive__namespace.Content,
|
|
54
|
+
{
|
|
55
|
+
side,
|
|
56
|
+
align,
|
|
57
|
+
className: chunkCZC76ZD5_js.cn(tooltipContentVariants({ variant }), className),
|
|
58
|
+
sideOffset: 4,
|
|
59
|
+
children: [
|
|
60
|
+
content,
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
62
|
+
TooltipPrimitive__namespace.Arrow,
|
|
63
|
+
{
|
|
64
|
+
className: variant === "dark" ? "nexus-tooltip-arrow--dark" : "nexus-tooltip-arrow--light"
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
) })
|
|
70
|
+
] }) });
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
exports.Tooltip = Tooltip;
|
|
74
|
+
exports.TooltipProvider = TooltipProvider;
|
|
75
|
+
exports.tooltipContentVariants = tooltipContentVariants;
|