@scbt-ecom/ui 0.27.2 → 0.28.1
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/hooks/useOverflow.d.ts +1 -0
- package/dist/shared/ui/formElements/controlled/dayPickerControl/dayPickerControl.d.ts +10 -0
- package/dist/shared/ui/formElements/controlled/dayPickerControl/range.d.ts +12 -0
- package/dist/shared/ui/formElements/controlled/dayPickerControl/single.d.ts +18 -1
- package/dist/shared/ui/formElements/controlled/index.d.ts +7 -0
- package/dist/shared/ui/formElements/controlled/uploader/UploaderControl.d.ts +12 -0
- package/dist/shared/ui/formElements/controlled/uploader/index.d.ts +1 -0
- package/dist/shared/ui/formElements/index.d.ts +0 -1
- package/dist/shared/ui/formElements/uncontrolled/checkbox/Checkbox.d.ts +14 -0
- package/dist/shared/ui/formElements/uncontrolled/dayPicker/DayPicker.d.ts +15 -0
- package/dist/shared/ui/formElements/uncontrolled/index.d.ts +44 -0
- package/dist/shared/ui/formElements/uncontrolled/input/Input.d.ts +14 -0
- package/dist/shared/ui/formElements/uncontrolled/maskInput/MaskInput.d.ts +6 -0
- package/dist/shared/ui/formElements/uncontrolled/radio/RadioGroup.d.ts +14 -0
- package/dist/shared/ui/formElements/uncontrolled/switch/Switch.d.ts +8 -0
- package/dist/shared/ui/formElements/uncontrolled/textarea/Textarea.d.ts +14 -0
- package/dist/shared/ui/formElements/uncontrolled/uploader/UploaderBase.d.ts +38 -0
- package/dist/shared/ui/formElements/uncontrolled/uploader/index.d.ts +2 -0
- package/dist/shared/ui/formElements/{uploaderControl → uncontrolled/uploader}/model/helpers.d.ts +2 -0
- package/dist/shared/ui/formElements/{uploaderControl → uncontrolled/uploader}/model/hooks/useUploader.d.ts +2 -2
- package/dist/shared/ui/formElements/uncontrolled/uploader/model/index.d.ts +1 -0
- package/dist/shared/ui/formElements/uncontrolled/uploader/ui/UploaderFile.d.ts +19 -0
- package/dist/shared/ui/formElements/uncontrolled/uploader/ui/UploaderFilename.d.ts +9 -0
- package/dist/shared/ui/formElements/uncontrolled/uploader/ui/UploaderFiles.d.ts +16 -0
- package/dist/shared/ui/formElements/uncontrolled/uploader/ui/UploaderInput.d.ts +17 -0
- package/dist/shared/ui/formElements/uncontrolled/uploader/ui/index.d.ts +4 -0
- package/dist/shared/utils/index.d.ts +1 -0
- package/dist/shared/utils/typeGuards.d.ts +9 -0
- package/dist/typeGuards-CaNkXs7N.js +36 -0
- package/dist/typeGuards-CaNkXs7N.js.map +1 -0
- package/dist/ui.js +9129 -9077
- package/dist/ui.js.map +1 -1
- package/dist/utils.js +5 -4
- package/package.json +1 -1
- package/dist/mergeRefs-qDToYXtM.js +0 -12
- package/dist/mergeRefs-qDToYXtM.js.map +0 -1
- package/dist/shared/ui/formElements/uploaderControl/UploaderControl.d.ts +0 -10
- package/dist/shared/ui/formElements/uploaderControl/index.d.ts +0 -1
- package/dist/shared/ui/formElements/uploaderControl/model/index.d.ts +0 -1
- package/dist/shared/ui/formElements/uploaderControl/model/types.d.ts +0 -24
- package/dist/shared/ui/formElements/uploaderControl/ui/File.d.ts +0 -12
- package/dist/shared/ui/formElements/uploaderControl/ui/Filename.d.ts +0 -7
- package/dist/shared/ui/formElements/uploaderControl/ui/Files.d.ts +0 -12
- package/dist/shared/ui/formElements/uploaderControl/ui/Input.d.ts +0 -11
- package/dist/shared/ui/formElements/uploaderControl/ui/Uploader.d.ts +0 -15
- package/dist/shared/ui/formElements/uploaderControl/ui/index.d.ts +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useOverflow: (ref: React.RefObject<HTMLElement>) => boolean;
|
|
@@ -4,6 +4,12 @@ type CalendarProps = React.ComponentPropsWithoutRef<typeof Calendar>;
|
|
|
4
4
|
type DayPickerControlClasses = MaskInputProps['classes'] & {
|
|
5
5
|
message?: string;
|
|
6
6
|
};
|
|
7
|
+
export type ExternalHandlers = {
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
10
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
11
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
12
|
+
};
|
|
7
13
|
export type DayPickerControlProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = UseControllerProps<TFieldValues, TName> & Omit<CalendarProps, 'selected' | 'onSelect' | 'mode'> & {
|
|
8
14
|
/**
|
|
9
15
|
* Контрол объект для управления полем
|
|
@@ -21,6 +27,10 @@ export type DayPickerControlProps<TFieldValues extends FieldValues = FieldValues
|
|
|
21
27
|
* Дополнительные стили компонента
|
|
22
28
|
*/
|
|
23
29
|
classes?: DayPickerControlClasses;
|
|
30
|
+
/**
|
|
31
|
+
* Дополнительные хендлеры
|
|
32
|
+
*/
|
|
33
|
+
externalHandlers?: ExternalHandlers;
|
|
24
34
|
};
|
|
25
35
|
declare const InnerComponent: <T extends FieldValues = FieldValues>({ control, name, disabled, rules, shouldUnregister, defaultValue, inputProps, helperText, classes, ...props }: DayPickerControlProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
26
36
|
export declare const DayPickerControl: typeof InnerComponent;
|
|
@@ -8,9 +8,21 @@ type IsoDateRange = {
|
|
|
8
8
|
to?: string;
|
|
9
9
|
};
|
|
10
10
|
type RangeDayPickerProps = Omit<CalendarProps, 'mode'> & {
|
|
11
|
+
/**
|
|
12
|
+
* Свойства Input компонента
|
|
13
|
+
*/
|
|
11
14
|
inputProps: Omit<MaskInputProps, 'mask'>;
|
|
15
|
+
/**
|
|
16
|
+
* Стили внутренних компонентов
|
|
17
|
+
*/
|
|
12
18
|
classes?: RangeDayPickerClasses;
|
|
19
|
+
/**
|
|
20
|
+
* Управляемое значение
|
|
21
|
+
*/
|
|
13
22
|
value: IsoDateRange;
|
|
23
|
+
/**
|
|
24
|
+
* Функция для управления значением
|
|
25
|
+
*/
|
|
14
26
|
onChange: (value: IsoDateRange) => void;
|
|
15
27
|
};
|
|
16
28
|
export declare const RangeDayPicker: ({ inputProps, classes, value, onChange, ...props }: RangeDayPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
+
import { ExternalHandlers } from './dayPickerControl';
|
|
1
2
|
import { Calendar, MaskInputProps } from '../../..';
|
|
2
3
|
type CalendarProps = React.ComponentPropsWithoutRef<typeof Calendar>;
|
|
3
4
|
type SingleDayPickerClasses = MaskInputProps['classes'] & {
|
|
4
5
|
calendar?: string;
|
|
5
6
|
};
|
|
6
7
|
type SingleDayPickerProps = Omit<CalendarProps, 'mode'> & {
|
|
8
|
+
/**
|
|
9
|
+
* Свойства Input компонента
|
|
10
|
+
*/
|
|
7
11
|
inputProps: Omit<MaskInputProps, 'mask'>;
|
|
12
|
+
/**
|
|
13
|
+
* Стили внутренних компонентов
|
|
14
|
+
*/
|
|
8
15
|
classes?: SingleDayPickerClasses;
|
|
16
|
+
/**
|
|
17
|
+
* Управляемое значение
|
|
18
|
+
*/
|
|
9
19
|
value: string;
|
|
20
|
+
/**
|
|
21
|
+
* Функция для управления значением
|
|
22
|
+
*/
|
|
10
23
|
onChange: (value: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Дополнительные хендлеры
|
|
26
|
+
*/
|
|
27
|
+
externalHandlers?: ExternalHandlers;
|
|
11
28
|
};
|
|
12
|
-
export declare const SingleDayPicker: ({ inputProps, classes, value, onChange, ...props }: SingleDayPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const SingleDayPicker: ({ inputProps, classes, value, onChange, externalHandlers, ...props }: SingleDayPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
30
|
export {};
|
|
@@ -107,4 +107,11 @@ export declare const Controlled: {
|
|
|
107
107
|
formatter?: (item: import('./dadata/types').IDadataOrganizationOption) => import('..').SelectItemOption;
|
|
108
108
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
109
109
|
TextareaControl: <TFieldValues extends import('react-hook-form').FieldValues = import('react-hook-form').FieldValues>({ classes, control, name, rules, disabled, defaultValue, shouldUnregister, helperText, ...props }: import('./textarea').TextareaControlProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
110
|
+
UploaderControl: ({ control, name, defaultValue, rules, shouldUnregister, classes, helperText, disabled, ...props }: import('react-hook-form').UseControllerProps<import('react-hook-form').FieldValues, string> & import('../uncontrolled/uploader').UploaderBaseProps & {
|
|
111
|
+
control: import('react-hook-form').Control<import('react-hook-form').FieldValues>;
|
|
112
|
+
classes?: import('../uncontrolled/uploader').UploaderBaseProps & {
|
|
113
|
+
message?: string;
|
|
114
|
+
container?: string;
|
|
115
|
+
};
|
|
116
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
110
117
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Control, FieldValues, Path, UseControllerProps } from 'react-hook-form';
|
|
2
|
+
import { UploaderBaseProps } from '../../uncontrolled/uploader';
|
|
3
|
+
type UploaderControlClasses = UploaderBaseProps & {
|
|
4
|
+
message?: string;
|
|
5
|
+
container?: string;
|
|
6
|
+
};
|
|
7
|
+
type UploaderControlProps<TFieldValues extends FieldValues = FieldValues, TName extends Path<TFieldValues> = Path<TFieldValues>> = UseControllerProps<TFieldValues, TName> & UploaderBaseProps & {
|
|
8
|
+
control: Control<TFieldValues>;
|
|
9
|
+
classes?: UploaderControlClasses;
|
|
10
|
+
};
|
|
11
|
+
export declare const UploaderControl: ({ control, name, defaultValue, rules, shouldUnregister, classes, helperText, disabled, ...props }: UploaderControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UploaderControl } from './UploaderControl';
|
|
@@ -7,7 +7,6 @@ export * from './dadataControl';
|
|
|
7
7
|
export * from './comboboxControl';
|
|
8
8
|
export * from './sliderControl';
|
|
9
9
|
export * from './editorControl';
|
|
10
|
-
export * from './uploaderControl';
|
|
11
10
|
export * from './radioControl';
|
|
12
11
|
export * from './inputCurrencyControl';
|
|
13
12
|
export * from './InputOtpControl';
|
|
@@ -4,6 +4,12 @@ type CheckboxBaseClasses = {
|
|
|
4
4
|
indicator?: string;
|
|
5
5
|
};
|
|
6
6
|
export type { CheckedState };
|
|
7
|
+
type ExternalHandlers = {
|
|
8
|
+
onChange?: (value: CheckedState) => void;
|
|
9
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
|
+
onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
11
|
+
onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
12
|
+
};
|
|
7
13
|
export type CheckboxBaseProps = CheckboxPrimitiveProps & {
|
|
8
14
|
/**
|
|
9
15
|
* Дополнительные стили внутренних компонентов
|
|
@@ -13,6 +19,10 @@ export type CheckboxBaseProps = CheckboxPrimitiveProps & {
|
|
|
13
19
|
* Свойство для отображения не валидного поля
|
|
14
20
|
*/
|
|
15
21
|
invalid?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Дополнительные хендлеры
|
|
24
|
+
*/
|
|
25
|
+
externalHandlers?: ExternalHandlers;
|
|
16
26
|
};
|
|
17
27
|
export declare const CheckboxBase: import('react').ForwardRefExoticComponent<CheckboxPrimitiveProps & {
|
|
18
28
|
/**
|
|
@@ -23,4 +33,8 @@ export declare const CheckboxBase: import('react').ForwardRefExoticComponent<Che
|
|
|
23
33
|
* Свойство для отображения не валидного поля
|
|
24
34
|
*/
|
|
25
35
|
invalid?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Дополнительные хендлеры
|
|
38
|
+
*/
|
|
39
|
+
externalHandlers?: ExternalHandlers;
|
|
26
40
|
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { MaskInputProps } from '../../..';
|
|
2
|
+
type ExternalHandlers = {
|
|
3
|
+
onChange?: (value: string) => void;
|
|
4
|
+
onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
5
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
6
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
7
|
+
};
|
|
2
8
|
export type DayPickerProps = Omit<MaskInputProps, 'value' | 'onChange' | 'mask'> & {
|
|
3
9
|
/**
|
|
4
10
|
* Указывает, открыт ли календарь по умолчанию
|
|
@@ -12,6 +18,10 @@ export type DayPickerProps = Omit<MaskInputProps, 'value' | 'onChange' | 'mask'>
|
|
|
12
18
|
* Функция изменения значения
|
|
13
19
|
*/
|
|
14
20
|
onChange?: (value: string) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Дополнительные хендлеры
|
|
23
|
+
*/
|
|
24
|
+
externalHandlers?: ExternalHandlers;
|
|
15
25
|
};
|
|
16
26
|
export declare const DayPickerBase: import('react').ForwardRefExoticComponent<Omit<MaskInputProps, "value" | "onChange" | "mask"> & {
|
|
17
27
|
/**
|
|
@@ -26,4 +36,9 @@ export declare const DayPickerBase: import('react').ForwardRefExoticComponent<Om
|
|
|
26
36
|
* Функция изменения значения
|
|
27
37
|
*/
|
|
28
38
|
onChange?: (value: string) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Дополнительные хендлеры
|
|
41
|
+
*/
|
|
42
|
+
externalHandlers?: ExternalHandlers;
|
|
29
43
|
} & import('react').RefAttributes<HTMLInputElement>>;
|
|
44
|
+
export {};
|
|
@@ -2,6 +2,7 @@ export type { InputBaseProps } from './input';
|
|
|
2
2
|
export type { MaskInputProps } from './maskInput';
|
|
3
3
|
export type { SelectBaseProps, SelectItemOption } from './select';
|
|
4
4
|
export type { CheckboxBaseProps, CheckedState } from './checkbox';
|
|
5
|
+
export type { DayPickerProps } from './dayPicker';
|
|
5
6
|
export type { SwitchBaseProps } from './switch';
|
|
6
7
|
export type { AutocompleteBaseProps } from './autocomplete';
|
|
7
8
|
export type { RadioGroupBaseProps, RadioOption } from './radio';
|
|
@@ -17,6 +18,12 @@ export declare const Uncontrolled: {
|
|
|
17
18
|
invalid?: boolean;
|
|
18
19
|
attachmentProps?: import('../../../types').DeepPartial<import('../ui').IFieldAttachmentProps>;
|
|
19
20
|
renderValues?: () => React.JSX.Element | null;
|
|
21
|
+
externalHandlers?: {
|
|
22
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
23
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
24
|
+
onFocus?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
25
|
+
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
26
|
+
};
|
|
20
27
|
} & import('react').RefAttributes<HTMLInputElement>>;
|
|
21
28
|
MaskInput: import('react').ForwardRefExoticComponent<Omit<import('react').InputHTMLAttributes<HTMLInputElement>, "size" | "placeholder"> & {
|
|
22
29
|
classes?: {
|
|
@@ -28,6 +35,12 @@ export declare const Uncontrolled: {
|
|
|
28
35
|
invalid?: boolean;
|
|
29
36
|
attachmentProps?: import('../../../types').DeepPartial<import('../ui').IFieldAttachmentProps>;
|
|
30
37
|
renderValues?: () => React.JSX.Element | null;
|
|
38
|
+
externalHandlers?: {
|
|
39
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
40
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
41
|
+
onFocus?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
42
|
+
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
43
|
+
};
|
|
31
44
|
} & {
|
|
32
45
|
mask: "datetime" | "email" | "numeric" | "currency" | "decimal" | "integer" | "percentage" | "url" | "ip" | "mac" | "ssn" | "brl-currency" | "cpf" | "cnpj" | (string & {}) | (string[] & {}) | null;
|
|
33
46
|
externalMaskDefinitions?: Record<string, import('./maskInput/MaskInput').Definition>;
|
|
@@ -54,11 +67,23 @@ export declare const Uncontrolled: {
|
|
|
54
67
|
indicator?: string;
|
|
55
68
|
};
|
|
56
69
|
invalid?: boolean;
|
|
70
|
+
externalHandlers?: {
|
|
71
|
+
onChange?: (value: import('@radix-ui/react-checkbox').CheckedState) => void;
|
|
72
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
73
|
+
onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
74
|
+
onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
75
|
+
};
|
|
57
76
|
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
58
77
|
DayPickerBase: import('react').ForwardRefExoticComponent<Omit<import('./maskInput').MaskInputProps, "value" | "onChange" | "mask"> & {
|
|
59
78
|
defaultOpen?: boolean;
|
|
60
79
|
value?: string;
|
|
61
80
|
onChange?: (value: string) => void;
|
|
81
|
+
externalHandlers?: {
|
|
82
|
+
onChange?: (value: string) => void;
|
|
83
|
+
onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
84
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
85
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
86
|
+
};
|
|
62
87
|
} & import('react').RefAttributes<HTMLInputElement>>;
|
|
63
88
|
AutocompleteBase: <TData>({ formatter, query, value, returnValue, onChange, ...props }: import('./autocomplete').AutocompleteBaseProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
64
89
|
SwitchBase: import('react').ForwardRefExoticComponent<import('@radix-ui/react-switch').SwitchProps & {
|
|
@@ -66,6 +91,12 @@ export declare const Uncontrolled: {
|
|
|
66
91
|
root?: string;
|
|
67
92
|
thumb?: string;
|
|
68
93
|
};
|
|
94
|
+
externalHandlers?: {
|
|
95
|
+
onChange?: (value: boolean) => void;
|
|
96
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
97
|
+
onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
98
|
+
onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
99
|
+
};
|
|
69
100
|
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
70
101
|
RadioGroupBase: import('react').ForwardRefExoticComponent<Omit<import('@radix-ui/react-radio-group').RadioGroupProps, "children"> & {
|
|
71
102
|
options: import('./radio').RadioOption[];
|
|
@@ -80,6 +111,12 @@ export declare const Uncontrolled: {
|
|
|
80
111
|
list?: string;
|
|
81
112
|
};
|
|
82
113
|
invalid?: boolean;
|
|
114
|
+
externalHandlers?: {
|
|
115
|
+
onChange?: (value: string) => void;
|
|
116
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
117
|
+
onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
118
|
+
onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
119
|
+
};
|
|
83
120
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
84
121
|
TextareaBase: import('react').ForwardRefExoticComponent<Omit<import('react').TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "className"> & {
|
|
85
122
|
classes?: {
|
|
@@ -90,5 +127,12 @@ export declare const Uncontrolled: {
|
|
|
90
127
|
label: string;
|
|
91
128
|
invalid?: boolean;
|
|
92
129
|
attachmentProps?: import('../../../types').DeepPartial<import('../ui').IFieldAttachmentProps>;
|
|
130
|
+
externalHandlers?: {
|
|
131
|
+
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
132
|
+
onClick?: (event: React.MouseEvent<HTMLTextAreaElement>) => void;
|
|
133
|
+
onFocus?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
134
|
+
onBlur?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
135
|
+
};
|
|
93
136
|
} & import('react').RefAttributes<HTMLTextAreaElement>>;
|
|
137
|
+
UploaderBase: import('react').ForwardRefExoticComponent<import('./uploader').UploaderBaseProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
94
138
|
};
|
|
@@ -6,6 +6,12 @@ type InputBaseClasses = {
|
|
|
6
6
|
label?: string;
|
|
7
7
|
};
|
|
8
8
|
type FieldAttachmentProps = React.ComponentPropsWithoutRef<typeof FieldAttachment>;
|
|
9
|
+
type ExternalHandlers = {
|
|
10
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
11
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
12
|
+
onFocus?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
13
|
+
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
14
|
+
};
|
|
9
15
|
export type InputBaseProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'placeholder' | 'size'> & {
|
|
10
16
|
/**
|
|
11
17
|
* Дополнительные стили внутренних компонентов
|
|
@@ -27,6 +33,10 @@ export type InputBaseProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, '
|
|
|
27
33
|
* Рендер дополнительных значений вместо базового ввода
|
|
28
34
|
*/
|
|
29
35
|
renderValues?: () => React.JSX.Element | null;
|
|
36
|
+
/**
|
|
37
|
+
* Дополнительные хендлеры
|
|
38
|
+
*/
|
|
39
|
+
externalHandlers?: ExternalHandlers;
|
|
30
40
|
};
|
|
31
41
|
export declare const InputBase: import('react').ForwardRefExoticComponent<Omit<import('react').InputHTMLAttributes<HTMLInputElement>, "size" | "placeholder"> & {
|
|
32
42
|
/**
|
|
@@ -49,5 +59,9 @@ export declare const InputBase: import('react').ForwardRefExoticComponent<Omit<i
|
|
|
49
59
|
* Рендер дополнительных значений вместо базового ввода
|
|
50
60
|
*/
|
|
51
61
|
renderValues?: () => React.JSX.Element | null;
|
|
62
|
+
/**
|
|
63
|
+
* Дополнительные хендлеры
|
|
64
|
+
*/
|
|
65
|
+
externalHandlers?: ExternalHandlers;
|
|
52
66
|
} & import('react').RefAttributes<HTMLInputElement>>;
|
|
53
67
|
export {};
|
|
@@ -35,6 +35,12 @@ export declare const MaskInput: import('react').ForwardRefExoticComponent<Omit<i
|
|
|
35
35
|
invalid?: boolean;
|
|
36
36
|
attachmentProps?: import('../../../../types').DeepPartial<import('../../ui').IFieldAttachmentProps>;
|
|
37
37
|
renderValues?: () => React.JSX.Element | null;
|
|
38
|
+
externalHandlers?: {
|
|
39
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
40
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
41
|
+
onFocus?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
42
|
+
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
43
|
+
};
|
|
38
44
|
} & {
|
|
39
45
|
/**
|
|
40
46
|
* маска, по которой будет определяться валидация символов
|
|
@@ -4,6 +4,12 @@ type RadioGroupClasses = RadioItemProps['classes'] & {
|
|
|
4
4
|
root?: string;
|
|
5
5
|
list?: string;
|
|
6
6
|
};
|
|
7
|
+
type ExternalHandlers = {
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
|
+
onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
11
|
+
onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
12
|
+
};
|
|
7
13
|
export type RadioGroupBaseProps = Omit<RadioGroupPrimitiveProps, 'children'> & {
|
|
8
14
|
/**
|
|
9
15
|
* Список отображаемых опций
|
|
@@ -25,6 +31,10 @@ export type RadioGroupBaseProps = Omit<RadioGroupPrimitiveProps, 'children'> & {
|
|
|
25
31
|
* Свойство для отображения не валидного поля
|
|
26
32
|
*/
|
|
27
33
|
invalid?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Дополнительные хендлеры
|
|
36
|
+
*/
|
|
37
|
+
externalHandlers?: ExternalHandlers;
|
|
28
38
|
};
|
|
29
39
|
export declare const RadioGroupBase: import('react').ForwardRefExoticComponent<Omit<RadioGroupPrimitiveProps, "children"> & {
|
|
30
40
|
/**
|
|
@@ -47,5 +57,9 @@ export declare const RadioGroupBase: import('react').ForwardRefExoticComponent<O
|
|
|
47
57
|
* Свойство для отображения не валидного поля
|
|
48
58
|
*/
|
|
49
59
|
invalid?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Дополнительные хендлеры
|
|
62
|
+
*/
|
|
63
|
+
externalHandlers?: ExternalHandlers;
|
|
50
64
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
51
65
|
export {};
|
|
@@ -3,10 +3,18 @@ type SwitchBaseClasses = {
|
|
|
3
3
|
root?: string;
|
|
4
4
|
thumb?: string;
|
|
5
5
|
};
|
|
6
|
+
type ExternalHandlers = {
|
|
7
|
+
onChange?: (value: boolean) => void;
|
|
8
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
9
|
+
onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
10
|
+
onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
11
|
+
};
|
|
6
12
|
export type SwitchBaseProps = SwitchProps & {
|
|
7
13
|
classes?: SwitchBaseClasses;
|
|
14
|
+
externalHandlers?: ExternalHandlers;
|
|
8
15
|
};
|
|
9
16
|
export declare const SwitchBase: import('react').ForwardRefExoticComponent<SwitchProps & {
|
|
10
17
|
classes?: SwitchBaseClasses;
|
|
18
|
+
externalHandlers?: ExternalHandlers;
|
|
11
19
|
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
12
20
|
export {};
|
|
@@ -6,6 +6,12 @@ type TextareaBaseClasses = {
|
|
|
6
6
|
label?: string;
|
|
7
7
|
};
|
|
8
8
|
type FieldAttachmentProps = React.ComponentPropsWithoutRef<typeof FieldAttachment>;
|
|
9
|
+
type ExternalHandlers = {
|
|
10
|
+
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
11
|
+
onClick?: (event: React.MouseEvent<HTMLTextAreaElement>) => void;
|
|
12
|
+
onFocus?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
13
|
+
onBlur?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
14
|
+
};
|
|
9
15
|
export type TextareaBaseProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size' | 'className'> & {
|
|
10
16
|
/**
|
|
11
17
|
* Дополнительные стили внутренних компонентов
|
|
@@ -23,6 +29,10 @@ export type TextareaBaseProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaEl
|
|
|
23
29
|
* Свойства дополнительной иконки
|
|
24
30
|
*/
|
|
25
31
|
attachmentProps?: DeepPartial<FieldAttachmentProps>;
|
|
32
|
+
/**
|
|
33
|
+
* Дополнительные хендлеры
|
|
34
|
+
*/
|
|
35
|
+
externalHandlers?: ExternalHandlers;
|
|
26
36
|
};
|
|
27
37
|
export declare const TextareaBase: import('react').ForwardRefExoticComponent<Omit<import('react').TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "className"> & {
|
|
28
38
|
/**
|
|
@@ -41,5 +51,9 @@ export declare const TextareaBase: import('react').ForwardRefExoticComponent<Omi
|
|
|
41
51
|
* Свойства дополнительной иконки
|
|
42
52
|
*/
|
|
43
53
|
attachmentProps?: DeepPartial<FieldAttachmentProps>;
|
|
54
|
+
/**
|
|
55
|
+
* Дополнительные хендлеры
|
|
56
|
+
*/
|
|
57
|
+
externalHandlers?: ExternalHandlers;
|
|
44
58
|
} & import('react').RefAttributes<HTMLTextAreaElement>>;
|
|
45
59
|
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { DropzoneOptions } from 'react-dropzone';
|
|
3
|
+
import { UploaderFilesClasses, UploaderInputClasses } from './ui';
|
|
4
|
+
type UploaderBaseClasses = {
|
|
5
|
+
root?: string;
|
|
6
|
+
input?: UploaderInputClasses;
|
|
7
|
+
files?: UploaderFilesClasses;
|
|
8
|
+
};
|
|
9
|
+
export interface UploaderBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'placeholder' | 'value' | 'onChange'> {
|
|
10
|
+
/**
|
|
11
|
+
* Опции uploader-а, в нем можно валидировать файлы, указывать максимум и минимум для файлов
|
|
12
|
+
* Подробнее можно узнать в типе DropzoneOptions
|
|
13
|
+
*/
|
|
14
|
+
dropzoneOptions?: DropzoneOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Объект классов которые можно переопределить
|
|
17
|
+
*/
|
|
18
|
+
classes?: UploaderBaseClasses;
|
|
19
|
+
/**
|
|
20
|
+
* Доп текст под инпутом
|
|
21
|
+
*/
|
|
22
|
+
helperText?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Сеттер инпута
|
|
25
|
+
* @param file - файлы
|
|
26
|
+
*/
|
|
27
|
+
onChange: (file: File[]) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Валидный ли инпут
|
|
30
|
+
*/
|
|
31
|
+
invalid?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Value инпута
|
|
34
|
+
*/
|
|
35
|
+
value: File[];
|
|
36
|
+
}
|
|
37
|
+
export declare const UploaderBase: import('react').ForwardRefExoticComponent<UploaderBaseProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
38
|
+
export {};
|
package/dist/shared/ui/formElements/{uploaderControl → uncontrolled/uploader}/model/helpers.d.ts
RENAMED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DropzoneOptions } from 'react-dropzone';
|
|
2
|
+
export declare const bytesToMegabytes: (number: number) => number;
|
|
3
|
+
export declare const megabytesToBytes: (number: number) => number;
|
|
2
4
|
export declare const defaultDropzoneOptions: DropzoneOptions;
|
|
3
5
|
export declare const FilesErrorCode: {
|
|
4
6
|
readonly FileInvalidType: "file-invalid-type";
|
|
@@ -2,9 +2,9 @@ import { DropzoneOptions } from 'react-dropzone';
|
|
|
2
2
|
export type TUseUploader = {
|
|
3
3
|
controlledFiles: File[];
|
|
4
4
|
dropzoneOptions: DropzoneOptions;
|
|
5
|
-
|
|
5
|
+
onChange: (files: File[]) => void;
|
|
6
6
|
};
|
|
7
|
-
export declare const useUploader: ({ dropzoneOptions, controlledFiles,
|
|
7
|
+
export declare const useUploader: ({ dropzoneOptions, controlledFiles, onChange }: TUseUploader) => {
|
|
8
8
|
filesStatus: Record<string, "error" | "success" | "loading">;
|
|
9
9
|
removeFile: (index: number) => void;
|
|
10
10
|
dropzoneState: import('react-dropzone').DropzoneState;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defaultDropzoneOptions, megabytesToBytes, bytesToMegabytes, FilesErrorCode } from './helpers';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UploaderFileNameClasses } from './UploaderFilename';
|
|
2
|
+
export type UploaderFileClasses = UploaderFileNameClasses & {
|
|
3
|
+
root?: string;
|
|
4
|
+
content?: string;
|
|
5
|
+
deleteIcon?: string;
|
|
6
|
+
buttonRoot?: string;
|
|
7
|
+
buttonDelete?: string;
|
|
8
|
+
};
|
|
9
|
+
interface UploaderFileProps {
|
|
10
|
+
filesStatus: {
|
|
11
|
+
[key: string]: 'loading' | 'success' | 'error';
|
|
12
|
+
};
|
|
13
|
+
removeFile: (index: number) => void;
|
|
14
|
+
classes?: UploaderFileClasses;
|
|
15
|
+
file: File;
|
|
16
|
+
index: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const UploaderFile: ({ filesStatus, removeFile, classes, file, index }: UploaderFileProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type UploaderFileNameClasses = {
|
|
2
|
+
text?: string;
|
|
3
|
+
};
|
|
4
|
+
interface UploaderFilenameProps {
|
|
5
|
+
file: File;
|
|
6
|
+
classes?: UploaderFileNameClasses;
|
|
7
|
+
}
|
|
8
|
+
export declare const UploaderFilename: ({ file, classes }: UploaderFilenameProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { UploaderFileClasses } from './UploaderFile';
|
|
3
|
+
export type UploaderFilesClasses = {
|
|
4
|
+
root?: string;
|
|
5
|
+
file?: UploaderFileClasses;
|
|
6
|
+
};
|
|
7
|
+
interface UploaderFilesProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
files: File[];
|
|
9
|
+
filesStatus: {
|
|
10
|
+
[key: string]: 'loading' | 'success' | 'error';
|
|
11
|
+
};
|
|
12
|
+
removeFile: (index: number) => void;
|
|
13
|
+
classes?: UploaderFilesClasses;
|
|
14
|
+
}
|
|
15
|
+
export declare const UploaderFiles: ({ files, filesStatus, classes, removeFile }: UploaderFilesProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DropzoneRootProps } from 'react-dropzone';
|
|
2
|
+
export type UploaderInputClasses = {
|
|
3
|
+
root?: string;
|
|
4
|
+
input?: string;
|
|
5
|
+
textContainer?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
textContent?: string;
|
|
8
|
+
textContentSpan?: string;
|
|
9
|
+
};
|
|
10
|
+
export interface UploaderInputProps {
|
|
11
|
+
dropzoneState: DropzoneRootProps;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
invalid?: boolean;
|
|
14
|
+
classes?: UploaderInputClasses;
|
|
15
|
+
name?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const UploaderInput: import('react').ForwardRefExoticComponent<UploaderInputProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { UploaderFiles, type UploaderFilesClasses } from './UploaderFiles';
|
|
2
|
+
export { UploaderFilename, type UploaderFileNameClasses } from './UploaderFilename';
|
|
3
|
+
export { UploaderInput, type UploaderInputClasses } from './UploaderInput';
|
|
4
|
+
export { UploaderFile, type UploaderFileClasses } from './UploaderFile';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class TypeGuards {
|
|
2
|
+
static isString(value: unknown): value is string;
|
|
3
|
+
static isStringEmpty(value: unknown): boolean;
|
|
4
|
+
static isNull(value: unknown): value is null;
|
|
5
|
+
static isUndefined(value: unknown): value is undefined;
|
|
6
|
+
static isNil(value: unknown): value is boolean;
|
|
7
|
+
static isArray(value: unknown): value is unknown[];
|
|
8
|
+
static isArrayEmpty(value: unknown): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const n = (...i) => {
|
|
2
|
+
const t = i.filter(Boolean);
|
|
3
|
+
return t.length <= 1 ? t[0] || null : function(s) {
|
|
4
|
+
t.forEach((r) => {
|
|
5
|
+
typeof r == "function" ? r(s) : r && (r.current = s);
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
class f {
|
|
10
|
+
static isString(t) {
|
|
11
|
+
return typeof t == "string";
|
|
12
|
+
}
|
|
13
|
+
static isStringEmpty(t) {
|
|
14
|
+
return this.isString(t) && !t.length;
|
|
15
|
+
}
|
|
16
|
+
static isNull(t) {
|
|
17
|
+
return t === null;
|
|
18
|
+
}
|
|
19
|
+
static isUndefined(t) {
|
|
20
|
+
return t === void 0 && typeof t > "u";
|
|
21
|
+
}
|
|
22
|
+
static isNil(t) {
|
|
23
|
+
return this.isNull(t) || this.isUndefined(t);
|
|
24
|
+
}
|
|
25
|
+
static isArray(t) {
|
|
26
|
+
return Array.isArray(t);
|
|
27
|
+
}
|
|
28
|
+
static isArrayEmpty(t) {
|
|
29
|
+
return this.isArray(t) && !t.length;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
f as T,
|
|
34
|
+
n as m
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=typeGuards-CaNkXs7N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeGuards-CaNkXs7N.js","sources":["../lib/shared/utils/mergeRefs.ts","../lib/shared/utils/typeGuards.ts"],"sourcesContent":["import type React from 'react'\n\nexport const mergeRefs = <T>(...inputRefs: (React.Ref<T> | undefined)[]): React.Ref<T> | React.RefCallback<T> => {\n const filteredInputRefs = inputRefs.filter(Boolean)\n\n if (filteredInputRefs.length <= 1) {\n const firstRef = filteredInputRefs[0]\n\n return firstRef || null\n }\n\n return function mergedRefs(ref) {\n filteredInputRefs.forEach((inputRef) => {\n if (typeof inputRef === 'function') {\n inputRef(ref)\n } else if (inputRef) {\n ;(inputRef as React.MutableRefObject<T | null>).current = ref\n }\n })\n }\n}\n","export class TypeGuards {\n static isString(value: unknown): value is string {\n return typeof value === 'string'\n }\n\n static isStringEmpty(value: unknown): boolean {\n return this.isString(value) && !value.length\n }\n\n static isNull(value: unknown): value is null {\n return value === null\n }\n\n static isUndefined(value: unknown): value is undefined {\n return value === undefined && typeof value === 'undefined'\n }\n\n static isNil(value: unknown): value is boolean {\n return this.isNull(value) || this.isUndefined(value)\n }\n\n static isArray(value: unknown): value is unknown[] {\n return Array.isArray(value)\n }\n\n static isArrayEmpty(value: unknown): boolean {\n return this.isArray(value) && !value.length\n }\n}\n"],"names":["mergeRefs","inputRefs","filteredInputRefs","ref","inputRef","TypeGuards","value"],"mappings":"AAEa,MAAAA,IAAY,IAAOC,MAAiF;AACzG,QAAAC,IAAoBD,EAAU,OAAO,OAAO;AAE9C,SAAAC,EAAkB,UAAU,IACbA,EAAkB,CAAC,KAEjB,OAGd,SAAoBC,GAAK;AACZ,IAAAD,EAAA,QAAQ,CAACE,MAAa;AAClC,MAAA,OAAOA,KAAa,aACtBA,EAASD,CAAG,IACHC,MACPA,EAA8C,UAAUD;AAAA,IAC5D,CACD;AAAA,EACH;AACF;ACpBO,MAAME,EAAW;AAAA,EACtB,OAAO,SAASC,GAAiC;AAC/C,WAAO,OAAOA,KAAU;AAAA,EAAA;AAAA,EAG1B,OAAO,cAAcA,GAAyB;AAC5C,WAAO,KAAK,SAASA,CAAK,KAAK,CAACA,EAAM;AAAA,EAAA;AAAA,EAGxC,OAAO,OAAOA,GAA+B;AAC3C,WAAOA,MAAU;AAAA,EAAA;AAAA,EAGnB,OAAO,YAAYA,GAAoC;AAC9C,WAAAA,MAAU,UAAa,OAAOA,IAAU;AAAA,EAAA;AAAA,EAGjD,OAAO,MAAMA,GAAkC;AAC7C,WAAO,KAAK,OAAOA,CAAK,KAAK,KAAK,YAAYA,CAAK;AAAA,EAAA;AAAA,EAGrD,OAAO,QAAQA,GAAoC;AAC1C,WAAA,MAAM,QAAQA,CAAK;AAAA,EAAA;AAAA,EAG5B,OAAO,aAAaA,GAAyB;AAC3C,WAAO,KAAK,QAAQA,CAAK,KAAK,CAACA,EAAM;AAAA,EAAA;AAEzC;"}
|