@digital-ai/dot-components 1.6.0 → 1.6.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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.6.1](https://github.com/digital-ai/dot-components/tree/1.6.1) (01/10/2022)
4
+
5
+ [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.6.0...1.6.1)
6
+
7
+ **Features:**
8
+
9
+ - S-78917: Character limit for breadcrumb items [\#921](https://github.com/digital-ai/dot-components/pull/921) ([monapatel91](https://github.com/monapatel91))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - `1.6.0` - Sidebar links broken, import was moved [\#925](https://github.com/digital-ai/dot-components/issues/925)
14
+ - `Autocomplete` doesn't have `dot-input` class [\#923](https://github.com/digital-ai/dot-components/issues/923)
15
+ - D-19415: `1.6.0` - Sidebar links broken, import was moved [\#926](https://github.com/digital-ai/dot-components/pull/926) ([dmiletic85](https://github.com/dmiletic85))
16
+ - D-19390: `Autocomplete` doesn't have `dot-input` class [\#924](https://github.com/digital-ai/dot-components/pull/924) ([dmiletic85](https://github.com/dmiletic85))
17
+
3
18
  ## [1.6.0](https://github.com/digital-ai/dot-components/tree/1.6.0) (01/03/2022)
4
19
 
5
20
  [Full Changelog](https://github.com/digital-ai/dot-components/compare/1.5.4...1.6.0)
@@ -7,6 +22,7 @@
7
22
  **Features:**
8
23
 
9
24
  - S-77210: Component - Drawer [\#893](https://github.com/digital-ai/dot-components/pull/893) ([monapatel91](https://github.com/monapatel91))
25
+ - 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))
10
26
 
11
27
  **Fixed bugs:**
12
28
 
@@ -39,7 +55,6 @@
39
55
  - `Breadcrumbs` Display tooltip on last item \(on hover\) when it is clipped with ellipsis [\#878](https://github.com/digital-ai/dot-components/issues/878)
40
56
  - 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))
41
57
  - S-80871: `Sidebar` Changes on back arrow [\#896](https://github.com/digital-ai/dot-components/pull/896) ([dmiletic85](https://github.com/dmiletic85))
42
- - 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))
43
58
 
44
59
  **Fixed bugs:**
45
60
 
@@ -446,7 +461,6 @@
446
461
  **Merged pull requests:**
447
462
 
448
463
  - New patch release [\#677](https://github.com/digital-ai/dot-components/pull/677) ([CWSites](https://github.com/CWSites))
449
- - S-78572: Make entire sidebar backitem clickable [\#670](https://github.com/digital-ai/dot-components/pull/670) ([selsemore](https://github.com/selsemore))
450
464
 
451
465
  ## [1.0.9](https://github.com/digital-ai/dot-components/tree/1.0.9) (09/02/2021)
452
466
 
@@ -469,6 +483,7 @@
469
483
  **Merged pull requests:**
470
484
 
471
485
  - Release `1.0.8` [\#673](https://github.com/digital-ai/dot-components/pull/673) ([CWSites](https://github.com/CWSites))
486
+ - S-78572: Make entire sidebar backitem clickable [\#670](https://github.com/digital-ai/dot-components/pull/670) ([selsemore](https://github.com/selsemore))
472
487
  - improving table component by fixing issues reported on github [\#668](https://github.com/digital-ai/dot-components/pull/668) ([monapatel91](https://github.com/monapatel91))
473
488
  - S-78516 extra files being formatted [\#665](https://github.com/digital-ai/dot-components/pull/665) ([TheKeithStewart](https://github.com/TheKeithStewart))
474
489
  - S-78464: add main branch name [\#664](https://github.com/digital-ai/dot-components/pull/664) ([CWSites](https://github.com/CWSites))
@@ -1868,9 +1868,7 @@ var DotListItem = function DotListItem(_ref3) {
1868
1868
  }, []);
1869
1869
 
1870
1870
  var toggleOpen = function toggleOpen(event) {
1871
- event.stopPropagation();
1872
- event.preventDefault();
1873
- setAnchorEl(event.currentTarget);
1871
+ return setAnchorEl(event.currentTarget);
1874
1872
  };
1875
1873
 
1876
1874
  var handleClick = function handleClick(event) {
@@ -2813,6 +2811,11 @@ var DotAutoComplete = function DotAutoComplete(_ref) {
2813
2811
  open: isOpened,
2814
2812
  options: sortOptions(),
2815
2813
  renderInput: function renderInput(params) {
2814
+ // InputBaseComponentProps is used here because that is the base
2815
+ // type of 'inputProps' of 'StyledTextField' component. TS treats
2816
+ // 'inputProps' as 'object' type and will complain when accessing
2817
+ // className without casting to proper type
2818
+ var inputProps = params.inputProps;
2816
2819
  return (
2817
2820
  /*#__PURE__*/
2818
2821
  // We are not using DotInputText here because the {...params} spread
@@ -2832,6 +2835,9 @@ var DotAutoComplete = function DotAutoComplete(_ref) {
2832
2835
  error: error,
2833
2836
  helperText: helperText,
2834
2837
  id: inputId,
2838
+ inputProps: Object.assign(Object.assign({}, inputProps), {
2839
+ className: useStylesWithRootClass(inputProps.className, 'dot-input')
2840
+ }),
2835
2841
  inputRef: textFieldRef,
2836
2842
  label: label,
2837
2843
  name: label,
@@ -3016,10 +3022,17 @@ var mapBreadcrumbItems = function mapBreadcrumbItems(items, refs, _ref2) {
3016
3022
  lastItemRef = refs.lastItemRef;
3017
3023
  return items === null || items === void 0 ? void 0 : items.map(function (item, index) {
3018
3024
  var ariaLabel = item.ariaLabel,
3025
+ characterLimit = item.characterLimit,
3019
3026
  href = item.href,
3020
3027
  onClick = item.onClick,
3021
3028
  text = item.text,
3022
- underline = item.underline; // Check if last element
3029
+ underline = item.underline;
3030
+ var truncatedText = '';
3031
+
3032
+ if (text.length > characterLimit) {
3033
+ truncatedText = text.slice(0, characterLimit) + '...';
3034
+ } // Check if last element
3035
+
3023
3036
 
3024
3037
  if (index === items.length - 1) {
3025
3038
  // Add tooltip if item is not fully visible
@@ -3033,6 +3046,8 @@ var mapBreadcrumbItems = function mapBreadcrumbItems(items, refs, _ref2) {
3033
3046
  return /*#__PURE__*/React__default.createElement("div", {
3034
3047
  key: index,
3035
3048
  ref: isFirstItemAfterCollapse ? firstItemRef : undefined
3049
+ }, /*#__PURE__*/React__default.createElement(DotTooltip, {
3050
+ title: truncatedText && text
3036
3051
  }, /*#__PURE__*/React__default.createElement(DotLink, {
3037
3052
  ariaLabel: ariaLabel,
3038
3053
  className: "breadcrumb",
@@ -3041,7 +3056,7 @@ var mapBreadcrumbItems = function mapBreadcrumbItems(items, refs, _ref2) {
3041
3056
  onClick: onClick,
3042
3057
  tabIndex: 0,
3043
3058
  underline: underline
3044
- }, text));
3059
+ }, truncatedText ? truncatedText : text)));
3045
3060
  }
3046
3061
  });
3047
3062
  };
@@ -1958,9 +1958,7 @@
1958
1958
  }, []);
1959
1959
 
1960
1960
  var toggleOpen = function toggleOpen(event) {
1961
- event.stopPropagation();
1962
- event.preventDefault();
1963
- setAnchorEl(event.currentTarget);
1961
+ return setAnchorEl(event.currentTarget);
1964
1962
  };
1965
1963
 
1966
1964
  var handleClick = function handleClick(event) {
@@ -2905,6 +2903,11 @@
2905
2903
  open: isOpened,
2906
2904
  options: sortOptions(),
2907
2905
  renderInput: function renderInput(params) {
2906
+ // InputBaseComponentProps is used here because that is the base
2907
+ // type of 'inputProps' of 'StyledTextField' component. TS treats
2908
+ // 'inputProps' as 'object' type and will complain when accessing
2909
+ // className without casting to proper type
2910
+ var inputProps = params.inputProps;
2908
2911
  return (
2909
2912
  /*#__PURE__*/
2910
2913
  // We are not using DotInputText here because the {...params} spread
@@ -2924,6 +2927,9 @@
2924
2927
  error: error,
2925
2928
  helperText: helperText,
2926
2929
  id: inputId,
2930
+ inputProps: __assign(__assign({}, inputProps), {
2931
+ className: useStylesWithRootClass(inputProps.className, 'dot-input')
2932
+ }),
2927
2933
  inputRef: textFieldRef,
2928
2934
  label: label,
2929
2935
  name: label,
@@ -3108,10 +3114,17 @@
3108
3114
  lastItemRef = refs.lastItemRef;
3109
3115
  return items === null || items === void 0 ? void 0 : items.map(function (item, index) {
3110
3116
  var ariaLabel = item.ariaLabel,
3117
+ characterLimit = item.characterLimit,
3111
3118
  href = item.href,
3112
3119
  onClick = item.onClick,
3113
3120
  text = item.text,
3114
- underline = item.underline; // Check if last element
3121
+ underline = item.underline;
3122
+ var truncatedText = '';
3123
+
3124
+ if (text.length > characterLimit) {
3125
+ truncatedText = text.slice(0, characterLimit) + '...';
3126
+ } // Check if last element
3127
+
3115
3128
 
3116
3129
  if (index === items.length - 1) {
3117
3130
  // Add tooltip if item is not fully visible
@@ -3125,6 +3138,8 @@
3125
3138
  return /*#__PURE__*/React__default["default"].createElement("div", {
3126
3139
  key: index,
3127
3140
  ref: isFirstItemAfterCollapse ? firstItemRef : undefined
3141
+ }, /*#__PURE__*/React__default["default"].createElement(DotTooltip, {
3142
+ title: truncatedText && text
3128
3143
  }, /*#__PURE__*/React__default["default"].createElement(DotLink, {
3129
3144
  ariaLabel: ariaLabel,
3130
3145
  className: "breadcrumb",
@@ -3133,7 +3148,7 @@
3133
3148
  onClick: onClick,
3134
3149
  tabIndex: 0,
3135
3150
  underline: underline
3136
- }, text));
3151
+ }, truncatedText ? truncatedText : text)));
3137
3152
  }
3138
3153
  });
3139
3154
  };
@@ -4,6 +4,8 @@ import { LinkUnderline } from '../link/Link';
4
4
  export declare type BreadcrumbItem = {
5
5
  /** Defines a string value that labels the current element **/
6
6
  ariaLabel?: string;
7
+ /** If the number of characters is exceeded then an ellipsis should be used to truncate the text */
8
+ characterLimit?: number;
7
9
  /** link the breadcrumb goes to */
8
10
  href?: string;
9
11
  onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
@@ -1,4 +1,5 @@
1
1
  import { BreadcrumbItem } from '../breadcrumbs/Breadcrumbs';
2
2
  export declare const defaultStorybookItems: BreadcrumbItem[];
3
+ export declare const characterLimitBreadcrumbItems: BreadcrumbItem[];
3
4
  export declare const mockBreadcrumbItems: BreadcrumbItem[];
4
5
  export declare const mockLongBreadcrumbItems: BreadcrumbItem[];
@@ -1,3 +1,3 @@
1
- import { ListItemProps } from './ListItem';
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>;
@@ -0,0 +1,83 @@
1
+ import { MouseEvent } from 'react';
2
+ import { ListItemProps } from '../list/utils/models';
3
+ export declare const getNavigationItems: (isSelected: (key: number) => boolean, handleClick: (key: number) => void) => ({
4
+ startIconId: string;
5
+ onClick: import("@storybook/addon-actions").HandlerFunction;
6
+ items: ({
7
+ text: string;
8
+ divider: boolean;
9
+ onClick?: undefined;
10
+ selected?: undefined;
11
+ child?: undefined;
12
+ } | {
13
+ onClick: (_event: MouseEvent) => void;
14
+ selected: boolean;
15
+ text: string;
16
+ divider?: undefined;
17
+ child?: undefined;
18
+ } | {
19
+ child: JSX.Element;
20
+ text?: undefined;
21
+ divider?: undefined;
22
+ onClick?: undefined;
23
+ selected?: undefined;
24
+ })[];
25
+ text: string;
26
+ endIconId?: undefined;
27
+ selected?: undefined;
28
+ divider?: undefined;
29
+ } | {
30
+ items: ({
31
+ text: string;
32
+ divider: boolean;
33
+ startIconId?: undefined;
34
+ onClick?: undefined;
35
+ selected?: undefined;
36
+ } | {
37
+ startIconId: string;
38
+ onClick: (_event: MouseEvent) => void;
39
+ selected: boolean;
40
+ text: string;
41
+ divider?: undefined;
42
+ })[];
43
+ text: string;
44
+ startIconId?: undefined;
45
+ onClick?: undefined;
46
+ endIconId?: undefined;
47
+ selected?: undefined;
48
+ divider?: undefined;
49
+ } | {
50
+ endIconId: string;
51
+ startIconId: string;
52
+ onClick: (_event: MouseEvent) => void;
53
+ selected: boolean;
54
+ text: string;
55
+ items?: undefined;
56
+ divider?: undefined;
57
+ } | {
58
+ text: string;
59
+ divider: boolean;
60
+ startIconId?: undefined;
61
+ onClick?: undefined;
62
+ items?: undefined;
63
+ endIconId?: undefined;
64
+ selected?: undefined;
65
+ } | {
66
+ startIconId: string;
67
+ onClick: (_event: MouseEvent) => void;
68
+ selected: boolean;
69
+ text: string;
70
+ items?: undefined;
71
+ endIconId?: undefined;
72
+ divider?: undefined;
73
+ } | {
74
+ divider: boolean;
75
+ startIconId?: undefined;
76
+ onClick?: undefined;
77
+ items?: undefined;
78
+ text?: undefined;
79
+ endIconId?: undefined;
80
+ selected?: undefined;
81
+ })[];
82
+ export declare const routerNavigationItems: Array<ListItemProps>;
83
+ export declare const SidebarStoryRoutes: () => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -32,6 +32,7 @@
32
32
  "styled-components": "^5.2.1"
33
33
  },
34
34
  "peerDependencies": {
35
- "react": "^16.8.0 || ^17.0.0"
35
+ "react": "^16.8.0 || ^17.0.0",
36
+ "react-router-dom": "^5.2.0"
36
37
  }
37
38
  }