@almadar/ui 5.122.4 → 5.122.5
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/dist/avl/index.cjs +79 -87
- package/dist/avl/index.js +79 -87
- package/dist/components/index.cjs +8 -16
- package/dist/components/index.js +8 -16
- package/dist/providers/index.cjs +79 -87
- package/dist/providers/index.js +79 -87
- package/dist/runtime/index.cjs +79 -87
- package/dist/runtime/index.js +79 -87
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -5106,6 +5106,77 @@ var init_Dialog = __esm({
|
|
|
5106
5106
|
Dialog.displayName = "Dialog";
|
|
5107
5107
|
}
|
|
5108
5108
|
});
|
|
5109
|
+
function isMotionEnabled() {
|
|
5110
|
+
if (typeof document === "undefined") return true;
|
|
5111
|
+
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
5112
|
+
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
5113
|
+
motionEnabledCache = v !== "off";
|
|
5114
|
+
return motionEnabledCache;
|
|
5115
|
+
}
|
|
5116
|
+
function usePresence(show, opts) {
|
|
5117
|
+
const { animation, animate = true, onExited } = opts;
|
|
5118
|
+
const [mounted, setMounted] = React91.useState(show);
|
|
5119
|
+
const [exiting, setExiting] = React91.useState(false);
|
|
5120
|
+
const prev = React91.useRef(show);
|
|
5121
|
+
const onExitedRef = React91.useRef(onExited);
|
|
5122
|
+
onExitedRef.current = onExited;
|
|
5123
|
+
const safeTimer = React91.useRef(null);
|
|
5124
|
+
const clearSafe = React91.useCallback(() => {
|
|
5125
|
+
if (safeTimer.current) {
|
|
5126
|
+
clearTimeout(safeTimer.current);
|
|
5127
|
+
safeTimer.current = null;
|
|
5128
|
+
}
|
|
5129
|
+
}, []);
|
|
5130
|
+
const finishExit = React91.useCallback(() => {
|
|
5131
|
+
clearSafe();
|
|
5132
|
+
setExiting(false);
|
|
5133
|
+
setMounted(false);
|
|
5134
|
+
onExitedRef.current?.();
|
|
5135
|
+
}, [clearSafe]);
|
|
5136
|
+
React91.useLayoutEffect(() => {
|
|
5137
|
+
const moving = animate && isMotionEnabled();
|
|
5138
|
+
if (show && !prev.current) {
|
|
5139
|
+
setExiting(false);
|
|
5140
|
+
setMounted(true);
|
|
5141
|
+
} else if (!show && prev.current) {
|
|
5142
|
+
if (moving) {
|
|
5143
|
+
setExiting(true);
|
|
5144
|
+
clearSafe();
|
|
5145
|
+
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
5146
|
+
} else {
|
|
5147
|
+
setMounted(false);
|
|
5148
|
+
setExiting(false);
|
|
5149
|
+
}
|
|
5150
|
+
}
|
|
5151
|
+
prev.current = show;
|
|
5152
|
+
}, [show, animate, clearSafe, finishExit]);
|
|
5153
|
+
React91.useEffect(() => () => clearSafe(), [clearSafe]);
|
|
5154
|
+
const disabled = !animate || !isMotionEnabled();
|
|
5155
|
+
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
5156
|
+
const onAnimationEnd = React91.useCallback(
|
|
5157
|
+
(e) => {
|
|
5158
|
+
if (e.target !== e.currentTarget) return;
|
|
5159
|
+
if (exiting) finishExit();
|
|
5160
|
+
},
|
|
5161
|
+
[exiting, finishExit]
|
|
5162
|
+
);
|
|
5163
|
+
return { mounted, exiting, className, onAnimationEnd };
|
|
5164
|
+
}
|
|
5165
|
+
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
5166
|
+
var init_Presence = __esm({
|
|
5167
|
+
"components/core/atoms/Presence.tsx"() {
|
|
5168
|
+
"use client";
|
|
5169
|
+
init_cn();
|
|
5170
|
+
SAFE_EXIT_MS = 1e3;
|
|
5171
|
+
motionEnabledCache = null;
|
|
5172
|
+
Presence = ({ show, className, children, ...opts }) => {
|
|
5173
|
+
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
5174
|
+
if (!mounted) return null;
|
|
5175
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
5176
|
+
};
|
|
5177
|
+
Presence.displayName = "Presence";
|
|
5178
|
+
}
|
|
5179
|
+
});
|
|
5109
5180
|
var sizeClasses2, minWidthClasses, lookStyles, Modal;
|
|
5110
5181
|
var init_Modal = __esm({
|
|
5111
5182
|
"components/core/molecules/Modal.tsx"() {
|
|
@@ -5116,6 +5187,7 @@ var init_Modal = __esm({
|
|
|
5116
5187
|
init_Typography();
|
|
5117
5188
|
init_cn();
|
|
5118
5189
|
init_useEventBus();
|
|
5190
|
+
init_Presence();
|
|
5119
5191
|
sizeClasses2 = {
|
|
5120
5192
|
sm: "max-w-md",
|
|
5121
5193
|
md: "max-w-2xl",
|
|
@@ -5160,18 +5232,10 @@ var init_Modal = __esm({
|
|
|
5160
5232
|
const [dragY, setDragY] = React91.useState(0);
|
|
5161
5233
|
const dragStartY = React91.useRef(0);
|
|
5162
5234
|
const isDragging = React91.useRef(false);
|
|
5163
|
-
const
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
wasOpenRef.current = isOpen;
|
|
5168
|
-
}, [isOpen]);
|
|
5169
|
-
const handleAnimEnd = (e) => {
|
|
5170
|
-
if (closing && e.target === e.currentTarget) {
|
|
5171
|
-
setClosing(false);
|
|
5172
|
-
onExited?.();
|
|
5173
|
-
}
|
|
5174
|
-
};
|
|
5235
|
+
const { mounted, exiting, onAnimationEnd: handleAnimEnd } = usePresence(isOpen, {
|
|
5236
|
+
animation: "modal",
|
|
5237
|
+
onExited
|
|
5238
|
+
});
|
|
5175
5239
|
React91.useEffect(() => {
|
|
5176
5240
|
if (isOpen) {
|
|
5177
5241
|
previousActiveElement.current = document.activeElement;
|
|
@@ -5206,10 +5270,9 @@ var init_Modal = __esm({
|
|
|
5206
5270
|
};
|
|
5207
5271
|
}, [isOpen]);
|
|
5208
5272
|
if (typeof document === "undefined") return null;
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
const
|
|
5212
|
-
const overlayAnim = closing ? "animate-overlay-out" : "animate-overlay-in";
|
|
5273
|
+
if (!mounted) return null;
|
|
5274
|
+
const dialogAnim = exiting ? "animate-modal-out" : "animate-modal-in";
|
|
5275
|
+
const overlayAnim = exiting ? "animate-overlay-out" : "animate-overlay-in";
|
|
5213
5276
|
const handleClose = () => {
|
|
5214
5277
|
if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
|
|
5215
5278
|
onClose();
|
|
@@ -5340,77 +5403,6 @@ var init_Modal = __esm({
|
|
|
5340
5403
|
Modal.displayName = "Modal";
|
|
5341
5404
|
}
|
|
5342
5405
|
});
|
|
5343
|
-
function isMotionEnabled() {
|
|
5344
|
-
if (typeof document === "undefined") return true;
|
|
5345
|
-
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
5346
|
-
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
5347
|
-
motionEnabledCache = v !== "off";
|
|
5348
|
-
return motionEnabledCache;
|
|
5349
|
-
}
|
|
5350
|
-
function usePresence(show, opts) {
|
|
5351
|
-
const { animation, animate = true, onExited } = opts;
|
|
5352
|
-
const [mounted, setMounted] = React91.useState(show);
|
|
5353
|
-
const [exiting, setExiting] = React91.useState(false);
|
|
5354
|
-
const prev = React91.useRef(show);
|
|
5355
|
-
const onExitedRef = React91.useRef(onExited);
|
|
5356
|
-
onExitedRef.current = onExited;
|
|
5357
|
-
const safeTimer = React91.useRef(null);
|
|
5358
|
-
const clearSafe = React91.useCallback(() => {
|
|
5359
|
-
if (safeTimer.current) {
|
|
5360
|
-
clearTimeout(safeTimer.current);
|
|
5361
|
-
safeTimer.current = null;
|
|
5362
|
-
}
|
|
5363
|
-
}, []);
|
|
5364
|
-
const finishExit = React91.useCallback(() => {
|
|
5365
|
-
clearSafe();
|
|
5366
|
-
setExiting(false);
|
|
5367
|
-
setMounted(false);
|
|
5368
|
-
onExitedRef.current?.();
|
|
5369
|
-
}, [clearSafe]);
|
|
5370
|
-
React91.useLayoutEffect(() => {
|
|
5371
|
-
const moving = animate && isMotionEnabled();
|
|
5372
|
-
if (show && !prev.current) {
|
|
5373
|
-
setExiting(false);
|
|
5374
|
-
setMounted(true);
|
|
5375
|
-
} else if (!show && prev.current) {
|
|
5376
|
-
if (moving) {
|
|
5377
|
-
setExiting(true);
|
|
5378
|
-
clearSafe();
|
|
5379
|
-
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
5380
|
-
} else {
|
|
5381
|
-
setMounted(false);
|
|
5382
|
-
setExiting(false);
|
|
5383
|
-
}
|
|
5384
|
-
}
|
|
5385
|
-
prev.current = show;
|
|
5386
|
-
}, [show, animate, clearSafe, finishExit]);
|
|
5387
|
-
React91.useEffect(() => () => clearSafe(), [clearSafe]);
|
|
5388
|
-
const disabled = !animate || !isMotionEnabled();
|
|
5389
|
-
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
5390
|
-
const onAnimationEnd = React91.useCallback(
|
|
5391
|
-
(e) => {
|
|
5392
|
-
if (e.target !== e.currentTarget) return;
|
|
5393
|
-
if (exiting) finishExit();
|
|
5394
|
-
},
|
|
5395
|
-
[exiting, finishExit]
|
|
5396
|
-
);
|
|
5397
|
-
return { mounted, exiting, className, onAnimationEnd };
|
|
5398
|
-
}
|
|
5399
|
-
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
5400
|
-
var init_Presence = __esm({
|
|
5401
|
-
"components/core/atoms/Presence.tsx"() {
|
|
5402
|
-
"use client";
|
|
5403
|
-
init_cn();
|
|
5404
|
-
SAFE_EXIT_MS = 1e3;
|
|
5405
|
-
motionEnabledCache = null;
|
|
5406
|
-
Presence = ({ show, className, children, ...opts }) => {
|
|
5407
|
-
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
5408
|
-
if (!mounted) return null;
|
|
5409
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
5410
|
-
};
|
|
5411
|
-
Presence.displayName = "Presence";
|
|
5412
|
-
}
|
|
5413
|
-
});
|
|
5414
5406
|
var Overlay;
|
|
5415
5407
|
var init_Overlay = __esm({
|
|
5416
5408
|
"components/core/atoms/Overlay.tsx"() {
|
package/dist/avl/index.js
CHANGED
|
@@ -5060,6 +5060,77 @@ var init_Dialog = __esm({
|
|
|
5060
5060
|
Dialog.displayName = "Dialog";
|
|
5061
5061
|
}
|
|
5062
5062
|
});
|
|
5063
|
+
function isMotionEnabled() {
|
|
5064
|
+
if (typeof document === "undefined") return true;
|
|
5065
|
+
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
5066
|
+
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
5067
|
+
motionEnabledCache = v !== "off";
|
|
5068
|
+
return motionEnabledCache;
|
|
5069
|
+
}
|
|
5070
|
+
function usePresence(show, opts) {
|
|
5071
|
+
const { animation, animate = true, onExited } = opts;
|
|
5072
|
+
const [mounted, setMounted] = useState(show);
|
|
5073
|
+
const [exiting, setExiting] = useState(false);
|
|
5074
|
+
const prev = useRef(show);
|
|
5075
|
+
const onExitedRef = useRef(onExited);
|
|
5076
|
+
onExitedRef.current = onExited;
|
|
5077
|
+
const safeTimer = useRef(null);
|
|
5078
|
+
const clearSafe = useCallback(() => {
|
|
5079
|
+
if (safeTimer.current) {
|
|
5080
|
+
clearTimeout(safeTimer.current);
|
|
5081
|
+
safeTimer.current = null;
|
|
5082
|
+
}
|
|
5083
|
+
}, []);
|
|
5084
|
+
const finishExit = useCallback(() => {
|
|
5085
|
+
clearSafe();
|
|
5086
|
+
setExiting(false);
|
|
5087
|
+
setMounted(false);
|
|
5088
|
+
onExitedRef.current?.();
|
|
5089
|
+
}, [clearSafe]);
|
|
5090
|
+
useLayoutEffect(() => {
|
|
5091
|
+
const moving = animate && isMotionEnabled();
|
|
5092
|
+
if (show && !prev.current) {
|
|
5093
|
+
setExiting(false);
|
|
5094
|
+
setMounted(true);
|
|
5095
|
+
} else if (!show && prev.current) {
|
|
5096
|
+
if (moving) {
|
|
5097
|
+
setExiting(true);
|
|
5098
|
+
clearSafe();
|
|
5099
|
+
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
5100
|
+
} else {
|
|
5101
|
+
setMounted(false);
|
|
5102
|
+
setExiting(false);
|
|
5103
|
+
}
|
|
5104
|
+
}
|
|
5105
|
+
prev.current = show;
|
|
5106
|
+
}, [show, animate, clearSafe, finishExit]);
|
|
5107
|
+
useEffect(() => () => clearSafe(), [clearSafe]);
|
|
5108
|
+
const disabled = !animate || !isMotionEnabled();
|
|
5109
|
+
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
5110
|
+
const onAnimationEnd = useCallback(
|
|
5111
|
+
(e) => {
|
|
5112
|
+
if (e.target !== e.currentTarget) return;
|
|
5113
|
+
if (exiting) finishExit();
|
|
5114
|
+
},
|
|
5115
|
+
[exiting, finishExit]
|
|
5116
|
+
);
|
|
5117
|
+
return { mounted, exiting, className, onAnimationEnd };
|
|
5118
|
+
}
|
|
5119
|
+
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
5120
|
+
var init_Presence = __esm({
|
|
5121
|
+
"components/core/atoms/Presence.tsx"() {
|
|
5122
|
+
"use client";
|
|
5123
|
+
init_cn();
|
|
5124
|
+
SAFE_EXIT_MS = 1e3;
|
|
5125
|
+
motionEnabledCache = null;
|
|
5126
|
+
Presence = ({ show, className, children, ...opts }) => {
|
|
5127
|
+
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
5128
|
+
if (!mounted) return null;
|
|
5129
|
+
return /* @__PURE__ */ jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
5130
|
+
};
|
|
5131
|
+
Presence.displayName = "Presence";
|
|
5132
|
+
}
|
|
5133
|
+
});
|
|
5063
5134
|
var sizeClasses2, minWidthClasses, lookStyles, Modal;
|
|
5064
5135
|
var init_Modal = __esm({
|
|
5065
5136
|
"components/core/molecules/Modal.tsx"() {
|
|
@@ -5070,6 +5141,7 @@ var init_Modal = __esm({
|
|
|
5070
5141
|
init_Typography();
|
|
5071
5142
|
init_cn();
|
|
5072
5143
|
init_useEventBus();
|
|
5144
|
+
init_Presence();
|
|
5073
5145
|
sizeClasses2 = {
|
|
5074
5146
|
sm: "max-w-md",
|
|
5075
5147
|
md: "max-w-2xl",
|
|
@@ -5114,18 +5186,10 @@ var init_Modal = __esm({
|
|
|
5114
5186
|
const [dragY, setDragY] = useState(0);
|
|
5115
5187
|
const dragStartY = useRef(0);
|
|
5116
5188
|
const isDragging = useRef(false);
|
|
5117
|
-
const
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
wasOpenRef.current = isOpen;
|
|
5122
|
-
}, [isOpen]);
|
|
5123
|
-
const handleAnimEnd = (e) => {
|
|
5124
|
-
if (closing && e.target === e.currentTarget) {
|
|
5125
|
-
setClosing(false);
|
|
5126
|
-
onExited?.();
|
|
5127
|
-
}
|
|
5128
|
-
};
|
|
5189
|
+
const { mounted, exiting, onAnimationEnd: handleAnimEnd } = usePresence(isOpen, {
|
|
5190
|
+
animation: "modal",
|
|
5191
|
+
onExited
|
|
5192
|
+
});
|
|
5129
5193
|
useEffect(() => {
|
|
5130
5194
|
if (isOpen) {
|
|
5131
5195
|
previousActiveElement.current = document.activeElement;
|
|
@@ -5160,10 +5224,9 @@ var init_Modal = __esm({
|
|
|
5160
5224
|
};
|
|
5161
5225
|
}, [isOpen]);
|
|
5162
5226
|
if (typeof document === "undefined") return null;
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
const
|
|
5166
|
-
const overlayAnim = closing ? "animate-overlay-out" : "animate-overlay-in";
|
|
5227
|
+
if (!mounted) return null;
|
|
5228
|
+
const dialogAnim = exiting ? "animate-modal-out" : "animate-modal-in";
|
|
5229
|
+
const overlayAnim = exiting ? "animate-overlay-out" : "animate-overlay-in";
|
|
5167
5230
|
const handleClose = () => {
|
|
5168
5231
|
if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
|
|
5169
5232
|
onClose();
|
|
@@ -5294,77 +5357,6 @@ var init_Modal = __esm({
|
|
|
5294
5357
|
Modal.displayName = "Modal";
|
|
5295
5358
|
}
|
|
5296
5359
|
});
|
|
5297
|
-
function isMotionEnabled() {
|
|
5298
|
-
if (typeof document === "undefined") return true;
|
|
5299
|
-
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
5300
|
-
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
5301
|
-
motionEnabledCache = v !== "off";
|
|
5302
|
-
return motionEnabledCache;
|
|
5303
|
-
}
|
|
5304
|
-
function usePresence(show, opts) {
|
|
5305
|
-
const { animation, animate = true, onExited } = opts;
|
|
5306
|
-
const [mounted, setMounted] = useState(show);
|
|
5307
|
-
const [exiting, setExiting] = useState(false);
|
|
5308
|
-
const prev = useRef(show);
|
|
5309
|
-
const onExitedRef = useRef(onExited);
|
|
5310
|
-
onExitedRef.current = onExited;
|
|
5311
|
-
const safeTimer = useRef(null);
|
|
5312
|
-
const clearSafe = useCallback(() => {
|
|
5313
|
-
if (safeTimer.current) {
|
|
5314
|
-
clearTimeout(safeTimer.current);
|
|
5315
|
-
safeTimer.current = null;
|
|
5316
|
-
}
|
|
5317
|
-
}, []);
|
|
5318
|
-
const finishExit = useCallback(() => {
|
|
5319
|
-
clearSafe();
|
|
5320
|
-
setExiting(false);
|
|
5321
|
-
setMounted(false);
|
|
5322
|
-
onExitedRef.current?.();
|
|
5323
|
-
}, [clearSafe]);
|
|
5324
|
-
useLayoutEffect(() => {
|
|
5325
|
-
const moving = animate && isMotionEnabled();
|
|
5326
|
-
if (show && !prev.current) {
|
|
5327
|
-
setExiting(false);
|
|
5328
|
-
setMounted(true);
|
|
5329
|
-
} else if (!show && prev.current) {
|
|
5330
|
-
if (moving) {
|
|
5331
|
-
setExiting(true);
|
|
5332
|
-
clearSafe();
|
|
5333
|
-
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
5334
|
-
} else {
|
|
5335
|
-
setMounted(false);
|
|
5336
|
-
setExiting(false);
|
|
5337
|
-
}
|
|
5338
|
-
}
|
|
5339
|
-
prev.current = show;
|
|
5340
|
-
}, [show, animate, clearSafe, finishExit]);
|
|
5341
|
-
useEffect(() => () => clearSafe(), [clearSafe]);
|
|
5342
|
-
const disabled = !animate || !isMotionEnabled();
|
|
5343
|
-
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
5344
|
-
const onAnimationEnd = useCallback(
|
|
5345
|
-
(e) => {
|
|
5346
|
-
if (e.target !== e.currentTarget) return;
|
|
5347
|
-
if (exiting) finishExit();
|
|
5348
|
-
},
|
|
5349
|
-
[exiting, finishExit]
|
|
5350
|
-
);
|
|
5351
|
-
return { mounted, exiting, className, onAnimationEnd };
|
|
5352
|
-
}
|
|
5353
|
-
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
5354
|
-
var init_Presence = __esm({
|
|
5355
|
-
"components/core/atoms/Presence.tsx"() {
|
|
5356
|
-
"use client";
|
|
5357
|
-
init_cn();
|
|
5358
|
-
SAFE_EXIT_MS = 1e3;
|
|
5359
|
-
motionEnabledCache = null;
|
|
5360
|
-
Presence = ({ show, className, children, ...opts }) => {
|
|
5361
|
-
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
5362
|
-
if (!mounted) return null;
|
|
5363
|
-
return /* @__PURE__ */ jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
5364
|
-
};
|
|
5365
|
-
Presence.displayName = "Presence";
|
|
5366
|
-
}
|
|
5367
|
-
});
|
|
5368
5360
|
var Overlay;
|
|
5369
5361
|
var init_Overlay = __esm({
|
|
5370
5362
|
"components/core/atoms/Overlay.tsx"() {
|
|
@@ -6122,6 +6122,7 @@ var init_Modal = __esm({
|
|
|
6122
6122
|
init_Typography();
|
|
6123
6123
|
init_cn();
|
|
6124
6124
|
init_useEventBus();
|
|
6125
|
+
init_Presence();
|
|
6125
6126
|
sizeClasses6 = {
|
|
6126
6127
|
sm: "max-w-md",
|
|
6127
6128
|
md: "max-w-2xl",
|
|
@@ -6166,18 +6167,10 @@ var init_Modal = __esm({
|
|
|
6166
6167
|
const [dragY, setDragY] = React74.useState(0);
|
|
6167
6168
|
const dragStartY = React74.useRef(0);
|
|
6168
6169
|
const isDragging = React74.useRef(false);
|
|
6169
|
-
const
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
wasOpenRef.current = isOpen;
|
|
6174
|
-
}, [isOpen]);
|
|
6175
|
-
const handleAnimEnd = (e) => {
|
|
6176
|
-
if (closing && e.target === e.currentTarget) {
|
|
6177
|
-
setClosing(false);
|
|
6178
|
-
onExited?.();
|
|
6179
|
-
}
|
|
6180
|
-
};
|
|
6170
|
+
const { mounted, exiting, onAnimationEnd: handleAnimEnd } = usePresence(isOpen, {
|
|
6171
|
+
animation: "modal",
|
|
6172
|
+
onExited
|
|
6173
|
+
});
|
|
6181
6174
|
React74.useEffect(() => {
|
|
6182
6175
|
if (isOpen) {
|
|
6183
6176
|
previousActiveElement.current = document.activeElement;
|
|
@@ -6212,10 +6205,9 @@ var init_Modal = __esm({
|
|
|
6212
6205
|
};
|
|
6213
6206
|
}, [isOpen]);
|
|
6214
6207
|
if (typeof document === "undefined") return null;
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
const
|
|
6218
|
-
const overlayAnim = closing ? "animate-overlay-out" : "animate-overlay-in";
|
|
6208
|
+
if (!mounted) return null;
|
|
6209
|
+
const dialogAnim = exiting ? "animate-modal-out" : "animate-modal-in";
|
|
6210
|
+
const overlayAnim = exiting ? "animate-overlay-out" : "animate-overlay-in";
|
|
6219
6211
|
const handleClose = () => {
|
|
6220
6212
|
if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
|
|
6221
6213
|
onClose();
|
package/dist/components/index.js
CHANGED
|
@@ -6077,6 +6077,7 @@ var init_Modal = __esm({
|
|
|
6077
6077
|
init_Typography();
|
|
6078
6078
|
init_cn();
|
|
6079
6079
|
init_useEventBus();
|
|
6080
|
+
init_Presence();
|
|
6080
6081
|
sizeClasses6 = {
|
|
6081
6082
|
sm: "max-w-md",
|
|
6082
6083
|
md: "max-w-2xl",
|
|
@@ -6121,18 +6122,10 @@ var init_Modal = __esm({
|
|
|
6121
6122
|
const [dragY, setDragY] = useState(0);
|
|
6122
6123
|
const dragStartY = useRef(0);
|
|
6123
6124
|
const isDragging = useRef(false);
|
|
6124
|
-
const
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
wasOpenRef.current = isOpen;
|
|
6129
|
-
}, [isOpen]);
|
|
6130
|
-
const handleAnimEnd = (e) => {
|
|
6131
|
-
if (closing && e.target === e.currentTarget) {
|
|
6132
|
-
setClosing(false);
|
|
6133
|
-
onExited?.();
|
|
6134
|
-
}
|
|
6135
|
-
};
|
|
6125
|
+
const { mounted, exiting, onAnimationEnd: handleAnimEnd } = usePresence(isOpen, {
|
|
6126
|
+
animation: "modal",
|
|
6127
|
+
onExited
|
|
6128
|
+
});
|
|
6136
6129
|
useEffect(() => {
|
|
6137
6130
|
if (isOpen) {
|
|
6138
6131
|
previousActiveElement.current = document.activeElement;
|
|
@@ -6167,10 +6160,9 @@ var init_Modal = __esm({
|
|
|
6167
6160
|
};
|
|
6168
6161
|
}, [isOpen]);
|
|
6169
6162
|
if (typeof document === "undefined") return null;
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
const
|
|
6173
|
-
const overlayAnim = closing ? "animate-overlay-out" : "animate-overlay-in";
|
|
6163
|
+
if (!mounted) return null;
|
|
6164
|
+
const dialogAnim = exiting ? "animate-modal-out" : "animate-modal-in";
|
|
6165
|
+
const overlayAnim = exiting ? "animate-overlay-out" : "animate-overlay-in";
|
|
6174
6166
|
const handleClose = () => {
|
|
6175
6167
|
if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
|
|
6176
6168
|
onClose();
|
package/dist/providers/index.cjs
CHANGED
|
@@ -1277,6 +1277,77 @@ var init_Typography = __esm({
|
|
|
1277
1277
|
Typography.displayName = "Typography";
|
|
1278
1278
|
}
|
|
1279
1279
|
});
|
|
1280
|
+
function isMotionEnabled() {
|
|
1281
|
+
if (typeof document === "undefined") return true;
|
|
1282
|
+
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
1283
|
+
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
1284
|
+
motionEnabledCache = v !== "off";
|
|
1285
|
+
return motionEnabledCache;
|
|
1286
|
+
}
|
|
1287
|
+
function usePresence(show, opts) {
|
|
1288
|
+
const { animation, animate = true, onExited } = opts;
|
|
1289
|
+
const [mounted, setMounted] = React84.useState(show);
|
|
1290
|
+
const [exiting, setExiting] = React84.useState(false);
|
|
1291
|
+
const prev = React84.useRef(show);
|
|
1292
|
+
const onExitedRef = React84.useRef(onExited);
|
|
1293
|
+
onExitedRef.current = onExited;
|
|
1294
|
+
const safeTimer = React84.useRef(null);
|
|
1295
|
+
const clearSafe = React84.useCallback(() => {
|
|
1296
|
+
if (safeTimer.current) {
|
|
1297
|
+
clearTimeout(safeTimer.current);
|
|
1298
|
+
safeTimer.current = null;
|
|
1299
|
+
}
|
|
1300
|
+
}, []);
|
|
1301
|
+
const finishExit = React84.useCallback(() => {
|
|
1302
|
+
clearSafe();
|
|
1303
|
+
setExiting(false);
|
|
1304
|
+
setMounted(false);
|
|
1305
|
+
onExitedRef.current?.();
|
|
1306
|
+
}, [clearSafe]);
|
|
1307
|
+
React84.useLayoutEffect(() => {
|
|
1308
|
+
const moving = animate && isMotionEnabled();
|
|
1309
|
+
if (show && !prev.current) {
|
|
1310
|
+
setExiting(false);
|
|
1311
|
+
setMounted(true);
|
|
1312
|
+
} else if (!show && prev.current) {
|
|
1313
|
+
if (moving) {
|
|
1314
|
+
setExiting(true);
|
|
1315
|
+
clearSafe();
|
|
1316
|
+
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
1317
|
+
} else {
|
|
1318
|
+
setMounted(false);
|
|
1319
|
+
setExiting(false);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
prev.current = show;
|
|
1323
|
+
}, [show, animate, clearSafe, finishExit]);
|
|
1324
|
+
React84.useEffect(() => () => clearSafe(), [clearSafe]);
|
|
1325
|
+
const disabled = !animate || !isMotionEnabled();
|
|
1326
|
+
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
1327
|
+
const onAnimationEnd = React84.useCallback(
|
|
1328
|
+
(e) => {
|
|
1329
|
+
if (e.target !== e.currentTarget) return;
|
|
1330
|
+
if (exiting) finishExit();
|
|
1331
|
+
},
|
|
1332
|
+
[exiting, finishExit]
|
|
1333
|
+
);
|
|
1334
|
+
return { mounted, exiting, className, onAnimationEnd };
|
|
1335
|
+
}
|
|
1336
|
+
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
1337
|
+
var init_Presence = __esm({
|
|
1338
|
+
"components/core/atoms/Presence.tsx"() {
|
|
1339
|
+
"use client";
|
|
1340
|
+
init_cn();
|
|
1341
|
+
SAFE_EXIT_MS = 1e3;
|
|
1342
|
+
motionEnabledCache = null;
|
|
1343
|
+
Presence = ({ show, className, children, ...opts }) => {
|
|
1344
|
+
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
1345
|
+
if (!mounted) return null;
|
|
1346
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
1347
|
+
};
|
|
1348
|
+
Presence.displayName = "Presence";
|
|
1349
|
+
}
|
|
1350
|
+
});
|
|
1280
1351
|
var sizeClasses2, minWidthClasses, lookStyles, Modal;
|
|
1281
1352
|
var init_Modal = __esm({
|
|
1282
1353
|
"components/core/molecules/Modal.tsx"() {
|
|
@@ -1287,6 +1358,7 @@ var init_Modal = __esm({
|
|
|
1287
1358
|
init_Typography();
|
|
1288
1359
|
init_cn();
|
|
1289
1360
|
init_useEventBus();
|
|
1361
|
+
init_Presence();
|
|
1290
1362
|
sizeClasses2 = {
|
|
1291
1363
|
sm: "max-w-md",
|
|
1292
1364
|
md: "max-w-2xl",
|
|
@@ -1331,18 +1403,10 @@ var init_Modal = __esm({
|
|
|
1331
1403
|
const [dragY, setDragY] = React84.useState(0);
|
|
1332
1404
|
const dragStartY = React84.useRef(0);
|
|
1333
1405
|
const isDragging = React84.useRef(false);
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
wasOpenRef.current = isOpen;
|
|
1339
|
-
}, [isOpen]);
|
|
1340
|
-
const handleAnimEnd = (e) => {
|
|
1341
|
-
if (closing && e.target === e.currentTarget) {
|
|
1342
|
-
setClosing(false);
|
|
1343
|
-
onExited?.();
|
|
1344
|
-
}
|
|
1345
|
-
};
|
|
1406
|
+
const { mounted, exiting, onAnimationEnd: handleAnimEnd } = usePresence(isOpen, {
|
|
1407
|
+
animation: "modal",
|
|
1408
|
+
onExited
|
|
1409
|
+
});
|
|
1346
1410
|
React84.useEffect(() => {
|
|
1347
1411
|
if (isOpen) {
|
|
1348
1412
|
previousActiveElement.current = document.activeElement;
|
|
@@ -1377,10 +1441,9 @@ var init_Modal = __esm({
|
|
|
1377
1441
|
};
|
|
1378
1442
|
}, [isOpen]);
|
|
1379
1443
|
if (typeof document === "undefined") return null;
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
const
|
|
1383
|
-
const overlayAnim = closing ? "animate-overlay-out" : "animate-overlay-in";
|
|
1444
|
+
if (!mounted) return null;
|
|
1445
|
+
const dialogAnim = exiting ? "animate-modal-out" : "animate-modal-in";
|
|
1446
|
+
const overlayAnim = exiting ? "animate-overlay-out" : "animate-overlay-in";
|
|
1384
1447
|
const handleClose = () => {
|
|
1385
1448
|
if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
|
|
1386
1449
|
onClose();
|
|
@@ -1511,77 +1574,6 @@ var init_Modal = __esm({
|
|
|
1511
1574
|
Modal.displayName = "Modal";
|
|
1512
1575
|
}
|
|
1513
1576
|
});
|
|
1514
|
-
function isMotionEnabled() {
|
|
1515
|
-
if (typeof document === "undefined") return true;
|
|
1516
|
-
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
1517
|
-
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
1518
|
-
motionEnabledCache = v !== "off";
|
|
1519
|
-
return motionEnabledCache;
|
|
1520
|
-
}
|
|
1521
|
-
function usePresence(show, opts) {
|
|
1522
|
-
const { animation, animate = true, onExited } = opts;
|
|
1523
|
-
const [mounted, setMounted] = React84.useState(show);
|
|
1524
|
-
const [exiting, setExiting] = React84.useState(false);
|
|
1525
|
-
const prev = React84.useRef(show);
|
|
1526
|
-
const onExitedRef = React84.useRef(onExited);
|
|
1527
|
-
onExitedRef.current = onExited;
|
|
1528
|
-
const safeTimer = React84.useRef(null);
|
|
1529
|
-
const clearSafe = React84.useCallback(() => {
|
|
1530
|
-
if (safeTimer.current) {
|
|
1531
|
-
clearTimeout(safeTimer.current);
|
|
1532
|
-
safeTimer.current = null;
|
|
1533
|
-
}
|
|
1534
|
-
}, []);
|
|
1535
|
-
const finishExit = React84.useCallback(() => {
|
|
1536
|
-
clearSafe();
|
|
1537
|
-
setExiting(false);
|
|
1538
|
-
setMounted(false);
|
|
1539
|
-
onExitedRef.current?.();
|
|
1540
|
-
}, [clearSafe]);
|
|
1541
|
-
React84.useLayoutEffect(() => {
|
|
1542
|
-
const moving = animate && isMotionEnabled();
|
|
1543
|
-
if (show && !prev.current) {
|
|
1544
|
-
setExiting(false);
|
|
1545
|
-
setMounted(true);
|
|
1546
|
-
} else if (!show && prev.current) {
|
|
1547
|
-
if (moving) {
|
|
1548
|
-
setExiting(true);
|
|
1549
|
-
clearSafe();
|
|
1550
|
-
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
1551
|
-
} else {
|
|
1552
|
-
setMounted(false);
|
|
1553
|
-
setExiting(false);
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
prev.current = show;
|
|
1557
|
-
}, [show, animate, clearSafe, finishExit]);
|
|
1558
|
-
React84.useEffect(() => () => clearSafe(), [clearSafe]);
|
|
1559
|
-
const disabled = !animate || !isMotionEnabled();
|
|
1560
|
-
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
1561
|
-
const onAnimationEnd = React84.useCallback(
|
|
1562
|
-
(e) => {
|
|
1563
|
-
if (e.target !== e.currentTarget) return;
|
|
1564
|
-
if (exiting) finishExit();
|
|
1565
|
-
},
|
|
1566
|
-
[exiting, finishExit]
|
|
1567
|
-
);
|
|
1568
|
-
return { mounted, exiting, className, onAnimationEnd };
|
|
1569
|
-
}
|
|
1570
|
-
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
1571
|
-
var init_Presence = __esm({
|
|
1572
|
-
"components/core/atoms/Presence.tsx"() {
|
|
1573
|
-
"use client";
|
|
1574
|
-
init_cn();
|
|
1575
|
-
SAFE_EXIT_MS = 1e3;
|
|
1576
|
-
motionEnabledCache = null;
|
|
1577
|
-
Presence = ({ show, className, children, ...opts }) => {
|
|
1578
|
-
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
1579
|
-
if (!mounted) return null;
|
|
1580
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
1581
|
-
};
|
|
1582
|
-
Presence.displayName = "Presence";
|
|
1583
|
-
}
|
|
1584
|
-
});
|
|
1585
1577
|
var Overlay;
|
|
1586
1578
|
var init_Overlay = __esm({
|
|
1587
1579
|
"components/core/atoms/Overlay.tsx"() {
|
package/dist/providers/index.js
CHANGED
|
@@ -1232,6 +1232,77 @@ var init_Typography = __esm({
|
|
|
1232
1232
|
Typography.displayName = "Typography";
|
|
1233
1233
|
}
|
|
1234
1234
|
});
|
|
1235
|
+
function isMotionEnabled() {
|
|
1236
|
+
if (typeof document === "undefined") return true;
|
|
1237
|
+
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
1238
|
+
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
1239
|
+
motionEnabledCache = v !== "off";
|
|
1240
|
+
return motionEnabledCache;
|
|
1241
|
+
}
|
|
1242
|
+
function usePresence(show, opts) {
|
|
1243
|
+
const { animation, animate = true, onExited } = opts;
|
|
1244
|
+
const [mounted, setMounted] = useState(show);
|
|
1245
|
+
const [exiting, setExiting] = useState(false);
|
|
1246
|
+
const prev = useRef(show);
|
|
1247
|
+
const onExitedRef = useRef(onExited);
|
|
1248
|
+
onExitedRef.current = onExited;
|
|
1249
|
+
const safeTimer = useRef(null);
|
|
1250
|
+
const clearSafe = useCallback(() => {
|
|
1251
|
+
if (safeTimer.current) {
|
|
1252
|
+
clearTimeout(safeTimer.current);
|
|
1253
|
+
safeTimer.current = null;
|
|
1254
|
+
}
|
|
1255
|
+
}, []);
|
|
1256
|
+
const finishExit = useCallback(() => {
|
|
1257
|
+
clearSafe();
|
|
1258
|
+
setExiting(false);
|
|
1259
|
+
setMounted(false);
|
|
1260
|
+
onExitedRef.current?.();
|
|
1261
|
+
}, [clearSafe]);
|
|
1262
|
+
useLayoutEffect(() => {
|
|
1263
|
+
const moving = animate && isMotionEnabled();
|
|
1264
|
+
if (show && !prev.current) {
|
|
1265
|
+
setExiting(false);
|
|
1266
|
+
setMounted(true);
|
|
1267
|
+
} else if (!show && prev.current) {
|
|
1268
|
+
if (moving) {
|
|
1269
|
+
setExiting(true);
|
|
1270
|
+
clearSafe();
|
|
1271
|
+
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
1272
|
+
} else {
|
|
1273
|
+
setMounted(false);
|
|
1274
|
+
setExiting(false);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
prev.current = show;
|
|
1278
|
+
}, [show, animate, clearSafe, finishExit]);
|
|
1279
|
+
useEffect(() => () => clearSafe(), [clearSafe]);
|
|
1280
|
+
const disabled = !animate || !isMotionEnabled();
|
|
1281
|
+
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
1282
|
+
const onAnimationEnd = useCallback(
|
|
1283
|
+
(e) => {
|
|
1284
|
+
if (e.target !== e.currentTarget) return;
|
|
1285
|
+
if (exiting) finishExit();
|
|
1286
|
+
},
|
|
1287
|
+
[exiting, finishExit]
|
|
1288
|
+
);
|
|
1289
|
+
return { mounted, exiting, className, onAnimationEnd };
|
|
1290
|
+
}
|
|
1291
|
+
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
1292
|
+
var init_Presence = __esm({
|
|
1293
|
+
"components/core/atoms/Presence.tsx"() {
|
|
1294
|
+
"use client";
|
|
1295
|
+
init_cn();
|
|
1296
|
+
SAFE_EXIT_MS = 1e3;
|
|
1297
|
+
motionEnabledCache = null;
|
|
1298
|
+
Presence = ({ show, className, children, ...opts }) => {
|
|
1299
|
+
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
1300
|
+
if (!mounted) return null;
|
|
1301
|
+
return /* @__PURE__ */ jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
1302
|
+
};
|
|
1303
|
+
Presence.displayName = "Presence";
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1235
1306
|
var sizeClasses2, minWidthClasses, lookStyles, Modal;
|
|
1236
1307
|
var init_Modal = __esm({
|
|
1237
1308
|
"components/core/molecules/Modal.tsx"() {
|
|
@@ -1242,6 +1313,7 @@ var init_Modal = __esm({
|
|
|
1242
1313
|
init_Typography();
|
|
1243
1314
|
init_cn();
|
|
1244
1315
|
init_useEventBus();
|
|
1316
|
+
init_Presence();
|
|
1245
1317
|
sizeClasses2 = {
|
|
1246
1318
|
sm: "max-w-md",
|
|
1247
1319
|
md: "max-w-2xl",
|
|
@@ -1286,18 +1358,10 @@ var init_Modal = __esm({
|
|
|
1286
1358
|
const [dragY, setDragY] = useState(0);
|
|
1287
1359
|
const dragStartY = useRef(0);
|
|
1288
1360
|
const isDragging = useRef(false);
|
|
1289
|
-
const
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
wasOpenRef.current = isOpen;
|
|
1294
|
-
}, [isOpen]);
|
|
1295
|
-
const handleAnimEnd = (e) => {
|
|
1296
|
-
if (closing && e.target === e.currentTarget) {
|
|
1297
|
-
setClosing(false);
|
|
1298
|
-
onExited?.();
|
|
1299
|
-
}
|
|
1300
|
-
};
|
|
1361
|
+
const { mounted, exiting, onAnimationEnd: handleAnimEnd } = usePresence(isOpen, {
|
|
1362
|
+
animation: "modal",
|
|
1363
|
+
onExited
|
|
1364
|
+
});
|
|
1301
1365
|
useEffect(() => {
|
|
1302
1366
|
if (isOpen) {
|
|
1303
1367
|
previousActiveElement.current = document.activeElement;
|
|
@@ -1332,10 +1396,9 @@ var init_Modal = __esm({
|
|
|
1332
1396
|
};
|
|
1333
1397
|
}, [isOpen]);
|
|
1334
1398
|
if (typeof document === "undefined") return null;
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
const
|
|
1338
|
-
const overlayAnim = closing ? "animate-overlay-out" : "animate-overlay-in";
|
|
1399
|
+
if (!mounted) return null;
|
|
1400
|
+
const dialogAnim = exiting ? "animate-modal-out" : "animate-modal-in";
|
|
1401
|
+
const overlayAnim = exiting ? "animate-overlay-out" : "animate-overlay-in";
|
|
1339
1402
|
const handleClose = () => {
|
|
1340
1403
|
if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
|
|
1341
1404
|
onClose();
|
|
@@ -1466,77 +1529,6 @@ var init_Modal = __esm({
|
|
|
1466
1529
|
Modal.displayName = "Modal";
|
|
1467
1530
|
}
|
|
1468
1531
|
});
|
|
1469
|
-
function isMotionEnabled() {
|
|
1470
|
-
if (typeof document === "undefined") return true;
|
|
1471
|
-
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
1472
|
-
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
1473
|
-
motionEnabledCache = v !== "off";
|
|
1474
|
-
return motionEnabledCache;
|
|
1475
|
-
}
|
|
1476
|
-
function usePresence(show, opts) {
|
|
1477
|
-
const { animation, animate = true, onExited } = opts;
|
|
1478
|
-
const [mounted, setMounted] = useState(show);
|
|
1479
|
-
const [exiting, setExiting] = useState(false);
|
|
1480
|
-
const prev = useRef(show);
|
|
1481
|
-
const onExitedRef = useRef(onExited);
|
|
1482
|
-
onExitedRef.current = onExited;
|
|
1483
|
-
const safeTimer = useRef(null);
|
|
1484
|
-
const clearSafe = useCallback(() => {
|
|
1485
|
-
if (safeTimer.current) {
|
|
1486
|
-
clearTimeout(safeTimer.current);
|
|
1487
|
-
safeTimer.current = null;
|
|
1488
|
-
}
|
|
1489
|
-
}, []);
|
|
1490
|
-
const finishExit = useCallback(() => {
|
|
1491
|
-
clearSafe();
|
|
1492
|
-
setExiting(false);
|
|
1493
|
-
setMounted(false);
|
|
1494
|
-
onExitedRef.current?.();
|
|
1495
|
-
}, [clearSafe]);
|
|
1496
|
-
useLayoutEffect(() => {
|
|
1497
|
-
const moving = animate && isMotionEnabled();
|
|
1498
|
-
if (show && !prev.current) {
|
|
1499
|
-
setExiting(false);
|
|
1500
|
-
setMounted(true);
|
|
1501
|
-
} else if (!show && prev.current) {
|
|
1502
|
-
if (moving) {
|
|
1503
|
-
setExiting(true);
|
|
1504
|
-
clearSafe();
|
|
1505
|
-
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
1506
|
-
} else {
|
|
1507
|
-
setMounted(false);
|
|
1508
|
-
setExiting(false);
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
prev.current = show;
|
|
1512
|
-
}, [show, animate, clearSafe, finishExit]);
|
|
1513
|
-
useEffect(() => () => clearSafe(), [clearSafe]);
|
|
1514
|
-
const disabled = !animate || !isMotionEnabled();
|
|
1515
|
-
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
1516
|
-
const onAnimationEnd = useCallback(
|
|
1517
|
-
(e) => {
|
|
1518
|
-
if (e.target !== e.currentTarget) return;
|
|
1519
|
-
if (exiting) finishExit();
|
|
1520
|
-
},
|
|
1521
|
-
[exiting, finishExit]
|
|
1522
|
-
);
|
|
1523
|
-
return { mounted, exiting, className, onAnimationEnd };
|
|
1524
|
-
}
|
|
1525
|
-
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
1526
|
-
var init_Presence = __esm({
|
|
1527
|
-
"components/core/atoms/Presence.tsx"() {
|
|
1528
|
-
"use client";
|
|
1529
|
-
init_cn();
|
|
1530
|
-
SAFE_EXIT_MS = 1e3;
|
|
1531
|
-
motionEnabledCache = null;
|
|
1532
|
-
Presence = ({ show, className, children, ...opts }) => {
|
|
1533
|
-
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
1534
|
-
if (!mounted) return null;
|
|
1535
|
-
return /* @__PURE__ */ jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
1536
|
-
};
|
|
1537
|
-
Presence.displayName = "Presence";
|
|
1538
|
-
}
|
|
1539
|
-
});
|
|
1540
1532
|
var Overlay;
|
|
1541
1533
|
var init_Overlay = __esm({
|
|
1542
1534
|
"components/core/atoms/Overlay.tsx"() {
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -1755,6 +1755,77 @@ var init_Typography = __esm({
|
|
|
1755
1755
|
Typography.displayName = "Typography";
|
|
1756
1756
|
}
|
|
1757
1757
|
});
|
|
1758
|
+
function isMotionEnabled() {
|
|
1759
|
+
if (typeof document === "undefined") return true;
|
|
1760
|
+
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
1761
|
+
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
1762
|
+
motionEnabledCache = v !== "off";
|
|
1763
|
+
return motionEnabledCache;
|
|
1764
|
+
}
|
|
1765
|
+
function usePresence(show, opts) {
|
|
1766
|
+
const { animation, animate = true, onExited } = opts;
|
|
1767
|
+
const [mounted, setMounted] = React82.useState(show);
|
|
1768
|
+
const [exiting, setExiting] = React82.useState(false);
|
|
1769
|
+
const prev = React82.useRef(show);
|
|
1770
|
+
const onExitedRef = React82.useRef(onExited);
|
|
1771
|
+
onExitedRef.current = onExited;
|
|
1772
|
+
const safeTimer = React82.useRef(null);
|
|
1773
|
+
const clearSafe = React82.useCallback(() => {
|
|
1774
|
+
if (safeTimer.current) {
|
|
1775
|
+
clearTimeout(safeTimer.current);
|
|
1776
|
+
safeTimer.current = null;
|
|
1777
|
+
}
|
|
1778
|
+
}, []);
|
|
1779
|
+
const finishExit = React82.useCallback(() => {
|
|
1780
|
+
clearSafe();
|
|
1781
|
+
setExiting(false);
|
|
1782
|
+
setMounted(false);
|
|
1783
|
+
onExitedRef.current?.();
|
|
1784
|
+
}, [clearSafe]);
|
|
1785
|
+
React82.useLayoutEffect(() => {
|
|
1786
|
+
const moving = animate && isMotionEnabled();
|
|
1787
|
+
if (show && !prev.current) {
|
|
1788
|
+
setExiting(false);
|
|
1789
|
+
setMounted(true);
|
|
1790
|
+
} else if (!show && prev.current) {
|
|
1791
|
+
if (moving) {
|
|
1792
|
+
setExiting(true);
|
|
1793
|
+
clearSafe();
|
|
1794
|
+
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
1795
|
+
} else {
|
|
1796
|
+
setMounted(false);
|
|
1797
|
+
setExiting(false);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
prev.current = show;
|
|
1801
|
+
}, [show, animate, clearSafe, finishExit]);
|
|
1802
|
+
React82.useEffect(() => () => clearSafe(), [clearSafe]);
|
|
1803
|
+
const disabled = !animate || !isMotionEnabled();
|
|
1804
|
+
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
1805
|
+
const onAnimationEnd = React82.useCallback(
|
|
1806
|
+
(e) => {
|
|
1807
|
+
if (e.target !== e.currentTarget) return;
|
|
1808
|
+
if (exiting) finishExit();
|
|
1809
|
+
},
|
|
1810
|
+
[exiting, finishExit]
|
|
1811
|
+
);
|
|
1812
|
+
return { mounted, exiting, className, onAnimationEnd };
|
|
1813
|
+
}
|
|
1814
|
+
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
1815
|
+
var init_Presence = __esm({
|
|
1816
|
+
"components/core/atoms/Presence.tsx"() {
|
|
1817
|
+
"use client";
|
|
1818
|
+
init_cn();
|
|
1819
|
+
SAFE_EXIT_MS = 1e3;
|
|
1820
|
+
motionEnabledCache = null;
|
|
1821
|
+
Presence = ({ show, className, children, ...opts }) => {
|
|
1822
|
+
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
1823
|
+
if (!mounted) return null;
|
|
1824
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
1825
|
+
};
|
|
1826
|
+
Presence.displayName = "Presence";
|
|
1827
|
+
}
|
|
1828
|
+
});
|
|
1758
1829
|
var sizeClasses2, minWidthClasses, lookStyles, Modal;
|
|
1759
1830
|
var init_Modal = __esm({
|
|
1760
1831
|
"components/core/molecules/Modal.tsx"() {
|
|
@@ -1765,6 +1836,7 @@ var init_Modal = __esm({
|
|
|
1765
1836
|
init_Typography();
|
|
1766
1837
|
init_cn();
|
|
1767
1838
|
init_useEventBus();
|
|
1839
|
+
init_Presence();
|
|
1768
1840
|
sizeClasses2 = {
|
|
1769
1841
|
sm: "max-w-md",
|
|
1770
1842
|
md: "max-w-2xl",
|
|
@@ -1809,18 +1881,10 @@ var init_Modal = __esm({
|
|
|
1809
1881
|
const [dragY, setDragY] = React82.useState(0);
|
|
1810
1882
|
const dragStartY = React82.useRef(0);
|
|
1811
1883
|
const isDragging = React82.useRef(false);
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
wasOpenRef.current = isOpen;
|
|
1817
|
-
}, [isOpen]);
|
|
1818
|
-
const handleAnimEnd = (e) => {
|
|
1819
|
-
if (closing && e.target === e.currentTarget) {
|
|
1820
|
-
setClosing(false);
|
|
1821
|
-
onExited?.();
|
|
1822
|
-
}
|
|
1823
|
-
};
|
|
1884
|
+
const { mounted, exiting, onAnimationEnd: handleAnimEnd } = usePresence(isOpen, {
|
|
1885
|
+
animation: "modal",
|
|
1886
|
+
onExited
|
|
1887
|
+
});
|
|
1824
1888
|
React82.useEffect(() => {
|
|
1825
1889
|
if (isOpen) {
|
|
1826
1890
|
previousActiveElement.current = document.activeElement;
|
|
@@ -1855,10 +1919,9 @@ var init_Modal = __esm({
|
|
|
1855
1919
|
};
|
|
1856
1920
|
}, [isOpen]);
|
|
1857
1921
|
if (typeof document === "undefined") return null;
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
const
|
|
1861
|
-
const overlayAnim = closing ? "animate-overlay-out" : "animate-overlay-in";
|
|
1922
|
+
if (!mounted) return null;
|
|
1923
|
+
const dialogAnim = exiting ? "animate-modal-out" : "animate-modal-in";
|
|
1924
|
+
const overlayAnim = exiting ? "animate-overlay-out" : "animate-overlay-in";
|
|
1862
1925
|
const handleClose = () => {
|
|
1863
1926
|
if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
|
|
1864
1927
|
onClose();
|
|
@@ -1989,77 +2052,6 @@ var init_Modal = __esm({
|
|
|
1989
2052
|
Modal.displayName = "Modal";
|
|
1990
2053
|
}
|
|
1991
2054
|
});
|
|
1992
|
-
function isMotionEnabled() {
|
|
1993
|
-
if (typeof document === "undefined") return true;
|
|
1994
|
-
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
1995
|
-
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
1996
|
-
motionEnabledCache = v !== "off";
|
|
1997
|
-
return motionEnabledCache;
|
|
1998
|
-
}
|
|
1999
|
-
function usePresence(show, opts) {
|
|
2000
|
-
const { animation, animate = true, onExited } = opts;
|
|
2001
|
-
const [mounted, setMounted] = React82.useState(show);
|
|
2002
|
-
const [exiting, setExiting] = React82.useState(false);
|
|
2003
|
-
const prev = React82.useRef(show);
|
|
2004
|
-
const onExitedRef = React82.useRef(onExited);
|
|
2005
|
-
onExitedRef.current = onExited;
|
|
2006
|
-
const safeTimer = React82.useRef(null);
|
|
2007
|
-
const clearSafe = React82.useCallback(() => {
|
|
2008
|
-
if (safeTimer.current) {
|
|
2009
|
-
clearTimeout(safeTimer.current);
|
|
2010
|
-
safeTimer.current = null;
|
|
2011
|
-
}
|
|
2012
|
-
}, []);
|
|
2013
|
-
const finishExit = React82.useCallback(() => {
|
|
2014
|
-
clearSafe();
|
|
2015
|
-
setExiting(false);
|
|
2016
|
-
setMounted(false);
|
|
2017
|
-
onExitedRef.current?.();
|
|
2018
|
-
}, [clearSafe]);
|
|
2019
|
-
React82.useLayoutEffect(() => {
|
|
2020
|
-
const moving = animate && isMotionEnabled();
|
|
2021
|
-
if (show && !prev.current) {
|
|
2022
|
-
setExiting(false);
|
|
2023
|
-
setMounted(true);
|
|
2024
|
-
} else if (!show && prev.current) {
|
|
2025
|
-
if (moving) {
|
|
2026
|
-
setExiting(true);
|
|
2027
|
-
clearSafe();
|
|
2028
|
-
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
2029
|
-
} else {
|
|
2030
|
-
setMounted(false);
|
|
2031
|
-
setExiting(false);
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
prev.current = show;
|
|
2035
|
-
}, [show, animate, clearSafe, finishExit]);
|
|
2036
|
-
React82.useEffect(() => () => clearSafe(), [clearSafe]);
|
|
2037
|
-
const disabled = !animate || !isMotionEnabled();
|
|
2038
|
-
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
2039
|
-
const onAnimationEnd = React82.useCallback(
|
|
2040
|
-
(e) => {
|
|
2041
|
-
if (e.target !== e.currentTarget) return;
|
|
2042
|
-
if (exiting) finishExit();
|
|
2043
|
-
},
|
|
2044
|
-
[exiting, finishExit]
|
|
2045
|
-
);
|
|
2046
|
-
return { mounted, exiting, className, onAnimationEnd };
|
|
2047
|
-
}
|
|
2048
|
-
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
2049
|
-
var init_Presence = __esm({
|
|
2050
|
-
"components/core/atoms/Presence.tsx"() {
|
|
2051
|
-
"use client";
|
|
2052
|
-
init_cn();
|
|
2053
|
-
SAFE_EXIT_MS = 1e3;
|
|
2054
|
-
motionEnabledCache = null;
|
|
2055
|
-
Presence = ({ show, className, children, ...opts }) => {
|
|
2056
|
-
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
2057
|
-
if (!mounted) return null;
|
|
2058
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
2059
|
-
};
|
|
2060
|
-
Presence.displayName = "Presence";
|
|
2061
|
-
}
|
|
2062
|
-
});
|
|
2063
2055
|
var Overlay;
|
|
2064
2056
|
var init_Overlay = __esm({
|
|
2065
2057
|
"components/core/atoms/Overlay.tsx"() {
|
package/dist/runtime/index.js
CHANGED
|
@@ -1711,6 +1711,77 @@ var init_Typography = __esm({
|
|
|
1711
1711
|
Typography.displayName = "Typography";
|
|
1712
1712
|
}
|
|
1713
1713
|
});
|
|
1714
|
+
function isMotionEnabled() {
|
|
1715
|
+
if (typeof document === "undefined") return true;
|
|
1716
|
+
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
1717
|
+
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
1718
|
+
motionEnabledCache = v !== "off";
|
|
1719
|
+
return motionEnabledCache;
|
|
1720
|
+
}
|
|
1721
|
+
function usePresence(show, opts) {
|
|
1722
|
+
const { animation, animate = true, onExited } = opts;
|
|
1723
|
+
const [mounted, setMounted] = useState(show);
|
|
1724
|
+
const [exiting, setExiting] = useState(false);
|
|
1725
|
+
const prev = useRef(show);
|
|
1726
|
+
const onExitedRef = useRef(onExited);
|
|
1727
|
+
onExitedRef.current = onExited;
|
|
1728
|
+
const safeTimer = useRef(null);
|
|
1729
|
+
const clearSafe = useCallback(() => {
|
|
1730
|
+
if (safeTimer.current) {
|
|
1731
|
+
clearTimeout(safeTimer.current);
|
|
1732
|
+
safeTimer.current = null;
|
|
1733
|
+
}
|
|
1734
|
+
}, []);
|
|
1735
|
+
const finishExit = useCallback(() => {
|
|
1736
|
+
clearSafe();
|
|
1737
|
+
setExiting(false);
|
|
1738
|
+
setMounted(false);
|
|
1739
|
+
onExitedRef.current?.();
|
|
1740
|
+
}, [clearSafe]);
|
|
1741
|
+
useLayoutEffect(() => {
|
|
1742
|
+
const moving = animate && isMotionEnabled();
|
|
1743
|
+
if (show && !prev.current) {
|
|
1744
|
+
setExiting(false);
|
|
1745
|
+
setMounted(true);
|
|
1746
|
+
} else if (!show && prev.current) {
|
|
1747
|
+
if (moving) {
|
|
1748
|
+
setExiting(true);
|
|
1749
|
+
clearSafe();
|
|
1750
|
+
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
1751
|
+
} else {
|
|
1752
|
+
setMounted(false);
|
|
1753
|
+
setExiting(false);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
prev.current = show;
|
|
1757
|
+
}, [show, animate, clearSafe, finishExit]);
|
|
1758
|
+
useEffect(() => () => clearSafe(), [clearSafe]);
|
|
1759
|
+
const disabled = !animate || !isMotionEnabled();
|
|
1760
|
+
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
1761
|
+
const onAnimationEnd = useCallback(
|
|
1762
|
+
(e) => {
|
|
1763
|
+
if (e.target !== e.currentTarget) return;
|
|
1764
|
+
if (exiting) finishExit();
|
|
1765
|
+
},
|
|
1766
|
+
[exiting, finishExit]
|
|
1767
|
+
);
|
|
1768
|
+
return { mounted, exiting, className, onAnimationEnd };
|
|
1769
|
+
}
|
|
1770
|
+
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
1771
|
+
var init_Presence = __esm({
|
|
1772
|
+
"components/core/atoms/Presence.tsx"() {
|
|
1773
|
+
"use client";
|
|
1774
|
+
init_cn();
|
|
1775
|
+
SAFE_EXIT_MS = 1e3;
|
|
1776
|
+
motionEnabledCache = null;
|
|
1777
|
+
Presence = ({ show, className, children, ...opts }) => {
|
|
1778
|
+
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
1779
|
+
if (!mounted) return null;
|
|
1780
|
+
return /* @__PURE__ */ jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
1781
|
+
};
|
|
1782
|
+
Presence.displayName = "Presence";
|
|
1783
|
+
}
|
|
1784
|
+
});
|
|
1714
1785
|
var sizeClasses2, minWidthClasses, lookStyles, Modal;
|
|
1715
1786
|
var init_Modal = __esm({
|
|
1716
1787
|
"components/core/molecules/Modal.tsx"() {
|
|
@@ -1721,6 +1792,7 @@ var init_Modal = __esm({
|
|
|
1721
1792
|
init_Typography();
|
|
1722
1793
|
init_cn();
|
|
1723
1794
|
init_useEventBus();
|
|
1795
|
+
init_Presence();
|
|
1724
1796
|
sizeClasses2 = {
|
|
1725
1797
|
sm: "max-w-md",
|
|
1726
1798
|
md: "max-w-2xl",
|
|
@@ -1765,18 +1837,10 @@ var init_Modal = __esm({
|
|
|
1765
1837
|
const [dragY, setDragY] = useState(0);
|
|
1766
1838
|
const dragStartY = useRef(0);
|
|
1767
1839
|
const isDragging = useRef(false);
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
wasOpenRef.current = isOpen;
|
|
1773
|
-
}, [isOpen]);
|
|
1774
|
-
const handleAnimEnd = (e) => {
|
|
1775
|
-
if (closing && e.target === e.currentTarget) {
|
|
1776
|
-
setClosing(false);
|
|
1777
|
-
onExited?.();
|
|
1778
|
-
}
|
|
1779
|
-
};
|
|
1840
|
+
const { mounted, exiting, onAnimationEnd: handleAnimEnd } = usePresence(isOpen, {
|
|
1841
|
+
animation: "modal",
|
|
1842
|
+
onExited
|
|
1843
|
+
});
|
|
1780
1844
|
useEffect(() => {
|
|
1781
1845
|
if (isOpen) {
|
|
1782
1846
|
previousActiveElement.current = document.activeElement;
|
|
@@ -1811,10 +1875,9 @@ var init_Modal = __esm({
|
|
|
1811
1875
|
};
|
|
1812
1876
|
}, [isOpen]);
|
|
1813
1877
|
if (typeof document === "undefined") return null;
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
const
|
|
1817
|
-
const overlayAnim = closing ? "animate-overlay-out" : "animate-overlay-in";
|
|
1878
|
+
if (!mounted) return null;
|
|
1879
|
+
const dialogAnim = exiting ? "animate-modal-out" : "animate-modal-in";
|
|
1880
|
+
const overlayAnim = exiting ? "animate-overlay-out" : "animate-overlay-in";
|
|
1818
1881
|
const handleClose = () => {
|
|
1819
1882
|
if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
|
|
1820
1883
|
onClose();
|
|
@@ -1945,77 +2008,6 @@ var init_Modal = __esm({
|
|
|
1945
2008
|
Modal.displayName = "Modal";
|
|
1946
2009
|
}
|
|
1947
2010
|
});
|
|
1948
|
-
function isMotionEnabled() {
|
|
1949
|
-
if (typeof document === "undefined") return true;
|
|
1950
|
-
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
1951
|
-
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
1952
|
-
motionEnabledCache = v !== "off";
|
|
1953
|
-
return motionEnabledCache;
|
|
1954
|
-
}
|
|
1955
|
-
function usePresence(show, opts) {
|
|
1956
|
-
const { animation, animate = true, onExited } = opts;
|
|
1957
|
-
const [mounted, setMounted] = useState(show);
|
|
1958
|
-
const [exiting, setExiting] = useState(false);
|
|
1959
|
-
const prev = useRef(show);
|
|
1960
|
-
const onExitedRef = useRef(onExited);
|
|
1961
|
-
onExitedRef.current = onExited;
|
|
1962
|
-
const safeTimer = useRef(null);
|
|
1963
|
-
const clearSafe = useCallback(() => {
|
|
1964
|
-
if (safeTimer.current) {
|
|
1965
|
-
clearTimeout(safeTimer.current);
|
|
1966
|
-
safeTimer.current = null;
|
|
1967
|
-
}
|
|
1968
|
-
}, []);
|
|
1969
|
-
const finishExit = useCallback(() => {
|
|
1970
|
-
clearSafe();
|
|
1971
|
-
setExiting(false);
|
|
1972
|
-
setMounted(false);
|
|
1973
|
-
onExitedRef.current?.();
|
|
1974
|
-
}, [clearSafe]);
|
|
1975
|
-
useLayoutEffect(() => {
|
|
1976
|
-
const moving = animate && isMotionEnabled();
|
|
1977
|
-
if (show && !prev.current) {
|
|
1978
|
-
setExiting(false);
|
|
1979
|
-
setMounted(true);
|
|
1980
|
-
} else if (!show && prev.current) {
|
|
1981
|
-
if (moving) {
|
|
1982
|
-
setExiting(true);
|
|
1983
|
-
clearSafe();
|
|
1984
|
-
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
1985
|
-
} else {
|
|
1986
|
-
setMounted(false);
|
|
1987
|
-
setExiting(false);
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
prev.current = show;
|
|
1991
|
-
}, [show, animate, clearSafe, finishExit]);
|
|
1992
|
-
useEffect(() => () => clearSafe(), [clearSafe]);
|
|
1993
|
-
const disabled = !animate || !isMotionEnabled();
|
|
1994
|
-
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
1995
|
-
const onAnimationEnd = useCallback(
|
|
1996
|
-
(e) => {
|
|
1997
|
-
if (e.target !== e.currentTarget) return;
|
|
1998
|
-
if (exiting) finishExit();
|
|
1999
|
-
},
|
|
2000
|
-
[exiting, finishExit]
|
|
2001
|
-
);
|
|
2002
|
-
return { mounted, exiting, className, onAnimationEnd };
|
|
2003
|
-
}
|
|
2004
|
-
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
2005
|
-
var init_Presence = __esm({
|
|
2006
|
-
"components/core/atoms/Presence.tsx"() {
|
|
2007
|
-
"use client";
|
|
2008
|
-
init_cn();
|
|
2009
|
-
SAFE_EXIT_MS = 1e3;
|
|
2010
|
-
motionEnabledCache = null;
|
|
2011
|
-
Presence = ({ show, className, children, ...opts }) => {
|
|
2012
|
-
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
2013
|
-
if (!mounted) return null;
|
|
2014
|
-
return /* @__PURE__ */ jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
2015
|
-
};
|
|
2016
|
-
Presence.displayName = "Presence";
|
|
2017
|
-
}
|
|
2018
|
-
});
|
|
2019
2011
|
var Overlay;
|
|
2020
2012
|
var init_Overlay = __esm({
|
|
2021
2013
|
"components/core/atoms/Overlay.tsx"() {
|