grommet 2.57.0 → 2.58.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/Box/StyledBox.js +1 -1
- package/components/Box/stories/ColorContrast.stories.js +36 -0
- package/components/Button/BusyAnimation.js +7 -1
- package/components/Button/Button.js +12 -3
- package/components/DataTable/StyledDataTable.js +1 -1
- package/components/DateInput/DateInput.js +3 -3
- package/components/DateTimeInput/DateTimeInput.js +17 -11
- package/components/FocusedContainer.js +2 -1
- package/components/FormField/FormField.js +31 -10
- package/components/FormField/FormFieldContext.js +12 -0
- package/components/Grommet/Grommet.js +4 -1
- package/components/Grommet/StyledGrommet.js +3 -3
- package/components/Grommet/index.d.ts +6 -0
- package/components/Grommet/propTypes.js +2 -0
- package/components/Menu/Menu.js +1 -1
- package/components/Select/SelectContainer.js +2 -2
- package/components/Select/StyledSelect.js +3 -1
- package/components/TextArea/StyledTextArea.js +3 -1
- package/components/TextInput/CopyButton.js +23 -6
- package/components/TextInput/StyledTextInput.js +19 -25
- package/components/TextInput/TextInput.js +75 -28
- package/components/TextInput/index.d.ts +12 -3
- package/components/TextInput/propTypes.js +2 -0
- package/components/TextInput/stories/Copy.stories.tsx +42 -0
- package/components/TextInput/stories/CopySecret.stories.tsx +44 -0
- package/components/TimeInput/README.md +24 -1
- package/components/TimeInput/StyledTimeInput.js +91 -27
- package/components/TimeInput/TimeInput.js +185 -120
- package/components/TimeInput/TimeInputPopup.js +114 -117
- package/components/TimeInput/index.d.ts +2 -0
- package/components/TimeInput/propTypes.js +2 -0
- package/components/TimeInput/stories/Controlled.stories.tsx +2 -2
- package/components/TimeInput/stories/CustomThemed.stories.tsx +79 -0
- package/components/TimeInput/stories/CustomThemedHpe.stories.tsx +115 -0
- package/components/TimeInput/stories/Form.stories.tsx +1 -0
- package/components/TimeInput/stories/ShowSeconds.stories.tsx +28 -0
- package/components/TimeInput/useSectionedTimeField.js +2 -2
- package/components/TimeInput/utils.js +13 -62
- package/components/Wizard/Wizard.js +396 -210
- package/components/Wizard/WizardContent.js +61 -35
- package/components/Wizard/WizardContext.js +3 -0
- package/components/Wizard/WizardFooter.js +14 -15
- package/components/Wizard/WizardHeader.js +12 -7
- package/components/Wizard/WizardProgress.js +27 -2
- package/components/Wizard/index.d.ts +35 -4
- package/components/Wizard/propTypes.js +6 -1
- package/components/Wizard/stories/BasicLinear.stories.js +12 -10
- package/components/Wizard/stories/ClickableSteps.stories.js +104 -0
- package/components/Wizard/stories/ExternalForm.stories.js +114 -0
- package/components/Wizard/stories/NonClosableHeader.stories.js +68 -0
- package/components/Wizard/stories/Validation.stories.js +18 -8
- package/es6/components/Box/StyledBox.js +1 -1
- package/es6/components/Box/stories/ColorContrast.stories.js +31 -0
- package/es6/components/Button/BusyAnimation.js +7 -1
- package/es6/components/Button/Button.js +12 -3
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DateInput/DateInput.js +3 -3
- package/es6/components/DateTimeInput/DateTimeInput.js +17 -11
- package/es6/components/FocusedContainer.js +2 -1
- package/es6/components/FormField/FormField.js +31 -10
- package/es6/components/FormField/FormFieldContext.js +7 -0
- package/es6/components/Grommet/Grommet.js +4 -1
- package/es6/components/Grommet/StyledGrommet.js +4 -4
- package/es6/components/Grommet/index.d.ts +6 -0
- package/es6/components/Grommet/propTypes.js +2 -0
- package/es6/components/Menu/Menu.js +1 -1
- package/es6/components/Select/SelectContainer.js +2 -2
- package/es6/components/Select/StyledSelect.js +4 -2
- package/es6/components/TextArea/StyledTextArea.js +4 -2
- package/es6/components/TextInput/CopyButton.js +22 -6
- package/es6/components/TextInput/StyledTextInput.js +20 -26
- package/es6/components/TextInput/TextInput.js +76 -29
- package/es6/components/TextInput/index.d.ts +12 -3
- package/es6/components/TextInput/propTypes.js +2 -0
- package/es6/components/TextInput/stories/Copy.stories.tsx +42 -0
- package/es6/components/TextInput/stories/CopySecret.stories.tsx +44 -0
- package/es6/components/TimeInput/README.md +24 -1
- package/es6/components/TimeInput/StyledTimeInput.js +92 -28
- package/es6/components/TimeInput/TimeInput.js +187 -122
- package/es6/components/TimeInput/TimeInputPopup.js +115 -118
- package/es6/components/TimeInput/index.d.ts +2 -0
- package/es6/components/TimeInput/propTypes.js +2 -0
- package/es6/components/TimeInput/stories/Controlled.stories.tsx +2 -2
- package/es6/components/TimeInput/stories/CustomThemed.stories.tsx +79 -0
- package/es6/components/TimeInput/stories/CustomThemedHpe.stories.tsx +115 -0
- package/es6/components/TimeInput/stories/Form.stories.tsx +1 -0
- package/es6/components/TimeInput/stories/ShowSeconds.stories.tsx +28 -0
- package/es6/components/TimeInput/useSectionedTimeField.js +2 -2
- package/es6/components/TimeInput/utils.js +12 -61
- package/es6/components/Wizard/Wizard.js +397 -211
- package/es6/components/Wizard/WizardContent.js +62 -36
- package/es6/components/Wizard/WizardContext.js +3 -0
- package/es6/components/Wizard/WizardFooter.js +14 -15
- package/es6/components/Wizard/WizardHeader.js +12 -7
- package/es6/components/Wizard/WizardProgress.js +27 -2
- package/es6/components/Wizard/index.d.ts +35 -4
- package/es6/components/Wizard/propTypes.js +6 -1
- package/es6/components/Wizard/stories/BasicLinear.stories.js +11 -11
- package/es6/components/Wizard/stories/ClickableSteps.stories.js +99 -0
- package/es6/components/Wizard/stories/ExternalForm.stories.js +111 -0
- package/es6/components/Wizard/stories/NonClosableHeader.stories.js +63 -0
- package/es6/components/Wizard/stories/Validation.stories.js +18 -9
- package/es6/languages/default.json +2 -0
- package/es6/themes/base.d.ts +79 -59
- package/es6/themes/base.js +65 -34
- package/es6/utils/DOM.js +10 -7
- package/es6/utils/background.js +9 -7
- package/es6/utils/colors.js +84 -12
- package/es6/utils/legacyColorIsDark.js +17 -0
- package/es6/utils/styles.js +13 -5
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +2 -0
- package/package.json +3 -3
- package/themes/base.d.ts +79 -59
- package/themes/base.js +65 -34
- package/tools/draft-release-version-pr.js +1 -0
- package/tools/generate-release-notes.js +1 -1
- package/tools/release-notes-utils.js +1 -0
- package/utils/DOM.js +10 -7
- package/utils/background.js +9 -7
- package/utils/colors.js +84 -12
- package/utils/legacyColorIsDark.js +21 -0
- package/utils/styles.js +14 -6
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
var _excluded = ["
|
|
1
|
+
var _excluded = ["hover", "selected"],
|
|
2
|
+
_excluded2 = ["hover"],
|
|
3
|
+
_excluded3 = ["activeSection", "align", "format", "formatMessage", "hoursOptions", "focusOnOpen", "id", "incrementSection", "messages", "minuteOptions", "onClose", "onFocusLeave", "secondOptions", "sectionOrder", "sections", "setActiveSection", "setSectionValue", "target", "dropProps", "label", "inline", "onKeyDown"],
|
|
4
|
+
_excluded4 = ["column", "option"];
|
|
2
5
|
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); }
|
|
3
6
|
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; }
|
|
4
7
|
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
@@ -7,7 +10,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
7
10
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
8
11
|
import styled from 'styled-components';
|
|
9
12
|
import { useLayoutEffect } from '../../utils/use-isomorphic-layout-effect';
|
|
10
|
-
import { edgeStyle,
|
|
13
|
+
import { backgroundStyle, borderStyle, edgeStyle, elevationStyle, focusStyle, roundStyle } from '../../utils';
|
|
11
14
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
12
15
|
import { Box } from '../Box';
|
|
13
16
|
import { Drop } from '../Drop';
|
|
@@ -16,36 +19,22 @@ import { defaultHourForFormat, pad, getSectionName, SECTION_HOUR, SECTION_MINUTE
|
|
|
16
19
|
var PopupColumnBox = styled(Box).withConfig({
|
|
17
20
|
displayName: "TimeInputPopup__PopupColumnBox",
|
|
18
21
|
componentId: "sc-r2j8uh-0"
|
|
19
|
-
})(["scrollbar-gutter:stable;
|
|
20
|
-
var PopupOption = styled.
|
|
22
|
+
})(["scrollbar-gutter:stable;"]);
|
|
23
|
+
var PopupOption = styled(Box).withConfig({
|
|
21
24
|
displayName: "TimeInputPopup__PopupOption",
|
|
22
25
|
componentId: "sc-r2j8uh-1"
|
|
23
|
-
})(["
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
return normalizeColor((_props$theme$timeInpu3 = props.theme.timeInput) == null || (_props$theme$timeInpu3 = _props$theme$timeInpu3.drop) == null || (_props$theme$timeInpu3 = _props$theme$timeInpu3.option) == null || (_props$theme$timeInpu3 = _props$theme$timeInpu3.selected) == null ? void 0 : _props$theme$timeInpu3.background, props.theme);
|
|
36
|
-
}
|
|
37
|
-
if (props.$active) {
|
|
38
|
-
var _props$theme$timeInpu4;
|
|
39
|
-
return normalizeColor((_props$theme$timeInpu4 = props.theme.timeInput) == null || (_props$theme$timeInpu4 = _props$theme$timeInpu4.drop) == null || (_props$theme$timeInpu4 = _props$theme$timeInpu4.option) == null || (_props$theme$timeInpu4 = _props$theme$timeInpu4.hover) == null ? void 0 : _props$theme$timeInpu4.background, props.theme);
|
|
40
|
-
}
|
|
41
|
-
return normalizeColor((_props$theme$timeInpu5 = props.theme.timeInput) == null || (_props$theme$timeInpu5 = _props$theme$timeInpu5.drop) == null || (_props$theme$timeInpu5 = _props$theme$timeInpu5.option) == null ? void 0 : _props$theme$timeInpu5.background, props.theme);
|
|
42
|
-
}, function (props) {
|
|
43
|
-
var _props$theme$timeInpu8;
|
|
44
|
-
if (props.$selected) {
|
|
45
|
-
var _props$theme$timeInpu6, _props$theme$timeInpu7;
|
|
46
|
-
return normalizeColor(((_props$theme$timeInpu6 = props.theme.timeInput) == null || (_props$theme$timeInpu6 = _props$theme$timeInpu6.drop) == null || (_props$theme$timeInpu6 = _props$theme$timeInpu6.option) == null || (_props$theme$timeInpu6 = _props$theme$timeInpu6.selected) == null || (_props$theme$timeInpu6 = _props$theme$timeInpu6.hover) == null ? void 0 : _props$theme$timeInpu6.background) || ((_props$theme$timeInpu7 = props.theme.timeInput) == null || (_props$theme$timeInpu7 = _props$theme$timeInpu7.drop) == null || (_props$theme$timeInpu7 = _props$theme$timeInpu7.option) == null || (_props$theme$timeInpu7 = _props$theme$timeInpu7.selected) == null ? void 0 : _props$theme$timeInpu7.background), props.theme);
|
|
47
|
-
}
|
|
48
|
-
return normalizeColor((_props$theme$timeInpu8 = props.theme.timeInput) == null || (_props$theme$timeInpu8 = _props$theme$timeInpu8.drop) == null || (_props$theme$timeInpu8 = _props$theme$timeInpu8.option) == null || (_props$theme$timeInpu8 = _props$theme$timeInpu8.hover) == null ? void 0 : _props$theme$timeInpu8.background, props.theme);
|
|
26
|
+
})(["cursor:pointer;&:hover{", "}&:focus-visible{", "}"], function (props) {
|
|
27
|
+
var theme = props.theme,
|
|
28
|
+
$hoverState = props.$hoverState,
|
|
29
|
+
$hoverBackground = props.$hoverBackground;
|
|
30
|
+
var responsive = props.responsive === undefined ? true : props.responsive;
|
|
31
|
+
var styles = [];
|
|
32
|
+
if ($hoverBackground !== undefined) styles.push(backgroundStyle($hoverBackground, theme));
|
|
33
|
+
if (($hoverState == null ? void 0 : $hoverState.border) !== undefined) styles.push(borderStyle($hoverState.border, responsive, theme));
|
|
34
|
+
if (($hoverState == null ? void 0 : $hoverState.elevation) !== undefined) styles.push(elevationStyle($hoverState.elevation));
|
|
35
|
+
if (($hoverState == null ? void 0 : $hoverState.pad) !== undefined) styles.push(edgeStyle('padding', $hoverState.pad, responsive, theme.box.responsiveBreakpoint, theme));
|
|
36
|
+
if (($hoverState == null ? void 0 : $hoverState.round) !== undefined) styles.push($hoverState.round === false ? 'border-radius: 0;' : roundStyle($hoverState.round, responsive, theme));
|
|
37
|
+
return styles;
|
|
49
38
|
}, focusStyle({
|
|
50
39
|
inset: true
|
|
51
40
|
}));
|
|
@@ -64,7 +53,7 @@ var getDefaultPopupOption = function getDefaultPopupOption(_ref) {
|
|
|
64
53
|
return options[0];
|
|
65
54
|
};
|
|
66
55
|
var PopupColumn = function PopupColumn(_ref2) {
|
|
67
|
-
var _theme$
|
|
56
|
+
var _theme$timeInput;
|
|
68
57
|
var activeSection = _ref2.activeSection,
|
|
69
58
|
format = _ref2.format,
|
|
70
59
|
formatMessage = _ref2.formatMessage,
|
|
@@ -72,37 +61,40 @@ var PopupColumn = function PopupColumn(_ref2) {
|
|
|
72
61
|
label = _ref2.label,
|
|
73
62
|
messages = _ref2.messages,
|
|
74
63
|
onClickCommitOption = _ref2.onClickCommitOption,
|
|
75
|
-
onPointerCommitOption = _ref2.onPointerCommitOption,
|
|
76
64
|
onSetSection = _ref2.onSetSection,
|
|
77
65
|
options = _ref2.options,
|
|
78
66
|
section = _ref2.section,
|
|
79
67
|
sections = _ref2.sections,
|
|
80
|
-
theme = _ref2.theme
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var maxHeight = maxHeightToken && ((_theme$global$size = theme.global.size) == null ? void 0 : _theme$global$size[maxHeightToken]) || ((_theme$timeInput = theme.timeInput) == null || (_theme$timeInput = _theme$timeInput.drop) == null || (_theme$timeInput = _theme$timeInput.column) == null ? void 0 : _theme$timeInput.maxHeight) || theme.global.size.small;
|
|
85
|
-
return /*#__PURE__*/React.createElement(PopupColumnBox, {
|
|
68
|
+
theme = _ref2.theme,
|
|
69
|
+
passThemeFlag = _ref2.passThemeFlag;
|
|
70
|
+
var columnTheme = ((_theme$timeInput = theme.timeInput) == null || (_theme$timeInput = _theme$timeInput.drop) == null ? void 0 : _theme$timeInput.column) || {};
|
|
71
|
+
return /*#__PURE__*/React.createElement(PopupColumnBox, _extends({
|
|
86
72
|
role: "listbox",
|
|
87
73
|
"aria-label": label,
|
|
88
|
-
gap: ((_theme$timeInput2 = theme.timeInput) == null || (_theme$timeInput2 = _theme$timeInput2.drop) == null || (_theme$timeInput2 = _theme$timeInput2.option) == null ? void 0 : _theme$timeInput2.gap) || 'xxsmall',
|
|
89
|
-
height: {
|
|
90
|
-
max: maxHeight
|
|
91
|
-
},
|
|
92
74
|
overflow: "auto",
|
|
93
75
|
flex: {
|
|
94
76
|
grow: 0,
|
|
95
77
|
shrink: 0
|
|
96
78
|
}
|
|
97
|
-
}, options.map(function (option) {
|
|
98
|
-
var _theme$timeInput3, _theme$timeInput4, _theme$timeInput5;
|
|
79
|
+
}, columnTheme, passThemeFlag), options.map(function (option) {
|
|
80
|
+
var _theme$timeInput2, _theme$timeInput3, _theme$timeInput4, _theme$timeInput5, _ref3, _hoverState$backgroun, _theme$timeInput6, _theme$timeInput7, _theme$timeInput8, _theme$timeInput$drop, _theme$timeInput9, _theme$timeInput0, _theme$timeInput1;
|
|
99
81
|
var key = optionKey(label, option);
|
|
100
82
|
var sectionHasValue = section === SECTION_HOUR && sections.hour !== undefined || section === SECTION_MINUTE && sections.minute !== undefined || section === SECTION_SECOND && sections.second !== undefined || section === SECTION_PERIOD && sections.period !== undefined;
|
|
101
83
|
|
|
102
84
|
// In empty state, keep focus defaults but avoid visually selecting
|
|
103
85
|
// options until the user makes an explicit choice.
|
|
104
86
|
var selected = section === SECTION_HOUR && sections.hour === option || section === SECTION_MINUTE && sections.minute === option || section === SECTION_SECOND && sections.second === option || section === SECTION_PERIOD && sections.period === option;
|
|
105
|
-
var optionColor = selected ? ((_theme$timeInput3 = theme.timeInput) == null || (_theme$timeInput3 = _theme$timeInput3.drop) == null || (_theme$timeInput3 = _theme$timeInput3.option) == null || (_theme$timeInput3 = _theme$timeInput3.
|
|
87
|
+
var optionColor = selected ? ((_theme$timeInput2 = theme.timeInput) == null || (_theme$timeInput2 = _theme$timeInput2.drop) == null || (_theme$timeInput2 = _theme$timeInput2.option) == null || (_theme$timeInput2 = _theme$timeInput2.text) == null || (_theme$timeInput2 = _theme$timeInput2.selected) == null ? void 0 : _theme$timeInput2.color) || ((_theme$timeInput3 = theme.timeInput) == null || (_theme$timeInput3 = _theme$timeInput3.drop) == null || (_theme$timeInput3 = _theme$timeInput3.option) == null || (_theme$timeInput3 = _theme$timeInput3.text) == null ? void 0 : _theme$timeInput3.color) || 'text' : ((_theme$timeInput4 = theme.timeInput) == null || (_theme$timeInput4 = _theme$timeInput4.drop) == null || (_theme$timeInput4 = _theme$timeInput4.option) == null || (_theme$timeInput4 = _theme$timeInput4.text) == null ? void 0 : _theme$timeInput4.color) || 'text';
|
|
88
|
+
var optionContainer = ((_theme$timeInput5 = theme.timeInput) == null || (_theme$timeInput5 = _theme$timeInput5.drop) == null || (_theme$timeInput5 = _theme$timeInput5.option) == null ? void 0 : _theme$timeInput5.container) || {};
|
|
89
|
+
var optionHover = optionContainer.hover,
|
|
90
|
+
_optionContainer$sele = optionContainer.selected,
|
|
91
|
+
selectedContainer = _optionContainer$sele === void 0 ? {} : _optionContainer$sele,
|
|
92
|
+
baseOptionStyles = _objectWithoutPropertiesLoose(optionContainer, _excluded);
|
|
93
|
+
var selectedHover = selectedContainer.hover,
|
|
94
|
+
selectedOptionStyles = _objectWithoutPropertiesLoose(selectedContainer, _excluded2);
|
|
95
|
+
var optionStyles = selected ? _extends({}, baseOptionStyles, selectedOptionStyles) : baseOptionStyles;
|
|
96
|
+
var hoverState = selected ? selectedHover : optionHover;
|
|
97
|
+
var hoverBackground = selected ? (_ref3 = (_hoverState$backgroun = hoverState == null ? void 0 : hoverState.background) != null ? _hoverState$backgroun : selectedContainer.background) != null ? _ref3 : baseOptionStyles.background : hoverState == null ? void 0 : hoverState.background;
|
|
106
98
|
var isActive = selected && activeSection === section;
|
|
107
99
|
var optionTabIndex = -1;
|
|
108
100
|
if (inline) {
|
|
@@ -119,66 +111,66 @@ var PopupColumn = function PopupColumn(_ref2) {
|
|
|
119
111
|
} else if (isActive) {
|
|
120
112
|
optionTabIndex = 0;
|
|
121
113
|
}
|
|
122
|
-
return /*#__PURE__*/React.createElement(PopupOption, {
|
|
114
|
+
return /*#__PURE__*/React.createElement(PopupOption, _extends({
|
|
123
115
|
key: key,
|
|
124
|
-
"data-option-key": key,
|
|
125
116
|
role: "option",
|
|
117
|
+
"data-option-key": key,
|
|
126
118
|
"aria-selected": selected,
|
|
127
119
|
tabIndex: optionTabIndex,
|
|
128
120
|
"aria-label": (section === SECTION_PERIOD ? option : pad(option)) + " " + getSectionName(section, format, formatMessage, messages),
|
|
129
|
-
|
|
130
|
-
$
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
},
|
|
121
|
+
flex: false,
|
|
122
|
+
$hoverState: hoverState,
|
|
123
|
+
$hoverBackground: hoverBackground
|
|
124
|
+
}, optionStyles, {
|
|
125
|
+
// This option owns its inset :focus-visible indicator. Box's
|
|
126
|
+
// focus tracking can retain state when tabIndex becomes -1.
|
|
127
|
+
focusIndicator: false,
|
|
137
128
|
onClick: function onClick() {
|
|
138
129
|
return onClickCommitOption(section, option);
|
|
139
130
|
},
|
|
140
131
|
onFocus: function onFocus() {
|
|
141
132
|
return onSetSection(section);
|
|
142
133
|
}
|
|
143
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
144
|
-
size: ((_theme$
|
|
145
|
-
weight: selected ? (_theme$
|
|
146
|
-
color: optionColor
|
|
134
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
135
|
+
size: selected ? ((_theme$timeInput6 = theme.timeInput) == null || (_theme$timeInput6 = _theme$timeInput6.drop) == null || (_theme$timeInput6 = _theme$timeInput6.option) == null || (_theme$timeInput6 = _theme$timeInput6.text) == null || (_theme$timeInput6 = _theme$timeInput6.selected) == null ? void 0 : _theme$timeInput6.size) || ((_theme$timeInput7 = theme.timeInput) == null || (_theme$timeInput7 = _theme$timeInput7.drop) == null || (_theme$timeInput7 = _theme$timeInput7.option) == null || (_theme$timeInput7 = _theme$timeInput7.text) == null ? void 0 : _theme$timeInput7.size) || theme.global.input.font.size || 'small' : ((_theme$timeInput8 = theme.timeInput) == null || (_theme$timeInput8 = _theme$timeInput8.drop) == null || (_theme$timeInput8 = _theme$timeInput8.option) == null || (_theme$timeInput8 = _theme$timeInput8.text) == null ? void 0 : _theme$timeInput8.size) || theme.global.input.font.size || 'small',
|
|
136
|
+
weight: selected ? (_theme$timeInput$drop = (_theme$timeInput9 = theme.timeInput) == null || (_theme$timeInput9 = _theme$timeInput9.drop) == null || (_theme$timeInput9 = _theme$timeInput9.option) == null || (_theme$timeInput9 = _theme$timeInput9.text) == null || (_theme$timeInput9 = _theme$timeInput9.selected) == null ? void 0 : _theme$timeInput9.weight) != null ? _theme$timeInput$drop : (_theme$timeInput0 = theme.timeInput) == null || (_theme$timeInput0 = _theme$timeInput0.drop) == null || (_theme$timeInput0 = _theme$timeInput0.option) == null || (_theme$timeInput0 = _theme$timeInput0.text) == null ? void 0 : _theme$timeInput0.weight : (_theme$timeInput1 = theme.timeInput) == null || (_theme$timeInput1 = _theme$timeInput1.drop) == null || (_theme$timeInput1 = _theme$timeInput1.option) == null || (_theme$timeInput1 = _theme$timeInput1.text) == null ? void 0 : _theme$timeInput1.weight,
|
|
137
|
+
color: optionColor,
|
|
138
|
+
textAlign: "center"
|
|
147
139
|
}, section === SECTION_PERIOD ? option : pad(option)));
|
|
148
140
|
}));
|
|
149
141
|
};
|
|
150
|
-
var TimeInputPopup = function TimeInputPopup(
|
|
151
|
-
var _theme$
|
|
152
|
-
var activeSection =
|
|
153
|
-
align =
|
|
154
|
-
format =
|
|
155
|
-
formatMessage =
|
|
156
|
-
hoursOptions =
|
|
157
|
-
|
|
158
|
-
focusOnOpen =
|
|
159
|
-
id =
|
|
160
|
-
incrementSection =
|
|
161
|
-
messages =
|
|
162
|
-
minuteOptions =
|
|
163
|
-
onClose =
|
|
164
|
-
onFocusLeave =
|
|
165
|
-
secondOptions =
|
|
166
|
-
sectionOrder =
|
|
167
|
-
sections =
|
|
168
|
-
setActiveSection =
|
|
169
|
-
setSectionValue =
|
|
170
|
-
target =
|
|
171
|
-
dropProps =
|
|
172
|
-
label =
|
|
173
|
-
|
|
174
|
-
inline =
|
|
175
|
-
onKeyDownProp =
|
|
176
|
-
rest = _objectWithoutPropertiesLoose(
|
|
142
|
+
var TimeInputPopup = function TimeInputPopup(_ref4) {
|
|
143
|
+
var _theme$timeInput10, _dropWidth$max;
|
|
144
|
+
var activeSection = _ref4.activeSection,
|
|
145
|
+
align = _ref4.align,
|
|
146
|
+
format = _ref4.format,
|
|
147
|
+
formatMessage = _ref4.formatMessage,
|
|
148
|
+
hoursOptions = _ref4.hoursOptions,
|
|
149
|
+
_ref4$focusOnOpen = _ref4.focusOnOpen,
|
|
150
|
+
focusOnOpen = _ref4$focusOnOpen === void 0 ? true : _ref4$focusOnOpen,
|
|
151
|
+
id = _ref4.id,
|
|
152
|
+
incrementSection = _ref4.incrementSection,
|
|
153
|
+
messages = _ref4.messages,
|
|
154
|
+
minuteOptions = _ref4.minuteOptions,
|
|
155
|
+
onClose = _ref4.onClose,
|
|
156
|
+
onFocusLeave = _ref4.onFocusLeave,
|
|
157
|
+
secondOptions = _ref4.secondOptions,
|
|
158
|
+
sectionOrder = _ref4.sectionOrder,
|
|
159
|
+
sections = _ref4.sections,
|
|
160
|
+
setActiveSection = _ref4.setActiveSection,
|
|
161
|
+
setSectionValue = _ref4.setSectionValue,
|
|
162
|
+
target = _ref4.target,
|
|
163
|
+
dropProps = _ref4.dropProps,
|
|
164
|
+
label = _ref4.label,
|
|
165
|
+
_ref4$inline = _ref4.inline,
|
|
166
|
+
inline = _ref4$inline === void 0 ? false : _ref4$inline,
|
|
167
|
+
onKeyDownProp = _ref4.onKeyDown,
|
|
168
|
+
rest = _objectWithoutPropertiesLoose(_ref4, _excluded3);
|
|
177
169
|
var _useThemeValue = useThemeValue(),
|
|
178
|
-
theme = _useThemeValue.theme
|
|
170
|
+
theme = _useThemeValue.theme,
|
|
171
|
+
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
179
172
|
var dialogRef = useRef();
|
|
180
173
|
var pointerDownInsideRef = useRef(false);
|
|
181
|
-
var pointerSelectionCommittedRef = useRef(false);
|
|
182
174
|
var suppressNextAutoScrollRef = useRef(false);
|
|
183
175
|
var wheelInteractionTimeoutRef = useRef();
|
|
184
176
|
var pointerReleaseTimeoutRef = useRef();
|
|
@@ -214,18 +206,14 @@ var TimeInputPopup = function TimeInputPopup(_ref3) {
|
|
|
214
206
|
setActiveSection(section);
|
|
215
207
|
setSectionValue(section, option);
|
|
216
208
|
}, [setActiveSection, setSectionValue]);
|
|
217
|
-
|
|
218
|
-
|
|
209
|
+
|
|
210
|
+
// Commit on the up-event (click), not mousedown - see WCAG 2.5.2 (Pointer
|
|
211
|
+
// Cancellation). Committing on press would leave no way to abort by
|
|
212
|
+
// moving the pointer off-target before releasing.
|
|
213
|
+
var commitClickOptionSelection = useCallback(function (section, option) {
|
|
219
214
|
suppressNextAutoScroll();
|
|
220
215
|
commitOptionSelection(section, option);
|
|
221
216
|
}, [commitOptionSelection, suppressNextAutoScroll]);
|
|
222
|
-
var commitClickOptionSelection = useCallback(function (section, option) {
|
|
223
|
-
if (pointerSelectionCommittedRef.current) {
|
|
224
|
-
pointerSelectionCommittedRef.current = false;
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
commitOptionSelection(section, option);
|
|
228
|
-
}, [commitOptionSelection]);
|
|
229
217
|
var onPopupWheelCapture = useCallback(function () {
|
|
230
218
|
pointerDownInsideRef.current = true;
|
|
231
219
|
if (wheelInteractionTimeoutRef.current) {
|
|
@@ -264,8 +252,8 @@ var TimeInputPopup = function TimeInputPopup(_ref3) {
|
|
|
264
252
|
label: 'period',
|
|
265
253
|
options: ['AM', 'PM']
|
|
266
254
|
}];
|
|
267
|
-
var visiblePopupSections = popupSections.filter(function (
|
|
268
|
-
var section =
|
|
255
|
+
var visiblePopupSections = popupSections.filter(function (_ref5) {
|
|
256
|
+
var section = _ref5.section;
|
|
269
257
|
return sectionOrder.includes(section);
|
|
270
258
|
});
|
|
271
259
|
var getSectionFromLabel = useCallback(function (listboxLabel) {
|
|
@@ -310,8 +298,8 @@ var TimeInputPopup = function TimeInputPopup(_ref3) {
|
|
|
310
298
|
format: format,
|
|
311
299
|
options: secondOptions
|
|
312
300
|
}), _sectionValue[SECTION_PERIOD] = sections.period || 'AM', _sectionValue);
|
|
313
|
-
visiblePopupSections.forEach(function (
|
|
314
|
-
var section =
|
|
301
|
+
visiblePopupSections.forEach(function (_ref6) {
|
|
302
|
+
var section = _ref6.section;
|
|
315
303
|
var labelValue = sectionLabel[section];
|
|
316
304
|
if (!labelValue) return;
|
|
317
305
|
var listboxNode = popupNode.querySelector("[role=\"listbox\"][aria-label=\"" + labelValue + "\"]");
|
|
@@ -397,27 +385,36 @@ var TimeInputPopup = function TimeInputPopup(_ref3) {
|
|
|
397
385
|
if (rafB) window.cancelAnimationFrame(rafB);
|
|
398
386
|
};
|
|
399
387
|
}, [focusCurrentPopupOption, focusOnOpen, scrollSelectedOptionsIntoView]);
|
|
388
|
+
var dropTheme = (_theme$timeInput10 = theme.timeInput) == null ? void 0 : _theme$timeInput10.drop;
|
|
389
|
+
var column = dropTheme.column,
|
|
390
|
+
option = dropTheme.option,
|
|
391
|
+
dropBoxTheme = _objectWithoutPropertiesLoose(dropTheme, _excluded4);
|
|
392
|
+
var dropWidth = dropBoxTheme.width;
|
|
393
|
+
var popupWidth = typeof dropWidth === 'object' ? _extends({}, dropWidth, {
|
|
394
|
+
max: (_dropWidth$max = dropWidth.max) != null ? _dropWidth$max : '100%'
|
|
395
|
+
}) : {
|
|
396
|
+
width: dropWidth,
|
|
397
|
+
max: '100%'
|
|
398
|
+
};
|
|
400
399
|
var popupContent = /*#__PURE__*/React.createElement(Box, _extends({
|
|
401
400
|
ref: dialogRef,
|
|
402
401
|
role: inline ? undefined : 'dialog',
|
|
403
402
|
"aria-label": inline ? undefined : label,
|
|
404
403
|
direction: "row",
|
|
405
|
-
width:
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
gap: ((_theme$timeInput8 = theme.timeInput) == null || (_theme$timeInput8 = _theme$timeInput8.drop) == null ? void 0 : _theme$timeInput8.gap) || 'xsmall',
|
|
411
|
-
pad: inline ? 'none' : ((_theme$timeInput9 = theme.timeInput) == null || (_theme$timeInput9 = _theme$timeInput9.drop) == null ? void 0 : _theme$timeInput9.pad) || 'small',
|
|
404
|
+
width: popupWidth
|
|
405
|
+
}, dropBoxTheme, {
|
|
406
|
+
height: inline ? '100%' : dropBoxTheme.height,
|
|
407
|
+
pad: inline ? 'none' : dropBoxTheme.pad,
|
|
408
|
+
responsive: false,
|
|
412
409
|
onPointerDownCapture: markInteractionInProgress,
|
|
413
410
|
onPointerUpCapture: releaseInteractionAfterClick,
|
|
414
411
|
onPointerCancelCapture: clearInteractionInProgress,
|
|
415
412
|
onWheelCapture: onPopupWheelCapture,
|
|
416
413
|
onKeyDown: function onKeyDown(event) {
|
|
417
|
-
var
|
|
414
|
+
var _ref7;
|
|
418
415
|
var eventSectionFromTarget = getSectionFromEventTarget(event.target);
|
|
419
416
|
var eventSectionFromActiveElement = getSectionFromEventTarget(document.activeElement);
|
|
420
|
-
var eventSection = (
|
|
417
|
+
var eventSection = (_ref7 = eventSectionFromTarget != null ? eventSectionFromTarget : eventSectionFromActiveElement) != null ? _ref7 : activeSection;
|
|
421
418
|
if (event.key === 'Escape') {
|
|
422
419
|
if (onClose) {
|
|
423
420
|
event.preventDefault();
|
|
@@ -446,10 +443,10 @@ var TimeInputPopup = function TimeInputPopup(_ref3) {
|
|
|
446
443
|
setActiveSection(getAdjacentSection(eventSection, 1));
|
|
447
444
|
} else if (event.key === 'ArrowUp') {
|
|
448
445
|
event.preventDefault();
|
|
449
|
-
incrementSection(eventSection, 1);
|
|
446
|
+
incrementSection(eventSection, -1, true);
|
|
450
447
|
} else if (event.key === 'ArrowDown') {
|
|
451
448
|
event.preventDefault();
|
|
452
|
-
incrementSection(eventSection,
|
|
449
|
+
incrementSection(eventSection, 1, true);
|
|
453
450
|
}
|
|
454
451
|
onKeyDownProp == null || onKeyDownProp(event);
|
|
455
452
|
},
|
|
@@ -469,10 +466,10 @@ var TimeInputPopup = function TimeInputPopup(_ref3) {
|
|
|
469
466
|
onFocusLeave == null || onFocusLeave();
|
|
470
467
|
}
|
|
471
468
|
}
|
|
472
|
-
}, rest), visiblePopupSections.map(function (
|
|
473
|
-
var section =
|
|
474
|
-
sectionLabel =
|
|
475
|
-
options =
|
|
469
|
+
}, rest), visiblePopupSections.map(function (_ref8) {
|
|
470
|
+
var section = _ref8.section,
|
|
471
|
+
sectionLabel = _ref8.label,
|
|
472
|
+
options = _ref8.options;
|
|
476
473
|
return /*#__PURE__*/React.createElement(PopupColumn, {
|
|
477
474
|
key: sectionLabel,
|
|
478
475
|
activeSection: activeSection,
|
|
@@ -482,12 +479,12 @@ var TimeInputPopup = function TimeInputPopup(_ref3) {
|
|
|
482
479
|
label: sectionLabel,
|
|
483
480
|
messages: messages,
|
|
484
481
|
onClickCommitOption: commitClickOptionSelection,
|
|
485
|
-
onPointerCommitOption: commitPointerOptionSelection,
|
|
486
482
|
onSetSection: setActiveSection,
|
|
487
483
|
options: options,
|
|
488
484
|
section: section,
|
|
489
485
|
sections: sections,
|
|
490
|
-
theme: theme
|
|
486
|
+
theme: theme,
|
|
487
|
+
passThemeFlag: passThemeFlag
|
|
491
488
|
});
|
|
492
489
|
}));
|
|
493
490
|
if (inline) return popupContent;
|
|
@@ -7,12 +7,14 @@ export interface TimeInputProps {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
format?: '12' | '24';
|
|
9
9
|
id?: string;
|
|
10
|
+
inline?: boolean;
|
|
10
11
|
messages?: {
|
|
11
12
|
activePeriodValue?: string;
|
|
12
13
|
activeSection?: string;
|
|
13
14
|
activeSectionValue?: string;
|
|
14
15
|
chooseTime?: string;
|
|
15
16
|
currentValue?: string;
|
|
17
|
+
currentValueWithoutSeconds?: string;
|
|
16
18
|
inputLabel?: string;
|
|
17
19
|
invalidTime?: string;
|
|
18
20
|
openDrop?: string;
|
|
@@ -8,12 +8,14 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
8
8
|
disabled: PropTypes.bool,
|
|
9
9
|
format: PropTypes.oneOf(['12', '24']),
|
|
10
10
|
id: PropTypes.string,
|
|
11
|
+
inline: PropTypes.bool,
|
|
11
12
|
messages: PropTypes.shape({
|
|
12
13
|
activePeriodValue: PropTypes.string,
|
|
13
14
|
activeSection: PropTypes.string,
|
|
14
15
|
activeSectionValue: PropTypes.string,
|
|
15
16
|
chooseTime: PropTypes.string,
|
|
16
17
|
currentValue: PropTypes.string,
|
|
18
|
+
currentValueWithoutSeconds: PropTypes.string,
|
|
17
19
|
inputLabel: PropTypes.string,
|
|
18
20
|
invalidTime: PropTypes.string,
|
|
19
21
|
openDrop: PropTypes.string,
|
|
@@ -5,7 +5,7 @@ import React from 'react';
|
|
|
5
5
|
import { Box, Button, Text, TimeInput } from 'grommet';
|
|
6
6
|
|
|
7
7
|
export const Controlled = () => {
|
|
8
|
-
const [value, setValue] = React.useState('12:34
|
|
8
|
+
const [value, setValue] = React.useState('12:34');
|
|
9
9
|
|
|
10
10
|
const onChange = ({ value: next }: { value?: string }) => {
|
|
11
11
|
console.log('onChange iso time:', next);
|
|
@@ -19,7 +19,7 @@ export const Controlled = () => {
|
|
|
19
19
|
</Text>
|
|
20
20
|
<TimeInput format="12" value={value} onChange={onChange} />
|
|
21
21
|
<Box direction="row" gap="small">
|
|
22
|
-
<Button label="Set 01:02
|
|
22
|
+
<Button label="Set 01:02 PM" onClick={() => setValue('13:02')} />
|
|
23
23
|
<Button label="Clear" onClick={() => setValue('')} />
|
|
24
24
|
</Box>
|
|
25
25
|
</Box>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Box, Grommet, Heading, TimeInput, ThemeType } from 'grommet';
|
|
5
|
+
import { FormClock } from 'grommet-icons';
|
|
6
|
+
|
|
7
|
+
const theme: ThemeType = {
|
|
8
|
+
timeInput: {
|
|
9
|
+
container: {
|
|
10
|
+
border: { color: 'brand', size: 'small' },
|
|
11
|
+
round: 'small',
|
|
12
|
+
},
|
|
13
|
+
value: {
|
|
14
|
+
pad: { horizontal: 'small' },
|
|
15
|
+
background: 'background-front',
|
|
16
|
+
round: 'xsmall',
|
|
17
|
+
},
|
|
18
|
+
segment: {
|
|
19
|
+
color: 'text',
|
|
20
|
+
placeholder: { color: 'text-weak' },
|
|
21
|
+
size: 'medium',
|
|
22
|
+
weight: 500,
|
|
23
|
+
pad: 'xxsmall',
|
|
24
|
+
active: {
|
|
25
|
+
background: 'background-contrast',
|
|
26
|
+
border: { color: 'brand', side: 'bottom', size: 'small' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
dropButton: {
|
|
30
|
+
icon: <FormClock />,
|
|
31
|
+
background: 'brand',
|
|
32
|
+
color: 'white',
|
|
33
|
+
padding: { vertical: 'xsmall', horizontal: 'small' },
|
|
34
|
+
},
|
|
35
|
+
drop: {
|
|
36
|
+
background: 'background-front',
|
|
37
|
+
border: { color: 'border', size: 'small' },
|
|
38
|
+
round: 'small',
|
|
39
|
+
pad: 'xsmall',
|
|
40
|
+
width: '20rem',
|
|
41
|
+
column: {
|
|
42
|
+
height: { max: 'medium' },
|
|
43
|
+
gap: 'xxsmall',
|
|
44
|
+
pad: { horizontal: 'xsmall' },
|
|
45
|
+
round: 'small',
|
|
46
|
+
},
|
|
47
|
+
option: {
|
|
48
|
+
container: {
|
|
49
|
+
pad: { vertical: 'xsmall', horizontal: 'small' },
|
|
50
|
+
round: 'xsmall',
|
|
51
|
+
hover: { background: 'background-contrast' },
|
|
52
|
+
selected: {
|
|
53
|
+
background: 'selected',
|
|
54
|
+
hover: { background: 'brand' },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
text: {
|
|
58
|
+
size: 'small',
|
|
59
|
+
selected: { color: 'white', weight: 600 },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const CustomThemed = () => (
|
|
67
|
+
<Grommet theme={theme}>
|
|
68
|
+
<Box gap="medium" pad="large" width="medium">
|
|
69
|
+
<Heading level={3} margin="none">
|
|
70
|
+
Custom themed time input
|
|
71
|
+
</Heading>
|
|
72
|
+
<TimeInput format="12" defaultValue="10:15:20" />
|
|
73
|
+
</Box>
|
|
74
|
+
</Grommet>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
export default {
|
|
78
|
+
title: 'Input/TimeInput/Custom Themed',
|
|
79
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { hpe } from 'grommet-theme-hpe';
|
|
6
|
+
import {
|
|
7
|
+
Box,
|
|
8
|
+
Grommet,
|
|
9
|
+
Heading,
|
|
10
|
+
ThemeContext,
|
|
11
|
+
ThemeType,
|
|
12
|
+
TimeInput,
|
|
13
|
+
} from 'grommet';
|
|
14
|
+
import { deepMerge } from 'grommet/utils';
|
|
15
|
+
import {
|
|
16
|
+
components,
|
|
17
|
+
dimension,
|
|
18
|
+
global as globalTokens,
|
|
19
|
+
} from 'hpe-design-tokens/grommet';
|
|
20
|
+
|
|
21
|
+
const { hpe: hpeComponents } = components;
|
|
22
|
+
const { hpe: hpeDimension } = dimension;
|
|
23
|
+
const { hpe: hpeGlobal } = globalTokens;
|
|
24
|
+
|
|
25
|
+
const theme: ThemeType = deepMerge({}, hpe);
|
|
26
|
+
theme.timeInput = {
|
|
27
|
+
container: {
|
|
28
|
+
round: hpeComponents.formField.default.medium.input.container.borderRadius,
|
|
29
|
+
},
|
|
30
|
+
segment: {
|
|
31
|
+
pad: {
|
|
32
|
+
start: hpeDimension.spacing['5xsmall'],
|
|
33
|
+
end: hpeDimension.spacing['5xsmall'],
|
|
34
|
+
},
|
|
35
|
+
active: {
|
|
36
|
+
background: 'background-active',
|
|
37
|
+
border: {
|
|
38
|
+
size: 'small',
|
|
39
|
+
color: 'focus',
|
|
40
|
+
},
|
|
41
|
+
pad: {
|
|
42
|
+
start: hpeDimension.spacing['5xsmall'],
|
|
43
|
+
end: hpeDimension.spacing['5xsmall'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
drop: {
|
|
48
|
+
column: {
|
|
49
|
+
gap: hpeDimension.spacing['4xsmall'],
|
|
50
|
+
pad: { horizontal: '3xsmall' },
|
|
51
|
+
},
|
|
52
|
+
pad: { horizontal: '3xsmall', vertical: 'xsmall' },
|
|
53
|
+
option: {
|
|
54
|
+
container: {
|
|
55
|
+
pad: {
|
|
56
|
+
vertical: hpeComponents.element.medium.paddingY,
|
|
57
|
+
horizontal: hpeComponents.element.medium.paddingX.default,
|
|
58
|
+
},
|
|
59
|
+
round: hpeDimension.radius.xxsmall,
|
|
60
|
+
hover: {
|
|
61
|
+
background: 'background-active',
|
|
62
|
+
},
|
|
63
|
+
selected: {
|
|
64
|
+
background: 'background-selected-primary-strong',
|
|
65
|
+
hover: {
|
|
66
|
+
background: 'background-selected-primary-strong-hover',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
text: {
|
|
71
|
+
size: hpeDimension.text.medium.fontSize,
|
|
72
|
+
selected: {
|
|
73
|
+
color: 'text-onSelectedPrimaryStrong',
|
|
74
|
+
weight: hpeGlobal.fontWeight.medium,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const CustomThemedHpe = () => (
|
|
82
|
+
<Grommet theme={theme}>
|
|
83
|
+
<Box gap="xlarge" pad="large">
|
|
84
|
+
<Box width="medium" gap="medium">
|
|
85
|
+
<Heading level={3} margin="none">
|
|
86
|
+
Full TimeInput theme, extending grommet-theme-hpe
|
|
87
|
+
</Heading>
|
|
88
|
+
<TimeInput format="12" showSeconds />
|
|
89
|
+
<TimeInput format="12" />
|
|
90
|
+
<TimeInput format="24" showSeconds />
|
|
91
|
+
<TimeInput format="24" />
|
|
92
|
+
</Box>
|
|
93
|
+
<ThemeContext.Extend value={{ dark: true }}>
|
|
94
|
+
<Box
|
|
95
|
+
width="medium"
|
|
96
|
+
gap="medium"
|
|
97
|
+
pad="large"
|
|
98
|
+
background="background-front"
|
|
99
|
+
>
|
|
100
|
+
<Heading level={3} margin="none">
|
|
101
|
+
Dark Theme
|
|
102
|
+
</Heading>
|
|
103
|
+
<TimeInput format="12" showSeconds />
|
|
104
|
+
<TimeInput format="12" />
|
|
105
|
+
<TimeInput format="24" showSeconds />
|
|
106
|
+
<TimeInput format="24" />
|
|
107
|
+
</Box>
|
|
108
|
+
</ThemeContext.Extend>
|
|
109
|
+
</Box>
|
|
110
|
+
</Grommet>
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
export default {
|
|
114
|
+
title: 'Input/TimeInput/Custom Themed/Hpe',
|
|
115
|
+
};
|