@astra-kit/ui 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE.md +21 -0
- package/README.md +330 -2
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/assets/fonts/geist-LICENSE.txt +93 -0
- package/assets/fonts/geist-latin-variable.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
- package/assets/fonts/ibmplexmono-LICENSE.txt +93 -0
- package/assets/fonts/inter-LICENSE.txt +93 -0
- package/assets/fonts/inter-latin-variable.woff2 +0 -0
- package/dist/adapters/unpic-image.d.ts +3 -0
- package/dist/adapters/unpic-image.js +98 -0
- package/dist/components/account-menu.d.ts +67 -0
- package/dist/components/account-menu.js +440 -0
- package/dist/components/action-button.d.ts +25 -0
- package/dist/components/action-button.js +264 -0
- package/dist/components/alert.d.ts +31 -0
- package/dist/components/alert.js +503 -0
- package/dist/components/animated-collapse.d.ts +19 -0
- package/dist/components/animated-collapse.js +170 -0
- package/dist/components/animated-count.d.ts +13 -0
- package/dist/components/animated-count.js +105 -0
- package/dist/components/animated-list-item.d.ts +25 -0
- package/dist/components/animated-list-item.js +134 -0
- package/dist/components/animated-theme-toggler.d.ts +12 -0
- package/dist/components/animated-theme-toggler.js +200 -0
- package/dist/components/avatar.d.ts +65 -0
- package/dist/components/avatar.js +463 -0
- package/dist/components/badge.d.ts +21 -0
- package/dist/components/badge.js +297 -0
- package/dist/components/button-interaction.d.ts +23 -0
- package/dist/components/button-interaction.js +22 -0
- package/dist/components/button-label.d.ts +8 -0
- package/dist/components/button-label.js +203 -0
- package/dist/components/button.d.ts +23 -0
- package/dist/components/button.js +145 -0
- package/dist/components/calendar.d.ts +47 -0
- package/dist/components/calendar.js +155 -0
- package/dist/components/card.d.ts +38 -0
- package/dist/components/card.js +904 -0
- package/dist/components/carousel.d.ts +71 -0
- package/dist/components/carousel.js +585 -0
- package/dist/components/checkbox.d.ts +15 -0
- package/dist/components/checkbox.js +324 -0
- package/dist/components/control-button.d.ts +16 -0
- package/dist/components/control-button.js +215 -0
- package/dist/components/data-table.d.ts +118 -0
- package/dist/components/data-table.js +895 -0
- package/dist/components/dialog-surface.d.ts +49 -0
- package/dist/components/dialog-surface.js +220 -0
- package/dist/components/dialog.d.ts +92 -0
- package/dist/components/dialog.js +320 -0
- package/dist/components/dropdown-menu.d.ts +58 -0
- package/dist/components/dropdown-menu.js +135 -0
- package/dist/components/field.d.ts +53 -0
- package/dist/components/field.js +710 -0
- package/dist/components/file-upload.d.ts +88 -0
- package/dist/components/file-upload.js +776 -0
- package/dist/components/filter-presets-bar.d.ts +73 -0
- package/dist/components/filter-presets-bar.js +510 -0
- package/dist/components/filter-query-bar.d.ts +21 -0
- package/dist/components/filter-query-bar.js +881 -0
- package/dist/components/filter-query-grammar.d.ts +188 -0
- package/dist/components/filter-query-grammar.js +875 -0
- package/dist/components/form.d.ts +29 -0
- package/dist/components/form.js +330 -0
- package/dist/components/highlighter.d.ts +15 -0
- package/dist/components/highlighter.js +152 -0
- package/dist/components/hover-card.d.ts +50 -0
- package/dist/components/hover-card.js +80 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.js +277 -0
- package/dist/components/input.d.ts +17 -0
- package/dist/components/input.js +120 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +43 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +43 -0
- package/dist/components/morph-text.d.ts +14 -0
- package/dist/components/morph-text.js +210 -0
- package/dist/components/pagination.d.ts +59 -0
- package/dist/components/pagination.js +190 -0
- package/dist/components/popover.d.ts +17 -0
- package/dist/components/popover.js +40 -0
- package/dist/components/presence-swap.d.ts +22 -0
- package/dist/components/presence-swap.js +209 -0
- package/dist/components/primitives/alert-dialog.d.ts +68 -0
- package/dist/components/primitives/alert-dialog.js +629 -0
- package/dist/components/primitives/avatar.d.ts +46 -0
- package/dist/components/primitives/avatar.js +265 -0
- package/dist/components/primitives/calendar.d.ts +37 -0
- package/dist/components/primitives/calendar.js +1250 -0
- package/dist/components/primitives/carousel.d.ts +106 -0
- package/dist/components/primitives/carousel.js +928 -0
- package/dist/components/primitives/dialog.d.ts +62 -0
- package/dist/components/primitives/dialog.js +490 -0
- package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
- package/dist/components/primitives/dropdown-menu-items.js +265 -0
- package/dist/components/primitives/dropdown-menu.d.ts +64 -0
- package/dist/components/primitives/dropdown-menu.js +560 -0
- package/dist/components/primitives/hover-card.d.ts +50 -0
- package/dist/components/primitives/hover-card.js +507 -0
- package/dist/components/primitives/pagination.d.ts +65 -0
- package/dist/components/primitives/pagination.js +373 -0
- package/dist/components/primitives/popover.d.ts +22 -0
- package/dist/components/primitives/popover.js +213 -0
- package/dist/components/primitives/select.d.ts +37 -0
- package/dist/components/primitives/select.js +428 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.js +277 -0
- package/dist/components/progress-ring.d.ts +20 -0
- package/dist/components/progress-ring.js +53 -0
- package/dist/components/radio-group.d.ts +34 -0
- package/dist/components/radio-group.js +392 -0
- package/dist/components/reaction-button.d.ts +30 -0
- package/dist/components/reaction-button.js +189 -0
- package/dist/components/rich-link-editor.d.ts +25 -0
- package/dist/components/rich-link-editor.js +320 -0
- package/dist/components/rich-markdown-content.d.ts +10 -0
- package/dist/components/rich-markdown-content.js +56 -0
- package/dist/components/rich-text-content.d.ts +19 -0
- package/dist/components/rich-text-content.js +26 -0
- package/dist/components/select.d.ts +55 -0
- package/dist/components/select.js +188 -0
- package/dist/components/separator.d.ts +3 -0
- package/dist/components/separator.js +48 -0
- package/dist/components/sheet.d.ts +19 -0
- package/dist/components/sheet.js +420 -0
- package/dist/components/sidebar-panel-context.d.ts +17 -0
- package/dist/components/sidebar-panel-context.js +14 -0
- package/dist/components/sidebar.d.ts +195 -0
- package/dist/components/sidebar.js +2041 -0
- package/dist/components/skeleton.d.ts +23 -0
- package/dist/components/skeleton.js +334 -0
- package/dist/components/split-button.d.ts +36 -0
- package/dist/components/split-button.js +306 -0
- package/dist/components/svgs/whatsappIcon.d.ts +3 -0
- package/dist/components/svgs/whatsappIcon.js +14 -0
- package/dist/components/switch.d.ts +13 -0
- package/dist/components/switch.js +444 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +298 -0
- package/dist/components/tabs.d.ts +36 -0
- package/dist/components/tabs.js +636 -0
- package/dist/components/textarea.d.ts +16 -0
- package/dist/components/textarea.js +111 -0
- package/dist/components/themed-toaster.d.ts +7 -0
- package/dist/components/themed-toaster.js +86 -0
- package/dist/components/toaster.d.ts +12 -0
- package/dist/components/toaster.js +62 -0
- package/dist/components/tooltip.d.ts +43 -0
- package/dist/components/tooltip.js +65 -0
- package/dist/components/typing-animation.d.ts +34 -0
- package/dist/components/typing-animation.js +389 -0
- package/dist/constants/action-button.d.ts +20 -0
- package/dist/constants/action-button.js +17 -0
- package/dist/constants/alert.d.ts +16 -0
- package/dist/constants/alert.js +13 -0
- package/dist/constants/avatar.d.ts +38 -0
- package/dist/constants/avatar.js +32 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/button.d.ts +16 -0
- package/dist/constants/button.js +16 -0
- package/dist/constants/calendar.d.ts +36 -0
- package/dist/constants/calendar.js +34 -0
- package/dist/constants/card.d.ts +23 -0
- package/dist/constants/card.js +20 -0
- package/dist/constants/carousel.d.ts +55 -0
- package/dist/constants/carousel.js +74 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +11 -0
- package/dist/constants/dialog.js +10 -0
- package/dist/constants/dropdown-menu.d.ts +17 -0
- package/dist/constants/dropdown-menu.js +48 -0
- package/dist/constants/field.d.ts +24 -0
- package/dist/constants/field.js +24 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/morph-text.d.ts +13 -0
- package/dist/constants/morph-text.js +13 -0
- package/dist/constants/motion.d.ts +12 -0
- package/dist/constants/motion.js +12 -0
- package/dist/constants/pagination.d.ts +20 -0
- package/dist/constants/pagination.js +20 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +33 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +7 -0
- package/dist/constants/select.js +34 -0
- package/dist/constants/sidebar.d.ts +9 -0
- package/dist/constants/sidebar.js +17 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/split-button.d.ts +7 -0
- package/dist/constants/split-button.js +5 -0
- package/dist/constants/switch.d.ts +33 -0
- package/dist/constants/switch.js +41 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
- package/dist/hooks/use-horizontal-swipe.js +80 -0
- package/dist/hooks/use-is-hydrated.d.ts +6 -0
- package/dist/hooks/use-is-hydrated.js +20 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +19 -0
- package/dist/hooks/use-prefers-reduced-motion.d.ts +2 -0
- package/dist/hooks/use-prefers-reduced-motion.js +27 -0
- package/dist/hooks/use-rich-link-editor.d.ts +55 -0
- package/dist/hooks/use-rich-link-editor.js +515 -0
- package/dist/hooks/use-sidebar-persistence.d.ts +6 -0
- package/dist/hooks/use-sidebar-persistence.js +52 -0
- package/dist/hooks/use-today.d.ts +7 -0
- package/dist/hooks/use-today.js +50 -0
- package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
- package/dist/hooks/use-viewer-time-zone.js +20 -0
- package/dist/hooks.d.ts +11 -0
- package/dist/hooks.js +11 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +69 -0
- package/dist/lib/browser-clipboard.d.ts +13 -0
- package/dist/lib/browser-clipboard.js +48 -0
- package/dist/lib/column-filter-value.d.ts +12 -0
- package/dist/lib/column-filter-value.js +52 -0
- package/dist/lib/file-acceptance.d.ts +43 -0
- package/dist/lib/file-acceptance.js +107 -0
- package/dist/lib/format-file-size.d.ts +16 -0
- package/dist/lib/format-file-size.js +34 -0
- package/dist/lib/fuzzy-search.d.ts +17 -0
- package/dist/lib/fuzzy-search.js +183 -0
- package/dist/lib/horizontal-swipe.d.ts +23 -0
- package/dist/lib/horizontal-swipe.js +29 -0
- package/dist/lib/image-dimensions.d.ts +2 -0
- package/dist/lib/image-dimensions.js +7 -0
- package/dist/lib/name-initials.d.ts +7 -0
- package/dist/lib/name-initials.js +11 -0
- package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
- package/dist/lib/rich-text/link-markdown-constants.js +458 -0
- package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
- package/dist/lib/rich-text/link-markdown-types.js +1 -0
- package/dist/lib/rich-text/link-markdown.d.ts +193 -0
- package/dist/lib/rich-text/link-markdown.js +592 -0
- package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
- package/dist/lib/rich-text/rich-markdown.js +105 -0
- package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
- package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +2 -0
- package/dist/lib/year-month-filter.d.ts +16 -0
- package/dist/lib/year-month-filter.js +46 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +177 -0
- package/dist/motion/arc-press.d.ts +6 -0
- package/dist/motion/arc-press.js +59 -0
- package/dist/motion/arc-swap.d.ts +22 -0
- package/dist/motion/arc-swap.js +49 -0
- package/dist/motion/arc-tokens.d.ts +53 -0
- package/dist/motion/arc-tokens.js +73 -0
- package/dist/motion/glide-indicator.d.ts +69 -0
- package/dist/motion/glide-indicator.js +309 -0
- package/dist/motion/glide-slot.d.ts +9 -0
- package/dist/motion/glide-slot.js +71 -0
- package/dist/motion/motion-slot.d.ts +12 -0
- package/dist/motion/motion-slot.js +376 -0
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/motion/presence.d.ts +40 -0
- package/dist/motion/presence.js +101 -0
- package/dist/motion/surface-keyframes.d.ts +24 -0
- package/dist/motion/surface-keyframes.js +141 -0
- package/dist/motion/tokens.d.ts +81 -0
- package/dist/motion/tokens.js +67 -0
- package/dist/motion/use-attached-element.d.ts +7 -0
- package/dist/motion/use-attached-element.js +22 -0
- package/dist/motion/use-morph-width.d.ts +13 -0
- package/dist/motion/use-morph-width.js +59 -0
- package/dist/next.d.ts +14 -0
- package/dist/next.js +79 -0
- package/dist/providers/astra-ui-provider.d.ts +27 -0
- package/dist/providers/astra-ui-provider.js +100 -0
- package/dist/providers/native-provider.d.ts +4 -0
- package/dist/providers/native-provider.js +45 -0
- package/dist/sonner.d.ts +7 -0
- package/dist/sonner.js +8 -0
- package/dist/styles.css +2 -0
- package/dist/tanstack.d.ts +11 -0
- package/dist/tanstack.js +50 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +1 -0
- package/dist/types/data-table.d.ts +27 -0
- package/dist/types/data-table.js +1 -0
- package/fonts.css +5 -0
- package/package.json +450 -4
- package/styles.css +4 -0
- package/theme.css +248 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Animates the original primitive node with Motion, without adding DOM wrappers. Every kind plays Arc's motion
|
|
5
|
+
* (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md) for the component it serves.
|
|
6
|
+
*/
|
|
7
|
+
import { useLayoutEffect, useRef } from "react";
|
|
8
|
+
import { Slot } from "radix-ui";
|
|
9
|
+
import { animate, usePresence, frame } from "motion/react";
|
|
10
|
+
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
11
|
+
import { MOTION_ENTERING_ATTRIBUTE } from "../constants/motion.js";
|
|
12
|
+
import { ARC_BLUR, ARC_DURATION, ARC_EASE } from "./arc-tokens.js";
|
|
13
|
+
import { SPRING_CHEVRON, SPRING_POP } from "./tokens.js";
|
|
14
|
+
import { surfaceEnter, surfaceExit, withRestingStyle } from "./surface-keyframes.js";
|
|
15
|
+
import { useAttachedElement } from "./use-attached-element.js";
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
const EASE_ENTER = [...ARC_EASE.enter];
|
|
18
|
+
const SURFACE_KINDS = [
|
|
19
|
+
"dialog",
|
|
20
|
+
"sheet",
|
|
21
|
+
"overlay"
|
|
22
|
+
];
|
|
23
|
+
/** Inline style properties Motion playback may write; they are restored after playback. */
|
|
24
|
+
const ANIMATED_PROPERTIES = [
|
|
25
|
+
"opacity",
|
|
26
|
+
"transform",
|
|
27
|
+
"filter"
|
|
28
|
+
];
|
|
29
|
+
/** Arc's theme switch grows the incoming icon from .7. */
|
|
30
|
+
const THEME_ICON_ENTER_SCALE = .7;
|
|
31
|
+
/** Arc's chosen-option check sharpens in just after its row: scale .6 and a subtle blur. */
|
|
32
|
+
const ITEM_CHECK_ENTER_SCALE = .6;
|
|
33
|
+
const ITEM_CHECK_DELAY_S = .04;
|
|
34
|
+
/** Arc's helper and error rows rise into place by a third of a line while they sharpen. */
|
|
35
|
+
const MESSAGE_RISE = "0.35em";
|
|
36
|
+
/** Reads a computed `matrix()` or `matrix3d()` transform as its 2D components. */
|
|
37
|
+
function matrixOf(transform) {
|
|
38
|
+
const values = /^matrix(3d)?\(([^)]+)\)$/.exec(transform);
|
|
39
|
+
if (!values) return {
|
|
40
|
+
a: 1,
|
|
41
|
+
b: 0
|
|
42
|
+
};
|
|
43
|
+
const parts = values[2].split(",").map(parseFloat);
|
|
44
|
+
return {
|
|
45
|
+
a: parts[0] ?? 1,
|
|
46
|
+
b: parts[1] ?? 0
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Extracts the rotation, in degrees, of a computed transform. */
|
|
50
|
+
function rotationOf(transform) {
|
|
51
|
+
const { a, b } = matrixOf(transform);
|
|
52
|
+
return Math.atan2(b, a) * 180 / Math.PI;
|
|
53
|
+
}
|
|
54
|
+
/** Composes refs through Radix Slot and delegates entry, exit and state playback to Motion. */
|
|
55
|
+
export function MotionSlot(t0) {
|
|
56
|
+
const $ = _c(20);
|
|
57
|
+
let children;
|
|
58
|
+
let kind;
|
|
59
|
+
let props;
|
|
60
|
+
let ref;
|
|
61
|
+
if ($[0] !== t0) {
|
|
62
|
+
({children, kind, ref, ...props} = t0);
|
|
63
|
+
$[0] = t0;
|
|
64
|
+
$[1] = children;
|
|
65
|
+
$[2] = kind;
|
|
66
|
+
$[3] = props;
|
|
67
|
+
$[4] = ref;
|
|
68
|
+
} else {
|
|
69
|
+
children = $[1];
|
|
70
|
+
kind = $[2];
|
|
71
|
+
props = $[3];
|
|
72
|
+
ref = $[4];
|
|
73
|
+
}
|
|
74
|
+
const [element, attach] = useAttachedElement(ref);
|
|
75
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
76
|
+
const [isPresent, safeToRemove] = usePresence();
|
|
77
|
+
const safeToRemoveRef = useRef(safeToRemove);
|
|
78
|
+
let t1;
|
|
79
|
+
if ($[5] !== safeToRemove) {
|
|
80
|
+
t1 = () => {
|
|
81
|
+
safeToRemoveRef.current = safeToRemove;
|
|
82
|
+
};
|
|
83
|
+
$[5] = safeToRemove;
|
|
84
|
+
$[6] = t1;
|
|
85
|
+
} else {
|
|
86
|
+
t1 = $[6];
|
|
87
|
+
}
|
|
88
|
+
useLayoutEffect(t1);
|
|
89
|
+
const interruptedRef = useRef(null);
|
|
90
|
+
let t2;
|
|
91
|
+
let t3;
|
|
92
|
+
if ($[7] !== element || $[8] !== isPresent || $[9] !== kind || $[10] !== reduceMotion) {
|
|
93
|
+
t2 = () => {
|
|
94
|
+
let active = true;
|
|
95
|
+
const safeToRemove_0 = () => safeToRemoveRef.current?.();
|
|
96
|
+
if (!element || !element.isConnected) {
|
|
97
|
+
if (!isPresent) {
|
|
98
|
+
queueMicrotask(() => {
|
|
99
|
+
if (active) {
|
|
100
|
+
safeToRemove_0();
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return () => {
|
|
105
|
+
active = false;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const animations = new Map();
|
|
109
|
+
const cleanups = [];
|
|
110
|
+
const original = {
|
|
111
|
+
opacity: element.style.opacity,
|
|
112
|
+
transform: element.style.transform,
|
|
113
|
+
filter: element.style.filter
|
|
114
|
+
};
|
|
115
|
+
const restore = function restore(t4) {
|
|
116
|
+
const properties = t4 === undefined ? ANIMATED_PROPERTIES : t4;
|
|
117
|
+
properties.forEach((property) => {
|
|
118
|
+
element.style[property] = original[property];
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
const cancel = function cancel(t5) {
|
|
122
|
+
const properties_0 = t5 === undefined ? ANIMATED_PROPERTIES : t5;
|
|
123
|
+
animations.forEach((driven, animation) => {
|
|
124
|
+
if (!driven.some((property_0) => properties_0.includes(property_0))) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
animation.cancel();
|
|
128
|
+
animations.delete(animation);
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
const dispose = function dispose() {
|
|
132
|
+
active = false;
|
|
133
|
+
if (animations.size) {
|
|
134
|
+
const computed = getComputedStyle(element);
|
|
135
|
+
const snapshot = {};
|
|
136
|
+
new Set([...animations.values()].flat()).forEach((property_1) => {
|
|
137
|
+
const value = computed[property_1];
|
|
138
|
+
if (value && value !== "none") {
|
|
139
|
+
snapshot[property_1] = value;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
interruptedRef.current = {
|
|
143
|
+
element,
|
|
144
|
+
values: snapshot
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
cleanups.forEach(_temp);
|
|
148
|
+
cancel();
|
|
149
|
+
restore();
|
|
150
|
+
element.removeAttribute(MOTION_ENTERING_ATTRIBUTE);
|
|
151
|
+
};
|
|
152
|
+
const interrupted = interruptedRef.current;
|
|
153
|
+
interruptedRef.current = null;
|
|
154
|
+
if (reduceMotion) {
|
|
155
|
+
if (!isPresent) {
|
|
156
|
+
queueMicrotask(() => {
|
|
157
|
+
if (active) {
|
|
158
|
+
safeToRemove_0();
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return dispose;
|
|
163
|
+
}
|
|
164
|
+
const play = function play(keyframes, transition, t6) {
|
|
165
|
+
const { remove: t7, onSettled } = t6 === undefined ? {} : t6;
|
|
166
|
+
const remove = t7 === undefined ? false : t7;
|
|
167
|
+
const properties_1 = ANIMATED_PROPERTIES.filter((property_2) => property_2 in keyframes);
|
|
168
|
+
const busy = new Set([...animations.values()].flat());
|
|
169
|
+
properties_1.forEach((property_3) => {
|
|
170
|
+
if (!busy.has(property_3)) {
|
|
171
|
+
original[property_3] = element.style[property_3];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
cancel(properties_1);
|
|
175
|
+
const frames = keyframes;
|
|
176
|
+
properties_1.forEach((property_4) => {
|
|
177
|
+
const values = frames[property_4];
|
|
178
|
+
if (Array.isArray(values) && values.length > 1) {
|
|
179
|
+
element.style[property_4] = String(values[0]);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
const animation_0 = animate(element, keyframes, transition);
|
|
183
|
+
animations.set(animation_0, properties_1);
|
|
184
|
+
animation_0.then(() => {
|
|
185
|
+
if (!animations.delete(animation_0) || !active) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (remove) {
|
|
189
|
+
safeToRemove_0();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
frame.postRender(() => {
|
|
193
|
+
if (!active) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const busy_0 = new Set([...animations.values()].flat());
|
|
197
|
+
restore(ANIMATED_PROPERTIES.filter((property_5) => !busy_0.has(property_5)));
|
|
198
|
+
onSettled?.();
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
const tween = _temp2;
|
|
203
|
+
if (SURFACE_KINDS.includes(kind)) {
|
|
204
|
+
const step = isPresent ? surfaceEnter(element, kind) : surfaceExit(element, kind);
|
|
205
|
+
const computed_0 = getComputedStyle(element);
|
|
206
|
+
const keyframes_0 = withRestingStyle(step.keyframes, {
|
|
207
|
+
transform: computed_0.transform,
|
|
208
|
+
opacity: Number.parseFloat(computed_0.opacity)
|
|
209
|
+
});
|
|
210
|
+
if (interrupted?.element === element) {
|
|
211
|
+
Object.entries(interrupted.values).forEach((t8) => {
|
|
212
|
+
const [property_6, value_0] = t8;
|
|
213
|
+
const frames_0 = keyframes_0[property_6];
|
|
214
|
+
if (!Array.isArray(frames_0) || !value_0) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const start = property_6 === "opacity" ? Number.parseFloat(value_0) : value_0;
|
|
218
|
+
keyframes_0[property_6] = [start, ...frames_0.slice(1)];
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
if (isPresent) {
|
|
222
|
+
element.setAttribute(MOTION_ENTERING_ATTRIBUTE, "");
|
|
223
|
+
}
|
|
224
|
+
play(keyframes_0, step.transition, {
|
|
225
|
+
remove: !isPresent,
|
|
226
|
+
onSettled: () => element.removeAttribute(MOTION_ENTERING_ATTRIBUTE)
|
|
227
|
+
});
|
|
228
|
+
return dispose;
|
|
229
|
+
}
|
|
230
|
+
if (!isPresent) {
|
|
231
|
+
queueMicrotask(() => {
|
|
232
|
+
if (active) {
|
|
233
|
+
safeToRemove_0();
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
return dispose;
|
|
237
|
+
}
|
|
238
|
+
if (kind === "icon-swap") {
|
|
239
|
+
play({
|
|
240
|
+
opacity: [0, 1],
|
|
241
|
+
transform: [`scale(${THEME_ICON_ENTER_SCALE})`, "scale(1)"],
|
|
242
|
+
filter: [`blur(${ARC_BLUR.subtle}px)`, "blur(0px)"]
|
|
243
|
+
}, {
|
|
244
|
+
...SPRING_POP,
|
|
245
|
+
opacity: tween(ARC_DURATION.fast),
|
|
246
|
+
filter: tween(ARC_DURATION.fast)
|
|
247
|
+
});
|
|
248
|
+
} else {
|
|
249
|
+
if (kind === "item-check") {
|
|
250
|
+
play({
|
|
251
|
+
opacity: [0, 1],
|
|
252
|
+
transform: [`scale(${ITEM_CHECK_ENTER_SCALE})`, "scale(1)"],
|
|
253
|
+
filter: [`blur(${ARC_BLUR.subtle}px)`, "blur(0px)"]
|
|
254
|
+
}, {
|
|
255
|
+
...tween(ARC_DURATION.standard),
|
|
256
|
+
delay: ITEM_CHECK_DELAY_S
|
|
257
|
+
});
|
|
258
|
+
} else {
|
|
259
|
+
if (kind === "message") {
|
|
260
|
+
play({
|
|
261
|
+
opacity: [0, 1],
|
|
262
|
+
transform: [`translateY(${MESSAGE_RISE})`, "translateY(0px)"],
|
|
263
|
+
filter: [`blur(${ARC_BLUR.soft}px)`, "blur(0px)"]
|
|
264
|
+
}, tween(ARC_DURATION.standard));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (kind === "rotate") {
|
|
269
|
+
const restingAngle = () => parseFloat(getComputedStyle(element).rotate) || 0;
|
|
270
|
+
let previousAngle = restingAngle();
|
|
271
|
+
const turn = () => {
|
|
272
|
+
const inFlight = rotationOf(getComputedStyle(element).transform);
|
|
273
|
+
cancel(["transform"]);
|
|
274
|
+
restore(["transform"]);
|
|
275
|
+
const nextAngle = restingAngle();
|
|
276
|
+
const delta = previousAngle + inFlight - nextAngle;
|
|
277
|
+
previousAngle = nextAngle;
|
|
278
|
+
if (Math.abs(delta) >= 1) {
|
|
279
|
+
play({ transform: [`rotate(${delta}deg)`, "rotate(0deg)"] }, SPRING_CHEVRON);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const observer = new MutationObserver(turn);
|
|
283
|
+
observer.observe(element, {
|
|
284
|
+
attributes: true,
|
|
285
|
+
attributeFilter: ["class"]
|
|
286
|
+
});
|
|
287
|
+
if (element.parentElement) {
|
|
288
|
+
observer.observe(element.parentElement, {
|
|
289
|
+
attributes: true,
|
|
290
|
+
attributeFilter: [
|
|
291
|
+
"aria-expanded",
|
|
292
|
+
"data-state",
|
|
293
|
+
"class"
|
|
294
|
+
]
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
cleanups.push(() => observer.disconnect());
|
|
298
|
+
}
|
|
299
|
+
if (kind === "reveal") {
|
|
300
|
+
const isLoading = () => element.hasAttribute("data-loading");
|
|
301
|
+
let wasLoading = isLoading();
|
|
302
|
+
const observer_0 = new MutationObserver(() => {
|
|
303
|
+
const loading = isLoading();
|
|
304
|
+
const loaded = wasLoading && !loading && !element.hasAttribute("data-error");
|
|
305
|
+
wasLoading = loading;
|
|
306
|
+
if (!loaded) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
play({
|
|
310
|
+
opacity: [0, 1],
|
|
311
|
+
filter: [`blur(${ARC_BLUR.soft}px)`, "blur(0px)"]
|
|
312
|
+
}, tween(ARC_DURATION.standard));
|
|
313
|
+
});
|
|
314
|
+
observer_0.observe(element, {
|
|
315
|
+
attributes: true,
|
|
316
|
+
attributeFilter: ["data-loading", "data-error"]
|
|
317
|
+
});
|
|
318
|
+
cleanups.push(() => observer_0.disconnect());
|
|
319
|
+
}
|
|
320
|
+
return dispose;
|
|
321
|
+
};
|
|
322
|
+
t3 = [
|
|
323
|
+
element,
|
|
324
|
+
kind,
|
|
325
|
+
reduceMotion,
|
|
326
|
+
isPresent
|
|
327
|
+
];
|
|
328
|
+
$[7] = element;
|
|
329
|
+
$[8] = isPresent;
|
|
330
|
+
$[9] = kind;
|
|
331
|
+
$[10] = reduceMotion;
|
|
332
|
+
$[11] = t2;
|
|
333
|
+
$[12] = t3;
|
|
334
|
+
} else {
|
|
335
|
+
t2 = $[11];
|
|
336
|
+
t3 = $[12];
|
|
337
|
+
}
|
|
338
|
+
useLayoutEffect(t2, t3);
|
|
339
|
+
let t4;
|
|
340
|
+
if ($[13] !== isPresent) {
|
|
341
|
+
t4 = isPresent ? {} : {
|
|
342
|
+
inert: true,
|
|
343
|
+
"aria-hidden": true
|
|
344
|
+
};
|
|
345
|
+
$[13] = isPresent;
|
|
346
|
+
$[14] = t4;
|
|
347
|
+
} else {
|
|
348
|
+
t4 = $[14];
|
|
349
|
+
}
|
|
350
|
+
let t5;
|
|
351
|
+
if ($[15] !== attach || $[16] !== children || $[17] !== props || $[18] !== t4) {
|
|
352
|
+
t5 = /* @__PURE__ */ _jsx(Slot.Root, {
|
|
353
|
+
...props,
|
|
354
|
+
ref: attach,
|
|
355
|
+
...t4,
|
|
356
|
+
children
|
|
357
|
+
});
|
|
358
|
+
$[15] = attach;
|
|
359
|
+
$[16] = children;
|
|
360
|
+
$[17] = props;
|
|
361
|
+
$[18] = t4;
|
|
362
|
+
$[19] = t5;
|
|
363
|
+
} else {
|
|
364
|
+
t5 = $[19];
|
|
365
|
+
}
|
|
366
|
+
return t5;
|
|
367
|
+
}
|
|
368
|
+
function _temp2(duration) {
|
|
369
|
+
return {
|
|
370
|
+
duration,
|
|
371
|
+
ease: EASE_ENTER
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function _temp(cleanup) {
|
|
375
|
+
return cleanup();
|
|
376
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** A subscribable warm flag shared by every instance of one layer family. */
|
|
2
|
+
export interface OverlayWarmth {
|
|
3
|
+
subscribe: (listener: () => void) => () => void;
|
|
4
|
+
/** Whether a layer of the family is open, or closed less than the skip window ago. */
|
|
5
|
+
isWarm: () => boolean;
|
|
6
|
+
/** Server snapshot: nothing is open while rendering on the server. */
|
|
7
|
+
isWarmOnServer: () => boolean;
|
|
8
|
+
/** Marks one more layer as open and returns the call that marks it closed again. */
|
|
9
|
+
open: () => () => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates the warm flag of one layer family.
|
|
13
|
+
* @param skipWindowMs - Milliseconds the page stays warm after the last layer closes.
|
|
14
|
+
* @returns The store, meant for `useSyncExternalStore`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createOverlayWarmth(skipWindowMs: number): OverlayWarmth;
|
|
17
|
+
/**
|
|
18
|
+
* Remembers whether the page was already warm when a layer opened, so its entrance picks the instant path. It is
|
|
19
|
+
* captured while rendering the open change, before the layer marks the page warm itself.
|
|
20
|
+
* @param open - Whether the layer is open.
|
|
21
|
+
* @param isWarm - The family's current warm flag, read through `useSyncExternalStore`.
|
|
22
|
+
* @returns Whether the current (or last) opening happened while warm.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useOpenedWhileWarm(open: boolean, isWarm: boolean): boolean;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arc's skip window for hover-driven layers (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): while any
|
|
3
|
+
* layer of a family is open, and briefly after the last one closes, the page is warm and the next layer opens
|
|
4
|
+
* without waiting and only fades. Each family (tooltips, hover cards) keeps its own store.
|
|
5
|
+
*/
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
/**
|
|
8
|
+
* Creates the warm flag of one layer family.
|
|
9
|
+
* @param skipWindowMs - Milliseconds the page stays warm after the last layer closes.
|
|
10
|
+
* @returns The store, meant for `useSyncExternalStore`.
|
|
11
|
+
*/
|
|
12
|
+
export function createOverlayWarmth(skipWindowMs) {
|
|
13
|
+
let warm = false;
|
|
14
|
+
let openCount = 0;
|
|
15
|
+
/** When the last layer closed, so the window also expires when its timer never runs (a frozen test clock). */
|
|
16
|
+
let closedAt = 0;
|
|
17
|
+
let coolTimer;
|
|
18
|
+
const listeners = new Set();
|
|
19
|
+
const notify = () => listeners.forEach((listener) => listener());
|
|
20
|
+
return {
|
|
21
|
+
subscribe(listener) {
|
|
22
|
+
listeners.add(listener);
|
|
23
|
+
return () => {
|
|
24
|
+
listeners.delete(listener);
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
isWarm() {
|
|
28
|
+
if (warm && !openCount && Date.now() - closedAt >= skipWindowMs) warm = false;
|
|
29
|
+
return warm;
|
|
30
|
+
},
|
|
31
|
+
isWarmOnServer: () => false,
|
|
32
|
+
open() {
|
|
33
|
+
openCount += 1;
|
|
34
|
+
clearTimeout(coolTimer);
|
|
35
|
+
if (!warm) {
|
|
36
|
+
warm = true;
|
|
37
|
+
notify();
|
|
38
|
+
}
|
|
39
|
+
let closed = false;
|
|
40
|
+
return () => {
|
|
41
|
+
if (closed) return;
|
|
42
|
+
closed = true;
|
|
43
|
+
openCount = Math.max(0, openCount - 1);
|
|
44
|
+
if (openCount) return;
|
|
45
|
+
clearTimeout(coolTimer);
|
|
46
|
+
closedAt = Date.now();
|
|
47
|
+
coolTimer = setTimeout(() => {
|
|
48
|
+
warm = false;
|
|
49
|
+
notify();
|
|
50
|
+
}, skipWindowMs);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Remembers whether the page was already warm when a layer opened, so its entrance picks the instant path. It is
|
|
57
|
+
* captured while rendering the open change, before the layer marks the page warm itself.
|
|
58
|
+
* @param open - Whether the layer is open.
|
|
59
|
+
* @param isWarm - The family's current warm flag, read through `useSyncExternalStore`.
|
|
60
|
+
* @returns Whether the current (or last) opening happened while warm.
|
|
61
|
+
*/
|
|
62
|
+
export function useOpenedWhileWarm(open, isWarm) {
|
|
63
|
+
const [wasOpen, setWasOpen] = useState(open);
|
|
64
|
+
const [openedWhileWarm, setOpenedWhileWarm] = useState(open && isWarm);
|
|
65
|
+
if (open !== wasOpen) {
|
|
66
|
+
setWasOpen(open);
|
|
67
|
+
if (open) setOpenedWhileWarm(isWarm);
|
|
68
|
+
}
|
|
69
|
+
return openedWhileWarm;
|
|
70
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Shares visibility with portaled content while leaving interaction ownership with Radix. */
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
/** Separate contexts preserve correctly nested combinations such as menus inside tooltips. */
|
|
4
|
+
declare const OPEN_CONTEXTS: {
|
|
5
|
+
dialog: import("react").Context<boolean>;
|
|
6
|
+
"alert-dialog": import("react").Context<boolean>;
|
|
7
|
+
sheet: import("react").Context<boolean>;
|
|
8
|
+
"dropdown-menu": import("react").Context<boolean>;
|
|
9
|
+
popover: import("react").Context<boolean>;
|
|
10
|
+
"hover-card": import("react").Context<boolean>;
|
|
11
|
+
tooltip: import("react").Context<boolean>;
|
|
12
|
+
select: import("react").Context<boolean>;
|
|
13
|
+
};
|
|
14
|
+
type MotionScope = keyof typeof OPEN_CONTEXTS;
|
|
15
|
+
/** Provides only the owning primitive's visibility, independently of other nested primitives. */
|
|
16
|
+
export declare function MotionOpenProvider({ scope, open, children, }: {
|
|
17
|
+
scope: MotionScope;
|
|
18
|
+
open: boolean;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* Reads the owning primitive's visibility, for content that Radix keeps mounted while closed and so cannot be
|
|
23
|
+
* retained by `MotionPresence`.
|
|
24
|
+
* @param scope - The primitive whose visibility is read.
|
|
25
|
+
* @returns Whether that primitive is open.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useMotionOpen(scope: MotionScope): boolean;
|
|
28
|
+
/** Preserves the primitive's controlled/uncontrolled open contract. */
|
|
29
|
+
export declare function useMotionOpenState({ open, defaultOpen, onOpenChange, }: {
|
|
30
|
+
open?: boolean;
|
|
31
|
+
defaultOpen?: boolean;
|
|
32
|
+
onOpenChange?: (open: boolean) => void;
|
|
33
|
+
}): readonly [boolean, (open: boolean) => void];
|
|
34
|
+
/** Retains closing content until its Motion exit finishes; explicit forceMount remains caller-owned. */
|
|
35
|
+
export declare function MotionPresence({ scope, children, forceMount, }: {
|
|
36
|
+
scope: MotionScope;
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
forceMount?: boolean;
|
|
39
|
+
}): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/** Shares visibility with portaled content while leaving interaction ownership with Radix. */
|
|
4
|
+
import { createContext, useContext, useState } from "react";
|
|
5
|
+
import { AnimatePresence } from "motion/react";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
/** Separate contexts preserve correctly nested combinations such as menus inside tooltips. */
|
|
8
|
+
const OPEN_CONTEXTS = {
|
|
9
|
+
dialog: createContext(true),
|
|
10
|
+
"alert-dialog": createContext(true),
|
|
11
|
+
sheet: createContext(true),
|
|
12
|
+
"dropdown-menu": createContext(true),
|
|
13
|
+
popover: createContext(true),
|
|
14
|
+
"hover-card": createContext(true),
|
|
15
|
+
tooltip: createContext(true),
|
|
16
|
+
select: createContext(true)
|
|
17
|
+
};
|
|
18
|
+
/** Provides only the owning primitive's visibility, independently of other nested primitives. */
|
|
19
|
+
export function MotionOpenProvider(t0) {
|
|
20
|
+
const $ = _c(4);
|
|
21
|
+
const { scope, open, children } = t0;
|
|
22
|
+
const Context = OPEN_CONTEXTS[scope];
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[0] !== Context.Provider || $[1] !== children || $[2] !== open) {
|
|
25
|
+
t1 = /* @__PURE__ */ _jsx(Context.Provider, {
|
|
26
|
+
value: open,
|
|
27
|
+
children
|
|
28
|
+
});
|
|
29
|
+
$[0] = Context.Provider;
|
|
30
|
+
$[1] = children;
|
|
31
|
+
$[2] = open;
|
|
32
|
+
$[3] = t1;
|
|
33
|
+
} else {
|
|
34
|
+
t1 = $[3];
|
|
35
|
+
}
|
|
36
|
+
return t1;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Reads the owning primitive's visibility, for content that Radix keeps mounted while closed and so cannot be
|
|
40
|
+
* retained by `MotionPresence`.
|
|
41
|
+
* @param scope - The primitive whose visibility is read.
|
|
42
|
+
* @returns Whether that primitive is open.
|
|
43
|
+
*/
|
|
44
|
+
export function useMotionOpen(scope) {
|
|
45
|
+
return useContext(OPEN_CONTEXTS[scope]);
|
|
46
|
+
}
|
|
47
|
+
/** Preserves the primitive's controlled/uncontrolled open contract. */
|
|
48
|
+
export function useMotionOpenState(t0) {
|
|
49
|
+
const $ = _c(6);
|
|
50
|
+
const { open, defaultOpen: t1, onOpenChange } = t0;
|
|
51
|
+
const defaultOpen = t1 === undefined ? false : t1;
|
|
52
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
53
|
+
let t2;
|
|
54
|
+
if ($[0] !== onOpenChange || $[1] !== open) {
|
|
55
|
+
t2 = (nextOpen) => {
|
|
56
|
+
if (open === undefined) {
|
|
57
|
+
setInternalOpen(nextOpen);
|
|
58
|
+
}
|
|
59
|
+
onOpenChange?.(nextOpen);
|
|
60
|
+
};
|
|
61
|
+
$[0] = onOpenChange;
|
|
62
|
+
$[1] = open;
|
|
63
|
+
$[2] = t2;
|
|
64
|
+
} else {
|
|
65
|
+
t2 = $[2];
|
|
66
|
+
}
|
|
67
|
+
const setOpen = t2;
|
|
68
|
+
const t3 = open ?? internalOpen;
|
|
69
|
+
let t4;
|
|
70
|
+
if ($[3] !== setOpen || $[4] !== t3) {
|
|
71
|
+
t4 = [t3, setOpen];
|
|
72
|
+
$[3] = setOpen;
|
|
73
|
+
$[4] = t3;
|
|
74
|
+
$[5] = t4;
|
|
75
|
+
} else {
|
|
76
|
+
t4 = $[5];
|
|
77
|
+
}
|
|
78
|
+
return t4;
|
|
79
|
+
}
|
|
80
|
+
/** Retains closing content until its Motion exit finishes; explicit forceMount remains caller-owned. */
|
|
81
|
+
export function MotionPresence(t0) {
|
|
82
|
+
const $ = _c(2);
|
|
83
|
+
const { scope, children, forceMount } = t0;
|
|
84
|
+
const open = useContext(OPEN_CONTEXTS[scope]);
|
|
85
|
+
if (forceMount) {
|
|
86
|
+
return children;
|
|
87
|
+
}
|
|
88
|
+
const t1 = open ? children : null;
|
|
89
|
+
let t2;
|
|
90
|
+
if ($[0] !== t1) {
|
|
91
|
+
t2 = /* @__PURE__ */ _jsx(AnimatePresence, {
|
|
92
|
+
initial: false,
|
|
93
|
+
children: t1
|
|
94
|
+
});
|
|
95
|
+
$[0] = t1;
|
|
96
|
+
$[1] = t2;
|
|
97
|
+
} else {
|
|
98
|
+
t2 = $[1];
|
|
99
|
+
}
|
|
100
|
+
return t2;
|
|
101
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Resolves entry and exit playback of Arc's modal surfaces: dialogs, sheets and their scrims. */
|
|
2
|
+
import type { AnimationOptions, DOMKeyframesDefinition } from "motion/react";
|
|
3
|
+
/** Surface kinds whose presence is animated on mount and before removal. */
|
|
4
|
+
export type SurfaceKind = "dialog" | "sheet" | "overlay";
|
|
5
|
+
/** Keyframes plus the transition that plays them. */
|
|
6
|
+
export interface MotionStep {
|
|
7
|
+
keyframes: DOMKeyframesDefinition;
|
|
8
|
+
transition: AnimationOptions;
|
|
9
|
+
}
|
|
10
|
+
/** Entrance playback for each surface kind, on Arc's motion presets. */
|
|
11
|
+
export declare function surfaceEnter(element: Element, kind: SurfaceKind): MotionStep;
|
|
12
|
+
/** Transform and opacity a surface rests at, which its caller may set through a class or style. */
|
|
13
|
+
export interface RestingStyle {
|
|
14
|
+
transform: string;
|
|
15
|
+
opacity: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Composes surface playback with the surface's resting transform and opacity, so a caller-owned
|
|
19
|
+
* tilt, offset or translucency holds through the whole entrance and exit instead of being
|
|
20
|
+
* replaced by identity and full opacity, then snapping back once playback restores it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function withRestingStyle(keyframes: DOMKeyframesDefinition, resting: RestingStyle): DOMKeyframesDefinition;
|
|
23
|
+
/** Exit playback: brief and eased so dismissal never blocks the next interaction. */
|
|
24
|
+
export declare function surfaceExit(element: Element, kind: SurfaceKind): MotionStep;
|