@carbon/ibm-products 2.25.0 → 2.26.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +42 -10
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +18 -2
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +42 -10
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +42 -10
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/Cascade/Cascade.d.ts +19 -2
- package/es/components/Cascade/Cascade.js +12 -9
- package/es/components/Coachmark/CoachmarkTagline.js +1 -2
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +1 -1
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +14 -5
- package/es/components/Datagrid/Datagrid/DatagridRow.js +15 -2
- package/es/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +2 -0
- package/es/components/Datagrid/Datagrid/addons/Slug/{ColumnHeaderSlug.js → DatagridSlug.js} +4 -4
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +2 -2
- package/es/components/Datagrid/useSelectAllToggle.js +1 -1
- package/es/components/Datagrid/useSortableColumns.js +2 -2
- package/es/components/EmptyStates/EmptyStateContent.d.ts +1 -1
- package/es/components/FullPageError/FullPageError.js +41 -15
- package/es/components/FullPageError/assets/Error403SVG.d.ts +9 -0
- package/es/components/FullPageError/assets/Error403SVG.js +714 -0
- package/es/components/FullPageError/assets/Error404SVG.d.ts +9 -0
- package/es/components/FullPageError/assets/Error404SVG.js +623 -0
- package/es/components/HTTPErrors/HTTPErrorContent.d.ts +1 -1
- package/es/components/InterstitialScreen/InterstitialScreen.js +1 -1
- package/es/components/Tearsheet/TearsheetShell.js +16 -4
- package/es/components/UserAvatar/UserAvatar.js +1 -2
- package/es/global/js/hooks/index.d.ts +1 -0
- package/es/global/js/hooks/useFocus.d.ts +11 -0
- package/es/global/js/hooks/useFocus.js +76 -0
- package/lib/components/Cascade/Cascade.d.ts +19 -2
- package/lib/components/Cascade/Cascade.js +12 -9
- package/lib/components/Coachmark/CoachmarkTagline.js +3 -4
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +2 -2
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +13 -4
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +14 -1
- package/lib/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +2 -0
- package/lib/components/Datagrid/Datagrid/addons/Slug/{ColumnHeaderSlug.js → DatagridSlug.js} +4 -4
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +2 -2
- package/lib/components/Datagrid/useSelectAllToggle.js +1 -1
- package/lib/components/Datagrid/useSortableColumns.js +2 -2
- package/lib/components/EmptyStates/EmptyStateContent.d.ts +1 -1
- package/lib/components/FullPageError/FullPageError.js +41 -15
- package/lib/components/FullPageError/assets/Error403SVG.d.ts +9 -0
- package/lib/components/FullPageError/assets/Error403SVG.js +722 -0
- package/lib/components/FullPageError/assets/Error404SVG.d.ts +9 -0
- package/lib/components/FullPageError/assets/Error404SVG.js +631 -0
- package/lib/components/HTTPErrors/HTTPErrorContent.d.ts +1 -1
- package/lib/components/InterstitialScreen/InterstitialScreen.js +3 -3
- package/lib/components/Tearsheet/TearsheetShell.js +16 -4
- package/lib/components/UserAvatar/UserAvatar.js +1 -2
- package/lib/global/js/hooks/index.d.ts +1 -0
- package/lib/global/js/hooks/useFocus.d.ts +11 -0
- package/lib/global/js/hooks/useFocus.js +80 -0
- package/package.json +3 -3
- package/scss/components/Datagrid/styles/_datagrid.scss +19 -0
- package/scss/components/FilterSummary/_filter-summary.scss +1 -1
- package/scss/components/FullPageError/_full-page-error.scss +20 -2
- package/scss/components/ProductiveCard/_productive-card.scss +1 -1
- package/scss/components/UserAvatar/_user-avatar.scss +8 -5
- package/es/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.d.ts +0 -2
- package/es/node_modules/@carbon/icon-helpers/es/index.js +0 -140
- package/es/node_modules/@carbon/icons-react/es/Icon.js +0 -73
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-0.js +0 -2985
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-3.js +0 -2900
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3004
- package/es/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +0 -14
- package/lib/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.d.ts +0 -2
- package/lib/node_modules/@carbon/icon-helpers/es/index.js +0 -145
- package/lib/node_modules/@carbon/icons-react/es/Icon.js +0 -81
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-0.js +0 -3117
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-3.js +0 -3032
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3136
- package/lib/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +0 -18
@@ -1,3 +1,18 @@
|
|
1
|
+
import React, { ReactNode } from 'react';
|
2
|
+
interface CascadeProps {
|
3
|
+
children: ReactNode;
|
4
|
+
/**
|
5
|
+
* Specify an optional className to be applied to
|
6
|
+
* the container node.
|
7
|
+
*/
|
8
|
+
className?: string;
|
9
|
+
/**
|
10
|
+
* Specifies whether or not to wrap the child content in a `<Grid />`.
|
11
|
+
* If this is set to true it's important that the children are being wrapped in rows in columns.
|
12
|
+
* Check the documentation for additional clarification.
|
13
|
+
*/
|
14
|
+
grid?: boolean;
|
15
|
+
}
|
1
16
|
/**
|
2
17
|
|
3
18
|
This pattern is intended for use with cards, tiles, or similarly styled
|
@@ -7,5 +22,7 @@ the page. It should not be used on a page if it is the secondary focus of the
|
|
7
22
|
page as that will distract the user.
|
8
23
|
|
9
24
|
*/
|
10
|
-
export let Cascade: React.ForwardRefExoticComponent<
|
11
|
-
|
25
|
+
export declare let Cascade: React.ForwardRefExoticComponent<CascadeProps & {
|
26
|
+
children?: React.ReactNode;
|
27
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
28
|
+
export {};
|
@@ -53,16 +53,19 @@ var Cascade = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
53
53
|
if (grid) {
|
54
54
|
var colIdx = 0;
|
55
55
|
var gridElm = React__default.Children.map(children, function (row) {
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
if ( /*#__PURE__*/React__default.isValidElement(row)) {
|
57
|
+
var cols = React__default.Children.map(row === null || row === void 0 ? void 0 : row.props.children, function (col) {
|
58
|
+
colIdx = colIdx + 1;
|
59
|
+
var colClassnames = cx(col.props.className, "".concat(blockClass, "__col"), "".concat(blockClass, "__col-").concat(colIdx));
|
60
|
+
return /*#__PURE__*/React__default.cloneElement(col, {
|
61
|
+
className: colClassnames
|
62
|
+
});
|
61
63
|
});
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
}
|
64
|
+
return /*#__PURE__*/React__default.cloneElement(row, {
|
65
|
+
children: cols
|
66
|
+
});
|
67
|
+
}
|
68
|
+
return children;
|
66
69
|
});
|
67
70
|
return /*#__PURE__*/React__default.createElement("div", props, /*#__PURE__*/React__default.createElement(Grid, null, gridElm));
|
68
71
|
}
|
@@ -9,12 +9,11 @@ import { objectWithoutProperties as _objectWithoutProperties, extends as _extend
|
|
9
9
|
import React__default from 'react';
|
10
10
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
11
11
|
import cx from '../../node_modules/classnames/index.js';
|
12
|
+
import { Idea, Close } from '@carbon/react/icons';
|
12
13
|
import { Button } from '@carbon/react';
|
13
14
|
import { useCoachmark } from './utils/context.js';
|
14
15
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
15
16
|
import { pkg } from '../../settings.js';
|
16
|
-
import { Idea } from '../../node_modules/@carbon/icons-react/es/generated/bucket-8.js';
|
17
|
-
import { Close } from '../../node_modules/@carbon/icons-react/es/generated/bucket-3.js';
|
18
17
|
|
19
18
|
var _Idea;
|
20
19
|
var _excluded = ["closeIconDescription", "onClose", "theme", "title"];
|
@@ -10,12 +10,12 @@ import React__default, { forwardRef, useRef, useState, useEffect } from 'react';
|
|
10
10
|
import pconsole from '../../global/js/utils/pconsole.js';
|
11
11
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
12
12
|
import cx from '../../node_modules/classnames/index.js';
|
13
|
+
import { Idea } from '@carbon/react/icons';
|
13
14
|
import { Button } from '@carbon/react';
|
14
15
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
15
16
|
import { pkg } from '../../settings.js';
|
16
17
|
import { createPortal } from 'react-dom';
|
17
18
|
import { CoachmarkHeader } from '../Coachmark/CoachmarkHeader.js';
|
18
|
-
import { Idea } from '../../node_modules/@carbon/icons-react/es/generated/bucket-8.js';
|
19
19
|
import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia/SteppedAnimatedMedia.js';
|
20
20
|
|
21
21
|
var _excluded = ["className", "description", "isOpen", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray, objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, { useEffect, useState } from 'react';
|
9
|
+
import React__default, { useEffect, useState, isValidElement } from 'react';
|
10
10
|
import cx from '../../../node_modules/classnames/index.js';
|
11
11
|
import { TableRow, TableHeader } from '@carbon/react';
|
12
12
|
import { px } from '@carbon/layout';
|
@@ -14,8 +14,9 @@ import { selectionColumnId } from '../common-column-ids.js';
|
|
14
14
|
import { pkg } from '../../../settings.js';
|
15
15
|
import { handleColumnResizeEndEvent, handleColumnResizingEvent } from './addons/stateReducer.js';
|
16
16
|
import { getNodeTextContent } from '../../../global/js/utils/getNodeTextContent.js';
|
17
|
-
import {
|
17
|
+
import { DatagridSlug } from './addons/Slug/DatagridSlug.js';
|
18
18
|
|
19
|
+
var _th;
|
19
20
|
var _excluded = ["role"],
|
20
21
|
_excluded2 = ["className", "role"],
|
21
22
|
_excluded3 = ["role", "className"];
|
@@ -86,7 +87,8 @@ var ResizeHeader = function ResizeHeader(_ref) {
|
|
86
87
|
};
|
87
88
|
var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
88
89
|
var resizerAriaLabel = datagridState.resizerAriaLabel,
|
89
|
-
isTableSortable = datagridState.isTableSortable
|
90
|
+
isTableSortable = datagridState.isTableSortable,
|
91
|
+
rows = datagridState.rows;
|
90
92
|
// Used to measure the height of the table and uses that value
|
91
93
|
// to display a vertical line to indicate the column you are resizing
|
92
94
|
useEffect(function () {
|
@@ -132,14 +134,21 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
132
134
|
if (isTableSortable) {
|
133
135
|
return;
|
134
136
|
}
|
135
|
-
return /*#__PURE__*/React__default.createElement(
|
137
|
+
return /*#__PURE__*/React__default.createElement(DatagridSlug, {
|
136
138
|
slug: slug
|
137
139
|
});
|
138
140
|
};
|
141
|
+
var foundAIRow = rows.some(function (r) {
|
142
|
+
var _r$original;
|
143
|
+
return /*#__PURE__*/isValidElement(r === null || r === void 0 || (_r$original = r.original) === null || _r$original === void 0 ? void 0 : _r$original.slug);
|
144
|
+
});
|
139
145
|
return /*#__PURE__*/React__default.createElement(TableRow, _extends({}, headerGroupProps, {
|
140
146
|
className: cx("".concat(blockClass, "__head"), headerGroupClassName),
|
141
147
|
ref: headRef
|
142
|
-
}),
|
148
|
+
}), foundAIRow ? _th || (_th = /*#__PURE__*/React__default.createElement("th", {
|
149
|
+
scope: "col",
|
150
|
+
"aria-hidden": "false"
|
151
|
+
})) : null, datagridState.headers.filter(function (_ref3) {
|
143
152
|
var isVisible = _ref3.isVisible;
|
144
153
|
return isVisible;
|
145
154
|
}).map(function (header, index) {
|
@@ -6,12 +6,13 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { defineProperty as _defineProperty, objectWithoutProperties as _objectWithoutProperties, extends as _extends, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default from 'react';
|
9
|
+
import React__default, { isValidElement } from 'react';
|
10
10
|
import { TableRow, SkeletonText, TableCell } from '@carbon/react';
|
11
11
|
import { px } from '@carbon/layout';
|
12
12
|
import { selectionColumnId } from '../common-column-ids.js';
|
13
13
|
import cx from '../../../node_modules/classnames/index.js';
|
14
14
|
import { pkg, carbon } from '../../../settings.js';
|
15
|
+
import { DatagridSlug } from './addons/Slug/DatagridSlug.js';
|
15
16
|
|
16
17
|
var _SkeletonText;
|
17
18
|
var _excluded = ["role"],
|
@@ -27,7 +28,9 @@ var rowHeights = {
|
|
27
28
|
|
28
29
|
// eslint-disable-next-line react/prop-types
|
29
30
|
var DatagridRow = function DatagridRow(datagridState) {
|
31
|
+
var _row$original, _row$original2;
|
30
32
|
var row = datagridState.row,
|
33
|
+
rows = datagridState.rows,
|
31
34
|
rowSize = datagridState.rowSize,
|
32
35
|
withNestedRows = datagridState.withNestedRows,
|
33
36
|
prepareRow = datagridState.prepareRow,
|
@@ -109,6 +112,10 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
109
112
|
var _row$getRowProps = row.getRowProps();
|
110
113
|
_row$getRowProps.role;
|
111
114
|
var rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
|
115
|
+
var foundAIRow = rows.some(function (r) {
|
116
|
+
var _r$original;
|
117
|
+
return /*#__PURE__*/isValidElement(r === null || r === void 0 || (_r$original = r.original) === null || _r$original === void 0 ? void 0 : _r$original.slug);
|
118
|
+
});
|
112
119
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
113
120
|
key: key
|
114
121
|
}, /*#__PURE__*/React__default.createElement(TableRow, _extends({
|
@@ -120,7 +127,13 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
120
127
|
onFocus: hoverHandler,
|
121
128
|
onBlur: focusRemover,
|
122
129
|
onKeyUp: handleOnKeyUp
|
123
|
-
}, setAdditionalRowProps()), row.
|
130
|
+
}, setAdditionalRowProps()), foundAIRow ? row !== null && row !== void 0 && (_row$original = row.original) !== null && _row$original !== void 0 && _row$original.slug ? /*#__PURE__*/React__default.createElement("td", {
|
131
|
+
className: "".concat(blockClass, "__table-row-ai-enabled")
|
132
|
+
}, /*#__PURE__*/React__default.createElement(DatagridSlug, {
|
133
|
+
slug: row === null || row === void 0 || (_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.slug
|
134
|
+
})) : /*#__PURE__*/React__default.createElement("td", {
|
135
|
+
className: "".concat(blockClass, "__table-row-ai-spacer")
|
136
|
+
}) : null, row.cells.map(function (cell, index) {
|
124
137
|
var _cell$column, _content$props;
|
125
138
|
var cellProps = cell.getCellProps();
|
126
139
|
// eslint-disable-next-line no-unused-vars
|
@@ -8,7 +8,7 @@
|
|
8
8
|
import React__default, { forwardRef, isValidElement } from 'react';
|
9
9
|
import PropTypes from '../../../../../node_modules/prop-types/index.js';
|
10
10
|
|
11
|
-
var
|
11
|
+
var DatagridSlug = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
12
12
|
var slug = _ref.slug;
|
13
13
|
if (slug && /*#__PURE__*/isValidElement(slug)) {
|
14
14
|
var normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
@@ -17,13 +17,13 @@ var ColumnHeaderSlug = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
17
17
|
});
|
18
18
|
return normalizedSlug;
|
19
19
|
}
|
20
|
-
return;
|
20
|
+
return null;
|
21
21
|
});
|
22
|
-
|
22
|
+
DatagridSlug.propTypes = {
|
23
23
|
/**
|
24
24
|
* Specify the AI slug to be displayed
|
25
25
|
*/
|
26
26
|
slug: PropTypes.node
|
27
27
|
};
|
28
28
|
|
29
|
-
export {
|
29
|
+
export { DatagridSlug };
|
@@ -89,7 +89,7 @@ var stateReducer = function stateReducer(newState, action) {
|
|
89
89
|
if (rows) {
|
90
90
|
var newSelectedRowData = {};
|
91
91
|
rows.forEach(function (row) {
|
92
|
-
newSelectedRowData[getRowId(row, row.index)] = row;
|
92
|
+
newSelectedRowData[getRowId(row.original, row.index)] = row.original;
|
93
93
|
});
|
94
94
|
return _objectSpread2(_objectSpread2({}, newState), {}, {
|
95
95
|
selectedRowData: indeterminate || !isChecked ? {} : newSelectedRowData
|
@@ -108,7 +108,7 @@ var stateReducer = function stateReducer(newState, action) {
|
|
108
108
|
}
|
109
109
|
if (_isChecked) {
|
110
110
|
return _objectSpread2(_objectSpread2({}, newState), {}, {
|
111
|
-
selectedRowData: _objectSpread2(_objectSpread2({}, newState.selectedRowData), {}, _defineProperty({}, _getRowId(rowData, rowData.index), rowData))
|
111
|
+
selectedRowData: _objectSpread2(_objectSpread2({}, newState.selectedRowData), {}, _defineProperty({}, _getRowId(rowData.original, rowData.index), rowData.original))
|
112
112
|
});
|
113
113
|
}
|
114
114
|
if (rowData && !_isChecked) {
|
@@ -36,7 +36,7 @@ var useSelectAllWithToggleComponent = function useSelectAllWithToggleComponent(h
|
|
36
36
|
hooks.useInstance.push(useInstance);
|
37
37
|
};
|
38
38
|
var useAddClassNameToSelectRow = function useAddClassNameToSelectRow(hooks) {
|
39
|
-
var _useState = useState(window.innerWidth),
|
39
|
+
var _useState = useState(typeof window !== 'undefined' ? window.innerWidth : ''),
|
40
40
|
_useState2 = _slicedToArray(_useState, 2),
|
41
41
|
windowSize = _useState2[0],
|
42
42
|
setWindowSize = _useState2[1];
|
@@ -12,7 +12,7 @@ import { pkg, carbon } from '../../settings.js';
|
|
12
12
|
import { Button } from '@carbon/react';
|
13
13
|
import { ArrowsVertical, ArrowDown, ArrowUp } from '@carbon/react/icons';
|
14
14
|
import { SelectAll } from './Datagrid/DatagridSelectAll.js';
|
15
|
-
import {
|
15
|
+
import { DatagridSlug } from './Datagrid/addons/Slug/DatagridSlug.js';
|
16
16
|
|
17
17
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
18
18
|
var ordering = {
|
@@ -107,7 +107,7 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
107
107
|
kind: "ghost",
|
108
108
|
renderIcon: function renderIcon(props) {
|
109
109
|
var _headerProp$column;
|
110
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(
|
110
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(DatagridSlug, {
|
111
111
|
slug: headerProp === null || headerProp === void 0 || (_headerProp$column = headerProp.column) === null || _headerProp$column === void 0 ? void 0 : _headerProp$column.slug
|
112
112
|
}), icon(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column, props));
|
113
113
|
},
|
@@ -112,7 +112,7 @@ export namespace EmptyStateContent {
|
|
112
112
|
"aria-posinset"?: React.Validator<number | null | undefined> | undefined;
|
113
113
|
"aria-pressed"?: React.Validator<boolean | "true" | "false" | "mixed" | null | undefined> | undefined;
|
114
114
|
"aria-readonly"?: React.Validator<(boolean | "true" | "false") | null | undefined> | undefined;
|
115
|
-
"aria-relevant"?: React.Validator<"text" | "additions" | "additions removals" | "additions text" | "
|
115
|
+
"aria-relevant"?: React.Validator<"all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | null | undefined> | undefined;
|
116
116
|
"aria-required"?: React.Validator<(boolean | "true" | "false") | null | undefined> | undefined;
|
117
117
|
"aria-roledescription"?: React.Validator<string | null | undefined> | undefined;
|
118
118
|
"aria-rowcount"?: React.Validator<number | null | undefined> | undefined;
|
@@ -13,9 +13,10 @@ import { Grid, Column } from '@carbon/react';
|
|
13
13
|
import { ErrorGenericSVG } from './assets/ErrorGenericSVG.js';
|
14
14
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
15
15
|
import { pkg } from '../../settings.js';
|
16
|
+
import { Error404SVG } from './assets/Error404SVG.js';
|
17
|
+
import { Error403SVG } from './assets/Error403SVG.js';
|
16
18
|
|
17
|
-
var
|
18
|
-
var _excluded = ["children", "className", "description", "errorLabel", "title"];
|
19
|
+
var _excluded = ["children", "className", "description", "errorLabel", "kind", "title"];
|
19
20
|
|
20
21
|
// Carbon and package components we use.
|
21
22
|
/* TODO: @import(s) of carbon components and other package components. */
|
@@ -36,9 +37,9 @@ var componentName = 'FullPageError';
|
|
36
37
|
// or assumption when a prop is not supplied.
|
37
38
|
|
38
39
|
// Default values for props
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
var defaults = {
|
41
|
+
kind: 'custom'
|
42
|
+
};
|
42
43
|
|
43
44
|
/**
|
44
45
|
* TODO: A description of the component.
|
@@ -48,8 +49,33 @@ var FullPageError = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
48
49
|
className = _ref.className,
|
49
50
|
description = _ref.description,
|
50
51
|
errorLabel = _ref.errorLabel,
|
52
|
+
_ref$kind = _ref.kind,
|
53
|
+
kind = _ref$kind === void 0 ? defaults.kind : _ref$kind,
|
51
54
|
title = _ref.title,
|
52
55
|
rest = _objectWithoutProperties(_ref, _excluded);
|
56
|
+
var errorData = {
|
57
|
+
403: {
|
58
|
+
title: 'Access denied',
|
59
|
+
description: 'You are not authorized to access the requested page. Please verify that you are logged in to the hosting environment and your access permissions are correct.',
|
60
|
+
svg: /*#__PURE__*/React__default.createElement(Error403SVG, {
|
61
|
+
className: cx("".concat(blockClass, "__error-svg"), "".concat(blockClass, "__error-403"))
|
62
|
+
})
|
63
|
+
},
|
64
|
+
404: {
|
65
|
+
title: 'Page not found',
|
66
|
+
description: 'The page you requested has moved or is unavailable, or the specified URL is not valid. Please check the URL or search the site for the requested content.',
|
67
|
+
svg: /*#__PURE__*/React__default.createElement(Error404SVG, {
|
68
|
+
className: cx("".concat(blockClass, "__error-svg"), "".concat(blockClass, "__error-404"))
|
69
|
+
})
|
70
|
+
},
|
71
|
+
custom: {
|
72
|
+
title: title,
|
73
|
+
description: description,
|
74
|
+
svg: /*#__PURE__*/React__default.createElement(ErrorGenericSVG, {
|
75
|
+
className: cx("".concat(blockClass, "__error-svg"), "".concat(blockClass, "__error-custom"))
|
76
|
+
})
|
77
|
+
}
|
78
|
+
};
|
53
79
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
54
80
|
className: cx(blockClass,
|
55
81
|
// Apply the block class to the main HTML element
|
@@ -75,20 +101,15 @@ var FullPageError = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
75
101
|
className: "".concat(blockClass, "__error-title")
|
76
102
|
}, /*#__PURE__*/React__default.createElement("span", {
|
77
103
|
className: "".concat(blockClass, "__error-label")
|
78
|
-
}, "\u21B3 ",
|
104
|
+
}, "\u21B3 ", kind === 'custom' ? errorLabel : "Error ".concat(kind)), /*#__PURE__*/React__default.createElement("span", null, errorData[kind].title)), /*#__PURE__*/React__default.createElement("p", {
|
79
105
|
className: "".concat(blockClass, "__description")
|
80
|
-
}, description), children), /*#__PURE__*/React__default.createElement(Column, {
|
106
|
+
}, description || errorData[kind].description), children), /*#__PURE__*/React__default.createElement(Column, {
|
81
107
|
sm: 4,
|
82
108
|
md: 5,
|
83
109
|
lg: 10
|
84
110
|
}, /*#__PURE__*/React__default.createElement("div", {
|
85
|
-
|
86
|
-
|
87
|
-
height: '100%'
|
88
|
-
}
|
89
|
-
}, /*#__PURE__*/React__default.createElement(ErrorGenericSVG, {
|
90
|
-
className: "".concat(blockClass, "__error-svg")
|
91
|
-
}))))));
|
111
|
+
className: "".concat(blockClass, "__error-svg-container")
|
112
|
+
}, errorData[kind].svg)))));
|
92
113
|
});
|
93
114
|
|
94
115
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -111,13 +132,18 @@ FullPageError.propTypes = {
|
|
111
132
|
*/
|
112
133
|
className: PropTypes.string,
|
113
134
|
/**
|
114
|
-
* String that will provide the description for the error code
|
135
|
+
* String that will provide the description for the error code. <br/>
|
136
|
+
* This is optional for 403 and 404 kinds, and passing this would override their default descriptions.
|
115
137
|
*/
|
116
138
|
description: PropTypes.string.isRequired,
|
117
139
|
/**
|
118
140
|
* String that will describe the error that occurred
|
119
141
|
*/
|
120
142
|
errorLabel: PropTypes.string.isRequired,
|
143
|
+
/**
|
144
|
+
* The kind of error page to be displayed, default is custom
|
145
|
+
*/
|
146
|
+
kind: PropTypes.oneOf(['custom', '403', '404']),
|
121
147
|
/**
|
122
148
|
* This will be for the main title of the FullPageError component
|
123
149
|
*/
|