@greenbone/ui-lib 2.1.1-alpha0 → 2.1.2-alpha0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) 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/Tag/Tag.module.css +1 -1
  76. package/lib/cjs/components/TimeZoneInfo/index.js +1 -1
  77. package/lib/cjs/components/TimeZoneInfo/index.js.map +1 -1
  78. package/lib/cjs/components/Tooltip/Tooltip.js +1 -1
  79. package/lib/cjs/components/Tooltip/Tooltip.js.map +1 -1
  80. package/lib/cjs/components/Typo/Typo.js +1 -1
  81. package/lib/cjs/components/Typo/Typo.js.map +1 -1
  82. package/lib/cjs/icons/StatusIcon/StatusIcon.js +1 -1
  83. package/lib/cjs/icons/StatusIcon/StatusIcon.js.map +1 -1
  84. package/lib/esm/components/Accordion/Accordion.js +1 -1
  85. package/lib/esm/components/Accordion/Accordion.js.map +1 -1
  86. package/lib/esm/components/Alert/Alert.js +1 -1
  87. package/lib/esm/components/Alert/Alert.js.map +1 -1
  88. package/lib/esm/components/ConfirmationDialog/ConfirmationDialog.js +1 -1
  89. package/lib/esm/components/ConfirmationDialog/ConfirmationDialog.js.map +1 -1
  90. package/lib/esm/components/Drawer/Drawer.js +1 -1
  91. package/lib/esm/components/Drawer/Drawer.js.map +1 -1
  92. package/lib/esm/components/Filter/TermContainer/Term/TermBadge.js +1 -1
  93. package/lib/esm/components/Filter/TermContainer/Term/TermBadge.js.map +1 -1
  94. package/lib/esm/components/Filter/persistence/FilterPersistent.js +1 -1
  95. package/lib/esm/components/Filter/persistence/FilterPersistent.js.map +1 -1
  96. package/lib/esm/components/Filter/utils/FilterSelect.js +1 -1
  97. package/lib/esm/components/Filter/utils/FilterSelect.js.map +1 -1
  98. package/lib/esm/components/Filter/utils/Select.js +1 -1
  99. package/lib/esm/components/Filter/utils/Select.js.map +1 -1
  100. package/lib/esm/components/Form/Button/Button.js +1 -1
  101. package/lib/esm/components/Form/Button/Button.js.map +1 -1
  102. package/lib/esm/components/Form/Checkbox/Checkbox.js +1 -1
  103. package/lib/esm/components/Form/Checkbox/Checkbox.js.map +1 -1
  104. package/lib/esm/components/Form/DateTimePicker/DateTimePicker.js +1 -1
  105. package/lib/esm/components/Form/DateTimePicker/DateTimePicker.js.map +1 -1
  106. package/lib/esm/components/Form/DateTimePicker/TimePicker.js +1 -1
  107. package/lib/esm/components/Form/DateTimePicker/TimePicker.js.map +1 -1
  108. package/lib/esm/components/Form/FileInput/FileInput.js +1 -1
  109. package/lib/esm/components/Form/FileInput/FileInput.js.map +1 -1
  110. package/lib/esm/components/Form/Form/Form.js +1 -1
  111. package/lib/esm/components/Form/Form/Form.js.map +1 -1
  112. package/lib/esm/components/Form/Input/Input.js +1 -1
  113. package/lib/esm/components/Form/Input/Input.js.map +1 -1
  114. package/lib/esm/components/Form/MenuButton/index.js +1 -1
  115. package/lib/esm/components/Form/MenuButton/index.js.map +1 -1
  116. package/lib/esm/components/Form/PasswordInput/PasswordInput.js +1 -1
  117. package/lib/esm/components/Form/PasswordInput/PasswordInput.js.map +1 -1
  118. package/lib/esm/components/Form/RadioButton/RadioButton.js +1 -1
  119. package/lib/esm/components/Form/RadioButton/RadioButton.js.map +1 -1
  120. package/lib/esm/components/Form/Select/Cascade/CascadeMenu.js +1 -1
  121. package/lib/esm/components/Form/Select/Cascade/CascadeMenu.js.map +1 -1
  122. package/lib/esm/components/Form/Select/Cascade/CascadeOption.js +1 -1
  123. package/lib/esm/components/Form/Select/Cascade/CascadeOption.js.map +1 -1
  124. package/lib/esm/components/Form/Select/Cascade/index.js +1 -1
  125. package/lib/esm/components/Form/Select/Cascade/index.js.map +1 -1
  126. package/lib/esm/components/Form/Select/CreatableSelect.js +1 -1
  127. package/lib/esm/components/Form/Select/CreatableSelect.js.map +1 -1
  128. package/lib/esm/components/Form/Select/Select.js +1 -1
  129. package/lib/esm/components/Form/Select/Select.js.map +1 -1
  130. package/lib/esm/components/Form/Switch/Switch.js +1 -1
  131. package/lib/esm/components/Form/Switch/Switch.js.map +1 -1
  132. package/lib/esm/components/Form/Textarea/Textarea.js +1 -1
  133. package/lib/esm/components/Form/Textarea/Textarea.js.map +1 -1
  134. package/lib/esm/components/Icon/Icon.js +1 -1
  135. package/lib/esm/components/Icon/Icon.js.map +1 -1
  136. package/lib/esm/components/InfoTip/InfoTip.js +1 -1
  137. package/lib/esm/components/InfoTip/InfoTip.js.map +1 -1
  138. package/lib/esm/components/InformationList/InformationList.js +1 -1
  139. package/lib/esm/components/InformationList/InformationList.js.map +1 -1
  140. package/lib/esm/components/Layout/AppNavigation/AppNavigationLink.js +1 -1
  141. package/lib/esm/components/Layout/AppNavigation/AppNavigationLink.js.map +1 -1
  142. package/lib/esm/components/Layout/SimplePageLayout/SimpleGrid.js +1 -1
  143. package/lib/esm/components/Layout/SimplePageLayout/SimpleGrid.js.map +1 -1
  144. package/lib/esm/components/Layout/SimplePageLayout/index.js +1 -1
  145. package/lib/esm/components/Layout/SimplePageLayout/index.js.map +1 -1
  146. package/lib/esm/components/Modal/Modal.js +1 -1
  147. package/lib/esm/components/Modal/Modal.js.map +1 -1
  148. package/lib/esm/components/Notification/notifications.js +1 -1
  149. package/lib/esm/components/Notification/notifications.js.map +1 -1
  150. package/lib/esm/components/Table/TableClientSide/TableClientSidePersistent/index.js +1 -1
  151. package/lib/esm/components/Table/TableClientSide/TableClientSidePersistent/index.js.map +1 -1
  152. package/lib/esm/components/Table/TableServerSide/TableServerSidePersistent/index.js +1 -1
  153. package/lib/esm/components/Table/TableServerSide/TableServerSidePersistent/index.js.map +1 -1
  154. package/lib/esm/components/Table/components/ActionMenu/ActionMenu.js +1 -1
  155. package/lib/esm/components/Table/components/ActionMenu/ActionMenu.js.map +1 -1
  156. package/lib/esm/components/Tag/Tag.js +1 -1
  157. package/lib/esm/components/Tag/Tag.js.map +1 -1
  158. package/lib/esm/components/Tag/Tag.module.css +1 -1
  159. package/lib/esm/components/TimeZoneInfo/index.js +1 -1
  160. package/lib/esm/components/TimeZoneInfo/index.js.map +1 -1
  161. package/lib/esm/components/Tooltip/Tooltip.js +1 -1
  162. package/lib/esm/components/Tooltip/Tooltip.js.map +1 -1
  163. package/lib/esm/components/Typo/Typo.js +1 -1
  164. package/lib/esm/components/Typo/Typo.js.map +1 -1
  165. package/lib/esm/icons/StatusIcon/StatusIcon.js +1 -1
  166. package/lib/esm/icons/StatusIcon/StatusIcon.js.map +1 -1
  167. package/package.json +22 -22
  168. package/types/src/components/Tag/Tag.d.ts +2 -1
  169. package/types/src/components/Tag/Tag.d.ts.map +1 -1
@@ -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{createElement as _createElement}from"react";import{Fragment}from"react";import{Typo}from"../Typo";import classes from"./InformationList.module.css";import{cx}from"../../helper/cx";const getLargestRow=rows=>{return rows.reduce((acc,curr)=>{if(curr.length>acc)return curr.length;return acc},0)};const buildFillerColumns=(rowItems,largestRowItems)=>{const filler=[];if(rowItems<largestRowItems){const delta=largestRowItems-rowItems;for(let i=0;i<delta;i++){filler.push(_jsx("span",{},i))}}return filler.length?filler:null};export const InformationList=_0=>{let{firstColumnBold=true}=_0,props=_object_without_properties(_0,["firstColumnBold"]);const columnsAmount=getLargestRow(props.items);const rowAmount=props.items.length;const firstColumFontWeight=firstColumnBold?500:"inherit";return _jsx("div",{className:cx(classes.list,props.classname),style:{display:"grid",columnGap:props.columnGap||"var(--mantine-spacing-md)",rowGap:props.rowGap||"var(--mantine-spacing-xs)",gridTemplateColumns:`repeat(${columnsAmount}, fit-content(${100/columnsAmount}%))`,gridTemplateRows:`repeat(${rowAmount}, 1fr)`},children:props.items.map((rowItems,rowIndex)=>_jsxs(Fragment,{children:[rowItems.map((item,colIndex)=>_createElement(Typo,_object_spread_props(_object_spread({miw:colIndex===0?props.firstColumnMinWidth:undefined,type:"body",fw:colIndex===0?firstColumFontWeight:"inherit"},props.typoWrapperProps),{key:`${rowIndex}-${colIndex}`,className:classes.cell}),item)),buildFillerColumns(rowItems.length,columnsAmount)]},rowIndex))})};
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{createElement as _createElement}from"react";import{Fragment}from"react";import{Typo}from"../Typo";import classes from"./InformationList.module.css";import{cx}from"../../helper/cx";const getLargestRow=rows=>{return rows.reduce((acc,curr)=>{if(curr.length>acc)return curr.length;return acc},0)};const buildFillerColumns=(rowItems,largestRowItems)=>{const filler=[];if(rowItems<largestRowItems){const delta=largestRowItems-rowItems;for(let i=0;i<delta;i++){filler.push(_jsx("span",{},i))}}return filler.length?filler:null};export const InformationList=_0=>{let{firstColumnBold=true}=_0,props=_object_without_properties(_0,["firstColumnBold"]);const columnsAmount=getLargestRow(props.items);const rowAmount=props.items.length;const firstColumFontWeight=firstColumnBold?500:"inherit";return _jsx("div",{className:cx(classes.list,props.classname),style:{display:"grid",columnGap:props.columnGap||"var(--mantine-spacing-md)",rowGap:props.rowGap||"var(--mantine-spacing-xs)",gridTemplateColumns:`repeat(${columnsAmount}, fit-content(${100/columnsAmount}%))`,gridTemplateRows:`repeat(${rowAmount}, 1fr)`},children:props.items.map((rowItems,rowIndex)=>_jsxs(Fragment,{children:[rowItems.map((item,colIndex)=>_createElement(Typo,_object_spread_props(_object_spread({miw:colIndex===0?props.firstColumnMinWidth:undefined,type:"body",fw:colIndex===0?firstColumFontWeight:"inherit"},props.typoWrapperProps),{key:`${rowIndex}-${colIndex}`,className:classes.cell}),item)),buildFillerColumns(rowItems.length,columnsAmount)]},rowIndex))})};
2
2
  //# sourceMappingURL=InformationList.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/InformationList/InformationList.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { FC, Fragment, ReactNode } from \"react\"\nimport { TTypoProps, Typo } from \"../Typo\"\nimport classes from \"./InformationList.module.css\"\nimport { cx } from \"../../helper/cx\"\n\ntype TSharedDesignProps = {\n rowGap?: string\n columnGap?: string\n}\n\ntype TInformationListDesignProps = TSharedDesignProps & {\n firstColumnMinWidth?: string | number\n typoWrapperProps?: Partial<TTypoProps>\n classname?: string\n}\n\nexport type TInformationListItems = Array<(ReactNode | string)[]>\n\nexport type TInformationListProps = TInformationListDesignProps & {\n items: TInformationListItems\n firstColumnBold?: boolean\n}\n\nconst getLargestRow = (rows: TInformationListItems) => {\n return rows.reduce((acc, curr) => {\n if (curr.length > acc) return curr.length\n return acc\n }, 0)\n}\n\nconst buildFillerColumns = (rowItems: number, largestRowItems: number): ReactNode | null => {\n const filler: ReactNode[] = []\n if (rowItems < largestRowItems) {\n const delta = largestRowItems - rowItems\n for (let i = 0; i < delta; i++) {\n filler.push(<span key={i}></span>)\n }\n }\n return filler.length ? filler : null\n}\n\n/**\n * Provides an arranged list of information giving a table like appearance\n * @param firstColumnBold Controls whether the first column should be written in bold letters\n * @param firstColumnMinWidth If defined it sets the first column's minimal width\n * @param typoWrapperProps Props to change font appearance as defined in TTypoProps\n * @param classname Class name for additional styles\n */\nexport const InformationList: FC<TInformationListProps> = ({\n firstColumnBold = true,\n ...props\n}) => {\n const columnsAmount = getLargestRow(props.items)\n\n const rowAmount = props.items.length\n\n const firstColumFontWeight = firstColumnBold ? 500 : \"inherit\"\n\n return (\n <div\n className={cx(classes.list, props.classname)}\n style={{\n display: \"grid\",\n columnGap: props.columnGap || \"var(--mantine-spacing-md)\",\n rowGap: props.rowGap || \"var(--mantine-spacing-xs)\",\n gridTemplateColumns: `repeat(${columnsAmount}, fit-content(${100 / columnsAmount}%))`,\n gridTemplateRows: `repeat(${rowAmount}, 1fr)`,\n }}\n >\n {props.items.map((rowItems, rowIndex) => (\n <Fragment key={rowIndex}>\n {rowItems.map((item, colIndex) => (\n <Typo\n miw={colIndex === 0 ? props.firstColumnMinWidth : undefined}\n type={\"body\"}\n fw={colIndex === 0 ? firstColumFontWeight : \"inherit\"}\n {...props.typoWrapperProps}\n key={`${rowIndex}-${colIndex}`}\n className={classes.cell}\n >\n {item}\n </Typo>\n ))}\n {buildFillerColumns(rowItems.length, columnsAmount)}\n </Fragment>\n ))}\n </div>\n )\n}\n"],"names":["Fragment","Typo","classes","cx","getLargestRow","rows","reduce","acc","curr","length","buildFillerColumns","rowItems","largestRowItems","filler","delta","i","push","span","InformationList","firstColumnBold","props","columnsAmount","items","rowAmount","firstColumFontWeight","div","className","list","classname","style","display","columnGap","rowGap","gridTemplateColumns","gridTemplateRows","map","rowIndex","item","colIndex","miw","firstColumnMinWidth","undefined","type","fw","typoWrapperProps","key","cell"],"mappings":"23EAIA,QAAaA,QAAQ,KAAmB,OAAO,AAC/C,QAAqBC,IAAI,KAAQ,SAAS,AAC1C,QAAOC,YAAa,8BAA8B,AAClD,QAASC,EAAE,KAAQ,iBAAiB,CAoBpC,MAAMC,cAAgB,AAACC,OACrB,OAAOA,KAAKC,MAAM,CAAC,CAACC,IAAKC,QACvB,GAAIA,KAAKC,MAAM,CAAGF,IAAK,OAAOC,KAAKC,MAAM,CACzC,OAAOF,GACT,EAAG,EACL,EAEA,MAAMG,mBAAqB,CAACC,SAAkBC,mBAC5C,MAAMC,OAAsB,EAAE,CAC9B,GAAIF,SAAWC,gBAAiB,CAC9B,MAAME,MAAQF,gBAAkBD,SAChC,IAAK,IAAII,EAAI,EAAGA,EAAID,MAAOC,IAAK,CAC9BF,OAAOG,IAAI,CAAC,KAACC,UAAUF,GACzB,CACF,CACA,OAAOF,OAAOJ,MAAM,CAAGI,OAAS,IAClC,CASA,QAAO,MAAMK,gBAA6C,QAAC,CACzDC,gBAAkB,IAAI,CAEvB,IADIC,yDAEH,MAAMC,cAAgBjB,cAAcgB,MAAME,KAAK,EAE/C,MAAMC,UAAYH,MAAME,KAAK,CAACb,MAAM,CAEpC,MAAMe,qBAAuBL,gBAAkB,IAAM,UAErD,OACE,KAACM,OACCC,UAAWvB,GAAGD,QAAQyB,IAAI,CAAEP,MAAMQ,SAAS,EAC3CC,MAAO,CACLC,QAAS,OACTC,UAAWX,MAAMW,SAAS,EAAI,4BAC9BC,OAAQZ,MAAMY,MAAM,EAAI,4BACxBC,oBAAqB,CAAC,OAAO,EAAEZ,cAAc,cAAc,EAAE,IAAMA,cAAc,GAAG,CAAC,CACrFa,iBAAkB,CAAC,OAAO,EAAEX,UAAU,MAAM,CAAC,AAC/C,WAECH,MAAME,KAAK,CAACa,GAAG,CAAC,CAACxB,SAAUyB,WAC1B,MAACpC,oBACEW,SAASwB,GAAG,CAAC,CAACE,KAAMC,WACnB,eAACrC,0CACCsC,IAAKD,WAAa,EAAIlB,MAAMoB,mBAAmB,CAAGC,UAClDC,KAAM,OACNC,GAAIL,WAAa,EAAId,qBAAuB,WACxCJ,MAAMwB,gBAAgB,GAC1BC,IAAK,CAAC,EAAET,SAAS,CAAC,EAAEE,SAAS,CAAC,CAC9BZ,UAAWxB,QAAQ4C,IAAI,GAEtBT,OAGJ3B,mBAAmBC,SAASF,MAAM,CAAEY,iBAbxBe,YAkBvB,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/InformationList/InformationList.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { FC, Fragment, ReactNode } from \"react\"\nimport { TTypoProps, Typo } from \"../Typo\"\nimport classes from \"./InformationList.module.css\"\nimport { cx } from \"../../helper/cx\"\n\ntype TSharedDesignProps = {\n rowGap?: string\n columnGap?: string\n}\n\ntype TInformationListDesignProps = TSharedDesignProps & {\n firstColumnMinWidth?: string | number\n typoWrapperProps?: Partial<TTypoProps>\n classname?: string\n}\n\nexport type TInformationListItems = Array<(ReactNode | string)[]>\n\nexport type TInformationListProps = TInformationListDesignProps & {\n items: TInformationListItems\n firstColumnBold?: boolean\n}\n\nconst getLargestRow = (rows: TInformationListItems) => {\n return rows.reduce((acc, curr) => {\n if (curr.length > acc) return curr.length\n return acc\n }, 0)\n}\n\nconst buildFillerColumns = (rowItems: number, largestRowItems: number): ReactNode | null => {\n const filler: ReactNode[] = []\n if (rowItems < largestRowItems) {\n const delta = largestRowItems - rowItems\n for (let i = 0; i < delta; i++) {\n filler.push(<span key={i}></span>)\n }\n }\n return filler.length ? filler : null\n}\n\n/**\n * Provides an arranged list of information giving a table like appearance\n * @param firstColumnBold Controls whether the first column should be written in bold letters\n * @param firstColumnMinWidth If defined it sets the first column's minimal width\n * @param typoWrapperProps Props to change font appearance as defined in TTypoProps\n * @param classname Class name for additional styles\n */\nexport const InformationList: FC<TInformationListProps> = ({\n firstColumnBold = true,\n ...props\n}) => {\n const columnsAmount = getLargestRow(props.items)\n\n const rowAmount = props.items.length\n\n const firstColumFontWeight = firstColumnBold ? 500 : \"inherit\"\n\n return (\n <div\n className={cx(classes.list, props.classname)}\n style={{\n display: \"grid\",\n columnGap: props.columnGap || \"var(--mantine-spacing-md)\",\n rowGap: props.rowGap || \"var(--mantine-spacing-xs)\",\n gridTemplateColumns: `repeat(${columnsAmount}, fit-content(${100 / columnsAmount}%))`,\n gridTemplateRows: `repeat(${rowAmount}, 1fr)`,\n }}\n >\n {props.items.map((rowItems, rowIndex) => (\n <Fragment key={rowIndex}>\n {rowItems.map((item, colIndex) => (\n <Typo\n miw={colIndex === 0 ? props.firstColumnMinWidth : undefined}\n type={\"body\"}\n fw={colIndex === 0 ? firstColumFontWeight : \"inherit\"}\n {...props.typoWrapperProps}\n key={`${rowIndex}-${colIndex}`}\n className={classes.cell}\n >\n {item}\n </Typo>\n ))}\n {buildFillerColumns(rowItems.length, columnsAmount)}\n </Fragment>\n ))}\n </div>\n )\n}\n"],"names":["Fragment","Typo","classes","cx","getLargestRow","rows","reduce","acc","curr","length","buildFillerColumns","rowItems","largestRowItems","filler","delta","i","push","span","InformationList","firstColumnBold","props","columnsAmount","items","rowAmount","firstColumFontWeight","div","className","list","classname","style","display","columnGap","rowGap","gridTemplateColumns","gridTemplateRows","map","rowIndex","item","colIndex","miw","firstColumnMinWidth","undefined","type","fw","typoWrapperProps","key","cell"],"mappings":"m4EAIA,QAAaA,QAAQ,KAAmB,OAAO,AAC/C,QAAqBC,IAAI,KAAQ,SAAS,AAC1C,QAAOC,YAAa,8BAA8B,AAClD,QAASC,EAAE,KAAQ,iBAAiB,CAoBpC,MAAMC,cAAgB,AAACC,OACrB,OAAOA,KAAKC,MAAM,CAAC,CAACC,IAAKC,QACvB,GAAIA,KAAKC,MAAM,CAAGF,IAAK,OAAOC,KAAKC,MAAM,CACzC,OAAOF,GACT,EAAG,EACL,EAEA,MAAMG,mBAAqB,CAACC,SAAkBC,mBAC5C,MAAMC,OAAsB,EAAE,CAC9B,GAAIF,SAAWC,gBAAiB,CAC9B,MAAME,MAAQF,gBAAkBD,SAChC,IAAK,IAAII,EAAI,EAAGA,EAAID,MAAOC,IAAK,CAC9BF,OAAOG,IAAI,CAAC,KAACC,UAAUF,GACzB,CACF,CACA,OAAOF,OAAOJ,MAAM,CAAGI,OAAS,IAClC,CASA,QAAO,MAAMK,gBAA6C,QAAC,CACzDC,gBAAkB,IAAI,CAEvB,IADIC,yDAEH,MAAMC,cAAgBjB,cAAcgB,MAAME,KAAK,EAE/C,MAAMC,UAAYH,MAAME,KAAK,CAACb,MAAM,CAEpC,MAAMe,qBAAuBL,gBAAkB,IAAM,UAErD,OACE,KAACM,OACCC,UAAWvB,GAAGD,QAAQyB,IAAI,CAAEP,MAAMQ,SAAS,EAC3CC,MAAO,CACLC,QAAS,OACTC,UAAWX,MAAMW,SAAS,EAAI,4BAC9BC,OAAQZ,MAAMY,MAAM,EAAI,4BACxBC,oBAAqB,CAAC,OAAO,EAAEZ,cAAc,cAAc,EAAE,IAAMA,cAAc,GAAG,CAAC,CACrFa,iBAAkB,CAAC,OAAO,EAAEX,UAAU,MAAM,CAAC,AAC/C,WAECH,MAAME,KAAK,CAACa,GAAG,CAAC,CAACxB,SAAUyB,WAC1B,MAACpC,oBACEW,SAASwB,GAAG,CAAC,CAACE,KAAMC,WACnB,eAACrC,0CACCsC,IAAKD,WAAa,EAAIlB,MAAMoB,mBAAmB,CAAGC,UAClDC,KAAM,OACNC,GAAIL,WAAa,EAAId,qBAAuB,WACxCJ,MAAMwB,gBAAgB,GAC1BC,IAAK,CAAC,EAAET,SAAS,CAAC,EAAEE,SAAS,CAAC,CAC9BZ,UAAWxB,QAAQ4C,IAAI,GAEtBT,OAGJ3B,mBAAmBC,SAASF,MAAM,CAAEY,iBAbxBe,YAkBvB,CAAC"}
@@ -1,2 +1,2 @@
1
- function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import{Badge,NavLink}from"@mantine/core";import classes from"./AppNavigationLink.module.css";const AppNavigationLinkUntyped=_0=>{let{rightSection,active,children}=_0,other=_object_without_properties(_0,["rightSection","active","children"]);return _jsx(NavLink,_object_spread_props(_object_spread({classNames:_object_spread({root:`${classes.root} ${active?classes["root-active"]:classes["root-inactive"]}`,label:classes.label,section:classes.section,children:classes.children},other.classNames),rightSection:rightSection&&_jsx(Badge,{classNames:{root:classes["badge-root"]},children:rightSection})},other),{children:children}))};const AppNavigationLink=AppNavigationLinkUntyped;export{AppNavigationLink};
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{Badge,NavLink}from"@mantine/core";import classes from"./AppNavigationLink.module.css";const AppNavigationLinkUntyped=_0=>{let{rightSection,active,children}=_0,other=_object_without_properties(_0,["rightSection","active","children"]);return _jsx(NavLink,_object_spread_props(_object_spread({classNames:_object_spread({root:`${classes.root} ${active?classes["root-active"]:classes["root-inactive"]}`,label:classes.label,section:classes.section,children:classes.children},other.classNames),rightSection:rightSection&&_jsx(Badge,{classNames:{root:classes["badge-root"]},children:rightSection})},other),{children:children}))};const AppNavigationLink=AppNavigationLinkUntyped;export{AppNavigationLink};
2
2
  //# sourceMappingURL=AppNavigationLink.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/Layout/AppNavigation/AppNavigationLink.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { NavLinkProps } from \"@mantine/core\"\nimport { Badge, NavLink } from \"@mantine/core\"\nimport classes from \"./AppNavigationLink.module.css\"\n\nconst AppNavigationLinkUntyped = ({ rightSection, active, children, ...other }: NavLinkProps) => {\n return (\n <NavLink\n classNames={{\n root: `${classes.root} ${active ? classes[\"root-active\"] : classes[\"root-inactive\"]}`,\n label: classes.label,\n section: classes.section,\n children: classes.children,\n ...other.classNames,\n }}\n rightSection={\n rightSection && (\n <Badge\n classNames={{\n root: classes[\"badge-root\"],\n }}\n >\n {rightSection}\n </Badge>\n )\n }\n {...other}\n >\n {children}\n </NavLink>\n )\n}\n\nconst AppNavigationLink = AppNavigationLinkUntyped as typeof NavLink\n\nexport { AppNavigationLink }\n"],"names":["Badge","NavLink","classes","AppNavigationLinkUntyped","rightSection","active","children","other","classNames","root","label","section","AppNavigationLink"],"mappings":"0zEAKA,QAASA,KAAK,CAAEC,OAAO,KAAQ,eAAe,AAC9C,QAAOC,YAAa,gCAAgC,CAEpD,MAAMC,yBAA2B,QAAC,CAAEC,YAAY,CAAEC,MAAM,CAAEC,QAAQ,CAA0B,IAArBC,0EACrE,OACE,KAACN,6CACCO,WAAY,gBACVC,KAAM,CAAC,EAAEP,QAAQO,IAAI,CAAC,CAAC,EAAEJ,OAASH,OAAO,CAAC,cAAc,CAAGA,OAAO,CAAC,gBAAgB,CAAC,CAAC,CACrFQ,MAAOR,QAAQQ,KAAK,CACpBC,QAAST,QAAQS,OAAO,CACxBL,SAAUJ,QAAQI,QAAQ,EACvBC,MAAMC,UAAU,EAErBJ,aACEA,cACE,KAACJ,OACCQ,WAAY,CACVC,KAAMP,OAAO,CAAC,aAAa,AAC7B,WAECE,gBAIHG,iBAEHD,WAGP,EAEA,MAAMM,kBAAoBT,wBAE1B,QAASS,iBAAiB,CAAE"}
1
+ {"version":3,"sources":["../../../../../src/components/Layout/AppNavigation/AppNavigationLink.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport type { NavLinkProps } from \"@mantine/core\"\nimport { Badge, NavLink } from \"@mantine/core\"\nimport classes from \"./AppNavigationLink.module.css\"\n\nconst AppNavigationLinkUntyped = ({ rightSection, active, children, ...other }: NavLinkProps) => {\n return (\n <NavLink\n classNames={{\n root: `${classes.root} ${active ? classes[\"root-active\"] : classes[\"root-inactive\"]}`,\n label: classes.label,\n section: classes.section,\n children: classes.children,\n ...other.classNames,\n }}\n rightSection={\n rightSection && (\n <Badge\n classNames={{\n root: classes[\"badge-root\"],\n }}\n >\n {rightSection}\n </Badge>\n )\n }\n {...other}\n >\n {children}\n </NavLink>\n )\n}\n\nconst AppNavigationLink = AppNavigationLinkUntyped as typeof NavLink\n\nexport { AppNavigationLink }\n"],"names":["Badge","NavLink","classes","AppNavigationLinkUntyped","rightSection","active","children","other","classNames","root","label","section","AppNavigationLink"],"mappings":"k0EAKA,QAASA,KAAK,CAAEC,OAAO,KAAQ,eAAe,AAC9C,QAAOC,YAAa,gCAAgC,CAEpD,MAAMC,yBAA2B,QAAC,CAAEC,YAAY,CAAEC,MAAM,CAAEC,QAAQ,CAA0B,IAArBC,0EACrE,OACE,KAACN,6CACCO,WAAY,gBACVC,KAAM,CAAC,EAAEP,QAAQO,IAAI,CAAC,CAAC,EAAEJ,OAASH,OAAO,CAAC,cAAc,CAAGA,OAAO,CAAC,gBAAgB,CAAC,CAAC,CACrFQ,MAAOR,QAAQQ,KAAK,CACpBC,QAAST,QAAQS,OAAO,CACxBL,SAAUJ,QAAQI,QAAQ,EACvBC,MAAMC,UAAU,EAErBJ,aACEA,cACE,KAACJ,OACCQ,WAAY,CACVC,KAAMP,OAAO,CAAC,aAAa,AAC7B,WAECE,gBAIHG,iBAEHD,WAGP,EAEA,MAAMM,kBAAoBT,wBAE1B,QAASS,iBAAiB,CAAE"}
@@ -1,2 +1,2 @@
1
- function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import classes from"./SimpleGrid.module.css";export const SimpleGrid=_0=>{let{config}=_0,styleProps=_object_without_properties(_0,["config"]);return _jsx("div",{className:`${classes["grid-container"]} ${styleProps.hScroll?classes.hScroll:""}`,style:{padding:styleProps.padding||`0 var(--mantine-spacing-md)`,margin:styleProps.margin||"",gridTemplateAreas:`"${styleProps.gridTemplateAreas.join('" "')}"`,gridTemplateColumns:styleProps.gridTemplateColumns,gridTemplateRows:styleProps.gridTemplateRows,gap:styleProps.gap||""},children:Object.entries(config).map(([gridArea,element])=>_jsx("div",{className:classes.area,style:{gridArea},children:element},gridArea))})};
1
+ function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(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 React from"react";import classes from"./SimpleGrid.module.css";export const SimpleGrid=_0=>{let{config}=_0,styleProps=_object_without_properties(_0,["config"]);return _jsx("div",{className:`${classes["grid-container"]} ${styleProps.hScroll?classes.hScroll:""}`,style:{padding:styleProps.padding||`0 var(--mantine-spacing-md)`,margin:styleProps.margin||"",gridTemplateAreas:`"${styleProps.gridTemplateAreas.join('" "')}"`,gridTemplateColumns:styleProps.gridTemplateColumns,gridTemplateRows:styleProps.gridTemplateRows,gap:styleProps.gap||""},children:Object.entries(config).map(([gridArea,element])=>_jsx("div",{className:classes.area,style:{gridArea},children:element},gridArea))})};
2
2
  //# sourceMappingURL=SimpleGrid.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/Layout/SimplePageLayout/SimpleGrid.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React, { ReactNode } from \"react\"\nimport classes from \"./SimpleGrid.module.css\"\nexport type TSimpleGridStyling = {\n gridTemplateAreas: string[]\n gridTemplateColumns: string\n gridTemplateRows: string\n gap?: string\n margin?: string\n padding?: string\n hScroll?: boolean\n}\n\ntype TSimpleGridProps = TSimpleGridStyling & {\n config: Record<string, ReactNode>\n}\n\n/**\n * Generic grid wrapper that renders areas from a config map.\n * Supports spacing props and optional horizontal scrolling.\n * @param config Mapping of grid-area names to React nodes.\n * @param gridTemplateAreas Array describing grid-template-areas rows.\n * @param gridTemplateColumns CSS grid-template-columns value.\n * @param gridTemplateRows CSS grid-template-rows value.\n * @param gap Optional CSS gap between grid areas.\n * @param margin Optional CSS margin for the grid container.\n * @param padding Optional CSS padding for the grid container.\n * @param hScroll When true, applies a min-width to enable horizontal scrolling on narrow viewports.\n */\nexport const SimpleGrid: React.FC<TSimpleGridProps> = ({ config, ...styleProps }) => {\n return (\n <div\n className={`${classes[\"grid-container\"]} ${styleProps.hScroll ? classes.hScroll : \"\"}`}\n style={{\n padding: styleProps.padding || `0 var(--mantine-spacing-md)`,\n margin: styleProps.margin || \"\",\n gridTemplateAreas: `\"${styleProps.gridTemplateAreas.join('\" \"')}\"`,\n gridTemplateColumns: styleProps.gridTemplateColumns,\n gridTemplateRows: styleProps.gridTemplateRows,\n gap: styleProps.gap || \"\",\n }}\n >\n {Object.entries(config).map(([gridArea, element]: [string, ReactNode]) => (\n <div key={gridArea} className={classes.area} style={{ gridArea }}>\n {element}\n </div>\n ))}\n </div>\n )\n}\n"],"names":["React","classes","SimpleGrid","config","styleProps","div","className","hScroll","style","padding","margin","gridTemplateAreas","join","gridTemplateColumns","gridTemplateRows","gap","Object","entries","map","gridArea","element","area"],"mappings":"mlCAIA,QAAOA,UAA0B,OAAO,AACxC,QAAOC,YAAa,yBAAyB,AA2B7C,QAAO,MAAMC,WAAyC,QAAC,CAAEC,MAAM,CAAiB,IAAZC,qDAClE,OACE,KAACC,OACCC,UAAW,CAAC,EAAEL,OAAO,CAAC,iBAAiB,CAAC,CAAC,EAAEG,WAAWG,OAAO,CAAGN,QAAQM,OAAO,CAAG,GAAG,CAAC,CACtFC,MAAO,CACLC,QAASL,WAAWK,OAAO,EAAI,CAAC,2BAA2B,CAAC,CAC5DC,OAAQN,WAAWM,MAAM,EAAI,GAC7BC,kBAAmB,CAAC,CAAC,EAAEP,WAAWO,iBAAiB,CAACC,IAAI,CAAC,OAAO,CAAC,CAAC,CAClEC,oBAAqBT,WAAWS,mBAAmB,CACnDC,iBAAkBV,WAAWU,gBAAgB,CAC7CC,IAAKX,WAAWW,GAAG,EAAI,EACzB,WAECC,OAAOC,OAAO,CAACd,QAAQe,GAAG,CAAC,CAAC,CAACC,SAAUC,QAA6B,GACnE,KAACf,OAAmBC,UAAWL,QAAQoB,IAAI,CAAEb,MAAO,CAAEW,QAAS,WAC5DC,SADOD,YAMlB,CAAC"}
1
+ {"version":3,"sources":["../../../../../src/components/Layout/SimplePageLayout/SimpleGrid.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React, { ReactNode } from \"react\"\nimport classes from \"./SimpleGrid.module.css\"\nexport type TSimpleGridStyling = {\n gridTemplateAreas: string[]\n gridTemplateColumns: string\n gridTemplateRows: string\n gap?: string\n margin?: string\n padding?: string\n hScroll?: boolean\n}\n\ntype TSimpleGridProps = TSimpleGridStyling & {\n config: Record<string, ReactNode>\n}\n\n/**\n * Generic grid wrapper that renders areas from a config map.\n * Supports spacing props and optional horizontal scrolling.\n * @param config Mapping of grid-area names to React nodes.\n * @param gridTemplateAreas Array describing grid-template-areas rows.\n * @param gridTemplateColumns CSS grid-template-columns value.\n * @param gridTemplateRows CSS grid-template-rows value.\n * @param gap Optional CSS gap between grid areas.\n * @param margin Optional CSS margin for the grid container.\n * @param padding Optional CSS padding for the grid container.\n * @param hScroll When true, applies a min-width to enable horizontal scrolling on narrow viewports.\n */\nexport const SimpleGrid: React.FC<TSimpleGridProps> = ({ config, ...styleProps }) => {\n return (\n <div\n className={`${classes[\"grid-container\"]} ${styleProps.hScroll ? classes.hScroll : \"\"}`}\n style={{\n padding: styleProps.padding || `0 var(--mantine-spacing-md)`,\n margin: styleProps.margin || \"\",\n gridTemplateAreas: `\"${styleProps.gridTemplateAreas.join('\" \"')}\"`,\n gridTemplateColumns: styleProps.gridTemplateColumns,\n gridTemplateRows: styleProps.gridTemplateRows,\n gap: styleProps.gap || \"\",\n }}\n >\n {Object.entries(config).map(([gridArea, element]: [string, ReactNode]) => (\n <div key={gridArea} className={classes.area} style={{ gridArea }}>\n {element}\n </div>\n ))}\n </div>\n )\n}\n"],"names":["React","classes","SimpleGrid","config","styleProps","div","className","hScroll","style","padding","margin","gridTemplateAreas","join","gridTemplateColumns","gridTemplateRows","gap","Object","entries","map","gridArea","element","area"],"mappings":"2lCAIA,QAAOA,UAA0B,OAAO,AACxC,QAAOC,YAAa,yBAAyB,AA2B7C,QAAO,MAAMC,WAAyC,QAAC,CAAEC,MAAM,CAAiB,IAAZC,qDAClE,OACE,KAACC,OACCC,UAAW,CAAC,EAAEL,OAAO,CAAC,iBAAiB,CAAC,CAAC,EAAEG,WAAWG,OAAO,CAAGN,QAAQM,OAAO,CAAG,GAAG,CAAC,CACtFC,MAAO,CACLC,QAASL,WAAWK,OAAO,EAAI,CAAC,2BAA2B,CAAC,CAC5DC,OAAQN,WAAWM,MAAM,EAAI,GAC7BC,kBAAmB,CAAC,CAAC,EAAEP,WAAWO,iBAAiB,CAACC,IAAI,CAAC,OAAO,CAAC,CAAC,CAClEC,oBAAqBT,WAAWS,mBAAmB,CACnDC,iBAAkBV,WAAWU,gBAAgB,CAC7CC,IAAKX,WAAWW,GAAG,EAAI,EACzB,WAECC,OAAOC,OAAO,CAACd,QAAQe,GAAG,CAAC,CAAC,CAACC,SAAUC,QAA6B,GACnE,KAACf,OAAmBC,UAAWL,QAAQoB,IAAI,CAAEb,MAAO,CAAEW,QAAS,WAC5DC,SADOD,YAMlB,CAAC"}
@@ -1,2 +1,2 @@
1
- function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import{SimpleGrid}from"./SimpleGrid";import{Typo}from"../../Typo";import classes from"./index.module.css";export const SimplePageLayout=_0=>{let{children,title,Button,Breadcrumbs}=_0,gridProps=_object_without_properties(_0,["children","title","Button","Breadcrumbs"]);return _jsx(SimpleGrid,{config:{title:_jsx("div",{className:classes.title,children:_jsx(Typo,{type:"heading2",children:title})}),button:Button?_jsx("div",{className:classes.button,children:Button}):null,content:_jsx("div",{className:classes.content,children:children}),breadcrumbs:Breadcrumbs?_jsx("div",{className:classes.breadcrumbs,children:Breadcrumbs}):null},gridTemplateAreas:[...Breadcrumbs?["breadcrumbs breadcrumbs breadcrumbs"]:[],"title . button","content content content"],gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:`${Breadcrumbs?"35px":""} 66px 1fr`,gap:gridProps.gap,margin:"-1rem -1rem 0 -1rem",padding:gridProps.padding,hScroll:gridProps.hScroll})};export const SimplePageLayoutComplex=props=>{return _jsx(SimplePageLayout,{title:props.title,Button:props.Button,hScroll:props.hScroll,children:_jsx(SimpleGrid,_object_spread_props(_object_spread({},props),{padding:props.padding||"0"}))})};
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 React from"react";import{SimpleGrid}from"./SimpleGrid";import{Typo}from"../../Typo";import classes from"./index.module.css";export const SimplePageLayout=_0=>{let{children,title,Button,Breadcrumbs}=_0,gridProps=_object_without_properties(_0,["children","title","Button","Breadcrumbs"]);return _jsx(SimpleGrid,{config:{title:_jsx("div",{className:classes.title,children:_jsx(Typo,{type:"heading2",children:title})}),button:Button?_jsx("div",{className:classes.button,children:Button}):null,content:_jsx("div",{className:classes.content,children:children}),breadcrumbs:Breadcrumbs?_jsx("div",{className:classes.breadcrumbs,children:Breadcrumbs}):null},gridTemplateAreas:[...Breadcrumbs?["breadcrumbs breadcrumbs breadcrumbs"]:[],"title . button","content content content"],gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:`${Breadcrumbs?"35px":""} 66px 1fr`,gap:gridProps.gap,margin:"-1rem -1rem 0 -1rem",padding:gridProps.padding,hScroll:gridProps.hScroll})};export const SimplePageLayoutComplex=props=>{return _jsx(SimplePageLayout,{title:props.title,Button:props.Button,hScroll:props.hScroll,children:_jsx(SimpleGrid,_object_spread_props(_object_spread({},props),{padding:props.padding||"0"}))})};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/Layout/SimplePageLayout/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React, { ReactNode } from \"react\"\nimport { SimpleGrid, TSimpleGridStyling } from \"./SimpleGrid\"\nimport { Typo } from \"../../Typo\"\nimport classes from \"./index.module.css\"\n\nexport type TSimplePageLayoutProps = Partial<TSimpleGridStyling> & {\n title: string\n Button?: ReactNode\n children?: ReactNode\n Breadcrumbs?: ReactNode\n}\n\n/**\n * Renders a simple page layout with title, optional breadcrumbs and action button.\n * Uses a 3-column grid and exposes styling props for spacing and horizontal scroll.\n * @param title Page title displayed as heading2.\n * @param Button Optional action element rendered in the header's right side.\n * @param Breadcrumbs Optional breadcrumbs rendered above the title.\n * @param children Main content area.\n * @param gap Optional CSS gap between grid areas.\n * @param padding Optional padding for the grid container.\n * @param hScroll When true, enforces a min-width to allow horizontal scrolling on smaller viewports.\n */\nexport const SimplePageLayout: React.FC<TSimplePageLayoutProps> = ({\n children,\n title,\n Button,\n Breadcrumbs,\n ...gridProps\n}) => {\n return (\n <SimpleGrid\n config={{\n title: (\n <div className={classes.title}>\n <Typo type=\"heading2\">{title}</Typo>\n </div>\n ),\n button: Button ? <div className={classes.button}>{Button}</div> : null,\n content: <div className={classes.content}>{children}</div>,\n breadcrumbs: Breadcrumbs ? <div className={classes.breadcrumbs}>{Breadcrumbs}</div> : null,\n }}\n gridTemplateAreas={[\n ...(Breadcrumbs ? [\"breadcrumbs breadcrumbs breadcrumbs\"] : []),\n \"title . button\",\n \"content content content\",\n ]}\n gridTemplateColumns={\"1fr 1fr 1fr\"}\n gridTemplateRows={`${Breadcrumbs ? \"35px\" : \"\"} 66px 1fr`}\n gap={gridProps.gap}\n margin={\"-1rem -1rem 0 -1rem\"}\n padding={gridProps.padding}\n hScroll={gridProps.hScroll}\n />\n )\n}\n\nexport type TSimplePageLayoutComplex = TSimpleGridStyling & {\n title: string\n Button?: ReactNode\n config: Record<string, ReactNode>\n}\n\n/**\n * Complex variant that composes SimplePageLayout with a configurable SimpleGrid.\n * Forwards styling props (including hScroll) and renders additional grid areas via config.\n * @param title Page title.\n * @param Button Optional action element rendered in the header's right side.\n * @param config Mapping of grid-area names to React nodes.\n * @param gridTemplateAreas CSS grid-template-areas definition.\n * @param gridTemplateColumns CSS grid-template-columns definition.\n * @param gridTemplateRows CSS grid-template-rows definition.\n * @param gap Optional CSS gap between grid areas.\n * @param margin Optional CSS margin for the grid container.\n * @param padding Optional CSS padding for the grid container (defaults to \"0\" for inner grid).\n * @param hScroll When true, enforces a min-width to allow horizontal scrolling on smaller viewports.\n */\nexport const SimplePageLayoutComplex = (props: TSimplePageLayoutComplex) => {\n return (\n <SimplePageLayout title={props.title} Button={props.Button} hScroll={props.hScroll}>\n <SimpleGrid {...props} padding={props.padding || \"0\"} />\n </SimplePageLayout>\n )\n}\n"],"names":["React","SimpleGrid","Typo","classes","SimplePageLayout","children","title","Button","Breadcrumbs","gridProps","config","div","className","type","button","content","breadcrumbs","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","gap","margin","padding","hScroll","SimplePageLayoutComplex","props"],"mappings":"0zEAIA,QAAOA,UAA0B,OAAO,AACxC,QAASC,UAAU,KAA4B,cAAc,AAC7D,QAASC,IAAI,KAAQ,YAAY,AACjC,QAAOC,YAAa,oBAAoB,AAoBxC,QAAO,MAAMC,iBAAqD,QAAC,CACjEC,QAAQ,CACRC,KAAK,CACLC,MAAM,CACNC,WAAW,CAEZ,IADIC,qFAEH,OACE,KAACR,YACCS,OAAQ,CACNJ,MACE,KAACK,OAAIC,UAAWT,QAAQG,KAAK,UAC3B,KAACJ,MAAKW,KAAK,oBAAYP,UAG3BQ,OAAQP,OAAS,KAACI,OAAIC,UAAWT,QAAQW,MAAM,UAAGP,SAAgB,KAClEQ,QAAS,KAACJ,OAAIC,UAAWT,QAAQY,OAAO,UAAGV,WAC3CW,YAAaR,YAAc,KAACG,OAAIC,UAAWT,QAAQa,WAAW,UAAGR,cAAqB,IACxF,EACAS,kBAAmB,IACbT,YAAc,CAAC,sCAAsC,CAAG,EAAE,CAC9D,iBACA,0BACD,CACDU,oBAAqB,cACrBC,iBAAkB,CAAC,EAAEX,YAAc,OAAS,GAAG,SAAS,CAAC,CACzDY,IAAKX,UAAUW,GAAG,CAClBC,OAAQ,sBACRC,QAASb,UAAUa,OAAO,CAC1BC,QAASd,UAAUc,OAAO,EAGhC,CAAC,AAsBD,QAAO,MAAMC,wBAA0B,AAACC,QACtC,OACE,KAACrB,kBAAiBE,MAAOmB,MAAMnB,KAAK,CAAEC,OAAQkB,MAAMlB,MAAM,CAAEgB,QAASE,MAAMF,OAAO,UAChF,KAACtB,kDAAewB,QAAOH,QAASG,MAAMH,OAAO,EAAI,QAGvD,CAAC"}
1
+ {"version":3,"sources":["../../../../../src/components/Layout/SimplePageLayout/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport React, { ReactNode } from \"react\"\nimport { SimpleGrid, TSimpleGridStyling } from \"./SimpleGrid\"\nimport { Typo } from \"../../Typo\"\nimport classes from \"./index.module.css\"\n\nexport type TSimplePageLayoutProps = Partial<TSimpleGridStyling> & {\n title: string\n Button?: ReactNode\n children?: ReactNode\n Breadcrumbs?: ReactNode\n}\n\n/**\n * Renders a simple page layout with title, optional breadcrumbs and action button.\n * Uses a 3-column grid and exposes styling props for spacing and horizontal scroll.\n * @param title Page title displayed as heading2.\n * @param Button Optional action element rendered in the header's right side.\n * @param Breadcrumbs Optional breadcrumbs rendered above the title.\n * @param children Main content area.\n * @param gap Optional CSS gap between grid areas.\n * @param padding Optional padding for the grid container.\n * @param hScroll When true, enforces a min-width to allow horizontal scrolling on smaller viewports.\n */\nexport const SimplePageLayout: React.FC<TSimplePageLayoutProps> = ({\n children,\n title,\n Button,\n Breadcrumbs,\n ...gridProps\n}) => {\n return (\n <SimpleGrid\n config={{\n title: (\n <div className={classes.title}>\n <Typo type=\"heading2\">{title}</Typo>\n </div>\n ),\n button: Button ? <div className={classes.button}>{Button}</div> : null,\n content: <div className={classes.content}>{children}</div>,\n breadcrumbs: Breadcrumbs ? <div className={classes.breadcrumbs}>{Breadcrumbs}</div> : null,\n }}\n gridTemplateAreas={[\n ...(Breadcrumbs ? [\"breadcrumbs breadcrumbs breadcrumbs\"] : []),\n \"title . button\",\n \"content content content\",\n ]}\n gridTemplateColumns={\"1fr 1fr 1fr\"}\n gridTemplateRows={`${Breadcrumbs ? \"35px\" : \"\"} 66px 1fr`}\n gap={gridProps.gap}\n margin={\"-1rem -1rem 0 -1rem\"}\n padding={gridProps.padding}\n hScroll={gridProps.hScroll}\n />\n )\n}\n\nexport type TSimplePageLayoutComplex = TSimpleGridStyling & {\n title: string\n Button?: ReactNode\n config: Record<string, ReactNode>\n}\n\n/**\n * Complex variant that composes SimplePageLayout with a configurable SimpleGrid.\n * Forwards styling props (including hScroll) and renders additional grid areas via config.\n * @param title Page title.\n * @param Button Optional action element rendered in the header's right side.\n * @param config Mapping of grid-area names to React nodes.\n * @param gridTemplateAreas CSS grid-template-areas definition.\n * @param gridTemplateColumns CSS grid-template-columns definition.\n * @param gridTemplateRows CSS grid-template-rows definition.\n * @param gap Optional CSS gap between grid areas.\n * @param margin Optional CSS margin for the grid container.\n * @param padding Optional CSS padding for the grid container (defaults to \"0\" for inner grid).\n * @param hScroll When true, enforces a min-width to allow horizontal scrolling on smaller viewports.\n */\nexport const SimplePageLayoutComplex = (props: TSimplePageLayoutComplex) => {\n return (\n <SimplePageLayout title={props.title} Button={props.Button} hScroll={props.hScroll}>\n <SimpleGrid {...props} padding={props.padding || \"0\"} />\n </SimplePageLayout>\n )\n}\n"],"names":["React","SimpleGrid","Typo","classes","SimplePageLayout","children","title","Button","Breadcrumbs","gridProps","config","div","className","type","button","content","breadcrumbs","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","gap","margin","padding","hScroll","SimplePageLayoutComplex","props"],"mappings":"k0EAIA,QAAOA,UAA0B,OAAO,AACxC,QAASC,UAAU,KAA4B,cAAc,AAC7D,QAASC,IAAI,KAAQ,YAAY,AACjC,QAAOC,YAAa,oBAAoB,AAoBxC,QAAO,MAAMC,iBAAqD,QAAC,CACjEC,QAAQ,CACRC,KAAK,CACLC,MAAM,CACNC,WAAW,CAEZ,IADIC,qFAEH,OACE,KAACR,YACCS,OAAQ,CACNJ,MACE,KAACK,OAAIC,UAAWT,QAAQG,KAAK,UAC3B,KAACJ,MAAKW,KAAK,oBAAYP,UAG3BQ,OAAQP,OAAS,KAACI,OAAIC,UAAWT,QAAQW,MAAM,UAAGP,SAAgB,KAClEQ,QAAS,KAACJ,OAAIC,UAAWT,QAAQY,OAAO,UAAGV,WAC3CW,YAAaR,YAAc,KAACG,OAAIC,UAAWT,QAAQa,WAAW,UAAGR,cAAqB,IACxF,EACAS,kBAAmB,IACbT,YAAc,CAAC,sCAAsC,CAAG,EAAE,CAC9D,iBACA,0BACD,CACDU,oBAAqB,cACrBC,iBAAkB,CAAC,EAAEX,YAAc,OAAS,GAAG,SAAS,CAAC,CACzDY,IAAKX,UAAUW,GAAG,CAClBC,OAAQ,sBACRC,QAASb,UAAUa,OAAO,CAC1BC,QAASd,UAAUc,OAAO,EAGhC,CAAC,AAsBD,QAAO,MAAMC,wBAA0B,AAACC,QACtC,OACE,KAACrB,kBAAiBE,MAAOmB,MAAMnB,KAAK,CAAEC,OAAQkB,MAAMlB,MAAM,CAAEgB,QAASE,MAAMF,OAAO,UAChF,KAACtB,kDAAewB,QAAOH,QAASG,MAAMH,OAAO,EAAI,QAGvD,CAAC"}
@@ -1,2 +1,2 @@
1
- function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{createContext,useState}from"react";import{Modal as MantineModal}from"@mantine/core";import{ErrorBoundary}from"../ErrorBoundary";import classes from"./Modal.module.css";export const ModalContext=createContext({setOpen:()=>void 0});const ModalWithOpener=({children,Opener,initiallyOpen=false,modalProps,title})=>{const[open,setOpen]=useState(initiallyOpen);return _jsxs(ModalContext.Provider,{value:{setOpen},children:[Opener(setOpen),_jsx(Modal,_object_spread_props(_object_spread({opened:open,title:title},modalProps),{onClose:()=>setOpen(false),children:typeof children==="function"?children(setOpen):children}))]})};const Modal=_0=>{let{children,title}=_0,props=_object_without_properties(_0,["children","title"]);return _jsx(MantineModal,_object_spread_props(_object_spread({centered:true,classNames:{body:classes.body,header:classes.header,title:classes.title,content:classes.content,close:classes.close},title:title},props),{children:_jsx(ErrorBoundary,{children:children})}))};export{ModalWithOpener,Modal};
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{createContext,useState}from"react";import{Modal as MantineModal}from"@mantine/core";import{ErrorBoundary}from"../ErrorBoundary";import classes from"./Modal.module.css";export const ModalContext=createContext({setOpen:()=>void 0});const ModalWithOpener=({children,Opener,initiallyOpen=false,modalProps,title})=>{const[open,setOpen]=useState(initiallyOpen);return _jsxs(ModalContext.Provider,{value:{setOpen},children:[Opener(setOpen),_jsx(Modal,_object_spread_props(_object_spread({opened:open,title:title},modalProps),{onClose:()=>setOpen(false),children:typeof children==="function"?children(setOpen):children}))]})};const Modal=_0=>{let{children,title}=_0,props=_object_without_properties(_0,["children","title"]);return _jsx(MantineModal,_object_spread_props(_object_spread({centered:true,classNames:{body:classes.body,header:classes.header,title:classes.title,content:classes.content,close:classes.close},title:title},props),{children:_jsx(ErrorBoundary,{children:children})}))};export{ModalWithOpener,Modal};
2
2
  //# sourceMappingURL=Modal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport {\n createContext,\n Dispatch,\n FC,\n PropsWithChildren,\n ReactElement,\n ReactNode,\n useState,\n} from \"react\"\nimport { Modal as MantineModal, ModalProps } from \"@mantine/core\"\nimport { ErrorBoundary } from \"../ErrorBoundary\"\nimport classes from \"./Modal.module.css\"\n\nexport type TModalWithOpenerConfig = {\n initiallyOpen?: boolean\n Opener: (setOpen: Dispatch<React.SetStateAction<boolean>>) => ReactElement\n children: ReactNode | ((setOpen: (value: boolean) => void) => ReactElement)\n onSave?: () => void\n title?: ReactNode\n modalProps?: Partial<ModalProps>\n}\n\ntype TModalContext = {\n setOpen: Dispatch<React.SetStateAction<boolean>>\n}\n\nexport const ModalContext = createContext<TModalContext>({\n setOpen: () => void 0,\n})\n\nconst ModalWithOpener = ({\n children,\n Opener,\n initiallyOpen = false,\n modalProps,\n title,\n}: TModalWithOpenerConfig) => {\n const [open, setOpen] = useState<boolean>(initiallyOpen)\n return (\n <ModalContext.Provider value={{ setOpen }}>\n {Opener(setOpen)}\n <Modal opened={open} title={title} {...modalProps} onClose={() => setOpen(false)}>\n {typeof children === \"function\" ? children(setOpen) : children}\n </Modal>\n </ModalContext.Provider>\n )\n}\n\nconst Modal: FC<PropsWithChildren<ModalProps>> = ({ children, title, ...props }) => {\n return (\n <MantineModal\n centered\n classNames={{\n body: classes.body,\n header: classes.header,\n title: classes.title,\n content: classes.content,\n close: classes.close,\n }}\n title={title}\n {...props}\n >\n <ErrorBoundary>{children}</ErrorBoundary>\n </MantineModal>\n )\n}\n\nexport { ModalWithOpener, Modal }\n"],"names":["createContext","useState","Modal","MantineModal","ErrorBoundary","classes","ModalContext","setOpen","ModalWithOpener","children","Opener","initiallyOpen","modalProps","title","open","Provider","value","opened","onClose","props","centered","classNames","body","header","content","close"],"mappings":"w0EAIA,QACEA,aAAa,CAMbC,QAAQ,KACH,OAAO,AACd,QAASC,SAASC,YAAY,KAAoB,eAAe,AACjE,QAASC,aAAa,KAAQ,kBAAkB,AAChD,QAAOC,YAAa,oBAAoB,AAexC,QAAO,MAAMC,aAAeN,cAA6B,CACvDO,QAAS,IAAM,KAAK,CACtB,EAAE,CAEF,MAAMC,gBAAkB,CAAC,CACvBC,QAAQ,CACRC,MAAM,CACNC,cAAgB,KAAK,CACrBC,UAAU,CACVC,KAAK,CACkB,IACvB,KAAM,CAACC,KAAMP,QAAQ,CAAGN,SAAkBU,eAC1C,OACE,MAACL,aAAaS,QAAQ,EAACC,MAAO,CAAET,OAAQ,YACrCG,OAAOH,SACR,KAACL,2CAAMe,OAAQH,KAAMD,MAAOA,OAAWD,aAAYM,QAAS,IAAMX,QAAQ,gBACvE,OAAOE,WAAa,WAAaA,SAASF,SAAWE,cAI9D,EAEA,MAAMP,MAA2C,QAAC,CAAEO,QAAQ,CAAEI,KAAK,CAAY,IAAPM,0DACtE,OACE,KAAChB,kDACCiB,QAAQ,MACRC,WAAY,CACVC,KAAMjB,QAAQiB,IAAI,CAClBC,OAAQlB,QAAQkB,MAAM,CACtBV,MAAOR,QAAQQ,KAAK,CACpBW,QAASnB,QAAQmB,OAAO,CACxBC,MAAOpB,QAAQoB,KAAK,AACtB,EACAZ,MAAOA,OACHM,iBAEJ,KAACf,wBAAeK,aAGtB,CAEA,QAASD,eAAe,CAAEN,KAAK,CAAE"}
1
+ {"version":3,"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport {\n createContext,\n Dispatch,\n FC,\n PropsWithChildren,\n ReactElement,\n ReactNode,\n useState,\n} from \"react\"\nimport { Modal as MantineModal, ModalProps } from \"@mantine/core\"\nimport { ErrorBoundary } from \"../ErrorBoundary\"\nimport classes from \"./Modal.module.css\"\n\nexport type TModalWithOpenerConfig = {\n initiallyOpen?: boolean\n Opener: (setOpen: Dispatch<React.SetStateAction<boolean>>) => ReactElement\n children: ReactNode | ((setOpen: (value: boolean) => void) => ReactElement)\n onSave?: () => void\n title?: ReactNode\n modalProps?: Partial<ModalProps>\n}\n\ntype TModalContext = {\n setOpen: Dispatch<React.SetStateAction<boolean>>\n}\n\nexport const ModalContext = createContext<TModalContext>({\n setOpen: () => void 0,\n})\n\nconst ModalWithOpener = ({\n children,\n Opener,\n initiallyOpen = false,\n modalProps,\n title,\n}: TModalWithOpenerConfig) => {\n const [open, setOpen] = useState<boolean>(initiallyOpen)\n return (\n <ModalContext.Provider value={{ setOpen }}>\n {Opener(setOpen)}\n <Modal opened={open} title={title} {...modalProps} onClose={() => setOpen(false)}>\n {typeof children === \"function\" ? children(setOpen) : children}\n </Modal>\n </ModalContext.Provider>\n )\n}\n\nconst Modal: FC<PropsWithChildren<ModalProps>> = ({ children, title, ...props }) => {\n return (\n <MantineModal\n centered\n classNames={{\n body: classes.body,\n header: classes.header,\n title: classes.title,\n content: classes.content,\n close: classes.close,\n }}\n title={title}\n {...props}\n >\n <ErrorBoundary>{children}</ErrorBoundary>\n </MantineModal>\n )\n}\n\nexport { ModalWithOpener, Modal }\n"],"names":["createContext","useState","Modal","MantineModal","ErrorBoundary","classes","ModalContext","setOpen","ModalWithOpener","children","Opener","initiallyOpen","modalProps","title","open","Provider","value","opened","onClose","props","centered","classNames","body","header","content","close"],"mappings":"g1EAIA,QACEA,aAAa,CAMbC,QAAQ,KACH,OAAO,AACd,QAASC,SAASC,YAAY,KAAoB,eAAe,AACjE,QAASC,aAAa,KAAQ,kBAAkB,AAChD,QAAOC,YAAa,oBAAoB,AAexC,QAAO,MAAMC,aAAeN,cAA6B,CACvDO,QAAS,IAAM,KAAK,CACtB,EAAE,CAEF,MAAMC,gBAAkB,CAAC,CACvBC,QAAQ,CACRC,MAAM,CACNC,cAAgB,KAAK,CACrBC,UAAU,CACVC,KAAK,CACkB,IACvB,KAAM,CAACC,KAAMP,QAAQ,CAAGN,SAAkBU,eAC1C,OACE,MAACL,aAAaS,QAAQ,EAACC,MAAO,CAAET,OAAQ,YACrCG,OAAOH,SACR,KAACL,2CAAMe,OAAQH,KAAMD,MAAOA,OAAWD,aAAYM,QAAS,IAAMX,QAAQ,gBACvE,OAAOE,WAAa,WAAaA,SAASF,SAAWE,cAI9D,EAEA,MAAMP,MAA2C,QAAC,CAAEO,QAAQ,CAAEI,KAAK,CAAY,IAAPM,0DACtE,OACE,KAAChB,kDACCiB,QAAQ,MACRC,WAAY,CACVC,KAAMjB,QAAQiB,IAAI,CAClBC,OAAQlB,QAAQkB,MAAM,CACtBV,MAAOR,QAAQQ,KAAK,CACpBW,QAASnB,QAAQmB,OAAO,CACxBC,MAAOpB,QAAQoB,KAAK,AACtB,EACAZ,MAAOA,OACHM,iBAEJ,KAACf,wBAAeK,aAGtB,CAEA,QAASD,eAAe,CAAEN,KAAK,CAAE"}
@@ -1,2 +1,2 @@
1
- function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import{notifications}from"@mantine/notifications";import classes from"./Notification.module.css";import{StatusIcon}from"../../icons";import{EStatus}from"../../genericTypes";export const showNotification=_0=>{let{type=EStatus.INFO}=_0,props=_object_without_properties(_0,["type"]);notifications.show(_object_spread_props(_object_spread({classNames:_object_spread({},classes)},props),{icon:_jsx(StatusIcon,{status:type})}))};export const showSuccessNotification=(text,title)=>{showNotification({type:EStatus.SUCCESS,title:title,message:text})};export const showErrorNotification=(text,title)=>{showNotification({type:EStatus.ERROR,title:title,message:text})};export const showInfoNotification=(text,title)=>{showNotification({type:EStatus.INFO,title:title,message:text})};export const showWarningNotification=(text,title)=>{showNotification({type:EStatus.WARNING,title:title,message:text})};
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{notifications}from"@mantine/notifications";import classes from"./Notification.module.css";import{StatusIcon}from"../../icons";import{EStatus}from"../../genericTypes";export const showNotification=_0=>{let{type=EStatus.INFO}=_0,props=_object_without_properties(_0,["type"]);notifications.show(_object_spread_props(_object_spread({classNames:_object_spread({},classes)},props),{icon:_jsx(StatusIcon,{status:type})}))};export const showSuccessNotification=(text,title)=>{showNotification({type:EStatus.SUCCESS,title:title,message:text})};export const showErrorNotification=(text,title)=>{showNotification({type:EStatus.ERROR,title:title,message:text})};export const showInfoNotification=(text,title)=>{showNotification({type:EStatus.INFO,title:title,message:text})};export const showWarningNotification=(text,title)=>{showNotification({type:EStatus.WARNING,title:title,message:text})};
2
2
  //# sourceMappingURL=notifications.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Notification/notifications.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { notifications, NotificationData } from \"@mantine/notifications\"\n\nimport classes from \"./Notification.module.css\"\nimport { StatusIcon } from \"../../icons\"\nimport { EStatus } from \"../../genericTypes\"\nexport type TNotificationProps = {\n type?: EStatus\n} & NotificationData\n\nexport const showNotification = ({ type = EStatus.INFO, ...props }: TNotificationProps) => {\n notifications.show({\n classNames: { ...classes },\n ...props,\n icon: <StatusIcon status={type} />,\n })\n}\n\nexport const showSuccessNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.SUCCESS,\n title: title,\n message: text,\n })\n}\n\nexport const showErrorNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.ERROR,\n title: title,\n message: text,\n })\n}\n\nexport const showInfoNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.INFO,\n title: title,\n message: text,\n })\n}\n\nexport const showWarningNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.WARNING,\n title: title,\n message: text,\n })\n}\n"],"names":["notifications","classes","StatusIcon","EStatus","showNotification","type","INFO","props","show","classNames","icon","status","showSuccessNotification","text","title","SUCCESS","message","showErrorNotification","ERROR","showInfoNotification","showWarningNotification","WARNING"],"mappings":"0zEAIA,QAASA,aAAa,KAA0B,wBAAwB,AAExE,QAAOC,YAAa,2BAA2B,AAC/C,QAASC,UAAU,KAAQ,aAAa,AACxC,QAASC,OAAO,KAAQ,oBAAoB,AAK5C,QAAO,MAAMC,iBAAmB,QAAC,CAAEC,KAAOF,QAAQG,IAAI,CAAgC,IAA3BC,8CACzDP,cAAcQ,IAAI,CAAC,qCACjBC,WAAY,kBAAKR,UACdM,QACHG,KAAM,KAACR,YAAWS,OAAQN,SAE9B,CAAC,AAED,QAAO,MAAMO,wBAA0B,CAACC,KAAcC,SACpDV,iBAAiB,CACfC,KAAMF,QAAQY,OAAO,CACrBD,MAAOA,MACPE,QAASH,IACX,EACF,CAAC,AAED,QAAO,MAAMI,sBAAwB,CAACJ,KAAcC,SAClDV,iBAAiB,CACfC,KAAMF,QAAQe,KAAK,CACnBJ,MAAOA,MACPE,QAASH,IACX,EACF,CAAC,AAED,QAAO,MAAMM,qBAAuB,CAACN,KAAcC,SACjDV,iBAAiB,CACfC,KAAMF,QAAQG,IAAI,CAClBQ,MAAOA,MACPE,QAASH,IACX,EACF,CAAC,AAED,QAAO,MAAMO,wBAA0B,CAACP,KAAcC,SACpDV,iBAAiB,CACfC,KAAMF,QAAQkB,OAAO,CACrBP,MAAOA,MACPE,QAASH,IACX,EACF,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/Notification/notifications.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { notifications, NotificationData } from \"@mantine/notifications\"\n\nimport classes from \"./Notification.module.css\"\nimport { StatusIcon } from \"../../icons\"\nimport { EStatus } from \"../../genericTypes\"\nexport type TNotificationProps = {\n type?: EStatus\n} & NotificationData\n\nexport const showNotification = ({ type = EStatus.INFO, ...props }: TNotificationProps) => {\n notifications.show({\n classNames: { ...classes },\n ...props,\n icon: <StatusIcon status={type} />,\n })\n}\n\nexport const showSuccessNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.SUCCESS,\n title: title,\n message: text,\n })\n}\n\nexport const showErrorNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.ERROR,\n title: title,\n message: text,\n })\n}\n\nexport const showInfoNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.INFO,\n title: title,\n message: text,\n })\n}\n\nexport const showWarningNotification = (text: string, title?: string) => {\n showNotification({\n type: EStatus.WARNING,\n title: title,\n message: text,\n })\n}\n"],"names":["notifications","classes","StatusIcon","EStatus","showNotification","type","INFO","props","show","classNames","icon","status","showSuccessNotification","text","title","SUCCESS","message","showErrorNotification","ERROR","showInfoNotification","showWarningNotification","WARNING"],"mappings":"k0EAIA,QAASA,aAAa,KAA0B,wBAAwB,AAExE,QAAOC,YAAa,2BAA2B,AAC/C,QAASC,UAAU,KAAQ,aAAa,AACxC,QAASC,OAAO,KAAQ,oBAAoB,AAK5C,QAAO,MAAMC,iBAAmB,QAAC,CAAEC,KAAOF,QAAQG,IAAI,CAAgC,IAA3BC,8CACzDP,cAAcQ,IAAI,CAAC,qCACjBC,WAAY,kBAAKR,UACdM,QACHG,KAAM,KAACR,YAAWS,OAAQN,SAE9B,CAAC,AAED,QAAO,MAAMO,wBAA0B,CAACC,KAAcC,SACpDV,iBAAiB,CACfC,KAAMF,QAAQY,OAAO,CACrBD,MAAOA,MACPE,QAASH,IACX,EACF,CAAC,AAED,QAAO,MAAMI,sBAAwB,CAACJ,KAAcC,SAClDV,iBAAiB,CACfC,KAAMF,QAAQe,KAAK,CACnBJ,MAAOA,MACPE,QAASH,IACX,EACF,CAAC,AAED,QAAO,MAAMM,qBAAuB,CAACN,KAAcC,SACjDV,iBAAiB,CACfC,KAAMF,QAAQG,IAAI,CAClBQ,MAAOA,MACPE,QAASH,IACX,EACF,CAAC,AAED,QAAO,MAAMO,wBAA0B,CAACP,KAAcC,SACpDV,iBAAiB,CACfC,KAAMF,QAAQkB,OAAO,CACrBP,MAAOA,MACPE,QAASH,IACX,EACF,CAAC"}
@@ -1,2 +1,2 @@
1
- function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import{TableClientSide}from"../index";import{TableSessionStorage}from"../../persistence/TableSessionStorage";import{useMemo}from"react";import{defaultPagingState}from"../../constants";export function TableClientSidePersistent(_0){let{Storage=TableSessionStorage.Instance(),tableId,config,onSortingChange,onPagingChange}=_0,tableProps=_object_without_properties(_0,["Storage","tableId","config","onSortingChange","onPagingChange"]);const savedTable=useMemo(()=>Storage.get(tableId)||{paging:defaultPagingState,sorting:config.sorting.default},[tableId]);const configurationWithAdjustedSorting=_object_spread_props(_object_spread({},config),{sorting:{default:savedTable.sorting}});const handleSortingChange=props=>{Storage===null||Storage===void 0?void 0:Storage.set(tableId,()=>_object_spread_props(_object_spread({},savedTable),{sorting:{column:props.column,direction:props.direction}}));onSortingChange===null||onSortingChange===void 0?void 0:onSortingChange(props)};const handlePagingChange=props=>{Storage===null||Storage===void 0?void 0:Storage.set(tableId,()=>_object_spread_props(_object_spread({},savedTable),{paging:{index:props.index,size:props.size}}));onPagingChange===null||onPagingChange===void 0?void 0:onPagingChange(props)};return _jsx(TableClientSide,_object_spread_props(_object_spread({},tableProps),{onSortingChange:handleSortingChange,onPagingChange:handlePagingChange,defaultPaging:savedTable.paging,config:configurationWithAdjustedSorting}))}
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{TableClientSide}from"../index";import{TableSessionStorage}from"../../persistence/TableSessionStorage";import{useMemo}from"react";import{defaultPagingState}from"../../constants";export function TableClientSidePersistent(_0){let{Storage=TableSessionStorage.Instance(),tableId,config,onSortingChange,onPagingChange}=_0,tableProps=_object_without_properties(_0,["Storage","tableId","config","onSortingChange","onPagingChange"]);const savedTable=useMemo(()=>Storage.get(tableId)||{paging:defaultPagingState,sorting:config.sorting.default},[tableId]);const configurationWithAdjustedSorting=_object_spread_props(_object_spread({},config),{sorting:{default:savedTable.sorting}});const handleSortingChange=props=>{Storage===null||Storage===void 0?void 0:Storage.set(tableId,()=>_object_spread_props(_object_spread({},savedTable),{sorting:{column:props.column,direction:props.direction}}));onSortingChange===null||onSortingChange===void 0?void 0:onSortingChange(props)};const handlePagingChange=props=>{Storage===null||Storage===void 0?void 0:Storage.set(tableId,()=>_object_spread_props(_object_spread({},savedTable),{paging:{index:props.index,size:props.size}}));onPagingChange===null||onPagingChange===void 0?void 0:onPagingChange(props)};return _jsx(TableClientSide,_object_spread_props(_object_spread({},tableProps),{onSortingChange:handleSortingChange,onPagingChange:handlePagingChange,defaultPaging:savedTable.paging,config:configurationWithAdjustedSorting}))}
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/Table/TableClientSide/TableClientSidePersistent/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport {\n TableClientSide,\n THandlePagingChange,\n THandleSortingChange,\n TTableClientSideProps,\n} from \"../index\"\nimport { ITableStorage, TableSessionStorage } from \"../../persistence/TableSessionStorage\"\nimport { useMemo } from \"react\"\nimport { defaultPagingState } from \"../../constants\"\n\nexport type TTableClientSidePersistentProps<TDataType> = TTableClientSideProps<TDataType> & {\n Storage?: ITableStorage\n tableId: string\n}\n\n/**\n * The TableClientSidePersistent is a persistence middleware that uses closely the same interface as the table\n * with addition of the *Storage* and *tableId*.\n * it wraps and intercepts incoming and outgoing data to inject loaded data into the\n * table or save table changes into the Storage Repository.\n *\n * @param Storage Storage Repository for the Table. This is optional and per default the TableSessionStorage for SessionStorage persistence\n * @param tableId Unique ID for persistence\n * @param config Table Configuration\n * @param onSortingChange Callback\n * @param onPagingChange Callback\n * @param tableProps Interface from useTableClientSide hook\n */\nexport function TableClientSidePersistent<TDataType>({\n Storage = TableSessionStorage.Instance(),\n tableId,\n config,\n onSortingChange,\n onPagingChange,\n ...tableProps\n}: TTableClientSidePersistentProps<TDataType>) {\n const savedTable = useMemo(\n () =>\n Storage.get(tableId) || {\n paging: defaultPagingState,\n sorting: config.sorting.default,\n },\n [tableId]\n )\n\n const configurationWithAdjustedSorting = {\n ...config,\n sorting: {\n default: savedTable.sorting,\n },\n }\n const handleSortingChange: THandleSortingChange = (props) => {\n Storage?.set(tableId, () => ({\n ...savedTable,\n sorting: {\n column: props.column,\n direction: props.direction,\n },\n }))\n onSortingChange?.(props)\n }\n\n const handlePagingChange: THandlePagingChange = (props) => {\n Storage?.set(tableId, () => ({\n ...savedTable,\n paging: {\n index: props.index,\n size: props.size,\n },\n }))\n onPagingChange?.(props)\n }\n\n return (\n <TableClientSide\n {...tableProps}\n onSortingChange={handleSortingChange}\n onPagingChange={handlePagingChange}\n defaultPaging={savedTable.paging}\n config={configurationWithAdjustedSorting}\n />\n )\n}\n"],"names":["TableClientSide","TableSessionStorage","useMemo","defaultPagingState","TableClientSidePersistent","Storage","Instance","tableId","config","onSortingChange","onPagingChange","tableProps","savedTable","get","paging","sorting","default","configurationWithAdjustedSorting","handleSortingChange","props","set","column","direction","handlePagingChange","index","size","defaultPaging"],"mappings":"0zEAIA,QACEA,eAAe,KAIV,UAAU,AACjB,QAAwBC,mBAAmB,KAAQ,uCAAuC,AAC1F,QAASC,OAAO,KAAQ,OAAO,AAC/B,QAASC,kBAAkB,KAAQ,iBAAiB,AAoBpD,QAAO,SAASC,0BAAqC,EAOR,KAPQ,CACnDC,QAAUJ,oBAAoBK,QAAQ,EAAE,CACxCC,OAAO,CACPC,MAAM,CACNC,eAAe,CACfC,cAAc,CAE6B,IADxCC,4GAEH,MAAMC,WAAaV,QACjB,IACEG,QAAQQ,GAAG,CAACN,UAAY,CACtBO,OAAQX,mBACRY,QAASP,OAAOO,OAAO,CAACC,OAAO,AACjC,EACF,CAACT,QAAQ,EAGX,MAAMU,iCAAmC,uCACpCT,SACHO,QAAS,CACPC,QAASJ,WAAWG,OAAO,AAC7B,IAEF,MAAMG,oBAA4C,AAACC,QACjDd,gBAAAA,wBAAAA,QAASe,GAAG,CAACb,QAAS,IAAO,uCACxBK,aACHG,QAAS,CACPM,OAAQF,MAAME,MAAM,CACpBC,UAAWH,MAAMG,SAAS,AAC5B,KAEFb,wBAAAA,gCAAAA,gBAAkBU,MACpB,EAEA,MAAMI,mBAA0C,AAACJ,QAC/Cd,gBAAAA,wBAAAA,QAASe,GAAG,CAACb,QAAS,IAAO,uCACxBK,aACHE,OAAQ,CACNU,MAAOL,MAAMK,KAAK,CAClBC,KAAMN,MAAMM,IAAI,AAClB,KAEFf,uBAAAA,+BAAAA,eAAiBS,MACnB,EAEA,OACE,KAACnB,uDACKW,aACJF,gBAAiBS,oBACjBR,eAAgBa,mBAChBG,cAAed,WAAWE,MAAM,CAChCN,OAAQS,mCAGd"}
1
+ {"version":3,"sources":["../../../../../../src/components/Table/TableClientSide/TableClientSidePersistent/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport {\n TableClientSide,\n THandlePagingChange,\n THandleSortingChange,\n TTableClientSideProps,\n} from \"../index\"\nimport { ITableStorage, TableSessionStorage } from \"../../persistence/TableSessionStorage\"\nimport { useMemo } from \"react\"\nimport { defaultPagingState } from \"../../constants\"\n\nexport type TTableClientSidePersistentProps<TDataType> = TTableClientSideProps<TDataType> & {\n Storage?: ITableStorage\n tableId: string\n}\n\n/**\n * The TableClientSidePersistent is a persistence middleware that uses closely the same interface as the table\n * with addition of the *Storage* and *tableId*.\n * it wraps and intercepts incoming and outgoing data to inject loaded data into the\n * table or save table changes into the Storage Repository.\n *\n * @param Storage Storage Repository for the Table. This is optional and per default the TableSessionStorage for SessionStorage persistence\n * @param tableId Unique ID for persistence\n * @param config Table Configuration\n * @param onSortingChange Callback\n * @param onPagingChange Callback\n * @param tableProps Interface from useTableClientSide hook\n */\nexport function TableClientSidePersistent<TDataType>({\n Storage = TableSessionStorage.Instance(),\n tableId,\n config,\n onSortingChange,\n onPagingChange,\n ...tableProps\n}: TTableClientSidePersistentProps<TDataType>) {\n const savedTable = useMemo(\n () =>\n Storage.get(tableId) || {\n paging: defaultPagingState,\n sorting: config.sorting.default,\n },\n [tableId]\n )\n\n const configurationWithAdjustedSorting = {\n ...config,\n sorting: {\n default: savedTable.sorting,\n },\n }\n const handleSortingChange: THandleSortingChange = (props) => {\n Storage?.set(tableId, () => ({\n ...savedTable,\n sorting: {\n column: props.column,\n direction: props.direction,\n },\n }))\n onSortingChange?.(props)\n }\n\n const handlePagingChange: THandlePagingChange = (props) => {\n Storage?.set(tableId, () => ({\n ...savedTable,\n paging: {\n index: props.index,\n size: props.size,\n },\n }))\n onPagingChange?.(props)\n }\n\n return (\n <TableClientSide\n {...tableProps}\n onSortingChange={handleSortingChange}\n onPagingChange={handlePagingChange}\n defaultPaging={savedTable.paging}\n config={configurationWithAdjustedSorting}\n />\n )\n}\n"],"names":["TableClientSide","TableSessionStorage","useMemo","defaultPagingState","TableClientSidePersistent","Storage","Instance","tableId","config","onSortingChange","onPagingChange","tableProps","savedTable","get","paging","sorting","default","configurationWithAdjustedSorting","handleSortingChange","props","set","column","direction","handlePagingChange","index","size","defaultPaging"],"mappings":"k0EAIA,QACEA,eAAe,KAIV,UAAU,AACjB,QAAwBC,mBAAmB,KAAQ,uCAAuC,AAC1F,QAASC,OAAO,KAAQ,OAAO,AAC/B,QAASC,kBAAkB,KAAQ,iBAAiB,AAoBpD,QAAO,SAASC,0BAAqC,EAOR,KAPQ,CACnDC,QAAUJ,oBAAoBK,QAAQ,EAAE,CACxCC,OAAO,CACPC,MAAM,CACNC,eAAe,CACfC,cAAc,CAE6B,IADxCC,4GAEH,MAAMC,WAAaV,QACjB,IACEG,QAAQQ,GAAG,CAACN,UAAY,CACtBO,OAAQX,mBACRY,QAASP,OAAOO,OAAO,CAACC,OAAO,AACjC,EACF,CAACT,QAAQ,EAGX,MAAMU,iCAAmC,uCACpCT,SACHO,QAAS,CACPC,QAASJ,WAAWG,OAAO,AAC7B,IAEF,MAAMG,oBAA4C,AAACC,QACjDd,gBAAAA,wBAAAA,QAASe,GAAG,CAACb,QAAS,IAAO,uCACxBK,aACHG,QAAS,CACPM,OAAQF,MAAME,MAAM,CACpBC,UAAWH,MAAMG,SAAS,AAC5B,KAEFb,wBAAAA,gCAAAA,gBAAkBU,MACpB,EAEA,MAAMI,mBAA0C,AAACJ,QAC/Cd,gBAAAA,wBAAAA,QAASe,GAAG,CAACb,QAAS,IAAO,uCACxBK,aACHE,OAAQ,CACNU,MAAOL,MAAMK,KAAK,CAClBC,KAAMN,MAAMM,IAAI,AAClB,KAEFf,uBAAAA,+BAAAA,eAAiBS,MACnB,EAEA,OACE,KAACnB,uDACKW,aACJF,gBAAiBS,oBACjBR,eAAgBa,mBAChBG,cAAed,WAAWE,MAAM,CAChCN,OAAQS,mCAGd"}
@@ -1,2 +1,2 @@
1
- function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx}from"react/jsx-runtime";import{TableSessionStorage}from"../../persistence/TableSessionStorage";import{useEffect,useMemo}from"react";import{defaultPagingState}from"../../constants";import{TableServerSide}from"../index";export function getTableServerSidePersistentState(id,Storage=TableSessionStorage.Instance()){return Storage.get(id)}export function TableServerSidePersistent(_0){let{Storage=TableSessionStorage.Instance(),tableId,config,onTableUpdate}=_0,tableProps=_object_without_properties(_0,["Storage","tableId","config","onTableUpdate"]);const savedTable=useMemo(()=>Storage.get(tableId)||{paging:defaultPagingState,sorting:config.sorting.default},[tableId]);const configurationWithAdjustedSorting=_object_spread_props(_object_spread({},config),{sorting:{default:savedTable.sorting}});const handleTableChange=tableState=>{Storage===null||Storage===void 0?void 0:Storage.set(tableId,()=>tableState);onTableUpdate===null||onTableUpdate===void 0?void 0:onTableUpdate(tableState)};useEffect(()=>{if(!tableProps.metadata)return;Storage===null||Storage===void 0?void 0:Storage.set(tableId,prev=>_object_spread({},prev,tableProps.metadata))},[tableProps.metadata]);return _jsx(TableServerSide,_object_spread_props(_object_spread({},tableProps),{onTableUpdate:handleTableChange,config:configurationWithAdjustedSorting}))}
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{TableSessionStorage}from"../../persistence/TableSessionStorage";import{useEffect,useMemo}from"react";import{defaultPagingState}from"../../constants";import{TableServerSide}from"../index";export function getTableServerSidePersistentState(id,Storage=TableSessionStorage.Instance()){return Storage.get(id)}export function TableServerSidePersistent(_0){let{Storage=TableSessionStorage.Instance(),tableId,config,onTableUpdate}=_0,tableProps=_object_without_properties(_0,["Storage","tableId","config","onTableUpdate"]);const savedTable=useMemo(()=>Storage.get(tableId)||{paging:defaultPagingState,sorting:config.sorting.default},[tableId]);const configurationWithAdjustedSorting=_object_spread_props(_object_spread({},config),{sorting:{default:savedTable.sorting}});const handleTableChange=tableState=>{Storage===null||Storage===void 0?void 0:Storage.set(tableId,()=>tableState);onTableUpdate===null||onTableUpdate===void 0?void 0:onTableUpdate(tableState)};useEffect(()=>{if(!tableProps.metadata)return;Storage===null||Storage===void 0?void 0:Storage.set(tableId,prev=>_object_spread({},prev,tableProps.metadata))},[tableProps.metadata]);return _jsx(TableServerSide,_object_spread_props(_object_spread({},tableProps),{onTableUpdate:handleTableChange,config:configurationWithAdjustedSorting}))}
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/Table/TableServerSide/TableServerSidePersistent/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ITableStorage, TableSessionStorage } from \"../../persistence/TableSessionStorage\"\nimport { useEffect, useMemo } from \"react\"\nimport { defaultPagingState } from \"../../constants\"\nimport { TableServerSide, TTableServerSideProps } from \"../index\"\nimport { TOnTableUpdateArgs } from \"../useTableServerSide\"\n\nexport type TTableServerSidePersistentProps<TDataType> = TTableServerSideProps<TDataType> & {\n Storage?: ITableStorage\n tableId: string\n}\n\nexport function getTableServerSidePersistentState(\n id: string,\n Storage = TableSessionStorage.Instance()\n) {\n return Storage.get(id)\n}\n\n/**\n * The TableServerSidePersistent is a persistence middleware that uses closely the same interface as the table\n * with addition of the *Storage* and *tableId*.\n * it wraps and intercepts incoming and outgoing data to inject loaded data into the\n * table or save table changes into the Storage Repository.\n *\n * @param Storage Storage Repository for the Table. This is optional and per default the TableSessionStorage for SessionStorage persistence\n * @param tableId Unique ID for persistence\n * @param config Table Configuration\n * @param onTableUpdate Callback\n * @param tableProps Interface from useTableClientSide hook\n */\nexport function TableServerSidePersistent<TDataType>({\n Storage = TableSessionStorage.Instance(),\n tableId,\n config,\n onTableUpdate,\n ...tableProps\n}: TTableServerSidePersistentProps<TDataType>) {\n const savedTable = useMemo(\n () =>\n Storage.get(tableId) || {\n paging: defaultPagingState,\n sorting: config.sorting.default,\n },\n [tableId]\n )\n\n const configurationWithAdjustedSorting = {\n ...config,\n sorting: {\n default: savedTable.sorting,\n },\n }\n const handleTableChange = (tableState: TOnTableUpdateArgs) => {\n Storage?.set(tableId, () => tableState)\n onTableUpdate?.(tableState)\n }\n\n useEffect(() => {\n if (!tableProps.metadata) return\n Storage?.set(tableId, (prev) => ({ ...prev, ...tableProps.metadata }))\n }, [tableProps.metadata])\n\n return (\n <TableServerSide\n {...tableProps}\n onTableUpdate={handleTableChange}\n config={configurationWithAdjustedSorting}\n />\n )\n}\n"],"names":["TableSessionStorage","useEffect","useMemo","defaultPagingState","TableServerSide","getTableServerSidePersistentState","id","Storage","Instance","get","TableServerSidePersistent","tableId","config","onTableUpdate","tableProps","savedTable","paging","sorting","default","configurationWithAdjustedSorting","handleTableChange","tableState","set","metadata","prev"],"mappings":"0zEAIA,QAAwBA,mBAAmB,KAAQ,uCAAuC,AAC1F,QAASC,SAAS,CAAEC,OAAO,KAAQ,OAAO,AAC1C,QAASC,kBAAkB,KAAQ,iBAAiB,AACpD,QAASC,eAAe,KAA+B,UAAU,AAQjE,QAAO,SAASC,kCACdC,EAAU,CACVC,QAAUP,oBAAoBQ,QAAQ,EAAE,EAExC,OAAOD,QAAQE,GAAG,CAACH,GACrB,CAcA,OAAO,SAASI,0BAAqC,EAMR,KANQ,CACnDH,QAAUP,oBAAoBQ,QAAQ,EAAE,CACxCG,OAAO,CACPC,MAAM,CACNC,aAAa,CAE8B,IADxCC,yFAEH,MAAMC,WAAab,QACjB,IACEK,QAAQE,GAAG,CAACE,UAAY,CACtBK,OAAQb,mBACRc,QAASL,OAAOK,OAAO,CAACC,OAAO,AACjC,EACF,CAACP,QAAQ,EAGX,MAAMQ,iCAAmC,uCACpCP,SACHK,QAAS,CACPC,QAASH,WAAWE,OAAO,AAC7B,IAEF,MAAMG,kBAAoB,AAACC,aACzBd,gBAAAA,wBAAAA,QAASe,GAAG,CAACX,QAAS,IAAMU,YAC5BR,sBAAAA,8BAAAA,cAAgBQ,WAClB,EAEApB,UAAU,KACR,GAAI,CAACa,WAAWS,QAAQ,CAAE,OAC1BhB,gBAAAA,wBAAAA,QAASe,GAAG,CAACX,QAAS,AAACa,MAAU,kBAAKA,KAASV,WAAWS,QAAQ,EACpE,EAAG,CAACT,WAAWS,QAAQ,CAAC,EAExB,OACE,KAACnB,uDACKU,aACJD,cAAeO,kBACfR,OAAQO,mCAGd"}
1
+ {"version":3,"sources":["../../../../../../src/components/Table/TableServerSide/TableServerSidePersistent/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ITableStorage, TableSessionStorage } from \"../../persistence/TableSessionStorage\"\nimport { useEffect, useMemo } from \"react\"\nimport { defaultPagingState } from \"../../constants\"\nimport { TableServerSide, TTableServerSideProps } from \"../index\"\nimport { TOnTableUpdateArgs } from \"../useTableServerSide\"\n\nexport type TTableServerSidePersistentProps<TDataType> = TTableServerSideProps<TDataType> & {\n Storage?: ITableStorage\n tableId: string\n}\n\nexport function getTableServerSidePersistentState(\n id: string,\n Storage = TableSessionStorage.Instance()\n) {\n return Storage.get(id)\n}\n\n/**\n * The TableServerSidePersistent is a persistence middleware that uses closely the same interface as the table\n * with addition of the *Storage* and *tableId*.\n * it wraps and intercepts incoming and outgoing data to inject loaded data into the\n * table or save table changes into the Storage Repository.\n *\n * @param Storage Storage Repository for the Table. This is optional and per default the TableSessionStorage for SessionStorage persistence\n * @param tableId Unique ID for persistence\n * @param config Table Configuration\n * @param onTableUpdate Callback\n * @param tableProps Interface from useTableClientSide hook\n */\nexport function TableServerSidePersistent<TDataType>({\n Storage = TableSessionStorage.Instance(),\n tableId,\n config,\n onTableUpdate,\n ...tableProps\n}: TTableServerSidePersistentProps<TDataType>) {\n const savedTable = useMemo(\n () =>\n Storage.get(tableId) || {\n paging: defaultPagingState,\n sorting: config.sorting.default,\n },\n [tableId]\n )\n\n const configurationWithAdjustedSorting = {\n ...config,\n sorting: {\n default: savedTable.sorting,\n },\n }\n const handleTableChange = (tableState: TOnTableUpdateArgs) => {\n Storage?.set(tableId, () => tableState)\n onTableUpdate?.(tableState)\n }\n\n useEffect(() => {\n if (!tableProps.metadata) return\n Storage?.set(tableId, (prev) => ({ ...prev, ...tableProps.metadata }))\n }, [tableProps.metadata])\n\n return (\n <TableServerSide\n {...tableProps}\n onTableUpdate={handleTableChange}\n config={configurationWithAdjustedSorting}\n />\n )\n}\n"],"names":["TableSessionStorage","useEffect","useMemo","defaultPagingState","TableServerSide","getTableServerSidePersistentState","id","Storage","Instance","get","TableServerSidePersistent","tableId","config","onTableUpdate","tableProps","savedTable","paging","sorting","default","configurationWithAdjustedSorting","handleTableChange","tableState","set","metadata","prev"],"mappings":"k0EAIA,QAAwBA,mBAAmB,KAAQ,uCAAuC,AAC1F,QAASC,SAAS,CAAEC,OAAO,KAAQ,OAAO,AAC1C,QAASC,kBAAkB,KAAQ,iBAAiB,AACpD,QAASC,eAAe,KAA+B,UAAU,AAQjE,QAAO,SAASC,kCACdC,EAAU,CACVC,QAAUP,oBAAoBQ,QAAQ,EAAE,EAExC,OAAOD,QAAQE,GAAG,CAACH,GACrB,CAcA,OAAO,SAASI,0BAAqC,EAMR,KANQ,CACnDH,QAAUP,oBAAoBQ,QAAQ,EAAE,CACxCG,OAAO,CACPC,MAAM,CACNC,aAAa,CAE8B,IADxCC,yFAEH,MAAMC,WAAab,QACjB,IACEK,QAAQE,GAAG,CAACE,UAAY,CACtBK,OAAQb,mBACRc,QAASL,OAAOK,OAAO,CAACC,OAAO,AACjC,EACF,CAACP,QAAQ,EAGX,MAAMQ,iCAAmC,uCACpCP,SACHK,QAAS,CACPC,QAASH,WAAWE,OAAO,AAC7B,IAEF,MAAMG,kBAAoB,AAACC,aACzBd,gBAAAA,wBAAAA,QAASe,GAAG,CAACX,QAAS,IAAMU,YAC5BR,sBAAAA,8BAAAA,cAAgBQ,WAClB,EAEApB,UAAU,KACR,GAAI,CAACa,WAAWS,QAAQ,CAAE,OAC1BhB,gBAAAA,wBAAAA,QAASe,GAAG,CAACX,QAAS,AAACa,MAAU,kBAAKA,KAASV,WAAWS,QAAQ,EACpE,EAAG,CAACT,WAAWS,QAAQ,CAAC,EAExB,OACE,KAACnB,uDACKU,aACJD,cAAeO,kBACfR,OAAQO,mCAGd"}
@@ -1,2 +1,2 @@
1
- function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _object_without_properties(source,excluded){if(source==null)return{};var target={},sourceKeys,key,i;if(typeof Reflect!=="undefined"&&Reflect.ownKeys){sourceKeys=Reflect.ownKeys(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){sourceKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _object_without_properties_loose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.getOwnPropertyNames(source),key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}return target}import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{ActionIcon,Menu}from"@mantine/core";import{MoreVertical}from"lucide-react";import{useCallback,useMemo}from"react";import{Tooltip}from"../../../Tooltip";import classes from"./ActionMenu.module.css";function getLabel(label,tableProps){if(typeof label==="function"){return label(tableProps)}return label}function createWiredActionMenuComponent({setMenuState,menuState,items,setModalOpen}){return({tableProps,menuProps,actionIcon})=>{const getOwnMenuState=useMemo(()=>menuState[tableProps.id],[menuState]);const dispatchLoading=(label,isLoading)=>setMenuState({type:"SET_LOADING",payload:{id:tableProps.id,loading:{label,isLoading}}});const dispatchOpen=open=>setMenuState({type:"SET_OPEN",payload:{id:tableProps.id,state:{open}}});const handleItemClick=item=>{var _item_modal,_item_action;return item.modal?setModalOpen((_item_modal=item.modal)===null||_item_modal===void 0?void 0:_item_modal.id,tableProps)():(_item_action=item.action)===null||_item_action===void 0?void 0:_item_action.call(item,tableProps,{setLoading:setLoading(item)})};const getTooltipText=item=>{var _item_tooltip_customText,_item_tooltip,_item_tooltip1;return((_item_tooltip=item.tooltip)===null||_item_tooltip===void 0?void 0:(_item_tooltip_customText=_item_tooltip.customText)===null||_item_tooltip_customText===void 0?void 0:_item_tooltip_customText.call(_item_tooltip,tableProps))?(_item_tooltip1=item.tooltip)===null||_item_tooltip1===void 0?void 0:_item_tooltip1.customText(tableProps):getLabel(item.label,tableProps)};const getIsMenuItemDisabled=item=>{var _getOwnMenuState_loading,_item_disabled;return(getOwnMenuState===null||getOwnMenuState===void 0?void 0:(_getOwnMenuState_loading=getOwnMenuState.loading)===null||_getOwnMenuState_loading===void 0?void 0:_getOwnMenuState_loading.includes(item.id))||((_item_disabled=item.disabled)===null||_item_disabled===void 0?void 0:_item_disabled.call(item,tableProps))};const getIcon=item=>typeof item.icon==="function"?_jsx(item.icon,_object_spread({},tableProps)):item.icon;const setLoading=useCallback(item=>value=>{dispatchLoading(item.id,value)},[menuState]);if(items.length<=2){return _jsx("span",{className:classes["icon-container"],children:items.map(item=>{var _item_hidden;if((_item_hidden=item.hidden)===null||_item_hidden===void 0?void 0:_item_hidden.call(item,tableProps))return null;return _jsx(Tooltip,{label:getTooltipText(item),children:_jsx("span",{children:_jsx(ActionIcon,{className:classes.icon,disabled:getIsMenuItemDisabled(item),onClick:()=>handleItemClick(item),children:_jsx("span",{children:getIcon(item)})},item.id)})},item.id)})})}return _jsx(ActionMenu,_object_spread_props(_object_spread({actionIcon:actionIcon,opened:getOwnMenuState===null||getOwnMenuState===void 0?void 0:getOwnMenuState.open,onOpen:()=>dispatchOpen(true),onClose:()=>dispatchOpen(false)},menuProps),{children:_jsx(_Fragment,{children:items.map(item=>{var _item_hidden,_item_tooltip_showInMenu,_item_tooltip;if((_item_hidden=item.hidden)===null||_item_hidden===void 0?void 0:_item_hidden.call(item,tableProps))return null;return _jsx(Tooltip,{label:getTooltipText(item),disabled:!((_item_tooltip=item.tooltip)===null||_item_tooltip===void 0?void 0:(_item_tooltip_showInMenu=_item_tooltip.showInMenu)===null||_item_tooltip_showInMenu===void 0?void 0:_item_tooltip_showInMenu.call(_item_tooltip,tableProps)),children:_jsx("span",{children:_jsx(Menu.Item,{className:classes.item,disabled:getIsMenuItemDisabled(item),onClick:()=>handleItemClick(item),leftSection:getIcon(item),children:getLabel(item.label,tableProps)},item.id)})},item.id)})})}))}}const ActionMenu=_0=>{let{actionIcon,children}=_0,menuProps=_object_without_properties(_0,["actionIcon","children"]);return _jsx("div",{className:classes["action-container"],"data-testid":"table-action-menu",children:_jsxs(Menu,_object_spread_props(_object_spread({shadow:"md",width:180},menuProps),{children:[_jsx(Menu.Target,{children:_jsx(ActionIcon,{"data-testid":"table-action-menu-opener",className:classes.icon,children:actionIcon||_jsx(MoreVertical,{})})}),_jsx(Menu.Dropdown,{children:children})]}))})};export{createWiredActionMenuComponent,ActionMenu};
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{ActionIcon,Menu}from"@mantine/core";import{MoreVertical}from"lucide-react";import{useCallback,useMemo}from"react";import{Tooltip}from"../../../Tooltip";import classes from"./ActionMenu.module.css";function getLabel(label,tableProps){if(typeof label==="function"){return label(tableProps)}return label}function createWiredActionMenuComponent({setMenuState,menuState,items,setModalOpen}){return({tableProps,menuProps,actionIcon})=>{const getOwnMenuState=useMemo(()=>menuState[tableProps.id],[menuState]);const dispatchLoading=(label,isLoading)=>setMenuState({type:"SET_LOADING",payload:{id:tableProps.id,loading:{label,isLoading}}});const dispatchOpen=open=>setMenuState({type:"SET_OPEN",payload:{id:tableProps.id,state:{open}}});const handleItemClick=item=>{var _item_modal,_item_action;return item.modal?setModalOpen((_item_modal=item.modal)===null||_item_modal===void 0?void 0:_item_modal.id,tableProps)():(_item_action=item.action)===null||_item_action===void 0?void 0:_item_action.call(item,tableProps,{setLoading:setLoading(item)})};const getTooltipText=item=>{var _item_tooltip_customText,_item_tooltip,_item_tooltip1;return((_item_tooltip=item.tooltip)===null||_item_tooltip===void 0?void 0:(_item_tooltip_customText=_item_tooltip.customText)===null||_item_tooltip_customText===void 0?void 0:_item_tooltip_customText.call(_item_tooltip,tableProps))?(_item_tooltip1=item.tooltip)===null||_item_tooltip1===void 0?void 0:_item_tooltip1.customText(tableProps):getLabel(item.label,tableProps)};const getIsMenuItemDisabled=item=>{var _getOwnMenuState_loading,_item_disabled;return(getOwnMenuState===null||getOwnMenuState===void 0?void 0:(_getOwnMenuState_loading=getOwnMenuState.loading)===null||_getOwnMenuState_loading===void 0?void 0:_getOwnMenuState_loading.includes(item.id))||((_item_disabled=item.disabled)===null||_item_disabled===void 0?void 0:_item_disabled.call(item,tableProps))};const getIcon=item=>typeof item.icon==="function"?_jsx(item.icon,_object_spread({},tableProps)):item.icon;const setLoading=useCallback(item=>value=>{dispatchLoading(item.id,value)},[menuState]);if(items.length<=2){return _jsx("span",{className:classes["icon-container"],children:items.map(item=>{var _item_hidden;if((_item_hidden=item.hidden)===null||_item_hidden===void 0?void 0:_item_hidden.call(item,tableProps))return null;return _jsx(Tooltip,{label:getTooltipText(item),children:_jsx("span",{children:_jsx(ActionIcon,{className:classes.icon,disabled:getIsMenuItemDisabled(item),onClick:()=>handleItemClick(item),children:_jsx("span",{children:getIcon(item)})},item.id)})},item.id)})})}return _jsx(ActionMenu,_object_spread_props(_object_spread({actionIcon:actionIcon,opened:getOwnMenuState===null||getOwnMenuState===void 0?void 0:getOwnMenuState.open,onOpen:()=>dispatchOpen(true),onClose:()=>dispatchOpen(false)},menuProps),{children:_jsx(_Fragment,{children:items.map(item=>{var _item_hidden,_item_tooltip_showInMenu,_item_tooltip;if((_item_hidden=item.hidden)===null||_item_hidden===void 0?void 0:_item_hidden.call(item,tableProps))return null;return _jsx(Tooltip,{label:getTooltipText(item),disabled:!((_item_tooltip=item.tooltip)===null||_item_tooltip===void 0?void 0:(_item_tooltip_showInMenu=_item_tooltip.showInMenu)===null||_item_tooltip_showInMenu===void 0?void 0:_item_tooltip_showInMenu.call(_item_tooltip,tableProps)),children:_jsx("span",{children:_jsx(Menu.Item,{className:classes.item,disabled:getIsMenuItemDisabled(item),onClick:()=>handleItemClick(item),leftSection:getIcon(item),children:getLabel(item.label,tableProps)},item.id)})},item.id)})})}))}}const ActionMenu=_0=>{let{actionIcon,children}=_0,menuProps=_object_without_properties(_0,["actionIcon","children"]);return _jsx("div",{className:classes["action-container"],"data-testid":"table-action-menu",children:_jsxs(Menu,_object_spread_props(_object_spread({shadow:"md",width:180},menuProps),{children:[_jsx(Menu.Target,{children:_jsx(ActionIcon,{"data-testid":"table-action-menu-opener",className:classes.icon,children:actionIcon||_jsx(MoreVertical,{})})}),_jsx(Menu.Dropdown,{children:children})]}))})};export{createWiredActionMenuComponent,ActionMenu};
2
2
  //# sourceMappingURL=ActionMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/Table/components/ActionMenu/ActionMenu.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ActionIcon, Menu, MenuProps } from \"@mantine/core\"\nimport { MoreVertical } from \"lucide-react\"\nimport {\n TActionMenuItem,\n TActionMenuRawProps,\n TMenuConfig,\n TMenuState,\n TWiredActionMenuProps,\n} from \"../../types\"\nimport { Dispatch, ReactNode, useCallback, useMemo } from \"react\"\nimport { Tooltip } from \"../../../Tooltip\"\nimport classes from \"./ActionMenu.module.css\"\n\ntype TcreateWiredActionMenuComponent<TDataType> = {\n setMenuState: Dispatch<{\n type: string\n payload: {\n state?: Partial<TMenuState>\n loading?: { label: string; isLoading: boolean }\n id: string\n }\n }>\n menuState: TMenuConfig\n items: TActionMenuItem<TDataType>[]\n setModalOpen: (\n id: string | undefined,\n tableProps?: TActionMenuRawProps<TDataType>\n ) => (value?: boolean) => void\n}\n\nfunction getLabel<TDataType>(\n label: TActionMenuItem<TDataType>[\"label\"],\n tableProps: TActionMenuRawProps<TDataType>\n) {\n if (typeof label === \"function\") {\n return label(tableProps)\n }\n return label\n}\n\n/**\n *\n * The **Table ActionMenu** has two forms. If less than 3 entries, the menu items are visualized as **ActionIcons**,\n * if more or equal to 3, it's a Menu that the user can open and close.\n * This function (closure) returns the ActionMenu or Block of ActionIcon **Components** that are wired to the ActionMenu state.\n * It is a closure to abstract away the ActionMenu states and return a simple component that fits perfectly into the Table Action Menu Configuration.\n * @param setMenuState Callback to set the MenuState\n * @param menuState Connected state for all **ActionMenu** (not the options, just the menu) on the page\n * @param items Configuration items for the ActionMenu\n * @param setModalOpen Callback to open a modal. Needs the id for the modal\n */\nfunction createWiredActionMenuComponent<TDataType>({\n setMenuState,\n menuState,\n items,\n setModalOpen,\n}: TcreateWiredActionMenuComponent<TDataType>) {\n // Closure function to abstract statehandler from direct props for action item\n // eslint-disable-next-line react/display-name\n return ({ tableProps, menuProps, actionIcon }: TWiredActionMenuProps<TDataType>) => {\n // Simplification function to update value of this explicit ActionMenu in state\n\n const getOwnMenuState = useMemo(() => menuState[tableProps.id], [menuState])\n\n const dispatchLoading = (label: string, isLoading: boolean) =>\n setMenuState({\n type: \"SET_LOADING\",\n payload: {\n id: tableProps.id,\n loading: {\n label,\n isLoading,\n },\n },\n })\n const dispatchOpen = (open: boolean) =>\n setMenuState({\n type: \"SET_OPEN\",\n payload: {\n id: tableProps.id,\n state: {\n open,\n },\n },\n })\n\n const handleItemClick = (item: TActionMenuItem<TDataType>) =>\n item.modal\n ? setModalOpen(item.modal?.id, tableProps)()\n : item.action?.(tableProps, {\n setLoading: setLoading(item),\n })\n\n const getTooltipText = (item: TActionMenuItem<TDataType>) =>\n item.tooltip?.customText?.(tableProps)\n ? item.tooltip?.customText(tableProps)\n : getLabel(item.label, tableProps)\n\n const getIsMenuItemDisabled = (item: TActionMenuItem<TDataType>) =>\n getOwnMenuState?.loading?.includes(item.id) || item.disabled?.(tableProps)\n\n const getIcon = (item: TActionMenuItem<TDataType>) =>\n typeof item.icon === \"function\" ? <item.icon {...tableProps} /> : item.icon\n\n // closure function that alters the menustate to set loading to true for this specific ActionItem\n const setLoading = useCallback(\n (item: TActionMenuItem<TDataType>) => (value: boolean) => {\n dispatchLoading(item.id, value)\n },\n [menuState]\n )\n\n // Condition if the amount of items is less than 3, it's not a menu, it's just two icons next to each other\n if (items.length <= 2) {\n return (\n <span className={classes[\"icon-container\"]}>\n {items.map((item) => {\n if (item.hidden?.(tableProps)) return null\n\n return (\n <Tooltip key={item.id} label={getTooltipText(item)}>\n <span>\n <ActionIcon\n key={item.id}\n className={classes.icon}\n disabled={getIsMenuItemDisabled(item)}\n onClick={() => handleItemClick(item)}\n >\n <span>{getIcon(item)}</span>\n </ActionIcon>\n </span>\n </Tooltip>\n )\n })}\n </span>\n )\n }\n\n return (\n <ActionMenu\n actionIcon={actionIcon}\n opened={getOwnMenuState?.open}\n onOpen={() => dispatchOpen(true)}\n onClose={() => dispatchOpen(false)}\n {...menuProps}\n >\n <>\n {items.map((item) => {\n if (item.hidden?.(tableProps)) return null\n\n return (\n <Tooltip\n key={item.id}\n label={getTooltipText(item)}\n disabled={!item.tooltip?.showInMenu?.(tableProps)}\n >\n <span>\n <Menu.Item\n className={classes.item}\n key={item.id}\n disabled={getIsMenuItemDisabled(item)}\n onClick={() => handleItemClick(item)}\n leftSection={getIcon(item)}\n >\n {getLabel(item.label, tableProps)}\n </Menu.Item>\n </span>\n </Tooltip>\n )\n })}\n </>\n </ActionMenu>\n )\n }\n}\n\ntype TActionMenuProps = MenuProps & {\n actionIcon?: ReactNode\n children: ReactNode\n}\n\n/**\n * Simple UI Action Menu component opened by Icon click\n * @param actionIcon Icon for Opener\n * @param children Children menu items\n * @param menuProps Properties for the Menu component\n * @constructor\n */\nconst ActionMenu = ({ actionIcon, children, ...menuProps }: TActionMenuProps) => {\n return (\n <div className={classes[\"action-container\"]} data-testid={\"table-action-menu\"}>\n <Menu shadow=\"md\" width={180} {...menuProps}>\n <Menu.Target>\n <ActionIcon data-testid={\"table-action-menu-opener\"} className={classes.icon}>\n {actionIcon || <MoreVertical />}\n </ActionIcon>\n </Menu.Target>\n\n <Menu.Dropdown>{children}</Menu.Dropdown>\n </Menu>\n </div>\n )\n}\n\nexport { createWiredActionMenuComponent, ActionMenu }\n"],"names":["ActionIcon","Menu","MoreVertical","useCallback","useMemo","Tooltip","classes","getLabel","label","tableProps","createWiredActionMenuComponent","setMenuState","menuState","items","setModalOpen","menuProps","actionIcon","getOwnMenuState","id","dispatchLoading","isLoading","type","payload","loading","dispatchOpen","open","state","handleItemClick","item","modal","action","setLoading","getTooltipText","tooltip","customText","getIsMenuItemDisabled","includes","disabled","getIcon","icon","value","length","span","className","map","hidden","onClick","ActionMenu","opened","onOpen","onClose","showInMenu","Item","leftSection","children","div","data-testid","shadow","width","Target","Dropdown"],"mappings":"81EAIA,QAASA,UAAU,CAAEC,IAAI,KAAmB,eAAe,AAC3D,QAASC,YAAY,KAAQ,cAAc,AAQ3C,QAA8BC,WAAW,CAAEC,OAAO,KAAQ,OAAO,AACjE,QAASC,OAAO,KAAQ,kBAAkB,AAC1C,QAAOC,YAAa,yBAAyB,CAmB7C,SAASC,SACPC,KAA0C,CAC1CC,UAA0C,EAE1C,GAAI,OAAOD,QAAU,WAAY,CAC/B,OAAOA,MAAMC,WACf,CACA,OAAOD,KACT,CAaA,SAASE,+BAA0C,CACjDC,YAAY,CACZC,SAAS,CACTC,KAAK,CACLC,YAAY,CAC+B,EAG3C,MAAO,CAAC,CAAEL,UAAU,CAAEM,SAAS,CAAEC,UAAU,CAAoC,IAG7E,MAAMC,gBAAkBb,QAAQ,IAAMQ,SAAS,CAACH,WAAWS,EAAE,CAAC,CAAE,CAACN,UAAU,EAE3E,MAAMO,gBAAkB,CAACX,MAAeY,YACtCT,aAAa,CACXU,KAAM,cACNC,QAAS,CACPJ,GAAIT,WAAWS,EAAE,CACjBK,QAAS,CACPf,MACAY,SACF,CACF,CACF,GACF,MAAMI,aAAe,AAACC,MACpBd,aAAa,CACXU,KAAM,WACNC,QAAS,CACPJ,GAAIT,WAAWS,EAAE,CACjBQ,MAAO,CACLD,IACF,CACF,CACF,GAEF,MAAME,gBAAkB,AAACC,WAENA,YACbA,oBAFJA,KAAKC,KAAK,CACNf,cAAac,YAAAA,KAAKC,KAAK,UAAVD,4BAAAA,YAAYV,EAAE,CAAET,eAC7BmB,aAAAA,KAAKE,MAAM,UAAXF,6BAAAA,kBAAAA,KAAcnB,WAAY,CACxBsB,WAAYA,WAAWH,KACzB,IAEN,MAAMI,eAAiB,AAACJ,WACtBA,yBAAAA,cACIA,qBADJA,EAAAA,cAAAA,KAAKK,OAAO,UAAZL,+BAAAA,yBAAAA,cAAcM,UAAU,UAAxBN,yCAAAA,8BAAAA,cAA2BnB,cACvBmB,eAAAA,KAAKK,OAAO,UAAZL,+BAAAA,eAAcM,UAAU,CAACzB,YACzBF,SAASqB,KAAKpB,KAAK,CAAEC,aAE3B,MAAM0B,sBAAwB,AAACP,WAC7BX,yBAA+CW,qBAA/CX,CAAAA,wBAAAA,iCAAAA,yBAAAA,gBAAiBM,OAAO,UAAxBN,yCAAAA,yBAA0BmB,QAAQ,CAACR,KAAKV,EAAE,MAAKU,eAAAA,KAAKS,QAAQ,UAAbT,+BAAAA,oBAAAA,KAAgBnB,cAEjE,MAAM6B,QAAU,AAACV,MACf,OAAOA,KAAKW,IAAI,GAAK,WAAa,KAACX,KAAKW,IAAI,mBAAK9B,aAAiBmB,KAAKW,IAAI,CAG7E,MAAMR,WAAa5B,YACjB,AAACyB,MAAqC,AAACY,QACrCrB,gBAAgBS,KAAKV,EAAE,CAAEsB,MAC3B,EACA,CAAC5B,UAAU,EAIb,GAAIC,MAAM4B,MAAM,EAAI,EAAG,CACrB,OACE,KAACC,QAAKC,UAAWrC,OAAO,CAAC,iBAAiB,UACvCO,MAAM+B,GAAG,CAAC,AAAChB,WACNA,aAAJ,IAAIA,aAAAA,KAAKiB,MAAM,UAAXjB,6BAAAA,kBAAAA,KAAcnB,YAAa,OAAO,KAEtC,OACE,KAACJ,SAAsBG,MAAOwB,eAAeJ,eAC3C,KAACc,iBACC,KAAC1C,YAEC2C,UAAWrC,QAAQiC,IAAI,CACvBF,SAAUF,sBAAsBP,MAChCkB,QAAS,IAAMnB,gBAAgBC,eAE/B,KAACc,iBAAMJ,QAAQV,SALVA,KAAKV,EAAE,KAHJU,KAAKV,EAAE,CAazB,IAGN,CAEA,OACE,KAAC6B,gDACC/B,WAAYA,WACZgC,MAAM,CAAE/B,wBAAAA,gCAAAA,gBAAiBQ,IAAI,CAC7BwB,OAAQ,IAAMzB,aAAa,MAC3B0B,QAAS,IAAM1B,aAAa,QACxBT,qBAEJ,yBACGF,MAAM+B,GAAG,CAAC,AAAChB,WACNA,aAMWA,yBAAAA,cANf,IAAIA,aAAAA,KAAKiB,MAAM,UAAXjB,6BAAAA,kBAAAA,KAAcnB,YAAa,OAAO,KAEtC,OACE,KAACJ,SAECG,MAAOwB,eAAeJ,MACtBS,SAAU,GAACT,cAAAA,KAAKK,OAAO,UAAZL,+BAAAA,yBAAAA,cAAcuB,UAAU,UAAxBvB,yCAAAA,8BAAAA,cAA2BnB,sBAEtC,KAACiC,iBACC,KAACzC,KAAKmD,IAAI,EACRT,UAAWrC,QAAQsB,IAAI,CAEvBS,SAAUF,sBAAsBP,MAChCkB,QAAS,IAAMnB,gBAAgBC,MAC/ByB,YAAaf,QAAQV,eAEpBrB,SAASqB,KAAKpB,KAAK,CAAEC,aALjBmB,KAAKV,EAAE,KAPXU,KAAKV,EAAE,CAiBlB,OAIR,CACF,CAcA,MAAM6B,WAAa,QAAC,CAAE/B,UAAU,CAAEsC,QAAQ,CAAkC,IAA7BvC,mEAC7C,OACE,KAACwC,OAAIZ,UAAWrC,OAAO,CAAC,mBAAmB,CAAEkD,cAAa,6BACxD,MAACvD,0CAAKwD,OAAO,KAAKC,MAAO,KAAS3C,sBAChC,KAACd,KAAK0D,MAAM,WACV,KAAC3D,YAAWwD,cAAa,2BAA4Bb,UAAWrC,QAAQiC,IAAI,UACzEvB,YAAc,KAACd,qBAIpB,KAACD,KAAK2D,QAAQ,WAAEN,gBAIxB,CAEA,QAAS5C,8BAA8B,CAAEqC,UAAU,CAAE"}
1
+ {"version":3,"sources":["../../../../../../src/components/Table/components/ActionMenu/ActionMenu.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { ActionIcon, Menu, MenuProps } from \"@mantine/core\"\nimport { MoreVertical } from \"lucide-react\"\nimport {\n TActionMenuItem,\n TActionMenuRawProps,\n TMenuConfig,\n TMenuState,\n TWiredActionMenuProps,\n} from \"../../types\"\nimport { Dispatch, ReactNode, useCallback, useMemo } from \"react\"\nimport { Tooltip } from \"../../../Tooltip\"\nimport classes from \"./ActionMenu.module.css\"\n\ntype TcreateWiredActionMenuComponent<TDataType> = {\n setMenuState: Dispatch<{\n type: string\n payload: {\n state?: Partial<TMenuState>\n loading?: { label: string; isLoading: boolean }\n id: string\n }\n }>\n menuState: TMenuConfig\n items: TActionMenuItem<TDataType>[]\n setModalOpen: (\n id: string | undefined,\n tableProps?: TActionMenuRawProps<TDataType>\n ) => (value?: boolean) => void\n}\n\nfunction getLabel<TDataType>(\n label: TActionMenuItem<TDataType>[\"label\"],\n tableProps: TActionMenuRawProps<TDataType>\n) {\n if (typeof label === \"function\") {\n return label(tableProps)\n }\n return label\n}\n\n/**\n *\n * The **Table ActionMenu** has two forms. If less than 3 entries, the menu items are visualized as **ActionIcons**,\n * if more or equal to 3, it's a Menu that the user can open and close.\n * This function (closure) returns the ActionMenu or Block of ActionIcon **Components** that are wired to the ActionMenu state.\n * It is a closure to abstract away the ActionMenu states and return a simple component that fits perfectly into the Table Action Menu Configuration.\n * @param setMenuState Callback to set the MenuState\n * @param menuState Connected state for all **ActionMenu** (not the options, just the menu) on the page\n * @param items Configuration items for the ActionMenu\n * @param setModalOpen Callback to open a modal. Needs the id for the modal\n */\nfunction createWiredActionMenuComponent<TDataType>({\n setMenuState,\n menuState,\n items,\n setModalOpen,\n}: TcreateWiredActionMenuComponent<TDataType>) {\n // Closure function to abstract statehandler from direct props for action item\n // eslint-disable-next-line react/display-name\n return ({ tableProps, menuProps, actionIcon }: TWiredActionMenuProps<TDataType>) => {\n // Simplification function to update value of this explicit ActionMenu in state\n\n const getOwnMenuState = useMemo(() => menuState[tableProps.id], [menuState])\n\n const dispatchLoading = (label: string, isLoading: boolean) =>\n setMenuState({\n type: \"SET_LOADING\",\n payload: {\n id: tableProps.id,\n loading: {\n label,\n isLoading,\n },\n },\n })\n const dispatchOpen = (open: boolean) =>\n setMenuState({\n type: \"SET_OPEN\",\n payload: {\n id: tableProps.id,\n state: {\n open,\n },\n },\n })\n\n const handleItemClick = (item: TActionMenuItem<TDataType>) =>\n item.modal\n ? setModalOpen(item.modal?.id, tableProps)()\n : item.action?.(tableProps, {\n setLoading: setLoading(item),\n })\n\n const getTooltipText = (item: TActionMenuItem<TDataType>) =>\n item.tooltip?.customText?.(tableProps)\n ? item.tooltip?.customText(tableProps)\n : getLabel(item.label, tableProps)\n\n const getIsMenuItemDisabled = (item: TActionMenuItem<TDataType>) =>\n getOwnMenuState?.loading?.includes(item.id) || item.disabled?.(tableProps)\n\n const getIcon = (item: TActionMenuItem<TDataType>) =>\n typeof item.icon === \"function\" ? <item.icon {...tableProps} /> : item.icon\n\n // closure function that alters the menustate to set loading to true for this specific ActionItem\n const setLoading = useCallback(\n (item: TActionMenuItem<TDataType>) => (value: boolean) => {\n dispatchLoading(item.id, value)\n },\n [menuState]\n )\n\n // Condition if the amount of items is less than 3, it's not a menu, it's just two icons next to each other\n if (items.length <= 2) {\n return (\n <span className={classes[\"icon-container\"]}>\n {items.map((item) => {\n if (item.hidden?.(tableProps)) return null\n\n return (\n <Tooltip key={item.id} label={getTooltipText(item)}>\n <span>\n <ActionIcon\n key={item.id}\n className={classes.icon}\n disabled={getIsMenuItemDisabled(item)}\n onClick={() => handleItemClick(item)}\n >\n <span>{getIcon(item)}</span>\n </ActionIcon>\n </span>\n </Tooltip>\n )\n })}\n </span>\n )\n }\n\n return (\n <ActionMenu\n actionIcon={actionIcon}\n opened={getOwnMenuState?.open}\n onOpen={() => dispatchOpen(true)}\n onClose={() => dispatchOpen(false)}\n {...menuProps}\n >\n <>\n {items.map((item) => {\n if (item.hidden?.(tableProps)) return null\n\n return (\n <Tooltip\n key={item.id}\n label={getTooltipText(item)}\n disabled={!item.tooltip?.showInMenu?.(tableProps)}\n >\n <span>\n <Menu.Item\n className={classes.item}\n key={item.id}\n disabled={getIsMenuItemDisabled(item)}\n onClick={() => handleItemClick(item)}\n leftSection={getIcon(item)}\n >\n {getLabel(item.label, tableProps)}\n </Menu.Item>\n </span>\n </Tooltip>\n )\n })}\n </>\n </ActionMenu>\n )\n }\n}\n\ntype TActionMenuProps = MenuProps & {\n actionIcon?: ReactNode\n children: ReactNode\n}\n\n/**\n * Simple UI Action Menu component opened by Icon click\n * @param actionIcon Icon for Opener\n * @param children Children menu items\n * @param menuProps Properties for the Menu component\n * @constructor\n */\nconst ActionMenu = ({ actionIcon, children, ...menuProps }: TActionMenuProps) => {\n return (\n <div className={classes[\"action-container\"]} data-testid={\"table-action-menu\"}>\n <Menu shadow=\"md\" width={180} {...menuProps}>\n <Menu.Target>\n <ActionIcon data-testid={\"table-action-menu-opener\"} className={classes.icon}>\n {actionIcon || <MoreVertical />}\n </ActionIcon>\n </Menu.Target>\n\n <Menu.Dropdown>{children}</Menu.Dropdown>\n </Menu>\n </div>\n )\n}\n\nexport { createWiredActionMenuComponent, ActionMenu }\n"],"names":["ActionIcon","Menu","MoreVertical","useCallback","useMemo","Tooltip","classes","getLabel","label","tableProps","createWiredActionMenuComponent","setMenuState","menuState","items","setModalOpen","menuProps","actionIcon","getOwnMenuState","id","dispatchLoading","isLoading","type","payload","loading","dispatchOpen","open","state","handleItemClick","item","modal","action","setLoading","getTooltipText","tooltip","customText","getIsMenuItemDisabled","includes","disabled","getIcon","icon","value","length","span","className","map","hidden","onClick","ActionMenu","opened","onOpen","onClose","showInMenu","Item","leftSection","children","div","data-testid","shadow","width","Target","Dropdown"],"mappings":"s2EAIA,QAASA,UAAU,CAAEC,IAAI,KAAmB,eAAe,AAC3D,QAASC,YAAY,KAAQ,cAAc,AAQ3C,QAA8BC,WAAW,CAAEC,OAAO,KAAQ,OAAO,AACjE,QAASC,OAAO,KAAQ,kBAAkB,AAC1C,QAAOC,YAAa,yBAAyB,CAmB7C,SAASC,SACPC,KAA0C,CAC1CC,UAA0C,EAE1C,GAAI,OAAOD,QAAU,WAAY,CAC/B,OAAOA,MAAMC,WACf,CACA,OAAOD,KACT,CAaA,SAASE,+BAA0C,CACjDC,YAAY,CACZC,SAAS,CACTC,KAAK,CACLC,YAAY,CAC+B,EAG3C,MAAO,CAAC,CAAEL,UAAU,CAAEM,SAAS,CAAEC,UAAU,CAAoC,IAG7E,MAAMC,gBAAkBb,QAAQ,IAAMQ,SAAS,CAACH,WAAWS,EAAE,CAAC,CAAE,CAACN,UAAU,EAE3E,MAAMO,gBAAkB,CAACX,MAAeY,YACtCT,aAAa,CACXU,KAAM,cACNC,QAAS,CACPJ,GAAIT,WAAWS,EAAE,CACjBK,QAAS,CACPf,MACAY,SACF,CACF,CACF,GACF,MAAMI,aAAe,AAACC,MACpBd,aAAa,CACXU,KAAM,WACNC,QAAS,CACPJ,GAAIT,WAAWS,EAAE,CACjBQ,MAAO,CACLD,IACF,CACF,CACF,GAEF,MAAME,gBAAkB,AAACC,WAENA,YACbA,oBAFJA,KAAKC,KAAK,CACNf,cAAac,YAAAA,KAAKC,KAAK,UAAVD,4BAAAA,YAAYV,EAAE,CAAET,eAC7BmB,aAAAA,KAAKE,MAAM,UAAXF,6BAAAA,kBAAAA,KAAcnB,WAAY,CACxBsB,WAAYA,WAAWH,KACzB,IAEN,MAAMI,eAAiB,AAACJ,WACtBA,yBAAAA,cACIA,qBADJA,EAAAA,cAAAA,KAAKK,OAAO,UAAZL,+BAAAA,yBAAAA,cAAcM,UAAU,UAAxBN,yCAAAA,8BAAAA,cAA2BnB,cACvBmB,eAAAA,KAAKK,OAAO,UAAZL,+BAAAA,eAAcM,UAAU,CAACzB,YACzBF,SAASqB,KAAKpB,KAAK,CAAEC,aAE3B,MAAM0B,sBAAwB,AAACP,WAC7BX,yBAA+CW,qBAA/CX,CAAAA,wBAAAA,iCAAAA,yBAAAA,gBAAiBM,OAAO,UAAxBN,yCAAAA,yBAA0BmB,QAAQ,CAACR,KAAKV,EAAE,MAAKU,eAAAA,KAAKS,QAAQ,UAAbT,+BAAAA,oBAAAA,KAAgBnB,cAEjE,MAAM6B,QAAU,AAACV,MACf,OAAOA,KAAKW,IAAI,GAAK,WAAa,KAACX,KAAKW,IAAI,mBAAK9B,aAAiBmB,KAAKW,IAAI,CAG7E,MAAMR,WAAa5B,YACjB,AAACyB,MAAqC,AAACY,QACrCrB,gBAAgBS,KAAKV,EAAE,CAAEsB,MAC3B,EACA,CAAC5B,UAAU,EAIb,GAAIC,MAAM4B,MAAM,EAAI,EAAG,CACrB,OACE,KAACC,QAAKC,UAAWrC,OAAO,CAAC,iBAAiB,UACvCO,MAAM+B,GAAG,CAAC,AAAChB,WACNA,aAAJ,IAAIA,aAAAA,KAAKiB,MAAM,UAAXjB,6BAAAA,kBAAAA,KAAcnB,YAAa,OAAO,KAEtC,OACE,KAACJ,SAAsBG,MAAOwB,eAAeJ,eAC3C,KAACc,iBACC,KAAC1C,YAEC2C,UAAWrC,QAAQiC,IAAI,CACvBF,SAAUF,sBAAsBP,MAChCkB,QAAS,IAAMnB,gBAAgBC,eAE/B,KAACc,iBAAMJ,QAAQV,SALVA,KAAKV,EAAE,KAHJU,KAAKV,EAAE,CAazB,IAGN,CAEA,OACE,KAAC6B,gDACC/B,WAAYA,WACZgC,MAAM,CAAE/B,wBAAAA,gCAAAA,gBAAiBQ,IAAI,CAC7BwB,OAAQ,IAAMzB,aAAa,MAC3B0B,QAAS,IAAM1B,aAAa,QACxBT,qBAEJ,yBACGF,MAAM+B,GAAG,CAAC,AAAChB,WACNA,aAMWA,yBAAAA,cANf,IAAIA,aAAAA,KAAKiB,MAAM,UAAXjB,6BAAAA,kBAAAA,KAAcnB,YAAa,OAAO,KAEtC,OACE,KAACJ,SAECG,MAAOwB,eAAeJ,MACtBS,SAAU,GAACT,cAAAA,KAAKK,OAAO,UAAZL,+BAAAA,yBAAAA,cAAcuB,UAAU,UAAxBvB,yCAAAA,8BAAAA,cAA2BnB,sBAEtC,KAACiC,iBACC,KAACzC,KAAKmD,IAAI,EACRT,UAAWrC,QAAQsB,IAAI,CAEvBS,SAAUF,sBAAsBP,MAChCkB,QAAS,IAAMnB,gBAAgBC,MAC/ByB,YAAaf,QAAQV,eAEpBrB,SAASqB,KAAKpB,KAAK,CAAEC,aALjBmB,KAAKV,EAAE,KAPXU,KAAKV,EAAE,CAiBlB,OAIR,CACF,CAcA,MAAM6B,WAAa,QAAC,CAAE/B,UAAU,CAAEsC,QAAQ,CAAkC,IAA7BvC,mEAC7C,OACE,KAACwC,OAAIZ,UAAWrC,OAAO,CAAC,mBAAmB,CAAEkD,cAAa,6BACxD,MAACvD,0CAAKwD,OAAO,KAAKC,MAAO,KAAS3C,sBAChC,KAACd,KAAK0D,MAAM,WACV,KAAC3D,YAAWwD,cAAa,2BAA4Bb,UAAWrC,QAAQiC,IAAI,UACzEvB,YAAc,KAACd,qBAIpB,KAACD,KAAK2D,QAAQ,WAAEN,gBAIxB,CAEA,QAAS5C,8BAA8B,CAAEqC,UAAU,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{Badge}from"../Badge";import{EThemeColors}from"../../theme";import{TextWithTooltip}from"../TextWithTooltip";import classes from"./Tag.module.css";export const Tag=_0=>{let{name,value}=_0,badgeProps=_object_without_properties(_0,["name","value"]);return _jsx(Badge,_object_spread_props(_object_spread({className:classes["tag-name"],color:EThemeColors.NeutralLight},badgeProps),{children:_jsx(TextWithTooltip,{tooltipProps:{multiline:true,style:{width:300}},classNameText:classes.typo,classNameTooltip:classes["tooltip-text"],text:`${name}: ${value}`,tooltip:`${name}: ${value}`,typoType:"small"})}))};
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{Badge}from"../Badge";import{EThemeColors}from"../../theme";import{TextWithTooltip}from"../TextWithTooltip";import classes from"./Tag.module.css";export const Tag=_0=>{let{name,value,icon}=_0,badgeProps=_object_without_properties(_0,["name","value","icon"]);return _jsx(Badge,_object_spread_props(_object_spread({className:classes["tag-name"],color:EThemeColors.NeutralLight},badgeProps),{children:_jsxs("span",{className:classes.content,children:[icon?_jsx("span",{className:classes["left-icon"],children:icon}):null,_jsx(TextWithTooltip,{tooltipProps:{multiline:true,style:{width:300}},classNameText:classes.typo,classNameTooltip:classes["tooltip-text"],text:`${name}: ${value}`,tooltip:`${name}: ${value}`,typoType:"small"})]})}))};
2
2
  //# sourceMappingURL=Tag.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { FC } from \"react\"\nimport { Badge, TBadgeProps } from \"../Badge\"\nimport { EThemeColors } from \"../../theme\"\nimport { TextWithTooltip } from \"../TextWithTooltip\"\nimport classes from \"./Tag.module.css\"\n\nexport type TTagProps = Partial<TBadgeProps> & {\n name: string\n value: string\n}\nexport const Tag: FC<TTagProps> = ({ name, value, ...badgeProps }) => {\n return (\n <Badge className={classes[\"tag-name\"]} color={EThemeColors.NeutralLight} {...badgeProps}>\n <TextWithTooltip\n tooltipProps={{\n multiline: true,\n style: {\n width: 300,\n },\n }}\n classNameText={classes.typo}\n classNameTooltip={classes[\"tooltip-text\"]}\n text={`${name}: ${value}`}\n tooltip={`${name}: ${value}`}\n typoType={\"small\"}\n />\n </Badge>\n )\n}\n"],"names":["Badge","EThemeColors","TextWithTooltip","classes","Tag","name","value","badgeProps","className","color","NeutralLight","tooltipProps","multiline","style","width","classNameText","typo","classNameTooltip","text","tooltip","typoType"],"mappings":"0zEAKA,QAASA,KAAK,KAAqB,UAAU,AAC7C,QAASC,YAAY,KAAQ,aAAa,AAC1C,QAASC,eAAe,KAAQ,oBAAoB,AACpD,QAAOC,YAAa,kBAAkB,AAMtC,QAAO,MAAMC,IAAqB,QAAC,CAAEC,IAAI,CAAEC,KAAK,CAAiB,IAAZC,2DACnD,OACE,KAACP,2CAAMQ,UAAWL,OAAO,CAAC,WAAW,CAAEM,MAAOR,aAAaS,YAAY,EAAMH,sBAC3E,KAACL,iBACCS,aAAc,CACZC,UAAW,KACXC,MAAO,CACLC,MAAO,GACT,CACF,EACAC,cAAeZ,QAAQa,IAAI,CAC3BC,iBAAkBd,OAAO,CAAC,eAAe,CACzCe,KAAM,CAAC,EAAEb,KAAK,EAAE,EAAEC,MAAM,CAAC,CACzBa,QAAS,CAAC,EAAEd,KAAK,EAAE,EAAEC,MAAM,CAAC,CAC5Bc,SAAU,YAIlB,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { FC, ReactNode } from \"react\"\nimport { Badge, TBadgeProps } from \"../Badge\"\nimport { EThemeColors } from \"../../theme\"\nimport { TextWithTooltip } from \"../TextWithTooltip\"\nimport classes from \"./Tag.module.css\"\n\nexport type TTagProps = Partial<TBadgeProps> & {\n name: string\n value: string\n icon?: ReactNode\n}\nexport const Tag: FC<TTagProps> = ({ name, value, icon, ...badgeProps }) => {\n return (\n <Badge className={classes[\"tag-name\"]} color={EThemeColors.NeutralLight} {...badgeProps}>\n <span className={classes.content}>\n {icon ? <span className={classes[\"left-icon\"]}>{icon}</span> : null}\n <TextWithTooltip\n tooltipProps={{\n multiline: true,\n style: {\n width: 300,\n },\n }}\n classNameText={classes.typo}\n classNameTooltip={classes[\"tooltip-text\"]}\n text={`${name}: ${value}`}\n tooltip={`${name}: ${value}`}\n typoType={\"small\"}\n />\n </span>\n </Badge>\n )\n}\n"],"names":["Badge","EThemeColors","TextWithTooltip","classes","Tag","name","value","icon","badgeProps","className","color","NeutralLight","span","content","tooltipProps","multiline","style","width","classNameText","typo","classNameTooltip","text","tooltip","typoType"],"mappings":"g1EAKA,QAASA,KAAK,KAAqB,UAAU,AAC7C,QAASC,YAAY,KAAQ,aAAa,AAC1C,QAASC,eAAe,KAAQ,oBAAoB,AACpD,QAAOC,YAAa,kBAAkB,AAOtC,QAAO,MAAMC,IAAqB,QAAC,CAAEC,IAAI,CAAEC,KAAK,CAAEC,IAAI,CAAiB,IAAZC,kEACzD,OACE,KAACR,2CAAMS,UAAWN,OAAO,CAAC,WAAW,CAAEO,MAAOT,aAAaU,YAAY,EAAMH,sBAC3E,MAACI,QAAKH,UAAWN,QAAQU,OAAO,WAC7BN,KAAO,KAACK,QAAKH,UAAWN,OAAO,CAAC,YAAY,UAAGI,OAAe,KAC/D,KAACL,iBACCY,aAAc,CACZC,UAAW,KACXC,MAAO,CACLC,MAAO,GACT,CACF,EACAC,cAAef,QAAQgB,IAAI,CAC3BC,iBAAkBjB,OAAO,CAAC,eAAe,CACzCkB,KAAM,CAAC,EAAEhB,KAAK,EAAE,EAAEC,MAAM,CAAC,CACzBgB,QAAS,CAAC,EAAEjB,KAAK,EAAE,EAAEC,MAAM,CAAC,CAC5BiB,SAAU,eAKpB,CAAC"}
@@ -1 +1 @@
1
- .tag-name{margin-right:calc(.25rem*var(--mantine-scale))}.typo{color:inherit}.tooltip-text{word-break:break-all}
1
+ .tag-name{margin-right:calc(.25rem*var(--mantine-scale))}.typo{color:inherit}.tooltip-text{word-break:break-all}.content{gap:var(--mantine-spacing-xs)}.content,.left-icon{align-items:center;display:inline-flex}
@@ -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{jsxs as _jsxs}from"react/jsx-runtime";import{Typo}from"../Typo";import{DateTime,IANAZone}from"luxon";export const getTimeZoneInformation=ianaTimeZone=>{var _now_zoneName;const browserTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone;const fallbackTimeZone="UTC";if(!ianaTimeZone){ianaTimeZone=browserTimeZone}if(!IANAZone.isValidZone(ianaTimeZone)){ianaTimeZone=fallbackTimeZone;console.warn(`Invalid timezone provided: ${ianaTimeZone}. Using fallback timezone: ${fallbackTimeZone}`)}const now=DateTime.now().setZone(ianaTimeZone);const offsetMinutes=now.offset;const offsetHours=offsetMinutes/60;const sign=offsetMinutes>=0?"+":"-";const hoursPart=Math.floor(Math.abs(offsetMinutes)/60).toString().padStart(2,"0");const minutesPart=(Math.abs(offsetMinutes)%60).toString().padStart(2,"0");const offsetString=`${sign}${hoursPart}:${minutesPart}`;const label=(_now_zoneName=now.zoneName)!==null&&_now_zoneName!==void 0?_now_zoneName:fallbackTimeZone;return{label,offsetMinutes,offsetHours,offsetString}};export const TimeZoneInfo=_0=>{let{timezone}=_0,props=_object_without_properties(_0,["timezone"]);return _jsxs(Typo,_object_spread_props(_object_spread({type:"body",display:"inline"},props),{children:[timezone.label," (GMT ",timezone.offsetString,")"]}))};
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{jsxs as _jsxs}from"react/jsx-runtime";import{Typo}from"../Typo";import{DateTime,IANAZone}from"luxon";export const getTimeZoneInformation=ianaTimeZone=>{var _now_zoneName;const browserTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone;const fallbackTimeZone="UTC";if(!ianaTimeZone){ianaTimeZone=browserTimeZone}if(!IANAZone.isValidZone(ianaTimeZone)){ianaTimeZone=fallbackTimeZone;console.warn(`Invalid timezone provided: ${ianaTimeZone}. Using fallback timezone: ${fallbackTimeZone}`)}const now=DateTime.now().setZone(ianaTimeZone);const offsetMinutes=now.offset;const offsetHours=offsetMinutes/60;const sign=offsetMinutes>=0?"+":"-";const hoursPart=Math.floor(Math.abs(offsetMinutes)/60).toString().padStart(2,"0");const minutesPart=(Math.abs(offsetMinutes)%60).toString().padStart(2,"0");const offsetString=`${sign}${hoursPart}:${minutesPart}`;const label=(_now_zoneName=now.zoneName)!==null&&_now_zoneName!==void 0?_now_zoneName:fallbackTimeZone;return{label,offsetMinutes,offsetHours,offsetString}};export const TimeZoneInfo=_0=>{let{timezone}=_0,props=_object_without_properties(_0,["timezone"]);return _jsxs(Typo,_object_spread_props(_object_spread({type:"body",display:"inline"},props),{children:[timezone.label," (GMT ",timezone.offsetString,")"]}))};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/TimeZoneInfo/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { FC } from \"react\"\nimport { TTypoProps, Typo } from \"../Typo\"\nimport { DateTime, IANAZone } from \"luxon\"\n\nexport type TTimeZoneDetails = {\n label: string\n offsetMinutes: number\n offsetHours: number\n offsetString: string\n}\n\nexport const getTimeZoneInformation = (ianaTimeZone?: string): TTimeZoneDetails => {\n const browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone\n const fallbackTimeZone = \"UTC\"\n\n if (!ianaTimeZone) {\n ianaTimeZone = browserTimeZone\n }\n\n if (!IANAZone.isValidZone(ianaTimeZone)) {\n ianaTimeZone = fallbackTimeZone\n console.warn(\n `Invalid timezone provided: ${ianaTimeZone}. Using fallback timezone: ${fallbackTimeZone}`\n )\n }\n\n const now = DateTime.now().setZone(ianaTimeZone)\n const offsetMinutes = now.offset\n const offsetHours = offsetMinutes / 60\n const sign = offsetMinutes >= 0 ? \"+\" : \"-\"\n const hoursPart = Math.floor(Math.abs(offsetMinutes) / 60)\n .toString()\n .padStart(2, \"0\")\n const minutesPart = (Math.abs(offsetMinutes) % 60).toString().padStart(2, \"0\")\n const offsetString = `${sign}${hoursPart}:${minutesPart}`\n const label = now.zoneName ?? fallbackTimeZone\n\n return {\n label,\n offsetMinutes,\n offsetHours,\n offsetString,\n }\n}\n\nexport type TTimeZoneInfoProps = Partial<TTypoProps> & {\n timezone: TTimeZoneDetails\n}\nexport const TimeZoneInfo: FC<TTimeZoneInfoProps> = ({ timezone, ...props }) => {\n return (\n <Typo type={\"body\"} display={\"inline\"} {...props}>\n {timezone.label} (GMT {timezone.offsetString})\n </Typo>\n )\n}\n"],"names":["Typo","DateTime","IANAZone","getTimeZoneInformation","ianaTimeZone","now","browserTimeZone","Intl","DateTimeFormat","resolvedOptions","timeZone","fallbackTimeZone","isValidZone","console","warn","setZone","offsetMinutes","offset","offsetHours","sign","hoursPart","Math","floor","abs","toString","padStart","minutesPart","offsetString","label","zoneName","TimeZoneInfo","timezone","props","type","display"],"mappings":"4zEAKA,QAAqBA,IAAI,KAAQ,SAAS,AAC1C,QAASC,QAAQ,CAAEC,QAAQ,KAAQ,OAAO,AAS1C,QAAO,MAAMC,uBAAyB,AAACC,mBAwBvBC,cAvBd,MAAMC,gBAAkBC,KAAKC,cAAc,GAAGC,eAAe,GAAGC,QAAQ,CACxE,MAAMC,iBAAmB,MAEzB,GAAI,CAACP,aAAc,CACjBA,aAAeE,eACjB,CAEA,GAAI,CAACJ,SAASU,WAAW,CAACR,cAAe,CACvCA,aAAeO,iBACfE,QAAQC,IAAI,CACV,CAAC,2BAA2B,EAAEV,aAAa,2BAA2B,EAAEO,iBAAiB,CAAC,CAE9F,CAEA,MAAMN,IAAMJ,SAASI,GAAG,GAAGU,OAAO,CAACX,cACnC,MAAMY,cAAgBX,IAAIY,MAAM,CAChC,MAAMC,YAAcF,cAAgB,GACpC,MAAMG,KAAOH,eAAiB,EAAI,IAAM,IACxC,MAAMI,UAAYC,KAAKC,KAAK,CAACD,KAAKE,GAAG,CAACP,eAAiB,IACpDQ,QAAQ,GACRC,QAAQ,CAAC,EAAG,KACf,MAAMC,YAAc,AAACL,CAAAA,KAAKE,GAAG,CAACP,eAAiB,EAAC,EAAGQ,QAAQ,GAAGC,QAAQ,CAAC,EAAG,KAC1E,MAAME,aAAe,CAAC,EAAER,KAAK,EAAEC,UAAU,CAAC,EAAEM,YAAY,CAAC,CACzD,MAAME,OAAQvB,cAAAA,IAAIwB,QAAQ,UAAZxB,uBAAAA,cAAgBM,iBAE9B,MAAO,CACLiB,MACAZ,cACAE,YACAS,YACF,CACF,CAAC,AAKD,QAAO,MAAMG,aAAuC,QAAC,CAAEC,QAAQ,CAAY,IAAPC,kDAClE,OACE,MAAChC,0CAAKiC,KAAM,OAAQC,QAAS,UAAcF,kBACxCD,SAASH,KAAK,CAAC,SAAOG,SAASJ,YAAY,CAAC,OAGnD,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/TimeZoneInfo/index.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { FC } from \"react\"\nimport { TTypoProps, Typo } from \"../Typo\"\nimport { DateTime, IANAZone } from \"luxon\"\n\nexport type TTimeZoneDetails = {\n label: string\n offsetMinutes: number\n offsetHours: number\n offsetString: string\n}\n\nexport const getTimeZoneInformation = (ianaTimeZone?: string): TTimeZoneDetails => {\n const browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone\n const fallbackTimeZone = \"UTC\"\n\n if (!ianaTimeZone) {\n ianaTimeZone = browserTimeZone\n }\n\n if (!IANAZone.isValidZone(ianaTimeZone)) {\n ianaTimeZone = fallbackTimeZone\n console.warn(\n `Invalid timezone provided: ${ianaTimeZone}. Using fallback timezone: ${fallbackTimeZone}`\n )\n }\n\n const now = DateTime.now().setZone(ianaTimeZone)\n const offsetMinutes = now.offset\n const offsetHours = offsetMinutes / 60\n const sign = offsetMinutes >= 0 ? \"+\" : \"-\"\n const hoursPart = Math.floor(Math.abs(offsetMinutes) / 60)\n .toString()\n .padStart(2, \"0\")\n const minutesPart = (Math.abs(offsetMinutes) % 60).toString().padStart(2, \"0\")\n const offsetString = `${sign}${hoursPart}:${minutesPart}`\n const label = now.zoneName ?? fallbackTimeZone\n\n return {\n label,\n offsetMinutes,\n offsetHours,\n offsetString,\n }\n}\n\nexport type TTimeZoneInfoProps = Partial<TTypoProps> & {\n timezone: TTimeZoneDetails\n}\nexport const TimeZoneInfo: FC<TTimeZoneInfoProps> = ({ timezone, ...props }) => {\n return (\n <Typo type={\"body\"} display={\"inline\"} {...props}>\n {timezone.label} (GMT {timezone.offsetString})\n </Typo>\n )\n}\n"],"names":["Typo","DateTime","IANAZone","getTimeZoneInformation","ianaTimeZone","now","browserTimeZone","Intl","DateTimeFormat","resolvedOptions","timeZone","fallbackTimeZone","isValidZone","console","warn","setZone","offsetMinutes","offset","offsetHours","sign","hoursPart","Math","floor","abs","toString","padStart","minutesPart","offsetString","label","zoneName","TimeZoneInfo","timezone","props","type","display"],"mappings":"o0EAKA,QAAqBA,IAAI,KAAQ,SAAS,AAC1C,QAASC,QAAQ,CAAEC,QAAQ,KAAQ,OAAO,AAS1C,QAAO,MAAMC,uBAAyB,AAACC,mBAwBvBC,cAvBd,MAAMC,gBAAkBC,KAAKC,cAAc,GAAGC,eAAe,GAAGC,QAAQ,CACxE,MAAMC,iBAAmB,MAEzB,GAAI,CAACP,aAAc,CACjBA,aAAeE,eACjB,CAEA,GAAI,CAACJ,SAASU,WAAW,CAACR,cAAe,CACvCA,aAAeO,iBACfE,QAAQC,IAAI,CACV,CAAC,2BAA2B,EAAEV,aAAa,2BAA2B,EAAEO,iBAAiB,CAAC,CAE9F,CAEA,MAAMN,IAAMJ,SAASI,GAAG,GAAGU,OAAO,CAACX,cACnC,MAAMY,cAAgBX,IAAIY,MAAM,CAChC,MAAMC,YAAcF,cAAgB,GACpC,MAAMG,KAAOH,eAAiB,EAAI,IAAM,IACxC,MAAMI,UAAYC,KAAKC,KAAK,CAACD,KAAKE,GAAG,CAACP,eAAiB,IACpDQ,QAAQ,GACRC,QAAQ,CAAC,EAAG,KACf,MAAMC,YAAc,AAACL,CAAAA,KAAKE,GAAG,CAACP,eAAiB,EAAC,EAAGQ,QAAQ,GAAGC,QAAQ,CAAC,EAAG,KAC1E,MAAME,aAAe,CAAC,EAAER,KAAK,EAAEC,UAAU,CAAC,EAAEM,YAAY,CAAC,CACzD,MAAME,OAAQvB,cAAAA,IAAIwB,QAAQ,UAAZxB,uBAAAA,cAAgBM,iBAE9B,MAAO,CACLiB,MACAZ,cACAE,YACAS,YACF,CACF,CAAC,AAKD,QAAO,MAAMG,aAAuC,QAAC,CAAEC,QAAQ,CAAY,IAAPC,kDAClE,OACE,MAAChC,0CAAKiC,KAAM,OAAQC,QAAS,UAAcF,kBACxCD,SAASH,KAAK,CAAC,SAAOG,SAASJ,YAAY,CAAC,OAGnD,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}from"react/jsx-runtime";import{Tooltip as MantineTooltip}from"@mantine/core";export const Tooltip=_0=>{let{children,width}=_0,props=_object_without_properties(_0,["children","width"]);return _jsx(MantineTooltip,_object_spread_props(_object_spread({withArrow:true,arrowSize:8,offset:0,withinPortal:true,style:{width}},props),{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}from"react/jsx-runtime";import{Tooltip as MantineTooltip}from"@mantine/core";export const Tooltip=_0=>{let{children,width}=_0,props=_object_without_properties(_0,["children","width"]);return _jsx(MantineTooltip,_object_spread_props(_object_spread({withArrow:true,arrowSize:8,offset:0,withinPortal:true,style:{width}},props),{children:children}))};
2
2
  //# sourceMappingURL=Tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { TooltipProps, Tooltip as MantineTooltip } from \"@mantine/core\"\n\n// Width extra property is to keep the same interface in MantineV7 Lib with MantineV6 Lib\nexport const Tooltip = ({ children, width, ...props }: TooltipProps & { width?: number }) => {\n return (\n <MantineTooltip\n withArrow\n arrowSize={8}\n offset={0}\n withinPortal={true}\n style={{\n width,\n }}\n {...props}\n >\n {children}\n </MantineTooltip>\n )\n}\n"],"names":["Tooltip","MantineTooltip","children","width","props","withArrow","arrowSize","offset","withinPortal","style"],"mappings":"0zEAIA,QAAuBA,WAAWC,cAAc,KAAQ,eAAe,AAGvE,QAAO,MAAMD,QAAU,QAAC,CAAEE,QAAQ,CAAEC,KAAK,CAA+C,IAA1CC,0DAC5C,OACE,KAACH,oDACCI,SAAS,MACTC,UAAW,EACXC,OAAQ,EACRC,aAAc,KACdC,MAAO,CACLN,KACF,GACIC,iBAEHF,WAGP,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/* Copyright (C) Greenbone AG\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { TooltipProps, Tooltip as MantineTooltip } from \"@mantine/core\"\n\n// Width extra property is to keep the same interface in MantineV7 Lib with MantineV6 Lib\nexport const Tooltip = ({ children, width, ...props }: TooltipProps & { width?: number }) => {\n return (\n <MantineTooltip\n withArrow\n arrowSize={8}\n offset={0}\n withinPortal={true}\n style={{\n width,\n }}\n {...props}\n >\n {children}\n </MantineTooltip>\n )\n}\n"],"names":["Tooltip","MantineTooltip","children","width","props","withArrow","arrowSize","offset","withinPortal","style"],"mappings":"k0EAIA,QAAuBA,WAAWC,cAAc,KAAQ,eAAe,AAGvE,QAAO,MAAMD,QAAU,QAAC,CAAEE,QAAQ,CAAEC,KAAK,CAA+C,IAA1CC,0DAC5C,OACE,KAACH,oDACCI,SAAS,MACTC,UAAW,EACXC,OAAQ,EACRC,aAAc,KACdC,MAAO,CACLN,KACF,GACIC,iBAEHF,WAGP,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}from"react/jsx-runtime";import{forwardRef}from"react";import{Text,Title}from"@mantine/core";import classes from"./Typo.module.css";import{cx}from"../../helper/cx";const Typo=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=_jsx(Text,_object_spread_props(_object_spread({className:cx(classes.root,classes[`${rootType}-root`],underline?classes.underline:undefined,isLink?"":classes["cursor-text"],className,classes[type]),ref:innerRef},props),{children:children}));if(type.includes("heading")){const headingOrder=Number(type.slice(-1));content=_jsx(Title,{className:cx(classes.root,classes[`${rootType}-root`],className,classes[type]),order:headingOrder,ref:ref,children:content})}else if(withWrapper){return _jsx("span",{ref:ref,className:(wrapperProps===null||wrapperProps===void 0?void 0:wrapperProps.noFullWidth)?"":classes.wrapper,children:content})}return content});export{Typo};
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{forwardRef}from"react";import{Text,Title}from"@mantine/core";import classes from"./Typo.module.css";import{cx}from"../../helper/cx";const Typo=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=_jsx(Text,_object_spread_props(_object_spread({className:cx(classes.root,classes[`${rootType}-root`],underline?classes.underline:undefined,isLink?"":classes["cursor-text"],className,classes[type]),ref:innerRef},props),{children:children}));if(type.includes("heading")){const headingOrder=Number(type.slice(-1));content=_jsx(Title,{className:cx(classes.root,classes[`${rootType}-root`],className,classes[type]),order:headingOrder,ref:ref,children:content})}else if(withWrapper){return _jsx("span",{ref:ref,className:(wrapperProps===null||wrapperProps===void 0?void 0:wrapperProps.noFullWidth)?"":classes.wrapper,children:content})}return content});export{Typo};
2
2
  //# sourceMappingURL=Typo.js.map