@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,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
// src/hooks/useClickOutside.ts
|
|
6
|
+
var useClickOutside = (ref, handler, option) => {
|
|
7
|
+
react.useEffect(() => {
|
|
8
|
+
const listener = (event) => {
|
|
9
|
+
const el = ref && "current" in ref ? ref.current : ref;
|
|
10
|
+
if (!el || el.contains(event.target)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
handler(event);
|
|
14
|
+
};
|
|
15
|
+
document.addEventListener("click", listener);
|
|
16
|
+
if (!option?.offTouchEvent) {
|
|
17
|
+
document.addEventListener("touchstart", listener);
|
|
18
|
+
}
|
|
19
|
+
return () => {
|
|
20
|
+
document.removeEventListener("click", listener);
|
|
21
|
+
document.removeEventListener("touchstart", listener);
|
|
22
|
+
};
|
|
23
|
+
}, [ref, handler, option]);
|
|
24
|
+
};
|
|
25
|
+
var useClickOutside_default = useClickOutside;
|
|
26
|
+
|
|
27
|
+
exports.useClickOutside_default = useClickOutside_default;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n.default = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
+
|
|
27
|
+
var Spinner = React__namespace.forwardRef(
|
|
28
|
+
({ className, size = 20, "aria-label": ariaLabel = "Loading", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29
|
+
"svg",
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
role: "status",
|
|
33
|
+
"aria-label": ariaLabel,
|
|
34
|
+
className: chunkCZC76ZD5_js.cn("nexus-spinner", className),
|
|
35
|
+
viewBox: "0 0 50 50",
|
|
36
|
+
fill: "none",
|
|
37
|
+
style: { width: size, height: size },
|
|
38
|
+
...props,
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
+
"circle",
|
|
42
|
+
{
|
|
43
|
+
cx: "25",
|
|
44
|
+
cy: "25",
|
|
45
|
+
r: "20",
|
|
46
|
+
stroke: "currentColor",
|
|
47
|
+
strokeWidth: "5",
|
|
48
|
+
opacity: "0.3"
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
52
|
+
"circle",
|
|
53
|
+
{
|
|
54
|
+
cx: "25",
|
|
55
|
+
cy: "25",
|
|
56
|
+
r: "20",
|
|
57
|
+
stroke: "currentColor",
|
|
58
|
+
strokeWidth: "5",
|
|
59
|
+
strokeLinecap: "round",
|
|
60
|
+
strokeDasharray: "90 150",
|
|
61
|
+
strokeDashoffset: "-35"
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
Spinner.displayName = "Spinner";
|
|
69
|
+
|
|
70
|
+
exports.Spinner = Spinner;
|
|
@@ -0,0 +1,132 @@
|
|
|
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 checkBoxVariants = classVarianceAuthority.cva("nexus-checkbox", {
|
|
29
|
+
variants: {
|
|
30
|
+
size: {
|
|
31
|
+
sm: "nexus-checkbox--sm",
|
|
32
|
+
md: "nexus-checkbox--md"
|
|
33
|
+
},
|
|
34
|
+
shape: {
|
|
35
|
+
square: "",
|
|
36
|
+
round: ""
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: { size: "md", shape: "square" }
|
|
40
|
+
});
|
|
41
|
+
var boxVariants = classVarianceAuthority.cva("nexus-checkbox__box", {
|
|
42
|
+
variants: {
|
|
43
|
+
size: {
|
|
44
|
+
sm: "nexus-checkbox__box--sm",
|
|
45
|
+
md: "nexus-checkbox__box--md"
|
|
46
|
+
},
|
|
47
|
+
shape: {
|
|
48
|
+
square: "nexus-checkbox__box--square",
|
|
49
|
+
round: "nexus-checkbox__box--round"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: { size: "md", shape: "square" }
|
|
53
|
+
});
|
|
54
|
+
var CheckIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.5 8.5L6.5 11.5L12.5 5" }) });
|
|
55
|
+
var IndeterminateIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 8h8" }) });
|
|
56
|
+
var CheckBox = React__namespace.forwardRef(
|
|
57
|
+
({
|
|
58
|
+
className,
|
|
59
|
+
size,
|
|
60
|
+
shape,
|
|
61
|
+
checked,
|
|
62
|
+
indeterminate = false,
|
|
63
|
+
disabled,
|
|
64
|
+
readOnly,
|
|
65
|
+
label,
|
|
66
|
+
children,
|
|
67
|
+
onCheckedChange,
|
|
68
|
+
onChange,
|
|
69
|
+
...props
|
|
70
|
+
}, ref) => {
|
|
71
|
+
const innerRef = React__namespace.useRef(null);
|
|
72
|
+
React__namespace.useImperativeHandle(ref, () => innerRef.current);
|
|
73
|
+
React__namespace.useEffect(() => {
|
|
74
|
+
if (innerRef.current) {
|
|
75
|
+
innerRef.current.indeterminate = indeterminate;
|
|
76
|
+
}
|
|
77
|
+
}, [indeterminate]);
|
|
78
|
+
const handleChange = React__namespace.useCallback(
|
|
79
|
+
(e) => {
|
|
80
|
+
onCheckedChange?.(e.target.checked);
|
|
81
|
+
onChange?.(e);
|
|
82
|
+
},
|
|
83
|
+
[onCheckedChange, onChange]
|
|
84
|
+
);
|
|
85
|
+
const isChecked = checked || indeterminate;
|
|
86
|
+
const content = label ?? children;
|
|
87
|
+
const iconClass = size === "sm" ? "nexus-checkbox__icon--sm" : "nexus-checkbox__icon--md";
|
|
88
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
89
|
+
"label",
|
|
90
|
+
{
|
|
91
|
+
className: chunkCZC76ZD5_js.cn(
|
|
92
|
+
checkBoxVariants({ size, shape }),
|
|
93
|
+
disabled ? "nexus-checkbox--disabled" : "nexus-checkbox--pointer",
|
|
94
|
+
className
|
|
95
|
+
),
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
"input",
|
|
99
|
+
{
|
|
100
|
+
ref: innerRef,
|
|
101
|
+
type: "checkbox",
|
|
102
|
+
className: "nexus-sr-only",
|
|
103
|
+
checked,
|
|
104
|
+
disabled,
|
|
105
|
+
readOnly,
|
|
106
|
+
"aria-checked": indeterminate ? "mixed" : checked,
|
|
107
|
+
onChange: handleChange,
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
112
|
+
"span",
|
|
113
|
+
{
|
|
114
|
+
"aria-hidden": "true",
|
|
115
|
+
className: chunkCZC76ZD5_js.cn(
|
|
116
|
+
boxVariants({ size, shape }),
|
|
117
|
+
isChecked ? "nexus-checkbox__box--checked" : "nexus-checkbox__box--unchecked"
|
|
118
|
+
),
|
|
119
|
+
children: indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(IndeterminateIcon, { className: iconClass }) : checked ? /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: iconClass }) : null
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
content && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-checkbox__label", children: content })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
CheckBox.displayName = "CheckBox";
|
|
129
|
+
|
|
130
|
+
exports.CheckBox = CheckBox;
|
|
131
|
+
exports.boxVariants = boxVariants;
|
|
132
|
+
exports.checkBoxVariants = checkBoxVariants;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
exports.__require = __require;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function calcTimeLeft(endTimestamp) {
|
|
6
|
+
const total = Math.max(0, endTimestamp - Date.now());
|
|
7
|
+
const isFinished = total <= 0;
|
|
8
|
+
return {
|
|
9
|
+
days: Math.floor(total / (1e3 * 60 * 60 * 24)),
|
|
10
|
+
hours: Math.floor(total / (1e3 * 60 * 60) % 24),
|
|
11
|
+
minutes: Math.floor(total / (1e3 * 60) % 60),
|
|
12
|
+
seconds: Math.floor(total / 1e3 % 60),
|
|
13
|
+
total,
|
|
14
|
+
isFinished
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function useCountdown(endTimestamp, onEnd) {
|
|
18
|
+
const [timeLeft, setTimeLeft] = React.useState(() => calcTimeLeft(endTimestamp));
|
|
19
|
+
const onEndRef = React.useRef(onEnd);
|
|
20
|
+
onEndRef.current = onEnd;
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
setTimeLeft(calcTimeLeft(endTimestamp));
|
|
23
|
+
const id = setInterval(() => {
|
|
24
|
+
const next = calcTimeLeft(endTimestamp);
|
|
25
|
+
setTimeLeft(next);
|
|
26
|
+
if (next.isFinished) {
|
|
27
|
+
clearInterval(id);
|
|
28
|
+
onEndRef.current?.();
|
|
29
|
+
}
|
|
30
|
+
}, 1e3);
|
|
31
|
+
const handleVisibility = () => {
|
|
32
|
+
if (!document.hidden) setTimeLeft(calcTimeLeft(endTimestamp));
|
|
33
|
+
};
|
|
34
|
+
document.addEventListener("visibilitychange", handleVisibility);
|
|
35
|
+
return () => {
|
|
36
|
+
clearInterval(id);
|
|
37
|
+
document.removeEventListener("visibilitychange", handleVisibility);
|
|
38
|
+
};
|
|
39
|
+
}, [endTimestamp]);
|
|
40
|
+
return timeLeft;
|
|
41
|
+
}
|
|
42
|
+
var pad = (n) => n.toString().padStart(2, "0");
|
|
43
|
+
var Countdown = React.forwardRef(
|
|
44
|
+
({
|
|
45
|
+
endTimestamp,
|
|
46
|
+
separator = ":",
|
|
47
|
+
showDays = true,
|
|
48
|
+
labels,
|
|
49
|
+
onEnd,
|
|
50
|
+
render,
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}, ref) => {
|
|
54
|
+
const timeLeft = useCountdown(endTimestamp, onEnd);
|
|
55
|
+
if (render) {
|
|
56
|
+
return /* @__PURE__ */ jsx("div", { ref, className, ...props, children: render(timeLeft) });
|
|
57
|
+
}
|
|
58
|
+
const units = [];
|
|
59
|
+
if (showDays && timeLeft.days > 0) {
|
|
60
|
+
units.push({ value: timeLeft.days.toString(), label: labels?.days });
|
|
61
|
+
}
|
|
62
|
+
units.push(
|
|
63
|
+
{ value: pad(timeLeft.hours), label: labels?.hours },
|
|
64
|
+
{ value: pad(timeLeft.minutes), label: labels?.minutes },
|
|
65
|
+
{ value: pad(timeLeft.seconds), label: labels?.seconds }
|
|
66
|
+
);
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
ref,
|
|
71
|
+
className: cn("nexus-countdown", className),
|
|
72
|
+
role: "timer",
|
|
73
|
+
"aria-live": "polite",
|
|
74
|
+
"aria-atomic": "true",
|
|
75
|
+
...props,
|
|
76
|
+
children: units.map((unit, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
77
|
+
i > 0 && separator && /* @__PURE__ */ jsx("span", { className: "nexus-countdown__separator", children: separator }),
|
|
78
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
79
|
+
unit.value,
|
|
80
|
+
unit.label && /* @__PURE__ */ jsx("span", { className: "nexus-countdown__label", children: unit.label })
|
|
81
|
+
] })
|
|
82
|
+
] }, i))
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
Countdown.displayName = "Countdown";
|
|
88
|
+
|
|
89
|
+
export { Countdown, useCountdown };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
+
import { useRef, useState, useMemo, useCallback, useEffect, createElement } from 'react';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var DefaultSpinner = () => /* @__PURE__ */ jsx("div", { className: "nexus-infinite-spinner", children: /* @__PURE__ */ jsx("div", { className: "nexus-infinite-spinner-icon" }) });
|
|
6
|
+
var InfiniteScroll = ({
|
|
7
|
+
className = "",
|
|
8
|
+
tag = "div",
|
|
9
|
+
list,
|
|
10
|
+
scrollTarget = null,
|
|
11
|
+
rootMargin = 100,
|
|
12
|
+
loading,
|
|
13
|
+
loadingElement = /* @__PURE__ */ jsx(DefaultSpinner, {}),
|
|
14
|
+
children,
|
|
15
|
+
handleLoadMore,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const target = useRef(null);
|
|
19
|
+
const listRef = useRef(list);
|
|
20
|
+
const totalCountRef = useRef("totalCount" in props ? props.totalCount : void 0);
|
|
21
|
+
const hasMoreRef = useRef("hasMore" in props ? props.hasMore : void 0);
|
|
22
|
+
const loadingRef = useRef(loading);
|
|
23
|
+
const prevCount = useRef(-1);
|
|
24
|
+
const [count, setCount] = useState(0);
|
|
25
|
+
const io = useMemo(() => {
|
|
26
|
+
if (typeof window === "undefined") return null;
|
|
27
|
+
return new IntersectionObserver(
|
|
28
|
+
(entries, observer) => {
|
|
29
|
+
if (!target.current) return;
|
|
30
|
+
if (entries[0].intersectionRatio > 0.2) {
|
|
31
|
+
if (!loadingRef.current) {
|
|
32
|
+
setCount((v) => v + 1);
|
|
33
|
+
observer.disconnect();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
root: !scrollTarget ? null : "current" in scrollTarget ? scrollTarget.current : scrollTarget,
|
|
39
|
+
rootMargin: `${rootMargin}px 0px`,
|
|
40
|
+
threshold: [0.1, 0.2, 0.5, 0.8, 0.9, 1]
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}, [rootMargin, scrollTarget]);
|
|
44
|
+
const hasNext = useCallback(() => {
|
|
45
|
+
if (!listRef.current || loadingRef.current) return false;
|
|
46
|
+
if (typeof totalCountRef.current !== "undefined") {
|
|
47
|
+
return totalCountRef.current > listRef.current.length;
|
|
48
|
+
}
|
|
49
|
+
return !!hasMoreRef.current;
|
|
50
|
+
}, []);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (count > 0 && prevCount.current < count && (listRef.current ?? []).length && hasNext()) {
|
|
53
|
+
prevCount.current = count;
|
|
54
|
+
handleLoadMore();
|
|
55
|
+
}
|
|
56
|
+
}, [count, hasNext, handleLoadMore]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const observeEl = target.current;
|
|
59
|
+
if (observeEl && io) io.observe(observeEl);
|
|
60
|
+
return () => {
|
|
61
|
+
if (observeEl && io) io.unobserve(observeEl);
|
|
62
|
+
};
|
|
63
|
+
}, [list, io]);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if ("totalCount" in props) {
|
|
66
|
+
totalCountRef.current = props.totalCount;
|
|
67
|
+
} else {
|
|
68
|
+
hasMoreRef.current = props.hasMore;
|
|
69
|
+
}
|
|
70
|
+
listRef.current = [...list || []];
|
|
71
|
+
}, [list, props]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
loadingRef.current = loading;
|
|
74
|
+
}, [loading]);
|
|
75
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("nexus-infinite-scroll", className), children: [
|
|
76
|
+
createElement(tag, null, children),
|
|
77
|
+
/* @__PURE__ */ jsx("div", { ref: target, className: "nexus-infinite-sentinel", role: "status", "aria-live": "polite", children: loading && (list ?? []).length > 0 && loadingElement })
|
|
78
|
+
] });
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export { InfiniteScroll };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
|
|
4
|
+
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n.default = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
26
|
+
|
|
27
|
+
var popoverContentClasses = "nexus-popover-content";
|
|
28
|
+
var Popover = ({
|
|
29
|
+
children,
|
|
30
|
+
trigger,
|
|
31
|
+
align = "center",
|
|
32
|
+
side = "bottom",
|
|
33
|
+
sideOffset = 4,
|
|
34
|
+
alignOffset,
|
|
35
|
+
open,
|
|
36
|
+
onOpenChange,
|
|
37
|
+
className = "",
|
|
38
|
+
arrowClassName,
|
|
39
|
+
onClickTrigger
|
|
40
|
+
}) => {
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(PopoverPrimitive__namespace.Root, { open, onOpenChange, children: [
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { asChild: true, onClick: onClickTrigger, children: trigger }),
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
44
|
+
PopoverPrimitive__namespace.Content,
|
|
45
|
+
{
|
|
46
|
+
align,
|
|
47
|
+
alignOffset,
|
|
48
|
+
side,
|
|
49
|
+
sideOffset,
|
|
50
|
+
className: chunkCZC76ZD5_js.cn(popoverContentClasses, className),
|
|
51
|
+
children: [
|
|
52
|
+
children,
|
|
53
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
+
PopoverPrimitive__namespace.Arrow,
|
|
55
|
+
{
|
|
56
|
+
className: chunkCZC76ZD5_js.cn("nexus-popover-arrow", arrowClassName)
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
) })
|
|
62
|
+
] });
|
|
63
|
+
};
|
|
64
|
+
var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
|
|
65
|
+
var PopoverContent = PopoverPrimitive__namespace.Content;
|
|
66
|
+
var PopoverArrow = PopoverPrimitive__namespace.Arrow;
|
|
67
|
+
var PopoverClose = PopoverPrimitive__namespace.Close;
|
|
68
|
+
|
|
69
|
+
exports.Popover = Popover;
|
|
70
|
+
exports.PopoverArrow = PopoverArrow;
|
|
71
|
+
exports.PopoverClose = PopoverClose;
|
|
72
|
+
exports.PopoverContent = PopoverContent;
|
|
73
|
+
exports.PopoverTrigger = PopoverTrigger;
|
|
74
|
+
exports.popoverContentClasses = popoverContentClasses;
|
|
@@ -0,0 +1,71 @@
|
|
|
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 avatarVariants = classVarianceAuthority.cva("nexus-avatar", {
|
|
29
|
+
variants: {
|
|
30
|
+
size: {
|
|
31
|
+
xs: "nexus-avatar--xs",
|
|
32
|
+
sm: "nexus-avatar--sm",
|
|
33
|
+
md: "nexus-avatar--md",
|
|
34
|
+
lg: "nexus-avatar--lg",
|
|
35
|
+
xl: "nexus-avatar--xl"
|
|
36
|
+
},
|
|
37
|
+
shape: {
|
|
38
|
+
circle: "nexus-avatar--circle",
|
|
39
|
+
square: "nexus-avatar--square"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: { size: "md", shape: "circle" }
|
|
43
|
+
});
|
|
44
|
+
var DefaultIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z" }) });
|
|
45
|
+
var Avatar = React__namespace.forwardRef(
|
|
46
|
+
({ className, size, shape, src, alt, fallback, children, onImageError, ...props }, ref) => {
|
|
47
|
+
const [imgError, setImgError] = React__namespace.useState(false);
|
|
48
|
+
React__namespace.useEffect(() => {
|
|
49
|
+
setImgError(false);
|
|
50
|
+
}, [src]);
|
|
51
|
+
const handleError = React__namespace.useCallback(() => {
|
|
52
|
+
setImgError(true);
|
|
53
|
+
onImageError?.();
|
|
54
|
+
}, [onImageError]);
|
|
55
|
+
const showFallback = !src || imgError;
|
|
56
|
+
const iconSize = size === "xs" ? "nexus-avatar__icon--xs" : size === "sm" ? "nexus-avatar__icon--sm" : size === "lg" ? "nexus-avatar__icon--lg" : size === "xl" ? "nexus-avatar__icon--xl" : "nexus-avatar__icon--md";
|
|
57
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "img", "aria-label": alt ?? void 0, className: chunkCZC76ZD5_js.cn(avatarVariants({ size, shape }), className), ...props, children: children ? children : showFallback ? fallback ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultIcon, { className: iconSize }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
58
|
+
"img",
|
|
59
|
+
{
|
|
60
|
+
src,
|
|
61
|
+
alt: alt ?? "",
|
|
62
|
+
className: "nexus-avatar__img",
|
|
63
|
+
onError: handleError
|
|
64
|
+
}
|
|
65
|
+
) });
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
Avatar.displayName = "Avatar";
|
|
69
|
+
|
|
70
|
+
exports.Avatar = Avatar;
|
|
71
|
+
exports.avatarVariants = avatarVariants;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var checkBoxVariants = cva("nexus-checkbox", {
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: "nexus-checkbox--sm",
|
|
10
|
+
md: "nexus-checkbox--md"
|
|
11
|
+
},
|
|
12
|
+
shape: {
|
|
13
|
+
square: "",
|
|
14
|
+
round: ""
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: { size: "md", shape: "square" }
|
|
18
|
+
});
|
|
19
|
+
var boxVariants = cva("nexus-checkbox__box", {
|
|
20
|
+
variants: {
|
|
21
|
+
size: {
|
|
22
|
+
sm: "nexus-checkbox__box--sm",
|
|
23
|
+
md: "nexus-checkbox__box--md"
|
|
24
|
+
},
|
|
25
|
+
shape: {
|
|
26
|
+
square: "nexus-checkbox__box--square",
|
|
27
|
+
round: "nexus-checkbox__box--round"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: { size: "md", shape: "square" }
|
|
31
|
+
});
|
|
32
|
+
var CheckIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M3.5 8.5L6.5 11.5L12.5 5" }) });
|
|
33
|
+
var IndeterminateIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", children: /* @__PURE__ */ jsx("path", { d: "M4 8h8" }) });
|
|
34
|
+
var CheckBox = React.forwardRef(
|
|
35
|
+
({
|
|
36
|
+
className,
|
|
37
|
+
size,
|
|
38
|
+
shape,
|
|
39
|
+
checked,
|
|
40
|
+
indeterminate = false,
|
|
41
|
+
disabled,
|
|
42
|
+
readOnly,
|
|
43
|
+
label,
|
|
44
|
+
children,
|
|
45
|
+
onCheckedChange,
|
|
46
|
+
onChange,
|
|
47
|
+
...props
|
|
48
|
+
}, ref) => {
|
|
49
|
+
const innerRef = React.useRef(null);
|
|
50
|
+
React.useImperativeHandle(ref, () => innerRef.current);
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
if (innerRef.current) {
|
|
53
|
+
innerRef.current.indeterminate = indeterminate;
|
|
54
|
+
}
|
|
55
|
+
}, [indeterminate]);
|
|
56
|
+
const handleChange = React.useCallback(
|
|
57
|
+
(e) => {
|
|
58
|
+
onCheckedChange?.(e.target.checked);
|
|
59
|
+
onChange?.(e);
|
|
60
|
+
},
|
|
61
|
+
[onCheckedChange, onChange]
|
|
62
|
+
);
|
|
63
|
+
const isChecked = checked || indeterminate;
|
|
64
|
+
const content = label ?? children;
|
|
65
|
+
const iconClass = size === "sm" ? "nexus-checkbox__icon--sm" : "nexus-checkbox__icon--md";
|
|
66
|
+
return /* @__PURE__ */ jsxs(
|
|
67
|
+
"label",
|
|
68
|
+
{
|
|
69
|
+
className: cn(
|
|
70
|
+
checkBoxVariants({ size, shape }),
|
|
71
|
+
disabled ? "nexus-checkbox--disabled" : "nexus-checkbox--pointer",
|
|
72
|
+
className
|
|
73
|
+
),
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
"input",
|
|
77
|
+
{
|
|
78
|
+
ref: innerRef,
|
|
79
|
+
type: "checkbox",
|
|
80
|
+
className: "nexus-sr-only",
|
|
81
|
+
checked,
|
|
82
|
+
disabled,
|
|
83
|
+
readOnly,
|
|
84
|
+
"aria-checked": indeterminate ? "mixed" : checked,
|
|
85
|
+
onChange: handleChange,
|
|
86
|
+
...props
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
"span",
|
|
91
|
+
{
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
className: cn(
|
|
94
|
+
boxVariants({ size, shape }),
|
|
95
|
+
isChecked ? "nexus-checkbox__box--checked" : "nexus-checkbox__box--unchecked"
|
|
96
|
+
),
|
|
97
|
+
children: indeterminate ? /* @__PURE__ */ jsx(IndeterminateIcon, { className: iconClass }) : checked ? /* @__PURE__ */ jsx(CheckIcon, { className: iconClass }) : null
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
content && /* @__PURE__ */ jsx("span", { className: "nexus-checkbox__label", children: content })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
CheckBox.displayName = "CheckBox";
|
|
107
|
+
|
|
108
|
+
export { CheckBox, boxVariants, checkBoxVariants };
|