@zentauri-ui/zentauri-components 0.0.84 → 0.0.92
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/README.md +47 -29
- package/dist/chunk-BZSIXBA7.js +70 -0
- package/dist/chunk-BZSIXBA7.js.map +1 -0
- package/dist/chunk-E5UX537J.js +11 -0
- package/dist/chunk-E5UX537J.js.map +1 -0
- package/dist/chunk-MEWYFWBX.mjs +14 -0
- package/dist/chunk-MEWYFWBX.mjs.map +1 -0
- package/dist/chunk-VJHD7QZH.mjs +73 -0
- package/dist/chunk-VJHD7QZH.mjs.map +1 -0
- package/dist/ui/accordion.d.mts +70 -0
- package/dist/ui/accordion.d.ts +70 -0
- package/dist/ui/accordion.js +280 -0
- package/dist/ui/accordion.js.map +1 -0
- package/dist/ui/accordion.mjs +282 -0
- package/dist/ui/accordion.mjs.map +1 -0
- package/dist/ui/alert.d.mts +66 -0
- package/dist/ui/alert.d.ts +66 -0
- package/dist/ui/alert.js +218 -0
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/alert.mjs +220 -0
- package/dist/ui/alert.mjs.map +1 -0
- package/dist/ui/badge.d.mts +37 -0
- package/dist/ui/badge.d.ts +37 -0
- package/dist/ui/badge.js +159 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/badge.mjs +161 -0
- package/dist/ui/badge.mjs.map +1 -0
- package/dist/ui/buttons.d.mts +27 -0
- package/dist/ui/buttons.d.ts +27 -0
- package/dist/ui/buttons.js +107 -0
- package/dist/ui/buttons.js.map +1 -0
- package/dist/ui/buttons.mjs +109 -0
- package/dist/ui/buttons.mjs.map +1 -0
- package/dist/ui/card.d.mts +77 -0
- package/dist/ui/card.d.ts +77 -0
- package/dist/ui/card.js +252 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/card.mjs +254 -0
- package/dist/ui/card.mjs.map +1 -0
- package/dist/ui/divider.d.mts +39 -0
- package/dist/ui/divider.d.ts +39 -0
- package/dist/ui/divider.js +194 -0
- package/dist/ui/divider.js.map +1 -0
- package/dist/ui/divider.mjs +196 -0
- package/dist/ui/divider.mjs.map +1 -0
- package/dist/ui/drawer.d.mts +81 -0
- package/dist/ui/drawer.d.ts +81 -0
- package/dist/ui/drawer.js +377 -0
- package/dist/ui/drawer.js.map +1 -0
- package/dist/ui/drawer.mjs +379 -0
- package/dist/ui/drawer.mjs.map +1 -0
- package/dist/ui/dropdown.d.mts +50 -0
- package/dist/ui/dropdown.d.ts +50 -0
- package/dist/ui/dropdown.js +272 -0
- package/dist/ui/dropdown.js.map +1 -0
- package/dist/ui/dropdown.mjs +274 -0
- package/dist/ui/dropdown.mjs.map +1 -0
- package/dist/ui/empty-state.d.mts +55 -0
- package/dist/ui/empty-state.d.ts +55 -0
- package/dist/ui/empty-state.js +148 -0
- package/dist/ui/empty-state.js.map +1 -0
- package/dist/ui/empty-state.mjs +150 -0
- package/dist/ui/empty-state.mjs.map +1 -0
- package/dist/ui/inputs.d.mts +35 -0
- package/dist/ui/inputs.d.ts +35 -0
- package/dist/ui/inputs.js +426 -0
- package/dist/ui/inputs.js.map +1 -0
- package/dist/ui/inputs.mjs +428 -0
- package/dist/ui/inputs.mjs.map +1 -0
- package/dist/ui/modal.d.mts +84 -0
- package/dist/ui/modal.d.ts +84 -0
- package/dist/ui/modal.js +378 -0
- package/dist/ui/modal.js.map +1 -0
- package/dist/ui/modal.mjs +380 -0
- package/dist/ui/modal.mjs.map +1 -0
- package/dist/ui/pagination.d.mts +114 -0
- package/dist/ui/pagination.d.ts +114 -0
- package/dist/ui/pagination.js +425 -0
- package/dist/ui/pagination.js.map +1 -0
- package/dist/ui/pagination.mjs +427 -0
- package/dist/ui/pagination.mjs.map +1 -0
- package/dist/ui/progress.d.mts +61 -0
- package/dist/ui/progress.d.ts +61 -0
- package/dist/ui/progress.js +231 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/progress.mjs +233 -0
- package/dist/ui/progress.mjs.map +1 -0
- package/dist/ui/select.d.mts +73 -0
- package/dist/ui/select.d.ts +73 -0
- package/dist/ui/select.js +321 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/select.mjs +323 -0
- package/dist/ui/select.mjs.map +1 -0
- package/dist/ui/skeleton.d.mts +90 -0
- package/dist/ui/skeleton.d.ts +90 -0
- package/dist/ui/skeleton.js +538 -0
- package/dist/ui/skeleton.js.map +1 -0
- package/dist/ui/skeleton.mjs +540 -0
- package/dist/ui/skeleton.mjs.map +1 -0
- package/dist/ui/spinner.d.mts +27 -0
- package/dist/ui/spinner.d.ts +27 -0
- package/dist/ui/spinner.js +187 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/spinner.mjs +189 -0
- package/dist/ui/spinner.mjs.map +1 -0
- package/dist/ui/table.d.mts +81 -0
- package/dist/ui/table.d.ts +81 -0
- package/dist/ui/table.js +287 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/table.mjs +289 -0
- package/dist/ui/table.mjs.map +1 -0
- package/dist/ui/tabs.d.mts +58 -0
- package/dist/ui/tabs.d.ts +58 -0
- package/dist/ui/tabs.js +268 -0
- package/dist/ui/tabs.js.map +1 -0
- package/dist/ui/tabs.mjs +270 -0
- package/dist/ui/tabs.mjs.map +1 -0
- package/dist/ui/toast.d.mts +86 -0
- package/dist/ui/toast.d.ts +86 -0
- package/dist/ui/toast.js +252 -0
- package/dist/ui/toast.js.map +1 -0
- package/dist/ui/toast.mjs +254 -0
- package/dist/ui/toast.mjs.map +1 -0
- package/dist/ui/toggle.d.mts +37 -0
- package/dist/ui/toggle.d.ts +37 -0
- package/dist/ui/toggle.js +152 -0
- package/dist/ui/toggle.js.map +1 -0
- package/dist/ui/toggle.mjs +154 -0
- package/dist/ui/toggle.mjs.map +1 -0
- package/dist/ui/tooltip.d.mts +46 -0
- package/dist/ui/tooltip.d.ts +46 -0
- package/dist/ui/tooltip.js +208 -0
- package/dist/ui/tooltip.js.map +1 -0
- package/dist/ui/tooltip.mjs +210 -0
- package/dist/ui/tooltip.mjs.map +1 -0
- package/dist/variants-Dd9pe-ov.d.mts +8 -0
- package/dist/variants-Dd9pe-ov.d.ts +8 -0
- package/package.json +15 -14
- package/dist/ui/index.cjs +0 -5764
- package/dist/ui/index.cjs.map +0 -1
- package/dist/ui/index.d.cts +0 -1164
- package/dist/ui/index.d.ts +0 -1164
- package/dist/ui/index.js +0 -5626
- package/dist/ui/index.js.map +0 -1
package/dist/ui/modal.js
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkE5UX537Jjs = require('../chunk-E5UX537J.js');
|
|
4
|
+
|
|
5
|
+
// src/ui/modal/modal.tsx
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _framermotion = require('framer-motion');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _react = require('react');
|
|
21
|
+
var _reactdom = require('react-dom');
|
|
22
|
+
|
|
23
|
+
// src/ui/modal/animations.ts
|
|
24
|
+
var modalOverlayAnimationPresets = {
|
|
25
|
+
none: {},
|
|
26
|
+
fade: {
|
|
27
|
+
initial: { opacity: 0 },
|
|
28
|
+
animate: { opacity: 1 },
|
|
29
|
+
exit: { opacity: 0 },
|
|
30
|
+
transition: { duration: 0.2 }
|
|
31
|
+
},
|
|
32
|
+
scale: {
|
|
33
|
+
initial: { opacity: 0, scale: 0.96 },
|
|
34
|
+
animate: { opacity: 1, scale: 1 },
|
|
35
|
+
exit: { opacity: 0, scale: 0.96 },
|
|
36
|
+
transition: { type: "spring", stiffness: 420, damping: 32 }
|
|
37
|
+
},
|
|
38
|
+
"slide-up": {
|
|
39
|
+
initial: { opacity: 0, y: 24 },
|
|
40
|
+
animate: { opacity: 1, y: 0 },
|
|
41
|
+
exit: { opacity: 0, y: 16 },
|
|
42
|
+
transition: { type: "spring", stiffness: 380, damping: 30 }
|
|
43
|
+
},
|
|
44
|
+
"slide-down": {
|
|
45
|
+
initial: { opacity: 0, y: -24 },
|
|
46
|
+
animate: { opacity: 1, y: 0 },
|
|
47
|
+
exit: { opacity: 0, y: -16 },
|
|
48
|
+
transition: { type: "spring", stiffness: 380, damping: 30 }
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/ui/modal/variants.ts
|
|
53
|
+
var _classvarianceauthority = require('class-variance-authority');
|
|
54
|
+
var modalOverlayVariants = _classvarianceauthority.cva.call(void 0,
|
|
55
|
+
"fixed inset-0 z-50 bg-slate-950/70 backdrop-blur-sm data-[state=open]:animate-in"
|
|
56
|
+
);
|
|
57
|
+
var modalTriggerVariants = _classvarianceauthority.cva.call(void 0,
|
|
58
|
+
"relative inline-flex shrink-0 cursor-pointer rounded-md border",
|
|
59
|
+
{
|
|
60
|
+
variants: {
|
|
61
|
+
appearance: {
|
|
62
|
+
default: "bg-slate-950",
|
|
63
|
+
glass: "border-white/15 bg-slate-950/70 backdrop-blur-xl",
|
|
64
|
+
sky: "border-sky-600 bg-sky-950/70 backdrop-blur-xl",
|
|
65
|
+
rose: "border-rose-600 bg-rose-950/70 backdrop-blur-xl",
|
|
66
|
+
purple: "border-purple-600 bg-purple-950/70 backdrop-blur-xl",
|
|
67
|
+
pink: "border-pink-600 bg-pink-950/70 backdrop-blur-xl",
|
|
68
|
+
orange: "border-orange-600 bg-orange-950/70 backdrop-blur-xl",
|
|
69
|
+
yellow: "border-yellow-600 bg-yellow-950/70 backdrop-blur-xl",
|
|
70
|
+
teal: "border-teal-600 bg-teal-950/70 backdrop-blur-xl",
|
|
71
|
+
indigo: "border-indigo-600 bg-indigo-950/70 backdrop-blur-xl",
|
|
72
|
+
emerald: "border-emerald-600 bg-emerald-950/70 backdrop-blur-xl",
|
|
73
|
+
gray: "border-gray-600 bg-gray-950/70 backdrop-blur-xl",
|
|
74
|
+
amber: "border-amber-600 bg-amber-950/70 backdrop-blur-xl",
|
|
75
|
+
violet: "border-violet-600 bg-violet-950/70 backdrop-blur-xl",
|
|
76
|
+
"gradient-blue": "border-gradient-to-r from-blue-600 to-purple-600 bg-gradient-to-r from-blue-950/70 to-purple-950/70 backdrop-blur-xl",
|
|
77
|
+
"gradient-green": "border-gradient-to-r from-green-600 to-lime-600 bg-gradient-to-r from-green-950/70 to-lime-950/70 backdrop-blur-xl",
|
|
78
|
+
"gradient-red": "border-gradient-to-r from-red-600 to-pink-600 bg-gradient-to-r from-red-950/70 to-pink-950/70 backdrop-blur-xl",
|
|
79
|
+
"gradient-yellow": "border-gradient-to-r from-yellow-600 to-orange-600 bg-gradient-to-r from-yellow-950/70 to-orange-950/70 backdrop-blur-xl",
|
|
80
|
+
"gradient-purple": "border-gradient-to-r from-purple-600 to-pink-600 bg-gradient-to-r from-purple-950/70 to-pink-950/70 backdrop-blur-xl",
|
|
81
|
+
"gradient-teal": "border-gradient-to-r from-teal-600 to-cyan-600 bg-gradient-to-r from-teal-950/70 to-cyan-950/70 backdrop-blur-xl",
|
|
82
|
+
"gradient-indigo": "border-gradient-to-r from-indigo-600 to-purple-600 bg-gradient-to-r from-indigo-950/70 to-purple-950/70 backdrop-blur-xl",
|
|
83
|
+
"gradient-pink": "border-gradient-to-r from-pink-600 to-rose-600 bg-gradient-to-r from-pink-950/70 to-rose-950/70 backdrop-blur-xl",
|
|
84
|
+
"gradient-orange": "border-gradient-to-r from-orange-600 to-red-600 bg-gradient-to-r from-orange-950/70 to-red-950/70 backdrop-blur-xl"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
defaultVariants: {
|
|
88
|
+
appearance: "default"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
var modalContentVariants = _classvarianceauthority.cva.call(void 0,
|
|
93
|
+
"fixed left-1/2 z-50 w-[calc(100%-2rem)] max-h-[min(90vh,720px)] translate-x-[-50%] overflow-y-auto border border-white/10 bg-slate-950 p-6 text-slate-50 shadow-[0_24px_80px_rgba(15,23,42,0.55)] focus:outline-none",
|
|
94
|
+
{
|
|
95
|
+
variants: {
|
|
96
|
+
size: {
|
|
97
|
+
sm: "max-w-md",
|
|
98
|
+
md: "max-w-lg",
|
|
99
|
+
lg: "max-w-2xl",
|
|
100
|
+
xl: "max-w-4xl",
|
|
101
|
+
full: "max-w-[calc(100%-2rem)]"
|
|
102
|
+
},
|
|
103
|
+
position: {
|
|
104
|
+
center: "top-1/2 translate-y-[-50%]",
|
|
105
|
+
top: "top-10 translate-y-0",
|
|
106
|
+
bottom: "bottom-10 translate-y-0"
|
|
107
|
+
},
|
|
108
|
+
appearance: {
|
|
109
|
+
default: "bg-slate-950",
|
|
110
|
+
glass: "border-white/15 bg-slate-950/70 backdrop-blur-xl",
|
|
111
|
+
sky: "border-sky-600 bg-sky-950/70 backdrop-blur-xl",
|
|
112
|
+
rose: "border-rose-600 bg-rose-950/70 backdrop-blur-xl",
|
|
113
|
+
purple: "border-purple-600 bg-purple-950/70 backdrop-blur-xl",
|
|
114
|
+
pink: "border-pink-600 bg-pink-950/70 backdrop-blur-xl",
|
|
115
|
+
orange: "border-orange-600 bg-orange-950/70 backdrop-blur-xl",
|
|
116
|
+
yellow: "border-yellow-600 bg-yellow-950/70 backdrop-blur-xl",
|
|
117
|
+
teal: "border-teal-600 bg-teal-950/70 backdrop-blur-xl",
|
|
118
|
+
indigo: "border-indigo-600 bg-indigo-950/70 backdrop-blur-xl",
|
|
119
|
+
emerald: "border-emerald-600 bg-emerald-950/70 backdrop-blur-xl",
|
|
120
|
+
gray: "border-gray-600 bg-gray-950/70 backdrop-blur-xl",
|
|
121
|
+
amber: "border-amber-600 bg-amber-950/70 backdrop-blur-xl",
|
|
122
|
+
violet: "border-violet-600 bg-violet-950/70 backdrop-blur-xl",
|
|
123
|
+
"gradient-blue": "border-gradient-to-r from-blue-600 to-purple-600 bg-gradient-to-r from-blue-950/70 to-purple-950/70 backdrop-blur-xl",
|
|
124
|
+
"gradient-green": "border-gradient-to-r from-green-600 to-lime-600 bg-gradient-to-r from-green-950/70 to-lime-950/70 backdrop-blur-xl",
|
|
125
|
+
"gradient-red": "border-gradient-to-r from-red-600 to-pink-600 bg-gradient-to-r from-red-950/70 to-pink-950/70 backdrop-blur-xl",
|
|
126
|
+
"gradient-yellow": "border-gradient-to-r from-yellow-600 to-orange-600 bg-gradient-to-r from-yellow-950/70 to-orange-950/70 backdrop-blur-xl",
|
|
127
|
+
"gradient-purple": "border-gradient-to-r from-purple-600 to-pink-600 bg-gradient-to-r from-purple-950/70 to-pink-950/70 backdrop-blur-xl",
|
|
128
|
+
"gradient-teal": "border-gradient-to-r from-teal-600 to-cyan-600 bg-gradient-to-r from-teal-950/70 to-cyan-950/70 backdrop-blur-xl",
|
|
129
|
+
"gradient-indigo": "border-gradient-to-r from-indigo-600 to-purple-600 bg-gradient-to-r from-indigo-950/70 to-purple-950/70 backdrop-blur-xl",
|
|
130
|
+
"gradient-pink": "border-gradient-to-r from-pink-600 to-rose-600 bg-gradient-to-r from-pink-950/70 to-rose-950/70 backdrop-blur-xl",
|
|
131
|
+
"gradient-orange": "border-gradient-to-r from-orange-600 to-red-600 bg-gradient-to-r from-orange-950/70 to-red-950/70 backdrop-blur-xl"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
defaultVariants: {
|
|
135
|
+
size: "md",
|
|
136
|
+
position: "center",
|
|
137
|
+
appearance: "default"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// src/ui/modal/modal.tsx
|
|
143
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
144
|
+
var ModalContext = _react.createContext.call(void 0, null);
|
|
145
|
+
function useModalContext(component) {
|
|
146
|
+
const ctx = _react.useContext.call(void 0, ModalContext);
|
|
147
|
+
if (!ctx) {
|
|
148
|
+
throw new Error(`${component} must be used within <Modal>`);
|
|
149
|
+
}
|
|
150
|
+
return ctx;
|
|
151
|
+
}
|
|
152
|
+
var FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex="-1"])';
|
|
153
|
+
function useBodyScrollLock(locked) {
|
|
154
|
+
_react.useEffect.call(void 0, () => {
|
|
155
|
+
if (!locked) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const previousOverflow = document.body.style.overflow;
|
|
159
|
+
document.body.style.overflow = "hidden";
|
|
160
|
+
return () => {
|
|
161
|
+
document.body.style.overflow = previousOverflow;
|
|
162
|
+
};
|
|
163
|
+
}, [locked]);
|
|
164
|
+
}
|
|
165
|
+
function Modal({ open, defaultOpen = false, onOpenChange, children }) {
|
|
166
|
+
const isControlled = open !== void 0;
|
|
167
|
+
const [uncontrolledOpen, setUncontrolledOpen] = _react.useState.call(void 0, defaultOpen);
|
|
168
|
+
const resolvedOpen = isControlled ? Boolean(open) : uncontrolledOpen;
|
|
169
|
+
const setOpen = _react.useCallback.call(void 0,
|
|
170
|
+
(next) => {
|
|
171
|
+
if (!isControlled) {
|
|
172
|
+
setUncontrolledOpen(next);
|
|
173
|
+
}
|
|
174
|
+
_optionalChain([onOpenChange, 'optionalCall', _ => _(next)]);
|
|
175
|
+
},
|
|
176
|
+
[isControlled, onOpenChange]
|
|
177
|
+
);
|
|
178
|
+
const baseId = _react.useId.call(void 0, );
|
|
179
|
+
const titleId = `${baseId}-title`;
|
|
180
|
+
const descriptionId = `${baseId}-description`;
|
|
181
|
+
const contentRef = _react.useRef.call(void 0, null);
|
|
182
|
+
const ctx = _react.useMemo.call(void 0,
|
|
183
|
+
() => ({
|
|
184
|
+
open: resolvedOpen,
|
|
185
|
+
setOpen,
|
|
186
|
+
titleId,
|
|
187
|
+
descriptionId,
|
|
188
|
+
contentRef
|
|
189
|
+
}),
|
|
190
|
+
[descriptionId, resolvedOpen, setOpen, titleId]
|
|
191
|
+
);
|
|
192
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ModalContext.Provider, { value: ctx, children });
|
|
193
|
+
}
|
|
194
|
+
Modal.displayName = "Modal";
|
|
195
|
+
function ModalTrigger({ className, children, appearance, onClick, ref, ...rest }) {
|
|
196
|
+
const { setOpen } = useModalContext("ModalTrigger");
|
|
197
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
198
|
+
"button",
|
|
199
|
+
{
|
|
200
|
+
ref,
|
|
201
|
+
type: "button",
|
|
202
|
+
"data-slot": "modal-trigger",
|
|
203
|
+
className: _chunkE5UX537Jjs.cn.call(void 0, modalTriggerVariants({ appearance }), className),
|
|
204
|
+
onClick: (event) => {
|
|
205
|
+
_optionalChain([onClick, 'optionalCall', _2 => _2(event)]);
|
|
206
|
+
if (!event.defaultPrevented) {
|
|
207
|
+
setOpen(true);
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
...rest,
|
|
211
|
+
children
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
ModalTrigger.displayName = "ModalTrigger";
|
|
216
|
+
function ModalContent({
|
|
217
|
+
className,
|
|
218
|
+
size,
|
|
219
|
+
position,
|
|
220
|
+
appearance,
|
|
221
|
+
animation = "scale",
|
|
222
|
+
children,
|
|
223
|
+
ref,
|
|
224
|
+
id,
|
|
225
|
+
style
|
|
226
|
+
}) {
|
|
227
|
+
const { open, setOpen, titleId, descriptionId, contentRef } = useModalContext("ModalContent");
|
|
228
|
+
const reduceMotion = _framermotion.useReducedMotion.call(void 0, );
|
|
229
|
+
const overlayMotion = modalOverlayAnimationPresets[reduceMotion ? "fade" : animation];
|
|
230
|
+
const panelMotion = modalOverlayAnimationPresets[reduceMotion ? "fade" : animation];
|
|
231
|
+
useBodyScrollLock(open);
|
|
232
|
+
_react.useEffect.call(void 0, () => {
|
|
233
|
+
if (!open) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const handleKeyDown = (event) => {
|
|
237
|
+
if (event.key === "Escape") {
|
|
238
|
+
setOpen(false);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
242
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
243
|
+
}, [open, setOpen]);
|
|
244
|
+
_react.useEffect.call(void 0, () => {
|
|
245
|
+
if (!open) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const node = contentRef.current;
|
|
249
|
+
if (!node) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const focusables = Array.from(
|
|
253
|
+
node.querySelectorAll(FOCUSABLE_SELECTOR)
|
|
254
|
+
).filter((element) => element.offsetParent !== null || element === node);
|
|
255
|
+
const target = _nullishCoalesce(focusables[0], () => ( node));
|
|
256
|
+
const previouslyFocused = document.activeElement;
|
|
257
|
+
target.focus();
|
|
258
|
+
const handleFocusIn = (event) => {
|
|
259
|
+
if (!node.contains(event.target)) {
|
|
260
|
+
event.stopPropagation();
|
|
261
|
+
target.focus();
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
document.addEventListener("focusin", handleFocusIn);
|
|
265
|
+
return () => {
|
|
266
|
+
document.removeEventListener("focusin", handleFocusIn);
|
|
267
|
+
_optionalChain([previouslyFocused, 'optionalAccess', _3 => _3.focus, 'optionalCall', _4 => _4()]);
|
|
268
|
+
};
|
|
269
|
+
}, [contentRef, open]);
|
|
270
|
+
const portalTarget = typeof document !== "undefined" ? document.body : null;
|
|
271
|
+
if (!portalTarget) {
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
return _reactdom.createPortal.call(void 0,
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _framermotion.AnimatePresence, { children: open ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fixed inset-0 z-50", "data-slot": "modal-portal", children: [
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
277
|
+
_framermotion.motion.button,
|
|
278
|
+
{
|
|
279
|
+
type: "button",
|
|
280
|
+
"aria-hidden": true,
|
|
281
|
+
tabIndex: -1,
|
|
282
|
+
"data-slot": "modal-overlay",
|
|
283
|
+
className: modalOverlayVariants(),
|
|
284
|
+
onClick: () => setOpen(false),
|
|
285
|
+
initial: animation === "none" ? false : overlayMotion.initial,
|
|
286
|
+
animate: animation === "none" ? void 0 : overlayMotion.animate,
|
|
287
|
+
exit: animation === "none" ? void 0 : overlayMotion.exit,
|
|
288
|
+
transition: overlayMotion.transition
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
292
|
+
_framermotion.motion.div,
|
|
293
|
+
{
|
|
294
|
+
ref: (node) => {
|
|
295
|
+
contentRef.current = node;
|
|
296
|
+
if (typeof ref === "function") {
|
|
297
|
+
ref(node);
|
|
298
|
+
} else if (ref) {
|
|
299
|
+
ref.current = node;
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
role: "dialog",
|
|
303
|
+
"aria-modal": "true",
|
|
304
|
+
"aria-labelledby": titleId,
|
|
305
|
+
"aria-describedby": descriptionId,
|
|
306
|
+
"data-slot": "modal-content",
|
|
307
|
+
tabIndex: -1,
|
|
308
|
+
className: _chunkE5UX537Jjs.cn.call(void 0, modalContentVariants({ size, position, appearance }), className),
|
|
309
|
+
initial: animation === "none" ? false : panelMotion.initial,
|
|
310
|
+
animate: animation === "none" ? void 0 : panelMotion.animate,
|
|
311
|
+
exit: animation === "none" ? void 0 : panelMotion.exit,
|
|
312
|
+
transition: panelMotion.transition,
|
|
313
|
+
id,
|
|
314
|
+
style,
|
|
315
|
+
children
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
] }) : null }),
|
|
319
|
+
portalTarget
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
ModalContent.displayName = "ModalContent";
|
|
323
|
+
function ModalHeader({ className, children }) {
|
|
324
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "header", { "data-slot": "modal-header", className: _chunkE5UX537Jjs.cn.call(void 0, "mb-4 flex flex-col gap-2", className), children });
|
|
325
|
+
}
|
|
326
|
+
ModalHeader.displayName = "ModalHeader";
|
|
327
|
+
function ModalBody({ className, children }) {
|
|
328
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-slot": "modal-body", className: _chunkE5UX537Jjs.cn.call(void 0, "text-sm text-slate-300", className), children });
|
|
329
|
+
}
|
|
330
|
+
ModalBody.displayName = "ModalBody";
|
|
331
|
+
function ModalFooter({ className, children }) {
|
|
332
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "footer", { "data-slot": "modal-footer", className: _chunkE5UX537Jjs.cn.call(void 0, "mt-6 flex justify-end gap-2", className), children });
|
|
333
|
+
}
|
|
334
|
+
ModalFooter.displayName = "ModalFooter";
|
|
335
|
+
function ModalTitle({ className, children }) {
|
|
336
|
+
const { titleId } = useModalContext("ModalTitle");
|
|
337
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { id: titleId, "data-slot": "modal-title", className: _chunkE5UX537Jjs.cn.call(void 0, "text-lg font-semibold", className), children });
|
|
338
|
+
}
|
|
339
|
+
ModalTitle.displayName = "ModalTitle";
|
|
340
|
+
function ModalDescription({ className, children }) {
|
|
341
|
+
const { descriptionId } = useModalContext("ModalDescription");
|
|
342
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { id: descriptionId, "data-slot": "modal-description", className: _chunkE5UX537Jjs.cn.call(void 0, "text-sm text-slate-400", className), children });
|
|
343
|
+
}
|
|
344
|
+
ModalDescription.displayName = "ModalDescription";
|
|
345
|
+
function ModalClose({ className, children, ...rest }) {
|
|
346
|
+
const { setOpen } = useModalContext("ModalClose");
|
|
347
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
348
|
+
"button",
|
|
349
|
+
{
|
|
350
|
+
type: "button",
|
|
351
|
+
"data-slot": "modal-close",
|
|
352
|
+
className: _chunkE5UX537Jjs.cn.call(void 0,
|
|
353
|
+
"absolute right-4 top-4 inline-flex size-9 items-center justify-center rounded-md text-slate-200 transition hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/30",
|
|
354
|
+
className
|
|
355
|
+
),
|
|
356
|
+
"aria-label": "Close dialog",
|
|
357
|
+
onClick: () => setOpen(false),
|
|
358
|
+
...rest,
|
|
359
|
+
children: _nullishCoalesce(children, () => ( "\xD7"))
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
ModalClose.displayName = "ModalClose";
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
exports.Modal = Modal; exports.ModalBody = ModalBody; exports.ModalClose = ModalClose; exports.ModalContent = ModalContent; exports.ModalDescription = ModalDescription; exports.ModalFooter = ModalFooter; exports.ModalHeader = ModalHeader; exports.ModalTitle = ModalTitle; exports.ModalTrigger = ModalTrigger; exports.modalContentVariants = modalContentVariants; exports.modalOverlayAnimationPresets = modalOverlayAnimationPresets; exports.modalOverlayVariants = modalOverlayVariants;
|
|
378
|
+
//# sourceMappingURL=modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/sh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MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,wBAAA;AACA,QAAA;AACA,UAAA;AACA,QAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,IAAA;AACA,EAAA;AACA;AACA;AACA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,IAAA;AACA,MAAA;AACA,IAAA;AACA,IAAA;AACA,MAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,EAAA;AACA,EAAA;AACA,IAAA;AACA,MAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,MAAA;AACA,IAAA;AACA,IAAA;AACA,MAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,MAAA;AACA,QAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,MAAA;AACA,sBAAA;AACA,IAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,IAAA;AACA,EAAA;AACA,EAAA;AACA,oBAAA;AACA,sBAAA;AACA,QAAA;AACA,QAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,QAAA;AACA,MAAA;AACA,sBAAA;AACA,QAAA;AACA,QAAA;AACA,UAAA;AACA,YAAA;AACA,YAAA;AACA,cAAA;AACA,YAAA;AACA,cAAA;AACA,YAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,UAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA;AACA,IAAA;AACA,EAAA;AACA;AACA;AACA;AACA,EAAA;AACA;AACA;AACA;AACA,EAAA;AACA;AACA;AACA;AACA,EAAA;AACA;AACA;AACA;AACA,EAAA;AACA,EAAA;AACA;AACA;AACA;AACA,EAAA;AACA,EAAA;AACA;AACA;AACA;AACA,EAAA;AACA,EAAA;AACA,IAAA;AACA,IAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,QAAA;AACA,QAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,IAAA;AACA,EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/shubham/Desktop/Repos/NEXT JS/zentauri-ui/packages/components/dist/ui/modal.js","sourcesContent":[null]}
|