@capillarytech/blaze-ui 6.1.0 → 6.1.2

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 (92) hide show
  1. package/.npmrc +3 -0
  2. package/CapCustomCheckboxList/styles.css +3 -3
  3. package/CapCustomCheckboxList/styles.scss +7 -8
  4. package/CapEventCalendar/CalendarCanvas/calendarCanvasStyles.css +21 -0
  5. package/CapEventCalendar/CalendarCanvas/calendarCanvasStyles.module.scss.js +8 -0
  6. package/CapEventCalendar/CalendarCanvas/calendarCanvasStyles.scss +17 -0
  7. package/CapEventCalendar/CalendarCanvas/index.d.ts +3 -52
  8. package/CapEventCalendar/CalendarCanvas/index.d.ts.map +1 -1
  9. package/CapEventCalendar/CalendarCanvas/index.js +31 -50
  10. package/CapEventCalendar/CalendarCanvas/utils.d.ts +5 -9
  11. package/CapEventCalendar/CalendarCanvas/utils.d.ts.map +1 -1
  12. package/CapEventCalendar/CalendarCanvas/utils.js +6 -6
  13. package/CapEventCalendar/components/DayDropdown/index.d.ts +3 -13
  14. package/CapEventCalendar/components/DayDropdown/index.d.ts.map +1 -1
  15. package/CapEventCalendar/components/DayDropdown/index.js +32 -14
  16. package/CapEventCalendar/components/MonthHeader/index.d.ts +3 -9
  17. package/CapEventCalendar/components/MonthHeader/index.d.ts.map +1 -1
  18. package/CapEventCalendar/components/MonthHeader/index.js +4 -9
  19. package/CapEventCalendar/components/MonthHeader/monthHeaderStyles.css +20 -0
  20. package/CapEventCalendar/components/MonthHeader/monthHeaderStyles.module.scss.js +7 -0
  21. package/CapEventCalendar/components/MonthHeader/monthHeaderStyles.scss +15 -0
  22. package/CapEventCalendar/drawUtils.d.ts +9 -71
  23. package/CapEventCalendar/drawUtils.d.ts.map +1 -1
  24. package/CapEventCalendar/drawUtils.js +12 -4
  25. package/CapEventCalendar/index.d.ts +4 -80
  26. package/CapEventCalendar/index.d.ts.map +1 -1
  27. package/CapEventCalendar/index.js +60 -85
  28. package/CapEventCalendar/messages.d.ts +25 -0
  29. package/CapEventCalendar/messages.d.ts.map +1 -0
  30. package/CapEventCalendar/messages.js +28 -0
  31. package/CapEventCalendar/styles.css +9 -81
  32. package/CapEventCalendar/styles.module.scss.js +12 -0
  33. package/CapEventCalendar/styles.scss +34 -107
  34. package/CapEventCalendar/tests/types.d.ts +26 -0
  35. package/CapEventCalendar/tests/types.d.ts.map +1 -0
  36. package/CapEventCalendar/types.d.ts +188 -0
  37. package/CapEventCalendar/types.d.ts.map +1 -0
  38. package/CapEventCalendar/types.js +1 -0
  39. package/CapEventCalendar/utils.d.ts +11 -9
  40. package/CapEventCalendar/utils.d.ts.map +1 -1
  41. package/CapEventCalendar/utils.js +10 -7
  42. package/CapProductSelection/index.d.ts +7 -29
  43. package/CapProductSelection/index.d.ts.map +1 -1
  44. package/CapProductSelection/index.js +52 -89
  45. package/CapProductSelection/messages.d.ts +76 -0
  46. package/CapProductSelection/messages.d.ts.map +1 -0
  47. package/CapProductSelection/messages.js +79 -0
  48. package/CapProductSelection/styles.css +81 -0
  49. package/CapProductSelection/styles.module.scss.js +8 -0
  50. package/CapProductSelection/styles.scss +82 -40
  51. package/CapProductSelection/tests/CapProductSelection.mockData.d.ts +36 -0
  52. package/CapProductSelection/tests/CapProductSelection.mockData.d.ts.map +1 -0
  53. package/CapProductSelection/types.d.ts +34 -0
  54. package/CapProductSelection/types.d.ts.map +1 -0
  55. package/CapProductSelection/types.js +1 -0
  56. package/CapRadioCard/index.d.ts.map +1 -1
  57. package/CapRadioCard/index.js +52 -20
  58. package/CapRadioCard/styles.css +25 -25
  59. package/CapRadioCard/styles.module.scss.js +14 -40
  60. package/CapRadioCard/styles.scss +20 -20
  61. package/CapRadioCard/types.d.ts +20 -0
  62. package/CapRadioCard/types.d.ts.map +1 -1
  63. package/CapStaticTemplates/index.d.ts +3 -1
  64. package/CapStaticTemplates/index.d.ts.map +1 -1
  65. package/CapStaticTemplates/index.js +185 -144
  66. package/CapStaticTemplates/messages.d.ts +32 -0
  67. package/CapStaticTemplates/messages.d.ts.map +1 -0
  68. package/CapStaticTemplates/messages.js +35 -0
  69. package/CapStaticTemplates/styles.css +220 -0
  70. package/CapStaticTemplates/styles.module.scss.js +55 -0
  71. package/CapStaticTemplates/styles.scss +291 -0
  72. package/CapStaticTemplates/tests/CapStaticTemplates.mockData.d.ts +54 -0
  73. package/CapStaticTemplates/tests/CapStaticTemplates.mockData.d.ts.map +1 -0
  74. package/CapStaticTemplates/types.d.ts +97 -0
  75. package/CapStaticTemplates/types.d.ts.map +1 -0
  76. package/CapStaticTemplates/types.js +1 -0
  77. package/CapTabV3/tests/CapTabV3.mockData.d.ts +26 -26
  78. package/CapTabV3/tests/CapTabV3.mockData.d.ts.map +1 -1
  79. package/index.d.ts +6 -0
  80. package/index.d.ts.map +1 -1
  81. package/index.js +227 -221
  82. package/package.json +1 -1
  83. package/styles/_variables.scss +2 -0
  84. package/utils/dayjs.d.ts +1 -0
  85. package/utils/dayjs.d.ts.map +1 -1
  86. package/utils/dayjs.js +1 -0
  87. package/CapProductSelection/style.d.ts +0 -3
  88. package/CapProductSelection/style.d.ts.map +0 -1
  89. package/CapProductSelection/style.js +0 -38
  90. package/CapStaticTemplates/style.d.ts +0 -13
  91. package/CapStaticTemplates/style.d.ts.map +0 -1
  92. package/CapStaticTemplates/style.js +0 -216
@@ -1,72 +1,75 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import classNames from "classnames";
3
3
  import debounce from "lodash/debounce";
4
- import PropTypes from "prop-types";
5
4
  import { useState, useMemo } from "react";
5
+ import { injectIntl } from "react-intl";
6
6
  import ModalImage from "../assets/images/group-3.svg.js";
7
+ import CapCard from "../CapCard/index.js";
7
8
  import CapColoredTag from "../CapColoredTag/index.js";
8
9
  import CapColumn from "../CapColumn/index.js";
9
10
  import CapHeader from "../CapHeader/index.js";
10
11
  import CapHeadingWithStatic from "../CapHeading/index.js";
11
12
  import CapIcon from "../CapIcon/index.js";
12
13
  import CapImage from "../CapImage/index.js";
14
+ import InputFinal from "../CapInput/index.js";
13
15
  import CapLabelWithStatic from "../CapLabel/index.js";
16
+ import CapModalWithHoc from "../CapModal/index.js";
17
+ import CapRadioCard from "../CapRadioCard/index.js";
14
18
  import CapRow from "../CapRow/index.js";
15
19
  import CapSpin from "../CapSpin/index.js";
16
20
  import CapTooltip from "../CapTooltip/index.js";
17
- import LocaleHoc from "../LocaleHoc/index.js";
18
- import { CAP_SPACE_12 } from "../styles/_variables.js";
19
21
  import { BLANK_TEMPLATE, BLANK_TEMPLATE_ICON } from "./constants.js";
20
- import { StrategyTemplate, StyledDiv, SideBar, CategoryContainer, PremiumIcon, TemplatesAndSearchContainer, SearchBox, TemplatesContainer, TemplatesModal, TemplateIcon, StyledCapCard } from "./style.js";
22
+ import messages from "./messages.js";
23
+ import styles from "./styles.module.scss.js";
21
24
  const clsPrefix = "cap-static-templates-v2";
22
- function CapStaticTemplates(props) {
23
- const {
24
- categories,
25
- className,
26
- cardWidth,
27
- cardHeight,
28
- blankCardWidth,
29
- blankCardHeight,
30
- selectedCategory,
31
- onSelectCategory,
32
- selectedStrategyTemplate,
33
- onSelectStrategyTemplate,
34
- isBlankTemplateRequired,
35
- templatesContainerWidth,
36
- templatesContainerMaxHeight,
37
- modalContent,
38
- searchPlaceholder,
39
- // Below props are messages form LocaleHoc
40
- strategyTitleMsg,
41
- strategyDescriptionMsg,
42
- comingSoonMsg,
43
- blankCategoryLabel,
44
- blankTemplateLabel,
45
- blankTemplateDescription,
46
- searchPlaceholderMsg,
47
- showComingSoon = true
48
- } = props;
25
+ const CapStaticTemplates = ({
26
+ categories = [],
27
+ className,
28
+ cardWidth = "278px",
29
+ cardHeight = "104px",
30
+ blankCardWidth = "278px",
31
+ blankCardHeight = "80px",
32
+ selectedCategory,
33
+ onSelectCategory,
34
+ selectedStrategyTemplate,
35
+ onSelectStrategyTemplate,
36
+ isBlankTemplateRequired = false,
37
+ templatesContainerWidth = "990px",
38
+ templatesContainerMaxHeight = "400px",
39
+ modalContent,
40
+ searchPlaceholder,
41
+ showComingSoon = true,
42
+ intl: { formatMessage }
43
+ }) => {
49
44
  const [showModal, setShowModal] = useState(false);
50
45
  const [searchText, setSearchText] = useState(null);
51
46
  const [isSearching, setIsSearching] = useState(false);
52
47
  const [filteredCategories, setFilteredCategories] = useState([]);
48
+ const rootClassName = styles["strategy-template-radio-root"];
49
+ const radioButtonWrapperClassName = styles["strategy-template-radio-button"];
50
+ const iconWrapperClassName = styles["strategy-template-radio-icon-wrapper"];
51
+ const iconContainerClassName = styles["strategy-template-radio-icon-container"];
52
+ const divIconClassName = styles["strategy-template-radio-div-icon"];
53
+ const contentContainerClassName = styles["strategy-template-radio-content-container"];
53
54
  const CUSTOM_STRATEGY_PANE = {
54
55
  value: BLANK_TEMPLATE,
55
56
  key: BLANK_TEMPLATE,
56
- label: blankTemplateLabel,
57
- description: blankTemplateDescription,
57
+ label: formatMessage(messages.blankTemplateLabel),
58
+ description: formatMessage(messages.blankTemplateDescription),
58
59
  icon: BLANK_TEMPLATE_ICON,
59
60
  isAvailable: true,
60
61
  isBlankTemplate: true
61
62
  };
62
63
  function handleClick(value) {
63
64
  scrollToSelectedCategory(value);
64
- onSelectCategory(value);
65
+ onSelectCategory == null ? void 0 : onSelectCategory(value);
65
66
  }
66
67
  function scrollToSelectedCategory(id) {
67
68
  const selectedElement = document.getElementById(id);
68
69
  const templateContainer = document.querySelector(".templates-container");
69
- templateContainer.scrollTo(0, selectedElement == null ? void 0 : selectedElement.offsetTop);
70
+ if (templateContainer && selectedElement) {
71
+ templateContainer.scrollTo(0, selectedElement.offsetTop);
72
+ }
70
73
  }
71
74
  const debounceSearch = debounce((text) => {
72
75
  getSearchResult(text);
@@ -77,12 +80,13 @@ function CapStaticTemplates(props) {
77
80
  setIsSearching(true);
78
81
  debounceSearch(value);
79
82
  }
80
- function handleShowModal(event) {
81
- const { value } = (event == null ? void 0 : event.target) ?? {};
82
- onSelectStrategyTemplate(value);
83
+ function handleShowModal(e) {
84
+ var _a;
85
+ const value = (_a = e == null ? void 0 : e.target) == null ? void 0 : _a.value;
86
+ onSelectStrategyTemplate == null ? void 0 : onSelectStrategyTemplate(value);
83
87
  categories == null ? void 0 : categories.forEach((category) => {
84
- var _a;
85
- (_a = category == null ? void 0 : category.panes) == null ? void 0 : _a.forEach((template) => {
88
+ var _a2;
89
+ (_a2 = category == null ? void 0 : category.panes) == null ? void 0 : _a2.forEach((template) => {
86
90
  if ((template == null ? void 0 : template.key) === value && !template.isAvailable) {
87
91
  setShowModal(true);
88
92
  }
@@ -104,7 +108,7 @@ function CapStaticTemplates(props) {
104
108
  ...rest
105
109
  } = pane;
106
110
  const iconLabelArray = value == null ? void 0 : value.split(" ");
107
- const iconLabelText = (iconLabelArray == null ? void 0 : iconLabelArray.length) > 1 ? (iconLabelArray == null ? void 0 : iconLabelArray[0][0]) + (iconLabelArray == null ? void 0 : iconLabelArray[1][0]) : iconLabelArray == null ? void 0 : iconLabelArray[0][0];
111
+ const iconLabelText = iconLabelArray && iconLabelArray.length > 1 ? iconLabelArray[0][0] + iconLabelArray[1][0] : (iconLabelArray == null ? void 0 : iconLabelArray[0][0]) || "";
108
112
  const templateCardTitle = /* @__PURE__ */ jsx(CapHeadingWithStatic, { type: "h4", className: `card-header-title ${isAvailable ? "card-available" : ""}`, children: label });
109
113
  return {
110
114
  title: /* @__PURE__ */ jsxs(
@@ -126,21 +130,20 @@ function CapStaticTemplates(props) {
126
130
  description: isBlankTemplate && /* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label1", className: "card-content", children: description })
127
131
  }
128
132
  ),
129
- showComingSoon && !isAvailable && !isBlankTemplate && /* @__PURE__ */ jsx(
130
- CapColoredTag,
131
- {
132
- className: "coming-soon-tag",
133
- style: { marginBottom: CAP_SPACE_12 },
134
- tagColor: "#0065ff",
135
- children: comingSoonMsg
136
- }
137
- )
133
+ showComingSoon && !isAvailable && !isBlankTemplate && /* @__PURE__ */ jsx(CapColoredTag, { className: "coming-soon-tag", tagColor: "#0065ff", children: formatMessage(messages.comingSoonMsg) })
138
134
  ]
139
135
  }
140
136
  ),
141
137
  value: key,
142
- icon: isBlankTemplate ? /* @__PURE__ */ jsx(TemplateIcon, { type: icon, color: "blue" }) : /* @__PURE__ */ jsx(CapColumn, { className: "strategy-icon", children: /* @__PURE__ */ jsx("span", { className: `text-label ${selectedStrategyTemplate === value ? "selected" : ""}`, children: iconLabelText }) }),
143
- customComponent: !isBlankTemplate && /* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label1", className: !isBlankTemplate && "card-content margin-t-4", children: description }),
138
+ icon: isBlankTemplate ? /* @__PURE__ */ jsx(CapIcon, { type: icon || "", color: "blue", size: "xs" }) : /* @__PURE__ */ jsx(CapColumn, { className: "strategy-icon", children: /* @__PURE__ */ jsx("span", { className: `text-label ${selectedStrategyTemplate === value ? "selected" : ""}`, children: iconLabelText }) }),
139
+ customComponent: !isBlankTemplate && /* @__PURE__ */ jsx(
140
+ CapLabelWithStatic,
141
+ {
142
+ type: "label1",
143
+ className: classNames("card-content", styles["cap-static-templates-v2-margin-t-4"]),
144
+ children: description
145
+ }
146
+ ),
144
147
  radioCardClassName: isAvailable || !showComingSoon ? "template-enabled" : "template-disabled",
145
148
  ...rest
146
149
  };
@@ -148,24 +151,41 @@ function CapStaticTemplates(props) {
148
151
  const getAllPanes = (panes = []) => panes.map((pane) => getPane(pane));
149
152
  const getTemplates = useMemo(() => {
150
153
  const categoriesData = searchText ? filteredCategories : categories;
151
- const strategyTemplates = categoriesData == null ? void 0 : categoriesData.map((category) => {
154
+ const strategyTemplates = (categoriesData || []).map((category) => {
152
155
  const { value, label, key, color, panes = [] } = category;
153
156
  const structuredPanes = getAllPanes(panes);
154
- return /* @__PURE__ */ jsxs(CapRow, { id: value, className: "margin-t-13", children: [
155
- /* @__PURE__ */ jsx(CapLabelWithStatic, { className: "margin-l-8 margin-b-8", type: "label4", children: label }),
157
+ return /* @__PURE__ */ jsxs(CapRow, { id: value, className: styles["cap-static-templates-v2-margin-t-13"], children: [
156
158
  /* @__PURE__ */ jsx(
157
- StrategyTemplate,
159
+ CapLabelWithStatic,
160
+ {
161
+ className: classNames(
162
+ styles["cap-static-templates-v2-margin-l-8"],
163
+ styles["cap-static-templates-v2-margin-b-8"]
164
+ ),
165
+ type: "label4",
166
+ children: label
167
+ }
168
+ ),
169
+ /* @__PURE__ */ jsx("div", { className: classNames(clsPrefix, className, styles["strategy-template"]), children: /* @__PURE__ */ jsx(
170
+ CapRadioCard,
158
171
  {
159
172
  panes: structuredPanes,
160
173
  cardWidth,
161
174
  cardHeight,
162
- borderColor: color,
163
175
  selected: selectedStrategyTemplate,
164
176
  value: selectedStrategyTemplate,
165
177
  onChange: handleShowModal,
166
- className: classNames(clsPrefix, className)
178
+ rootClassName,
179
+ radioButtonWrapperClassName,
180
+ iconWrapperClassName,
181
+ iconContainerClassName,
182
+ divIconClassName,
183
+ contentContainerClassName,
184
+ style: {
185
+ "--category-color": color
186
+ }
167
187
  }
168
- )
188
+ ) })
169
189
  ] }, key);
170
190
  });
171
191
  return strategyTemplates;
@@ -181,7 +201,7 @@ function CapStaticTemplates(props) {
181
201
  var _a2, _b;
182
202
  const parentName = (_a2 = currentData == null ? void 0 : currentData.value) == null ? void 0 : _a2.toLowerCase();
183
203
  const isParent = (parentName == null ? void 0 : parentName.indexOf(searchString)) > -1;
184
- const childPanes = (_b = currentData == null ? void 0 : currentData.panes) == null ? void 0 : _b.filter(
204
+ const childPanes = (_b = currentData.panes) == null ? void 0 : _b.filter(
185
205
  (childPane) => {
186
206
  var _a3, _b2;
187
207
  return ((_b2 = (_a3 = childPane == null ? void 0 : childPane.value) == null ? void 0 : _a3.toLowerCase()) == null ? void 0 : _b2.indexOf(searchString)) > -1;
@@ -201,26 +221,37 @@ function CapStaticTemplates(props) {
201
221
  setFilteredCategories(filteredData);
202
222
  }
203
223
  function getModalContent() {
224
+ if (!modalContent) return null;
204
225
  const { title, description, iconsAndMessages = [] } = modalContent;
205
- return /* @__PURE__ */ jsxs(CapRow, { type: "flex", justify: "space-between", align: "center", children: [
226
+ return /* @__PURE__ */ jsxs(CapRow, { type: "flex", justify: "space-between", align: "middle", children: [
206
227
  /* @__PURE__ */ jsx(CapColumn, { children: /* @__PURE__ */ jsx(CapImage, { src: ModalImage, className: "modal-image" }) }),
207
228
  /* @__PURE__ */ jsxs(CapColumn, { className: "modal-info-content", children: [
208
229
  /* @__PURE__ */ jsx(
209
230
  CapHeader,
210
231
  {
211
232
  title,
212
- description: /* @__PURE__ */ jsx(CapColoredTag, { tagColor: "#0065ff", children: comingSoonMsg })
233
+ description: /* @__PURE__ */ jsx(CapColoredTag, { tagColor: "#0065ff", children: formatMessage(messages.comingSoonMsg) })
213
234
  }
214
235
  ),
215
- /* @__PURE__ */ jsx(CapHeadingWithStatic, { type: "label2", className: "margin-t-16", children: description }),
216
- /* @__PURE__ */ jsx(CapRow, { type: "flex", align: "center", justify: "space-between", className: "margin-t-16", children: iconsAndMessages == null ? void 0 : iconsAndMessages.map((data, idx) => /* @__PURE__ */ jsx(
217
- StyledCapCard,
236
+ /* @__PURE__ */ jsx(CapHeadingWithStatic, { type: "label2", className: styles["cap-static-templates-v2-margin-t-16"], children: description }),
237
+ /* @__PURE__ */ jsx(
238
+ CapRow,
218
239
  {
219
- title: /* @__PURE__ */ jsx(CapIcon, { type: data == null ? void 0 : data.iconType, size: "m" }),
220
- children: /* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label5", style: { fontWeight: 500 }, children: data == null ? void 0 : data.message })
221
- },
222
- (data == null ? void 0 : data.iconType) || idx
223
- )) })
240
+ type: "flex",
241
+ align: "middle",
242
+ justify: "space-between",
243
+ className: styles["cap-static-templates-v2-margin-t-16"],
244
+ children: iconsAndMessages == null ? void 0 : iconsAndMessages.map((data, idx) => /* @__PURE__ */ jsx(
245
+ CapCard,
246
+ {
247
+ title: /* @__PURE__ */ jsx(CapIcon, { type: data == null ? void 0 : data.iconType, size: "m" }),
248
+ className: styles["styled-cap-card"],
249
+ children: /* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label5", style: { fontWeight: 500 }, children: data == null ? void 0 : data.message })
250
+ },
251
+ (data == null ? void 0 : data.iconType) || idx
252
+ ))
253
+ }
254
+ )
224
255
  ] })
225
256
  ] });
226
257
  }
@@ -228,35 +259,41 @@ function CapStaticTemplates(props) {
228
259
  /* @__PURE__ */ jsx(
229
260
  CapHeader,
230
261
  {
231
- className: "margin-b-16",
232
- title: /* @__PURE__ */ jsx(CapHeadingWithStatic, { type: "h3", children: strategyTitleMsg }),
233
- description: /* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label3", children: strategyDescriptionMsg })
262
+ className: styles["cap-static-templates-v2-margin-b-16"],
263
+ title: /* @__PURE__ */ jsx(CapHeadingWithStatic, { type: "h3", children: formatMessage(messages.strategyTitleMsg) }),
264
+ description: /* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label3", children: formatMessage(messages.strategyDescriptionMsg) })
234
265
  }
235
266
  ),
236
- /* @__PURE__ */ jsxs(StyledDiv, { children: [
237
- /* @__PURE__ */ jsxs(SideBar, { children: [
267
+ /* @__PURE__ */ jsxs("div", { className: styles[clsPrefix], children: [
268
+ /* @__PURE__ */ jsxs("div", { className: styles["sidebar"], children: [
238
269
  isBlankTemplateRequired && /* @__PURE__ */ jsx(
239
- CategoryContainer,
270
+ "div",
240
271
  {
241
- selected: BLANK_TEMPLATE === selectedCategory,
242
- className: "category-selector",
272
+ className: classNames(styles["category-container"], {
273
+ [styles["selected"]]: BLANK_TEMPLATE === selectedCategory,
274
+ "category-selector": true
275
+ }),
243
276
  onClick: () => handleClick(BLANK_TEMPLATE),
244
- children: /* @__PURE__ */ jsx(CapLabelWithStatic, { type: BLANK_TEMPLATE === selectedCategory ? "label4" : "label9", children: blankCategoryLabel })
277
+ children: /* @__PURE__ */ jsx(CapLabelWithStatic, { type: BLANK_TEMPLATE === selectedCategory ? "label4" : "label9", children: formatMessage(messages.blankCategoryLabel) })
245
278
  }
246
279
  ),
247
280
  categories == null ? void 0 : categories.map((category) => {
248
281
  var _a;
249
282
  return /* @__PURE__ */ jsxs(
250
- CategoryContainer,
283
+ "div",
251
284
  {
252
- className: "category-selector",
253
- color: category == null ? void 0 : category.color,
254
- selected: (category == null ? void 0 : category.value) === selectedCategory,
285
+ className: classNames(styles["category-container"], {
286
+ [styles["selected"]]: (category == null ? void 0 : category.value) === selectedCategory,
287
+ "category-selector": true
288
+ }),
289
+ style: {
290
+ "--category-color": category == null ? void 0 : category.color
291
+ },
255
292
  onClick: () => handleClick(category == null ? void 0 : category.value),
256
293
  children: [
257
294
  /* @__PURE__ */ jsxs(CapLabelWithStatic, { type: (category == null ? void 0 : category.value) === selectedCategory ? "label4" : "label9", children: [
258
295
  category == null ? void 0 : category.label,
259
- (category == null ? void 0 : category.premium) && /* @__PURE__ */ jsx(PremiumIcon, { type: "premium", size: "s" })
296
+ (category == null ? void 0 : category.premium) && /* @__PURE__ */ jsx(CapIcon, { type: "premium", size: "s", className: styles["premium-icon"] })
260
297
  ] }),
261
298
  /* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label1", children: (_a = category == null ? void 0 : category.panes) == null ? void 0 : _a.length })
262
299
  ]
@@ -265,69 +302,73 @@ function CapStaticTemplates(props) {
265
302
  );
266
303
  })
267
304
  ] }),
268
- /* @__PURE__ */ jsxs(TemplatesAndSearchContainer, { width: templatesContainerWidth, children: [
269
- /* @__PURE__ */ jsx(
270
- SearchBox,
271
- {
272
- value: searchText,
273
- onChange: handleSearch,
274
- onClear: handleSearch,
275
- placeholder: searchPlaceholder || searchPlaceholderMsg
276
- }
277
- ),
278
- /* @__PURE__ */ jsx(
279
- TemplatesContainer,
280
- {
281
- className: "templates-container",
282
- maxHeight: templatesContainerMaxHeight,
283
- children: /* @__PURE__ */ jsxs(CapSpin, { spinning: isSearching, children: [
284
- isBlankTemplateRequired && /* @__PURE__ */ jsx(CapRow, { id: BLANK_TEMPLATE, className: "margin-t-4", children: /* @__PURE__ */ jsx(
285
- StrategyTemplate,
286
- {
287
- panes: [getPane(CUSTOM_STRATEGY_PANE)],
288
- cardWidth: blankCardWidth,
289
- cardHeight: blankCardHeight,
290
- selected: selectedStrategyTemplate,
291
- value: selectedStrategyTemplate,
292
- onChange: handleShowModal
293
- }
294
- ) }, BLANK_TEMPLATE),
295
- getTemplates
296
- ] })
297
- }
298
- )
299
- ] }),
300
- /* @__PURE__ */ jsx(TemplatesModal, { visible: showModal, onCancel: handleHideModal, children: getModalContent() })
305
+ /* @__PURE__ */ jsxs(
306
+ "div",
307
+ {
308
+ className: styles["templates-and-search-container"],
309
+ style: {
310
+ "--templates-container-width": templatesContainerWidth
311
+ },
312
+ children: [
313
+ /* @__PURE__ */ jsx(
314
+ InputFinal.Search,
315
+ {
316
+ value: searchText || void 0,
317
+ onChange: handleSearch,
318
+ onClear: handleSearch,
319
+ placeholder: searchPlaceholder || formatMessage(messages.searchPlaceholderMsg),
320
+ className: styles["search-box"]
321
+ }
322
+ ),
323
+ /* @__PURE__ */ jsx(
324
+ CapRow,
325
+ {
326
+ className: classNames("templates-container", styles["templates-container"]),
327
+ style: {
328
+ "--templates-container-max-height": templatesContainerMaxHeight
329
+ },
330
+ children: /* @__PURE__ */ jsxs(CapSpin, { spinning: isSearching, children: [
331
+ isBlankTemplateRequired && /* @__PURE__ */ jsx(
332
+ CapRow,
333
+ {
334
+ id: BLANK_TEMPLATE,
335
+ className: classNames(
336
+ styles["cap-static-templates-v2-margin-t-4"],
337
+ styles["strategy-template"],
338
+ styles["strategy-template-icon-placeholder"]
339
+ ),
340
+ children: /* @__PURE__ */ jsx(
341
+ CapRadioCard,
342
+ {
343
+ panes: [getPane(CUSTOM_STRATEGY_PANE)],
344
+ cardWidth: blankCardWidth,
345
+ cardHeight: blankCardHeight,
346
+ selected: selectedStrategyTemplate,
347
+ value: selectedStrategyTemplate,
348
+ onChange: handleShowModal,
349
+ className: rootClassName,
350
+ radioButtonWrapperClassName,
351
+ iconWrapperClassName,
352
+ iconContainerClassName,
353
+ divIconClassName,
354
+ contentContainerClassName
355
+ }
356
+ )
357
+ },
358
+ BLANK_TEMPLATE
359
+ ),
360
+ getTemplates
361
+ ] })
362
+ }
363
+ )
364
+ ]
365
+ }
366
+ ),
367
+ /* @__PURE__ */ jsx(CapModalWithHoc, { open: showModal, onCancel: handleHideModal, className: styles["templates-modal"], children: getModalContent() })
301
368
  ] })
302
369
  ] });
303
- }
304
- CapStaticTemplates.defaultProps = {
305
- cardWidth: "278px",
306
- cardHeight: "104px",
307
- blankCardWidth: "278px",
308
- blankCardHeight: "80px",
309
- categories: [],
310
- isBlankTemplateRequired: false,
311
- templatesContainerWidth: "990px",
312
- templatesContainerMaxHeight: "400px"
313
- };
314
- CapStaticTemplates.propTypes = {
315
- categories: PropTypes.array,
316
- className: PropTypes.string,
317
- cardWidth: PropTypes.string,
318
- cardHeight: PropTypes.string,
319
- blankCardWidth: PropTypes.string,
320
- blankCardHeight: PropTypes.string,
321
- selectedCategory: PropTypes.string,
322
- onSelectCategory: PropTypes.func,
323
- selectedStrategyTemplate: PropTypes.string,
324
- onSelectStrategyTemplate: PropTypes.func,
325
- isBlankTemplateRequired: PropTypes.bool,
326
- templatesContainerWidth: PropTypes.string,
327
- templatesContainerMaxHeight: PropTypes.string,
328
- searchPlaceholder: PropTypes.any
329
370
  };
330
- const index = LocaleHoc(CapStaticTemplates, { key: "CapStaticTemplates" });
371
+ const index = injectIntl(CapStaticTemplates);
331
372
  export {
332
373
  index as default
333
374
  };
@@ -0,0 +1,32 @@
1
+ declare const _default: {
2
+ strategyTitleMsg: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ };
6
+ strategyDescriptionMsg: {
7
+ id: string;
8
+ defaultMessage: string;
9
+ };
10
+ comingSoonMsg: {
11
+ id: string;
12
+ defaultMessage: string;
13
+ };
14
+ blankCategoryLabel: {
15
+ id: string;
16
+ defaultMessage: string;
17
+ };
18
+ blankTemplateLabel: {
19
+ id: string;
20
+ defaultMessage: string;
21
+ };
22
+ blankTemplateDescription: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ };
26
+ searchPlaceholderMsg: {
27
+ id: string;
28
+ defaultMessage: string;
29
+ };
30
+ };
31
+ export default _default;
32
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../components/CapStaticTemplates/messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wBA8BG"}
@@ -0,0 +1,35 @@
1
+ import { defineMessages } from "react-intl";
2
+ const scope = "app.commonUtils.capUiLibrary.CapStaticTemplates";
3
+ const messages = defineMessages({
4
+ strategyTitleMsg: {
5
+ id: `${scope}.strategyTitleMsg`,
6
+ defaultMessage: "Select the strategy"
7
+ },
8
+ strategyDescriptionMsg: {
9
+ id: `${scope}.strategyDescriptionMsg`,
10
+ defaultMessage: "Use strategy driven pre-defined marketing use-cases or build your own strategy"
11
+ },
12
+ comingSoonMsg: {
13
+ id: `${scope}.comingSoonMsg`,
14
+ defaultMessage: "Coming soon"
15
+ },
16
+ blankCategoryLabel: {
17
+ id: `${scope}.blankCategoryLabel`,
18
+ defaultMessage: "Custom"
19
+ },
20
+ blankTemplateLabel: {
21
+ id: `${scope}.blankTemplateLabel`,
22
+ defaultMessage: "Build from scratch"
23
+ },
24
+ blankTemplateDescription: {
25
+ id: `${scope}.blankTemplateDescription`,
26
+ defaultMessage: "Create your own journey from scratch"
27
+ },
28
+ searchPlaceholderMsg: {
29
+ id: `${scope}.searchPlaceholderMsg`,
30
+ defaultMessage: "Search strategy"
31
+ }
32
+ });
33
+ export {
34
+ messages as default
35
+ };