@cloud-ru/ds-fields 1.0.8-preview-13225cc1.0 → 1.0.8-preview-b5c05914.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/README.md +1 -2
- package/dist/cjs/components/FieldSelect/FieldSelect.js +1 -1
- package/dist/cjs/components/FieldTextArea/FieldTextArea.d.ts +1 -7
- package/dist/cjs/components/FieldTextArea/FieldTextArea.js +4 -4
- package/dist/esm/components/FieldSelect/FieldSelect.js +1 -1
- package/dist/esm/components/FieldTextArea/FieldTextArea.d.ts +1 -7
- package/dist/esm/components/FieldTextArea/FieldTextArea.js +4 -4
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/src/components/FieldSelect/FieldSelect.tsx +1 -1
- package/src/components/FieldTextArea/FieldTextArea.tsx +4 -11
package/README.md
CHANGED
|
@@ -804,8 +804,7 @@ export function TextArea() {
|
|
|
804
804
|
| `required` | `boolean` | — | Показать знак обязательности `*` |
|
|
805
805
|
| `resizable` | `boolean` | `false` | Можно ли менять высоту мышкой за нижний угол. Игнорируется при `disabled` или `readonly`. |
|
|
806
806
|
| `showClearButton` | `boolean` | `true` | Кнопка очистки (видна при value && !readonly) |
|
|
807
|
-
| `showCopyButton` | `boolean` | `true` | Кнопка копирования (видна при
|
|
808
|
-
| `showCopyButtonInEditMode` | `boolean` | `false` | Показывать кнопку копирования и в обычном (не readonly) режиме — рядом с кнопкой очистки. <br/> Опция только для textarea: в многострочном поле копирование значения осмысленно и при вводе. |
|
|
807
|
+
| `showCopyButton` | `boolean` | `true` | Кнопка копирования (видна при value && !disabled, независимо от readonly) |
|
|
809
808
|
| `showHintIcon` | `boolean` | — | Отображение статус-иконки у подсказки (по умолчанию `true`) |
|
|
810
809
|
| `size` | `"l"` \| `"m"` \| `"s"` | `m` | Размер |
|
|
811
810
|
| `spellCheck` | `boolean` | — | Проверка орфографии |
|
|
@@ -350,7 +350,7 @@ exports.FieldSelect = (0, react_1.forwardRef)(function FieldSelect(props, ref) {
|
|
|
350
350
|
const plug = inputPlugRef.current?.clientWidth ?? SEARCH_INPUT_PLUG_MIN_WIDTH;
|
|
351
351
|
setChipInputMinWidth(Math.min(content, Math.max(plug, SEARCH_INPUT_PLUG_MIN_WIDTH)));
|
|
352
352
|
}, [hasChips, inputValue, selectedPairs.length]);
|
|
353
|
-
const searchInputField = ((0, jsx_runtime_1.jsx)(input_private_1.InputPrivate, { ref: (0, merge_refs_1.default)(ref, inputRef, inputElementRef), className: (0, classnames_1.default)(styles_module_scss_1.default.fieldInput, !searchable && styles_module_scss_2.default.readonlyCursor), value: inputValue, onChange: searchable ? handleInputChange : undefined, placeholder: selectedLabel
|
|
353
|
+
const searchInputField = ((0, jsx_runtime_1.jsx)(input_private_1.InputPrivate, { ref: (0, merge_refs_1.default)(ref, inputRef, inputElementRef), className: (0, classnames_1.default)(styles_module_scss_1.default.fieldInput, !searchable && styles_module_scss_2.default.readonlyCursor), value: inputValue, onChange: searchable ? handleInputChange : undefined, placeholder: selectedLabel ? '' : placeholder, disabled: disabled, readonly: !searchable || readOnly, id: id, name: name, autoFocus: resolvedAutoFocus, tabIndex: inputTabIndex, onFocus: handleInputFocus, onBlur: handleInputBlur, onKeyDown: handleTriggerKeyDown, "data-test-id": constants_1.TEST_IDS.fieldSelectInput }));
|
|
354
354
|
// В режиме чипов input заворачивается в `.inputWrapper` с динамической minWidth (флоу за чипами);
|
|
355
355
|
// без чипов — обычный `inputArea` на всю строку.
|
|
356
356
|
const searchInput = hasChips ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_2.default.inputWrapper, style: { minWidth: chipInputMinWidth }, children: searchInputField })) : ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.inputArea, children: searchInputField }));
|
|
@@ -77,16 +77,10 @@ type FieldTextAreaOwnProps = {
|
|
|
77
77
|
*/
|
|
78
78
|
showClearButton?: boolean;
|
|
79
79
|
/**
|
|
80
|
-
* Кнопка копирования (видна при
|
|
80
|
+
* Кнопка копирования (видна при value && !disabled, независимо от readonly)
|
|
81
81
|
* @default true
|
|
82
82
|
*/
|
|
83
83
|
showCopyButton?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Показывать кнопку копирования и в обычном (не readonly) режиме — рядом с кнопкой очистки.
|
|
86
|
-
* Опция только для textarea: в многострочном поле копирование значения осмысленно и при вводе.
|
|
87
|
-
* @default false
|
|
88
|
-
*/
|
|
89
|
-
showCopyButtonInEditMode?: boolean;
|
|
90
84
|
/** Колбек после копирования */
|
|
91
85
|
onCopyButtonClick?(): void;
|
|
92
86
|
/** Колбек фокуса */
|
|
@@ -18,7 +18,7 @@ const hooks_1 = require("../../hooks");
|
|
|
18
18
|
const shared_1 = require("../shared");
|
|
19
19
|
const styles_module_scss_1 = __importDefault(require('../shared/styles.module.css'));
|
|
20
20
|
const styles_module_scss_2 = __importDefault(require('./styles.module.css'));
|
|
21
|
-
exports.FieldTextArea = (0, react_1.forwardRef)(function FieldTextArea({ label = '', labelTooltip, caption, hint, error, validationState = field_decorator_1.VALIDATION_STATE.Default, showHintIcon, length, required, size = field_decorator_1.SIZE.M, className, fieldClassName, background = true, value: valueProp, defaultValue = '', onChange, placeholder, id, name, maxLength, disabled, readonly: readOnly, autoFocus, layoutPresets, inputMode, spellCheck, minRows = 3, maxRows = 1000, resizable = false, allowMoreThanMaxLength = true, header, footer, showClearButton: showClearButtonProp = true, showCopyButton: showCopyButtonProp = true,
|
|
21
|
+
exports.FieldTextArea = (0, react_1.forwardRef)(function FieldTextArea({ label = '', labelTooltip, caption, hint, error, validationState = field_decorator_1.VALIDATION_STATE.Default, showHintIcon, length, required, size = field_decorator_1.SIZE.M, className, fieldClassName, background = true, value: valueProp, defaultValue = '', onChange, placeholder, id, name, maxLength, disabled, readonly: readOnly, autoFocus, layoutPresets, inputMode, spellCheck, minRows = 3, maxRows = 1000, resizable = false, allowMoreThanMaxLength = true, header, footer, showClearButton: showClearButtonProp = true, showCopyButton: showCopyButtonProp = true, onCopyButtonClick, onFocus: onFocusProp, onBlur: onBlurProp, onKeyDown: onKeyDownProp, 'data-test-id': dataTestId, ...rest }, ref) {
|
|
22
22
|
const localRef = (0, react_1.useRef)(null);
|
|
23
23
|
const clearButtonRef = (0, react_1.useRef)(null);
|
|
24
24
|
const copyButtonRef = (0, react_1.useRef)(null);
|
|
@@ -37,9 +37,9 @@ exports.FieldTextArea = (0, react_1.forwardRef)(function FieldTextArea({ label =
|
|
|
37
37
|
const stringValue = String(value ?? '');
|
|
38
38
|
const isResizable = resizable && !disabled && !readOnly;
|
|
39
39
|
const showClearUi = Boolean(showClearButtonProp && stringValue && !readOnly && !disabled);
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
const showCopyUi = Boolean(showCopyButtonProp && stringValue && !disabled
|
|
40
|
+
// Copy не завязан на readonly (паритет с snack-uikit master): виден при любом непустом значении.
|
|
41
|
+
// В editable-режиме показываются обе кнопки (clear + copy), в readonly — только copy.
|
|
42
|
+
const showCopyUi = Boolean(showCopyButtonProp && stringValue && !disabled);
|
|
43
43
|
const onClear = (0, react_1.useCallback)(() => {
|
|
44
44
|
setValue('');
|
|
45
45
|
onChange?.('');
|
|
@@ -344,7 +344,7 @@ export const FieldSelect = forwardRef(function FieldSelect(props, ref) {
|
|
|
344
344
|
const plug = inputPlugRef.current?.clientWidth ?? SEARCH_INPUT_PLUG_MIN_WIDTH;
|
|
345
345
|
setChipInputMinWidth(Math.min(content, Math.max(plug, SEARCH_INPUT_PLUG_MIN_WIDTH)));
|
|
346
346
|
}, [hasChips, inputValue, selectedPairs.length]);
|
|
347
|
-
const searchInputField = (_jsx(InputPrivate, { ref: mergeRefs(ref, inputRef, inputElementRef), className: cn(fieldStyles.fieldInput, !searchable && styles.readonlyCursor), value: inputValue, onChange: searchable ? handleInputChange : undefined, placeholder: selectedLabel
|
|
347
|
+
const searchInputField = (_jsx(InputPrivate, { ref: mergeRefs(ref, inputRef, inputElementRef), className: cn(fieldStyles.fieldInput, !searchable && styles.readonlyCursor), value: inputValue, onChange: searchable ? handleInputChange : undefined, placeholder: selectedLabel ? '' : placeholder, disabled: disabled, readonly: !searchable || readOnly, id: id, name: name, autoFocus: resolvedAutoFocus, tabIndex: inputTabIndex, onFocus: handleInputFocus, onBlur: handleInputBlur, onKeyDown: handleTriggerKeyDown, "data-test-id": TEST_IDS.fieldSelectInput }));
|
|
348
348
|
// В режиме чипов input заворачивается в `.inputWrapper` с динамической minWidth (флоу за чипами);
|
|
349
349
|
// без чипов — обычный `inputArea` на всю строку.
|
|
350
350
|
const searchInput = hasChips ? (_jsx("div", { className: styles.inputWrapper, style: { minWidth: chipInputMinWidth }, children: searchInputField })) : (_jsx("div", { className: fieldStyles.inputArea, children: searchInputField }));
|
|
@@ -77,16 +77,10 @@ type FieldTextAreaOwnProps = {
|
|
|
77
77
|
*/
|
|
78
78
|
showClearButton?: boolean;
|
|
79
79
|
/**
|
|
80
|
-
* Кнопка копирования (видна при
|
|
80
|
+
* Кнопка копирования (видна при value && !disabled, независимо от readonly)
|
|
81
81
|
* @default true
|
|
82
82
|
*/
|
|
83
83
|
showCopyButton?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Показывать кнопку копирования и в обычном (не readonly) режиме — рядом с кнопкой очистки.
|
|
86
|
-
* Опция только для textarea: в многострочном поле копирование значения осмысленно и при вводе.
|
|
87
|
-
* @default false
|
|
88
|
-
*/
|
|
89
|
-
showCopyButtonInEditMode?: boolean;
|
|
90
84
|
/** Колбек после копирования */
|
|
91
85
|
onCopyButtonClick?(): void;
|
|
92
86
|
/** Колбек фокуса */
|
|
@@ -12,7 +12,7 @@ import { useAdaptiveAutoFocus } from '../../hooks/index.js';
|
|
|
12
12
|
import { copyTextToClipboard, FieldShell, toInputSize, useCopyButton } from '../shared/index.js';
|
|
13
13
|
import fieldStyles from '../shared/styles.module.css';
|
|
14
14
|
import styles from './styles.module.css';
|
|
15
|
-
export const FieldTextArea = forwardRef(function FieldTextArea({ label = '', labelTooltip, caption, hint, error, validationState = VALIDATION_STATE.Default, showHintIcon, length, required, size = SIZE.M, className, fieldClassName, background = true, value: valueProp, defaultValue = '', onChange, placeholder, id, name, maxLength, disabled, readonly: readOnly, autoFocus, layoutPresets, inputMode, spellCheck, minRows = 3, maxRows = 1000, resizable = false, allowMoreThanMaxLength = true, header, footer, showClearButton: showClearButtonProp = true, showCopyButton: showCopyButtonProp = true,
|
|
15
|
+
export const FieldTextArea = forwardRef(function FieldTextArea({ label = '', labelTooltip, caption, hint, error, validationState = VALIDATION_STATE.Default, showHintIcon, length, required, size = SIZE.M, className, fieldClassName, background = true, value: valueProp, defaultValue = '', onChange, placeholder, id, name, maxLength, disabled, readonly: readOnly, autoFocus, layoutPresets, inputMode, spellCheck, minRows = 3, maxRows = 1000, resizable = false, allowMoreThanMaxLength = true, header, footer, showClearButton: showClearButtonProp = true, showCopyButton: showCopyButtonProp = true, onCopyButtonClick, onFocus: onFocusProp, onBlur: onBlurProp, onKeyDown: onKeyDownProp, 'data-test-id': dataTestId, ...rest }, ref) {
|
|
16
16
|
const localRef = useRef(null);
|
|
17
17
|
const clearButtonRef = useRef(null);
|
|
18
18
|
const copyButtonRef = useRef(null);
|
|
@@ -31,9 +31,9 @@ export const FieldTextArea = forwardRef(function FieldTextArea({ label = '', lab
|
|
|
31
31
|
const stringValue = String(value ?? '');
|
|
32
32
|
const isResizable = resizable && !disabled && !readOnly;
|
|
33
33
|
const showClearUi = Boolean(showClearButtonProp && stringValue && !readOnly && !disabled);
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
const showCopyUi = Boolean(showCopyButtonProp && stringValue && !disabled
|
|
34
|
+
// Copy не завязан на readonly (паритет с snack-uikit master): виден при любом непустом значении.
|
|
35
|
+
// В editable-режиме показываются обе кнопки (clear + copy), в readonly — только copy.
|
|
36
|
+
const showCopyUi = Boolean(showCopyButtonProp && stringValue && !disabled);
|
|
37
37
|
const onClear = useCallback(() => {
|
|
38
38
|
setValue('');
|
|
39
39
|
onChange?.('');
|