beez-ui 0.4.2 → 0.5.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.
- package/CHANGELOG.md +31 -27
- package/README.md +22 -2
- package/dist/adapters/unpic-image.js +92 -14
- package/dist/components/alert-dialog.js +444 -26
- package/dist/components/alert.js +153 -18
- package/dist/components/animated-theme-toggler.js +215 -76
- package/dist/components/avatar.js +247 -15
- package/dist/components/badge.js +18 -16
- package/dist/components/button.js +85 -28
- package/dist/components/calendar.js +327 -68
- package/dist/components/card.js +39 -9
- package/dist/components/carousel.js +454 -84
- package/dist/components/checkbox.js +50 -3
- package/dist/components/data-table.js +827 -583
- package/dist/components/dialog.js +363 -22
- package/dist/components/dropdown-menu.js +543 -32
- package/dist/components/filter-query-bar.js +809 -468
- package/dist/components/filter-query-grammar.js +781 -736
- package/dist/components/form.js +305 -43
- package/dist/components/highlighter.js +142 -87
- package/dist/components/hover-card.js +97 -7
- package/dist/components/input-group.js +261 -41
- package/dist/components/input.js +8 -2
- package/dist/components/label.js +38 -3
- package/dist/components/link.js +45 -7
- package/dist/components/pagination.js +332 -16
- package/dist/components/popover.js +222 -16
- package/dist/components/radio-group.js +85 -5
- package/dist/components/select.js +451 -22
- package/dist/components/separator.js +43 -3
- package/dist/components/sheet.js +345 -22
- package/dist/components/sidebar.js +1385 -193
- package/dist/components/skeleton.js +6 -2
- package/dist/components/svgs/whatsappIcon.js +11 -1
- package/dist/components/switch.js +55 -3
- package/dist/components/table.js +288 -18
- package/dist/components/tabs.js +161 -18
- package/dist/components/textarea.js +7 -2
- package/dist/components/themed-toaster.js +63 -20
- package/dist/components/tooltip.js +128 -9
- package/dist/components/typing-animation.js +335 -150
- package/dist/constants/sidebar.js +1 -4
- package/dist/hooks/use-mobile.js +8 -8
- package/dist/hooks/use-sidebar-persistence.js +27 -27
- package/dist/lib/image-dimensions.js +2 -2
- package/dist/lib/year-month-filter.js +38 -40
- package/dist/next.js +69 -17
- package/dist/providers/beez-ui-provider.js +48 -7
- package/dist/providers/native-provider.js +40 -6
- package/dist/tanstack.js +35 -23
- package/package.json +4 -1
|
@@ -1,48 +1,46 @@
|
|
|
1
1
|
const YEAR_MONTH_INPUT_PATTERN = /^(0[1-9]|1[0-2])\/(\d{4})$/;
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
* Parsea un texto `MM/AAAA` a su valor numérico comparable `AAAAMM`
|
|
4
|
+
* (por ejemplo `06/2026` → `202606`). Devuelve `null` cuando el texto no es
|
|
5
|
+
* un mes-año válido.
|
|
6
|
+
*/
|
|
7
7
|
export function parseYearMonthFilterInput(value) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const match = YEAR_MONTH_INPUT_PATTERN.exec(value.trim());
|
|
9
|
+
if (!match) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const [, month, year] = match;
|
|
13
|
+
return Number(`${year}${month}`);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
* Formatea un valor numérico `AAAAMM` de vuelta a `MM/AAAA` para rehidratar
|
|
17
|
+
* los inputs del filtro al reabrir el diálogo.
|
|
18
|
+
*/
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
* Evalúa un filtro de rango de año-mes contra el valor numérico `AAAAMM` de una
|
|
21
|
+
* fila (`null` cuando la fila no tiene fecha). Devuelve `true` cuando el filtro
|
|
22
|
+
* no aplica, replicando el contrato de los demás matchers de la tabla.
|
|
23
|
+
*/
|
|
24
24
|
export function matchesAdvancedYearMonthRangeFilter(columnFilterValue, value) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
25
|
+
if (!columnFilterValue || typeof columnFilterValue !== "object" || columnFilterValue.kind !== "yearMonthRange") {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
const filterValue = columnFilterValue;
|
|
29
|
+
const hasValue = value != null && Number.isFinite(value);
|
|
30
|
+
if (filterValue.mode === "hasValue") {
|
|
31
|
+
return hasValue;
|
|
32
|
+
}
|
|
33
|
+
if (filterValue.mode === "noValue") {
|
|
34
|
+
return !hasValue;
|
|
35
|
+
}
|
|
36
|
+
if (!hasValue) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (filterValue.min != null && value < filterValue.min) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (filterValue.max != null && value > filterValue.max) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
48
46
|
}
|
package/dist/next.js
CHANGED
|
@@ -1,27 +1,79 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
/** Isolates optional Next.js imports from the framework-neutral package entrypoint. */
|
|
4
|
-
import { useMemo } from "react";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
5
3
|
import NextImageModule from "next/image.js";
|
|
6
4
|
import NextLinkModule from "next/link.js";
|
|
7
5
|
import { BeezUIProvider as BaseBeezUIProvider } from "./providers/beez-ui-provider.js";
|
|
8
6
|
import { imageDimension } from "./lib/image-dimensions.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
8
|
/** Supports both native ESM loading of Next's CommonJS modules and bundler interop. */
|
|
10
9
|
const NextImage = NextImageModule.default ?? NextImageModule;
|
|
11
10
|
const NextLink = NextLinkModule.default ?? NextLinkModule;
|
|
12
11
|
/** Activates Next.js navigation and images for every descendant using shared primitives. */
|
|
13
|
-
export function BeezUIProvider(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
export function BeezUIProvider(t0) {
|
|
13
|
+
const $ = _c(11);
|
|
14
|
+
const { children, optimizeImages: t1, prefetch: t2, themeOptions } = t0;
|
|
15
|
+
const optimizeImages = t1 === undefined ? false : t1;
|
|
16
|
+
const prefetch = t2 === undefined ? false : t2;
|
|
17
|
+
let t3;
|
|
18
|
+
if ($[0] !== prefetch) {
|
|
19
|
+
t3 = function NextRoutingAdapter(t4) {
|
|
20
|
+
const { prefetch: linkPrefetch, ...props } = t4;
|
|
21
|
+
return /* @__PURE__ */ _jsx(NextLink, {
|
|
22
|
+
...props,
|
|
23
|
+
prefetch: linkPrefetch ?? prefetch
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
$[0] = prefetch;
|
|
27
|
+
$[1] = t3;
|
|
28
|
+
} else {
|
|
29
|
+
t3 = $[1];
|
|
30
|
+
}
|
|
31
|
+
let t4;
|
|
32
|
+
if ($[2] !== optimizeImages) {
|
|
33
|
+
t4 = function NextImageAdapter(props_0) {
|
|
34
|
+
if (!props_0.src) {
|
|
35
|
+
return /* @__PURE__ */ _jsx("img", { ...props_0 });
|
|
36
|
+
}
|
|
37
|
+
return /* @__PURE__ */ _jsx(NextImage, {
|
|
38
|
+
...props_0,
|
|
39
|
+
alt: props_0.alt ?? "",
|
|
40
|
+
src: props_0.src,
|
|
41
|
+
width: imageDimension(props_0.width),
|
|
42
|
+
height: imageDimension(props_0.height),
|
|
43
|
+
unoptimized: !optimizeImages
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
$[2] = optimizeImages;
|
|
47
|
+
$[3] = t4;
|
|
48
|
+
} else {
|
|
49
|
+
t4 = $[3];
|
|
50
|
+
}
|
|
51
|
+
let t5;
|
|
52
|
+
if ($[4] !== t3 || $[5] !== t4) {
|
|
53
|
+
t5 = {
|
|
54
|
+
Link: t3,
|
|
55
|
+
Image: t4
|
|
56
|
+
};
|
|
57
|
+
$[4] = t3;
|
|
58
|
+
$[5] = t4;
|
|
59
|
+
$[6] = t5;
|
|
60
|
+
} else {
|
|
61
|
+
t5 = $[6];
|
|
62
|
+
}
|
|
63
|
+
const components = t5;
|
|
64
|
+
let t6;
|
|
65
|
+
if ($[7] !== children || $[8] !== components || $[9] !== themeOptions) {
|
|
66
|
+
t6 = /* @__PURE__ */ _jsx(BaseBeezUIProvider, {
|
|
67
|
+
components,
|
|
68
|
+
themeOptions,
|
|
69
|
+
children
|
|
70
|
+
});
|
|
71
|
+
$[7] = children;
|
|
72
|
+
$[8] = components;
|
|
73
|
+
$[9] = themeOptions;
|
|
74
|
+
$[10] = t6;
|
|
75
|
+
} else {
|
|
76
|
+
t6 = $[10];
|
|
77
|
+
}
|
|
78
|
+
return t6;
|
|
27
79
|
}
|
|
@@ -1,18 +1,59 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
/** Shares optional rendering adapters without importing a framework into the core. */
|
|
4
|
-
import { createContext, useContext
|
|
4
|
+
import { createContext, useContext } from "react";
|
|
5
5
|
import { ThemeProvider } from "next-themes";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
/** Native elements remain the implicit fallback for unconfigured adapters. */
|
|
7
8
|
const EMPTY_COMPONENTS = {};
|
|
8
9
|
const AdapterContext = createContext(EMPTY_COMPONENTS);
|
|
9
10
|
/** Merges nested overrides while preserving stable adapter identities. */
|
|
10
|
-
export function BeezUIProvider(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export function BeezUIProvider(t0) {
|
|
12
|
+
const $ = _c(9);
|
|
13
|
+
const { children, components: t1, themeOptions } = t0;
|
|
14
|
+
const components = t1 === undefined ? EMPTY_COMPONENTS : t1;
|
|
15
|
+
const parent = useContext(AdapterContext);
|
|
16
|
+
let t2;
|
|
17
|
+
if ($[0] !== components || $[1] !== parent) {
|
|
18
|
+
t2 = {
|
|
19
|
+
...parent,
|
|
20
|
+
...components
|
|
21
|
+
};
|
|
22
|
+
$[0] = components;
|
|
23
|
+
$[1] = parent;
|
|
24
|
+
$[2] = t2;
|
|
25
|
+
} else {
|
|
26
|
+
t2 = $[2];
|
|
27
|
+
}
|
|
28
|
+
const value = t2;
|
|
29
|
+
let t3;
|
|
30
|
+
if ($[3] !== children || $[4] !== value) {
|
|
31
|
+
t3 = /* @__PURE__ */ _jsx(AdapterContext.Provider, {
|
|
32
|
+
value,
|
|
33
|
+
children
|
|
34
|
+
});
|
|
35
|
+
$[3] = children;
|
|
36
|
+
$[4] = value;
|
|
37
|
+
$[5] = t3;
|
|
38
|
+
} else {
|
|
39
|
+
t3 = $[5];
|
|
40
|
+
}
|
|
41
|
+
let t4;
|
|
42
|
+
if ($[6] !== t3 || $[7] !== themeOptions) {
|
|
43
|
+
t4 = /* @__PURE__ */ _jsx(ThemeProvider, {
|
|
44
|
+
attribute: "class",
|
|
45
|
+
...themeOptions,
|
|
46
|
+
children: t3
|
|
47
|
+
});
|
|
48
|
+
$[6] = t3;
|
|
49
|
+
$[7] = themeOptions;
|
|
50
|
+
$[8] = t4;
|
|
51
|
+
} else {
|
|
52
|
+
t4 = $[8];
|
|
53
|
+
}
|
|
54
|
+
return t4;
|
|
14
55
|
}
|
|
15
56
|
/** Reads adapters internally; native components work without a provider. */
|
|
16
57
|
export function useBeezUIComponents() {
|
|
17
|
-
|
|
58
|
+
return useContext(AdapterContext);
|
|
18
59
|
}
|
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
/** Keeps the default image integration separate from optional framework entrypoints. */
|
|
4
|
-
import { useMemo } from "react";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
5
3
|
import { BeezUIProvider as BaseBeezUIProvider } from "./beez-ui-provider.js";
|
|
6
4
|
import { UnpicImageAdapter } from "../adapters/unpic-image.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
6
|
/** Combines native navigation, responsive Unpic images and the shared theme provider. */
|
|
8
|
-
export function BeezUIProvider(
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export function BeezUIProvider(t0) {
|
|
8
|
+
const $ = _c(8);
|
|
9
|
+
let components;
|
|
10
|
+
let props;
|
|
11
|
+
if ($[0] !== t0) {
|
|
12
|
+
({components, ...props} = t0);
|
|
13
|
+
$[0] = t0;
|
|
14
|
+
$[1] = components;
|
|
15
|
+
$[2] = props;
|
|
16
|
+
} else {
|
|
17
|
+
components = $[1];
|
|
18
|
+
props = $[2];
|
|
19
|
+
}
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[3] !== components) {
|
|
22
|
+
t1 = {
|
|
23
|
+
Image: UnpicImageAdapter,
|
|
24
|
+
...components
|
|
25
|
+
};
|
|
26
|
+
$[3] = components;
|
|
27
|
+
$[4] = t1;
|
|
28
|
+
} else {
|
|
29
|
+
t1 = $[4];
|
|
30
|
+
}
|
|
31
|
+
const nativeComponents = t1;
|
|
32
|
+
let t2;
|
|
33
|
+
if ($[5] !== nativeComponents || $[6] !== props) {
|
|
34
|
+
t2 = /* @__PURE__ */ _jsx(BaseBeezUIProvider, {
|
|
35
|
+
...props,
|
|
36
|
+
components: nativeComponents
|
|
37
|
+
});
|
|
38
|
+
$[5] = nativeComponents;
|
|
39
|
+
$[6] = props;
|
|
40
|
+
$[7] = t2;
|
|
41
|
+
} else {
|
|
42
|
+
t2 = $[7];
|
|
43
|
+
}
|
|
44
|
+
return t2;
|
|
11
45
|
}
|
package/dist/tanstack.js
CHANGED
|
@@ -1,38 +1,50 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
/** Integrates TanStack navigation without making the router a core dependency. */
|
|
4
3
|
import { useMemo } from "react";
|
|
5
4
|
import { Link as RouterLink, defaultParseSearch, useRouter } from "@tanstack/react-router";
|
|
6
5
|
import { BeezUIProvider as BaseBeezUIProvider } from "./providers/native-provider.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
/** Leaves absolute destinations to the router's built-in external-link handling. */
|
|
8
8
|
const ABSOLUTE_URL_PATTERN = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/iu;
|
|
9
9
|
/** Uses TanStack's intent preloading only when explicitly requested. */
|
|
10
10
|
const INTENT_PRELOAD = "intent";
|
|
11
11
|
/** Converts a native href into TanStack's pathname/search/hash options. */
|
|
12
12
|
function splitHref(href) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const hashIndex = href.indexOf("#");
|
|
14
|
+
const beforeHash = hashIndex < 0 ? href : href.slice(0, hashIndex);
|
|
15
|
+
const searchIndex = beforeHash.indexOf("?");
|
|
16
|
+
return {
|
|
17
|
+
pathname: searchIndex < 0 ? beforeHash : beforeHash.slice(0, searchIndex),
|
|
18
|
+
search: searchIndex < 0 ? undefined : beforeHash.slice(searchIndex),
|
|
19
|
+
hash: hashIndex < 0 ? "" : href.slice(hashIndex + 1)
|
|
20
|
+
};
|
|
21
21
|
}
|
|
22
22
|
/** Combines TanStack links with responsive Unpic images and shared theme behavior. */
|
|
23
23
|
export function BeezUIProvider({ children, prefetch = false, themeOptions }) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
const components = useMemo(() => ({
|
|
25
|
+
/** Uses the real router parser so application search configuration remains authoritative. */
|
|
26
|
+
Link: function TanStackLinkAdapter({ href, prefetch: linkPrefetch, ...props }) {
|
|
27
|
+
const router = useRouter();
|
|
28
|
+
const preload = linkPrefetch ?? prefetch ? INTENT_PRELOAD : false;
|
|
29
|
+
if (ABSOLUTE_URL_PATTERN.test(href)) return /* @__PURE__ */ _jsx(RouterLink, {
|
|
30
|
+
...props,
|
|
31
|
+
to: href,
|
|
32
|
+
preload
|
|
33
|
+
});
|
|
34
|
+
const location = splitHref(href);
|
|
35
|
+
const parseSearch = router.options.parseSearch ?? defaultParseSearch;
|
|
36
|
+
const search = location.search === undefined ? location.pathname ? {} : true : parseSearch(location.search);
|
|
37
|
+
return /* @__PURE__ */ _jsx(RouterLink, {
|
|
38
|
+
...props,
|
|
39
|
+
to: location.pathname || ".",
|
|
40
|
+
search,
|
|
41
|
+
hash: location.hash,
|
|
42
|
+
preload
|
|
43
|
+
});
|
|
44
|
+
} }), [prefetch]);
|
|
45
|
+
return /* @__PURE__ */ _jsx(BaseBeezUIProvider, {
|
|
46
|
+
components,
|
|
47
|
+
themeOptions,
|
|
48
|
+
children
|
|
49
|
+
});
|
|
38
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beez-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Shared UI components with the customizations extracted from TuTribu.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -287,6 +287,8 @@
|
|
|
287
287
|
"jsdom": "^29.1.1",
|
|
288
288
|
"lucide-react": "^1.41.0",
|
|
289
289
|
"next": "^16.3.4",
|
|
290
|
+
"oxc-parser": "^0.149.0",
|
|
291
|
+
"oxc-transform-react": "^0.149.0",
|
|
290
292
|
"react": "^19.2.8",
|
|
291
293
|
"react-dom": "^19.2.8",
|
|
292
294
|
"semver": "^7.8.5",
|
|
@@ -327,6 +329,7 @@
|
|
|
327
329
|
"typecheck:src": "tsc --noEmit -p tsconfig.json",
|
|
328
330
|
"typecheck:tests": "tsc --noEmit -p tests/tsconfig.json",
|
|
329
331
|
"test": "pnpm build && vitest run",
|
|
332
|
+
"test:uncompiled": "pnpm build --no-react-compiler && vitest run",
|
|
330
333
|
"check": "pnpm build && pnpm lint && pnpm typecheck:src && pnpm typecheck:tests && pnpm exec vitest run",
|
|
331
334
|
"lint": "eslint .",
|
|
332
335
|
"test:browser": "pnpm build && playwright test",
|