@carbon/ibm-products 2.43.2-canary.101 → 2.43.2-canary.103

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,8 @@ var DatagridContent = function DatagridContent(_ref) {
40
40
  var _useContext2 = useContext(FilterContext),
41
41
  filterTags = _useContext2.filterTags,
42
42
  EventEmitter = _useContext2.EventEmitter,
43
- panelOpen = _useContext2.panelOpen;
43
+ panelOpen = _useContext2.panelOpen,
44
+ contextTableId = _useContext2.tableId;
44
45
  var activeCellId = inlineEditState.activeCellId,
45
46
  gridActive = inlineEditState.gridActive,
46
47
  editId = inlineEditState.editId,
@@ -151,7 +152,7 @@ var DatagridContent = function DatagridContent(_ref) {
151
152
  }
152
153
  }, [withInlineEdit, tableId, totalColumnsWidth, datagridState, gridActive]);
153
154
  useSubscribeToEventEmitter(CLEAR_SINGLE_FILTER, function (id) {
154
- return clearSingleFilter(id, setAllFilters, state);
155
+ return clearSingleFilter(id, setAllFilters, state, contextTableId);
155
156
  });
156
157
  var renderFilterSummary = function renderFilterSummary() {
157
158
  return state.filters.length > 0 && /*#__PURE__*/React__default.createElement(FilterSummary, {
@@ -185,7 +185,7 @@ var FilterPanel = function FilterPanel(_ref) {
185
185
  }, [filterPanelMinHeight]);
186
186
 
187
187
  // tableId is passed in from the event emitter from the FilterSummary component
188
- // in DatagridContent
188
+ // in DatagridContent
189
189
  useSubscribeToEventEmitter(CLEAR_FILTERS, function (tableId) {
190
190
  reset(tableId);
191
191
  });
@@ -1,8 +1,9 @@
1
1
  export const FilterContext: React.Context<any>;
2
- export function clearSingleFilter({ key, value }: {
2
+ export function clearSingleFilter({ key, value, tableId }: {
3
3
  key: any;
4
4
  value: any;
5
- }, setAllFilters: any, state: any): void;
5
+ tableId: any;
6
+ }, setAllFilters: any, state: any, contextTableId: any): void;
6
7
  export function FilterProvider({ children, filters, filterProps, tableId }: {
7
8
  children: any;
8
9
  filters: any;
@@ -47,9 +47,13 @@ var updateFilterState = function updateFilterState(state, type, value) {
47
47
  });
48
48
  return removeFilterItem(state, filterTagIndex);
49
49
  };
50
- var clearSingleFilter = function clearSingleFilter(_ref, setAllFilters, state) {
50
+ var clearSingleFilter = function clearSingleFilter(_ref, setAllFilters, state, contextTableId) {
51
51
  var key = _ref.key,
52
- value = _ref.value;
52
+ value = _ref.value,
53
+ tableId = _ref.tableId;
54
+ if (tableId !== contextTableId) {
55
+ return;
56
+ }
53
57
  var tempState = _toConsumableArray(state.filters);
54
58
  tempState.forEach(function (f, filterIndex) {
55
59
  if (f.id === key) {
@@ -85,10 +89,11 @@ var clearSingleFilter = function clearSingleFilter(_ref, setAllFilters, state) {
85
89
  });
86
90
  setAllFilters(tempState);
87
91
  };
88
- var handleSingleFilterRemoval = function handleSingleFilterRemoval(key, value) {
92
+ var handleSingleFilterRemoval = function handleSingleFilterRemoval(key, value, tableId) {
89
93
  EventEmitter.dispatch(CLEAR_SINGLE_FILTER, {
90
94
  key: key,
91
- value: value
95
+ value: value,
96
+ tableId: tableId
92
97
  });
93
98
  };
94
99
  var formatDateRange = function formatDateRange(startDate, endDate) {
@@ -96,7 +101,7 @@ var formatDateRange = function formatDateRange(startDate, endDate) {
96
101
  var endDateObj = new Date(endDate);
97
102
  return "".concat(startDateObj.toLocaleDateString(), " - ").concat(endDateObj.toLocaleDateString());
98
103
  };
99
- var prepareFiltersForTags = function prepareFiltersForTags(filters, renderDateLabel) {
104
+ var prepareFiltersForTags = function prepareFiltersForTags(filters, renderDateLabel, tableId) {
100
105
  var tags = [];
101
106
  filters.forEach(function (_ref2) {
102
107
  var id = _ref2.id,
@@ -105,7 +110,7 @@ var prepareFiltersForTags = function prepareFiltersForTags(filters, renderDateLa
105
110
  var sharedFilterProps = {
106
111
  filter: true,
107
112
  onClose: function onClose() {
108
- return handleSingleFilterRemoval(id, value);
113
+ return handleSingleFilterRemoval(id, value, tableId);
109
114
  }
110
115
  };
111
116
  if (type === DROPDOWN || type === RADIO || type === NUMBER) {
@@ -130,7 +135,7 @@ var prepareFiltersForTags = function prepareFiltersForTags(filters, renderDateLa
130
135
  value: option.value
131
136
  }, sharedFilterProps), {}, {
132
137
  onClose: function onClose() {
133
- return handleSingleFilterRemoval(id, option.value);
138
+ return handleSingleFilterRemoval(id, option.value, tableId);
134
139
  }
135
140
  }));
136
141
  }
@@ -160,7 +165,7 @@ var FilterProvider = function FilterProvider(_ref4) {
160
165
  tableId = _ref4.tableId;
161
166
  var _ref5 = filterProps || {},
162
167
  renderDateLabel = _ref5.renderDateLabel;
163
- var filterTags = prepareFiltersForTags(filters, renderDateLabel);
168
+ var filterTags = prepareFiltersForTags(filters, renderDateLabel, tableId);
164
169
  var _useState = useState(false),
165
170
  _useState2 = _slicedToArray(_useState, 2),
166
171
  panelOpen = _useState2[0],
@@ -1,9 +1,76 @@
1
- export namespace defaults {
2
- let position: string;
3
- let size: string;
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2021
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /// <reference path="../../../src/custom-typings/index.d.ts" />
8
+ import React, { ReactNode } from 'react';
9
+ import '../../global/js/utils/props-helper';
10
+ import { ButtonProps } from '@carbon/react';
11
+ import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
12
+ declare enum sizes {
13
+ lg = "lg",
14
+ sm = "sm"
15
+ }
16
+ export declare const defaults: {
17
+ position: string;
18
+ size: sizes;
19
+ };
20
+ interface EmptyStateProps {
21
+ /**
22
+ * Empty state action button
23
+ */
24
+ action?: {
25
+ kind?: 'primary' | 'secondary' | 'tertiary';
26
+ renderIcon?: CarbonIconType;
27
+ onClick?: ButtonProps['onClick'];
28
+ text?: string;
29
+ };
30
+ /**
31
+ * Provide an optional class to be applied to the containing node.
32
+ */
33
+ className?: string;
34
+ /**
35
+ * Empty state illustration, specify the `src` for a provided illustration to be displayed. In the case of requiring a light and dark illustration of your own, simply pass the corresponding illustration based on the current theme of your application.
36
+ * For example: `illustration={appTheme === 'dark' ? darkIllustration : lightIllustration}`
37
+ */
38
+ illustration?: string;
39
+ /**
40
+ * The alt text for empty state svg images. If not provided , title will be used.
41
+ */
42
+ illustrationDescription?: string;
43
+ /**
44
+ * Designates the position of the illustration relative to the content
45
+ */
46
+ illustrationPosition?: 'top' | 'right' | 'bottom' | 'left';
47
+ /**
48
+ * Empty state link object
49
+ */
50
+ link?: {
51
+ text?: string | ReactNode;
52
+ href?: string;
53
+ };
54
+ /**
55
+ * Empty state size
56
+ */
57
+ size?: 'lg' | 'sm';
58
+ /**
59
+ * Empty state subtitle
60
+ */
61
+ subtitle?: string | ReactNode;
62
+ /**
63
+ * Empty state title
64
+ */
65
+ title: string | ReactNode;
66
+ /**
67
+ * Designates which version of the EmptyState component is being used.
68
+ * Refer to V2 documentation separately.
69
+ */
70
+ v2?: boolean;
4
71
  }
5
72
  /**
6
73
  * The `EmptyState` component follows the Carbon guidelines for empty states with some added specifications around illustration usage. For additional usage guidelines and documentation please refer to the links above.
7
74
  */
8
- export let EmptyState: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
9
- import React from 'react';
75
+ export declare let EmptyState: React.ForwardRefExoticComponent<EmptyStateProps & React.RefAttributes<HTMLDivElement>>;
76
+ export {};
@@ -22,13 +22,15 @@ var _excluded = ["v2"],
22
22
  // The block part of our conventional BEM class names (blockClass__E--M).
23
23
  var blockClass = "".concat(pkg.prefix, "--empty-state");
24
24
  var componentName = 'EmptyState';
25
-
26
- // Default values for props
25
+ var sizes = /*#__PURE__*/function (sizes) {
26
+ sizes["lg"] = "lg";
27
+ sizes["sm"] = "sm";
28
+ return sizes;
29
+ }(sizes || {}); // Default values for props
27
30
  var defaults = {
28
31
  position: 'top',
29
- size: 'lg'
32
+ size: sizes.lg
30
33
  };
31
-
32
34
  /**
33
35
  * The `EmptyState` component follows the Carbon guidelines for empty states with some added specifications around illustration usage. For additional usage guidelines and documentation please refer to the links above.
34
36
  */
@@ -64,7 +66,7 @@ var EmptyState = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
64
66
  link: link,
65
67
  size: size,
66
68
  subtitle: subtitle,
67
- title: title
69
+ title: title !== null && title !== void 0 ? title : ''
68
70
  }));
69
71
  });
70
72
 
@@ -92,6 +94,7 @@ EmptyState.propTypes = {
92
94
  /**
93
95
  * The alt text for custom provided illustrations
94
96
  */
97
+ /**@ts-ignore*/
95
98
  illustrationDescription: PropTypes.string.isRequired.if(function (_ref2) {
96
99
  var illustration = _ref2.illustration;
97
100
  return illustration;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2023, 2023
2
+ * Copyright IBM Corp. 2023, 2024
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -44,7 +44,7 @@ interface EmptyStateV2Props {
44
44
  * Props for the link. Refer to the Carbon Components link documentation for full list of props.
45
45
  */
46
46
  link?: {
47
- text?: string;
47
+ text?: string | ReactNode;
48
48
  };
49
49
  /**
50
50
  * Empty state size
@@ -107,7 +107,7 @@ EmptyStateV2.propTypes = {
107
107
  */
108
108
  /**@ts-ignore*/
109
109
  link: PropTypes.shape({
110
- text: PropTypes.string
110
+ text: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
111
111
  }),
112
112
  /**
113
113
  * Empty state size
@@ -49,7 +49,8 @@ var DatagridContent = function DatagridContent(_ref) {
49
49
  var _useContext2 = React.useContext(FilterProvider.FilterContext),
50
50
  filterTags = _useContext2.filterTags,
51
51
  EventEmitter = _useContext2.EventEmitter,
52
- panelOpen = _useContext2.panelOpen;
52
+ panelOpen = _useContext2.panelOpen,
53
+ contextTableId = _useContext2.tableId;
53
54
  var activeCellId = inlineEditState.activeCellId,
54
55
  gridActive = inlineEditState.gridActive,
55
56
  editId = inlineEditState.editId,
@@ -160,7 +161,7 @@ var DatagridContent = function DatagridContent(_ref) {
160
161
  }
161
162
  }, [withInlineEdit, tableId, totalColumnsWidth, datagridState, gridActive]);
162
163
  useSubscribeToEventEmitter["default"](constants.CLEAR_SINGLE_FILTER, function (id) {
163
- return FilterProvider.clearSingleFilter(id, setAllFilters, state);
164
+ return FilterProvider.clearSingleFilter(id, setAllFilters, state, contextTableId);
164
165
  });
165
166
  var renderFilterSummary = function renderFilterSummary() {
166
167
  return state.filters.length > 0 && /*#__PURE__*/React__default["default"].createElement(FilterSummary["default"], {
@@ -194,7 +194,7 @@ var FilterPanel = function FilterPanel(_ref) {
194
194
  }, [filterPanelMinHeight]);
195
195
 
196
196
  // tableId is passed in from the event emitter from the FilterSummary component
197
- // in DatagridContent
197
+ // in DatagridContent
198
198
  useSubscribeToEventEmitter["default"](constants.CLEAR_FILTERS, function (tableId) {
199
199
  reset(tableId);
200
200
  });
@@ -1,8 +1,9 @@
1
1
  export const FilterContext: React.Context<any>;
2
- export function clearSingleFilter({ key, value }: {
2
+ export function clearSingleFilter({ key, value, tableId }: {
3
3
  key: any;
4
4
  value: any;
5
- }, setAllFilters: any, state: any): void;
5
+ tableId: any;
6
+ }, setAllFilters: any, state: any, contextTableId: any): void;
6
7
  export function FilterProvider({ children, filters, filterProps, tableId }: {
7
8
  children: any;
8
9
  filters: any;
@@ -55,9 +55,13 @@ var updateFilterState = function updateFilterState(state, type, value) {
55
55
  });
56
56
  return removeFilterItem(state, filterTagIndex);
57
57
  };
58
- var clearSingleFilter = function clearSingleFilter(_ref, setAllFilters, state) {
58
+ var clearSingleFilter = function clearSingleFilter(_ref, setAllFilters, state, contextTableId) {
59
59
  var key = _ref.key,
60
- value = _ref.value;
60
+ value = _ref.value,
61
+ tableId = _ref.tableId;
62
+ if (tableId !== contextTableId) {
63
+ return;
64
+ }
61
65
  var tempState = _rollupPluginBabelHelpers.toConsumableArray(state.filters);
62
66
  tempState.forEach(function (f, filterIndex) {
63
67
  if (f.id === key) {
@@ -93,10 +97,11 @@ var clearSingleFilter = function clearSingleFilter(_ref, setAllFilters, state) {
93
97
  });
94
98
  setAllFilters(tempState);
95
99
  };
96
- var handleSingleFilterRemoval = function handleSingleFilterRemoval(key, value) {
100
+ var handleSingleFilterRemoval = function handleSingleFilterRemoval(key, value, tableId) {
97
101
  EventEmitter.dispatch(constants.CLEAR_SINGLE_FILTER, {
98
102
  key: key,
99
- value: value
103
+ value: value,
104
+ tableId: tableId
100
105
  });
101
106
  };
102
107
  var formatDateRange = function formatDateRange(startDate, endDate) {
@@ -104,7 +109,7 @@ var formatDateRange = function formatDateRange(startDate, endDate) {
104
109
  var endDateObj = new Date(endDate);
105
110
  return "".concat(startDateObj.toLocaleDateString(), " - ").concat(endDateObj.toLocaleDateString());
106
111
  };
107
- var prepareFiltersForTags = function prepareFiltersForTags(filters, renderDateLabel) {
112
+ var prepareFiltersForTags = function prepareFiltersForTags(filters, renderDateLabel, tableId) {
108
113
  var tags = [];
109
114
  filters.forEach(function (_ref2) {
110
115
  var id = _ref2.id,
@@ -113,7 +118,7 @@ var prepareFiltersForTags = function prepareFiltersForTags(filters, renderDateLa
113
118
  var sharedFilterProps = {
114
119
  filter: true,
115
120
  onClose: function onClose() {
116
- return handleSingleFilterRemoval(id, value);
121
+ return handleSingleFilterRemoval(id, value, tableId);
117
122
  }
118
123
  };
119
124
  if (type === constants.DROPDOWN || type === constants.RADIO || type === constants.NUMBER) {
@@ -138,7 +143,7 @@ var prepareFiltersForTags = function prepareFiltersForTags(filters, renderDateLa
138
143
  value: option.value
139
144
  }, sharedFilterProps), {}, {
140
145
  onClose: function onClose() {
141
- return handleSingleFilterRemoval(id, option.value);
146
+ return handleSingleFilterRemoval(id, option.value, tableId);
142
147
  }
143
148
  }));
144
149
  }
@@ -168,7 +173,7 @@ var FilterProvider = function FilterProvider(_ref4) {
168
173
  tableId = _ref4.tableId;
169
174
  var _ref5 = filterProps || {},
170
175
  renderDateLabel = _ref5.renderDateLabel;
171
- var filterTags = prepareFiltersForTags(filters, renderDateLabel);
176
+ var filterTags = prepareFiltersForTags(filters, renderDateLabel, tableId);
172
177
  var _useState = React.useState(false),
173
178
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
174
179
  panelOpen = _useState2[0],
@@ -1,9 +1,76 @@
1
- export namespace defaults {
2
- let position: string;
3
- let size: string;
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2021
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /// <reference path="../../../src/custom-typings/index.d.ts" />
8
+ import React, { ReactNode } from 'react';
9
+ import '../../global/js/utils/props-helper';
10
+ import { ButtonProps } from '@carbon/react';
11
+ import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
12
+ declare enum sizes {
13
+ lg = "lg",
14
+ sm = "sm"
15
+ }
16
+ export declare const defaults: {
17
+ position: string;
18
+ size: sizes;
19
+ };
20
+ interface EmptyStateProps {
21
+ /**
22
+ * Empty state action button
23
+ */
24
+ action?: {
25
+ kind?: 'primary' | 'secondary' | 'tertiary';
26
+ renderIcon?: CarbonIconType;
27
+ onClick?: ButtonProps['onClick'];
28
+ text?: string;
29
+ };
30
+ /**
31
+ * Provide an optional class to be applied to the containing node.
32
+ */
33
+ className?: string;
34
+ /**
35
+ * Empty state illustration, specify the `src` for a provided illustration to be displayed. In the case of requiring a light and dark illustration of your own, simply pass the corresponding illustration based on the current theme of your application.
36
+ * For example: `illustration={appTheme === 'dark' ? darkIllustration : lightIllustration}`
37
+ */
38
+ illustration?: string;
39
+ /**
40
+ * The alt text for empty state svg images. If not provided , title will be used.
41
+ */
42
+ illustrationDescription?: string;
43
+ /**
44
+ * Designates the position of the illustration relative to the content
45
+ */
46
+ illustrationPosition?: 'top' | 'right' | 'bottom' | 'left';
47
+ /**
48
+ * Empty state link object
49
+ */
50
+ link?: {
51
+ text?: string | ReactNode;
52
+ href?: string;
53
+ };
54
+ /**
55
+ * Empty state size
56
+ */
57
+ size?: 'lg' | 'sm';
58
+ /**
59
+ * Empty state subtitle
60
+ */
61
+ subtitle?: string | ReactNode;
62
+ /**
63
+ * Empty state title
64
+ */
65
+ title: string | ReactNode;
66
+ /**
67
+ * Designates which version of the EmptyState component is being used.
68
+ * Refer to V2 documentation separately.
69
+ */
70
+ v2?: boolean;
4
71
  }
5
72
  /**
6
73
  * The `EmptyState` component follows the Carbon guidelines for empty states with some added specifications around illustration usage. For additional usage guidelines and documentation please refer to the links above.
7
74
  */
8
- export let EmptyState: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
9
- import React from 'react';
75
+ export declare let EmptyState: React.ForwardRefExoticComponent<EmptyStateProps & React.RefAttributes<HTMLDivElement>>;
76
+ export {};
@@ -31,13 +31,15 @@ var _excluded = ["v2"],
31
31
  // The block part of our conventional BEM class names (blockClass__E--M).
32
32
  var blockClass = "".concat(settings.pkg.prefix, "--empty-state");
33
33
  var componentName = 'EmptyState';
34
-
35
- // Default values for props
34
+ var sizes = /*#__PURE__*/function (sizes) {
35
+ sizes["lg"] = "lg";
36
+ sizes["sm"] = "sm";
37
+ return sizes;
38
+ }(sizes || {}); // Default values for props
36
39
  var defaults = {
37
40
  position: 'top',
38
- size: 'lg'
41
+ size: sizes.lg
39
42
  };
40
-
41
43
  /**
42
44
  * The `EmptyState` component follows the Carbon guidelines for empty states with some added specifications around illustration usage. For additional usage guidelines and documentation please refer to the links above.
43
45
  */
@@ -73,7 +75,7 @@ exports.EmptyState = /*#__PURE__*/React__default["default"].forwardRef(function
73
75
  link: link,
74
76
  size: size,
75
77
  subtitle: subtitle,
76
- title: title
78
+ title: title !== null && title !== void 0 ? title : ''
77
79
  }));
78
80
  });
79
81
 
@@ -101,6 +103,7 @@ exports.EmptyState.propTypes = {
101
103
  /**
102
104
  * The alt text for custom provided illustrations
103
105
  */
106
+ /**@ts-ignore*/
104
107
  illustrationDescription: index["default"].string.isRequired.if(function (_ref2) {
105
108
  var illustration = _ref2.illustration;
106
109
  return illustration;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2023, 2023
2
+ * Copyright IBM Corp. 2023, 2024
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -44,7 +44,7 @@ interface EmptyStateV2Props {
44
44
  * Props for the link. Refer to the Carbon Components link documentation for full list of props.
45
45
  */
46
46
  link?: {
47
- text?: string;
47
+ text?: string | ReactNode;
48
48
  };
49
49
  /**
50
50
  * Empty state size
@@ -116,7 +116,7 @@ exports.EmptyStateV2.propTypes = {
116
116
  */
117
117
  /**@ts-ignore*/
118
118
  link: index["default"].shape({
119
- text: index["default"].string
119
+ text: index["default"].oneOfType([index["default"].string, index["default"].node])
120
120
  }),
121
121
  /**
122
122
  * Empty state size
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.43.2-canary.101+137f5b1f1",
4
+ "version": "2.43.2-canary.103+95b756345",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -96,7 +96,7 @@
96
96
  "dependencies": {
97
97
  "@babel/runtime": "^7.23.9",
98
98
  "@carbon/feature-flags": "^0.20.0",
99
- "@carbon/ibm-products-styles": "^2.39.1-canary.111+137f5b1f1",
99
+ "@carbon/ibm-products-styles": "^2.42.0-rc.0",
100
100
  "@carbon/telemetry": "^0.1.0",
101
101
  "@dnd-kit/core": "^6.0.8",
102
102
  "@dnd-kit/modifiers": "^7.0.0",
@@ -120,5 +120,5 @@
120
120
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
121
121
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
122
122
  },
123
- "gitHead": "137f5b1f103140707b90e1d6f94a0e7ba2636883"
123
+ "gitHead": "95b7563457730ea24fed77e9aca2c964d9d713ac"
124
124
  }