@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,336 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkBLGQHR3M_js = require('./chunk-BLGQHR3M.js');
|
|
4
|
+
var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
|
|
5
|
+
var lodashEs = require('lodash-es');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
9
|
+
|
|
10
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
|
+
|
|
14
|
+
var TableHighlightContext = React.createContext({
|
|
15
|
+
highlightValue: null,
|
|
16
|
+
setHighlightValue: () => {
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var useTableHighlight = () => React.useContext(TableHighlightContext);
|
|
20
|
+
var TableHighlightProvider = ({ children }) => {
|
|
21
|
+
const [highlightValue, setHighlightValue] = React.useState(null);
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableHighlightContext.Provider, { value: { highlightValue, setHighlightValue }, children });
|
|
23
|
+
};
|
|
24
|
+
var ALIGN_CLASSES = {
|
|
25
|
+
center: "nexus-td--center",
|
|
26
|
+
left: "nexus-td--left",
|
|
27
|
+
right: "nexus-td--right"
|
|
28
|
+
};
|
|
29
|
+
var TEXT_OVERFLOW_CLASSES = {
|
|
30
|
+
auto: "nexus-td--nowrap",
|
|
31
|
+
truncate: "nexus-td--truncate",
|
|
32
|
+
wrap: "nexus-td--wrap",
|
|
33
|
+
"break-all": "nexus-td--break-all"
|
|
34
|
+
};
|
|
35
|
+
var TdColumn = ({
|
|
36
|
+
className = "",
|
|
37
|
+
children,
|
|
38
|
+
fieldId,
|
|
39
|
+
size,
|
|
40
|
+
colSpan,
|
|
41
|
+
rowSpan,
|
|
42
|
+
align = "left",
|
|
43
|
+
textOverflow = "truncate",
|
|
44
|
+
highlightKey
|
|
45
|
+
}) => {
|
|
46
|
+
const { highlightValue, setHighlightValue } = useTableHighlight();
|
|
47
|
+
const isHighlighted = !!highlightKey && !!highlightValue && highlightKey === highlightValue;
|
|
48
|
+
const handleMouseEnter = React.useCallback(() => {
|
|
49
|
+
if (highlightKey) setHighlightValue(highlightKey);
|
|
50
|
+
}, [highlightKey, setHighlightValue]);
|
|
51
|
+
const handleMouseLeave = React.useCallback(() => {
|
|
52
|
+
if (highlightKey) setHighlightValue(null);
|
|
53
|
+
}, [highlightKey, setHighlightValue]);
|
|
54
|
+
const sizeStyle = size ? { width: typeof size === "number" ? `${size}px` : size, flex: `0 0 ${typeof size === "number" ? `${size}px` : size}` } : void 0;
|
|
55
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
"td",
|
|
57
|
+
{
|
|
58
|
+
className: chunkCZC76ZD5_js.cn("nexus-td", fieldId, className),
|
|
59
|
+
title: textOverflow === "truncate" && typeof children === "string" ? children : void 0,
|
|
60
|
+
colSpan,
|
|
61
|
+
rowSpan,
|
|
62
|
+
style: sizeStyle,
|
|
63
|
+
onMouseEnter: handleMouseEnter,
|
|
64
|
+
onMouseLeave: handleMouseLeave,
|
|
65
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
className: chunkCZC76ZD5_js.cn(
|
|
69
|
+
typeof children !== "string" && "nexus-td__inner--flex",
|
|
70
|
+
TEXT_OVERFLOW_CLASSES[textOverflow],
|
|
71
|
+
ALIGN_CLASSES[align],
|
|
72
|
+
"nexus-td__inner",
|
|
73
|
+
isHighlighted && "nexus-td__inner--highlight"
|
|
74
|
+
),
|
|
75
|
+
children
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
TdColumn.displayName = "TdColumn";
|
|
82
|
+
var tableRowVariants = classVarianceAuthority.cva("nexus-table-row", {
|
|
83
|
+
variants: {
|
|
84
|
+
variant: {
|
|
85
|
+
default: "nexus-table-row--default",
|
|
86
|
+
accent: "nexus-table-row--accent"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
defaultVariants: { variant: "default" }
|
|
90
|
+
});
|
|
91
|
+
var TableRow = ({ className = "", children, onClick, variant = "default" }) => {
|
|
92
|
+
const columnList = React.useMemo(() => {
|
|
93
|
+
const getChildren = (childArray) => {
|
|
94
|
+
return childArray.flatMap((child) => {
|
|
95
|
+
if (!React__default.default.isValidElement(child)) return [];
|
|
96
|
+
const childType = child.type;
|
|
97
|
+
if (childType?.displayName === "TdColumn") {
|
|
98
|
+
return child;
|
|
99
|
+
}
|
|
100
|
+
const childProps = child.props;
|
|
101
|
+
if (Array.isArray(childProps?.children)) {
|
|
102
|
+
return getChildren(childProps.children);
|
|
103
|
+
}
|
|
104
|
+
return [];
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const childList = Array.isArray(children) ? children : [children];
|
|
108
|
+
return getChildren(childList);
|
|
109
|
+
}, [children]);
|
|
110
|
+
return /* @__PURE__ */ jsxRuntime.jsx("tr", { className: chunkCZC76ZD5_js.cn(tableRowVariants({ variant }), className), onClick, children: columnList });
|
|
111
|
+
};
|
|
112
|
+
TableRow.displayName = "TableRow";
|
|
113
|
+
var DefaultSortIcon = ({ direction }) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "nexus-table-sort-icon", viewBox: "0 0 16 16", fill: "currentColor", children: [
|
|
114
|
+
direction === "asc" && /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 4l4 5H4z" }),
|
|
115
|
+
direction === "desc" && /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 12l4-5H4z" }),
|
|
116
|
+
direction === "default" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 4l3 3.5H5z", opacity: 0.3 }),
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 12l3-3.5H5z", opacity: 0.3 })
|
|
119
|
+
] })
|
|
120
|
+
] });
|
|
121
|
+
var findTdColumns = (children) => {
|
|
122
|
+
let result = [];
|
|
123
|
+
React.Children.forEach(children, (child) => {
|
|
124
|
+
if (React.isValidElement(child)) {
|
|
125
|
+
if (child.type === React.Fragment) {
|
|
126
|
+
result = [...result, ...findTdColumns(child.props.children)];
|
|
127
|
+
} else if (child.type === TdColumn || child.type?.displayName === "TdColumn") {
|
|
128
|
+
result.push(child);
|
|
129
|
+
} else {
|
|
130
|
+
result = [...result, ...findTdColumns(child?.props?.children)];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
return result;
|
|
135
|
+
};
|
|
136
|
+
var findTrRow = (children) => {
|
|
137
|
+
let result = null;
|
|
138
|
+
React.Children.forEach(children, (child) => {
|
|
139
|
+
if (React.isValidElement(child)) {
|
|
140
|
+
if (child.type === TableRow || child.type?.displayName === "TableRow") {
|
|
141
|
+
result = child;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
return result;
|
|
146
|
+
};
|
|
147
|
+
var ALIGN_CLASSES2 = {
|
|
148
|
+
center: "nexus-td--center",
|
|
149
|
+
left: "nexus-td--left",
|
|
150
|
+
right: "nexus-td--right"
|
|
151
|
+
};
|
|
152
|
+
var DefaultNoData = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-table-center nexus-table-nodata", children: "No data available." });
|
|
153
|
+
var DefaultLoading = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-table-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-table-loading-icon" }) });
|
|
154
|
+
function Table({
|
|
155
|
+
className = "",
|
|
156
|
+
theadClassName = "",
|
|
157
|
+
list,
|
|
158
|
+
children,
|
|
159
|
+
loadingElement,
|
|
160
|
+
noDataMsg,
|
|
161
|
+
hideThead,
|
|
162
|
+
sortUpElement = /* @__PURE__ */ jsxRuntime.jsx(DefaultSortIcon, { direction: "asc" }),
|
|
163
|
+
sortDownElement = /* @__PURE__ */ jsxRuntime.jsx(DefaultSortIcon, { direction: "desc" }),
|
|
164
|
+
loadingType = "skeleton",
|
|
165
|
+
loading,
|
|
166
|
+
skeletonCount = 10,
|
|
167
|
+
notification
|
|
168
|
+
}) {
|
|
169
|
+
const [isSorting, setIsSorting] = React.useState(false);
|
|
170
|
+
const [orderData, setOrderData] = React.useState(null);
|
|
171
|
+
const tdColumns = React.useMemo(() => {
|
|
172
|
+
const item = (list || []).length > 0 ? list?.[0] : {};
|
|
173
|
+
return findTdColumns(children({ item, index: 0 }));
|
|
174
|
+
}, [children, list]);
|
|
175
|
+
const trRow = React.useMemo(() => {
|
|
176
|
+
const item = (list || []).length > 0 ? list?.[0] : {};
|
|
177
|
+
return findTrRow(children({ item, index: 0 }));
|
|
178
|
+
}, [children, list]);
|
|
179
|
+
const thRowData = React.useMemo(() => {
|
|
180
|
+
const thRows = tdColumns?.map((column) => {
|
|
181
|
+
const component = column;
|
|
182
|
+
const tdClassName = component?.props?.className;
|
|
183
|
+
const widthClassName = tdClassName?.match(
|
|
184
|
+
/(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
|
|
185
|
+
);
|
|
186
|
+
return {
|
|
187
|
+
className: component.props?.className ?? "",
|
|
188
|
+
label: component.props?.label ?? "",
|
|
189
|
+
fieldId: component.props?.fieldId,
|
|
190
|
+
enableSorting: typeof component.props?.sortValue !== "undefined" || !!component.props?.handleClickSort,
|
|
191
|
+
handleClickSort: component.props?.handleClickSort,
|
|
192
|
+
thColSpan: component.props?.thColSpan,
|
|
193
|
+
thRowSpan: component.props?.thRowSpan,
|
|
194
|
+
rowSpan: component.props?.rowSpan,
|
|
195
|
+
colSpan: component.props?.colSpan,
|
|
196
|
+
size: component.props?.size,
|
|
197
|
+
widthClassName: widthClassName && widthClassName.join(" "),
|
|
198
|
+
align: component.props?.align ?? "left",
|
|
199
|
+
order: component.props?.order ?? ""
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
if (thRows) {
|
|
203
|
+
return thRows.filter((th) => typeof th.label !== "undefined").map((th) => {
|
|
204
|
+
if (!orderData?.fieldId) return th;
|
|
205
|
+
return {
|
|
206
|
+
...th,
|
|
207
|
+
order: orderData.fieldId === th.fieldId ? orderData.order : ""
|
|
208
|
+
};
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return [];
|
|
212
|
+
}, [tdColumns, orderData]);
|
|
213
|
+
const skeletonRows = React.useMemo(() => {
|
|
214
|
+
const trRowComponent = trRow;
|
|
215
|
+
return Array.from({ length: skeletonCount }, (_, trIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
+
"tr",
|
|
217
|
+
{
|
|
218
|
+
className: chunkCZC76ZD5_js.cn(trRowComponent?.props?.className, "nexus-table-skeleton-row"),
|
|
219
|
+
children: thRowData?.map((thData, tdIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
220
|
+
"td",
|
|
221
|
+
{
|
|
222
|
+
className: chunkCZC76ZD5_js.cn(thData.widthClassName, "nexus-table-skeleton-td"),
|
|
223
|
+
style: thData.size ? {
|
|
224
|
+
width: typeof thData.size === "number" ? `${thData.size}px` : thData.size,
|
|
225
|
+
flex: `0 0 ${typeof thData.size === "number" ? `${thData.size}px` : thData.size}`
|
|
226
|
+
} : void 0,
|
|
227
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chunkBLGQHR3M_js.Skeleton, { className: "nexus-table-skeleton-bar" })
|
|
228
|
+
},
|
|
229
|
+
`skeleton-td-${tdIndex}`
|
|
230
|
+
))
|
|
231
|
+
},
|
|
232
|
+
`skeleton-tr-${trIndex}`
|
|
233
|
+
));
|
|
234
|
+
}, [skeletonCount, thRowData, trRow]);
|
|
235
|
+
const tableRows = React.useMemo(() => {
|
|
236
|
+
const { fieldId: orderTargetFieldId, order } = orderData ?? {};
|
|
237
|
+
if (!order) return list;
|
|
238
|
+
const componentList = list?.map(
|
|
239
|
+
(item, index) => React.Children.map(
|
|
240
|
+
children({ item, index }),
|
|
241
|
+
(child) => {
|
|
242
|
+
if (React.isValidElement(child)) {
|
|
243
|
+
if (child.type === TdColumn) return child;
|
|
244
|
+
return React.Children.toArray(child.props.children);
|
|
245
|
+
}
|
|
246
|
+
return [];
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
);
|
|
250
|
+
const sortValueList = componentList?.reduce((acc, cur) => {
|
|
251
|
+
const columns = cur;
|
|
252
|
+
const target = columns?.find((col) => col?.props?.fieldId === orderTargetFieldId);
|
|
253
|
+
acc.push(target?.props?.sortValue ?? 0);
|
|
254
|
+
return acc;
|
|
255
|
+
}, []);
|
|
256
|
+
return lodashEs.orderBy(
|
|
257
|
+
list?.map((item, index) => ({ ...item, sortValue: sortValueList?.[index] })),
|
|
258
|
+
["sortValue"],
|
|
259
|
+
[order]
|
|
260
|
+
);
|
|
261
|
+
}, [list, orderData, children]);
|
|
262
|
+
const handleThSorting = async (thData) => {
|
|
263
|
+
let newOrder = "desc";
|
|
264
|
+
const { order, index, fieldId, enableSorting, handleClickSort } = thData;
|
|
265
|
+
if (!enableSorting || isSorting) return;
|
|
266
|
+
if (order === "desc") newOrder = "asc";
|
|
267
|
+
else if (order === "asc") newOrder = "";
|
|
268
|
+
const newOrderData = { index, order: newOrder, fieldId: fieldId ?? "" };
|
|
269
|
+
setOrderData(newOrderData);
|
|
270
|
+
if (handleClickSort) {
|
|
271
|
+
try {
|
|
272
|
+
setIsSorting(true);
|
|
273
|
+
await handleClickSort(newOrderData);
|
|
274
|
+
} finally {
|
|
275
|
+
setIsSorting(false);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableHighlightProvider, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkCZC76ZD5_js.cn("nexus-table-wrap", className), children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "nexus-table", children: [
|
|
280
|
+
!hideThead && /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { className: chunkCZC76ZD5_js.cn("nexus-table-thead", theadClassName), children: thRowData.map((thData, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
281
|
+
"th",
|
|
282
|
+
{
|
|
283
|
+
rowSpan: thData.thRowSpan ?? thData.rowSpan,
|
|
284
|
+
colSpan: thData.thColSpan ?? thData.colSpan,
|
|
285
|
+
className: chunkCZC76ZD5_js.cn(
|
|
286
|
+
"nexus-table-th",
|
|
287
|
+
thData.enableSorting && "nexus-table-th--sortable",
|
|
288
|
+
ALIGN_CLASSES2[thData.align ?? "left"],
|
|
289
|
+
thData.widthClassName
|
|
290
|
+
),
|
|
291
|
+
style: thData.size ? {
|
|
292
|
+
width: typeof thData.size === "number" ? `${thData.size}px` : thData.size,
|
|
293
|
+
flex: `0 0 ${typeof thData.size === "number" ? `${thData.size}px` : thData.size}`
|
|
294
|
+
} : void 0,
|
|
295
|
+
children: thData.enableSorting ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
296
|
+
"button",
|
|
297
|
+
{
|
|
298
|
+
type: "button",
|
|
299
|
+
className: "nexus-table-th__sort-btn",
|
|
300
|
+
onClick: () => handleThSorting({ ...thData, index }),
|
|
301
|
+
onKeyDown: (e) => {
|
|
302
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
303
|
+
e.preventDefault();
|
|
304
|
+
handleThSorting({ ...thData, index });
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
"aria-label": `Sort by ${thData.label}${thData.order === "asc" ? ", ascending" : thData.order === "desc" ? ", descending" : ""}`,
|
|
308
|
+
children: [
|
|
309
|
+
thData.label,
|
|
310
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
311
|
+
thData.order !== "desc" && thData.order !== "asc" && /* @__PURE__ */ jsxRuntime.jsx(DefaultSortIcon, { direction: "default" }),
|
|
312
|
+
thData.order === "desc" && sortDownElement,
|
|
313
|
+
thData.order === "asc" && sortUpElement
|
|
314
|
+
] })
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
) : thData.label
|
|
318
|
+
},
|
|
319
|
+
`th-${thData.fieldId ?? index}`
|
|
320
|
+
)) }) }),
|
|
321
|
+
notification && /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: thRowData.length || 1, children: notification }) }) }),
|
|
322
|
+
/* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
|
|
323
|
+
(!list || isSorting || loading) && (loadingType === "loading" ? /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: thRowData.length, children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: loadingElement ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultLoading, {}) }) }) }) : /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: skeletonRows })),
|
|
324
|
+
!!list && !loading && !isSorting && (list.length > 0 ? tableRows?.map(
|
|
325
|
+
(item, index) => children({ item, index })
|
|
326
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: thRowData.length, children: noDataMsg && typeof noDataMsg === "object" ? noDataMsg : /* @__PURE__ */ jsxRuntime.jsx(DefaultNoData, {}) }) }))
|
|
327
|
+
] })
|
|
328
|
+
] }) }) });
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
exports.Table = Table;
|
|
332
|
+
exports.TableHighlightProvider = TableHighlightProvider;
|
|
333
|
+
exports.TableRow = TableRow;
|
|
334
|
+
exports.TdColumn = TdColumn;
|
|
335
|
+
exports.tableRowVariants = tableRowVariants;
|
|
336
|
+
exports.useTableHighlight = useTableHighlight;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/components/ErrorBoundary.tsx
|
|
5
|
+
var ErrorBoundary = class extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.state = { hasError: false, error: null };
|
|
9
|
+
}
|
|
10
|
+
static getDerivedStateFromError(error) {
|
|
11
|
+
return { hasError: true, error };
|
|
12
|
+
}
|
|
13
|
+
componentDidCatch(error, errorInfo) {
|
|
14
|
+
this.props.onError?.(error, errorInfo);
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
if (this.state.hasError) {
|
|
18
|
+
if (this.props.fallback !== void 0) {
|
|
19
|
+
return this.props.fallback;
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ jsxs(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
role: "alert",
|
|
25
|
+
className: "nexus-error-boundary",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx("p", { className: "nexus-error-boundary__title", children: "Something went wrong" }),
|
|
28
|
+
this.state.error && /* @__PURE__ */ jsx("p", { className: "nexus-error-boundary__message", children: this.state.error.message })
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return this.props.children;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { ErrorBoundary };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var buttonVariants = cva("nexus-btn", {
|
|
8
|
+
variants: {
|
|
9
|
+
semantic: {
|
|
10
|
+
primary: "nexus-btn--primary",
|
|
11
|
+
secondary: "nexus-btn--secondary",
|
|
12
|
+
normal: "nexus-btn--normal",
|
|
13
|
+
danger: "nexus-btn--danger"
|
|
14
|
+
},
|
|
15
|
+
variant: {
|
|
16
|
+
contained: "nexus-btn--contained",
|
|
17
|
+
outlined: "nexus-btn--outlined",
|
|
18
|
+
subtle: "nexus-btn--subtle",
|
|
19
|
+
ghost: "nexus-btn--ghost"
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
xl: "nexus-btn--xl",
|
|
23
|
+
lg: "nexus-btn--lg",
|
|
24
|
+
md: "nexus-btn--md",
|
|
25
|
+
sm: "nexus-btn--sm"
|
|
26
|
+
},
|
|
27
|
+
radius: {
|
|
28
|
+
default: "",
|
|
29
|
+
circle: "nexus-btn--circle"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
semantic: "primary",
|
|
34
|
+
variant: "contained",
|
|
35
|
+
size: "md",
|
|
36
|
+
radius: "default"
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
var Button = React.forwardRef(
|
|
40
|
+
({
|
|
41
|
+
className,
|
|
42
|
+
semantic,
|
|
43
|
+
variant,
|
|
44
|
+
size,
|
|
45
|
+
radius,
|
|
46
|
+
asChild = false,
|
|
47
|
+
detectDoubleClick = false,
|
|
48
|
+
disabled,
|
|
49
|
+
children,
|
|
50
|
+
onClick,
|
|
51
|
+
style,
|
|
52
|
+
...props
|
|
53
|
+
}, ref) => {
|
|
54
|
+
const clickTimeoutRef = React.useRef(
|
|
55
|
+
null
|
|
56
|
+
);
|
|
57
|
+
const handleClick = React.useCallback(
|
|
58
|
+
(e) => {
|
|
59
|
+
if (detectDoubleClick && clickTimeoutRef.current) return;
|
|
60
|
+
onClick?.(e);
|
|
61
|
+
if (detectDoubleClick) {
|
|
62
|
+
clickTimeoutRef.current = setTimeout(() => {
|
|
63
|
+
clickTimeoutRef.current = null;
|
|
64
|
+
}, 500);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
[detectDoubleClick, onClick]
|
|
68
|
+
);
|
|
69
|
+
const Comp = asChild ? Slot : "button";
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
Comp,
|
|
72
|
+
{
|
|
73
|
+
ref,
|
|
74
|
+
type: asChild ? void 0 : "button",
|
|
75
|
+
role: asChild ? "button" : void 0,
|
|
76
|
+
className: cn(
|
|
77
|
+
buttonVariants({ semantic, variant, size, radius }),
|
|
78
|
+
className
|
|
79
|
+
),
|
|
80
|
+
disabled: asChild ? void 0 : disabled,
|
|
81
|
+
"aria-disabled": disabled || void 0,
|
|
82
|
+
tabIndex: disabled ? -1 : void 0,
|
|
83
|
+
onClick: disabled ? void 0 : handleClick,
|
|
84
|
+
style,
|
|
85
|
+
...props,
|
|
86
|
+
children
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
Button.displayName = "Button";
|
|
92
|
+
|
|
93
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var tooltipContentVariants = cva("nexus-tooltip-content", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
light: "nexus-tooltip--light",
|
|
10
|
+
dark: "nexus-tooltip--dark"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { variant: "dark" }
|
|
14
|
+
});
|
|
15
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
16
|
+
var Tooltip = ({
|
|
17
|
+
children,
|
|
18
|
+
content,
|
|
19
|
+
side = "top",
|
|
20
|
+
align = "center",
|
|
21
|
+
delayDuration = 200,
|
|
22
|
+
disabled = false,
|
|
23
|
+
variant = "dark",
|
|
24
|
+
triggerClassName = "",
|
|
25
|
+
className = ""
|
|
26
|
+
}) => {
|
|
27
|
+
if (disabled) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
28
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration, children: /* @__PURE__ */ jsxs(TooltipPrimitive.Root, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { asChild: true, className: cn("nexus-tooltip-trigger", triggerClassName), children: /* @__PURE__ */ jsx("span", { children }) }),
|
|
30
|
+
/* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
31
|
+
TooltipPrimitive.Content,
|
|
32
|
+
{
|
|
33
|
+
side,
|
|
34
|
+
align,
|
|
35
|
+
className: cn(tooltipContentVariants({ variant }), className),
|
|
36
|
+
sideOffset: 4,
|
|
37
|
+
children: [
|
|
38
|
+
content,
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
TooltipPrimitive.Arrow,
|
|
41
|
+
{
|
|
42
|
+
className: variant === "dark" ? "nexus-tooltip-arrow--dark" : "nexus-tooltip-arrow--light"
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
) })
|
|
48
|
+
] }) });
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { Tooltip, TooltipProvider, tooltipContentVariants };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
6
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
28
|
+
|
|
29
|
+
var chipVariants = classVarianceAuthority.cva("nexus-chip", {
|
|
30
|
+
variants: {
|
|
31
|
+
variant: {
|
|
32
|
+
default: "nexus-chip--default",
|
|
33
|
+
filled: "nexus-chip--filled",
|
|
34
|
+
outline: "nexus-chip--outline",
|
|
35
|
+
accent: "nexus-chip--accent"
|
|
36
|
+
},
|
|
37
|
+
size: {
|
|
38
|
+
sm: "nexus-chip--sm",
|
|
39
|
+
md: "nexus-chip--md",
|
|
40
|
+
lg: "nexus-chip--lg"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
variant: "default",
|
|
45
|
+
size: "md"
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var CloseIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
49
|
+
"svg",
|
|
50
|
+
{
|
|
51
|
+
className,
|
|
52
|
+
viewBox: "0 0 16 16",
|
|
53
|
+
fill: "none",
|
|
54
|
+
stroke: "currentColor",
|
|
55
|
+
strokeWidth: "2",
|
|
56
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 4l8 8M12 4l-8 8", strokeLinecap: "round" })
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
var Chip = React__namespace.forwardRef(
|
|
60
|
+
({
|
|
61
|
+
className,
|
|
62
|
+
variant,
|
|
63
|
+
size,
|
|
64
|
+
asChild = false,
|
|
65
|
+
disabled,
|
|
66
|
+
children,
|
|
67
|
+
onClose,
|
|
68
|
+
...props
|
|
69
|
+
}, ref) => {
|
|
70
|
+
const Comp = asChild ? reactSlot.Slot : "div";
|
|
71
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
72
|
+
Comp,
|
|
73
|
+
{
|
|
74
|
+
ref,
|
|
75
|
+
className: chunkCZC76ZD5_js.cn(chipVariants({ variant, size }), className),
|
|
76
|
+
"aria-disabled": disabled || void 0,
|
|
77
|
+
...props,
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children }),
|
|
80
|
+
onClose && /* @__PURE__ */ jsxRuntime.jsx(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
type: "button",
|
|
84
|
+
className: "nexus-chip__close",
|
|
85
|
+
onClick: disabled ? void 0 : onClose,
|
|
86
|
+
disabled,
|
|
87
|
+
"aria-label": "Remove",
|
|
88
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, { className: "nexus-chip__close-icon" })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
Chip.displayName = "Chip";
|
|
97
|
+
|
|
98
|
+
exports.Chip = Chip;
|
|
99
|
+
exports.chipVariants = chipVariants;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
|
|
4
|
+
var React = require('react');
|
|
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 React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
var textAreaVariants = classVarianceAuthority.cva("nexus-textarea", {
|
|
29
|
+
variants: {
|
|
30
|
+
state: {
|
|
31
|
+
default: "nexus-textarea--default",
|
|
32
|
+
error: "nexus-textarea--error"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: { state: "default" }
|
|
36
|
+
});
|
|
37
|
+
var TextArea = React__namespace.forwardRef(
|
|
38
|
+
({ className, error, showCount, maxLength, onValueChange, onChange, ...props }, ref) => {
|
|
39
|
+
const state = error ? "error" : "default";
|
|
40
|
+
const [count, setCount] = React__namespace.useState(0);
|
|
41
|
+
const handleChange = React__namespace.useCallback(
|
|
42
|
+
(e) => {
|
|
43
|
+
setCount(e.target.value.length);
|
|
44
|
+
onValueChange?.(e.target.value);
|
|
45
|
+
onChange?.(e);
|
|
46
|
+
},
|
|
47
|
+
[onValueChange, onChange]
|
|
48
|
+
);
|
|
49
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-textarea-wrap", children: [
|
|
50
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
51
|
+
"textarea",
|
|
52
|
+
{
|
|
53
|
+
ref,
|
|
54
|
+
className: chunkCZC76ZD5_js.cn(textAreaVariants({ state }), className),
|
|
55
|
+
maxLength,
|
|
56
|
+
"aria-invalid": error || void 0,
|
|
57
|
+
onChange: handleChange,
|
|
58
|
+
...props
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
showCount && maxLength && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
62
|
+
"p",
|
|
63
|
+
{
|
|
64
|
+
className: "nexus-textarea-count",
|
|
65
|
+
"aria-live": "polite",
|
|
66
|
+
"aria-atomic": "true",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-textarea-count__current", children: count.toLocaleString() }),
|
|
69
|
+
"/",
|
|
70
|
+
maxLength.toLocaleString()
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
TextArea.displayName = "TextArea";
|
|
78
|
+
|
|
79
|
+
exports.TextArea = TextArea;
|
|
80
|
+
exports.textAreaVariants = textAreaVariants;
|