@fast-food/design-system 1.30.1 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/atoms/Accordion/Accordion.style.d.ts +1 -0
- package/dist/components/atoms/Input/Input.type.d.ts +5 -1
- package/dist/components/molecules/ComboboxSelect/ComboboxSelect.d.ts +6 -0
- package/dist/components/molecules/ComboboxSelect/ComboboxSelect.type.d.ts +52 -0
- package/dist/components/molecules/ComboboxSelect/index.d.ts +2 -0
- package/dist/components/molecules/DateRangePicker/DateRangePicker.d.ts +4 -0
- package/dist/components/molecules/DateRangePicker/DateRangePicker.type.d.ts +18 -0
- package/dist/components/molecules/DateRangePicker/index.d.ts +2 -0
- package/dist/components/molecules/FormFields/ComboboxField/ComboboxField.d.ts +8 -0
- package/dist/components/molecules/FormFields/ComboboxField/index.d.ts +2 -0
- package/dist/components/molecules/FormFields/index.d.ts +1 -0
- package/dist/components/molecules/FormFields/shared/applyMask.d.ts +12 -2
- package/dist/components/molecules/FormFields/shared/formFieldTypes.d.ts +27 -11
- package/dist/components/molecules/PopoverMultiSelect/PopoverMultiSelect.d.ts +6 -0
- package/dist/components/molecules/PopoverMultiSelect/PopoverMultiSelect.type.d.ts +37 -0
- package/dist/components/molecules/PopoverMultiSelect/index.d.ts +2 -0
- package/dist/components/molecules/index.d.ts +3 -0
- package/dist/fast-food-design-system-1.32.0.tgz +0 -0
- package/dist/fast-food-design-system.cjs.js +197 -169
- package/dist/fast-food-design-system.css +1 -1
- package/dist/fast-food-design-system.es.js +15440 -14422
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useDebouncedValue.d.ts +6 -0
- package/package.json +1 -1
- package/dist/fast-food-design-system-1.30.1.tgz +0 -0
|
@@ -4,6 +4,7 @@ export declare const accordionHeaderStyles: (props?: ({} & import('class-varianc
|
|
|
4
4
|
export declare const accordionContentStyles: (props?: ({
|
|
5
5
|
isOpen?: boolean | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
export declare const accordionBodyStyles: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
7
8
|
export declare const accordionIconStyles: (props?: ({
|
|
8
9
|
isOpen?: boolean | null | undefined;
|
|
9
10
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputHTMLAttributes } from 'react';
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export type InputVariant = 'default' | 'primary' | 'secondary' | 'error';
|
|
3
3
|
export type InputSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
4
4
|
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
@@ -9,4 +9,8 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
9
9
|
success?: boolean;
|
|
10
10
|
/** Shows a skeleton placeholder instead of the input control. */
|
|
11
11
|
isLoading?: boolean;
|
|
12
|
+
/** Conteúdo fixo à esquerda do campo (ícone, "R$", etc.). */
|
|
13
|
+
startAdornment?: ReactNode;
|
|
14
|
+
/** Conteúdo fixo à direita do campo (ícone, "%", botão, etc.). */
|
|
15
|
+
endAdornment?: ReactNode;
|
|
12
16
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComboboxSelectProps } from './ComboboxSelect.type';
|
|
2
|
+
declare function ComboboxSelect<TData, TParams = void>({ id, label, value, onChange, loadOptions, loadPage, loadParams, getValue, getLabel, getDescription, placeholder, searchPlaceholder, loadingText, noOptionsText, loadErrorText, helperText, errorText, error, disabled, readOnly, clearable, onClear, className, containerClassName, reloadOnParamsChange, searchDebounce, }: ComboboxSelectProps<TData, TParams>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare namespace ComboboxSelect {
|
|
4
|
+
var displayName: string;
|
|
5
|
+
}
|
|
6
|
+
export default ComboboxSelect;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Argumentos passados ao carregador paginado (busca no servidor + scroll infinito). */
|
|
2
|
+
export interface LoadPageArgs<TParams = void> {
|
|
3
|
+
/** Texto de busca atual (já com debounce aplicado). */
|
|
4
|
+
search: string;
|
|
5
|
+
/** Página solicitada (base 0). A primeira carga e toda nova busca usam página 0. */
|
|
6
|
+
page: number;
|
|
7
|
+
/** Parâmetros extras fornecidos via `loadParams`. */
|
|
8
|
+
params?: TParams;
|
|
9
|
+
}
|
|
10
|
+
/** Resultado de uma página: itens daquela página + se há mais para carregar. */
|
|
11
|
+
export interface LoadPageResult<TData> {
|
|
12
|
+
data: TData[];
|
|
13
|
+
hasMore: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ComboboxSelectProps<TData, TParams = void> {
|
|
16
|
+
id?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
value?: string | null;
|
|
19
|
+
onChange?: (value: string | null, item: TData | null) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Carregador simples: busca todas as opções de uma vez. A busca é feita no
|
|
22
|
+
* cliente. Use quando a lista é pequena. Obrigatório se `loadPage` não for usado.
|
|
23
|
+
*/
|
|
24
|
+
loadOptions?: (params?: TParams) => Promise<TData[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Carregador paginado com busca no servidor + scroll infinito. Quando fornecido,
|
|
27
|
+
* tem prioridade sobre `loadOptions`: a busca é debounced e enviada ao servidor,
|
|
28
|
+
* e novas páginas são carregadas ao rolar até o fim da lista.
|
|
29
|
+
*/
|
|
30
|
+
loadPage?: (args: LoadPageArgs<TParams>) => Promise<LoadPageResult<TData>>;
|
|
31
|
+
loadParams?: TParams;
|
|
32
|
+
getValue: (item: TData) => string;
|
|
33
|
+
getLabel: (item: TData) => string;
|
|
34
|
+
getDescription?: (item: TData) => string | undefined;
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
searchPlaceholder?: string;
|
|
37
|
+
loadingText?: string;
|
|
38
|
+
noOptionsText?: string;
|
|
39
|
+
loadErrorText?: string;
|
|
40
|
+
helperText?: string;
|
|
41
|
+
errorText?: string;
|
|
42
|
+
error?: boolean;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
readOnly?: boolean;
|
|
45
|
+
clearable?: boolean;
|
|
46
|
+
onClear?: () => void;
|
|
47
|
+
className?: string;
|
|
48
|
+
containerClassName?: string;
|
|
49
|
+
reloadOnParamsChange?: boolean;
|
|
50
|
+
/** Debounce (ms) da busca no servidor quando `loadPage` é usado. Padrão: 300. */
|
|
51
|
+
searchDebounce?: number;
|
|
52
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DateRange } from 'react-day-picker';
|
|
2
|
+
export type { DateRange };
|
|
3
|
+
export interface DateRangePreset {
|
|
4
|
+
label: string;
|
|
5
|
+
range: () => DateRange;
|
|
6
|
+
}
|
|
7
|
+
export interface DateRangePickerProps {
|
|
8
|
+
value?: DateRange;
|
|
9
|
+
onChange?: (range: DateRange | undefined) => void;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Exibe botões de atalho (Hoje, Últimos 7 dias…). Padrão: true */
|
|
14
|
+
showPresets?: boolean;
|
|
15
|
+
/** Substitui os presets padrão por uma lista customizada */
|
|
16
|
+
presets?: DateRangePreset[];
|
|
17
|
+
'aria-invalid'?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComboboxSelectProps } from '../../ComboboxSelect/ComboboxSelect.type';
|
|
2
|
+
import { BaseFieldProps } from '../shared/formFieldTypes';
|
|
3
|
+
export type ComboboxFieldProps<TData, TParams = void> = Omit<ComboboxSelectProps<TData, TParams>, 'label' | 'helperText' | 'errorText' | 'containerClassName'> & BaseFieldProps;
|
|
4
|
+
declare function ComboboxField<TData, TParams = void>({ label, helperText, errorText, containerClassName, id, ...props }: ComboboxFieldProps<TData, TParams>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare namespace ComboboxField {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
8
|
+
export default ComboboxField;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export declare function
|
|
1
|
+
/** Conta quantos dígitos-curinga (`#`) a máscara possui. */
|
|
2
|
+
export declare function countMaskSlots(mask: string): number;
|
|
3
|
+
/**
|
|
4
|
+
* Escolhe a máscara mais adequada à quantidade de dígitos informada.
|
|
5
|
+
* Entre as máscaras ordenadas por capacidade, retorna a primeira cujo número de
|
|
6
|
+
* slots `#` comporta os dígitos; se nenhuma comporta, retorna a de maior capacidade.
|
|
7
|
+
*/
|
|
8
|
+
export declare function pickMask(mask: string | string[], digitCount: number): string;
|
|
9
|
+
/** Máscara com `#` = um dígito; demais caracteres são literais. Aceita array de máscaras. */
|
|
10
|
+
export declare function applyMask(rawValue: string, mask: string | string[]): string;
|
|
11
|
+
/** Verifica se os dígitos preencheram completamente a máscara escolhida. */
|
|
12
|
+
export declare function isMaskComplete(rawValue: string, mask: string | string[]): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChangeEventHandler, InputHTMLAttributes, ReactNode, TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import { DateRange } from 'react-day-picker';
|
|
2
3
|
import { DatePickerCalendarProps } from '../../DatePicker/DatePicker.type';
|
|
3
4
|
export type BaseFieldProps = {
|
|
4
5
|
label?: ReactNode;
|
|
@@ -9,9 +10,16 @@ export type BaseFieldProps = {
|
|
|
9
10
|
export type TextFieldProps = InputHTMLAttributes<HTMLInputElement> & BaseFieldProps;
|
|
10
11
|
export type EmailFieldProps = InputHTMLAttributes<HTMLInputElement> & BaseFieldProps;
|
|
11
12
|
export type PasswordFieldProps = InputHTMLAttributes<HTMLInputElement> & BaseFieldProps;
|
|
12
|
-
export type NumberFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange'> & BaseFieldProps & {
|
|
13
|
+
export type NumberFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'value'> & BaseFieldProps & {
|
|
14
|
+
value?: number | null;
|
|
13
15
|
onValueChange?: (value: number | null) => void;
|
|
14
16
|
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
17
|
+
/** Mínimo permitido — aplicado no onBlur */
|
|
18
|
+
min?: number;
|
|
19
|
+
/** Máximo permitido — aplicado no onBlur */
|
|
20
|
+
max?: number;
|
|
21
|
+
/** Permite decimais (ponto/vírgula). Padrão: false */
|
|
22
|
+
allowDecimal?: boolean;
|
|
15
23
|
};
|
|
16
24
|
export type CurrencyFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange'> & BaseFieldProps & {
|
|
17
25
|
value?: number;
|
|
@@ -28,12 +36,24 @@ export type PercentageFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, '
|
|
|
28
36
|
max?: number;
|
|
29
37
|
};
|
|
30
38
|
export type MaskFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange'> & BaseFieldProps & {
|
|
31
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Máscara com `#` = um dígito; demais caracteres são literais. Aceita um
|
|
41
|
+
* array de máscaras — a mais adequada ao número de dígitos digitados é
|
|
42
|
+
* escolhida automaticamente (ex.: `['###.###.###-##', '##.###.###/####-##']`
|
|
43
|
+
* para CPF/CNPJ).
|
|
44
|
+
*/
|
|
45
|
+
mask: string | string[];
|
|
32
46
|
onValueChange?: (value: string) => void;
|
|
33
47
|
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
48
|
+
/** Disparado quando a máscara escolhida fica completamente preenchida. */
|
|
49
|
+
onComplete?: (value: string) => void;
|
|
34
50
|
};
|
|
35
51
|
export type TextAreaFieldProps = TextareaHTMLAttributes<HTMLTextAreaElement> & BaseFieldProps & {
|
|
36
52
|
error?: boolean;
|
|
53
|
+
/** Exibe contador de caracteres. Ativado automaticamente quando `characterLimit` é fornecido. */
|
|
54
|
+
characterCount?: boolean;
|
|
55
|
+
/** Limite máximo de caracteres — aplica `maxLength` e exibe contador. */
|
|
56
|
+
characterLimit?: number;
|
|
37
57
|
};
|
|
38
58
|
export type DateFieldProps = BaseFieldProps & DatePickerCalendarProps & {
|
|
39
59
|
value?: Date;
|
|
@@ -51,15 +71,11 @@ export type DateTimeFieldProps = BaseFieldProps & DatePickerCalendarProps & {
|
|
|
51
71
|
id?: string;
|
|
52
72
|
readOnly?: boolean;
|
|
53
73
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
value?: DateRangeValue;
|
|
60
|
-
onValueChange?: (value: DateRangeValue) => void;
|
|
61
|
-
fromPlaceholder?: string;
|
|
62
|
-
toPlaceholder?: string;
|
|
74
|
+
/** Alias de `DateRange` do react-day-picker para conveniência. */
|
|
75
|
+
export type DateRangeValue = DateRange;
|
|
76
|
+
export type DateRangeFieldProps = BaseFieldProps & {
|
|
77
|
+
value?: DateRange;
|
|
78
|
+
onValueChange?: (value: DateRange | undefined) => void;
|
|
63
79
|
disabled?: boolean;
|
|
64
80
|
readOnly?: boolean;
|
|
65
81
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PopoverMultiSelectProps } from './PopoverMultiSelect.type';
|
|
2
|
+
declare function PopoverMultiSelect<TData, TParams = void>({ label, value, onChange, loadOptions, loadPage, loadParams, getValue, getLabel, getSubLabel, placeholder, searchPlaceholder, emptyText, loadingText, loadErrorText, helperText, errorText, error, disabled, readOnly, clearable, previewLimit, className, containerClassName, searchDebounce, }: PopoverMultiSelectProps<TData, TParams>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare namespace PopoverMultiSelect {
|
|
4
|
+
var displayName: string;
|
|
5
|
+
}
|
|
6
|
+
export default PopoverMultiSelect;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { LoadPageArgs, LoadPageResult } from '../ComboboxSelect/ComboboxSelect.type';
|
|
2
|
+
export type { LoadPageArgs, LoadPageResult };
|
|
3
|
+
export interface PopoverMultiSelectProps<TData, TParams = void> {
|
|
4
|
+
label?: string;
|
|
5
|
+
value: string[];
|
|
6
|
+
onChange: (values: string[]) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Carregador simples: busca todas as opções de uma vez (filtro no cliente).
|
|
9
|
+
* Obrigatório se `loadPage` não for usado.
|
|
10
|
+
*/
|
|
11
|
+
loadOptions?: (params?: TParams) => Promise<TData[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Carregador paginado com busca no servidor + scroll infinito. Quando fornecido,
|
|
14
|
+
* tem prioridade sobre `loadOptions`.
|
|
15
|
+
*/
|
|
16
|
+
loadPage?: (args: LoadPageArgs<TParams>) => Promise<LoadPageResult<TData>>;
|
|
17
|
+
loadParams?: TParams;
|
|
18
|
+
getValue: (item: TData) => string;
|
|
19
|
+
getLabel: (item: TData) => string;
|
|
20
|
+
getSubLabel?: (item: TData) => string | undefined;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
searchPlaceholder?: string;
|
|
23
|
+
emptyText?: string;
|
|
24
|
+
loadingText?: string;
|
|
25
|
+
loadErrorText?: string;
|
|
26
|
+
helperText?: string;
|
|
27
|
+
errorText?: string;
|
|
28
|
+
error?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
readOnly?: boolean;
|
|
31
|
+
clearable?: boolean;
|
|
32
|
+
previewLimit?: number;
|
|
33
|
+
className?: string;
|
|
34
|
+
containerClassName?: string;
|
|
35
|
+
/** Debounce (ms) da busca no servidor quando `loadPage` é usado. Padrão: 300. */
|
|
36
|
+
searchDebounce?: number;
|
|
37
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './DashboardChart';
|
|
2
2
|
export * from './DatePicker';
|
|
3
|
+
export * from './DateRangePicker';
|
|
3
4
|
export * from './DateTimePicker';
|
|
4
5
|
export * from './DataTableActions';
|
|
5
6
|
export * from './Drawer';
|
|
@@ -17,7 +18,9 @@ export * from './PageLoadingSkeleton';
|
|
|
17
18
|
export * from './PageHeader';
|
|
18
19
|
export * from './Pagination';
|
|
19
20
|
export * from './PaymentInfo';
|
|
21
|
+
export * from './ComboboxSelect';
|
|
20
22
|
export * from './MultiSelect';
|
|
23
|
+
export * from './PopoverMultiSelect';
|
|
21
24
|
export * from './RadioGroup';
|
|
22
25
|
export * from './Section';
|
|
23
26
|
export * from './SidebarNav';
|
|
Binary file
|