grommet 2.56.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/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/Stepper/StepConnector.js +19 -49
- package/components/Stepper/Stepper.js +5 -11
- package/components/Stepper/StepperStep.js +14 -4
- package/components/Stepper/StyledStepper.js +59 -21
- package/components/TimeInput/TimeInput.js +50 -47
- package/components/TimeInput/TimeInputPopup.js +172 -76
- package/components/TimeInput/index.d.ts +3 -0
- package/components/TimeInput/propTypes.js +4 -0
- package/components/TimeInput/useSectionedTimeField.js +33 -34
- package/components/TimeInput/utils.js +31 -26
- 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 +4 -0
- package/components/index.js +12 -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/Stepper/StepConnector.js +18 -48
- package/es6/components/Stepper/Stepper.js +5 -10
- package/es6/components/Stepper/StepperStep.js +15 -4
- package/es6/components/Stepper/StyledStepper.js +57 -21
- package/es6/components/TimeInput/TimeInput.js +50 -46
- package/es6/components/TimeInput/TimeInputPopup.js +172 -76
- package/es6/components/TimeInput/index.d.ts +3 -0
- package/es6/components/TimeInput/propTypes.js +3 -0
- package/es6/components/TimeInput/useSectionedTimeField.js +34 -35
- package/es6/components/TimeInput/utils.js +25 -21
- 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 +4 -0
- package/es6/components/index.js +4 -0
- package/es6/index.d.ts +4 -0
- package/es6/languages/default.json +28 -0
- package/es6/themes/base.d.ts +115 -0
- package/es6/themes/base.js +158 -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 +4 -0
- package/languages/default.json +28 -0
- package/package.json +35 -31
- package/themes/base.d.ts +115 -0
- package/themes/base.js +158 -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
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { Box, Notification, Paragraph, TextInput, FormField } from 'grommet';
|
|
5
|
+
import { Wizard } from '../Wizard';
|
|
6
|
+
var validateEmail = function validateEmail(email) {
|
|
7
|
+
if (!email) return 'Email is required.';
|
|
8
|
+
if (!email.includes('@')) return 'Enter a valid email address.';
|
|
9
|
+
return undefined;
|
|
10
|
+
};
|
|
11
|
+
var validatePassword = function validatePassword(password) {
|
|
12
|
+
if (!password || password.length < 6) {
|
|
13
|
+
return 'Password must be at least 6 characters.';
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
};
|
|
17
|
+
var Validation = function Validation() {
|
|
18
|
+
var _useState = useState(null),
|
|
19
|
+
result = _useState[0],
|
|
20
|
+
setResult = _useState[1];
|
|
21
|
+
var steps = [{
|
|
22
|
+
id: 'email',
|
|
23
|
+
title: 'Email',
|
|
24
|
+
description: 'Enter a valid email address.',
|
|
25
|
+
skippable: true,
|
|
26
|
+
validate: function validate(value) {
|
|
27
|
+
if (value.extra !== 'please') {
|
|
28
|
+
return 'You must enter "please" in the Extra field to proceed.';
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
},
|
|
32
|
+
render: function render(/* step, api */
|
|
33
|
+
) {
|
|
34
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormField, {
|
|
35
|
+
htmlFor: "wizard-email",
|
|
36
|
+
label: "Email",
|
|
37
|
+
name: "email",
|
|
38
|
+
required: true,
|
|
39
|
+
validate: validateEmail
|
|
40
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
41
|
+
id: "wizard-email",
|
|
42
|
+
name: "email",
|
|
43
|
+
placeholder: "you@example.com"
|
|
44
|
+
})), /*#__PURE__*/React.createElement(FormField, {
|
|
45
|
+
htmlFor: "wizard-extra",
|
|
46
|
+
label: "Extra",
|
|
47
|
+
name: "extra",
|
|
48
|
+
required: true
|
|
49
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
50
|
+
id: "wizard-extra",
|
|
51
|
+
name: "extra",
|
|
52
|
+
placeholder: "Extra information"
|
|
53
|
+
})));
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
id: 'password',
|
|
57
|
+
title: 'Password',
|
|
58
|
+
description: 'Choose a password.',
|
|
59
|
+
render: function render(/* step, api */
|
|
60
|
+
) {
|
|
61
|
+
return /*#__PURE__*/React.createElement(FormField, {
|
|
62
|
+
htmlFor: "wizard-password",
|
|
63
|
+
label: "Password",
|
|
64
|
+
name: "password",
|
|
65
|
+
required: true,
|
|
66
|
+
validate: validatePassword
|
|
67
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
68
|
+
id: "wizard-password",
|
|
69
|
+
name: "password",
|
|
70
|
+
type: "password",
|
|
71
|
+
placeholder: "password"
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
id: 'confirm',
|
|
76
|
+
title: 'Confirm',
|
|
77
|
+
description: 'Ready to submit.',
|
|
78
|
+
render: function render(step, api) {
|
|
79
|
+
return /*#__PURE__*/React.createElement(Paragraph, null, "Confirm sign-up for ", api.formValue.email, ".");
|
|
80
|
+
}
|
|
81
|
+
}];
|
|
82
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
83
|
+
fill: true
|
|
84
|
+
}, /*#__PURE__*/React.createElement(Wizard, {
|
|
85
|
+
"aria-label": "Sign up",
|
|
86
|
+
title: "Create your account",
|
|
87
|
+
showProgress: "vertical",
|
|
88
|
+
steps: steps,
|
|
89
|
+
defaultValue: {
|
|
90
|
+
email: '',
|
|
91
|
+
password: ''
|
|
92
|
+
},
|
|
93
|
+
onComplete: function onComplete(_ref) {
|
|
94
|
+
var value = _ref.value;
|
|
95
|
+
return setResult({
|
|
96
|
+
status: 'complete',
|
|
97
|
+
value: value
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}), result && /*#__PURE__*/React.createElement(Notification, {
|
|
101
|
+
toast: {
|
|
102
|
+
position: 'top'
|
|
103
|
+
},
|
|
104
|
+
status: "normal",
|
|
105
|
+
title: "Wizard complete",
|
|
106
|
+
message: "Account created for " + result.value.email + ".",
|
|
107
|
+
onClose: function onClose() {
|
|
108
|
+
return setResult(null);
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
Validation.args = {
|
|
113
|
+
full: true
|
|
114
|
+
};
|
|
115
|
+
export default {
|
|
116
|
+
title: 'Layout/Wizard/Validation'
|
|
117
|
+
};
|
|
118
|
+
export { Validation };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
export * from './Accordion';
|
|
2
4
|
export * from './AccordionPanel';
|
|
3
5
|
export * from './Anchor';
|
|
@@ -30,6 +32,7 @@ export * from './DataTableColumns';
|
|
|
30
32
|
export * from './DataTableGroupBy';
|
|
31
33
|
export * from './DataView';
|
|
32
34
|
export * from './DateInput';
|
|
35
|
+
export * from './DateTimeInput';
|
|
33
36
|
export * from './Diagram';
|
|
34
37
|
export * from './Distribution';
|
|
35
38
|
export * from './Drop';
|
|
@@ -94,4 +97,5 @@ export * from './Tip';
|
|
|
94
97
|
export * from './ToggleGroup';
|
|
95
98
|
export * from './Toolbar';
|
|
96
99
|
export * from './Video';
|
|
100
|
+
export * from './Wizard';
|
|
97
101
|
export * from './WorldMap';
|
package/es6/components/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
export * from './Accordion';
|
|
2
4
|
export * from './AccordionPanel';
|
|
3
5
|
export * from './Anchor';
|
|
@@ -29,6 +31,7 @@ export * from './DataTableColumns';
|
|
|
29
31
|
export * from './DataTableGroupBy';
|
|
30
32
|
export * from './DataView';
|
|
31
33
|
export * from './DateInput';
|
|
34
|
+
export * from './DateTimeInput';
|
|
32
35
|
export * from './Diagram';
|
|
33
36
|
export * from './Distribution';
|
|
34
37
|
export * from './Drop';
|
|
@@ -95,4 +98,5 @@ export * from './Toolbar';
|
|
|
95
98
|
export * from './ToggleGroup';
|
|
96
99
|
export * from './ThumbsRating';
|
|
97
100
|
export * from './Video';
|
|
101
|
+
export * from './Wizard';
|
|
98
102
|
export * from './WorldMap';
|
package/es6/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
export * from './components/Accordion';
|
|
2
4
|
export * from './components/AccordionPanel';
|
|
3
5
|
export * from './components/Anchor';
|
|
@@ -28,6 +30,7 @@ export * from './components/DataTableColumns';
|
|
|
28
30
|
export * from './components/DataTableGroupBy';
|
|
29
31
|
export * from './components/DataView';
|
|
30
32
|
export * from './components/DateInput';
|
|
33
|
+
export * from './components/DateTimeInput';
|
|
31
34
|
export * from './components/Diagram';
|
|
32
35
|
export * from './components/Distribution';
|
|
33
36
|
export * from './components/Drop';
|
|
@@ -94,6 +97,7 @@ export * from './components/Tip';
|
|
|
94
97
|
export * from './components/ToggleGroup';
|
|
95
98
|
export * from './components/Toolbar';
|
|
96
99
|
export * from './components/Video';
|
|
100
|
+
export * from './components/Wizard';
|
|
97
101
|
export * from './components/WorldMap';
|
|
98
102
|
export * from './contexts/AnnounceContext';
|
|
99
103
|
export * from './contexts/ContainerTargetContext';
|
|
@@ -25,6 +25,21 @@
|
|
|
25
25
|
"exitCalendar": "Exited calendar dialog",
|
|
26
26
|
"outOfBounds": "Date is out of the allowed range. Enter a date between {start} and {end}."
|
|
27
27
|
},
|
|
28
|
+
"dateTimeInput": {
|
|
29
|
+
"inputLabel": "Date and time input",
|
|
30
|
+
"chooseDateTime": "Open date and time picker",
|
|
31
|
+
"openDrop": "Press space to open date and time picker",
|
|
32
|
+
"invalidDateTime": "Invalid date or time value",
|
|
33
|
+
"activeSection": "{section} selected",
|
|
34
|
+
"activeSectionValue": "{value}",
|
|
35
|
+
"sectionDay": "day",
|
|
36
|
+
"sectionMonth": "month",
|
|
37
|
+
"sectionYear": "year",
|
|
38
|
+
"sectionHours": "hours",
|
|
39
|
+
"sectionMinutes": "minutes",
|
|
40
|
+
"sectionSeconds": "seconds",
|
|
41
|
+
"sectionMeridiem": "meridiem"
|
|
42
|
+
},
|
|
28
43
|
"dataChart": {
|
|
29
44
|
"detailTitle": "Data chart",
|
|
30
45
|
"detailFocus": "Use the left and right arrow keys to navigate the chart data."
|
|
@@ -245,5 +260,18 @@
|
|
|
245
260
|
"playButton": "play",
|
|
246
261
|
"volumeDown": "volume down",
|
|
247
262
|
"volumeUp": "volume up"
|
|
263
|
+
},
|
|
264
|
+
"wizard": {
|
|
265
|
+
"previous": "Previous",
|
|
266
|
+
"next": "Next",
|
|
267
|
+
"skip": "Skip",
|
|
268
|
+
"cancel": "Cancel",
|
|
269
|
+
"close": "Close",
|
|
270
|
+
"complete": "Complete",
|
|
271
|
+
"stepHeader": {
|
|
272
|
+
"counter": "Step {step} of {total}"
|
|
273
|
+
},
|
|
274
|
+
"progress": "Wizard progress",
|
|
275
|
+
"validationError": "Please complete required fields."
|
|
248
276
|
}
|
|
249
277
|
}
|
package/es6/themes/base.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
import {
|
|
2
4
|
FlattenInterpolation,
|
|
3
5
|
FlattenSimpleInterpolation,
|
|
@@ -1025,6 +1027,36 @@ export interface ThemeType {
|
|
|
1025
1027
|
size?: string;
|
|
1026
1028
|
};
|
|
1027
1029
|
};
|
|
1030
|
+
dateTimeInput?: {
|
|
1031
|
+
button?: {
|
|
1032
|
+
margin?: string | object;
|
|
1033
|
+
};
|
|
1034
|
+
container?: {
|
|
1035
|
+
round?: RoundType;
|
|
1036
|
+
};
|
|
1037
|
+
active?: {
|
|
1038
|
+
background?: ColorType;
|
|
1039
|
+
pad?: string;
|
|
1040
|
+
indicator?: {
|
|
1041
|
+
color?: ColorType;
|
|
1042
|
+
size?: string;
|
|
1043
|
+
};
|
|
1044
|
+
};
|
|
1045
|
+
drop?: {
|
|
1046
|
+
pad?: PadType;
|
|
1047
|
+
gap?: GapType;
|
|
1048
|
+
border?: {
|
|
1049
|
+
color?: ColorType;
|
|
1050
|
+
size?: string;
|
|
1051
|
+
};
|
|
1052
|
+
};
|
|
1053
|
+
icon?: {
|
|
1054
|
+
calendar?: React.ReactNode | Icon;
|
|
1055
|
+
};
|
|
1056
|
+
separator?: {
|
|
1057
|
+
pad?: GapType;
|
|
1058
|
+
};
|
|
1059
|
+
};
|
|
1028
1060
|
dataTable?: {
|
|
1029
1061
|
body?: {
|
|
1030
1062
|
extend?: ExtendType;
|
|
@@ -2161,6 +2193,22 @@ export interface ThemeType {
|
|
|
2161
2193
|
size?: string;
|
|
2162
2194
|
color?: ColorType;
|
|
2163
2195
|
};
|
|
2196
|
+
button?: {
|
|
2197
|
+
pad?: EdgeSizeType;
|
|
2198
|
+
};
|
|
2199
|
+
horizontal?: {
|
|
2200
|
+
connector?: {
|
|
2201
|
+
margin?: EdgeSizeType;
|
|
2202
|
+
};
|
|
2203
|
+
button?: {
|
|
2204
|
+
gap?: GapType;
|
|
2205
|
+
};
|
|
2206
|
+
};
|
|
2207
|
+
vertical?: {
|
|
2208
|
+
button?: {
|
|
2209
|
+
gap?: GapType;
|
|
2210
|
+
};
|
|
2211
|
+
};
|
|
2164
2212
|
hover?: {
|
|
2165
2213
|
background?: BackgroundType;
|
|
2166
2214
|
border?: ColorType;
|
|
@@ -2436,6 +2484,73 @@ export interface ThemeType {
|
|
|
2436
2484
|
};
|
|
2437
2485
|
};
|
|
2438
2486
|
};
|
|
2487
|
+
wizard?: {
|
|
2488
|
+
container?: {
|
|
2489
|
+
gap?: GapType;
|
|
2490
|
+
background?: BackgroundType;
|
|
2491
|
+
};
|
|
2492
|
+
body?: {
|
|
2493
|
+
pad?: PadType;
|
|
2494
|
+
gap?: GridGapType;
|
|
2495
|
+
};
|
|
2496
|
+
header?: {
|
|
2497
|
+
pad?: PadType;
|
|
2498
|
+
background?: BackgroundType;
|
|
2499
|
+
title?: {
|
|
2500
|
+
size?: string;
|
|
2501
|
+
};
|
|
2502
|
+
close?: {
|
|
2503
|
+
icon?: React.ReactNode | Icon;
|
|
2504
|
+
};
|
|
2505
|
+
};
|
|
2506
|
+
progress?: {
|
|
2507
|
+
horizontal?: {
|
|
2508
|
+
pad?: PadType;
|
|
2509
|
+
};
|
|
2510
|
+
vertical?: {
|
|
2511
|
+
width?: string;
|
|
2512
|
+
pad?: PadType;
|
|
2513
|
+
};
|
|
2514
|
+
};
|
|
2515
|
+
stepHeader?: {
|
|
2516
|
+
pad?: PadType;
|
|
2517
|
+
gap?: GapType;
|
|
2518
|
+
counter?: {
|
|
2519
|
+
size?: string;
|
|
2520
|
+
color?: ColorType;
|
|
2521
|
+
};
|
|
2522
|
+
title?: {
|
|
2523
|
+
size?: string;
|
|
2524
|
+
margin?: MarginType;
|
|
2525
|
+
};
|
|
2526
|
+
description?: {
|
|
2527
|
+
size?: string;
|
|
2528
|
+
color?: ColorType;
|
|
2529
|
+
margin?: MarginType;
|
|
2530
|
+
};
|
|
2531
|
+
};
|
|
2532
|
+
content?: {
|
|
2533
|
+
pad?: PadType;
|
|
2534
|
+
gap?: GapType;
|
|
2535
|
+
background?: BackgroundType;
|
|
2536
|
+
round?: RoundType;
|
|
2537
|
+
margin?: MarginType;
|
|
2538
|
+
};
|
|
2539
|
+
footer?: {
|
|
2540
|
+
background?: BackgroundType;
|
|
2541
|
+
border?: BorderType;
|
|
2542
|
+
gap?: GridGapType;
|
|
2543
|
+
pad?: PadType;
|
|
2544
|
+
justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'stretch';
|
|
2545
|
+
button?: {
|
|
2546
|
+
next?: { icon?: React.ReactNode | Icon };
|
|
2547
|
+
complete?: { icon?: React.ReactNode | Icon };
|
|
2548
|
+
previous?: { icon?: React.ReactNode | Icon };
|
|
2549
|
+
cancel?: { icon?: React.ReactNode | Icon };
|
|
2550
|
+
skip?: { icon?: React.ReactNode | Icon };
|
|
2551
|
+
};
|
|
2552
|
+
};
|
|
2553
|
+
};
|
|
2439
2554
|
worldMap?: {
|
|
2440
2555
|
color?: ColorType;
|
|
2441
2556
|
continent?: {
|
package/es6/themes/base.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
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); }
|
|
2
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
4
|
import { Actions } from 'grommet-icons/icons/Actions';
|
|
3
5
|
import { AssistListening } from 'grommet-icons/icons/AssistListening';
|
|
4
6
|
import { CircleInformation } from 'grommet-icons/icons/CircleInformation';
|
|
@@ -1124,6 +1126,41 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1124
1126
|
size: 'medium'
|
|
1125
1127
|
}
|
|
1126
1128
|
},
|
|
1129
|
+
dateTimeInput: {
|
|
1130
|
+
button: {
|
|
1131
|
+
margin: {
|
|
1132
|
+
right: 'small'
|
|
1133
|
+
}
|
|
1134
|
+
},
|
|
1135
|
+
container: {
|
|
1136
|
+
round: 'xxsmall'
|
|
1137
|
+
},
|
|
1138
|
+
active: {
|
|
1139
|
+
background: 'active-background',
|
|
1140
|
+
pad: 'xxsmall',
|
|
1141
|
+
indicator: {
|
|
1142
|
+
color: {
|
|
1143
|
+
dark: 'white',
|
|
1144
|
+
light: 'black'
|
|
1145
|
+
},
|
|
1146
|
+
size: 'small'
|
|
1147
|
+
}
|
|
1148
|
+
},
|
|
1149
|
+
drop: {
|
|
1150
|
+
pad: 'small',
|
|
1151
|
+
gap: 'small',
|
|
1152
|
+
border: {
|
|
1153
|
+
color: 'border',
|
|
1154
|
+
size: 'xsmall'
|
|
1155
|
+
}
|
|
1156
|
+
},
|
|
1157
|
+
icon: {
|
|
1158
|
+
calendar: undefined
|
|
1159
|
+
},
|
|
1160
|
+
separator: {
|
|
1161
|
+
pad: 'xxsmall'
|
|
1162
|
+
}
|
|
1163
|
+
},
|
|
1127
1164
|
dataSearch: {
|
|
1128
1165
|
// icons: {
|
|
1129
1166
|
// search: undefined,
|
|
@@ -2508,6 +2545,22 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
2508
2545
|
size: 'xsmall',
|
|
2509
2546
|
color: 'text-weak'
|
|
2510
2547
|
},
|
|
2548
|
+
button: {
|
|
2549
|
+
pad: 'xxsmall'
|
|
2550
|
+
},
|
|
2551
|
+
horizontal: {
|
|
2552
|
+
connector: {
|
|
2553
|
+
margin: 'xxsmall'
|
|
2554
|
+
},
|
|
2555
|
+
button: {
|
|
2556
|
+
gap: 'xsmall'
|
|
2557
|
+
}
|
|
2558
|
+
},
|
|
2559
|
+
vertical: {
|
|
2560
|
+
button: {
|
|
2561
|
+
gap: 'small'
|
|
2562
|
+
}
|
|
2563
|
+
},
|
|
2511
2564
|
// States: [component].[state].[element].[property]
|
|
2512
2565
|
pending: {
|
|
2513
2566
|
indicator: {
|
|
@@ -2846,6 +2899,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
2846
2899
|
selected: {
|
|
2847
2900
|
background: 'selected',
|
|
2848
2901
|
color: 'white',
|
|
2902
|
+
text: {
|
|
2903
|
+
weight: 'medium'
|
|
2904
|
+
},
|
|
2849
2905
|
hover: {
|
|
2850
2906
|
// background: undefined,
|
|
2851
2907
|
}
|
|
@@ -2938,6 +2994,108 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
2938
2994
|
}
|
|
2939
2995
|
}
|
|
2940
2996
|
},
|
|
2997
|
+
wizard: {
|
|
2998
|
+
container: {
|
|
2999
|
+
gap: 'none',
|
|
3000
|
+
background: 'background-back'
|
|
3001
|
+
},
|
|
3002
|
+
body: {
|
|
3003
|
+
pad: {
|
|
3004
|
+
horizontal: 'large',
|
|
3005
|
+
vertical: 'large'
|
|
3006
|
+
},
|
|
3007
|
+
gap: {
|
|
3008
|
+
row: 'none',
|
|
3009
|
+
column: 'medium'
|
|
3010
|
+
}
|
|
3011
|
+
},
|
|
3012
|
+
header: {
|
|
3013
|
+
pad: {
|
|
3014
|
+
horizontal: 'large',
|
|
3015
|
+
vertical: 'small'
|
|
3016
|
+
},
|
|
3017
|
+
background: 'background-front',
|
|
3018
|
+
title: {
|
|
3019
|
+
size: 'small'
|
|
3020
|
+
},
|
|
3021
|
+
close: {
|
|
3022
|
+
icon: FormClose
|
|
3023
|
+
}
|
|
3024
|
+
},
|
|
3025
|
+
progress: {
|
|
3026
|
+
horizontal: {
|
|
3027
|
+
pad: {
|
|
3028
|
+
horizontal: 'none',
|
|
3029
|
+
vertical: 'none'
|
|
3030
|
+
}
|
|
3031
|
+
},
|
|
3032
|
+
vertical: {
|
|
3033
|
+
// Fixed rail width so the column doesn't collapse to label text.
|
|
3034
|
+
width: 'small'
|
|
3035
|
+
// pad: undefined,
|
|
3036
|
+
}
|
|
3037
|
+
},
|
|
3038
|
+
stepHeader: {
|
|
3039
|
+
pad: {
|
|
3040
|
+
horizontal: 'none',
|
|
3041
|
+
vertical: 'none'
|
|
3042
|
+
},
|
|
3043
|
+
counter: {
|
|
3044
|
+
size: 'small',
|
|
3045
|
+
color: 'text'
|
|
3046
|
+
},
|
|
3047
|
+
title: {
|
|
3048
|
+
size: 'large',
|
|
3049
|
+
margin: 'none'
|
|
3050
|
+
},
|
|
3051
|
+
description: {
|
|
3052
|
+
size: 'medium',
|
|
3053
|
+
color: 'text-weak',
|
|
3054
|
+
margin: {
|
|
3055
|
+
top: 'xsmall',
|
|
3056
|
+
bottom: 'none'
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
},
|
|
3060
|
+
content: {
|
|
3061
|
+
pad: 'medium',
|
|
3062
|
+
gap: 'medium',
|
|
3063
|
+
background: 'background-front',
|
|
3064
|
+
round: 'small',
|
|
3065
|
+
margin: {
|
|
3066
|
+
top: 'medium'
|
|
3067
|
+
}
|
|
3068
|
+
},
|
|
3069
|
+
footer: {
|
|
3070
|
+
pad: {
|
|
3071
|
+
horizontal: 'large',
|
|
3072
|
+
vertical: 'small'
|
|
3073
|
+
},
|
|
3074
|
+
gap: {
|
|
3075
|
+
row: 'xsmall',
|
|
3076
|
+
column: 'small'
|
|
3077
|
+
},
|
|
3078
|
+
background: 'background-front',
|
|
3079
|
+
justify: 'end',
|
|
3080
|
+
button: {
|
|
3081
|
+
next: {
|
|
3082
|
+
icon: FormNext
|
|
3083
|
+
},
|
|
3084
|
+
complete: {
|
|
3085
|
+
icon: undefined
|
|
3086
|
+
},
|
|
3087
|
+
previous: {
|
|
3088
|
+
icon: FormPrevious
|
|
3089
|
+
},
|
|
3090
|
+
cancel: {
|
|
3091
|
+
icon: undefined
|
|
3092
|
+
},
|
|
3093
|
+
skip: {
|
|
3094
|
+
icon: FormNext
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
},
|
|
2941
3099
|
worldMap: {
|
|
2942
3100
|
color: 'light-3',
|
|
2943
3101
|
continent: {
|
package/es6/utils/DOM.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
export var findScrollParent = function findScrollParent(element, horizontal) {
|
|
2
4
|
var result;
|
|
3
5
|
if (element) {
|
|
@@ -76,10 +78,17 @@ export var withinDropPortal = function withinDropPortal(node, portalContext) {
|
|
|
76
78
|
return true;
|
|
77
79
|
};
|
|
78
80
|
|
|
79
|
-
// Check if
|
|
81
|
+
// Check if an element can receive focus: native form inputs, or non-native
|
|
82
|
+
// interactive elements with an explicit tabIndex attribute
|
|
83
|
+
// (e.g. span[role="spinbutton"]). Excludes native interactive elements
|
|
84
|
+
// (button, a) so they don't trigger FormField focus state.
|
|
80
85
|
export var isFocusable = function isFocusable(element) {
|
|
86
|
+
if (!element || element.disabled) return false;
|
|
81
87
|
var tagName = element.tagName.toLowerCase();
|
|
82
|
-
|
|
88
|
+
if (tagName === 'input' || tagName === 'select' || tagName === 'textarea') return true;
|
|
89
|
+
// Only non-native-interactive elements with an explicit tabindex attribute
|
|
90
|
+
var isNativeInteractive = tagName === 'button' || tagName === 'a';
|
|
91
|
+
return !isNativeInteractive && element.tabIndex >= 0 && element.hasAttribute('tabindex');
|
|
83
92
|
};
|
|
84
93
|
|
|
85
94
|
// Get the first element that can receive focus
|
package/es6/utils/dates.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
export var setHoursWithOffset = function setHoursWithOffset(date) {
|
|
2
4
|
var newDate = new Date(date);
|
|
3
5
|
if ((date == null ? void 0 : date.indexOf('T')) === -1) {
|
|
@@ -6,4 +8,12 @@ export var setHoursWithOffset = function setHoursWithOffset(date) {
|
|
|
6
8
|
newDate.setHours(hour, offset < 0 ? -offset : offset);
|
|
7
9
|
}
|
|
8
10
|
return newDate;
|
|
11
|
+
};
|
|
12
|
+
export var pad = function pad(value) {
|
|
13
|
+
return String(value).padStart(2, '0');
|
|
14
|
+
};
|
|
15
|
+
export var normalizeStep = function normalizeStep(step) {
|
|
16
|
+
var parsed = Number(step);
|
|
17
|
+
if (!Number.isFinite(parsed) || parsed <= 0) return 1;
|
|
18
|
+
return Math.max(1, Math.floor(parsed));
|
|
9
19
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var sectionKeyByType = {
|
|
4
|
+
day: 'day',
|
|
5
|
+
month: 'month',
|
|
6
|
+
year: 'year',
|
|
7
|
+
hours: 'hour',
|
|
8
|
+
minutes: 'minute',
|
|
9
|
+
seconds: 'second',
|
|
10
|
+
meridiem: 'period'
|
|
11
|
+
};
|
|
12
|
+
var sectionTokenByType = {
|
|
13
|
+
day: 'dd',
|
|
14
|
+
month: 'mm',
|
|
15
|
+
year: 'yyyy',
|
|
16
|
+
hours: 'hh',
|
|
17
|
+
minutes: 'mm',
|
|
18
|
+
seconds: 'ss',
|
|
19
|
+
meridiem: 'aa'
|
|
20
|
+
};
|
|
21
|
+
var sectionMessageSuffixByType = {
|
|
22
|
+
day: 'sectionDay',
|
|
23
|
+
month: 'sectionMonth',
|
|
24
|
+
year: 'sectionYear',
|
|
25
|
+
hours: 'sectionHours',
|
|
26
|
+
minutes: 'sectionMinutes',
|
|
27
|
+
seconds: 'sectionSeconds',
|
|
28
|
+
meridiem: 'sectionMeridiem'
|
|
29
|
+
};
|
|
30
|
+
var defaultSectionNameByType = {
|
|
31
|
+
day: 'day',
|
|
32
|
+
month: 'month',
|
|
33
|
+
year: 'year',
|
|
34
|
+
hours: 'hours',
|
|
35
|
+
minutes: 'minutes',
|
|
36
|
+
seconds: 'seconds',
|
|
37
|
+
meridiem: 'meridiem'
|
|
38
|
+
};
|
|
39
|
+
export var getSectionKeyFromType = function getSectionKeyFromType(sectionType) {
|
|
40
|
+
return sectionKeyByType[sectionType];
|
|
41
|
+
};
|
|
42
|
+
export var getSectionTokenFromType = function getSectionTokenFromType(sectionType) {
|
|
43
|
+
return sectionTokenByType[sectionType];
|
|
44
|
+
};
|
|
45
|
+
export var getSectionNameFromType = function getSectionNameFromType(_ref) {
|
|
46
|
+
var sectionType = _ref.sectionType,
|
|
47
|
+
messagePrefix = _ref.messagePrefix,
|
|
48
|
+
formatMessage = _ref.formatMessage,
|
|
49
|
+
messages = _ref.messages;
|
|
50
|
+
if (formatMessage) {
|
|
51
|
+
return formatMessage({
|
|
52
|
+
id: messagePrefix + "." + sectionMessageSuffixByType[sectionType],
|
|
53
|
+
messages: messages
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return defaultSectionNameByType[sectionType];
|
|
57
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
export var useSectionedField = function useSectionedField(_ref) {
|
|
5
|
+
var value = _ref.value,
|
|
6
|
+
parseValue = _ref.parseValue,
|
|
7
|
+
defaultValue = _ref.defaultValue,
|
|
8
|
+
sectionOrder = _ref.sectionOrder;
|
|
9
|
+
var parsedValue = useMemo(function () {
|
|
10
|
+
return parseValue(value);
|
|
11
|
+
}, [parseValue, value]);
|
|
12
|
+
var _useState = useState(function () {
|
|
13
|
+
return parsedValue || defaultValue();
|
|
14
|
+
}),
|
|
15
|
+
sections = _useState[0],
|
|
16
|
+
setSections = _useState[1];
|
|
17
|
+
var _useState2 = useState({}),
|
|
18
|
+
pendingDigits = _useState2[0],
|
|
19
|
+
setPendingDigits = _useState2[1];
|
|
20
|
+
var _useState3 = useState(sectionOrder[0]),
|
|
21
|
+
activeSection = _useState3[0],
|
|
22
|
+
setActiveSection = _useState3[1];
|
|
23
|
+
var preserveIncompleteSectionsRef = useRef(false);
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
if (!sectionOrder.includes(activeSection)) {
|
|
26
|
+
setActiveSection(sectionOrder[0]);
|
|
27
|
+
}
|
|
28
|
+
}, [activeSection, sectionOrder]);
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
if (!parsedValue && preserveIncompleteSectionsRef.current) {
|
|
31
|
+
preserveIncompleteSectionsRef.current = false;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
setSections(parsedValue || defaultValue());
|
|
35
|
+
}, [defaultValue, parsedValue]);
|
|
36
|
+
return {
|
|
37
|
+
activeSection: activeSection,
|
|
38
|
+
pendingDigits: pendingDigits,
|
|
39
|
+
preserveIncompleteSectionsRef: preserveIncompleteSectionsRef,
|
|
40
|
+
sections: sections,
|
|
41
|
+
setActiveSection: setActiveSection,
|
|
42
|
+
setPendingDigits: setPendingDigits,
|
|
43
|
+
setSections: setSections
|
|
44
|
+
};
|
|
45
|
+
};
|