@cloud-ru/ds-uikit-product-fields-predefined 2.0.16-preview-c228f409.0 → 2.0.16-preview-d50a3da1.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/dist/cjs/components/FieldChat/FieldChat.js +1 -1
- package/dist/cjs/components/FieldChat/components/Attachments/styles.module.css +1 -1
- package/dist/cjs/components/FieldChat/components/TextAreaActionsFooter/styles.module.css +4 -2
- package/dist/cjs/components/FieldChat/styles.module.css +2 -4
- package/dist/cjs/components/FieldCode/FieldCode.js +1 -1
- package/dist/cjs/components/FieldCode/styles.module.css +4 -17
- package/dist/cjs/components/FieldPhone/FieldPhone.js +4 -1
- package/dist/cjs/components/FieldPhone/constants.d.ts +7 -1
- package/dist/cjs/components/FieldPhone/constants.js +7 -2
- package/dist/cjs/components/FieldSelectCreate/FieldSelectCreate.js +2 -2
- package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.d.ts +3 -1
- package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.js +2 -2
- package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/styles.module.css +1 -2
- package/dist/cjs/components/FieldSelectCreate/styles.module.css +2 -1
- package/dist/cjs/style.css +14 -27
- package/dist/esm/components/FieldChat/FieldChat.js +1 -1
- package/dist/esm/components/FieldChat/components/Attachments/styles.module.css +1 -1
- package/dist/esm/components/FieldChat/components/TextAreaActionsFooter/styles.module.css +4 -2
- package/dist/esm/components/FieldChat/styles.module.css +2 -4
- package/dist/esm/components/FieldCode/FieldCode.js +1 -1
- package/dist/esm/components/FieldCode/styles.module.css +4 -17
- package/dist/esm/components/FieldPhone/FieldPhone.js +6 -3
- package/dist/esm/components/FieldPhone/constants.d.ts +7 -1
- package/dist/esm/components/FieldPhone/constants.js +6 -1
- package/dist/esm/components/FieldSelectCreate/FieldSelectCreate.js +2 -2
- package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.d.ts +3 -1
- package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.js +2 -2
- package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/styles.module.css +1 -2
- package/dist/esm/components/FieldSelectCreate/styles.module.css +2 -1
- package/dist/esm/style.css +14 -27
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/src/components/FieldChat/FieldChat.tsx +1 -1
- package/src/components/FieldChat/components/Attachments/styles.module.scss +1 -1
- package/src/components/FieldChat/components/TextAreaActionsFooter/styles.module.scss +5 -2
- package/src/components/FieldChat/styles.module.scss +3 -5
- package/src/components/FieldCode/FieldCode.tsx +1 -6
- package/src/components/FieldCode/styles.module.scss +5 -17
- package/src/components/FieldPhone/FieldPhone.tsx +16 -3
- package/src/components/FieldPhone/constants.ts +9 -1
- package/src/components/FieldSelectCreate/FieldSelectCreate.tsx +2 -1
- package/src/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.tsx +4 -2
- package/src/components/FieldSelectCreate/helperComponents/SelectFooter/styles.module.scss +2 -4
- package/src/components/FieldSelectCreate/styles.module.scss +2 -1
|
@@ -46,5 +46,5 @@ function FieldChat({ handleSubmit: handleSubmitProp, value, attachment, autoFocu
|
|
|
46
46
|
handleSubmit();
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.fieldChat,
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.fieldChat, children: [isMobile && (0, jsx_runtime_1.jsx)(Attachments_1.Attachments, { files: files, isMobile: isMobile }), (0, jsx_runtime_1.jsx)(fields_1.FieldTextArea, { ...props, autoFocus: autoFocus, value: value, size: 'm', minRows: 1, maxRows: 4, showCopyButton: false, placeholder: t('FieldChat.placeholder'), onKeyDown: handleKeyDown, footer: (0, jsx_runtime_1.jsx)(TextAreaActionsFooter_1.TextAreaActionsFooter, { right: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [attachment && ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: t('FieldChat.attachFileTooltip'), hoverDelayOpen: 600, open: isInactive ? false : undefined, triggerClassName: styles_module_scss_1.default.uploadTooltip, children: (0, jsx_runtime_1.jsx)(dropzone_1.FileUpload, { mode: dropzone_1.UPLOAD_MODE.Multiple, onFilesUpload: attachment.onFilesUpload, accept: attachment.accept, children: (0, jsx_runtime_1.jsx)(button_1.Button, { view: button_1.VIEW.Function, appearance: button_1.APPEARANCE.Neutral, size: 's', icon: (0, jsx_runtime_1.jsx)(product_1.AttachmentSVG, {}), disabled: isInactive, "data-test-id": constants_1.TEST_IDS.fieldChatUpload }) }) })), (0, jsx_runtime_1.jsx)(FieldSubmitButton_1.FieldSubmitButton, { active: isValueValid && !isInactive, handleClick: handleSubmit, "data-test-id": constants_1.TEST_IDS.fieldChatSubmit })] }) }) }), !isMobile && (0, jsx_runtime_1.jsx)(Attachments_1.Attachments, { files: files })] }));
|
|
50
50
|
}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
flex-direction:row;
|
|
4
4
|
align-items:center;
|
|
5
5
|
justify-content:space-between;
|
|
6
|
+
box-sizing:border-box;
|
|
6
7
|
width:100%;
|
|
7
|
-
padding
|
|
8
|
+
padding:var(--sn-primitive-dimension-8, 8px);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.actionsLeft{
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
flex-direction:row;
|
|
13
14
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
14
15
|
align-items:center;
|
|
16
|
+
box-sizing:border-box;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
.actionsRight{
|
|
@@ -20,6 +22,6 @@
|
|
|
20
22
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
21
23
|
align-items:center;
|
|
22
24
|
justify-content:flex-end;
|
|
25
|
+
box-sizing:border-box;
|
|
23
26
|
width:100%;
|
|
24
|
-
padding-right:var(--sn-primitive-dimension-8, 8px);
|
|
25
27
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
.fieldChat{
|
|
2
2
|
display:flex;
|
|
3
3
|
flex-direction:column;
|
|
4
|
-
gap:var(--sn-primitive-dimension-
|
|
4
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
5
|
+
box-sizing:border-box;
|
|
5
6
|
width:100%;
|
|
6
7
|
min-width:0;
|
|
7
8
|
}
|
|
8
|
-
.fieldChat[data-layout-type=mobile]{
|
|
9
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
10
|
-
}
|
|
11
9
|
|
|
12
10
|
.uploadTooltip{
|
|
13
11
|
display:flex;
|
|
@@ -34,7 +34,7 @@ exports.FieldCode = (0, react_1.forwardRef)(function FieldCode(props, ref) {
|
|
|
34
34
|
resetCode,
|
|
35
35
|
}), [moveFocus, blurFields, resetCode]);
|
|
36
36
|
const resolvedError = error ?? invalidCode;
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: rootRef, className: (0, classnames_1.default)(styles_module_scss_1.default.fieldCode, hasOverflow && styles_module_scss_1.default.fieldCodeScrollable, className), "data-size": size, "data-disabled": disabled || undefined, "data-stretch-cells": stretchCells || undefined, ...(dataTestId ? { 'data-test-id': dataTestId } : undefined), children: [(0, jsx_runtime_1.jsx)(field_decorator_1.FieldDecorator, { className: (0, classnames_1.default)(!hasOverflow && styles_module_scss_1.default.fieldDecorator), label: label, disabled: disabled, size: size, error: resolvedError, children: (0, jsx_runtime_1.jsx)("div", { ref: codeContainerRef, className: styles_module_scss_1.default.codeContainer, "data-
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: rootRef, className: (0, classnames_1.default)(styles_module_scss_1.default.fieldCode, hasOverflow && styles_module_scss_1.default.fieldCodeScrollable, className), "data-size": size, "data-disabled": disabled || undefined, "data-stretch-cells": stretchCells || undefined, ...(dataTestId ? { 'data-test-id': dataTestId } : undefined), children: [(0, jsx_runtime_1.jsx)(field_decorator_1.FieldDecorator, { className: (0, classnames_1.default)(!hasOverflow && styles_module_scss_1.default.fieldDecorator), label: label, disabled: disabled, size: size, error: resolvedError, children: (0, jsx_runtime_1.jsx)("div", { ref: codeContainerRef, className: styles_module_scss_1.default.codeContainer, "data-stretch-cells": stretchCells || undefined, children: code.map((char, index) => ((0, jsx_runtime_1.jsx)(components_1.Cell, { ref: inputRef => {
|
|
38
38
|
if (inputRef) {
|
|
39
39
|
inputsRef.current[index] = inputRef;
|
|
40
40
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
flex-direction:column;
|
|
4
4
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
5
5
|
align-items:center;
|
|
6
|
+
box-sizing:border-box;
|
|
6
7
|
}
|
|
7
8
|
.fieldCode[data-stretch-cells]{
|
|
8
9
|
align-items:stretch;
|
|
@@ -19,27 +20,13 @@
|
|
|
19
20
|
|
|
20
21
|
.codeContainer{
|
|
21
22
|
display:flex;
|
|
23
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
22
24
|
justify-content:safe center;
|
|
23
25
|
}
|
|
24
26
|
.codeContainer[data-stretch-cells]{
|
|
25
27
|
width:100%;
|
|
26
28
|
}
|
|
27
|
-
.codeContainer[data-size=s]{
|
|
28
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
29
|
-
}
|
|
30
|
-
.codeContainer[data-size=m]{
|
|
31
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
32
|
-
}
|
|
33
|
-
.codeContainer[data-size=l]{
|
|
34
|
-
gap:var(--sn-primitive-dimension-12, 12px);
|
|
35
|
-
}
|
|
36
29
|
|
|
37
|
-
.cellSpacing
|
|
38
|
-
margin-right:var(--sn-primitive-dimension-
|
|
39
|
-
}
|
|
40
|
-
.cellSpacing[data-size=m]{
|
|
41
|
-
margin-right:var(--sn-primitive-dimension-8, 8px);
|
|
42
|
-
}
|
|
43
|
-
.cellSpacing[data-size=l]{
|
|
44
|
-
margin-right:var(--sn-primitive-dimension-12, 12px);
|
|
30
|
+
.cellSpacing{
|
|
31
|
+
margin-right:var(--sn-primitive-dimension-4, 4px);
|
|
45
32
|
}
|
|
@@ -144,10 +144,13 @@ exports.FieldPhone = (0, react_1.forwardRef)(function FieldPhone({ value: valueP
|
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
const showClear = showClearButton && Boolean(unmaskedValue);
|
|
147
|
+
const selectorFlag = (0, react_1.isValidElement)(country?.beforeContent)
|
|
148
|
+
? (0, react_1.cloneElement)(country.beforeContent, { style: constants_2.SELECTOR_FLAG_STYLE })
|
|
149
|
+
: country?.beforeContent;
|
|
147
150
|
return ((0, jsx_runtime_1.jsx)(fields_1.FieldCombo, { ...rest, inputMode: 'tel', type: 'tel', ref: (0, merge_refs_1.default)(ref, localRef, iMaskRef), className: (0, classnames_1.default)(className, styles_module_scss_1.default.fieldPhone), "data-empty": !unmaskedValue || undefined, autoFocus: autoFocus, value: iMaskValue, onChange: handleChange, onPaste: handlePaste, showClearButton: showClear, prefix: country?.content.caption, elementBefore: isOnlyOneCountryAvailable
|
|
148
151
|
? undefined
|
|
149
152
|
: {
|
|
150
|
-
action:
|
|
153
|
+
action: selectorFlag,
|
|
151
154
|
'data-test-id': constants_1.TEST_IDS.fieldPhoneCountrySelect,
|
|
152
155
|
droplist: {
|
|
153
156
|
items,
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
1
2
|
export declare const PLACEHOLDER_CHAR = "_";
|
|
2
3
|
/**
|
|
3
4
|
* Размер иконки флага страны в селекторе и выпадающем списке. У флагов из `@cloud-ru/ds-icons/flags`
|
|
4
5
|
* `size` — высота, ширина следует нативному аспекту 24×18: `18` даёт бокс 24×18.
|
|
5
6
|
*/
|
|
6
|
-
export declare const FLAG_ICON_SIZE =
|
|
7
|
+
export declare const FLAG_ICON_SIZE = 18;
|
|
8
|
+
/**
|
|
9
|
+
* Флаг в кнопке страны — 24×18 на всех размерах (Product-макет fieldPhone). Кнопка-слот FieldCombo
|
|
10
|
+
* клампит иконки до 16 на size s, инлайн-стиль снимает кламп.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SELECTOR_FLAG_STYLE: CSSProperties;
|
|
7
13
|
/** Задержка перед возвратом фокуса в поле после выбора страны — ждём закрытия дроплиста (desktop). */
|
|
8
14
|
export declare const REFOCUS_AFTER_COUNTRY_DELAY_MS = 500;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REFOCUS_AFTER_COUNTRY_DELAY_MS = exports.FLAG_ICON_SIZE = exports.PLACEHOLDER_CHAR = void 0;
|
|
3
|
+
exports.REFOCUS_AFTER_COUNTRY_DELAY_MS = exports.SELECTOR_FLAG_STYLE = exports.FLAG_ICON_SIZE = exports.PLACEHOLDER_CHAR = void 0;
|
|
4
4
|
exports.PLACEHOLDER_CHAR = '_';
|
|
5
5
|
/**
|
|
6
6
|
* Размер иконки флага страны в селекторе и выпадающем списке. У флагов из `@cloud-ru/ds-icons/flags`
|
|
7
7
|
* `size` — высота, ширина следует нативному аспекту 24×18: `18` даёт бокс 24×18.
|
|
8
8
|
*/
|
|
9
|
-
exports.FLAG_ICON_SIZE =
|
|
9
|
+
exports.FLAG_ICON_SIZE = 18;
|
|
10
|
+
/**
|
|
11
|
+
* Флаг в кнопке страны — 24×18 на всех размерах (Product-макет fieldPhone). Кнопка-слот FieldCombo
|
|
12
|
+
* клампит иконки до 16 на size s, инлайн-стиль снимает кламп.
|
|
13
|
+
*/
|
|
14
|
+
exports.SELECTOR_FLAG_STYLE = { maxWidth: 'none', maxHeight: 'none' };
|
|
10
15
|
/** Задержка перед возвратом фокуса в поле после выбора страны — ждём закрытия дроплиста (desktop). */
|
|
11
16
|
exports.REFOCUS_AFTER_COUNTRY_DELAY_MS = 500;
|
|
@@ -60,7 +60,7 @@ exports.FieldSelectCreate = (0, react_1.forwardRef)(function FieldSelectCreate({
|
|
|
60
60
|
};
|
|
61
61
|
const formLayout = createLayoutType === constants_2.CREATE_LAYOUT_TYPE.Modal ? ((0, jsx_runtime_1.jsx)(modal_1.Modal, { ...layoutProps })) : ((0, jsx_runtime_1.jsx)(drawer_1.Drawer, { ...layoutProps, position: createLayoutProps.position ?? drawer_1.POSITION.Right }));
|
|
62
62
|
const withTip = (node, show) => show ? (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: noPermissionTip, children: node }) : node;
|
|
63
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.fieldSelectCreate, className), ...(0, utils_1.extractSupportProps)(rest), "data-test-id": constants_1.TEST_IDS.fieldSelectCreate, children: [withTip((0, jsx_runtime_1.jsx)(fields_1.FieldSelect, { ...selectProps, ref: ref, size: size, disabled: isNone || selectProps.disabled, placeholder: selectProps.placeholder ?? t('FieldSelectCreate.placeholder'), ...selectDataStates, footer:
|
|
63
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.fieldSelectCreate, className), ...(0, utils_1.extractSupportProps)(rest), "data-test-id": constants_1.TEST_IDS.fieldSelectCreate, children: [withTip((0, jsx_runtime_1.jsx)(fields_1.FieldSelect, { ...selectProps, ref: ref, size: size, disabled: isNone || selectProps.disabled, placeholder: selectProps.placeholder ?? t('FieldSelectCreate.placeholder'), ...selectDataStates, footerDivider: true, footer:
|
|
64
64
|
// В состоянии ошибки показываем только «Обновить» из errorDataState — без футера «Создать» (по макету).
|
|
65
|
-
selectProps.dataError ? undefined : ((0, jsx_runtime_1.jsx)(SelectFooter_1.SelectFooter, { onClick: onOpen, createButtonLabel: createButtonLabel, canCreate: canCreate })) }), isNone), withTip((0, jsx_runtime_1.jsx)(button_1.Button, { view: button_1.VIEW.Function, appearance: button_1.APPEARANCE.Neutral, label: createButtonLabel, icon: (0, jsx_runtime_1.jsx)(system_1.PlusSVG, {}), iconPosition: button_1.ICON_POSITION.Before, onClick: onOpen, size: size, disabled: !canCreate, className: styles_module_scss_1.default.createButton, "data-test-id": constants_1.TEST_IDS.fieldSelectCreateButton }), !canCreate), formLayout] }));
|
|
65
|
+
selectProps.dataError ? undefined : ((0, jsx_runtime_1.jsx)(SelectFooter_1.SelectFooter, { onClick: onOpen, createButtonLabel: createButtonLabel, canCreate: canCreate, size: size })) }), isNone), withTip((0, jsx_runtime_1.jsx)(button_1.Button, { view: button_1.VIEW.Function, appearance: button_1.APPEARANCE.Neutral, label: createButtonLabel, icon: (0, jsx_runtime_1.jsx)(system_1.PlusSVG, {}), iconPosition: button_1.ICON_POSITION.Before, onClick: onOpen, size: size, disabled: !canCreate, className: styles_module_scss_1.default.createButton, "data-test-id": constants_1.TEST_IDS.fieldSelectCreateButton }), !canCreate), formLayout] }));
|
|
66
66
|
});
|
package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Size } from '@cloud-ru/ds-button';
|
|
1
2
|
type SelectFooterProps = {
|
|
2
3
|
onClick(): void;
|
|
3
4
|
createButtonLabel: string;
|
|
4
5
|
canCreate: boolean;
|
|
6
|
+
size: Size;
|
|
5
7
|
};
|
|
6
8
|
/** Персистентный футер дроплиста с кнопкой «Создать» (недоступна и с tooltip при нехватке прав). */
|
|
7
|
-
export declare function SelectFooter({ onClick, createButtonLabel, canCreate }: SelectFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function SelectFooter({ onClick, createButtonLabel, canCreate, size }: SelectFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export {};
|
|
@@ -12,8 +12,8 @@ const constants_1 = require("../../../../constants");
|
|
|
12
12
|
const locale_1 = require("../../../../locale");
|
|
13
13
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
14
14
|
/** Персистентный футер дроплиста с кнопкой «Создать» (недоступна и с tooltip при нехватке прав). */
|
|
15
|
-
function SelectFooter({ onClick, createButtonLabel, canCreate }) {
|
|
15
|
+
function SelectFooter({ onClick, createButtonLabel, canCreate, size }) {
|
|
16
16
|
const { t } = locale_1.fieldsPredefinedLocale.useTranslations();
|
|
17
|
-
const button = ((0, jsx_runtime_1.jsx)(button_1.Button, { view: button_1.VIEW.Function, appearance: button_1.APPEARANCE.Neutral, label: createButtonLabel, icon: (0, jsx_runtime_1.jsx)(system_1.PlusSVG, {}), iconPosition: button_1.ICON_POSITION.Before, onClick: onClick, disabled: !canCreate, "data-test-id": constants_1.TEST_IDS.fieldSelectCreateFooterButton }));
|
|
17
|
+
const button = ((0, jsx_runtime_1.jsx)(button_1.Button, { view: button_1.VIEW.Function, appearance: button_1.APPEARANCE.Neutral, label: createButtonLabel, icon: (0, jsx_runtime_1.jsx)(system_1.PlusSVG, {}), iconPosition: button_1.ICON_POSITION.Before, onClick: onClick, size: size, disabled: !canCreate, "data-test-id": constants_1.TEST_IDS.fieldSelectCreateFooterButton }));
|
|
18
18
|
return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.footerWrapper, children: canCreate ? button : (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: t('FieldSelectCreate.noPermission'), children: button }) }));
|
|
19
19
|
}
|
package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/styles.module.css
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.footerWrapper{
|
|
2
2
|
display:flex;
|
|
3
3
|
align-items:center;
|
|
4
|
-
|
|
5
|
-
border-top:var(--sn-primitive-strokeWeight-strokeRegular, 1px) solid var(--sn-theme-color-available-borderColor, var(--sn-brand-color-state-neutralBorder-forLightMode-default-borderColor, rgba(159, 166, 198, 0.3019607843)));
|
|
4
|
+
box-sizing:border-box;
|
|
6
5
|
}
|
package/dist/cjs/style.css
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
.attachments{
|
|
6
6
|
display:flex;
|
|
7
7
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
8
|
-
|
|
8
|
+
box-sizing:border-box;
|
|
9
9
|
}
|
|
10
10
|
.attachments > *{
|
|
11
11
|
flex-shrink:0;
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
flex-direction:row;
|
|
19
19
|
align-items:center;
|
|
20
20
|
justify-content:space-between;
|
|
21
|
+
box-sizing:border-box;
|
|
21
22
|
width:100%;
|
|
22
|
-
padding
|
|
23
|
+
padding:var(--sn-primitive-dimension-8, 8px);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.actionsLeft{
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
flex-direction:row;
|
|
28
29
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
29
30
|
align-items:center;
|
|
31
|
+
box-sizing:border-box;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
.actionsRight{
|
|
@@ -35,19 +37,17 @@
|
|
|
35
37
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
36
38
|
align-items:center;
|
|
37
39
|
justify-content:flex-end;
|
|
40
|
+
box-sizing:border-box;
|
|
38
41
|
width:100%;
|
|
39
|
-
padding-right:var(--sn-primitive-dimension-8, 8px);
|
|
40
42
|
}
|
|
41
43
|
.fieldChat{
|
|
42
44
|
display:flex;
|
|
43
45
|
flex-direction:column;
|
|
44
|
-
gap:var(--sn-primitive-dimension-
|
|
46
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
47
|
+
box-sizing:border-box;
|
|
45
48
|
width:100%;
|
|
46
49
|
min-width:0;
|
|
47
50
|
}
|
|
48
|
-
.fieldChat[data-layout-type=mobile]{
|
|
49
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
50
|
-
}
|
|
51
51
|
|
|
52
52
|
.uploadTooltip{
|
|
53
53
|
display:flex;
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
flex-direction:column;
|
|
77
77
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
78
78
|
align-items:center;
|
|
79
|
+
box-sizing:border-box;
|
|
79
80
|
}
|
|
80
81
|
.fieldCode[data-stretch-cells]{
|
|
81
82
|
align-items:stretch;
|
|
@@ -92,29 +93,15 @@
|
|
|
92
93
|
|
|
93
94
|
.codeContainer{
|
|
94
95
|
display:flex;
|
|
96
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
95
97
|
justify-content:safe center;
|
|
96
98
|
}
|
|
97
99
|
.codeContainer[data-stretch-cells]{
|
|
98
100
|
width:100%;
|
|
99
101
|
}
|
|
100
|
-
.codeContainer[data-size=s]{
|
|
101
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
102
|
-
}
|
|
103
|
-
.codeContainer[data-size=m]{
|
|
104
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
105
|
-
}
|
|
106
|
-
.codeContainer[data-size=l]{
|
|
107
|
-
gap:var(--sn-primitive-dimension-12, 12px);
|
|
108
|
-
}
|
|
109
102
|
|
|
110
|
-
.cellSpacing
|
|
111
|
-
margin-right:var(--sn-primitive-dimension-
|
|
112
|
-
}
|
|
113
|
-
.cellSpacing[data-size=m]{
|
|
114
|
-
margin-right:var(--sn-primitive-dimension-8, 8px);
|
|
115
|
-
}
|
|
116
|
-
.cellSpacing[data-size=l]{
|
|
117
|
-
margin-right:var(--sn-primitive-dimension-12, 12px);
|
|
103
|
+
.cellSpacing{
|
|
104
|
+
margin-right:var(--sn-primitive-dimension-4, 4px);
|
|
118
105
|
}
|
|
119
106
|
.fieldPhone input[data-empty]{
|
|
120
107
|
color:var(--sn-theme-color-available-version-textDisabled, var(--sn-brand-color-text-version-disabled, rgba(65, 66, 78, 0.3490196078)));
|
|
@@ -122,13 +109,13 @@
|
|
|
122
109
|
.footerWrapper{
|
|
123
110
|
display:flex;
|
|
124
111
|
align-items:center;
|
|
125
|
-
|
|
126
|
-
border-top:var(--sn-primitive-strokeWeight-strokeRegular, 1px) solid var(--sn-theme-color-available-borderColor, var(--sn-brand-color-state-neutralBorder-forLightMode-default-borderColor, rgba(159, 166, 198, 0.3019607843)));
|
|
112
|
+
box-sizing:border-box;
|
|
127
113
|
}
|
|
128
114
|
.fieldSelectCreate{
|
|
129
115
|
display:flex;
|
|
130
116
|
flex-direction:column;
|
|
131
|
-
gap:var(--sn-primitive-dimension-
|
|
117
|
+
gap:var(--sn-primitive-dimension-4, 4px);
|
|
118
|
+
box-sizing:border-box;
|
|
132
119
|
}
|
|
133
120
|
|
|
134
121
|
.createButton{
|
|
@@ -40,5 +40,5 @@ export function FieldChat({ handleSubmit: handleSubmitProp, value, attachment, a
|
|
|
40
40
|
handleSubmit();
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
return (_jsxs("div", { className: styles.fieldChat,
|
|
43
|
+
return (_jsxs("div", { className: styles.fieldChat, children: [isMobile && _jsx(Attachments, { files: files, isMobile: isMobile }), _jsx(FieldTextArea, { ...props, autoFocus: autoFocus, value: value, size: 'm', minRows: 1, maxRows: 4, showCopyButton: false, placeholder: t('FieldChat.placeholder'), onKeyDown: handleKeyDown, footer: _jsx(TextAreaActionsFooter, { right: _jsxs(_Fragment, { children: [attachment && (_jsx(Tooltip, { tip: t('FieldChat.attachFileTooltip'), hoverDelayOpen: 600, open: isInactive ? false : undefined, triggerClassName: styles.uploadTooltip, children: _jsx(FileUpload, { mode: UPLOAD_MODE.Multiple, onFilesUpload: attachment.onFilesUpload, accept: attachment.accept, children: _jsx(Button, { view: VIEW.Function, appearance: APPEARANCE.Neutral, size: 's', icon: _jsx(AttachmentSVG, {}), disabled: isInactive, "data-test-id": TEST_IDS.fieldChatUpload }) }) })), _jsx(FieldSubmitButton, { active: isValueValid && !isInactive, handleClick: handleSubmit, "data-test-id": TEST_IDS.fieldChatSubmit })] }) }) }), !isMobile && _jsx(Attachments, { files: files })] }));
|
|
44
44
|
}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
flex-direction:row;
|
|
4
4
|
align-items:center;
|
|
5
5
|
justify-content:space-between;
|
|
6
|
+
box-sizing:border-box;
|
|
6
7
|
width:100%;
|
|
7
|
-
padding
|
|
8
|
+
padding:var(--sn-primitive-dimension-8, 8px);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.actionsLeft{
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
flex-direction:row;
|
|
13
14
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
14
15
|
align-items:center;
|
|
16
|
+
box-sizing:border-box;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
.actionsRight{
|
|
@@ -20,6 +22,6 @@
|
|
|
20
22
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
21
23
|
align-items:center;
|
|
22
24
|
justify-content:flex-end;
|
|
25
|
+
box-sizing:border-box;
|
|
23
26
|
width:100%;
|
|
24
|
-
padding-right:var(--sn-primitive-dimension-8, 8px);
|
|
25
27
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
.fieldChat{
|
|
2
2
|
display:flex;
|
|
3
3
|
flex-direction:column;
|
|
4
|
-
gap:var(--sn-primitive-dimension-
|
|
4
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
5
|
+
box-sizing:border-box;
|
|
5
6
|
width:100%;
|
|
6
7
|
min-width:0;
|
|
7
8
|
}
|
|
8
|
-
.fieldChat[data-layout-type=mobile]{
|
|
9
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
10
|
-
}
|
|
11
9
|
|
|
12
10
|
.uploadTooltip{
|
|
13
11
|
display:flex;
|
|
@@ -28,7 +28,7 @@ export const FieldCode = forwardRef(function FieldCode(props, ref) {
|
|
|
28
28
|
resetCode,
|
|
29
29
|
}), [moveFocus, blurFields, resetCode]);
|
|
30
30
|
const resolvedError = error ?? invalidCode;
|
|
31
|
-
return (_jsxs("div", { ref: rootRef, className: cn(styles.fieldCode, hasOverflow && styles.fieldCodeScrollable, className), "data-size": size, "data-disabled": disabled || undefined, "data-stretch-cells": stretchCells || undefined, ...(dataTestId ? { 'data-test-id': dataTestId } : undefined), children: [_jsx(FieldDecorator, { className: cn(!hasOverflow && styles.fieldDecorator), label: label, disabled: disabled, size: size, error: resolvedError, children: _jsx("div", { ref: codeContainerRef, className: styles.codeContainer, "data-
|
|
31
|
+
return (_jsxs("div", { ref: rootRef, className: cn(styles.fieldCode, hasOverflow && styles.fieldCodeScrollable, className), "data-size": size, "data-disabled": disabled || undefined, "data-stretch-cells": stretchCells || undefined, ...(dataTestId ? { 'data-test-id': dataTestId } : undefined), children: [_jsx(FieldDecorator, { className: cn(!hasOverflow && styles.fieldDecorator), label: label, disabled: disabled, size: size, error: resolvedError, children: _jsx("div", { ref: codeContainerRef, className: styles.codeContainer, "data-stretch-cells": stretchCells || undefined, children: code.map((char, index) => (_jsx(Cell, { ref: inputRef => {
|
|
32
32
|
if (inputRef) {
|
|
33
33
|
inputsRef.current[index] = inputRef;
|
|
34
34
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
flex-direction:column;
|
|
4
4
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
5
5
|
align-items:center;
|
|
6
|
+
box-sizing:border-box;
|
|
6
7
|
}
|
|
7
8
|
.fieldCode[data-stretch-cells]{
|
|
8
9
|
align-items:stretch;
|
|
@@ -19,27 +20,13 @@
|
|
|
19
20
|
|
|
20
21
|
.codeContainer{
|
|
21
22
|
display:flex;
|
|
23
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
22
24
|
justify-content:safe center;
|
|
23
25
|
}
|
|
24
26
|
.codeContainer[data-stretch-cells]{
|
|
25
27
|
width:100%;
|
|
26
28
|
}
|
|
27
|
-
.codeContainer[data-size=s]{
|
|
28
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
29
|
-
}
|
|
30
|
-
.codeContainer[data-size=m]{
|
|
31
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
32
|
-
}
|
|
33
|
-
.codeContainer[data-size=l]{
|
|
34
|
-
gap:var(--sn-primitive-dimension-12, 12px);
|
|
35
|
-
}
|
|
36
29
|
|
|
37
|
-
.cellSpacing
|
|
38
|
-
margin-right:var(--sn-primitive-dimension-
|
|
39
|
-
}
|
|
40
|
-
.cellSpacing[data-size=m]{
|
|
41
|
-
margin-right:var(--sn-primitive-dimension-8, 8px);
|
|
42
|
-
}
|
|
43
|
-
.cellSpacing[data-size=l]{
|
|
44
|
-
margin-right:var(--sn-primitive-dimension-12, 12px);
|
|
30
|
+
.cellSpacing{
|
|
31
|
+
margin-right:var(--sn-primitive-dimension-4, 4px);
|
|
45
32
|
}
|
|
@@ -4,10 +4,10 @@ import { FieldCombo } from '@cloud-ru/ds-fields';
|
|
|
4
4
|
import { useValueControl } from '@cloud-ru/ds-utils';
|
|
5
5
|
import cn from 'classnames';
|
|
6
6
|
import mergeRefs from 'merge-refs';
|
|
7
|
-
import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { cloneElement, forwardRef, isValidElement, useEffect, useMemo, useRef, useState, } from 'react';
|
|
8
8
|
import { useIMask } from 'react-imask';
|
|
9
9
|
import { TEST_IDS } from '../../constants.js';
|
|
10
|
-
import { PLACEHOLDER_CHAR, REFOCUS_AFTER_COUNTRY_DELAY_MS } from './constants.js';
|
|
10
|
+
import { PLACEHOLDER_CHAR, REFOCUS_AFTER_COUNTRY_DELAY_MS, SELECTOR_FLAG_STYLE } from './constants.js';
|
|
11
11
|
import { useCountries } from './hooks/index.js';
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
13
|
import { detectCountryByPhone, handleAutoInsert } from './utils.js';
|
|
@@ -138,10 +138,13 @@ export const FieldPhone = forwardRef(function FieldPhone({ value: valueProp, onC
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
const showClear = showClearButton && Boolean(unmaskedValue);
|
|
141
|
+
const selectorFlag = isValidElement(country?.beforeContent)
|
|
142
|
+
? cloneElement(country.beforeContent, { style: SELECTOR_FLAG_STYLE })
|
|
143
|
+
: country?.beforeContent;
|
|
141
144
|
return (_jsx(FieldCombo, { ...rest, inputMode: 'tel', type: 'tel', ref: mergeRefs(ref, localRef, iMaskRef), className: cn(className, styles.fieldPhone), "data-empty": !unmaskedValue || undefined, autoFocus: autoFocus, value: iMaskValue, onChange: handleChange, onPaste: handlePaste, showClearButton: showClear, prefix: country?.content.caption, elementBefore: isOnlyOneCountryAvailable
|
|
142
145
|
? undefined
|
|
143
146
|
: {
|
|
144
|
-
action:
|
|
147
|
+
action: selectorFlag,
|
|
145
148
|
'data-test-id': TEST_IDS.fieldPhoneCountrySelect,
|
|
146
149
|
droplist: {
|
|
147
150
|
items,
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
1
2
|
export declare const PLACEHOLDER_CHAR = "_";
|
|
2
3
|
/**
|
|
3
4
|
* Размер иконки флага страны в селекторе и выпадающем списке. У флагов из `@cloud-ru/ds-icons/flags`
|
|
4
5
|
* `size` — высота, ширина следует нативному аспекту 24×18: `18` даёт бокс 24×18.
|
|
5
6
|
*/
|
|
6
|
-
export declare const FLAG_ICON_SIZE =
|
|
7
|
+
export declare const FLAG_ICON_SIZE = 18;
|
|
8
|
+
/**
|
|
9
|
+
* Флаг в кнопке страны — 24×18 на всех размерах (Product-макет fieldPhone). Кнопка-слот FieldCombo
|
|
10
|
+
* клампит иконки до 16 на size s, инлайн-стиль снимает кламп.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SELECTOR_FLAG_STYLE: CSSProperties;
|
|
7
13
|
/** Задержка перед возвратом фокуса в поле после выбора страны — ждём закрытия дроплиста (desktop). */
|
|
8
14
|
export declare const REFOCUS_AFTER_COUNTRY_DELAY_MS = 500;
|
|
@@ -3,6 +3,11 @@ export const PLACEHOLDER_CHAR = '_';
|
|
|
3
3
|
* Размер иконки флага страны в селекторе и выпадающем списке. У флагов из `@cloud-ru/ds-icons/flags`
|
|
4
4
|
* `size` — высота, ширина следует нативному аспекту 24×18: `18` даёт бокс 24×18.
|
|
5
5
|
*/
|
|
6
|
-
export const FLAG_ICON_SIZE =
|
|
6
|
+
export const FLAG_ICON_SIZE = 18;
|
|
7
|
+
/**
|
|
8
|
+
* Флаг в кнопке страны — 24×18 на всех размерах (Product-макет fieldPhone). Кнопка-слот FieldCombo
|
|
9
|
+
* клампит иконки до 16 на size s, инлайн-стиль снимает кламп.
|
|
10
|
+
*/
|
|
11
|
+
export const SELECTOR_FLAG_STYLE = { maxWidth: 'none', maxHeight: 'none' };
|
|
7
12
|
/** Задержка перед возвратом фокуса в поле после выбора страны — ждём закрытия дроплиста (desktop). */
|
|
8
13
|
export const REFOCUS_AFTER_COUNTRY_DELAY_MS = 500;
|
|
@@ -54,7 +54,7 @@ export const FieldSelectCreate = forwardRef(function FieldSelectCreate({ selectP
|
|
|
54
54
|
};
|
|
55
55
|
const formLayout = createLayoutType === CREATE_LAYOUT_TYPE.Modal ? (_jsx(Modal, { ...layoutProps })) : (_jsx(Drawer, { ...layoutProps, position: createLayoutProps.position ?? POSITION.Right }));
|
|
56
56
|
const withTip = (node, show) => show ? _jsx(Tooltip, { tip: noPermissionTip, children: node }) : node;
|
|
57
|
-
return (_jsxs("div", { className: cn(styles.fieldSelectCreate, className), ...extractSupportProps(rest), "data-test-id": TEST_IDS.fieldSelectCreate, children: [withTip(_jsx(FieldSelect, { ...selectProps, ref: ref, size: size, disabled: isNone || selectProps.disabled, placeholder: selectProps.placeholder ?? t('FieldSelectCreate.placeholder'), ...selectDataStates, footer:
|
|
57
|
+
return (_jsxs("div", { className: cn(styles.fieldSelectCreate, className), ...extractSupportProps(rest), "data-test-id": TEST_IDS.fieldSelectCreate, children: [withTip(_jsx(FieldSelect, { ...selectProps, ref: ref, size: size, disabled: isNone || selectProps.disabled, placeholder: selectProps.placeholder ?? t('FieldSelectCreate.placeholder'), ...selectDataStates, footerDivider: true, footer:
|
|
58
58
|
// В состоянии ошибки показываем только «Обновить» из errorDataState — без футера «Создать» (по макету).
|
|
59
|
-
selectProps.dataError ? undefined : (_jsx(SelectFooter, { onClick: onOpen, createButtonLabel: createButtonLabel, canCreate: canCreate })) }), isNone), withTip(_jsx(Button, { view: VIEW.Function, appearance: APPEARANCE.Neutral, label: createButtonLabel, icon: _jsx(PlusSVG, {}), iconPosition: ICON_POSITION.Before, onClick: onOpen, size: size, disabled: !canCreate, className: styles.createButton, "data-test-id": TEST_IDS.fieldSelectCreateButton }), !canCreate), formLayout] }));
|
|
59
|
+
selectProps.dataError ? undefined : (_jsx(SelectFooter, { onClick: onOpen, createButtonLabel: createButtonLabel, canCreate: canCreate, size: size })) }), isNone), withTip(_jsx(Button, { view: VIEW.Function, appearance: APPEARANCE.Neutral, label: createButtonLabel, icon: _jsx(PlusSVG, {}), iconPosition: ICON_POSITION.Before, onClick: onOpen, size: size, disabled: !canCreate, className: styles.createButton, "data-test-id": TEST_IDS.fieldSelectCreateButton }), !canCreate), formLayout] }));
|
|
60
60
|
});
|
package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Size } from '@cloud-ru/ds-button';
|
|
1
2
|
type SelectFooterProps = {
|
|
2
3
|
onClick(): void;
|
|
3
4
|
createButtonLabel: string;
|
|
4
5
|
canCreate: boolean;
|
|
6
|
+
size: Size;
|
|
5
7
|
};
|
|
6
8
|
/** Персистентный футер дроплиста с кнопкой «Создать» (недоступна и с tooltip при нехватке прав). */
|
|
7
|
-
export declare function SelectFooter({ onClick, createButtonLabel, canCreate }: SelectFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function SelectFooter({ onClick, createButtonLabel, canCreate, size }: SelectFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export {};
|
|
@@ -6,8 +6,8 @@ import { TEST_IDS } from '../../../../constants.js';
|
|
|
6
6
|
import { fieldsPredefinedLocale } from '../../../../locale/index.js';
|
|
7
7
|
import styles from './styles.module.css';
|
|
8
8
|
/** Персистентный футер дроплиста с кнопкой «Создать» (недоступна и с tooltip при нехватке прав). */
|
|
9
|
-
export function SelectFooter({ onClick, createButtonLabel, canCreate }) {
|
|
9
|
+
export function SelectFooter({ onClick, createButtonLabel, canCreate, size }) {
|
|
10
10
|
const { t } = fieldsPredefinedLocale.useTranslations();
|
|
11
|
-
const button = (_jsx(Button, { view: VIEW.Function, appearance: APPEARANCE.Neutral, label: createButtonLabel, icon: _jsx(PlusSVG, {}), iconPosition: ICON_POSITION.Before, onClick: onClick, disabled: !canCreate, "data-test-id": TEST_IDS.fieldSelectCreateFooterButton }));
|
|
11
|
+
const button = (_jsx(Button, { view: VIEW.Function, appearance: APPEARANCE.Neutral, label: createButtonLabel, icon: _jsx(PlusSVG, {}), iconPosition: ICON_POSITION.Before, onClick: onClick, size: size, disabled: !canCreate, "data-test-id": TEST_IDS.fieldSelectCreateFooterButton }));
|
|
12
12
|
return (_jsx("div", { className: styles.footerWrapper, children: canCreate ? button : _jsx(Tooltip, { tip: t('FieldSelectCreate.noPermission'), children: button }) }));
|
|
13
13
|
}
|
package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/styles.module.css
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.footerWrapper{
|
|
2
2
|
display:flex;
|
|
3
3
|
align-items:center;
|
|
4
|
-
|
|
5
|
-
border-top:var(--sn-primitive-strokeWeight-strokeRegular, 1px) solid var(--sn-theme-color-available-borderColor, var(--sn-brand-color-state-neutralBorder-forLightMode-default-borderColor, rgba(159, 166, 198, 0.3019607843)));
|
|
4
|
+
box-sizing:border-box;
|
|
6
5
|
}
|