@humansafe/design-system-full 0.0.0-stage → 1.1.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 +36 -0
- package/LICENSE +21 -0
- package/README.md +173 -2
- package/assets/logos/README.md +32 -0
- package/assets/logos/app/avatar-redes-800.png +0 -0
- package/assets/logos/app/favicon-180.png +0 -0
- package/assets/logos/app/favicon-192.png +0 -0
- package/assets/logos/app/favicon-32.png +0 -0
- package/assets/logos/app/favicon-48.png +0 -0
- package/assets/logos/app/favicon-512.png +0 -0
- package/assets/logos/app/favicon.ico +0 -0
- package/assets/logos/app/icono-app-1024.png +0 -0
- package/assets/logos/app/tarjeta-compartir-1200x630.png +0 -0
- package/assets/logos/png/fondo/logo-blanco-sobre-azul-2000px.png +0 -0
- package/assets/logos/png/fondo/logo-negro-sobre-lima-2000px.png +0 -0
- package/assets/logos/png/fondo/logo-placa-negra-para-fondo-claro-2000px.png +0 -0
- package/assets/logos/png/fondo/logo-sobre-negro-2000px.png +0 -0
- package/assets/logos/png/transparente/isotipo-hs-blanco-1024px.png +0 -0
- package/assets/logos/png/transparente/isotipo-hs-blanco-256px.png +0 -0
- package/assets/logos/png/transparente/isotipo-hs-color-1024px.png +0 -0
- package/assets/logos/png/transparente/isotipo-hs-color-256px.png +0 -0
- package/assets/logos/png/transparente/isotipo-hs-negro-1024px.png +0 -0
- package/assets/logos/png/transparente/isotipo-hs-negro-256px.png +0 -0
- package/assets/logos/png/transparente/logo-principal-blanco-2000px.png +0 -0
- package/assets/logos/png/transparente/logo-principal-blanco-800px.png +0 -0
- package/assets/logos/png/transparente/logo-principal-color-2000px.png +0 -0
- package/assets/logos/png/transparente/logo-principal-color-800px.png +0 -0
- package/assets/logos/png/transparente/logo-principal-negro-2000px.png +0 -0
- package/assets/logos/png/transparente/logo-principal-negro-800px.png +0 -0
- package/assets/logos/svg/isotipo-hs-blanco.svg +1 -0
- package/assets/logos/svg/isotipo-hs-color.svg +1 -0
- package/assets/logos/svg/isotipo-hs-negro.svg +1 -0
- package/assets/logos/svg/logo-principal-blanco.svg +1 -0
- package/assets/logos/svg/logo-principal-color.svg +1 -0
- package/assets/logos/svg/logo-principal-negro.svg +1 -0
- 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 +30 -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 +2091 -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 +82 -4
|
@@ -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;AAQpC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAkC,SAAS,QAAQ,CACnF,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EACxD,GAAG;IAEH,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,EAAE,IAAI,eAAe,MAAM,EAAE,CAAC;IAC9C,MAAM,MAAM,GAAG,GAAG,OAAO,OAAO,CAAC;IACjC,MAAM,OAAO,GAAG,GAAG,OAAO,QAAQ,CAAC;IAEnC,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,QAAQ,IAAI,qBAAqB,EAAE,SAAS,CAAC,aAC3E,eAAK,SAAS,EAAC,gBAAgB,aAC7B,gBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,UAAU,EACf,EAAE,EAAE,OAAO,EACX,SAAS,EAAC,6CAA6C,kBACzC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,sBACpB,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC7D,QAAQ,EAAE,QAAQ,KACd,IAAI,GACR,EACD,KAAK,IAAI,gBAAO,SAAS,EAAC,kBAAkB,EAAC,OAAO,EAAE,OAAO,YAAG,KAAK,GAAS,IAC3E,EACL,KAAK,CAAC,CAAC,CAAC,CACP,YAAG,SAAS,EAAC,iBAAiB,EAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAC,OAAO,YAAE,KAAK,GAAK,CACrE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACT,YAAG,SAAS,EAAC,gBAAgB,EAAC,EAAE,EAAE,MAAM,YAAG,IAAI,GAAK,CACrD,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { IconPhone } from './icons.js';
|
|
5
|
+
/** Números de emergencia de Chile. */
|
|
6
|
+
export const CHILE_EMERGENCY_SERVICES = [
|
|
7
|
+
{ number: '131', label: 'Ambulancia', detail: 'SAMU' },
|
|
8
|
+
{ number: '132', label: 'Bomberos' },
|
|
9
|
+
{ number: '133', label: 'Carabineros' },
|
|
10
|
+
{ number: '134', label: 'PDI', detail: 'Investigaciones' },
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* Botón de emergencia: UN toque abre el marcador del teléfono con el número cargado.
|
|
14
|
+
* Es un enlace `tel:` (funciona sin JavaScript y sin conexión), con 72 px de alto,
|
|
15
|
+
* número a 28 px y color de peligro con texto de contraste. Estado = color + ícono + número.
|
|
16
|
+
*/
|
|
17
|
+
export const EmergencyButton = forwardRef(function EmergencyButton({ number, label, detail, onCall, onClick, className, ...rest }, ref) {
|
|
18
|
+
const digits = number.replace(/[^\d+]/g, '');
|
|
19
|
+
return (_jsxs("a", { ref: ref, href: `tel:${digits}`, className: cx('hs-emergency', className), "aria-label": `Llamar al ${number}, ${label}${detail ? ` (${detail})` : ''}`, onClick: (e) => {
|
|
20
|
+
onCall?.(number, e);
|
|
21
|
+
onClick?.(e);
|
|
22
|
+
}, ...rest, children: [_jsx("span", { className: "hs-emergency__icon", "aria-hidden": "true", children: _jsx(IconPhone, {}) }), _jsx("span", { className: "hs-emergency__number", "aria-hidden": "true", children: number }), _jsxs("span", { className: "hs-emergency__text", "aria-hidden": "true", children: [_jsx("span", { className: "hs-emergency__label", children: label }), detail && _jsx("span", { className: "hs-emergency__detail", children: detail })] })] }));
|
|
23
|
+
});
|
|
24
|
+
/** Grilla de 2 columnas con los botones de emergencia. Úsala fija en la pantalla de ayuda o en el pie de la app. */
|
|
25
|
+
export const EmergencyNumbers = forwardRef(function EmergencyNumbers({ services = CHILE_EMERGENCY_SERVICES, onCall, className, 'aria-label': ariaLabel = 'Números de emergencia', ...rest }, ref) {
|
|
26
|
+
return (_jsx("nav", { ref: ref, className: cx('hs-emergency-group', className), "aria-label": ariaLabel, ...rest, children: services.map((s) => (_jsx(EmergencyButton, { number: s.number, label: s.label, detail: s.detail, onCall: onCall }, s.number))) }));
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=EmergencyButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmergencyButton.js","sourceRoot":"","sources":["../../src/components/EmergencyButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkD,MAAM,OAAO,CAAC;AACnF,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAWvC,sCAAsC;AACtC,MAAM,CAAC,MAAM,wBAAwB,GAAoC;IACvE,EAAE,MAAM,EA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B,YAAE,MAAM,GAAQ,IAC5D,IACL,CACL,CAAC;AACJ,CAAC,CAAC,CAAC;AAQH,oHAAoH;AACpH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAqC,SAAS,gBAAgB,CACtG,EAAE,QAAQ,GAAG,wBAAwB,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,GAAG,uBAAuB,EAAE,GAAG,IAAI,EAAE,EACtH,GAAG;IAEH,OAAO,CACL,cAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,SAAS,CAAC,gBAAc,SAAS,KAAM,IAAI,YAC3F,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACnB,KAAC,eAAe,IAAgB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,IAA5E,CAAC,CAAC,MAAM,CAAwE,CACvG,CAAC,GACE,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export interface HeaderProps extends ComponentPropsWithoutRef<'header'> {
|
|
3
|
+
/** Slot izquierdo: logo, botón de menú en mobile. */
|
|
4
|
+
start?: ReactNode;
|
|
5
|
+
/** Slot derecho: acciones, toggle de tema, menú de usuario. */
|
|
6
|
+
end?: ReactNode;
|
|
7
|
+
/** Fija el header arriba del viewport al hacer scroll. */
|
|
8
|
+
sticky?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Barra superior de la app. `children` es el contenido central (título de página, buscador). */
|
|
11
|
+
export declare const Header: import("react").ForwardRefExoticComponent<HeaderProps & import("react").RefAttributes<HTMLElement>>;
|
|
12
|
+
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlF,MAAM,WAAW,WAAY,SAAQ,wBAAwB,CAAC,QAAQ,CAAC;IACrE,qDAAqD;IACrD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,iGAAiG;AACjG,eAAO,MAAM,MAAM,qGAWjB,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
|
+
/** Barra superior de la app. `children` es el contenido central (título de página, buscador). */
|
|
5
|
+
export const Header = forwardRef(function Header({ start, end, sticky = false, className, children, ...rest }, ref) {
|
|
6
|
+
return (_jsxs("header", { ref: ref, className: cx('hs-header', sticky && 'hs-header--sticky', className), ...rest, children: [start && _jsx("div", { className: "hs-header__start", children: start }), children && _jsx("div", { className: "hs-header__center", children: children }), end && _jsx("div", { className: "hs-header__end", children: end })] }));
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=Header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAiD,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAWpC,iGAAiG;AACjG,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAA2B,SAAS,MAAM,CACxE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAC5D,GAAG;IAEH,OAAO,CACL,kBAAQ,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,MAAM,IAAI,mBAAmB,EAAE,SAAS,CAAC,KAAM,IAAI,aAC7F,KAAK,IAAI,cAAK,SAAS,EAAC,kBAAkB,YAAE,KAAK,GAAO,EACxD,QAAQ,IAAI,cAAK,SAAS,EAAC,mBAAmB,YAAE,QAAQ,GAAO,EAC/D,GAAG,IAAI,cAAK,SAAS,EAAC,gBAAgB,YAAE,GAAG,GAAO,IAC5C,CACV,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export type InputSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export interface InputProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'> {
|
|
4
|
+
/** Etiqueta visible. Si se omite, pasa `aria-label` por props. */
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
/** Texto de ayuda bajo el campo. Se anula si hay `error`. */
|
|
7
|
+
hint?: ReactNode;
|
|
8
|
+
/** Mensaje de error. Activa `aria-invalid` y describe el campo. */
|
|
9
|
+
error?: ReactNode;
|
|
10
|
+
inputSize?: InputSize;
|
|
11
|
+
/** Ícono decorativo al inicio del campo. */
|
|
12
|
+
leadingIcon?: ReactNode;
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Campo de texto de una línea, con label, hint y estado de error accesible. */
|
|
16
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
17
|
+
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzF,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjF,kEAAkE;IAClE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,mEAAmE;IACnE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,gFAAgF;AAChF,eAAO,MAAM,KAAK,yGAqChB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
/** Campo de texto de una línea, con label, hint y estado de error accesible. */
|
|
5
|
+
export const Input = forwardRef(function Input({ label, hint, error, inputSize = 'md', leadingIcon, fullWidth = true, className, id, disabled, ...rest }, ref) {
|
|
6
|
+
const autoId = useId();
|
|
7
|
+
const inputId = id ?? `hs-input-${autoId}`;
|
|
8
|
+
const hintId = `${inputId}-hint`;
|
|
9
|
+
const errorId = `${inputId}-error`;
|
|
10
|
+
const describedBy = error ? errorId : hint ? hintId : undefined;
|
|
11
|
+
return (_jsxs("div", { className: cx('hs-field', fullWidth && 'hs-field--full', disabled && 'hs-field--disabled', className), children: [label && (_jsxs("label", { className: "hs-field__label", htmlFor: inputId, children: [label, rest.required && _jsx("span", { className: "hs-field__required", "aria-hidden": "true", children: " *" })] })), _jsxs("div", { className: cx('hs-input', `hs-input--${inputSize}`, error && 'hs-input--error'), children: [leadingIcon && _jsx("span", { className: "hs-input__icon", "aria-hidden": "true", children: leadingIcon }), _jsx("input", { ref: ref, id: inputId, className: "hs-input__control", "aria-invalid": error ? true : undefined, "aria-describedby": describedBy, disabled: disabled, ...rest })] }), 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] }));
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAiD,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAiBpC,gFAAgF;AAChF,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAA+B,SAAS,KAAK,CAC1E,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,WAAW,EAAE,SAAS,GAAG,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EACzG,GAAG;IAEH,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,EAAE,IAAI,YAAY,MAAM,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAG,GAAG,OAAO,OAAO,CAAC;IACjC,MAAM,OAAO,GAAG,GAAG,OAAO,QAAQ,CAAC;IACnC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAEhE,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,IAAI,gBAAgB,EAAE,QAAQ,IAAI,oBAAoB,EAAE,SAAS,CAAC,aACvG,KAAK,IAAI,CACR,iBAAO,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,OAAO,aAChD,KAAK,EACL,IAAI,CAAC,QAAQ,IAAI,eAAM,SAAS,EAAC,oBAAoB,iBAAa,MAAM,mBAAU,IAC7E,CACT,EACD,eAAK,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,aAAa,SAAS,EAAE,EAAE,KAAK,IAAI,iBAAiB,CAAC,aACjF,WAAW,IAAI,eAAM,SAAS,EAAC,gBAAgB,iBAAa,MAAM,YAAE,WAAW,GAAQ,EACxF,gBACE,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,OAAO,EACX,SAAS,EAAC,mBAAmB,kBACf,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,sBACpB,WAAW,EAC7B,QAAQ,EAAE,QAAQ,KACd,IAAI,GACR,IACE,EACL,KAAK,CAAC,CAAC,CAAC,CACP,YAAG,SAAS,EAAC,iBAAiB,EAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAC,OAAO,YAAE,KAAK,GAAK,CACrE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACT,YAAG,SAAS,EAAC,gBAAgB,EAAC,EAAE,EAAE,MAAM,YAAG,IAAI,GAAK,CACrD,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export type LogoVariant = 'principal' | 'isotipo';
|
|
3
|
+
export type LogoTone = 'auto' | 'color' | 'white' | 'black' | 'on-blue' | 'on-lime';
|
|
4
|
+
export type LogoSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export interface LogoProps extends ComponentPropsWithoutRef<'div'> {
|
|
6
|
+
/** `principal`: isotipo + "Human Safe". `isotipo`: solo el símbolo HS (espacios reducidos, favicon, header móvil). */
|
|
7
|
+
variant?: LogoVariant;
|
|
8
|
+
/**
|
|
9
|
+
* - `auto` (defecto): versión a color; en tema claro se apoya sobre una placa negra
|
|
10
|
+
* (el manual prohíbe el logo a color directamente sobre fondos claros).
|
|
11
|
+
* - `color`: versión a color. Úsala SOLO sobre negro / superficies oscuras.
|
|
12
|
+
* - `white`: monocromo blanco, para fondos oscuros o fotos oscuras.
|
|
13
|
+
* - `black`: monocromo negro, para fondos claros o impresión en una tinta.
|
|
14
|
+
* - `on-blue`: logo blanco sobre placa Azul Seguro (#0053F1).
|
|
15
|
+
* - `on-lime`: logo negro sobre placa Lima Visible (#8FFF00).
|
|
16
|
+
*/
|
|
17
|
+
tone?: LogoTone;
|
|
18
|
+
/** Fuerza la placa negra detrás del logo (útil con `tone="color"` sobre fondos claros). */
|
|
19
|
+
plate?: boolean;
|
|
20
|
+
size?: LogoSize;
|
|
21
|
+
/** Nombre accesible. Defecto: "Human Safe". */
|
|
22
|
+
title?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Logo de Human Safe. Vectorial (sin imágenes externas) y con nombre accesible.
|
|
26
|
+
* Manual de marca, sección 3 "Logo": no deformar, no recolorear, no usar sin
|
|
27
|
+
* área de resguardo (el componente la aplica como padding).
|
|
28
|
+
*/
|
|
29
|
+
export declare const Logo: import("react").ForwardRefExoticComponent<LogoProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
30
|
+
//# sourceMappingURL=Logo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logo.d.ts","sourceRoot":"","sources":["../../src/components/Logo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAIlE,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,SAAS,CAAC;AAClD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AACpF,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C,MAAM,WAAW,SAAU,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IAChE,sHAAsH;IACtH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,2FAA2F;IAC3F,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,IAAI,sGA0Bf,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
|
+
import { logoIsotipo, logoPrincipal } from './logoArt.js';
|
|
5
|
+
/**
|
|
6
|
+
* Logo de Human Safe. Vectorial (sin imágenes externas) y con nombre accesible.
|
|
7
|
+
* Manual de marca, sección 3 "Logo": no deformar, no recolorear, no usar sin
|
|
8
|
+
* área de resguardo (el componente la aplica como padding).
|
|
9
|
+
*/
|
|
10
|
+
export const Logo = forwardRef(function Logo({ variant = 'principal', tone = 'auto', plate = false, size = 'md', title = 'Human Safe', className, ...rest }, ref) {
|
|
11
|
+
const art = variant === 'isotipo' ? logoIsotipo : logoPrincipal;
|
|
12
|
+
return (_jsx("div", { ref: ref, className: cx('hs-logo', `hs-logo--${variant}`, `hs-logo--${tone}`, `hs-logo--${size}`, plate && 'hs-logo--plate', className), ...rest, children: _jsxs("svg", { className: "hs-logo__svg", viewBox: art.viewBox, role: "img", "aria-label": title, focusable: "false", children: [_jsx("title", { children: title }), art.parts.map((part, i) => (_jsx("path", { className: `hs-logo__part hs-logo__part--${part.role}`, fillRule: "evenodd", d: part.d }, i)))] }) }));
|
|
13
|
+
});
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C,IACE,GACF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
export interface MenuItem {
|
|
3
|
+
value: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** Acción destructiva (ej. "Eliminar", "Rechazar"). */
|
|
8
|
+
tone?: 'default' | 'danger';
|
|
9
|
+
}
|
|
10
|
+
export interface MenuProps {
|
|
11
|
+
items: MenuItem[];
|
|
12
|
+
/** Único elemento disparador con soporte de ref (p. ej. `<Button>`). */
|
|
13
|
+
trigger: ReactElement;
|
|
14
|
+
onSelect?: (value: string) => void;
|
|
15
|
+
align?: 'start' | 'end';
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Menú de acciones ancladas a un disparador (patrón WAI-ARIA Menu Button).
|
|
20
|
+
* No usa portal: el consumidor debe evitar `overflow: hidden` en el ancestro
|
|
21
|
+
* si el menú puede desbordar la superficie.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Menu: import("react").ForwardRefExoticComponent<MenuProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../src/components/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAYL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uDAAuD;IACvD,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,wEAAwE;IACxE,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;;GAIG;AACH,eAAO,MAAM,IAAI,sGAuIf,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement, forwardRef, isValidElement, useCallback, useEffect, useId, useRef, useState, } from 'react';
|
|
3
|
+
import { cx } from '../utils/cx.js';
|
|
4
|
+
/**
|
|
5
|
+
* Menú de acciones ancladas a un disparador (patrón WAI-ARIA Menu Button).
|
|
6
|
+
* No usa portal: el consumidor debe evitar `overflow: hidden` en el ancestro
|
|
7
|
+
* si el menú puede desbordar la superficie.
|
|
8
|
+
*/
|
|
9
|
+
export const Menu = forwardRef(function Menu({ items, trigger, onSelect, align = 'start', ariaLabel = 'Menú de acciones' }, ref) {
|
|
10
|
+
const autoId = useId();
|
|
11
|
+
const [open, setOpen] = useState(false);
|
|
12
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
13
|
+
const rootRef = useRef(null);
|
|
14
|
+
const triggerRef = useRef(null);
|
|
15
|
+
const itemRefs = useRef({});
|
|
16
|
+
const enabled = items.filter((i) => !i.disabled);
|
|
17
|
+
const setRootRef = useCallback((node) => {
|
|
18
|
+
rootRef.current = node;
|
|
19
|
+
if (typeof ref === 'function')
|
|
20
|
+
ref(node);
|
|
21
|
+
else if (ref)
|
|
22
|
+
ref.current = node;
|
|
23
|
+
}, [ref]);
|
|
24
|
+
const focusItem = (value) => {
|
|
25
|
+
if (value)
|
|
26
|
+
itemRefs.current[value]?.focus();
|
|
27
|
+
};
|
|
28
|
+
const close = useCallback((focusTrigger = true) => {
|
|
29
|
+
setOpen(false);
|
|
30
|
+
if (focusTrigger)
|
|
31
|
+
triggerRef.current?.focus();
|
|
32
|
+
}, []);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!open)
|
|
35
|
+
return;
|
|
36
|
+
setActiveIndex(0);
|
|
37
|
+
const raf = requestAnimationFrame(() => focusItem(enabled[0]?.value));
|
|
38
|
+
const onDocMouseDown = (event) => {
|
|
39
|
+
if (rootRef.current && !rootRef.current.contains(event.target))
|
|
40
|
+
close(false);
|
|
41
|
+
};
|
|
42
|
+
document.addEventListener('mousedown', onDocMouseDown);
|
|
43
|
+
return () => {
|
|
44
|
+
cancelAnimationFrame(raf);
|
|
45
|
+
document.removeEventListener('mousedown', onDocMouseDown);
|
|
46
|
+
};
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
}, [open]);
|
|
49
|
+
const select = (value) => {
|
|
50
|
+
onSelect?.(value);
|
|
51
|
+
close();
|
|
52
|
+
};
|
|
53
|
+
const move = (delta) => {
|
|
54
|
+
if (enabled.length === 0)
|
|
55
|
+
return;
|
|
56
|
+
const next = (activeIndex + delta + enabled.length) % enabled.length;
|
|
57
|
+
setActiveIndex(next);
|
|
58
|
+
focusItem(enabled[next]?.value);
|
|
59
|
+
};
|
|
60
|
+
const onMenuKeyDown = (event) => {
|
|
61
|
+
if (event.key === 'ArrowDown') {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
move(1);
|
|
64
|
+
}
|
|
65
|
+
else if (event.key === 'ArrowUp') {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
move(-1);
|
|
68
|
+
}
|
|
69
|
+
else if (event.key === 'Home') {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
setActiveIndex(0);
|
|
72
|
+
focusItem(enabled[0]?.value);
|
|
73
|
+
}
|
|
74
|
+
else if (event.key === 'End') {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
setActiveIndex(enabled.length - 1);
|
|
77
|
+
focusItem(enabled[enabled.length - 1]?.value);
|
|
78
|
+
}
|
|
79
|
+
else if (event.key === 'Escape') {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
close();
|
|
82
|
+
}
|
|
83
|
+
else if (event.key === 'Tab') {
|
|
84
|
+
close(false);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
if (!isValidElement(trigger))
|
|
88
|
+
return null;
|
|
89
|
+
const triggerProps = trigger.props;
|
|
90
|
+
const clonedTrigger = cloneElement(trigger, {
|
|
91
|
+
ref: (node) => {
|
|
92
|
+
triggerRef.current = node;
|
|
93
|
+
},
|
|
94
|
+
'aria-haspopup': 'menu',
|
|
95
|
+
'aria-expanded': open,
|
|
96
|
+
onClick: (event) => {
|
|
97
|
+
setOpen((o) => !o);
|
|
98
|
+
triggerProps.onClick?.(event);
|
|
99
|
+
},
|
|
100
|
+
onKeyDown: (event) => {
|
|
101
|
+
if (!open && (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ')) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
setOpen(true);
|
|
104
|
+
}
|
|
105
|
+
triggerProps.onKeyDown?.(event);
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
return (_jsxs("div", { ref: setRootRef, className: "hs-menu", children: [clonedTrigger, open && (_jsx("div", { id: `hs-menu-${autoId}`, className: cx('hs-menu__list', `hs-menu__list--${align}`), role: "menu", "aria-label": ariaLabel, onKeyDown: onMenuKeyDown, children: items.map((item) => (_jsxs("button", { ref: (node) => {
|
|
109
|
+
itemRefs.current[item.value] = node;
|
|
110
|
+
}, type: "button", role: "menuitem", tabIndex: -1, disabled: item.disabled, className: cx('hs-menu__item', item.tone === 'danger' && 'hs-menu__item--danger'), onClick: () => select(item.value), children: [item.icon && _jsx("span", { className: "hs-menu__icon", "aria-hidden": "true", children: item.icon }), item.label] }, item.value))) }))] }));
|
|
111
|
+
});
|
|
112
|
+
//# sourceMappingURL=Menu.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AAE,aAAa,YAEvB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,kBAEE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;wBACZ,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;oBACtC,CAAC,EACD,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,CAAC,CAAC,EACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,uBAAuB,CAAC,EACjF,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,aAEhC,IAAI,CAAC,IAAI,IAAI,eAAM,SAAS,EAAC,eAAe,iBAAa,MAAM,YAAE,IAAI,CAAC,IAAI,GAAQ,EAClF,IAAI,CAAC,KAAK,KAZN,IAAI,CAAC,KAAK,CAaR,CACV,CAAC,GACE,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export interface ModalProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title'> {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** Acciones del pie, normalmente <Button>. */
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
size?: 'sm' | 'md' | 'lg';
|
|
10
|
+
/** Cerrar al pulsar Escape. Por defecto sí. */
|
|
11
|
+
closeOnEscape?: boolean;
|
|
12
|
+
/** Cerrar al hacer clic fuera. Por defecto sí. */
|
|
13
|
+
closeOnOverlay?: boolean;
|
|
14
|
+
closeLabel?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Diálogo modal con trampa de foco, restauración del foco previo y bloqueo de scroll.
|
|
18
|
+
* Renderiza en el árbol de React (sin portal) para no imponer un contenedor al consumidor.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Modal: import("react").ForwardRefExoticComponent<ModalProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../src/components/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChF,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,+CAA+C;IAC/C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kDAAkD;IAClD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAKD;;;GAGG;AACH,eAAO,MAAM,KAAK,uGA4GhB,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback, useEffect, useId, useRef, } from 'react';
|
|
3
|
+
import { cx } from '../utils/cx.js';
|
|
4
|
+
const FOCUSABLE = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
5
|
+
/**
|
|
6
|
+
* Diálogo modal con trampa de foco, restauración del foco previo y bloqueo de scroll.
|
|
7
|
+
* Renderiza en el árbol de React (sin portal) para no imponer un contenedor al consumidor.
|
|
8
|
+
*/
|
|
9
|
+
export const Modal = forwardRef(function Modal({ open, onClose, title, description, footer, size = 'md', closeOnEscape = true, closeOnOverlay = true, closeLabel = 'Cerrar', className, children, ...rest }, ref) {
|
|
10
|
+
const autoId = useId();
|
|
11
|
+
const titleId = `${autoId}-title`;
|
|
12
|
+
const descId = `${autoId}-desc`;
|
|
13
|
+
const dialogRef = useRef(null);
|
|
14
|
+
const lastFocused = useRef(null);
|
|
15
|
+
const setRefs = useCallback((node) => {
|
|
16
|
+
dialogRef.current = node;
|
|
17
|
+
if (typeof ref === 'function')
|
|
18
|
+
ref(node);
|
|
19
|
+
else if (ref)
|
|
20
|
+
ref.current = node;
|
|
21
|
+
}, [ref]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!open)
|
|
24
|
+
return;
|
|
25
|
+
lastFocused.current = document.activeElement;
|
|
26
|
+
const node = dialogRef.current;
|
|
27
|
+
const first = node?.querySelector(FOCUSABLE);
|
|
28
|
+
(first ?? node)?.focus();
|
|
29
|
+
const previousOverflow = document.body.style.overflow;
|
|
30
|
+
document.body.style.overflow = 'hidden';
|
|
31
|
+
const onKeyDown = (event) => {
|
|
32
|
+
if (event.key === 'Escape' && closeOnEscape) {
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
onClose();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (event.key !== 'Tab' || !node)
|
|
38
|
+
return;
|
|
39
|
+
const items = Array.from(node.querySelectorAll(FOCUSABLE)).filter((el) => el.offsetParent !== null || el === document.activeElement);
|
|
40
|
+
if (items.length === 0) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const first = items[0];
|
|
45
|
+
const last = items[items.length - 1];
|
|
46
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
last.focus();
|
|
49
|
+
}
|
|
50
|
+
else if (!event.shiftKey && document.activeElement === last) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
first.focus();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
document.addEventListener('keydown', onKeyDown, true);
|
|
56
|
+
return () => {
|
|
57
|
+
document.removeEventListener('keydown', onKeyDown, true);
|
|
58
|
+
document.body.style.overflow = previousOverflow;
|
|
59
|
+
lastFocused.current?.focus?.();
|
|
60
|
+
};
|
|
61
|
+
}, [open, closeOnEscape, onClose]);
|
|
62
|
+
if (!open)
|
|
63
|
+
return null;
|
|
64
|
+
return (_jsx("div", { className: "hs-modal__overlay", onMouseDown: (event) => {
|
|
65
|
+
if (closeOnOverlay && event.target === event.currentTarget)
|
|
66
|
+
onClose();
|
|
67
|
+
}, children: _jsxs("div", { ref: setRefs, role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, "aria-describedby": description ? descId : undefined, tabIndex: -1, className: cx('hs-modal', `hs-modal--${size}`, className), ...rest, children: [_jsxs("div", { className: "hs-modal__header", children: [_jsxs("div", { children: [_jsx("h2", { className: "hs-modal__title", id: titleId, children: title }), description && _jsx("p", { className: "hs-modal__description", id: descId, children: description })] }), _jsx("button", { type: "button", className: "hs-modal__close", onClick: onClose, "aria-label": closeLabel, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] }), _jsx("div", { className: "hs-modal__body", children: children }), footer && _jsx("div", { className: "hs-modal__footer", children: footer })] }) }));
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=Modal.js.map
|