@pushwoosh/smart-components-kit 1.0.90 → 1.1.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 (58) hide show
  1. package/CampaignsConfigurationDrawer/CampaignsConfigurationDrawer.d.ts +1 -2
  2. package/CampaignsConfigurationDrawer/CampaignsConfigurationDrawer.js +103 -88
  3. package/CampaignsConfigurationDrawer/components/Card/Card.d.ts +1 -2
  4. package/CampaignsConfigurationDrawer/components/Card/Card.js +19 -13
  5. package/DocsButton/DocsButton.d.ts +1 -2
  6. package/DocsButton/DocsButton.js +21 -18
  7. package/DynamicContentPicker/DynamicContentPicker.js +76 -63
  8. package/DynamicContentPicker/Line.js +24 -22
  9. package/DynamicContentPickerForm/DynamicContentCustomPickerForm.js +18 -17
  10. package/DynamicContentPickerForm/DynamicContentEventPickerForm.js +60 -57
  11. package/DynamicContentPickerForm/DynamicContentTagPickerForm.js +60 -57
  12. package/DynamicContentPickerForm/SimpleDynamicContentPickerFormSmart.js +72 -63
  13. package/DynamicContentPickerForm/VariedDynamicContentPickerFormSmart.js +86 -74
  14. package/EmailTemplatePreview/EmailTemplatePreview.js +8 -6
  15. package/ExportCSV/ExportCsvBanner/ExportCsvBanner.d.ts +1 -2
  16. package/ExportCSV/ExportCsvBanner/ExportCsvBanner.js +54 -49
  17. package/ExportCSV/useExportService/useExportService.js +1 -0
  18. package/LanguagesSelector/LanguagesModal.js +38 -24
  19. package/LanguagesSelector/LanguagesSelectForm.js +73 -62
  20. package/LanguagesSelector/LanguagesSelectFormLoader.js +8 -7
  21. package/LanguagesSelector/LanguagesSelector.js +92 -78
  22. package/MediaStore/CreateVariantDrawer.js +134 -85
  23. package/MediaStore/MediaStore.js +137 -112
  24. package/ModalCloningJourney/ModalCloningJourney.d.ts +1 -2
  25. package/ModalCloningJourney/ModalCloningJourney.js +113 -91
  26. package/OpenActions/components/OpenActionsSummary/OpenActionsSummary.d.ts +1 -2
  27. package/OpenActions/components/OpenActionsSummary/OpenActionsSummary.js +98 -78
  28. package/OpenActions/components/OpenActionsSummaryByPreset.d.ts +1 -2
  29. package/OpenActions/components/OpenActionsSummaryByPreset.js +2 -2
  30. package/PlatformsConfigurationDrawer/PlatformsConfigurationDrawer.js +21 -17
  31. package/PlatformsConfigurationDrawer/components/DesktopPage/DesktopPage.js +112 -75
  32. package/PlatformsConfigurationDrawer/components/MainPage/MainPage.js +155 -101
  33. package/PlatformsConfigurationDrawer/components/MobilePage/MobilePage.js +138 -91
  34. package/ResendModal/ResendModal.d.ts +1 -2
  35. package/ResendModal/ResendModal.js +92 -72
  36. package/RichMessageEditorSmart/NewDynamicContentForm.js +16 -12
  37. package/RichMessageEditorSmart/RichMessageEditorSmart.js +4 -4
  38. package/SystemParcel/SystemParcel.d.ts +3 -3
  39. package/SystemParcel/SystemParcel.js +3 -2
  40. package/Table/components/DataTable/DataTable.js +80 -61
  41. package/Table/components/DataTableGetContext/DataTableGetContext.d.ts +1 -2
  42. package/Table/components/DataTableGetContext/DataTableGetContext.js +5 -2
  43. package/Table/components/DataTableList/DataTableList.d.ts +1 -2
  44. package/Table/components/DataTableList/DataTableList.js +86 -68
  45. package/Table/components/DataTablePagination/DataTablePagination.js +6 -4
  46. package/Table/components/DataTableSearchInput/DataTableSearchInput.js +3 -2
  47. package/Table/components/DataTableSortableCell/DataTableSortableCell.js +6 -4
  48. package/Table/components/Loading/Loading.d.ts +1 -2
  49. package/Table/components/Loading/Loading.js +16 -14
  50. package/Table/components/TablePagination/TablePagination.js +31 -25
  51. package/_devel/index.js +36 -24
  52. package/_devel/lib/dynamic-content-picker.d.ts +1 -2
  53. package/_devel/lib/dynamic-content-picker.js +16 -10
  54. package/_devel/lib/index.d.ts +2 -2
  55. package/_devel/lib/index.js +38 -19
  56. package/_devel/test-place.d.ts +1 -2
  57. package/_devel/test-place.js +4 -2
  58. package/package.json +2 -2
@@ -1,4 +1,5 @@
1
- import React, { useCallback, useEffect } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useEffect } from 'react';
2
3
  import { ExportResult, ProgressBar, Button } from '@pushwoosh/dumb-components';
3
4
  import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
4
5
  import { Horizontal } from '@pushwoosh/kit-helpers';
@@ -97,57 +98,61 @@ export const ExportCsvBanner = ({
97
98
  resultSubTitle,
98
99
  progressTitle
99
100
  } = exportTask;
100
- return React.createElement(Horizontal, {
101
+ return _jsxs(Horizontal, {
101
102
  "$padding": 8,
102
103
  "$alignItems": "center",
103
104
  "$border": `1px solid ${Color.DIVIDER}`,
104
105
  "$borderRadius": ShapeRadius.SECTION,
105
- "$bgColor": Color.CLEAR
106
- }, status === 'STATUS_SUCCESS' && React.createElement(ExportResult, {
107
- type: "success",
108
- title: lang({
109
- message: 'SMART.EXPORT_CSV.SUCCESS_TITLE'
110
- }),
111
- subtitle: `${resultSubTitle} ${filename}`,
112
- handleClose: handleClose,
113
- rightSlot: React.createElement("a", {
114
- href: `/api/v2/statistics/exportMessagesStatistics/download/${filename}`,
115
- download: filename
116
- }, React.createElement(Button, {
117
- color: "secondary",
118
- size: "compact",
119
- icon: React.createElement(DownloadIcon, {
120
- size: "small",
121
- view: "filled"
106
+ "$bgColor": Color.CLEAR,
107
+ children: [status === 'STATUS_SUCCESS' && _jsx(ExportResult, {
108
+ type: "success",
109
+ title: lang({
110
+ message: 'SMART.EXPORT_CSV.SUCCESS_TITLE'
111
+ }),
112
+ subtitle: `${resultSubTitle} ${filename}`,
113
+ handleClose: handleClose,
114
+ rightSlot: _jsx("a", {
115
+ href: `/api/v2/statistics/exportMessagesStatistics/download/${filename}`,
116
+ download: filename,
117
+ children: _jsx(Button, {
118
+ color: "secondary",
119
+ size: "compact",
120
+ icon: _jsx(DownloadIcon, {
121
+ size: "small",
122
+ view: "filled"
123
+ }),
124
+ children: lang({
125
+ message: 'SMART.EXPORT_CSV.DOWNLOAD'
126
+ })
127
+ })
128
+ })
129
+ }), status === 'STATUS_PENDING' && (isKeepPageOpenWarning ? _jsx(ProgressBar, {
130
+ title: progressTitle,
131
+ percentValue: progress,
132
+ rightSlot: _jsx(Text, {
133
+ "$color": Color.WARNING,
134
+ "$variant": "h5",
135
+ "$uppercase": true,
136
+ children: lang({
137
+ message: 'SMART.EXPORT_CSV.KEEP_PAGE_OPEN'
138
+ })
122
139
  })
123
- }, lang({
124
- message: 'SMART.EXPORT_CSV.DOWNLOAD'
125
- })))
126
- }), status === 'STATUS_PENDING' && (isKeepPageOpenWarning ? React.createElement(ProgressBar, {
127
- title: progressTitle,
128
- percentValue: progress,
129
- rightSlot: React.createElement(Text, {
130
- "$color": Color.WARNING,
131
- "$variant": "h5",
132
- "$uppercase": true
133
- }, lang({
134
- message: 'SMART.EXPORT_CSV.KEEP_PAGE_OPEN'
135
- }))
136
- }) : React.createElement(ProgressBar, {
137
- title: progressTitle,
138
- percentValue: progress
139
- })), status === 'STATUS_FAILED' && React.createElement(ExportResult, {
140
- type: "error",
141
- title: lang({
142
- message: 'SMART.EXPORT_CSV.FAILED_TITLE'
143
- }),
144
- subtitle: lang({
145
- message: 'SMART.EXPORT_CSV.FAILED_SUBTITLE'
146
- }),
147
- leftSlotIcon: React.createElement(DangerTriangleIcon, {
148
- size: "medium",
149
- view: "filled"
150
- }),
151
- handleClose: handleClose
152
- }));
140
+ }) : _jsx(ProgressBar, {
141
+ title: progressTitle,
142
+ percentValue: progress
143
+ })), status === 'STATUS_FAILED' && _jsx(ExportResult, {
144
+ type: "error",
145
+ title: lang({
146
+ message: 'SMART.EXPORT_CSV.FAILED_TITLE'
147
+ }),
148
+ subtitle: lang({
149
+ message: 'SMART.EXPORT_CSV.FAILED_SUBTITLE'
150
+ }),
151
+ leftSlotIcon: _jsx(DangerTriangleIcon, {
152
+ size: "medium",
153
+ view: "filled"
154
+ }),
155
+ handleClose: handleClose
156
+ })]
157
+ });
153
158
  };
@@ -60,6 +60,7 @@ export const useExportService = () => {
60
60
  if (retriesRef.current < MAX_RETRIES) {
61
61
  retriesRef.current += 1;
62
62
  timeoutStatusRef.current = setTimeout(() => {
63
+ // eslint-disable-next-line react-hooks/immutability
63
64
  getStatus(params);
64
65
  clearStatusTimeout();
65
66
  }, API_CHECK_INTERVAL);
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
2
3
  import { Button, ModalHeader, ModalBody, ModalFooter, ModalTitle } from '@pushwoosh/dumb-components';
3
4
  import { Horizontal } from '@pushwoosh/kit-helpers';
4
5
  import { LanguagesSelectFormLoader } from './LanguagesSelectFormLoader';
@@ -12,27 +13,40 @@ export const LanguagesModal = ({
12
13
  }) => {
13
14
  const lang = useLang();
14
15
  const [selectedLanguages, setSelectedLanguages] = useState(initialLanguages);
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, {
18
- application: applicationCode,
19
- onChange: setSelectedLanguages,
20
- value: selectedLanguages
21
- })), React.createElement(ModalFooter, null, React.createElement(Horizontal, {
22
- "$justifyContent": "end",
23
- "$gap": 8
24
- }, React.createElement(Button, {
25
- color: "secondary",
26
- onClick: onClose
27
- }, lang({
28
- message: 'SMART.LANGUAGES_SELECTOR.BUTTON.CANCEL'
29
- })), React.createElement(Button, {
30
- color: "primary",
31
- onClick: () => {
32
- saveLastSelection(selectedLanguages);
33
- onSubmit(selectedLanguages);
34
- }
35
- }, lang({
36
- message: 'SMART.LANGUAGES_SELECTOR.BUTTON.APPLY'
37
- })))));
16
+ return _jsxs(_Fragment, {
17
+ children: [_jsx(ModalHeader, {
18
+ children: _jsx(ModalTitle, {
19
+ children: lang({
20
+ message: 'SMART.LANGUAGES_SELECTOR.MODAL.TITLE'
21
+ })
22
+ })
23
+ }), _jsx(ModalBody, {
24
+ children: _jsx(LanguagesSelectFormLoader, {
25
+ application: applicationCode,
26
+ onChange: setSelectedLanguages,
27
+ value: selectedLanguages
28
+ })
29
+ }), _jsx(ModalFooter, {
30
+ children: _jsxs(Horizontal, {
31
+ "$justifyContent": "end",
32
+ "$gap": 8,
33
+ children: [_jsx(Button, {
34
+ color: "secondary",
35
+ onClick: onClose,
36
+ children: lang({
37
+ message: 'SMART.LANGUAGES_SELECTOR.BUTTON.CANCEL'
38
+ })
39
+ }), _jsx(Button, {
40
+ color: "primary",
41
+ onClick: () => {
42
+ saveLastSelection(selectedLanguages);
43
+ onSubmit(selectedLanguages);
44
+ },
45
+ children: lang({
46
+ message: 'SMART.LANGUAGES_SELECTOR.BUTTON.APPLY'
47
+ })
48
+ })]
49
+ })
50
+ })]
51
+ });
38
52
  };
@@ -1,4 +1,5 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
2
3
  import { Checkbox, SearchInput } from '@pushwoosh/dumb-components';
3
4
  import { Columns, Horizontal, Vertical } from '@pushwoosh/kit-helpers';
4
5
  import { useLang } from './polyglot';
@@ -24,65 +25,75 @@ export const LanguagesSelectForm = ({
24
25
  return item.name.toLowerCase().includes(search.toLowerCase());
25
26
  });
26
27
  }, [allLanguageItems, search, showAllLanguages, langs]);
27
- return React.createElement(Vertical, {
28
- "$gap": 8
29
- }, React.createElement(SearchInput, {
30
- value: search,
31
- onChange: e => setSearch(e.target.value),
32
- "$onClear": () => setSearch(''),
33
- placeholder: lang({
34
- message: 'SMART.LANGUAGES_SELECTOR.SEARCH_PLACEHOLDER'
35
- })
36
- }), React.createElement(Horizontal, {
37
- "$justifyContent": "space-between"
38
- }, React.createElement(Horizontal, {
39
- "$gap": 16,
40
- "$justifyContent": "start"
41
- }, React.createElement(ActionButton, {
42
- onClick: () => {
43
- onChange(filteredLanguages.map(item => item.code));
44
- }
45
- }, lang({
46
- message: 'SMART.LANGUAGES_SELECTOR.ACTION.SELECT_ALL'
47
- })), React.createElement(ActionButton, {
48
- onClick: () => {
49
- onChange([]);
50
- }
51
- }, lang({
52
- message: 'SMART.LANGUAGES_SELECTOR.ACTION.DESELECT_ALL'
53
- }))), lastSelection.length > 0 && React.createElement(ActionButton, {
54
- onClick: () => {
55
- onChange(lastSelection);
56
- }
57
- }, lang({
58
- message: 'SMART.LANGUAGES_SELECTOR.ACTION.REUSE_LAST'
59
- }))), React.createElement(Vertical, {
60
- "$gap": 24
61
- }, React.createElement(Columns, {
62
- "$sizes": 3,
63
- "$gap": 8
64
- }, filteredLanguages.map(item => React.createElement(Checkbox, {
65
- name: "languages",
66
- value: item.code,
67
- isChecked: langs.includes(item.code),
68
- onChange: isChecked => {
69
- if (isChecked) {
70
- onChange([...langs, item.code]);
71
- } else {
72
- onChange(langs.filter(code => code !== item.code));
73
- }
74
- },
75
- label: lang({
76
- message: 'SMART.LANGUAGES_SELECTOR.CHECKBOX_LABEL',
77
- name: getLangName(item.code),
78
- subscribers: item.subscribers
79
- }),
80
- key: item.code
81
- }))), React.createElement("div", null, React.createElement(ActionButton, {
82
- onClick: () => setShowAllLanguages(x => !x)
83
- }, showAllLanguages ? lang({
84
- message: 'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_WITH_SUBSCRIBERS'
85
- }) : lang({
86
- message: 'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_ALL'
87
- })))));
28
+ return _jsxs(Vertical, {
29
+ "$gap": 8,
30
+ children: [_jsx(SearchInput, {
31
+ value: search,
32
+ onChange: e => setSearch(e.target.value),
33
+ "$onClear": () => setSearch(''),
34
+ placeholder: lang({
35
+ message: 'SMART.LANGUAGES_SELECTOR.SEARCH_PLACEHOLDER'
36
+ })
37
+ }), _jsxs(Horizontal, {
38
+ "$justifyContent": "space-between",
39
+ children: [_jsxs(Horizontal, {
40
+ "$gap": 16,
41
+ "$justifyContent": "start",
42
+ children: [_jsx(ActionButton, {
43
+ onClick: () => {
44
+ onChange(filteredLanguages.map(item => item.code));
45
+ },
46
+ children: lang({
47
+ message: 'SMART.LANGUAGES_SELECTOR.ACTION.SELECT_ALL'
48
+ })
49
+ }), _jsx(ActionButton, {
50
+ onClick: () => {
51
+ onChange([]);
52
+ },
53
+ children: lang({
54
+ message: 'SMART.LANGUAGES_SELECTOR.ACTION.DESELECT_ALL'
55
+ })
56
+ })]
57
+ }), lastSelection.length > 0 && _jsx(ActionButton, {
58
+ onClick: () => {
59
+ onChange(lastSelection);
60
+ },
61
+ children: lang({
62
+ message: 'SMART.LANGUAGES_SELECTOR.ACTION.REUSE_LAST'
63
+ })
64
+ })]
65
+ }), _jsxs(Vertical, {
66
+ "$gap": 24,
67
+ children: [_jsx(Columns, {
68
+ "$sizes": 3,
69
+ "$gap": 8,
70
+ children: filteredLanguages.map(item => _jsx(Checkbox, {
71
+ name: "languages",
72
+ value: item.code,
73
+ isChecked: langs.includes(item.code),
74
+ onChange: isChecked => {
75
+ if (isChecked) {
76
+ onChange([...langs, item.code]);
77
+ } else {
78
+ onChange(langs.filter(code => code !== item.code));
79
+ }
80
+ },
81
+ label: lang({
82
+ message: 'SMART.LANGUAGES_SELECTOR.CHECKBOX_LABEL',
83
+ name: getLangName(item.code),
84
+ subscribers: item.subscribers
85
+ })
86
+ }, item.code))
87
+ }), _jsx("div", {
88
+ children: _jsx(ActionButton, {
89
+ onClick: () => setShowAllLanguages(x => !x),
90
+ children: showAllLanguages ? lang({
91
+ message: 'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_WITH_SUBSCRIBERS'
92
+ }) : lang({
93
+ message: 'SMART.LANGUAGES_SELECTOR.ACTION.SHOW_ALL'
94
+ })
95
+ })
96
+ })]
97
+ })]
98
+ });
88
99
  };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Spinner } from '@pushwoosh/dumb-components';
3
3
  import { Horizontal, useAsync } from '@pushwoosh/kit-helpers';
4
4
  import { useSPAContext } from '@pushwoosh/spa-context';
@@ -38,14 +38,15 @@ export const LanguagesSelectFormLoader = ({
38
38
  });
39
39
  }, [application, getLangName, systemLanguage]);
40
40
  if (langAsync.loading) {
41
- return React.createElement(Horizontal, {
41
+ return _jsx(Horizontal, {
42
42
  "$placeItems": "center",
43
- "$padding": 36
44
- }, React.createElement(Spinner, {
45
- size: "medium"
46
- }));
43
+ "$padding": 36,
44
+ children: _jsx(Spinner, {
45
+ size: "medium"
46
+ })
47
+ });
47
48
  }
48
- return React.createElement(LanguagesSelectForm, {
49
+ return _jsx(LanguagesSelectForm, {
49
50
  allLanguageItems: langAsync.value,
50
51
  langs: value,
51
52
  onChange: onChange,
@@ -1,4 +1,5 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
2
3
  import { Button, Modal, DropdownMenu, DropdownMenuItem, DropdownMenuSection } from '@pushwoosh/dumb-components';
3
4
  import { Horizontal } from '@pushwoosh/kit-helpers';
4
5
  import { ArrowIcon, ChevronIcon, LanguageIcon, PlusIcon } from '@pushwoosh/kit-icons';
@@ -23,84 +24,97 @@ export const LanguagesSelector = ({
23
24
  }));
24
25
  return ['default', ...sorted];
25
26
  }, [getLangName, languages]);
26
- return React.createElement(Horizontal, {
27
- "$gap": 8
28
- }, React.createElement(DropdownMenu, {
29
- isScrollable: true,
30
- renderHandler: handlerProps => React.createElement(Button, {
31
- style: {
32
- minWidth: 200
33
- },
34
- color: "secondary",
35
- icon: React.createElement(LanguageIcon, {
36
- size: "medium",
37
- view: "lined"
27
+ return _jsxs(Horizontal, {
28
+ "$gap": 8,
29
+ children: [_jsx(DropdownMenu, {
30
+ isScrollable: true,
31
+ renderHandler: handlerProps => _jsx(Button, {
32
+ style: {
33
+ minWidth: 200
34
+ },
35
+ color: "secondary",
36
+ icon: _jsx(LanguageIcon, {
37
+ size: "medium",
38
+ view: "lined"
39
+ }),
40
+ rightIcon: _jsx(ChevronIcon, {
41
+ size: "medium",
42
+ direction: "down"
43
+ }),
44
+ onClick: handlerProps.onClick,
45
+ boxRef: handlerProps.ref,
46
+ isOpen: handlerProps.isOpen,
47
+ isDisabled: isDisabled,
48
+ children: getLangName(value)
38
49
  }),
39
- rightIcon: React.createElement(ChevronIcon, {
40
- size: "medium",
41
- direction: "down"
50
+ children: () => _jsxs(_Fragment, {
51
+ children: [_jsx(DropdownMenuSection, {
52
+ children: _jsx(DropdownMenuItem, {
53
+ onClick: () => setShowLanguagesModal(true),
54
+ children: lang({
55
+ message: 'SMART.LANGUAGES_SELECTOR.CHOOSE_LANGUAGES'
56
+ })
57
+ })
58
+ }), _jsx(DropdownMenuSection, {
59
+ children: sortedLanguages.map(code => _jsx(DropdownMenuItem, {
60
+ isActive: code === value,
61
+ onClick: () => onChange(code),
62
+ children: getLangName(code)
63
+ }, code))
64
+ })]
65
+ })
66
+ }), sortedLanguages.length > 1 && _jsxs(ButtonGroup, {
67
+ children: [_jsx(Button, {
68
+ color: "secondary",
69
+ isDisabled: isDisabled,
70
+ icon: _jsx(ArrowIcon, {
71
+ size: "medium",
72
+ direction: "left"
73
+ }),
74
+ onClick: () => {
75
+ const index = sortedLanguages.indexOf(value);
76
+ if (index > 0) {
77
+ onChange(sortedLanguages[index - 1]);
78
+ } else {
79
+ onChange(sortedLanguages[sortedLanguages.length - 1]);
80
+ }
81
+ }
82
+ }), _jsx(Button, {
83
+ color: "secondary",
84
+ isDisabled: isDisabled,
85
+ icon: _jsx(ArrowIcon, {
86
+ size: "medium",
87
+ direction: "right"
88
+ }),
89
+ onClick: () => {
90
+ const index = sortedLanguages.indexOf(value);
91
+ if (index < sortedLanguages.length - 1) {
92
+ onChange(sortedLanguages[index + 1]);
93
+ } else {
94
+ onChange(sortedLanguages[0]);
95
+ }
96
+ }
97
+ })]
98
+ }), sortedLanguages.length <= 1 && _jsx(Button, {
99
+ color: "secondary",
100
+ icon: _jsx(PlusIcon, {
101
+ size: "medium"
42
102
  }),
43
- onClick: handlerProps.onClick,
44
- boxRef: handlerProps.ref,
45
- isOpen: handlerProps.isOpen,
46
- isDisabled: isDisabled
47
- }, getLangName(value))
48
- }, () => React.createElement(React.Fragment, null, React.createElement(DropdownMenuSection, null, React.createElement(DropdownMenuItem, {
49
- onClick: () => setShowLanguagesModal(true)
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, {
57
- color: "secondary",
58
- isDisabled: isDisabled,
59
- icon: React.createElement(ArrowIcon, {
60
- size: "medium",
61
- direction: "left"
62
- }),
63
- onClick: () => {
64
- const index = sortedLanguages.indexOf(value);
65
- if (index > 0) {
66
- onChange(sortedLanguages[index - 1]);
67
- } else {
68
- onChange(sortedLanguages[sortedLanguages.length - 1]);
69
- }
70
- }
71
- }), React.createElement(Button, {
72
- color: "secondary",
73
- isDisabled: isDisabled,
74
- icon: React.createElement(ArrowIcon, {
103
+ onClick: () => setShowLanguagesModal(true)
104
+ }), _jsx(Modal, {
75
105
  size: "medium",
76
- direction: "right"
77
- }),
78
- onClick: () => {
79
- const index = sortedLanguages.indexOf(value);
80
- if (index < sortedLanguages.length - 1) {
81
- onChange(sortedLanguages[index + 1]);
82
- } else {
83
- onChange(sortedLanguages[0]);
84
- }
85
- }
86
- })), sortedLanguages.length <= 1 && React.createElement(Button, {
87
- color: "secondary",
88
- icon: React.createElement(PlusIcon, {
89
- size: "medium"
90
- }),
91
- onClick: () => setShowLanguagesModal(true)
92
- }), React.createElement(Modal, {
93
- size: "medium",
94
- isOpen: showLanguagesModal
95
- }, React.createElement(LanguagesModal, {
96
- applicationCode: applicationCode,
97
- initialLanguages: languages,
98
- onSubmit: langs => {
99
- onChangeLanguages(langs);
100
- setShowLanguagesModal(false);
101
- },
102
- onClose: () => {
103
- setShowLanguagesModal(false);
104
- }
105
- })));
106
+ isOpen: showLanguagesModal,
107
+ children: _jsx(LanguagesModal, {
108
+ applicationCode: applicationCode,
109
+ initialLanguages: languages,
110
+ onSubmit: langs => {
111
+ onChangeLanguages(langs);
112
+ setShowLanguagesModal(false);
113
+ },
114
+ onClose: () => {
115
+ setShowLanguagesModal(false);
116
+ }
117
+ })
118
+ })]
119
+ });
106
120
  };