@digital-ai/dot-components 1.9.1 → 1.10.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.
package/CHANGE_LOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.10.1](https://github.com/digital-ai/dot-components/tree/1.10.1) (03/02/2022)
4
+
5
+ [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.10.0...1.10.1)
6
+
7
+ ## [1.10.0](https://github.com/digital-ai/dot-components/tree/1.10.0) (03/01/2022)
8
+
9
+ [Full Changelog](https://github.com/digital-ai/dot-components/compare/2.0.1-rc.0...1.10.0)
10
+
11
+ **Features:**
12
+
13
+ - `Autocomplete` hide/customize chips [\#1023](https://github.com/digital-ai/dot-components/issues/1023)
14
+ - S-82231: `Autocomplete` hide/customize chips [\#1031](https://github.com/digital-ai/dot-components/pull/1031) ([dmiletic85](https://github.com/dmiletic85))
15
+
16
+ ## [2.0.1-rc.0](https://github.com/digital-ai/dot-components/tree/2.0.1-rc.0) (02/25/2022)
17
+
18
+ [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.9.1...2.0.1-rc.0)
19
+
20
+ **Features:**
21
+
22
+ - Missing disable props on DotMenu component [\#1021](https://github.com/digital-ai/dot-components/issues/1021)
23
+ - `Autocomplete`: allow custom `renderOption` [\#1002](https://github.com/digital-ai/dot-components/issues/1002)
24
+ - S-82227: `DotMenu`: Missing disable prop [\#1022](https://github.com/digital-ai/dot-components/pull/1022) ([dmiletic85](https://github.com/dmiletic85))
25
+ - S-82076: `Autocomplete`: allow custom `renderOption` [\#1013](https://github.com/digital-ai/dot-components/pull/1013) ([dmiletic85](https://github.com/dmiletic85))
26
+
27
+ **Fixed bugs:**
28
+
29
+ - `Autocomplete` popper shouldn't take full height of screen [\#1024](https://github.com/digital-ai/dot-components/issues/1024)
30
+ - No default icon for DotList items [\#1009](https://github.com/digital-ai/dot-components/issues/1009)
31
+ - D-20111: `Autocomplete` popper shouldn't take full height of screen [\#1029](https://github.com/digital-ai/dot-components/pull/1029) ([dmiletic85](https://github.com/dmiletic85))
32
+ - D-20010: `DotList `: No default icon for DotList items [\#1014](https://github.com/digital-ai/dot-components/pull/1014) ([dmiletic85](https://github.com/dmiletic85))
33
+
34
+ **Merged pull requests:**
35
+
36
+ - S-81949: migrate test into rc workflow to simplify process [\#1030](https://github.com/digital-ai/dot-components/pull/1030) ([CWSites](https://github.com/CWSites))
37
+ - S-81949: attempting branch name instead of sha [\#1028](https://github.com/digital-ai/dot-components/pull/1028) ([CWSites](https://github.com/CWSites))
38
+ - S-81949: simplfying wait step, extend interval to 30s [\#1027](https://github.com/digital-ai/dot-components/pull/1027) ([CWSites](https://github.com/CWSites))
39
+ - S-81949: add release candidate workflow [\#1026](https://github.com/digital-ai/dot-components/pull/1026) ([CWSites](https://github.com/CWSites))
40
+
3
41
  ## [1.9.1](https://github.com/digital-ai/dot-components/tree/1.9.1) (02/17/2022)
4
42
 
5
43
  [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.9.0...1.9.1)
@@ -193,6 +231,7 @@
193
231
  - `sidebar` Changes on back arrow [\#890](https://github.com/digital-ai/dot-components/issues/890)
194
232
  - `Breadcrumbs` Display tooltip on last item \(on hover\) when it is clipped with ellipsis [\#878](https://github.com/digital-ai/dot-components/issues/878)
195
233
  - S-80939: `Menu`: Add option to customize item's height [\#902](https://github.com/digital-ai/dot-components/pull/902) ([dmiletic85](https://github.com/dmiletic85))
234
+ - S-80871: `Sidebar` Changes on back arrow [\#896](https://github.com/digital-ai/dot-components/pull/896) ([dmiletic85](https://github.com/dmiletic85))
196
235
  - S-80855: Display tooltip on last breadcrumb item \(on hover\) when it is clipped with ellipsis [\#883](https://github.com/digital-ai/dot-components/pull/883) ([dmiletic85](https://github.com/dmiletic85))
197
236
 
198
237
  **Fixed bugs:**
@@ -211,7 +250,6 @@
211
250
  **Features:**
212
251
 
213
252
  - `Sidebar` Ability to view the sub nav items without expanding the DotSidebar [\#787](https://github.com/digital-ai/dot-components/issues/787)
214
- - S-80871: `Sidebar` Changes on back arrow [\#896](https://github.com/digital-ai/dot-components/pull/896) ([dmiletic85](https://github.com/dmiletic85))
215
253
 
216
254
  **Fixed bugs:**
217
255
 
@@ -313,7 +351,6 @@
313
351
  - Extended sidenav drawer should collapse when another drawer option is clicked [\#739](https://github.com/digital-ai/dot-components/issues/739)
314
352
  - \#841 Fix DotDynamicForm initial form state for controls with initialValue false [\#842](https://github.com/digital-ai/dot-components/pull/842) ([selsemore](https://github.com/selsemore))
315
353
  - D-19189: Extended sidenav drawer should collapse when another drawer option is clicked [\#830](https://github.com/digital-ai/dot-components/pull/830) ([dmiletic85](https://github.com/dmiletic85))
316
- - D-19151: `DotBadge` generates console warnings [\#827](https://github.com/digital-ai/dot-components/pull/827) ([dmiletic85](https://github.com/dmiletic85))
317
354
 
318
355
  **Merged pull requests:**
319
356
 
@@ -336,6 +373,7 @@
336
373
  - Go back item in `Sidebar` is not aligned with rest of items [\#824](https://github.com/digital-ai/dot-components/issues/824)
337
374
  - DotBadge generates console warnings [\#816](https://github.com/digital-ai/dot-components/issues/816)
338
375
  - Sidebar scrollbar should be positioned on the very right of the sidebar [\#746](https://github.com/digital-ai/dot-components/issues/746)
376
+ - D-19151: `DotBadge` generates console warnings [\#827](https://github.com/digital-ai/dot-components/pull/827) ([dmiletic85](https://github.com/dmiletic85))
339
377
  - D-19177: `Go back` item in `DotSidebar` is not aligned with rest of items [\#826](https://github.com/digital-ai/dot-components/pull/826) ([dmiletic85](https://github.com/dmiletic85))
340
378
 
341
379
  ## [1.3.4](https://github.com/digital-ai/dot-components/tree/1.3.4) (11/30/2021)
package/index.esm.js CHANGED
@@ -1365,12 +1365,17 @@ var variables = /*#__PURE__*/Object.freeze({
1365
1365
  const flyoutMenuClassName = 'dot-flyout-menu';
1366
1366
  const rootClassName$M = 'dot-menu';
1367
1367
  const popperClassName = 'dot-popper';
1368
+ const getListMaxHeight = maxHeight => isString(maxHeight) ? maxHeight : `${maxHeight}px`;
1368
1369
  const StyledPopper$1 = styled(Popper).withConfig({
1369
1370
  displayName: "Menustyles__StyledPopper",
1370
1371
  componentId: "sc-134fmqu-0"
1371
1372
  })(["", ""], ({
1372
1373
  theme
1373
- }) => css(["&.", "{z-index:", ";}&.", ",&.", "{&.loading .MuiPaper-root{align-items:center;display:flex;justify-content:center;min-height:200px;min-width:200px;}ul,.dot-action-item{background:", ";.dot-action-item-text{white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;}}ul{box-sizing:content-box;min-width:112px;max-height:calc(100vh - 24px);overflow:auto;.dot-li{min-height:auto;&:hover{background:", ";}&:active,&:focus{background:", ";}}.dot-link{color:", ";}}.dot-action-item{height:", "px;border-top:1px solid ", ";line-height:inherit;button.dot-button{border-radius:", ";justify-content:flex-start;height:100%;margin:0;&:focus-visible{background-color:", ";}.MuiButton-label{gap:", "px;.MuiButton-startIcon{margin-left:0;.dot-icon{flex-shrink:0;}}}}}}"], popperClassName, levelSecond, rootClassName$M, popperClassName, theme.palette.product === 'agility' && theme.palette.agilityInterface.menuBg, theme.palette.product === 'agility' && theme.palette.agilityInterface.fixedCol, theme.palette.product === 'agility' && theme.palette.agilityInterface.activeCardBg, theme.palette.product === 'agility' && theme.palette.layer.n700, theme.spacing(7), theme.palette.grey[100], theme.spacing(0, 0, 0.5, 0.5), theme.palette.product === 'agility' && theme.palette.type === 'dark' ? theme.palette.layer.n200 : theme.palette.layer.n100, theme.spacing(3)));
1374
+ }) => css(["&.", "{z-index:", ";}&.", ",&.", "{&.loading .MuiPaper-root{align-items:center;display:flex;justify-content:center;min-height:200px;min-width:200px;}ul,.dot-action-item{background:", ";.dot-action-item-text{white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;}}ul{box-sizing:content-box;min-width:112px;overflow:auto;", " .dot-li{min-height:auto;&:hover{background:", ";}&:active,&:focus{background:", ";}}.dot-link{color:", ";}}.dot-action-item{height:", "px;border-top:1px solid ", ";line-height:inherit;button.dot-button{border-radius:", ";justify-content:flex-start;height:100%;margin:0;&:focus-visible{background-color:", ";}.MuiButton-label{gap:", "px;.MuiButton-startIcon{margin-left:0;.dot-icon{flex-shrink:0;}}}}}}"], popperClassName, levelSecond, rootClassName$M, popperClassName, theme.palette.product === 'agility' && theme.palette.agilityInterface.menuBg, ({
1375
+ $maxHeight
1376
+ }) => $maxHeight !== undefined && `
1377
+ max-height: ${getListMaxHeight($maxHeight)};
1378
+ `, theme.palette.product === 'agility' && theme.palette.agilityInterface.fixedCol, theme.palette.product === 'agility' && theme.palette.agilityInterface.activeCardBg, theme.palette.product === 'agility' && theme.palette.layer.n700, theme.spacing(7), theme.palette.grey[100], theme.spacing(0, 0, 0.5, 0.5), theme.palette.product === 'agility' && theme.palette.type === 'dark' ? theme.palette.layer.n200 : theme.palette.layer.n100, theme.spacing(3)));
1374
1379
 
1375
1380
  const MENU_ITEM_HEIGHT_NORMAL = 33;
1376
1381
  const MENU_ITEM_HEIGHT_DENSE = 28;
@@ -1505,6 +1510,7 @@ const DotMenuList = /*#__PURE__*/forwardRef(({
1505
1510
  ariaLabel: itemAriaLabel,
1506
1511
  children,
1507
1512
  classes,
1513
+ disabled,
1508
1514
  divider,
1509
1515
  height,
1510
1516
  items: subItems,
@@ -1534,6 +1540,7 @@ const DotMenuList = /*#__PURE__*/forwardRef(({
1534
1540
  autoFocus: hasAutoFocus,
1535
1541
  "aria-label": itemAriaLabel,
1536
1542
  className: menuItemClasses,
1543
+ disabled: disabled,
1537
1544
  disableRipple: hasSubmenu,
1538
1545
  divider: divider,
1539
1546
  key: key,
@@ -1550,7 +1557,7 @@ const DotMenuList = /*#__PURE__*/forwardRef(({
1550
1557
  }), hasSubmenu && onSubMenuCreate({
1551
1558
  anchorElement: subItemAnchorEl,
1552
1559
  isOpened: isSelected,
1553
- subMenuId: `${index}-${key}`,
1560
+ subMenuId: key,
1554
1561
  subMenuItems: subItems
1555
1562
  }));
1556
1563
  }));
@@ -1918,7 +1925,7 @@ const DotList = ({
1918
1925
  primaryText: item.primaryText,
1919
1926
  secondaryText: item.secondaryText,
1920
1927
  selected: item.selected,
1921
- startIconId: item.startIconId || 'block',
1928
+ startIconId: item.startIconId,
1922
1929
  target: item.target,
1923
1930
  text: item.text,
1924
1931
  title: item.title,
@@ -2280,6 +2287,15 @@ const DotSidebar = ({
2280
2287
  const hasBackItem = _goBack && backItem;
2281
2288
  const displayHeader = title || hasAppLogo;
2282
2289
  const openClass = isOpen ? 'open' : 'collapsed';
2290
+
2291
+ const checkPrimaryNavMissingIcons = () => _navItems.some(item => !item.divider && !item.startIconId);
2292
+
2293
+ useEffect(() => {
2294
+ // Incorrect usage warning
2295
+ if (_collapsable && checkPrimaryNavMissingIcons()) {
2296
+ console.warn('When using `collapsable`, please define `startIconId` for each item in primary nav.');
2297
+ }
2298
+ }, []);
2283
2299
  useEffect(() => {
2284
2300
  setIsOpen(_open);
2285
2301
  }, [_open]);
@@ -2724,6 +2740,7 @@ const DotAutoComplete = ({
2724
2740
  disabled: _disabled = false,
2725
2741
  disablePortal: _disablePortal = true,
2726
2742
  error: _error = false,
2743
+ filterSelectedOptions: _filterSelectedOptions = true,
2727
2744
  freesolo: _freesolo = true,
2728
2745
  group: _group = false,
2729
2746
  helperText,
@@ -2731,6 +2748,7 @@ const DotAutoComplete = ({
2731
2748
  inputRef,
2732
2749
  label,
2733
2750
  loading,
2751
+ maxHeight,
2734
2752
  multiple: _multiple = true,
2735
2753
  onChange,
2736
2754
  onClose,
@@ -2739,6 +2757,8 @@ const DotAutoComplete = ({
2739
2757
  open,
2740
2758
  options,
2741
2759
  placeholder,
2760
+ renderOption,
2761
+ renderTags,
2742
2762
  required: _required = false,
2743
2763
  size: _size = 'small',
2744
2764
  value
@@ -2798,7 +2818,8 @@ const DotAutoComplete = ({
2798
2818
  const DotPopper = props => {
2799
2819
  if (!isActionItemDefined) return /*#__PURE__*/React__default.createElement(StyledPopper$1, Object.assign({}, props, {
2800
2820
  className: popperClassName,
2801
- disablePortal: _disablePortal
2821
+ disablePortal: _disablePortal,
2822
+ "$maxHeight": maxHeight
2802
2823
  })); // Disable action if customer explicitly enabled duplicate
2803
2824
  // item insertion and input text is found inside the 'options'
2804
2825
 
@@ -2826,7 +2847,8 @@ const DotAutoComplete = ({
2826
2847
 
2827
2848
  return /*#__PURE__*/React__default.createElement(StyledPopper$1, Object.assign({}, props, {
2828
2849
  className: popperClassName,
2829
- disablePortal: _disablePortal
2850
+ disablePortal: _disablePortal,
2851
+ "$maxHeight": maxHeight
2830
2852
  }), /*#__PURE__*/React__default.createElement(Paper, Object.assign({}, paperProps), paperChildren, /*#__PURE__*/React__default.createElement("div", {
2831
2853
  className: "dot-action-item",
2832
2854
 
@@ -2888,6 +2910,11 @@ const DotAutoComplete = ({
2888
2910
 
2889
2911
  const handleRenderChips = (values, getTagProps) => getChipsFromAutocomplete(values, getTagProps, _dense ? 'small' : 'medium');
2890
2912
 
2913
+ const handleTagsRender = () => {
2914
+ if (!_multiple) return;
2915
+ return renderTags || handleRenderChips;
2916
+ };
2917
+
2891
2918
  return /*#__PURE__*/React__default.createElement(StyledAutocomplete, {
2892
2919
  PopperComponent: DotPopper,
2893
2920
  "aria-label": ariaLabel,
@@ -2898,7 +2925,7 @@ const DotAutoComplete = ({
2898
2925
  "data-testid": dataTestId,
2899
2926
  defaultValue: defaultValue,
2900
2927
  disabled: _disabled,
2901
- filterSelectedOptions: true,
2928
+ filterSelectedOptions: _filterSelectedOptions,
2902
2929
  freeSolo: _freesolo,
2903
2930
  getOptionLabel: option => parseAutoCompleteValue(option),
2904
2931
  groupBy: _group ? option => option.group : undefined,
@@ -2973,7 +3000,8 @@ const DotAutoComplete = ({
2973
3000
  }))
2974
3001
  );
2975
3002
  },
2976
- renderTags: _multiple ? handleRenderChips : null,
3003
+ renderOption: renderOption,
3004
+ renderTags: handleTagsRender(),
2977
3005
  size: _size,
2978
3006
  value: value
2979
3007
  });
package/index.umd.js CHANGED
@@ -1507,12 +1507,18 @@
1507
1507
  var flyoutMenuClassName = 'dot-flyout-menu';
1508
1508
  var rootClassName$M = 'dot-menu';
1509
1509
  var popperClassName = 'dot-popper';
1510
+ var getListMaxHeight = function getListMaxHeight(maxHeight) {
1511
+ return isString(maxHeight) ? maxHeight : maxHeight + "px";
1512
+ };
1510
1513
  var StyledPopper$1 = styled__default["default"](core.Popper).withConfig({
1511
1514
  displayName: "Menustyles__StyledPopper",
1512
1515
  componentId: "sc-134fmqu-0"
1513
1516
  })(templateObject_2$O || (templateObject_2$O = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
1514
1517
  var theme = _a.theme;
1515
- return styled.css(templateObject_1$Q || (templateObject_1$Q = __makeTemplateObject(["\n &.", " {\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n background: ", ";\n\n .dot-action-item-text {\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n }\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n max-height: calc(100vh - 24px);\n overflow: auto;\n\n .dot-li {\n min-height: auto;\n\n &:hover {\n background: ", ";\n }\n\n &:active,\n &:focus {\n background: ", ";\n }\n }\n\n .dot-link {\n color: ", ";\n }\n }\n\n .dot-action-item {\n height: ", "px;\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", "px;\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "], ["\n &.", " {\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n background: ", ";\n\n .dot-action-item-text {\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n }\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n max-height: calc(100vh - 24px);\n overflow: auto;\n\n .dot-li {\n min-height: auto;\n\n &:hover {\n background: ", ";\n }\n\n &:active,\n &:focus {\n background: ", ";\n }\n }\n\n .dot-link {\n color: ", ";\n }\n }\n\n .dot-action-item {\n height: ", "px;\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", "px;\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "])), popperClassName, levelSecond, rootClassName$M, popperClassName, theme.palette.product === 'agility' && theme.palette.agilityInterface.menuBg, theme.palette.product === 'agility' && theme.palette.agilityInterface.fixedCol, theme.palette.product === 'agility' && theme.palette.agilityInterface.activeCardBg, theme.palette.product === 'agility' && theme.palette.layer.n700, theme.spacing(7), theme.palette.grey[100], theme.spacing(0, 0, 0.5, 0.5), theme.palette.product === 'agility' && theme.palette.type === 'dark' ? theme.palette.layer.n200 : theme.palette.layer.n100, theme.spacing(3));
1518
+ return styled.css(templateObject_1$Q || (templateObject_1$Q = __makeTemplateObject(["\n &.", " {\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n background: ", ";\n\n .dot-action-item-text {\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n }\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n overflow: auto;\n\n /* Conditionally setting 'max-height' with transient prop */\n ", "\n\n .dot-li {\n min-height: auto;\n\n &:hover {\n background: ", ";\n }\n\n &:active,\n &:focus {\n background: ", ";\n }\n }\n\n .dot-link {\n color: ", ";\n }\n }\n\n .dot-action-item {\n height: ", "px;\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", "px;\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "], ["\n &.", " {\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n background: ", ";\n\n .dot-action-item-text {\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n }\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n overflow: auto;\n\n /* Conditionally setting 'max-height' with transient prop */\n ", "\n\n .dot-li {\n min-height: auto;\n\n &:hover {\n background: ", ";\n }\n\n &:active,\n &:focus {\n background: ", ";\n }\n }\n\n .dot-link {\n color: ", ";\n }\n }\n\n .dot-action-item {\n height: ", "px;\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", "px;\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "])), popperClassName, levelSecond, rootClassName$M, popperClassName, theme.palette.product === 'agility' && theme.palette.agilityInterface.menuBg, function (_a) {
1519
+ var $maxHeight = _a.$maxHeight;
1520
+ return $maxHeight !== undefined && "\n max-height: " + getListMaxHeight($maxHeight) + ";\n ";
1521
+ }, theme.palette.product === 'agility' && theme.palette.agilityInterface.fixedCol, theme.palette.product === 'agility' && theme.palette.agilityInterface.activeCardBg, theme.palette.product === 'agility' && theme.palette.layer.n700, theme.spacing(7), theme.palette.grey[100], theme.spacing(0, 0, 0.5, 0.5), theme.palette.product === 'agility' && theme.palette.type === 'dark' ? theme.palette.layer.n200 : theme.palette.layer.n100, theme.spacing(3));
1516
1522
  });
1517
1523
  var templateObject_1$Q, templateObject_2$O;
1518
1524
 
@@ -1663,6 +1669,7 @@
1663
1669
  var itemAriaLabel = item.ariaLabel,
1664
1670
  children = item.children,
1665
1671
  classes = item.classes,
1672
+ disabled = item.disabled,
1666
1673
  divider = item.divider,
1667
1674
  height = item.height,
1668
1675
  subItems = item.items,
@@ -1691,6 +1698,7 @@
1691
1698
  autoFocus: hasAutoFocus,
1692
1699
  "aria-label": itemAriaLabel,
1693
1700
  className: menuItemClasses,
1701
+ disabled: disabled,
1694
1702
  disableRipple: hasSubmenu,
1695
1703
  divider: divider,
1696
1704
  key: key,
@@ -1707,7 +1715,7 @@
1707
1715
  }), hasSubmenu && onSubMenuCreate({
1708
1716
  anchorElement: subItemAnchorEl,
1709
1717
  isOpened: isSelected,
1710
- subMenuId: index + "-" + key,
1718
+ subMenuId: key,
1711
1719
  subMenuItems: subItems
1712
1720
  }));
1713
1721
  }));
@@ -2107,7 +2115,7 @@
2107
2115
  primaryText: item.primaryText,
2108
2116
  secondaryText: item.secondaryText,
2109
2117
  selected: item.selected,
2110
- startIconId: item.startIconId || 'block',
2118
+ startIconId: item.startIconId,
2111
2119
  target: item.target,
2112
2120
  text: item.text,
2113
2121
  title: item.title,
@@ -2493,6 +2501,19 @@
2493
2501
  var hasBackItem = goBack && backItem;
2494
2502
  var displayHeader = title || hasAppLogo;
2495
2503
  var openClass = isOpen ? 'open' : 'collapsed';
2504
+
2505
+ var checkPrimaryNavMissingIcons = function checkPrimaryNavMissingIcons() {
2506
+ return navItems.some(function (item) {
2507
+ return !item.divider && !item.startIconId;
2508
+ });
2509
+ };
2510
+
2511
+ React.useEffect(function () {
2512
+ // Incorrect usage warning
2513
+ if (collapsable && checkPrimaryNavMissingIcons()) {
2514
+ console.warn('When using `collapsable`, please define `startIconId` for each item in primary nav.');
2515
+ }
2516
+ }, []);
2496
2517
  React.useEffect(function () {
2497
2518
  setIsOpen(open);
2498
2519
  }, [open]);
@@ -2993,17 +3014,20 @@
2993
3014
  disablePortal = _d === void 0 ? true : _d,
2994
3015
  _e = _a.error,
2995
3016
  error = _e === void 0 ? false : _e,
2996
- _f = _a.freesolo,
2997
- freesolo = _f === void 0 ? true : _f,
2998
- _g = _a.group,
2999
- group = _g === void 0 ? false : _g,
3017
+ _f = _a.filterSelectedOptions,
3018
+ filterSelectedOptions = _f === void 0 ? true : _f,
3019
+ _g = _a.freesolo,
3020
+ freesolo = _g === void 0 ? true : _g,
3021
+ _h = _a.group,
3022
+ group = _h === void 0 ? false : _h,
3000
3023
  helperText = _a.helperText,
3001
3024
  inputId = _a.inputId,
3002
3025
  inputRef = _a.inputRef,
3003
3026
  label = _a.label,
3004
3027
  loading = _a.loading,
3005
- _h = _a.multiple,
3006
- multiple = _h === void 0 ? true : _h,
3028
+ maxHeight = _a.maxHeight,
3029
+ _j = _a.multiple,
3030
+ multiple = _j === void 0 ? true : _j,
3007
3031
  onChange = _a.onChange,
3008
3032
  onClose = _a.onClose,
3009
3033
  onInputChange = _a.onInputChange,
@@ -3011,32 +3035,34 @@
3011
3035
  open = _a.open,
3012
3036
  options = _a.options,
3013
3037
  placeholder = _a.placeholder,
3014
- _j = _a.required,
3015
- required = _j === void 0 ? false : _j,
3016
- _k = _a.size,
3017
- size = _k === void 0 ? 'small' : _k,
3038
+ renderOption = _a.renderOption,
3039
+ renderTags = _a.renderTags,
3040
+ _k = _a.required,
3041
+ required = _k === void 0 ? false : _k,
3042
+ _l = _a.size,
3043
+ size = _l === void 0 ? 'small' : _l,
3018
3044
  value = _a.value;
3019
3045
 
3020
- var _l = React.useState(!value && !defaultValue),
3021
- showPlaceholder = _l[0],
3022
- setShowPlaceholder = _l[1];
3046
+ var _m = React.useState(!value && !defaultValue),
3047
+ showPlaceholder = _m[0],
3048
+ setShowPlaceholder = _m[1];
3023
3049
 
3024
- var _m = actionItem || {},
3025
- _o = _m.iconId,
3026
- actionIconId = _o === void 0 ? 'add' : _o,
3027
- actionItemText = _m.text,
3028
- onActionItemClick = _m.onClick,
3029
- preventDuplicateInsertion = _m.preventDuplicateInsertion;
3050
+ var _o = actionItem || {},
3051
+ _p = _o.iconId,
3052
+ actionIconId = _p === void 0 ? 'add' : _p,
3053
+ actionItemText = _o.text,
3054
+ onActionItemClick = _o.onClick,
3055
+ preventDuplicateInsertion = _o.preventDuplicateInsertion;
3030
3056
 
3031
3057
  var isActionItemDefined = onActionItemClick !== undefined;
3032
3058
 
3033
- var _p = React.useState(false),
3034
- isOpened = _p[0],
3035
- setIsOpened = _p[1];
3059
+ var _q = React.useState(false),
3060
+ isOpened = _q[0],
3061
+ setIsOpened = _q[1];
3036
3062
 
3037
- var _q = React.useState(''),
3038
- inputText = _q[0],
3039
- setInputText = _q[1];
3063
+ var _r = React.useState(''),
3064
+ inputText = _r[0],
3065
+ setInputText = _r[1];
3040
3066
 
3041
3067
  var rootClasses = useStylesWithRootClass(rootClassName$E, className);
3042
3068
  var textFieldRootClasses = useStylesWithRootClass(rootClassName$D, className);
@@ -3084,7 +3110,8 @@
3084
3110
  var DotPopper = function DotPopper(props) {
3085
3111
  if (!isActionItemDefined) return /*#__PURE__*/React__default["default"].createElement(StyledPopper$1, __assign({}, props, {
3086
3112
  className: popperClassName,
3087
- disablePortal: disablePortal
3113
+ disablePortal: disablePortal,
3114
+ "$maxHeight": maxHeight
3088
3115
  })); // Disable action if customer explicitly enabled duplicate
3089
3116
  // item insertion and input text is found inside the 'options'
3090
3117
 
@@ -3112,7 +3139,8 @@
3112
3139
 
3113
3140
  return /*#__PURE__*/React__default["default"].createElement(StyledPopper$1, __assign({}, props, {
3114
3141
  className: popperClassName,
3115
- disablePortal: disablePortal
3142
+ disablePortal: disablePortal,
3143
+ "$maxHeight": maxHeight
3116
3144
  }), /*#__PURE__*/React__default["default"].createElement(core.Paper, __assign({}, paperProps), paperChildren, /*#__PURE__*/React__default["default"].createElement("div", {
3117
3145
  className: "dot-action-item",
3118
3146
 
@@ -3178,6 +3206,11 @@
3178
3206
  return getChipsFromAutocomplete(values, getTagProps, dense ? 'small' : 'medium');
3179
3207
  };
3180
3208
 
3209
+ var handleTagsRender = function handleTagsRender() {
3210
+ if (!multiple) return;
3211
+ return renderTags || handleRenderChips;
3212
+ };
3213
+
3181
3214
  return /*#__PURE__*/React__default["default"].createElement(StyledAutocomplete, {
3182
3215
  PopperComponent: DotPopper,
3183
3216
  "aria-label": ariaLabel,
@@ -3188,7 +3221,7 @@
3188
3221
  "data-testid": dataTestId,
3189
3222
  defaultValue: defaultValue,
3190
3223
  disabled: disabled,
3191
- filterSelectedOptions: true,
3224
+ filterSelectedOptions: filterSelectedOptions,
3192
3225
  freeSolo: freesolo,
3193
3226
  getOptionLabel: function (option) {
3194
3227
  return parseAutoCompleteValue(option);
@@ -3267,7 +3300,8 @@
3267
3300
  }))
3268
3301
  );
3269
3302
  },
3270
- renderTags: multiple ? handleRenderChips : null,
3303
+ renderOption: renderOption,
3304
+ renderTags: handleTagsRender(),
3271
3305
  size: size,
3272
3306
  value: value
3273
3307
  });
@@ -1,5 +1,5 @@
1
1
  import { ChangeEvent, ReactNode, Ref } from 'react';
2
- import { AutocompleteCloseReason } from '@material-ui/lab';
2
+ import { AutocompleteCloseReason, AutocompleteGetTagProps, AutocompleteRenderOptionState } from '@material-ui/lab';
3
3
  import { CommonProps } from '../CommonProps';
4
4
  export declare const DEFAULT_ACTION_ITEM_TEXT = "Add new item";
5
5
  export interface ActionItem {
@@ -19,7 +19,11 @@ export interface AutoCompleteOption {
19
19
  group?: string;
20
20
  title: string;
21
21
  }
22
- export interface AutoCompleteProps extends CommonProps {
22
+ /**
23
+ * AutoCompleteOption can be extended for the use case when customizing
24
+ * autocomplete option rendering by using `renderOption` prop.
25
+ */
26
+ export interface AutoCompleteProps<T extends AutoCompleteOption = AutoCompleteOption> extends CommonProps {
23
27
  /** Action button as the last element on the menu **/
24
28
  actionItem?: ActionItem;
25
29
  /** This prop helps users to fill forms faster */
@@ -34,6 +38,8 @@ export interface AutoCompleteProps extends CommonProps {
34
38
  disabled?: boolean;
35
39
  /** If true, the input will be displayed in an error state. */
36
40
  error?: boolean;
41
+ /** If `true`, hide the selected options from the list box. */
42
+ filterSelectedOptions?: boolean;
37
43
  /** If true, any arbitrary value can be typed in the field */
38
44
  freesolo?: boolean;
39
45
  /** If true, options will be grouped by category */
@@ -48,6 +54,8 @@ export interface AutoCompleteProps extends CommonProps {
48
54
  label?: string;
49
55
  /** If true, the component will be in a loading state. */
50
56
  loading?: boolean;
57
+ /** Maximum height of Popper's <ul> element */
58
+ maxHeight?: number | string;
51
59
  /** If true, will allow the user to select multiple options */
52
60
  multiple?: boolean;
53
61
  /** A function that should be executed when the autocomplete value changes */
@@ -61,9 +69,13 @@ export interface AutoCompleteProps extends CommonProps {
61
69
  /** Controls the popup's open state. */
62
70
  open?: boolean;
63
71
  /** pre-defined options available to the user */
64
- options?: Array<AutoCompleteOption>;
72
+ options?: Array<T>;
65
73
  /** Placeholder text always displayed inside the input field */
66
74
  placeholder?: string;
75
+ /** Render the option, use `getOptionLabel` by default. */
76
+ renderOption?: (option: T, state: AutocompleteRenderOptionState) => ReactNode;
77
+ /** Render the selected value. */
78
+ renderTags?: (value: T[], getTagProps: AutocompleteGetTagProps) => ReactNode;
67
79
  /** If true, the input will be required and label will display accordingly */
68
80
  required?: boolean;
69
81
  /** Determines the padding within the input field 'medium' or 'small' */
@@ -71,4 +83,4 @@ export interface AutoCompleteProps extends CommonProps {
71
83
  /** value if this is a controlled component */
72
84
  value?: AutoCompleteValue;
73
85
  }
74
- export declare const DotAutoComplete: ({ actionItem, ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, dense, disabled, disablePortal, error, freesolo, group, helperText, inputId, inputRef, label, loading, multiple, onChange, onClose, onInputChange, onOpen, open, options, placeholder, required, size, value, }: AutoCompleteProps) => JSX.Element;
86
+ export declare const DotAutoComplete: <T extends AutoCompleteOption>({ actionItem, ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, dense, disabled, disablePortal, error, filterSelectedOptions, freesolo, group, helperText, inputId, inputRef, label, loading, maxHeight, multiple, onChange, onClose, onInputChange, onOpen, open, options, placeholder, renderOption, renderTags, required, size, value, }: AutoCompleteProps<T>) => JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare const selectedAutocompleteClassName = "dot-selected-autocomplete-items";
2
+ export declare const autocompleteWithoutChipsClassName = "dot-autocomplete-without-chips";
3
+ export declare const StyledSelectedAutocompleteItems: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const StyledAutocompleteWithoutChips: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,4 +1,6 @@
1
- import { ActionItem } from './AutoComplete';
1
+ import { ChangeEvent } from 'react';
2
+ import { ActionItem, AutoCompleteOption, AutoCompleteProps, AutoCompleteValue } from './AutoComplete';
3
+ import { CommonProps } from '../CommonProps';
2
4
  export declare const movies: {
3
5
  group: string;
4
6
  title: string;
@@ -19,3 +21,19 @@ export declare const actionItemArgType: {
19
21
  };
20
22
  defaultValue: string;
21
23
  };
24
+ export interface AutoCompleteWithRenderOption extends AutoCompleteOption {
25
+ imageUrl: string;
26
+ }
27
+ export declare const fullNameOptions: AutoCompleteWithRenderOption[];
28
+ export interface SelectedAutocompleteItemsProps extends CommonProps {
29
+ onItemRemove: (optionTitle: string) => void;
30
+ selectedOptions: AutoCompleteOption[];
31
+ }
32
+ export declare const SelectedAutocompleteItems: ({ className, onItemRemove, selectedOptions, }: SelectedAutocompleteItemsProps) => JSX.Element;
33
+ export interface AutocompleteWithoutChipsProps extends CommonProps {
34
+ onChange: (event: ChangeEvent, currentlySelectedOptions: AutoCompleteValue) => void;
35
+ onItemRemove: (optionTitle: string) => void;
36
+ selectedOptions: AutoCompleteOption[];
37
+ storyArgs: AutoCompleteProps;
38
+ }
39
+ export declare const AutocompleteWithoutChips: ({ className, onChange, onItemRemove, selectedOptions, storyArgs, }: AutocompleteWithoutChipsProps) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { AutocompleteRenderOptionState } from '@material-ui/lab';
2
+ export * from './AutoComplete';
3
+ export { parseAutoCompleteValue } from './utils/helpers';
@@ -1,5 +1,5 @@
1
1
  export type { AppToolbarProps } from './app-toolbar/AppToolbar';
2
- export type { AutoCompleteOption, AutoCompleteProps, AutoCompleteValue, } from './auto-complete/AutoComplete';
2
+ export type { AutoCompleteOption, AutoCompleteProps, AutoCompleteValue, AutocompleteRenderOptionState, } from './auto-complete';
3
3
  export type { AvatarProps } from './avatar/Avatar';
4
4
  export type { BreadcrumbItem } from './breadcrumbs/Breadcrumbs';
5
5
  export type { ButtonProps } from './button/Button';
@@ -31,7 +31,7 @@ export { DotActionToolbar } from './action-toolbar/ActionToolbar';
31
31
  export { DotAlertBanner } from './alert-banner/AlertBanner';
32
32
  export { DotAppLogo } from './app-logo/AppLogo';
33
33
  export { DotAppToolbar } from './app-toolbar/AppToolbar';
34
- export { DotAutoComplete } from './auto-complete/AutoComplete';
34
+ export { DotAutoComplete, parseAutoCompleteValue } from './auto-complete';
35
35
  export { DotAvatar } from './avatar/Avatar';
36
36
  export { DotAvatarGroup } from './avatar-group/AvatarGroup';
37
37
  export { DotBadge } from './badge/Badge';
@@ -80,6 +80,5 @@ export { DotTooltip } from './tooltip/Tooltip';
80
80
  export { DotTabs } from './tabs/Tabs';
81
81
  export { DotTypography } from './typography/Typography';
82
82
  export { DotFileUpload } from './file-upload/FileUpload';
83
- export { parseAutoCompleteValue } from './auto-complete/utils/helpers';
84
83
  export { DotDivider } from './divider';
85
84
  export { DotPopper } from './popper';
@@ -1,3 +1,4 @@
1
1
  import { ListItemProps } from './utils/models';
2
2
  export declare const mockHref = "/?path=/story/components-list--default";
3
3
  export declare const mockListItems: Array<ListItemProps>;
4
+ export declare const listItemsWithoutIcons: Array<ListItemProps>;
@@ -36,6 +36,8 @@ export interface MenuItemProps {
36
36
  children?: ReactNode;
37
37
  /** Space delimited CSS classes to be attributed to the menu item */
38
38
  classes?: string;
39
+ /** If true, the item will be displayed in a disabled state. */
40
+ disabled?: boolean;
39
41
  /** If true, a 1px light border is added to the bottom of the menu item. */
40
42
  divider?: boolean;
41
43
  /** Used to set custom item height (in pixels). This value has priority over "menuItemHeight" prop. */
@@ -2,4 +2,9 @@ import { Popper } from '@material-ui/core';
2
2
  export declare const flyoutMenuClassName = "dot-flyout-menu";
3
3
  export declare const rootClassName = "dot-menu";
4
4
  export declare const popperClassName = "dot-popper";
5
- export declare const StyledPopper: import("styled-components").StyledComponent<typeof Popper, any, {}, never>;
5
+ interface StyledPopperArgs {
6
+ $maxHeight?: number | string;
7
+ }
8
+ export declare const getListMaxHeight: (maxHeight: string | number) => string;
9
+ export declare const StyledPopper: import("styled-components").StyledComponent<typeof Popper, any, StyledPopperArgs, never>;
10
+ export {};
@@ -41,8 +41,8 @@ export declare const getNavigationItems: (isSelected: (key: number) => boolean,
41
41
  text: string;
42
42
  divider?: undefined;
43
43
  })[];
44
+ startIconId: string;
44
45
  text: string;
45
- startIconId?: undefined;
46
46
  onClick?: undefined;
47
47
  endIconId?: undefined;
48
48
  selected?: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "1.9.1",
3
+ "version": "1.10.1",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [