@pushwoosh/smart-components-kit 1.0.76 → 1.0.88
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/DocsButton/DocsButton.js +5 -1
- package/DocsButton/polyglot/index.d.ts +5 -0
- package/DocsButton/polyglot/index.js +10 -0
- package/DocsButton/polyglot/messages_en.d.ts +3 -0
- package/DocsButton/polyglot/messages_en.js +3 -0
- package/DocsButton/polyglot/messages_ru.d.ts +3 -0
- package/DocsButton/polyglot/messages_ru.js +3 -0
- package/DocsButton/polyglot/types.d.ts +4 -0
- package/DocsButton/polyglot/types.js +1 -0
- package/DynamicContentPicker/styled.d.ts +16 -104
- package/DynamicContentPickerForm/styled.d.ts +18 -106
- package/ExportCSV/ExportCsvBanner/ExportCsvBanner.js +2 -1
- package/LanguagesSelector/LanguagesModal.js +11 -3
- package/LanguagesSelector/LanguagesSelectForm.js +34 -16
- package/LanguagesSelector/LanguagesSelector.js +10 -6
- package/LanguagesSelector/polyglot/index.d.ts +2 -0
- package/LanguagesSelector/polyglot/index.js +10 -0
- package/LanguagesSelector/polyglot/messages_en.d.ts +3 -0
- package/LanguagesSelector/polyglot/messages_en.js +13 -0
- package/LanguagesSelector/polyglot/messages_ru.d.ts +3 -0
- package/LanguagesSelector/polyglot/messages_ru.js +13 -0
- package/LanguagesSelector/polyglot/types.d.ts +17 -0
- package/LanguagesSelector/polyglot/types.js +1 -0
- package/LanguagesSelector/styled.d.ts +8 -52
- package/ModalCloningJourney/ModalCloningJourney.js +67 -22
- package/ModalCloningJourney/polyglot/index.d.ts +2 -0
- package/ModalCloningJourney/polyglot/index.js +10 -0
- package/ModalCloningJourney/polyglot/messages_en.d.ts +3 -0
- package/ModalCloningJourney/polyglot/messages_en.js +22 -0
- package/ModalCloningJourney/polyglot/messages_ru.d.ts +3 -0
- package/ModalCloningJourney/polyglot/messages_ru.js +22 -0
- package/ModalCloningJourney/polyglot/types.d.ts +25 -0
- package/ModalCloningJourney/polyglot/types.js +1 -0
- package/OpenActions/components/OpenActionsSummary/styles.d.ts +8 -52
- package/RichMessageEditorSmart/NewDynamicContentForm.js +5 -1
- package/RichMessageEditorSmart/polyglot/index.d.ts +5 -0
- package/RichMessageEditorSmart/polyglot/index.js +10 -0
- package/RichMessageEditorSmart/polyglot/messages_en.d.ts +3 -0
- package/RichMessageEditorSmart/polyglot/messages_en.js +3 -0
- package/RichMessageEditorSmart/polyglot/messages_ru.d.ts +3 -0
- package/RichMessageEditorSmart/polyglot/messages_ru.js +3 -0
- package/RichMessageEditorSmart/polyglot/types.d.ts +4 -0
- package/RichMessageEditorSmart/polyglot/types.js +1 -0
- package/Table/components/DataTable/DataTable.js +27 -8
- package/Table/components/DataTableList/DataTableList.js +29 -9
- package/Table/components/TablePagination/TablePagination.js +5 -1
- package/Table/polyglot/index.d.ts +2 -0
- package/Table/polyglot/index.js +10 -0
- package/Table/polyglot/messages_en.d.ts +3 -0
- package/Table/polyglot/messages_en.js +18 -0
- package/Table/polyglot/messages_ru.d.ts +3 -0
- package/Table/polyglot/messages_ru.js +18 -0
- package/Table/polyglot/types.d.ts +21 -0
- package/Table/polyglot/types.js +1 -0
- package/Table/styles.d.ts +34 -210
- package/package.json +3 -2
package/DocsButton/DocsButton.js
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Button, DrawerDocs, useDocs } from '@pushwoosh/dumb-components';
|
|
3
3
|
import { DocsIcon } from '@pushwoosh/kit-icons';
|
|
4
4
|
import { useDocsButtonUrl } from './hooks';
|
|
5
|
+
import { useLang } from './polyglot';
|
|
5
6
|
export function DocsButton(props) {
|
|
6
7
|
const {
|
|
7
8
|
pathname,
|
|
@@ -11,6 +12,7 @@ export function DocsButton(props) {
|
|
|
11
12
|
size,
|
|
12
13
|
openInNewWindow = false
|
|
13
14
|
} = props;
|
|
15
|
+
const lang = useLang();
|
|
14
16
|
const {
|
|
15
17
|
docsOpen,
|
|
16
18
|
openDocsDrawer,
|
|
@@ -28,7 +30,9 @@ export function DocsButton(props) {
|
|
|
28
30
|
openDocsDrawer();
|
|
29
31
|
};
|
|
30
32
|
return React.createElement(React.Fragment, null, React.createElement(Button, {
|
|
31
|
-
"aria-label":
|
|
33
|
+
"aria-label": lang({
|
|
34
|
+
message: 'SMART.DOCS_BUTTON.ARIA_LABEL'
|
|
35
|
+
}),
|
|
32
36
|
color: color,
|
|
33
37
|
view: view,
|
|
34
38
|
size: size,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const Lang: import("react").FC<{
|
|
2
|
+
message: "SMART.DOCS_BUTTON.ARIA_LABEL";
|
|
3
|
+
} & import("@pushwoosh/dumb-components/polyglot").NoParams>, useLang: () => (props: {
|
|
4
|
+
message: "SMART.DOCS_BUTTON.ARIA_LABEL";
|
|
5
|
+
} & import("@pushwoosh/dumb-components/polyglot").NoParams) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,114 +1,26 @@
|
|
|
1
1
|
import { type ArrowDirection } from './types';
|
|
2
|
-
export declare const FieldPlace: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
-
$alignContent?: "
|
|
4
|
-
$alignItems?: "
|
|
5
|
-
$
|
|
6
|
-
$
|
|
7
|
-
|
|
8
|
-
right?: string | undefined;
|
|
9
|
-
bottom?: string | undefined;
|
|
10
|
-
left?: string | undefined;
|
|
11
|
-
} | {
|
|
12
|
-
horizontal: string;
|
|
13
|
-
top?: string | undefined;
|
|
14
|
-
bottom?: string | undefined;
|
|
15
|
-
} | {
|
|
16
|
-
vertical: string;
|
|
17
|
-
right?: string | undefined;
|
|
18
|
-
left?: string | undefined;
|
|
19
|
-
}) | undefined;
|
|
20
|
-
$borderRadius?: (string | number) | undefined;
|
|
21
|
-
$boxShadow?: string | undefined;
|
|
22
|
-
$gap?: (string | number) | undefined;
|
|
2
|
+
export declare const FieldPlace: import("styled-components").StyledComponent<"div", any, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
|
|
3
|
+
$alignContent?: import("@pushwoosh/kit-helpers/styled-helpers").AlignContentValue | undefined;
|
|
4
|
+
$alignItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
5
|
+
$gap?: import("@pushwoosh/kit-helpers/styled-helpers").StrNum | undefined;
|
|
6
|
+
$justifyContent?: import("@pushwoosh/kit-helpers/styled-helpers").JustifyContentValue | undefined;
|
|
7
|
+
} & {
|
|
23
8
|
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
24
|
-
$
|
|
25
|
-
$
|
|
26
|
-
$margin?: (string | number) | ({
|
|
27
|
-
top?: (string | number) | undefined;
|
|
28
|
-
right?: (string | number) | undefined;
|
|
29
|
-
bottom?: (string | number) | undefined;
|
|
30
|
-
left?: (string | number) | undefined;
|
|
31
|
-
} | {
|
|
32
|
-
horizontal: string | number;
|
|
33
|
-
top?: (string | number) | undefined;
|
|
34
|
-
bottom?: (string | number) | undefined;
|
|
35
|
-
} | {
|
|
36
|
-
vertical: string | number;
|
|
37
|
-
right?: (string | number) | undefined;
|
|
38
|
-
left?: (string | number) | undefined;
|
|
39
|
-
}) | undefined;
|
|
40
|
-
$padding?: (string | number) | ({
|
|
41
|
-
top?: (string | number) | undefined;
|
|
42
|
-
right?: (string | number) | undefined;
|
|
43
|
-
bottom?: (string | number) | undefined;
|
|
44
|
-
left?: (string | number) | undefined;
|
|
45
|
-
} | {
|
|
46
|
-
horizontal: string | number;
|
|
47
|
-
top?: (string | number) | undefined;
|
|
48
|
-
bottom?: (string | number) | undefined;
|
|
49
|
-
} | {
|
|
50
|
-
vertical: string | number;
|
|
51
|
-
right?: (string | number) | undefined;
|
|
52
|
-
left?: (string | number) | undefined;
|
|
53
|
-
}) | undefined;
|
|
54
|
-
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
9
|
+
$justifyItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
10
|
+
$placeItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
55
11
|
} & {
|
|
56
12
|
$gridAutoFlow: string;
|
|
57
13
|
}, "$gridAutoFlow">;
|
|
58
14
|
export declare const TextPlace: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
59
|
-
export declare const Arrow: import("styled-components").StyledComponent<"div", any, {
|
|
60
|
-
$alignContent?: "
|
|
61
|
-
$alignItems?: "
|
|
62
|
-
$
|
|
63
|
-
$
|
|
64
|
-
|
|
65
|
-
right?: string | undefined;
|
|
66
|
-
bottom?: string | undefined;
|
|
67
|
-
left?: string | undefined;
|
|
68
|
-
} | {
|
|
69
|
-
horizontal: string;
|
|
70
|
-
top?: string | undefined;
|
|
71
|
-
bottom?: string | undefined;
|
|
72
|
-
} | {
|
|
73
|
-
vertical: string;
|
|
74
|
-
right?: string | undefined;
|
|
75
|
-
left?: string | undefined;
|
|
76
|
-
}) | undefined;
|
|
77
|
-
$borderRadius?: (string | number) | undefined;
|
|
78
|
-
$boxShadow?: string | undefined;
|
|
79
|
-
$gap?: (string | number) | undefined;
|
|
15
|
+
export declare const Arrow: import("styled-components").StyledComponent<"div", any, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
|
|
16
|
+
$alignContent?: import("@pushwoosh/kit-helpers/styled-helpers").AlignContentValue | undefined;
|
|
17
|
+
$alignItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
18
|
+
$gap?: import("@pushwoosh/kit-helpers/styled-helpers").StrNum | undefined;
|
|
19
|
+
$justifyContent?: import("@pushwoosh/kit-helpers/styled-helpers").JustifyContentValue | undefined;
|
|
20
|
+
} & {
|
|
80
21
|
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
81
|
-
$
|
|
82
|
-
$
|
|
83
|
-
$margin?: (string | number) | ({
|
|
84
|
-
top?: (string | number) | undefined;
|
|
85
|
-
right?: (string | number) | undefined;
|
|
86
|
-
bottom?: (string | number) | undefined;
|
|
87
|
-
left?: (string | number) | undefined;
|
|
88
|
-
} | {
|
|
89
|
-
horizontal: string | number;
|
|
90
|
-
top?: (string | number) | undefined;
|
|
91
|
-
bottom?: (string | number) | undefined;
|
|
92
|
-
} | {
|
|
93
|
-
vertical: string | number;
|
|
94
|
-
right?: (string | number) | undefined;
|
|
95
|
-
left?: (string | number) | undefined;
|
|
96
|
-
}) | undefined;
|
|
97
|
-
$padding?: (string | number) | ({
|
|
98
|
-
top?: (string | number) | undefined;
|
|
99
|
-
right?: (string | number) | undefined;
|
|
100
|
-
bottom?: (string | number) | undefined;
|
|
101
|
-
left?: (string | number) | undefined;
|
|
102
|
-
} | {
|
|
103
|
-
horizontal: string | number;
|
|
104
|
-
top?: (string | number) | undefined;
|
|
105
|
-
bottom?: (string | number) | undefined;
|
|
106
|
-
} | {
|
|
107
|
-
vertical: string | number;
|
|
108
|
-
right?: (string | number) | undefined;
|
|
109
|
-
left?: (string | number) | undefined;
|
|
110
|
-
}) | undefined;
|
|
111
|
-
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
22
|
+
$justifyItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
23
|
+
$placeItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
112
24
|
} & {
|
|
113
25
|
$gridAutoFlow: string;
|
|
114
26
|
} & {
|
|
@@ -1,117 +1,29 @@
|
|
|
1
1
|
import { Color, Shadow, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
2
|
-
export declare const SimpleTagPickerDiv: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
-
$alignContent?: "
|
|
4
|
-
$alignItems?: "
|
|
5
|
-
$
|
|
6
|
-
$
|
|
7
|
-
|
|
8
|
-
right?: string | undefined;
|
|
9
|
-
bottom?: string | undefined;
|
|
10
|
-
left?: string | undefined;
|
|
11
|
-
} | {
|
|
12
|
-
horizontal: string;
|
|
13
|
-
top?: string | undefined;
|
|
14
|
-
bottom?: string | undefined;
|
|
15
|
-
} | {
|
|
16
|
-
vertical: string;
|
|
17
|
-
right?: string | undefined;
|
|
18
|
-
left?: string | undefined;
|
|
19
|
-
}) | undefined;
|
|
20
|
-
$borderRadius?: (string | number) | undefined;
|
|
21
|
-
$boxShadow?: string | undefined;
|
|
22
|
-
$gap?: (string | number) | undefined;
|
|
2
|
+
export declare const SimpleTagPickerDiv: import("styled-components").StyledComponent<"div", any, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
|
|
3
|
+
$alignContent?: import("@pushwoosh/kit-helpers/styled-helpers").AlignContentValue | undefined;
|
|
4
|
+
$alignItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
5
|
+
$gap?: import("@pushwoosh/kit-helpers/styled-helpers").StrNum | undefined;
|
|
6
|
+
$justifyContent?: import("@pushwoosh/kit-helpers/styled-helpers").JustifyContentValue | undefined;
|
|
7
|
+
} & {
|
|
23
8
|
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
24
|
-
$
|
|
25
|
-
$
|
|
26
|
-
$margin?: (string | number) | ({
|
|
27
|
-
top?: (string | number) | undefined;
|
|
28
|
-
right?: (string | number) | undefined;
|
|
29
|
-
bottom?: (string | number) | undefined;
|
|
30
|
-
left?: (string | number) | undefined;
|
|
31
|
-
} | {
|
|
32
|
-
horizontal: string | number;
|
|
33
|
-
top?: (string | number) | undefined;
|
|
34
|
-
bottom?: (string | number) | undefined;
|
|
35
|
-
} | {
|
|
36
|
-
vertical: string | number;
|
|
37
|
-
right?: (string | number) | undefined;
|
|
38
|
-
left?: (string | number) | undefined;
|
|
39
|
-
}) | undefined;
|
|
40
|
-
$padding?: (string | number) | ({
|
|
41
|
-
top?: (string | number) | undefined;
|
|
42
|
-
right?: (string | number) | undefined;
|
|
43
|
-
bottom?: (string | number) | undefined;
|
|
44
|
-
left?: (string | number) | undefined;
|
|
45
|
-
} | {
|
|
46
|
-
horizontal: string | number;
|
|
47
|
-
top?: (string | number) | undefined;
|
|
48
|
-
bottom?: (string | number) | undefined;
|
|
49
|
-
} | {
|
|
50
|
-
vertical: string | number;
|
|
51
|
-
right?: (string | number) | undefined;
|
|
52
|
-
left?: (string | number) | undefined;
|
|
53
|
-
}) | undefined;
|
|
54
|
-
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
9
|
+
$justifyItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
10
|
+
$placeItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
55
11
|
} & {
|
|
56
12
|
$gridAutoFlow: string;
|
|
57
13
|
} & {
|
|
58
14
|
$gap: number;
|
|
59
15
|
$padding: number;
|
|
60
16
|
$borderRadius: ShapeRadius;
|
|
61
|
-
}, "$gridAutoFlow" | "$borderRadius" | "$
|
|
62
|
-
export declare const VariedTagPickerDiv: import("styled-components").StyledComponent<"div", any, {
|
|
63
|
-
$alignContent?: "
|
|
64
|
-
$alignItems?: "
|
|
65
|
-
$
|
|
66
|
-
$
|
|
67
|
-
|
|
68
|
-
right?: string | undefined;
|
|
69
|
-
bottom?: string | undefined;
|
|
70
|
-
left?: string | undefined;
|
|
71
|
-
} | {
|
|
72
|
-
horizontal: string;
|
|
73
|
-
top?: string | undefined;
|
|
74
|
-
bottom?: string | undefined;
|
|
75
|
-
} | {
|
|
76
|
-
vertical: string;
|
|
77
|
-
right?: string | undefined;
|
|
78
|
-
left?: string | undefined;
|
|
79
|
-
}) | undefined;
|
|
80
|
-
$borderRadius?: (string | number) | undefined;
|
|
81
|
-
$boxShadow?: string | undefined;
|
|
82
|
-
$gap?: (string | number) | undefined;
|
|
17
|
+
}, "$gridAutoFlow" | "$borderRadius" | "$padding" | "$gap">;
|
|
18
|
+
export declare const VariedTagPickerDiv: import("styled-components").StyledComponent<"div", any, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
|
|
19
|
+
$alignContent?: import("@pushwoosh/kit-helpers/styled-helpers").AlignContentValue | undefined;
|
|
20
|
+
$alignItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
21
|
+
$gap?: import("@pushwoosh/kit-helpers/styled-helpers").StrNum | undefined;
|
|
22
|
+
$justifyContent?: import("@pushwoosh/kit-helpers/styled-helpers").JustifyContentValue | undefined;
|
|
23
|
+
} & {
|
|
83
24
|
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
84
|
-
$
|
|
85
|
-
$
|
|
86
|
-
$margin?: (string | number) | ({
|
|
87
|
-
top?: (string | number) | undefined;
|
|
88
|
-
right?: (string | number) | undefined;
|
|
89
|
-
bottom?: (string | number) | undefined;
|
|
90
|
-
left?: (string | number) | undefined;
|
|
91
|
-
} | {
|
|
92
|
-
horizontal: string | number;
|
|
93
|
-
top?: (string | number) | undefined;
|
|
94
|
-
bottom?: (string | number) | undefined;
|
|
95
|
-
} | {
|
|
96
|
-
vertical: string | number;
|
|
97
|
-
right?: (string | number) | undefined;
|
|
98
|
-
left?: (string | number) | undefined;
|
|
99
|
-
}) | undefined;
|
|
100
|
-
$padding?: (string | number) | ({
|
|
101
|
-
top?: (string | number) | undefined;
|
|
102
|
-
right?: (string | number) | undefined;
|
|
103
|
-
bottom?: (string | number) | undefined;
|
|
104
|
-
left?: (string | number) | undefined;
|
|
105
|
-
} | {
|
|
106
|
-
horizontal: string | number;
|
|
107
|
-
top?: (string | number) | undefined;
|
|
108
|
-
bottom?: (string | number) | undefined;
|
|
109
|
-
} | {
|
|
110
|
-
vertical: string | number;
|
|
111
|
-
right?: (string | number) | undefined;
|
|
112
|
-
left?: (string | number) | undefined;
|
|
113
|
-
}) | undefined;
|
|
114
|
-
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
25
|
+
$justifyItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
26
|
+
$placeItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
115
27
|
} & {
|
|
116
28
|
$gridAutoFlow: string;
|
|
117
29
|
} & {
|
|
@@ -122,4 +34,4 @@ export declare const VariedTagPickerDiv: import("styled-components").StyledCompo
|
|
|
122
34
|
$border: string;
|
|
123
35
|
$bgColor: Color;
|
|
124
36
|
$boxShadow: Shadow;
|
|
125
|
-
}, "$gridAutoFlow" | "$bgColor" | "$border" | "$borderRadius" | "$boxShadow" | "$
|
|
37
|
+
}, "$gridAutoFlow" | "$bgColor" | "$border" | "$borderRadius" | "$boxShadow" | "$padding" | "$gap">;
|
|
@@ -83,7 +83,8 @@ export const ExportCsvBanner = ({
|
|
|
83
83
|
hide();
|
|
84
84
|
onClose === null || onClose === void 0 || onClose();
|
|
85
85
|
}, [hide, onClose]);
|
|
86
|
-
|
|
86
|
+
const hasRenderableContent = exportTask && ['STATUS_SUCCESS', 'STATUS_PENDING', 'STATUS_FAILED'].includes(exportTask.status);
|
|
87
|
+
if (!exportTask || isHidden || !hasRenderableContent) return null;
|
|
87
88
|
const {
|
|
88
89
|
filename,
|
|
89
90
|
status,
|
|
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { Button, ModalHeader, ModalBody, ModalFooter, ModalTitle } from '@pushwoosh/dumb-components';
|
|
3
3
|
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
4
4
|
import { LanguagesSelectFormLoader } from './LanguagesSelectFormLoader';
|
|
5
|
+
import { useLang } from './polyglot';
|
|
5
6
|
import { saveLastSelection } from './utils';
|
|
6
7
|
export const LanguagesModal = ({
|
|
7
8
|
applicationCode,
|
|
@@ -9,8 +10,11 @@ export const LanguagesModal = ({
|
|
|
9
10
|
onSubmit,
|
|
10
11
|
onClose
|
|
11
12
|
}) => {
|
|
13
|
+
const lang = useLang();
|
|
12
14
|
const [selectedLanguages, setSelectedLanguages] = useState(initialLanguages);
|
|
13
|
-
return React.createElement(React.Fragment, null, React.createElement(ModalHeader, null, React.createElement(ModalTitle, null,
|
|
15
|
+
return React.createElement(React.Fragment, null, React.createElement(ModalHeader, null, React.createElement(ModalTitle, null, lang({
|
|
16
|
+
message: 'SMART.LANGUAGES_SELECTOR.MODAL.TITLE'
|
|
17
|
+
}))), React.createElement(ModalBody, null, React.createElement(LanguagesSelectFormLoader, {
|
|
14
18
|
application: applicationCode,
|
|
15
19
|
onChange: setSelectedLanguages,
|
|
16
20
|
value: selectedLanguages
|
|
@@ -20,11 +24,15 @@ export const LanguagesModal = ({
|
|
|
20
24
|
}, React.createElement(Button, {
|
|
21
25
|
color: "secondary",
|
|
22
26
|
onClick: onClose
|
|
23
|
-
},
|
|
27
|
+
}, lang({
|
|
28
|
+
message: 'SMART.LANGUAGES_SELECTOR.BUTTON.CANCEL'
|
|
29
|
+
})), React.createElement(Button, {
|
|
24
30
|
color: "primary",
|
|
25
31
|
onClick: () => {
|
|
26
32
|
saveLastSelection(selectedLanguages);
|
|
27
33
|
onSubmit(selectedLanguages);
|
|
28
34
|
}
|
|
29
|
-
},
|
|
35
|
+
}, lang({
|
|
36
|
+
message: 'SMART.LANGUAGES_SELECTOR.BUTTON.APPLY'
|
|
37
|
+
})))));
|
|
30
38
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import { Checkbox, SearchInput } from '@pushwoosh/dumb-components';
|
|
3
3
|
import { Columns, Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { useLang } from './polyglot';
|
|
4
5
|
import { ActionButton } from './styled';
|
|
5
6
|
import { fetchLastSelection, useGetLangName } from './utils';
|
|
6
7
|
export const LanguagesSelectForm = ({
|
|
@@ -9,17 +10,18 @@ export const LanguagesSelectForm = ({
|
|
|
9
10
|
onChange,
|
|
10
11
|
systemLanguage = 'en'
|
|
11
12
|
}) => {
|
|
13
|
+
const lang = useLang();
|
|
12
14
|
const getLangName = useGetLangName(systemLanguage);
|
|
13
15
|
const [lastSelection] = useState(fetchLastSelection);
|
|
14
16
|
const [search, setSearch] = useState('');
|
|
15
17
|
const [showAllLanguages, setShowAllLanguages] = useState(false);
|
|
16
18
|
const filteredLanguages = useMemo(() => {
|
|
17
|
-
const languageItems = showAllLanguages ? allLanguageItems : allLanguageItems.filter(
|
|
19
|
+
const languageItems = showAllLanguages ? allLanguageItems : allLanguageItems.filter(item => item.subscribers > 0 || langs.includes(item.code));
|
|
18
20
|
if (!search) {
|
|
19
21
|
return languageItems;
|
|
20
22
|
}
|
|
21
|
-
return languageItems.filter(
|
|
22
|
-
return
|
|
23
|
+
return languageItems.filter(item => {
|
|
24
|
+
return item.name.toLowerCase().includes(search.toLowerCase());
|
|
23
25
|
});
|
|
24
26
|
}, [allLanguageItems, search, showAllLanguages, langs]);
|
|
25
27
|
return React.createElement(Vertical, {
|
|
@@ -28,7 +30,9 @@ export const LanguagesSelectForm = ({
|
|
|
28
30
|
value: search,
|
|
29
31
|
onChange: e => setSearch(e.target.value),
|
|
30
32
|
"$onClear": () => setSearch(''),
|
|
31
|
-
placeholder:
|
|
33
|
+
placeholder: lang({
|
|
34
|
+
message: 'SMART.LANGUAGES_SELECTOR.SEARCH_PLACEHOLDER'
|
|
35
|
+
})
|
|
32
36
|
}), React.createElement(Horizontal, {
|
|
33
37
|
"$justifyContent": "space-between"
|
|
34
38
|
}, React.createElement(Horizontal, {
|
|
@@ -36,35 +40,49 @@ export const LanguagesSelectForm = ({
|
|
|
36
40
|
"$justifyContent": "start"
|
|
37
41
|
}, React.createElement(ActionButton, {
|
|
38
42
|
onClick: () => {
|
|
39
|
-
onChange(filteredLanguages.map(
|
|
43
|
+
onChange(filteredLanguages.map(item => item.code));
|
|
40
44
|
}
|
|
41
|
-
},
|
|
45
|
+
}, lang({
|
|
46
|
+
message: 'SMART.LANGUAGES_SELECTOR.ACTION.SELECT_ALL'
|
|
47
|
+
})), React.createElement(ActionButton, {
|
|
42
48
|
onClick: () => {
|
|
43
49
|
onChange([]);
|
|
44
50
|
}
|
|
45
|
-
},
|
|
51
|
+
}, lang({
|
|
52
|
+
message: 'SMART.LANGUAGES_SELECTOR.ACTION.DESELECT_ALL'
|
|
53
|
+
}))), lastSelection.length > 0 && React.createElement(ActionButton, {
|
|
46
54
|
onClick: () => {
|
|
47
55
|
onChange(lastSelection);
|
|
48
56
|
}
|
|
49
|
-
},
|
|
57
|
+
}, lang({
|
|
58
|
+
message: 'SMART.LANGUAGES_SELECTOR.ACTION.REUSE_LAST'
|
|
59
|
+
}))), React.createElement(Vertical, {
|
|
50
60
|
"$gap": 24
|
|
51
61
|
}, React.createElement(Columns, {
|
|
52
62
|
"$sizes": 3,
|
|
53
63
|
"$gap": 8
|
|
54
|
-
}, filteredLanguages.map(
|
|
64
|
+
}, filteredLanguages.map(item => React.createElement(Checkbox, {
|
|
55
65
|
name: "languages",
|
|
56
|
-
value:
|
|
57
|
-
isChecked: langs.includes(
|
|
66
|
+
value: item.code,
|
|
67
|
+
isChecked: langs.includes(item.code),
|
|
58
68
|
onChange: isChecked => {
|
|
59
69
|
if (isChecked) {
|
|
60
|
-
onChange([...langs,
|
|
70
|
+
onChange([...langs, item.code]);
|
|
61
71
|
} else {
|
|
62
|
-
onChange(langs.filter(code => code !==
|
|
72
|
+
onChange(langs.filter(code => code !== item.code));
|
|
63
73
|
}
|
|
64
74
|
},
|
|
65
|
-
label:
|
|
66
|
-
|
|
75
|
+
label: lang({
|
|
76
|
+
message: 'SMART.LANGUAGES_SELECTOR.CHECKBOX_LABEL',
|
|
77
|
+
name: getLangName(item.code),
|
|
78
|
+
subscribers: item.subscribers
|
|
79
|
+
}),
|
|
80
|
+
key: item.code
|
|
67
81
|
}))), React.createElement("div", null, React.createElement(ActionButton, {
|
|
68
82
|
onClick: () => setShowAllLanguages(x => !x)
|
|
69
|
-
}, showAllLanguages ?
|
|
83
|
+
}, showAllLanguages ? lang({
|
|
84
|
+
message: 'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_WITH_SUBSCRIBERS'
|
|
85
|
+
}) : lang({
|
|
86
|
+
message: 'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_ALL'
|
|
87
|
+
})))));
|
|
70
88
|
};
|
|
@@ -3,6 +3,7 @@ import { Button, Modal, DropdownMenu, DropdownMenuItem, DropdownMenuSection } fr
|
|
|
3
3
|
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
4
4
|
import { ArrowIcon, ChevronIcon, LanguageIcon, PlusIcon } from '@pushwoosh/kit-icons';
|
|
5
5
|
import { LanguagesModal } from './LanguagesModal';
|
|
6
|
+
import { useLang } from './polyglot';
|
|
6
7
|
import { ButtonGroup } from './styled';
|
|
7
8
|
import { useGetLangName } from './utils';
|
|
8
9
|
export const LanguagesSelector = ({
|
|
@@ -14,9 +15,10 @@ export const LanguagesSelector = ({
|
|
|
14
15
|
onChangeLanguages
|
|
15
16
|
}) => {
|
|
16
17
|
const [showLanguagesModal, setShowLanguagesModal] = useState(false);
|
|
18
|
+
const lang = useLang();
|
|
17
19
|
const getLangName = useGetLangName('en');
|
|
18
20
|
const sortedLanguages = useMemo(() => {
|
|
19
|
-
const sorted = languages.filter(
|
|
21
|
+
const sorted = languages.filter(code => code !== 'default').sort((a, b) => getLangName(a).localeCompare(getLangName(b), 'en', {
|
|
20
22
|
sensitivity: 'base'
|
|
21
23
|
}));
|
|
22
24
|
return ['default', ...sorted];
|
|
@@ -45,11 +47,13 @@ export const LanguagesSelector = ({
|
|
|
45
47
|
}, getLangName(value))
|
|
46
48
|
}, () => React.createElement(React.Fragment, null, React.createElement(DropdownMenuSection, null, React.createElement(DropdownMenuItem, {
|
|
47
49
|
onClick: () => setShowLanguagesModal(true)
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
}, lang({
|
|
51
|
+
message: 'SMART.LANGUAGES_SELECTOR.CHOOSE_LANGUAGES'
|
|
52
|
+
}))), React.createElement(DropdownMenuSection, null, sortedLanguages.map(code => React.createElement(DropdownMenuItem, {
|
|
53
|
+
key: code,
|
|
54
|
+
isActive: code === value,
|
|
55
|
+
onClick: () => onChange(code)
|
|
56
|
+
}, getLangName(code)))))), sortedLanguages.length > 1 && React.createElement(ButtonGroup, null, React.createElement(Button, {
|
|
53
57
|
color: "secondary",
|
|
54
58
|
isDisabled: isDisabled,
|
|
55
59
|
icon: React.createElement(ArrowIcon, {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { type LanguagesSelectorMessages } from './types';
|
|
2
|
+
export declare const Lang: import("react").FC<import("@pushwoosh/dumb-components/polyglot").LangProps<LanguagesSelectorMessages>>, useLang: () => (props: import("@pushwoosh/dumb-components/polyglot").LangProps<LanguagesSelectorMessages>) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const messages = {
|
|
2
|
+
'SMART.LANGUAGES_SELECTOR.MODAL.TITLE': 'Select languages',
|
|
3
|
+
'SMART.LANGUAGES_SELECTOR.BUTTON.CANCEL': 'Cancel',
|
|
4
|
+
'SMART.LANGUAGES_SELECTOR.BUTTON.APPLY': 'Apply',
|
|
5
|
+
'SMART.LANGUAGES_SELECTOR.SEARCH_PLACEHOLDER': 'Search languages...',
|
|
6
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.SELECT_ALL': 'select all',
|
|
7
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.DESELECT_ALL': 'deselect all',
|
|
8
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.REUSE_LAST': 'reuse last selection',
|
|
9
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_ALL': 'Show all languages',
|
|
10
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_WITH_SUBSCRIBERS': 'Show only languages with subscribers',
|
|
11
|
+
'SMART.LANGUAGES_SELECTOR.CHECKBOX_LABEL': '{{name}} ({{subscribers}})',
|
|
12
|
+
'SMART.LANGUAGES_SELECTOR.CHOOSE_LANGUAGES': 'Choose languages…'
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const messages = {
|
|
2
|
+
'SMART.LANGUAGES_SELECTOR.MODAL.TITLE': 'Выберите языки',
|
|
3
|
+
'SMART.LANGUAGES_SELECTOR.BUTTON.CANCEL': 'Отмена',
|
|
4
|
+
'SMART.LANGUAGES_SELECTOR.BUTTON.APPLY': 'Применить',
|
|
5
|
+
'SMART.LANGUAGES_SELECTOR.SEARCH_PLACEHOLDER': 'Поиск языков...',
|
|
6
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.SELECT_ALL': 'выбрать все',
|
|
7
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.DESELECT_ALL': 'снять все',
|
|
8
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.REUSE_LAST': 'повторить прошлый выбор',
|
|
9
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_ALL': 'Показать все языки',
|
|
10
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_WITH_SUBSCRIBERS': 'Только языки с подписчиками',
|
|
11
|
+
'SMART.LANGUAGES_SELECTOR.CHECKBOX_LABEL': '{{name}} ({{subscribers}})',
|
|
12
|
+
'SMART.LANGUAGES_SELECTOR.CHOOSE_LANGUAGES': 'Выбрать языки…'
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NoParams } from '@pushwoosh/dumb-components/polyglot';
|
|
2
|
+
export type LanguagesSelectorMessages = {
|
|
3
|
+
'SMART.LANGUAGES_SELECTOR.MODAL.TITLE': NoParams;
|
|
4
|
+
'SMART.LANGUAGES_SELECTOR.BUTTON.CANCEL': NoParams;
|
|
5
|
+
'SMART.LANGUAGES_SELECTOR.BUTTON.APPLY': NoParams;
|
|
6
|
+
'SMART.LANGUAGES_SELECTOR.SEARCH_PLACEHOLDER': NoParams;
|
|
7
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.SELECT_ALL': NoParams;
|
|
8
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.DESELECT_ALL': NoParams;
|
|
9
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.REUSE_LAST': NoParams;
|
|
10
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_ALL': NoParams;
|
|
11
|
+
'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_WITH_SUBSCRIBERS': NoParams;
|
|
12
|
+
'SMART.LANGUAGES_SELECTOR.CHECKBOX_LABEL': {
|
|
13
|
+
name: string;
|
|
14
|
+
subscribers: number;
|
|
15
|
+
};
|
|
16
|
+
'SMART.LANGUAGES_SELECTOR.CHOOSE_LANGUAGES': NoParams;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|