@elliemae/ds-controlled-form 2.4.1-rc.1 → 2.4.1-rc.13
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/cjs/autocomplete/Autocomplete.js +4 -5
- package/cjs/autocomplete/AutocompleteCTX.js +3 -14
- package/cjs/autocomplete/AutocompleteDataTestids.js +1 -7
- package/cjs/autocomplete/config/useAutocomplete.js +23 -10
- package/cjs/autocomplete/parts/container/Container.js +36 -20
- package/cjs/autocomplete/parts/container/styled.js +1 -5
- package/cjs/autocomplete/parts/{controls → container}/useKeyboardNavigation.js +8 -24
- package/cjs/autocomplete/parts/menu-list/MenuList.js +17 -50
- package/cjs/autocomplete/parts/menu-list/styled.js +9 -10
- package/cjs/autocomplete/parts/menu-list/useItemRenderer.js +38 -44
- package/cjs/autocomplete/react-desc-prop-types.js +4 -8
- package/cjs/autocomplete/utils/listHelper.js +8 -16
- package/cjs/checkbox/ControlledCheckbox.js +2 -1
- package/cjs/checkbox/react-desc-prop-types.js +2 -0
- package/cjs/combobox/ComboBox.js +1 -0
- package/cjs/combobox/config/useComboBox.js +8 -2
- package/cjs/combobox/config/useCorrectOptions.js +14 -42
- package/cjs/combobox/index.js +1 -0
- package/cjs/combobox/parts/A11yFocusedOption.js +3 -3
- package/cjs/combobox/parts/controls/Controls.js +4 -2
- package/cjs/combobox/parts/controls-input/ControlsInput.js +2 -0
- package/cjs/combobox/parts/controls-input/styled.js +1 -1
- package/cjs/combobox/parts/controls-input/useControlsInput.js +6 -6
- package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +30 -26
- package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +7 -5
- package/cjs/combobox/parts/dropdown-indicator/DropdownIndicator.js +6 -4
- package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +4 -4
- package/cjs/combobox/parts/menu-list/MenuList.js +13 -7
- package/cjs/combobox/parts/menu-list/styled.js +16 -5
- package/cjs/combobox/parts/menu-list/useItemRenderer.js +8 -8
- package/cjs/combobox/parts/menu-list/useMenuListSetFocusOption.js +6 -6
- package/cjs/combobox/react-desc-prop-types.js +2 -1
- package/cjs/combobox/utils/listHelper.js +40 -11
- package/cjs/date-time-picker/ControlledDateTimePickerCTX.js +1 -114
- package/cjs/date-time-picker/ControlledDateTimePickerDatatestid.js +0 -2
- package/cjs/date-time-picker/config/useChangeHandlers.js +264 -0
- package/cjs/date-time-picker/config/useControlledDateTimePicker.js +37 -420
- package/cjs/date-time-picker/config/useGetDestructuredValues.js +25 -68
- package/cjs/date-time-picker/config/useGetFlags.js +173 -0
- package/cjs/date-time-picker/config/useGetPropsBasedOnType.js +101 -0
- package/cjs/date-time-picker/config/useGetPropsWithDefault.js +2 -3
- package/cjs/date-time-picker/config/useGetReferences.js +86 -0
- package/cjs/date-time-picker/config/useGlobalKeyHandlers.js +106 -0
- package/cjs/date-time-picker/config/useRelevantValueFromProps.js +39 -0
- package/cjs/date-time-picker/config/useValidateProps.js +47 -42
- package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +20 -8
- package/cjs/date-time-picker/parts/ControlledDateTimePickerContent.js +14 -12
- package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +5 -5
- package/cjs/date-time-picker/parts/Pickers/Calendar/Calendar.js +11 -13
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarContent.js +4 -1
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarContext.js +1 -49
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +10 -7
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +8 -4
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarMonthDays.js +5 -2
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarWrapper.js +5 -2
- package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +18 -18
- package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +24 -122
- package/cjs/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +32 -4
- package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +10 -6
- package/cjs/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +30 -14
- package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +7 -4
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheel.js +7 -3
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.js +1 -16
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +0 -1
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +10 -10
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +18 -13
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +60 -33
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +18 -13
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheel.js +11 -13
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +5 -2
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.js +1 -65
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +8 -3
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelWrapper.js +5 -2
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/useConfigTimePickerCTX.js +18 -116
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +52 -94
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +4 -1
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +1 -1
- package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +1 -3
- package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +1 -1
- package/cjs/date-time-picker/parts/TimeInputs/TimeInputs.js +3 -7
- package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +3 -6
- package/cjs/date-time-picker/propTypes.js +56 -23
- package/cjs/{autocomplete/index.d.js → date-time-picker/sharedTypes.js} +0 -0
- package/cjs/date-time-picker/utils/dateHelpers.js +56 -56
- package/cjs/date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js +2 -5
- package/cjs/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +50 -47
- package/cjs/date-time-picker/utils/hooks/useOnClickOutside.js +1 -2
- package/cjs/date-time-picker/utils/stringHelpers.js +8 -14
- package/cjs/date-time-picker/utils/typeGuards.js +14 -0
- package/cjs/index.js +20 -3
- package/cjs/large-text-input/DSControlledLargeTextInput.js +83 -0
- package/cjs/large-text-input/exported-related/data-test-ids.js +11 -0
- package/cjs/large-text-input/exported-related/index.js +12 -0
- package/cjs/large-text-input/exported-related/theming.js +13 -0
- package/cjs/large-text-input/index.js +15 -0
- package/cjs/large-text-input/react-desc-prop-types.js +45 -0
- package/cjs/large-text-input/styles.js +40 -0
- package/cjs/mask-hook/hooks/index.js +11 -3
- package/cjs/mask-hook/hooks/useNumberMask.js +7 -0
- package/cjs/mask-hook/hooks/usePhoneMask.js +7 -0
- package/cjs/mask-hook/hooks/useRegExpMask.js +122 -0
- package/cjs/mask-hook/hooks/useSSNMask.js +7 -0
- package/cjs/mask-hook/hooks/{useZipCode.js → useZipCodeMask.js} +12 -5
- package/cjs/mask-hook/index.js +11 -3
- package/cjs/mask-hook/react-desc-prop-types.js +9 -0
- package/cjs/mask-hook/utils/addSpecialCharacters.js +3 -4
- package/cjs/mask-hook/utils/flatStringArray.js +18 -0
- package/cjs/mask-hook/utils/index.js +2 -0
- package/esm/autocomplete/Autocomplete.js +2 -3
- package/esm/autocomplete/AutocompleteCTX.js +3 -14
- package/esm/autocomplete/AutocompleteDataTestids.js +1 -7
- package/esm/autocomplete/config/useAutocomplete.js +27 -14
- package/esm/autocomplete/parts/container/Container.js +38 -23
- package/esm/autocomplete/parts/container/styled.js +2 -5
- package/esm/autocomplete/parts/{controls → container}/useKeyboardNavigation.js +8 -24
- package/esm/autocomplete/parts/menu-list/MenuList.js +19 -52
- package/esm/autocomplete/parts/menu-list/styled.js +9 -10
- package/esm/autocomplete/parts/menu-list/useItemRenderer.js +39 -45
- package/esm/autocomplete/react-desc-prop-types.js +5 -8
- package/esm/autocomplete/utils/listHelper.js +8 -16
- package/esm/checkbox/ControlledCheckbox.js +2 -1
- package/esm/checkbox/react-desc-prop-types.js +2 -0
- package/esm/combobox/ComboBox.js +1 -1
- package/esm/combobox/config/useComboBox.js +8 -2
- package/esm/combobox/config/useCorrectOptions.js +15 -43
- package/esm/combobox/index.js +1 -1
- package/esm/combobox/parts/A11yFocusedOption.js +3 -3
- package/esm/combobox/parts/controls/Controls.js +4 -2
- package/esm/combobox/parts/controls-input/ControlsInput.js +2 -0
- package/esm/combobox/parts/controls-input/styled.js +1 -1
- package/esm/combobox/parts/controls-input/useControlsInput.js +6 -6
- package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +30 -26
- package/esm/combobox/parts/controls-input/useMaskedOnChange.js +7 -5
- package/esm/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
- package/esm/combobox/parts/header-list/useHeaderListHandlers.js +4 -4
- package/esm/combobox/parts/menu-list/MenuList.js +13 -7
- package/esm/combobox/parts/menu-list/styled.js +16 -5
- package/esm/combobox/parts/menu-list/useItemRenderer.js +8 -8
- package/esm/combobox/parts/menu-list/useMenuListSetFocusOption.js +6 -6
- package/esm/combobox/react-desc-prop-types.js +2 -1
- package/esm/combobox/utils/listHelper.js +38 -12
- package/esm/date-time-picker/ControlledDateTimePickerCTX.js +3 -115
- package/esm/date-time-picker/ControlledDateTimePickerDatatestid.js +0 -2
- package/esm/date-time-picker/config/useChangeHandlers.js +256 -0
- package/esm/date-time-picker/config/useControlledDateTimePicker.js +38 -421
- package/esm/date-time-picker/config/useGetDestructuredValues.js +21 -68
- package/esm/date-time-picker/config/useGetFlags.js +165 -0
- package/esm/date-time-picker/config/useGetPropsBasedOnType.js +97 -0
- package/esm/date-time-picker/config/useGetPropsWithDefault.js +1 -2
- package/esm/date-time-picker/config/useGetReferences.js +82 -0
- package/esm/date-time-picker/config/useGlobalKeyHandlers.js +98 -0
- package/esm/date-time-picker/config/useRelevantValueFromProps.js +35 -0
- package/esm/date-time-picker/config/useValidateProps.js +47 -42
- package/esm/date-time-picker/parts/ClearButton/ClearButton.js +20 -9
- package/esm/date-time-picker/parts/ControlledDateTimePickerContent.js +14 -12
- package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +5 -5
- package/esm/date-time-picker/parts/Pickers/Calendar/Calendar.js +11 -13
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarContent.js +4 -1
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarContext.js +2 -50
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +10 -7
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +9 -5
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarMonthDays.js +5 -2
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarWrapper.js +5 -2
- package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +18 -18
- package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +23 -125
- package/esm/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +33 -5
- package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +10 -6
- package/esm/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +30 -14
- package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +7 -4
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheel.js +9 -5
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.js +1 -16
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -2
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +10 -10
- package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +18 -13
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +59 -33
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +18 -13
- package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheel.js +11 -13
- package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +5 -2
- package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.js +2 -66
- package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +8 -3
- package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelWrapper.js +5 -2
- package/esm/date-time-picker/parts/Pickers/TimeWheel/useConfigTimePickerCTX.js +15 -117
- package/esm/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +54 -96
- package/esm/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +4 -1
- package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +1 -1
- package/esm/date-time-picker/parts/TimeInputs/HHInput.js +1 -3
- package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +1 -1
- package/esm/date-time-picker/parts/TimeInputs/TimeInputs.js +3 -7
- package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +3 -6
- package/esm/date-time-picker/propTypes.js +49 -17
- package/esm/{autocomplete/index.d.js → date-time-picker/sharedTypes.js} +0 -0
- package/esm/date-time-picker/utils/dateHelpers.js +57 -57
- package/esm/date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js +2 -5
- package/esm/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +46 -47
- package/esm/date-time-picker/utils/hooks/useOnClickOutside.js +1 -2
- package/esm/date-time-picker/utils/stringHelpers.js +8 -14
- package/esm/date-time-picker/utils/typeGuards.js +8 -0
- package/esm/index.js +9 -5
- package/esm/large-text-input/DSControlledLargeTextInput.js +72 -0
- package/esm/large-text-input/exported-related/data-test-ids.js +7 -0
- package/esm/large-text-input/exported-related/index.js +2 -0
- package/esm/large-text-input/exported-related/theming.js +8 -0
- package/esm/large-text-input/index.js +3 -0
- package/esm/large-text-input/react-desc-prop-types.js +36 -0
- package/esm/large-text-input/styles.js +30 -0
- package/esm/mask-hook/hooks/index.js +5 -4
- package/esm/mask-hook/hooks/useNumberMask.js +7 -1
- package/esm/mask-hook/hooks/usePhoneMask.js +7 -1
- package/esm/mask-hook/hooks/useRegExpMask.js +116 -0
- package/esm/mask-hook/hooks/useSSNMask.js +7 -1
- package/esm/mask-hook/hooks/{useZipCode.js → useZipCodeMask.js} +11 -5
- package/esm/mask-hook/index.js +5 -4
- package/esm/mask-hook/react-desc-prop-types.js +8 -1
- package/esm/mask-hook/utils/addSpecialCharacters.js +3 -4
- package/esm/mask-hook/utils/flatStringArray.js +14 -0
- package/esm/mask-hook/utils/index.js +1 -0
- package/package.json +92 -88
- package/types/autocomplete/Autocomplete.d.ts +4 -61
- package/types/autocomplete/AutocompleteCTX.d.ts +4 -3
- package/types/autocomplete/AutocompleteDataTestids.d.ts +1 -7
- package/types/autocomplete/config/useAutocomplete.d.ts +3 -2
- package/types/autocomplete/parts/container/Container.d.ts +1 -2
- package/types/autocomplete/parts/container/styled.d.ts +0 -1
- package/types/autocomplete/parts/{controls → container}/useKeyboardNavigation.d.ts +0 -0
- package/types/autocomplete/parts/menu-list/MenuList.d.ts +1 -2
- package/types/autocomplete/parts/menu-list/styled.d.ts +1 -4
- package/types/autocomplete/parts/menu-list/useItemRenderer.d.ts +2 -3
- package/types/autocomplete/react-desc-prop-types.d.ts +8 -18
- package/types/autocomplete/sharedTypes.d.ts +1 -3
- package/types/autocomplete/tests/general.test.d.ts +1 -0
- package/types/autocomplete/tests/utils.d.ts +5 -0
- package/types/autocomplete/utils/listHelper.d.ts +2 -2
- package/types/checkbox/ControlledCheckbox.d.ts +1 -1
- package/types/checkbox/react-desc-prop-types.d.ts +367 -1
- package/types/combobox/ComboBox.d.ts +2 -2
- package/types/combobox/parts/dropdown-indicator/DropdownIndicator.d.ts +1 -0
- package/types/combobox/react-desc-prop-types.d.ts +381 -3
- package/types/combobox/utils/listHelper.d.ts +4 -1
- package/types/date-time-picker/ControlledDateTimePicker.d.ts +25 -80
- package/types/date-time-picker/ControlledDateTimePickerCTX.d.ts +1 -2
- package/types/date-time-picker/ControlledDateTimePickerDatatestid.d.ts +46 -46
- package/types/date-time-picker/ControlledDateTimePickerTypes.d.ts +15 -15
- package/types/date-time-picker/config/useChangeHandlers.d.ts +25 -0
- package/types/date-time-picker/config/useControlledDateTimePicker.d.ts +18 -2
- package/types/date-time-picker/config/useGetDestructuredValues.d.ts +30 -4
- package/types/date-time-picker/config/useGetFlags.d.ts +27 -0
- package/types/date-time-picker/config/useGetPropsBasedOnType.d.ts +28 -0
- package/types/date-time-picker/config/useGetPropsWithDefault.d.ts +2 -2
- package/types/date-time-picker/config/useGetReferences.d.ts +39 -0
- package/types/date-time-picker/config/useGlobalKeyHandlers.d.ts +16 -0
- package/types/date-time-picker/config/useRelevantValueFromProps.d.ts +10 -0
- package/types/date-time-picker/config/useValidateProps.d.ts +2 -2
- package/types/date-time-picker/parts/ClearButton/useClearButton.d.ts +6 -6
- package/types/date-time-picker/parts/DateInputs/DDInput.d.ts +6 -6
- package/types/date-time-picker/parts/DateInputs/MMInput.d.ts +6 -6
- package/types/date-time-picker/parts/DateInputs/YYYYInput.d.ts +6 -6
- package/types/date-time-picker/parts/DateInputs/useDateInputs.d.ts +2 -2
- package/types/date-time-picker/parts/Pickers/Calendar/Calendar.d.ts +4 -2
- package/types/date-time-picker/parts/Pickers/Calendar/CalendarContext.d.ts +3 -63
- package/types/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.d.ts +4 -4
- package/types/date-time-picker/parts/Pickers/Calendar/CalendarFooter.d.ts +2 -2
- package/types/date-time-picker/parts/Pickers/Calendar/Day.d.ts +2 -2
- package/types/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.d.ts +15 -2
- package/types/date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +12 -5
- package/types/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.d.ts +17 -11
- package/types/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.d.ts +1 -16
- package/types/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.d.ts +2 -2
- package/types/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.d.ts +15 -1
- package/types/date-time-picker/parts/Pickers/TimeWheel/TimeWheel.d.ts +4 -2
- package/types/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.d.ts +3 -62
- package/types/date-time-picker/parts/Pickers/TimeWheel/TimeWheelFooter.d.ts +2 -2
- package/types/date-time-picker/parts/Pickers/TimeWheel/useConfigTimePickerCTX.d.ts +4 -1
- package/types/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.d.ts +16 -5
- package/types/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +18 -3
- package/types/date-time-picker/parts/TimeInputs/HHInput.d.ts +6 -6
- package/types/date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +6 -6
- package/types/date-time-picker/parts/TimeInputs/MinutesInput.d.ts +6 -6
- package/types/date-time-picker/parts/TimeInputs/useTimeInputs.d.ts +22 -2
- package/types/date-time-picker/parts/config.d.ts +3 -3
- package/types/date-time-picker/sharedTypes.d.ts +94 -0
- package/types/date-time-picker/utils/constants.d.ts +33 -33
- package/types/date-time-picker/utils/dateHelpers.d.ts +15 -14
- package/types/date-time-picker/utils/dateTimeHelpers.d.ts +3 -3
- package/types/date-time-picker/utils/hooks/useGetDayFromDateString.d.ts +1 -1
- package/types/date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.d.ts +2 -2
- package/types/date-time-picker/utils/hooks/useGetStartingFocusedDay.d.ts +6 -6
- package/types/date-time-picker/utils/hooks/useOnClickOutside.d.ts +1 -1
- package/types/date-time-picker/utils/timeHelpers.d.ts +2 -2
- package/types/date-time-picker/utils/typeGuards.d.ts +4 -0
- package/types/index.d.ts +1 -0
- package/types/large-text-input/DSControlledLargeTextInput.d.ts +5 -0
- package/types/large-text-input/exported-related/data-test-ids.d.ts +5 -0
- package/types/large-text-input/exported-related/index.d.ts +2 -0
- package/types/large-text-input/exported-related/theming.d.ts +6 -0
- package/types/large-text-input/index.d.ts +2 -0
- package/types/large-text-input/react-desc-prop-types.d.ts +447 -0
- package/types/large-text-input/styles.d.ts +3 -0
- package/types/large-text-input/tests/DSControlledLargeTextInput.test.d.ts +1 -0
- package/types/mask-hook/hooks/index.d.ts +2 -1
- package/types/mask-hook/hooks/useNumberMask.d.ts +2 -1
- package/types/mask-hook/hooks/usePhoneMask.d.ts +2 -1
- package/types/mask-hook/hooks/useRegExpMask.d.ts +4 -0
- package/types/mask-hook/hooks/useSSNMask.d.ts +2 -1
- package/types/mask-hook/hooks/useZipCodeMask.d.ts +4 -0
- package/types/mask-hook/react-desc-prop-types.d.ts +6 -1
- package/types/mask-hook/tests/useRegExpMask.test.d.ts +1 -0
- package/types/mask-hook/utils/flatStringArray.d.ts +1 -0
- package/types/mask-hook/utils/index.d.ts +1 -0
- package/types/text-input/DSInputText.d.ts +1 -1
- package/types/text-input/config/useInputText.d.ts +110 -110
- package/cjs/autocomplete/config/constants.js +0 -14
- package/cjs/autocomplete/config/useGetPropsWithDefault.js +0 -11
- package/cjs/autocomplete/parts/a11y-messages/MultiAllyMessages.js +0 -33
- package/cjs/autocomplete/parts/a11y-messages/SingleAllyMessages.js +0 -28
- package/cjs/autocomplete/parts/a11y-messages/index.js +0 -11
- package/cjs/autocomplete/parts/a11y-messages/styled.js +0 -15
- package/cjs/autocomplete/parts/controls/Controls.js +0 -63
- package/cjs/autocomplete/parts/controls/index.js +0 -9
- package/cjs/autocomplete/parts/controls/styled.js +0 -44
- package/cjs/autocomplete/parts/controls/useControlsInput.js +0 -44
- package/cjs/autocomplete/parts/controls/useMaskedOnChange.js +0 -28
- package/cjs/autocomplete/parts/menu-list/useMenuList.js +0 -69
- package/cjs/autocomplete/propTypes.js +0 -25
- package/cjs/autocomplete/utils/hooks/useKeyboardNavigation.js +0 -97
- package/cjs/autocomplete/utils/hooks/useOnElementResize.js +0 -37
- package/cjs/text-input/exported-related/name.js +0 -7
- package/cjs/text-input/exported-related/slots.js +0 -11
- package/esm/autocomplete/config/constants.js +0 -10
- package/esm/autocomplete/config/useGetPropsWithDefault.js +0 -7
- package/esm/autocomplete/parts/a11y-messages/MultiAllyMessages.js +0 -25
- package/esm/autocomplete/parts/a11y-messages/SingleAllyMessages.js +0 -20
- package/esm/autocomplete/parts/a11y-messages/index.js +0 -2
- package/esm/autocomplete/parts/a11y-messages/styled.js +0 -7
- package/esm/autocomplete/parts/controls/Controls.js +0 -55
- package/esm/autocomplete/parts/controls/index.js +0 -1
- package/esm/autocomplete/parts/controls/styled.js +0 -32
- package/esm/autocomplete/parts/controls/useControlsInput.js +0 -40
- package/esm/autocomplete/parts/controls/useMaskedOnChange.js +0 -24
- package/esm/autocomplete/parts/menu-list/useMenuList.js +0 -65
- package/esm/autocomplete/propTypes.js +0 -21
- package/esm/autocomplete/utils/hooks/useKeyboardNavigation.js +0 -93
- package/esm/autocomplete/utils/hooks/useOnElementResize.js +0 -33
- package/esm/text-input/exported-related/name.js +0 -3
- package/esm/text-input/exported-related/slots.js +0 -7
- package/types/autocomplete/config/constants.d.ts +0 -8
- package/types/autocomplete/config/useGetPropsWithDefault.d.ts +0 -2
- package/types/autocomplete/parts/a11y-messages/MultiAllyMessages.d.ts +0 -3
- package/types/autocomplete/parts/a11y-messages/SingleAllyMessages.d.ts +0 -3
- package/types/autocomplete/parts/a11y-messages/index.d.ts +0 -2
- package/types/autocomplete/parts/a11y-messages/styled.d.ts +0 -1
- package/types/autocomplete/parts/controls/Controls.d.ts +0 -3
- package/types/autocomplete/parts/controls/index.d.ts +0 -1
- package/types/autocomplete/parts/controls/styled.d.ts +0 -8
- package/types/autocomplete/parts/controls/useControlsInput.d.ts +0 -9
- package/types/autocomplete/parts/controls/useMaskedOnChange.d.ts +0 -2
- package/types/autocomplete/parts/menu-list/useMenuList.d.ts +0 -2
- package/types/autocomplete/propTypes.d.ts +0 -51
- package/types/autocomplete/utils/hooks/useKeyboardNavigation.d.ts +0 -4
- package/types/autocomplete/utils/hooks/useOnElementResize.d.ts +0 -3
- package/types/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.d.ts +0 -2
- package/types/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +0 -12
- package/types/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +0 -2
- package/types/date-time-picker/propTypes.d.ts +0 -81
- package/types/mask-hook/hooks/useZipCode.d.ts +0 -3
- package/types/text-input/exported-related/name.d.ts +0 -1
- package/types/text-input/exported-related/slots.d.ts +0 -5
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
const AutocompleteDataTestid = {
|
|
2
|
-
INPUT: 'autocomplete-input',
|
|
3
2
|
LIST: 'autocomplete-menu-list',
|
|
4
|
-
SELECTED_VALUES: 'autocomplete-selected-values',
|
|
5
|
-
SELECT_ALL_BUTTON: 'autocomplete-all-btn',
|
|
6
|
-
CLEAR_ALL_BUTTON: 'autocomplete-clear-btn',
|
|
7
|
-
DROPDOWN: 'autocomplete-dropdown-btn',
|
|
8
3
|
OPTION: 'autocomplete-option',
|
|
9
|
-
|
|
10
|
-
SHOW_SELECTED_OPTIONS_BUTTON: 'autocomplete-selected-options-btn'
|
|
4
|
+
CONTAINER: 'autocomplete-container'
|
|
11
5
|
};
|
|
12
6
|
|
|
13
7
|
export { AutocompleteDataTestid };
|
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
1
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
2
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
3
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
4
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
-
import
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import { useRef, useState, useCallback, useEffect, useMemo } from 'react';
|
|
9
|
+
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
9
10
|
import { useVirtual } from 'react-virtual';
|
|
10
|
-
import {
|
|
11
|
+
import { propTypes } from '../react-desc-prop-types.js';
|
|
12
|
+
import { defaultProps } from '../AutocompleteCTX.js';
|
|
13
|
+
import { getFirstOption } from '../utils/listHelper.js';
|
|
11
14
|
|
|
12
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
16
|
|
|
14
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
18
|
const useAutocomplete = props => {
|
|
19
|
+
const defaultPropsWithInnerRef = _objectSpread(_objectSpread({}, defaultProps), {}, {
|
|
20
|
+
innerRef: useRef(null)
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultPropsWithInnerRef);
|
|
24
|
+
useValidateTypescriptPropTypes(propsWithDefault, propTypes);
|
|
16
25
|
const [showPopover, setShowPopover] = useState(false);
|
|
17
26
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
18
27
|
const [focusOptionIdx, setCurrentOption] = useState('');
|
|
19
28
|
const inputRef = useRef(null);
|
|
20
29
|
const listRef = useRef(null);
|
|
21
|
-
const wrapperListRef = useRef(null);
|
|
22
30
|
const selectedOptionsRef = useRef(null);
|
|
23
|
-
const controlsWrapperRef = useRef(null);
|
|
24
|
-
const propsWithDefaults = useGetAutocompleteWithDefaultsProps(props);
|
|
25
31
|
const {
|
|
26
|
-
options
|
|
27
|
-
|
|
32
|
+
options,
|
|
33
|
+
filter
|
|
34
|
+
} = propsWithDefault; // ===========================================================================
|
|
28
35
|
// Virtualization setup
|
|
29
36
|
// ===========================================================================
|
|
30
37
|
|
|
@@ -43,8 +50,16 @@ const useAutocomplete = props => {
|
|
|
43
50
|
};
|
|
44
51
|
virtualListHelpers.scrollToIndex(options.findIndex(opt => opt.dsId === dsId), opts);
|
|
45
52
|
}, [options, virtualListHelpers]);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (filter.length === 0 || options.length === 0) {
|
|
55
|
+
setShowPopover(false);
|
|
56
|
+
}
|
|
57
|
+
}, [filter, options.length, setShowPopover]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setCurrentOption(getFirstOption(options));
|
|
60
|
+
}, [options, showPopover]);
|
|
46
61
|
const ctx = useMemo(() => ({
|
|
47
|
-
props: _objectSpread({},
|
|
62
|
+
props: _objectSpread({}, propsWithDefault),
|
|
48
63
|
virtualListHelpers,
|
|
49
64
|
showPopover,
|
|
50
65
|
referenceElement,
|
|
@@ -52,13 +67,11 @@ const useAutocomplete = props => {
|
|
|
52
67
|
listRef,
|
|
53
68
|
focusOptionIdx,
|
|
54
69
|
selectedOptionsRef,
|
|
55
|
-
controlsWrapperRef,
|
|
56
|
-
wrapperListRef,
|
|
57
70
|
setCurrentOption,
|
|
58
71
|
scrollOptionIntoView,
|
|
59
72
|
setReferenceElement,
|
|
60
73
|
setShowPopover
|
|
61
|
-
}), [scrollOptionIntoView,
|
|
74
|
+
}), [scrollOptionIntoView, propsWithDefault, virtualListHelpers, focusOptionIdx, showPopover, referenceElement, inputRef, selectedOptionsRef, listRef]);
|
|
62
75
|
return ctx;
|
|
63
76
|
};
|
|
64
77
|
|
|
@@ -1,40 +1,56 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
5
|
+
import React, { useContext, useEffect, useCallback } from 'react';
|
|
3
6
|
import { DSPopperJS } from '@elliemae/ds-popperjs';
|
|
4
7
|
import { AutocompleteContext } from '../../AutocompleteCTX.js';
|
|
5
|
-
import {
|
|
6
|
-
import { Controls } from '../controls/Controls.js';
|
|
8
|
+
import { StyledContainerWithPopper, StyledPopperWrapper } from './styled.js';
|
|
7
9
|
import { MenuList } from '../menu-list/MenuList.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
import { useKeyboardNavigation } from './useKeyboardNavigation.js';
|
|
11
|
+
import { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';
|
|
12
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
11
13
|
|
|
14
|
+
var _StyledPopperWrapper;
|
|
12
15
|
const Container = () => {
|
|
13
16
|
const {
|
|
14
17
|
props: {
|
|
15
|
-
inline,
|
|
16
18
|
startPlacementPreference,
|
|
19
|
+
children,
|
|
20
|
+
filter,
|
|
17
21
|
placementOrderPreference
|
|
18
22
|
},
|
|
19
23
|
showPopover,
|
|
20
|
-
inputRef,
|
|
21
24
|
setReferenceElement,
|
|
22
25
|
setShowPopover,
|
|
23
26
|
referenceElement
|
|
24
27
|
} = useContext(AutocompleteContext);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const closePopper = () => {
|
|
30
|
+
setShowPopover(false);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
window.addEventListener('blur', closePopper);
|
|
34
|
+
return () => {
|
|
35
|
+
window.removeEventListener('blur', closePopper);
|
|
36
|
+
};
|
|
37
|
+
}, [setShowPopover]);
|
|
25
38
|
const handleCloseMenu = useCallback(() => {
|
|
26
39
|
setShowPopover(false);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
}, [setShowPopover]);
|
|
41
|
+
const input = React.Children.only(children);
|
|
42
|
+
const {
|
|
43
|
+
onInputKeyDown
|
|
44
|
+
} = useKeyboardNavigation();
|
|
45
|
+
return /*#__PURE__*/jsxs(StyledContainerWithPopper, {
|
|
46
|
+
ref: setReferenceElement,
|
|
47
|
+
role: "combobox",
|
|
48
|
+
"aria-autocomplete": "list",
|
|
49
|
+
"aria-controls": "autocomplete-listbox",
|
|
50
|
+
"aria-expanded": showPopover,
|
|
51
|
+
onKeyDown: onInputKeyDown,
|
|
52
|
+
"data-testid": AutocompleteDataTestid.CONTAINER,
|
|
53
|
+
children: [input, filter && /*#__PURE__*/_jsx(DSPopperJS, {
|
|
38
54
|
customOffset: [0, 5],
|
|
39
55
|
closeContextMenu: handleCloseMenu,
|
|
40
56
|
referenceElement: referenceElement,
|
|
@@ -45,10 +61,9 @@ const Container = () => {
|
|
|
45
61
|
withoutArrow: true,
|
|
46
62
|
withoutAnimation: true,
|
|
47
63
|
zIndex: 10
|
|
48
|
-
}, void 0, /*#__PURE__*/_jsx(StyledPopperWrapper, {
|
|
49
|
-
tabIndex: -1
|
|
50
|
-
|
|
51
|
-
}, void 0, _MenuList2 || (_MenuList2 = /*#__PURE__*/_jsx(MenuList, {}))))]
|
|
64
|
+
}, void 0, _StyledPopperWrapper || (_StyledPopperWrapper = /*#__PURE__*/_jsx(StyledPopperWrapper, {
|
|
65
|
+
tabIndex: -1
|
|
66
|
+
}, void 0, /*#__PURE__*/_jsx(MenuList, {}))))]
|
|
52
67
|
});
|
|
53
68
|
};
|
|
54
69
|
|
|
@@ -3,11 +3,8 @@ import styled from 'styled-components';
|
|
|
3
3
|
const StyledContainerWithPopper = /*#__PURE__*/styled.div.withConfig({
|
|
4
4
|
componentId: "sc-xupfk9-0"
|
|
5
5
|
})(["width:100%;height:28px;position:relative;"]);
|
|
6
|
-
const StyledContainerInline = /*#__PURE__*/styled.div.withConfig({
|
|
7
|
-
componentId: "sc-xupfk9-1"
|
|
8
|
-
})(["width:100%;position:relative;"]);
|
|
9
6
|
const StyledPopperWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
10
|
-
componentId: "sc-xupfk9-
|
|
7
|
+
componentId: "sc-xupfk9-1"
|
|
11
8
|
})(["background:#fff;overflow:auto;position:relative;"]);
|
|
12
9
|
|
|
13
|
-
export {
|
|
10
|
+
export { StyledContainerWithPopper, StyledPopperWrapper };
|
|
@@ -10,7 +10,7 @@ const isOptionFocuseable = opt => !['section', 'separator'].includes(opt.type);
|
|
|
10
10
|
const useKeyboardNavigation = () => {
|
|
11
11
|
const {
|
|
12
12
|
props: {
|
|
13
|
-
|
|
13
|
+
onSelect,
|
|
14
14
|
options
|
|
15
15
|
},
|
|
16
16
|
setShowPopover,
|
|
@@ -21,25 +21,18 @@ const useKeyboardNavigation = () => {
|
|
|
21
21
|
} = useContext(AutocompleteContext);
|
|
22
22
|
const currentItemIndex = options.findIndex(opt => opt.dsId === focusOptionIdx);
|
|
23
23
|
const currentItem = options.find(item => item.type === 'option' && item.dsId === focusOptionIdx);
|
|
24
|
-
const selectOption = useCallback(e => {
|
|
25
|
-
if (onValueChange) onValueChange(currentItem.label, e);
|
|
26
|
-
setShowPopover(false);
|
|
27
|
-
}, [currentItem, setShowPopover, onValueChange]);
|
|
28
24
|
const onInputKeyDown = useCallback(e => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (['ArrowDown', 'ArrowUp', 'Enter'].includes(e.key) || e.keyCode >= 48 && e.keyCode <= 90) {
|
|
25
|
+
if ((e.keyCode >= 48 && e.keyCode <= 90 || e.key === 'Backspace') && !showPopover) {
|
|
32
26
|
setShowPopover(true);
|
|
33
|
-
} // =============================================================================
|
|
27
|
+
} else if (e.key === 'Tab') setShowPopover(false); // =============================================================================
|
|
34
28
|
// ENTER AND SPACE KEY SELECT OPTIONS AND OPEN CLOSE THE POPOVER
|
|
35
29
|
// =============================================================================
|
|
36
30
|
|
|
37
31
|
|
|
38
|
-
if (e.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
32
|
+
if (e.key === 'Enter' && showPopover) {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
onSelect(currentItem === null || currentItem === void 0 ? void 0 : currentItem.label, e);
|
|
35
|
+
setShowPopover(false);
|
|
43
36
|
} // =============================================================================
|
|
44
37
|
// ARROWS UP AND DOWN
|
|
45
38
|
// =============================================================================
|
|
@@ -52,8 +45,6 @@ const useKeyboardNavigation = () => {
|
|
|
52
45
|
const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable);
|
|
53
46
|
setCurrentOption(options[nextItemIndex].dsId);
|
|
54
47
|
scrollOptionIntoView(options[nextItemIndex].dsId);
|
|
55
|
-
} else {
|
|
56
|
-
setShowPopover(true);
|
|
57
48
|
}
|
|
58
49
|
}
|
|
59
50
|
|
|
@@ -64,13 +55,6 @@ const useKeyboardNavigation = () => {
|
|
|
64
55
|
const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable, -1);
|
|
65
56
|
setCurrentOption(options[nextItemIndex].dsId);
|
|
66
57
|
scrollOptionIntoView(options[nextItemIndex].dsId);
|
|
67
|
-
} else {
|
|
68
|
-
setShowPopover(true);
|
|
69
|
-
setTimeout(() => {
|
|
70
|
-
const nextItemIndex = findInCircularList(options, 0, isOptionFocuseable, -1);
|
|
71
|
-
setCurrentOption(options[nextItemIndex].dsId);
|
|
72
|
-
scrollOptionIntoView(options[nextItemIndex].dsId);
|
|
73
|
-
});
|
|
74
58
|
}
|
|
75
59
|
} // =============================================================================
|
|
76
60
|
// ESCAPE
|
|
@@ -80,7 +64,7 @@ const useKeyboardNavigation = () => {
|
|
|
80
64
|
if (e.key === 'Escape') {
|
|
81
65
|
setShowPopover(false);
|
|
82
66
|
}
|
|
83
|
-
}, [
|
|
67
|
+
}, [currentItem === null || currentItem === void 0 ? void 0 : currentItem.label, currentItemIndex, onSelect, options, scrollOptionIntoView, setCurrentOption, setShowPopover, showPopover]);
|
|
84
68
|
return {
|
|
85
69
|
onInputKeyDown
|
|
86
70
|
};
|
|
@@ -1,83 +1,50 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import { useContext,
|
|
3
|
-
import { DSCircularProgressIndicator } from '@elliemae/ds-circular-progress-indicator';
|
|
4
|
-
import { Grid } from '@elliemae/ds-grid';
|
|
2
|
+
import { useContext, useCallback } from 'react';
|
|
5
3
|
import { StyledListWrapper, StyledVirtualListWrapper, StyledList } from './styled.js';
|
|
6
4
|
import { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';
|
|
7
5
|
import { AutocompleteContext } from '../../AutocompleteCTX.js';
|
|
8
|
-
import { useOnElementResize } from '../../utils/hooks/useOnElementResize.js';
|
|
9
6
|
import { useItemRenderer } from './useItemRenderer.js';
|
|
10
|
-
import {
|
|
11
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
8
|
|
|
13
9
|
const MenuList = () => {
|
|
14
|
-
var _inputRef$current2;
|
|
15
|
-
|
|
16
10
|
const {
|
|
17
11
|
props: {
|
|
18
|
-
|
|
19
|
-
menuMaxHeight,
|
|
20
|
-
options,
|
|
21
|
-
isLoading
|
|
12
|
+
options
|
|
22
13
|
},
|
|
23
14
|
referenceElement,
|
|
24
15
|
inputRef,
|
|
25
16
|
listRef,
|
|
26
17
|
showPopover,
|
|
27
|
-
wrapperListRef,
|
|
28
|
-
controlsWrapperRef,
|
|
29
18
|
virtualListHelpers: {
|
|
30
19
|
totalSize
|
|
31
20
|
}
|
|
32
21
|
} = useContext(AutocompleteContext);
|
|
33
22
|
const ItemRenderer = useItemRenderer();
|
|
34
|
-
useMenuList();
|
|
35
|
-
const {
|
|
36
|
-
width
|
|
37
|
-
} = useOnElementResize(controlsWrapperRef);
|
|
38
|
-
const listWidth = useMemo(() => menuMinWidth || "".concat(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth), // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
-
[menuMinWidth, referenceElement, width]);
|
|
40
23
|
const handleOnFocus = useCallback(() => {
|
|
41
24
|
var _inputRef$current;
|
|
42
25
|
|
|
43
26
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
44
27
|
}, [inputRef]);
|
|
45
|
-
return /*#__PURE__*/
|
|
28
|
+
return /*#__PURE__*/_jsx(StyledListWrapper, {
|
|
46
29
|
tabIndex: -1,
|
|
47
|
-
ref: wrapperListRef,
|
|
48
30
|
onMouseDown: e => e.preventDefault(),
|
|
49
|
-
minWidth:
|
|
50
|
-
id: "
|
|
51
|
-
role: "listbox"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
31
|
+
minWidth: referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth,
|
|
32
|
+
id: "autocomplete-listbox",
|
|
33
|
+
role: "listbox"
|
|
34
|
+
}, void 0, options.length > 0 && /*#__PURE__*/jsx(StyledVirtualListWrapper, {
|
|
35
|
+
tabIndex: -1,
|
|
36
|
+
ref: listRef,
|
|
37
|
+
children: /*#__PURE__*/_jsx(StyledList, {
|
|
38
|
+
tabIndex: -1,
|
|
39
|
+
"aria-expanded": showPopover,
|
|
40
|
+
onFocus: handleOnFocus,
|
|
41
|
+
"data-testid": AutocompleteDataTestid.LIST,
|
|
55
42
|
style: {
|
|
56
|
-
|
|
43
|
+
height: totalSize,
|
|
44
|
+
margin: '8px 0px'
|
|
57
45
|
}
|
|
58
|
-
}, void 0,
|
|
59
|
-
|
|
60
|
-
loading: isLoading,
|
|
61
|
-
waiting: false,
|
|
62
|
-
showTooltip: false
|
|
63
|
-
})) : /*#__PURE__*/jsx(Fragment, {
|
|
64
|
-
children: options.length > 0 && /*#__PURE__*/jsx(StyledVirtualListWrapper, {
|
|
65
|
-
tabIndex: -1,
|
|
66
|
-
maxHeight: menuMaxHeight,
|
|
67
|
-
ref: listRef,
|
|
68
|
-
children: /*#__PURE__*/_jsx(StyledList, {
|
|
69
|
-
tabIndex: -1,
|
|
70
|
-
"aria-expanded": showPopover,
|
|
71
|
-
onFocus: handleOnFocus,
|
|
72
|
-
"data-testid": AutocompleteDataTestid.LIST,
|
|
73
|
-
style: {
|
|
74
|
-
height: totalSize,
|
|
75
|
-
margin: '8px 0px'
|
|
76
|
-
}
|
|
77
|
-
}, void 0, ItemRenderer)
|
|
78
|
-
})
|
|
79
|
-
})
|
|
80
|
-
});
|
|
46
|
+
}, void 0, ItemRenderer)
|
|
47
|
+
}));
|
|
81
48
|
};
|
|
82
49
|
|
|
83
50
|
export { MenuList };
|
|
@@ -2,23 +2,22 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
const StyledListWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
4
4
|
componentId: "sc-qt1kwv-0"
|
|
5
|
-
})(["min-width:", ";"],
|
|
5
|
+
})(["min-width:", ";"], _ref => {
|
|
6
|
+
let {
|
|
7
|
+
minWidth
|
|
8
|
+
} = _ref;
|
|
9
|
+
return minWidth ? "".concat(minWidth, "px") : '100%';
|
|
10
|
+
});
|
|
6
11
|
const StyledList = /*#__PURE__*/styled.ul.withConfig({
|
|
7
12
|
componentId: "sc-qt1kwv-1"
|
|
8
13
|
})(["position:relative;padding:0;"]);
|
|
9
14
|
const StyledVirtualListWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
10
15
|
componentId: "sc-qt1kwv-2"
|
|
11
|
-
})(["overflow-y:auto;
|
|
12
|
-
let {
|
|
13
|
-
withHeader
|
|
14
|
-
} = _ref;
|
|
15
|
-
return withHeader ? '28px' : '';
|
|
16
|
-
}, _ref2 => {
|
|
16
|
+
})(["overflow-y:auto;max-height:", ";"], _ref2 => {
|
|
17
17
|
let {
|
|
18
|
-
maxHeight
|
|
19
|
-
inline
|
|
18
|
+
maxHeight
|
|
20
19
|
} = _ref2;
|
|
21
|
-
return
|
|
20
|
+
return "".concat(!maxHeight ? '400' : maxHeight, "px");
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
export { StyledList, StyledListWrapper, StyledVirtualListWrapper };
|
|
@@ -7,75 +7,69 @@ import 'core-js/modules/esnext.iterator.filter.js';
|
|
|
7
7
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
8
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
9
9
|
import { useContext, useCallback, useMemo } from 'react';
|
|
10
|
-
import { SingleMenuItem } from '@elliemae/ds-form';
|
|
10
|
+
import { Section, SingleMenuItem } from '@elliemae/ds-form';
|
|
11
11
|
import { AutocompleteContext } from '../../AutocompleteCTX.js';
|
|
12
|
-
import { isSelected } from '../../utils/listHelper.js';
|
|
13
12
|
import { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';
|
|
14
13
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
15
14
|
|
|
16
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
16
|
|
|
18
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
-
|
|
20
18
|
const useItemRenderer = () => {
|
|
21
19
|
const {
|
|
22
20
|
props: {
|
|
23
21
|
options,
|
|
24
|
-
|
|
25
|
-
selectedValues,
|
|
26
|
-
onFilter
|
|
22
|
+
onSelect
|
|
27
23
|
},
|
|
28
24
|
inputRef,
|
|
29
25
|
setShowPopover,
|
|
30
26
|
focusOptionIdx,
|
|
31
27
|
virtualListHelpers
|
|
32
28
|
} = useContext(AutocompleteContext);
|
|
33
|
-
const {
|
|
34
|
-
virtualItems
|
|
35
|
-
} = virtualListHelpers;
|
|
36
29
|
const handleClick = useCallback((option, e) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (inputRef.current) inputRef.current.value = option.label;
|
|
40
|
-
onFilter(option.label);
|
|
41
|
-
onChange(option.label);
|
|
30
|
+
onSelect(option.label, e);
|
|
42
31
|
setShowPopover(false);
|
|
43
|
-
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
44
32
|
e.stopPropagation();
|
|
45
33
|
e.preventDefault();
|
|
46
|
-
}, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
34
|
+
}, [onSelect, setShowPopover]);
|
|
35
|
+
return useMemo(() => {
|
|
36
|
+
if (virtualListHelpers) {
|
|
37
|
+
return virtualListHelpers.virtualItems.map(vItem => {
|
|
38
|
+
const option = options[vItem.index];
|
|
39
|
+
const generalProps = {
|
|
40
|
+
wrapperStyles: {
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
top: vItem.start,
|
|
43
|
+
left: 0,
|
|
44
|
+
width: '100%'
|
|
45
|
+
},
|
|
46
|
+
key: "".concat(option.dsId),
|
|
47
|
+
innerRef: vItem.measureRef
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (option.type === 'section') {
|
|
51
|
+
return /*#__PURE__*/jsx(Section, _objectSpread({
|
|
52
|
+
label: option.label
|
|
53
|
+
}, generalProps));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (option.type === 'option') {
|
|
57
|
+
return /*#__PURE__*/jsx(SingleMenuItem, _objectSpread(_objectSpread({}, generalProps), {}, {
|
|
58
|
+
value: option.value,
|
|
59
|
+
label: option.label,
|
|
60
|
+
dataTestid: AutocompleteDataTestid.OPTION,
|
|
61
|
+
disabled: option.disabled,
|
|
62
|
+
onClick: e => handleClick(option, e),
|
|
63
|
+
isActive: option.dsId === focusOptionIdx
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
value: option.value,
|
|
66
|
-
label: option.label,
|
|
67
|
-
dataTestid: AutocompleteDataTestid.OPTION,
|
|
68
|
-
disabled: option.disabled,
|
|
69
|
-
onClick: e => handleClick(option, e),
|
|
70
|
-
onMouseDown: handleOnMouseDown,
|
|
71
|
-
isActive: option.dsId === focusOptionIdx,
|
|
72
|
-
isSelected: isSelected(selectedValues, option)
|
|
73
|
-
}));
|
|
67
|
+
return /*#__PURE__*/jsx(Fragment, {});
|
|
68
|
+
});
|
|
74
69
|
}
|
|
75
70
|
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
return ItemRenderer;
|
|
71
|
+
return null;
|
|
72
|
+
}, [options, focusOptionIdx, inputRef, virtualListHelpers]);
|
|
79
73
|
};
|
|
80
74
|
|
|
81
75
|
export { useItemRenderer };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { PropTypes } from '@elliemae/ds-props-helpers';
|
|
2
2
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
4
|
-
function noop() {}
|
|
5
4
|
const propTypes = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
hasError: PropTypes.bool.description('Whether the combo box has error or not').defaultValue('false'),
|
|
11
|
-
onChange: PropTypes.func.description('function triggered when an option is selected it will send the options selected').defaultValue('')
|
|
5
|
+
options: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired.description('List of options').defaultValue([]),
|
|
6
|
+
filter: PropTypes.string.isRequired.description('String value to filter the options').defaultValue(''),
|
|
7
|
+
onSelect: PropTypes.func.isRequired.description('function triggered when an option is selected it will send the options selected').defaultValue(''),
|
|
8
|
+
children: PropTypes.node.isRequired.description('React component to apply autocomplete functionality').defaultValue('')
|
|
12
9
|
};
|
|
13
10
|
|
|
14
|
-
export {
|
|
11
|
+
export { propTypes };
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
3
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.some.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.some.js';
|
|
6
4
|
|
|
7
5
|
const getSelectableOptions = options => options ? options.filter(option => option.type === 'option' && !option.disabled) : [];
|
|
8
6
|
const getOptions = options => options ? options.filter(option => option.type === 'option') : [];
|
|
9
7
|
const isSelectedValueEmpty = value => Array.isArray(value) ? value.length === 0 : !value;
|
|
10
8
|
const isSelectedValueMultiple = value => Array.isArray(value);
|
|
11
|
-
const isSelected = (value, activeOption) => {
|
|
12
|
-
if (isSelectedValueMultiple(value)) {
|
|
13
|
-
const multiValue = value;
|
|
14
|
-
return multiValue.some(item => (item === null || item === void 0 ? void 0 : item.value) === (activeOption === null || activeOption === void 0 ? void 0 : activeOption.value));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (typeof value === 'string') {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const singleValue = value;
|
|
22
|
-
return (singleValue === null || singleValue === void 0 ? void 0 : singleValue.value) === activeOption.value;
|
|
23
|
-
};
|
|
24
9
|
const findInCircularList = function (list, from, criteria) {
|
|
25
10
|
let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
26
11
|
|
|
@@ -30,5 +15,12 @@ const findInCircularList = function (list, from, criteria) {
|
|
|
30
15
|
|
|
31
16
|
return from; // return same item
|
|
32
17
|
};
|
|
18
|
+
const getFirstOption = options => {
|
|
19
|
+
for (let i = 0; i < options.length; i += 1) if (!['section', 'separator'].includes(options[i].type)) {
|
|
20
|
+
return options[i].dsId;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return '';
|
|
24
|
+
};
|
|
33
25
|
|
|
34
|
-
export { findInCircularList, getOptions, getSelectableOptions,
|
|
26
|
+
export { findInCircularList, getFirstOption, getOptions, getSelectableOptions, isSelectedValueEmpty, isSelectedValueMultiple };
|
|
@@ -30,6 +30,7 @@ const DSControlledCheckbox = props => {
|
|
|
30
30
|
label,
|
|
31
31
|
hasError,
|
|
32
32
|
innerRef,
|
|
33
|
+
wrapLabel,
|
|
33
34
|
tabIndex,
|
|
34
35
|
ariaLabel: legacyAriaLabel,
|
|
35
36
|
ariaControls: legacyAriaControls,
|
|
@@ -82,7 +83,7 @@ const DSControlledCheckbox = props => {
|
|
|
82
83
|
readOnly: readOnly,
|
|
83
84
|
checked: checked,
|
|
84
85
|
"data-testid": "ds-checkbox-label"
|
|
85
|
-
}, void 0, /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
86
|
+
}, void 0, wrapLabel ? label : /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
86
87
|
value: label
|
|
87
88
|
})));
|
|
88
89
|
};
|
|
@@ -10,12 +10,14 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
10
10
|
|
|
11
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
12
|
const defaultProps = {
|
|
13
|
+
wrapLabel: false,
|
|
13
14
|
hasError: false,
|
|
14
15
|
tabIndex: undefined,
|
|
15
16
|
checked: false
|
|
16
17
|
};
|
|
17
18
|
const propTypes = _objectSpread(_objectSpread({}, globalAttributesPropTypes), {}, {
|
|
18
19
|
label: PropTypes.string.description('Checkbox Label property. This label is also going to be used as an aria-label for screen readers.'),
|
|
20
|
+
wrapLabel: PropTypes.bool.description('Whether to wrap or truncate label'),
|
|
19
21
|
hasError: PropTypes.bool.description('Whether the checkbox has error or not.'),
|
|
20
22
|
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Checkbox input ref.')
|
|
21
23
|
});
|
package/esm/combobox/ComboBox.js
CHANGED