@zohodesk/components 1.6.0 → 1.6.1

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.
@@ -0,0 +1,451 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Label - Snapshot Render with a11y attributes 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="inlineFlex row alignItems_center container default"
7
+ data-id="flex"
8
+ data-test-id="flex"
9
+ role="group"
10
+ >
11
+ <label
12
+ aria-label="Custom label"
13
+ class="size14 font_regular label"
14
+ data-title="Label text"
15
+ >
16
+ Label text
17
+ </label>
18
+ </div>
19
+ </DocumentFragment>
20
+ `;
21
+
22
+ exports[`Label - Snapshot Render with customClass 1`] = `
23
+ <DocumentFragment>
24
+ <div
25
+ class="inlineFlex row alignItems_center container default custom-container"
26
+ data-id="flex"
27
+ data-test-id="flex"
28
+ >
29
+ <label
30
+ class="size14 font_regular label custom-label"
31
+ data-title="Label text"
32
+ >
33
+ Label text
34
+ </label>
35
+ </div>
36
+ </DocumentFragment>
37
+ `;
38
+
39
+ exports[`Label - Snapshot Render with customId and testId 1`] = `
40
+ <DocumentFragment>
41
+ <div
42
+ class="inlineFlex row alignItems_center container default"
43
+ data-id="label-customId"
44
+ data-selector-id="label-customId"
45
+ data-test-id="label-testId"
46
+ >
47
+ <label
48
+ class="size14 font_regular label"
49
+ data-title="Label text"
50
+ >
51
+ Label text
52
+ </label>
53
+ </div>
54
+ </DocumentFragment>
55
+ `;
56
+
57
+ exports[`Label - Snapshot Render with customProps 1`] = `
58
+ <DocumentFragment>
59
+ <div
60
+ class="inlineFlex row alignItems_center shrink container default"
61
+ data-id="flex"
62
+ data-test-id="flex"
63
+ >
64
+ <label
65
+ class="size14 lineclamp_2 font_regular label"
66
+ data-title="Label text"
67
+ >
68
+ Label text
69
+ </label>
70
+ </div>
71
+ </DocumentFragment>
72
+ `;
73
+
74
+ exports[`Label - Snapshot Render with default props 1`] = `
75
+ <DocumentFragment>
76
+ <div
77
+ class="inlineFlex row alignItems_center container default"
78
+ data-id="flex"
79
+ data-test-id="flex"
80
+ >
81
+ <label
82
+ class="size14 font_regular label"
83
+ data-title="Label text"
84
+ >
85
+ Label text
86
+ </label>
87
+ </div>
88
+ </DocumentFragment>
89
+ `;
90
+
91
+ exports[`Label - Snapshot Render with htmlFor 1`] = `
92
+ <DocumentFragment>
93
+ <div
94
+ class="inlineFlex row alignItems_center container default"
95
+ data-id="flex"
96
+ data-test-id="flex"
97
+ >
98
+ <label
99
+ class="size14 font_regular label"
100
+ data-title="Label text"
101
+ for="input-id"
102
+ >
103
+ Label text
104
+ </label>
105
+ </div>
106
+ </DocumentFragment>
107
+ `;
108
+
109
+ exports[`Label - Snapshot Render with i18nKeys 1`] = `
110
+ <DocumentFragment>
111
+ <div
112
+ class="inlineFlex row alignItems_center container default"
113
+ data-id="flex"
114
+ data-test-id="flex"
115
+ >
116
+ <label
117
+ class="size14 font_regular label"
118
+ data-title="Label text"
119
+ >
120
+ Label text
121
+ <span
122
+ aria-hidden="true"
123
+ class="size14 font_regular requiredCommon flexshrink requiredText"
124
+ >
125
+ (Custom Required)
126
+ </span>
127
+ </label>
128
+ </div>
129
+ </DocumentFragment>
130
+ `;
131
+
132
+ exports[`Label - Snapshot Render with isClipped=true 1`] = `
133
+ <DocumentFragment>
134
+ <div
135
+ class="inlineFlex row alignItems_center container default"
136
+ data-id="flex"
137
+ data-test-id="flex"
138
+ >
139
+ <label
140
+ class="dotted size14 font_regular label"
141
+ data-title="Label text"
142
+ >
143
+ Label text
144
+ </label>
145
+ </div>
146
+ </DocumentFragment>
147
+ `;
148
+
149
+ exports[`Label - Snapshot Render with isDisabled=true 1`] = `
150
+ <DocumentFragment>
151
+ <div
152
+ class="inlineFlex row alignItems_center container disabled"
153
+ data-id="flex"
154
+ data-test-id="flex"
155
+ >
156
+ <label
157
+ class="size14 font_regular label"
158
+ data-title="Label text"
159
+ >
160
+ Label text
161
+ </label>
162
+ </div>
163
+ </DocumentFragment>
164
+ `;
165
+
166
+ exports[`Label - Snapshot Render with isReadOnly=true 1`] = `
167
+ <DocumentFragment>
168
+ <div
169
+ class="inlineFlex row alignItems_center container readonly default"
170
+ data-id="flex"
171
+ data-test-id="flex"
172
+ >
173
+ <label
174
+ class="size14 font_regular label"
175
+ data-title="Label text"
176
+ >
177
+ Label text
178
+ </label>
179
+ </div>
180
+ </DocumentFragment>
181
+ `;
182
+
183
+ exports[`Label - Snapshot Render with isRequired=true 1`] = `
184
+ <DocumentFragment>
185
+ <div
186
+ class="inlineFlex row alignItems_center container default"
187
+ data-id="flex"
188
+ data-test-id="flex"
189
+ >
190
+ <label
191
+ class="size14 font_regular label"
192
+ data-title="Label text"
193
+ >
194
+ Label text
195
+ <span
196
+ aria-hidden="true"
197
+ class="size14 font_regular requiredCommon flexshrink asterisk"
198
+ >
199
+ *
200
+ </span>
201
+ </label>
202
+ </div>
203
+ </DocumentFragment>
204
+ `;
205
+
206
+ exports[`Label - Snapshot Render with isRequired=true isClipped=true 1`] = `
207
+ <DocumentFragment>
208
+ <div
209
+ class="inlineFlex row alignItems_center container default"
210
+ data-id="flex"
211
+ data-test-id="flex"
212
+ >
213
+ <label
214
+ class="dotted size14 font_regular label"
215
+ data-title="Label text"
216
+ >
217
+ Label text
218
+ </label>
219
+ <span
220
+ aria-hidden="true"
221
+ class="size14 font_regular requiredCommon flexshrink asterisk"
222
+ >
223
+ *
224
+ </span>
225
+ </div>
226
+ </DocumentFragment>
227
+ `;
228
+
229
+ exports[`Label - Snapshot Render with layout=block 1`] = `
230
+ <DocumentFragment>
231
+ <div
232
+ class="flex row alignItems_center container default"
233
+ data-id="flex"
234
+ data-test-id="flex"
235
+ >
236
+ <label
237
+ class="size14 font_regular label"
238
+ data-title="Label text"
239
+ >
240
+ Label text
241
+ </label>
242
+ </div>
243
+ </DocumentFragment>
244
+ `;
245
+
246
+ exports[`Label - Snapshot Render with layout=inline 1`] = `
247
+ <DocumentFragment>
248
+ <div
249
+ class="inlineFlex row alignItems_center container default"
250
+ data-id="flex"
251
+ data-test-id="flex"
252
+ >
253
+ <label
254
+ class="size14 font_regular label"
255
+ data-title="Label text"
256
+ >
257
+ Label text
258
+ </label>
259
+ </div>
260
+ </DocumentFragment>
261
+ `;
262
+
263
+ exports[`Label - Snapshot Render with palette=default 1`] = `
264
+ <DocumentFragment>
265
+ <div
266
+ class="inlineFlex row alignItems_center container default"
267
+ data-id="flex"
268
+ data-test-id="flex"
269
+ >
270
+ <label
271
+ class="size14 font_regular label"
272
+ data-title="Label text"
273
+ >
274
+ Label text
275
+ </label>
276
+ </div>
277
+ </DocumentFragment>
278
+ `;
279
+
280
+ exports[`Label - Snapshot Render with palette=secondary 1`] = `
281
+ <DocumentFragment>
282
+ <div
283
+ class="inlineFlex row alignItems_center container secondary"
284
+ data-id="flex"
285
+ data-test-id="flex"
286
+ >
287
+ <label
288
+ class="size14 font_regular label"
289
+ data-title="Label text"
290
+ >
291
+ Label text
292
+ </label>
293
+ </div>
294
+ </DocumentFragment>
295
+ `;
296
+
297
+ exports[`Label - Snapshot Render with requiredType=asterisk 1`] = `
298
+ <DocumentFragment>
299
+ <div
300
+ class="inlineFlex row alignItems_center container default"
301
+ data-id="flex"
302
+ data-test-id="flex"
303
+ >
304
+ <label
305
+ class="size14 font_regular label"
306
+ data-title="Label text"
307
+ >
308
+ Label text
309
+ <span
310
+ aria-hidden="true"
311
+ class="size14 font_regular requiredCommon flexshrink asterisk"
312
+ >
313
+ *
314
+ </span>
315
+ </label>
316
+ </div>
317
+ </DocumentFragment>
318
+ `;
319
+
320
+ exports[`Label - Snapshot Render with requiredType=text 1`] = `
321
+ <DocumentFragment>
322
+ <div
323
+ class="inlineFlex row alignItems_center container default"
324
+ data-id="flex"
325
+ data-test-id="flex"
326
+ >
327
+ <label
328
+ class="size14 font_regular label"
329
+ data-title="Label text"
330
+ >
331
+ Label text
332
+ <span
333
+ aria-hidden="true"
334
+ class="size14 font_regular requiredCommon flexshrink requiredText"
335
+ >
336
+ (Required)
337
+ </span>
338
+ </label>
339
+ </div>
340
+ </DocumentFragment>
341
+ `;
342
+
343
+ exports[`Label - Snapshot Render with shouldHighlightRequired=true 1`] = `
344
+ <DocumentFragment>
345
+ <div
346
+ class="inlineFlex row alignItems_center container required"
347
+ data-id="flex"
348
+ data-test-id="flex"
349
+ >
350
+ <label
351
+ class="size14 font_regular label"
352
+ data-title="Label text"
353
+ >
354
+ Label text
355
+ <span
356
+ aria-hidden="true"
357
+ class="size14 font_regular requiredCommon flexshrink asterisk"
358
+ >
359
+ *
360
+ </span>
361
+ </label>
362
+ </div>
363
+ </DocumentFragment>
364
+ `;
365
+
366
+ exports[`Label - Snapshot Render with size=medium 1`] = `
367
+ <DocumentFragment>
368
+ <div
369
+ class="inlineFlex row alignItems_center container default"
370
+ data-id="flex"
371
+ data-test-id="flex"
372
+ >
373
+ <label
374
+ class="size14 font_regular label"
375
+ data-title="Label text"
376
+ >
377
+ Label text
378
+ </label>
379
+ </div>
380
+ </DocumentFragment>
381
+ `;
382
+
383
+ exports[`Label - Snapshot Render with size=small 1`] = `
384
+ <DocumentFragment>
385
+ <div
386
+ class="inlineFlex row alignItems_center container default"
387
+ data-id="flex"
388
+ data-test-id="flex"
389
+ >
390
+ <label
391
+ class="size13 font_regular label"
392
+ data-title="Label text"
393
+ >
394
+ Label text
395
+ </label>
396
+ </div>
397
+ </DocumentFragment>
398
+ `;
399
+
400
+ exports[`Label - Snapshot Render with tag attributes 1`] = `
401
+ <DocumentFragment>
402
+ <div
403
+ class="inlineFlex row alignItems_center container default"
404
+ data-custom-attr="true"
405
+ data-id="flex"
406
+ data-test-id="flex"
407
+ >
408
+ <label
409
+ class="size14 font_regular label"
410
+ data-custom-attr="true"
411
+ data-title="Label text"
412
+ >
413
+ Label text
414
+ </label>
415
+ </div>
416
+ </DocumentFragment>
417
+ `;
418
+
419
+ exports[`Label - Snapshot Render with fontWeight=regular 1`] = `
420
+ <DocumentFragment>
421
+ <div
422
+ class="inlineFlex row alignItems_center container default"
423
+ data-id="flex"
424
+ data-test-id="flex"
425
+ >
426
+ <label
427
+ class="size14 font_regular label"
428
+ data-title="Label text"
429
+ >
430
+ Label text
431
+ </label>
432
+ </div>
433
+ </DocumentFragment>
434
+ `;
435
+
436
+ exports[`Label - Snapshot Render with fontWeight=semibold 1`] = `
437
+ <DocumentFragment>
438
+ <div
439
+ class="inlineFlex row alignItems_center container default"
440
+ data-id="flex"
441
+ data-test-id="flex"
442
+ >
443
+ <label
444
+ class="size14 font_semibold label"
445
+ data-title="Label text"
446
+ >
447
+ Label text
448
+ </label>
449
+ </div>
450
+ </DocumentFragment>
451
+ `;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FONT_SIZE = exports.DISPLAY_MODE = void 0;
7
+ var DISPLAY_MODE = {
8
+ block: 'flex',
9
+ inline: 'inline'
10
+ };
11
+ exports.DISPLAY_MODE = DISPLAY_MODE;
12
+ var FONT_SIZE = {
13
+ small: '13',
14
+ medium: '14'
15
+ };
16
+ exports.FONT_SIZE = FONT_SIZE;
@@ -0,0 +1,42 @@
1
+ .container {
2
+ --local-label-cursor: pointer;
3
+ max-width: 100% ;
4
+ }
5
+ .label {
6
+ /*css:theme-validation:ignore*/
7
+ color: var(--local-label-text-color);
8
+ cursor: var(--local-label-cursor);
9
+ }
10
+ .required .label {
11
+ /*css:theme-validation:ignore*/
12
+ color: var(--local-label-required-text-color);
13
+ }
14
+ .disabled:not(.required) .label {
15
+ /*css:theme-validation:ignore*/
16
+ color: var(--local-label-disabled-text-color);
17
+ }
18
+ .default {
19
+ --local-label-text-color: var(--zdt_v1_label_text);
20
+ }
21
+ .secondary {
22
+ --local-label-text-color: var(--zdt_v1_label_secondary_text);
23
+ }
24
+ .required {
25
+ --local-label-required-text-color: var(--zdt_v1_label_required_text);
26
+ }
27
+ .disabled {
28
+ --local-label-disabled-text-color: var(--zdt_v1_label_disabled_text);
29
+ }
30
+ .disabled, .readonly {
31
+ --local-label-cursor: not-allowed;
32
+ }
33
+ .requiredCommon {
34
+ color: var(--zdt_v1_label_required_text);
35
+ cursor: var(--local-label-cursor);
36
+ }
37
+ .requiredText {
38
+ margin-inline-start: var(--zd_size4) ;
39
+ }
40
+ .asterisk {
41
+ margin-inline-start: var(--zd_size2) ;
42
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = cssJSLogic;
7
+
8
+ var _compileClassNames4 = _interopRequireDefault(require("@zohodesk/utils/es/compileClassNames"));
9
+
10
+ var _commonModule = _interopRequireDefault(require("../../../common/common.module.css"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
+
14
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
+
16
+ function cssJSLogic(_ref) {
17
+ var _compileClassNames, _compileClassNames2, _compileClassNames3;
18
+
19
+ var style = _ref.style,
20
+ props = _ref.props;
21
+ var shouldHighlightRequired = props.shouldHighlightRequired,
22
+ isRequired = props.isRequired,
23
+ isDisabled = props.isDisabled,
24
+ customClass = props.customClass,
25
+ requiredType = props.requiredType,
26
+ palette = props.palette,
27
+ isReadOnly = props.isReadOnly;
28
+ var customClass_label = customClass.label,
29
+ customClass_container = customClass.container;
30
+ var labelClass = (0, _compileClassNames4["default"])((_compileClassNames = {}, _defineProperty(_compileClassNames, style.label, true), _defineProperty(_compileClassNames, customClass_label, !!customClass_label), _compileClassNames));
31
+ var requiredClass = (0, _compileClassNames4["default"])((_compileClassNames2 = {}, _defineProperty(_compileClassNames2, style.requiredCommon, true), _defineProperty(_compileClassNames2, _commonModule["default"].flexshrink, true), _defineProperty(_compileClassNames2, style.requiredText, requiredType === 'text'), _defineProperty(_compileClassNames2, style.asterisk, requiredType === 'asterisk'), _compileClassNames2));
32
+ var containerClass = (0, _compileClassNames4["default"])((_compileClassNames3 = {}, _defineProperty(_compileClassNames3, style.container, true), _defineProperty(_compileClassNames3, style.required, isRequired && shouldHighlightRequired), _defineProperty(_compileClassNames3, style.readonly, isReadOnly), _defineProperty(_compileClassNames3, style.disabled, isDisabled), _defineProperty(_compileClassNames3, style[palette], palette && !(isRequired && shouldHighlightRequired) && !isDisabled), _defineProperty(_compileClassNames3, customClass_container, !!customClass_container), _compileClassNames3));
33
+ return {
34
+ labelClass: labelClass,
35
+ requiredClass: requiredClass,
36
+ containerClass: containerClass
37
+ };
38
+ }
@@ -3,16 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.defaultProps = void 0;
7
- var defaultProps = {
8
- clipped: false,
9
- dataId: 'label',
10
- palette: 'default',
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ customProps: {},
9
+ tagAttributes: {},
10
+ a11yAttributes: {},
11
+ customClass: {},
12
+ shouldHighlightRequired: false,
13
+ isDisabled: false,
14
+ isClipped: false,
15
+ isReadOnly: false,
16
+ requiredType: 'asterisk',
11
17
  size: 'medium',
12
- text: 'Label',
13
- type: 'title',
14
- variant: 'default',
15
- customClass: '',
16
- dataSelectorId: 'label'
18
+ palette: 'default',
19
+ fontWeight: 'regular',
20
+ layout: 'inline',
21
+ i18nKeys: {}
17
22
  };
18
- exports.defaultProps = defaultProps;
23
+ exports["default"] = _default;
@@ -3,28 +3,48 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.propTypes = void 0;
6
+ exports["default"] = void 0;
7
7
 
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
11
 
12
- var propTypes = {
13
- clipped: _propTypes["default"].bool,
14
- dataId: _propTypes["default"].string,
15
- dataSelectorId: _propTypes["default"].string,
12
+ var _default = {
16
13
  htmlFor: _propTypes["default"].string,
17
- onClick: _propTypes["default"].func,
18
- palette: _propTypes["default"].oneOf(['default', 'primary', 'secondary', 'danger', 'mandatory', 'disable', 'dark']),
19
- size: _propTypes["default"].oneOf(['xsmall', 'small', 'medium', 'large']),
20
14
  text: _propTypes["default"].string,
21
- title: _propTypes["default"].string,
22
- type: _propTypes["default"].oneOf(['title', 'subtitle']),
23
- variant: _propTypes["default"].oneOf(['primary', 'default']),
24
- customClass: _propTypes["default"].string,
25
- a11y: _propTypes["default"].shape({
26
- tabIndex: _propTypes["default"].string
15
+ onClick: _propTypes["default"].func,
16
+ a11yAttributes: _propTypes["default"].shape({
17
+ container: _propTypes["default"].object,
18
+ label: _propTypes["default"].object
19
+ }),
20
+ tagAttributes: _propTypes["default"].shape({
21
+ container: _propTypes["default"].object,
22
+ label: _propTypes["default"].object
23
+ }),
24
+ customProps: _propTypes["default"].shape({
25
+ container: _propTypes["default"].object,
26
+ label: _propTypes["default"].object
27
+ }),
28
+ customId: _propTypes["default"].string,
29
+ testId: _propTypes["default"].string,
30
+ customClass: _propTypes["default"].shape({
31
+ container: _propTypes["default"].string,
32
+ label: _propTypes["default"].string
33
+ }),
34
+ requiredType: _propTypes["default"].oneOf(['asterisk', 'text']),
35
+ shouldHighlightRequired: _propTypes["default"].bool,
36
+ isClipped: _propTypes["default"].bool,
37
+ isRequired: _propTypes["default"].bool,
38
+ isDisabled: _propTypes["default"].bool,
39
+ isReadOnly: _propTypes["default"].bool,
40
+ size: _propTypes["default"].oneOf(['small', 'medium']),
41
+ palette: _propTypes["default"].oneOf(['default', 'secondary']),
42
+ renderLeftPlaceholderNode: _propTypes["default"].oneOfType([_propTypes["default"].node, _propTypes["default"].func]),
43
+ renderRightPlaceholderNode: _propTypes["default"].oneOfType([_propTypes["default"].node, _propTypes["default"].func]),
44
+ fontWeight: _propTypes["default"].oneOf(['regular', 'semibold']),
45
+ i18nKeys: _propTypes["default"].shape({
46
+ requiredText: _propTypes["default"].string
27
47
  }),
28
- id: _propTypes["default"].string
48
+ layout: _propTypes["default"].oneOf(['inline', 'block'])
29
49
  };
30
- exports.propTypes = propTypes;
50
+ exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "main": "es/index.js",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -84,9 +84,9 @@
84
84
  "@zohodesk/docstool": "1.0.0-alpha-2",
85
85
  "@zohodesk/dotkit": "1.0.7",
86
86
  "@zohodesk/hooks": "2.0.6",
87
- "@zohodesk/icons": "1.1.6",
87
+ "@zohodesk/icons": "1.1.7",
88
88
  "@zohodesk/layout": "3.1.0",
89
- "@zohodesk/svg": "1.3.0",
89
+ "@zohodesk/svg": "1.3.1",
90
90
  "@zohodesk/utils": "1.3.16",
91
91
  "@zohodesk/variables": "1.2.0",
92
92
  "@zohodesk/virtualizer": "1.0.13",
@@ -102,9 +102,9 @@
102
102
  "selectn": "1.1.2"
103
103
  },
104
104
  "peerDependencies": {
105
- "@zohodesk/icons": "1.1.6",
105
+ "@zohodesk/icons": "1.1.7",
106
106
  "@zohodesk/variables": "1.2.0",
107
- "@zohodesk/svg": "1.3.0",
107
+ "@zohodesk/svg": "1.3.1",
108
108
  "@zohodesk/virtualizer": "1.0.13",
109
109
  "velocity-react": "1.4.3",
110
110
  "react-sortable-hoc": "^0.8.3",