@greenbone/ui-lib 1.5.0 → 1.5.1-alpha0
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/lib/cjs/api/error/libs.js.map +1 -1
- package/lib/cjs/components/Accordion/Accordion.js +1 -1
- package/lib/cjs/components/Accordion/Accordion.js.map +1 -1
- package/lib/cjs/components/Alert/Alert.js +1 -1
- package/lib/cjs/components/Alert/Alert.js.map +1 -1
- package/lib/cjs/components/Badge/Badge.js.map +1 -1
- package/lib/cjs/components/BadgeIconHoverCard/BadgeIconHoverCard.js.map +1 -1
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/cjs/components/ConfirmationDialog/ConfirmationDialog.js +1 -1
- package/lib/cjs/components/ConfirmationDialog/ConfirmationDialog.js.map +1 -1
- package/lib/cjs/components/DateInline/DateInline.js.map +1 -1
- package/lib/cjs/components/Drawer/Drawer.js +1 -1
- package/lib/cjs/components/Drawer/Drawer.js.map +1 -1
- package/lib/cjs/components/Filter/TermContainer/Term/TermBadge.js +1 -1
- package/lib/cjs/components/Filter/TermContainer/Term/TermBadge.js.map +1 -1
- package/lib/cjs/components/Filter/TermContainer/index.js +1 -1
- package/lib/cjs/components/Filter/TermContainer/index.js.map +1 -1
- package/lib/cjs/components/Filter/persistence/FilterPersistent.js +1 -1
- package/lib/cjs/components/Filter/persistence/FilterPersistent.js.map +1 -1
- package/lib/cjs/components/Filter/utils/FilterSelect.js +1 -1
- package/lib/cjs/components/Filter/utils/FilterSelect.js.map +1 -1
- package/lib/cjs/components/Filter/utils/Select.js +1 -1
- package/lib/cjs/components/Filter/utils/Select.js.map +1 -1
- package/lib/cjs/components/Form/Button/Button.js +1 -1
- package/lib/cjs/components/Form/Button/Button.js.map +1 -1
- package/lib/cjs/components/Form/Checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/Form/Checkbox/Checkbox.js.map +1 -1
- package/lib/cjs/components/Form/DateTimePicker/DateTimePicker.js +1 -1
- package/lib/cjs/components/Form/DateTimePicker/DateTimePicker.js.map +1 -1
- package/lib/cjs/components/Form/DateTimePicker/TimePicker.js +1 -1
- package/lib/cjs/components/Form/DateTimePicker/TimePicker.js.map +1 -1
- package/lib/cjs/components/Form/FileInput/FileInput.js +1 -1
- package/lib/cjs/components/Form/FileInput/FileInput.js.map +1 -1
- package/lib/cjs/components/Form/Form/Form.js +1 -1
- package/lib/cjs/components/Form/Form/Form.js.map +1 -1
- package/lib/cjs/components/Form/FormItemGroup.js.map +1 -1
- package/lib/cjs/components/Form/Input/Input.js +1 -1
- package/lib/cjs/components/Form/Input/Input.js.map +1 -1
- package/lib/cjs/components/Form/Labels/InfoLabel.js.map +1 -1
- package/lib/cjs/components/Form/Labels/LabelWithIcon.js.map +1 -1
- package/lib/cjs/components/Form/MenuButton/index.js +1 -1
- package/lib/cjs/components/Form/MenuButton/index.js.map +1 -1
- package/lib/cjs/components/Form/PasswordInput/PasswordInput.js +1 -1
- package/lib/cjs/components/Form/PasswordInput/PasswordInput.js.map +1 -1
- package/lib/cjs/components/Form/RadioButton/RadioButton.js +1 -1
- package/lib/cjs/components/Form/RadioButton/RadioButton.js.map +1 -1
- package/lib/cjs/components/Form/Select/Cascade/CascadeMenu.js +1 -1
- package/lib/cjs/components/Form/Select/Cascade/CascadeMenu.js.map +1 -1
- package/lib/cjs/components/Form/Select/Cascade/CascadeOption.js +1 -1
- package/lib/cjs/components/Form/Select/Cascade/CascadeOption.js.map +1 -1
- package/lib/cjs/components/Form/Select/Cascade/index.js +1 -1
- package/lib/cjs/components/Form/Select/Cascade/index.js.map +1 -1
- package/lib/cjs/components/Form/Select/CreatableSelect.js +1 -1
- package/lib/cjs/components/Form/Select/CreatableSelect.js.map +1 -1
- package/lib/cjs/components/Form/Select/Select.js +1 -1
- package/lib/cjs/components/Form/Select/Select.js.map +1 -1
- package/lib/cjs/components/Form/Switch/Switch.js +1 -1
- package/lib/cjs/components/Form/Switch/Switch.js.map +1 -1
- package/lib/cjs/components/Form/Textarea/Textarea.js +1 -1
- package/lib/cjs/components/Form/Textarea/Textarea.js.map +1 -1
- package/lib/cjs/components/HighlightBox/HighlightBox.js +2 -0
- package/lib/cjs/components/HighlightBox/HighlightBox.js.map +1 -0
- package/lib/cjs/components/HighlightBox/HighlightBox.module.css +1 -0
- package/lib/cjs/components/HighlightBox/index.js +2 -0
- package/lib/cjs/components/HighlightBox/index.js.map +1 -0
- package/lib/cjs/components/HoverCard/HoverCard.js.map +1 -1
- package/lib/cjs/components/Icon/Icon.js +1 -1
- package/lib/cjs/components/Icon/Icon.js.map +1 -1
- package/lib/cjs/components/InfoTip/InfoTip.js +1 -1
- package/lib/cjs/components/InfoTip/InfoTip.js.map +1 -1
- package/lib/cjs/components/InformationList/InformationList.js +1 -1
- package/lib/cjs/components/InformationList/InformationList.js.map +1 -1
- package/lib/cjs/components/Layout/AppHeader/AppHeader.js +1 -1
- package/lib/cjs/components/Layout/AppHeader/AppHeader.js.map +1 -1
- package/lib/cjs/components/Layout/AppHeader/TimeZone.js.map +1 -1
- package/lib/cjs/components/Layout/AppHeader/languageSwitch/LanguageSwitch.js.map +1 -1
- package/lib/cjs/components/Layout/AppHeader/manual/Manual.js.map +1 -1
- package/lib/cjs/components/Layout/AppHeader/themeSwitch/ThemeSwitch.js.map +1 -1
- package/lib/cjs/components/Layout/AppHeader/userNav/NavItem.js +1 -1
- package/lib/cjs/components/Layout/AppHeader/userNav/NavItem.js.map +1 -1
- package/lib/cjs/components/Layout/AppHeader/userNav/UserNav.js.map +1 -1
- package/lib/cjs/components/Layout/AppNavigation/AppNavigationLink.js +1 -1
- package/lib/cjs/components/Layout/AppNavigation/AppNavigationLink.js.map +1 -1
- package/lib/cjs/components/Layout/SimplePageLayout/SimpleGrid.js +1 -1
- package/lib/cjs/components/Layout/SimplePageLayout/SimpleGrid.js.map +1 -1
- package/lib/cjs/components/Layout/SimplePageLayout/index.js +1 -1
- package/lib/cjs/components/Layout/SimplePageLayout/index.js.map +1 -1
- package/lib/cjs/components/Modal/Modal.js +1 -1
- package/lib/cjs/components/Modal/Modal.js.map +1 -1
- package/lib/cjs/components/Notification/notifications.js +1 -1
- package/lib/cjs/components/Notification/notifications.js.map +1 -1
- package/lib/cjs/components/Table/TableClientSide/TableClientSidePersistent/index.js +1 -1
- package/lib/cjs/components/Table/TableClientSide/TableClientSidePersistent/index.js.map +1 -1
- package/lib/cjs/components/Table/TableServerSide/TableServerSidePersistent/index.js +1 -1
- package/lib/cjs/components/Table/TableServerSide/TableServerSidePersistent/index.js.map +1 -1
- package/lib/cjs/components/Table/components/ActionMenu/ActionMenu.js +1 -1
- package/lib/cjs/components/Table/components/ActionMenu/ActionMenu.js.map +1 -1
- package/lib/cjs/components/Tag/Tag.js +1 -1
- package/lib/cjs/components/Tag/Tag.js.map +1 -1
- package/lib/cjs/components/TextWithTooltip/TextWithTooltip.js.map +1 -1
- package/lib/cjs/components/TimeZoneInfo/index.js +1 -1
- package/lib/cjs/components/TimeZoneInfo/index.js.map +1 -1
- package/lib/cjs/components/Tooltip/Tooltip.js +1 -1
- package/lib/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/cjs/components/Typo/Typo.js +1 -1
- package/lib/cjs/components/Typo/Typo.js.map +1 -1
- package/lib/cjs/icons/StatusIcon/StatusIcon.js +1 -1
- package/lib/cjs/icons/StatusIcon/StatusIcon.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/api/error/libs.js.map +1 -1
- package/lib/esm/components/Accordion/Accordion.js +1 -1
- package/lib/esm/components/Accordion/Accordion.js.map +1 -1
- package/lib/esm/components/Alert/Alert.js +1 -1
- package/lib/esm/components/Alert/Alert.js.map +1 -1
- package/lib/esm/components/Badge/Badge.js.map +1 -1
- package/lib/esm/components/BadgeIconHoverCard/BadgeIconHoverCard.js.map +1 -1
- package/lib/esm/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/esm/components/ConfirmationDialog/ConfirmationDialog.js +1 -1
- package/lib/esm/components/ConfirmationDialog/ConfirmationDialog.js.map +1 -1
- package/lib/esm/components/DateInline/DateInline.js.map +1 -1
- package/lib/esm/components/Drawer/Drawer.js +1 -1
- package/lib/esm/components/Drawer/Drawer.js.map +1 -1
- package/lib/esm/components/Filter/TermContainer/Term/TermBadge.js +1 -1
- package/lib/esm/components/Filter/TermContainer/Term/TermBadge.js.map +1 -1
- package/lib/esm/components/Filter/TermContainer/index.js +1 -1
- package/lib/esm/components/Filter/TermContainer/index.js.map +1 -1
- package/lib/esm/components/Filter/persistence/FilterPersistent.js +1 -1
- package/lib/esm/components/Filter/persistence/FilterPersistent.js.map +1 -1
- package/lib/esm/components/Filter/utils/FilterSelect.js +1 -1
- package/lib/esm/components/Filter/utils/FilterSelect.js.map +1 -1
- package/lib/esm/components/Filter/utils/Select.js +1 -1
- package/lib/esm/components/Filter/utils/Select.js.map +1 -1
- package/lib/esm/components/Form/Button/Button.js +1 -1
- package/lib/esm/components/Form/Button/Button.js.map +1 -1
- package/lib/esm/components/Form/Checkbox/Checkbox.js +1 -1
- package/lib/esm/components/Form/Checkbox/Checkbox.js.map +1 -1
- package/lib/esm/components/Form/DateTimePicker/DateTimePicker.js +1 -1
- package/lib/esm/components/Form/DateTimePicker/DateTimePicker.js.map +1 -1
- package/lib/esm/components/Form/DateTimePicker/TimePicker.js +1 -1
- package/lib/esm/components/Form/DateTimePicker/TimePicker.js.map +1 -1
- package/lib/esm/components/Form/FileInput/FileInput.js +1 -1
- package/lib/esm/components/Form/FileInput/FileInput.js.map +1 -1
- package/lib/esm/components/Form/Form/Form.js +1 -1
- package/lib/esm/components/Form/Form/Form.js.map +1 -1
- package/lib/esm/components/Form/FormItemGroup.js.map +1 -1
- package/lib/esm/components/Form/Input/Input.js +1 -1
- package/lib/esm/components/Form/Input/Input.js.map +1 -1
- package/lib/esm/components/Form/Labels/InfoLabel.js.map +1 -1
- package/lib/esm/components/Form/Labels/LabelWithIcon.js.map +1 -1
- package/lib/esm/components/Form/MenuButton/index.js +1 -1
- package/lib/esm/components/Form/MenuButton/index.js.map +1 -1
- package/lib/esm/components/Form/PasswordInput/PasswordInput.js +1 -1
- package/lib/esm/components/Form/PasswordInput/PasswordInput.js.map +1 -1
- package/lib/esm/components/Form/RadioButton/RadioButton.js +1 -1
- package/lib/esm/components/Form/RadioButton/RadioButton.js.map +1 -1
- package/lib/esm/components/Form/Select/Cascade/CascadeMenu.js +1 -1
- package/lib/esm/components/Form/Select/Cascade/CascadeMenu.js.map +1 -1
- package/lib/esm/components/Form/Select/Cascade/CascadeOption.js +1 -1
- package/lib/esm/components/Form/Select/Cascade/CascadeOption.js.map +1 -1
- package/lib/esm/components/Form/Select/Cascade/index.js +1 -1
- package/lib/esm/components/Form/Select/Cascade/index.js.map +1 -1
- package/lib/esm/components/Form/Select/CreatableSelect.js +1 -1
- package/lib/esm/components/Form/Select/CreatableSelect.js.map +1 -1
- package/lib/esm/components/Form/Select/Select.js +1 -1
- package/lib/esm/components/Form/Select/Select.js.map +1 -1
- package/lib/esm/components/Form/Switch/Switch.js +1 -1
- package/lib/esm/components/Form/Switch/Switch.js.map +1 -1
- package/lib/esm/components/Form/Textarea/Textarea.js +1 -1
- package/lib/esm/components/Form/Textarea/Textarea.js.map +1 -1
- package/lib/esm/components/HighlightBox/HighlightBox.js +2 -0
- package/lib/esm/components/HighlightBox/HighlightBox.js.map +1 -0
- package/lib/esm/components/HighlightBox/HighlightBox.module.css +1 -0
- package/lib/esm/components/HighlightBox/index.js +2 -0
- package/lib/esm/components/HighlightBox/index.js.map +1 -0
- package/lib/esm/components/HoverCard/HoverCard.js.map +1 -1
- package/lib/esm/components/Icon/Icon.js +1 -1
- package/lib/esm/components/Icon/Icon.js.map +1 -1
- package/lib/esm/components/InfoTip/InfoTip.js +1 -1
- package/lib/esm/components/InfoTip/InfoTip.js.map +1 -1
- package/lib/esm/components/InformationList/InformationList.js +1 -1
- package/lib/esm/components/InformationList/InformationList.js.map +1 -1
- package/lib/esm/components/Layout/AppHeader/AppHeader.js +1 -1
- package/lib/esm/components/Layout/AppHeader/AppHeader.js.map +1 -1
- package/lib/esm/components/Layout/AppHeader/TimeZone.js.map +1 -1
- package/lib/esm/components/Layout/AppHeader/languageSwitch/LanguageSwitch.js.map +1 -1
- package/lib/esm/components/Layout/AppHeader/manual/Manual.js.map +1 -1
- package/lib/esm/components/Layout/AppHeader/themeSwitch/ThemeSwitch.js.map +1 -1
- package/lib/esm/components/Layout/AppHeader/userNav/NavItem.js +1 -1
- package/lib/esm/components/Layout/AppHeader/userNav/NavItem.js.map +1 -1
- package/lib/esm/components/Layout/AppHeader/userNav/UserNav.js.map +1 -1
- package/lib/esm/components/Layout/AppNavigation/AppNavigationLink.js +1 -1
- package/lib/esm/components/Layout/AppNavigation/AppNavigationLink.js.map +1 -1
- package/lib/esm/components/Layout/SimplePageLayout/SimpleGrid.js +1 -1
- package/lib/esm/components/Layout/SimplePageLayout/SimpleGrid.js.map +1 -1
- package/lib/esm/components/Layout/SimplePageLayout/index.js +1 -1
- package/lib/esm/components/Layout/SimplePageLayout/index.js.map +1 -1
- package/lib/esm/components/Modal/Modal.js +1 -1
- package/lib/esm/components/Modal/Modal.js.map +1 -1
- package/lib/esm/components/Notification/notifications.js +1 -1
- package/lib/esm/components/Notification/notifications.js.map +1 -1
- package/lib/esm/components/Table/TableClientSide/TableClientSidePersistent/index.js +1 -1
- package/lib/esm/components/Table/TableClientSide/TableClientSidePersistent/index.js.map +1 -1
- package/lib/esm/components/Table/TableServerSide/TableServerSidePersistent/index.js +1 -1
- package/lib/esm/components/Table/TableServerSide/TableServerSidePersistent/index.js.map +1 -1
- package/lib/esm/components/Table/components/ActionMenu/ActionMenu.js +1 -1
- package/lib/esm/components/Table/components/ActionMenu/ActionMenu.js.map +1 -1
- package/lib/esm/components/Tag/Tag.js +1 -1
- package/lib/esm/components/Tag/Tag.js.map +1 -1
- package/lib/esm/components/TextWithTooltip/TextWithTooltip.js.map +1 -1
- package/lib/esm/components/TimeZoneInfo/index.js +1 -1
- package/lib/esm/components/TimeZoneInfo/index.js.map +1 -1
- package/lib/esm/components/Tooltip/Tooltip.js +1 -1
- package/lib/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/esm/components/Typo/Typo.js +1 -1
- package/lib/esm/components/Typo/Typo.js.map +1 -1
- package/lib/esm/icons/StatusIcon/StatusIcon.js +1 -1
- package/lib/esm/icons/StatusIcon/StatusIcon.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/types/src/api/error/libs.d.ts.map +1 -1
- package/types/src/components/Alert/Alert.d.ts.map +1 -1
- package/types/src/components/Badge/Badge.d.ts +0 -1
- package/types/src/components/Badge/Badge.d.ts.map +1 -1
- package/types/src/components/BadgeIconHoverCard/BadgeIconHoverCard.d.ts.map +1 -1
- package/types/src/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/types/src/components/DateInline/DateInline.d.ts.map +1 -1
- package/types/src/components/Drawer/Drawer.d.ts.map +1 -1
- package/types/src/components/Form/Button/Button.d.ts.map +1 -1
- package/types/src/components/Form/Checkbox/Checkbox.d.ts.map +1 -1
- package/types/src/components/Form/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/types/src/components/Form/DateTimePicker/TimePicker.d.ts.map +1 -1
- package/types/src/components/Form/FileInput/FileInput.d.ts.map +1 -1
- package/types/src/components/Form/FormItemGroup.d.ts.map +1 -1
- package/types/src/components/Form/Labels/InfoLabel.d.ts.map +1 -1
- package/types/src/components/Form/Labels/LabelWithIcon.d.ts.map +1 -1
- package/types/src/components/Form/MenuButton/index.d.ts.map +1 -1
- package/types/src/components/Form/RadioButton/RadioButton.d.ts.map +1 -1
- package/types/src/components/HighlightBox/HighlightBox.d.ts +3 -0
- package/types/src/components/HighlightBox/HighlightBox.d.ts.map +1 -0
- package/types/src/components/HighlightBox/index.d.ts +2 -0
- package/types/src/components/HighlightBox/index.d.ts.map +1 -0
- package/types/src/components/HoverCard/HoverCard.d.ts.map +1 -1
- package/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/types/src/components/InformationList/InformationList.d.ts.map +1 -1
- package/types/src/components/Layout/AppHeader/AppHeader.d.ts.map +1 -1
- package/types/src/components/Layout/AppHeader/TimeZone.d.ts.map +1 -1
- package/types/src/components/Layout/AppHeader/languageSwitch/LanguageSwitch.d.ts.map +1 -1
- package/types/src/components/Layout/AppHeader/manual/Manual.d.ts.map +1 -1
- package/types/src/components/Layout/AppHeader/themeSwitch/ThemeSwitch.d.ts.map +1 -1
- package/types/src/components/Layout/AppHeader/userNav/NavItem.d.ts.map +1 -1
- package/types/src/components/Layout/AppHeader/userNav/UserNav.d.ts.map +1 -1
- package/types/src/index.d.ts +1 -0
- package/types/src/index.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/InfoTip/InfoTip.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React from \"react\"\nimport { useDisclosure } from \"@mantine/hooks\"\nimport { Popover, PopoverProps, useMantineTheme } from \"@mantine/core\"\nimport { Info, LucideIcon } from \"lucide-react\"\nimport classes from \"./InfoTip.module.css\"\nimport { ICON_SIZES } from \"../../theme\"\nimport { cx } from \"../../helper/cx\"\n\nexport type TInfoTipBasicProps = PopoverProps & {\n dropDownContent: React.ReactElement\n className?: string\n}\n\nexport type TInfoIProps = Omit<TInfoTipBasicProps, \"children\"> & {\n icon?: LucideIcon\n}\n\n/**\n * Provides detailed information for the user upon hover.\n * Usually used for infoIs.\n * @param dropDownContent component that should be displayed inside the infoTip\n * @param children\n * @param className a class name for additional styles for the Popover.Target wrapper\n */\nexport const InfoTip = ({ children, dropDownContent, className, ...props }: TInfoTipBasicProps) => {\n const [opened, { close, open }] = useDisclosure(false)\n\n return (\n <Popover position=\"top\" withArrow offset={4} opened={opened} withinPortal={true} {...props}>\n <Popover.Target>\n <div\n className={cx(classes[\"info-tip-target\"], className)}\n onMouseEnter={open}\n onMouseLeave={close}\n >\n {children}\n </div>\n </Popover.Target>\n <Popover.Dropdown className={cx(classes.root, className)}>{dropDownContent}</Popover.Dropdown>\n </Popover>\n )\n}\n\n/**\n * The InfoI is a sign for the user that additional information is\n * available. Upon hover an InfoTip will provide detailed information.\n * @param dropDownContent component that should be displayed inside the infoTip\n * @param children\n */\nexport const InfoI = ({ dropDownContent, icon, ...props }: TInfoIProps) => {\n const theme = useMantineTheme()\n const Icon = icon || Info\n return (\n <InfoTip data-testid=\"info-i\" dropDownContent={dropDownContent} {...props}>\n <Icon size={ICON_SIZES.MEDIUM} color={theme.colors.gray[5]} />\n </InfoTip>\n )\n}\n"],"names":["React","useDisclosure","Popover","useMantineTheme","Info","classes","ICON_SIZES","cx","InfoTip","children","dropDownContent","className","props","opened","close","open","position","withArrow","offset","withinPortal","Target","div","onMouseEnter","onMouseLeave","Dropdown","root","InfoI","icon","theme","Icon","data-testid","size","MEDIUM","color","colors","gray"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/InfoTip/InfoTip.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React from \"react\"\nimport { useDisclosure } from \"@mantine/hooks\"\nimport { Popover, PopoverProps, useMantineTheme } from \"@mantine/core\"\nimport { Info, LucideIcon } from \"lucide-react\"\nimport classes from \"./InfoTip.module.css\"\nimport { ICON_SIZES } from \"../../theme\"\nimport { cx } from \"../../helper/cx\"\n\nexport type TInfoTipBasicProps = PopoverProps & {\n dropDownContent: React.ReactElement\n className?: string\n}\n\nexport type TInfoIProps = Omit<TInfoTipBasicProps, \"children\"> & {\n icon?: LucideIcon\n}\n\n/**\n * Provides detailed information for the user upon hover.\n * Usually used for infoIs.\n * @param dropDownContent component that should be displayed inside the infoTip\n * @param children\n * @param className a class name for additional styles for the Popover.Target wrapper\n */\nexport const InfoTip = ({ children, dropDownContent, className, ...props }: TInfoTipBasicProps) => {\n const [opened, { close, open }] = useDisclosure(false)\n\n return (\n <Popover position=\"top\" withArrow offset={4} opened={opened} withinPortal={true} {...props}>\n <Popover.Target>\n <div\n className={cx(classes[\"info-tip-target\"], className)}\n onMouseEnter={open}\n onMouseLeave={close}\n >\n {children}\n </div>\n </Popover.Target>\n <Popover.Dropdown className={cx(classes.root, className)}>{dropDownContent}</Popover.Dropdown>\n </Popover>\n )\n}\n\n/**\n * The InfoI is a sign for the user that additional information is\n * available. Upon hover an InfoTip will provide detailed information.\n * @param dropDownContent component that should be displayed inside the infoTip\n * @param children\n */\nexport const InfoI = ({ dropDownContent, icon, ...props }: TInfoIProps) => {\n const theme = useMantineTheme()\n const Icon = icon || Info\n return (\n <InfoTip data-testid=\"info-i\" dropDownContent={dropDownContent} {...props}>\n <Icon size={ICON_SIZES.MEDIUM} color={theme.colors.gray[5]} />\n </InfoTip>\n )\n}\n"],"names":["React","useDisclosure","Popover","useMantineTheme","Info","classes","ICON_SIZES","cx","InfoTip","children","dropDownContent","className","props","opened","close","open","position","withArrow","offset","withinPortal","Target","div","onMouseEnter","onMouseLeave","Dropdown","root","InfoI","icon","theme","Icon","data-testid","size","MEDIUM","color","colors","gray"],"mappings":"w0EAIA,QAAOA,UAAW,OAAO,AACzB,QAASC,aAAa,KAAQ,gBAAgB,AAC9C,QAASC,OAAO,CAAgBC,eAAe,KAAQ,eAAe,AACtE,QAASC,IAAI,KAAoB,cAAc,AAC/C,QAAOC,YAAa,sBAAsB,AAC1C,QAASC,UAAU,KAAQ,aAAa,AACxC,QAASC,EAAE,KAAQ,iBAAiB,AAkBpC,QAAO,MAAMC,QAAU,QAAC,CAAEC,QAAQ,CAAEC,eAAe,CAAEC,SAAS,CAAgC,IAA3BC,gFACjE,KAAM,CAACC,OAAQ,CAAEC,KAAK,CAAEC,IAAI,CAAE,CAAC,CAAGd,cAAc,OAEhD,OACE,MAACC,6CAAQc,SAAS,MAAMC,SAAS,MAACC,OAAQ,EAAGL,OAAQA,OAAQM,aAAc,MAAUP,kBACnF,KAACV,QAAQkB,MAAM,WACb,KAACC,OACCV,UAAWJ,GAAGF,OAAO,CAAC,kBAAkB,CAAEM,WAC1CW,aAAcP,KACdQ,aAAcT,eAEbL,aAGL,KAACP,QAAQsB,QAAQ,EAACb,UAAWJ,GAAGF,QAAQoB,IAAI,CAAEd,oBAAaD,qBAGjE,CAAC,AAQD,QAAO,MAAMgB,MAAQ,QAAC,CAAEhB,eAAe,CAAEiB,IAAI,CAAyB,IAApBf,gEAChD,MAAMgB,MAAQzB,kBACd,MAAM0B,KAAOF,MAAQvB,KACrB,OACE,KAACI,6CAAQsB,cAAY,SAASpB,gBAAiBA,iBAAqBE,iBAClE,KAACiB,MAAKE,KAAMzB,WAAW0B,MAAM,CAAEC,MAAOL,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE,KAGhE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target=
|
|
1
|
+
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{createElement as _createElement}from"react";import{Fragment}from"react";import{Typo}from"../Typo";import classes from"./InformationList.module.css";import{cx}from"../../helper/cx";const getLargestRow=rows=>{return rows.reduce((acc,curr)=>{if(curr.length>acc)return curr.length;return acc},0)};const buildFillerColumns=(rowItems,largestRowItems)=>{const filler=[];if(rowItems<largestRowItems){const delta=largestRowItems-rowItems;for(let i=0;i<delta;i++){filler.push(_jsx("span",{},i))}}return filler.length?filler:null};export const InformationList=_0=>{let{firstColumnBold=true}=_0,props=_object_without_properties(_0,["firstColumnBold"]);const columnsAmount=getLargestRow(props.items);const rowAmount=props.items.length;const firstColumFontWeight=firstColumnBold?500:"inherit";return _jsx("div",{className:cx(classes.list,props.classname),style:{display:"grid",columnGap:props.columnGap||"var(--mantine-spacing-md)",rowGap:props.rowGap||"var(--mantine-spacing-xs)",gridTemplateColumns:`repeat(${columnsAmount}, fit-content(${100/columnsAmount}%))`,gridTemplateRows:`repeat(${rowAmount}, 1fr)`},children:props.items.map((rowItems,rowIndex)=>_jsxs(Fragment,{children:[rowItems.map((item,colIndex)=>_createElement(Typo,_object_spread_props(_object_spread({miw:colIndex===0?props.firstColumnMinWidth:undefined,type:"body",fw:colIndex===0?firstColumFontWeight:"inherit"},props.typoWrapperProps),{key:`${rowIndex}-${colIndex}`,className:classes.cell}),item)),buildFillerColumns(rowItems.length,columnsAmount)]},rowIndex))})};
|
|
2
2
|
//# sourceMappingURL=InformationList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/InformationList/InformationList.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { FC, Fragment, ReactNode } from \"react\"\nimport { TTypoProps, Typo } from \"../Typo\"\nimport classes from \"./InformationList.module.css\"\nimport { cx } from \"../../helper/cx\"\n\ntype TSharedDesignProps = {\n rowGap?: string\n columnGap?: string\n}\n\ntype TInformationListDesignProps = TSharedDesignProps & {\n firstColumnMinWidth?: string | number\n typoWrapperProps?: Partial<TTypoProps>\n classname?: string\n}\n\nexport type TInformationListItems = Array<(ReactNode | string)[]>\n\nexport type TInformationListProps = TInformationListDesignProps & {\n items: TInformationListItems\n firstColumnBold?: boolean\n}\n\nconst getLargestRow = (rows: TInformationListItems) => {\n return rows.reduce((acc, curr) => {\n if (curr.length > acc) return curr.length\n return acc\n }, 0)\n}\n\nconst buildFillerColumns = (rowItems: number, largestRowItems: number): ReactNode | null => {\n const filler: ReactNode[] = []\n if (rowItems < largestRowItems) {\n const delta = largestRowItems - rowItems\n for (let i = 0; i < delta; i++) {\n filler.push(<span key={i}></span>)\n }\n }\n return filler.length ? filler : null\n}\n\nexport const InformationList: FC<TInformationListProps> = ({\n firstColumnBold = true,\n ...props\n}) => {\n const columnsAmount = getLargestRow(props.items)\n\n const rowAmount = props.items.length\n\n const firstColumFontWeight = firstColumnBold ? 500 : \"inherit\"\n\n return (\n <div\n className={cx(classes.list, props.classname)}\n style={{\n display: \"grid\",\n columnGap: props.columnGap || \"var(--mantine-spacing-md)\",\n rowGap: props.rowGap || \"var(--mantine-spacing-xs)\",\n gridTemplateColumns: `repeat(${columnsAmount}, fit-content(${100 / columnsAmount}%))`,\n gridTemplateRows: `repeat(${rowAmount}, 1fr)`,\n }}\n >\n {props.items.map((rowItems, rowIndex) => (\n <Fragment key={rowIndex}>\n {rowItems.map((item, colIndex) => (\n <Typo\n miw={colIndex === 0 ? props.firstColumnMinWidth : undefined}\n type={\"body\"}\n fw={colIndex === 0 ? firstColumFontWeight : \"inherit\"}\n {...props.typoWrapperProps}\n key={`${rowIndex}-${colIndex}`}\n className={classes.cell}\n >\n {item}\n </Typo>\n ))}\n {buildFillerColumns(rowItems.length, columnsAmount)}\n </Fragment>\n ))}\n </div>\n )\n}\n"],"names":["Fragment","Typo","classes","cx","getLargestRow","rows","reduce","acc","curr","length","buildFillerColumns","rowItems","largestRowItems","filler","delta","i","push","span","InformationList","firstColumnBold","props","columnsAmount","items","rowAmount","firstColumFontWeight","div","className","list","classname","style","display","columnGap","rowGap","gridTemplateColumns","gridTemplateRows","map","rowIndex","item","colIndex","miw","firstColumnMinWidth","undefined","type","fw","typoWrapperProps","key","cell"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/InformationList/InformationList.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { FC, Fragment, ReactNode } from \"react\"\nimport { TTypoProps, Typo } from \"../Typo\"\nimport classes from \"./InformationList.module.css\"\nimport { cx } from \"../../helper/cx\"\n\ntype TSharedDesignProps = {\n rowGap?: string\n columnGap?: string\n}\n\ntype TInformationListDesignProps = TSharedDesignProps & {\n firstColumnMinWidth?: string | number\n typoWrapperProps?: Partial<TTypoProps>\n classname?: string\n}\n\nexport type TInformationListItems = Array<(ReactNode | string)[]>\n\nexport type TInformationListProps = TInformationListDesignProps & {\n items: TInformationListItems\n firstColumnBold?: boolean\n}\n\nconst getLargestRow = (rows: TInformationListItems) => {\n return rows.reduce((acc, curr) => {\n if (curr.length > acc) return curr.length\n return acc\n }, 0)\n}\n\nconst buildFillerColumns = (rowItems: number, largestRowItems: number): ReactNode | null => {\n const filler: ReactNode[] = []\n if (rowItems < largestRowItems) {\n const delta = largestRowItems - rowItems\n for (let i = 0; i < delta; i++) {\n filler.push(<span key={i}></span>)\n }\n }\n return filler.length ? filler : null\n}\n\n/**\n * Provides an arranged list of information giving a table like appearance\n * @param firstColumnBold Controls whether the first column should be written in bold letters\n * @param firstColumnMinWidth If defined it sets the first column's minimal width\n * @param typoWrapperProps Props to change font appearance as defined in TTypoProps\n * @param classname Class name for additional styles\n */\nexport const InformationList: FC<TInformationListProps> = ({\n firstColumnBold = true,\n ...props\n}) => {\n const columnsAmount = getLargestRow(props.items)\n\n const rowAmount = props.items.length\n\n const firstColumFontWeight = firstColumnBold ? 500 : \"inherit\"\n\n return (\n <div\n className={cx(classes.list, props.classname)}\n style={{\n display: \"grid\",\n columnGap: props.columnGap || \"var(--mantine-spacing-md)\",\n rowGap: props.rowGap || \"var(--mantine-spacing-xs)\",\n gridTemplateColumns: `repeat(${columnsAmount}, fit-content(${100 / columnsAmount}%))`,\n gridTemplateRows: `repeat(${rowAmount}, 1fr)`,\n }}\n >\n {props.items.map((rowItems, rowIndex) => (\n <Fragment key={rowIndex}>\n {rowItems.map((item, colIndex) => (\n <Typo\n miw={colIndex === 0 ? props.firstColumnMinWidth : undefined}\n type={\"body\"}\n fw={colIndex === 0 ? firstColumFontWeight : \"inherit\"}\n {...props.typoWrapperProps}\n key={`${rowIndex}-${colIndex}`}\n className={classes.cell}\n >\n {item}\n </Typo>\n ))}\n {buildFillerColumns(rowItems.length, columnsAmount)}\n </Fragment>\n ))}\n </div>\n )\n}\n"],"names":["Fragment","Typo","classes","cx","getLargestRow","rows","reduce","acc","curr","length","buildFillerColumns","rowItems","largestRowItems","filler","delta","i","push","span","InformationList","firstColumnBold","props","columnsAmount","items","rowAmount","firstColumFontWeight","div","className","list","classname","style","display","columnGap","rowGap","gridTemplateColumns","gridTemplateRows","map","rowIndex","item","colIndex","miw","firstColumnMinWidth","undefined","type","fw","typoWrapperProps","key","cell"],"mappings":"23EAIA,QAAaA,QAAQ,KAAmB,OAAO,AAC/C,QAAqBC,IAAI,KAAQ,SAAS,AAC1C,QAAOC,YAAa,8BAA8B,AAClD,QAASC,EAAE,KAAQ,iBAAiB,CAoBpC,MAAMC,cAAgB,AAACC,OACrB,OAAOA,KAAKC,MAAM,CAAC,CAACC,IAAKC,QACvB,GAAIA,KAAKC,MAAM,CAAGF,IAAK,OAAOC,KAAKC,MAAM,CACzC,OAAOF,GACT,EAAG,EACL,EAEA,MAAMG,mBAAqB,CAACC,SAAkBC,mBAC5C,MAAMC,OAAsB,EAAE,CAC9B,GAAIF,SAAWC,gBAAiB,CAC9B,MAAME,MAAQF,gBAAkBD,SAChC,IAAK,IAAII,EAAI,EAAGA,EAAID,MAAOC,IAAK,CAC9BF,OAAOG,IAAI,CAAC,KAACC,UAAUF,GACzB,CACF,CACA,OAAOF,OAAOJ,MAAM,CAAGI,OAAS,IAClC,CASA,QAAO,MAAMK,gBAA6C,QAAC,CACzDC,gBAAkB,IAAI,CAEvB,IADIC,yDAEH,MAAMC,cAAgBjB,cAAcgB,MAAME,KAAK,EAE/C,MAAMC,UAAYH,MAAME,KAAK,CAACb,MAAM,CAEpC,MAAMe,qBAAuBL,gBAAkB,IAAM,UAErD,OACE,KAACM,OACCC,UAAWvB,GAAGD,QAAQyB,IAAI,CAAEP,MAAMQ,SAAS,EAC3CC,MAAO,CACLC,QAAS,OACTC,UAAWX,MAAMW,SAAS,EAAI,4BAC9BC,OAAQZ,MAAMY,MAAM,EAAI,4BACxBC,oBAAqB,CAAC,OAAO,EAAEZ,cAAc,cAAc,EAAE,IAAMA,cAAc,GAAG,CAAC,CACrFa,iBAAkB,CAAC,OAAO,EAAEX,UAAU,MAAM,CAAC,AAC/C,WAECH,MAAME,KAAK,CAACa,GAAG,CAAC,CAACxB,SAAUyB,WAC1B,MAACpC,oBACEW,SAASwB,GAAG,CAAC,CAACE,KAAMC,WACnB,eAACrC,0CACCsC,IAAKD,WAAa,EAAIlB,MAAMoB,mBAAmB,CAAGC,UAClDC,KAAM,OACNC,GAAIL,WAAa,EAAId,qBAAuB,WACxCJ,MAAMwB,gBAAgB,GAC1BC,IAAK,CAAC,EAAET,SAAS,CAAC,EAAEE,SAAS,CAAC,CAC9BZ,UAAWxB,QAAQ4C,IAAI,GAEtBT,OAGJ3B,mBAAmBC,SAASF,MAAM,CAAEY,iBAbxBe,YAkBvB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{LanguageSwitch}from"./languageSwitch/LanguageSwitch";import{ThemeSwitch,UserNav}from"./index";import{GreenboneLogo}from"../../../icons";import{Divider}from"@mantine/core";import{useTranslation}from"react-i18next";import{Power}from"lucide-react";import{TimeZone}from"./TimeZone";import{Z_INDEX_LAYER}from"../../../theme";import classes from"./AppHeader.module.css";import{Manual}from"./manual/Manual";export const AppHeader=({username,menuPoints,logoLink,isLoggedIn,languageSwitch,sessionTimer,logo,isThemeSwitchVisible=true,ianaTimeZone,manualLink,userNavWidth})=>{return _jsxs("header",{className:classes.header,style:{zIndex:Z_INDEX_LAYER.GROUND.HIGHEST},children:[_jsx("a",{className:classes["logo-link"],href:logoLink,children:logo||_jsx(GreenboneLogo,{})}),_jsxs("div",{className:classes["right-side"],children:[_jsx(TimeZone,{ianaTimeZone:ianaTimeZone}),_jsx(Divider,{orientation:"vertical",className:classes.divider}),languageSwitch||_jsx(LanguageSwitch,{}),isThemeSwitchVisible&&_jsxs(_Fragment,{children:[_jsx(Divider,{orientation:"vertical",className:classes.divider}),_jsx(ThemeSwitch,{})]}),manualLink&&_jsx(Manual,{manualLink:manualLink}),isLoggedIn&&_jsxs(_Fragment,{children:[sessionTimer&&_jsxs(_Fragment,{children:[_jsx(Divider,{orientation:"vertical",className:classes.divider}),sessionTimer]}),_jsx(Divider,{orientation:"vertical",className:classes.divider}),_jsx(UserNav,{menuPoints:menuPoints,username:username,userNavWidth:userNavWidth})]})]})]})};export const useHeaderMenuPoints=logoutCallback=>{const{t}=useTranslation();return[{linkText:t("Sign out"),id:"logout",icon:_jsx(Power,{size:14,strokeWidth:1.5}),to:()=>logoutCallback?logoutCallback():null}]};
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{LanguageSwitch}from"./languageSwitch/LanguageSwitch";import{ThemeSwitch,UserNav}from"./index";import{GreenboneLogo}from"../../../icons";import{Divider}from"@mantine/core";import{useTranslation}from"react-i18next";import{Power}from"lucide-react";import{TimeZone}from"./TimeZone";import{Z_INDEX_LAYER}from"../../../theme";import classes from"./AppHeader.module.css";import{Manual}from"./manual/Manual";export const AppHeader=({username,menuPoints,logoLink,isLoggedIn,languageSwitch,sessionTimer,logo,isThemeSwitchVisible=true,ianaTimeZone,manualLink,userNavWidth})=>{return _jsxs("header",{className:classes.header,style:{zIndex:Z_INDEX_LAYER.GROUND.HIGHEST},children:[_jsx("a",{"data-testid":"header-logo-link",className:classes["logo-link"],href:logoLink,children:logo||_jsx(GreenboneLogo,{})}),_jsxs("div",{className:classes["right-side"],children:[_jsx(TimeZone,{ianaTimeZone:ianaTimeZone}),_jsx(Divider,{orientation:"vertical",className:classes.divider}),languageSwitch||_jsx(LanguageSwitch,{}),isThemeSwitchVisible&&_jsxs(_Fragment,{children:[_jsx(Divider,{orientation:"vertical",className:classes.divider}),_jsx(ThemeSwitch,{})]}),manualLink&&_jsx(Manual,{manualLink:manualLink}),isLoggedIn&&_jsxs(_Fragment,{children:[sessionTimer&&_jsxs(_Fragment,{children:[_jsx(Divider,{orientation:"vertical",className:classes.divider}),sessionTimer]}),_jsx(Divider,{orientation:"vertical",className:classes.divider}),_jsx(UserNav,{menuPoints:menuPoints,username:username,userNavWidth:userNavWidth})]})]})]})};export const useHeaderMenuPoints=logoutCallback=>{const{t}=useTranslation();return[{linkText:t("Sign out"),id:"logout",icon:_jsx(Power,{size:14,strokeWidth:1.5}),to:()=>logoutCallback?logoutCallback():null}]};
|
|
2
2
|
//# sourceMappingURL=AppHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Layout/AppHeader/AppHeader.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { LanguageSwitch } from \"./languageSwitch/LanguageSwitch\"\nimport { ThemeSwitch, UserNav } from \"./index\"\nimport { TAppHeaderProps } from \"./types\"\nimport { GreenboneLogo } from \"../../../icons\"\nimport { Divider } from \"@mantine/core\"\nimport { useTranslation } from \"react-i18next\"\nimport { Power } from \"lucide-react\"\nimport { TimeZone } from \"./TimeZone\"\nimport { Z_INDEX_LAYER } from \"../../../theme\"\nimport classes from \"./AppHeader.module.css\"\nimport { Manual } from \"./manual/Manual\"\n\nexport const AppHeader = ({\n username,\n menuPoints,\n logoLink,\n isLoggedIn,\n languageSwitch,\n sessionTimer,\n logo,\n isThemeSwitchVisible = true,\n ianaTimeZone,\n manualLink,\n userNavWidth,\n}: TAppHeaderProps) => {\n return (\n <header\n className={classes.header}\n style={{\n zIndex: Z_INDEX_LAYER.GROUND.HIGHEST,\n }}\n >\n <a className={classes[\"logo-link\"]} href={logoLink}>\n {logo || <GreenboneLogo />}\n </a>\n <div className={classes[\"right-side\"]}>\n <TimeZone ianaTimeZone={ianaTimeZone} />\n <Divider orientation=\"vertical\" className={classes.divider} />\n {languageSwitch || <LanguageSwitch />}\n {isThemeSwitchVisible && (\n <>\n <Divider orientation=\"vertical\" className={classes.divider} />\n <ThemeSwitch />\n </>\n )}\n {manualLink && <Manual manualLink={manualLink} />}\n {isLoggedIn && (\n <>\n {sessionTimer && (\n <>\n <Divider orientation=\"vertical\" className={classes.divider} />\n {sessionTimer}\n </>\n )}\n <Divider orientation=\"vertical\" className={classes.divider} />\n <UserNav menuPoints={menuPoints} username={username} userNavWidth={userNavWidth} />\n </>\n )}\n </div>\n </header>\n )\n}\n\nexport const useHeaderMenuPoints = (logoutCallback?: () => void) => {\n const { t } = useTranslation()\n\n return [\n {\n linkText: t(\"Sign out\"),\n id: \"logout\",\n icon: <Power size={14} strokeWidth={1.5} />,\n to: () => (logoutCallback ? logoutCallback() : null),\n },\n ]\n}\n"],"names":["LanguageSwitch","ThemeSwitch","UserNav","GreenboneLogo","Divider","useTranslation","Power","TimeZone","Z_INDEX_LAYER","classes","Manual","AppHeader","username","menuPoints","logoLink","isLoggedIn","languageSwitch","sessionTimer","logo","isThemeSwitchVisible","ianaTimeZone","manualLink","userNavWidth","header","className","style","zIndex","GROUND","HIGHEST","a","href","div","orientation","divider","useHeaderMenuPoints","logoutCallback","t","linkText","id","icon","size","strokeWidth","to"],"mappings":"8EAIA,QAASA,cAAc,KAAQ,iCAAiC,AAChE,QAASC,WAAW,CAAEC,OAAO,KAAQ,SAAS,AAE9C,QAASC,aAAa,KAAQ,gBAAgB,AAC9C,QAASC,OAAO,KAAQ,eAAe,AACvC,QAASC,cAAc,KAAQ,eAAe,AAC9C,QAASC,KAAK,KAAQ,cAAc,AACpC,QAASC,QAAQ,KAAQ,YAAY,AACrC,QAASC,aAAa,KAAQ,gBAAgB,AAC9C,QAAOC,YAAa,wBAAwB,AAC5C,QAASC,MAAM,KAAQ,iBAAiB,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Layout/AppHeader/AppHeader.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { LanguageSwitch } from \"./languageSwitch/LanguageSwitch\"\nimport { ThemeSwitch, UserNav } from \"./index\"\nimport { TAppHeaderProps } from \"./types\"\nimport { GreenboneLogo } from \"../../../icons\"\nimport { Divider } from \"@mantine/core\"\nimport { useTranslation } from \"react-i18next\"\nimport { Power } from \"lucide-react\"\nimport { TimeZone } from \"./TimeZone\"\nimport { Z_INDEX_LAYER } from \"../../../theme\"\nimport classes from \"./AppHeader.module.css\"\nimport { Manual } from \"./manual/Manual\"\n\n/**\n * Provides the AppHeader component including all necessary elements\n * Usually used for infoIs.\n * @param username Name of the current user\n * @param menuPoints Array of menu items that open when the username is hovered\n * @param isLoggedIn Boolean if a user is currently logged in\n * @param languageSwitch JSX element used to toggle languages\n * @param sessionTimer ReactNode showing the remaining session time\n * @param logo ReactNode with the logo to be displayed in the top left\n * @param isThemeSwitchVisible Controls whether the theme switch (light/dark) is visible\n * @param ianaTimeZone String with timezone information\n * @param manualLink URL to the user manual, normally dependent on the current language\n * @param userNavWidth Width of the navigation in pixel\n */\nexport const AppHeader = ({\n username,\n menuPoints,\n logoLink,\n isLoggedIn,\n languageSwitch,\n sessionTimer,\n logo,\n isThemeSwitchVisible = true,\n ianaTimeZone,\n manualLink,\n userNavWidth,\n}: TAppHeaderProps) => {\n return (\n <header\n className={classes.header}\n style={{\n zIndex: Z_INDEX_LAYER.GROUND.HIGHEST,\n }}\n >\n <a data-testid=\"header-logo-link\" className={classes[\"logo-link\"]} href={logoLink}>\n {logo || <GreenboneLogo />}\n </a>\n <div className={classes[\"right-side\"]}>\n <TimeZone ianaTimeZone={ianaTimeZone} />\n <Divider orientation=\"vertical\" className={classes.divider} />\n {languageSwitch || <LanguageSwitch />}\n {isThemeSwitchVisible && (\n <>\n <Divider orientation=\"vertical\" className={classes.divider} />\n <ThemeSwitch />\n </>\n )}\n {manualLink && <Manual manualLink={manualLink} />}\n {isLoggedIn && (\n <>\n {sessionTimer && (\n <>\n <Divider orientation=\"vertical\" className={classes.divider} />\n {sessionTimer}\n </>\n )}\n <Divider orientation=\"vertical\" className={classes.divider} />\n <UserNav menuPoints={menuPoints} username={username} userNavWidth={userNavWidth} />\n </>\n )}\n </div>\n </header>\n )\n}\n\nexport const useHeaderMenuPoints = (logoutCallback?: () => void) => {\n const { t } = useTranslation()\n\n return [\n {\n linkText: t(\"Sign out\"),\n id: \"logout\",\n icon: <Power size={14} strokeWidth={1.5} />,\n to: () => (logoutCallback ? logoutCallback() : null),\n },\n ]\n}\n"],"names":["LanguageSwitch","ThemeSwitch","UserNav","GreenboneLogo","Divider","useTranslation","Power","TimeZone","Z_INDEX_LAYER","classes","Manual","AppHeader","username","menuPoints","logoLink","isLoggedIn","languageSwitch","sessionTimer","logo","isThemeSwitchVisible","ianaTimeZone","manualLink","userNavWidth","header","className","style","zIndex","GROUND","HIGHEST","a","data-testid","href","div","orientation","divider","useHeaderMenuPoints","logoutCallback","t","linkText","id","icon","size","strokeWidth","to"],"mappings":"8EAIA,QAASA,cAAc,KAAQ,iCAAiC,AAChE,QAASC,WAAW,CAAEC,OAAO,KAAQ,SAAS,AAE9C,QAASC,aAAa,KAAQ,gBAAgB,AAC9C,QAASC,OAAO,KAAQ,eAAe,AACvC,QAASC,cAAc,KAAQ,eAAe,AAC9C,QAASC,KAAK,KAAQ,cAAc,AACpC,QAASC,QAAQ,KAAQ,YAAY,AACrC,QAASC,aAAa,KAAQ,gBAAgB,AAC9C,QAAOC,YAAa,wBAAwB,AAC5C,QAASC,MAAM,KAAQ,iBAAiB,AAgBxC,QAAO,MAAMC,UAAY,CAAC,CACxBC,QAAQ,CACRC,UAAU,CACVC,QAAQ,CACRC,UAAU,CACVC,cAAc,CACdC,YAAY,CACZC,IAAI,CACJC,qBAAuB,IAAI,CAC3BC,YAAY,CACZC,UAAU,CACVC,YAAY,CACI,IAChB,OACE,MAACC,UACCC,UAAWf,QAAQc,MAAM,CACzBE,MAAO,CACLC,OAAQlB,cAAcmB,MAAM,CAACC,OAAO,AACtC,YAEA,KAACC,KAAEC,cAAY,mBAAmBN,UAAWf,OAAO,CAAC,YAAY,CAAEsB,KAAMjB,kBACtEI,MAAQ,KAACf,oBAEZ,MAAC6B,OAAIR,UAAWf,OAAO,CAAC,aAAa,WACnC,KAACF,UAASa,aAAcA,eACxB,KAAChB,SAAQ6B,YAAY,WAAWT,UAAWf,QAAQyB,OAAO,GACzDlB,gBAAkB,KAAChB,mBACnBmB,sBACC,2BACE,KAACf,SAAQ6B,YAAY,WAAWT,UAAWf,QAAQyB,OAAO,GAC1D,KAACjC,mBAGJoB,YAAc,KAACX,QAAOW,WAAYA,aAClCN,YACC,2BACGE,cACC,2BACE,KAACb,SAAQ6B,YAAY,WAAWT,UAAWf,QAAQyB,OAAO,GACzDjB,gBAGL,KAACb,SAAQ6B,YAAY,WAAWT,UAAWf,QAAQyB,OAAO,GAC1D,KAAChC,SAAQW,WAAYA,WAAYD,SAAUA,SAAUU,aAAcA,uBAM/E,CAAC,AAED,QAAO,MAAMa,oBAAsB,AAACC,iBAClC,KAAM,CAAEC,CAAC,CAAE,CAAGhC,iBAEd,MAAO,CACL,CACEiC,SAAUD,EAAE,YACZE,GAAI,SACJC,KAAM,KAAClC,OAAMmC,KAAM,GAAIC,YAAa,MACpCC,GAAI,IAAOP,eAAiBA,iBAAmB,IACjD,EACD,AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Layout/AppHeader/TimeZone.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { getTimeZoneInformation } from \"../../TimeZoneInfo\"\nimport { Tooltip } from \"../../Tooltip\"\nimport { Typo } from \"../../Typo\"\nimport { MapPin } from \"lucide-react\"\nimport classes from \"./TimeZone.module.css\"\nimport { ICON_SIZES } from \"../../../theme/conventions\"\n\nexport const TimeZone = ({ ianaTimeZone }: { ianaTimeZone?: string }) => {\n const timeZone = getTimeZoneInformation(ianaTimeZone)\n return (\n <Tooltip label={`GMT ${timeZone.offsetString}`}>\n <span className={classes[\"timezone-container\"]}>\n <Typo display={\"inline\"} type={\"body\"} className={classes.timezone}>\n {timeZone.label}\n </Typo>\n <MapPin size={ICON_SIZES.MEDIUM} color={\"var(--mantine-color-white)\"} strokeWidth={1.5} />\n </span>\n </Tooltip>\n )\n}\n"],"names":["getTimeZoneInformation","Tooltip","Typo","MapPin","classes","ICON_SIZES","TimeZone","ianaTimeZone","timeZone","label","offsetString","span","className","display","type","timezone","size","MEDIUM","color","strokeWidth"],"mappings":"wDAIA,QAASA,sBAAsB,KAAQ,oBAAoB,AAC3D,QAASC,OAAO,KAAQ,eAAe,AACvC,QAASC,IAAI,KAAQ,YAAY,AACjC,QAASC,MAAM,KAAQ,cAAc,AACrC,QAAOC,YAAa,uBAAuB,AAC3C,QAASC,UAAU,KAAQ,4BAA4B,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Layout/AppHeader/TimeZone.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { getTimeZoneInformation } from \"../../TimeZoneInfo\"\nimport { Tooltip } from \"../../Tooltip\"\nimport { Typo } from \"../../Typo\"\nimport { MapPin } from \"lucide-react\"\nimport classes from \"./TimeZone.module.css\"\nimport { ICON_SIZES } from \"../../../theme/conventions\"\n\n/**\n * Provides formatted timezone information with icon and tooltip as used in the AppHeader\n * @param ianaTimeZone String with timezone information\n */\nexport const TimeZone = ({ ianaTimeZone }: { ianaTimeZone?: string }) => {\n const timeZone = getTimeZoneInformation(ianaTimeZone)\n return (\n <Tooltip label={`GMT ${timeZone.offsetString}`}>\n <span className={classes[\"timezone-container\"]}>\n <Typo display={\"inline\"} type={\"body\"} className={classes.timezone}>\n {timeZone.label}\n </Typo>\n <MapPin size={ICON_SIZES.MEDIUM} color={\"var(--mantine-color-white)\"} strokeWidth={1.5} />\n </span>\n </Tooltip>\n )\n}\n"],"names":["getTimeZoneInformation","Tooltip","Typo","MapPin","classes","ICON_SIZES","TimeZone","ianaTimeZone","timeZone","label","offsetString","span","className","display","type","timezone","size","MEDIUM","color","strokeWidth"],"mappings":"wDAIA,QAASA,sBAAsB,KAAQ,oBAAoB,AAC3D,QAASC,OAAO,KAAQ,eAAe,AACvC,QAASC,IAAI,KAAQ,YAAY,AACjC,QAASC,MAAM,KAAQ,cAAc,AACrC,QAAOC,YAAa,uBAAuB,AAC3C,QAASC,UAAU,KAAQ,4BAA4B,AAMvD,QAAO,MAAMC,SAAW,CAAC,CAAEC,YAAY,CAA6B,IAClE,MAAMC,SAAWR,uBAAuBO,cACxC,OACE,KAACN,SAAQQ,MAAO,CAAC,IAAI,EAAED,SAASE,YAAY,CAAC,CAAC,UAC5C,MAACC,QAAKC,UAAWR,OAAO,CAAC,qBAAqB,WAC5C,KAACF,MAAKW,QAAS,SAAUC,KAAM,OAAQF,UAAWR,QAAQW,QAAQ,UAC/DP,SAASC,KAAK,GAEjB,KAACN,QAAOa,KAAMX,WAAWY,MAAM,CAAEC,MAAO,6BAA8BC,YAAa,UAI3F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/Layout/AppHeader/languageSwitch/LanguageSwitch.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ActionIcon } from \"@mantine/core\"\nimport { FlagDeIcon, FlagEnIcon } from \"../../../../icons\"\nimport { useLanguageContext } from \"../../../../contextProviders\"\nimport { useTranslation } from \"react-i18next\"\n\nexport const LanguageSwitch = () => {\n const { language, changeLanguageFu } = useLanguageContext()\n const { t } = useTranslation()\n return (\n <ActionIcon\n variant=\"transparent\"\n onClick={changeLanguageFu}\n title={t(\"Switch language\")}\n color=\"neutral.0\"\n >\n {language === \"en\" ? <FlagEnIcon /> : <FlagDeIcon />}\n </ActionIcon>\n )\n}\n"],"names":["ActionIcon","FlagDeIcon","FlagEnIcon","useLanguageContext","useTranslation","LanguageSwitch","language","changeLanguageFu","t","variant","onClick","title","color"],"mappings":"0CAIA,QAASA,UAAU,KAAQ,eAAe,AAC1C,QAASC,UAAU,CAAEC,UAAU,KAAQ,mBAAmB,AAC1D,QAASC,kBAAkB,KAAQ,8BAA8B,AACjE,QAASC,cAAc,KAAQ,eAAe,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Layout/AppHeader/languageSwitch/LanguageSwitch.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ActionIcon } from \"@mantine/core\"\nimport { FlagDeIcon, FlagEnIcon } from \"../../../../icons\"\nimport { useLanguageContext } from \"../../../../contextProviders\"\nimport { useTranslation } from \"react-i18next\"\n\n/**\n * Provides the language switch for the AppHeader\n */\nexport const LanguageSwitch = () => {\n const { language, changeLanguageFu } = useLanguageContext()\n const { t } = useTranslation()\n return (\n <ActionIcon\n variant=\"transparent\"\n onClick={changeLanguageFu}\n title={t(\"Switch language\")}\n color=\"neutral.0\"\n >\n {language === \"en\" ? <FlagEnIcon /> : <FlagDeIcon />}\n </ActionIcon>\n )\n}\n"],"names":["ActionIcon","FlagDeIcon","FlagEnIcon","useLanguageContext","useTranslation","LanguageSwitch","language","changeLanguageFu","t","variant","onClick","title","color"],"mappings":"0CAIA,QAASA,UAAU,KAAQ,eAAe,AAC1C,QAASC,UAAU,CAAEC,UAAU,KAAQ,mBAAmB,AAC1D,QAASC,kBAAkB,KAAQ,8BAA8B,AACjE,QAASC,cAAc,KAAQ,eAAe,AAK9C,QAAO,MAAMC,eAAiB,KAC5B,KAAM,CAAEC,QAAQ,CAAEC,gBAAgB,CAAE,CAAGJ,qBACvC,KAAM,CAAEK,CAAC,CAAE,CAAGJ,iBACd,OACE,KAACJ,YACCS,QAAQ,cACRC,QAASH,iBACTI,MAAOH,EAAE,mBACTI,MAAM,qBAELN,WAAa,KAAO,KAACJ,eAAgB,KAACD,gBAG7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/Layout/AppHeader/manual/Manual.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ActionIcon, Divider } from \"@mantine/core\"\nimport { useTranslation } from \"react-i18next\"\nimport { Tooltip } from \"../../../Tooltip\"\nimport { BookMarked } from \"lucide-react\"\nimport classes from \"../AppHeader.module.css\"\n\ntype TManualProps = { manualLink: string }\n\nexport const Manual = ({ manualLink }: TManualProps) => {\n const { t } = useTranslation()\n return (\n <>\n <Divider orientation=\"vertical\" className={classes.divider} />\n <Tooltip label={t(\"Open manual\")}>\n <ActionIcon\n variant=\"transparent\"\n onClick={() => window.open(manualLink, \"_blank\", \"noreferrer\")}\n color=\"neutral.0\"\n data-testid=\"manual-link\"\n >\n <BookMarked size={14} strokeWidth={1.5} />\n </ActionIcon>\n </Tooltip>\n </>\n )\n}\n"],"names":["ActionIcon","Divider","useTranslation","Tooltip","BookMarked","classes","Manual","manualLink","t","orientation","className","divider","label","variant","onClick","window","open","color","data-testid","size","strokeWidth"],"mappings":"8EAIA,QAASA,UAAU,CAAEC,OAAO,KAAQ,eAAe,AACnD,QAASC,cAAc,KAAQ,eAAe,AAC9C,QAASC,OAAO,KAAQ,kBAAkB,AAC1C,QAASC,UAAU,KAAQ,cAAc,AACzC,QAAOC,YAAa,yBAAyB,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Layout/AppHeader/manual/Manual.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ActionIcon, Divider } from \"@mantine/core\"\nimport { useTranslation } from \"react-i18next\"\nimport { Tooltip } from \"../../../Tooltip\"\nimport { BookMarked } from \"lucide-react\"\nimport classes from \"../AppHeader.module.css\"\n\ntype TManualProps = { manualLink: string }\n\n/**\n * Provides an icon with the link to the user manual and a tooltip\n * @param manualLink URL to the user manual, normally dependent on the current language\n */\nexport const Manual = ({ manualLink }: TManualProps) => {\n const { t } = useTranslation()\n return (\n <>\n <Divider orientation=\"vertical\" className={classes.divider} />\n <Tooltip label={t(\"Open manual\")}>\n <ActionIcon\n variant=\"transparent\"\n onClick={() => window.open(manualLink, \"_blank\", \"noreferrer\")}\n color=\"neutral.0\"\n data-testid=\"manual-link\"\n >\n <BookMarked size={14} strokeWidth={1.5} />\n </ActionIcon>\n </Tooltip>\n </>\n )\n}\n"],"names":["ActionIcon","Divider","useTranslation","Tooltip","BookMarked","classes","Manual","manualLink","t","orientation","className","divider","label","variant","onClick","window","open","color","data-testid","size","strokeWidth"],"mappings":"8EAIA,QAASA,UAAU,CAAEC,OAAO,KAAQ,eAAe,AACnD,QAASC,cAAc,KAAQ,eAAe,AAC9C,QAASC,OAAO,KAAQ,kBAAkB,AAC1C,QAASC,UAAU,KAAQ,cAAc,AACzC,QAAOC,YAAa,yBAAyB,AAQ7C,QAAO,MAAMC,OAAS,CAAC,CAAEC,UAAU,CAAgB,IACjD,KAAM,CAAEC,CAAC,CAAE,CAAGN,iBACd,OACE,2BACE,KAACD,SAAQQ,YAAY,WAAWC,UAAWL,QAAQM,OAAO,GAC1D,KAACR,SAAQS,MAAOJ,EAAE,wBAChB,KAACR,YACCa,QAAQ,cACRC,QAAS,IAAMC,OAAOC,IAAI,CAACT,WAAY,SAAU,cACjDU,MAAM,YACNC,cAAY,uBAEZ,KAACd,YAAWe,KAAM,GAAIC,YAAa,YAK7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/Layout/AppHeader/themeSwitch/ThemeSwitch.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ActionIcon, useMantineColorScheme, useMantineTheme } from \"@mantine/core\"\nimport { Moon, Sun } from \"lucide-react\"\nimport { useTranslation } from \"react-i18next\"\n\nexport const ThemeSwitch = () => {\n const { colorScheme, toggleColorScheme } = useMantineColorScheme()\n const theme = useMantineTheme()\n const dark = colorScheme === \"dark\"\n const { t } = useTranslation()\n\n return (\n <ActionIcon\n variant=\"transparent\"\n onClick={() => toggleColorScheme()}\n title={t(\"Switch color theme\")}\n color=\"neutral.0\"\n >\n {dark ? (\n <Moon size={theme.other.iconSizes.MEDIUM} strokeWidth={1.5} />\n ) : (\n <Sun size={theme.other.iconSizes.MEDIUM} strokeWidth={1.5} />\n )}\n </ActionIcon>\n )\n}\n"],"names":["ActionIcon","useMantineColorScheme","useMantineTheme","Moon","Sun","useTranslation","ThemeSwitch","colorScheme","toggleColorScheme","theme","dark","t","variant","onClick","title","color","size","other","iconSizes","MEDIUM","strokeWidth"],"mappings":"0CAIA,QAASA,UAAU,CAAEC,qBAAqB,CAAEC,eAAe,KAAQ,eAAe,AAClF,QAASC,IAAI,CAAEC,GAAG,KAAQ,cAAc,AACxC,QAASC,cAAc,KAAQ,eAAe,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Layout/AppHeader/themeSwitch/ThemeSwitch.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ActionIcon, useMantineColorScheme, useMantineTheme } from \"@mantine/core\"\nimport { Moon, Sun } from \"lucide-react\"\nimport { useTranslation } from \"react-i18next\"\n\n/**\n * Provides an icon for switching themes\n */\nexport const ThemeSwitch = () => {\n const { colorScheme, toggleColorScheme } = useMantineColorScheme()\n const theme = useMantineTheme()\n const dark = colorScheme === \"dark\"\n const { t } = useTranslation()\n\n return (\n <ActionIcon\n variant=\"transparent\"\n onClick={() => toggleColorScheme()}\n title={t(\"Switch color theme\")}\n color=\"neutral.0\"\n >\n {dark ? (\n <Moon size={theme.other.iconSizes.MEDIUM} strokeWidth={1.5} />\n ) : (\n <Sun size={theme.other.iconSizes.MEDIUM} strokeWidth={1.5} />\n )}\n </ActionIcon>\n )\n}\n"],"names":["ActionIcon","useMantineColorScheme","useMantineTheme","Moon","Sun","useTranslation","ThemeSwitch","colorScheme","toggleColorScheme","theme","dark","t","variant","onClick","title","color","size","other","iconSizes","MEDIUM","strokeWidth"],"mappings":"0CAIA,QAASA,UAAU,CAAEC,qBAAqB,CAAEC,eAAe,KAAQ,eAAe,AAClF,QAASC,IAAI,CAAEC,GAAG,KAAQ,cAAc,AACxC,QAASC,cAAc,KAAQ,eAAe,AAK9C,QAAO,MAAMC,YAAc,KACzB,KAAM,CAAEC,WAAW,CAAEC,iBAAiB,CAAE,CAAGP,wBAC3C,MAAMQ,MAAQP,kBACd,MAAMQ,KAAOH,cAAgB,OAC7B,KAAM,CAAEI,CAAC,CAAE,CAAGN,iBAEd,OACE,KAACL,YACCY,QAAQ,cACRC,QAAS,IAAML,oBACfM,MAAOH,EAAE,sBACTI,MAAM,qBAELL,KACC,KAACP,MAAKa,KAAMP,MAAMQ,KAAK,CAACC,SAAS,CAACC,MAAM,CAAEC,YAAa,MAEvD,KAAChB,KAAIY,KAAMP,MAAMQ,KAAK,CAACC,SAAS,CAACC,MAAM,CAAEC,YAAa,OAI9D,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import classes from"./NavItem.module.css";export const NavItem=_0=>{let{}=_0,menuPoint=_extends({},_0);return _jsxs("div",{className:classes["menu-item-wrapper"],children:[_jsx("div",{className:classes["menu-icon"],children:menuPoint.icon}),_jsx("div",{className:classes["menu-item-text"],children:menuPoint.linkText})]})};
|
|
2
2
|
//# sourceMappingURL=NavItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/Layout/AppHeader/userNav/NavItem.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { TMenuPoint } from \"../types\"\nimport classes from \"./NavItem.module.css\"\n\nexport const NavItem = ({ ...menuPoint }: Omit<TMenuPoint, \"to\">) => {\n return (\n <div className={classes[\"menu-item-wrapper\"]}>\n <div className={classes[\"menu-icon\"]}>{menuPoint.icon}</div>\n <div className={classes[\"menu-item-text\"]}>{menuPoint.linkText}</div>\n </div>\n )\n}\n"],"names":["classes","NavItem","menuPoint","div","className","icon","linkText"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Layout/AppHeader/userNav/NavItem.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { TMenuPoint } from \"../types\"\nimport classes from \"./NavItem.module.css\"\n\n/**\n * Provides a navigation item for the menu opening when hovering the username\n * @param linkText Item text\n * @param icon JSX element used as icon in the menu item\n * @param to String or function defining the link's destination\n */\nexport const NavItem = ({ ...menuPoint }: Omit<TMenuPoint, \"to\">) => {\n return (\n <div className={classes[\"menu-item-wrapper\"]}>\n <div className={classes[\"menu-icon\"]}>{menuPoint.icon}</div>\n <div className={classes[\"menu-item-text\"]}>{menuPoint.linkText}</div>\n </div>\n )\n}\n"],"names":["classes","NavItem","menuPoint","div","className","icon","linkText"],"mappings":"4UAKA,QAAOA,YAAa,sBAAsB,AAQ1C,QAAO,MAAMC,QAAU,QAAC,EAAwC,IAAnCC,0BAC3B,OACE,MAACC,OAAIC,UAAWJ,OAAO,CAAC,oBAAoB,WAC1C,KAACG,OAAIC,UAAWJ,OAAO,CAAC,YAAY,UAAGE,UAAUG,IAAI,GACrD,KAACF,OAAIC,UAAWJ,OAAO,CAAC,iBAAiB,UAAGE,UAAUI,QAAQ,KAGpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/Layout/AppHeader/userNav/UserNav.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { Menu } from \"@mantine/core\"\nimport { TUserNavProps } from \"../types\"\nimport { NavItem } from \"./NavItem\"\nimport { UserCircle2 } from \"lucide-react\"\nimport classes from \"./UserNav.module.css\"\nimport { ICON_SIZES } from \"../../../../theme\"\n\nexport const UserNav = ({ username, menuPoints, userNavWidth = 140 }: TUserNavProps) => {\n return (\n <Menu shadow=\"md\" trigger=\"hover\" width={userNavWidth} closeDelay={100} offset={11}>\n <Menu.Target>\n <div className={classes[\"user-nav-wrapper\"]}>\n <div className={classes[\"user-name\"]}>{username}</div>\n <div className={classes[\"user-icon-wrapper\"]}>\n <UserCircle2 size={ICON_SIZES.MEDIUM} strokeWidth={1.5} />\n </div>\n </div>\n </Menu.Target>\n\n <Menu.Dropdown>\n {menuPoints.map((menuPoint) => {\n if (typeof menuPoint.to === \"string\") {\n return (\n <Menu.Item component={\"a\"} href={menuPoint.to} key={menuPoint.linkText}>\n <NavItem linkText={menuPoint.linkText} icon={menuPoint.icon} />\n </Menu.Item>\n )\n }\n if (typeof menuPoint.to === \"function\") {\n return (\n <div key={menuPoint.linkText} onClick={menuPoint.to}>\n <Menu.Item>\n <NavItem linkText={menuPoint.linkText} icon={menuPoint.icon} />\n </Menu.Item>\n </div>\n )\n }\n })}\n </Menu.Dropdown>\n </Menu>\n )\n}\n"],"names":["Menu","NavItem","UserCircle2","classes","ICON_SIZES","UserNav","username","menuPoints","userNavWidth","shadow","trigger","width","closeDelay","offset","Target","div","className","size","MEDIUM","strokeWidth","Dropdown","map","menuPoint","to","Item","component","href","linkText","icon","onClick"],"mappings":"wDAIA,QAASA,IAAI,KAAQ,eAAe,AAEpC,QAASC,OAAO,KAAQ,WAAW,AACnC,QAASC,WAAW,KAAQ,cAAc,AAC1C,QAAOC,YAAa,sBAAsB,AAC1C,QAASC,UAAU,KAAQ,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Layout/AppHeader/userNav/UserNav.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { Menu } from \"@mantine/core\"\nimport { TUserNavProps } from \"../types\"\nimport { NavItem } from \"./NavItem\"\nimport { UserCircle2 } from \"lucide-react\"\nimport classes from \"./UserNav.module.css\"\nimport { ICON_SIZES } from \"../../../../theme\"\n\n/**\n * Provides the user navigation that is openend when hovering the user name\n * @param username Name of the current user\n * @param menuPoints Array of menu items that open when the username is hovered\n * @param userNavWidth Width of the navigation in pixel\n */\nexport const UserNav = ({ username, menuPoints, userNavWidth = 140 }: TUserNavProps) => {\n return (\n <Menu shadow=\"md\" trigger=\"hover\" width={userNavWidth} closeDelay={100} offset={11}>\n <Menu.Target>\n <div className={classes[\"user-nav-wrapper\"]}>\n <div className={classes[\"user-name\"]}>{username}</div>\n <div className={classes[\"user-icon-wrapper\"]}>\n <UserCircle2 size={ICON_SIZES.MEDIUM} strokeWidth={1.5} />\n </div>\n </div>\n </Menu.Target>\n\n <Menu.Dropdown>\n {menuPoints.map((menuPoint) => {\n if (typeof menuPoint.to === \"string\") {\n return (\n <Menu.Item component={\"a\"} href={menuPoint.to} key={menuPoint.linkText}>\n <NavItem linkText={menuPoint.linkText} icon={menuPoint.icon} />\n </Menu.Item>\n )\n }\n if (typeof menuPoint.to === \"function\") {\n return (\n <div key={menuPoint.linkText} onClick={menuPoint.to}>\n <Menu.Item>\n <NavItem linkText={menuPoint.linkText} icon={menuPoint.icon} />\n </Menu.Item>\n </div>\n )\n }\n })}\n </Menu.Dropdown>\n </Menu>\n )\n}\n"],"names":["Menu","NavItem","UserCircle2","classes","ICON_SIZES","UserNav","username","menuPoints","userNavWidth","shadow","trigger","width","closeDelay","offset","Target","div","className","size","MEDIUM","strokeWidth","Dropdown","map","menuPoint","to","Item","component","href","linkText","icon","onClick"],"mappings":"wDAIA,QAASA,IAAI,KAAQ,eAAe,AAEpC,QAASC,OAAO,KAAQ,WAAW,AACnC,QAASC,WAAW,KAAQ,cAAc,AAC1C,QAAOC,YAAa,sBAAsB,AAC1C,QAASC,UAAU,KAAQ,mBAAmB,AAQ9C,QAAO,MAAMC,QAAU,CAAC,CAAEC,QAAQ,CAAEC,UAAU,CAAEC,aAAe,GAAG,CAAiB,IACjF,OACE,MAACR,MAAKS,OAAO,KAAKC,QAAQ,QAAQC,MAAOH,aAAcI,WAAY,IAAKC,OAAQ,aAC9E,KAACb,KAAKc,MAAM,WACV,MAACC,OAAIC,UAAWb,OAAO,CAAC,mBAAmB,WACzC,KAACY,OAAIC,UAAWb,OAAO,CAAC,YAAY,UAAGG,WACvC,KAACS,OAAIC,UAAWb,OAAO,CAAC,oBAAoB,UAC1C,KAACD,aAAYe,KAAMb,WAAWc,MAAM,CAAEC,YAAa,aAKzD,KAACnB,KAAKoB,QAAQ,WACXb,WAAWc,GAAG,CAAC,AAACC,YACf,GAAI,OAAOA,UAAUC,EAAE,GAAK,SAAU,CACpC,OACE,KAACvB,KAAKwB,IAAI,EAACC,UAAW,IAAKC,KAAMJ,UAAUC,EAAE,UAC3C,KAACtB,SAAQ0B,SAAUL,UAAUK,QAAQ,CAAEC,KAAMN,UAAUM,IAAI,IADTN,UAAUK,QAAQ,CAI1E,CACA,GAAI,OAAOL,UAAUC,EAAE,GAAK,WAAY,CACtC,OACE,KAACR,OAA6Bc,QAASP,UAAUC,EAAE,UACjD,KAACvB,KAAKwB,IAAI,WACR,KAACvB,SAAQ0B,SAAUL,UAAUK,QAAQ,CAAEC,KAAMN,UAAUM,IAAI,MAFrDN,UAAUK,QAAQ,CAMhC,CACF,OAIR,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target=
|
|
1
|
+
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import{Badge,NavLink}from"@mantine/core";import classes from"./AppNavigationLink.module.css";const AppNavigationLinkUntyped=_0=>{let{rightSection,active,children}=_0,other=_object_without_properties(_0,["rightSection","active","children"]);return _jsx(NavLink,_object_spread_props(_object_spread({classNames:_object_spread({root:`${classes.root} ${active?classes["root-active"]:classes["root-inactive"]}`,label:classes.label,section:classes.section,children:classes.children},other.classNames),rightSection:rightSection&&_jsx(Badge,{classNames:{root:classes["badge-root"]},children:rightSection})},other),{children:children}))};const AppNavigationLink=AppNavigationLinkUntyped;export{AppNavigationLink};
|
|
2
2
|
//# sourceMappingURL=AppNavigationLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Layout/AppNavigation/AppNavigationLink.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { NavLinkProps } from \"@mantine/core\"\nimport { Badge, NavLink } from \"@mantine/core\"\nimport classes from \"./AppNavigationLink.module.css\"\n\nconst AppNavigationLinkUntyped = ({ rightSection, active, children, ...other }: NavLinkProps) => {\n return (\n <NavLink\n classNames={{\n root: `${classes.root} ${active ? classes[\"root-active\"] : classes[\"root-inactive\"]}`,\n label: classes.label,\n section: classes.section,\n children: classes.children,\n ...other.classNames,\n }}\n rightSection={\n rightSection && (\n <Badge\n classNames={{\n root: classes[\"badge-root\"],\n }}\n >\n {rightSection}\n </Badge>\n )\n }\n {...other}\n >\n {children}\n </NavLink>\n )\n}\n\nconst AppNavigationLink = AppNavigationLinkUntyped as typeof NavLink\n\nexport { AppNavigationLink }\n"],"names":["Badge","NavLink","classes","AppNavigationLinkUntyped","rightSection","active","children","other","classNames","root","label","section","AppNavigationLink"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Layout/AppNavigation/AppNavigationLink.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { NavLinkProps } from \"@mantine/core\"\nimport { Badge, NavLink } from \"@mantine/core\"\nimport classes from \"./AppNavigationLink.module.css\"\n\nconst AppNavigationLinkUntyped = ({ rightSection, active, children, ...other }: NavLinkProps) => {\n return (\n <NavLink\n classNames={{\n root: `${classes.root} ${active ? classes[\"root-active\"] : classes[\"root-inactive\"]}`,\n label: classes.label,\n section: classes.section,\n children: classes.children,\n ...other.classNames,\n }}\n rightSection={\n rightSection && (\n <Badge\n classNames={{\n root: classes[\"badge-root\"],\n }}\n >\n {rightSection}\n </Badge>\n )\n }\n {...other}\n >\n {children}\n </NavLink>\n )\n}\n\nconst AppNavigationLink = AppNavigationLinkUntyped as typeof NavLink\n\nexport { AppNavigationLink }\n"],"names":["Badge","NavLink","classes","AppNavigationLinkUntyped","rightSection","active","children","other","classNames","root","label","section","AppNavigationLink"],"mappings":"0zEAKA,QAASA,KAAK,CAAEC,OAAO,KAAQ,eAAe,AAC9C,QAAOC,YAAa,gCAAgC,CAEpD,MAAMC,yBAA2B,QAAC,CAAEC,YAAY,CAAEC,MAAM,CAAEC,QAAQ,CAA0B,IAArBC,0EACrE,OACE,KAACN,6CACCO,WAAY,gBACVC,KAAM,CAAC,EAAEP,QAAQO,IAAI,CAAC,CAAC,EAAEJ,OAASH,OAAO,CAAC,cAAc,CAAGA,OAAO,CAAC,gBAAgB,CAAC,CAAC,CACrFQ,MAAOR,QAAQQ,KAAK,CACpBC,QAAST,QAAQS,OAAO,CACxBL,SAAUJ,QAAQI,QAAQ,EACvBC,MAAMC,UAAU,EAErBJ,aACEA,cACE,KAACJ,OACCQ,WAAY,CACVC,KAAMP,OAAO,CAAC,aAAa,AAC7B,WAECE,gBAIHG,iBAEHD,WAGP,EAEA,MAAMM,kBAAoBT,wBAE1B,QAASS,iBAAiB,CAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _object_without_properties(source,excluded){if(source==null)return{};var target=
|
|
1
|
+
function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import classes from"./SimpleGrid.module.css";export const SimpleGrid=_0=>{let{config}=_0,styleProps=_object_without_properties(_0,["config"]);return _jsx("div",{className:`${classes["grid-container"]} ${styleProps.hScroll?classes.hScroll:""}`,style:{padding:styleProps.padding||`0 var(--mantine-spacing-md)`,margin:styleProps.margin||"",gridTemplateAreas:`"${styleProps.gridTemplateAreas.join('" "')}"`,gridTemplateColumns:styleProps.gridTemplateColumns,gridTemplateRows:styleProps.gridTemplateRows,gap:styleProps.gap||""},children:Object.entries(config).map(([gridArea,element])=>_jsx("div",{className:classes.area,style:{gridArea},children:element},gridArea))})};
|
|
2
2
|
//# sourceMappingURL=SimpleGrid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Layout/SimplePageLayout/SimpleGrid.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React, { ReactNode } from \"react\"\nimport classes from \"./SimpleGrid.module.css\"\nexport type TSimpleGridStyling = {\n gridTemplateAreas: string[]\n gridTemplateColumns: string\n gridTemplateRows: string\n gap?: string\n margin?: string\n padding?: string\n hScroll?: boolean\n}\n\ntype TSimpleGridProps = TSimpleGridStyling & {\n config: Record<string, ReactNode>\n}\n\n/**\n * Generic grid wrapper that renders areas from a config map.\n * Supports spacing props and optional horizontal scrolling.\n * @param config Mapping of grid-area names to React nodes.\n * @param gridTemplateAreas Array describing grid-template-areas rows.\n * @param gridTemplateColumns CSS grid-template-columns value.\n * @param gridTemplateRows CSS grid-template-rows value.\n * @param gap Optional CSS gap between grid areas.\n * @param margin Optional CSS margin for the grid container.\n * @param padding Optional CSS padding for the grid container.\n * @param hScroll When true, applies a min-width to enable horizontal scrolling on narrow viewports.\n */\nexport const SimpleGrid: React.FC<TSimpleGridProps> = ({ config, ...styleProps }) => {\n return (\n <div\n className={`${classes[\"grid-container\"]} ${styleProps.hScroll ? classes.hScroll : \"\"}`}\n style={{\n padding: styleProps.padding || `0 var(--mantine-spacing-md)`,\n margin: styleProps.margin || \"\",\n gridTemplateAreas: `\"${styleProps.gridTemplateAreas.join('\" \"')}\"`,\n gridTemplateColumns: styleProps.gridTemplateColumns,\n gridTemplateRows: styleProps.gridTemplateRows,\n gap: styleProps.gap || \"\",\n }}\n >\n {Object.entries(config).map(([gridArea, element]: [string, ReactNode]) => (\n <div key={gridArea} className={classes.area} style={{ gridArea }}>\n {element}\n </div>\n ))}\n </div>\n )\n}\n"],"names":["React","classes","SimpleGrid","config","styleProps","div","className","hScroll","style","padding","margin","gridTemplateAreas","join","gridTemplateColumns","gridTemplateRows","gap","Object","entries","map","gridArea","element","area"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Layout/SimplePageLayout/SimpleGrid.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React, { ReactNode } from \"react\"\nimport classes from \"./SimpleGrid.module.css\"\nexport type TSimpleGridStyling = {\n gridTemplateAreas: string[]\n gridTemplateColumns: string\n gridTemplateRows: string\n gap?: string\n margin?: string\n padding?: string\n hScroll?: boolean\n}\n\ntype TSimpleGridProps = TSimpleGridStyling & {\n config: Record<string, ReactNode>\n}\n\n/**\n * Generic grid wrapper that renders areas from a config map.\n * Supports spacing props and optional horizontal scrolling.\n * @param config Mapping of grid-area names to React nodes.\n * @param gridTemplateAreas Array describing grid-template-areas rows.\n * @param gridTemplateColumns CSS grid-template-columns value.\n * @param gridTemplateRows CSS grid-template-rows value.\n * @param gap Optional CSS gap between grid areas.\n * @param margin Optional CSS margin for the grid container.\n * @param padding Optional CSS padding for the grid container.\n * @param hScroll When true, applies a min-width to enable horizontal scrolling on narrow viewports.\n */\nexport const SimpleGrid: React.FC<TSimpleGridProps> = ({ config, ...styleProps }) => {\n return (\n <div\n className={`${classes[\"grid-container\"]} ${styleProps.hScroll ? classes.hScroll : \"\"}`}\n style={{\n padding: styleProps.padding || `0 var(--mantine-spacing-md)`,\n margin: styleProps.margin || \"\",\n gridTemplateAreas: `\"${styleProps.gridTemplateAreas.join('\" \"')}\"`,\n gridTemplateColumns: styleProps.gridTemplateColumns,\n gridTemplateRows: styleProps.gridTemplateRows,\n gap: styleProps.gap || \"\",\n }}\n >\n {Object.entries(config).map(([gridArea, element]: [string, ReactNode]) => (\n <div key={gridArea} className={classes.area} style={{ gridArea }}>\n {element}\n </div>\n ))}\n </div>\n )\n}\n"],"names":["React","classes","SimpleGrid","config","styleProps","div","className","hScroll","style","padding","margin","gridTemplateAreas","join","gridTemplateColumns","gridTemplateRows","gap","Object","entries","map","gridArea","element","area"],"mappings":"mlCAIA,QAAOA,UAA0B,OAAO,AACxC,QAAOC,YAAa,yBAAyB,AA2B7C,QAAO,MAAMC,WAAyC,QAAC,CAAEC,MAAM,CAAiB,IAAZC,qDAClE,OACE,KAACC,OACCC,UAAW,CAAC,EAAEL,OAAO,CAAC,iBAAiB,CAAC,CAAC,EAAEG,WAAWG,OAAO,CAAGN,QAAQM,OAAO,CAAG,GAAG,CAAC,CACtFC,MAAO,CACLC,QAASL,WAAWK,OAAO,EAAI,CAAC,2BAA2B,CAAC,CAC5DC,OAAQN,WAAWM,MAAM,EAAI,GAC7BC,kBAAmB,CAAC,CAAC,EAAEP,WAAWO,iBAAiB,CAACC,IAAI,CAAC,OAAO,CAAC,CAAC,CAClEC,oBAAqBT,WAAWS,mBAAmB,CACnDC,iBAAkBV,WAAWU,gBAAgB,CAC7CC,IAAKX,WAAWW,GAAG,EAAI,EACzB,WAECC,OAAOC,OAAO,CAACd,QAAQe,GAAG,CAAC,CAAC,CAACC,SAAUC,QAA6B,GACnE,KAACf,OAAmBC,UAAWL,QAAQoB,IAAI,CAAEb,MAAO,CAAEW,QAAS,WAC5DC,SADOD,YAMlB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target=
|
|
1
|
+
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import{SimpleGrid}from"./SimpleGrid";import{Typo}from"../../Typo";import classes from"./index.module.css";export const SimplePageLayout=_0=>{let{children,title,Button,Breadcrumbs}=_0,gridProps=_object_without_properties(_0,["children","title","Button","Breadcrumbs"]);return _jsx(SimpleGrid,{config:{title:_jsx("div",{className:classes.title,children:_jsx(Typo,{type:"heading2",children:title})}),button:Button?_jsx("div",{className:classes.button,children:Button}):null,content:_jsx("div",{className:classes.content,children:children}),breadcrumbs:Breadcrumbs?_jsx("div",{className:classes.breadcrumbs,children:Breadcrumbs}):null},gridTemplateAreas:[...Breadcrumbs?["breadcrumbs breadcrumbs breadcrumbs"]:[],"title . button","content content content"],gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:`${Breadcrumbs?"35px":""} 66px 1fr`,gap:gridProps.gap,margin:"-1rem -1rem 0 -1rem",padding:gridProps.padding,hScroll:gridProps.hScroll})};export const SimplePageLayoutComplex=props=>{return _jsx(SimplePageLayout,{title:props.title,Button:props.Button,hScroll:props.hScroll,children:_jsx(SimpleGrid,_object_spread_props(_object_spread({},props),{padding:props.padding||"0"}))})};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Layout/SimplePageLayout/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React, { ReactNode } from \"react\"\nimport { SimpleGrid, TSimpleGridStyling } from \"./SimpleGrid\"\nimport { Typo } from \"../../Typo\"\nimport classes from \"./index.module.css\"\n\nexport type TSimplePageLayoutProps = Partial<TSimpleGridStyling> & {\n title: string\n Button?: ReactNode\n children?: ReactNode\n Breadcrumbs?: ReactNode\n}\n\n/**\n * Renders a simple page layout with title, optional breadcrumbs and action button.\n * Uses a 3-column grid and exposes styling props for spacing and horizontal scroll.\n * @param title Page title displayed as heading2.\n * @param Button Optional action element rendered in the header's right side.\n * @param Breadcrumbs Optional breadcrumbs rendered above the title.\n * @param children Main content area.\n * @param gap Optional CSS gap between grid areas.\n * @param padding Optional padding for the grid container.\n * @param hScroll When true, enforces a min-width to allow horizontal scrolling on smaller viewports.\n */\nexport const SimplePageLayout: React.FC<TSimplePageLayoutProps> = ({\n children,\n title,\n Button,\n Breadcrumbs,\n ...gridProps\n}) => {\n return (\n <SimpleGrid\n config={{\n title: (\n <div className={classes.title}>\n <Typo type=\"heading2\">{title}</Typo>\n </div>\n ),\n button: Button ? <div className={classes.button}>{Button}</div> : null,\n content: <div className={classes.content}>{children}</div>,\n breadcrumbs: Breadcrumbs ? <div className={classes.breadcrumbs}>{Breadcrumbs}</div> : null,\n }}\n gridTemplateAreas={[\n ...(Breadcrumbs ? [\"breadcrumbs breadcrumbs breadcrumbs\"] : []),\n \"title . button\",\n \"content content content\",\n ]}\n gridTemplateColumns={\"1fr 1fr 1fr\"}\n gridTemplateRows={`${Breadcrumbs ? \"35px\" : \"\"} 66px 1fr`}\n gap={gridProps.gap}\n margin={\"-1rem -1rem 0 -1rem\"}\n padding={gridProps.padding}\n hScroll={gridProps.hScroll}\n />\n )\n}\n\nexport type TSimplePageLayoutComplex = TSimpleGridStyling & {\n title: string\n Button?: ReactNode\n config: Record<string, ReactNode>\n}\n\n/**\n * Complex variant that composes SimplePageLayout with a configurable SimpleGrid.\n * Forwards styling props (including hScroll) and renders additional grid areas via config.\n * @param title Page title.\n * @param Button Optional action element rendered in the header's right side.\n * @param config Mapping of grid-area names to React nodes.\n * @param gridTemplateAreas CSS grid-template-areas definition.\n * @param gridTemplateColumns CSS grid-template-columns definition.\n * @param gridTemplateRows CSS grid-template-rows definition.\n * @param gap Optional CSS gap between grid areas.\n * @param margin Optional CSS margin for the grid container.\n * @param padding Optional CSS padding for the grid container (defaults to \"0\" for inner grid).\n * @param hScroll When true, enforces a min-width to allow horizontal scrolling on smaller viewports.\n */\nexport const SimplePageLayoutComplex = (props: TSimplePageLayoutComplex) => {\n return (\n <SimplePageLayout title={props.title} Button={props.Button} hScroll={props.hScroll}>\n <SimpleGrid {...props} padding={props.padding || \"0\"} />\n </SimplePageLayout>\n )\n}\n"],"names":["React","SimpleGrid","Typo","classes","SimplePageLayout","children","title","Button","Breadcrumbs","gridProps","config","div","className","type","button","content","breadcrumbs","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","gap","margin","padding","hScroll","SimplePageLayoutComplex","props"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Layout/SimplePageLayout/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React, { ReactNode } from \"react\"\nimport { SimpleGrid, TSimpleGridStyling } from \"./SimpleGrid\"\nimport { Typo } from \"../../Typo\"\nimport classes from \"./index.module.css\"\n\nexport type TSimplePageLayoutProps = Partial<TSimpleGridStyling> & {\n title: string\n Button?: ReactNode\n children?: ReactNode\n Breadcrumbs?: ReactNode\n}\n\n/**\n * Renders a simple page layout with title, optional breadcrumbs and action button.\n * Uses a 3-column grid and exposes styling props for spacing and horizontal scroll.\n * @param title Page title displayed as heading2.\n * @param Button Optional action element rendered in the header's right side.\n * @param Breadcrumbs Optional breadcrumbs rendered above the title.\n * @param children Main content area.\n * @param gap Optional CSS gap between grid areas.\n * @param padding Optional padding for the grid container.\n * @param hScroll When true, enforces a min-width to allow horizontal scrolling on smaller viewports.\n */\nexport const SimplePageLayout: React.FC<TSimplePageLayoutProps> = ({\n children,\n title,\n Button,\n Breadcrumbs,\n ...gridProps\n}) => {\n return (\n <SimpleGrid\n config={{\n title: (\n <div className={classes.title}>\n <Typo type=\"heading2\">{title}</Typo>\n </div>\n ),\n button: Button ? <div className={classes.button}>{Button}</div> : null,\n content: <div className={classes.content}>{children}</div>,\n breadcrumbs: Breadcrumbs ? <div className={classes.breadcrumbs}>{Breadcrumbs}</div> : null,\n }}\n gridTemplateAreas={[\n ...(Breadcrumbs ? [\"breadcrumbs breadcrumbs breadcrumbs\"] : []),\n \"title . button\",\n \"content content content\",\n ]}\n gridTemplateColumns={\"1fr 1fr 1fr\"}\n gridTemplateRows={`${Breadcrumbs ? \"35px\" : \"\"} 66px 1fr`}\n gap={gridProps.gap}\n margin={\"-1rem -1rem 0 -1rem\"}\n padding={gridProps.padding}\n hScroll={gridProps.hScroll}\n />\n )\n}\n\nexport type TSimplePageLayoutComplex = TSimpleGridStyling & {\n title: string\n Button?: ReactNode\n config: Record<string, ReactNode>\n}\n\n/**\n * Complex variant that composes SimplePageLayout with a configurable SimpleGrid.\n * Forwards styling props (including hScroll) and renders additional grid areas via config.\n * @param title Page title.\n * @param Button Optional action element rendered in the header's right side.\n * @param config Mapping of grid-area names to React nodes.\n * @param gridTemplateAreas CSS grid-template-areas definition.\n * @param gridTemplateColumns CSS grid-template-columns definition.\n * @param gridTemplateRows CSS grid-template-rows definition.\n * @param gap Optional CSS gap between grid areas.\n * @param margin Optional CSS margin for the grid container.\n * @param padding Optional CSS padding for the grid container (defaults to \"0\" for inner grid).\n * @param hScroll When true, enforces a min-width to allow horizontal scrolling on smaller viewports.\n */\nexport const SimplePageLayoutComplex = (props: TSimplePageLayoutComplex) => {\n return (\n <SimplePageLayout title={props.title} Button={props.Button} hScroll={props.hScroll}>\n <SimpleGrid {...props} padding={props.padding || \"0\"} />\n </SimplePageLayout>\n )\n}\n"],"names":["React","SimpleGrid","Typo","classes","SimplePageLayout","children","title","Button","Breadcrumbs","gridProps","config","div","className","type","button","content","breadcrumbs","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","gap","margin","padding","hScroll","SimplePageLayoutComplex","props"],"mappings":"0zEAIA,QAAOA,UAA0B,OAAO,AACxC,QAASC,UAAU,KAA4B,cAAc,AAC7D,QAASC,IAAI,KAAQ,YAAY,AACjC,QAAOC,YAAa,oBAAoB,AAoBxC,QAAO,MAAMC,iBAAqD,QAAC,CACjEC,QAAQ,CACRC,KAAK,CACLC,MAAM,CACNC,WAAW,CAEZ,IADIC,qFAEH,OACE,KAACR,YACCS,OAAQ,CACNJ,MACE,KAACK,OAAIC,UAAWT,QAAQG,KAAK,UAC3B,KAACJ,MAAKW,KAAK,oBAAYP,UAG3BQ,OAAQP,OAAS,KAACI,OAAIC,UAAWT,QAAQW,MAAM,UAAGP,SAAgB,KAClEQ,QAAS,KAACJ,OAAIC,UAAWT,QAAQY,OAAO,UAAGV,WAC3CW,YAAaR,YAAc,KAACG,OAAIC,UAAWT,QAAQa,WAAW,UAAGR,cAAqB,IACxF,EACAS,kBAAmB,IACbT,YAAc,CAAC,sCAAsC,CAAG,EAAE,CAC9D,iBACA,0BACD,CACDU,oBAAqB,cACrBC,iBAAkB,CAAC,EAAEX,YAAc,OAAS,GAAG,SAAS,CAAC,CACzDY,IAAKX,UAAUW,GAAG,CAClBC,OAAQ,sBACRC,QAASb,UAAUa,OAAO,CAC1BC,QAASd,UAAUc,OAAO,EAGhC,CAAC,AAsBD,QAAO,MAAMC,wBAA0B,AAACC,QACtC,OACE,KAACrB,kBAAiBE,MAAOmB,MAAMnB,KAAK,CAAEC,OAAQkB,MAAMlB,MAAM,CAAEgB,QAASE,MAAMF,OAAO,UAChF,KAACtB,kDAAewB,QAAOH,QAASG,MAAMH,OAAO,EAAI,QAGvD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target=
|
|
1
|
+
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{createContext,useState}from"react";import{Modal as MantineModal}from"@mantine/core";import{ErrorBoundary}from"../ErrorBoundary";import classes from"./Modal.module.css";export const ModalContext=createContext({setOpen:()=>void 0});const ModalWithOpener=({children,Opener,initiallyOpen=false,modalProps,title})=>{const[open,setOpen]=useState(initiallyOpen);return _jsxs(ModalContext.Provider,{value:{setOpen},children:[Opener(setOpen),_jsx(Modal,_object_spread_props(_object_spread({opened:open,title:title},modalProps),{onClose:()=>setOpen(false),children:typeof children==="function"?children(setOpen):children}))]})};const Modal=_0=>{let{children,title}=_0,props=_object_without_properties(_0,["children","title"]);return _jsx(MantineModal,_object_spread_props(_object_spread({centered:true,classNames:{body:classes.body,header:classes.header,title:classes.title,content:classes.content,close:classes.close},title:title},props),{children:_jsx(ErrorBoundary,{children:children})}))};export{ModalWithOpener,Modal};
|
|
2
2
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport {\n createContext,\n Dispatch,\n FC,\n PropsWithChildren,\n ReactElement,\n ReactNode,\n useState,\n} from \"react\"\nimport { Modal as MantineModal, ModalProps } from \"@mantine/core\"\nimport { ErrorBoundary } from \"../ErrorBoundary\"\nimport classes from \"./Modal.module.css\"\n\nexport type TModalWithOpenerConfig = {\n initiallyOpen?: boolean\n Opener: (setOpen: Dispatch<React.SetStateAction<boolean>>) => ReactElement\n children: ReactNode | ((setOpen: (value: boolean) => void) => ReactElement)\n onSave?: () => void\n title?: ReactNode\n modalProps?: Partial<ModalProps>\n}\n\ntype TModalContext = {\n setOpen: Dispatch<React.SetStateAction<boolean>>\n}\n\nexport const ModalContext = createContext<TModalContext>({\n setOpen: () => void 0,\n})\n\nconst ModalWithOpener = ({\n children,\n Opener,\n initiallyOpen = false,\n modalProps,\n title,\n}: TModalWithOpenerConfig) => {\n const [open, setOpen] = useState<boolean>(initiallyOpen)\n return (\n <ModalContext.Provider value={{ setOpen }}>\n {Opener(setOpen)}\n <Modal opened={open} title={title} {...modalProps} onClose={() => setOpen(false)}>\n {typeof children === \"function\" ? children(setOpen) : children}\n </Modal>\n </ModalContext.Provider>\n )\n}\n\nconst Modal: FC<PropsWithChildren<ModalProps>> = ({ children, title, ...props }) => {\n return (\n <MantineModal\n centered\n classNames={{\n body: classes.body,\n header: classes.header,\n title: classes.title,\n content: classes.content,\n close: classes.close,\n }}\n title={title}\n {...props}\n >\n <ErrorBoundary>{children}</ErrorBoundary>\n </MantineModal>\n )\n}\n\nexport { ModalWithOpener, Modal }\n"],"names":["createContext","useState","Modal","MantineModal","ErrorBoundary","classes","ModalContext","setOpen","ModalWithOpener","children","Opener","initiallyOpen","modalProps","title","open","Provider","value","opened","onClose","props","centered","classNames","body","header","content","close"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport {\n createContext,\n Dispatch,\n FC,\n PropsWithChildren,\n ReactElement,\n ReactNode,\n useState,\n} from \"react\"\nimport { Modal as MantineModal, ModalProps } from \"@mantine/core\"\nimport { ErrorBoundary } from \"../ErrorBoundary\"\nimport classes from \"./Modal.module.css\"\n\nexport type TModalWithOpenerConfig = {\n initiallyOpen?: boolean\n Opener: (setOpen: Dispatch<React.SetStateAction<boolean>>) => ReactElement\n children: ReactNode | ((setOpen: (value: boolean) => void) => ReactElement)\n onSave?: () => void\n title?: ReactNode\n modalProps?: Partial<ModalProps>\n}\n\ntype TModalContext = {\n setOpen: Dispatch<React.SetStateAction<boolean>>\n}\n\nexport const ModalContext = createContext<TModalContext>({\n setOpen: () => void 0,\n})\n\nconst ModalWithOpener = ({\n children,\n Opener,\n initiallyOpen = false,\n modalProps,\n title,\n}: TModalWithOpenerConfig) => {\n const [open, setOpen] = useState<boolean>(initiallyOpen)\n return (\n <ModalContext.Provider value={{ setOpen }}>\n {Opener(setOpen)}\n <Modal opened={open} title={title} {...modalProps} onClose={() => setOpen(false)}>\n {typeof children === \"function\" ? children(setOpen) : children}\n </Modal>\n </ModalContext.Provider>\n )\n}\n\nconst Modal: FC<PropsWithChildren<ModalProps>> = ({ children, title, ...props }) => {\n return (\n <MantineModal\n centered\n classNames={{\n body: classes.body,\n header: classes.header,\n title: classes.title,\n content: classes.content,\n close: classes.close,\n }}\n title={title}\n {...props}\n >\n <ErrorBoundary>{children}</ErrorBoundary>\n </MantineModal>\n )\n}\n\nexport { ModalWithOpener, Modal }\n"],"names":["createContext","useState","Modal","MantineModal","ErrorBoundary","classes","ModalContext","setOpen","ModalWithOpener","children","Opener","initiallyOpen","modalProps","title","open","Provider","value","opened","onClose","props","centered","classNames","body","header","content","close"],"mappings":"w0EAIA,QACEA,aAAa,CAMbC,QAAQ,KACH,OAAO,AACd,QAASC,SAASC,YAAY,KAAoB,eAAe,AACjE,QAASC,aAAa,KAAQ,kBAAkB,AAChD,QAAOC,YAAa,oBAAoB,AAexC,QAAO,MAAMC,aAAeN,cAA6B,CACvDO,QAAS,IAAM,KAAK,CACtB,EAAE,CAEF,MAAMC,gBAAkB,CAAC,CACvBC,QAAQ,CACRC,MAAM,CACNC,cAAgB,KAAK,CACrBC,UAAU,CACVC,KAAK,CACkB,IACvB,KAAM,CAACC,KAAMP,QAAQ,CAAGN,SAAkBU,eAC1C,OACE,MAACL,aAAaS,QAAQ,EAACC,MAAO,CAAET,OAAQ,YACrCG,OAAOH,SACR,KAACL,2CAAMe,OAAQH,KAAMD,MAAOA,OAAWD,aAAYM,QAAS,IAAMX,QAAQ,gBACvE,OAAOE,WAAa,WAAaA,SAASF,SAAWE,cAI9D,EAEA,MAAMP,MAA2C,QAAC,CAAEO,QAAQ,CAAEI,KAAK,CAAY,IAAPM,0DACtE,OACE,KAAChB,kDACCiB,QAAQ,MACRC,WAAY,CACVC,KAAMjB,QAAQiB,IAAI,CAClBC,OAAQlB,QAAQkB,MAAM,CACtBV,MAAOR,QAAQQ,KAAK,CACpBW,QAASnB,QAAQmB,OAAO,CACxBC,MAAOpB,QAAQoB,KAAK,AACtB,EACAZ,MAAOA,OACHM,iBAEJ,KAACf,wBAAeK,aAGtB,CAEA,QAASD,eAAe,CAAEN,KAAK,CAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target=
|
|
1
|
+
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import{notifications}from"@mantine/notifications";import classes from"./Notification.module.css";import{StatusIcon}from"../../icons";import{EStatus}from"../../genericTypes";export const showNotification=_0=>{let{type=EStatus.INFO}=_0,props=_object_without_properties(_0,["type"]);notifications.show(_object_spread_props(_object_spread({classNames:_object_spread({},classes)},props),{icon:_jsx(StatusIcon,{status:type})}))};export const showSuccessNotification=(text,title)=>{showNotification({type:EStatus.SUCCESS,title:title,message:text})};export const showErrorNotification=(text,title)=>{showNotification({type:EStatus.ERROR,title:title,message:text})};export const showInfoNotification=(text,title)=>{showNotification({type:EStatus.INFO,title:title,message:text})};export const showWarningNotification=(text,title)=>{showNotification({type:EStatus.WARNING,title:title,message:text})};
|
|
2
2
|
//# sourceMappingURL=notifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Notification/notifications.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { notifications, NotificationData } from \"@mantine/notifications\"\n\nimport classes from \"./Notification.module.css\"\nimport { StatusIcon } from \"../../icons\"\nimport { EStatus } from \"../../genericTypes\"\nexport type TNotificationProps = {\n type?: EStatus\n} & NotificationData\n\nexport const showNotification = ({ type = EStatus.INFO, ...props }: TNotificationProps) => {\n notifications.show({\n classNames: { ...classes },\n ...props,\n icon: <StatusIcon status={type} />,\n })\n}\n\nexport const showSuccessNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.SUCCESS,\n title: title,\n message: text,\n })\n}\n\nexport const showErrorNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.ERROR,\n title: title,\n message: text,\n })\n}\n\nexport const showInfoNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.INFO,\n title: title,\n message: text,\n })\n}\n\nexport const showWarningNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.WARNING,\n title: title,\n message: text,\n })\n}\n"],"names":["notifications","classes","StatusIcon","EStatus","showNotification","type","INFO","props","show","classNames","icon","status","showSuccessNotification","text","title","SUCCESS","message","showErrorNotification","ERROR","showInfoNotification","showWarningNotification","WARNING"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Notification/notifications.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { notifications, NotificationData } from \"@mantine/notifications\"\n\nimport classes from \"./Notification.module.css\"\nimport { StatusIcon } from \"../../icons\"\nimport { EStatus } from \"../../genericTypes\"\nexport type TNotificationProps = {\n type?: EStatus\n} & NotificationData\n\nexport const showNotification = ({ type = EStatus.INFO, ...props }: TNotificationProps) => {\n notifications.show({\n classNames: { ...classes },\n ...props,\n icon: <StatusIcon status={type} />,\n })\n}\n\nexport const showSuccessNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.SUCCESS,\n title: title,\n message: text,\n })\n}\n\nexport const showErrorNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.ERROR,\n title: title,\n message: text,\n })\n}\n\nexport const showInfoNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.INFO,\n title: title,\n message: text,\n })\n}\n\nexport const showWarningNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.WARNING,\n title: title,\n message: text,\n })\n}\n"],"names":["notifications","classes","StatusIcon","EStatus","showNotification","type","INFO","props","show","classNames","icon","status","showSuccessNotification","text","title","SUCCESS","message","showErrorNotification","ERROR","showInfoNotification","showWarningNotification","WARNING"],"mappings":"0zEAIA,QAASA,aAAa,KAA0B,wBAAwB,AAExE,QAAOC,YAAa,2BAA2B,AAC/C,QAASC,UAAU,KAAQ,aAAa,AACxC,QAASC,OAAO,KAAQ,oBAAoB,AAK5C,QAAO,MAAMC,iBAAmB,QAAC,CAAEC,KAAOF,QAAQG,IAAI,CAAgC,IAA3BC,8CACzDP,cAAcQ,IAAI,CAAC,qCACjBC,WAAY,kBAAKR,UACdM,QACHG,KAAM,KAACR,YAAWS,OAAQN,SAE9B,CAAC,AAED,QAAO,MAAMO,wBAA0B,CAACC,KAAcC,SACpDV,iBAAiB,CACfC,KAAMF,QAAQY,OAAO,CACrBD,MAAOA,MACPE,QAASH,IACX,EACF,CAAC,AAED,QAAO,MAAMI,sBAAwB,CAACJ,KAAcC,SAClDV,iBAAiB,CACfC,KAAMF,QAAQe,KAAK,CACnBJ,MAAOA,MACPE,QAASH,IACX,EACF,CAAC,AAED,QAAO,MAAMM,qBAAuB,CAACN,KAAcC,SACjDV,iBAAiB,CACfC,KAAMF,QAAQG,IAAI,CAClBQ,MAAOA,MACPE,QAASH,IACX,EACF,CAAC,AAED,QAAO,MAAMO,wBAA0B,CAACP,KAAcC,SACpDV,iBAAiB,CACfC,KAAMF,QAAQkB,OAAO,CACrBP,MAAOA,MACPE,QAASH,IACX,EACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target=
|
|
1
|
+
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import{TableClientSide}from"../index";import{TableSessionStorage}from"../../persistence/TableSessionStorage";import{useMemo}from"react";import{defaultPagingState}from"../../constants";export function TableClientSidePersistent(_0){let{Storage=TableSessionStorage.Instance(),tableId,config,onSortingChange,onPagingChange}=_0,tableProps=_object_without_properties(_0,["Storage","tableId","config","onSortingChange","onPagingChange"]);const savedTable=useMemo(()=>Storage.get(tableId)||{paging:defaultPagingState,sorting:config.sorting.default},[tableId]);const configurationWithAdjustedSorting=_object_spread_props(_object_spread({},config),{sorting:{default:savedTable.sorting}});const handleSortingChange=props=>{Storage===null||Storage===void 0?void 0:Storage.set(tableId,()=>_object_spread_props(_object_spread({},savedTable),{sorting:{column:props.column,direction:props.direction}}));onSortingChange===null||onSortingChange===void 0?void 0:onSortingChange(props)};const handlePagingChange=props=>{Storage===null||Storage===void 0?void 0:Storage.set(tableId,()=>_object_spread_props(_object_spread({},savedTable),{paging:{index:props.index,size:props.size}}));onPagingChange===null||onPagingChange===void 0?void 0:onPagingChange(props)};return _jsx(TableClientSide,_object_spread_props(_object_spread({},tableProps),{onSortingChange:handleSortingChange,onPagingChange:handlePagingChange,defaultPaging:savedTable.paging,config:configurationWithAdjustedSorting}))}
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/Table/TableClientSide/TableClientSidePersistent/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport {\n TableClientSide,\n THandlePagingChange,\n THandleSortingChange,\n TTableClientSideProps,\n} from \"../index\"\nimport { ITableStorage, TableSessionStorage } from \"../../persistence/TableSessionStorage\"\nimport { useMemo } from \"react\"\nimport { defaultPagingState } from \"../../constants\"\n\nexport type TTableClientSidePersistentProps<TDataType> = TTableClientSideProps<TDataType> & {\n Storage?: ITableStorage\n tableId: string\n}\n\n/**\n * The TableClientSidePersistent is a persistence middleware that uses closely the same interface as the table\n * with addition of the *Storage* and *tableId*.\n * it wraps and intercepts incoming and outgoing data to inject loaded data into the\n * table or save table changes into the Storage Repository.\n *\n * @param Storage Storage Repository for the Table. This is optional and per default the TableSessionStorage for SessionStorage persistence\n * @param tableId Unique ID for persistence\n * @param config Table Configuration\n * @param onSortingChange Callback\n * @param onPagingChange Callback\n * @param tableProps Interface from useTableClientSide hook\n */\nexport function TableClientSidePersistent<TDataType>({\n Storage = TableSessionStorage.Instance(),\n tableId,\n config,\n onSortingChange,\n onPagingChange,\n ...tableProps\n}: TTableClientSidePersistentProps<TDataType>) {\n const savedTable = useMemo(\n () =>\n Storage.get(tableId) || {\n paging: defaultPagingState,\n sorting: config.sorting.default,\n },\n [tableId]\n )\n\n const configurationWithAdjustedSorting = {\n ...config,\n sorting: {\n default: savedTable.sorting,\n },\n }\n const handleSortingChange: THandleSortingChange = (props) => {\n Storage?.set(tableId, () => ({\n ...savedTable,\n sorting: {\n column: props.column,\n direction: props.direction,\n },\n }))\n onSortingChange?.(props)\n }\n\n const handlePagingChange: THandlePagingChange = (props) => {\n Storage?.set(tableId, () => ({\n ...savedTable,\n paging: {\n index: props.index,\n size: props.size,\n },\n }))\n onPagingChange?.(props)\n }\n\n return (\n <TableClientSide\n {...tableProps}\n onSortingChange={handleSortingChange}\n onPagingChange={handlePagingChange}\n defaultPaging={savedTable.paging}\n config={configurationWithAdjustedSorting}\n />\n )\n}\n"],"names":["TableClientSide","TableSessionStorage","useMemo","defaultPagingState","TableClientSidePersistent","Storage","Instance","tableId","config","onSortingChange","onPagingChange","tableProps","savedTable","get","paging","sorting","default","configurationWithAdjustedSorting","handleSortingChange","props","set","column","direction","handlePagingChange","index","size","defaultPaging"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Table/TableClientSide/TableClientSidePersistent/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport {\n TableClientSide,\n THandlePagingChange,\n THandleSortingChange,\n TTableClientSideProps,\n} from \"../index\"\nimport { ITableStorage, TableSessionStorage } from \"../../persistence/TableSessionStorage\"\nimport { useMemo } from \"react\"\nimport { defaultPagingState } from \"../../constants\"\n\nexport type TTableClientSidePersistentProps<TDataType> = TTableClientSideProps<TDataType> & {\n Storage?: ITableStorage\n tableId: string\n}\n\n/**\n * The TableClientSidePersistent is a persistence middleware that uses closely the same interface as the table\n * with addition of the *Storage* and *tableId*.\n * it wraps and intercepts incoming and outgoing data to inject loaded data into the\n * table or save table changes into the Storage Repository.\n *\n * @param Storage Storage Repository for the Table. This is optional and per default the TableSessionStorage for SessionStorage persistence\n * @param tableId Unique ID for persistence\n * @param config Table Configuration\n * @param onSortingChange Callback\n * @param onPagingChange Callback\n * @param tableProps Interface from useTableClientSide hook\n */\nexport function TableClientSidePersistent<TDataType>({\n Storage = TableSessionStorage.Instance(),\n tableId,\n config,\n onSortingChange,\n onPagingChange,\n ...tableProps\n}: TTableClientSidePersistentProps<TDataType>) {\n const savedTable = useMemo(\n () =>\n Storage.get(tableId) || {\n paging: defaultPagingState,\n sorting: config.sorting.default,\n },\n [tableId]\n )\n\n const configurationWithAdjustedSorting = {\n ...config,\n sorting: {\n default: savedTable.sorting,\n },\n }\n const handleSortingChange: THandleSortingChange = (props) => {\n Storage?.set(tableId, () => ({\n ...savedTable,\n sorting: {\n column: props.column,\n direction: props.direction,\n },\n }))\n onSortingChange?.(props)\n }\n\n const handlePagingChange: THandlePagingChange = (props) => {\n Storage?.set(tableId, () => ({\n ...savedTable,\n paging: {\n index: props.index,\n size: props.size,\n },\n }))\n onPagingChange?.(props)\n }\n\n return (\n <TableClientSide\n {...tableProps}\n onSortingChange={handleSortingChange}\n onPagingChange={handlePagingChange}\n defaultPaging={savedTable.paging}\n config={configurationWithAdjustedSorting}\n />\n )\n}\n"],"names":["TableClientSide","TableSessionStorage","useMemo","defaultPagingState","TableClientSidePersistent","Storage","Instance","tableId","config","onSortingChange","onPagingChange","tableProps","savedTable","get","paging","sorting","default","configurationWithAdjustedSorting","handleSortingChange","props","set","column","direction","handlePagingChange","index","size","defaultPaging"],"mappings":"0zEAIA,QACEA,eAAe,KAIV,UAAU,AACjB,QAAwBC,mBAAmB,KAAQ,uCAAuC,AAC1F,QAASC,OAAO,KAAQ,OAAO,AAC/B,QAASC,kBAAkB,KAAQ,iBAAiB,AAoBpD,QAAO,SAASC,0BAAqC,EAOR,KAPQ,CACnDC,QAAUJ,oBAAoBK,QAAQ,EAAE,CACxCC,OAAO,CACPC,MAAM,CACNC,eAAe,CACfC,cAAc,CAE6B,IADxCC,4GAEH,MAAMC,WAAaV,QACjB,IACEG,QAAQQ,GAAG,CAACN,UAAY,CACtBO,OAAQX,mBACRY,QAASP,OAAOO,OAAO,CAACC,OAAO,AACjC,EACF,CAACT,QAAQ,EAGX,MAAMU,iCAAmC,uCACpCT,SACHO,QAAS,CACPC,QAASJ,WAAWG,OAAO,AAC7B,IAEF,MAAMG,oBAA4C,AAACC,QACjDd,gBAAAA,wBAAAA,QAASe,GAAG,CAACb,QAAS,IAAO,uCACxBK,aACHG,QAAS,CACPM,OAAQF,MAAME,MAAM,CACpBC,UAAWH,MAAMG,SAAS,AAC5B,KAEFb,wBAAAA,gCAAAA,gBAAkBU,MACpB,EAEA,MAAMI,mBAA0C,AAACJ,QAC/Cd,gBAAAA,wBAAAA,QAASe,GAAG,CAACb,QAAS,IAAO,uCACxBK,aACHE,OAAQ,CACNU,MAAOL,MAAMK,KAAK,CAClBC,KAAMN,MAAMM,IAAI,AAClB,KAEFf,uBAAAA,+BAAAA,eAAiBS,MACnB,EAEA,OACE,KAACnB,uDACKW,aACJF,gBAAiBS,oBACjBR,eAAgBa,mBAChBG,cAAed,WAAWE,MAAM,CAChCN,OAAQS,mCAGd"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target=
|
|
1
|
+
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import{TableSessionStorage}from"../../persistence/TableSessionStorage";import{useEffect,useMemo}from"react";import{defaultPagingState}from"../../constants";import{TableServerSide}from"../index";export function getTableServerSidePersistentState(id,Storage=TableSessionStorage.Instance()){return Storage.get(id)}export function TableServerSidePersistent(_0){let{Storage=TableSessionStorage.Instance(),tableId,config,onTableUpdate}=_0,tableProps=_object_without_properties(_0,["Storage","tableId","config","onTableUpdate"]);const savedTable=useMemo(()=>Storage.get(tableId)||{paging:defaultPagingState,sorting:config.sorting.default},[tableId]);const configurationWithAdjustedSorting=_object_spread_props(_object_spread({},config),{sorting:{default:savedTable.sorting}});const handleTableChange=tableState=>{Storage===null||Storage===void 0?void 0:Storage.set(tableId,()=>tableState);onTableUpdate===null||onTableUpdate===void 0?void 0:onTableUpdate(tableState)};useEffect(()=>{if(!tableProps.metadata)return;Storage===null||Storage===void 0?void 0:Storage.set(tableId,prev=>_object_spread({},prev,tableProps.metadata))},[tableProps.metadata]);return _jsx(TableServerSide,_object_spread_props(_object_spread({},tableProps),{onTableUpdate:handleTableChange,config:configurationWithAdjustedSorting}))}
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/Table/TableServerSide/TableServerSidePersistent/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ITableStorage, TableSessionStorage } from \"../../persistence/TableSessionStorage\"\nimport { useEffect, useMemo } from \"react\"\nimport { defaultPagingState } from \"../../constants\"\nimport { TableServerSide, TTableServerSideProps } from \"../index\"\nimport { TOnTableUpdateArgs } from \"../useTableServerSide\"\n\nexport type TTableServerSidePersistentProps<TDataType> = TTableServerSideProps<TDataType> & {\n Storage?: ITableStorage\n tableId: string\n}\n\nexport function getTableServerSidePersistentState(\n id: string,\n Storage = TableSessionStorage.Instance()\n) {\n return Storage.get(id)\n}\n\n/**\n * The TableServerSidePersistent is a persistence middleware that uses closely the same interface as the table\n * with addition of the *Storage* and *tableId*.\n * it wraps and intercepts incoming and outgoing data to inject loaded data into the\n * table or save table changes into the Storage Repository.\n *\n * @param Storage Storage Repository for the Table. This is optional and per default the TableSessionStorage for SessionStorage persistence\n * @param tableId Unique ID for persistence\n * @param config Table Configuration\n * @param onTableUpdate Callback\n * @param tableProps Interface from useTableClientSide hook\n */\nexport function TableServerSidePersistent<TDataType>({\n Storage = TableSessionStorage.Instance(),\n tableId,\n config,\n onTableUpdate,\n ...tableProps\n}: TTableServerSidePersistentProps<TDataType>) {\n const savedTable = useMemo(\n () =>\n Storage.get(tableId) || {\n paging: defaultPagingState,\n sorting: config.sorting.default,\n },\n [tableId]\n )\n\n const configurationWithAdjustedSorting = {\n ...config,\n sorting: {\n default: savedTable.sorting,\n },\n }\n const handleTableChange = (tableState: TOnTableUpdateArgs) => {\n Storage?.set(tableId, () => tableState)\n onTableUpdate?.(tableState)\n }\n\n useEffect(() => {\n if (!tableProps.metadata) return\n Storage?.set(tableId, (prev) => ({ ...prev, ...tableProps.metadata }))\n }, [tableProps.metadata])\n\n return (\n <TableServerSide\n {...tableProps}\n onTableUpdate={handleTableChange}\n config={configurationWithAdjustedSorting}\n />\n )\n}\n"],"names":["TableSessionStorage","useEffect","useMemo","defaultPagingState","TableServerSide","getTableServerSidePersistentState","id","Storage","Instance","get","TableServerSidePersistent","tableId","config","onTableUpdate","tableProps","savedTable","paging","sorting","default","configurationWithAdjustedSorting","handleTableChange","tableState","set","metadata","prev"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Table/TableServerSide/TableServerSidePersistent/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ITableStorage, TableSessionStorage } from \"../../persistence/TableSessionStorage\"\nimport { useEffect, useMemo } from \"react\"\nimport { defaultPagingState } from \"../../constants\"\nimport { TableServerSide, TTableServerSideProps } from \"../index\"\nimport { TOnTableUpdateArgs } from \"../useTableServerSide\"\n\nexport type TTableServerSidePersistentProps<TDataType> = TTableServerSideProps<TDataType> & {\n Storage?: ITableStorage\n tableId: string\n}\n\nexport function getTableServerSidePersistentState(\n id: string,\n Storage = TableSessionStorage.Instance()\n) {\n return Storage.get(id)\n}\n\n/**\n * The TableServerSidePersistent is a persistence middleware that uses closely the same interface as the table\n * with addition of the *Storage* and *tableId*.\n * it wraps and intercepts incoming and outgoing data to inject loaded data into the\n * table or save table changes into the Storage Repository.\n *\n * @param Storage Storage Repository for the Table. This is optional and per default the TableSessionStorage for SessionStorage persistence\n * @param tableId Unique ID for persistence\n * @param config Table Configuration\n * @param onTableUpdate Callback\n * @param tableProps Interface from useTableClientSide hook\n */\nexport function TableServerSidePersistent<TDataType>({\n Storage = TableSessionStorage.Instance(),\n tableId,\n config,\n onTableUpdate,\n ...tableProps\n}: TTableServerSidePersistentProps<TDataType>) {\n const savedTable = useMemo(\n () =>\n Storage.get(tableId) || {\n paging: defaultPagingState,\n sorting: config.sorting.default,\n },\n [tableId]\n )\n\n const configurationWithAdjustedSorting = {\n ...config,\n sorting: {\n default: savedTable.sorting,\n },\n }\n const handleTableChange = (tableState: TOnTableUpdateArgs) => {\n Storage?.set(tableId, () => tableState)\n onTableUpdate?.(tableState)\n }\n\n useEffect(() => {\n if (!tableProps.metadata) return\n Storage?.set(tableId, (prev) => ({ ...prev, ...tableProps.metadata }))\n }, [tableProps.metadata])\n\n return (\n <TableServerSide\n {...tableProps}\n onTableUpdate={handleTableChange}\n config={configurationWithAdjustedSorting}\n />\n )\n}\n"],"names":["TableSessionStorage","useEffect","useMemo","defaultPagingState","TableServerSide","getTableServerSidePersistentState","id","Storage","Instance","get","TableServerSidePersistent","tableId","config","onTableUpdate","tableProps","savedTable","paging","sorting","default","configurationWithAdjustedSorting","handleTableChange","tableState","set","metadata","prev"],"mappings":"0zEAIA,QAAwBA,mBAAmB,KAAQ,uCAAuC,AAC1F,QAASC,SAAS,CAAEC,OAAO,KAAQ,OAAO,AAC1C,QAASC,kBAAkB,KAAQ,iBAAiB,AACpD,QAASC,eAAe,KAA+B,UAAU,AAQjE,QAAO,SAASC,kCACdC,EAAU,CACVC,QAAUP,oBAAoBQ,QAAQ,EAAE,EAExC,OAAOD,QAAQE,GAAG,CAACH,GACrB,CAcA,OAAO,SAASI,0BAAqC,EAMR,KANQ,CACnDH,QAAUP,oBAAoBQ,QAAQ,EAAE,CACxCG,OAAO,CACPC,MAAM,CACNC,aAAa,CAE8B,IADxCC,yFAEH,MAAMC,WAAab,QACjB,IACEK,QAAQE,GAAG,CAACE,UAAY,CACtBK,OAAQb,mBACRc,QAASL,OAAOK,OAAO,CAACC,OAAO,AACjC,EACF,CAACP,QAAQ,EAGX,MAAMQ,iCAAmC,uCACpCP,SACHK,QAAS,CACPC,QAASH,WAAWE,OAAO,AAC7B,IAEF,MAAMG,kBAAoB,AAACC,aACzBd,gBAAAA,wBAAAA,QAASe,GAAG,CAACX,QAAS,IAAMU,YAC5BR,sBAAAA,8BAAAA,cAAgBQ,WAClB,EAEApB,UAAU,KACR,GAAI,CAACa,WAAWS,QAAQ,CAAE,OAC1BhB,gBAAAA,wBAAAA,QAASe,GAAG,CAACX,QAAS,AAACa,MAAU,kBAAKA,KAASV,WAAWS,QAAQ,EACpE,EAAG,CAACT,WAAWS,QAAQ,CAAC,EAExB,OACE,KAACnB,uDACKU,aACJD,cAAeO,kBACfR,OAAQO,mCAGd"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target=
|
|
1
|
+
function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{ActionIcon,Menu}from"@mantine/core";import{MoreVertical}from"lucide-react";import{useCallback,useMemo}from"react";import{Tooltip}from"../../../Tooltip";import classes from"./ActionMenu.module.css";function getLabel(label,tableProps){if(typeof label==="function"){return label(tableProps)}return label}function createWiredActionMenuComponent({setMenuState,menuState,items,setModalOpen}){return({tableProps,menuProps,actionIcon})=>{const getOwnMenuState=useMemo(()=>menuState[tableProps.id],[menuState]);const dispatchLoading=(label,isLoading)=>setMenuState({type:"SET_LOADING",payload:{id:tableProps.id,loading:{label,isLoading}}});const dispatchOpen=open=>setMenuState({type:"SET_OPEN",payload:{id:tableProps.id,state:{open}}});const handleItemClick=item=>{var _item_modal,_item_action;return item.modal?setModalOpen((_item_modal=item.modal)===null||_item_modal===void 0?void 0:_item_modal.id,tableProps)():(_item_action=item.action)===null||_item_action===void 0?void 0:_item_action.call(item,tableProps,{setLoading:setLoading(item)})};const getTooltipText=item=>{var _item_tooltip_customText,_item_tooltip,_item_tooltip1;return((_item_tooltip=item.tooltip)===null||_item_tooltip===void 0?void 0:(_item_tooltip_customText=_item_tooltip.customText)===null||_item_tooltip_customText===void 0?void 0:_item_tooltip_customText.call(_item_tooltip,tableProps))?(_item_tooltip1=item.tooltip)===null||_item_tooltip1===void 0?void 0:_item_tooltip1.customText(tableProps):getLabel(item.label,tableProps)};const getIsMenuItemDisabled=item=>{var _getOwnMenuState_loading,_item_disabled;return(getOwnMenuState===null||getOwnMenuState===void 0?void 0:(_getOwnMenuState_loading=getOwnMenuState.loading)===null||_getOwnMenuState_loading===void 0?void 0:_getOwnMenuState_loading.includes(item.id))||((_item_disabled=item.disabled)===null||_item_disabled===void 0?void 0:_item_disabled.call(item,tableProps))};const getIcon=item=>typeof item.icon==="function"?_jsx(item.icon,_object_spread({},tableProps)):item.icon;const setLoading=useCallback(item=>value=>{dispatchLoading(item.id,value)},[menuState]);if(items.length<=2){return _jsx("span",{className:classes["icon-container"],children:items.map(item=>{var _item_hidden;if((_item_hidden=item.hidden)===null||_item_hidden===void 0?void 0:_item_hidden.call(item,tableProps))return null;return _jsx(Tooltip,{label:getTooltipText(item),children:_jsx("span",{children:_jsx(ActionIcon,{className:classes.icon,disabled:getIsMenuItemDisabled(item),onClick:()=>handleItemClick(item),children:_jsx("span",{children:getIcon(item)})},item.id)})},item.id)})})}return _jsx(ActionMenu,_object_spread_props(_object_spread({actionIcon:actionIcon,opened:getOwnMenuState===null||getOwnMenuState===void 0?void 0:getOwnMenuState.open,onOpen:()=>dispatchOpen(true),onClose:()=>dispatchOpen(false)},menuProps),{children:_jsx(_Fragment,{children:items.map(item=>{var _item_hidden,_item_tooltip_showInMenu,_item_tooltip;if((_item_hidden=item.hidden)===null||_item_hidden===void 0?void 0:_item_hidden.call(item,tableProps))return null;return _jsx(Tooltip,{label:getTooltipText(item),disabled:!((_item_tooltip=item.tooltip)===null||_item_tooltip===void 0?void 0:(_item_tooltip_showInMenu=_item_tooltip.showInMenu)===null||_item_tooltip_showInMenu===void 0?void 0:_item_tooltip_showInMenu.call(_item_tooltip,tableProps)),children:_jsx("span",{children:_jsx(Menu.Item,{className:classes.item,disabled:getIsMenuItemDisabled(item),onClick:()=>handleItemClick(item),leftSection:getIcon(item),children:getLabel(item.label,tableProps)},item.id)})},item.id)})})}))}}const ActionMenu=_0=>{let{actionIcon,children}=_0,menuProps=_object_without_properties(_0,["actionIcon","children"]);return _jsx("div",{className:classes["action-container"],"data-testid":"table-action-menu",children:_jsxs(Menu,_object_spread_props(_object_spread({shadow:"md",width:180},menuProps),{children:[_jsx(Menu.Target,{children:_jsx(ActionIcon,{"data-testid":"table-action-menu-opener",className:classes.icon,children:actionIcon||_jsx(MoreVertical,{})})}),_jsx(Menu.Dropdown,{children:children})]}))})};export{createWiredActionMenuComponent,ActionMenu};
|
|
2
2
|
//# sourceMappingURL=ActionMenu.js.map
|