@cloud-ru/ds-uikit-product-fields-predefined 4.2.3-preview-2df639a4.0 → 4.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +16 -16
- package/dist/cjs/components/FieldChat/FieldChat.js +1 -2
- package/dist/cjs/components/FieldChat/components/Attachments/Attachments.js +1 -2
- package/dist/cjs/components/FieldChat/components/FieldSubmitButton/FieldSubmitButton.d.ts +4 -3
- package/dist/cjs/components/FieldChat/components/FieldSubmitButton/FieldSubmitButton.js +1 -2
- package/dist/cjs/components/FieldCode/FieldCode.js +1 -2
- package/dist/cjs/components/FieldPhone/FieldPhone.js +1 -4
- package/dist/cjs/components/FieldSelectCreate/FieldSelectCreate.js +3 -11
- package/dist/cjs/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.js +1 -1
- package/dist/cjs/components/FieldSelectCreate/useSelectDataStates.js +3 -6
- package/dist/cjs/constants.d.ts +0 -16
- package/dist/cjs/constants.js +0 -16
- package/dist/esm/components/FieldChat/FieldChat.js +1 -2
- package/dist/esm/components/FieldChat/components/Attachments/Attachments.js +1 -2
- package/dist/esm/components/FieldChat/components/FieldSubmitButton/FieldSubmitButton.d.ts +4 -3
- package/dist/esm/components/FieldChat/components/FieldSubmitButton/FieldSubmitButton.js +1 -2
- package/dist/esm/components/FieldCode/FieldCode.js +1 -2
- package/dist/esm/components/FieldPhone/FieldPhone.js +1 -4
- package/dist/esm/components/FieldSelectCreate/FieldSelectCreate.js +3 -11
- package/dist/esm/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.js +1 -1
- package/dist/esm/components/FieldSelectCreate/useSelectDataStates.js +3 -6
- package/dist/esm/constants.d.ts +0 -16
- package/dist/esm/constants.js +0 -16
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/components/FieldChat/FieldChat.tsx +0 -3
- package/src/components/FieldChat/components/Attachments/Attachments.tsx +1 -2
- package/src/components/FieldChat/components/FieldSubmitButton/FieldSubmitButton.tsx +4 -5
- package/src/components/FieldCode/FieldCode.tsx +0 -2
- package/src/components/FieldPhone/FieldPhone.tsx +1 -4
- package/src/components/FieldSelectCreate/FieldSelectCreate.tsx +3 -17
- package/src/components/FieldSelectCreate/helperComponents/SelectFooter/SelectFooter.tsx +1 -7
- package/src/components/FieldSelectCreate/useSelectDataStates.tsx +3 -6
- package/src/constants.ts +0 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/ds-uikit-product-fields-predefined",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "Набор предопределённых полей формы поверх @ds/fields — телефон, маски, имя, описание, код и другие готовые сценарии ввода.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,21 +44,21 @@
|
|
|
44
44
|
"imask": "^7.6.1",
|
|
45
45
|
"merge-refs": "^2.0.0",
|
|
46
46
|
"react-imask": "^7.6.1",
|
|
47
|
-
"@cloud-ru/ds-
|
|
48
|
-
"@cloud-ru/ds-
|
|
49
|
-
"@cloud-ru/ds-button": "1.0.
|
|
50
|
-
"@cloud-ru/ds-
|
|
51
|
-
"@cloud-ru/ds-
|
|
52
|
-
"@cloud-ru/ds-field-decorator": "1.1.
|
|
53
|
-
"@cloud-ru/ds-fields": "3.1.
|
|
54
|
-
"@cloud-ru/ds-icons": "1.8.
|
|
55
|
-
"@cloud-ru/ds-input-private": "1.0.
|
|
56
|
-
"@cloud-ru/ds-list": "3.2.
|
|
57
|
-
"@cloud-ru/ds-locale": "1.0.0",
|
|
58
|
-
"@cloud-ru/ds-modal": "2.2.
|
|
59
|
-
"@cloud-ru/ds-scroll": "1.0.
|
|
60
|
-
"@cloud-ru/ds-tooltip": "1.0.
|
|
61
|
-
"@cloud-ru/ds-utils": "1.4.
|
|
47
|
+
"@cloud-ru/ds-attachment": "^1.1.39",
|
|
48
|
+
"@cloud-ru/ds-adaptive": "^1.0.6",
|
|
49
|
+
"@cloud-ru/ds-button": "^1.0.9",
|
|
50
|
+
"@cloud-ru/ds-drawer": "^2.4.4",
|
|
51
|
+
"@cloud-ru/ds-dropzone": "^1.0.7",
|
|
52
|
+
"@cloud-ru/ds-field-decorator": "^1.1.15",
|
|
53
|
+
"@cloud-ru/ds-fields": "^3.1.2",
|
|
54
|
+
"@cloud-ru/ds-icons": "^1.8.0",
|
|
55
|
+
"@cloud-ru/ds-input-private": "^1.0.20",
|
|
56
|
+
"@cloud-ru/ds-list": "^3.2.2",
|
|
57
|
+
"@cloud-ru/ds-locale": "^1.0.0",
|
|
58
|
+
"@cloud-ru/ds-modal": "^2.2.4",
|
|
59
|
+
"@cloud-ru/ds-scroll": "^1.0.9",
|
|
60
|
+
"@cloud-ru/ds-tooltip": "^1.0.22",
|
|
61
|
+
"@cloud-ru/ds-utils": "^1.4.2"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"react-hook-form": "^7.79.0",
|
|
@@ -33,7 +33,6 @@ export function FieldChat({ handleSubmit: handleSubmitProp, value, attachment, a
|
|
|
33
33
|
const files = useMemo<AttachmentSquareProps[]>(
|
|
34
34
|
() =>
|
|
35
35
|
attachment?.files?.map(file => ({
|
|
36
|
-
'data-test-id': `${TEST_IDS.fieldChatFiles}-${file.name}`,
|
|
37
36
|
file,
|
|
38
37
|
onDelete: attachment?.onFileDelete,
|
|
39
38
|
})) ?? [],
|
|
@@ -75,14 +74,12 @@ export function FieldChat({ handleSubmit: handleSubmitProp, value, attachment, a
|
|
|
75
74
|
<>
|
|
76
75
|
{attachment && (
|
|
77
76
|
<Tooltip
|
|
78
|
-
data-test-id={TEST_IDS.fieldChatTooltip}
|
|
79
77
|
tip={t('FieldChat.attachFileTooltip')}
|
|
80
78
|
hoverDelayOpen={600}
|
|
81
79
|
open={isInactive ? false : undefined}
|
|
82
80
|
triggerClassName={styles.uploadTooltip}
|
|
83
81
|
>
|
|
84
82
|
<FileUpload
|
|
85
|
-
data-test-id={TEST_IDS.fieldChatFileUpload}
|
|
86
83
|
mode={UPLOAD_MODE.Multiple}
|
|
87
84
|
onFilesUpload={attachment.onFilesUpload}
|
|
88
85
|
accept={attachment.accept}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Attachment, AttachmentSquare, AttachmentSquareProps } from '@cloud-ru/ds-attachment';
|
|
2
2
|
import { Scroll } from '@cloud-ru/ds-scroll';
|
|
3
3
|
|
|
4
|
-
import { TEST_IDS } from '../../../../constants';
|
|
5
4
|
import styles from './styles.module.scss';
|
|
6
5
|
|
|
7
6
|
export type AttachmentsProps = {
|
|
@@ -17,7 +16,7 @@ export function Attachments({ files, isMobile }: AttachmentsProps) {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
return (
|
|
20
|
-
<Scroll
|
|
19
|
+
<Scroll className={styles.attachmentsScroll}>
|
|
21
20
|
<div className={styles.attachments}>
|
|
22
21
|
{files.map((file, index) =>
|
|
23
22
|
isMobile ? (
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { APPEARANCE, Button, VIEW } from '@cloud-ru/ds-button';
|
|
2
2
|
import { ArrowUpSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
3
3
|
import { Tooltip } from '@cloud-ru/ds-tooltip';
|
|
4
|
-
import type { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
5
4
|
|
|
6
|
-
import { TEST_IDS } from '../../../../constants';
|
|
7
5
|
import { fieldsPredefinedLocale } from '../../../../locale';
|
|
8
6
|
import styles from './styles.module.scss';
|
|
9
7
|
|
|
10
|
-
export type FieldSubmitButtonProps =
|
|
8
|
+
export type FieldSubmitButtonProps = {
|
|
11
9
|
/** Активна ли отправка (есть валидное значение или прикреплённые файлы) */
|
|
12
10
|
active: boolean;
|
|
13
11
|
/** Колбек клика по кнопке отправки */
|
|
@@ -18,7 +16,9 @@ export type FieldSubmitButtonProps = WithSupportProps<{
|
|
|
18
16
|
fullWidth?: boolean;
|
|
19
17
|
/** Показывать тултип над активной кнопкой */
|
|
20
18
|
showTooltip?: boolean;
|
|
21
|
-
|
|
19
|
+
/** Идентификатор для тестов */
|
|
20
|
+
'data-test-id'?: string;
|
|
21
|
+
};
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Кнопка отправки сообщения. В активном состоянии — `submit` с тултипом, иначе — disabled.
|
|
@@ -36,7 +36,6 @@ export function FieldSubmitButton({
|
|
|
36
36
|
if (active) {
|
|
37
37
|
return (
|
|
38
38
|
<Tooltip
|
|
39
|
-
data-test-id={TEST_IDS.fieldSubmitButtonTooltip}
|
|
40
39
|
tip={t('FieldAi.submit.tooltip')}
|
|
41
40
|
hoverDelayOpen={600}
|
|
42
41
|
open={showTooltip ? undefined : false}
|
|
@@ -3,7 +3,6 @@ import { FieldDecorator, FieldDecoratorProps } from '@cloud-ru/ds-field-decorato
|
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import { forwardRef, useImperativeHandle } from 'react';
|
|
5
5
|
|
|
6
|
-
import { TEST_IDS } from '../../constants';
|
|
7
6
|
import { Cell, ResendCode, ResendCodeProps } from './components';
|
|
8
7
|
import { useCodeInput, UseCodeInputParams, useFieldCodeOverflow, useFieldHelpers, useFocusCell } from './hooks';
|
|
9
8
|
import styles from './styles.module.scss';
|
|
@@ -98,7 +97,6 @@ export const FieldCode = forwardRef<FieldCodeRef, FieldCodeProps>(function Field
|
|
|
98
97
|
{...(dataTestId ? { 'data-test-id': dataTestId } : undefined)}
|
|
99
98
|
>
|
|
100
99
|
<FieldDecorator
|
|
101
|
-
data-test-id={TEST_IDS.fieldCodeFieldDecorator}
|
|
102
100
|
className={cn(!hasOverflow && styles.fieldDecorator)}
|
|
103
101
|
label={label}
|
|
104
102
|
disabled={disabled}
|
|
@@ -96,10 +96,7 @@ export const FieldPhone = forwardRef<HTMLInputElement, FieldPhoneProps>(function
|
|
|
96
96
|
filteredOptions.map(opt => ({
|
|
97
97
|
id: opt.id,
|
|
98
98
|
beforeContent: opt.beforeContent,
|
|
99
|
-
content: {
|
|
100
|
-
label: opt.content.label,
|
|
101
|
-
caption: opt.content.caption,
|
|
102
|
-
},
|
|
99
|
+
content: { label: opt.content.label, caption: opt.content.caption },
|
|
103
100
|
})),
|
|
104
101
|
[filteredOptions],
|
|
105
102
|
);
|
|
@@ -72,16 +72,8 @@ export const FieldSelectCreate = forwardRef<HTMLInputElement, FieldSelectCreateP
|
|
|
72
72
|
open: isOpen,
|
|
73
73
|
onClose: handleClose,
|
|
74
74
|
'data-test-id': TEST_IDS.fieldSelectCreateSurface,
|
|
75
|
-
approveButton: {
|
|
76
|
-
|
|
77
|
-
label: t('FieldSelectCreate.create'),
|
|
78
|
-
onClick: handleCreate,
|
|
79
|
-
},
|
|
80
|
-
cancelButton: {
|
|
81
|
-
'data-test-id': TEST_IDS.fieldSelectCreateCancelButton,
|
|
82
|
-
label: t('FieldSelectCreate.cancel'),
|
|
83
|
-
onClick: handleClose,
|
|
84
|
-
},
|
|
75
|
+
approveButton: { label: t('FieldSelectCreate.create'), onClick: handleCreate },
|
|
76
|
+
cancelButton: { label: t('FieldSelectCreate.cancel'), onClick: handleClose },
|
|
85
77
|
};
|
|
86
78
|
|
|
87
79
|
const formLayout =
|
|
@@ -95,13 +87,7 @@ export const FieldSelectCreate = forwardRef<HTMLInputElement, FieldSelectCreateP
|
|
|
95
87
|
);
|
|
96
88
|
|
|
97
89
|
const withTip = (node: ReactElement, show: boolean) =>
|
|
98
|
-
show ?
|
|
99
|
-
<Tooltip data-test-id={TEST_IDS.fieldSelectCreateTooltip} tip={noPermissionTip}>
|
|
100
|
-
{node}
|
|
101
|
-
</Tooltip>
|
|
102
|
-
) : (
|
|
103
|
-
node
|
|
104
|
-
);
|
|
90
|
+
show ? <Tooltip tip={noPermissionTip}>{node}</Tooltip> : node;
|
|
105
91
|
|
|
106
92
|
return (
|
|
107
93
|
<div
|
|
@@ -33,13 +33,7 @@ export function SelectFooter({ onClick, createButtonLabel, canCreate, size }: Se
|
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
35
|
<div className={styles.footerWrapper}>
|
|
36
|
-
{canCreate ? (
|
|
37
|
-
button
|
|
38
|
-
) : (
|
|
39
|
-
<Tooltip data-test-id={TEST_IDS.selectFooterTooltip} tip={t('FieldSelectCreate.noPermission')}>
|
|
40
|
-
{button}
|
|
41
|
-
</Tooltip>
|
|
42
|
-
)}
|
|
36
|
+
{canCreate ? button : <Tooltip tip={t('FieldSelectCreate.noPermission')}>{button}</Tooltip>}
|
|
43
37
|
</div>
|
|
44
38
|
);
|
|
45
39
|
}
|
|
@@ -23,13 +23,11 @@ export function useSelectDataStates({ entityName, entityIcon, onRefetch }: Props
|
|
|
23
23
|
return useMemo(
|
|
24
24
|
() => ({
|
|
25
25
|
noDataState: {
|
|
26
|
-
'
|
|
27
|
-
icon: { 'data-test-id': TEST_IDS.useSelectDataStatesIcon, icon: entityIcon ?? SearchSVG, appearance: 'green' },
|
|
26
|
+
icon: { icon: entityIcon ?? SearchSVG, appearance: 'green' },
|
|
28
27
|
description: `${capitalize(entityName.plural)} ${t('FieldSelectCreate.noData')}`,
|
|
29
28
|
},
|
|
30
29
|
noResultsState: {
|
|
31
|
-
'
|
|
32
|
-
icon: { 'data-test-id': TEST_IDS.useSelectDataStatesIcon, icon: SearchSVG, appearance: 'green' },
|
|
30
|
+
icon: { icon: SearchSVG, appearance: 'green' },
|
|
33
31
|
description: (
|
|
34
32
|
<>
|
|
35
33
|
{capitalize(entityName.plural)} {t('FieldSelectCreate.noResult')}.
|
|
@@ -39,8 +37,7 @@ export function useSelectDataStates({ entityName, entityIcon, onRefetch }: Props
|
|
|
39
37
|
),
|
|
40
38
|
},
|
|
41
39
|
errorDataState: {
|
|
42
|
-
'
|
|
43
|
-
icon: { 'data-test-id': TEST_IDS.useSelectDataStatesIcon, icon: CrossSVG, appearance: 'neutral' },
|
|
40
|
+
icon: { icon: CrossSVG, appearance: 'neutral' },
|
|
44
41
|
description: `${t('FieldSelectCreate.loadError')} ${entityName.plural.toLocaleLowerCase()}`,
|
|
45
42
|
footer: onRefetch ? (
|
|
46
43
|
<Button
|
package/src/constants.ts
CHANGED
|
@@ -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',
|