@octavius2929-personal/design-system 0.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.
@@ -0,0 +1,512 @@
1
+ import * as react from 'react';
2
+ import { SVGProps, ReactElement, ButtonHTMLAttributes, HTMLAttributes, ReactNode, InputHTMLAttributes, TableHTMLAttributes } from 'react';
3
+
4
+ type SchemaName = "tinta";
5
+ type Mode = "light" | "dark" | "sepia" | "contrast";
6
+ declare const vars: {
7
+ color: {
8
+ bg1: `var(--${string})`;
9
+ bg2: `var(--${string})`;
10
+ bg3: `var(--${string})`;
11
+ bgInset: `var(--${string})`;
12
+ fg1: `var(--${string})`;
13
+ fg2: `var(--${string})`;
14
+ fg3: `var(--${string})`;
15
+ fgOnAccent: `var(--${string})`;
16
+ border1: `var(--${string})`;
17
+ border2: `var(--${string})`;
18
+ borderStrong: `var(--${string})`;
19
+ accent: `var(--${string})`;
20
+ accentHover: `var(--${string})`;
21
+ accentSoft: `var(--${string})`;
22
+ ok: `var(--${string})`;
23
+ warn: `var(--${string})`;
24
+ danger: `var(--${string})`;
25
+ info: `var(--${string})`;
26
+ scrim: `var(--${string})`;
27
+ };
28
+ font: {
29
+ readonly display: `var(--${string})`;
30
+ readonly text: `var(--${string})`;
31
+ readonly mono: `var(--${string})`;
32
+ readonly black: `var(--${string})`;
33
+ };
34
+ text: {
35
+ readonly eyebrow: {
36
+ readonly size: `var(--${string})`;
37
+ readonly lineHeight: `var(--${string})`;
38
+ readonly weight: `var(--${string})`;
39
+ readonly letterSpacing: `var(--${string})`;
40
+ };
41
+ readonly display: {
42
+ readonly size: `var(--${string})`;
43
+ readonly lineHeight: `var(--${string})`;
44
+ readonly weight: `var(--${string})`;
45
+ readonly letterSpacing: `var(--${string})`;
46
+ };
47
+ readonly h1: {
48
+ readonly size: `var(--${string})`;
49
+ readonly lineHeight: `var(--${string})`;
50
+ readonly weight: `var(--${string})`;
51
+ readonly letterSpacing: `var(--${string})`;
52
+ };
53
+ readonly h2: {
54
+ readonly size: `var(--${string})`;
55
+ readonly lineHeight: `var(--${string})`;
56
+ readonly weight: `var(--${string})`;
57
+ readonly letterSpacing: `var(--${string})`;
58
+ };
59
+ readonly h3: {
60
+ readonly size: `var(--${string})`;
61
+ readonly lineHeight: `var(--${string})`;
62
+ readonly weight: `var(--${string})`;
63
+ readonly letterSpacing: `var(--${string})`;
64
+ };
65
+ readonly h4: {
66
+ readonly size: `var(--${string})`;
67
+ readonly lineHeight: `var(--${string})`;
68
+ readonly weight: `var(--${string})`;
69
+ readonly letterSpacing: `var(--${string})`;
70
+ };
71
+ readonly body: {
72
+ readonly size: `var(--${string})`;
73
+ readonly lineHeight: `var(--${string})`;
74
+ readonly weight: `var(--${string})`;
75
+ readonly letterSpacing: `var(--${string})`;
76
+ };
77
+ readonly lead: {
78
+ readonly size: `var(--${string})`;
79
+ readonly lineHeight: `var(--${string})`;
80
+ readonly weight: `var(--${string})`;
81
+ readonly letterSpacing: `var(--${string})`;
82
+ };
83
+ readonly small: {
84
+ readonly size: `var(--${string})`;
85
+ readonly lineHeight: `var(--${string})`;
86
+ readonly weight: `var(--${string})`;
87
+ readonly letterSpacing: `var(--${string})`;
88
+ };
89
+ readonly caption: {
90
+ readonly size: `var(--${string})`;
91
+ readonly lineHeight: `var(--${string})`;
92
+ readonly weight: `var(--${string})`;
93
+ readonly letterSpacing: `var(--${string})`;
94
+ };
95
+ };
96
+ weight: {
97
+ readonly light: `var(--${string})`;
98
+ readonly regular: `var(--${string})`;
99
+ readonly medium: `var(--${string})`;
100
+ readonly semibold: `var(--${string})`;
101
+ readonly bold: `var(--${string})`;
102
+ };
103
+ space: {
104
+ readonly none: `var(--${string})`;
105
+ readonly xs: `var(--${string})`;
106
+ readonly sm: `var(--${string})`;
107
+ readonly md: `var(--${string})`;
108
+ readonly lg: `var(--${string})`;
109
+ readonly xl: `var(--${string})`;
110
+ readonly "2xl": `var(--${string})`;
111
+ readonly "3xl": `var(--${string})`;
112
+ readonly "4xl": `var(--${string})`;
113
+ readonly "5xl": `var(--${string})`;
114
+ };
115
+ radius: {
116
+ readonly none: `var(--${string})`;
117
+ readonly sm: `var(--${string})`;
118
+ readonly md: `var(--${string})`;
119
+ readonly lg: `var(--${string})`;
120
+ readonly base: `var(--${string})`;
121
+ readonly full: `var(--${string})`;
122
+ };
123
+ border: {
124
+ readonly hair: `var(--${string})`;
125
+ readonly rule: `var(--${string})`;
126
+ readonly heavy: `var(--${string})`;
127
+ };
128
+ tracking: {
129
+ readonly tight: `var(--${string})`;
130
+ readonly normal: `var(--${string})`;
131
+ readonly wide: `var(--${string})`;
132
+ readonly wider: `var(--${string})`;
133
+ readonly widest: `var(--${string})`;
134
+ };
135
+ leading: {
136
+ readonly tight: `var(--${string})`;
137
+ readonly snug: `var(--${string})`;
138
+ readonly normal: `var(--${string})`;
139
+ readonly relaxed: `var(--${string})`;
140
+ };
141
+ dur: {
142
+ readonly fast: `var(--${string})`;
143
+ readonly base: `var(--${string})`;
144
+ readonly slow: `var(--${string})`;
145
+ };
146
+ ease: {
147
+ readonly ink: `var(--${string})`;
148
+ };
149
+ shadow: {
150
+ readonly sm: `var(--${string})`;
151
+ readonly md: `var(--${string})`;
152
+ readonly lg: `var(--${string})`;
153
+ };
154
+ };
155
+ declare const themes: Record<SchemaName, Record<Mode, string>>;
156
+ declare const schemaNames: readonly SchemaName[];
157
+ declare const modeNames: readonly Mode[];
158
+
159
+ declare function useToggle(initial?: boolean): readonly [boolean, () => void, (value: boolean) => void];
160
+
161
+ interface IconProps extends SVGProps<SVGSVGElement> {
162
+ /** Lado del cuadro en px. Por defecto 20. */
163
+ size?: number;
164
+ /** Grosor de trazo. Por defecto 1.75. */
165
+ strokeWidth?: number;
166
+ }
167
+ type Icon = (props: IconProps) => ReactElement;
168
+
169
+ type ButtonVariant = "filled" | "outline" | "ghost";
170
+ type ButtonTone = "ink" | "accent";
171
+ type ButtonSize = "sm" | "md" | "lg";
172
+ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
173
+ variant?: ButtonVariant;
174
+ tone?: ButtonTone;
175
+ size?: ButtonSize;
176
+ startIcon?: Icon;
177
+ endIcon?: Icon;
178
+ full?: boolean;
179
+ }
180
+
181
+ declare function Button({ variant, tone, size, startIcon: StartIcon, endIcon: EndIcon, full, className, children, ...rest }: ButtonProps): react.JSX.Element;
182
+
183
+ interface DividerProps extends Omit<HTMLAttributes<HTMLDivElement>, "className"> {
184
+ vertical?: boolean;
185
+ label?: ReactNode;
186
+ }
187
+
188
+ declare function Divider({ vertical, label, ...rest }: DividerProps): react.JSX.Element;
189
+
190
+ type AvatarSize = "sm" | "md" | "lg";
191
+ interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
192
+ size?: AvatarSize;
193
+ filled?: boolean;
194
+ }
195
+
196
+ declare function Avatar({ size, filled, className, children, ...rest }: AvatarProps): react.JSX.Element;
197
+
198
+ type BadgeTone = "ink" | "accent";
199
+ interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
200
+ count?: number;
201
+ tone?: BadgeTone;
202
+ }
203
+
204
+ declare function Badge({ count, tone, className, children, ...rest }: BadgeProps): react.JSX.Element;
205
+
206
+ type ProgressVariant = "linear" | "circular";
207
+ interface ProgressProps extends HTMLAttributes<HTMLDivElement> {
208
+ variant?: ProgressVariant;
209
+ value?: number;
210
+ size?: number;
211
+ }
212
+
213
+ declare function Progress({ variant, value, size, className, ...rest }: ProgressProps): react.JSX.Element;
214
+
215
+ type ChipTone = "ink" | "accent";
216
+ interface ChipProps extends Omit<HTMLAttributes<HTMLSpanElement>, "className"> {
217
+ selected?: boolean;
218
+ tone?: ChipTone;
219
+ onDelete?: () => void;
220
+ }
221
+
222
+ declare function Chip({ selected, tone, onDelete, onClick, children, ...rest }: ChipProps): react.JSX.Element;
223
+
224
+ interface CheckboxProps {
225
+ checked?: boolean;
226
+ onChange?: (checked: boolean) => void;
227
+ label?: ReactNode;
228
+ disabled?: boolean;
229
+ id?: string;
230
+ }
231
+
232
+ declare function Checkbox({ checked, onChange, label, disabled, id, }: CheckboxProps): react.JSX.Element;
233
+
234
+ interface RadioProps {
235
+ checked?: boolean;
236
+ onChange?: () => void;
237
+ label?: ReactNode;
238
+ name?: string;
239
+ value?: string;
240
+ disabled?: boolean;
241
+ }
242
+
243
+ declare function Radio({ checked, onChange, label, name, value, disabled }: RadioProps): react.JSX.Element;
244
+
245
+ interface SwitchProps {
246
+ checked?: boolean;
247
+ onChange?: (checked: boolean) => void;
248
+ label?: ReactNode;
249
+ disabled?: boolean;
250
+ }
251
+
252
+ declare function Switch({ checked, onChange, label, disabled }: SwitchProps): react.JSX.Element;
253
+
254
+ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange"> {
255
+ label?: ReactNode;
256
+ help?: ReactNode;
257
+ error?: boolean;
258
+ startIcon?: Icon;
259
+ multiline?: boolean;
260
+ rows?: number;
261
+ onChange?: (value: string) => void;
262
+ }
263
+
264
+ declare function TextField({ label, help, error, startIcon: StartIcon, multiline, rows, type, onChange, className, id, ...rest }: TextFieldProps): react.JSX.Element;
265
+
266
+ type IconButtonTone = "ink" | "accent";
267
+ interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "className"> {
268
+ icon: Icon;
269
+ active?: boolean;
270
+ tone?: IconButtonTone;
271
+ title: string;
272
+ }
273
+
274
+ declare function IconButton({ icon: Icon, active, tone, title, ...rest }: IconButtonProps): react.JSX.Element;
275
+
276
+ type DivProps = Omit<HTMLAttributes<HTMLDivElement>, "className">;
277
+ type CardProps = DivProps;
278
+ type CardSectionProps = DivProps;
279
+
280
+ declare function CardRoot({ children, ...rest }: CardProps): react.JSX.Element;
281
+ declare namespace CardRoot {
282
+ var displayName: string;
283
+ }
284
+ declare function CardHeader({ children, ...rest }: CardSectionProps): react.JSX.Element;
285
+ declare namespace CardHeader {
286
+ var displayName: string;
287
+ }
288
+ declare function CardBody({ children, ...rest }: CardSectionProps): react.JSX.Element;
289
+ declare namespace CardBody {
290
+ var displayName: string;
291
+ }
292
+ declare function CardFooter({ children, ...rest }: CardSectionProps): react.JSX.Element;
293
+ declare namespace CardFooter {
294
+ var displayName: string;
295
+ }
296
+ declare const Card: typeof CardRoot & {
297
+ Header: typeof CardHeader;
298
+ Body: typeof CardBody;
299
+ Footer: typeof CardFooter;
300
+ };
301
+
302
+ type AlertSeverity = "info" | "ok" | "warn" | "danger";
303
+ interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
304
+ severity?: AlertSeverity;
305
+ title?: ReactNode;
306
+ icon?: Icon;
307
+ }
308
+
309
+ declare function Alert({ severity, title, icon, className, children, ...rest }: AlertProps): react.JSX.Element;
310
+
311
+ type TooltipPlacement = "top" | "bottom";
312
+ interface TooltipProps {
313
+ label: ReactNode;
314
+ children: ReactElement;
315
+ placement?: TooltipPlacement;
316
+ }
317
+
318
+ declare function Tooltip({ label, children, placement }: TooltipProps): react.JSX.Element;
319
+
320
+ interface SelectOption {
321
+ value: string;
322
+ label: ReactNode;
323
+ }
324
+ interface SelectProps {
325
+ options: SelectOption[];
326
+ value?: string;
327
+ onChange?: (value: string) => void;
328
+ placeholder?: ReactNode;
329
+ label?: ReactNode;
330
+ disabled?: boolean;
331
+ }
332
+
333
+ declare function Select({ options, value, onChange, placeholder, label, disabled }: SelectProps): react.JSX.Element;
334
+
335
+ interface SliderProps {
336
+ value?: number;
337
+ onChange?: (value: number) => void;
338
+ min?: number;
339
+ max?: number;
340
+ step?: number;
341
+ disabled?: boolean;
342
+ label?: string;
343
+ }
344
+
345
+ declare function Slider({ value, onChange, min, max, step, disabled, label, }: SliderProps): react.JSX.Element;
346
+
347
+ interface AccordionItem {
348
+ id: string;
349
+ title: ReactNode;
350
+ content: ReactNode;
351
+ }
352
+ interface AccordionProps {
353
+ items: AccordionItem[];
354
+ multiple?: boolean;
355
+ defaultOpen?: string[];
356
+ className?: string;
357
+ }
358
+
359
+ declare function Accordion({ items, multiple, defaultOpen, className, }: AccordionProps): react.JSX.Element;
360
+
361
+ interface Crumb {
362
+ label: ReactNode;
363
+ href?: string;
364
+ }
365
+ interface BreadcrumbsProps extends HTMLAttributes<HTMLElement> {
366
+ items: Crumb[];
367
+ }
368
+
369
+ declare function Breadcrumbs({ items, className, ...rest }: BreadcrumbsProps): react.JSX.Element;
370
+
371
+ interface PaginationProps {
372
+ count: number;
373
+ page?: number;
374
+ onChange?: (page: number) => void;
375
+ siblingCount?: number;
376
+ }
377
+
378
+ declare function Pagination({ count, page, onChange, siblingCount }: PaginationProps): react.JSX.Element;
379
+
380
+ interface Step {
381
+ label: ReactNode;
382
+ }
383
+ interface StepperProps extends HTMLAttributes<HTMLDivElement> {
384
+ steps: Step[];
385
+ active?: number;
386
+ }
387
+
388
+ declare function Stepper({ steps, active, className, ...rest }: StepperProps): react.JSX.Element;
389
+
390
+ interface TabItem {
391
+ value: string;
392
+ label: ReactNode;
393
+ }
394
+ interface TabsProps {
395
+ items: TabItem[];
396
+ value?: string;
397
+ onChange?: (value: string) => void;
398
+ }
399
+
400
+ declare function Tabs({ items, value, onChange }: TabsProps): react.JSX.Element;
401
+
402
+ interface MenuItemDef {
403
+ label: ReactNode;
404
+ onClick?: () => void;
405
+ danger?: boolean;
406
+ }
407
+ interface MenuProps {
408
+ trigger: ReactElement;
409
+ items: MenuItemDef[];
410
+ }
411
+
412
+ declare function Menu({ trigger, items }: MenuProps): react.JSX.Element;
413
+
414
+ interface DialogProps {
415
+ open: boolean;
416
+ onClose: () => void;
417
+ title?: ReactNode;
418
+ actions?: ReactNode;
419
+ children?: ReactNode;
420
+ }
421
+
422
+ declare function Dialog({ open, onClose, title, actions, children }: DialogProps): react.JSX.Element | null;
423
+
424
+ interface SnackbarProps {
425
+ open: boolean;
426
+ message: ReactNode;
427
+ action?: ReactNode;
428
+ onClose?: () => void;
429
+ }
430
+
431
+ declare function Snackbar({ open, message, action, onClose }: SnackbarProps): react.JSX.Element | null;
432
+
433
+ interface TableColumn<Row> {
434
+ key: string;
435
+ header: ReactNode;
436
+ render?: (row: Row) => ReactNode;
437
+ align?: "left" | "right";
438
+ }
439
+ interface TableProps<Row extends Record<string, unknown>> extends TableHTMLAttributes<HTMLTableElement> {
440
+ columns: TableColumn<Row>[];
441
+ rows: Row[];
442
+ getRowKey?: (row: Row, index: number) => string | number;
443
+ }
444
+
445
+ declare function Table<Row extends Record<string, unknown>>({ columns, rows, getRowKey, className, ...rest }: TableProps<Row>): react.JSX.Element;
446
+
447
+ interface AppBarProps extends HTMLAttributes<HTMLElement> {
448
+ brand?: ReactNode;
449
+ actions?: ReactNode;
450
+ }
451
+
452
+ declare function AppBar({ brand, actions, className, children, ...rest }: AppBarProps): react.JSX.Element;
453
+
454
+ interface ListItemProps extends HTMLAttributes<HTMLDivElement> {
455
+ leading?: ReactNode;
456
+ trailing?: ReactNode;
457
+ selected?: boolean;
458
+ }
459
+
460
+ declare function ListItem({ leading, trailing, selected, className, children, ...rest }: ListItemProps): react.JSX.Element;
461
+
462
+ declare function ChevronDownIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
463
+
464
+ declare function ChevronUpIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
465
+
466
+ declare function ChevronLeftIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
467
+
468
+ declare function ChevronRightIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
469
+
470
+ declare function CheckIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
471
+
472
+ declare function XIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
473
+
474
+ declare function EyeIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
475
+
476
+ declare function EyeOffIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
477
+
478
+ declare function SearchIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
479
+
480
+ declare function InfoIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
481
+
482
+ declare function CircleCheckIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
483
+
484
+ declare function TriangleAlertIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
485
+
486
+ declare function CircleXIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
487
+
488
+ declare function PlusIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
489
+
490
+ declare function MinusIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
491
+
492
+ declare function MoreHorizontalIcon({ size, strokeWidth, ...rest }: IconProps): react.JSX.Element;
493
+
494
+ declare const text: Record<"display" | "eyebrow" | "h1" | "h2" | "h3" | "h4" | "body" | "lead" | "small" | "caption" | "code" | "blackletter", string>;
495
+
496
+ interface ThemeContextValue {
497
+ schema: SchemaName;
498
+ mode: Mode;
499
+ themeClass: string;
500
+ setSchema: (schema: SchemaName) => void;
501
+ setMode: (mode: Mode) => void;
502
+ toggleMode: () => void;
503
+ }
504
+ interface ThemeProviderProps {
505
+ children: ReactNode;
506
+ defaultSchema?: SchemaName;
507
+ defaultMode?: Mode;
508
+ }
509
+ declare function ThemeProvider({ children, defaultSchema, defaultMode, }: ThemeProviderProps): react.JSX.Element;
510
+ declare function useTheme(): ThemeContextValue;
511
+
512
+ export { Accordion, type AccordionItem, type AccordionProps, Alert, type AlertProps, type AlertSeverity, AppBar, type AppBarProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, type ButtonSize, type ButtonTone, type ButtonVariant, Card, type CardProps, type CardSectionProps, CheckIcon, Checkbox, type CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, Chip, type ChipProps, type ChipTone, CircleCheckIcon, CircleXIcon, type Crumb, Dialog, type DialogProps, Divider, type DividerProps, EyeIcon, EyeOffIcon, type Icon, IconButton, type IconButtonProps, type IconButtonTone, type IconProps, InfoIcon, ListItem, type ListItemProps, Menu, type MenuItemDef, type MenuProps, MinusIcon, type Mode, MoreHorizontalIcon, Pagination, type PaginationProps, PlusIcon, Progress, type ProgressProps, type ProgressVariant, Radio, type RadioProps, type SchemaName, SearchIcon, Select, type SelectOption, type SelectProps, Slider, type SliderProps, Snackbar, type SnackbarProps, type Step, Stepper, type StepperProps, Switch, type SwitchProps, type TabItem, Table, type TableColumn, type TableProps, Tabs, type TabsProps, TextField, type TextFieldProps, ThemeProvider, type ThemeProviderProps, Tooltip, type TooltipPlacement, type TooltipProps, TriangleAlertIcon, XIcon, modeNames, schemaNames, text, vars as theme, themes, useTheme, useToggle };