@onewelcome/react-lib-components 14.0.0-experiment.1 → 14.1.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/dist/components/Breadcrumbs/Breadcrumbs.module.scss.cjs.js +2 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.module.scss.es.js +5 -5
- package/dist/components/Button/BaseButton.module.scss.cjs.js +2 -2
- package/dist/components/Button/BaseButton.module.scss.es.js +4 -4
- package/dist/components/Button/Button.cjs.js +1 -1
- package/dist/components/Button/Button.cjs.js.map +1 -1
- package/dist/components/Button/Button.es.js +11 -2
- package/dist/components/Button/Button.es.js.map +1 -1
- package/dist/components/Button/Button.module.scss.cjs.js +2 -2
- package/dist/components/Button/Button.module.scss.es.js +17 -17
- package/dist/components/Button/IconButton.module.scss.cjs.js +2 -2
- package/dist/components/Button/IconButton.module.scss.es.js +18 -18
- package/dist/components/ContextMenu/ContextMenu.cjs.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.es.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.module.scss.cjs.js +2 -2
- package/dist/components/ContextMenu/ContextMenu.module.scss.es.js +6 -6
- package/dist/components/ContextMenu/ContextMenuDivider.module.scss.cjs.js +2 -2
- package/dist/components/ContextMenu/ContextMenuDivider.module.scss.es.js +2 -2
- package/dist/components/ContextMenu/ContextMenuItem.cjs.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenuItem.es.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenuItem.module.scss.cjs.js +2 -2
- package/dist/components/ContextMenu/ContextMenuItem.module.scss.es.js +3 -3
- package/dist/components/ContextMenu/ContextMenuService.cjs.js +1 -1
- package/dist/components/ContextMenu/ContextMenuService.cjs.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenuService.es.js +20 -17
- package/dist/components/ContextMenu/ContextMenuService.es.js.map +1 -1
- package/dist/components/DataGrid/DataGrid.cjs.js +1 -1
- package/dist/components/DataGrid/DataGrid.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGrid.es.js +102 -59
- package/dist/components/DataGrid/DataGrid.es.js.map +1 -1
- package/dist/components/DataGrid/DataGrid.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGrid.module.scss.es.js +8 -6
- package/dist/components/DataGrid/DataGrid.module.scss.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridActions/DataGridActions.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridActions/DataGridActions.module.scss.es.js +6 -6
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss.es.js +7 -7
- package/dist/components/DataGrid/DataGridBody/DataGridBody.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridBody.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridBody.es.js +4 -2
- package/dist/components/DataGrid/DataGridBody/DataGridBody.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridBody.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridBody.module.scss.es.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.module.scss.es.js +5 -5
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawer.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawer.module.scss.es.js +4 -4
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.module.scss.es.js +5 -5
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.es.js +2 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.module.scss.es.js +24 -24
- package/dist/components/DataGrid/DataGridBody/DataGridRow/useNestedRow.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/useNestedRow.es.js +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/useNestedRow.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.es.js +4 -4
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.module.scss.es.js +9 -9
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterPopover.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterPopover.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterService.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterService.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterService.es.js +17 -21
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterService.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterTag.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterTag.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterTag.es.js +15 -4
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterTag.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.es.js +54 -6
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilters.interfaces.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilters.interfaces.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.es.js +4 -4
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.module.scss.es.js +10 -10
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.es.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.module.scss.es.js +17 -17
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerCalendarSection.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerCalendarSection.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerCalendarSection.es.js +45 -24
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerCalendarSection.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/useFiltersReducer.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/useFiltersReducer.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/useFiltersReducer.es.js +7 -9
- package/dist/components/DataGrid/DataGridFilters/useFiltersReducer.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.es.js +6 -2
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.module.scss.es.js +7 -4
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.module.scss.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.es.js +14 -12
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss.es.js +11 -10
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss.es.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.module.scss.cjs.js +2 -2
- package/dist/components/DatePicker/DatePicker.module.scss.es.js +31 -31
- package/dist/components/Form/Checkbox/Checkbox.cjs.js.map +1 -1
- package/dist/components/Form/Checkbox/Checkbox.es.js.map +1 -1
- package/dist/components/Form/Checkbox/Checkbox.module.scss.cjs.js +2 -2
- package/dist/components/Form/Checkbox/Checkbox.module.scss.es.js +13 -13
- package/dist/components/Form/Fieldset/Fieldset.cjs.js +1 -1
- package/dist/components/Form/Fieldset/Fieldset.cjs.js.map +1 -1
- package/dist/components/Form/Fieldset/Fieldset.es.js +3 -2
- package/dist/components/Form/Fieldset/Fieldset.es.js.map +1 -1
- package/dist/components/Form/Fieldset/Fieldset.module.scss.cjs.js +2 -2
- package/dist/components/Form/Fieldset/Fieldset.module.scss.es.js +8 -5
- package/dist/components/Form/Fieldset/Fieldset.module.scss.es.js.map +1 -1
- package/dist/components/Form/FileUpload/FileItem/FileItem.cjs.js +1 -1
- package/dist/components/Form/FileUpload/FileItem/FileItem.cjs.js.map +1 -1
- package/dist/components/Form/FileUpload/FileItem/FileItem.es.js +1 -1
- package/dist/components/Form/FileUpload/FileItem/FileItem.es.js.map +1 -1
- package/dist/components/Form/FileUpload/FileItem/FileItem.module.scss.cjs.js +2 -2
- package/dist/components/Form/FileUpload/FileItem/FileItem.module.scss.es.js +18 -18
- package/dist/components/Form/FileUpload/FileUpload.cjs.js +1 -1
- package/dist/components/Form/FileUpload/FileUpload.cjs.js.map +1 -1
- package/dist/components/Form/FileUpload/FileUpload.es.js +6 -6
- package/dist/components/Form/FileUpload/FileUpload.es.js.map +1 -1
- package/dist/components/Form/FileUpload/FileUpload.module.scss.cjs.js +2 -2
- package/dist/components/Form/FileUpload/FileUpload.module.scss.es.js +16 -16
- package/dist/components/Form/Form.module.scss.cjs.js +2 -2
- package/dist/components/Form/Form.module.scss.es.js +2 -2
- package/dist/components/Form/FormControl/FormControl.cjs.js +1 -1
- package/dist/components/Form/FormControl/FormControl.cjs.js.map +1 -1
- package/dist/components/Form/FormControl/FormControl.es.js +3 -3
- package/dist/components/Form/FormControl/FormControl.es.js.map +1 -1
- package/dist/components/Form/FormControl/FormControl.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormControl/FormControl.module.scss.es.js +13 -13
- package/dist/components/Form/FormErrorText/FormErrorText.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormErrorText/FormErrorText.module.scss.es.js +9 -6
- package/dist/components/Form/FormErrorText/FormErrorText.module.scss.es.js.map +1 -1
- package/dist/components/Form/FormGroup/FormGroup.cjs.js.map +1 -1
- package/dist/components/Form/FormGroup/FormGroup.es.js.map +1 -1
- package/dist/components/Form/FormGroup/FormGroup.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormGroup/FormGroup.module.scss.es.js +3 -3
- package/dist/components/Form/FormHelperText/FormHelperText.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormHelperText/FormHelperText.module.scss.es.js +4 -4
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.cjs.js +1 -1
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.cjs.js.map +1 -1
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.es.js +4 -1
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.es.js.map +1 -1
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.module.scss.es.js +6 -6
- package/dist/components/Form/Input/Input.cjs.js +1 -1
- package/dist/components/Form/Input/Input.cjs.js.map +1 -1
- package/dist/components/Form/Input/Input.es.js +48 -5
- package/dist/components/Form/Input/Input.es.js.map +1 -1
- package/dist/components/Form/Input/Input.module.scss.cjs.js +2 -2
- package/dist/components/Form/Input/Input.module.scss.es.js +8 -8
- package/dist/components/Form/Label/Label.module.scss.cjs.js +2 -2
- package/dist/components/Form/Label/Label.module.scss.es.js +2 -2
- package/dist/components/Form/Radio/Radio.cjs.js.map +1 -1
- package/dist/components/Form/Radio/Radio.es.js +1 -1
- package/dist/components/Form/Radio/Radio.es.js.map +1 -1
- package/dist/components/Form/Radio/Radio.module.scss.cjs.js +2 -2
- package/dist/components/Form/Radio/Radio.module.scss.es.js +11 -11
- package/dist/components/Form/Select/MultiSelect/MultiOption.cjs.js +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiOption.cjs.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiOption.es.js +11 -10
- package/dist/components/Form/Select/MultiSelect/MultiOption.es.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiSelect.cjs.js +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiSelect.cjs.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiSelect.es.js +236 -57
- package/dist/components/Form/Select/MultiSelect/MultiSelect.es.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiSelect.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/MultiSelect/MultiSelect.module.scss.es.js +20 -15
- package/dist/components/Form/Select/MultiSelect/MultiSelect.module.scss.es.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/SelectButton.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/MultiSelect/SelectButton.module.scss.es.js +2 -2
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.cjs.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.es.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.module.scss.es.js +4 -4
- package/dist/components/Form/Select/MultiSelect/useArrowNavigation.cjs.js +1 -1
- package/dist/components/Form/Select/MultiSelect/useArrowNavigation.cjs.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/useArrowNavigation.es.js +134 -32
- package/dist/components/Form/Select/MultiSelect/useArrowNavigation.es.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/useSearch.cjs.js +1 -1
- package/dist/components/Form/Select/MultiSelect/useSearch.cjs.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/useSearch.es.js +73 -55
- package/dist/components/Form/Select/MultiSelect/useSearch.es.js.map +1 -1
- package/dist/components/Form/Select/Select.interfaces.cjs.js.map +1 -1
- package/dist/components/Form/Select/Select.interfaces.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Option.cjs.js +1 -1
- package/dist/components/Form/Select/SingleSelect/Option.cjs.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Option.es.js +16 -9
- package/dist/components/Form/Select/SingleSelect/Option.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.cjs.js +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.cjs.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.es.js +202 -46
- package/dist/components/Form/Select/SingleSelect/Select.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/SingleSelect/Select.module.scss.es.js +21 -17
- package/dist/components/Form/Select/SingleSelect/Select.module.scss.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/useArrowNavigation.cjs.js +1 -1
- package/dist/components/Form/Select/SingleSelect/useArrowNavigation.cjs.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/useArrowNavigation.es.js +176 -89
- package/dist/components/Form/Select/SingleSelect/useArrowNavigation.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/useSearch.cjs.js +1 -1
- package/dist/components/Form/Select/SingleSelect/useSearch.cjs.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/useSearch.es.js +48 -36
- package/dist/components/Form/Select/SingleSelect/useSearch.es.js.map +1 -1
- package/dist/components/Form/Select/useAddNewBtn.cjs.js +1 -1
- package/dist/components/Form/Select/useAddNewBtn.cjs.js.map +1 -1
- package/dist/components/Form/Select/useAddNewBtn.es.js +8 -6
- package/dist/components/Form/Select/useAddNewBtn.es.js.map +1 -1
- package/dist/components/Form/Select/useAddNewBtn.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/useAddNewBtn.module.scss.es.js +4 -4
- package/dist/components/Form/Select/useBaseSearch.cjs.js +2 -0
- package/dist/components/Form/Select/useBaseSearch.cjs.js.map +1 -0
- package/dist/components/Form/Select/useBaseSearch.es.js +85 -0
- package/dist/components/Form/Select/useBaseSearch.es.js.map +1 -0
- package/dist/components/Form/Select/useSelectPositionList.cjs.js +1 -1
- package/dist/components/Form/Select/useSelectPositionList.cjs.js.map +1 -1
- package/dist/components/Form/Select/useSelectPositionList.es.js +18 -5
- package/dist/components/Form/Select/useSelectPositionList.es.js.map +1 -1
- package/dist/components/Form/Textarea/Textarea.cjs.js +1 -1
- package/dist/components/Form/Textarea/Textarea.cjs.js.map +1 -1
- package/dist/components/Form/Textarea/Textarea.es.js +4 -0
- package/dist/components/Form/Textarea/Textarea.es.js.map +1 -1
- package/dist/components/Form/Textarea/Textarea.module.scss.cjs.js +2 -2
- package/dist/components/Form/Textarea/Textarea.module.scss.es.js +6 -6
- package/dist/components/Form/Toggle/Toggle.cjs.js +1 -1
- package/dist/components/Form/Toggle/Toggle.cjs.js.map +1 -1
- package/dist/components/Form/Toggle/Toggle.es.js +5 -3
- package/dist/components/Form/Toggle/Toggle.es.js.map +1 -1
- package/dist/components/Form/Toggle/Toggle.module.scss.cjs.js +2 -2
- package/dist/components/Form/Toggle/Toggle.module.scss.es.js +18 -18
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.cjs.js +1 -1
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.es.js +25 -17
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.module.scss.es.js +8 -4
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.module.scss.es.js.map +1 -1
- package/dist/components/Form/Wrapper/InputWrapper/InputWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/InputWrapper/InputWrapper.module.scss.es.js +5 -5
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.module.scss.es.js +3 -3
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.cjs.js +1 -1
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.es.js +41 -22
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.module.scss.es.js +8 -4
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.module.scss.es.js.map +1 -1
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.module.scss.es.js +3 -3
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.cjs.js +1 -1
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.es.js +2 -0
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss.es.js +8 -8
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.cjs.js +1 -1
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.es.js +1 -1
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.module.scss.es.js +6 -6
- package/dist/components/Icon/Icon.cjs.js +1 -1
- package/dist/components/Icon/Icon.cjs.js.map +1 -1
- package/dist/components/Icon/Icon.es.js +3 -1
- package/dist/components/Icon/Icon.es.js.map +1 -1
- package/dist/components/Icon/Icon.module.scss.cjs.js +2 -2
- package/dist/components/Icon/Icon.module.scss.es.js +109 -107
- package/dist/components/Icon/Icon.module.scss.es.js.map +1 -1
- package/dist/components/Layout/ActionBar/ActionBar.cjs.js +2 -0
- package/dist/components/Layout/ActionBar/ActionBar.cjs.js.map +1 -0
- package/dist/components/Layout/ActionBar/ActionBar.es.js +122 -0
- package/dist/components/Layout/ActionBar/ActionBar.es.js.map +1 -0
- package/dist/components/Layout/ActionBar/ActionBar.module.scss.cjs.js +3 -0
- package/dist/components/Layout/ActionBar/ActionBar.module.scss.cjs.js.map +1 -0
- package/dist/components/Layout/ActionBar/ActionBar.module.scss.es.js +24 -0
- package/dist/components/Layout/ActionBar/ActionBar.module.scss.es.js.map +1 -0
- package/dist/components/Layout/Card/Card.module.scss.cjs.js +2 -2
- package/dist/components/Layout/Card/Card.module.scss.es.js +12 -12
- package/dist/components/Layout/ContentHeader/ContentHeader.cjs.js +1 -1
- package/dist/components/Layout/ContentHeader/ContentHeader.cjs.js.map +1 -1
- package/dist/components/Layout/ContentHeader/ContentHeader.es.js +66 -41
- package/dist/components/Layout/ContentHeader/ContentHeader.es.js.map +1 -1
- package/dist/components/Layout/ContentHeader/ContentHeader.module.scss.cjs.js +2 -2
- package/dist/components/Layout/ContentHeader/ContentHeader.module.scss.es.js +28 -13
- package/dist/components/Layout/ContentHeader/ContentHeader.module.scss.es.js.map +1 -1
- package/dist/components/Layout/FormPage/FormWithStepper/FormSection/FormSection.module.scss.cjs.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormSection/FormSection.module.scss.es.js +4 -4
- package/dist/components/Layout/FormPage/FormWithStepper/FormStepper/FormStepper.module.scss.cjs.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormStepper/FormStepper.module.scss.es.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormWithStepper.module.scss.cjs.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormWithStepper.module.scss.es.js +3 -3
- package/dist/components/Link/Link.cjs.js.map +1 -1
- package/dist/components/Link/Link.es.js +1 -1
- package/dist/components/Link/Link.es.js.map +1 -1
- package/dist/components/Link/Link.module.scss.cjs.js +2 -2
- package/dist/components/Link/Link.module.scss.es.js +17 -17
- package/dist/components/Notifications/Alert/AlertContainer/AlertContainer.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Alert/AlertContainer/AlertContainer.module.scss.es.js +11 -11
- package/dist/components/Notifications/Alert/AlertContainer/useAlertContainerHeightAnimation.cjs.js +1 -1
- package/dist/components/Notifications/Alert/AlertContainer/useAlertContainerHeightAnimation.cjs.js.map +1 -1
- package/dist/components/Notifications/Alert/AlertContainer/useAlertContainerHeightAnimation.es.js +7 -1
- package/dist/components/Notifications/Alert/AlertContainer/useAlertContainerHeightAnimation.es.js.map +1 -1
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.cjs.js +1 -1
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.cjs.js.map +1 -1
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.es.js +1 -1
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.es.js.map +1 -1
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.module.scss.es.js +22 -22
- package/dist/components/Notifications/Banner/Banner.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Banner/Banner.module.scss.es.js +9 -9
- package/dist/components/Notifications/BaseModal/BaseModal.cjs.js +1 -1
- package/dist/components/Notifications/BaseModal/BaseModal.cjs.js.map +1 -1
- package/dist/components/Notifications/BaseModal/BaseModal.es.js +1 -1
- package/dist/components/Notifications/BaseModal/BaseModal.es.js.map +1 -1
- package/dist/components/Notifications/BaseModal/BaseModal.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModal.module.scss.es.js +5 -5
- package/dist/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.cjs.js.map +1 -1
- package/dist/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.es.js.map +1 -1
- package/dist/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.scss.es.js +4 -4
- package/dist/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.cjs.js.map +1 -1
- package/dist/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.es.js.map +1 -1
- package/dist/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.scss.es.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.scss.es.js +6 -6
- package/dist/components/Notifications/Dialog/Dialog.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Dialog/Dialog.module.scss.es.js +4 -4
- package/dist/components/Notifications/Dialog/DialogActions/DialogActions.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Dialog/DialogActions/DialogActions.module.scss.es.js +3 -3
- package/dist/components/Notifications/Dialog/DialogTitle/DialogTitle.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Dialog/DialogTitle/DialogTitle.module.scss.es.js +10 -10
- package/dist/components/Notifications/DiscardChangesModal/DiscardChangesModal.cjs.js.map +1 -1
- package/dist/components/Notifications/DiscardChangesModal/DiscardChangesModal.es.js.map +1 -1
- package/dist/components/Notifications/SideSheet/SideSheet.cjs.js.map +1 -1
- package/dist/components/Notifications/SideSheet/SideSheet.es.js +1 -1
- package/dist/components/Notifications/SideSheet/SideSheet.es.js.map +1 -1
- package/dist/components/Notifications/SideSheet/SideSheet.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheet.module.scss.es.js +13 -13
- package/dist/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss.es.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss.es.js +2 -2
- package/dist/components/Notifications/SlideInModal/SlideInModal.cjs.js.map +1 -1
- package/dist/components/Notifications/SlideInModal/SlideInModal.es.js +1 -1
- package/dist/components/Notifications/SlideInModal/SlideInModal.es.js.map +1 -1
- package/dist/components/Notifications/SlideInModal/SlideInModal.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SlideInModal/SlideInModal.module.scss.es.js +10 -10
- package/dist/components/Pagination/Pagination.cjs.js +1 -1
- package/dist/components/Pagination/Pagination.cjs.js.map +1 -1
- package/dist/components/Pagination/Pagination.es.js +118 -90
- package/dist/components/Pagination/Pagination.es.js.map +1 -1
- package/dist/components/Pagination/Pagination.module.scss.cjs.js +2 -2
- package/dist/components/Pagination/Pagination.module.scss.es.js +15 -14
- package/dist/components/Pagination/Pagination.module.scss.es.js.map +1 -1
- package/dist/components/Popover/Popover.cjs.js.map +1 -1
- package/dist/components/Popover/Popover.es.js.map +1 -1
- package/dist/components/Popover/Popover.module.scss.cjs.js +2 -2
- package/dist/components/Popover/Popover.module.scss.es.js +3 -3
- package/dist/components/ProgressBar/ProgressBar.cjs.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.es.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.module.scss.cjs.js +2 -2
- package/dist/components/ProgressBar/ProgressBar.module.scss.es.js +9 -9
- package/dist/components/Skeleton/Skeleton.module.scss.cjs.js +2 -2
- package/dist/components/Skeleton/Skeleton.module.scss.es.js +5 -5
- package/dist/components/Spinner/Spinner.module.scss.cjs.js +2 -2
- package/dist/components/Spinner/Spinner.module.scss.es.js +3 -3
- package/dist/components/Stepper/Step.module.scss.cjs.js +2 -2
- package/dist/components/Stepper/Step.module.scss.es.js +22 -22
- package/dist/components/Stepper/Stepper.module.scss.cjs.js +2 -2
- package/dist/components/Stepper/Stepper.module.scss.es.js +4 -4
- package/dist/components/Tabs/Tab.module.scss.cjs.js +2 -2
- package/dist/components/Tabs/Tab.module.scss.es.js +3 -3
- package/dist/components/Tabs/TabButton.cjs.js.map +1 -1
- package/dist/components/Tabs/TabButton.es.js.map +1 -1
- package/dist/components/Tabs/TabButton.module.scss.cjs.js +2 -2
- package/dist/components/Tabs/TabButton.module.scss.es.js +12 -12
- package/dist/components/Tabs/Tabs.cjs.js +1 -1
- package/dist/components/Tabs/Tabs.cjs.js.map +1 -1
- package/dist/components/Tabs/Tabs.es.js +1 -1
- package/dist/components/Tabs/Tabs.es.js.map +1 -1
- package/dist/components/Tabs/Tabs.module.scss.cjs.js +2 -2
- package/dist/components/Tabs/Tabs.module.scss.es.js +10 -10
- package/dist/components/Tag/RemoveButton.module.scss.cjs.js +2 -2
- package/dist/components/Tag/RemoveButton.module.scss.es.js +3 -3
- package/dist/components/Tag/Tag.cjs.js +1 -1
- package/dist/components/Tag/Tag.cjs.js.map +1 -1
- package/dist/components/Tag/Tag.es.js +7 -1
- package/dist/components/Tag/Tag.es.js.map +1 -1
- package/dist/components/Tag/Tag.module.scss.cjs.js +2 -2
- package/dist/components/Tag/Tag.module.scss.es.js +6 -6
- package/dist/components/TextEllipsis/TextEllipsis.cjs.js.map +1 -1
- package/dist/components/TextEllipsis/TextEllipsis.es.js.map +1 -1
- package/dist/components/TextEllipsis/TextEllipsis.module.scss.cjs.js +2 -2
- package/dist/components/TextEllipsis/TextEllipsis.module.scss.es.js +3 -3
- package/dist/components/Tiles/Tile.cjs.js.map +1 -1
- package/dist/components/Tiles/Tile.es.js.map +1 -1
- package/dist/components/Tiles/Tile.module.scss.cjs.js +2 -2
- package/dist/components/Tiles/Tile.module.scss.es.js +8 -8
- package/dist/components/Tiles/Tiles.module.scss.cjs.js +2 -2
- package/dist/components/Tiles/Tiles.module.scss.es.js +2 -2
- package/dist/components/Tooltip/Tooltip.cjs.js +1 -1
- package/dist/components/Tooltip/Tooltip.cjs.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.es.js +47 -39
- package/dist/components/Tooltip/Tooltip.es.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.module.scss.cjs.js +2 -2
- package/dist/components/Tooltip/Tooltip.module.scss.es.js +28 -27
- package/dist/components/Tooltip/Tooltip.module.scss.es.js.map +1 -1
- package/dist/components/Typography/Typography.module.scss.cjs.js +2 -2
- package/dist/components/Typography/Typography.module.scss.es.js +13 -13
- package/dist/components/_BaseStyling_/BaseStyling.cjs.js +2 -1
- package/dist/components/_BaseStyling_/BaseStyling.cjs.js.map +1 -1
- package/dist/components/_BaseStyling_/BaseStyling.es.js +3 -3
- package/dist/components/_BaseStyling_/BaseStyling.es.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNav.cjs.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNav.es.js +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNav.es.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNav.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/LeftNav/LeftNav.module.scss.es.js +5 -5
- package/dist/components/admin/layout/LeftNav/LeftNavItem/ButtonLeftNavItem.cjs.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNavItem/ButtonLeftNavItem.es.js +3 -1
- package/dist/components/admin/layout/LeftNav/LeftNavItem/ButtonLeftNavItem.es.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.module.scss.es.js +14 -14
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LinkLeftNavItem.cjs.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LinkLeftNavItem.es.js +6 -2
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LinkLeftNavItem.es.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/useRefItems.cjs.js +1 -1
- package/dist/components/admin/layout/LeftNav/useRefItems.cjs.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/useRefItems.es.js +7 -6
- package/dist/components/admin/layout/LeftNav/useRefItems.es.js.map +1 -1
- package/dist/components/admin/layout/MicrofrontendContainer/MicrofrontendContainer.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/MicrofrontendContainer/MicrofrontendContainer.module.scss.es.js +3 -3
- package/dist/components/admin/layout/ProfileMenu/ProfileMenu.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/ProfileMenu/ProfileMenu.module.scss.es.js +7 -7
- package/dist/components/admin/layout/TopNavBar/TopNavBar.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/TopNavBar/TopNavBar.module.scss.es.js +13 -13
- package/dist/components/miscellaneous/IdentityProviderButton.cjs.js.map +1 -1
- package/dist/components/miscellaneous/IdentityProviderButton.es.js.map +1 -1
- package/dist/components/miscellaneous/IdentityProviderButton.module.scss.cjs.js +2 -2
- package/dist/components/miscellaneous/IdentityProviderButton.module.scss.es.js +3 -3
- package/dist/components/withReadOnly.cjs.js +1 -1
- package/dist/components/withReadOnly.cjs.js.map +1 -1
- package/dist/components/withReadOnly.es.js +2 -4
- package/dist/components/withReadOnly.es.js.map +1 -1
- package/dist/hooks/useClickOutside.cjs.js +1 -1
- package/dist/hooks/useClickOutside.cjs.js.map +1 -1
- package/dist/hooks/useClickOutside.es.js +1 -1
- package/dist/hooks/useClickOutside.es.js.map +1 -1
- package/dist/hooks/useDebouncedCallback.cjs.js +1 -1
- package/dist/hooks/useDebouncedCallback.cjs.js.map +1 -1
- package/dist/hooks/useDebouncedCallback.es.js +9 -2
- package/dist/hooks/useDebouncedCallback.es.js.map +1 -1
- package/dist/hooks/useGetDomRoot.cjs.js.map +1 -1
- package/dist/hooks/useGetDomRoot.es.js.map +1 -1
- package/dist/hooks/usePosition.cjs.js +1 -1
- package/dist/hooks/usePosition.cjs.js.map +1 -1
- package/dist/hooks/usePosition.es.js +105 -4
- package/dist/hooks/usePosition.es.js.map +1 -1
- package/dist/hooks/useRepeatFocus.cjs.js.map +1 -1
- package/dist/hooks/useRepeatFocus.es.js.map +1 -1
- package/dist/hooks/useScreenSize.cjs.js +1 -1
- package/dist/hooks/useScreenSize.cjs.js.map +1 -1
- package/dist/hooks/useScreenSize.es.js +1 -1
- package/dist/hooks/useScreenSize.es.js.map +1 -1
- package/dist/hooks/useStickyStacking.cjs.js +2 -0
- package/dist/hooks/useStickyStacking.cjs.js.map +1 -0
- package/dist/hooks/useStickyStacking.es.js +208 -0
- package/dist/hooks/useStickyStacking.es.js.map +1 -0
- package/dist/hooks/useUploadFile.cjs.js +1 -1
- package/dist/hooks/useUploadFile.cjs.js.map +1 -1
- package/dist/hooks/useUploadFile.es.js +1 -1
- package/dist/hooks/useUploadFile.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +141 -29
- package/dist/index.es.js +4 -0
- package/dist/index.es.js.map +1 -1
- package/dist/node_modules/tabbable/dist/index.esm.cjs.js +1 -1
- package/dist/node_modules/tabbable/dist/index.esm.cjs.js.map +1 -1
- package/dist/node_modules/tabbable/dist/index.esm.es.js +4 -3
- package/dist/node_modules/tabbable/dist/index.esm.es.js.map +1 -1
- package/dist/readyclasses.module.scss.cjs.js +2 -2
- package/dist/readyclasses.module.scss.es.js +5 -5
- package/dist/util/helper.cjs.js +1 -1
- package/dist/util/helper.cjs.js.map +1 -1
- package/dist/util/helper.es.js +33 -16
- package/dist/util/helper.es.js.map +1 -1
- package/package.json +12 -12
|
@@ -1,35 +1,44 @@
|
|
|
1
|
-
import React, { useState,
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
2
|
import { Input } from "../../Input/Input.es.js";
|
|
3
|
-
import {
|
|
3
|
+
import { omitProps } from "../../../../util/helper.es.js";
|
|
4
|
+
import { useBaseSearch } from "../useBaseSearch.es.js";
|
|
5
|
+
import { Icon, Icons } from "../../../Icon/Icon.es.js";
|
|
6
|
+
import selectClasses from "./Select.module.scss.es.js";
|
|
4
7
|
const useSearch = ({
|
|
5
8
|
search,
|
|
6
9
|
optionsCount,
|
|
7
10
|
searchInputClassName,
|
|
8
11
|
expanded,
|
|
9
|
-
setFocusedSelectItem
|
|
12
|
+
setFocusedSelectItem,
|
|
13
|
+
placeholder
|
|
10
14
|
}) => {
|
|
11
|
-
var _a;
|
|
12
|
-
const [filter, setFilter] = useState("");
|
|
13
15
|
const [isSearching, setIsSearching] = useState(false);
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
const {
|
|
17
|
+
filter,
|
|
18
|
+
isAsyncPending,
|
|
19
|
+
searchInputRef,
|
|
20
|
+
threshold,
|
|
21
|
+
asyncSearch,
|
|
22
|
+
filterResults,
|
|
23
|
+
visible,
|
|
24
|
+
resetSearchState,
|
|
25
|
+
defaultMinSearchLength
|
|
26
|
+
} = useBaseSearch({
|
|
27
|
+
search,
|
|
28
|
+
optionsCount,
|
|
29
|
+
defaultRenderThreshold: 10,
|
|
30
|
+
resetFocusedIndex: -1,
|
|
31
|
+
setFocusedSelectItem,
|
|
32
|
+
onReset: () => setIsSearching(false)
|
|
33
|
+
});
|
|
34
|
+
const clearFilter = () => {
|
|
35
|
+
var _a;
|
|
36
|
+
filterResults({ currentTarget: { value: "" } });
|
|
37
|
+
(_a = searchInputRef.current) == null ? void 0 : _a.focus();
|
|
29
38
|
};
|
|
30
39
|
const renderSearch = () => {
|
|
31
|
-
var
|
|
32
|
-
const filteredProps =
|
|
40
|
+
var _a, _b;
|
|
41
|
+
const filteredProps = omitProps((search == null ? void 0 : search.searchInputProps) ?? {}, /^reset$/);
|
|
33
42
|
return /* @__PURE__ */ React.createElement(
|
|
34
43
|
Input,
|
|
35
44
|
{
|
|
@@ -40,27 +49,27 @@ const useSearch = ({
|
|
|
40
49
|
onChange: filterResults,
|
|
41
50
|
className: searchInputClassName,
|
|
42
51
|
wrapperProps: {
|
|
43
|
-
className: (_b = (
|
|
52
|
+
className: (_b = (_a = search == null ? void 0 : search.searchInputProps) == null ? void 0 : _a.wrapperProps) == null ? void 0 : _b.className
|
|
44
53
|
},
|
|
45
54
|
style: {
|
|
46
|
-
display: expanded ? "
|
|
55
|
+
display: expanded ? "flex" : "none"
|
|
47
56
|
},
|
|
48
57
|
type: "text",
|
|
49
58
|
name: "search-option",
|
|
50
|
-
placeholder: (search == null ? void 0 : search.searchPlaceholder)
|
|
59
|
+
placeholder: (search == null ? void 0 : search.searchPlaceholder) ?? placeholder ?? "Search...",
|
|
60
|
+
suffix: filter ? /* @__PURE__ */ React.createElement(
|
|
61
|
+
"button",
|
|
62
|
+
{
|
|
63
|
+
type: "button",
|
|
64
|
+
className: selectClasses["search-clear-button"],
|
|
65
|
+
onClick: clearFilter,
|
|
66
|
+
"aria-label": "Clear search"
|
|
67
|
+
},
|
|
68
|
+
/* @__PURE__ */ React.createElement(Icon, { icon: Icons.Times })
|
|
69
|
+
) : void 0
|
|
51
70
|
}
|
|
52
71
|
);
|
|
53
72
|
};
|
|
54
|
-
const resetSearchState = () => {
|
|
55
|
-
setFilter("");
|
|
56
|
-
setIsSearching(false);
|
|
57
|
-
setFocusedSelectItem(-1);
|
|
58
|
-
};
|
|
59
|
-
const visible = shouldRenderSearch();
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
var _a2;
|
|
62
|
-
((_a2 = search == null ? void 0 : search.searchInputProps) == null ? void 0 : _a2.reset) && resetSearchState();
|
|
63
|
-
}, [(_a = search == null ? void 0 : search.searchInputProps) == null ? void 0 : _a.reset]);
|
|
64
73
|
useEffect(() => {
|
|
65
74
|
const searchDeactivated = !visible && !isSearching;
|
|
66
75
|
if (searchDeactivated) {
|
|
@@ -74,7 +83,10 @@ const useSearch = ({
|
|
|
74
83
|
searchThreshold: threshold,
|
|
75
84
|
searchInputRef,
|
|
76
85
|
filter,
|
|
77
|
-
isSearching
|
|
86
|
+
isSearching,
|
|
87
|
+
isAsync: !!asyncSearch,
|
|
88
|
+
isAsyncPending,
|
|
89
|
+
asyncMinSearchLength: (asyncSearch == null ? void 0 : asyncSearch.minSearchLength) ?? defaultMinSearchLength
|
|
78
90
|
};
|
|
79
91
|
};
|
|
80
92
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSearch.es.js","sources":["../../../../../src/components/Form/Select/SingleSelect/useSearch.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect,
|
|
1
|
+
{"version":3,"file":"useSearch.es.js","sources":["../../../../../src/components/Form/Select/SingleSelect/useSearch.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState } from \"react\";\nimport { SearchProps } from \"../Select.interfaces\";\nimport { Input } from \"../../Input/Input\";\nimport { omitProps } from \"../../../../util/helper\";\nimport { useBaseSearch } from \"../useBaseSearch\";\nimport { Icon, Icons } from \"../../../Icon/Icon\";\nimport classes from \"./Select.module.scss\";\n\ninterface Props {\n search?: SearchProps;\n optionsCount: number;\n searchInputClassName: string;\n expanded: boolean;\n setFocusedSelectItem: (idx: number) => void;\n placeholder?: string;\n}\n\n/** @scope .*/\nexport const useSearch = ({\n search,\n optionsCount,\n searchInputClassName,\n expanded,\n setFocusedSelectItem,\n placeholder\n}: Props) => {\n const [isSearching, setIsSearching] = useState(false);\n\n const {\n filter,\n isAsyncPending,\n searchInputRef,\n threshold,\n asyncSearch,\n filterResults,\n visible,\n resetSearchState,\n defaultMinSearchLength\n } = useBaseSearch({\n search,\n optionsCount,\n defaultRenderThreshold: 10,\n resetFocusedIndex: -1,\n setFocusedSelectItem,\n onReset: () => setIsSearching(false)\n });\n\n const clearFilter = () => {\n filterResults({ currentTarget: { value: \"\" } } as React.ChangeEvent<HTMLInputElement>);\n searchInputRef.current?.focus();\n };\n\n const renderSearch = () => {\n const filteredProps = omitProps(search?.searchInputProps ?? {}, /^reset$/);\n\n return (\n <Input\n {...filteredProps}\n ref={searchInputRef}\n onFocus={() => setIsSearching(true)}\n onBlur={() => setIsSearching(false)}\n onChange={filterResults}\n className={searchInputClassName}\n wrapperProps={{\n className: search?.searchInputProps?.wrapperProps?.className\n }}\n style={{\n display: expanded ? \"flex\" : \"none\"\n }}\n type=\"text\"\n name=\"search-option\"\n placeholder={search?.searchPlaceholder ?? placeholder ?? \"Search...\"}\n suffix={\n filter ? (\n <button\n type=\"button\"\n className={classes[\"search-clear-button\"]}\n onClick={clearFilter}\n aria-label=\"Clear search\"\n >\n <Icon icon={Icons.Times} />\n </button>\n ) : undefined\n }\n />\n );\n };\n\n useEffect(() => {\n const searchDeactivated =\n !visible &&\n !isSearching; /*solves issue in MultiSelect when we filtered result and selected result causes list to be shorter than threshold so still we have a filter applied but can't change it due to `visible` variable has false */\n if (searchDeactivated) {\n resetSearchState();\n }\n }, [isSearching, visible]);\n\n return {\n renderSearch,\n setIsSearching,\n searchVisible: visible,\n searchThreshold: threshold,\n searchInputRef,\n filter,\n isSearching,\n isAsync: !!asyncSearch,\n isAsyncPending,\n asyncMinSearchLength: asyncSearch?.minSearchLength ?? defaultMinSearchLength\n };\n};\n"],"names":["classes"],"mappings":";;;;;;AAkCO,MAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAa;AACX,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEpD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,cAAc;AAAA,IAChB;AAAA,IACA;AAAA,IACA,wBAAwB;AAAA,IACxB,mBAAmB;AAAA,IACnB;AAAA,IACA,SAAS,MAAM,eAAe,KAAK;AAAA,EAAA,CACpC;AAED,QAAM,cAAc,MAAM;;AACxB,kBAAc,EAAE,eAAe,EAAE,OAAO,GAAA,GAA6C;AACrF,yBAAe,YAAf,mBAAwB;AAAA,EAC1B;AAEA,QAAM,eAAe,MAAM;;AACzB,UAAM,gBAAgB,WAAU,iCAAQ,qBAAoB,CAAA,GAAI,SAAS;AAEzE,WACE,sBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,SAAS,MAAM,eAAe,IAAI;AAAA,QAClC,QAAQ,MAAM,eAAe,KAAK;AAAA,QAClC,UAAU;AAAA,QACV,WAAW;AAAA,QACX,cAAc;AAAA,UACZ,YAAW,4CAAQ,qBAAR,mBAA0B,iBAA1B,mBAAwC;AAAA,QAAA;AAAA,QAErD,OAAO;AAAA,UACL,SAAS,WAAW,SAAS;AAAA,QAAA;AAAA,QAE/B,MAAK;AAAA,QACL,MAAK;AAAA,QACL,cAAa,iCAAQ,sBAAqB,eAAe;AAAA,QACzD,QACE,SACE,sBAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAWA,cAAQ,qBAAqB;AAAA,YACxC,SAAS;AAAA,YACT,cAAW;AAAA,UAAA;AAAA,UAEX,sBAAA,cAAC,MAAA,EAAK,MAAM,MAAM,MAAA,CAAO;AAAA,QAAA,IAEzB;AAAA,MAAA;AAAA,IAAA;AAAA,EAIZ;AAEA,YAAU,MAAM;AACd,UAAM,oBACJ,CAAC,WACD,CAAC;AACH,QAAI,mBAAmB;AACrB,uBAAA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,OAAO,CAAC;AAEzB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,CAAC,CAAC;AAAA,IACX;AAAA,IACA,uBAAsB,2CAAa,oBAAmB;AAAA,EAAA;AAE1D;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useAddNewBtn.module.scss.cjs.js"),t=require("react");exports.useAddNewBtn=({id:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useAddNewBtn.module.scss.cjs.js"),t=require("react"),n=require("../../../util/helper.cjs.js");exports.useAddNewBtn=({id:l,addNew:s,filter:r,focusedSelectItem:a,optionsCount:u,searchInputRef:o,shouldClick:c,onClickCallback:d})=>{var i;const f=t.useRef(null),b=(null==s?void 0:s.label)??"Create new",p=a===u,m=!o.current,N="string"==typeof r&&!!r.trim()&&!!o.current,w=s&&(m||N||s.alwaysEnabled),C=n.classNames(e.default["action-button"],null==(i=null==s?void 0:s.btnProps)?void 0:i.className,{[e.default.focus]:p});return t.useEffect(()=>{var e;f.current&&p&&c&&(null==(e=f.current)||e.click())},[f.current,p,c]),{addNewBtnOptionsContainerClassName:s?e.default["has-sibling"]:"",renderAddNew:()=>w&&t.createElement("button",{"data-testid":"select-action-button",...s.btnProps,ref:f,type:"button",className:C,onClick:()=>{s.onAddNew(r),null==d||d()},id:l},!r&&b,r&&t.createElement("span",{style:{fontWeight:"700"}},`"${r}"`),r&&` (${b.toLowerCase()})`),addBtnRef:f}};
|
|
2
2
|
//# sourceMappingURL=useAddNewBtn.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAddNewBtn.cjs.js","sources":["../../../../src/components/Form/Select/useAddNewBtn.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classes from \"./useAddNewBtn.module.scss\";\n\nimport React, { RefObject, useEffect, useRef } from \"react\";\nimport { AddNewProps } from \"./Select.interfaces\";\n\ninterface Props {\n id?: string;\n addNew?: AddNewProps;\n filter: string;\n focusedSelectItem: number;\n optionsCount: number;\n searchInputRef: RefObject<HTMLInputElement>;\n shouldClick?: boolean;\n onClickCallback?: () => void;\n}\n\n/** @scope .*/\nexport const useAddNewBtn = ({\n id,\n addNew,\n filter,\n focusedSelectItem,\n optionsCount,\n searchInputRef,\n shouldClick,\n onClickCallback\n}: Props) => {\n const addBtnRef = useRef<HTMLButtonElement>(null);\n const addNewLabel = addNew?.label ?? \"Create new\";\n const isProgrammaticallyFocused = focusedSelectItem === optionsCount;\n const isSearchDisabled = !searchInputRef.current;\n const hasSearchQuery = typeof filter === \"string\" && !!filter.trim() && !!searchInputRef.current;\n const shouldRender = addNew && (isSearchDisabled || hasSearchQuery || addNew.alwaysEnabled);\n\n const additionalClasses =
|
|
1
|
+
{"version":3,"file":"useAddNewBtn.cjs.js","sources":["../../../../src/components/Form/Select/useAddNewBtn.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classes from \"./useAddNewBtn.module.scss\";\n\nimport React, { RefObject, useEffect, useRef } from \"react\";\nimport { AddNewProps } from \"./Select.interfaces\";\nimport { classNames } from \"../../../util/helper\";\n\ninterface Props {\n id?: string;\n addNew?: AddNewProps;\n filter: string;\n focusedSelectItem: number;\n optionsCount: number;\n searchInputRef: RefObject<HTMLInputElement | null>;\n shouldClick?: boolean;\n onClickCallback?: () => void;\n}\n\n/** @scope .*/\nexport const useAddNewBtn = ({\n id,\n addNew,\n filter,\n focusedSelectItem,\n optionsCount,\n searchInputRef,\n shouldClick,\n onClickCallback\n}: Props) => {\n const addBtnRef = useRef<HTMLButtonElement>(null);\n const addNewLabel = addNew?.label ?? \"Create new\";\n const isProgrammaticallyFocused = focusedSelectItem === optionsCount;\n const isSearchDisabled = !searchInputRef.current;\n const hasSearchQuery = typeof filter === \"string\" && !!filter.trim() && !!searchInputRef.current;\n const shouldRender = addNew && (isSearchDisabled || hasSearchQuery || addNew.alwaysEnabled);\n\n const additionalClasses = classNames(classes[\"action-button\"], addNew?.btnProps?.className, {\n [classes[\"focus\"]]: isProgrammaticallyFocused\n });\n\n useEffect(() => {\n const addBtnClicked = addBtnRef.current && isProgrammaticallyFocused && shouldClick;\n if (addBtnClicked) {\n addBtnRef.current?.click();\n }\n }, [addBtnRef.current, isProgrammaticallyFocused, shouldClick]);\n\n const renderAddNew = () =>\n shouldRender && (\n <button\n data-testid=\"select-action-button\"\n {...addNew.btnProps}\n ref={addBtnRef}\n type=\"button\"\n className={additionalClasses}\n onClick={() => {\n addNew.onAddNew(filter);\n onClickCallback?.();\n }}\n id={id}\n >\n {!filter && addNewLabel}\n {filter && <span style={{ fontWeight: \"700\" }}>{`\"${filter}\"`}</span>}\n {filter && ` (${addNewLabel.toLowerCase()})`}\n </button>\n );\n\n const addNewBtnOptionsContainerClassName = addNew ? classes[\"has-sibling\"] : \"\";\n\n return {\n addNewBtnOptionsContainerClassName,\n renderAddNew,\n addBtnRef\n };\n};\n"],"names":["id","addNew","filter","focusedSelectItem","optionsCount","searchInputRef","shouldClick","onClickCallback","addBtnRef","useRef","addNewLabel","label","isProgrammaticallyFocused","isSearchDisabled","current","hasSearchQuery","trim","shouldRender","alwaysEnabled","additionalClasses","classNames","classes","_a","btnProps","className","useEffect","click","addNewBtnOptionsContainerClassName","renderAddNew","React","createElement","ref","type","onClick","onAddNew","style","fontWeight","toLowerCase"],"mappings":"sNAkC4B,EAC1BA,KACAC,SACAC,SACAC,oBACAC,eACAC,iBACAC,cACAC,4BAEA,MAAMC,EAAYC,EAAAA,OAA0B,MACtCC,SAAcT,WAAQU,QAAS,aAC/BC,EAA4BT,IAAsBC,EAClDS,GAAoBR,EAAeS,QACnCC,EAAmC,iBAAXb,KAAyBA,EAAOc,UAAYX,EAAeS,QACnFG,EAAehB,IAAWY,GAAoBE,GAAkBd,EAAOiB,eAEvEC,EAAoBC,EAAAA,WAAWC,EAAAA,QAAQ,iBAAkB,OAAAC,EAAA,MAAArB,OAAA,EAAAA,EAAQsB,eAAR,EAAAD,EAAkBE,UAAW,CAC1F,CAACH,EAAAA,QAAe,OAAIT,IAgCtB,OA7BAa,EAAAA,UAAU,WACcjB,EAAUM,SAAWF,GAA6BN,IAEtE,OAAAgB,EAAAd,EAAUM,UAAVQ,EAAmBI,UAEpB,CAAClB,EAAUM,QAASF,EAA2BN,IAwB3C,CACLqB,mCAHyC1B,EAASoB,UAAQ,eAAiB,GAI3EO,aAxBmB,IACnBX,GACEY,EAAAC,cAAC,SAAA,CACC,cAAY,0BACR7B,EAAOsB,SACXQ,IAAKvB,EACLwB,KAAK,SACLR,UAAWL,EACXc,QAAS,KACPhC,EAAOiC,SAAShC,GAChB,MAAAK,GAAAA,KAEFP,OAEEE,GAAUQ,EACXR,GAAU2B,EAAAC,cAAC,OAAA,CAAKK,MAAO,CAAEC,WAAY,QAAU,IAAIlC,MACnDA,GAAU,KAAKQ,EAAY2B,kBAShC7B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import classes from "./useAddNewBtn.module.scss.es.js";
|
|
2
2
|
import React, { useRef, useEffect } from "react";
|
|
3
|
+
import { classNames } from "../../../util/helper.es.js";
|
|
3
4
|
const useAddNewBtn = ({
|
|
4
5
|
id,
|
|
5
6
|
addNew,
|
|
@@ -10,20 +11,21 @@ const useAddNewBtn = ({
|
|
|
10
11
|
shouldClick,
|
|
11
12
|
onClickCallback
|
|
12
13
|
}) => {
|
|
13
|
-
var _a
|
|
14
|
+
var _a;
|
|
14
15
|
const addBtnRef = useRef(null);
|
|
15
16
|
const addNewLabel = (addNew == null ? void 0 : addNew.label) ?? "Create new";
|
|
16
17
|
const isProgrammaticallyFocused = focusedSelectItem === optionsCount;
|
|
17
18
|
const isSearchDisabled = !searchInputRef.current;
|
|
18
19
|
const hasSearchQuery = typeof filter === "string" && !!filter.trim() && !!searchInputRef.current;
|
|
19
20
|
const shouldRender = addNew && (isSearchDisabled || hasSearchQuery || addNew.alwaysEnabled);
|
|
20
|
-
const additionalClasses =
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const additionalClasses = classNames(classes["action-button"], (_a = addNew == null ? void 0 : addNew.btnProps) == null ? void 0 : _a.className, {
|
|
22
|
+
[classes["focus"]]: isProgrammaticallyFocused
|
|
23
|
+
});
|
|
23
24
|
useEffect(() => {
|
|
25
|
+
var _a2;
|
|
24
26
|
const addBtnClicked = addBtnRef.current && isProgrammaticallyFocused && shouldClick;
|
|
25
27
|
if (addBtnClicked) {
|
|
26
|
-
addBtnRef.current.click();
|
|
28
|
+
(_a2 = addBtnRef.current) == null ? void 0 : _a2.click();
|
|
27
29
|
}
|
|
28
30
|
}, [addBtnRef.current, isProgrammaticallyFocused, shouldClick]);
|
|
29
31
|
const renderAddNew = () => shouldRender && /* @__PURE__ */ React.createElement(
|
|
@@ -33,7 +35,7 @@ const useAddNewBtn = ({
|
|
|
33
35
|
...addNew.btnProps,
|
|
34
36
|
ref: addBtnRef,
|
|
35
37
|
type: "button",
|
|
36
|
-
className: additionalClasses
|
|
38
|
+
className: additionalClasses,
|
|
37
39
|
onClick: () => {
|
|
38
40
|
addNew.onAddNew(filter);
|
|
39
41
|
onClickCallback == null ? void 0 : onClickCallback();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAddNewBtn.es.js","sources":["../../../../src/components/Form/Select/useAddNewBtn.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classes from \"./useAddNewBtn.module.scss\";\n\nimport React, { RefObject, useEffect, useRef } from \"react\";\nimport { AddNewProps } from \"./Select.interfaces\";\n\ninterface Props {\n id?: string;\n addNew?: AddNewProps;\n filter: string;\n focusedSelectItem: number;\n optionsCount: number;\n searchInputRef: RefObject<HTMLInputElement>;\n shouldClick?: boolean;\n onClickCallback?: () => void;\n}\n\n/** @scope .*/\nexport const useAddNewBtn = ({\n id,\n addNew,\n filter,\n focusedSelectItem,\n optionsCount,\n searchInputRef,\n shouldClick,\n onClickCallback\n}: Props) => {\n const addBtnRef = useRef<HTMLButtonElement>(null);\n const addNewLabel = addNew?.label ?? \"Create new\";\n const isProgrammaticallyFocused = focusedSelectItem === optionsCount;\n const isSearchDisabled = !searchInputRef.current;\n const hasSearchQuery = typeof filter === \"string\" && !!filter.trim() && !!searchInputRef.current;\n const shouldRender = addNew && (isSearchDisabled || hasSearchQuery || addNew.alwaysEnabled);\n\n const additionalClasses =
|
|
1
|
+
{"version":3,"file":"useAddNewBtn.es.js","sources":["../../../../src/components/Form/Select/useAddNewBtn.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classes from \"./useAddNewBtn.module.scss\";\n\nimport React, { RefObject, useEffect, useRef } from \"react\";\nimport { AddNewProps } from \"./Select.interfaces\";\nimport { classNames } from \"../../../util/helper\";\n\ninterface Props {\n id?: string;\n addNew?: AddNewProps;\n filter: string;\n focusedSelectItem: number;\n optionsCount: number;\n searchInputRef: RefObject<HTMLInputElement | null>;\n shouldClick?: boolean;\n onClickCallback?: () => void;\n}\n\n/** @scope .*/\nexport const useAddNewBtn = ({\n id,\n addNew,\n filter,\n focusedSelectItem,\n optionsCount,\n searchInputRef,\n shouldClick,\n onClickCallback\n}: Props) => {\n const addBtnRef = useRef<HTMLButtonElement>(null);\n const addNewLabel = addNew?.label ?? \"Create new\";\n const isProgrammaticallyFocused = focusedSelectItem === optionsCount;\n const isSearchDisabled = !searchInputRef.current;\n const hasSearchQuery = typeof filter === \"string\" && !!filter.trim() && !!searchInputRef.current;\n const shouldRender = addNew && (isSearchDisabled || hasSearchQuery || addNew.alwaysEnabled);\n\n const additionalClasses = classNames(classes[\"action-button\"], addNew?.btnProps?.className, {\n [classes[\"focus\"]]: isProgrammaticallyFocused\n });\n\n useEffect(() => {\n const addBtnClicked = addBtnRef.current && isProgrammaticallyFocused && shouldClick;\n if (addBtnClicked) {\n addBtnRef.current?.click();\n }\n }, [addBtnRef.current, isProgrammaticallyFocused, shouldClick]);\n\n const renderAddNew = () =>\n shouldRender && (\n <button\n data-testid=\"select-action-button\"\n {...addNew.btnProps}\n ref={addBtnRef}\n type=\"button\"\n className={additionalClasses}\n onClick={() => {\n addNew.onAddNew(filter);\n onClickCallback?.();\n }}\n id={id}\n >\n {!filter && addNewLabel}\n {filter && <span style={{ fontWeight: \"700\" }}>{`\"${filter}\"`}</span>}\n {filter && ` (${addNewLabel.toLowerCase()})`}\n </button>\n );\n\n const addNewBtnOptionsContainerClassName = addNew ? classes[\"has-sibling\"] : \"\";\n\n return {\n addNewBtnOptionsContainerClassName,\n renderAddNew,\n addBtnRef\n };\n};\n"],"names":["_a"],"mappings":";;;AAkCO,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAa;;AACX,QAAM,YAAY,OAA0B,IAAI;AAChD,QAAM,eAAc,iCAAQ,UAAS;AACrC,QAAM,4BAA4B,sBAAsB;AACxD,QAAM,mBAAmB,CAAC,eAAe;AACzC,QAAM,iBAAiB,OAAO,WAAW,YAAY,CAAC,CAAC,OAAO,KAAA,KAAU,CAAC,CAAC,eAAe;AACzF,QAAM,eAAe,WAAW,oBAAoB,kBAAkB,OAAO;AAE7E,QAAM,oBAAoB,WAAW,QAAQ,eAAe,IAAG,sCAAQ,aAAR,mBAAkB,WAAW;AAAA,IAC1F,CAAC,QAAQ,OAAO,CAAC,GAAG;AAAA,EAAA,CACrB;AAED,YAAU,MAAM;;AACd,UAAM,gBAAgB,UAAU,WAAW,6BAA6B;AACxE,QAAI,eAAe;AACjB,OAAAA,MAAA,UAAU,YAAV,gBAAAA,IAAmB;AAAA,IACrB;AAAA,EACF,GAAG,CAAC,UAAU,SAAS,2BAA2B,WAAW,CAAC;AAE9D,QAAM,eAAe,MACnB,gBACE,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACX,GAAG,OAAO;AAAA,MACX,KAAK;AAAA,MACL,MAAK;AAAA,MACL,WAAW;AAAA,MACX,SAAS,MAAM;AACb,eAAO,SAAS,MAAM;AACtB;AAAA,MACF;AAAA,MACA;AAAA,IAAA;AAAA,IAEC,CAAC,UAAU;AAAA,IACX,UAAU,sBAAA,cAAC,QAAA,EAAK,OAAO,EAAE,YAAY,MAAA,EAAM,GAAI,IAAI,MAAM,GAAI;AAAA,IAC7D,UAAU,KAAK,YAAY,YAAA,CAAa;AAAA,EAAA;AAI/C,QAAM,qCAAqC,SAAS,QAAQ,aAAa,IAAI;AAE7E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.useAddNewBtn_sr-
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.useAddNewBtn_sr-only_8eZbI{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.useAddNewBtn_hidden_8eZbI{display:none}.useAddNewBtn_slide-in_8eZbI{animation:useAddNewBtn_slide-in_8eZbI .5s forwards}@media(prefers-reduced-motion:reduce){.useAddNewBtn_slide-in_8eZbI{animation-duration:.1ms}}.useAddNewBtn_slide-out_8eZbI{animation:useAddNewBtn_slide-out_8eZbI .5s forwards}@media(prefers-reduced-motion:reduce){.useAddNewBtn_slide-out_8eZbI{animation-duration:.1ms}}@keyframes useAddNewBtn_slide-in_8eZbI{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes useAddNewBtn_slide-out_8eZbI{0%{transform:translateY(0)}to{transform:translateY(100vh)}}/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ul.useAddNewBtn_has-sibling_8eZbI{padding-bottom:2px}.useAddNewBtn_action-button_8eZbI{position:relative;border:none;border-top:1px solid var(--color-blue-grey50);width:100%;height:calc(2.5 * var(--font-size));padding:.625rem .75rem;margin:0 0 .25rem;background-color:var(--light);border-radius:var(--input-border-radius);color:var(--default);text-align:left;box-sizing:border-box;cursor:pointer;font-family:var(--font-family);font-size:var(--form-control-font-size)}.useAddNewBtn_action-button_8eZbI:focus,.useAddNewBtn_action-button_8eZbI.useAddNewBtn_focus_8eZbI{outline:none}.useAddNewBtn_action-button_8eZbI:focus:before,.useAddNewBtn_action-button_8eZbI.useAddNewBtn_focus_8eZbI:before{outline:calc(.125 * var(--font-size)) solid var(--color-focus);outline-offset:0;border-radius:var(--focus-border-radius);content:"";position:absolute;top:0;left:.125rem;height:100%;width:calc(100% - .25rem);opacity:1;z-index:101}.useAddNewBtn_action-button_8eZbI:hover{background-color:var(--color-blue-grey50)}.useAddNewBtn_action-button_8eZbI:active{background-color:var(--color-blue-grey100)}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="useAddNewBtn_focus_8eZbI",t={"has-sibling":"useAddNewBtn_has-sibling_8eZbI","action-button":"useAddNewBtn_action-button_8eZbI",focus:e};exports.default=t,exports.focus=e;
|
|
3
3
|
//# sourceMappingURL=useAddNewBtn.module.scss.cjs.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.useAddNewBtn_sr-
|
|
2
|
-
const focus = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.useAddNewBtn_sr-only_8eZbI{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.useAddNewBtn_hidden_8eZbI{display:none}.useAddNewBtn_slide-in_8eZbI{animation:useAddNewBtn_slide-in_8eZbI .5s forwards}@media(prefers-reduced-motion:reduce){.useAddNewBtn_slide-in_8eZbI{animation-duration:.1ms}}.useAddNewBtn_slide-out_8eZbI{animation:useAddNewBtn_slide-out_8eZbI .5s forwards}@media(prefers-reduced-motion:reduce){.useAddNewBtn_slide-out_8eZbI{animation-duration:.1ms}}@keyframes useAddNewBtn_slide-in_8eZbI{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes useAddNewBtn_slide-out_8eZbI{0%{transform:translateY(0)}to{transform:translateY(100vh)}}/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ul.useAddNewBtn_has-sibling_8eZbI{padding-bottom:2px}.useAddNewBtn_action-button_8eZbI{position:relative;border:none;border-top:1px solid var(--color-blue-grey50);width:100%;height:calc(2.5 * var(--font-size));padding:.625rem .75rem;margin:0 0 .25rem;background-color:var(--light);border-radius:var(--input-border-radius);color:var(--default);text-align:left;box-sizing:border-box;cursor:pointer;font-family:var(--font-family);font-size:var(--form-control-font-size)}.useAddNewBtn_action-button_8eZbI:focus,.useAddNewBtn_action-button_8eZbI.useAddNewBtn_focus_8eZbI{outline:none}.useAddNewBtn_action-button_8eZbI:focus:before,.useAddNewBtn_action-button_8eZbI.useAddNewBtn_focus_8eZbI:before{outline:calc(.125 * var(--font-size)) solid var(--color-focus);outline-offset:0;border-radius:var(--focus-border-radius);content:"";position:absolute;top:0;left:.125rem;height:100%;width:calc(100% - .25rem);opacity:1;z-index:101}.useAddNewBtn_action-button_8eZbI:hover{background-color:var(--color-blue-grey50)}.useAddNewBtn_action-button_8eZbI:active{background-color:var(--color-blue-grey100)}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
const focus = "useAddNewBtn_focus_8eZbI";
|
|
3
3
|
const classes = {
|
|
4
|
-
"has-sibling": "useAddNewBtn_has-
|
|
5
|
-
"action-button": "useAddNewBtn_action-
|
|
4
|
+
"has-sibling": "useAddNewBtn_has-sibling_8eZbI",
|
|
5
|
+
"action-button": "useAddNewBtn_action-button_8eZbI",
|
|
6
6
|
focus
|
|
7
7
|
};
|
|
8
8
|
export {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),n=require("../../../hooks/useDebouncedCallback.cjs.js");exports.useBaseSearch=({search:l,optionsCount:s,defaultRenderThreshold:t,resetFocusedIndex:r,setFocusedSelectItem:u,onReset:o})=>{var a;const[c,d]=e.useState(""),[i,h]=e.useState(!1),v=e.useRef(null),S=(null==l?void 0:l.renderThreshold)??t,p=s>=S,b=null==l?void 0:l.async,f=n.useDebouncedCallback(e=>{h(!1),null==b||b.onSearch(e)},(null==b?void 0:b.debounceTime)??300,[null==b?void 0:b.onSearch]),g=()=>{d(""),h(!1),u(r),null==o||o()},I=!!b||((null==l?void 0:l.enabled)?p:l?l.enabled:s>t);return e.useEffect(()=>{var e;(null==(e=null==l?void 0:l.searchInputProps)?void 0:e.reset)&&g()},[null==(a=null==l?void 0:l.searchInputProps)?void 0:a.reset]),{filter:c,setFilter:d,isAsyncPending:i,setIsAsyncPending:h,searchInputRef:v,threshold:S,asyncSearch:b,filterResults:e=>{var n,s;null==(s=null==(n=null==l?void 0:l.searchInputProps)?void 0:n.onChange)||s.call(n,e);const t=e.currentTarget.value;if(d(t),b){const e=t.length>=(b.minSearchLength??0);h(e),e?f(t):f.cancel()}},visible:I,resetSearchState:g,defaultMinSearchLength:0}};
|
|
2
|
+
//# sourceMappingURL=useBaseSearch.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBaseSearch.cjs.js","sources":["../../../../src/components/Form/Select/useBaseSearch.ts"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { SearchProps } from \"./Select.interfaces\";\nimport { useDebouncedCallback } from \"../../../hooks/useDebouncedCallback\";\n\nexport interface BaseSearchProps {\n search?: SearchProps;\n optionsCount: number;\n defaultRenderThreshold: number;\n resetFocusedIndex: number;\n setFocusedSelectItem: (idx: number) => void;\n onReset?: () => void;\n}\n\nexport const useBaseSearch = ({\n search,\n optionsCount,\n defaultRenderThreshold,\n resetFocusedIndex,\n setFocusedSelectItem,\n onReset\n}: BaseSearchProps) => {\n const [filter, setFilter] = useState(\"\");\n const [isAsyncPending, setIsAsyncPending] = useState(false);\n\n const DEFAULT_DEBOUNCE_TIME = 300;\n const DEFAULT_MIN_SEARCH_LENGTH = 0;\n\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n const threshold = search?.renderThreshold ?? defaultRenderThreshold;\n const hasEnoughChildren = optionsCount >= threshold;\n const asyncSearch = search?.async;\n\n const debouncedOnSearch = useDebouncedCallback(\n (query: string) => {\n setIsAsyncPending(false);\n asyncSearch?.onSearch(query);\n },\n asyncSearch?.debounceTime ?? DEFAULT_DEBOUNCE_TIME,\n [asyncSearch?.onSearch]\n );\n\n const filterResults = (event: React.ChangeEvent<HTMLInputElement>) => {\n search?.searchInputProps?.onChange?.(event);\n\n const query = event.currentTarget.value;\n setFilter(query);\n\n if (asyncSearch) {\n const meetsMinLength =\n query.length >= (asyncSearch.minSearchLength ?? DEFAULT_MIN_SEARCH_LENGTH);\n setIsAsyncPending(meetsMinLength);\n\n if (meetsMinLength) {\n debouncedOnSearch(query);\n } else {\n debouncedOnSearch.cancel();\n }\n }\n };\n\n const shouldRenderSearch = () => {\n if (asyncSearch) {\n return true;\n }\n\n if (search?.enabled) {\n return hasEnoughChildren;\n }\n\n if (search) {\n return search.enabled as boolean;\n }\n\n return optionsCount > defaultRenderThreshold;\n };\n\n const resetSearchState = () => {\n setFilter(\"\");\n setIsAsyncPending(false);\n setFocusedSelectItem(resetFocusedIndex);\n onReset?.();\n };\n\n const visible = shouldRenderSearch();\n\n useEffect(() => {\n if (search?.searchInputProps?.reset) {\n resetSearchState();\n }\n }, [search?.searchInputProps?.reset]);\n\n return {\n filter,\n setFilter,\n isAsyncPending,\n setIsAsyncPending,\n searchInputRef,\n threshold,\n asyncSearch,\n filterResults,\n visible,\n resetSearchState,\n defaultMinSearchLength: DEFAULT_MIN_SEARCH_LENGTH\n };\n};\n"],"names":["search","optionsCount","defaultRenderThreshold","resetFocusedIndex","setFocusedSelectItem","onReset","filter","setFilter","useState","isAsyncPending","setIsAsyncPending","searchInputRef","useRef","threshold","renderThreshold","hasEnoughChildren","asyncSearch","async","debouncedOnSearch","useDebouncedCallback","query","onSearch","debounceTime","resetSearchState","visible","enabled","useEffect","_a","searchInputProps","reset","filterResults","event","_b","onChange","currentTarget","value","meetsMinLength","length","minSearchLength","cancel","defaultMinSearchLength"],"mappings":"uLA6B6B,EAC3BA,SACAC,eACAC,yBACAC,oBACAC,uBACAC,oBAEA,MAAOC,EAAQC,GAAaC,EAAAA,SAAS,KAC9BC,EAAgBC,GAAqBF,EAAAA,UAAS,GAK/CG,EAAiBC,EAAAA,OAAyB,MAE1CC,SAAYb,WAAQc,kBAAmBZ,EACvCa,EAAoBd,GAAgBY,EACpCG,EAAc,MAAAhB,OAAA,EAAAA,EAAQiB,MAEtBC,EAAoBC,EAAAA,qBACvBC,IACCV,GAAkB,GAClB,MAAAM,GAAAA,EAAaK,SAASD,WAExBJ,WAAaM,eAde,IAe5B,OAACN,WAAaK,WAsCVE,EAAmB,KACvBhB,EAAU,IACVG,GAAkB,GAClBN,EAAqBD,GACrB,MAAAE,GAAAA,KAGImB,IAtBAR,WAIAhB,WAAQyB,SACHV,EAGLf,EACKA,EAAOyB,QAGTxB,EAAeC,GAkBxB,OANAwB,EAAAA,UAAU,YACJ,OAAAC,EAAA,MAAA3B,OAAA,EAAAA,EAAQ4B,uBAAR,EAAAD,EAA0BE,QAC5BN,KAED,CAAC,OAAAI,EAAA,MAAA3B,OAAA,EAAAA,EAAQ4B,uBAAR,EAAAD,EAA0BE,QAEvB,CACLvB,SACAC,YACAE,iBACAC,oBACAC,iBACAE,YACAG,cACAc,cA1DqBC,YACrB,OAAAC,EAAA,OAAAL,EAAA,MAAA3B,OAAA,EAAAA,EAAQ4B,yBAARD,EAA0BM,kBAA1BN,EAAqCI,GAErC,MAAMX,EAAQW,EAAMG,cAAcC,MAGlC,GAFA5B,EAAUa,GAENJ,EAAa,CACf,MAAMoB,EACJhB,EAAMiB,SAAWrB,EAAYsB,iBAzBD,GA0B9B5B,EAAkB0B,GAEdA,EACFlB,EAAkBE,GAElBF,EAAkBqB,QAEtB,GA2CAf,UACAD,mBACAiB,uBA9EgC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useState, useRef, useEffect } from "react";
|
|
2
|
+
import { useDebouncedCallback } from "../../../hooks/useDebouncedCallback.es.js";
|
|
3
|
+
const useBaseSearch = ({
|
|
4
|
+
search,
|
|
5
|
+
optionsCount,
|
|
6
|
+
defaultRenderThreshold,
|
|
7
|
+
resetFocusedIndex,
|
|
8
|
+
setFocusedSelectItem,
|
|
9
|
+
onReset
|
|
10
|
+
}) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const [filter, setFilter] = useState("");
|
|
13
|
+
const [isAsyncPending, setIsAsyncPending] = useState(false);
|
|
14
|
+
const DEFAULT_DEBOUNCE_TIME = 300;
|
|
15
|
+
const DEFAULT_MIN_SEARCH_LENGTH = 0;
|
|
16
|
+
const searchInputRef = useRef(null);
|
|
17
|
+
const threshold = (search == null ? void 0 : search.renderThreshold) ?? defaultRenderThreshold;
|
|
18
|
+
const hasEnoughChildren = optionsCount >= threshold;
|
|
19
|
+
const asyncSearch = search == null ? void 0 : search.async;
|
|
20
|
+
const debouncedOnSearch = useDebouncedCallback(
|
|
21
|
+
(query) => {
|
|
22
|
+
setIsAsyncPending(false);
|
|
23
|
+
asyncSearch == null ? void 0 : asyncSearch.onSearch(query);
|
|
24
|
+
},
|
|
25
|
+
(asyncSearch == null ? void 0 : asyncSearch.debounceTime) ?? DEFAULT_DEBOUNCE_TIME,
|
|
26
|
+
[asyncSearch == null ? void 0 : asyncSearch.onSearch]
|
|
27
|
+
);
|
|
28
|
+
const filterResults = (event) => {
|
|
29
|
+
var _a2, _b;
|
|
30
|
+
(_b = (_a2 = search == null ? void 0 : search.searchInputProps) == null ? void 0 : _a2.onChange) == null ? void 0 : _b.call(_a2, event);
|
|
31
|
+
const query = event.currentTarget.value;
|
|
32
|
+
setFilter(query);
|
|
33
|
+
if (asyncSearch) {
|
|
34
|
+
const meetsMinLength = query.length >= (asyncSearch.minSearchLength ?? DEFAULT_MIN_SEARCH_LENGTH);
|
|
35
|
+
setIsAsyncPending(meetsMinLength);
|
|
36
|
+
if (meetsMinLength) {
|
|
37
|
+
debouncedOnSearch(query);
|
|
38
|
+
} else {
|
|
39
|
+
debouncedOnSearch.cancel();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const shouldRenderSearch = () => {
|
|
44
|
+
if (asyncSearch) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
if (search == null ? void 0 : search.enabled) {
|
|
48
|
+
return hasEnoughChildren;
|
|
49
|
+
}
|
|
50
|
+
if (search) {
|
|
51
|
+
return search.enabled;
|
|
52
|
+
}
|
|
53
|
+
return optionsCount > defaultRenderThreshold;
|
|
54
|
+
};
|
|
55
|
+
const resetSearchState = () => {
|
|
56
|
+
setFilter("");
|
|
57
|
+
setIsAsyncPending(false);
|
|
58
|
+
setFocusedSelectItem(resetFocusedIndex);
|
|
59
|
+
onReset == null ? void 0 : onReset();
|
|
60
|
+
};
|
|
61
|
+
const visible = shouldRenderSearch();
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
var _a2;
|
|
64
|
+
if ((_a2 = search == null ? void 0 : search.searchInputProps) == null ? void 0 : _a2.reset) {
|
|
65
|
+
resetSearchState();
|
|
66
|
+
}
|
|
67
|
+
}, [(_a = search == null ? void 0 : search.searchInputProps) == null ? void 0 : _a.reset]);
|
|
68
|
+
return {
|
|
69
|
+
filter,
|
|
70
|
+
setFilter,
|
|
71
|
+
isAsyncPending,
|
|
72
|
+
setIsAsyncPending,
|
|
73
|
+
searchInputRef,
|
|
74
|
+
threshold,
|
|
75
|
+
asyncSearch,
|
|
76
|
+
filterResults,
|
|
77
|
+
visible,
|
|
78
|
+
resetSearchState,
|
|
79
|
+
defaultMinSearchLength: DEFAULT_MIN_SEARCH_LENGTH
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
useBaseSearch
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=useBaseSearch.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBaseSearch.es.js","sources":["../../../../src/components/Form/Select/useBaseSearch.ts"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { SearchProps } from \"./Select.interfaces\";\nimport { useDebouncedCallback } from \"../../../hooks/useDebouncedCallback\";\n\nexport interface BaseSearchProps {\n search?: SearchProps;\n optionsCount: number;\n defaultRenderThreshold: number;\n resetFocusedIndex: number;\n setFocusedSelectItem: (idx: number) => void;\n onReset?: () => void;\n}\n\nexport const useBaseSearch = ({\n search,\n optionsCount,\n defaultRenderThreshold,\n resetFocusedIndex,\n setFocusedSelectItem,\n onReset\n}: BaseSearchProps) => {\n const [filter, setFilter] = useState(\"\");\n const [isAsyncPending, setIsAsyncPending] = useState(false);\n\n const DEFAULT_DEBOUNCE_TIME = 300;\n const DEFAULT_MIN_SEARCH_LENGTH = 0;\n\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n const threshold = search?.renderThreshold ?? defaultRenderThreshold;\n const hasEnoughChildren = optionsCount >= threshold;\n const asyncSearch = search?.async;\n\n const debouncedOnSearch = useDebouncedCallback(\n (query: string) => {\n setIsAsyncPending(false);\n asyncSearch?.onSearch(query);\n },\n asyncSearch?.debounceTime ?? DEFAULT_DEBOUNCE_TIME,\n [asyncSearch?.onSearch]\n );\n\n const filterResults = (event: React.ChangeEvent<HTMLInputElement>) => {\n search?.searchInputProps?.onChange?.(event);\n\n const query = event.currentTarget.value;\n setFilter(query);\n\n if (asyncSearch) {\n const meetsMinLength =\n query.length >= (asyncSearch.minSearchLength ?? DEFAULT_MIN_SEARCH_LENGTH);\n setIsAsyncPending(meetsMinLength);\n\n if (meetsMinLength) {\n debouncedOnSearch(query);\n } else {\n debouncedOnSearch.cancel();\n }\n }\n };\n\n const shouldRenderSearch = () => {\n if (asyncSearch) {\n return true;\n }\n\n if (search?.enabled) {\n return hasEnoughChildren;\n }\n\n if (search) {\n return search.enabled as boolean;\n }\n\n return optionsCount > defaultRenderThreshold;\n };\n\n const resetSearchState = () => {\n setFilter(\"\");\n setIsAsyncPending(false);\n setFocusedSelectItem(resetFocusedIndex);\n onReset?.();\n };\n\n const visible = shouldRenderSearch();\n\n useEffect(() => {\n if (search?.searchInputProps?.reset) {\n resetSearchState();\n }\n }, [search?.searchInputProps?.reset]);\n\n return {\n filter,\n setFilter,\n isAsyncPending,\n setIsAsyncPending,\n searchInputRef,\n threshold,\n asyncSearch,\n filterResults,\n visible,\n resetSearchState,\n defaultMinSearchLength: DEFAULT_MIN_SEARCH_LENGTH\n };\n};\n"],"names":["_a"],"mappings":";;AA6BO,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAuB;;AACrB,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,EAAE;AACvC,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAE1D,QAAM,wBAAwB;AAC9B,QAAM,4BAA4B;AAElC,QAAM,iBAAiB,OAAyB,IAAI;AAEpD,QAAM,aAAY,iCAAQ,oBAAmB;AAC7C,QAAM,oBAAoB,gBAAgB;AAC1C,QAAM,cAAc,iCAAQ;AAE5B,QAAM,oBAAoB;AAAA,IACxB,CAAC,UAAkB;AACjB,wBAAkB,KAAK;AACvB,iDAAa,SAAS;AAAA,IACxB;AAAA,KACA,2CAAa,iBAAgB;AAAA,IAC7B,CAAC,2CAAa,QAAQ;AAAA,EAAA;AAGxB,QAAM,gBAAgB,CAAC,UAA+C;;AACpE,WAAAA,MAAA,iCAAQ,qBAAR,gBAAAA,IAA0B,aAA1B,wBAAAA,KAAqC;AAErC,UAAM,QAAQ,MAAM,cAAc;AAClC,cAAU,KAAK;AAEf,QAAI,aAAa;AACf,YAAM,iBACJ,MAAM,WAAW,YAAY,mBAAmB;AAClD,wBAAkB,cAAc;AAEhC,UAAI,gBAAgB;AAClB,0BAAkB,KAAK;AAAA,MACzB,OAAO;AACL,0BAAkB,OAAA;AAAA,MACpB;AAAA,IACF;AAAA,EACF;AAEA,QAAM,qBAAqB,MAAM;AAC/B,QAAI,aAAa;AACf,aAAO;AAAA,IACT;AAEA,QAAI,iCAAQ,SAAS;AACnB,aAAO;AAAA,IACT;AAEA,QAAI,QAAQ;AACV,aAAO,OAAO;AAAA,IAChB;AAEA,WAAO,eAAe;AAAA,EACxB;AAEA,QAAM,mBAAmB,MAAM;AAC7B,cAAU,EAAE;AACZ,sBAAkB,KAAK;AACvB,yBAAqB,iBAAiB;AACtC;AAAA,EACF;AAEA,QAAM,UAAU,mBAAA;AAEhB,YAAU,MAAM;;AACd,SAAIA,MAAA,iCAAQ,qBAAR,gBAAAA,IAA0B,OAAO;AACnC,uBAAA;AAAA,IACF;AAAA,EACF,GAAG,EAAC,sCAAQ,qBAAR,mBAA0B,KAAK,CAAC;AAEpC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,wBAAwB;AAAA,EAAA;AAE5B;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),e=require("./Select.interfaces.cjs.js");exports.useSelectPositionList=({expanded:n,optionListReference:i,addBtnRef:o,containerReference:r})=>{const[s,c]=t.useState({wrapper:void 0,list:void 0}),[u,l]=t.useState(0),[d,g]=t.useState(e.Position.Below);t.useEffect(()=>{
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),e=require("./Select.interfaces.cjs.js");exports.useSelectPositionList=({expanded:n,optionListReference:i,addBtnRef:o,containerReference:r})=>{const[s,c]=t.useState({wrapper:void 0,list:void 0}),[u,l]=t.useState(0),[d,g]=t.useState(e.Position.Below);t.useEffect(()=>{a()},[n]);const p=()=>o.current?o.current.getBoundingClientRect().height+Number.parseInt(getComputedStyle(o.current).marginBottom):0,a=()=>{var t;if(!n||!i.current||!r.current)return;const o=null==(t=i.current)?void 0:t.getBoundingClientRect().height,s=r.current.getBoundingClientRect(),c=p(),u=s.top-0,l=window.innerHeight-s.bottom-0,d=o+c,a=d<=u;let v;v=d<=l?e.Position.Below:a||u>l?e.Position.Above:e.Position.Below,g(v),B(v)},B=t=>{var n;const o=null==(n=i.current)?void 0:n.getBoundingClientRect().height,s=p(),u=t===e.Position.Below?"top":"bottom";if(!r.current)return;const d="top"===u?window.innerHeight-r.current.getBoundingClientRect().bottom-0:r.current.getBoundingClientRect().top-0;if(o&&d<o+s)return c({wrapper:`${d}px`,list:s>0?d-s+"px":"none"}),void l(100);c({wrapper:void 0,list:void 0}),l(100)};return{optionsListMaxHeight:s,opacity:u,setOpacity:l,listPosition:d,setListPosition:g}};
|
|
2
2
|
//# sourceMappingURL=useSelectPositionList.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectPositionList.cjs.js","sources":["../../../../src/components/Form/Select/useSelectPositionList.ts"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from \"react\";\nimport { Position, UseSelectPositionListParams } from \"./Select.interfaces\";\n\n/** @scope .*/\nexport const useSelectPositionList = ({\n expanded,\n optionListReference,\n addBtnRef,\n containerReference\n}: UseSelectPositionListParams) => {\n const [optionsListMaxHeight, setOptionsListMaxHeight] = useState<{\n wrapper?: string;\n list?: string;\n }>({\n wrapper: undefined,\n list: undefined\n });\n const [opacity, setOpacity] = useState(0); // We set opacity because otherwise if we calculate the max height you see the list full height for a split second and then it shortens.\n const [listPosition, setListPosition] = useState<Position>(Position.Below);\n\n useEffect(() => {\n rePositionList();\n }, [expanded]);\n\n const rePositionList = () => {\n if (!expanded || !optionListReference.current || !containerReference.current) {\n return;\n }\n\n const listHeight = optionListReference.current?.getBoundingClientRect().height;\n\n const viewportRelativeRect = containerReference.current.getBoundingClientRect();\n\n const spaceOnTopOfSelect = viewportRelativeRect.top;\n const spaceOnBottomOfSelect
|
|
1
|
+
{"version":3,"file":"useSelectPositionList.cjs.js","sources":["../../../../src/components/Form/Select/useSelectPositionList.ts"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from \"react\";\nimport { Position, UseSelectPositionListParams } from \"./Select.interfaces\";\n\n/** @scope .*/\nexport const useSelectPositionList = ({\n expanded,\n optionListReference,\n addBtnRef,\n containerReference\n}: UseSelectPositionListParams) => {\n const [optionsListMaxHeight, setOptionsListMaxHeight] = useState<{\n wrapper?: string;\n list?: string;\n }>({\n wrapper: undefined,\n list: undefined\n });\n const [opacity, setOpacity] = useState(0); // We set opacity because otherwise if we calculate the max height you see the list full height for a split second and then it shortens.\n const [listPosition, setListPosition] = useState<Position>(Position.Below);\n\n useEffect(() => {\n rePositionList();\n }, [expanded]);\n\n // Must be identical in the fit check and the max-height cap below, otherwise a\n // list deemed to \"fit\" on a side can still get capped there with a scrollbar.\n const VIEWPORT_MARGIN = 0;\n\n const getAddNewButtonHeightWithMargin = () =>\n addBtnRef.current\n ? addBtnRef.current.getBoundingClientRect().height +\n Number.parseInt(getComputedStyle(addBtnRef.current).marginBottom)\n : 0;\n\n const rePositionList = () => {\n if (!expanded || !optionListReference.current || !containerReference.current) {\n return;\n }\n\n const listHeight = optionListReference.current?.getBoundingClientRect().height;\n\n const viewportRelativeRect = containerReference.current.getBoundingClientRect();\n\n const addNewButtonHeightWithMargin = getAddNewButtonHeightWithMargin();\n\n const spaceOnTopOfSelect = viewportRelativeRect.top - VIEWPORT_MARGIN;\n const spaceOnBottomOfSelect =\n window.innerHeight - viewportRelativeRect.bottom - VIEWPORT_MARGIN;\n\n const requiredHeight = listHeight + addNewButtonHeightWithMargin;\n const fitsBelow = requiredHeight <= spaceOnBottomOfSelect;\n const fitsAbove = requiredHeight <= spaceOnTopOfSelect;\n\n let position: Position;\n if (fitsBelow) {\n position = Position.Below;\n } else if (fitsAbove) {\n position = Position.Above;\n } else {\n position = spaceOnTopOfSelect > spaceOnBottomOfSelect ? Position.Above : Position.Below;\n }\n\n setListPosition(position);\n\n // Calculate the potential max height of the options list\n calculateOptionListMaxHeight(position);\n };\n\n const calculateOptionListMaxHeight = (position: Position) => {\n // Calculate max height if there's more space below the select\n const listHeight = optionListReference.current?.getBoundingClientRect().height;\n const addNewButtonHeightWithMargin = getAddNewButtonHeightWithMargin();\n const transformOrigin = position === Position.Below ? \"top\" : \"bottom\";\n\n if (!containerReference.current) {\n console.error(\n \"The containerReference is empty for some reason in the SelectService.ts for the Select component in react-lib-components. We are trying to calculate the option list max height on expand\"\n );\n return;\n }\n\n const availableSpace =\n transformOrigin === \"top\"\n ? window.innerHeight -\n containerReference.current.getBoundingClientRect().bottom -\n VIEWPORT_MARGIN\n : containerReference.current.getBoundingClientRect().top - VIEWPORT_MARGIN;\n\n if (listHeight && availableSpace < listHeight + addNewButtonHeightWithMargin) {\n const maxHeightObject = {\n wrapper: `${availableSpace}px`,\n list:\n addNewButtonHeightWithMargin > 0\n ? `${availableSpace - addNewButtonHeightWithMargin}px`\n : \"none\"\n };\n setOptionsListMaxHeight(maxHeightObject);\n setOpacity(100);\n return;\n }\n\n setOptionsListMaxHeight({ wrapper: undefined, list: undefined });\n setOpacity(100);\n };\n\n return {\n optionsListMaxHeight,\n opacity,\n setOpacity,\n listPosition,\n setListPosition\n };\n};\n"],"names":["expanded","optionListReference","addBtnRef","containerReference","optionsListMaxHeight","setOptionsListMaxHeight","useState","wrapper","list","opacity","setOpacity","listPosition","setListPosition","Position","Below","useEffect","rePositionList","getAddNewButtonHeightWithMargin","current","getBoundingClientRect","height","Number","parseInt","getComputedStyle","marginBottom","listHeight","_a","viewportRelativeRect","addNewButtonHeightWithMargin","spaceOnTopOfSelect","top","spaceOnBottomOfSelect","window","innerHeight","bottom","requiredHeight","fitsAbove","position","Above","calculateOptionListMaxHeight","transformOrigin","availableSpace"],"mappings":"+KAoBqC,EACnCA,WACAC,sBACAC,YACAC,yBAEA,MAAOC,EAAsBC,GAA2BC,WAGrD,CACDC,aAAS,EACTC,UAAM,KAEDC,EAASC,GAAcJ,EAAAA,SAAS,IAChCK,EAAcC,GAAmBN,EAAAA,SAAmBO,EAAAA,SAASC,OAEpEC,EAAAA,UAAU,KACRC,KACC,CAAChB,IAIJ,MAEMiB,EAAkC,IACtCf,EAAUgB,QACNhB,EAAUgB,QAAQC,wBAAwBC,OAC1CC,OAAOC,SAASC,iBAAiBrB,EAAUgB,SAASM,cACpD,EAEAR,EAAiB,WACrB,IAAKhB,IAAaC,EAAoBiB,UAAYf,EAAmBe,QACnE,OAGF,MAAMO,EAAa,OAAAC,EAAAzB,EAAoBiB,cAApB,EAAAQ,EAA6BP,wBAAwBC,OAElEO,EAAuBxB,EAAmBe,QAAQC,wBAElDS,EAA+BX,IAE/BY,EAAqBF,EAAqBG,IAnB1B,EAoBhBC,EACJC,OAAOC,YAAcN,EAAqBO,OArBtB,EAuBhBC,EAAiBV,EAAaG,EAE9BQ,EAAYD,GAAkBN,EAEpC,IAAIQ,EAEFA,EALgBF,GAAkBJ,EAKvBlB,EAAAA,SAASC,MACXsB,GAGEP,EAAqBE,EAFrBlB,EAAAA,SAASyB,MAEqDzB,EAAAA,SAASC,MAGpFF,EAAgByB,GAGhBE,EAA6BF,IAGzBE,EAAgCF,UAEpC,MAAMZ,EAAa,OAAAC,EAAAzB,EAAoBiB,cAApB,EAAAQ,EAA6BP,wBAAwBC,OAClEQ,EAA+BX,IAC/BuB,EAAkBH,IAAaxB,EAAAA,SAASC,MAAQ,MAAQ,SAE9D,IAAKX,EAAmBe,QAItB,OAGF,MAAMuB,EACgB,QAApBD,EACIR,OAAOC,YACP9B,EAAmBe,QAAQC,wBAAwBe,OA1DnC,EA4DhB/B,EAAmBe,QAAQC,wBAAwBW,IA5DnC,EA8DtB,GAAIL,GAAcgB,EAAiBhB,EAAaG,EAU9C,OAFAvB,EAPwB,CACtBE,QAAS,GAAGkC,MACZjC,KACEoB,EAA+B,EACxBa,EAAiBb,EAApB,KACA,cAGRlB,EAAW,KAIbL,EAAwB,CAAEE,aAAS,EAAWC,cAC9CE,EAAW,MAGb,MAAO,CACLN,uBACAK,UACAC,aACAC,eACAC"}
|
|
@@ -15,6 +15,8 @@ const useSelectPositionList = ({
|
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
rePositionList();
|
|
17
17
|
}, [expanded]);
|
|
18
|
+
const VIEWPORT_MARGIN = 0;
|
|
19
|
+
const getAddNewButtonHeightWithMargin = () => addBtnRef.current ? addBtnRef.current.getBoundingClientRect().height + Number.parseInt(getComputedStyle(addBtnRef.current).marginBottom) : 0;
|
|
18
20
|
const rePositionList = () => {
|
|
19
21
|
var _a;
|
|
20
22
|
if (!expanded || !optionListReference.current || !containerReference.current) {
|
|
@@ -22,16 +24,27 @@ const useSelectPositionList = ({
|
|
|
22
24
|
}
|
|
23
25
|
const listHeight = (_a = optionListReference.current) == null ? void 0 : _a.getBoundingClientRect().height;
|
|
24
26
|
const viewportRelativeRect = containerReference.current.getBoundingClientRect();
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
27
|
+
const addNewButtonHeightWithMargin = getAddNewButtonHeightWithMargin();
|
|
28
|
+
const spaceOnTopOfSelect = viewportRelativeRect.top - VIEWPORT_MARGIN;
|
|
29
|
+
const spaceOnBottomOfSelect = window.innerHeight - viewportRelativeRect.bottom - VIEWPORT_MARGIN;
|
|
30
|
+
const requiredHeight = listHeight + addNewButtonHeightWithMargin;
|
|
31
|
+
const fitsBelow = requiredHeight <= spaceOnBottomOfSelect;
|
|
32
|
+
const fitsAbove = requiredHeight <= spaceOnTopOfSelect;
|
|
33
|
+
let position;
|
|
34
|
+
if (fitsBelow) {
|
|
35
|
+
position = Position.Below;
|
|
36
|
+
} else if (fitsAbove) {
|
|
37
|
+
position = Position.Above;
|
|
38
|
+
} else {
|
|
39
|
+
position = spaceOnTopOfSelect > spaceOnBottomOfSelect ? Position.Above : Position.Below;
|
|
40
|
+
}
|
|
28
41
|
setListPosition(position);
|
|
29
42
|
calculateOptionListMaxHeight(position);
|
|
30
43
|
};
|
|
31
44
|
const calculateOptionListMaxHeight = (position) => {
|
|
32
45
|
var _a;
|
|
33
46
|
const listHeight = (_a = optionListReference.current) == null ? void 0 : _a.getBoundingClientRect().height;
|
|
34
|
-
const addNewButtonHeightWithMargin =
|
|
47
|
+
const addNewButtonHeightWithMargin = getAddNewButtonHeightWithMargin();
|
|
35
48
|
const transformOrigin = position === Position.Below ? "top" : "bottom";
|
|
36
49
|
if (!containerReference.current) {
|
|
37
50
|
console.error(
|
|
@@ -39,7 +52,7 @@ const useSelectPositionList = ({
|
|
|
39
52
|
);
|
|
40
53
|
return;
|
|
41
54
|
}
|
|
42
|
-
const availableSpace = transformOrigin === "top" ? window.innerHeight - containerReference.current.getBoundingClientRect().bottom -
|
|
55
|
+
const availableSpace = transformOrigin === "top" ? window.innerHeight - containerReference.current.getBoundingClientRect().bottom - VIEWPORT_MARGIN : containerReference.current.getBoundingClientRect().top - VIEWPORT_MARGIN;
|
|
43
56
|
if (listHeight && availableSpace < listHeight + addNewButtonHeightWithMargin) {
|
|
44
57
|
const maxHeightObject = {
|
|
45
58
|
wrapper: `${availableSpace}px`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectPositionList.es.js","sources":["../../../../src/components/Form/Select/useSelectPositionList.ts"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from \"react\";\nimport { Position, UseSelectPositionListParams } from \"./Select.interfaces\";\n\n/** @scope .*/\nexport const useSelectPositionList = ({\n expanded,\n optionListReference,\n addBtnRef,\n containerReference\n}: UseSelectPositionListParams) => {\n const [optionsListMaxHeight, setOptionsListMaxHeight] = useState<{\n wrapper?: string;\n list?: string;\n }>({\n wrapper: undefined,\n list: undefined\n });\n const [opacity, setOpacity] = useState(0); // We set opacity because otherwise if we calculate the max height you see the list full height for a split second and then it shortens.\n const [listPosition, setListPosition] = useState<Position>(Position.Below);\n\n useEffect(() => {\n rePositionList();\n }, [expanded]);\n\n const rePositionList = () => {\n if (!expanded || !optionListReference.current || !containerReference.current) {\n return;\n }\n\n const listHeight = optionListReference.current?.getBoundingClientRect().height;\n\n const viewportRelativeRect = containerReference.current.getBoundingClientRect();\n\n const spaceOnTopOfSelect = viewportRelativeRect.top;\n const spaceOnBottomOfSelect
|
|
1
|
+
{"version":3,"file":"useSelectPositionList.es.js","sources":["../../../../src/components/Form/Select/useSelectPositionList.ts"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from \"react\";\nimport { Position, UseSelectPositionListParams } from \"./Select.interfaces\";\n\n/** @scope .*/\nexport const useSelectPositionList = ({\n expanded,\n optionListReference,\n addBtnRef,\n containerReference\n}: UseSelectPositionListParams) => {\n const [optionsListMaxHeight, setOptionsListMaxHeight] = useState<{\n wrapper?: string;\n list?: string;\n }>({\n wrapper: undefined,\n list: undefined\n });\n const [opacity, setOpacity] = useState(0); // We set opacity because otherwise if we calculate the max height you see the list full height for a split second and then it shortens.\n const [listPosition, setListPosition] = useState<Position>(Position.Below);\n\n useEffect(() => {\n rePositionList();\n }, [expanded]);\n\n // Must be identical in the fit check and the max-height cap below, otherwise a\n // list deemed to \"fit\" on a side can still get capped there with a scrollbar.\n const VIEWPORT_MARGIN = 0;\n\n const getAddNewButtonHeightWithMargin = () =>\n addBtnRef.current\n ? addBtnRef.current.getBoundingClientRect().height +\n Number.parseInt(getComputedStyle(addBtnRef.current).marginBottom)\n : 0;\n\n const rePositionList = () => {\n if (!expanded || !optionListReference.current || !containerReference.current) {\n return;\n }\n\n const listHeight = optionListReference.current?.getBoundingClientRect().height;\n\n const viewportRelativeRect = containerReference.current.getBoundingClientRect();\n\n const addNewButtonHeightWithMargin = getAddNewButtonHeightWithMargin();\n\n const spaceOnTopOfSelect = viewportRelativeRect.top - VIEWPORT_MARGIN;\n const spaceOnBottomOfSelect =\n window.innerHeight - viewportRelativeRect.bottom - VIEWPORT_MARGIN;\n\n const requiredHeight = listHeight + addNewButtonHeightWithMargin;\n const fitsBelow = requiredHeight <= spaceOnBottomOfSelect;\n const fitsAbove = requiredHeight <= spaceOnTopOfSelect;\n\n let position: Position;\n if (fitsBelow) {\n position = Position.Below;\n } else if (fitsAbove) {\n position = Position.Above;\n } else {\n position = spaceOnTopOfSelect > spaceOnBottomOfSelect ? Position.Above : Position.Below;\n }\n\n setListPosition(position);\n\n // Calculate the potential max height of the options list\n calculateOptionListMaxHeight(position);\n };\n\n const calculateOptionListMaxHeight = (position: Position) => {\n // Calculate max height if there's more space below the select\n const listHeight = optionListReference.current?.getBoundingClientRect().height;\n const addNewButtonHeightWithMargin = getAddNewButtonHeightWithMargin();\n const transformOrigin = position === Position.Below ? \"top\" : \"bottom\";\n\n if (!containerReference.current) {\n console.error(\n \"The containerReference is empty for some reason in the SelectService.ts for the Select component in react-lib-components. We are trying to calculate the option list max height on expand\"\n );\n return;\n }\n\n const availableSpace =\n transformOrigin === \"top\"\n ? window.innerHeight -\n containerReference.current.getBoundingClientRect().bottom -\n VIEWPORT_MARGIN\n : containerReference.current.getBoundingClientRect().top - VIEWPORT_MARGIN;\n\n if (listHeight && availableSpace < listHeight + addNewButtonHeightWithMargin) {\n const maxHeightObject = {\n wrapper: `${availableSpace}px`,\n list:\n addNewButtonHeightWithMargin > 0\n ? `${availableSpace - addNewButtonHeightWithMargin}px`\n : \"none\"\n };\n setOptionsListMaxHeight(maxHeightObject);\n setOpacity(100);\n return;\n }\n\n setOptionsListMaxHeight({ wrapper: undefined, list: undefined });\n setOpacity(100);\n };\n\n return {\n optionsListMaxHeight,\n opacity,\n setOpacity,\n listPosition,\n setListPosition\n };\n};\n"],"names":[],"mappings":";;AAoBO,MAAM,wBAAwB,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAmC;AACjC,QAAM,CAAC,sBAAsB,uBAAuB,IAAI,SAGrD;AAAA,IACD,SAAS;AAAA,IACT,MAAM;AAAA,EAAA,CACP;AACD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,CAAC;AACxC,QAAM,CAAC,cAAc,eAAe,IAAI,SAAmB,SAAS,KAAK;AAEzE,YAAU,MAAM;AACd,mBAAA;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAIb,QAAM,kBAAkB;AAExB,QAAM,kCAAkC,MACtC,UAAU,UACN,UAAU,QAAQ,sBAAA,EAAwB,SAC1C,OAAO,SAAS,iBAAiB,UAAU,OAAO,EAAE,YAAY,IAChE;AAEN,QAAM,iBAAiB,MAAM;;AAC3B,QAAI,CAAC,YAAY,CAAC,oBAAoB,WAAW,CAAC,mBAAmB,SAAS;AAC5E;AAAA,IACF;AAEA,UAAM,cAAa,yBAAoB,YAApB,mBAA6B,wBAAwB;AAExE,UAAM,uBAAuB,mBAAmB,QAAQ,sBAAA;AAExD,UAAM,+BAA+B,gCAAA;AAErC,UAAM,qBAAqB,qBAAqB,MAAM;AACtD,UAAM,wBACJ,OAAO,cAAc,qBAAqB,SAAS;AAErD,UAAM,iBAAiB,aAAa;AACpC,UAAM,YAAY,kBAAkB;AACpC,UAAM,YAAY,kBAAkB;AAEpC,QAAI;AACJ,QAAI,WAAW;AACb,iBAAW,SAAS;AAAA,IACtB,WAAW,WAAW;AACpB,iBAAW,SAAS;AAAA,IACtB,OAAO;AACL,iBAAW,qBAAqB,wBAAwB,SAAS,QAAQ,SAAS;AAAA,IACpF;AAEA,oBAAgB,QAAQ;AAGxB,iCAA6B,QAAQ;AAAA,EACvC;AAEA,QAAM,+BAA+B,CAAC,aAAuB;;AAE3D,UAAM,cAAa,yBAAoB,YAApB,mBAA6B,wBAAwB;AACxE,UAAM,+BAA+B,gCAAA;AACrC,UAAM,kBAAkB,aAAa,SAAS,QAAQ,QAAQ;AAE9D,QAAI,CAAC,mBAAmB,SAAS;AAC/B,cAAQ;AAAA,QACN;AAAA,MAAA;AAEF;AAAA,IACF;AAEA,UAAM,iBACJ,oBAAoB,QAChB,OAAO,cACP,mBAAmB,QAAQ,sBAAA,EAAwB,SACnD,kBACA,mBAAmB,QAAQ,sBAAA,EAAwB,MAAM;AAE/D,QAAI,cAAc,iBAAiB,aAAa,8BAA8B;AAC5E,YAAM,kBAAkB;AAAA,QACtB,SAAS,GAAG,cAAc;AAAA,QAC1B,MACE,+BAA+B,IAC3B,GAAG,iBAAiB,4BAA4B,OAChD;AAAA,MAAA;AAER,8BAAwB,eAAe;AACvC,iBAAW,GAAG;AACd;AAAA,IACF;AAEA,4BAAwB,EAAE,SAAS,QAAW,MAAM,QAAW;AAC/D,eAAW,GAAG;AAAA,EAChB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),a=require("./Textarea.module.scss.cjs.js"),s=require("../../../hooks/useDetermineStatusIcon.cjs.js"),r=require("../../withReadOnly.cjs.js"),t=require("../../../util/helper.cjs.js"),u=r.withReadOnly(e.forwardRef(({error:r=!1,success:u=!1,disabled:l=!1,className:o,rows:c=4,wrapperProps:d,onFocus:n,onBlur:i,value:p,...f},m)=>{const[h,j]=e.useState(!1),x=[a.default["textarea-wrapper"]],b=[a.default.outline];(null==d?void 0:d.className)&&x.push(d.className),l&&x.push(a.default.disabled)&&b.push(a.default.disabled),r&&x.push(a.default.error)&&b.push(a.default.error),h&&x.push(a.default.focus)&&b.push(a.default.focus),u&&x.push("success");const w=s.useDetermineStatusIcon({success:u,error:r});return e.createElement("div",{...d,className:x.join(" ")},f["data-readonlyview"]?e.createElement("div",{...t.pickProps(f,/^aria-/),"data-readonlyview":!0,role:"textbox","aria-readonly":"true",tabIndex:0,className:`${r?a.default.error:""} ${u?a.default.success:""}`},p):e.createElement("textarea",{...f,ref:m,rows:c,className:`${r?a.default.error:""} ${a.default.textarea} ${o??""}`,disabled:l,"aria-disabled":l,onFocus:e=>{j(!0),null==n||n(e)},onBlur:e=>{j(!1),null==i||i(e)},value:p}),w,e.createElement("span",{className:b.join(" ")}))}));exports.Textarea=u;
|
|
2
2
|
//# sourceMappingURL=Textarea.cjs.js.map
|