@capillarytech/blaze-ui 6.1.1 → 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 (81) hide show
  1. package/.npmrc +3 -0
  2. package/CapCustomCheckboxList/styles.css +3 -3
  3. package/CapCustomCheckboxList/styles.scss +7 -8
  4. package/CapMobileDatePicker/index.d.ts +14 -3
  5. package/CapMobileDatePicker/index.d.ts.map +1 -1
  6. package/CapMobileDatePicker/index.js +20 -28
  7. package/CapMobileDatePicker/styles.css +11 -28
  8. package/CapMobileDatePicker/styles.scss +16 -37
  9. package/CapPopoverTree/index.d.ts +40 -3
  10. package/CapPopoverTree/index.d.ts.map +1 -1
  11. package/CapPopoverTree/index.js +82 -72
  12. package/CapPopoverTree/style.d.ts +1 -5
  13. package/CapPopoverTree/style.d.ts.map +1 -1
  14. package/CapPopoverTree/styles.css +18 -119
  15. package/CapPopoverTree/styles.scss +31 -179
  16. package/CapProductSelection/index.d.ts +7 -29
  17. package/CapProductSelection/index.d.ts.map +1 -1
  18. package/CapProductSelection/index.js +52 -89
  19. package/CapProductSelection/messages.d.ts +76 -0
  20. package/CapProductSelection/messages.d.ts.map +1 -0
  21. package/CapProductSelection/messages.js +79 -0
  22. package/CapProductSelection/styles.css +81 -0
  23. package/CapProductSelection/styles.module.scss.js +8 -0
  24. package/CapProductSelection/styles.scss +82 -40
  25. package/CapProductSelection/tests/CapProductSelection.mockData.d.ts +36 -0
  26. package/CapProductSelection/tests/CapProductSelection.mockData.d.ts.map +1 -0
  27. package/CapProductSelection/types.d.ts +34 -0
  28. package/CapProductSelection/types.d.ts.map +1 -0
  29. package/CapRadioCard/index.d.ts.map +1 -1
  30. package/CapRadioCard/index.js +52 -20
  31. package/CapRadioCard/styles.css +25 -25
  32. package/CapRadioCard/styles.module.scss.js +14 -40
  33. package/CapRadioCard/styles.scss +20 -20
  34. package/CapRadioCard/types.d.ts +20 -0
  35. package/CapRadioCard/types.d.ts.map +1 -1
  36. package/CapSelectFilter/index.d.ts.map +1 -1
  37. package/CapSelectFilter/index.js +10 -11
  38. package/CapSelectFilter/styles.css +11 -10
  39. package/CapSelectFilter/styles.module.scss.js +8 -10
  40. package/CapSelectFilter/styles.scss +11 -8
  41. package/CapSelectFilter/types.d.ts +1 -1
  42. package/CapSelectFilter/types.d.ts.map +1 -1
  43. package/CapStaticTemplates/index.d.ts +3 -1
  44. package/CapStaticTemplates/index.d.ts.map +1 -1
  45. package/CapStaticTemplates/index.js +185 -144
  46. package/CapStaticTemplates/messages.d.ts +32 -0
  47. package/CapStaticTemplates/messages.d.ts.map +1 -0
  48. package/CapStaticTemplates/messages.js +35 -0
  49. package/CapStaticTemplates/styles.css +220 -0
  50. package/CapStaticTemplates/styles.module.scss.js +55 -0
  51. package/CapStaticTemplates/styles.scss +291 -0
  52. package/CapStaticTemplates/tests/CapStaticTemplates.mockData.d.ts +54 -0
  53. package/CapStaticTemplates/tests/CapStaticTemplates.mockData.d.ts.map +1 -0
  54. package/CapStaticTemplates/types.d.ts +97 -0
  55. package/CapStaticTemplates/types.d.ts.map +1 -0
  56. package/index.d.ts +4 -4
  57. package/index.d.ts.map +1 -1
  58. package/index.js +56 -56
  59. package/package.json +1 -1
  60. package/styles/_variables.scss +2 -0
  61. package/utils/dayjs.d.ts +0 -1
  62. package/utils/dayjs.d.ts.map +1 -1
  63. package/utils/dayjs.js +0 -1
  64. package/CapMobileDatePicker/styles.module.scss.js +0 -10
  65. package/CapMobileDatePicker/tests/CapMobileDatePicker.mockData.d.ts +0 -41
  66. package/CapMobileDatePicker/tests/CapMobileDatePicker.mockData.d.ts.map +0 -1
  67. package/CapMobileDatePicker/types.d.ts +0 -17
  68. package/CapMobileDatePicker/types.d.ts.map +0 -1
  69. package/CapPopoverTree/styles.module.scss.js +0 -26
  70. package/CapPopoverTree/tests/CapPopoverTree.mockData.d.ts +0 -22
  71. package/CapPopoverTree/tests/CapPopoverTree.mockData.d.ts.map +0 -1
  72. package/CapPopoverTree/types.d.ts +0 -62
  73. package/CapPopoverTree/types.d.ts.map +0 -1
  74. package/CapProductSelection/style.d.ts +0 -3
  75. package/CapProductSelection/style.d.ts.map +0 -1
  76. package/CapProductSelection/style.js +0 -38
  77. package/CapStaticTemplates/style.d.ts +0 -13
  78. package/CapStaticTemplates/style.d.ts.map +0 -1
  79. package/CapStaticTemplates/style.js +0 -216
  80. /package/{CapMobileDatePicker → CapProductSelection}/types.js +0 -0
  81. /package/{CapPopoverTree → CapStaticTemplates}/types.js +0 -0
@@ -6,132 +6,31 @@
6
6
  /* Border Width */
7
7
  /* Transition */
8
8
  /* Timezones Footer */
9
- .expandIcon {
10
- margin-top: 0.714rem;
11
- z-index: 1;
12
- }
13
- .expandIcon svg {
14
- height: 1.714rem;
15
- width: 1.714rem;
16
- }
17
- .styledIcon {
18
- z-index: 1;
19
- padding: 0.286rem;
20
- border-radius: 0.571rem;
21
- background: #ebecf0;
22
- }
23
- .styledCapHeading {
24
- display: inline;
25
- margin-left: 0.286rem;
26
- }
27
- .styledCapColumn {
28
- display: inline;
29
- }
30
- .matchedSearch {
31
- font-weight: 500;
32
- }
33
- .styledCapTree.ant-tree.cap-tree-v2 {
34
- min-height: 8.857rem;
35
- }
36
- .styledCapTree.ant-tree.cap-tree-v2 li {
37
- padding: 0;
38
- }
39
- .styledCapTree.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper {
40
- height: 2.857rem;
41
- padding: 0.643rem 0 0.786rem 0.286rem;
42
- }
43
- .styledCapTree.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper:hover {
44
- background-color: #faf9f4;
45
- margin-left: -2.857rem;
46
- padding-left: 3.143rem;
47
- }
48
- .styledCapTree.ant-tree.cap-tree-v2 .ant-tree-node-selected .tree-node-title {
49
- color: #1d61ee;
50
- }
51
- .styledCapTree.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper-open {
52
- margin-left: -2.857rem;
53
- padding-left: 3.143rem;
54
- width: 23.143rem;
55
- }
56
- .styledCapTree.ant-tree.cap-tree-v2.isExpanded .ant-tree-node-content-wrapper-open {
57
- background: #e9f0fe;
58
- border-left: 0.143rem solid #2466ea;
59
- }
60
- .styledCapTree.ant-tree.cap-tree-v2.isExpanded .ant-tree-node-content-wrapper-open:hover {
61
- background-color: #e9f0fe;
62
- }
63
- .styledCapTree.ant-tree.cap-tree-v2.isExpanded .ant-tree-node-content-wrapper-open .tree-node-title {
64
- color: #1d61ee;
65
- }
66
- .styledCapTree.ant-tree.cap-tree-v2.isExpanded .ant-tree-node-content-wrapper-open .tree-node-icon {
67
- z-index: 1;
68
- background: #2466ea;
69
- color: #ffffff;
70
- }
71
- .styledCapTree.ant-tree.cap-tree-v2 .ant-tree-child-tree .ant-tree-node-content-wrapper {
72
- position: relative;
73
- margin-left: 1.143rem;
74
- padding-left: 0;
75
- width: 17.857rem;
76
- }
77
- .styledCapTree.ant-tree.cap-tree-v2 .ant-tree-child-tree .ant-tree-node-selected {
78
- background-color: #e9f0fe;
79
- }
80
- .styledCapTree.ant-tree.cap-tree-v2 .ant-tree-child-tree .ant-tree-title {
81
- margin-left: -0.857rem;
82
- }
83
- .styledCapTree.ant-tree.cap-tree-v2 .ant-tree-child-tree .ant-tree-title .info-icon {
84
- position: absolute;
85
- right: 1.786rem;
86
- top: 1rem;
87
- }
88
- .isExpanded.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper-open {
89
- background: #e9f0fe;
90
- border-left: 0.143rem solid #2466ea;
91
- }
92
- .isExpanded.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper-open:hover {
93
- background-color: #e9f0fe;
94
- }
95
- .isExpanded.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper-open .tree-node-title {
96
- color: #1d61ee;
97
- }
98
- .isExpanded.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper-open .tree-node-icon {
99
- z-index: 1;
100
- background: #2466ea;
101
- color: #ffffff;
102
- }
103
- .ant-popover.cap-popover-tree-v2 {
104
- width: 23.857rem;
105
- }
106
9
  .ant-popover.cap-popover-tree-v2 .ant-popover-content {
10
+ width: 334px;
107
11
  padding: 0;
108
- min-height: 12.571rem;
109
- }
110
- .ant-popover.cap-popover-tree-v2 .ant-popover-inner-content {
111
- padding: 0 0 0.857rem 0;
112
- }
113
- .ant-popover.cap-popover-tree-v2 .search-and-tree-wrapper {
114
- display: block;
115
- }
116
- .ant-popover.cap-popover-tree-v2 .search-and-tree-wrapper .ant-spin-container {
117
- width: 100%;
118
- }
119
- .ant-popover.cap-popover-tree-v2 .search-tree-node.ant-input-affix-wrapper {
120
- width: 100%;
121
- padding: 0.571rem 0.857rem;
122
- border-bottom: 0.071rem solid #dfe2e7;
123
- }
124
- .ant-popover.cap-popover-tree-v2 .search-tree-node.ant-input-affix-wrapper .ant-input {
125
- margin-left: 0.286rem;
12
+ min-height: 176px;
126
13
  }
127
14
  .ant-popover.cap-popover-tree-v2 .divider {
128
- display: none;
15
+ border-top: 1px solid #dfe2e7;
129
16
  }
130
17
  .ant-popover.cap-popover-tree-v2 .empty-data-text {
131
18
  text-align: center;
132
- margin-top: 0.857rem;
133
- padding: 0.714rem 0.857rem;
19
+ margin-top: 12px;
20
+ padding: 10px 0;
21
+ }
22
+ .ant-popover.cap-popover-tree-v2 .ant-popover-inner-content {
23
+ padding: 0 0 12px 0;
24
+ }
25
+ .ant-popover.cap-popover-tree-v2 .search-tree-node .ant-input-affix-wrapper {
26
+ width: 300px;
27
+ margin-left: 12px;
28
+ }
29
+ .ant-popover.cap-popover-tree-v2 .search-tree-node .ant-input-affix-wrapper .ant-input.ant-input-lg {
30
+ border: none !important;
31
+ border-radius: 0 !important;
32
+ margin-left: 8px;
134
33
  }
135
34
  .add-condition-tooltip .ant-tooltip-inner {
136
- width: 27.571rem;
35
+ width: 386px;
137
36
  }
@@ -2,186 +2,38 @@
2
2
 
3
3
  $popoverTree: cap-popover-tree-v2;
4
4
 
5
- // ExpandIcon styles
6
- .expandIcon {
7
- margin-top: 0.714rem; // 10px / 14
8
- z-index: 1;
9
-
10
- svg {
11
- height: 1.714rem; // 24px / 14
12
- width: 1.714rem; // 24px / 14
13
- }
14
- }
15
-
16
- // StyledIcon styles
17
- .styledIcon {
18
- z-index: 1;
19
- padding: 0.286rem; // 4px / 14
20
- border-radius: 0.571rem; // 8px / 14
21
- background: $CAP_G08;
22
- }
23
-
24
- // StyledCapHeading styles
25
- .styledCapHeading {
26
- display: inline;
27
- margin-left: 0.286rem; // 4px / 14
28
- }
29
-
30
- // StyledCapColumn styles
31
- .styledCapColumn {
32
- display: inline;
33
- }
34
-
35
- .matchedSearch {
36
- font-weight: 500;
37
- }
38
-
39
- // StyledCapTree styles
40
- .styledCapTree {
41
- &.ant-tree.cap-tree-v2 {
42
- min-height: 8.857rem; // 124px / 14
43
-
44
- li {
45
- padding: 0;
46
- }
47
-
48
- .ant-tree-node-content-wrapper {
49
- height: 2.857rem; // 40px / 14
50
- padding: 0.643rem 0 0.786rem 0.286rem; // 9px 0 11px 4px / 14
51
-
52
- &:hover {
53
- background-color: $BG_01;
54
- margin-left: -2.857rem; // -40px / 14
55
- padding-left: 3.143rem; // 44px / 14
56
- }
57
- }
58
-
59
- .ant-tree-node-selected {
60
- .tree-node-title {
61
- color: $CAP_COLOR_17; // #1d61ee
62
- }
63
- }
64
-
65
- .ant-tree-node-content-wrapper-open {
66
- margin-left: -2.857rem; // -40px / 14
67
- padding-left: 3.143rem; // 44px / 14
68
- width: 23.143rem; // 324px / 14
69
- }
70
-
71
- &.isExpanded {
72
- .ant-tree-node-content-wrapper-open {
73
- background: $CAP_PALE_GREY;
74
- border-left: 0.143rem solid $FONT_COLOR_05; // 2px / 14
75
-
76
- &:hover {
77
- background-color: $CAP_PALE_GREY;
78
- }
79
-
80
- .tree-node-title {
81
- color: $CAP_COLOR_17; // #1d61ee
82
- }
83
-
84
- .tree-node-icon {
85
- z-index: 1;
86
- background: $FONT_COLOR_05;
87
- color: $CAP_WHITE;
88
- }
89
- }
90
- }
91
-
92
- .ant-tree-child-tree {
93
- .ant-tree-node-content-wrapper {
94
- position: relative;
95
- margin-left: 1.143rem; // 16px / 14
96
- padding-left: 0;
97
- width: 17.857rem; // 250px / 14
98
- }
99
-
100
- .ant-tree-node-selected {
101
- background-color: $CAP_PALE_GREY;
102
- }
103
-
104
- .ant-tree-title {
105
- margin-left: -0.857rem; // -12px / 14
106
-
107
- .info-icon {
108
- position: absolute;
109
- right: 1.786rem; // 25px / 14
110
- top: 1rem; // 14px / 14
111
- }
112
- }
113
- }
114
- }
115
- }
116
-
117
- // IsExpanded styles - exported as separate class for CSS module
118
- .isExpanded {
119
- &.ant-tree.cap-tree-v2 {
120
- .ant-tree-node-content-wrapper-open {
121
- background: $CAP_PALE_GREY;
122
- border-left: 0.143rem solid $FONT_COLOR_05; // 2px / 14
123
-
124
- &:hover {
125
- background-color: $CAP_PALE_GREY;
126
- }
127
-
128
- .tree-node-title {
129
- color: $CAP_COLOR_17; // #1d61ee
130
- }
131
-
132
- .tree-node-icon {
133
- z-index: 1;
134
- background: $FONT_COLOR_05;
135
- color: $CAP_WHITE;
136
- }
137
- }
138
- }
139
- }
140
-
141
5
  .ant-popover.#{$popoverTree} {
142
- width: 23.857rem; // 334px / 14
143
- .ant-popover-content {
144
- padding: 0;
145
- min-height: 12.571rem; // 176px / 14
146
- }
147
-
148
- .ant-popover-inner-content {
149
- padding: 0 0 $CAP_SPACE_12 0;
150
- }
151
-
152
- .search-and-tree-wrapper {
153
- display: block;
154
-
155
- .ant-spin-container {
156
- width: 100%;
157
- }
158
- }
159
-
160
- .search-tree-node {
161
- &.ant-input-affix-wrapper {
162
- width: 100%;
163
- padding: 0.571rem $CAP_SPACE_12; // 8px 12px / 14
164
- border-bottom: 0.071rem solid $CAP_G07; // 1px / 14
165
-
166
- .ant-input {
167
- margin-left: 0.286rem; // 4px / 14
168
- }
6
+ .ant-popover-content {
7
+ width: 334px;
8
+ padding: 0;
9
+ min-height: 176px;
10
+ }
11
+
12
+ .divider {
13
+ border-top: 1px solid $CAP_G07;
14
+ }
15
+ .empty-data-text {
16
+ text-align: center;
17
+ margin-top: 12px;
18
+ padding: 10px 0;
19
+ }
20
+ .ant-popover-inner-content {
21
+ padding: 0 0 12px 0;
22
+ }
23
+ .search-tree-node {
24
+ .ant-input-affix-wrapper {
25
+ width: 300px;
26
+ margin-left: 12px;
27
+ .ant-input.ant-input-lg {
28
+ border: none !important;
29
+ border-radius: 0 !important;
30
+ margin-left: 8px;
31
+ }
32
+ }
169
33
  }
170
- }
171
-
172
- .divider {
173
- display: none; // replaced by search input bottom border
174
- }
175
-
176
- .empty-data-text {
177
- text-align: center;
178
- margin-top: 0.857rem; // 12px / 14
179
- padding: 0.714rem $CAP_SPACE_12; // 10px 12px / 14
180
- }
181
34
  }
182
-
183
35
  .add-condition-tooltip {
184
- .ant-tooltip-inner {
185
- width: 27.571rem; // 386px / 14
186
- }
187
- }
36
+ .ant-tooltip-inner {
37
+ width: 386px;
38
+ }
39
+ }
@@ -1,32 +1,10 @@
1
1
  import React from 'react';
2
- declare const _default: React.ComponentType<Omit<{
3
- [x: string]: any;
4
- treeData: any;
5
- target: any;
6
- trigger?: string;
7
- placement: any;
8
- overlayClassName: any;
9
- selectedAttributes?: any[];
10
- handleSelect?: () => void;
11
- isProductMandatory: any;
12
- lineItem: any;
13
- selectAttribute: any;
14
- brand: any;
15
- brandInfo: any;
16
- category: any;
17
- categoryInfo: any;
18
- product: any;
19
- productInfo: any;
20
- SKU: any;
21
- uploadSKU: any;
22
- uploadSKUInfo: any;
23
- comingSoon: any;
24
- changeSelection: any;
25
- description: any;
26
- okText: any;
27
- cancelText: any;
28
- selectValues: any;
29
- atleast1Attribute: any;
30
- } & import("react-intl").WrappedComponentProps, "intl">>;
2
+ import type { IntlShape } from 'react-intl';
3
+ import type { CapProductSelectionProps } from './types';
4
+ interface CapProductSelectionWithIntlProps extends CapProductSelectionProps {
5
+ intl: IntlShape;
6
+ }
7
+ declare const _default: React.ComponentType<Omit<CapProductSelectionWithIntlProps, "intl">>;
31
8
  export default _default;
9
+ export type { CapProductSelectionProps, TreeNodeItem } from './types';
32
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapProductSelection/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoZnD,wBAA8E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapProductSelection/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAyB5C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAIxD,UAAU,gCAAiC,SAAQ,wBAAwB;IACzE,IAAI,EAAE,SAAS,CAAC;CACjB;;AA0VD,wBAA+C;AAC/C,YAAY,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { Checkbox, Tree, Tooltip } from "antd";
2
+ import { useState, useEffect, createElement } from "react";
3
+ import { Checkbox, Tree, Tooltip } from "antd-v5";
3
4
  import classNames from "classnames";
4
- import PropTypes from "prop-types";
5
- import { useState, useEffect } from "react";
5
+ import { injectIntl } from "react-intl";
6
6
  import CapButton from "../CapButton/index.js";
7
+ import CapCard from "../CapCard/index.js";
7
8
  import CapHeadingWithStatic from "../CapHeading/index.js";
8
9
  import CapIcon from "../CapIcon/index.js";
9
10
  import CapPopover from "../CapPopover/index.js";
@@ -11,12 +12,13 @@ import CapRadio from "../CapRadio/index.js";
11
12
  import CapRow from "../CapRow/index.js";
12
13
  import CapTooltip from "../CapTooltip/index.js";
13
14
  import CapTree from "../CapTree/index.js";
14
- import LocaleHoc from "../LocaleHoc/index.js";
15
15
  import { CAP_G06 } from "../styles/_variables.js";
16
16
  import { SKU, ATTRIBUTE, BRAND, CATEGORY, PRODUCT_ATTRIBUTE, SKU_UPLOAD, SKU_SELECT, LINE_ITEM } from "./constants.js";
17
- import { StyledCapCard } from "./style.js";
17
+ import messages from "./messages.js";
18
+ import styles from "./styles.module.scss.js";
18
19
  const clsPrefix = "cap-product-selection-v2";
19
20
  const CapProductSelection = ({
21
+ intl: { formatMessage },
20
22
  treeData: treeDataProps,
21
23
  target,
22
24
  trigger = "click",
@@ -26,25 +28,6 @@ const CapProductSelection = ({
26
28
  handleSelect = () => {
27
29
  },
28
30
  isProductMandatory,
29
- /**LocaleHoc messages */
30
- lineItem,
31
- selectAttribute,
32
- brand,
33
- brandInfo,
34
- category,
35
- categoryInfo,
36
- product,
37
- productInfo,
38
- SKU: SKU$1,
39
- uploadSKU,
40
- uploadSKUInfo,
41
- comingSoon,
42
- changeSelection,
43
- description,
44
- okText,
45
- cancelText,
46
- selectValues,
47
- atleast1Attribute,
48
31
  ...rest
49
32
  }) => {
50
33
  const [showPopover, setShowPopover] = useState(false);
@@ -87,11 +70,17 @@ const CapProductSelection = ({
87
70
  if (attribute === ATTRIBUTE) handleSelect(checkedKeys);
88
71
  if (attribute === SKU) handleSelect([SKU]);
89
72
  }
90
- }, [showPopover, isBrandSelected, isCategorySelected, isProductSelected, attribute]);
73
+ }, [
74
+ showPopover,
75
+ isBrandSelected,
76
+ isCategorySelected,
77
+ isProductSelected,
78
+ attribute,
79
+ handleSelect
80
+ ]);
91
81
  const handleCheckboxSelect = (event) => {
92
- const {
93
- target: { value }
94
- } = event;
82
+ var _a;
83
+ const value = (_a = event.target) == null ? void 0 : _a.value;
95
84
  if (attribute && attribute !== ATTRIBUTE) {
96
85
  setShowModal(true);
97
86
  setIntermediateValue(ATTRIBUTE);
@@ -115,7 +104,7 @@ const CapProductSelection = ({
115
104
  setShowModal(false);
116
105
  setAttribute(intermediateValue);
117
106
  setIntermediateValue(null);
118
- if (intermediateValue === SKU$1) {
107
+ if (intermediateValue === SKU) {
119
108
  setIsBrandSelected(false);
120
109
  setIsCategorySelected(false);
121
110
  setIsProductSelected(false);
@@ -142,12 +131,14 @@ const CapProductSelection = ({
142
131
  setIntermediateValue(null);
143
132
  };
144
133
  const handleRadioOnChange = (event) => {
134
+ var _a;
135
+ const value = (_a = event.target) == null ? void 0 : _a.value;
145
136
  if (attribute) {
146
137
  setShowModal(true);
147
- setIntermediateValue(event.target.value);
138
+ setIntermediateValue(value);
148
139
  return;
149
140
  }
150
- setAttribute(event.target.value);
141
+ setAttribute(value);
151
142
  };
152
143
  const checkedMap = {
153
144
  [BRAND]: isBrandSelected,
@@ -155,9 +146,9 @@ const CapProductSelection = ({
155
146
  [PRODUCT_ATTRIBUTE]: isProductSelected
156
147
  };
157
148
  const titleMap = {
158
- [BRAND]: brand,
159
- [CATEGORY]: category,
160
- [PRODUCT_ATTRIBUTE]: product
149
+ [BRAND]: formatMessage(messages.brand),
150
+ [CATEGORY]: formatMessage(messages.category),
151
+ [PRODUCT_ATTRIBUTE]: formatMessage(messages.product)
161
152
  };
162
153
  const checkIfDisabled = (type) => {
163
154
  if (isProductMandatory) {
@@ -176,7 +167,7 @@ const CapProductSelection = ({
176
167
  };
177
168
  const getCheckboxComponent = (type) => {
178
169
  if (checkIfDisabled(type)) {
179
- return /* @__PURE__ */ jsx(CapTooltip, { title: atleast1Attribute, children: /* @__PURE__ */ jsx(
170
+ return /* @__PURE__ */ jsx(CapTooltip, { title: formatMessage(messages.atleast1Attribute), children: /* @__PURE__ */ jsx(
180
171
  Checkbox,
181
172
  {
182
173
  checked: checkedMap[type],
@@ -191,7 +182,7 @@ const CapProductSelection = ({
191
182
  };
192
183
  const defaultTreeData = [
193
184
  {
194
- title: lineItem,
185
+ title: formatMessage(messages.lineItem),
195
186
  key: LINE_ITEM,
196
187
  children: [
197
188
  {
@@ -201,7 +192,7 @@ const CapProductSelection = ({
201
192
  checked: attribute === ATTRIBUTE,
202
193
  value: ATTRIBUTE,
203
194
  onChange: handleRadioOnChange,
204
- children: selectAttribute
195
+ children: formatMessage(messages.selectAttribute)
205
196
  }
206
197
  ),
207
198
  key: ATTRIBUTE,
@@ -209,17 +200,17 @@ const CapProductSelection = ({
209
200
  {
210
201
  title: getCheckboxComponent(BRAND),
211
202
  key: BRAND,
212
- info: brandInfo
203
+ info: formatMessage(messages.brandInfo)
213
204
  },
214
205
  {
215
206
  title: getCheckboxComponent(CATEGORY),
216
207
  key: CATEGORY,
217
- info: categoryInfo
208
+ info: formatMessage(messages.categoryInfo)
218
209
  },
219
210
  {
220
211
  title: getCheckboxComponent(PRODUCT_ATTRIBUTE),
221
212
  key: PRODUCT_ATTRIBUTE,
222
- info: productInfo
213
+ info: formatMessage(messages.productInfo)
223
214
  }
224
215
  ]
225
216
  },
@@ -230,7 +221,7 @@ const CapProductSelection = ({
230
221
  checked: attribute === SKU,
231
222
  value: SKU,
232
223
  onChange: handleRadioOnChange,
233
- children: SKU$1
224
+ children: formatMessage(messages.SKU)
234
225
  }
235
226
  ),
236
227
  key: SKU,
@@ -242,16 +233,16 @@ const CapProductSelection = ({
242
233
  onChange: handleRadioOnChange,
243
234
  value: SKU,
244
235
  checked: attribute === "SKU",
245
- children: uploadSKU
236
+ children: formatMessage(messages.uploadSKU)
246
237
  }
247
238
  ),
248
239
  key: SKU_UPLOAD,
249
- info: uploadSKUInfo
240
+ info: formatMessage(messages.uploadSKUInfo)
250
241
  },
251
242
  {
252
- title: /* @__PURE__ */ jsx(CapRadio, { disabled: true, children: selectValues }),
243
+ title: /* @__PURE__ */ jsx(CapRadio, { disabled: true, children: formatMessage(messages.selectValues) }),
253
244
  key: SKU_SELECT,
254
- info: comingSoon,
245
+ info: formatMessage(messages.comingSoon),
255
246
  isHover: true
256
247
  }
257
248
  ]
@@ -260,7 +251,9 @@ const CapProductSelection = ({
260
251
  }
261
252
  ];
262
253
  const getTreeData = (treeData) => {
263
- const finalTreeData = treeData == null ? void 0 : treeData.reduce((result, data) => {
254
+ const result = [];
255
+ if (!treeData) return result;
256
+ treeData.forEach((data) => {
264
257
  const { title, key, children = [], checkable, info, isHover } = data;
265
258
  const hoverProps = {};
266
259
  const tooltipProp = {};
@@ -280,33 +273,32 @@ const CapProductSelection = ({
280
273
  checkable
281
274
  };
282
275
  result.push(
283
- /* @__PURE__ */ jsx(Tree.TreeNode, { ...treeNodeProps, children: (children == null ? void 0 : children.length) && getTreeData(children) })
276
+ /* @__PURE__ */ createElement(Tree.TreeNode, { ...treeNodeProps, key }, (children == null ? void 0 : children.length) ? getTreeData(children) : null)
284
277
  );
285
278
  }
286
- return result;
287
- }, []);
288
- return finalTreeData;
279
+ });
280
+ return result;
289
281
  };
290
282
  return /* @__PURE__ */ jsx(
291
283
  CapPopover,
292
284
  {
293
- visible: showPopover,
294
- onVisibleChange: setShowPopover,
285
+ open: showPopover,
286
+ onOpenChange: setShowPopover,
295
287
  trigger,
296
288
  placement,
297
- overlayClassName: classNames(`${clsPrefix}`, overlayClassName, { greyed: showModal }),
289
+ overlayClassName: classNames(clsPrefix, overlayClassName, { greyed: showModal }),
298
290
  ...rest,
299
291
  content: /* @__PURE__ */ jsxs(Fragment, { children: [
300
292
  /* @__PURE__ */ jsx(CapTree, { blockNode: true, selectable: false, defaultExpandAll: true, disabled: showModal, ...rest, children: getTreeData(treeDataProps || defaultTreeData) }),
301
- showModal && /* @__PURE__ */ jsxs(StyledCapCard, { children: [
302
- /* @__PURE__ */ jsxs(CapRow, { type: "flex", align: "center", justify: "space-between", className: "card-title", children: [
303
- /* @__PURE__ */ jsx(CapHeadingWithStatic, { type: "h3", children: changeSelection }),
293
+ showModal && /* @__PURE__ */ jsxs(CapCard, { className: styles.changeSelectionCard, children: [
294
+ /* @__PURE__ */ jsxs(CapRow, { type: "flex", align: "middle", justify: "space-between", className: "card-title", children: [
295
+ /* @__PURE__ */ jsx(CapHeadingWithStatic, { type: "h3", children: formatMessage(messages.changeSelection) }),
304
296
  /* @__PURE__ */ jsx(CapIcon, { type: "close", size: "s", style: { paddingTop: "4px" } })
305
297
  ] }),
306
- /* @__PURE__ */ jsx(CapHeadingWithStatic, { type: "h5", className: "card-description", children: description }),
298
+ /* @__PURE__ */ jsx(CapHeadingWithStatic, { type: "h5", className: "card-description", children: formatMessage(messages.description) }),
307
299
  /* @__PURE__ */ jsxs(CapRow, { className: "card-buttons", children: [
308
- /* @__PURE__ */ jsx(CapButton, { onClick: handleOk, className: "card-buttons-primary", type: "primary", children: okText }),
309
- /* @__PURE__ */ jsx(CapButton, { onClick: handleCancel, type: "secondary", children: cancelText })
300
+ /* @__PURE__ */ jsx(CapButton, { onClick: handleOk, className: "card-buttons-primary", type: "primary", children: formatMessage(messages.okText) }),
301
+ /* @__PURE__ */ jsx(CapButton, { onClick: handleCancel, type: "secondary", children: formatMessage(messages.cancelText) })
310
302
  ] })
311
303
  ] })
312
304
  ] }),
@@ -314,36 +306,7 @@ const CapProductSelection = ({
314
306
  }
315
307
  );
316
308
  };
317
- CapProductSelection.propTypes = {
318
- target: PropTypes.node,
319
- treeData: PropTypes.array,
320
- trigger: PropTypes.string,
321
- placement: PropTypes.string,
322
- overlayClassName: PropTypes.string,
323
- handleSelect: PropTypes.func,
324
- selectedAttributes: PropTypes.array,
325
- isProductMandatory: PropTypes.bool,
326
- /**LocaleHoc messages */
327
- lineItem: PropTypes.string,
328
- selectAttribute: PropTypes.string,
329
- brand: PropTypes.string,
330
- brandInfo: PropTypes.string,
331
- category: PropTypes.string,
332
- categoryInfo: PropTypes.string,
333
- product: PropTypes.string,
334
- productInfo: PropTypes.string,
335
- SKU: PropTypes.string,
336
- uploadSKU: PropTypes.string,
337
- uploadSKUInfo: PropTypes.string,
338
- comingSoon: PropTypes.string,
339
- changeSelection: PropTypes.string,
340
- description: PropTypes.string,
341
- okText: PropTypes.string,
342
- cancelText: PropTypes.string,
343
- selectValues: PropTypes.string,
344
- atleast1Attribute: PropTypes.string
345
- };
346
- const CapProductSelection$1 = LocaleHoc(CapProductSelection, { key: "CapProductSelection" });
309
+ const CapProductSelection$1 = injectIntl(CapProductSelection);
347
310
  export {
348
311
  CapProductSelection$1 as default
349
312
  };