grommet 2.55.0 → 2.56.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/components/Button/Button.js +7 -4
- package/components/Button/stories/CustomThemed/ChildrenPlainOption.stories.js +86 -0
- package/components/FormField/FormField.js +1 -1
- package/components/Grommet/index.d.ts +21 -0
- package/components/Grommet/propTypes.js +26 -0
- package/components/Stepper/StepConnector.js +68 -0
- package/components/Stepper/Stepper.js +309 -0
- package/components/Stepper/StepperContext.js +43 -0
- package/components/Stepper/StepperDescription.js +26 -0
- package/components/Stepper/StepperHelperText.js +44 -0
- package/components/Stepper/StepperIndicator.js +74 -0
- package/components/Stepper/StepperLabel.js +41 -0
- package/components/Stepper/StepperStep.js +127 -0
- package/components/Stepper/StyledStepper.js +124 -0
- package/components/Stepper/index.d.ts +80 -0
- package/components/Stepper/index.js +18 -0
- package/components/Stepper/propTypes.js +35 -0
- package/components/Stepper/stories/DisabledSteps.stories.js +45 -0
- package/components/Stepper/stories/ErrorStates.stories.js +45 -0
- package/components/Stepper/stories/HorizontalSteps.stories.js +50 -0
- package/components/Stepper/stories/Interactive.stories.js +60 -0
- package/components/Stepper/stories/KeyboardNavigation.stories.js +64 -0
- package/components/Stepper/stories/NestedSubSteps.stories.js +70 -0
- package/components/Stepper/stories/ReadOnly.stories.js +43 -0
- package/components/Stepper/stories/ThemingLightDark.stories.js +58 -0
- package/components/Stepper/stories/VerticalSteps.stories.js +67 -0
- package/components/Tab/Tab.js +19 -6
- package/components/Tabs/Tabs.js +156 -22
- package/components/TimeInput/README.md +2 -0
- package/components/TimeInput/StyledTimeInput.js +73 -0
- package/components/TimeInput/TimeInput.js +689 -0
- package/components/TimeInput/TimeInputPopup.js +393 -0
- package/components/TimeInput/index.d.ts +41 -0
- package/components/TimeInput/index.js +6 -0
- package/components/TimeInput/propTypes.js +35 -0
- package/components/TimeInput/stories/Controlled.stories.tsx +29 -0
- package/components/TimeInput/stories/Disabled.stories.tsx +13 -0
- package/components/TimeInput/stories/Form.stories.tsx +38 -0
- package/components/TimeInput/stories/ReadOnly.stories.tsx +13 -0
- package/components/TimeInput/stories/Simple.stories.tsx +19 -0
- package/components/TimeInput/stories/Step.stories.tsx +14 -0
- package/components/TimeInput/stories/ThemingLightDark.stories.tsx +22 -0
- package/components/TimeInput/stories/Uncontrolled.stories.tsx +22 -0
- package/components/TimeInput/useSectionedTimeField.js +359 -0
- package/components/TimeInput/utils.js +187 -0
- package/components/index.d.ts +2 -0
- package/components/index.js +12 -0
- package/es6/components/Button/Button.js +7 -4
- package/es6/components/Button/stories/CustomThemed/ChildrenPlainOption.stories.js +81 -0
- package/es6/components/FormField/FormField.js +1 -1
- package/es6/components/Grommet/index.d.ts +21 -0
- package/es6/components/Grommet/propTypes.js +26 -0
- package/es6/components/Stepper/StepConnector.js +63 -0
- package/es6/components/Stepper/Stepper.js +306 -0
- package/es6/components/Stepper/StepperContext.js +39 -0
- package/es6/components/Stepper/StepperDescription.js +21 -0
- package/es6/components/Stepper/StepperHelperText.js +39 -0
- package/es6/components/Stepper/StepperIndicator.js +69 -0
- package/es6/components/Stepper/StepperLabel.js +36 -0
- package/es6/components/Stepper/StepperStep.js +122 -0
- package/es6/components/Stepper/StyledStepper.js +120 -0
- package/es6/components/Stepper/index.d.ts +80 -0
- package/es6/components/Stepper/index.js +6 -0
- package/es6/components/Stepper/propTypes.js +30 -0
- package/es6/components/Stepper/stories/DisabledSteps.stories.js +41 -0
- package/es6/components/Stepper/stories/ErrorStates.stories.js +41 -0
- package/es6/components/Stepper/stories/HorizontalSteps.stories.js +46 -0
- package/es6/components/Stepper/stories/Interactive.stories.js +56 -0
- package/es6/components/Stepper/stories/KeyboardNavigation.stories.js +60 -0
- package/es6/components/Stepper/stories/NestedSubSteps.stories.js +66 -0
- package/es6/components/Stepper/stories/ReadOnly.stories.js +39 -0
- package/es6/components/Stepper/stories/ThemingLightDark.stories.js +54 -0
- package/es6/components/Stepper/stories/VerticalSteps.stories.js +63 -0
- package/es6/components/Tab/Tab.js +19 -6
- package/es6/components/Tabs/Tabs.js +157 -23
- package/es6/components/TimeInput/README.md +2 -0
- package/es6/components/TimeInput/StyledTimeInput.js +68 -0
- package/es6/components/TimeInput/TimeInput.js +685 -0
- package/es6/components/TimeInput/TimeInputPopup.js +389 -0
- package/es6/components/TimeInput/index.d.ts +41 -0
- package/es6/components/TimeInput/index.js +1 -0
- package/es6/components/TimeInput/propTypes.js +30 -0
- package/es6/components/TimeInput/stories/Controlled.stories.tsx +29 -0
- package/es6/components/TimeInput/stories/Disabled.stories.tsx +13 -0
- package/es6/components/TimeInput/stories/Form.stories.tsx +38 -0
- package/es6/components/TimeInput/stories/ReadOnly.stories.tsx +13 -0
- package/es6/components/TimeInput/stories/Simple.stories.tsx +19 -0
- package/es6/components/TimeInput/stories/Step.stories.tsx +14 -0
- package/es6/components/TimeInput/stories/ThemingLightDark.stories.tsx +22 -0
- package/es6/components/TimeInput/stories/Uncontrolled.stories.tsx +22 -0
- package/es6/components/TimeInput/useSectionedTimeField.js +356 -0
- package/es6/components/TimeInput/utils.js +183 -0
- package/es6/components/index.d.ts +2 -0
- package/es6/components/index.js +2 -0
- package/es6/index.d.ts +2 -0
- package/es6/languages/default.json +20 -0
- package/es6/themes/base.d.ts +108 -0
- package/es6/themes/base.js +208 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/index.d.ts +2 -0
- package/languages/default.json +20 -0
- package/package.json +41 -40
- package/themes/base.d.ts +108 -0
- package/themes/base.js +208 -0
- package/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +0 -180
- package/components/TextInput/stories/CustomThemed/Themed.stories.js +0 -79
- package/es6/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +0 -180
- package/es6/components/TextInput/stories/CustomThemed/Themed.stories.js +0 -74
|
@@ -8,6 +8,7 @@ var _utils = require("../../utils");
|
|
|
8
8
|
var _propTypes = require("./propTypes");
|
|
9
9
|
var _AnnounceContext = require("../../contexts/AnnounceContext");
|
|
10
10
|
var _MessageContext = require("../../contexts/MessageContext");
|
|
11
|
+
var _OptionsContext = require("../../contexts/OptionsContext");
|
|
11
12
|
var _Box = require("../Box");
|
|
12
13
|
var _Tip = require("../Tip");
|
|
13
14
|
var _Badge = require("./Badge");
|
|
@@ -188,6 +189,8 @@ var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
188
189
|
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
189
190
|
theme = _useThemeValue.theme,
|
|
190
191
|
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
192
|
+
var _useContext = (0, _react.useContext)(_OptionsContext.OptionsContext),
|
|
193
|
+
buttonOptions = _useContext.button;
|
|
191
194
|
var _useState = (0, _react.useState)(),
|
|
192
195
|
focus = _useState[0],
|
|
193
196
|
setFocus = _useState[1];
|
|
@@ -195,8 +198,8 @@ var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
195
198
|
hover = _useState2[0],
|
|
196
199
|
setHover = _useState2[1];
|
|
197
200
|
var announce = (0, _react.useContext)(_AnnounceContext.AnnounceContext);
|
|
198
|
-
var
|
|
199
|
-
format =
|
|
201
|
+
var _useContext2 = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
202
|
+
format = _useContext2.format;
|
|
200
203
|
if (busy && success) {
|
|
201
204
|
console.warn('Button cannot have both busy and success set to true.');
|
|
202
205
|
}
|
|
@@ -441,7 +444,7 @@ var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
441
444
|
onMouseOver: onMouseOverButton,
|
|
442
445
|
onMouseOut: onMouseOutButton,
|
|
443
446
|
pad: pad,
|
|
444
|
-
plain: plain || _react.Children.count(children) > 0,
|
|
447
|
+
plain: plain || (buttonOptions == null ? void 0 : buttonOptions.childrenPlain) !== false && _react.Children.count(children) > 0,
|
|
445
448
|
primary: primary,
|
|
446
449
|
selected: selected,
|
|
447
450
|
sizeProp: size,
|
|
@@ -479,7 +482,7 @@ var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
479
482
|
onMouseOver: onMouseOverButton,
|
|
480
483
|
onMouseOut: onMouseOutButton,
|
|
481
484
|
pad: pad || !plain,
|
|
482
|
-
plain: typeof plain !== 'undefined' ? plain : _react.Children.count(children) > 0 || icon && !label,
|
|
485
|
+
plain: typeof plain !== 'undefined' ? plain : (buttonOptions == null ? void 0 : buttonOptions.childrenPlain) !== false && _react.Children.count(children) > 0 || icon && !label,
|
|
483
486
|
primary: primary,
|
|
484
487
|
sizeProp: size,
|
|
485
488
|
success: success,
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.ChildrenPlainOption = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _grommetIcons = require("grommet-icons");
|
|
7
|
+
var _grommet = require("grommet");
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
var ChildrenPlainOption = exports.ChildrenPlainOption = function ChildrenPlainOption() {
|
|
10
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
11
|
+
pad: "large",
|
|
12
|
+
gap: "large"
|
|
13
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Grommet, {
|
|
14
|
+
options: {
|
|
15
|
+
button: {
|
|
16
|
+
childrenPlain: false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
20
|
+
align: "center",
|
|
21
|
+
gap: "small"
|
|
22
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
23
|
+
size: "small",
|
|
24
|
+
color: "text-weak"
|
|
25
|
+
}, "options.button.childrenPlain defaults to true. Setting it to false stops automatically forcing plain when Button has children."), /*#__PURE__*/_react["default"].createElement(_grommet.Button, {
|
|
26
|
+
hoverIndicator: "light-1",
|
|
27
|
+
onClick: function onClick() {}
|
|
28
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
29
|
+
pad: "small",
|
|
30
|
+
direction: "row",
|
|
31
|
+
align: "center",
|
|
32
|
+
gap: "small"
|
|
33
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommetIcons.Add, null), /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "Option false"))), /*#__PURE__*/_react["default"].createElement(_grommet.Button, {
|
|
34
|
+
hoverIndicator: "light-1",
|
|
35
|
+
plain: true,
|
|
36
|
+
onClick: function onClick() {}
|
|
37
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
38
|
+
pad: "small",
|
|
39
|
+
direction: "row",
|
|
40
|
+
align: "center",
|
|
41
|
+
gap: "small"
|
|
42
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommetIcons.Add, null), /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "Explicit plain"))))), /*#__PURE__*/_react["default"].createElement(_grommet.Grommet, {
|
|
43
|
+
options: {
|
|
44
|
+
button: {
|
|
45
|
+
childrenPlain: false
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
theme: {
|
|
49
|
+
global: {
|
|
50
|
+
font: {
|
|
51
|
+
family: "-apple-system, BlinkMacSystemFont"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
button: {
|
|
55
|
+
"default": {}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
59
|
+
align: "center",
|
|
60
|
+
gap: "small"
|
|
61
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
62
|
+
size: "small",
|
|
63
|
+
color: "text-weak"
|
|
64
|
+
}, "Same behavior applies for kind buttons."), /*#__PURE__*/_react["default"].createElement(_grommet.Button, {
|
|
65
|
+
hoverIndicator: "light-1",
|
|
66
|
+
onClick: function onClick() {}
|
|
67
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
68
|
+
pad: "small",
|
|
69
|
+
direction: "row",
|
|
70
|
+
align: "center",
|
|
71
|
+
gap: "small"
|
|
72
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommetIcons.Add, null), /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "Kind option false"))), /*#__PURE__*/_react["default"].createElement(_grommet.Button, {
|
|
73
|
+
hoverIndicator: "light-1",
|
|
74
|
+
plain: true,
|
|
75
|
+
onClick: function onClick() {}
|
|
76
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
77
|
+
pad: "small",
|
|
78
|
+
direction: "row",
|
|
79
|
+
align: "center",
|
|
80
|
+
gap: "small"
|
|
81
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommetIcons.Add, null), /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "Kind explicit plain"))))));
|
|
82
|
+
};
|
|
83
|
+
ChildrenPlainOption.storyName = 'Children Plain Option';
|
|
84
|
+
var _default = exports["default"] = {
|
|
85
|
+
title: 'Controls/Button/Custom Themed/Children Plain Option'
|
|
86
|
+
};
|
|
@@ -27,7 +27,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
27
27
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
28
28
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
29
29
|
var grommetInputFocusNames = ['CheckBox', 'CheckBoxGroup', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector', 'StarRating', 'ThumbsRating'];
|
|
30
|
-
var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'SelectMultiple', 'TextArea', 'DateInput', 'FileInput', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector', 'StarRating', 'ThumbsRating'];
|
|
30
|
+
var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'SelectMultiple', 'TextArea', 'DateInput', 'TimeInput', 'FileInput', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector', 'StarRating', 'ThumbsRating'];
|
|
31
31
|
var grommetInputPadNames = ['CheckBox', 'CheckBoxGroup', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector'];
|
|
32
32
|
var isGrommetInput = function isGrommetInput(comp) {
|
|
33
33
|
return comp && (grommetInputNames.indexOf(comp.displayName) !== -1 || grommetInputPadNames.indexOf(comp.displayName) !== -1);
|
|
@@ -9,6 +9,7 @@ export interface GrommetProps {
|
|
|
9
9
|
dir?: 'rtl';
|
|
10
10
|
full?: boolean | 'min';
|
|
11
11
|
options?: {
|
|
12
|
+
button?: { childrenPlain?: boolean };
|
|
12
13
|
box?: {
|
|
13
14
|
cssGap?: boolean;
|
|
14
15
|
};
|
|
@@ -219,9 +220,29 @@ export interface GrommetProps {
|
|
|
219
220
|
skipLinks?: {
|
|
220
221
|
skipTo?: string;
|
|
221
222
|
};
|
|
223
|
+
stepper?: {
|
|
224
|
+
progress?: string;
|
|
225
|
+
step?: string;
|
|
226
|
+
};
|
|
222
227
|
tabs?: {
|
|
228
|
+
nextTab?: string;
|
|
229
|
+
previousTab?: string;
|
|
223
230
|
tabContents?: string;
|
|
224
231
|
};
|
|
232
|
+
timeInput?: {
|
|
233
|
+
activePeriodValue?: string;
|
|
234
|
+
activeSection?: string;
|
|
235
|
+
activeSectionValue?: string;
|
|
236
|
+
chooseTime?: string;
|
|
237
|
+
currentValue?: string;
|
|
238
|
+
inputLabel?: string;
|
|
239
|
+
invalidTime?: string;
|
|
240
|
+
openDrop?: string;
|
|
241
|
+
sectionHours?: string;
|
|
242
|
+
sectionMeridiem?: string;
|
|
243
|
+
sectionMinutes?: string;
|
|
244
|
+
sectionSeconds?: string;
|
|
245
|
+
};
|
|
225
246
|
textInput?: {
|
|
226
247
|
enterSelect?: string;
|
|
227
248
|
suggestionsCount?: string;
|
|
@@ -12,6 +12,12 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
12
12
|
dir: _propTypes["default"].oneOf(['rtl']),
|
|
13
13
|
full: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].oneOf(['min'])]),
|
|
14
14
|
options: _propTypes["default"].shape({
|
|
15
|
+
box: _propTypes["default"].shape({
|
|
16
|
+
cssGap: _propTypes["default"].bool
|
|
17
|
+
}),
|
|
18
|
+
button: _propTypes["default"].shape({
|
|
19
|
+
childrenPlain: _propTypes["default"].bool
|
|
20
|
+
}),
|
|
15
21
|
layer: _propTypes["default"].shape({
|
|
16
22
|
singleId: _propTypes["default"].bool
|
|
17
23
|
}),
|
|
@@ -220,7 +226,13 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
220
226
|
skipLinks: _propTypes["default"].shape({
|
|
221
227
|
skipTo: _propTypes["default"].string
|
|
222
228
|
}),
|
|
229
|
+
stepper: _propTypes["default"].shape({
|
|
230
|
+
progress: _propTypes["default"].string,
|
|
231
|
+
step: _propTypes["default"].string
|
|
232
|
+
}),
|
|
223
233
|
tabs: _propTypes["default"].shape({
|
|
234
|
+
nextTab: _propTypes["default"].string,
|
|
235
|
+
previousTab: _propTypes["default"].string,
|
|
224
236
|
tabContents: _propTypes["default"].string
|
|
225
237
|
}),
|
|
226
238
|
tag: _propTypes["default"].shape({
|
|
@@ -235,6 +247,20 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
235
247
|
suggestionsExist: _propTypes["default"].string,
|
|
236
248
|
suggestionIsOpen: _propTypes["default"].string
|
|
237
249
|
}),
|
|
250
|
+
timeInput: _propTypes["default"].shape({
|
|
251
|
+
activePeriodValue: _propTypes["default"].string,
|
|
252
|
+
activeSection: _propTypes["default"].string,
|
|
253
|
+
activeSectionValue: _propTypes["default"].string,
|
|
254
|
+
chooseTime: _propTypes["default"].string,
|
|
255
|
+
currentValue: _propTypes["default"].string,
|
|
256
|
+
inputLabel: _propTypes["default"].string,
|
|
257
|
+
invalidTime: _propTypes["default"].string,
|
|
258
|
+
openDrop: _propTypes["default"].string,
|
|
259
|
+
sectionHours: _propTypes["default"].string,
|
|
260
|
+
sectionMeridiem: _propTypes["default"].string,
|
|
261
|
+
sectionMinutes: _propTypes["default"].string,
|
|
262
|
+
sectionSeconds: _propTypes["default"].string
|
|
263
|
+
}),
|
|
238
264
|
video: _propTypes["default"].shape({
|
|
239
265
|
audioDescriptions: _propTypes["default"].string,
|
|
240
266
|
captions: _propTypes["default"].string,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.StepConnector = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
7
|
+
var _StyledStepper = require("./StyledStepper");
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
10
|
+
var StepConnector = exports.StepConnector = function StepConnector(_ref) {
|
|
11
|
+
var _theme$stepper, _theme$global, _theme$global2, _theme$global3, _theme$global4, _theme$global5;
|
|
12
|
+
var step = _ref.step,
|
|
13
|
+
direction = _ref.direction,
|
|
14
|
+
children = _ref.children;
|
|
15
|
+
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
16
|
+
theme = _useThemeValue.theme,
|
|
17
|
+
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
18
|
+
var indicatorSize = (_theme$stepper = theme.stepper) != null && (_theme$stepper = _theme$stepper.indicator) != null && _theme$stepper.size && (_theme$global = theme.global) != null && (_theme$global = _theme$global.edgeSize) != null && _theme$global[theme.stepper.indicator.size] ? theme.global.edgeSize[theme.stepper.indicator.size] : ((_theme$global2 = theme.global) == null || (_theme$global2 = _theme$global2.edgeSize) == null ? void 0 : _theme$global2.medium) || '24px';
|
|
19
|
+
var childGap = ((_theme$global3 = theme.global) == null || (_theme$global3 = _theme$global3.edgeSize) == null ? void 0 : _theme$global3.xsmall) || '8px';
|
|
20
|
+
var childPadTop = ((_theme$global4 = theme.global) == null || (_theme$global4 = _theme$global4.edgeSize) == null ? void 0 : _theme$global4.medium) || '24px';
|
|
21
|
+
var minConnectorInlineSize = ((_theme$global5 = theme.global) == null || (_theme$global5 = _theme$global5.edgeSize) == null ? void 0 : _theme$global5.small) || '12px';
|
|
22
|
+
var directionStyle = direction === 'horizontal' ? {
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
minWidth: minConnectorInlineSize
|
|
25
|
+
} : {
|
|
26
|
+
justifyContent: 'flex-start',
|
|
27
|
+
minHeight: minConnectorInlineSize
|
|
28
|
+
};
|
|
29
|
+
var renderChildren = function renderChildren() {
|
|
30
|
+
var _theme$global6;
|
|
31
|
+
if (!children) return null;
|
|
32
|
+
var childIndent = "calc(" + indicatorSize + " + " + (((_theme$global6 = theme.global) == null || (_theme$global6 = _theme$global6.edgeSize) == null ? void 0 : _theme$global6.small) || '12px') + ")";
|
|
33
|
+
return direction === 'horizontal' ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
34
|
+
style: {
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
gap: childGap,
|
|
39
|
+
paddingTop: childPadTop,
|
|
40
|
+
maxWidth: '100%',
|
|
41
|
+
flexWrap: 'wrap',
|
|
42
|
+
justifyContent: 'center'
|
|
43
|
+
}
|
|
44
|
+
}, children) : /*#__PURE__*/_react["default"].createElement("ol", {
|
|
45
|
+
style: {
|
|
46
|
+
listStyle: 'none',
|
|
47
|
+
padding: "0 0 0 " + childIndent,
|
|
48
|
+
margin: 0
|
|
49
|
+
}
|
|
50
|
+
}, children);
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
53
|
+
role: "presentation",
|
|
54
|
+
"aria-hidden": children ? undefined : 'true',
|
|
55
|
+
style: _extends({
|
|
56
|
+
display: 'flex',
|
|
57
|
+
flexDirection: 'column',
|
|
58
|
+
position: 'relative',
|
|
59
|
+
flex: 1,
|
|
60
|
+
overflow: 'visible'
|
|
61
|
+
}, directionStyle)
|
|
62
|
+
}, /*#__PURE__*/_react["default"].createElement(_StyledStepper.StyledConnector, _extends({
|
|
63
|
+
direction: direction,
|
|
64
|
+
status: step.status,
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
isBetween: true
|
|
67
|
+
}, passThemeFlag)), renderChildren());
|
|
68
|
+
};
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Stepper = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _Box = require("../Box");
|
|
7
|
+
var _MessageContext = require("../../contexts/MessageContext");
|
|
8
|
+
var _Keyboard = require("../Keyboard");
|
|
9
|
+
var _StepConnector = require("./StepConnector");
|
|
10
|
+
var _StepperContext = require("./StepperContext");
|
|
11
|
+
var _StepperStep = require("./StepperStep");
|
|
12
|
+
var _propTypes = require("./propTypes");
|
|
13
|
+
var _excluded = ["steps", "currentStep", "direction", "clickableSteps", "showDescription", "onStepClick", "aria-label", "children", "id"];
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
|
+
// Flattens steps with parent/child relationships into a linear list
|
|
18
|
+
// for keyboard navigation and index-based tracking.
|
|
19
|
+
var flattenSteps = function flattenSteps(steps) {
|
|
20
|
+
var flat = [];
|
|
21
|
+
var hasSubSubSteps = false;
|
|
22
|
+
steps.forEach(function (step, parentIdx) {
|
|
23
|
+
var hasChildren = step.children && step.children.length > 0;
|
|
24
|
+
var isLastParent = parentIdx === steps.length - 1;
|
|
25
|
+
flat.push(_extends({}, step, {
|
|
26
|
+
isSubStep: false,
|
|
27
|
+
showConnector: !isLastParent,
|
|
28
|
+
childIds: hasChildren ? step.children.map(function (c) {
|
|
29
|
+
return c.id;
|
|
30
|
+
}) : []
|
|
31
|
+
}));
|
|
32
|
+
if (hasChildren) {
|
|
33
|
+
step.children.forEach(function (child) {
|
|
34
|
+
flat.push(_extends({}, child, {
|
|
35
|
+
isSubStep: true,
|
|
36
|
+
showConnector: false,
|
|
37
|
+
parentId: step.id,
|
|
38
|
+
childIds: []
|
|
39
|
+
}));
|
|
40
|
+
if (child.children && child.children.length > 0) {
|
|
41
|
+
hasSubSubSteps = true;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
if (process.env.NODE_ENV !== 'production' && hasSubSubSteps) {
|
|
47
|
+
console.warn('Stepper: sub-steps with their own children are not supported.');
|
|
48
|
+
}
|
|
49
|
+
return flat;
|
|
50
|
+
};
|
|
51
|
+
var Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
52
|
+
var _ref$steps = _ref.steps,
|
|
53
|
+
steps = _ref$steps === void 0 ? [] : _ref$steps,
|
|
54
|
+
currentStep = _ref.currentStep,
|
|
55
|
+
_ref$direction = _ref.direction,
|
|
56
|
+
directionProp = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
|
|
57
|
+
_ref$clickableSteps = _ref.clickableSteps,
|
|
58
|
+
clickableSteps = _ref$clickableSteps === void 0 ? true : _ref$clickableSteps,
|
|
59
|
+
_ref$showDescription = _ref.showDescription,
|
|
60
|
+
showDescription = _ref$showDescription === void 0 ? true : _ref$showDescription,
|
|
61
|
+
onStepClick = _ref.onStepClick,
|
|
62
|
+
ariaLabel = _ref['aria-label'],
|
|
63
|
+
children = _ref.children,
|
|
64
|
+
id = _ref.id,
|
|
65
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
66
|
+
var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
67
|
+
format = _useContext.format;
|
|
68
|
+
var stepRefs = (0, _react.useRef)(new Map());
|
|
69
|
+
var flatSteps = (0, _react.useMemo)(function () {
|
|
70
|
+
return flattenSteps(steps);
|
|
71
|
+
}, [steps]);
|
|
72
|
+
var stepsRef = (0, _react.useRef)(flatSteps);
|
|
73
|
+
stepsRef.current = flatSteps;
|
|
74
|
+
(0, _react.useEffect)(function () {
|
|
75
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
76
|
+
console.warn('Warning: Stepper is currently in beta. The API is subject ' + 'to change in future releases.');
|
|
77
|
+
}
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
// Force vertical if steps have children
|
|
81
|
+
// (horizontal substeps not supported)
|
|
82
|
+
var hasSubSteps = steps.some(function (step) {
|
|
83
|
+
return step.children && step.children.length > 0;
|
|
84
|
+
});
|
|
85
|
+
var direction = hasSubSteps && directionProp === 'horizontal' ? 'vertical' : directionProp;
|
|
86
|
+
|
|
87
|
+
// Warn in dev about invalid state
|
|
88
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
89
|
+
if (hasSubSteps && directionProp === 'horizontal') {
|
|
90
|
+
console.warn('Stepper: horizontal direction with sub-steps is not supported. ' + 'Falling back to vertical.');
|
|
91
|
+
}
|
|
92
|
+
if (currentStep) {
|
|
93
|
+
var currentStepObj = flatSteps.find(function (s) {
|
|
94
|
+
return s.id === currentStep;
|
|
95
|
+
});
|
|
96
|
+
if (!currentStepObj) {
|
|
97
|
+
console.warn('Stepper: currentStep "' + (currentStep + "\" does not match any ") + 'step id. Falling back to the ' + 'first non-disabled step.');
|
|
98
|
+
} else if (currentStepObj.status === 'disabled') {
|
|
99
|
+
console.warn("Stepper: currentStep \"" + currentStep + "\" matches a disabled step. " + "This is an invalid state. The step will render as disabled.");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Determine effective current step (fallback to first non-disabled)
|
|
105
|
+
var effectiveCurrentStep = (0, _react.useMemo)(function () {
|
|
106
|
+
var _flatSteps$;
|
|
107
|
+
var match = flatSteps.find(function (s) {
|
|
108
|
+
return s.id === currentStep;
|
|
109
|
+
});
|
|
110
|
+
if (match && match.status !== 'disabled') return currentStep;
|
|
111
|
+
var fallback = flatSteps.find(function (s) {
|
|
112
|
+
return s.status !== 'disabled';
|
|
113
|
+
});
|
|
114
|
+
return fallback ? fallback.id : ((_flatSteps$ = flatSteps[0]) == null ? void 0 : _flatSteps$.id) || '';
|
|
115
|
+
}, [currentStep, flatSteps]);
|
|
116
|
+
|
|
117
|
+
// Roving tabindex: only the focused step has tabIndex=0,
|
|
118
|
+
// all others have tabIndex=-1. A ref keeps the index synchronous
|
|
119
|
+
// for keyboard handlers that fire before React re-renders.
|
|
120
|
+
var currentIndex = flatSteps.findIndex(function (s) {
|
|
121
|
+
return s.id === effectiveCurrentStep;
|
|
122
|
+
});
|
|
123
|
+
var flatStepsLength = flatSteps.length;
|
|
124
|
+
var _useState = (0, _react.useState)(currentIndex >= 0 ? currentIndex : 0),
|
|
125
|
+
focusedIndex = _useState[0],
|
|
126
|
+
setFocusedIndex = _useState[1];
|
|
127
|
+
var focusedIndexRef = (0, _react.useRef)(focusedIndex);
|
|
128
|
+
var updateFocusedIndex = (0, _react.useCallback)(function (idx) {
|
|
129
|
+
focusedIndexRef.current = idx;
|
|
130
|
+
setFocusedIndex(idx);
|
|
131
|
+
}, []);
|
|
132
|
+
var stepIndex = (0, _react.useCallback)(function (stepId) {
|
|
133
|
+
return flatSteps.findIndex(function (s) {
|
|
134
|
+
return s.id === stepId;
|
|
135
|
+
});
|
|
136
|
+
}, [flatSteps]);
|
|
137
|
+
var isPriorStep = (0, _react.useCallback)(function (stepId) {
|
|
138
|
+
var idx = stepIndex(stepId);
|
|
139
|
+
var curIdx = stepIndex(effectiveCurrentStep);
|
|
140
|
+
return idx < curIdx;
|
|
141
|
+
}, [stepIndex, effectiveCurrentStep]);
|
|
142
|
+
var isAfterStep = (0, _react.useCallback)(function (stepId) {
|
|
143
|
+
var idx = stepIndex(stepId);
|
|
144
|
+
var curIdx = stepIndex(effectiveCurrentStep);
|
|
145
|
+
return idx > curIdx;
|
|
146
|
+
}, [stepIndex, effectiveCurrentStep]);
|
|
147
|
+
var isCurrentStep = (0, _react.useCallback)(function (stepId) {
|
|
148
|
+
return stepId === effectiveCurrentStep;
|
|
149
|
+
}, [effectiveCurrentStep]);
|
|
150
|
+
var canNavigateTo = (0, _react.useCallback)(function (stepId) {
|
|
151
|
+
var step = flatSteps.find(function (s) {
|
|
152
|
+
return s.id === stepId;
|
|
153
|
+
});
|
|
154
|
+
return clickableSteps && step && step.status !== 'disabled';
|
|
155
|
+
}, [flatSteps, clickableSteps]);
|
|
156
|
+
var contextValue = (0, _react.useMemo)(function () {
|
|
157
|
+
return {
|
|
158
|
+
currentStep: effectiveCurrentStep,
|
|
159
|
+
steps: flatSteps,
|
|
160
|
+
direction: direction,
|
|
161
|
+
clickableSteps: clickableSteps,
|
|
162
|
+
onStepClick: onStepClick,
|
|
163
|
+
showDescription: showDescription,
|
|
164
|
+
stepIndex: stepIndex,
|
|
165
|
+
isPriorStep: isPriorStep,
|
|
166
|
+
isAfterStep: isAfterStep,
|
|
167
|
+
isCurrentStep: isCurrentStep,
|
|
168
|
+
canNavigateTo: canNavigateTo
|
|
169
|
+
};
|
|
170
|
+
}, [effectiveCurrentStep, flatSteps, direction, clickableSteps, onStepClick, showDescription, stepIndex, isPriorStep, isAfterStep, isCurrentStep, canNavigateTo]);
|
|
171
|
+
|
|
172
|
+
// Wraps around the step list to find the next step
|
|
173
|
+
// in the given direction (+1 forward, -1 backward).
|
|
174
|
+
var findNextEnabledIndex = (0, _react.useCallback)(function (startIndex, delta) {
|
|
175
|
+
return (startIndex + delta + flatStepsLength) % flatStepsLength;
|
|
176
|
+
}, [flatStepsLength]);
|
|
177
|
+
var findFirstEnabledIndex = (0, _react.useCallback)(function () {
|
|
178
|
+
return 0;
|
|
179
|
+
}, []);
|
|
180
|
+
var findLastEnabledIndex = (0, _react.useCallback)(function () {
|
|
181
|
+
return flatStepsLength - 1;
|
|
182
|
+
}, [flatStepsLength]);
|
|
183
|
+
var moveFocus = (0, _react.useCallback)(function (nextIndex) {
|
|
184
|
+
if (nextIndex !== undefined && nextIndex !== focusedIndexRef.current) {
|
|
185
|
+
updateFocusedIndex(nextIndex);
|
|
186
|
+
var nextButton = stepRefs.current.get(nextIndex);
|
|
187
|
+
if (nextButton) {
|
|
188
|
+
nextButton.focus();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}, [updateFocusedIndex]);
|
|
192
|
+
var onNext = (0, _react.useCallback)(function () {
|
|
193
|
+
moveFocus(findNextEnabledIndex(focusedIndexRef.current, 1));
|
|
194
|
+
}, [findNextEnabledIndex, moveFocus]);
|
|
195
|
+
var onPrevious = (0, _react.useCallback)(function () {
|
|
196
|
+
moveFocus(findNextEnabledIndex(focusedIndexRef.current, -1));
|
|
197
|
+
}, [findNextEnabledIndex, moveFocus]);
|
|
198
|
+
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
199
|
+
var isHorizontal = direction === 'horizontal';
|
|
200
|
+
switch (event.key) {
|
|
201
|
+
case 'ArrowRight':
|
|
202
|
+
if (isHorizontal) {
|
|
203
|
+
event.preventDefault();
|
|
204
|
+
onNext();
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
case 'ArrowLeft':
|
|
208
|
+
if (isHorizontal) {
|
|
209
|
+
event.preventDefault();
|
|
210
|
+
onPrevious();
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
case 'ArrowDown':
|
|
214
|
+
if (!isHorizontal) {
|
|
215
|
+
event.preventDefault();
|
|
216
|
+
onNext();
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
case 'ArrowUp':
|
|
220
|
+
if (!isHorizontal) {
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
onPrevious();
|
|
223
|
+
}
|
|
224
|
+
break;
|
|
225
|
+
case 'Home':
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
moveFocus(findFirstEnabledIndex());
|
|
228
|
+
break;
|
|
229
|
+
case 'End':
|
|
230
|
+
event.preventDefault();
|
|
231
|
+
moveFocus(findLastEnabledIndex());
|
|
232
|
+
break;
|
|
233
|
+
default:
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
}, [direction, onNext, onPrevious, findFirstEnabledIndex, findLastEnabledIndex, moveFocus]);
|
|
237
|
+
var renderDefaultSteps = function renderDefaultSteps() {
|
|
238
|
+
var flatIndex = 0;
|
|
239
|
+
var elements = [];
|
|
240
|
+
steps.forEach(function (step, parentIdx) {
|
|
241
|
+
var parentFlatIndex = flatIndex;
|
|
242
|
+
flatIndex += 1;
|
|
243
|
+
var childElements = step.children ? step.children.map(function (child) {
|
|
244
|
+
var childFlatIndex = flatIndex;
|
|
245
|
+
flatIndex += 1;
|
|
246
|
+
return /*#__PURE__*/_react["default"].createElement(_StepperStep.StepperStep, {
|
|
247
|
+
key: child.id,
|
|
248
|
+
step: child,
|
|
249
|
+
stepNumber: childFlatIndex + 1,
|
|
250
|
+
isLast: false,
|
|
251
|
+
showConnector: false,
|
|
252
|
+
direction: direction,
|
|
253
|
+
focusedIndex: focusedIndex,
|
|
254
|
+
index: childFlatIndex,
|
|
255
|
+
isSubStep: true,
|
|
256
|
+
onFocusStep: updateFocusedIndex,
|
|
257
|
+
stepsRef: stepsRef,
|
|
258
|
+
stepRefs: stepRefs
|
|
259
|
+
});
|
|
260
|
+
}) : null;
|
|
261
|
+
var isLastParent = parentIdx === steps.length - 1;
|
|
262
|
+
elements.push(/*#__PURE__*/_react["default"].createElement(_StepperStep.StepperStep, {
|
|
263
|
+
key: step.id,
|
|
264
|
+
step: step,
|
|
265
|
+
stepNumber: parentFlatIndex + 1,
|
|
266
|
+
isLast: isLastParent,
|
|
267
|
+
showConnector: direction === 'horizontal' ? false : !isLastParent || !!childElements,
|
|
268
|
+
direction: direction,
|
|
269
|
+
focusedIndex: focusedIndex,
|
|
270
|
+
index: parentFlatIndex,
|
|
271
|
+
isSubStep: false,
|
|
272
|
+
onFocusStep: updateFocusedIndex,
|
|
273
|
+
stepsRef: stepsRef,
|
|
274
|
+
stepRefs: stepRefs
|
|
275
|
+
}));
|
|
276
|
+
if (!isLastParent || childElements && direction === 'vertical') {
|
|
277
|
+
elements.push(/*#__PURE__*/_react["default"].createElement(_StepConnector.StepConnector, {
|
|
278
|
+
key: step.id + "-connector",
|
|
279
|
+
step: step,
|
|
280
|
+
direction: direction
|
|
281
|
+
}, childElements));
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
return elements;
|
|
285
|
+
};
|
|
286
|
+
var stepperContent = /*#__PURE__*/_react["default"].createElement(_Box.Box, _extends({
|
|
287
|
+
ref: ref,
|
|
288
|
+
as: "ol",
|
|
289
|
+
"aria-label": ariaLabel || format({
|
|
290
|
+
id: 'stepper.progress'
|
|
291
|
+
}),
|
|
292
|
+
direction: direction === 'horizontal' ? 'row' : 'column',
|
|
293
|
+
fill: direction,
|
|
294
|
+
id: id,
|
|
295
|
+
overflow: "hidden",
|
|
296
|
+
pad: "none",
|
|
297
|
+
margin: "none",
|
|
298
|
+
style: {
|
|
299
|
+
listStyle: 'none'
|
|
300
|
+
}
|
|
301
|
+
}, rest), children || renderDefaultSteps());
|
|
302
|
+
return /*#__PURE__*/_react["default"].createElement(_StepperContext.StepperContext.Provider, {
|
|
303
|
+
value: contextValue
|
|
304
|
+
}, clickableSteps ? /*#__PURE__*/_react["default"].createElement(_Keyboard.Keyboard, {
|
|
305
|
+
onKeyDown: handleKeyDown
|
|
306
|
+
}, stepperContent) : stepperContent);
|
|
307
|
+
});
|
|
308
|
+
Stepper.displayName = 'Stepper';
|
|
309
|
+
Stepper.propTypes = _propTypes.StepperPropTypes;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.useStepper = exports.useStepItem = exports.StepperContext = exports.StepItemContext = void 0;
|
|
5
|
+
var _react = require("react");
|
|
6
|
+
var StepperContext = exports.StepperContext = /*#__PURE__*/(0, _react.createContext)({
|
|
7
|
+
currentStep: '',
|
|
8
|
+
steps: [],
|
|
9
|
+
direction: 'horizontal',
|
|
10
|
+
clickableSteps: true,
|
|
11
|
+
onStepClick: undefined,
|
|
12
|
+
showDescription: true,
|
|
13
|
+
stepIndex: function stepIndex() {
|
|
14
|
+
return -1;
|
|
15
|
+
},
|
|
16
|
+
isPriorStep: function isPriorStep() {
|
|
17
|
+
return false;
|
|
18
|
+
},
|
|
19
|
+
isAfterStep: function isAfterStep() {
|
|
20
|
+
return false;
|
|
21
|
+
},
|
|
22
|
+
isCurrentStep: function isCurrentStep() {
|
|
23
|
+
return false;
|
|
24
|
+
},
|
|
25
|
+
canNavigateTo: function canNavigateTo() {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Step-level context: provides the current step's data to subcomponents
|
|
31
|
+
var StepItemContext = exports.StepItemContext = /*#__PURE__*/(0, _react.createContext)({
|
|
32
|
+
step: null,
|
|
33
|
+
index: 0,
|
|
34
|
+
isLast: false,
|
|
35
|
+
isLabelRevealed: false,
|
|
36
|
+
isSubStep: false
|
|
37
|
+
});
|
|
38
|
+
var useStepper = exports.useStepper = function useStepper() {
|
|
39
|
+
return (0, _react.useContext)(StepperContext);
|
|
40
|
+
};
|
|
41
|
+
var useStepItem = exports.useStepItem = function useStepItem() {
|
|
42
|
+
return (0, _react.useContext)(StepItemContext);
|
|
43
|
+
};
|