beez-ui 0.5.2 → 0.5.4
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/CHANGELOG.md +8 -0
- package/README.md +66 -3
- package/dist/components/alert-dialog.js +72 -28
- package/dist/components/alert.js +9 -5
- package/dist/components/animated-theme-toggler.js +113 -97
- package/dist/components/avatar.js +22 -15
- package/dist/components/badge.js +9 -5
- package/dist/components/button.js +11 -7
- package/dist/components/card.js +9 -5
- package/dist/components/carousel.js +59 -55
- package/dist/components/checkbox.js +16 -9
- package/dist/components/dialog.js +77 -33
- package/dist/components/dropdown-menu.js +126 -49
- package/dist/components/form.js +16 -9
- package/dist/components/highlighter.js +18 -12
- package/dist/components/hover-card.js +60 -21
- package/dist/components/input-group.js +9 -5
- package/dist/components/input.js +9 -5
- package/dist/components/label.js +8 -4
- package/dist/components/link.d.ts +0 -1
- package/dist/components/link.js +28 -20
- package/dist/components/popover.js +66 -25
- package/dist/components/radio-group.js +16 -9
- package/dist/components/select.js +34 -24
- package/dist/components/separator.js +9 -5
- package/dist/components/sheet.js +78 -34
- package/dist/components/sidebar.js +21 -14
- package/dist/components/skeleton.js +8 -4
- package/dist/components/svgs/whatsappIcon.js +14 -9
- package/dist/components/switch.js +16 -9
- package/dist/components/table.js +8 -4
- package/dist/components/tabs.js +15 -8
- package/dist/components/textarea.js +8 -4
- package/dist/components/themed-toaster.js +61 -27
- package/dist/components/tooltip.js +70 -29
- package/dist/components/typing-animation.js +80 -58
- package/dist/constants/motion.d.ts +2 -0
- package/dist/constants/motion.js +2 -0
- package/dist/hooks/use-prefers-reduced-motion.d.ts +2 -0
- package/dist/hooks/use-prefers-reduced-motion.js +27 -0
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/motion/motion-slot.d.ts +9 -0
- package/dist/motion/motion-slot.js +353 -0
- package/dist/motion/presence.d.ts +33 -0
- package/dist/motion/presence.js +92 -0
- package/dist/motion/tokens.d.ts +13 -0
- package/dist/motion/tokens.js +17 -0
- package/dist/providers/beez-ui-provider.js +7 -3
- package/dist/styles.css +1 -1
- package/package.json +13 -5
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -2,13 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
Biblioteca de componentes React reutilizables, con adaptadores opcionales por framework y tema compartido. Reúne los componentes de LaTribu y las funcionalidades reutilizables de agenda-mensual.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Storybook
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm storybook
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Abre `http://localhost:6006` para explorar los componentes con controles de texto,
|
|
12
|
+
variantes, tamaños, estados y comportamiento. El selector de la barra permite
|
|
13
|
+
probar el tema claro, oscuro o del sistema. Las stories de componentes compuestos
|
|
14
|
+
incluyen sus piezas en ejemplos completos; los campos editables y selectores
|
|
15
|
+
sincronizan sus interacciones con Controls. `BeezUIProvider` configura el preview
|
|
16
|
+
y no forma parte del catálogo. Las notificaciones se exploran en `ThemedToaster`,
|
|
17
|
+
sin duplicar una story de `Toaster`; `WhatsappIcon` está en la sección `Icons`.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm build-storybook # Genera storybook-static para servirlo o publicarlo
|
|
21
|
+
pnpm typecheck:stories # Comprueba stories y configuración con TypeScript
|
|
22
|
+
pnpm test:storybook # Build y navegación/interacciones en Chromium y WebKit
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
El catálogo consume los exports públicos y el CSS compilado de la librería. Los
|
|
26
|
+
scripts compilan `beez-ui` antes de arrancar; si editás sus fuentes con Storybook
|
|
27
|
+
abierto, ejecutá `pnpm build` para actualizar el paquete que muestra el preview.
|
|
28
|
+
Los cambios en las stories se actualizan durante el desarrollo. Storybook y sus
|
|
29
|
+
addons son dependencias de desarrollo y no se incluyen en el paquete publicado.
|
|
30
|
+
|
|
31
|
+
Configuración basada en [React con Vite](https://storybook.js.org/docs/get-started/frameworks/react-vite)
|
|
32
|
+
y [Controls](https://storybook.js.org/docs/essentials/controls).
|
|
33
|
+
|
|
34
|
+
## Uso del paquete
|
|
6
35
|
|
|
7
36
|
```tsx
|
|
8
37
|
import { Button, Avatar, AvatarImage, DataTable, Calendar } from "beez-ui";
|
|
9
38
|
```
|
|
10
39
|
|
|
11
|
-
Agrupar los imports de componentes desde la raíz. El paquete publica JavaScript ESM y declaraciones TypeScript en `dist`; el consumidor no necesita transpilar el código fuente de la librería. La gramática de filtros y los helpers de mes-año son independientes de React.
|
|
40
|
+
Agrupar los imports de componentes desde la raíz. El paquete publica JavaScript ESM y declaraciones TypeScript en `dist`; el consumidor no necesita transpilar el código fuente de la librería. La gramática de filtros y los helpers de mes-año son independientes de React.
|
|
41
|
+
|
|
42
|
+
La utilidad `cn`, también exportada desde `beez-ui`, usa el paquete `cn` para combinar clases condicionales y resolver conflictos de Tailwind.
|
|
12
43
|
|
|
13
44
|
```css
|
|
14
45
|
@import "beez-ui/styles.css";
|
|
@@ -24,7 +55,39 @@ Los componentes usan por defecto los espaciados compactos de Agenda: `Select` mi
|
|
|
24
55
|
|
|
25
56
|
Los `Sheet` superiores e inferiores limitan su altura al viewport dinámico (`100dvh`) y permiten desplazar el contenido para mantener accesibles las acciones de paneles largos.
|
|
26
57
|
|
|
27
|
-
##
|
|
58
|
+
## Movimiento
|
|
59
|
+
|
|
60
|
+
Las nuevas animaciones usan la dependencia `motion`: `animate` controla la
|
|
61
|
+
reproducción, `hover` y `press` los gestos, y `AnimatePresence` / `usePresence`
|
|
62
|
+
retienen los overlays durante su salida. Los presets y tiempos viven en
|
|
63
|
+
`src/motion/`. No se usan keyframes CSS para estas animaciones.
|
|
64
|
+
|
|
65
|
+
`MotionSlot` anima el nodo original del primitive mediante refs compuestos,
|
|
66
|
+
sin agregar wrappers al DOM ni reemplazar sus handlers. Las pulsaciones reducen
|
|
67
|
+
la escala a 0.98; cards y enlaces responden al hover; campos e indicadores
|
|
68
|
+
responden al foco y la selección. Menús, popovers, diálogos y sheets usan entradas
|
|
69
|
+
cortas y salidas de 120 ms. El skeleton pulsa con Motion. Las animaciones
|
|
70
|
+
especializadas existentes de Embla, Sonner y rough-notation se conservan.
|
|
71
|
+
|
|
72
|
+
El contenido que está saliendo deja de ser interactivo y accesible de inmediato.
|
|
73
|
+
Cada familia de overlays tiene un contexto de visibilidad independiente para
|
|
74
|
+
soportar composiciones anidadas; los portales sin nodo visible no bloquean el
|
|
75
|
+
cierre del padre. `Select` conserva su desmontaje nativo y usa Motion en la entrada.
|
|
76
|
+
La elección explícita de `forceMount` permanece bajo control del consumidor.
|
|
77
|
+
|
|
78
|
+
Se respeta `prefers-reduced-motion`: las nuevas animaciones se cancelan y se
|
|
79
|
+
restauran los estilos; las anotaciones se dibujan sin animación y el texto aparece
|
|
80
|
+
completo, incluidas todas las palabras de una secuencia. Los controles del carrusel
|
|
81
|
+
avanzan directamente. El CSS solo aporta el fallback de movimiento reducido para
|
|
82
|
+
los efectos heredados. `BeezUIProvider` configura `MotionConfig` con
|
|
83
|
+
`reducedMotion="user"`. El primer render conserva el contrato de SSR.
|
|
84
|
+
|
|
85
|
+
El selector aplica el tema inmediatamente y anima su icono con Motion; no depende
|
|
86
|
+
de View Transitions nativas ni de una animación para completar el cambio. Los estilos temporales se liberan al terminar
|
|
87
|
+
la reproducción. Las stories permiten probar los gestos y estados reales; el
|
|
88
|
+
selector de tema de la story y la barra de Storybook se mantienen sincronizados.
|
|
89
|
+
|
|
90
|
+
## Providers de UI
|
|
28
91
|
|
|
29
92
|
Elegir un único `BeezUIProvider` según el framework. Los componentes y `useTheme` siempre se importan desde `beez-ui`.
|
|
30
93
|
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
|
|
5
|
+
import { MotionSlot } from "../motion/motion-slot.js";
|
|
6
|
+
import { MotionPresence, MotionOpenProvider, useMotionOpenState } from "../motion/presence.js";
|
|
5
7
|
import { cn } from "../lib/utils.js";
|
|
6
8
|
import { Button } from "./button.js";
|
|
7
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
10
|
function AlertDialog(t0) {
|
|
9
|
-
const $ = _c(
|
|
11
|
+
const $ = _c(9);
|
|
10
12
|
let props;
|
|
11
13
|
if ($[0] !== t0) {
|
|
12
14
|
({...props} = t0);
|
|
@@ -15,18 +17,36 @@ function AlertDialog(t0) {
|
|
|
15
17
|
} else {
|
|
16
18
|
props = $[1];
|
|
17
19
|
}
|
|
20
|
+
const [motionOpen, setMotionOpen] = useMotionOpenState(props);
|
|
18
21
|
let t1;
|
|
19
|
-
if ($[2] !== props) {
|
|
22
|
+
if ($[2] !== motionOpen || $[3] !== props || $[4] !== setMotionOpen) {
|
|
20
23
|
t1 = /* @__PURE__ */ _jsx(AlertDialogPrimitive.Root, {
|
|
21
24
|
"data-slot": "alert-dialog",
|
|
22
|
-
...props
|
|
25
|
+
...props,
|
|
26
|
+
open: motionOpen,
|
|
27
|
+
onOpenChange: setMotionOpen
|
|
23
28
|
});
|
|
24
|
-
$[2] =
|
|
25
|
-
$[3] =
|
|
29
|
+
$[2] = motionOpen;
|
|
30
|
+
$[3] = props;
|
|
31
|
+
$[4] = setMotionOpen;
|
|
32
|
+
$[5] = t1;
|
|
26
33
|
} else {
|
|
27
|
-
t1 = $[
|
|
34
|
+
t1 = $[5];
|
|
28
35
|
}
|
|
29
|
-
|
|
36
|
+
let t2;
|
|
37
|
+
if ($[6] !== motionOpen || $[7] !== t1) {
|
|
38
|
+
t2 = /* @__PURE__ */ _jsx(MotionOpenProvider, {
|
|
39
|
+
scope: "alert-dialog",
|
|
40
|
+
open: motionOpen,
|
|
41
|
+
children: t1
|
|
42
|
+
});
|
|
43
|
+
$[6] = motionOpen;
|
|
44
|
+
$[7] = t1;
|
|
45
|
+
$[8] = t2;
|
|
46
|
+
} else {
|
|
47
|
+
t2 = $[8];
|
|
48
|
+
}
|
|
49
|
+
return t2;
|
|
30
50
|
}
|
|
31
51
|
function AlertDialogTrigger(t0) {
|
|
32
52
|
const $ = _c(4);
|
|
@@ -89,7 +109,7 @@ function AlertDialogOverlay(t0) {
|
|
|
89
109
|
}
|
|
90
110
|
let t1;
|
|
91
111
|
if ($[3] !== className) {
|
|
92
|
-
t1 = cn("fixed inset-0 z-50 bg-black/10
|
|
112
|
+
t1 = cn("fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs ", className);
|
|
93
113
|
$[3] = className;
|
|
94
114
|
$[4] = t1;
|
|
95
115
|
} else {
|
|
@@ -116,7 +136,7 @@ function AlertDialogOverlay(t0) {
|
|
|
116
136
|
* @returns The styled primitive with its original interaction contract.
|
|
117
137
|
*/
|
|
118
138
|
function AlertDialogContent(t0) {
|
|
119
|
-
const $ = _c(
|
|
139
|
+
const $ = _c(14);
|
|
120
140
|
let className;
|
|
121
141
|
let props;
|
|
122
142
|
let t1;
|
|
@@ -132,37 +152,61 @@ function AlertDialogContent(t0) {
|
|
|
132
152
|
t1 = $[3];
|
|
133
153
|
}
|
|
134
154
|
const size = t1 === undefined ? "default" : t1;
|
|
135
|
-
|
|
155
|
+
const t2 = props.forceMount;
|
|
156
|
+
let t3;
|
|
136
157
|
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
137
|
-
|
|
138
|
-
|
|
158
|
+
t3 = /* @__PURE__ */ _jsx(MotionSlot, {
|
|
159
|
+
kind: "overlay",
|
|
160
|
+
children: /* @__PURE__ */ _jsx(AlertDialogOverlay, { forceMount: true })
|
|
161
|
+
});
|
|
162
|
+
$[4] = t3;
|
|
139
163
|
} else {
|
|
140
|
-
|
|
164
|
+
t3 = $[4];
|
|
141
165
|
}
|
|
142
|
-
let
|
|
166
|
+
let t4;
|
|
143
167
|
if ($[5] !== className) {
|
|
144
|
-
|
|
168
|
+
t4 = cn("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100svh-2rem)] overflow-y-auto overscroll-contain w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm ", className);
|
|
145
169
|
$[5] = className;
|
|
146
|
-
$[6] =
|
|
170
|
+
$[6] = t4;
|
|
147
171
|
} else {
|
|
148
|
-
|
|
172
|
+
t4 = $[6];
|
|
149
173
|
}
|
|
150
|
-
let
|
|
151
|
-
if ($[7] !== props || $[8] !== size || $[9] !==
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
174
|
+
let t5;
|
|
175
|
+
if ($[7] !== props || $[8] !== size || $[9] !== t4) {
|
|
176
|
+
t5 = /* @__PURE__ */ _jsxs(React.Fragment, { children: [t3, /* @__PURE__ */ _jsx(MotionSlot, {
|
|
177
|
+
kind: "dialog",
|
|
178
|
+
children: /* @__PURE__ */ _jsx(AlertDialogPrimitive.Content, {
|
|
179
|
+
forceMount: true,
|
|
180
|
+
"data-slot": "alert-dialog-content",
|
|
181
|
+
"data-size": size,
|
|
182
|
+
className: t4,
|
|
183
|
+
...props
|
|
184
|
+
})
|
|
157
185
|
})] });
|
|
158
186
|
$[7] = props;
|
|
159
187
|
$[8] = size;
|
|
160
|
-
$[9] =
|
|
161
|
-
$[10] =
|
|
188
|
+
$[9] = t4;
|
|
189
|
+
$[10] = t5;
|
|
190
|
+
} else {
|
|
191
|
+
t5 = $[10];
|
|
192
|
+
}
|
|
193
|
+
let t6;
|
|
194
|
+
if ($[11] !== props.forceMount || $[12] !== t5) {
|
|
195
|
+
t6 = /* @__PURE__ */ _jsx(AlertDialogPortal, {
|
|
196
|
+
forceMount: true,
|
|
197
|
+
children: /* @__PURE__ */ _jsx(MotionPresence, {
|
|
198
|
+
scope: "alert-dialog",
|
|
199
|
+
forceMount: t2,
|
|
200
|
+
children: t5
|
|
201
|
+
})
|
|
202
|
+
});
|
|
203
|
+
$[11] = props.forceMount;
|
|
204
|
+
$[12] = t5;
|
|
205
|
+
$[13] = t6;
|
|
162
206
|
} else {
|
|
163
|
-
|
|
207
|
+
t6 = $[13];
|
|
164
208
|
}
|
|
165
|
-
return
|
|
209
|
+
return t6;
|
|
166
210
|
}
|
|
167
211
|
/**
|
|
168
212
|
* Aligns confirmation headings and media with compact spacing.
|
package/dist/components/alert.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
|
+
import { MotionSlot } from "../motion/motion-slot.js";
|
|
5
6
|
import { cn } from "../lib/utils.js";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
const alertVariants = cva("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", {
|
|
@@ -38,11 +39,14 @@ function Alert(t0) {
|
|
|
38
39
|
}
|
|
39
40
|
let t2;
|
|
40
41
|
if ($[7] !== props || $[8] !== t1) {
|
|
41
|
-
t2 = /* @__PURE__ */ _jsx(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
t2 = /* @__PURE__ */ _jsx(MotionSlot, {
|
|
43
|
+
kind: "fade",
|
|
44
|
+
children: /* @__PURE__ */ _jsx("div", {
|
|
45
|
+
"data-slot": "alert",
|
|
46
|
+
role: "alert",
|
|
47
|
+
className: t1,
|
|
48
|
+
...props
|
|
49
|
+
})
|
|
46
50
|
});
|
|
47
51
|
$[7] = props;
|
|
48
52
|
$[8] = t1;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
|
-
import { useRef, useSyncExternalStore } from "react";
|
|
3
|
+
import { useEffect, useRef, useSyncExternalStore } from "react";
|
|
4
4
|
import { Monitor, Moon, Sun, SunMoon } from "lucide-react";
|
|
5
|
-
import {
|
|
5
|
+
import { animate, frame } from "motion/react";
|
|
6
|
+
import { MOTION_EASE } from "../motion/tokens.js";
|
|
6
7
|
import { useTheme } from "next-themes";
|
|
7
8
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
9
|
+
import { REDUCED_MOTION_QUERY } from "../constants/motion.js";
|
|
8
10
|
import { cn } from "../lib/utils.js";
|
|
9
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
12
|
const THEME_OPTIONS = [
|
|
@@ -24,12 +26,10 @@ const THEME_OPTIONS = [
|
|
|
24
26
|
value: "system"
|
|
25
27
|
}
|
|
26
28
|
];
|
|
27
|
-
/**
|
|
28
|
-
const
|
|
29
|
-
/** Respects user preferences when deciding whether to animate a theme change. */
|
|
30
|
-
const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
29
|
+
/** Converts the public duration (milliseconds) to Motion seconds. */
|
|
30
|
+
const MILLISECONDS_PER_SECOND = 1e3;
|
|
31
31
|
export const AnimatedThemeToggler = (t0) => {
|
|
32
|
-
const $ = _c(
|
|
32
|
+
const $ = _c(34);
|
|
33
33
|
let className;
|
|
34
34
|
let controlledOnThemeChange;
|
|
35
35
|
let controlledResolvedTheme;
|
|
@@ -62,143 +62,163 @@ export const AnimatedThemeToggler = (t0) => {
|
|
|
62
62
|
const resolvedTheme = controlledResolvedTheme ?? providerTheme.resolvedTheme;
|
|
63
63
|
const onThemeChange = controlledOnThemeChange ?? providerTheme.setTheme;
|
|
64
64
|
const buttonRef = useRef(null);
|
|
65
|
+
const animationRef = useRef(null);
|
|
66
|
+
let t2;
|
|
67
|
+
let t3;
|
|
68
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
69
|
+
t2 = () => () => {
|
|
70
|
+
animationRef.current?.cancel();
|
|
71
|
+
animationRef.current = null;
|
|
72
|
+
};
|
|
73
|
+
t3 = [];
|
|
74
|
+
$[8] = t2;
|
|
75
|
+
$[9] = t3;
|
|
76
|
+
} else {
|
|
77
|
+
t2 = $[8];
|
|
78
|
+
t3 = $[9];
|
|
79
|
+
}
|
|
80
|
+
useEffect(t2, t3);
|
|
65
81
|
const isHydrated = useSyncExternalStore(_temp2, _temp3, _temp4);
|
|
66
82
|
const isThemeReady = isHydrated && (resolvedTheme === "light" || resolvedTheme === "dark");
|
|
67
83
|
const isDark = resolvedTheme === "dark";
|
|
68
84
|
const selectedTheme = theme === "light" || theme === "dark" || theme === "system" ? theme : "system";
|
|
69
85
|
const isDisabled = !isThemeReady || disabled;
|
|
70
|
-
let
|
|
71
|
-
if ($[
|
|
72
|
-
|
|
86
|
+
let t4;
|
|
87
|
+
if ($[10] !== duration || $[11] !== isDisabled || $[12] !== onThemeChange) {
|
|
88
|
+
t4 = (nextTheme) => {
|
|
73
89
|
const button = buttonRef.current;
|
|
74
90
|
if (!button || typeof document === "undefined" || isDisabled) {
|
|
75
91
|
return;
|
|
76
92
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const viewportWidth = window.visualViewport?.width ?? window.innerWidth;
|
|
81
|
-
const viewportHeight = window.visualViewport?.height ?? window.innerHeight;
|
|
82
|
-
const maxRadius = Math.hypot(Math.max(x, viewportWidth - x), Math.max(y, viewportHeight - y));
|
|
83
|
-
const applyTheme = () => {
|
|
84
|
-
onThemeChange(nextTheme);
|
|
85
|
-
};
|
|
86
|
-
if (typeof document.startViewTransition !== "function" || typeof document.documentElement.animate !== "function" || window.matchMedia?.(REDUCED_MOTION_QUERY).matches) {
|
|
87
|
-
applyTheme();
|
|
93
|
+
onThemeChange(nextTheme);
|
|
94
|
+
animationRef.current?.cancel();
|
|
95
|
+
if (window.matchMedia?.(REDUCED_MOTION_QUERY).matches || !Number.isFinite(duration) || duration <= 0) {
|
|
88
96
|
return;
|
|
89
97
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
const original = {
|
|
99
|
+
transform: button.style.transform,
|
|
100
|
+
opacity: button.style.opacity
|
|
101
|
+
};
|
|
102
|
+
const animation = animate(button, {
|
|
103
|
+
transform: ["rotate(-8deg)", "rotate(0deg)"],
|
|
104
|
+
opacity: [.65, 1]
|
|
105
|
+
}, {
|
|
106
|
+
duration: duration / MILLISECONDS_PER_SECOND,
|
|
107
|
+
ease: [...MOTION_EASE]
|
|
93
108
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
109
|
+
animationRef.current = animation;
|
|
110
|
+
animation.then(() => frame.postRender(() => {
|
|
111
|
+
if (animationRef.current !== animation) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
button.style.transform = original.transform;
|
|
115
|
+
button.style.opacity = original.opacity;
|
|
116
|
+
animationRef.current = null;
|
|
117
|
+
}));
|
|
99
118
|
};
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
119
|
+
$[10] = duration;
|
|
120
|
+
$[11] = isDisabled;
|
|
121
|
+
$[12] = onThemeChange;
|
|
122
|
+
$[13] = t4;
|
|
104
123
|
} else {
|
|
105
|
-
|
|
124
|
+
t4 = $[13];
|
|
106
125
|
}
|
|
107
|
-
const selectTheme =
|
|
108
|
-
let
|
|
109
|
-
if ($[
|
|
110
|
-
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
126
|
+
const selectTheme = t4;
|
|
127
|
+
let t5;
|
|
128
|
+
if ($[14] !== className) {
|
|
129
|
+
t5 = cn(className);
|
|
130
|
+
$[14] = className;
|
|
131
|
+
$[15] = t5;
|
|
113
132
|
} else {
|
|
114
|
-
|
|
133
|
+
t5 = $[15];
|
|
115
134
|
}
|
|
116
|
-
let
|
|
117
|
-
if ($[
|
|
118
|
-
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
135
|
+
let t6;
|
|
136
|
+
if ($[16] !== isDark || $[17] !== isThemeReady) {
|
|
137
|
+
t6 = !isThemeReady ? /* @__PURE__ */ _jsx(SunMoon, { "aria-hidden": "true" }) : isDark ? /* @__PURE__ */ _jsx(Moon, { "aria-hidden": "true" }) : /* @__PURE__ */ _jsx(Sun, { "aria-hidden": "true" });
|
|
138
|
+
$[16] = isDark;
|
|
139
|
+
$[17] = isThemeReady;
|
|
140
|
+
$[18] = t6;
|
|
122
141
|
} else {
|
|
123
|
-
|
|
142
|
+
t6 = $[18];
|
|
124
143
|
}
|
|
125
|
-
let
|
|
126
|
-
if ($[
|
|
127
|
-
|
|
144
|
+
let t7;
|
|
145
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
146
|
+
t7 = /* @__PURE__ */ _jsx("span", {
|
|
128
147
|
className: "sr-only",
|
|
129
148
|
children: "Alternar tema"
|
|
130
149
|
});
|
|
131
|
-
$[
|
|
150
|
+
$[19] = t7;
|
|
132
151
|
} else {
|
|
133
|
-
|
|
152
|
+
t7 = $[19];
|
|
134
153
|
}
|
|
135
|
-
let
|
|
136
|
-
if ($[
|
|
137
|
-
|
|
154
|
+
let t8;
|
|
155
|
+
if ($[20] !== isDisabled || $[21] !== props || $[22] !== t5 || $[23] !== t6) {
|
|
156
|
+
t8 = /* @__PURE__ */ _jsx(DropdownMenuTrigger, {
|
|
138
157
|
asChild: true,
|
|
139
158
|
children: /* @__PURE__ */ _jsxs("button", {
|
|
140
159
|
type: "button",
|
|
141
160
|
ref: buttonRef,
|
|
142
161
|
disabled: isDisabled,
|
|
143
|
-
className:
|
|
162
|
+
className: t5,
|
|
144
163
|
...props,
|
|
145
|
-
children: [
|
|
164
|
+
children: [t6, t7]
|
|
146
165
|
})
|
|
147
166
|
});
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
167
|
+
$[20] = isDisabled;
|
|
168
|
+
$[21] = props;
|
|
169
|
+
$[22] = t5;
|
|
170
|
+
$[23] = t6;
|
|
171
|
+
$[24] = t8;
|
|
153
172
|
} else {
|
|
154
|
-
|
|
173
|
+
t8 = $[24];
|
|
155
174
|
}
|
|
156
|
-
let
|
|
157
|
-
if ($[
|
|
158
|
-
|
|
175
|
+
let t9;
|
|
176
|
+
if ($[25] !== selectTheme) {
|
|
177
|
+
t9 = (nextTheme_0) => {
|
|
159
178
|
selectTheme(nextTheme_0);
|
|
160
179
|
};
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
180
|
+
$[25] = selectTheme;
|
|
181
|
+
$[26] = t9;
|
|
163
182
|
} else {
|
|
164
|
-
|
|
183
|
+
t9 = $[26];
|
|
165
184
|
}
|
|
166
|
-
let
|
|
167
|
-
if ($[
|
|
168
|
-
|
|
169
|
-
$[
|
|
185
|
+
let t10;
|
|
186
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
187
|
+
t10 = THEME_OPTIONS.map(_temp5);
|
|
188
|
+
$[27] = t10;
|
|
170
189
|
} else {
|
|
171
|
-
|
|
190
|
+
t10 = $[27];
|
|
172
191
|
}
|
|
173
|
-
let
|
|
174
|
-
if ($[
|
|
175
|
-
|
|
192
|
+
let t11;
|
|
193
|
+
if ($[28] !== selectedTheme || $[29] !== t9) {
|
|
194
|
+
t11 = /* @__PURE__ */ _jsx(DropdownMenuContent, {
|
|
195
|
+
"data-beez-theme-menu": true,
|
|
176
196
|
align: "end",
|
|
177
197
|
className: "w-44 rounded-xl p-2",
|
|
178
198
|
side: "bottom",
|
|
179
199
|
sideOffset: 8,
|
|
180
200
|
children: /* @__PURE__ */ _jsx(DropdownMenuRadioGroup, {
|
|
181
|
-
onValueChange:
|
|
201
|
+
onValueChange: t9,
|
|
182
202
|
value: selectedTheme,
|
|
183
|
-
children:
|
|
203
|
+
children: t10
|
|
184
204
|
})
|
|
185
205
|
});
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
206
|
+
$[28] = selectedTheme;
|
|
207
|
+
$[29] = t9;
|
|
208
|
+
$[30] = t11;
|
|
189
209
|
} else {
|
|
190
|
-
|
|
210
|
+
t11 = $[30];
|
|
191
211
|
}
|
|
192
|
-
let
|
|
193
|
-
if ($[
|
|
194
|
-
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
212
|
+
let t12;
|
|
213
|
+
if ($[31] !== t11 || $[32] !== t8) {
|
|
214
|
+
t12 = /* @__PURE__ */ _jsxs(DropdownMenu, { children: [t8, t11] });
|
|
215
|
+
$[31] = t11;
|
|
216
|
+
$[32] = t8;
|
|
217
|
+
$[33] = t12;
|
|
198
218
|
} else {
|
|
199
|
-
|
|
219
|
+
t12 = $[33];
|
|
200
220
|
}
|
|
201
|
-
return
|
|
221
|
+
return t12;
|
|
202
222
|
};
|
|
203
223
|
function _temp() {}
|
|
204
224
|
function _temp2() {
|
|
@@ -210,11 +230,7 @@ function _temp3() {
|
|
|
210
230
|
function _temp4() {
|
|
211
231
|
return false;
|
|
212
232
|
}
|
|
213
|
-
function _temp5() {
|
|
214
|
-
function _temp6() {
|
|
215
|
-
document.documentElement.classList.remove(THEME_TRANSITION_CLASS);
|
|
216
|
-
}
|
|
217
|
-
function _temp7(t0) {
|
|
233
|
+
function _temp5(t0) {
|
|
218
234
|
const { icon: Icon, label, value } = t0;
|
|
219
235
|
return /* @__PURE__ */ _jsxs(DropdownMenuRadioItem, {
|
|
220
236
|
className: "h-11 gap-3 px-3 pr-9 text-base",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
5
|
+
import { MotionSlot } from "../motion/motion-slot.js";
|
|
5
6
|
import { cn } from "../lib/utils.js";
|
|
6
7
|
import { useBeezUIComponents } from "../providers/beez-ui-provider.js";
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -32,11 +33,14 @@ function Avatar(t0) {
|
|
|
32
33
|
}
|
|
33
34
|
let t3;
|
|
34
35
|
if ($[6] !== props || $[7] !== size || $[8] !== t2) {
|
|
35
|
-
t3 = /* @__PURE__ */ _jsx(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
t3 = /* @__PURE__ */ _jsx(MotionSlot, {
|
|
37
|
+
kind: "fade",
|
|
38
|
+
children: /* @__PURE__ */ _jsx(AvatarPrimitive.Root, {
|
|
39
|
+
"data-slot": "avatar",
|
|
40
|
+
"data-size": size,
|
|
41
|
+
className: t2,
|
|
42
|
+
...props
|
|
43
|
+
})
|
|
40
44
|
});
|
|
41
45
|
$[6] = props;
|
|
42
46
|
$[7] = size;
|
|
@@ -89,16 +93,19 @@ function AvatarImage(t0) {
|
|
|
89
93
|
const t5 = src ?? undefined;
|
|
90
94
|
let t6;
|
|
91
95
|
if ($[9] !== alt || $[10] !== props || $[11] !== t3 || $[12] !== t4 || $[13] !== t5) {
|
|
92
|
-
t6 = /* @__PURE__ */ _jsx(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
t6 = /* @__PURE__ */ _jsx(MotionSlot, {
|
|
97
|
+
kind: "field",
|
|
98
|
+
children: /* @__PURE__ */ _jsx(AvatarPrimitive.Image, {
|
|
99
|
+
render: t3,
|
|
100
|
+
keepMounted: true,
|
|
101
|
+
alt,
|
|
102
|
+
"data-slot": "avatar-image",
|
|
103
|
+
className: t4,
|
|
104
|
+
src: t5,
|
|
105
|
+
loading: "lazy",
|
|
106
|
+
decoding: "async",
|
|
107
|
+
...props
|
|
108
|
+
})
|
|
102
109
|
});
|
|
103
110
|
$[9] = alt;
|
|
104
111
|
$[10] = props;
|
package/dist/components/badge.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
3
|
import { Slot } from "radix-ui";
|
|
4
|
+
import { MotionSlot } from "../motion/motion-slot.js";
|
|
4
5
|
import { cn } from "../lib/utils.js";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
const badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
@@ -16,11 +17,14 @@ const badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-cent
|
|
|
16
17
|
});
|
|
17
18
|
function Badge({ className, variant = "default", asChild = false, ...props }) {
|
|
18
19
|
const Comp = asChild ? Slot.Root : "span";
|
|
19
|
-
return /* @__PURE__ */ _jsx(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
return /* @__PURE__ */ _jsx(MotionSlot, {
|
|
21
|
+
kind: "fade",
|
|
22
|
+
children: /* @__PURE__ */ _jsx(Comp, {
|
|
23
|
+
"data-slot": "badge",
|
|
24
|
+
"data-variant": variant,
|
|
25
|
+
className: cn(badgeVariants({ variant }), className),
|
|
26
|
+
...props
|
|
27
|
+
})
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
30
|
export { Badge, badgeVariants };
|