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,188 @@
|
|
|
1
|
+
import type { DataTableColumnFilterValue } from "../types/data-table.js";
|
|
2
|
+
/** Slug de valor para los modos de presencia/rango mes-año sin cota. */
|
|
3
|
+
export declare const YEAR_MONTH_NO_VALUE_SLUG = "sin-fechas";
|
|
4
|
+
export declare const YEAR_MONTH_HAS_VALUE_SLUG = "con-fechas";
|
|
5
|
+
export declare const PRESENCE_TRUE_SLUG = "si";
|
|
6
|
+
export declare const PRESENCE_FALSE_SLUG = "no";
|
|
7
|
+
/**
|
|
8
|
+
* GitHub-style meta-keys to filter by presence/absence of ANY field:
|
|
9
|
+
* `tiene:<field>` (the field has a value) and `no:<field>` (the field is empty).
|
|
10
|
+
* The token value is the key of the target qualifier (e.g. `tiene:enviados`,
|
|
11
|
+
* `no:carpeta`). They unify presence across every kind into a single syntax,
|
|
12
|
+
* instead of a `<field>:si/no` per qualifier.
|
|
13
|
+
*/
|
|
14
|
+
export declare const PRESENCE_HAS_META_KEY = "tiene";
|
|
15
|
+
export declare const PRESENCE_NO_META_KEY = "no";
|
|
16
|
+
export type FilterQualifierKind = "text" | "numberRange" | "enum" | "presence" | "yearMonthRange" | "textMatch" | "folder";
|
|
17
|
+
/** Operadores soportados por un qualifier de texto (`textMatch`). */
|
|
18
|
+
export type TextMatchOperator = "has" | "notHas" | "startsWith" | "endsWith" | "equals" | "contains";
|
|
19
|
+
/** Valor estructurado de un qualifier de texto (link, prestamista, etc.). */
|
|
20
|
+
export interface TextMatchFilterValue {
|
|
21
|
+
kind: "textMatch";
|
|
22
|
+
op: TextMatchOperator;
|
|
23
|
+
/** Texto a comparar (normalizado). Ausente para `has`/`notHas`. */
|
|
24
|
+
text?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Identificador de "sin carpeta asignada" en un qualifier de carpeta. */
|
|
27
|
+
export declare const UNASSIGNED_FOLDER_FILTER_VALUE = "__unassigned__";
|
|
28
|
+
/** Valor de un qualifier de carpeta (un token; el predicado agrupa varios). */
|
|
29
|
+
export interface FolderFilterValue {
|
|
30
|
+
kind: "folder";
|
|
31
|
+
/** Id de carpeta, o `UNASSIGNED_FOLDER_FILTER_VALUE` para sin carpeta. */
|
|
32
|
+
folderId: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Valor estructurado que viaja al predicado de filtrado, independiente de las
|
|
36
|
+
* columnas de TanStack. Une los valores clásicos por columna con los nuevos
|
|
37
|
+
* (texto y carpeta) que no tienen columna.
|
|
38
|
+
*/
|
|
39
|
+
export type AppliedFilterValue = DataTableColumnFilterValue | TextMatchFilterValue | FolderFilterValue;
|
|
40
|
+
/** Un filtro aplicado parseado desde la query: `clave`, negación y valor. */
|
|
41
|
+
export interface AppliedFilter {
|
|
42
|
+
key: string;
|
|
43
|
+
negated: boolean;
|
|
44
|
+
value: AppliedFilterValue;
|
|
45
|
+
}
|
|
46
|
+
export interface FilterQualifierOption {
|
|
47
|
+
/** Slug que el usuario tipea (sin acentos ni espacios). */
|
|
48
|
+
slug: string;
|
|
49
|
+
/** Etiqueta visible en el autocompletado. */
|
|
50
|
+
label: string;
|
|
51
|
+
/** Valor interno que consume el matcher de la columna. */
|
|
52
|
+
value: string;
|
|
53
|
+
}
|
|
54
|
+
export interface FilterQualifierConfig {
|
|
55
|
+
/**
|
|
56
|
+
* Slug que el usuario tipea antes del `:`. Cadena vacía para el qualifier de
|
|
57
|
+
* texto libre por defecto (búsqueda fuzzy por descripción).
|
|
58
|
+
*/
|
|
59
|
+
key: string;
|
|
60
|
+
/** Claves alternativas aceptadas al parsear (no se sugieren). */
|
|
61
|
+
aliases?: string[];
|
|
62
|
+
/** Columna destino para los filtros avanzados. Ausente para texto libre. */
|
|
63
|
+
columnId?: string;
|
|
64
|
+
kind: FilterQualifierKind;
|
|
65
|
+
/** Etiqueta humana mostrada en la sugerencia de clave. */
|
|
66
|
+
label: string;
|
|
67
|
+
/** Valores sugeridos para enum/presence. */
|
|
68
|
+
options?: FilterQualifierOption[];
|
|
69
|
+
/**
|
|
70
|
+
* Logical name of the icon to show in the bar (UI-agnostic; the bar maps it
|
|
71
|
+
* to a component). E.g. `"user"` for lenders. When omitted, the bar uses the
|
|
72
|
+
* default icon for the `kind`.
|
|
73
|
+
*/
|
|
74
|
+
iconName?: string;
|
|
75
|
+
/**
|
|
76
|
+
* `false` cuando el campo siempre tiene valor y las meta-claves de presencia
|
|
77
|
+
* (`tiene:<clave>` / `no:<clave>`) no tienen sentido: la barra no las sugiere
|
|
78
|
+
* y el parser las rechaza como token inválido. Default: `true`.
|
|
79
|
+
*/
|
|
80
|
+
supportsPresence?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface FilterQueryToken {
|
|
83
|
+
/** Substring exacto del token (sin espacios alrededor). */
|
|
84
|
+
raw: string;
|
|
85
|
+
/** Índice del primer carácter del token en la query original. */
|
|
86
|
+
startIndex: number;
|
|
87
|
+
/** Índice siguiente al último carácter del token. */
|
|
88
|
+
endIndex: number;
|
|
89
|
+
/** Si el token arranca con `-` (negación / exclusión). */
|
|
90
|
+
negated: boolean;
|
|
91
|
+
/** Texto de la clave tal cual se tipeó (sin normalizar), o `null`. */
|
|
92
|
+
rawKey: string | null;
|
|
93
|
+
/** Valor del qualifier desenrollado de comillas, o `null` si no hay `:`. */
|
|
94
|
+
value: string | null;
|
|
95
|
+
/** Si el token contiene un `:` que separa clave de valor. */
|
|
96
|
+
hasColon: boolean;
|
|
97
|
+
}
|
|
98
|
+
export type InvalidFilterTokenReason = "unknownKey" | "invalidValue";
|
|
99
|
+
export interface InvalidFilterToken {
|
|
100
|
+
raw: string;
|
|
101
|
+
reason: InvalidFilterTokenReason;
|
|
102
|
+
}
|
|
103
|
+
export interface ParsedFilterQuery {
|
|
104
|
+
/** Texto libre positivo, concatenado para la búsqueda fuzzy por descripción. */
|
|
105
|
+
descriptionFilter: string;
|
|
106
|
+
/** Textos a excluir (`-texto`), crudos como espera la tabla. */
|
|
107
|
+
excludedDescriptionFilters: string[];
|
|
108
|
+
/**
|
|
109
|
+
* Filtros avanzados clásicos por `columnId`, derivados para compatibilidad con
|
|
110
|
+
* el path de columnas de TanStack. Solo incluye qualifiers no negados con
|
|
111
|
+
* columna. La fuente de verdad completa es {@link ParsedFilterQuery.appliedFilters}.
|
|
112
|
+
*/
|
|
113
|
+
advancedFiltersByColumn: Record<string, DataTableColumnFilterValue>;
|
|
114
|
+
/**
|
|
115
|
+
* Lista completa de filtros aplicados (cualquier kind, con o sin columna,
|
|
116
|
+
* incluyendo negados). El predicado de dominio consume esta lista.
|
|
117
|
+
*/
|
|
118
|
+
appliedFilters: AppliedFilter[];
|
|
119
|
+
/** Tokens que no se pudieron aplicar (clave o valor inválidos). */
|
|
120
|
+
invalidTokens: InvalidFilterToken[];
|
|
121
|
+
}
|
|
122
|
+
/** Normaliza una clave o slug: sin acentos, minúsculas, recortado. */
|
|
123
|
+
export declare function normalizeFilterSlug(value: string): string;
|
|
124
|
+
/**
|
|
125
|
+
* Divide la query en tokens respetando comillas (`"..."` / `'...'` agrupan
|
|
126
|
+
* espacios). Conserva los índices de cada token para que el autocompletado
|
|
127
|
+
* pueda ubicar el token bajo el caret.
|
|
128
|
+
*/
|
|
129
|
+
export declare function tokenizeFilterQuery(query: string): FilterQueryToken[];
|
|
130
|
+
/** Convierte un slug `AAAA-MM` a su valor numérico comparable `AAAAMM`. */
|
|
131
|
+
export declare function parseYearMonthSlug(value: string): number | null;
|
|
132
|
+
/** Formatea un valor numérico `AAAAMM` de vuelta a su slug `AAAA-MM`. */
|
|
133
|
+
export declare function formatYearMonthSlug(value: number): string;
|
|
134
|
+
/**
|
|
135
|
+
* Parses the value of a text qualifier (`textMatch`) with glob syntax. Accepts
|
|
136
|
+
* presence (`si`/`no`) and `*` wildcards: `text*` starts with, `*text` ends
|
|
137
|
+
* with, `*text*` contains, and `text` (no wildcard) is exact equality. The text
|
|
138
|
+
* is normalized (no accents, lowercase) to compare case/accent-insensitively.
|
|
139
|
+
*/
|
|
140
|
+
export declare function parseTextMatchValue(value: string): TextMatchFilterValue | null;
|
|
141
|
+
/**
|
|
142
|
+
* Parsea el valor de un qualifier de carpeta (`folder`) contra sus opciones
|
|
143
|
+
* dinámicas (slug→folderId). `sin-carpeta` mapea al sentinel de "sin asignar".
|
|
144
|
+
*/
|
|
145
|
+
export declare function parseFolderValue(config: FilterQualifierConfig, value: string): FolderFilterValue | null;
|
|
146
|
+
/** Parsea la query completa contra la configuración de qualifiers. */
|
|
147
|
+
export declare function parseFilterQuery(query: string, configs: FilterQualifierConfig[]): ParsedFilterQuery;
|
|
148
|
+
/** Reconstruye una query canónica a partir de un resultado parseado. */
|
|
149
|
+
export declare function serializeFilterQuery(parsed: ParsedFilterQuery, configs: FilterQualifierConfig[]): string;
|
|
150
|
+
/** Character range (within the query) of a value to highlight. */
|
|
151
|
+
export interface ValueHighlightRange {
|
|
152
|
+
start: number;
|
|
153
|
+
end: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Returns the character ranges of the VALUES (whatever comes after the `:`) that
|
|
157
|
+
* are valid for their qualifier, to highlight them in the bar. An invalid,
|
|
158
|
+
* unknown, or incomplete value produces no range (no highlight). Covers the
|
|
159
|
+
* presence meta-keys (`tiene:`/`no:` with an existing field) and the normal
|
|
160
|
+
* qualifiers (value parseable per its kind: enum, range, text, etc.).
|
|
161
|
+
*/
|
|
162
|
+
export declare function getValueHighlightRanges(query: string, configs: FilterQualifierConfig[]): ValueHighlightRange[];
|
|
163
|
+
export type FilterSuggestionMode = "key" | "value";
|
|
164
|
+
export interface ActiveFilterToken {
|
|
165
|
+
/** Modo de sugerencia según la posición del caret. */
|
|
166
|
+
mode: FilterSuggestionMode;
|
|
167
|
+
/** Texto de la clave tipeada hasta el caret (modo `key`). */
|
|
168
|
+
keyPart: string;
|
|
169
|
+
/** Texto del valor tipeado hasta el caret (modo `value`). */
|
|
170
|
+
valuePart: string;
|
|
171
|
+
/** Clave resuelta cuando el token ya tiene `:` (modo `value`). */
|
|
172
|
+
resolvedKey: string | null;
|
|
173
|
+
negated: boolean;
|
|
174
|
+
/** Rango de la query a reemplazar al insertar una sugerencia. */
|
|
175
|
+
replaceStart: number;
|
|
176
|
+
replaceEnd: number;
|
|
177
|
+
/**
|
|
178
|
+
* Start of the whole token (including `-` and the key). Allows replacing the
|
|
179
|
+
* entire token when inserting a meta-key (`tiene:<field>`) or an exclusion
|
|
180
|
+
* (`-<field>:`), not just the value segment.
|
|
181
|
+
*/
|
|
182
|
+
tokenStart: number;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Describe el token bajo el caret para alimentar el autocompletado. Decide si
|
|
186
|
+
* el usuario está tipeando una clave (sin `:`) o el valor de una clave.
|
|
187
|
+
*/
|
|
188
|
+
export declare function getActiveFilterToken(query: string, caretIndex: number): ActiveFilterToken;
|