@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,75 @@
|
|
|
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 React, {
|
|
18
|
+
ForwardRefRenderFunction,
|
|
19
|
+
TransitionEventHandler,
|
|
20
|
+
useState,
|
|
21
|
+
useRef,
|
|
22
|
+
useCallback,
|
|
23
|
+
useEffect
|
|
24
|
+
} from "react";
|
|
25
|
+
import { Props as ModalProps, Modal } from "../Modal/Modal";
|
|
26
|
+
import classes from "./SlideInModal.module.scss";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated use the new `SideSheet` component
|
|
30
|
+
*/
|
|
31
|
+
const SlideInModalComponent: ForwardRefRenderFunction<HTMLDivElement, ModalProps> = (
|
|
32
|
+
{ children, id, open, ...rest }: ModalProps,
|
|
33
|
+
ref
|
|
34
|
+
) => {
|
|
35
|
+
const [classHideOnTransition, setClassHideOnTransition] = useState<string>("hide");
|
|
36
|
+
const [controlledOpen, setControlledOpen] = useState(false);
|
|
37
|
+
const containerRef = useRef(null);
|
|
38
|
+
|
|
39
|
+
const onTransitionEnd: TransitionEventHandler<HTMLDivElement> = useCallback(
|
|
40
|
+
e => {
|
|
41
|
+
if (e.target === containerRef.current) {
|
|
42
|
+
setClassHideOnTransition(prev => (prev ? "" : "hide"));
|
|
43
|
+
if (!open && controlledOpen) {
|
|
44
|
+
setControlledOpen(false);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
[open]
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
open && setControlledOpen(open);
|
|
53
|
+
}, [open]);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<Modal
|
|
57
|
+
{...rest}
|
|
58
|
+
id={id}
|
|
59
|
+
open={controlledOpen}
|
|
60
|
+
className={`${classes["slide-in-modal"]} ${open ? classes["visible"] : ""} ${
|
|
61
|
+
!open ? classes[classHideOnTransition] : ""
|
|
62
|
+
}`}
|
|
63
|
+
containerProps={{ className: classes["container"] }}
|
|
64
|
+
backdropProps={{ id: classes["backdrop-slide"] }}
|
|
65
|
+
onTransitionEnd={onTransitionEnd}
|
|
66
|
+
ref={ref ?? containerRef}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</Modal>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type { Props } from "../Modal/Modal";
|
|
74
|
+
|
|
75
|
+
export const SlideInModal = React.forwardRef(SlideInModalComponent);
|
|
@@ -0,0 +1,162 @@
|
|
|
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 "../../functions" as *;
|
|
18
|
+
|
|
19
|
+
.pagination-wrapper {
|
|
20
|
+
font-family: var(--font-family);
|
|
21
|
+
font-size: var(--font-size-data-grid);
|
|
22
|
+
line-height: var(--data-grid-line-height);
|
|
23
|
+
color: var(--greyed-out);
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
|
|
28
|
+
.left {
|
|
29
|
+
display: flex;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.form-element {
|
|
33
|
+
height: relativeToBaseFontSize(2.5);
|
|
34
|
+
|
|
35
|
+
.search-input-wrapper {
|
|
36
|
+
width: 2.75rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
button {
|
|
40
|
+
min-height: relativeToBaseFontSize(2.5);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.total {
|
|
45
|
+
flex: 1 0 auto;
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
|
|
50
|
+
span {
|
|
51
|
+
color: var(--color-blue-grey500);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.pagination {
|
|
56
|
+
flex: 1 0 auto;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
margin-top: 1rem;
|
|
61
|
+
|
|
62
|
+
.previous,
|
|
63
|
+
.next {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
|
|
67
|
+
button span:before {
|
|
68
|
+
font-size: var(--font-size-sub);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.per-page {
|
|
74
|
+
display: none;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: 0.5rem;
|
|
77
|
+
|
|
78
|
+
label {
|
|
79
|
+
font-size: var(--font-size-data-grid);
|
|
80
|
+
line-height: var(--data-grid-line-height);
|
|
81
|
+
font-weight: 500;
|
|
82
|
+
color: var(--color-blue-grey900);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
+ .total {
|
|
86
|
+
padding-left: 0.9375rem;
|
|
87
|
+
border-left: 1px solid var(--color-blue-grey100);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.page {
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
flex-basis: min-content;
|
|
95
|
+
padding-right: 1rem;
|
|
96
|
+
|
|
97
|
+
&-total {
|
|
98
|
+
display: inline-block;
|
|
99
|
+
margin-left: 0.5rem;
|
|
100
|
+
white-space: nowrap;
|
|
101
|
+
font-weight: 500;
|
|
102
|
+
color: var(--color-blue-grey900);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
+ .previous {
|
|
106
|
+
padding-left: 0.9375rem;
|
|
107
|
+
border-left: 1px solid var(--color-blue-grey100);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.page-size-select {
|
|
112
|
+
button {
|
|
113
|
+
min-width: relativeToBaseFontSize(4.25);
|
|
114
|
+
padding: 0;
|
|
115
|
+
|
|
116
|
+
div[data-display] {
|
|
117
|
+
left: 0.5rem;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
div:not([data-display]) {
|
|
121
|
+
right: 0.5rem;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.current-page-select {
|
|
128
|
+
button {
|
|
129
|
+
min-width: relativeToBaseFontSize(3.75);
|
|
130
|
+
padding: 0;
|
|
131
|
+
|
|
132
|
+
div[data-display] {
|
|
133
|
+
left: 0.5rem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
div:not([data-display]) {
|
|
137
|
+
right: 0.5rem;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@media screen and (min-width: 30em) {
|
|
143
|
+
.pagination-wrapper {
|
|
144
|
+
flex-direction: row;
|
|
145
|
+
|
|
146
|
+
.total {
|
|
147
|
+
justify-content: flex-start;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.pagination {
|
|
151
|
+
margin-top: 0;
|
|
152
|
+
justify-content: flex-end;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@media screen and (min-width: 48em) {
|
|
158
|
+
.pagination-wrapper .per-page {
|
|
159
|
+
display: flex;
|
|
160
|
+
margin-right: 1rem;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
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 React, {
|
|
18
|
+
ForwardRefRenderFunction,
|
|
19
|
+
ComponentPropsWithRef,
|
|
20
|
+
Fragment,
|
|
21
|
+
useState,
|
|
22
|
+
useEffect
|
|
23
|
+
} from "react";
|
|
24
|
+
import classes from "./Pagination.module.scss";
|
|
25
|
+
import readyclasses from "../../readyclasses.module.scss";
|
|
26
|
+
import { IconButton } from "../Button/IconButton";
|
|
27
|
+
import { Icons, Icon } from "../Icon/Icon";
|
|
28
|
+
import { Select } from "../Form/Select/SingleSelect/Select";
|
|
29
|
+
import { Option } from "../Form/Select/SingleSelect/Option";
|
|
30
|
+
import { Label } from "../Form/Label/Label";
|
|
31
|
+
|
|
32
|
+
export type PaginationTranslations = {
|
|
33
|
+
totalItems: string;
|
|
34
|
+
itemsPerPage: string;
|
|
35
|
+
itemsPerPageLabel: string;
|
|
36
|
+
currentPage: string;
|
|
37
|
+
currentPageLabel: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type PageChangeLabels = "next" | "previous" | "first" | "last";
|
|
41
|
+
|
|
42
|
+
enum DefaultTranslations {
|
|
43
|
+
totalItems = "items in total",
|
|
44
|
+
itemsPerPage = "Items per page",
|
|
45
|
+
currentPage = "of %1 pages",
|
|
46
|
+
itemsPerPageLabel = "Select how many items per page you want to see.",
|
|
47
|
+
currentPageLabel = "What page you are currently on."
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type PageSize = 10 | 25 | 50;
|
|
51
|
+
|
|
52
|
+
export interface Props extends Omit<ComponentPropsWithRef<"div">, "translate"> {
|
|
53
|
+
currentPage: number;
|
|
54
|
+
totalElements?: number;
|
|
55
|
+
pageSize?: PageSize;
|
|
56
|
+
translate?: PaginationTranslations;
|
|
57
|
+
onPageChange: (pageToGoTo: number) => void;
|
|
58
|
+
onPageSizeChange: (pageSize: PageSize) => void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const PaginationComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
|
|
62
|
+
{
|
|
63
|
+
totalElements,
|
|
64
|
+
pageSize = 10,
|
|
65
|
+
translate = DefaultTranslations,
|
|
66
|
+
currentPage,
|
|
67
|
+
className,
|
|
68
|
+
onPageChange,
|
|
69
|
+
onPageSizeChange,
|
|
70
|
+
...rest
|
|
71
|
+
}: Props,
|
|
72
|
+
ref
|
|
73
|
+
) => {
|
|
74
|
+
const calculateAmountOfPages = () => {
|
|
75
|
+
if (!totalElements) {
|
|
76
|
+
return 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (Math.ceil(totalElements / pageSize) < 1) {
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return Math.ceil(totalElements / pageSize);
|
|
84
|
+
};
|
|
85
|
+
const pagesAmount = calculateAmountOfPages();
|
|
86
|
+
const [resetPageNoSelect, setResetPageNoSelect] = useState(false);
|
|
87
|
+
|
|
88
|
+
const onPageSizeChangeHandler = (event: React.ChangeEvent<HTMLSelectElement>) => {
|
|
89
|
+
const pageSizeNumber = Number(event.target.value) as PageSize;
|
|
90
|
+
setResetPageNoSelect(true);
|
|
91
|
+
onPageSizeChange(pageSizeNumber);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const onPageChangeHandler = (pageToGoTo: number) => {
|
|
95
|
+
onPageChange(pageToGoTo);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
resetPageNoSelect && setResetPageNoSelect(false);
|
|
100
|
+
}, [resetPageNoSelect]);
|
|
101
|
+
|
|
102
|
+
if (totalElements === undefined || totalElements === null || totalElements === 0) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<div {...rest} ref={ref} className={`${classes["pagination-wrapper"]} ${className ?? ""}`}>
|
|
108
|
+
<div className={classes["left"]}>
|
|
109
|
+
{pageSize && (
|
|
110
|
+
<div className={classes["per-page"]}>
|
|
111
|
+
<Label
|
|
112
|
+
id="page-size-select-label"
|
|
113
|
+
htmlFor="page-size-select"
|
|
114
|
+
className={classes["label"]}
|
|
115
|
+
>
|
|
116
|
+
{translate.itemsPerPage}
|
|
117
|
+
</Label>
|
|
118
|
+
<Select
|
|
119
|
+
name="page-size-select"
|
|
120
|
+
id="page-size-select"
|
|
121
|
+
labeledBy="page-size-select-label"
|
|
122
|
+
className={`${classes["form-element"]} ${classes["page-size-select"]}`}
|
|
123
|
+
value={pageSize.toString()}
|
|
124
|
+
onChange={onPageSizeChangeHandler}
|
|
125
|
+
>
|
|
126
|
+
<Option value="10">10</Option>
|
|
127
|
+
<Option value="25">25</Option>
|
|
128
|
+
<Option value="50">50</Option>
|
|
129
|
+
</Select>
|
|
130
|
+
</div>
|
|
131
|
+
)}
|
|
132
|
+
<div className={classes["total"]}>
|
|
133
|
+
<span tabIndex={0}>
|
|
134
|
+
{totalElements} {translate.totalItems}
|
|
135
|
+
</span>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
<div className={classes["pagination"]}>
|
|
139
|
+
<Fragment>
|
|
140
|
+
{!!pagesAmount && (
|
|
141
|
+
<div className={classes["page"]}>
|
|
142
|
+
<Label
|
|
143
|
+
id="current-value-input-label"
|
|
144
|
+
htmlFor="current-value-input"
|
|
145
|
+
className={`${readyclasses["sr-only"]} ${classes["current-value-select-label"]}`}
|
|
146
|
+
>
|
|
147
|
+
{translate.currentPageLabel}
|
|
148
|
+
</Label>
|
|
149
|
+
<Select
|
|
150
|
+
labeledBy="current-value-input-label"
|
|
151
|
+
key="input"
|
|
152
|
+
id="current-value-input"
|
|
153
|
+
size={currentPage.toString().length}
|
|
154
|
+
onChange={(e: React.ChangeEvent<HTMLSelectElement>) =>
|
|
155
|
+
onPageChangeHandler(Number(e.target.value))
|
|
156
|
+
}
|
|
157
|
+
name="current-value-input"
|
|
158
|
+
value={currentPage.toString()}
|
|
159
|
+
className={`${classes["form-element"]} ${classes["current-page-select"]}`}
|
|
160
|
+
search={{
|
|
161
|
+
enabled: true,
|
|
162
|
+
searchInputProps: {
|
|
163
|
+
wrapperProps: { className: classes["search-input-wrapper"] },
|
|
164
|
+
reset: resetPageNoSelect ? resetPageNoSelect : undefined,
|
|
165
|
+
autoComplete: "off"
|
|
166
|
+
}
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
{Array.from(Array(pagesAmount).keys()).map(page => (
|
|
170
|
+
<Option key={page} value={(page + 1).toString()}>
|
|
171
|
+
{(page + 1).toString()}
|
|
172
|
+
</Option>
|
|
173
|
+
))}
|
|
174
|
+
</Select>
|
|
175
|
+
<span className={classes["page-total"]}>
|
|
176
|
+
{translate.currentPage.replace(
|
|
177
|
+
"%1",
|
|
178
|
+
Math.ceil(totalElements / pageSize).toString()
|
|
179
|
+
)}
|
|
180
|
+
</span>
|
|
181
|
+
</div>
|
|
182
|
+
)}
|
|
183
|
+
{!!currentPage && (
|
|
184
|
+
<div className={classes["previous"]}>
|
|
185
|
+
{
|
|
186
|
+
<IconButton
|
|
187
|
+
disabled={currentPage <= 1}
|
|
188
|
+
title="first"
|
|
189
|
+
onClick={() => onPageChangeHandler(1)}
|
|
190
|
+
data-paginate="first"
|
|
191
|
+
>
|
|
192
|
+
<Icon icon={Icons.NavigationFirst} />
|
|
193
|
+
</IconButton>
|
|
194
|
+
}
|
|
195
|
+
{
|
|
196
|
+
<IconButton
|
|
197
|
+
disabled={currentPage <= 1}
|
|
198
|
+
title="previous"
|
|
199
|
+
onClick={() => onPageChangeHandler(currentPage - 1)}
|
|
200
|
+
data-paginate="previous"
|
|
201
|
+
>
|
|
202
|
+
<Icon icon={Icons.ChevronLeft} />
|
|
203
|
+
</IconButton>
|
|
204
|
+
}
|
|
205
|
+
</div>
|
|
206
|
+
)}
|
|
207
|
+
<div className={classes["next"]}>
|
|
208
|
+
{(currentPage !== undefined || false) && (
|
|
209
|
+
<IconButton
|
|
210
|
+
disabled={currentPage >= pagesAmount}
|
|
211
|
+
title="next"
|
|
212
|
+
onClick={() => onPageChangeHandler(currentPage + 1)}
|
|
213
|
+
data-paginate="next"
|
|
214
|
+
>
|
|
215
|
+
<Icon icon={Icons.ChevronRight} />
|
|
216
|
+
</IconButton>
|
|
217
|
+
)}
|
|
218
|
+
{!!currentPage && (
|
|
219
|
+
<IconButton
|
|
220
|
+
disabled={currentPage >= pagesAmount}
|
|
221
|
+
title="last"
|
|
222
|
+
onClick={() => onPageChangeHandler(Math.ceil(totalElements / pageSize))}
|
|
223
|
+
data-paginate="last"
|
|
224
|
+
>
|
|
225
|
+
<Icon icon={Icons.NavigationLast} />
|
|
226
|
+
</IconButton>
|
|
227
|
+
)}
|
|
228
|
+
</div>
|
|
229
|
+
</Fragment>
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export const Pagination = React.forwardRef(PaginationComponent);
|
|
@@ -0,0 +1,42 @@
|
|
|
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.scss";
|
|
18
|
+
@use "../../variables.scss";
|
|
19
|
+
|
|
20
|
+
.popover {
|
|
21
|
+
$transition-property: transform, opacity;
|
|
22
|
+
|
|
23
|
+
position: fixed;
|
|
24
|
+
z-index: variables.$popover-z-index;
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
background-color: var(--light);
|
|
27
|
+
border-radius: 0.125rem;
|
|
28
|
+
box-shadow:
|
|
29
|
+
0px 4px 5px 0px rgba(1, 5, 50, 0.2),
|
|
30
|
+
0px 3px 14px 0px rgba(1, 5, 50, 0.12),
|
|
31
|
+
0px 8px 10px 0px rgba(1, 5, 50, 0.14);
|
|
32
|
+
opacity: 0;
|
|
33
|
+
transform: scale(0.5);
|
|
34
|
+
|
|
35
|
+
@include mixins.transition($transition-property, 0.2s, ease-in-out);
|
|
36
|
+
|
|
37
|
+
&.show {
|
|
38
|
+
transform: scale(1);
|
|
39
|
+
pointer-events: auto;
|
|
40
|
+
opacity: 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
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 React, {
|
|
18
|
+
ForwardRefRenderFunction,
|
|
19
|
+
ComponentPropsWithRef,
|
|
20
|
+
ReactNode,
|
|
21
|
+
RefObject,
|
|
22
|
+
useEffect,
|
|
23
|
+
useRef,
|
|
24
|
+
useState
|
|
25
|
+
} from "react";
|
|
26
|
+
import { Offset, Placement, PositionType, usePosition } from "../../hooks/usePosition";
|
|
27
|
+
import classes from "./Popover.module.scss";
|
|
28
|
+
|
|
29
|
+
export interface Props extends ComponentPropsWithRef<"div"> {
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
show?: boolean;
|
|
32
|
+
anchorEl?: RefObject<HTMLOrSVGElement>; //eslint-disable-line no-undef
|
|
33
|
+
placement?: Placement;
|
|
34
|
+
offset?: Offset;
|
|
35
|
+
debounceAmount?: number;
|
|
36
|
+
transformOrigin?: Placement;
|
|
37
|
+
onAnchorOutOfView?: () => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const PopoverComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
|
|
41
|
+
{
|
|
42
|
+
children,
|
|
43
|
+
className,
|
|
44
|
+
show,
|
|
45
|
+
placement,
|
|
46
|
+
offset,
|
|
47
|
+
debounceAmount,
|
|
48
|
+
transformOrigin,
|
|
49
|
+
anchorEl,
|
|
50
|
+
onAnchorOutOfView,
|
|
51
|
+
...rest
|
|
52
|
+
},
|
|
53
|
+
ref
|
|
54
|
+
) => {
|
|
55
|
+
const [showPopover, setShowPopover] = useState(false);
|
|
56
|
+
const elToBePositioned = useRef<HTMLDivElement>(null);
|
|
57
|
+
const { top, left, right, bottom, calculatePosition, initialCalculationDone } = usePosition({
|
|
58
|
+
elementToBePositioned: elToBePositioned,
|
|
59
|
+
relativeElement: anchorEl,
|
|
60
|
+
offset: offset,
|
|
61
|
+
placement: placement,
|
|
62
|
+
transformOrigin: transformOrigin,
|
|
63
|
+
debounceAmount: debounceAmount ?? undefined
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const normalizePosition = (value: PositionType) => {
|
|
67
|
+
if (value === "initial") {
|
|
68
|
+
return "initial";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (isNaN(value)) {
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return Number(value);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (initialCalculationDone) {
|
|
80
|
+
setShowPopover(!!show);
|
|
81
|
+
}
|
|
82
|
+
}, [show, initialCalculationDone]);
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (!showPopover) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
window.addEventListener("resize", calculatePosition);
|
|
90
|
+
window.addEventListener("scroll", calculatePosition);
|
|
91
|
+
|
|
92
|
+
return () => {
|
|
93
|
+
window.removeEventListener("resize", calculatePosition);
|
|
94
|
+
window.removeEventListener("scroll", calculatePosition);
|
|
95
|
+
};
|
|
96
|
+
}, [showPopover]);
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
calculatePosition();
|
|
100
|
+
}, [showPopover, elToBePositioned, anchorEl]);
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
const anchor = anchorEl?.current as HTMLElement;
|
|
104
|
+
|
|
105
|
+
if (anchor) {
|
|
106
|
+
const anchorTop = anchor.getBoundingClientRect().top;
|
|
107
|
+
const anchorBottom = anchor.getBoundingClientRect().bottom;
|
|
108
|
+
|
|
109
|
+
const isAnchorOffscreen =
|
|
110
|
+
showPopover &&
|
|
111
|
+
(Number(top) < 0 ||
|
|
112
|
+
Number(left) < 0 ||
|
|
113
|
+
Number(right) < 0 ||
|
|
114
|
+
Number(bottom) < 0 ||
|
|
115
|
+
anchorTop < 0 ||
|
|
116
|
+
anchorBottom > window.innerHeight);
|
|
117
|
+
|
|
118
|
+
if (isAnchorOffscreen) {
|
|
119
|
+
onAnchorOutOfView?.();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, [top, left, right, bottom]);
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<div ref={ref} {...rest}>
|
|
126
|
+
<div
|
|
127
|
+
ref={elToBePositioned}
|
|
128
|
+
className={`${classes.popover} ${className ?? ""} ${showPopover ? classes.show : ""}`}
|
|
129
|
+
style={{
|
|
130
|
+
top: normalizePosition(top),
|
|
131
|
+
left: normalizePosition(left),
|
|
132
|
+
right: normalizePosition(right),
|
|
133
|
+
bottom: normalizePosition(bottom)
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
{children}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const Popover = React.forwardRef(PopoverComponent);
|