grommet 2.55.0 → 2.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Button/Button.js +7 -4
- package/components/Button/stories/CustomThemed/ChildrenPlainOption.stories.js +86 -0
- package/components/FormField/FormField.js +1 -1
- package/components/Grommet/index.d.ts +21 -0
- package/components/Grommet/propTypes.js +26 -0
- package/components/Stepper/StepConnector.js +68 -0
- package/components/Stepper/Stepper.js +309 -0
- package/components/Stepper/StepperContext.js +43 -0
- package/components/Stepper/StepperDescription.js +26 -0
- package/components/Stepper/StepperHelperText.js +44 -0
- package/components/Stepper/StepperIndicator.js +74 -0
- package/components/Stepper/StepperLabel.js +41 -0
- package/components/Stepper/StepperStep.js +127 -0
- package/components/Stepper/StyledStepper.js +124 -0
- package/components/Stepper/index.d.ts +80 -0
- package/components/Stepper/index.js +18 -0
- package/components/Stepper/propTypes.js +35 -0
- package/components/Stepper/stories/DisabledSteps.stories.js +45 -0
- package/components/Stepper/stories/ErrorStates.stories.js +45 -0
- package/components/Stepper/stories/HorizontalSteps.stories.js +50 -0
- package/components/Stepper/stories/Interactive.stories.js +60 -0
- package/components/Stepper/stories/KeyboardNavigation.stories.js +64 -0
- package/components/Stepper/stories/NestedSubSteps.stories.js +70 -0
- package/components/Stepper/stories/ReadOnly.stories.js +43 -0
- package/components/Stepper/stories/ThemingLightDark.stories.js +58 -0
- package/components/Stepper/stories/VerticalSteps.stories.js +67 -0
- package/components/Tab/Tab.js +19 -6
- package/components/Tabs/Tabs.js +156 -22
- package/components/TimeInput/README.md +2 -0
- package/components/TimeInput/StyledTimeInput.js +73 -0
- package/components/TimeInput/TimeInput.js +689 -0
- package/components/TimeInput/TimeInputPopup.js +393 -0
- package/components/TimeInput/index.d.ts +41 -0
- package/components/TimeInput/index.js +6 -0
- package/components/TimeInput/propTypes.js +35 -0
- package/components/TimeInput/stories/Controlled.stories.tsx +29 -0
- package/components/TimeInput/stories/Disabled.stories.tsx +13 -0
- package/components/TimeInput/stories/Form.stories.tsx +38 -0
- package/components/TimeInput/stories/ReadOnly.stories.tsx +13 -0
- package/components/TimeInput/stories/Simple.stories.tsx +19 -0
- package/components/TimeInput/stories/Step.stories.tsx +14 -0
- package/components/TimeInput/stories/ThemingLightDark.stories.tsx +22 -0
- package/components/TimeInput/stories/Uncontrolled.stories.tsx +22 -0
- package/components/TimeInput/useSectionedTimeField.js +359 -0
- package/components/TimeInput/utils.js +187 -0
- package/components/index.d.ts +2 -0
- package/components/index.js +12 -0
- package/es6/components/Button/Button.js +7 -4
- package/es6/components/Button/stories/CustomThemed/ChildrenPlainOption.stories.js +81 -0
- package/es6/components/FormField/FormField.js +1 -1
- package/es6/components/Grommet/index.d.ts +21 -0
- package/es6/components/Grommet/propTypes.js +26 -0
- package/es6/components/Stepper/StepConnector.js +63 -0
- package/es6/components/Stepper/Stepper.js +306 -0
- package/es6/components/Stepper/StepperContext.js +39 -0
- package/es6/components/Stepper/StepperDescription.js +21 -0
- package/es6/components/Stepper/StepperHelperText.js +39 -0
- package/es6/components/Stepper/StepperIndicator.js +69 -0
- package/es6/components/Stepper/StepperLabel.js +36 -0
- package/es6/components/Stepper/StepperStep.js +122 -0
- package/es6/components/Stepper/StyledStepper.js +120 -0
- package/es6/components/Stepper/index.d.ts +80 -0
- package/es6/components/Stepper/index.js +6 -0
- package/es6/components/Stepper/propTypes.js +30 -0
- package/es6/components/Stepper/stories/DisabledSteps.stories.js +41 -0
- package/es6/components/Stepper/stories/ErrorStates.stories.js +41 -0
- package/es6/components/Stepper/stories/HorizontalSteps.stories.js +46 -0
- package/es6/components/Stepper/stories/Interactive.stories.js +56 -0
- package/es6/components/Stepper/stories/KeyboardNavigation.stories.js +60 -0
- package/es6/components/Stepper/stories/NestedSubSteps.stories.js +66 -0
- package/es6/components/Stepper/stories/ReadOnly.stories.js +39 -0
- package/es6/components/Stepper/stories/ThemingLightDark.stories.js +54 -0
- package/es6/components/Stepper/stories/VerticalSteps.stories.js +63 -0
- package/es6/components/Tab/Tab.js +19 -6
- package/es6/components/Tabs/Tabs.js +157 -23
- package/es6/components/TimeInput/README.md +2 -0
- package/es6/components/TimeInput/StyledTimeInput.js +68 -0
- package/es6/components/TimeInput/TimeInput.js +685 -0
- package/es6/components/TimeInput/TimeInputPopup.js +389 -0
- package/es6/components/TimeInput/index.d.ts +41 -0
- package/es6/components/TimeInput/index.js +1 -0
- package/es6/components/TimeInput/propTypes.js +30 -0
- package/es6/components/TimeInput/stories/Controlled.stories.tsx +29 -0
- package/es6/components/TimeInput/stories/Disabled.stories.tsx +13 -0
- package/es6/components/TimeInput/stories/Form.stories.tsx +38 -0
- package/es6/components/TimeInput/stories/ReadOnly.stories.tsx +13 -0
- package/es6/components/TimeInput/stories/Simple.stories.tsx +19 -0
- package/es6/components/TimeInput/stories/Step.stories.tsx +14 -0
- package/es6/components/TimeInput/stories/ThemingLightDark.stories.tsx +22 -0
- package/es6/components/TimeInput/stories/Uncontrolled.stories.tsx +22 -0
- package/es6/components/TimeInput/useSectionedTimeField.js +356 -0
- package/es6/components/TimeInput/utils.js +183 -0
- package/es6/components/index.d.ts +2 -0
- package/es6/components/index.js +2 -0
- package/es6/index.d.ts +2 -0
- package/es6/languages/default.json +20 -0
- package/es6/themes/base.d.ts +108 -0
- package/es6/themes/base.js +208 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/index.d.ts +2 -0
- package/languages/default.json +20 -0
- package/package.json +41 -40
- package/themes/base.d.ts +108 -0
- package/themes/base.js +208 -0
- package/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +0 -180
- package/components/TextInput/stories/CustomThemed/Themed.stories.js +0 -79
- package/es6/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +0 -180
- package/es6/components/TextInput/stories/CustomThemed/Themed.stories.js +0 -74
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
|
+
});
|