@humansafe/design-system-full 0.0.0-stage → 1.0.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 +27 -0
- package/LICENSE +21 -0
- package/README.md +156 -2
- package/dist/components/Alert.d.ts +19 -0
- package/dist/components/Alert.d.ts.map +1 -0
- package/dist/components/Alert.js +20 -0
- package/dist/components/Alert.js.map +1 -0
- package/dist/components/Avatar.d.ts +12 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar.js +14 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Badge.d.ts +14 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/Badge.js +8 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/BarChart.d.ts +37 -0
- package/dist/components/BarChart.d.ts.map +1 -0
- package/dist/components/BarChart.js +30 -0
- package/dist/components/BarChart.js.map +1 -0
- package/dist/components/Button.d.ts +27 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +16 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Card.d.ts +22 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +12 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/Checkbox.d.ts +9 -0
- package/dist/components/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox.js +12 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/EmergencyButton.d.ts +35 -0
- package/dist/components/EmergencyButton.d.ts.map +1 -0
- package/dist/components/EmergencyButton.js +28 -0
- package/dist/components/EmergencyButton.js.map +1 -0
- package/dist/components/Header.d.ts +12 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.js +8 -0
- package/dist/components/Header.js.map +1 -0
- package/dist/components/Input.d.ts +17 -0
- package/dist/components/Input.d.ts.map +1 -0
- package/dist/components/Input.js +13 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/Logo.d.ts +28 -0
- package/dist/components/Logo.d.ts.map +1 -0
- package/dist/components/Logo.js +14 -0
- package/dist/components/Logo.js.map +1 -0
- package/dist/components/Menu.d.ts +24 -0
- package/dist/components/Menu.d.ts.map +1 -0
- package/dist/components/Menu.js +112 -0
- package/dist/components/Menu.js.map +1 -0
- package/dist/components/Modal.d.ts +21 -0
- package/dist/components/Modal.d.ts.map +1 -0
- package/dist/components/Modal.js +69 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/Pagination.d.ts +15 -0
- package/dist/components/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination.js +25 -0
- package/dist/components/Pagination.js.map +1 -0
- package/dist/components/Progress.d.ts +15 -0
- package/dist/components/Progress.d.ts.map +1 -0
- package/dist/components/Progress.js +12 -0
- package/dist/components/Progress.js.map +1 -0
- package/dist/components/QuizQuestion.d.ts +38 -0
- package/dist/components/QuizQuestion.d.ts.map +1 -0
- package/dist/components/QuizQuestion.js +30 -0
- package/dist/components/QuizQuestion.js.map +1 -0
- package/dist/components/Radio.d.ts +15 -0
- package/dist/components/Radio.d.ts.map +1 -0
- package/dist/components/Radio.js +17 -0
- package/dist/components/Radio.js.map +1 -0
- package/dist/components/Select.d.ts +21 -0
- package/dist/components/Select.d.ts.map +1 -0
- package/dist/components/Select.js +12 -0
- package/dist/components/Select.js.map +1 -0
- package/dist/components/Sidebar.d.ts +27 -0
- package/dist/components/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar.js +19 -0
- package/dist/components/Sidebar.js.map +1 -0
- package/dist/components/Skeleton.d.ts +10 -0
- package/dist/components/Skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton.js +8 -0
- package/dist/components/Skeleton.js.map +1 -0
- package/dist/components/Sparkline.d.ts +21 -0
- package/dist/components/Sparkline.d.ts.map +1 -0
- package/dist/components/Sparkline.js +24 -0
- package/dist/components/Sparkline.js.map +1 -0
- package/dist/components/Spinner.d.ts +9 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +8 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Stepper.d.ts +18 -0
- package/dist/components/Stepper.d.ts.map +1 -0
- package/dist/components/Stepper.js +15 -0
- package/dist/components/Stepper.js.map +1 -0
- package/dist/components/Switch.d.ts +14 -0
- package/dist/components/Switch.d.ts.map +1 -0
- package/dist/components/Switch.js +17 -0
- package/dist/components/Switch.js.map +1 -0
- package/dist/components/Table.d.ts +34 -0
- package/dist/components/Table.d.ts.map +1 -0
- package/dist/components/Table.js +9 -0
- package/dist/components/Table.js.map +1 -0
- package/dist/components/Tabs.d.ts +24 -0
- package/dist/components/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs.js +42 -0
- package/dist/components/Tabs.js.map +1 -0
- package/dist/components/TalkCard.d.ts +35 -0
- package/dist/components/TalkCard.d.ts.map +1 -0
- package/dist/components/TalkCard.js +38 -0
- package/dist/components/TalkCard.js.map +1 -0
- package/dist/components/Textarea.d.ts +10 -0
- package/dist/components/Textarea.d.ts.map +1 -0
- package/dist/components/Textarea.js +12 -0
- package/dist/components/Textarea.js.map +1 -0
- package/dist/components/Toast.d.ts +30 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Toast.js +38 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/components/Tooltip.d.ts +17 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip.js +45 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/VideoPlayer.d.ts +41 -0
- package/dist/components/VideoPlayer.d.ts.map +1 -0
- package/dist/components/VideoPlayer.js +68 -0
- package/dist/components/VideoPlayer.js.map +1 -0
- package/dist/components/icons.d.ts +16 -0
- package/dist/components/icons.d.ts.map +1 -0
- package/dist/components/icons.js +31 -0
- package/dist/components/icons.js.map +1 -0
- package/dist/components/logoArt.d.ts +16 -0
- package/dist/components/logoArt.d.ts.map +1 -0
- package/dist/components/logoArt.js +10 -0
- package/dist/components/logoArt.js.map +1 -0
- package/dist/fonts.d.ts +13 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +12 -0
- package/dist/fonts.js.map +1 -0
- package/dist/hooks/useTheme.d.ts +18 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/hooks/useTheme.js +49 -0
- package/dist/hooks/useTheme.js.map +1 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +2084 -0
- package/dist/tokens/tokens.d.ts +447 -0
- package/dist/tokens/tokens.d.ts.map +1 -0
- package/dist/tokens/tokens.js +193 -0
- package/dist/tokens/tokens.js.map +1 -0
- package/dist/tokens.css +423 -0
- package/dist/utils/cx.d.ts +6 -0
- package/dist/utils/cx.d.ts.map +1 -0
- package/dist/utils/cx.js +8 -0
- package/dist/utils/cx.js.map +1 -0
- package/docs/AI-GUIDE.md +232 -0
- package/docs/components.json +1183 -0
- package/package.json +80 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Formato basado en [Keep a Changelog](https://keepachangelog.com/es-ES/1.1.0/) y [SemVer](https://semver.org/lang/es/).
|
|
4
|
+
|
|
5
|
+
## [1.0.0] — 2026-11-20
|
|
6
|
+
|
|
7
|
+
Primera versión. Construido desde el **Manual de Marca Human Safe** sobre la arquitectura de componentes del DS base.
|
|
8
|
+
|
|
9
|
+
### Agregado
|
|
10
|
+
- **Tokens** en tres capas: primitivos `--hs-*`, contrato semántico `--color-*` (compatible con `react-admin-shell`) y CSS de componente que solo consume la capa semántica.
|
|
11
|
+
- **Tema oscuro por defecto** (`data-theme="dark"`), tema claro (`data-theme="light"`) y `data-theme="auto"` que sigue al sistema.
|
|
12
|
+
- **Tipografía incluida**: Poppins 600/700 (títulos) e Inter 400–700 (texto e interfaz) vía `@fontsource`; `import '@humansafe/design-system-full/fonts'`.
|
|
13
|
+
- **Logo** como componente (`principal` / `isotipo`; `auto`, `color`, `white`, `black`; placa negra sobre fondos claros).
|
|
14
|
+
- **34 componentes tipados**: Logo, Header, Sidebar, Stepper, Button, Input, Select, Textarea, Checkbox, Radio, RadioGroup, Card, CardTitle, Badge, Alert, Modal, Tabs, Table, Avatar, Spinner, Switch, Tooltip, ToastProvider, Menu, Pagination, Skeleton, Progress, BarChart, Sparkline y los propios de Human Safe: **TalkCard, QuizQuestion, VideoPlayer, EmergencyButton, EmergencyNumbers**.
|
|
15
|
+
- `useTheme` (persistencia en `hs-theme`; no sigue al sistema operativo) y `applyTheme`.
|
|
16
|
+
- **Verificación automática**: `check-contrast` (136 pares, claro y oscuro: 7:1 texto de lectura, 4.5:1 texto de botones y etiquetas de gráficos, 3:1 íconos/bordes/foco/barras), `check-tokens-sync` (CSS ↔ `tokens.ts`) y `smoke` (render de todos los componentes en ambos temas).
|
|
17
|
+
- `docs/AI-GUIDE.md` y `docs/components.json` para agentes.
|
|
18
|
+
|
|
19
|
+
### Decisiones de diseño
|
|
20
|
+
- Controles táctiles de 48 / 56 / 64 px; bordes de 2 px; anillo de foco de 3 px con 2 px de separación; texto mínimo de 16 px.
|
|
21
|
+
- Estado comunicado con color + ícono + texto (Alert trae ícono por tono).
|
|
22
|
+
- Paleta de gráficos elegida por ΔE bajo simulación de deuteranopía, protanopía y tritanopía.
|
|
23
|
+
|
|
24
|
+
### Derivaciones (no vienen del manual; comentadas en `tokens.css`)
|
|
25
|
+
- Grises de texto secundario, bordes y superficies elevadas (≥7:1 / ≥3:1).
|
|
26
|
+
- Enlace `#7AAEFF` (oscuro) y `#0043C8` (claro): el azul de marca `#0053F1` sobre blanco da 5.99:1, bajo el 7:1 de lectura.
|
|
27
|
+
- Éxito en claro `#1B5E20` (adición del DS: el lima del manual no se ve sobre blanco) y ámbar `#946200` para texto sobre blanco.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Human Safe
|
|
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,157 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @humansafe/design-system-full
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Human Safe — Design System v1.0.** Tokens, tipografía y componentes React para la plataforma de capacitación en seguridad de trabajadores en faena.
|
|
4
|
+
|
|
5
|
+
Pensado para usarse de pie, con luz dura y una sola mano:
|
|
6
|
+
|
|
7
|
+
- **Tema oscuro por defecto**, con tema claro y `auto`.
|
|
8
|
+
- Contraste verificado por script en cada build: **7:1** texto de lectura, 4.5:1 texto de botones, 3:1 íconos, bordes y foco (136 pares, claro y oscuro).
|
|
9
|
+
- Objetivos táctiles de **48 / 56 / 64 px**, texto mínimo de **16 px**.
|
|
10
|
+
- Estado siempre con color + ícono + texto.
|
|
11
|
+
- 34 componentes React tipados (`.d.ts` publicados), incluidos `TalkCard`, `QuizQuestion`, `VideoPlayer`, `EmergencyButton` y `EmergencyNumbers`.
|
|
12
|
+
- Poppins e Inter incluidas en el paquete (sin CDN).
|
|
13
|
+
- Compatible con el contrato de tokens de `react-admin-shell`.
|
|
14
|
+
|
|
15
|
+
## Instalación
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @humansafe/design-system-full
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`react` y `react-dom` (>= 18) son *peer dependencies*.
|
|
22
|
+
|
|
23
|
+
## Uso mínimo
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
// main.tsx — una sola vez
|
|
27
|
+
import '@humansafe/design-system-full/styles.css'; // tokens + estilos de componentes
|
|
28
|
+
import '@humansafe/design-system-full/fonts'; // Poppins + Inter
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Button, TalkCard, EmergencyNumbers, useTheme } from '@humansafe/design-system-full';
|
|
33
|
+
|
|
34
|
+
export function Inicio() {
|
|
35
|
+
const { theme, toggleTheme } = useTheme(); // oscuro por defecto
|
|
36
|
+
return (
|
|
37
|
+
<main className="hs-root">
|
|
38
|
+
<TalkCard
|
|
39
|
+
number={12}
|
|
40
|
+
category="Trabajo en altura"
|
|
41
|
+
title="Cómo usar el arnés"
|
|
42
|
+
duration="5 min"
|
|
43
|
+
status="in-progress"
|
|
44
|
+
progress={45}
|
|
45
|
+
actionVariant="primary"
|
|
46
|
+
href="/charlas/12"
|
|
47
|
+
/>
|
|
48
|
+
<EmergencyNumbers aria-label="Números de emergencia" />
|
|
49
|
+
<Button variant="ghost" onClick={toggleTheme}>Tema: {theme}</Button>
|
|
50
|
+
</main>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`className="hs-root"` es opcional: aplica fondo, color de texto y fuente base.
|
|
56
|
+
|
|
57
|
+
### Solo los tokens
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import '@humansafe/design-system-full/tokens.css'; // únicamente primitivos y contrato semántico
|
|
61
|
+
import { palette, semanticColors, chartSeries } from '@humansafe/design-system-full/tokens';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Tema oscuro / claro
|
|
65
|
+
|
|
66
|
+
El tema se controla con el atributo **`data-theme`** en `<html>` (lo mismo que escribe el `ThemeContext` de `react-admin-shell`):
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<html data-theme="dark"> <!-- predeterminado; también si no hay atributo -->
|
|
70
|
+
<html data-theme="light">
|
|
71
|
+
<html data-theme="auto"> <!-- sigue al sistema operativo -->
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- `useTheme(defaultTheme = 'dark')` escribe el atributo y persiste la elección en `localStorage` (`hs-theme`). **No sigue al sistema operativo** salvo que uses `auto`.
|
|
75
|
+
- `applyTheme('dark')` lo escribe sin hook (útil en un script inline anti-flash).
|
|
76
|
+
|
|
77
|
+
## Contrato de tokens
|
|
78
|
+
|
|
79
|
+
`tokens.css` publica dos capas. La primera, con prefijo `--hs-*`, son los primitivos del manual de marca. La segunda son los alias semánticos que consume el shell tal cual:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
--color-bg --color-bg-elevated --color-surface --color-border --color-border-strong
|
|
83
|
+
--color-text --color-text-muted --color-text-disabled --color-link
|
|
84
|
+
--color-primary --color-primary-hover --color-primary-active
|
|
85
|
+
--color-primary-soft --color-primary-contrast
|
|
86
|
+
--color-hover --color-active --color-focus
|
|
87
|
+
--color-success --color-warning --color-danger --color-info (+ -soft y -contrast)
|
|
88
|
+
--chart-series-1..4 --chart-label
|
|
89
|
+
--font-body --font-heading --font-mono
|
|
90
|
+
--font-size-* --line-height-* --font-weight-* --letter-spacing-*
|
|
91
|
+
--radius-sm|md|lg|full --shadow-sm|md|lg --space-1..16 --transition-fast|base
|
|
92
|
+
--control-sm|md|lg --touch-min --border-width --focus-width --focus-offset
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
El CSS de cada componente solo consume la capa semántica. **Una app nunca usa `--hs-*` directamente.**
|
|
96
|
+
|
|
97
|
+
## Paleta (manual de marca)
|
|
98
|
+
|
|
99
|
+
| Rol | Valor |
|
|
100
|
+
|---|---|
|
|
101
|
+
| Negro | `#000000` |
|
|
102
|
+
| Blanco | `#FFFFFF` |
|
|
103
|
+
| Azul Seguro | `#0053F1` |
|
|
104
|
+
| Lima Visible | `#8FFF00` |
|
|
105
|
+
| Azul claro de apoyo | `#5C9BFF` |
|
|
106
|
+
| Ámbar | `#FFB800` |
|
|
107
|
+
| Rojo alerta | `#FF5A4F` (oscuro) · `#C62828` (claro) |
|
|
108
|
+
|
|
109
|
+
Lo que el manual no define (grises, estados, enlaces, éxito en claro) está derivado y comentado en `src/tokens/tokens.css`; la tabla resumida está en `docs/AI-GUIDE.md` §9. Un detalle importante: el azul de marca sobre blanco da 5.99:1, por eso los enlaces en tema claro usan el derivado `#0043C8`.
|
|
110
|
+
|
|
111
|
+
## Logo
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
<Logo /> {/* principal, a color; placa negra en tema claro */}
|
|
115
|
+
<Logo variant="isotipo" size="sm" /> {/* solo HS */}
|
|
116
|
+
<Logo tone="white" /> {/* monocromo para fondos oscuros */}
|
|
117
|
+
<Logo tone="black" /> {/* monocromo para fondos claros / una tinta */}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
El logo a color solo va sobre negro: sobre fondos claros `tone="auto"` lo apoya en una placa negra.
|
|
121
|
+
|
|
122
|
+
## Iconografía
|
|
123
|
+
|
|
124
|
+
El DS no trae un set de íconos propio. El estándar es **`lucide-react`**, pasado por props (`leadingIcon`, `icon`). Los íconos mínimos que usan los propios componentes (play, check, reloj, etc.) van internos.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npm install lucide-react
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Componentes
|
|
131
|
+
|
|
132
|
+
`Logo`, `Header`, `Sidebar`, `Stepper`, `Button`, `Input`, `Select`, `Textarea`, `Checkbox`, `Radio` + `RadioGroup`, `Card` + `CardTitle`, `Badge`, `Alert`, `Modal`, `Tabs`, `Table`, `Avatar`, `Spinner`, `Switch`, `Tooltip`, `ToastProvider` + `useToast`, `Menu`, `Pagination`, `Skeleton`, `Progress`, `BarChart`, `Sparkline`.
|
|
133
|
+
|
|
134
|
+
**Propios de Human Safe:** `TalkCard`, `QuizQuestion`, `VideoPlayer`, `EmergencyButton`, `EmergencyNumbers`.
|
|
135
|
+
|
|
136
|
+
Props completas: [`docs/components.json`](./docs/components.json). Guía para agentes: [`docs/AI-GUIDE.md`](./docs/AI-GUIDE.md).
|
|
137
|
+
|
|
138
|
+
## Desarrollo
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npm ci
|
|
142
|
+
npm run build # contraste + tsc (.js + .d.ts) + sincronía de tokens + CSS
|
|
143
|
+
npm run smoke # renderiza todo en español -> preview-light.html / preview-dark.html
|
|
144
|
+
npm run gen:tokens # regenera src/tokens/tokens.css desde scripts/gen-tokens.mjs
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Ver [CONTRIBUTING.md](./CONTRIBUTING.md) y [CHANGELOG.md](./CHANGELOG.md).
|
|
148
|
+
|
|
149
|
+
## Publicación
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npm run build && npm publish --access public
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Licencia
|
|
156
|
+
|
|
157
|
+
MIT — ver [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
3
|
+
export interface AlertProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title'> {
|
|
4
|
+
tone?: AlertTone;
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
/** Ícono del estado. Por defecto cada tono trae el suyo (estado = color + ícono + texto); pasa `null` para quitarlo. */
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
/** Muestra el botón de cierre y ejecuta esta función al pulsarlo. */
|
|
9
|
+
onDismiss?: () => void;
|
|
10
|
+
dismissLabel?: string;
|
|
11
|
+
/** Acciones al pie del mensaje (botones). */
|
|
12
|
+
actions?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Mensaje contextual persistente.
|
|
16
|
+
* `danger` y `warning` se anuncian con role="alert"; el resto con role="status".
|
|
17
|
+
*/
|
|
18
|
+
export declare const Alert: import("react").ForwardRefExoticComponent<AlertProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
|
+
//# sourceMappingURL=Alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElE,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,wHAAwH;IACxH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,uGAgChB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cx } from '../utils/cx.js';
|
|
4
|
+
import { IconAlertOctagon, IconAlertTriangle, IconCheckCircle, IconInfo } from './icons.js';
|
|
5
|
+
/**
|
|
6
|
+
* Mensaje contextual persistente.
|
|
7
|
+
* `danger` y `warning` se anuncian con role="alert"; el resto con role="status".
|
|
8
|
+
*/
|
|
9
|
+
export const Alert = forwardRef(function Alert({ tone = 'info', title, icon: iconProp, onDismiss, dismissLabel = 'Cerrar', actions, className, children, ...rest }, ref) {
|
|
10
|
+
const urgent = tone === 'danger' || tone === 'warning';
|
|
11
|
+
const defaultIcon = {
|
|
12
|
+
info: _jsx(IconInfo, {}),
|
|
13
|
+
success: _jsx(IconCheckCircle, {}),
|
|
14
|
+
warning: _jsx(IconAlertTriangle, {}),
|
|
15
|
+
danger: _jsx(IconAlertOctagon, {}),
|
|
16
|
+
}[tone];
|
|
17
|
+
const icon = iconProp === undefined ? defaultIcon : iconProp;
|
|
18
|
+
return (_jsxs("div", { ref: ref, className: cx('hs-alert', `hs-alert--${tone}`, className), role: urgent ? 'alert' : 'status', ...rest, children: [icon && _jsx("span", { className: "hs-alert__icon", "aria-hidden": "true", children: icon }), _jsxs("div", { className: "hs-alert__content", children: [title && _jsx("p", { className: "hs-alert__title", children: title }), children && _jsx("div", { className: "hs-alert__body", children: children }), actions && _jsx("div", { className: "hs-alert__actions", children: actions })] }), onDismiss && (_jsx("button", { type: "button", className: "hs-alert__dismiss", onClick: onDismiss, "aria-label": dismissLabel, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) }))] }));
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=Alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot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AAK,GAAK,EACnD,QAAQ,IAAI,cAAK,SAAS,EAAC,gBAAgB,YAAE,QAAQ,GAAO,EAC5D,OAAO,IAAI,cAAK,SAAS,EAAC,mBAAmB,YAAE,OAAO,GAAO,IAC1D,EACL,SAAS,IAAI,CACZ,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,mBAAmB,EAAC,OAAO,EAAE,SAAS,gBAAc,YAAY,YAC9F,8BAAkB,MAAM,uBAAS,GAC1B,CACV,IACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export interface AvatarProps extends ComponentPropsWithoutRef<'span'> {
|
|
3
|
+
/** Nombre completo: genera las iniciales y el texto alternativo. */
|
|
4
|
+
name?: string;
|
|
5
|
+
src?: string;
|
|
6
|
+
size?: 'sm' | 'md' | 'lg';
|
|
7
|
+
/** Contenido propio (por ejemplo un ícono) en lugar de iniciales. */
|
|
8
|
+
fallback?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** Identidad de usuario o agente. Sin imagen, cae a iniciales sobre el color primario. */
|
|
11
|
+
export declare const Avatar: import("react").ForwardRefExoticComponent<AvatarProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
12
|
+
//# sourceMappingURL=Avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/components/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlF,MAAM,WAAW,WAAY,SAAQ,wBAAwB,CAAC,MAAM,CAAC;IACnE,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAUD,0FAA0F;AAC1F,eAAO,MAAM,MAAM,yGAgBjB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cx } from '../utils/cx.js';
|
|
4
|
+
const initialsOf = (name) => name
|
|
5
|
+
.trim()
|
|
6
|
+
.split(/\s+/)
|
|
7
|
+
.slice(0, 2)
|
|
8
|
+
.map((w) => w[0]?.toUpperCase() ?? '')
|
|
9
|
+
.join('');
|
|
10
|
+
/** Identidad de usuario o agente. Sin imagen, cae a iniciales sobre el color primario. */
|
|
11
|
+
export const Avatar = forwardRef(function Avatar({ name, src, size = 'md', fallback, className, ...rest }, ref) {
|
|
12
|
+
return (_jsxs("span", { ref: ref, className: cx('hs-avatar', `hs-avatar--${size}`, className), ...rest, children: [src ? (_jsx("img", { className: "hs-avatar__img", src: src, alt: name ?? '' })) : (_jsx("span", { className: "hs-avatar__fallback", "aria-hidden": name ? undefined : true, children: fallback ?? (name ? initialsOf(name) : '') })), !src && name && _jsx("span", { className: "hs-avatar__sr", children: name })] }));
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=Avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../src/components/Avatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAiD,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAWpC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAClC,IAAI;KACD,IAAI,EAAE;KACN,KAAK,CAAC,KAAK,CAAC;KACZ,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;KACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;KACrC,IAAI,CAAC,EAAE,CAAC,CAAC;AAEd,0FAA0F;AAC1F,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAA+B,SAAS,MAAM,CAC5E,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EACxD,GAAG;IAEH,OAAO,CACL,gBAAM,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,cAAc,IAAI,EAAE,EAAE,SAAS,CAAC,KAAM,IAAI,aAClF,GAAG,CAAC,CAAC,CAAC,CACL,cAAK,SAAS,EAAC,gBAAgB,EAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,IAAI,EAAE,GAAI,CAC9D,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,qBAAqB,iBAAc,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,YACvE,QAAQ,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACtC,CACR,EACA,CAAC,GAAG,IAAI,IAAI,IAAI,eAAM,SAAS,EAAC,eAAe,YAAE,IAAI,GAAQ,IACzD,CACR,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export type BadgeTone = 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info';
|
|
3
|
+
export type BadgeVariant = 'soft' | 'solid' | 'outline';
|
|
4
|
+
export interface BadgeProps extends ComponentPropsWithoutRef<'span'> {
|
|
5
|
+
/** Semántica del estado. Brandbook lámina 3: Online=success, Warning=warning, Offline=danger, Auditing=info. */
|
|
6
|
+
tone?: BadgeTone;
|
|
7
|
+
variant?: BadgeVariant;
|
|
8
|
+
/** Punto de color antes del texto, para estados de dispositivo. */
|
|
9
|
+
dot?: boolean;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/** Etiqueta de estado no interactiva. */
|
|
13
|
+
export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
14
|
+
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlF,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC1F,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,UAAW,SAAQ,wBAAwB,CAAC,MAAM,CAAC;IAClE,gHAAgH;IAChH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,mEAAmE;IACnE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,yCAAyC;AACzC,eAAO,MAAM,KAAK,wGAehB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cx } from '../utils/cx.js';
|
|
4
|
+
/** Etiqueta de estado no interactiva. */
|
|
5
|
+
export const Badge = forwardRef(function Badge({ tone = 'neutral', variant = 'soft', dot = false, icon, className, children, ...rest }, ref) {
|
|
6
|
+
return (_jsxs("span", { ref: ref, className: cx('hs-badge', `hs-badge--${tone}`, `hs-badge--${variant}`, className), ...rest, children: [dot && _jsx("span", { className: "hs-badge__dot", "aria-hidden": "true" }), icon && _jsx("span", { className: "hs-badge__icon", "aria-hidden": "true", children: icon }), children] }));
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=Badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAiD,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAcpC,yCAAyC;AACzC,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAA8B,SAAS,KAAK,CACzE,EAAE,IAAI,GAAG,SAAS,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,GAAG,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EACvF,GAAG;IAEH,OAAO,CACL,gBACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,aAAa,IAAI,EAAE,EAAE,aAAa,OAAO,EAAE,EAAE,SAAS,CAAC,KAC7E,IAAI,aAEP,GAAG,IAAI,eAAM,SAAS,EAAC,eAAe,iBAAa,MAAM,GAAG,EAC5D,IAAI,IAAI,eAAM,SAAS,EAAC,gBAAgB,iBAAa,MAAM,YAAE,IAAI,GAAQ,EACzE,QAAQ,IACJ,CACR,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export interface BarChartSeries {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
/** 1-4: fija el color categórico a esta serie sin importar su posición en el array.
|
|
6
|
+
* Por defecto, la posición (1ra serie -> 1, 2da -> 2, ...). No reasignar al filtrar series:
|
|
7
|
+
* el color sigue a la entidad, no al índice visible (ver docs/AI-GUIDE.md). */
|
|
8
|
+
colorIndex?: 1 | 2 | 3 | 4;
|
|
9
|
+
}
|
|
10
|
+
export interface BarChartDatum {
|
|
11
|
+
label: string;
|
|
12
|
+
/** Valor por clave de serie. */
|
|
13
|
+
values: Record<string, number>;
|
|
14
|
+
}
|
|
15
|
+
export interface BarChartProps extends ComponentPropsWithoutRef<'div'> {
|
|
16
|
+
data: BarChartDatum[];
|
|
17
|
+
/** Una serie = barras simples. Más de una = apiladas. */
|
|
18
|
+
series: BarChartSeries[];
|
|
19
|
+
orientation?: 'horizontal' | 'vertical';
|
|
20
|
+
/** Nombre del gráfico: título visible, y caption de la tabla de datos accesible. */
|
|
21
|
+
title: string;
|
|
22
|
+
formatValue?: (value: number) => string;
|
|
23
|
+
/** Altura del área de trazado en orientación vertical (px). */
|
|
24
|
+
height?: number;
|
|
25
|
+
/** Además de la tabla accesible (siempre presente para lectores de pantalla), la muestra visible bajo el gráfico. */
|
|
26
|
+
showDataTable?: boolean;
|
|
27
|
+
/** Oculta el valor de un segmento apilado si pesa menos de este % de la barra. El total siempre se muestra. */
|
|
28
|
+
minSegmentLabelPercent?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Barras de magnitud por categoría, sin tooltip: el valor va siempre visible
|
|
32
|
+
* (sobre cada barra simple, o en cada segmento cuando el peso lo permite, más
|
|
33
|
+
* el total al final de la pila). Para una serie temporal con ejes, ese alcance
|
|
34
|
+
* queda fuera del DS por ahora — ver docs/AI-GUIDE.md.
|
|
35
|
+
*/
|
|
36
|
+
export declare const BarChart: import("react").ForwardRefExoticComponent<BarChartProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
|
+
//# sourceMappingURL=BarChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../src/components/BarChart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAGzE,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd;;oFAEgF;IAChF,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,aAAc,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACpE,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,yDAAyD;IACzD,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qHAAqH;IACrH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,+GAA+G;IAC/G,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAID;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,0GAqGnB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId } from 'react';
|
|
3
|
+
import { cx } from '../utils/cx.js';
|
|
4
|
+
const defaultFormat = (v) => v.toLocaleString('es');
|
|
5
|
+
/**
|
|
6
|
+
* Barras de magnitud por categoría, sin tooltip: el valor va siempre visible
|
|
7
|
+
* (sobre cada barra simple, o en cada segmento cuando el peso lo permite, más
|
|
8
|
+
* el total al final de la pila). Para una serie temporal con ejes, ese alcance
|
|
9
|
+
* queda fuera del DS por ahora — ver docs/AI-GUIDE.md.
|
|
10
|
+
*/
|
|
11
|
+
export const BarChart = forwardRef(function BarChart({ data, series, orientation = 'vertical', title, formatValue = defaultFormat, height = 240, showDataTable = false, minSegmentLabelPercent = 0.06, className, ...rest }, ref) {
|
|
12
|
+
const autoId = useId();
|
|
13
|
+
const stacked = series.length > 1;
|
|
14
|
+
const vertical = orientation === 'vertical';
|
|
15
|
+
const colorIndexOf = (s, i) => s.colorIndex ?? ((i % 4) + 1);
|
|
16
|
+
const totals = data.map((d) => series.reduce((sum, s) => sum + (d.values[s.key] ?? 0), 0));
|
|
17
|
+
const max = Math.max(1, ...totals);
|
|
18
|
+
const bars = data.map((datum, di) => {
|
|
19
|
+
const total = totals[di];
|
|
20
|
+
const segments = series.map((s, si) => {
|
|
21
|
+
const value = datum.values[s.key] ?? 0;
|
|
22
|
+
const sizePercent = (value / max) * 100;
|
|
23
|
+
const showLabel = !stacked || value / total >= minSegmentLabelPercent;
|
|
24
|
+
return { series: s, value, sizePercent, showLabel, colorIndex: colorIndexOf(s, si) };
|
|
25
|
+
});
|
|
26
|
+
return { datum, total, segments };
|
|
27
|
+
});
|
|
28
|
+
return (_jsxs("div", { ref: ref, className: cx('hs-barchart', `hs-barchart--${orientation}`, className), ...rest, children: [_jsx("p", { className: "hs-barchart__title", children: title }), stacked && (_jsx("ul", { className: "hs-barchart__legend", children: series.map((s, i) => (_jsxs("li", { className: "hs-barchart__legend-item", children: [_jsx("span", { className: cx('hs-barchart__swatch', `hs-barchart__swatch--${colorIndexOf(s, i)}`), "aria-hidden": "true" }), s.label] }, s.key))) })), _jsx("div", { className: "hs-barchart__plot", "aria-hidden": "true", style: vertical ? { height } : undefined, children: bars.map(({ datum, total, segments }) => (_jsxs("div", { className: "hs-barchart__row", children: [stacked && _jsx("span", { className: "hs-barchart__total", children: formatValue(total) }), _jsx("div", { className: "hs-barchart__track", children: segments.map(({ series: s, value, sizePercent, showLabel, colorIndex }) => value <= 0 ? null : (_jsx("div", { className: cx('hs-barchart__segment', `hs-barchart__segment--${colorIndex}`), style: { [vertical ? 'height' : 'width']: `${sizePercent}%` }, children: showLabel && _jsx("span", { className: "hs-barchart__segment-label", children: formatValue(value) }) }, s.key))) }), _jsx("span", { className: "hs-barchart__row-label", children: datum.label })] }, datum.label))) }), _jsx("div", { className: cx(!showDataTable && 'hs-barchart__data-table-wrap--sr-only'), children: _jsxs("table", { className: "hs-barchart__data-table", id: `hs-barchart-${autoId}`, children: [_jsx("caption", { children: title }), _jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: "Categor\u00EDa" }), series.map((s) => (_jsx("th", { scope: "col", children: s.label }, s.key))), stacked && _jsx("th", { scope: "col", children: "Total" })] }) }), _jsx("tbody", { children: data.map((datum, di) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: datum.label }), series.map((s) => (_jsx("td", { children: formatValue(datum.values[s.key] ?? 0) }, s.key))), stacked && _jsx("td", { children: formatValue(totals[di]) })] }, datum.label))) })] }) })] }));
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=BarChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarChart.js","sourceRoot":"","sources":["../../src/components/BarChart.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAiC,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAiCpC,MAAM,aAAa,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAgC,SAAS,QAAQ,CACjF,EACE,IAAI,EACJ,MAAM,EACN,WAAW,GAAG,UAAU,EACxB,KAAK,EACL,WAAW,GAAG,aAAa,EAC3B,MAAM,GAAG,GAAG,EACZ,aAAa,GAAG,KAAK,EACrB,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CAAC,IAAI,CAAC,CAAC,IAA7C,CAAC,CAAC,GAAG,CAA8C,CAC7D,CAAC,EACD,OAAO,IAAI,uBAAK,WAAW,CAAC,MAAM,CAAC,EAAE,CAAE,CAAC,GAAM,KALxC,KAAK,CAAC,KAAK,CAMf,CACN,CAAC,GACI,IACF,GACJ,IACF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger' | 'success' | 'link';
|
|
3
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface ButtonProps extends ComponentPropsWithoutRef<'button'> {
|
|
5
|
+
/** Jerarquía visual. `primary` es la acción principal: una sola por pantalla. */
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
/** Ícono a la izquierda del texto (se recomienda lucide-react, 16–18px). */
|
|
9
|
+
leadingIcon?: ReactNode;
|
|
10
|
+
/** Ícono a la derecha del texto. */
|
|
11
|
+
trailingIcon?: ReactNode;
|
|
12
|
+
/** Muestra spinner y bloquea la interacción sin cambiar el ancho del botón. */
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
/** Ocupa todo el ancho del contenedor. */
|
|
15
|
+
fullWidth?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Botón de acción. Brandbook, lámina 3 "Botones & Badges".
|
|
19
|
+
*
|
|
20
|
+
* - `primary` → acción más importante de la pantalla (Aprobar Runbook)
|
|
21
|
+
* - `secondary`→ acción alternativa con el mismo peso informativo (Ver Detalle)
|
|
22
|
+
* - `danger` → acción destructiva o de rechazo (Rechazar)
|
|
23
|
+
* - `ghost` → acción terciaria dentro de una fila o tarjeta
|
|
24
|
+
* - `link` → navegación textual (Re-auditar)
|
|
25
|
+
*/
|
|
26
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
27
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAC9F,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,WAAW,WAAY,SAAQ,wBAAwB,CAAC,QAAQ,CAAC;IACrE,iFAAiF;IACjF,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,oCAAoC;IACpC,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,2GA8CjB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cx } from '../utils/cx.js';
|
|
4
|
+
/**
|
|
5
|
+
* Botón de acción. Brandbook, lámina 3 "Botones & Badges".
|
|
6
|
+
*
|
|
7
|
+
* - `primary` → acción más importante de la pantalla (Aprobar Runbook)
|
|
8
|
+
* - `secondary`→ acción alternativa con el mismo peso informativo (Ver Detalle)
|
|
9
|
+
* - `danger` → acción destructiva o de rechazo (Rechazar)
|
|
10
|
+
* - `ghost` → acción terciaria dentro de una fila o tarjeta
|
|
11
|
+
* - `link` → navegación textual (Re-auditar)
|
|
12
|
+
*/
|
|
13
|
+
export const Button = forwardRef(function Button({ variant = 'secondary', size = 'md', leadingIcon, trailingIcon, loading = false, fullWidth = false, disabled, className, children, type = 'button', ...rest }, ref) {
|
|
14
|
+
return (_jsxs("button", { ref: ref, type: type, className: cx('hs-button', `hs-button--${variant}`, `hs-button--${size}`, fullWidth && 'hs-button--full', loading && 'hs-button--loading', className), disabled: disabled || loading, "aria-busy": loading || undefined, ...rest, children: [loading && _jsx("span", { className: "hs-button__spinner", "aria-hidden": "true" }), leadingIcon && !loading && (_jsx("span", { className: "hs-button__icon", "aria-hidden": "true", children: leadingIcon })), _jsx("span", { className: "hs-button__label", children: children }), trailingIcon && (_jsx("span", { className: "hs-button__icon", "aria-hidden": "true", children: trailingIcon }))] }));
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAiD,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAmBpC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAiC,SAAS,MAAM,CAC9E,EACE,OAAO,GAAG,WAAW,EACrB,IAAI,GAAG,IAAI,EACX,WAAW,EACX,YAAY,EACZ,OAAO,GAAG,KAAK,EACf,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,GAAG,IAAI,EACR,EACD,GAAG;IAEH,OAAO,CACL,kBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,WAAW,EACX,cAAc,OAAO,EAAE,EACvB,cAAc,IAAI,EAAE,EACpB,SAAS,IAAI,iBAAiB,EAC9B,OAAO,IAAI,oBAAoB,EAC/B,SAAS,CACV,EACD,QAAQ,EAAE,QAAQ,IAAI,OAAO,eAClB,OAAO,IAAI,SAAS,KAC3B,IAAI,aAEP,OAAO,IAAI,eAAM,SAAS,EAAC,oBAAoB,iBAAa,MAAM,GAAG,EACrE,WAAW,IAAI,CAAC,OAAO,IAAI,CAC1B,eAAM,SAAS,EAAC,iBAAiB,iBAAa,MAAM,YACjD,WAAW,GACP,CACR,EACD,eAAM,SAAS,EAAC,kBAAkB,YAAE,QAAQ,GAAQ,EACnD,YAAY,IAAI,CACf,eAAM,SAAS,EAAC,iBAAiB,iBAAa,MAAM,YACjD,YAAY,GACR,CACR,IACM,CACV,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export type CardVariant = 'raised' | 'subtle' | 'outlined';
|
|
3
|
+
export type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface CardProps extends ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
variant?: CardVariant;
|
|
6
|
+
padding?: CardPadding;
|
|
7
|
+
/** Cabecera de la tarjeta (título + acciones a la derecha). */
|
|
8
|
+
header?: ReactNode;
|
|
9
|
+
/** Pie de la tarjeta, normalmente botones. */
|
|
10
|
+
footer?: ReactNode;
|
|
11
|
+
/** Marca la tarjeta como interactiva (hover/foco). Úsalo con onClick o un enlace dentro. */
|
|
12
|
+
interactive?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Superficie contenedora. Brandbook, lámina 3 "Card Preview". */
|
|
15
|
+
export declare const Card: import("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export interface CardTitleProps extends ComponentPropsWithoutRef<'h3'> {
|
|
17
|
+
/** Ícono a la izquierda del título (lucide-react, 18px). */
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/** Título de tarjeta con la escala heading-md del brandbook. */
|
|
21
|
+
export declare const CardTitle: import("react").ForwardRefExoticComponent<CardTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
22
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlF,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,MAAM,WAAW,SAAU,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IAChE,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,4FAA4F;IAC5F,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,kEAAkE;AAClE,eAAO,MAAM,IAAI,sGAef,CAAC;AAEH,MAAM,WAAW,cAAe,SAAQ,wBAAwB,CAAC,IAAI,CAAC;IACpE,4DAA4D;IAC5D,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,gEAAgE;AAChE,eAAO,MAAM,SAAS,+GAUpB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cx } from '../utils/cx.js';
|
|
4
|
+
/** Superficie contenedora. Brandbook, lámina 3 "Card Preview". */
|
|
5
|
+
export const Card = forwardRef(function Card({ variant = 'raised', padding = 'md', header, footer, interactive = false, className, children, ...rest }, ref) {
|
|
6
|
+
return (_jsxs("div", { ref: ref, className: cx('hs-card', `hs-card--${variant}`, interactive && 'hs-card--interactive', className), ...rest, children: [header && _jsx("div", { className: "hs-card__header", children: header }), _jsx("div", { className: cx('hs-card__body', `hs-card__body--${padding}`), children: children }), footer && _jsx("div", { className: "hs-card__footer", children: footer })] }));
|
|
7
|
+
});
|
|
8
|
+
/** Título de tarjeta con la escala heading-md del brandbook. */
|
|
9
|
+
export const CardTitle = forwardRef(function CardTitle({ icon, className, children, ...rest }, ref) {
|
|
10
|
+
return (_jsxs("h3", { ref: ref, className: cx('hs-card__title', className), ...rest, children: [icon && _jsx("span", { className: "hs-card__title-icon", "aria-hidden": "true", children: icon }), children] }));
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=Card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAiD,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAgBpC,kEAAkE;AAClE,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAA4B,SAAS,IAAI,CACrE,EAAE,OAAO,GAAG,QAAQ,EAAE,OAAO,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EACzG,GAAG;IAEH,OAAO,CACL,eACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,YAAY,OAAO,EAAE,EAAE,WAAW,IAAI,sBAAsB,EAAE,SAAS,CAAC,KAC7F,IAAI,aAEP,MAAM,IAAI,cAAK,SAAS,EAAC,iBAAiB,YAAE,MAAM,GAAO,EAC1D,cAAK,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,kBAAkB,OAAO,EAAE,CAAC,YAAG,QAAQ,GAAO,EACjF,MAAM,IAAI,cAAK,SAAS,EAAC,iBAAiB,YAAE,MAAM,GAAO,IACtD,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAOH,gEAAgE;AAChE,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAqC,SAAS,SAAS,CACxF,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EACtC,GAAG;IAEH,OAAO,CACL,cAAI,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,KAAM,IAAI,aAC/D,IAAI,IAAI,eAAM,SAAS,EAAC,qBAAqB,iBAAa,MAAM,YAAE,IAAI,GAAQ,EAC9E,QAAQ,IACN,CACN,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export interface CheckboxProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type'> {
|
|
3
|
+
label?: ReactNode;
|
|
4
|
+
hint?: ReactNode;
|
|
5
|
+
error?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Casilla de verificación. El control nativo se mantiene: solo se repinta. */
|
|
8
|
+
export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
9
|
+
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzF,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IACpF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,+EAA+E;AAC/E,eAAO,MAAM,QAAQ,4GA+BnB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId } from 'react';
|
|
3
|
+
import { cx } from '../utils/cx.js';
|
|
4
|
+
/** Casilla de verificación. El control nativo se mantiene: solo se repinta. */
|
|
5
|
+
export const Checkbox = forwardRef(function Checkbox({ label, hint, error, className, id, disabled, ...rest }, ref) {
|
|
6
|
+
const autoId = useId();
|
|
7
|
+
const inputId = id ?? `hs-checkbox-${autoId}`;
|
|
8
|
+
const hintId = `${inputId}-hint`;
|
|
9
|
+
const errorId = `${inputId}-error`;
|
|
10
|
+
return (_jsxs("div", { className: cx('hs-choice', disabled && 'hs-choice--disabled', className), children: [_jsxs("div", { className: "hs-choice__row", children: [_jsx("input", { ref: ref, type: "checkbox", id: inputId, className: "hs-choice__input hs-choice__input--checkbox", "aria-invalid": error ? true : undefined, "aria-describedby": error ? errorId : hint ? hintId : undefined, disabled: disabled, ...rest }), label && _jsx("label", { className: "hs-choice__label", htmlFor: inputId, children: label })] }), error ? (_jsx("p", { className: "hs-field__error", id: errorId, role: "alert", children: error })) : hint ? (_jsx("p", { className: "hs-field__hint", id: hintId, children: hint })) : null] }));
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAiD,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC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AAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type MouseEvent } from 'react';
|
|
2
|
+
export interface EmergencyService {
|
|
3
|
+
/** Número a marcar ("131"). */
|
|
4
|
+
number: string;
|
|
5
|
+
/** Nombre del servicio ("Ambulancia"). */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Aclaración corta bajo el nombre ("SAMU"). */
|
|
8
|
+
detail?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Números de emergencia de Chile. */
|
|
11
|
+
export declare const CHILE_EMERGENCY_SERVICES: ReadonlyArray<EmergencyService>;
|
|
12
|
+
export interface EmergencyButtonProps extends Omit<ComponentPropsWithoutRef<'a'>, 'href' | 'children'> {
|
|
13
|
+
/** Número a marcar ("131"). Se normaliza a un enlace `tel:`. */
|
|
14
|
+
number: string;
|
|
15
|
+
/** Nombre del servicio, visible junto al número. */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Aclaración corta (opcional). */
|
|
18
|
+
detail?: string;
|
|
19
|
+
/** Se llama justo antes de abrir el marcador (útil para registrar el uso). No impide la llamada. */
|
|
20
|
+
onCall?: (number: string, event: MouseEvent<HTMLAnchorElement>) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Botón de emergencia: UN toque abre el marcador del teléfono con el número cargado.
|
|
24
|
+
* Es un enlace `tel:` (funciona sin JavaScript y sin conexión), con 72 px de alto,
|
|
25
|
+
* número a 28 px y color de peligro con texto de contraste. Estado = color + ícono + número.
|
|
26
|
+
*/
|
|
27
|
+
export declare const EmergencyButton: import("react").ForwardRefExoticComponent<EmergencyButtonProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
28
|
+
export interface EmergencyNumbersProps extends ComponentPropsWithoutRef<'nav'> {
|
|
29
|
+
/** Servicios a mostrar. Defecto: 131, 132, 133 y 134 de Chile. */
|
|
30
|
+
services?: ReadonlyArray<EmergencyService>;
|
|
31
|
+
onCall?: (number: string, event: MouseEvent<HTMLAnchorElement>) => void;
|
|
32
|
+
}
|
|
33
|
+
/** Grilla de 2 columnas con los botones de emergencia. Úsala fija en la pantalla de ayuda o en el pie de la app. */
|
|
34
|
+
export declare const EmergencyNumbers: import("react").ForwardRefExoticComponent<EmergencyNumbersProps & import("react").RefAttributes<HTMLElement>>;
|
|
35
|
+
//# sourceMappingURL=EmergencyButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmergencyButton.d.ts","sourceRoot":"","sources":["../../src/components/EmergencyButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAInF,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,sCAAsC;AACtC,eAAO,MAAM,wBAAwB,EAAE,aAAa,CAAC,gBAAgB,CAKpE,CAAC;AAEF,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACpG,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACzE;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,oHA2B1B,CAAC;AAEH,MAAM,WAAW,qBAAsB,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IAC5E,kEAAkE;IAClE,QAAQ,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACzE;AAED,oHAAoH;AACpH,eAAO,MAAM,gBAAgB,+GAW3B,CAAC"}
|