@nexus-cross/design-system 1.0.4-beta.1 → 1.0.4
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 +167 -145
- package/cursor-rules/nexus-ui-api.mdc +894 -311
- package/cursor-rules/nexus-ui-components.mdc +179 -91
- package/dist/accordion.js +7 -7
- package/dist/accordion.mjs +2 -2
- package/dist/alert.d.mts +17 -0
- package/dist/alert.d.ts +17 -0
- package/dist/alert.js +16 -0
- package/dist/alert.mjs +3 -0
- package/dist/avatar.js +4 -4
- package/dist/avatar.mjs +2 -2
- package/dist/badge.d.mts +18 -0
- package/dist/badge.d.ts +18 -0
- package/dist/badge.js +16 -0
- package/dist/badge.mjs +3 -0
- package/dist/breadcrumb.d.mts +15 -0
- package/dist/breadcrumb.d.ts +15 -0
- package/dist/breadcrumb.js +12 -0
- package/dist/breadcrumb.mjs +3 -0
- package/dist/button.js +4 -4
- package/dist/button.mjs +2 -2
- package/dist/carousel.js +8 -8
- package/dist/carousel.mjs +2 -2
- package/dist/checkbox.js +5 -5
- package/dist/checkbox.mjs +2 -2
- package/dist/chip.d.mts +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chip.js +4 -4
- package/dist/chip.mjs +2 -2
- package/dist/chunks/{chunk-5TBXVD56.js → chunk-2MC7XJSE.js} +16 -6
- package/dist/chunks/chunk-2N2EPBO4.js +120 -0
- package/dist/chunks/{chunk-BEA727LO.mjs → chunk-2RPRCWKV.mjs} +57 -26
- package/dist/chunks/chunk-2UPGFY6E.mjs +76 -0
- package/dist/chunks/{chunk-5I2VRWWU.js → chunk-2ZXDXO4I.js} +32 -38
- package/dist/chunks/{chunk-RLP3U52D.mjs → chunk-33UFQJIO.mjs} +22 -40
- package/dist/chunks/{chunk-AOVU67NI.mjs → chunk-3HHJORN7.mjs} +23 -25
- package/dist/chunks/{chunk-TWHDXCKR.js → chunk-3PCNRCTB.js} +8 -8
- package/dist/chunks/chunk-3ZWN66YH.js +53 -0
- package/dist/chunks/chunk-4ENXP7WH.js +224 -0
- package/dist/chunks/{chunk-YEGPB7A7.js → chunk-5JHJNN2K.js} +4 -4
- package/dist/chunks/chunk-5PQ3UCKF.js +99 -0
- package/dist/chunks/chunk-6BWOKTVQ.mjs +87 -0
- package/dist/chunks/chunk-6DBRL6NA.mjs +81 -0
- package/dist/chunks/{chunk-C3E7CSKG.mjs → chunk-6FMDO6TT.mjs} +7 -8
- package/dist/chunks/{chunk-76CY4STF.js → chunk-7G65JBTN.js} +34 -66
- package/dist/chunks/{chunk-GMIGQ5VP.mjs → chunk-ADO7PDLY.mjs} +15 -35
- package/dist/chunks/{chunk-ZINDMFOI.js → chunk-AFSEYJZT.js} +24 -32
- package/dist/chunks/chunk-B5O6W3Z4.mjs +73 -0
- package/dist/chunks/{chunk-6FHK6CBR.js → chunk-B6G5TJRO.js} +7 -8
- package/dist/chunks/chunk-BBLBTOP4.js +205 -0
- package/dist/chunks/{chunk-5XVEYVYA.js → chunk-BLGQHR3M.js} +5 -8
- package/dist/chunks/{chunk-LVTD2UQN.mjs → chunk-BPUQ2CO2.mjs} +2 -2
- package/dist/chunks/{chunk-AWBGWBFS.js → chunk-BSZ2LN6E.js} +21 -27
- package/dist/chunks/chunk-C2DSAJTL.js +109 -0
- package/dist/chunks/{chunk-KWPIEHD2.mjs → chunk-CA3SOLI3.mjs} +1 -1
- package/dist/chunks/{chunk-MPKRXMCJ.js → chunk-CSJDDREF.js} +7 -10
- package/dist/chunks/chunk-CUTMLBC3.mjs +86 -0
- package/dist/chunks/chunk-CV4GMFWP.js +174 -0
- package/dist/chunks/{chunk-SXLMI7CZ.mjs → chunk-CWMLTXOH.mjs} +162 -234
- package/dist/chunks/chunk-CZC76ZD5.js +10 -0
- package/dist/chunks/chunk-DICN6GKE.js +99 -0
- package/dist/chunks/{chunk-TLTEUIBY.js → chunk-DLFV7ZZV.js} +4 -4
- package/dist/chunks/chunk-DO6VK2QQ.mjs +108 -0
- package/dist/chunks/chunk-DYPPVXQF.js +143 -0
- package/dist/chunks/{chunk-GQP7IXH2.mjs → chunk-ECVAVQUY.mjs} +23 -31
- package/dist/chunks/{chunk-3CHRUKSJ.mjs → chunk-EHAUUUWB.mjs} +3 -3
- package/dist/chunks/chunk-EJY7IVSK.mjs +31 -0
- package/dist/chunks/{chunk-G4XJG7XI.js → chunk-EVOOTSY5.js} +3 -10
- package/dist/chunks/chunk-FUIBYZZ4.mjs +98 -0
- package/dist/chunks/{chunk-VH5FF6DZ.mjs → chunk-GX6GSWX3.mjs} +7 -7
- package/dist/chunks/chunk-H2G5FMRN.mjs +75 -0
- package/dist/chunks/chunk-H2V7RHYV.mjs +120 -0
- package/dist/chunks/{chunk-DDMZSNTG.js → chunk-HFBTS42N.js} +168 -240
- package/dist/chunks/{chunk-OGUTGD4J.mjs → chunk-HNLI646G.mjs} +71 -39
- package/dist/chunks/{chunk-C6H2UNOX.js → chunk-IE4DGLMH.js} +13 -21
- package/dist/chunks/{chunk-U76LT5GE.js → chunk-IOSIQLZL.js} +2 -2
- package/dist/chunks/{chunk-ZCMKIB5U.js → chunk-J5ZKGPBY.js} +33 -41
- package/dist/chunks/{chunk-JUZHWKGS.mjs → chunk-K2TBLM3F.mjs} +6 -12
- package/dist/chunks/chunk-KZ7S5VN2.js +7 -0
- package/dist/chunks/{chunk-FHPHDK3O.mjs → chunk-LI7SFBUQ.mjs} +4 -4
- package/dist/chunks/{chunk-7OEK2KX3.mjs → chunk-LMMON5AU.mjs} +4 -4
- package/dist/chunks/{chunk-6DZVNFVY.js → chunk-LOQXCHKL.js} +4 -12
- package/dist/chunks/{chunk-377KBJQG.js → chunk-MA2VCCIY.js} +19 -22
- package/dist/chunks/chunk-MCKOWMLS.mjs +8 -0
- package/dist/chunks/chunk-MMCA33FW.mjs +85 -0
- package/dist/chunks/{chunk-TR5JBBEA.mjs → chunk-MRRKW5QN.mjs} +31 -39
- package/dist/chunks/{chunk-76K6KXCT.js → chunk-NFIPQZ4O.js} +1 -1
- package/dist/chunks/chunk-NZHK76R3.js +109 -0
- package/dist/chunks/{chunk-I7YJB2F5.js → chunk-OMN5YQCE.js} +3 -3
- package/dist/chunks/{chunk-B7UU3FSS.mjs → chunk-P2T72N62.mjs} +4 -7
- package/dist/chunks/chunk-P3DZKXG4.js +116 -0
- package/dist/chunks/chunk-P73MEU7N.mjs +150 -0
- package/dist/chunks/chunk-PDJTSQOC.js +59 -0
- package/dist/chunks/{chunk-RXVYL4AU.js → chunk-PEIEVKD5.js} +7 -13
- package/dist/chunks/chunk-PI464222.mjs +5 -0
- package/dist/chunks/{chunk-IJG7J2VU.mjs → chunk-QZ4QR3XV.mjs} +30 -36
- package/dist/chunks/{chunk-6NTASYZO.js → chunk-RS3SBY3I.js} +61 -30
- package/dist/chunks/{chunk-AKIBUO5A.mjs → chunk-RX5UKRYK.mjs} +19 -26
- package/dist/chunks/chunk-S2GMEC43.js +109 -0
- package/dist/chunks/{chunk-WJ2OVQD3.mjs → chunk-SGNRVYYQ.mjs} +19 -25
- package/dist/chunks/{chunk-IB5UCYQY.mjs → chunk-SJMCPSVH.mjs} +15 -5
- package/dist/chunks/chunk-UKRU46PH.mjs +182 -0
- package/dist/chunks/{chunk-WNFJ4NJN.mjs → chunk-ULGYTBCT.mjs} +3 -11
- package/dist/chunks/{chunk-TXYYBJBQ.js → chunk-VGO4Z2WH.js} +73 -41
- package/dist/chunks/{chunk-LBKBCI2K.mjs → chunk-VIGRCJAE.mjs} +3 -10
- package/dist/chunks/chunk-VVXQZ4XH.mjs +93 -0
- package/dist/chunks/{chunk-Z7OKV6NW.mjs → chunk-W4GG5A7K.mjs} +12 -20
- package/dist/chunks/chunk-WGGBE4ZD.mjs +201 -0
- package/dist/chunks/{chunk-WSWD5ZUJ.js → chunk-WKCXACMZ.js} +20 -27
- package/dist/chunks/{chunk-GSLIY6WW.js → chunk-X2SHTVZQ.js} +17 -37
- package/dist/chunks/chunk-X3CTJ7TD.js +108 -0
- package/dist/chunks/{chunk-U6KOUYWX.mjs → chunk-XG6QG65W.mjs} +7 -10
- package/dist/chunks/chunk-XGIJZ3NZ.js +160 -0
- package/dist/chunks/chunk-YB5ZKHVB.js +64 -0
- package/dist/chunks/{chunk-Q7H6LCNN.js → chunk-YCG4FZC3.js} +23 -25
- package/dist/chunks/{chunk-JZ3PWHKS.mjs → chunk-YLO4UKSC.mjs} +18 -21
- package/dist/chunks/chunk-YO5MSDPX.mjs +36 -0
- package/dist/chunks/{chunk-Q2TMXHPK.js → chunk-YZV6FWE7.js} +25 -43
- package/dist/chunks/chunk-ZI4LN2B2.js +96 -0
- package/dist/chunks/chunk-ZU4AWAFT.mjs +137 -0
- package/dist/chunks/chunk-ZWSIIGA3.mjs +58 -0
- package/dist/countdown.js +4 -4
- package/dist/countdown.mjs +2 -2
- package/dist/counter.js +2 -2
- package/dist/counter.mjs +1 -1
- package/dist/data-list.js +5 -5
- package/dist/data-list.mjs +4 -4
- package/dist/date-picker.d.mts +17 -0
- package/dist/date-picker.d.ts +17 -0
- package/dist/date-picker.js +12 -0
- package/dist/date-picker.mjs +3 -0
- package/dist/divider.js +4 -4
- package/dist/divider.mjs +2 -2
- package/dist/drawer.d.mts +1 -1
- package/dist/drawer.d.ts +1 -1
- package/dist/drawer.js +11 -11
- package/dist/drawer.mjs +2 -2
- package/dist/dropdown-menu.d.mts +30 -0
- package/dist/dropdown-menu.d.ts +30 -0
- package/dist/dropdown-menu.js +32 -0
- package/dist/dropdown-menu.mjs +3 -0
- package/dist/ellipsis.js +3 -3
- package/dist/ellipsis.mjs +2 -2
- package/dist/empty-state.d.mts +16 -0
- package/dist/empty-state.d.ts +16 -0
- package/dist/empty-state.js +16 -0
- package/dist/empty-state.mjs +3 -0
- package/dist/error-boundary.d.mts +1 -1
- package/dist/error-boundary.d.ts +1 -1
- package/dist/error-boundary.js +2 -2
- package/dist/error-boundary.mjs +1 -1
- package/dist/index.d.mts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +322 -200
- package/dist/index.mjs +49 -35
- package/dist/infinite-scroll.js +3 -3
- package/dist/infinite-scroll.mjs +2 -2
- package/dist/marquee.js +3 -3
- package/dist/marquee.mjs +2 -2
- package/dist/modal/index.js +13 -13
- package/dist/modal/index.mjs +4 -4
- package/dist/number-input.d.mts +1 -1
- package/dist/number-input.d.ts +1 -1
- package/dist/number-input.js +5 -5
- package/dist/number-input.mjs +2 -2
- package/dist/nx-image.d.mts +13 -0
- package/dist/nx-image.d.ts +13 -0
- package/dist/nx-image.js +12 -0
- package/dist/nx-image.mjs +3 -0
- package/dist/pagination.d.mts +1 -0
- package/dist/pagination.d.ts +1 -0
- package/dist/pagination.js +5 -5
- package/dist/pagination.mjs +2 -2
- package/dist/popover.d.mts +1 -1
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +8 -8
- package/dist/popover.mjs +2 -2
- package/dist/price-input.d.mts +36 -0
- package/dist/price-input.d.ts +36 -0
- package/dist/price-input.js +16 -0
- package/dist/price-input.mjs +3 -0
- package/dist/progress.d.mts +18 -0
- package/dist/progress.d.ts +18 -0
- package/dist/progress.js +16 -0
- package/dist/progress.mjs +3 -0
- package/dist/radio-group.js +6 -6
- package/dist/radio-group.mjs +2 -2
- package/dist/schemas/_all.json +2356 -404
- package/dist/schemas/accordion.json +14 -11
- package/dist/schemas/alert.json +49 -0
- package/dist/schemas/avatar.json +13 -7
- package/dist/schemas/badge.json +76 -0
- package/dist/schemas/breadcrumb.json +47 -0
- package/dist/schemas/button.json +27 -9
- package/dist/schemas/carousel.json +10 -4
- 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 +33 -8
- package/dist/schemas/chip.json +15 -6
- package/dist/schemas/clientOnly.json +19 -0
- package/dist/schemas/countdown.json +10 -7
- package/dist/schemas/counter.json +15 -9
- package/dist/schemas/dataList.json +10 -10
- package/dist/schemas/datePicker.json +56 -0
- package/dist/schemas/divider.json +8 -5
- package/dist/schemas/drawer.json +24 -2
- package/dist/schemas/drawerClose.json +24 -0
- package/dist/schemas/drawerContent.json +9 -6
- package/dist/schemas/drawerDescription.json +20 -0
- package/dist/schemas/drawerTitle.json +20 -0
- package/dist/schemas/drawerTrigger.json +24 -0
- package/dist/schemas/dropdownMenu.json +83 -0
- package/dist/schemas/ellipsis.json +17 -7
- package/dist/schemas/emptyState.json +44 -0
- package/dist/schemas/errorBoundary.json +22 -0
- package/dist/schemas/infiniteScroll.json +18 -9
- package/dist/schemas/marquee.json +12 -6
- package/dist/schemas/modalCall.json +81 -3
- package/dist/schemas/modalTemplate.json +67 -14
- package/dist/schemas/numberInput.json +42 -12
- package/dist/schemas/nxImage.json +56 -0
- package/dist/schemas/pagination.json +13 -6
- package/dist/schemas/popover.json +18 -9
- package/dist/schemas/priceInput.json +104 -0
- package/dist/schemas/progress.json +63 -0
- package/dist/schemas/radioGroup.json +19 -9
- package/dist/schemas/radioItem.json +12 -5
- package/dist/schemas/select.json +15 -9
- package/dist/schemas/selectItem.json +7 -4
- package/dist/schemas/skeleton.json +12 -6
- package/dist/schemas/slider.json +78 -0
- package/dist/schemas/spinner.json +11 -4
- package/dist/schemas/stepper.json +73 -0
- package/dist/schemas/switch.json +23 -5
- package/dist/schemas/tab.json +17 -14
- package/dist/schemas/table.json +75 -0
- package/dist/schemas/tableRow.json +32 -0
- package/dist/schemas/tagInput.json +70 -0
- package/dist/schemas/tdColumn.json +107 -0
- package/dist/schemas/textArea.json +72 -7
- package/dist/schemas/textInput.json +72 -10
- package/dist/schemas/themeProvider.json +65 -0
- package/dist/schemas/toastOptions.json +81 -0
- package/dist/schemas/toaster.json +76 -0
- package/dist/schemas/toggleGroup.json +88 -0
- package/dist/schemas/tooltip.json +12 -9
- package/dist/schemas/virtualGrid.json +22 -11
- package/dist/schemas/virtualList.json +14 -8
- package/dist/schemas.d.mts +1360 -81
- package/dist/schemas.d.ts +1360 -81
- package/dist/schemas.js +725 -273
- package/dist/schemas.mjs +698 -273
- package/dist/select.js +6 -6
- package/dist/select.mjs +2 -2
- package/dist/skeleton.js +3 -3
- package/dist/skeleton.mjs +2 -2
- package/dist/slider.d.mts +20 -0
- package/dist/slider.d.ts +20 -0
- package/dist/slider.js +16 -0
- package/dist/slider.mjs +3 -0
- package/dist/spinner.js +3 -3
- package/dist/spinner.mjs +2 -2
- package/dist/stepper.d.mts +20 -0
- package/dist/stepper.d.ts +20 -0
- package/dist/stepper.js +16 -0
- package/dist/stepper.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 +3872 -2
- package/dist/styles.js +2 -5
- package/dist/styles.layered.css +3875 -0
- package/dist/styles.mjs +1 -4
- package/dist/switch.js +4 -4
- package/dist/switch.mjs +2 -2
- package/dist/tab.js +5 -5
- package/dist/tab.mjs +2 -2
- package/dist/table.d.mts +2 -2
- package/dist/table.d.ts +2 -2
- package/dist/table.js +9 -9
- package/dist/table.mjs +3 -3
- package/dist/tag-input.d.mts +21 -0
- package/dist/tag-input.d.ts +21 -0
- package/dist/tag-input.js +16 -0
- package/dist/tag-input.mjs +3 -0
- package/dist/text-area.d.mts +5 -1
- package/dist/text-area.d.ts +5 -1
- package/dist/text-area.js +4 -4
- package/dist/text-area.mjs +2 -2
- package/dist/text-input.d.mts +5 -1
- package/dist/text-input.d.ts +5 -1
- package/dist/text-input.js +4 -4
- package/dist/text-input.mjs +2 -2
- package/dist/toast.js +5 -5
- package/dist/toast.mjs +2 -2
- package/dist/toggle-group.d.mts +36 -0
- package/dist/toggle-group.d.ts +36 -0
- package/dist/toggle-group.js +16 -0
- package/dist/toggle-group.mjs +3 -0
- package/dist/tooltip.js +5 -5
- package/dist/tooltip.mjs +2 -2
- package/dist/utils/cn.d.mts +0 -10
- package/dist/utils/cn.d.ts +0 -10
- package/dist/utils/cn.js +2 -2
- package/dist/utils/cn.mjs +1 -1
- package/dist/virtual-scroll.js +4 -4
- package/dist/virtual-scroll.mjs +2 -2
- package/package.json +90 -17
- package/scripts/setup-cursor-rules.cjs +6 -6
- package/dist/chunks/chunk-7MT3QYE6.js +0 -92
- package/dist/chunks/chunk-FA2OPP3U.mjs +0 -140
- package/dist/chunks/chunk-FKZI2HTI.js +0 -104
- package/dist/chunks/chunk-NCQDOPBR.mjs +0 -86
- package/dist/chunks/chunk-NTN55ZIX.mjs +0 -113
- package/dist/chunks/chunk-Q7GQVAYY.js +0 -88
- package/dist/chunks/chunk-QJNQCLMV.js +0 -25
- package/dist/chunks/chunk-UDQXLI5Y.mjs +0 -81
- package/dist/chunks/chunk-UR6JOKVB.mjs +0 -65
- package/dist/chunks/chunk-WVIEIRK2.js +0 -136
- package/dist/chunks/chunk-XALPBGSC.mjs +0 -23
- package/dist/schemas/typography.json +0 -70
- package/dist/typography.d.mts +0 -19
- package/dist/typography.d.ts +0 -19
- package/dist/typography.js +0 -102
- package/dist/typography.mjs +0 -79
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
|
|
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
|
+
var ToggleGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToggleGroupPrimitive);
|
|
29
|
+
|
|
30
|
+
var toggleGroupVariants = classVarianceAuthority.cva("nexus-toggle-group", {
|
|
31
|
+
variants: {
|
|
32
|
+
variant: {
|
|
33
|
+
default: "nexus-toggle-group--default",
|
|
34
|
+
outline: "nexus-toggle-group--outline"
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
sm: "nexus-toggle-group--sm",
|
|
38
|
+
md: "nexus-toggle-group--md",
|
|
39
|
+
lg: "nexus-toggle-group--lg"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
variant: "default",
|
|
44
|
+
size: "md"
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
var ToggleGroup = React__namespace.forwardRef(
|
|
48
|
+
({ className, variant, size, items, disabled, ...props }, ref) => {
|
|
49
|
+
const rootRef = React__namespace.useRef(null);
|
|
50
|
+
const [animated, setAnimated] = React__namespace.useState(false);
|
|
51
|
+
const [pos, setPos] = React__namespace.useState(null);
|
|
52
|
+
const combinedRef = React__namespace.useCallback(
|
|
53
|
+
(node) => {
|
|
54
|
+
rootRef.current = node;
|
|
55
|
+
if (typeof ref === "function") ref(node);
|
|
56
|
+
else if (ref) ref.current = node;
|
|
57
|
+
},
|
|
58
|
+
[ref]
|
|
59
|
+
);
|
|
60
|
+
const currentValue = props.type === "multiple" ? props.value ?? props.defaultValue : props.value ?? props.defaultValue;
|
|
61
|
+
const [trackedValue, setTrackedValue] = React__namespace.useState(currentValue);
|
|
62
|
+
React__namespace.useEffect(() => {
|
|
63
|
+
if (currentValue !== void 0) setTrackedValue(currentValue);
|
|
64
|
+
}, [currentValue]);
|
|
65
|
+
const isDefault = variant !== "outline";
|
|
66
|
+
React__namespace.useLayoutEffect(() => {
|
|
67
|
+
const root = rootRef.current;
|
|
68
|
+
if (!root || !isDefault) return;
|
|
69
|
+
const activeVal = Array.isArray(trackedValue) ? trackedValue[0] : trackedValue;
|
|
70
|
+
if (!activeVal) {
|
|
71
|
+
setPos(null);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const idx = items.findIndex((item) => item.value === activeVal);
|
|
75
|
+
if (idx === -1) {
|
|
76
|
+
setPos(null);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const itemEls = root.querySelectorAll(
|
|
80
|
+
".nexus-toggle-group__item"
|
|
81
|
+
);
|
|
82
|
+
const el = itemEls[idx];
|
|
83
|
+
if (!el) return;
|
|
84
|
+
const rootRect = root.getBoundingClientRect();
|
|
85
|
+
const elRect = el.getBoundingClientRect();
|
|
86
|
+
setPos({
|
|
87
|
+
width: elRect.width,
|
|
88
|
+
height: elRect.height,
|
|
89
|
+
x: elRect.left - rootRect.left,
|
|
90
|
+
y: elRect.top - rootRect.top
|
|
91
|
+
});
|
|
92
|
+
}, [trackedValue, items, isDefault]);
|
|
93
|
+
React__namespace.useEffect(() => {
|
|
94
|
+
const frame = requestAnimationFrame(() => {
|
|
95
|
+
requestAnimationFrame(() => setAnimated(true));
|
|
96
|
+
});
|
|
97
|
+
return () => cancelAnimationFrame(frame);
|
|
98
|
+
}, []);
|
|
99
|
+
const handleSingleChange = React__namespace.useCallback(
|
|
100
|
+
(val) => {
|
|
101
|
+
setTrackedValue(val);
|
|
102
|
+
if (props.type !== "multiple") {
|
|
103
|
+
props.onValueChange?.(val);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
[props.type, props.onValueChange]
|
|
107
|
+
);
|
|
108
|
+
const handleMultipleChange = React__namespace.useCallback(
|
|
109
|
+
(val) => {
|
|
110
|
+
setTrackedValue(val);
|
|
111
|
+
if (props.type === "multiple") {
|
|
112
|
+
props.onValueChange?.(val);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
[props.type, props.onValueChange]
|
|
116
|
+
);
|
|
117
|
+
const rootProps = props.type === "multiple" ? {
|
|
118
|
+
type: "multiple",
|
|
119
|
+
value: props.value,
|
|
120
|
+
defaultValue: props.defaultValue,
|
|
121
|
+
onValueChange: handleMultipleChange
|
|
122
|
+
} : {
|
|
123
|
+
type: "single",
|
|
124
|
+
value: props.value,
|
|
125
|
+
defaultValue: props.defaultValue,
|
|
126
|
+
onValueChange: handleSingleChange
|
|
127
|
+
};
|
|
128
|
+
const indicatorStyle = pos ? {
|
|
129
|
+
width: pos.width,
|
|
130
|
+
height: pos.height,
|
|
131
|
+
transform: `translate(${pos.x}px, ${pos.y}px)`,
|
|
132
|
+
opacity: 1
|
|
133
|
+
} : { opacity: 0 };
|
|
134
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
135
|
+
ToggleGroupPrimitive__namespace.Root,
|
|
136
|
+
{
|
|
137
|
+
ref: combinedRef,
|
|
138
|
+
className: chunkCZC76ZD5_js.cn(toggleGroupVariants({ variant, size }), className),
|
|
139
|
+
disabled,
|
|
140
|
+
...rootProps,
|
|
141
|
+
children: [
|
|
142
|
+
isDefault && /* @__PURE__ */ jsxRuntime.jsx(
|
|
143
|
+
"span",
|
|
144
|
+
{
|
|
145
|
+
className: chunkCZC76ZD5_js.cn(
|
|
146
|
+
"nexus-toggle-group__indicator",
|
|
147
|
+
animated && "nexus-toggle-group__indicator--animated"
|
|
148
|
+
),
|
|
149
|
+
style: indicatorStyle,
|
|
150
|
+
"aria-hidden": true
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
154
|
+
ToggleGroupPrimitive__namespace.Item,
|
|
155
|
+
{
|
|
156
|
+
value: item.value,
|
|
157
|
+
disabled: item.disabled,
|
|
158
|
+
className: "nexus-toggle-group__item",
|
|
159
|
+
children: [
|
|
160
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-toggle-group__icon", children: item.icon }),
|
|
161
|
+
item.label && /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
item.value
|
|
165
|
+
))
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
ToggleGroup.displayName = "ToggleGroup";
|
|
172
|
+
|
|
173
|
+
exports.ToggleGroup = ToggleGroup;
|
|
174
|
+
exports.toggleGroupVariants = toggleGroupVariants;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useDraggableBottomSheet } from './chunk-U56AGSLE.mjs';
|
|
2
|
-
import { useDraggableWindow } from './chunk-4J3GCZ7W.mjs';
|
|
3
1
|
import { scrollRelease, scrollFreeze } from './chunk-54IA2P2Z.mjs';
|
|
4
2
|
import { useCheckDevice_default } from './chunk-YEWKPWK3.mjs';
|
|
5
3
|
import { useClickOutside_default } from './chunk-OTGS6BDQ.mjs';
|
|
6
4
|
import { Modal_default } from './chunk-6H7V2I3X.mjs';
|
|
7
|
-
import {
|
|
5
|
+
import { useDraggableBottomSheet } from './chunk-U56AGSLE.mjs';
|
|
6
|
+
import { useDraggableWindow } from './chunk-4J3GCZ7W.mjs';
|
|
7
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
8
8
|
import React, { forwardRef, useState, useMemo, useCallback, useEffect, useImperativeHandle, useRef, Suspense } from 'react';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import { createPortal } from 'react-dom';
|
|
@@ -119,28 +119,17 @@ var ModalComponent = forwardRef(
|
|
|
119
119
|
close
|
|
120
120
|
}));
|
|
121
121
|
const getModalClassName = () => {
|
|
122
|
-
const baseClasses = ["
|
|
122
|
+
const baseClasses = ["nexus-modal-component"];
|
|
123
123
|
if (modal.props.portalId) {
|
|
124
|
-
baseClasses.push("
|
|
124
|
+
baseClasses.push("nexus-modal-component--portal");
|
|
125
125
|
}
|
|
126
126
|
if (["enter", "enter-done", "leave"].includes(status)) {
|
|
127
|
-
baseClasses.push("
|
|
127
|
+
baseClasses.push("nexus-modal-component--visible");
|
|
128
128
|
}
|
|
129
129
|
if (status === "enter") {
|
|
130
|
-
baseClasses.push(
|
|
131
|
-
"nx:[&_.modal-inner]:[animation-direction:var(--modal-animation-direction)]",
|
|
132
|
-
"nx:[&_.modal-inner]:[animation-duration:var(--modal-animation-duration)]",
|
|
133
|
-
"nx:[&_.modal-inner]:[animation-name:var(--modal-animation-name)]",
|
|
134
|
-
"nx:[&_.modal-inner]:[animation-timing-function:var(--modal-animation-timing-function)]"
|
|
135
|
-
);
|
|
130
|
+
baseClasses.push("nexus-modal-component--enter");
|
|
136
131
|
} else if (status === "leave") {
|
|
137
|
-
baseClasses.push(
|
|
138
|
-
"nx:[&_.modal-inner]:[animation-direction:reverse]",
|
|
139
|
-
"nx:[&_.modal-inner]:[animation-duration:var(--modal-animation-duration)]",
|
|
140
|
-
"nx:[&_.modal-inner]:[animation-fill-mode:var(--modal-animation-fill-mode)]",
|
|
141
|
-
"nx:[&_.modal-inner]:[animation-name:var(--modal-animation-name)]",
|
|
142
|
-
"nx:[&_.modal-inner]:[animation-timing-function:var(--modal-animation-timing-function)]"
|
|
143
|
-
);
|
|
132
|
+
baseClasses.push("nexus-modal-component--leave");
|
|
144
133
|
}
|
|
145
134
|
if (className) {
|
|
146
135
|
baseClasses.push(className);
|
|
@@ -242,248 +231,154 @@ var ModalContainer = ({ className = "", breakPoints, ...defaultOption }) => {
|
|
|
242
231
|
};
|
|
243
232
|
var ModalContainer_default = ModalContainer;
|
|
244
233
|
var ModalPortalTarget = ({ id, className }) => {
|
|
245
|
-
return /* @__PURE__ */ jsx("div", { id, className:
|
|
234
|
+
return /* @__PURE__ */ jsx("div", { id, className: cn("nexus-modal-portal-target", className) });
|
|
246
235
|
};
|
|
247
236
|
var ModalPortalTarget_default = ModalPortalTarget;
|
|
248
|
-
var modalWrapVariants = cva(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
"full-page-reverse": "nx:h-full nx:justify-start",
|
|
259
|
-
draggable: ""
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
defaultVariants: {
|
|
263
|
-
layout: "default"
|
|
237
|
+
var modalWrapVariants = cva("nexus-modal-wrap", {
|
|
238
|
+
variants: {
|
|
239
|
+
layout: {
|
|
240
|
+
default: "",
|
|
241
|
+
"bottom-sheet": "nexus-modal-wrap--bottom-sheet",
|
|
242
|
+
"slide-left": "nexus-modal-wrap--slide-left",
|
|
243
|
+
"slide-right": "nexus-modal-wrap--slide-right",
|
|
244
|
+
"full-page": "nexus-modal-wrap--full-page",
|
|
245
|
+
"full-page-reverse": "nexus-modal-wrap--full-page-reverse",
|
|
246
|
+
draggable: ""
|
|
264
247
|
}
|
|
248
|
+
},
|
|
249
|
+
defaultVariants: {
|
|
250
|
+
layout: "default"
|
|
265
251
|
}
|
|
266
|
-
);
|
|
267
|
-
var modalInnerVariants = cva(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
layout: {
|
|
278
|
-
default: "",
|
|
279
|
-
"bottom-sheet": "nx:mx-0 nx:my-0 nx:w-full nx:rounded-t-2xl nx:rounded-b-none nx:border-t nx:border-border-default nx:px-4 nx:pt-6",
|
|
280
|
-
"slide-left": "nx:h-full nx:rounded-none",
|
|
281
|
-
"slide-right": "nx:h-full nx:rounded-none",
|
|
282
|
-
"full-page": "nx:h-full nx:w-full nx:sm:w-full nx:rounded-none nx:border-transparent",
|
|
283
|
-
"full-page-reverse": "nx:h-full nx:w-full nx:sm:w-full nx:rounded-none nx:border-transparent",
|
|
284
|
-
draggable: "nx:min-w-[320px] nx:overflow-visible"
|
|
285
|
-
},
|
|
286
|
-
hasFooter: {
|
|
287
|
-
true: "",
|
|
288
|
-
false: ""
|
|
289
|
-
}
|
|
252
|
+
});
|
|
253
|
+
var modalInnerVariants = cva("nexus-modal-inner", {
|
|
254
|
+
variants: {
|
|
255
|
+
layout: {
|
|
256
|
+
default: "",
|
|
257
|
+
"bottom-sheet": "nexus-modal-inner--bottom-sheet",
|
|
258
|
+
"slide-left": "nexus-modal-inner--slide-left",
|
|
259
|
+
"slide-right": "nexus-modal-inner--slide-right",
|
|
260
|
+
"full-page": "nexus-modal-inner--full-page",
|
|
261
|
+
"full-page-reverse": "nexus-modal-inner--full-page-reverse",
|
|
262
|
+
draggable: "nexus-modal-inner--draggable"
|
|
290
263
|
},
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
],
|
|
295
|
-
defaultVariants: {
|
|
296
|
-
layout: "default",
|
|
297
|
-
hasFooter: false
|
|
264
|
+
hasFooter: {
|
|
265
|
+
true: "nexus-modal-inner--has-footer",
|
|
266
|
+
false: ""
|
|
298
267
|
}
|
|
268
|
+
},
|
|
269
|
+
compoundVariants: [
|
|
270
|
+
{ layout: "bottom-sheet", hasFooter: true, class: "nexus-modal-inner--bottom-sheet nexus-modal-inner--has-footer" }
|
|
271
|
+
],
|
|
272
|
+
defaultVariants: {
|
|
273
|
+
layout: "default",
|
|
274
|
+
hasFooter: false
|
|
299
275
|
}
|
|
300
|
-
);
|
|
301
|
-
var modalHeaderVariants = cva("modal-header
|
|
276
|
+
});
|
|
277
|
+
var modalHeaderVariants = cva("nexus-modal-header", {
|
|
302
278
|
variants: {
|
|
303
279
|
layout: {
|
|
304
280
|
default: "",
|
|
305
|
-
"bottom-sheet": "
|
|
281
|
+
"bottom-sheet": "nexus-modal-header--bottom-sheet",
|
|
306
282
|
"slide-left": "",
|
|
307
283
|
"slide-right": "",
|
|
308
284
|
"full-page": "",
|
|
309
285
|
"full-page-reverse": "",
|
|
310
|
-
draggable: "
|
|
286
|
+
draggable: "nexus-modal-header--draggable"
|
|
311
287
|
}
|
|
312
288
|
},
|
|
313
289
|
defaultVariants: {
|
|
314
290
|
layout: "default"
|
|
315
291
|
}
|
|
316
292
|
});
|
|
317
|
-
var modalCloseButtonVariants = cva(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
"full-page-reverse": "",
|
|
328
|
-
draggable: ""
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
defaultVariants: {
|
|
332
|
-
layout: "default"
|
|
293
|
+
var modalCloseButtonVariants = cva("nexus-modal-close-btn", {
|
|
294
|
+
variants: {
|
|
295
|
+
layout: {
|
|
296
|
+
default: "",
|
|
297
|
+
"bottom-sheet": "nexus-modal-close-btn--bottom-sheet",
|
|
298
|
+
"slide-left": "",
|
|
299
|
+
"slide-right": "",
|
|
300
|
+
"full-page": "",
|
|
301
|
+
"full-page-reverse": "",
|
|
302
|
+
draggable: ""
|
|
333
303
|
}
|
|
304
|
+
},
|
|
305
|
+
defaultVariants: {
|
|
306
|
+
layout: "default"
|
|
334
307
|
}
|
|
335
|
-
);
|
|
336
|
-
var modalTitleVariants = cva(
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
"full-page-reverse": "",
|
|
347
|
-
draggable: ""
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
defaultVariants: {
|
|
351
|
-
layout: "default"
|
|
308
|
+
});
|
|
309
|
+
var modalTitleVariants = cva("nexus-modal-title", {
|
|
310
|
+
variants: {
|
|
311
|
+
layout: {
|
|
312
|
+
default: "",
|
|
313
|
+
"bottom-sheet": "nexus-modal-title--bottom-sheet",
|
|
314
|
+
"slide-left": "",
|
|
315
|
+
"slide-right": "",
|
|
316
|
+
"full-page": "",
|
|
317
|
+
"full-page-reverse": "",
|
|
318
|
+
draggable: ""
|
|
352
319
|
}
|
|
320
|
+
},
|
|
321
|
+
defaultVariants: {
|
|
322
|
+
layout: "default"
|
|
353
323
|
}
|
|
354
|
-
);
|
|
355
|
-
var modalBodyVariants = cva(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
"full-page-reverse": "nx:h-full nx:max-h-full nx:overflow-y-auto nx:pb-0",
|
|
366
|
-
draggable: ""
|
|
367
|
-
},
|
|
368
|
-
hasHeader: {
|
|
369
|
-
true: "",
|
|
370
|
-
false: ""
|
|
371
|
-
},
|
|
372
|
-
hasFooter: {
|
|
373
|
-
true: "",
|
|
374
|
-
false: "nx:pb-6"
|
|
375
|
-
}
|
|
324
|
+
});
|
|
325
|
+
var modalBodyVariants = cva("nexus-modal-body", {
|
|
326
|
+
variants: {
|
|
327
|
+
layout: {
|
|
328
|
+
default: "",
|
|
329
|
+
"bottom-sheet": "nexus-modal-body--bottom-sheet",
|
|
330
|
+
"slide-left": "nexus-modal-body--slide",
|
|
331
|
+
"slide-right": "nexus-modal-body--slide",
|
|
332
|
+
"full-page": "nexus-modal-body--full-page",
|
|
333
|
+
"full-page-reverse": "nexus-modal-body--full-page",
|
|
334
|
+
draggable: ""
|
|
376
335
|
},
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
layout: "default",
|
|
385
|
-
hasHeader: true,
|
|
386
|
-
hasFooter: true,
|
|
387
|
-
class: "nx:max-h-[calc(90vh-var(--ft-height,88px)-var(--hd-height,60px))]"
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
layout: "default",
|
|
391
|
-
hasFooter: true,
|
|
392
|
-
hasHeader: false,
|
|
393
|
-
class: "nx:max-h-[calc(90vh-var(--ft-height,88px))]"
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
layout: "bottom-sheet",
|
|
397
|
-
hasHeader: true,
|
|
398
|
-
class: "nx:max-h-[calc(100vh-var(--hd-height,60px)-124px)] nx:pb-0"
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
layout: "bottom-sheet",
|
|
402
|
-
hasHeader: true,
|
|
403
|
-
hasFooter: true,
|
|
404
|
-
class: "nx:max-h-[calc(100vh-var(--ft-height,88px)-var(--hd-height,60px)-100px)]"
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
layout: "full-page",
|
|
408
|
-
hasHeader: true,
|
|
409
|
-
class: "nx:max-h-[calc(100vh-var(--hd-height,60px))] nx:pb-0"
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
layout: "full-page",
|
|
413
|
-
hasHeader: true,
|
|
414
|
-
hasFooter: true,
|
|
415
|
-
class: "nx:max-h-[calc(100vh-var(--ft-height,88px)-var(--hd-height,60px))]"
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
layout: "full-page-reverse",
|
|
419
|
-
hasHeader: true,
|
|
420
|
-
class: "nx:max-h-[calc(100vh-var(--hd-height,60px))] nx:pb-0"
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
layout: "full-page-reverse",
|
|
424
|
-
hasHeader: true,
|
|
425
|
-
hasFooter: true,
|
|
426
|
-
class: "nx:max-h-[calc(100vh-var(--ft-height,88px)-var(--hd-height,60px))]"
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
layout: "slide-left",
|
|
430
|
-
hasHeader: true,
|
|
431
|
-
class: "nx:max-h-[calc(100%-var(--hd-height,60px))]"
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
layout: "slide-right",
|
|
435
|
-
hasHeader: true,
|
|
436
|
-
class: "nx:max-h-[calc(100%-var(--hd-height,60px))]"
|
|
437
|
-
}
|
|
438
|
-
],
|
|
439
|
-
defaultVariants: {
|
|
440
|
-
layout: "default",
|
|
441
|
-
hasHeader: false,
|
|
442
|
-
hasFooter: false
|
|
336
|
+
hasHeader: {
|
|
337
|
+
true: "",
|
|
338
|
+
false: ""
|
|
339
|
+
},
|
|
340
|
+
hasFooter: {
|
|
341
|
+
true: "",
|
|
342
|
+
false: "nexus-modal-body--no-footer"
|
|
443
343
|
}
|
|
344
|
+
},
|
|
345
|
+
defaultVariants: {
|
|
346
|
+
layout: "default",
|
|
347
|
+
hasHeader: false,
|
|
348
|
+
hasFooter: false
|
|
444
349
|
}
|
|
445
|
-
);
|
|
446
|
-
var modalFooterVariants = cva(
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
"bottom-sheet": "nx:px-4 nx:py-3 nx:pb-6",
|
|
457
|
-
"slide-left": "",
|
|
458
|
-
"slide-right": "",
|
|
459
|
-
"full-page": "",
|
|
460
|
-
"full-page-reverse": "",
|
|
461
|
-
draggable: "nx:relative"
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
|
-
defaultVariants: {
|
|
465
|
-
layout: "default"
|
|
350
|
+
});
|
|
351
|
+
var modalFooterVariants = cva("nexus-modal-footer", {
|
|
352
|
+
variants: {
|
|
353
|
+
layout: {
|
|
354
|
+
default: "",
|
|
355
|
+
"bottom-sheet": "nexus-modal-footer--bottom-sheet",
|
|
356
|
+
"slide-left": "",
|
|
357
|
+
"slide-right": "",
|
|
358
|
+
"full-page": "",
|
|
359
|
+
"full-page-reverse": "",
|
|
360
|
+
draggable: "nexus-modal-footer--draggable"
|
|
466
361
|
}
|
|
362
|
+
},
|
|
363
|
+
defaultVariants: {
|
|
364
|
+
layout: "default"
|
|
467
365
|
}
|
|
468
|
-
);
|
|
469
|
-
var modalDimVariants = cva(
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
true: "",
|
|
475
|
-
false: "nx:hidden"
|
|
476
|
-
}
|
|
477
|
-
},
|
|
478
|
-
defaultVariants: {
|
|
479
|
-
visible: true
|
|
366
|
+
});
|
|
367
|
+
var modalDimVariants = cva("nexus-modal-dim", {
|
|
368
|
+
variants: {
|
|
369
|
+
visible: {
|
|
370
|
+
true: "",
|
|
371
|
+
false: "nexus-modal-dim--hidden"
|
|
480
372
|
}
|
|
373
|
+
},
|
|
374
|
+
defaultVariants: {
|
|
375
|
+
visible: true
|
|
481
376
|
}
|
|
482
|
-
);
|
|
377
|
+
});
|
|
483
378
|
var CloseIcon = () => /* @__PURE__ */ jsx(
|
|
484
379
|
"svg",
|
|
485
380
|
{
|
|
486
|
-
className: "
|
|
381
|
+
className: "nexus-modal-close-icon",
|
|
487
382
|
fill: "none",
|
|
488
383
|
stroke: "currentColor",
|
|
489
384
|
viewBox: "0 0 24 24",
|
|
@@ -558,6 +453,37 @@ var ModalTemplate = forwardRef(
|
|
|
558
453
|
}
|
|
559
454
|
}, []);
|
|
560
455
|
useImperativeHandle(ref, () => elRef.current);
|
|
456
|
+
useEffect(() => {
|
|
457
|
+
const inner = innerRef.current;
|
|
458
|
+
if (!inner) return;
|
|
459
|
+
const focusableSelector = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
460
|
+
const handleKeyDown = (e) => {
|
|
461
|
+
if (e.key !== "Tab") return;
|
|
462
|
+
const focusable = inner.querySelectorAll(focusableSelector);
|
|
463
|
+
if (focusable.length === 0) return;
|
|
464
|
+
const first = focusable[0];
|
|
465
|
+
const last = focusable[focusable.length - 1];
|
|
466
|
+
if (e.shiftKey) {
|
|
467
|
+
if (document.activeElement === first) {
|
|
468
|
+
e.preventDefault();
|
|
469
|
+
last.focus();
|
|
470
|
+
}
|
|
471
|
+
} else {
|
|
472
|
+
if (document.activeElement === last) {
|
|
473
|
+
e.preventDefault();
|
|
474
|
+
first.focus();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
inner.addEventListener("keydown", handleKeyDown);
|
|
479
|
+
const prev = document.activeElement;
|
|
480
|
+
const firstFocusable = inner.querySelector(focusableSelector);
|
|
481
|
+
firstFocusable?.focus();
|
|
482
|
+
return () => {
|
|
483
|
+
inner.removeEventListener("keydown", handleKeyDown);
|
|
484
|
+
prev?.focus();
|
|
485
|
+
};
|
|
486
|
+
}, []);
|
|
561
487
|
const hasHeader = !hideHeader;
|
|
562
488
|
const hasFooter = !hideFooter;
|
|
563
489
|
const wrapStyle = {};
|
|
@@ -610,10 +536,7 @@ var ModalTemplate = forwardRef(
|
|
|
610
536
|
tabIndex: -1,
|
|
611
537
|
role: "button",
|
|
612
538
|
"aria-label": "modal-dim",
|
|
613
|
-
className: cn(
|
|
614
|
-
"dim nx:pointer-events-auto nx:fixed nx:inset-0 nx:z-[1] nx:block nx:h-screen nx:w-screen nx:bg-static-black/30",
|
|
615
|
-
dimClassName
|
|
616
|
-
),
|
|
539
|
+
className: cn("nexus-modal-dim nexus-modal-dim--draggable", dimClassName),
|
|
617
540
|
onClick: closeModal2
|
|
618
541
|
}
|
|
619
542
|
),
|
|
@@ -621,14 +544,17 @@ var ModalTemplate = forwardRef(
|
|
|
621
544
|
"div",
|
|
622
545
|
{
|
|
623
546
|
ref: innerRef,
|
|
547
|
+
role: "dialog",
|
|
548
|
+
"aria-modal": "true",
|
|
549
|
+
"aria-label": typeof title === "string" ? title : void 0,
|
|
624
550
|
className: cn(
|
|
625
551
|
modalInnerVariants({ layout, hasFooter }),
|
|
626
552
|
innerClassName
|
|
627
553
|
),
|
|
628
554
|
style: innerStyle,
|
|
629
555
|
children: [
|
|
630
|
-
isBottomSheet && /* @__PURE__ */ jsx("span", { className: "
|
|
631
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
556
|
+
isBottomSheet && /* @__PURE__ */ jsx("span", { className: "nexus-modal-bottom-sheet-handle", children: /* @__PURE__ */ jsx("span", { className: "nexus-modal-bottom-sheet-bar" }) }),
|
|
557
|
+
/* @__PURE__ */ jsxs("div", { className: "nexus-contents", children: [
|
|
632
558
|
hasHeader && /* @__PURE__ */ jsxs(
|
|
633
559
|
"header",
|
|
634
560
|
{
|
|
@@ -639,14 +565,16 @@ var ModalTemplate = forwardRef(
|
|
|
639
565
|
/* @__PURE__ */ jsx(
|
|
640
566
|
"button",
|
|
641
567
|
{
|
|
568
|
+
type: "button",
|
|
642
569
|
className: modalCloseButtonVariants({ layout }),
|
|
643
570
|
onClick: () => close(),
|
|
571
|
+
"aria-label": "Close",
|
|
644
572
|
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
645
573
|
}
|
|
646
574
|
),
|
|
647
575
|
/* @__PURE__ */ jsxs("div", { className: "modal-header-inner", children: [
|
|
648
576
|
title && /* @__PURE__ */ jsx("h1", { className: modalTitleVariants({ layout }), children: title }),
|
|
649
|
-
desc && /* @__PURE__ */ jsx("p", { className: "modal-desc
|
|
577
|
+
desc && /* @__PURE__ */ jsx("p", { className: "nexus-modal-desc", children: desc })
|
|
650
578
|
] })
|
|
651
579
|
]
|
|
652
580
|
}
|