@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,214 @@
|
|
|
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, { ButtonHTMLAttributes, useContext, useEffect, useRef } from "react";
|
|
18
|
+
import { IconButton } from "../../../Button/IconButton";
|
|
19
|
+
import { Icon, Icons } from "../../../Icon/Icon";
|
|
20
|
+
import classes from "./AlertItem.module.scss";
|
|
21
|
+
import readyclasses from "../../../../readyclasses.module.scss";
|
|
22
|
+
import { useAnimation } from "../../../../hooks/useAnimation";
|
|
23
|
+
import { Typography } from "../../../Typography/Typography";
|
|
24
|
+
import AlertContext from "../AlertProvider/AlertContext";
|
|
25
|
+
|
|
26
|
+
export const EMPHASES = ["low", "medium", "high"] as const;
|
|
27
|
+
export type Emphasis = (typeof EMPHASES)[keyof typeof EMPHASES];
|
|
28
|
+
|
|
29
|
+
export const VARIANTS = ["neutral", "informative", "success", "warning", "error"] as const;
|
|
30
|
+
export type Variant = (typeof VARIANTS)[keyof typeof VARIANTS];
|
|
31
|
+
|
|
32
|
+
export type Actions = (ButtonHTMLAttributes<HTMLButtonElement> & { label: string })[];
|
|
33
|
+
|
|
34
|
+
export interface Props {
|
|
35
|
+
id: string;
|
|
36
|
+
title?: string | React.ReactNode;
|
|
37
|
+
content?: string | React.ReactNode;
|
|
38
|
+
duration?: number;
|
|
39
|
+
emphasis?: Emphasis;
|
|
40
|
+
variant?: Variant;
|
|
41
|
+
className?: string;
|
|
42
|
+
onClose?: () => void;
|
|
43
|
+
closeButtonTitle?: string;
|
|
44
|
+
actions?: Actions;
|
|
45
|
+
wasShown?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const useRegisterAlertHeight = (
|
|
49
|
+
singleAlertRef: React.RefObject<HTMLDivElement>,
|
|
50
|
+
alertId: string
|
|
51
|
+
) => {
|
|
52
|
+
const ctx = useContext(AlertContext);
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (singleAlertRef.current) {
|
|
56
|
+
ctx.setAlertHeight(alertId, singleAlertRef.current.getBoundingClientRect().height);
|
|
57
|
+
}
|
|
58
|
+
}, [singleAlertRef.current]);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
let actionButtonKeyCounter = 1;
|
|
62
|
+
export const AlertItem = ({
|
|
63
|
+
id,
|
|
64
|
+
title,
|
|
65
|
+
duration,
|
|
66
|
+
variant = "neutral",
|
|
67
|
+
emphasis = "low",
|
|
68
|
+
content,
|
|
69
|
+
className,
|
|
70
|
+
actions = [],
|
|
71
|
+
onClose,
|
|
72
|
+
closeButtonTitle,
|
|
73
|
+
wasShown
|
|
74
|
+
}: Props) => {
|
|
75
|
+
const timerHandler = useRef<ReturnType<typeof setTimeout>>();
|
|
76
|
+
const onAnimationEnd = () => {
|
|
77
|
+
onClose?.();
|
|
78
|
+
};
|
|
79
|
+
const { ref, animationStarted, startAnimation } = useAnimation<HTMLDivElement>(onAnimationEnd);
|
|
80
|
+
|
|
81
|
+
useRegisterAlertHeight(ref, id);
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (duration && duration > 0) {
|
|
85
|
+
timerHandler.current = setTimeout(() => startAnimation(), duration);
|
|
86
|
+
}
|
|
87
|
+
if (ref) {
|
|
88
|
+
ref.current?.addEventListener("focus", onItemFocus);
|
|
89
|
+
ref.current?.addEventListener("blur", onItemBlur);
|
|
90
|
+
ref.current?.addEventListener("mouseenter", onItemFocus);
|
|
91
|
+
ref.current?.addEventListener("mouseleave", onItemBlur);
|
|
92
|
+
}
|
|
93
|
+
return () => {
|
|
94
|
+
timerHandler.current && clearTimeout(timerHandler.current);
|
|
95
|
+
};
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
const onItemFocus = () => {
|
|
99
|
+
timerHandler.current && clearTimeout(timerHandler.current);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const onItemBlur = () => {
|
|
103
|
+
if (duration && duration > 0) {
|
|
104
|
+
timerHandler.current = setTimeout(() => startAnimation(), duration);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const getVariantIcon = () => {
|
|
109
|
+
if (variant === "error") {
|
|
110
|
+
return Icons.ErrorAlt;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (variant === "warning") {
|
|
114
|
+
return Icons.Warning;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return variant === "success" ? Icons.CheckmarkCircleAlt : Icons.InfoCircle;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const actionButtons = actions.map(actionProp => (
|
|
121
|
+
<button
|
|
122
|
+
key={`alert-action-button-${(actionButtonKeyCounter++).toString()}`}
|
|
123
|
+
{...actionProp}
|
|
124
|
+
onClick={e => {
|
|
125
|
+
onClose?.();
|
|
126
|
+
actionProp.onClick?.(e);
|
|
127
|
+
}}
|
|
128
|
+
className={classes["action-button"]}
|
|
129
|
+
>
|
|
130
|
+
{actionProp.label}
|
|
131
|
+
</button>
|
|
132
|
+
));
|
|
133
|
+
|
|
134
|
+
const getAlertClasses = (): string => {
|
|
135
|
+
const alertClasses = [classes["alert"], classes[`${variant}`], classes[`emph-${emphasis}`]];
|
|
136
|
+
if (animationStarted) {
|
|
137
|
+
alertClasses.push(readyclasses["slide-out"]);
|
|
138
|
+
}
|
|
139
|
+
if (!animationStarted && !wasShown) {
|
|
140
|
+
alertClasses.push(readyclasses["slide-in"]);
|
|
141
|
+
}
|
|
142
|
+
if (className) {
|
|
143
|
+
alertClasses.push(className);
|
|
144
|
+
}
|
|
145
|
+
return alertClasses.join(" ");
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const getAria = () => {
|
|
149
|
+
if (variant === "error" && (emphasis === "medium" || emphasis === "high")) {
|
|
150
|
+
return "assertive";
|
|
151
|
+
}
|
|
152
|
+
return "polite";
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const getContentOrTitle = () => {
|
|
156
|
+
if (content) {
|
|
157
|
+
return content;
|
|
158
|
+
}
|
|
159
|
+
return title;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<div
|
|
164
|
+
{...{ ["data-testid"]: "alert-container" }}
|
|
165
|
+
ref={ref}
|
|
166
|
+
aria-live={getAria()}
|
|
167
|
+
className={getAlertClasses()}
|
|
168
|
+
role="alert"
|
|
169
|
+
>
|
|
170
|
+
<div className={classes["outer-content-wrapper"]}>
|
|
171
|
+
<Icon icon={getVariantIcon()} className={classes["icon"]} />
|
|
172
|
+
<div className={classes["content-wrapper"]} role="log">
|
|
173
|
+
{!!title && !!content && (
|
|
174
|
+
<Typography
|
|
175
|
+
{...{ ["data-testid"]: "alert-title" }}
|
|
176
|
+
className={classes["title"]}
|
|
177
|
+
variant="body-bold"
|
|
178
|
+
tag="span"
|
|
179
|
+
>
|
|
180
|
+
{title}
|
|
181
|
+
</Typography>
|
|
182
|
+
)}
|
|
183
|
+
{(!!content || !!title) && (
|
|
184
|
+
<Typography
|
|
185
|
+
{...{ ["data-testid"]: "alert-content" }}
|
|
186
|
+
className={classes["content"]}
|
|
187
|
+
variant="body"
|
|
188
|
+
>
|
|
189
|
+
{getContentOrTitle()}
|
|
190
|
+
</Typography>
|
|
191
|
+
)}
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
{actionButtons.length > 0 && (
|
|
195
|
+
<div {...{ ["data-testid"]: "alert-actions" }} className={classes["actions"]}>
|
|
196
|
+
{actionButtons}
|
|
197
|
+
</div>
|
|
198
|
+
)}
|
|
199
|
+
{onClose && (
|
|
200
|
+
<IconButton
|
|
201
|
+
className={classes["close-btn"]}
|
|
202
|
+
onClick={e => {
|
|
203
|
+
e.stopPropagation();
|
|
204
|
+
startAnimation();
|
|
205
|
+
}}
|
|
206
|
+
title={closeButtonTitle}
|
|
207
|
+
{...{ ["data-testid"]: "alert-close" }}
|
|
208
|
+
>
|
|
209
|
+
<Icon icon={Icons.Times} />
|
|
210
|
+
</IconButton>
|
|
211
|
+
)}
|
|
212
|
+
</div>
|
|
213
|
+
);
|
|
214
|
+
};
|
|
@@ -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
|
+
import { AlertEntry } from "./AlertProvider";
|
|
18
|
+
import { createContext } from "react";
|
|
19
|
+
|
|
20
|
+
export type AlertQueue = Omit<AlertEntry, "id">;
|
|
21
|
+
|
|
22
|
+
export interface AlertContextValue {
|
|
23
|
+
enqueueAlert: (entry: AlertQueue) => void;
|
|
24
|
+
enqueueInfoAlert: (entry: AlertQueue) => void;
|
|
25
|
+
enqueueSuccessAlert: (entry: AlertQueue) => void;
|
|
26
|
+
enqueueWarningAlert: (entry: AlertQueue) => void;
|
|
27
|
+
enqueueErrorAlert: (entry: AlertQueue) => void;
|
|
28
|
+
setAlertHeight: (id: string, height: number) => void;
|
|
29
|
+
alerts: AlertEntry[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const AlertContext = createContext<AlertContextValue>({
|
|
33
|
+
enqueueAlert: entry => null,
|
|
34
|
+
enqueueInfoAlert: entry => null,
|
|
35
|
+
enqueueSuccessAlert: entry => null,
|
|
36
|
+
enqueueErrorAlert: entry => null,
|
|
37
|
+
enqueueWarningAlert: entry => null,
|
|
38
|
+
setAlertHeight: (id, height) => null,
|
|
39
|
+
alerts: []
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export default AlertContext;
|
|
@@ -0,0 +1,173 @@
|
|
|
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, { ReactNode, useRef, useState, useMemo } from "react";
|
|
18
|
+
import { createPortal } from "react-dom";
|
|
19
|
+
import { Placement, AlertContainer } from "../AlertContainer/AlertContainer";
|
|
20
|
+
import { generateID } from "../../../../util/helper";
|
|
21
|
+
import { AlertItem, Props as AlertComponentProps, Variant } from "../AlertItem/AlertItem";
|
|
22
|
+
import { useGetDomRoot } from "../../../../hooks/useGetDomRoot";
|
|
23
|
+
import AlertContext, { AlertContextValue } from "./AlertContext";
|
|
24
|
+
|
|
25
|
+
/** Short msg is when only title is provided. Long one when content or/and actions are provided (or type is error). */
|
|
26
|
+
interface Duration {
|
|
27
|
+
long: number;
|
|
28
|
+
short: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface Props {
|
|
32
|
+
closeButtonTitle: string;
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
placement?: Placement;
|
|
35
|
+
stackSize?: number;
|
|
36
|
+
domRoot?: HTMLElement;
|
|
37
|
+
autoHideDuration?: Duration;
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type AlertEntry = AlertComponentProps & { height?: number };
|
|
42
|
+
|
|
43
|
+
export const AlertProvider = ({
|
|
44
|
+
closeButtonTitle,
|
|
45
|
+
placement = { vertical: "bottom", horizontal: "center" },
|
|
46
|
+
autoHideDuration = { long: 8000, short: 4000 },
|
|
47
|
+
stackSize = 3,
|
|
48
|
+
domRoot,
|
|
49
|
+
children,
|
|
50
|
+
className
|
|
51
|
+
}: Props) => {
|
|
52
|
+
const [alertEntries, setAlertEntries] = useState<AlertEntry[]>([]);
|
|
53
|
+
const wrappingDivRef = useRef(null);
|
|
54
|
+
const { root } = useGetDomRoot(domRoot, wrappingDivRef);
|
|
55
|
+
|
|
56
|
+
const getDuration = (entry: Omit<AlertEntry, "id">) => {
|
|
57
|
+
if (entry.variant === "error") {
|
|
58
|
+
return autoHideDuration.long;
|
|
59
|
+
}
|
|
60
|
+
if (entry.actions?.length) {
|
|
61
|
+
return autoHideDuration.long;
|
|
62
|
+
}
|
|
63
|
+
return autoHideDuration.short;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const buildEntryWithVariant = (arg: Omit<AlertEntry, "id">, variant?: Variant): AlertEntry => {
|
|
67
|
+
let closeTitle = closeButtonTitle;
|
|
68
|
+
if (arg.closeButtonTitle) {
|
|
69
|
+
closeTitle = arg.closeButtonTitle;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
...arg,
|
|
73
|
+
variant: variant ?? arg.variant,
|
|
74
|
+
id: generateID(),
|
|
75
|
+
duration: arg.duration ?? getDuration(arg),
|
|
76
|
+
closeButtonTitle: closeTitle
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const enqueueAlert = (arg: Omit<AlertEntry, "id">) => {
|
|
81
|
+
const newEntry = buildEntryWithVariant(arg);
|
|
82
|
+
setAlertEntries(entries => [...entries, newEntry]);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const enqueueInfoAlert: AlertContextValue["enqueueInfoAlert"] = arg => {
|
|
86
|
+
const newEntry: AlertEntry = buildEntryWithVariant(arg, "informative");
|
|
87
|
+
setAlertEntries(entries => [...entries, newEntry]);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const enqueueSuccessAlert: AlertContextValue["enqueueSuccessAlert"] = arg => {
|
|
91
|
+
const newEntry: AlertEntry = buildEntryWithVariant(arg, "success");
|
|
92
|
+
setAlertEntries(entries => [...entries, newEntry]);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const enqueueWarningAlert: AlertContextValue["enqueueWarningAlert"] = arg => {
|
|
96
|
+
const newEntry: AlertEntry = buildEntryWithVariant(arg, "warning");
|
|
97
|
+
setAlertEntries(entries => [...entries, newEntry]);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const enqueueErrorAlert: AlertContextValue["enqueueErrorAlert"] = arg => {
|
|
101
|
+
const newEntry: AlertEntry = buildEntryWithVariant(arg, "error");
|
|
102
|
+
setAlertEntries(entries => [...entries, newEntry]);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const setAlertHeight = (id: string, height: number) => {
|
|
106
|
+
const newAlertsState = alertEntries.map(alertEntry => {
|
|
107
|
+
if (alertEntry.id !== id) {
|
|
108
|
+
return alertEntry;
|
|
109
|
+
}
|
|
110
|
+
return { ...alertEntry, height };
|
|
111
|
+
});
|
|
112
|
+
setAlertEntries(newAlertsState);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const removeEntry = (entryId: string) => {
|
|
116
|
+
setAlertEntries(entries => {
|
|
117
|
+
return entries.filter((entry, idx) => {
|
|
118
|
+
if (idx < stackSize) {
|
|
119
|
+
entries[idx] = { ...entries[idx], wasShown: true };
|
|
120
|
+
}
|
|
121
|
+
return entry.id !== entryId;
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const renderAlertList = (): ReactNode => {
|
|
127
|
+
return alertEntries.slice(0, stackSize).map(entry => (
|
|
128
|
+
<AlertItem
|
|
129
|
+
{...entry}
|
|
130
|
+
key={`${entry.id}`}
|
|
131
|
+
onClose={() => {
|
|
132
|
+
removeEntry(entry.id);
|
|
133
|
+
entry.onClose?.();
|
|
134
|
+
}}
|
|
135
|
+
/>
|
|
136
|
+
));
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const contextValue = useMemo(
|
|
140
|
+
() => ({
|
|
141
|
+
enqueueAlert,
|
|
142
|
+
enqueueInfoAlert,
|
|
143
|
+
enqueueSuccessAlert,
|
|
144
|
+
enqueueErrorAlert,
|
|
145
|
+
enqueueWarningAlert,
|
|
146
|
+
setAlertHeight,
|
|
147
|
+
alerts: alertEntries
|
|
148
|
+
}),
|
|
149
|
+
[
|
|
150
|
+
enqueueAlert,
|
|
151
|
+
enqueueInfoAlert,
|
|
152
|
+
enqueueSuccessAlert,
|
|
153
|
+
enqueueErrorAlert,
|
|
154
|
+
enqueueWarningAlert,
|
|
155
|
+
setAlertHeight,
|
|
156
|
+
alertEntries
|
|
157
|
+
]
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
<AlertContext.Provider value={contextValue}>
|
|
162
|
+
{children}
|
|
163
|
+
<div ref={wrappingDivRef}>
|
|
164
|
+
{createPortal(
|
|
165
|
+
<AlertContainer placement={placement} className={className}>
|
|
166
|
+
{renderAlertList()}
|
|
167
|
+
</AlertContainer>,
|
|
168
|
+
root
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
</AlertContext.Provider>
|
|
172
|
+
);
|
|
173
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
$alert-item-width: 25rem;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { useContext } from "react";
|
|
18
|
+
import AlertContext from "./AlertProvider/AlertContext";
|
|
19
|
+
|
|
20
|
+
export const useAlert = () => {
|
|
21
|
+
const ctx = useContext(AlertContext);
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
enqueueAlert: ctx.enqueueAlert,
|
|
25
|
+
enqueueInfoAlert: ctx.enqueueInfoAlert,
|
|
26
|
+
enqueueSuccessAlert: ctx.enqueueSuccessAlert,
|
|
27
|
+
enqueueWarningAlert: ctx.enqueueWarningAlert,
|
|
28
|
+
enqueueErrorAlert: ctx.enqueueErrorAlert
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
.banner {
|
|
18
|
+
padding: 1rem 1.25rem;
|
|
19
|
+
background-color: var(--light);
|
|
20
|
+
display: flex;
|
|
21
|
+
border-width: 0 0 0 var(--banner-border-width);
|
|
22
|
+
border-style: solid;
|
|
23
|
+
flex-grow: 0;
|
|
24
|
+
border-radius: var(--banner-border-radius);
|
|
25
|
+
|
|
26
|
+
.container {
|
|
27
|
+
display: block;
|
|
28
|
+
margin-left: 1rem;
|
|
29
|
+
flex: 1;
|
|
30
|
+
color: var(--default);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.headline {
|
|
34
|
+
margin-bottom: 0.25rem;
|
|
35
|
+
}
|
|
36
|
+
.content {
|
|
37
|
+
margin-bottom: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.icon {
|
|
41
|
+
margin-top: 0.1rem;
|
|
42
|
+
font-size: var(--font-size-big);
|
|
43
|
+
line-height: var(--default-line-height);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.info {
|
|
47
|
+
border-color: var(--info);
|
|
48
|
+
.icon {
|
|
49
|
+
color: var(--info);
|
|
50
|
+
}
|
|
51
|
+
.headline {
|
|
52
|
+
color: var(--info);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.warning {
|
|
57
|
+
border-color: var(--warning);
|
|
58
|
+
.icon {
|
|
59
|
+
color: var(--warning);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.headline {
|
|
63
|
+
color: var(--warning);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
&.error {
|
|
67
|
+
border-color: var(--error);
|
|
68
|
+
.icon {
|
|
69
|
+
color: var(--error);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.headline {
|
|
73
|
+
color: var(--error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
AriaAttributes,
|
|
19
|
+
AriaRole,
|
|
20
|
+
ComponentPropsWithRef,
|
|
21
|
+
ForwardRefRenderFunction
|
|
22
|
+
} from "react";
|
|
23
|
+
import { Typography } from "../../Typography/Typography";
|
|
24
|
+
import { Icon, Icons } from "../../Icon/Icon";
|
|
25
|
+
import classes from "./Banner.module.scss";
|
|
26
|
+
|
|
27
|
+
export type BannerType = "error" | "warning" | "info";
|
|
28
|
+
export interface Props extends ComponentPropsWithRef<"section"> {
|
|
29
|
+
children: string;
|
|
30
|
+
ariaRole?: AriaRole;
|
|
31
|
+
ariaLive?: AriaAttributes["aria-live"];
|
|
32
|
+
ariaLabel?: AriaAttributes["aria-label"];
|
|
33
|
+
type: BannerType;
|
|
34
|
+
title: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const BannerComponent: ForwardRefRenderFunction<HTMLElement, Props> = (
|
|
38
|
+
{ children, ariaLabel, ariaRole, ariaLive, type, title, ...rest }: Props,
|
|
39
|
+
ref
|
|
40
|
+
) => {
|
|
41
|
+
const getIconVariant = (type: BannerType): Icons | null => {
|
|
42
|
+
switch (type) {
|
|
43
|
+
case "info":
|
|
44
|
+
return Icons.InfoCircle;
|
|
45
|
+
case "error":
|
|
46
|
+
return Icons.Error;
|
|
47
|
+
case "warning":
|
|
48
|
+
return Icons.Warning;
|
|
49
|
+
default:
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const icon = getIconVariant(type);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<section
|
|
58
|
+
{...rest}
|
|
59
|
+
ref={ref}
|
|
60
|
+
aria-live={ariaLive}
|
|
61
|
+
aria-label={ariaLabel}
|
|
62
|
+
role={ariaRole}
|
|
63
|
+
className={`${classes["banner"]} ${classes[type]}`}
|
|
64
|
+
>
|
|
65
|
+
{icon && <Icon icon={icon} className={classes["icon"]} />}
|
|
66
|
+
<div className={classes["container"]}>
|
|
67
|
+
<Typography variant={"h4"} className={classes["headline"]}>
|
|
68
|
+
{title}
|
|
69
|
+
</Typography>
|
|
70
|
+
<Typography variant={"body"} className={classes["content"]} tag={"p"}>
|
|
71
|
+
{children}
|
|
72
|
+
</Typography>
|
|
73
|
+
</div>
|
|
74
|
+
</section>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const Banner = React.forwardRef(BannerComponent);
|