grommet 2.55.0 → 2.56.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/COPYRIGHT.md +3 -1
- package/components/Button/Button.js +7 -4
- package/components/Button/stories/CustomThemed/ChildrenPlainOption.stories.js +86 -0
- package/components/Calendar/Calendar.js +2 -1
- package/components/Cards/Cards.js +1 -2
- package/components/DateTimeInput/DateTimeInput.js +1093 -0
- package/components/DateTimeInput/README.md +2 -0
- package/components/DateTimeInput/StyledDateTimeInput.js +74 -0
- package/components/DateTimeInput/index.d.ts +47 -0
- package/components/DateTimeInput/index.js +6 -0
- package/components/DateTimeInput/propTypes.js +42 -0
- package/components/DateTimeInput/stories/CustomThemed/Custom.stories.tsx +53 -0
- package/components/DateTimeInput/stories/Form.stories.tsx +44 -0
- package/components/DateTimeInput/stories/Inline.stories.tsx +45 -0
- package/components/DateTimeInput/stories/Locale.stories.tsx +59 -0
- package/components/DateTimeInput/stories/Simple.stories.tsx +23 -0
- package/components/Form/Form.js +7 -4
- package/components/Form/index.d.ts +3 -0
- package/components/Form/stories/AggregateValidation.stories.js +6 -8
- package/components/FormField/FormField.js +164 -91
- package/components/Grommet/index.d.ts +21 -0
- package/components/Grommet/propTypes.js +26 -0
- package/components/Stepper/StepConnector.js +38 -0
- package/components/Stepper/Stepper.js +303 -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 +137 -0
- package/components/Stepper/StyledStepper.js +162 -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 +692 -0
- package/components/TimeInput/TimeInputPopup.js +489 -0
- package/components/TimeInput/index.d.ts +44 -0
- package/components/TimeInput/index.js +6 -0
- package/components/TimeInput/propTypes.js +39 -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 +358 -0
- package/components/TimeInput/utils.js +192 -0
- package/components/Wizard/StyledWizard.js +16 -0
- package/components/Wizard/Wizard.js +770 -0
- package/components/Wizard/WizardContent.js +90 -0
- package/components/Wizard/WizardContext.js +35 -0
- package/components/Wizard/WizardFooter.js +123 -0
- package/components/Wizard/WizardHeader.js +63 -0
- package/components/Wizard/WizardProgress.js +84 -0
- package/components/Wizard/WizardStepHeader.js +55 -0
- package/components/Wizard/index.d.ts +171 -0
- package/components/Wizard/index.js +19 -0
- package/components/Wizard/propTypes.js +56 -0
- package/components/Wizard/stories/BasicLinear.stories.js +71 -0
- package/components/Wizard/stories/Branching.stories.js +96 -0
- package/components/Wizard/stories/Composable.stories.js +75 -0
- package/components/Wizard/stories/Controlled.stories.js +136 -0
- package/components/Wizard/stories/LongContent.stories.js +118 -0
- package/components/Wizard/stories/Modal.stories.js +143 -0
- package/components/Wizard/stories/NestedSubSteps.stories.js +79 -0
- package/components/Wizard/stories/Validation.stories.js +123 -0
- package/components/index.d.ts +6 -0
- package/components/index.js +24 -0
- package/es6/components/Button/Button.js +7 -4
- package/es6/components/Button/stories/CustomThemed/ChildrenPlainOption.stories.js +81 -0
- package/es6/components/Calendar/Calendar.js +2 -0
- package/es6/components/Cards/Cards.js +1 -2
- package/es6/components/DateTimeInput/DateTimeInput.js +1090 -0
- package/es6/components/DateTimeInput/README.md +2 -0
- package/es6/components/DateTimeInput/StyledDateTimeInput.js +68 -0
- package/es6/components/DateTimeInput/index.d.ts +47 -0
- package/es6/components/DateTimeInput/index.js +3 -0
- package/es6/components/DateTimeInput/propTypes.js +36 -0
- package/es6/components/DateTimeInput/stories/CustomThemed/Custom.stories.tsx +53 -0
- package/es6/components/DateTimeInput/stories/Form.stories.tsx +44 -0
- package/es6/components/DateTimeInput/stories/Inline.stories.tsx +45 -0
- package/es6/components/DateTimeInput/stories/Locale.stories.tsx +59 -0
- package/es6/components/DateTimeInput/stories/Simple.stories.tsx +23 -0
- package/es6/components/Form/Form.js +7 -3
- package/es6/components/Form/index.d.ts +3 -0
- package/es6/components/Form/stories/AggregateValidation.stories.js +6 -9
- package/es6/components/FormField/FormField.js +165 -91
- package/es6/components/Grommet/index.d.ts +21 -0
- package/es6/components/Grommet/propTypes.js +26 -0
- package/es6/components/Stepper/StepConnector.js +33 -0
- package/es6/components/Stepper/Stepper.js +301 -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 +133 -0
- package/es6/components/Stepper/StyledStepper.js +156 -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 +689 -0
- package/es6/components/TimeInput/TimeInputPopup.js +485 -0
- package/es6/components/TimeInput/index.d.ts +44 -0
- package/es6/components/TimeInput/index.js +1 -0
- package/es6/components/TimeInput/propTypes.js +33 -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 +355 -0
- package/es6/components/TimeInput/utils.js +187 -0
- package/es6/components/Wizard/StyledWizard.js +11 -0
- package/es6/components/Wizard/Wizard.js +768 -0
- package/es6/components/Wizard/WizardContent.js +87 -0
- package/es6/components/Wizard/WizardContext.js +31 -0
- package/es6/components/Wizard/WizardFooter.js +120 -0
- package/es6/components/Wizard/WizardHeader.js +60 -0
- package/es6/components/Wizard/WizardProgress.js +80 -0
- package/es6/components/Wizard/WizardStepHeader.js +51 -0
- package/es6/components/Wizard/index.d.ts +171 -0
- package/es6/components/Wizard/index.js +7 -0
- package/es6/components/Wizard/propTypes.js +51 -0
- package/es6/components/Wizard/stories/BasicLinear.stories.js +67 -0
- package/es6/components/Wizard/stories/Branching.stories.js +93 -0
- package/es6/components/Wizard/stories/Composable.stories.js +72 -0
- package/es6/components/Wizard/stories/Controlled.stories.js +133 -0
- package/es6/components/Wizard/stories/LongContent.stories.js +115 -0
- package/es6/components/Wizard/stories/Modal.stories.js +141 -0
- package/es6/components/Wizard/stories/NestedSubSteps.stories.js +76 -0
- package/es6/components/Wizard/stories/Validation.stories.js +118 -0
- package/es6/components/index.d.ts +6 -0
- package/es6/components/index.js +6 -0
- package/es6/index.d.ts +6 -0
- package/es6/languages/default.json +48 -0
- package/es6/themes/base.d.ts +223 -0
- package/es6/themes/base.js +366 -0
- package/es6/utils/DOM.js +11 -2
- package/es6/utils/dates.js +10 -0
- package/es6/utils/sectionHelpers.js +57 -0
- package/es6/utils/useSectionedField.js +45 -0
- package/grommet.min.js +2 -1
- package/grommet.min.js.LICENSE.txt +1 -0
- package/grommet.min.js.map +1 -1
- package/index.d.ts +6 -0
- package/languages/default.json +48 -0
- package/package.json +57 -52
- package/themes/base.d.ts +223 -0
- package/themes/base.js +366 -1
- package/tools/license-header.js +2 -0
- package/utils/DOM.js +11 -2
- package/utils/dates.js +11 -1
- package/utils/sectionHelpers.js +61 -0
- package/utils/useSectionedField.js +50 -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
|
@@ -19,15 +19,19 @@ var _FormContext = require("../Form/FormContext");
|
|
|
19
19
|
var _propTypes = require("./propTypes");
|
|
20
20
|
var _useThemeValue3 = require("../../utils/useThemeValue");
|
|
21
21
|
var _AnnounceContext = require("../../contexts/AnnounceContext");
|
|
22
|
-
var _excluded = ["
|
|
23
|
-
_excluded2 = ["
|
|
24
|
-
_excluded3 = ["
|
|
22
|
+
var _excluded = ["message", "id"],
|
|
23
|
+
_excluded2 = ["error", "info", "message", "type"],
|
|
24
|
+
_excluded3 = ["id"],
|
|
25
|
+
_excluded4 = ["component", "disabled", "invalid", "name", "onChange"],
|
|
26
|
+
_excluded5 = ["children", "className", "component", "contentProps", "disabled", "error", "help", "htmlFor", "info", "label", "margin", "name", "onBlur", "onChange", "onFocus", "pad", "required", "style", "validate", "validateOn"],
|
|
27
|
+
_excluded6 = ["aria-describedby"]; // SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
28
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
25
29
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
26
30
|
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); }
|
|
27
31
|
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
32
|
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
33
|
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'];
|
|
34
|
+
var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'SelectMultiple', 'TextArea', 'DateInput', 'DateTimeInput', 'TimeInput', 'FileInput', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector', 'StarRating', 'ThumbsRating'];
|
|
31
35
|
var grommetInputPadNames = ['CheckBox', 'CheckBoxGroup', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector'];
|
|
32
36
|
var isGrommetInput = function isGrommetInput(comp) {
|
|
33
37
|
return comp && (grommetInputNames.indexOf(comp.displayName) !== -1 || grommetInputPadNames.indexOf(comp.displayName) !== -1);
|
|
@@ -80,12 +84,22 @@ var ScreenReaderOnly = (0, _styledComponents["default"])(_Text.Text).withConfig(
|
|
|
80
84
|
displayName: "FormField__ScreenReaderOnly",
|
|
81
85
|
componentId: "sc-m9hood-5"
|
|
82
86
|
})(["position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;"]);
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
message = _ref.message,
|
|
87
|
-
type = _ref.type,
|
|
87
|
+
var MessageContent = function MessageContent(_ref) {
|
|
88
|
+
var message = _ref.message,
|
|
89
|
+
id = _ref.id,
|
|
88
90
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
91
|
+
return typeof message === 'string' ? /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({
|
|
92
|
+
id: id
|
|
93
|
+
}, rest), message) : /*#__PURE__*/_react["default"].createElement(_Box.Box, _extends({
|
|
94
|
+
id: id
|
|
95
|
+
}, rest), message);
|
|
96
|
+
};
|
|
97
|
+
var Message = function Message(_ref2) {
|
|
98
|
+
var error = _ref2.error,
|
|
99
|
+
info = _ref2.info,
|
|
100
|
+
message = _ref2.message,
|
|
101
|
+
type = _ref2.type,
|
|
102
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
89
103
|
var _useThemeValue = (0, _useThemeValue3.useThemeValue)(),
|
|
90
104
|
theme = _useThemeValue.theme,
|
|
91
105
|
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
@@ -96,24 +110,36 @@ var Message = function Message(_ref) {
|
|
|
96
110
|
icon = theme.formField[type] && theme.formField[type].icon;
|
|
97
111
|
containerProps = theme.formField[type] && theme.formField[type].container;
|
|
98
112
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
|
|
114
|
+
// id is in rest; extract it so we can place it on the outermost element
|
|
115
|
+
var id = rest.id,
|
|
116
|
+
contentRest = _objectWithoutPropertiesLoose(rest, _excluded3);
|
|
117
|
+
if (icon || containerProps) {
|
|
118
|
+
return /*#__PURE__*/_react["default"].createElement(StyledMessageContainer, _extends({
|
|
119
|
+
direction: "row",
|
|
120
|
+
messageType: type
|
|
121
|
+
}, containerProps, passThemeFlag, {
|
|
122
|
+
id: id
|
|
123
|
+
}), icon && /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
124
|
+
flex: false
|
|
125
|
+
}, icon), /*#__PURE__*/_react["default"].createElement(MessageContent, _extends({
|
|
126
|
+
message: message
|
|
127
|
+
}, contentRest)));
|
|
128
|
+
}
|
|
129
|
+
return /*#__PURE__*/_react["default"].createElement(MessageContent, _extends({
|
|
130
|
+
message: message,
|
|
131
|
+
id: id
|
|
132
|
+
}, contentRest));
|
|
107
133
|
}
|
|
108
134
|
return null;
|
|
109
135
|
};
|
|
110
|
-
var Input = function Input(
|
|
111
|
-
var component =
|
|
112
|
-
disabled =
|
|
113
|
-
invalid =
|
|
114
|
-
name =
|
|
115
|
-
_onChange =
|
|
116
|
-
rest = _objectWithoutPropertiesLoose(
|
|
136
|
+
var Input = function Input(_ref3) {
|
|
137
|
+
var component = _ref3.component,
|
|
138
|
+
disabled = _ref3.disabled,
|
|
139
|
+
invalid = _ref3.invalid,
|
|
140
|
+
name = _ref3.name,
|
|
141
|
+
_onChange = _ref3.onChange,
|
|
142
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded4);
|
|
117
143
|
var formContext = (0, _react.useContext)(_FormContext.FormContext);
|
|
118
144
|
var _formContext$useFormI = formContext.useFormInput({
|
|
119
145
|
name: name,
|
|
@@ -144,29 +170,58 @@ var Input = function Input(_ref2) {
|
|
|
144
170
|
"aria-invalid": invalid || undefined
|
|
145
171
|
}, rest, extraProps));
|
|
146
172
|
};
|
|
147
|
-
|
|
173
|
+
|
|
174
|
+
// Adds aria-describedby (linking to the error Message) and aria-invalid to
|
|
175
|
+
// a Grommet input child when the field has an error. Merges with any
|
|
176
|
+
// aria-describedby the consumer already put on the child instead of
|
|
177
|
+
// overwriting it.
|
|
178
|
+
var getChildErrorProps = function getChildErrorProps(child, errorId, error) {
|
|
179
|
+
if (!errorId && !error) return {};
|
|
180
|
+
var props = {};
|
|
181
|
+
if (errorId) {
|
|
182
|
+
var existingDescribedBy = child.props['aria-describedby'];
|
|
183
|
+
props['aria-describedby'] = existingDescribedBy ? existingDescribedBy + " " + errorId : errorId;
|
|
184
|
+
}
|
|
185
|
+
if (error) props['aria-invalid'] = true;
|
|
186
|
+
return props;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// Backwards compatibility: defaults plain/focusIndicator/pad on a Grommet
|
|
190
|
+
// input child, unless the consumer already set plain or focusIndicator.
|
|
191
|
+
// This is the same logic FormField has always had; only pulled out into
|
|
192
|
+
// its own function so it can be reasoned about independent of the newer
|
|
193
|
+
// error-linking logic above.
|
|
194
|
+
var getChildFocusProps = function getChildFocusProps(child, themeBorder, containerFocus, formFieldTheme) {
|
|
195
|
+
var _formFieldTheme$check;
|
|
196
|
+
return !themeBorder || child.props.plain !== undefined || child.props.focusIndicator !== undefined ? {} : {
|
|
197
|
+
plain: true,
|
|
198
|
+
focusIndicator: !containerFocus,
|
|
199
|
+
pad: child.type.displayName === 'CheckBox' ? formFieldTheme == null || (_formFieldTheme$check = formFieldTheme.checkBox) == null ? void 0 : _formFieldTheme$check.pad : undefined
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
var FormField = exports.FormField = /*#__PURE__*/(0, _react.forwardRef)(function (_ref4, ref) {
|
|
148
203
|
var _theme$formField2, _theme$global$input, _formFieldTheme$disab, _formFieldTheme$disab2;
|
|
149
|
-
var children =
|
|
150
|
-
className =
|
|
151
|
-
component =
|
|
152
|
-
contentProps =
|
|
153
|
-
disabled =
|
|
154
|
-
errorProp =
|
|
155
|
-
help =
|
|
156
|
-
htmlFor =
|
|
157
|
-
infoProp =
|
|
158
|
-
label =
|
|
159
|
-
margin =
|
|
160
|
-
name =
|
|
161
|
-
_onBlur =
|
|
162
|
-
onChange =
|
|
163
|
-
_onFocus =
|
|
164
|
-
pad =
|
|
165
|
-
required =
|
|
166
|
-
style =
|
|
167
|
-
validate =
|
|
168
|
-
validateOn =
|
|
169
|
-
rest = _objectWithoutPropertiesLoose(
|
|
204
|
+
var children = _ref4.children,
|
|
205
|
+
className = _ref4.className,
|
|
206
|
+
component = _ref4.component,
|
|
207
|
+
contentProps = _ref4.contentProps,
|
|
208
|
+
disabled = _ref4.disabled,
|
|
209
|
+
errorProp = _ref4.error,
|
|
210
|
+
help = _ref4.help,
|
|
211
|
+
htmlFor = _ref4.htmlFor,
|
|
212
|
+
infoProp = _ref4.info,
|
|
213
|
+
label = _ref4.label,
|
|
214
|
+
margin = _ref4.margin,
|
|
215
|
+
name = _ref4.name,
|
|
216
|
+
_onBlur = _ref4.onBlur,
|
|
217
|
+
onChange = _ref4.onChange,
|
|
218
|
+
_onFocus = _ref4.onFocus,
|
|
219
|
+
pad = _ref4.pad,
|
|
220
|
+
required = _ref4.required,
|
|
221
|
+
style = _ref4.style,
|
|
222
|
+
validate = _ref4.validate,
|
|
223
|
+
validateOn = _ref4.validateOn,
|
|
224
|
+
rest = _objectWithoutPropertiesLoose(_ref4, _excluded5);
|
|
170
225
|
var _useThemeValue2 = (0, _useThemeValue3.useThemeValue)(),
|
|
171
226
|
theme = _useThemeValue2.theme,
|
|
172
227
|
passThemeFlag = _useThemeValue2.passThemeFlag;
|
|
@@ -205,7 +260,7 @@ var FormField = exports.FormField = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
205
260
|
if (children) {
|
|
206
261
|
_react.Children.map(children, function (child) {
|
|
207
262
|
var _child$props, _child$props2;
|
|
208
|
-
if (((child == null || (_child$props = child.props) == null ? void 0 : _child$props.readOnly) === true || (child == null || (_child$props2 = child.props) == null ? void 0 : _child$props2.readOnlyCopy) === true) && child.type && (
|
|
263
|
+
if (((child == null || (_child$props = child.props) == null ? void 0 : _child$props.readOnly) === true || (child == null || (_child$props2 = child.props) == null ? void 0 : _child$props2.readOnlyCopy) === true) && child.type && (child.type.displayName === 'TextInput' || child.type.displayName === 'DateInput')) {
|
|
209
264
|
readOnly = true;
|
|
210
265
|
}
|
|
211
266
|
});
|
|
@@ -223,37 +278,74 @@ var FormField = exports.FormField = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
223
278
|
return focusIndicatorFlag;
|
|
224
279
|
}, [children, (_theme$formField2 = theme.formField) == null || (_theme$formField2 = _theme$formField2.focus) == null ? void 0 : _theme$formField2.containerFocus]);
|
|
225
280
|
|
|
281
|
+
// Check if child is Select or SelectMultiple and modify htmlFor if needed
|
|
282
|
+
var adjustedHtmlFor = htmlFor;
|
|
283
|
+
if (htmlFor) {
|
|
284
|
+
var isSelectComponent = false;
|
|
285
|
+
|
|
286
|
+
// Check if children contain Select or SelectMultiple
|
|
287
|
+
if (children) {
|
|
288
|
+
_react.Children.forEach(children, function (child) {
|
|
289
|
+
if (child && child.type && (child.type.displayName === 'Select' || child.type.displayName === 'SelectMultiple') && child.props.id === htmlFor) {
|
|
290
|
+
isSelectComponent = true;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// If it's a Select component and htmlFor doesn't end with __input, add it
|
|
296
|
+
if (isSelectComponent && !htmlFor.endsWith('__input')) {
|
|
297
|
+
adjustedHtmlFor = htmlFor + "__input";
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
226
301
|
// This is here for backwards compatibility. In case the child is a grommet
|
|
227
302
|
// input component, set plain and focusIndicator props, if they aren't
|
|
228
303
|
// already set.
|
|
229
304
|
var wantContentPad = component && (component === _CheckBox.CheckBox || component === _CheckBoxGroup.CheckBoxGroup || component === _RadioButtonGroup.RadioButtonGroup);
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
305
|
+
|
|
306
|
+
// id of the error Message, used to link it to its input via
|
|
307
|
+
// aria-describedby. Always computed when there's an error + htmlFor,
|
|
308
|
+
// regardless of theme border config.
|
|
309
|
+
var errorId = error && htmlFor ? "grommet-" + adjustedHtmlFor + "__error" : undefined;
|
|
310
|
+
|
|
311
|
+
// Single Children.map pass applying both the error-linking props
|
|
312
|
+
// (getChildErrorProps) and the plain/focusIndicator/pad backwards-compat
|
|
313
|
+
// defaults (getChildFocusProps) to each Grommet input child. Must run
|
|
314
|
+
// the same way regardless of `error`, or a child's reconciliation key
|
|
315
|
+
// changes between renders - remounting it and losing state (e.g. a
|
|
316
|
+
// typed value) right when the error appears.
|
|
317
|
+
var contents;
|
|
318
|
+
if (children) {
|
|
319
|
+
contents = _react.Children.map(children, function (child) {
|
|
320
|
+
if (!child || !child.type || !isGrommetInput(child.type)) return child;
|
|
321
|
+
if (themeBorder && grommetInputPadNames.indexOf(child.type.displayName) !== -1) {
|
|
322
|
+
wantContentPad = true;
|
|
323
|
+
}
|
|
324
|
+
var newProps = _extends({}, getChildErrorProps(child, errorId, error), getChildFocusProps(child, themeBorder, containerFocus, formFieldTheme));
|
|
325
|
+
return Object.keys(newProps).length ? /*#__PURE__*/(0, _react.cloneElement)(child, newProps) : child;
|
|
326
|
+
});
|
|
327
|
+
} else {
|
|
328
|
+
contents = children;
|
|
329
|
+
}
|
|
245
330
|
|
|
246
331
|
// put rest on container, unless we use internal Input
|
|
247
332
|
var containerRest = rest;
|
|
248
333
|
if (inForm) {
|
|
249
334
|
if (!contents) containerRest = {};
|
|
335
|
+
// Merge aria-describedby with the error id rather than
|
|
336
|
+
// letting either one silently win.
|
|
337
|
+
var ariaDescribedBy = rest['aria-describedby'],
|
|
338
|
+
restWithoutAria = _objectWithoutPropertiesLoose(rest, _excluded6);
|
|
339
|
+
var combinedAriaDescribedBy = errorId ? [ariaDescribedBy, errorId].filter(Boolean).join(' ') : ariaDescribedBy;
|
|
250
340
|
contents = contents || /*#__PURE__*/_react["default"].createElement(Input, _extends({
|
|
251
341
|
component: component,
|
|
252
342
|
disabled: disabled,
|
|
253
343
|
invalid: !!error,
|
|
254
344
|
name: name,
|
|
255
345
|
label: component === _CheckBox.CheckBox ? label : undefined
|
|
256
|
-
},
|
|
346
|
+
}, restWithoutAria, {
|
|
347
|
+
"aria-describedby": combinedAriaDescribedBy || undefined
|
|
348
|
+
}));
|
|
257
349
|
}
|
|
258
350
|
var themeContentProps = _extends({}, formFieldTheme.content);
|
|
259
351
|
if (!pad && !wantContentPad) {
|
|
@@ -273,9 +365,11 @@ var FormField = exports.FormField = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
273
365
|
// fileinput handle
|
|
274
366
|
// use fileinput plain use formfield to drive the border
|
|
275
367
|
var isFileInputComponent;
|
|
276
|
-
if (children
|
|
277
|
-
|
|
278
|
-
|
|
368
|
+
if (children) {
|
|
369
|
+
_react.Children.forEach(children, function (child) {
|
|
370
|
+
if (child && child.type && child.type.displayName === 'FileInput') isFileInputComponent = true;
|
|
371
|
+
});
|
|
372
|
+
}
|
|
279
373
|
if (component && component.displayName === 'FileInput' && !isFileInputComponent) {
|
|
280
374
|
isFileInputComponent = true;
|
|
281
375
|
}
|
|
@@ -314,10 +408,7 @@ var FormField = exports.FormField = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
314
408
|
} else {
|
|
315
409
|
borderColor = themeBorder && themeBorder.color || 'border';
|
|
316
410
|
}
|
|
317
|
-
var labelStyle;
|
|
318
|
-
if (formKind) {
|
|
319
|
-
labelStyle = _extends({}, formFieldTheme[formKind].label);
|
|
320
|
-
} else labelStyle = _extends({}, formFieldTheme.label);
|
|
411
|
+
var labelStyle = _extends({}, formKind ? formFieldTheme[formKind].label : formFieldTheme.label);
|
|
321
412
|
if (disabled) {
|
|
322
413
|
labelStyle.color = formFieldTheme.disabled && formFieldTheme.disabled.label ? formFieldTheme.disabled.label.color : labelStyle.color;
|
|
323
414
|
}
|
|
@@ -405,26 +496,6 @@ var FormField = exports.FormField = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
405
496
|
}, "*"), /*#__PURE__*/_react["default"].createElement(ScreenReaderOnly, null, "required"));
|
|
406
497
|
var showRequiredIndicator = required && requiredIndicator;
|
|
407
498
|
if (typeof required === 'object' && required.indicator === false) showRequiredIndicator = false;
|
|
408
|
-
|
|
409
|
-
// Check if child is Select or SelectMultiple and modify htmlFor if needed
|
|
410
|
-
var adjustedHtmlFor = htmlFor;
|
|
411
|
-
if (htmlFor) {
|
|
412
|
-
var isSelectComponent = false;
|
|
413
|
-
|
|
414
|
-
// Check if children contain Select or SelectMultiple
|
|
415
|
-
if (children) {
|
|
416
|
-
_react.Children.forEach(children, function (child) {
|
|
417
|
-
if (child && child.type && (child.type.displayName === 'Select' || child.type.displayName === 'SelectMultiple') && child.props.id === htmlFor) {
|
|
418
|
-
isSelectComponent = true;
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// If it's a Select component and htmlFor doesn't end with __input, add it
|
|
424
|
-
if (isSelectComponent && !htmlFor.endsWith('__input')) {
|
|
425
|
-
adjustedHtmlFor = htmlFor + "__input";
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
499
|
return /*#__PURE__*/_react["default"].createElement(FormFieldBox, _extends({
|
|
429
500
|
ref: formFieldRef,
|
|
430
501
|
className: className,
|
|
@@ -471,7 +542,9 @@ var FormField = exports.FormField = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
471
542
|
}, themeHelpProps))) : undefined, contents, /*#__PURE__*/_react["default"].createElement(Message, _extends({
|
|
472
543
|
type: "error",
|
|
473
544
|
message: error
|
|
474
|
-
}, formFieldTheme.error
|
|
545
|
+
}, formFieldTheme.error, {
|
|
546
|
+
id: errorId
|
|
547
|
+
})), /*#__PURE__*/_react["default"].createElement(Message, _extends({
|
|
475
548
|
type: "info",
|
|
476
549
|
message: info
|
|
477
550
|
}, themeInfoProps)));
|
|
@@ -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,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.StepConnector = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
7
|
+
var _isPropValid = _interopRequireDefault(require("@emotion/is-prop-valid"));
|
|
8
|
+
var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
9
|
+
var _StyledStepper = require("./StyledStepper");
|
|
10
|
+
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); }
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
+
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); } // SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
13
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
|
+
var StyledStepConnectorGroup = _styledComponents["default"].div.withConfig({
|
|
15
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
16
|
+
return (0, _isPropValid["default"])(prop) && prop !== 'direction';
|
|
17
|
+
}
|
|
18
|
+
}).withConfig({
|
|
19
|
+
displayName: "StepConnector__StyledStepConnectorGroup",
|
|
20
|
+
componentId: "sc-1k7y9sb-0"
|
|
21
|
+
})(["display:flex;flex-direction:column;position:relative;flex:1;overflow:visible;", ""], function (props) {
|
|
22
|
+
return props.direction === 'horizontal' && (0, _styledComponents.css)(["align-items:center;"]);
|
|
23
|
+
});
|
|
24
|
+
var StepConnector = exports.StepConnector = function StepConnector(_ref) {
|
|
25
|
+
var step = _ref.step,
|
|
26
|
+
direction = _ref.direction,
|
|
27
|
+
children = _ref.children;
|
|
28
|
+
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
29
|
+
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
30
|
+
return /*#__PURE__*/_react["default"].createElement(StyledStepConnectorGroup, _extends({
|
|
31
|
+
direction: direction
|
|
32
|
+
}, passThemeFlag), /*#__PURE__*/_react["default"].createElement(_StyledStepper.StyledConnector, _extends({
|
|
33
|
+
direction: direction,
|
|
34
|
+
status: step.status,
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
isBetween: true
|
|
37
|
+
}, passThemeFlag)), children);
|
|
38
|
+
};
|