@foi/design-system 0.0.0 → 0.0.2
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/dist/components/atoms/Button/Button.d.ts +10 -0
- package/dist/components/atoms/Button/Button.emotion.d.ts +2 -0
- package/dist/components/atoms/Button/Button.interface.d.ts +29 -0
- package/dist/components/atoms/Button/index.d.ts +3 -0
- package/dist/components/atoms/Checkbox/Checkbox.d.ts +7 -0
- package/dist/components/atoms/Checkbox/Checkbox.emotion.d.ts +2 -0
- package/dist/components/atoms/Checkbox/Checkbox.interface.d.ts +64 -0
- package/dist/components/atoms/Checkbox/index.d.ts +4 -0
- package/dist/components/atoms/DatePicker/DatePicker.d.ts +17 -0
- package/dist/components/atoms/DatePicker/DatePicker.emotion.d.ts +2 -0
- package/dist/components/atoms/DatePicker/DatePicker.interface.d.ts +105 -0
- package/dist/components/atoms/DatePicker/DatePicker.utils.d.ts +50 -0
- package/dist/components/atoms/DatePicker/DatePickerMenu/DatePickerMenu.d.ts +14 -0
- package/dist/components/atoms/DatePicker/DatePickerMenu/DatePickerMenu.emotion.d.ts +2 -0
- package/dist/components/atoms/DatePicker/DatePickerMenu/DatePickerMenu.interface.d.ts +46 -0
- package/dist/components/atoms/DatePicker/DatePickerMenu/index.d.ts +4 -0
- package/dist/components/atoms/DatePicker/index.d.ts +4 -0
- package/dist/components/atoms/IconButton/IconButton.d.ts +9 -0
- package/dist/components/atoms/IconButton/IconButton.emotion.d.ts +2 -0
- package/dist/components/atoms/IconButton/IconButton.interface.d.ts +21 -0
- package/dist/components/atoms/IconButton/index.d.ts +3 -0
- package/dist/components/atoms/Input/Input.d.ts +11 -0
- package/dist/components/atoms/Input/Input.emotion.d.ts +2 -0
- package/dist/components/atoms/Input/Input.interface.d.ts +55 -0
- package/dist/components/atoms/Input/index.d.ts +4 -0
- package/dist/components/atoms/Radio/Radio.d.ts +12 -0
- package/dist/components/atoms/Radio/Radio.emotion.d.ts +2 -0
- package/dist/components/atoms/Radio/Radio.interface.d.ts +51 -0
- package/dist/components/atoms/Radio/RadioGroup.context.d.ts +15 -0
- package/dist/components/atoms/Radio/index.d.ts +3 -0
- package/dist/components/atoms/Select/Select.d.ts +11 -0
- package/dist/components/atoms/Select/Select.emotion.d.ts +2 -0
- package/dist/components/atoms/Select/Select.interface.d.ts +55 -0
- package/dist/components/atoms/Select/SelectMenu/SelectMenu.d.ts +9 -0
- package/dist/components/atoms/Select/SelectMenu/SelectMenu.emotion.d.ts +2 -0
- package/dist/components/atoms/Select/SelectMenu/SelectMenu.interface.d.ts +33 -0
- package/dist/components/atoms/Select/SelectMenu/index.d.ts +4 -0
- package/dist/components/atoms/Select/index.d.ts +4 -0
- package/dist/components/atoms/Slider/Slider.d.ts +13 -0
- package/dist/components/atoms/Slider/Slider.emotion.d.ts +2 -0
- package/dist/components/atoms/Slider/Slider.interface.d.ts +59 -0
- package/dist/components/atoms/Slider/index.d.ts +4 -0
- package/dist/components/atoms/Switch/Switch.d.ts +11 -0
- package/dist/components/atoms/Switch/Switch.emotion.d.ts +2 -0
- package/dist/components/atoms/Switch/Switch.interface.d.ts +27 -0
- package/dist/components/atoms/Switch/index.d.ts +4 -0
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.context.d.ts +13 -0
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +23 -0
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.emotion.d.ts +2 -0
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.interface.d.ts +38 -0
- package/dist/components/molecules/CheckboxGroup/index.d.ts +4 -0
- package/dist/components/molecules/CheckboxTree/CheckboxTree.context.d.ts +13 -0
- package/dist/components/molecules/CheckboxTree/CheckboxTree.d.ts +23 -0
- package/dist/components/molecules/CheckboxTree/CheckboxTree.emotion.d.ts +2 -0
- package/dist/components/molecules/CheckboxTree/CheckboxTree.interface.d.ts +42 -0
- package/dist/components/molecules/CheckboxTree/index.d.ts +4 -0
- package/dist/components/molecules/RadioGroup/RadioGroup.d.ts +19 -0
- package/dist/components/molecules/RadioGroup/RadioGroup.emotion.d.ts +2 -0
- package/dist/components/molecules/RadioGroup/RadioGroup.interface.d.ts +38 -0
- package/dist/components/molecules/RadioGroup/index.d.ts +4 -0
- package/dist/hocs/MarginPage/index.d.ts +6 -0
- package/dist/hocs/OutsideEvent/index.d.ts +7 -0
- package/dist/hocs/ScrollToTop/index.d.ts +2 -0
- package/dist/hocs/ThemeProvider/ThemeProvider.d.ts +4 -0
- package/dist/hocs/ThemeProvider/ThemeProvider.interface.d.ts +29 -0
- package/dist/hocs/ThemeProvider/components/Button.d.ts +36 -0
- package/dist/hocs/ThemeProvider/components/Checkbox.d.ts +60 -0
- package/dist/hocs/ThemeProvider/components/CheckboxGroup.d.ts +20 -0
- package/dist/hocs/ThemeProvider/components/CheckboxTree.d.ts +20 -0
- package/dist/hocs/ThemeProvider/components/DatePicker.d.ts +60 -0
- package/dist/hocs/ThemeProvider/components/DatePickerMenu.d.ts +36 -0
- package/dist/hocs/ThemeProvider/components/IconButton.d.ts +36 -0
- package/dist/hocs/ThemeProvider/components/Input.d.ts +60 -0
- package/dist/hocs/ThemeProvider/components/Radio.d.ts +60 -0
- package/dist/hocs/ThemeProvider/components/RadioGroup.d.ts +20 -0
- package/dist/hocs/ThemeProvider/components/Select.d.ts +60 -0
- package/dist/hocs/ThemeProvider/components/SelectMenu.d.ts +32 -0
- package/dist/hocs/ThemeProvider/components/Slider.d.ts +36 -0
- package/dist/hocs/ThemeProvider/components/Switch.d.ts +40 -0
- package/dist/hocs/ThemeProvider/components/index.d.ts +13 -0
- package/dist/hocs/ThemeProvider/createComponentStyles.d.ts +2 -0
- package/dist/hocs/ThemeProvider/fonts/index.d.ts +6 -0
- package/dist/hocs/ThemeProvider/index.d.ts +1 -0
- package/dist/hocs/ThemeProvider/interfaces/Components.interface.d.ts +16 -0
- package/dist/hocs/ThemeProvider/interfaces/Events.interface.d.ts +16 -0
- package/dist/hocs/ThemeProvider/interfaces/Styles.interface.d.ts +54 -0
- package/dist/hocs/ThemeProvider/interfaces/Typography.interface.d.ts +10 -0
- package/dist/hocs/ThemeProvider/interfaces/index.d.ts +4 -0
- package/dist/hocs/ThemeProvider/useThemeProvider.hook.d.ts +10 -0
- package/dist/hocs/ThemeProvider/useThemeProvider.store.d.ts +2 -0
- package/dist/hooks/useOnClickOutside.d.ts +10 -0
- package/dist/hooks/useStateCallback.d.ts +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.mjs +2728 -3254
- package/dist/index.mjs.map +1 -1
- package/dist/interfaces/Option.d.ts +10 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/theme/dark/colors.d.ts +31 -0
- package/dist/theme/dark/components/Button.d.ts +35 -0
- package/dist/theme/dark/components/Checkbox.d.ts +64 -0
- package/dist/theme/dark/components/CheckboxGroup.d.ts +18 -0
- package/dist/theme/dark/components/CheckboxTree.d.ts +17 -0
- package/dist/theme/dark/components/DatePicker.d.ts +58 -0
- package/dist/theme/dark/components/DatePickerMenu.d.ts +31 -0
- package/dist/theme/dark/components/IconButton.d.ts +30 -0
- package/dist/theme/dark/components/Input.d.ts +58 -0
- package/dist/theme/dark/components/Radio.d.ts +61 -0
- package/dist/theme/dark/components/RadioGroup.d.ts +18 -0
- package/dist/theme/dark/components/Select.d.ts +58 -0
- package/dist/theme/dark/components/SelectMenu.d.ts +30 -0
- package/dist/theme/dark/components/Slider.d.ts +46 -0
- package/dist/theme/dark/components/Switch.d.ts +55 -0
- package/dist/theme/dark/components/index.d.ts +540 -0
- package/dist/theme/dark/fonts.d.ts +6 -0
- package/dist/theme/dark/index.d.ts +547 -0
- package/dist/theme/index.d.ts +549 -0
- package/dist/utilities/emotion/styles.d.ts +2 -0
- package/package.json +81 -81
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ButtonProps } from './Button.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Buttons communicate actions that users can take. Place them in dialogs, forms, cards,
|
|
4
|
+
* and toolbars.
|
|
5
|
+
*
|
|
6
|
+
* Supports optional leading/trailing icons and a `loading` state that visually signals
|
|
7
|
+
* a pending operation.
|
|
8
|
+
*/
|
|
9
|
+
declare const Button: ({ className, style, children, type, loading, iconStart, iconEnd, ...rest }: ButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default Button;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { type ReactNode, type JSX } from 'react';
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/Input';
|
|
3
|
+
export interface ButtonStyleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
/** Content rendered inside the button. Can be a string, element, or any React node.
|
|
5
|
+
* @default 'Click me!'
|
|
6
|
+
*/
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Icon rendered **before** the label text. */
|
|
9
|
+
iconStart?: JSX.Element;
|
|
10
|
+
/** Icon rendered **after** the label text. */
|
|
11
|
+
iconEnd?: JSX.Element;
|
|
12
|
+
/** When `true`, renders a loading indicator and signals a pending state.
|
|
13
|
+
* The button remains interactive; disable it separately if needed.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
/** HTML button type attribute.
|
|
18
|
+
* @default 'button'
|
|
19
|
+
*/
|
|
20
|
+
type?: 'button' | 'submit';
|
|
21
|
+
/** Additional CSS class applied to the root element. */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** Theme override tokens. Pass a partial `EVENTS` object to customise colours. */
|
|
24
|
+
theme?: EVENTS;
|
|
25
|
+
}
|
|
26
|
+
export interface ButtonProps extends ButtonStyleProps {
|
|
27
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
28
|
+
style: Record<string, string>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CheckboxProps, CheckboxBaseProps } from './Checkbox.interface';
|
|
3
|
+
import { type FieldValues } from 'react-hook-form';
|
|
4
|
+
/** @internal Headless presentational layer shared by all checkbox variants. */
|
|
5
|
+
export declare const CheckboxBase: React.ForwardRefExoticComponent<CheckboxBaseProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
|
+
declare const Checkbox: <TFieldValues extends FieldValues = FieldValues>(props: CheckboxProps<TFieldValues>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default Checkbox;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/Checkbox';
|
|
3
|
+
import type { Control, FieldValues } from 'react-hook-form';
|
|
4
|
+
/** Internal props used by CheckboxBase — the headless presentational layer. */
|
|
5
|
+
export interface CheckboxBaseProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'checked' | 'style'> {
|
|
6
|
+
/** Text label displayed next to the checkbox. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Icon rendered inside the checkbox when it is checked.
|
|
9
|
+
* @default `<CheckOutlinedIcon />`
|
|
10
|
+
*/
|
|
11
|
+
icon?: JSX.Element;
|
|
12
|
+
/** Helper text shown below the checkbox when there is no error. */
|
|
13
|
+
helperText?: string;
|
|
14
|
+
/** When `false`, the error message is suppressed even if validation fails.
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
showErrorText?: boolean;
|
|
18
|
+
/** Additional CSS class applied to the root element. */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
21
|
+
style?: Record<string, string>;
|
|
22
|
+
/** Whether the checkbox is currently checked. */
|
|
23
|
+
checked: boolean;
|
|
24
|
+
/** Callback fired when the checked state changes. Receives the new boolean value. */
|
|
25
|
+
onChecked: (checked: boolean) => void;
|
|
26
|
+
/** Validation error object from React Hook Form. */
|
|
27
|
+
error?: {
|
|
28
|
+
message?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface CheckboxStyleProps<TFieldValues extends FieldValues = FieldValues> extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
32
|
+
/** RHF field name. Required in standalone mode; optional (ignored) inside CheckboxGroup. */
|
|
33
|
+
name?: string;
|
|
34
|
+
/** Text label displayed next to the checkbox. */
|
|
35
|
+
label?: string;
|
|
36
|
+
/** RHF control object. Required in standalone mode; omit when inside CheckboxGroup. */
|
|
37
|
+
control?: Control<TFieldValues>;
|
|
38
|
+
/** Prevents all interaction when `true`.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/** Icon rendered inside the checkbox when it is checked.
|
|
43
|
+
* @default `<CheckOutlinedIcon />`
|
|
44
|
+
*/
|
|
45
|
+
icon?: JSX.Element;
|
|
46
|
+
/** When `false`, the error message below the checkbox is hidden even if validation fails.
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
showErrorText?: boolean;
|
|
50
|
+
/** Helper text displayed below the checkbox when there is no active error. */
|
|
51
|
+
helperText?: string;
|
|
52
|
+
/** Additional CSS class applied to the root element. */
|
|
53
|
+
className?: string;
|
|
54
|
+
/** Theme override tokens. Pass a partial `EVENTS` object to customise colours. */
|
|
55
|
+
theme?: EVENTS;
|
|
56
|
+
/** Controlled mode — callback fired when the checked state changes.
|
|
57
|
+
* Use this prop together with the `checked` attribute instead of RHF `control`.
|
|
58
|
+
*/
|
|
59
|
+
onChecked?: (checked: boolean) => void;
|
|
60
|
+
}
|
|
61
|
+
export interface CheckboxProps<TFieldValues extends FieldValues = FieldValues> extends CheckboxStyleProps<TFieldValues> {
|
|
62
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
63
|
+
style: Record<string, string>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CheckboxStyleProps } from './Checkbox.interface';
|
|
2
|
+
import type { FieldValues } from 'react-hook-form';
|
|
3
|
+
declare const Checkbox: <TFieldValues extends FieldValues = FieldValues>({ theme, ...rest }: CheckboxStyleProps<TFieldValues>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default Checkbox;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DatePickerProps } from './DatePicker.interface';
|
|
2
|
+
import { type FieldValues } from 'react-hook-form';
|
|
3
|
+
/**
|
|
4
|
+
* A date input field with a pop-up calendar for selecting dates.
|
|
5
|
+
*
|
|
6
|
+
* Renders three spinbutton spans (month/day or day/month, and year) that
|
|
7
|
+
* support Tab navigation and direct numeric entry. The calendar popup supports
|
|
8
|
+
* full keyboard navigation (arrows to move focus, Enter to select, Tab to close).
|
|
9
|
+
*
|
|
10
|
+
* Language controls both the date format and the calendar labels:
|
|
11
|
+
* - `en` → `MM / DD / YYYY`, Sunday-first calendar
|
|
12
|
+
* - `es` → `DD / MM / YYYY`, Monday-first calendar
|
|
13
|
+
*
|
|
14
|
+
* The form value is a `Date` object.
|
|
15
|
+
*/
|
|
16
|
+
declare const DatePicker: <TFieldValues extends FieldValues = FieldValues>({ name, label, control, language, minDate, maxDate, disabled, disableFuture, disablePast, hasStaticOptions, showErrorText, hasPadding, helperText, style, className, }: DatePickerProps<TFieldValues>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default DatePicker;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { Control, FieldValues } from 'react-hook-form';
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/DatePicker';
|
|
3
|
+
export interface DatePickerStyleProps<TFieldValues extends FieldValues = FieldValues> {
|
|
4
|
+
/** RHF field name. The form value will be a `Date`. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Floating label displayed inside the field border. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** RHF control object. */
|
|
9
|
+
control: Control<TFieldValues>;
|
|
10
|
+
/** Display language. Controls date format (`MM/DD/YYYY` for `en`, `DD/MM/YYYY` for `es`)
|
|
11
|
+
* and month/weekday labels. Defaults to the browser locale.
|
|
12
|
+
*/
|
|
13
|
+
language?: 'es' | 'en';
|
|
14
|
+
/** Earliest selectable date (inclusive). */
|
|
15
|
+
minDate?: Date;
|
|
16
|
+
/** Latest selectable date (inclusive). */
|
|
17
|
+
maxDate?: Date;
|
|
18
|
+
/** Prevents all interaction when `true`.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Disables every date after today.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
disableFuture?: boolean;
|
|
26
|
+
/** Disables every date before today.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
disablePast?: boolean;
|
|
30
|
+
/** When `true`, the calendar renders in the document flow instead of floating above other content.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
hasStaticOptions?: boolean;
|
|
34
|
+
/** When `false`, validation error text below the field is hidden.
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
showErrorText?: boolean;
|
|
38
|
+
/** When `true`, adds bottom padding below the helper text area.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
hasPadding?: boolean;
|
|
42
|
+
/** Helper text displayed below the field when there is no active error. */
|
|
43
|
+
helperText?: string;
|
|
44
|
+
/** Additional CSS class applied to the root element. */
|
|
45
|
+
className?: string;
|
|
46
|
+
/** Theme override tokens. Pass a partial `EVENTS` object to customise colours. */
|
|
47
|
+
theme?: EVENTS;
|
|
48
|
+
}
|
|
49
|
+
export interface DatePickerProps<TFieldValues extends FieldValues = FieldValues> extends DatePickerStyleProps<TFieldValues> {
|
|
50
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
51
|
+
style: Record<string, string>;
|
|
52
|
+
}
|
|
53
|
+
/** A single calendar day cell as produced by `getWeeksForMonth`. */
|
|
54
|
+
export interface DateCell {
|
|
55
|
+
label: string;
|
|
56
|
+
value: string;
|
|
57
|
+
isDate: boolean;
|
|
58
|
+
isDisabled?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export declare enum DaysEnProps {
|
|
61
|
+
Mo = "Mo",
|
|
62
|
+
Tu = "Tu",
|
|
63
|
+
We = "We",
|
|
64
|
+
Th = "Th",
|
|
65
|
+
Fr = "Fr",
|
|
66
|
+
Sa = "Sa",
|
|
67
|
+
Su = "Su"
|
|
68
|
+
}
|
|
69
|
+
export declare enum DaysEsProps {
|
|
70
|
+
Lu = "Lu",
|
|
71
|
+
Ma = "Ma",
|
|
72
|
+
Mi = "Mi",
|
|
73
|
+
Ju = "Ju",
|
|
74
|
+
Vi = "Vi",
|
|
75
|
+
Sa = "S\u00E1",
|
|
76
|
+
Do = "Do"
|
|
77
|
+
}
|
|
78
|
+
export declare enum MonthsEnProps {
|
|
79
|
+
January = "January",
|
|
80
|
+
February = "February",
|
|
81
|
+
March = "March",
|
|
82
|
+
April = "April",
|
|
83
|
+
May = "May",
|
|
84
|
+
June = "June",
|
|
85
|
+
July = "July",
|
|
86
|
+
August = "August",
|
|
87
|
+
September = "September",
|
|
88
|
+
October = "October",
|
|
89
|
+
November = "November",
|
|
90
|
+
December = "December"
|
|
91
|
+
}
|
|
92
|
+
export declare enum MonthsEsProps {
|
|
93
|
+
Enero = "Enero",
|
|
94
|
+
Febrero = "Febrero",
|
|
95
|
+
Marzo = "Marzo",
|
|
96
|
+
Abril = "Abril",
|
|
97
|
+
Mayo = "Mayo",
|
|
98
|
+
Junio = "Junio",
|
|
99
|
+
Julio = "Julio",
|
|
100
|
+
Agosto = "Agosto",
|
|
101
|
+
Septiembre = "Septiembre",
|
|
102
|
+
Octubre = "Octubre",
|
|
103
|
+
Noviembre = "Noviembre",
|
|
104
|
+
Diciembre = "Diciembre"
|
|
105
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type DateCell, DaysEnProps, MonthsEnProps } from './DatePicker.interface';
|
|
2
|
+
export declare const datePickerConfig: {
|
|
3
|
+
es: {
|
|
4
|
+
daysOfWeek: DaysEnProps[];
|
|
5
|
+
endOfWeek: string;
|
|
6
|
+
format: string;
|
|
7
|
+
};
|
|
8
|
+
en: {
|
|
9
|
+
daysOfWeek: DaysEnProps[];
|
|
10
|
+
endOfWeek: string;
|
|
11
|
+
format: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const daysDictionary: Record<'en' | 'es', Record<DaysEnProps, string>>;
|
|
15
|
+
export declare const monthsDictionary: Record<'en' | 'es', Record<MonthsEnProps, string>>;
|
|
16
|
+
export declare const isDateValid: (date: unknown) => boolean;
|
|
17
|
+
export declare const isDateOutOfRange: (date: Date, options: {
|
|
18
|
+
minDate?: Date;
|
|
19
|
+
maxDate?: Date;
|
|
20
|
+
disableFuture?: boolean;
|
|
21
|
+
disablePast?: boolean;
|
|
22
|
+
today: Date;
|
|
23
|
+
}) => boolean;
|
|
24
|
+
export declare const getWeeksForMonth: (baseDate: Date, format: string, language: "en" | "es", options: {
|
|
25
|
+
minDate?: Date;
|
|
26
|
+
maxDate?: Date;
|
|
27
|
+
disableFuture?: boolean;
|
|
28
|
+
disablePast?: boolean;
|
|
29
|
+
today: Date;
|
|
30
|
+
}) => DateCell[][];
|
|
31
|
+
export declare const getYearsGrid: (format: string, startYear?: number, count?: number, rowSize?: number) => DateCell[][];
|
|
32
|
+
export declare const isPrevMonthDisabled: (date: Date, options: {
|
|
33
|
+
minDate?: Date;
|
|
34
|
+
disablePast?: boolean;
|
|
35
|
+
today: Date;
|
|
36
|
+
format: string;
|
|
37
|
+
}) => boolean;
|
|
38
|
+
export declare const isNextMonthDisabled: (date: Date, options: {
|
|
39
|
+
maxDate?: Date;
|
|
40
|
+
disableFuture?: boolean;
|
|
41
|
+
today: Date;
|
|
42
|
+
format: string;
|
|
43
|
+
}) => boolean;
|
|
44
|
+
export declare const splitDateParts: (date: Date) => {
|
|
45
|
+
day: string;
|
|
46
|
+
month: string;
|
|
47
|
+
year: string;
|
|
48
|
+
};
|
|
49
|
+
export declare const getBrowserLang: () => "es" | "en";
|
|
50
|
+
export declare const formatMonthLabel: (date: Date, language: "en" | "es") => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DatePickerMenuProps } from './DatePickerMenu.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Calendar popup for `DatePicker`.
|
|
5
|
+
*
|
|
6
|
+
* Displays a monthly grid with weekday headers, month/year navigation, and a
|
|
7
|
+
* scrollable year-picker. Keyboard navigation (arrow keys, Enter, Escape) is
|
|
8
|
+
* handled by the parent `DatePicker`; this component focuses the active day
|
|
9
|
+
* button when `focusedElement` changes.
|
|
10
|
+
*
|
|
11
|
+
* @internal — rendered exclusively by `DatePicker`. Do not use directly.
|
|
12
|
+
*/
|
|
13
|
+
declare const DatePickerMenu: React.ForwardRefExoticComponent<DatePickerMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export default DatePickerMenu;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DateCell } from '../DatePicker.interface';
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/DatePickerMenu';
|
|
3
|
+
export interface DatePickerMenuStyleProps {
|
|
4
|
+
/** Whether the calendar popup is visible. */
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
/** When `true`, the popup renders in the document flow instead of floating. */
|
|
7
|
+
hasStaticOptions?: boolean;
|
|
8
|
+
/** Display language for month/weekday labels. */
|
|
9
|
+
language?: 'es' | 'en';
|
|
10
|
+
/** Test id prefix. */
|
|
11
|
+
testId?: string;
|
|
12
|
+
/** Localised month name to display in the header. */
|
|
13
|
+
monthLabel?: string;
|
|
14
|
+
/** Year string (e.g. "2024") to display in the header. */
|
|
15
|
+
yearLabel?: string;
|
|
16
|
+
onPrevMonth: () => void;
|
|
17
|
+
onNextMonth: () => void;
|
|
18
|
+
/** Disables the "previous month" arrow when the earliest selectable month is reached. */
|
|
19
|
+
disablePrev?: boolean;
|
|
20
|
+
/** Disables the "next month" arrow when the latest selectable month is reached. */
|
|
21
|
+
disableNext?: boolean;
|
|
22
|
+
/** Week rows for the currently displayed month. Each row is 7 `DateCell` items. */
|
|
23
|
+
weeks?: DateCell[][];
|
|
24
|
+
/** Year rows for the year-picker grid. */
|
|
25
|
+
years?: DateCell[][];
|
|
26
|
+
/** Short weekday labels ordered for the current language (Mon–Sun or Sun–Sat). */
|
|
27
|
+
daysOfWeek?: string[];
|
|
28
|
+
/** Currently selected `Date` value (used to highlight the selected day). */
|
|
29
|
+
selectedValue?: Date;
|
|
30
|
+
/** date-fns format string matching the cells' `value` strings. */
|
|
31
|
+
format?: string;
|
|
32
|
+
/** Today's date — used to render the "today" dot indicator. */
|
|
33
|
+
today?: Date;
|
|
34
|
+
/** Index into the flattened `weeks` array that currently has keyboard focus. */
|
|
35
|
+
focusedElement?: number;
|
|
36
|
+
onSelectDay?: (value: string, viaKeyboard?: boolean) => void;
|
|
37
|
+
onSelectYear?: (value: string) => void;
|
|
38
|
+
onMoveFocus?: (key: string) => void;
|
|
39
|
+
onClose?: () => void;
|
|
40
|
+
/** Theme override tokens for the menu popup. */
|
|
41
|
+
theme?: EVENTS;
|
|
42
|
+
}
|
|
43
|
+
export interface DatePickerMenuProps extends DatePickerMenuStyleProps {
|
|
44
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
45
|
+
style: Record<string, string>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DatePickerStyleProps } from './DatePicker.interface';
|
|
2
|
+
import type { FieldValues } from 'react-hook-form';
|
|
3
|
+
declare const DatePicker: <TFieldValues extends FieldValues = FieldValues>({ theme, ...rest }: DatePickerStyleProps<TFieldValues>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default DatePicker;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IconButtonProps } from './IconButton.interface';
|
|
2
|
+
/**
|
|
3
|
+
* A compact, circular button that renders a single icon.
|
|
4
|
+
* Use it for secondary or contextual actions where label text is unnecessary (e.g. close, edit, delete).
|
|
5
|
+
*
|
|
6
|
+
* Pass `isFlipped` to mirror the icon horizontally — useful for directional icons.
|
|
7
|
+
*/
|
|
8
|
+
declare const IconButton: ({ className, style, icon, onClick, isFlipped, ...rest }: IconButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default IconButton;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/Input';
|
|
3
|
+
export interface IconButtonStyleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
/** The icon element rendered inside the button. */
|
|
5
|
+
icon: JSX.Element;
|
|
6
|
+
/** Click handler. Required — IconButton is always interactive. */
|
|
7
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
8
|
+
/** When `true`, horizontally mirrors the icon via a CSS transform.
|
|
9
|
+
* Useful for directional icons (e.g. an arrow that should point left).
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
isFlipped?: boolean;
|
|
13
|
+
/** Additional CSS class applied to the root element. */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Theme override tokens. Pass a partial `EVENTS` object to customise colours. */
|
|
16
|
+
theme?: EVENTS;
|
|
17
|
+
}
|
|
18
|
+
export interface IconButtonProps extends IconButtonStyleProps {
|
|
19
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
20
|
+
style: Record<string, string>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InputProps } from './Input.interface';
|
|
2
|
+
import { type FieldValues } from 'react-hook-form';
|
|
3
|
+
/**
|
|
4
|
+
* A text input field that lets users enter and edit a single line of text.
|
|
5
|
+
*
|
|
6
|
+
* Supports floating labels, helper/error text, leading and trailing adornments,
|
|
7
|
+
* optional value formatting, and input filtering via `regex`.
|
|
8
|
+
* The form value is a `string`.
|
|
9
|
+
*/
|
|
10
|
+
declare const Input: <TFieldValues extends FieldValues = FieldValues>({ name, label, control, width, disabled, type, regex, hasPadding, format, startAdornment, endAdornment, helperText, showErrorText, style, className, ...rest }: InputProps<TFieldValues>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default Input;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/Input';
|
|
3
|
+
import type { Control, FieldValues } from 'react-hook-form';
|
|
4
|
+
export interface InputStyleProps<TFieldValues extends FieldValues = FieldValues> extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
5
|
+
/** RHF field name. The form value will be a `string`. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Floating label displayed inside the field border. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** RHF control object. */
|
|
10
|
+
control: Control<TFieldValues>;
|
|
11
|
+
/** Prevents all interaction when `true`.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Short hint shown inside the field before the user enters a value. */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** Controls the rendered width of the field.
|
|
18
|
+
* @default 'medium'
|
|
19
|
+
*/
|
|
20
|
+
width?: 'small' | 'medium' | 'large' | 'full';
|
|
21
|
+
/** HTML input type. Use `'password'` to mask the value.
|
|
22
|
+
* @default 'text'
|
|
23
|
+
*/
|
|
24
|
+
type?: 'text' | 'password' | 'number' | 'email';
|
|
25
|
+
/** When provided, each keystroke is validated against this regex.
|
|
26
|
+
* Characters that do not match are silently ignored.
|
|
27
|
+
*/
|
|
28
|
+
regex?: RegExp;
|
|
29
|
+
/** When `false`, validation error text below the field is hidden.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
showErrorText?: boolean;
|
|
33
|
+
/** When `true`, adds bottom padding below the helper text area.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
hasPadding?: boolean;
|
|
37
|
+
/** A function applied to the value on every keystroke before it is stored.
|
|
38
|
+
* Receives the raw string and must return the formatted string.
|
|
39
|
+
*/
|
|
40
|
+
format?: (value: string) => string;
|
|
41
|
+
/** Element rendered on the **left** side of the input (e.g. an icon or a currency symbol). */
|
|
42
|
+
startAdornment?: JSX.Element;
|
|
43
|
+
/** Element rendered on the **right** side of the input (e.g. an action icon). */
|
|
44
|
+
endAdornment?: JSX.Element;
|
|
45
|
+
/** Helper text displayed below the field when there is no active error. */
|
|
46
|
+
helperText?: string;
|
|
47
|
+
/** Additional CSS class applied to the root element. */
|
|
48
|
+
className?: string;
|
|
49
|
+
/** Theme override tokens. Pass a partial `EVENTS` object to customise colours. */
|
|
50
|
+
theme?: EVENTS;
|
|
51
|
+
}
|
|
52
|
+
export interface InputProps<TFieldValues extends FieldValues = FieldValues> extends InputStyleProps<TFieldValues> {
|
|
53
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
54
|
+
style: Record<string, string>;
|
|
55
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InputStyleProps } from './Input.interface';
|
|
2
|
+
import type { FieldValues } from 'react-hook-form';
|
|
3
|
+
declare const Input: <TFieldValues extends FieldValues = FieldValues>({ theme, ...rest }: InputStyleProps<TFieldValues>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default Input;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RadioProps, RadioBaseProps } from './Radio.interface';
|
|
3
|
+
export declare const RadioBase: React.ForwardRefExoticComponent<RadioBaseProps & React.RefAttributes<HTMLInputElement>>;
|
|
4
|
+
/**
|
|
5
|
+
* A radio button lets the user select exactly one option from a set.
|
|
6
|
+
*
|
|
7
|
+
* **Radio must always be rendered inside a `<RadioGroup>`** — it reads its selected state,
|
|
8
|
+
* name and change handler from the nearest RadioGroup context.
|
|
9
|
+
* Rendering a Radio outside a RadioGroup throws an error.
|
|
10
|
+
*/
|
|
11
|
+
declare const Radio: (props: RadioProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default Radio;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/Radio';
|
|
3
|
+
/** Internal props used by RadioBase — the headless presentational layer. */
|
|
4
|
+
export interface RadioBaseProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'checked' | 'style'> {
|
|
5
|
+
/** The string value this radio option represents. Matched against the RadioGroup's selected value. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Text label displayed next to the radio. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Icon rendered inside the radio when it is selected.
|
|
10
|
+
* @default `<FiberManualRecordIcon />`
|
|
11
|
+
*/
|
|
12
|
+
icon?: JSX.Element;
|
|
13
|
+
/** Additional CSS class applied to the root element. */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
16
|
+
style?: Record<string, string>;
|
|
17
|
+
/** Whether this radio is currently selected. Controlled by RadioGroup. */
|
|
18
|
+
checked: boolean;
|
|
19
|
+
/** Callback fired when this radio is selected. Controlled by RadioGroup. */
|
|
20
|
+
onSelect: () => void;
|
|
21
|
+
/** Validation error object propagated from RadioGroup. */
|
|
22
|
+
error?: {
|
|
23
|
+
message?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Prevents interaction when `true`. Can be set per-radio or inherited from RadioGroup. */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface RadioStyleProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'style'> {
|
|
29
|
+
/** The string value this radio option represents.
|
|
30
|
+
* Must be unique within the RadioGroup.
|
|
31
|
+
*/
|
|
32
|
+
value: string;
|
|
33
|
+
/** Text label displayed next to the radio. */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Icon rendered inside the radio when it is selected.
|
|
36
|
+
* @default `<FiberManualRecordIcon />`
|
|
37
|
+
*/
|
|
38
|
+
icon?: JSX.Element;
|
|
39
|
+
/** Additional CSS class applied to the root element. */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Theme override tokens. Pass a partial `EVENTS` object to customise colours. */
|
|
42
|
+
theme?: EVENTS;
|
|
43
|
+
/** Prevents interaction when `true`. Overrides the RadioGroup `disabled` value if set.
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface RadioProps extends RadioStyleProps {
|
|
49
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
50
|
+
style: Record<string, string>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RadioGroupContextValue {
|
|
2
|
+
/** The name attribute shared by all radios in this group */
|
|
3
|
+
name: string;
|
|
4
|
+
/** The currently selected value */
|
|
5
|
+
selectedValue: string;
|
|
6
|
+
/** Select a value */
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
/** Group-level disabled state */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Group-level validation error */
|
|
11
|
+
error?: {
|
|
12
|
+
message?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const RadioGroupContext: import("react").Context<RadioGroupContextValue | null>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SelectProps } from './Select.interface';
|
|
2
|
+
import { type FieldValues } from 'react-hook-form';
|
|
3
|
+
/**
|
|
4
|
+
* A select field lets users pick a single option from a dropdown list.
|
|
5
|
+
*
|
|
6
|
+
* Features: floating label, helper/error text, optional search (≥3 chars), lazy loading via
|
|
7
|
+
* `range`, per-option descriptions, and full keyboard navigation (arrows, Enter, Tab).
|
|
8
|
+
* The form value is a `string` (the selected option's `value`).
|
|
9
|
+
*/
|
|
10
|
+
declare const Select: <TFieldValues extends FieldValues = FieldValues>({ name, label, control, options, disabled, range, hasStaticOptions, hasSearch, hasDescription, hasPadding, showErrorText, helperText, style, className, ...rest }: SelectProps<TFieldValues>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default Select;
|