@qualtrics/ui-react 2.18.0 → 2.19.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/CHANGELOG.md +28 -0
- package/dist/__shared/cjs/{index-00992312.js → index-384184bd.js} +994 -1872
- package/dist/__shared/cjs/{index-615ed9b2.js → index-4a5425cc.js} +10 -7
- package/dist/components/Accordion/Accordion.js +1 -5
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Accordion/AccordionHeader.js +4 -8
- package/dist/components/Accordion/AccordionPanel.js +3 -3
- package/dist/components/BreakpointSwitch/Breakpoint.js +0 -2
- package/dist/components/BreakpointSwitch/BreakpointSwitch.js +0 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button2.js +2 -7
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -2
- package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +11 -11
- package/dist/components/Checkbox/Checkbox2.js +3 -3
- package/dist/components/Checkbox/VisualCheckbox.js +1 -1
- package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
- package/dist/components/ColorPicker/Alpha.js +9 -30
- package/dist/components/ColorPicker/ColorPicker.js +33 -42
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/ColorPicker/ColorPickerFlyout.js +2 -1
- package/dist/components/ColorPicker/ColorPickerFlyoutInputs.js +20 -23
- package/dist/components/ColorPicker/Hue.js +2 -19
- package/dist/components/ColorPicker/Palette.js +7 -27
- package/dist/components/ColorPicker/Saturation.js +8 -29
- package/dist/components/ColorPicker/utils/calculateTargetId.js +10 -20
- package/dist/components/ColorPicker/utils/getMousePosition.js +4 -3
- package/dist/components/ColorPicker/utils/hexToHsv.js +0 -5
- package/dist/components/ColorPicker/utils/hexToRgbaString.js +2 -4
- package/dist/components/ColorPicker/utils/hsvToHex.js +0 -3
- package/dist/components/ColorPicker/utils/rgbToHex.js +1 -1
- package/dist/components/ColorPicker/utils/validateHex.js +12 -19
- package/dist/components/Combobox/Combobox.js +57 -127
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/Combobox/ComboboxHeader.js +1 -1
- package/dist/components/Combobox/ComboboxIcon.js +2 -4
- package/dist/components/Combobox/ComboboxInput.js +4 -5
- package/dist/components/Combobox/ComboboxList.js +2 -2
- package/dist/components/ConfigPane/ConfigPane.js +0 -7
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/ChildIndexContext/index.js +0 -1
- package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +34 -30
- package/dist/components/Dropdown/Dropdown.js +17 -68
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/Dropdown/DropdownButton.js +23 -33
- package/dist/components/Dropdown/DropdownHeader.js +2 -1
- package/dist/components/Dropdown/DropdownList.js +8 -7
- package/dist/components/Dropdown/DropdownOption.js +3 -10
- package/dist/components/Dropdown/DropdownSearch.js +6 -24
- package/dist/components/FilePicker/FilePicker.js +15 -26
- package/dist/components/FilePicker/FilePicker2.js +3 -3
- package/dist/components/FormField/Caption.js +3 -3
- package/dist/components/FormField/FormField.js +2 -2
- package/dist/components/FormField/FormField2.js +3 -3
- package/dist/components/FormField/FormFieldContext.js +3 -6
- package/dist/components/FormField/ReadOnlyText.js +2 -1
- package/dist/components/FullScreenTakeover/FullScreenTakeover.js +5 -11
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/Icon/Icon.js +3 -6
- package/dist/components/Icon/IconTypes.js +1 -0
- package/dist/components/IconButton/IconButton.js +1 -6
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput.js +16 -33
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input.js +3 -2
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/Input/InputField.js +2 -5
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/InputGroup/InputGroupProvider.js +0 -2
- package/dist/components/Label/Label2.js +3 -3
- package/dist/components/Link/Link2.js +3 -3
- package/dist/components/LoadingSpinner/LoadingSpinner.js +1 -1
- package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/components/LogicEditor/ConditionContainer.js +0 -2
- package/dist/components/LogicEditor/ConditionSet.js +8 -25
- package/dist/components/LogicEditor/Controls.js +2 -2
- package/dist/components/LogicEditor/LogicEditor.js +3 -12
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/LogicEditor/utils.js +9 -34
- package/dist/components/Modal/Modal.js +22 -35
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/BaseMenu.js +43 -108
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NewMenu/SelectMenu/SelectMenu.js +2 -3
- package/dist/components/NewMenu/parts/ArrowNav/ArrowNav.js +20 -32
- package/dist/components/NewMenu/parts/MenuItem.js +2 -3
- package/dist/components/NewMenu/parts/MenuSearchBox.js +2 -1
- package/dist/components/NumberStepper/NumberStepper.js +29 -44
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/NumberStepper/NumberStepperDecrement.js +6 -5
- package/dist/components/NumberStepper/NumberStepperIncrement.js +6 -5
- package/dist/components/NumberStepper/NumberStepperInput.js +10 -12
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination.js +10 -6
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Pagination/PaginationNextButton.js +8 -8
- package/dist/components/Pagination/PaginationPageInput.js +17 -22
- package/dist/components/Pagination/PaginationPreviousButton.js +8 -8
- package/dist/components/Popover/Popover.js +9 -18
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch.js +3 -5
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/QuickSearch/QuickSearchInput.js +6 -23
- package/dist/components/Radio/Radio.js +11 -13
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/SearchInput/SearchInput.js +5 -11
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/ExpandCollapseButton.js +0 -2
- package/dist/components/SidebarNav/SidebarNav.js +5 -4
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/SidebarNav/SidebarNavLink.js +1 -4
- package/dist/components/Slider/RangeSlider.js +8 -22
- package/dist/components/Slider/Slider.js +7 -26
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Slider/SliderButton.js +7 -9
- package/dist/components/Switch/Switch.js +11 -11
- package/dist/components/Switch/Switch2.js +3 -3
- package/dist/components/Table/Table2.js +3 -3
- package/dist/components/Tabs/Tab.js +3 -3
- package/dist/components/Tabs/TabContextProvider.js +1 -1
- package/dist/components/Tabs/TabList.js +9 -17
- package/dist/components/Tabs/TabPanel.js +3 -3
- package/dist/components/Tabs/TabPanels.js +0 -2
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip.js +12 -41
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/UIProvider/PortalTargetContext.js +0 -1
- package/dist/components/UIProvider/UIProvider.js +2 -2
- package/dist/components/deprecated_ColorPicker/Alpha.js +4 -11
- package/dist/components/deprecated_ColorPicker/Color.js +9 -66
- package/dist/components/deprecated_ColorPicker/ColorPicker.js +2 -8
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_ColorPicker/HexInput.js +1 -7
- package/dist/components/deprecated_ColorPicker/Hue.js +3 -10
- package/dist/components/deprecated_ColorPicker/Saturation.js +7 -14
- package/dist/components/deprecated_ColorPicker/Swatch.js +2 -6
- package/dist/components/deprecated_ColorPicker/useMouseDrag.js +0 -3
- package/dist/components/deprecated_NumberStepper/NumberStepper.js +14 -20
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepperDecrement.js +7 -6
- package/dist/components/deprecated_NumberStepper/NumberStepperIncrement.js +7 -6
- package/dist/components/deprecated_NumberStepper/NumberStepperInput.js +16 -17
- package/dist/components/deprecated_Tabs/Tabs.js +9 -25
- package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
- package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanel.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanels.js +3 -17
- package/dist/components/deprecated_Toolbar/ToolbarTab.js +10 -26
- package/dist/components/deprecated_Toolbar/ToolbarTabs.js +6 -18
- package/dist/hooks/useBreakpoints/useBreakpoints.js +3 -4
- package/dist/hooks/useClickOutside/useClickOutside.js +2 -7
- package/dist/hooks/useClickOutsidePortals/useClickOutsidePortals.js +3 -6
- package/dist/hooks/useControllableState/useControllableState.js +5 -10
- package/dist/hooks/useDidUpdate/useDidUpdate.js +2 -4
- package/dist/hooks/useEventCallback/useEventCallback.js +2 -1
- package/dist/hooks/useEventListener/useEventListener.js +1 -4
- package/dist/hooks/useFocusSequence/useFocusSequence.js +10 -17
- package/dist/hooks/useId/useId.js +1 -2
- package/dist/hooks/useIsFocused/useIsFocused.js +0 -1
- package/dist/hooks/useIsHovered/useIsHovered.js +0 -1
- package/dist/hooks/useIsTruncated/useIsTruncated.js +4 -3
- package/dist/hooks/useLatest/useLatest.js +0 -1
- package/dist/hooks/useMounted/useMounted.js +0 -1
- package/dist/hooks/useMouseDrag/useMouseDrag.js +0 -4
- package/dist/hooks/useOverlay/useOverlay.js +4 -10
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/usePrevious/usePrevious.js +0 -1
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +1 -4
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement.js +11 -16
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/components/HeadsetIcon.js +6 -0
- package/dist/icons/components/PauseCircleIcon.js +1 -1
- package/dist/icons/createIconComponent.js +2 -3
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.es.js +1 -0
- package/dist/icons/index.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +4 -3
- package/dist/index.js +6 -5
- package/dist/next/AdvancedTable/AdvancedTable.js +82 -188
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTableCell.js +4 -14
- package/dist/next/AdvancedTable/AdvancedTableCheckbox.js +0 -1
- package/dist/next/AdvancedTable/AdvancedTableColumnHeader.js +11 -41
- package/dist/next/AdvancedTable/AdvancedTableColumnHeaderMenu.js +8 -14
- package/dist/next/AdvancedTable/AdvancedTableDragPreview.js +4 -6
- package/dist/next/AdvancedTable/AdvancedTablePagination.js +1 -4
- package/dist/next/AdvancedTable/AdvancedTableRowExpandButton.js +0 -1
- package/dist/next/AdvancedTable/AdvancedTableTypes.js +1 -3
- package/dist/next/AdvancedTable/useAdvancedTableDragAndDrop.js +8 -13
- package/dist/next/AdvancedTable/useComputedWidth.js +1 -1
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput.js +5 -20
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInputIconButton.js +1 -1
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Combobox/ComboboxFlyout.js +3 -3
- package/dist/next/Combobox/ComboboxGroup.js +1 -1
- package/dist/next/Combobox/ComboboxInput.js +7 -20
- package/dist/next/Combobox/ComboboxOption.js +5 -6
- package/dist/next/Combobox/hooks/useComboboxFilteredGroup/useComboboxFilteredGroup.js +4 -5
- package/dist/next/Combobox/hooks/useComboboxFocusSequence/useComboboxFocusSequence.js +37 -54
- package/dist/next/Combobox/hooks/useComboboxLoadingState/useComboboxLoadingState.js +4 -5
- package/dist/next/Combobox/hooks/useComboboxValue/useComboboxValue.js +5 -3
- package/dist/next/Combobox/hooks/useListboxFlyoutDimensions/useListboxFlyoutDimensions.js +10 -10
- package/dist/next/Combobox/hooks/useSelectedOptionScroll/useSelectedOptionScroll.js +1 -6
- package/dist/next/Combobox/hooks/useShouldRenderGroupHeader/useShouldRenderGroupHeader.js +6 -6
- package/dist/next/Combobox/utils/nodeRegistration/nodeRegistration.js +4 -6
- package/dist/next/Drawer/Drawer.js +5 -16
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor.js +7 -5
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Input/Input.js +5 -8
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/Menu/Menu.js +10 -23
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuContext.js +0 -2
- package/dist/next/Menu/MenuItem.js +11 -15
- package/dist/next/Menu/MenuPane.js +11 -25
- package/dist/next/Menu/MenuSearch.js +15 -22
- package/dist/next/Menu/SubMenu.js +10 -27
- package/dist/next/Menu/usePaneSearch.js +2 -1
- package/dist/next/PhoneNumberInput/PhoneNumberInput.js +12 -19
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/SplitButton/SplitButton.js +6 -12
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/Stack/HStack.js +11 -0
- package/dist/next/Stack/Stack.js +95 -0
- package/dist/next/Stack/StackItem.js +37 -0
- package/dist/next/Stack/VStack.js +11 -0
- package/dist/next/Stack/index.js +3 -0
- package/dist/next/TimePicker/TimeDropdown.js +4 -5
- package/dist/next/TimePicker/TimeInput.js +4 -5
- package/dist/next/TimePicker/TimePicker.js +12 -30
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/TimePicker/TimePickerIcon.js +1 -3
- package/dist/next/TimePicker/utils.js +12 -52
- package/dist/next/ToggleButton/ToggleButton.js +0 -5
- package/dist/next/ToggleButton/ToggleButtonGroup.js +2 -1
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.d.ts +82 -4
- package/dist/next/index.es.js +4 -0
- package/dist/next/index.js +514 -745
- package/dist/utils/Flyout/Flyout.js +4 -5
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/dist/utils/Popper/Popper.js +18 -25
- package/dist/utils/Portal/Portal.js +2 -1
- package/dist/utils/TextOverflowTooltip/TextOverflowTooltip.js +4 -4
- package/dist/utils/Translation/Translate.js +0 -4
- package/dist/utils/Translation/TranslationProvider.js +0 -1
- package/dist/utils/Translation/containsComponentOrElement.js +1 -5
- package/dist/utils/Translation/insertPlaceholders.js +0 -1
- package/dist/utils/Translation/useTranslation.js +7 -14
- package/dist/utils/concatIds/concatIds.js +0 -1
- package/dist/utils/constants.js +2 -2
- package/dist/utils/createContextUtilities/createContextUtilities.js +0 -4
- package/dist/utils/filterChildren/filterChildren.js +8 -17
- package/dist/utils/getSubDataTestId/getSubDataTestId.js +1 -2
- package/dist/utils/keyboardUser/keyboardUser.js +0 -1
- package/dist/utils/mediaQueryManager/mediaQueryManager.js +1 -12
- package/dist/utils/mergeRefs/mergeRefs.js +1 -2
- package/dist/utils/wrapAround/wrapAround.js +1 -2
- package/dist/utils/wrapEvent/wrapEvent.js +2 -4
- package/icons/package.json +3 -2
- package/next/package.json +6 -2
- package/package.json +10 -5
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React__default, { forwardRef } from 'react';
|
|
2
|
+
|
|
3
|
+
// Explicitly listed props to prevent arbitrary prop spreading
|
|
4
|
+
const StackItem = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
5
|
+
let {
|
|
6
|
+
width,
|
|
7
|
+
minWidth,
|
|
8
|
+
maxWidth,
|
|
9
|
+
height,
|
|
10
|
+
minHeight,
|
|
11
|
+
maxHeight,
|
|
12
|
+
fillSpace,
|
|
13
|
+
'aria-label': ariaLabel,
|
|
14
|
+
'aria-labelledby': ariaLabelledBy,
|
|
15
|
+
'aria-describedby': ariaDescribedBy,
|
|
16
|
+
'data-testid': dataTestId,
|
|
17
|
+
children
|
|
18
|
+
} = _ref;
|
|
19
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
20
|
+
ref: ref,
|
|
21
|
+
style: {
|
|
22
|
+
width,
|
|
23
|
+
minWidth,
|
|
24
|
+
maxWidth,
|
|
25
|
+
height,
|
|
26
|
+
minHeight,
|
|
27
|
+
maxHeight,
|
|
28
|
+
flex: fillSpace ? '1 1 0%' : 'none'
|
|
29
|
+
},
|
|
30
|
+
"aria-label": ariaLabel,
|
|
31
|
+
"aria-labelledby": ariaLabelledBy,
|
|
32
|
+
"aria-describedby": ariaDescribedBy,
|
|
33
|
+
"data-testid": dataTestId
|
|
34
|
+
}, children);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { StackItem };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
|
+
import { Stack } from './Stack.js';
|
|
4
|
+
|
|
5
|
+
const VStack = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/React__default.createElement(Stack, _extends({
|
|
6
|
+
ref: ref
|
|
7
|
+
}, props, {
|
|
8
|
+
direction: "vertical"
|
|
9
|
+
})));
|
|
10
|
+
|
|
11
|
+
export { VStack };
|
|
@@ -25,7 +25,6 @@ const TimeDropdown = _ref => {
|
|
|
25
25
|
const [refsInitialized, setRefsInitialized] = useState(false);
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
const nodes = scrollRef.current;
|
|
28
|
-
|
|
29
28
|
if (scrolledToItem && nodes[scrolledToItem.index]) {
|
|
30
29
|
nodes[scrolledToItem.index].scrollIntoView();
|
|
31
30
|
}
|
|
@@ -44,14 +43,14 @@ const TimeDropdown = _ref => {
|
|
|
44
43
|
"aria-label": ariaLabel,
|
|
45
44
|
"aria-labelledby": ariaLabelledBy,
|
|
46
45
|
"aria-describedby": ariaDescribedBy,
|
|
47
|
-
"data-testid": dataTestId &&
|
|
46
|
+
"data-testid": dataTestId && `${dataTestId}-dropdown`,
|
|
48
47
|
className: styles.flyout,
|
|
49
48
|
onMouseOver: () => setIsOptionHovered(true),
|
|
50
49
|
onMouseLeave: () => setIsOptionHovered(false)
|
|
51
50
|
}, items.map((item, index) => /*#__PURE__*/React__default.createElement(FlyoutOption, {
|
|
52
51
|
id: item.id,
|
|
53
52
|
isHighlightedOnHover: true,
|
|
54
|
-
isHighlighted:
|
|
53
|
+
isHighlighted: scrolledToItem?.index === index && scrolledToItem?.isFocused,
|
|
55
54
|
key: item.label,
|
|
56
55
|
ref: node => {
|
|
57
56
|
if (node) {
|
|
@@ -60,9 +59,9 @@ const TimeDropdown = _ref => {
|
|
|
60
59
|
}
|
|
61
60
|
},
|
|
62
61
|
onClick: () => onClick(index),
|
|
63
|
-
"data-testid": dataTestId &&
|
|
62
|
+
"data-testid": dataTestId && `${dataTestId}-option-${index}`,
|
|
64
63
|
className: classNames(styles.option, {
|
|
65
|
-
[styles.exactMatch]:
|
|
64
|
+
[styles.exactMatch]: scrolledToItem?.index === index && scrolledToItem.isExactMatch && !isOptionHovered
|
|
66
65
|
})
|
|
67
66
|
}, item.label))),
|
|
68
67
|
anchorNode: inputRef.current,
|
|
@@ -47,8 +47,7 @@ const TimeInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
47
47
|
correctedTime,
|
|
48
48
|
selectionModifier
|
|
49
49
|
} = correctTime(next.value, is24HourClock, false);
|
|
50
|
-
const newSelection = next
|
|
51
|
-
|
|
50
|
+
const newSelection = next?.selection;
|
|
52
51
|
if (newSelection) {
|
|
53
52
|
const validTimeLength = mask.length;
|
|
54
53
|
newSelection.start = shouldMoveSelectionToEnd ? validTimeLength : newSelection.start;
|
|
@@ -56,9 +55,9 @@ const TimeInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
56
55
|
newSelection.start = Math.min(newSelection.start + selectionModifier, validTimeLength);
|
|
57
56
|
newSelection.end = Math.min(newSelection.end + selectionModifier, validTimeLength);
|
|
58
57
|
}
|
|
59
|
-
|
|
60
58
|
setShouldMoveSelectionToEnd(false);
|
|
61
|
-
return {
|
|
59
|
+
return {
|
|
60
|
+
...next,
|
|
62
61
|
value: correctedTime,
|
|
63
62
|
selection: newSelection
|
|
64
63
|
};
|
|
@@ -80,7 +79,7 @@ const TimeInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
80
79
|
"aria-labelledby": ariaLabelledBy,
|
|
81
80
|
"aria-describedby": ariaDescribedBy,
|
|
82
81
|
"aria-activedescendant": ariaActiveDescendant,
|
|
83
|
-
"data-testid": dataTestId &&
|
|
82
|
+
"data-testid": dataTestId && `${dataTestId}-input`
|
|
84
83
|
}));
|
|
85
84
|
});
|
|
86
85
|
|
|
@@ -20,7 +20,6 @@ const DEFAULT_TIME = (() => {
|
|
|
20
20
|
minute
|
|
21
21
|
};
|
|
22
22
|
})();
|
|
23
|
-
|
|
24
23
|
const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
25
24
|
let {
|
|
26
25
|
value: externalValue,
|
|
@@ -35,12 +34,13 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
35
34
|
'aria-describedby': ariaDescribedBy
|
|
36
35
|
} = _ref;
|
|
37
36
|
const timePickerId = useId(externalId);
|
|
38
|
-
const inputId =
|
|
39
|
-
const dropdownId =
|
|
37
|
+
const inputId = `${timePickerId}-input`;
|
|
38
|
+
const dropdownId = `${timePickerId}-dropdown`;
|
|
40
39
|
const [isOptionHovered, setIsOptionHovered] = useState(false);
|
|
41
40
|
const [timeObject, setTimeObject] = useControllableState(DEFAULT_TIME, externalOnChange, externalValue);
|
|
42
|
-
const defaultTimeString = convertTimeObjectToTimeString(timeObject, is24HourClock);
|
|
41
|
+
const defaultTimeString = convertTimeObjectToTimeString(timeObject, is24HourClock);
|
|
43
42
|
|
|
43
|
+
// timeString needs its own state instead of always being derived from timeObject, since typing doesn't "commit" a new time.
|
|
44
44
|
const [timeString, setTimeString] = useState(defaultTimeString);
|
|
45
45
|
const [isTimeStringDirty, setIsTimeStringDirty] = useState(false);
|
|
46
46
|
const step = 60 * 30;
|
|
@@ -51,11 +51,10 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
51
51
|
} = correctTime(typedTime, is24HourClock, true);
|
|
52
52
|
const correctedTimeObject = convertTimeStringToTimeObject(correctedTime);
|
|
53
53
|
const correctedTimeValue = correctedTimeObject.hour * 60 * 60 + correctedTimeObject.minute * 60;
|
|
54
|
-
let minDistance = correctedTimeValue - dropdownItems[0].value;
|
|
55
|
-
|
|
54
|
+
let minDistance = correctedTimeValue - dropdownItems[0].value;
|
|
55
|
+
// Substring search up to first empty spot
|
|
56
56
|
for (let i = 1; i < dropdownItems.length; i += 1) {
|
|
57
57
|
const distance = correctedTimeValue - dropdownItems[i].value;
|
|
58
|
-
|
|
59
58
|
if (distance > minDistance || distance < 0) {
|
|
60
59
|
return {
|
|
61
60
|
index: i - 1,
|
|
@@ -63,10 +62,8 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
63
62
|
isExactMatch: minDistance === 0
|
|
64
63
|
};
|
|
65
64
|
}
|
|
66
|
-
|
|
67
65
|
minDistance = distance;
|
|
68
66
|
}
|
|
69
|
-
|
|
70
67
|
return {
|
|
71
68
|
index: dropdownItems.length - 1,
|
|
72
69
|
isFocused: false,
|
|
@@ -74,8 +71,9 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
74
71
|
};
|
|
75
72
|
}, [is24HourClock, dropdownItems]);
|
|
76
73
|
const [scrolledToItem, setScrolledToItem] = useState(() => getScrolledToItemFromTimeString(timeString));
|
|
77
|
-
const [shouldMoveSelectionToEnd, setShouldMoveSelectionToEnd] = useState(true);
|
|
74
|
+
const [shouldMoveSelectionToEnd, setShouldMoveSelectionToEnd] = useState(true);
|
|
78
75
|
|
|
76
|
+
// timeObject may be controlled and may change at any time, so we need to update timeString and the focused item whenever it changes.
|
|
79
77
|
useEffect(() => {
|
|
80
78
|
const newTimeString = convertTimeObjectToTimeString(timeObject, is24HourClock);
|
|
81
79
|
setTimeString(newTimeString);
|
|
@@ -83,8 +81,9 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
83
81
|
setShouldMoveSelectionToEnd(true);
|
|
84
82
|
setScrolledToItem(getScrolledToItemFromTimeString(newTimeString));
|
|
85
83
|
}, [timeObject, is24HourClock, getScrolledToItemFromTimeString]);
|
|
86
|
-
const [isFlyoutOpen, setIsFlyoutOpen] = useState(false);
|
|
84
|
+
const [isFlyoutOpen, setIsFlyoutOpen] = useState(false);
|
|
87
85
|
|
|
86
|
+
// Sets the actual time object and updates the flyout and focus state
|
|
88
87
|
const commitTimeString = function () {
|
|
89
88
|
let newTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : timeString;
|
|
90
89
|
const {
|
|
@@ -94,12 +93,10 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
94
93
|
setTimeObject(newTimeObject);
|
|
95
94
|
setIsFlyoutOpen(false);
|
|
96
95
|
};
|
|
97
|
-
|
|
98
96
|
const inputRef = useRef(null);
|
|
99
97
|
const dropdownRef = useRef(null);
|
|
100
98
|
const iconRef = useRef(null);
|
|
101
99
|
useClickOutside([inputRef, dropdownRef, iconRef], () => isTimeStringDirty ? commitTimeString() : setIsFlyoutOpen(false));
|
|
102
|
-
|
|
103
100
|
const focusNext = () => {
|
|
104
101
|
setScrolledToItem(f => {
|
|
105
102
|
if (!f.isFocused) {
|
|
@@ -111,11 +108,9 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
111
108
|
isExactMatch: false
|
|
112
109
|
};
|
|
113
110
|
}
|
|
114
|
-
|
|
115
111
|
if (f.index === dropdownItems.length - 1) {
|
|
116
112
|
return f;
|
|
117
113
|
}
|
|
118
|
-
|
|
119
114
|
return {
|
|
120
115
|
index: f.index + 1,
|
|
121
116
|
isFocused: true,
|
|
@@ -123,7 +118,6 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
123
118
|
};
|
|
124
119
|
});
|
|
125
120
|
};
|
|
126
|
-
|
|
127
121
|
const focusPrevious = () => {
|
|
128
122
|
setScrolledToItem(f => {
|
|
129
123
|
if (!f.isFocused) {
|
|
@@ -135,11 +129,9 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
135
129
|
isExactMatch: false
|
|
136
130
|
};
|
|
137
131
|
}
|
|
138
|
-
|
|
139
132
|
if (f.index === 0) {
|
|
140
133
|
return f;
|
|
141
134
|
}
|
|
142
|
-
|
|
143
135
|
return {
|
|
144
136
|
index: f.index - 1,
|
|
145
137
|
isFocused: true,
|
|
@@ -147,20 +139,17 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
147
139
|
};
|
|
148
140
|
});
|
|
149
141
|
};
|
|
150
|
-
|
|
151
142
|
const handleType = typedTime => {
|
|
152
143
|
setIsFlyoutOpen(true);
|
|
153
144
|
setTimeString(typedTime);
|
|
154
145
|
setIsTimeStringDirty(true);
|
|
155
146
|
setScrolledToItem(getScrolledToItemFromTimeString(typedTime));
|
|
156
147
|
};
|
|
157
|
-
|
|
158
148
|
const handleSelectTime = selectedIndex => {
|
|
159
149
|
const timeLabel = dropdownItems[selectedIndex].label;
|
|
160
150
|
setIsOptionHovered(false);
|
|
161
151
|
commitTimeString(timeLabel);
|
|
162
152
|
};
|
|
163
|
-
|
|
164
153
|
const handleKeyDown = e => {
|
|
165
154
|
switch (e.key) {
|
|
166
155
|
case 'ArrowUp':
|
|
@@ -168,44 +157,37 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
168
157
|
setIsFlyoutOpen(true);
|
|
169
158
|
focusPrevious();
|
|
170
159
|
break;
|
|
171
|
-
|
|
172
160
|
case 'ArrowDown':
|
|
173
161
|
e.preventDefault();
|
|
174
162
|
setIsFlyoutOpen(true);
|
|
175
163
|
focusNext();
|
|
176
164
|
break;
|
|
177
|
-
|
|
178
165
|
case 'Enter':
|
|
179
166
|
e.preventDefault();
|
|
180
|
-
|
|
181
|
-
if (scrolledToItem !== null && scrolledToItem !== void 0 && scrolledToItem.isFocused) {
|
|
167
|
+
if (scrolledToItem?.isFocused) {
|
|
182
168
|
// "focus" is on the listbox
|
|
183
169
|
handleSelectTime(scrolledToItem.index);
|
|
184
170
|
} else {
|
|
185
171
|
// "focus" is on the input
|
|
186
172
|
commitTimeString();
|
|
187
173
|
}
|
|
188
|
-
|
|
189
174
|
break;
|
|
190
|
-
|
|
191
175
|
case 'Escape':
|
|
192
176
|
case 'Tab':
|
|
193
177
|
// use whatever time is closest to what's in the input
|
|
194
178
|
commitTimeString();
|
|
195
179
|
break;
|
|
196
|
-
|
|
197
180
|
default:
|
|
198
181
|
break;
|
|
199
182
|
}
|
|
200
183
|
};
|
|
201
|
-
|
|
202
184
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
203
185
|
id: timePickerId,
|
|
204
186
|
className: styles.container
|
|
205
187
|
}, /*#__PURE__*/React__default.createElement(TimeInput, {
|
|
206
188
|
id: inputId,
|
|
207
189
|
dataTestId: dataTestId,
|
|
208
|
-
ariaActiveDescendant: isFlyoutOpen && scrolledToItem
|
|
190
|
+
ariaActiveDescendant: isFlyoutOpen && scrolledToItem?.isFocused ? dropdownItems[scrolledToItem.index].id : undefined,
|
|
209
191
|
ariaControls: dropdownId,
|
|
210
192
|
ariaExpanded: isFlyoutOpen,
|
|
211
193
|
onChange: handleType,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"container":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._7lOdN{display:inline-block;position:relative}._dLogP{width:120px}._dLogP ._SvLXS._sB9s6{transform:rotate(-180deg)}._dLogP ._SvLXS._93Jl7{fill:#9d9fa1;opacity:.4}._oy5-J>input:focus{box-shadow:none!important;border:1px solid #898989!important}._HKxEu{width:120px}._HKxEu ._IjBc3._ttgJu{background-color:#efefef;border-radius:6px}._SvLXS{position:absolute;right:4px;bottom:4px;height:28px;width:28px}._SvLXS._sB9s6{transform:rotate(-180deg)}";
|
|
4
|
+
var styles = {"container":"_7lOdN","input":"_dLogP","icon":"_SvLXS","open":"_sB9s6","disabled":"_93Jl7","ignoreFocusStyle":"_oy5-J","flyout":"_HKxEu","option":"_IjBc3","exactMatch":"_ttgJu"};
|
|
5
|
+
var stylesheet="._7lOdN{display:inline-block;position:relative}._dLogP{width:120px}._dLogP ._SvLXS._sB9s6{transform:rotate(-180deg)}._dLogP ._SvLXS._93Jl7{fill:#9d9fa1;opacity:.4}._oy5-J>input:focus{box-shadow:none!important;border:1px solid #898989!important}._HKxEu{width:120px}._HKxEu ._IjBc3._ttgJu{background-color:#efefef;border-radius:6px}._SvLXS{position:absolute;right:4px;bottom:4px;height:28px;width:28px}._SvLXS._sB9s6{transform:rotate(-180deg)}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -23,10 +23,8 @@ const TimePickerIcon = _ref => {
|
|
|
23
23
|
})
|
|
24
24
|
}, /*#__PURE__*/React__default.createElement(ChevronDownIcon, {
|
|
25
25
|
onClick: !isDisabled ? () => {
|
|
26
|
-
var _inputRef$current;
|
|
27
|
-
|
|
28
26
|
setIsFlyoutOpen(i => !i);
|
|
29
|
-
|
|
27
|
+
inputRef.current?.focus();
|
|
30
28
|
} : undefined,
|
|
31
29
|
onMouseDown: e => e.preventDefault(),
|
|
32
30
|
ref: iconRef
|
|
@@ -10,11 +10,9 @@ const formatUtcDate = (utcDate, is24HourClock) => {
|
|
|
10
10
|
});
|
|
11
11
|
const dateWithoutLeadingZeros = format(utcDate);
|
|
12
12
|
let dateWithLeadingZeros = dateWithoutLeadingZeros;
|
|
13
|
-
|
|
14
13
|
if (dateWithLeadingZeros.split(':')[0].length === 1) {
|
|
15
|
-
dateWithLeadingZeros =
|
|
14
|
+
dateWithLeadingZeros = `0${dateWithLeadingZeros}`;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
return dateWithLeadingZeros.toLowerCase();
|
|
19
17
|
};
|
|
20
18
|
const convertTimeObjectToTimeString = (time, is24HourClock) => {
|
|
@@ -25,13 +23,11 @@ const convertTimeStringToTimeObject = completeTimeString => {
|
|
|
25
23
|
const [hourPart, minutePart, amPmPart] = completeTimeString.split(/:| /);
|
|
26
24
|
let hour = +hourPart;
|
|
27
25
|
const minute = +minutePart;
|
|
28
|
-
|
|
29
26
|
if (amPmPart === 'am' && hour === 12) {
|
|
30
27
|
hour = 0;
|
|
31
28
|
} else if (amPmPart === 'pm' && hour < 12) {
|
|
32
29
|
hour += 12;
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
return {
|
|
36
32
|
hour,
|
|
37
33
|
minute
|
|
@@ -44,28 +40,21 @@ const generateTimes = (step, is24HourClock) => {
|
|
|
44
40
|
return {
|
|
45
41
|
label: labelWithLeadingZeros,
|
|
46
42
|
value: i * step,
|
|
47
|
-
id:
|
|
43
|
+
id: `time-option-${i}`
|
|
48
44
|
};
|
|
49
45
|
});
|
|
50
46
|
};
|
|
51
|
-
|
|
52
47
|
function getTimeStringCorrector(str, is24HourClock) {
|
|
53
|
-
var _letterString;
|
|
54
|
-
|
|
55
48
|
let [numberString, letterString] = str.replace(':', '').split(' ');
|
|
56
|
-
letterString =
|
|
49
|
+
letterString = letterString?.toLowerCase();
|
|
57
50
|
let selectionModifier = 0;
|
|
58
|
-
|
|
59
51
|
const getTimeString = () => {
|
|
60
|
-
const finalNumberString =
|
|
61
|
-
return is24HourClock ? finalNumberString :
|
|
52
|
+
const finalNumberString = `${numberString.slice(0, 2)}:${numberString.slice(2, 4)}`;
|
|
53
|
+
return is24HourClock ? finalNumberString : `${finalNumberString} ${letterString}`;
|
|
62
54
|
};
|
|
63
|
-
|
|
64
55
|
const getSelectionModifier = () => selectionModifier;
|
|
65
|
-
|
|
66
56
|
const replaceDashes = () => {
|
|
67
57
|
numberString = numberString.replace(/-/g, '0');
|
|
68
|
-
|
|
69
58
|
if (letterString) {
|
|
70
59
|
if (letterString[0] === '-' || letterString[0] === 'a') {
|
|
71
60
|
// Arbitrarily choose AM if user hasn't typed 'a' or 'p'
|
|
@@ -75,55 +64,39 @@ function getTimeStringCorrector(str, is24HourClock) {
|
|
|
75
64
|
}
|
|
76
65
|
}
|
|
77
66
|
};
|
|
78
|
-
|
|
79
67
|
const shiftMinutesRight = () => {
|
|
80
|
-
numberString =
|
|
68
|
+
numberString = `${numberString.slice(0, 2)}0${numberString[2]}`;
|
|
81
69
|
selectionModifier += 1;
|
|
82
70
|
};
|
|
83
|
-
|
|
84
71
|
const prependCharacter = character => {
|
|
85
|
-
numberString =
|
|
72
|
+
numberString = `${character}${numberString}`;
|
|
86
73
|
selectionModifier += 1;
|
|
87
74
|
};
|
|
88
|
-
|
|
89
75
|
const setHoursTo12 = () => {
|
|
90
|
-
numberString =
|
|
76
|
+
numberString = `12${numberString.slice(2)}`;
|
|
91
77
|
};
|
|
92
|
-
|
|
93
78
|
const clearSecondHoursDigit = () => {
|
|
94
|
-
numberString =
|
|
79
|
+
numberString = `${numberString.slice(0, 1)}0${numberString.slice(2)}`;
|
|
95
80
|
};
|
|
96
|
-
|
|
97
81
|
const hoursAre00 = () => numberString[0] === '0' && numberString[1] === '0';
|
|
98
|
-
|
|
99
82
|
const firstHourGreaterThan1 = () => {
|
|
100
83
|
var _context;
|
|
101
|
-
|
|
102
84
|
return !_includesInstanceProperty(_context = '01-').call(_context, numberString[0]);
|
|
103
85
|
};
|
|
104
|
-
|
|
105
86
|
const firstHourGreaterThan2 = () => {
|
|
106
87
|
var _context2;
|
|
107
|
-
|
|
108
88
|
return !_includesInstanceProperty(_context2 = '012-').call(_context2, numberString[0]);
|
|
109
89
|
};
|
|
110
|
-
|
|
111
90
|
const hoursGreaterThan12 = () => {
|
|
112
91
|
var _context3;
|
|
113
|
-
|
|
114
92
|
return numberString[0] === '1' && !_includesInstanceProperty(_context3 = '012-').call(_context3, numberString[1]);
|
|
115
93
|
};
|
|
116
|
-
|
|
117
94
|
const hoursGreaterThan23 = () => {
|
|
118
95
|
var _context4;
|
|
119
|
-
|
|
120
96
|
return numberString[0] === '2' && !_includesInstanceProperty(_context4 = '0123-').call(_context4, numberString[1]);
|
|
121
97
|
};
|
|
122
|
-
|
|
123
98
|
const firstMinuteGreaterThan5 = () => numberString[2] !== '-' && +numberString[2] > 5;
|
|
124
|
-
|
|
125
99
|
const hasTypedMinutes = () => numberString[2] !== '-' && numberString[3] !== '-';
|
|
126
|
-
|
|
127
100
|
return {
|
|
128
101
|
getTimeString,
|
|
129
102
|
getSelectionModifier,
|
|
@@ -141,18 +114,14 @@ function getTimeStringCorrector(str, is24HourClock) {
|
|
|
141
114
|
hasTypedMinutes
|
|
142
115
|
};
|
|
143
116
|
}
|
|
144
|
-
|
|
145
117
|
const correct12HourTime = (time, mustCompleteTime) => {
|
|
146
118
|
const timeStringCorrector = getTimeStringCorrector(time, false);
|
|
147
|
-
|
|
148
119
|
if (mustCompleteTime) {
|
|
149
120
|
timeStringCorrector.replaceDashes();
|
|
150
121
|
}
|
|
151
|
-
|
|
152
122
|
if (timeStringCorrector.firstHourGreaterThan1()) {
|
|
153
123
|
timeStringCorrector.prependCharacter('0');
|
|
154
124
|
}
|
|
155
|
-
|
|
156
125
|
if (timeStringCorrector.hoursGreaterThan12()) {
|
|
157
126
|
if (timeStringCorrector.hasTypedMinutes()) {
|
|
158
127
|
// User likely just edited the first digit and that made the
|
|
@@ -165,30 +134,24 @@ const correct12HourTime = (time, mustCompleteTime) => {
|
|
|
165
134
|
timeStringCorrector.prependCharacter('0');
|
|
166
135
|
}
|
|
167
136
|
}
|
|
168
|
-
|
|
169
137
|
if (timeStringCorrector.hoursAre00()) {
|
|
170
138
|
timeStringCorrector.setHoursTo12();
|
|
171
139
|
}
|
|
172
|
-
|
|
173
140
|
if (timeStringCorrector.firstMinuteGreaterThan5()) {
|
|
174
141
|
// Assume the user forgot a 0
|
|
175
142
|
// Example: we are changing 12:6- to 12:06
|
|
176
143
|
timeStringCorrector.shiftMinutesRight();
|
|
177
144
|
}
|
|
178
|
-
|
|
179
145
|
return {
|
|
180
146
|
correctedTime: timeStringCorrector.getTimeString(),
|
|
181
147
|
selectionModifier: timeStringCorrector.getSelectionModifier()
|
|
182
148
|
};
|
|
183
149
|
};
|
|
184
|
-
|
|
185
150
|
const correct24HourTime = (time, mustCompleteTime) => {
|
|
186
151
|
const timeStringCorrector = getTimeStringCorrector(time, true);
|
|
187
|
-
|
|
188
152
|
if (mustCompleteTime) {
|
|
189
153
|
timeStringCorrector.replaceDashes();
|
|
190
154
|
}
|
|
191
|
-
|
|
192
155
|
if (timeStringCorrector.hoursGreaterThan23()) {
|
|
193
156
|
// User likely just edited the first digit and that made the second
|
|
194
157
|
// digit invalid, e.g., changed '15:' to '25:'. They probably
|
|
@@ -201,29 +164,26 @@ const correct24HourTime = (time, mustCompleteTime) => {
|
|
|
201
164
|
timeStringCorrector.prependCharacter('0');
|
|
202
165
|
}
|
|
203
166
|
}
|
|
204
|
-
|
|
205
167
|
if (timeStringCorrector.firstHourGreaterThan2()) {
|
|
206
168
|
// Assume the user forgot a leading 0
|
|
207
169
|
// Example: we are changing '3-:--' to '03:--'
|
|
208
170
|
timeStringCorrector.prependCharacter('0');
|
|
209
171
|
}
|
|
210
|
-
|
|
211
172
|
if (timeStringCorrector.firstMinuteGreaterThan5()) {
|
|
212
173
|
// Assume the user forgot a 0
|
|
213
174
|
// Example: we are changing 12:6- to 12:06
|
|
214
175
|
timeStringCorrector.shiftMinutesRight();
|
|
215
176
|
}
|
|
216
|
-
|
|
217
177
|
return {
|
|
218
178
|
correctedTime: timeStringCorrector.getTimeString(),
|
|
219
179
|
selectionModifier: timeStringCorrector.getSelectionModifier()
|
|
220
180
|
};
|
|
221
|
-
};
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// We will follow the same process to correct the time regardless
|
|
222
184
|
// of what specific character changed.
|
|
223
185
|
// This simplifies logic for when multiple chars are pasted in
|
|
224
186
|
// and for when the input has to be shifted due to invalid entries.
|
|
225
|
-
|
|
226
|
-
|
|
227
187
|
const correctTime = (time, is24HourClock, mustCompleteTime) => is24HourClock ? correct24HourTime(time, mustCompleteTime) : correct12HourTime(time, mustCompleteTime);
|
|
228
188
|
|
|
229
189
|
export { convertTimeObjectToTimeString, convertTimeStringToTimeObject, correctTime, formatUtcDate, generateTimes };
|
|
@@ -27,27 +27,22 @@ const ToggleButton = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
27
27
|
let checked = isActivated;
|
|
28
28
|
let disabled = isDisabled;
|
|
29
29
|
let name = inputName;
|
|
30
|
-
|
|
31
30
|
let handleChange = () => {
|
|
32
31
|
if (onChange) {
|
|
33
32
|
onChange(checked);
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
|
-
|
|
37
35
|
if (inGroup) {
|
|
38
36
|
checked = value === groupContext.value;
|
|
39
37
|
disabled = groupContext.isDisabled || isDisabled;
|
|
40
38
|
name = groupContext.name;
|
|
41
|
-
|
|
42
39
|
handleChange = () => {
|
|
43
40
|
if (onChange) {
|
|
44
41
|
onChange(checked);
|
|
45
42
|
}
|
|
46
|
-
|
|
47
43
|
groupContext.onChange(value);
|
|
48
44
|
};
|
|
49
45
|
}
|
|
50
|
-
|
|
51
46
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
52
47
|
ref: ref,
|
|
53
48
|
className: styles.toggleContainer
|
|
@@ -25,7 +25,8 @@ const ToggleButtonGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
25
25
|
}
|
|
26
26
|
}, /*#__PURE__*/React__default.createElement("fieldset", {
|
|
27
27
|
className: styles.toggleButtonGroupFieldset,
|
|
28
|
-
disabled: isDisabled
|
|
28
|
+
disabled: isDisabled
|
|
29
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
|
|
29
30
|
,
|
|
30
31
|
role: "radiogroup",
|
|
31
32
|
"aria-label": ariaLabel,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"default":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._dQ2H3{border-color:transparent;background-color:transparent;color:#515559;cursor:pointer}._UHCUT{background-color:rgba(50,54,58,.08)}._IxOqH{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._ViMDu{color:rgba(81,85,89,.4);cursor:not-allowed}._XfgD-{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._sjPfz{color:#085caf;border-color:#085caf}._sBKSB,._sjPfz{background:rgba(11,110,208,.11)}._sBKSB{color:#0854a1;border-color:#0854a1}._6-jnb{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._MqILq{position:relative;display:inline-grid}._MqILq svg{fill:currentColor}._MqILq ._SZYjR{-webkit-appearance:none;-moz-appearance:none;appearance:none;grid-column:1;grid-row:1}._MqILq ._SZYjR+._-GaoZ{background-color:transparent;color:#515559;cursor:pointer;border:1px solid transparent;border-radius:4px;grid-column:1;grid-row:1;padding:0;min-width:76px;-webkit-user-select:none;-moz-user-select:none;user-select:none}._MqILq ._SZYjR+._-GaoZ._hPlTe{padding:5px;max-width:36px;min-width:36px}._MqILq ._SZYjR+._-GaoZ._Ikzts{padding:0 16px}._MqILq ._SZYjR+._-GaoZ._6-26f{padding:0 16px 0 12px}._MqILq ._SZYjR:hover+._-GaoZ{background-color:rgba(50,54,58,.08)}._MqILq ._SZYjR:disabled+._-GaoZ{color:rgba(81,85,89,.4);cursor:not-allowed}._MqILq ._SZYjR:active+._-GaoZ,._MqILq ._SZYjR:focus:active+._-GaoZ{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._MqILq ._SZYjR:checked+._-GaoZ{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._MqILq ._SZYjR:checked:hover+._-GaoZ{background:rgba(11,110,208,.11);color:#085caf;border-color:#085caf}._MqILq ._SZYjR:checked:disabled+._-GaoZ{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._MqILq ._SZYjR:checked:active+._-GaoZ,._MqILq ._SZYjR:checked:focus:active+._-GaoZ{background:rgba(11,110,208,.11);color:#0854a1;border-color:#0854a1}._RRJux{display:inline-flex;position:relative}._RRJux:before{content:\"\";border:1px solid #d9d9d9;border-radius:4px;position:absolute;top:0;bottom:0;right:0;left:0}._RRJux>*{flex-shrink:0;flex-grow:0}._VbbII{border:none;margin:0;padding:0}._VbbII legend{padding:0;display:block;font-size:14px;margin-bottom:6px;color:#515559}body.keyboard-user ._MqILq ._SZYjR:active:focus+._-GaoZ,body.keyboard-user ._MqILq ._SZYjR:focus+._-GaoZ{z-index:20;outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
4
|
+
var styles = {"default":"_dQ2H3","hovered":"_UHCUT","pressed":"_IxOqH","disabled":"_ViMDu","selectedDefault":"_XfgD-","selectedHovered":"_sjPfz","selectedPressed":"_sBKSB","selectedDisabled":"_6-jnb","toggleContainer":"_MqILq","toggleInput":"_SZYjR","toggleButton":"_-GaoZ","iconOnly":"_hPlTe","text":"_Ikzts","iconText":"_6-26f","toggleButtonGroup":"_RRJux","toggleButtonGroupFieldset":"_VbbII"};
|
|
5
|
+
var stylesheet="._dQ2H3{border-color:transparent;background-color:transparent;color:#515559;cursor:pointer}._UHCUT{background-color:rgba(50,54,58,.08)}._IxOqH{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._ViMDu{color:rgba(81,85,89,.4);cursor:not-allowed}._XfgD-{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._sjPfz{color:#085caf;border-color:#085caf}._sBKSB,._sjPfz{background:rgba(11,110,208,.11)}._sBKSB{color:#0854a1;border-color:#0854a1}._6-jnb{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._MqILq{position:relative;display:inline-grid}._MqILq svg{fill:currentColor}._MqILq ._SZYjR{-webkit-appearance:none;-moz-appearance:none;appearance:none;grid-column:1;grid-row:1}._MqILq ._SZYjR+._-GaoZ{background-color:transparent;color:#515559;cursor:pointer;border:1px solid transparent;border-radius:4px;grid-column:1;grid-row:1;padding:0;min-width:76px;-webkit-user-select:none;-moz-user-select:none;user-select:none}._MqILq ._SZYjR+._-GaoZ._hPlTe{padding:5px;max-width:36px;min-width:36px}._MqILq ._SZYjR+._-GaoZ._Ikzts{padding:0 16px}._MqILq ._SZYjR+._-GaoZ._6-26f{padding:0 16px 0 12px}._MqILq ._SZYjR:hover+._-GaoZ{background-color:rgba(50,54,58,.08)}._MqILq ._SZYjR:disabled+._-GaoZ{color:rgba(81,85,89,.4);cursor:not-allowed}._MqILq ._SZYjR:active+._-GaoZ,._MqILq ._SZYjR:focus:active+._-GaoZ{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._MqILq ._SZYjR:checked+._-GaoZ{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._MqILq ._SZYjR:checked:hover+._-GaoZ{background:rgba(11,110,208,.11);color:#085caf;border-color:#085caf}._MqILq ._SZYjR:checked:disabled+._-GaoZ{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._MqILq ._SZYjR:checked:active+._-GaoZ,._MqILq ._SZYjR:checked:focus:active+._-GaoZ{background:rgba(11,110,208,.11);color:#0854a1;border-color:#0854a1}._RRJux{display:inline-flex;position:relative}._RRJux:before{content:\"\";border:1px solid #d9d9d9;border-radius:4px;position:absolute;top:0;bottom:0;right:0;left:0}._RRJux>*{flex-shrink:0;flex-grow:0}._VbbII{border:none;margin:0;padding:0}._VbbII legend{padding:0;display:block;font-size:14px;margin-bottom:6px;color:#515559}body.keyboard-user ._MqILq ._SZYjR:active:focus+._-GaoZ,body.keyboard-user ._MqILq ._SZYjR:focus+._-GaoZ{z-index:20;outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|