beez-ui 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +45 -47
  3. package/dist/components/account-menu.js +1 -1
  4. package/dist/components/alert.js +3 -7
  5. package/dist/components/animated-collapse.js +51 -38
  6. package/dist/components/animated-list-item.js +33 -34
  7. package/dist/components/animated-theme-toggler.d.ts +5 -1
  8. package/dist/components/animated-theme-toggler.js +75 -120
  9. package/dist/components/badge.js +7 -11
  10. package/dist/components/card.js +13 -16
  11. package/dist/components/dialog-surface.js +8 -21
  12. package/dist/components/filter-query-bar.js +7 -11
  13. package/dist/components/input-group.js +5 -9
  14. package/dist/components/input.js +8 -12
  15. package/dist/components/label.js +4 -8
  16. package/dist/components/link.d.ts +1 -0
  17. package/dist/components/link.js +2 -16
  18. package/dist/components/presence-swap.d.ts +1 -1
  19. package/dist/components/presence-swap.js +44 -32
  20. package/dist/components/primitives/avatar.js +8 -10
  21. package/dist/components/primitives/dropdown-menu.d.ts +2 -2
  22. package/dist/components/primitives/dropdown-menu.js +8 -5
  23. package/dist/components/primitives/select.d.ts +2 -1
  24. package/dist/components/primitives/select.js +104 -83
  25. package/dist/components/reaction-button.d.ts +5 -6
  26. package/dist/components/reaction-button.js +139 -75
  27. package/dist/components/rich-link-editor.js +1 -1
  28. package/dist/components/separator.js +5 -9
  29. package/dist/components/sheet.js +8 -11
  30. package/dist/components/sidebar.d.ts +6 -6
  31. package/dist/components/sidebar.js +221 -184
  32. package/dist/components/svgs/whatsappIcon.js +10 -14
  33. package/dist/components/table.js +4 -8
  34. package/dist/components/textarea.js +7 -11
  35. package/dist/components/themed-toaster.js +28 -62
  36. package/dist/constants/avatar.d.ts +6 -1
  37. package/dist/constants/avatar.js +6 -0
  38. package/dist/constants/dropdown-menu.d.ts +6 -1
  39. package/dist/constants/dropdown-menu.js +33 -1
  40. package/dist/constants/popover.js +2 -8
  41. package/dist/constants/select.d.ts +3 -1
  42. package/dist/constants/select.js +30 -1
  43. package/dist/motion/arc-tokens.d.ts +6 -0
  44. package/dist/motion/arc-tokens.js +6 -0
  45. package/dist/motion/glide-indicator.d.ts +6 -21
  46. package/dist/motion/glide-indicator.js +8 -17
  47. package/dist/motion/motion-slot.d.ts +6 -3
  48. package/dist/motion/motion-slot.js +100 -411
  49. package/dist/motion/presence.d.ts +8 -0
  50. package/dist/motion/presence.js +11 -1
  51. package/dist/motion/surface-keyframes.d.ts +2 -2
  52. package/dist/motion/surface-keyframes.js +40 -141
  53. package/dist/motion/tokens.d.ts +10 -114
  54. package/dist/motion/tokens.js +11 -116
  55. package/dist/styles.css +1 -1
  56. package/package.json +1 -1
  57. package/dist/motion/shared-layout-bg.d.ts +0 -16
  58. package/dist/motion/shared-layout-bg.js +0 -181
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beez-ui",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "Shared UI components with the customizations extracted from TuTribu.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -1,16 +0,0 @@
1
- import { type ComponentProps } from "react";
2
- export type SharedLayoutBgProps = ComponentProps<"ul"> & {
3
- /** Classes of the moving pill. */
4
- pillClassName?: string;
5
- /** Positioning override for the pill wrapper inside each item. */
6
- pillContainerClassName?: string;
7
- /** Horizontal distance, in pixels, the pill extends past each row. */
8
- inset?: number;
9
- };
10
- /**
11
- * Renders a list whose items share one hover pill that glides between them.
12
- * Each child element receives the pill behind its content, so children should be list items.
13
- * @param props - List attributes, pill styling and the items to decorate.
14
- * @returns The decorated list.
15
- */
16
- export declare function SharedLayoutBg({ children, className, onMouseLeave, pillClassName, pillContainerClassName, inset, ...props }: SharedLayoutBgProps): import("react").JSX.Element;
@@ -1,181 +0,0 @@
1
- "use client";
2
- import { c as _c } from "react/compiler-runtime";
3
- /** Follows the hovered item of a list with one shared background pill, as in beui.dev. */
4
- import { AnimatePresence, motion } from "motion/react";
5
- import { Children, cloneElement, isValidElement, useId, useState } from "react";
6
- import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
7
- import { cn } from "../lib/utils.js";
8
- import { MOTION_REVEAL_BLUR_PX, SPRING_LAYOUT } from "./tokens.js";
9
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
- /** Horizontal distance, in pixels, the pill extends past each row by default. */
11
- const DEFAULT_PILL_INSET_PX = 20;
12
- const PILL_BLUR = `blur(${MOTION_REVEAL_BLUR_PX}px)`;
13
- /** The pill fades in blurred, and only blurs out when the pointer leaves the whole list. */
14
- const PILL_VARIANTS = {
15
- initial: {
16
- opacity: 0,
17
- filter: PILL_BLUR
18
- },
19
- animate: {
20
- opacity: 1,
21
- filter: "blur(0px)"
22
- },
23
- exit: (isHovering) => isHovering ? {} : {
24
- opacity: 0,
25
- filter: PILL_BLUR
26
- }
27
- };
28
- /** With reduced motion the pill appears and leaves at once, like other pointer highlights. */
29
- const REDUCED_PILL_VARIANTS = {
30
- initial: { opacity: 0 },
31
- animate: {
32
- opacity: 1,
33
- transition: { duration: 0 }
34
- },
35
- exit: (isHovering) => isHovering ? {} : {
36
- opacity: 0,
37
- transition: { duration: 0 }
38
- }
39
- };
40
- /**
41
- * Renders a list whose items share one hover pill that glides between them.
42
- * Each child element receives the pill behind its content, so children should be list items.
43
- * @param props - List attributes, pill styling and the items to decorate.
44
- * @returns The decorated list.
45
- */
46
- export function SharedLayoutBg(t0) {
47
- const $ = _c(34);
48
- let children;
49
- let className;
50
- let onMouseLeave;
51
- let pillClassName;
52
- let pillContainerClassName;
53
- let props;
54
- let t1;
55
- if ($[0] !== t0) {
56
- ({children, className, onMouseLeave, pillClassName, pillContainerClassName, inset: t1, ...props} = t0);
57
- $[0] = t0;
58
- $[1] = children;
59
- $[2] = className;
60
- $[3] = onMouseLeave;
61
- $[4] = pillClassName;
62
- $[5] = pillContainerClassName;
63
- $[6] = props;
64
- $[7] = t1;
65
- } else {
66
- children = $[1];
67
- className = $[2];
68
- onMouseLeave = $[3];
69
- pillClassName = $[4];
70
- pillContainerClassName = $[5];
71
- props = $[6];
72
- t1 = $[7];
73
- }
74
- const inset = t1 === undefined ? DEFAULT_PILL_INSET_PX : t1;
75
- const [hoveredKey, setHoveredKey] = useState(null);
76
- const layoutId = useId();
77
- const shouldReduceMotion = usePrefersReducedMotion();
78
- const isHovering = hoveredKey !== null;
79
- let t2;
80
- if ($[8] !== children || $[9] !== hoveredKey || $[10] !== inset || $[11] !== isHovering || $[12] !== layoutId || $[13] !== pillClassName || $[14] !== pillContainerClassName || $[15] !== shouldReduceMotion) {
81
- let t3;
82
- if ($[17] !== hoveredKey || $[18] !== inset || $[19] !== isHovering || $[20] !== layoutId || $[21] !== pillClassName || $[22] !== pillContainerClassName || $[23] !== shouldReduceMotion) {
83
- t3 = (child, index) => {
84
- const item = child;
85
- const itemKey = item.key === null ? `item-${index}` : String(item.key);
86
- return cloneElement(item, {
87
- key: itemKey,
88
- className: cn("relative", item.props.className),
89
- onMouseEnter: (event) => {
90
- item.props.onMouseEnter?.(event);
91
- setHoveredKey(itemKey);
92
- }
93
- }, /* @__PURE__ */ _jsxs(_Fragment, { children: [/* @__PURE__ */ _jsx(AnimatePresence, {
94
- custom: isHovering,
95
- children: isHovering ? /* @__PURE__ */ _jsx(motion.div, {
96
- variants: shouldReduceMotion ? REDUCED_PILL_VARIANTS : PILL_VARIANTS,
97
- initial: "initial",
98
- animate: "animate",
99
- exit: "exit",
100
- custom: isHovering,
101
- className: cn("pointer-events-none absolute inset-y-0", pillContainerClassName),
102
- style: {
103
- left: -inset,
104
- right: -inset
105
- },
106
- children: hoveredKey === itemKey ? /* @__PURE__ */ _jsx(motion.div, {
107
- "data-slot": "shared-layout-pill",
108
- layoutId: `shared-layout-bg-${layoutId}`,
109
- transition: shouldReduceMotion ? { duration: 0 } : SPRING_LAYOUT,
110
- className: cn("pointer-events-none size-full rounded-2xl bg-muted/80", pillClassName)
111
- }) : null
112
- }) : null
113
- }), /* @__PURE__ */ _jsx("div", {
114
- className: "relative z-10",
115
- children: item.props.children
116
- })] }));
117
- };
118
- $[17] = hoveredKey;
119
- $[18] = inset;
120
- $[19] = isHovering;
121
- $[20] = layoutId;
122
- $[21] = pillClassName;
123
- $[22] = pillContainerClassName;
124
- $[23] = shouldReduceMotion;
125
- $[24] = t3;
126
- } else {
127
- t3 = $[24];
128
- }
129
- t2 = Children.toArray(children).filter(isValidElement).map(t3);
130
- $[8] = children;
131
- $[9] = hoveredKey;
132
- $[10] = inset;
133
- $[11] = isHovering;
134
- $[12] = layoutId;
135
- $[13] = pillClassName;
136
- $[14] = pillContainerClassName;
137
- $[15] = shouldReduceMotion;
138
- $[16] = t2;
139
- } else {
140
- t2 = $[16];
141
- }
142
- const items = t2;
143
- const t3 = props;
144
- let t4;
145
- if ($[25] !== onMouseLeave) {
146
- t4 = (event_0) => {
147
- setHoveredKey(null);
148
- onMouseLeave?.(event_0);
149
- };
150
- $[25] = onMouseLeave;
151
- $[26] = t4;
152
- } else {
153
- t4 = $[26];
154
- }
155
- let t5;
156
- if ($[27] !== className) {
157
- t5 = cn("flex w-full flex-col", className);
158
- $[27] = className;
159
- $[28] = t5;
160
- } else {
161
- t5 = $[28];
162
- }
163
- let t6;
164
- if ($[29] !== items || $[30] !== t3 || $[31] !== t4 || $[32] !== t5) {
165
- t6 = /* @__PURE__ */ _jsx(motion.ul, {
166
- ...t3,
167
- layoutRoot: true,
168
- onMouseLeave: t4,
169
- className: t5,
170
- children: items
171
- });
172
- $[29] = items;
173
- $[30] = t3;
174
- $[31] = t4;
175
- $[32] = t5;
176
- $[33] = t6;
177
- } else {
178
- t6 = $[33];
179
- }
180
- return t6;
181
- }