@cloud-ru/ds-uikit-product-fields-predefined 4.2.3-preview-2df639a4.0 → 4.2.3-preview-87a0f601.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.
Files changed (35) hide show
  1. package/README.md +16 -16
  2. package/dist/cjs/components/FieldChat/FieldChat.js +1 -2
  3. package/dist/cjs/components/FieldChat/components/Attachments/Attachments.js +1 -2
  4. package/dist/cjs/components/FieldChat/components/FieldSubmitButton/FieldSubmitButton.d.ts +4 -3
  5. package/dist/cjs/components/FieldChat/components/FieldSubmitButton/FieldSubmitButton.js +1 -2
  6. package/dist/cjs/components/FieldCode/FieldCode.js +1 -2
  7. package/dist/cjs/components/FieldPhone/FieldPhone.js +1 -4
  8. package/dist/cjs/components/FieldSelectCreate/FieldSelectCreate.js +3 -11
  9. package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.js +1 -1
  10. package/dist/cjs/components/FieldSelectCreate/useSelectDataStates.js +3 -6
  11. package/dist/cjs/constants.d.ts +0 -16
  12. package/dist/cjs/constants.js +0 -16
  13. package/dist/esm/components/FieldChat/FieldChat.js +1 -2
  14. package/dist/esm/components/FieldChat/components/Attachments/Attachments.js +1 -2
  15. package/dist/esm/components/FieldChat/components/FieldSubmitButton/FieldSubmitButton.d.ts +4 -3
  16. package/dist/esm/components/FieldChat/components/FieldSubmitButton/FieldSubmitButton.js +1 -2
  17. package/dist/esm/components/FieldCode/FieldCode.js +1 -2
  18. package/dist/esm/components/FieldPhone/FieldPhone.js +1 -4
  19. package/dist/esm/components/FieldSelectCreate/FieldSelectCreate.js +3 -11
  20. package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.js +1 -1
  21. package/dist/esm/components/FieldSelectCreate/useSelectDataStates.js +3 -6
  22. package/dist/esm/constants.d.ts +0 -16
  23. package/dist/esm/constants.js +0 -16
  24. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  25. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  26. package/package.json +15 -15
  27. package/src/components/FieldChat/FieldChat.tsx +0 -3
  28. package/src/components/FieldChat/components/Attachments/Attachments.tsx +1 -2
  29. package/src/components/FieldChat/components/FieldSubmitButton/FieldSubmitButton.tsx +4 -5
  30. package/src/components/FieldCode/FieldCode.tsx +0 -2
  31. package/src/components/FieldPhone/FieldPhone.tsx +1 -4
  32. package/src/components/FieldSelectCreate/FieldSelectCreate.tsx +3 -17
  33. package/src/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.tsx +1 -7
  34. package/src/components/FieldSelectCreate/useSelectDataStates.tsx +3 -6
  35. package/src/constants.ts +0 -16
package/README.md CHANGED
@@ -116,11 +116,11 @@ export function FieldMaskControlled() {
116
116
  | `background` | `boolean` | `true` | Фон поля (acrylic) |
117
117
  | `caption` | `string` | — | Вторичная подпись справа |
118
118
  | `className` | `string` | — | CSS-класс <br/> CSS-класс корня `FieldDecorator` |
119
- | `data-test-id` | `string` | — | Идентификатор элемента для поиска в автоматизированных тестах. |
119
+ | `data-test-id` | `string` | — | |
120
120
  | `defaultValue` | `string` | — | Начальное значение (uncontrolled-режим) |
121
121
  | `disabled` | `boolean` | `false` | Поле выключено <br/> Является ли поле деактивированным |
122
- | `elementAfter` | `FieldElementSlot` | — | Слот справа (кнопка / селект с опциональным выпадающим списком) |
123
- | `elementBefore` | `FieldElementSlot` | — | Слот слева (кнопка / селект с опциональным выпадающим списком) |
122
+ | `elementAfter` | `FieldElementButtonProps` \| `FieldElementSlot` | — | Слот справа (кнопка / селект с опциональным выпадающим списком) |
123
+ | `elementBefore` | `FieldElementButtonProps` \| `FieldElementSlot` | — | Слот слева (кнопка / селект с опциональным выпадающим списком) |
124
124
  | `error` | `string` | — | Ошибка (приоритетнее `hint`; форсит `validationState=error`) |
125
125
  | `fieldClassName` | `string` | — | CSS-класс оболочки поля ввода |
126
126
  | `hint` | `string` | — | Подсказка |
@@ -304,7 +304,7 @@ export function FieldPhoneCountrySettings() {
304
304
  | `background` | `boolean` | `true` | Фон поля (acrylic) |
305
305
  | `caption` | `string` | — | Вторичная подпись справа |
306
306
  | `className` | `string` | — | CSS-класс <br/> CSS-класс корня `FieldDecorator` |
307
- | `data-test-id` | `string` | — | Идентификатор элемента для поиска в автоматизированных тестах. |
307
+ | `data-test-id` | `string` | — | |
308
308
  | `defaultValue` | `string` | — | Начальное значение (uncontrolled-режим) |
309
309
  | `disabled` | `boolean` | `false` | Поле выключено <br/> Является ли поле деактивированным |
310
310
  | `error` | `string` | — | Ошибка (приоритетнее `hint`; форсит `validationState=error`) |
@@ -467,11 +467,11 @@ export function FieldNameRHFExample() {
467
467
  | `background` | `boolean` | `true` | Фон поля (acrylic) |
468
468
  | `className` | `string` | — | CSS-класс <br/> CSS-класс корня `FieldDecorator` |
469
469
  | `customSchema` | `StringSchema<string, AnyObject, undefined, "">` | — | Дополнительная yup-схема, конкатенируется к встроенной (обязательность, длина, допустимые символы). <br/> Через неё подключают data-зависимые проверки, которые компонент не может выполнить сам — например, <br/> проверку уникальности имени по данным потребителя. Текст ошибки можно взять из локали пакета: <br/> `fieldsPredefinedLocale.useTranslations().t('FieldName.errorDuplicate')`. |
470
- | `data-test-id` | `string` | — | Идентификатор элемента для поиска в автоматизированных тестах. |
470
+ | `data-test-id` | `string` | — | |
471
471
  | `defaultValue` | `string` | — | Начальное значение (uncontrolled-режим) |
472
472
  | `disabled` | `boolean` | `false` | Поле выключено <br/> Является ли поле деактивированным |
473
- | `elementAfter` | `FieldElementSlot` | — | Слот справа (кнопка / селект с опциональным выпадающим списком) |
474
- | `elementBefore` | `FieldElementSlot` | — | Слот слева (кнопка / селект с опциональным выпадающим списком) |
473
+ | `elementAfter` | `FieldElementButtonProps` \| `FieldElementSlot` | — | Слот справа (кнопка / селект с опциональным выпадающим списком) |
474
+ | `elementBefore` | `FieldElementButtonProps` \| `FieldElementSlot` | — | Слот слева (кнопка / селект с опциональным выпадающим списком) |
475
475
  | `error` | `string` | — | Ошибка (приоритетнее `hint`; форсит `validationState=error`) |
476
476
  | `fieldClassName` | `string` | — | CSS-класс оболочки поля ввода |
477
477
  | `iconAfter` | `ReactNode` | — | Иконка справа от строки ввода |
@@ -626,7 +626,7 @@ export function FieldDescriptionRHFExample() {
626
626
  | `background` | `boolean` | `true` | Фон поля (acrylic) |
627
627
  | `className` | `string` | — | CSS-класс <br/> CSS-класс корня `FieldDecorator` |
628
628
  | `customSchema` | `StringSchema<string, AnyObject, undefined, "">` | — | Дополнительная yup-схема, которая конкатенируется к встроенной |
629
- | `data-test-id` | `string` | — | Идентификатор элемента для поиска в автоматизированных тестах. |
629
+ | `data-test-id` | `string` | — | |
630
630
  | `defaultValue` | `string` | — | Начальное значение (uncontrolled-режим) |
631
631
  | `disabled` | `boolean` | — | Поле выключено |
632
632
  | `error` | `string` | — | Ошибка (приоритетнее `hint`; форсит `validationState=error`) |
@@ -870,7 +870,7 @@ export function FieldSelectCreateModal() {
870
870
  | `className` | `string` | — | CSS-класс корневой обёртки. |
871
871
  | `createLayoutProps` | `ManagedLayoutKeys` \| `ModalProps` | — | Пропсы модалки создания (`content` — форма создания опции). <br/> Пропсы дровера создания (`content` — форма создания опции); `position` по умолчанию `right`. |
872
872
  | `createLayoutType` | `"drawer"` \| `"modal"` | `drawer` | По клику на «Создать» открывается модальное окно. <br/> По клику на «Создать» открывается дровер (по умолчанию). |
873
- | `data-test-id` | `string` | — | Идентификатор элемента для поиска в автоматизированных тестах. |
873
+ | `data-test-id` | `string` | — | |
874
874
  | `entityIcon` | `EntityIcon` | — | Иконка пустого состояния `noData` (по умолчанию — иконка поиска). |
875
875
  | `entityName` | `EntityName` | — | Название сущности в единственном и множественном числе — для кнопок и пустых состояний. |
876
876
  | `onRefetch` | `(() => void)` | — | Повтор загрузки в состоянии ошибки (кнопка «Обновить» в футере `errorDataState`). |
@@ -880,7 +880,7 @@ export function FieldSelectCreateModal() {
880
880
 
881
881
  ##### Related types
882
882
 
883
- - `EntityIcon` = `((props: WithSupportProps<{ size?: number; className?: string; }>, deprecatedLegacyContext?: any) => ReactNode) | (new (props: WithSupportProps<{ size?: number; className?: string; }>, deprecatedLegacyContext?: any) => Component<any, any>)`
883
+ - `EntityIcon` = `((props: { size?: number; className?: string; }, deprecatedLegacyContext?: any) => ReactNode) | (new (props: { size?: number; className?: string; }, deprecatedLegacyContext?: any) => Component<any, any>)`
884
884
 
885
885
  **EntityName**
886
886
 
@@ -997,7 +997,7 @@ export function FieldChatWithAttachments() {
997
997
  | `background` | `boolean` | `true` | Фон поля (acrylic) |
998
998
  | `caption` | `string` | — | Вторичная подпись справа |
999
999
  | `className` | `string` | — | CSS-класс <br/> CSS-класс корня `FieldDecorator` |
1000
- | `data-test-id` | `string` | — | Идентификатор элемента для поиска в автоматизированных тестах. |
1000
+ | `data-test-id` | `string` | — | |
1001
1001
  | `defaultValue` | `string` | — | Начальное значение (uncontrolled-режим) |
1002
1002
  | `disabled` | `boolean` | — | Поле выключено |
1003
1003
  | `error` | `string` | — | Ошибка (приоритетнее `hint`; форсит `validationState=error`) |
@@ -1182,7 +1182,7 @@ export function FieldCodeResend() {
1182
1182
  | `cellClassName` | `string` | — | CSS-класс ячейки кода |
1183
1183
  | `className` | `string` | — | CSS-класс компонента |
1184
1184
  | `codeLength` | `number` | — | Количество цифр в коде (целое ≥ 1) |
1185
- | `data-test-id` | `string` | — | Идентификатор элемента для поиска в автоматизированных тестах. |
1185
+ | `data-test-id` | `string` | — | |
1186
1186
  | `disabled` | `boolean` | — | Поле выключено |
1187
1187
  | `error` | `string` | — | Ошибка (приоритетнее `hint`; форсит `validationState=error`) |
1188
1188
  | `invalidCode` | `string` | — | Сообщение при неверном коде, если не передан свой `error` |
@@ -1243,7 +1243,7 @@ export function FieldDescriptionRHFExample() {
1243
1243
  | `className` | `string` | — | CSS-класс <br/> CSS-класс корня `FieldDecorator` |
1244
1244
  | `controllerProps` | `Omit<ControllerProps<FieldValues>, "disabled" \| "rules" \| "render">` | — | Режим контроллера с использованием react-hook-form |
1245
1245
  | `customSchema` | `StringSchema<string, AnyObject, undefined, "">` | — | Дополнительная yup-схема, которая конкатенируется к встроенной |
1246
- | `data-test-id` | `string` | — | Идентификатор элемента для поиска в автоматизированных тестах. |
1246
+ | `data-test-id` | `string` | — | |
1247
1247
  | `defaultValue` | `string` | — | Начальное значение (uncontrolled-режим) |
1248
1248
  | `disabled` | `boolean` | — | Поле выключено |
1249
1249
  | `error` | `string` | — | Ошибка (приоритетнее `hint`; форсит `validationState=error`) |
@@ -1312,11 +1312,11 @@ export function FieldNameRHFExample() {
1312
1312
  | `className` | `string` | — | CSS-класс <br/> CSS-класс корня `FieldDecorator` |
1313
1313
  | `controllerProps` | `Omit<ControllerProps<FieldValues>, "disabled" \| "rules" \| "render">` | — | Режим контроллера с использованием react-hook-form |
1314
1314
  | `customSchema` | `StringSchema<string, AnyObject, undefined, "">` | — | Дополнительная yup-схема, конкатенируется к встроенной (обязательность, длина, допустимые символы). <br/> Через неё подключают data-зависимые проверки, которые компонент не может выполнить сам — например, <br/> проверку уникальности имени по данным потребителя. Текст ошибки можно взять из локали пакета: <br/> `fieldsPredefinedLocale.useTranslations().t('FieldName.errorDuplicate')`. |
1315
- | `data-test-id` | `string` | — | Идентификатор элемента для поиска в автоматизированных тестах. |
1315
+ | `data-test-id` | `string` | — | |
1316
1316
  | `defaultValue` | `string` | — | Начальное значение (uncontrolled-режим) |
1317
1317
  | `disabled` | `boolean` | `false` | Поле выключено <br/> Является ли поле деактивированным |
1318
- | `elementAfter` | `FieldElementSlot` | — | Слот справа (кнопка / селект с опциональным выпадающим списком) |
1319
- | `elementBefore` | `FieldElementSlot` | — | Слот слева (кнопка / селект с опциональным выпадающим списком) |
1318
+ | `elementAfter` | `FieldElementButtonProps` \| `FieldElementSlot` | — | Слот справа (кнопка / селект с опциональным выпадающим списком) |
1319
+ | `elementBefore` | `FieldElementButtonProps` \| `FieldElementSlot` | — | Слот слева (кнопка / селект с опциональным выпадающим списком) |
1320
1320
  | `error` | `string` | — | Ошибка (приоритетнее `hint`; форсит `validationState=error`) |
1321
1321
  | `fieldClassName` | `string` | — | CSS-класс оболочки поля ввода |
1322
1322
  | `iconAfter` | `ReactNode` | — | Иконка справа от строки ввода |
@@ -31,7 +31,6 @@ function FieldChat({ handleSubmit: handleSubmitProp, value, attachment, autoFocu
31
31
  // их не наследуют — гасим их явно, иначе прикрепление/отправка остаются кликабельны в disabled-поле.
32
32
  const isInactive = Boolean(props.disabled || props.readonly);
33
33
  const files = (0, react_1.useMemo)(() => attachment?.files?.map(file => ({
34
- 'data-test-id': `${constants_1.TEST_IDS.fieldChatFiles}-${file.name}`,
35
34
  file,
36
35
  onDelete: attachment?.onFileDelete,
37
36
  })) ?? [], [attachment?.files, attachment?.onFileDelete]);
@@ -47,5 +46,5 @@ function FieldChat({ handleSubmit: handleSubmitProp, value, attachment, autoFocu
47
46
  handleSubmit();
48
47
  }
49
48
  };
50
- 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, { "data-test-id": constants_1.TEST_IDS.fieldChatTooltip, 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, { "data-test-id": constants_1.TEST_IDS.fieldChatFileUpload, 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, 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 })] }));
51
50
  }
@@ -7,11 +7,10 @@ exports.Attachments = Attachments;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const attachment_1 = require("@cloud-ru/ds-attachment");
9
9
  const scroll_1 = require("@cloud-ru/ds-scroll");
10
- const constants_1 = require("../../../../constants");
11
10
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
12
11
  function Attachments({ files, isMobile }) {
13
12
  if (!files.length) {
14
13
  return null;
15
14
  }
16
- return ((0, jsx_runtime_1.jsx)(scroll_1.Scroll, { "data-test-id": constants_1.TEST_IDS.attachmentsAttachmentsScroll, className: styles_module_scss_1.default.attachmentsScroll, children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.attachments, children: files.map((file, index) => isMobile ? ((0, jsx_runtime_1.jsx)(attachment_1.Attachment, { size: 's', ...file }, file.file?.name || index)) : ((0, jsx_runtime_1.jsx)(attachment_1.AttachmentSquare, { size: 's', ...file }, file.file?.name || index))) }) }));
15
+ return ((0, jsx_runtime_1.jsx)(scroll_1.Scroll, { className: styles_module_scss_1.default.attachmentsScroll, children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.attachments, children: files.map((file, index) => isMobile ? ((0, jsx_runtime_1.jsx)(attachment_1.Attachment, { size: 's', ...file }, file.file?.name || index)) : ((0, jsx_runtime_1.jsx)(attachment_1.AttachmentSquare, { size: 's', ...file }, file.file?.name || index))) }) }));
17
16
  }
@@ -1,5 +1,4 @@
1
- import type { WithSupportProps } from '@cloud-ru/ds-utils';
2
- export type FieldSubmitButtonProps = WithSupportProps<{
1
+ export type FieldSubmitButtonProps = {
3
2
  /** Активна ли отправка (есть валидное значение или прикреплённые файлы) */
4
3
  active: boolean;
5
4
  /** Колбек клика по кнопке отправки */
@@ -10,7 +9,9 @@ export type FieldSubmitButtonProps = WithSupportProps<{
10
9
  fullWidth?: boolean;
11
10
  /** Показывать тултип над активной кнопкой */
12
11
  showTooltip?: boolean;
13
- }>;
12
+ /** Идентификатор для тестов */
13
+ 'data-test-id'?: string;
14
+ };
14
15
  /**
15
16
  * Кнопка отправки сообщения. В активном состоянии — `submit` с тултипом, иначе — disabled.
16
17
  */
@@ -8,7 +8,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const button_1 = require("@cloud-ru/ds-button");
9
9
  const system_1 = require("@cloud-ru/ds-icons/interface/system");
10
10
  const tooltip_1 = require("@cloud-ru/ds-tooltip");
11
- const constants_1 = require("../../../../constants");
12
11
  const locale_1 = require("../../../../locale");
13
12
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
14
13
  /**
@@ -17,7 +16,7 @@ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
17
16
  function FieldSubmitButton({ active, handleClick, className, fullWidth, showTooltip = true, 'data-test-id': dataTestId, }) {
18
17
  const { t } = locale_1.fieldsPredefinedLocale.useTranslations();
19
18
  if (active) {
20
- return ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { "data-test-id": constants_1.TEST_IDS.fieldSubmitButtonTooltip, tip: t('FieldAi.submit.tooltip'), hoverDelayOpen: 600, open: showTooltip ? undefined : false, triggerClassName: styles_module_scss_1.default.tooltipTrigger, children: (0, jsx_runtime_1.jsx)(button_1.Button, { fullWidth: fullWidth, icon: (0, jsx_runtime_1.jsx)(system_1.ArrowUpSVG, {}), size: 's', view: button_1.VIEW.Filled, appearance: button_1.APPEARANCE.Primary, type: 'submit', onClick: handleClick, className: className, "data-test-id": dataTestId }) }));
19
+ return ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: t('FieldAi.submit.tooltip'), hoverDelayOpen: 600, open: showTooltip ? undefined : false, triggerClassName: styles_module_scss_1.default.tooltipTrigger, children: (0, jsx_runtime_1.jsx)(button_1.Button, { fullWidth: fullWidth, icon: (0, jsx_runtime_1.jsx)(system_1.ArrowUpSVG, {}), size: 's', view: button_1.VIEW.Filled, appearance: button_1.APPEARANCE.Primary, type: 'submit', onClick: handleClick, className: className, "data-test-id": dataTestId }) }));
21
20
  }
22
21
  return ((0, jsx_runtime_1.jsx)(button_1.Button, { icon: (0, jsx_runtime_1.jsx)(system_1.ArrowUpSVG, {}), size: 's', view: button_1.VIEW.Filled, appearance: button_1.APPEARANCE.Primary, disabled: true, className: className, fullWidth: fullWidth, "data-test-id": dataTestId }));
23
22
  }
@@ -9,7 +9,6 @@ const adaptive_1 = require("@cloud-ru/ds-adaptive");
9
9
  const field_decorator_1 = require("@cloud-ru/ds-field-decorator");
10
10
  const classnames_1 = __importDefault(require("classnames"));
11
11
  const react_1 = require("react");
12
- const constants_1 = require("../../constants");
13
12
  const components_1 = require("./components");
14
13
  const hooks_1 = require("./hooks");
15
14
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
@@ -35,7 +34,7 @@ exports.FieldCode = (0, react_1.forwardRef)(function FieldCode(props, ref) {
35
34
  resetCode,
36
35
  }), [moveFocus, blurFields, resetCode]);
37
36
  const resolvedError = error ?? invalidCode;
38
- 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, { "data-test-id": constants_1.TEST_IDS.fieldCodeFieldDecorator, 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-stretch-cells": stretchCells || undefined, children: code.map((char, index) => ((0, jsx_runtime_1.jsx)(components_1.Cell, { ref: inputRef => {
39
38
  if (inputRef) {
40
39
  inputsRef.current[index] = inputRef;
41
40
  }
@@ -39,10 +39,7 @@ exports.FieldPhone = (0, react_1.forwardRef)(function FieldPhone({ value: valueP
39
39
  const items = (0, react_1.useMemo)(() => filteredOptions.map(opt => ({
40
40
  id: opt.id,
41
41
  beforeContent: opt.beforeContent,
42
- content: {
43
- label: opt.content.label,
44
- caption: opt.content.caption,
45
- },
42
+ content: { label: opt.content.label, caption: opt.content.caption },
46
43
  })), [filteredOptions]);
47
44
  const maskOptions = (0, react_1.useMemo)(() => ({
48
45
  mask: country?.mask,
@@ -55,19 +55,11 @@ exports.FieldSelectCreate = (0, react_1.forwardRef)(function FieldSelectCreate({
55
55
  open: isOpen,
56
56
  onClose: handleClose,
57
57
  'data-test-id': constants_1.TEST_IDS.fieldSelectCreateSurface,
58
- approveButton: {
59
- 'data-test-id': constants_1.TEST_IDS.fieldSelectCreateApproveButton,
60
- label: t('FieldSelectCreate.create'),
61
- onClick: handleCreate,
62
- },
63
- cancelButton: {
64
- 'data-test-id': constants_1.TEST_IDS.fieldSelectCreateCancelButton,
65
- label: t('FieldSelectCreate.cancel'),
66
- onClick: handleClose,
67
- },
58
+ approveButton: { label: t('FieldSelectCreate.create'), onClick: handleCreate },
59
+ cancelButton: { label: t('FieldSelectCreate.cancel'), onClick: handleClose },
68
60
  };
69
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 }));
70
- const withTip = (node, show) => show ? ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { "data-test-id": constants_1.TEST_IDS.fieldSelectCreateTooltip, tip: noPermissionTip, children: node })) : (node);
62
+ const withTip = (node, show) => show ? (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: noPermissionTip, children: node }) : node;
71
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:
72
64
  // В состоянии ошибки показываем только «Обновить» из errorDataState — без футера «Создать» (по макету).
73
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] }));
@@ -15,5 +15,5 @@ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
15
15
  function SelectFooter({ onClick, createButtonLabel, canCreate, size }) {
16
16
  const { t } = locale_1.fieldsPredefinedLocale.useTranslations();
17
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
- 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, { "data-test-id": constants_1.TEST_IDS.selectFooterTooltip, tip: t('FieldSelectCreate.noPermission'), children: button })) }));
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
  }
@@ -13,18 +13,15 @@ function useSelectDataStates({ entityName, entityIcon, onRefetch }) {
13
13
  const { t } = locale_1.fieldsPredefinedLocale.useTranslations();
14
14
  return (0, react_1.useMemo)(() => ({
15
15
  noDataState: {
16
- 'data-test-id': constants_1.TEST_IDS.useSelectDataStatesNoDataState,
17
- icon: { 'data-test-id': constants_1.TEST_IDS.useSelectDataStatesIcon, icon: entityIcon ?? system_1.SearchSVG, appearance: 'green' },
16
+ icon: { icon: entityIcon ?? system_1.SearchSVG, appearance: 'green' },
18
17
  description: `${(0, utils_1.capitalize)(entityName.plural)} ${t('FieldSelectCreate.noData')}`,
19
18
  },
20
19
  noResultsState: {
21
- 'data-test-id': constants_1.TEST_IDS.useSelectDataStatesNoResultsState,
22
- icon: { 'data-test-id': constants_1.TEST_IDS.useSelectDataStatesIcon, icon: system_1.SearchSVG, appearance: 'green' },
20
+ icon: { icon: system_1.SearchSVG, appearance: 'green' },
23
21
  description: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, utils_1.capitalize)(entityName.plural), " ", t('FieldSelectCreate.noResult'), ".", (0, jsx_runtime_1.jsx)("br", {}), t('FieldSelectCreate.changeRequest'), " ", entityName.single.toLocaleLowerCase()] })),
24
22
  },
25
23
  errorDataState: {
26
- 'data-test-id': constants_1.TEST_IDS.useSelectDataStatesErrorDataState,
27
- icon: { 'data-test-id': constants_1.TEST_IDS.useSelectDataStatesIcon, icon: system_1.CrossSVG, appearance: 'neutral' },
24
+ icon: { icon: system_1.CrossSVG, appearance: 'neutral' },
28
25
  description: `${t('FieldSelectCreate.loadError')} ${entityName.plural.toLocaleLowerCase()}`,
29
26
  footer: onRefetch ? ((0, jsx_runtime_1.jsx)(button_1.Button, { view: button_1.VIEW.Tonal, appearance: button_1.APPEARANCE.Neutral, label: t('FieldSelectCreate.refetch'), icon: (0, jsx_runtime_1.jsx)(system_1.UpdateSVG, {}), iconPosition: button_1.ICON_POSITION.After, onClick: onRefetch, "data-test-id": constants_1.TEST_IDS.fieldSelectCreateRetry })) : undefined,
30
27
  },
@@ -1,20 +1,4 @@
1
1
  export declare const TEST_IDS: {
2
- readonly fieldChatFiles: "field-chat__files";
3
- readonly fieldPhoneItems: "field-phone__items";
4
- readonly fieldPhoneContent: "field-phone__content";
5
- readonly fieldSelectCreateApproveButton: "field-select-create__approve-button";
6
- readonly fieldSelectCreateCancelButton: "field-select-create__cancel-button";
7
- readonly useSelectDataStatesNoDataState: "use-select-data-states__no-data-state";
8
- readonly useSelectDataStatesIcon: "use-select-data-states__icon";
9
- readonly useSelectDataStatesNoResultsState: "use-select-data-states__no-results-state";
10
- readonly useSelectDataStatesErrorDataState: "use-select-data-states__error-data-state";
11
- readonly attachmentsAttachmentsScroll: "attachments__attachments-scroll";
12
- readonly fieldSubmitButtonTooltip: "field-submit-button__tooltip";
13
- readonly fieldChatTooltip: "field-chat__tooltip";
14
- readonly fieldChatFileUpload: "field-chat__file-upload";
15
- readonly fieldCodeFieldDecorator: "field-code__field-decorator";
16
- readonly fieldSelectCreateTooltip: "field-select-create__tooltip";
17
- readonly selectFooterTooltip: "select-footer__tooltip";
18
2
  readonly fieldMask: "field-mask";
19
3
  readonly fieldName: "field-name";
20
4
  readonly fieldDescription: "field-description";
@@ -2,22 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TEST_IDS = void 0;
4
4
  exports.TEST_IDS = {
5
- fieldChatFiles: 'field-chat__files',
6
- fieldPhoneItems: 'field-phone__items',
7
- fieldPhoneContent: 'field-phone__content',
8
- fieldSelectCreateApproveButton: 'field-select-create__approve-button',
9
- fieldSelectCreateCancelButton: 'field-select-create__cancel-button',
10
- useSelectDataStatesNoDataState: 'use-select-data-states__no-data-state',
11
- useSelectDataStatesIcon: 'use-select-data-states__icon',
12
- useSelectDataStatesNoResultsState: 'use-select-data-states__no-results-state',
13
- useSelectDataStatesErrorDataState: 'use-select-data-states__error-data-state',
14
- attachmentsAttachmentsScroll: 'attachments__attachments-scroll',
15
- fieldSubmitButtonTooltip: 'field-submit-button__tooltip',
16
- fieldChatTooltip: 'field-chat__tooltip',
17
- fieldChatFileUpload: 'field-chat__file-upload',
18
- fieldCodeFieldDecorator: 'field-code__field-decorator',
19
- fieldSelectCreateTooltip: 'field-select-create__tooltip',
20
- selectFooterTooltip: 'select-footer__tooltip',
21
5
  fieldMask: 'field-mask',
22
6
  fieldName: 'field-name',
23
7
  fieldDescription: 'field-description',
@@ -25,7 +25,6 @@ export function FieldChat({ handleSubmit: handleSubmitProp, value, attachment, a
25
25
  // их не наследуют — гасим их явно, иначе прикрепление/отправка остаются кликабельны в disabled-поле.
26
26
  const isInactive = Boolean(props.disabled || props.readonly);
27
27
  const files = useMemo(() => attachment?.files?.map(file => ({
28
- 'data-test-id': `${TEST_IDS.fieldChatFiles}-${file.name}`,
29
28
  file,
30
29
  onDelete: attachment?.onFileDelete,
31
30
  })) ?? [], [attachment?.files, attachment?.onFileDelete]);
@@ -41,5 +40,5 @@ export function FieldChat({ handleSubmit: handleSubmitProp, value, attachment, a
41
40
  handleSubmit();
42
41
  }
43
42
  };
44
- 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, { "data-test-id": TEST_IDS.fieldChatTooltip, tip: t('FieldChat.attachFileTooltip'), hoverDelayOpen: 600, open: isInactive ? false : undefined, triggerClassName: styles.uploadTooltip, children: _jsx(FileUpload, { "data-test-id": TEST_IDS.fieldChatFileUpload, 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, 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 })] }));
45
44
  }
@@ -1,11 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Attachment, AttachmentSquare } from '@cloud-ru/ds-attachment';
3
3
  import { Scroll } from '@cloud-ru/ds-scroll';
4
- import { TEST_IDS } from '../../../../constants.js';
5
4
  import styles from './styles.module.css';
6
5
  export function Attachments({ files, isMobile }) {
7
6
  if (!files.length) {
8
7
  return null;
9
8
  }
10
- return (_jsx(Scroll, { "data-test-id": TEST_IDS.attachmentsAttachmentsScroll, className: styles.attachmentsScroll, children: _jsx("div", { className: styles.attachments, children: files.map((file, index) => isMobile ? (_jsx(Attachment, { size: 's', ...file }, file.file?.name || index)) : (_jsx(AttachmentSquare, { size: 's', ...file }, file.file?.name || index))) }) }));
9
+ return (_jsx(Scroll, { className: styles.attachmentsScroll, children: _jsx("div", { className: styles.attachments, children: files.map((file, index) => isMobile ? (_jsx(Attachment, { size: 's', ...file }, file.file?.name || index)) : (_jsx(AttachmentSquare, { size: 's', ...file }, file.file?.name || index))) }) }));
11
10
  }
@@ -1,5 +1,4 @@
1
- import type { WithSupportProps } from '@cloud-ru/ds-utils';
2
- export type FieldSubmitButtonProps = WithSupportProps<{
1
+ export type FieldSubmitButtonProps = {
3
2
  /** Активна ли отправка (есть валидное значение или прикреплённые файлы) */
4
3
  active: boolean;
5
4
  /** Колбек клика по кнопке отправки */
@@ -10,7 +9,9 @@ export type FieldSubmitButtonProps = WithSupportProps<{
10
9
  fullWidth?: boolean;
11
10
  /** Показывать тултип над активной кнопкой */
12
11
  showTooltip?: boolean;
13
- }>;
12
+ /** Идентификатор для тестов */
13
+ 'data-test-id'?: string;
14
+ };
14
15
  /**
15
16
  * Кнопка отправки сообщения. В активном состоянии — `submit` с тултипом, иначе — disabled.
16
17
  */
@@ -2,7 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { APPEARANCE, Button, VIEW } from '@cloud-ru/ds-button';
3
3
  import { ArrowUpSVG } from '@cloud-ru/ds-icons/interface/system';
4
4
  import { Tooltip } from '@cloud-ru/ds-tooltip';
5
- import { TEST_IDS } from '../../../../constants.js';
6
5
  import { fieldsPredefinedLocale } from '../../../../locale/index.js';
7
6
  import styles from './styles.module.css';
8
7
  /**
@@ -11,7 +10,7 @@ import styles from './styles.module.css';
11
10
  export function FieldSubmitButton({ active, handleClick, className, fullWidth, showTooltip = true, 'data-test-id': dataTestId, }) {
12
11
  const { t } = fieldsPredefinedLocale.useTranslations();
13
12
  if (active) {
14
- return (_jsx(Tooltip, { "data-test-id": TEST_IDS.fieldSubmitButtonTooltip, tip: t('FieldAi.submit.tooltip'), hoverDelayOpen: 600, open: showTooltip ? undefined : false, triggerClassName: styles.tooltipTrigger, children: _jsx(Button, { fullWidth: fullWidth, icon: _jsx(ArrowUpSVG, {}), size: 's', view: VIEW.Filled, appearance: APPEARANCE.Primary, type: 'submit', onClick: handleClick, className: className, "data-test-id": dataTestId }) }));
13
+ return (_jsx(Tooltip, { tip: t('FieldAi.submit.tooltip'), hoverDelayOpen: 600, open: showTooltip ? undefined : false, triggerClassName: styles.tooltipTrigger, children: _jsx(Button, { fullWidth: fullWidth, icon: _jsx(ArrowUpSVG, {}), size: 's', view: VIEW.Filled, appearance: APPEARANCE.Primary, type: 'submit', onClick: handleClick, className: className, "data-test-id": dataTestId }) }));
15
14
  }
16
15
  return (_jsx(Button, { icon: _jsx(ArrowUpSVG, {}), size: 's', view: VIEW.Filled, appearance: APPEARANCE.Primary, disabled: true, className: className, fullWidth: fullWidth, "data-test-id": dataTestId }));
17
16
  }
@@ -3,7 +3,6 @@ import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
3
3
  import { FieldDecorator } from '@cloud-ru/ds-field-decorator';
4
4
  import cn from 'classnames';
5
5
  import { forwardRef, useImperativeHandle } from 'react';
6
- import { TEST_IDS } from '../../constants.js';
7
6
  import { Cell, ResendCode } from './components/index.js';
8
7
  import { useCodeInput, useFieldCodeOverflow, useFieldHelpers, useFocusCell } from './hooks/index.js';
9
8
  import styles from './styles.module.css';
@@ -29,7 +28,7 @@ export const FieldCode = forwardRef(function FieldCode(props, ref) {
29
28
  resetCode,
30
29
  }), [moveFocus, blurFields, resetCode]);
31
30
  const resolvedError = error ?? invalidCode;
32
- 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, { "data-test-id": TEST_IDS.fieldCodeFieldDecorator, 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-stretch-cells": stretchCells || undefined, children: code.map((char, index) => (_jsx(Cell, { ref: inputRef => {
33
32
  if (inputRef) {
34
33
  inputsRef.current[index] = inputRef;
35
34
  }
@@ -33,10 +33,7 @@ export const FieldPhone = forwardRef(function FieldPhone({ value: valueProp, onC
33
33
  const items = useMemo(() => filteredOptions.map(opt => ({
34
34
  id: opt.id,
35
35
  beforeContent: opt.beforeContent,
36
- content: {
37
- label: opt.content.label,
38
- caption: opt.content.caption,
39
- },
36
+ content: { label: opt.content.label, caption: opt.content.caption },
40
37
  })), [filteredOptions]);
41
38
  const maskOptions = useMemo(() => ({
42
39
  mask: country?.mask,
@@ -49,19 +49,11 @@ export const FieldSelectCreate = forwardRef(function FieldSelectCreate({ selectP
49
49
  open: isOpen,
50
50
  onClose: handleClose,
51
51
  'data-test-id': TEST_IDS.fieldSelectCreateSurface,
52
- approveButton: {
53
- 'data-test-id': TEST_IDS.fieldSelectCreateApproveButton,
54
- label: t('FieldSelectCreate.create'),
55
- onClick: handleCreate,
56
- },
57
- cancelButton: {
58
- 'data-test-id': TEST_IDS.fieldSelectCreateCancelButton,
59
- label: t('FieldSelectCreate.cancel'),
60
- onClick: handleClose,
61
- },
52
+ approveButton: { label: t('FieldSelectCreate.create'), onClick: handleCreate },
53
+ cancelButton: { label: t('FieldSelectCreate.cancel'), onClick: handleClose },
62
54
  };
63
55
  const formLayout = createLayoutType === CREATE_LAYOUT_TYPE.Modal ? (_jsx(Modal, { ...layoutProps })) : (_jsx(Drawer, { ...layoutProps, position: createLayoutProps.position ?? POSITION.Right }));
64
- const withTip = (node, show) => show ? (_jsx(Tooltip, { "data-test-id": TEST_IDS.fieldSelectCreateTooltip, tip: noPermissionTip, children: node })) : (node);
56
+ const withTip = (node, show) => show ? _jsx(Tooltip, { tip: noPermissionTip, children: node }) : node;
65
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:
66
58
  // В состоянии ошибки показываем только «Обновить» из errorDataState — без футера «Создать» (по макету).
67
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] }));
@@ -9,5 +9,5 @@ import styles from './styles.module.css';
9
9
  export function SelectFooter({ onClick, createButtonLabel, canCreate, size }) {
10
10
  const { t } = fieldsPredefinedLocale.useTranslations();
11
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
- return (_jsx("div", { className: styles.footerWrapper, children: canCreate ? (button) : (_jsx(Tooltip, { "data-test-id": TEST_IDS.selectFooterTooltip, tip: t('FieldSelectCreate.noPermission'), children: button })) }));
12
+ return (_jsx("div", { className: styles.footerWrapper, children: canCreate ? button : _jsx(Tooltip, { tip: t('FieldSelectCreate.noPermission'), children: button }) }));
13
13
  }
@@ -10,18 +10,15 @@ export function useSelectDataStates({ entityName, entityIcon, onRefetch }) {
10
10
  const { t } = fieldsPredefinedLocale.useTranslations();
11
11
  return useMemo(() => ({
12
12
  noDataState: {
13
- 'data-test-id': TEST_IDS.useSelectDataStatesNoDataState,
14
- icon: { 'data-test-id': TEST_IDS.useSelectDataStatesIcon, icon: entityIcon ?? SearchSVG, appearance: 'green' },
13
+ icon: { icon: entityIcon ?? SearchSVG, appearance: 'green' },
15
14
  description: `${capitalize(entityName.plural)} ${t('FieldSelectCreate.noData')}`,
16
15
  },
17
16
  noResultsState: {
18
- 'data-test-id': TEST_IDS.useSelectDataStatesNoResultsState,
19
- icon: { 'data-test-id': TEST_IDS.useSelectDataStatesIcon, icon: SearchSVG, appearance: 'green' },
17
+ icon: { icon: SearchSVG, appearance: 'green' },
20
18
  description: (_jsxs(_Fragment, { children: [capitalize(entityName.plural), " ", t('FieldSelectCreate.noResult'), ".", _jsx("br", {}), t('FieldSelectCreate.changeRequest'), " ", entityName.single.toLocaleLowerCase()] })),
21
19
  },
22
20
  errorDataState: {
23
- 'data-test-id': TEST_IDS.useSelectDataStatesErrorDataState,
24
- icon: { 'data-test-id': TEST_IDS.useSelectDataStatesIcon, icon: CrossSVG, appearance: 'neutral' },
21
+ icon: { icon: CrossSVG, appearance: 'neutral' },
25
22
  description: `${t('FieldSelectCreate.loadError')} ${entityName.plural.toLocaleLowerCase()}`,
26
23
  footer: onRefetch ? (_jsx(Button, { view: VIEW.Tonal, appearance: APPEARANCE.Neutral, label: t('FieldSelectCreate.refetch'), icon: _jsx(UpdateSVG, {}), iconPosition: ICON_POSITION.After, onClick: onRefetch, "data-test-id": TEST_IDS.fieldSelectCreateRetry })) : undefined,
27
24
  },
@@ -1,20 +1,4 @@
1
1
  export declare const TEST_IDS: {
2
- readonly fieldChatFiles: "field-chat__files";
3
- readonly fieldPhoneItems: "field-phone__items";
4
- readonly fieldPhoneContent: "field-phone__content";
5
- readonly fieldSelectCreateApproveButton: "field-select-create__approve-button";
6
- readonly fieldSelectCreateCancelButton: "field-select-create__cancel-button";
7
- readonly useSelectDataStatesNoDataState: "use-select-data-states__no-data-state";
8
- readonly useSelectDataStatesIcon: "use-select-data-states__icon";
9
- readonly useSelectDataStatesNoResultsState: "use-select-data-states__no-results-state";
10
- readonly useSelectDataStatesErrorDataState: "use-select-data-states__error-data-state";
11
- readonly attachmentsAttachmentsScroll: "attachments__attachments-scroll";
12
- readonly fieldSubmitButtonTooltip: "field-submit-button__tooltip";
13
- readonly fieldChatTooltip: "field-chat__tooltip";
14
- readonly fieldChatFileUpload: "field-chat__file-upload";
15
- readonly fieldCodeFieldDecorator: "field-code__field-decorator";
16
- readonly fieldSelectCreateTooltip: "field-select-create__tooltip";
17
- readonly selectFooterTooltip: "select-footer__tooltip";
18
2
  readonly fieldMask: "field-mask";
19
3
  readonly fieldName: "field-name";
20
4
  readonly fieldDescription: "field-description";
@@ -1,20 +1,4 @@
1
1
  export const TEST_IDS = {
2
- fieldChatFiles: 'field-chat__files',
3
- fieldPhoneItems: 'field-phone__items',
4
- fieldPhoneContent: 'field-phone__content',
5
- fieldSelectCreateApproveButton: 'field-select-create__approve-button',
6
- fieldSelectCreateCancelButton: 'field-select-create__cancel-button',
7
- useSelectDataStatesNoDataState: 'use-select-data-states__no-data-state',
8
- useSelectDataStatesIcon: 'use-select-data-states__icon',
9
- useSelectDataStatesNoResultsState: 'use-select-data-states__no-results-state',
10
- useSelectDataStatesErrorDataState: 'use-select-data-states__error-data-state',
11
- attachmentsAttachmentsScroll: 'attachments__attachments-scroll',
12
- fieldSubmitButtonTooltip: 'field-submit-button__tooltip',
13
- fieldChatTooltip: 'field-chat__tooltip',
14
- fieldChatFileUpload: 'field-chat__file-upload',
15
- fieldCodeFieldDecorator: 'field-code__field-decorator',
16
- fieldSelectCreateTooltip: 'field-select-create__tooltip',
17
- selectFooterTooltip: 'select-footer__tooltip',
18
2
  fieldMask: 'field-mask',
19
3
  fieldName: 'field-name',
20
4
  fieldDescription: 'field-description',