@devtron-labs/devtron-fe-common-lib 0.0.38 → 0.0.39

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.
@@ -0,0 +1 @@
1
+ export declare const useClickOutside: (ref: any, callback: () => void) => void;
@@ -1 +1,2 @@
1
1
  export { useSuperAdmin } from './UseSuperAdmin/UseSuperAdmin';
2
+ export { useClickOutside } from './UseClickOutside/UseClickOutside';
package/dist/index.js CHANGED
@@ -22845,7 +22845,7 @@ var Toggle = function (_a) {
22845
22845
  return (jsxRuntime.jsxs("label", __assign({}, props, { className: "".concat(rootClassName, " toggle__switch ").concat(disabled ? 'disabled' : ''), style: (_b = {}, _b['--color'] = color, _b) }, { children: [jsxRuntime.jsx("input", { type: "checkbox", checked: !!active, onChange: handleClick, className: "toggle__input" }), jsxRuntime.jsx("span", __assign({ className: "toggle__slider ".concat(Icon ? 'with-icon br-4 dc__border' : 'round'), "data-testid": dataTestId }, { children: Icon && jsxRuntime.jsx(Icon, { className: "icon-dim-20 br-4 p-2 ".concat(iconClass) }) }))] })));
22846
22846
  };
22847
22847
 
22848
- var css_248z$1 = ".modal-body--scan-details {\n position: fixed;\n top: 0;\n right: 0;\n background: var(--N000);\n width: 800px;\n}\n\n.security-tab__table {\n width: 100%;\n}\n\n.security-tab__table-header {\n border-bottom: solid 1px var(--N200);\n}\n\n.security-cell-header {\n font-size: 12px;\n font-weight: 600;\n line-height: 1.5;\n letter-spacing: normal;\n text-transform: uppercase;\n color: var(--N500);\n}\n\n.dc__security-tab__table-row {\n font-size: 13px;\n font-weight: normal;\n line-height: 1.54;\n letter-spacing: normal;\n color: var(--N900);\n box-shadow: inset 0 -1px 0 0 #f5f5f5;\n}\n\n.security-tab__cell-cve,\n.security-tab__cell-severity,\n.security-tab__cell-package,\n.security-tab__cell-current-ver,\n.security-tab__cell-fixed-ver,\n.security-tab__cell-policy {\n padding: 10px;\n}\n\n.security-tab__cell-cve {\n padding-left: 0px;\n text-align: left;\n width: 20%;\n}\n\n.security-tab__cell-policy {\n padding-right: 0px;\n}\n\n.security-tab__cell-policy--whitelist,\n.security-tab__cell-policy--whitelisted {\n color: var(--G500);\n text-transform: capitalize;\n}\n\n.security-tab__cell-policy--block {\n color: var(--R500);\n text-transform: capitalize;\n}\n\n.scanned-object__results {\n margin: 0 20px;\n}";
22848
+ var css_248z$1 = ".modal-body--scan-details {\n position: fixed;\n top: 0;\n right: 0;\n background: var(--N000);\n width: 800px;\n}\n\n.security-tab__table {\n width: 100%;\n}\n\n.security-tab__table-header {\n border-bottom: solid 1px var(--N200);\n}\n\n.security-cell-header {\n font-size: 12px;\n font-weight: 600;\n line-height: 1.5;\n letter-spacing: normal;\n text-transform: uppercase;\n color: var(--N500);\n}\n\n.dc__security-tab__table-row {\n font-size: 13px;\n font-weight: normal;\n line-height: 1.54;\n letter-spacing: normal;\n color: var(--N900);\n box-shadow: inset 0 -1px 0 0 #f5f5f5;\n}\n\n.security-tab__cell-cve,\n.security-tab__cell-severity,\n.security-tab__cell-package,\n.security-tab__cell-current-ver,\n.security-tab__cell-fixed-ver,\n.security-tab__cell-policy {\n padding: 10px;\n max-width: 120px;\n word-wrap: break-word;\n}\n\n.security-tab__cell-cve {\n padding-left: 0px;\n text-align: left;\n width: 20%;\n}\n\n.security-tab__cell-policy {\n padding-right: 0px;\n}\n\n.security-tab__cell-policy--whitelist,\n.security-tab__cell-policy--whitelisted {\n color: var(--G500);\n text-transform: capitalize;\n}\n\n.security-tab__cell-policy--block {\n color: var(--R500);\n text-transform: capitalize;\n}\n\n.scanned-object__results {\n margin: 0 20px;\n}";
22849
22849
  styleInject(css_248z$1);
22850
22850
 
22851
22851
  function ScanVulnerabilitiesTable(_a) {
@@ -23616,6 +23616,20 @@ var useSuperAdmin = function () {
23616
23616
  return { isSuperAdmin: isSuperAdmin };
23617
23617
  };
23618
23618
 
23619
+ var useClickOutside = function (ref, callback) {
23620
+ React.useEffect(function () {
23621
+ var handleClickOutside = function (e) {
23622
+ if ((ref === null || ref === void 0 ? void 0 : ref.current) && !ref.current.contains(e.target)) {
23623
+ callback();
23624
+ }
23625
+ };
23626
+ document.addEventListener('click', handleClickOutside);
23627
+ return function () {
23628
+ document.removeEventListener('click', handleClickOutside);
23629
+ };
23630
+ }, [ref, callback]);
23631
+ };
23632
+
23619
23633
  var StatusConstants = {
23620
23634
  NOT_DEPLOYED: {
23621
23635
  noSpaceLower: 'notdeployed',
@@ -23811,6 +23825,7 @@ exports.toastAccessDenied = toastAccessDenied;
23811
23825
  exports.trash = trash;
23812
23826
  exports.useAsync = useAsync;
23813
23827
  exports.useBreadcrumb = useBreadcrumb;
23828
+ exports.useClickOutside = useClickOutside;
23814
23829
  exports.useEffectAfterMount = useEffectAfterMount;
23815
23830
  exports.useForm = useForm;
23816
23831
  exports.useSearchString = useSearchString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,15 @@
1
+ import React, { useEffect } from 'react'
2
+
3
+ export const useClickOutside = (ref: any, callback: () => void) => {
4
+ useEffect(() => {
5
+ const handleClickOutside = (e: any) => {
6
+ if (ref?.current && !ref.current.contains(e.target)) {
7
+ callback()
8
+ }
9
+ }
10
+ document.addEventListener('click', handleClickOutside)
11
+ return () => {
12
+ document.removeEventListener('click', handleClickOutside)
13
+ }
14
+ }, [ref, callback])
15
+ }
@@ -1 +1,2 @@
1
1
  export { useSuperAdmin } from './UseSuperAdmin/UseSuperAdmin'
2
+ export { useClickOutside } from './UseClickOutside/UseClickOutside'
@@ -39,6 +39,8 @@
39
39
  .security-tab__cell-fixed-ver,
40
40
  .security-tab__cell-policy {
41
41
  padding: 10px;
42
+ max-width: 120px;
43
+ word-wrap: break-word;
42
44
  }
43
45
 
44
46
  .security-tab__cell-cve {