@vkzstudio/muza-ui 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/Button.js +19 -19
- package/dist/components/Button/ButtonLoader.d.ts +7 -0
- package/dist/components/Button/ButtonLoader.d.ts.map +1 -0
- package/dist/components/Button/ButtonLoader.js +40 -0
- package/dist/components/Icons/CustomIcons.js +1 -1
- package/dist/components/ReorderableTable/ReorderableTable.js +1 -1
- package/dist/components/SwipeButton/SwipeButton.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/animation/animate/resolve-subjects.js +4 -4
- package/dist/node_modules/framer-motion/dist/es/animation/animate/subject.js +24 -24
- package/dist/node_modules/framer-motion/dist/es/animation/sequence/create.js +61 -56
- package/dist/node_modules/framer-motion/dist/es/animation/utils/create-visual-element.js +8 -8
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +32 -30
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +22 -22
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +34 -32
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/Group.js +34 -26
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/Item.js +30 -25
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/utils/auto-scroll.js +64 -0
- package/dist/node_modules/framer-motion/dist/es/context/MotionContext/utils.js +2 -2
- package/dist/node_modules/framer-motion/dist/es/events/add-pointer-event.js +3 -3
- package/dist/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.js +100 -89
- package/dist/node_modules/framer-motion/dist/es/gestures/drag/index.js +11 -7
- package/dist/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.js +4 -4
- package/dist/node_modules/framer-motion/dist/es/gestures/focus.js +2 -2
- package/dist/node_modules/framer-motion/dist/es/gestures/hover.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.js +106 -59
- package/dist/node_modules/framer-motion/dist/es/gestures/pan/index.js +6 -6
- package/dist/node_modules/framer-motion/dist/es/gestures/press.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/animation/exit.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/animation/index.js +5 -5
- package/dist/node_modules/framer-motion/dist/es/motion/features/definitions.js +18 -6
- package/dist/node_modules/framer-motion/dist/es/motion/features/drag.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.js +27 -42
- package/dist/node_modules/framer-motion/dist/es/motion/features/layout.js +4 -4
- package/dist/node_modules/framer-motion/dist/es/motion/features/load-features.js +10 -7
- package/dist/node_modules/framer-motion/dist/es/motion/features/viewport/index.js +4 -4
- package/dist/node_modules/framer-motion/dist/es/motion/index.js +49 -49
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.js +18 -13
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.js +41 -40
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.js +13 -13
- package/dist/node_modules/framer-motion/dist/es/render/dom/create-visual-element.js +6 -6
- package/dist/node_modules/framer-motion/dist/es/render/dom/use-render.js +12 -12
- package/dist/node_modules/framer-motion/dist/es/render/html/use-html-visual-state.js +3 -3
- package/dist/node_modules/framer-motion/dist/es/render/html/use-props.js +7 -7
- package/dist/node_modules/framer-motion/dist/es/render/svg/use-props.js +5 -5
- package/dist/node_modules/framer-motion/dist/es/render/svg/use-svg-visual-state.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/value/use-transform.js +26 -18
- package/dist/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.js +33 -30
- package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimation.js +17 -17
- package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimationExtended.js +20 -19
- package/dist/node_modules/motion-dom/dist/es/animation/animate/single-value.js +10 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/motion-value.js +13 -13
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/visual-element-target.js +11 -11
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.js +24 -20
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/utils/default-transitions.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/utils/is-css-variable.js +7 -3
- package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js +1 -1
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/animation/mix-values.js +2 -2
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/delta-apply.js +4 -4
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/delta-calc.js +1 -1
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/delta-remove.js +6 -6
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/DocumentProjectionNode.js +7 -4
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/create-projection-node.js +149 -149
- package/dist/node_modules/motion-dom/dist/es/projection/shared/stack.js +60 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/styles/scale-border-radius.js +1 -1
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/styles/scale-box-shadow.js +2 -2
- package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.js +21 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/VisualElement.js +58 -50
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/dom/DOMVisualElement.js +7 -6
- package/dist/node_modules/motion-dom/dist/es/render/dom/utils/camel-to-dash.js +6 -0
- package/dist/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.js +38 -0
- package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-styles.js +29 -0
- package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-transform.js +37 -0
- package/dist/node_modules/motion-dom/dist/es/render/html/utils/scrape-motion-values.js +14 -0
- package/dist/node_modules/motion-dom/dist/es/render/svg/SVGVisualElement.js +40 -0
- package/dist/node_modules/motion-dom/dist/es/render/svg/utils/build-attrs.js +32 -0
- package/dist/node_modules/motion-dom/dist/es/render/svg/utils/path.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/render/svg/utils/scrape-motion-values.js +15 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/animation-state.js +31 -31
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/is-controlling-variants.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/utils/is-forced-motion-value.js +9 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/motion-values.js +6 -6
- package/dist/node_modules/motion-dom/dist/es/render/utils/reduced-motion/index.js +15 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/setters.js +4 -4
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/utils/delay.js +2 -2
- package/dist/node_modules/motion-dom/dist/es/utils/resolve-elements.js +8 -6
- package/dist/node_modules/motion-dom/dist/es/value/types/maps/number.js +62 -42
- package/dist/node_modules/motion-dom/dist/es/value/utils/resolve-motion-value.js +7 -0
- package/dist/node_modules/motion-dom/dist/es/value/will-change/is.js +7 -0
- package/dist/node_modules/motion-utils/dist/es/errors.js +10 -9
- package/package.json +1 -1
- package/dist/node_modules/framer-motion/dist/es/animation/animate/single-value.js +0 -10
- package/dist/node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.js +0 -8
- package/dist/node_modules/framer-motion/dist/es/projection/shared/stack.js +0 -58
- package/dist/node_modules/framer-motion/dist/es/projection/styles/scale-correction.js +0 -10
- package/dist/node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.js +0 -4
- package/dist/node_modules/framer-motion/dist/es/render/html/HTMLVisualElement.js +0 -38
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/build-styles.js +0 -29
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/build-transform.js +0 -31
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.js +0 -12
- package/dist/node_modules/framer-motion/dist/es/render/svg/SVGVisualElement.js +0 -40
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.js +0 -23
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/path.js +0 -18
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.js +0 -15
- package/dist/node_modules/framer-motion/dist/es/utils/reduced-motion/index.js +0 -13
- package/dist/node_modules/framer-motion/dist/es/value/use-will-change/is.js +0 -7
- package/dist/node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.js +0 -7
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/visual-element-variant.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/visual-element.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/optimized-appear/data-id.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/optimized-appear/get-appear-id.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/utils/calc-child-stagger.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/animation/animators/waapi → motion-dom/dist/es/animation}/utils/get-final-keyframe.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/utils/is-transition-defined.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/events/add-dom-event.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/conversion.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/copy.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/models.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/utils.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/HTMLProjectionNode.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/state.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/styles/transform.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/render → motion-dom/dist/es/projection}/utils/compare-by-depth.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/utils/each-axis.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/render → motion-dom/dist/es/projection}/utils/flat-tree.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/utils/has-transform.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/utils/measure.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/motion/features → motion-dom/dist/es/render}/Feature.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/html/utils/render.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/object/ObjectVisualElement.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/store.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/svg/utils/camel-case-attrs.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/svg/utils/is-svg-tag.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/svg/utils/render.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/get-variant-context.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/animation → motion-dom/dist/es/render}/utils/is-animation-controls.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/animation → motion-dom/dist/es/render}/utils/is-keyframes-target.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/is-variant-label.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es → motion-dom/dist/es/render}/utils/reduced-motion/state.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/resolve-dynamic-variants.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/resolve-variants.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es → motion-dom/dist/es/render}/utils/shallow-compare.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/variant-props.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/value/use-will-change → motion-dom/dist/es/value/will-change}/add-will-change.js +0 -0
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as F, useRef as
|
|
1
|
+
import { jsx as k, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as F, useRef as p, useState as v, useContext as G } from "react";
|
|
3
3
|
import { LayoutGroupContext as O } from "../../context/LayoutGroupContext.js";
|
|
4
4
|
import { useConstant as R } from "../../utils/use-constant.js";
|
|
5
|
-
import { useIsomorphicLayoutEffect as
|
|
6
|
-
import { PresenceChild as
|
|
7
|
-
import { usePresence as
|
|
8
|
-
import { onlyElements as
|
|
9
|
-
const
|
|
10
|
-
const [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
for (let t = 0; t <
|
|
14
|
-
const e = c(
|
|
15
|
-
o.includes(e) ?
|
|
5
|
+
import { useIsomorphicLayoutEffect as V } from "../../utils/use-isomorphic-effect.js";
|
|
6
|
+
import { PresenceChild as X } from "./PresenceChild.js";
|
|
7
|
+
import { usePresence as _ } from "./use-presence.js";
|
|
8
|
+
import { onlyElements as A, getChildKey as c } from "./utils.js";
|
|
9
|
+
const W = ({ children: C, custom: L, initial: b = !0, onExitComplete: y, presenceAffectsLayout: j = !0, mode: u = "sync", propagate: l = !1, anchorX: D = "left", anchorY: I = "top", root: K }) => {
|
|
10
|
+
const [x, f] = _(l), n = F(() => A(C), [C]), o = l && !x ? [] : n.map(c), g = p(!0), P = p(n), i = R(() => /* @__PURE__ */ new Map()), d = p(/* @__PURE__ */ new Set()), [M, N] = v(n), [r, w] = v(n);
|
|
11
|
+
V(() => {
|
|
12
|
+
g.current = !1, P.current = n;
|
|
13
|
+
for (let t = 0; t < r.length; t++) {
|
|
14
|
+
const e = c(r[t]);
|
|
15
|
+
o.includes(e) ? (i.delete(e), d.current.delete(e)) : i.get(e) !== !0 && i.set(e, !1);
|
|
16
16
|
}
|
|
17
|
-
}, [
|
|
18
|
-
const
|
|
19
|
-
if (n !==
|
|
17
|
+
}, [r, o.length, o.join("-")]);
|
|
18
|
+
const m = [];
|
|
19
|
+
if (n !== M) {
|
|
20
20
|
let t = [...n];
|
|
21
|
-
for (let e = 0; e <
|
|
22
|
-
const s =
|
|
23
|
-
o.includes(
|
|
21
|
+
for (let e = 0; e < r.length; e++) {
|
|
22
|
+
const s = r[e], h = c(s);
|
|
23
|
+
o.includes(h) || (t.splice(e, 0, s), m.push(s));
|
|
24
24
|
}
|
|
25
|
-
return u === "wait" &&
|
|
25
|
+
return u === "wait" && m.length && (t = m), w(A(t)), N(n), null;
|
|
26
26
|
}
|
|
27
|
-
process.env.NODE_ENV !== "production" && u === "wait" &&
|
|
28
|
-
const { forceRender:
|
|
29
|
-
return
|
|
30
|
-
const e = c(t), s = l && !
|
|
31
|
-
if (
|
|
32
|
-
|
|
27
|
+
process.env.NODE_ENV !== "production" && u === "wait" && r.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
|
|
28
|
+
const { forceRender: a } = G(O);
|
|
29
|
+
return k(Y, { children: r.map((t) => {
|
|
30
|
+
const e = c(t), s = l && !x ? !1 : n === r || o.includes(e), h = () => {
|
|
31
|
+
if (d.current.has(e))
|
|
32
|
+
return;
|
|
33
|
+
if (d.current.add(e), i.has(e))
|
|
34
|
+
i.set(e, !0);
|
|
33
35
|
else
|
|
34
36
|
return;
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}),
|
|
37
|
+
let E = !0;
|
|
38
|
+
i.forEach((S) => {
|
|
39
|
+
S || (E = !1);
|
|
40
|
+
}), E && (a == null || a(), w(P.current), l && (f == null || f()), y && y());
|
|
39
41
|
};
|
|
40
|
-
return
|
|
42
|
+
return k(X, { isPresent: s, initial: !g.current || b ? void 0 : !1, custom: L, presenceAffectsLayout: j, mode: u, root: K, onExitComplete: s ? void 0 : h, anchorX: D, anchorY: I, children: t }, e);
|
|
41
43
|
}) });
|
|
42
44
|
};
|
|
43
45
|
export {
|
|
44
|
-
|
|
46
|
+
W as AnimatePresence
|
|
45
47
|
};
|
|
@@ -1,38 +1,46 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { ReorderContext as
|
|
4
|
-
import { motion as
|
|
5
|
-
import { useConstant as
|
|
6
|
-
import { checkReorder as
|
|
7
|
-
import { invariant as
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as w, useRef as a, useEffect as G } from "react";
|
|
3
|
+
import { ReorderContext as O } from "../../context/ReorderContext.js";
|
|
4
|
+
import { motion as x } from "../../render/components/motion/proxy.js";
|
|
5
|
+
import { useConstant as I } from "../../utils/use-constant.js";
|
|
6
|
+
import { checkReorder as S } from "./utils/check-reorder.js";
|
|
7
|
+
import { invariant as b } from "../../../../../motion-utils/dist/es/errors.js";
|
|
8
|
+
function j({ children: e, as: c = "ul", axis: f = "y", onReorder: v, values: d, ...m }, t) {
|
|
9
|
+
const y = I(() => x[c]), o = [], s = a(!1), p = a(null);
|
|
10
|
+
b(!!d, "Reorder.Group must be provided a values prop", "reorder-values");
|
|
11
11
|
const R = {
|
|
12
12
|
axis: f,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
groupRef: p,
|
|
14
|
+
registerItem: (r, n) => {
|
|
15
|
+
const u = o.findIndex((i) => r === i.value);
|
|
16
|
+
u !== -1 ? o[u].layout = n[f] : o.push({ value: r, layout: n[f] }), o.sort(A);
|
|
16
17
|
},
|
|
17
|
-
updateOrder: (
|
|
18
|
-
if (
|
|
18
|
+
updateOrder: (r, n, u) => {
|
|
19
|
+
if (s.current)
|
|
19
20
|
return;
|
|
20
|
-
const i =
|
|
21
|
-
|
|
21
|
+
const i = S(o, r, n, u);
|
|
22
|
+
o !== i && (s.current = !0, v(i.map(k).filter((C) => d.indexOf(C) !== -1)));
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
25
|
+
G(() => {
|
|
26
|
+
s.current = !1;
|
|
27
|
+
});
|
|
28
|
+
const g = (r) => {
|
|
29
|
+
p.current = r, typeof t == "function" ? t(r) : t && (t.current = r);
|
|
30
|
+
}, h = {
|
|
31
|
+
overflowAnchor: "none",
|
|
32
|
+
...m.style
|
|
33
|
+
};
|
|
34
|
+
return l(y, { ...m, style: h, ref: g, ignoreStrict: !0, children: l(O.Provider, { value: R, children: e }) });
|
|
27
35
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
36
|
+
const D = /* @__PURE__ */ w(j);
|
|
37
|
+
function k(e) {
|
|
30
38
|
return e.value;
|
|
31
39
|
}
|
|
32
|
-
function
|
|
33
|
-
return e.layout.min -
|
|
40
|
+
function A(e, c) {
|
|
41
|
+
return e.layout.min - c.layout.min;
|
|
34
42
|
}
|
|
35
43
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
D as ReorderGroup,
|
|
45
|
+
j as ReorderGroupComponent
|
|
38
46
|
};
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { ReorderContext as
|
|
4
|
-
import { motion as
|
|
5
|
-
import { useConstant as
|
|
6
|
-
import { useMotionValue as
|
|
7
|
-
import { useTransform as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as V, useContext as O } from "react";
|
|
3
|
+
import { ReorderContext as T } from "../../context/ReorderContext.js";
|
|
4
|
+
import { motion as b } from "../../render/components/motion/proxy.js";
|
|
5
|
+
import { useConstant as j } from "../../utils/use-constant.js";
|
|
6
|
+
import { useMotionValue as w } from "../../value/use-motion-value.js";
|
|
7
|
+
import { useTransform as z } from "../../value/use-transform.js";
|
|
8
|
+
import { autoScrollIfNeeded as A, resetAutoScrollState as B } from "./utils/auto-scroll.js";
|
|
9
|
+
import { isMotionValue as D } from "../../../../../motion-dom/dist/es/value/utils/is-motion-value.js";
|
|
10
|
+
import { invariant as G } from "../../../../../motion-utils/dist/es/errors.js";
|
|
11
|
+
function a(i, e = 0) {
|
|
12
|
+
return D(i) ? i : w(e);
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
x:
|
|
16
|
-
y:
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
const { axis:
|
|
20
|
-
return
|
|
21
|
-
const { velocity:
|
|
22
|
-
|
|
23
|
-
},
|
|
14
|
+
function L({ children: i, style: e = {}, value: m, as: c = "li", onDrag: u, onDragEnd: f, layout: d = !0, ...l }, x) {
|
|
15
|
+
const y = j(() => b[c]), s = O(T), n = {
|
|
16
|
+
x: a(e.x),
|
|
17
|
+
y: a(e.y)
|
|
18
|
+
}, R = z([n.x, n.y], ([o, t]) => o || t ? 1 : "unset");
|
|
19
|
+
G(!!s, "Reorder.Item must be a child of Reorder.Group", "reorder-item-child");
|
|
20
|
+
const { axis: r, registerItem: g, updateOrder: I, groupRef: C } = s;
|
|
21
|
+
return h(y, { drag: r, ...l, dragSnapToOrigin: !0, style: { ...e, x: n.x, y: n.y, zIndex: R }, layout: d, onDrag: (o, t) => {
|
|
22
|
+
const { velocity: p, point: S } = t, M = n[r].get();
|
|
23
|
+
I(m, M, p[r]), A(C.current, S[r], r, p[r]), u && u(o, t);
|
|
24
|
+
}, onDragEnd: (o, t) => {
|
|
25
|
+
B(), f && f(o, t);
|
|
26
|
+
}, onLayoutMeasure: (o) => {
|
|
27
|
+
g(m, o);
|
|
28
|
+
}, ref: x, ignoreStrict: !0, children: i });
|
|
24
29
|
}
|
|
25
|
-
const
|
|
30
|
+
const Q = /* @__PURE__ */ V(L);
|
|
26
31
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
Q as ReorderItem,
|
|
33
|
+
L as ReorderItemComponent
|
|
29
34
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const g = /* @__PURE__ */ new Set(["auto", "scroll"]), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap();
|
|
2
|
+
let i = null;
|
|
3
|
+
function p() {
|
|
4
|
+
if (i) {
|
|
5
|
+
const o = f(i, "y");
|
|
6
|
+
o && (d.delete(o), u.delete(o));
|
|
7
|
+
const l = f(i, "x");
|
|
8
|
+
l && l !== o && (d.delete(l), u.delete(l)), i = null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function m(o, l) {
|
|
12
|
+
const t = getComputedStyle(o), n = l === "x" ? t.overflowX : t.overflowY;
|
|
13
|
+
return g.has(n);
|
|
14
|
+
}
|
|
15
|
+
function f(o, l) {
|
|
16
|
+
let t = o == null ? void 0 : o.parentElement;
|
|
17
|
+
for (; t; ) {
|
|
18
|
+
if (m(t, l))
|
|
19
|
+
return t;
|
|
20
|
+
t = t.parentElement;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function w(o, l, t) {
|
|
25
|
+
const n = l.getBoundingClientRect(), e = t === "x" ? n.left : n.top, a = t === "x" ? n.right : n.bottom, c = o - e, r = a - o;
|
|
26
|
+
if (c < 50) {
|
|
27
|
+
const s = 1 - c / 50;
|
|
28
|
+
return { amount: -25 * s * s, edge: "start" };
|
|
29
|
+
} else if (r < 50) {
|
|
30
|
+
const s = 1 - r / 50;
|
|
31
|
+
return { amount: 25 * s * s, edge: "end" };
|
|
32
|
+
}
|
|
33
|
+
return { amount: 0, edge: null };
|
|
34
|
+
}
|
|
35
|
+
function A(o, l, t, n) {
|
|
36
|
+
if (!o)
|
|
37
|
+
return;
|
|
38
|
+
i = o;
|
|
39
|
+
const e = f(o, t);
|
|
40
|
+
if (!e)
|
|
41
|
+
return;
|
|
42
|
+
const a = l - (t === "x" ? window.scrollX : window.scrollY), { amount: c, edge: r } = w(a, e, t);
|
|
43
|
+
if (r === null) {
|
|
44
|
+
d.delete(e), u.delete(e);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (d.get(e) !== r) {
|
|
48
|
+
if (!(r === "start" && n < 0 || r === "end" && n > 0))
|
|
49
|
+
return;
|
|
50
|
+
d.set(e, r);
|
|
51
|
+
const h = t === "x" ? e.scrollWidth - e.clientWidth : e.scrollHeight - e.clientHeight;
|
|
52
|
+
u.set(e, h);
|
|
53
|
+
}
|
|
54
|
+
if (c > 0) {
|
|
55
|
+
const S = u.get(e);
|
|
56
|
+
if ((t === "x" ? e.scrollLeft : e.scrollTop) >= S)
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
t === "x" ? e.scrollLeft += c : e.scrollTop += c;
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
A as autoScrollIfNeeded,
|
|
63
|
+
p as resetAutoScrollState
|
|
64
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isControllingVariants as r } from "
|
|
2
|
-
import { isVariantLabel as e } from "
|
|
1
|
+
import { isControllingVariants as r } from "../../../../../motion-dom/dist/es/render/utils/is-controlling-variants.js";
|
|
2
|
+
import { isVariantLabel as e } from "../../../../../motion-dom/dist/es/render/utils/is-variant-label.js";
|
|
3
3
|
function o(i, a) {
|
|
4
4
|
if (r(i)) {
|
|
5
5
|
const { initial: n, animate: t } = i;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { addPointerInfo as d } from "./event-info.js";
|
|
2
|
+
import { addDomEvent as e } from "../../../../motion-dom/dist/es/events/add-dom-event.js";
|
|
3
3
|
function f(o, r, t, n) {
|
|
4
|
-
return
|
|
4
|
+
return e(o, r, d(t), n);
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
7
|
f as addPointerEvent
|