@zohodesk/components 1.0.0-temp-233 → 1.0.0-temp-235

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 (51) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +13 -0
  3. package/assets/Appearance/dark/mode/Component_DarkMode.module.css +4 -4
  4. package/assets/Appearance/dark/themes/blue/blue_CTA_DarkModifyCategory.module.css +461 -8
  5. package/assets/Appearance/dark/themes/green/green_CTA_DarkModifyCategory.module.css +461 -8
  6. package/assets/Appearance/dark/themes/orange/orange_CTA_DarkModifyCategory.module.css +461 -8
  7. package/assets/Appearance/dark/themes/red/red_CTA_DarkModifyCategory.module.css +461 -8
  8. package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkModifyCategory.module.css +461 -8
  9. package/assets/Appearance/light/mode/Component_LightMode.module.css +6 -6
  10. package/assets/Appearance/light/themes/blue/blue_CTA_LightModifyCategory.module.css +461 -8
  11. package/assets/Appearance/light/themes/green/green_CTA_LightModifyCategory.module.css +461 -8
  12. package/assets/Appearance/light/themes/orange/orange_CTA_LightModifyCategory.module.css +461 -8
  13. package/assets/Appearance/light/themes/red/red_CTA_LightModifyCategory.module.css +461 -8
  14. package/assets/Appearance/light/themes/yellow/yellow_CTA_LightModifyCategory.module.css +461 -8
  15. package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +3 -3
  16. package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkModifyCategory.module.css +461 -8
  17. package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkModifyCategory.module.css +461 -8
  18. package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkModifyCategory.module.css +461 -8
  19. package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkModifyCategory.module.css +461 -8
  20. package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkModifyCategory.module.css +461 -8
  21. package/es/MultiSelect/MultiSelect.js +36 -12
  22. package/es/MultiSelect/Suggestions.js +171 -100
  23. package/es/MultiSelect/props/defaultProps.js +2 -0
  24. package/es/MultiSelect/props/propTypes.js +4 -0
  25. package/es/Select/Select.js +41 -12
  26. package/es/Select/props/defaultProps.js +1 -0
  27. package/es/Select/props/propTypes.js +1 -0
  28. package/es/Typography/Typography.js +9 -2
  29. package/es/Typography/__tests__/Typography.spec.js +334 -0
  30. package/es/Typography/__tests__/__snapshots__/Typography.spec.js.snap +451 -0
  31. package/es/Typography/highlight.js +144 -0
  32. package/es/Typography/props/defaultProps.js +2 -1
  33. package/es/Typography/props/propTypes.js +26 -1
  34. package/es/utils/Common.js +2 -1
  35. package/es/utils/dropDownUtils.js +3 -1
  36. package/lib/MultiSelect/MultiSelect.js +36 -10
  37. package/lib/MultiSelect/Suggestions.js +174 -104
  38. package/lib/MultiSelect/props/defaultProps.js +2 -0
  39. package/lib/MultiSelect/props/propTypes.js +4 -0
  40. package/lib/Select/Select.js +40 -9
  41. package/lib/Select/props/defaultProps.js +1 -0
  42. package/lib/Select/props/propTypes.js +1 -0
  43. package/lib/Typography/Typography.js +9 -2
  44. package/lib/Typography/__tests__/Typography.spec.js +342 -0
  45. package/lib/Typography/__tests__/__snapshots__/Typography.spec.js.snap +451 -0
  46. package/lib/Typography/highlight.js +151 -0
  47. package/lib/Typography/props/defaultProps.js +2 -1
  48. package/lib/Typography/props/propTypes.js +31 -1
  49. package/lib/utils/Common.js +4 -2
  50. package/lib/utils/dropDownUtils.js +3 -1
  51. package/package.json +6 -6
@@ -0,0 +1,342 @@
1
+ "use strict";
2
+
3
+ var _react = _interopRequireDefault(require("react"));
4
+
5
+ var _Typography = _interopRequireDefault(require("../Typography"));
6
+
7
+ var _react2 = require("@testing-library/react");
8
+
9
+ var _Tag = _interopRequireDefault(require("../../Tag/Tag"));
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
+
13
+ describe('Typography component', function () {
14
+ var weights = ['regular', 'light', 'semibold', 'bold'];
15
+ var decorations = ['default', 'underline', 'strike', 'overline'];
16
+ test('should be render with the basic set of default props', function () {
17
+ var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], null)),
18
+ asFragment = _render.asFragment;
19
+
20
+ expect(asFragment()).toMatchSnapshot();
21
+ });
22
+ test('should be render with text children', function () {
23
+ var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, "Text testing")),
24
+ asFragment = _render2.asFragment;
25
+
26
+ expect(asFragment()).toMatchSnapshot();
27
+ });
28
+ test('should render highlighted word', function () {
29
+ var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
30
+ highlights: {
31
+ highlightData: ['sun'],
32
+ highlightsStyle: {
33
+ weight: 'bold'
34
+ }
35
+ }
36
+ }, "The sun was bright, the sun was warm, the sun was high in the sky.")),
37
+ asFragment = _render3.asFragment;
38
+
39
+ expect(asFragment()).toMatchSnapshot();
40
+ });
41
+ test('should render highlight by Index', function () {
42
+ var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
43
+ highlights: {
44
+ highlightData: [{
45
+ highlightText: 'sun',
46
+ index: [1, 2]
47
+ }, {
48
+ highlightText: 'under',
49
+ index: 1
50
+ }],
51
+ highlightsStyle: {
52
+ weight: 'bold',
53
+ decoration: 'underline'
54
+ }
55
+ }
56
+ }, "The sun was bright, I walked under the sun, I talked under the sun.")),
57
+ asFragment = _render4.asFragment;
58
+
59
+ expect(asFragment()).toMatchSnapshot();
60
+ });
61
+ test('should render separate Styles per Word', function () {
62
+ var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
63
+ highlights: {
64
+ highlightData: [{
65
+ highlightText: 'sun',
66
+ highlightsStyle: {
67
+ weight: 'bold'
68
+ }
69
+ }, {
70
+ highlightText: 'under',
71
+ highlightsStyle: {
72
+ decoration: 'underline'
73
+ }
74
+ }]
75
+ }
76
+ }, "The sun was bright, I walked under the sun, I talked under the sun.")),
77
+ asFragment = _render5.asFragment;
78
+
79
+ expect(asFragment()).toMatchSnapshot();
80
+ });
81
+ test('should render globally skip highlights at given indexes, with isExcludedIndex', function () {
82
+ var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
83
+ highlights: {
84
+ highlightData: [{
85
+ highlightText: 'sun',
86
+ index: 1
87
+ }, {
88
+ highlightText: 'moon',
89
+ index: [2, 3]
90
+ }],
91
+ isExcludedIndex: true,
92
+ highlightsStyle: {
93
+ weight: 'bold',
94
+ decoration: 'underline'
95
+ }
96
+ }
97
+ }, "The sun was bright, the sun was warm, the sun was high in the sky.")),
98
+ asFragment = _render6.asFragment;
99
+
100
+ expect(asFragment()).toMatchSnapshot();
101
+ });
102
+ test('should render with separate excluded index option per word', function () {
103
+ var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
104
+ highlights: {
105
+ highlightData: [{
106
+ highlightText: 'sun',
107
+ index: 1,
108
+ isExcludedIndex: true
109
+ }, {
110
+ highlightText: 'moon',
111
+ index: [2, 3],
112
+ isExcludedIndex: false
113
+ }],
114
+ highlightsStyle: {
115
+ weight: 'bold',
116
+ decoration: 'underline'
117
+ }
118
+ }
119
+ }, "The sun was bright, the moon was bright, the sun and moon again.")),
120
+ asFragment = _render7.asFragment;
121
+
122
+ expect(asFragment()).toMatchSnapshot();
123
+ });
124
+ test('should render with global tagName applied to all highlights', function () {
125
+ var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
126
+ highlights: {
127
+ highlightData: [{
128
+ highlightText: 'sun'
129
+ }, {
130
+ highlightText: 'moon'
131
+ }],
132
+ tagName: 'i'
133
+ }
134
+ }, "The sun and moon were bright.")),
135
+ asFragment = _render8.asFragment;
136
+
137
+ expect(asFragment()).toMatchSnapshot();
138
+ });
139
+ test('should render with separate tagName for each highlighted word', function () {
140
+ var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
141
+ highlights: {
142
+ highlightData: [{
143
+ highlightText: 'sun',
144
+ tagName: 'i'
145
+ }, {
146
+ highlightText: 'moon',
147
+ tagName: 'u'
148
+ }]
149
+ }
150
+ }, "The sun and moon were bright.")),
151
+ asFragment = _render9.asFragment;
152
+
153
+ expect(asFragment()).toMatchSnapshot();
154
+ });
155
+ test('should render with global case-sensitive option', function () {
156
+ var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
157
+ highlights: {
158
+ highlightData: [{
159
+ highlightText: 'Sun'
160
+ }, {
161
+ highlightText: 'moon'
162
+ }],
163
+ highlightsStyle: {
164
+ weight: 'bold',
165
+ decoration: 'underline'
166
+ },
167
+ isCaseSensitive: true
168
+ }
169
+ }, "The Sun was bright, the moon was bright, the sun was warm.")),
170
+ asFragment = _render10.asFragment;
171
+
172
+ expect(asFragment()).toMatchSnapshot();
173
+ });
174
+ test('should render with separate case-sensitive option per word', function () {
175
+ var _render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
176
+ highlights: {
177
+ highlightData: [{
178
+ highlightText: 'Sun',
179
+ isCaseSensitive: true
180
+ }, {
181
+ highlightText: 'Moon',
182
+ isCaseSensitive: false
183
+ }],
184
+ highlightsStyle: {
185
+ weight: 'bold',
186
+ decoration: 'underline'
187
+ }
188
+ }
189
+ }, "The Sun was bright, the Moon was bright, the sun was warm.")),
190
+ asFragment = _render11.asFragment;
191
+
192
+ expect(asFragment()).toMatchSnapshot();
193
+ });
194
+ test('should render with global whole-word match only', function () {
195
+ var _render12 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
196
+ highlights: {
197
+ highlightData: [{
198
+ highlightText: 'Sun'
199
+ }, {
200
+ highlightText: 'moon'
201
+ }],
202
+ highlightsStyle: {
203
+ weight: 'bold',
204
+ decoration: 'underline'
205
+ },
206
+ isWholeWord: true
207
+ }
208
+ }, "Sunflower is a flower. The Sun was bright, the moonlight was bright.")),
209
+ asFragment = _render12.asFragment;
210
+
211
+ expect(asFragment()).toMatchSnapshot();
212
+ });
213
+ test('should render with separate whole-word option per word', function () {
214
+ var _render13 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
215
+ highlights: {
216
+ highlightData: [{
217
+ highlightText: 'Sun',
218
+ isWholeWord: true
219
+ }, {
220
+ highlightText: 'moon',
221
+ isWholeWord: false
222
+ }],
223
+ highlightsStyle: {
224
+ weight: 'bold',
225
+ decoration: 'underline'
226
+ }
227
+ }
228
+ }, "Sunflower is a flower. The Sun was bright, the moonlight was bright.")),
229
+ asFragment = _render13.asFragment;
230
+
231
+ expect(asFragment()).toMatchSnapshot();
232
+ });
233
+ test('should render with global custom style for all highlights', function () {
234
+ var _render14 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
235
+ highlights: {
236
+ highlightData: [{
237
+ highlightText: 'Sun'
238
+ }, {
239
+ highlightText: 'moon'
240
+ }],
241
+ customStyle: {
242
+ backgroundColor: 'lightgreen'
243
+ }
244
+ }
245
+ }, "The sun and moon were bright.")),
246
+ asFragment = _render14.asFragment;
247
+
248
+ expect(asFragment()).toMatchSnapshot();
249
+ });
250
+ test('should render with separate custom style per word', function () {
251
+ var _render15 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
252
+ highlights: {
253
+ highlightData: [{
254
+ highlightText: 'Sun',
255
+ customStyle: {
256
+ backgroundColor: 'lightgreen'
257
+ }
258
+ }, {
259
+ highlightText: 'moon',
260
+ customStyle: {
261
+ backgroundColor: 'orange'
262
+ }
263
+ }]
264
+ }
265
+ }, "The sun and moon were bright.")),
266
+ asFragment = _render15.asFragment;
267
+
268
+ expect(asFragment()).toMatchSnapshot();
269
+ });
270
+ test('should render with global custom class for all highlights', function () {
271
+ var _render16 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
272
+ highlights: {
273
+ highlightData: [{
274
+ highlightText: 'Sun'
275
+ }, {
276
+ highlightText: 'moon'
277
+ }],
278
+ highlightsStyle: {
279
+ customClass: 'global_custom_class'
280
+ }
281
+ }
282
+ }, "The sun and moon were bright.")),
283
+ asFragment = _render16.asFragment;
284
+
285
+ expect(asFragment()).toMatchSnapshot();
286
+ });
287
+ test('should render with separate custom class for each highlighted word', function () {
288
+ var _render17 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
289
+ highlights: {
290
+ highlightData: [{
291
+ highlightText: 'Sun',
292
+ highlightsStyle: {
293
+ customClass: 'separate_custom_class_sun'
294
+ }
295
+ }, {
296
+ highlightText: 'moon',
297
+ highlightsStyle: {
298
+ customClass: 'separate_custom_class_moon'
299
+ }
300
+ }]
301
+ }
302
+ }, "The sun and moon were bright.")),
303
+ asFragment = _render17.asFragment;
304
+
305
+ expect(asFragment()).toMatchSnapshot();
306
+ });
307
+ test('should render customised render the highlight element for all highlighted words', function () {
308
+ var _render18 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
309
+ highlights: {
310
+ highlightData: [{
311
+ highlightText: 'sun'
312
+ }],
313
+ render: /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
314
+ text: "Sun"
315
+ })
316
+ }
317
+ }, "The sun was bright.")),
318
+ asFragment = _render18.asFragment;
319
+
320
+ expect(asFragment()).toMatchSnapshot();
321
+ });
322
+ test('should render separate customised render the highlight element for each highlighted word', function () {
323
+ var _render19 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
324
+ highlights: {
325
+ highlightData: [{
326
+ highlightText: 'Sun',
327
+ render: /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
328
+ text: "Sun"
329
+ })
330
+ }, {
331
+ highlightText: 'moon',
332
+ render: /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
333
+ text: "Moon"
334
+ })
335
+ }]
336
+ }
337
+ }, "The sun and moon were bright.")),
338
+ asFragment = _render19.asFragment;
339
+
340
+ expect(asFragment()).toMatchSnapshot();
341
+ });
342
+ });