@cloud-ru/ds-uikit-product-fields-predefined 2.0.16-preview-d50a3da1.0 → 2.0.16-preview-d90ac2be.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 +2 -4
- package/dist/cjs/components/FieldChat/styles.module.css +4 -2
- package/dist/cjs/components/FieldCode/FieldCode.js +1 -1
- package/dist/cjs/components/FieldCode/styles.module.css +17 -4
- package/dist/cjs/components/FieldPhone/FieldPhone.js +1 -4
- package/dist/cjs/components/FieldPhone/constants.d.ts +1 -7
- package/dist/cjs/components/FieldPhone/constants.js +2 -7
- package/dist/cjs/components/FieldSelectCreate/FieldSelectCreate.js +2 -2
- package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.d.ts +1 -3
- package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.js +2 -2
- package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/styles.module.css +2 -1
- package/dist/cjs/components/FieldSelectCreate/styles.module.css +1 -2
- package/dist/cjs/style.css +27 -14
- 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 +2 -4
- package/dist/esm/components/FieldChat/styles.module.css +4 -2
- package/dist/esm/components/FieldCode/FieldCode.js +1 -1
- package/dist/esm/components/FieldCode/styles.module.css +17 -4
- package/dist/esm/components/FieldPhone/FieldPhone.js +3 -6
- package/dist/esm/components/FieldPhone/constants.d.ts +1 -7
- package/dist/esm/components/FieldPhone/constants.js +1 -6
- package/dist/esm/components/FieldSelectCreate/FieldSelectCreate.js +2 -2
- package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.d.ts +1 -3
- package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.js +2 -2
- package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/styles.module.css +2 -1
- package/dist/esm/components/FieldSelectCreate/styles.module.css +1 -2
- package/dist/esm/style.css +27 -14
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +13 -13
- 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 +2 -5
- package/src/components/FieldChat/styles.module.scss +5 -3
- package/src/components/FieldCode/FieldCode.tsx +6 -1
- package/src/components/FieldCode/styles.module.scss +17 -5
- package/src/components/FieldPhone/FieldPhone.tsx +3 -16
- package/src/components/FieldPhone/constants.ts +1 -9
- package/src/components/FieldSelectCreate/FieldSelectCreate.tsx +1 -2
- package/src/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.tsx +2 -4
- package/src/components/FieldSelectCreate/helperComponents/SelectFooter/styles.module.scss +4 -2
- package/src/components/FieldSelectCreate/styles.module.scss +1 -2
|
@@ -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, 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 })] }));
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.fieldChat, "data-layout-type": layoutType, 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,9 +3,8 @@
|
|
|
3
3
|
flex-direction:row;
|
|
4
4
|
align-items:center;
|
|
5
5
|
justify-content:space-between;
|
|
6
|
-
box-sizing:border-box;
|
|
7
6
|
width:100%;
|
|
8
|
-
padding:var(--sn-primitive-dimension-8, 8px);
|
|
7
|
+
padding-bottom:var(--sn-primitive-dimension-8, 8px);
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
.actionsLeft{
|
|
@@ -13,7 +12,6 @@
|
|
|
13
12
|
flex-direction:row;
|
|
14
13
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
15
14
|
align-items:center;
|
|
16
|
-
box-sizing:border-box;
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
.actionsRight{
|
|
@@ -22,6 +20,6 @@
|
|
|
22
20
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
23
21
|
align-items:center;
|
|
24
22
|
justify-content:flex-end;
|
|
25
|
-
box-sizing:border-box;
|
|
26
23
|
width:100%;
|
|
24
|
+
padding-right:var(--sn-primitive-dimension-8, 8px);
|
|
27
25
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
.fieldChat{
|
|
2
2
|
display:flex;
|
|
3
3
|
flex-direction:column;
|
|
4
|
-
gap:var(--sn-primitive-dimension-
|
|
5
|
-
box-sizing:border-box;
|
|
4
|
+
gap:var(--sn-primitive-dimension-12, 12px);
|
|
6
5
|
width:100%;
|
|
7
6
|
min-width:0;
|
|
8
7
|
}
|
|
8
|
+
.fieldChat[data-layout-type=mobile]{
|
|
9
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
10
|
+
}
|
|
9
11
|
|
|
10
12
|
.uploadTooltip{
|
|
11
13
|
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-stretch-cells": stretchCells || undefined, children: code.map((char, index) => ((0, jsx_runtime_1.jsx)(components_1.Cell, { ref: inputRef => {
|
|
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-size": size, "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,7 +3,6 @@
|
|
|
3
3
|
flex-direction:column;
|
|
4
4
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
5
5
|
align-items:center;
|
|
6
|
-
box-sizing:border-box;
|
|
7
6
|
}
|
|
8
7
|
.fieldCode[data-stretch-cells]{
|
|
9
8
|
align-items:stretch;
|
|
@@ -20,13 +19,27 @@
|
|
|
20
19
|
|
|
21
20
|
.codeContainer{
|
|
22
21
|
display:flex;
|
|
23
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
24
22
|
justify-content:safe center;
|
|
25
23
|
}
|
|
26
24
|
.codeContainer[data-stretch-cells]{
|
|
27
25
|
width:100%;
|
|
28
26
|
}
|
|
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
|
+
}
|
|
29
36
|
|
|
30
|
-
.cellSpacing{
|
|
31
|
-
margin-right:var(--sn-primitive-dimension-
|
|
37
|
+
.cellSpacing[data-size=s]{
|
|
38
|
+
margin-right:var(--sn-primitive-dimension-8, 8px);
|
|
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);
|
|
32
45
|
}
|
|
@@ -144,13 +144,10 @@ 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;
|
|
150
147
|
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
|
|
151
148
|
? undefined
|
|
152
149
|
: {
|
|
153
|
-
action:
|
|
150
|
+
action: country?.beforeContent,
|
|
154
151
|
'data-test-id': constants_1.TEST_IDS.fieldPhoneCountrySelect,
|
|
155
152
|
droplist: {
|
|
156
153
|
items,
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
1
|
export declare const PLACEHOLDER_CHAR = "_";
|
|
3
2
|
/**
|
|
4
3
|
* Размер иконки флага страны в селекторе и выпадающем списке. У флагов из `@cloud-ru/ds-icons/flags`
|
|
5
4
|
* `size` — высота, ширина следует нативному аспекту 24×18: `18` даёт бокс 24×18.
|
|
6
5
|
*/
|
|
7
|
-
export declare const FLAG_ICON_SIZE =
|
|
8
|
-
/**
|
|
9
|
-
* Флаг в кнопке страны — 24×18 на всех размерах (Product-макет fieldPhone). Кнопка-слот FieldCombo
|
|
10
|
-
* клампит иконки до 16 на size s, инлайн-стиль снимает кламп.
|
|
11
|
-
*/
|
|
12
|
-
export declare const SELECTOR_FLAG_STYLE: CSSProperties;
|
|
6
|
+
export declare const FLAG_ICON_SIZE = 24;
|
|
13
7
|
/** Задержка перед возвратом фокуса в поле после выбора страны — ждём закрытия дроплиста (desktop). */
|
|
14
8
|
export declare const REFOCUS_AFTER_COUNTRY_DELAY_MS = 500;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REFOCUS_AFTER_COUNTRY_DELAY_MS = exports.
|
|
3
|
+
exports.REFOCUS_AFTER_COUNTRY_DELAY_MS = 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 =
|
|
10
|
-
/**
|
|
11
|
-
* Флаг в кнопке страны — 24×18 на всех размерах (Product-макет fieldPhone). Кнопка-слот FieldCombo
|
|
12
|
-
* клампит иконки до 16 на size s, инлайн-стиль снимает кламп.
|
|
13
|
-
*/
|
|
14
|
-
exports.SELECTOR_FLAG_STYLE = { maxWidth: 'none', maxHeight: 'none' };
|
|
9
|
+
exports.FLAG_ICON_SIZE = 24;
|
|
15
10
|
/** Задержка перед возвратом фокуса в поле после выбора страны — ждём закрытия дроплиста (desktop). */
|
|
16
11
|
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,
|
|
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:
|
|
64
64
|
// В состоянии ошибки показываем только «Обновить» из errorDataState — без футера «Создать» (по макету).
|
|
65
|
-
selectProps.dataError ? undefined : ((0, jsx_runtime_1.jsx)(SelectFooter_1.SelectFooter, { onClick: onOpen, createButtonLabel: createButtonLabel, canCreate: canCreate
|
|
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] }));
|
|
66
66
|
});
|
package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { Size } from '@cloud-ru/ds-button';
|
|
2
1
|
type SelectFooterProps = {
|
|
3
2
|
onClick(): void;
|
|
4
3
|
createButtonLabel: string;
|
|
5
4
|
canCreate: boolean;
|
|
6
|
-
size: Size;
|
|
7
5
|
};
|
|
8
6
|
/** Персистентный футер дроплиста с кнопкой «Создать» (недоступна и с tooltip при нехватке прав). */
|
|
9
|
-
export declare function SelectFooter({ onClick, createButtonLabel, canCreate
|
|
7
|
+
export declare function SelectFooter({ onClick, createButtonLabel, canCreate }: SelectFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
10
8
|
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 }) {
|
|
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,
|
|
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 }));
|
|
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,5 +1,6 @@
|
|
|
1
1
|
.footerWrapper{
|
|
2
2
|
display:flex;
|
|
3
3
|
align-items:center;
|
|
4
|
-
|
|
4
|
+
padding-top:var(--sn-primitive-dimension-4, 4px);
|
|
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)));
|
|
5
6
|
}
|
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
|
+
padding:var(--sn-primitive-dimension-1, 1px) 0;
|
|
9
9
|
}
|
|
10
10
|
.attachments > *{
|
|
11
11
|
flex-shrink:0;
|
|
@@ -18,9 +18,8 @@
|
|
|
18
18
|
flex-direction:row;
|
|
19
19
|
align-items:center;
|
|
20
20
|
justify-content:space-between;
|
|
21
|
-
box-sizing:border-box;
|
|
22
21
|
width:100%;
|
|
23
|
-
padding:var(--sn-primitive-dimension-8, 8px);
|
|
22
|
+
padding-bottom:var(--sn-primitive-dimension-8, 8px);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
.actionsLeft{
|
|
@@ -28,7 +27,6 @@
|
|
|
28
27
|
flex-direction:row;
|
|
29
28
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
30
29
|
align-items:center;
|
|
31
|
-
box-sizing:border-box;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
.actionsRight{
|
|
@@ -37,17 +35,19 @@
|
|
|
37
35
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
38
36
|
align-items:center;
|
|
39
37
|
justify-content:flex-end;
|
|
40
|
-
box-sizing:border-box;
|
|
41
38
|
width:100%;
|
|
39
|
+
padding-right:var(--sn-primitive-dimension-8, 8px);
|
|
42
40
|
}
|
|
43
41
|
.fieldChat{
|
|
44
42
|
display:flex;
|
|
45
43
|
flex-direction:column;
|
|
46
|
-
gap:var(--sn-primitive-dimension-
|
|
47
|
-
box-sizing:border-box;
|
|
44
|
+
gap:var(--sn-primitive-dimension-12, 12px);
|
|
48
45
|
width:100%;
|
|
49
46
|
min-width:0;
|
|
50
47
|
}
|
|
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,7 +76,6 @@
|
|
|
76
76
|
flex-direction:column;
|
|
77
77
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
78
78
|
align-items:center;
|
|
79
|
-
box-sizing:border-box;
|
|
80
79
|
}
|
|
81
80
|
.fieldCode[data-stretch-cells]{
|
|
82
81
|
align-items:stretch;
|
|
@@ -93,15 +92,29 @@
|
|
|
93
92
|
|
|
94
93
|
.codeContainer{
|
|
95
94
|
display:flex;
|
|
96
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
97
95
|
justify-content:safe center;
|
|
98
96
|
}
|
|
99
97
|
.codeContainer[data-stretch-cells]{
|
|
100
98
|
width:100%;
|
|
101
99
|
}
|
|
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
|
+
}
|
|
102
109
|
|
|
103
|
-
.cellSpacing{
|
|
104
|
-
margin-right:var(--sn-primitive-dimension-
|
|
110
|
+
.cellSpacing[data-size=s]{
|
|
111
|
+
margin-right:var(--sn-primitive-dimension-8, 8px);
|
|
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);
|
|
105
118
|
}
|
|
106
119
|
.fieldPhone input[data-empty]{
|
|
107
120
|
color:var(--sn-theme-color-available-version-textDisabled, var(--sn-brand-color-text-version-disabled, rgba(65, 66, 78, 0.3490196078)));
|
|
@@ -109,13 +122,13 @@
|
|
|
109
122
|
.footerWrapper{
|
|
110
123
|
display:flex;
|
|
111
124
|
align-items:center;
|
|
112
|
-
|
|
125
|
+
padding-top:var(--sn-primitive-dimension-4, 4px);
|
|
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)));
|
|
113
127
|
}
|
|
114
128
|
.fieldSelectCreate{
|
|
115
129
|
display:flex;
|
|
116
130
|
flex-direction:column;
|
|
117
|
-
gap:var(--sn-primitive-dimension-
|
|
118
|
-
box-sizing:border-box;
|
|
131
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
119
132
|
}
|
|
120
133
|
|
|
121
134
|
.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, 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 })] }));
|
|
43
|
+
return (_jsxs("div", { className: styles.fieldChat, "data-layout-type": layoutType, 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,9 +3,8 @@
|
|
|
3
3
|
flex-direction:row;
|
|
4
4
|
align-items:center;
|
|
5
5
|
justify-content:space-between;
|
|
6
|
-
box-sizing:border-box;
|
|
7
6
|
width:100%;
|
|
8
|
-
padding:var(--sn-primitive-dimension-8, 8px);
|
|
7
|
+
padding-bottom:var(--sn-primitive-dimension-8, 8px);
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
.actionsLeft{
|
|
@@ -13,7 +12,6 @@
|
|
|
13
12
|
flex-direction:row;
|
|
14
13
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
15
14
|
align-items:center;
|
|
16
|
-
box-sizing:border-box;
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
.actionsRight{
|
|
@@ -22,6 +20,6 @@
|
|
|
22
20
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
23
21
|
align-items:center;
|
|
24
22
|
justify-content:flex-end;
|
|
25
|
-
box-sizing:border-box;
|
|
26
23
|
width:100%;
|
|
24
|
+
padding-right:var(--sn-primitive-dimension-8, 8px);
|
|
27
25
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
.fieldChat{
|
|
2
2
|
display:flex;
|
|
3
3
|
flex-direction:column;
|
|
4
|
-
gap:var(--sn-primitive-dimension-
|
|
5
|
-
box-sizing:border-box;
|
|
4
|
+
gap:var(--sn-primitive-dimension-12, 12px);
|
|
6
5
|
width:100%;
|
|
7
6
|
min-width:0;
|
|
8
7
|
}
|
|
8
|
+
.fieldChat[data-layout-type=mobile]{
|
|
9
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
10
|
+
}
|
|
9
11
|
|
|
10
12
|
.uploadTooltip{
|
|
11
13
|
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-stretch-cells": stretchCells || undefined, children: code.map((char, index) => (_jsx(Cell, { ref: inputRef => {
|
|
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-size": size, "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,7 +3,6 @@
|
|
|
3
3
|
flex-direction:column;
|
|
4
4
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
5
5
|
align-items:center;
|
|
6
|
-
box-sizing:border-box;
|
|
7
6
|
}
|
|
8
7
|
.fieldCode[data-stretch-cells]{
|
|
9
8
|
align-items:stretch;
|
|
@@ -20,13 +19,27 @@
|
|
|
20
19
|
|
|
21
20
|
.codeContainer{
|
|
22
21
|
display:flex;
|
|
23
|
-
gap:var(--sn-primitive-dimension-8, 8px);
|
|
24
22
|
justify-content:safe center;
|
|
25
23
|
}
|
|
26
24
|
.codeContainer[data-stretch-cells]{
|
|
27
25
|
width:100%;
|
|
28
26
|
}
|
|
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
|
+
}
|
|
29
36
|
|
|
30
|
-
.cellSpacing{
|
|
31
|
-
margin-right:var(--sn-primitive-dimension-
|
|
37
|
+
.cellSpacing[data-size=s]{
|
|
38
|
+
margin-right:var(--sn-primitive-dimension-8, 8px);
|
|
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);
|
|
32
45
|
}
|
|
@@ -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 {
|
|
7
|
+
import { forwardRef, 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
|
|
10
|
+
import { PLACEHOLDER_CHAR, REFOCUS_AFTER_COUNTRY_DELAY_MS } 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,13 +138,10 @@ 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;
|
|
144
141
|
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
|
|
145
142
|
? undefined
|
|
146
143
|
: {
|
|
147
|
-
action:
|
|
144
|
+
action: country?.beforeContent,
|
|
148
145
|
'data-test-id': TEST_IDS.fieldPhoneCountrySelect,
|
|
149
146
|
droplist: {
|
|
150
147
|
items,
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
1
|
export declare const PLACEHOLDER_CHAR = "_";
|
|
3
2
|
/**
|
|
4
3
|
* Размер иконки флага страны в селекторе и выпадающем списке. У флагов из `@cloud-ru/ds-icons/flags`
|
|
5
4
|
* `size` — высота, ширина следует нативному аспекту 24×18: `18` даёт бокс 24×18.
|
|
6
5
|
*/
|
|
7
|
-
export declare const FLAG_ICON_SIZE =
|
|
8
|
-
/**
|
|
9
|
-
* Флаг в кнопке страны — 24×18 на всех размерах (Product-макет fieldPhone). Кнопка-слот FieldCombo
|
|
10
|
-
* клампит иконки до 16 на size s, инлайн-стиль снимает кламп.
|
|
11
|
-
*/
|
|
12
|
-
export declare const SELECTOR_FLAG_STYLE: CSSProperties;
|
|
6
|
+
export declare const FLAG_ICON_SIZE = 24;
|
|
13
7
|
/** Задержка перед возвратом фокуса в поле после выбора страны — ждём закрытия дроплиста (desktop). */
|
|
14
8
|
export declare const REFOCUS_AFTER_COUNTRY_DELAY_MS = 500;
|
|
@@ -3,11 +3,6 @@ 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 =
|
|
7
|
-
/**
|
|
8
|
-
* Флаг в кнопке страны — 24×18 на всех размерах (Product-макет fieldPhone). Кнопка-слот FieldCombo
|
|
9
|
-
* клампит иконки до 16 на size s, инлайн-стиль снимает кламп.
|
|
10
|
-
*/
|
|
11
|
-
export const SELECTOR_FLAG_STYLE = { maxWidth: 'none', maxHeight: 'none' };
|
|
6
|
+
export const FLAG_ICON_SIZE = 24;
|
|
12
7
|
/** Задержка перед возвратом фокуса в поле после выбора страны — ждём закрытия дроплиста (desktop). */
|
|
13
8
|
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,
|
|
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:
|
|
58
58
|
// В состоянии ошибки показываем только «Обновить» из errorDataState — без футера «Создать» (по макету).
|
|
59
|
-
selectProps.dataError ? undefined : (_jsx(SelectFooter, { onClick: onOpen, createButtonLabel: createButtonLabel, canCreate: canCreate
|
|
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] }));
|
|
60
60
|
});
|
package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { Size } from '@cloud-ru/ds-button';
|
|
2
1
|
type SelectFooterProps = {
|
|
3
2
|
onClick(): void;
|
|
4
3
|
createButtonLabel: string;
|
|
5
4
|
canCreate: boolean;
|
|
6
|
-
size: Size;
|
|
7
5
|
};
|
|
8
6
|
/** Персистентный футер дроплиста с кнопкой «Создать» (недоступна и с tooltip при нехватке прав). */
|
|
9
|
-
export declare function SelectFooter({ onClick, createButtonLabel, canCreate
|
|
7
|
+
export declare function SelectFooter({ onClick, createButtonLabel, canCreate }: SelectFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
10
8
|
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 }) {
|
|
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,
|
|
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 }));
|
|
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,5 +1,6 @@
|
|
|
1
1
|
.footerWrapper{
|
|
2
2
|
display:flex;
|
|
3
3
|
align-items:center;
|
|
4
|
-
|
|
4
|
+
padding-top:var(--sn-primitive-dimension-4, 4px);
|
|
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)));
|
|
5
6
|
}
|