beez-ui 0.5.5 → 0.6.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.
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ import { c as _c } from "react/compiler-runtime";
3
+ /** Adds a gliding active-item indicator to the original container, without DOM wrappers. */
4
+ import { useLayoutEffect } from "react";
5
+ import { Slot } from "radix-ui";
6
+ import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
7
+ import { attachGlideIndicator, GLIDE_PRESETS } from "./glide-indicator.js";
8
+ import { useAttachedElement } from "./use-attached-element.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ /** Composes refs through Radix Slot and glides the preset's highlight between its items. */
11
+ export function GlideSlot(t0) {
12
+ const $ = _c(14);
13
+ let children;
14
+ let preset;
15
+ let props;
16
+ let ref;
17
+ if ($[0] !== t0) {
18
+ ({children, preset, ref, ...props} = t0);
19
+ $[0] = t0;
20
+ $[1] = children;
21
+ $[2] = preset;
22
+ $[3] = props;
23
+ $[4] = ref;
24
+ } else {
25
+ children = $[1];
26
+ preset = $[2];
27
+ props = $[3];
28
+ ref = $[4];
29
+ }
30
+ const [element, attach] = useAttachedElement(ref);
31
+ const reduceMotion = usePrefersReducedMotion();
32
+ let t1;
33
+ let t2;
34
+ if ($[5] !== element || $[6] !== preset || $[7] !== reduceMotion) {
35
+ t1 = () => {
36
+ if (!element || reduceMotion) {
37
+ return;
38
+ }
39
+ return attachGlideIndicator(element, GLIDE_PRESETS[preset]);
40
+ };
41
+ t2 = [
42
+ element,
43
+ preset,
44
+ reduceMotion
45
+ ];
46
+ $[5] = element;
47
+ $[6] = preset;
48
+ $[7] = reduceMotion;
49
+ $[8] = t1;
50
+ $[9] = t2;
51
+ } else {
52
+ t1 = $[8];
53
+ t2 = $[9];
54
+ }
55
+ useLayoutEffect(t1, t2);
56
+ let t3;
57
+ if ($[10] !== attach || $[11] !== children || $[12] !== props) {
58
+ t3 = /* @__PURE__ */ _jsx(Slot.Root, {
59
+ ...props,
60
+ ref: attach,
61
+ children
62
+ });
63
+ $[10] = attach;
64
+ $[11] = children;
65
+ $[12] = props;
66
+ $[13] = t3;
67
+ } else {
68
+ t3 = $[13];
69
+ }
70
+ return t3;
71
+ }