@carbon/ibm-products 1.58.0 → 1.59.0
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/css/index-full-carbon.css +56 -44
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +10 -0
- 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 +54 -44
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/css/index.min.css.map +1 -1
- package/es/components/Checklist/Checklist.js +3 -3
- package/es/components/Checklist/ChecklistChart.js +1 -7
- package/es/components/CreateFullPage/CreateFullPage.js +25 -3
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +34 -18
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +2 -37
- package/es/components/InlineTip/InlineTip.js +5 -1
- package/es/components/InlineTip/InlineTipButton.js +1 -8
- package/es/components/InlineTip/InlineTipLink.js +1 -8
- package/es/global/js/utils/test-helper.js +2 -2
- package/lib/components/Checklist/Checklist.js +3 -3
- package/lib/components/Checklist/ChecklistChart.js +1 -7
- package/lib/components/CreateFullPage/CreateFullPage.js +24 -2
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +35 -19
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +2 -40
- package/lib/components/InlineTip/InlineTip.js +4 -0
- package/lib/components/InlineTip/InlineTipButton.js +2 -9
- package/lib/components/InlineTip/InlineTipLink.js +2 -9
- package/lib/global/js/utils/test-helper.js +2 -2
- package/package.json +10 -10
- package/scss/components/ComboButton/_combo-button.scss +2 -1
- package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +6 -1
- package/scss/components/Toolbar/_toolbar.scss +6 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "
|
|
3
|
+
var _excluded = ["className", "value", "theme"];
|
|
4
4
|
/**
|
|
5
5
|
* Copyright IBM Corp. 2023, 2023
|
|
6
6
|
*
|
|
@@ -53,7 +53,6 @@ var defaults = {
|
|
|
53
53
|
*/
|
|
54
54
|
export var ChecklistChart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
55
55
|
var className = _ref.className,
|
|
56
|
-
ariaLabelledById = _ref.ariaLabelledById,
|
|
57
56
|
value = _ref.value,
|
|
58
57
|
_ref$theme = _ref.theme,
|
|
59
58
|
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
|
@@ -63,7 +62,6 @@ export var ChecklistChart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
63
62
|
var progressColor = theme === 'light' ? '#6929c4' : '#A56EFF'; // $purple-70, $purple-50
|
|
64
63
|
|
|
65
64
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
66
|
-
"aria-labelledby": ariaLabelledById,
|
|
67
65
|
className: cx(blockClass, className),
|
|
68
66
|
style: {
|
|
69
67
|
backgroundImage: "conic-gradient(".concat(progressColor, " ").concat(numDegrees, "deg, ").concat(circleColor, " ").concat(numDegrees, "deg 360deg)"),
|
|
@@ -85,10 +83,6 @@ export var ChecklistChart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
85
83
|
// in alphabetical order (for consistency).
|
|
86
84
|
// See https://www.npmjs.com/package/prop-types#usage.
|
|
87
85
|
ChecklistChart.propTypes = {
|
|
88
|
-
/**
|
|
89
|
-
* Id of the parent's aria-label for accessibility.
|
|
90
|
-
*/
|
|
91
|
-
ariaLabelledById: PropTypes.string.isRequired,
|
|
92
86
|
/**
|
|
93
87
|
* Optional class name for this component.
|
|
94
88
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "modalDangerButtonText", "modalDescription", "modalSecondaryButtonText", "modalTitle", "nextButtonText", "onClose", "onRequestSubmit", "firstFocusElement", "submitButtonText", "title"];
|
|
4
|
+
var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "initialStep", "modalDangerButtonText", "modalDescription", "modalSecondaryButtonText", "modalTitle", "nextButtonText", "onClose", "onRequestSubmit", "firstFocusElement", "submitButtonText", "title"];
|
|
5
5
|
/**
|
|
6
6
|
* Copyright IBM Corp. 2021, 2023
|
|
7
7
|
*
|
|
@@ -22,8 +22,9 @@ import { pkg } from '../../settings';
|
|
|
22
22
|
import { Grid, ModalFooter, ComposedModal, ModalHeader, ModalBody, Button, Form } from 'carbon-components-react';
|
|
23
23
|
import { CreateInfluencer } from '../CreateInfluencer';
|
|
24
24
|
import { ActionSet } from '../ActionSet';
|
|
25
|
-
import { usePreviousValue, useValidCreateStepCount, useCreateComponentFocus, useCreateComponentStepChange } from '../../global/js/hooks';
|
|
25
|
+
import { usePreviousValue, useValidCreateStepCount, useResetCreateComponent, useCreateComponentFocus, useCreateComponentStepChange } from '../../global/js/hooks';
|
|
26
26
|
import { lastIndexInArray } from '../../global/js/utils/lastIndexInArray';
|
|
27
|
+
import { getNumberOfHiddenSteps } from '../../global/js/utils/getNumberOfHiddenSteps';
|
|
27
28
|
var blockClass = "".concat(pkg.prefix, "--create-full-page");
|
|
28
29
|
var componentName = 'CreateFullPage';
|
|
29
30
|
|
|
@@ -40,6 +41,7 @@ export var CreateFullPage = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
40
41
|
cancelButtonText = _ref.cancelButtonText,
|
|
41
42
|
children = _ref.children,
|
|
42
43
|
className = _ref.className,
|
|
44
|
+
initialStep = _ref.initialStep,
|
|
43
45
|
modalDangerButtonText = _ref.modalDangerButtonText,
|
|
44
46
|
modalDescription = _ref.modalDescription,
|
|
45
47
|
modalSecondaryButtonText = _ref.modalSecondaryButtonText,
|
|
@@ -110,7 +112,11 @@ export var CreateFullPage = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
110
112
|
if (lastItem !== lastIncludedStep) {
|
|
111
113
|
setLastIncludedStep(lastItem);
|
|
112
114
|
}
|
|
113
|
-
|
|
115
|
+
if (open && initialStep) {
|
|
116
|
+
var numberOfHiddenSteps = getNumberOfHiddenSteps(stepData, initialStep);
|
|
117
|
+
setCurrentStep(Number(initialStep + numberOfHiddenSteps));
|
|
118
|
+
}
|
|
119
|
+
}, [stepData, firstIncludedStep, lastIncludedStep, initialStep]);
|
|
114
120
|
useCreateComponentFocus({
|
|
115
121
|
previousState: previousState,
|
|
116
122
|
currentStep: currentStep,
|
|
@@ -119,6 +125,16 @@ export var CreateFullPage = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
119
125
|
firstFocusElement: firstFocusElement
|
|
120
126
|
});
|
|
121
127
|
useValidCreateStepCount(stepData.length, componentName);
|
|
128
|
+
useResetCreateComponent({
|
|
129
|
+
firstIncludedStep: firstIncludedStep,
|
|
130
|
+
previousState: previousState,
|
|
131
|
+
open: open,
|
|
132
|
+
setCurrentStep: setCurrentStep,
|
|
133
|
+
stepData: stepData,
|
|
134
|
+
initialStep: initialStep,
|
|
135
|
+
totalSteps: stepData === null || stepData === void 0 ? void 0 : stepData.length,
|
|
136
|
+
componentName: componentName
|
|
137
|
+
});
|
|
122
138
|
useCreateComponentStepChange({
|
|
123
139
|
firstIncludedStep: firstIncludedStep,
|
|
124
140
|
lastIncludedStep: lastIncludedStep,
|
|
@@ -242,6 +258,12 @@ CreateFullPage.propTypes = {
|
|
|
242
258
|
* Specifies elements to focus on first on render.
|
|
243
259
|
*/
|
|
244
260
|
firstFocusElement: PropTypes.string,
|
|
261
|
+
/**
|
|
262
|
+
* This can be used to open the component to a step other than the first step.
|
|
263
|
+
* For example, a create flow was previously in progress, data was saved, and
|
|
264
|
+
* is now being completed.
|
|
265
|
+
*/
|
|
266
|
+
initialStep: PropTypes.number,
|
|
245
267
|
/**
|
|
246
268
|
* The primary 'danger' button text in the modal
|
|
247
269
|
*/
|
|
@@ -10,42 +10,58 @@ var _excluded = ["legendText"];
|
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import React, { useRef, useState } from 'react';
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
15
|
import { Settings16 } from '@carbon/icons-react';
|
|
16
16
|
import { Button } from 'carbon-components-react';
|
|
17
17
|
import cx from 'classnames';
|
|
18
18
|
import RowSizeRadioGroup from './RowSizeRadioGroup';
|
|
19
19
|
import { pkg } from '../../../../../settings';
|
|
20
|
-
var blockClass = "".concat(pkg.prefix, "--
|
|
20
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid__row-size");
|
|
21
21
|
var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
22
22
|
var _ref$legendText = _ref.legendText,
|
|
23
23
|
legendText = _ref$legendText === void 0 ? 'Row height' : _ref$legendText,
|
|
24
24
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
-
var buttonRef =
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
isOpen =
|
|
29
|
-
setIsOpen =
|
|
30
|
-
|
|
25
|
+
var buttonRef = useRef(null);
|
|
26
|
+
var _useState = useState(false),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
isOpen = _useState2[0],
|
|
29
|
+
setIsOpen = _useState2[1];
|
|
30
|
+
var onCloseHandler = function onCloseHandler() {
|
|
31
|
+
setIsOpen(false);
|
|
32
|
+
};
|
|
33
|
+
var onBlurHandler = function onBlurHandler(e) {
|
|
34
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
35
|
+
onCloseHandler();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var onClickHandler = function onClickHandler() {
|
|
39
|
+
setIsOpen(!isOpen);
|
|
40
|
+
};
|
|
41
|
+
var onKeyHandler = function onKeyHandler(e) {
|
|
42
|
+
if (e.key === 'Escape') {
|
|
43
|
+
onCloseHandler();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
tabIndex: -1,
|
|
48
|
+
className: blockClass,
|
|
49
|
+
role: "presentation",
|
|
50
|
+
onBlur: onBlurHandler,
|
|
51
|
+
onKeyDown: onKeyHandler
|
|
52
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
53
|
+
tabIndex: 0,
|
|
31
54
|
hasIconOnly: true,
|
|
32
55
|
ref: buttonRef,
|
|
33
56
|
kind: "ghost",
|
|
34
57
|
tooltipPosition: "bottom",
|
|
35
58
|
renderIcon: Settings16,
|
|
36
|
-
onClick: function onClick() {
|
|
37
|
-
return setIsOpen(function (prevOpen) {
|
|
38
|
-
return !prevOpen;
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
59
|
iconDescription: legendText,
|
|
42
|
-
className: cx("".concat(blockClass, "
|
|
60
|
+
className: cx("".concat(blockClass, "-button"), _defineProperty({}, "".concat(blockClass, "-button--open"), isOpen)),
|
|
61
|
+
onClick: onClickHandler
|
|
43
62
|
}), isOpen && /*#__PURE__*/React.createElement(RowSizeRadioGroup, _extends({}, props, {
|
|
44
63
|
legendText: legendText,
|
|
45
|
-
buttonRef: buttonRef
|
|
46
|
-
hideRadioGroup: function hideRadioGroup() {
|
|
47
|
-
setIsOpen(false);
|
|
48
|
-
}
|
|
64
|
+
buttonRef: buttonRef
|
|
49
65
|
})));
|
|
50
66
|
};
|
|
51
67
|
RowSizeDropdown.propTypes = {
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import React
|
|
11
|
+
import React from 'react';
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
|
-
import { rem } from '@carbon/layout';
|
|
14
13
|
import { RadioButtonGroup, RadioButton } from 'carbon-components-react';
|
|
15
14
|
import isArray from 'lodash/isArray';
|
|
16
15
|
import { pkg } from '../../../../../settings';
|
|
@@ -19,9 +18,7 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
|
|
19
18
|
var rowSizes = _ref.rowSizes,
|
|
20
19
|
selectedOption = _ref.selectedOption,
|
|
21
20
|
datagridName = _ref.datagridName,
|
|
22
|
-
buttonRef = _ref.buttonRef,
|
|
23
21
|
onChange = _ref.onChange,
|
|
24
|
-
hideRadioGroup = _ref.hideRadioGroup,
|
|
25
22
|
legendText = _ref.legendText,
|
|
26
23
|
_ref$rowSizeLabels = _ref.rowSizeLabels,
|
|
27
24
|
rowSizeLabels = _ref$rowSizeLabels === void 0 ? {
|
|
@@ -31,25 +28,9 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
|
|
31
28
|
sm: 'Small',
|
|
32
29
|
xs: 'Extra small'
|
|
33
30
|
} : _ref$rowSizeLabels;
|
|
34
|
-
var _getDropdownPosition = getDropdownPosition(buttonRef.current),
|
|
35
|
-
top = _getDropdownPosition.top,
|
|
36
|
-
right = _getDropdownPosition.right;
|
|
37
|
-
useEffect(function () {
|
|
38
|
-
window.addEventListener('click', hideRadioGroup);
|
|
39
|
-
return function () {
|
|
40
|
-
window.removeEventListener('click', hideRadioGroup);
|
|
41
|
-
};
|
|
42
|
-
}, [hideRadioGroup]);
|
|
43
31
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
32
|
className: "".concat(blockClass, "__row-size-dropdown"),
|
|
45
|
-
|
|
46
|
-
top: rem(top),
|
|
47
|
-
right: rem(right)
|
|
48
|
-
},
|
|
49
|
-
role: "presentation",
|
|
50
|
-
onClick: function onClick(e) {
|
|
51
|
-
e.stopPropagation();
|
|
52
|
-
}
|
|
33
|
+
role: "presentation"
|
|
53
34
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
54
35
|
legendText: legendText,
|
|
55
36
|
name: "row-height-group",
|
|
@@ -83,21 +64,6 @@ var getBackwardCompatibleRowSize = function getBackwardCompatibleRowSize(rowSize
|
|
|
83
64
|
|
|
84
65
|
return rowSizeMap[rowSize] || rowSize;
|
|
85
66
|
};
|
|
86
|
-
var getDropdownPosition = function getDropdownPosition(buttonEle) {
|
|
87
|
-
var parent = buttonEle.parentElement;
|
|
88
|
-
if (parent instanceof HTMLElement) {
|
|
89
|
-
var top = buttonEle.offsetTop + buttonEle.offsetHeight;
|
|
90
|
-
var right = parent.offsetWidth - (buttonEle.offsetLeft + buttonEle.offsetWidth);
|
|
91
|
-
return {
|
|
92
|
-
top: top,
|
|
93
|
-
right: right
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
top: 0,
|
|
98
|
-
right: 0
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
67
|
RowSizeRadioGroup.defaultProps = {
|
|
102
68
|
rowSizes: [{
|
|
103
69
|
value: 'xl' // 64
|
|
@@ -116,7 +82,6 @@ RowSizeRadioGroup.defaultProps = {
|
|
|
116
82
|
RowSizeRadioGroup.propTypes = {
|
|
117
83
|
buttonRef: PropTypes.any.isRequired,
|
|
118
84
|
datagridName: PropTypes.string,
|
|
119
|
-
hideRadioGroup: PropTypes.func.isRequired,
|
|
120
85
|
legendText: PropTypes.string,
|
|
121
86
|
onChange: PropTypes.func.isRequired,
|
|
122
87
|
rowSizeLabels: PropTypes.object,
|
|
@@ -10,7 +10,7 @@ var _excluded = ["children", "className", "closeIconDescription", "collapsible",
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
// Import portions of React that are needed.
|
|
13
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
14
14
|
|
|
15
15
|
// Other standard imports.
|
|
16
16
|
import { Close16, Crossroads16, Idea20 } from '@carbon/icons-react';
|
|
@@ -20,6 +20,7 @@ import cx from 'classnames';
|
|
|
20
20
|
import { getComponentText } from './utils';
|
|
21
21
|
import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia';
|
|
22
22
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
|
23
|
+
import uuidv4 from '../../global/js/utils/uuidv4';
|
|
23
24
|
import { pkg /*, carbon */ } from '../../settings';
|
|
24
25
|
|
|
25
26
|
// Carbon and package components we use.
|
|
@@ -79,6 +80,7 @@ export var InlineTip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
79
80
|
_useState2 = _slicedToArray(_useState, 2),
|
|
80
81
|
isCollapsed = _useState2[0],
|
|
81
82
|
setIsCollapsed = _useState2[1];
|
|
83
|
+
var labelId = useRef(uuidv4()).current;
|
|
82
84
|
var previewText = useMemo(function () {
|
|
83
85
|
return getComponentText(React.Children.toArray(children));
|
|
84
86
|
}, [children]);
|
|
@@ -94,6 +96,7 @@ export var InlineTip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
94
96
|
setIsCollapsed(collapsible);
|
|
95
97
|
}, [collapsible]);
|
|
96
98
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
99
|
+
"aria-labelledby": labelId,
|
|
97
100
|
className: cx(blockClass,
|
|
98
101
|
// Apply the block class to the main HTML element
|
|
99
102
|
className,
|
|
@@ -115,6 +118,7 @@ export var InlineTip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
115
118
|
}, /*#__PURE__*/React.createElement(Idea20, null)), /*#__PURE__*/React.createElement("div", {
|
|
116
119
|
className: "".concat(blockClass, "__content")
|
|
117
120
|
}, /*#__PURE__*/React.createElement("h6", {
|
|
121
|
+
id: labelId,
|
|
118
122
|
className: "".concat(blockClass, "__title")
|
|
119
123
|
}, title), /*#__PURE__*/React.createElement("section", {
|
|
120
124
|
className: "".concat(blockClass, "__body")
|
|
@@ -42,7 +42,7 @@ var componentName = 'InlineTipButton';
|
|
|
42
42
|
// };
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* TODO: A
|
|
45
|
+
* TODO: A standard Carbon button, styled specifically for use inside InlineTip.
|
|
46
46
|
*/
|
|
47
47
|
export var InlineTipButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
48
48
|
var children = _ref.children,
|
|
@@ -65,13 +65,6 @@ export var InlineTipButton = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
65
65
|
}), children);
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
// Return a placeholder if not released and not enabled by feature flag
|
|
69
|
-
InlineTipButton = pkg.checkComponentEnabled(InlineTipButton, componentName);
|
|
70
|
-
|
|
71
|
-
// The display name of the component, used by React. Note that displayName
|
|
72
|
-
// is used in preference to relying on function.name.
|
|
73
|
-
InlineTipButton.displayName = componentName;
|
|
74
|
-
|
|
75
68
|
// The types and DocGen commentary for the component props,
|
|
76
69
|
// in alphabetical order (for consistency).
|
|
77
70
|
// See https://www.npmjs.com/package/prop-types#usage.
|
|
@@ -43,7 +43,7 @@ var componentName = 'InlineTipLink';
|
|
|
43
43
|
// };
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* TODO: A
|
|
46
|
+
* TODO: A standard Carbon link, styled specifically for use inside InlineTip.
|
|
47
47
|
*/
|
|
48
48
|
export var InlineTipLink = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
49
49
|
var children = _ref.children,
|
|
@@ -65,13 +65,6 @@ export var InlineTipLink = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
65
65
|
}), children);
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
// Return a placeholder if not released and not enabled by feature flag
|
|
69
|
-
InlineTipLink = pkg.checkComponentEnabled(InlineTipLink, componentName);
|
|
70
|
-
|
|
71
|
-
// The display name of the component, used by React. Note that displayName
|
|
72
|
-
// is used in preference to relying on function.name.
|
|
73
|
-
InlineTipLink.displayName = componentName;
|
|
74
|
-
|
|
75
68
|
// The types and DocGen commentary for the component props,
|
|
76
69
|
// in alphabetical order (for consistency).
|
|
77
70
|
// See https://www.npmjs.com/package/prop-types#usage.
|
|
@@ -109,7 +109,7 @@ var makeMatcherArray = function makeMatcherArray(args) {
|
|
|
109
109
|
* A helper function to enable a test to expect a single call to
|
|
110
110
|
* console.warn, for example when intentionally using a deprecated prop
|
|
111
111
|
* or supplying invalid parameters for the purposes of the test.
|
|
112
|
-
* @param {string|regex|Function|[]} message the expected parameters for the call to
|
|
112
|
+
* @param {string | regex | Function | []} message the expected parameters for the call to
|
|
113
113
|
* console.warn, which must be called exactly once. A single string or regex or an
|
|
114
114
|
* expect matcher can be used to match a single-argument call to console.warn (most common),
|
|
115
115
|
* while an array of strings and/or regex and/or expect matchers can be used to match a
|
|
@@ -220,7 +220,7 @@ export var expectLogging = function expectLogging(_ref2, test) {
|
|
|
220
220
|
* A helper function to enable a test to expect a single call to
|
|
221
221
|
* console.error, for example when intentionally omitting a required prop
|
|
222
222
|
* or supplying an invalid prop type or value for the purposes of the test.
|
|
223
|
-
* @param {string|regex|Function|[]} message the expected parameters for the call to
|
|
223
|
+
* @param {string | regex | Function | []} message the expected parameters for the call to
|
|
224
224
|
* console.error, which must be called exactly once. A single string or regex or an
|
|
225
225
|
* expect matcher can be used to match a single-argument call to console.error (most common),
|
|
226
226
|
* while an array of strings and/or regex and/or expect matchers can be used to match a
|
|
@@ -118,9 +118,9 @@ var Checklist = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
118
118
|
}, (0, _devtools.getDevtoolsProps)(componentName)), (title || chartLabelAndValue) && /*#__PURE__*/_react.default.createElement("header", {
|
|
119
119
|
className: "".concat(blockClass, "__header")
|
|
120
120
|
}, chartLabelAndValue && /*#__PURE__*/_react.default.createElement(_ChecklistChart.ChecklistChart, {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
"aria-labelledby": chartLabelId,
|
|
122
|
+
theme: theme,
|
|
123
|
+
value: chartValue
|
|
124
124
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
125
125
|
className: "".concat(blockClass, "__titles")
|
|
126
126
|
}, title && /*#__PURE__*/_react.default.createElement("h2", {
|
|
@@ -13,7 +13,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
var _devtools = require("../../global/js/utils/devtools");
|
|
14
14
|
var _settings = require("../../settings");
|
|
15
15
|
var _clamp = _interopRequireDefault(require("lodash/clamp"));
|
|
16
|
-
var _excluded = ["className", "
|
|
16
|
+
var _excluded = ["className", "value", "theme"];
|
|
17
17
|
// Carbon and package components we use.
|
|
18
18
|
/* TODO: @import(s) of carbon components and other package components. */
|
|
19
19
|
|
|
@@ -42,7 +42,6 @@ var defaults = {
|
|
|
42
42
|
*/
|
|
43
43
|
var ChecklistChart = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
44
44
|
var className = _ref.className,
|
|
45
|
-
ariaLabelledById = _ref.ariaLabelledById,
|
|
46
45
|
value = _ref.value,
|
|
47
46
|
_ref$theme = _ref.theme,
|
|
48
47
|
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
|
@@ -52,7 +51,6 @@ var ChecklistChart = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
|
52
51
|
var progressColor = theme === 'light' ? '#6929c4' : '#A56EFF'; // $purple-70, $purple-50
|
|
53
52
|
|
|
54
53
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
|
55
|
-
"aria-labelledby": ariaLabelledById,
|
|
56
54
|
className: (0, _classnames.default)(blockClass, className),
|
|
57
55
|
style: {
|
|
58
56
|
backgroundImage: "conic-gradient(".concat(progressColor, " ").concat(numDegrees, "deg, ").concat(circleColor, " ").concat(numDegrees, "deg 360deg)"),
|
|
@@ -75,10 +73,6 @@ var ChecklistChart = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
|
75
73
|
// See https://www.npmjs.com/package/prop-types#usage.
|
|
76
74
|
exports.ChecklistChart = ChecklistChart;
|
|
77
75
|
ChecklistChart.propTypes = {
|
|
78
|
-
/**
|
|
79
|
-
* Id of the parent's aria-label for accessibility.
|
|
80
|
-
*/
|
|
81
|
-
ariaLabelledById: _propTypes.default.string.isRequired,
|
|
82
76
|
/**
|
|
83
77
|
* Optional class name for this component.
|
|
84
78
|
*/
|
|
@@ -19,7 +19,8 @@ var _CreateInfluencer = require("../CreateInfluencer");
|
|
|
19
19
|
var _ActionSet = require("../ActionSet");
|
|
20
20
|
var _hooks = require("../../global/js/hooks");
|
|
21
21
|
var _lastIndexInArray = require("../../global/js/utils/lastIndexInArray");
|
|
22
|
-
var
|
|
22
|
+
var _getNumberOfHiddenSteps = require("../../global/js/utils/getNumberOfHiddenSteps");
|
|
23
|
+
var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "initialStep", "modalDangerButtonText", "modalDescription", "modalSecondaryButtonText", "modalTitle", "nextButtonText", "onClose", "onRequestSubmit", "firstFocusElement", "submitButtonText", "title"];
|
|
23
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
26
|
var blockClass = "".concat(_settings.pkg.prefix, "--create-full-page");
|
|
@@ -40,6 +41,7 @@ var CreateFullPage = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
|
40
41
|
cancelButtonText = _ref.cancelButtonText,
|
|
41
42
|
children = _ref.children,
|
|
42
43
|
className = _ref.className,
|
|
44
|
+
initialStep = _ref.initialStep,
|
|
43
45
|
modalDangerButtonText = _ref.modalDangerButtonText,
|
|
44
46
|
modalDescription = _ref.modalDescription,
|
|
45
47
|
modalSecondaryButtonText = _ref.modalSecondaryButtonText,
|
|
@@ -110,7 +112,11 @@ var CreateFullPage = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
|
110
112
|
if (lastItem !== lastIncludedStep) {
|
|
111
113
|
setLastIncludedStep(lastItem);
|
|
112
114
|
}
|
|
113
|
-
|
|
115
|
+
if (open && initialStep) {
|
|
116
|
+
var numberOfHiddenSteps = (0, _getNumberOfHiddenSteps.getNumberOfHiddenSteps)(stepData, initialStep);
|
|
117
|
+
setCurrentStep(Number(initialStep + numberOfHiddenSteps));
|
|
118
|
+
}
|
|
119
|
+
}, [stepData, firstIncludedStep, lastIncludedStep, initialStep]);
|
|
114
120
|
(0, _hooks.useCreateComponentFocus)({
|
|
115
121
|
previousState: previousState,
|
|
116
122
|
currentStep: currentStep,
|
|
@@ -119,6 +125,16 @@ var CreateFullPage = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
|
119
125
|
firstFocusElement: firstFocusElement
|
|
120
126
|
});
|
|
121
127
|
(0, _hooks.useValidCreateStepCount)(stepData.length, componentName);
|
|
128
|
+
(0, _hooks.useResetCreateComponent)({
|
|
129
|
+
firstIncludedStep: firstIncludedStep,
|
|
130
|
+
previousState: previousState,
|
|
131
|
+
open: open,
|
|
132
|
+
setCurrentStep: setCurrentStep,
|
|
133
|
+
stepData: stepData,
|
|
134
|
+
initialStep: initialStep,
|
|
135
|
+
totalSteps: stepData === null || stepData === void 0 ? void 0 : stepData.length,
|
|
136
|
+
componentName: componentName
|
|
137
|
+
});
|
|
122
138
|
(0, _hooks.useCreateComponentStepChange)({
|
|
123
139
|
firstIncludedStep: firstIncludedStep,
|
|
124
140
|
lastIncludedStep: lastIncludedStep,
|
|
@@ -243,6 +259,12 @@ CreateFullPage.propTypes = {
|
|
|
243
259
|
* Specifies elements to focus on first on render.
|
|
244
260
|
*/
|
|
245
261
|
firstFocusElement: _propTypes.default.string,
|
|
262
|
+
/**
|
|
263
|
+
* This can be used to open the component to a step other than the first step.
|
|
264
|
+
* For example, a create flow was previously in progress, data was saved, and
|
|
265
|
+
* is now being completed.
|
|
266
|
+
*/
|
|
267
|
+
initialStep: _propTypes.default.number,
|
|
246
268
|
/**
|
|
247
269
|
* The primary 'danger' button text in the modal
|
|
248
270
|
*/
|
|
@@ -10,7 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
var
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
var _iconsReact = require("@carbon/icons-react");
|
|
16
16
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
@@ -20,35 +20,51 @@ var _settings = require("../../../../../settings");
|
|
|
20
20
|
var _excluded = ["legendText"];
|
|
21
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
var blockClass = "".concat(_settings.pkg.prefix, "--
|
|
23
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid__row-size");
|
|
24
24
|
var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
25
25
|
var _ref$legendText = _ref.legendText,
|
|
26
26
|
legendText = _ref$legendText === void 0 ? 'Row height' : _ref$legendText,
|
|
27
27
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
28
|
-
var buttonRef =
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
isOpen =
|
|
32
|
-
setIsOpen =
|
|
33
|
-
|
|
28
|
+
var buttonRef = (0, _react.useRef)(null);
|
|
29
|
+
var _useState = (0, _react.useState)(false),
|
|
30
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
31
|
+
isOpen = _useState2[0],
|
|
32
|
+
setIsOpen = _useState2[1];
|
|
33
|
+
var onCloseHandler = function onCloseHandler() {
|
|
34
|
+
setIsOpen(false);
|
|
35
|
+
};
|
|
36
|
+
var onBlurHandler = function onBlurHandler(e) {
|
|
37
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
38
|
+
onCloseHandler();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var onClickHandler = function onClickHandler() {
|
|
42
|
+
setIsOpen(!isOpen);
|
|
43
|
+
};
|
|
44
|
+
var onKeyHandler = function onKeyHandler(e) {
|
|
45
|
+
if (e.key === 'Escape') {
|
|
46
|
+
onCloseHandler();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
50
|
+
tabIndex: -1,
|
|
51
|
+
className: blockClass,
|
|
52
|
+
role: "presentation",
|
|
53
|
+
onBlur: onBlurHandler,
|
|
54
|
+
onKeyDown: onKeyHandler
|
|
55
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
56
|
+
tabIndex: 0,
|
|
34
57
|
hasIconOnly: true,
|
|
35
58
|
ref: buttonRef,
|
|
36
59
|
kind: "ghost",
|
|
37
60
|
tooltipPosition: "bottom",
|
|
38
61
|
renderIcon: _iconsReact.Settings16,
|
|
39
|
-
onClick: function onClick() {
|
|
40
|
-
return setIsOpen(function (prevOpen) {
|
|
41
|
-
return !prevOpen;
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
62
|
iconDescription: legendText,
|
|
45
|
-
className: (0, _classnames.default)("".concat(blockClass, "
|
|
46
|
-
|
|
63
|
+
className: (0, _classnames.default)("".concat(blockClass, "-button"), (0, _defineProperty2.default)({}, "".concat(blockClass, "-button--open"), isOpen)),
|
|
64
|
+
onClick: onClickHandler
|
|
65
|
+
}), isOpen && /*#__PURE__*/_react.default.createElement(_RowSizeRadioGroup.default, (0, _extends2.default)({}, props, {
|
|
47
66
|
legendText: legendText,
|
|
48
|
-
buttonRef: buttonRef
|
|
49
|
-
hideRadioGroup: function hideRadioGroup() {
|
|
50
|
-
setIsOpen(false);
|
|
51
|
-
}
|
|
67
|
+
buttonRef: buttonRef
|
|
52
68
|
})));
|
|
53
69
|
};
|
|
54
70
|
RowSizeDropdown.propTypes = {
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _layout = require("@carbon/layout");
|
|
12
10
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
13
11
|
var _isArray = _interopRequireDefault(require("lodash/isArray"));
|
|
14
12
|
var _settings = require("../../../../../settings");
|
|
15
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
13
|
/* eslint-disable react/default-props-match-prop-types */
|
|
18
14
|
// @flow
|
|
19
15
|
/*
|
|
@@ -29,9 +25,7 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
|
|
29
25
|
var rowSizes = _ref.rowSizes,
|
|
30
26
|
selectedOption = _ref.selectedOption,
|
|
31
27
|
datagridName = _ref.datagridName,
|
|
32
|
-
buttonRef = _ref.buttonRef,
|
|
33
28
|
onChange = _ref.onChange,
|
|
34
|
-
hideRadioGroup = _ref.hideRadioGroup,
|
|
35
29
|
legendText = _ref.legendText,
|
|
36
30
|
_ref$rowSizeLabels = _ref.rowSizeLabels,
|
|
37
31
|
rowSizeLabels = _ref$rowSizeLabels === void 0 ? {
|
|
@@ -41,25 +35,9 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
|
|
41
35
|
sm: 'Small',
|
|
42
36
|
xs: 'Extra small'
|
|
43
37
|
} : _ref$rowSizeLabels;
|
|
44
|
-
var _getDropdownPosition = getDropdownPosition(buttonRef.current),
|
|
45
|
-
top = _getDropdownPosition.top,
|
|
46
|
-
right = _getDropdownPosition.right;
|
|
47
|
-
(0, _react.useEffect)(function () {
|
|
48
|
-
window.addEventListener('click', hideRadioGroup);
|
|
49
|
-
return function () {
|
|
50
|
-
window.removeEventListener('click', hideRadioGroup);
|
|
51
|
-
};
|
|
52
|
-
}, [hideRadioGroup]);
|
|
53
38
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
54
39
|
className: "".concat(blockClass, "__row-size-dropdown"),
|
|
55
|
-
|
|
56
|
-
top: (0, _layout.rem)(top),
|
|
57
|
-
right: (0, _layout.rem)(right)
|
|
58
|
-
},
|
|
59
|
-
role: "presentation",
|
|
60
|
-
onClick: function onClick(e) {
|
|
61
|
-
e.stopPropagation();
|
|
62
|
-
}
|
|
40
|
+
role: "presentation"
|
|
63
41
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.RadioButtonGroup, {
|
|
64
42
|
legendText: legendText,
|
|
65
43
|
name: "row-height-group",
|
|
@@ -93,21 +71,6 @@ var getBackwardCompatibleRowSize = function getBackwardCompatibleRowSize(rowSize
|
|
|
93
71
|
|
|
94
72
|
return rowSizeMap[rowSize] || rowSize;
|
|
95
73
|
};
|
|
96
|
-
var getDropdownPosition = function getDropdownPosition(buttonEle) {
|
|
97
|
-
var parent = buttonEle.parentElement;
|
|
98
|
-
if (parent instanceof HTMLElement) {
|
|
99
|
-
var top = buttonEle.offsetTop + buttonEle.offsetHeight;
|
|
100
|
-
var right = parent.offsetWidth - (buttonEle.offsetLeft + buttonEle.offsetWidth);
|
|
101
|
-
return {
|
|
102
|
-
top: top,
|
|
103
|
-
right: right
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
top: 0,
|
|
108
|
-
right: 0
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
74
|
RowSizeRadioGroup.defaultProps = {
|
|
112
75
|
rowSizes: [{
|
|
113
76
|
value: 'xl' // 64
|
|
@@ -126,7 +89,6 @@ RowSizeRadioGroup.defaultProps = {
|
|
|
126
89
|
RowSizeRadioGroup.propTypes = {
|
|
127
90
|
buttonRef: _propTypes.default.any.isRequired,
|
|
128
91
|
datagridName: _propTypes.default.string,
|
|
129
|
-
hideRadioGroup: _propTypes.default.func.isRequired,
|
|
130
92
|
legendText: _propTypes.default.string,
|
|
131
93
|
onChange: _propTypes.default.func.isRequired,
|
|
132
94
|
rowSizeLabels: _propTypes.default.object,
|