@zohodesk/components 1.0.0-temp-252.4 → 1.0.0-temp-256

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 (88) hide show
  1. package/README.md +20 -3
  2. package/assets/Appearance/dark/mode/Component_DarkMode.module.css +4 -4
  3. package/assets/Appearance/dark/themes/blue/blue_componentsCTA_DarkModifyCategory.module.css +14 -0
  4. package/assets/Appearance/dark/themes/green/green_componentsCTA_DarkModifyCategory.module.css +14 -0
  5. package/assets/Appearance/dark/themes/orange/orange_componentsCTA_DarkModifyCategory.module.css +14 -0
  6. package/assets/Appearance/dark/themes/red/red_componentsCTA_DarkModifyCategory.module.css +14 -0
  7. package/assets/Appearance/dark/themes/yellow/yellow_componentsCTA_DarkModifyCategory.module.css +14 -0
  8. package/assets/Appearance/light/mode/Component_LightMode.module.css +6 -6
  9. package/assets/Appearance/light/themes/blue/blue_componentsCTA_LightModifyCategory.module.css +14 -0
  10. package/assets/Appearance/light/themes/green/green_componentsCTA_LightModifyCategory.module.css +14 -0
  11. package/assets/Appearance/light/themes/orange/orange_componentsCTA_LightModifyCategory.module.css +14 -0
  12. package/assets/Appearance/light/themes/red/red_componentsCTA_LightModifyCategory.module.css +14 -0
  13. package/assets/Appearance/light/themes/yellow/yellow_componentsCTA_LightModifyCategory.module.css +14 -0
  14. package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +3 -3
  15. package/assets/Appearance/pureDark/themes/blue/blue_componentsCTA_PureDarkModifyCategory.module.css +14 -0
  16. package/assets/Appearance/pureDark/themes/green/green_componentsCTA_PureDarkModifyCategory.module.css +14 -0
  17. package/assets/Appearance/pureDark/themes/orange/orange_componentsCTA_PureDarkModifyCategory.module.css +14 -0
  18. package/assets/Appearance/pureDark/themes/red/red_componentsCTA_PureDarkModifyCategory.module.css +14 -0
  19. package/assets/Appearance/pureDark/themes/yellow/yellow_componentsCTA_PureDarkModifyCategory.module.css +14 -0
  20. package/cbt.config.js +12 -3
  21. package/es/Avatar/Avatar.js +1 -2
  22. package/es/Button/css/cssJSLogic.js +4 -5
  23. package/es/DateTime/DateTime.js +3 -6
  24. package/es/DateTime/DateWidget.js +34 -11
  25. package/es/DateTime/YearView.js +5 -6
  26. package/es/DateTime/common.js +2 -9
  27. package/es/DateTime/dateFormatUtils/dateFormat.js +55 -76
  28. package/es/DateTime/dateFormatUtils/index.js +7 -12
  29. package/es/DateTime/dateFormatUtils/timeChange.js +3 -4
  30. package/es/DateTime/dateFormatUtils/yearChange.js +3 -4
  31. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +5 -6
  32. package/es/Layout/utils.js +1 -2
  33. package/es/ListItem/ListContainer.js +4 -5
  34. package/es/Modal/Portal/Portal.js +4 -5
  35. package/es/MultiSelect/AdvancedGroupMultiSelect.js +91 -103
  36. package/es/MultiSelect/AdvancedMultiSelect.js +74 -80
  37. package/es/MultiSelect/MultiSelect.js +4 -13
  38. package/es/MultiSelect/Suggestions.js +14 -17
  39. package/es/Popup/Popup.js +1 -4
  40. package/es/Provider/IdProvider.js +4 -5
  41. package/es/Provider/LibraryContext.js +15 -12
  42. package/es/Provider/NumberGenerator/NumberGenerator.js +15 -17
  43. package/es/Provider/ZindexProvider.js +4 -5
  44. package/es/Responsive/CustomResponsive.js +8 -11
  45. package/es/Responsive/ResizeComponent.js +1 -3
  46. package/es/Responsive/Responsive.js +9 -12
  47. package/es/Responsive/sizeObservers.js +1 -5
  48. package/es/ResponsiveDropBox/ResponsiveDropBox.js +10 -14
  49. package/es/Select/GroupSelect.js +98 -103
  50. package/es/Select/Select.js +110 -116
  51. package/es/Select/SelectWithAvatar.js +91 -95
  52. package/es/Select/SelectWithIcon.js +104 -109
  53. package/es/Select/__tests__/Select.spec.js +6 -9
  54. package/es/Tab/Tab.js +90 -40
  55. package/es/Tab/Tab.module.css +25 -0
  56. package/es/Tab/TabContent.js +16 -19
  57. package/es/Tab/TabContentWrapper.js +19 -22
  58. package/es/Tab/TabWrapper.js +15 -16
  59. package/es/Tab/Tabs.js +105 -81
  60. package/es/Tab/Tabs.module.css +48 -3
  61. package/es/Tab/__tests__/Tab.spec.js +112 -0
  62. package/es/Tab/__tests__/__snapshots__/Tab.spec.js.snap +316 -0
  63. package/es/Tab/props/defaultProps.js +3 -2
  64. package/es/Tab/props/propTypes.js +12 -3
  65. package/es/Tab/utils/tabConfigs.js +5 -0
  66. package/es/Typography/css/cssJSLogic.js +4 -5
  67. package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +1 -2
  68. package/es/utils/Common.js +10 -31
  69. package/es/utils/datetime/common.js +12 -9
  70. package/es/utils/dropDownUtils.js +7 -11
  71. package/es/utils/getInitial.js +1 -3
  72. package/es/v1/Button/css/cssJSLogic.js +4 -8
  73. package/es/v1/Label/css/cssJSLogic.js +4 -5
  74. package/es/v1/Switch/css/cssJSLogic.js +4 -5
  75. package/es/v1/helpers/colorHelpers/colorHelper.js +28 -39
  76. package/lib/DateTime/DateWidget.js +33 -6
  77. package/lib/Provider/LibraryContext.js +5 -1
  78. package/lib/Tab/Tab.js +62 -9
  79. package/lib/Tab/Tab.module.css +25 -0
  80. package/lib/Tab/Tabs.js +34 -3
  81. package/lib/Tab/Tabs.module.css +48 -3
  82. package/lib/Tab/__tests__/Tab.spec.js +115 -0
  83. package/lib/Tab/__tests__/__snapshots__/Tab.spec.js.snap +316 -0
  84. package/lib/Tab/props/defaultProps.js +3 -2
  85. package/lib/Tab/props/propTypes.js +14 -3
  86. package/lib/Tab/utils/tabConfigs.js +7 -1
  87. package/lib/utils/datetime/common.js +10 -2
  88. package/package.json +12 -11
@@ -118,10 +118,9 @@ class SelectWithAvatarComponent extends SelectComponent {
118
118
  }
119
119
  }
120
120
 
121
- responsiveFunc(_ref) {
122
- let {
123
- mediaQueryOR
124
- } = _ref;
121
+ responsiveFunc({
122
+ mediaQueryOR
123
+ }) {
125
124
  return {
126
125
  tabletMode: mediaQueryOR([{
127
126
  maxWidth: 700
@@ -268,97 +267,94 @@ class SelectWithAvatarComponent extends SelectComponent {
268
267
  }, TextBoxProps)))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
269
268
  query: this.responsiveFunc,
270
269
  responsiveId: "Helmet"
271
- }, _ref2 => {
272
- let {
273
- tabletMode
274
- } = _ref2;
275
- return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
276
- animationStyle: animationStyle,
277
- boxPosition: position || `${defaultDropBoxPosition}Center`,
278
- getRef: getContainerRef,
279
- isActive: isPopupReady,
280
- isAnimate: true,
281
- isArrow: false,
282
- onClick: removeClose,
283
- needResponsive: needResponsive,
284
- isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
285
- positionsOffset: positionsOffset,
286
- targetOffset: targetOffset,
287
- isRestrictScroll: isRestrictScroll,
288
- isPadding: false,
289
- isResponsivePadding: true,
290
- alignBox: "row",
291
- dataId: `${dataId}_dropbox`,
292
- customClass: {
293
- customDropBox: dropBoxClass
294
- }
295
- }, isLoading ? /*#__PURE__*/React.createElement(Container, {
296
- align: "both",
297
- className: style.loader
298
- }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(Box, {
299
- flexible: true
300
- }, /*#__PURE__*/React.createElement(Card, {
301
- onScroll: this.handleScroll
302
- }, needSearch ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement("div", {
303
- className: `${selectStyle.search} ${selectStyle[size]}`
304
- }, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
305
- inputRef: this.searchInputRef,
306
- maxLength: maxLength,
307
- onChange: this.handleSearch,
308
- onKeyDown: this.handleKeyDown,
309
- placeHolder: searchBoxPlaceHolder,
310
- size: searchBoxSize,
311
- value: searchStr,
312
- onClear: this.handleClearSearch,
313
- dataId: `${dataId}_search`,
314
- a11y: {
315
- ariaAutocomplete: 'list',
316
- ariaControls: setAriaId,
317
- ariaDescribedby: ariaErrorId
318
- },
319
- autoComplete: false
320
- }, DropdownSearchTextBoxProps)))) : null, /*#__PURE__*/React.createElement(CardContent, {
321
- shrink: true,
322
- customClass: `${!tabletMode && dropBoxSize ? style[dropBoxSize] : ''} ${cardContentClass}`,
323
- eleRef: this.suggestionContainerRef
324
- }, groupName ? /*#__PURE__*/React.createElement("div", {
325
- className: style.title
326
- }, /*#__PURE__*/React.createElement(DropDownHeading, {
327
- text: groupName,
328
- a11y: {
329
- role: 'heading'
330
- }
331
- })) : null, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, _extends({
332
- dataId: `${dataId}_Options`,
333
- activeId: selectedId,
334
- suggestions: suggestions,
335
- getRef: this.suggestionItemRef,
336
- hoverOption: hoverIndex,
337
- onClick: this.handleChange,
338
- onMouseEnter: this.handleMouseEnter,
339
- needTick: true,
340
- needBorder: false,
341
- selectedOptions: [selectedId],
342
- className: selectStyle.listItemContainer,
343
- htmlId: setAriaId,
344
- a11y: {
345
- ariaParentRole: 'listbox',
346
- role: 'option'
347
- }
348
- }, SuggestionsProps)) : /*#__PURE__*/React.createElement(EmptyState, {
349
- isLoading: isFetchingOptions,
350
- options: options,
351
- searchString: searchStr,
352
- suggestions: suggestions,
353
- renderCustomEmptyState: renderCustomEmptyState,
354
- dataId: dataId,
355
- i18nKeys: i18nKeys,
356
- htmlId: ariaErrorId
357
- }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
358
- isCover: false,
359
- align: "both"
360
- }, /*#__PURE__*/React.createElement(Loader, null))))));
361
- }) : null);
270
+ }, ({
271
+ tabletMode
272
+ }) => /*#__PURE__*/React.createElement(ResponsiveDropBox, {
273
+ animationStyle: animationStyle,
274
+ boxPosition: position || `${defaultDropBoxPosition}Center`,
275
+ getRef: getContainerRef,
276
+ isActive: isPopupReady,
277
+ isAnimate: true,
278
+ isArrow: false,
279
+ onClick: removeClose,
280
+ needResponsive: needResponsive,
281
+ isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
282
+ positionsOffset: positionsOffset,
283
+ targetOffset: targetOffset,
284
+ isRestrictScroll: isRestrictScroll,
285
+ isPadding: false,
286
+ isResponsivePadding: true,
287
+ alignBox: "row",
288
+ dataId: `${dataId}_dropbox`,
289
+ customClass: {
290
+ customDropBox: dropBoxClass
291
+ }
292
+ }, isLoading ? /*#__PURE__*/React.createElement(Container, {
293
+ align: "both",
294
+ className: style.loader
295
+ }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(Box, {
296
+ flexible: true
297
+ }, /*#__PURE__*/React.createElement(Card, {
298
+ onScroll: this.handleScroll
299
+ }, needSearch ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement("div", {
300
+ className: `${selectStyle.search} ${selectStyle[size]}`
301
+ }, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
302
+ inputRef: this.searchInputRef,
303
+ maxLength: maxLength,
304
+ onChange: this.handleSearch,
305
+ onKeyDown: this.handleKeyDown,
306
+ placeHolder: searchBoxPlaceHolder,
307
+ size: searchBoxSize,
308
+ value: searchStr,
309
+ onClear: this.handleClearSearch,
310
+ dataId: `${dataId}_search`,
311
+ a11y: {
312
+ ariaAutocomplete: 'list',
313
+ ariaControls: setAriaId,
314
+ ariaDescribedby: ariaErrorId
315
+ },
316
+ autoComplete: false
317
+ }, DropdownSearchTextBoxProps)))) : null, /*#__PURE__*/React.createElement(CardContent, {
318
+ shrink: true,
319
+ customClass: `${!tabletMode && dropBoxSize ? style[dropBoxSize] : ''} ${cardContentClass}`,
320
+ eleRef: this.suggestionContainerRef
321
+ }, groupName ? /*#__PURE__*/React.createElement("div", {
322
+ className: style.title
323
+ }, /*#__PURE__*/React.createElement(DropDownHeading, {
324
+ text: groupName,
325
+ a11y: {
326
+ role: 'heading'
327
+ }
328
+ })) : null, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, _extends({
329
+ dataId: `${dataId}_Options`,
330
+ activeId: selectedId,
331
+ suggestions: suggestions,
332
+ getRef: this.suggestionItemRef,
333
+ hoverOption: hoverIndex,
334
+ onClick: this.handleChange,
335
+ onMouseEnter: this.handleMouseEnter,
336
+ needTick: true,
337
+ needBorder: false,
338
+ selectedOptions: [selectedId],
339
+ className: selectStyle.listItemContainer,
340
+ htmlId: setAriaId,
341
+ a11y: {
342
+ ariaParentRole: 'listbox',
343
+ role: 'option'
344
+ }
345
+ }, SuggestionsProps)) : /*#__PURE__*/React.createElement(EmptyState, {
346
+ isLoading: isFetchingOptions,
347
+ options: options,
348
+ searchString: searchStr,
349
+ suggestions: suggestions,
350
+ renderCustomEmptyState: renderCustomEmptyState,
351
+ dataId: dataId,
352
+ i18nKeys: i18nKeys,
353
+ htmlId: ariaErrorId
354
+ }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
355
+ isCover: false,
356
+ align: "both"
357
+ }, /*#__PURE__*/React.createElement(Loader, null))))))) : null);
362
358
  }
363
359
 
364
360
  }
@@ -268,8 +268,7 @@ class SelectWithIcon extends Component {
268
268
  isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchValue);
269
269
  }
270
270
 
271
- handleFetchOptions(APICall) {
272
- let searchValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
271
+ handleFetchOptions(APICall, searchValue = '') {
273
272
  let {
274
273
  isFetchingOptions = false
275
274
  } = this.state;
@@ -300,10 +299,9 @@ class SelectWithIcon extends Component {
300
299
  }
301
300
  }
302
301
 
303
- responsiveFunc(_ref) {
304
- let {
305
- mediaQueryOR
306
- } = _ref;
302
+ responsiveFunc({
303
+ mediaQueryOR
304
+ }) {
307
305
  return {
308
306
  tabletMode: mediaQueryOR([{
309
307
  maxWidth: 700
@@ -459,112 +457,109 @@ class SelectWithIcon extends Component {
459
457
  })))))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
460
458
  query: this.responsiveFunc,
461
459
  responsiveId: "Helmet"
462
- }, _ref2 => {
460
+ }, ({
461
+ tabletMode
462
+ }) => /*#__PURE__*/React.createElement(ResponsiveDropBox, {
463
+ animationStyle: animationStyle,
464
+ boxPosition: position,
465
+ isActive: isPopupReady,
466
+ isAnimate: true,
467
+ isArrow: false,
468
+ onClick: removeClose,
469
+ getRef: getContainerRef,
470
+ needResponsive: needResponsive,
471
+ isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
472
+ positionsOffset: positionsOffset,
473
+ targetOffset: targetOffset,
474
+ isRestrictScroll: isRestrictScroll,
475
+ dataId: `${dataId}_suggestions`,
476
+ size: boxSize,
477
+ isPadding: false,
478
+ isResponsivePadding: true,
479
+ alignBox: "row",
480
+ customClass: {
481
+ customDropBox: dropBoxClass
482
+ }
483
+ }, isLoading ? /*#__PURE__*/React.createElement(Container, {
484
+ align: "both",
485
+ className: style.loader
486
+ }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(Box, {
487
+ flexible: true
488
+ }, /*#__PURE__*/React.createElement(Card, {
489
+ onScroll: this.handleScroll,
490
+ htmlId: setAriaId,
491
+ a11y: {
492
+ role: 'listbox'
493
+ }
494
+ }, needSearch ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement("div", {
495
+ className: `${style.search} ${style[size]}`
496
+ }, /*#__PURE__*/React.createElement(TextBoxIcon, {
497
+ onClear: this.onSearchClear,
498
+ onChange: this.onSearch,
499
+ placeHolder: searchBoxPlaceHolder,
500
+ value: searchValue,
501
+ maxLength: maxLength,
502
+ onKeyDown: this.handleKeyDown,
503
+ inputRef: this.searchInputRef,
504
+ size: searchBoxSize,
505
+ dataId: `${dataId}_search`,
506
+ a11y: {
507
+ ariaDescribedby: ariaErrorId
508
+ },
509
+ autoComplete: false,
510
+ customProps: {
511
+ TextBoxProps: DropdownSearchTextBoxProps
512
+ }
513
+ }))) : null, /*#__PURE__*/React.createElement(CardContent, {
514
+ customClass: `${tabletMode ? style.responsivedropBoxList : style.dropBoxList} ${!tabletMode && dropBoxSize ? style[dropBoxSize] : ''} ${cardContentClass}`,
515
+ shrink: true,
516
+ eleRef: this.scrollContentRef,
517
+ dataId: `${dataId}_Options`
518
+ }, options.length ? /*#__PURE__*/React.createElement(React.Fragment, null, options.map((options, i) => {
463
519
  let {
464
- tabletMode
465
- } = _ref2;
466
- return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
467
- animationStyle: animationStyle,
468
- boxPosition: position,
469
- isActive: isPopupReady,
470
- isAnimate: true,
471
- isArrow: false,
472
- onClick: removeClose,
473
- getRef: getContainerRef,
474
- needResponsive: needResponsive,
475
- isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
476
- positionsOffset: positionsOffset,
477
- targetOffset: targetOffset,
478
- isRestrictScroll: isRestrictScroll,
479
- dataId: `${dataId}_suggestions`,
480
- size: boxSize,
481
- isPadding: false,
482
- isResponsivePadding: true,
483
- alignBox: "row",
484
- customClass: {
485
- customDropBox: dropBoxClass
486
- }
487
- }, isLoading ? /*#__PURE__*/React.createElement(Container, {
488
- align: "both",
489
- className: style.loader
490
- }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(Box, {
491
- flexible: true
492
- }, /*#__PURE__*/React.createElement(Card, {
493
- onScroll: this.handleScroll,
494
- htmlId: setAriaId,
520
+ iconName,
521
+ iconSize,
522
+ iconColor
523
+ } = options;
524
+ return /*#__PURE__*/React.createElement(ListItemWithIcon, _extends({
525
+ key: options[idKey],
526
+ value: options[valueKey],
527
+ secondaryValue: options[secondaryValueKey],
528
+ size: "medium",
529
+ onClick: this.handleChange,
530
+ id: options[idKey],
531
+ index: i,
532
+ title: options[valueKey],
533
+ palette: "default",
534
+ dataId: options[idKey],
535
+ iconName: iconName,
536
+ iconSize: iconSize,
537
+ iconClass: iconColor,
538
+ active: selectedId === options[idKey],
539
+ needBorder: needListBorder,
540
+ needTick: needTick,
541
+ onMouseEnter: this.handleMouseEnter,
542
+ highlight: selectedIndex === i,
543
+ getRef: this.itemRef,
495
544
  a11y: {
496
- role: 'listbox'
545
+ role: 'option',
546
+ ariaSelected: selectedId === options[idKey],
547
+ ariaLabel: options[valueKey]
497
548
  }
498
- }, needSearch ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement("div", {
499
- className: `${style.search} ${style[size]}`
500
- }, /*#__PURE__*/React.createElement(TextBoxIcon, {
501
- onClear: this.onSearchClear,
502
- onChange: this.onSearch,
503
- placeHolder: searchBoxPlaceHolder,
504
- value: searchValue,
505
- maxLength: maxLength,
506
- onKeyDown: this.handleKeyDown,
507
- inputRef: this.searchInputRef,
508
- size: searchBoxSize,
509
- dataId: `${dataId}_search`,
510
- a11y: {
511
- ariaDescribedby: ariaErrorId
512
- },
513
- autoComplete: false,
514
- customProps: {
515
- TextBoxProps: DropdownSearchTextBoxProps
516
- }
517
- }))) : null, /*#__PURE__*/React.createElement(CardContent, {
518
- customClass: `${tabletMode ? style.responsivedropBoxList : style.dropBoxList} ${!tabletMode && dropBoxSize ? style[dropBoxSize] : ''} ${cardContentClass}`,
519
- shrink: true,
520
- eleRef: this.scrollContentRef,
521
- dataId: `${dataId}_Options`
522
- }, options.length ? /*#__PURE__*/React.createElement(React.Fragment, null, options.map((options, i) => {
523
- let {
524
- iconName,
525
- iconSize,
526
- iconColor
527
- } = options;
528
- return /*#__PURE__*/React.createElement(ListItemWithIcon, _extends({
529
- key: options[idKey],
530
- value: options[valueKey],
531
- secondaryValue: options[secondaryValueKey],
532
- size: "medium",
533
- onClick: this.handleChange,
534
- id: options[idKey],
535
- index: i,
536
- title: options[valueKey],
537
- palette: "default",
538
- dataId: options[idKey],
539
- iconName: iconName,
540
- iconSize: iconSize,
541
- iconClass: iconColor,
542
- active: selectedId === options[idKey],
543
- needBorder: needListBorder,
544
- needTick: needTick,
545
- onMouseEnter: this.handleMouseEnter,
546
- highlight: selectedIndex === i,
547
- getRef: this.itemRef,
548
- a11y: {
549
- role: 'option',
550
- ariaSelected: selectedId === options[idKey],
551
- ariaLabel: options[valueKey]
552
- }
553
- }, ListItemProps));
554
- })) : /*#__PURE__*/React.createElement(EmptyState, {
555
- isLoading: isFetchingOptions,
556
- options: options,
557
- searchString: searchValue,
558
- suggestions: options,
559
- renderCustomEmptyState: renderCustomEmptyState,
560
- dataId: dataId,
561
- i18nKeys: i18nKeys,
562
- htmlId: ariaErrorId
563
- }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
564
- isCover: false,
565
- align: "both"
566
- }, /*#__PURE__*/React.createElement(Loader, null))))));
567
- }) : null);
549
+ }, ListItemProps));
550
+ })) : /*#__PURE__*/React.createElement(EmptyState, {
551
+ isLoading: isFetchingOptions,
552
+ options: options,
553
+ searchString: searchValue,
554
+ suggestions: options,
555
+ renderCustomEmptyState: renderCustomEmptyState,
556
+ dataId: dataId,
557
+ i18nKeys: i18nKeys,
558
+ htmlId: ariaErrorId
559
+ }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
560
+ isCover: false,
561
+ align: "both"
562
+ }, /*#__PURE__*/React.createElement(Loader, null))))))) : null);
568
563
  }
569
564
 
570
565
  }
@@ -618,15 +618,12 @@ describe('Select -', () => {
618
618
  });
619
619
  test('Should trigger onAddNewOption, when click on the custom search empty state button', () => {
620
620
  const addMessage = 'Add New Option';
621
- const getCustomEmptyState = jest.fn(_ref => {
622
- let {
623
- searchString,
624
- onAddNewOption
625
- } = _ref;
626
- return /*#__PURE__*/React.createElement("button", {
627
- onClick: onAddNewOption
628
- }, addMessage);
629
- });
621
+ const getCustomEmptyState = jest.fn(({
622
+ searchString,
623
+ onAddNewOption
624
+ }) => /*#__PURE__*/React.createElement("button", {
625
+ onClick: onAddNewOption
626
+ }, addMessage));
630
627
  const mockOnAddNewOption = jest.fn();
631
628
  const {
632
629
  getByRole,
package/es/Tab/Tab.js CHANGED
@@ -2,14 +2,16 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
 
3
3
  /* eslint-disable react/forbid-component-props */
4
4
 
5
- /* eslint css-modules/no-unused-class: [2, { markAsUsed: ['text', 'tabAlpha', 'alphaActive', 'gammaActive', 'betaActive', 'deltaActive', 'tabGamma', 'tabBeta', 'tabDelta',', 'specialActive', 'tabSpecial', 'alphaActive_border', 'gammaActive_border', 'betaActive_border', 'deltaActive_border'] }] */
5
+ /* eslint css-modules/no-unused-class: [2, { markAsUsed: ['text', 'tabAlpha', 'alphaActive', 'gammaActive', 'betaActive', 'deltaActive', 'tabGamma', 'tabBeta', 'tabDelta',', 'specialActive', 'tabSpecial', 'alphaActive_border', 'gammaActive_border', 'betaActive_border', 'deltaActive_border', 'tabDefault', 'defaultHover', 'defaultActive', 'defaultActive_border'] }] */
6
6
  import React, { useMemo, useCallback } from 'react';
7
7
  import { Tab_defaultProps } from "./props/defaultProps";
8
8
  import { Tab_propTypes } from "./props/propTypes";
9
9
  import { Box, Container } from "../Layout";
10
10
  import { cs } from "../utils/Common";
11
- import { TAB_DIRECTION_MAPPING } from "./utils/tabConfigs";
11
+ import { TAB_DIRECTION_MAPPING, VARIANT } from "./utils/tabConfigs";
12
12
  import styles from "./Tab.module.css";
13
+ import { renderNode, isRenderable } from '@zohodesk/utils';
14
+ import { Icon } from '@zohodesk/icons';
13
15
  const tabTypes = {
14
16
  alpha: {
15
17
  active: 'alphaActive',
@@ -22,38 +24,48 @@ const tabTypes = {
22
24
  delta: {
23
25
  active: 'deltaActive',
24
26
  tab: 'tabDelta'
27
+ },
28
+ default: {
29
+ active: 'defaultActive',
30
+ tab: 'tabDefault'
25
31
  }
26
32
  };
27
- export default function Tab(_ref) {
28
- let {
29
- id,
30
- style,
31
- text,
32
- children,
33
- className,
34
- dataId,
35
- dataSelectorId,
36
- title,
37
- titlePosition,
38
- activeClass,
39
- href,
40
- isLink,
41
- isDisabled,
42
- tourId,
43
- onClick,
44
- isActive,
45
- getTabRef,
46
- onSelect,
47
- type,
48
- isAnimate,
49
- needBorder,
50
- needAppearance,
51
- align,
52
- isVirtual,
53
- contentAlign,
54
- contentAlignBox,
55
- customProps
56
- } = _ref;
33
+ export default function Tab({
34
+ id,
35
+ style,
36
+ text,
37
+ children,
38
+ className,
39
+ dataId,
40
+ dataSelectorId,
41
+ title,
42
+ titlePosition,
43
+ activeClass,
44
+ href,
45
+ isLink,
46
+ isDisabled,
47
+ tourId,
48
+ onClick,
49
+ isActive,
50
+ getTabRef,
51
+ onSelect,
52
+ type,
53
+ isAnimate,
54
+ needBorder,
55
+ needAppearance,
56
+ align,
57
+ isVirtual,
58
+ contentAlign,
59
+ contentAlignBox,
60
+ customProps,
61
+ variant,
62
+ iconPlacement,
63
+ iconName,
64
+ iconSize,
65
+ renderIcon,
66
+ renderBefore,
67
+ renderAfter
68
+ }) {
57
69
  let clickListener = useCallback(event => {
58
70
  if (isLink && event && (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)) {
59
71
  event && event.stopPropagation();
@@ -71,8 +83,50 @@ export default function Tab(_ref) {
71
83
  let getTab = useCallback(ref => getTabRef && getTabRef(id, ref, isVirtual), [id, isVirtual]);
72
84
  let activeWithAppearance = cs([styles[styleContent.active], needBorder && !isAnimate && styles[`${styleContent.active}_border`]]);
73
85
  let activeClasses = cs([needAppearance && activeWithAppearance, activeClass]);
74
- let inActiveClasses = needAppearance && cs([styles[styleContent.tab], tabTypes[type] && styles[`${`${type}Hover`}`]]);
75
- let tabClass = cs([styles.tab, TAB_DIRECTION_MAPPING[align] === 'column' ? styles.vertical : styles.horizontal, isDisabled && styles.disabled, needBorder && !isAnimate && needAppearance && styles.border, isActive ? activeClasses : inActiveClasses, className]);
86
+ let inActiveClasses = needAppearance && cs([styles[styleContent.tab], tabTypes[type] && styles[`${type}Hover`]]);
87
+ let tabClass = cs([styles.tab, TAB_DIRECTION_MAPPING[align] === 'column' ? styles.vertical : styles.horizontal, isDisabled && styles.disabled, needBorder && !isAnimate && needAppearance && styles.border, isActive ? activeClasses : inActiveClasses, variant === VARIANT.ICON && styles.tabVariantIcon, variant === VARIANT.ICON_WITH_TEXT && styles.tabVariantIconWithText, className]);
88
+
89
+ const _renderIconNode = () => {
90
+ if (isRenderable(renderIcon)) {
91
+ return renderNode(renderIcon);
92
+ }
93
+
94
+ if (!iconName) {
95
+ return null;
96
+ }
97
+
98
+ return /*#__PURE__*/React.createElement(Icon, {
99
+ name: iconName,
100
+ size: iconSize
101
+ });
102
+ };
103
+
104
+ const _renderBeforeNode = () => {
105
+ if (!isRenderable(renderBefore)) {
106
+ return null;
107
+ }
108
+
109
+ return renderNode(renderBefore);
110
+ };
111
+
112
+ const _renderAfterNode = () => {
113
+ if (!isRenderable(renderAfter)) {
114
+ return null;
115
+ }
116
+
117
+ return renderNode(renderAfter);
118
+ };
119
+
120
+ const _renderLabel = () => {
121
+ const showIcon = variant !== VARIANT.TEXT && (isRenderable(renderIcon) || iconName);
122
+ const showText = variant !== VARIANT.ICON && text !== undefined && text !== null;
123
+ return /*#__PURE__*/React.createElement(React.Fragment, null, showIcon ? _renderIconNode() : null, showText ? /*#__PURE__*/React.createElement(Box, {
124
+ flexible: true,
125
+ adjust: true,
126
+ className: styles.tabText
127
+ }, text) : null);
128
+ };
129
+
76
130
  return /*#__PURE__*/React.createElement(Box, _extends({
77
131
  tourId: tourId,
78
132
  tagName: isLink ? 'a' : 'div',
@@ -96,13 +150,9 @@ export default function Tab(_ref) {
96
150
  alignBox: contentAlignBox,
97
151
  align: contentAlign,
98
152
  className: styles.textContainer
99
- }, text && /*#__PURE__*/React.createElement(Box, {
100
- flexible: true,
101
- adjust: true,
102
- className: styles.tabText
103
- }, text), children ? /*#__PURE__*/React.createElement(Box, {
153
+ }, _renderBeforeNode(), _renderLabel(), children ? /*#__PURE__*/React.createElement(Box, {
104
154
  shrink: true
105
- }, children) : null));
155
+ }, children) : null, _renderAfterNode()));
106
156
  }
107
157
  Tab.defaultProps = Tab_defaultProps;
108
158
  Tab.propTypes = Tab_propTypes; // if (__DOCS__) {
@@ -11,6 +11,9 @@
11
11
  width: 100% ;
12
12
  max-width: 100% ;
13
13
  }
14
+ .textContainer {
15
+ gap: var(--zd_size4) ;
16
+ }
14
17
  .textContainer,
15
18
  .tabText {
16
19
  max-width: inherit ;
@@ -91,3 +94,25 @@
91
94
  composes: delta;
92
95
  color: var(--zdt_tab_alpha_active_text);
93
96
  }
97
+
98
+ .tabDefault {
99
+ transition: all var(--zd_transition2);
100
+ padding-inline: 0 ;
101
+ padding-block: 0 ;
102
+ font-size: var(--zd_font_size11) ;
103
+ line-height: 3;
104
+ margin-inline-end: var(--zd_size34) ;
105
+ color: var(--zd-text-secondary);
106
+ }
107
+ .defaultHover:hover { color: var(--zd-text-primary); }
108
+ .defaultActive {
109
+ transition: all var(--zd_transition2);
110
+ padding-inline: 0 ;
111
+ padding-block: 0 ;
112
+ font-size: var(--zd_font_size11) ;
113
+ line-height: 3;
114
+ margin-inline-end: var(--zd_size34) ;
115
+ color: var(--zd-text-primary);
116
+ border-bottom: 1px solid var(--zdt_tab_alpha_active_border);
117
+ }
118
+ .defaultActive_border { border-color: var(--zdt_tab_alpha_active_border); }