@mieweb/ui 0.9.0 → 0.10.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.
Files changed (121) hide show
  1. package/MIGRATION.md +112 -0
  2. package/dist/{Animated-Cs-naa2g.d.cts → Animated-XmH6k8pZ.d.cts} +16 -3
  3. package/dist/{Animated-Cs-naa2g.d.ts → Animated-XmH6k8pZ.d.ts} +16 -3
  4. package/dist/{chunk-XUVEF2RQ.js → chunk-24SEAAOH.js} +2 -2
  5. package/dist/{chunk-XUVEF2RQ.js.map → chunk-24SEAAOH.js.map} +1 -1
  6. package/dist/{chunk-FUFBRKOG.cjs → chunk-2WBPNXO2.cjs} +21 -21
  7. package/dist/{chunk-FUFBRKOG.cjs.map → chunk-2WBPNXO2.cjs.map} +1 -1
  8. package/dist/{chunk-IUDY6S7I.cjs → chunk-37UZHCLM.cjs} +35 -14
  9. package/dist/chunk-37UZHCLM.cjs.map +1 -0
  10. package/dist/{chunk-L52N6BEN.cjs → chunk-AUOTJQGO.cjs} +7 -7
  11. package/dist/{chunk-L52N6BEN.cjs.map → chunk-AUOTJQGO.cjs.map} +1 -1
  12. package/dist/{chunk-6XDPJWSC.cjs → chunk-E7G22IQM.cjs} +32 -28
  13. package/dist/chunk-E7G22IQM.cjs.map +1 -0
  14. package/dist/chunk-IIFQ6BSJ.js +1888 -0
  15. package/dist/chunk-IIFQ6BSJ.js.map +1 -0
  16. package/dist/{chunk-ONNY7UO4.js → chunk-JDJQTKTX.js} +3 -3
  17. package/dist/{chunk-ONNY7UO4.js.map → chunk-JDJQTKTX.js.map} +1 -1
  18. package/dist/{chunk-BJKAVWED.js → chunk-MBWF36DJ.js} +35 -14
  19. package/dist/chunk-MBWF36DJ.js.map +1 -0
  20. package/dist/chunk-NV2CWBI2.cjs +290 -0
  21. package/dist/chunk-NV2CWBI2.cjs.map +1 -0
  22. package/dist/{chunk-FQBTGS3E.cjs → chunk-OFUKTVBN.cjs} +363 -285
  23. package/dist/chunk-OFUKTVBN.cjs.map +1 -0
  24. package/dist/{chunk-7KN6J7XV.cjs → chunk-OMAACCFW.cjs} +7 -7
  25. package/dist/{chunk-7KN6J7XV.cjs.map → chunk-OMAACCFW.cjs.map} +1 -1
  26. package/dist/chunk-OYQ7GYAA.cjs +1921 -0
  27. package/dist/chunk-OYQ7GYAA.cjs.map +1 -0
  28. package/dist/{chunk-YJP6DUFO.cjs → chunk-PKD3JLS2.cjs} +6 -6
  29. package/dist/{chunk-YJP6DUFO.cjs.map → chunk-PKD3JLS2.cjs.map} +1 -1
  30. package/dist/{chunk-CXDMZT45.cjs → chunk-PY7XAG4D.cjs} +27 -4
  31. package/dist/chunk-PY7XAG4D.cjs.map +1 -0
  32. package/dist/{chunk-5H7SAEQO.js → chunk-QKFJDQEK.js} +3 -3
  33. package/dist/{chunk-5H7SAEQO.js.map → chunk-QKFJDQEK.js.map} +1 -1
  34. package/dist/{chunk-XJTFZLWH.cjs → chunk-QO6PRHDX.cjs} +2 -2
  35. package/dist/{chunk-XJTFZLWH.cjs.map → chunk-QO6PRHDX.cjs.map} +1 -1
  36. package/dist/{chunk-OHDIJOGG.js → chunk-RD3JDFYJ.js} +3 -3
  37. package/dist/{chunk-OHDIJOGG.js.map → chunk-RD3JDFYJ.js.map} +1 -1
  38. package/dist/{chunk-4SM3I7WE.cjs → chunk-RXPEZXAB.cjs} +67 -38
  39. package/dist/chunk-RXPEZXAB.cjs.map +1 -0
  40. package/dist/{chunk-VTR2KGLY.cjs → chunk-S3BCHPXT.cjs} +9 -9
  41. package/dist/{chunk-VTR2KGLY.cjs.map → chunk-S3BCHPXT.cjs.map} +1 -1
  42. package/dist/{chunk-KU3XRHWA.js → chunk-TZX76ZNZ.js} +67 -38
  43. package/dist/chunk-TZX76ZNZ.js.map +1 -0
  44. package/dist/{chunk-MXQ7J4BB.js → chunk-VSVGMMNO.js} +361 -284
  45. package/dist/chunk-VSVGMMNO.js.map +1 -0
  46. package/dist/{chunk-Q7G56ZIO.js → chunk-WUBMDOTG.js} +3 -3
  47. package/dist/{chunk-Q7G56ZIO.js.map → chunk-WUBMDOTG.js.map} +1 -1
  48. package/dist/{chunk-DGRXAIWK.js → chunk-X5YM3KXY.js} +27 -4
  49. package/dist/chunk-X5YM3KXY.js.map +1 -0
  50. package/dist/chunk-XCP454Q6.js +263 -0
  51. package/dist/chunk-XCP454Q6.js.map +1 -0
  52. package/dist/{chunk-I3DQXUSC.js → chunk-Y6DFMDMH.js} +3 -3
  53. package/dist/{chunk-I3DQXUSC.js.map → chunk-Y6DFMDMH.js.map} +1 -1
  54. package/dist/{chunk-ODYQYLO2.js → chunk-YSEMAI4I.js} +8 -4
  55. package/dist/chunk-YSEMAI4I.js.map +1 -0
  56. package/dist/components/AlertDialog/index.cjs +4 -4
  57. package/dist/components/AlertDialog/index.js +3 -3
  58. package/dist/components/Collapsible/index.cjs +6 -4
  59. package/dist/components/Collapsible/index.js +3 -1
  60. package/dist/components/Dropdown/index.cjs +9 -8
  61. package/dist/components/Dropdown/index.js +2 -1
  62. package/dist/components/KeyboardShortcutsOverlay/index.cjs +5 -5
  63. package/dist/components/KeyboardShortcutsOverlay/index.js +3 -3
  64. package/dist/components/MediaEditor/index.cjs +8 -8
  65. package/dist/components/MediaEditor/index.js +3 -3
  66. package/dist/components/Modal/index.cjs +10 -10
  67. package/dist/components/Modal/index.js +2 -2
  68. package/dist/components/RichTextEditor/index.cjs +6 -5
  69. package/dist/components/RichTextEditor/index.js +3 -2
  70. package/dist/components/SuperChat/index.cjs +40 -17
  71. package/dist/components/SuperChat/index.cjs.map +1 -1
  72. package/dist/components/SuperChat/index.d.cts +20 -7
  73. package/dist/components/SuperChat/index.d.ts +20 -7
  74. package/dist/components/SuperChat/index.js +35 -12
  75. package/dist/components/SuperChat/index.js.map +1 -1
  76. package/dist/components/SuperChat/plugins/index.cjs +10 -3
  77. package/dist/components/SuperChat/plugins/index.cjs.map +1 -1
  78. package/dist/components/SuperChat/plugins/index.d.cts +3 -3
  79. package/dist/components/SuperChat/plugins/index.d.ts +3 -3
  80. package/dist/components/SuperChat/plugins/index.js +9 -2
  81. package/dist/components/SuperChat/plugins/index.js.map +1 -1
  82. package/dist/esheet.cjs +6 -6
  83. package/dist/esheet.js +3 -3
  84. package/dist/hooks/index.cjs +13 -13
  85. package/dist/hooks/index.js +1 -1
  86. package/dist/index.cjs +720 -1671
  87. package/dist/index.cjs.map +1 -1
  88. package/dist/index.d.cts +347 -347
  89. package/dist/index.d.ts +347 -347
  90. package/dist/index.js +459 -1405
  91. package/dist/index.js.map +1 -1
  92. package/dist/motion.cjs +7 -7
  93. package/dist/motion.d.cts +1 -1
  94. package/dist/motion.d.ts +1 -1
  95. package/dist/motion.js +2 -2
  96. package/dist/styles.css +1 -1
  97. package/dist/tailwind-preset.cjs +4 -4
  98. package/dist/tailwind-preset.js +1 -1
  99. package/dist/{types-DZDroUW8.d.cts → types-B97JNRNQ.d.cts} +1 -1
  100. package/dist/{types-B2RLmdVd.d.ts → types-CnPEwzlp.d.cts} +6 -2
  101. package/dist/{types-B2RLmdVd.d.cts → types-CnPEwzlp.d.ts} +6 -2
  102. package/dist/{types-9vK_YdEb.d.ts → types-gZXrfLj6.d.ts} +1 -1
  103. package/package.json +2 -1
  104. package/dist/chunk-4SM3I7WE.cjs.map +0 -1
  105. package/dist/chunk-5BVFVXHN.cjs +0 -1244
  106. package/dist/chunk-5BVFVXHN.cjs.map +0 -1
  107. package/dist/chunk-6XDPJWSC.cjs.map +0 -1
  108. package/dist/chunk-BJKAVWED.js.map +0 -1
  109. package/dist/chunk-BN75TLUN.cjs +0 -163
  110. package/dist/chunk-BN75TLUN.cjs.map +0 -1
  111. package/dist/chunk-CXDMZT45.cjs.map +0 -1
  112. package/dist/chunk-DGRXAIWK.js.map +0 -1
  113. package/dist/chunk-FQBTGS3E.cjs.map +0 -1
  114. package/dist/chunk-IUDY6S7I.cjs.map +0 -1
  115. package/dist/chunk-KU3XRHWA.js.map +0 -1
  116. package/dist/chunk-MXQ7J4BB.js.map +0 -1
  117. package/dist/chunk-O6GJ4IYS.js +0 -1210
  118. package/dist/chunk-O6GJ4IYS.js.map +0 -1
  119. package/dist/chunk-ODYQYLO2.js.map +0 -1
  120. package/dist/chunk-WYMO3IIK.js +0 -136
  121. package/dist/chunk-WYMO3IIK.js.map +0 -1
@@ -1,4 +1,6 @@
1
+ import { AnimatedPresence, Animated } from './chunk-XCP454Q6.js';
1
2
  import { cn } from './chunk-TQONQSJO.js';
3
+ import { usePrefersReducedMotion } from './chunk-HB7C7NB5.js';
2
4
  import * as React from 'react';
3
5
  import { jsx } from 'react/jsx-runtime';
4
6
 
@@ -82,25 +84,44 @@ var CollapsibleTrigger = React.forwardRef(({ className, onClick, children, ...pr
82
84
  CollapsibleTrigger.displayName = "CollapsibleTrigger";
83
85
  var CollapsibleContent = React.forwardRef(({ className, forceMount, children, ...props }, ref) => {
84
86
  const { open, contentId, triggerId } = useCollapsibleContext("CollapsibleContent");
85
- if (!open && !forceMount) return null;
86
- return /* @__PURE__ */ jsx(
87
- "div",
87
+ const prefersReducedMotion = usePrefersReducedMotion();
88
+ const sharedProps = {
89
+ id: contentId,
90
+ role: "region",
91
+ "aria-labelledby": triggerId,
92
+ "data-slot": "collapsible-content",
93
+ "data-state": open ? "open" : "closed"
94
+ };
95
+ if (forceMount) {
96
+ return /* @__PURE__ */ jsx(
97
+ "div",
98
+ {
99
+ ref,
100
+ ...sharedProps,
101
+ hidden: !open,
102
+ className: cn(className),
103
+ ...props,
104
+ children
105
+ }
106
+ );
107
+ }
108
+ return /* @__PURE__ */ jsx(AnimatedPresence, { initial: false, children: open && /* @__PURE__ */ jsx(
109
+ Animated,
88
110
  {
89
111
  ref,
90
- id: contentId,
91
- role: "region",
92
- "aria-labelledby": triggerId,
93
- "data-slot": "collapsible-content",
94
- "data-state": open ? "open" : "closed",
95
- hidden: !open,
96
- className: cn(className),
112
+ preset: "collapse",
113
+ mode: "presence",
114
+ enabled: !prefersReducedMotion,
115
+ ...sharedProps,
116
+ className: cn("overflow-hidden", className),
97
117
  ...props,
98
118
  children
99
- }
100
- );
119
+ },
120
+ "collapsible-content"
121
+ ) });
101
122
  });
102
123
  CollapsibleContent.displayName = "CollapsibleContent";
103
124
 
104
125
  export { Collapsible, CollapsibleContent, CollapsibleTrigger };
105
- //# sourceMappingURL=chunk-BJKAVWED.js.map
106
- //# sourceMappingURL=chunk-BJKAVWED.js.map
126
+ //# sourceMappingURL=chunk-MBWF36DJ.js.map
127
+ //# sourceMappingURL=chunk-MBWF36DJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Collapsible/Collapsible.tsx"],"names":[],"mappings":";;;;;;AAaA,IAAM,kBAAA,GAA2B,KAAA,CAAA,aAAA;AAAA,EAC/B;AACF,CAAA;AAEA,SAAS,sBAAsB,SAAA,EAA4C;AACzE,EAAA,MAAM,GAAA,GAAY,iBAAW,kBAAkB,CAAA;AAC/C,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,SAAS,CAAA,oCAAA,CAAsC,CAAA;AAAA,EACpE;AACA,EAAA,OAAO,GAAA;AACT;AAwBA,IAAM,WAAA,GAAoB,KAAA,CAAA,UAAA;AAAA,EACxB,CACE;AAAA,IACE,SAAA;AAAA,IACA,IAAA,EAAM,cAAA;AAAA,IACN,WAAA,GAAc,KAAA;AAAA,IACd,YAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,GAAG;AAAA,KAEL,GAAA,KACG;AACH,IAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAU,eAAS,WAAW,CAAA;AAC1E,IAAA,MAAM,cAAoB,KAAA,CAAA,KAAA,EAAM;AAEhC,IAAA,MAAM,eAAe,cAAA,KAAmB,MAAA;AACxC,IAAA,MAAM,IAAA,GAAO,eAAe,cAAA,GAAiB,gBAAA;AAE7C,IAAA,MAAM,MAAA,GAAe,kBAAY,MAAM;AACrC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AA,CAAC,gBAAA,EAAA,EAAiB,OAAA,EAAS,KAAA,EACxB,QAAA,EAAA,IAAA,oBACC,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MAEC,GAAA;AAAA,MACA,MAAA,EAAO,UAAA;AAAA,MACP,IAAA,EAAK,UAAA;AAAA,MAIL,SAAS,CAAC,oBAAA;AAAA,MACT,GAAG,WAAA;AAAA,MAGJ,SAAA,EAAW,EAAA,CAAG,iBAAA,EAAmB,SAAS,CAAA;AAAA,MACzC,GAAG,KAAA;AAAA,MAEH;AAAA,KAAA;AAAA,IAdG;AAAA,GAeN,EAEJ,CAAA;AAEJ,CAAC;AAED,kBAAA,CAAmB,WAAA,GAAc,oBAAA","file":"chunk-MBWF36DJ.js","sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Animated, AnimatedPresence } from '../../motion';\nimport { usePrefersReducedMotion } from '../../hooks/usePrefersReducedMotion';\n\ninterface CollapsibleContextValue {\n open: boolean;\n toggle: () => void;\n disabled?: boolean;\n contentId: string;\n triggerId: string;\n}\n\nconst CollapsibleContext = React.createContext<CollapsibleContextValue | null>(\n null\n);\n\nfunction useCollapsibleContext(component: string): CollapsibleContextValue {\n const ctx = React.useContext(CollapsibleContext);\n if (!ctx) {\n throw new Error(`${component} must be used within a <Collapsible>`);\n }\n return ctx;\n}\n\nexport interface CollapsibleProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Controlled open state */\n open?: boolean;\n /** Default open state (uncontrolled) */\n defaultOpen?: boolean;\n /** Callback fired when the open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Disables toggling */\n disabled?: boolean;\n}\n\n/**\n * An interactive component that expands and collapses its content.\n *\n * @example\n * ```tsx\n * <Collapsible>\n * <CollapsibleTrigger>Toggle</CollapsibleTrigger>\n * <CollapsibleContent>Hidden content</CollapsibleContent>\n * </Collapsible>\n * ```\n */\nconst Collapsible = React.forwardRef<HTMLDivElement, CollapsibleProps>(\n (\n {\n className,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n disabled,\n children,\n ...props\n },\n ref\n ) => {\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const generatedId = React.useId();\n\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : uncontrolledOpen;\n\n const toggle = React.useCallback(() => {\n if (disabled) return;\n const next = !open;\n if (!isControlled) setUncontrolledOpen(next);\n onOpenChange?.(next);\n }, [disabled, open, isControlled, onOpenChange]);\n\n const value = React.useMemo<CollapsibleContextValue>(\n () => ({\n open,\n toggle,\n disabled,\n contentId: `${generatedId}-content`,\n triggerId: `${generatedId}-trigger`,\n }),\n [open, toggle, disabled, generatedId]\n );\n\n return (\n <CollapsibleContext.Provider value={value}>\n <div\n ref={ref}\n data-slot=\"collapsible\"\n data-state={open ? 'open' : 'closed'}\n className={cn(className)}\n {...props}\n >\n {children}\n </div>\n </CollapsibleContext.Provider>\n );\n }\n);\n\nCollapsible.displayName = 'Collapsible';\n\nexport type CollapsibleTriggerProps =\n React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nconst CollapsibleTrigger = React.forwardRef<\n HTMLButtonElement,\n CollapsibleTriggerProps\n>(({ className, onClick, children, ...props }, ref) => {\n const { open, toggle, disabled, contentId, triggerId } =\n useCollapsibleContext('CollapsibleTrigger');\n\n return (\n <button\n ref={ref}\n type=\"button\"\n id={triggerId}\n data-slot=\"collapsible-trigger\"\n aria-expanded={open}\n aria-controls={contentId}\n data-state={open ? 'open' : 'closed'}\n disabled={disabled}\n onClick={(e) => {\n toggle();\n onClick?.(e);\n }}\n className={cn(className)}\n {...props}\n >\n {children}\n </button>\n );\n});\n\nCollapsibleTrigger.displayName = 'CollapsibleTrigger';\n\nexport interface CollapsibleContentProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Keep content mounted when collapsed (hidden via CSS) */\n forceMount?: boolean;\n}\n\nconst CollapsibleContent = React.forwardRef<\n HTMLDivElement,\n CollapsibleContentProps\n>(({ className, forceMount, children, ...props }, ref) => {\n const { open, contentId, triggerId } =\n useCollapsibleContext('CollapsibleContent');\n const prefersReducedMotion = usePrefersReducedMotion();\n\n const sharedProps = {\n id: contentId,\n role: 'region' as const,\n 'aria-labelledby': triggerId,\n 'data-slot': 'collapsible-content',\n 'data-state': open ? ('open' as const) : ('closed' as const),\n };\n\n /*\n * `forceMount` keeps the old instant behaviour, deliberately.\n *\n * It exists so consumers can keep collapsed content in the DOM, and it relies\n * on `hidden` to keep that content out of the tab order and the accessibility\n * tree. `hidden` is `display: none`, which an animated height cannot run\n * through — and dropping it for the duration would leave keyboard users able\n * to tab into content that is visually collapsed. Sequencing `hidden` around\n * the animation is the real fix; until then, not animating is the safe\n * answer, and the default (unmounting) path below covers the common case.\n */\n if (forceMount) {\n return (\n <div\n ref={ref}\n {...sharedProps}\n hidden={!open}\n className={cn(className)}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n return (\n <AnimatedPresence initial={false}>\n {open && (\n <Animated\n key=\"collapsible-content\"\n ref={ref as React.Ref<HTMLElement>}\n preset=\"collapse\"\n mode=\"presence\"\n // `collapse` animates height, which `MotionConfig reducedMotion=\"user\"`\n // does not treat as a transform or layout animation and so leaves\n // running. Honouring the preference is the component's job here.\n enabled={!prefersReducedMotion}\n {...sharedProps}\n // Content must be clipped or it spills past the box while the height\n // is still travelling.\n className={cn('overflow-hidden', className)}\n {...props}\n >\n {children}\n </Animated>\n )}\n </AnimatedPresence>\n );\n});\n\nCollapsibleContent.displayName = 'CollapsibleContent';\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"]}
@@ -0,0 +1,290 @@
1
+ 'use strict';
2
+
3
+ var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
4
+ var React = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
+
27
+ // src/motion/presets.ts
28
+ function offsetFromEdge(edge, distance) {
29
+ switch (edge) {
30
+ case "top":
31
+ return { x: 0, y: -distance };
32
+ case "bottom":
33
+ return { x: 0, y: distance };
34
+ case "left":
35
+ return { x: -distance, y: 0 };
36
+ default:
37
+ return { x: distance, y: 0 };
38
+ }
39
+ }
40
+ var motionPresets = {
41
+ /**
42
+ * Off-canvas panel pinned to the inline-start edge. Animates `x` only, which
43
+ * the compositor can handle without layout or paint.
44
+ */
45
+ drawerStart: {
46
+ variants: {
47
+ open: { x: "0%" },
48
+ // Off-canvas direction follows writing direction, mirroring the
49
+ // `-translate-x-full rtl:translate-x-full` CSS fallback.
50
+ closed: (isRtl) => ({ x: isRtl ? "100%" : "-100%" })
51
+ },
52
+ transition: { type: "spring", stiffness: 400, damping: 40, mass: 1 }
53
+ },
54
+ /** Scrim behind a drawer or modal. */
55
+ overlay: {
56
+ variants: {
57
+ open: { opacity: 1 },
58
+ closed: { opacity: 0 }
59
+ },
60
+ transition: { duration: 0.2, ease: "easeOut" }
61
+ },
62
+ /** Centered dialog surface — rises and settles rather than popping. */
63
+ modalContent: {
64
+ variants: {
65
+ open: { opacity: 1, scale: 1, y: 0 },
66
+ closed: { opacity: 0, scale: 0.96, y: 8 }
67
+ },
68
+ transition: { type: "spring", stiffness: 500, damping: 40, mass: 0.8 }
69
+ },
70
+ /**
71
+ * Text that disappears as its container narrows — sidebar labels on collapse.
72
+ *
73
+ * Opacity only, and deliberately so. An inline-axis slide would read slightly
74
+ * better but would make every label direction-aware, and resolving direction
75
+ * per nav item is a disproportionate amount of plumbing for an 8px nudge.
76
+ * Fading also degrades to itself under reduced motion instead of becoming a
77
+ * different animation.
78
+ *
79
+ * Short because it runs on many elements at once and has to finish inside the
80
+ * container's own width transition, or labels are still fading after the rail
81
+ * has stopped moving.
82
+ */
83
+ sidebarLabel: {
84
+ variants: {
85
+ open: { opacity: 1 },
86
+ closed: { opacity: 0 }
87
+ },
88
+ transition: { duration: 0.15, ease: "easeOut" }
89
+ },
90
+ /**
91
+ * Anchored popup surface — dropdown, select, autocomplete, command palette.
92
+ *
93
+ * `custom` is the side of the anchor the menu actually occupies, so the
94
+ * closed state nudges back *toward* the trigger and the menu reads as coming
95
+ * out of the control that opened it. Pass the post-flip side, not the
96
+ * requested placement: a menu asked for `bottom` that flipped to `top` for
97
+ * want of room must animate from the top, or it moves the wrong way.
98
+ *
99
+ * `transform-origin` is deliberately left to CSS (`origin-top` and friends).
100
+ * It is static per side and never animates, so making it a variant would put
101
+ * a second owner on a property motion has no reason to touch.
102
+ *
103
+ * Snappier than `modalContent`: a menu is a transient response to a click and
104
+ * should feel instant, where a dialog is a context switch and can afford to
105
+ * settle.
106
+ */
107
+ menu: {
108
+ variants: {
109
+ open: { opacity: 1, scale: 1, x: 0, y: 0 },
110
+ closed: (edge) => ({
111
+ opacity: 0,
112
+ scale: 0.95,
113
+ ...offsetFromEdge(edge, -4)
114
+ })
115
+ },
116
+ transition: { type: "spring", stiffness: 600, damping: 40, mass: 0.6 }
117
+ },
118
+ /**
119
+ * Disclosure content that expands and collapses — `Collapsible`, `Accordion`.
120
+ *
121
+ * The one preset that earns its keep on capability rather than polish:
122
+ * `height: auto` is not interpolable in CSS, so the alternative is a
123
+ * hard-coded max-height that either clips tall content or eases against dead
124
+ * space on short content. Motion measures the real height instead.
125
+ *
126
+ * Animating `height` costs layout on every frame, unlike the transform and
127
+ * opacity work everywhere else in this file. That is the price of the
128
+ * capability; keep the duration short and don't reach for this preset when a
129
+ * transform would do.
130
+ *
131
+ * Consumers must clip the element (`overflow-hidden`) or content spills past
132
+ * the shrinking box mid-animation.
133
+ *
134
+ * Note that `MotionConfig reducedMotion="user"` does **not** cover this:
135
+ * it drops transform and layout animations, and `height` is a plain value
136
+ * animation to motion. Components using this preset are responsible for
137
+ * honoring the preference themselves — see `usePrefersReducedMotion`.
138
+ */
139
+ collapse: {
140
+ variants: {
141
+ open: { height: "auto", opacity: 1 },
142
+ closed: { height: 0, opacity: 0 }
143
+ },
144
+ transition: { duration: 0.2, ease: "easeOut" }
145
+ },
146
+ /**
147
+ * Transient notification entering and leaving a stack.
148
+ *
149
+ * `custom` is the physical edge the toast lives against, so it enters from
150
+ * the screen edge nearest it rather than always from the right — which is
151
+ * what the `animate-slide-in-right` fallback does regardless of position.
152
+ *
153
+ * Scale is near-imperceptible on purpose: it softens the arrival without
154
+ * making a message that may carry an error read as playful.
155
+ */
156
+ toast: {
157
+ variants: {
158
+ open: { opacity: 1, scale: 1, x: 0, y: 0 },
159
+ closed: (edge) => ({
160
+ opacity: 0,
161
+ scale: 0.98,
162
+ ...offsetFromEdge(edge, 24)
163
+ })
164
+ },
165
+ transition: { type: "spring", stiffness: 400, damping: 36, mass: 0.8 }
166
+ },
167
+ /**
168
+ * Generic presence fade, for surfaces with no meaningful direction —
169
+ * drag overlays, connectivity banners, skeleton-to-content swaps.
170
+ *
171
+ * Survives `reducedMotion="user"` intact, since opacity is the one thing that
172
+ * setting keeps. Prefer it over a transform preset wherever the movement is
173
+ * decorative rather than explanatory.
174
+ */
175
+ fade: {
176
+ variants: {
177
+ open: { opacity: 1 },
178
+ closed: { opacity: 0 }
179
+ },
180
+ transition: { duration: 0.15, ease: "easeOut" }
181
+ },
182
+ /**
183
+ * Small element arriving with emphasis — a count badge, a status pill.
184
+ *
185
+ * Overshoots past full size and settles back (`1 → 1.1 → 1`) so the arrival
186
+ * is legible on an element too small for movement to register. Reserve it
187
+ * for things that appear in response to an event worth noticing; on anything
188
+ * large it reads as a bounce.
189
+ *
190
+ * The overshoot is a keyframe rather than a spring because the resting open
191
+ * state has to be `scale: 1`. Expressing the emphasis as a spring target
192
+ * would leave a mounted consumer parked at 1.1 — permanently 10% oversized —
193
+ * since the open variant is also the at-rest state.
194
+ */
195
+ pop: {
196
+ variants: {
197
+ open: { opacity: 1, scale: [1, 1.1, 1] },
198
+ closed: { opacity: 0, scale: 1 }
199
+ },
200
+ // `times` front-loads the overshoot so it reads as a pop rather than an
201
+ // even swell. Keyframe arrays need a duration-based tween; a spring has no
202
+ // way to run through intermediate values.
203
+ transition: { duration: 0.28, ease: "easeOut", times: [0, 0.45, 1] }
204
+ }
205
+ };
206
+ var CONTEXT_KEY = /* @__PURE__ */ Symbol.for("@mieweb/ui.motionRuntimeContext.v1");
207
+ function getMotionRuntimeContext() {
208
+ const globalScope = globalThis;
209
+ if (!globalScope[CONTEXT_KEY]) {
210
+ globalScope[CONTEXT_KEY] = React__namespace.createContext(null);
211
+ }
212
+ return globalScope[CONTEXT_KEY];
213
+ }
214
+ var MotionRuntimeContext = getMotionRuntimeContext();
215
+ function useMotionRuntime() {
216
+ return React__namespace.useContext(MotionRuntimeContext);
217
+ }
218
+ function createPresetPropBuilders() {
219
+ return {
220
+ toggle(preset, open, custom) {
221
+ const { variants, transition } = motionPresets[preset];
222
+ return {
223
+ variants,
224
+ transition,
225
+ custom,
226
+ // `false` pins the element to its current variant on mount instead of
227
+ // animating into it.
228
+ initial: false,
229
+ animate: open ? "open" : "closed"
230
+ };
231
+ },
232
+ presence(preset, custom) {
233
+ const { variants, transition } = motionPresets[preset];
234
+ return {
235
+ variants,
236
+ transition,
237
+ custom,
238
+ initial: "closed",
239
+ animate: "open",
240
+ exit: "closed"
241
+ };
242
+ }
243
+ };
244
+ }
245
+ var Animated = React__namespace.forwardRef(
246
+ function Animated2({
247
+ as = "div",
248
+ preset,
249
+ mode,
250
+ open = false,
251
+ custom,
252
+ className,
253
+ fallbackClassName,
254
+ enabled = true,
255
+ children,
256
+ ...rest
257
+ }, ref) {
258
+ const runtime = useMotionRuntime();
259
+ if (!runtime || !runtime.enabled || !enabled) {
260
+ const Tag = as;
261
+ return /* @__PURE__ */ jsxRuntime.jsx(Tag, { ref, className: chunkS5RVSXDV_cjs.cn(fallbackClassName, className), ...rest, children });
262
+ }
263
+ const Component = as === "nav" ? runtime.Nav : as === "span" ? runtime.Span : runtime.Div;
264
+ const motionProps = mode === "toggle" ? runtime.toggle(preset, open, custom) : runtime.presence(preset, custom);
265
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className, ...motionProps, ...rest, children });
266
+ }
267
+ );
268
+ Animated.displayName = "Animated";
269
+ function AnimatedPresence({
270
+ children,
271
+ initial,
272
+ onExitComplete
273
+ }) {
274
+ const runtime = useMotionRuntime();
275
+ if (!runtime) {
276
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
277
+ }
278
+ const { Presence } = runtime;
279
+ return /* @__PURE__ */ jsxRuntime.jsx(Presence, { initial, onExitComplete, children });
280
+ }
281
+ AnimatedPresence.displayName = "AnimatedPresence";
282
+
283
+ exports.Animated = Animated;
284
+ exports.AnimatedPresence = AnimatedPresence;
285
+ exports.MotionRuntimeContext = MotionRuntimeContext;
286
+ exports.createPresetPropBuilders = createPresetPropBuilders;
287
+ exports.motionPresets = motionPresets;
288
+ exports.useMotionRuntime = useMotionRuntime;
289
+ //# sourceMappingURL=chunk-NV2CWBI2.cjs.map
290
+ //# sourceMappingURL=chunk-NV2CWBI2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/motion/presets.ts","../src/motion/runtime.ts","../src/motion/Animated.tsx"],"names":["React","React2","Animated","jsx","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAS,cAAA,CACP,MACA,QAAA,EAC0B;AAC1B,EAAA,QAAQ,IAAA;AAAM,IACZ,KAAK,KAAA;AACH,MAAA,OAAO,EAAE,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAC,QAAA,EAAS;AAAA,IAC9B,KAAK,QAAA;AACH,MAAA,OAAO,EA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AAI,CAAC,OAAA,EAAS;AACZ,IAAA,6DAAU,QAAA,EAAS,CAAA;AAAA,EACrB;AAEA,EAAA,MAAM,EAAE,UAAS,GAAI,OAAA;AACrB,EAAA,uBACEA,cAAA,CAAC,QAAA,EAAA,EAAS,OAAA,EAAkB,cAAA,EACzB,QAAA,EACH,CAAA;AAEJ;AAEA,gBAAA,CAAiB,WAAA,GAAc,kBAAA","file":"chunk-NV2CWBI2.cjs","sourcesContent":["/**\n * Motion presets — the shared vocabulary of animations.\n *\n * This module is intentionally **free of any `motion` import**. It ships in the\n * main `@mieweb/ui` entry so components can describe *what* they animate\n * without pulling in a runtime to actually do it. The `@mieweb/ui/motion` entry\n * is what turns these descriptions into real animations.\n *\n * Every preset is expressed as an open/closed variant pair so the same\n * definition serves both usages:\n *\n * - **toggle** — the element stays mounted and animates between `open` and\n * `closed` (a drawer sliding in and out).\n * - **presence** — the element mounts and unmounts, entering on `open` and\n * exiting back to `closed` (a modal).\n */\n\n// =============================================================================\n// Types\n// =============================================================================\n\n/** Named animation recipes shared by components. */\nexport type MotionPreset =\n | 'drawerStart'\n | 'overlay'\n | 'modalContent'\n | 'sidebarLabel'\n | 'menu'\n | 'collapse'\n | 'toast'\n | 'fade'\n | 'pop';\n\n/**\n * A physical edge, already resolved from any logical (`start`/`end`) position\n * and from writing direction.\n *\n * Presets that move an element along an axis take one of these as `custom`.\n * Resolution is the component's job, not the preset's: only the component knows\n * whether its `end` means right or left, and — for anything anchored — which\n * side it actually landed on after flipping away from a viewport edge.\n */\nexport type MotionEdge = 'top' | 'bottom' | 'left' | 'right';\n\n/** Offset along the axis implied by `edge`, in px. */\nfunction offsetFromEdge(\n edge: unknown,\n distance: number\n): { x: number; y: number } {\n switch (edge) {\n case 'top':\n return { x: 0, y: -distance };\n case 'bottom':\n return { x: 0, y: distance };\n case 'left':\n return { x: -distance, y: 0 };\n default:\n return { x: distance, y: 0 };\n }\n}\n\n/**\n * A variant value. Either a plain target object or a function of the element's\n * `custom` value — the latter lets a single preset adapt to context, e.g. a\n * drawer flipping its off-canvas direction in RTL.\n */\nexport type MotionVariant =\n | Record<string, unknown>\n | ((custom: unknown) => Record<string, unknown>);\n\nexport interface MotionPresetDefinition {\n variants: {\n open: MotionVariant;\n closed: MotionVariant;\n };\n transition: Record<string, unknown>;\n}\n\n// =============================================================================\n// Presets\n// =============================================================================\n\n/**\n * `custom` contract per preset:\n *\n * - `drawerStart` — `boolean`, whether the document direction is RTL.\n * - `menu`, `toast` — a {@link MotionEdge}, already resolved from logical\n * position and writing direction by the component.\n * - `overlay`, `modalContent`, `sidebarLabel`, `collapse`, `fade`, `pop` —\n * unused.\n */\nexport const motionPresets: Record<MotionPreset, MotionPresetDefinition> = {\n /**\n * Off-canvas panel pinned to the inline-start edge. Animates `x` only, which\n * the compositor can handle without layout or paint.\n */\n drawerStart: {\n variants: {\n open: { x: '0%' },\n // Off-canvas direction follows writing direction, mirroring the\n // `-translate-x-full rtl:translate-x-full` CSS fallback.\n closed: (isRtl: unknown) => ({ x: isRtl ? '100%' : '-100%' }),\n },\n transition: { type: 'spring', stiffness: 400, damping: 40, mass: 1 },\n },\n\n /** Scrim behind a drawer or modal. */\n overlay: {\n variants: {\n open: { opacity: 1 },\n closed: { opacity: 0 },\n },\n transition: { duration: 0.2, ease: 'easeOut' },\n },\n\n /** Centered dialog surface — rises and settles rather than popping. */\n modalContent: {\n variants: {\n open: { opacity: 1, scale: 1, y: 0 },\n closed: { opacity: 0, scale: 0.96, y: 8 },\n },\n transition: { type: 'spring', stiffness: 500, damping: 40, mass: 0.8 },\n },\n\n /**\n * Text that disappears as its container narrows — sidebar labels on collapse.\n *\n * Opacity only, and deliberately so. An inline-axis slide would read slightly\n * better but would make every label direction-aware, and resolving direction\n * per nav item is a disproportionate amount of plumbing for an 8px nudge.\n * Fading also degrades to itself under reduced motion instead of becoming a\n * different animation.\n *\n * Short because it runs on many elements at once and has to finish inside the\n * container's own width transition, or labels are still fading after the rail\n * has stopped moving.\n */\n sidebarLabel: {\n variants: {\n open: { opacity: 1 },\n closed: { opacity: 0 },\n },\n transition: { duration: 0.15, ease: 'easeOut' },\n },\n\n /**\n * Anchored popup surface — dropdown, select, autocomplete, command palette.\n *\n * `custom` is the side of the anchor the menu actually occupies, so the\n * closed state nudges back *toward* the trigger and the menu reads as coming\n * out of the control that opened it. Pass the post-flip side, not the\n * requested placement: a menu asked for `bottom` that flipped to `top` for\n * want of room must animate from the top, or it moves the wrong way.\n *\n * `transform-origin` is deliberately left to CSS (`origin-top` and friends).\n * It is static per side and never animates, so making it a variant would put\n * a second owner on a property motion has no reason to touch.\n *\n * Snappier than `modalContent`: a menu is a transient response to a click and\n * should feel instant, where a dialog is a context switch and can afford to\n * settle.\n */\n menu: {\n variants: {\n open: { opacity: 1, scale: 1, x: 0, y: 0 },\n closed: (edge: unknown) => ({\n opacity: 0,\n scale: 0.95,\n ...offsetFromEdge(edge, -4),\n }),\n },\n transition: { type: 'spring', stiffness: 600, damping: 40, mass: 0.6 },\n },\n\n /**\n * Disclosure content that expands and collapses — `Collapsible`, `Accordion`.\n *\n * The one preset that earns its keep on capability rather than polish:\n * `height: auto` is not interpolable in CSS, so the alternative is a\n * hard-coded max-height that either clips tall content or eases against dead\n * space on short content. Motion measures the real height instead.\n *\n * Animating `height` costs layout on every frame, unlike the transform and\n * opacity work everywhere else in this file. That is the price of the\n * capability; keep the duration short and don't reach for this preset when a\n * transform would do.\n *\n * Consumers must clip the element (`overflow-hidden`) or content spills past\n * the shrinking box mid-animation.\n *\n * Note that `MotionConfig reducedMotion=\"user\"` does **not** cover this:\n * it drops transform and layout animations, and `height` is a plain value\n * animation to motion. Components using this preset are responsible for\n * honoring the preference themselves — see `usePrefersReducedMotion`.\n */\n collapse: {\n variants: {\n open: { height: 'auto', opacity: 1 },\n closed: { height: 0, opacity: 0 },\n },\n transition: { duration: 0.2, ease: 'easeOut' },\n },\n\n /**\n * Transient notification entering and leaving a stack.\n *\n * `custom` is the physical edge the toast lives against, so it enters from\n * the screen edge nearest it rather than always from the right — which is\n * what the `animate-slide-in-right` fallback does regardless of position.\n *\n * Scale is near-imperceptible on purpose: it softens the arrival without\n * making a message that may carry an error read as playful.\n */\n toast: {\n variants: {\n open: { opacity: 1, scale: 1, x: 0, y: 0 },\n closed: (edge: unknown) => ({\n opacity: 0,\n scale: 0.98,\n ...offsetFromEdge(edge, 24),\n }),\n },\n transition: { type: 'spring', stiffness: 400, damping: 36, mass: 0.8 },\n },\n\n /**\n * Generic presence fade, for surfaces with no meaningful direction —\n * drag overlays, connectivity banners, skeleton-to-content swaps.\n *\n * Survives `reducedMotion=\"user\"` intact, since opacity is the one thing that\n * setting keeps. Prefer it over a transform preset wherever the movement is\n * decorative rather than explanatory.\n */\n fade: {\n variants: {\n open: { opacity: 1 },\n closed: { opacity: 0 },\n },\n transition: { duration: 0.15, ease: 'easeOut' },\n },\n\n /**\n * Small element arriving with emphasis — a count badge, a status pill.\n *\n * Overshoots past full size and settles back (`1 → 1.1 → 1`) so the arrival\n * is legible on an element too small for movement to register. Reserve it\n * for things that appear in response to an event worth noticing; on anything\n * large it reads as a bounce.\n *\n * The overshoot is a keyframe rather than a spring because the resting open\n * state has to be `scale: 1`. Expressing the emphasis as a spring target\n * would leave a mounted consumer parked at 1.1 — permanently 10% oversized —\n * since the open variant is also the at-rest state.\n */\n pop: {\n variants: {\n open: { opacity: 1, scale: [1, 1.1, 1] },\n closed: { opacity: 0, scale: 1 },\n },\n // `times` front-loads the overshoot so it reads as a pop rather than an\n // even swell. Keyframe arrays need a duration-based tween; a spring has no\n // way to run through intermediate values.\n transition: { duration: 0.28, ease: 'easeOut', times: [0, 0.45, 1] },\n },\n};\n","/**\n * Motion runtime — the seam between components and an optional animation library.\n *\n * Components in the main entry never import `motion`. They ask this module for\n * a runtime; if an app has opted in by rendering `<MotionProvider>` from\n * `@mieweb/ui/motion`, they get one and animate. If not, `useMotionRuntime()`\n * returns `null` and they fall back to their existing CSS transitions. That is\n * what keeps `motion` out of the bundle of every app that hasn't asked for it —\n * the opt-in is resolved in the *module graph*, not by a prop.\n *\n * Like `presets`, this module must stay free of any `motion` import.\n */\n\nimport * as React from 'react';\nimport { motionPresets, type MotionPreset } from './presets';\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface MotionPresenceProps {\n children?: React.ReactNode;\n /** Suppress the initial mount animation. */\n initial?: boolean;\n /**\n * Fires once every exiting child has finished and been removed.\n *\n * Needed by anything that guards the DOM while it is open — a focus trap, a\n * scroll lock — because those guards must outlive `open` for as long as the\n * subtree is still on screen. Never fires when no runtime is active, since\n * there is no exit to wait for.\n */\n onExitComplete?: () => void;\n}\n\n/**\n * The capabilities a motion library must supply. Deliberately small: element\n * factories, a presence wrapper, and prop builders. Components depend on this\n * interface, never on a concrete library, so swapping or dropping the library\n * stays a one-file change.\n */\nexport interface MotionRuntime {\n /**\n * Whether animations should actually run.\n *\n * A disabled provider still supplies a runtime rather than `null` so that\n * consumers can tell \"disabled\" apart from \"never opted in\": `Modal` uses it\n * to decide whether an exit animation will ever report completion, and\n * `AnimatedPresence` keeps its wrapper element stable across the flip.\n * `Animated` itself renders the plain fallback tag whenever this is false —\n * withholding animation props from a mounted motion component corrupts\n * `toggle`-mode elements, so the swap (and the remount it implies) is the\n * correct behaviour. See the render branches in `Animated`.\n */\n enabled: boolean;\n /** Animated `div`. */\n Div: React.ElementType;\n /** Animated `nav`. */\n Nav: React.ElementType;\n /** Animated `span`, for inline content that must not become a block. */\n Span: React.ElementType;\n /** Enables exit animations for conditionally rendered children. */\n Presence: React.ComponentType<MotionPresenceProps>;\n /**\n * Props for an element that stays mounted and animates between states.\n * Skips the initial animation so a closed drawer doesn't slide out on load.\n */\n toggle: (\n preset: MotionPreset,\n open: boolean,\n custom?: unknown\n ) => Record<string, unknown>;\n /** Props for an element that mounts and unmounts inside `Presence`. */\n presence: (preset: MotionPreset, custom?: unknown) => Record<string, unknown>;\n}\n\n// =============================================================================\n// Context\n// =============================================================================\n\n/**\n * The context is stashed on `globalThis` under a registered symbol rather than\n * held in a module-local `const`.\n *\n * `@mieweb/ui` and `@mieweb/ui/motion` are separate bundle entries, and CJS\n * builds cannot code-split. Without this, the provider and the components\n * would each get their own copy of the context object and the provider would\n * silently never be seen — animations would simply never turn on, with no\n * error to explain why. A duplicated install of the package causes the same\n * failure. Keying off the global symbol registry makes the context a true\n * singleton in every one of those cases.\n *\n * The key is versioned. Two copies of this package sharing one page share\n * whatever lives under the key, so the `v1` suffix is a compatibility\n * contract: bump it if the `MotionRuntime` interface ever changes shape,\n * or an old provider will hand a new component a runtime it cannot use.\n */\nconst CONTEXT_KEY = Symbol.for('@mieweb/ui.motionRuntimeContext.v1');\n\ntype GlobalWithMotionContext = typeof globalThis & {\n [CONTEXT_KEY]?: React.Context<MotionRuntime | null>;\n};\n\nfunction getMotionRuntimeContext(): React.Context<MotionRuntime | null> {\n const globalScope = globalThis as GlobalWithMotionContext;\n if (!globalScope[CONTEXT_KEY]) {\n globalScope[CONTEXT_KEY] = React.createContext<MotionRuntime | null>(null);\n }\n return globalScope[CONTEXT_KEY];\n}\n\n/** @internal Consumed by `<MotionProvider>` in the `@mieweb/ui/motion` entry. */\nexport const MotionRuntimeContext = getMotionRuntimeContext();\n\n// =============================================================================\n// Hooks\n// =============================================================================\n\n/**\n * The active motion runtime, or `null` when the app has not opted in.\n *\n * Components must treat `null` as the normal case and keep a CSS path that\n * looks good on its own — motion is an enhancement, never a requirement.\n */\nexport function useMotionRuntime(): MotionRuntime | null {\n return React.useContext(MotionRuntimeContext);\n}\n\n// =============================================================================\n// Prop builders\n// =============================================================================\n\n/**\n * Builds the `toggle`/`presence` prop builders around a library-agnostic core.\n * Exported so `<MotionProvider>` can assemble a runtime without restating the\n * preset lookup.\n *\n * @internal\n */\nexport function createPresetPropBuilders(): Pick<\n MotionRuntime,\n 'toggle' | 'presence'\n> {\n return {\n toggle(preset, open, custom) {\n const { variants, transition } = motionPresets[preset];\n return {\n variants,\n transition,\n custom,\n // `false` pins the element to its current variant on mount instead of\n // animating into it.\n initial: false,\n animate: open ? 'open' : 'closed',\n };\n },\n\n presence(preset, custom) {\n const { variants, transition } = motionPresets[preset];\n return {\n variants,\n transition,\n custom,\n initial: 'closed',\n animate: 'open',\n exit: 'closed',\n };\n },\n };\n}\n","/**\n * `Animated` / `AnimatedPresence` — the ergonomic layer components use.\n *\n * These exist so an individual component never has to branch on whether motion\n * is available. It declares the preset it wants and the CSS classes that stand\n * in when motion is absent; this module picks the element to render.\n *\n * Adding motion to a further component should be a matter of swapping its\n * root `<div>` for an `<Animated>` and naming a preset — no new imports, no\n * new dependency, and no behavior change for apps that have not opted in.\n */\n\nimport * as React from 'react';\nimport { cn } from '../utils/cn';\nimport { useMotionRuntime, type MotionPresenceProps } from './runtime';\nimport type { MotionPreset } from './presets';\n\n// =============================================================================\n// Animated\n// =============================================================================\n\nexport interface AnimatedProps extends React.HTMLAttributes<HTMLElement> {\n /** Intrinsic element to render. */\n as?: 'div' | 'nav' | 'span';\n /** Which shared animation recipe to use. */\n preset: MotionPreset;\n /**\n * - `toggle` — element stays mounted and animates between open and closed.\n * - `presence` — element mounts and unmounts; wrap it in `<AnimatedPresence>`\n * so the exit animation gets a chance to run.\n */\n mode: 'toggle' | 'presence';\n /** Current state. Only read in `toggle` mode. */\n open?: boolean;\n /** Per-preset context value — see the `custom` contract in `presets.ts`. */\n custom?: unknown;\n /**\n * Classes applied whenever this element is **not** animating — no provider,\n * a disabled provider, or `enabled={false}`. This is where a component's\n * existing CSS transition lives, so the two paths never both try to drive\n * the same property.\n */\n fallbackClassName?: string;\n /**\n * Set `false` to stop this element animating even when a runtime is active.\n *\n * For states where an animated element would be wrong rather than merely\n * unnecessary. Motion writes a `transform` to hold an element at its resting\n * position, and a transformed ancestor becomes the containing block for any\n * `position: fixed` descendant — so an element that is only sometimes\n * animated should opt out the rest of the time.\n *\n * Flipping this (or the provider's `disabled`) swaps the element back to a\n * plain tag, which **remounts** it — deliberately. See the note on the\n * render branches below.\n */\n enabled?: boolean;\n}\n\nexport const Animated = React.forwardRef<HTMLElement, AnimatedProps>(\n function Animated(\n {\n as = 'div',\n preset,\n mode,\n open = false,\n custom,\n className,\n fallbackClassName,\n enabled = true,\n children,\n ...rest\n },\n ref\n ) {\n const runtime = useMotionRuntime();\n\n /*\n * Anything not animating renders the plain tag with the CSS fallback —\n * no provider, a disabled provider, or `enabled={false}` alike.\n *\n * Crossing between this branch and the motion one changes the element\n * type, which remounts the subtree. That is deliberate. The obvious\n * alternative — keeping the motion component mounted and only withholding\n * its animation props — corrupts `toggle`-mode elements in both\n * directions, because motion only writes variant styles at mount or in\n * response to an animation:\n *\n * - props added in place (a drawer crossing into its mobile breakpoint\n * while closed) never get the `closed` transform, so the drawer sits\n * fully visible over the page;\n * - props removed in place strand whatever inline `transform` motion last\n * wrote, so a sidebar returning to desktop stays off-canvas.\n *\n * Fresh mounts are correct in both worlds, so remounting at the flip is\n * the fix. The flips are rare — a breakpoint cross, a test toggling the\n * provider — and a remount that resets local state beats a stale\n * transform that removes the navigation.\n */\n if (!runtime || !runtime.enabled || !enabled) {\n const Tag = as as React.ElementType;\n return (\n <Tag ref={ref} className={cn(fallbackClassName, className)} {...rest}>\n {children}\n </Tag>\n );\n }\n\n const Component =\n as === 'nav' ? runtime.Nav : as === 'span' ? runtime.Span : runtime.Div;\n\n const motionProps =\n mode === 'toggle'\n ? runtime.toggle(preset, open, custom)\n : runtime.presence(preset, custom);\n\n return (\n <Component ref={ref} className={className} {...motionProps} {...rest}>\n {children}\n </Component>\n );\n }\n);\n\nAnimated.displayName = 'Animated';\n\n// =============================================================================\n// AnimatedPresence\n// =============================================================================\n\n/**\n * Keeps unmounting children on screen long enough to animate out.\n *\n * Without a runtime this is a pass-through, so children disappear immediately —\n * which is exactly what they do today. Children rendered conditionally inside\n * it need a stable `key`.\n */\nexport function AnimatedPresence({\n children,\n initial,\n onExitComplete,\n}: MotionPresenceProps): React.JSX.Element {\n const runtime = useMotionRuntime();\n\n if (!runtime) {\n return <>{children}</>;\n }\n\n const { Presence } = runtime;\n return (\n <Presence initial={initial} onExitComplete={onExitComplete}>\n {children}\n </Presence>\n );\n}\n\nAnimatedPresence.displayName = 'AnimatedPresence';\n"]}