@faast-app/ui 0.0.0-stage → 0.8.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.
Files changed (176) hide show
  1. package/README.md +16 -2
  2. package/dist/components/Alert.d.ts +30 -0
  3. package/dist/components/Alert.js +19 -0
  4. package/dist/components/AppShell.d.ts +63 -0
  5. package/dist/components/AppShell.js +80 -0
  6. package/dist/components/Avatar.d.ts +18 -0
  7. package/dist/components/Avatar.js +21 -0
  8. package/dist/components/Badge.d.ts +24 -0
  9. package/dist/components/Badge.js +10 -0
  10. package/dist/components/Button.d.ts +71 -0
  11. package/dist/components/Button.js +40 -0
  12. package/dist/components/Card.d.ts +23 -0
  13. package/dist/components/Card.js +17 -0
  14. package/dist/components/Chip.d.ts +16 -0
  15. package/dist/components/Chip.js +9 -0
  16. package/dist/components/Choice.d.ts +38 -0
  17. package/dist/components/Choice.js +53 -0
  18. package/dist/components/Dialog.d.ts +44 -0
  19. package/dist/components/Dialog.js +51 -0
  20. package/dist/components/EmptyState.d.ts +16 -0
  21. package/dist/components/EmptyState.js +8 -0
  22. package/dist/components/FileDropArea.d.ts +62 -0
  23. package/dist/components/FileDropArea.js +90 -0
  24. package/dist/components/FormField.d.ts +35 -0
  25. package/dist/components/FormField.js +32 -0
  26. package/dist/components/HelpMenu.d.ts +46 -0
  27. package/dist/components/HelpMenu.js +104 -0
  28. package/dist/components/Icon.d.ts +24 -0
  29. package/dist/components/Icon.js +195 -0
  30. package/dist/components/Input.d.ts +37 -0
  31. package/dist/components/Input.js +31 -0
  32. package/dist/components/KpiStrip.d.ts +32 -0
  33. package/dist/components/KpiStrip.js +14 -0
  34. package/dist/components/LockScreen.d.ts +34 -0
  35. package/dist/components/LockScreen.js +22 -0
  36. package/dist/components/Logo.d.ts +27 -0
  37. package/dist/components/Logo.js +12 -0
  38. package/dist/components/Navigation.d.ts +37 -0
  39. package/dist/components/Navigation.js +29 -0
  40. package/dist/components/OptionList.d.ts +27 -0
  41. package/dist/components/OptionList.js +18 -0
  42. package/dist/components/OtpInput.d.ts +31 -0
  43. package/dist/components/OtpInput.js +102 -0
  44. package/dist/components/Pagination.d.ts +31 -0
  45. package/dist/components/Pagination.js +41 -0
  46. package/dist/components/PasswordField.d.ts +32 -0
  47. package/dist/components/PasswordField.js +29 -0
  48. package/dist/components/SegmentedControl.d.ts +35 -0
  49. package/dist/components/SegmentedControl.js +52 -0
  50. package/dist/components/Select.d.ts +15 -0
  51. package/dist/components/Select.js +10 -0
  52. package/dist/components/SessionTimeoutDialog.d.ts +39 -0
  53. package/dist/components/SessionTimeoutDialog.js +62 -0
  54. package/dist/components/Spinner.d.ts +25 -0
  55. package/dist/components/Spinner.js +15 -0
  56. package/dist/components/StatTiles.d.ts +35 -0
  57. package/dist/components/StatTiles.js +12 -0
  58. package/dist/components/Stepper.d.ts +26 -0
  59. package/dist/components/Stepper.js +26 -0
  60. package/dist/components/StickyActionBar.d.ts +28 -0
  61. package/dist/components/StickyActionBar.js +12 -0
  62. package/dist/components/Table.d.ts +69 -0
  63. package/dist/components/Table.js +73 -0
  64. package/dist/components/TenantMark.d.ts +27 -0
  65. package/dist/components/TenantMark.js +15 -0
  66. package/dist/components/Timeline.d.ts +31 -0
  67. package/dist/components/Timeline.js +18 -0
  68. package/dist/components/Toast.d.ts +43 -0
  69. package/dist/components/Toast.js +46 -0
  70. package/dist/components/Toggletip.d.ts +26 -0
  71. package/dist/components/Toggletip.js +47 -0
  72. package/dist/components/Tooltip.d.ts +24 -0
  73. package/dist/components/Tooltip.js +73 -0
  74. package/dist/components/Tour.d.ts +66 -0
  75. package/dist/components/Tour.js +161 -0
  76. package/dist/components/TourOffer.d.ts +22 -0
  77. package/dist/components/TourOffer.js +33 -0
  78. package/dist/components/WelcomeDialog.d.ts +45 -0
  79. package/dist/components/WelcomeDialog.js +38 -0
  80. package/dist/data-table/components/ClientDataTable.d.ts +22 -0
  81. package/dist/data-table/components/ClientDataTable.js +29 -0
  82. package/dist/data-table/components/DataTableFooter.d.ts +11 -0
  83. package/dist/data-table/components/DataTableFooter.js +16 -0
  84. package/dist/data-table/components/DataTableView.d.ts +9 -0
  85. package/dist/data-table/components/DataTableView.js +95 -0
  86. package/dist/data-table/components/ServerDataTable.d.ts +16 -0
  87. package/dist/data-table/components/ServerDataTable.js +17 -0
  88. package/dist/data-table/core/columnVisibility.d.ts +15 -0
  89. package/dist/data-table/core/columnVisibility.js +34 -0
  90. package/dist/data-table/core/constants.d.ts +20 -0
  91. package/dist/data-table/core/constants.js +21 -0
  92. package/dist/data-table/core/filters/registry.d.ts +33 -0
  93. package/dist/data-table/core/filters/registry.js +393 -0
  94. package/dist/data-table/core/filters/types.d.ts +88 -0
  95. package/dist/data-table/core/filters/types.js +1 -0
  96. package/dist/data-table/core/group.d.ts +15 -0
  97. package/dist/data-table/core/group.js +73 -0
  98. package/dist/data-table/core/paginate.d.ts +13 -0
  99. package/dist/data-table/core/paginate.js +27 -0
  100. package/dist/data-table/core/query.d.ts +65 -0
  101. package/dist/data-table/core/query.js +138 -0
  102. package/dist/data-table/core/search.d.ts +10 -0
  103. package/dist/data-table/core/search.js +35 -0
  104. package/dist/data-table/core/selection.d.ts +24 -0
  105. package/dist/data-table/core/selection.js +59 -0
  106. package/dist/data-table/core/sort.d.ts +14 -0
  107. package/dist/data-table/core/sort.js +41 -0
  108. package/dist/data-table/core/text.d.ts +5 -0
  109. package/dist/data-table/core/text.js +27 -0
  110. package/dist/data-table/core/types.d.ts +40 -0
  111. package/dist/data-table/core/types.js +1 -0
  112. package/dist/data-table/core/url.d.ts +43 -0
  113. package/dist/data-table/core/url.js +194 -0
  114. package/dist/data-table/hooks/common.d.ts +14 -0
  115. package/dist/data-table/hooks/common.js +30 -0
  116. package/dist/data-table/hooks/small-hooks.d.ts +12 -0
  117. package/dist/data-table/hooks/small-hooks.js +111 -0
  118. package/dist/data-table/hooks/useClientDataTable.d.ts +35 -0
  119. package/dist/data-table/hooks/useClientDataTable.js +311 -0
  120. package/dist/data-table/hooks/useServerDataTable.d.ts +38 -0
  121. package/dist/data-table/hooks/useServerDataTable.js +209 -0
  122. package/dist/data-table/hooks/useServerRows.d.ts +27 -0
  123. package/dist/data-table/hooks/useServerRows.js +82 -0
  124. package/dist/data-table/hooks/useTableState.d.ts +39 -0
  125. package/dist/data-table/hooks/useTableState.js +219 -0
  126. package/dist/data-table/index.d.ts +42 -0
  127. package/dist/data-table/index.js +22 -0
  128. package/dist/data-table/labels.d.ts +77 -0
  129. package/dist/data-table/labels.js +77 -0
  130. package/dist/data-table/toolbar/ActiveFilters.d.ts +10 -0
  131. package/dist/data-table/toolbar/ActiveFilters.js +53 -0
  132. package/dist/data-table/toolbar/BulkActionBar.d.ts +15 -0
  133. package/dist/data-table/toolbar/BulkActionBar.js +22 -0
  134. package/dist/data-table/toolbar/ColumnVisibilityDialog.d.ts +7 -0
  135. package/dist/data-table/toolbar/ColumnVisibilityDialog.js +15 -0
  136. package/dist/data-table/toolbar/DataTableToolbar.d.ts +19 -0
  137. package/dist/data-table/toolbar/DataTableToolbar.js +12 -0
  138. package/dist/data-table/toolbar/FilterFields.d.ts +11 -0
  139. package/dist/data-table/toolbar/FilterFields.js +58 -0
  140. package/dist/data-table/toolbar/FiltersControl.d.ts +34 -0
  141. package/dist/data-table/toolbar/FiltersControl.js +70 -0
  142. package/dist/data-table/toolbar/PageSizeSelect.d.ts +7 -0
  143. package/dist/data-table/toolbar/PageSizeSelect.js +12 -0
  144. package/dist/data-table/toolbar/QuickFilters.d.ts +7 -0
  145. package/dist/data-table/toolbar/QuickFilters.js +9 -0
  146. package/dist/data-table/toolbar/ResultsCount.d.ts +7 -0
  147. package/dist/data-table/toolbar/ResultsCount.js +9 -0
  148. package/dist/data-table/toolbar/SearchField.d.ts +36 -0
  149. package/dist/data-table/toolbar/SearchField.js +64 -0
  150. package/dist/data-table/toolbar/SortSelect.d.ts +10 -0
  151. package/dist/data-table/toolbar/SortSelect.js +30 -0
  152. package/dist/data-table/types.d.ts +334 -0
  153. package/dist/data-table/types.js +1 -0
  154. package/dist/index.d.ts +91 -0
  155. package/dist/index.js +49 -0
  156. package/dist/kit/catalogo.html +5281 -0
  157. package/dist/kit/faast-kit.css +5129 -0
  158. package/dist/kit/markup.json +127 -0
  159. package/dist/styles.css +4668 -0
  160. package/dist/theme/ThemeProvider.d.ts +33 -0
  161. package/dist/theme/ThemeProvider.js +77 -0
  162. package/dist/theme/ThemeToggle.d.ts +16 -0
  163. package/dist/theme/ThemeToggle.js +27 -0
  164. package/dist/utils/cx.d.ts +2 -0
  165. package/dist/utils/cx.js +4 -0
  166. package/dist/utils/devWarn.d.ts +2 -0
  167. package/dist/utils/devWarn.js +10 -0
  168. package/dist/utils/tourGeometry.d.ts +61 -0
  169. package/dist/utils/tourGeometry.js +135 -0
  170. package/dist/utils/useFloatingPosition.d.ts +9 -0
  171. package/dist/utils/useFloatingPosition.js +45 -0
  172. package/dist/utils/useModalDialog.d.ts +7 -0
  173. package/dist/utils/useModalDialog.js +49 -0
  174. package/dist/utils/useTourAnchorRect.d.ts +6 -0
  175. package/dist/utils/useTourAnchorRect.js +40 -0
  176. package/package.json +53 -4
@@ -0,0 +1,195 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ArrowDown, ArrowLeftRight, ArrowRight, ArrowUp, ArrowUpDown, Ban, Bell, BellOff, BookOpen, Building2, Calculator, Calendar, CalendarCog, Check, CheckCheck, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, ChevronsUpDown, ChevronUp, CircleAlert, CircleCheck, CircleHelp, CircleX, Coins, Columns3Cog, Download, Eraser, Eye, EyeOff, FileCheck, FileCode2, FilePlus, Files, FileSpreadsheet, FileText, FileUp, FileWarning, FileX, Fingerprint, FolderClock, Globe, History, House, Image, Info, KeyRound, LayoutDashboard, List, Lock, LogIn, LogOut, Mail, Menu, Monitor, Moon, Palette, PanelLeft, Paperclip, Pencil, Play, Plus, RefreshCw, Repeat, Replace, RotateCw, Route, Search, SearchX, Send, Settings, ShieldAlert, ShieldCheck, SlidersHorizontal, Sun, Timer, Trash2, TriangleAlert, Undo2, Upload, UserRound, Users, X, XCircle, } from 'lucide-react';
3
+ import { cx } from '../utils/cx.js';
4
+ /**
5
+ * The closed set of icon names. Only these Lucide icons are imported, so a bundler keeps
6
+ * exactly this set. Applications validate backend icon ids with `isIconName` before
7
+ * rendering; an unknown id is a configuration error, never rendered.
8
+ */
9
+ export const iconNames = [
10
+ 'arrow-down',
11
+ 'arrow-left-right',
12
+ 'arrow-right',
13
+ 'arrow-up',
14
+ 'arrow-up-down',
15
+ 'ban',
16
+ 'bell',
17
+ 'bell-off',
18
+ 'book-open',
19
+ 'building-2',
20
+ 'calculator',
21
+ 'calendar',
22
+ 'calendar-cog',
23
+ 'check',
24
+ 'check-check',
25
+ 'check-circle-2',
26
+ 'chevron-down',
27
+ 'chevron-left',
28
+ 'chevron-right',
29
+ 'chevron-up',
30
+ 'chevrons-up-down',
31
+ 'circle-alert',
32
+ 'circle-check',
33
+ 'circle-help',
34
+ 'circle-x',
35
+ 'coins',
36
+ 'columns-3-cog',
37
+ 'download',
38
+ 'eraser',
39
+ 'eye',
40
+ 'eye-off',
41
+ 'file-check',
42
+ 'file-code-2',
43
+ 'file-plus',
44
+ 'file-spreadsheet',
45
+ 'file-text',
46
+ 'file-up',
47
+ 'file-warning',
48
+ 'file-x',
49
+ 'files',
50
+ 'fingerprint',
51
+ 'folder-clock',
52
+ 'globe',
53
+ 'history',
54
+ 'house',
55
+ 'image',
56
+ 'info',
57
+ 'key-round',
58
+ 'layout-dashboard',
59
+ 'list',
60
+ 'lock',
61
+ 'log-in',
62
+ 'log-out',
63
+ 'mail',
64
+ 'menu',
65
+ 'monitor',
66
+ 'moon',
67
+ 'palette',
68
+ 'panel-left',
69
+ 'paperclip',
70
+ 'pencil',
71
+ 'play',
72
+ 'plus',
73
+ 'refresh-cw',
74
+ 'repeat',
75
+ 'replace',
76
+ 'rotate-cw',
77
+ 'route',
78
+ 'search',
79
+ 'search-x',
80
+ 'send',
81
+ 'settings',
82
+ 'shield-alert',
83
+ 'shield-check',
84
+ 'sliders-horizontal',
85
+ 'sun',
86
+ 'timer',
87
+ 'trash-2',
88
+ 'triangle-alert',
89
+ 'undo-2',
90
+ 'upload',
91
+ 'user-round',
92
+ 'users',
93
+ 'x',
94
+ 'x-circle',
95
+ ];
96
+ const ICONS = {
97
+ 'arrow-down': ArrowDown,
98
+ 'arrow-left-right': ArrowLeftRight,
99
+ 'arrow-right': ArrowRight,
100
+ 'arrow-up': ArrowUp,
101
+ 'arrow-up-down': ArrowUpDown,
102
+ ban: Ban,
103
+ bell: Bell,
104
+ 'bell-off': BellOff,
105
+ 'book-open': BookOpen,
106
+ 'building-2': Building2,
107
+ calculator: Calculator,
108
+ calendar: Calendar,
109
+ 'calendar-cog': CalendarCog,
110
+ check: Check,
111
+ 'check-check': CheckCheck,
112
+ 'check-circle-2': CheckCircle2,
113
+ 'chevron-down': ChevronDown,
114
+ 'chevron-left': ChevronLeft,
115
+ 'chevron-right': ChevronRight,
116
+ 'chevron-up': ChevronUp,
117
+ 'chevrons-up-down': ChevronsUpDown,
118
+ 'circle-alert': CircleAlert,
119
+ 'circle-check': CircleCheck,
120
+ 'circle-help': CircleHelp,
121
+ 'circle-x': CircleX,
122
+ coins: Coins,
123
+ 'columns-3-cog': Columns3Cog,
124
+ download: Download,
125
+ eraser: Eraser,
126
+ eye: Eye,
127
+ 'eye-off': EyeOff,
128
+ 'file-check': FileCheck,
129
+ 'file-code-2': FileCode2,
130
+ 'file-plus': FilePlus,
131
+ 'file-spreadsheet': FileSpreadsheet,
132
+ 'file-text': FileText,
133
+ 'file-up': FileUp,
134
+ 'file-warning': FileWarning,
135
+ 'file-x': FileX,
136
+ files: Files,
137
+ fingerprint: Fingerprint,
138
+ 'folder-clock': FolderClock,
139
+ globe: Globe,
140
+ history: History,
141
+ house: House,
142
+ image: Image,
143
+ info: Info,
144
+ 'key-round': KeyRound,
145
+ 'layout-dashboard': LayoutDashboard,
146
+ list: List,
147
+ lock: Lock,
148
+ 'log-in': LogIn,
149
+ 'log-out': LogOut,
150
+ mail: Mail,
151
+ menu: Menu,
152
+ monitor: Monitor,
153
+ moon: Moon,
154
+ palette: Palette,
155
+ 'panel-left': PanelLeft,
156
+ paperclip: Paperclip,
157
+ pencil: Pencil,
158
+ play: Play,
159
+ plus: Plus,
160
+ 'refresh-cw': RefreshCw,
161
+ repeat: Repeat,
162
+ replace: Replace,
163
+ 'rotate-cw': RotateCw,
164
+ route: Route,
165
+ search: Search,
166
+ 'search-x': SearchX,
167
+ send: Send,
168
+ settings: Settings,
169
+ 'shield-alert': ShieldAlert,
170
+ 'shield-check': ShieldCheck,
171
+ 'sliders-horizontal': SlidersHorizontal,
172
+ sun: Sun,
173
+ timer: Timer,
174
+ 'trash-2': Trash2,
175
+ 'triangle-alert': TriangleAlert,
176
+ 'undo-2': Undo2,
177
+ upload: Upload,
178
+ 'user-round': UserRound,
179
+ users: Users,
180
+ x: X,
181
+ 'x-circle': XCircle,
182
+ };
183
+ const NAME_SET = new Set(iconNames);
184
+ /** Type guard for icon ids that come from configuration (e.g. backend navigation). */
185
+ export function isIconName(value) {
186
+ return typeof value === 'string' && NAME_SET.has(value);
187
+ }
188
+ /** One Lucide icon from the allowlist. Colour follows `currentColor`. */
189
+ export function Icon({ name, size = 20, strokeWidth = 1.75, label, className, ...rest }) {
190
+ const Glyph = ICONS[name];
191
+ const a11y = label
192
+ ? { role: 'img', 'aria-label': label, 'aria-hidden': undefined }
193
+ : { 'aria-hidden': true };
194
+ return (_jsx(Glyph, { size: size, strokeWidth: strokeWidth, focusable: "false", className: cx('faast-icon', className), ...rest, ...a11y }));
195
+ }
@@ -0,0 +1,37 @@
1
+ import { type InputHTMLAttributes, type ReactNode, type TextareaHTMLAttributes } from 'react';
2
+ import { type IconName } from './Icon.js';
3
+ /** Props a control takes from the surrounding FormField unless set explicitly. */
4
+ export declare function useFieldProps<P extends {
5
+ id?: string;
6
+ required?: boolean;
7
+ 'aria-describedby'?: string;
8
+ 'aria-invalid'?: InputHTMLAttributes<HTMLInputElement>['aria-invalid'];
9
+ }>(props: P): {
10
+ id: string | undefined;
11
+ required: boolean | undefined;
12
+ 'aria-describedby': string | undefined;
13
+ 'aria-invalid': boolean | "false" | "true" | "grammar" | "spelling" | undefined;
14
+ };
15
+ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
16
+ /** Decorative icon inside the field, before the text. Tinted with the accent on focus. */
17
+ leadingIcon?: IconName;
18
+ /**
19
+ * One control inside the field, after the text (e.g. an `IconButton` that reveals a
20
+ * password). The input reserves room for it.
21
+ */
22
+ trailingAction?: ReactNode;
23
+ }
24
+ /** Text input. 16px text (no iOS zoom), 44px tall on touch. */
25
+ export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
26
+ export type TextareaProps = TextareaHTMLAttributes<HTMLTextAreaElement>;
27
+ export declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
28
+ export interface TextFieldProps extends InputProps {
29
+ label: ReactNode;
30
+ hint?: ReactNode;
31
+ error?: ReactNode;
32
+ fieldClassName?: string;
33
+ /** Content right under the control, before hint and error (e.g. password requirements). */
34
+ afterControl?: ReactNode;
35
+ }
36
+ /** FormField + Input in one component. */
37
+ export declare const TextField: import("react").ForwardRefExoticComponent<TextFieldProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,31 @@
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 { FormField, mergeDescribedBy, useFormField } from './FormField.js';
5
+ import { Icon } from './Icon.js';
6
+ /** Props a control takes from the surrounding FormField unless set explicitly. */
7
+ export function useFieldProps(props) {
8
+ const field = useFormField();
9
+ return {
10
+ id: props.id ?? field?.controlId,
11
+ required: props.required ?? (field?.required || undefined),
12
+ 'aria-describedby': mergeDescribedBy(field?.describedBy, props['aria-describedby']),
13
+ 'aria-invalid': props['aria-invalid'] ?? (field?.invalid || undefined),
14
+ };
15
+ }
16
+ /** Text input. 16px text (no iOS zoom), 44px tall on touch. */
17
+ export const Input = forwardRef(function Input({ className, type = 'text', leadingIcon, trailingAction, ...rest }, ref) {
18
+ const field = useFieldProps(rest);
19
+ const input = (_jsx("input", { ref: ref, type: type, className: cx('faast-input', leadingIcon && 'faast-input--leading', trailingAction != null && 'faast-input--trailing', className), ...rest, ...field }));
20
+ if (!leadingIcon && trailingAction == null)
21
+ return input;
22
+ return (_jsxs("span", { className: "faast-input-wrap", children: [leadingIcon && _jsx(Icon, { name: leadingIcon, className: "faast-input-wrap__leading" }), input, trailingAction != null && (_jsx("span", { className: "faast-input-wrap__trailing", children: trailingAction }))] }));
23
+ });
24
+ export const Textarea = forwardRef(function Textarea({ className, rows = 4, ...rest }, ref) {
25
+ const field = useFieldProps(rest);
26
+ return (_jsx("textarea", { ref: ref, rows: rows, className: cx('faast-input', 'faast-textarea', className), ...rest, ...field }));
27
+ });
28
+ /** FormField + Input in one component. */
29
+ export const TextField = forwardRef(function TextField({ label, hint, error, required, id, fieldClassName, afterControl, ...rest }, ref) {
30
+ return (_jsxs(FormField, { label: label, hint: hint, error: error, required: required, id: id, className: fieldClassName, children: [_jsx(Input, { ref: ref, ...rest }), afterControl] }));
31
+ });
@@ -0,0 +1,32 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface KpiItem {
3
+ id: string;
4
+ /** Short name of the figure ("Intereses"). */
5
+ label: ReactNode;
6
+ /** The figure, already formatted by the app. May include a `<small>` for a unit. */
7
+ value: ReactNode;
8
+ /** Emphasised cell (accent-subtle background, larger accent value), e.g. the net amount. */
9
+ highlight?: boolean;
10
+ /** Hidden when the strip is narrower than 520px (secondary figures on phones). */
11
+ hideOnNarrow?: boolean;
12
+ }
13
+ export interface KpiStripProps {
14
+ items: readonly KpiItem[];
15
+ /** Accessible name of the group of figures ("Resumen de la liquidación"). Required. */
16
+ label: string;
17
+ /**
18
+ * Relative column widths of the wide layout (strip at least 860px wide), one per item,
19
+ * e.g. `[0.85, 1.15, 1, 1, 0.8, 0.8, 1.3]`. Default: equal columns.
20
+ */
21
+ weights?: readonly number[];
22
+ /** The figures are being recalculated: sets `aria-busy` and dims the values. */
23
+ busy?: boolean;
24
+ className?: string;
25
+ }
26
+ /**
27
+ * Joined strip of key figures. The layout follows the width of the strip, not the viewport
28
+ * (container queries): below 520px two columns with the highlighted cell full width and the
29
+ * `hideOnNarrow` cells hidden; from 520px four columns with the highlight spanning two; from
30
+ * 860px a single row. A description list, so each figure is read with its label.
31
+ */
32
+ export declare function KpiStrip({ items, label, weights, busy, className }: KpiStripProps): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from '../utils/cx.js';
3
+ /**
4
+ * Joined strip of key figures. The layout follows the width of the strip, not the viewport
5
+ * (container queries): below 520px two columns with the highlighted cell full width and the
6
+ * `hideOnNarrow` cells hidden; from 520px four columns with the highlight spanning two; from
7
+ * 860px a single row. A description list, so each figure is read with its label.
8
+ */
9
+ export function KpiStrip({ items, label, weights, busy = false, className }) {
10
+ const columns = weights && weights.length === items.length
11
+ ? weights.map((weight) => `${weight}fr`).join(' ')
12
+ : `repeat(${Math.max(items.length, 1)}, minmax(0, 1fr))`;
13
+ return (_jsx("div", { className: cx('faast-kpi-strip', className), role: "group", "aria-label": label, children: _jsx("dl", { className: cx('faast-kpi-strip__grid', busy && 'faast-kpi-strip__grid--busy'), "aria-busy": busy || undefined, style: { '--faast-kpi-columns': columns }, children: items.map((item) => (_jsxs("div", { className: cx('faast-kpi', item.highlight && 'faast-kpi--highlight', item.hideOnNarrow && 'faast-kpi--hide-narrow'), children: [_jsx("dt", { className: "faast-kpi__label", children: item.label }), _jsx("dd", { className: "faast-kpi__value faast-num", children: item.value })] }, item.id))) }) }));
14
+ }
@@ -0,0 +1,34 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface LockScreenUser {
3
+ name: string;
4
+ /** Already masked by the application (see `maskEmail`). Never pass the full address. */
5
+ maskedEmail: string;
6
+ initials?: string;
7
+ }
8
+ export interface LockScreenProps {
9
+ user: LockScreenUser;
10
+ /** Tenant mark (or FaaST logo) for the top bar. */
11
+ brand?: ReactNode;
12
+ /** Default "Tu sesión expiró". */
13
+ title?: ReactNode;
14
+ /** Default "Cerramos tu sesión por inactividad. Vuelve a ingresar para seguir donde estabas." */
15
+ description?: ReactNode;
16
+ /** Note that unsaved work is kept (e.g. "Guardamos tu borrador … en esta pestaña."). */
17
+ keptNotice?: ReactNode;
18
+ /** Main re-entry action, usually "Continuar con Llave de Acceso". */
19
+ primaryAction: ReactNode;
20
+ /** Second re-entry action, usually "Usar Contraseña". */
21
+ secondaryAction?: ReactNode;
22
+ /** "¿No eres …? Ingresa con otra cuenta" line (text plus a link-style button). */
23
+ switchAccount?: ReactNode;
24
+ /** Heading level of the title. Default 1 (the lock screen replaces the page). */
25
+ headingLevel?: 1 | 2;
26
+ className?: string;
27
+ }
28
+ /** Masks an e-mail for display: "lucia.ramos@empresa.pe" -> "l•••••@empresa.pe". */
29
+ export declare function maskEmail(email: string): string;
30
+ /**
31
+ * Full-page layout shown when the session has expired. It takes no children: the
32
+ * application unmounts protected content instead of hiding it behind this screen.
33
+ */
34
+ export declare function LockScreen({ user, brand, title, description, keptNotice, primaryAction, secondaryAction, switchAccount, headingLevel, className, }: LockScreenProps): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from 'react';
3
+ import { cx } from '../utils/cx.js';
4
+ import { Avatar } from './Avatar.js';
5
+ import { Icon } from './Icon.js';
6
+ /** Masks an e-mail for display: "lucia.ramos@empresa.pe" -> "l•••••@empresa.pe". */
7
+ export function maskEmail(email) {
8
+ const at = email.lastIndexOf('@');
9
+ if (at <= 0)
10
+ return '•••••';
11
+ const first = Array.from(email.slice(0, at))[0] ?? '';
12
+ return `${first}•••••${email.slice(at)}`;
13
+ }
14
+ /**
15
+ * Full-page layout shown when the session has expired. It takes no children: the
16
+ * application unmounts protected content instead of hiding it behind this screen.
17
+ */
18
+ export function LockScreen({ user, brand, title = 'Tu sesión expiró', description = 'Cerramos tu sesión por inactividad. Vuelve a ingresar para seguir donde estabas.', keptNotice, primaryAction, secondaryAction, switchAccount, headingLevel = 1, className, }) {
19
+ const titleId = `${useId()}-lock-title`;
20
+ const Heading = headingLevel === 1 ? 'h1' : 'h2';
21
+ return (_jsxs("div", { className: cx('faast-lock', className), "data-testid": "lock-screen", children: [brand && _jsx("header", { className: "faast-lock__bar", children: brand }), _jsx("main", { className: "faast-lock__body", children: _jsxs("section", { className: "faast-lock__card", "aria-labelledby": titleId, children: [_jsxs("div", { className: "faast-lock__identity", children: [_jsx(Avatar, { name: user.name, initials: user.initials, size: 48, decorative: true }), _jsxs("div", { className: "faast-lock__who", children: [_jsx("p", { className: "faast-lock__name", children: user.name }), _jsx("p", { className: "faast-lock__email", translate: "no", children: user.maskedEmail })] })] }), _jsxs("div", { children: [_jsxs(Heading, { className: "faast-lock__title", id: titleId, children: [_jsx(Icon, { name: "lock", size: 24 }), title] }), _jsx("p", { className: "faast-lock__description", children: description })] }), keptNotice && (_jsxs("div", { className: "faast-lock__kept", children: [_jsx(Icon, { name: "check", size: 18 }), _jsx("span", { children: keptNotice })] })), _jsxs("div", { className: "faast-lock__actions", children: [primaryAction, secondaryAction] }), switchAccount && (_jsxs("div", { className: "faast-lock__switch", children: [_jsx(Icon, { name: "user-round" }), _jsx("div", { children: switchAccount })] }))] }) })] }));
22
+ }
@@ -0,0 +1,27 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ export interface LogoProps extends HTMLAttributes<HTMLSpanElement> {
3
+ /**
4
+ * URL of the official logo for light surfaces, e.g.
5
+ * `import logoUrl from '@faast-app/tokens/brand/faast-logo.svg'` (Vite/webpack asset import).
6
+ */
7
+ src: string;
8
+ /**
9
+ * URL of the derived on-dark variant (`@faast-app/tokens/brand/faast-logo-on-dark.svg`).
10
+ * When omitted, the light logo is used on every surface.
11
+ */
12
+ srcOnDark?: string;
13
+ /** Rendered height in px; width follows the official 122:36 ratio. Default 28. */
14
+ height?: number;
15
+ /** Accessible name. Default "FaaST". Pass "" when a visible name sits next to it. */
16
+ alt?: string;
17
+ /**
18
+ * `auto` (default) follows the active theme with CSS only (no JS, no flash):
19
+ * `data-theme` first, then `prefers-color-scheme`. Force `light`/`dark` for a known surface.
20
+ */
21
+ theme?: 'auto' | 'light' | 'dark';
22
+ }
23
+ /**
24
+ * The FaaST logo, never recoloured or distorted: the light-surface file is the official one,
25
+ * the dark-surface file is the user-approved derived variant (wordmark in white).
26
+ */
27
+ export declare function Logo({ src, srcOnDark, height, alt, theme, className, ...rest }: LogoProps): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { logo } from '@faast-app/tokens';
3
+ import { cx } from '../utils/cx.js';
4
+ /**
5
+ * The FaaST logo, never recoloured or distorted: the light-surface file is the official one,
6
+ * the dark-surface file is the user-approved derived variant (wordmark in white).
7
+ */
8
+ export function Logo({ src, srcOnDark, height = 28, alt = logo.alt, theme = 'auto', className, ...rest }) {
9
+ const width = Math.round(height * logo.aspectRatio);
10
+ const variant = srcOnDark ? theme : 'light';
11
+ return (_jsxs("span", { className: cx('faast-logo', `faast-logo--${variant}`, className), translate: "no", ...rest, children: [_jsx("img", { className: "faast-logo__img faast-logo__img--light", src: src, alt: alt, width: width, height: height, decoding: "async" }), srcOnDark && (_jsx("img", { className: "faast-logo__img faast-logo__img--dark", src: srcOnDark, alt: alt, width: width, height: height, decoding: "async" }))] }));
12
+ }
@@ -0,0 +1,37 @@
1
+ import { type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
2
+ export interface SideNavProps extends HTMLAttributes<HTMLElement> {
3
+ /** Accessible name of the navigation landmark. Default "Principal". */
4
+ label?: string;
5
+ }
6
+ /** Vertical navigation landmark. Put NavSection / NavItem inside. */
7
+ export declare function SideNav({ label, className, children, ...rest }: SideNavProps): import("react").JSX.Element;
8
+ export interface NavSectionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
9
+ /** Optional group title (shown in uppercase with letter spacing; write it in sentence case). */
10
+ title?: ReactNode;
11
+ /** Pin this section to the bottom of the sidebar, under a divider (profile, settings, help). */
12
+ bottom?: boolean;
13
+ }
14
+ export declare function NavSection({ title, bottom, className, children, ...rest }: NavSectionProps): import("react").JSX.Element;
15
+ export interface NavItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
16
+ /** Marks the current page (`aria-current="page"`, grey pill). */
17
+ active?: boolean;
18
+ /** 16px outline icon, decorative. */
19
+ icon?: ReactNode;
20
+ /** Count for a queue that needs action (e.g. a Badge). */
21
+ badge?: ReactNode;
22
+ /**
23
+ * Render your router's link instead of `<a>`: pass one element as the only child, e.g.
24
+ * `<NavItem asChild active><Link to="/ops">Operaciones</Link></NavItem>`.
25
+ */
26
+ asChild?: boolean;
27
+ }
28
+ /** One destination in a SideNav. Links, never buttons: other screens, not in-page anchors. */
29
+ export declare function NavItem({ active, icon, badge, asChild, className, children, ...rest }: NavItemProps): import("react").JSX.Element;
30
+ export interface TopBarProps extends HTMLAttributes<HTMLElement> {
31
+ /** Leading content (menu button, brand). */
32
+ start?: ReactNode;
33
+ /** Trailing content (theme toggle, account). */
34
+ end?: ReactNode;
35
+ }
36
+ /** Horizontal header bar: start, flexible middle (search, page name), end. */
37
+ export declare function TopBar({ start, end, className, children, ...rest }: TopBarProps): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { cloneElement, isValidElement, } from 'react';
3
+ import { cx } from '../utils/cx.js';
4
+ /** Vertical navigation landmark. Put NavSection / NavItem inside. */
5
+ export function SideNav({ label = 'Principal', className, children, ...rest }) {
6
+ return (_jsx("nav", { "aria-label": label, className: cx('faast-sidenav', className), ...rest, children: children }));
7
+ }
8
+ export function NavSection({ title, bottom = false, className, children, ...rest }) {
9
+ return (_jsxs("div", { className: cx('faast-nav-section', bottom && 'faast-nav-section--bottom', className), ...rest, children: [title && _jsx("p", { className: "faast-nav-section__title", children: title }), _jsx("ul", { className: "faast-nav-section__list", children: children })] }));
10
+ }
11
+ /** One destination in a SideNav. Links, never buttons: other screens, not in-page anchors. */
12
+ export function NavItem({ active = false, icon, badge, asChild = false, className, children, ...rest }) {
13
+ const classes = cx('faast-nav-item', active && 'faast-nav-item--active', className);
14
+ const current = active ? 'page' : undefined;
15
+ const content = (label) => (_jsxs(_Fragment, { children: [icon && _jsx("span", { className: "faast-nav-item__icon", children: icon }), _jsx("span", { className: "faast-nav-item__label", children: label }), badge && _jsx("span", { className: "faast-nav-item__badge", children: badge })] }));
16
+ if (asChild && isValidElement(children)) {
17
+ const child = children;
18
+ return (_jsx("li", { children: cloneElement(child, {
19
+ className: cx(classes, child.props.className),
20
+ 'aria-current': current,
21
+ children: content(child.props.children),
22
+ }) }));
23
+ }
24
+ return (_jsx("li", { children: _jsx("a", { className: classes, "aria-current": current, ...rest, children: content(children) }) }));
25
+ }
26
+ /** Horizontal header bar: start, flexible middle (search, page name), end. */
27
+ export function TopBar({ start, end, className, children, ...rest }) {
28
+ return (_jsxs("header", { className: cx('faast-topbar', className), ...rest, children: [start && _jsx("div", { className: "faast-topbar__start", children: start }), _jsx("div", { className: "faast-topbar__middle", children: children }), end && _jsx("div", { className: "faast-topbar__end", children: end })] }));
29
+ }
@@ -0,0 +1,27 @@
1
+ import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
2
+ import { type IconName } from './Icon.js';
3
+ export interface OptionListProps extends HTMLAttributes<HTMLUListElement> {
4
+ children: ReactNode;
5
+ }
6
+ /** Vertical list of full-width action rows (e.g. alternative verification methods). */
7
+ export declare function OptionList({ className, children, ...rest }: OptionListProps): import("react").JSX.Element;
8
+ interface OptionContentProps {
9
+ icon?: IconName;
10
+ title: ReactNode;
11
+ description?: ReactNode;
12
+ /** Trailing icon. Default `arrow-right`; `null` hides it. */
13
+ trailingIcon?: IconName | null;
14
+ }
15
+ type OptionButtonProps = OptionContentProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'title' | 'children'> & {
16
+ href?: undefined;
17
+ };
18
+ type OptionLinkProps = OptionContentProps & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'title' | 'children'> & {
19
+ href: string;
20
+ };
21
+ export type OptionListItemProps = OptionButtonProps | OptionLinkProps;
22
+ /**
23
+ * One row: icon, title, description and a trailing arrow. Renders a `<button>`, or an
24
+ * `<a>` when `href` is given. The whole row is the hit target.
25
+ */
26
+ export declare const OptionListItem: import("react").ForwardRefExoticComponent<OptionListItemProps & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
27
+ export {};
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { forwardRef, } from 'react';
3
+ import { cx } from '../utils/cx.js';
4
+ import { Icon } from './Icon.js';
5
+ /** Vertical list of full-width action rows (e.g. alternative verification methods). */
6
+ export function OptionList({ className, children, ...rest }) {
7
+ return (_jsx("ul", { className: cx('faast-option-list', className), ...rest, children: children }));
8
+ }
9
+ /**
10
+ * One row: icon, title, description and a trailing arrow. Renders a `<button>`, or an
11
+ * `<a>` when `href` is given. The whole row is the hit target.
12
+ */
13
+ export const OptionListItem = forwardRef(function OptionListItem(props, ref) {
14
+ const { icon, title, description, trailingIcon = 'arrow-right', className, ...rest } = props;
15
+ const content = (_jsxs(_Fragment, { children: [icon && _jsx(Icon, { name: icon, className: "faast-option__icon" }), _jsxs("span", { className: "faast-option__text", children: [_jsx("span", { className: "faast-option__title", children: title }), description && _jsx("span", { className: "faast-option__description", children: description })] }), trailingIcon && _jsx(Icon, { name: trailingIcon, className: "faast-option__trailing" })] }));
16
+ const classes = cx('faast-option', className);
17
+ return (_jsx("li", { className: "faast-option-list__item", children: rest.href !== undefined ? (_jsx("a", { ref: ref, className: classes, ...rest, children: content })) : (_jsx("button", { ref: ref, type: "button", className: classes, ...rest, children: content })) }));
18
+ });
@@ -0,0 +1,31 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface OtpInputProps {
3
+ /** Number of digits. Default 6. */
4
+ length?: number;
5
+ /** Controlled value (digits only). */
6
+ value?: string;
7
+ defaultValue?: string;
8
+ onChange?: (value: string) => void;
9
+ /** Called once every cell holds a digit, with the full code. */
10
+ onComplete?: (code: string) => void;
11
+ /** Group name (fieldset legend). Default "Código de verificación". */
12
+ legend?: ReactNode;
13
+ /** Keeps the legend for screen readers only, when a visible heading already says it. */
14
+ hideLegend?: boolean;
15
+ hint?: ReactNode;
16
+ /** Error message: marks every cell invalid and is announced politely. */
17
+ error?: ReactNode;
18
+ disabled?: boolean;
19
+ /** Submits the joined code under this name (hidden input). */
20
+ name?: string;
21
+ /** Accessible name of each cell. Default "Dígito 1 de 6". */
22
+ digitLabel?: (position: number, length: number) => string;
23
+ id?: string;
24
+ className?: string;
25
+ }
26
+ /**
27
+ * One-time code entry as N single-digit cells in a fieldset. Paste (or the platform's
28
+ * one-time-code autofill) of the whole code fills every cell; arrows, Home/End and
29
+ * Backspace move between cells.
30
+ */
31
+ export declare function OtpInput({ length, value: valueProp, defaultValue, onChange, onComplete, legend, hideLegend, hint, error, disabled, name, digitLabel, id, className, }: OtpInputProps): import("react").JSX.Element;