@snack-uikit/fields 0.22.2 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +8 -0
- package/dist/components/FieldDate/FieldDate.d.ts +1 -1
- package/dist/components/FieldDate/FieldDate.js +2 -2
- package/dist/components/FieldDate/styles.module.css +3 -3
- package/dist/components/FieldDecorator/FieldDecorator.d.ts +1 -1
- package/dist/components/FieldDecorator/FieldDecorator.js +2 -2
- package/dist/components/FieldDecorator/Header.d.ts +3 -1
- package/dist/components/FieldDecorator/Header.js +2 -2
- package/dist/components/FieldDecorator/styles.module.css +48 -11
- package/dist/components/FieldDecorator/utils.d.ts +2 -1
- package/dist/components/FieldDecorator/utils.js +2 -1
- package/dist/components/FieldSecure/FieldSecure.d.ts +1 -1
- package/dist/components/FieldSecure/FieldSecure.js +2 -2
- package/dist/components/FieldSelect/styles.module.css +5 -5
- package/dist/components/FieldSelect/types.d.ts +1 -1
- package/dist/components/FieldSlider/FieldSlider.d.ts +1 -1
- package/dist/components/FieldSlider/FieldSlider.js +2 -2
- package/dist/components/FieldSlider/styles.module.css +1 -1
- package/dist/components/FieldStepper/FieldStepper.d.ts +1 -1
- package/dist/components/FieldStepper/FieldStepper.js +2 -2
- package/dist/components/FieldText/FieldText.d.ts +1 -1
- package/dist/components/FieldText/FieldText.js +2 -2
- package/dist/components/FieldTextArea/FieldTextArea.d.ts +1 -1
- package/dist/components/FieldTextArea/FieldTextArea.js +2 -2
- package/dist/helperComponents/ButtonCopyValue/styles.module.css +6 -6
- package/dist/helperComponents/ButtonHideValue/ButtonHideValue.js +1 -1
- package/dist/helperComponents/ButtonHideValue/styles.module.css +6 -6
- package/dist/helperComponents/FieldContainerPrivate/styles.module.css +11 -11
- package/dist/helperComponents/TextArea/styles.module.css +6 -6
- package/package.json +3 -3
- package/src/components/FieldDate/FieldDate.tsx +4 -1
- package/src/components/FieldDecorator/FieldDecorator.tsx +2 -0
- package/src/components/FieldDecorator/Header.tsx +10 -1
- package/src/components/FieldDecorator/styles.module.scss +38 -19
- package/src/components/FieldDecorator/utils.ts +2 -0
- package/src/components/FieldSecure/FieldSecure.tsx +3 -0
- package/src/components/FieldSelect/types.ts +1 -0
- package/src/components/FieldSlider/FieldSlider.tsx +11 -1
- package/src/components/FieldStepper/FieldStepper.tsx +3 -0
- package/src/components/FieldText/FieldText.tsx +3 -0
- package/src/components/FieldTextArea/FieldTextArea.tsx +3 -0
- package/src/helperComponents/ButtonHideValue/ButtonHideValue.tsx +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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.23.1 (2024-07-09)
|
|
7
|
+
|
|
8
|
+
### Only dependencies have been changed
|
|
9
|
+
* [@snack-uikit/tag@0.9.6](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/tag/CHANGELOG.md)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# 0.23.0 (2024-07-02)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **PDS-153:** add caption, invert hidden button icon behavior, set width=auto for droplist in field-date, up tokens ([606716c](https://github.com/cloud-ru-tech/snack-uikit/commit/606716cc2b877d8a452a89dc23d3e38265ff5848))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## 0.22.2 (2024-06-27)
|
|
7
27
|
|
|
8
28
|
### Only dependencies have been changed
|
package/README.md
CHANGED
|
@@ -195,6 +195,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
195
195
|
| readonly | `boolean` | - | Является ли поле доступным только на чтение Доступно ли поле только на чтение |
|
|
196
196
|
| error | `string` | - | |
|
|
197
197
|
| label | `string` | - | Лейбл |
|
|
198
|
+
| caption | `string` | - | Подпись справа от лейбла |
|
|
198
199
|
| labelTooltip | `ReactNode` | - | Всплывающая подсказка лейбла |
|
|
199
200
|
| labelFor | `string` | - | Аттрибут for |
|
|
200
201
|
| required | `boolean` | - | Является ли поле обязательным |
|
|
@@ -225,6 +226,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
225
226
|
| error | `string` | - | |
|
|
226
227
|
| className | `string` | - | CSS-класс |
|
|
227
228
|
| label | `string` | - | Лейбл |
|
|
229
|
+
| caption | `string` | - | Подпись справа от лейбла |
|
|
228
230
|
| labelTooltip | `ReactNode` | - | Всплывающая подсказка лейбла |
|
|
229
231
|
| required | `boolean` | - | Является ли поле обязательным |
|
|
230
232
|
| size | enum Size: `"s"`, `"m"`, `"l"` | SIZE.S | Размер |
|
|
@@ -257,6 +259,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
257
259
|
| error | `string` | - | |
|
|
258
260
|
| className | `string` | - | CSS-класс |
|
|
259
261
|
| label | `string` | - | Лейбл |
|
|
262
|
+
| caption | `string` | - | Подпись справа от лейбла |
|
|
260
263
|
| labelTooltip | `ReactNode` | - | Всплывающая подсказка лейбла |
|
|
261
264
|
| required | `boolean` | - | Является ли поле обязательным |
|
|
262
265
|
| size | enum Size: `"s"`, `"m"`, `"l"` | SIZE.S | Размер |
|
|
@@ -289,6 +292,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
289
292
|
| error | `string` | - | |
|
|
290
293
|
| className | `string` | - | CSS-класс |
|
|
291
294
|
| label | `string` | - | Лейбл |
|
|
295
|
+
| caption | `string` | - | Подпись справа от лейбла |
|
|
292
296
|
| labelTooltip | `ReactNode` | - | Всплывающая подсказка лейбла |
|
|
293
297
|
| required | `boolean` | - | Является ли поле обязательным |
|
|
294
298
|
| size | enum Size: `"s"`, `"m"`, `"l"` | SIZE.S | Размер |
|
|
@@ -323,6 +327,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
323
327
|
| error | `string` | - | |
|
|
324
328
|
| className | `string` | - | CSS-класс |
|
|
325
329
|
| label | `string` | - | Лейбл |
|
|
330
|
+
| caption | `string` | - | Подпись справа от лейбла |
|
|
326
331
|
| labelTooltip | `ReactNode` | - | Всплывающая подсказка лейбла |
|
|
327
332
|
| required | `boolean` | - | Является ли поле обязательным |
|
|
328
333
|
| size | enum Size: `"s"`, `"m"`, `"l"` | SIZE.S | Размер |
|
|
@@ -348,6 +353,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
348
353
|
| error | `string` | - | |
|
|
349
354
|
| className | `string` | - | CSS-класс |
|
|
350
355
|
| label | `string` | - | Лейбл |
|
|
356
|
+
| caption | `string` | - | Подпись справа от лейбла |
|
|
351
357
|
| labelTooltip | `ReactNode` | - | Всплывающая подсказка лейбла |
|
|
352
358
|
| required | `boolean` | - | Является ли поле обязательным |
|
|
353
359
|
| size | enum Size: `"s"`, `"m"`, `"l"` | - | Размер |
|
|
@@ -401,6 +407,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
401
407
|
| error | `string` | - | |
|
|
402
408
|
| className | `string` | - | CSS-класс |
|
|
403
409
|
| label | `string` | - | Лейбл |
|
|
410
|
+
| caption | `string` | - | Подпись справа от лейбла |
|
|
404
411
|
| labelTooltip | `ReactNode` | - | Всплывающая подсказка лейбла |
|
|
405
412
|
| required | `boolean` | - | Является ли поле обязательным |
|
|
406
413
|
| size | enum Size: `"s"`, `"m"`, `"l"` | SIZE.S | Размер |
|
|
@@ -433,6 +440,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
433
440
|
| marks | `Record<string \| number, ReactNode \| MarkObj>` | - | |
|
|
434
441
|
| className | `string` | - | CSS-класс |
|
|
435
442
|
| label | `string` | - | Лейбл |
|
|
443
|
+
| caption | `string` | - | Подпись справа от лейбла |
|
|
436
444
|
| labelTooltip | `ReactNode` | - | Всплывающая подсказка лейбла |
|
|
437
445
|
| required | `boolean` | - | Является ли поле обязательным |
|
|
438
446
|
| size | enum Size: `"s"`, `"m"`, `"l"` | SIZE.S | Размер |
|
|
@@ -4,7 +4,7 @@ import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
|
4
4
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
5
5
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
6
6
|
type InputProps = Pick<InputPrivateProps, 'id' | 'name' | 'value' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur'>;
|
|
7
|
-
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
|
|
7
|
+
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
|
|
8
8
|
type FieldDateOwnProps = {
|
|
9
9
|
/** Открыт date-picker */
|
|
10
10
|
open?: boolean;
|
|
@@ -35,7 +35,7 @@ const CALENDAR_SIZE_MAP = {
|
|
|
35
35
|
[SIZE.L]: 'm',
|
|
36
36
|
};
|
|
37
37
|
export const FieldDate = forwardRef((_a, ref) => {
|
|
38
|
-
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, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, locale = DEFAULT_LOCALE, buildCellProps, error } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "hint", "showHintIcon", "size", "validationState", "locale", "buildCellProps", "error"]);
|
|
38
|
+
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, locale = DEFAULT_LOCALE, buildCellProps, error } = _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", "locale", "buildCellProps", "error"]);
|
|
39
39
|
const [isOpen, setIsOpen] = useUncontrolledProp(open, false, onOpenChange);
|
|
40
40
|
const [pickerAutofocus, setPickerAutofocus] = useState(false);
|
|
41
41
|
const localRef = useRef(null);
|
|
@@ -135,7 +135,7 @@ export const FieldDate = forwardRef((_a, ref) => {
|
|
|
135
135
|
e.stopPropagation();
|
|
136
136
|
}
|
|
137
137
|
}, [dateInputClickHandler, isOpen]);
|
|
138
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, 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: '
|
|
138
|
+
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
|
|
139
139
|
? { open: false }
|
|
140
140
|
: {
|
|
141
141
|
open: showDropList,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.container .calendarIcon{
|
|
25
|
-
color:var(--sys-neutral-text-light, #
|
|
25
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
26
26
|
}
|
|
27
27
|
.container .calendarIcon[data-size=s]{
|
|
28
28
|
width:var(--size-icon-container-xs, 16px) !important;
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
height:var(--size-icon-container-s, 24px) !important;
|
|
38
38
|
}
|
|
39
39
|
.container:hover .calendarIcon, .container:focus-within .calendarIcon, .container[data-focused] .calendarIcon{
|
|
40
|
-
color:var(--sys-neutral-text-support, #
|
|
40
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
41
41
|
}
|
|
42
42
|
.container[data-disabled] .calendarIcon, .container[data-readonly] .calendarIcon{
|
|
43
|
-
color:var(--sys-neutral-text-disabled, #
|
|
43
|
+
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
44
44
|
}
|
|
@@ -12,4 +12,4 @@ export type FieldDecoratorProps = WithSupportProps<{
|
|
|
12
12
|
readonly?: boolean;
|
|
13
13
|
error?: string;
|
|
14
14
|
} & HeaderProps & FooterProps>;
|
|
15
|
-
export declare function FieldDecorator({ children, className, label, labelTooltip, required, labelFor, length, hint, disabled, readonly, showHintIcon, labelTooltipPlacement, size, error, validationState, ...rest }: FieldDecoratorProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function FieldDecorator({ children, className, label, labelTooltip, required, labelFor, caption, length, hint, disabled, readonly, showHintIcon, labelTooltipPlacement, size, error, validationState, ...rest }: FieldDecoratorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,8 +19,8 @@ import { Footer } from './Footer';
|
|
|
19
19
|
import { Header } from './Header';
|
|
20
20
|
import styles from './styles.module.css';
|
|
21
21
|
export function FieldDecorator(_a) {
|
|
22
|
-
var { children, className, label, labelTooltip, required, labelFor, length, hint, disabled, readonly, showHintIcon, labelTooltipPlacement, size = SIZE.S, error, validationState = VALIDATION_STATE.Default } = _a, rest = __rest(_a, ["children", "className", "label", "labelTooltip", "required", "labelFor", "length", "hint", "disabled", "readonly", "showHintIcon", "labelTooltipPlacement", "size", "error", "validationState"]);
|
|
22
|
+
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
23
|
const isFieldActive = !disabled && !readonly;
|
|
24
24
|
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, size: size })), children, _jsx(Footer, { length: isFieldActive ? length : undefined, hint: error || hint, showHintIcon: showHintIcon, size: size, validationState: isFieldActive ? fieldValidationState : VALIDATION_STATE.Default })] })));
|
|
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
|
}
|
|
@@ -4,6 +4,8 @@ import { TooltipProps } from '@snack-uikit/tooltip';
|
|
|
4
4
|
export type HeaderProps = {
|
|
5
5
|
/** Лейбл */
|
|
6
6
|
label?: string;
|
|
7
|
+
/** Подпись справа от лейбла */
|
|
8
|
+
caption?: string;
|
|
7
9
|
/** Всплывающая подсказка лейбла */
|
|
8
10
|
labelTooltip?: ReactNode;
|
|
9
11
|
/** Аттрибут for */
|
|
@@ -18,4 +20,4 @@ export type HeaderProps = {
|
|
|
18
20
|
*/
|
|
19
21
|
labelTooltipPlacement?: TooltipProps['placement'];
|
|
20
22
|
};
|
|
21
|
-
export declare function Header({ label, labelTooltip, labelFor, size, required, labelTooltipPlacement, }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function Header({ label, labelTooltip, caption, labelFor, size, required, labelTooltipPlacement, }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,6 @@ import { QuestionSVG } from '@snack-uikit/icons';
|
|
|
3
3
|
import { Tooltip } from '@snack-uikit/tooltip';
|
|
4
4
|
import { TruncateString } from '@snack-uikit/truncate-string';
|
|
5
5
|
import styles from './styles.module.css';
|
|
6
|
-
export function Header({ label = '', labelTooltip, labelFor, size, required = false, labelTooltipPlacement = 'top', }) {
|
|
7
|
-
return (
|
|
6
|
+
export function Header({ label = '', labelTooltip, caption, labelFor, size, required = false, labelTooltipPlacement = 'top', }) {
|
|
7
|
+
return (_jsxs("span", { className: styles.header, "data-size": size, children: [label && (_jsxs("span", { className: styles.labelLayout, children: [_jsx("label", { className: styles.label, htmlFor: labelFor, "data-test-id": 'field-decorator__label', children: _jsx(TruncateString, { text: label }) }), required && (_jsx("span", { className: styles.required, "data-test-id": 'field-decorator__required-sign', children: "*" })), labelTooltip && (_jsx(Tooltip, { tip: labelTooltip, placement: labelTooltipPlacement, "data-test-id": 'field-decorator__label-tooltip', triggerClassName: styles.labelTooltipTrigger, children: _jsx(QuestionSVG, { size: 16, className: styles.icon, "data-test-id": 'field-decorator__label-tooltip-trigger' }) }))] })), caption && _jsx("span", { className: styles.caption, children: caption })] }));
|
|
8
8
|
}
|
|
@@ -17,46 +17,83 @@
|
|
|
17
17
|
|
|
18
18
|
.header{
|
|
19
19
|
display:flex;
|
|
20
|
+
gap:var(--dimension-050m, 4px);
|
|
20
21
|
box-sizing:border-box;
|
|
21
|
-
color:var(--sys-neutral-text-support, #
|
|
22
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
22
23
|
}
|
|
23
24
|
.header[data-size=s]{
|
|
24
25
|
font-family:var(--sans-label-m-font-family, SB Sans Interface);
|
|
25
26
|
font-weight:var(--sans-label-m-font-weight, Semibold);
|
|
26
27
|
line-height:var(--sans-label-m-line-height, 16px);
|
|
27
28
|
font-size:var(--sans-label-m-font-size, 12px);
|
|
28
|
-
letter-spacing:var(--sans-label-m-letter-spacing,
|
|
29
|
+
letter-spacing:var(--sans-label-m-letter-spacing, 0px);
|
|
29
30
|
paragraph-spacing:var(--sans-label-m-paragraph-spacing, 6.6px);
|
|
30
31
|
}
|
|
32
|
+
.header[data-size=s] .caption{
|
|
33
|
+
font-family:var(--sans-body-s-font-family, SB Sans Interface);
|
|
34
|
+
font-weight:var(--sans-body-s-font-weight, Regular);
|
|
35
|
+
line-height:var(--sans-body-s-line-height, 16px);
|
|
36
|
+
font-size:var(--sans-body-s-font-size, 12px);
|
|
37
|
+
letter-spacing:var(--sans-body-s-letter-spacing, 0.1px);
|
|
38
|
+
paragraph-spacing:var(--sans-body-s-paragraph-spacing, 6.6px);
|
|
39
|
+
margin-left:auto;
|
|
40
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
41
|
+
}
|
|
31
42
|
.header[data-size=m]{
|
|
32
43
|
font-family:var(--sans-label-l-font-family, SB Sans Interface);
|
|
33
44
|
font-weight:var(--sans-label-l-font-weight, Semibold);
|
|
34
45
|
line-height:var(--sans-label-l-line-height, 20px);
|
|
35
46
|
font-size:var(--sans-label-l-font-size, 14px);
|
|
36
|
-
letter-spacing:var(--sans-label-l-letter-spacing,
|
|
47
|
+
letter-spacing:var(--sans-label-l-letter-spacing, 0px);
|
|
37
48
|
paragraph-spacing:var(--sans-label-l-paragraph-spacing, 7.7px);
|
|
38
49
|
}
|
|
50
|
+
.header[data-size=m] .caption{
|
|
51
|
+
font-family:var(--sans-body-m-font-family, SB Sans Interface);
|
|
52
|
+
font-weight:var(--sans-body-m-font-weight, Regular);
|
|
53
|
+
line-height:var(--sans-body-m-line-height, 20px);
|
|
54
|
+
font-size:var(--sans-body-m-font-size, 14px);
|
|
55
|
+
letter-spacing:var(--sans-body-m-letter-spacing, 0.1px);
|
|
56
|
+
paragraph-spacing:var(--sans-body-m-paragraph-spacing, 7.7px);
|
|
57
|
+
margin-left:auto;
|
|
58
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
59
|
+
}
|
|
39
60
|
.header[data-size=l]{
|
|
40
61
|
font-family:var(--sans-label-l-font-family, SB Sans Interface);
|
|
41
62
|
font-weight:var(--sans-label-l-font-weight, Semibold);
|
|
42
63
|
line-height:var(--sans-label-l-line-height, 20px);
|
|
43
64
|
font-size:var(--sans-label-l-font-size, 14px);
|
|
44
|
-
letter-spacing:var(--sans-label-l-letter-spacing,
|
|
65
|
+
letter-spacing:var(--sans-label-l-letter-spacing, 0px);
|
|
45
66
|
paragraph-spacing:var(--sans-label-l-paragraph-spacing, 7.7px);
|
|
46
67
|
}
|
|
68
|
+
.header[data-size=l] .caption{
|
|
69
|
+
font-family:var(--sans-body-m-font-family, SB Sans Interface);
|
|
70
|
+
font-weight:var(--sans-body-m-font-weight, Regular);
|
|
71
|
+
line-height:var(--sans-body-m-line-height, 20px);
|
|
72
|
+
font-size:var(--sans-body-m-font-size, 14px);
|
|
73
|
+
letter-spacing:var(--sans-body-m-letter-spacing, 0.1px);
|
|
74
|
+
paragraph-spacing:var(--sans-body-m-paragraph-spacing, 7.7px);
|
|
75
|
+
margin-left:auto;
|
|
76
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
77
|
+
}
|
|
47
78
|
|
|
48
79
|
.labelLayout{
|
|
49
80
|
gap:var(--space-fields-label-gap, 2px);
|
|
50
81
|
display:inline-flex;
|
|
51
82
|
align-items:center;
|
|
83
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
52
84
|
}
|
|
53
85
|
|
|
54
86
|
.label{
|
|
55
87
|
display:grid;
|
|
88
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.required{
|
|
92
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
56
93
|
}
|
|
57
94
|
|
|
58
95
|
.footer{
|
|
59
|
-
gap:var(--space-fields-hint-container-gap,
|
|
96
|
+
gap:var(--space-fields-hint-container-gap, 16px);
|
|
60
97
|
display:flex;
|
|
61
98
|
justify-content:space-between;
|
|
62
99
|
box-sizing:border-box;
|
|
@@ -120,7 +157,7 @@
|
|
|
120
157
|
word-break:break-word;
|
|
121
158
|
}
|
|
122
159
|
.hint[data-validation=default]{
|
|
123
|
-
color:var(--sys-neutral-text-light, #
|
|
160
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
124
161
|
}
|
|
125
162
|
.hint[data-validation=error]{
|
|
126
163
|
color:var(--sys-red-text-main, #621c1b);
|
|
@@ -135,7 +172,7 @@
|
|
|
135
172
|
.icon{
|
|
136
173
|
flex-shrink:0;
|
|
137
174
|
box-sizing:content-box;
|
|
138
|
-
color:var(--sys-neutral-text-light, #
|
|
175
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
139
176
|
}
|
|
140
177
|
|
|
141
178
|
.hintIcon{
|
|
@@ -143,20 +180,20 @@
|
|
|
143
180
|
box-sizing:content-box;
|
|
144
181
|
}
|
|
145
182
|
.hintIcon[data-validation=default]{
|
|
146
|
-
color:var(--sys-neutral-
|
|
183
|
+
color:var(--sys-neutral-accent-default, #787b8a);
|
|
147
184
|
}
|
|
148
185
|
.hintIcon[data-validation=error]{
|
|
149
186
|
color:var(--sys-red-accent-default, #cd3c3c);
|
|
150
187
|
}
|
|
151
188
|
.hintIcon[data-validation=warning]{
|
|
152
|
-
color:var(--sys-yellow-accent-default, #
|
|
189
|
+
color:var(--sys-yellow-accent-default, #ffc443);
|
|
153
190
|
}
|
|
154
191
|
.hintIcon[data-validation=success]{
|
|
155
192
|
color:var(--sys-green-accent-default, #57b762);
|
|
156
193
|
}
|
|
157
194
|
|
|
158
195
|
.counterLimit > span[data-validation=default]{
|
|
159
|
-
color:var(--sys-neutral-text-light, #
|
|
196
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
160
197
|
}
|
|
161
198
|
.counterLimit > span[data-limit-exceeded], .counterLimit > span[data-validation=error]{
|
|
162
199
|
color:var(--sys-red-text-light, #ea6658);
|
|
@@ -169,7 +206,7 @@
|
|
|
169
206
|
}
|
|
170
207
|
|
|
171
208
|
.counterCurrentValue[data-limit-exceeded][data-validation=default]{
|
|
172
|
-
color:var(--sys-neutral-text-main, #
|
|
209
|
+
color:var(--sys-neutral-text-main, #33343f);
|
|
173
210
|
}
|
|
174
211
|
.counterCurrentValue[data-limit-exceeded][data-validation=error]{
|
|
175
212
|
color:var(--sys-red-text-main, #621c1b);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FieldDecoratorProps } from './FieldDecorator';
|
|
3
|
-
export declare function extractFieldDecoratorProps<T extends Partial<FieldDecoratorProps>>({ error, required, readonly, label, labelTooltip, labelTooltipPlacement, labelFor, hint, disabled, showHintIcon, size, validationState, className, }: T): {
|
|
3
|
+
export declare function extractFieldDecoratorProps<T extends Partial<FieldDecoratorProps>>({ error, required, readonly, label, labelTooltip, labelTooltipPlacement, labelFor, caption, hint, disabled, showHintIcon, size, validationState, className, }: T): {
|
|
4
4
|
error: string | undefined;
|
|
5
5
|
required: boolean | undefined;
|
|
6
6
|
readonly: boolean | undefined;
|
|
@@ -8,6 +8,7 @@ export declare function extractFieldDecoratorProps<T extends Partial<FieldDecora
|
|
|
8
8
|
labelTooltip: import("react").ReactNode;
|
|
9
9
|
labelTooltipPlacement: import("@snack-uikit/popover-private/dist/types").Placement | undefined;
|
|
10
10
|
labelFor: string | undefined;
|
|
11
|
+
caption: string | undefined;
|
|
11
12
|
hint: string | undefined;
|
|
12
13
|
disabled: boolean | undefined;
|
|
13
14
|
showHintIcon: boolean | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function extractFieldDecoratorProps({ error, required, readonly, label, labelTooltip, labelTooltipPlacement, labelFor, hint, disabled, showHintIcon, size, validationState, className, }) {
|
|
1
|
+
export function extractFieldDecoratorProps({ error, required, readonly, label, labelTooltip, labelTooltipPlacement, labelFor, caption, hint, disabled, showHintIcon, size, validationState, className, }) {
|
|
2
2
|
return {
|
|
3
3
|
error,
|
|
4
4
|
required,
|
|
@@ -7,6 +7,7 @@ export function extractFieldDecoratorProps({ error, required, readonly, label, l
|
|
|
7
7
|
labelTooltip,
|
|
8
8
|
labelTooltipPlacement,
|
|
9
9
|
labelFor,
|
|
10
|
+
caption,
|
|
10
11
|
hint,
|
|
11
12
|
disabled,
|
|
12
13
|
showHintIcon,
|
|
@@ -3,7 +3,7 @@ import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
|
3
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
4
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
5
5
|
type InputProps = Pick<Partial<InputPrivateProps>, 'value' | 'onChange'> & Pick<InputPrivateProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur'>;
|
|
6
|
-
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'hint' | 'size' | 'validationState' | 'showHintIcon' | 'labelTooltipPlacement' | 'error'>;
|
|
6
|
+
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'size' | 'validationState' | 'showHintIcon' | 'labelTooltipPlacement' | 'error'>;
|
|
7
7
|
type FieldSecureOwnProps = {
|
|
8
8
|
/** Замаскированно ли значение поля */
|
|
9
9
|
hidden?: boolean;
|
|
@@ -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, hint, size = SIZE.S, validationState = VALIDATION_STATE.Default, prefixIcon, error, asyncValueGetter } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "allowMoreThanMaxLength", "hidden", "onHiddenChange", "showHintIcon", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "hint", "size", "validationState", "prefixIcon", "error", "asyncValueGetter"]);
|
|
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 } = _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"]);
|
|
34
34
|
const localRef = useRef(null);
|
|
35
35
|
const copyButtonRef = useRef(null);
|
|
36
36
|
const hideButtonRef = useRef(null);
|
|
@@ -110,5 +110,5 @@ export const FieldSecure = forwardRef((_a, ref) => {
|
|
|
110
110
|
readonly,
|
|
111
111
|
submitKeys: ['Enter', 'Space', 'Tab'],
|
|
112
112
|
});
|
|
113
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, 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: buttons, 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' }) }) }) })));
|
|
113
|
+
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: buttons, 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' }) }) }) })));
|
|
114
114
|
});
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
.container[data-size=s] .arrowIcon{
|
|
70
70
|
width:var(--size-icon-container-xs, 16px) !important;
|
|
71
71
|
height:var(--size-icon-container-xs, 16px) !important;
|
|
72
|
-
color:var(--sys-neutral-text-light, #
|
|
72
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
73
73
|
}
|
|
74
74
|
.container[data-size=s][data-variant=single-line-container] .displayValue{
|
|
75
75
|
width:calc(100% - (
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
.container[data-size=m] .arrowIcon{
|
|
93
93
|
width:var(--size-icon-container-s, 24px) !important;
|
|
94
94
|
height:var(--size-icon-container-s, 24px) !important;
|
|
95
|
-
color:var(--sys-neutral-text-light, #
|
|
95
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
96
96
|
}
|
|
97
97
|
.container[data-size=m][data-variant=single-line-container] .displayValue{
|
|
98
98
|
width:calc(100% - (
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
.container[data-size=l] .arrowIcon{
|
|
116
116
|
width:var(--size-icon-container-s, 24px) !important;
|
|
117
117
|
height:var(--size-icon-container-s, 24px) !important;
|
|
118
|
-
color:var(--sys-neutral-text-light, #
|
|
118
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
119
119
|
}
|
|
120
120
|
.container[data-size=l][data-variant=single-line-container] .displayValue{
|
|
121
121
|
width:calc(100% - (
|
|
@@ -128,10 +128,10 @@
|
|
|
128
128
|
border-radius:var(--radius-fields-l, 16px);
|
|
129
129
|
}
|
|
130
130
|
.container:hover .arrowIcon, .container:focus-within .arrowIcon, .container[data-focused] .arrowIcon{
|
|
131
|
-
color:var(--sys-neutral-text-support, #
|
|
131
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
132
132
|
}
|
|
133
133
|
.container[data-disabled] .arrowIcon, .container[data-readonly] .arrowIcon{
|
|
134
|
-
color:var(--sys-neutral-text-disabled, #
|
|
134
|
+
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
.inputPlug{
|
|
@@ -20,7 +20,7 @@ export type NestListOptionProps = Pick<NextListItemProps, 'type' | 'onSublistOpe
|
|
|
20
20
|
options: OptionProps[];
|
|
21
21
|
};
|
|
22
22
|
export type InputProps = Pick<InputPrivateProps, 'id' | 'name' | 'placeholder' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'onKeyDown'>;
|
|
23
|
-
export type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
|
|
23
|
+
export type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
|
|
24
24
|
export type ItemWithId = (BaseItemProps | AccordionItemProps | NextListItemProps) & {
|
|
25
25
|
placeholder?: boolean;
|
|
26
26
|
appearance?: TagProps['appearance'];
|
|
@@ -5,7 +5,7 @@ import { WithSupportProps } from '@snack-uikit/utils';
|
|
|
5
5
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
6
6
|
import { TextInputFormatter } from './types';
|
|
7
7
|
type SliderProps = Pick<InputPrivateProps, 'id' | 'name' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur'> & Pick<SliderComponentProps, 'range' | 'value' | 'onChange' | 'tipFormatter'> & Required<Pick<SliderComponentProps, 'min' | 'max' | 'step' | 'marks'>>;
|
|
8
|
-
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'hint' | 'showHintIcon' | 'size' | 'labelTooltipPlacement'>;
|
|
8
|
+
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'showHintIcon' | 'size' | 'labelTooltipPlacement'>;
|
|
9
9
|
type FieldSliderOwnProps = {
|
|
10
10
|
/** Иконка-постфикс для поля */
|
|
11
11
|
postfixIcon?: ReactElement;
|
|
@@ -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, hint, showHintIcon, size = SIZE.S, postfixIcon, textInputFormatter } = _a, rest = __rest(_a, ["id", "name", "min", "max", "step", "marks", "showScaleBar", "value", "range", "disabled", "readonly", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "hint", "showHintIcon", "size", "postfixIcon", "textInputFormatter"]);
|
|
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, postfixIcon, textInputFormatter } = _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", "postfixIcon", "textInputFormatter"]);
|
|
35
35
|
const getMarkValue = useCallback((key) => {
|
|
36
36
|
const mark = marks[key];
|
|
37
37
|
if (isMarkObject(mark)) {
|
|
@@ -145,5 +145,5 @@ export const FieldSlider = forwardRef((_a, ref) => {
|
|
|
145
145
|
// update value only when marks, min or max are changed
|
|
146
146
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
147
147
|
}, [marks, min, max]);
|
|
148
|
-
return (_jsxs(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, disabled: disabled, required: required, 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, postfix: 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' }) }) })] })));
|
|
148
|
+
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, postfix: 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' }) }) })] })));
|
|
149
149
|
});
|
|
@@ -3,7 +3,7 @@ import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
|
3
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
4
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
5
5
|
type InputProps = Pick<InputPrivateProps, 'id' | 'name' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur' | 'min' | 'max'>;
|
|
6
|
-
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
|
|
6
|
+
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
|
|
7
7
|
type FieldStepperOwnProps = {
|
|
8
8
|
/** Значение поля */
|
|
9
9
|
value?: number;
|
|
@@ -35,7 +35,7 @@ const getDefaultValue = (min, max) => {
|
|
|
35
35
|
return 0;
|
|
36
36
|
};
|
|
37
37
|
export const FieldStepper = forwardRef((_a, ref) => {
|
|
38
|
-
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, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, error } = _a, rest = __rest(_a, ["id", "name", "value", "min", "max", "step", "disabled", "readonly", "allowMoreThanLimits", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "hint", "showHintIcon", "size", "validationState", "error"]);
|
|
38
|
+
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 } = _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"]);
|
|
39
39
|
const { t } = useLocale('Fields');
|
|
40
40
|
const [value = 0, setValue] = useValueControl({
|
|
41
41
|
value: valueProp,
|
|
@@ -124,5 +124,5 @@ export const FieldStepper = forwardRef((_a, ref) => {
|
|
|
124
124
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, 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', children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: inputRef, prefix: _jsx(ButtonFunction, { tabIndex: -1, ref: minusButtonRef, size: 'xs', className: styles.button, icon: _jsx(MinusSVG, {}), onClick: handleMinusButtonClick, onKeyDown: handleMinusButtonKeyDown, disabled: isMinusButtonDisabled, "data-test-id": 'field-stepper__minus-button' }), postfix: _jsx(ButtonFunction, { ref: plusButtonRef, tabIndex: -1, size: 'xs', className: styles.button, icon: _jsx(PlusSVG, {}), onClick: handlePlusButtonClick, onKeyDown: handlePlusButtonKeyDown, disabled: isPlusButtonDisabled, "data-test-id": 'field-stepper__plus-button' }), 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, name: name, min: min, max: max, "data-test-id": 'field-stepper__input' }) }) }) })));
|
|
127
|
+
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', children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: inputRef, prefix: _jsx(ButtonFunction, { tabIndex: -1, ref: minusButtonRef, size: 'xs', className: styles.button, icon: _jsx(MinusSVG, {}), onClick: handleMinusButtonClick, onKeyDown: handleMinusButtonKeyDown, disabled: isMinusButtonDisabled, "data-test-id": 'field-stepper__minus-button' }), postfix: _jsx(ButtonFunction, { ref: plusButtonRef, tabIndex: -1, size: 'xs', className: styles.button, icon: _jsx(PlusSVG, {}), onClick: handlePlusButtonClick, onKeyDown: handlePlusButtonKeyDown, disabled: isPlusButtonDisabled, "data-test-id": 'field-stepper__plus-button' }), 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, name: name, min: min, max: max, "data-test-id": 'field-stepper__input' }) }) }) })));
|
|
128
128
|
});
|
|
@@ -3,7 +3,7 @@ import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
|
3
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
4
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
5
5
|
type InputProps = Pick<Partial<InputPrivateProps>, 'value' | 'onChange'> & Pick<InputPrivateProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur'>;
|
|
6
|
-
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
|
|
6
|
+
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
|
|
7
7
|
type FieldTextOwnProps = {
|
|
8
8
|
/** Отображение кнопки Копировать для поля (актуально только для `readonly = true`) */
|
|
9
9
|
showCopyButton?: boolean;
|
|
@@ -20,7 +20,7 @@ import { useCopyButton, useValueControl } from '../../hooks';
|
|
|
20
20
|
import { getValidationState } from '../../utils/getValidationState';
|
|
21
21
|
import { FieldDecorator } from '../FieldDecorator';
|
|
22
22
|
export const FieldText = forwardRef((_a, ref) => {
|
|
23
|
-
var { id, name, value: valueProp, placeholder, maxLength, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, allowMoreThanMaxLength = false, onChange: onChangeProp, onFocus, onBlur, className, label, labelTooltip, labelTooltipPlacement, required = false, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, prefixIcon, error } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "hint", "showHintIcon", "size", "validationState", "prefixIcon", "error"]);
|
|
23
|
+
var { id, name, value: valueProp, placeholder, maxLength, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, allowMoreThanMaxLength = false, onChange: onChangeProp, onFocus, onBlur, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, prefixIcon, error } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "prefixIcon", "error"]);
|
|
24
24
|
const [value = '', onChange] = useValueControl({
|
|
25
25
|
value: valueProp,
|
|
26
26
|
defaultValue: '',
|
|
@@ -48,5 +48,5 @@ export const FieldText = forwardRef((_a, ref) => {
|
|
|
48
48
|
readonly,
|
|
49
49
|
submitKeys: ['Enter', 'Space', 'Tab'],
|
|
50
50
|
});
|
|
51
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, 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: CONTAINER_VARIANT.SingleLine, inputRef: localRef, prefix: prefixIcon, postfix: buttons, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, tabIndex: inputTabIndex, onKeyDown: onInputKeyDown, placeholder: placeholder, disabled: disabled, readonly: readonly, type: 'text', maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, id: id, name: name, "data-test-id": 'field-text__input' }) }) })));
|
|
51
|
+
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: CONTAINER_VARIANT.SingleLine, inputRef: localRef, prefix: prefixIcon, postfix: buttons, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, tabIndex: inputTabIndex, onKeyDown: onInputKeyDown, placeholder: placeholder, disabled: disabled, readonly: readonly, type: 'text', maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, id: id, name: name, "data-test-id": 'field-text__input' }) }) })));
|
|
52
52
|
});
|
|
@@ -3,7 +3,7 @@ import { WithSupportProps } from '@snack-uikit/utils';
|
|
|
3
3
|
import { TextAreaProps } from '../../helperComponents';
|
|
4
4
|
import { FieldDecoratorProps } from '../FieldDecorator';
|
|
5
5
|
type InputProps = Pick<Partial<TextAreaProps>, 'value'> & Pick<TextAreaProps, 'id' | 'name' | 'placeholder' | 'maxLength' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur'>;
|
|
6
|
-
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'hint' | 'size' | 'validationState' | 'showHintIcon' | 'labelTooltipPlacement' | 'error'>;
|
|
6
|
+
type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'size' | 'validationState' | 'showHintIcon' | 'labelTooltipPlacement' | 'error'>;
|
|
7
7
|
type FieldTextAreaOwnProps = {
|
|
8
8
|
/** Минимальное кол-во строк, до которого размер поля может быть увеличен @default 3*/
|
|
9
9
|
minRows?: number;
|
|
@@ -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, hint, error, size = SIZE.S, validationState = VALIDATION_STATE.Default } = _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", "hint", "error", "size", "validationState"]);
|
|
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 } = _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"]);
|
|
26
26
|
const localRef = useRef(null);
|
|
27
27
|
const clearButtonRef = useRef(null);
|
|
28
28
|
const copyButtonRef = useRef(null);
|
|
@@ -50,5 +50,5 @@ export const FieldTextArea = forwardRef((_a, ref) => {
|
|
|
50
50
|
readonly,
|
|
51
51
|
submitKeys: ['Enter', 'Space', 'Tab'],
|
|
52
52
|
});
|
|
53
|
-
return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, 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: buttons }), 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' }) }) }) })));
|
|
53
|
+
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: buttons }), 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' }) }) }) })));
|
|
54
54
|
});
|