@onewelcome/react-lib-components 10.0.1 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Breadcrumbs/Breadcrumbs.module.scss.cjs.js +2 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.module.scss.es.js +5 -5
- package/dist/components/Button/BaseButton.module.scss.cjs.js +2 -2
- package/dist/components/Button/BaseButton.module.scss.es.js +4 -4
- package/dist/components/Button/Button.module.scss.cjs.js +2 -2
- package/dist/components/Button/Button.module.scss.es.js +17 -17
- package/dist/components/Button/IconButton.module.scss.cjs.js +2 -2
- package/dist/components/Button/IconButton.module.scss.es.js +18 -18
- package/dist/components/ContextMenu/ContextMenu.cjs.js +1 -1
- package/dist/components/ContextMenu/ContextMenu.cjs.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.es.js +32 -19
- package/dist/components/ContextMenu/ContextMenu.es.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.module.scss.cjs.js +2 -2
- package/dist/components/ContextMenu/ContextMenu.module.scss.es.js +5 -5
- package/dist/components/ContextMenu/ContextMenuDivider.cjs.js +2 -0
- package/dist/components/ContextMenu/ContextMenuDivider.cjs.js.map +1 -0
- package/dist/components/ContextMenu/ContextMenuDivider.es.js +9 -0
- package/dist/components/ContextMenu/ContextMenuDivider.es.js.map +1 -0
- package/dist/components/ContextMenu/ContextMenuDivider.module.scss.cjs.js +3 -0
- package/dist/components/ContextMenu/ContextMenuDivider.module.scss.cjs.js.map +1 -0
- package/dist/components/ContextMenu/ContextMenuDivider.module.scss.es.js +8 -0
- package/dist/components/ContextMenu/ContextMenuDivider.module.scss.es.js.map +1 -0
- package/dist/components/ContextMenu/ContextMenuItem.module.scss.cjs.js +2 -2
- package/dist/components/ContextMenu/ContextMenuItem.module.scss.es.js +3 -3
- package/dist/components/DataGrid/DataGrid.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGrid.module.scss.es.js +6 -6
- package/dist/components/DataGrid/DataGridActions/DataGridActions.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridActions/DataGridActions.module.scss.es.js +6 -6
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.es.js +2 -2
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss.es.js +7 -7
- package/dist/components/DataGrid/DataGridBody/DataGridBody.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridBody.module.scss.es.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.module.scss.es.js +5 -5
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawer.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawer.module.scss.es.js +4 -4
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.module.scss.es.js +5 -5
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.es.js +11 -3
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.module.scss.es.js +24 -24
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.es.js +0 -8
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.module.scss.es.js +9 -9
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterPopover.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterPopover.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterPopover.es.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterPopover.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.es.js +4 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.module.scss.es.js +8 -8
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.es.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.module.scss.es.js +17 -17
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.module.scss.es.js +3 -3
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss.es.js +7 -7
- package/dist/components/DatePicker/DatePicker.module.scss.cjs.js +2 -2
- package/dist/components/DatePicker/DatePicker.module.scss.es.js +31 -31
- package/dist/components/Form/Checkbox/Checkbox.module.scss.cjs.js +2 -2
- package/dist/components/Form/Checkbox/Checkbox.module.scss.es.js +13 -13
- package/dist/components/Form/Fieldset/Fieldset.module.scss.cjs.js +2 -2
- package/dist/components/Form/Fieldset/Fieldset.module.scss.es.js +5 -5
- package/dist/components/Form/FileUpload/FileItem/FileItem.module.scss.cjs.js +2 -2
- package/dist/components/Form/FileUpload/FileItem/FileItem.module.scss.es.js +18 -18
- package/dist/components/Form/FileUpload/FileUpload.module.scss.cjs.js +2 -2
- package/dist/components/Form/FileUpload/FileUpload.module.scss.es.js +16 -16
- package/dist/components/Form/Form.module.scss.cjs.js +2 -2
- package/dist/components/Form/Form.module.scss.es.js +2 -2
- package/dist/components/Form/FormControl/FormControl.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormControl/FormControl.module.scss.es.js +13 -13
- package/dist/components/Form/FormErrorText/FormErrorText.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormErrorText/FormErrorText.module.scss.es.js +5 -5
- package/dist/components/Form/FormGroup/FormGroup.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormGroup/FormGroup.module.scss.es.js +3 -3
- package/dist/components/Form/FormHelperText/FormHelperText.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormHelperText/FormHelperText.module.scss.es.js +4 -4
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.module.scss.es.js +6 -6
- package/dist/components/Form/Input/Input.module.scss.cjs.js +2 -2
- package/dist/components/Form/Input/Input.module.scss.es.js +9 -9
- package/dist/components/Form/Label/Label.module.scss.cjs.js +2 -2
- package/dist/components/Form/Label/Label.module.scss.es.js +2 -2
- package/dist/components/Form/Radio/Radio.module.scss.cjs.js +2 -2
- package/dist/components/Form/Radio/Radio.module.scss.es.js +11 -11
- package/dist/components/Form/Select/MultiSelect/MultiSelect.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/MultiSelect/MultiSelect.module.scss.es.js +15 -15
- package/dist/components/Form/Select/MultiSelect/SelectButton.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/MultiSelect/SelectButton.module.scss.es.js +2 -2
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.module.scss.es.js +4 -4
- package/dist/components/Form/Select/Select.interfaces.cjs.js.map +1 -1
- package/dist/components/Form/Select/Select.interfaces.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.cjs.js +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.cjs.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.es.js +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/SingleSelect/Select.module.scss.es.js +17 -17
- package/dist/components/Form/Select/useAddNewBtn.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/useAddNewBtn.module.scss.es.js +4 -4
- package/dist/components/Form/Textarea/Textarea.module.scss.cjs.js +2 -2
- package/dist/components/Form/Textarea/Textarea.module.scss.es.js +6 -6
- package/dist/components/Form/Toggle/Toggle.cjs.js.map +1 -1
- package/dist/components/Form/Toggle/Toggle.es.js.map +1 -1
- package/dist/components/Form/Toggle/Toggle.module.scss.cjs.js +2 -2
- package/dist/components/Form/Toggle/Toggle.module.scss.es.js +18 -18
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.module.scss.es.js +3 -3
- package/dist/components/Form/Wrapper/InputWrapper/InputWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/InputWrapper/InputWrapper.module.scss.es.js +4 -4
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.module.scss.es.js +3 -3
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.module.scss.es.js +3 -3
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.module.scss.es.js +3 -3
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss.es.js +8 -8
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.module.scss.es.js +6 -6
- package/dist/components/Icon/Icon.module.scss.cjs.js +2 -2
- package/dist/components/Icon/Icon.module.scss.es.js +104 -104
- package/dist/components/Layout/Card/Card.module.scss.cjs.js +2 -2
- package/dist/components/Layout/Card/Card.module.scss.es.js +12 -12
- package/dist/components/Layout/ContentHeader/ContentHeader.module.scss.cjs.js +2 -2
- package/dist/components/Layout/ContentHeader/ContentHeader.module.scss.es.js +12 -12
- package/dist/components/Layout/FormPage/FormWithStepper/FormSection/FormSection.module.scss.cjs.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormSection/FormSection.module.scss.es.js +4 -4
- package/dist/components/Layout/FormPage/FormWithStepper/FormStepper/FormStepper.module.scss.cjs.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormStepper/FormStepper.module.scss.es.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormWithStepper.module.scss.cjs.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormWithStepper.module.scss.es.js +3 -3
- package/dist/components/Link/Link.module.scss.cjs.js +2 -2
- package/dist/components/Link/Link.module.scss.es.js +16 -16
- package/dist/components/Notifications/Alert/AlertContainer/AlertContainer.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Alert/AlertContainer/AlertContainer.module.scss.es.js +11 -11
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.module.scss.es.js +22 -22
- package/dist/components/Notifications/Banner/Banner.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Banner/Banner.module.scss.es.js +9 -9
- package/dist/components/Notifications/BaseModal/BaseModal.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModal.module.scss.es.js +5 -5
- package/dist/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.scss.es.js +4 -4
- package/dist/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.scss.es.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.scss.es.js +6 -6
- package/dist/components/Notifications/Dialog/Dialog.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Dialog/Dialog.module.scss.es.js +4 -4
- package/dist/components/Notifications/Dialog/DialogActions/DialogActions.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Dialog/DialogActions/DialogActions.module.scss.es.js +3 -3
- package/dist/components/Notifications/Dialog/DialogTitle/DialogTitle.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Dialog/DialogTitle/DialogTitle.module.scss.es.js +10 -10
- package/dist/components/Notifications/SideSheet/SideSheet.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheet.module.scss.es.js +13 -13
- package/dist/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss.es.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss.es.js +2 -2
- package/dist/components/Notifications/SlideInModal/SlideInModal.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SlideInModal/SlideInModal.module.scss.es.js +10 -10
- package/dist/components/Pagination/Pagination.module.scss.cjs.js +2 -2
- package/dist/components/Pagination/Pagination.module.scss.es.js +14 -14
- package/dist/components/Popover/Popover.cjs.js +1 -1
- package/dist/components/Popover/Popover.cjs.js.map +1 -1
- package/dist/components/Popover/Popover.es.js +32 -9
- package/dist/components/Popover/Popover.es.js.map +1 -1
- package/dist/components/Popover/Popover.module.scss.cjs.js +2 -2
- package/dist/components/Popover/Popover.module.scss.es.js +3 -3
- package/dist/components/ProgressBar/ProgressBar.module.scss.cjs.js +2 -2
- package/dist/components/ProgressBar/ProgressBar.module.scss.es.js +9 -9
- package/dist/components/Skeleton/Skeleton.module.scss.cjs.js +2 -2
- package/dist/components/Skeleton/Skeleton.module.scss.es.js +5 -5
- package/dist/components/Spinner/Spinner.module.scss.cjs.js +2 -2
- package/dist/components/Spinner/Spinner.module.scss.es.js +3 -3
- package/dist/components/Stepper/Step.module.scss.cjs.js +2 -2
- package/dist/components/Stepper/Step.module.scss.es.js +22 -22
- package/dist/components/Stepper/Stepper.module.scss.cjs.js +2 -2
- package/dist/components/Stepper/Stepper.module.scss.es.js +4 -4
- package/dist/components/Tabs/Tab.module.scss.cjs.js +2 -2
- package/dist/components/Tabs/Tab.module.scss.es.js +3 -3
- package/dist/components/Tabs/TabButton.module.scss.cjs.js +2 -2
- package/dist/components/Tabs/TabButton.module.scss.es.js +12 -12
- package/dist/components/Tabs/Tabs.module.scss.cjs.js +2 -2
- package/dist/components/Tabs/Tabs.module.scss.es.js +10 -10
- package/dist/components/Tag/RemoveButton.module.scss.cjs.js +2 -2
- package/dist/components/Tag/RemoveButton.module.scss.es.js +3 -3
- package/dist/components/Tag/Tag.module.scss.cjs.js +2 -2
- package/dist/components/Tag/Tag.module.scss.es.js +6 -6
- package/dist/components/TextEllipsis/TextEllipsis.module.scss.cjs.js +2 -2
- package/dist/components/TextEllipsis/TextEllipsis.module.scss.es.js +3 -3
- package/dist/components/Tiles/Tile.module.scss.cjs.js +2 -2
- package/dist/components/Tiles/Tile.module.scss.es.js +8 -8
- package/dist/components/Tiles/Tiles.module.scss.cjs.js +2 -2
- package/dist/components/Tiles/Tiles.module.scss.es.js +2 -2
- package/dist/components/Tooltip/Tooltip.cjs.js +1 -1
- package/dist/components/Tooltip/Tooltip.cjs.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.es.js +38 -12
- package/dist/components/Tooltip/Tooltip.es.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.module.scss.cjs.js +2 -2
- package/dist/components/Tooltip/Tooltip.module.scss.es.js +27 -27
- package/dist/components/Typography/Typography.module.scss.cjs.js +2 -2
- package/dist/components/Typography/Typography.module.scss.es.js +13 -13
- package/dist/components/admin/layout/LeftNav/LeftNav.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/LeftNav/LeftNav.module.scss.es.js +5 -5
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.module.scss.es.js +14 -14
- package/dist/components/admin/layout/MicrofrontendContainer/MicrofrontendContainer.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/MicrofrontendContainer/MicrofrontendContainer.module.scss.es.js +3 -3
- package/dist/components/miscellaneous/IdentityProviderButton.module.scss.cjs.js +2 -2
- package/dist/components/miscellaneous/IdentityProviderButton.module.scss.es.js +3 -3
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.es.js +2 -0
- package/dist/index.es.js.map +1 -1
- package/dist/readyclasses.module.scss.cjs.js +2 -2
- package/dist/readyclasses.module.scss.es.js +5 -5
- package/package.json +5 -47
- package/LICENSE +0 -202
- package/README.md +0 -94
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.cjs.js","sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentPropsWithRef,\n createRef,\n ForwardRefRenderFunction,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from \"react\";\nimport { Props as ButtonProps } from \"../Button/Button\";\nimport { Props as IconButtonProps } from \"../Button/IconButton\";\nimport { Popover, Props as PopoverProps } from \"../Popover/Popover\";\nimport { Placement, Offset } from \"../../hooks/usePosition\";\nimport classes from \"./ContextMenu.module.scss\";\nimport { useClickOutside } from \"../../hooks/useClickOutside\";\nimport { Props as ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { createPortal } from \"react-dom\";\nimport { useGetDomRoot } from \"../../hooks/useGetDomRoot\";\nimport { useArrowNavigation, useDefaultOffset, useFocusAnchorElement } from \"./ContextMenuService\";\nimport { generateID } from \"../../util/helper\";\n\nexport interface Props extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n trigger: ReactElement<ButtonProps> | ReactElement<IconButtonProps>;\n decorativeElement?: ReactNode;\n children: ReactElement<ContextMenuItemProps> | ReactElement<ContextMenuItemProps>[];\n placement?: Placement;\n transformOrigin?: Placement;\n offset?: Offset;\n debounceAmount?: number;\n id?: string;\n show?: boolean;\n domRoot?: HTMLElement;\n onShow?: () => void;\n onClose?: () => void;\n popoverProps?: PopoverProps;\n value?: number;\n onChange?: (event: React.MouseEvent<HTMLButtonElement>, childIndex: number) => void;\n}\n\nconst ContextMenuComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n trigger,\n children,\n decorativeElement,\n id = `ID-${generateID()}`,\n show = false,\n onShow,\n onClose,\n placement = { horizontal: \"right\", vertical: \"top\" },\n offset,\n transformOrigin = { horizontal: \"left\", vertical: \"top\" },\n debounceAmount,\n domRoot,\n popoverProps,\n value,\n onChange,\n ...rest\n }: Props,\n ref\n) => {\n const anchorEl = useRef<HTMLButtonElement>(null);\n const wrappingDivRef = (ref as RefObject<HTMLDivElement>) || createRef<HTMLDivElement>();\n const [showContextMenu, setShowContextMenu] = useState(show);\n const [selectedContextMenuItem, setSelectedContextMenuItem] = useState(-1);\n const [focusedContextMenuItem, setFocusedContextMenuItem] = useState(-1);\n const [shouldClick, setShouldClick] =\n useState(\n false\n ); /** We need this, because whenever we use the arrow keys to select the contextmenu item, and we focus the currently selected item it fires the \"click\" listener in ContextMenuItem component. Instead, we only want this to fire if we press \"enter\" or \"spacebar\" so we set this to true whenever that is the case, and back to false when it has been executed. */\n const childrenCount = React.Children.count(children);\n\n const { root } = useGetDomRoot(domRoot, wrappingDivRef);\n\n const syncSelectedContextMenuItem = setSelectedContextMenuItem;\n\n useEffect(() => {\n value !== undefined && syncSelectedContextMenuItem(value);\n }, [value]);\n\n const { calculateDefaultOffset } = useDefaultOffset();\n const calculatedOffset = offset ?? calculateDefaultOffset(placement, transformOrigin);\n\n const { onArrowNavigation } = useArrowNavigation({\n selectedContextMenuItem,\n setSelectedContextMenuItem,\n focusedContextMenuItem,\n setFocusedContextMenuItem,\n showContextMenu,\n setShowContextMenu,\n childrenCount,\n setShouldClick\n });\n\n useClickOutside(anchorEl, () => {\n if (showContextMenu) {\n setShowContextMenu(false);\n }\n }, [showContextMenu]);\n\n useFocusAnchorElement(\n anchorEl,\n id,\n showContextMenu,\n setShowContextMenu,\n setFocusedContextMenuItem,\n onShow,\n onClose\n );\n\n const renderTrigger = () =>\n React.cloneElement(trigger, {\n id: id,\n \"aria-haspopup\": \"true\",\n \"aria-controls\": `${id}-menu`,\n \"aria-expanded\": showContextMenu,\n onClick: () => setShowContextMenu(!showContextMenu),\n tabIndex: 0,\n ref: anchorEl\n });\n\n const renderChildren = () =>\n React.Children.map(children, (child, index) =>\n React.cloneElement(child as ReactElement, {\n onFocusChange: (childIndex: number) => setFocusedContextMenuItem(childIndex),\n onSelectedChange: (event: React.MouseEvent<HTMLButtonElement>, childIndex: number) => {\n setSelectedContextMenuItem(childIndex);\n setShouldClick(false);\n onChange?.(event, childIndex);\n },\n childIndex: index,\n hasFocus: focusedContextMenuItem === index,\n isSelected: selectedContextMenuItem === index,\n showActiveState:\n child?.props.showActiveState ??\n (value !== undefined && selectedContextMenuItem === index),\n contextMenuOpened: showContextMenu,\n shouldClick: shouldClick,\n autoFocus: showContextMenu && index === 0\n })\n );\n\n const onOutOfViewHandler = useCallback(() => {\n setShowContextMenu(false);\n }, []);\n\n if (!root) {\n return null;\n }\n\n return (\n <div\n {...rest}\n ref={wrappingDivRef}\n onKeyDown={onArrowNavigation}\n className={classes[\"context-menu\"]}\n >\n {renderTrigger()}\n {createPortal(\n <Popover\n {...popoverProps}\n placement={placement}\n transformOrigin={transformOrigin}\n offset={calculatedOffset}\n anchorEl={anchorEl}\n debounceAmount={debounceAmount}\n show={showContextMenu}\n onAnchorOutOfView={onOutOfViewHandler}\n >\n {decorativeElement && (\n <div className={classes[\"decorative-element\"]}>{decorativeElement}</div>\n )}\n <ul\n className={`${classes[\"menu\"]} ${decorativeElement ? classes[\"no-margin-top\"] : \"\"}`}\n id={`${id}-menu`}\n aria-describedby={id}\n role=\"menu\"\n >\n {renderChildren()}\n </ul>\n </Popover>,\n root\n )}\n </div>\n );\n};\n\nexport const ContextMenu = React.forwardRef(ContextMenuComponent);\n"],"names":["ContextMenu","React","forwardRef","trigger","children","decorativeElement","id","generateID","show","onShow","onClose","placement","horizontal","vertical","offset","transformOrigin","debounceAmount","domRoot","popoverProps","value","onChange","rest","ref","anchorEl","useRef","wrappingDivRef","createRef","showContextMenu","setShowContextMenu","useState","selectedContextMenuItem","setSelectedContextMenuItem","focusedContextMenuItem","setFocusedContextMenuItem","shouldClick","setShouldClick","childrenCount","Children","count","root","useGetDomRoot","syncSelectedContextMenuItem","useEffect","calculateDefaultOffset","useDefaultOffset","calculatedOffset","onArrowNavigation","useArrowNavigation","useClickOutside","ContextMenuService","useFocusAnchorElement","onOutOfViewHandler","useCallback","createElement","onKeyDown","className","classes","cloneElement","onClick","tabIndex","createPortal","Popover","onAnchorOutOfView","role","map","child","index","onFocusChange","childIndex","onSelectedChange","event","hasFocus","isSelected","showActiveState","props","contextMenuOpened","autoFocus"],"mappings":"kYA6MaA,EAAcC,EAAMC,YAnJ6C,EAE1EC,UACAC,WACAC,oBACAC,KAAK,MAA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AD,OAAQ+B,EACRtB,WACAP,iBACAR,KAAMmB,EACNmC,kBAAmBX,GAElB9C,GACEJ,EAAAoD,cAAA,MAAA,CAAIE,UAAWC,UAAQ,uBAAwBnD,GAElDJ,EAAAoD,cAAC,KAAA,CACCE,UAAW,GAAGC,UAAc,QAAKnD,EAAoBmD,UAAQ,iBAAmB,KAChFlD,GAAI,GAAGA,SACP,mBAAkBA,EAClByD,KAAK,QAtDb9D,EAAMoC,SAAS2B,IAAI5D,GAAU,CAAC6D,EAAOC,IACnCjE,EAAMwD,aAAaQ,EAAuB,CACxCE,cAAgBC,GAAuBnC,EAA0BmC,GACjEC,iBAAkB,CAACC,EAA4CF,KAC7DrC,EAA2BqC,GAC3BjC,GAAe,GACf,MAAAf,GAAAA,EAAWkD,EAAOF,EAAA,EAEpBA,WAAYF,EACZK,SAAUvC,IAA2BkC,EACrCM,WAAY1C,IAA4BoC,EACxCO,iBACS,MAAPR,OAAO,EAAAA,EAAAS,MAAMD,wBACF,IAAVtD,GAAuBW,IAA4BoC,GACtDS,kBAAmBhD,EACnBO,cACA0C,UAAWjD,GAA6B,IAAVuC,QA2C9B3B,IAlCG,IAoCP"}
|
|
1
|
+
{"version":3,"file":"ContextMenu.cjs.js","sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentPropsWithRef,\n createRef,\n ForwardRefRenderFunction,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from \"react\";\nimport { Props as ButtonProps } from \"../Button/Button\";\nimport { Props as IconButtonProps } from \"../Button/IconButton\";\nimport { Popover, Props as PopoverProps } from \"../Popover/Popover\";\nimport { Placement, Offset } from \"../../hooks/usePosition\";\nimport classes from \"./ContextMenu.module.scss\";\nimport { useClickOutside } from \"../../hooks/useClickOutside\";\nimport { Props as ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { ContextMenuDivider } from \"./ContextMenuDivider\";\nimport { createPortal } from \"react-dom\";\nimport { useGetDomRoot } from \"../../hooks/useGetDomRoot\";\nimport { useArrowNavigation, useDefaultOffset, useFocusAnchorElement } from \"./ContextMenuService\";\nimport { generateID } from \"../../util/helper\";\n\nexport interface Props extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n ariaLabel?: string;\n trigger: ReactElement<ButtonProps> | ReactElement<IconButtonProps>;\n decorativeElement?: ReactNode;\n children:\n | ReactElement<ContextMenuItemProps>\n | ReactElement<typeof ContextMenuDivider>\n | (ReactElement<ContextMenuItemProps> | ReactElement<typeof ContextMenuDivider>)[];\n placement?: Placement;\n transformOrigin?: Placement;\n offset?: Offset;\n debounceAmount?: number;\n id?: string;\n show?: boolean;\n domRoot?: HTMLElement;\n onShow?: () => void;\n onClose?: () => void;\n popoverProps?: PopoverProps;\n value?: number;\n onChange?: (event: React.MouseEvent<HTMLButtonElement>, childIndex: number) => void;\n}\n\nconst ContextMenuComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n trigger,\n children,\n decorativeElement,\n id = `ID-${generateID()}`,\n show = false,\n onShow,\n onClose,\n placement = { horizontal: \"right\", vertical: \"top\" },\n offset,\n transformOrigin = { horizontal: \"left\", vertical: \"top\" },\n debounceAmount,\n domRoot,\n popoverProps,\n value,\n onChange,\n ariaLabel,\n ...rest\n }: Props,\n ref\n) => {\n const anchorEl = useRef<HTMLButtonElement>(null);\n const wrappingDivRef = (ref as RefObject<HTMLDivElement>) || createRef<HTMLDivElement>();\n const [showContextMenu, setShowContextMenu] = useState(show);\n const [selectedContextMenuItem, setSelectedContextMenuItem] = useState(-1);\n const [focusedContextMenuItem, setFocusedContextMenuItem] = useState(-1);\n const [shouldClick, setShouldClick] =\n useState(\n false\n ); /** We need this, because whenever we use the arrow keys to select the contextmenu item, and we focus the currently selected item it fires the \"click\" listener in ContextMenuItem component. Instead, we only want this to fire if we press \"enter\" or \"spacebar\" so we set this to true whenever that is the case, and back to false when it has been executed. */\n\n const childrenCount = React.Children.toArray(children).filter(\n child => React.isValidElement(child) && child.type !== ContextMenuDivider\n ).length;\n\n const { root } = useGetDomRoot(domRoot, wrappingDivRef);\n\n const syncSelectedContextMenuItem = setSelectedContextMenuItem;\n\n useEffect(() => {\n value !== undefined && syncSelectedContextMenuItem(value);\n }, [value]);\n\n const { calculateDefaultOffset } = useDefaultOffset();\n const calculatedOffset = offset ?? calculateDefaultOffset(placement, transformOrigin);\n\n const { onArrowNavigation } = useArrowNavigation({\n selectedContextMenuItem,\n setSelectedContextMenuItem,\n focusedContextMenuItem,\n setFocusedContextMenuItem,\n showContextMenu,\n setShowContextMenu,\n childrenCount,\n setShouldClick\n });\n\n useClickOutside(anchorEl, () => {\n if (showContextMenu) {\n setShowContextMenu(false);\n }\n }, [showContextMenu]);\n\n useFocusAnchorElement(\n anchorEl,\n id,\n showContextMenu,\n setShowContextMenu,\n setFocusedContextMenuItem,\n onShow,\n onClose\n );\n\n const renderTrigger = () =>\n React.cloneElement(trigger, {\n id: id,\n \"aria-haspopup\": \"true\",\n \"aria-controls\": `${id}-menu`,\n \"aria-expanded\": showContextMenu,\n \"aria-label\": ariaLabel,\n onClick: () => setShowContextMenu(!showContextMenu),\n tabIndex: 0,\n ref: anchorEl\n });\n\n const renderChildren = () => {\n let itemIndex = 0;\n return React.Children.map(children, child => {\n if (React.isValidElement(child) && child.type === ContextMenuDivider) {\n return child;\n }\n\n const menuItem = child as ReactElement<ContextMenuItemProps>;\n const currentItemIndex = itemIndex;\n itemIndex++;\n\n return React.cloneElement(menuItem, {\n onFocusChange: (childIndex: number) => setFocusedContextMenuItem(childIndex),\n onSelectedChange: (event: React.MouseEvent<HTMLButtonElement>, childIndex: number) => {\n setSelectedContextMenuItem(childIndex);\n setShouldClick(false);\n onChange?.(event, childIndex);\n },\n childIndex: currentItemIndex,\n hasFocus: focusedContextMenuItem === currentItemIndex,\n isSelected: selectedContextMenuItem === currentItemIndex,\n showActiveState:\n menuItem.props.showActiveState ??\n (value !== undefined && selectedContextMenuItem === currentItemIndex),\n contextMenuOpened: showContextMenu,\n shouldClick: shouldClick,\n autoFocus: showContextMenu && currentItemIndex === 0\n });\n });\n };\n\n const onOutOfViewHandler = useCallback(() => {\n setShowContextMenu(false);\n }, []);\n\n if (!root) {\n return null;\n }\n\n return (\n <div\n {...rest}\n ref={wrappingDivRef}\n onKeyDown={onArrowNavigation}\n className={classes[\"context-menu\"]}\n >\n {renderTrigger()}\n {createPortal(\n <Popover\n {...popoverProps}\n placement={placement}\n transformOrigin={transformOrigin}\n offset={calculatedOffset}\n anchorEl={anchorEl}\n debounceAmount={debounceAmount}\n show={showContextMenu}\n onAnchorOutOfView={onOutOfViewHandler}\n >\n {decorativeElement && (\n <div className={classes[\"decorative-element\"]}>{decorativeElement}</div>\n )}\n <ul\n className={`${classes[\"menu\"]} ${decorativeElement ? classes[\"no-margin-top\"] : \"\"}`}\n id={`${id}-menu`}\n aria-describedby={id}\n role=\"menu\"\n >\n {renderChildren()}\n </ul>\n </Popover>,\n root\n )}\n </div>\n );\n};\n\nexport const ContextMenu = React.forwardRef(ContextMenuComponent);\n"],"names":["ContextMenu","React","forwardRef","trigger","children","decorativeElement","id","generateID","show","onShow","onClose","placement","horizontal","vertical","offset","transformOrigin","debounceAmount","domRoot","popoverProps","value","onChange","ariaLabel","rest","ref","anchorEl","useRef","wrappingDivRef","createRef","showContextMenu","setShowContextMenu","useState","selectedContextMenuItem","setSelectedContextMenuItem","focusedContextMenuItem","setFocusedContextMenuItem","shouldClick","setShouldClick","childrenCount","Children","toArray","filter","isValidElement","child","type","ContextMenuDivider","length","root","useGetDomRoot","syncSelectedContextMenuItem","useEffect","calculateDefaultOffset","useDefaultOffset","calculatedOffset","onArrowNavigation","useArrowNavigation","useClickOutside","ContextMenuService","useFocusAnchorElement","onOutOfViewHandler","useCallback","createElement","onKeyDown","className","classes","cloneElement","onClick","tabIndex","createPortal","Popover","onAnchorOutOfView","role","itemIndex","map","menuItem","currentItemIndex","onFocusChange","childIndex","onSelectedChange","event","hasFocus","isSelected","showActiveState","props","contextMenuOpened","autoFocus","renderChildren"],"mappings":"2aAiOaA,EAAcC,EAAMC,YAlK6C,EAE1EC,UACAC,WACAC,oBACAC,KAAK,MAAMC,EAAAA,eACXC,QAAO,EACPC,SACAC,UACAC,YAAY,CAAEC,WAAY,QAASC,SAAU,OAC7CC,SACAC,kBAAkB,CAAEH,WAAY,OAAQC,SAAU,OAClDG,iBACAC,UACAC,eACAC,QACAC,WACAC,eACGC,GAELC,KAEM,MAAAC,EAAWC,SAA0B,MACrCC,EAAkBH,GAAqCI,eACtDC,EAAiBC,GAAsBC,EAAAA,SAAStB,IAChDuB,EAAyBC,GAA8BF,EAAAA,UAAW,IAClEG,EAAwBC,GAA6BJ,EAAAA,UAAW,IAChEK,EAAaC,GAClBN,EAAAA,UACE,GAGEO,EAAgBpC,EAAMqC,SAASC,QAAQnC,GAAUoC,WAC5CvC,EAAMwC,eAAeC,IAAUA,EAAMC,OAASC,EAAAA,qBACvDC,QAEIC,KAAEA,GAASC,gBAAc9B,EAASS,GAElCsB,EAA8BhB,EAEpCiB,EAAAA,WAAU,UACE,IAAA9B,GAAa6B,EAA4B7B,EAAK,GACvD,CAACA,IAEE,MAAA+B,uBAAEA,GAA2BC,qBAC7BC,EAAmBtC,GAAUoC,EAAuBvC,EAAWI,IAE/DsC,kBAAEA,GAAsBC,qBAAmB,CAC/CvB,0BACAC,6BACAC,yBACAC,4BACAN,kBACAC,qBACAQ,gBACAD,mBAGFmB,EAAAA,gBAAgB/B,GAAU,KACpBI,GACFC,G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9D,GAAuBY,IAA4B2C,GACtDS,kBAAmBvD,EACnBO,cACAiD,UAAWxD,GAAwC,IAArB8C,GAC/B,GACF,EAuCQW,KAGLvC,IAlCG,IAoCP"}
|
|
@@ -2,6 +2,7 @@ import React, { useRef, createRef, useState, useEffect, useCallback } from "reac
|
|
|
2
2
|
import { Popover } from "../Popover/Popover.es.js";
|
|
3
3
|
import classes from "./ContextMenu.module.scss.es.js";
|
|
4
4
|
import { useClickOutside } from "../../hooks/useClickOutside.es.js";
|
|
5
|
+
import { ContextMenuDivider } from "./ContextMenuDivider.es.js";
|
|
5
6
|
import { createPortal } from "react-dom";
|
|
6
7
|
import { useGetDomRoot } from "../../hooks/useGetDomRoot.es.js";
|
|
7
8
|
import { useDefaultOffset, useFocusAnchorElement, useArrowNavigation } from "./ContextMenuService.es.js";
|
|
@@ -22,6 +23,7 @@ const ContextMenuComponent = ({
|
|
|
22
23
|
popoverProps,
|
|
23
24
|
value,
|
|
24
25
|
onChange,
|
|
26
|
+
ariaLabel,
|
|
25
27
|
...rest
|
|
26
28
|
}, ref) => {
|
|
27
29
|
const anchorEl = useRef(null);
|
|
@@ -32,7 +34,9 @@ const ContextMenuComponent = ({
|
|
|
32
34
|
const [shouldClick, setShouldClick] = useState(
|
|
33
35
|
false
|
|
34
36
|
);
|
|
35
|
-
const childrenCount = React.Children.
|
|
37
|
+
const childrenCount = React.Children.toArray(children).filter(
|
|
38
|
+
(child) => React.isValidElement(child) && child.type !== ContextMenuDivider
|
|
39
|
+
).length;
|
|
36
40
|
const { root } = useGetDomRoot(domRoot, wrappingDivRef);
|
|
37
41
|
const syncSelectedContextMenuItem = setSelectedContextMenuItem;
|
|
38
42
|
useEffect(() => {
|
|
@@ -69,28 +73,37 @@ const ContextMenuComponent = ({
|
|
|
69
73
|
"aria-haspopup": "true",
|
|
70
74
|
"aria-controls": `${id}-menu`,
|
|
71
75
|
"aria-expanded": showContextMenu,
|
|
76
|
+
"aria-label": ariaLabel,
|
|
72
77
|
onClick: () => setShowContextMenu(!showContextMenu),
|
|
73
78
|
tabIndex: 0,
|
|
74
79
|
ref: anchorEl
|
|
75
80
|
});
|
|
76
|
-
const renderChildren = () =>
|
|
77
|
-
|
|
78
|
-
(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
const renderChildren = () => {
|
|
82
|
+
let itemIndex = 0;
|
|
83
|
+
return React.Children.map(children, (child) => {
|
|
84
|
+
if (React.isValidElement(child) && child.type === ContextMenuDivider) {
|
|
85
|
+
return child;
|
|
86
|
+
}
|
|
87
|
+
const menuItem = child;
|
|
88
|
+
const currentItemIndex = itemIndex;
|
|
89
|
+
itemIndex++;
|
|
90
|
+
return React.cloneElement(menuItem, {
|
|
91
|
+
onFocusChange: (childIndex) => setFocusedContextMenuItem(childIndex),
|
|
92
|
+
onSelectedChange: (event, childIndex) => {
|
|
93
|
+
setSelectedContextMenuItem(childIndex);
|
|
94
|
+
setShouldClick(false);
|
|
95
|
+
onChange == null ? void 0 : onChange(event, childIndex);
|
|
96
|
+
},
|
|
97
|
+
childIndex: currentItemIndex,
|
|
98
|
+
hasFocus: focusedContextMenuItem === currentItemIndex,
|
|
99
|
+
isSelected: selectedContextMenuItem === currentItemIndex,
|
|
100
|
+
showActiveState: menuItem.props.showActiveState ?? (value !== void 0 && selectedContextMenuItem === currentItemIndex),
|
|
101
|
+
contextMenuOpened: showContextMenu,
|
|
102
|
+
shouldClick,
|
|
103
|
+
autoFocus: showContextMenu && currentItemIndex === 0
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
};
|
|
94
107
|
const onOutOfViewHandler = useCallback(() => {
|
|
95
108
|
setShowContextMenu(false);
|
|
96
109
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.es.js","sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentPropsWithRef,\n createRef,\n ForwardRefRenderFunction,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from \"react\";\nimport { Props as ButtonProps } from \"../Button/Button\";\nimport { Props as IconButtonProps } from \"../Button/IconButton\";\nimport { Popover, Props as PopoverProps } from \"../Popover/Popover\";\nimport { Placement, Offset } from \"../../hooks/usePosition\";\nimport classes from \"./ContextMenu.module.scss\";\nimport { useClickOutside } from \"../../hooks/useClickOutside\";\nimport { Props as ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { createPortal } from \"react-dom\";\nimport { useGetDomRoot } from \"../../hooks/useGetDomRoot\";\nimport { useArrowNavigation, useDefaultOffset, useFocusAnchorElement } from \"./ContextMenuService\";\nimport { generateID } from \"../../util/helper\";\n\nexport interface Props extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n trigger: ReactElement<ButtonProps> | ReactElement<IconButtonProps>;\n decorativeElement?: ReactNode;\n children: ReactElement<ContextMenuItemProps> | ReactElement<ContextMenuItemProps>[];\n placement?: Placement;\n transformOrigin?: Placement;\n offset?: Offset;\n debounceAmount?: number;\n id?: string;\n show?: boolean;\n domRoot?: HTMLElement;\n onShow?: () => void;\n onClose?: () => void;\n popoverProps?: PopoverProps;\n value?: number;\n onChange?: (event: React.MouseEvent<HTMLButtonElement>, childIndex: number) => void;\n}\n\nconst ContextMenuComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n trigger,\n children,\n decorativeElement,\n id = `ID-${generateID()}`,\n show = false,\n onShow,\n onClose,\n placement = { horizontal: \"right\", vertical: \"top\" },\n offset,\n transformOrigin = { horizontal: \"left\", vertical: \"top\" },\n debounceAmount,\n domRoot,\n popoverProps,\n value,\n onChange,\n ...rest\n }: Props,\n ref\n) => {\n const anchorEl = useRef<HTMLButtonElement>(null);\n const wrappingDivRef = (ref as RefObject<HTMLDivElement>) || createRef<HTMLDivElement>();\n const [showContextMenu, setShowContextMenu] = useState(show);\n const [selectedContextMenuItem, setSelectedContextMenuItem] = useState(-1);\n const [focusedContextMenuItem, setFocusedContextMenuItem] = useState(-1);\n const [shouldClick, setShouldClick] =\n useState(\n false\n ); /** We need this, because whenever we use the arrow keys to select the contextmenu item, and we focus the currently selected item it fires the \"click\" listener in ContextMenuItem component. Instead, we only want this to fire if we press \"enter\" or \"spacebar\" so we set this to true whenever that is the case, and back to false when it has been executed. */\n const childrenCount = React.Children.count(children);\n\n const { root } = useGetDomRoot(domRoot, wrappingDivRef);\n\n const syncSelectedContextMenuItem = setSelectedContextMenuItem;\n\n useEffect(() => {\n value !== undefined && syncSelectedContextMenuItem(value);\n }, [value]);\n\n const { calculateDefaultOffset } = useDefaultOffset();\n const calculatedOffset = offset ?? calculateDefaultOffset(placement, transformOrigin);\n\n const { onArrowNavigation } = useArrowNavigation({\n selectedContextMenuItem,\n setSelectedContextMenuItem,\n focusedContextMenuItem,\n setFocusedContextMenuItem,\n showContextMenu,\n setShowContextMenu,\n childrenCount,\n setShouldClick\n });\n\n useClickOutside(anchorEl, () => {\n if (showContextMenu) {\n setShowContextMenu(false);\n }\n }, [showContextMenu]);\n\n useFocusAnchorElement(\n anchorEl,\n id,\n showContextMenu,\n setShowContextMenu,\n setFocusedContextMenuItem,\n onShow,\n onClose\n );\n\n const renderTrigger = () =>\n React.cloneElement(trigger, {\n id: id,\n \"aria-haspopup\": \"true\",\n \"aria-controls\": `${id}-menu`,\n \"aria-expanded\": showContextMenu,\n onClick: () => setShowContextMenu(!showContextMenu),\n tabIndex: 0,\n ref: anchorEl\n });\n\n const renderChildren = () =>\n React.Children.map(children, (child, index) =>\n React.cloneElement(child as ReactElement, {\n onFocusChange: (childIndex: number) => setFocusedContextMenuItem(childIndex),\n onSelectedChange: (event: React.MouseEvent<HTMLButtonElement>, childIndex: number) => {\n setSelectedContextMenuItem(childIndex);\n setShouldClick(false);\n onChange?.(event, childIndex);\n },\n childIndex: index,\n hasFocus: focusedContextMenuItem === index,\n isSelected: selectedContextMenuItem === index,\n showActiveState:\n child?.props.showActiveState ??\n (value !== undefined && selectedContextMenuItem === index),\n contextMenuOpened: showContextMenu,\n shouldClick: shouldClick,\n autoFocus: showContextMenu && index === 0\n })\n );\n\n const onOutOfViewHandler = useCallback(() => {\n setShowContextMenu(false);\n }, []);\n\n if (!root) {\n return null;\n }\n\n return (\n <div\n {...rest}\n ref={wrappingDivRef}\n onKeyDown={onArrowNavigation}\n className={classes[\"context-menu\"]}\n >\n {renderTrigger()}\n {createPortal(\n <Popover\n {...popoverProps}\n placement={placement}\n transformOrigin={transformOrigin}\n offset={calculatedOffset}\n anchorEl={anchorEl}\n debounceAmount={debounceAmount}\n show={showContextMenu}\n onAnchorOutOfView={onOutOfViewHandler}\n >\n {decorativeElement && (\n <div className={classes[\"decorative-element\"]}>{decorativeElement}</div>\n )}\n <ul\n className={`${classes[\"menu\"]} ${decorativeElement ? classes[\"no-margin-top\"] : \"\"}`}\n id={`${id}-menu`}\n aria-describedby={id}\n role=\"menu\"\n >\n {renderChildren()}\n </ul>\n </Popover>,\n root\n )}\n </div>\n );\n};\n\nexport const ContextMenu = React.forwardRef(ContextMenuComponent);\n"],"names":[],"mappings":";;;;;;;;AA0DA,MAAM,uBAAwE,CAC5E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,KAAK,MAAM,WAAA,CAAY;AAAA,EACvB,OAAO;AAAA,EACP;AAA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,CAAC,IAAI,oBAAoB,QAAQ,eAAe,IAAI,EAAE;AAAA,YAClF,IAAI,GAAG,EAAE;AAAA,YACT,oBAAkB;AAAA,YAClB,MAAK;AAAA,UAAA;AAAA,UAEJ,eAAe;AAAA,QAAA;AAAA,MAEpB;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAEJ;AAEa,MAAA,cAAc,MAAM,WAAW,oBAAoB;"}
|
|
1
|
+
{"version":3,"file":"ContextMenu.es.js","sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentPropsWithRef,\n createRef,\n ForwardRefRenderFunction,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from \"react\";\nimport { Props as ButtonProps } from \"../Button/Button\";\nimport { Props as IconButtonProps } from \"../Button/IconButton\";\nimport { Popover, Props as PopoverProps } from \"../Popover/Popover\";\nimport { Placement, Offset } from \"../../hooks/usePosition\";\nimport classes from \"./ContextMenu.module.scss\";\nimport { useClickOutside } from \"../../hooks/useClickOutside\";\nimport { Props as ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { ContextMenuDivider } from \"./ContextMenuDivider\";\nimport { createPortal } from \"react-dom\";\nimport { useGetDomRoot } from \"../../hooks/useGetDomRoot\";\nimport { useArrowNavigation, useDefaultOffset, useFocusAnchorElement } from \"./ContextMenuService\";\nimport { generateID } from \"../../util/helper\";\n\nexport interface Props extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n ariaLabel?: string;\n trigger: ReactElement<ButtonProps> | ReactElement<IconButtonProps>;\n decorativeElement?: ReactNode;\n children:\n | ReactElement<ContextMenuItemProps>\n | ReactElement<typeof ContextMenuDivider>\n | (ReactElement<ContextMenuItemProps> | ReactElement<typeof ContextMenuDivider>)[];\n placement?: Placement;\n transformOrigin?: Placement;\n offset?: Offset;\n debounceAmount?: number;\n id?: string;\n show?: boolean;\n domRoot?: HTMLElement;\n onShow?: () => void;\n onClose?: () => void;\n popoverProps?: PopoverProps;\n value?: number;\n onChange?: (event: React.MouseEvent<HTMLButtonElement>, childIndex: number) => void;\n}\n\nconst ContextMenuComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n trigger,\n children,\n decorativeElement,\n id = `ID-${generateID()}`,\n show = false,\n onShow,\n onClose,\n placement = { horizontal: \"right\", vertical: \"top\" },\n offset,\n transformOrigin = { horizontal: \"left\", vertical: \"top\" },\n debounceAmount,\n domRoot,\n popoverProps,\n value,\n onChange,\n ariaLabel,\n ...rest\n }: Props,\n ref\n) => {\n const anchorEl = useRef<HTMLButtonElement>(null);\n const wrappingDivRef = (ref as RefObject<HTMLDivElement>) || createRef<HTMLDivElement>();\n const [showContextMenu, setShowContextMenu] = useState(show);\n const [selectedContextMenuItem, setSelectedContextMenuItem] = useState(-1);\n const [focusedContextMenuItem, setFocusedContextMenuItem] = useState(-1);\n const [shouldClick, setShouldClick] =\n useState(\n false\n ); /** We need this, because whenever we use the arrow keys to select the contextmenu item, and we focus the currently selected item it fires the \"click\" listener in ContextMenuItem component. Instead, we only want this to fire if we press \"enter\" or \"spacebar\" so we set this to true whenever that is the case, and back to false when it has been executed. */\n\n const childrenCount = React.Children.toArray(children).filter(\n child => React.isValidElement(child) && child.type !== ContextMenuDivider\n ).length;\n\n const { root } = useGetDomRoot(domRoot, wrappingDivRef);\n\n const syncSelectedContextMenuItem = setSelectedContextMenuItem;\n\n useEffect(() => {\n value !== undefined && syncSelectedContextMenuItem(value);\n }, [value]);\n\n const { calculateDefaultOffset } = useDefaultOffset();\n const calculatedOffset = offset ?? calculateDefaultOffset(placement, transformOrigin);\n\n const { onArrowNavigation } = useArrowNavigation({\n selectedContextMenuItem,\n setSelectedContextMenuItem,\n focusedContextMenuItem,\n setFocusedContextMenuItem,\n showContextMenu,\n setShowContextMenu,\n childrenCount,\n setShouldClick\n });\n\n useClickOutside(anchorEl, () => {\n if (showContextMenu) {\n setShowContextMenu(false);\n }\n }, [showContextMenu]);\n\n useFocusAnchorElement(\n anchorEl,\n id,\n showContextMenu,\n setShowContextMenu,\n setFocusedContextMenuItem,\n onShow,\n onClose\n );\n\n const renderTrigger = () =>\n React.cloneElement(trigger, {\n id: id,\n \"aria-haspopup\": \"true\",\n \"aria-controls\": `${id}-menu`,\n \"aria-expanded\": showContextMenu,\n \"aria-label\": ariaLabel,\n onClick: () => setShowContextMenu(!showContextMenu),\n tabIndex: 0,\n ref: anchorEl\n });\n\n const renderChildren = () => {\n let itemIndex = 0;\n return React.Children.map(children, child => {\n if (React.isValidElement(child) && child.type === ContextMenuDivider) {\n return child;\n }\n\n const menuItem = child as ReactElement<ContextMenuItemProps>;\n const currentItemIndex = itemIndex;\n itemIndex++;\n\n return React.cloneElement(menuItem, {\n onFocusChange: (childIndex: number) => setFocusedContextMenuItem(childIndex),\n onSelectedChange: (event: React.MouseEvent<HTMLButtonElement>, childIndex: number) => {\n setSelectedContextMenuItem(childIndex);\n setShouldClick(false);\n onChange?.(event, childIndex);\n },\n childIndex: currentItemIndex,\n hasFocus: focusedContextMenuItem === currentItemIndex,\n isSelected: selectedContextMenuItem === currentItemIndex,\n showActiveState:\n menuItem.props.showActiveState ??\n (value !== undefined && selectedContextMenuItem === currentItemIndex),\n contextMenuOpened: showContextMenu,\n shouldClick: shouldClick,\n autoFocus: showContextMenu && currentItemIndex === 0\n });\n });\n };\n\n const onOutOfViewHandler = useCallback(() => {\n setShowContextMenu(false);\n }, []);\n\n if (!root) {\n return null;\n }\n\n return (\n <div\n {...rest}\n ref={wrappingDivRef}\n onKeyDown={onArrowNavigation}\n className={classes[\"context-menu\"]}\n >\n {renderTrigger()}\n {createPortal(\n <Popover\n {...popoverProps}\n placement={placement}\n transformOrigin={transformOrigin}\n offset={calculatedOffset}\n anchorEl={anchorEl}\n debounceAmount={debounceAmount}\n show={showContextMenu}\n onAnchorOutOfView={onOutOfViewHandler}\n >\n {decorativeElement && (\n <div className={classes[\"decorative-element\"]}>{decorativeElement}</div>\n )}\n <ul\n className={`${classes[\"menu\"]} ${decorativeElement ? classes[\"no-margin-top\"] : \"\"}`}\n id={`${id}-menu`}\n aria-describedby={id}\n role=\"menu\"\n >\n {renderChildren()}\n </ul>\n </Popover>,\n root\n )}\n </div>\n );\n};\n\nexport const ContextMenu = React.forwardRef(ContextMenuComponent);\n"],"names":[],"mappings":";;;;;;;;;AA+DA,MAAM,uBAAwE,CAC5E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,KAAK,MAAM,WAAA,CAAY;AAAA,EACvB,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,YAAY,EAAE,YAAY,SAAS,UAAU,MAAM;AAAA,EACnD;AAAA,EACA,kBAAkB,EAAE,YAAY,QAAQ,UAAU,MAAM;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,QACG;AACG,QAAA,WAAW,OAA0B,IAAI;AACzC,QAAA,iBAAkB,OAAqC,UAA0B;AACvF,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAS,IAAI;AAC3D,QAAM,CAAC,yBAAyB,0BAA0B,IAAI,SAAS,EAAE;AACzE,QAAM,CAAC,wBAAwB,yBAAyB,IAAI,SAAS,EAAE;AACjE,QAAA,CAAC,aAAa,cAAc,IAChC;AAAA,IACE;AAAA,EACF;AAEF,QAAM,gBAAgB,MAAM,SAAS,QAAQ,QAAQ,EAAE;AAAA,IACrD,WAAS,MAAM,eAAe,KAAK,KAAK,MAAM,S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var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.ContextMenu_context-
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.ContextMenu_context-menu_uJyTX{position:relative;display:inline-block;box-sizing:border-box}.ContextMenu_menu_uJyTX{white-space:nowrap;margin:.25rem 0;list-style:none;padding:0;min-width:10rem}.ContextMenu_menu_uJyTX.ContextMenu_no-margin-top_uJyTX{margin:0 0 .25rem}.ContextMenu_menu_uJyTX button{text-align:left}.ContextMenu_decorative-element_uJyTX{margin-top:.5rem}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="ContextMenu_menu_uJyTX",t={"context-menu":"ContextMenu_context-menu_uJyTX",menu:e,"no-margin-top":"ContextMenu_no-margin-top_uJyTX","decorative-element":"ContextMenu_decorative-element_uJyTX"};exports.default=t,exports.menu=e;
|
|
3
3
|
//# sourceMappingURL=ContextMenu.module.scss.cjs.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.ContextMenu_context-
|
|
2
|
-
const menu = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.ContextMenu_context-menu_uJyTX{position:relative;display:inline-block;box-sizing:border-box}.ContextMenu_menu_uJyTX{white-space:nowrap;margin:.25rem 0;list-style:none;padding:0;min-width:10rem}.ContextMenu_menu_uJyTX.ContextMenu_no-margin-top_uJyTX{margin:0 0 .25rem}.ContextMenu_menu_uJyTX button{text-align:left}.ContextMenu_decorative-element_uJyTX{margin-top:.5rem}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
const menu = "ContextMenu_menu_uJyTX";
|
|
3
3
|
const classes = {
|
|
4
|
-
"context-menu": "ContextMenu_context-
|
|
4
|
+
"context-menu": "ContextMenu_context-menu_uJyTX",
|
|
5
5
|
menu,
|
|
6
|
-
"no-margin-top": "ContextMenu_no-margin-
|
|
7
|
-
"decorative-element": "ContextMenu_decorative-
|
|
6
|
+
"no-margin-top": "ContextMenu_no-margin-top_uJyTX",
|
|
7
|
+
"decorative-element": "ContextMenu_decorative-element_uJyTX"
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
10
|
classes as default,
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./ContextMenuDivider.module.scss.cjs.js");exports.ContextMenuDivider=()=>e.createElement("hr",{className:t.default["context-menu-divider"]});
|
|
2
|
+
//# sourceMappingURL=ContextMenuDivider.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextMenuDivider.cjs.js","sources":["../../../src/components/ContextMenu/ContextMenuDivider.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport classes from \"./ContextMenuDivider.module.scss\";\n\nexport const ContextMenuDivider: React.FC = () => {\n return <hr className={classes[\"context-menu-divider\"]} />;\n};\n"],"names":["React","createElement","className","classes","default"],"mappings":"yLAmB4C,IAClCA,EAAAC,cAAA,KAAA,CAAGC,UAAWC,EAAAC,QAAQ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classes from "./ContextMenuDivider.module.scss.es.js";
|
|
3
|
+
const ContextMenuDivider = () => {
|
|
4
|
+
return /* @__PURE__ */ React.createElement("hr", { className: classes["context-menu-divider"] });
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
ContextMenuDivider
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=ContextMenuDivider.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextMenuDivider.es.js","sources":["../../../src/components/ContextMenu/ContextMenuDivider.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport classes from \"./ContextMenuDivider.module.scss\";\n\nexport const ContextMenuDivider: React.FC = () => {\n return <hr className={classes[\"context-menu-divider\"]} />;\n};\n"],"names":[],"mappings":";;AAmBO,MAAM,qBAA+B,MAAM;AAChD,SAAQ,sBAAA,cAAA,MAAA,EAAG,WAAW,QAAQ,sBAAsB,GAAG;AACzD;"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.ContextMenuDivider_context-menu-divider_uJyTX{margin:.31rem .62rem;border:none;border-top:1px solid var(--color-blue-grey100);height:0}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default={"context-menu-divider":"ContextMenuDivider_context-menu-divider_uJyTX"};
|
|
3
|
+
//# sourceMappingURL=ContextMenuDivider.module.scss.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextMenuDivider.module.scss.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.ContextMenuDivider_context-menu-divider_uJyTX{margin:.31rem .62rem;border:none;border-top:1px solid var(--color-blue-grey100);height:0}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
const classes = {
|
|
3
|
+
"context-menu-divider": "ContextMenuDivider_context-menu-divider_uJyTX"
|
|
4
|
+
};
|
|
5
|
+
export {
|
|
6
|
+
classes as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=ContextMenuDivider.module.scss.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextMenuDivider.module.scss.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.ContextMenuItem_sr-
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.ContextMenuItem_sr-only_uJyTX{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.ContextMenuItem_hidden_uJyTX{display:none}.ContextMenuItem_slide-in_uJyTX{animation:ContextMenuItem_slide-in_uJyTX .5s forwards}@media (prefers-reduced-motion: reduce){.ContextMenuItem_slide-in_uJyTX{animation-duration:.1ms}}.ContextMenuItem_slide-out_uJyTX{animation:ContextMenuItem_slide-out_uJyTX .5s forwards}@media (prefers-reduced-motion: reduce){.ContextMenuItem_slide-out_uJyTX{animation-duration:.1ms}}@keyframes ContextMenuItem_slide-in_uJyTX{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes ContextMenuItem_slide-out_uJyTX{0%{transform:translateY(0)}to{transform:translateY(100vh)}}/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.ContextMenuItem_context-menu-item_uJyTX{position:relative}.ContextMenuItem_context-menu-item_uJyTX button{background-color:transparent;border:0;font-family:var(--font-family);font-size:var(--context-menu-font-size);line-height:1.43;cursor:pointer;width:100%;height:100%;padding:.62rem .75rem;box-sizing:border-box}.ContextMenuItem_context-menu-item_uJyTX button:focus-visible{outline:none}.ContextMenuItem_context-menu-item_uJyTX button:focus-visible:after{content:"";position:absolute;top:0;left:0;height:100%;width:100%;z-index:101;outline:calc(.125 * var(--font-size)) solid var(--color-focus);outline-offset:0;border-radius:var(--focus-border-radius)}.ContextMenuItem_context-menu-item_uJyTX button:hover{background-color:var(--context-menu-hover-color)}.ContextMenuItem_context-menu-item_uJyTX button:active{background-color:var(--context-menu-pressed-color)}.ContextMenuItem_context-menu-item_uJyTX button.ContextMenuItem_active_uJyTX{color:var(--context-menu-active-color)}.ContextMenuItem_context-menu-item_uJyTX button.ContextMenuItem_active_uJyTX:before{content:"";position:absolute;top:0;left:0;height:100%;border-top-right-radius:.125rem;border-bottom-right-radius:.125rem;border-left:.25rem solid var(--context-menu-active-color)}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="ContextMenuItem_active_uJyTX",t={"context-menu-item":"ContextMenuItem_context-menu-item_uJyTX",active:e};exports.active=e,exports.default=t;
|
|
3
3
|
//# sourceMappingURL=ContextMenuItem.module.scss.cjs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.ContextMenuItem_sr-
|
|
2
|
-
const active = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.ContextMenuItem_sr-only_uJyTX{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.ContextMenuItem_hidden_uJyTX{display:none}.ContextMenuItem_slide-in_uJyTX{animation:ContextMenuItem_slide-in_uJyTX .5s forwards}@media (prefers-reduced-motion: reduce){.ContextMenuItem_slide-in_uJyTX{animation-duration:.1ms}}.ContextMenuItem_slide-out_uJyTX{animation:ContextMenuItem_slide-out_uJyTX .5s forwards}@media (prefers-reduced-motion: reduce){.ContextMenuItem_slide-out_uJyTX{animation-duration:.1ms}}@keyframes ContextMenuItem_slide-in_uJyTX{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes ContextMenuItem_slide-out_uJyTX{0%{transform:translateY(0)}to{transform:translateY(100vh)}}/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.ContextMenuItem_context-menu-item_uJyTX{position:relative}.ContextMenuItem_context-menu-item_uJyTX button{background-color:transparent;border:0;font-family:var(--font-family);font-size:var(--context-menu-font-size);line-height:1.43;cursor:pointer;width:100%;height:100%;padding:.62rem .75rem;box-sizing:border-box}.ContextMenuItem_context-menu-item_uJyTX button:focus-visible{outline:none}.ContextMenuItem_context-menu-item_uJyTX button:focus-visible:after{content:"";position:absolute;top:0;left:0;height:100%;width:100%;z-index:101;outline:calc(.125 * var(--font-size)) solid var(--color-focus);outline-offset:0;border-radius:var(--focus-border-radius)}.ContextMenuItem_context-menu-item_uJyTX button:hover{background-color:var(--context-menu-hover-color)}.ContextMenuItem_context-menu-item_uJyTX button:active{background-color:var(--context-menu-pressed-color)}.ContextMenuItem_context-menu-item_uJyTX button.ContextMenuItem_active_uJyTX{color:var(--context-menu-active-color)}.ContextMenuItem_context-menu-item_uJyTX button.ContextMenuItem_active_uJyTX:before{content:"";position:absolute;top:0;left:0;height:100%;border-top-right-radius:.125rem;border-bottom-right-radius:.125rem;border-left:.25rem solid var(--context-menu-active-color)}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
|
|
2
|
+
const active = "ContextMenuItem_active_uJyTX";
|
|
3
3
|
const contextMenuItemClasses = {
|
|
4
|
-
"context-menu-item": "ContextMenuItem_context-menu-
|
|
4
|
+
"context-menu-item": "ContextMenuItem_context-menu-item_uJyTX",
|
|
5
5
|
active
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DataGrid_grid-
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DataGrid_grid-wrapper_uJyTX{padding:.875rem 0}.DataGrid_table-wrapper_uJyTX{overflow-x:auto;overflow-y:hidden}.DataGrid_table_uJyTX{border-collapse:collapse;padding-top:.5rem;width:100%;position:relative}.DataGrid_pagination_uJyTX{margin-top:.875rem;padding:0 1rem}.DataGrid_action-button_uJyTX{display:flex;margin-top:2rem}.DataGrid_action-button_uJyTX button{margin-right:1rem}@media only screen and (min-width: 50em){.DataGrid_pagination_uJyTX{padding:0 1.25rem}}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a="DataGrid_table_uJyTX",t="DataGrid_pagination_uJyTX",e={"grid-wrapper":"DataGrid_grid-wrapper_uJyTX","table-wrapper":"DataGrid_table-wrapper_uJyTX",table:a,pagination:t,"action-button":"DataGrid_action-button_uJyTX"};exports.default=e,exports.pagination=t,exports.table=a;
|
|
3
3
|
//# sourceMappingURL=DataGrid.module.scss.cjs.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DataGrid_grid-
|
|
2
|
-
const table = "
|
|
3
|
-
const pagination = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DataGrid_grid-wrapper_uJyTX{padding:.875rem 0}.DataGrid_table-wrapper_uJyTX{overflow-x:auto;overflow-y:hidden}.DataGrid_table_uJyTX{border-collapse:collapse;padding-top:.5rem;width:100%;position:relative}.DataGrid_pagination_uJyTX{margin-top:.875rem;padding:0 1rem}.DataGrid_action-button_uJyTX{display:flex;margin-top:2rem}.DataGrid_action-button_uJyTX button{margin-right:1rem}@media only screen and (min-width: 50em){.DataGrid_pagination_uJyTX{padding:0 1.25rem}}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
const table = "DataGrid_table_uJyTX";
|
|
3
|
+
const pagination = "DataGrid_pagination_uJyTX";
|
|
4
4
|
const classes = {
|
|
5
|
-
"grid-wrapper": "DataGrid_grid-
|
|
6
|
-
"table-wrapper": "DataGrid_table-
|
|
5
|
+
"grid-wrapper": "DataGrid_grid-wrapper_uJyTX",
|
|
6
|
+
"table-wrapper": "DataGrid_table-wrapper_uJyTX",
|
|
7
7
|
table,
|
|
8
8
|
pagination,
|
|
9
|
-
"action-button": "DataGrid_action-
|
|
9
|
+
"action-button": "DataGrid_action-button_uJyTX"
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
12
|
classes as default,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DataGridActions_actions_uJyTX{margin-bottom:1rem;padding:0 1rem;display:flex;flex-wrap:wrap}.DataGridActions_left-actions_uJyTX{flex:1}.DataGridActions_right-actions_uJyTX{display:flex;gap:1rem}.DataGridActions_desktop_uJyTX{display:none}@media only screen and (min-width: 50em){.DataGridActions_actions_uJyTX{padding:0 1.25rem}}@media only screen and (min-width: 30em){.DataGridActions_desktop_uJyTX{display:flex}.DataGridActions_mobile_uJyTX{display:none}}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="DataGridActions_actions_uJyTX",o="DataGridActions_desktop_uJyTX",i="DataGridActions_mobile_uJyTX",e={actions:t,"left-actions":"DataGridActions_left-actions_uJyTX","right-actions":"DataGridActions_right-actions_uJyTX",desktop:o,mobile:i};exports.actions=t,exports.default=e,exports.desktop=o,exports.mobile=i;
|
|
3
3
|
//# sourceMappingURL=DataGridActions.module.scss.cjs.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.
|
|
2
|
-
const actions = "
|
|
3
|
-
const desktop = "
|
|
4
|
-
const mobile = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DataGridActions_actions_uJyTX{margin-bottom:1rem;padding:0 1rem;display:flex;flex-wrap:wrap}.DataGridActions_left-actions_uJyTX{flex:1}.DataGridActions_right-actions_uJyTX{display:flex;gap:1rem}.DataGridActions_desktop_uJyTX{display:none}@media only screen and (min-width: 50em){.DataGridActions_actions_uJyTX{padding:0 1.25rem}}@media only screen and (min-width: 30em){.DataGridActions_desktop_uJyTX{display:flex}.DataGridActions_mobile_uJyTX{display:none}}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
const actions = "DataGridActions_actions_uJyTX";
|
|
3
|
+
const desktop = "DataGridActions_desktop_uJyTX";
|
|
4
|
+
const mobile = "DataGridActions_mobile_uJyTX";
|
|
5
5
|
const classes = {
|
|
6
6
|
actions,
|
|
7
|
-
"left-actions": "DataGridActions_left-
|
|
8
|
-
"right-actions": "DataGridActions_right-
|
|
7
|
+
"left-actions": "DataGridActions_left-actions_uJyTX",
|
|
8
|
+
"right-actions": "DataGridActions_right-actions_uJyTX",
|
|
9
9
|
desktop,
|
|
10
10
|
mobile
|
|
11
11
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),a=require("../../Button/IconButton.cjs.js"),t=require("../../Form/Toggle/Toggle.cjs.js"),o=require("../../Icon/Icon.cjs.js"),r=require("../../Popover/Popover.cjs.js"),l=require("../../Typography/Typography.cjs.js"),n=require("../../../util/helper.cjs.js"),s=require("./DataGridColumnsToggle.module.scss.cjs.js"),c=require("react-dom"),i=e.forwardRef((({open:i,headers:d,titleLabel:m="Show columns",closeButtonTitle:u="Close show columns dialog",onClose:g,onToggleClicked:p,className:h,domRoot:j=document.body,...T},y)=>{const[f]=e.useState(n.generateID()),b=f+"_header",q=d.map((a=>e.createElement(t.Toggle,{key:a.name,name:a.name,checked:!a.hidden,onChange:()=>p(a.name),label:a.headline})));return e.createElement(r.Popover,{...T,ref:y,className:`${s.default.popover} ${h}`,show:i,role:"dialog","aria-modal":"true","aria-labelledby":b},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),a=require("../../Button/IconButton.cjs.js"),t=require("../../Form/Toggle/Toggle.cjs.js"),o=require("../../Icon/Icon.cjs.js"),r=require("../../Popover/Popover.cjs.js"),l=require("../../Typography/Typography.cjs.js"),n=require("../../../util/helper.cjs.js"),s=require("./DataGridColumnsToggle.module.scss.cjs.js"),c=require("react-dom"),i=e.forwardRef((({open:i,headers:d,titleLabel:m="Show columns",closeButtonTitle:u="Close show columns dialog",onClose:g,onToggleClicked:p,className:h,domRoot:j=document.body,...T},y)=>{const[f]=e.useState(n.generateID()),b=f+"_header",q=d.map((a=>e.createElement(t.Toggle,{key:a.name,name:a.name,checked:!a.hidden,onChange:()=>p(a.name),label:a.headline})));return e.createElement(r.Popover,{...T,ref:y,className:`${s.default.popover} ${h}`,show:i,role:"dialog","aria-modal":"true","aria-labelledby":b},c.createPortal(e.createElement("div",{"aria-hidden":"true",className:s.default.backdrop,onClick:()=>g()}),j),e.createElement(e.Fragment,null,e.createElement("div",{className:s.default.header},e.createElement(l.Typography,{id:b,className:s.default.title,tag:"span",variant:"h4"},m),e.createElement(a.IconButton,{onClick:g,className:`${s.default["close-btn"]}`,title:u},e.createElement(o.Icon,{icon:o.Icons.Times}))),e.createElement("div",{className:s.default.content},q)))}));exports.DataGridColumnsToggle=i;
|
|
2
2
|
//# sourceMappingURL=DataGridColumnsToggle.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridColumnsToggle.cjs.js","sources":["../../../../src/components/DataGrid/DataGridActions/DataGridColumnsToggle.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, Fragment, useState } from \"react\";\nimport { IconButton } from \"../../Button/IconButton\";\nimport { Toggle } from \"../../Form/Toggle/Toggle\";\nimport { Icon, Icons } from \"../../Icon/Icon\";\nimport { Popover, Props as PopoverProps } from \"../../Popover/Popover\";\nimport { Typography } from \"../../Typography/Typography\";\nimport { generateID } from \"../../../util/helper\";\nimport { HeaderCell } from \"../datagrid.interfaces\";\nimport classes from \"./DataGridColumnsToggle.module.scss\";\nimport { createPortal } from \"react-dom\";\n\nexport interface Props extends PopoverProps {\n open: boolean;\n headers: HeaderCell[];\n titleLabel?: string;\n closeButtonTitle?: string;\n onClose: () => void;\n onToggleClicked: (colName: string) => void;\n domRoot?: HTMLElement;\n}\n\nconst DataGridColumnsToggleComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n open,\n headers,\n titleLabel = \"Show columns\",\n closeButtonTitle = \"Close show columns dialog\",\n onClose,\n onToggleClicked,\n className,\n domRoot = document.body,\n ...rest\n }: Props,\n ref\n) => {\n const [id] = useState(generateID());\n const labelledId = id + \"_header\";\n\n const toggles = headers.map(item => (\n <Toggle\n key={item.name}\n name={item.name}\n checked={!item.hidden}\n onChange={() => onToggleClicked(item.name)}\n label={item.headline}\n />\n ));\n\n const handleBackdropClick = () => onClose();\n\n return (\n <Popover\n {...rest}\n ref={ref}\n className={`${classes[\"popover\"]} ${className}`}\n show={open}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={labelledId}\n >\n {
|
|
1
|
+
{"version":3,"file":"DataGridColumnsToggle.cjs.js","sources":["../../../../src/components/DataGrid/DataGridActions/DataGridColumnsToggle.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, Fragment, useState } from \"react\";\nimport { IconButton } from \"../../Button/IconButton\";\nimport { Toggle } from \"../../Form/Toggle/Toggle\";\nimport { Icon, Icons } from \"../../Icon/Icon\";\nimport { Popover, Props as PopoverProps } from \"../../Popover/Popover\";\nimport { Typography } from \"../../Typography/Typography\";\nimport { generateID } from \"../../../util/helper\";\nimport { HeaderCell } from \"../datagrid.interfaces\";\nimport classes from \"./DataGridColumnsToggle.module.scss\";\nimport { createPortal } from \"react-dom\";\n\nexport interface Props extends PopoverProps {\n open: boolean;\n headers: HeaderCell[];\n titleLabel?: string;\n closeButtonTitle?: string;\n onClose: () => void;\n onToggleClicked: (colName: string) => void;\n domRoot?: HTMLElement;\n}\n\nconst DataGridColumnsToggleComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n open,\n headers,\n titleLabel = \"Show columns\",\n closeButtonTitle = \"Close show columns dialog\",\n onClose,\n onToggleClicked,\n className,\n domRoot = document.body,\n ...rest\n }: Props,\n ref\n) => {\n const [id] = useState(generateID());\n const labelledId = id + \"_header\";\n\n const toggles = headers.map(item => (\n <Toggle\n key={item.name}\n name={item.name}\n checked={!item.hidden}\n onChange={() => onToggleClicked(item.name)}\n label={item.headline}\n />\n ));\n\n const handleBackdropClick = () => onClose();\n\n return (\n <Popover\n {...rest}\n ref={ref}\n className={`${classes[\"popover\"]} ${className}`}\n show={open}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={labelledId}\n >\n {createPortal(\n <div\n aria-hidden=\"true\"\n className={classes[\"backdrop\"]}\n onClick={handleBackdropClick}\n ></div>,\n domRoot\n )}\n <Fragment>\n <div className={classes[\"header\"]}>\n <Typography id={labelledId} className={classes[\"title\"]} tag=\"span\" variant=\"h4\">\n {titleLabel}\n </Typography>\n <IconButton\n onClick={onClose}\n className={`${classes[\"close-btn\"]}`}\n title={closeButtonTitle}\n >\n <Icon icon={Icons.Times} />\n </IconButton>\n </div>\n <div className={classes[\"content\"]}>{toggles}</div>\n </Fragment>\n </Popover>\n );\n};\n\nexport const DataGridColumnsToggle = React.forwardRef(DataGridColumnsToggleComponent);\n"],"names":["DataGridColumnsToggle","React","forwardRef","open","headers","titleLabel","closeButtonTitle","onClose","onToggleClicked","className","domRoot","document","body","rest","ref","id","useState","generateID","labelledId","toggles","map","item","createElement","Toggle","key","name","checked","hidden","onChange","label","headline","Popover","classes","default","show","role","createPortal","onClick","Fragment","Typography","tag","variant","IconButton","title","Icon","icon","Icons","Times"],"mappings":"wbAuGaA,EAAwBC,EAAMC,YAlE6C,EAEpFC,OACAC,UACAC,aAAa,eACbC,mBAAmB,4BACnBC,UACAC,kBACAC,YACAC,UAAUC,SAASC,QAChBC,GAELC,KAEA,MAAOC,GAAMC,EAAAA,SAASC,gBAChBC,EAAaH,EAAK,UAElBI,EAAUf,EAAQgB,KACtBC,GAAApB,EAAAqB,cAACC,EAAAA,OAAA,CACCC,IAAKH,EAAKI,KACVA,KAAMJ,EAAKI,KACXC,SAAUL,EAAKM,OACfC,SAAU,IAAMpB,EAAgBa,EAAKI,MACrCI,MAAOR,EAAKS,aAOd,OAAA7B,EAAAqB,cAACS,EAAAA,QAAA,IACKlB,EACJC,MACAL,UAAW,GAAGuB,EAAAC,QAAiB,WAAKxB,IACpCyB,KAAM/B,EACNgC,KAAK,SACL,aAAW,OACX,kBAAiBjB,GAEhBkB,EAAAA,aACCnC,EAAAqB,cAAC,MAAA,CACC,cAAY,OACZb,UAAWuB,UAAkB,SAC7BK,QAhBoB,IAAM9B,MAkB5BG,GAEFT,EAAAqB,cAACgB,EAAAA,cACErC,EAAAqB,cAAA,MAAA,CAAIb,UAAWuB,EAAQC,QAAQ,QAC7BhC,EAAAqB,cAAAiB,aAAA,CAAWxB,GAAIG,EAAYT,UAAWuB,UAAe,MAAGQ,IAAI,OAAOC,QAAQ,MACzEpC,GAEHJ,EAAAqB,cAACoB,EAAAA,WAAA,CACCL,QAAS9B,EACTE,UAAW,GAAGuB,UAAQ,eACtBW,MAAOrC,GAENL,EAAAqB,cAAAsB,EAAAA,KAAA,CAAKC,KAAMC,EAAAA,MAAMC,UAGrB9C,EAAAqB,cAAA,MAAA,CAAIb,UAAWuB,UAAiB,SAAIb,IAEzC"}
|
|
@@ -42,7 +42,7 @@ const DataGridColumnsToggleComponent = ({
|
|
|
42
42
|
"aria-modal": "true",
|
|
43
43
|
"aria-labelledby": labelledId
|
|
44
44
|
},
|
|
45
|
-
|
|
45
|
+
createPortal(
|
|
46
46
|
/* @__PURE__ */ React.createElement(
|
|
47
47
|
"div",
|
|
48
48
|
{
|
|
@@ -53,7 +53,7 @@ const DataGridColumnsToggleComponent = ({
|
|
|
53
53
|
),
|
|
54
54
|
domRoot
|
|
55
55
|
),
|
|
56
|
-
|
|
56
|
+
/* @__PURE__ */ React.createElement(Fragment, null, /* @__PURE__ */ React.createElement("div", { className: classes["header"] }, /* @__PURE__ */ React.createElement(Typography, { id: labelledId, className: classes["title"], tag: "span", variant: "h4" }, titleLabel), /* @__PURE__ */ React.createElement(
|
|
57
57
|
IconButton,
|
|
58
58
|
{
|
|
59
59
|
onClick: onClose,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridColumnsToggle.es.js","sources":["../../../../src/components/DataGrid/DataGridActions/DataGridColumnsToggle.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, Fragment, useState } from \"react\";\nimport { IconButton } from \"../../Button/IconButton\";\nimport { Toggle } from \"../../Form/Toggle/Toggle\";\nimport { Icon, Icons } from \"../../Icon/Icon\";\nimport { Popover, Props as PopoverProps } from \"../../Popover/Popover\";\nimport { Typography } from \"../../Typography/Typography\";\nimport { generateID } from \"../../../util/helper\";\nimport { HeaderCell } from \"../datagrid.interfaces\";\nimport classes from \"./DataGridColumnsToggle.module.scss\";\nimport { createPortal } from \"react-dom\";\n\nexport interface Props extends PopoverProps {\n open: boolean;\n headers: HeaderCell[];\n titleLabel?: string;\n closeButtonTitle?: string;\n onClose: () => void;\n onToggleClicked: (colName: string) => void;\n domRoot?: HTMLElement;\n}\n\nconst DataGridColumnsToggleComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n open,\n headers,\n titleLabel = \"Show columns\",\n closeButtonTitle = \"Close show columns dialog\",\n onClose,\n onToggleClicked,\n className,\n domRoot = document.body,\n ...rest\n }: Props,\n ref\n) => {\n const [id] = useState(generateID());\n const labelledId = id + \"_header\";\n\n const toggles = headers.map(item => (\n <Toggle\n key={item.name}\n name={item.name}\n checked={!item.hidden}\n onChange={() => onToggleClicked(item.name)}\n label={item.headline}\n />\n ));\n\n const handleBackdropClick = () => onClose();\n\n return (\n <Popover\n {...rest}\n ref={ref}\n className={`${classes[\"popover\"]} ${className}`}\n show={open}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={labelledId}\n >\n {
|
|
1
|
+
{"version":3,"file":"DataGridColumnsToggle.es.js","sources":["../../../../src/components/DataGrid/DataGridActions/DataGridColumnsToggle.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, Fragment, useState } from \"react\";\nimport { IconButton } from \"../../Button/IconButton\";\nimport { Toggle } from \"../../Form/Toggle/Toggle\";\nimport { Icon, Icons } from \"../../Icon/Icon\";\nimport { Popover, Props as PopoverProps } from \"../../Popover/Popover\";\nimport { Typography } from \"../../Typography/Typography\";\nimport { generateID } from \"../../../util/helper\";\nimport { HeaderCell } from \"../datagrid.interfaces\";\nimport classes from \"./DataGridColumnsToggle.module.scss\";\nimport { createPortal } from \"react-dom\";\n\nexport interface Props extends PopoverProps {\n open: boolean;\n headers: HeaderCell[];\n titleLabel?: string;\n closeButtonTitle?: string;\n onClose: () => void;\n onToggleClicked: (colName: string) => void;\n domRoot?: HTMLElement;\n}\n\nconst DataGridColumnsToggleComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n open,\n headers,\n titleLabel = \"Show columns\",\n closeButtonTitle = \"Close show columns dialog\",\n onClose,\n onToggleClicked,\n className,\n domRoot = document.body,\n ...rest\n }: Props,\n ref\n) => {\n const [id] = useState(generateID());\n const labelledId = id + \"_header\";\n\n const toggles = headers.map(item => (\n <Toggle\n key={item.name}\n name={item.name}\n checked={!item.hidden}\n onChange={() => onToggleClicked(item.name)}\n label={item.headline}\n />\n ));\n\n const handleBackdropClick = () => onClose();\n\n return (\n <Popover\n {...rest}\n ref={ref}\n className={`${classes[\"popover\"]} ${className}`}\n show={open}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={labelledId}\n >\n {createPortal(\n <div\n aria-hidden=\"true\"\n className={classes[\"backdrop\"]}\n onClick={handleBackdropClick}\n ></div>,\n domRoot\n )}\n <Fragment>\n <div className={classes[\"header\"]}>\n <Typography id={labelledId} className={classes[\"title\"]} tag=\"span\" variant=\"h4\">\n {titleLabel}\n </Typography>\n <IconButton\n onClick={onClose}\n className={`${classes[\"close-btn\"]}`}\n title={closeButtonTitle}\n >\n <Icon icon={Icons.Times} />\n </IconButton>\n </div>\n <div className={classes[\"content\"]}>{toggles}</div>\n </Fragment>\n </Popover>\n );\n};\n\nexport const DataGridColumnsToggle = React.forwardRef(DataGridColumnsToggleComponent);\n"],"names":[],"mappings":";;;;;;;;;AAqCA,MAAM,iCAAkF,CACtF;AAAA,EACE;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU,SAAS;AAAA,EACnB,GAAG;AACL,GACA,QACG;AACH,QAAM,CAAC,EAAE,IAAI,SAAS,YAAY;AAClC,QAAM,aAAa,KAAK;AAElB,QAAA,UAAU,QAAQ,IAAI,CAC1B,SAAA,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK,KAAK;AAAA,MACV,MAAM,KAAK;AAAA,MACX,SAAS,CAAC,KAAK;AAAA,MACf,UAAU,MAAM,gBAAgB,KAAK,IAAI;AAAA,MACzC,OAAO,KAAK;AAAA,IAAA;AAAA,EAAA,CAEf;AAEK,QAAA,sBAAsB,MAAM,QAAQ;AAGxC,SAAA,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,WAAW,GAAG,QAAQ,SAAS,CAAC,IAAI,SAAS;AAAA,MAC7C,MAAM;AAAA,MACN,MAAK;AAAA,MACL,cAAW;AAAA,MACX,mBAAiB;AAAA,IAAA;AAAA,IAEhB;AAAA,MACC,sBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,eAAY;AAAA,UACZ,WAAW,QAAQ,UAAU;AAAA,UAC7B,SAAS;AAAA,QAAA;AAAA,MACV;AAAA,MACD;AAAA,IACF;AAAA,IACA,sBAAA,cAAC,gBACE,sBAAA,cAAA,OAAA,EAAI,WAAW,QAAQ,QAAQ,KAC7B,sBAAA,cAAA,YAAA,EAAW,IAAI,YAAY,WAAW,QAAQ,OAAO,GAAG,KAAI,QAAO,SAAQ,KACzE,GAAA,UACH,GACA,sBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAS;AAAA,QACT,WAAW,GAAG,QAAQ,WAAW,CAAC;AAAA,QAClC,OAAO;AAAA,MAAA;AAAA,MAEN,sBAAA,cAAA,MAAA,EAAK,MAAM,MAAM,MAAO,CAAA;AAAA,IAAA,CAE7B,GACC,sBAAA,cAAA,OAAA,EAAI,WAAW,QAAQ,SAAS,EAAI,GAAA,OAAQ,CAC/C;AAAA,EACF;AAEJ;AAEa,MAAA,wBAAwB,MAAM,WAAW,8BAA8B;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DataGridColumnsToggle_popover_uJyTX{background-color:var(--modal-background-color);z-index:1;min-width:17.5rem;font-family:var(--font-family)}.DataGridColumnsToggle_backdrop_uJyTX{content:"";position:absolute;width:100%;height:100%;left:0;top:0;background-color:transparent}.DataGridColumnsToggle_header_uJyTX{min-width:5rem;padding:1rem .5rem 1rem 1.5rem;background-color:var(--modal-header-background-color);border-top-left-radius:.5rem;border-top-right-radius:.5rem;display:flex;align-items:center}.DataGridColumnsToggle_title_uJyTX{flex:1;margin:0}.DataGridColumnsToggle_close-btn_uJyTX{margin-left:.5rem}.DataGridColumnsToggle_content_uJyTX{padding:1.5rem;display:flex;flex-direction:column;gap:1.25rem}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="DataGridColumnsToggle_popover_uJyTX",o="DataGridColumnsToggle_backdrop_uJyTX",t="DataGridColumnsToggle_header_uJyTX",r="DataGridColumnsToggle_title_uJyTX",l="DataGridColumnsToggle_content_uJyTX",a={popover:e,backdrop:o,header:t,title:r,"close-btn":"DataGridColumnsToggle_close-btn_uJyTX",content:l};exports.backdrop=o,exports.content=l,exports.default=a,exports.header=t,exports.popover=e,exports.title=r;
|
|
3
3
|
//# sourceMappingURL=DataGridColumnsToggle.module.scss.cjs.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.
|
|
2
|
-
const popover = "
|
|
3
|
-
const backdrop = "
|
|
4
|
-
const header = "
|
|
5
|
-
const title = "
|
|
6
|
-
const content = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DataGridColumnsToggle_popover_uJyTX{background-color:var(--modal-background-color);z-index:1;min-width:17.5rem;font-family:var(--font-family)}.DataGridColumnsToggle_backdrop_uJyTX{content:"";position:absolute;width:100%;height:100%;left:0;top:0;background-color:transparent}.DataGridColumnsToggle_header_uJyTX{min-width:5rem;padding:1rem .5rem 1rem 1.5rem;background-color:var(--modal-header-background-color);border-top-left-radius:.5rem;border-top-right-radius:.5rem;display:flex;align-items:center}.DataGridColumnsToggle_title_uJyTX{flex:1;margin:0}.DataGridColumnsToggle_close-btn_uJyTX{margin-left:.5rem}.DataGridColumnsToggle_content_uJyTX{padding:1.5rem;display:flex;flex-direction:column;gap:1.25rem}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
const popover = "DataGridColumnsToggle_popover_uJyTX";
|
|
3
|
+
const backdrop = "DataGridColumnsToggle_backdrop_uJyTX";
|
|
4
|
+
const header = "DataGridColumnsToggle_header_uJyTX";
|
|
5
|
+
const title = "DataGridColumnsToggle_title_uJyTX";
|
|
6
|
+
const content = "DataGridColumnsToggle_content_uJyTX";
|
|
7
7
|
const classes = {
|
|
8
8
|
popover,
|
|
9
9
|
backdrop,
|
|
10
10
|
header,
|
|
11
11
|
title,
|
|
12
|
-
"close-btn": "DataGridColumnsToggle_close-
|
|
12
|
+
"close-btn": "DataGridColumnsToggle_close-btn_uJyTX",
|
|
13
13
|
content
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DataGridBody_empty_uJyTX{text-align:center;height:6rem;padding:2rem;vertical-align:top}.DataGridBody_empty_uJyTX p{color:var(--greyed-out)}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="DataGridBody_empty_uJyTX",t={empty:e};exports.default=t,exports.empty=e;
|
|
3
3
|
//# sourceMappingURL=DataGridBody.module.scss.cjs.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.
|
|
2
|
-
const empty = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.DataGridBody_empty_uJyTX{text-align:center;height:6rem;padding:2rem;vertical-align:top}.DataGridBody_empty_uJyTX p{color:var(--greyed-out)}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
const empty = "DataGridBody_empty_uJyTX";
|
|
3
3
|
const classes = {
|
|
4
4
|
empty
|
|
5
5
|
};
|