@digital-ai/dot-components 1.17.2 → 1.18.0

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,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.18.0](https://github.com/digital-ai/dot-components/tree/1.18.0) (06/21/2022)
4
+
5
+ [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.17.2...1.18.0)
6
+
7
+ **Features:**
8
+
9
+ - S-85256: `Map` component example in demo app [\#1184](https://github.com/digital-ai/dot-components/pull/1184) ([dmiletic85](https://github.com/dmiletic85))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - `DotAutcomplete` loading spinner is in wrong position when `freesolo` is not enabled [\#1188](https://github.com/digital-ai/dot-components/issues/1188)
14
+ - `DotDraggableList` 4 issues in 1 [\#1183](https://github.com/digital-ai/dot-components/issues/1183)
15
+ - D-21609: `DotAutocomplete` allow `null` as value [\#1195](https://github.com/digital-ai/dot-components/pull/1195) ([dmiletic85](https://github.com/dmiletic85))
16
+ - D-21606 `DotAutcomplete` loading spinner is in wrong position when `freesolo` is not enabled [\#1194](https://github.com/digital-ai/dot-components/pull/1194) ([angel-git](https://github.com/angel-git))
17
+ - D-21577: `DraggableList` improvements and bug fixes [\#1190](https://github.com/digital-ai/dot-components/pull/1190) ([dmiletic85](https://github.com/dmiletic85))
18
+
19
+ **Closed issues:**
20
+
21
+ - `DotAutocomplete` allow `null` as value [\#1189](https://github.com/digital-ai/dot-components/issues/1189)
22
+
23
+ **Merged pull requests:**
24
+
25
+ - `master` \> `develop` [\#1187](https://github.com/digital-ai/dot-components/pull/1187) ([TheKeithStewart](https://github.com/TheKeithStewart))
26
+
3
27
  ## [1.17.2](https://github.com/digital-ai/dot-components/tree/1.17.2) (06/10/2022)
4
28
 
5
29
  [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.17.1...1.17.2)
@@ -112,6 +136,7 @@
112
136
 
113
137
  - `InlineEdit` Support for different text in view/edit modes [\#1103](https://github.com/digital-ai/dot-components/issues/1103)
114
138
  - S-83748: `InlineEdit`: Support for different text in view/edit modes [\#1105](https://github.com/digital-ai/dot-components/pull/1105) ([dmiletic85](https://github.com/dmiletic85))
139
+ - S-82617: `DotInputText` Expose mouse up event [\#1063](https://github.com/digital-ai/dot-components/pull/1063) ([dmiletic85](https://github.com/dmiletic85))
115
140
 
116
141
  **Fixed bugs:**
117
142
 
@@ -153,7 +178,6 @@
153
178
  - S-82899: `DotCheckbox`: Add more Storybook examples [\#1090](https://github.com/digital-ai/dot-components/pull/1090) ([dmiletic85](https://github.com/dmiletic85))
154
179
  - S-82453: `TruncateWithTooltip`: Create new component [\#1072](https://github.com/digital-ai/dot-components/pull/1072) ([dmiletic85](https://github.com/dmiletic85))
155
180
  - S-82519: `Snackbar` Allow positioning [\#1064](https://github.com/digital-ai/dot-components/pull/1064) ([dmiletic85](https://github.com/dmiletic85))
156
- - S-82617: `DotInputText` Expose mouse up event [\#1063](https://github.com/digital-ai/dot-components/pull/1063) ([dmiletic85](https://github.com/dmiletic85))
157
181
  - S-76904: `InlineEdit` improvements [\#1053](https://github.com/digital-ai/dot-components/pull/1053) ([dmiletic85](https://github.com/dmiletic85))
158
182
  - S-82059: `DraggableList`: Create and export the component [\#1003](https://github.com/digital-ai/dot-components/pull/1003) ([dmiletic85](https://github.com/dmiletic85))
159
183
 
@@ -891,6 +915,7 @@
891
915
  - S-78497: Add 'page' prop to DotTable [\#662](https://github.com/digital-ai/dot-components/pull/662) ([selsemore](https://github.com/selsemore))
892
916
  - Issue \#632: Add aria-label property [\#659](https://github.com/digital-ai/dot-components/pull/659) ([dmiletic85](https://github.com/dmiletic85))
893
917
  - S-78464: SonarQube [\#657](https://github.com/digital-ai/dot-components/pull/657) ([CWSites](https://github.com/CWSites))
918
+ - S-78388: Export interfaces and types needed for table pagination and sorting [\#654](https://github.com/digital-ai/dot-components/pull/654) ([selsemore](https://github.com/selsemore))
894
919
  - S-77872: gather test coverage in sonarcloud [\#653](https://github.com/digital-ai/dot-components/pull/653) ([CWSites](https://github.com/CWSites))
895
920
 
896
921
  ## [1.0.8](https://github.com/digital-ai/dot-components/tree/1.0.8) (08/23/2021)
@@ -903,7 +928,6 @@
903
928
 
904
929
  **Merged pull requests:**
905
930
 
906
- - S-78388: Export interfaces and types needed for table pagination and sorting [\#654](https://github.com/digital-ai/dot-components/pull/654) ([selsemore](https://github.com/selsemore))
907
931
  - add export back to component library [\#652](https://github.com/digital-ai/dot-components/pull/652) ([CWSites](https://github.com/CWSites))
908
932
  - add back missing items from export [\#651](https://github.com/digital-ai/dot-components/pull/651) ([TheKeithStewart](https://github.com/TheKeithStewart))
909
933
 
package/index.esm.js CHANGED
@@ -3116,10 +3116,10 @@ const DotAutoComplete = ({
3116
3116
  className: useStylesWithRootClass(inputProps.className, 'dot-input')
3117
3117
  }),
3118
3118
  InputProps: Object.assign(Object.assign({}, params.InputProps), {
3119
- endAdornment: loading ? /*#__PURE__*/React__default.createElement(DotProgress, {
3119
+ endAdornment: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, loading && /*#__PURE__*/React__default.createElement(DotProgress, {
3120
3120
  color: "inherit",
3121
3121
  size: 20
3122
- }) : params.InputProps.endAdornment
3122
+ }), params.InputProps.endAdornment)
3123
3123
  }),
3124
3124
  inputRef: textFieldRef,
3125
3125
  label: label,
@@ -4582,6 +4582,7 @@ const DotInputText = ({
4582
4582
  'data-testid': dataTestId,
4583
4583
  disabled: _disabled = false,
4584
4584
  error: _error = false,
4585
+ endAdornmentTooltip,
4585
4586
  fullWidth: _fullWidth = true,
4586
4587
  hasDebounce,
4587
4588
  helperText,
@@ -4652,16 +4653,24 @@ const DotInputText = ({
4652
4653
  // in that case component is controlled
4653
4654
 
4654
4655
  const defaultInputValue = hasDebounce ? undefined : defaultValue;
4656
+
4657
+ const renderEndAdornment = () => {
4658
+ const styledAdornment = /*#__PURE__*/React__default.createElement(StyledAdornment, {
4659
+ className: `${adornmentIconClassName} end`,
4660
+ position: "end"
4661
+ }, endAdornmentIcon);
4662
+ return endAdornmentTooltip ? /*#__PURE__*/React__default.createElement(DotTooltip, {
4663
+ title: endAdornmentTooltip
4664
+ }, styledAdornment) : styledAdornment;
4665
+ };
4666
+
4655
4667
  return /*#__PURE__*/React__default.createElement(StyledTextField, {
4656
4668
  InputProps: {
4657
4669
  startAdornment: startIcon && /*#__PURE__*/React__default.createElement(StyledAdornment, {
4658
4670
  className: `${adornmentIconClassName} start`,
4659
4671
  position: "start"
4660
4672
  }, startIcon),
4661
- endAdornment: endAdornmentIcon && /*#__PURE__*/React__default.createElement(StyledAdornment, {
4662
- className: `${adornmentIconClassName} end`,
4663
- position: "end"
4664
- }, endAdornmentIcon)
4673
+ endAdornment: endAdornmentIcon && renderEndAdornment()
4665
4674
  },
4666
4675
  "aria-label": name,
4667
4676
  autoComplete: _autoComplete,
@@ -7727,13 +7736,18 @@ const StyledDraggableList = styled.div.withConfig({
7727
7736
  displayName: "DraggableListstyles__StyledDraggableList",
7728
7737
  componentId: "sc-1nekees-0"
7729
7738
  })(["", ""], ({
7730
- theme
7731
- }) => css(["&.", " .", ".react-draggable-dragging{background-color:", ";}"], rootClassName, listItemClassName, theme.palette.grey[50]));
7739
+ theme,
7740
+ width,
7741
+ draggableHandle
7742
+ }) => css(["&.", " .", "{&.react-draggable-dragging{background-color:", ";}width:", " !important;&.with-default-cursor{cursor:default;}&.with-handle-grab-cursor{", "{cursor:grab;}}}"], rootClassName, listItemClassName, theme.palette.grey[50], width, draggableHandle));
7732
7743
 
7733
7744
  const getOrderedListItems = (layout, listItems) => {
7734
7745
  if (!listItems || !layout) return [];
7735
- listItems.sort((a, b) => layout.find(layoutItem => layoutItem.i === a.id).y - layout.find(layoutItem => layoutItem.i === b.id).y);
7736
- return listItems;
7746
+ return [...listItems].sort((a, b) => layout.find(layoutItem => layoutItem.i === a.id).y - layout.find(layoutItem => layoutItem.i === b.id).y);
7747
+ };
7748
+ const checkIfEqual = (oldList, newList) => {
7749
+ if (oldList.length !== newList.length) return false;
7750
+ return oldList.every((oldListItem, index) => oldListItem.id === newList[index].id);
7737
7751
  };
7738
7752
  const getListItemLayout = listItems => {
7739
7753
  return listItems === null || listItems === void 0 ? void 0 : listItems.map((item, index) => ({
@@ -7745,27 +7759,43 @@ const getListItemLayout = listItems => {
7745
7759
  }));
7746
7760
  };
7747
7761
 
7748
- const DEFAULT_LIST_WIDTH = 240;
7762
+ const DEFAULT_LIST_WIDTH = '100%';
7749
7763
  const DEFAULT_LIST_ITEM_HEIGHT = 36;
7750
7764
  const ListGridLayout = WidthProvider(GridLayout);
7751
7765
  const DotDraggableList = ({
7752
7766
  ariaLabel,
7753
7767
  className,
7754
7768
  'data-testid': dataTestId,
7769
+ disableDrag,
7770
+ draggableHandle,
7755
7771
  items,
7756
7772
  onChange,
7757
- width: _width = DEFAULT_LIST_WIDTH,
7758
- rowHeight: _rowHeight = DEFAULT_LIST_ITEM_HEIGHT
7773
+ rowHeight: _rowHeight = DEFAULT_LIST_ITEM_HEIGHT,
7774
+ width: _width = DEFAULT_LIST_WIDTH
7759
7775
  }) => {
7760
- const rootClasses = useStylesWithRootClass(rootClassName, className);
7761
- const listWidth = typeof _width === 'number' ? `${_width}px` : _width;
7776
+ const rootClasses = useStylesWithRootClass(rootClassName, className, draggableHandle ? 'with-draggable-handle' : '');
7777
+ const listItemClasses = useStylesWithRootClass(listItemClassName, draggableHandle && !disableDrag ? 'with-handle-grab-cursor' : '', draggableHandle || disableDrag ? 'with-default-cursor' : '');
7778
+ const listWidth = isNumber(_width) ? `${_width}px` : _width;
7779
+ const [orderedItems, setOrderedItems] = useState([]);
7780
+ useEffect(() => {
7781
+ setOrderedItems(items);
7782
+ }, [items]);
7762
7783
 
7763
- const handleLayoutChange = () => layout => onChange(getOrderedListItems(layout, items));
7784
+ const handleLayoutChange = () => layout => {
7785
+ const newList = getOrderedListItems(layout, orderedItems);
7786
+
7787
+ if (!checkIfEqual(orderedItems, newList)) {
7788
+ setOrderedItems(newList);
7789
+ onChange(newList);
7790
+ }
7791
+ };
7764
7792
 
7765
7793
  return /*#__PURE__*/React__default.createElement(StyledDraggableList, {
7766
7794
  "aria-label": ariaLabel,
7767
7795
  className: rootClasses,
7768
- "data-testid": dataTestId
7796
+ "data-testid": dataTestId,
7797
+ draggableHandle: draggableHandle,
7798
+ width: listWidth
7769
7799
  }, /*#__PURE__*/React__default.createElement(List, {
7770
7800
  "data-testid": dataTestId && `${dataTestId}-ul`,
7771
7801
  style: {
@@ -7773,23 +7803,26 @@ const DotDraggableList = ({
7773
7803
  }
7774
7804
  }, /*#__PURE__*/React__default.createElement(ListGridLayout, {
7775
7805
  className: "layout",
7776
- layout: getListItemLayout(items),
7806
+ draggableHandle: draggableHandle,
7807
+ isDraggable: !disableDrag,
7808
+ layout: getListItemLayout(orderedItems),
7777
7809
  cols: 1,
7778
7810
  margin: [0, 0],
7779
7811
  onLayoutChange: onChange && handleLayoutChange(),
7780
7812
  rowHeight: _rowHeight
7781
- }, items.map(({
7813
+ }, orderedItems.map(({
7782
7814
  id: itemId,
7783
7815
  children
7784
7816
  }) => {
7785
7817
  return /*#__PURE__*/React__default.createElement(ListItem, {
7818
+ "data-testid": dataTestId && `${dataTestId}-item`,
7786
7819
  key: itemId,
7787
7820
  button: true,
7788
7821
  children: renderNodeOrTypography(children),
7789
- className: listItemClassName,
7822
+ className: listItemClasses,
7790
7823
  disableRipple: true
7791
7824
  });
7792
7825
  }))));
7793
7826
  };
7794
7827
 
7795
- export { Cell, CssCell, CssGrid, CssGridDebug, DotAccordion, DotActionToolbar, DotAlertBanner, DotAppLogo, DotAppToolbar, DotAutoComplete, DotAvatar, DotAvatarGroup, DotBadge, DotBreadcrumbs, DotButton, DotButtonToggle, DotCard, DotCardContent, DotCardFooter, DotCardHeader, DotCheckbox, DotCheckboxGroup, DotChip, DotConfirmationDialog, DotDialog, DotDivider, DotDraggableList, DotDrawer, DotDynamicForm, DotEmptyState, DotFileListItem, DotFileUpload, DotForm, DotFormGroup, DotHeaderRow, DotIcon, DotIconButton, DotInlineEdit, DotInputSelect, DotInputText, DotLink, DotList, DotMenu, DotNavigationRail, DotPill, DotPopper, DotProgress, DotProgressButton, DotRadioButton, DotRadioGroup, DotSidebar, DotSkeleton, DotSnackbar, DotSnackbarContainer, DotSnackbarProvider, DotSplitButton, DotSwitch, DotTable, DotTableAction, DotTableActions, DotTablePagination, DotTabs, DotThemeProvider, DotTooltip, DotTruncateWithTooltip, DotTypography, avatarColors, lightThemeColors as lightColors, parseAutoCompleteValue, variables as themeVariables, typographyOptions, useDotSnackbarContext };
7828
+ export { Cell, CreateUUID, CssCell, CssGrid, CssGridDebug, DotAccordion, DotActionToolbar, DotAlertBanner, DotAppLogo, DotAppToolbar, DotAutoComplete, DotAvatar, DotAvatarGroup, DotBadge, DotBreadcrumbs, DotButton, DotButtonToggle, DotCard, DotCardContent, DotCardFooter, DotCardHeader, DotCheckbox, DotCheckboxGroup, DotChip, DotConfirmationDialog, DotDialog, DotDivider, DotDraggableList, DotDrawer, DotDynamicForm, DotEmptyState, DotFileListItem, DotFileUpload, DotForm, DotFormGroup, DotHeaderRow, DotIcon, DotIconButton, DotInlineEdit, DotInputSelect, DotInputText, DotLink, DotList, DotMenu, DotNavigationRail, DotPill, DotPopper, DotProgress, DotProgressButton, DotRadioButton, DotRadioGroup, DotSidebar, DotSkeleton, DotSnackbar, DotSnackbarContainer, DotSnackbarProvider, DotSplitButton, DotSwitch, DotTable, DotTableAction, DotTableActions, DotTablePagination, DotTabs, DotThemeProvider, DotTooltip, DotTruncateWithTooltip, DotTypography, avatarColors, lightThemeColors as lightColors, parseAutoCompleteValue, variables as themeVariables, typographyOptions, useDotSnackbarContext };
package/index.umd.js CHANGED
@@ -3428,10 +3428,10 @@
3428
3428
  className: useStylesWithRootClass(inputProps.className, 'dot-input')
3429
3429
  }),
3430
3430
  InputProps: __assign(__assign({}, params.InputProps), {
3431
- endAdornment: loading ? /*#__PURE__*/React__default["default"].createElement(DotProgress, {
3431
+ endAdornment: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, loading && /*#__PURE__*/React__default["default"].createElement(DotProgress, {
3432
3432
  color: "inherit",
3433
3433
  size: 20
3434
- }) : params.InputProps.endAdornment
3434
+ }), params.InputProps.endAdornment)
3435
3435
  }),
3436
3436
  inputRef: textFieldRef,
3437
3437
  label: label,
@@ -4940,6 +4940,7 @@
4940
4940
  disabled = _c === void 0 ? false : _c,
4941
4941
  _d = _a.error,
4942
4942
  error = _d === void 0 ? false : _d,
4943
+ endAdornmentTooltip = _a.endAdornmentTooltip,
4943
4944
  _e = _a.fullWidth,
4944
4945
  fullWidth = _e === void 0 ? true : _e,
4945
4946
  hasDebounce = _a.hasDebounce,
@@ -5020,16 +5021,24 @@
5020
5021
  // in that case component is controlled
5021
5022
 
5022
5023
  var defaultInputValue = hasDebounce ? undefined : defaultValue;
5024
+
5025
+ var renderEndAdornment = function renderEndAdornment() {
5026
+ var styledAdornment = /*#__PURE__*/React__default["default"].createElement(StyledAdornment, {
5027
+ className: adornmentIconClassName + " end",
5028
+ position: "end"
5029
+ }, endAdornmentIcon);
5030
+ return endAdornmentTooltip ? /*#__PURE__*/React__default["default"].createElement(DotTooltip, {
5031
+ title: endAdornmentTooltip
5032
+ }, styledAdornment) : styledAdornment;
5033
+ };
5034
+
5023
5035
  return /*#__PURE__*/React__default["default"].createElement(StyledTextField, {
5024
5036
  InputProps: {
5025
5037
  startAdornment: startIcon && /*#__PURE__*/React__default["default"].createElement(StyledAdornment, {
5026
5038
  className: adornmentIconClassName + " start",
5027
5039
  position: "start"
5028
5040
  }, startIcon),
5029
- endAdornment: endAdornmentIcon && /*#__PURE__*/React__default["default"].createElement(StyledAdornment, {
5030
- className: adornmentIconClassName + " end",
5031
- position: "end"
5032
- }, endAdornmentIcon)
5041
+ endAdornment: endAdornmentIcon && renderEndAdornment()
5033
5042
  },
5034
5043
  "aria-label": name,
5035
5044
  autoComplete: autoComplete,
@@ -8434,21 +8443,28 @@
8434
8443
  displayName: "DraggableListstyles__StyledDraggableList",
8435
8444
  componentId: "sc-1nekees-0"
8436
8445
  })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
8437
- var theme = _a.theme;
8438
- return styled.css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &.", " .", ".react-draggable-dragging {\n background-color: ", ";\n }\n "], ["\n &.", " .", ".react-draggable-dragging {\n background-color: ", ";\n }\n "])), rootClassName, listItemClassName, theme.palette.grey[50]);
8446
+ var theme = _a.theme,
8447
+ width = _a.width,
8448
+ draggableHandle = _a.draggableHandle;
8449
+ return styled.css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &.", " .", " {\n &.react-draggable-dragging {\n background-color: ", ";\n }\n width: ", " !important;\n\n &.with-default-cursor {\n cursor: default;\n }\n\n &.with-handle-grab-cursor {\n ", " {\n cursor: grab;\n }\n }\n }\n "], ["\n &.", " .", " {\n &.react-draggable-dragging {\n background-color: ", ";\n }\n width: ", " !important;\n\n &.with-default-cursor {\n cursor: default;\n }\n\n &.with-handle-grab-cursor {\n ", " {\n cursor: grab;\n }\n }\n }\n "])), rootClassName, listItemClassName, theme.palette.grey[50], width, draggableHandle);
8439
8450
  });
8440
8451
  var templateObject_1, templateObject_2;
8441
8452
 
8442
8453
  var getOrderedListItems = function getOrderedListItems(layout, listItems) {
8443
8454
  if (!listItems || !layout) return [];
8444
- listItems.sort(function (a, b) {
8455
+ return __spreadArray([], listItems).sort(function (a, b) {
8445
8456
  return layout.find(function (layoutItem) {
8446
8457
  return layoutItem.i === a.id;
8447
8458
  }).y - layout.find(function (layoutItem) {
8448
8459
  return layoutItem.i === b.id;
8449
8460
  }).y;
8450
8461
  });
8451
- return listItems;
8462
+ };
8463
+ var checkIfEqual = function checkIfEqual(oldList, newList) {
8464
+ if (oldList.length !== newList.length) return false;
8465
+ return oldList.every(function (oldListItem, index) {
8466
+ return oldListItem.id === newList[index].id;
8467
+ });
8452
8468
  };
8453
8469
  var getListItemLayout = function getListItemLayout(listItems) {
8454
8470
  return listItems === null || listItems === void 0 ? void 0 : listItems.map(function (item, index) {
@@ -8462,32 +8478,50 @@
8462
8478
  });
8463
8479
  };
8464
8480
 
8465
- var DEFAULT_LIST_WIDTH = 240;
8481
+ var DEFAULT_LIST_WIDTH = '100%';
8466
8482
  var DEFAULT_LIST_ITEM_HEIGHT = 36;
8467
8483
  var ListGridLayout = GridLayout.WidthProvider(GridLayout__default["default"]);
8468
8484
  var DotDraggableList = function DotDraggableList(_a) {
8469
8485
  var ariaLabel = _a.ariaLabel,
8470
8486
  className = _a.className,
8471
8487
  dataTestId = _a["data-testid"],
8488
+ disableDrag = _a.disableDrag,
8489
+ draggableHandle = _a.draggableHandle,
8472
8490
  items = _a.items,
8473
8491
  onChange = _a.onChange,
8474
- _b = _a.width,
8475
- width = _b === void 0 ? DEFAULT_LIST_WIDTH : _b,
8476
- _c = _a.rowHeight,
8477
- rowHeight = _c === void 0 ? DEFAULT_LIST_ITEM_HEIGHT : _c;
8478
- var rootClasses = useStylesWithRootClass(rootClassName, className);
8479
- var listWidth = typeof width === 'number' ? width + "px" : width;
8492
+ _b = _a.rowHeight,
8493
+ rowHeight = _b === void 0 ? DEFAULT_LIST_ITEM_HEIGHT : _b,
8494
+ _c = _a.width,
8495
+ width = _c === void 0 ? DEFAULT_LIST_WIDTH : _c;
8496
+ var rootClasses = useStylesWithRootClass(rootClassName, className, draggableHandle ? 'with-draggable-handle' : '');
8497
+ var listItemClasses = useStylesWithRootClass(listItemClassName, draggableHandle && !disableDrag ? 'with-handle-grab-cursor' : '', draggableHandle || disableDrag ? 'with-default-cursor' : '');
8498
+ var listWidth = isNumber(width) ? width + "px" : width;
8499
+
8500
+ var _d = React.useState([]),
8501
+ orderedItems = _d[0],
8502
+ setOrderedItems = _d[1];
8503
+
8504
+ React.useEffect(function () {
8505
+ setOrderedItems(items);
8506
+ }, [items]);
8480
8507
 
8481
8508
  var handleLayoutChange = function handleLayoutChange() {
8482
8509
  return function (layout) {
8483
- return onChange(getOrderedListItems(layout, items));
8510
+ var newList = getOrderedListItems(layout, orderedItems);
8511
+
8512
+ if (!checkIfEqual(orderedItems, newList)) {
8513
+ setOrderedItems(newList);
8514
+ onChange(newList);
8515
+ }
8484
8516
  };
8485
8517
  };
8486
8518
 
8487
8519
  return /*#__PURE__*/React__default["default"].createElement(StyledDraggableList, {
8488
8520
  "aria-label": ariaLabel,
8489
8521
  className: rootClasses,
8490
- "data-testid": dataTestId
8522
+ "data-testid": dataTestId,
8523
+ draggableHandle: draggableHandle,
8524
+ width: listWidth
8491
8525
  }, /*#__PURE__*/React__default["default"].createElement(core.List, {
8492
8526
  "data-testid": dataTestId && dataTestId + "-ul",
8493
8527
  style: {
@@ -8495,25 +8529,29 @@
8495
8529
  }
8496
8530
  }, /*#__PURE__*/React__default["default"].createElement(ListGridLayout, {
8497
8531
  className: "layout",
8498
- layout: getListItemLayout(items),
8532
+ draggableHandle: draggableHandle,
8533
+ isDraggable: !disableDrag,
8534
+ layout: getListItemLayout(orderedItems),
8499
8535
  cols: 1,
8500
8536
  margin: [0, 0],
8501
8537
  onLayoutChange: onChange && handleLayoutChange(),
8502
8538
  rowHeight: rowHeight
8503
- }, items.map(function (_a) {
8539
+ }, orderedItems.map(function (_a) {
8504
8540
  var itemId = _a.id,
8505
8541
  children = _a.children;
8506
8542
  return /*#__PURE__*/React__default["default"].createElement(core.ListItem, {
8543
+ "data-testid": dataTestId && dataTestId + "-item",
8507
8544
  key: itemId,
8508
8545
  button: true,
8509
8546
  children: renderNodeOrTypography(children),
8510
- className: listItemClassName,
8547
+ className: listItemClasses,
8511
8548
  disableRipple: true
8512
8549
  });
8513
8550
  }))));
8514
8551
  };
8515
8552
 
8516
8553
  exports.Cell = Cell;
8554
+ exports.CreateUUID = CreateUUID;
8517
8555
  exports.CssCell = CssCell;
8518
8556
  exports.CssGrid = CssGrid;
8519
8557
  exports.CssGridDebug = CssGridDebug;
@@ -13,7 +13,7 @@ export interface ActionItem {
13
13
  text?: string | ReactNode;
14
14
  }
15
15
  export declare type autoCompleteSize = 'medium' | 'small';
16
- export declare type AutoCompleteValue = string | string[] | AutoCompleteOption | AutoCompleteOption[];
16
+ export declare type AutoCompleteValue = string | string[] | AutoCompleteOption | AutoCompleteOption[] | null;
17
17
  export interface AutoCompleteOption {
18
18
  error?: boolean;
19
19
  group?: string;
@@ -1,4 +1,6 @@
1
1
  export declare const selectedAutocompleteClassName = "dot-selected-autocomplete-items";
2
2
  export declare const autocompleteWithoutChipsClassName = "dot-autocomplete-without-chips";
3
+ export declare const autocompleteWithNullValueClassName = "dot-autocomplete-with-null-value";
3
4
  export declare const StyledSelectedAutocompleteItems: import("styled-components").StyledComponent<"div", any, {}, never>;
4
5
  export declare const StyledAutocompleteWithoutChips: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export declare const StyledAutocompleteWithNullValue: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -37,3 +37,7 @@ export interface AutocompleteWithoutChipsProps extends CommonProps {
37
37
  storyArgs: AutoCompleteProps;
38
38
  }
39
39
  export declare const AutocompleteWithoutChips: ({ className, onChange, onItemRemove, selectedOptions, storyArgs, }: AutocompleteWithoutChipsProps) => JSX.Element;
40
+ export interface AutocompleteWithNullValueProps {
41
+ storyArgs: AutoCompleteProps;
42
+ }
43
+ export declare const AutocompleteWithNullValue: ({ storyArgs, }: AutocompleteWithNullValueProps) => JSX.Element;
@@ -1,16 +1,24 @@
1
1
  /// <reference types="react" />
2
2
  import { CommonProps } from '../CommonProps';
3
3
  import { DraggableItem, DraggableListChangeHandler } from './utils/models';
4
- export declare const DEFAULT_LIST_WIDTH = 240;
4
+ export declare const DEFAULT_LIST_WIDTH = "100%";
5
5
  export declare const DEFAULT_LIST_ITEM_HEIGHT = 36;
6
6
  export interface DraggableListProps extends CommonProps {
7
+ /** If true, component will prevent items to be dragged. */
8
+ disableDrag?: boolean;
9
+ /**
10
+ * A CSS selector for tags that will act as the draggable handle.
11
+ * For example: `draggableHandle: '.MyDragHandleClassName'`
12
+ * If you forget the leading . it will not work.
13
+ */
14
+ draggableHandle?: string;
7
15
  /** Array of draggable list items displayed */
8
16
  items: DraggableItem[];
9
17
  /** Callback function which gets executed when the list changes */
10
18
  onChange?: DraggableListChangeHandler;
11
19
  /** Height of the list item in pixels, defaults to 36px */
12
20
  rowHeight?: number;
13
- /** Width of the draggable list, defaults to 240px */
21
+ /** Width of the draggable list, defaults to '100%' */
14
22
  width?: number | string;
15
23
  }
16
- export declare const DotDraggableList: ({ ariaLabel, className, "data-testid": dataTestId, items, onChange, width, rowHeight, }: DraggableListProps) => JSX.Element;
24
+ export declare const DotDraggableList: ({ ariaLabel, className, "data-testid": dataTestId, disableDrag, draggableHandle, items, onChange, rowHeight, width, }: DraggableListProps) => JSX.Element;
@@ -5,11 +5,15 @@ export interface DraggableListWithAvatarArgs {
5
5
  secondaryText: string;
6
6
  }
7
7
  export interface DraggableListWithIconsArgs {
8
- id: string;
9
8
  text: string;
10
9
  }
10
+ export interface DraggableListWithHandleArgs extends DraggableListWithIconsArgs {
11
+ id: string;
12
+ }
11
13
  export declare const DraggableListWithAvatar: ({ primaryText, secondaryText, }: DraggableListWithAvatarArgs) => JSX.Element;
12
- export declare const DraggableListWithIcons: ({ id, text, }: DraggableListWithIconsArgs) => JSX.Element;
14
+ export declare const DraggableListWithIcons: ({ text, }: DraggableListWithIconsArgs) => JSX.Element;
15
+ export declare const DraggableListWithHandle: ({ id, text, }: DraggableListWithHandleArgs) => JSX.Element;
13
16
  export declare const draggableListItems: DraggableItem[];
14
17
  export declare const draggableListWithAvatar: DraggableItem[];
15
18
  export declare const draggableListWithIcons: DraggableItem[];
19
+ export declare const draggableListWithHandle: DraggableItem[];
@@ -1,4 +1,6 @@
1
+ export declare const withDefaultContainerClassName = "dot-draggable-list-with-icons";
1
2
  export declare const withIconsClassName = "dot-draggable-list-with-icons";
2
3
  export declare const withAvatarClassName = "dot-draggable-list-with-avatar";
4
+ export declare const StyledDefaultStoryContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
3
5
  export declare const StyledDraggableListWithAvatar: import("styled-components").StyledComponent<"div", any, {}, never>;
4
6
  export declare const StyledDraggableListWithIcons: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,3 +1,8 @@
1
1
  export declare const rootClassName = "dot-draggable-list";
2
2
  export declare const listItemClassName = "dot-draggable-list-item";
3
- export declare const StyledDraggableList: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ interface StyledDraggableListProps {
4
+ draggableHandle?: string;
5
+ width: string;
6
+ }
7
+ export declare const StyledDraggableList: import("styled-components").StyledComponent<"div", any, StyledDraggableListProps, never>;
8
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { Layout } from 'react-grid-layout';
2
2
  import { DraggableItem } from './models';
3
3
  export declare const getOrderedListItems: (layout: Layout[], listItems: DraggableItem[]) => DraggableItem[];
4
+ export declare const checkIfEqual: (oldList: DraggableItem[], newList: DraggableItem[]) => boolean;
4
5
  export declare const getListItemLayout: (listItems: DraggableItem[]) => Layout[];
@@ -7,3 +7,4 @@ export declare const getAvatarColorForInputText: (value: string) => AvatarColor;
7
7
  export declare const isString: (str: unknown) => boolean;
8
8
  export declare const isNumber: (num: unknown) => boolean;
9
9
  export declare const renderNodeOrTypography: (content: string | ReactNode, typographyVariant?: TypographyVariant) => ReactNode;
10
+ export declare const searchString: (needle: string, haystack: string) => boolean;
@@ -19,7 +19,7 @@ export type { RadioButtonProps } from './radio/RadioButton';
19
19
  export type { RadioGroupProps } from './radio/RadioGroup';
20
20
  export type { BackItemProps, SidebarProps } from './sidebar/Sidebar';
21
21
  export type { SwitchProps, SwitchColor, SwitchSize, SwitchLabelPlacement, } from './switch';
22
- export type { DotColumnHeader, MultiSelect, Order, RowSelectionChangeHandler, RowsPerPageOption, TableDataWithPagination, TableRowProps, TableRowSelectChangeHandler, TextAlignment, SortDirection, } from './table';
22
+ export type { DotColumnHeader, MultiSelect, Order, RowSelectionChangeHandler, RowsPerPageOption, TableActionProps, TableActionsProps, TableDataWithPagination, TableRowProps, TableRowSelectChangeHandler, TextAlignment, SortDirection, } from './table';
23
23
  export type { TabProps } from './tabs/Tabs';
24
24
  export type { TypographyVariant } from './typography/Typography';
25
25
  export type { ProgressButtonProps } from './progress-button/ProgressButton';
@@ -88,3 +88,4 @@ export { DotDivider } from './divider';
88
88
  export { DotPopper } from './popper';
89
89
  export { DotTruncateWithTooltip } from './truncate-with-tooltip';
90
90
  export { DotDraggableList } from './draggable-list';
91
+ export { CreateUUID } from './createUUID';
@@ -7,6 +7,7 @@ export interface InputTextProps extends InputProps {
7
7
  https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill
8
8
  **/
9
9
  autoComplete?: string;
10
+ endAdornmentTooltip?: string;
10
11
  /** If true, the input will use debounce functionality. **/
11
12
  hasDebounce?: boolean;
12
13
  /** if multiline it wil render multiple lines */
@@ -22,4 +23,4 @@ export interface InputTextProps extends InputProps {
22
23
  /** value of the InputText */
23
24
  value?: string;
24
25
  }
25
- export declare const DotInputText: ({ autoComplete, autoFocus, className, defaultValue, "data-testid": dataTestId, disabled, error, fullWidth, hasDebounce, helperText, endIcon, id, inputRef, label, multiline, name, onBlur, onChange, onFocus, onKeyDown, onMouseUp, placeholder, readOnly, required, rows, rowsMax, startIcon, size, type, value, warning, }: InputTextProps) => JSX.Element;
26
+ export declare const DotInputText: ({ autoComplete, autoFocus, className, defaultValue, "data-testid": dataTestId, disabled, error, endAdornmentTooltip, fullWidth, hasDebounce, helperText, endIcon, id, inputRef, label, multiline, name, onBlur, onChange, onFocus, onKeyDown, onMouseUp, placeholder, readOnly, required, rows, rowsMax, startIcon, size, type, value, warning, }: InputTextProps) => JSX.Element;
@@ -1,4 +1,6 @@
1
1
  export type { TableRowProps } from './Table';
2
+ export type { TableActionProps } from './TableAction';
3
+ export type { TableActionsProps } from './TableActions';
2
4
  export type { TextAlignment } from './TableCell';
3
5
  export type { TableDataWithPagination } from './TableDataWithPagination';
4
6
  export type { DotColumnHeader, Order } from './TableHeader';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "1.17.2",
3
+ "version": "1.18.0",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [