@carbon/ibm-products 2.41.1-canary.8 → 2.42.0
Sign up to get free protection for your applications and to get access to all the features.
- package/es/components/CreateFullPage/CreateFullPage.d.ts +2 -1
- package/es/components/CreateFullPage/CreateFullPageStep.d.ts +71 -2
- package/es/components/CreateFullPage/CreateFullPageStep.js +3 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +3 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +28 -28
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +7 -8
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +4 -3
- package/es/components/DataSpreadsheet/types/index.d.ts +1 -4
- package/es/components/Datagrid/Datagrid/Datagrid.d.ts +24 -2
- package/es/components/Datagrid/Datagrid/Datagrid.js +4 -4
- package/es/components/Datagrid/Datagrid/DatagridBody.d.ts +2 -1
- package/es/components/Datagrid/Datagrid/DatagridBody.js +1 -2
- package/es/components/Datagrid/Datagrid/DatagridContent.d.ts +16 -13
- package/es/components/Datagrid/Datagrid/DatagridContent.js +12 -13
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.d.ts +8 -1
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -4
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.d.ts +9 -1
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +10 -5
- package/es/components/Datagrid/Datagrid/DatagridHead.d.ts +8 -1
- package/es/components/Datagrid/Datagrid/DatagridHead.js +3 -5
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.d.ts +8 -1
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +41 -36
- package/es/components/Datagrid/Datagrid/DatagridRefBody.d.ts +2 -1
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -4
- package/es/components/Datagrid/Datagrid/DatagridRow.d.ts +8 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +12 -16
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.d.ts +9 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -8
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.d.ts +23 -27
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +9 -9
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.d.ts +2 -1
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +3 -3
- package/es/components/Datagrid/Datagrid/DatagridToolbar.d.ts +17 -10
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +15 -11
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +8 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +29 -17
- package/es/components/Datagrid/Datagrid/DraggableElement.d.ts +23 -21
- package/es/components/Datagrid/Datagrid/DraggableElement.js +2 -4
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +12 -2
- package/es/components/Datagrid/Datagrid/index.d.ts +7 -1
- package/es/components/Datagrid/types/index.d.ts +210 -0
- package/es/components/Datagrid/useColumnOrder.d.ts +1 -0
- package/es/components/Datagrid/useDatagrid.d.ts +1 -1
- package/es/components/Datagrid/useFocusRowExpander.js +1 -1
- package/es/components/Datagrid/useInfiniteScroll.d.ts +8 -1
- package/es/components/Datagrid/useInfiniteScroll.js +10 -9
- package/es/components/Datagrid/useSelectRows.js +5 -1
- package/es/components/EditUpdateCards/EditUpdateCards.d.ts +4 -3
- package/es/components/FilterSummary/FilterSummary.d.ts +21 -2
- package/es/components/FilterSummary/FilterSummary.js +10 -11
- package/es/components/Guidebanner/Guidebanner.js +7 -2
- package/es/components/ProductiveCard/ProductiveCard.d.ts +115 -2
- package/es/components/ProductiveCard/ProductiveCard.js +9 -9
- package/es/components/WebTerminal/WebTerminal.js +1 -1
- package/es/global/js/hooks/usePreviousValue.d.ts +1 -1
- package/es/global/js/hooks/usePreviousValue.js +3 -2
- package/es/global/js/hooks/useRetrieveStepData.d.ts +5 -5
- package/es/global/js/hooks/useRetrieveStepData.js +5 -5
- package/lib/components/CreateFullPage/CreateFullPage.d.ts +2 -1
- package/lib/components/CreateFullPage/CreateFullPageStep.d.ts +71 -2
- package/lib/components/CreateFullPage/CreateFullPageStep.js +3 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +3 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +28 -28
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +7 -8
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +4 -3
- package/lib/components/DataSpreadsheet/types/index.d.ts +1 -4
- package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +24 -2
- package/lib/components/Datagrid/Datagrid/Datagrid.js +4 -4
- package/lib/components/Datagrid/Datagrid/DatagridBody.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridBody.js +1 -2
- package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +16 -13
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +44 -45
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.d.ts +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -4
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.d.ts +9 -1
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -4
- package/lib/components/Datagrid/Datagrid/DatagridHead.d.ts +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridHead.js +3 -5
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.d.ts +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +40 -35
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -4
- package/lib/components/Datagrid/Datagrid/DatagridRow.d.ts +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +12 -16
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.d.ts +9 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -8
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.d.ts +23 -27
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +9 -9
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +3 -3
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.d.ts +17 -10
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +15 -11
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +29 -17
- package/lib/components/Datagrid/Datagrid/DraggableElement.d.ts +23 -21
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +2 -4
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +12 -2
- package/lib/components/Datagrid/Datagrid/index.d.ts +7 -1
- package/lib/components/Datagrid/types/index.d.ts +210 -0
- package/lib/components/Datagrid/useColumnOrder.d.ts +1 -0
- package/lib/components/Datagrid/useDatagrid.d.ts +1 -1
- package/lib/components/Datagrid/useFocusRowExpander.js +1 -1
- package/lib/components/Datagrid/useInfiniteScroll.d.ts +8 -1
- package/lib/components/Datagrid/useInfiniteScroll.js +10 -9
- package/lib/components/Datagrid/useSelectRows.js +5 -1
- package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +4 -3
- package/lib/components/FilterSummary/FilterSummary.d.ts +21 -2
- package/lib/components/FilterSummary/FilterSummary.js +10 -11
- package/lib/components/Guidebanner/Guidebanner.js +7 -2
- package/lib/components/ProductiveCard/ProductiveCard.d.ts +115 -2
- package/lib/components/ProductiveCard/ProductiveCard.js +9 -9
- package/lib/components/WebTerminal/WebTerminal.js +1 -1
- package/lib/global/js/hooks/usePreviousValue.d.ts +1 -1
- package/lib/global/js/hooks/usePreviousValue.js +3 -2
- package/lib/global/js/hooks/useRetrieveStepData.d.ts +5 -5
- package/lib/global/js/hooks/useRetrieveStepData.js +5 -5
- package/package.json +5 -4
- package/telemetry.yml +67 -6
@@ -14,6 +14,7 @@ import { Idea, CaretLeft, CaretRight, Close } from '@carbon/react/icons';
|
|
14
14
|
import { Button, IconButton } from '@carbon/react';
|
15
15
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
16
16
|
import { pkg } from '../../settings.js';
|
17
|
+
import uuidv4 from '../../global/js/utils/uuidv4.js';
|
17
18
|
import { Carousel } from '../Carousel/Carousel.js';
|
18
19
|
|
19
20
|
var _CaretLeft, _CaretRight, _Close;
|
@@ -76,8 +77,9 @@ var Guidebanner = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
76
77
|
return !prevState;
|
77
78
|
});
|
78
79
|
};
|
80
|
+
var carouselContentId = "".concat(uuidv4(), "--carousel-content-id");
|
79
81
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
80
|
-
"aria-
|
82
|
+
"aria-owns": !isCollapsed ? carouselContentId : undefined,
|
81
83
|
className: cx(blockClass, className, collapsible && "".concat(blockClass, "__collapsible"), isCollapsed && "".concat(blockClass, "__collapsible-collapsed"), withLeftGutter && "".concat(blockClass, "__with-left-gutter")),
|
82
84
|
ref: ref
|
83
85
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement(Idea, {
|
@@ -86,6 +88,7 @@ var Guidebanner = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
86
88
|
}), /*#__PURE__*/React__default.createElement("div", {
|
87
89
|
className: "".concat(blockClass, "__title")
|
88
90
|
}, title), /*#__PURE__*/React__default.createElement(Carousel, {
|
91
|
+
id: carouselContentId,
|
89
92
|
className: "".concat(blockClass, "__carousel")
|
90
93
|
// These colors are to match the Carousel's faded edges
|
91
94
|
// against the Guidebanner's gradient background.
|
@@ -108,7 +111,9 @@ var Guidebanner = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
108
111
|
size: "md",
|
109
112
|
className: "".concat(blockClass, "__toggle-button"),
|
110
113
|
onClick: handleClickToggle,
|
111
|
-
ref: toggleRef
|
114
|
+
ref: toggleRef,
|
115
|
+
"aria-controls": !isCollapsed ? carouselContentId : undefined,
|
116
|
+
"aria-expanded": !isCollapsed
|
112
117
|
}, isCollapsed ? expandButtonLabel : collapseButtonLabel), showNavigation && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
113
118
|
className: cx("".concat(blockClass, "__back-button"), [scrollPosition === 0 ? "".concat(blockClass, "__back-button--disabled") : null])
|
114
119
|
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
@@ -1,2 +1,115 @@
|
|
1
|
-
|
2
|
-
import
|
1
|
+
import React, { PropsWithChildren, ReactNode } from 'react';
|
2
|
+
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
3
|
+
type ActionIcon = {
|
4
|
+
id?: string;
|
5
|
+
icon?: CarbonIconType;
|
6
|
+
onKeyDown?(): void;
|
7
|
+
onClick?(): void;
|
8
|
+
iconDescription?: string;
|
9
|
+
href?: string;
|
10
|
+
};
|
11
|
+
type overflowAction = {
|
12
|
+
id?: string;
|
13
|
+
itemText?: string;
|
14
|
+
onClick?: () => void;
|
15
|
+
onKeydown?: () => void;
|
16
|
+
};
|
17
|
+
type PlacementType = 'top' | 'bottom';
|
18
|
+
type ClickZoneType = 'one' | 'two' | 'three';
|
19
|
+
interface ProductiveCardProps extends PropsWithChildren {
|
20
|
+
/**
|
21
|
+
* Icons that are displayed on card. Refer to design documentation for implementation guidelines. Note- href will supersede onClick
|
22
|
+
*/
|
23
|
+
actionIcons?: ActionIcon[];
|
24
|
+
/**
|
25
|
+
* Determines if the action icons are on the top or bottom of the card
|
26
|
+
*/
|
27
|
+
actionsPlacement?: PlacementType;
|
28
|
+
/**
|
29
|
+
* Content that shows in the body of the card
|
30
|
+
*/
|
31
|
+
/**
|
32
|
+
* Optional user provided class
|
33
|
+
*/
|
34
|
+
className?: string;
|
35
|
+
children: ReactNode;
|
36
|
+
/**
|
37
|
+
* Designates which zones of the card are clickable. Refer to design documentation for implementation guidelines
|
38
|
+
*/
|
39
|
+
clickZone?: ClickZoneType;
|
40
|
+
/**
|
41
|
+
* Optional header description
|
42
|
+
*/
|
43
|
+
description?: string | object | ReactNode;
|
44
|
+
/**
|
45
|
+
* Optional label for the top of the card
|
46
|
+
*/
|
47
|
+
label?: string | object | ReactNode;
|
48
|
+
/**
|
49
|
+
* Provides the callback for a clickable card
|
50
|
+
*/
|
51
|
+
onClick?: () => void;
|
52
|
+
/**
|
53
|
+
* Function that's called from the primary button or action icon
|
54
|
+
*/
|
55
|
+
onPrimaryButtonClick?: () => void;
|
56
|
+
/**
|
57
|
+
* Function that's called from the secondary button
|
58
|
+
*/
|
59
|
+
onSecondaryButtonClick?: () => void;
|
60
|
+
/**
|
61
|
+
* Use an overflow menu instead of action icons. Refer to design documentation for implementation guidelines
|
62
|
+
*/
|
63
|
+
overflowActions?: overflowAction[];
|
64
|
+
/**
|
65
|
+
* Aria label prop required for OverflowMenu
|
66
|
+
*/
|
67
|
+
overflowAriaLabel?: string;
|
68
|
+
/**
|
69
|
+
* Optionally specify an href for your Button to become an <a> element
|
70
|
+
*/
|
71
|
+
primaryButtonHref?: string;
|
72
|
+
/**
|
73
|
+
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
74
|
+
*/
|
75
|
+
primaryButtonIcon?: CarbonIconType;
|
76
|
+
/**
|
77
|
+
* Determines if the primary button is on the top or bottom of the card
|
78
|
+
*/
|
79
|
+
primaryButtonPlacement?: PlacementType;
|
80
|
+
/**
|
81
|
+
* The text that's displayed in the primary button
|
82
|
+
*/
|
83
|
+
primaryButtonText?: string;
|
84
|
+
/**
|
85
|
+
* Optionally specify an href for your Button to become an <a> element
|
86
|
+
*/
|
87
|
+
secondaryButtonHref?: string;
|
88
|
+
/**
|
89
|
+
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
90
|
+
*/
|
91
|
+
secondaryButtonIcon?: CarbonIconType;
|
92
|
+
/**
|
93
|
+
* Determines if the secondary button is on the top or bottom of the card
|
94
|
+
*/
|
95
|
+
secondaryButtonPlacement?: PlacementType;
|
96
|
+
/**
|
97
|
+
* The text that's displayed in the secondary button
|
98
|
+
*/
|
99
|
+
secondaryButtonText?: string;
|
100
|
+
/**
|
101
|
+
* **Experimental:** For all cases a `Slug` component can be provided.
|
102
|
+
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
103
|
+
*/
|
104
|
+
slug?: ReactNode | boolean;
|
105
|
+
/**
|
106
|
+
* Title that's displayed at the top of the card
|
107
|
+
*/
|
108
|
+
title?: string | object | ReactNode;
|
109
|
+
/**
|
110
|
+
* Determines title size
|
111
|
+
*/
|
112
|
+
titleSize?: 'default' | 'large';
|
113
|
+
}
|
114
|
+
export declare let ProductiveCard: React.ForwardRefExoticComponent<ProductiveCardProps & React.RefAttributes<HTMLDivElement>>;
|
115
|
+
export {};
|
@@ -15,22 +15,16 @@ import { Card } from '../Card/Card.js';
|
|
15
15
|
|
16
16
|
var _excluded = ["actionsPlacement"];
|
17
17
|
var componentName = 'ProductiveCard';
|
18
|
-
|
19
|
-
// Default values for props
|
20
|
-
var defaults = {
|
21
|
-
actionsPlacement: 'top'
|
22
|
-
};
|
23
18
|
var ProductiveCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
24
19
|
var _ref$actionsPlacement = _ref.actionsPlacement,
|
25
|
-
actionsPlacement = _ref$actionsPlacement === void 0 ?
|
20
|
+
actionsPlacement = _ref$actionsPlacement === void 0 ? 'top' : _ref$actionsPlacement,
|
26
21
|
rest = _objectWithoutProperties(_ref, _excluded);
|
27
22
|
var validProps = prepareProps(rest, ['media', 'mediaPosition', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind']);
|
28
23
|
return /*#__PURE__*/React__default.createElement(Card, _extends({}, _objectSpread2(_objectSpread2({}, validProps), {}, {
|
29
24
|
actionsPlacement: actionsPlacement,
|
30
|
-
ref: ref
|
31
|
-
}), {
|
25
|
+
ref: ref,
|
32
26
|
productive: true
|
33
|
-
}, getDevtoolsProps(componentName)));
|
27
|
+
}), getDevtoolsProps(componentName)));
|
34
28
|
});
|
35
29
|
|
36
30
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -39,6 +33,7 @@ ProductiveCard.propTypes = {
|
|
39
33
|
/**
|
40
34
|
* Icons that are displayed on card. Refer to design documentation for implementation guidelines
|
41
35
|
*/
|
36
|
+
/**@ts-ignore */
|
42
37
|
actionIcons: PropTypes.arrayOf(PropTypes.shape({
|
43
38
|
id: PropTypes.string,
|
44
39
|
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
@@ -86,6 +81,7 @@ ProductiveCard.propTypes = {
|
|
86
81
|
/**
|
87
82
|
* Use an overflow menu instead of action icons. Refer to design documentation for implementation guidelines
|
88
83
|
*/
|
84
|
+
/**@ts-ignore */
|
89
85
|
overflowActions: PropTypes.arrayOf(PropTypes.shape({
|
90
86
|
id: PropTypes.string,
|
91
87
|
itemText: PropTypes.string,
|
@@ -103,6 +99,7 @@ ProductiveCard.propTypes = {
|
|
103
99
|
/**
|
104
100
|
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
105
101
|
*/
|
102
|
+
/**@ts-ignore */
|
106
103
|
primaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
107
104
|
/**
|
108
105
|
* Determines if the primary button is on the top or bottom of the card
|
@@ -111,6 +108,7 @@ ProductiveCard.propTypes = {
|
|
111
108
|
/**
|
112
109
|
* The text that's displayed in the primary button
|
113
110
|
*/
|
111
|
+
/**@ts-ignore */
|
114
112
|
primaryButtonText: PropTypes.node,
|
115
113
|
/**
|
116
114
|
* Optionally specify an href for your Button to become an <a> element
|
@@ -119,6 +117,7 @@ ProductiveCard.propTypes = {
|
|
119
117
|
/**
|
120
118
|
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
121
119
|
*/
|
120
|
+
/**@ts-ignore */
|
122
121
|
secondaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
123
122
|
/**
|
124
123
|
* Determines if the secondary button is on the top or bottom of the card
|
@@ -127,6 +126,7 @@ ProductiveCard.propTypes = {
|
|
127
126
|
/**
|
128
127
|
* The text that's displayed in the secondary button
|
129
128
|
*/
|
129
|
+
/**@ts-ignore */
|
130
130
|
secondaryButtonText: PropTypes.node,
|
131
131
|
/**
|
132
132
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
@@ -60,7 +60,7 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
60
60
|
matches: true
|
61
61
|
},
|
62
62
|
prefersReducedMotion = _ref2.matches;
|
63
|
-
var webTerminalAnimationName = "".concat(open ? 'web-terminal-entrance' : 'web-terminal-exit', " ").concat(moderate02);
|
63
|
+
var webTerminalAnimationName = "".concat(open ? 'web-terminal-entrance' : 'web-terminal-exit forwards', " ").concat(moderate02);
|
64
64
|
var showDocumentationLinks = useMemo(function () {
|
65
65
|
return documentationLinks.length > 0;
|
66
66
|
}, [documentationLinks]);
|
@@ -1 +1 @@
|
|
1
|
-
export function usePreviousValue(value: object): undefined;
|
1
|
+
export function usePreviousValue(value: object): T | undefined;
|
@@ -8,8 +8,9 @@
|
|
8
8
|
import { useRef, useEffect } from 'react';
|
9
9
|
|
10
10
|
/**
|
11
|
-
* Returns the previous state
|
12
|
-
* @param {object} value
|
11
|
+
* Returns the previous state value included in the param
|
12
|
+
* @param {object} value - The current value of any type.
|
13
|
+
* @returns {T | undefined} - The previous value of the same type, or undefined if there is none
|
13
14
|
*/
|
14
15
|
var usePreviousValue = function usePreviousValue(value) {
|
15
16
|
var ref = useRef();
|
@@ -1,9 +1,9 @@
|
|
1
1
|
export function useRetrieveStepData({ stepsContext, stepNumber, introStep, invalid, shouldIncludeStep, secondaryLabel, title, }: {
|
2
2
|
stepsContext: object;
|
3
3
|
stepNumber: number;
|
4
|
-
introStep: boolean;
|
5
|
-
invalid: boolean;
|
6
|
-
shouldIncludeStep: boolean;
|
7
|
-
secondaryLabel: string;
|
8
|
-
title: React.ReactNode;
|
4
|
+
introStep: boolean | undefined;
|
5
|
+
invalid: boolean | undefined;
|
6
|
+
shouldIncludeStep: boolean | undefined;
|
7
|
+
secondaryLabel: string | undefined;
|
8
|
+
title: string | React.ReactNode;
|
9
9
|
}): void;
|
@@ -14,11 +14,11 @@ import { useEffect } from 'react';
|
|
14
14
|
* @param {object} useResetCreateComponent
|
15
15
|
* @param {object} useResetCreateComponent.stepsContext
|
16
16
|
* @param {number} useResetCreateComponent.stepNumber
|
17
|
-
* @param {boolean} useResetCreateComponent.introStep
|
18
|
-
* @param {boolean} useResetCreateComponent.invalid
|
19
|
-
* @param {boolean} useResetCreateComponent.shouldIncludeStep
|
20
|
-
* @param {string} useResetCreateComponent.secondaryLabel
|
21
|
-
* @param {React.ReactNode} useResetCreateComponent.title
|
17
|
+
* @param {boolean | undefined} useResetCreateComponent.introStep
|
18
|
+
* @param {boolean | undefined} useResetCreateComponent.invalid
|
19
|
+
* @param {boolean | undefined} useResetCreateComponent.shouldIncludeStep
|
20
|
+
* @param {string | undefined } useResetCreateComponent.secondaryLabel
|
21
|
+
* @param {string | React.ReactNode} useResetCreateComponent.title
|
22
22
|
*/
|
23
23
|
var useRetrieveStepData = function useRetrieveStepData(_ref) {
|
24
24
|
var stepsContext = _ref.stepsContext,
|
@@ -5,7 +5,8 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
import React, { ReactNode } from 'react';
|
8
|
-
|
8
|
+
import { StepsContextType } from '../CreateTearsheet/CreateTearsheet';
|
9
|
+
export declare const StepsContext: React.Context<StepsContextType | null>;
|
9
10
|
export declare const StepNumberContext: React.Context<number>;
|
10
11
|
interface HeaderBreadcrumbs {
|
11
12
|
/** breadcrumb item key */
|
@@ -1,2 +1,71 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2021, 2023
|
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
|
+
import React, { PropsWithChildren, ReactNode } from 'react';
|
8
|
+
interface CreateFullPageStepBaseProps extends PropsWithChildren {
|
9
|
+
/**
|
10
|
+
* Sets an optional className to be added to the CreateFullPage step
|
11
|
+
*/
|
12
|
+
className?: string;
|
13
|
+
/**
|
14
|
+
* Sets an optional description on the progress step component
|
15
|
+
*/
|
16
|
+
description?: ReactNode;
|
17
|
+
/**
|
18
|
+
* This will conditionally disable the submit button in the multi step CreateFullPage
|
19
|
+
*/
|
20
|
+
disableSubmit?: boolean;
|
21
|
+
/**
|
22
|
+
* This optional prop will render your form content inside of a fieldset html element
|
23
|
+
*/
|
24
|
+
hasFieldset: boolean;
|
25
|
+
/**
|
26
|
+
* This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
|
27
|
+
* steps. If this value is `true` then the step will be included in the list of visible steps, as well as being included in the ProgressIndicator step list
|
28
|
+
*/
|
29
|
+
includeStep?: boolean;
|
30
|
+
/**
|
31
|
+
* This prop can be used on the first step to mark it as an intro step, which will not render the progress indicator steps
|
32
|
+
*/
|
33
|
+
introStep?: boolean;
|
34
|
+
/**
|
35
|
+
* This optional prop will indicate an error icon on the progress indicator step item
|
36
|
+
*/
|
37
|
+
invalid?: boolean;
|
38
|
+
/**
|
39
|
+
* Optional function to be called on initial mount of a step.
|
40
|
+
* For example, this can be used to fetch data that is required on a particular step.
|
41
|
+
*/
|
42
|
+
onMount?: () => void;
|
43
|
+
/**
|
44
|
+
* Optional function to be called on a step change.
|
45
|
+
* For example, this can be used to validate input fields before proceeding to the next step.
|
46
|
+
* This function can _optionally_ return a promise that is either resolved or rejected and the CreateFullPage will handle the submitting state of the next button.
|
47
|
+
*/
|
48
|
+
onNext?: () => void | Promise<any>;
|
49
|
+
/**
|
50
|
+
* Sets the optional secondary label on the progress step component
|
51
|
+
*/
|
52
|
+
secondaryLabel?: string;
|
53
|
+
/**
|
54
|
+
* Sets an optional subtitle on the progress step component
|
55
|
+
*/
|
56
|
+
subtitle?: string;
|
57
|
+
/**
|
58
|
+
* Sets the title text for a create full page step
|
59
|
+
*/
|
60
|
+
title: ReactNode;
|
61
|
+
}
|
62
|
+
type CreateFullPageStepFieldsetProps = {
|
63
|
+
hasFieldset: false;
|
64
|
+
fieldsetLegendText?: string;
|
65
|
+
} | {
|
66
|
+
hasFieldset?: true;
|
67
|
+
fieldsetLegendText: string;
|
68
|
+
};
|
69
|
+
type CreateFullPageStepProps = CreateFullPageStepBaseProps & CreateFullPageStepFieldsetProps;
|
70
|
+
export declare let CreateFullPageStep: React.ForwardRefExoticComponent<CreateFullPageStepProps & React.RefAttributes<HTMLDivElement>>;
|
71
|
+
export {};
|
@@ -143,10 +143,12 @@ exports.CreateFullPageStep.propTypes = {
|
|
143
143
|
/**
|
144
144
|
* This will conditionally disable the submit button in the multi step CreateFullPage
|
145
145
|
*/
|
146
|
+
/**@ts-ignore */
|
146
147
|
disableSubmit: index["default"].bool,
|
147
148
|
/**
|
148
149
|
* This is the legend text that appears above a fieldset html element for accessibility purposes. It is required when the optional `hasFieldset` prop is provided to a FullPageStep.
|
149
150
|
*/
|
151
|
+
/**@ts-ignore */
|
150
152
|
fieldsetLegendText: index["default"].string.isRequired.if(function (_ref2) {
|
151
153
|
var hasFieldset = _ref2.hasFieldset;
|
152
154
|
return hasFieldset === true;
|
@@ -154,6 +156,7 @@ exports.CreateFullPageStep.propTypes = {
|
|
154
156
|
/**
|
155
157
|
* This optional prop will render your form content inside of a fieldset html element
|
156
158
|
*/
|
159
|
+
/**@ts-ignore */
|
157
160
|
hasFieldset: index["default"].bool,
|
158
161
|
/**
|
159
162
|
* This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
|
@@ -5,7 +5,8 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
import React from 'react';
|
8
|
-
import { Column
|
8
|
+
import { Column } from 'react-table';
|
9
|
+
import { Size, Theme } from './types';
|
9
10
|
interface DataSpreadsheetProps {
|
10
11
|
/**
|
11
12
|
* Specifies the cell height
|
@@ -18,7 +19,7 @@ interface DataSpreadsheetProps {
|
|
18
19
|
/**
|
19
20
|
* The data that will build the column headers
|
20
21
|
*/
|
21
|
-
columns?: readonly Column[];
|
22
|
+
columns?: readonly Column<object>[];
|
22
23
|
/**
|
23
24
|
* The spreadsheet data that will be rendered in the body of the spreadsheet component
|
24
25
|
*/
|
@@ -135,7 +135,7 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
135
135
|
}) || {};
|
136
136
|
var cellSizeValue = getCellSize.getCellSize(cellSize);
|
137
137
|
var cellEditorRef = React.useRef();
|
138
|
-
var _useState23 = React.useState(
|
138
|
+
var _useState23 = React.useState(),
|
139
139
|
_useState24 = _rollupPluginBabelHelpers.slicedToArray(_useState23, 2),
|
140
140
|
activeCellContent = _useState24[0],
|
141
141
|
setActiveCellContent = _useState24[1];
|
@@ -158,19 +158,19 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
158
158
|
var scrollBarSize = React.useMemo(function () {
|
159
159
|
return getScrollbarWidth.getScrollbarWidth();
|
160
160
|
}, []);
|
161
|
-
var
|
161
|
+
var _ref2 = reactTable.useTable({
|
162
162
|
columns: columns,
|
163
163
|
data: data,
|
164
164
|
defaultColumn: defaultColumn
|
165
165
|
}, reactTable.useBlockLayout, reactTable.useColumnOrder),
|
166
|
-
getTableProps =
|
167
|
-
getTableBodyProps =
|
168
|
-
headerGroups =
|
169
|
-
rows =
|
170
|
-
totalColumnsWidth =
|
171
|
-
prepareRow =
|
172
|
-
setColumnOrder =
|
173
|
-
visibleColumns =
|
166
|
+
getTableProps = _ref2.getTableProps,
|
167
|
+
getTableBodyProps = _ref2.getTableBodyProps,
|
168
|
+
headerGroups = _ref2.headerGroups,
|
169
|
+
rows = _ref2.rows,
|
170
|
+
totalColumnsWidth = _ref2.totalColumnsWidth,
|
171
|
+
prepareRow = _ref2.prepareRow,
|
172
|
+
setColumnOrder = _ref2.setColumnOrder,
|
173
|
+
visibleColumns = _ref2.visibleColumns;
|
174
174
|
|
175
175
|
// Update the spreadsheet data after editing a cell
|
176
176
|
var updateData = React.useCallback(function (rowIndex, columnId, newValue) {
|
@@ -205,7 +205,7 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
205
205
|
React.useEffect(function () {
|
206
206
|
var prevCoords = previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates;
|
207
207
|
if (((prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) || (prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column)) && isEditing) {
|
208
|
-
var cellProps = rows[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row].cells[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column];
|
208
|
+
var cellProps = rows[Number(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row)].cells[Number(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column)];
|
209
209
|
removeCellEditor();
|
210
210
|
updateData(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row, cellProps.column.id, undefined);
|
211
211
|
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
@@ -226,11 +226,11 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
226
226
|
}
|
227
227
|
}
|
228
228
|
}, [activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates, updateData, rows, isEditing, removeCellEditor, activeCellContent]);
|
229
|
-
var createActiveCell = React.useCallback(function (
|
230
|
-
var placementElement =
|
231
|
-
coords =
|
232
|
-
|
233
|
-
addToHeader =
|
229
|
+
var createActiveCell = React.useCallback(function (_ref3) {
|
230
|
+
var placementElement = _ref3.placementElement,
|
231
|
+
coords = _ref3.coords,
|
232
|
+
_ref3$addToHeader = _ref3.addToHeader,
|
233
|
+
addToHeader = _ref3$addToHeader === void 0 ? false : _ref3$addToHeader;
|
234
234
|
var activeCellFullData = typeof (coords === null || coords === void 0 ? void 0 : coords.column) === 'number' && typeof (coords === null || coords === void 0 ? void 0 : coords.row) === 'number' ? rows[coords === null || coords === void 0 ? void 0 : coords.row].cells[coords === null || coords === void 0 ? void 0 : coords.column] : null;
|
235
235
|
var activeCellValue = activeCellFullData ? Object.values(activeCellFullData.row.values)[coords === null || coords === void 0 ? void 0 : coords.column] : null;
|
236
236
|
createActiveCellFn.createActiveCellFn({
|
@@ -279,12 +279,12 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
279
279
|
}
|
280
280
|
return;
|
281
281
|
}, [activeCellCoordinates]);
|
282
|
-
var updateActiveCellCoordinates = React.useCallback(function (
|
283
|
-
var
|
284
|
-
coords =
|
285
|
-
updatedValue =
|
286
|
-
|
287
|
-
optOutOfSelectionAreaUpdate =
|
282
|
+
var updateActiveCellCoordinates = React.useCallback(function (_ref4) {
|
283
|
+
var _ref4$coords = _ref4.coords,
|
284
|
+
coords = _ref4$coords === void 0 ? _rollupPluginBabelHelpers.objectSpread2({}, activeCellCoordinates) : _ref4$coords,
|
285
|
+
updatedValue = _ref4.updatedValue,
|
286
|
+
_ref4$optOutOfSelecti = _ref4.optOutOfSelectionAreaUpdate,
|
287
|
+
optOutOfSelectionAreaUpdate = _ref4$optOutOfSelecti === void 0 ? false : _ref4$optOutOfSelecti;
|
288
288
|
var newActiveCell = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, coords), updatedValue);
|
289
289
|
setActiveCellCoordinates(newActiveCell);
|
290
290
|
// Only run if the active cell is _not_ a header cell. This will add a point1 object
|
@@ -300,8 +300,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
300
300
|
setCurrentMatcher(tempMatcher);
|
301
301
|
}
|
302
302
|
}, [activeCellCoordinates]);
|
303
|
-
var handleHomeEndKey = React.useCallback(function (
|
304
|
-
var type =
|
303
|
+
var handleHomeEndKey = React.useCallback(function (_ref5) {
|
304
|
+
var type = _ref5.type;
|
305
305
|
var coordinatesClone = _rollupPluginBabelHelpers.objectSpread2({}, activeCellCoordinates);
|
306
306
|
updateActiveCellCoordinates({
|
307
307
|
coords: coordinatesClone,
|
@@ -499,10 +499,10 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
499
499
|
}
|
500
500
|
}
|
501
501
|
};
|
502
|
-
var handleRowColumnHeaderClick = function handleRowColumnHeaderClick(
|
503
|
-
var isKeyboard =
|
504
|
-
|
505
|
-
index =
|
502
|
+
var handleRowColumnHeaderClick = function handleRowColumnHeaderClick(_ref6) {
|
503
|
+
var isKeyboard = _ref6.isKeyboard,
|
504
|
+
_ref6$index = _ref6.index,
|
505
|
+
index = _ref6$index === void 0 ? -1 : _ref6$index;
|
506
506
|
var handleHeaderCellProps = {
|
507
507
|
activeCellCoordinates: activeCellCoordinates,
|
508
508
|
rows: rows,
|
@@ -5,7 +5,8 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
import React, { Dispatch, SetStateAction, MutableRefObject } from 'react';
|
8
|
-
import { ActiveCellCoordinates,
|
8
|
+
import { ActiveCellCoordinates, SpreadsheetColumn } from './types';
|
9
|
+
import { Column, IdType, TableBodyPropGetter, TableBodyProps } from 'react-table';
|
9
10
|
interface DataSpreadsheetBodyProps {
|
10
11
|
/**
|
11
12
|
* Object containing the active cell coordinates
|
@@ -22,7 +23,7 @@ interface DataSpreadsheetBodyProps {
|
|
22
23
|
/**
|
23
24
|
* All of the spreadsheet columns
|
24
25
|
*/
|
25
|
-
columns?: readonly Column[];
|
26
|
+
columns?: readonly Column<object>[];
|
26
27
|
/**
|
27
28
|
* This represents the id of the current cell selection area
|
28
29
|
*/
|
@@ -30,7 +31,7 @@ interface DataSpreadsheetBodyProps {
|
|
30
31
|
/**
|
31
32
|
* Default spreadsheet sizing values
|
32
33
|
*/
|
33
|
-
defaultColumn?:
|
34
|
+
defaultColumn?: SpreadsheetColumn;
|
34
35
|
/**
|
35
36
|
* Sets the number of empty rows to be created when there is no data provided
|
36
37
|
*/
|
@@ -38,9 +39,7 @@ interface DataSpreadsheetBodyProps {
|
|
38
39
|
/**
|
39
40
|
* Function to set table body prop values
|
40
41
|
*/
|
41
|
-
getTableBodyProps?:
|
42
|
-
data: any;
|
43
|
-
};
|
42
|
+
getTableBodyProps: (propGetter?: TableBodyPropGetter<any>) => TableBodyProps;
|
44
43
|
/**
|
45
44
|
* Headers provided from useTable hook
|
46
45
|
*/
|
@@ -100,7 +99,7 @@ interface DataSpreadsheetBodyProps {
|
|
100
99
|
/**
|
101
100
|
* Setter fn for column ordering, provided from react-table
|
102
101
|
*/
|
103
|
-
setColumnOrder?: () => void;
|
102
|
+
setColumnOrder?: (updater: ((columnOrder: Array<IdType<any>>) => Array<IdType<any>>) | Array<IdType<any>>) => void;
|
104
103
|
/**
|
105
104
|
* Setter fn for containerHasFocus state value
|
106
105
|
*/
|
@@ -133,7 +132,7 @@ interface DataSpreadsheetBodyProps {
|
|
133
132
|
/**
|
134
133
|
* Prop from react-table used to reorder columns
|
135
134
|
*/
|
136
|
-
visibleColumns?: [];
|
135
|
+
visibleColumns?: Column<object>[];
|
137
136
|
}
|
138
137
|
export declare const DataSpreadsheetBody: React.ForwardRefExoticComponent<DataSpreadsheetBodyProps & React.RefAttributes<HTMLDivElement>>;
|
139
138
|
export {};
|
@@ -5,7 +5,8 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
import React, { Dispatch, SetStateAction } from 'react';
|
8
|
-
import { ActiveCellCoordinates,
|
8
|
+
import { ActiveCellCoordinates, ItemType, Size, SpreadsheetColumn } from './types';
|
9
|
+
import { Column } from 'react-table';
|
9
10
|
interface DataSpreadsheetHeaderProps {
|
10
11
|
/**
|
11
12
|
* Object containing the active cell coordinates
|
@@ -26,7 +27,7 @@ interface DataSpreadsheetHeaderProps {
|
|
26
27
|
/**
|
27
28
|
* Default spreadsheet sizing values
|
28
29
|
*/
|
29
|
-
defaultColumn?:
|
30
|
+
defaultColumn?: SpreadsheetColumn;
|
30
31
|
/**
|
31
32
|
* Whether or not a click/hold is active on a header cell
|
32
33
|
*/
|
@@ -83,7 +84,7 @@ interface DataSpreadsheetHeaderProps {
|
|
83
84
|
/**
|
84
85
|
* Array of visible columns provided by react-table useTable hook
|
85
86
|
*/
|
86
|
-
visibleColumns?: [];
|
87
|
+
visibleColumns?: Column<object>[];
|
87
88
|
}
|
88
89
|
export declare const DataSpreadsheetHeader: React.ForwardRefExoticComponent<DataSpreadsheetHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
89
90
|
export {};
|
@@ -1,9 +1,6 @@
|
|
1
1
|
export type Size = 'xs' | 'sm' | 'md' | 'lg';
|
2
2
|
export type Theme = 'light' | 'dark';
|
3
|
-
export interface
|
4
|
-
Header?: string;
|
5
|
-
accessor?: string | (() => void);
|
6
|
-
Cell?: () => void;
|
3
|
+
export interface SpreadsheetColumn {
|
7
4
|
rowHeight?: number;
|
8
5
|
rowHeaderWidth?: number;
|
9
6
|
width?: number;
|
@@ -1,5 +1,27 @@
|
|
1
1
|
/**
|
2
|
-
*
|
2
|
+
* Copyright IBM Corp. 2020, 2023
|
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.
|
3
6
|
*/
|
4
|
-
export let Datagrid: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
5
7
|
import React from 'react';
|
8
|
+
import { DataGridState } from '../types';
|
9
|
+
export interface DatagridProps {
|
10
|
+
/**
|
11
|
+
* Specify a label to be read by screen readers on the container node
|
12
|
+
* 'aria-label' of the TableToolbar component.
|
13
|
+
*/
|
14
|
+
ariaToolbarLabel?: string;
|
15
|
+
/**
|
16
|
+
* The data grid state, much of it being supplied by the useDatagrid hook
|
17
|
+
*/
|
18
|
+
datagridState: DataGridState;
|
19
|
+
/**
|
20
|
+
* Table title
|
21
|
+
*/
|
22
|
+
title?: string;
|
23
|
+
}
|
24
|
+
/**
|
25
|
+
* The `Datagrid` component is an extension of Carbon's DataTable component. At the most basic level, the `Datagrid` component takes in columns and rows and renders a data table. There is a set of data table extensions which this component provides support for, these can be found [here](https://pages.github.ibm.com/cdai-design/pal/components/data-table/overview/). This component is data driven and allows you to choose what pieces will be included based on the hooks/plugins that are provided.
|
26
|
+
*/
|
27
|
+
export declare let Datagrid: React.ForwardRefExoticComponent<DatagridProps & React.RefAttributes<HTMLDivElement>>;
|