@snack-uikit/fields 0.45.0 → 0.47.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/CHANGELOG.md +22 -0
- package/README.md +2 -0
- package/dist/cjs/components/FieldColor/FieldColor.d.ts +1 -1
- package/dist/cjs/components/FieldSecure/FieldSecure.d.ts +1 -1
- package/dist/cjs/components/FieldSelect/FieldSelectMultiple.d.ts +1 -1
- package/dist/cjs/components/FieldSelect/FieldSelectSingle.d.ts +1 -1
- package/dist/cjs/components/FieldSlider/FieldSlider.d.ts +1 -1
- package/dist/cjs/components/FieldText/FieldText.d.ts +2 -2
- package/dist/cjs/components/FieldText/FieldText.js +4 -2
- package/dist/cjs/components/FieldTextArea/FieldTextArea.d.ts +2 -2
- package/dist/cjs/components/FieldTextArea/FieldTextArea.js +4 -2
- package/dist/cjs/helperComponents/ButtonFieldList/ButtonFieldList.d.ts +1 -1
- package/dist/cjs/helperComponents/TextArea/TextArea.d.ts +2 -0
- package/dist/cjs/helperComponents/TextArea/TextArea.js +5 -3
- package/dist/cjs/hooks/addonButton/index.d.ts +2 -0
- package/dist/cjs/hooks/addonButton/index.js +26 -0
- package/dist/cjs/hooks/addonButton/useAddonButton.d.ts +14 -0
- package/dist/cjs/hooks/{usePostfixButton.js → addonButton/useAddonButton.js} +22 -16
- package/dist/cjs/hooks/addonButton/usePostfixButton.d.ts +6 -0
- package/dist/cjs/hooks/addonButton/usePostfixButton.js +26 -0
- package/dist/cjs/hooks/addonButton/usePrefixButton.d.ts +6 -0
- package/dist/cjs/hooks/addonButton/usePrefixButton.js +26 -0
- package/dist/cjs/hooks/index.d.ts +1 -2
- package/dist/cjs/hooks/index.js +1 -2
- package/dist/cjs/types/allFields.d.ts +9 -4
- package/dist/esm/components/FieldColor/FieldColor.d.ts +1 -1
- package/dist/esm/components/FieldSecure/FieldSecure.d.ts +1 -1
- package/dist/esm/components/FieldSelect/FieldSelectMultiple.d.ts +1 -1
- package/dist/esm/components/FieldSelect/FieldSelectSingle.d.ts +1 -1
- package/dist/esm/components/FieldSlider/FieldSlider.d.ts +1 -1
- package/dist/esm/components/FieldText/FieldText.d.ts +2 -2
- package/dist/esm/components/FieldText/FieldText.js +2 -2
- package/dist/esm/components/FieldTextArea/FieldTextArea.d.ts +2 -2
- package/dist/esm/components/FieldTextArea/FieldTextArea.js +2 -2
- package/dist/esm/helperComponents/ButtonFieldList/ButtonFieldList.d.ts +1 -1
- package/dist/esm/helperComponents/TextArea/TextArea.d.ts +2 -0
- package/dist/esm/helperComponents/TextArea/TextArea.js +2 -2
- package/dist/esm/hooks/addonButton/index.d.ts +2 -0
- package/dist/esm/hooks/addonButton/index.js +2 -0
- package/dist/esm/hooks/addonButton/useAddonButton.d.ts +14 -0
- package/dist/esm/hooks/addonButton/useAddonButton.js +30 -0
- package/dist/esm/hooks/addonButton/usePostfixButton.d.ts +6 -0
- package/dist/esm/hooks/addonButton/usePostfixButton.js +16 -0
- package/dist/esm/hooks/addonButton/usePrefixButton.d.ts +6 -0
- package/dist/esm/hooks/addonButton/usePrefixButton.js +16 -0
- package/dist/esm/hooks/index.d.ts +1 -2
- package/dist/esm/hooks/index.js +1 -2
- package/dist/esm/types/allFields.d.ts +9 -4
- package/package.json +6 -6
- package/src/components/FieldText/FieldText.tsx +3 -0
- package/src/components/FieldTextArea/FieldTextArea.tsx +12 -1
- package/src/helperComponents/TextArea/TextArea.tsx +4 -0
- package/src/hooks/addonButton/index.ts +2 -0
- package/src/hooks/{usePostfixButton.tsx → addonButton/useAddonButton.tsx} +30 -23
- package/src/hooks/addonButton/usePostfixButton.tsx +12 -0
- package/src/hooks/addonButton/usePrefixButton.tsx +12 -0
- package/src/hooks/index.ts +1 -2
- package/src/types/allFields.ts +15 -5
- package/dist/cjs/hooks/usePostfixButton.d.ts +0 -11
- package/dist/cjs/hooks/usePrefixButton.d.ts +0 -11
- package/dist/cjs/hooks/usePrefixButton.js +0 -63
- package/dist/esm/hooks/usePostfixButton.d.ts +0 -11
- package/dist/esm/hooks/usePostfixButton.js +0 -28
- package/dist/esm/hooks/usePrefixButton.d.ts +0 -11
- package/dist/esm/hooks/usePrefixButton.js +0 -28
- package/src/hooks/usePrefixButton.tsx +0 -76
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 0.47.0 (2025-05-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **PDS-2255:** extend button prefix props ([ee14165](https://github.com/cloud-ru-tech/snack-uikit/commit/ee14165a43d23faf09106434072df85faeaae3c1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# 0.46.0 (2025-05-26)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **PDS-2223:** add spellcheck prop to FieldTextArea and FieldText ([60e8c86](https://github.com/cloud-ru-tech/snack-uikit/commit/60e8c8693ad4c69efdac887938180af99000af9e))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# 0.45.0 (2025-05-26)
|
|
7
29
|
|
|
8
30
|
|
package/README.md
CHANGED
|
@@ -482,6 +482,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
482
482
|
| placeholder | `string` | - | Значение плейсхолдера |
|
|
483
483
|
| maxLength | `number` | - | Максимальная длина вводимого значения |
|
|
484
484
|
| autoComplete | `string \| boolean` | false | Включен ли автокомплит для поля |
|
|
485
|
+
| spellCheck | `boolean` | true | Значение атрибута spellcheck (проверка орфографии) |
|
|
485
486
|
| onKeyDown | `KeyboardEventHandler<HTMLInputElement>` | - | Колбек обработки начала нажатия клавиши клавиатуры |
|
|
486
487
|
| onPaste | `ClipboardEventHandler<HTMLInputElement>` | - | Колбек обработки вставки значения |
|
|
487
488
|
| className | `string` | - | CSS-класс |
|
|
@@ -519,6 +520,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
519
520
|
| onBlur | `FocusEventHandler<HTMLTextAreaElement>` | - | Колбек потери фокуса |
|
|
520
521
|
| placeholder | `string` | - | Плейсхолдер |
|
|
521
522
|
| maxLength | `number` | - | Максимальное кол-во символов |
|
|
523
|
+
| spellCheck | `boolean` | true | Включение проверки орфографии |
|
|
522
524
|
| onKeyDown | `KeyboardEventHandler<HTMLTextAreaElement>` | - | Колбек нажатия клавиши клавиатуры |
|
|
523
525
|
| className | `string` | - | CSS-класс |
|
|
524
526
|
| label | `string` | - | Лейбл |
|
|
@@ -40,5 +40,5 @@ export declare const FieldColor: import("react").ForwardRefExoticComponent<{
|
|
|
40
40
|
showClearButton?: boolean;
|
|
41
41
|
value?: string;
|
|
42
42
|
onChange?(value: string): void;
|
|
43
|
-
} & Omit<ColorPickerProps, "
|
|
43
|
+
} & Omit<ColorPickerProps, "onChange" | "value"> & InputProps & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
44
44
|
export {};
|
|
@@ -23,5 +23,5 @@ type FieldSecureOwnProps = {
|
|
|
23
23
|
export type FieldSecureProps = WithSupportProps<FieldSecureOwnProps & InputProps & WrapperProps>;
|
|
24
24
|
export declare const FieldSecure: import("react").ForwardRefExoticComponent<{
|
|
25
25
|
'data-test-id'?: string;
|
|
26
|
-
} & import("react").AriaAttributes & FieldSecureOwnProps & Pick<Partial<InputPrivateProps>, "
|
|
26
|
+
} & import("react").AriaAttributes & FieldSecureOwnProps & Pick<Partial<InputPrivateProps>, "onChange" | "value"> & Pick<InputPrivateProps, "id" | "name" | "onFocus" | "onBlur" | "disabled" | "readonly" | "placeholder" | "autoComplete" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
27
27
|
export {};
|
|
@@ -28,4 +28,4 @@ export declare const FieldSelectMultiple: import("react").ForwardRefExoticCompon
|
|
|
28
28
|
resetSearchOnOptionSelection?: boolean;
|
|
29
29
|
onOpenChange?(open: boolean): void;
|
|
30
30
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
31
|
-
} & Pick<import("@snack-uikit/list").DroplistProps, "
|
|
31
|
+
} & Pick<import("@snack-uikit/list").DroplistProps, "untouchableScrollbars" | "dataError" | "dataFiltered" | "scrollToSelectedItem" | "virtualized" | "noDataState" | "noResultsState" | "errorDataState">, "showCopyButton" | "onCopyButtonClick"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -26,4 +26,4 @@ export declare const FieldSelectSingle: import("react").ForwardRefExoticComponen
|
|
|
26
26
|
resetSearchOnOptionSelection?: boolean;
|
|
27
27
|
onOpenChange?(open: boolean): void;
|
|
28
28
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
29
|
-
} & Pick<import("@snack-uikit/list").DroplistProps, "
|
|
29
|
+
} & Pick<import("@snack-uikit/list").DroplistProps, "untouchableScrollbars" | "dataError" | "dataFiltered" | "scrollToSelectedItem" | "virtualized" | "noDataState" | "noResultsState" | "errorDataState"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -23,5 +23,5 @@ type FieldSliderOwnProps = {
|
|
|
23
23
|
export type FieldSliderProps = WithSupportProps<FieldSliderOwnProps & SliderProps & WrapperProps>;
|
|
24
24
|
export declare const FieldSlider: import("react").ForwardRefExoticComponent<{
|
|
25
25
|
'data-test-id'?: string;
|
|
26
|
-
} & import("react").AriaAttributes & FieldSliderOwnProps & Pick<InputPrivateProps, "
|
|
26
|
+
} & import("react").AriaAttributes & FieldSliderOwnProps & Pick<InputPrivateProps, "id" | "name" | "onFocus" | "onBlur" | "disabled" | "readonly"> & Pick<SliderComponentProps, "onChange" | "value" | "range" | "tipFormatter"> & Required<Pick<SliderComponentProps, "max" | "min" | "step" | "marks">> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
27
27
|
export {};
|
|
@@ -3,7 +3,7 @@ import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
|
3
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
4
|
import { Button } from '../../types';
|
|
5
5
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
6
|
-
type InputProps = Pick<Partial<InputPrivateProps>, 'value' | 'onChange'> & Pick<InputPrivateProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'autoComplete' | 'onPaste' | 'onKeyDown'>;
|
|
6
|
+
type InputProps = Pick<Partial<InputPrivateProps>, 'value' | 'onChange'> & Pick<InputPrivateProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'autoComplete' | 'onPaste' | 'onKeyDown' | 'spellCheck'>;
|
|
7
7
|
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
|
|
8
8
|
type FieldTextOwnProps = {
|
|
9
9
|
/** Отображение кнопки Копировать для поля (актуально только для `readonly = true`) */
|
|
@@ -30,5 +30,5 @@ type FieldTextOwnProps = {
|
|
|
30
30
|
export type FieldTextProps = WithSupportProps<FieldTextOwnProps & InputProps & WrapperProps>;
|
|
31
31
|
export declare const FieldText: import("react").ForwardRefExoticComponent<{
|
|
32
32
|
'data-test-id'?: string;
|
|
33
|
-
} & import("react").AriaAttributes & FieldTextOwnProps & Pick<Partial<InputPrivateProps>, "
|
|
33
|
+
} & import("react").AriaAttributes & FieldTextOwnProps & Pick<Partial<InputPrivateProps>, "onChange" | "value"> & Pick<InputPrivateProps, "id" | "name" | "onPaste" | "onFocus" | "onBlur" | "onKeyDown" | "disabled" | "readonly" | "placeholder" | "autoComplete" | "maxLength" | "spellCheck"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
34
34
|
export {};
|
|
@@ -62,9 +62,10 @@ exports.FieldText = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
62
62
|
button: buttonProp,
|
|
63
63
|
onPaste,
|
|
64
64
|
onKeyDown,
|
|
65
|
-
type = 'text'
|
|
65
|
+
type = 'text',
|
|
66
|
+
spellCheck
|
|
66
67
|
} = _a,
|
|
67
|
-
rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "onChange", "onFocus", "onBlur", "onCopyButtonClick", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "autoComplete", "prefixIcon", "prefix", "postfix", "button", "onPaste", "onKeyDown", "type"]);
|
|
68
|
+
rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "onChange", "onFocus", "onBlur", "onCopyButtonClick", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "autoComplete", "prefixIcon", "prefix", "postfix", "button", "onPaste", "onKeyDown", "type", "spellCheck"]);
|
|
68
69
|
const [value = '', onChange] = (0, hooks_1.useValueControl)({
|
|
69
70
|
value: valueProp,
|
|
70
71
|
defaultValue: '',
|
|
@@ -209,6 +210,7 @@ exports.FieldText = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
209
210
|
id: id,
|
|
210
211
|
name: name,
|
|
211
212
|
autoComplete: autoComplete,
|
|
213
|
+
spellCheck: spellCheck,
|
|
212
214
|
"data-test-id": 'field-text__input'
|
|
213
215
|
})
|
|
214
216
|
})
|
|
@@ -2,7 +2,7 @@ import { ChangeEvent, ReactNode } from 'react';
|
|
|
2
2
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
3
3
|
import { TextAreaProps } from '../../helperComponents';
|
|
4
4
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
5
|
-
type InputProps = Pick<Partial<TextAreaProps>, 'value'> & Pick<TextAreaProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'onKeyDown'>;
|
|
5
|
+
type InputProps = Pick<Partial<TextAreaProps>, 'value'> & Pick<TextAreaProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'spellCheck'>;
|
|
6
6
|
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'size' | 'validationState' | 'showHintIcon' | 'labelTooltipPlacement' | 'error'>;
|
|
7
7
|
type FieldTextAreaOwnProps = {
|
|
8
8
|
/** Минимальное кол-во строк, до которого размер поля может быть увеличен @default 3*/
|
|
@@ -30,5 +30,5 @@ type FieldTextAreaOwnProps = {
|
|
|
30
30
|
export type FieldTextAreaProps = WithSupportProps<FieldTextAreaOwnProps & InputProps & WrapperProps>;
|
|
31
31
|
export declare const FieldTextArea: import("react").ForwardRefExoticComponent<{
|
|
32
32
|
'data-test-id'?: string;
|
|
33
|
-
} & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "
|
|
33
|
+
} & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "id" | "name" | "onFocus" | "onBlur" | "onKeyDown" | "disabled" | "readonly" | "placeholder" | "maxLength" | "spellCheck"> & WrapperProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
34
34
|
export {};
|
|
@@ -60,9 +60,10 @@ exports.FieldTextArea = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
60
60
|
size = input_private_1.SIZE.S,
|
|
61
61
|
validationState = constants_1.VALIDATION_STATE.Default,
|
|
62
62
|
onCopyButtonClick,
|
|
63
|
-
footer
|
|
63
|
+
footer,
|
|
64
|
+
spellCheck
|
|
64
65
|
} = _a,
|
|
65
|
-
rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "minRows", "maxRows", "disabled", "resizable", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "showHintIcon", "onChange", "onFocus", "onBlur", "onKeyDown", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "error", "size", "validationState", "onCopyButtonClick", "footer"]);
|
|
66
|
+
rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "minRows", "maxRows", "disabled", "resizable", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "showHintIcon", "onChange", "onFocus", "onBlur", "onKeyDown", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "error", "size", "validationState", "onCopyButtonClick", "footer", "spellCheck"]);
|
|
66
67
|
const localRef = (0, react_1.useRef)(null);
|
|
67
68
|
const clearButtonRef = (0, react_1.useRef)(null);
|
|
68
69
|
const copyButtonRef = (0, react_1.useRef)(null);
|
|
@@ -172,6 +173,7 @@ exports.FieldTextArea = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
172
173
|
onBlur: onBlur,
|
|
173
174
|
onKeyDown: handleKeyDown,
|
|
174
175
|
tabIndex: inputTabIndex,
|
|
176
|
+
spellCheck: spellCheck,
|
|
175
177
|
maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined,
|
|
176
178
|
"data-test-id": 'field-textarea__input'
|
|
177
179
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ButtonFieldProps } from '../ButtonField';
|
|
2
|
-
export declare const ButtonFieldList: import("react").ForwardRefExoticComponent<Omit<ButtonFieldProps, "hasArrow" | "arrowOpen"> & Pick<import("@snack-uikit/list").DroplistProps, "
|
|
2
|
+
export declare const ButtonFieldList: import("react").ForwardRefExoticComponent<Omit<ButtonFieldProps, "hasArrow" | "arrowOpen"> & Pick<import("@snack-uikit/list").DroplistProps, "search" | "open" | "onOpenChange" | "items" | "scroll"> & {
|
|
3
3
|
selection?: Omit<import("@snack-uikit/list").SelectionSingleState, "mode">;
|
|
4
4
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -30,5 +30,7 @@ export type TextAreaProps = RefAttributes<HTMLTextAreaElement> & WithSupportProp
|
|
|
30
30
|
tabIndex?: number;
|
|
31
31
|
/** Минимальное кол-во строк, до которого размер поля может быть увеличен @default 3*/
|
|
32
32
|
minRows?: number;
|
|
33
|
+
/** Включение проверки орфографии @default true*/
|
|
34
|
+
spellCheck?: boolean;
|
|
33
35
|
}>;
|
|
34
36
|
export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -39,9 +39,10 @@ exports.TextArea = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
39
39
|
onBlur,
|
|
40
40
|
onKeyDown,
|
|
41
41
|
tabIndex,
|
|
42
|
-
minRows = 3
|
|
42
|
+
minRows = 3,
|
|
43
|
+
spellCheck
|
|
43
44
|
} = _a,
|
|
44
|
-
rest = __rest(_a, ["name", "value", "onChange", "placeholder", "id", "className", "disabled", "readonly", "autoComplete", "maxLength", "onFocus", "onBlur", "onKeyDown", "tabIndex", "minRows"]);
|
|
45
|
+
rest = __rest(_a, ["name", "value", "onChange", "placeholder", "id", "className", "disabled", "readonly", "autoComplete", "maxLength", "onFocus", "onBlur", "onKeyDown", "tabIndex", "minRows", "spellCheck"]);
|
|
45
46
|
// fix of height on the initial render
|
|
46
47
|
// see https://github.com/Andarist/react-textarea-autosize/issues/337#issuecomment-1024980737
|
|
47
48
|
const [, setIsRerendered] = (0, react_1.useState)(false);
|
|
@@ -65,6 +66,7 @@ exports.TextArea = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
65
66
|
onBlur: onBlur,
|
|
66
67
|
onKeyDown: onKeyDown,
|
|
67
68
|
tabIndex: tabIndex,
|
|
68
|
-
minRows: minRows
|
|
69
|
+
minRows: minRows,
|
|
70
|
+
spellCheck: spellCheck
|
|
69
71
|
}, (0, utils_1.extractSupportProps)(rest)));
|
|
70
72
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./usePostfixButton"), exports);
|
|
26
|
+
__exportStar(require("./usePrefixButton"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonProps, Size } from '@snack-uikit/input-private';
|
|
3
|
+
import { ButtonFieldProps } from '../../helperComponents';
|
|
4
|
+
import { Button, ButtonVariant } from '../../types';
|
|
5
|
+
export type UseAddonProps = {
|
|
6
|
+
button?: Button;
|
|
7
|
+
size: Size;
|
|
8
|
+
icon?: ReactElement;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
variant: ButtonVariant;
|
|
12
|
+
type: 'prefix' | 'postfix';
|
|
13
|
+
} & Pick<ButtonFieldProps, 'onFocus' | 'onBlur'>;
|
|
14
|
+
export declare function useAddonButton({ variant, button, icon, size, disabled, readonly, type, onFocus, onBlur, }: UseAddonProps): ButtonProps;
|
|
@@ -3,36 +3,38 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.useAddonButton = useAddonButton;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("react");
|
|
9
|
-
const helperComponents_1 = require("
|
|
10
|
-
function
|
|
9
|
+
const helperComponents_1 = require("../../helperComponents");
|
|
10
|
+
function useAddonButton(_ref) {
|
|
11
11
|
let {
|
|
12
|
+
variant,
|
|
12
13
|
button,
|
|
14
|
+
icon,
|
|
13
15
|
size,
|
|
14
|
-
postfixIcon,
|
|
15
16
|
disabled,
|
|
16
17
|
readonly,
|
|
18
|
+
type,
|
|
17
19
|
onFocus,
|
|
18
20
|
onBlur
|
|
19
21
|
} = _ref;
|
|
20
22
|
const buttonListRef = (0, react_1.useRef)(null);
|
|
21
|
-
const
|
|
22
|
-
id:
|
|
23
|
+
const addonIconProps = (0, react_1.useMemo)(() => ({
|
|
24
|
+
id: `${type}Icon`,
|
|
23
25
|
active: false,
|
|
24
|
-
show: Boolean(
|
|
26
|
+
show: Boolean(icon && !button),
|
|
25
27
|
render: () => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {
|
|
26
|
-
children:
|
|
28
|
+
children: icon
|
|
27
29
|
})
|
|
28
|
-
}), [button,
|
|
29
|
-
const
|
|
30
|
-
id:
|
|
30
|
+
}), [button, icon, type]);
|
|
31
|
+
const addonButtonProps = (0, react_1.useMemo)(() => ({
|
|
32
|
+
id: `${type}Button`,
|
|
31
33
|
active: false,
|
|
32
|
-
show: Boolean(button && button.variant ===
|
|
34
|
+
show: Boolean(button && button.variant === variant),
|
|
33
35
|
render: renderProps => {
|
|
34
36
|
const buttonProps = Object.assign(Object.assign({}, renderProps), {
|
|
35
|
-
variant
|
|
37
|
+
variant,
|
|
36
38
|
size,
|
|
37
39
|
content: button === null || button === void 0 ? void 0 : button.content,
|
|
38
40
|
disabled: disabled || readonly,
|
|
@@ -56,8 +58,12 @@ function usePostfixButton(_ref) {
|
|
|
56
58
|
onOpenChange: button.onOpenChange
|
|
57
59
|
}));
|
|
58
60
|
}
|
|
59
|
-
|
|
61
|
+
const buttonField = (0, jsx_runtime_1.jsx)(helperComponents_1.ButtonField, Object.assign({}, buttonProps, {
|
|
62
|
+
hasArrow: button === null || button === void 0 ? void 0 : button.hasArrow,
|
|
63
|
+
arrowOpen: button === null || button === void 0 ? void 0 : button.arrowOpen
|
|
64
|
+
}));
|
|
65
|
+
return (button === null || button === void 0 ? void 0 : button.wrapper) ? button.wrapper(buttonField) : buttonField;
|
|
60
66
|
}
|
|
61
|
-
}), [button, size, disabled, readonly, onFocus, onBlur]);
|
|
62
|
-
return button ?
|
|
67
|
+
}), [type, button, variant, size, disabled, readonly, onFocus, onBlur]);
|
|
68
|
+
return button ? addonButtonProps : addonIconProps;
|
|
63
69
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonProps } from '@snack-uikit/input-private';
|
|
3
|
+
import { UseAddonProps } from './useAddonButton';
|
|
4
|
+
export declare function usePostfixButton({ postfixIcon, ...props }: Omit<UseAddonProps, 'type' | 'variant'> & {
|
|
5
|
+
postfixIcon?: ReactElement;
|
|
6
|
+
}): ButtonProps;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports.usePostfixButton = usePostfixButton;
|
|
15
|
+
const useAddonButton_1 = require("./useAddonButton");
|
|
16
|
+
function usePostfixButton(_a) {
|
|
17
|
+
var {
|
|
18
|
+
postfixIcon
|
|
19
|
+
} = _a,
|
|
20
|
+
props = __rest(_a, ["postfixIcon"]);
|
|
21
|
+
return (0, useAddonButton_1.useAddonButton)(Object.assign(Object.assign({}, props), {
|
|
22
|
+
icon: postfixIcon,
|
|
23
|
+
type: 'postfix',
|
|
24
|
+
variant: 'after'
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonProps } from '@snack-uikit/input-private';
|
|
3
|
+
import { UseAddonProps } from './useAddonButton';
|
|
4
|
+
export declare function usePrefixButton({ prefixIcon, ...props }: Omit<UseAddonProps, 'type' | 'variant'> & {
|
|
5
|
+
prefixIcon?: ReactElement;
|
|
6
|
+
}): ButtonProps;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports.usePrefixButton = usePrefixButton;
|
|
15
|
+
const useAddonButton_1 = require("./useAddonButton");
|
|
16
|
+
function usePrefixButton(_a) {
|
|
17
|
+
var {
|
|
18
|
+
prefixIcon
|
|
19
|
+
} = _a,
|
|
20
|
+
props = __rest(_a, ["prefixIcon"]);
|
|
21
|
+
return (0, useAddonButton_1.useAddonButton)(Object.assign(Object.assign({}, props), {
|
|
22
|
+
icon: prefixIcon,
|
|
23
|
+
type: 'prefix',
|
|
24
|
+
variant: 'before'
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
@@ -2,7 +2,6 @@ export * from './dateHandlers';
|
|
|
2
2
|
export * from './useCopyButton';
|
|
3
3
|
export * from './useHideButton';
|
|
4
4
|
export * from './usePostfix';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './addonButton';
|
|
6
6
|
export * from './usePrefix';
|
|
7
|
-
export * from './usePrefixButton';
|
|
8
7
|
export * from './useValueControl';
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -26,7 +26,6 @@ __exportStar(require("./dateHandlers"), exports);
|
|
|
26
26
|
__exportStar(require("./useCopyButton"), exports);
|
|
27
27
|
__exportStar(require("./useHideButton"), exports);
|
|
28
28
|
__exportStar(require("./usePostfix"), exports);
|
|
29
|
-
__exportStar(require("./
|
|
29
|
+
__exportStar(require("./addonButton"), exports);
|
|
30
30
|
__exportStar(require("./usePrefix"), exports);
|
|
31
|
-
__exportStar(require("./usePrefixButton"), exports);
|
|
32
31
|
__exportStar(require("./useValueControl"), exports);
|
|
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { DroplistProps, SelectionSingleState } from '@snack-uikit/list';
|
|
3
3
|
import { ValueOf } from '@snack-uikit/utils';
|
|
4
4
|
import { BUTTON_VARIANT, CONTAINER_VARIANT, VALIDATION_STATE } from '../constants';
|
|
5
|
+
import { ButtonFieldProps } from '../helperComponents';
|
|
5
6
|
export type ValidationState = ValueOf<typeof VALIDATION_STATE>;
|
|
6
7
|
export type ContainerVariant = ValueOf<typeof CONTAINER_VARIANT>;
|
|
7
8
|
export type ButtonVariant = ValueOf<typeof BUTTON_VARIANT>;
|
|
@@ -12,8 +13,12 @@ export type AsyncValueRequest = Promise<{
|
|
|
12
13
|
export type NativeDroplistProps = Pick<DroplistProps, 'items' | 'open' | 'onOpenChange' | 'search' | 'scroll'> & {
|
|
13
14
|
selection?: Omit<SelectionSingleState, 'mode'>;
|
|
14
15
|
};
|
|
15
|
-
export type Button = Omit<NativeDroplistProps, 'items'> & {
|
|
16
|
-
variant: ButtonVariant;
|
|
17
|
-
content?: ReactNode;
|
|
16
|
+
export type Button = Omit<NativeDroplistProps, 'items'> & Pick<ButtonFieldProps, 'variant' | 'content'> & ({
|
|
18
17
|
items?: DroplistProps['items'];
|
|
19
|
-
|
|
18
|
+
hasArrow?: never;
|
|
19
|
+
arrowOpen?: never;
|
|
20
|
+
wrapper?: never;
|
|
21
|
+
} | (Pick<ButtonFieldProps, 'hasArrow' | 'arrowOpen'> & {
|
|
22
|
+
items?: never;
|
|
23
|
+
wrapper?: (button: ReactNode) => JSX.Element;
|
|
24
|
+
}));
|
|
@@ -40,5 +40,5 @@ export declare const FieldColor: import("react").ForwardRefExoticComponent<{
|
|
|
40
40
|
showClearButton?: boolean;
|
|
41
41
|
value?: string;
|
|
42
42
|
onChange?(value: string): void;
|
|
43
|
-
} & Omit<ColorPickerProps, "
|
|
43
|
+
} & Omit<ColorPickerProps, "onChange" | "value"> & InputProps & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
44
44
|
export {};
|
|
@@ -23,5 +23,5 @@ type FieldSecureOwnProps = {
|
|
|
23
23
|
export type FieldSecureProps = WithSupportProps<FieldSecureOwnProps & InputProps & WrapperProps>;
|
|
24
24
|
export declare const FieldSecure: import("react").ForwardRefExoticComponent<{
|
|
25
25
|
'data-test-id'?: string;
|
|
26
|
-
} & import("react").AriaAttributes & FieldSecureOwnProps & Pick<Partial<InputPrivateProps>, "
|
|
26
|
+
} & import("react").AriaAttributes & FieldSecureOwnProps & Pick<Partial<InputPrivateProps>, "onChange" | "value"> & Pick<InputPrivateProps, "id" | "name" | "onFocus" | "onBlur" | "disabled" | "readonly" | "placeholder" | "autoComplete" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
27
27
|
export {};
|
|
@@ -28,4 +28,4 @@ export declare const FieldSelectMultiple: import("react").ForwardRefExoticCompon
|
|
|
28
28
|
resetSearchOnOptionSelection?: boolean;
|
|
29
29
|
onOpenChange?(open: boolean): void;
|
|
30
30
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
31
|
-
} & Pick<import("@snack-uikit/list").DroplistProps, "
|
|
31
|
+
} & Pick<import("@snack-uikit/list").DroplistProps, "untouchableScrollbars" | "dataError" | "dataFiltered" | "scrollToSelectedItem" | "virtualized" | "noDataState" | "noResultsState" | "errorDataState">, "showCopyButton" | "onCopyButtonClick"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -26,4 +26,4 @@ export declare const FieldSelectSingle: import("react").ForwardRefExoticComponen
|
|
|
26
26
|
resetSearchOnOptionSelection?: boolean;
|
|
27
27
|
onOpenChange?(open: boolean): void;
|
|
28
28
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
29
|
-
} & Pick<import("@snack-uikit/list").DroplistProps, "
|
|
29
|
+
} & Pick<import("@snack-uikit/list").DroplistProps, "untouchableScrollbars" | "dataError" | "dataFiltered" | "scrollToSelectedItem" | "virtualized" | "noDataState" | "noResultsState" | "errorDataState"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -23,5 +23,5 @@ type FieldSliderOwnProps = {
|
|
|
23
23
|
export type FieldSliderProps = WithSupportProps<FieldSliderOwnProps & SliderProps & WrapperProps>;
|
|
24
24
|
export declare const FieldSlider: import("react").ForwardRefExoticComponent<{
|
|
25
25
|
'data-test-id'?: string;
|
|
26
|
-
} & import("react").AriaAttributes & FieldSliderOwnProps & Pick<InputPrivateProps, "
|
|
26
|
+
} & import("react").AriaAttributes & FieldSliderOwnProps & Pick<InputPrivateProps, "id" | "name" | "onFocus" | "onBlur" | "disabled" | "readonly"> & Pick<SliderComponentProps, "onChange" | "value" | "range" | "tipFormatter"> & Required<Pick<SliderComponentProps, "max" | "min" | "step" | "marks">> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
27
27
|
export {};
|
|
@@ -3,7 +3,7 @@ import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
|
3
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
4
|
import { Button } from '../../types';
|
|
5
5
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
6
|
-
type InputProps = Pick<Partial<InputPrivateProps>, 'value' | 'onChange'> & Pick<InputPrivateProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'autoComplete' | 'onPaste' | 'onKeyDown'>;
|
|
6
|
+
type InputProps = Pick<Partial<InputPrivateProps>, 'value' | 'onChange'> & Pick<InputPrivateProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'autoComplete' | 'onPaste' | 'onKeyDown' | 'spellCheck'>;
|
|
7
7
|
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
|
|
8
8
|
type FieldTextOwnProps = {
|
|
9
9
|
/** Отображение кнопки Копировать для поля (актуально только для `readonly = true`) */
|
|
@@ -30,5 +30,5 @@ type FieldTextOwnProps = {
|
|
|
30
30
|
export type FieldTextProps = WithSupportProps<FieldTextOwnProps & InputProps & WrapperProps>;
|
|
31
31
|
export declare const FieldText: import("react").ForwardRefExoticComponent<{
|
|
32
32
|
'data-test-id'?: string;
|
|
33
|
-
} & import("react").AriaAttributes & FieldTextOwnProps & Pick<Partial<InputPrivateProps>, "
|
|
33
|
+
} & import("react").AriaAttributes & FieldTextOwnProps & Pick<Partial<InputPrivateProps>, "onChange" | "value"> & Pick<InputPrivateProps, "id" | "name" | "onPaste" | "onFocus" | "onBlur" | "onKeyDown" | "disabled" | "readonly" | "placeholder" | "autoComplete" | "maxLength" | "spellCheck"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
34
34
|
export {};
|
|
@@ -21,7 +21,7 @@ import { getValidationState } from '../../utils/getValidationState';
|
|
|
21
21
|
import { FieldDecorator } from '../FieldDecorator';
|
|
22
22
|
import { getContainerVariant } from './helpers';
|
|
23
23
|
export const FieldText = forwardRef((_a, ref) => {
|
|
24
|
-
var { id, name, value: valueProp, placeholder, maxLength, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, allowMoreThanMaxLength = false, onChange: onChangeProp, onFocus, onBlur, onCopyButtonClick, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, autoComplete, prefixIcon, prefix, postfix, button: buttonProp, onPaste, onKeyDown, type = 'text' } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "onChange", "onFocus", "onBlur", "onCopyButtonClick", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "autoComplete", "prefixIcon", "prefix", "postfix", "button", "onPaste", "onKeyDown", "type"]);
|
|
24
|
+
var { id, name, value: valueProp, placeholder, maxLength, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, allowMoreThanMaxLength = false, onChange: onChangeProp, onFocus, onBlur, onCopyButtonClick, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, autoComplete, prefixIcon, prefix, postfix, button: buttonProp, onPaste, onKeyDown, type = 'text', spellCheck } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "onChange", "onFocus", "onBlur", "onCopyButtonClick", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "autoComplete", "prefixIcon", "prefix", "postfix", "button", "onPaste", "onKeyDown", "type", "spellCheck"]);
|
|
25
25
|
const [value = '', onChange] = useValueControl({
|
|
26
26
|
value: valueProp,
|
|
27
27
|
defaultValue: '',
|
|
@@ -91,5 +91,5 @@ export const FieldText = forwardRef((_a, ref) => {
|
|
|
91
91
|
onInputKeyDown(event);
|
|
92
92
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
93
93
|
};
|
|
94
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, length: maxLength ? { max: maxLength, current: value.length } : undefined, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, validationState: fieldValidationState, error: error }, extractSupportProps(rest), { children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: containerVariant, inputRef: localRef, prefix: prefixButtons, postfix: postfixButtons, disableFocus: isButtonFocused, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, tabIndex: inputTabIndex, onKeyDown: handleKeyDown, onPaste: onPaste, placeholder: placeholder, disabled: disabled, readonly: readonly, type: type, maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, id: id, name: name, autoComplete: autoComplete, "data-test-id": 'field-text__input' }) }) })));
|
|
94
|
+
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, length: maxLength ? { max: maxLength, current: value.length } : undefined, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, validationState: fieldValidationState, error: error }, extractSupportProps(rest), { children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: containerVariant, inputRef: localRef, prefix: prefixButtons, postfix: postfixButtons, disableFocus: isButtonFocused, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, tabIndex: inputTabIndex, onKeyDown: handleKeyDown, onPaste: onPaste, placeholder: placeholder, disabled: disabled, readonly: readonly, type: type, maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, id: id, name: name, autoComplete: autoComplete, spellCheck: spellCheck, "data-test-id": 'field-text__input' }) }) })));
|
|
95
95
|
});
|
|
@@ -2,7 +2,7 @@ import { ChangeEvent, ReactNode } from 'react';
|
|
|
2
2
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
3
3
|
import { TextAreaProps } from '../../helperComponents';
|
|
4
4
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
5
|
-
type InputProps = Pick<Partial<TextAreaProps>, 'value'> & Pick<TextAreaProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'onKeyDown'>;
|
|
5
|
+
type InputProps = Pick<Partial<TextAreaProps>, 'value'> & Pick<TextAreaProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'spellCheck'>;
|
|
6
6
|
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'size' | 'validationState' | 'showHintIcon' | 'labelTooltipPlacement' | 'error'>;
|
|
7
7
|
type FieldTextAreaOwnProps = {
|
|
8
8
|
/** Минимальное кол-во строк, до которого размер поля может быть увеличен @default 3*/
|
|
@@ -30,5 +30,5 @@ type FieldTextAreaOwnProps = {
|
|
|
30
30
|
export type FieldTextAreaProps = WithSupportProps<FieldTextAreaOwnProps & InputProps & WrapperProps>;
|
|
31
31
|
export declare const FieldTextArea: import("react").ForwardRefExoticComponent<{
|
|
32
32
|
'data-test-id'?: string;
|
|
33
|
-
} & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "
|
|
33
|
+
} & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "id" | "name" | "onFocus" | "onBlur" | "onKeyDown" | "disabled" | "readonly" | "placeholder" | "maxLength" | "spellCheck"> & WrapperProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
34
34
|
export {};
|
|
@@ -22,7 +22,7 @@ import { getValidationState } from '../../utils/getValidationState';
|
|
|
22
22
|
import { FieldDecorator } from '../FieldDecorator';
|
|
23
23
|
import styles from './styles.module.css';
|
|
24
24
|
export const FieldTextArea = forwardRef((_a, ref) => {
|
|
25
|
-
var { id, name, value: valueProp, placeholder, maxLength, minRows = 3, maxRows = 1000, disabled = false, resizable = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, allowMoreThanMaxLength = true, showHintIcon, onChange: onChangeProp, onFocus, onBlur, onKeyDown, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, error, size = SIZE.S, validationState = VALIDATION_STATE.Default, onCopyButtonClick, footer } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "minRows", "maxRows", "disabled", "resizable", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "showHintIcon", "onChange", "onFocus", "onBlur", "onKeyDown", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "error", "size", "validationState", "onCopyButtonClick", "footer"]);
|
|
25
|
+
var { id, name, value: valueProp, placeholder, maxLength, minRows = 3, maxRows = 1000, disabled = false, resizable = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, allowMoreThanMaxLength = true, showHintIcon, onChange: onChangeProp, onFocus, onBlur, onKeyDown, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, error, size = SIZE.S, validationState = VALIDATION_STATE.Default, onCopyButtonClick, footer, spellCheck } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "minRows", "maxRows", "disabled", "resizable", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "showHintIcon", "onChange", "onFocus", "onBlur", "onKeyDown", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "error", "size", "validationState", "onCopyButtonClick", "footer", "spellCheck"]);
|
|
26
26
|
const localRef = useRef(null);
|
|
27
27
|
const clearButtonRef = useRef(null);
|
|
28
28
|
const copyButtonRef = useRef(null);
|
|
@@ -60,5 +60,5 @@ export const FieldTextArea = forwardRef((_a, ref) => {
|
|
|
60
60
|
onInputKeyDown(event);
|
|
61
61
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
62
62
|
};
|
|
63
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, length: maxLength ? { max: maxLength, current: value.length } : undefined, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, error: error, validationState: fieldValidationState }, extractSupportProps(rest), { children: _jsxs(FieldContainerPrivate, { className: styles.container, size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, "data-resizable": isResizable || undefined, "data-actions": Boolean(footer) || undefined, variant: CONTAINER_VARIANT.MultiLine, style: { '--max-rows': maxRows, '--min-rows': minRows }, inputRef: localRef, postfix: _jsx("span", { className: styles.postfix, children: postfixButtons }), children: [_jsx(Scroll, { className: styles.scrollContainer, size: 's', barHideStrategy: 'never', resize: isResizable ? 'vertical' : 'none', "data-test-id": 'field-textarea__scroll-area', children: _jsx(TextArea, { className: styles.textarea, "data-size": size, value: value, onChange: onChange, placeholder: placeholder, disabled: disabled, readonly: readonly, minRows: minRows, id: id, name: name, ref: mergeRefs(ref, localRef), onFocus: onFocus, onBlur: onBlur, onKeyDown: handleKeyDown, tabIndex: inputTabIndex, maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, "data-test-id": 'field-textarea__input' }) }), footer] }) })));
|
|
63
|
+
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, length: maxLength ? { max: maxLength, current: value.length } : undefined, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, error: error, validationState: fieldValidationState }, extractSupportProps(rest), { children: _jsxs(FieldContainerPrivate, { className: styles.container, size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, "data-resizable": isResizable || undefined, "data-actions": Boolean(footer) || undefined, variant: CONTAINER_VARIANT.MultiLine, style: { '--max-rows': maxRows, '--min-rows': minRows }, inputRef: localRef, postfix: _jsx("span", { className: styles.postfix, children: postfixButtons }), children: [_jsx(Scroll, { className: styles.scrollContainer, size: 's', barHideStrategy: 'never', resize: isResizable ? 'vertical' : 'none', "data-test-id": 'field-textarea__scroll-area', children: _jsx(TextArea, { className: styles.textarea, "data-size": size, value: value, onChange: onChange, placeholder: placeholder, disabled: disabled, readonly: readonly, minRows: minRows, id: id, name: name, ref: mergeRefs(ref, localRef), onFocus: onFocus, onBlur: onBlur, onKeyDown: handleKeyDown, tabIndex: inputTabIndex, spellCheck: spellCheck, maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, "data-test-id": 'field-textarea__input' }) }), footer] }) })));
|
|
64
64
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ButtonFieldProps } from '../ButtonField';
|
|
2
|
-
export declare const ButtonFieldList: import("react").ForwardRefExoticComponent<Omit<ButtonFieldProps, "hasArrow" | "arrowOpen"> & Pick<import("@snack-uikit/list").DroplistProps, "
|
|
2
|
+
export declare const ButtonFieldList: import("react").ForwardRefExoticComponent<Omit<ButtonFieldProps, "hasArrow" | "arrowOpen"> & Pick<import("@snack-uikit/list").DroplistProps, "search" | "open" | "onOpenChange" | "items" | "scroll"> & {
|
|
3
3
|
selection?: Omit<import("@snack-uikit/list").SelectionSingleState, "mode">;
|
|
4
4
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -30,5 +30,7 @@ export type TextAreaProps = RefAttributes<HTMLTextAreaElement> & WithSupportProp
|
|
|
30
30
|
tabIndex?: number;
|
|
31
31
|
/** Минимальное кол-во строк, до которого размер поля может быть увеличен @default 3*/
|
|
32
32
|
minRows?: number;
|
|
33
|
+
/** Включение проверки орфографии @default true*/
|
|
34
|
+
spellCheck?: boolean;
|
|
33
35
|
}>;
|
|
34
36
|
export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & RefAttributes<HTMLTextAreaElement>>;
|