@innovaccer/design-system 2.13.5 → 2.13.6

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.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /**
3
- * Generated on: 1668603336407
3
+ * Generated on: 1670480135361
4
4
  * Package: @innovaccer/design-system
5
- * Version: v2.13.5
5
+ * Version: v2.13.6
6
6
  * License: MIT
7
7
  * Docs: https://innovaccer.github.io/design-system
8
8
  */
@@ -1722,6 +1722,16 @@
1722
1722
  cursor = _p[0],
1723
1723
  setCursor = _p[1];
1724
1724
 
1725
+ var _q = React__namespace.useState(),
1726
+ minHeight = _q[0],
1727
+ setMinHeight = _q[1];
1728
+
1729
+ var getMinHeight = function getMinHeight() {
1730
+ var dropdownWrapper = document.querySelector('.Dropdown-wrapper');
1731
+ var minHeight = dropdownWrapper === null || dropdownWrapper === void 0 ? void 0 : dropdownWrapper.offsetHeight;
1732
+ minHeight && setMinHeight(minHeight);
1733
+ };
1734
+
1725
1735
  React__namespace.useEffect(function () {
1726
1736
  var _a;
1727
1737
 
@@ -1738,6 +1748,7 @@
1738
1748
  minWidth: minWidth ? minWidth : popperMinWidth,
1739
1749
  maxWidth: maxWidth ? maxWidth : '100%'
1740
1750
  };
1751
+ requestAnimationFrame(getMinHeight);
1741
1752
  setPopoverStyle(popperWrapperStyle);
1742
1753
 
1743
1754
  if (scrollIndex && tempSelected.length === 0) {
@@ -1754,10 +1765,10 @@
1754
1765
  React__namespace.useEffect(function () {
1755
1766
  if (firstEnabledOption !== cursor) setCursor(firstEnabledOption);
1756
1767
  }, [firstEnabledOption]);
1757
- var _q = props.triggerSize,
1758
- triggerSize = _q === void 0 ? 'regular' : _q,
1759
- _r = props.placeholder,
1760
- placeholder = _r === void 0 ? 'Select' : _r,
1768
+ var _r = props.triggerSize,
1769
+ triggerSize = _r === void 0 ? 'regular' : _r,
1770
+ _s = props.placeholder,
1771
+ placeholder = _s === void 0 ? 'Select' : _s,
1761
1772
  icon = props.icon,
1762
1773
  error = props.error,
1763
1774
  disabled = props.disabled,
@@ -1782,7 +1793,14 @@
1782
1793
  var dropdownStyle = {
1783
1794
  maxHeight: maxHeight,
1784
1795
  overflowY: 'auto',
1785
- overflowX: 'hidden'
1796
+ overflowX: 'hidden',
1797
+ minHeight: minHeight
1798
+ };
1799
+ var loaderStyle = {
1800
+ maxHeight: minHeight ? minHeight : maxHeight,
1801
+ overflowY: 'auto',
1802
+ overflowX: 'hidden',
1803
+ minHeight: minHeight
1786
1804
  };
1787
1805
 
1788
1806
  var getDropdownClass = function getDropdownClass(index, isGroup) {
@@ -2000,7 +2018,7 @@
2000
2018
  className: 'Dropdown-loading'
2001
2019
  }, /*#__PURE__*/React__namespace.createElement("div", {
2002
2020
  className: "Dropdown-wrapper",
2003
- style: dropdownStyle
2021
+ style: loaderStyle
2004
2022
  }, renderLoading(loadersCount)));
2005
2023
  }
2006
2024
 
@@ -2008,7 +2026,8 @@
2008
2026
  var _c = props.noResultMessage,
2009
2027
  noResultMessage = _c === void 0 ? 'No result found' : _c;
2010
2028
  return /*#__PURE__*/React__namespace.createElement("div", {
2011
- className: 'Dropdown-errorWrapper',
2029
+ className: "Dropdown-wrapper",
2030
+ style: dropdownStyle,
2012
2031
  "data-test": "DesignSystem-Dropdown--errorWrapper"
2013
2032
  }, /*#__PURE__*/React__namespace.createElement("div", {
2014
2033
  className: 'Option'
@@ -5559,14 +5578,16 @@
5559
5578
  disabled = props.disabled,
5560
5579
  readOnly = props.readOnly,
5561
5580
  valueProp = props.value,
5562
- rest = __rest(props, ["size", "defaultValue", "name", "placeholder", "icon", "prefix", "suffix", "error", "min", "max", "onChange", "onClick", "onBlur", "onFocus", "className", "autoFocus", "disabled", "readOnly", "value"]);
5581
+ _f = props.showActionButton,
5582
+ showActionButton = _f === void 0 ? true : _f,
5583
+ rest = __rest(props, ["size", "defaultValue", "name", "placeholder", "icon", "prefix", "suffix", "error", "min", "max", "onChange", "onClick", "onBlur", "onFocus", "className", "autoFocus", "disabled", "readOnly", "value", "showActionButton"]);
5563
5584
 
5564
5585
  var ref = React__namespace.useRef(null);
5565
5586
  var isUncontrolled = valueProp === undefined;
5566
5587
 
5567
- var _f = React__namespace.useState(valueProp || defaultValue),
5568
- value = _f[0],
5569
- setValue = _f[1];
5588
+ var _g = React__namespace.useState(valueProp || defaultValue),
5589
+ value = _g[0],
5590
+ setValue = _g[1];
5570
5591
 
5571
5592
  React__namespace.useImperativeHandle(forwardedRef, function () {
5572
5593
  return ref.current;
@@ -5585,7 +5606,7 @@
5585
5606
  }, [valueProp]);
5586
5607
  var baseProps = extractBaseProps(props);
5587
5608
  var classes = classNames__default["default"]((_a = {}, _a['MetricInput'] = true, _a["MetricInput--" + size] = size, _a['MetricInput--disabled'] = disabled || readOnly, _a['MetricInput--error'] = error, _a), className);
5588
- var inputClass = classNames__default["default"]((_b = {}, _b['MetricInput-input'] = true, _b["MetricInput-input--" + size] = size, _b));
5609
+ var inputClass = classNames__default["default"]((_b = {}, _b['MetricInput-input'] = true, _b["MetricInput-input--" + size] = size, _b["mr-4"] = !suffix && !showActionButton && size === 'regular', _b["mr-6"] = !suffix && !showActionButton && size === 'large', _b));
5589
5610
  var iconClass = classNames__default["default"]((_c = {}, _c['MetricInput-icon'] = true, _c["MetricInput-icon--" + size] = size, _c));
5590
5611
  var actionButton = classNames__default["default"]((_d = {}, _d['p-0'] = true, _d["MetricInput-arrowIcon--" + size] = size, _d['ml-4'] = size === 'regular', _d['ml-6'] = size === 'large', _d));
5591
5612
 
@@ -5636,6 +5657,12 @@
5636
5657
  }
5637
5658
  };
5638
5659
 
5660
+ var handleKeyDown = function handleKeyDown(e) {
5661
+ if (showActionButton) {
5662
+ onKeyDown(e);
5663
+ } else e.preventDefault();
5664
+ };
5665
+
5639
5666
  var actionButtonSize = size === 'large' ? 'regular' : 'tiny';
5640
5667
  return /*#__PURE__*/React__namespace.createElement("div", {
5641
5668
  "data-test": "DesignSystem-MetricInputWrapper",
@@ -5669,13 +5696,13 @@
5669
5696
  onBlur: onBlur,
5670
5697
  onClick: onClick,
5671
5698
  onFocus: onFocus,
5672
- onKeyDown: onKeyDown
5699
+ onKeyDown: handleKeyDown
5673
5700
  })), suffix && /*#__PURE__*/React__namespace.createElement(Text, {
5674
5701
  "data-test": "DesignSystem-MetricInput--suffix",
5675
5702
  className: size === 'regular' ? 'ml-4' : 'ml-5',
5676
5703
  size: size,
5677
5704
  appearance: "subtle"
5678
- }, suffix), /*#__PURE__*/React__namespace.createElement("div", {
5705
+ }, suffix), showActionButton && /*#__PURE__*/React__namespace.createElement("div", {
5679
5706
  className: "MetricInput-arrowIcons"
5680
5707
  }, /*#__PURE__*/React__namespace.createElement(Button, {
5681
5708
  icon: "keyboard_arrow_up",
@@ -9049,7 +9076,7 @@
9049
9076
  onClick: function onClick(event) {
9050
9077
  if (onClose) onClose(event, 'IconClick');
9051
9078
  }
9052
- })))), children && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, headerOptions || footerOptions || footer || header ? /*#__PURE__*/React__namespace.createElement(OverlayBody, {
9079
+ })))), open && children && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, headerOptions || footerOptions || footer || header ? /*#__PURE__*/React__namespace.createElement(OverlayBody, {
9053
9080
  className: bodyClass
9054
9081
  }, this.props.children) : children), (!!footer || !!footerOptions) && /*#__PURE__*/React__namespace.createElement(OverlayFooter, __assign({
9055
9082
  "data-test": "DesignSystem-Modal--footer"
@@ -11285,8 +11312,6 @@
11285
11312
  var Tabs = function Tabs(props) {
11286
11313
  var _a, _b, _c;
11287
11314
 
11288
- var _d, _e, _f;
11289
-
11290
11315
  var children = props.children,
11291
11316
  withSeparator = props.withSeparator,
11292
11317
  onTabChange = props.onTabChange,
@@ -11297,9 +11322,9 @@
11297
11322
  var inlineComponent = children ? filterInlineComponent(children) : /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null);
11298
11323
  var totalTabs = tabs.length;
11299
11324
 
11300
- var _g = React__namespace.useState(props.activeIndex && props.activeIndex < totalTabs ? props.activeIndex : 0),
11301
- activeIndex = _g[0],
11302
- setActiveTab = _g[1];
11325
+ var _d = React__namespace.useState(props.activeIndex && props.activeIndex < totalTabs ? props.activeIndex : 0),
11326
+ activeIndex = _d[0],
11327
+ setActiveTab = _d[1];
11303
11328
 
11304
11329
  React__namespace.useEffect(function () {
11305
11330
  if (props.activeIndex !== undefined && props.activeIndex < totalTabs) {
@@ -11315,17 +11340,24 @@
11315
11340
  return classNames__default["default"]((_a = {}, _a['Tab-pills'] = true, _a['Tab-pills--disabled'] = disabled, _a));
11316
11341
  };
11317
11342
 
11318
- var activeTab;
11319
- var activeTabClass;
11343
+ var getActiveTabClass = function getActiveTabClass() {
11344
+ var _a;
11345
+
11346
+ var activeTab;
11347
+ var activeTabClass;
11320
11348
 
11321
- if ('props' in tabs[activeIndex]) {
11322
- activeTab = tabs[activeIndex];
11323
- activeTabClass = (_d = activeTab.props) === null || _d === void 0 ? void 0 : _d.className;
11324
- } else {
11325
- activeTab = tabs[activeIndex];
11326
- activeTabClass = activeTab.className;
11327
- }
11349
+ if (tabs && tabs.length && tabs[activeIndex] && 'props' in tabs[activeIndex]) {
11350
+ activeTab = tabs[activeIndex];
11351
+ activeTabClass = (_a = activeTab.props) === null || _a === void 0 ? void 0 : _a.className;
11352
+ } else {
11353
+ activeTab = tabs[activeIndex];
11354
+ activeTabClass = activeTab && activeTab.className;
11355
+ }
11356
+
11357
+ return activeTabClass;
11358
+ };
11328
11359
 
11360
+ var activeTabClass = getActiveTabClass();
11329
11361
  var tabContentClass = classNames__default["default"]((_c = {}, _c['TabsWrapper-content'] = true, _c["" + activeTabClass] = activeTabClass, _c));
11330
11362
 
11331
11363
  var tabClickHandler = function tabClickHandler(tabIndex, isKeyboard) {
@@ -11470,19 +11502,10 @@
11470
11502
  className: wrapperClass
11471
11503
  }), /*#__PURE__*/React__namespace.createElement("div", {
11472
11504
  className: headerClass
11473
- }, renderTabs, inlineComponent), children && ((_e = tabs[activeIndex].props) === null || _e === void 0 ? void 0 : _e.disabled) ? /*#__PURE__*/React__namespace.createElement("div", {
11474
- className: "h-100 pb-5",
11475
- style: {
11476
- backgroundColor: 'var(--secondary-lightest)'
11477
- }
11478
- }, /*#__PURE__*/React__namespace.createElement(EmptyState, {
11479
- title: "There's a problem loading this page.",
11480
- description: "Tab is disabled and you are not authorized to see the content of this tab",
11481
- size: "large"
11482
- })) : children && !((_f = tabs[activeIndex].props) === null || _f === void 0 ? void 0 : _f.disabled) ? /*#__PURE__*/React__namespace.createElement("div", {
11505
+ }, renderTabs, inlineComponent), children && /*#__PURE__*/React__namespace.createElement("div", {
11483
11506
  className: tabContentClass,
11484
11507
  "data-test": "DesignSystem-Tabs--Content"
11485
- }, tabs[activeIndex]) : null);
11508
+ }, tabs[activeIndex]));
11486
11509
  };
11487
11510
  Tabs.displayName = 'Tabs';
11488
11511
  Tabs.defaultProps = {
@@ -12705,12 +12728,15 @@
12705
12728
  return sizes[cellType];
12706
12729
  }
12707
12730
 
12708
- var updateBatchData = function updateBatchData(data, rowIndexes, dataUpdate) {
12731
+ var updateBatchData = function updateBatchData(data, rowIndexes, dataUpdate, selectDisabledRow) {
12709
12732
  var updatedData = __spreadArrays(data);
12710
12733
 
12711
12734
  for (var _i = 0, rowIndexes_1 = rowIndexes; _i < rowIndexes_1.length; _i++) {
12712
12735
  var rowIndex = rowIndexes_1[_i];
12713
- updatedData[rowIndex] = __assign(__assign({}, updatedData[rowIndex]), dataUpdate);
12736
+
12737
+ if (data[rowIndex].disabled && selectDisabledRow || !data[rowIndex].disabled) {
12738
+ updatedData[rowIndex] = __assign(__assign({}, updatedData[rowIndex]), dataUpdate);
12739
+ }
12714
12740
  }
12715
12741
 
12716
12742
  return updatedData;
@@ -12817,7 +12843,11 @@
12817
12843
  var getTotalPages = function getTotalPages(totalRecords, pageSize) {
12818
12844
  return Math.ceil(totalRecords / pageSize);
12819
12845
  };
12820
- var getSelectAll = function getSelectAll(data) {
12846
+ var getSelectAll = function getSelectAll(tableData, selectDisabledRow) {
12847
+ var data = tableData.filter(function (d) {
12848
+ return d.disabled && selectDisabledRow || !d.disabled;
12849
+ });
12850
+
12821
12851
  if (data.length) {
12822
12852
  var anyUnSelected = data.some(function (d) {
12823
12853
  return !d._selected;
@@ -13323,7 +13353,8 @@
13323
13353
  setExpanded = _a[1];
13324
13354
 
13325
13355
  var rowClasses = classNames__default["default"]('Grid-row', 'Grid-row--body', {
13326
- 'Grid-row--selected': data._selected
13356
+ 'Grid-row--selected': data._selected,
13357
+ 'Grid-row--disabled': data.disabled
13327
13358
  });
13328
13359
  var onClickHandler = React__namespace.useCallback(function () {
13329
13360
  if (type === 'resource' && !loading) {
@@ -13395,6 +13426,7 @@
13395
13426
  return /*#__PURE__*/React__namespace.createElement("div", {
13396
13427
  className: wrapperClasses
13397
13428
  }, /*#__PURE__*/React__namespace.createElement("div", {
13429
+ "data-test": "DesignSystem-Grid-row",
13398
13430
  className: rowClasses,
13399
13431
  onClick: onClickHandler,
13400
13432
  ref: rowRef
@@ -14157,7 +14189,8 @@
14157
14189
  updateSearchTerm = props.updateSearchTerm,
14158
14190
  dynamicColumn = props.dynamicColumn,
14159
14191
  allowSelectAll = props.allowSelectAll,
14160
- showFilters = props.showFilters;
14192
+ showFilters = props.showFilters,
14193
+ customSelectionLabel = props.customSelectionLabel;
14161
14194
 
14162
14195
  var _c = React__namespace.useState(false),
14163
14196
  selectAllRecords = _c[0],
@@ -14219,12 +14252,13 @@
14219
14252
  if (updateSchema) updateSchema(newSchema);
14220
14253
  };
14221
14254
 
14255
+ var customLabel = customSelectionLabel ? customSelectionLabel : 'item';
14222
14256
  var selectedCount = data.filter(function (d) {
14223
14257
  return d._selected;
14224
14258
  }).length;
14225
14259
  var startIndex = (page - 1) * pageSize + 1;
14226
14260
  var endIndex = Math.min(page * pageSize, totalRecords);
14227
- var label = error ? 'Showing 0 items' : withCheckbox && selectedCount ? selectAllRecords ? "Selected all " + totalRecords + " item" + getPluralSuffix(totalRecords) : "Selected " + selectedCount + " item" + getPluralSuffix(totalRecords) + " on this page" : withPagination ? "Showing " + startIndex + "-" + endIndex + " of " + totalRecords + " item" + getPluralSuffix(totalRecords) : "Showing " + totalRecords + " item" + getPluralSuffix(totalRecords);
14261
+ var label = error ? "Showing 0 " + customLabel + "s" : withCheckbox && selectedCount ? selectAllRecords ? "Selected all " + totalRecords + " " + customLabel + getPluralSuffix(totalRecords) : "Selected " + selectedCount + " " + customLabel + getPluralSuffix(totalRecords) + " on this page" : withPagination ? "Showing " + startIndex + "-" + endIndex + " of " + totalRecords + " " + customLabel + getPluralSuffix(totalRecords) : "Showing " + totalRecords + " " + customLabel + getPluralSuffix(totalRecords);
14228
14262
  return /*#__PURE__*/React__namespace.createElement("div", {
14229
14263
  className: "Header"
14230
14264
  }, /*#__PURE__*/React__namespace.createElement("div", {
@@ -14241,7 +14275,8 @@
14241
14275
  onClear: function onClear() {
14242
14276
  return updateSearchTerm && updateSearchTerm('');
14243
14277
  },
14244
- disabled: loading && !hasSchema(schema)
14278
+ disabled: loading && !hasSchema(schema),
14279
+ autoComplete: "off"
14245
14280
  })), showFilters && filterSchema.length > 0 && /*#__PURE__*/React__namespace.createElement("div", {
14246
14281
  className: "Header-dropdown"
14247
14282
  }, /*#__PURE__*/React__namespace.createElement("div", {
@@ -14291,7 +14326,7 @@
14291
14326
  onClick: function onClick() {
14292
14327
  return setSelectAllRecords(true);
14293
14328
  }
14294
- }, "Select all " + totalRecords + " items") : /*#__PURE__*/React__namespace.createElement(Button, {
14329
+ }, "Select all " + totalRecords + " " + customLabel + "s") : /*#__PURE__*/React__namespace.createElement(Button, {
14295
14330
  "data-test": "DesignSystem-Table-Header--clearSelectionItemsButton",
14296
14331
  size: "tiny",
14297
14332
  onClick: function onClick() {
@@ -14406,7 +14441,7 @@
14406
14441
  _this.setState({
14407
14442
  data: data,
14408
14443
  schema: schema,
14409
- selectAll: getSelectAll(data),
14444
+ selectAll: getSelectAll(data, _this.props.selectDisabledRow),
14410
14445
  totalRecords: res.count,
14411
14446
  loading: false,
14412
14447
  error: !data.length,
@@ -14439,7 +14474,7 @@
14439
14474
  totalRecords: totalRecords,
14440
14475
  error: !renderedData.length,
14441
14476
  errorType: 'NO_RECORDS_FOUND',
14442
- selectAll: getSelectAll(renderedData),
14477
+ selectAll: getSelectAll(renderedData, _this.props.selectDisabledRow),
14443
14478
  schema: renderedSchema,
14444
14479
  data: renderedData
14445
14480
  });
@@ -14455,11 +14490,11 @@
14455
14490
  if (rowIndexes >= 0) {
14456
14491
  newData = updateBatchData(data, indexes, {
14457
14492
  _selected: selected
14458
- });
14493
+ }, _this.props.selectDisabledRow);
14459
14494
 
14460
14495
  _this.setState({
14461
14496
  data: newData,
14462
- selectAll: getSelectAll(newData)
14497
+ selectAll: getSelectAll(newData, _this.props.selectDisabledRow)
14463
14498
  });
14464
14499
  }
14465
14500
 
@@ -14480,17 +14515,23 @@
14480
14515
  });
14481
14516
  var newData = updateBatchData(data, indexes, {
14482
14517
  _selected: selected
14518
+ }, _this.props.selectDisabledRow);
14519
+ var selectedIndex = [];
14520
+ newData.forEach(function (item, key) {
14521
+ if (item._selected) {
14522
+ selectedIndex.push(key);
14523
+ }
14483
14524
  });
14484
14525
 
14485
14526
  if (onSelect) {
14486
- onSelect(indexes, selected, newData.filter(function (d) {
14527
+ onSelect(selectedIndex, selected, newData.filter(function (d) {
14487
14528
  return d._selected;
14488
14529
  }), selectAll);
14489
14530
  }
14490
14531
 
14491
14532
  _this.setState({
14492
14533
  data: newData,
14493
- selectAll: getSelectAll(newData)
14534
+ selectAll: getSelectAll(newData, _this.props.selectDisabledRow)
14494
14535
  });
14495
14536
  };
14496
14537
 
@@ -14558,7 +14599,7 @@
14558
14599
  var _this = this;
14559
14600
 
14560
14601
  if (!this.state.async) {
14561
- if (prevProps.loading !== this.props.loading || prevProps.error !== this.props.error || this.props.schema !== prevProps.schema) {
14602
+ if (prevProps.loading !== this.props.loading || prevProps.error !== this.props.error) {
14562
14603
  var _a = this.props,
14563
14604
  _b = _a.data,
14564
14605
  data = _b === void 0 ? [] : _b,
@@ -15317,7 +15358,7 @@
15317
15358
  size = props.size;
15318
15359
  var baseProps = extractBaseProps(props);
15319
15360
  var InlineMessageClass = classNames__default["default"]((_a = {}, _a['InlineMessage'] = true, _a), className);
15320
- var IconClass = classNames__default["default"]((_b = {}, _b['InlineMessage-icon'] = true, _b['InlineMessage-icon--warning'] = appearance === 'warning', _b));
15361
+ var IconClass = classNames__default["default"]((_b = {}, _b['InlineMessage-icon--warning'] = appearance === 'warning', _b['InlineMessage-icon--small'] = size === 'small', _b['InlineMessage-icon--regular'] = size === 'regular', _b));
15321
15362
  var DescriptionClass = classNames__default["default"]((_c = {}, _c["InlineMessage-text--" + appearance] = appearance, _c));
15322
15363
  var IconSize = size === 'small' ? 14 : 16;
15323
15364
  var TextWeight = size === 'small' ? 'medium' : undefined;
@@ -15505,7 +15546,7 @@
15505
15546
  };
15506
15547
  HelpText.displayName = 'HelpText';
15507
15548
 
15508
- var version = "2.13.5";
15549
+ var version = "2.13.6";
15509
15550
 
15510
15551
  exports.Avatar = Avatar;
15511
15552
  exports.AvatarGroup = AvatarGroup;