@snack-uikit/fields 0.36.3 → 0.36.5-preview-c8fb5dcc.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 +10 -0
- package/README.md +11 -0
- package/dist/cjs/components/FieldColor/FieldColor.d.ts +5 -0
- package/dist/cjs/components/FieldColor/FieldColor.js +5 -3
- package/dist/cjs/components/FieldDate/FieldDate.d.ts +3 -0
- package/dist/cjs/components/FieldDate/FieldDate.js +5 -3
- package/dist/cjs/components/FieldDecorator/FieldDecorator.d.ts +12 -1
- package/dist/cjs/components/FieldDecorator/FieldDecorator.js +5 -3
- package/dist/cjs/components/FieldSecure/FieldSecure.d.ts +3 -1
- package/dist/cjs/components/FieldSecure/FieldSecure.js +5 -3
- package/dist/cjs/components/FieldSelect/FieldSelectMultiple.d.ts +1 -0
- package/dist/cjs/components/FieldSelect/FieldSelectMultiple.js +4 -2
- package/dist/cjs/components/FieldSelect/FieldSelectSingle.d.ts +1 -0
- package/dist/cjs/components/FieldSelect/FieldSelectSingle.js +4 -2
- package/dist/cjs/components/FieldSelect/types.d.ts +3 -1
- package/dist/cjs/components/FieldSlider/FieldSlider.d.ts +3 -1
- package/dist/cjs/components/FieldSlider/FieldSlider.js +5 -3
- package/dist/cjs/components/FieldStepper/FieldStepper.d.ts +3 -1
- package/dist/cjs/components/FieldStepper/FieldStepper.js +5 -3
- package/dist/cjs/components/FieldText/FieldText.d.ts +3 -1
- package/dist/cjs/components/FieldText/FieldText.js +5 -3
- package/dist/cjs/components/FieldTextArea/FieldTextArea.d.ts +3 -1
- package/dist/cjs/components/FieldTextArea/FieldTextArea.js +5 -3
- package/dist/cjs/components/FieldTime/FieldTime.d.ts +3 -0
- package/dist/cjs/components/FieldTime/FieldTime.js +5 -3
- package/dist/cjs/helperComponents/ButtonFieldList/ButtonFieldList.d.ts +1 -1
- package/dist/cjs/helperComponents/ButtonFieldList/ButtonFieldList.js +4 -2
- package/dist/cjs/types/allFields.d.ts +1 -1
- package/dist/esm/components/FieldColor/FieldColor.d.ts +5 -0
- package/dist/esm/components/FieldColor/FieldColor.js +2 -2
- package/dist/esm/components/FieldDate/FieldDate.d.ts +3 -0
- package/dist/esm/components/FieldDate/FieldDate.js +3 -3
- package/dist/esm/components/FieldDecorator/FieldDecorator.d.ts +12 -1
- package/dist/esm/components/FieldDecorator/FieldDecorator.js +4 -3
- package/dist/esm/components/FieldSecure/FieldSecure.d.ts +3 -1
- package/dist/esm/components/FieldSecure/FieldSecure.js +2 -2
- package/dist/esm/components/FieldSelect/FieldSelectMultiple.d.ts +1 -0
- package/dist/esm/components/FieldSelect/FieldSelectMultiple.js +2 -2
- package/dist/esm/components/FieldSelect/FieldSelectSingle.d.ts +1 -0
- package/dist/esm/components/FieldSelect/FieldSelectSingle.js +2 -2
- package/dist/esm/components/FieldSelect/types.d.ts +3 -1
- package/dist/esm/components/FieldSlider/FieldSlider.d.ts +3 -1
- package/dist/esm/components/FieldSlider/FieldSlider.js +2 -2
- package/dist/esm/components/FieldStepper/FieldStepper.d.ts +3 -1
- package/dist/esm/components/FieldStepper/FieldStepper.js +2 -2
- package/dist/esm/components/FieldText/FieldText.d.ts +3 -1
- package/dist/esm/components/FieldText/FieldText.js +2 -2
- package/dist/esm/components/FieldTextArea/FieldTextArea.d.ts +3 -1
- package/dist/esm/components/FieldTextArea/FieldTextArea.js +2 -2
- package/dist/esm/components/FieldTime/FieldTime.d.ts +3 -0
- package/dist/esm/components/FieldTime/FieldTime.js +3 -3
- package/dist/esm/helperComponents/ButtonFieldList/ButtonFieldList.d.ts +1 -1
- package/dist/esm/helperComponents/ButtonFieldList/ButtonFieldList.js +2 -2
- package/dist/esm/types/allFields.d.ts +1 -1
- package/package.json +4 -4
- package/src/components/FieldColor/FieldColor.tsx +5 -1
- package/src/components/FieldDate/FieldDate.tsx +15 -1
- package/src/components/FieldDecorator/FieldDecorator.tsx +49 -44
- package/src/components/FieldSecure/FieldSecure.tsx +5 -1
- package/src/components/FieldSelect/FieldSelectMultiple.tsx +2 -0
- package/src/components/FieldSelect/FieldSelectSingle.tsx +2 -0
- package/src/components/FieldSelect/types.ts +4 -1
- package/src/components/FieldSlider/FieldSlider.tsx +5 -0
- package/src/components/FieldStepper/FieldStepper.tsx +5 -0
- package/src/components/FieldText/FieldText.tsx +5 -0
- package/src/components/FieldTextArea/FieldTextArea.tsx +5 -1
- package/src/components/FieldTime/FieldTime.tsx +15 -1
- package/src/helperComponents/ButtonFieldList/ButtonFieldList.tsx +2 -1
- package/src/types/allFields.ts +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ForwardedRef } from 'react';
|
|
1
2
|
import { ColorPickerProps } from '@snack-uikit/color-picker';
|
|
2
3
|
import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
3
4
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
@@ -20,6 +21,8 @@ type FieldDateOwnProps = {
|
|
|
20
21
|
showClearButton?: boolean;
|
|
21
22
|
value?: string;
|
|
22
23
|
onChange?(value: string): void;
|
|
24
|
+
/** Ref для корневой обертки компонента */
|
|
25
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
23
26
|
} & Omit<ColorPickerProps, 'onChange' | 'value'>;
|
|
24
27
|
export type FieldColorProps = WithSupportProps<FieldDateOwnProps & InputProps & WrapperProps>;
|
|
25
28
|
export declare const FieldColor: import("react").ForwardRefExoticComponent<{
|
|
@@ -40,5 +43,7 @@ export declare const FieldColor: import("react").ForwardRefExoticComponent<{
|
|
|
40
43
|
showClearButton?: boolean;
|
|
41
44
|
value?: string;
|
|
42
45
|
onChange?(value: string): void;
|
|
46
|
+
/** Ref для корневой обертки компонента */
|
|
47
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
43
48
|
} & Omit<ColorPickerProps, "value" | "onChange"> & InputProps & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
44
49
|
export {};
|
|
@@ -24,7 +24,7 @@ import { getValidationState } from '../../utils/getValidationState';
|
|
|
24
24
|
import { FieldDecorator } from '../FieldDecorator';
|
|
25
25
|
import styles from './styles.module.css';
|
|
26
26
|
export const FieldColor = forwardRef((_a, ref) => {
|
|
27
|
-
var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onChange, onOpenChange, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, withAlpha, autoApply, placeholder, onFocus, onBlur, onCopyButtonClick } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onChange", "onOpenChange", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "withAlpha", "autoApply", "placeholder", "onFocus", "onBlur", "onCopyButtonClick"]);
|
|
27
|
+
var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onChange, onOpenChange, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, withAlpha, autoApply, placeholder, onFocus, onBlur, onCopyButtonClick, decoratorRef } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onChange", "onOpenChange", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "withAlpha", "autoApply", "placeholder", "onFocus", "onBlur", "onCopyButtonClick", "decoratorRef"]);
|
|
28
28
|
const [isOpen, setIsOpen] = useUncontrolledProp(open, false, onOpenChange);
|
|
29
29
|
const localRef = useRef(null);
|
|
30
30
|
const showDropList = isOpen && !readonly && !disabled;
|
|
@@ -62,7 +62,7 @@ export const FieldColor = forwardRef((_a, ref) => {
|
|
|
62
62
|
(_a = localRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
63
63
|
}
|
|
64
64
|
}, [open]);
|
|
65
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, error: error, validationState: fieldValidationState }, extractSupportProps(rest), { children: _jsx(Dropdown, Object.assign({ trigger: 'click', triggerClassName: styles.triggerClassName, widthStrategy: 'auto' }, (readonly || disabled
|
|
65
|
+
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, error: error, validationState: fieldValidationState, ref: decoratorRef }, extractSupportProps(rest), { children: _jsx(Dropdown, Object.assign({ trigger: 'click', triggerClassName: styles.triggerClassName, widthStrategy: 'auto' }, (readonly || disabled
|
|
66
66
|
? { open: false }
|
|
67
67
|
: {
|
|
68
68
|
open: showDropList,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ForwardedRef } from 'react';
|
|
1
2
|
import { CalendarProps } from '@snack-uikit/calendar';
|
|
2
3
|
import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
3
4
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
@@ -29,6 +30,8 @@ type FieldDateOwnProps = {
|
|
|
29
30
|
*/
|
|
30
31
|
showClearButton?: boolean;
|
|
31
32
|
mode: Mode;
|
|
33
|
+
/** Ref для корневой обертки компонента */
|
|
34
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
32
35
|
} & Pick<CalendarProps, 'buildCellProps'> & ({
|
|
33
36
|
mode: typeof MODES.Date;
|
|
34
37
|
} | FieldDateWithSeconds);
|
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import mergeRefs from 'merge-refs';
|
|
14
|
-
import { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
14
|
+
import { forwardRef, useCallback, useEffect, useMemo, useRef, } from 'react';
|
|
15
15
|
import { useUncontrolledProp } from 'uncontrollable';
|
|
16
16
|
import { Calendar } from '@snack-uikit/calendar';
|
|
17
17
|
import { Dropdown } from '@snack-uikit/dropdown';
|
|
@@ -26,7 +26,7 @@ import { FieldDecorator } from '../FieldDecorator';
|
|
|
26
26
|
import styles from './styles.module.css';
|
|
27
27
|
export const FieldDate = forwardRef((_a, ref) => {
|
|
28
28
|
var _b;
|
|
29
|
-
var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onOpenChange, onChange, onFocus, onBlur: onBlurProp, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, buildCellProps, error, mode, onCopyButtonClick } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "buildCellProps", "error", "mode", "onCopyButtonClick"]);
|
|
29
|
+
var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onOpenChange, onChange, onFocus, onBlur: onBlurProp, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, buildCellProps, error, mode, onCopyButtonClick, decoratorRef } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "buildCellProps", "error", "mode", "onCopyButtonClick", "decoratorRef"]);
|
|
30
30
|
const [isOpen, setIsOpen] = useUncontrolledProp(open, false, onOpenChange);
|
|
31
31
|
const localRef = useRef(null);
|
|
32
32
|
const clearButtonRef = useRef(null);
|
|
@@ -154,7 +154,7 @@ export const FieldDate = forwardRef((_a, ref) => {
|
|
|
154
154
|
e.stopPropagation();
|
|
155
155
|
}
|
|
156
156
|
}, [dateInputClickHandler, isOpen]);
|
|
157
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, error: error, validationState: fieldValidationState }, extractSupportProps(rest), { children: _jsx(Dropdown, Object.assign({ trigger: 'click', triggerClassName: styles.triggerClassName, widthStrategy: 'auto' }, (readonly || disabled
|
|
157
|
+
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, error: error, validationState: fieldValidationState, ref: decoratorRef }, extractSupportProps(rest), { children: _jsx(Dropdown, Object.assign({ trigger: 'click', triggerClassName: styles.triggerClassName, widthStrategy: 'auto' }, (readonly || disabled
|
|
158
158
|
? { open: false }
|
|
159
159
|
: {
|
|
160
160
|
open: showDropList,
|
|
@@ -12,4 +12,15 @@ export type FieldDecoratorProps = WithSupportProps<{
|
|
|
12
12
|
readonly?: boolean;
|
|
13
13
|
error?: string;
|
|
14
14
|
} & HeaderProps & FooterProps>;
|
|
15
|
-
export declare
|
|
15
|
+
export declare const FieldDecorator: import("react").ForwardRefExoticComponent<{
|
|
16
|
+
'data-test-id'?: string;
|
|
17
|
+
} & import("react").AriaAttributes & {
|
|
18
|
+
className?: string;
|
|
19
|
+
/** Контент */
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
/** Деактивирован ли элемент */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Является ли поле доступным только на чтение */
|
|
24
|
+
readonly?: boolean;
|
|
25
|
+
error?: string;
|
|
26
|
+
} & HeaderProps & FooterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import cn from 'classnames';
|
|
14
|
+
import { forwardRef } from 'react';
|
|
14
15
|
import { SIZE } from '@snack-uikit/input-private';
|
|
15
16
|
import { extractSupportProps } from '@snack-uikit/utils';
|
|
16
17
|
import { VALIDATION_STATE } from '../../constants';
|
|
@@ -18,9 +19,9 @@ import { getValidationState } from '../../utils/getValidationState';
|
|
|
18
19
|
import { Footer } from './Footer';
|
|
19
20
|
import { Header } from './Header';
|
|
20
21
|
import styles from './styles.module.css';
|
|
21
|
-
export
|
|
22
|
+
export const FieldDecorator = forwardRef((_a, ref) => {
|
|
22
23
|
var { children, className, label, labelTooltip, required, labelFor, caption, length, hint, disabled, readonly, showHintIcon, labelTooltipPlacement, size = SIZE.S, error, validationState = VALIDATION_STATE.Default } = _a, rest = __rest(_a, ["children", "className", "label", "labelTooltip", "required", "labelFor", "caption", "length", "hint", "disabled", "readonly", "showHintIcon", "labelTooltipPlacement", "size", "error", "validationState"]);
|
|
23
24
|
const isFieldActive = !disabled && !readonly;
|
|
24
25
|
const fieldValidationState = getValidationState({ validationState, error });
|
|
25
|
-
return (_jsxs("div", Object.assign({ className: cn(styles.decorator, className) }, extractSupportProps(rest), { "data-size": size, children: [label && (_jsx(Header, { labelTooltipPlacement: labelTooltipPlacement, required: required, label: label, labelTooltip: labelTooltip, labelFor: labelFor, caption: caption, size: size })), children, _jsx(Footer, { length: isFieldActive ? length : undefined, hint: error || hint, showHintIcon: showHintIcon, size: size, validationState: isFieldActive ? fieldValidationState : VALIDATION_STATE.Default })] })));
|
|
26
|
-
}
|
|
26
|
+
return (_jsxs("div", Object.assign({ className: cn(styles.decorator, className) }, extractSupportProps(rest), { "data-size": size, ref: ref, children: [label && (_jsx(Header, { labelTooltipPlacement: labelTooltipPlacement, required: required, label: label, labelTooltip: labelTooltip, labelFor: labelFor, caption: caption, size: size })), children, _jsx(Footer, { length: isFieldActive ? length : undefined, hint: error || hint, showHintIcon: showHintIcon, size: size, validationState: isFieldActive ? fieldValidationState : VALIDATION_STATE.Default })] })));
|
|
27
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { ForwardedRef, ReactElement } from 'react';
|
|
2
2
|
import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
3
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
4
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
@@ -19,6 +19,8 @@ type FieldSecureOwnProps = {
|
|
|
19
19
|
prefixIcon?: ReactElement;
|
|
20
20
|
/** Свойство позволяет грузить данные в поле по требованию */
|
|
21
21
|
asyncValueGetter?(): Promise<string>;
|
|
22
|
+
/** Ref для корневой обертки компонента */
|
|
23
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
22
24
|
};
|
|
23
25
|
export type FieldSecureProps = WithSupportProps<FieldSecureOwnProps & InputProps & WrapperProps>;
|
|
24
26
|
export declare const FieldSecure: import("react").ForwardRefExoticComponent<{
|
|
@@ -30,7 +30,7 @@ import { useCopyButton, useHideButton, useValueControl } from '../../hooks';
|
|
|
30
30
|
import { getValidationState } from '../../utils/getValidationState';
|
|
31
31
|
import { FieldDecorator } from '../FieldDecorator';
|
|
32
32
|
export const FieldSecure = forwardRef((_a, ref) => {
|
|
33
|
-
var { id, name, value: valueProp, placeholder, maxLength, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, allowMoreThanMaxLength = false, hidden: hiddenProp, onHiddenChange, showHintIcon, onChange: onChangeProp, onFocus, onBlur, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, size = SIZE.S, validationState = VALIDATION_STATE.Default, prefixIcon, error, asyncValueGetter, autoComplete, onCopyButtonClick } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "allowMoreThanMaxLength", "hidden", "onHiddenChange", "showHintIcon", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "size", "validationState", "prefixIcon", "error", "asyncValueGetter", "autoComplete", "onCopyButtonClick"]);
|
|
33
|
+
var { id, name, value: valueProp, placeholder, maxLength, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, allowMoreThanMaxLength = false, hidden: hiddenProp, onHiddenChange, showHintIcon, onChange: onChangeProp, onFocus, onBlur, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, size = SIZE.S, validationState = VALIDATION_STATE.Default, prefixIcon, error, asyncValueGetter, autoComplete, onCopyButtonClick, decoratorRef } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "allowMoreThanMaxLength", "hidden", "onHiddenChange", "showHintIcon", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "size", "validationState", "prefixIcon", "error", "asyncValueGetter", "autoComplete", "onCopyButtonClick", "decoratorRef"]);
|
|
34
34
|
const localRef = useRef(null);
|
|
35
35
|
const copyButtonRef = useRef(null);
|
|
36
36
|
const hideButtonRef = useRef(null);
|
|
@@ -111,5 +111,5 @@ export const FieldSecure = forwardRef((_a, ref) => {
|
|
|
111
111
|
readonly,
|
|
112
112
|
submitKeys: ['Enter', 'Space', 'Tab'],
|
|
113
113
|
});
|
|
114
|
-
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: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: localRef, prefix: prefixIcon, postfix: postfixButtons, children: _jsx(WithSkeleton, { skeleton: _jsx(Skeleton, { width: '100%', borderRadius: 2 }), loading: isLoading, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onInputKeyDown, tabIndex: inputTabIndex, placeholder: placeholder, disabled: disabled, readonly: readonly, type: hidden ? 'password' : 'text', maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, id: id, name: name, "data-test-id": 'field-secure__input', autoComplete: autoComplete }) }) }) })));
|
|
114
|
+
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, ref: decoratorRef }, extractSupportProps(rest), { children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: localRef, prefix: prefixIcon, postfix: postfixButtons, children: _jsx(WithSkeleton, { skeleton: _jsx(Skeleton, { width: '100%', borderRadius: 2 }), loading: isLoading, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onInputKeyDown, tabIndex: inputTabIndex, placeholder: placeholder, disabled: disabled, readonly: readonly, type: hidden ? 'password' : 'text', maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, id: id, name: name, "data-test-id": 'field-secure__input', autoComplete: autoComplete }) }) }) })));
|
|
115
115
|
});
|
|
@@ -28,4 +28,5 @@ export declare const FieldSelectMultiple: import("react").ForwardRefExoticCompon
|
|
|
28
28
|
resetSearchOnOptionSelection?: boolean;
|
|
29
29
|
onOpenChange?(open: boolean): void;
|
|
30
30
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
31
|
+
decoratorRef?: import("react").ForwardedRef<HTMLDivElement>;
|
|
31
32
|
} & Pick<import("@snack-uikit/list").DroplistProps, "scrollToSelectedItem" | "untouchableScrollbars" | "dataFiltered" | "dataError" | "noDataState" | "noResultsState" | "errorDataState">, "showCopyButton" | "onCopyButtonClick"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -32,7 +32,7 @@ const defaultSelectedOptionFormatter = item =>
|
|
|
32
32
|
(item === null || item === void 0 ? void 0 : item.content.option) || '';
|
|
33
33
|
export const FieldSelectMultiple = forwardRef((props, ref) => {
|
|
34
34
|
var _a;
|
|
35
|
-
const { id, name, placeholder, size = 's', options, value: valueProp, defaultValue, onChange: onChangeProp, disabled = false, readonly = false, searchable = true, showClearButton = true, onKeyDown: onInputKeyDownProp, validationState = 'default', search, autocomplete = false, prefixIcon, prefix, postfix, removeByBackspace = false, addOptionByEnter = false, untouchableScrollbars = false, open: openProp, enableFuzzySearch = true, resetSearchOnOptionSelection = true, onOpenChange, selectedOptionFormatter = defaultSelectedOptionFormatter } = props, rest = __rest(props, ["id", "name", "placeholder", "size", "options", "value", "defaultValue", "onChange", "disabled", "readonly", "searchable", "showClearButton", "onKeyDown", "validationState", "search", "autocomplete", "prefixIcon", "prefix", "postfix", "removeByBackspace", "addOptionByEnter", "untouchableScrollbars", "open", "enableFuzzySearch", "resetSearchOnOptionSelection", "onOpenChange", "selectedOptionFormatter"]);
|
|
35
|
+
const { id, name, placeholder, size = 's', options, value: valueProp, defaultValue, onChange: onChangeProp, disabled = false, readonly = false, searchable = true, showClearButton = true, onKeyDown: onInputKeyDownProp, validationState = 'default', search, autocomplete = false, prefixIcon, prefix, postfix, removeByBackspace = false, addOptionByEnter = false, untouchableScrollbars = false, open: openProp, enableFuzzySearch = true, resetSearchOnOptionSelection = true, onOpenChange, selectedOptionFormatter = defaultSelectedOptionFormatter, decoratorRef } = props, rest = __rest(props, ["id", "name", "placeholder", "size", "options", "value", "defaultValue", "onChange", "disabled", "readonly", "searchable", "showClearButton", "onKeyDown", "validationState", "search", "autocomplete", "prefixIcon", "prefix", "postfix", "removeByBackspace", "addOptionByEnter", "untouchableScrollbars", "open", "enableFuzzySearch", "resetSearchOnOptionSelection", "onOpenChange", "selectedOptionFormatter", "decoratorRef"]);
|
|
36
36
|
const localRef = useRef(null);
|
|
37
37
|
const inputPlugRef = useRef(null);
|
|
38
38
|
const contentRef = useRef(null);
|
|
@@ -124,7 +124,7 @@ export const FieldSelectMultiple = forwardRef((props, ref) => {
|
|
|
124
124
|
});
|
|
125
125
|
const result = isSearchUnavailable ? items : searchFunction(inputValue);
|
|
126
126
|
const fieldValidationState = getValidationState({ validationState, error: rest.error });
|
|
127
|
-
return (_jsx(FieldDecorator, Object.assign({}, extractSupportProps(rest), extractFieldDecoratorProps(props), { validationState: fieldValidationState, children: _jsx(Droplist, Object.assign({}, extractListProps(props), { items: result, triggerElemRef: localRef, trigger: 'click', selection: {
|
|
127
|
+
return (_jsx(FieldDecorator, Object.assign({}, extractSupportProps(rest), extractFieldDecoratorProps(props), { validationState: fieldValidationState, ref: decoratorRef, children: _jsx(Droplist, Object.assign({}, extractListProps(props), { items: result, triggerElemRef: localRef, trigger: 'click', selection: {
|
|
128
128
|
mode: 'multiple',
|
|
129
129
|
value: value,
|
|
130
130
|
onChange: value => {
|
|
@@ -26,4 +26,5 @@ export declare const FieldSelectSingle: import("react").ForwardRefExoticComponen
|
|
|
26
26
|
resetSearchOnOptionSelection?: boolean;
|
|
27
27
|
onOpenChange?(open: boolean): void;
|
|
28
28
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
29
|
+
decoratorRef?: import("react").ForwardedRef<HTMLDivElement>;
|
|
29
30
|
} & Pick<import("@snack-uikit/list").DroplistProps, "scrollToSelectedItem" | "untouchableScrollbars" | "dataFiltered" | "dataError" | "noDataState" | "noResultsState" | "errorDataState">, "resetSearchOnOptionSelection"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -29,7 +29,7 @@ const defaultSelectedOptionFormatter = item =>
|
|
|
29
29
|
// @ts-expect-error
|
|
30
30
|
(item === null || item === void 0 ? void 0 : item.content.option) || '';
|
|
31
31
|
export const FieldSelectSingle = forwardRef((props, ref) => {
|
|
32
|
-
const { id, name, placeholder, size = 's', options, value: valueProp, defaultValue, onChange: onChangeProp, disabled = false, readonly = false, searchable = true, showCopyButton = true, showClearButton = true, onKeyDown: onInputKeyDownProp, required = false, validationState = 'default', search, autocomplete = false, prefixIcon, prefix, postfix, addOptionByEnter = false, untouchableScrollbars = false, open: openProp, onOpenChange, selectedOptionFormatter = defaultSelectedOptionFormatter, enableFuzzySearch = true, onCopyButtonClick } = props, rest = __rest(props, ["id", "name", "placeholder", "size", "options", "value", "defaultValue", "onChange", "disabled", "readonly", "searchable", "showCopyButton", "showClearButton", "onKeyDown", "required", "validationState", "search", "autocomplete", "prefixIcon", "prefix", "postfix", "addOptionByEnter", "untouchableScrollbars", "open", "onOpenChange", "selectedOptionFormatter", "enableFuzzySearch", "onCopyButtonClick"]);
|
|
32
|
+
const { id, name, placeholder, size = 's', options, value: valueProp, defaultValue, onChange: onChangeProp, disabled = false, readonly = false, searchable = true, showCopyButton = true, showClearButton = true, onKeyDown: onInputKeyDownProp, required = false, validationState = 'default', search, autocomplete = false, prefixIcon, prefix, postfix, addOptionByEnter = false, untouchableScrollbars = false, open: openProp, onOpenChange, selectedOptionFormatter = defaultSelectedOptionFormatter, enableFuzzySearch = true, onCopyButtonClick, decoratorRef } = props, rest = __rest(props, ["id", "name", "placeholder", "size", "options", "value", "defaultValue", "onChange", "disabled", "readonly", "searchable", "showCopyButton", "showClearButton", "onKeyDown", "required", "validationState", "search", "autocomplete", "prefixIcon", "prefix", "postfix", "addOptionByEnter", "untouchableScrollbars", "open", "onOpenChange", "selectedOptionFormatter", "enableFuzzySearch", "onCopyButtonClick", "decoratorRef"]);
|
|
33
33
|
const localRef = useRef(null);
|
|
34
34
|
const [open = false, setOpen] = useValueControl({ value: openProp, onChange: onOpenChange });
|
|
35
35
|
const [value, setValue] = useValueControl({
|
|
@@ -125,7 +125,7 @@ export const FieldSelectSingle = forwardRef((props, ref) => {
|
|
|
125
125
|
});
|
|
126
126
|
const result = isSearchUnavailable ? items : filterFunction(inputValue);
|
|
127
127
|
const fieldValidationState = getValidationState({ validationState, error: rest.error });
|
|
128
|
-
return (_jsx(FieldDecorator, Object.assign({}, extractSupportProps(rest), extractFieldDecoratorProps(props), { validationState: fieldValidationState, children: _jsx(Droplist, Object.assign({}, extractListProps(props), { items: result, selection: {
|
|
128
|
+
return (_jsx(FieldDecorator, Object.assign({}, extractSupportProps(rest), extractFieldDecoratorProps(props), { validationState: fieldValidationState, ref: decoratorRef, children: _jsx(Droplist, Object.assign({}, extractListProps(props), { items: result, selection: {
|
|
129
129
|
mode: 'single',
|
|
130
130
|
value: value,
|
|
131
131
|
onChange: handleSelectionChange,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
1
|
+
import { ForwardedRef, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
3
3
|
import { AccordionItemProps, BaseItemProps, DroplistProps, GroupItemProps, ItemContentProps, NextListItemProps, SelectionMultipleState, SelectionSingleState } from '@snack-uikit/list';
|
|
4
4
|
import { TagProps } from '@snack-uikit/tag';
|
|
@@ -72,6 +72,8 @@ type FiledSelectCommonProps = WithSupportProps<{
|
|
|
72
72
|
resetSearchOnOptionSelection?: boolean;
|
|
73
73
|
onOpenChange?(open: boolean): void;
|
|
74
74
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
75
|
+
/** Ref для корневой обертки компонента */
|
|
76
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
75
77
|
}> & Pick<DroplistProps, 'dataError' | 'noDataState' | 'noResultsState' | 'errorDataState' | 'dataFiltered' | 'untouchableScrollbars' | 'scrollToSelectedItem'>;
|
|
76
78
|
export type FieldSelectSingleProps = FieldSelectPrivateProps & Omit<SelectionSingleState, 'mode'> & WrapperProps & Omit<FiledSelectCommonProps, 'resetSearchOnOptionSelection'>;
|
|
77
79
|
export type FieldSelectMultipleProps = FieldSelectPrivateProps & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
1
|
+
import { ForwardedRef, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
3
3
|
import { SliderProps as SliderComponentProps } from '@snack-uikit/slider';
|
|
4
4
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
@@ -19,6 +19,8 @@ type FieldSliderOwnProps = {
|
|
|
19
19
|
prefix?: ReactNode;
|
|
20
20
|
/** Произвольный постфикс для поля */
|
|
21
21
|
postfix?: ReactNode;
|
|
22
|
+
/** Ref для корневой обертки компонента */
|
|
23
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
22
24
|
};
|
|
23
25
|
export type FieldSliderProps = WithSupportProps<FieldSliderOwnProps & SliderProps & WrapperProps>;
|
|
24
26
|
export declare const FieldSlider: import("react").ForwardRefExoticComponent<{
|
|
@@ -31,7 +31,7 @@ const getDefaultValue = (range, min, max, value) => {
|
|
|
31
31
|
return value !== null && value !== void 0 ? value : min;
|
|
32
32
|
};
|
|
33
33
|
export const FieldSlider = forwardRef((_a, ref) => {
|
|
34
|
-
var { id, name, min, max, step, marks, showScaleBar = true, value: valueProp, range = false, disabled = false, readonly = false, onChange: onChangeProp, onFocus, onBlur, className, label, labelTooltip, labelTooltipPlacement, required, caption, hint, showHintIcon, size = SIZE.S, textInputFormatter, unbindInputFromMarks, postfixIcon, prefix, postfix } = _a, rest = __rest(_a, ["id", "name", "min", "max", "step", "marks", "showScaleBar", "value", "range", "disabled", "readonly", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "textInputFormatter", "unbindInputFromMarks", "postfixIcon", "prefix", "postfix"]);
|
|
34
|
+
var { id, name, min, max, step, marks, showScaleBar = true, value: valueProp, range = false, disabled = false, readonly = false, onChange: onChangeProp, onFocus, onBlur, className, label, labelTooltip, labelTooltipPlacement, required, caption, hint, showHintIcon, size = SIZE.S, textInputFormatter, unbindInputFromMarks, postfixIcon, prefix, postfix, decoratorRef } = _a, rest = __rest(_a, ["id", "name", "min", "max", "step", "marks", "showScaleBar", "value", "range", "disabled", "readonly", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "textInputFormatter", "unbindInputFromMarks", "postfixIcon", "prefix", "postfix", "decoratorRef"]);
|
|
35
35
|
const [value = getDefaultValue(range, min, max, valueProp), onChange] = useValueControl({
|
|
36
36
|
value: valueProp,
|
|
37
37
|
defaultValue: getDefaultValue(range, min, max, valueProp),
|
|
@@ -148,5 +148,5 @@ export const FieldSlider = forwardRef((_a, ref) => {
|
|
|
148
148
|
useEffect(() => {
|
|
149
149
|
handleTextValueChange();
|
|
150
150
|
}, [marks, min, max, handleTextValueChange]);
|
|
151
|
-
return (_jsxs(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, disabled: disabled, required: required, caption: caption, hint: hint, showHintIcon: showHintIcon, readonly: readonly, size: size }, extractSupportProps(rest), { children: [_jsx(FieldContainerPrivate, { className: styles.fieldContainer, size: size, validationState: VALIDATION_STATE.Default, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: localRef, prefix: prefixSettings.show && prefixSettings.render({ key: prefixSettings.id }), postfix: _jsxs(_Fragment, { children: [postfixSettings.show && postfixSettings.render({ key: postfixSettings.id }), postfixIcon] }), children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: textFieldInputValue, onChange: range ? undefined : onTextFieldChange, onFocus: onFocus, onBlur: range ? onBlur : onTextFieldBlur, onKeyDown: handleTextFieldKeyChange, disabled: disabled, readonly: range ? true : readonly, type: 'text', id: id, name: name, "data-test-id": 'field-slider__input' }) }), _jsx("div", { className: styles.sliderWrapper, children: _jsx("div", { className: styles.slider, "data-size": size, children: _jsx(Slider, { range: range, min: min, max: max, step: step, value: value, onChange: onChange, marks: showScaleBar ? marks : undefined, disabled: readonly || disabled, "data-test-id": 'field-slider__slider' }) }) })] })));
|
|
151
|
+
return (_jsxs(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, disabled: disabled, required: required, caption: caption, hint: hint, showHintIcon: showHintIcon, readonly: readonly, size: size, ref: decoratorRef }, extractSupportProps(rest), { children: [_jsx(FieldContainerPrivate, { className: styles.fieldContainer, size: size, validationState: VALIDATION_STATE.Default, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: localRef, prefix: prefixSettings.show && prefixSettings.render({ key: prefixSettings.id }), postfix: _jsxs(_Fragment, { children: [postfixSettings.show && postfixSettings.render({ key: postfixSettings.id }), postfixIcon] }), children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: textFieldInputValue, onChange: range ? undefined : onTextFieldChange, onFocus: onFocus, onBlur: range ? onBlur : onTextFieldBlur, onKeyDown: handleTextFieldKeyChange, disabled: disabled, readonly: range ? true : readonly, type: 'text', id: id, name: name, "data-test-id": 'field-slider__input' }) }), _jsx("div", { className: styles.sliderWrapper, children: _jsx("div", { className: styles.slider, "data-size": size, children: _jsx(Slider, { range: range, min: min, max: max, step: step, value: value, onChange: onChange, marks: showScaleBar ? marks : undefined, disabled: readonly || disabled, "data-test-id": 'field-slider__slider' }) }) })] })));
|
|
152
152
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEvent, ReactNode } from 'react';
|
|
1
|
+
import { ChangeEvent, ForwardedRef, ReactNode } from 'react';
|
|
2
2
|
import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
3
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
4
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
@@ -17,6 +17,8 @@ type FieldStepperOwnProps = {
|
|
|
17
17
|
prefix?: ReactNode;
|
|
18
18
|
/** Произвольный постфикс для поля */
|
|
19
19
|
postfix?: ReactNode;
|
|
20
|
+
/** Ref для корневой обертки компонента */
|
|
21
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
20
22
|
};
|
|
21
23
|
export type FieldStepperProps = WithSupportProps<FieldStepperOwnProps & InputProps & WrapperProps>;
|
|
22
24
|
export declare const FieldStepper: import("react").ForwardRefExoticComponent<{
|
|
@@ -41,7 +41,7 @@ const SymbolWidth = {
|
|
|
41
41
|
l: 10,
|
|
42
42
|
};
|
|
43
43
|
export const FieldStepper = forwardRef((_a, ref) => {
|
|
44
|
-
var { id, name, value: valueProp, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFINITY, step = 1, disabled = false, readonly = false, allowMoreThanLimits = true, onChange: onChangeProp, onFocus, onBlur, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, prefix, postfix } = _a, rest = __rest(_a, ["id", "name", "value", "min", "max", "step", "disabled", "readonly", "allowMoreThanLimits", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "prefix", "postfix"]);
|
|
44
|
+
var { id, name, value: valueProp, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFINITY, step = 1, disabled = false, readonly = false, allowMoreThanLimits = true, onChange: onChangeProp, onFocus, onBlur, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, prefix, postfix, decoratorRef } = _a, rest = __rest(_a, ["id", "name", "value", "min", "max", "step", "disabled", "readonly", "allowMoreThanLimits", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "prefix", "postfix", "decoratorRef"]);
|
|
45
45
|
const { t } = useLocale('Fields');
|
|
46
46
|
const [value = 0, setValue] = useValueControl({
|
|
47
47
|
value: valueProp,
|
|
@@ -113,7 +113,7 @@ export const FieldStepper = forwardRef((_a, ref) => {
|
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, validationState: fieldValidationState, error: error }, extractSupportProps(rest), { children: _jsx(Tooltip, { tip: tooltip, open: allowMoreThanLimits ? false : tooltipOpen, "data-test-id": 'field-stepper__limit-tooltip', triggerClassName: styles.trigger, children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: inputRef, prefix: _jsx(ButtonFunction, { tabIndex: -1, size: 'xs', className: styles.button, icon: _jsx(MinusSVG, {}), onClick: handleMinusButtonClick, onKeyDown: handleMinusButtonKeyDown, disabled: isMinusButtonDisabled, "data-test-id": 'field-stepper__minus-button' }), postfix: _jsx(ButtonFunction, { tabIndex: -1, size: 'xs', className: styles.button, icon: _jsx(PlusSVG, {}), onClick: handlePlusButtonClick, onKeyDown: handlePlusButtonKeyDown, disabled: isPlusButtonDisabled, "data-test-id": 'field-stepper__plus-button' }), children: _jsxs("div", { className: styles.wrap, children: [_jsx("div", { className: cn({ [styles.prefixWrapper]: prefixSettings.show }), children: prefixSettings.show && prefixSettings.render({ key: prefixSettings.id }) }), _jsx("div", { style: {
|
|
116
|
+
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, validationState: fieldValidationState, error: error, ref: decoratorRef }, extractSupportProps(rest), { children: _jsx(Tooltip, { tip: tooltip, open: allowMoreThanLimits ? false : tooltipOpen, "data-test-id": 'field-stepper__limit-tooltip', triggerClassName: styles.trigger, children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: inputRef, prefix: _jsx(ButtonFunction, { tabIndex: -1, size: 'xs', className: styles.button, icon: _jsx(MinusSVG, {}), onClick: handleMinusButtonClick, onKeyDown: handleMinusButtonKeyDown, disabled: isMinusButtonDisabled, "data-test-id": 'field-stepper__minus-button' }), postfix: _jsx(ButtonFunction, { tabIndex: -1, size: 'xs', className: styles.button, icon: _jsx(PlusSVG, {}), onClick: handlePlusButtonClick, onKeyDown: handlePlusButtonKeyDown, disabled: isPlusButtonDisabled, "data-test-id": 'field-stepper__plus-button' }), children: _jsxs("div", { className: styles.wrap, children: [_jsx("div", { className: cn({ [styles.prefixWrapper]: prefixSettings.show }), children: prefixSettings.show && prefixSettings.render({ key: prefixSettings.id }) }), _jsx("div", { style: {
|
|
117
117
|
width: String(value).length * SymbolWidth[size],
|
|
118
118
|
maxWidth: '100%',
|
|
119
119
|
}, children: _jsx(InputPrivate, { ref: mergeRefs(ref, inputRef), className: styles.stepper, "data-size": size, value: String(value), tabIndex: 0, onKeyDown: handleInputKeyDown, onChange: handleInputChange, onBlur: handleInputBlur, onFocus: handleInputFocus, disabled: disabled, readonly: readonly, type: 'number', id: id, step: step, name: name, min: min, max: max, "data-test-id": 'field-stepper__input' }) }), _jsx("div", { className: cn({ [styles.postfixWrapper]: postfixSettings.show }), children: postfixSettings.show && postfixSettings.render({ key: postfixSettings.id }) })] }) }) }) })));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
1
|
+
import { ForwardedRef, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
3
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
4
|
import { Button } from '../../types';
|
|
@@ -25,6 +25,8 @@ type FieldTextOwnProps = {
|
|
|
25
25
|
postfix?: ReactNode;
|
|
26
26
|
/** Кнопка действия внутри поля */
|
|
27
27
|
button?: Button;
|
|
28
|
+
/** Ref для корневой обертки компонента */
|
|
29
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
28
30
|
};
|
|
29
31
|
export type FieldTextProps = WithSupportProps<FieldTextOwnProps & InputProps & WrapperProps>;
|
|
30
32
|
export declare const FieldText: import("react").ForwardRefExoticComponent<{
|
|
@@ -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 } = _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"]);
|
|
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, decoratorRef } = _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", "decoratorRef"]);
|
|
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: 'text', 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, ref: decoratorRef }, 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: 'text', maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, id: id, name: name, autoComplete: autoComplete, "data-test-id": 'field-text__input' }) }) })));
|
|
95
95
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
1
|
+
import { ChangeEvent, ForwardedRef } from 'react';
|
|
2
2
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
3
3
|
import { TextAreaProps } from '../../helperComponents';
|
|
4
4
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
@@ -24,6 +24,8 @@ type FieldTextAreaOwnProps = {
|
|
|
24
24
|
showClearButton?: boolean;
|
|
25
25
|
/** Можно ли вводить больше разрешённого кол-ва символов */
|
|
26
26
|
allowMoreThanMaxLength?: boolean;
|
|
27
|
+
/** Ref для корневой обертки компонента */
|
|
28
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
27
29
|
};
|
|
28
30
|
export type FieldTextAreaProps = WithSupportProps<FieldTextAreaOwnProps & InputProps & WrapperProps>;
|
|
29
31
|
export declare const FieldTextArea: import("react").ForwardRefExoticComponent<{
|
|
@@ -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, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, error, size = SIZE.S, validationState = VALIDATION_STATE.Default, onCopyButtonClick, decoratorRef } = _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", "decoratorRef"]);
|
|
26
26
|
const localRef = useRef(null);
|
|
27
27
|
const clearButtonRef = useRef(null);
|
|
28
28
|
const copyButtonRef = useRef(null);
|
|
@@ -56,5 +56,5 @@ export const FieldTextArea = forwardRef((_a, ref) => {
|
|
|
56
56
|
readonly,
|
|
57
57
|
submitKeys: ['Enter', 'Space', 'Tab'],
|
|
58
58
|
});
|
|
59
|
-
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: _jsx(FieldContainerPrivate, { className: styles.container, size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, "data-resizable": isResizable || 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: onInputKeyDown, tabIndex: inputTabIndex, maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, "data-test-id": 'field-textarea__input' }) }) }) })));
|
|
59
|
+
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, ref: decoratorRef }, extractSupportProps(rest), { children: _jsx(FieldContainerPrivate, { className: styles.container, size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, "data-resizable": isResizable || 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: onInputKeyDown, tabIndex: inputTabIndex, maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, "data-test-id": 'field-textarea__input' }) }) }) })));
|
|
60
60
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ForwardedRef } from 'react';
|
|
1
2
|
import { TimePickerProps } from '@snack-uikit/calendar';
|
|
2
3
|
import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
3
4
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
@@ -24,6 +25,8 @@ type FieldTimeOwnProps = {
|
|
|
24
25
|
* @default true
|
|
25
26
|
*/
|
|
26
27
|
showClearButton?: boolean;
|
|
28
|
+
/** Ref для корневой обертки компонента */
|
|
29
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
27
30
|
};
|
|
28
31
|
export type FieldTimeProps = WithSupportProps<FieldTimeOwnProps & InputProps & WrapperProps>;
|
|
29
32
|
export declare const FieldTime: import("react").ForwardRefExoticComponent<{
|
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import mergeRefs from 'merge-refs';
|
|
14
|
-
import { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
14
|
+
import { forwardRef, useCallback, useEffect, useMemo, useRef, } from 'react';
|
|
15
15
|
import { useUncontrolledProp } from 'uncontrollable';
|
|
16
16
|
import { TimePicker } from '@snack-uikit/calendar';
|
|
17
17
|
import { Dropdown } from '@snack-uikit/dropdown';
|
|
@@ -40,7 +40,7 @@ const getStringTimeValue = (time, { showSeconds, locale }) => {
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
export const FieldTime = forwardRef((_a, ref) => {
|
|
43
|
-
var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onOpenChange, onChange, onFocus, onBlur: onBlurProp, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, showSeconds = true, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, onCopyButtonClick } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "showSeconds", "size", "validationState", "error", "onCopyButtonClick"]);
|
|
43
|
+
var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onOpenChange, onChange, onFocus, onBlur: onBlurProp, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, showSeconds = true, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, onCopyButtonClick, decoratorRef } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "showSeconds", "size", "validationState", "error", "onCopyButtonClick", "decoratorRef"]);
|
|
44
44
|
const [isOpen, setIsOpen] = useUncontrolledProp(open, false, onOpenChange);
|
|
45
45
|
const localRef = useRef(null);
|
|
46
46
|
const clearButtonRef = useRef(null);
|
|
@@ -152,7 +152,7 @@ export const FieldTime = forwardRef((_a, ref) => {
|
|
|
152
152
|
e.stopPropagation();
|
|
153
153
|
}
|
|
154
154
|
}, [timeInputClickHandler, isOpen]);
|
|
155
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, error: error, validationState: fieldValidationState }, extractSupportProps(rest), { children: _jsx(Dropdown, Object.assign({ trigger: 'click', triggerClassName: styles.triggerClassName, widthStrategy: 'auto' }, (readonly || disabled
|
|
155
|
+
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, error: error, validationState: fieldValidationState, ref: decoratorRef }, extractSupportProps(rest), { children: _jsx(Dropdown, Object.assign({ trigger: 'click', triggerClassName: styles.triggerClassName, widthStrategy: 'auto' }, (readonly || disabled
|
|
156
156
|
? { open: false }
|
|
157
157
|
: {
|
|
158
158
|
open: showDropList,
|
|
@@ -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, "open" | "onOpenChange" | "items"> & {
|
|
2
|
+
export declare const ButtonFieldList: import("react").ForwardRefExoticComponent<Omit<ButtonFieldProps, "hasArrow" | "arrowOpen"> & Pick<import("@snack-uikit/list").DroplistProps, "open" | "onOpenChange" | "items" | "search"> & {
|
|
3
3
|
selection?: Omit<import("@snack-uikit/list").SelectionSingleState, "mode">;
|
|
4
4
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -17,10 +17,10 @@ import { ButtonField } from '../ButtonField';
|
|
|
17
17
|
import { getPlacement } from './helpers';
|
|
18
18
|
import styles from './styles.module.css';
|
|
19
19
|
export const ButtonFieldList = forwardRef((_a, ref) => {
|
|
20
|
-
var { items, selection, open, onOpenChange } = _a, rest = __rest(_a, ["items", "selection", "open", "onOpenChange"]);
|
|
20
|
+
var { items, selection, open, onOpenChange, search } = _a, rest = __rest(_a, ["items", "selection", "open", "onOpenChange", "search"]);
|
|
21
21
|
const [isOpen, setIsOpen] = useUncontrolledProp(open, false, onOpenChange);
|
|
22
22
|
const placement = getPlacement(rest);
|
|
23
|
-
return (_jsx(Droplist, { "data-test-id": 'button-field-list', items: items, selection: Object.assign({ mode: 'single' }, selection), open: isOpen, onOpenChange: setIsOpen, closeDroplistOnItemClick: true,
|
|
23
|
+
return (_jsx(Droplist, { "data-test-id": 'button-field-list', items: items, selection: Object.assign({ mode: 'single' }, selection), open: isOpen, onOpenChange: setIsOpen, closeDroplistOnItemClick: true, search: search,
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
25
25
|
// @ts-ignore
|
|
26
26
|
triggerElemRef: ref, size: rest.size, placement: placement, children: _jsx(ButtonField, Object.assign({}, rest, { hasArrow: true, arrowOpen: isOpen, className: styles.triggerClassName })) }));
|
|
@@ -9,7 +9,7 @@ export type AsyncValueRequest = Promise<{
|
|
|
9
9
|
success: boolean;
|
|
10
10
|
value?: string;
|
|
11
11
|
}>;
|
|
12
|
-
export type NativeDroplistProps = Pick<DroplistProps, 'items' | 'open' | 'onOpenChange'> & {
|
|
12
|
+
export type NativeDroplistProps = Pick<DroplistProps, 'items' | 'open' | 'onOpenChange' | 'search'> & {
|
|
13
13
|
selection?: Omit<SelectionSingleState, 'mode'>;
|
|
14
14
|
};
|
|
15
15
|
export type Button = Omit<NativeDroplistProps, 'items'> & {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Fields",
|
|
7
|
-
"version": "0.36.
|
|
7
|
+
"version": "0.36.5-preview-c8fb5dcc.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@snack-uikit/button": "0.19.5",
|
|
40
|
-
"@snack-uikit/calendar": "0.11.
|
|
40
|
+
"@snack-uikit/calendar": "0.11.16",
|
|
41
41
|
"@snack-uikit/color-picker": "0.3.11",
|
|
42
42
|
"@snack-uikit/divider": "3.2.2",
|
|
43
43
|
"@snack-uikit/dropdown": "0.4.2",
|
|
44
44
|
"@snack-uikit/icons": "0.24.1",
|
|
45
45
|
"@snack-uikit/input-private": "4.5.0",
|
|
46
|
-
"@snack-uikit/list": "0.
|
|
46
|
+
"@snack-uikit/list": "0.23.0",
|
|
47
47
|
"@snack-uikit/scroll": "0.9.2",
|
|
48
48
|
"@snack-uikit/skeleton": "0.6.1",
|
|
49
49
|
"@snack-uikit/slider": "0.3.5",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@snack-uikit/locale": "*"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "981796332767b10d08aedd9691a8f4180fbff196"
|
|
69
69
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mergeRefs from 'merge-refs';
|
|
2
|
-
import { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { ForwardedRef, forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { useUncontrolledProp } from 'uncontrollable';
|
|
4
4
|
|
|
5
5
|
import { ColorPicker, ColorPickerProps } from '@snack-uikit/color-picker';
|
|
@@ -51,6 +51,8 @@ type FieldDateOwnProps = {
|
|
|
51
51
|
|
|
52
52
|
value?: string;
|
|
53
53
|
onChange?(value: string): void;
|
|
54
|
+
/** Ref для корневой обертки компонента */
|
|
55
|
+
decoratorRef?: ForwardedRef<HTMLDivElement>;
|
|
54
56
|
} & Omit<ColorPickerProps, 'onChange' | 'value'>;
|
|
55
57
|
|
|
56
58
|
export type FieldColorProps = WithSupportProps<FieldDateOwnProps & InputProps & WrapperProps>;
|
|
@@ -85,6 +87,7 @@ export const FieldColor = forwardRef<HTMLInputElement, FieldColorProps>(
|
|
|
85
87
|
onFocus,
|
|
86
88
|
onBlur,
|
|
87
89
|
onCopyButtonClick,
|
|
90
|
+
decoratorRef,
|
|
88
91
|
...rest
|
|
89
92
|
},
|
|
90
93
|
ref,
|
|
@@ -152,6 +155,7 @@ export const FieldColor = forwardRef<HTMLInputElement, FieldColorProps>(
|
|
|
152
155
|
size={size}
|
|
153
156
|
error={error}
|
|
154
157
|
validationState={fieldValidationState}
|
|
158
|
+
ref={decoratorRef}
|
|
155
159
|
{...extractSupportProps(rest)}
|
|
156
160
|
>
|
|
157
161
|
<Dropdown
|