@snack-uikit/fields 0.43.1-preview-e9e71368.0 → 0.45.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 +1 -1
- package/dist/cjs/components/FieldTextArea/FieldTextArea.d.ts +5 -3
- package/dist/cjs/components/FieldTextArea/FieldTextArea.js +13 -6
- package/dist/cjs/components/FieldTextArea/styles.module.css +4 -0
- package/dist/cjs/helperComponents/ButtonFieldList/ButtonFieldList.d.ts +1 -1
- package/dist/cjs/hooks/index.d.ts +2 -1
- package/dist/cjs/hooks/index.js +2 -1
- package/dist/cjs/hooks/usePostfixButton.d.ts +11 -0
- package/dist/cjs/hooks/{addonButton/useAddonButton.js → usePostfixButton.js} +15 -21
- package/dist/cjs/hooks/usePrefixButton.d.ts +11 -0
- package/dist/cjs/hooks/usePrefixButton.js +63 -0
- package/dist/cjs/types/allFields.d.ts +4 -9
- 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 +1 -1
- package/dist/esm/components/FieldTextArea/FieldTextArea.d.ts +5 -3
- package/dist/esm/components/FieldTextArea/FieldTextArea.js +7 -3
- package/dist/esm/components/FieldTextArea/styles.module.css +4 -0
- package/dist/esm/helperComponents/ButtonFieldList/ButtonFieldList.d.ts +1 -1
- package/dist/esm/hooks/index.d.ts +2 -1
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/hooks/usePostfixButton.d.ts +11 -0
- package/dist/esm/hooks/usePostfixButton.js +28 -0
- package/dist/esm/hooks/usePrefixButton.d.ts +11 -0
- package/dist/esm/hooks/usePrefixButton.js +28 -0
- package/dist/esm/types/allFields.d.ts +4 -9
- package/package.json +2 -2
- package/src/components/FieldTextArea/FieldTextArea.tsx +17 -3
- package/src/components/FieldTextArea/styles.module.scss +7 -3
- package/src/hooks/index.ts +2 -1
- package/src/hooks/{addonButton/useAddonButton.tsx → usePostfixButton.tsx} +22 -29
- package/src/hooks/usePrefixButton.tsx +76 -0
- package/src/types/allFields.ts +5 -15
- package/dist/cjs/hooks/addonButton/index.d.ts +0 -2
- package/dist/cjs/hooks/addonButton/index.js +0 -26
- package/dist/cjs/hooks/addonButton/useAddonButton.d.ts +0 -14
- package/dist/cjs/hooks/addonButton/usePostfixButton.d.ts +0 -6
- package/dist/cjs/hooks/addonButton/usePostfixButton.js +0 -26
- package/dist/cjs/hooks/addonButton/usePrefixButton.d.ts +0 -6
- package/dist/cjs/hooks/addonButton/usePrefixButton.js +0 -26
- package/dist/esm/hooks/addonButton/index.d.ts +0 -2
- package/dist/esm/hooks/addonButton/index.js +0 -2
- package/dist/esm/hooks/addonButton/useAddonButton.d.ts +0 -14
- package/dist/esm/hooks/addonButton/useAddonButton.js +0 -30
- package/dist/esm/hooks/addonButton/usePostfixButton.d.ts +0 -6
- package/dist/esm/hooks/addonButton/usePostfixButton.js +0 -16
- package/dist/esm/hooks/addonButton/usePrefixButton.d.ts +0 -6
- package/dist/esm/hooks/addonButton/usePrefixButton.js +0 -16
- package/src/hooks/addonButton/index.ts +0 -2
- package/src/hooks/addonButton/usePostfixButton.tsx +0 -12
- package/src/hooks/addonButton/usePrefixButton.tsx +0 -12
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.45.0 (2025-05-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **PDS-2223:** add onKeyDown props to FieldTextArea ([818f74d](https://github.com/cloud-ru-tech/snack-uikit/commit/818f74d498068e5cd9ed13bc9d2f9bfcc1943d2f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# 0.44.0 (2025-05-23)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **PDS-2225:** actions at the bottom of textarea input ([9a050ec](https://github.com/cloud-ru-tech/snack-uikit/commit/9a050ec1c60c3df39789a13b652a37373ed80027))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# 0.43.0 (2025-05-21)
|
|
7
29
|
|
|
8
30
|
|
package/README.md
CHANGED
|
@@ -509,6 +509,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
509
509
|
| onCopyButtonClick | `() => void` | - | Колбек клика по кнопке Копировать для поля |
|
|
510
510
|
| showClearButton | `boolean` | true | Отображение кнопки очистки поля |
|
|
511
511
|
| allowMoreThanMaxLength | `boolean` | true | Можно ли вводить больше разрешённого кол-ва символов |
|
|
512
|
+
| footer | `ReactNode` | - | Нода под футер |
|
|
512
513
|
| value | `string` | - | HTML-аттрибут value |
|
|
513
514
|
| id | `string` | - | HTML-аттрибут id |
|
|
514
515
|
| name | `string` | - | HTML-аттрибут name |
|
|
@@ -518,6 +519,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
518
519
|
| onBlur | `FocusEventHandler<HTMLTextAreaElement>` | - | Колбек потери фокуса |
|
|
519
520
|
| placeholder | `string` | - | Плейсхолдер |
|
|
520
521
|
| maxLength | `number` | - | Максимальное кол-во символов |
|
|
522
|
+
| onKeyDown | `KeyboardEventHandler<HTMLTextAreaElement>` | - | Колбек нажатия клавиши клавиатуры |
|
|
521
523
|
| className | `string` | - | CSS-класс |
|
|
522
524
|
| label | `string` | - | Лейбл |
|
|
523
525
|
| labelTooltip | `ReactNode` | - | Всплывающая подсказка лейбла |
|
|
@@ -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, "value" | "onChange"> & 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>, "value" | "onChange"> & Pick<InputPrivateProps, "onFocus" | "onBlur" | "id" | "disabled" | "name" | "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, "scrollToSelectedItem" | "virtualized" | "untouchableScrollbars" | "dataFiltered" | "dataError" | "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, "scrollToSelectedItem" | "virtualized" | "untouchableScrollbars" | "dataFiltered" | "dataError" | "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, "onFocus" | "onBlur" | "id" | "disabled" | "name" | "readonly"> & Pick<SliderComponentProps, "value" | "onChange" | "range" | "tipFormatter"> & Required<Pick<SliderComponentProps, "max" | "min" | "step" | "marks">> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
27
27
|
export {};
|
|
@@ -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>, "value" | "onChange"> & Pick<InputPrivateProps, "onKeyDown" | "onFocus" | "onBlur" | "id" | "disabled" | "name" | "onPaste" | "readonly" | "placeholder" | "autoComplete" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
34
34
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
1
|
+
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'>;
|
|
5
|
+
type InputProps = Pick<Partial<TextAreaProps>, 'value'> & Pick<TextAreaProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'onKeyDown'>;
|
|
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*/
|
|
@@ -24,9 +24,11 @@ type FieldTextAreaOwnProps = {
|
|
|
24
24
|
showClearButton?: boolean;
|
|
25
25
|
/** Можно ли вводить больше разрешённого кол-ва символов */
|
|
26
26
|
allowMoreThanMaxLength?: boolean;
|
|
27
|
+
/** Нода под футер */
|
|
28
|
+
footer?: ReactNode;
|
|
27
29
|
};
|
|
28
30
|
export type FieldTextAreaProps = WithSupportProps<FieldTextAreaOwnProps & InputProps & WrapperProps>;
|
|
29
31
|
export declare const FieldTextArea: import("react").ForwardRefExoticComponent<{
|
|
30
32
|
'data-test-id'?: string;
|
|
31
|
-
} & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "
|
|
33
|
+
} & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "onKeyDown" | "onFocus" | "onBlur" | "id" | "disabled" | "name" | "readonly" | "placeholder" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
32
34
|
export {};
|
|
@@ -48,6 +48,7 @@ exports.FieldTextArea = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
48
48
|
onChange: onChangeProp,
|
|
49
49
|
onFocus,
|
|
50
50
|
onBlur,
|
|
51
|
+
onKeyDown,
|
|
51
52
|
className,
|
|
52
53
|
label,
|
|
53
54
|
labelTooltip,
|
|
@@ -58,9 +59,10 @@ exports.FieldTextArea = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
58
59
|
error,
|
|
59
60
|
size = input_private_1.SIZE.S,
|
|
60
61
|
validationState = constants_1.VALIDATION_STATE.Default,
|
|
61
|
-
onCopyButtonClick
|
|
62
|
+
onCopyButtonClick,
|
|
63
|
+
footer
|
|
62
64
|
} = _a,
|
|
63
|
-
rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "minRows", "maxRows", "disabled", "resizable", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "showHintIcon", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "error", "size", "validationState", "onCopyButtonClick"]);
|
|
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"]);
|
|
64
66
|
const localRef = (0, react_1.useRef)(null);
|
|
65
67
|
const clearButtonRef = (0, react_1.useRef)(null);
|
|
66
68
|
const copyButtonRef = (0, react_1.useRef)(null);
|
|
@@ -106,6 +108,10 @@ exports.FieldTextArea = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
106
108
|
readonly,
|
|
107
109
|
submitKeys: ['Enter', 'Space', 'Tab']
|
|
108
110
|
});
|
|
111
|
+
const handleKeyDown = event => {
|
|
112
|
+
onInputKeyDown(event);
|
|
113
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
114
|
+
};
|
|
109
115
|
return (0, jsx_runtime_1.jsx)(FieldDecorator_1.FieldDecorator, Object.assign({
|
|
110
116
|
className: className,
|
|
111
117
|
label: label,
|
|
@@ -126,13 +132,14 @@ exports.FieldTextArea = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
126
132
|
error: error,
|
|
127
133
|
validationState: fieldValidationState
|
|
128
134
|
}, (0, utils_1.extractSupportProps)(rest), {
|
|
129
|
-
children: (0, jsx_runtime_1.
|
|
135
|
+
children: (0, jsx_runtime_1.jsxs)(helperComponents_1.FieldContainerPrivate, {
|
|
130
136
|
className: styles_module_scss_1.default.container,
|
|
131
137
|
size: size,
|
|
132
138
|
validationState: fieldValidationState,
|
|
133
139
|
disabled: disabled,
|
|
134
140
|
readonly: readonly,
|
|
135
141
|
"data-resizable": isResizable || undefined,
|
|
142
|
+
"data-actions": Boolean(footer) || undefined,
|
|
136
143
|
variant: constants_1.CONTAINER_VARIANT.MultiLine,
|
|
137
144
|
style: {
|
|
138
145
|
'--max-rows': maxRows,
|
|
@@ -143,7 +150,7 @@ exports.FieldTextArea = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
143
150
|
className: styles_module_scss_1.default.postfix,
|
|
144
151
|
children: postfixButtons
|
|
145
152
|
}),
|
|
146
|
-
children: (0, jsx_runtime_1.jsx)(scroll_1.Scroll, {
|
|
153
|
+
children: [(0, jsx_runtime_1.jsx)(scroll_1.Scroll, {
|
|
147
154
|
className: styles_module_scss_1.default.scrollContainer,
|
|
148
155
|
size: 's',
|
|
149
156
|
barHideStrategy: 'never',
|
|
@@ -163,12 +170,12 @@ exports.FieldTextArea = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
163
170
|
ref: (0, merge_refs_1.default)(ref, localRef),
|
|
164
171
|
onFocus: onFocus,
|
|
165
172
|
onBlur: onBlur,
|
|
166
|
-
onKeyDown:
|
|
173
|
+
onKeyDown: handleKeyDown,
|
|
167
174
|
tabIndex: inputTabIndex,
|
|
168
175
|
maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined,
|
|
169
176
|
"data-test-id": 'field-textarea__input'
|
|
170
177
|
})
|
|
171
|
-
})
|
|
178
|
+
}), footer]
|
|
172
179
|
})
|
|
173
180
|
}));
|
|
174
181
|
});
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
--max-rows:1000;
|
|
3
3
|
--min-rows:3;
|
|
4
4
|
}
|
|
5
|
+
.container[data-actions]{
|
|
6
|
+
display:flex;
|
|
7
|
+
flex-direction:column;
|
|
8
|
+
}
|
|
5
9
|
.container .scrollContainer{
|
|
6
10
|
min-height:calc(var(--min-rows) * var(--row-height) + var(--horizontal-scroll-bar-height));
|
|
7
11
|
max-height:calc(var(--max-rows) * var(--row-height) + var(--horizontal-scroll-bar-height));
|
|
@@ -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, "open" | "onOpenChange" | "items" | "search" | "scroll"> & {
|
|
3
3
|
selection?: Omit<import("@snack-uikit/list").SelectionSingleState, "mode">;
|
|
4
4
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -2,6 +2,7 @@ export * from './dateHandlers';
|
|
|
2
2
|
export * from './useCopyButton';
|
|
3
3
|
export * from './useHideButton';
|
|
4
4
|
export * from './usePostfix';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './usePostfixButton';
|
|
6
6
|
export * from './usePrefix';
|
|
7
|
+
export * from './usePrefixButton';
|
|
7
8
|
export * from './useValueControl';
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __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("./usePostfixButton"), exports);
|
|
30
30
|
__exportStar(require("./usePrefix"), exports);
|
|
31
|
+
__exportStar(require("./usePrefixButton"), exports);
|
|
31
32
|
__exportStar(require("./useValueControl"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonProps, Size } from '@snack-uikit/input-private';
|
|
3
|
+
import { ButtonFieldProps } from '../helperComponents';
|
|
4
|
+
import { Button } from '../types';
|
|
5
|
+
export declare function usePostfixButton({ button, size, postfixIcon, disabled, readonly, onFocus, onBlur, }: {
|
|
6
|
+
button?: Button;
|
|
7
|
+
size: Size;
|
|
8
|
+
postfixIcon?: ReactElement;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
} & Pick<ButtonFieldProps, 'onFocus' | 'onBlur'>): ButtonProps;
|
|
@@ -3,38 +3,36 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.usePostfixButton = usePostfixButton;
|
|
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 usePostfixButton(_ref) {
|
|
11
11
|
let {
|
|
12
|
-
variant,
|
|
13
12
|
button,
|
|
14
|
-
icon,
|
|
15
13
|
size,
|
|
14
|
+
postfixIcon,
|
|
16
15
|
disabled,
|
|
17
16
|
readonly,
|
|
18
|
-
type,
|
|
19
17
|
onFocus,
|
|
20
18
|
onBlur
|
|
21
19
|
} = _ref;
|
|
22
20
|
const buttonListRef = (0, react_1.useRef)(null);
|
|
23
21
|
const postfixIconProps = (0, react_1.useMemo)(() => ({
|
|
24
|
-
id:
|
|
22
|
+
id: 'postfixIcon',
|
|
25
23
|
active: false,
|
|
26
|
-
show: Boolean(
|
|
24
|
+
show: Boolean(postfixIcon && !button),
|
|
27
25
|
render: () => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {
|
|
28
|
-
children:
|
|
26
|
+
children: postfixIcon
|
|
29
27
|
})
|
|
30
|
-
}), [button,
|
|
31
|
-
const
|
|
32
|
-
id:
|
|
28
|
+
}), [button, postfixIcon]);
|
|
29
|
+
const postfixButtonProps = (0, react_1.useMemo)(() => ({
|
|
30
|
+
id: 'postfixButton',
|
|
33
31
|
active: false,
|
|
34
|
-
show: Boolean(button && button.variant ===
|
|
32
|
+
show: Boolean(button && button.variant === 'after'),
|
|
35
33
|
render: renderProps => {
|
|
36
34
|
const buttonProps = Object.assign(Object.assign({}, renderProps), {
|
|
37
|
-
variant,
|
|
35
|
+
variant: 'after',
|
|
38
36
|
size,
|
|
39
37
|
content: button === null || button === void 0 ? void 0 : button.content,
|
|
40
38
|
disabled: disabled || readonly,
|
|
@@ -58,12 +56,8 @@ function useAddonButton(_ref) {
|
|
|
58
56
|
onOpenChange: button.onOpenChange
|
|
59
57
|
}));
|
|
60
58
|
}
|
|
61
|
-
|
|
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;
|
|
59
|
+
return (0, jsx_runtime_1.jsx)(helperComponents_1.ButtonField, Object.assign({}, buttonProps));
|
|
66
60
|
}
|
|
67
|
-
}), [
|
|
68
|
-
return button ?
|
|
61
|
+
}), [button, size, disabled, readonly, onFocus, onBlur]);
|
|
62
|
+
return button ? postfixButtonProps : postfixIconProps;
|
|
69
63
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonProps, Size } from '@snack-uikit/input-private';
|
|
3
|
+
import { ButtonFieldProps } from '../helperComponents';
|
|
4
|
+
import { Button } from '../types';
|
|
5
|
+
export declare function usePrefixButton({ button, prefixIcon, size, disabled, readonly, onFocus, onBlur, }: {
|
|
6
|
+
button?: Button;
|
|
7
|
+
prefixIcon?: ReactElement;
|
|
8
|
+
size: Size;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
} & Pick<ButtonFieldProps, 'onFocus' | 'onBlur'>): ButtonProps;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePrefixButton = usePrefixButton;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const helperComponents_1 = require("../helperComponents");
|
|
10
|
+
function usePrefixButton(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
button,
|
|
13
|
+
prefixIcon,
|
|
14
|
+
size,
|
|
15
|
+
disabled,
|
|
16
|
+
readonly,
|
|
17
|
+
onFocus,
|
|
18
|
+
onBlur
|
|
19
|
+
} = _ref;
|
|
20
|
+
const buttonListRef = (0, react_1.useRef)(null);
|
|
21
|
+
const prefixIconProps = (0, react_1.useMemo)(() => ({
|
|
22
|
+
id: 'prefixIcon',
|
|
23
|
+
active: false,
|
|
24
|
+
show: Boolean(prefixIcon && !button),
|
|
25
|
+
render: () => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {
|
|
26
|
+
children: prefixIcon
|
|
27
|
+
})
|
|
28
|
+
}), [button, prefixIcon]);
|
|
29
|
+
const prefixButtonProps = (0, react_1.useMemo)(() => ({
|
|
30
|
+
id: 'prefixButton',
|
|
31
|
+
active: false,
|
|
32
|
+
show: Boolean(button && button.variant === 'before'),
|
|
33
|
+
render: renderProps => {
|
|
34
|
+
const buttonProps = Object.assign(Object.assign({}, renderProps), {
|
|
35
|
+
variant: 'before',
|
|
36
|
+
size,
|
|
37
|
+
content: button === null || button === void 0 ? void 0 : button.content,
|
|
38
|
+
disabled: disabled || readonly,
|
|
39
|
+
onFocus,
|
|
40
|
+
onBlur
|
|
41
|
+
});
|
|
42
|
+
if (button === null || button === void 0 ? void 0 : button.items) {
|
|
43
|
+
return (0, jsx_runtime_1.jsx)(helperComponents_1.ButtonFieldList, Object.assign({}, buttonProps, {
|
|
44
|
+
ref: buttonListRef,
|
|
45
|
+
onClick: () => {
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
var _a;
|
|
48
|
+
return (_a = buttonListRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
49
|
+
}, 0);
|
|
50
|
+
},
|
|
51
|
+
search: button.search,
|
|
52
|
+
items: button.items,
|
|
53
|
+
selection: button.selection,
|
|
54
|
+
open: button.open,
|
|
55
|
+
scroll: button.scroll,
|
|
56
|
+
onOpenChange: button.onOpenChange
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
return (0, jsx_runtime_1.jsx)(helperComponents_1.ButtonField, Object.assign({}, buttonProps));
|
|
60
|
+
}
|
|
61
|
+
}), [button, size, disabled, readonly, onFocus, onBlur]);
|
|
62
|
+
return button ? prefixButtonProps : prefixIconProps;
|
|
63
|
+
}
|
|
@@ -2,7 +2,6 @@ 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';
|
|
6
5
|
export type ValidationState = ValueOf<typeof VALIDATION_STATE>;
|
|
7
6
|
export type ContainerVariant = ValueOf<typeof CONTAINER_VARIANT>;
|
|
8
7
|
export type ButtonVariant = ValueOf<typeof BUTTON_VARIANT>;
|
|
@@ -13,12 +12,8 @@ export type AsyncValueRequest = Promise<{
|
|
|
13
12
|
export type NativeDroplistProps = Pick<DroplistProps, 'items' | 'open' | 'onOpenChange' | 'search' | 'scroll'> & {
|
|
14
13
|
selection?: Omit<SelectionSingleState, 'mode'>;
|
|
15
14
|
};
|
|
16
|
-
export type Button = Omit<NativeDroplistProps, 'items'> &
|
|
15
|
+
export type Button = Omit<NativeDroplistProps, 'items'> & {
|
|
16
|
+
variant: ButtonVariant;
|
|
17
|
+
content?: ReactNode;
|
|
17
18
|
items?: DroplistProps['items'];
|
|
18
|
-
|
|
19
|
-
arrowOpen?: never;
|
|
20
|
-
wrapper?: never;
|
|
21
|
-
} | (Pick<ButtonFieldProps, 'hasArrow' | 'arrowOpen'> & {
|
|
22
|
-
items?: never;
|
|
23
|
-
wrapper?: (button: ReactNode) => JSX.Element;
|
|
24
|
-
}));
|
|
19
|
+
};
|
|
@@ -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, "value" | "onChange"> & 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>, "value" | "onChange"> & Pick<InputPrivateProps, "onFocus" | "onBlur" | "id" | "disabled" | "name" | "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, "scrollToSelectedItem" | "virtualized" | "untouchableScrollbars" | "dataFiltered" | "dataError" | "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, "scrollToSelectedItem" | "virtualized" | "untouchableScrollbars" | "dataFiltered" | "dataError" | "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, "onFocus" | "onBlur" | "id" | "disabled" | "name" | "readonly"> & Pick<SliderComponentProps, "value" | "onChange" | "range" | "tipFormatter"> & Required<Pick<SliderComponentProps, "max" | "min" | "step" | "marks">> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
27
27
|
export {};
|
|
@@ -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>, "value" | "onChange"> & Pick<InputPrivateProps, "onKeyDown" | "onFocus" | "onBlur" | "id" | "disabled" | "name" | "onPaste" | "readonly" | "placeholder" | "autoComplete" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
34
34
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
1
|
+
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'>;
|
|
5
|
+
type InputProps = Pick<Partial<TextAreaProps>, 'value'> & Pick<TextAreaProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'onKeyDown'>;
|
|
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*/
|
|
@@ -24,9 +24,11 @@ type FieldTextAreaOwnProps = {
|
|
|
24
24
|
showClearButton?: boolean;
|
|
25
25
|
/** Можно ли вводить больше разрешённого кол-ва символов */
|
|
26
26
|
allowMoreThanMaxLength?: boolean;
|
|
27
|
+
/** Нода под футер */
|
|
28
|
+
footer?: ReactNode;
|
|
27
29
|
};
|
|
28
30
|
export type FieldTextAreaProps = WithSupportProps<FieldTextAreaOwnProps & InputProps & WrapperProps>;
|
|
29
31
|
export declare const FieldTextArea: import("react").ForwardRefExoticComponent<{
|
|
30
32
|
'data-test-id'?: string;
|
|
31
|
-
} & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "
|
|
33
|
+
} & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "onKeyDown" | "onFocus" | "onBlur" | "id" | "disabled" | "name" | "readonly" | "placeholder" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
32
34
|
export {};
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import mergeRefs from 'merge-refs';
|
|
14
14
|
import { forwardRef, useMemo, useRef } from 'react';
|
|
15
15
|
import { SIZE, useButtonNavigation, useClearButton } from '@snack-uikit/input-private';
|
|
@@ -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, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, error, size = SIZE.S, validationState = VALIDATION_STATE.Default, onCopyButtonClick } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "minRows", "maxRows", "disabled", "resizable", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "showHintIcon", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "error", "size", "validationState", "onCopyButtonClick"]);
|
|
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"]);
|
|
26
26
|
const localRef = useRef(null);
|
|
27
27
|
const clearButtonRef = useRef(null);
|
|
28
28
|
const copyButtonRef = useRef(null);
|
|
@@ -56,5 +56,9 @@ export const FieldTextArea = forwardRef((_a, ref) => {
|
|
|
56
56
|
readonly,
|
|
57
57
|
submitKeys: ['Enter', 'Space', 'Tab'],
|
|
58
58
|
});
|
|
59
|
-
|
|
59
|
+
const handleKeyDown = event => {
|
|
60
|
+
onInputKeyDown(event);
|
|
61
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
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] }) })));
|
|
60
64
|
});
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
--max-rows:1000;
|
|
3
3
|
--min-rows:3;
|
|
4
4
|
}
|
|
5
|
+
.container[data-actions]{
|
|
6
|
+
display:flex;
|
|
7
|
+
flex-direction:column;
|
|
8
|
+
}
|
|
5
9
|
.container .scrollContainer{
|
|
6
10
|
min-height:calc(var(--min-rows) * var(--row-height) + var(--horizontal-scroll-bar-height));
|
|
7
11
|
max-height:calc(var(--max-rows) * var(--row-height) + var(--horizontal-scroll-bar-height));
|
|
@@ -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, "open" | "onOpenChange" | "items" | "search" | "scroll"> & {
|
|
3
3
|
selection?: Omit<import("@snack-uikit/list").SelectionSingleState, "mode">;
|
|
4
4
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -2,6 +2,7 @@ export * from './dateHandlers';
|
|
|
2
2
|
export * from './useCopyButton';
|
|
3
3
|
export * from './useHideButton';
|
|
4
4
|
export * from './usePostfix';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './usePostfixButton';
|
|
6
6
|
export * from './usePrefix';
|
|
7
|
+
export * from './usePrefixButton';
|
|
7
8
|
export * from './useValueControl';
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from './dateHandlers';
|
|
|
2
2
|
export * from './useCopyButton';
|
|
3
3
|
export * from './useHideButton';
|
|
4
4
|
export * from './usePostfix';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './usePostfixButton';
|
|
6
6
|
export * from './usePrefix';
|
|
7
|
+
export * from './usePrefixButton';
|
|
7
8
|
export * from './useValueControl';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonProps, Size } from '@snack-uikit/input-private';
|
|
3
|
+
import { ButtonFieldProps } from '../helperComponents';
|
|
4
|
+
import { Button } from '../types';
|
|
5
|
+
export declare function usePostfixButton({ button, size, postfixIcon, disabled, readonly, onFocus, onBlur, }: {
|
|
6
|
+
button?: Button;
|
|
7
|
+
size: Size;
|
|
8
|
+
postfixIcon?: ReactElement;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
} & Pick<ButtonFieldProps, 'onFocus' | 'onBlur'>): ButtonProps;
|