@onewelcome/react-lib-components 0.0.0-experimental-8e3a0fd
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/LICENSE +202 -0
- package/README.md +94 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +9 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/dist/components/Button/BaseButton.d.ts +8 -0
- package/dist/components/Button/BaseButton.test.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +8 -0
- package/dist/components/Button/Button.test.d.ts +1 -0
- package/dist/components/Button/IconButton.d.ts +11 -0
- package/dist/components/Button/IconButton.test.d.ts +1 -0
- package/dist/components/Button/Spinner.d.ts +2 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +24 -0
- package/dist/components/ContextMenu/ContextMenu.test.d.ts +1 -0
- package/dist/components/ContextMenu/ContextMenuItem.d.ts +15 -0
- package/dist/components/ContextMenu/ContextMenuService.d.ts +21 -0
- package/dist/components/DataGrid/DataGrid.d.ts +46 -0
- package/dist/components/DataGrid/DataGrid.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridActions/DataGridActions.d.ts +15 -0
- package/dist/components/DataGrid/DataGridActions/DataGridActions.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.d.ts +13 -0
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridBody/DataGridBody.d.ts +21 -0
- package/dist/components/DataGrid/DataGridBody/DataGridBody.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.d.ts +12 -0
- package/dist/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawer.d.ts +5 -0
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.d.ts +6 -0
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.d.ts +33 -0
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridWithNestedRows.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridBody/DataGridRow/useNestedRow.d.ts +855 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridDateFilter.d.ts +9 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.d.ts +16 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterPopover.d.ts +23 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterService.d.ts +16 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterTag.d.ts +15 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterTag.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.d.ts +15 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridFilters.interfaces.d.ts +78 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridSearchbar.d.ts +10 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.d.ts +15 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbarWrapper.d.ts +10 -0
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.d.ts +31 -0
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerCalendarSection.d.ts +15 -0
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerInputSection.d.ts +18 -0
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimeService.d.ts +10 -0
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/SideMenu.d.ts +10 -0
- package/dist/components/DataGrid/DataGridFilters/FilterKeyMapper.d.ts +14 -0
- package/dist/components/DataGrid/DataGridFilters/FilterKeyMapper.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridFilters/useFiltersReducer.d.ts +9 -0
- package/dist/components/DataGrid/DataGridFilters/useFiltersReducer.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.d.ts +13 -0
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.d.ts +10 -0
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.test.d.ts +1 -0
- package/dist/components/DataGrid/datagrid.interfaces.d.ts +13 -0
- package/dist/components/DataGrid/testUtils.d.ts +22 -0
- package/dist/components/DatePicker/DatePicker.d.ts +14 -0
- package/dist/components/DatePicker/DatePicker.test.d.ts +1 -0
- package/dist/components/Form/Checkbox/Checkbox.d.ts +14 -0
- package/dist/components/Form/Checkbox/Checkbox.test.d.ts +1 -0
- package/dist/components/Form/Fieldset/Fieldset.d.ts +14 -0
- package/dist/components/Form/Fieldset/Fieldset.test.d.ts +1 -0
- package/dist/components/Form/FileUpload/FileItem/FileItem.d.ts +28 -0
- package/dist/components/Form/FileUpload/FileItem/FileItem.test.d.ts +1 -0
- package/dist/components/Form/FileUpload/FileUpload.d.ts +32 -0
- package/dist/components/Form/FileUpload/FileUpload.test.d.ts +1 -0
- package/dist/components/Form/Form.d.ts +5 -0
- package/dist/components/Form/Form.test.d.ts +1 -0
- package/dist/components/Form/FormControl/FormControl.d.ts +8 -0
- package/dist/components/Form/FormControl/FormControl.test.d.ts +1 -0
- package/dist/components/Form/FormErrorText/FormErrorText.d.ts +12 -0
- package/dist/components/Form/FormErrorText/FormErrorText.test.d.ts +1 -0
- package/dist/components/Form/FormGroup/FormGroup.d.ts +17 -0
- package/dist/components/Form/FormGroup/FormGroup.test.d.ts +1 -0
- package/dist/components/Form/FormHelperText/FormHelperText.d.ts +7 -0
- package/dist/components/Form/FormHelperText/FormHelperText.test.d.ts +1 -0
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.d.ts +15 -0
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.test.d.ts +1 -0
- package/dist/components/Form/FormStatusIndicator/FormStatusIndicator.d.ts +8 -0
- package/dist/components/Form/Input/Input.d.ts +14 -0
- package/dist/components/Form/Input/Input.test.d.ts +1 -0
- package/dist/components/Form/Label/Label.d.ts +5 -0
- package/dist/components/Form/Label/Label.test.d.ts +1 -0
- package/dist/components/Form/Radio/Radio.d.ts +11 -0
- package/dist/components/Form/Radio/Radio.test.d.ts +1 -0
- package/dist/components/Form/Select/MultiSelect/MultiOption.d.ts +6 -0
- package/dist/components/Form/Select/MultiSelect/MultiSelect.d.ts +3 -0
- package/dist/components/Form/Select/MultiSelect/MultiSelect.test.d.ts +63 -0
- package/dist/components/Form/Select/MultiSelect/MultiSelectKeyboardNavigation.test.d.ts +1 -0
- package/dist/components/Form/Select/MultiSelect/SelectButton.d.ts +4 -0
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.d.ts +12 -0
- package/dist/components/Form/Select/MultiSelect/useArrowNavigation.d.ts +17 -0
- package/dist/components/Form/Select/MultiSelect/useMultiSelect.d.ts +16 -0
- package/dist/components/Form/Select/MultiSelect/useMultiSelect.test.d.ts +1 -0
- package/dist/components/Form/Select/MultiSelect/useSearch.d.ts +24 -0
- package/dist/components/Form/Select/Select.interfaces.d.ts +60 -0
- package/dist/components/Form/Select/SingleSelect/Option.d.ts +18 -0
- package/dist/components/Form/Select/SingleSelect/Option.test.d.ts +1 -0
- package/dist/components/Form/Select/SingleSelect/Select.d.ts +3 -0
- package/dist/components/Form/Select/SingleSelect/Select.test.d.ts +124 -0
- package/dist/components/Form/Select/SingleSelect/SelectKeyboardNavigation.test.d.ts +1 -0
- package/dist/components/Form/Select/SingleSelect/useArrowNavigation.d.ts +5 -0
- package/dist/components/Form/Select/SingleSelect/useSearch.d.ts +20 -0
- package/dist/components/Form/Select/useAddNewBtn.d.ts +19 -0
- package/dist/components/Form/Select/useSelectPositionList.d.ts +12 -0
- package/dist/components/Form/Textarea/Textarea.d.ts +7 -0
- package/dist/components/Form/Textarea/Textarea.test.d.ts +1 -0
- package/dist/components/Form/Toggle/Toggle.d.ts +11 -0
- package/dist/components/Form/Toggle/Toggle.test.d.ts +1 -0
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.d.ts +12 -0
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.d.ts +1 -0
- package/dist/components/Form/Wrapper/InputWrapper/InputWrapper.d.ts +18 -0
- package/dist/components/Form/Wrapper/InputWrapper/InputWrapper.test.d.ts +1 -0
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.d.ts +16 -0
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.test.d.ts +1 -0
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.d.ts +10 -0
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.test.d.ts +1 -0
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +16 -0
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.test.d.ts +1 -0
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.d.ts +16 -0
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.test.d.ts +1 -0
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.d.ts +27 -0
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.test.d.ts +1 -0
- package/dist/components/Form/form.interfaces.d.ts +16 -0
- package/dist/components/Icon/Icon.d.ts +114 -0
- package/dist/components/Icon/Icon.test.d.ts +1 -0
- package/dist/components/InlineEditing/InlineCheckbox/InlineCheckbox.d.ts +6 -0
- package/dist/components/InlineEditing/InlineEditingContext.d.ts +10 -0
- package/dist/components/InlineEditing/InlineEditingSelect/InlineSelect.d.ts +6 -0
- package/dist/components/Layout/Card/Card.d.ts +16 -0
- package/dist/components/Layout/Card/Card.test.d.ts +0 -0
- package/dist/components/Layout/ContentHeader/ContentHeader.d.ts +24 -0
- package/dist/components/Layout/ContentHeader/ContentHeader.test.d.ts +1 -0
- package/dist/components/Layout/FormPage/FormWithStepper/FormSection/FormSection.d.ts +7 -0
- package/dist/components/Layout/FormPage/FormWithStepper/FormSection/FormSection.test.d.ts +1 -0
- package/dist/components/Layout/FormPage/FormWithStepper/FormStepper/FormStepper.d.ts +10 -0
- package/dist/components/Layout/FormPage/FormWithStepper/FormStepper/FormStepper.test.d.ts +1 -0
- package/dist/components/Layout/FormPage/FormWithStepper/FormWithStepper.d.ts +6 -0
- package/dist/components/Layout/FormPage/FormWithStepper/FormWithStepper.test.d.ts +1 -0
- package/dist/components/Link/Link.d.ts +14 -0
- package/dist/components/Link/Link.test.d.ts +1 -0
- package/dist/components/Notifications/Alert/AlertContainer/AlertContainer.d.ts +12 -0
- package/dist/components/Notifications/Alert/AlertContainer/AlertContainer.test.d.ts +1 -0
- package/dist/components/Notifications/Alert/AlertContainer/useAlertContainerHeightAnimation.d.ts +4 -0
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.d.ts +22 -0
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.test.d.ts +1 -0
- package/dist/components/Notifications/Alert/AlertProvider/AlertContext.d.ts +13 -0
- package/dist/components/Notifications/Alert/AlertProvider/AlertProvider.d.ts +22 -0
- package/dist/components/Notifications/Alert/AlertProvider/AlertProvider.test.d.ts +1 -0
- package/dist/components/Notifications/Alert/useAlert.d.ts +7 -0
- package/dist/components/Notifications/Alert/useAlert.test.d.ts +1 -0
- package/dist/components/Notifications/Banner/Banner.d.ts +11 -0
- package/dist/components/Notifications/Banner/Banner.test.d.ts +1 -0
- package/dist/components/Notifications/BaseModal/BaseModal.d.ts +21 -0
- package/dist/components/Notifications/BaseModal/BaseModal.test.d.ts +1 -0
- package/dist/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.d.ts +13 -0
- package/dist/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.test.d.ts +1 -0
- package/dist/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.d.ts +8 -0
- package/dist/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.test.d.ts +1 -0
- package/dist/components/Notifications/BaseModal/BaseModalContext.d.ts +2 -0
- package/dist/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.d.ts +9 -0
- package/dist/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.test.d.ts +1 -0
- package/dist/components/Notifications/Dialog/Dialog.d.ts +22 -0
- package/dist/components/Notifications/Dialog/Dialog.test.d.ts +1 -0
- package/dist/components/Notifications/Dialog/DialogActions/DialogActions.d.ts +6 -0
- package/dist/components/Notifications/Dialog/DialogActions/DialogActions.test.d.ts +1 -0
- package/dist/components/Notifications/Dialog/DialogTitle/DialogTitle.d.ts +9 -0
- package/dist/components/Notifications/Dialog/DialogTitle/DialogTitle.test.d.ts +1 -0
- package/dist/components/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.d.ts +15 -0
- package/dist/components/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.test.d.ts +1 -0
- package/dist/components/Notifications/DiscardChangesModal/DiscardChangesModal.d.ts +13 -0
- package/dist/components/Notifications/DiscardChangesModal/DiscardChangesModal.test.d.ts +1 -0
- package/dist/components/Notifications/Modal/Modal.d.ts +2 -0
- package/dist/components/Notifications/Modal/Modal.test.d.ts +1 -0
- package/dist/components/Notifications/Modal/ModalActions/ModalActions.d.ts +2 -0
- package/dist/components/Notifications/Modal/ModalContent/ModalContent.d.ts +2 -0
- package/dist/components/Notifications/Modal/ModalHeader/ModalHeader.d.ts +2 -0
- package/dist/components/Notifications/NotificationProvider/NotificationContext.d.ts +35 -0
- package/dist/components/Notifications/NotificationProvider/NotificationContext.test.d.ts +1 -0
- package/dist/components/Notifications/NotificationProvider/NotificationService.d.ts +2 -0
- package/dist/components/Notifications/NotificationProvider/notification.interfaces.d.ts +46 -0
- package/dist/components/Notifications/SideSheet/SideSheet.d.ts +10 -0
- package/dist/components/Notifications/SideSheet/SideSheet.test.d.ts +1 -0
- package/dist/components/Notifications/SideSheet/SideSheetActions/SideSheetActions.d.ts +2 -0
- package/dist/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.d.ts +4 -0
- package/dist/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.d.ts +4 -0
- package/dist/components/Notifications/SlideInModal/SlideInModal.d.ts +4 -0
- package/dist/components/Notifications/SlideInModal/SlideInModal.test.d.ts +1 -0
- package/dist/components/Pagination/Pagination.d.ts +19 -0
- package/dist/components/Pagination/Pagination.test.d.ts +1 -0
- package/dist/components/Popover/Popover.d.ts +13 -0
- package/dist/components/Popover/Popover.test.d.ts +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +9 -0
- package/dist/components/ProgressBar/ProgressBar.test.d.ts +1 -0
- package/dist/components/RequiredSign/RequiredSign.d.ts +5 -0
- package/dist/components/Skeleton/Skeleton.d.ts +7 -0
- package/dist/components/Skeleton/Skeleton.test.d.ts +1 -0
- package/dist/components/Spinner/Spinner.d.ts +6 -0
- package/dist/components/Spinner/Spinner.test.d.ts +1 -0
- package/dist/components/Stepper/Step.d.ts +15 -0
- package/dist/components/Stepper/Stepper.d.ts +8 -0
- package/dist/components/Stepper/Stepper.test.d.ts +1 -0
- package/dist/components/Tabs/Tab.d.ts +8 -0
- package/dist/components/Tabs/Tab.test.d.ts +1 -0
- package/dist/components/Tabs/TabButton.d.ts +9 -0
- package/dist/components/Tabs/TabButton.test.d.ts +1 -0
- package/dist/components/Tabs/Tabs.d.ts +13 -0
- package/dist/components/Tabs/Tabs.test.d.ts +1 -0
- package/dist/components/Tag/RemoveButton.d.ts +7 -0
- package/dist/components/Tag/Tag.d.ts +13 -0
- package/dist/components/Tag/Tag.test.d.ts +1 -0
- package/dist/components/TextEllipsis/TextEllipsis.d.ts +6 -0
- package/dist/components/TextEllipsis/TextEllipsis.test.d.ts +1 -0
- package/dist/components/Tiles/Tile.d.ts +15 -0
- package/dist/components/Tiles/Tile.test.d.ts +1 -0
- package/dist/components/Tiles/Tiles.d.ts +6 -0
- package/dist/components/Tiles/Tiles.test.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +13 -0
- package/dist/components/Tooltip/Tooltip.test.d.ts +1 -0
- package/dist/components/Typography/Typography.d.ts +14 -0
- package/dist/components/Typography/Typography.test.d.ts +1 -0
- package/dist/components/_BaseStyling_/BaseStyling.d.ts +208 -0
- package/dist/components/_BaseStyling_/BaseStyling.test.d.ts +1 -0
- package/dist/components/_BaseStyling_/buttonBaseStyling.d.ts +14 -0
- package/dist/components/admin/layout/LeftNav/LeftNav.d.ts +13 -0
- package/dist/components/admin/layout/LeftNav/LeftNav.interfaces.d.ts +13 -0
- package/dist/components/admin/layout/LeftNav/LeftNav.test.d.ts +0 -0
- package/dist/components/admin/layout/LeftNav/LeftNavItem/ButtonLeftNavItem.d.ts +14 -0
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.d.ts +3 -0
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.interface.d.ts +11 -0
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.test.d.ts +0 -0
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LinkLeftNavItem.d.ts +12 -0
- package/dist/components/admin/layout/LeftNav/LeftNavItem/useKeyboardNavigation.d.ts +13 -0
- package/dist/components/admin/layout/LeftNav/useRefItems.d.ts +22 -0
- package/dist/components/admin/layout/LeftNav/useRefItems.test.d.ts +1 -0
- package/dist/components/admin/layout/MicrofrontendContainer/MicrofrontendContainer.d.ts +8 -0
- package/dist/components/miscellaneous/IdentityProviderButton.d.ts +18 -0
- package/dist/components/miscellaneous/IdentityProviderButton.test.d.ts +1 -0
- package/dist/components/withReadOnly.d.ts +12 -0
- package/dist/components/withReadOnly.test.d.ts +1 -0
- package/dist/hooks/useAnimation.d.ts +5 -0
- package/dist/hooks/useAnimation.test.d.ts +1 -0
- package/dist/hooks/useClickOutside.d.ts +2 -0
- package/dist/hooks/useClickOutside.test.d.ts +1 -0
- package/dist/hooks/useDebouncedCallback.d.ts +1 -0
- package/dist/hooks/useDebouncedCallback.test.d.ts +1 -0
- package/dist/hooks/useDetermineStatusIcon.d.ts +3 -0
- package/dist/hooks/useDetermineStatusIcon.test.d.ts +1 -0
- package/dist/hooks/useFormSelector.d.ts +13 -0
- package/dist/hooks/useFormSelector.test.d.ts +1 -0
- package/dist/hooks/useFullHeightCollapse.d.ts +4 -0
- package/dist/hooks/useFullHeightCollapse.test.d.ts +1 -0
- package/dist/hooks/useGetDomRoot.d.ts +3 -0
- package/dist/hooks/usePosition.d.ts +50 -0
- package/dist/hooks/usePosition.test.d.ts +1 -0
- package/dist/hooks/useRepeatFocus.d.ts +7 -0
- package/dist/hooks/useRepeater.d.ts +10 -0
- package/dist/hooks/useRepeater.test.d.ts +6 -0
- package/dist/hooks/useScreenSize.d.ts +9 -0
- package/dist/hooks/useScreenSize.test.d.ts +1 -0
- package/dist/hooks/useScroll.d.ts +2 -0
- package/dist/hooks/useScroll.test.d.ts +1 -0
- package/dist/hooks/useSpacing.d.ts +18 -0
- package/dist/hooks/useSpacing.test.d.ts +1 -0
- package/dist/hooks/useUploadFile.d.ts +27 -0
- package/dist/hooks/useUploadFile.test.d.ts +1 -0
- package/dist/hooks/useWrapper.d.ts +7 -0
- package/dist/hooks/useWrapper.test.d.ts +1 -0
- package/dist/index.cjs.js +205 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +175 -0
- package/dist/index.es.js +65380 -0
- package/dist/index.es.js.map +1 -0
- package/dist/interfaces.d.ts +9 -0
- package/dist/util/helper.d.ts +14 -0
- package/dist/util/helper.test.d.ts +1 -0
- package/dist/util/unitTestUtils.d.ts +12 -0
- package/dist/utils/statusUtils.d.ts +10 -0
- package/dist/variables.d.ts +8 -0
- package/package.json +144 -0
- package/src/_functions.scss +19 -0
- package/src/components/Breadcrumbs/Breadcrumbs.module.scss +54 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +84 -0
- package/src/components/Button/BaseButton.module.scss +48 -0
- package/src/components/Button/BaseButton.tsx +65 -0
- package/src/components/Button/Button.module.scss +58 -0
- package/src/components/Button/Button.tsx +70 -0
- package/src/components/Button/IconButton.module.scss +73 -0
- package/src/components/Button/IconButton.tsx +63 -0
- package/src/components/Button/Spinner.tsx +33 -0
- package/src/components/ContextMenu/ContextMenu.module.scss +41 -0
- package/src/components/ContextMenu/ContextMenu.tsx +206 -0
- package/src/components/ContextMenu/ContextMenuItem.module.scss +73 -0
- package/src/components/ContextMenu/ContextMenuItem.tsx +100 -0
- package/src/components/ContextMenu/ContextMenuService.ts +171 -0
- package/src/components/DataGrid/DataGrid.module.scss +51 -0
- package/src/components/DataGrid/DataGrid.tsx +225 -0
- package/src/components/DataGrid/DataGridActions/DataGridActions.module.scss +51 -0
- package/src/components/DataGrid/DataGridActions/DataGridActions.tsx +140 -0
- package/src/components/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss +58 -0
- package/src/components/DataGrid/DataGridActions/DataGridColumnsToggle.tsx +107 -0
- package/src/components/DataGrid/DataGridBody/DataGridBody.module.scss +26 -0
- package/src/components/DataGrid/DataGridBody/DataGridBody.tsx +110 -0
- package/src/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.module.scss +61 -0
- package/src/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.tsx +131 -0
- package/src/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawer.module.scss +60 -0
- package/src/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawer.tsx +39 -0
- package/src/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.module.scss +21 -0
- package/src/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.tsx +47 -0
- package/src/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.module.scss +127 -0
- package/src/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.tsx +192 -0
- package/src/components/DataGrid/DataGridBody/DataGridRow/useNestedRow.tsx +143 -0
- package/src/components/DataGrid/DataGridBody/__snapshots__/DataGridBody.test.tsx.snap +262 -0
- package/src/components/DataGrid/DataGridFilters/DataGridDateFilter.tsx +65 -0
- package/src/components/DataGrid/DataGridFilters/DataGridFilter.module.scss +116 -0
- package/src/components/DataGrid/DataGridFilters/DataGridFilter.tsx +161 -0
- package/src/components/DataGrid/DataGridFilters/DataGridFilterPopover.tsx +172 -0
- package/src/components/DataGrid/DataGridFilters/DataGridFilterService.ts +124 -0
- package/src/components/DataGrid/DataGridFilters/DataGridFilterTag.tsx +146 -0
- package/src/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.tsx +136 -0
- package/src/components/DataGrid/DataGridFilters/DataGridFilters.interfaces.ts +123 -0
- package/src/components/DataGrid/DataGridFilters/DataGridSearchbar.tsx +71 -0
- package/src/components/DataGrid/DataGridFilters/DataGridToolbar.module.scss +73 -0
- package/src/components/DataGrid/DataGridFilters/DataGridToolbar.tsx +132 -0
- package/src/components/DataGrid/DataGridFilters/DataGridToolbarWrapper.tsx +38 -0
- package/src/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.module.scss +136 -0
- package/src/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.tsx +267 -0
- package/src/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerCalendarSection.tsx +103 -0
- package/src/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerInputSection.tsx +121 -0
- package/src/components/DataGrid/DataGridFilters/DateTimePicker/DateTimeService.ts +30 -0
- package/src/components/DataGrid/DataGridFilters/DateTimePicker/SideMenu.tsx +50 -0
- package/src/components/DataGrid/DataGridFilters/FilterKeyMapper.ts +48 -0
- package/src/components/DataGrid/DataGridFilters/useFiltersReducer.tsx +73 -0
- package/src/components/DataGrid/DataGridHeader/DataGridHeader.module.scss +32 -0
- package/src/components/DataGrid/DataGridHeader/DataGridHeader.tsx +128 -0
- package/src/components/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss +93 -0
- package/src/components/DataGrid/DataGridHeader/DataGridHeaderCell.tsx +83 -0
- package/src/components/DataGrid/dataGridMixins.module.scss +33 -0
- package/src/components/DataGrid/datagrid.interfaces.ts +30 -0
- package/src/components/DataGrid/testUtils.ts +117 -0
- package/src/components/DatePicker/DatePicker.module.scss +360 -0
- package/src/components/DatePicker/DatePicker.tsx +98 -0
- package/src/components/Form/Checkbox/Checkbox.module.scss +221 -0
- package/src/components/Form/Checkbox/Checkbox.tsx +205 -0
- package/src/components/Form/Fieldset/Fieldset.module.scss +49 -0
- package/src/components/Form/Fieldset/Fieldset.tsx +128 -0
- package/src/components/Form/FileUpload/FileItem/FileItem.module.scss +204 -0
- package/src/components/Form/FileUpload/FileItem/FileItem.tsx +271 -0
- package/src/components/Form/FileUpload/FileUpload.module.scss +241 -0
- package/src/components/Form/FileUpload/FileUpload.tsx +317 -0
- package/src/components/Form/Form.module.scss +19 -0
- package/src/components/Form/Form.tsx +35 -0
- package/src/components/Form/FormControl/FormControl.module.scss +65 -0
- package/src/components/Form/FormControl/FormControl.tsx +62 -0
- package/src/components/Form/FormErrorText/FormErrorText.module.scss +35 -0
- package/src/components/Form/FormErrorText/FormErrorText.tsx +65 -0
- package/src/components/Form/FormGroup/FormGroup.module.scss +24 -0
- package/src/components/Form/FormGroup/FormGroup.tsx +96 -0
- package/src/components/Form/FormHelperText/FormHelperText.module.scss +32 -0
- package/src/components/Form/FormHelperText/FormHelperText.tsx +43 -0
- package/src/components/Form/FormSection/FormSection.module.scss +12 -0
- package/src/components/Form/FormSelectorWrapper/FormSelectorWrapper.module.scss +68 -0
- package/src/components/Form/FormSelectorWrapper/FormSelectorWrapper.tsx +117 -0
- package/src/components/Form/FormStatusIndicator/FormStatusIndicator.tsx +75 -0
- package/src/components/Form/Input/Input.module.scss +186 -0
- package/src/components/Form/Input/Input.tsx +161 -0
- package/src/components/Form/Label/Label.module.scss +21 -0
- package/src/components/Form/Label/Label.tsx +40 -0
- package/src/components/Form/Radio/Radio.module.scss +196 -0
- package/src/components/Form/Radio/Radio.tsx +142 -0
- package/src/components/Form/Select/MultiSelect/MultiOption.tsx +66 -0
- package/src/components/Form/Select/MultiSelect/MultiSelect.module.scss +318 -0
- package/src/components/Form/Select/MultiSelect/MultiSelect.tsx +406 -0
- package/src/components/Form/Select/MultiSelect/SelectButton.module.scss +28 -0
- package/src/components/Form/Select/MultiSelect/SelectButton.tsx +37 -0
- package/src/components/Form/Select/MultiSelect/SelectedOptions.module.scss +39 -0
- package/src/components/Form/Select/MultiSelect/SelectedOptions.tsx +68 -0
- package/src/components/Form/Select/MultiSelect/useArrowNavigation.ts +133 -0
- package/src/components/Form/Select/MultiSelect/useMultiSelect.tsx +98 -0
- package/src/components/Form/Select/MultiSelect/useSearch.tsx +117 -0
- package/src/components/Form/Select/Select.interfaces.ts +84 -0
- package/src/components/Form/Select/SingleSelect/Option.tsx +116 -0
- package/src/components/Form/Select/SingleSelect/Select.module.scss +409 -0
- package/src/components/Form/Select/SingleSelect/Select.tsx +312 -0
- package/src/components/Form/Select/SingleSelect/useArrowNavigation.ts +177 -0
- package/src/components/Form/Select/SingleSelect/useSearch.tsx +113 -0
- package/src/components/Form/Select/useAddNewBtn.module.scss +66 -0
- package/src/components/Form/Select/useAddNewBtn.tsx +89 -0
- package/src/components/Form/Select/useSelectPositionList.ts +109 -0
- package/src/components/Form/Textarea/Textarea.module.scss +142 -0
- package/src/components/Form/Textarea/Textarea.tsx +97 -0
- package/src/components/Form/Toggle/Toggle.module.scss +214 -0
- package/src/components/Form/Toggle/Toggle.tsx +80 -0
- package/src/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.module.scss +32 -0
- package/src/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.tsx +99 -0
- package/src/components/Form/Wrapper/InputWrapper/InputWrapper.module.scss +79 -0
- package/src/components/Form/Wrapper/InputWrapper/InputWrapper.tsx +125 -0
- package/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.module.scss +27 -0
- package/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.tsx +88 -0
- package/src/components/Form/Wrapper/RadioWrapper/RadioWrapper.module.scss +30 -0
- package/src/components/Form/Wrapper/RadioWrapper/RadioWrapper.tsx +109 -0
- package/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.module.scss +27 -0
- package/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.tsx +89 -0
- package/src/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss +100 -0
- package/src/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.tsx +154 -0
- package/src/components/Form/Wrapper/Wrapper/Wrapper.module.scss +87 -0
- package/src/components/Form/Wrapper/Wrapper/Wrapper.tsx +116 -0
- package/src/components/Form/form.interfaces.ts +34 -0
- package/src/components/Icon/Icon.module.scss +455 -0
- package/src/components/Icon/Icon.tsx +152 -0
- package/src/components/InlineEditing/InlineCheckbox/InlineCheckbox.tsx +40 -0
- package/src/components/InlineEditing/InlineEditingContext.tsx +32 -0
- package/src/components/InlineEditing/InlineEditingSelect/InlineSelect.tsx +44 -0
- package/src/components/Layout/Card/Card.module.scss +68 -0
- package/src/components/Layout/Card/Card.tsx +108 -0
- package/src/components/Layout/ContentHeader/ContentHeader.module.scss +95 -0
- package/src/components/Layout/ContentHeader/ContentHeader.tsx +146 -0
- package/src/components/Layout/FormPage/FormWithStepper/FormSection/FormSection.module.scss +12 -0
- package/src/components/Layout/FormPage/FormWithStepper/FormSection/FormSection.tsx +53 -0
- package/src/components/Layout/FormPage/FormWithStepper/FormStepper/FormStepper.module.scss +25 -0
- package/src/components/Layout/FormPage/FormWithStepper/FormStepper/FormStepper.tsx +54 -0
- package/src/components/Layout/FormPage/FormWithStepper/FormWithStepper.module.scss +36 -0
- package/src/components/Layout/FormPage/FormWithStepper/FormWithStepper.tsx +32 -0
- package/src/components/Link/Link.module.scss +106 -0
- package/src/components/Link/Link.tsx +111 -0
- package/src/components/Notifications/Alert/AlertContainer/AlertContainer.module.scss +57 -0
- package/src/components/Notifications/Alert/AlertContainer/AlertContainer.tsx +52 -0
- package/src/components/Notifications/Alert/AlertContainer/useAlertContainerHeightAnimation.ts +47 -0
- package/src/components/Notifications/Alert/AlertItem/AlertItem.module.scss +279 -0
- package/src/components/Notifications/Alert/AlertItem/AlertItem.tsx +214 -0
- package/src/components/Notifications/Alert/AlertProvider/AlertContext.ts +42 -0
- package/src/components/Notifications/Alert/AlertProvider/AlertProvider.tsx +173 -0
- package/src/components/Notifications/Alert/alertVariables.scss +17 -0
- package/src/components/Notifications/Alert/useAlert.ts +30 -0
- package/src/components/Notifications/Banner/Banner.module.scss +76 -0
- package/src/components/Notifications/Banner/Banner.tsx +78 -0
- package/src/components/Notifications/BaseModal/BaseModal.module.scss +76 -0
- package/src/components/Notifications/BaseModal/BaseModal.tsx +186 -0
- package/src/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.scss +65 -0
- package/src/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.tsx +66 -0
- package/src/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.scss +25 -0
- package/src/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.tsx +60 -0
- package/src/components/Notifications/BaseModal/BaseModalContext.ts +18 -0
- package/src/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.scss +43 -0
- package/src/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.tsx +69 -0
- package/src/components/Notifications/Dialog/Dialog.module.scss +31 -0
- package/src/components/Notifications/Dialog/Dialog.tsx +143 -0
- package/src/components/Notifications/Dialog/DialogActions/DialogActions.module.scss +35 -0
- package/src/components/Notifications/Dialog/DialogActions/DialogActions.tsx +48 -0
- package/src/components/Notifications/Dialog/DialogTitle/DialogTitle.module.scss +58 -0
- package/src/components/Notifications/Dialog/DialogTitle/DialogTitle.tsx +75 -0
- package/src/components/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.tsx +77 -0
- package/src/components/Notifications/DiscardChangesModal/DiscardChangesModal.tsx +77 -0
- package/src/components/Notifications/Modal/Modal.tsx +18 -0
- package/src/components/Notifications/Modal/ModalActions/ModalActions.tsx +18 -0
- package/src/components/Notifications/Modal/ModalContent/ModalContent.tsx +18 -0
- package/src/components/Notifications/Modal/ModalHeader/ModalHeader.tsx +18 -0
- package/src/components/Notifications/NotificationProvider/NotificationContext.tsx +217 -0
- package/src/components/Notifications/NotificationProvider/NotificationService.ts +33 -0
- package/src/components/Notifications/NotificationProvider/notification.interfaces.ts +68 -0
- package/src/components/Notifications/SideSheet/SideSheet.module.scss +97 -0
- package/src/components/Notifications/SideSheet/SideSheet.tsx +114 -0
- package/src/components/Notifications/SideSheet/SideSheetActions/SideSheetActions.tsx +18 -0
- package/src/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss +19 -0
- package/src/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.tsx +25 -0
- package/src/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss +19 -0
- package/src/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.tsx +25 -0
- package/src/components/Notifications/SlideInModal/SlideInModal.module.scss +54 -0
- package/src/components/Notifications/SlideInModal/SlideInModal.tsx +75 -0
- package/src/components/Pagination/Pagination.module.scss +162 -0
- package/src/components/Pagination/Pagination.tsx +235 -0
- package/src/components/Popover/Popover.module.scss +42 -0
- package/src/components/Popover/Popover.tsx +142 -0
- package/src/components/ProgressBar/ProgressBar.module.scss +95 -0
- package/src/components/ProgressBar/ProgressBar.tsx +75 -0
- package/src/components/RequiredSign/RequiredSign.tsx +28 -0
- package/src/components/Skeleton/Skeleton.module.scss +36 -0
- package/src/components/Skeleton/Skeleton.tsx +48 -0
- package/src/components/Spinner/Spinner.module.scss +33 -0
- package/src/components/Spinner/Spinner.tsx +61 -0
- package/src/components/Stepper/Step.module.scss +301 -0
- package/src/components/Stepper/Step.tsx +116 -0
- package/src/components/Stepper/Stepper.module.scss +17 -0
- package/src/components/Stepper/Stepper.tsx +53 -0
- package/src/components/Tabs/Tab.module.scss +27 -0
- package/src/components/Tabs/Tab.tsx +41 -0
- package/src/components/Tabs/TabButton.module.scss +87 -0
- package/src/components/Tabs/TabButton.tsx +66 -0
- package/src/components/Tabs/Tabs.module.scss +58 -0
- package/src/components/Tabs/Tabs.tsx +217 -0
- package/src/components/Tag/RemoveButton.module.scss +42 -0
- package/src/components/Tag/RemoveButton.tsx +53 -0
- package/src/components/Tag/Tag.module.scss +43 -0
- package/src/components/Tag/Tag.tsx +79 -0
- package/src/components/TextEllipsis/TextEllipsis.module.scss +35 -0
- package/src/components/TextEllipsis/TextEllipsis.tsx +80 -0
- package/src/components/Tiles/Tile.module.scss +91 -0
- package/src/components/Tiles/Tile.tsx +105 -0
- package/src/components/Tiles/Tiles.module.scss +27 -0
- package/src/components/Tiles/Tiles.tsx +70 -0
- package/src/components/Tooltip/Tooltip.module.scss +221 -0
- package/src/components/Tooltip/Tooltip.tsx +251 -0
- package/src/components/Typography/Typography.module.scss +80 -0
- package/src/components/Typography/Typography.tsx +111 -0
- package/src/components/_BaseStyling_/BaseStyling.tsx +481 -0
- package/src/components/_BaseStyling_/buttonBaseStyling.ts +123 -0
- package/src/components/admin/layout/LeftNav/LeftNav.interfaces.ts +30 -0
- package/src/components/admin/layout/LeftNav/LeftNav.module.scss +66 -0
- package/src/components/admin/layout/LeftNav/LeftNav.tsx +96 -0
- package/src/components/admin/layout/LeftNav/LeftNavItem/ButtonLeftNavItem.tsx +173 -0
- package/src/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.interface.ts +28 -0
- package/src/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.module.scss +222 -0
- package/src/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.tsx +34 -0
- package/src/components/admin/layout/LeftNav/LeftNavItem/LinkLeftNavItem.tsx +106 -0
- package/src/components/admin/layout/LeftNav/LeftNavItem/useKeyboardNavigation.ts +75 -0
- package/src/components/admin/layout/LeftNav/useRefItems.ts +280 -0
- package/src/components/admin/layout/MicrofrontendContainer/MicrofrontendContainer.module.scss +25 -0
- package/src/components/admin/layout/MicrofrontendContainer/MicrofrontendContainer.tsx +47 -0
- package/src/components/miscellaneous/IdentityProviderButton.module.scss +31 -0
- package/src/components/miscellaneous/IdentityProviderButton.tsx +92 -0
- package/src/components/withReadOnly.tsx +121 -0
- package/src/font/README.md +47 -0
- package/src/font/icomoon.eot +0 -0
- package/src/font/icomoon.svg +111 -0
- package/src/font/icomoon.ttf +0 -0
- package/src/font/icomoon.woff +0 -0
- package/src/font/selection.json +1 -0
- package/src/hooks/useAnimation.ts +36 -0
- package/src/hooks/useClickOutside.ts +42 -0
- package/src/hooks/useDebouncedCallback.tsx +34 -0
- package/src/hooks/useDetermineStatusIcon.tsx +33 -0
- package/src/hooks/useFormSelector.ts +63 -0
- package/src/hooks/useFullHeightCollapse.ts +33 -0
- package/src/hooks/useGetDomRoot.ts +40 -0
- package/src/hooks/usePosition.ts +387 -0
- package/src/hooks/useRepeatFocus.tsx +89 -0
- package/src/hooks/useRepeater.ts +50 -0
- package/src/hooks/useScreenSize.ts +60 -0
- package/src/hooks/useScroll.ts +32 -0
- package/src/hooks/useSpacing.ts +58 -0
- package/src/hooks/useUploadFile.tsx +141 -0
- package/src/hooks/useWrapper.ts +33 -0
- package/src/index.ts +237 -0
- package/src/interfaces.ts +37 -0
- package/src/mixins.module.scss +371 -0
- package/src/readyclasses.module.scss +64 -0
- package/src/types.d.ts +20 -0
- package/src/util/helper.tsx +219 -0
- package/src/util/unitTestUtils.ts +32 -0
- package/src/utils/statusUtils.ts +51 -0
- package/src/variables.scss +38 -0
- package/src/variables.ts +32 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
@use "../../../../mixins.module";
|
|
18
|
+
@use "../../../../variables";
|
|
19
|
+
@use "../../../../functions" as *;
|
|
20
|
+
|
|
21
|
+
$listItemHeight: 2.5rem;
|
|
22
|
+
|
|
23
|
+
.select {
|
|
24
|
+
position: relative;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
border: 0;
|
|
27
|
+
border-radius: var(--input-border-radius);
|
|
28
|
+
background-color: var(--input-background-color);
|
|
29
|
+
font-size: var(--form-control-font-size);
|
|
30
|
+
|
|
31
|
+
@include mixins.transition(background-color, 0.2s, ease-in-out);
|
|
32
|
+
|
|
33
|
+
[data-display] {
|
|
34
|
+
color: var(--color-default);
|
|
35
|
+
font-family: var(--font-family);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.expanded {
|
|
39
|
+
.list-wrapper {
|
|
40
|
+
background: var(--light);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:not(.expanded) {
|
|
45
|
+
&:has(button:focus) {
|
|
46
|
+
position: relative;
|
|
47
|
+
z-index: 2;
|
|
48
|
+
@include mixins.focusVisibleOutline($selectors: null);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
button:focus:not(.error) {
|
|
52
|
+
border-color: var(--input-border-color);
|
|
53
|
+
border-width: var(--input-border-width);
|
|
54
|
+
padding: 0
|
|
55
|
+
calc(
|
|
56
|
+
relativeToBaseFontSize(variables.$form-element-horizontal-padding-ratio-mobile) - var(
|
|
57
|
+
--input-border-width
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:hover:not(.disabled):not(.expanded):not(.error) {
|
|
64
|
+
button:not(:focus) {
|
|
65
|
+
border-color: var(--input-border-color);
|
|
66
|
+
border-width: var(--input-border-width);
|
|
67
|
+
background-color: var(--color-blue-grey25);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.custom-select {
|
|
72
|
+
position: relative;
|
|
73
|
+
width: 100%;
|
|
74
|
+
min-height: calc(relativeToBaseFontSize(2.875) - (2 * var(--input-border-width)));
|
|
75
|
+
padding: 0
|
|
76
|
+
calc(
|
|
77
|
+
relativeToBaseFontSize(variables.$form-element-horizontal-padding-ratio-mobile) - var(
|
|
78
|
+
--input-border-width
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
background-color: transparent;
|
|
82
|
+
border-color: var(--input-border-color);
|
|
83
|
+
border-style: var(--input-border-style);
|
|
84
|
+
border-width: var(--input-border-width);
|
|
85
|
+
border-radius: var(--input-border-radius);
|
|
86
|
+
font-size: var(--form-control-font-size);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
@include mixins.transition((background-color, border-color), 0.2s, ease-in-out);
|
|
89
|
+
|
|
90
|
+
&:focus {
|
|
91
|
+
outline: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&.error {
|
|
95
|
+
border-color: var(--error);
|
|
96
|
+
color: var(--error);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&.error:focus {
|
|
100
|
+
border-width: var(--input-border-width);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&.disabled {
|
|
104
|
+
border-color: var(--color-disabled);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.list-wrapper-container {
|
|
109
|
+
position: relative;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.list-wrapper {
|
|
113
|
+
border-color: var(--light-grey-border);
|
|
114
|
+
border-style: var(--input-border-style);
|
|
115
|
+
border-width: var(--input-border-width);
|
|
116
|
+
border-radius: var(--input-border-radius);
|
|
117
|
+
box-shadow: 0 8px 10px 0 #01053224;
|
|
118
|
+
position: absolute;
|
|
119
|
+
z-index: variables.$select-z-index;
|
|
120
|
+
left: 0;
|
|
121
|
+
width: 100%;
|
|
122
|
+
overflow: auto;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
ul {
|
|
126
|
+
box-sizing: border-box;
|
|
127
|
+
padding: 0.25rem 0;
|
|
128
|
+
width: 100%;
|
|
129
|
+
margin: 0;
|
|
130
|
+
list-style: none;
|
|
131
|
+
background-color: var(--light);
|
|
132
|
+
border-radius: var(--input-border-radius);
|
|
133
|
+
color: var(--default);
|
|
134
|
+
text-align: left;
|
|
135
|
+
overflow: auto;
|
|
136
|
+
max-height: calc($listItemHeight * 10);
|
|
137
|
+
|
|
138
|
+
li {
|
|
139
|
+
padding: 0.62rem 0.75rem;
|
|
140
|
+
font-size: var(--form-control-font-size);
|
|
141
|
+
margin: 0;
|
|
142
|
+
position: relative;
|
|
143
|
+
line-height: 1.43;
|
|
144
|
+
box-sizing: border-box;
|
|
145
|
+
min-height: $listItemHeight;
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
|
|
148
|
+
&:focus {
|
|
149
|
+
outline: none;
|
|
150
|
+
|
|
151
|
+
&::before {
|
|
152
|
+
content: "";
|
|
153
|
+
position: absolute;
|
|
154
|
+
top: 0;
|
|
155
|
+
left: 0.125rem;
|
|
156
|
+
height: 100%;
|
|
157
|
+
width: calc(100% - 0.25rem);
|
|
158
|
+
opacity: 1;
|
|
159
|
+
z-index: calc(variables.$popover-z-index + 1);
|
|
160
|
+
|
|
161
|
+
@include mixins.focusVisibleOutline($outlineOffset: 0, $selectors: null);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&:hover {
|
|
166
|
+
background-color: var(--color-blue-grey50);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&:active {
|
|
170
|
+
background-color: var(--color-blue-grey100);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&.disabled {
|
|
174
|
+
color: var(--greyed-out);
|
|
175
|
+
background-color: var(--disabled);
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&[data-readonlyview="true"] {
|
|
182
|
+
user-select: text;
|
|
183
|
+
pointer-events: none;
|
|
184
|
+
|
|
185
|
+
& button[type="button"] {
|
|
186
|
+
background-color: var(--color-white);
|
|
187
|
+
color: var(--read-only-text-color);
|
|
188
|
+
border-color: var(--read-only-border-color);
|
|
189
|
+
|
|
190
|
+
& .selected {
|
|
191
|
+
color: var(--read-only-text-color);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&.error,
|
|
195
|
+
&.success {
|
|
196
|
+
border-color: var(--read-only-border-color);
|
|
197
|
+
color: var(--read-only-text-color);
|
|
198
|
+
|
|
199
|
+
& .status {
|
|
200
|
+
visibility: visible;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
& .status {
|
|
205
|
+
& .chevron-icon {
|
|
206
|
+
visibility: hidden;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
& .list-wrapper {
|
|
211
|
+
visibility: hidden;
|
|
212
|
+
& ul {
|
|
213
|
+
display: none;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.selected-option {
|
|
220
|
+
content: "";
|
|
221
|
+
position: absolute;
|
|
222
|
+
top: 0;
|
|
223
|
+
left: 0;
|
|
224
|
+
height: 100%;
|
|
225
|
+
border-top-right-radius: 0.125rem;
|
|
226
|
+
border-bottom-right-radius: 0.125rem;
|
|
227
|
+
border-left: 0.25rem solid var(--color-primary);
|
|
228
|
+
color: var(--color-primary);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.selected {
|
|
232
|
+
position: absolute;
|
|
233
|
+
top: 50%;
|
|
234
|
+
transform: translateY(-50%);
|
|
235
|
+
pointer-events: none;
|
|
236
|
+
left: calc(
|
|
237
|
+
relativeToBaseFontSize(variables.$form-element-horizontal-padding-ratio-mobile) - var(
|
|
238
|
+
--input-border-width
|
|
239
|
+
)
|
|
240
|
+
);
|
|
241
|
+
right: calc(2.25rem);
|
|
242
|
+
text-align: left;
|
|
243
|
+
white-space: normal;
|
|
244
|
+
.required {
|
|
245
|
+
color: var(--error);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.status {
|
|
250
|
+
position: absolute;
|
|
251
|
+
top: 50%;
|
|
252
|
+
right: 0.8125rem;
|
|
253
|
+
transform: translateY(-50%);
|
|
254
|
+
display: flex;
|
|
255
|
+
align-items: center;
|
|
256
|
+
flex-shrink: 0;
|
|
257
|
+
|
|
258
|
+
[data-icon-status="success"] {
|
|
259
|
+
color: var(--success);
|
|
260
|
+
font-size: var(--font-size-big);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
[data-icon-status="error"] {
|
|
264
|
+
color: var(--error);
|
|
265
|
+
font-size: var(--font-size-big);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
[data-icon-status="info"] {
|
|
269
|
+
color: var(--default);
|
|
270
|
+
font-size: var(--font-size-big);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.chevron-icon {
|
|
274
|
+
color: var(--default);
|
|
275
|
+
font-size: var(--font-size-small);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
* + * {
|
|
279
|
+
margin-left: 1.25rem;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.placeholder {
|
|
284
|
+
color: var(--greyed-out);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.select-search {
|
|
288
|
+
position: relative;
|
|
289
|
+
width: 100%;
|
|
290
|
+
box-sizing: border-box;
|
|
291
|
+
border-bottom-left-radius: 0;
|
|
292
|
+
border-bottom-right-radius: 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.disabled {
|
|
296
|
+
cursor: not-allowed;
|
|
297
|
+
color: var(--greyed-out);
|
|
298
|
+
background-color: var(--color-blue-grey25);
|
|
299
|
+
|
|
300
|
+
> * {
|
|
301
|
+
pointer-events: none;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@media only screen and (min-width: 30em) {
|
|
306
|
+
.select {
|
|
307
|
+
.custom-select {
|
|
308
|
+
padding: 0
|
|
309
|
+
calc(
|
|
310
|
+
relativeToBaseFontSize(variables.$form-element-horizontal-padding-ratio-desktop) - var(
|
|
311
|
+
--input-border-width
|
|
312
|
+
)
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
&:not(.expanded) {
|
|
317
|
+
button:focus:not(.error) {
|
|
318
|
+
padding: 0
|
|
319
|
+
calc(
|
|
320
|
+
relativeToBaseFontSize(variables.$form-element-horizontal-padding-ratio-desktop) - var(
|
|
321
|
+
--input-border-width
|
|
322
|
+
)
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
[data-readonlyview="true"] .root {
|
|
330
|
+
[data-readonlyview] {
|
|
331
|
+
& button {
|
|
332
|
+
border-color: var(--read-only-border-color);
|
|
333
|
+
|
|
334
|
+
& .status {
|
|
335
|
+
& .chevron-icon {
|
|
336
|
+
visibility: hidden;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
&.error {
|
|
341
|
+
border-color: var(--read-only-border-color);
|
|
342
|
+
color: var(--read-only-text-color);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.inlineEditing {
|
|
349
|
+
& .select {
|
|
350
|
+
background-color: transparent;
|
|
351
|
+
transition: none;
|
|
352
|
+
&:not(.expanded) {
|
|
353
|
+
button:focus:not(.error) {
|
|
354
|
+
border-width: 0;
|
|
355
|
+
border-radius: 0.3125rem;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
&:focus {
|
|
359
|
+
& button {
|
|
360
|
+
&:focus {
|
|
361
|
+
border: 0.125rem solid var(--color-focus);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
&:hover {
|
|
366
|
+
& button {
|
|
367
|
+
& .status {
|
|
368
|
+
span.chevron-icon {
|
|
369
|
+
visibility: visible;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
&:not(.disabled):not(.expanded):not(.error) {
|
|
374
|
+
button:not(:focus) {
|
|
375
|
+
border: 0;
|
|
376
|
+
background-color: transparent;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
& button {
|
|
381
|
+
border: 0;
|
|
382
|
+
&.expanded {
|
|
383
|
+
div.status {
|
|
384
|
+
span.chevron-icon {
|
|
385
|
+
visibility: visible;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
&:focus-visible {
|
|
390
|
+
outline: 0.125rem solid var(--color-focus);
|
|
391
|
+
border-radius: 0.3125rem;
|
|
392
|
+
outline-offset: -1px;
|
|
393
|
+
}
|
|
394
|
+
&.error {
|
|
395
|
+
color: var(--color-default);
|
|
396
|
+
}
|
|
397
|
+
& .status {
|
|
398
|
+
span.chevron-icon {
|
|
399
|
+
visibility: hidden;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
&[data-readonlyview="true"] {
|
|
404
|
+
& button {
|
|
405
|
+
background-color: transparent;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import classes from "./Select.module.scss";
|
|
18
|
+
|
|
19
|
+
import React, {
|
|
20
|
+
createRef,
|
|
21
|
+
ForwardRefRenderFunction,
|
|
22
|
+
ReactElement,
|
|
23
|
+
useEffect,
|
|
24
|
+
useRef,
|
|
25
|
+
useState
|
|
26
|
+
} from "react";
|
|
27
|
+
import { useClickOutside } from "../../../../hooks/useClickOutside";
|
|
28
|
+
import readyclasses from "../../../../readyclasses.module.scss";
|
|
29
|
+
import { filterProps } from "../../../../util/helper";
|
|
30
|
+
import { Icon, Icons } from "../../../Icon/Icon";
|
|
31
|
+
import { Position, SingleSelectProps } from "../Select.interfaces";
|
|
32
|
+
import { useSelectPositionList } from "../useSelectPositionList";
|
|
33
|
+
import { useAddNewBtn } from "../useAddNewBtn";
|
|
34
|
+
import { useSearch } from "./useSearch";
|
|
35
|
+
import { useArrowNavigation } from "./useArrowNavigation";
|
|
36
|
+
import { withReadOnly } from "../../../withReadOnly";
|
|
37
|
+
import { RequiredSign } from "../../../RequiredSign/RequiredSign";
|
|
38
|
+
import { FormStatusIndicator } from "../../FormStatusIndicator/FormStatusIndicator";
|
|
39
|
+
import { useInlineEditing } from "../../../InlineEditing/InlineEditingContext";
|
|
40
|
+
|
|
41
|
+
const SelectComponent: ForwardRefRenderFunction<HTMLSelectElement, SingleSelectProps> = (
|
|
42
|
+
{
|
|
43
|
+
children,
|
|
44
|
+
name,
|
|
45
|
+
disabled = false,
|
|
46
|
+
labeledBy,
|
|
47
|
+
placeholder,
|
|
48
|
+
describedBy,
|
|
49
|
+
selectButtonProps,
|
|
50
|
+
className,
|
|
51
|
+
error = false,
|
|
52
|
+
success = false,
|
|
53
|
+
value,
|
|
54
|
+
clearLabel = "Clear selection",
|
|
55
|
+
noResultsLabel = "No results found",
|
|
56
|
+
onChange,
|
|
57
|
+
addNew,
|
|
58
|
+
search,
|
|
59
|
+
isReadOnlyView,
|
|
60
|
+
...rest
|
|
61
|
+
}: SingleSelectProps,
|
|
62
|
+
ref
|
|
63
|
+
) => {
|
|
64
|
+
const [expanded, setExpanded] = useState(false);
|
|
65
|
+
const [display, setDisplay] = useState("");
|
|
66
|
+
const containerReference = useRef<HTMLDivElement>(null);
|
|
67
|
+
const optionListReference = useRef<HTMLDivElement>(null);
|
|
68
|
+
const [focusedSelectItem, setFocusedSelectItem] = useState(-1);
|
|
69
|
+
const [shouldClick, setShouldClick] = useState(false);
|
|
70
|
+
/** We need this, because whenever we use the arrow keys to select the select item, and we focus the currently selected item it fires the "click" listener in Option component. Instead, we only want this to fire if we press "enter" or "spacebar" so we set this to true whenever that is the case, and back to false when it has been executed. */
|
|
71
|
+
const [shouldFocusButtonAfterClose, setShouldFocusButtonAfterClose] = useState(false);
|
|
72
|
+
const optionsCount = React.Children.count(children);
|
|
73
|
+
const {
|
|
74
|
+
filter,
|
|
75
|
+
isSearching,
|
|
76
|
+
renderSearch,
|
|
77
|
+
searchInputRef,
|
|
78
|
+
setIsSearching,
|
|
79
|
+
searchThreshold,
|
|
80
|
+
searchVisible
|
|
81
|
+
} = useSearch({
|
|
82
|
+
expanded,
|
|
83
|
+
search,
|
|
84
|
+
searchInputClassName: classes["select-search"],
|
|
85
|
+
optionsCount,
|
|
86
|
+
setFocusedSelectItem
|
|
87
|
+
});
|
|
88
|
+
const { addBtnRef, addNewBtnOptionsContainerClassName, renderAddNew } = useAddNewBtn({
|
|
89
|
+
addNew,
|
|
90
|
+
filter,
|
|
91
|
+
focusedSelectItem,
|
|
92
|
+
optionsCount,
|
|
93
|
+
searchInputRef
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const { inlineClassNames } = useInlineEditing();
|
|
97
|
+
const rootClassNames = inlineClassNames ? ` ${inlineClassNames}` : "";
|
|
98
|
+
|
|
99
|
+
const nativeSelect = (ref as React.RefObject<HTMLSelectElement>) || createRef();
|
|
100
|
+
|
|
101
|
+
const onOptionChangeHandler = (optionElement: HTMLElement | null) => {
|
|
102
|
+
if (nativeSelect.current && optionElement) {
|
|
103
|
+
nativeSelect.current.value = optionElement.getAttribute("data-value")!;
|
|
104
|
+
nativeSelect.current.dispatchEvent(new Event("change", { bubbles: true }));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
setExpanded(false);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const customSelectButtonRef = useRef<HTMLButtonElement>(null);
|
|
111
|
+
const { onArrowNavigation } = useArrowNavigation({
|
|
112
|
+
expanded,
|
|
113
|
+
setExpanded,
|
|
114
|
+
isSearching,
|
|
115
|
+
setIsSearching,
|
|
116
|
+
setFocusedSelectItem,
|
|
117
|
+
onOptionChangeHandler,
|
|
118
|
+
childrenCount: optionsCount,
|
|
119
|
+
setShouldClick,
|
|
120
|
+
searchInputRef,
|
|
121
|
+
addBtnRef,
|
|
122
|
+
renderThreshold: searchThreshold,
|
|
123
|
+
isReadOnlyView: isReadOnlyView || !!rest["data-readonlyview"]
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const { listPosition, opacity, optionsListMaxHeight, setListPosition, setOpacity } =
|
|
127
|
+
useSelectPositionList({ expanded, optionListReference, containerReference, addBtnRef });
|
|
128
|
+
|
|
129
|
+
const syncDisplayValue = (val: string) => {
|
|
130
|
+
React.Children.forEach(children, child => {
|
|
131
|
+
if (child.props.value === val) {
|
|
132
|
+
setDisplay(child.props.children);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @description We have to modify the children (Option component) to have an additional props that allows us to keep track of which one is selected and focused at all times and if a filter is active.
|
|
139
|
+
* The `children` prop can be either a single object (1 child) or an array of multiple children.
|
|
140
|
+
*/
|
|
141
|
+
const renderOptions = () => {
|
|
142
|
+
if (isSearching || filter !== "") {
|
|
143
|
+
const filteredChildren = React.Children.toArray(children).filter(child => {
|
|
144
|
+
const childElement = child as React.ReactElement;
|
|
145
|
+
const innerChildren = childElement.props.children;
|
|
146
|
+
|
|
147
|
+
const childText = Array.isArray(innerChildren)
|
|
148
|
+
? innerChildren.map(String).join("")
|
|
149
|
+
: String(innerChildren);
|
|
150
|
+
return childText.toLowerCase().includes(filter.toLowerCase());
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const internalChildren = _internalRenderChildren(filteredChildren as ReactElement[]);
|
|
154
|
+
|
|
155
|
+
if (internalChildren.length === 0) {
|
|
156
|
+
return <li className={classes["no-results"]}>{noResultsLabel}</li>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return _internalRenderChildren(filteredChildren as ReactElement[]);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return _internalRenderChildren(children);
|
|
163
|
+
|
|
164
|
+
function _internalRenderChildren(internalChildren: ReactElement[]) {
|
|
165
|
+
return React.Children.map(internalChildren, (child, index) => {
|
|
166
|
+
return React.cloneElement(child, {
|
|
167
|
+
onFocusChange: (childIndex: number) => {
|
|
168
|
+
setFocusedSelectItem(childIndex);
|
|
169
|
+
},
|
|
170
|
+
onOptionSelect: (optionRef: React.RefObject<HTMLLIElement>) => {
|
|
171
|
+
onOptionChangeHandler(optionRef.current);
|
|
172
|
+
setShouldClick(false);
|
|
173
|
+
},
|
|
174
|
+
isSelected: child.props.value === value,
|
|
175
|
+
isSearching: isSearching,
|
|
176
|
+
selectOpened: expanded,
|
|
177
|
+
childIndex: index,
|
|
178
|
+
hasFocus: focusedSelectItem === index,
|
|
179
|
+
shouldClick: shouldClick,
|
|
180
|
+
isAddBtnFocused: addBtnRef.current === document.activeElement
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const renderChevronIcon = () => {
|
|
187
|
+
return expanded ? (
|
|
188
|
+
<Icon className={classes["chevron-icon"]} icon={Icons.ChevronUp} />
|
|
189
|
+
) : (
|
|
190
|
+
<Icon className={classes["chevron-icon"]} icon={Icons.ChevronDown} />
|
|
191
|
+
);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const nativeOnChangeHandler = (event: React.ChangeEvent<HTMLSelectElement>) => {
|
|
195
|
+
onChange?.(event);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
useEffect(() => {
|
|
199
|
+
if (expanded) {
|
|
200
|
+
setFocusedSelectItem(0);
|
|
201
|
+
setShouldFocusButtonAfterClose(true);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (!expanded && customSelectButtonRef.current && shouldFocusButtonAfterClose) {
|
|
205
|
+
customSelectButtonRef.current.focus();
|
|
206
|
+
setShouldFocusButtonAfterClose(false);
|
|
207
|
+
}
|
|
208
|
+
}, [expanded, customSelectButtonRef.current, shouldFocusButtonAfterClose]);
|
|
209
|
+
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
syncDisplayValue(value);
|
|
212
|
+
}, [value]);
|
|
213
|
+
|
|
214
|
+
const myElementRef = useRef<HTMLDivElement>(null);
|
|
215
|
+
|
|
216
|
+
useClickOutside(myElementRef, () => {
|
|
217
|
+
if (!expanded) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
setExpanded(false);
|
|
221
|
+
setListPosition(Position.Below);
|
|
222
|
+
setOpacity(0);
|
|
223
|
+
}, [expanded]);
|
|
224
|
+
|
|
225
|
+
const additionalClasses = [];
|
|
226
|
+
expanded && additionalClasses.push(classes.expanded);
|
|
227
|
+
error && additionalClasses.push(classes.error);
|
|
228
|
+
disabled && additionalClasses.push(classes.disabled);
|
|
229
|
+
className && additionalClasses.push(className);
|
|
230
|
+
success && additionalClasses.push(classes.success);
|
|
231
|
+
|
|
232
|
+
/** The native select is purely for external form libraries. We use it to emit an onChange with native select event object so they know exactly what's happening. */
|
|
233
|
+
return (
|
|
234
|
+
<div ref={myElementRef} className={`${classes["root"]}${rootClassNames}`}>
|
|
235
|
+
<select
|
|
236
|
+
{...filterProps(rest, /^data-/, false)}
|
|
237
|
+
tabIndex={-1}
|
|
238
|
+
aria-hidden="true"
|
|
239
|
+
ref={nativeSelect}
|
|
240
|
+
name={name}
|
|
241
|
+
onChange={nativeOnChangeHandler}
|
|
242
|
+
className={readyclasses["sr-only"]}
|
|
243
|
+
>
|
|
244
|
+
<option value=""></option>
|
|
245
|
+
{React.Children.map(children, child => (
|
|
246
|
+
<option value={child.props.value}></option>
|
|
247
|
+
))}
|
|
248
|
+
</select>
|
|
249
|
+
<div
|
|
250
|
+
{...filterProps(rest, /^data-/)}
|
|
251
|
+
ref={containerReference}
|
|
252
|
+
onKeyDown={onArrowNavigation}
|
|
253
|
+
className={`custom-select ${classes.select} ${additionalClasses.join(" ")}`}
|
|
254
|
+
>
|
|
255
|
+
{searchVisible && renderSearch()}
|
|
256
|
+
<button
|
|
257
|
+
{...selectButtonProps}
|
|
258
|
+
onClick={() => {
|
|
259
|
+
setExpanded(isReadOnlyView || rest["data-readonlyview"] ? false : !expanded);
|
|
260
|
+
}}
|
|
261
|
+
ref={customSelectButtonRef}
|
|
262
|
+
type="button"
|
|
263
|
+
name={name}
|
|
264
|
+
className={`${classes["custom-select"]} ${additionalClasses.join(" ")} `}
|
|
265
|
+
style={{ display: expanded && searchVisible ? "none" : "block" }}
|
|
266
|
+
disabled={disabled}
|
|
267
|
+
aria-disabled={disabled}
|
|
268
|
+
aria-invalid={error}
|
|
269
|
+
aria-expanded={expanded}
|
|
270
|
+
aria-haspopup="listbox"
|
|
271
|
+
aria-labelledby={labeledBy}
|
|
272
|
+
aria-describedby={describedBy}
|
|
273
|
+
>
|
|
274
|
+
<div data-display className={classes["selected"]}>
|
|
275
|
+
{!value && placeholder && <span className={classes["placeholder"]}>{placeholder}</span>}
|
|
276
|
+
{value?.length > 0 && <span data-display-inner>{display}</span>}
|
|
277
|
+
<RequiredSign className={classes["required"]} />
|
|
278
|
+
</div>
|
|
279
|
+
<div className={classes["status"]}>
|
|
280
|
+
<FormStatusIndicator isReadOnlyView={isReadOnlyView} success={success} error={error}>
|
|
281
|
+
{renderChevronIcon()}
|
|
282
|
+
</FormStatusIndicator>
|
|
283
|
+
</div>
|
|
284
|
+
</button>
|
|
285
|
+
<div className="list-wrapper-container">
|
|
286
|
+
<div
|
|
287
|
+
ref={optionListReference}
|
|
288
|
+
className={`list-wrapper ${classes["list-wrapper"]}`}
|
|
289
|
+
style={{
|
|
290
|
+
display: expanded ? "block" : "none",
|
|
291
|
+
opacity: opacity,
|
|
292
|
+
maxHeight: optionsListMaxHeight.wrapper,
|
|
293
|
+
pointerEvents: expanded ? "auto" : "none",
|
|
294
|
+
bottom: listPosition === Position.Above ? "2.85rem" : "initial",
|
|
295
|
+
marginTop: "4px"
|
|
296
|
+
}}
|
|
297
|
+
>
|
|
298
|
+
<ul
|
|
299
|
+
className={addNewBtnOptionsContainerClassName}
|
|
300
|
+
role="listbox"
|
|
301
|
+
style={{ maxHeight: optionsListMaxHeight.list }}
|
|
302
|
+
>
|
|
303
|
+
{renderOptions()}
|
|
304
|
+
</ul>
|
|
305
|
+
{renderAddNew()}
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
);
|
|
311
|
+
};
|
|
312
|
+
export const Select = withReadOnly(React.forwardRef(SelectComponent));
|