@scbt-ecom/ui 0.22.8 → 0.23.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/shared/ui/formElements/controlled/index.d.ts +19 -13
- package/dist/shared/ui/formElements/controlled/select/SelectControl.d.ts +7 -3
- package/dist/shared/ui/formElements/uncontrolled/index.d.ts +14 -10
- package/dist/shared/ui/formElements/uncontrolled/select/Select.d.ts +55 -30
- package/dist/shared/ui/formElements/uncontrolled/select/hooks/useSelectController.d.ts +17 -0
- package/dist/shared/ui/formElements/uncontrolled/select/index.d.ts +1 -1
- package/dist/shared/ui/formElements/uncontrolled/select/model/index.d.ts +1 -0
- package/dist/shared/ui/formElements/uncontrolled/select/model/types.d.ts +14 -0
- package/dist/shared/ui/formElements/uncontrolled/select/ui/{control/ui/Chip.d.ts → Chip.d.ts} +1 -1
- package/dist/shared/ui/formElements/uncontrolled/select/ui/ChipList.d.ts +11 -0
- package/dist/shared/ui/formElements/uncontrolled/select/ui/SelectItem.d.ts +12 -20
- package/dist/shared/ui/formElements/uncontrolled/select/ui/index.d.ts +2 -3
- package/dist/ui.js +7415 -7531
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
- package/dist/shared/ui/formElements/uncontrolled/select/ui/SelectList.d.ts +0 -10
- package/dist/shared/ui/formElements/uncontrolled/select/ui/control/Control.d.ts +0 -16
- package/dist/shared/ui/formElements/uncontrolled/select/ui/control/hooks/useSelectController.d.ts +0 -52
- package/dist/shared/ui/formElements/uncontrolled/select/ui/control/index.d.ts +0 -1
- package/dist/shared/ui/formElements/uncontrolled/select/ui/control/ui/ChipList.d.ts +0 -11
- package/dist/shared/ui/formElements/uncontrolled/select/ui/control/ui/index.d.ts +0 -1
- /package/dist/shared/ui/formElements/uncontrolled/select/{ui/control/hooks → hooks}/index.d.ts +0 -0
|
@@ -37,31 +37,37 @@ export declare const Controlled: {
|
|
|
37
37
|
};
|
|
38
38
|
helperText?: string;
|
|
39
39
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
-
SelectControl: <TFieldValues extends import('react-hook-form').FieldValues = import('react-hook-form').FieldValues>({ control, classes, name, rules, shouldUnregister, disabled, defaultValue, returnValue, options, helperText, size, ...props }: import('react-hook-form').UseControllerProps<TFieldValues, import('react-hook-form').Path<TFieldValues>> & Omit<import('react
|
|
40
|
+
SelectControl: <TFieldValues extends import('react-hook-form').FieldValues = import('react-hook-form').FieldValues>({ control, classes, name, rules, shouldUnregister, disabled, defaultValue, returnValue, options, helperText, size, ...props }: import('react-hook-form').UseControllerProps<TFieldValues, import('react-hook-form').Path<TFieldValues>> & Omit<import('@headlessui/react').ComboboxProps<import('..').SelectItemOption, boolean, "li">, "onChange" | "className" | "multiple" | "by" | "virtual"> & {
|
|
41
|
+
label: string;
|
|
42
|
+
isMulti: boolean;
|
|
43
|
+
invalid?: boolean;
|
|
41
44
|
isSearchable?: boolean;
|
|
42
|
-
|
|
43
|
-
displayValue?: (option: import('..').SelectItemOption) => string;
|
|
45
|
+
options: import('..').SelectItemOption[];
|
|
44
46
|
classes?: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
item?: string;
|
|
48
|
+
helperText?: string;
|
|
49
|
+
} & {
|
|
50
|
+
root?: string;
|
|
51
|
+
list?: string;
|
|
49
52
|
};
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
displayValue?: (option: import('..').SelectItemOption) => string;
|
|
54
|
+
onChange?: (value: import('..').SelectItemOption | import('..').SelectItemOption[] | null) => void;
|
|
55
|
+
attachmentProps?: import('../../../types').DeepPartial<import('../ui').IFieldAttachmentProps>;
|
|
52
56
|
} & {
|
|
53
57
|
control: import('react-hook-form').Control<TFieldValues>;
|
|
54
58
|
classes?: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
item?: string;
|
|
60
|
+
helperText?: string;
|
|
61
|
+
} & {
|
|
62
|
+
root?: string;
|
|
63
|
+
list?: string;
|
|
59
64
|
} & {
|
|
60
65
|
container?: string;
|
|
61
66
|
message?: string;
|
|
62
67
|
};
|
|
63
68
|
helperText?: string;
|
|
64
69
|
size?: import('../ui').TFieldContainerConfig["size"];
|
|
70
|
+
returnValue?: (option: import('..').SelectItemOption) => string;
|
|
65
71
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
66
72
|
SwitchControl: <TFieldValues extends import('react-hook-form').FieldValues = import('react-hook-form').FieldValues>({ classes, className, control, name, rules, defaultValue, disabled, shouldUnregister, children, helperText, tooltip, popoverProps, ...props }: import('./switch/SwitchControl').SwitchControlProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
67
73
|
RadioGroupControl: <TFieldValues extends import('react-hook-form').FieldValues = import('react-hook-form').FieldValues>({ classes, className, control, name, rules, shouldUnregister, disabled, defaultValue, helperText, label, ...props }: import('react-hook-form').UseControllerProps<TFieldValues, import('react-hook-form').Path<TFieldValues>> & Omit<import('..').RadioGroupBaseProps, "classes"> & {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Control, FieldPath, FieldValues, UseControllerProps } from 'react-hook-form';
|
|
2
|
-
import { SelectBaseProps } from '../../..';
|
|
2
|
+
import { SelectBaseProps, SelectItemOption } from '../../..';
|
|
3
3
|
import { TFieldContainerConfig } from '../../ui';
|
|
4
|
-
type SelectControlClasses = SelectBaseProps['classes'] & {
|
|
4
|
+
type SelectControlClasses = SelectBaseProps<boolean>['classes'] & {
|
|
5
5
|
container?: string;
|
|
6
6
|
message?: string;
|
|
7
7
|
};
|
|
8
|
-
type SelectControlProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = UseControllerProps<TFieldValues, TName> & SelectBaseProps & {
|
|
8
|
+
type SelectControlProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = UseControllerProps<TFieldValues, TName> & SelectBaseProps<boolean> & {
|
|
9
9
|
/**
|
|
10
10
|
* Контрол объект для управления полем
|
|
11
11
|
*/
|
|
@@ -22,6 +22,10 @@ type SelectControlProps<TFieldValues extends FieldValues = FieldValues, TName ex
|
|
|
22
22
|
* Размер контейнера для поля
|
|
23
23
|
*/
|
|
24
24
|
size?: TFieldContainerConfig['size'];
|
|
25
|
+
/**
|
|
26
|
+
* Функция для управления возвращаемым значением
|
|
27
|
+
*/
|
|
28
|
+
returnValue?: (option: SelectItemOption) => string;
|
|
25
29
|
};
|
|
26
30
|
declare const InnerComponent: <TFieldValues extends FieldValues = FieldValues>({ control, classes, name, rules, shouldUnregister, disabled, defaultValue, returnValue, options, helperText, size, ...props }: SelectControlProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
27
31
|
export declare const SelectControl: typeof InnerComponent;
|
|
@@ -30,19 +30,23 @@ export declare const Uncontrolled: {
|
|
|
30
30
|
mask: "datetime" | "email" | "numeric" | "currency" | "decimal" | "integer" | "percentage" | "url" | "ip" | "mac" | "ssn" | "brl-currency" | "cpf" | "cnpj" | (string & {}) | (string[] & {}) | null;
|
|
31
31
|
externalMaskDefinitions?: Record<string, import('./maskInput/MaskInput').Definition>;
|
|
32
32
|
} & import('react').RefAttributes<HTMLInputElement>>;
|
|
33
|
-
SelectBase: import('react').ForwardRefExoticComponent<Omit<import('react
|
|
33
|
+
SelectBase: import('react').ForwardRefExoticComponent<Omit<import('@headlessui/react').ComboboxProps<import('./select').SelectItemOption, boolean, "li">, "onChange" | "className" | "multiple" | "by" | "virtual"> & {
|
|
34
|
+
label: string;
|
|
35
|
+
isMulti: boolean;
|
|
36
|
+
invalid?: boolean;
|
|
34
37
|
isSearchable?: boolean;
|
|
35
|
-
|
|
36
|
-
displayValue?: (option: import('./select').SelectItemOption) => string;
|
|
38
|
+
options: import('./select').SelectItemOption[];
|
|
37
39
|
classes?: {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
item?: string;
|
|
41
|
+
helperText?: string;
|
|
42
|
+
} & {
|
|
43
|
+
root?: string;
|
|
44
|
+
list?: string;
|
|
42
45
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
displayValue?: (option: import('./select').SelectItemOption) => string;
|
|
47
|
+
onChange?: (value: import('./select').SelectItemOption | import('./select').SelectItemOption[] | null) => void;
|
|
48
|
+
attachmentProps?: import('../../../types').DeepPartial<import('../ui').IFieldAttachmentProps>;
|
|
49
|
+
} & import('react').RefAttributes<HTMLElement>>;
|
|
46
50
|
CheckboxBase: import('react').ForwardRefExoticComponent<import('@radix-ui/react-checkbox').CheckboxProps & {
|
|
47
51
|
classes?: {
|
|
48
52
|
root?: string;
|
|
@@ -1,62 +1,87 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ComboboxProps } from '@headlessui/react';
|
|
2
|
+
import { SelectItemOption } from './model';
|
|
3
|
+
import { SelectItemProps } from './ui';
|
|
4
|
+
import { DeepPartial } from '../../../../types';
|
|
5
|
+
import { FieldAttachment } from '../../ui';
|
|
6
|
+
type FieldAttachmentProps = React.ComponentPropsWithoutRef<typeof FieldAttachment>;
|
|
7
|
+
type SelectClasses = SelectItemProps['classes'] & {
|
|
8
|
+
root?: string;
|
|
9
|
+
list?: string;
|
|
9
10
|
};
|
|
10
|
-
export type SelectBaseProps<
|
|
11
|
+
export type SelectBaseProps<Multi extends boolean> = Omit<ComboboxProps<SelectItemOption, Multi, 'li'>, 'multiple' | 'onChange' | 'by' | 'virtual' | 'className'> & {
|
|
12
|
+
/**
|
|
13
|
+
* Отображаемый лейбл
|
|
14
|
+
*/
|
|
15
|
+
label: string;
|
|
16
|
+
/**
|
|
17
|
+
* Поддержка множественного выбора
|
|
18
|
+
*/
|
|
19
|
+
isMulti: Multi;
|
|
20
|
+
/**
|
|
21
|
+
* Пометить поле как не валидное
|
|
22
|
+
*/
|
|
23
|
+
invalid?: boolean;
|
|
11
24
|
/**
|
|
12
25
|
* Свойство управляющее поиском
|
|
13
26
|
*/
|
|
14
27
|
isSearchable?: boolean;
|
|
15
28
|
/**
|
|
16
|
-
*
|
|
29
|
+
* Список отображаемых значений
|
|
17
30
|
*/
|
|
18
|
-
|
|
31
|
+
options: SelectItemOption[];
|
|
32
|
+
/**
|
|
33
|
+
* Дополнительные стили каждого внутреннего элемента
|
|
34
|
+
*/
|
|
35
|
+
classes?: SelectClasses;
|
|
19
36
|
/**
|
|
20
37
|
* Функция для управления отображаемым значением
|
|
21
38
|
*/
|
|
22
39
|
displayValue?: (option: SelectItemOption) => string;
|
|
23
40
|
/**
|
|
24
|
-
*
|
|
41
|
+
* Функция для изменения значения
|
|
25
42
|
*/
|
|
26
|
-
|
|
43
|
+
onChange?: (value: SelectItemOption | SelectItemOption[] | null) => void;
|
|
27
44
|
/**
|
|
28
|
-
*
|
|
45
|
+
* Свойства дополнительной иконки
|
|
29
46
|
*/
|
|
30
|
-
|
|
47
|
+
attachmentProps?: DeepPartial<FieldAttachmentProps>;
|
|
48
|
+
};
|
|
49
|
+
export declare const SelectBase: import('react').ForwardRefExoticComponent<Omit<ComboboxProps<SelectItemOption, boolean, "li">, "onChange" | "className" | "multiple" | "by" | "virtual"> & {
|
|
31
50
|
/**
|
|
32
|
-
*
|
|
51
|
+
* Отображаемый лейбл
|
|
33
52
|
*/
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
export declare const SelectBase: import('react').ForwardRefExoticComponent<Omit<Props<SelectItemOption, boolean>, "options" | "defaultValue" | "placeholder" | "isSearchable"> & Pick<InputBaseProps, "invalid" | "label" | "attachmentProps"> & {
|
|
53
|
+
label: string;
|
|
37
54
|
/**
|
|
38
|
-
*
|
|
55
|
+
* Поддержка множественного выбора
|
|
39
56
|
*/
|
|
40
|
-
|
|
57
|
+
isMulti: boolean;
|
|
41
58
|
/**
|
|
42
|
-
*
|
|
59
|
+
* Пометить поле как не валидное
|
|
43
60
|
*/
|
|
44
|
-
|
|
61
|
+
invalid?: boolean;
|
|
45
62
|
/**
|
|
46
|
-
*
|
|
63
|
+
* Свойство управляющее поиском
|
|
47
64
|
*/
|
|
48
|
-
|
|
65
|
+
isSearchable?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Список отображаемых значений
|
|
68
|
+
*/
|
|
69
|
+
options: SelectItemOption[];
|
|
49
70
|
/**
|
|
50
71
|
* Дополнительные стили каждого внутреннего элемента
|
|
51
72
|
*/
|
|
52
73
|
classes?: SelectClasses;
|
|
53
74
|
/**
|
|
54
|
-
*
|
|
75
|
+
* Функция для управления отображаемым значением
|
|
55
76
|
*/
|
|
56
|
-
|
|
77
|
+
displayValue?: (option: SelectItemOption) => string;
|
|
78
|
+
/**
|
|
79
|
+
* Функция для изменения значения
|
|
80
|
+
*/
|
|
81
|
+
onChange?: (value: SelectItemOption | SelectItemOption[] | null) => void;
|
|
57
82
|
/**
|
|
58
|
-
*
|
|
83
|
+
* Свойства дополнительной иконки
|
|
59
84
|
*/
|
|
60
|
-
|
|
61
|
-
} & import('react').RefAttributes<
|
|
85
|
+
attachmentProps?: DeepPartial<FieldAttachmentProps>;
|
|
86
|
+
} & import('react').RefAttributes<HTMLElement>>;
|
|
62
87
|
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SelectItemOption } from '../model';
|
|
2
|
+
type UseSelectControllerProps = {
|
|
3
|
+
options: SelectItemOption[];
|
|
4
|
+
isMulti?: boolean;
|
|
5
|
+
isSearchable?: boolean;
|
|
6
|
+
displayValue?: (option: SelectItemOption) => string;
|
|
7
|
+
onChange?: (value: SelectItemOption | SelectItemOption[] | null) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const useSelectController: ({ options: initialOptions, displayValue, isSearchable, onChange }: UseSelectControllerProps) => {
|
|
10
|
+
options: SelectItemOption[];
|
|
11
|
+
inputValue: string;
|
|
12
|
+
onInputValueChange: import('react').ChangeEventHandler<HTMLInputElement>;
|
|
13
|
+
onValueChange: (value: SelectItemOption | SelectItemOption[] | null) => void;
|
|
14
|
+
onDeleteItem: (values: SelectItemOption | SelectItemOption[], option: SelectItemOption) => void;
|
|
15
|
+
selectDisplayValue: (value: SelectItemOption | SelectItemOption[] | null) => string | undefined;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { SelectBase, type SelectBaseProps } from './Select';
|
|
2
|
-
export type { SelectItemOption } from './
|
|
2
|
+
export type { SelectItemOption } from './model';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from './types';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DeepPartial } from '../../../../../types';
|
|
2
|
+
import { FieldAttachment } from '../../../ui';
|
|
3
|
+
type FieldAttachmentProps = React.ComponentPropsWithoutRef<typeof FieldAttachment>;
|
|
4
|
+
export type SelectItemOption = {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
helperText?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
attachment?: {
|
|
10
|
+
left?: DeepPartial<FieldAttachmentProps>;
|
|
11
|
+
right?: DeepPartial<FieldAttachmentProps>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
import { SelectItemOption } from '../model';
|
|
3
|
+
import { ControlChipProps } from './Chip';
|
|
4
|
+
type ControlChipListProps = Omit<ControlChipProps, 'data'> & {
|
|
5
|
+
values: SelectItemOption | SelectItemOption[];
|
|
6
|
+
inputValue: string;
|
|
7
|
+
onInputValueChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
onDeleteItem: (option: SelectItemOption) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const ChipList: ({ values, onDeleteItem, inputValue, onInputValueChange, ...props }: ControlChipListProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
value: string;
|
|
8
|
-
label: string;
|
|
9
|
-
additionalText?: string;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
attachment?: {
|
|
12
|
-
left?: DeepPartial<FieldAttachmentProps>;
|
|
13
|
-
right?: DeepPartial<FieldAttachmentProps>;
|
|
14
|
-
};
|
|
1
|
+
import { ComboboxOptionProps } from '@headlessui/react';
|
|
2
|
+
import { motion } from 'framer-motion';
|
|
3
|
+
import { SelectItemOption } from '../model';
|
|
4
|
+
type SelectItemClasses = {
|
|
5
|
+
item?: string;
|
|
6
|
+
helperText?: string;
|
|
15
7
|
};
|
|
16
|
-
export type
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
type SelectItemProps = OptionProps<SelectItemOption> & {
|
|
8
|
+
export type SelectItemProps = Omit<ComboboxOptionProps, 'className' | 'value'> & {
|
|
9
|
+
option: SelectItemOption;
|
|
10
|
+
isMulti?: boolean;
|
|
21
11
|
classes?: SelectItemClasses;
|
|
12
|
+
displayValue?: (option: SelectItemOption) => string;
|
|
13
|
+
motionProps?: React.ComponentPropsWithoutRef<typeof motion.li>;
|
|
22
14
|
};
|
|
23
|
-
export declare const SelectItem: ({
|
|
15
|
+
export declare const SelectItem: ({ option, classes, displayValue, isMulti, motionProps, ...props }: SelectItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
16
|
export {};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export * from './SelectList';
|
|
1
|
+
export { SelectItem, type SelectItemProps } from './SelectItem';
|
|
2
|
+
export { ChipList } from './ChipList';
|