@greenbone/ui-lib 2.1.1-alpha0 → 2.1.1

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.
Files changed (165) hide show
  1. package/lib/cjs/components/Accordion/Accordion.js +1 -1
  2. package/lib/cjs/components/Accordion/Accordion.js.map +1 -1
  3. package/lib/cjs/components/Alert/Alert.js +1 -1
  4. package/lib/cjs/components/Alert/Alert.js.map +1 -1
  5. package/lib/cjs/components/ConfirmationDialog/ConfirmationDialog.js +1 -1
  6. package/lib/cjs/components/ConfirmationDialog/ConfirmationDialog.js.map +1 -1
  7. package/lib/cjs/components/Drawer/Drawer.js +1 -1
  8. package/lib/cjs/components/Drawer/Drawer.js.map +1 -1
  9. package/lib/cjs/components/Filter/TermContainer/Term/TermBadge.js +1 -1
  10. package/lib/cjs/components/Filter/TermContainer/Term/TermBadge.js.map +1 -1
  11. package/lib/cjs/components/Filter/persistence/FilterPersistent.js +1 -1
  12. package/lib/cjs/components/Filter/persistence/FilterPersistent.js.map +1 -1
  13. package/lib/cjs/components/Filter/utils/FilterSelect.js +1 -1
  14. package/lib/cjs/components/Filter/utils/FilterSelect.js.map +1 -1
  15. package/lib/cjs/components/Filter/utils/Select.js +1 -1
  16. package/lib/cjs/components/Filter/utils/Select.js.map +1 -1
  17. package/lib/cjs/components/Form/Button/Button.js +1 -1
  18. package/lib/cjs/components/Form/Button/Button.js.map +1 -1
  19. package/lib/cjs/components/Form/Checkbox/Checkbox.js +1 -1
  20. package/lib/cjs/components/Form/Checkbox/Checkbox.js.map +1 -1
  21. package/lib/cjs/components/Form/DateTimePicker/DateTimePicker.js +1 -1
  22. package/lib/cjs/components/Form/DateTimePicker/DateTimePicker.js.map +1 -1
  23. package/lib/cjs/components/Form/DateTimePicker/TimePicker.js +1 -1
  24. package/lib/cjs/components/Form/DateTimePicker/TimePicker.js.map +1 -1
  25. package/lib/cjs/components/Form/FileInput/FileInput.js +1 -1
  26. package/lib/cjs/components/Form/FileInput/FileInput.js.map +1 -1
  27. package/lib/cjs/components/Form/Form/Form.js +1 -1
  28. package/lib/cjs/components/Form/Form/Form.js.map +1 -1
  29. package/lib/cjs/components/Form/Input/Input.js +1 -1
  30. package/lib/cjs/components/Form/Input/Input.js.map +1 -1
  31. package/lib/cjs/components/Form/MenuButton/index.js +1 -1
  32. package/lib/cjs/components/Form/MenuButton/index.js.map +1 -1
  33. package/lib/cjs/components/Form/PasswordInput/PasswordInput.js +1 -1
  34. package/lib/cjs/components/Form/PasswordInput/PasswordInput.js.map +1 -1
  35. package/lib/cjs/components/Form/RadioButton/RadioButton.js +1 -1
  36. package/lib/cjs/components/Form/RadioButton/RadioButton.js.map +1 -1
  37. package/lib/cjs/components/Form/Select/Cascade/CascadeMenu.js +1 -1
  38. package/lib/cjs/components/Form/Select/Cascade/CascadeMenu.js.map +1 -1
  39. package/lib/cjs/components/Form/Select/Cascade/CascadeOption.js +1 -1
  40. package/lib/cjs/components/Form/Select/Cascade/CascadeOption.js.map +1 -1
  41. package/lib/cjs/components/Form/Select/Cascade/index.js +1 -1
  42. package/lib/cjs/components/Form/Select/Cascade/index.js.map +1 -1
  43. package/lib/cjs/components/Form/Select/CreatableSelect.js +1 -1
  44. package/lib/cjs/components/Form/Select/CreatableSelect.js.map +1 -1
  45. package/lib/cjs/components/Form/Select/Select.js +1 -1
  46. package/lib/cjs/components/Form/Select/Select.js.map +1 -1
  47. package/lib/cjs/components/Form/Switch/Switch.js +1 -1
  48. package/lib/cjs/components/Form/Switch/Switch.js.map +1 -1
  49. package/lib/cjs/components/Form/Textarea/Textarea.js +1 -1
  50. package/lib/cjs/components/Form/Textarea/Textarea.js.map +1 -1
  51. package/lib/cjs/components/Icon/Icon.js +1 -1
  52. package/lib/cjs/components/Icon/Icon.js.map +1 -1
  53. package/lib/cjs/components/InfoTip/InfoTip.js +1 -1
  54. package/lib/cjs/components/InfoTip/InfoTip.js.map +1 -1
  55. package/lib/cjs/components/InformationList/InformationList.js +1 -1
  56. package/lib/cjs/components/InformationList/InformationList.js.map +1 -1
  57. package/lib/cjs/components/Layout/AppNavigation/AppNavigationLink.js +1 -1
  58. package/lib/cjs/components/Layout/AppNavigation/AppNavigationLink.js.map +1 -1
  59. package/lib/cjs/components/Layout/SimplePageLayout/SimpleGrid.js +1 -1
  60. package/lib/cjs/components/Layout/SimplePageLayout/SimpleGrid.js.map +1 -1
  61. package/lib/cjs/components/Layout/SimplePageLayout/index.js +1 -1
  62. package/lib/cjs/components/Layout/SimplePageLayout/index.js.map +1 -1
  63. package/lib/cjs/components/Modal/Modal.js +1 -1
  64. package/lib/cjs/components/Modal/Modal.js.map +1 -1
  65. package/lib/cjs/components/Notification/notifications.js +1 -1
  66. package/lib/cjs/components/Notification/notifications.js.map +1 -1
  67. package/lib/cjs/components/Table/TableClientSide/TableClientSidePersistent/index.js +1 -1
  68. package/lib/cjs/components/Table/TableClientSide/TableClientSidePersistent/index.js.map +1 -1
  69. package/lib/cjs/components/Table/TableServerSide/TableServerSidePersistent/index.js +1 -1
  70. package/lib/cjs/components/Table/TableServerSide/TableServerSidePersistent/index.js.map +1 -1
  71. package/lib/cjs/components/Table/components/ActionMenu/ActionMenu.js +1 -1
  72. package/lib/cjs/components/Table/components/ActionMenu/ActionMenu.js.map +1 -1
  73. package/lib/cjs/components/Tag/Tag.js +1 -1
  74. package/lib/cjs/components/Tag/Tag.js.map +1 -1
  75. package/lib/cjs/components/TimeZoneInfo/index.js +1 -1
  76. package/lib/cjs/components/TimeZoneInfo/index.js.map +1 -1
  77. package/lib/cjs/components/Tooltip/Tooltip.js +1 -1
  78. package/lib/cjs/components/Tooltip/Tooltip.js.map +1 -1
  79. package/lib/cjs/components/Typo/Typo.js +1 -1
  80. package/lib/cjs/components/Typo/Typo.js.map +1 -1
  81. package/lib/cjs/icons/StatusIcon/StatusIcon.js +1 -1
  82. package/lib/cjs/icons/StatusIcon/StatusIcon.js.map +1 -1
  83. package/lib/esm/components/Accordion/Accordion.js +1 -1
  84. package/lib/esm/components/Accordion/Accordion.js.map +1 -1
  85. package/lib/esm/components/Alert/Alert.js +1 -1
  86. package/lib/esm/components/Alert/Alert.js.map +1 -1
  87. package/lib/esm/components/ConfirmationDialog/ConfirmationDialog.js +1 -1
  88. package/lib/esm/components/ConfirmationDialog/ConfirmationDialog.js.map +1 -1
  89. package/lib/esm/components/Drawer/Drawer.js +1 -1
  90. package/lib/esm/components/Drawer/Drawer.js.map +1 -1
  91. package/lib/esm/components/Filter/TermContainer/Term/TermBadge.js +1 -1
  92. package/lib/esm/components/Filter/TermContainer/Term/TermBadge.js.map +1 -1
  93. package/lib/esm/components/Filter/persistence/FilterPersistent.js +1 -1
  94. package/lib/esm/components/Filter/persistence/FilterPersistent.js.map +1 -1
  95. package/lib/esm/components/Filter/utils/FilterSelect.js +1 -1
  96. package/lib/esm/components/Filter/utils/FilterSelect.js.map +1 -1
  97. package/lib/esm/components/Filter/utils/Select.js +1 -1
  98. package/lib/esm/components/Filter/utils/Select.js.map +1 -1
  99. package/lib/esm/components/Form/Button/Button.js +1 -1
  100. package/lib/esm/components/Form/Button/Button.js.map +1 -1
  101. package/lib/esm/components/Form/Checkbox/Checkbox.js +1 -1
  102. package/lib/esm/components/Form/Checkbox/Checkbox.js.map +1 -1
  103. package/lib/esm/components/Form/DateTimePicker/DateTimePicker.js +1 -1
  104. package/lib/esm/components/Form/DateTimePicker/DateTimePicker.js.map +1 -1
  105. package/lib/esm/components/Form/DateTimePicker/TimePicker.js +1 -1
  106. package/lib/esm/components/Form/DateTimePicker/TimePicker.js.map +1 -1
  107. package/lib/esm/components/Form/FileInput/FileInput.js +1 -1
  108. package/lib/esm/components/Form/FileInput/FileInput.js.map +1 -1
  109. package/lib/esm/components/Form/Form/Form.js +1 -1
  110. package/lib/esm/components/Form/Form/Form.js.map +1 -1
  111. package/lib/esm/components/Form/Input/Input.js +1 -1
  112. package/lib/esm/components/Form/Input/Input.js.map +1 -1
  113. package/lib/esm/components/Form/MenuButton/index.js +1 -1
  114. package/lib/esm/components/Form/MenuButton/index.js.map +1 -1
  115. package/lib/esm/components/Form/PasswordInput/PasswordInput.js +1 -1
  116. package/lib/esm/components/Form/PasswordInput/PasswordInput.js.map +1 -1
  117. package/lib/esm/components/Form/RadioButton/RadioButton.js +1 -1
  118. package/lib/esm/components/Form/RadioButton/RadioButton.js.map +1 -1
  119. package/lib/esm/components/Form/Select/Cascade/CascadeMenu.js +1 -1
  120. package/lib/esm/components/Form/Select/Cascade/CascadeMenu.js.map +1 -1
  121. package/lib/esm/components/Form/Select/Cascade/CascadeOption.js +1 -1
  122. package/lib/esm/components/Form/Select/Cascade/CascadeOption.js.map +1 -1
  123. package/lib/esm/components/Form/Select/Cascade/index.js +1 -1
  124. package/lib/esm/components/Form/Select/Cascade/index.js.map +1 -1
  125. package/lib/esm/components/Form/Select/CreatableSelect.js +1 -1
  126. package/lib/esm/components/Form/Select/CreatableSelect.js.map +1 -1
  127. package/lib/esm/components/Form/Select/Select.js +1 -1
  128. package/lib/esm/components/Form/Select/Select.js.map +1 -1
  129. package/lib/esm/components/Form/Switch/Switch.js +1 -1
  130. package/lib/esm/components/Form/Switch/Switch.js.map +1 -1
  131. package/lib/esm/components/Form/Textarea/Textarea.js +1 -1
  132. package/lib/esm/components/Form/Textarea/Textarea.js.map +1 -1
  133. package/lib/esm/components/Icon/Icon.js +1 -1
  134. package/lib/esm/components/Icon/Icon.js.map +1 -1
  135. package/lib/esm/components/InfoTip/InfoTip.js +1 -1
  136. package/lib/esm/components/InfoTip/InfoTip.js.map +1 -1
  137. package/lib/esm/components/InformationList/InformationList.js +1 -1
  138. package/lib/esm/components/InformationList/InformationList.js.map +1 -1
  139. package/lib/esm/components/Layout/AppNavigation/AppNavigationLink.js +1 -1
  140. package/lib/esm/components/Layout/AppNavigation/AppNavigationLink.js.map +1 -1
  141. package/lib/esm/components/Layout/SimplePageLayout/SimpleGrid.js +1 -1
  142. package/lib/esm/components/Layout/SimplePageLayout/SimpleGrid.js.map +1 -1
  143. package/lib/esm/components/Layout/SimplePageLayout/index.js +1 -1
  144. package/lib/esm/components/Layout/SimplePageLayout/index.js.map +1 -1
  145. package/lib/esm/components/Modal/Modal.js +1 -1
  146. package/lib/esm/components/Modal/Modal.js.map +1 -1
  147. package/lib/esm/components/Notification/notifications.js +1 -1
  148. package/lib/esm/components/Notification/notifications.js.map +1 -1
  149. package/lib/esm/components/Table/TableClientSide/TableClientSidePersistent/index.js +1 -1
  150. package/lib/esm/components/Table/TableClientSide/TableClientSidePersistent/index.js.map +1 -1
  151. package/lib/esm/components/Table/TableServerSide/TableServerSidePersistent/index.js +1 -1
  152. package/lib/esm/components/Table/TableServerSide/TableServerSidePersistent/index.js.map +1 -1
  153. package/lib/esm/components/Table/components/ActionMenu/ActionMenu.js +1 -1
  154. package/lib/esm/components/Table/components/ActionMenu/ActionMenu.js.map +1 -1
  155. package/lib/esm/components/Tag/Tag.js +1 -1
  156. package/lib/esm/components/Tag/Tag.js.map +1 -1
  157. package/lib/esm/components/TimeZoneInfo/index.js +1 -1
  158. package/lib/esm/components/TimeZoneInfo/index.js.map +1 -1
  159. package/lib/esm/components/Tooltip/Tooltip.js +1 -1
  160. package/lib/esm/components/Tooltip/Tooltip.js.map +1 -1
  161. package/lib/esm/components/Typo/Typo.js +1 -1
  162. package/lib/esm/components/Typo/Typo.js.map +1 -1
  163. package/lib/esm/icons/StatusIcon/StatusIcon.js +1 -1
  164. package/lib/esm/icons/StatusIcon/StatusIcon.js.map +1 -1
  165. package/package.json +22 -22
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Typo",{enumerable:true,get:function(){return Typo}});const _jsxruntime=require("react/jsx-runtime");const _react=require("react");const _core=require("@mantine/core");const _Typomodulecss=/*#__PURE__*/_interop_require_default(require("./Typo.module.css"));const _cx=require("../../helper/cx");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 _interop_require_default(obj){return obj&&obj.__esModule?obj:{default: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}const Typo=(0,_react.forwardRef)((_0,_1)=>{let _ref=[_0,_1],[_ref1,..._rest]=_ref,{className,children,type,withWrapper=false,innerRef,isLink=false,inheritColor=false,underline=false,wrapperProps}=_ref1,props=_object_without_properties(_ref1,["className","children","type","withWrapper","innerRef","isLink","inheritColor","underline","wrapperProps"]),[ref]=_rest;const rootType=isLink?"link":inheritColor?"inherit-color":"";let content=(0,_jsxruntime.jsx)(_core.Text,_object_spread_props(_object_spread({className:(0,_cx.cx)(_Typomodulecss.default.root,_Typomodulecss.default[`${rootType}-root`],underline?_Typomodulecss.default.underline:undefined,isLink?"":_Typomodulecss.default["cursor-text"],className,_Typomodulecss.default[type]),ref:innerRef},props),{children:children}));if(type.includes("heading")){const headingOrder=Number(type.slice(-1));content=(0,_jsxruntime.jsx)(_core.Title,{className:(0,_cx.cx)(_Typomodulecss.default.root,_Typomodulecss.default[`${rootType}-root`],className,_Typomodulecss.default[type]),order:headingOrder,ref:ref,children:content})}else if(withWrapper){return(0,_jsxruntime.jsx)("span",{ref:ref,className:(wrapperProps===null||wrapperProps===void 0?void 0:wrapperProps.noFullWidth)?"":_Typomodulecss.default.wrapper,children:content})}return content});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Typo",{enumerable:true,get:function(){return Typo}});const _jsxruntime=require("react/jsx-runtime");const _react=require("react");const _core=require("@mantine/core");const _Typomodulecss=/*#__PURE__*/_interop_require_default(require("./Typo.module.css"));const _cx=require("../../helper/cx");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 _interop_require_default(obj){return obj&&obj.__esModule?obj:{default: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(Object(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}const Typo=(0,_react.forwardRef)((_0,_1)=>{let _ref=[_0,_1],[_ref1,..._rest]=_ref,{className,children,type,withWrapper=false,innerRef,isLink=false,inheritColor=false,underline=false,wrapperProps}=_ref1,props=_object_without_properties(_ref1,["className","children","type","withWrapper","innerRef","isLink","inheritColor","underline","wrapperProps"]),[ref]=_rest;const rootType=isLink?"link":inheritColor?"inherit-color":"";let content=(0,_jsxruntime.jsx)(_core.Text,_object_spread_props(_object_spread({className:(0,_cx.cx)(_Typomodulecss.default.root,_Typomodulecss.default[`${rootType}-root`],underline?_Typomodulecss.default.underline:undefined,isLink?"":_Typomodulecss.default["cursor-text"],className,_Typomodulecss.default[type]),ref:innerRef},props),{children:children}));if(type.includes("heading")){const headingOrder=Number(type.slice(-1));content=(0,_jsxruntime.jsx)(_core.Title,{className:(0,_cx.cx)(_Typomodulecss.default.root,_Typomodulecss.default[`${rootType}-root`],className,_Typomodulecss.default[type]),order:headingOrder,ref:ref,children:content})}else if(withWrapper){return(0,_jsxruntime.jsx)("span",{ref:ref,className:(wrapperProps===null||wrapperProps===void 0?void 0:wrapperProps.noFullWidth)?"":_Typomodulecss.default.wrapper,children:content})}return content});
2
2
  //# sourceMappingURL=Typo.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Typo/Typo.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { forwardRef, MouseEventHandler, PropsWithChildren, RefObject } from \"react\"\nimport { Text, TextProps, Title, TitleOrder } from \"@mantine/core\"\nimport classes from \"./Typo.module.css\"\nimport { cx } from \"../../helper/cx\"\n\nexport type TTypoTypeProps =\n | \"heading1\"\n | \"heading2\"\n | \"heading3\"\n | \"heading4\"\n | \"bodyLarge\"\n | \"body\"\n | \"small\"\n | \"extraSmall\"\n\nexport type TTypoProps = TextProps & {\n className?: string\n isLink?: boolean\n inheritColor?: boolean\n underline?: boolean\n innerRef?: RefObject<HTMLHeadingElement>\n onMouseEnter?: MouseEventHandler\n onMouseLeave?: MouseEventHandler\n type: TTypoTypeProps\n // The Wrapper is needed for the TextWithTooltip component to correctly truncate the text if needed and display a tooltip\n withWrapper?: boolean\n wrapperProps?: {\n noFullWidth?: boolean\n }\n}\n\n// eslint-disable-next-line react/display-name\nconst Typo = forwardRef<HTMLHeadingElement, PropsWithChildren<TTypoProps>>(\n (\n {\n className,\n children,\n type,\n withWrapper = false,\n innerRef,\n isLink = false,\n inheritColor = false,\n underline = false,\n wrapperProps,\n ...props\n },\n ref\n ) => {\n const rootType = isLink ? \"link\" : inheritColor ? \"inherit-color\" : \"\"\n\n let content = (\n <Text\n className={cx(\n classes.root,\n classes[`${rootType}-root`],\n underline ? classes.underline : undefined,\n isLink ? \"\" : classes[\"cursor-text\"],\n className,\n classes[type]\n )}\n ref={innerRef}\n {...props}\n >\n {children}\n </Text>\n )\n if (type.includes(\"heading\")) {\n const headingOrder = Number(type.slice(-1)) as TitleOrder\n content = (\n <Title\n className={cx(classes.root, classes[`${rootType}-root`], className, classes[type])}\n order={headingOrder}\n ref={ref}\n >\n {content}\n </Title>\n )\n } else if (withWrapper) {\n return (\n <span ref={ref} className={wrapperProps?.noFullWidth ? \"\" : classes.wrapper}>\n {content}\n </span>\n )\n }\n return content\n }\n)\n\nexport { Typo }\n"],"names":["Typo","forwardRef","className","children","type","withWrapper","innerRef","isLink","inheritColor","underline","wrapperProps","props","ref","rootType","content","Text","cx","classes","root","undefined","includes","headingOrder","Number","slice","Title","order","span","noFullWidth","wrapper"],"mappings":"oGA4FSA,8CAAAA,4EAxFmE,6BACzB,oFAC/B,wCACD,u3EA6BnB,MAAMA,KAAOC,GAAAA,iBAAU,EACrB,iDACE,CACEC,SAAS,CACTC,QAAQ,CACRC,IAAI,CACJC,YAAc,KAAK,CACnBC,QAAQ,CACRC,OAAS,KAAK,CACdC,aAAe,KAAK,CACpBC,UAAY,KAAK,CACjBC,YAAY,CAEb,OADIC,qJAELC,WAEA,MAAMC,SAAWN,OAAS,OAASC,aAAe,gBAAkB,GAEpE,IAAIM,QACF,oBAACC,UAAI,sCACHb,UAAWc,GAAAA,MAAE,EACXC,sBAAO,CAACC,IAAI,CACZD,sBAAO,CAAC,CAAC,EAAEJ,SAAS,KAAK,CAAC,CAAC,CAC3BJ,UAAYQ,sBAAO,CAACR,SAAS,CAAGU,UAChCZ,OAAS,GAAKU,sBAAO,CAAC,cAAc,CACpCf,UACAe,sBAAO,CAACb,KAAK,EAEfQ,IAAKN,UACDK,iBAEHR,YAGL,GAAIC,KAAKgB,QAAQ,CAAC,WAAY,CAC5B,MAAMC,aAAeC,OAAOlB,KAAKmB,KAAK,CAAC,CAAC,IACxCT,QACE,oBAACU,WAAK,EACJtB,UAAWc,GAAAA,MAAE,EAACC,sBAAO,CAACC,IAAI,CAAED,sBAAO,CAAC,CAAC,EAAEJ,SAAS,KAAK,CAAC,CAAC,CAAEX,UAAWe,sBAAO,CAACb,KAAK,EACjFqB,MAAOJ,aACPT,IAAKA,aAEJE,SAGP,MAAO,GAAIT,YAAa,CACtB,MACE,oBAACqB,QAAKd,IAAKA,IAAKV,UAAWQ,CAAAA,qBAAAA,6BAAAA,aAAciB,WAAW,EAAG,GAAKV,sBAAO,CAACW,OAAO,UACxEd,SAGP,CACA,OAAOA,OACT"}
1
+ {"version":3,"sources":["../../../../src/components/Typo/Typo.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { forwardRef, MouseEventHandler, PropsWithChildren, RefObject } from \"react\"\nimport { Text, TextProps, Title, TitleOrder } from \"@mantine/core\"\nimport classes from \"./Typo.module.css\"\nimport { cx } from \"../../helper/cx\"\n\nexport type TTypoTypeProps =\n | \"heading1\"\n | \"heading2\"\n | \"heading3\"\n | \"heading4\"\n | \"bodyLarge\"\n | \"body\"\n | \"small\"\n | \"extraSmall\"\n\nexport type TTypoProps = TextProps & {\n className?: string\n isLink?: boolean\n inheritColor?: boolean\n underline?: boolean\n innerRef?: RefObject<HTMLHeadingElement>\n onMouseEnter?: MouseEventHandler\n onMouseLeave?: MouseEventHandler\n type: TTypoTypeProps\n // The Wrapper is needed for the TextWithTooltip component to correctly truncate the text if needed and display a tooltip\n withWrapper?: boolean\n wrapperProps?: {\n noFullWidth?: boolean\n }\n}\n\n// eslint-disable-next-line react/display-name\nconst Typo = forwardRef<HTMLHeadingElement, PropsWithChildren<TTypoProps>>(\n (\n {\n className,\n children,\n type,\n withWrapper = false,\n innerRef,\n isLink = false,\n inheritColor = false,\n underline = false,\n wrapperProps,\n ...props\n },\n ref\n ) => {\n const rootType = isLink ? \"link\" : inheritColor ? \"inherit-color\" : \"\"\n\n let content = (\n <Text\n className={cx(\n classes.root,\n classes[`${rootType}-root`],\n underline ? classes.underline : undefined,\n isLink ? \"\" : classes[\"cursor-text\"],\n className,\n classes[type]\n )}\n ref={innerRef}\n {...props}\n >\n {children}\n </Text>\n )\n if (type.includes(\"heading\")) {\n const headingOrder = Number(type.slice(-1)) as TitleOrder\n content = (\n <Title\n className={cx(classes.root, classes[`${rootType}-root`], className, classes[type])}\n order={headingOrder}\n ref={ref}\n >\n {content}\n </Title>\n )\n } else if (withWrapper) {\n return (\n <span ref={ref} className={wrapperProps?.noFullWidth ? \"\" : classes.wrapper}>\n {content}\n </span>\n )\n }\n return content\n }\n)\n\nexport { Typo }\n"],"names":["Typo","forwardRef","className","children","type","withWrapper","innerRef","isLink","inheritColor","underline","wrapperProps","props","ref","rootType","content","Text","cx","classes","root","undefined","includes","headingOrder","Number","slice","Title","order","span","noFullWidth","wrapper"],"mappings":"oGA4FSA,8CAAAA,4EAxFmE,6BACzB,oFAC/B,wCACD,+3EA6BnB,MAAMA,KAAOC,GAAAA,iBAAU,EACrB,iDACE,CACEC,SAAS,CACTC,QAAQ,CACRC,IAAI,CACJC,YAAc,KAAK,CACnBC,QAAQ,CACRC,OAAS,KAAK,CACdC,aAAe,KAAK,CACpBC,UAAY,KAAK,CACjBC,YAAY,CAEb,OADIC,qJAELC,WAEA,MAAMC,SAAWN,OAAS,OAASC,aAAe,gBAAkB,GAEpE,IAAIM,QACF,oBAACC,UAAI,sCACHb,UAAWc,GAAAA,MAAE,EACXC,sBAAO,CAACC,IAAI,CACZD,sBAAO,CAAC,CAAC,EAAEJ,SAAS,KAAK,CAAC,CAAC,CAC3BJ,UAAYQ,sBAAO,CAACR,SAAS,CAAGU,UAChCZ,OAAS,GAAKU,sBAAO,CAAC,cAAc,CACpCf,UACAe,sBAAO,CAACb,KAAK,EAEfQ,IAAKN,UACDK,iBAEHR,YAGL,GAAIC,KAAKgB,QAAQ,CAAC,WAAY,CAC5B,MAAMC,aAAeC,OAAOlB,KAAKmB,KAAK,CAAC,CAAC,IACxCT,QACE,oBAACU,WAAK,EACJtB,UAAWc,GAAAA,MAAE,EAACC,sBAAO,CAACC,IAAI,CAAED,sBAAO,CAAC,CAAC,EAAEJ,SAAS,KAAK,CAAC,CAAC,CAAEX,UAAWe,sBAAO,CAACb,KAAK,EACjFqB,MAAOJ,aACPT,IAAKA,aAEJE,SAGP,MAAO,GAAIT,YAAa,CACtB,MACE,oBAACqB,QAAKd,IAAKA,IAAKV,UAAWQ,CAAAA,qBAAAA,6BAAAA,aAAciB,WAAW,EAAG,GAAKV,sBAAO,CAACW,OAAO,UACxEd,SAGP,CACA,OAAOA,OACT"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"StatusIcon",{enumerable:true,get:function(){return StatusIcon}});const _jsxruntime=require("react/jsx-runtime");const _lucidereact=require("lucide-react");const _react=require("react");const _StatusIconmodulecss=/*#__PURE__*/_interop_require_default(require("./StatusIcon.module.css"));const _genericTypes=require("../../genericTypes");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 _interop_require_default(obj){return obj&&obj.__esModule?obj:{default: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}const StatusIcon=(0,_react.forwardRef)((_0,_1)=>{let _ref=[_0,_1],[_ref1,..._rest]=_ref,{status}=_ref1,props=_object_without_properties(_ref1,["status"]),[ref]=_rest;let IconComponent;switch(status){case _genericTypes.EStatus.ERROR:IconComponent=_lucidereact.CircleAlert;break;case _genericTypes.EStatus.SUCCESS:IconComponent=_lucidereact.CheckCircle2;break;case _genericTypes.EStatus.INFO:IconComponent=_lucidereact.Info;break;case _genericTypes.EStatus.WARNING:IconComponent=_lucidereact.AlertTriangle;break;default:IconComponent=_lucidereact.Info}return(0,_jsxruntime.jsx)(IconComponent,_object_spread_props(_object_spread({ref:ref,size:16,strokeWidth:2},props),{className:`${_StatusIconmodulecss.default[status||"info-tip"]} ${props.className}`}))});StatusIcon.displayName="StatusIcon";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"StatusIcon",{enumerable:true,get:function(){return StatusIcon}});const _jsxruntime=require("react/jsx-runtime");const _lucidereact=require("lucide-react");const _react=require("react");const _StatusIconmodulecss=/*#__PURE__*/_interop_require_default(require("./StatusIcon.module.css"));const _genericTypes=require("../../genericTypes");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 _interop_require_default(obj){return obj&&obj.__esModule?obj:{default: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(Object(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}const StatusIcon=(0,_react.forwardRef)((_0,_1)=>{let _ref=[_0,_1],[_ref1,..._rest]=_ref,{status}=_ref1,props=_object_without_properties(_ref1,["status"]),[ref]=_rest;let IconComponent;switch(status){case _genericTypes.EStatus.ERROR:IconComponent=_lucidereact.CircleAlert;break;case _genericTypes.EStatus.SUCCESS:IconComponent=_lucidereact.CheckCircle2;break;case _genericTypes.EStatus.INFO:IconComponent=_lucidereact.Info;break;case _genericTypes.EStatus.WARNING:IconComponent=_lucidereact.AlertTriangle;break;default:IconComponent=_lucidereact.Info}return(0,_jsxruntime.jsx)(IconComponent,_object_spread_props(_object_spread({ref:ref,size:16,strokeWidth:2},props),{className:`${_StatusIconmodulecss.default[status||"info-tip"]} ${props.className}`}))});StatusIcon.displayName="StatusIcon";
2
2
  //# sourceMappingURL=StatusIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/icons/StatusIcon/StatusIcon.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { AlertTriangle, CheckCircle2, CircleAlert, Info } from \"lucide-react\"\nimport { LucideProps } from \"lucide-react\"\nimport { forwardRef } from \"react\"\nimport classes from \"./StatusIcon.module.css\"\nimport { EStatus } from \"../../genericTypes\"\n\ntype TStatusIconProps = {\n status?: EStatus\n} & LucideProps\n\nexport const StatusIcon = forwardRef<SVGSVGElement, TStatusIconProps>(\n ({ status, ...props }, ref) => {\n let IconComponent: React.ForwardRefExoticComponent<\n Omit<LucideProps, \"ref\"> & React.RefAttributes<SVGSVGElement>\n >\n switch (status) {\n case EStatus.ERROR:\n IconComponent = CircleAlert\n break\n case EStatus.SUCCESS:\n IconComponent = CheckCircle2\n break\n case EStatus.INFO:\n IconComponent = Info\n break\n case EStatus.WARNING:\n IconComponent = AlertTriangle\n break\n default:\n IconComponent = Info\n }\n return (\n <IconComponent\n ref={ref}\n size={16}\n strokeWidth={2}\n {...props}\n className={`${classes[status || \"info-tip\"]} ${props.className}`}\n />\n )\n }\n)\n\nStatusIcon.displayName = \"StatusIcon\"\n"],"names":["StatusIcon","forwardRef","status","props","ref","IconComponent","EStatus","ERROR","CircleAlert","SUCCESS","CheckCircle2","INFO","Info","WARNING","AlertTriangle","size","strokeWidth","className","classes","displayName"],"mappings":"oGAcaA,oDAAAA,wFAVkD,qCAEpC,kFACP,wDACI,03EAMjB,MAAMA,WAAaC,GAAAA,iBAAU,EAClC,iDAAC,CAAEC,MAAM,CAAY,OAAPC,oDAASC,WACrB,IAAIC,cAGJ,OAAQH,QACN,KAAKI,qBAAO,CAACC,KAAK,CAChBF,cAAgBG,wBAAW,CAC3B,KACF,MAAKF,qBAAO,CAACG,OAAO,CAClBJ,cAAgBK,yBAAY,CAC5B,KACF,MAAKJ,qBAAO,CAACK,IAAI,CACfN,cAAgBO,iBAAI,CACpB,KACF,MAAKN,qBAAO,CAACO,OAAO,CAClBR,cAAgBS,0BAAa,CAC7B,KACF,SACET,cAAgBO,iBAAI,AACxB,CACA,MACE,oBAACP,mDACCD,IAAKA,IACLW,KAAM,GACNC,YAAa,GACTb,QACJc,UAAW,CAAC,EAAEC,4BAAO,CAAChB,QAAU,WAAW,CAAC,CAAC,EAAEC,MAAMc,SAAS,CAAC,CAAC,GAGtE,EAGFjB,CAAAA,WAAWmB,WAAW,CAAG"}
1
+ {"version":3,"sources":["../../../../src/icons/StatusIcon/StatusIcon.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { AlertTriangle, CheckCircle2, CircleAlert, Info } from \"lucide-react\"\nimport { LucideProps } from \"lucide-react\"\nimport { forwardRef } from \"react\"\nimport classes from \"./StatusIcon.module.css\"\nimport { EStatus } from \"../../genericTypes\"\n\ntype TStatusIconProps = {\n status?: EStatus\n} & LucideProps\n\nexport const StatusIcon = forwardRef<SVGSVGElement, TStatusIconProps>(\n ({ status, ...props }, ref) => {\n let IconComponent: React.ForwardRefExoticComponent<\n Omit<LucideProps, \"ref\"> & React.RefAttributes<SVGSVGElement>\n >\n switch (status) {\n case EStatus.ERROR:\n IconComponent = CircleAlert\n break\n case EStatus.SUCCESS:\n IconComponent = CheckCircle2\n break\n case EStatus.INFO:\n IconComponent = Info\n break\n case EStatus.WARNING:\n IconComponent = AlertTriangle\n break\n default:\n IconComponent = Info\n }\n return (\n <IconComponent\n ref={ref}\n size={16}\n strokeWidth={2}\n {...props}\n className={`${classes[status || \"info-tip\"]} ${props.className}`}\n />\n )\n }\n)\n\nStatusIcon.displayName = \"StatusIcon\"\n"],"names":["StatusIcon","forwardRef","status","props","ref","IconComponent","EStatus","ERROR","CircleAlert","SUCCESS","CheckCircle2","INFO","Info","WARNING","AlertTriangle","size","strokeWidth","className","classes","displayName"],"mappings":"oGAcaA,oDAAAA,wFAVkD,qCAEpC,kFACP,wDACI,k4EAMjB,MAAMA,WAAaC,GAAAA,iBAAU,EAClC,iDAAC,CAAEC,MAAM,CAAY,OAAPC,oDAASC,WACrB,IAAIC,cAGJ,OAAQH,QACN,KAAKI,qBAAO,CAACC,KAAK,CAChBF,cAAgBG,wBAAW,CAC3B,KACF,MAAKF,qBAAO,CAACG,OAAO,CAClBJ,cAAgBK,yBAAY,CAC5B,KACF,MAAKJ,qBAAO,CAACK,IAAI,CACfN,cAAgBO,iBAAI,CACpB,KACF,MAAKN,qBAAO,CAACO,OAAO,CAClBR,cAAgBS,0BAAa,CAC7B,KACF,SACET,cAAgBO,iBAAI,AACxB,CACA,MACE,oBAACP,mDACCD,IAAKA,IACLW,KAAM,GACNC,YAAa,GACTb,QACJc,UAAW,CAAC,EAAEC,4BAAO,CAAChB,QAAU,WAAW,CAAC,CAAC,EAAEC,MAAMc,SAAS,CAAC,CAAC,GAGtE,EAGFjB,CAAAA,WAAWmB,WAAW,CAAG"}
@@ -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={},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{Accordion as MantineAccordion}from"@mantine/core";import React from"react";import classes from"./Accordion.module.css";export const AccordionWrapper=_0=>{let{children}=_0,props=_object_without_properties(_0,["children"]);return _jsx(MantineAccordion,_object_spread_props(_object_spread({chevronPosition:"left",variant:"contained"},props),{children:children}))};export const AccordionWrapperMultiple=_0=>{let{children}=_0,props=_object_without_properties(_0,["children"]);return _jsx(MantineAccordion,_object_spread_props(_object_spread({multiple:true,chevronPosition:"left",variant:"contained"},props),{children:children}))};export const AccordionItem=({children,controlContent,itemValue})=>{return _jsxs(MantineAccordion.Item,{value:itemValue,children:[_jsx(MantineAccordion.Control,{component:"div",className:classes.label,children:controlContent}),_jsx(MantineAccordion.Panel,{children:children})]})};
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(Object(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{Accordion as MantineAccordion}from"@mantine/core";import React from"react";import classes from"./Accordion.module.css";export const AccordionWrapper=_0=>{let{children}=_0,props=_object_without_properties(_0,["children"]);return _jsx(MantineAccordion,_object_spread_props(_object_spread({chevronPosition:"left",variant:"contained"},props),{children:children}))};export const AccordionWrapperMultiple=_0=>{let{children}=_0,props=_object_without_properties(_0,["children"]);return _jsx(MantineAccordion,_object_spread_props(_object_spread({multiple:true,chevronPosition:"left",variant:"contained"},props),{children:children}))};export const AccordionItem=({children,controlContent,itemValue})=>{return _jsxs(MantineAccordion.Item,{value:itemValue,children:[_jsx(MantineAccordion.Control,{component:"div",className:classes.label,children:controlContent}),_jsx(MantineAccordion.Panel,{children:children})]})};
2
2
  //# sourceMappingURL=Accordion.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { Accordion as MantineAccordion, AccordionProps } from \"@mantine/core\"\nimport React, { ReactNode } from \"react\"\nimport classes from \"./Accordion.module.css\"\n\n/**\n * Wrapper around Mantine Accordion with default styling.\n * Single-open behavior (use AccordionWrapperMultiple for multi-open).\n * - chevronPosition defaults to \"left\"\n * - variant defaults to \"contained\"\n * @param children AccordionItem elements to render.\n * @param props Mantine Accordion props in single mode:\n * - value | defaultValue: string | null\n * - onChange: (value: string | null) => void\n * - chevronPosition: 'left' | 'right' (default 'left')\n * - variant: 'default' | 'contained' | 'filled' | 'separated' (default 'contained')\n * - className, disabled, id, styles, classNames, etc.\n * Note: 'multiple' is managed internally and not applicable here.\n */\nexport const AccordionWrapper: React.FC<\n {\n children: ReactNode\n } & AccordionProps\n> = ({ children, ...props }) => {\n return (\n <MantineAccordion chevronPosition=\"left\" variant=\"contained\" {...props}>\n {children}\n </MantineAccordion>\n )\n}\n\n/**\n * Wrapper around Mantine Accordion that allows multiple items open.\n * - Sets multiple\n * - chevronPosition defaults to \"left\"\n * - variant defaults to \"contained\"\n * @param children AccordionItem elements to render.\n * @param props Mantine Accordion props in multiple mode:\n * - value | defaultValue: string[]\n * - onChange: (value: string[]) => void\n * - chevronPosition: 'left' | 'right' (default 'left')\n * - variant: 'default' | 'contained' | 'filled' | 'separated' (default 'contained')\n * - className, disabled, id, styles, classNames, etc.\n * Note: 'multiple' is set by this wrapper.\n */\nexport const AccordionWrapperMultiple: React.FC<\n {\n children: ReactNode\n } & AccordionProps<true>\n> = ({ children, ...props }) => {\n return (\n <MantineAccordion multiple chevronPosition=\"left\" variant=\"contained\" {...props}>\n {children}\n </MantineAccordion>\n )\n}\n\n/**\n * Single accordion item composed of a Control and Panel following UI styling.\n * @param controlContent Custom content rendered inside the control header.\n * @param itemValue Unique value used for controlled/uncontrolled state.\n * @param children Content rendered inside the panel.\n */\nexport const AccordionItem: React.FC<{\n children: ReactNode\n itemValue: string\n controlContent?: ReactNode\n}> = ({ children, controlContent, itemValue }) => {\n return (\n <MantineAccordion.Item value={itemValue}>\n <MantineAccordion.Control component=\"div\" className={classes.label}>\n {controlContent}\n </MantineAccordion.Control>\n <MantineAccordion.Panel>{children}</MantineAccordion.Panel>\n </MantineAccordion.Item>\n )\n}\n"],"names":["Accordion","MantineAccordion","React","classes","AccordionWrapper","children","props","chevronPosition","variant","AccordionWrapperMultiple","multiple","AccordionItem","controlContent","itemValue","Item","value","Control","component","className","label","Panel"],"mappings":"w0EAIA,QAASA,aAAaC,gBAAgB,KAAwB,eAAe,AAC7E,QAAOC,UAA0B,OAAO,AACxC,QAAOC,YAAa,wBAAwB,AAgB5C,QAAO,MAAMC,iBAIT,QAAC,CAAEC,QAAQ,CAAY,IAAPC,kDAClB,OACE,KAACL,sDAAiBM,gBAAgB,OAAOC,QAAQ,aAAgBF,iBAC9DD,WAGP,CAAC,AAgBD,QAAO,MAAMI,yBAIT,QAAC,CAAEJ,QAAQ,CAAY,IAAPC,kDAClB,OACE,KAACL,sDAAiBS,QAAQ,MAACH,gBAAgB,OAAOC,QAAQ,aAAgBF,iBACvED,WAGP,CAAC,AAQD,QAAO,MAAMM,cAIR,CAAC,CAAEN,QAAQ,CAAEO,cAAc,CAAEC,SAAS,CAAE,IAC3C,OACE,MAACZ,iBAAiBa,IAAI,EAACC,MAAOF,oBAC5B,KAACZ,iBAAiBe,OAAO,EAACC,UAAU,MAAMC,UAAWf,QAAQgB,KAAK,UAC/DP,iBAEH,KAACX,iBAAiBmB,KAAK,WAAEf,aAG/B,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { Accordion as MantineAccordion, AccordionProps } from \"@mantine/core\"\nimport React, { ReactNode } from \"react\"\nimport classes from \"./Accordion.module.css\"\n\n/**\n * Wrapper around Mantine Accordion with default styling.\n * Single-open behavior (use AccordionWrapperMultiple for multi-open).\n * - chevronPosition defaults to \"left\"\n * - variant defaults to \"contained\"\n * @param children AccordionItem elements to render.\n * @param props Mantine Accordion props in single mode:\n * - value | defaultValue: string | null\n * - onChange: (value: string | null) => void\n * - chevronPosition: 'left' | 'right' (default 'left')\n * - variant: 'default' | 'contained' | 'filled' | 'separated' (default 'contained')\n * - className, disabled, id, styles, classNames, etc.\n * Note: 'multiple' is managed internally and not applicable here.\n */\nexport const AccordionWrapper: React.FC<\n {\n children: ReactNode\n } & AccordionProps\n> = ({ children, ...props }) => {\n return (\n <MantineAccordion chevronPosition=\"left\" variant=\"contained\" {...props}>\n {children}\n </MantineAccordion>\n )\n}\n\n/**\n * Wrapper around Mantine Accordion that allows multiple items open.\n * - Sets multiple\n * - chevronPosition defaults to \"left\"\n * - variant defaults to \"contained\"\n * @param children AccordionItem elements to render.\n * @param props Mantine Accordion props in multiple mode:\n * - value | defaultValue: string[]\n * - onChange: (value: string[]) => void\n * - chevronPosition: 'left' | 'right' (default 'left')\n * - variant: 'default' | 'contained' | 'filled' | 'separated' (default 'contained')\n * - className, disabled, id, styles, classNames, etc.\n * Note: 'multiple' is set by this wrapper.\n */\nexport const AccordionWrapperMultiple: React.FC<\n {\n children: ReactNode\n } & AccordionProps<true>\n> = ({ children, ...props }) => {\n return (\n <MantineAccordion multiple chevronPosition=\"left\" variant=\"contained\" {...props}>\n {children}\n </MantineAccordion>\n )\n}\n\n/**\n * Single accordion item composed of a Control and Panel following UI styling.\n * @param controlContent Custom content rendered inside the control header.\n * @param itemValue Unique value used for controlled/uncontrolled state.\n * @param children Content rendered inside the panel.\n */\nexport const AccordionItem: React.FC<{\n children: ReactNode\n itemValue: string\n controlContent?: ReactNode\n}> = ({ children, controlContent, itemValue }) => {\n return (\n <MantineAccordion.Item value={itemValue}>\n <MantineAccordion.Control component=\"div\" className={classes.label}>\n {controlContent}\n </MantineAccordion.Control>\n <MantineAccordion.Panel>{children}</MantineAccordion.Panel>\n </MantineAccordion.Item>\n )\n}\n"],"names":["Accordion","MantineAccordion","React","classes","AccordionWrapper","children","props","chevronPosition","variant","AccordionWrapperMultiple","multiple","AccordionItem","controlContent","itemValue","Item","value","Control","component","className","label","Panel"],"mappings":"g1EAIA,QAASA,aAAaC,gBAAgB,KAAwB,eAAe,AAC7E,QAAOC,UAA0B,OAAO,AACxC,QAAOC,YAAa,wBAAwB,AAgB5C,QAAO,MAAMC,iBAIT,QAAC,CAAEC,QAAQ,CAAY,IAAPC,kDAClB,OACE,KAACL,sDAAiBM,gBAAgB,OAAOC,QAAQ,aAAgBF,iBAC9DD,WAGP,CAAC,AAgBD,QAAO,MAAMI,yBAIT,QAAC,CAAEJ,QAAQ,CAAY,IAAPC,kDAClB,OACE,KAACL,sDAAiBS,QAAQ,MAACH,gBAAgB,OAAOC,QAAQ,aAAgBF,iBACvED,WAGP,CAAC,AAQD,QAAO,MAAMM,cAIR,CAAC,CAAEN,QAAQ,CAAEO,cAAc,CAAEC,SAAS,CAAE,IAC3C,OACE,MAACZ,iBAAiBa,IAAI,EAACC,MAAOF,oBAC5B,KAACZ,iBAAiBe,OAAO,EAACC,UAAU,MAAMC,UAAWf,QAAQgB,KAAK,UAC/DP,iBAEH,KAACX,iBAAiBmB,KAAK,WAAEf,aAG/B,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={},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{Alert as AlertMantine}from"@mantine/core";import{Button}from"../Form";import{Typo}from"../Typo";import{StatusIcon}from"../../icons";import{useEffect,useState}from"react";import classes from"./Alert.module.css";import{ICON_SIZES}from"../../theme/conventions";const Alert=_0=>{let{type,text,dismissible,defaultButton,filledButton,onClose,width="auto",content,buttonAligned="left",open:_open=true,classNames,title}=_0,alertProps=_object_without_properties(_0,["type","text","dismissible","defaultButton","filledButton","onClose","width","content","buttonAligned","open","classNames","title"]);const[open,setOpen]=useState(_open);const body=text?_jsx(Typo,{type:"body",children:text}):content||null;useEffect(()=>{if(_open!==undefined){setOpen(_open)}},[_open]);const handleClose=()=>{setOpen(false);onClose===null||onClose===void 0?void 0:onClose()};if(!open)return null;return _jsx("div",{children:_jsxs(AlertMantine,_object_spread_props(_object_spread({icon:_jsx(StatusIcon,{size:ICON_SIZES.MEDIUM_LARGE,status:type}),withCloseButton:dismissible,closeButtonLabel:"close",onClose:handleClose,style:{width},classNames:_object_spread({root:classes[`alert-${type}`],closeButton:classes["alert-close-button"],title:classes["alert-title"],icon:classes["alert-icon"],message:classes["alert-message"]},classNames),title:title?_jsx(Typo,{type:"heading3",children:title}):null},alertProps),{children:[body,_jsxs("div",{className:`${classes["alert-button-wrapper"]} ${buttonAligned==="left"?classes["alert-button-wrapper-left"]:classes["alert-button-wrapper-right"]}`,children:[filledButton&&_jsx(Button,_object_spread_props(_object_spread({className:classes["alert-button"],variant:"filled"},filledButton),{onClick:e=>{var _filledButton_onClick;filledButton===null||filledButton===void 0?void 0:(_filledButton_onClick=filledButton.onClick)===null||_filledButton_onClick===void 0?void 0:_filledButton_onClick.call(filledButton,e);if(filledButton===null||filledButton===void 0?void 0:filledButton.closeOnClick)handleClose()}})),defaultButton&&_jsx(Button,_object_spread_props(_object_spread({className:classes["alert-button"],variant:"default"},defaultButton),{onClick:e=>{var _defaultButton_onClick;defaultButton===null||defaultButton===void 0?void 0:(_defaultButton_onClick=defaultButton.onClick)===null||_defaultButton_onClick===void 0?void 0:_defaultButton_onClick.call(defaultButton,e);if(defaultButton===null||defaultButton===void 0?void 0:defaultButton.closeOnClick)handleClose()}}))]})]}))})};export{Alert};
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(Object(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{Alert as AlertMantine}from"@mantine/core";import{Button}from"../Form";import{Typo}from"../Typo";import{StatusIcon}from"../../icons";import{useEffect,useState}from"react";import classes from"./Alert.module.css";import{ICON_SIZES}from"../../theme/conventions";const Alert=_0=>{let{type,text,dismissible,defaultButton,filledButton,onClose,width="auto",content,buttonAligned="left",open:_open=true,classNames,title}=_0,alertProps=_object_without_properties(_0,["type","text","dismissible","defaultButton","filledButton","onClose","width","content","buttonAligned","open","classNames","title"]);const[open,setOpen]=useState(_open);const body=text?_jsx(Typo,{type:"body",children:text}):content||null;useEffect(()=>{if(_open!==undefined){setOpen(_open)}},[_open]);const handleClose=()=>{setOpen(false);onClose===null||onClose===void 0?void 0:onClose()};if(!open)return null;return _jsx("div",{children:_jsxs(AlertMantine,_object_spread_props(_object_spread({icon:_jsx(StatusIcon,{size:ICON_SIZES.MEDIUM_LARGE,status:type}),withCloseButton:dismissible,closeButtonLabel:"close",onClose:handleClose,style:{width},classNames:_object_spread({root:classes[`alert-${type}`],closeButton:classes["alert-close-button"],title:classes["alert-title"],icon:classes["alert-icon"],message:classes["alert-message"]},classNames),title:title?_jsx(Typo,{type:"heading3",children:title}):null},alertProps),{children:[body,_jsxs("div",{className:`${classes["alert-button-wrapper"]} ${buttonAligned==="left"?classes["alert-button-wrapper-left"]:classes["alert-button-wrapper-right"]}`,children:[filledButton&&_jsx(Button,_object_spread_props(_object_spread({className:classes["alert-button"],variant:"filled"},filledButton),{onClick:e=>{var _filledButton_onClick;filledButton===null||filledButton===void 0?void 0:(_filledButton_onClick=filledButton.onClick)===null||_filledButton_onClick===void 0?void 0:_filledButton_onClick.call(filledButton,e);if(filledButton===null||filledButton===void 0?void 0:filledButton.closeOnClick)handleClose()}})),defaultButton&&_jsx(Button,_object_spread_props(_object_spread({className:classes["alert-button"],variant:"default"},defaultButton),{onClick:e=>{var _defaultButton_onClick;defaultButton===null||defaultButton===void 0?void 0:(_defaultButton_onClick=defaultButton.onClick)===null||_defaultButton_onClick===void 0?void 0:_defaultButton_onClick.call(defaultButton,e);if(defaultButton===null||defaultButton===void 0?void 0:defaultButton.closeOnClick)handleClose()}}))]})]}))})};export{Alert};
2
2
  //# sourceMappingURL=Alert.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { Alert as AlertMantine, AlertProps } from \"@mantine/core\"\nimport { Button, TButtonProps } from \"../Form\"\nimport { Typo } from \"../Typo\"\nimport { StatusIcon } from \"../../icons\"\nimport { ReactNode, useEffect, useState } from \"react\"\nimport { EStatus, Modify } from \"../../genericTypes\"\nimport classes from \"./Alert.module.css\"\nimport { ICON_SIZES } from \"../../theme/conventions\"\n\ntype TAlertProps = Modify<\n Partial<AlertProps>,\n {\n type: EStatus\n title?: ReactNode\n text?: string\n content?: ReactNode\n dismissible?: boolean\n defaultButton?: TButtonProps & { closeOnClick?: boolean }\n filledButton?: TButtonProps & { closeOnClick?: boolean }\n onClose?: () => void\n width?: string\n buttonAligned?: \"left\" | \"right\"\n initiallyOpen?: boolean\n open?: boolean\n }\n>\n\n/**\n * Provides an alert with customizable content and buttons\n * @param type Type of the alert based on status of StatusIcons TButtonProps\n * @param text The text to be shown in the alert\n * @param dismissible Controls if the alert should be dismissible\n * @param defaulButton Button component that should be used as default\n * @param filledButton Button component that should be filled\n * @param onClose Callback when alert is closed\n * @param width Width of the alert\n * @param content Component to be included in the alert. If text is defined, this will not be shown.\n * @param buttonAligned Button component to be aligned left or right\n * @param open Controls if alert is open\n * @param title Title of the alert\n * @param classNames Class names for additional styles\n */\nconst Alert: React.FC<TAlertProps> = ({\n type,\n text,\n dismissible,\n defaultButton,\n filledButton,\n onClose,\n width = \"auto\",\n content,\n buttonAligned = \"left\",\n open: _open = true,\n classNames,\n title,\n ...alertProps\n}) => {\n const [open, setOpen] = useState(_open)\n const body = text ? <Typo type=\"body\">{text}</Typo> : content || null\n\n useEffect(() => {\n if (_open !== undefined) {\n setOpen(_open)\n }\n }, [_open])\n\n const handleClose = () => {\n setOpen(false)\n onClose?.()\n }\n\n if (!open) return null\n\n return (\n <div>\n <AlertMantine\n icon={<StatusIcon size={ICON_SIZES.MEDIUM_LARGE} status={type} />}\n withCloseButton={dismissible}\n closeButtonLabel=\"close\"\n onClose={handleClose}\n style={{\n width,\n }}\n classNames={{\n root: classes[`alert-${type}`],\n closeButton: classes[\"alert-close-button\"],\n title: classes[\"alert-title\"],\n icon: classes[\"alert-icon\"],\n message: classes[\"alert-message\"],\n ...classNames,\n }}\n title={title ? <Typo type={\"heading3\"}>{title}</Typo> : null}\n {...alertProps}\n >\n {body}\n <div\n className={`${classes[\"alert-button-wrapper\"]} ${buttonAligned === \"left\" ? classes[\"alert-button-wrapper-left\"] : classes[\"alert-button-wrapper-right\"]}`}\n >\n {filledButton && (\n <Button\n className={classes[\"alert-button\"]}\n variant=\"filled\"\n {...filledButton}\n onClick={(e) => {\n filledButton?.onClick?.(e)\n if (filledButton?.closeOnClick) handleClose()\n }}\n />\n )}\n {defaultButton && (\n <Button\n className={classes[\"alert-button\"]}\n variant=\"default\"\n {...defaultButton}\n onClick={(e) => {\n defaultButton?.onClick?.(e)\n if (defaultButton?.closeOnClick) handleClose()\n }}\n />\n )}\n </div>\n </AlertMantine>\n </div>\n )\n}\n\nexport { Alert }\n"],"names":["Alert","AlertMantine","Button","Typo","StatusIcon","useEffect","useState","classes","ICON_SIZES","type","text","dismissible","defaultButton","filledButton","onClose","width","content","buttonAligned","open","_open","classNames","title","alertProps","setOpen","body","undefined","handleClose","div","icon","size","MEDIUM_LARGE","status","withCloseButton","closeButtonLabel","style","root","closeButton","message","className","variant","onClick","e","closeOnClick"],"mappings":"w0EAIA,QAASA,SAASC,YAAY,KAAoB,eAAe,AACjE,QAASC,MAAM,KAAsB,SAAS,AAC9C,QAASC,IAAI,KAAQ,SAAS,AAC9B,QAASC,UAAU,KAAQ,aAAa,AACxC,QAAoBC,SAAS,CAAEC,QAAQ,KAAQ,OAAO,AAEtD,QAAOC,YAAa,oBAAoB,AACxC,QAASC,UAAU,KAAQ,yBAAyB,CAmCpD,MAAMR,MAA+B,QAAC,CACpCS,IAAI,CACJC,IAAI,CACJC,WAAW,CACXC,aAAa,CACbC,YAAY,CACZC,OAAO,CACPC,MAAQ,MAAM,CACdC,OAAO,CACPC,cAAgB,MAAM,CACtBC,KAAMC,MAAQ,IAAI,CAClBC,UAAU,CACVC,KAAK,CAEN,IADIC,+KAEH,KAAM,CAACJ,KAAMK,QAAQ,CAAGjB,SAASa,OACjC,MAAMK,KAAOd,KAAO,KAACP,MAAKM,KAAK,gBAAQC,OAAeM,SAAW,KAEjEX,UAAU,KACR,GAAIc,QAAUM,UAAW,CACvBF,QAAQJ,MACV,CACF,EAAG,CAACA,MAAM,EAEV,MAAMO,YAAc,KAClBH,QAAQ,OACRT,gBAAAA,wBAAAA,SACF,EAEA,GAAI,CAACI,KAAM,OAAO,KAElB,OACE,KAACS,gBACC,MAAC1B,kDACC2B,KAAM,KAACxB,YAAWyB,KAAMrB,WAAWsB,YAAY,CAAEC,OAAQtB,OACzDuB,gBAAiBrB,YACjBsB,iBAAiB,QACjBnB,QAASY,YACTQ,MAAO,CACLnB,KACF,EACAK,WAAY,gBACVe,KAAM5B,OAAO,CAAC,CAAC,MAAM,EAAEE,KAAK,CAAC,CAAC,CAC9B2B,YAAa7B,OAAO,CAAC,qBAAqB,CAC1Cc,MAAOd,OAAO,CAAC,cAAc,CAC7BqB,KAAMrB,OAAO,CAAC,aAAa,CAC3B8B,QAAS9B,OAAO,CAAC,gBAAgB,EAC9Ba,YAELC,MAAOA,MAAQ,KAAClB,MAAKM,KAAM,oBAAaY,QAAgB,MACpDC,uBAEHE,KACD,MAACG,OACCW,UAAW,CAAC,EAAE/B,OAAO,CAAC,uBAAuB,CAAC,CAAC,EAAEU,gBAAkB,OAASV,OAAO,CAAC,4BAA4B,CAAGA,OAAO,CAAC,6BAA6B,CAAC,CAAC,WAEzJM,cACC,KAACX,4CACCoC,UAAW/B,OAAO,CAAC,eAAe,CAClCgC,QAAQ,UACJ1B,eACJ2B,QAAS,AAACC,QACR5B,sBAAAA,qBAAAA,8BAAAA,sBAAAA,aAAc2B,OAAO,UAArB3B,sCAAAA,2BAAAA,aAAwB4B,GACxB,GAAI5B,qBAAAA,6BAAAA,aAAc6B,YAAY,CAAEhB,aAClC,KAGHd,eACC,KAACV,4CACCoC,UAAW/B,OAAO,CAAC,eAAe,CAClCgC,QAAQ,WACJ3B,gBACJ4B,QAAS,AAACC,QACR7B,uBAAAA,sBAAAA,+BAAAA,uBAAAA,cAAe4B,OAAO,UAAtB5B,uCAAAA,4BAAAA,cAAyB6B,GACzB,GAAI7B,sBAAAA,8BAAAA,cAAe8B,YAAY,CAAEhB,aACnC,aAOd,CAEA,QAAS1B,KAAK,CAAE"}
1
+ {"version":3,"sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { Alert as AlertMantine, AlertProps } from \"@mantine/core\"\nimport { Button, TButtonProps } from \"../Form\"\nimport { Typo } from \"../Typo\"\nimport { StatusIcon } from \"../../icons\"\nimport { ReactNode, useEffect, useState } from \"react\"\nimport { EStatus, Modify } from \"../../genericTypes\"\nimport classes from \"./Alert.module.css\"\nimport { ICON_SIZES } from \"../../theme/conventions\"\n\ntype TAlertProps = Modify<\n Partial<AlertProps>,\n {\n type: EStatus\n title?: ReactNode\n text?: string\n content?: ReactNode\n dismissible?: boolean\n defaultButton?: TButtonProps & { closeOnClick?: boolean }\n filledButton?: TButtonProps & { closeOnClick?: boolean }\n onClose?: () => void\n width?: string\n buttonAligned?: \"left\" | \"right\"\n initiallyOpen?: boolean\n open?: boolean\n }\n>\n\n/**\n * Provides an alert with customizable content and buttons\n * @param type Type of the alert based on status of StatusIcons TButtonProps\n * @param text The text to be shown in the alert\n * @param dismissible Controls if the alert should be dismissible\n * @param defaulButton Button component that should be used as default\n * @param filledButton Button component that should be filled\n * @param onClose Callback when alert is closed\n * @param width Width of the alert\n * @param content Component to be included in the alert. If text is defined, this will not be shown.\n * @param buttonAligned Button component to be aligned left or right\n * @param open Controls if alert is open\n * @param title Title of the alert\n * @param classNames Class names for additional styles\n */\nconst Alert: React.FC<TAlertProps> = ({\n type,\n text,\n dismissible,\n defaultButton,\n filledButton,\n onClose,\n width = \"auto\",\n content,\n buttonAligned = \"left\",\n open: _open = true,\n classNames,\n title,\n ...alertProps\n}) => {\n const [open, setOpen] = useState(_open)\n const body = text ? <Typo type=\"body\">{text}</Typo> : content || null\n\n useEffect(() => {\n if (_open !== undefined) {\n setOpen(_open)\n }\n }, [_open])\n\n const handleClose = () => {\n setOpen(false)\n onClose?.()\n }\n\n if (!open) return null\n\n return (\n <div>\n <AlertMantine\n icon={<StatusIcon size={ICON_SIZES.MEDIUM_LARGE} status={type} />}\n withCloseButton={dismissible}\n closeButtonLabel=\"close\"\n onClose={handleClose}\n style={{\n width,\n }}\n classNames={{\n root: classes[`alert-${type}`],\n closeButton: classes[\"alert-close-button\"],\n title: classes[\"alert-title\"],\n icon: classes[\"alert-icon\"],\n message: classes[\"alert-message\"],\n ...classNames,\n }}\n title={title ? <Typo type={\"heading3\"}>{title}</Typo> : null}\n {...alertProps}\n >\n {body}\n <div\n className={`${classes[\"alert-button-wrapper\"]} ${buttonAligned === \"left\" ? classes[\"alert-button-wrapper-left\"] : classes[\"alert-button-wrapper-right\"]}`}\n >\n {filledButton && (\n <Button\n className={classes[\"alert-button\"]}\n variant=\"filled\"\n {...filledButton}\n onClick={(e) => {\n filledButton?.onClick?.(e)\n if (filledButton?.closeOnClick) handleClose()\n }}\n />\n )}\n {defaultButton && (\n <Button\n className={classes[\"alert-button\"]}\n variant=\"default\"\n {...defaultButton}\n onClick={(e) => {\n defaultButton?.onClick?.(e)\n if (defaultButton?.closeOnClick) handleClose()\n }}\n />\n )}\n </div>\n </AlertMantine>\n </div>\n )\n}\n\nexport { Alert }\n"],"names":["Alert","AlertMantine","Button","Typo","StatusIcon","useEffect","useState","classes","ICON_SIZES","type","text","dismissible","defaultButton","filledButton","onClose","width","content","buttonAligned","open","_open","classNames","title","alertProps","setOpen","body","undefined","handleClose","div","icon","size","MEDIUM_LARGE","status","withCloseButton","closeButtonLabel","style","root","closeButton","message","className","variant","onClick","e","closeOnClick"],"mappings":"g1EAIA,QAASA,SAASC,YAAY,KAAoB,eAAe,AACjE,QAASC,MAAM,KAAsB,SAAS,AAC9C,QAASC,IAAI,KAAQ,SAAS,AAC9B,QAASC,UAAU,KAAQ,aAAa,AACxC,QAAoBC,SAAS,CAAEC,QAAQ,KAAQ,OAAO,AAEtD,QAAOC,YAAa,oBAAoB,AACxC,QAASC,UAAU,KAAQ,yBAAyB,CAmCpD,MAAMR,MAA+B,QAAC,CACpCS,IAAI,CACJC,IAAI,CACJC,WAAW,CACXC,aAAa,CACbC,YAAY,CACZC,OAAO,CACPC,MAAQ,MAAM,CACdC,OAAO,CACPC,cAAgB,MAAM,CACtBC,KAAMC,MAAQ,IAAI,CAClBC,UAAU,CACVC,KAAK,CAEN,IADIC,+KAEH,KAAM,CAACJ,KAAMK,QAAQ,CAAGjB,SAASa,OACjC,MAAMK,KAAOd,KAAO,KAACP,MAAKM,KAAK,gBAAQC,OAAeM,SAAW,KAEjEX,UAAU,KACR,GAAIc,QAAUM,UAAW,CACvBF,QAAQJ,MACV,CACF,EAAG,CAACA,MAAM,EAEV,MAAMO,YAAc,KAClBH,QAAQ,OACRT,gBAAAA,wBAAAA,SACF,EAEA,GAAI,CAACI,KAAM,OAAO,KAElB,OACE,KAACS,gBACC,MAAC1B,kDACC2B,KAAM,KAACxB,YAAWyB,KAAMrB,WAAWsB,YAAY,CAAEC,OAAQtB,OACzDuB,gBAAiBrB,YACjBsB,iBAAiB,QACjBnB,QAASY,YACTQ,MAAO,CACLnB,KACF,EACAK,WAAY,gBACVe,KAAM5B,OAAO,CAAC,CAAC,MAAM,EAAEE,KAAK,CAAC,CAAC,CAC9B2B,YAAa7B,OAAO,CAAC,qBAAqB,CAC1Cc,MAAOd,OAAO,CAAC,cAAc,CAC7BqB,KAAMrB,OAAO,CAAC,aAAa,CAC3B8B,QAAS9B,OAAO,CAAC,gBAAgB,EAC9Ba,YAELC,MAAOA,MAAQ,KAAClB,MAAKM,KAAM,oBAAaY,QAAgB,MACpDC,uBAEHE,KACD,MAACG,OACCW,UAAW,CAAC,EAAE/B,OAAO,CAAC,uBAAuB,CAAC,CAAC,EAAEU,gBAAkB,OAASV,OAAO,CAAC,4BAA4B,CAAGA,OAAO,CAAC,6BAA6B,CAAC,CAAC,WAEzJM,cACC,KAACX,4CACCoC,UAAW/B,OAAO,CAAC,eAAe,CAClCgC,QAAQ,UACJ1B,eACJ2B,QAAS,AAACC,QACR5B,sBAAAA,qBAAAA,8BAAAA,sBAAAA,aAAc2B,OAAO,UAArB3B,sCAAAA,2BAAAA,aAAwB4B,GACxB,GAAI5B,qBAAAA,6BAAAA,aAAc6B,YAAY,CAAEhB,aAClC,KAGHd,eACC,KAACV,4CACCoC,UAAW/B,OAAO,CAAC,eAAe,CAClCgC,QAAQ,WACJ3B,gBACJ4B,QAAS,AAACC,QACR7B,uBAAAA,sBAAAA,+BAAAA,uBAAAA,cAAe4B,OAAO,UAAtB5B,uCAAAA,4BAAAA,cAAyB6B,GACzB,GAAI7B,sBAAAA,8BAAAA,cAAe8B,YAAY,CAAEhB,aACnC,aAOd,CAEA,QAAS1B,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={},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{Modal,ModalActions}from"../Modal";import{Button}from"../Form";import{Alert}from"../Alert";import{EStatus}from"../../genericTypes";import{useMantineTheme}from"@mantine/core";import{InformationList}from"../InformationList";const mapInformationToInformationList=information=>{return(information===null||information===void 0?void 0:information.map(x=>[x.key,x.value]))||[]};const ConfirmationDialogBody=({text,content,onSubmit,onClose,cancelButtonText,confirmationButtonText,confirmationButtonVariant="danger",information,gridListProps,alertStatus=EStatus.ERROR})=>{const theme=useMantineTheme();return _jsxs(_Fragment,{children:[_jsx(Alert,{type:alertStatus,dismissible:false,text:text,content:content,mb:information?theme.spacing.md:undefined}),_jsx(InformationList,_object_spread({items:mapInformationToInformationList(information)},gridListProps)),_jsxs(ModalActions,{children:[_jsx(Button,{"data-testid":"confirmation-dialog-cancel-button",variant:"default",onClick:onClose,children:cancelButtonText}),_jsx(Button,{"data-testid":"confirmation-dialog-confirm-button",variant:confirmationButtonVariant,type:"submit",onClick:onSubmit,children:confirmationButtonText})]})]})};const ConfirmationDialog=_0=>{let{title,opened,onClose,closeOnEscape=true,closeOnClickOutside=false}=_0,bodyProps=_object_without_properties(_0,["title","opened","onClose","closeOnEscape","closeOnClickOutside"]);return _jsx(Modal,{title:title,opened:opened,onClose:onClose,closeOnEscape:closeOnEscape,closeOnClickOutside:closeOnClickOutside,children:_jsx(ConfirmationDialogBody,_object_spread_props(_object_spread({},bodyProps),{onClose:onClose}))})};export{ConfirmationDialog,ConfirmationDialogBody};
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(Object(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{Modal,ModalActions}from"../Modal";import{Button}from"../Form";import{Alert}from"../Alert";import{EStatus}from"../../genericTypes";import{useMantineTheme}from"@mantine/core";import{InformationList}from"../InformationList";const mapInformationToInformationList=information=>{return(information===null||information===void 0?void 0:information.map(x=>[x.key,x.value]))||[]};const ConfirmationDialogBody=({text,content,onSubmit,onClose,cancelButtonText,confirmationButtonText,confirmationButtonVariant="danger",information,gridListProps,alertStatus=EStatus.ERROR})=>{const theme=useMantineTheme();return _jsxs(_Fragment,{children:[_jsx(Alert,{type:alertStatus,dismissible:false,text:text,content:content,mb:information?theme.spacing.md:undefined}),_jsx(InformationList,_object_spread({items:mapInformationToInformationList(information)},gridListProps)),_jsxs(ModalActions,{children:[_jsx(Button,{"data-testid":"confirmation-dialog-cancel-button",variant:"default",onClick:onClose,children:cancelButtonText}),_jsx(Button,{"data-testid":"confirmation-dialog-confirm-button",variant:confirmationButtonVariant,type:"submit",onClick:onSubmit,children:confirmationButtonText})]})]})};const ConfirmationDialog=_0=>{let{title,opened,onClose,closeOnEscape=true,closeOnClickOutside=false}=_0,bodyProps=_object_without_properties(_0,["title","opened","onClose","closeOnEscape","closeOnClickOutside"]);return _jsx(Modal,{title:title,opened:opened,onClose:onClose,closeOnEscape:closeOnEscape,closeOnClickOutside:closeOnClickOutside,children:_jsx(ConfirmationDialogBody,_object_spread_props(_object_spread({},bodyProps),{onClose:onClose}))})};export{ConfirmationDialog,ConfirmationDialogBody};
2
2
  //# sourceMappingURL=ConfirmationDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ConfirmationDialog/ConfirmationDialog.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { Modal, ModalActions } from \"../Modal\"\nimport { Button, TButtonProps } from \"../Form\"\nimport { Alert } from \"../Alert\"\nimport { EStatus } from \"../../genericTypes\"\nimport { useMantineTheme } from \"@mantine/core\"\nimport { InformationList, TInformationListItems, TInformationListProps } from \"../InformationList\"\nimport { ReactNode } from \"react\"\n\ntype TConfirmationDialogBodyProps = {\n text?: string\n content?: ReactNode\n cancelButtonText: string\n confirmationButtonText: string\n confirmationButtonVariant?: TButtonProps[\"variant\"]\n information?: { key: string; value: ReactNode }[]\n gridListProps?: Omit<TInformationListProps, \"items\">\n onSubmit: () => void\n onClose: () => void\n alertStatus?: EStatus\n}\n\ntype TConfirmationDialogProps = TConfirmationDialogBodyProps & {\n opened: boolean\n closeOnEscape?: boolean\n closeOnClickOutside?: boolean\n title: string\n}\n\nconst mapInformationToInformationList = (\n information: TConfirmationDialogProps[\"information\"]\n): TInformationListItems => {\n return information?.map((x) => [x.key, x.value]) || []\n}\n\n/**\n * ConfirmationDialog implementation according to the UI guidelines.\n * This component uses the Modal, ModalActions and the Alert components.\n * @param title the title show in the Modal Header\n * @param text the message shown in the Alert\n * @param content optional component to display custom content instead of text\n * @param onSubmit function that should be called, when the confirm button is clicked\n * @param alertStatus status of the Alert, default is error\n * @param onClose function that should be called, when the cancel button is clicked\n * @param cancelButtonText text the cancel (left) button should be labeled with\n * @param confirmationButtonText text the confirmation (right) button should be labeled with\n * @param confirmationButtonColor color of the confirmation (right) button\n * @param gridListProps, props to adjust the underlying GridList component, default is undefined\n * @param information optional parameter for displaying a key,value information list, default is undefined\n * @constructor\n */\nconst ConfirmationDialogBody = ({\n text,\n content,\n onSubmit,\n onClose,\n cancelButtonText,\n confirmationButtonText,\n confirmationButtonVariant = \"danger\",\n information,\n gridListProps,\n alertStatus = EStatus.ERROR,\n}: TConfirmationDialogBodyProps) => {\n const theme = useMantineTheme()\n return (\n <>\n <Alert\n type={alertStatus}\n dismissible={false}\n text={text}\n content={content}\n mb={information ? theme.spacing.md : undefined}\n />\n <InformationList items={mapInformationToInformationList(information)} {...gridListProps} />\n <ModalActions>\n <Button\n data-testid=\"confirmation-dialog-cancel-button\"\n variant={\"default\"}\n onClick={onClose}\n >\n {cancelButtonText}\n </Button>\n <Button\n data-testid=\"confirmation-dialog-confirm-button\"\n variant={confirmationButtonVariant}\n type={\"submit\"}\n onClick={onSubmit}\n >\n {confirmationButtonText}\n </Button>\n </ModalActions>\n </>\n )\n}\n\n/**\n * ConfirmationDialog implementation according to the UI guidelines.\n * This component uses the Modal, ModalActions and the Alert components.\n * @param title the title show in the Modal Header\n * @param text the message shown in the Alert\n * @param onSubmit function that should be called, when the confirm button is clicked\n * @param opened determines if the ConfirmationDialog is rendered\n * @param onClose function that should be called, when the cancel button is clicked\n * @param cancelButtonText text the cancel (left) button should be labeled with\n * @param confirmationButtonText text the confirmation (right) button should be labeled with\n * @param confirmationButtonColor color of the confirmation (right) button\n * @param closeOnEscape optional parameter for Modal closing behaviour, default is true\n * @param closeOnClickOutside optional parameter for Modal closing behaviour, default is false\n * @param gridListProps, props to adjust the underlying GridList component, default is undefined\n * @param information optional parameter for displaying a key,value information list, default is undefined\n * @constructor\n */\nconst ConfirmationDialog = ({\n title,\n opened,\n onClose,\n closeOnEscape = true,\n closeOnClickOutside = false,\n ...bodyProps\n}: TConfirmationDialogProps) => {\n return (\n <Modal\n title={title}\n opened={opened}\n onClose={onClose}\n closeOnEscape={closeOnEscape}\n closeOnClickOutside={closeOnClickOutside}\n >\n <ConfirmationDialogBody {...bodyProps} onClose={onClose} />\n </Modal>\n )\n}\n\nexport { ConfirmationDialog, ConfirmationDialogBody }\n"],"names":["Modal","ModalActions","Button","Alert","EStatus","useMantineTheme","InformationList","mapInformationToInformationList","information","map","x","key","value","ConfirmationDialogBody","text","content","onSubmit","onClose","cancelButtonText","confirmationButtonText","confirmationButtonVariant","gridListProps","alertStatus","ERROR","theme","type","dismissible","mb","spacing","md","undefined","items","data-testid","variant","onClick","ConfirmationDialog","title","opened","closeOnEscape","closeOnClickOutside","bodyProps"],"mappings":"81EAIA,QAASA,KAAK,CAAEC,YAAY,KAAQ,UAAU,AAC9C,QAASC,MAAM,KAAsB,SAAS,AAC9C,QAASC,KAAK,KAAQ,UAAU,AAChC,QAASC,OAAO,KAAQ,oBAAoB,AAC5C,QAASC,eAAe,KAAQ,eAAe,AAC/C,QAASC,eAAe,KAAsD,oBAAoB,CAuBlG,MAAMC,gCAAkC,AACtCC,cAEA,MAAOA,CAAAA,oBAAAA,4BAAAA,YAAaC,GAAG,CAAC,AAACC,GAAM,CAACA,EAAEC,GAAG,CAAED,EAAEE,KAAK,CAAC,IAAK,EAAE,AACxD,EAkBA,MAAMC,uBAAyB,CAAC,CAC9BC,IAAI,CACJC,OAAO,CACPC,QAAQ,CACRC,OAAO,CACPC,gBAAgB,CAChBC,sBAAsB,CACtBC,0BAA4B,QAAQ,CACpCZ,WAAW,CACXa,aAAa,CACbC,YAAclB,QAAQmB,KAAK,CACE,IAC7B,MAAMC,MAAQnB,kBACd,OACE,2BACE,KAACF,OACCsB,KAAMH,YACNI,YAAa,MACbZ,KAAMA,KACNC,QAASA,QACTY,GAAInB,YAAcgB,MAAMI,OAAO,CAACC,EAAE,CAAGC,YAEvC,KAACxB,gCAAgByB,MAAOxB,gCAAgCC,cAAkBa,gBAC1E,MAACpB,wBACC,KAACC,QACC8B,cAAY,oCACZC,QAAS,UACTC,QAASjB,iBAERC,mBAEH,KAAChB,QACC8B,cAAY,qCACZC,QAASb,0BACTK,KAAM,SACNS,QAASlB,kBAERG,8BAKX,EAmBA,MAAMgB,mBAAqB,QAAC,CAC1BC,KAAK,CACLC,MAAM,CACNpB,OAAO,CACPqB,cAAgB,IAAI,CACpBC,oBAAsB,KAAK,CAEF,IADtBC,4GAEH,OACE,KAACxC,OACCoC,MAAOA,MACPC,OAAQA,OACRpB,QAASA,QACTqB,cAAeA,cACfC,oBAAqBA,6BAErB,KAAC1B,8DAA2B2B,YAAWvB,QAASA,YAGtD,CAEA,QAASkB,kBAAkB,CAAEtB,sBAAsB,CAAE"}
1
+ {"version":3,"sources":["../../../../src/components/ConfirmationDialog/ConfirmationDialog.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { Modal, ModalActions } from \"../Modal\"\nimport { Button, TButtonProps } from \"../Form\"\nimport { Alert } from \"../Alert\"\nimport { EStatus } from \"../../genericTypes\"\nimport { useMantineTheme } from \"@mantine/core\"\nimport { InformationList, TInformationListItems, TInformationListProps } from \"../InformationList\"\nimport { ReactNode } from \"react\"\n\ntype TConfirmationDialogBodyProps = {\n text?: string\n content?: ReactNode\n cancelButtonText: string\n confirmationButtonText: string\n confirmationButtonVariant?: TButtonProps[\"variant\"]\n information?: { key: string; value: ReactNode }[]\n gridListProps?: Omit<TInformationListProps, \"items\">\n onSubmit: () => void\n onClose: () => void\n alertStatus?: EStatus\n}\n\ntype TConfirmationDialogProps = TConfirmationDialogBodyProps & {\n opened: boolean\n closeOnEscape?: boolean\n closeOnClickOutside?: boolean\n title: string\n}\n\nconst mapInformationToInformationList = (\n information: TConfirmationDialogProps[\"information\"]\n): TInformationListItems => {\n return information?.map((x) => [x.key, x.value]) || []\n}\n\n/**\n * ConfirmationDialog implementation according to the UI guidelines.\n * This component uses the Modal, ModalActions and the Alert components.\n * @param title the title show in the Modal Header\n * @param text the message shown in the Alert\n * @param content optional component to display custom content instead of text\n * @param onSubmit function that should be called, when the confirm button is clicked\n * @param alertStatus status of the Alert, default is error\n * @param onClose function that should be called, when the cancel button is clicked\n * @param cancelButtonText text the cancel (left) button should be labeled with\n * @param confirmationButtonText text the confirmation (right) button should be labeled with\n * @param confirmationButtonColor color of the confirmation (right) button\n * @param gridListProps, props to adjust the underlying GridList component, default is undefined\n * @param information optional parameter for displaying a key,value information list, default is undefined\n * @constructor\n */\nconst ConfirmationDialogBody = ({\n text,\n content,\n onSubmit,\n onClose,\n cancelButtonText,\n confirmationButtonText,\n confirmationButtonVariant = \"danger\",\n information,\n gridListProps,\n alertStatus = EStatus.ERROR,\n}: TConfirmationDialogBodyProps) => {\n const theme = useMantineTheme()\n return (\n <>\n <Alert\n type={alertStatus}\n dismissible={false}\n text={text}\n content={content}\n mb={information ? theme.spacing.md : undefined}\n />\n <InformationList items={mapInformationToInformationList(information)} {...gridListProps} />\n <ModalActions>\n <Button\n data-testid=\"confirmation-dialog-cancel-button\"\n variant={\"default\"}\n onClick={onClose}\n >\n {cancelButtonText}\n </Button>\n <Button\n data-testid=\"confirmation-dialog-confirm-button\"\n variant={confirmationButtonVariant}\n type={\"submit\"}\n onClick={onSubmit}\n >\n {confirmationButtonText}\n </Button>\n </ModalActions>\n </>\n )\n}\n\n/**\n * ConfirmationDialog implementation according to the UI guidelines.\n * This component uses the Modal, ModalActions and the Alert components.\n * @param title the title show in the Modal Header\n * @param text the message shown in the Alert\n * @param onSubmit function that should be called, when the confirm button is clicked\n * @param opened determines if the ConfirmationDialog is rendered\n * @param onClose function that should be called, when the cancel button is clicked\n * @param cancelButtonText text the cancel (left) button should be labeled with\n * @param confirmationButtonText text the confirmation (right) button should be labeled with\n * @param confirmationButtonColor color of the confirmation (right) button\n * @param closeOnEscape optional parameter for Modal closing behaviour, default is true\n * @param closeOnClickOutside optional parameter for Modal closing behaviour, default is false\n * @param gridListProps, props to adjust the underlying GridList component, default is undefined\n * @param information optional parameter for displaying a key,value information list, default is undefined\n * @constructor\n */\nconst ConfirmationDialog = ({\n title,\n opened,\n onClose,\n closeOnEscape = true,\n closeOnClickOutside = false,\n ...bodyProps\n}: TConfirmationDialogProps) => {\n return (\n <Modal\n title={title}\n opened={opened}\n onClose={onClose}\n closeOnEscape={closeOnEscape}\n closeOnClickOutside={closeOnClickOutside}\n >\n <ConfirmationDialogBody {...bodyProps} onClose={onClose} />\n </Modal>\n )\n}\n\nexport { ConfirmationDialog, ConfirmationDialogBody }\n"],"names":["Modal","ModalActions","Button","Alert","EStatus","useMantineTheme","InformationList","mapInformationToInformationList","information","map","x","key","value","ConfirmationDialogBody","text","content","onSubmit","onClose","cancelButtonText","confirmationButtonText","confirmationButtonVariant","gridListProps","alertStatus","ERROR","theme","type","dismissible","mb","spacing","md","undefined","items","data-testid","variant","onClick","ConfirmationDialog","title","opened","closeOnEscape","closeOnClickOutside","bodyProps"],"mappings":"s2EAIA,QAASA,KAAK,CAAEC,YAAY,KAAQ,UAAU,AAC9C,QAASC,MAAM,KAAsB,SAAS,AAC9C,QAASC,KAAK,KAAQ,UAAU,AAChC,QAASC,OAAO,KAAQ,oBAAoB,AAC5C,QAASC,eAAe,KAAQ,eAAe,AAC/C,QAASC,eAAe,KAAsD,oBAAoB,CAuBlG,MAAMC,gCAAkC,AACtCC,cAEA,MAAOA,CAAAA,oBAAAA,4BAAAA,YAAaC,GAAG,CAAC,AAACC,GAAM,CAACA,EAAEC,GAAG,CAAED,EAAEE,KAAK,CAAC,IAAK,EAAE,AACxD,EAkBA,MAAMC,uBAAyB,CAAC,CAC9BC,IAAI,CACJC,OAAO,CACPC,QAAQ,CACRC,OAAO,CACPC,gBAAgB,CAChBC,sBAAsB,CACtBC,0BAA4B,QAAQ,CACpCZ,WAAW,CACXa,aAAa,CACbC,YAAclB,QAAQmB,KAAK,CACE,IAC7B,MAAMC,MAAQnB,kBACd,OACE,2BACE,KAACF,OACCsB,KAAMH,YACNI,YAAa,MACbZ,KAAMA,KACNC,QAASA,QACTY,GAAInB,YAAcgB,MAAMI,OAAO,CAACC,EAAE,CAAGC,YAEvC,KAACxB,gCAAgByB,MAAOxB,gCAAgCC,cAAkBa,gBAC1E,MAACpB,wBACC,KAACC,QACC8B,cAAY,oCACZC,QAAS,UACTC,QAASjB,iBAERC,mBAEH,KAAChB,QACC8B,cAAY,qCACZC,QAASb,0BACTK,KAAM,SACNS,QAASlB,kBAERG,8BAKX,EAmBA,MAAMgB,mBAAqB,QAAC,CAC1BC,KAAK,CACLC,MAAM,CACNpB,OAAO,CACPqB,cAAgB,IAAI,CACpBC,oBAAsB,KAAK,CAEF,IADtBC,4GAEH,OACE,KAACxC,OACCoC,MAAOA,MACPC,OAAQA,OACRpB,QAASA,QACTqB,cAAeA,cACfC,oBAAqBA,6BAErB,KAAC1B,8DAA2B2B,YAAWvB,QAASA,YAGtD,CAEA,QAASkB,kBAAkB,CAAEtB,sBAAsB,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={},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{forwardRef,useEffect,useImperativeHandle,useRef,useState}from"react";import{Drawer as MantineDrawer}from"@mantine/core";import{ChevronRight,ChevronLeft}from"lucide-react";import{createPortal}from"react-dom";import classes from"./Drawer.module.css";import{Z_INDEX_LAYER}from"../../theme";const Drawer=forwardRef(({children,invisibleWhenClosed=false,width=500,closedWidth=30,title,showChevronBtn=true,isOpen=false,drawerProps,onClose},ref)=>{const[opened,setOpened]=useState(false);useEffect(()=>{setOpened(isOpen)},[isOpen]);useImperativeHandle(ref,()=>({setOpen(){setOpened(true)},setClose(){setOpened(false)}}),[setOpened]);const handleDrawerClose=()=>{setOpened(false);if(onClose){onClose()}};return _jsxs(_Fragment,{children:[_jsx(MantineDrawer,_object_spread_props(_object_spread({opened:opened,onClose:handleDrawerClose,title:title,position:"right",size:width,classNames:{root:classes.root,overlay:classes.overlay,close:classes["close-button"],content:classes.content,inner:classes.inner,body:classes.body,header:classes.header,title:classes.title}},drawerProps),{children:children})),_jsx("div",{className:classes["open-drawer"],style:{transform:opened?"translateX(-20px)":`translateX(${width-closedWidth}px)`,visibility:invisibleWhenClosed?opened?"visible":"hidden":"visible",zIndex:Z_INDEX_LAYER.GROUND.HIGHEST,width},children:showChevronBtn&&(opened?_jsx(ChevronRight,{"data-testid":"drawer-close",size:32,strokeWidth:1.5,className:classes.chevron,color:"white",onClick:handleDrawerClose}):_jsx(ChevronLeft,{"data-testid":"drawer-open",size:32,className:classes.chevron,color:"white",onClick:()=>setOpened(true)}))})]})});const DrawerWithOpener=_0=>{let{Opener}=_0,props=_object_without_properties(_0,["Opener"]);const drawerRef=useRef(null);const DrawerPortal=createPortal(_jsx(Drawer,_object_spread_props(_object_spread({},props),{ref:drawerRef})),document.body);return _jsxs(_Fragment,{children:[_jsx(Opener,{setOpen:()=>{var _drawerRef_current;return drawerRef===null||drawerRef===void 0?void 0:(_drawerRef_current=drawerRef.current)===null||_drawerRef_current===void 0?void 0:_drawerRef_current.setOpen()}}),DrawerPortal]})};export{Drawer,DrawerWithOpener};
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(Object(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{forwardRef,useEffect,useImperativeHandle,useRef,useState}from"react";import{Drawer as MantineDrawer}from"@mantine/core";import{ChevronRight,ChevronLeft}from"lucide-react";import{createPortal}from"react-dom";import classes from"./Drawer.module.css";import{Z_INDEX_LAYER}from"../../theme";const Drawer=forwardRef(({children,invisibleWhenClosed=false,width=500,closedWidth=30,title,showChevronBtn=true,isOpen=false,drawerProps,onClose},ref)=>{const[opened,setOpened]=useState(false);useEffect(()=>{setOpened(isOpen)},[isOpen]);useImperativeHandle(ref,()=>({setOpen(){setOpened(true)},setClose(){setOpened(false)}}),[setOpened]);const handleDrawerClose=()=>{setOpened(false);if(onClose){onClose()}};return _jsxs(_Fragment,{children:[_jsx(MantineDrawer,_object_spread_props(_object_spread({opened:opened,onClose:handleDrawerClose,title:title,position:"right",size:width,classNames:{root:classes.root,overlay:classes.overlay,close:classes["close-button"],content:classes.content,inner:classes.inner,body:classes.body,header:classes.header,title:classes.title}},drawerProps),{children:children})),_jsx("div",{className:classes["open-drawer"],style:{transform:opened?"translateX(-20px)":`translateX(${width-closedWidth}px)`,visibility:invisibleWhenClosed?opened?"visible":"hidden":"visible",zIndex:Z_INDEX_LAYER.GROUND.HIGHEST,width},children:showChevronBtn&&(opened?_jsx(ChevronRight,{"data-testid":"drawer-close",size:32,strokeWidth:1.5,className:classes.chevron,color:"white",onClick:handleDrawerClose}):_jsx(ChevronLeft,{"data-testid":"drawer-open",size:32,className:classes.chevron,color:"white",onClick:()=>setOpened(true)}))})]})});const DrawerWithOpener=_0=>{let{Opener}=_0,props=_object_without_properties(_0,["Opener"]);const drawerRef=useRef(null);const DrawerPortal=createPortal(_jsx(Drawer,_object_spread_props(_object_spread({},props),{ref:drawerRef})),document.body);return _jsxs(_Fragment,{children:[_jsx(Opener,{setOpen:()=>{var _drawerRef_current;return drawerRef===null||drawerRef===void 0?void 0:(_drawerRef_current=drawerRef.current)===null||_drawerRef_current===void 0?void 0:_drawerRef_current.setOpen()}}),DrawerPortal]})};export{Drawer,DrawerWithOpener};
2
2
  //# sourceMappingURL=Drawer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport {\n forwardRef,\n PropsWithChildren,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\"\nimport { Drawer as MantineDrawer, DrawerProps } from \"@mantine/core\"\nimport { ChevronRight, ChevronLeft } from \"lucide-react\"\nimport { createPortal } from \"react-dom\"\nimport classes from \"./Drawer.module.css\"\nimport { Z_INDEX_LAYER } from \"../../theme\"\ntype TDrawerProps = {\n width?: number\n closedWidth?: number\n title: string\n showChevronBtn?: boolean\n isOpen?: boolean\n onClose?: () => void\n invisibleWhenClosed?: boolean\n drawerProps?: Partial<DrawerProps>\n}\n\ntype TDrawerHandle = {\n setOpen: () => void\n setClose: () => void\n}\n\n/**\n * Provides a Drawer component that slides into view from the corner of the window\n * @param width Width of the opened Drawer\n * @param closedWidth Width of the closed Drawer\n * @param title Title string of the Drawer\n * @param showChevronBtn Controls if chevron button should be shown\n * @param isOpen Controls if Drawer is opened\n * @param onClose Callback when Drawer is closed\n * @param invisibleWhenClosed Controls if the Drawer is visible when closed\n * @param drawerProps Original props from library to be used additionally\n */\n// eslint-disable-next-line react/display-name\nconst Drawer = forwardRef<TDrawerHandle, React.PropsWithChildren<TDrawerProps>>(\n (\n {\n children,\n invisibleWhenClosed = false,\n width = 500,\n closedWidth = 30,\n title,\n showChevronBtn = true,\n isOpen = false,\n drawerProps,\n onClose,\n },\n ref\n ) => {\n const [opened, setOpened] = useState(false)\n\n useEffect(() => {\n setOpened(isOpen)\n }, [isOpen])\n\n useImperativeHandle(\n ref,\n () => ({\n setOpen() {\n setOpened(true)\n },\n setClose() {\n setOpened(false)\n },\n }),\n [setOpened]\n )\n\n const handleDrawerClose = () => {\n setOpened(false)\n if (onClose) {\n onClose()\n }\n }\n\n return (\n <>\n <MantineDrawer\n opened={opened}\n onClose={handleDrawerClose}\n title={title}\n position=\"right\"\n size={width}\n classNames={{\n root: classes.root,\n overlay: classes.overlay,\n close: classes[\"close-button\"],\n content: classes.content,\n inner: classes.inner,\n body: classes.body,\n header: classes.header,\n title: classes.title,\n }}\n {...drawerProps}\n >\n {children}\n </MantineDrawer>\n <div\n className={classes[\"open-drawer\"]}\n style={{\n transform: opened ? \"translateX(-20px)\" : `translateX(${width - closedWidth}px)`,\n visibility: invisibleWhenClosed ? (opened ? \"visible\" : \"hidden\") : \"visible\",\n zIndex: Z_INDEX_LAYER.GROUND.HIGHEST,\n width,\n }}\n >\n {showChevronBtn &&\n (opened ? (\n <ChevronRight\n data-testid={\"drawer-close\"}\n size={32}\n strokeWidth={1.5}\n className={classes.chevron}\n color={\"white\"}\n onClick={handleDrawerClose}\n />\n ) : (\n <ChevronLeft\n data-testid={\"drawer-open\"}\n size={32}\n className={classes.chevron}\n color={\"white\"}\n onClick={() => setOpened(true)}\n />\n ))}\n </div>\n </>\n )\n }\n)\n\ntype TDrawerWithOpenerProps = PropsWithChildren<{\n Opener: React.FC<{ setOpen: () => void }>\n}> &\n TDrawerProps\n\nconst DrawerWithOpener = ({ Opener, ...props }: TDrawerWithOpenerProps) => {\n const drawerRef = useRef<TDrawerHandle>(null)\n const DrawerPortal = createPortal(<Drawer {...props} ref={drawerRef} />, document.body)\n return (\n <>\n <Opener setOpen={() => drawerRef?.current?.setOpen()}></Opener>\n {DrawerPortal}\n </>\n )\n}\n\nexport { Drawer, DrawerWithOpener }\n"],"names":["forwardRef","useEffect","useImperativeHandle","useRef","useState","Drawer","MantineDrawer","ChevronRight","ChevronLeft","createPortal","classes","Z_INDEX_LAYER","children","invisibleWhenClosed","width","closedWidth","title","showChevronBtn","isOpen","drawerProps","onClose","ref","opened","setOpened","setOpen","setClose","handleDrawerClose","position","size","classNames","root","overlay","close","content","inner","body","header","div","className","style","transform","visibility","zIndex","GROUND","HIGHEST","data-testid","strokeWidth","chevron","color","onClick","DrawerWithOpener","Opener","props","drawerRef","DrawerPortal","document","current"],"mappings":"81EAIA,QACEA,UAAU,CAEVC,SAAS,CACTC,mBAAmB,CACnBC,MAAM,CACNC,QAAQ,KACH,OAAO,AACd,QAASC,UAAUC,aAAa,KAAqB,eAAe,AACpE,QAASC,YAAY,CAAEC,WAAW,KAAQ,cAAc,AACxD,QAASC,YAAY,KAAQ,WAAW,AACxC,QAAOC,YAAa,qBAAqB,AACzC,QAASC,aAAa,KAAQ,aAAa,CA6B3C,MAAMN,OAASL,WACb,CACE,CACEY,QAAQ,CACRC,oBAAsB,KAAK,CAC3BC,MAAQ,GAAG,CACXC,YAAc,EAAE,CAChBC,KAAK,CACLC,eAAiB,IAAI,CACrBC,OAAS,KAAK,CACdC,WAAW,CACXC,OAAO,CACR,CACDC,OAEA,KAAM,CAACC,OAAQC,UAAU,CAAGnB,SAAS,OAErCH,UAAU,KACRsB,UAAUL,OACZ,EAAG,CAACA,OAAO,EAEXhB,oBACEmB,IACA,IAAO,CAAA,CACLG,UACED,UAAU,KACZ,EACAE,WACEF,UAAU,MACZ,CACF,CAAA,EACA,CAACA,UAAU,EAGb,MAAMG,kBAAoB,KACxBH,UAAU,OACV,GAAIH,QAAS,CACXA,SACF,CACF,EAEA,OACE,2BACE,KAACd,mDACCgB,OAAQA,OACRF,QAASM,kBACTV,MAAOA,MACPW,SAAS,QACTC,KAAMd,MACNe,WAAY,CACVC,KAAMpB,QAAQoB,IAAI,CAClBC,QAASrB,QAAQqB,OAAO,CACxBC,MAAOtB,OAAO,CAAC,eAAe,CAC9BuB,QAASvB,QAAQuB,OAAO,CACxBC,MAAOxB,QAAQwB,KAAK,CACpBC,KAAMzB,QAAQyB,IAAI,CAClBC,OAAQ1B,QAAQ0B,MAAM,CACtBpB,MAAON,QAAQM,KAAK,AACtB,GACIG,uBAEHP,YAEH,KAACyB,OACCC,UAAW5B,OAAO,CAAC,cAAc,CACjC6B,MAAO,CACLC,UAAWlB,OAAS,oBAAsB,CAAC,WAAW,EAAER,MAAQC,YAAY,GAAG,CAAC,CAChF0B,WAAY5B,oBAAuBS,OAAS,UAAY,SAAY,UACpEoB,OAAQ/B,cAAcgC,MAAM,CAACC,OAAO,CACpC9B,KACF,WAECG,gBACEK,CAAAA,OACC,KAACf,cACCsC,cAAa,eACbjB,KAAM,GACNkB,YAAa,IACbR,UAAW5B,QAAQqC,OAAO,CAC1BC,MAAO,QACPC,QAASvB,oBAGX,KAAClB,aACCqC,cAAa,cACbjB,KAAM,GACNU,UAAW5B,QAAQqC,OAAO,CAC1BC,MAAO,QACPC,QAAS,IAAM1B,UAAU,OAE7B,MAIV,GAQF,MAAM2B,iBAAmB,QAAC,CAAEC,MAAM,CAAoC,IAA/BC,gDACrC,MAAMC,UAAYlD,OAAsB,MACxC,MAAMmD,aAAe7C,aAAa,KAACJ,8CAAW+C,QAAO/B,IAAKgC,aAAeE,SAASpB,IAAI,EACtF,OACE,2BACE,KAACgB,QAAO3B,QAAS,SAAM6B,0BAAAA,kBAAAA,2BAAAA,mBAAAA,UAAWG,OAAO,UAAlBH,mCAAAA,mBAAoB7B,OAAO,MACjD8B,eAGP,CAEA,QAASjD,MAAM,CAAE6C,gBAAgB,CAAE"}
1
+ {"version":3,"sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport {\n forwardRef,\n PropsWithChildren,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\"\nimport { Drawer as MantineDrawer, DrawerProps } from \"@mantine/core\"\nimport { ChevronRight, ChevronLeft } from \"lucide-react\"\nimport { createPortal } from \"react-dom\"\nimport classes from \"./Drawer.module.css\"\nimport { Z_INDEX_LAYER } from \"../../theme\"\ntype TDrawerProps = {\n width?: number\n closedWidth?: number\n title: string\n showChevronBtn?: boolean\n isOpen?: boolean\n onClose?: () => void\n invisibleWhenClosed?: boolean\n drawerProps?: Partial<DrawerProps>\n}\n\ntype TDrawerHandle = {\n setOpen: () => void\n setClose: () => void\n}\n\n/**\n * Provides a Drawer component that slides into view from the corner of the window\n * @param width Width of the opened Drawer\n * @param closedWidth Width of the closed Drawer\n * @param title Title string of the Drawer\n * @param showChevronBtn Controls if chevron button should be shown\n * @param isOpen Controls if Drawer is opened\n * @param onClose Callback when Drawer is closed\n * @param invisibleWhenClosed Controls if the Drawer is visible when closed\n * @param drawerProps Original props from library to be used additionally\n */\n// eslint-disable-next-line react/display-name\nconst Drawer = forwardRef<TDrawerHandle, React.PropsWithChildren<TDrawerProps>>(\n (\n {\n children,\n invisibleWhenClosed = false,\n width = 500,\n closedWidth = 30,\n title,\n showChevronBtn = true,\n isOpen = false,\n drawerProps,\n onClose,\n },\n ref\n ) => {\n const [opened, setOpened] = useState(false)\n\n useEffect(() => {\n setOpened(isOpen)\n }, [isOpen])\n\n useImperativeHandle(\n ref,\n () => ({\n setOpen() {\n setOpened(true)\n },\n setClose() {\n setOpened(false)\n },\n }),\n [setOpened]\n )\n\n const handleDrawerClose = () => {\n setOpened(false)\n if (onClose) {\n onClose()\n }\n }\n\n return (\n <>\n <MantineDrawer\n opened={opened}\n onClose={handleDrawerClose}\n title={title}\n position=\"right\"\n size={width}\n classNames={{\n root: classes.root,\n overlay: classes.overlay,\n close: classes[\"close-button\"],\n content: classes.content,\n inner: classes.inner,\n body: classes.body,\n header: classes.header,\n title: classes.title,\n }}\n {...drawerProps}\n >\n {children}\n </MantineDrawer>\n <div\n className={classes[\"open-drawer\"]}\n style={{\n transform: opened ? \"translateX(-20px)\" : `translateX(${width - closedWidth}px)`,\n visibility: invisibleWhenClosed ? (opened ? \"visible\" : \"hidden\") : \"visible\",\n zIndex: Z_INDEX_LAYER.GROUND.HIGHEST,\n width,\n }}\n >\n {showChevronBtn &&\n (opened ? (\n <ChevronRight\n data-testid={\"drawer-close\"}\n size={32}\n strokeWidth={1.5}\n className={classes.chevron}\n color={\"white\"}\n onClick={handleDrawerClose}\n />\n ) : (\n <ChevronLeft\n data-testid={\"drawer-open\"}\n size={32}\n className={classes.chevron}\n color={\"white\"}\n onClick={() => setOpened(true)}\n />\n ))}\n </div>\n </>\n )\n }\n)\n\ntype TDrawerWithOpenerProps = PropsWithChildren<{\n Opener: React.FC<{ setOpen: () => void }>\n}> &\n TDrawerProps\n\nconst DrawerWithOpener = ({ Opener, ...props }: TDrawerWithOpenerProps) => {\n const drawerRef = useRef<TDrawerHandle>(null)\n const DrawerPortal = createPortal(<Drawer {...props} ref={drawerRef} />, document.body)\n return (\n <>\n <Opener setOpen={() => drawerRef?.current?.setOpen()}></Opener>\n {DrawerPortal}\n </>\n )\n}\n\nexport { Drawer, DrawerWithOpener }\n"],"names":["forwardRef","useEffect","useImperativeHandle","useRef","useState","Drawer","MantineDrawer","ChevronRight","ChevronLeft","createPortal","classes","Z_INDEX_LAYER","children","invisibleWhenClosed","width","closedWidth","title","showChevronBtn","isOpen","drawerProps","onClose","ref","opened","setOpened","setOpen","setClose","handleDrawerClose","position","size","classNames","root","overlay","close","content","inner","body","header","div","className","style","transform","visibility","zIndex","GROUND","HIGHEST","data-testid","strokeWidth","chevron","color","onClick","DrawerWithOpener","Opener","props","drawerRef","DrawerPortal","document","current"],"mappings":"s2EAIA,QACEA,UAAU,CAEVC,SAAS,CACTC,mBAAmB,CACnBC,MAAM,CACNC,QAAQ,KACH,OAAO,AACd,QAASC,UAAUC,aAAa,KAAqB,eAAe,AACpE,QAASC,YAAY,CAAEC,WAAW,KAAQ,cAAc,AACxD,QAASC,YAAY,KAAQ,WAAW,AACxC,QAAOC,YAAa,qBAAqB,AACzC,QAASC,aAAa,KAAQ,aAAa,CA6B3C,MAAMN,OAASL,WACb,CACE,CACEY,QAAQ,CACRC,oBAAsB,KAAK,CAC3BC,MAAQ,GAAG,CACXC,YAAc,EAAE,CAChBC,KAAK,CACLC,eAAiB,IAAI,CACrBC,OAAS,KAAK,CACdC,WAAW,CACXC,OAAO,CACR,CACDC,OAEA,KAAM,CAACC,OAAQC,UAAU,CAAGnB,SAAS,OAErCH,UAAU,KACRsB,UAAUL,OACZ,EAAG,CAACA,OAAO,EAEXhB,oBACEmB,IACA,IAAO,CAAA,CACLG,UACED,UAAU,KACZ,EACAE,WACEF,UAAU,MACZ,CACF,CAAA,EACA,CAACA,UAAU,EAGb,MAAMG,kBAAoB,KACxBH,UAAU,OACV,GAAIH,QAAS,CACXA,SACF,CACF,EAEA,OACE,2BACE,KAACd,mDACCgB,OAAQA,OACRF,QAASM,kBACTV,MAAOA,MACPW,SAAS,QACTC,KAAMd,MACNe,WAAY,CACVC,KAAMpB,QAAQoB,IAAI,CAClBC,QAASrB,QAAQqB,OAAO,CACxBC,MAAOtB,OAAO,CAAC,eAAe,CAC9BuB,QAASvB,QAAQuB,OAAO,CACxBC,MAAOxB,QAAQwB,KAAK,CACpBC,KAAMzB,QAAQyB,IAAI,CAClBC,OAAQ1B,QAAQ0B,MAAM,CACtBpB,MAAON,QAAQM,KAAK,AACtB,GACIG,uBAEHP,YAEH,KAACyB,OACCC,UAAW5B,OAAO,CAAC,cAAc,CACjC6B,MAAO,CACLC,UAAWlB,OAAS,oBAAsB,CAAC,WAAW,EAAER,MAAQC,YAAY,GAAG,CAAC,CAChF0B,WAAY5B,oBAAuBS,OAAS,UAAY,SAAY,UACpEoB,OAAQ/B,cAAcgC,MAAM,CAACC,OAAO,CACpC9B,KACF,WAECG,gBACEK,CAAAA,OACC,KAACf,cACCsC,cAAa,eACbjB,KAAM,GACNkB,YAAa,IACbR,UAAW5B,QAAQqC,OAAO,CAC1BC,MAAO,QACPC,QAASvB,oBAGX,KAAClB,aACCqC,cAAa,cACbjB,KAAM,GACNU,UAAW5B,QAAQqC,OAAO,CAC1BC,MAAO,QACPC,QAAS,IAAM1B,UAAU,OAE7B,MAIV,GAQF,MAAM2B,iBAAmB,QAAC,CAAEC,MAAM,CAAoC,IAA/BC,gDACrC,MAAMC,UAAYlD,OAAsB,MACxC,MAAMmD,aAAe7C,aAAa,KAACJ,8CAAW+C,QAAO/B,IAAKgC,aAAeE,SAASpB,IAAI,EACtF,OACE,2BACE,KAACgB,QAAO3B,QAAS,SAAM6B,0BAAAA,kBAAAA,2BAAAA,mBAAAA,UAAWG,OAAO,UAAlBH,mCAAAA,mBAAoB7B,OAAO,MACjD8B,eAGP,CAEA,QAASjD,MAAM,CAAE6C,gBAAgB,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={},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 React from"react";import{FilterBadge}from"../../utils/FilterBadge";import{X as CrossIcon}from"lucide-react";import{Tooltip}from"@mantine/core";import classes from"./TermBadge.module.css";import{cx}from"../../../../helper/cx";import{NumberInline}from"../../../NumberInline";import{TFilter}from"../../utils";const TermBadge=_0=>{let{label,controlType,onDelete,showDeleteButton,className}=_0,badgeProps=_object_without_properties(_0,["label","controlType","onDelete","showDeleteButton","className"]);const DeleteButton=()=>_jsx("span",{className:classes["delete-button"],"data-testid":"filter-badge-delete-button",onClick:e=>{e.stopPropagation();onDelete(e)},children:_jsx(CrossIcon,{size:16})});const labelLength=label.toString().length;if(labelLength>20){return _jsxs(FilterBadge,_object_spread_props(_object_spread({},badgeProps),{className:className,borderRadius:"2px",children:[_jsx(Tooltip,{label:label,"data-readonly-clickable":true,styles:{tooltip:{maxWidth:"50vw",wordBreak:"break-all",height:"auto",position:"fixed"}},multiline:true,children:_jsxs("span",{"data-testid":"filter-term-badge-label",style:{pointerEvents:"all"},children:[label.toString().substring(0,20),"..."]})}),showDeleteButton&&_jsx(DeleteButton,{})]}))}return _jsxs(FilterBadge,_object_spread_props(_object_spread({},badgeProps),{className:cx(className,classes.container),borderRadius:"2px",children:[controlType!=undefined&&(controlType==TFilter.EControlType.FLOAT||controlType==TFilter.EControlType.INTEGER)?_jsx("span",{"data-testid":"filter-term-badge-label",children:_jsx(NumberInline,{number:label})}):_jsx("span",{"data-testid":"filter-term-badge-label",children:label}),showDeleteButton&&_jsx(DeleteButton,{})]}))};export{TermBadge};
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(Object(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 React from"react";import{FilterBadge}from"../../utils/FilterBadge";import{X as CrossIcon}from"lucide-react";import{Tooltip}from"@mantine/core";import classes from"./TermBadge.module.css";import{cx}from"../../../../helper/cx";import{NumberInline}from"../../../NumberInline";import{TFilter}from"../../utils";const TermBadge=_0=>{let{label,controlType,onDelete,showDeleteButton,className}=_0,badgeProps=_object_without_properties(_0,["label","controlType","onDelete","showDeleteButton","className"]);const DeleteButton=()=>_jsx("span",{className:classes["delete-button"],"data-testid":"filter-badge-delete-button",onClick:e=>{e.stopPropagation();onDelete(e)},children:_jsx(CrossIcon,{size:16})});const labelLength=label.toString().length;if(labelLength>20){return _jsxs(FilterBadge,_object_spread_props(_object_spread({},badgeProps),{className:className,borderRadius:"2px",children:[_jsx(Tooltip,{label:label,"data-readonly-clickable":true,styles:{tooltip:{maxWidth:"50vw",wordBreak:"break-all",height:"auto",position:"fixed"}},multiline:true,children:_jsxs("span",{"data-testid":"filter-term-badge-label",style:{pointerEvents:"all"},children:[label.toString().substring(0,20),"..."]})}),showDeleteButton&&_jsx(DeleteButton,{})]}))}return _jsxs(FilterBadge,_object_spread_props(_object_spread({},badgeProps),{className:cx(className,classes.container),borderRadius:"2px",children:[controlType!=undefined&&(controlType==TFilter.EControlType.FLOAT||controlType==TFilter.EControlType.INTEGER)?_jsx("span",{"data-testid":"filter-term-badge-label",children:_jsx(NumberInline,{number:label})}):_jsx("span",{"data-testid":"filter-term-badge-label",children:label}),showDeleteButton&&_jsx(DeleteButton,{})]}))};export{TermBadge};
2
2
  //# sourceMappingURL=TermBadge.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/Filter/TermContainer/Term/TermBadge.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React, { MouseEventHandler } from \"react\"\nimport { FilterBadge } from \"../../utils/FilterBadge\"\nimport { X as CrossIcon } from \"lucide-react\"\nimport { Tooltip } from \"@mantine/core\"\nimport classes from \"./TermBadge.module.css\"\nimport { cx } from \"../../../../helper/cx\"\nimport { NumberInline } from \"../../../NumberInline\"\nimport { TFilter } from \"../../utils\"\n\ntype TTermBadgeProps = {\n label: string | number\n controlType?: TFilter.EControlType\n onDelete: MouseEventHandler<HTMLSpanElement>\n color: string\n bgColor: string\n showDeleteButton: boolean\n className?: string\n border?: string\n}\n\nconst TermBadge: React.FC<TTermBadgeProps> = ({\n label,\n controlType,\n onDelete,\n showDeleteButton,\n className,\n ...badgeProps\n}) => {\n const DeleteButton = () => (\n <span\n className={classes[\"delete-button\"]}\n data-testid={\"filter-badge-delete-button\"}\n onClick={(e) => {\n e.stopPropagation()\n onDelete(e)\n }}\n >\n {/* the icon's foreground color needs to be set to match the font color of the badge which depends\n on the theme and the background color of the badge. Currently, not setting the color fulfills this\n requirement for the light theme. */}\n <CrossIcon size={16} />\n </span>\n )\n\n const labelLength = label.toString().length\n\n if (labelLength > 20) {\n return (\n <FilterBadge {...badgeProps} className={className} borderRadius={\"2px\"}>\n <Tooltip\n label={label}\n data-readonly-clickable\n styles={{\n tooltip: {\n maxWidth: \"50vw\",\n wordBreak: \"break-all\",\n height: \"auto\",\n position: \"fixed\",\n },\n }}\n multiline\n >\n <span data-testid={\"filter-term-badge-label\"} style={{ pointerEvents: \"all\" }}>\n {label.toString().substring(0, 20)}...\n </span>\n </Tooltip>\n {showDeleteButton && <DeleteButton />}\n </FilterBadge>\n )\n }\n\n return (\n <FilterBadge {...badgeProps} className={cx(className, classes.container)} borderRadius={\"2px\"}>\n {controlType != undefined &&\n (controlType == TFilter.EControlType.FLOAT || controlType == TFilter.EControlType.INTEGER) ? (\n <span data-testid={\"filter-term-badge-label\"}>\n <NumberInline number={label as number} />\n </span>\n ) : (\n <span data-testid={\"filter-term-badge-label\"}>{label}</span>\n )}\n {showDeleteButton && <DeleteButton />}\n </FilterBadge>\n )\n}\n\nexport { TermBadge }\n"],"names":["React","FilterBadge","X","CrossIcon","Tooltip","classes","cx","NumberInline","TFilter","TermBadge","label","controlType","onDelete","showDeleteButton","className","badgeProps","DeleteButton","span","data-testid","onClick","e","stopPropagation","size","labelLength","toString","length","borderRadius","data-readonly-clickable","styles","tooltip","maxWidth","wordBreak","height","position","multiline","style","pointerEvents","substring","container","undefined","EControlType","FLOAT","INTEGER","number"],"mappings":"w0EAIA,QAAOA,UAAkC,OAAO,AAChD,QAASC,WAAW,KAAQ,yBAAyB,AACrD,QAASC,KAAKC,SAAS,KAAQ,cAAc,AAC7C,QAASC,OAAO,KAAQ,eAAe,AACvC,QAAOC,YAAa,wBAAwB,AAC5C,QAASC,EAAE,KAAQ,uBAAuB,AAC1C,QAASC,YAAY,KAAQ,uBAAuB,AACpD,QAASC,OAAO,KAAQ,aAAa,CAarC,MAAMC,UAAuC,QAAC,CAC5CC,KAAK,CACLC,WAAW,CACXC,QAAQ,CACRC,gBAAgB,CAChBC,SAAS,CAEV,IADIC,4GAEH,MAAMC,aAAe,IACnB,KAACC,QACCH,UAAWT,OAAO,CAAC,gBAAgB,CACnCa,cAAa,6BACbC,QAAS,AAACC,IACRA,EAAEC,eAAe,GACjBT,SAASQ,EACX,WAKA,KAACjB,WAAUmB,KAAM,OAIrB,MAAMC,YAAcb,MAAMc,QAAQ,GAAGC,MAAM,CAE3C,GAAIF,YAAc,GAAI,CACpB,OACE,MAACtB,mDAAgBc,aAAYD,UAAWA,UAAWY,aAAc,gBAC/D,KAACtB,SACCM,MAAOA,MACPiB,yBAAuB,MACvBC,OAAQ,CACNC,QAAS,CACPC,SAAU,OACVC,UAAW,YACXC,OAAQ,OACRC,SAAU,OACZ,CACF,EACAC,SAAS,eAET,MAACjB,QAAKC,cAAa,0BAA2BiB,MAAO,CAAEC,cAAe,KAAM,YACzE1B,MAAMc,QAAQ,GAAGa,SAAS,CAAC,EAAG,IAAI,WAGtCxB,kBAAoB,KAACG,oBAG5B,CAEA,OACE,MAACf,mDAAgBc,aAAYD,UAAWR,GAAGQ,UAAWT,QAAQiC,SAAS,EAAGZ,aAAc,gBACrFf,aAAe4B,WACf5B,CAAAA,aAAeH,QAAQgC,YAAY,CAACC,KAAK,EAAI9B,aAAeH,QAAQgC,YAAY,CAACE,OAAO,AAAD,EACtF,KAACzB,QAAKC,cAAa,mCACjB,KAACX,cAAaoC,OAAQjC,UAGxB,KAACO,QAAKC,cAAa,mCAA4BR,QAEhDG,kBAAoB,KAACG,oBAG5B,CAEA,QAASP,SAAS,CAAE"}
1
+ {"version":3,"sources":["../../../../../../src/components/Filter/TermContainer/Term/TermBadge.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React, { MouseEventHandler } from \"react\"\nimport { FilterBadge } from \"../../utils/FilterBadge\"\nimport { X as CrossIcon } from \"lucide-react\"\nimport { Tooltip } from \"@mantine/core\"\nimport classes from \"./TermBadge.module.css\"\nimport { cx } from \"../../../../helper/cx\"\nimport { NumberInline } from \"../../../NumberInline\"\nimport { TFilter } from \"../../utils\"\n\ntype TTermBadgeProps = {\n label: string | number\n controlType?: TFilter.EControlType\n onDelete: MouseEventHandler<HTMLSpanElement>\n color: string\n bgColor: string\n showDeleteButton: boolean\n className?: string\n border?: string\n}\n\nconst TermBadge: React.FC<TTermBadgeProps> = ({\n label,\n controlType,\n onDelete,\n showDeleteButton,\n className,\n ...badgeProps\n}) => {\n const DeleteButton = () => (\n <span\n className={classes[\"delete-button\"]}\n data-testid={\"filter-badge-delete-button\"}\n onClick={(e) => {\n e.stopPropagation()\n onDelete(e)\n }}\n >\n {/* the icon's foreground color needs to be set to match the font color of the badge which depends\n on the theme and the background color of the badge. Currently, not setting the color fulfills this\n requirement for the light theme. */}\n <CrossIcon size={16} />\n </span>\n )\n\n const labelLength = label.toString().length\n\n if (labelLength > 20) {\n return (\n <FilterBadge {...badgeProps} className={className} borderRadius={\"2px\"}>\n <Tooltip\n label={label}\n data-readonly-clickable\n styles={{\n tooltip: {\n maxWidth: \"50vw\",\n wordBreak: \"break-all\",\n height: \"auto\",\n position: \"fixed\",\n },\n }}\n multiline\n >\n <span data-testid={\"filter-term-badge-label\"} style={{ pointerEvents: \"all\" }}>\n {label.toString().substring(0, 20)}...\n </span>\n </Tooltip>\n {showDeleteButton && <DeleteButton />}\n </FilterBadge>\n )\n }\n\n return (\n <FilterBadge {...badgeProps} className={cx(className, classes.container)} borderRadius={\"2px\"}>\n {controlType != undefined &&\n (controlType == TFilter.EControlType.FLOAT || controlType == TFilter.EControlType.INTEGER) ? (\n <span data-testid={\"filter-term-badge-label\"}>\n <NumberInline number={label as number} />\n </span>\n ) : (\n <span data-testid={\"filter-term-badge-label\"}>{label}</span>\n )}\n {showDeleteButton && <DeleteButton />}\n </FilterBadge>\n )\n}\n\nexport { TermBadge }\n"],"names":["React","FilterBadge","X","CrossIcon","Tooltip","classes","cx","NumberInline","TFilter","TermBadge","label","controlType","onDelete","showDeleteButton","className","badgeProps","DeleteButton","span","data-testid","onClick","e","stopPropagation","size","labelLength","toString","length","borderRadius","data-readonly-clickable","styles","tooltip","maxWidth","wordBreak","height","position","multiline","style","pointerEvents","substring","container","undefined","EControlType","FLOAT","INTEGER","number"],"mappings":"g1EAIA,QAAOA,UAAkC,OAAO,AAChD,QAASC,WAAW,KAAQ,yBAAyB,AACrD,QAASC,KAAKC,SAAS,KAAQ,cAAc,AAC7C,QAASC,OAAO,KAAQ,eAAe,AACvC,QAAOC,YAAa,wBAAwB,AAC5C,QAASC,EAAE,KAAQ,uBAAuB,AAC1C,QAASC,YAAY,KAAQ,uBAAuB,AACpD,QAASC,OAAO,KAAQ,aAAa,CAarC,MAAMC,UAAuC,QAAC,CAC5CC,KAAK,CACLC,WAAW,CACXC,QAAQ,CACRC,gBAAgB,CAChBC,SAAS,CAEV,IADIC,4GAEH,MAAMC,aAAe,IACnB,KAACC,QACCH,UAAWT,OAAO,CAAC,gBAAgB,CACnCa,cAAa,6BACbC,QAAS,AAACC,IACRA,EAAEC,eAAe,GACjBT,SAASQ,EACX,WAKA,KAACjB,WAAUmB,KAAM,OAIrB,MAAMC,YAAcb,MAAMc,QAAQ,GAAGC,MAAM,CAE3C,GAAIF,YAAc,GAAI,CACpB,OACE,MAACtB,mDAAgBc,aAAYD,UAAWA,UAAWY,aAAc,gBAC/D,KAACtB,SACCM,MAAOA,MACPiB,yBAAuB,MACvBC,OAAQ,CACNC,QAAS,CACPC,SAAU,OACVC,UAAW,YACXC,OAAQ,OACRC,SAAU,OACZ,CACF,EACAC,SAAS,eAET,MAACjB,QAAKC,cAAa,0BAA2BiB,MAAO,CAAEC,cAAe,KAAM,YACzE1B,MAAMc,QAAQ,GAAGa,SAAS,CAAC,EAAG,IAAI,WAGtCxB,kBAAoB,KAACG,oBAG5B,CAEA,OACE,MAACf,mDAAgBc,aAAYD,UAAWR,GAAGQ,UAAWT,QAAQiC,SAAS,EAAGZ,aAAc,gBACrFf,aAAe4B,WACf5B,CAAAA,aAAeH,QAAQgC,YAAY,CAACC,KAAK,EAAI9B,aAAeH,QAAQgC,YAAY,CAACE,OAAO,AAAD,EACtF,KAACzB,QAAKC,cAAa,mCACjB,KAACX,cAAaoC,OAAQjC,UAGxB,KAACO,QAAKC,cAAa,mCAA4BR,QAEhDG,kBAAoB,KAACG,oBAG5B,CAEA,QAASP,SAAS,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={},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{Filter}from"../Filter";import{useFilterStorage}from"./useFilterStorage";import{emptyFilterInternal}from"../utils";const FilterPersistent=_0=>{let{sessionStorageId,skipLoadingFromStorage=false}=_0,filterProps=_object_without_properties(_0,["sessionStorageId","skipLoadingFromStorage"]);const storage=useFilterStorage({filterName:sessionStorageId,onApply:filterProps.onApply,transformers:filterProps.transformer,initialState:filterProps.initialState,skipLoadingFromStorage});return _jsx(Filter,_object_spread_props(_object_spread({},filterProps),{initialState:filterProps.initialState||storage.initialState||emptyFilterInternal,onApply:(_,internal,meta)=>storage.handleFilterApply(internal,meta)}))};export{FilterPersistent};
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(Object(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{Filter}from"../Filter";import{useFilterStorage}from"./useFilterStorage";import{emptyFilterInternal}from"../utils";const FilterPersistent=_0=>{let{sessionStorageId,skipLoadingFromStorage=false}=_0,filterProps=_object_without_properties(_0,["sessionStorageId","skipLoadingFromStorage"]);const storage=useFilterStorage({filterName:sessionStorageId,onApply:filterProps.onApply,transformers:filterProps.transformer,initialState:filterProps.initialState,skipLoadingFromStorage});return _jsx(Filter,_object_spread_props(_object_spread({},filterProps),{initialState:filterProps.initialState||storage.initialState||emptyFilterInternal,onApply:(_,internal,meta)=>storage.handleFilterApply(internal,meta)}))};export{FilterPersistent};
2
2
  //# sourceMappingURL=FilterPersistent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/Filter/persistence/FilterPersistent.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { Filter, TFilterProps } from \"../Filter\"\nimport { useFilterStorage } from \"./useFilterStorage\"\nimport { emptyFilterInternal } from \"../utils\"\n\nexport type TFilterPersistent = TFilterProps & {\n sessionStorageId: string\n skipLoadingFromStorage?: boolean\n}\n\n/**\n * This is a wrapper for the Filter that intercepts the onApply callback to save the applied internal state into the sessionStorage.\n * If no initialState is passed, it loads the saved state into the Filter by passing it as the initialState itself.\n * Uses the same props as the filter including:\n * @param sessionStorageId unique id for correct persistence in the session storage\n * @param onApply Callback that gets called with arguments: DTO State (simpler state for API communication),\n * Internal State (Used for addons like SessionStorage persistance) and metadata (the event that triggered the apply)\n * @param config Configuration for the filter. Determines the **Attributes** with their corresponding **operators** and **value** types.\n * Both the **Attribute** and **Operator** can specify a *ControlType*.\n * When both have one specified, the **Operator** takes precedence over the **Attribute**\n * @param initialState Initial filter state on mount. If **undefined** it will load the stored Filter, otherwise it will use the *initialState*\n * @param readonly Boolean flag whether the filter is readonly\n * @param transformer Built-in data transformers to adjust the data based on specific needs.\n * This removes the hustle of going through individual terms after receiving the data through the onApply callback,\n * @param transformer.dtoValueTransformMap this transformer is a Record<string, function> type and is used to transform values based on their unique attribute name.\n * E.g. if you need to set a prefix before user-defined values in the Autocomplete, you can set this transformer to\n * { tag: (term) => term.values.map(x => \"tag-prefix-\"+x) } * @constructor\n */\nconst FilterPersistent: React.FC<TFilterPersistent> = ({\n sessionStorageId,\n skipLoadingFromStorage = false,\n ...filterProps\n}) => {\n const storage = useFilterStorage({\n filterName: sessionStorageId,\n onApply: filterProps.onApply,\n transformers: filterProps.transformer,\n initialState: filterProps.initialState,\n skipLoadingFromStorage,\n })\n return (\n <Filter\n {...filterProps}\n initialState={filterProps.initialState || storage.initialState || emptyFilterInternal}\n onApply={(_, internal, meta) => storage.handleFilterApply(internal, meta)}\n />\n )\n}\n\nexport { FilterPersistent }\n"],"names":["Filter","useFilterStorage","emptyFilterInternal","FilterPersistent","sessionStorageId","skipLoadingFromStorage","filterProps","storage","filterName","onApply","transformers","transformer","initialState","_","internal","meta","handleFilterApply"],"mappings":"0zEAIA,QAASA,MAAM,KAAsB,WAAW,AAChD,QAASC,gBAAgB,KAAQ,oBAAoB,AACrD,QAASC,mBAAmB,KAAQ,UAAU,CAyB9C,MAAMC,iBAAgD,QAAC,CACrDC,gBAAgB,CAChBC,uBAAyB,KAAK,CAE/B,IADIC,yFAEH,MAAMC,QAAUN,iBAAiB,CAC/BO,WAAYJ,iBACZK,QAASH,YAAYG,OAAO,CAC5BC,aAAcJ,YAAYK,WAAW,CACrCC,aAAcN,YAAYM,YAAY,CACtCP,sBACF,GACA,OACE,KAACL,8CACKM,cACJM,aAAcN,YAAYM,YAAY,EAAIL,QAAQK,YAAY,EAAIV,oBAClEO,QAAS,CAACI,EAAGC,SAAUC,OAASR,QAAQS,iBAAiB,CAACF,SAAUC,QAG1E,CAEA,QAASZ,gBAAgB,CAAE"}
1
+ {"version":3,"sources":["../../../../../src/components/Filter/persistence/FilterPersistent.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { Filter, TFilterProps } from \"../Filter\"\nimport { useFilterStorage } from \"./useFilterStorage\"\nimport { emptyFilterInternal } from \"../utils\"\n\nexport type TFilterPersistent = TFilterProps & {\n sessionStorageId: string\n skipLoadingFromStorage?: boolean\n}\n\n/**\n * This is a wrapper for the Filter that intercepts the onApply callback to save the applied internal state into the sessionStorage.\n * If no initialState is passed, it loads the saved state into the Filter by passing it as the initialState itself.\n * Uses the same props as the filter including:\n * @param sessionStorageId unique id for correct persistence in the session storage\n * @param onApply Callback that gets called with arguments: DTO State (simpler state for API communication),\n * Internal State (Used for addons like SessionStorage persistance) and metadata (the event that triggered the apply)\n * @param config Configuration for the filter. Determines the **Attributes** with their corresponding **operators** and **value** types.\n * Both the **Attribute** and **Operator** can specify a *ControlType*.\n * When both have one specified, the **Operator** takes precedence over the **Attribute**\n * @param initialState Initial filter state on mount. If **undefined** it will load the stored Filter, otherwise it will use the *initialState*\n * @param readonly Boolean flag whether the filter is readonly\n * @param transformer Built-in data transformers to adjust the data based on specific needs.\n * This removes the hustle of going through individual terms after receiving the data through the onApply callback,\n * @param transformer.dtoValueTransformMap this transformer is a Record<string, function> type and is used to transform values based on their unique attribute name.\n * E.g. if you need to set a prefix before user-defined values in the Autocomplete, you can set this transformer to\n * { tag: (term) => term.values.map(x => \"tag-prefix-\"+x) } * @constructor\n */\nconst FilterPersistent: React.FC<TFilterPersistent> = ({\n sessionStorageId,\n skipLoadingFromStorage = false,\n ...filterProps\n}) => {\n const storage = useFilterStorage({\n filterName: sessionStorageId,\n onApply: filterProps.onApply,\n transformers: filterProps.transformer,\n initialState: filterProps.initialState,\n skipLoadingFromStorage,\n })\n return (\n <Filter\n {...filterProps}\n initialState={filterProps.initialState || storage.initialState || emptyFilterInternal}\n onApply={(_, internal, meta) => storage.handleFilterApply(internal, meta)}\n />\n )\n}\n\nexport { FilterPersistent }\n"],"names":["Filter","useFilterStorage","emptyFilterInternal","FilterPersistent","sessionStorageId","skipLoadingFromStorage","filterProps","storage","filterName","onApply","transformers","transformer","initialState","_","internal","meta","handleFilterApply"],"mappings":"k0EAIA,QAASA,MAAM,KAAsB,WAAW,AAChD,QAASC,gBAAgB,KAAQ,oBAAoB,AACrD,QAASC,mBAAmB,KAAQ,UAAU,CAyB9C,MAAMC,iBAAgD,QAAC,CACrDC,gBAAgB,CAChBC,uBAAyB,KAAK,CAE/B,IADIC,yFAEH,MAAMC,QAAUN,iBAAiB,CAC/BO,WAAYJ,iBACZK,QAASH,YAAYG,OAAO,CAC5BC,aAAcJ,YAAYK,WAAW,CACrCC,aAAcN,YAAYM,YAAY,CACtCP,sBACF,GACA,OACE,KAACL,8CACKM,cACJM,aAAcN,YAAYM,YAAY,EAAIL,QAAQK,YAAY,EAAIV,oBAClEO,QAAS,CAACI,EAAGC,SAAUC,OAASR,QAAQS,iBAAiB,CAACF,SAAUC,QAG1E,CAEA,QAASZ,gBAAgB,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={},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{useMantineColorScheme,useMantineTheme}from"@mantine/core";import{components}from"react-select";import React from"react";import{Select}from"./Select";import{useFilter}from"./hooks/useFilter";import{useTranslation}from"react-i18next";import{TextWithTooltip}from"../../TextWithTooltip";import classes from"./FilterSelect.module.css";import{Z_INDEX_LAYER}from"../../../theme";export const FilterInputWrapper=({children})=>{return _jsx("div",{className:classes.container,"data-testid":"filter-select-container",onClick:e=>{e.stopPropagation()},children:children})};const MultiValueLabelWithTranslation=props=>{const{t}=useTranslation();const toRender=typeof props.children==="string"?_jsx(TextWithTooltip,{typoType:"body",text:t(props.children)}):props.children;return _jsx(components.MultiValueLabel,_object_spread_props(_object_spread({},props),{children:toRender}))};const FilterSelect=_0=>{let{creatable,onBlur,onChange,onKeyDown,multiple,withTranslation,value,options}=_0,props=_object_without_properties(_0,["creatable","onBlur","onChange","onKeyDown","multiple","withTranslation","value","options"]);const theme=useMantineTheme();const{colorScheme}=useMantineColorScheme();const isDarkScheme=colorScheme==="dark";const{portalTargetRef}=useFilter();return _jsx(FilterInputWrapper,{children:_jsx(Select,_object_spread_props(_object_spread({multiple:multiple,menuPortalTarget:portalTargetRef===null||portalTargetRef===void 0?void 0:portalTargetRef.current,onChange:(newValue,actionMeta)=>{if(Array.isArray(newValue)){onChange===null||onChange===void 0?void 0:onChange(newValue,actionMeta)}const value=newValue;onChange===null||onChange===void 0?void 0:onChange(value,actionMeta)}},props),{onKeyDown:onKeyDown,onBlur:onBlur,menuIsOpen:true,value:Array.isArray(value)?value.map(x=>({value:x,label:x})):value,closeMenuOnSelect:!multiple,autoFocus:true,styles:{control:base=>_object_spread_props(_object_spread({},base),{minHeight:30,backgroundColor:isDarkScheme?theme.colors.gray[8]:base.backgroundColor,color:isDarkScheme?theme.white:base.backgroundColor}),option:(base,{isFocused})=>{return _object_spread_props(_object_spread({},base),{backgroundColor:isFocused?isDarkScheme?theme.colors.green[7]:theme.colors.green[0]:isDarkScheme?theme.colors.gray[9]:base.backgroundColor,"&:active":{backgroundColor:isDarkScheme?theme.colors.green[7]:theme.colors.green[0]},color:isDarkScheme?theme.white:base.color})},multiValue:base=>_object_spread_props(_object_spread({},base),{borderRadius:"2px",backgroundColor:isDarkScheme?theme.colors.gray[7]:theme.colors.gray[1],color:isDarkScheme?theme.white:theme.colors.gray[9]}),multiValueLabel:base=>_object_spread_props(_object_spread({},base),{color:isDarkScheme?theme.white:theme.colors.gray[9]}),multiValueRemove:base=>_object_spread_props(_object_spread({},base),{color:isDarkScheme?theme.white:theme.colors.gray[9],"&:hover":{backgroundColor:"inherit",borderRadius:"2px",cursor:"pointer",color:isDarkScheme?theme.black:theme.white}}),input:base=>isDarkScheme?_object_spread_props(_object_spread({},base),{color:theme.white}):base,dropdownIndicator:base=>_object_spread_props(_object_spread({},base),{paddingTop:0,paddingBottom:0}),clearIndicator:base=>_object_spread_props(_object_spread({},base),{paddingTop:0,paddingBottom:0}),menu:base=>_object_spread_props(_object_spread({},base),{overflow:"visible",border:`1px solid ${isDarkScheme?theme.colors.gray[8]:theme.colors.gray[2]}`,borderRadius:"2px",backgroundColor:isDarkScheme?theme.colors.gray[9]:base.backgroundColor}),menuPortal:base=>_object_spread_props(_object_spread({},base),{zIndex:Z_INDEX_LAYER.GROUND.HIGHEST})},options:options,creatable:creatable,hideSelectedOptions:true,noOptionsMessage:()=>null,isClearable:true,components:{DropdownIndicator:()=>null,IndicatorSeparator:()=>null,MultiValueLabel:withTranslation?MultiValueLabelWithTranslation:components.MultiValueLabel}}))})};export{FilterSelect};
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(Object(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{useMantineColorScheme,useMantineTheme}from"@mantine/core";import{components}from"react-select";import React from"react";import{Select}from"./Select";import{useFilter}from"./hooks/useFilter";import{useTranslation}from"react-i18next";import{TextWithTooltip}from"../../TextWithTooltip";import classes from"./FilterSelect.module.css";import{Z_INDEX_LAYER}from"../../../theme";export const FilterInputWrapper=({children})=>{return _jsx("div",{className:classes.container,"data-testid":"filter-select-container",onClick:e=>{e.stopPropagation()},children:children})};const MultiValueLabelWithTranslation=props=>{const{t}=useTranslation();const toRender=typeof props.children==="string"?_jsx(TextWithTooltip,{typoType:"body",text:t(props.children)}):props.children;return _jsx(components.MultiValueLabel,_object_spread_props(_object_spread({},props),{children:toRender}))};const FilterSelect=_0=>{let{creatable,onBlur,onChange,onKeyDown,multiple,withTranslation,value,options}=_0,props=_object_without_properties(_0,["creatable","onBlur","onChange","onKeyDown","multiple","withTranslation","value","options"]);const theme=useMantineTheme();const{colorScheme}=useMantineColorScheme();const isDarkScheme=colorScheme==="dark";const{portalTargetRef}=useFilter();return _jsx(FilterInputWrapper,{children:_jsx(Select,_object_spread_props(_object_spread({multiple:multiple,menuPortalTarget:portalTargetRef===null||portalTargetRef===void 0?void 0:portalTargetRef.current,onChange:(newValue,actionMeta)=>{if(Array.isArray(newValue)){onChange===null||onChange===void 0?void 0:onChange(newValue,actionMeta)}const value=newValue;onChange===null||onChange===void 0?void 0:onChange(value,actionMeta)}},props),{onKeyDown:onKeyDown,onBlur:onBlur,menuIsOpen:true,value:Array.isArray(value)?value.map(x=>({value:x,label:x})):value,closeMenuOnSelect:!multiple,autoFocus:true,styles:{control:base=>_object_spread_props(_object_spread({},base),{minHeight:30,backgroundColor:isDarkScheme?theme.colors.gray[8]:base.backgroundColor,color:isDarkScheme?theme.white:base.backgroundColor}),option:(base,{isFocused})=>{return _object_spread_props(_object_spread({},base),{backgroundColor:isFocused?isDarkScheme?theme.colors.green[7]:theme.colors.green[0]:isDarkScheme?theme.colors.gray[9]:base.backgroundColor,"&:active":{backgroundColor:isDarkScheme?theme.colors.green[7]:theme.colors.green[0]},color:isDarkScheme?theme.white:base.color})},multiValue:base=>_object_spread_props(_object_spread({},base),{borderRadius:"2px",backgroundColor:isDarkScheme?theme.colors.gray[7]:theme.colors.gray[1],color:isDarkScheme?theme.white:theme.colors.gray[9]}),multiValueLabel:base=>_object_spread_props(_object_spread({},base),{color:isDarkScheme?theme.white:theme.colors.gray[9]}),multiValueRemove:base=>_object_spread_props(_object_spread({},base),{color:isDarkScheme?theme.white:theme.colors.gray[9],"&:hover":{backgroundColor:"inherit",borderRadius:"2px",cursor:"pointer",color:isDarkScheme?theme.black:theme.white}}),input:base=>isDarkScheme?_object_spread_props(_object_spread({},base),{color:theme.white}):base,dropdownIndicator:base=>_object_spread_props(_object_spread({},base),{paddingTop:0,paddingBottom:0}),clearIndicator:base=>_object_spread_props(_object_spread({},base),{paddingTop:0,paddingBottom:0}),menu:base=>_object_spread_props(_object_spread({},base),{overflow:"visible",border:`1px solid ${isDarkScheme?theme.colors.gray[8]:theme.colors.gray[2]}`,borderRadius:"2px",backgroundColor:isDarkScheme?theme.colors.gray[9]:base.backgroundColor}),menuPortal:base=>_object_spread_props(_object_spread({},base),{zIndex:Z_INDEX_LAYER.GROUND.HIGHEST})},options:options,creatable:creatable,hideSelectedOptions:true,noOptionsMessage:()=>null,isClearable:true,components:{DropdownIndicator:()=>null,IndicatorSeparator:()=>null,MultiValueLabel:withTranslation?MultiValueLabelWithTranslation:components.MultiValueLabel}}))})};export{FilterSelect};
2
2
  //# sourceMappingURL=FilterSelect.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/Filter/utils/FilterSelect.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { useMantineColorScheme, useMantineTheme } from \"@mantine/core\"\nimport {\n ActionMeta,\n components,\n CSSObjectWithLabel,\n GroupBase,\n MultiValueGenericProps,\n} from \"react-select\"\nimport React, { FC, FocusEventHandler, KeyboardEventHandler, PropsWithChildren } from \"react\"\nimport { Select } from \"./Select\"\nimport { StateManagerProps } from \"react-select/dist/declarations/src/useStateManager\"\nimport { TFilter, TSelectOnChangeReturn, TSelectOnChangeReturnArray } from \"./types\"\nimport { useFilter } from \"./hooks/useFilter\"\nimport { useTranslation } from \"react-i18next\"\nimport { TextWithTooltip } from \"../../TextWithTooltip\"\nimport classes from \"./FilterSelect.module.css\"\nimport { Z_INDEX_LAYER } from \"../../../theme\"\n\ntype TFilterSelectProps = StateManagerProps & {\n creatable?: boolean\n onChange?: (\n newValue: TSelectOnChangeReturn | TSelectOnChangeReturnArray,\n actionMeta: ActionMeta<unknown>\n ) => void\n onBlur?: FocusEventHandler\n onKeyDown?: KeyboardEventHandler\n multiple?: boolean\n completed?: boolean\n options?: StateManagerProps[\"options\"]\n type?: TFilter.ConfigItem[\"control\"][\"type\"]\n value?: TFilter.Internal.Term.TermValue\n withTranslation?: boolean\n}\n\nexport const FilterInputWrapper: FC<PropsWithChildren> = ({ children }) => {\n return (\n <div\n className={classes.container}\n data-testid={\"filter-select-container\"}\n onClick={(e) => {\n e.stopPropagation()\n }}\n >\n {children}\n </div>\n )\n}\n\nconst MultiValueLabelWithTranslation = (\n props: MultiValueGenericProps<unknown, boolean, GroupBase<unknown>>\n) => {\n const { t } = useTranslation()\n const toRender =\n typeof props.children === \"string\" ? (\n <TextWithTooltip typoType={\"body\"} text={t(props.children)} />\n ) : (\n props.children\n )\n\n return <components.MultiValueLabel {...props}>{toRender}</components.MultiValueLabel>\n}\n\n/**\n * A @ReactSelect Select component wrapper for the filter.\n * @param creatable Whether you can add new values or not (*Autocomplete*)\n * @param onBlur Callback that is called when the select is blurred\n * @param onChange Callback that is called when the Select value changes\n * @param onKeyDown Callback that is called when a keyDown event occurs\n * @param multiple Whether you can add multiple values or not (*multiselect*)\n * @param withTranslation (DEPRECATED) Please wrap your filter options with **useTranslateFilterOptions(options) hook**\n * @param value An initial TermValue\n * @param options DropDown options\n * @param props Props for the ReactSelect element\n */\nconst FilterSelect: React.FC<React.PropsWithChildren<TFilterSelectProps>> = ({\n creatable,\n onBlur,\n onChange,\n onKeyDown,\n multiple,\n withTranslation,\n value,\n options,\n ...props\n}) => {\n const theme = useMantineTheme()\n const { colorScheme } = useMantineColorScheme()\n const isDarkScheme = colorScheme === \"dark\"\n const { portalTargetRef } = useFilter()\n return (\n <FilterInputWrapper>\n <Select\n multiple={multiple}\n menuPortalTarget={portalTargetRef?.current}\n onChange={(newValue, actionMeta) => {\n if (Array.isArray(newValue)) {\n onChange?.(newValue as TSelectOnChangeReturnArray, actionMeta)\n }\n const value = newValue as TSelectOnChangeReturn\n onChange?.(value, actionMeta)\n }}\n {...props}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n menuIsOpen={true}\n value={Array.isArray(value) ? value.map((x) => ({ value: x, label: x })) : value}\n closeMenuOnSelect={!multiple}\n autoFocus={true}\n styles={{\n control: (base) =>\n ({\n ...base,\n minHeight: 30,\n backgroundColor: isDarkScheme ? theme.colors.gray[8] : base.backgroundColor,\n color: isDarkScheme ? theme.white : base.backgroundColor,\n }) as CSSObjectWithLabel,\n option: (base, { isFocused }) => {\n return {\n ...base,\n backgroundColor: isFocused\n ? isDarkScheme\n ? theme.colors.green[7]\n : theme.colors.green[0]\n : isDarkScheme\n ? theme.colors.gray[9]\n : base.backgroundColor,\n \"&:active\": {\n backgroundColor: isDarkScheme ? theme.colors.green[7] : theme.colors.green[0],\n },\n color: isDarkScheme ? theme.white : base.color,\n } as CSSObjectWithLabel\n },\n multiValue: (base) =>\n ({\n ...base,\n borderRadius: \"2px\",\n backgroundColor: isDarkScheme ? theme.colors.gray[7] : theme.colors.gray[1],\n color: isDarkScheme ? theme.white : theme.colors.gray[9],\n }) as CSSObjectWithLabel,\n multiValueLabel: (base) =>\n ({\n ...base,\n color: isDarkScheme ? theme.white : theme.colors.gray[9],\n }) as CSSObjectWithLabel,\n multiValueRemove: (base) =>\n ({\n ...base,\n color: isDarkScheme ? theme.white : theme.colors.gray[9],\n \"&:hover\": {\n backgroundColor: \"inherit\",\n borderRadius: \"2px\",\n cursor: \"pointer\",\n color: isDarkScheme ? theme.black : theme.white,\n },\n }) as CSSObjectWithLabel,\n input: (base) =>\n (isDarkScheme ? { ...base, color: theme.white } : base) as CSSObjectWithLabel,\n dropdownIndicator: (base) =>\n ({\n ...base,\n paddingTop: 0,\n paddingBottom: 0,\n }) as CSSObjectWithLabel,\n clearIndicator: (base) =>\n ({\n ...base,\n paddingTop: 0,\n paddingBottom: 0,\n }) as CSSObjectWithLabel,\n menu: (base) =>\n ({\n ...base,\n overflow: \"visible\",\n border: `1px solid ${isDarkScheme ? theme.colors.gray[8] : theme.colors.gray[2]}`,\n borderRadius: \"2px\",\n backgroundColor: isDarkScheme ? theme.colors.gray[9] : base.backgroundColor,\n }) as CSSObjectWithLabel,\n menuPortal: (base) => ({\n ...base,\n zIndex: Z_INDEX_LAYER.GROUND.HIGHEST,\n }),\n }}\n options={options}\n creatable={creatable}\n hideSelectedOptions={true}\n noOptionsMessage={() => null}\n isClearable={true}\n components={{\n DropdownIndicator: () => null,\n IndicatorSeparator: () => null,\n MultiValueLabel: withTranslation\n ? MultiValueLabelWithTranslation\n : components.MultiValueLabel,\n }}\n />\n </FilterInputWrapper>\n )\n}\n\nexport { FilterSelect }\n"],"names":["useMantineColorScheme","useMantineTheme","components","React","Select","useFilter","useTranslation","TextWithTooltip","classes","Z_INDEX_LAYER","FilterInputWrapper","children","div","className","container","data-testid","onClick","e","stopPropagation","MultiValueLabelWithTranslation","props","t","toRender","typoType","text","MultiValueLabel","FilterSelect","creatable","onBlur","onChange","onKeyDown","multiple","withTranslation","value","options","theme","colorScheme","isDarkScheme","portalTargetRef","menuPortalTarget","current","newValue","actionMeta","Array","isArray","menuIsOpen","map","x","label","closeMenuOnSelect","autoFocus","styles","control","base","minHeight","backgroundColor","colors","gray","color","white","option","isFocused","green","multiValue","borderRadius","multiValueLabel","multiValueRemove","cursor","black","input","dropdownIndicator","paddingTop","paddingBottom","clearIndicator","menu","overflow","border","menuPortal","zIndex","GROUND","HIGHEST","hideSelectedOptions","noOptionsMessage","isClearable","DropdownIndicator","IndicatorSeparator"],"mappings":"0zEAIA,QAASA,qBAAqB,CAAEC,eAAe,KAAQ,eAAe,AACtE,QAEEC,UAAU,KAIL,cAAc,AACrB,QAAOC,UAA+E,OAAO,AAC7F,QAASC,MAAM,KAAQ,UAAU,AAGjC,QAASC,SAAS,KAAQ,mBAAmB,AAC7C,QAASC,cAAc,KAAQ,eAAe,AAC9C,QAASC,eAAe,KAAQ,uBAAuB,AACvD,QAAOC,YAAa,2BAA2B,AAC/C,QAASC,aAAa,KAAQ,gBAAgB,AAkB9C,QAAO,MAAMC,mBAA4C,CAAC,CAAEC,QAAQ,CAAE,IACpE,OACE,KAACC,OACCC,UAAWL,QAAQM,SAAS,CAC5BC,cAAa,0BACbC,QAAS,AAACC,IACRA,EAAEC,eAAe,EACnB,WAECP,UAGP,CAAC,CAED,MAAMQ,+BAAiC,AACrCC,QAEA,KAAM,CAAEC,CAAC,CAAE,CAAGf,iBACd,MAAMgB,SACJ,OAAOF,MAAMT,QAAQ,GAAK,SACxB,KAACJ,iBAAgBgB,SAAU,OAAQC,KAAMH,EAAED,MAAMT,QAAQ,IAEzDS,MAAMT,QAAQ,CAGlB,OAAO,KAACT,WAAWuB,eAAe,wCAAKL,iBAAQE,WACjD,EAcA,MAAMI,aAAsE,QAAC,CAC3EC,SAAS,CACTC,MAAM,CACNC,QAAQ,CACRC,SAAS,CACTC,QAAQ,CACRC,eAAe,CACfC,KAAK,CACLC,OAAO,CAER,IADId,kIAEH,MAAMe,MAAQlC,kBACd,KAAM,CAAEmC,WAAW,CAAE,CAAGpC,wBACxB,MAAMqC,aAAeD,cAAgB,OACrC,KAAM,CAAEE,eAAe,CAAE,CAAGjC,YAC5B,OACE,KAACK,6BACC,KAACN,4CACC2B,SAAUA,SACVQ,gBAAgB,CAAED,wBAAAA,gCAAAA,gBAAiBE,OAAO,CAC1CX,SAAU,CAACY,SAAUC,cACnB,GAAIC,MAAMC,OAAO,CAACH,UAAW,CAC3BZ,iBAAAA,yBAAAA,SAAWY,SAAwCC,WACrD,CACA,MAAMT,MAAQQ,SACdZ,iBAAAA,yBAAAA,SAAWI,MAAOS,WACpB,GACItB,QACJU,UAAWA,UACXF,OAAQA,OACRiB,WAAY,KACZZ,MAAOU,MAAMC,OAAO,CAACX,OAASA,MAAMa,GAAG,CAAC,AAACC,GAAO,CAAA,CAAEd,MAAOc,EAAGC,MAAOD,CAAE,CAAA,GAAMd,MAC3EgB,kBAAmB,CAAClB,SACpBmB,UAAW,KACXC,OAAQ,CACNC,QAAS,AAACC,MACP,uCACIA,OACHC,UAAW,GACXC,gBAAiBlB,aAAeF,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAAGJ,KAAKE,eAAe,CAC3EG,MAAOrB,aAAeF,MAAMwB,KAAK,CAAGN,KAAKE,eAAe,GAE5DK,OAAQ,CAACP,KAAM,CAAEQ,SAAS,CAAE,IAC1B,OAAO,uCACFR,OACHE,gBAAiBM,UACbxB,aACEF,MAAMqB,MAAM,CAACM,KAAK,CAAC,EAAE,CACrB3B,MAAMqB,MAAM,CAACM,KAAK,CAAC,EAAE,CACvBzB,aACEF,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CACpBJ,KAAKE,eAAe,CAC1B,WAAY,CACVA,gBAAiBlB,aAAeF,MAAMqB,MAAM,CAACM,KAAK,CAAC,EAAE,CAAG3B,MAAMqB,MAAM,CAACM,KAAK,CAAC,EAAE,AAC/E,EACAJ,MAAOrB,aAAeF,MAAMwB,KAAK,CAAGN,KAAKK,KAAK,EAElD,EACAK,WAAY,AAACV,MACV,uCACIA,OACHW,aAAc,MACdT,gBAAiBlB,aAAeF,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAAGtB,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAC3EC,MAAOrB,aAAeF,MAAMwB,KAAK,CAAGxB,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,GAE5DQ,gBAAiB,AAACZ,MACf,uCACIA,OACHK,MAAOrB,aAAeF,MAAMwB,KAAK,CAAGxB,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,GAE5DS,iBAAkB,AAACb,MAChB,uCACIA,OACHK,MAAOrB,aAAeF,MAAMwB,KAAK,CAAGxB,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CACxD,UAAW,CACTF,gBAAiB,UACjBS,aAAc,MACdG,OAAQ,UACRT,MAAOrB,aAAeF,MAAMiC,KAAK,CAAGjC,MAAMwB,KAAK,AACjD,IAEJU,MAAO,AAAChB,MACLhB,aAAe,uCAAKgB,OAAMK,MAAOvB,MAAMwB,KAAK,GAAKN,KACpDiB,kBAAmB,AAACjB,MACjB,uCACIA,OACHkB,WAAY,EACZC,cAAe,IAEnBC,eAAgB,AAACpB,MACd,uCACIA,OACHkB,WAAY,EACZC,cAAe,IAEnBE,KAAM,AAACrB,MACJ,uCACIA,OACHsB,SAAU,UACVC,OAAQ,CAAC,UAAU,EAAEvC,aAAeF,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAAGtB,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAAC,CAAC,CACjFO,aAAc,MACdT,gBAAiBlB,aAAeF,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAAGJ,KAAKE,eAAe,GAE/EsB,WAAY,AAACxB,MAAU,uCAClBA,OACHyB,OAAQrE,cAAcsE,MAAM,CAACC,OAAO,EAExC,EACA9C,QAASA,QACTP,UAAWA,UACXsD,oBAAqB,KACrBC,iBAAkB,IAAM,KACxBC,YAAa,KACbjF,WAAY,CACVkF,kBAAmB,IAAM,KACzBC,mBAAoB,IAAM,KAC1B5D,gBAAiBO,gBACbb,+BACAjB,WAAWuB,eAAe,AAChC,MAIR,CAEA,QAASC,YAAY,CAAE"}
1
+ {"version":3,"sources":["../../../../../src/components/Filter/utils/FilterSelect.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { useMantineColorScheme, useMantineTheme } from \"@mantine/core\"\nimport {\n ActionMeta,\n components,\n CSSObjectWithLabel,\n GroupBase,\n MultiValueGenericProps,\n} from \"react-select\"\nimport React, { FC, FocusEventHandler, KeyboardEventHandler, PropsWithChildren } from \"react\"\nimport { Select } from \"./Select\"\nimport { StateManagerProps } from \"react-select/dist/declarations/src/useStateManager\"\nimport { TFilter, TSelectOnChangeReturn, TSelectOnChangeReturnArray } from \"./types\"\nimport { useFilter } from \"./hooks/useFilter\"\nimport { useTranslation } from \"react-i18next\"\nimport { TextWithTooltip } from \"../../TextWithTooltip\"\nimport classes from \"./FilterSelect.module.css\"\nimport { Z_INDEX_LAYER } from \"../../../theme\"\n\ntype TFilterSelectProps = StateManagerProps & {\n creatable?: boolean\n onChange?: (\n newValue: TSelectOnChangeReturn | TSelectOnChangeReturnArray,\n actionMeta: ActionMeta<unknown>\n ) => void\n onBlur?: FocusEventHandler\n onKeyDown?: KeyboardEventHandler\n multiple?: boolean\n completed?: boolean\n options?: StateManagerProps[\"options\"]\n type?: TFilter.ConfigItem[\"control\"][\"type\"]\n value?: TFilter.Internal.Term.TermValue\n withTranslation?: boolean\n}\n\nexport const FilterInputWrapper: FC<PropsWithChildren> = ({ children }) => {\n return (\n <div\n className={classes.container}\n data-testid={\"filter-select-container\"}\n onClick={(e) => {\n e.stopPropagation()\n }}\n >\n {children}\n </div>\n )\n}\n\nconst MultiValueLabelWithTranslation = (\n props: MultiValueGenericProps<unknown, boolean, GroupBase<unknown>>\n) => {\n const { t } = useTranslation()\n const toRender =\n typeof props.children === \"string\" ? (\n <TextWithTooltip typoType={\"body\"} text={t(props.children)} />\n ) : (\n props.children\n )\n\n return <components.MultiValueLabel {...props}>{toRender}</components.MultiValueLabel>\n}\n\n/**\n * A @ReactSelect Select component wrapper for the filter.\n * @param creatable Whether you can add new values or not (*Autocomplete*)\n * @param onBlur Callback that is called when the select is blurred\n * @param onChange Callback that is called when the Select value changes\n * @param onKeyDown Callback that is called when a keyDown event occurs\n * @param multiple Whether you can add multiple values or not (*multiselect*)\n * @param withTranslation (DEPRECATED) Please wrap your filter options with **useTranslateFilterOptions(options) hook**\n * @param value An initial TermValue\n * @param options DropDown options\n * @param props Props for the ReactSelect element\n */\nconst FilterSelect: React.FC<React.PropsWithChildren<TFilterSelectProps>> = ({\n creatable,\n onBlur,\n onChange,\n onKeyDown,\n multiple,\n withTranslation,\n value,\n options,\n ...props\n}) => {\n const theme = useMantineTheme()\n const { colorScheme } = useMantineColorScheme()\n const isDarkScheme = colorScheme === \"dark\"\n const { portalTargetRef } = useFilter()\n return (\n <FilterInputWrapper>\n <Select\n multiple={multiple}\n menuPortalTarget={portalTargetRef?.current}\n onChange={(newValue, actionMeta) => {\n if (Array.isArray(newValue)) {\n onChange?.(newValue as TSelectOnChangeReturnArray, actionMeta)\n }\n const value = newValue as TSelectOnChangeReturn\n onChange?.(value, actionMeta)\n }}\n {...props}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n menuIsOpen={true}\n value={Array.isArray(value) ? value.map((x) => ({ value: x, label: x })) : value}\n closeMenuOnSelect={!multiple}\n autoFocus={true}\n styles={{\n control: (base) =>\n ({\n ...base,\n minHeight: 30,\n backgroundColor: isDarkScheme ? theme.colors.gray[8] : base.backgroundColor,\n color: isDarkScheme ? theme.white : base.backgroundColor,\n }) as CSSObjectWithLabel,\n option: (base, { isFocused }) => {\n return {\n ...base,\n backgroundColor: isFocused\n ? isDarkScheme\n ? theme.colors.green[7]\n : theme.colors.green[0]\n : isDarkScheme\n ? theme.colors.gray[9]\n : base.backgroundColor,\n \"&:active\": {\n backgroundColor: isDarkScheme ? theme.colors.green[7] : theme.colors.green[0],\n },\n color: isDarkScheme ? theme.white : base.color,\n } as CSSObjectWithLabel\n },\n multiValue: (base) =>\n ({\n ...base,\n borderRadius: \"2px\",\n backgroundColor: isDarkScheme ? theme.colors.gray[7] : theme.colors.gray[1],\n color: isDarkScheme ? theme.white : theme.colors.gray[9],\n }) as CSSObjectWithLabel,\n multiValueLabel: (base) =>\n ({\n ...base,\n color: isDarkScheme ? theme.white : theme.colors.gray[9],\n }) as CSSObjectWithLabel,\n multiValueRemove: (base) =>\n ({\n ...base,\n color: isDarkScheme ? theme.white : theme.colors.gray[9],\n \"&:hover\": {\n backgroundColor: \"inherit\",\n borderRadius: \"2px\",\n cursor: \"pointer\",\n color: isDarkScheme ? theme.black : theme.white,\n },\n }) as CSSObjectWithLabel,\n input: (base) =>\n (isDarkScheme ? { ...base, color: theme.white } : base) as CSSObjectWithLabel,\n dropdownIndicator: (base) =>\n ({\n ...base,\n paddingTop: 0,\n paddingBottom: 0,\n }) as CSSObjectWithLabel,\n clearIndicator: (base) =>\n ({\n ...base,\n paddingTop: 0,\n paddingBottom: 0,\n }) as CSSObjectWithLabel,\n menu: (base) =>\n ({\n ...base,\n overflow: \"visible\",\n border: `1px solid ${isDarkScheme ? theme.colors.gray[8] : theme.colors.gray[2]}`,\n borderRadius: \"2px\",\n backgroundColor: isDarkScheme ? theme.colors.gray[9] : base.backgroundColor,\n }) as CSSObjectWithLabel,\n menuPortal: (base) => ({\n ...base,\n zIndex: Z_INDEX_LAYER.GROUND.HIGHEST,\n }),\n }}\n options={options}\n creatable={creatable}\n hideSelectedOptions={true}\n noOptionsMessage={() => null}\n isClearable={true}\n components={{\n DropdownIndicator: () => null,\n IndicatorSeparator: () => null,\n MultiValueLabel: withTranslation\n ? MultiValueLabelWithTranslation\n : components.MultiValueLabel,\n }}\n />\n </FilterInputWrapper>\n )\n}\n\nexport { FilterSelect }\n"],"names":["useMantineColorScheme","useMantineTheme","components","React","Select","useFilter","useTranslation","TextWithTooltip","classes","Z_INDEX_LAYER","FilterInputWrapper","children","div","className","container","data-testid","onClick","e","stopPropagation","MultiValueLabelWithTranslation","props","t","toRender","typoType","text","MultiValueLabel","FilterSelect","creatable","onBlur","onChange","onKeyDown","multiple","withTranslation","value","options","theme","colorScheme","isDarkScheme","portalTargetRef","menuPortalTarget","current","newValue","actionMeta","Array","isArray","menuIsOpen","map","x","label","closeMenuOnSelect","autoFocus","styles","control","base","minHeight","backgroundColor","colors","gray","color","white","option","isFocused","green","multiValue","borderRadius","multiValueLabel","multiValueRemove","cursor","black","input","dropdownIndicator","paddingTop","paddingBottom","clearIndicator","menu","overflow","border","menuPortal","zIndex","GROUND","HIGHEST","hideSelectedOptions","noOptionsMessage","isClearable","DropdownIndicator","IndicatorSeparator"],"mappings":"k0EAIA,QAASA,qBAAqB,CAAEC,eAAe,KAAQ,eAAe,AACtE,QAEEC,UAAU,KAIL,cAAc,AACrB,QAAOC,UAA+E,OAAO,AAC7F,QAASC,MAAM,KAAQ,UAAU,AAGjC,QAASC,SAAS,KAAQ,mBAAmB,AAC7C,QAASC,cAAc,KAAQ,eAAe,AAC9C,QAASC,eAAe,KAAQ,uBAAuB,AACvD,QAAOC,YAAa,2BAA2B,AAC/C,QAASC,aAAa,KAAQ,gBAAgB,AAkB9C,QAAO,MAAMC,mBAA4C,CAAC,CAAEC,QAAQ,CAAE,IACpE,OACE,KAACC,OACCC,UAAWL,QAAQM,SAAS,CAC5BC,cAAa,0BACbC,QAAS,AAACC,IACRA,EAAEC,eAAe,EACnB,WAECP,UAGP,CAAC,CAED,MAAMQ,+BAAiC,AACrCC,QAEA,KAAM,CAAEC,CAAC,CAAE,CAAGf,iBACd,MAAMgB,SACJ,OAAOF,MAAMT,QAAQ,GAAK,SACxB,KAACJ,iBAAgBgB,SAAU,OAAQC,KAAMH,EAAED,MAAMT,QAAQ,IAEzDS,MAAMT,QAAQ,CAGlB,OAAO,KAACT,WAAWuB,eAAe,wCAAKL,iBAAQE,WACjD,EAcA,MAAMI,aAAsE,QAAC,CAC3EC,SAAS,CACTC,MAAM,CACNC,QAAQ,CACRC,SAAS,CACTC,QAAQ,CACRC,eAAe,CACfC,KAAK,CACLC,OAAO,CAER,IADId,kIAEH,MAAMe,MAAQlC,kBACd,KAAM,CAAEmC,WAAW,CAAE,CAAGpC,wBACxB,MAAMqC,aAAeD,cAAgB,OACrC,KAAM,CAAEE,eAAe,CAAE,CAAGjC,YAC5B,OACE,KAACK,6BACC,KAACN,4CACC2B,SAAUA,SACVQ,gBAAgB,CAAED,wBAAAA,gCAAAA,gBAAiBE,OAAO,CAC1CX,SAAU,CAACY,SAAUC,cACnB,GAAIC,MAAMC,OAAO,CAACH,UAAW,CAC3BZ,iBAAAA,yBAAAA,SAAWY,SAAwCC,WACrD,CACA,MAAMT,MAAQQ,SACdZ,iBAAAA,yBAAAA,SAAWI,MAAOS,WACpB,GACItB,QACJU,UAAWA,UACXF,OAAQA,OACRiB,WAAY,KACZZ,MAAOU,MAAMC,OAAO,CAACX,OAASA,MAAMa,GAAG,CAAC,AAACC,GAAO,CAAA,CAAEd,MAAOc,EAAGC,MAAOD,CAAE,CAAA,GAAMd,MAC3EgB,kBAAmB,CAAClB,SACpBmB,UAAW,KACXC,OAAQ,CACNC,QAAS,AAACC,MACP,uCACIA,OACHC,UAAW,GACXC,gBAAiBlB,aAAeF,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAAGJ,KAAKE,eAAe,CAC3EG,MAAOrB,aAAeF,MAAMwB,KAAK,CAAGN,KAAKE,eAAe,GAE5DK,OAAQ,CAACP,KAAM,CAAEQ,SAAS,CAAE,IAC1B,OAAO,uCACFR,OACHE,gBAAiBM,UACbxB,aACEF,MAAMqB,MAAM,CAACM,KAAK,CAAC,EAAE,CACrB3B,MAAMqB,MAAM,CAACM,KAAK,CAAC,EAAE,CACvBzB,aACEF,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CACpBJ,KAAKE,eAAe,CAC1B,WAAY,CACVA,gBAAiBlB,aAAeF,MAAMqB,MAAM,CAACM,KAAK,CAAC,EAAE,CAAG3B,MAAMqB,MAAM,CAACM,KAAK,CAAC,EAAE,AAC/E,EACAJ,MAAOrB,aAAeF,MAAMwB,KAAK,CAAGN,KAAKK,KAAK,EAElD,EACAK,WAAY,AAACV,MACV,uCACIA,OACHW,aAAc,MACdT,gBAAiBlB,aAAeF,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAAGtB,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAC3EC,MAAOrB,aAAeF,MAAMwB,KAAK,CAAGxB,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,GAE5DQ,gBAAiB,AAACZ,MACf,uCACIA,OACHK,MAAOrB,aAAeF,MAAMwB,KAAK,CAAGxB,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,GAE5DS,iBAAkB,AAACb,MAChB,uCACIA,OACHK,MAAOrB,aAAeF,MAAMwB,KAAK,CAAGxB,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CACxD,UAAW,CACTF,gBAAiB,UACjBS,aAAc,MACdG,OAAQ,UACRT,MAAOrB,aAAeF,MAAMiC,KAAK,CAAGjC,MAAMwB,KAAK,AACjD,IAEJU,MAAO,AAAChB,MACLhB,aAAe,uCAAKgB,OAAMK,MAAOvB,MAAMwB,KAAK,GAAKN,KACpDiB,kBAAmB,AAACjB,MACjB,uCACIA,OACHkB,WAAY,EACZC,cAAe,IAEnBC,eAAgB,AAACpB,MACd,uCACIA,OACHkB,WAAY,EACZC,cAAe,IAEnBE,KAAM,AAACrB,MACJ,uCACIA,OACHsB,SAAU,UACVC,OAAQ,CAAC,UAAU,EAAEvC,aAAeF,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAAGtB,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAAC,CAAC,CACjFO,aAAc,MACdT,gBAAiBlB,aAAeF,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE,CAAGJ,KAAKE,eAAe,GAE/EsB,WAAY,AAACxB,MAAU,uCAClBA,OACHyB,OAAQrE,cAAcsE,MAAM,CAACC,OAAO,EAExC,EACA9C,QAASA,QACTP,UAAWA,UACXsD,oBAAqB,KACrBC,iBAAkB,IAAM,KACxBC,YAAa,KACbjF,WAAY,CACVkF,kBAAmB,IAAM,KACzBC,mBAAoB,IAAM,KAC1B5D,gBAAiBO,gBACbb,+BACAjB,WAAWuB,eAAe,AAChC,MAIR,CAEA,QAASC,YAAY,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 _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{default as ReactSelect}from"react-select";import CreatableSelect from"react-select/creatable";import React from"react";const Select=_0=>{let{creatable,onBlur,onChange,onKeyDown,multiple}=_0,props=_object_without_properties(_0,["creatable","onBlur","onChange","onKeyDown","multiple"]);if(creatable){return _jsx(CreatableSelect,_object_spread({isMulti:multiple,onChange:onChange,onKeyDown:onKeyDown,onBlur:onBlur,menuPlacement:"auto",menuPosition:"fixed",formatCreateLabel:v=>v,noOptionsMessage:()=>null,placeholder:""},props))}return _jsx(ReactSelect,_object_spread({menuPlacement:"auto",menuPosition:"fixed",noOptionsMessage:()=>null,placeholder:"",isMulti:multiple,onChange:onChange,onKeyDown:onKeyDown,onBlur:onBlur},props))};export{Select};
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 _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(Object(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{default as ReactSelect}from"react-select";import CreatableSelect from"react-select/creatable";import React from"react";const Select=_0=>{let{creatable,onBlur,onChange,onKeyDown,multiple}=_0,props=_object_without_properties(_0,["creatable","onBlur","onChange","onKeyDown","multiple"]);if(creatable){return _jsx(CreatableSelect,_object_spread({isMulti:multiple,onChange:onChange,onKeyDown:onKeyDown,onBlur:onBlur,menuPlacement:"auto",menuPosition:"fixed",formatCreateLabel:v=>v,noOptionsMessage:()=>null,placeholder:""},props))}return _jsx(ReactSelect,_object_spread({menuPlacement:"auto",menuPosition:"fixed",noOptionsMessage:()=>null,placeholder:"",isMulti:multiple,onChange:onChange,onKeyDown:onKeyDown,onBlur:onBlur},props))};export{Select};
2
2
  //# sourceMappingURL=Select.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/Filter/utils/Select.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ActionMeta, default as ReactSelect } from \"react-select\"\nimport CreatableSelect from \"react-select/creatable\"\nimport React, { FocusEventHandler, KeyboardEventHandler } from \"react\"\nimport { StateManagerProps } from \"react-select/dist/declarations/src/useStateManager\"\n\ntype TSelectProps = StateManagerProps & {\n creatable?: boolean\n onChange?: (newValue: { value: unknown; label: string }, actionMeta: ActionMeta<unknown>) => void\n onBlur?: FocusEventHandler\n onKeyDown?: KeyboardEventHandler\n multiple?: boolean\n}\n\nconst Select: React.FC<React.PropsWithChildren<TSelectProps>> = ({\n creatable,\n onBlur,\n onChange,\n onKeyDown,\n multiple,\n ...props\n}) => {\n if (creatable) {\n return (\n <CreatableSelect\n isMulti={multiple}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n menuPlacement=\"auto\"\n menuPosition=\"fixed\"\n formatCreateLabel={(v) => v}\n noOptionsMessage={() => null}\n placeholder={\"\"}\n {...props}\n />\n )\n }\n\n return (\n <ReactSelect\n menuPlacement=\"auto\"\n menuPosition=\"fixed\"\n noOptionsMessage={() => null}\n placeholder={\"\"}\n isMulti={multiple}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n {...props}\n />\n )\n}\n\nexport { Select }\n"],"names":["default","ReactSelect","CreatableSelect","React","Select","creatable","onBlur","onChange","onKeyDown","multiple","props","isMulti","menuPlacement","menuPosition","formatCreateLabel","v","noOptionsMessage","placeholder"],"mappings":"urDAIA,QAAqBA,WAAWC,WAAW,KAAQ,cAAc,AACjE,QAAOC,oBAAqB,wBAAwB,AACpD,QAAOC,UAAwD,OAAO,CAWtE,MAAMC,OAA0D,QAAC,CAC/DC,SAAS,CACTC,MAAM,CACNC,QAAQ,CACRC,SAAS,CACTC,QAAQ,CAET,IADIC,8FAEH,GAAIL,UAAW,CACb,OACE,KAACH,gCACCS,QAASF,SACTF,SAAUA,SACVC,UAAWA,UACXF,OAAQA,OACRM,cAAc,OACdC,aAAa,QACbC,kBAAmB,AAACC,GAAMA,EAC1BC,iBAAkB,IAAM,KACxBC,YAAa,IACTP,OAGV,CAEA,OACE,KAACT,4BACCW,cAAc,OACdC,aAAa,QACbG,iBAAkB,IAAM,KACxBC,YAAa,GACbN,QAASF,SACTF,SAAUA,SACVC,UAAWA,UACXF,OAAQA,QACJI,OAGV,CAEA,QAASN,MAAM,CAAE"}
1
+ {"version":3,"sources":["../../../../../src/components/Filter/utils/Select.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ActionMeta, default as ReactSelect } from \"react-select\"\nimport CreatableSelect from \"react-select/creatable\"\nimport React, { FocusEventHandler, KeyboardEventHandler } from \"react\"\nimport { StateManagerProps } from \"react-select/dist/declarations/src/useStateManager\"\n\ntype TSelectProps = StateManagerProps & {\n creatable?: boolean\n onChange?: (newValue: { value: unknown; label: string }, actionMeta: ActionMeta<unknown>) => void\n onBlur?: FocusEventHandler\n onKeyDown?: KeyboardEventHandler\n multiple?: boolean\n}\n\nconst Select: React.FC<React.PropsWithChildren<TSelectProps>> = ({\n creatable,\n onBlur,\n onChange,\n onKeyDown,\n multiple,\n ...props\n}) => {\n if (creatable) {\n return (\n <CreatableSelect\n isMulti={multiple}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n menuPlacement=\"auto\"\n menuPosition=\"fixed\"\n formatCreateLabel={(v) => v}\n noOptionsMessage={() => null}\n placeholder={\"\"}\n {...props}\n />\n )\n }\n\n return (\n <ReactSelect\n menuPlacement=\"auto\"\n menuPosition=\"fixed\"\n noOptionsMessage={() => null}\n placeholder={\"\"}\n isMulti={multiple}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n {...props}\n />\n )\n}\n\nexport { Select }\n"],"names":["default","ReactSelect","CreatableSelect","React","Select","creatable","onBlur","onChange","onKeyDown","multiple","props","isMulti","menuPlacement","menuPosition","formatCreateLabel","v","noOptionsMessage","placeholder"],"mappings":"+rDAIA,QAAqBA,WAAWC,WAAW,KAAQ,cAAc,AACjE,QAAOC,oBAAqB,wBAAwB,AACpD,QAAOC,UAAwD,OAAO,CAWtE,MAAMC,OAA0D,QAAC,CAC/DC,SAAS,CACTC,MAAM,CACNC,QAAQ,CACRC,SAAS,CACTC,QAAQ,CAET,IADIC,8FAEH,GAAIL,UAAW,CACb,OACE,KAACH,gCACCS,QAASF,SACTF,SAAUA,SACVC,UAAWA,UACXF,OAAQA,OACRM,cAAc,OACdC,aAAa,QACbC,kBAAmB,AAACC,GAAMA,EAC1BC,iBAAkB,IAAM,KACxBC,YAAa,IACTP,OAGV,CAEA,OACE,KAACT,4BACCW,cAAc,OACdC,aAAa,QACbG,iBAAkB,IAAM,KACxBC,YAAa,GACbN,QAASF,SACTF,SAAUA,SACVC,UAAWA,UACXF,OAAQA,QACJI,OAGV,CAEA,QAASN,MAAM,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={},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{Button as MantineButton}from"@mantine/core";import classes from"./Button.module.css";import{forwardRef}from"react";import{ICON_SIZES}from"../../../theme";export const Button=forwardRef((_0,_1)=>{let _ref=[_0,_1],[_ref1,..._rest]=_ref,{variant="filled",size="md",children,icon}=_ref1,rest=_object_without_properties(_ref1,["variant","size","children","icon"]),[ref]=_rest;const Icon=icon;return _jsx(MantineButton,_object_spread_props(_object_spread({variant:variant,size:size,classNames:_object_spread({},classes)},rest),{color:"red",leftSection:Icon&&_jsx(Icon,{size:ICON_SIZES.MEDIUM}),ref:ref,children:children}))});Button.displayName="Button";
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(Object(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{Button as MantineButton}from"@mantine/core";import classes from"./Button.module.css";import{forwardRef}from"react";import{ICON_SIZES}from"../../../theme";export const Button=forwardRef((_0,_1)=>{let _ref=[_0,_1],[_ref1,..._rest]=_ref,{variant="filled",size="md",children,icon}=_ref1,rest=_object_without_properties(_ref1,["variant","size","children","icon"]),[ref]=_rest;const Icon=icon;return _jsx(MantineButton,_object_spread_props(_object_spread({variant:variant,size:size,classNames:_object_spread({},classes)},rest),{color:"red",leftSection:Icon&&_jsx(Icon,{size:ICON_SIZES.MEDIUM}),ref:ref,children:children}))});Button.displayName="Button";
2
2
  //# sourceMappingURL=Button.js.map