@eightshift/ui-components 8.1.0 → 8.2.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 (150) hide show
  1. package/dist/{Autocomplete-BUU44AuW.js → Autocomplete-CO9aIsTe.js} +29 -25
  2. package/dist/{Button-_E2Z5G2l.js → Button-DO3oQfCq.js} +15 -9
  3. package/dist/{Dialog-3XLIaepk.js → Dialog-Bdqjmtt2.js} +293 -160
  4. package/dist/{Disclosure-Dh0z_DEQ.js → Disclosure-BTSsPhG9.js} +33 -29
  5. package/dist/{FocusScope-BKGWN6UK.js → FocusScope-Cj6cUR6X.js} +8 -6
  6. package/dist/{Heading-BWTs9ckA.js → Heading-BQje2nS2.js} +1 -1
  7. package/dist/{I18nProvider-BskRMK8G.js → I18nProvider-R_4IDnf9.js} +1 -1
  8. package/dist/{Label-UpU4cKPh.js → Label-C4bJkVti.js} +1 -1
  9. package/dist/{ListBox-DepY-52g.js → ListBox-CBvtIFuB.js} +20 -16
  10. package/dist/{NumberFormatter-WKBRKiEA.js → NumberFormatter-Bwdv413k.js} +4 -2
  11. package/dist/{RadioGroup-Br9Mn9QJ.js → RadioGroup-Dxzko0ma.js} +35 -35
  12. package/dist/{SearchField-q2Fj0L9K.js → SearchField-zY9JqR1c.js} +29 -26
  13. package/dist/{Slider-B8icnyOo.js → Slider-BXc72kE0.js} +55 -44
  14. package/dist/{Text-D4y19vs8.js → Text-i-ZK4MiL.js} +1 -1
  15. package/dist/{VisuallyHidden-B_LZ_kn7.js → VisuallyHidden-CsM0VnV1.js} +2 -2
  16. package/dist/{animation-DpSgtWyu.js → animation-COc9P6ap.js} +2 -4
  17. package/dist/assets/{image-analysis-worker-BuHru-CI.js → image-analysis-worker-CBOB71mx.js} +1 -1
  18. package/dist/assets/style-admin.css +1 -1
  19. package/dist/assets/style-editor.css +1 -1
  20. package/dist/assets/style.css +1 -1
  21. package/dist/{button-XSk_8UW7.js → button-C7mc6eS1.js} +15 -12
  22. package/dist/{checkbox-BYaS9tQ5.js → checkbox-DlG5DILl.js} +8 -8
  23. package/dist/{color-swatch-6ZEIXej3.js → color-swatch-D6xMLGU-.js} +14 -15
  24. package/dist/components/animated-visibility/animated-visibility.js +5 -3
  25. package/dist/components/base-control/base-control.js +1 -1
  26. package/dist/components/base-control/container.d.ts +4 -30
  27. package/dist/components/base-control/container.js +5 -32
  28. package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -1
  29. package/dist/components/button/button.js +1 -1
  30. package/dist/components/checkbox/checkbox.js +1 -1
  31. package/dist/components/color-pickers/color-picker.js +7 -7
  32. package/dist/components/color-pickers/color-swatch.js +1 -1
  33. package/dist/components/color-pickers/gradient-editor.js +1 -1
  34. package/dist/components/color-pickers/solid-color-picker.js +1 -1
  35. package/dist/components/component-toggle/component-toggle.js +3 -3
  36. package/dist/components/container-panel/container-panel.js +11 -11
  37. package/dist/components/contextual-help/contextual-help.js +2 -2
  38. package/dist/components/draggable/draggable.d.ts +3 -3
  39. package/dist/components/draggable/draggable.js +1 -1
  40. package/dist/components/draggable-list/draggable-list.d.ts +3 -3
  41. package/dist/components/draggable-list/draggable-list.js +8 -8
  42. package/dist/components/expandable/expandable.js +3 -3
  43. package/dist/components/index.js +16 -16
  44. package/dist/components/input-field/input-field.js +1 -1
  45. package/dist/components/item-collection/item-collection.d.ts +3 -28
  46. package/dist/components/item-collection/item-collection.js +6 -6
  47. package/dist/components/link-input/link-input.d.ts +0 -2
  48. package/dist/components/link-input/link-input.js +1 -1
  49. package/dist/components/matrix-align/matrix-align.js +4 -3
  50. package/dist/components/menu/menu.js +10 -7
  51. package/dist/components/modal/modal.js +1 -1
  52. package/dist/components/notice/notice.js +8 -8
  53. package/dist/components/number-picker/number-picker.js +1 -1
  54. package/dist/components/option-select/option-select.d.ts +1 -1
  55. package/dist/components/option-select/option-select.js +21 -15
  56. package/dist/components/options-panel/options-panel.js +4 -4
  57. package/dist/components/placeholders/file-picker-shell.js +4 -3
  58. package/dist/components/placeholders/file-placeholder.js +2 -1
  59. package/dist/components/popover/popover.js +3 -3
  60. package/dist/components/portal-provider/portal-provider.js +2 -1
  61. package/dist/components/radio/radio.js +2 -2
  62. package/dist/components/repeater/repeater-context.d.ts +0 -1
  63. package/dist/components/repeater/repeater-item.js +1 -1
  64. package/dist/components/repeater/repeater.d.ts +5 -38
  65. package/dist/components/repeater/repeater.js +7 -10
  66. package/dist/components/responsive/mini-responsive.d.ts +0 -1
  67. package/dist/components/responsive/mini-responsive.js +30 -30
  68. package/dist/components/responsive/responsive-legacy.d.ts +0 -1
  69. package/dist/components/responsive/responsive-legacy.js +12 -10
  70. package/dist/components/responsive/responsive.d.ts +0 -1
  71. package/dist/components/responsive/responsive.js +28 -28
  72. package/dist/components/responsive-preview/responsive-preview.js +3 -3
  73. package/dist/components/select/async-multi-select.d.ts +12 -13
  74. package/dist/components/select/async-multi-select.js +39 -20
  75. package/dist/components/select/async-select.d.ts +12 -13
  76. package/dist/components/select/async-select.js +38 -20
  77. package/dist/components/select/multi-select.d.ts +2 -8
  78. package/dist/components/select/multi-select.js +19 -19
  79. package/dist/components/select/shared.d.ts +5 -9
  80. package/dist/components/select/shared.js +2 -2
  81. package/dist/components/select/single-select.d.ts +2 -8
  82. package/dist/components/select/single-select.js +16 -16
  83. package/dist/components/slider/column-config-slider.js +7 -5
  84. package/dist/components/slider/slider.js +15 -11
  85. package/dist/components/smart-image/smart-image.d.ts +0 -1
  86. package/dist/components/smart-image/smart-image.js +52 -50
  87. package/dist/components/tabs/tabs.js +1 -1
  88. package/dist/components/toggle/switch.js +1 -1
  89. package/dist/components/toggle/toggle.js +2 -2
  90. package/dist/components/toggle-button/toggle-button.js +1 -1
  91. package/dist/components/tooltip/tooltip.js +1 -1
  92. package/dist/{draggable-9MfdTVWP.js → draggable-BUfOpGSZ.js} +129 -124
  93. package/dist/{es-dash-DunirOmV.js → es-dash-DPtJSRjw.js} +23 -52
  94. package/dist/{gradient-editor-yqSw0uPA.js → gradient-editor-_q3XF10i.js} +38 -29
  95. package/dist/icons/block-icon.js +1 -1
  96. package/dist/icons/icon.d.ts +3 -3
  97. package/dist/icons/icon.js +21 -9
  98. package/dist/icons/icons.d.ts +210 -1
  99. package/dist/icons/index.js +1 -1
  100. package/dist/icons/jsx-svg.d.ts +5 -4
  101. package/dist/icons/jsx-svg.js +1 -1
  102. package/dist/index.js +16 -16
  103. package/dist/{input-field-nN6BO0oz.js → input-field-QzBpjm-m.js} +8 -8
  104. package/dist/{jsx-svg-BjGQUBLh.js → jsx-svg-DRwJdRpA.js} +171 -129
  105. package/dist/{keyboard-g5Amam-c.js → keyboard-BxnnQA2Z.js} +1 -1
  106. package/dist/{link-input-BhlPElU8.js → link-input-CElQp3lP.js} +145 -87
  107. package/dist/{modal-B5axB0Fc.js → modal-BeacK9N_.js} +14 -13
  108. package/dist/{number-picker-nnOf0XnN.js → number-picker-CK_OHBXw.js} +9 -9
  109. package/dist/{react-y40Dt3ab.js → react-C6Y6cCOx.js} +194 -215
  110. package/dist/{shared-Ba_bt4s9.js → shared-DBCipn_m.js} +59 -43
  111. package/dist/{solid-color-picker-CsosgTVa.js → solid-color-picker-2-X3ridX.js} +58 -53
  112. package/dist/{switch-BJ4_OyUm.js → switch-B87lQ1V0.js} +6 -6
  113. package/dist/{tabs-wAe0AAyu.js → tabs-DgkJUkIX.js} +33 -28
  114. package/dist/{text-helpers-2j9DuxP1.js → text-helpers-QrwKKaOh.js} +3 -2
  115. package/dist/{textSelection-B_Nv6Jz3.js → textSelection-5Qk8tLtm.js} +3 -3
  116. package/dist/{toggle-button-BLJdEp8V.js → toggle-button-B2-f2rU6.js} +8 -7
  117. package/dist/{tooltip-BW9nj5-V.js → tooltip-AzOLps8g.js} +68 -62
  118. package/dist/{useAsyncList-B3-uyJgA.js → useAsyncList-CjKVLGN0.js} +8 -4
  119. package/dist/{useButton-CPMVLXoX.js → useButton-BIrfoiY8.js} +3 -3
  120. package/dist/{useCollection-PzY6FI39.js → useCollection-LQlZnc1u.js} +267 -180
  121. package/dist/{useEvent-CzuFZ2HT.js → useEvent-Bih8lvtM.js} +1 -1
  122. package/dist/{useField-DrfR8j9h.js → useField-B_ibsWst.js} +2 -2
  123. package/dist/{useFilter-CiCjo6Na.js → useFilter-BFaOw4yi.js} +1 -1
  124. package/dist/{useFocusRing-CrYHpV7C.js → useFocusRing-ZXFsftJJ.js} +1 -1
  125. package/dist/{useFormReset-U6c35PHq.js → useFormReset-DDJhIIfG.js} +1 -1
  126. package/dist/{useFormValidation-B2q2MGWN.js → useFormValidation-BfnJKcdX.js} +2 -2
  127. package/dist/{useHover-CNsbAR0V.js → useHover-CbyH227W.js} +216 -39
  128. package/dist/{useLabel-DuxAjaic.js → useLabel-gfFDE4bn.js} +2 -2
  129. package/dist/{useLabels-NUsp5IW3.js → useLabels-Dcg-cEyM.js} +1 -1
  130. package/dist/{useListState-FLxa7R_U.js → useListState-I22DfnmE.js} +4 -2
  131. package/dist/{useLocalizedStringFormatter-Ccm8EL_u.js → useLocalizedStringFormatter-CTCqjYu4.js} +6 -1
  132. package/dist/{useNumberFieldState-DWvm7CXu.js → useNumberFieldState-C1gD0RuW.js} +79 -62
  133. package/dist/{useNumberFormatter-B0_D7a_o.js → useNumberFormatter-DbAt_fC_.js} +2 -2
  134. package/dist/{useOverlayTriggerState-zZ7homyI.js → useOverlayTriggerState-Cpc_IbQf.js} +12 -9
  135. package/dist/{usePress-DRoujMNm.js → usePress-BF7otjax.js} +30 -19
  136. package/dist/{useSlot-pRz-v9kC.js → useSlot-CnQHcvd4.js} +1 -1
  137. package/dist/{useTextField-e8jIFT3s.js → useTextField-CnTuCBMs.js} +6 -6
  138. package/dist/{useToggle-CR_ZKvr_.js → useToggle-Cgv5UXaB.js} +6 -6
  139. package/dist/{useToggleState-ButQxGrJ.js → useToggleState-Cy1E36QZ.js} +1 -1
  140. package/dist/utilities/array-helpers.d.ts +1 -1
  141. package/dist/utilities/array-helpers.js +4 -3
  142. package/dist/utilities/debounce-throttle.d.ts +9 -2
  143. package/dist/utilities/es-dash.d.ts +11 -8
  144. package/dist/utilities/es-dash.js +1 -1
  145. package/dist/utilities/index.js +2 -2
  146. package/dist/utilities/text-helpers.js +1 -1
  147. package/dist/utilities/web-workers.d.ts +7 -7
  148. package/dist/utilities/web-workers.js +5 -5
  149. package/dist/{utils-Czi6q2Ub.js → utils-ClM91CuL.js} +30 -19
  150. package/package.json +21 -25
@@ -1,48 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Children, Component, Fragment, createContext, createElement, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
4
- //#region \0rolldown/runtime.js
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __esmMin = (fn, res, err) => () => {
10
- if (err) throw err[0];
11
- try {
12
- return fn && (res = fn(fn = 0)), res;
13
- } catch (e) {
14
- throw err = [e], e;
15
- }
16
- };
17
- var __exportAll = (all, no_symbols) => {
18
- let target = {};
19
- for (var name in all) {
20
- __defProp(target, name, {
21
- get: all[name],
22
- enumerable: true
23
- });
24
- }
25
- if (!no_symbols) {
26
- __defProp(target, Symbol.toStringTag, { value: "Module" });
27
- }
28
- return target;
29
- };
30
- var __copyProps = (to, from, except, desc) => {
31
- if (from && typeof from === "object" || typeof from === "function") {
32
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
33
- key = keys[i];
34
- if (!__hasOwnProp.call(to, key) && key !== except) {
35
- __defProp(to, key, {
36
- get: ((k) => from[k]).bind(null, key),
37
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
38
- });
39
- }
40
- }
41
- }
42
- return to;
43
- };
44
- var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
- //#endregion
46
4
  //#region node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs
47
5
  var LayoutGroupContext = createContext({});
48
6
  //#endregion
@@ -61,10 +19,10 @@ function useConstant(init) {
61
19
  }
62
20
  //#endregion
63
21
  //#region node_modules/framer-motion/dist/es/utils/is-browser.mjs
64
- var isBrowser$1 = typeof window !== "undefined";
22
+ var isBrowser$2 = typeof window !== "undefined";
65
23
  //#endregion
66
24
  //#region node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs
67
- var useIsomorphicLayoutEffect = isBrowser$1 ? useLayoutEffect : useEffect;
25
+ var useIsomorphicLayoutEffect = isBrowser$2 ? useLayoutEffect : useEffect;
68
26
  //#endregion
69
27
  //#region node_modules/framer-motion/dist/es/context/PresenceContext.mjs
70
28
  /**
@@ -851,7 +809,8 @@ function matchOrder(origin, target) {
851
809
  for (let i = 0; i < target.values.length; i++) {
852
810
  const type = target.types[i];
853
811
  const originIndex = origin.indexes[type][pointers[type]];
854
- orderedOrigin[i] = origin.values[originIndex] ?? 0;
812
+ const originValue = origin.values[originIndex] ?? 0;
813
+ orderedOrigin[i] = originValue;
855
814
  pointers[type]++;
856
815
  }
857
816
  return orderedOrigin;
@@ -1281,7 +1240,10 @@ function createMixers(output, ease, customMixer) {
1281
1240
  const numMixers = output.length - 1;
1282
1241
  for (let i = 0; i < numMixers; i++) {
1283
1242
  let mixer = mixerFactory(output[i], output[i + 1]);
1284
- if (ease) mixer = pipe(Array.isArray(ease) ? ease[i] || noop : ease, mixer);
1243
+ if (ease) {
1244
+ const easingFunction = Array.isArray(ease) ? ease[i] || noop : ease;
1245
+ mixer = pipe(easingFunction, mixer);
1246
+ }
1285
1247
  mixers.push(mixer);
1286
1248
  }
1287
1249
  return mixers;
@@ -1372,7 +1334,11 @@ function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "e
1372
1334
  done: false,
1373
1335
  value: keyframeValues[0]
1374
1336
  };
1375
- const mapTimeToKeyframe = interpolate(convertOffsetToTimes(times && times.length === keyframeValues.length ? times : defaultOffset(keyframeValues), duration), keyframeValues, { ease: Array.isArray(easingFunctions) ? easingFunctions : defaultEasing(keyframeValues, easingFunctions) });
1337
+ /**
1338
+ * Create a times array based on the provided 0-1 offsets
1339
+ */
1340
+ const absoluteTimes = convertOffsetToTimes(times && times.length === keyframeValues.length ? times : defaultOffset(keyframeValues), duration);
1341
+ const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, { ease: Array.isArray(easingFunctions) ? easingFunctions : defaultEasing(keyframeValues, easingFunctions) });
1376
1342
  return {
1377
1343
  calculatedDuration: duration,
1378
1344
  next: (t) => {
@@ -2382,7 +2348,8 @@ var acceleratedValues = new Set([
2382
2348
  "opacity",
2383
2349
  "clipPath",
2384
2350
  "filter",
2385
- "transform"
2351
+ "transform",
2352
+ "backgroundColor"
2386
2353
  ]);
2387
2354
  //#endregion
2388
2355
  //#region node_modules/motion-dom/dist/es/animation/waapi/utils/is-browser-color.mjs
@@ -2408,13 +2375,15 @@ var colorProperties = new Set([
2408
2375
  var supportsWaapi = memo$1(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
2409
2376
  function supportsBrowserAnimation(options) {
2410
2377
  const { motionValue, name, repeatDelay, repeatType, damping, type, keyframes } = options;
2378
+ const subject = motionValue?.owner?.current;
2411
2379
  /**
2412
- * We use this check instead of isHTMLElement() because we explicitly
2413
- * **don't** want elements in different timing contexts (i.e. popups)
2414
- * to be accelerated, as it's not possible to sync these animations
2415
- * properly with those driven from the main window frameloop.
2380
+ * We use instanceof checks instead of isHTMLElement()/isSVGElement()
2381
+ * because we explicitly **don't** want elements in different timing
2382
+ * contexts (i.e. popups) to be accelerated, as it's not possible to sync
2383
+ * these animations properly with those driven from the main window
2384
+ * frameloop.
2416
2385
  */
2417
- if (!(motionValue?.owner?.current instanceof HTMLElement)) return false;
2386
+ if (!(subject instanceof HTMLElement) && !(subject instanceof SVGElement)) return false;
2418
2387
  const { onUpdate, transformTemplate } = motionValue.owner.getProps();
2419
2388
  return supportsWaapi() && name && (acceleratedValues.has(name) || colorProperties.has(name) && hasBrowserOnlyColors(keyframes)) && (name !== "transform" || !transformTemplate) && !onUpdate && !repeatDelay && repeatType !== "mirror" && damping !== 0 && type !== "inertia";
2420
2389
  }
@@ -3160,6 +3129,7 @@ function getOptimisedAppearId(visualElement) {
3160
3129
  }
3161
3130
  //#endregion
3162
3131
  //#region node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs
3132
+ var isBrowser$1 = typeof window !== "undefined";
3163
3133
  /**
3164
3134
  * Decide whether we should block this animation. Previously, we achieved this
3165
3135
  * just by checking whether the key was listed in protectedKeys, but this
@@ -3206,7 +3176,7 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
3206
3176
  * to see if we're handling off from an existing animation.
3207
3177
  */
3208
3178
  let isHandoff = false;
3209
- if (window.MotionHandoffAnimation) {
3179
+ if (isBrowser$1 && window.MotionHandoffAnimation) {
3210
3180
  const appearId = getOptimisedAppearId(visualElement);
3211
3181
  if (appearId) {
3212
3182
  const startTime = window.MotionHandoffAnimation(appearId, key, frame);
@@ -3676,14 +3646,15 @@ function isDragActive() {
3676
3646
  //#endregion
3677
3647
  //#region node_modules/motion-dom/dist/es/gestures/drag/state/set-active.mjs
3678
3648
  function setDragLock(axis) {
3679
- if (axis === "x" || axis === "y") if (isDragging[axis]) return null;
3680
- else {
3681
- isDragging[axis] = true;
3682
- return () => {
3683
- isDragging[axis] = false;
3684
- };
3685
- }
3686
- else if (isDragging.x || isDragging.y) return null;
3649
+ if (axis === "x" || axis === "y") {
3650
+ if (isDragging[axis]) return null;
3651
+ else {
3652
+ isDragging[axis] = true;
3653
+ return () => {
3654
+ isDragging[axis] = false;
3655
+ };
3656
+ }
3657
+ } else if (isDragging.x || isDragging.y) return null;
3687
3658
  else {
3688
3659
  isDragging.x = isDragging.y = true;
3689
3660
  return () => {
@@ -4147,19 +4118,20 @@ function updateMotionValuesFromProps(element, next, prev) {
4147
4118
  * create a new motion value from that
4148
4119
  */
4149
4120
  element.addValue(key, motionValue(nextValue, { owner: element }));
4150
- else if (prevValue !== nextValue)
4151
- /**
4152
- * If this is a flat value that has changed, update the motion value
4153
- * or create one if it doesn't exist. We only want to do this if we're
4154
- * not handling the value with our animation state.
4155
- */
4156
- if (element.hasValue(key)) {
4157
- const existingValue = element.getValue(key);
4158
- if (existingValue.liveStyle === true) existingValue.jump(nextValue);
4159
- else if (!existingValue.hasAnimated) existingValue.set(nextValue);
4160
- } else {
4161
- const latestValue = element.getStaticValue(key);
4162
- element.addValue(key, motionValue(latestValue !== void 0 ? latestValue : nextValue, { owner: element }));
4121
+ else if (prevValue !== nextValue) {
4122
+ /**
4123
+ * If this is a flat value that has changed, update the motion value
4124
+ * or create one if it doesn't exist. We only want to do this if we're
4125
+ * not handling the value with our animation state.
4126
+ */
4127
+ if (element.hasValue(key)) {
4128
+ const existingValue = element.getValue(key);
4129
+ if (existingValue.liveStyle === true) existingValue.jump(nextValue);
4130
+ else if (!existingValue.hasAnimated) existingValue.set(nextValue);
4131
+ } else {
4132
+ const latestValue = element.getStaticValue(key);
4133
+ element.addValue(key, motionValue(latestValue !== void 0 ? latestValue : nextValue, { owner: element }));
4134
+ }
4163
4135
  }
4164
4136
  }
4165
4137
  for (const key in prev) if (next[key] === void 0) element.removeValue(key);
@@ -4983,8 +4955,10 @@ var correctBorderRadius = { correct: (latest, node) => {
4983
4955
  * If latest is a string, if it's a percentage we can return immediately as it's
4984
4956
  * going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.
4985
4957
  */
4986
- if (typeof latest === "string") if (px.test(latest)) latest = parseFloat(latest);
4987
- else return latest;
4958
+ if (typeof latest === "string") {
4959
+ if (px.test(latest)) latest = parseFloat(latest);
4960
+ else return latest;
4961
+ }
4988
4962
  return `${pixelsToPercent(latest, node.target.x)}% ${pixelsToPercent(latest, node.target.y)}%`;
4989
4963
  } };
4990
4964
  //#endregion
@@ -5049,6 +5023,15 @@ var HTMLVisualElement = class extends DOMVisualElement {
5049
5023
  this.type = "html";
5050
5024
  this.renderInstance = renderHTML;
5051
5025
  }
5026
+ mount(instance) {
5027
+ /**
5028
+ * If a custom component forwards its ref to something other than a
5029
+ * HTML/SVG element (a class instance, an imperative handle) there's
5030
+ * nothing for Motion to style, measure or attach gestures to. #2777
5031
+ */
5032
+ invariant(Boolean(instance.style), "motion.create() components must forward their ref to a HTML or SVG element", "custom-component-ref");
5033
+ super.mount(instance);
5034
+ }
5052
5035
  readValueFromInstance(instance, key) {
5053
5036
  if (transformProps.has(key)) return this.projection?.isProjecting ? defaultTransformValue(key) : readTransformValue(instance, key);
5054
5037
  else {
@@ -5095,10 +5078,9 @@ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true
5095
5078
  }
5096
5079
  //#endregion
5097
5080
  //#region node_modules/motion-dom/dist/es/render/svg/utils/build-attrs.mjs
5098
- /**
5099
- * CSS Motion Path properties that should remain as CSS styles on SVG elements.
5100
- */
5101
- var cssMotionPathProperties = [
5081
+ var cssStyleProperties = [
5082
+ "transform",
5083
+ "opacity",
5102
5084
  "offsetDistance",
5103
5085
  "offsetPath",
5104
5086
  "offsetRotate",
@@ -5120,13 +5102,9 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, pathLength, pathSpacing
5120
5102
  state.attrs = state.style;
5121
5103
  state.style = {};
5122
5104
  const { attrs, style } = state;
5123
- /**
5124
- * However, we apply transforms as CSS transforms.
5125
- * So if we detect a transform, transformOrigin we take it from attrs and copy it into style.
5126
- */
5127
- if (attrs.transform) {
5128
- style.transform = attrs.transform;
5129
- delete attrs.transform;
5105
+ for (const key of cssStyleProperties) if (attrs[key] !== void 0) {
5106
+ style[key] = attrs[key];
5107
+ delete attrs[key];
5130
5108
  }
5131
5109
  if (style.transform || attrs.transformOrigin) {
5132
5110
  style.transformOrigin = attrs.transformOrigin ?? "50% 50%";
@@ -5140,10 +5118,6 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, pathLength, pathSpacing
5140
5118
  style.transformBox = styleProp?.transformBox ?? "fill-box";
5141
5119
  delete attrs.transformBox;
5142
5120
  }
5143
- for (const key of cssMotionPathProperties) if (attrs[key] !== void 0) {
5144
- style[key] = attrs[key];
5145
- delete attrs[key];
5146
- }
5147
5121
  if (attrX !== void 0) attrs.x = attrX;
5148
5122
  if (attrY !== void 0) attrs.y = attrY;
5149
5123
  if (attrScale !== void 0) attrs.scale = attrScale;
@@ -5215,6 +5189,10 @@ var SVGVisualElement = class extends DOMVisualElement {
5215
5189
  const defaultType = getDefaultValueType(key);
5216
5190
  return defaultType ? defaultType.default || 0 : 0;
5217
5191
  }
5192
+ if (cssStyleProperties.includes(key)) {
5193
+ const value = getComputedStyle(instance)[key];
5194
+ if (typeof value === "string" && value) return value.trim();
5195
+ }
5218
5196
  key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
5219
5197
  return instance.getAttribute(key);
5220
5198
  }
@@ -5439,9 +5417,10 @@ function createAnimationState(visualElement) {
5439
5417
  let valueHasChanged = false;
5440
5418
  if (isKeyframesTarget(next) && isKeyframesTarget(prev)) valueHasChanged = !shallowCompare(next, prev) || variantDidChange;
5441
5419
  else valueHasChanged = next !== prev;
5442
- if (valueHasChanged) if (next !== void 0 && next !== null) markToAnimate(key);
5443
- else removedKeys.add(key);
5444
- else if (next !== void 0 && removedKeys.has(key))
5420
+ if (valueHasChanged) {
5421
+ if (next !== void 0 && next !== null) markToAnimate(key);
5422
+ else removedKeys.add(key);
5423
+ } else if (next !== void 0 && removedKeys.has(key))
5445
5424
  /**
5446
5425
  * If next hasn't changed and it isn't undefined, we want to check if it's
5447
5426
  * been removed by a higher priority
@@ -6597,8 +6576,10 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
6597
6576
  * a relativeParent. This will allow a component to perform scale correction
6598
6577
  * even if no animation has started.
6599
6578
  */
6600
- if (!this.targetDelta && !this.relativeTarget) if (this.options.layoutAnchor !== false && relativeParent && relativeParent.layout) this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);
6601
- else this.removeRelativeTarget();
6579
+ if (!this.targetDelta && !this.relativeTarget) {
6580
+ if (this.options.layoutAnchor !== false && relativeParent && relativeParent.layout) this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);
6581
+ else this.removeRelativeTarget();
6582
+ }
6602
6583
  /**
6603
6584
  * If we have no relative target or no target delta our target isn't valid
6604
6585
  * for this frame.
@@ -7380,7 +7361,16 @@ function PopChild({ children, isPresent, anchorX, anchorY, root, pop }) {
7380
7361
  direction: "ltr"
7381
7362
  });
7382
7363
  const { nonce } = useContext(MotionConfigContext);
7383
- const composedRef = useComposedRefs(ref, children.props?.ref ?? children?.ref);
7364
+ /**
7365
+ * In React 19, refs are passed via props.ref instead of element.ref.
7366
+ * We check props.ref first (React 19) and fall back to element.ref (React 18).
7367
+ *
7368
+ * The composed ref is only used when popping the child out (pop !== false),
7369
+ * so we avoid reading children.props.ref otherwise. In React 18.3 that read
7370
+ * triggers a spurious "`ref` is not a prop" warning getter (#3745).
7371
+ */
7372
+ const childRef = pop !== false ? children.props?.ref ?? children?.ref : void 0;
7373
+ const composedRef = useComposedRefs(ref, childRef);
7384
7374
  /**
7385
7375
  * We create and inject a style block so we can apply this explicit
7386
7376
  * sizing in a non-destructive manner by just deleting the style block.
@@ -7613,6 +7603,14 @@ var AnimatePresence = ({ children, custom, initial = true, onExitComplete, prese
7613
7603
  */
7614
7604
  const [diffedChildren, setDiffedChildren] = useState(presentChildren);
7615
7605
  const [renderedChildren, setRenderedChildren] = useState(presentChildren);
7606
+ useIsomorphicLayoutEffect(() => {
7607
+ if (propagate && !isParentPresent && !renderedChildren.length) safeToRemove?.();
7608
+ }, [
7609
+ isParentPresent,
7610
+ propagate,
7611
+ renderedChildren.length,
7612
+ safeToRemove
7613
+ ]);
7616
7614
  useIsomorphicLayoutEffect(() => {
7617
7615
  isInitialRender.current = false;
7618
7616
  pendingPresentChildren.current = presentChildren;
@@ -7639,14 +7637,20 @@ var AnimatePresence = ({ children, custom, initial = true, onExitComplete, prese
7639
7637
  /**
7640
7638
  * Loop through all the currently rendered components and decide which
7641
7639
  * are exiting.
7640
+ *
7641
+ * Exiting children are reinserted directly after the child they
7642
+ * previously followed. Splicing at their index within the previously
7643
+ * rendered children, as we used to, indexes into the wrong list: it
7644
+ * can interleave them with entering children and push present children
7645
+ * to new positions, remounting them (#3746).
7642
7646
  */
7643
- for (let i = 0; i < renderedChildren.length; i++) {
7644
- const child = renderedChildren[i];
7645
- const key = getChildKey(child);
7646
- if (!presentKeys.includes(key)) {
7647
- nextChildren.splice(i, 0, child);
7647
+ let insertionIndex = 0;
7648
+ for (const child of renderedChildren) {
7649
+ const presentIndex = presentKeys.indexOf(getChildKey(child));
7650
+ if (presentIndex === -1) {
7651
+ nextChildren.splice(insertionIndex++, 0, child);
7648
7652
  exitingChildren.push(child);
7649
- }
7653
+ } else insertionIndex = presentIndex + exitingChildren.length + 1;
7650
7654
  }
7651
7655
  /**
7652
7656
  * If we're in "wait" mode, and we have exiting children, we want to
@@ -7775,105 +7779,6 @@ function loadFeatures(features) {
7775
7779
  setFeatureDefinitions(featureDefinitions);
7776
7780
  }
7777
7781
  //#endregion
7778
- //#region node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs
7779
- /**
7780
- * A list of all valid MotionProps.
7781
- *
7782
- * @privateRemarks
7783
- * This doesn't throw if a `MotionProp` name is missing - it should.
7784
- */
7785
- var validMotionProps = new Set([
7786
- "animate",
7787
- "exit",
7788
- "variants",
7789
- "initial",
7790
- "style",
7791
- "values",
7792
- "variants",
7793
- "transition",
7794
- "transformTemplate",
7795
- "custom",
7796
- "inherit",
7797
- "onBeforeLayoutMeasure",
7798
- "onAnimationStart",
7799
- "onAnimationComplete",
7800
- "onUpdate",
7801
- "onDragStart",
7802
- "onDrag",
7803
- "onDragEnd",
7804
- "onMeasureDragConstraints",
7805
- "onDirectionLock",
7806
- "onDragTransitionEnd",
7807
- "_dragX",
7808
- "_dragY",
7809
- "onHoverStart",
7810
- "onHoverEnd",
7811
- "onViewportEnter",
7812
- "onViewportLeave",
7813
- "globalTapTarget",
7814
- "propagate",
7815
- "ignoreStrict",
7816
- "viewport"
7817
- ]);
7818
- /**
7819
- * Check whether a prop name is a valid `MotionProp` key.
7820
- *
7821
- * @param key - Name of the property to check
7822
- * @returns `true` is key is a valid `MotionProp`.
7823
- *
7824
- * @public
7825
- */
7826
- function isValidMotionProp(key) {
7827
- return key.startsWith("while") || key.startsWith("drag") && key !== "draggable" || key.startsWith("layout") || key.startsWith("onTap") || key.startsWith("onPan") || key.startsWith("onLayout") || validMotionProps.has(key);
7828
- }
7829
- //#endregion
7830
- //#region __vite-optional-peer-dep:@emotion/is-prop-valid:framer-motion
7831
- var is_prop_valid_framer_motion_exports = __exportAll({ default: () => is_prop_valid_framer_motion_default });
7832
- var is_prop_valid_framer_motion_default;
7833
- var init_is_prop_valid_framer_motion = __esmMin((() => {
7834
- is_prop_valid_framer_motion_default = {};
7835
- throw new Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`);
7836
- }));
7837
- //#endregion
7838
- //#region node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs
7839
- var shouldForward = (key) => !isValidMotionProp(key);
7840
- function loadExternalIsValidProp(isValidProp) {
7841
- if (typeof isValidProp !== "function") return;
7842
- shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
7843
- }
7844
- /**
7845
- * Emotion and Styled Components both allow users to pass through arbitrary props to their components
7846
- * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
7847
- * of these should be passed to the underlying DOM node.
7848
- *
7849
- * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
7850
- * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
7851
- * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
7852
- * `@emotion/is-prop-valid`, however to fix this problem we need to use it.
7853
- *
7854
- * By making it an optionalDependency we can offer this functionality only in the situations where it's
7855
- * actually required.
7856
- */
7857
- try {
7858
- loadExternalIsValidProp((init_is_prop_valid_framer_motion(), __toCommonJS(is_prop_valid_framer_motion_exports)).default);
7859
- } catch {}
7860
- function filterProps(props, isDom, forwardMotionProps) {
7861
- const filteredProps = {};
7862
- for (const key in props) {
7863
- /**
7864
- * values is considered a valid prop by Emotion, so if it's present
7865
- * this will be rendered out to the DOM unless explicitly filtered.
7866
- *
7867
- * We check the type as it could be used with the `feColorMatrix`
7868
- * element, which we support.
7869
- */
7870
- if (key === "values" && typeof props.values === "object") continue;
7871
- if (isMotionValue(props[key])) continue;
7872
- if (shouldForward(key) || forwardMotionProps === true && isValidMotionProp(key) || !isDom && !isValidMotionProp(key) || props["draggable"] && key.startsWith("onDrag")) filteredProps[key] = props[key];
7873
- }
7874
- return filteredProps;
7875
- }
7876
- //#endregion
7877
7782
  //#region node_modules/framer-motion/dist/es/context/MotionContext/index.mjs
7878
7783
  var MotionContext = createContext({});
7879
7784
  //#endregion
@@ -7970,6 +7875,79 @@ function useSVGProps(props, visualState, _isStatic, Component) {
7970
7875
  return visualProps;
7971
7876
  }
7972
7877
  //#endregion
7878
+ //#region node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs
7879
+ /**
7880
+ * A list of all valid MotionProps.
7881
+ *
7882
+ * @privateRemarks
7883
+ * This doesn't throw if a `MotionProp` name is missing - it should.
7884
+ */
7885
+ var validMotionProps = new Set([
7886
+ "animate",
7887
+ "exit",
7888
+ "variants",
7889
+ "initial",
7890
+ "style",
7891
+ "values",
7892
+ "variants",
7893
+ "transition",
7894
+ "transformTemplate",
7895
+ "custom",
7896
+ "inherit",
7897
+ "onBeforeLayoutMeasure",
7898
+ "onAnimationStart",
7899
+ "onAnimationComplete",
7900
+ "onUpdate",
7901
+ "onDragStart",
7902
+ "onDrag",
7903
+ "onDragEnd",
7904
+ "onMeasureDragConstraints",
7905
+ "onDirectionLock",
7906
+ "onDragTransitionEnd",
7907
+ "_dragX",
7908
+ "_dragY",
7909
+ "onHoverStart",
7910
+ "onHoverEnd",
7911
+ "onViewportEnter",
7912
+ "onViewportLeave",
7913
+ "globalTapTarget",
7914
+ "propagate",
7915
+ "ignoreStrict",
7916
+ "viewport"
7917
+ ]);
7918
+ /**
7919
+ * Check whether a prop name is a valid `MotionProp` key.
7920
+ *
7921
+ * @param key - Name of the property to check
7922
+ * @returns `true` is key is a valid `MotionProp`.
7923
+ *
7924
+ * @public
7925
+ */
7926
+ function isValidMotionProp(key) {
7927
+ return key.startsWith("while") || key.startsWith("drag") && key !== "draggable" || key.startsWith("layout") || key.startsWith("onTap") || key.startsWith("onPan") || key.startsWith("onLayout") || validMotionProps.has(key);
7928
+ }
7929
+ //#endregion
7930
+ //#region node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs
7931
+ function shouldForward(key, isValidProp) {
7932
+ return key.startsWith("on") ? !isValidMotionProp(key) : isValidProp?.(key) ?? !isValidMotionProp(key);
7933
+ }
7934
+ function filterProps(props, isDom, forwardMotionProps, isValidProp) {
7935
+ const filteredProps = {};
7936
+ for (const key in props) {
7937
+ /**
7938
+ * values is considered a valid prop by Emotion, so if it's present
7939
+ * this will be rendered out to the DOM unless explicitly filtered.
7940
+ *
7941
+ * We check the type as it could be used with the `feColorMatrix`
7942
+ * element, which we support.
7943
+ */
7944
+ if (key === "values" && typeof props.values === "object") continue;
7945
+ if (isMotionValue(props[key])) continue;
7946
+ if (shouldForward(key, isValidProp) || forwardMotionProps === true && isValidMotionProp(key) || !isDom && !isValidMotionProp(key) || props["draggable"] && key.startsWith("onDrag")) filteredProps[key] = props[key];
7947
+ }
7948
+ return filteredProps;
7949
+ }
7950
+ //#endregion
7973
7951
  //#region node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs
7974
7952
  /**
7975
7953
  * We keep these listed separately as we use the lowercase tag names as part
@@ -8011,9 +7989,9 @@ function isSVGComponent(Component) {
8011
7989
  }
8012
7990
  //#endregion
8013
7991
  //#region node_modules/framer-motion/dist/es/render/dom/use-render.mjs
8014
- function useRender(Component, props, ref, { latestValues }, isStatic, forwardMotionProps = false, isSVG) {
7992
+ function useRender(Component, props, ref, { latestValues }, isStatic, forwardMotionProps = false, isSVG, isValidProp) {
8015
7993
  const visualProps = (isSVG ?? isSVGComponent(Component) ? useSVGProps : useHTMLProps)(props, latestValues, isStatic, Component);
8016
- const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
7994
+ const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps, isValidProp);
8017
7995
  const elementProps = Component !== Fragment ? {
8018
7996
  ...filteredProps,
8019
7997
  ...visualProps,
@@ -8121,14 +8099,15 @@ function useMotionRef(visualState, visualElement, externalRef) {
8121
8099
  if (instance) visualState.onMount?.(instance);
8122
8100
  if (visualElement) instance ? visualElement.mount(instance) : visualElement.unmount();
8123
8101
  const ref = externalRefContainer.current;
8124
- if (typeof ref === "function") if (instance) {
8125
- const cleanup = ref(instance);
8126
- if (typeof cleanup === "function") refCleanup.current = cleanup;
8127
- } else if (refCleanup.current) {
8128
- refCleanup.current();
8129
- refCleanup.current = null;
8130
- } else ref(instance);
8131
- else if (ref) ref.current = instance;
8102
+ if (typeof ref === "function") {
8103
+ if (instance) {
8104
+ const cleanup = ref(instance);
8105
+ if (typeof cleanup === "function") refCleanup.current = cleanup;
8106
+ } else if (refCleanup.current) {
8107
+ refCleanup.current();
8108
+ refCleanup.current = null;
8109
+ } else ref(instance);
8110
+ } else if (ref) ref.current = instance;
8132
8111
  }, [visualElement]);
8133
8112
  }
8134
8113
  //#endregion
@@ -8299,7 +8278,7 @@ function createMotionComponent(Component, { forwardMotionProps = false, type } =
8299
8278
  ...props,
8300
8279
  layoutId: useLayoutId(props)
8301
8280
  };
8302
- const { isStatic } = configAndProps;
8281
+ const { isStatic, isValidProp } = configAndProps;
8303
8282
  const context = useCreateMotionContext(props);
8304
8283
  const visualState = useVisualState(props, isStatic);
8305
8284
  if (!isStatic && typeof window !== "undefined") {
@@ -8323,7 +8302,7 @@ function createMotionComponent(Component, { forwardMotionProps = false, type } =
8323
8302
  children: [MeasureLayout && context.visualElement ? jsx(MeasureLayout, {
8324
8303
  visualElement: context.visualElement,
8325
8304
  ...configAndProps
8326
- }) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, forwardMotionProps, isSVG)]
8305
+ }) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, forwardMotionProps, isSVG, isValidProp)]
8327
8306
  });
8328
8307
  }
8329
8308
  MotionDOMComponent.displayName = `motion.${typeof Component === "string" ? Component : `create(${Component.displayName ?? Component.name ?? ""})`}`;