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
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.ReadOnly = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _grommet = require("grommet");
|
|
7
|
+
var _Stepper = require("../Stepper");
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
var ReadOnly = exports.ReadOnly = function ReadOnly() {
|
|
10
|
+
var steps = [{
|
|
11
|
+
id: 'step1',
|
|
12
|
+
title: 'Step 1',
|
|
13
|
+
status: 'completed'
|
|
14
|
+
}, {
|
|
15
|
+
id: 'step2',
|
|
16
|
+
title: 'Step 2',
|
|
17
|
+
status: 'completed'
|
|
18
|
+
}, {
|
|
19
|
+
id: 'step3',
|
|
20
|
+
title: 'Step 3',
|
|
21
|
+
status: 'pending'
|
|
22
|
+
}, {
|
|
23
|
+
id: 'step4',
|
|
24
|
+
title: 'Step 4',
|
|
25
|
+
status: 'pending'
|
|
26
|
+
}];
|
|
27
|
+
return (
|
|
28
|
+
/*#__PURE__*/
|
|
29
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
30
|
+
// <Grommet theme={...}>
|
|
31
|
+
_react["default"].createElement(_grommet.Box, {
|
|
32
|
+
pad: "large"
|
|
33
|
+
}, /*#__PURE__*/_react["default"].createElement(_Stepper.Stepper, {
|
|
34
|
+
steps: steps,
|
|
35
|
+
currentStep: "step3",
|
|
36
|
+
clickableSteps: false
|
|
37
|
+
}))
|
|
38
|
+
// </Grommet>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
var _default = exports["default"] = {
|
|
42
|
+
title: 'Visualizations/Stepper/Read-Only'
|
|
43
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.ThemingLightDark = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _grommet = require("grommet");
|
|
7
|
+
var _Stepper = require("../Stepper");
|
|
8
|
+
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); }
|
|
9
|
+
var ThemingLightDark = exports.ThemingLightDark = function ThemingLightDark() {
|
|
10
|
+
var _useState = (0, _react.useState)('step1'),
|
|
11
|
+
currentStep = _useState[0],
|
|
12
|
+
setCurrentStep = _useState[1];
|
|
13
|
+
var steps = [{
|
|
14
|
+
id: 'step1',
|
|
15
|
+
title: 'Account',
|
|
16
|
+
status: 'completed'
|
|
17
|
+
}, {
|
|
18
|
+
id: 'step2',
|
|
19
|
+
title: 'Profile',
|
|
20
|
+
status: 'pending'
|
|
21
|
+
}, {
|
|
22
|
+
id: 'step3',
|
|
23
|
+
title: 'Review',
|
|
24
|
+
status: 'pending'
|
|
25
|
+
}];
|
|
26
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
27
|
+
gap: "large"
|
|
28
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
29
|
+
pad: "large",
|
|
30
|
+
background: "background-front"
|
|
31
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Heading, {
|
|
32
|
+
level: 3
|
|
33
|
+
}, "Light Theme"), /*#__PURE__*/_react["default"].createElement(_Stepper.Stepper, {
|
|
34
|
+
steps: steps,
|
|
35
|
+
currentStep: currentStep,
|
|
36
|
+
onStepClick: function onStepClick(id) {
|
|
37
|
+
return setCurrentStep(id);
|
|
38
|
+
}
|
|
39
|
+
})), /*#__PURE__*/_react["default"].createElement(_grommet.ThemeContext.Extend, {
|
|
40
|
+
value: {
|
|
41
|
+
dark: true
|
|
42
|
+
}
|
|
43
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
44
|
+
pad: "large",
|
|
45
|
+
background: "background-front"
|
|
46
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Heading, {
|
|
47
|
+
level: 3
|
|
48
|
+
}, "Dark Theme"), /*#__PURE__*/_react["default"].createElement(_Stepper.Stepper, {
|
|
49
|
+
steps: steps,
|
|
50
|
+
currentStep: currentStep,
|
|
51
|
+
onStepClick: function onStepClick(id) {
|
|
52
|
+
return setCurrentStep(id);
|
|
53
|
+
}
|
|
54
|
+
}))));
|
|
55
|
+
};
|
|
56
|
+
var _default = exports["default"] = {
|
|
57
|
+
title: 'Visualizations/Stepper/Theming Light Dark'
|
|
58
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.VerticalSteps = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _grommet = require("grommet");
|
|
7
|
+
var _Stepper = require("../Stepper");
|
|
8
|
+
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); }
|
|
9
|
+
var VerticalSteps = exports.VerticalSteps = function VerticalSteps() {
|
|
10
|
+
var _steps$find, _steps$find2;
|
|
11
|
+
var _useState = (0, _react.useState)('deploy'),
|
|
12
|
+
currentStep = _useState[0],
|
|
13
|
+
setCurrentStep = _useState[1];
|
|
14
|
+
var steps = [{
|
|
15
|
+
id: 'setup',
|
|
16
|
+
title: 'Setup',
|
|
17
|
+
description: 'Configure your environment.',
|
|
18
|
+
status: 'completed'
|
|
19
|
+
}, {
|
|
20
|
+
id: 'deploy',
|
|
21
|
+
title: 'Deploy',
|
|
22
|
+
status: 'pending'
|
|
23
|
+
}, {
|
|
24
|
+
id: 'verify',
|
|
25
|
+
title: 'Verify',
|
|
26
|
+
description: 'Run post-deployment checks.',
|
|
27
|
+
status: 'pending'
|
|
28
|
+
}];
|
|
29
|
+
return (
|
|
30
|
+
/*#__PURE__*/
|
|
31
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
32
|
+
// <Grommet theme={...}>
|
|
33
|
+
_react["default"].createElement(_grommet.Box, {
|
|
34
|
+
direction: "row",
|
|
35
|
+
gap: "medium",
|
|
36
|
+
pad: "medium"
|
|
37
|
+
}, /*#__PURE__*/_react["default"].createElement(_Stepper.Stepper, {
|
|
38
|
+
steps: steps,
|
|
39
|
+
currentStep: currentStep,
|
|
40
|
+
direction: "vertical",
|
|
41
|
+
onStepClick: function onStepClick(id) {
|
|
42
|
+
return setCurrentStep(id);
|
|
43
|
+
}
|
|
44
|
+
}), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
45
|
+
flex: true,
|
|
46
|
+
pad: "medium",
|
|
47
|
+
background: "background-contrast",
|
|
48
|
+
round: "small",
|
|
49
|
+
height: {
|
|
50
|
+
min: 'medium'
|
|
51
|
+
},
|
|
52
|
+
gap: "none"
|
|
53
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Heading, {
|
|
54
|
+
level: 2
|
|
55
|
+
}, (_steps$find = steps.find(function (s) {
|
|
56
|
+
return s.id === currentStep;
|
|
57
|
+
})) == null ? void 0 : _steps$find.title), /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
58
|
+
color: "text-strong"
|
|
59
|
+
}, (_steps$find2 = steps.find(function (s) {
|
|
60
|
+
return s.id === currentStep;
|
|
61
|
+
})) == null ? void 0 : _steps$find2.description), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, "Step content")))
|
|
62
|
+
// </Grommet>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
var _default = exports["default"] = {
|
|
66
|
+
title: 'Visualizations/Stepper/Vertical Steps'
|
|
67
|
+
};
|
package/components/Tab/Tab.js
CHANGED
|
@@ -11,7 +11,7 @@ var _StyledTab = require("./StyledTab");
|
|
|
11
11
|
var _propTypes = require("./propTypes");
|
|
12
12
|
var _useIsomorphicLayoutEffect = require("../../utils/use-isomorphic-layout-effect");
|
|
13
13
|
var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
14
|
-
var _excluded = ["active", "disabled", "children", "icon", "plain", "title", "onBlur", "onFocus", "onMouseOver", "onMouseOut", "reverse", "onClick"];
|
|
14
|
+
var _excluded = ["active", "disabled", "children", "icon", "plain", "title", "onBlur", "onFocus", "onMouseOver", "onMouseOut", "reverse", "onClick", "onKeyDown"];
|
|
15
15
|
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); }
|
|
16
16
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
17
|
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; }
|
|
@@ -28,13 +28,17 @@ var Tab = exports.Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
28
28
|
onMouseOut = _ref.onMouseOut,
|
|
29
29
|
reverse = _ref.reverse,
|
|
30
30
|
onClick = _ref.onClick,
|
|
31
|
+
onKeyDown = _ref.onKeyDown,
|
|
31
32
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
32
33
|
var _useContext = (0, _react.useContext)(_TabsContext.TabsContext),
|
|
33
34
|
active = _useContext.active,
|
|
34
35
|
activeIndex = _useContext.activeIndex,
|
|
36
|
+
focusable = _useContext.focusable,
|
|
35
37
|
index = _useContext.index,
|
|
38
|
+
panelId = _useContext.panelId,
|
|
36
39
|
tabsContextRef = _useContext.ref,
|
|
37
40
|
onActivate = _useContext.onActivate,
|
|
41
|
+
onTabsKeyDown = _useContext.onKeyDown,
|
|
38
42
|
setActiveContent = _useContext.setActiveContent,
|
|
39
43
|
setActiveTitle = _useContext.setActiveTitle,
|
|
40
44
|
setFocusIndex = _useContext.setFocusIndex;
|
|
@@ -93,6 +97,13 @@ var Tab = exports.Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
93
97
|
onClick(event);
|
|
94
98
|
}
|
|
95
99
|
};
|
|
100
|
+
var onKeyDownTab = function onKeyDownTab(event) {
|
|
101
|
+
if (disabled) return;
|
|
102
|
+
onTabsKeyDown(event);
|
|
103
|
+
if (onKeyDown) {
|
|
104
|
+
onKeyDown(event);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
96
107
|
if (active && disabled) {
|
|
97
108
|
console.warn(// eslint-disable-next-line max-len
|
|
98
109
|
"Warning: Tab props 'active' and 'disabled' have both been set to TRUE on the same Tab resulting in an interesting Tab state. Is this your intent?");
|
|
@@ -162,19 +173,21 @@ var Tab = exports.Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
162
173
|
ref: tabRef,
|
|
163
174
|
plain: true,
|
|
164
175
|
role: "tab",
|
|
176
|
+
tabIndex: focusable ? 0 : -1,
|
|
177
|
+
"aria-controls": panelId,
|
|
165
178
|
"aria-selected": active,
|
|
166
|
-
"aria-expanded": active,
|
|
167
179
|
disabled: disabled
|
|
168
180
|
}, rest, {
|
|
169
181
|
onClick: onClickTab,
|
|
182
|
+
onKeyDown: onKeyDownTab,
|
|
170
183
|
onMouseOver: onMouseOverTab,
|
|
171
184
|
onMouseOut: onMouseOutTab,
|
|
172
|
-
onFocus: function onFocus() {
|
|
173
|
-
if (_onFocus) _onFocus();
|
|
185
|
+
onFocus: function onFocus(event) {
|
|
186
|
+
if (_onFocus) _onFocus(event);
|
|
174
187
|
setFocusIndex(index);
|
|
175
188
|
},
|
|
176
|
-
onBlur: function onBlur() {
|
|
177
|
-
if (_onBlur) _onBlur();
|
|
189
|
+
onBlur: function onBlur(event) {
|
|
190
|
+
if (_onBlur) _onBlur(event);
|
|
178
191
|
setFocusIndex(-1);
|
|
179
192
|
}
|
|
180
193
|
}), /*#__PURE__*/_react["default"].createElement(_StyledTab.StyledTab, _extends({
|
package/components/Tabs/Tabs.js
CHANGED
|
@@ -60,6 +60,7 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
60
60
|
focusIndex = _useState7[0],
|
|
61
61
|
setFocusIndex = _useState7[1];
|
|
62
62
|
var headerRef = (0, _react.useRef)();
|
|
63
|
+
var panelId = (0, _utils.useId)();
|
|
63
64
|
var size = (0, _react.useContext)(_ResponsiveContext.ResponsiveContext);
|
|
64
65
|
var PreviousIcon = ((_theme$tabs$header = theme.tabs.header) == null || (_theme$tabs$header = _theme$tabs$header.previousButton) == null ? void 0 : _theme$tabs$header.icon) || _Previous.Previous;
|
|
65
66
|
var NextIcon = ((_theme$tabs$header2 = theme.tabs.header) == null || (_theme$tabs$header2 = _theme$tabs$header2.nextButton) == null ? void 0 : _theme$tabs$header2.icon) || _Next.Next;
|
|
@@ -84,6 +85,114 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
84
85
|
return /*#__PURE__*/_react["default"].createRef();
|
|
85
86
|
});
|
|
86
87
|
}, [children]);
|
|
88
|
+
var disabledIndexes = (0, _react.useMemo)(function () {
|
|
89
|
+
return _react["default"].Children.map(children, function (child) {
|
|
90
|
+
if (! /*#__PURE__*/_react["default"].isValidElement(child)) return true;
|
|
91
|
+
return !!child.props.disabled;
|
|
92
|
+
}) || [];
|
|
93
|
+
}, [children]);
|
|
94
|
+
var focusTab = (0, _react.useCallback)(function (index) {
|
|
95
|
+
var _tabRefs$index;
|
|
96
|
+
if (index >= 0 && (_tabRefs$index = tabRefs[index]) != null && _tabRefs$index.current) {
|
|
97
|
+
tabRefs[index].current.focus();
|
|
98
|
+
}
|
|
99
|
+
}, [tabRefs]);
|
|
100
|
+
var findEnabledIndex = (0, _react.useCallback)(function (startIndex, direction) {
|
|
101
|
+
if (!disabledIndexes.length) return undefined;
|
|
102
|
+
var normalizeIndex = function normalizeIndex(index) {
|
|
103
|
+
if (index < 0) return disabledIndexes.length - 1;
|
|
104
|
+
if (index >= disabledIndexes.length) return 0;
|
|
105
|
+
return index;
|
|
106
|
+
};
|
|
107
|
+
var nextIndex = normalizeIndex(startIndex);
|
|
108
|
+
var attempts = 0;
|
|
109
|
+
while (attempts < disabledIndexes.length) {
|
|
110
|
+
if (!disabledIndexes[nextIndex]) {
|
|
111
|
+
return nextIndex;
|
|
112
|
+
}
|
|
113
|
+
nextIndex = normalizeIndex(nextIndex + direction);
|
|
114
|
+
attempts += 1;
|
|
115
|
+
}
|
|
116
|
+
return undefined;
|
|
117
|
+
}, [disabledIndexes]);
|
|
118
|
+
var getClosestEnabledIndex = (0, _react.useCallback)(function (preferredIndex) {
|
|
119
|
+
if (!disabledIndexes.length) return undefined;
|
|
120
|
+
var clampedIndex = Math.min(Math.max(preferredIndex, 0), disabledIndexes.length - 1);
|
|
121
|
+
if (!disabledIndexes[clampedIndex]) {
|
|
122
|
+
return clampedIndex;
|
|
123
|
+
}
|
|
124
|
+
for (var offset = 1; offset < disabledIndexes.length; offset += 1) {
|
|
125
|
+
var nextIndex = clampedIndex + offset;
|
|
126
|
+
if (nextIndex < disabledIndexes.length && !disabledIndexes[nextIndex]) {
|
|
127
|
+
return nextIndex;
|
|
128
|
+
}
|
|
129
|
+
var previousIndex = clampedIndex - offset;
|
|
130
|
+
if (previousIndex >= 0 && !disabledIndexes[previousIndex]) {
|
|
131
|
+
return previousIndex;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
}, [disabledIndexes]);
|
|
136
|
+
var resolvedActiveIndex = (0, _react.useMemo)(function () {
|
|
137
|
+
if (!disabledIndexes.length) return undefined;
|
|
138
|
+
if (activeIndex < 0 || activeIndex >= disabledIndexes.length) {
|
|
139
|
+
return getClosestEnabledIndex(activeIndex);
|
|
140
|
+
}
|
|
141
|
+
if (disabledIndexes[activeIndex]) {
|
|
142
|
+
return getClosestEnabledIndex(activeIndex);
|
|
143
|
+
}
|
|
144
|
+
return activeIndex;
|
|
145
|
+
}, [activeIndex, disabledIndexes, getClosestEnabledIndex]);
|
|
146
|
+
var activateTab = (0, _react.useCallback)(function (nextIndex) {
|
|
147
|
+
sendAnalytics({
|
|
148
|
+
type: 'activateTab',
|
|
149
|
+
element: tabRefs[nextIndex].current
|
|
150
|
+
});
|
|
151
|
+
if (propsActiveIndex === undefined) {
|
|
152
|
+
setActiveIndex(nextIndex);
|
|
153
|
+
}
|
|
154
|
+
if (onActive) {
|
|
155
|
+
onActive(nextIndex);
|
|
156
|
+
}
|
|
157
|
+
}, [onActive, propsActiveIndex, sendAnalytics, tabRefs]);
|
|
158
|
+
var moveFocus = (0, _react.useCallback)(function (targetIndex) {
|
|
159
|
+
if (targetIndex === undefined) return;
|
|
160
|
+
focusTab(targetIndex);
|
|
161
|
+
}, [focusTab]);
|
|
162
|
+
var moveFocusByKey = (0, _react.useCallback)(function (currentIndex, direction) {
|
|
163
|
+
moveFocus(findEnabledIndex(currentIndex + direction, direction));
|
|
164
|
+
}, [findEnabledIndex, moveFocus]);
|
|
165
|
+
var moveFocusToEdge = (0, _react.useCallback)(function (direction) {
|
|
166
|
+
var startIndex = direction > 0 ? 0 : tabRefs.length - 1;
|
|
167
|
+
moveFocus(findEnabledIndex(startIndex, direction));
|
|
168
|
+
}, [findEnabledIndex, moveFocus, tabRefs.length]);
|
|
169
|
+
var handleTabKeyDown = (0, _react.useCallback)(function (index, event) {
|
|
170
|
+
switch (event.key) {
|
|
171
|
+
case 'ArrowRight':
|
|
172
|
+
event.preventDefault();
|
|
173
|
+
moveFocusByKey(index, 1);
|
|
174
|
+
break;
|
|
175
|
+
case 'ArrowLeft':
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
moveFocusByKey(index, -1);
|
|
178
|
+
break;
|
|
179
|
+
case 'Home':
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
moveFocusToEdge(1);
|
|
182
|
+
break;
|
|
183
|
+
case 'End':
|
|
184
|
+
event.preventDefault();
|
|
185
|
+
moveFocusToEdge(-1);
|
|
186
|
+
break;
|
|
187
|
+
case 'Enter':
|
|
188
|
+
case ' ':
|
|
189
|
+
case 'Spacebar':
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
activateTab(index);
|
|
192
|
+
break;
|
|
193
|
+
default:
|
|
194
|
+
}
|
|
195
|
+
}, [activateTab, moveFocusByKey, moveFocusToEdge]);
|
|
87
196
|
|
|
88
197
|
// check if tab is in view
|
|
89
198
|
var isVisible = (0, _react.useCallback)(function (index) {
|
|
@@ -184,10 +293,10 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
184
293
|
}
|
|
185
294
|
};
|
|
186
295
|
(0, _react.useEffect)(function () {
|
|
187
|
-
var _tabRefs$
|
|
296
|
+
var _tabRefs$resolvedActi;
|
|
188
297
|
// if the active tab isn't visible scroll to it
|
|
189
|
-
if (overflow && tabRefs && (_tabRefs$
|
|
190
|
-
}, [overflow,
|
|
298
|
+
if (overflow && tabRefs && resolvedActiveIndex !== undefined && (_tabRefs$resolvedActi = tabRefs[resolvedActiveIndex]) != null && _tabRefs$resolvedActi.current && !isVisible(resolvedActiveIndex)) scrollTo(resolvedActiveIndex, true);
|
|
299
|
+
}, [overflow, resolvedActiveIndex, tabRefs, isVisible, scrollTo]);
|
|
191
300
|
(0, _react.useEffect)(function () {
|
|
192
301
|
// scroll focus item into view if it is not already visible
|
|
193
302
|
if (overflow && focusIndex !== -1 && !isVisible(focusIndex)) scrollTo(focusIndex, true);else if (overflow && focusIndex !== -1) {
|
|
@@ -216,33 +325,51 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
216
325
|
return function () {
|
|
217
326
|
return window.removeEventListener('resize', onResize);
|
|
218
327
|
};
|
|
219
|
-
}, [tabRefs,
|
|
328
|
+
}, [tabRefs, activeIndex, headerRef, updateArrowState]);
|
|
329
|
+
(0, _useIsomorphicLayoutEffect.useLayoutEffect)(function () {
|
|
330
|
+
if (focusIndex === -1 || !headerRef.current) return;
|
|
331
|
+
var _document = document,
|
|
332
|
+
activeElement = _document.activeElement;
|
|
333
|
+
if (headerRef.current.contains(activeElement)) return;
|
|
334
|
+
var nextFocusIndex = getClosestEnabledIndex(focusIndex);
|
|
335
|
+
if (nextFocusIndex === undefined) {
|
|
336
|
+
setFocusIndex(-1);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
setFocusIndex(nextFocusIndex);
|
|
340
|
+
focusTab(nextFocusIndex);
|
|
341
|
+
}, [children, focusIndex, focusTab, getClosestEnabledIndex]);
|
|
220
342
|
var getTabsContext = (0, _react.useCallback)(function (index) {
|
|
221
|
-
var activateTab = function activateTab(nextIndex) {
|
|
222
|
-
sendAnalytics({
|
|
223
|
-
type: 'activateTab',
|
|
224
|
-
element: tabRefs[nextIndex].current
|
|
225
|
-
});
|
|
226
|
-
if (propsActiveIndex === undefined) {
|
|
227
|
-
setActiveIndex(nextIndex);
|
|
228
|
-
}
|
|
229
|
-
if (onActive) {
|
|
230
|
-
onActive(nextIndex);
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
343
|
return {
|
|
234
|
-
activeIndex:
|
|
235
|
-
active:
|
|
344
|
+
activeIndex: resolvedActiveIndex,
|
|
345
|
+
active: resolvedActiveIndex === index,
|
|
346
|
+
focusable: focusIndex === -1 ? resolvedActiveIndex === index : focusIndex === index,
|
|
236
347
|
index: index,
|
|
348
|
+
panelId: panelId,
|
|
237
349
|
ref: tabRefs[index],
|
|
238
350
|
onActivate: function onActivate() {
|
|
239
351
|
return activateTab(index);
|
|
240
352
|
},
|
|
353
|
+
onKeyDown: function onKeyDown(event) {
|
|
354
|
+
return handleTabKeyDown(index, event);
|
|
355
|
+
},
|
|
356
|
+
onNext: function onNext() {
|
|
357
|
+
return moveFocusByKey(index, 1);
|
|
358
|
+
},
|
|
359
|
+
onPrevious: function onPrevious() {
|
|
360
|
+
return moveFocusByKey(index, -1);
|
|
361
|
+
},
|
|
362
|
+
onFirst: function onFirst() {
|
|
363
|
+
return moveFocusToEdge(1);
|
|
364
|
+
},
|
|
365
|
+
onLast: function onLast() {
|
|
366
|
+
return moveFocusToEdge(-1);
|
|
367
|
+
},
|
|
241
368
|
setActiveContent: setActiveContent,
|
|
242
369
|
setActiveTitle: setActiveTitle,
|
|
243
370
|
setFocusIndex: setFocusIndex
|
|
244
371
|
};
|
|
245
|
-
}, [
|
|
372
|
+
}, [focusIndex, activateTab, handleTabKeyDown, moveFocusByKey, moveFocusToEdge, panelId, resolvedActiveIndex, tabRefs]);
|
|
246
373
|
var tabs = _react["default"].Children.map(children, function (child, index) {
|
|
247
374
|
return /*#__PURE__*/_react["default"].createElement(_TabsContext.TabsContext.Provider, {
|
|
248
375
|
value: getTabsContext(index)
|
|
@@ -252,7 +379,7 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
252
379
|
// styled components that rely on props.active. We should reassess
|
|
253
380
|
// if it is still necessary in our next major release.
|
|
254
381
|
_react["default"].cloneElement(child, {
|
|
255
|
-
active:
|
|
382
|
+
active: resolvedActiveIndex === index
|
|
256
383
|
}) : child);
|
|
257
384
|
});
|
|
258
385
|
var tabsHeaderStyles = {};
|
|
@@ -281,7 +408,10 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
281
408
|
flex: false,
|
|
282
409
|
direction: overflow ? 'row' : 'column'
|
|
283
410
|
}, tabsHeaderStyles), overflow && /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
284
|
-
a11yTitle:
|
|
411
|
+
a11yTitle: format({
|
|
412
|
+
id: 'tabs.previousTab',
|
|
413
|
+
messages: messages
|
|
414
|
+
}),
|
|
285
415
|
disabled: disableLeftArrow
|
|
286
416
|
// removed from tabIndex, button is redundant for keyboard users
|
|
287
417
|
,
|
|
@@ -306,7 +436,10 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
306
436
|
pad: overflow ? '2px' : undefined,
|
|
307
437
|
margin: overflow ? '-2px' : undefined
|
|
308
438
|
}, passThemeFlag), tabs), overflow && /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
309
|
-
a11yTitle:
|
|
439
|
+
a11yTitle: format({
|
|
440
|
+
id: 'tabs.nextTab',
|
|
441
|
+
messages: messages
|
|
442
|
+
}),
|
|
310
443
|
disabled: disableRightArrow
|
|
311
444
|
// removed from tabIndex, button is redundant for keyboard users
|
|
312
445
|
,
|
|
@@ -319,6 +452,7 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
319
452
|
}, /*#__PURE__*/_react["default"].createElement(NextIcon, {
|
|
320
453
|
color: disableRightArrow ? theme.button.disabled.color : theme.global.colors.text
|
|
321
454
|
})))), /*#__PURE__*/_react["default"].createElement(_StyledTabs.StyledTabPanel, _extends({
|
|
455
|
+
id: panelId,
|
|
322
456
|
flex: flex,
|
|
323
457
|
"aria-label": tabContentTitle,
|
|
324
458
|
role: "tabpanel"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.StyledTimeInputSeparator = exports.StyledTimeInputSegment = exports.StyledTimeInputField = exports.StyledTimeInputDisplay = exports.StyledTimeInputContainer = exports.StyledTimeInput = void 0;
|
|
5
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
6
|
+
var _utils = require("../../utils");
|
|
7
|
+
var _Box = require("../Box");
|
|
8
|
+
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); }
|
|
9
|
+
var StyledTimeInputContainer = exports.StyledTimeInputContainer = (0, _styledComponents["default"])(_Box.Box).withConfig({
|
|
10
|
+
// Keep Box styling props like border and round flowing into Box.
|
|
11
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
12
|
+
return prop !== 'disabled' && prop !== 'readOnlyProp';
|
|
13
|
+
}
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledTimeInput__StyledTimeInputContainer",
|
|
16
|
+
componentId: "sc-xktdr3-0"
|
|
17
|
+
})(["", " ", " ", ""], function (props) {
|
|
18
|
+
return props.disabled && (0, _utils.disabledStyle)();
|
|
19
|
+
}, function (props) {
|
|
20
|
+
return props.readOnlyProp && (0, _utils.readOnlyStyle)(props.theme);
|
|
21
|
+
}, function (props) {
|
|
22
|
+
return props.focusIndicator !== false && (0, _styledComponents.css)(["&:focus-within{", "}"], (0, _utils.focusStyle)());
|
|
23
|
+
});
|
|
24
|
+
var StyledTimeInput = exports.StyledTimeInput = _styledComponents["default"].input.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
25
|
+
displayName: "StyledTimeInput",
|
|
26
|
+
componentId: "sc-xktdr3-1"
|
|
27
|
+
})(["", " ", " position:relative;pointer-events:none;color:transparent;caret-color:transparent;text-shadow:none;&::selection{background:transparent;color:transparent;}&::placeholder{color:transparent;}"], _utils.inputStyle, _utils.plainInputStyle);
|
|
28
|
+
var StyledTimeInputField = exports.StyledTimeInputField = _styledComponents["default"].div.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
29
|
+
displayName: "StyledTimeInput__StyledTimeInputField",
|
|
30
|
+
componentId: "sc-xktdr3-2"
|
|
31
|
+
})(["position:relative;flex:1 1 auto;min-width:0;"]);
|
|
32
|
+
var StyledTimeInputDisplay = exports.StyledTimeInputDisplay = _styledComponents["default"].div.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
33
|
+
displayName: "StyledTimeInput__StyledTimeInputDisplay",
|
|
34
|
+
componentId: "sc-xktdr3-3"
|
|
35
|
+
})(["position:absolute;inset:0;display:flex;align-items:center;overflow:hidden;", ""], function (props) {
|
|
36
|
+
return props.theme.global.input.padding && (typeof props.theme.global.input.padding !== 'object' ? "padding: " + ((0, _utils.parseMetricToNum)(props.theme.global.edgeSize[props.theme.global.input.padding] || props.theme.global.input.padding) - (0, _utils.parseMetricToNum)(props.theme.global.control.border.width)) + "px;" : (0, _utils.edgeStyle)('padding', props.theme.global.input.padding, props.responsive, props.theme.box.responsiveBreakpoint, props.theme));
|
|
37
|
+
});
|
|
38
|
+
var StyledTimeInputSeparator = exports.StyledTimeInputSeparator = _styledComponents["default"].span.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
39
|
+
displayName: "StyledTimeInput__StyledTimeInputSeparator",
|
|
40
|
+
componentId: "sc-xktdr3-4"
|
|
41
|
+
})(["display:inline-flex;align-items:center;line-height:inherit;color:", ";", ""], function (props) {
|
|
42
|
+
return (0, _utils.normalizeColor)(props.$filled ? 'text' : props.theme.global.colors.placeholder, props.theme);
|
|
43
|
+
}, function (props) {
|
|
44
|
+
var weight = props.theme.global.input.weight || props.theme.global.input.font.weight;
|
|
45
|
+
return weight && "font-weight: " + weight + ";";
|
|
46
|
+
});
|
|
47
|
+
var StyledTimeInputSegment = exports.StyledTimeInputSegment = _styledComponents["default"].span.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
48
|
+
displayName: "StyledTimeInput__StyledTimeInputSegment",
|
|
49
|
+
componentId: "sc-xktdr3-5"
|
|
50
|
+
})(["&:focus{outline:none;}display:inline-flex;align-items:center;position:relative;line-height:inherit;padding-inline:", ";color:", ";", " ", ""], function (props) {
|
|
51
|
+
var _props$theme$timeInpu, _props$theme$global$e;
|
|
52
|
+
var padToken = (_props$theme$timeInpu = props.theme.timeInput) == null || (_props$theme$timeInpu = _props$theme$timeInpu.active) == null ? void 0 : _props$theme$timeInpu.pad;
|
|
53
|
+
return ((_props$theme$global$e = props.theme.global.edgeSize) == null ? void 0 : _props$theme$global$e[padToken]) || padToken;
|
|
54
|
+
}, function (props) {
|
|
55
|
+
return (0, _utils.normalizeColor)(props.$filled ? 'text' : props.theme.global.colors.placeholder, props.theme);
|
|
56
|
+
}, function (props) {
|
|
57
|
+
var weight = props.theme.global.input.weight || props.theme.global.input.font.weight;
|
|
58
|
+
return weight && "font-weight: " + weight + ";";
|
|
59
|
+
}, function (props) {
|
|
60
|
+
var _props$theme$global$e2, _props$theme$timeInpu2, _props$theme$global$b, _props$theme$global$e3, _props$theme$timeInpu3, _props$theme$timeInpu4;
|
|
61
|
+
if (!props.$active) return '';
|
|
62
|
+
|
|
63
|
+
// The active indicator's corner rounding is intentionally a fixed
|
|
64
|
+
// "hair" edge size rather than a theme-exposed value we can expose
|
|
65
|
+
// theme in future.
|
|
66
|
+
var activeRound = (_props$theme$global$e2 = props.theme.global.edgeSize) == null ? void 0 : _props$theme$global$e2.hair;
|
|
67
|
+
var activeBorderToken = (_props$theme$timeInpu2 = props.theme.timeInput) == null || (_props$theme$timeInpu2 = _props$theme$timeInpu2.active) == null || (_props$theme$timeInpu2 = _props$theme$timeInpu2.indicator) == null ? void 0 : _props$theme$timeInpu2.size;
|
|
68
|
+
var activeBorderSize = ((_props$theme$global$b = props.theme.global.borderSize) == null ? void 0 : _props$theme$global$b[activeBorderToken]) || ((_props$theme$global$e3 = props.theme.global.edgeSize) == null ? void 0 : _props$theme$global$e3[activeBorderToken]) || activeBorderToken || props.theme.global.borderSize.small;
|
|
69
|
+
return (0, _styledComponents.css)(["&::before{content:'';position:absolute;inset:0;background-color:", ";border-top-left-radius:", ";border-top-right-radius:", ";}&::after{content:'';position:absolute;left:0;right:0;bottom:0;height:", ";background-color:", ";border-bottom-left-radius:", ";border-bottom-right-radius:", ";}"], (0, _utils.normalizeColor)((_props$theme$timeInpu3 = props.theme.timeInput) == null || (_props$theme$timeInpu3 = _props$theme$timeInpu3.active) == null ? void 0 : _props$theme$timeInpu3.background, props.theme), activeRound, activeRound, activeBorderSize, (0, _utils.normalizeColor)(((_props$theme$timeInpu4 = props.theme.timeInput) == null || (_props$theme$timeInpu4 = _props$theme$timeInpu4.active) == null || (_props$theme$timeInpu4 = _props$theme$timeInpu4.indicator) == null ? void 0 : _props$theme$timeInpu4.color) || {
|
|
70
|
+
dark: 'white',
|
|
71
|
+
light: 'black'
|
|
72
|
+
}, props.theme), activeRound, activeRound);
|
|
73
|
+
});
|