@qualtrics/ui-react 2.19.0 → 2.20.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/CHANGELOG.md +45 -0
- package/dist/__shared/cjs/{index-bf07471d.js → index-579c4690.js} +10 -7
- package/dist/__shared/cjs/{index-4e4cc354.js → index-90d4069b.js} +999 -1875
- package/dist/components/Accordion/Accordion.js +1 -5
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Accordion/AccordionHeader.js +8 -10
- 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 +13 -42
- 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 +4 -3
- 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/MenuButton.js +13 -6
- 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/Stack.js +0 -3
- 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 +5 -4
- package/dist/next/index.js +389 -754
- 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 +2 -1
- package/next/package.json +5 -1
- package/package.json +9 -4
|
@@ -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 = {"colorPickerBtnColor":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._sK-RJ{margin-left:-6px;height:16px;width:16px;border-radius:2px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}._uJ64f{margin-right:-12px;margin-left:4px}._uJMBh{background-color:#fff;border-radius:4px;box-shadow:0 4px 24px -4px rgba(0,0,0,.5);width:156px}._QR1hM{margin:8px 8px 0;display:flex}._nMFGw,._o1cuG{margin-left:4px}._yJ8-p{margin:8px 4px 0 8px;display:flex;flex-wrap:wrap}._vjDWP{margin:0 4px 4px 0}._vjDWP:hover{width:18px;height:18px;margin:-1px 3px 3px -1px}._3xKD3{margin:4px 8px 8px}._MiW2g{position:relative;width:96px;height:96px;outline:0}body.keyboard-user ._MiW2g:active:focus ._DkwTD,body.keyboard-user ._MiW2g:focus ._DkwTD{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._lG7T7{background:linear-gradient(90deg,#fff,transparent)}._IHy99,._lG7T7{position:absolute;top:0;right:0;bottom:0;left:0}._IHy99{background:linear-gradient(0deg,#000,transparent)}._DkwTD{position:absolute;border:2px solid #fff;border-radius:5px;height:8px;width:8px;margin:0 0 -4px -4px;box-shadow:0 0 1px 1px rgba(0,0,0,.4),inset 0 0 1px #000}._LO80Z{position:relative;background:linear-gradient(0deg,red,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);width:16px;height:96px;outline:0}body.keyboard-user ._LO80Z:active:focus ._iicaf,body.keyboard-user ._LO80Z:focus ._iicaf{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._iicaf{width:16px;height:4px;background:#fff;border-radius:50%;position:absolute;box-shadow:0 0 4px 1px rgba(0,0,0,.4);transform:translateY(2px)}._1kUR1{position:relative;width:16px;height:96px}._ybv-b{width:16px;height:4px;background:#fff;border-radius:50%;box-shadow:0 0 4px 1px rgba(0,0,0,.4);transform:translateY(2px)}._ScrTl,._ybv-b{position:absolute}._ScrTl{top:0;right:0;bottom:0;left:0;outline:0}body.keyboard-user ._ScrTl:active:focus ._ybv-b,body.keyboard-user ._ScrTl:focus ._ybv-b{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._Bogjj{position:absolute;top:0;right:0;bottom:0;left:0;background-image:linear-gradient(45deg,#d9dadb 25%,transparent 0),linear-gradient(-45deg,#d9dadb 25%,transparent 0),linear-gradient(45deg,transparent 75%,#d9dadb 0),linear-gradient(-45deg,transparent 75%,#d9dadb 0);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0}._peq6K{border-radius:2px;height:16px;width:16px;cursor:pointer;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}._peq6K:active:focus,._peq6K:focus{outline:none}body.keyboard-user ._peq6K:active:focus,body.keyboard-user ._peq6K:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._ZPVky{display:flex}._ZPVky ._G0Hee{position:relative;flex-shrink:0;width:26px;height:26px}._ZPVky ._9citq{position:absolute;top:0;right:0;bottom:0;left:0;border-top-left-radius:4px;border-bottom-left-radius:4px;border:1px solid #c6c6c6}._ZPVky ._V4laY{flex-basis:100%;min-width:0;border-top-left-radius:0;border-bottom-left-radius:0}";
|
|
4
|
+
var styles = {"colorPickerBtnColor":"_sK-RJ","colorPickerBtnIcon":"_uJ64f","colorPicker":"_uJMBh","colorPickerSliderContainer":"_QR1hM","colorPickerHue":"_o1cuG","colorPickerAlpha":"_nMFGw","colorPickerSwatches":"_yJ8-p","colorPickerSwatch":"_vjDWP","colorPickerHex":"_3xKD3","saturation":"_MiW2g","saturationCircle":"_DkwTD","saturationWhite":"_lG7T7","saturationBlack":"_IHy99","hue":"_LO80Z","hueSlider":"_iicaf","alpha":"_1kUR1","alphaSlider":"_ybv-b","alphaGradient":"_ScrTl","alphaCheckerboard":"_Bogjj","swatch":"_peq6K","hex":"_ZPVky","hexSwatch":"_G0Hee","hexSwatchColor":"_9citq","hexInput":"_V4laY"};
|
|
5
|
+
var stylesheet="._sK-RJ{margin-left:-6px;height:16px;width:16px;border-radius:2px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}._uJ64f{margin-right:-12px;margin-left:4px}._uJMBh{background-color:#fff;border-radius:4px;box-shadow:0 4px 24px -4px rgba(0,0,0,.5);width:156px}._QR1hM{margin:8px 8px 0;display:flex}._nMFGw,._o1cuG{margin-left:4px}._yJ8-p{margin:8px 4px 0 8px;display:flex;flex-wrap:wrap}._vjDWP{margin:0 4px 4px 0}._vjDWP:hover{width:18px;height:18px;margin:-1px 3px 3px -1px}._3xKD3{margin:4px 8px 8px}._MiW2g{position:relative;width:96px;height:96px;outline:0}body.keyboard-user ._MiW2g:active:focus ._DkwTD,body.keyboard-user ._MiW2g:focus ._DkwTD{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._lG7T7{background:linear-gradient(90deg,#fff,transparent)}._IHy99,._lG7T7{position:absolute;top:0;right:0;bottom:0;left:0}._IHy99{background:linear-gradient(0deg,#000,transparent)}._DkwTD{position:absolute;border:2px solid #fff;border-radius:5px;height:8px;width:8px;margin:0 0 -4px -4px;box-shadow:0 0 1px 1px rgba(0,0,0,.4),inset 0 0 1px #000}._LO80Z{position:relative;background:linear-gradient(0deg,red,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);width:16px;height:96px;outline:0}body.keyboard-user ._LO80Z:active:focus ._iicaf,body.keyboard-user ._LO80Z:focus ._iicaf{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._iicaf{width:16px;height:4px;background:#fff;border-radius:50%;position:absolute;box-shadow:0 0 4px 1px rgba(0,0,0,.4);transform:translateY(2px)}._1kUR1{position:relative;width:16px;height:96px}._ybv-b{width:16px;height:4px;background:#fff;border-radius:50%;box-shadow:0 0 4px 1px rgba(0,0,0,.4);transform:translateY(2px)}._ScrTl,._ybv-b{position:absolute}._ScrTl{top:0;right:0;bottom:0;left:0;outline:0}body.keyboard-user ._ScrTl:active:focus ._ybv-b,body.keyboard-user ._ScrTl:focus ._ybv-b{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._Bogjj{position:absolute;top:0;right:0;bottom:0;left:0;background-image:linear-gradient(45deg,#d9dadb 25%,transparent 0),linear-gradient(-45deg,#d9dadb 25%,transparent 0),linear-gradient(45deg,transparent 75%,#d9dadb 0),linear-gradient(-45deg,transparent 75%,#d9dadb 0);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0}._peq6K{border-radius:2px;height:16px;width:16px;cursor:pointer;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}._peq6K:active:focus,._peq6K:focus{outline:none}body.keyboard-user ._peq6K:active:focus,body.keyboard-user ._peq6K:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._ZPVky{display:flex}._ZPVky ._G0Hee{position:relative;flex-shrink:0;width:26px;height:26px}._ZPVky ._9citq{position:absolute;top:0;right:0;bottom:0;left:0;border-top-left-radius:4px;border-bottom-left-radius:4px;border:1px solid #c6c6c6}._ZPVky ._V4laY{flex-basis:100%;min-width:0;border-top-left-radius:0;border-bottom-left-radius:0}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -6,7 +6,6 @@ import '../Input/index.js';
|
|
|
6
6
|
import Input from '../Input/Input.js';
|
|
7
7
|
|
|
8
8
|
const HEX_REGEX = /#?[a-fA-F0-9]{3,}/;
|
|
9
|
-
|
|
10
9
|
const HexInput = function HexInput(_ref) {
|
|
11
10
|
let {
|
|
12
11
|
hex,
|
|
@@ -28,26 +27,21 @@ const HexInput = function HexInput(_ref) {
|
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
}, [blurValue, hex, value]);
|
|
31
|
-
|
|
32
30
|
function isValid(val) {
|
|
33
31
|
return HEX_REGEX.test(val);
|
|
34
32
|
}
|
|
35
|
-
|
|
36
33
|
function handleChange(e) {
|
|
37
34
|
setValue(e.target.value);
|
|
38
|
-
|
|
39
35
|
if (isValid(e.target.value)) {
|
|
40
|
-
onChange
|
|
36
|
+
onChange?.(e.target.value, e);
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
|
-
|
|
44
39
|
function handleBlur() {
|
|
45
40
|
if (blurValue) {
|
|
46
41
|
setValue(blurValue);
|
|
47
42
|
setBlurValue(null);
|
|
48
43
|
}
|
|
49
44
|
}
|
|
50
|
-
|
|
51
45
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
52
46
|
className: classNames(styles.hex, className)
|
|
53
47
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -12,7 +12,6 @@ const getMouseChange = (e, hsb, container) => {
|
|
|
12
12
|
const y = isMouseEvent(e) ? e.pageY : e.touches[0].pageY;
|
|
13
13
|
const bottom = container.getBoundingClientRect().bottom + window.pageYOffset - y;
|
|
14
14
|
let h;
|
|
15
|
-
|
|
16
15
|
if (bottom < 0) {
|
|
17
16
|
h = 0;
|
|
18
17
|
} else if (bottom > containerHeight) {
|
|
@@ -21,7 +20,6 @@ const getMouseChange = (e, hsb, container) => {
|
|
|
21
20
|
const percent = bottom / containerHeight;
|
|
22
21
|
h = 360 * percent;
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
return {
|
|
26
24
|
h: Math.round(h),
|
|
27
25
|
s: hsb.s,
|
|
@@ -29,12 +27,10 @@ const getMouseChange = (e, hsb, container) => {
|
|
|
29
27
|
a: hsb.a
|
|
30
28
|
};
|
|
31
29
|
};
|
|
32
|
-
|
|
33
30
|
const KEY_CHANGES = {
|
|
34
31
|
ArrowUp: 4,
|
|
35
32
|
ArrowDown: -4
|
|
36
33
|
};
|
|
37
|
-
|
|
38
34
|
const getKeyChange = (e, hsb) => {
|
|
39
35
|
const hueChange = KEY_CHANGES[e.key];
|
|
40
36
|
const h = Math.max(0, Math.min(360, hsb.h + hueChange));
|
|
@@ -45,7 +41,6 @@ const getKeyChange = (e, hsb) => {
|
|
|
45
41
|
a: hsb.a
|
|
46
42
|
};
|
|
47
43
|
};
|
|
48
|
-
|
|
49
44
|
const Hue = function Hue(_ref) {
|
|
50
45
|
let {
|
|
51
46
|
hsb,
|
|
@@ -56,17 +51,15 @@ const Hue = function Hue(_ref) {
|
|
|
56
51
|
const containerRef = React__default.useRef(null);
|
|
57
52
|
const handleChange = useEventCallback(e => {
|
|
58
53
|
const change = getMouseChange(e, hsb, containerRef.current);
|
|
59
|
-
onChange
|
|
54
|
+
onChange?.(change, e);
|
|
60
55
|
});
|
|
61
56
|
const handleMouseDown = useMouseDrag(handleChange);
|
|
62
|
-
|
|
63
57
|
function handleKeyDown(e) {
|
|
64
58
|
if (Object.keys(KEY_CHANGES).indexOf(e.key) > -1) {
|
|
65
59
|
const change = getKeyChange(e, hsb);
|
|
66
|
-
onChange
|
|
60
|
+
onChange?.(change, e);
|
|
67
61
|
}
|
|
68
62
|
}
|
|
69
|
-
|
|
70
63
|
return (
|
|
71
64
|
/*#__PURE__*/
|
|
72
65
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
@@ -85,7 +78,7 @@ const Hue = function Hue(_ref) {
|
|
|
85
78
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
86
79
|
className: styles.hueSlider,
|
|
87
80
|
style: {
|
|
88
|
-
bottom:
|
|
81
|
+
bottom: `${hsb.h / 360 * 100}%`
|
|
89
82
|
}
|
|
90
83
|
}))
|
|
91
84
|
);
|
|
@@ -18,19 +18,16 @@ const getMouseChange = (e, hsb, container) => {
|
|
|
18
18
|
const y = isMouseEvent(e) ? e.pageY : e.touches[0].pageY;
|
|
19
19
|
let left = x - (containerLeft + window.pageXOffset);
|
|
20
20
|
let bottom = containerBottom + window.pageYOffset - y;
|
|
21
|
-
|
|
22
21
|
if (left < 0) {
|
|
23
22
|
left = 0;
|
|
24
23
|
} else if (left > containerWidth) {
|
|
25
24
|
left = containerWidth;
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
if (bottom < 0) {
|
|
29
27
|
bottom = 0;
|
|
30
28
|
} else if (bottom > containerHeight) {
|
|
31
29
|
bottom = containerHeight;
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
const saturation = left / containerWidth;
|
|
35
32
|
const brightness = bottom / containerHeight;
|
|
36
33
|
return {
|
|
@@ -40,7 +37,6 @@ const getMouseChange = (e, hsb, container) => {
|
|
|
40
37
|
a: hsb.a
|
|
41
38
|
};
|
|
42
39
|
};
|
|
43
|
-
|
|
44
40
|
const KEY_CHANGES = {
|
|
45
41
|
ArrowUp: {
|
|
46
42
|
s: 0,
|
|
@@ -59,7 +55,6 @@ const KEY_CHANGES = {
|
|
|
59
55
|
b: 0
|
|
60
56
|
}
|
|
61
57
|
};
|
|
62
|
-
|
|
63
58
|
const getKeyChange = (e, hsb) => {
|
|
64
59
|
const {
|
|
65
60
|
s: saturationChange,
|
|
@@ -74,7 +69,6 @@ const getKeyChange = (e, hsb) => {
|
|
|
74
69
|
a: hsb.a
|
|
75
70
|
};
|
|
76
71
|
};
|
|
77
|
-
|
|
78
72
|
const Saturation = function Saturation(_ref) {
|
|
79
73
|
let {
|
|
80
74
|
hsb,
|
|
@@ -84,30 +78,29 @@ const Saturation = function Saturation(_ref) {
|
|
|
84
78
|
} = _ref;
|
|
85
79
|
const containerRef = React__default.useRef(null);
|
|
86
80
|
const handleChange = useEventCallback(e => {
|
|
87
|
-
onChange
|
|
81
|
+
onChange?.(getMouseChange(e, hsb, containerRef.current), e);
|
|
88
82
|
});
|
|
89
83
|
const handleMouseDown = useMouseDrag(handleChange);
|
|
90
|
-
|
|
91
84
|
function handleKeyDown(e) {
|
|
92
85
|
if (Object.keys(KEY_CHANGES).indexOf(e.key) > -1) {
|
|
93
86
|
const change = getKeyChange(e, hsb);
|
|
94
|
-
onChange
|
|
87
|
+
onChange?.(change, e);
|
|
95
88
|
}
|
|
96
89
|
}
|
|
97
|
-
|
|
98
90
|
return (
|
|
99
91
|
/*#__PURE__*/
|
|
100
92
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
101
93
|
React__default.createElement("div", _extends({}, rest, {
|
|
102
94
|
ref: containerRef,
|
|
103
95
|
style: {
|
|
104
|
-
backgroundColor:
|
|
96
|
+
backgroundColor: `hsl(${hsb.h}, 100%, 50%)`
|
|
105
97
|
},
|
|
106
98
|
className: classNames(styles.saturation, className),
|
|
107
99
|
onMouseDown: handleMouseDown,
|
|
108
100
|
onKeyDown: handleKeyDown,
|
|
109
101
|
onTouchMove: handleChange,
|
|
110
|
-
onTouchStart: handleChange
|
|
102
|
+
onTouchStart: handleChange
|
|
103
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
111
104
|
,
|
|
112
105
|
tabIndex: 0
|
|
113
106
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -117,8 +110,8 @@ const Saturation = function Saturation(_ref) {
|
|
|
117
110
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
118
111
|
className: styles.saturationCircle,
|
|
119
112
|
style: {
|
|
120
|
-
bottom:
|
|
121
|
-
left:
|
|
113
|
+
bottom: `${hsb.b * 100}%`,
|
|
114
|
+
left: `${hsb.s * 100}%`
|
|
122
115
|
}
|
|
123
116
|
}))))
|
|
124
117
|
);
|
|
@@ -4,7 +4,6 @@ import classNames from 'classnames';
|
|
|
4
4
|
import styles from './ColorPicker2.js';
|
|
5
5
|
|
|
6
6
|
const ENTER = 13;
|
|
7
|
-
|
|
8
7
|
const Swatch = function Swatch(_ref) {
|
|
9
8
|
let {
|
|
10
9
|
color = '#000000',
|
|
@@ -12,13 +11,10 @@ const Swatch = function Swatch(_ref) {
|
|
|
12
11
|
className,
|
|
13
12
|
...rest
|
|
14
13
|
} = _ref;
|
|
15
|
-
|
|
16
14
|
function handleClick(e) {
|
|
17
|
-
onClick
|
|
15
|
+
onClick?.(color, e);
|
|
18
16
|
}
|
|
19
|
-
|
|
20
|
-
const handleKeyDown = e => e.keyCode === ENTER && (onClick === null || onClick === void 0 ? void 0 : onClick(color, e));
|
|
21
|
-
|
|
17
|
+
const handleKeyDown = e => e.keyCode === ENTER && onClick?.(color, e);
|
|
22
18
|
return /*#__PURE__*/React__default.createElement("span", _extends({}, rest, {
|
|
23
19
|
role: "button",
|
|
24
20
|
tabIndex: 0,
|
|
@@ -4,16 +4,13 @@ import useEventListener from '../../hooks/useEventListener/useEventListener.js';
|
|
|
4
4
|
|
|
5
5
|
function useMouseDrag(handleChange) {
|
|
6
6
|
const [isMouseDown, setIsMouseDown] = React__default.useState(false);
|
|
7
|
-
|
|
8
7
|
function handleMouseDown(e) {
|
|
9
8
|
handleChange(e);
|
|
10
9
|
setIsMouseDown(true);
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
function handleMouseUp() {
|
|
14
12
|
setIsMouseDown(false);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
const isDisabled = !isMouseDown;
|
|
18
15
|
useEventListener(window, 'mousemove', handleChange, {
|
|
19
16
|
isDisabled
|
|
@@ -38,7 +38,6 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
38
38
|
onChange,
|
|
39
39
|
...rest
|
|
40
40
|
} = _ref;
|
|
41
|
-
|
|
42
41
|
/*
|
|
43
42
|
* Input value that comes from:
|
|
44
43
|
* (1) The `externalValue` prop, or
|
|
@@ -46,15 +45,16 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
46
45
|
*/
|
|
47
46
|
const [inputValue, setInputValue] = useControllableState(defaultValue, onChange, externalValue);
|
|
48
47
|
const [wasIncrementOrDecrementButtonPressed, setWasIncrementOrDecrementButtonPressed] = useState(false);
|
|
48
|
+
|
|
49
49
|
/**
|
|
50
50
|
* Increments the `inputValue` by `step`.
|
|
51
51
|
* The new value is bounded by `max` if `max` is defined.
|
|
52
52
|
*/
|
|
53
|
-
|
|
54
53
|
const increment = useCallback(isTriggeredByIncrementButton => {
|
|
55
54
|
setInputValue(currentValue => {
|
|
56
|
-
const newValue = convertToNumber(currentValue) + step;
|
|
55
|
+
const newValue = convertToNumber(currentValue) + step;
|
|
57
56
|
|
|
57
|
+
// Value needs to be rounded for accuracy
|
|
58
58
|
const newValueRounded = Math.round(newValue * 100) / 100;
|
|
59
59
|
return clampMinMax(newValueRounded, {
|
|
60
60
|
max
|
|
@@ -62,15 +62,16 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
62
62
|
});
|
|
63
63
|
setWasIncrementOrDecrementButtonPressed(isTriggeredByIncrementButton);
|
|
64
64
|
}, [step, max, setInputValue]);
|
|
65
|
+
|
|
65
66
|
/**
|
|
66
67
|
* Decrements the `inputValue` by `step`.
|
|
67
68
|
* The new value is bounded by `min` if `min` is defined.
|
|
68
69
|
*/
|
|
69
|
-
|
|
70
70
|
const decrement = useCallback(isTriggeredByDecrementButton => {
|
|
71
71
|
setInputValue(currentValue => {
|
|
72
|
-
const newValue = convertToNumber(currentValue) - step;
|
|
72
|
+
const newValue = convertToNumber(currentValue) - step;
|
|
73
73
|
|
|
74
|
+
// Value needs to be rounded for accuracy
|
|
74
75
|
const newValueRounded = Math.round(newValue * 100) / 100;
|
|
75
76
|
return clampMinMax(newValueRounded, {
|
|
76
77
|
min
|
|
@@ -78,33 +79,32 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
78
79
|
});
|
|
79
80
|
setWasIncrementOrDecrementButtonPressed(isTriggeredByDecrementButton);
|
|
80
81
|
}, [step, min, setInputValue]);
|
|
82
|
+
|
|
81
83
|
/**
|
|
82
84
|
* Updates the `inputValue` to `max`
|
|
83
85
|
*/
|
|
84
|
-
|
|
85
86
|
const increaseToMax = useCallback(() => {
|
|
86
87
|
if (max !== undefined) {
|
|
87
88
|
setInputValue(max);
|
|
88
89
|
}
|
|
89
90
|
}, [max, setInputValue]);
|
|
91
|
+
|
|
90
92
|
/**
|
|
91
93
|
* Updates the `inputValue` to `min`
|
|
92
94
|
*/
|
|
93
|
-
|
|
94
95
|
const decreaseToMin = useCallback(() => {
|
|
95
96
|
if (min !== undefined) {
|
|
96
97
|
setInputValue(min);
|
|
97
98
|
}
|
|
98
99
|
}, [min, setInputValue]);
|
|
100
|
+
|
|
99
101
|
/**
|
|
100
102
|
* Updates the `inputValue` to be:
|
|
101
103
|
* (1) An empty string, or
|
|
102
104
|
* (2) The entered value as a number
|
|
103
105
|
*/
|
|
104
|
-
|
|
105
106
|
const handleInputChange = useCallback(e => {
|
|
106
107
|
const val = e.target.value;
|
|
107
|
-
|
|
108
108
|
if (val === '') {
|
|
109
109
|
setInputValue(val);
|
|
110
110
|
} else {
|
|
@@ -113,19 +113,20 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
113
113
|
setInputValue(newValueRounded);
|
|
114
114
|
}
|
|
115
115
|
}, [setInputValue]);
|
|
116
|
+
|
|
116
117
|
/**
|
|
117
118
|
* Updates the `inputValue` to be:
|
|
118
119
|
* (1) The entered value as a number, or
|
|
119
120
|
* (2) The `min` or `max` value
|
|
120
121
|
*/
|
|
121
|
-
|
|
122
122
|
const handleInputBlur = useCallback(() => {
|
|
123
123
|
setInputValue(currentValue => clampMinMax(convertToNumber(currentValue), {
|
|
124
124
|
min,
|
|
125
125
|
max
|
|
126
126
|
}));
|
|
127
|
-
}, [max, min, setInputValue]);
|
|
127
|
+
}, [max, min, setInputValue]);
|
|
128
128
|
|
|
129
|
+
// NumberStepper context
|
|
129
130
|
const context = useMemo(() => ({
|
|
130
131
|
isExternallyDisabled,
|
|
131
132
|
dataTestId,
|
|
@@ -159,42 +160,35 @@ const NumberStepper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
159
160
|
className: styles.inputValueAlert
|
|
160
161
|
}, inputValue));
|
|
161
162
|
});
|
|
163
|
+
|
|
162
164
|
/**
|
|
163
165
|
* Attempts to convert the given `value` to a number
|
|
164
166
|
*/
|
|
165
|
-
|
|
166
167
|
function convertToNumber(value) {
|
|
167
168
|
if (typeof value === 'number') {
|
|
168
169
|
return value;
|
|
169
170
|
}
|
|
170
|
-
|
|
171
171
|
const num = Number(value);
|
|
172
|
-
|
|
173
172
|
if (Number.isNaN(num)) {
|
|
174
173
|
return 0;
|
|
175
174
|
}
|
|
176
|
-
|
|
177
175
|
return num;
|
|
178
176
|
}
|
|
177
|
+
|
|
179
178
|
/**
|
|
180
179
|
* Compares the given `value` to min and/or max
|
|
181
180
|
*/
|
|
182
|
-
|
|
183
|
-
|
|
184
181
|
function clampMinMax(value, _ref2) {
|
|
185
182
|
let {
|
|
186
183
|
min,
|
|
187
184
|
max
|
|
188
185
|
} = _ref2;
|
|
189
|
-
|
|
190
186
|
if (typeof max === 'number' && value > max) {
|
|
191
187
|
return max;
|
|
192
188
|
}
|
|
193
|
-
|
|
194
189
|
if (typeof min === 'number' && value < min) {
|
|
195
190
|
return min;
|
|
196
191
|
}
|
|
197
|
-
|
|
198
192
|
return value;
|
|
199
193
|
}
|
|
200
194
|
|
|
@@ -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 = {"numberStepperContainer":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._qVcn7{display:inline-flex}._HYvQZ{color:#32363a;background:#fafafa;outline:none;text-align:center;padding:0 12px;min-width:55px;width:100%;font-size:14px;border:1px solid #898989;border-radius:0;-moz-appearance:textfield}._HYvQZ:hover:not(._QetOJ){cursor:pointer;background:#f5f5f5}._HYvQZ._kKXcG{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000}._HYvQZ._QetOJ{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._HYvQZ._QetOJ>svg{opacity:.4}._HYvQZ::-webkit-inner-spin-button,._HYvQZ::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._HYvQZ:focus{z-index:0;border:none;border-radius:4px}._HYvQZ:focus:not(._kKXcG){box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._d-GH0,._HYvQZ:focus:not(._QetOJ){background:#fafafa}._d-GH0{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;fill:#515559;outline:none;border-radius:4px 0 0 4px;border:1px solid #898989;border-right-width:0}._d-GH0:hover:not(._QetOJ){cursor:pointer;background:#f5f5f5}._d-GH0:active:not(._QetOJ){background:#e5e5e5}._d-GH0._QetOJ{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._d-GH0._QetOJ>svg{opacity:.4}._JCVSo{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;background:#fafafa;fill:#515559;outline:none;border-radius:0 4px 4px 0;border:1px solid #898989;border-left-width:0}._JCVSo:hover:not(._QetOJ){cursor:pointer;background:#f5f5f5}._JCVSo:active:not(._QetOJ){background:#e5e5e5}._JCVSo._QetOJ{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._JCVSo._QetOJ>svg{opacity:.4}._wy6g8{position:absolute;top:0;left:0;width:0;height:0;margin:0;overflow:hidden}";
|
|
4
|
+
var styles = {"numberStepperContainer":"_qVcn7","numberStepperInput":"_HYvQZ","disabled":"_QetOJ","invalid":"_kKXcG","decrementBtn":"_d-GH0","incrementBtn":"_JCVSo","inputValueAlert":"_wy6g8"};
|
|
5
|
+
var stylesheet="._qVcn7{display:inline-flex}._HYvQZ{color:#32363a;background:#fafafa;outline:none;text-align:center;padding:0 12px;min-width:55px;width:100%;font-size:14px;border:1px solid #898989;border-radius:0;-moz-appearance:textfield}._HYvQZ:hover:not(._QetOJ){cursor:pointer;background:#f5f5f5}._HYvQZ._kKXcG{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000}._HYvQZ._QetOJ{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._HYvQZ._QetOJ>svg{opacity:.4}._HYvQZ::-webkit-inner-spin-button,._HYvQZ::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._HYvQZ:focus{z-index:0;border:none;border-radius:4px}._HYvQZ:focus:not(._kKXcG){box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._d-GH0,._HYvQZ:focus:not(._QetOJ){background:#fafafa}._d-GH0{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;fill:#515559;outline:none;border-radius:4px 0 0 4px;border:1px solid #898989;border-right-width:0}._d-GH0:hover:not(._QetOJ){cursor:pointer;background:#f5f5f5}._d-GH0:active:not(._QetOJ){background:#e5e5e5}._d-GH0._QetOJ{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._d-GH0._QetOJ>svg{opacity:.4}._JCVSo{padding:0;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:36px;height:36px;background:#fafafa;fill:#515559;outline:none;border-radius:0 4px 4px 0;border:1px solid #898989;border-left-width:0}._JCVSo:hover:not(._QetOJ){cursor:pointer;background:#f5f5f5}._JCVSo:active:not(._QetOJ){background:#e5e5e5}._JCVSo._QetOJ{cursor:not-allowed;fill:#74777a;color:#74777a;border-color:#e5e5e5}._JCVSo._QetOJ>svg{opacity:.4}._wy6g8{position:absolute;top:0;left:0;width:0;height:0;margin:0;overflow:hidden}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -27,31 +27,32 @@ const NumberStepperDecrement = /*#__PURE__*/React__default.forwardRef((_ref, ref
|
|
|
27
27
|
} = _ref;
|
|
28
28
|
const {
|
|
29
29
|
translate
|
|
30
|
-
} = useTranslation();
|
|
30
|
+
} = useTranslation();
|
|
31
31
|
|
|
32
|
+
// Context from NumberStepper
|
|
32
33
|
const {
|
|
33
34
|
isExternallyDisabled,
|
|
34
35
|
dataTestId,
|
|
35
36
|
decrement,
|
|
36
37
|
inputValue,
|
|
37
38
|
min
|
|
38
|
-
} = useNumberStepperContext();
|
|
39
|
+
} = useNumberStepperContext();
|
|
39
40
|
|
|
41
|
+
// Indicates if the button is disabled
|
|
40
42
|
const isDisabled = inputValue <= min || isExternallyDisabled;
|
|
43
|
+
|
|
41
44
|
/**
|
|
42
45
|
* Calls `onClick` if it is defined.
|
|
43
46
|
* Calls `decrement`.
|
|
44
47
|
*/
|
|
45
|
-
|
|
46
48
|
const handleClick = e => {
|
|
47
49
|
if (!isDisabled) {
|
|
48
|
-
onClick
|
|
50
|
+
onClick?.(e);
|
|
49
51
|
decrement(true);
|
|
50
52
|
}
|
|
51
53
|
};
|
|
52
|
-
|
|
53
54
|
return /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
|
|
54
|
-
"data-testid": dataTestIdFromProps
|
|
55
|
+
"data-testid": dataTestIdFromProps ?? getSubDataTestId(dataTestId, 'Decrement'),
|
|
55
56
|
ref: ref,
|
|
56
57
|
type: "button",
|
|
57
58
|
className: classNames(className, styles.decrementBtn, {
|
|
@@ -27,31 +27,32 @@ const NumberStepperIncrement = /*#__PURE__*/React__default.forwardRef((_ref, ref
|
|
|
27
27
|
} = _ref;
|
|
28
28
|
const {
|
|
29
29
|
translate
|
|
30
|
-
} = useTranslation();
|
|
30
|
+
} = useTranslation();
|
|
31
31
|
|
|
32
|
+
// Context from NumberStepper
|
|
32
33
|
const {
|
|
33
34
|
isExternallyDisabled,
|
|
34
35
|
dataTestId,
|
|
35
36
|
increment,
|
|
36
37
|
inputValue,
|
|
37
38
|
max
|
|
38
|
-
} = useNumberStepperContext();
|
|
39
|
+
} = useNumberStepperContext();
|
|
39
40
|
|
|
41
|
+
// Indicates if the button is disabled
|
|
40
42
|
const isDisabled = inputValue >= max || isExternallyDisabled;
|
|
43
|
+
|
|
41
44
|
/**
|
|
42
45
|
* Calls `onClick` if it is defined.
|
|
43
46
|
* Calls `increment`.
|
|
44
47
|
*/
|
|
45
|
-
|
|
46
48
|
const handleClick = e => {
|
|
47
49
|
if (!isDisabled) {
|
|
48
|
-
onClick
|
|
50
|
+
onClick?.(e);
|
|
49
51
|
increment(true);
|
|
50
52
|
}
|
|
51
53
|
};
|
|
52
|
-
|
|
53
54
|
return /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
|
|
54
|
-
"data-testid": dataTestIdFromProps
|
|
55
|
+
"data-testid": dataTestIdFromProps ?? getSubDataTestId(dataTestId, 'Increment'),
|
|
55
56
|
ref: ref,
|
|
56
57
|
type: "button",
|
|
57
58
|
className: classNames(className, styles.incrementBtn, {
|
|
@@ -48,25 +48,26 @@ const NumberStepperInput = /*#__PURE__*/React__default.forwardRef((_ref, ref) =>
|
|
|
48
48
|
ariaDescribedBy,
|
|
49
49
|
handleInputChange,
|
|
50
50
|
handleInputBlur
|
|
51
|
-
} = useNumberStepperContext();
|
|
51
|
+
} = useNumberStepperContext();
|
|
52
52
|
|
|
53
|
+
// TODO: Add proper styling for the form field label (this is a breaking change)
|
|
53
54
|
const {
|
|
54
55
|
helperTextId: formFieldHelperTextId,
|
|
55
56
|
errorTextId: formFieldErrorTextId
|
|
56
57
|
} = useFormFieldControl();
|
|
57
|
-
const internalAriaDescribedby = concatIds(ariaDescribedByFromProps
|
|
58
|
+
const internalAriaDescribedby = concatIds(ariaDescribedByFromProps ?? ariaDescribedBy, formFieldHelperTextId, formFieldErrorTextId);
|
|
58
59
|
|
|
60
|
+
// Indicates if the `inputValue` is invalid
|
|
59
61
|
const isInputValueInvalid = typeof inputValue === 'number' && (inputValue > inputMax || inputValue < inputMin);
|
|
62
|
+
|
|
60
63
|
/**
|
|
61
64
|
* Calls `onKeyDown` if it is defined.
|
|
62
65
|
* Calls `increment`, `decrement`, `increaseToMax`, or `decreaseToMin`
|
|
63
66
|
* depending on the key that was pressed.
|
|
64
67
|
*/
|
|
65
|
-
|
|
66
68
|
const handleKeyDown = e => {
|
|
67
|
-
onKeyDown
|
|
69
|
+
onKeyDown?.(e);
|
|
68
70
|
if (isExternallyDisabled) return;
|
|
69
|
-
|
|
70
71
|
if (e.key === 'ArrowUp') {
|
|
71
72
|
// Prevents browser's default increment
|
|
72
73
|
e.preventDefault();
|
|
@@ -83,7 +84,8 @@ const NumberStepperInput = /*#__PURE__*/React__default.forwardRef((_ref, ref) =>
|
|
|
83
84
|
// Prevents browser's default page scroll
|
|
84
85
|
e.preventDefault();
|
|
85
86
|
decreaseToMin();
|
|
86
|
-
}
|
|
87
|
+
}
|
|
88
|
+
// The w3 defines 'PageUp' and 'PageDown' as optional behavior.
|
|
87
89
|
// We decided not to add this optional behavior, but still wanted to prevent default scrolling behavior.
|
|
88
90
|
else if (e.key === 'PageUp') {
|
|
89
91
|
// Prevents browser's default page scroll
|
|
@@ -93,34 +95,31 @@ const NumberStepperInput = /*#__PURE__*/React__default.forwardRef((_ref, ref) =>
|
|
|
93
95
|
e.preventDefault();
|
|
94
96
|
}
|
|
95
97
|
};
|
|
98
|
+
|
|
96
99
|
/**
|
|
97
100
|
* Calls `onFocus` if it is defined.
|
|
98
101
|
* Selects the DOM element
|
|
99
102
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
103
|
const handleFocus = e => {
|
|
103
|
-
onFocus
|
|
104
|
+
onFocus?.(e);
|
|
104
105
|
if (isExternallyDisabled) return;
|
|
105
106
|
e.target.select();
|
|
106
107
|
};
|
|
108
|
+
|
|
107
109
|
/**
|
|
108
110
|
* Calls `onBlur` if it is defined.
|
|
109
111
|
* Calls `handleInputBlur`
|
|
110
112
|
*/
|
|
111
|
-
|
|
112
|
-
|
|
113
113
|
const handleBlur = e => {
|
|
114
|
-
onBlur
|
|
114
|
+
onBlur?.(e);
|
|
115
115
|
if (isExternallyDisabled) return;
|
|
116
116
|
handleInputBlur(e);
|
|
117
117
|
};
|
|
118
|
-
|
|
119
118
|
return /*#__PURE__*/React__default.createElement("input", _extends({}, rest, {
|
|
120
119
|
// `type`, `step`, `min`, `max`, `onChange`, and `value` are purposely overwritten
|
|
121
120
|
ref: ref,
|
|
122
|
-
"data-testid": dataTestIdFromProps
|
|
123
|
-
id: idFromProps
|
|
121
|
+
"data-testid": dataTestIdFromProps ?? getSubDataTestId(dataTestId, 'Input'),
|
|
122
|
+
id: idFromProps ?? inputId,
|
|
124
123
|
className: classNames(className, styles.numberStepperInput, {
|
|
125
124
|
[styles.invalid]: isInputValueInvalid,
|
|
126
125
|
[styles.disabled]: isExternallyDisabled
|
|
@@ -133,8 +132,8 @@ const NumberStepperInput = /*#__PURE__*/React__default.forwardRef((_ref, ref) =>
|
|
|
133
132
|
"aria-valuemin": inputMin,
|
|
134
133
|
"aria-valuemax": inputMax,
|
|
135
134
|
"aria-valuenow": Number(inputValue),
|
|
136
|
-
"aria-label": ariaLabelFromProps
|
|
137
|
-
"aria-labelledby": ariaLabelledByFromProps
|
|
135
|
+
"aria-label": ariaLabelFromProps ?? ariaLabel,
|
|
136
|
+
"aria-labelledby": ariaLabelledByFromProps ?? ariaLabelledBy,
|
|
138
137
|
"aria-describedby": internalAriaDescribedby,
|
|
139
138
|
"aria-invalid": isInputValueInvalid,
|
|
140
139
|
"aria-disabled": isExternallyDisabled,
|