@digital-ai/dot-components 1.11.0 → 1.11.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,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.11.1](https://github.com/digital-ai/dot-components/tree/1.11.1) (03/14/2022)
4
+
5
+ [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.11.0...1.11.1)
6
+
7
+ **Features:**
8
+
9
+ - Configure `tsconfig.json` so that `React` imports are obsolete [\#1040](https://github.com/digital-ai/dot-components/issues/1040)
10
+
11
+ **Fixed bugs:**
12
+
13
+ - `dot-components` requires `react-router-dom` as peer dependency [\#1001](https://github.com/digital-ai/dot-components/issues/1001)
14
+ - D-20092: `Chip`: Set the limit on chip component for number of characters [\#1036](https://github.com/digital-ai/dot-components/pull/1036) ([dmiletic85](https://github.com/dmiletic85))
15
+
16
+ **Merged pull requests:**
17
+
18
+ - D-19983: move react-router to dev dependency [\#1049](https://github.com/digital-ai/dot-components/pull/1049) ([CWSites](https://github.com/CWSites))
19
+ - S-81949: adjusting RC workflow [\#1038](https://github.com/digital-ai/dot-components/pull/1038) ([CWSites](https://github.com/CWSites))
20
+
3
21
  ## [1.11.0](https://github.com/digital-ai/dot-components/tree/1.11.0) (03/07/2022)
4
22
 
5
23
  [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.10.1...1.11.0)
@@ -27,21 +45,14 @@
27
45
 
28
46
  ## [1.10.0](https://github.com/digital-ai/dot-components/tree/1.10.0) (03/01/2022)
29
47
 
30
- [Full Changelog](https://github.com/digital-ai/dot-components/compare/2.0.1-rc.0...1.10.0)
48
+ [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.9.1...1.10.0)
31
49
 
32
50
  **Features:**
33
51
 
34
52
  - `Autocomplete` hide/customize chips [\#1023](https://github.com/digital-ai/dot-components/issues/1023)
35
- - S-82231: `Autocomplete` hide/customize chips [\#1031](https://github.com/digital-ai/dot-components/pull/1031) ([dmiletic85](https://github.com/dmiletic85))
36
-
37
- ## [2.0.1-rc.0](https://github.com/digital-ai/dot-components/tree/2.0.1-rc.0) (02/25/2022)
38
-
39
- [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.9.1...2.0.1-rc.0)
40
-
41
- **Features:**
42
-
43
53
  - Missing disable props on DotMenu component [\#1021](https://github.com/digital-ai/dot-components/issues/1021)
44
54
  - `Autocomplete`: allow custom `renderOption` [\#1002](https://github.com/digital-ai/dot-components/issues/1002)
55
+ - S-82231: `Autocomplete` hide/customize chips [\#1031](https://github.com/digital-ai/dot-components/pull/1031) ([dmiletic85](https://github.com/dmiletic85))
45
56
  - S-82227: `DotMenu`: Missing disable prop [\#1022](https://github.com/digital-ai/dot-components/pull/1022) ([dmiletic85](https://github.com/dmiletic85))
46
57
  - S-82076: `Autocomplete`: allow custom `renderOption` [\#1013](https://github.com/digital-ai/dot-components/pull/1013) ([dmiletic85](https://github.com/dmiletic85))
47
58
 
@@ -689,7 +700,6 @@
689
700
  - S-78497: Add 'page' prop to DotTable [\#662](https://github.com/digital-ai/dot-components/pull/662) ([selsemore](https://github.com/selsemore))
690
701
  - Issue \#632: Add aria-label property [\#659](https://github.com/digital-ai/dot-components/pull/659) ([dmiletic85](https://github.com/dmiletic85))
691
702
  - S-78464: SonarQube [\#657](https://github.com/digital-ai/dot-components/pull/657) ([CWSites](https://github.com/CWSites))
692
- - 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))
693
703
  - S-77872: gather test coverage in sonarcloud [\#653](https://github.com/digital-ai/dot-components/pull/653) ([CWSites](https://github.com/CWSites))
694
704
 
695
705
  ## [1.0.8](https://github.com/digital-ai/dot-components/tree/1.0.8) (08/23/2021)
@@ -702,6 +712,7 @@
702
712
 
703
713
  **Merged pull requests:**
704
714
 
715
+ - 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))
705
716
  - add export back to component library [\#652](https://github.com/digital-ai/dot-components/pull/652) ([CWSites](https://github.com/CWSites))
706
717
  - add back missing items from export [\#651](https://github.com/digital-ai/dot-components/pull/651) ([TheKeithStewart](https://github.com/TheKeithStewart))
707
718
 
package/index.esm.js CHANGED
@@ -2677,9 +2677,11 @@ const StyledChip = styled(Chip).withConfig({
2677
2677
  theme
2678
2678
  }) => css(["&.", "{border-color:", ";.dot-icon i{height:auto;}&.MuiChip-sizeSmall{.dot-icon,.dot-avatar{width:18px;height:18px;}}&.Mui-error{background-color:", ";border-color:", ";.MuiChip-deleteIcon{color:", ";}}&:not(.Mui-error){&:hover{background-color:", ";}.MuiChip-deleteIcon{&:hover{color:", ";}}}.MuiChip-deleteIcon{width:18px;height:18px;color:", ";}}"], rootClassName$B, theme.palette.grey[300], theme.palette.error[50], theme.palette.error.main, theme.palette.error.main, theme.palette.grey[50], theme.palette.grey[400], theme.palette.grey[300]));
2679
2679
 
2680
+ const DEFAULT_CHARACTERS_LIMIT = 32;
2680
2681
  const DotChip = ({
2681
2682
  ariaLabel,
2682
2683
  avatar,
2684
+ charactersLimit: _charactersLimit = DEFAULT_CHARACTERS_LIMIT,
2683
2685
  children,
2684
2686
  className,
2685
2687
  'data-testid': dataTestId,
@@ -2694,6 +2696,15 @@ const DotChip = ({
2694
2696
  }) => {
2695
2697
  const errorClass = _error ? 'Mui-error' : '';
2696
2698
  const rootClasses = useStylesWithRootClass(rootClassName$B, className, errorClass);
2699
+
2700
+ const getChipLabel = () => {
2701
+ if (_charactersLimit <= 0 || children.length < _charactersLimit) return children;
2702
+ const label = `${children.substr(0, _charactersLimit)}...`;
2703
+ return /*#__PURE__*/React__default.createElement(DotTooltip, {
2704
+ title: children
2705
+ }, /*#__PURE__*/React__default.createElement("span", null, label));
2706
+ };
2707
+
2697
2708
  return /*#__PURE__*/React__default.createElement(StyledChip, {
2698
2709
  "aria-label": ariaLabel,
2699
2710
  avatar: avatar,
@@ -2705,7 +2716,7 @@ const DotChip = ({
2705
2716
  "data-testid": dataTestId,
2706
2717
  disabled: _disabled,
2707
2718
  icon: avatar ? null : startIcon,
2708
- label: children,
2719
+ label: getChipLabel(),
2709
2720
  onClick: event => onClick && onClick(event),
2710
2721
  onDelete: _isDeletable && onDelete ? event => onDelete(event) : undefined,
2711
2722
  size: _size,
package/index.umd.js CHANGED
@@ -2929,27 +2929,39 @@
2929
2929
  });
2930
2930
  var templateObject_1$E, templateObject_2$C;
2931
2931
 
2932
+ var DEFAULT_CHARACTERS_LIMIT = 32;
2932
2933
  var DotChip = function DotChip(_a) {
2933
2934
  var ariaLabel = _a.ariaLabel,
2934
2935
  avatar = _a.avatar,
2936
+ _b = _a.charactersLimit,
2937
+ charactersLimit = _b === void 0 ? DEFAULT_CHARACTERS_LIMIT : _b,
2935
2938
  children = _a.children,
2936
2939
  className = _a.className,
2937
2940
  dataTestId = _a["data-testid"],
2938
- _b = _a.disabled,
2939
- disabled = _b === void 0 ? false : _b,
2940
- _c = _a.error,
2941
- error = _c === void 0 ? false : _c,
2942
- _d = _a.isClickable,
2943
- isClickable = _d === void 0 ? false : _d,
2944
- _e = _a.isDeletable,
2945
- isDeletable = _e === void 0 ? true : _e,
2941
+ _c = _a.disabled,
2942
+ disabled = _c === void 0 ? false : _c,
2943
+ _d = _a.error,
2944
+ error = _d === void 0 ? false : _d,
2945
+ _e = _a.isClickable,
2946
+ isClickable = _e === void 0 ? false : _e,
2947
+ _f = _a.isDeletable,
2948
+ isDeletable = _f === void 0 ? true : _f,
2946
2949
  onClick = _a.onClick,
2947
2950
  onDelete = _a.onDelete,
2948
- _f = _a.size,
2949
- size = _f === void 0 ? 'medium' : _f,
2951
+ _g = _a.size,
2952
+ size = _g === void 0 ? 'medium' : _g,
2950
2953
  startIcon = _a.startIcon;
2951
2954
  var errorClass = error ? 'Mui-error' : '';
2952
2955
  var rootClasses = useStylesWithRootClass(rootClassName$B, className, errorClass);
2956
+
2957
+ var getChipLabel = function getChipLabel() {
2958
+ if (charactersLimit <= 0 || children.length < charactersLimit) return children;
2959
+ var label = children.substr(0, charactersLimit) + "...";
2960
+ return /*#__PURE__*/React__default["default"].createElement(DotTooltip, {
2961
+ title: children
2962
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, label));
2963
+ };
2964
+
2953
2965
  return /*#__PURE__*/React__default["default"].createElement(StyledChip, {
2954
2966
  "aria-label": ariaLabel,
2955
2967
  avatar: avatar,
@@ -2961,7 +2973,7 @@
2961
2973
  "data-testid": dataTestId,
2962
2974
  disabled: disabled,
2963
2975
  icon: avatar ? null : startIcon,
2964
- label: children,
2976
+ label: getChipLabel(),
2965
2977
  onClick: function (event) {
2966
2978
  return onClick && onClick(event);
2967
2979
  },
@@ -1,3 +1,3 @@
1
- export { AutocompleteRenderOptionState } from '@material-ui/lab';
1
+ export type { AutocompleteRenderOptionState } from '@material-ui/lab';
2
2
  export * from './AutoComplete';
3
3
  export { parseAutoCompleteValue } from './utils/helpers';
@@ -1,9 +1,12 @@
1
1
  import { MouseEvent, ReactElement } from 'react';
2
2
  import { CommonProps } from '../CommonProps';
3
3
  export declare type ChipSize = 'medium' | 'small';
4
+ export declare const DEFAULT_CHARACTERS_LIMIT = 32;
4
5
  export interface ChipProps extends CommonProps {
5
6
  /** If provided, will display an avatar which takes precedence over icon */
6
7
  avatar?: ReactElement;
8
+ /** Maximum number of characters until the label gets truncated. Default is 32. */
9
+ charactersLimit?: number;
7
10
  /** The text for the chip. */
8
11
  children: string;
9
12
  /** If true, the chip is disabled */
@@ -23,4 +26,4 @@ export interface ChipProps extends CommonProps {
23
26
  /** The icon to display on the chip */
24
27
  startIcon?: ReactElement;
25
28
  }
26
- export declare const DotChip: ({ ariaLabel, avatar, children, className, "data-testid": dataTestId, disabled, error, isClickable, isDeletable, onClick, onDelete, size, startIcon, }: ChipProps) => JSX.Element;
29
+ export declare const DotChip: ({ ariaLabel, avatar, charactersLimit, children, className, "data-testid": dataTestId, disabled, error, isClickable, isDeletable, onClick, onDelete, size, startIcon, }: ChipProps) => JSX.Element;
@@ -1,2 +1,2 @@
1
- export { PopperPlacementType } from '@material-ui/core';
1
+ export type { PopperPlacementType } from '@material-ui/core';
2
2
  export * from './Popper';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -32,7 +32,6 @@
32
32
  "styled-components": "^5.2.1"
33
33
  },
34
34
  "peerDependencies": {
35
- "react": "^16.8.0 || ^17.0.0",
36
- "react-router-dom": "5.3.0"
35
+ "react": "^16.8.0 || ^17.0.0"
37
36
  }
38
37
  }