beez-ui 0.4.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 +34 -0
- package/LICENSE.md +21 -0
- package/README.md +113 -0
- package/assets/fonts/geist-LICENSE.txt +93 -0
- package/assets/fonts/geist-latin-variable.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
- package/assets/fonts/ibmplexmono-LICENSE.txt +93 -0
- package/assets/fonts/poppins-LICENSE.txt +93 -0
- package/assets/fonts/poppins-latin-600.woff2 +0 -0
- package/dist/adapters/unpic-image.d.ts +3 -0
- package/dist/adapters/unpic-image.js +20 -0
- package/dist/components/alert-dialog.d.ts +18 -0
- package/dist/components/alert-dialog.js +42 -0
- package/dist/components/alert.d.ts +10 -0
- package/dist/components/alert.js +28 -0
- package/dist/components/animated-theme-toggler.d.ts +8 -0
- package/dist/components/animated-theme-toggler.js +88 -0
- package/dist/components/avatar.d.ts +16 -0
- package/dist/components/avatar.js +26 -0
- package/dist/components/badge.d.ts +9 -0
- package/dist/components/badge.js +24 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.js +37 -0
- package/dist/components/calendar.d.ts +10 -0
- package/dist/components/calendar.js +77 -0
- package/dist/components/card.d.ts +11 -0
- package/dist/components/card.js +24 -0
- package/dist/components/carousel.d.ts +28 -0
- package/dist/components/carousel.js +98 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.js +9 -0
- package/dist/components/data-table.d.ts +117 -0
- package/dist/components/data-table.js +612 -0
- package/dist/components/dialog.d.ts +17 -0
- package/dist/components/dialog.js +37 -0
- package/dist/components/dropdown-menu.d.ts +29 -0
- package/dist/components/dropdown-menu.js +51 -0
- package/dist/components/filter-query-bar.d.ts +21 -0
- package/dist/components/filter-query-bar.js +526 -0
- package/dist/components/filter-query-grammar.d.ts +188 -0
- package/dist/components/filter-query-grammar.js +830 -0
- package/dist/components/form.d.ts +24 -0
- package/dist/components/form.js +59 -0
- package/dist/components/highlighter.d.ts +15 -0
- package/dist/components/highlighter.js +91 -0
- package/dist/components/hover-card.d.ts +6 -0
- package/dist/components/hover-card.js +14 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.js +57 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.js +7 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +8 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +11 -0
- package/dist/components/pagination.d.ts +18 -0
- package/dist/components/pagination.js +28 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.js +26 -0
- package/dist/components/radio-group.d.ts +5 -0
- package/dist/components/radio-group.js +11 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.js +36 -0
- package/dist/components/separator.d.ts +3 -0
- package/dist/components/separator.js +8 -0
- package/dist/components/sheet.d.ts +14 -0
- package/dist/components/sheet.js +37 -0
- package/dist/components/sidebar.d.ts +71 -0
- package/dist/components/sidebar.js +221 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/skeleton.js +6 -0
- package/dist/components/svgs/whatsappIcon.d.ts +3 -0
- package/dist/components/svgs/whatsappIcon.js +3 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.js +8 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +28 -0
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +29 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +6 -0
- package/dist/components/themed-toaster.d.ts +4 -0
- package/dist/components/themed-toaster.js +27 -0
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.js +17 -0
- package/dist/components/typing-animation.d.ts +34 -0
- package/dist/components/typing-animation.js +155 -0
- package/dist/constants/sidebar.d.ts +9 -0
- package/dist/constants/sidebar.js +20 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +19 -0
- package/dist/hooks/use-sidebar-persistence.d.ts +4 -0
- package/dist/hooks/use-sidebar-persistence.js +45 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +47 -0
- package/dist/lib/image-dimensions.d.ts +2 -0
- package/dist/lib/image-dimensions.js +7 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +2 -0
- package/dist/lib/year-month-filter.d.ts +16 -0
- package/dist/lib/year-month-filter.js +48 -0
- package/dist/next.d.ts +14 -0
- package/dist/next.js +27 -0
- package/dist/providers/beez-ui-provider.d.ts +27 -0
- package/dist/providers/beez-ui-provider.js +18 -0
- package/dist/providers/native-provider.d.ts +4 -0
- package/dist/providers/native-provider.js +11 -0
- package/dist/sonner.d.ts +2 -0
- package/dist/sonner.js +3 -0
- package/dist/styles.css +2 -0
- package/dist/tanstack.d.ts +11 -0
- package/dist/tanstack.js +38 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +1 -0
- package/dist/types/data-table.d.ts +27 -0
- package/dist/types/data-table.js +1 -0
- package/fonts.css +5 -0
- package/package.json +335 -0
- package/styles.css +4 -0
- package/theme.css +87 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useMemo, useRef, useState, } from "react";
|
|
4
|
+
import { motion, } from "motion/react";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
const motionElements = {
|
|
7
|
+
article: motion.article,
|
|
8
|
+
div: motion.div,
|
|
9
|
+
h1: motion.h1,
|
|
10
|
+
h2: motion.h2,
|
|
11
|
+
h3: motion.h3,
|
|
12
|
+
h4: motion.h4,
|
|
13
|
+
h5: motion.h5,
|
|
14
|
+
h6: motion.h6,
|
|
15
|
+
li: motion.li,
|
|
16
|
+
p: motion.p,
|
|
17
|
+
section: motion.section,
|
|
18
|
+
span: motion.span,
|
|
19
|
+
};
|
|
20
|
+
export function TypingAnimation({ children, words, className, duration = 80, typeSpeed, deleteSpeed, delay = 0, pauseDelay = 1000, loop = false, as: Component = "span", startOnView = true, showCursor = true, blinkCursor = true, cursorStyle = "line", ...props }) {
|
|
21
|
+
const MotionComponent = motionElements[Component];
|
|
22
|
+
const [displayedText, setDisplayedText] = useState("");
|
|
23
|
+
const [currentWordIndex, setCurrentWordIndex] = useState(0);
|
|
24
|
+
const [currentCharIndex, setCurrentCharIndex] = useState(0);
|
|
25
|
+
const [phase, setPhase] = useState("typing");
|
|
26
|
+
const elementRef = useRef(null);
|
|
27
|
+
const [isInView, setIsInView] = useState(() => !startOnView || typeof IntersectionObserver === "undefined");
|
|
28
|
+
const wordsToAnimate = useMemo(() => words ?? (children ? [children] : []), [words, children]);
|
|
29
|
+
const hasMultipleWords = wordsToAnimate.length > 1;
|
|
30
|
+
const typingSpeed = typeSpeed ?? duration;
|
|
31
|
+
const deletingSpeed = deleteSpeed ?? typingSpeed / 2;
|
|
32
|
+
const shouldStart = startOnView ? isInView : true;
|
|
33
|
+
const animationSourceKey = useMemo(() => (words ? words.join("\u0000") : (children ?? "")), [words, children]);
|
|
34
|
+
const lastResetSourceKeyRef = useRef(animationSourceKey);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!startOnView || isInView) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const element = elementRef.current;
|
|
40
|
+
if (!element || typeof IntersectionObserver === "undefined") {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
44
|
+
if (entry.isIntersecting) {
|
|
45
|
+
setIsInView(true);
|
|
46
|
+
observer.disconnect();
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
threshold: 0.3,
|
|
50
|
+
});
|
|
51
|
+
observer.observe(element);
|
|
52
|
+
return () => {
|
|
53
|
+
observer.disconnect();
|
|
54
|
+
};
|
|
55
|
+
}, [isInView, startOnView]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (lastResetSourceKeyRef.current === animationSourceKey) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
lastResetSourceKeyRef.current = animationSourceKey;
|
|
61
|
+
const resetTimeout = setTimeout(() => {
|
|
62
|
+
setDisplayedText("");
|
|
63
|
+
setCurrentWordIndex(0);
|
|
64
|
+
setCurrentCharIndex(0);
|
|
65
|
+
setPhase("typing");
|
|
66
|
+
}, 0);
|
|
67
|
+
return () => {
|
|
68
|
+
clearTimeout(resetTimeout);
|
|
69
|
+
};
|
|
70
|
+
}, [animationSourceKey]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
let timeout = null;
|
|
73
|
+
if (shouldStart && wordsToAnimate.length > 0) {
|
|
74
|
+
const timeoutDelay = delay > 0 && displayedText === ""
|
|
75
|
+
? delay
|
|
76
|
+
: phase === "typing"
|
|
77
|
+
? typingSpeed
|
|
78
|
+
: phase === "deleting"
|
|
79
|
+
? deletingSpeed
|
|
80
|
+
: pauseDelay;
|
|
81
|
+
timeout = setTimeout(() => {
|
|
82
|
+
const currentWord = wordsToAnimate[currentWordIndex] || "";
|
|
83
|
+
const graphemes = Array.from(currentWord);
|
|
84
|
+
switch (phase) {
|
|
85
|
+
case "typing":
|
|
86
|
+
if (currentCharIndex < graphemes.length) {
|
|
87
|
+
setDisplayedText(graphemes.slice(0, currentCharIndex + 1).join(""));
|
|
88
|
+
setCurrentCharIndex(currentCharIndex + 1);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
if (hasMultipleWords || loop) {
|
|
92
|
+
const isLastWord = currentWordIndex === wordsToAnimate.length - 1;
|
|
93
|
+
if (!isLastWord || loop) {
|
|
94
|
+
setPhase("pause");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case "pause":
|
|
100
|
+
setPhase("deleting");
|
|
101
|
+
break;
|
|
102
|
+
case "deleting":
|
|
103
|
+
if (currentCharIndex > 0) {
|
|
104
|
+
setDisplayedText(graphemes.slice(0, currentCharIndex - 1).join(""));
|
|
105
|
+
setCurrentCharIndex(currentCharIndex - 1);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const nextIndex = (currentWordIndex + 1) % wordsToAnimate.length;
|
|
109
|
+
setCurrentWordIndex(nextIndex);
|
|
110
|
+
setPhase("typing");
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}, timeoutDelay);
|
|
115
|
+
}
|
|
116
|
+
return () => {
|
|
117
|
+
if (timeout !== null) {
|
|
118
|
+
clearTimeout(timeout);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}, [
|
|
122
|
+
shouldStart,
|
|
123
|
+
phase,
|
|
124
|
+
currentCharIndex,
|
|
125
|
+
currentWordIndex,
|
|
126
|
+
displayedText,
|
|
127
|
+
wordsToAnimate,
|
|
128
|
+
hasMultipleWords,
|
|
129
|
+
loop,
|
|
130
|
+
typingSpeed,
|
|
131
|
+
deletingSpeed,
|
|
132
|
+
pauseDelay,
|
|
133
|
+
delay,
|
|
134
|
+
]);
|
|
135
|
+
const currentWordGraphemes = Array.from(wordsToAnimate[currentWordIndex] || "");
|
|
136
|
+
const isComplete = !loop &&
|
|
137
|
+
currentWordIndex === wordsToAnimate.length - 1 &&
|
|
138
|
+
currentCharIndex >= currentWordGraphemes.length &&
|
|
139
|
+
phase !== "deleting";
|
|
140
|
+
const shouldShowCursor = showCursor &&
|
|
141
|
+
!isComplete &&
|
|
142
|
+
(hasMultipleWords || loop || currentCharIndex < currentWordGraphemes.length);
|
|
143
|
+
const getCursorChar = () => {
|
|
144
|
+
switch (cursorStyle) {
|
|
145
|
+
case "block":
|
|
146
|
+
return "▌";
|
|
147
|
+
case "underscore":
|
|
148
|
+
return "_";
|
|
149
|
+
case "line":
|
|
150
|
+
default:
|
|
151
|
+
return "|";
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
return (_jsxs(MotionComponent, { ref: elementRef, className: cn("tracking-[-0.02em]", Component === "h1" && "text-3xl font-bold leading-tight md:text-4xl", Component === "span" && "inline-block", className), ...props, children: [displayedText, shouldShowCursor && (_jsx("span", { className: cn("inline-block", blinkCursor && "animate-blink-cursor"), children: getCursorChar() }))] }));
|
|
155
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Defines the cookie contract shared by the UI and server-side consumers. */
|
|
2
|
+
/** Stable cookie key read by server entrypoints and written by the sidebar. */
|
|
3
|
+
export declare const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
4
|
+
/** Serialized value representing expanded navigation. */
|
|
5
|
+
export declare const SIDEBAR_COOKIE_OPEN_VALUE = "true";
|
|
6
|
+
/** Serialized value representing collapsed navigation. */
|
|
7
|
+
export declare const SIDEBAR_COOKIE_COLLAPSED_VALUE = "false";
|
|
8
|
+
/** Preference lifetime in seconds, as required by the cookie max-age field. */
|
|
9
|
+
export declare const SIDEBAR_COOKIE_MAX_AGE: number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Defines the cookie contract shared by the UI and server-side consumers. */
|
|
2
|
+
/** Number of days the navigation preference remains valid. */
|
|
3
|
+
const SIDEBAR_COOKIE_MAX_AGE_DAYS = 7;
|
|
4
|
+
/** Converts preference days into hours. */
|
|
5
|
+
const SIDEBAR_COOKIE_MAX_AGE_HOURS_PER_DAY = 24;
|
|
6
|
+
/** Converts preference hours into minutes. */
|
|
7
|
+
const SIDEBAR_COOKIE_MAX_AGE_MINUTES_PER_HOUR = 60;
|
|
8
|
+
/** Converts preference minutes into cookie max-age seconds. */
|
|
9
|
+
const SIDEBAR_COOKIE_MAX_AGE_SECONDS_PER_MINUTE = 60;
|
|
10
|
+
/** Stable cookie key read by server entrypoints and written by the sidebar. */
|
|
11
|
+
export const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
12
|
+
/** Serialized value representing expanded navigation. */
|
|
13
|
+
export const SIDEBAR_COOKIE_OPEN_VALUE = "true";
|
|
14
|
+
/** Serialized value representing collapsed navigation. */
|
|
15
|
+
export const SIDEBAR_COOKIE_COLLAPSED_VALUE = "false";
|
|
16
|
+
/** Preference lifetime in seconds, as required by the cookie max-age field. */
|
|
17
|
+
export const SIDEBAR_COOKIE_MAX_AGE = SIDEBAR_COOKIE_MAX_AGE_SECONDS_PER_MINUTE *
|
|
18
|
+
SIDEBAR_COOKIE_MAX_AGE_MINUTES_PER_HOUR *
|
|
19
|
+
SIDEBAR_COOKIE_MAX_AGE_HOURS_PER_DAY *
|
|
20
|
+
SIDEBAR_COOKIE_MAX_AGE_DAYS;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsMobile(): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** Viewport width in CSS pixels at which desktop navigation begins. */
|
|
3
|
+
const MOBILE_BREAKPOINT = 768;
|
|
4
|
+
function subscribeToMobileBreakpoint(onStoreChange) {
|
|
5
|
+
const mediaQueryList = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
6
|
+
mediaQueryList.addEventListener("change", onStoreChange);
|
|
7
|
+
return () => {
|
|
8
|
+
mediaQueryList.removeEventListener("change", onStoreChange);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function getMobileSnapshot() {
|
|
12
|
+
return window.innerWidth < MOBILE_BREAKPOINT;
|
|
13
|
+
}
|
|
14
|
+
function getServerMobileSnapshot() {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
export function useIsMobile() {
|
|
18
|
+
return React.useSyncExternalStore(subscribeToMobileBreakpoint, getMobileSnapshot, getServerMobileSnapshot);
|
|
19
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Resolves opt-in persistence after hydration, without changing controlled state. */
|
|
2
|
+
export declare function useSidebarPersistence(storageKey?: string): boolean | null;
|
|
3
|
+
/** Stores an optional preference while retaining usable navigation in private mode. */
|
|
4
|
+
export declare function saveSidebarPreference(storageKey: string | undefined, open: boolean): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/** Keeps optional browser persistence separate from the sidebar rendering contract. */
|
|
3
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
4
|
+
import { SIDEBAR_COOKIE_COLLAPSED_VALUE, SIDEBAR_COOKIE_OPEN_VALUE } from "../constants/sidebar.js";
|
|
5
|
+
/** Reads a preference without making unavailable browser storage a render failure. */
|
|
6
|
+
function readSidebarPreference(storageKey) {
|
|
7
|
+
if (!storageKey || typeof window === "undefined")
|
|
8
|
+
return null;
|
|
9
|
+
try {
|
|
10
|
+
const value = window.localStorage.getItem(storageKey);
|
|
11
|
+
if (value === SIDEBAR_COOKIE_OPEN_VALUE)
|
|
12
|
+
return true;
|
|
13
|
+
if (value === SIDEBAR_COOKIE_COLLAPSED_VALUE)
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Persisted preferences are optional; blocked storage retains the server default.
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
/** Subscribes to browser storage updates and releases the listener on unmount. */
|
|
22
|
+
function subscribeToStorage(onChange) {
|
|
23
|
+
window.addEventListener("storage", onChange);
|
|
24
|
+
return () => window.removeEventListener("storage", onChange);
|
|
25
|
+
}
|
|
26
|
+
/** Keeps the first hydrated render identical to the server-provided preference. */
|
|
27
|
+
function getServerPreference() {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
/** Resolves opt-in persistence after hydration, without changing controlled state. */
|
|
31
|
+
export function useSidebarPersistence(storageKey) {
|
|
32
|
+
const getSnapshot = useCallback(() => readSidebarPreference(storageKey), [storageKey]);
|
|
33
|
+
return useSyncExternalStore(subscribeToStorage, getSnapshot, getServerPreference);
|
|
34
|
+
}
|
|
35
|
+
/** Stores an optional preference while retaining usable navigation in private mode. */
|
|
36
|
+
export function saveSidebarPreference(storageKey, open) {
|
|
37
|
+
if (!storageKey)
|
|
38
|
+
return;
|
|
39
|
+
try {
|
|
40
|
+
window.localStorage.setItem(storageKey, open ? SIDEBAR_COOKIE_OPEN_VALUE : SIDEBAR_COOKIE_COLLAPSED_VALUE);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// The current in-memory state remains authoritative if storage is blocked.
|
|
44
|
+
}
|
|
45
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Exposes shared UI without promoting server-safe exports into a client boundary. */
|
|
2
|
+
export { useTheme } from "next-themes";
|
|
3
|
+
export { Link, type LinkProps } from "./components/link.js";
|
|
4
|
+
export { BeezUIProvider, type BeezUIProviderProps } from "./providers/native-provider.js";
|
|
5
|
+
export type { BeezUIComponents, BeezImageProps, BeezLinkProps } from "./providers/beez-ui-provider.js";
|
|
6
|
+
export * from "./components/alert-dialog.js";
|
|
7
|
+
export * from "./components/avatar.js";
|
|
8
|
+
export * from "./components/badge.js";
|
|
9
|
+
export * from "./components/button.js";
|
|
10
|
+
export * from "./components/card.js";
|
|
11
|
+
export * from "./components/carousel.js";
|
|
12
|
+
export * from "./components/checkbox.js";
|
|
13
|
+
export * from "./components/dialog.js";
|
|
14
|
+
export * from "./components/dropdown-menu.js";
|
|
15
|
+
export * from "./components/hover-card.js";
|
|
16
|
+
export * from "./components/input.js";
|
|
17
|
+
export * from "./components/pagination.js";
|
|
18
|
+
export * from "./components/popover.js";
|
|
19
|
+
export * from "./components/select.js";
|
|
20
|
+
export * from "./components/separator.js";
|
|
21
|
+
export * from "./components/sheet.js";
|
|
22
|
+
export * from "./components/sidebar.js";
|
|
23
|
+
export * from "./components/skeleton.js";
|
|
24
|
+
export * from "./components/switch.js";
|
|
25
|
+
export * from "./components/table.js";
|
|
26
|
+
export * from "./components/tabs.js";
|
|
27
|
+
export * from "./components/textarea.js";
|
|
28
|
+
export * from "./components/tooltip.js";
|
|
29
|
+
export * from "./components/svgs/whatsappIcon.js";
|
|
30
|
+
export * from "./lib/utils.js";
|
|
31
|
+
export * from "./hooks/use-mobile.js";
|
|
32
|
+
export * from "./constants/sidebar.js";
|
|
33
|
+
export * from "./sonner.js";
|
|
34
|
+
export * from "./components/alert.js";
|
|
35
|
+
export * from "./components/animated-theme-toggler.js";
|
|
36
|
+
export * from "./components/calendar.js";
|
|
37
|
+
export * from "./components/data-table.js";
|
|
38
|
+
export * from "./components/filter-query-bar.js";
|
|
39
|
+
export * from "./components/filter-query-grammar.js";
|
|
40
|
+
export * from "./components/form.js";
|
|
41
|
+
export * from "./components/highlighter.js";
|
|
42
|
+
export * from "./components/input-group.js";
|
|
43
|
+
export * from "./components/label.js";
|
|
44
|
+
export * from "./components/radio-group.js";
|
|
45
|
+
export * from "./components/typing-animation.js";
|
|
46
|
+
export * from "./components/themed-toaster.js";
|
|
47
|
+
export * from "./theme.js";
|
|
48
|
+
export * from "./lib/year-month-filter.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Exposes shared UI without promoting server-safe exports into a client boundary. */
|
|
2
|
+
export { useTheme } from "next-themes";
|
|
3
|
+
export { Link } from "./components/link.js";
|
|
4
|
+
export { BeezUIProvider } from "./providers/native-provider.js";
|
|
5
|
+
export * from "./components/alert-dialog.js";
|
|
6
|
+
export * from "./components/avatar.js";
|
|
7
|
+
export * from "./components/badge.js";
|
|
8
|
+
export * from "./components/button.js";
|
|
9
|
+
export * from "./components/card.js";
|
|
10
|
+
export * from "./components/carousel.js";
|
|
11
|
+
export * from "./components/checkbox.js";
|
|
12
|
+
export * from "./components/dialog.js";
|
|
13
|
+
export * from "./components/dropdown-menu.js";
|
|
14
|
+
export * from "./components/hover-card.js";
|
|
15
|
+
export * from "./components/input.js";
|
|
16
|
+
export * from "./components/pagination.js";
|
|
17
|
+
export * from "./components/popover.js";
|
|
18
|
+
export * from "./components/select.js";
|
|
19
|
+
export * from "./components/separator.js";
|
|
20
|
+
export * from "./components/sheet.js";
|
|
21
|
+
export * from "./components/sidebar.js";
|
|
22
|
+
export * from "./components/skeleton.js";
|
|
23
|
+
export * from "./components/switch.js";
|
|
24
|
+
export * from "./components/table.js";
|
|
25
|
+
export * from "./components/tabs.js";
|
|
26
|
+
export * from "./components/textarea.js";
|
|
27
|
+
export * from "./components/tooltip.js";
|
|
28
|
+
export * from "./components/svgs/whatsappIcon.js";
|
|
29
|
+
export * from "./lib/utils.js";
|
|
30
|
+
export * from "./hooks/use-mobile.js";
|
|
31
|
+
export * from "./constants/sidebar.js";
|
|
32
|
+
export * from "./sonner.js";
|
|
33
|
+
export * from "./components/alert.js";
|
|
34
|
+
export * from "./components/animated-theme-toggler.js";
|
|
35
|
+
export * from "./components/calendar.js";
|
|
36
|
+
export * from "./components/data-table.js";
|
|
37
|
+
export * from "./components/filter-query-bar.js";
|
|
38
|
+
export * from "./components/filter-query-grammar.js";
|
|
39
|
+
export * from "./components/form.js";
|
|
40
|
+
export * from "./components/highlighter.js";
|
|
41
|
+
export * from "./components/input-group.js";
|
|
42
|
+
export * from "./components/label.js";
|
|
43
|
+
export * from "./components/radio-group.js";
|
|
44
|
+
export * from "./components/typing-animation.js";
|
|
45
|
+
export * from "./components/themed-toaster.js";
|
|
46
|
+
export * from "./theme.js";
|
|
47
|
+
export * from "./lib/year-month-filter.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Supplies intrinsic dimensions required by responsive and optimized image adapters. */
|
|
2
|
+
const DEFAULT_IMAGE_DIMENSION_PX = 40;
|
|
3
|
+
/** Converts native image dimensions into a positive numeric value. */
|
|
4
|
+
export function imageDimension(value) {
|
|
5
|
+
const parsed = Number(value);
|
|
6
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_IMAGE_DIMENSION_PX;
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parsea un texto `MM/AAAA` a su valor numérico comparable `AAAAMM`
|
|
3
|
+
* (por ejemplo `06/2026` → `202606`). Devuelve `null` cuando el texto no es
|
|
4
|
+
* un mes-año válido.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseYearMonthFilterInput(value: string): number | null;
|
|
7
|
+
/**
|
|
8
|
+
* Formatea un valor numérico `AAAAMM` de vuelta a `MM/AAAA` para rehidratar
|
|
9
|
+
* los inputs del filtro al reabrir el diálogo.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Evalúa un filtro de rango de año-mes contra el valor numérico `AAAAMM` de una
|
|
13
|
+
* fila (`null` cuando la fila no tiene fecha). Devuelve `true` cuando el filtro
|
|
14
|
+
* no aplica, replicando el contrato de los demás matchers de la tabla.
|
|
15
|
+
*/
|
|
16
|
+
export declare function matchesAdvancedYearMonthRangeFilter(columnFilterValue: unknown, value: number | null): boolean;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const YEAR_MONTH_INPUT_PATTERN = /^(0[1-9]|1[0-2])\/(\d{4})$/;
|
|
2
|
+
/**
|
|
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
|
+
export function parseYearMonthFilterInput(value) {
|
|
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
|
+
}
|
|
15
|
+
/**
|
|
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
|
+
/**
|
|
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
|
+
export function matchesAdvancedYearMonthRangeFilter(columnFilterValue, value) {
|
|
25
|
+
if (!columnFilterValue ||
|
|
26
|
+
typeof columnFilterValue !== "object" ||
|
|
27
|
+
columnFilterValue.kind !== "yearMonthRange") {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
const filterValue = columnFilterValue;
|
|
31
|
+
const hasValue = value != null && Number.isFinite(value);
|
|
32
|
+
if (filterValue.mode === "hasValue") {
|
|
33
|
+
return hasValue;
|
|
34
|
+
}
|
|
35
|
+
if (filterValue.mode === "noValue") {
|
|
36
|
+
return !hasValue;
|
|
37
|
+
}
|
|
38
|
+
if (!hasValue) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (filterValue.min != null && value < filterValue.min) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (filterValue.max != null && value > filterValue.max) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
package/dist/next.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Isolates optional Next.js imports from the framework-neutral package entrypoint. */
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type BeezUIProviderProps as BaseBeezUIProviderProps } from "./providers/beez-ui-provider.js";
|
|
4
|
+
/** Configures Next adapters without forcing image host configuration on existing apps. */
|
|
5
|
+
export interface BeezUIProviderProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Enables the image optimizer; configure allowed image hosts in the application. */
|
|
8
|
+
optimizeImages?: boolean;
|
|
9
|
+
/** Keeps speculative navigation opt-in, matching LaTribu's existing behavior. */
|
|
10
|
+
prefetch?: boolean;
|
|
11
|
+
themeOptions?: BaseBeezUIProviderProps["themeOptions"];
|
|
12
|
+
}
|
|
13
|
+
/** Activates Next.js navigation and images for every descendant using shared primitives. */
|
|
14
|
+
export declare function BeezUIProvider({ children, optimizeImages, prefetch, themeOptions }: BeezUIProviderProps): import("react").JSX.Element;
|
package/dist/next.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/** Isolates optional Next.js imports from the framework-neutral package entrypoint. */
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import NextImageModule from "next/image.js";
|
|
6
|
+
import NextLinkModule from "next/link.js";
|
|
7
|
+
import { BeezUIProvider as BaseBeezUIProvider } from "./providers/beez-ui-provider.js";
|
|
8
|
+
import { imageDimension } from "./lib/image-dimensions.js";
|
|
9
|
+
/** Supports both native ESM loading of Next's CommonJS modules and bundler interop. */
|
|
10
|
+
const NextImage = NextImageModule.default ?? NextImageModule;
|
|
11
|
+
const NextLink = NextLinkModule.default ?? NextLinkModule;
|
|
12
|
+
/** Activates Next.js navigation and images for every descendant using shared primitives. */
|
|
13
|
+
export function BeezUIProvider({ children, optimizeImages = false, prefetch = false, themeOptions }) {
|
|
14
|
+
const components = useMemo(() => ({
|
|
15
|
+
/** Delegates routing while retaining the consumer's native link props. */
|
|
16
|
+
Link: function NextRoutingAdapter({ prefetch: linkPrefetch, ...props }) {
|
|
17
|
+
return _jsx(NextLink, { ...props, prefetch: linkPrefetch ?? prefetch });
|
|
18
|
+
},
|
|
19
|
+
/** Delegates loading to Next while the avatar primitive owns error/fallback state. */
|
|
20
|
+
Image: function NextImageAdapter(props) {
|
|
21
|
+
if (!props.src)
|
|
22
|
+
return _jsx("img", { ...props });
|
|
23
|
+
return _jsx(NextImage, { ...props, alt: props.alt ?? "", src: props.src, width: imageDimension(props.width), height: imageDimension(props.height), unoptimized: !optimizeImages });
|
|
24
|
+
},
|
|
25
|
+
}), [optimizeImages, prefetch]);
|
|
26
|
+
return _jsx(BaseBeezUIProvider, { components: components, themeOptions: themeOptions, children: children });
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Shares optional rendering adapters without importing a framework into the core. */
|
|
2
|
+
import { type ComponentProps, type ComponentType, type ReactNode } from "react";
|
|
3
|
+
import { type ThemeProviderProps } from "next-themes";
|
|
4
|
+
/** Defines the native link contract accepted by routing adapters. */
|
|
5
|
+
export type BeezLinkProps = ComponentProps<"a"> & {
|
|
6
|
+
href: string;
|
|
7
|
+
/** Optional navigation hint consumed by framework adapters, never by native anchors. */
|
|
8
|
+
prefetch?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** Defines the native image contract accepted by image adapters. */
|
|
11
|
+
export type BeezImageProps = ComponentProps<"img">;
|
|
12
|
+
/** Lets each application select only the adapters it needs. */
|
|
13
|
+
export interface BeezUIComponents {
|
|
14
|
+
Link?: ComponentType<BeezLinkProps>;
|
|
15
|
+
Image?: ComponentType<BeezImageProps>;
|
|
16
|
+
}
|
|
17
|
+
/** Configures descendants while leaving theme and application state to the consumer. */
|
|
18
|
+
export interface BeezUIProviderProps {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
components?: BeezUIComponents;
|
|
21
|
+
/** Shares light/dark/system behavior while keeping the library's class-based theme contract. */
|
|
22
|
+
themeOptions?: Omit<ThemeProviderProps, "children" | "attribute">;
|
|
23
|
+
}
|
|
24
|
+
/** Merges nested overrides while preserving stable adapter identities. */
|
|
25
|
+
export declare function BeezUIProvider({ children, components, themeOptions }: BeezUIProviderProps): import("react").JSX.Element;
|
|
26
|
+
/** Reads adapters internally; native components work without a provider. */
|
|
27
|
+
export declare function useBeezUIComponents(): BeezUIComponents;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/** Shares optional rendering adapters without importing a framework into the core. */
|
|
4
|
+
import { createContext, useContext, useMemo } from "react";
|
|
5
|
+
import { ThemeProvider } from "next-themes";
|
|
6
|
+
/** Native elements remain the implicit fallback for unconfigured adapters. */
|
|
7
|
+
const EMPTY_COMPONENTS = {};
|
|
8
|
+
const AdapterContext = createContext(EMPTY_COMPONENTS);
|
|
9
|
+
/** Merges nested overrides while preserving stable adapter identities. */
|
|
10
|
+
export function BeezUIProvider({ children, components = EMPTY_COMPONENTS, themeOptions }) {
|
|
11
|
+
const parent = useContext(AdapterContext);
|
|
12
|
+
const value = useMemo(() => ({ ...parent, ...components }), [parent, components]);
|
|
13
|
+
return _jsx(ThemeProvider, { attribute: "class", ...themeOptions, children: _jsx(AdapterContext.Provider, { value: value, children: children }) });
|
|
14
|
+
}
|
|
15
|
+
/** Reads adapters internally; native components work without a provider. */
|
|
16
|
+
export function useBeezUIComponents() {
|
|
17
|
+
return useContext(AdapterContext);
|
|
18
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type BeezUIProviderProps } from "./beez-ui-provider.js";
|
|
2
|
+
export type { BeezUIProviderProps } from "./beez-ui-provider.js";
|
|
3
|
+
/** Combines native navigation, responsive Unpic images and the shared theme provider. */
|
|
4
|
+
export declare function BeezUIProvider({ components, ...props }: BeezUIProviderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/** Keeps the default image integration separate from optional framework entrypoints. */
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { BeezUIProvider as BaseBeezUIProvider } from "./beez-ui-provider.js";
|
|
6
|
+
import { UnpicImageAdapter } from "../adapters/unpic-image.js";
|
|
7
|
+
/** Combines native navigation, responsive Unpic images and the shared theme provider. */
|
|
8
|
+
export function BeezUIProvider({ components, ...props }) {
|
|
9
|
+
const nativeComponents = useMemo(() => ({ Image: UnpicImageAdapter, ...components }), [components]);
|
|
10
|
+
return _jsx(BaseBeezUIProvider, { ...props, components: nativeComponents });
|
|
11
|
+
}
|
package/dist/sonner.d.ts
ADDED
package/dist/sonner.js
ADDED