@scbt-ecom/ui 0.22.7 → 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.
Files changed (24) hide show
  1. package/dist/shared/ui/formElements/controlled/index.d.ts +19 -13
  2. package/dist/shared/ui/formElements/controlled/select/SelectControl.d.ts +7 -3
  3. package/dist/shared/ui/formElements/uncontrolled/index.d.ts +14 -10
  4. package/dist/shared/ui/formElements/uncontrolled/select/Select.d.ts +55 -30
  5. package/dist/shared/ui/formElements/uncontrolled/select/hooks/useSelectController.d.ts +17 -0
  6. package/dist/shared/ui/formElements/uncontrolled/select/index.d.ts +1 -1
  7. package/dist/shared/ui/formElements/uncontrolled/select/model/index.d.ts +1 -0
  8. package/dist/shared/ui/formElements/uncontrolled/select/model/types.d.ts +14 -0
  9. package/dist/shared/ui/formElements/uncontrolled/select/ui/{control/ui/Chip.d.ts → Chip.d.ts} +1 -1
  10. package/dist/shared/ui/formElements/uncontrolled/select/ui/ChipList.d.ts +11 -0
  11. package/dist/shared/ui/formElements/uncontrolled/select/ui/SelectItem.d.ts +12 -20
  12. package/dist/shared/ui/formElements/uncontrolled/select/ui/index.d.ts +2 -3
  13. package/dist/ui.js +7417 -7532
  14. package/dist/ui.js.map +1 -1
  15. package/dist/widget.js +1 -4
  16. package/dist/widget.js.map +1 -1
  17. package/package.json +1 -1
  18. package/dist/shared/ui/formElements/uncontrolled/select/ui/SelectList.d.ts +0 -10
  19. package/dist/shared/ui/formElements/uncontrolled/select/ui/control/Control.d.ts +0 -16
  20. package/dist/shared/ui/formElements/uncontrolled/select/ui/control/hooks/useSelectController.d.ts +0 -52
  21. package/dist/shared/ui/formElements/uncontrolled/select/ui/control/index.d.ts +0 -1
  22. package/dist/shared/ui/formElements/uncontrolled/select/ui/control/ui/ChipList.d.ts +0 -11
  23. package/dist/shared/ui/formElements/uncontrolled/select/ui/control/ui/index.d.ts +0 -1
  24. /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-select').Props<import('..').SelectItemOption, boolean>, "options" | "defaultValue" | "placeholder" | "isSearchable"> & Pick<import('..').InputBaseProps, "invalid" | "label" | "attachmentProps"> & {
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
- returnValue?: (option: import('..').SelectItemOption) => string;
43
- displayValue?: (option: import('..').SelectItemOption) => string;
45
+ options: import('..').SelectItemOption[];
44
46
  classes?: {
45
- container?: string;
46
- control?: import('../uncontrolled/select/ui').ControlClasses;
47
- option?: import('../uncontrolled/select/ui').SelectItemClasses;
48
- list?: import('../uncontrolled/select/ui').SelectListClasses;
47
+ item?: string;
48
+ helperText?: string;
49
+ } & {
50
+ root?: string;
51
+ list?: string;
49
52
  };
50
- options: import('..').SelectItemOption[];
51
- filterOptionDisabled?: boolean;
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
- container?: string;
56
- control?: import('../uncontrolled/select/ui').ControlClasses;
57
- option?: import('../uncontrolled/select/ui').SelectItemClasses;
58
- list?: import('../uncontrolled/select/ui').SelectListClasses;
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-select').Props<import('./select').SelectItemOption, boolean>, "options" | "defaultValue" | "placeholder" | "isSearchable"> & Pick<import('./input').InputBaseProps, "invalid" | "label" | "attachmentProps"> & {
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
- returnValue?: (option: import('./select').SelectItemOption) => string;
36
- displayValue?: (option: import('./select').SelectItemOption) => string;
38
+ options: import('./select').SelectItemOption[];
37
39
  classes?: {
38
- container?: string;
39
- control?: import('./select/ui').ControlClasses;
40
- option?: import('./select/ui').SelectItemClasses;
41
- list?: import('./select/ui').SelectListClasses;
40
+ item?: string;
41
+ helperText?: string;
42
+ } & {
43
+ root?: string;
44
+ list?: string;
42
45
  };
43
- options: import('./select').SelectItemOption[];
44
- filterOptionDisabled?: boolean;
45
- } & import('react').RefAttributes<import('node_modules/react-select/dist/declarations/src/Select').default<import('./select').SelectItemOption, boolean, import('react-select').GroupBase<import('./select').SelectItemOption>>>>;
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 { Props } from 'react-select';
2
- import { ControlClasses, SelectItemClasses, SelectItemOption, SelectListClasses } from './ui';
3
- import { InputBaseProps } from '../../..';
4
- type SelectClasses = {
5
- container?: string;
6
- control?: ControlClasses;
7
- option?: SelectItemClasses;
8
- list?: SelectListClasses;
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<IsMulti extends boolean = boolean> = Omit<Props<SelectItemOption, IsMulti>, 'placeholder' | 'options' | 'defaultValue' | 'isSearchable'> & Pick<InputBaseProps, 'attachmentProps' | 'label' | 'invalid'> & {
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
- returnValue?: (option: SelectItemOption) => string;
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
- classes?: SelectClasses;
43
+ onChange?: (value: SelectItemOption | SelectItemOption[] | null) => void;
27
44
  /**
28
- * Список отображаемых значений
45
+ * Свойства дополнительной иконки
29
46
  */
30
- options: SelectItemOption[];
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
- filterOptionDisabled?: boolean;
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
- isSearchable?: boolean;
57
+ isMulti: boolean;
41
58
  /**
42
- * Функция для управления возвращаемым значением
59
+ * Пометить поле как не валидное
43
60
  */
44
- returnValue?: (option: SelectItemOption) => string;
61
+ invalid?: boolean;
45
62
  /**
46
- * Функция для управления отображаемым значением
63
+ * Свойство управляющее поиском
47
64
  */
48
- displayValue?: (option: SelectItemOption) => string;
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
- options: SelectItemOption[];
77
+ displayValue?: (option: SelectItemOption) => string;
78
+ /**
79
+ * Функция для изменения значения
80
+ */
81
+ onChange?: (value: SelectItemOption | SelectItemOption[] | null) => void;
57
82
  /**
58
- * Свойство для выключения фильтрации элементов по поиску
83
+ * Свойства дополнительной иконки
59
84
  */
60
- filterOptionDisabled?: boolean;
61
- } & import('react').RefAttributes<import('node_modules/react-select/dist/declarations/src/Select').default<SelectItemOption, boolean, import('react-select').GroupBase<SelectItemOption>>>>;
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 './ui';
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 {};
@@ -1,4 +1,4 @@
1
- import { SelectItemOption } from '../../../../../..';
1
+ import { SelectItemOption } from '../model';
2
2
  type ControlChipClasses = {
3
3
  chip?: string;
4
4
  };
@@ -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 { OptionProps } from 'react-select';
2
- import { DeepPartial } from '../../../../../types';
3
- import { FieldAttachment } from '../../../ui';
4
- type FieldAttachmentProps = React.ComponentPropsWithoutRef<typeof FieldAttachment>;
5
- export type SelectItemOption = {
6
- id: string | number;
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 SelectItemClasses = {
17
- container?: string;
18
- additionalText?: string;
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: ({ isSelected, label, data, innerProps, innerRef, selectProps, isFocused, classes, isMulti, ...props }: SelectItemProps) => import("react/jsx-runtime").JSX.Element;
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 * from './control';
2
- export * from './SelectItem';
3
- export * from './SelectList';
1
+ export { SelectItem, type SelectItemProps } from './SelectItem';
2
+ export { ChipList } from './ChipList';