@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,142 @@
|
|
|
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 tabListVariants = cva("nexus-tab-list", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
line: "",
|
|
10
|
+
pill: "nexus-tab-list--pill"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { variant: "line" }
|
|
14
|
+
});
|
|
15
|
+
var tabTriggerVariants = cva("nexus-tab-trigger", {
|
|
16
|
+
variants: {
|
|
17
|
+
variant: {
|
|
18
|
+
line: "nexus-tab-trigger--line",
|
|
19
|
+
pill: "nexus-tab-trigger--pill"
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
sm: "nexus-tab-trigger--sm",
|
|
23
|
+
md: "nexus-tab-trigger--md"
|
|
24
|
+
},
|
|
25
|
+
active: {
|
|
26
|
+
true: "",
|
|
27
|
+
false: ""
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
compoundVariants: [
|
|
31
|
+
{ variant: "line", active: true, className: "nexus-tab-trigger--line-active" },
|
|
32
|
+
{ variant: "pill", active: true, className: "nexus-tab-trigger--pill-active" }
|
|
33
|
+
],
|
|
34
|
+
defaultVariants: { variant: "line", size: "md", active: false }
|
|
35
|
+
});
|
|
36
|
+
function Tab({
|
|
37
|
+
items,
|
|
38
|
+
activeKey: controlledKey,
|
|
39
|
+
defaultActiveKey,
|
|
40
|
+
variant,
|
|
41
|
+
size,
|
|
42
|
+
destroyInactive = false,
|
|
43
|
+
onTabChange,
|
|
44
|
+
className,
|
|
45
|
+
tabListClassName,
|
|
46
|
+
tabPanelClassName
|
|
47
|
+
}) {
|
|
48
|
+
const [internalKey, setInternalKey] = React.useState(
|
|
49
|
+
defaultActiveKey ?? items[0]?.key ?? ""
|
|
50
|
+
);
|
|
51
|
+
const currentKey = controlledKey ?? internalKey;
|
|
52
|
+
const handleSelect = React.useCallback(
|
|
53
|
+
(key) => {
|
|
54
|
+
if (controlledKey === void 0) setInternalKey(key);
|
|
55
|
+
onTabChange?.(key);
|
|
56
|
+
},
|
|
57
|
+
[controlledKey, onTabChange]
|
|
58
|
+
);
|
|
59
|
+
const handleKeyDown = React.useCallback(
|
|
60
|
+
(e, index) => {
|
|
61
|
+
const enabledItems = items.filter((i) => !i.disabled);
|
|
62
|
+
const currentIdx = enabledItems.findIndex((i) => i.key === items[index].key);
|
|
63
|
+
let nextIdx = currentIdx;
|
|
64
|
+
if (e.key === "ArrowRight") nextIdx = (currentIdx + 1) % enabledItems.length;
|
|
65
|
+
if (e.key === "ArrowLeft") nextIdx = (currentIdx - 1 + enabledItems.length) % enabledItems.length;
|
|
66
|
+
if (e.key === "Home") nextIdx = 0;
|
|
67
|
+
if (e.key === "End") nextIdx = enabledItems.length - 1;
|
|
68
|
+
if (nextIdx !== currentIdx) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
const next = enabledItems[nextIdx];
|
|
71
|
+
handleSelect(next.key);
|
|
72
|
+
const btn = e.currentTarget.parentElement?.querySelector(
|
|
73
|
+
`[data-tab-key="${next.key}"]`
|
|
74
|
+
);
|
|
75
|
+
btn?.focus();
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
[items, handleSelect]
|
|
79
|
+
);
|
|
80
|
+
const activeItem = items.find((i) => i.key === currentKey);
|
|
81
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
role: "tablist",
|
|
86
|
+
className: cn(tabListVariants({ variant }), tabListClassName),
|
|
87
|
+
children: items.map((item, i) => /* @__PURE__ */ jsx(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
role: "tab",
|
|
92
|
+
"data-tab-key": item.key,
|
|
93
|
+
id: `tab-${item.key}`,
|
|
94
|
+
"aria-selected": item.key === currentKey,
|
|
95
|
+
"aria-controls": `panel-${item.key}`,
|
|
96
|
+
"aria-disabled": item.disabled || void 0,
|
|
97
|
+
tabIndex: item.key === currentKey ? 0 : -1,
|
|
98
|
+
className: cn(
|
|
99
|
+
tabTriggerVariants({
|
|
100
|
+
variant,
|
|
101
|
+
size,
|
|
102
|
+
active: item.key === currentKey
|
|
103
|
+
}),
|
|
104
|
+
item.disabled && "nexus-tab-trigger--disabled"
|
|
105
|
+
),
|
|
106
|
+
onClick: () => !item.disabled && handleSelect(item.key),
|
|
107
|
+
onKeyDown: (e) => handleKeyDown(e, i),
|
|
108
|
+
children: item.label
|
|
109
|
+
},
|
|
110
|
+
item.key
|
|
111
|
+
))
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
destroyInactive ? activeItem?.children !== void 0 && /* @__PURE__ */ jsx(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
role: "tabpanel",
|
|
118
|
+
id: `panel-${currentKey}`,
|
|
119
|
+
"aria-labelledby": `tab-${currentKey}`,
|
|
120
|
+
className: tabPanelClassName,
|
|
121
|
+
children: activeItem.children
|
|
122
|
+
},
|
|
123
|
+
currentKey
|
|
124
|
+
) : items.map(
|
|
125
|
+
(item) => item.children !== void 0 ? /* @__PURE__ */ jsx(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
role: "tabpanel",
|
|
129
|
+
id: `panel-${item.key}`,
|
|
130
|
+
"aria-labelledby": `tab-${item.key}`,
|
|
131
|
+
className: tabPanelClassName,
|
|
132
|
+
hidden: item.key !== currentKey,
|
|
133
|
+
children: item.children
|
|
134
|
+
},
|
|
135
|
+
item.key
|
|
136
|
+
) : null
|
|
137
|
+
)
|
|
138
|
+
] });
|
|
139
|
+
}
|
|
140
|
+
Tab.displayName = "Tab";
|
|
141
|
+
|
|
142
|
+
export { Tab, tabListVariants, tabTriggerVariants };
|
|
@@ -0,0 +1,163 @@
|
|
|
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 paginationVariants = classVarianceAuthority.cva("nexus-pagination", {
|
|
29
|
+
variants: {
|
|
30
|
+
size: {
|
|
31
|
+
sm: "nexus-pagination--sm",
|
|
32
|
+
md: "nexus-pagination--md"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: { size: "md" }
|
|
36
|
+
});
|
|
37
|
+
var pageButtonVariants = classVarianceAuthority.cva("nexus-page-btn", {
|
|
38
|
+
variants: {
|
|
39
|
+
size: {
|
|
40
|
+
sm: "nexus-page-btn--sm",
|
|
41
|
+
md: "nexus-page-btn--md"
|
|
42
|
+
},
|
|
43
|
+
active: {
|
|
44
|
+
true: "nexus-page-btn--active",
|
|
45
|
+
false: "nexus-page-btn--inactive"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: { size: "md", active: false }
|
|
49
|
+
});
|
|
50
|
+
function generatePages(current, total, siblingCount) {
|
|
51
|
+
const totalNumbers = siblingCount * 2 + 5;
|
|
52
|
+
if (total <= totalNumbers) {
|
|
53
|
+
return Array.from({ length: total }, (_, i) => i + 1);
|
|
54
|
+
}
|
|
55
|
+
const leftSibling = Math.max(current - siblingCount, 1);
|
|
56
|
+
const rightSibling = Math.min(current + siblingCount, total);
|
|
57
|
+
const showLeftDots = leftSibling > 2;
|
|
58
|
+
const showRightDots = rightSibling < total - 1;
|
|
59
|
+
if (!showLeftDots && showRightDots) {
|
|
60
|
+
const leftCount = 3 + 2 * siblingCount;
|
|
61
|
+
const leftRange = Array.from({ length: leftCount }, (_, i) => i + 1);
|
|
62
|
+
return [...leftRange, "dots", total];
|
|
63
|
+
}
|
|
64
|
+
if (showLeftDots && !showRightDots) {
|
|
65
|
+
const rightCount = 3 + 2 * siblingCount;
|
|
66
|
+
const rightRange = Array.from({ length: rightCount }, (_, i) => total - rightCount + i + 1);
|
|
67
|
+
return [1, "dots", ...rightRange];
|
|
68
|
+
}
|
|
69
|
+
const middleRange = Array.from(
|
|
70
|
+
{ length: rightSibling - leftSibling + 1 },
|
|
71
|
+
(_, i) => leftSibling + i
|
|
72
|
+
);
|
|
73
|
+
return [1, "dots", ...middleRange, "dots", total];
|
|
74
|
+
}
|
|
75
|
+
var ChevronsLeft = ({ className }) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 4L3 8l4 4" }),
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13 4L9 8l4 4" })
|
|
78
|
+
] });
|
|
79
|
+
var ChevronLeft = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 4L6 8l4 4" }) });
|
|
80
|
+
var ChevronRight = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 4l4 4-4 4" }) });
|
|
81
|
+
var ChevronsRight = ({ className }) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
82
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 4l4 4-4 4" }),
|
|
83
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 4l4 4-4 4" })
|
|
84
|
+
] });
|
|
85
|
+
var Pagination = React__namespace.forwardRef(
|
|
86
|
+
({ currentPage, totalPages, siblingCount = 1, showEdges = false, onPageChange, size, className }, ref) => {
|
|
87
|
+
const pages = generatePages(currentPage, totalPages, siblingCount);
|
|
88
|
+
const iconSize = size === "sm" ? "nexus-page-icon--sm" : "nexus-page-icon--md";
|
|
89
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("nav", { ref, role: "navigation", "aria-label": "pagination", className: chunkCZC76ZD5_js.cn(paginationVariants({ size }), className), children: [
|
|
90
|
+
showEdges && /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
+
"button",
|
|
92
|
+
{
|
|
93
|
+
type: "button",
|
|
94
|
+
className: chunkCZC76ZD5_js.cn(pageButtonVariants({ size, active: false })),
|
|
95
|
+
disabled: currentPage <= 1,
|
|
96
|
+
onClick: () => onPageChange(1),
|
|
97
|
+
"aria-label": "First page",
|
|
98
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronsLeft, { className: iconSize })
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
102
|
+
"button",
|
|
103
|
+
{
|
|
104
|
+
type: "button",
|
|
105
|
+
className: chunkCZC76ZD5_js.cn(pageButtonVariants({ size, active: false })),
|
|
106
|
+
disabled: currentPage <= 1,
|
|
107
|
+
onClick: () => onPageChange(currentPage - 1),
|
|
108
|
+
"aria-label": "Previous page",
|
|
109
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeft, { className: iconSize })
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
pages.map(
|
|
113
|
+
(page, i) => page === "dots" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
114
|
+
"span",
|
|
115
|
+
{
|
|
116
|
+
className: chunkCZC76ZD5_js.cn(pageButtonVariants({ size, active: false })),
|
|
117
|
+
style: { pointerEvents: "none" },
|
|
118
|
+
children: "\xB7\xB7\xB7"
|
|
119
|
+
},
|
|
120
|
+
`dots-${i}`
|
|
121
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
type: "button",
|
|
125
|
+
className: chunkCZC76ZD5_js.cn(pageButtonVariants({ size, active: page === currentPage })),
|
|
126
|
+
onClick: () => onPageChange(page),
|
|
127
|
+
"aria-current": page === currentPage ? "page" : void 0,
|
|
128
|
+
"aria-label": `Page ${page}`,
|
|
129
|
+
children: page
|
|
130
|
+
},
|
|
131
|
+
page
|
|
132
|
+
)
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
135
|
+
"button",
|
|
136
|
+
{
|
|
137
|
+
type: "button",
|
|
138
|
+
className: chunkCZC76ZD5_js.cn(pageButtonVariants({ size, active: false })),
|
|
139
|
+
disabled: currentPage >= totalPages,
|
|
140
|
+
onClick: () => onPageChange(currentPage + 1),
|
|
141
|
+
"aria-label": "Next page",
|
|
142
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { className: iconSize })
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
showEdges && /* @__PURE__ */ jsxRuntime.jsx(
|
|
146
|
+
"button",
|
|
147
|
+
{
|
|
148
|
+
type: "button",
|
|
149
|
+
className: chunkCZC76ZD5_js.cn(pageButtonVariants({ size, active: false })),
|
|
150
|
+
disabled: currentPage >= totalPages,
|
|
151
|
+
onClick: () => onPageChange(totalPages),
|
|
152
|
+
"aria-label": "Last page",
|
|
153
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronsRight, { className: iconSize })
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
] });
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
Pagination.displayName = "Pagination";
|
|
160
|
+
|
|
161
|
+
exports.Pagination = Pagination;
|
|
162
|
+
exports.pageButtonVariants = pageButtonVariants;
|
|
163
|
+
exports.paginationVariants = paginationVariants;
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var chipVariants = cva("nexus-chip", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "nexus-chip--default",
|
|
11
|
+
filled: "nexus-chip--filled",
|
|
12
|
+
outline: "nexus-chip--outline",
|
|
13
|
+
accent: "nexus-chip--accent"
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
sm: "nexus-chip--sm",
|
|
17
|
+
md: "nexus-chip--md",
|
|
18
|
+
lg: "nexus-chip--lg"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
variant: "default",
|
|
23
|
+
size: "md"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var CloseIcon = ({ className }) => /* @__PURE__ */ jsx(
|
|
27
|
+
"svg",
|
|
28
|
+
{
|
|
29
|
+
className,
|
|
30
|
+
viewBox: "0 0 16 16",
|
|
31
|
+
fill: "none",
|
|
32
|
+
stroke: "currentColor",
|
|
33
|
+
strokeWidth: "2",
|
|
34
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8", strokeLinecap: "round" })
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
var Chip = React.forwardRef(
|
|
38
|
+
({
|
|
39
|
+
className,
|
|
40
|
+
variant,
|
|
41
|
+
size,
|
|
42
|
+
asChild = false,
|
|
43
|
+
disabled,
|
|
44
|
+
children,
|
|
45
|
+
onClose,
|
|
46
|
+
...props
|
|
47
|
+
}, ref) => {
|
|
48
|
+
const Comp = asChild ? Slot : "div";
|
|
49
|
+
return /* @__PURE__ */ jsxs(
|
|
50
|
+
Comp,
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
className: cn(chipVariants({ variant, size }), className),
|
|
54
|
+
"aria-disabled": disabled || void 0,
|
|
55
|
+
...props,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsx("span", { children }),
|
|
58
|
+
onClose && /* @__PURE__ */ jsx(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
className: "nexus-chip__close",
|
|
63
|
+
onClick: disabled ? void 0 : onClose,
|
|
64
|
+
disabled,
|
|
65
|
+
"aria-label": "Remove",
|
|
66
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { className: "nexus-chip__close-icon" })
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
Chip.displayName = "Chip";
|
|
75
|
+
|
|
76
|
+
export { Chip, chipVariants };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Drawer as Drawer$1 } from 'vaul';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var DrawerDirectionCtx = React.createContext("bottom");
|
|
8
|
+
var drawerOverlayVariants = cva("nexus-drawer-overlay", {
|
|
9
|
+
variants: {
|
|
10
|
+
blur: {
|
|
11
|
+
none: "",
|
|
12
|
+
sm: "nexus-drawer-overlay--blur-sm",
|
|
13
|
+
md: "nexus-drawer-overlay--blur-md"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: { blur: "none" }
|
|
17
|
+
});
|
|
18
|
+
var drawerContentVariants = cva("nexus-drawer-content", {
|
|
19
|
+
variants: {
|
|
20
|
+
direction: {
|
|
21
|
+
bottom: "nexus-drawer-content--bottom",
|
|
22
|
+
top: "nexus-drawer-content--top",
|
|
23
|
+
left: "nexus-drawer-content--left",
|
|
24
|
+
right: "nexus-drawer-content--right"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: { direction: "bottom" }
|
|
28
|
+
});
|
|
29
|
+
var DrawerRoot = ({ direction = "bottom", ...props }) => /* @__PURE__ */ jsx(DrawerDirectionCtx.Provider, { value: direction, children: /* @__PURE__ */ jsx(Drawer$1.Root, { shouldScaleBackground: false, direction, ...props }) });
|
|
30
|
+
var DrawerTrigger = (props) => /* @__PURE__ */ jsx(Drawer$1.Trigger, { ...props });
|
|
31
|
+
DrawerTrigger.displayName = "DrawerTrigger";
|
|
32
|
+
var DrawerContent = React.forwardRef(
|
|
33
|
+
({
|
|
34
|
+
className,
|
|
35
|
+
children,
|
|
36
|
+
direction: directionProp,
|
|
37
|
+
showHandle = true,
|
|
38
|
+
blur,
|
|
39
|
+
overlayClassName,
|
|
40
|
+
...props
|
|
41
|
+
}, ref) => {
|
|
42
|
+
const ctxDirection = React.useContext(DrawerDirectionCtx);
|
|
43
|
+
const direction = directionProp ?? ctxDirection;
|
|
44
|
+
return /* @__PURE__ */ jsxs(Drawer$1.Portal, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
Drawer$1.Overlay,
|
|
47
|
+
{
|
|
48
|
+
className: cn(drawerOverlayVariants({ blur }), overlayClassName)
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsxs(
|
|
52
|
+
Drawer$1.Content,
|
|
53
|
+
{
|
|
54
|
+
ref,
|
|
55
|
+
className: cn(drawerContentVariants({ direction }), className),
|
|
56
|
+
...props,
|
|
57
|
+
children: [
|
|
58
|
+
showHandle && (direction === "bottom" || direction === "top") && /* @__PURE__ */ jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: cn("nexus-drawer-handle", direction === "bottom" ? "nexus-drawer-handle--bottom" : "nexus-drawer-handle--top"),
|
|
62
|
+
children: /* @__PURE__ */ jsx("div", { className: "nexus-drawer-handle__bar" })
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
children
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
DrawerContent.displayName = "DrawerContent";
|
|
73
|
+
var DrawerClose = (props) => /* @__PURE__ */ jsx(Drawer$1.Close, { ...props });
|
|
74
|
+
DrawerClose.displayName = "DrawerClose";
|
|
75
|
+
var DrawerTitle = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
76
|
+
Drawer$1.Title,
|
|
77
|
+
{
|
|
78
|
+
className: cn("nexus-drawer-title", className),
|
|
79
|
+
...props
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
DrawerTitle.displayName = "DrawerTitle";
|
|
83
|
+
var DrawerDescription = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
84
|
+
Drawer$1.Description,
|
|
85
|
+
{
|
|
86
|
+
className: cn("nexus-drawer-description", className),
|
|
87
|
+
...props
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
DrawerDescription.displayName = "DrawerDescription";
|
|
91
|
+
var Drawer = Object.assign(DrawerRoot, {
|
|
92
|
+
Trigger: DrawerTrigger,
|
|
93
|
+
Content: DrawerContent,
|
|
94
|
+
Close: DrawerClose,
|
|
95
|
+
Title: DrawerTitle,
|
|
96
|
+
Description: DrawerDescription
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerRoot, DrawerTitle, DrawerTrigger, drawerContentVariants, drawerOverlayVariants };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var Marquee = React.forwardRef(
|
|
6
|
+
({ direction = "left", speed = 40, pauseOnHover = false, gap = 16, children, className, style, ...props }, ref) => {
|
|
7
|
+
const containerRef = React.useRef(null);
|
|
8
|
+
const [copies, setCopies] = React.useState(2);
|
|
9
|
+
const [prefersReducedMotion, setPrefersReducedMotion] = React.useState(false);
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
12
|
+
setPrefersReducedMotion(mq.matches);
|
|
13
|
+
const handler = (e) => setPrefersReducedMotion(e.matches);
|
|
14
|
+
mq.addEventListener("change", handler);
|
|
15
|
+
return () => mq.removeEventListener("change", handler);
|
|
16
|
+
}, []);
|
|
17
|
+
const isHorizontal = direction === "left" || direction === "right";
|
|
18
|
+
const isReverse = direction === "right" || direction === "down";
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
const container = containerRef.current;
|
|
21
|
+
if (!container) return;
|
|
22
|
+
const measure = () => {
|
|
23
|
+
const firstChild = container.firstElementChild;
|
|
24
|
+
if (!firstChild) return;
|
|
25
|
+
const containerSize = isHorizontal ? container.offsetWidth : container.offsetHeight;
|
|
26
|
+
const childSize = isHorizontal ? firstChild.offsetWidth : firstChild.offsetHeight;
|
|
27
|
+
if (childSize > 0) {
|
|
28
|
+
const needed = Math.ceil(containerSize / childSize) + 2;
|
|
29
|
+
setCopies(Math.max(2, needed));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
measure();
|
|
33
|
+
const observer = new ResizeObserver(measure);
|
|
34
|
+
observer.observe(container);
|
|
35
|
+
return () => observer.disconnect();
|
|
36
|
+
}, [isHorizontal, children]);
|
|
37
|
+
const animationName = isHorizontal ? "nx-marquee-x" : "nx-marquee-y";
|
|
38
|
+
const translate = isHorizontal ? isReverse ? "translateX(0)" : "translateX(0)" : isReverse ? "translateY(0)" : "translateY(0)";
|
|
39
|
+
const endTranslate = isHorizontal ? `translateX(${isReverse ? "" : "-"}100%)` : `translateY(${isReverse ? "" : "-"}100%)`;
|
|
40
|
+
const innerStyle = {
|
|
41
|
+
display: "flex",
|
|
42
|
+
flexDirection: isHorizontal ? "row" : "column",
|
|
43
|
+
gap,
|
|
44
|
+
...prefersReducedMotion ? {} : {
|
|
45
|
+
animation: `${animationName} ${speed}s linear infinite`,
|
|
46
|
+
...isReverse ? { animationDirection: "reverse" } : {}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const keyframes = `
|
|
50
|
+
@keyframes ${animationName} {
|
|
51
|
+
from { transform: ${translate}; }
|
|
52
|
+
to { transform: ${endTranslate}; }
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
return /* @__PURE__ */ jsxs(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
className: cn(
|
|
60
|
+
"nexus-marquee",
|
|
61
|
+
pauseOnHover && "nexus-marquee--pause-on-hover",
|
|
62
|
+
className
|
|
63
|
+
),
|
|
64
|
+
style,
|
|
65
|
+
...props,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx("style", { children: keyframes }),
|
|
68
|
+
/* @__PURE__ */ jsx("div", { ref: containerRef, style: innerStyle, children: Array.from({ length: copies }, (_, i) => /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: isHorizontal ? "row" : "column", gap, flexShrink: 0 }, children }, i)) })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
Marquee.displayName = "Marquee";
|
|
75
|
+
|
|
76
|
+
export { Marquee };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/utils/scroll.ts
|
|
4
|
+
var hasWindow = () => typeof window !== "undefined";
|
|
5
|
+
var scrollFreeze = () => {
|
|
6
|
+
if (!hasWindow()) return;
|
|
7
|
+
const body = document.body;
|
|
8
|
+
body.setAttribute(
|
|
9
|
+
"data-fz",
|
|
10
|
+
body.dataset.fz ? `${Number(body.dataset.fz) + 1}` : "1"
|
|
11
|
+
);
|
|
12
|
+
if (body.style.position !== "fixed") {
|
|
13
|
+
const scrollPosition = window.scrollY;
|
|
14
|
+
body.setAttribute("data-scroll-y", String(scrollPosition));
|
|
15
|
+
}
|
|
16
|
+
body.style.overflow = "hidden";
|
|
17
|
+
body.style.touchAction = "none";
|
|
18
|
+
body.style.position = "fixed";
|
|
19
|
+
body.style.top = `-${body.dataset.scrollY}px`;
|
|
20
|
+
body.style.left = "0";
|
|
21
|
+
body.style.width = "100%";
|
|
22
|
+
};
|
|
23
|
+
var scrollRelease = () => {
|
|
24
|
+
if (!hasWindow()) return;
|
|
25
|
+
const body = document.body;
|
|
26
|
+
if (body.dataset.fz && Number(body.dataset.fz) > 1) {
|
|
27
|
+
body.setAttribute("data-fz", `${Number(body.dataset.fz) - 1}`);
|
|
28
|
+
} else {
|
|
29
|
+
body.removeAttribute("data-fz");
|
|
30
|
+
body.style.position = "";
|
|
31
|
+
body.style.top = "";
|
|
32
|
+
body.style.left = "";
|
|
33
|
+
body.style.width = "";
|
|
34
|
+
body.style.overflow = "";
|
|
35
|
+
body.style.paddingRight = "";
|
|
36
|
+
body.style.backgroundColor = "";
|
|
37
|
+
body.style.touchAction = "";
|
|
38
|
+
window.scrollTo(0, Number(body.dataset.scrollY));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.scrollFreeze = scrollFreeze;
|
|
43
|
+
exports.scrollRelease = scrollRelease;
|