carbon-addons-iot-react 5.12.0 → 5.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/carbon-addons-iot-react.css +24 -0
- package/css/carbon-addons-iot-react.css.map +1 -1
- package/es/components/Card/CardToolbar.js +4 -4
- package/es/components/PageWizard/PageWizard.js +13 -3
- package/es/components/ProgressIndicator/ProgressIndicator.js +50 -19
- package/lib/components/Card/CardToolbar.js +4 -4
- package/lib/components/PageWizard/PageWizard.js +13 -3
- package/lib/components/ProgressIndicator/ProgressIndicator.js +69 -19
- package/lib/css/carbon-addons-iot-react.css +24 -0
- package/lib/css/carbon-addons-iot-react.css.map +1 -1
- package/lib/scss/components/ProgressIndicator/_progress-indicator.scss +30 -1
- package/package.json +1 -1
- package/scss/components/ProgressIndicator/_progress-indicator.scss +30 -1
- package/umd/carbon-addons-iot-react.js +16924 -1697
|
@@ -163,8 +163,8 @@ var CardToolbar = function CardToolbar(_ref) {
|
|
|
163
163
|
var extraActionSlot = extraActions && Object.keys(extraActions).length !== 0 ? extraActions.children && extraActions.children.length ? /*#__PURE__*/React__default.createElement(OverflowMenu, _extends({
|
|
164
164
|
menuOptionsClass: "".concat(iotPrefix, "--card--toolbar__overflow-menu"),
|
|
165
165
|
flipped: overflowMenuPosition,
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
iconDescription: extraActions.iconDescription || mergedI18n.overflowMenuDescription,
|
|
167
|
+
autoAlign: true
|
|
168
168
|
}, extraActions.icon ? {
|
|
169
169
|
renderIcon: extraActions.icon
|
|
170
170
|
} : {}), extraActions.children.map(function (child, i) {
|
|
@@ -195,8 +195,8 @@ var CardToolbar = function CardToolbar(_ref) {
|
|
|
195
195
|
className: classnames(className, "".concat(iotPrefix, "--card--toolbar"))
|
|
196
196
|
}, (availableActions.clone || availableActions.delete) && /*#__PURE__*/React__default.createElement(OverflowMenu, {
|
|
197
197
|
flipped: overflowMenuPosition,
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
iconDescription: mergedI18n.overflowMenuDescription,
|
|
199
|
+
autoAlign: true
|
|
200
200
|
}, availableActions.clone && /*#__PURE__*/React__default.createElement(OverflowMenuItem, {
|
|
201
201
|
onClick: function onClick() {
|
|
202
202
|
onCardAction(CARD_ACTIONS.CLONE_CARD);
|
|
@@ -161,9 +161,11 @@ var PageWizard = function PageWizard(_ref) {
|
|
|
161
161
|
description = _ref2.description,
|
|
162
162
|
subStep = _ref2.subStep,
|
|
163
163
|
disabled = _ref2.disabled,
|
|
164
|
-
invalid = _ref2.invalid
|
|
164
|
+
invalid = _ref2.invalid,
|
|
165
|
+
pictogramName = _ref2.pictogramName,
|
|
166
|
+
isComplete = _ref2.isComplete;
|
|
165
167
|
if (!subStep) {
|
|
166
|
-
array.push(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, id && {
|
|
168
|
+
array.push(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, id && {
|
|
167
169
|
id: id
|
|
168
170
|
}), label && {
|
|
169
171
|
label: label
|
|
@@ -175,13 +177,17 @@ var PageWizard = function PageWizard(_ref) {
|
|
|
175
177
|
disabled: disabled
|
|
176
178
|
}), invalid && {
|
|
177
179
|
invalid: invalid
|
|
180
|
+
}), pictogramName && {
|
|
181
|
+
pictogramName: pictogramName
|
|
182
|
+
}), {}, {
|
|
183
|
+
isComplete: isComplete
|
|
178
184
|
}));
|
|
179
185
|
} else {
|
|
180
186
|
var lastMainStep = array[array.length - 1];
|
|
181
187
|
if (!('children' in lastMainStep)) {
|
|
182
188
|
lastMainStep.children = [];
|
|
183
189
|
}
|
|
184
|
-
lastMainStep.children.push(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, id && {
|
|
190
|
+
lastMainStep.children.push(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, id && {
|
|
185
191
|
id: id
|
|
186
192
|
}), label && {
|
|
187
193
|
label: label
|
|
@@ -193,6 +199,10 @@ var PageWizard = function PageWizard(_ref) {
|
|
|
193
199
|
disabled: disabled
|
|
194
200
|
}), invalid && {
|
|
195
201
|
invalid: invalid
|
|
202
|
+
}), pictogramName && {
|
|
203
|
+
pictogramName: pictogramName
|
|
204
|
+
}), {}, {
|
|
205
|
+
isComplete: isComplete
|
|
196
206
|
}));
|
|
197
207
|
}
|
|
198
208
|
});
|
|
@@ -15,6 +15,7 @@ import PropTypes from 'prop-types';
|
|
|
15
15
|
import classnames from 'classnames';
|
|
16
16
|
import { Enter, Space } from '../../node_modules/@carbon/react/es/internal/keyboard/keys.js';
|
|
17
17
|
import { matches } from '../../node_modules/@carbon/react/es/internal/keyboard/match.js';
|
|
18
|
+
import * as Pictograms from '@carbon/pictograms-react';
|
|
18
19
|
import { settings } from '../../constants/Settings.js';
|
|
19
20
|
import { CheckmarkOutline, Warning, CircleFilled, RadioButton } from '@carbon/icons-react';
|
|
20
21
|
|
|
@@ -39,7 +40,9 @@ var ProgressStep = function ProgressStep(_ref) {
|
|
|
39
40
|
incomplete = _ref.incomplete,
|
|
40
41
|
mainStep = _ref.mainStep,
|
|
41
42
|
subStep = _ref.subStep,
|
|
42
|
-
spaceEqually = _ref.spaceEqually
|
|
43
|
+
spaceEqually = _ref.spaceEqually,
|
|
44
|
+
pictogramName = _ref.pictogramName,
|
|
45
|
+
hasPictogram = _ref.hasPictogram;
|
|
43
46
|
var accessible = isClickable && !disabled && !current;
|
|
44
47
|
var handleClick = function handleClick() {
|
|
45
48
|
if (onClick) {
|
|
@@ -137,7 +140,14 @@ var ProgressStep = function ProgressStep(_ref) {
|
|
|
137
140
|
// for testing purposes
|
|
138
141
|
var dataTestIdLabel = label.replace(/\s/g, '-').toLowerCase();
|
|
139
142
|
var type = mainStep ? 'main' : 'sub';
|
|
140
|
-
|
|
143
|
+
|
|
144
|
+
// get pictogram component from name passed in items array via pictogramName property
|
|
145
|
+
var PictogramComponent = pictogramName !== null && pictogramName !== void 0 && pictogramName.length ? Pictograms[pictogramName] : null;
|
|
146
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null,
|
|
147
|
+
// reserve space in all steps if even one pictogram is showing to align all the steps correctly
|
|
148
|
+
hasPictogram && /*#__PURE__*/React__default.createElement("div", {
|
|
149
|
+
className: "".concat(iotPrefix, "--progress-step--pictogram-item")
|
|
150
|
+
}, PictogramComponent && /*#__PURE__*/React__default.createElement(PictogramComponent, null)), /*#__PURE__*/React__default.createElement("button", {
|
|
141
151
|
className: buttonClasses,
|
|
142
152
|
type: "button",
|
|
143
153
|
"aria-disabled": disabled,
|
|
@@ -150,7 +160,7 @@ var ProgressStep = function ProgressStep(_ref) {
|
|
|
150
160
|
className: textClasses
|
|
151
161
|
}, /*#__PURE__*/React__default.createElement(StepLabel, null), /*#__PURE__*/React__default.createElement(StepSecondaryLabel, null))));
|
|
152
162
|
};
|
|
153
|
-
var classes = classnames(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--progress-step"), true), "".concat(iotPrefix, "--progress-step--current"), current && !disabled), "".concat(iotPrefix, "--progress-step--complete"), complete && !disabled && !invalid), "".concat(iotPrefix, "--progress-step--incomplete"), incomplete && !current && !disabled && !invalid), "".concat(iotPrefix, "--progress-step--disabled"), disabled), "".concat(iotPrefix, "--progress-step--invalid"), invalid));
|
|
163
|
+
var classes = classnames(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--progress-step"), true), "".concat(iotPrefix, "--progress-step--current"), current && !disabled), "".concat(iotPrefix, "--progress-step--complete"), complete && !disabled && !invalid), "".concat(iotPrefix, "--progress-step--incomplete"), incomplete && !current && !disabled && !invalid), "".concat(iotPrefix, "--progress-step--disabled"), disabled), "".concat(iotPrefix, "--progress-step--invalid"), invalid), "".concat(iotPrefix, "--progress-step--pictogram"), hasPictogram));
|
|
154
164
|
return /*#__PURE__*/React__default.createElement("li", {
|
|
155
165
|
className: classes,
|
|
156
166
|
style: getStepWidth()
|
|
@@ -175,7 +185,9 @@ ProgressStep.propTypes = {
|
|
|
175
185
|
mainStep: PropTypes.bool,
|
|
176
186
|
subStep: PropTypes.bool,
|
|
177
187
|
onClick: PropTypes.func,
|
|
178
|
-
spaceEqually: PropTypes.bool
|
|
188
|
+
spaceEqually: PropTypes.bool,
|
|
189
|
+
pictogramName: PropTypes.string,
|
|
190
|
+
hasPictogram: PropTypes.bool
|
|
179
191
|
};
|
|
180
192
|
ProgressStep.defaultProps = {
|
|
181
193
|
label: null,
|
|
@@ -195,7 +207,9 @@ ProgressStep.defaultProps = {
|
|
|
195
207
|
mainStep: false,
|
|
196
208
|
subStep: false,
|
|
197
209
|
onClick: null,
|
|
198
|
-
spaceEqually: false
|
|
210
|
+
spaceEqually: false,
|
|
211
|
+
pictogramName: null,
|
|
212
|
+
hasPictogram: false
|
|
199
213
|
};
|
|
200
214
|
var ProgressIndicator = function ProgressIndicator(_ref2) {
|
|
201
215
|
var className = _ref2.className,
|
|
@@ -262,27 +276,37 @@ var ProgressIndicator = function ProgressIndicator(_ref2) {
|
|
|
262
276
|
return setCurrentStep(currentItemId);
|
|
263
277
|
}, [currentItemId]);
|
|
264
278
|
var classes = classnames(_defineProperty(_defineProperty(_defineProperty({}, "".concat(iotPrefix, "--progress-indicator"), true), "".concat(iotPrefix, "--progress-indicator--vertical"), isVerticalMode), className, className));
|
|
279
|
+
|
|
280
|
+
// check if any pictogram is to be shown, this will modify styling of all the steps
|
|
281
|
+
var hasPictogram = newItems.some(function (_ref3) {
|
|
282
|
+
var pictogramName = _ref3.pictogramName;
|
|
283
|
+
return (pictogramName === null || pictogramName === void 0 ? void 0 : pictogramName.length) && typeof Pictograms[pictogramName] !== 'undefined';
|
|
284
|
+
});
|
|
265
285
|
return newItems.length > 1 ? /*#__PURE__*/React__default.createElement("ul", {
|
|
266
286
|
className: classes,
|
|
267
287
|
"data-testid": testId
|
|
268
|
-
}, newItems.map(function (
|
|
269
|
-
var id =
|
|
270
|
-
label =
|
|
271
|
-
secondaryLabel =
|
|
272
|
-
description =
|
|
273
|
-
disabled =
|
|
274
|
-
invalid =
|
|
275
|
-
stepNumber =
|
|
276
|
-
level =
|
|
288
|
+
}, newItems.map(function (_ref4, index) {
|
|
289
|
+
var id = _ref4.id,
|
|
290
|
+
label = _ref4.label,
|
|
291
|
+
secondaryLabel = _ref4.secondaryLabel,
|
|
292
|
+
description = _ref4.description,
|
|
293
|
+
disabled = _ref4.disabled,
|
|
294
|
+
invalid = _ref4.invalid,
|
|
295
|
+
stepNumber = _ref4.stepNumber,
|
|
296
|
+
level = _ref4.level,
|
|
297
|
+
pictogramName = _ref4.pictogramName,
|
|
298
|
+
isComplete = _ref4.isComplete;
|
|
277
299
|
return /*#__PURE__*/React__default.createElement(ProgressStep, {
|
|
278
300
|
id: id,
|
|
279
301
|
key: id,
|
|
280
302
|
label: label,
|
|
281
303
|
secondaryLabel: secondaryLabel,
|
|
282
304
|
description: description || label,
|
|
283
|
-
current: currentStep === id
|
|
284
|
-
complete
|
|
285
|
-
|
|
305
|
+
current: currentStep === id
|
|
306
|
+
// user can mark complete/incomplete based on it's own criteria
|
|
307
|
+
,
|
|
308
|
+
complete: typeof isComplete === 'boolean' ? isComplete : getCurrentIndex() > index,
|
|
309
|
+
incomplete: typeof isComplete === 'boolean' ? !isComplete : getCurrentIndex() < index,
|
|
286
310
|
mainStep: level === 0,
|
|
287
311
|
subStep: level > 0,
|
|
288
312
|
onClick: handleChange,
|
|
@@ -294,7 +318,9 @@ var ProgressIndicator = function ProgressIndicator(_ref2) {
|
|
|
294
318
|
disabled: disabled,
|
|
295
319
|
invalid: invalid,
|
|
296
320
|
isClickable: isClickable,
|
|
297
|
-
spaceEqually: spaceEqually
|
|
321
|
+
spaceEqually: spaceEqually,
|
|
322
|
+
pictogramName: pictogramName,
|
|
323
|
+
hasPictogram: hasPictogram
|
|
298
324
|
});
|
|
299
325
|
})) : null;
|
|
300
326
|
};
|
|
@@ -306,7 +332,8 @@ ProgressIndicator.propTypes = {
|
|
|
306
332
|
secondaryLabel: PropTypes.string,
|
|
307
333
|
description: PropTypes.string,
|
|
308
334
|
disabled: PropTypes.bool,
|
|
309
|
-
invalid: PropTypes.bool
|
|
335
|
+
invalid: PropTypes.bool,
|
|
336
|
+
pictogramName: PropTypes.string
|
|
310
337
|
})),
|
|
311
338
|
currentItemId: IDPropTypes,
|
|
312
339
|
showLabels: PropTypes.bool,
|
|
@@ -381,6 +408,10 @@ ProgressIndicator.__docgenInfo = {
|
|
|
381
408
|
"invalid": {
|
|
382
409
|
"name": "bool",
|
|
383
410
|
"required": false
|
|
411
|
+
},
|
|
412
|
+
"pictogramName": {
|
|
413
|
+
"name": "string",
|
|
414
|
+
"required": false
|
|
384
415
|
}
|
|
385
416
|
}
|
|
386
417
|
}
|
|
@@ -176,8 +176,8 @@ var CardToolbar = function CardToolbar(_ref) {
|
|
|
176
176
|
var extraActionSlot = extraActions && Object.keys(extraActions).length !== 0 ? extraActions.children && extraActions.children.length ? /*#__PURE__*/React__default.default.createElement(react.OverflowMenu, _extends__default.default({
|
|
177
177
|
menuOptionsClass: "".concat(iotPrefix, "--card--toolbar__overflow-menu"),
|
|
178
178
|
flipped: overflowMenuPosition,
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
iconDescription: extraActions.iconDescription || mergedI18n.overflowMenuDescription,
|
|
180
|
+
autoAlign: true
|
|
181
181
|
}, extraActions.icon ? {
|
|
182
182
|
renderIcon: extraActions.icon
|
|
183
183
|
} : {}), extraActions.children.map(function (child, i) {
|
|
@@ -208,8 +208,8 @@ var CardToolbar = function CardToolbar(_ref) {
|
|
|
208
208
|
className: classnames__default.default(className, "".concat(iotPrefix, "--card--toolbar"))
|
|
209
209
|
}, (availableActions.clone || availableActions.delete) && /*#__PURE__*/React__default.default.createElement(react.OverflowMenu, {
|
|
210
210
|
flipped: overflowMenuPosition,
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
iconDescription: mergedI18n.overflowMenuDescription,
|
|
212
|
+
autoAlign: true
|
|
213
213
|
}, availableActions.clone && /*#__PURE__*/React__default.default.createElement(react.OverflowMenuItem, {
|
|
214
214
|
onClick: function onClick() {
|
|
215
215
|
onCardAction(LayoutConstants.CARD_ACTIONS.CLONE_CARD);
|
|
@@ -172,9 +172,11 @@ var PageWizard = function PageWizard(_ref) {
|
|
|
172
172
|
description = _ref2.description,
|
|
173
173
|
subStep = _ref2.subStep,
|
|
174
174
|
disabled = _ref2.disabled,
|
|
175
|
-
invalid = _ref2.invalid
|
|
175
|
+
invalid = _ref2.invalid,
|
|
176
|
+
pictogramName = _ref2.pictogramName,
|
|
177
|
+
isComplete = _ref2.isComplete;
|
|
176
178
|
if (!subStep) {
|
|
177
|
-
array.push(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, id && {
|
|
179
|
+
array.push(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, id && {
|
|
178
180
|
id: id
|
|
179
181
|
}), label && {
|
|
180
182
|
label: label
|
|
@@ -186,13 +188,17 @@ var PageWizard = function PageWizard(_ref) {
|
|
|
186
188
|
disabled: disabled
|
|
187
189
|
}), invalid && {
|
|
188
190
|
invalid: invalid
|
|
191
|
+
}), pictogramName && {
|
|
192
|
+
pictogramName: pictogramName
|
|
193
|
+
}), {}, {
|
|
194
|
+
isComplete: isComplete
|
|
189
195
|
}));
|
|
190
196
|
} else {
|
|
191
197
|
var lastMainStep = array[array.length - 1];
|
|
192
198
|
if (!('children' in lastMainStep)) {
|
|
193
199
|
lastMainStep.children = [];
|
|
194
200
|
}
|
|
195
|
-
lastMainStep.children.push(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, id && {
|
|
201
|
+
lastMainStep.children.push(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, id && {
|
|
196
202
|
id: id
|
|
197
203
|
}), label && {
|
|
198
204
|
label: label
|
|
@@ -204,6 +210,10 @@ var PageWizard = function PageWizard(_ref) {
|
|
|
204
210
|
disabled: disabled
|
|
205
211
|
}), invalid && {
|
|
206
212
|
invalid: invalid
|
|
213
|
+
}), pictogramName && {
|
|
214
|
+
pictogramName: pictogramName
|
|
215
|
+
}), {}, {
|
|
216
|
+
isComplete: isComplete
|
|
207
217
|
}));
|
|
208
218
|
}
|
|
209
219
|
});
|
|
@@ -17,16 +17,36 @@ var PropTypes = require('prop-types');
|
|
|
17
17
|
var classnames = require('classnames');
|
|
18
18
|
var keys = require('../../node_modules/@carbon/react/es/internal/keyboard/keys.js');
|
|
19
19
|
var match = require('../../node_modules/@carbon/react/es/internal/keyboard/match.js');
|
|
20
|
+
var Pictograms = require('@carbon/pictograms-react');
|
|
20
21
|
var Settings = require('../../constants/Settings.js');
|
|
21
22
|
var iconsReact = require('@carbon/icons-react');
|
|
22
23
|
|
|
23
24
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
25
|
|
|
26
|
+
function _interopNamespace(e) {
|
|
27
|
+
if (e && e.__esModule) return e;
|
|
28
|
+
var n = Object.create(null);
|
|
29
|
+
if (e) {
|
|
30
|
+
Object.keys(e).forEach(function (k) {
|
|
31
|
+
if (k !== 'default') {
|
|
32
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
33
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return e[k]; }
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
n.default = e;
|
|
41
|
+
return Object.freeze(n);
|
|
42
|
+
}
|
|
43
|
+
|
|
25
44
|
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
|
|
26
45
|
var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
|
|
27
46
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
28
47
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
29
48
|
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
49
|
+
var Pictograms__namespace = /*#__PURE__*/_interopNamespace(Pictograms);
|
|
30
50
|
|
|
31
51
|
var iotPrefix = Settings.settings.iotPrefix;
|
|
32
52
|
var IDPropTypes = PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.number]);
|
|
@@ -49,7 +69,9 @@ var ProgressStep = function ProgressStep(_ref) {
|
|
|
49
69
|
incomplete = _ref.incomplete,
|
|
50
70
|
mainStep = _ref.mainStep,
|
|
51
71
|
subStep = _ref.subStep,
|
|
52
|
-
spaceEqually = _ref.spaceEqually
|
|
72
|
+
spaceEqually = _ref.spaceEqually,
|
|
73
|
+
pictogramName = _ref.pictogramName,
|
|
74
|
+
hasPictogram = _ref.hasPictogram;
|
|
53
75
|
var accessible = isClickable && !disabled && !current;
|
|
54
76
|
var handleClick = function handleClick() {
|
|
55
77
|
if (onClick) {
|
|
@@ -147,7 +169,14 @@ var ProgressStep = function ProgressStep(_ref) {
|
|
|
147
169
|
// for testing purposes
|
|
148
170
|
var dataTestIdLabel = label.replace(/\s/g, '-').toLowerCase();
|
|
149
171
|
var type = mainStep ? 'main' : 'sub';
|
|
150
|
-
|
|
172
|
+
|
|
173
|
+
// get pictogram component from name passed in items array via pictogramName property
|
|
174
|
+
var PictogramComponent = pictogramName !== null && pictogramName !== void 0 && pictogramName.length ? Pictograms__namespace[pictogramName] : null;
|
|
175
|
+
return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null,
|
|
176
|
+
// reserve space in all steps if even one pictogram is showing to align all the steps correctly
|
|
177
|
+
hasPictogram && /*#__PURE__*/React__default.default.createElement("div", {
|
|
178
|
+
className: "".concat(iotPrefix, "--progress-step--pictogram-item")
|
|
179
|
+
}, PictogramComponent && /*#__PURE__*/React__default.default.createElement(PictogramComponent, null)), /*#__PURE__*/React__default.default.createElement("button", {
|
|
151
180
|
className: buttonClasses,
|
|
152
181
|
type: "button",
|
|
153
182
|
"aria-disabled": disabled,
|
|
@@ -160,7 +189,7 @@ var ProgressStep = function ProgressStep(_ref) {
|
|
|
160
189
|
className: textClasses
|
|
161
190
|
}, /*#__PURE__*/React__default.default.createElement(StepLabel, null), /*#__PURE__*/React__default.default.createElement(StepSecondaryLabel, null))));
|
|
162
191
|
};
|
|
163
|
-
var classes = classnames__default.default(_defineProperty__default.default(_defineProperty__default.default(_defineProperty__default.default(_defineProperty__default.default(_defineProperty__default.default(_defineProperty__default.default({}, "".concat(iotPrefix, "--progress-step"), true), "".concat(iotPrefix, "--progress-step--current"), current && !disabled), "".concat(iotPrefix, "--progress-step--complete"), complete && !disabled && !invalid), "".concat(iotPrefix, "--progress-step--incomplete"), incomplete && !current && !disabled && !invalid), "".concat(iotPrefix, "--progress-step--disabled"), disabled), "".concat(iotPrefix, "--progress-step--invalid"), invalid));
|
|
192
|
+
var classes = classnames__default.default(_defineProperty__default.default(_defineProperty__default.default(_defineProperty__default.default(_defineProperty__default.default(_defineProperty__default.default(_defineProperty__default.default(_defineProperty__default.default({}, "".concat(iotPrefix, "--progress-step"), true), "".concat(iotPrefix, "--progress-step--current"), current && !disabled), "".concat(iotPrefix, "--progress-step--complete"), complete && !disabled && !invalid), "".concat(iotPrefix, "--progress-step--incomplete"), incomplete && !current && !disabled && !invalid), "".concat(iotPrefix, "--progress-step--disabled"), disabled), "".concat(iotPrefix, "--progress-step--invalid"), invalid), "".concat(iotPrefix, "--progress-step--pictogram"), hasPictogram));
|
|
164
193
|
return /*#__PURE__*/React__default.default.createElement("li", {
|
|
165
194
|
className: classes,
|
|
166
195
|
style: getStepWidth()
|
|
@@ -185,7 +214,9 @@ ProgressStep.propTypes = {
|
|
|
185
214
|
mainStep: PropTypes__default.default.bool,
|
|
186
215
|
subStep: PropTypes__default.default.bool,
|
|
187
216
|
onClick: PropTypes__default.default.func,
|
|
188
|
-
spaceEqually: PropTypes__default.default.bool
|
|
217
|
+
spaceEqually: PropTypes__default.default.bool,
|
|
218
|
+
pictogramName: PropTypes__default.default.string,
|
|
219
|
+
hasPictogram: PropTypes__default.default.bool
|
|
189
220
|
};
|
|
190
221
|
ProgressStep.defaultProps = {
|
|
191
222
|
label: null,
|
|
@@ -205,7 +236,9 @@ ProgressStep.defaultProps = {
|
|
|
205
236
|
mainStep: false,
|
|
206
237
|
subStep: false,
|
|
207
238
|
onClick: null,
|
|
208
|
-
spaceEqually: false
|
|
239
|
+
spaceEqually: false,
|
|
240
|
+
pictogramName: null,
|
|
241
|
+
hasPictogram: false
|
|
209
242
|
};
|
|
210
243
|
var ProgressIndicator = function ProgressIndicator(_ref2) {
|
|
211
244
|
var className = _ref2.className,
|
|
@@ -272,27 +305,37 @@ var ProgressIndicator = function ProgressIndicator(_ref2) {
|
|
|
272
305
|
return setCurrentStep(currentItemId);
|
|
273
306
|
}, [currentItemId]);
|
|
274
307
|
var classes = classnames__default.default(_defineProperty__default.default(_defineProperty__default.default(_defineProperty__default.default({}, "".concat(iotPrefix, "--progress-indicator"), true), "".concat(iotPrefix, "--progress-indicator--vertical"), isVerticalMode), className, className));
|
|
308
|
+
|
|
309
|
+
// check if any pictogram is to be shown, this will modify styling of all the steps
|
|
310
|
+
var hasPictogram = newItems.some(function (_ref3) {
|
|
311
|
+
var pictogramName = _ref3.pictogramName;
|
|
312
|
+
return (pictogramName === null || pictogramName === void 0 ? void 0 : pictogramName.length) && typeof Pictograms__namespace[pictogramName] !== 'undefined';
|
|
313
|
+
});
|
|
275
314
|
return newItems.length > 1 ? /*#__PURE__*/React__default.default.createElement("ul", {
|
|
276
315
|
className: classes,
|
|
277
316
|
"data-testid": testId
|
|
278
|
-
}, newItems.map(function (
|
|
279
|
-
var id =
|
|
280
|
-
label =
|
|
281
|
-
secondaryLabel =
|
|
282
|
-
description =
|
|
283
|
-
disabled =
|
|
284
|
-
invalid =
|
|
285
|
-
stepNumber =
|
|
286
|
-
level =
|
|
317
|
+
}, newItems.map(function (_ref4, index) {
|
|
318
|
+
var id = _ref4.id,
|
|
319
|
+
label = _ref4.label,
|
|
320
|
+
secondaryLabel = _ref4.secondaryLabel,
|
|
321
|
+
description = _ref4.description,
|
|
322
|
+
disabled = _ref4.disabled,
|
|
323
|
+
invalid = _ref4.invalid,
|
|
324
|
+
stepNumber = _ref4.stepNumber,
|
|
325
|
+
level = _ref4.level,
|
|
326
|
+
pictogramName = _ref4.pictogramName,
|
|
327
|
+
isComplete = _ref4.isComplete;
|
|
287
328
|
return /*#__PURE__*/React__default.default.createElement(ProgressStep, {
|
|
288
329
|
id: id,
|
|
289
330
|
key: id,
|
|
290
331
|
label: label,
|
|
291
332
|
secondaryLabel: secondaryLabel,
|
|
292
333
|
description: description || label,
|
|
293
|
-
current: currentStep === id
|
|
294
|
-
complete
|
|
295
|
-
|
|
334
|
+
current: currentStep === id
|
|
335
|
+
// user can mark complete/incomplete based on it's own criteria
|
|
336
|
+
,
|
|
337
|
+
complete: typeof isComplete === 'boolean' ? isComplete : getCurrentIndex() > index,
|
|
338
|
+
incomplete: typeof isComplete === 'boolean' ? !isComplete : getCurrentIndex() < index,
|
|
296
339
|
mainStep: level === 0,
|
|
297
340
|
subStep: level > 0,
|
|
298
341
|
onClick: handleChange,
|
|
@@ -304,7 +347,9 @@ var ProgressIndicator = function ProgressIndicator(_ref2) {
|
|
|
304
347
|
disabled: disabled,
|
|
305
348
|
invalid: invalid,
|
|
306
349
|
isClickable: isClickable,
|
|
307
|
-
spaceEqually: spaceEqually
|
|
350
|
+
spaceEqually: spaceEqually,
|
|
351
|
+
pictogramName: pictogramName,
|
|
352
|
+
hasPictogram: hasPictogram
|
|
308
353
|
});
|
|
309
354
|
})) : null;
|
|
310
355
|
};
|
|
@@ -316,7 +361,8 @@ ProgressIndicator.propTypes = {
|
|
|
316
361
|
secondaryLabel: PropTypes__default.default.string,
|
|
317
362
|
description: PropTypes__default.default.string,
|
|
318
363
|
disabled: PropTypes__default.default.bool,
|
|
319
|
-
invalid: PropTypes__default.default.bool
|
|
364
|
+
invalid: PropTypes__default.default.bool,
|
|
365
|
+
pictogramName: PropTypes__default.default.string
|
|
320
366
|
})),
|
|
321
367
|
currentItemId: IDPropTypes,
|
|
322
368
|
showLabels: PropTypes__default.default.bool,
|
|
@@ -391,6 +437,10 @@ ProgressIndicator.__docgenInfo = {
|
|
|
391
437
|
"invalid": {
|
|
392
438
|
"name": "bool",
|
|
393
439
|
"required": false
|
|
440
|
+
},
|
|
441
|
+
"pictogramName": {
|
|
442
|
+
"name": "string",
|
|
443
|
+
"required": false
|
|
394
444
|
}
|
|
395
445
|
}
|
|
396
446
|
}
|
|
@@ -32484,6 +32484,9 @@ span.cds--pagination__text.cds--pagination__items-count {
|
|
|
32484
32484
|
width: 8rem;
|
|
32485
32485
|
height: 4.25rem;
|
|
32486
32486
|
}
|
|
32487
|
+
.iot--progress-indicator .iot--progress-step.iot--progress-step--pictogram {
|
|
32488
|
+
height: 7.25rem;
|
|
32489
|
+
}
|
|
32487
32490
|
.iot--progress-indicator .iot--progress-step-line, .iot--progress-indicator .iot--progress-step-line--sub, .iot--progress-indicator .iot--progress-step-line--sub-complete, .iot--progress-indicator .iot--progress-step-line--complete {
|
|
32488
32491
|
position: absolute;
|
|
32489
32492
|
width: calc(100% - 1.5rem);
|
|
@@ -32669,6 +32672,18 @@ html[dir=rtl] .iot--progress-indicator .iot--progress-text {
|
|
|
32669
32672
|
.iot--progress-indicator--vertical {
|
|
32670
32673
|
display: unset;
|
|
32671
32674
|
}
|
|
32675
|
+
.iot--progress-indicator--vertical .iot--progress-step {
|
|
32676
|
+
display: flex;
|
|
32677
|
+
gap: 0.5rem;
|
|
32678
|
+
}
|
|
32679
|
+
.iot--progress-indicator--vertical .iot--progress-step .iot--progress-step--pictogram-item {
|
|
32680
|
+
margin-top: -6px;
|
|
32681
|
+
margin-bottom: 0;
|
|
32682
|
+
}
|
|
32683
|
+
.iot--progress-indicator--vertical .iot--progress-step.iot--progress-step--pictogram {
|
|
32684
|
+
width: 11rem;
|
|
32685
|
+
height: 4.25rem;
|
|
32686
|
+
}
|
|
32672
32687
|
.iot--progress-indicator--vertical .iot--progress-step-button .iot--progress-text {
|
|
32673
32688
|
left: 2rem;
|
|
32674
32689
|
top: 0.1875rem;
|
|
@@ -32716,6 +32731,15 @@ html[dir=rtl] .iot--progress-indicator--vertical .cds--skeleton .cds--progress-s
|
|
|
32716
32731
|
.iot--progress-indicator .cds--skeleton .cds--progress-step {
|
|
32717
32732
|
flex: unset;
|
|
32718
32733
|
}
|
|
32734
|
+
.iot--progress-indicator .iot--progress-step--pictogram-item {
|
|
32735
|
+
width: 3rem;
|
|
32736
|
+
height: 3rem;
|
|
32737
|
+
margin-bottom: 0.5rem;
|
|
32738
|
+
}
|
|
32739
|
+
.iot--progress-indicator .iot--progress-step--pictogram-item svg {
|
|
32740
|
+
width: 100%;
|
|
32741
|
+
height: 100%;
|
|
32742
|
+
}
|
|
32719
32743
|
|
|
32720
32744
|
.iot--rule-builder-header {
|
|
32721
32745
|
display: flex;
|