@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,146 @@
|
|
|
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, { ComponentPropsWithRef, ForwardRefRenderFunction, Fragment } from "react";
|
|
18
|
+
import { Icon, Icons } from "../../Icon/Icon";
|
|
19
|
+
import { RemoveButton } from "../../Tag/RemoveButton";
|
|
20
|
+
import { Typography } from "../../Typography/Typography";
|
|
21
|
+
import classes from "./DataGridFilter.module.scss";
|
|
22
|
+
import {
|
|
23
|
+
Filter,
|
|
24
|
+
FilterEditorMode,
|
|
25
|
+
TagTranslations,
|
|
26
|
+
DataGridColumnMetadata
|
|
27
|
+
} from "./DataGridFilters.interfaces";
|
|
28
|
+
|
|
29
|
+
export interface DataGridFilterTagProps extends ComponentPropsWithRef<"div"> {
|
|
30
|
+
customEditTagContent?: React.ReactElement;
|
|
31
|
+
triggerRef: React.Ref<HTMLButtonElement>;
|
|
32
|
+
filter?: Filter;
|
|
33
|
+
mode: FilterEditorMode;
|
|
34
|
+
onFilterRemove?: () => void;
|
|
35
|
+
onFilterOpen: () => void;
|
|
36
|
+
translations?: TagTranslations;
|
|
37
|
+
dateTagCaption?: string;
|
|
38
|
+
columnsMetadata?: DataGridColumnMetadata[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const EditTagContent = ({
|
|
42
|
+
filter,
|
|
43
|
+
or,
|
|
44
|
+
other,
|
|
45
|
+
columnsMetadata
|
|
46
|
+
}: {
|
|
47
|
+
filter: Filter;
|
|
48
|
+
or: string;
|
|
49
|
+
other: string;
|
|
50
|
+
columnsMetadata?: DataGridColumnMetadata[];
|
|
51
|
+
}) => {
|
|
52
|
+
const { column, operator, value } = filter;
|
|
53
|
+
const columnHeadlineWithFallback =
|
|
54
|
+
columnsMetadata?.find(meta => meta.name === column)?.headline || column;
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Fragment>
|
|
58
|
+
{columnHeadlineWithFallback} {operator?.name} {value.length > 0 && <b>{value[0]}</b>}
|
|
59
|
+
{value.length >= 2 && (
|
|
60
|
+
<>
|
|
61
|
+
{" "}
|
|
62
|
+
{or}{" "}
|
|
63
|
+
<b>
|
|
64
|
+
{value.length - 1} {other}
|
|
65
|
+
</b>
|
|
66
|
+
</>
|
|
67
|
+
)}
|
|
68
|
+
</Fragment>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const DataGridFilterTagComponent: ForwardRefRenderFunction<
|
|
73
|
+
HTMLDivElement,
|
|
74
|
+
DataGridFilterTagProps
|
|
75
|
+
> = (
|
|
76
|
+
{
|
|
77
|
+
triggerRef,
|
|
78
|
+
filter,
|
|
79
|
+
mode,
|
|
80
|
+
onFilterRemove,
|
|
81
|
+
onFilterOpen,
|
|
82
|
+
translations,
|
|
83
|
+
dateTagCaption,
|
|
84
|
+
customEditTagContent,
|
|
85
|
+
columnsMetadata,
|
|
86
|
+
...rest
|
|
87
|
+
}: DataGridFilterTagProps,
|
|
88
|
+
ref
|
|
89
|
+
) => {
|
|
90
|
+
const {
|
|
91
|
+
addButtonCaption = "Add filter",
|
|
92
|
+
or = "or",
|
|
93
|
+
other = "other",
|
|
94
|
+
dateIs = "Date is"
|
|
95
|
+
} = translations || {};
|
|
96
|
+
const shouldRenderAddTag = mode === "ADD";
|
|
97
|
+
const shouldRenderEditTag = mode === "EDIT" && filter;
|
|
98
|
+
const shouldRenderAddDateTag = mode === "ADD_DATE";
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div {...rest} ref={ref} className={classes["filter-wrapper"]}>
|
|
102
|
+
<button
|
|
103
|
+
ref={triggerRef}
|
|
104
|
+
type="button"
|
|
105
|
+
className={classes["filter-button"]}
|
|
106
|
+
onClick={onFilterOpen}
|
|
107
|
+
>
|
|
108
|
+
{shouldRenderAddTag && (
|
|
109
|
+
<Fragment>
|
|
110
|
+
<Icon icon={Icons.AddCircle} />
|
|
111
|
+
<Typography variant="body" className={classes["caption"]}>
|
|
112
|
+
{addButtonCaption}
|
|
113
|
+
</Typography>
|
|
114
|
+
</Fragment>
|
|
115
|
+
)}
|
|
116
|
+
{shouldRenderEditTag && (
|
|
117
|
+
<Typography variant="body" className={classes["caption"]}>
|
|
118
|
+
{customEditTagContent ? (
|
|
119
|
+
React.cloneElement(customEditTagContent, { filter })
|
|
120
|
+
) : (
|
|
121
|
+
<EditTagContent
|
|
122
|
+
filter={filter}
|
|
123
|
+
or={or}
|
|
124
|
+
other={other}
|
|
125
|
+
columnsMetadata={columnsMetadata}
|
|
126
|
+
/>
|
|
127
|
+
)}
|
|
128
|
+
</Typography>
|
|
129
|
+
)}
|
|
130
|
+
{shouldRenderAddDateTag && (
|
|
131
|
+
<Fragment>
|
|
132
|
+
<Icon icon={Icons.Calendar} />
|
|
133
|
+
<Typography variant="body" className={classes["caption"]}>
|
|
134
|
+
{dateIs} <b>{dateTagCaption}</b>
|
|
135
|
+
</Typography>
|
|
136
|
+
</Fragment>
|
|
137
|
+
)}
|
|
138
|
+
</button>
|
|
139
|
+
{shouldRenderEditTag && (
|
|
140
|
+
<RemoveButton className={classes["remove-button"]} onRemove={onFilterRemove} />
|
|
141
|
+
)}
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const DataGridFilterTag = React.forwardRef(DataGridFilterTagComponent);
|
|
@@ -0,0 +1,136 @@
|
|
|
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, { useCallback, useState } from "react";
|
|
18
|
+
import { Option } from "../../Form/Select/SingleSelect/Option";
|
|
19
|
+
import { MultiOption } from "../../Form/Select/MultiSelect/MultiOption";
|
|
20
|
+
import { MultiSelectWrapper } from "../../Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper";
|
|
21
|
+
import { SelectWrapper } from "../../Form/Wrapper/SelectWrapper/SelectWrapper";
|
|
22
|
+
import {
|
|
23
|
+
DataGridColumnMetadata,
|
|
24
|
+
PopoverTranslations,
|
|
25
|
+
ValueSelectType
|
|
26
|
+
} from "./DataGridFilters.interfaces";
|
|
27
|
+
|
|
28
|
+
export type Props = {
|
|
29
|
+
column: string;
|
|
30
|
+
columnsMetadata: DataGridColumnMetadata[];
|
|
31
|
+
values: string[];
|
|
32
|
+
pickedValues: string[];
|
|
33
|
+
setValues: (values: React.SetStateAction<string[]>) => void;
|
|
34
|
+
setPickedValues: (pickedValues: React.SetStateAction<string[]>) => void;
|
|
35
|
+
translations?: PopoverTranslations;
|
|
36
|
+
operator?: { allowEmptyValues: boolean } | null;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const DataGridFilterValueSelect = ({
|
|
40
|
+
column,
|
|
41
|
+
columnsMetadata,
|
|
42
|
+
values,
|
|
43
|
+
pickedValues,
|
|
44
|
+
setValues,
|
|
45
|
+
setPickedValues,
|
|
46
|
+
translations,
|
|
47
|
+
operator
|
|
48
|
+
}: Props) => {
|
|
49
|
+
const [touched, setTouched] = useState(false);
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
valueSelectLabel = "Value",
|
|
53
|
+
addNewValueLabel = "Create new",
|
|
54
|
+
addNewValueButtonTitle = "Add new select value"
|
|
55
|
+
} = translations || {};
|
|
56
|
+
|
|
57
|
+
const columnMetadata = columnsMetadata.find(({ name }) => name === column);
|
|
58
|
+
const disableAddNew = columnMetadata?.disableAddNew;
|
|
59
|
+
const valueSelectType = columnMetadata?.valueSelectType;
|
|
60
|
+
|
|
61
|
+
const isValueRequired = operator && !operator.allowEmptyValues;
|
|
62
|
+
const hasValidationError = Boolean(isValueRequired && pickedValues.length === 0 && touched);
|
|
63
|
+
|
|
64
|
+
const addNewBtnProps: React.ButtonHTMLAttributes<HTMLButtonElement> = {
|
|
65
|
+
title: addNewValueButtonTitle,
|
|
66
|
+
type: "button"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const onChangeHandler = useCallback(
|
|
70
|
+
(e: React.ChangeEvent<HTMLSelectElement>) => {
|
|
71
|
+
const { selectedOptions, value } = e.target;
|
|
72
|
+
|
|
73
|
+
let newValues: string[];
|
|
74
|
+
|
|
75
|
+
if (valueSelectType === ValueSelectType.single) {
|
|
76
|
+
newValues = value ? [value] : [];
|
|
77
|
+
} else {
|
|
78
|
+
newValues = Array.from(selectedOptions, option => option.value);
|
|
79
|
+
}
|
|
80
|
+
setPickedValues(newValues);
|
|
81
|
+
setTouched(true);
|
|
82
|
+
},
|
|
83
|
+
[valueSelectType]
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const selectProps = {
|
|
87
|
+
addNew: disableAddNew
|
|
88
|
+
? undefined
|
|
89
|
+
: {
|
|
90
|
+
label: addNewValueLabel,
|
|
91
|
+
onAddNew: (value: string) => {
|
|
92
|
+
if (value) {
|
|
93
|
+
setValues(prev => [...prev, value]);
|
|
94
|
+
setPickedValues(prev => [...prev, value]);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
btnProps: addNewBtnProps
|
|
98
|
+
},
|
|
99
|
+
search: {
|
|
100
|
+
enabled: true,
|
|
101
|
+
renderThreshold: 0
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return ValueSelectType.single === valueSelectType ? (
|
|
106
|
+
<SelectWrapper
|
|
107
|
+
label={valueSelectLabel}
|
|
108
|
+
name={"value"}
|
|
109
|
+
value={pickedValues[0]}
|
|
110
|
+
onChange={onChangeHandler}
|
|
111
|
+
selectProps={selectProps}
|
|
112
|
+
error={hasValidationError}
|
|
113
|
+
>
|
|
114
|
+
{values.map(value => (
|
|
115
|
+
<Option key={value} value={value}>
|
|
116
|
+
{value}
|
|
117
|
+
</Option>
|
|
118
|
+
))}
|
|
119
|
+
</SelectWrapper>
|
|
120
|
+
) : (
|
|
121
|
+
<MultiSelectWrapper
|
|
122
|
+
label={valueSelectLabel}
|
|
123
|
+
name={"value"}
|
|
124
|
+
value={pickedValues}
|
|
125
|
+
onChange={onChangeHandler}
|
|
126
|
+
selectProps={selectProps}
|
|
127
|
+
error={hasValidationError}
|
|
128
|
+
>
|
|
129
|
+
{values.map(value => (
|
|
130
|
+
<MultiOption key={value} value={value}>
|
|
131
|
+
{value}
|
|
132
|
+
</MultiOption>
|
|
133
|
+
))}
|
|
134
|
+
</MultiSelectWrapper>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
export interface FilterOperator {
|
|
18
|
+
name: string;
|
|
19
|
+
allowEmptyValues: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Filter {
|
|
23
|
+
id: string;
|
|
24
|
+
column: string;
|
|
25
|
+
operator: FilterOperator | null;
|
|
26
|
+
value: string[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type FiltersAction =
|
|
30
|
+
| {
|
|
31
|
+
type: "add";
|
|
32
|
+
payload: Filter;
|
|
33
|
+
}
|
|
34
|
+
| {
|
|
35
|
+
type: "edit";
|
|
36
|
+
payload: Filter;
|
|
37
|
+
}
|
|
38
|
+
| {
|
|
39
|
+
type: "remove";
|
|
40
|
+
payload: { id: string };
|
|
41
|
+
}
|
|
42
|
+
| {
|
|
43
|
+
type: "reset";
|
|
44
|
+
payload: Filter[];
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
type: "clear";
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type FiltersState = {
|
|
51
|
+
filters: Filter[];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type FilterEditorMode = "ADD" | "EDIT" | "ADD_DATE";
|
|
55
|
+
|
|
56
|
+
export const DefaultOperators: Record<string, FilterOperator> = {
|
|
57
|
+
is: { name: "is", allowEmptyValues: false },
|
|
58
|
+
isNot: { name: "is not", allowEmptyValues: false },
|
|
59
|
+
contains: { name: "contains", allowEmptyValues: false },
|
|
60
|
+
doesNotContain: { name: "does not contain", allowEmptyValues: false },
|
|
61
|
+
isEmpty: { name: "is empty", allowEmptyValues: true }
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export interface DataGridColumnMetadata {
|
|
65
|
+
name: string;
|
|
66
|
+
headline: string;
|
|
67
|
+
operators?: FilterOperator[];
|
|
68
|
+
defaultValues?: string[];
|
|
69
|
+
disableAddNew?: boolean;
|
|
70
|
+
allowSingleFilterOnly?: boolean;
|
|
71
|
+
valueSelectType?: ValueSelectType;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface PopoverTranslations {
|
|
75
|
+
columnSelectLabel?: string;
|
|
76
|
+
operatorSelectLabel?: string;
|
|
77
|
+
valueSelectLabel?: string;
|
|
78
|
+
addNewValueLabel?: string;
|
|
79
|
+
addNewValueButtonTitle?: string;
|
|
80
|
+
submitButtonTitle?: string;
|
|
81
|
+
cancelButtonTitle?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface TagTranslations {
|
|
85
|
+
addButtonCaption?: string;
|
|
86
|
+
or?: string;
|
|
87
|
+
other?: string;
|
|
88
|
+
dateIs?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ToolbarTranslations {
|
|
92
|
+
clearButtonCaption?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface FiltersTranslations {
|
|
96
|
+
toolbar?: ToolbarTranslations;
|
|
97
|
+
tag?: TagTranslations;
|
|
98
|
+
popover?: PopoverTranslations;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface KeyValuePair<TKey = string, TValue = string> {
|
|
102
|
+
key: TKey;
|
|
103
|
+
value: TValue;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export type DateTimeFilterType =
|
|
107
|
+
| "THIRTY_SECONDS"
|
|
108
|
+
| "ONE_MINUTE"
|
|
109
|
+
| "FIVE_MINUTES"
|
|
110
|
+
| "ONE_HOUR"
|
|
111
|
+
| "TWENTY_FOUR_HOURS"
|
|
112
|
+
| "CUSTOM";
|
|
113
|
+
|
|
114
|
+
export interface DateTimeFilter {
|
|
115
|
+
fromDate: string;
|
|
116
|
+
toDate: string;
|
|
117
|
+
type: DateTimeFilterType;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export enum ValueSelectType {
|
|
121
|
+
single = "single",
|
|
122
|
+
multi = "multi"
|
|
123
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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, { useState, useEffect } from "react";
|
|
18
|
+
import {
|
|
19
|
+
InputWrapper,
|
|
20
|
+
Props as InputWrapperProps
|
|
21
|
+
} from "../../Form/Wrapper/InputWrapper/InputWrapper";
|
|
22
|
+
import { Icon, Icons } from "../../Icon/Icon";
|
|
23
|
+
import classes from "./DataGridToolbar.module.scss";
|
|
24
|
+
import { useDebouncedCallback } from "../../../hooks/useDebouncedCallback";
|
|
25
|
+
|
|
26
|
+
export interface DataGridSearchbarProps {
|
|
27
|
+
onSearch: (value: string) => void;
|
|
28
|
+
initialSearchValue?: string;
|
|
29
|
+
debounceTime?: number;
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
inputWrapperProps?: InputWrapperProps;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const DataGridSearchbar = ({
|
|
35
|
+
onSearch,
|
|
36
|
+
initialSearchValue,
|
|
37
|
+
debounceTime,
|
|
38
|
+
inputWrapperProps,
|
|
39
|
+
placeholder
|
|
40
|
+
}: DataGridSearchbarProps) => {
|
|
41
|
+
const [search, setSearch] = useState(initialSearchValue ?? "");
|
|
42
|
+
const debouncedCallback = useDebouncedCallback(onSearch, debounceTime ?? 500);
|
|
43
|
+
const onSearchCallback = debounceTime ? debouncedCallback : onSearch;
|
|
44
|
+
|
|
45
|
+
const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
46
|
+
onSearchCallback(event.target.value);
|
|
47
|
+
setSearch(event.target.value);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
initialSearchValue && setSearch(initialSearchValue);
|
|
52
|
+
}, [initialSearchValue]);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<InputWrapper
|
|
56
|
+
{...inputWrapperProps}
|
|
57
|
+
className={`${classes["searchbar"]} ${inputWrapperProps?.className ?? ""}`}
|
|
58
|
+
label={inputWrapperProps?.label ?? ""}
|
|
59
|
+
onChange={onChange}
|
|
60
|
+
type="search"
|
|
61
|
+
name={inputWrapperProps?.name ?? "searchbar"}
|
|
62
|
+
value={search}
|
|
63
|
+
inputProps={{
|
|
64
|
+
...inputWrapperProps?.inputProps,
|
|
65
|
+
type: "search",
|
|
66
|
+
prefix: <Icon icon={Icons.Search} />,
|
|
67
|
+
placeholder: placeholder ?? "Search items"
|
|
68
|
+
}}
|
|
69
|
+
></InputWrapper>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
|
|
19
|
+
@include mixins.searchInputPointer("search", ".wrapper");
|
|
20
|
+
|
|
21
|
+
.wrapper {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: flex-start;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
gap: 0.5rem;
|
|
26
|
+
width: 100%;
|
|
27
|
+
padding-bottom: 1rem;
|
|
28
|
+
|
|
29
|
+
.filter-section {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: flex-start;
|
|
33
|
+
flex-wrap: wrap;
|
|
34
|
+
gap: 0.5rem;
|
|
35
|
+
width: 100%;
|
|
36
|
+
flex-grow: 1;
|
|
37
|
+
|
|
38
|
+
.searchbar {
|
|
39
|
+
min-width: 7rem;
|
|
40
|
+
flex-basis: 15rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.actions-wrapper {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: flex-start;
|
|
47
|
+
gap: 0.5rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.clear-button {
|
|
51
|
+
background: none;
|
|
52
|
+
border: none;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
@include mixins.focusVisibleOutline($outlineOffset: 0);
|
|
55
|
+
|
|
56
|
+
.caption {
|
|
57
|
+
margin: 0;
|
|
58
|
+
font-size: var(--font-size-data-grid);
|
|
59
|
+
line-height: var(--data-grid-line-height);
|
|
60
|
+
text-decoration: underline;
|
|
61
|
+
color: var(--color-primary500);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.button-section {
|
|
67
|
+
flex-shrink: 0;
|
|
68
|
+
display: flex;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
align-items: center;
|
|
71
|
+
gap: 0.5rem;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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, { Fragment, useEffect, useRef } from "react";
|
|
18
|
+
import { DataGridFilter } from "./DataGridFilter";
|
|
19
|
+
import classes from "./DataGridToolbar.module.scss";
|
|
20
|
+
import {
|
|
21
|
+
DataGridColumnMetadata,
|
|
22
|
+
DateTimeFilter,
|
|
23
|
+
Filter,
|
|
24
|
+
FiltersTranslations
|
|
25
|
+
} from "./DataGridFilters.interfaces";
|
|
26
|
+
import { Typography } from "../../Typography/Typography";
|
|
27
|
+
import { useFiltersReducer } from "./useFiltersReducer";
|
|
28
|
+
import { DataGridDateFilter } from "./DataGridDateFilter";
|
|
29
|
+
|
|
30
|
+
export interface DataGridToolbarProps {
|
|
31
|
+
columnsMetadata?: DataGridColumnMetadata[];
|
|
32
|
+
customEditTagContent?: React.ReactElement;
|
|
33
|
+
dateFilterValue?: DateTimeFilter;
|
|
34
|
+
onDateFilterValueChange?: (dateTimeFilter: DateTimeFilter) => void;
|
|
35
|
+
filterValues?: Filter[];
|
|
36
|
+
translations?: FiltersTranslations;
|
|
37
|
+
onFilterAdd?: (filter: Filter) => void;
|
|
38
|
+
onFilterEdit?: (filter: Filter) => void;
|
|
39
|
+
onFilterDelete?: (id: string) => void;
|
|
40
|
+
onFiltersClear?: () => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const DataGridToolbar = ({
|
|
44
|
+
columnsMetadata,
|
|
45
|
+
filterValues,
|
|
46
|
+
translations,
|
|
47
|
+
onFilterAdd,
|
|
48
|
+
onFilterEdit,
|
|
49
|
+
onFilterDelete,
|
|
50
|
+
dateFilterValue,
|
|
51
|
+
onDateFilterValueChange,
|
|
52
|
+
onFiltersClear,
|
|
53
|
+
customEditTagContent
|
|
54
|
+
}: DataGridToolbarProps) => {
|
|
55
|
+
const { state, addFilter, editFilter, deleteFilter, resetFilters, clearFilters } =
|
|
56
|
+
useFiltersReducer(filterValues);
|
|
57
|
+
|
|
58
|
+
const isFirstRenderRef = useRef(true);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (!isFirstRenderRef.current && filterValues) {
|
|
62
|
+
resetFilters(filterValues);
|
|
63
|
+
}
|
|
64
|
+
}, [filterValues]);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
isFirstRenderRef.current = false;
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
const { clearButtonCaption = "Clear all filters" } = translations?.toolbar || {};
|
|
71
|
+
return (
|
|
72
|
+
<Fragment>
|
|
73
|
+
{dateFilterValue && (
|
|
74
|
+
<DataGridDateFilter
|
|
75
|
+
dateFilterValue={dateFilterValue}
|
|
76
|
+
onDateFilterValueChange={onDateFilterValueChange}
|
|
77
|
+
/>
|
|
78
|
+
)}
|
|
79
|
+
{columnsMetadata &&
|
|
80
|
+
state.filters.map(filter => (
|
|
81
|
+
<DataGridFilter
|
|
82
|
+
mode="EDIT"
|
|
83
|
+
key={filter.id}
|
|
84
|
+
filter={filter}
|
|
85
|
+
columnsMetadata={columnsMetadata}
|
|
86
|
+
filterState={state}
|
|
87
|
+
onFilterEdit={filter => {
|
|
88
|
+
editFilter(filter);
|
|
89
|
+
onFilterEdit && onFilterEdit(filter);
|
|
90
|
+
}}
|
|
91
|
+
onFilterDelete={id => {
|
|
92
|
+
deleteFilter(id);
|
|
93
|
+
onFilterDelete && onFilterDelete(id);
|
|
94
|
+
}}
|
|
95
|
+
tagTranslations={translations?.tag}
|
|
96
|
+
popoverTranslations={translations?.popover}
|
|
97
|
+
customEditTagContent={customEditTagContent}
|
|
98
|
+
/>
|
|
99
|
+
))}
|
|
100
|
+
<div className={classes["actions-wrapper"]}>
|
|
101
|
+
{columnsMetadata && (
|
|
102
|
+
<DataGridFilter
|
|
103
|
+
mode="ADD"
|
|
104
|
+
customEditTagContent={customEditTagContent}
|
|
105
|
+
columnsMetadata={columnsMetadata}
|
|
106
|
+
filterState={state}
|
|
107
|
+
onFilterAdd={filter => {
|
|
108
|
+
addFilter(filter);
|
|
109
|
+
onFilterAdd && onFilterAdd(filter);
|
|
110
|
+
}}
|
|
111
|
+
tagTranslations={translations?.tag}
|
|
112
|
+
popoverTranslations={translations?.popover}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
115
|
+
{columnsMetadata && state.filters.length >= 1 && (
|
|
116
|
+
<button
|
|
117
|
+
type="button"
|
|
118
|
+
className={classes["clear-button"]}
|
|
119
|
+
onClick={() => {
|
|
120
|
+
clearFilters();
|
|
121
|
+
onFiltersClear && onFiltersClear();
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
<Typography variant="body" className={classes["caption"]}>
|
|
125
|
+
{clearButtonCaption}
|
|
126
|
+
</Typography>
|
|
127
|
+
</button>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
</Fragment>
|
|
131
|
+
);
|
|
132
|
+
};
|