@foi/design-system 0.0.12 → 0.0.14
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/README.md +141 -1
- package/dist/{RadioGroup-CdW6yS38.js → RadioGroup-DCJBoZc-.js} +18 -17
- package/dist/{RadioGroup-CdW6yS38.js.map → RadioGroup-DCJBoZc-.js.map} +1 -1
- package/dist/{RadioGroup.context-BdRgENJJ.js → RadioGroup.context-QNk2hW_4.js} +4 -4
- package/dist/RadioGroup.context-QNk2hW_4.js.map +1 -0
- package/dist/{Switch-C7wjcrjU.js → Switch-JF9P9VJf.js} +438 -421
- package/dist/Switch-JF9P9VJf.js.map +1 -0
- package/dist/{ThemeProvider-JlN3U_r2.js → ThemeProvider-Q2Hjezbt.js} +2 -2
- package/dist/{ThemeProvider-JlN3U_r2.js.map → ThemeProvider-Q2Hjezbt.js.map} +1 -1
- package/dist/atoms.mjs +2 -2
- package/dist/components/atoms/Button/Button.interface.d.ts +1 -1
- package/dist/components/atoms/Checkbox/Checkbox.d.ts +4 -1
- package/dist/components/atoms/DatePicker/DatePickerMenu/DatePickerMenu.d.ts +0 -2
- package/dist/components/atoms/IconButton/IconButton.interface.d.ts +1 -1
- package/dist/components/atoms/Input/Input.d.ts +6 -7
- package/dist/components/atoms/Input/Input.interface.d.ts +62 -13
- package/dist/components/atoms/Pagination/Pagination.d.ts +12 -0
- package/dist/components/atoms/Pagination/Pagination.emotion.d.ts +2 -0
- package/dist/components/atoms/Pagination/Pagination.interface.d.ts +32 -0
- package/dist/components/atoms/Pagination/PaginationMenu/PaginationMenu.d.ts +9 -0
- package/dist/components/atoms/Pagination/PaginationMenu/PaginationMenu.emotion.d.ts +2 -0
- package/dist/components/atoms/Pagination/PaginationMenu/PaginationMenu.interface.d.ts +23 -0
- package/dist/components/atoms/Pagination/PaginationMenu/index.d.ts +4 -0
- package/dist/components/atoms/Pagination/index.d.ts +4 -0
- package/dist/components/atoms/Radio/Radio.d.ts +4 -0
- package/dist/components/atoms/Radio/RadioGroup.context.d.ts +2 -0
- package/dist/components/atoms/Select/SelectMenu/SelectMenu.d.ts +1 -2
- package/dist/components/atoms/Skeleton/Skeleton.d.ts +10 -0
- package/dist/components/atoms/Skeleton/Skeleton.emotion.d.ts +2 -0
- package/dist/components/atoms/Skeleton/Skeleton.interface.d.ts +14 -0
- package/dist/components/atoms/Skeleton/index.d.ts +2 -0
- package/dist/components/molecules/Modal/Modal.d.ts +14 -0
- package/dist/components/molecules/Modal/Modal.emotion.d.ts +2 -0
- package/dist/components/molecules/Modal/Modal.interface.d.ts +42 -0
- package/dist/components/molecules/Modal/index.d.ts +5 -0
- package/dist/components/organisms/DataGrid/DataGrid.d.ts +19 -0
- package/dist/components/organisms/DataGrid/DataGrid.emotion.d.ts +2 -0
- package/dist/components/organisms/DataGrid/DataGrid.interface.d.ts +124 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/DataGridMenu.d.ts +14 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/DataGridMenu.emotion.d.ts +2 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/DataGridMenu.interface.d.ts +54 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/components/DataGridMenuMultiSelect.d.ts +12 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/components/DataGridMenuSearch.d.ts +8 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/index.d.ts +3 -0
- package/dist/components/organisms/DataGrid/DataGridSkeleton/DataGridSkeleton.d.ts +7 -0
- package/dist/components/organisms/DataGrid/DataGridSkeleton/index.d.ts +1 -0
- package/dist/components/organisms/DataGrid/index.d.ts +4 -0
- package/dist/{emotion-react-jsx-runtime.browser.esm-ClrpcFMG.js → emotion-react-jsx-runtime.browser.esm-C4rLUMui.js} +9 -8
- package/dist/emotion-react-jsx-runtime.browser.esm-C4rLUMui.js.map +1 -0
- package/dist/hocs/ThemeProvider/components/DataGrid.d.ts +20 -0
- package/dist/hocs/ThemeProvider/components/DataGridMenu.d.ts +18 -0
- package/dist/hocs/ThemeProvider/components/Modal.d.ts +16 -0
- package/dist/hocs/ThemeProvider/components/Pagination.d.ts +13 -0
- package/dist/hocs/ThemeProvider/components/PaginationMenu.d.ts +24 -0
- package/dist/hocs/ThemeProvider/components/index.d.ts +5 -1
- package/dist/hocs/ThemeProvider/interfaces/Components.interface.d.ts +6 -1
- package/dist/hocs.mjs +1 -1
- package/dist/hooks/useOnClickOutside.d.ts +2 -3
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +922 -6
- package/dist/index.mjs.map +1 -0
- package/dist/molecules.mjs +1 -1
- package/dist/theme/dark/colors.d.ts +1 -0
- package/dist/theme/dark/components/Button.d.ts +37 -0
- package/dist/theme/dark/components/DataGrid.d.ts +26 -0
- package/dist/theme/dark/components/DataGridMenu.d.ts +20 -0
- package/dist/theme/dark/components/Modal.d.ts +20 -0
- package/dist/theme/dark/components/Pagination.d.ts +12 -0
- package/dist/theme/dark/components/PaginationMenu.d.ts +32 -0
- package/dist/theme/dark/components/index.d.ts +132 -0
- package/dist/theme/dark/index.d.ts +132 -0
- package/dist/theme/index.d.ts +132 -0
- package/dist/{theme-D18AZjTt.js → theme-Cxg9jdmX.js} +126 -29
- package/dist/theme-Cxg9jdmX.js.map +1 -0
- package/dist/theme.mjs +1 -1
- package/dist/useStateCallback-B4O93zzK.js +32 -0
- package/dist/useStateCallback-B4O93zzK.js.map +1 -0
- package/dist/utilities.mjs +4 -5
- package/dist/utilities.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/RadioGroup.context-BdRgENJJ.js.map +0 -1
- package/dist/Switch-C7wjcrjU.js.map +0 -1
- package/dist/emotion-react-jsx-runtime.browser.esm-ClrpcFMG.js.map +0 -1
- package/dist/theme-D18AZjTt.js.map +0 -1
- package/dist/useStateCallback-D9fqdxiO.js +0 -26
- package/dist/useStateCallback-D9fqdxiO.js.map +0 -1
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CheckboxProps, CheckboxBaseProps } from './Checkbox.interface';
|
|
3
3
|
import { type FieldValues } from 'react-hook-form';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Headless presentational layer for the checkbox.
|
|
6
|
+
* Accepts `checked` and `onChecked` directly — use this when you need a controlled checkbox outside of React Hook Form.
|
|
7
|
+
*/
|
|
5
8
|
export declare const CheckboxBase: React.ForwardRefExoticComponent<CheckboxBaseProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
9
|
declare const Checkbox: <TFieldValues extends FieldValues = FieldValues>(props: CheckboxProps<TFieldValues>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
10
|
export default Checkbox;
|
|
@@ -7,8 +7,6 @@ import type { DatePickerMenuProps } from './DatePickerMenu.interface';
|
|
|
7
7
|
* scrollable year-picker. Keyboard navigation (arrow keys, Enter, Escape) is
|
|
8
8
|
* handled by the parent `DatePicker`; this component focuses the active day
|
|
9
9
|
* button when `focusedElement` changes.
|
|
10
|
-
*
|
|
11
|
-
* @internal — rendered exclusively by `DatePicker`. Do not use directly.
|
|
12
10
|
*/
|
|
13
11
|
declare const DatePickerMenu: React.ForwardRefExoticComponent<DatePickerMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
12
|
export default DatePickerMenu;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { type JSX } from 'react';
|
|
2
|
-
import type { EVENTS } from '@hocs/ThemeProvider/components/
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/IconButton';
|
|
3
3
|
export interface IconButtonStyleProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'style'> {
|
|
4
4
|
/** The icon element rendered inside the button. */
|
|
5
5
|
icon: JSX.Element;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { InputProps } from './Input.interface';
|
|
1
|
+
import type { InputBaseProps, InputProps } from './Input.interface';
|
|
2
2
|
import { type FieldValues } from 'react-hook-form';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* optional value formatting, and input filtering via `regex`.
|
|
8
|
-
* The form value is a `string`.
|
|
4
|
+
* Headless presentational layer shared by all input variants.
|
|
5
|
+
* Handles value rendering, adornments, error display, and formatting.
|
|
6
|
+
* Wrap with the `Input` component (which wires RHF) for form use.
|
|
9
7
|
*/
|
|
10
|
-
declare const
|
|
8
|
+
export declare const InputBase: ({ label, value, onChange, error, style, width, disabled, type, regex, hasPadding, format, startAdornment, endAdornment, helperText, showErrorText, className, onBlur, ...rest }: InputBaseProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const Input: <TFieldValues extends FieldValues = FieldValues>(props: InputProps<TFieldValues>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
10
|
export default Input;
|
|
@@ -1,30 +1,81 @@
|
|
|
1
1
|
import React, { type JSX } from 'react';
|
|
2
2
|
import type { EVENTS } from '@hocs/ThemeProvider/components/Input';
|
|
3
3
|
import type { Control, FieldValues } from 'react-hook-form';
|
|
4
|
-
|
|
4
|
+
/** Internal props used by InputBase — the headless presentational layer. */
|
|
5
|
+
export interface InputBaseProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'style' | 'value'> {
|
|
6
|
+
/** Floating label displayed inside the field border. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Current value (controlled). */
|
|
9
|
+
value: string;
|
|
10
|
+
/** Callback fired when the value changes. Receives the processed string. */
|
|
11
|
+
onChange: (value: string) => void;
|
|
12
|
+
/** Validation error from RHF (or any external source). */
|
|
13
|
+
error?: {
|
|
14
|
+
message?: string;
|
|
15
|
+
};
|
|
16
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
17
|
+
style?: Record<string, string>;
|
|
18
|
+
/** Controls the rendered width of the field.
|
|
19
|
+
* @default 'medium'
|
|
20
|
+
*/
|
|
21
|
+
width?: 'small' | 'medium' | 'large' | 'full';
|
|
22
|
+
/** HTML input type.
|
|
23
|
+
* @default 'text'
|
|
24
|
+
*/
|
|
25
|
+
type?: 'text' | 'password' | 'number' | 'email';
|
|
26
|
+
/** Each keystroke is validated against this regex; non-matching chars are ignored. */
|
|
27
|
+
regex?: RegExp;
|
|
28
|
+
/** When `false`, validation error text below the field is hidden.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
showErrorText?: boolean;
|
|
32
|
+
/** When `true`, adds bottom padding below the helper text area.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
hasPadding?: boolean;
|
|
36
|
+
/** Applied to the value on every keystroke before it is stored. */
|
|
37
|
+
format?: (value: string) => string;
|
|
38
|
+
/** Element rendered on the left side of the input. */
|
|
39
|
+
startAdornment?: JSX.Element;
|
|
40
|
+
/** Element rendered on the right side of the input. */
|
|
41
|
+
endAdornment?: JSX.Element;
|
|
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
|
+
/** Prevents all interaction when `true`.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/** Placeholder text shown when the field is empty and has no floating label focus. */
|
|
51
|
+
placeholder?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface InputStyleProps<TFieldValues extends FieldValues = FieldValues> extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'style' | 'onChange' | 'value'> {
|
|
5
54
|
/** RHF field name. The form value will be a `string`. */
|
|
6
55
|
name: string;
|
|
7
56
|
/** Floating label displayed inside the field border. */
|
|
8
57
|
label: string;
|
|
9
|
-
/** RHF control object. */
|
|
10
|
-
control
|
|
58
|
+
/** RHF control object. Omit to use controlled mode with `value` + `onValueChange`. */
|
|
59
|
+
control?: Control<TFieldValues>;
|
|
60
|
+
/** Current value for controlled mode (used when `control` is omitted). */
|
|
61
|
+
value?: string;
|
|
62
|
+
/** Callback for controlled mode (used when `control` is omitted). */
|
|
63
|
+
onValueChange?: (value: string) => void;
|
|
11
64
|
/** Prevents all interaction when `true`.
|
|
12
65
|
* @default false
|
|
13
66
|
*/
|
|
14
67
|
disabled?: boolean;
|
|
15
|
-
/**
|
|
68
|
+
/** Placeholder text shown when the field is empty and has no floating label focus. */
|
|
16
69
|
placeholder?: string;
|
|
17
70
|
/** Controls the rendered width of the field.
|
|
18
71
|
* @default 'medium'
|
|
19
72
|
*/
|
|
20
73
|
width?: 'small' | 'medium' | 'large' | 'full';
|
|
21
|
-
/** HTML input type.
|
|
74
|
+
/** HTML input type.
|
|
22
75
|
* @default 'text'
|
|
23
76
|
*/
|
|
24
77
|
type?: 'text' | 'password' | 'number' | 'email';
|
|
25
|
-
/**
|
|
26
|
-
* Characters that do not match are silently ignored.
|
|
27
|
-
*/
|
|
78
|
+
/** Each keystroke is validated against this regex; non-matching chars are ignored. */
|
|
28
79
|
regex?: RegExp;
|
|
29
80
|
/** When `false`, validation error text below the field is hidden.
|
|
30
81
|
* @default true
|
|
@@ -34,13 +85,11 @@ export interface InputStyleProps<TFieldValues extends FieldValues = FieldValues>
|
|
|
34
85
|
* @default false
|
|
35
86
|
*/
|
|
36
87
|
hasPadding?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Receives the raw string and must return the formatted string.
|
|
39
|
-
*/
|
|
88
|
+
/** Applied to the value on every keystroke before it is stored. */
|
|
40
89
|
format?: (value: string) => string;
|
|
41
|
-
/** Element rendered on the
|
|
90
|
+
/** Element rendered on the left side of the input. */
|
|
42
91
|
startAdornment?: JSX.Element;
|
|
43
|
-
/** Element rendered on the
|
|
92
|
+
/** Element rendered on the right side of the input. */
|
|
44
93
|
endAdornment?: JSX.Element;
|
|
45
94
|
/** Helper text displayed below the field when there is no active error. */
|
|
46
95
|
helperText?: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PaginationProps } from './Pagination.interface';
|
|
2
|
+
/**
|
|
3
|
+
* A pagination control bar that lets users navigate between pages of data.
|
|
4
|
+
*
|
|
5
|
+
* Displays the current row range (`start–end of total`), first/prev/next/last
|
|
6
|
+
* navigation buttons, and — when `pageSizeOptions` is provided — a rows-per-page
|
|
7
|
+
* dropdown menu.
|
|
8
|
+
*
|
|
9
|
+
* All navigation buttons are disabled while `loading` is `true`.
|
|
10
|
+
*/
|
|
11
|
+
declare const Pagination: ({ page, total, pageSize, onPageChange, pageSizeOptions, onPageSizeChange, loading, className, style, }: PaginationProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default Pagination;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface PaginationProps {
|
|
2
|
+
/** Zero-based index of the currently active page. */
|
|
3
|
+
page: number;
|
|
4
|
+
/** Total number of rows across all pages (used to compute the page count). */
|
|
5
|
+
total: number;
|
|
6
|
+
/** Number of rows displayed per page. */
|
|
7
|
+
pageSize: number;
|
|
8
|
+
/** Callback fired when the user navigates to a different page. Receives the new zero-based page index. */
|
|
9
|
+
onPageChange: (page: number) => void;
|
|
10
|
+
/** List of page-size choices rendered in the rows-per-page menu.
|
|
11
|
+
* When omitted the rows-per-page control is hidden.
|
|
12
|
+
*/
|
|
13
|
+
pageSizeOptions?: number[];
|
|
14
|
+
/** Callback fired when the user selects a new page size. */
|
|
15
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
16
|
+
/** When `true`, all navigation buttons are disabled to signal a pending fetch.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
/** Additional CSS class applied to the root element. */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
23
|
+
style?: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
export interface PaginationStyleProps extends Omit<PaginationProps, 'style'> {
|
|
26
|
+
/** Theme override tokens. */
|
|
27
|
+
theme?: Record<string, Record<string, Record<string, Record<string, string>>>>;
|
|
28
|
+
/** Selects the style variant defined in the theme.
|
|
29
|
+
* @default 'default'
|
|
30
|
+
*/
|
|
31
|
+
variant?: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PaginationMenuProps } from './PaginationMenu.interface';
|
|
2
|
+
/**
|
|
3
|
+
* A floating dropdown that renders a list of page-size options.
|
|
4
|
+
*
|
|
5
|
+
* Rendered inside `<Pagination>` when `pageSizeOptions` is provided.
|
|
6
|
+
* Keyboard focus is controlled externally via `focusedElement`.
|
|
7
|
+
*/
|
|
8
|
+
declare const PaginationMenu: ({ options, activeOption, onSelect, focusedElement, style }: PaginationMenuProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default PaginationMenu;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface PaginationMenuProps {
|
|
2
|
+
/** List of page-size values to display as selectable options. */
|
|
3
|
+
options: number[];
|
|
4
|
+
/** The currently active page-size value (will be highlighted). */
|
|
5
|
+
activeOption: number;
|
|
6
|
+
/** Callback fired when the user clicks an option. Receives the selected page size. */
|
|
7
|
+
onSelect: (option: number) => void;
|
|
8
|
+
/** Index (0-based) of the option that should receive keyboard focus highlight.
|
|
9
|
+
* Pass `-1` (default) when no item is keyboard-focused.
|
|
10
|
+
* @default -1
|
|
11
|
+
*/
|
|
12
|
+
focusedElement?: number;
|
|
13
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
14
|
+
style: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
export interface PaginationMenuStyleProps extends Omit<PaginationMenuProps, 'style'> {
|
|
17
|
+
/** Theme override tokens. */
|
|
18
|
+
theme?: Record<string, Record<string, Record<string, Record<string, string>>>>;
|
|
19
|
+
/** Selects the style variant defined in the theme.
|
|
20
|
+
* @default 'default'
|
|
21
|
+
*/
|
|
22
|
+
variant?: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PaginationMenuStyleProps } from './PaginationMenu.interface';
|
|
2
|
+
declare const PaginationMenu: ({ theme, variant, ...rest }: PaginationMenuStyleProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default PaginationMenu;
|
|
4
|
+
export type { PaginationMenuProps, PaginationMenuStyleProps } from './PaginationMenu.interface';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PaginationStyleProps } from './Pagination.interface';
|
|
2
|
+
declare const Pagination: ({ theme, variant, ...rest }: PaginationStyleProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default Pagination;
|
|
4
|
+
export type { PaginationProps, PaginationStyleProps } from './Pagination.interface';
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { RadioProps, RadioBaseProps } from './Radio.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Headless presentational layer for the radio button.
|
|
5
|
+
* Accepts `checked` and `onChange` directly — use this when you need a controlled radio outside of React Hook Form.
|
|
6
|
+
*/
|
|
3
7
|
export declare const RadioBase: React.ForwardRefExoticComponent<RadioBaseProps & React.RefAttributes<HTMLInputElement>>;
|
|
4
8
|
/**
|
|
5
9
|
* A radio button lets the user select exactly one option from a set.
|
|
@@ -11,5 +11,7 @@ export interface RadioGroupContextValue {
|
|
|
11
11
|
error?: {
|
|
12
12
|
message?: string;
|
|
13
13
|
};
|
|
14
|
+
/** Value of the first non-disabled Radio child — used to implement roving tabindex */
|
|
15
|
+
firstValue: string;
|
|
14
16
|
}
|
|
15
17
|
export declare const RadioGroupContext: import("react").Context<RadioGroupContextValue | null>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SelectMenuProps } from './SelectMenu.interface';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Dropdown list rendered by `<Select>`.
|
|
5
5
|
* Scrolls the focused option into view on keyboard navigation and calls `onChange` on click.
|
|
6
|
-
* Not intended for direct use — use `<Select>` instead.
|
|
7
6
|
*/
|
|
8
7
|
declare const SelectMenu: React.ForwardRefExoticComponent<SelectMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
8
|
export default SelectMenu;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SkeletonProps } from './Skeleton.interface';
|
|
2
|
+
/**
|
|
3
|
+
* A low-fidelity placeholder that mimics the shape of content while it loads.
|
|
4
|
+
*
|
|
5
|
+
* Use `variant="rectangular"` for text lines, cards, or images and
|
|
6
|
+
* `variant="circular"` for avatars or icon placeholders. Set `width` and
|
|
7
|
+
* `height` to match the real content's dimensions.
|
|
8
|
+
*/
|
|
9
|
+
declare const Skeleton: ({ variant, width, height, className }: SkeletonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default Skeleton;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SkeletonProps {
|
|
2
|
+
/** Shape of the skeleton placeholder.
|
|
3
|
+
* - `'rectangular'` — a rounded rectangle (suits text lines, cards, images).
|
|
4
|
+
* - `'circular'` — a full circle (suits avatars, icon placeholders).
|
|
5
|
+
* @default 'rectangular'
|
|
6
|
+
*/
|
|
7
|
+
variant?: 'rectangular' | 'circular';
|
|
8
|
+
/** Explicit width of the skeleton element. Accepts any valid CSS width value or a pixel number. */
|
|
9
|
+
width?: string | number;
|
|
10
|
+
/** Explicit height of the skeleton element. Accepts any valid CSS height value or a pixel number. */
|
|
11
|
+
height?: string | number;
|
|
12
|
+
/** Additional CSS class applied to the root element. */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import type { ModalProps } from './Modal.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Generic overlay dialog rendered via a portal into `document.body`.
|
|
5
|
+
*
|
|
6
|
+
* Closes on:
|
|
7
|
+
* - Clicking the × button in the header.
|
|
8
|
+
* - Pressing **Escape** (unless `staticBackdrop` is `true`).
|
|
9
|
+
* - Clicking the semi-transparent backdrop (unless `staticBackdrop` is `true`).
|
|
10
|
+
*
|
|
11
|
+
* Pass `footer` to render action buttons below the body content.
|
|
12
|
+
*/
|
|
13
|
+
declare const Modal: FC<ModalProps>;
|
|
14
|
+
export default Modal;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/Modal';
|
|
3
|
+
export interface ModalStyleProps {
|
|
4
|
+
/** Controls visibility of the modal. */
|
|
5
|
+
open: boolean;
|
|
6
|
+
/** Callback fired when the modal requests to close (X button, backdrop click, or Escape). */
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
/** Full content of the header bar (icon, title, etc.). Rendered as-is before the close button.
|
|
9
|
+
* Use `--MODAL-title` class on your title element to apply the themed title styles.
|
|
10
|
+
*/
|
|
11
|
+
header?: ReactNode;
|
|
12
|
+
/** When `true`, renders a × close button at the end of the header bar.
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
showCloseButton?: boolean;
|
|
16
|
+
/** Width preset.
|
|
17
|
+
* - `'md'` — 480 px (default)
|
|
18
|
+
* - `'lg'` — 720 px
|
|
19
|
+
* @default 'md'
|
|
20
|
+
*/
|
|
21
|
+
size?: 'md' | 'lg';
|
|
22
|
+
/** Main content area of the modal. */
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
/** Content rendered inside the footer row (typically action buttons). */
|
|
25
|
+
footer?: ReactNode;
|
|
26
|
+
/** When `true`, clicking the backdrop or pressing Escape will **not** close the modal.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
staticBackdrop?: boolean;
|
|
30
|
+
/** Additional CSS class applied to the modal panel. */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** Theme override tokens. Pass a partial `EVENTS` object to customise colours. */
|
|
33
|
+
theme?: EVENTS;
|
|
34
|
+
/** Selects the style variant defined in the theme.
|
|
35
|
+
* @default 'default'
|
|
36
|
+
*/
|
|
37
|
+
variant?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ModalProps extends Omit<ModalStyleProps, 'theme' | 'variant'> {
|
|
40
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
41
|
+
style: Record<string, string>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DataGridProps } from './DataGrid.interface';
|
|
2
|
+
/**
|
|
3
|
+
* A full-featured data table with server-side fetching, sorting, filtering, and pagination.
|
|
4
|
+
*
|
|
5
|
+
* Pass `columns` to define the table structure and `onFetch` to supply data.
|
|
6
|
+
* `onFetch` is called automatically whenever the page, page size, active sort,
|
|
7
|
+
* or any column filter changes.
|
|
8
|
+
*
|
|
9
|
+
* **Pagination modes** (controlled by `paginationType`):
|
|
10
|
+
* - `'pagination'` — renders a `<Pagination>` bar below the table.
|
|
11
|
+
* - `'scroll'` — appends rows as the user scrolls down (infinite scroll).
|
|
12
|
+
*
|
|
13
|
+
* **Column actions:**
|
|
14
|
+
* - Sortable columns show a sort-direction toggle in the header.
|
|
15
|
+
* - Columns with a `filter` config show a filter popover icon.
|
|
16
|
+
* - Add a column with `type: 'options'` and a `render` prop for row-level action buttons.
|
|
17
|
+
*/
|
|
18
|
+
declare const DataGrid: <T extends object>({ columns, onFetch, paginationType, pageSize, pageSizeOptions, emptyContent, loadingMoreContent, className, style, }: DataGridProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default DataGrid;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/DataGrid';
|
|
3
|
+
/** Determines the filter UI rendered in the column header popover. */
|
|
4
|
+
export type DataGridFilterType = 'search' | 'multiselect' | 'multiselect-search';
|
|
5
|
+
/** A single option entry used by `multiselect` and `multiselect-search` column filters. */
|
|
6
|
+
export interface DataGridFilterOption {
|
|
7
|
+
/** Machine-readable identifier stored in the active filter state. */
|
|
8
|
+
value: string;
|
|
9
|
+
/** Human-readable label shown in the filter list. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Optional accent colour applied to the option chip or label. */
|
|
12
|
+
color?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Configuration object that enables filtering for a column. */
|
|
15
|
+
export interface DataGridFilter {
|
|
16
|
+
/** Filter UI variant to render inside the popover. */
|
|
17
|
+
type: DataGridFilterType;
|
|
18
|
+
/** Heading text shown at the top of the filter popover. */
|
|
19
|
+
title?: string;
|
|
20
|
+
/** Placeholder / label text shown inside the search input. */
|
|
21
|
+
label?: string;
|
|
22
|
+
/** Label for the cancel button.
|
|
23
|
+
* @default 'Cancel'
|
|
24
|
+
*/
|
|
25
|
+
cancelLabel?: string;
|
|
26
|
+
/** Label for the apply button.
|
|
27
|
+
* @default 'Apply'
|
|
28
|
+
*/
|
|
29
|
+
applyLabel?: string;
|
|
30
|
+
/** Available options for `multiselect` and `multiselect-search` filter types. */
|
|
31
|
+
options?: DataGridFilterOption[];
|
|
32
|
+
}
|
|
33
|
+
/** Data type of a column, used to determine default formatting and sorting behaviour. */
|
|
34
|
+
export type DataGridColumnType = 'text' | 'number' | 'date' | 'options';
|
|
35
|
+
/** Definition of a single DataGrid column. */
|
|
36
|
+
export interface DataGridColumn<T = Record<string, unknown>> {
|
|
37
|
+
/** Unique identifier that matches a key on each data row. */
|
|
38
|
+
key: string;
|
|
39
|
+
/** Column header label. */
|
|
40
|
+
label: string;
|
|
41
|
+
/** Data type of the column's values. */
|
|
42
|
+
type: DataGridColumnType;
|
|
43
|
+
/** Optional filter configuration. When set, a filter icon appears in the header. */
|
|
44
|
+
filter?: DataGridFilter;
|
|
45
|
+
/** When `true` (default), a sort toggle button is rendered in the header.
|
|
46
|
+
* Set to `false` to disable sorting for this column.
|
|
47
|
+
*/
|
|
48
|
+
sortable?: boolean;
|
|
49
|
+
/** Fixed CSS width of the column (e.g. `'120px'`, `'10%'`).
|
|
50
|
+
* When omitted the column width is determined by the table layout algorithm.
|
|
51
|
+
*/
|
|
52
|
+
width?: string;
|
|
53
|
+
/** Custom cell renderer. When provided, `value` and the full `row` object are passed. */
|
|
54
|
+
render?: (value: unknown, row: T) => React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
/** The current sort applied to the grid. */
|
|
57
|
+
export interface DataGridSortState {
|
|
58
|
+
/** Key of the column being sorted. */
|
|
59
|
+
key: string;
|
|
60
|
+
/** Sort direction. */
|
|
61
|
+
direction: 'asc' | 'desc';
|
|
62
|
+
}
|
|
63
|
+
/** Parameters passed to `onFetch` on every data request. */
|
|
64
|
+
export interface DataGridFetchParams {
|
|
65
|
+
/** Zero-based page index. */
|
|
66
|
+
page: number;
|
|
67
|
+
/** Number of rows per page. */
|
|
68
|
+
pageSize: number;
|
|
69
|
+
/** Active sort state, or `undefined` when no sort is applied. */
|
|
70
|
+
sort?: DataGridSortState;
|
|
71
|
+
/** Map of active filter values keyed by column key. */
|
|
72
|
+
filters?: Record<string, string | string[]>;
|
|
73
|
+
}
|
|
74
|
+
/** Shape of the object that `onFetch` must resolve with. */
|
|
75
|
+
export interface DataGridFetchResult<T = Record<string, unknown>> {
|
|
76
|
+
/** The rows for the current page. */
|
|
77
|
+
data: T[];
|
|
78
|
+
/** Total row count across all pages (used to compute pagination). */
|
|
79
|
+
total: number;
|
|
80
|
+
}
|
|
81
|
+
/** Controls how additional rows are loaded. */
|
|
82
|
+
export type DataGridPaginationType = 'scroll' | 'pagination';
|
|
83
|
+
export interface DataGridStyleProps<T = Record<string, unknown>> {
|
|
84
|
+
/** Column definitions. Each entry describes one column's key, label, type, and optional filter/sort. */
|
|
85
|
+
columns: DataGridColumn<T>[];
|
|
86
|
+
/** Async function called whenever the page, sort, or filters change.
|
|
87
|
+
* Must return `{ data, total }`.
|
|
88
|
+
*/
|
|
89
|
+
onFetch: (params: DataGridFetchParams) => Promise<DataGridFetchResult<T>>;
|
|
90
|
+
/** Controls how more rows are loaded when the user reaches the end of the current view.
|
|
91
|
+
* - `'pagination'` — shows a pagination bar below the table.
|
|
92
|
+
* - `'scroll'` — loads the next page automatically when the user scrolls to the bottom.
|
|
93
|
+
* @default 'pagination'
|
|
94
|
+
*/
|
|
95
|
+
paginationType?: DataGridPaginationType;
|
|
96
|
+
/** Number of rows per page.
|
|
97
|
+
* @default 10
|
|
98
|
+
*/
|
|
99
|
+
pageSize?: number;
|
|
100
|
+
/** List of page-size options shown in the pagination rows-per-page menu.
|
|
101
|
+
* When omitted the rows-per-page control is hidden.
|
|
102
|
+
*/
|
|
103
|
+
pageSizeOptions?: number[];
|
|
104
|
+
/** Content rendered inside the table when no rows match the current query.
|
|
105
|
+
* @default `<span>No se han encontrado resultados</span>`
|
|
106
|
+
*/
|
|
107
|
+
emptyContent?: React.ReactNode;
|
|
108
|
+
/** Content rendered in the last table row while additional rows are being fetched in scroll mode.
|
|
109
|
+
* @default `<span>Cargando...</span>`
|
|
110
|
+
*/
|
|
111
|
+
loadingMoreContent?: React.ReactNode;
|
|
112
|
+
/** Additional CSS class applied to the root element. */
|
|
113
|
+
className?: string;
|
|
114
|
+
/** Theme override tokens. Pass a partial `EVENTS` object to customise colours. */
|
|
115
|
+
theme?: EVENTS;
|
|
116
|
+
/** Selects the style variant defined in the theme.
|
|
117
|
+
* @default 'default'
|
|
118
|
+
*/
|
|
119
|
+
variant?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface DataGridProps<T = Record<string, unknown>> extends Omit<DataGridStyleProps<T>, 'theme' | 'variant'> {
|
|
122
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
123
|
+
style: Record<string, string>;
|
|
124
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DataGridMenuProps } from './DataGridMenu.interface';
|
|
2
|
+
/**
|
|
3
|
+
* A portal-rendered popover that provides filter controls for a DataGrid column.
|
|
4
|
+
*
|
|
5
|
+
* Positions itself below `anchorEl` using `useLayoutEffect` and repositions
|
|
6
|
+
* on window scroll / resize. Renders one of three filter UIs based on `filterType`:
|
|
7
|
+
* - `'search'` — a single text input.
|
|
8
|
+
* - `'multiselect'` — a list of checkboxes.
|
|
9
|
+
* - `'multiselect-search'` — a list of checkboxes with an inline search input.
|
|
10
|
+
*
|
|
11
|
+
* Apply/cancel actions are delegated to the parent via `onApply` and `onCancel`.
|
|
12
|
+
*/
|
|
13
|
+
declare const DataGridMenu: ({ filterType, options, columnKey, filterTitle, searchLabel, cancelLabel, applyLabel, pendingSearch, onSearchChange, pendingMulti, onMultiChange, multiSearch, onMultiSearchChange, onCancel, onApply, onClear, anchorEl, style, }: DataGridMenuProps) => import("react").ReactPortal;
|
|
14
|
+
export default DataGridMenu;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DataGridFilterType, DataGridFilterOption } from '../DataGrid.interface';
|
|
2
|
+
import type { EVENTS } from '@hocs/ThemeProvider/components/DataGridMenu';
|
|
3
|
+
export interface DataGridMenuStyleProps {
|
|
4
|
+
/** Determines which filter UI is rendered inside the popover. */
|
|
5
|
+
filterType: DataGridFilterType;
|
|
6
|
+
/** Available options for `multiselect` and `multiselect-search` filter types. */
|
|
7
|
+
options?: DataGridFilterOption[];
|
|
8
|
+
/** Key of the column this menu belongs to. Used as a `data-popover-key` attribute
|
|
9
|
+
* so click-outside detection can ignore clicks inside the popover.
|
|
10
|
+
*/
|
|
11
|
+
columnKey: string;
|
|
12
|
+
/** Heading text rendered at the top of the filter popover. */
|
|
13
|
+
filterTitle?: string;
|
|
14
|
+
/** Placeholder / label shown inside the search input (search and multiselect-search modes). */
|
|
15
|
+
searchLabel?: string;
|
|
16
|
+
/** Label for the cancel button.
|
|
17
|
+
* @default 'Cancel'
|
|
18
|
+
*/
|
|
19
|
+
cancelLabel?: string;
|
|
20
|
+
/** Label for the apply button.
|
|
21
|
+
* @default 'Apply'
|
|
22
|
+
*/
|
|
23
|
+
applyLabel?: string;
|
|
24
|
+
/** Controlled value of the text search input (search mode). */
|
|
25
|
+
pendingSearch: string;
|
|
26
|
+
/** Callback fired when the text search input changes. */
|
|
27
|
+
onSearchChange: (val: string) => void;
|
|
28
|
+
/** Controlled array of selected option values (multiselect mode). */
|
|
29
|
+
pendingMulti: string[];
|
|
30
|
+
/** Callback fired when the selected options change. */
|
|
31
|
+
onMultiChange: (values: string[]) => void;
|
|
32
|
+
/** Controlled value of the search-within-options input (multiselect-search mode). */
|
|
33
|
+
multiSearch: string;
|
|
34
|
+
/** Callback fired when the search-within-options input changes. */
|
|
35
|
+
onMultiSearchChange: (val: string) => void;
|
|
36
|
+
/** Callback fired when the user clicks the cancel button. */
|
|
37
|
+
onCancel: () => void;
|
|
38
|
+
/** Callback fired when the user clicks the apply button. */
|
|
39
|
+
onApply: () => void;
|
|
40
|
+
/** Callback fired when the user clicks the clear (delete) button in the header. */
|
|
41
|
+
onClear: () => void;
|
|
42
|
+
/** The DOM element the popover should be positioned relative to. */
|
|
43
|
+
anchorEl: HTMLElement | null;
|
|
44
|
+
/** Theme override tokens. Pass a partial `EVENTS` object to customise colours. */
|
|
45
|
+
theme?: EVENTS;
|
|
46
|
+
/** Selects the style variant defined in the theme.
|
|
47
|
+
* @default 'default'
|
|
48
|
+
*/
|
|
49
|
+
variant?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface DataGridMenuProps extends Omit<DataGridMenuStyleProps, 'theme' | 'variant'> {
|
|
52
|
+
/** Theme tokens injected by the ThemeProvider HOC. Do not pass manually. */
|
|
53
|
+
style: Record<string, string>;
|
|
54
|
+
}
|
package/dist/components/organisms/DataGrid/DataGridMenu/components/DataGridMenuMultiSelect.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DataGridFilterOption } from '../../DataGrid.interface';
|
|
2
|
+
interface DataGridMenuMultiSelectProps {
|
|
3
|
+
filterType: 'multiselect' | 'multiselect-search';
|
|
4
|
+
columnKey: string;
|
|
5
|
+
options: DataGridFilterOption[];
|
|
6
|
+
pendingMulti: string[];
|
|
7
|
+
onMultiChange: (values: string[]) => void;
|
|
8
|
+
multiSearch: string;
|
|
9
|
+
onMultiSearchChange: (val: string) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const DataGridMenuMultiSelect: ({ filterType, columnKey, options, pendingMulti, onMultiChange, multiSearch, onMultiSearchChange, }: DataGridMenuMultiSelectProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default DataGridMenuMultiSelect;
|