@frantsiles/core 0.0.0-stage → 0.1.0-beta.1
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/LICENSE +21 -0
- package/README.md +29 -2
- package/dist/index.css +1 -0
- package/dist/index.d.ts +338 -0
- package/dist/index.js +2958 -0
- package/package.json +55 -3
- package/src/styles/theme.css +124 -0
- package/src/styles/tokens.css +387 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Francisco Torres Siles
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @frantsiles/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Tokens de diseño (variables CSS), temas y utilidades de accesibilidad del UI kit [`@frantsiles/components`](https://www.npmjs.com/package/@frantsiles/components).
|
|
4
|
+
|
|
5
|
+
**Documentación:** [Storybook](https://frantsiles.github.io/react-ui-kit/)
|
|
6
|
+
|
|
7
|
+
## Estilos
|
|
8
|
+
|
|
9
|
+
```css
|
|
10
|
+
@import "tailwindcss";
|
|
11
|
+
@import "@frantsiles/core/styles/tokens.css";
|
|
12
|
+
@import "@frantsiles/core/styles/theme.css";
|
|
13
|
+
@source "../node_modules/@frantsiles";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- `tokens.css`: los valores de cada tema (`light`, `dark`, `high-contrast`) como variables CSS.
|
|
17
|
+
- `theme.css`: los expone a Tailwind con el prefijo `ui-` (`bg-ui-surface`, `text-ui-fg`…), sin chocar con el tema de tu app.
|
|
18
|
+
|
|
19
|
+
## Utilidades
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { cn, focusRing } from '@frantsiles/core';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- `cn()`: combina clases de Tailwind resolviendo conflictos.
|
|
26
|
+
- `focusRing`, `fieldFocusRing`: el anillo de foco del kit.
|
|
27
|
+
|
|
28
|
+
## Licencia
|
|
29
|
+
|
|
30
|
+
MIT
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root,[data-theme=light]{color-scheme:light;--color-primary-50: 239 246 255;--color-primary-100: 219 234 254;--color-primary-200: 191 219 254;--color-primary-300: 147 197 253;--color-primary-400: 96 165 250;--color-primary-500: 59 130 246;--color-primary-600: 37 99 235;--color-primary-700: 29 78 216;--color-primary-800: 30 64 175;--color-primary-900: 30 58 138;--color-secondary-50: 248 250 252;--color-secondary-100: 241 245 249;--color-secondary-200: 226 232 240;--color-secondary-300: 203 213 225;--color-secondary-400: 148 163 184;--color-secondary-500: 100 116 139;--color-secondary-600: 71 85 105;--color-secondary-700: 51 65 85;--color-secondary-800: 30 41 59;--color-secondary-900: 15 23 42;--color-neutral-50: 250 250 250;--color-neutral-100: 245 245 245;--color-neutral-200: 229 229 229;--color-neutral-300: 212 212 212;--color-neutral-400: 163 163 163;--color-neutral-500: 115 115 115;--color-neutral-600: 82 82 82;--color-neutral-700: 64 64 64;--color-neutral-800: 38 38 38;--color-neutral-900: 23 23 23;--color-success-50: 240 253 244;--color-success-100: 220 252 231;--color-success-200: 187 247 208;--color-success-300: 134 239 172;--color-success-400: 74 222 128;--color-success-500: 34 197 94;--color-success-600: 22 163 74;--color-success-700: 21 128 61;--color-success-800: 22 101 52;--color-success-900: 20 83 45;--color-warning-50: 255 251 235;--color-warning-100: 254 243 199;--color-warning-200: 253 230 138;--color-warning-300: 252 211 77;--color-warning-400: 251 191 36;--color-warning-500: 245 158 11;--color-warning-600: 217 119 6;--color-warning-700: 180 83 9;--color-warning-800: 146 64 14;--color-warning-900: 120 53 15;--color-error-50: 254 242 242;--color-error-100: 254 226 226;--color-error-200: 254 202 202;--color-error-300: 252 165 165;--color-error-400: 248 113 113;--color-error-500: 239 68 68;--color-error-600: 220 38 38;--color-error-700: 185 28 28;--color-error-800: 153 27 27;--color-error-900: 127 29 29;--font-size-xs: .75rem;--font-size-sm: .875rem;--font-size-base: 1rem;--font-size-lg: 1.125rem;--font-size-xl: 1.25rem;--font-size-2xl: 1.5rem;--font-size-3xl: 1.875rem;--font-size-4xl: 2.25rem;--line-height-xs: 1rem;--line-height-sm: 1.25rem;--line-height-base: 1.5rem;--line-height-lg: 1.75rem;--line-height-xl: 1.75rem;--line-height-2xl: 2rem;--line-height-3xl: 2.25rem;--line-height-4xl: 2.5rem;--shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--radius-xs: .125rem;--radius-sm: .25rem;--radius-md: .375rem;--radius-lg: .5rem;--radius-xl: .75rem;--border-width-xs: 1px;--border-width-sm: 2px;--border-width-md: 3px;--border-width-lg: 4px}[data-theme=dark]{--color-neutral-50: 23 23 23;--color-neutral-100: 38 38 38;--color-neutral-200: 64 64 64;--color-neutral-300: 82 82 82;--color-neutral-400: 115 115 115;--color-neutral-500: 163 163 163;--color-neutral-600: 212 212 212;--color-neutral-700: 229 229 229;--color-neutral-800: 245 245 245;--color-neutral-900: 250 250 250}[data-theme=high-contrast]{--color-primary-500: 0 0 0;--color-primary-600: 0 0 0;--color-neutral-50: 255 255 255;--color-neutral-900: 0 0 0}:root,[data-theme]{--ui-color-surface: rgb(255 255 255);--ui-color-surface-muted: rgb(var(--color-neutral-100));--ui-color-surface-disabled: rgb(var(--color-neutral-100));--ui-color-fg: rgb(var(--color-neutral-900));--ui-color-fg-muted: rgb(var(--color-neutral-600));--ui-color-fg-disabled: rgb(var(--color-neutral-500));--ui-color-border: rgb(var(--color-neutral-500));--ui-color-border-subtle: rgb(var(--color-neutral-200));--ui-color-border-hover: rgb(var(--color-neutral-700));--ui-color-focus: rgb(var(--color-primary-600));--ui-color-primary: rgb(var(--color-primary-700));--ui-color-primary-soft: rgb(var(--color-primary-50));--ui-color-danger: rgb(var(--color-error-700));--ui-color-danger-soft: rgb(var(--color-error-50));--ui-color-success: rgb(var(--color-success-800));--ui-color-success-soft: rgb(var(--color-success-50));--ui-color-warning: rgb(var(--color-warning-800));--ui-color-warning-soft: rgb(var(--color-warning-50));--ui-color-surface-raised: rgb(255 255 255);--ui-color-overlay: rgb(0 0 0 / .5);--ui-color-fg-hover: color-mix(in srgb, var(--ui-color-fg), var(--ui-color-surface) 20%);--ui-color-primary-hover: color-mix(in srgb, var(--ui-color-primary), var(--ui-color-fg) 20%);--ui-color-success-hover: color-mix(in srgb, var(--ui-color-success), var(--ui-color-fg) 20%);--ui-color-warning-hover: color-mix(in srgb, var(--ui-color-warning), var(--ui-color-fg) 20%);--ui-color-danger-hover: color-mix(in srgb, var(--ui-color-danger), var(--ui-color-fg) 20%);--ui-focus-ring-width: 2px;--ui-focus-ring-offset: 2px;--ui-shadow-raised: 0 1px 2px 0 rgb(0 0 0 / .06), 0 1px 3px 0 rgb(0 0 0 / .1);--ui-shadow-overlay: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ui-shadow-modal: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1)}:root{--ui-font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";--ui-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;--ui-font-weight-regular: 400;--ui-font-weight-medium: 500;--ui-font-weight-semibold: 600;--ui-font-weight-bold: 700;--ui-text-caption-size: .75rem;--ui-text-caption-line-height: 1.3333;--ui-text-caption-weight: var(--ui-font-weight-regular);--ui-text-body-sm-size: .875rem;--ui-text-body-sm-line-height: 1.4286;--ui-text-body-sm-weight: var(--ui-font-weight-regular);--ui-text-body-size: 1rem;--ui-text-body-line-height: 1.5;--ui-text-body-weight: var(--ui-font-weight-regular);--ui-text-body-lg-size: 1.125rem;--ui-text-body-lg-line-height: 1.5556;--ui-text-body-lg-weight: var(--ui-font-weight-regular);--ui-text-label-size: .875rem;--ui-text-label-line-height: 1.4286;--ui-text-label-weight: var(--ui-font-weight-medium);--ui-text-heading-sm-size: 1rem;--ui-text-heading-sm-line-height: 1.5;--ui-text-heading-sm-weight: var(--ui-font-weight-semibold);--ui-text-heading-md-size: 1.25rem;--ui-text-heading-md-line-height: 1.4;--ui-text-heading-md-weight: var(--ui-font-weight-semibold);--ui-text-heading-lg-size: 1.5rem;--ui-text-heading-lg-line-height: 1.3333;--ui-text-heading-lg-weight: var(--ui-font-weight-semibold);--ui-text-heading-xl-size: 1.875rem;--ui-text-heading-xl-line-height: 1.2;--ui-text-heading-xl-weight: var(--ui-font-weight-bold);--ui-text-display-size: 2.25rem;--ui-text-display-line-height: 1.1111;--ui-text-display-weight: var(--ui-font-weight-bold);--ui-measure: 65ch;--ui-z-sticky: 100;--ui-z-modal: 300;--ui-z-popover: 400;--ui-z-toast: 500;--ui-z-tooltip: 600;--ui-duration-fast: .12s;--ui-duration-normal: .2s;--ui-duration-slow: .3s;--ui-ease-standard: cubic-bezier(.2, 0, 0, 1);--ui-ease-enter: cubic-bezier(0, 0, .2, 1);--ui-ease-exit: cubic-bezier(.4, 0, 1, 1);--ui-space-xs: .25rem;--ui-space-sm: .5rem;--ui-space-md: 1rem;--ui-space-lg: 1.5rem;--ui-space-xl: 2rem;--ui-space-2xl: 3rem;--ui-control-height-sm: 2rem;--ui-control-height-md: 2.5rem;--ui-control-height-lg: 3rem}[data-density=compact]{--ui-control-height-sm: 1.75rem;--ui-control-height-md: 2.25rem;--ui-control-height-lg: 2.75rem;--ui-space-sm: .375rem;--ui-space-md: .75rem;--ui-space-lg: 1rem;--ui-space-xl: 1.5rem;--ui-space-2xl: 2rem}[data-density=comfortable]{--ui-control-height-sm: 2rem;--ui-control-height-md: 2.5rem;--ui-control-height-lg: 3rem;--ui-space-sm: .5rem;--ui-space-md: 1rem;--ui-space-lg: 1.5rem;--ui-space-xl: 2rem;--ui-space-2xl: 3rem}[data-theme=dark]{color-scheme:dark;--ui-color-surface: rgb(var(--color-neutral-50));--ui-color-surface-muted: rgb(var(--color-neutral-100));--ui-color-surface-disabled: rgb(var(--color-neutral-100));--ui-color-focus: rgb(var(--color-primary-400));--ui-color-primary: rgb(var(--color-primary-300));--ui-color-primary-soft: rgb(30 58 138 / .35);--ui-color-danger: rgb(var(--color-error-400));--ui-color-danger-soft: rgb(127 29 29 / .35);--ui-color-success: rgb(var(--color-success-400));--ui-color-success-soft: rgb(20 83 45 / .35);--ui-color-warning: rgb(var(--color-warning-400));--ui-color-warning-soft: rgb(120 53 15 / .35);--ui-color-surface-raised: rgb(31 31 31);--ui-color-overlay: rgb(0 0 0 / .7);--ui-shadow-raised: 0 1px 2px 0 rgb(0 0 0 / .4), 0 1px 3px 0 rgb(0 0 0 / .5);--ui-shadow-overlay: 0 4px 6px -1px rgb(0 0 0 / .5), 0 2px 4px -2px rgb(0 0 0 / .5);--ui-shadow-modal: 0 20px 25px -5px rgb(0 0 0 / .6), 0 8px 10px -6px rgb(0 0 0 / .6)}[data-theme=high-contrast]{color-scheme:light;--ui-color-surface: rgb(255 255 255);--ui-color-surface-muted: rgb(255 255 255);--ui-color-surface-disabled: rgb(229 229 229);--ui-color-fg: rgb(0 0 0);--ui-color-fg-muted: rgb(0 0 0);--ui-color-fg-disabled: rgb(64 64 64);--ui-color-border: rgb(0 0 0);--ui-color-border-subtle: rgb(0 0 0);--ui-color-border-hover: rgb(0 0 0);--ui-color-focus: rgb(0 0 238);--ui-color-primary: rgb(0 0 160);--ui-color-primary-soft: rgb(255 255 255);--ui-color-danger: rgb(160 0 0);--ui-color-danger-soft: rgb(255 255 255);--ui-color-success: rgb(0 100 0);--ui-color-success-soft: rgb(255 255 255);--ui-color-warning: rgb(110 60 0);--ui-color-warning-soft: rgb(255 255 255);--ui-color-surface-raised: rgb(255 255 255);--ui-color-overlay: rgb(0 0 0 / .7);--ui-focus-ring-width: 3px;--ui-shadow-raised: none;--ui-shadow-overlay: none;--ui-shadow-modal: none}@media(prefers-reduced-motion:reduce){:root{--ui-duration-fast: .01ms;--ui-duration-normal: .01ms;--ui-duration-slow: .01ms}}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Common alignment options
|
|
6
|
+
*/
|
|
7
|
+
export declare type Alignment = 'left' | 'center' | 'right' | 'justify';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Animation duration options
|
|
11
|
+
*/
|
|
12
|
+
export declare type AnimationDuration = 'fast' | 'normal' | 'slow';
|
|
13
|
+
|
|
14
|
+
export declare const applyTheme: (theme: Theme) => void;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Base props that most components should accept
|
|
18
|
+
*/
|
|
19
|
+
export declare interface BaseProps {
|
|
20
|
+
/**
|
|
21
|
+
* Additional CSS class names
|
|
22
|
+
*/
|
|
23
|
+
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Inline styles
|
|
26
|
+
*/
|
|
27
|
+
style?: React.CSSProperties;
|
|
28
|
+
/**
|
|
29
|
+
* Test ID for testing purposes
|
|
30
|
+
*/
|
|
31
|
+
'data-testid'?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Unique identifier
|
|
34
|
+
*/
|
|
35
|
+
id?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Breakpoints de pantalla del kit (ver `breakpoints` en tokens.ts)
|
|
40
|
+
*/
|
|
41
|
+
export declare type Breakpoint = BreakpointName;
|
|
42
|
+
|
|
43
|
+
export declare type BreakpointName = keyof typeof breakpoints;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Breakpoints de pantalla (variantes `ui-sm:`, `ui-md:`…). Las media queries no
|
|
47
|
+
* aceptan variables CSS, por eso los valores viven aquí y en `theme.css`.
|
|
48
|
+
*/
|
|
49
|
+
export declare const breakpoints: {
|
|
50
|
+
readonly sm: "40rem";
|
|
51
|
+
readonly md: "48rem";
|
|
52
|
+
readonly lg: "64rem";
|
|
53
|
+
readonly xl: "80rem";
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Utility function to capitalize first letter
|
|
58
|
+
*/
|
|
59
|
+
export declare function capitalize(str: string): string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Props for clickable components
|
|
63
|
+
*/
|
|
64
|
+
export declare interface ClickableProps {
|
|
65
|
+
/**
|
|
66
|
+
* Click handler
|
|
67
|
+
*/
|
|
68
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the component should be focusable
|
|
71
|
+
*/
|
|
72
|
+
focusable?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Tab index for keyboard navigation
|
|
75
|
+
*/
|
|
76
|
+
tabIndex?: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Une clases y resuelve conflictos de Tailwind: la última gana. Pon el
|
|
81
|
+
* `className` del usuario al final.
|
|
82
|
+
*/
|
|
83
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Common color variants used across components
|
|
87
|
+
*/
|
|
88
|
+
export declare type ColorVariant = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'neutral';
|
|
89
|
+
|
|
90
|
+
/** Tamaños de contenedor (variantes `@ui-sm:`, `@ui-md:`… con `@container`). */
|
|
91
|
+
export declare const containerSizes: {
|
|
92
|
+
readonly xs: "20rem";
|
|
93
|
+
readonly sm: "24rem";
|
|
94
|
+
readonly md: "36rem";
|
|
95
|
+
readonly lg: "48rem";
|
|
96
|
+
readonly xl: "64rem";
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export declare function core(): string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Utility function to create a debounced version of a function
|
|
103
|
+
*/
|
|
104
|
+
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
105
|
+
|
|
106
|
+
/** Densidades (`data-density` en `<html>` o en una sección). */
|
|
107
|
+
export declare const densities: readonly ["comfortable", "compact"];
|
|
108
|
+
|
|
109
|
+
export declare type Density = (typeof densities)[number];
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Props for components that can be disabled
|
|
113
|
+
*/
|
|
114
|
+
export declare interface DisableableProps {
|
|
115
|
+
/**
|
|
116
|
+
* Whether the component is disabled
|
|
117
|
+
*/
|
|
118
|
+
disabled?: boolean;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Curvas de movimiento (`ease-ui-<curva>`). */
|
|
122
|
+
export declare const easings: readonly ["standard", "enter", "exit"];
|
|
123
|
+
|
|
124
|
+
export declare type Elevation = (typeof elevations)[number];
|
|
125
|
+
|
|
126
|
+
/** Niveles de elevación (`shadow-ui-<nivel>`). */
|
|
127
|
+
export declare const elevations: readonly ["raised", "overlay", "modal"];
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Anillo de foco para el contenedor que envuelve un <input> (el "borde" visible
|
|
131
|
+
* del Input). Solo reacciona al foco del <input>, no al de botones internos
|
|
132
|
+
* (mostrar contraseña, limpiar), que tienen su propio anillo.
|
|
133
|
+
*/
|
|
134
|
+
export declare const fieldFocusRing = "has-[input:focus-visible]:outline-solid has-[input:focus-visible]:outline-[length:var(--ui-focus-ring-width)] has-[input:focus-visible]:outline-offset-[var(--ui-focus-ring-offset)] has-[input:focus-visible]:outline-ui-focus";
|
|
135
|
+
|
|
136
|
+
/** Anillo de foco para elementos que reciben el foco directamente (botones, tags). */
|
|
137
|
+
export declare const focusRing = "outline-hidden focus-visible:outline-solid focus-visible:outline-[length:var(--ui-focus-ring-width)] focus-visible:outline-offset-[var(--ui-focus-ring-offset)] focus-visible:outline-ui-focus";
|
|
138
|
+
|
|
139
|
+
/** Familias tipográficas (`font-ui-<familia>`). */
|
|
140
|
+
export declare const fontFamilies: readonly ["sans", "mono"];
|
|
141
|
+
|
|
142
|
+
export declare type FontWeight = (typeof fontWeights)[number];
|
|
143
|
+
|
|
144
|
+
/** Pesos de letra (`font-ui-<peso>`). */
|
|
145
|
+
export declare const fontWeights: readonly ["regular", "medium", "semibold", "bold"];
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Utility function to format file sizes
|
|
149
|
+
*/
|
|
150
|
+
export declare function formatFileSize(bytes: number): string;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Props for form components
|
|
154
|
+
*/
|
|
155
|
+
export declare interface FormProps {
|
|
156
|
+
/**
|
|
157
|
+
* The name attribute for form elements
|
|
158
|
+
*/
|
|
159
|
+
name?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Whether the field is required
|
|
162
|
+
*/
|
|
163
|
+
required?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Validation state
|
|
166
|
+
*/
|
|
167
|
+
validationState?: ValidationState;
|
|
168
|
+
/**
|
|
169
|
+
* Error message to display
|
|
170
|
+
*/
|
|
171
|
+
errorMessage?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Help text to display
|
|
174
|
+
*/
|
|
175
|
+
helpText?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Label for the form element
|
|
178
|
+
*/
|
|
179
|
+
label?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Placeholder text
|
|
182
|
+
*/
|
|
183
|
+
placeholder?: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Utility function to generate unique IDs
|
|
188
|
+
*
|
|
189
|
+
* @deprecated No usar para asociar elementos (label ↔ input, aria-describedby):
|
|
190
|
+
* genera valores distintos en servidor y cliente y rompe la hidratación con SSR.
|
|
191
|
+
* En componentes React usa `useId()`.
|
|
192
|
+
*/
|
|
193
|
+
export declare function generateId(prefix?: string): string;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Utility function to safely access localStorage
|
|
197
|
+
*/
|
|
198
|
+
export declare function getStorageItem(key: string, defaultValue?: string): string | null;
|
|
199
|
+
|
|
200
|
+
export declare const getTheme: () => Theme;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Combined props for interactive components
|
|
204
|
+
*/
|
|
205
|
+
export declare interface InteractiveProps extends BaseProps, DisableableProps, LoadableProps, ClickableProps {
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Utility function to check if code is running in browser
|
|
210
|
+
*/
|
|
211
|
+
export declare function isBrowser(): boolean;
|
|
212
|
+
|
|
213
|
+
export declare type Layer = (typeof layers)[number];
|
|
214
|
+
|
|
215
|
+
/** Capas de apilamiento (`z-(--ui-z-<capa>)`), de menor a mayor. */
|
|
216
|
+
export declare const layers: readonly ["sticky", "modal", "popover", "toast", "tooltip"];
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Props for components that can have loading states
|
|
220
|
+
*/
|
|
221
|
+
export declare interface LoadableProps {
|
|
222
|
+
/**
|
|
223
|
+
* Whether the component is in a loading state
|
|
224
|
+
*/
|
|
225
|
+
loading?: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Loading state details
|
|
228
|
+
*/
|
|
229
|
+
loadingState?: LoadingState;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Common loading states
|
|
234
|
+
*/
|
|
235
|
+
export declare type LoadingState = 'idle' | 'loading' | 'success' | 'error';
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Media query de "al menos este breakpoint", para `matchMedia`:
|
|
239
|
+
*
|
|
240
|
+
* ```ts
|
|
241
|
+
* window.matchMedia(mediaQuery('md')).matches;
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
export declare function mediaQuery(breakpoint: BreakpointName): string;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Common position options
|
|
248
|
+
*/
|
|
249
|
+
export declare type Position = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Responsive value type that can accept different values for different breakpoints
|
|
253
|
+
*/
|
|
254
|
+
export declare type ResponsiveValue<T> = T | Partial<Record<Breakpoint, T>>;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Utility function to safely set localStorage
|
|
258
|
+
*/
|
|
259
|
+
export declare function setStorageItem(key: string, value: string): boolean;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Common size variants used across components
|
|
263
|
+
*/
|
|
264
|
+
export declare type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
265
|
+
|
|
266
|
+
export declare type Space = (typeof spaces)[number];
|
|
267
|
+
|
|
268
|
+
/** Escala de espaciado (`gap-ui-<paso>`, `p-ui-<paso>`). Se reduce en densidad compacta. */
|
|
269
|
+
export declare const spaces: readonly ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
270
|
+
|
|
271
|
+
export declare type TextStyle = (typeof textStyles)[number];
|
|
272
|
+
|
|
273
|
+
/** Estilos de texto por rol (`text-ui-<estilo>` en Tailwind). */
|
|
274
|
+
export declare const textStyles: readonly ["caption", "body-sm", "body", "body-lg", "label", "heading-sm", "heading-md", "heading-lg", "heading-xl", "display"];
|
|
275
|
+
|
|
276
|
+
export declare type Theme = 'light' | 'dark' | 'high-contrast';
|
|
277
|
+
|
|
278
|
+
export declare interface ThemeConfig {
|
|
279
|
+
theme: Theme;
|
|
280
|
+
cssVariables: Record<string, string>;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export declare const themes: Record<Theme, ThemeConfig>;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Utility function to create a throttled version of a function
|
|
287
|
+
*/
|
|
288
|
+
export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void;
|
|
289
|
+
|
|
290
|
+
export declare const toggleTheme: () => Theme;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Utility function to truncate text
|
|
294
|
+
*/
|
|
295
|
+
export declare function truncate(str: string, length: number): string;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Common validation states
|
|
299
|
+
*/
|
|
300
|
+
export declare type ValidationState = 'valid' | 'invalid' | 'warning' | undefined;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Common button/component variants
|
|
304
|
+
*/
|
|
305
|
+
export declare type Variant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'link';
|
|
306
|
+
|
|
307
|
+
/** Oculta visualmente sin ocultar a lectores de pantalla. */
|
|
308
|
+
export declare const visuallyHidden = "sr-only";
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Props for components that can have children
|
|
312
|
+
*/
|
|
313
|
+
export declare interface WithChildren {
|
|
314
|
+
/**
|
|
315
|
+
* Child elements
|
|
316
|
+
*/
|
|
317
|
+
children?: ReactNode;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Props for components that can have icons
|
|
322
|
+
*/
|
|
323
|
+
export declare interface WithIcon {
|
|
324
|
+
/**
|
|
325
|
+
* Icon to display (usually before content)
|
|
326
|
+
*/
|
|
327
|
+
icon?: ReactNode;
|
|
328
|
+
/**
|
|
329
|
+
* Icon to display after content
|
|
330
|
+
*/
|
|
331
|
+
iconAfter?: ReactNode;
|
|
332
|
+
/**
|
|
333
|
+
* Whether to show only the icon (hide text content)
|
|
334
|
+
*/
|
|
335
|
+
iconOnly?: boolean;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export { }
|