@devtron-labs/devtron-fe-common-lib 0.0.25 → 0.0.26-beta-3

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,15 @@
1
+ /// <reference types="react" />
2
+ import { DebouncedSearchProps } from './Types';
3
+ /**
4
+ * @param onSearch - Callback function to be called on search
5
+ * @param Icon - (Optional) Icon to be shown before the input
6
+ * @param iconClass - (Optional) Class for the icon
7
+ * @param children - (Optional) In case we want to add another button or any other element
8
+ * @param placeholder - (Optional) Placeholder for the input
9
+ * @param containerClass - (Optional) Class for the container
10
+ * @param inputClass - (Optional) Class for the input field
11
+ * @param debounceTimeout - (Optional) Timeout for the debounce with default value of 500ms
12
+ * @param clearSearch - (Optional) To clear the search text
13
+ * @param showClearIcon - (Optional) To show the clear icon default value is true
14
+ */
15
+ export default function DebouncedSearch({ onSearch, Icon, children, placeholder, containerClass, iconClass, inputClass, debounceTimeout, clearSearch, showClearIcon, }: DebouncedSearchProps): JSX.Element;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export interface DebouncedSearchProps {
3
+ onSearch: (query: string) => void;
4
+ Icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
5
+ placeholder?: string;
6
+ inputClass?: string;
7
+ containerClass?: string;
8
+ iconClass?: string;
9
+ children?: React.ReactNode;
10
+ debounceTimeout?: number;
11
+ clearSearch?: boolean;
12
+ showClearIcon?: boolean;
13
+ }
@@ -0,0 +1 @@
1
+ export declare function useDebouncedEffect(callback: any, delay: any, deps?: unknown[]): void;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { GridProps } from './types';
3
+ export default function Grid({ container, spacing, item, xs, containerClass, itemClass, children, }: GridProps): JSX.Element;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export interface GridProps {
3
+ container?: boolean;
4
+ spacing?: number;
5
+ item?: boolean;
6
+ xs?: number;
7
+ containerClass?: string;
8
+ itemClass?: string;
9
+ children?: React.ReactNode;
10
+ }
@@ -42,4 +42,5 @@ export declare function CustomInput({ name, value, error, onChange, onBlur, onFo
42
42
  }): JSX.Element;
43
43
  export declare function handleUTCTime(ts: string, isRelativeTime?: boolean): string;
44
44
  export declare function useSearchString(): UseSearchString;
45
+ export declare const closeOnEscKeyPressed: (e: any, actionClose: () => void) => void;
45
46
  export {};
@@ -35,3 +35,5 @@ export { default as DeleteComponent } from './DeleteComponentModal/DeleteCompone
35
35
  export * from './ImageTags';
36
36
  export * from './ImageTags.Types';
37
37
  export * from './ResizableTextarea';
38
+ export { default as DebouncedSearch } from './DebouncedSearch/DebouncedSearch';
39
+ export { default as Grid } from './Grid/Grid';
package/dist/index.js CHANGED
@@ -685,15 +685,15 @@ function styleInject(css, ref) {
685
685
  var css_248z$6 = ".empty-state {\n height: 100%;\n}\n.empty-state img {\n height: 40%;\n max-height: 200px;\n width: auto;\n max-width: 250px;\n}\n.empty-state svg {\n height: 40%;\n max-height: 200px;\n width: auto;\n}\n.empty-state h1,\n.empty-state h2,\n.empty-state h3,\n.empty-state h4,\n.empty-state h5,\n.empty-state h6 {\n color: var(--N900);\n}\n.empty-state .subtitle {\n font-size: 13px;\n width: 300px;\n font-weight: 400;\n text-align: center;\n line-height: 1.5;\n margin-bottom: 20px;\n}\n.empty-state .cta {\n height: 36px;\n}\n.empty-state p {\n width: 300px;\n text-align: center;\n font-size: 13px;\n color: var(--N700);\n}\n.empty-state strong {\n font-size: 16px;\n margin-bottom: 4px;\n color: var(--N900);\n font-weight: normal;\n}\n.empty-state .select-popup {\n height: min-content;\n max-height: 250px;\n overflow: auto;\n padding: 8px 0;\n}\n.empty-state .empty-state__loader {\n width: 34px;\n height: 34px;\n margin-bottom: 16px;\n}\n.empty-state .empty-state__loading-text {\n font-size: 12px;\n width: 200px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.5;\n letter-spacing: normal;\n text-align: center;\n color: var(--N900);\n}\n.empty-state .button__icon {\n width: 16px;\n height: 16px;\n margin-left: 8px;\n}";
686
686
  styleInject(css_248z$6);
687
687
 
688
- var _g$5;
689
- function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
688
+ var _g$6;
689
+ function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
690
690
  var SvgIcProgressing = function SvgIcProgressing(props) {
691
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
691
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
692
692
  xmlns: "http://www.w3.org/2000/svg",
693
693
  viewBox: "0 0 24 24",
694
694
  width: "1em",
695
695
  height: "1em"
696
- }, props), _g$5 || (_g$5 = /*#__PURE__*/React__namespace.createElement("g", {
696
+ }, props), _g$6 || (_g$6 = /*#__PURE__*/React__namespace.createElement("g", {
697
697
  fill: "none"
698
698
  }, /*#__PURE__*/React__namespace.createElement("animateTransform", {
699
699
  attributeName: "transform",
@@ -740,8 +740,8 @@ EmptyState.Loading = Loading;
740
740
 
741
741
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
742
742
 
743
- function _extends$h() {
744
- _extends$h = Object.assign || function (target) {
743
+ function _extends$i() {
744
+ _extends$i = Object.assign || function (target) {
745
745
  for (var i = 1; i < arguments.length; i++) {
746
746
  var source = arguments[i];
747
747
 
@@ -755,7 +755,7 @@ function _extends$h() {
755
755
  return target;
756
756
  };
757
757
 
758
- return _extends$h.apply(this, arguments);
758
+ return _extends$i.apply(this, arguments);
759
759
  }
760
760
 
761
761
  function _objectWithoutPropertiesLoose$2(source, excluded) {
@@ -1481,7 +1481,7 @@ function ProgressBar(_ref) {
1481
1481
  isIn = _ref.isIn,
1482
1482
  theme = _ref.theme;
1483
1483
 
1484
- var style = _extends$h({}, userStyle, {
1484
+ var style = _extends$i({}, userStyle, {
1485
1485
  animationDuration: delay + "ms",
1486
1486
  animationPlayState: isRunning ? 'running' : 'paused',
1487
1487
  opacity: hide ? 0 : 1
@@ -1758,9 +1758,9 @@ var ToastContainer = function ToastContainer(props) {
1758
1758
  ,
1759
1759
  id: containerId
1760
1760
  }, getToastToRender(function (position, toastList) {
1761
- var containerStyle = !toastList.length ? _extends$h({}, style, {
1761
+ var containerStyle = !toastList.length ? _extends$i({}, style, {
1762
1762
  pointerEvents: 'none'
1763
- }) : _extends$h({}, style);
1763
+ }) : _extends$i({}, style);
1764
1764
  return React.createElement("div", {
1765
1765
  className: getClassName(position),
1766
1766
  style: containerStyle,
@@ -1867,7 +1867,7 @@ function dispatchToast(content, options) {
1867
1867
 
1868
1868
 
1869
1869
  function mergeOptions(type, options) {
1870
- return _extends$h({}, options, {
1870
+ return _extends$i({}, options, {
1871
1871
  type: options && options.type || type,
1872
1872
  toastId: getToastId(options)
1873
1873
  });
@@ -1884,7 +1884,7 @@ function toast(content, options) {
1884
1884
  }
1885
1885
 
1886
1886
  toast.loading = function (content, options) {
1887
- return dispatchToast(content, mergeOptions(TYPE.DEFAULT, _extends$h({
1887
+ return dispatchToast(content, mergeOptions(TYPE.DEFAULT, _extends$i({
1888
1888
  isLoading: true,
1889
1889
  autoClose: false,
1890
1890
  closeOnClick: false,
@@ -1900,7 +1900,7 @@ function handlePromise(promise, _ref2, options) {
1900
1900
  var id;
1901
1901
 
1902
1902
  if (pending) {
1903
- id = isStr(pending) ? toast.loading(pending, options) : toast.loading(pending.render, _extends$h({}, options, pending));
1903
+ id = isStr(pending) ? toast.loading(pending, options) : toast.loading(pending.render, _extends$i({}, options, pending));
1904
1904
  }
1905
1905
 
1906
1906
  var resetParams = {
@@ -1919,7 +1919,7 @@ function handlePromise(promise, _ref2, options) {
1919
1919
  return;
1920
1920
  }
1921
1921
 
1922
- var baseParams = _extends$h({
1922
+ var baseParams = _extends$i({
1923
1923
  type: type
1924
1924
  }, resetParams, options, {
1925
1925
  data: result
@@ -1930,10 +1930,10 @@ function handlePromise(promise, _ref2, options) {
1930
1930
  } : input; // if the id is set we know that it's an update
1931
1931
 
1932
1932
  if (id) {
1933
- toast.update(id, _extends$h({}, baseParams, params));
1933
+ toast.update(id, _extends$i({}, baseParams, params));
1934
1934
  } else {
1935
1935
  // using toast.promise without loading
1936
- toast(params.render, _extends$h({}, baseParams, params));
1936
+ toast(params.render, _extends$i({}, baseParams, params));
1937
1937
  }
1938
1938
 
1939
1939
  return result;
@@ -1957,7 +1957,7 @@ toast.warning = /*#__PURE__*/createToastByType(TYPE.WARNING);
1957
1957
  toast.warn = toast.warning;
1958
1958
 
1959
1959
  toast.dark = function (content, options) {
1960
- return dispatchToast(content, mergeOptions(TYPE.DEFAULT, _extends$h({
1960
+ return dispatchToast(content, mergeOptions(TYPE.DEFAULT, _extends$i({
1961
1961
  theme: 'dark'
1962
1962
  }, options)));
1963
1963
  };
@@ -2014,7 +2014,7 @@ toast.update = function (toastId, options) {
2014
2014
  var oldOptions = toast.props,
2015
2015
  oldContent = toast.content;
2016
2016
 
2017
- var nextOptions = _extends$h({}, oldOptions, options, {
2017
+ var nextOptions = _extends$i({}, oldOptions, options, {
2018
2018
  toastId: options.toastId || toastId,
2019
2019
  updateId: generateToastId()
2020
2020
  });
@@ -4109,15 +4109,15 @@ function captureException(exception, captureContext) {
4109
4109
  return getCurrentHub().captureException(exception, { captureContext });
4110
4110
  }
4111
4111
 
4112
- var _g$4;
4113
- function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
4112
+ var _g$5;
4113
+ function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
4114
4114
  var SvgIcWarning = function SvgIcWarning(props) {
4115
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
4115
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
4116
4116
  xmlns: "http://www.w3.org/2000/svg",
4117
4117
  width: "1em",
4118
4118
  height: "1em",
4119
4119
  viewBox: "0 0 32 32"
4120
- }, props), _g$4 || (_g$4 = /*#__PURE__*/React__namespace.createElement("g", {
4120
+ }, props), _g$5 || (_g$5 = /*#__PURE__*/React__namespace.createElement("g", {
4121
4121
  fill: "none",
4122
4122
  fillRule: "evenodd"
4123
4123
  }, /*#__PURE__*/React__namespace.createElement("path", {
@@ -10099,7 +10099,12 @@ function useSearchString() {
10099
10099
  return agg;
10100
10100
  }, {});
10101
10101
  return { queryParams: queryParams, searchParams: searchParams };
10102
- }
10102
+ }
10103
+ var closeOnEscKeyPressed = function (e, actionClose) {
10104
+ if (e.keyCode === 27 || e.key === 'Escape') {
10105
+ actionClose();
10106
+ }
10107
+ };
10103
10108
 
10104
10109
  function Progressing(_a) {
10105
10110
  var pageLoader = _a.pageLoader, size = _a.size, theme = _a.theme, styles = _a.styles, fillColor = _a.fillColor;
@@ -10227,9 +10232,9 @@ var Modal = function (_a) {
10227
10232
  };
10228
10233
 
10229
10234
  var _path$a;
10230
- function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
10235
+ function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
10231
10236
  var SvgIcCross = function SvgIcCross(props) {
10232
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
10237
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
10233
10238
  width: "1em",
10234
10239
  height: "1em",
10235
10240
  viewBox: "0 0 24 24",
@@ -14535,9 +14540,9 @@ var index = /*#__PURE__*/forwardRef( /*#__PURE__*/TippyGenerator(tippy));
14535
14540
  var Tippy = index;
14536
14541
 
14537
14542
  var _path$9;
14538
- function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
14543
+ function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
14539
14544
  var SvgIcHelp = function SvgIcHelp(props) {
14540
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
14545
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
14541
14546
  xmlns: "http://www.w3.org/2000/svg",
14542
14547
  width: "1em",
14543
14548
  height: "1em",
@@ -14550,9 +14555,9 @@ var SvgIcHelp = function SvgIcHelp(props) {
14550
14555
  };
14551
14556
 
14552
14557
  var _path$8;
14553
- function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
14558
+ function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
14554
14559
  var SvgIcHelpOutline = function SvgIcHelpOutline(props) {
14555
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
14560
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
14556
14561
  xmlns: "http://www.w3.org/2000/svg",
14557
14562
  viewBox: "0 0 17 16",
14558
14563
  width: "1em",
@@ -14610,9 +14615,9 @@ function TippyCustomized(props) {
14610
14615
  }
14611
14616
 
14612
14617
  var _path$7, _circle, _path2$1;
14613
- function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
14618
+ function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
14614
14619
  var SvgInjectTag = function SvgInjectTag(props) {
14615
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
14620
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
14616
14621
  width: "1em",
14617
14622
  height: "1em",
14618
14623
  viewBox: "0 0 20 20",
@@ -14647,9 +14652,9 @@ function PropagateTagInfo(_a) {
14647
14652
  }
14648
14653
 
14649
14654
  var _path$6;
14650
- function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
14655
+ function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
14651
14656
  var SvgIcInfoOutlined = function SvgIcInfoOutlined(props) {
14652
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
14657
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
14653
14658
  xmlns: "http://www.w3.org/2000/svg",
14654
14659
  width: "1em",
14655
14660
  height: "1em",
@@ -14883,9 +14888,9 @@ var TagDetails = function (_a) {
14883
14888
  };
14884
14889
 
14885
14890
  var _path$5;
14886
- function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
14891
+ function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
14887
14892
  var SvgIcAdd = function SvgIcAdd(props) {
14888
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
14893
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
14889
14894
  xmlns: "http://www.w3.org/2000/svg",
14890
14895
  width: "1em",
14891
14896
  height: "1em",
@@ -15008,8 +15013,8 @@ function ForceDeleteDialog(_a) {
15008
15013
  return (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(DeleteDialog, __assign({ title: forceDeleteDialogTitle, delete: onClickDelete, closeDelete: closeDeleteModal, deletePrefix: "Force " }, { children: jsxRuntime.jsxs(DeleteDialog.Description, { children: [jsxRuntime.jsxs("p", __assign({ className: "mt-12 mb-12 p-8 dc__break-word dc__window-bg" }, { children: ["Error: ", forceDeleteDialogMessage] })), jsxRuntime.jsx("p", { children: "Do you want to force delete?" })] }) })) }));
15009
15014
  }
15010
15015
 
15011
- function _extends$9() {
15012
- _extends$9 = Object.assign ? Object.assign.bind() : function (target) {
15016
+ function _extends$a() {
15017
+ _extends$a = Object.assign ? Object.assign.bind() : function (target) {
15013
15018
  for (var i = 1; i < arguments.length; i++) {
15014
15019
  var source = arguments[i];
15015
15020
  for (var key in source) {
@@ -15020,7 +15025,7 @@ function _extends$9() {
15020
15025
  }
15021
15026
  return target;
15022
15027
  };
15023
- return _extends$9.apply(this, arguments);
15028
+ return _extends$a.apply(this, arguments);
15024
15029
  }
15025
15030
 
15026
15031
  /*
@@ -18561,7 +18566,7 @@ var Menu = function Menu(props) {
18561
18566
  getStyles = props.getStyles,
18562
18567
  innerRef = props.innerRef,
18563
18568
  innerProps = props.innerProps;
18564
- return jsx("div", _extends$9({
18569
+ return jsx("div", _extends$a({
18565
18570
  css: getStyles('menu', props),
18566
18571
  className: cx({
18567
18572
  menu: true
@@ -18593,7 +18598,7 @@ var MenuList = function MenuList(props) {
18593
18598
  innerProps = props.innerProps,
18594
18599
  innerRef = props.innerRef,
18595
18600
  isMulti = props.isMulti;
18596
- return jsx("div", _extends$9({
18601
+ return jsx("div", _extends$a({
18597
18602
  css: getStyles('menuList', props),
18598
18603
  className: cx({
18599
18604
  'menu-list': true,
@@ -18624,7 +18629,7 @@ var NoOptionsMessage = function NoOptionsMessage(props) {
18624
18629
  cx = props.cx,
18625
18630
  getStyles = props.getStyles,
18626
18631
  innerProps = props.innerProps;
18627
- return jsx("div", _extends$9({
18632
+ return jsx("div", _extends$a({
18628
18633
  css: getStyles('noOptionsMessage', props),
18629
18634
  className: cx({
18630
18635
  'menu-notice': true,
@@ -18641,7 +18646,7 @@ var LoadingMessage = function LoadingMessage(props) {
18641
18646
  cx = props.cx,
18642
18647
  getStyles = props.getStyles,
18643
18648
  innerProps = props.innerProps;
18644
- return jsx("div", _extends$9({
18649
+ return jsx("div", _extends$a({
18645
18650
  css: getStyles('loadingMessage', props),
18646
18651
  className: cx({
18647
18652
  'menu-notice': true,
@@ -18729,7 +18734,7 @@ var MenuPortal = /*#__PURE__*/function (_Component2) {
18729
18734
  rect: rect
18730
18735
  }; // same wrapper element whether fixed or portalled
18731
18736
 
18732
- var menuWrapper = jsx("div", _extends$9({
18737
+ var menuWrapper = jsx("div", _extends$a({
18733
18738
  css: getStyles('menuPortal', state),
18734
18739
  className: cx({
18735
18740
  'menu-portal': true
@@ -18765,7 +18770,7 @@ var SelectContainer = function SelectContainer(props) {
18765
18770
  innerProps = props.innerProps,
18766
18771
  isDisabled = props.isDisabled,
18767
18772
  isRtl = props.isRtl;
18768
- return jsx("div", _extends$9({
18773
+ return jsx("div", _extends$a({
18769
18774
  css: getStyles('container', props),
18770
18775
  className: cx({
18771
18776
  '--is-disabled': isDisabled,
@@ -18800,7 +18805,7 @@ var ValueContainer = function ValueContainer(props) {
18800
18805
  isMulti = props.isMulti,
18801
18806
  getStyles = props.getStyles,
18802
18807
  hasValue = props.hasValue;
18803
- return jsx("div", _extends$9({
18808
+ return jsx("div", _extends$a({
18804
18809
  css: getStyles('valueContainer', props),
18805
18810
  className: cx({
18806
18811
  'value-container': true,
@@ -18826,7 +18831,7 @@ var IndicatorsContainer = function IndicatorsContainer(props) {
18826
18831
  cx = props.cx,
18827
18832
  innerProps = props.innerProps,
18828
18833
  getStyles = props.getStyles;
18829
- return jsx("div", _extends$9({
18834
+ return jsx("div", _extends$a({
18830
18835
  css: getStyles('indicatorsContainer', props),
18831
18836
  className: cx({
18832
18837
  indicators: true
@@ -18857,7 +18862,7 @@ var Svg = function Svg(_ref) {
18857
18862
  var size = _ref.size,
18858
18863
  props = _objectWithoutProperties(_ref, _excluded$2);
18859
18864
 
18860
- return jsx("svg", _extends$9({
18865
+ return jsx("svg", _extends$a({
18861
18866
  height: size,
18862
18867
  width: size,
18863
18868
  viewBox: "0 0 20 20",
@@ -18868,14 +18873,14 @@ var Svg = function Svg(_ref) {
18868
18873
  };
18869
18874
 
18870
18875
  var CrossIcon = function CrossIcon(props) {
18871
- return jsx(Svg, _extends$9({
18876
+ return jsx(Svg, _extends$a({
18872
18877
  size: 20
18873
18878
  }, props), jsx("path", {
18874
18879
  d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"
18875
18880
  }));
18876
18881
  };
18877
18882
  var DownChevron = function DownChevron(props) {
18878
- return jsx(Svg, _extends$9({
18883
+ return jsx(Svg, _extends$a({
18879
18884
  size: 20
18880
18885
  }, props), jsx("path", {
18881
18886
  d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
@@ -18908,7 +18913,7 @@ var DropdownIndicator = function DropdownIndicator(props) {
18908
18913
  cx = props.cx,
18909
18914
  getStyles = props.getStyles,
18910
18915
  innerProps = props.innerProps;
18911
- return jsx("div", _extends$9({
18916
+ return jsx("div", _extends$a({
18912
18917
  css: getStyles('dropdownIndicator', props),
18913
18918
  className: cx({
18914
18919
  indicator: true,
@@ -18923,7 +18928,7 @@ var ClearIndicator$1 = function ClearIndicator(props) {
18923
18928
  cx = props.cx,
18924
18929
  getStyles = props.getStyles,
18925
18930
  innerProps = props.innerProps;
18926
- return jsx("div", _extends$9({
18931
+ return jsx("div", _extends$a({
18927
18932
  css: getStyles('clearIndicator', props),
18928
18933
  className: cx({
18929
18934
  indicator: true,
@@ -18953,7 +18958,7 @@ var IndicatorSeparator = function IndicatorSeparator(props) {
18953
18958
  cx = props.cx,
18954
18959
  getStyles = props.getStyles,
18955
18960
  innerProps = props.innerProps;
18956
- return jsx("span", _extends$9({}, innerProps, {
18961
+ return jsx("span", _extends$a({}, innerProps, {
18957
18962
  css: getStyles('indicatorSeparator', props),
18958
18963
  className: cx({
18959
18964
  'indicator-separator': true
@@ -19008,7 +19013,7 @@ var LoadingIndicator = function LoadingIndicator(props) {
19008
19013
  getStyles = props.getStyles,
19009
19014
  innerProps = props.innerProps,
19010
19015
  isRtl = props.isRtl;
19011
- return jsx("div", _extends$9({
19016
+ return jsx("div", _extends$a({
19012
19017
  css: getStyles('loadingIndicator', props),
19013
19018
  className: cx({
19014
19019
  indicator: true,
@@ -19069,7 +19074,7 @@ var Control = function Control(props) {
19069
19074
  innerRef = props.innerRef,
19070
19075
  innerProps = props.innerProps,
19071
19076
  menuIsOpen = props.menuIsOpen;
19072
- return jsx("div", _extends$9({
19077
+ return jsx("div", _extends$a({
19073
19078
  ref: innerRef,
19074
19079
  css: getStyles('control', props),
19075
19080
  className: cx({
@@ -19101,12 +19106,12 @@ var Group = function Group(props) {
19101
19106
  label = props.label,
19102
19107
  theme = props.theme,
19103
19108
  selectProps = props.selectProps;
19104
- return jsx("div", _extends$9({
19109
+ return jsx("div", _extends$a({
19105
19110
  css: getStyles('group', props),
19106
19111
  className: cx({
19107
19112
  group: true
19108
19113
  }, className)
19109
- }, innerProps), jsx(Heading, _extends$9({}, headingProps, {
19114
+ }, innerProps), jsx(Heading, _extends$a({}, headingProps, {
19110
19115
  selectProps: selectProps,
19111
19116
  theme: theme,
19112
19117
  getStyles: getStyles,
@@ -19138,7 +19143,7 @@ var GroupHeading = function GroupHeading(props) {
19138
19143
  _cleanCommonProps.data;
19139
19144
  var innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded$1$1);
19140
19145
 
19141
- return jsx("div", _extends$9({
19146
+ return jsx("div", _extends$a({
19142
19147
  css: getStyles('groupHeading', props),
19143
19148
  className: cx({
19144
19149
  'group-heading': true
@@ -19214,7 +19219,7 @@ var Input = function Input(props) {
19214
19219
  }, className),
19215
19220
  css: getStyles('input', props),
19216
19221
  "data-value": value || ''
19217
- }, jsx("input", _extends$9({
19222
+ }, jsx("input", _extends$a({
19218
19223
  className: cx({
19219
19224
  input: true
19220
19225
  }, inputClassName),
@@ -19284,7 +19289,7 @@ var MultiValueLabel = MultiValueGeneric;
19284
19289
  function MultiValueRemove$1(_ref5) {
19285
19290
  var children = _ref5.children,
19286
19291
  innerProps = _ref5.innerProps;
19287
- return jsx("div", _extends$9({
19292
+ return jsx("div", _extends$a({
19288
19293
  role: "button"
19289
19294
  }, innerProps), children || jsx(CrossIcon, {
19290
19295
  size: 14
@@ -19373,7 +19378,7 @@ var Option$1 = function Option(props) {
19373
19378
  isSelected = props.isSelected,
19374
19379
  innerRef = props.innerRef,
19375
19380
  innerProps = props.innerProps;
19376
- return jsx("div", _extends$9({
19381
+ return jsx("div", _extends$a({
19377
19382
  css: getStyles('option', props),
19378
19383
  className: cx({
19379
19384
  option: true,
@@ -19405,7 +19410,7 @@ var Placeholder = function Placeholder(props) {
19405
19410
  cx = props.cx,
19406
19411
  getStyles = props.getStyles,
19407
19412
  innerProps = props.innerProps;
19408
- return jsx("div", _extends$9({
19413
+ return jsx("div", _extends$a({
19409
19414
  css: getStyles('placeholder', props),
19410
19415
  className: cx({
19411
19416
  placeholder: true
@@ -19438,7 +19443,7 @@ var SingleValue = function SingleValue(props) {
19438
19443
  getStyles = props.getStyles,
19439
19444
  isDisabled = props.isDisabled,
19440
19445
  innerProps = props.innerProps;
19441
- return jsx("div", _extends$9({
19446
+ return jsx("div", _extends$a({
19442
19447
  css: getStyles('singleValue', props),
19443
19448
  className: cx({
19444
19449
  'single-value': true,
@@ -19686,7 +19691,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
19686
19691
  };
19687
19692
 
19688
19693
  var A11yText = function A11yText(props) {
19689
- return jsx("span", _extends$9({
19694
+ return jsx("span", _extends$a({
19690
19695
  css: _ref
19691
19696
  }, props));
19692
19697
  };
@@ -20222,7 +20227,7 @@ function DummyInput(_ref) {
20222
20227
  var innerRef = _ref.innerRef,
20223
20228
  props = _objectWithoutProperties(_ref, _excluded);
20224
20229
 
20225
- return jsx("input", _extends$9({
20230
+ return jsx("input", _extends$a({
20226
20231
  ref: innerRef
20227
20232
  }, props, {
20228
20233
  css: /*#__PURE__*/css$2({
@@ -21857,7 +21862,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
21857
21862
 
21858
21863
  if (!isSearchable) {
21859
21864
  // use a dummy input to maintain focus/blur functionality
21860
- return /*#__PURE__*/React__namespace.createElement(DummyInput, _extends$9({
21865
+ return /*#__PURE__*/React__namespace.createElement(DummyInput, _extends$a({
21861
21866
  id: id,
21862
21867
  innerRef: this.getInputRef,
21863
21868
  onBlur: this.onInputBlur,
@@ -21871,7 +21876,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
21871
21876
  }, ariaAttributes));
21872
21877
  }
21873
21878
 
21874
- return /*#__PURE__*/React__namespace.createElement(Input, _extends$9({}, commonProps, {
21879
+ return /*#__PURE__*/React__namespace.createElement(Input, _extends$a({}, commonProps, {
21875
21880
  autoCapitalize: "none",
21876
21881
  autoComplete: "off",
21877
21882
  autoCorrect: "off",
@@ -21915,7 +21920,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
21915
21920
  isFocused = _this$state5.isFocused;
21916
21921
 
21917
21922
  if (!this.hasValue() || !controlShouldRenderValue) {
21918
- return inputValue ? null : /*#__PURE__*/React__namespace.createElement(Placeholder, _extends$9({}, commonProps, {
21923
+ return inputValue ? null : /*#__PURE__*/React__namespace.createElement(Placeholder, _extends$a({}, commonProps, {
21919
21924
  key: "placeholder",
21920
21925
  isDisabled: isDisabled,
21921
21926
  isFocused: isFocused,
@@ -21929,7 +21934,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
21929
21934
  return selectValue.map(function (opt, index) {
21930
21935
  var isOptionFocused = opt === focusedValue;
21931
21936
  var key = "".concat(_this3.getOptionLabel(opt), "-").concat(_this3.getOptionValue(opt));
21932
- return /*#__PURE__*/React__namespace.createElement(MultiValue, _extends$9({}, commonProps, {
21937
+ return /*#__PURE__*/React__namespace.createElement(MultiValue, _extends$a({}, commonProps, {
21933
21938
  components: {
21934
21939
  Container: MultiValueContainer,
21935
21940
  Label: MultiValueLabel,
@@ -21961,7 +21966,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
21961
21966
  }
21962
21967
 
21963
21968
  var singleValue = selectValue[0];
21964
- return /*#__PURE__*/React__namespace.createElement(SingleValue, _extends$9({}, commonProps, {
21969
+ return /*#__PURE__*/React__namespace.createElement(SingleValue, _extends$a({}, commonProps, {
21965
21970
  data: singleValue,
21966
21971
  isDisabled: isDisabled
21967
21972
  }), this.formatOptionLabel(singleValue, 'value'));
@@ -21987,7 +21992,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
21987
21992
  onTouchEnd: this.onClearIndicatorTouchEnd,
21988
21993
  'aria-hidden': 'true'
21989
21994
  };
21990
- return /*#__PURE__*/React__namespace.createElement(ClearIndicator, _extends$9({}, commonProps, {
21995
+ return /*#__PURE__*/React__namespace.createElement(ClearIndicator, _extends$a({}, commonProps, {
21991
21996
  innerProps: innerProps,
21992
21997
  isFocused: isFocused
21993
21998
  }));
@@ -22007,7 +22012,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22007
22012
  var innerProps = {
22008
22013
  'aria-hidden': 'true'
22009
22014
  };
22010
- return /*#__PURE__*/React__namespace.createElement(LoadingIndicator, _extends$9({}, commonProps, {
22015
+ return /*#__PURE__*/React__namespace.createElement(LoadingIndicator, _extends$a({}, commonProps, {
22011
22016
  innerProps: innerProps,
22012
22017
  isDisabled: isDisabled,
22013
22018
  isFocused: isFocused
@@ -22025,7 +22030,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22025
22030
  var commonProps = this.commonProps;
22026
22031
  var isDisabled = this.props.isDisabled;
22027
22032
  var isFocused = this.state.isFocused;
22028
- return /*#__PURE__*/React__namespace.createElement(IndicatorSeparator, _extends$9({}, commonProps, {
22033
+ return /*#__PURE__*/React__namespace.createElement(IndicatorSeparator, _extends$a({}, commonProps, {
22029
22034
  isDisabled: isDisabled,
22030
22035
  isFocused: isFocused
22031
22036
  }));
@@ -22045,7 +22050,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22045
22050
  onTouchEnd: this.onDropdownIndicatorTouchEnd,
22046
22051
  'aria-hidden': 'true'
22047
22052
  };
22048
- return /*#__PURE__*/React__namespace.createElement(DropdownIndicator, _extends$9({}, commonProps, {
22053
+ return /*#__PURE__*/React__namespace.createElement(DropdownIndicator, _extends$a({}, commonProps, {
22049
22054
  innerProps: innerProps,
22050
22055
  isDisabled: isDisabled,
22051
22056
  isFocused: isFocused
@@ -22108,7 +22113,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22108
22113
  onMouseOver: onHover,
22109
22114
  tabIndex: -1
22110
22115
  };
22111
- return /*#__PURE__*/React__namespace.createElement(Option, _extends$9({}, commonProps, {
22116
+ return /*#__PURE__*/React__namespace.createElement(Option, _extends$a({}, commonProps, {
22112
22117
  innerProps: innerProps,
22113
22118
  data: data,
22114
22119
  isDisabled: isDisabled,
@@ -22132,7 +22137,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22132
22137
  groupIndex = item.index;
22133
22138
  var groupId = "".concat(_this4.getElementId('group'), "-").concat(groupIndex);
22134
22139
  var headingId = "".concat(groupId, "-heading");
22135
- return /*#__PURE__*/React__namespace.createElement(Group, _extends$9({}, commonProps, {
22140
+ return /*#__PURE__*/React__namespace.createElement(Group, _extends$a({}, commonProps, {
22136
22141
  key: groupId,
22137
22142
  data: _data,
22138
22143
  options: options,
@@ -22171,12 +22176,12 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22171
22176
  menuPosition: menuPosition,
22172
22177
  menuShouldScrollIntoView: menuShouldScrollIntoView
22173
22178
  };
22174
- var menuElement = /*#__PURE__*/React__namespace.createElement(MenuPlacer, _extends$9({}, commonProps, menuPlacementProps), function (_ref4) {
22179
+ var menuElement = /*#__PURE__*/React__namespace.createElement(MenuPlacer, _extends$a({}, commonProps, menuPlacementProps), function (_ref4) {
22175
22180
  var ref = _ref4.ref,
22176
22181
  _ref4$placerProps = _ref4.placerProps,
22177
22182
  placement = _ref4$placerProps.placement,
22178
22183
  maxHeight = _ref4$placerProps.maxHeight;
22179
- return /*#__PURE__*/React__namespace.createElement(Menu, _extends$9({}, commonProps, menuPlacementProps, {
22184
+ return /*#__PURE__*/React__namespace.createElement(Menu, _extends$a({}, commonProps, menuPlacementProps, {
22180
22185
  innerRef: ref,
22181
22186
  innerProps: {
22182
22187
  onMouseDown: _this4.onMenuMouseDown,
@@ -22191,7 +22196,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22191
22196
  onBottomArrive: onMenuScrollToBottom,
22192
22197
  lockEnabled: menuShouldBlockScroll
22193
22198
  }, function (scrollTargetRef) {
22194
- return /*#__PURE__*/React__namespace.createElement(MenuList, _extends$9({}, commonProps, {
22199
+ return /*#__PURE__*/React__namespace.createElement(MenuList, _extends$a({}, commonProps, {
22195
22200
  innerRef: function innerRef(instance) {
22196
22201
  _this4.getMenuListRef(instance);
22197
22202
 
@@ -22206,7 +22211,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22206
22211
  // so we use the same component. the actual portalling logic is forked
22207
22212
  // within the component based on `menuPosition`
22208
22213
 
22209
- return menuPortalTarget || menuPosition === 'fixed' ? /*#__PURE__*/React__namespace.createElement(MenuPortal, _extends$9({}, commonProps, {
22214
+ return menuPortalTarget || menuPosition === 'fixed' ? /*#__PURE__*/React__namespace.createElement(MenuPortal, _extends$a({}, commonProps, {
22210
22215
  appendTo: menuPortalTarget,
22211
22216
  controlElement: this.controlRef,
22212
22217
  menuPlacement: menuPlacement,
@@ -22271,7 +22276,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22271
22276
  isFocused = _this$state6.isFocused,
22272
22277
  selectValue = _this$state6.selectValue;
22273
22278
  var focusableOptions = this.getFocusableOptions();
22274
- return /*#__PURE__*/React__namespace.createElement(LiveRegion, _extends$9({}, commonProps, {
22279
+ return /*#__PURE__*/React__namespace.createElement(LiveRegion, _extends$a({}, commonProps, {
22275
22280
  id: this.getElementId('live-region'),
22276
22281
  ariaSelection: ariaSelection,
22277
22282
  focusedOption: focusedOption,
@@ -22297,7 +22302,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22297
22302
  menuIsOpen = _this$props14.menuIsOpen;
22298
22303
  var isFocused = this.state.isFocused;
22299
22304
  var commonProps = this.commonProps = this.getCommonProps();
22300
- return /*#__PURE__*/React__namespace.createElement(SelectContainer, _extends$9({}, commonProps, {
22305
+ return /*#__PURE__*/React__namespace.createElement(SelectContainer, _extends$a({}, commonProps, {
22301
22306
  className: className,
22302
22307
  innerProps: {
22303
22308
  id: id,
@@ -22305,7 +22310,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22305
22310
  },
22306
22311
  isDisabled: isDisabled,
22307
22312
  isFocused: isFocused
22308
- }), this.renderLiveRegion(), /*#__PURE__*/React__namespace.createElement(Control, _extends$9({}, commonProps, {
22313
+ }), this.renderLiveRegion(), /*#__PURE__*/React__namespace.createElement(Control, _extends$a({}, commonProps, {
22309
22314
  innerRef: this.getControlRef,
22310
22315
  innerProps: {
22311
22316
  onMouseDown: this.onControlMouseDown,
@@ -22314,9 +22319,9 @@ var Select$1 = /*#__PURE__*/function (_Component) {
22314
22319
  isDisabled: isDisabled,
22315
22320
  isFocused: isFocused,
22316
22321
  menuIsOpen: menuIsOpen
22317
- }), /*#__PURE__*/React__namespace.createElement(ValueContainer, _extends$9({}, commonProps, {
22322
+ }), /*#__PURE__*/React__namespace.createElement(ValueContainer, _extends$a({}, commonProps, {
22318
22323
  isDisabled: isDisabled
22319
- }), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React__namespace.createElement(IndicatorsContainer, _extends$9({}, commonProps, {
22324
+ }), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React__namespace.createElement(IndicatorsContainer, _extends$a({}, commonProps, {
22320
22325
  isDisabled: isDisabled
22321
22326
  }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
22322
22327
  }
@@ -22389,22 +22394,22 @@ Select$1.defaultProps = defaultProps;
22389
22394
 
22390
22395
  var StateManagedSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
22391
22396
  var baseSelectProps = useStateManager(props);
22392
- return /*#__PURE__*/React__namespace.createElement(Select$1, _extends$9({
22397
+ return /*#__PURE__*/React__namespace.createElement(Select$1, _extends$a({
22393
22398
  ref: ref
22394
22399
  }, baseSelectProps));
22395
22400
  });
22396
22401
 
22397
22402
  var Select = StateManagedSelect;
22398
22403
 
22399
- var _g$3;
22400
- function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
22404
+ var _g$4;
22405
+ function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
22401
22406
  var SvgIcAppstatusCancelled = function SvgIcAppstatusCancelled(props) {
22402
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
22407
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
22403
22408
  xmlns: "http://www.w3.org/2000/svg",
22404
22409
  viewBox: "0 0 28 28",
22405
22410
  width: "1em",
22406
22411
  height: "1em"
22407
- }, props), _g$3 || (_g$3 = /*#__PURE__*/React__namespace.createElement("g", {
22412
+ }, props), _g$4 || (_g$4 = /*#__PURE__*/React__namespace.createElement("g", {
22408
22413
  fill: "none",
22409
22414
  fillRule: "evenodd",
22410
22415
  transform: "translate(2 2)"
@@ -22421,9 +22426,9 @@ var SvgIcAppstatusCancelled = function SvgIcAppstatusCancelled(props) {
22421
22426
  };
22422
22427
 
22423
22428
  var _path$4;
22424
- function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
22429
+ function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
22425
22430
  var SvgIcCheck = function SvgIcCheck(props) {
22426
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
22431
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
22427
22432
  xmlns: "http://www.w3.org/2000/svg",
22428
22433
  width: "1em",
22429
22434
  height: "1em",
@@ -22439,15 +22444,15 @@ var SvgIcCheck = function SvgIcCheck(props) {
22439
22444
  })));
22440
22445
  };
22441
22446
 
22442
- var _g$2;
22443
- function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
22447
+ var _g$3;
22448
+ function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
22444
22449
  var SvgIcErrorMedium = function SvgIcErrorMedium(props) {
22445
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
22450
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
22446
22451
  xmlns: "http://www.w3.org/2000/svg",
22447
22452
  width: "1em",
22448
22453
  height: "1em",
22449
22454
  viewBox: "0 0 20 21"
22450
- }, props), _g$2 || (_g$2 = /*#__PURE__*/React__namespace.createElement("g", {
22455
+ }, props), _g$3 || (_g$3 = /*#__PURE__*/React__namespace.createElement("g", {
22451
22456
  fill: "none",
22452
22457
  fillRule: "evenodd"
22453
22458
  }, /*#__PURE__*/React__namespace.createElement("path", {
@@ -22816,15 +22821,15 @@ exports.ConsequenceAction = void 0;
22816
22821
  ConsequenceAction["ALLOW_FOREVER"] = "ALLOW_FOREVER";
22817
22822
  })(exports.ConsequenceAction || (exports.ConsequenceAction = {}));
22818
22823
 
22819
- var _g$1;
22820
- function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
22824
+ var _g$2;
22825
+ function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
22821
22826
  var SvgIcInfoFilled = function SvgIcInfoFilled(props) {
22822
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
22827
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
22823
22828
  xmlns: "http://www.w3.org/2000/svg",
22824
22829
  width: "1em",
22825
22830
  height: "1em",
22826
22831
  viewBox: "0 0 32 32"
22827
- }, props), _g$1 || (_g$1 = /*#__PURE__*/React__namespace.createElement("g", {
22832
+ }, props), _g$2 || (_g$2 = /*#__PURE__*/React__namespace.createElement("g", {
22828
22833
  fill: "none",
22829
22834
  fillRule: "evenodd"
22830
22835
  }, /*#__PURE__*/React__namespace.createElement("path", {
@@ -22899,9 +22904,9 @@ function DeleteComponent(_a) {
22899
22904
  }
22900
22905
 
22901
22906
  var _path$3;
22902
- function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
22907
+ function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
22903
22908
  var SvgIcPencil = function SvgIcPencil(props) {
22904
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
22909
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
22905
22910
  width: "1em",
22906
22911
  height: "1em",
22907
22912
  viewBox: "0 0 20 20",
@@ -22917,9 +22922,9 @@ var SvgIcPencil = function SvgIcPencil(props) {
22917
22922
  };
22918
22923
 
22919
22924
  var _path$2, _path2, _path3;
22920
- function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
22925
+ function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
22921
22926
  var SvgIcArrowCounterClockwise = function SvgIcArrowCounterClockwise(props) {
22922
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
22927
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
22923
22928
  width: "1em",
22924
22929
  height: "1em",
22925
22930
  viewBox: "0 0 12 12",
@@ -22944,9 +22949,9 @@ var SvgIcArrowCounterClockwise = function SvgIcArrowCounterClockwise(props) {
22944
22949
  };
22945
22950
 
22946
22951
  var _path$1;
22947
- function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
22952
+ function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
22948
22953
  var SvgIcMinus = function SvgIcMinus(props) {
22949
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
22954
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
22950
22955
  xmlns: "http://www.w3.org/2000/svg",
22951
22956
  width: "1em",
22952
22957
  height: "1em",
@@ -22959,15 +22964,15 @@ var SvgIcMinus = function SvgIcMinus(props) {
22959
22964
  })));
22960
22965
  };
22961
22966
 
22962
- var _g;
22963
- function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
22967
+ var _g$1;
22968
+ function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
22964
22969
  var SvgIcErrorExclamation = function SvgIcErrorExclamation(props) {
22965
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
22970
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
22966
22971
  xmlns: "http://www.w3.org/2000/svg",
22967
22972
  width: "1em",
22968
22973
  height: "1em",
22969
22974
  viewBox: "0 0 20 20"
22970
- }, props), _g || (_g = /*#__PURE__*/React__namespace.createElement("g", {
22975
+ }, props), _g$1 || (_g$1 = /*#__PURE__*/React__namespace.createElement("g", {
22971
22976
  fill: "none",
22972
22977
  fillRule: "evenodd"
22973
22978
  }, /*#__PURE__*/React__namespace.createElement("path", {
@@ -22980,9 +22985,9 @@ var SvgIcErrorExclamation = function SvgIcErrorExclamation(props) {
22980
22985
  };
22981
22986
 
22982
22987
  var _path;
22983
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22988
+ function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
22984
22989
  var SvgIcEnter = function SvgIcEnter(props) {
22985
- return /*#__PURE__*/React__namespace.createElement("svg", _extends({
22990
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
22986
22991
  width: "1em",
22987
22992
  height: "1em",
22988
22993
  viewBox: "0 0 16 16",
@@ -23348,6 +23353,95 @@ var ResizableTextarea = function (_a) {
23348
23353
  return (jsxRuntime.jsx("textarea", __assign({ "data-testid": dataTestId, ref: function (el) { return (_textRef.current = el); }, value: text, placeholder: placeholder, className: "dc__resizable-textarea ".concat(className), onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, style: { lineHeight: "".concat(lineHeight, "px"), padding: "".concat(padding, "px") }, spellCheck: false, disabled: disabled }, props)));
23349
23354
  };
23350
23355
 
23356
+ function useDebouncedEffect(callback, delay, deps) {
23357
+ if (deps === void 0) { deps = []; }
23358
+ // function will be executed only after the specified time once the user stops firing the event.
23359
+ var firstUpdate = React.useRef(true);
23360
+ React.useEffect(function () {
23361
+ if (firstUpdate.current) {
23362
+ firstUpdate.current = false;
23363
+ return;
23364
+ }
23365
+ var handler = setTimeout(function () {
23366
+ callback();
23367
+ }, delay);
23368
+ return function () {
23369
+ clearTimeout(handler);
23370
+ };
23371
+ }, __spreadArray([delay], __read(deps), false));
23372
+ }
23373
+
23374
+ var _g;
23375
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23376
+ var SvgIcErrorCross = function SvgIcErrorCross(props) {
23377
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends({
23378
+ xmlns: "http://www.w3.org/2000/svg",
23379
+ width: "1em",
23380
+ height: "1em",
23381
+ viewBox: "0 0 32 32"
23382
+ }, props), _g || (_g = /*#__PURE__*/React__namespace.createElement("g", {
23383
+ transform: "translate(2.667 2.667)",
23384
+ fill: "none",
23385
+ fillRule: "evenodd"
23386
+ }, /*#__PURE__*/React__namespace.createElement("rect", {
23387
+ width: 26.667,
23388
+ height: 26.667,
23389
+ className: "ic-error-cross_svg__fill-color",
23390
+ fill: "#596168",
23391
+ rx: 13.333
23392
+ }), /*#__PURE__*/React__namespace.createElement("path", {
23393
+ fill: "#FFF",
23394
+ fillRule: "nonzero",
23395
+ d: "M8.62 8.62a1.332 1.332 0 0 1 1.885 0l2.828 2.827 2.829-2.828a1.334 1.334 0 0 1 1.777-.097l.108.097a1.333 1.333 0 0 1 0 1.886l-2.828 2.828 2.828 2.829c.486.486.519 1.254.098 1.777l-.098.108a1.332 1.332 0 0 1-1.885 0l-2.83-2.828-2.827 2.828a1.334 1.334 0 0 1-1.777.098l-.109-.098a1.333 1.333 0 0 1 0-1.885l2.828-2.83-2.828-2.827a1.334 1.334 0 0 1-.097-1.777z"
23396
+ }))));
23397
+ };
23398
+
23399
+ /**
23400
+ * @param onSearch - Callback function to be called on search
23401
+ * @param Icon - (Optional) Icon to be shown before the input
23402
+ * @param iconClass - (Optional) Class for the icon
23403
+ * @param children - (Optional) In case we want to add another button or any other element
23404
+ * @param placeholder - (Optional) Placeholder for the input
23405
+ * @param containerClass - (Optional) Class for the container
23406
+ * @param inputClass - (Optional) Class for the input field
23407
+ * @param debounceTimeout - (Optional) Timeout for the debounce with default value of 500ms
23408
+ * @param clearSearch - (Optional) To clear the search text
23409
+ * @param showClearIcon - (Optional) To show the clear icon default value is true
23410
+ */
23411
+ function DebouncedSearch(_a) {
23412
+ var onSearch = _a.onSearch, Icon = _a.Icon, children = _a.children, placeholder = _a.placeholder, _b = _a.containerClass, containerClass = _b === void 0 ? '' : _b, _c = _a.iconClass, iconClass = _c === void 0 ? '' : _c, _d = _a.inputClass, inputClass = _d === void 0 ? '' : _d, _e = _a.debounceTimeout, debounceTimeout = _e === void 0 ? 500 : _e, clearSearch = _a.clearSearch, _f = _a.showClearIcon, showClearIcon = _f === void 0 ? true : _f;
23413
+ var _g = __read(React.useState(''), 2), searchText = _g[0], setSearchText = _g[1];
23414
+ React.useEffect(function () {
23415
+ setSearchText('');
23416
+ }, [clearSearch]);
23417
+ var handleSearchTextChange = function (e) {
23418
+ setSearchText(e.target.value);
23419
+ };
23420
+ var handleClearSearch = function () {
23421
+ setSearchText('');
23422
+ };
23423
+ useDebouncedEffect(function () { return onSearch(searchText); }, debounceTimeout, [searchText, onSearch]);
23424
+ return (jsxRuntime.jsxs("div", __assign({ className: containerClass }, { children: [Icon && jsxRuntime.jsx(Icon, { className: iconClass }), jsxRuntime.jsx("input", { type: "text", className: inputClass, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : 'Search', value: searchText, onChange: handleSearchTextChange, autoFocus: true, "data-testid": "debounced-search" }), showClearIcon && !!searchText && (jsxRuntime.jsx("button", __assign({ type: "button", className: "dc__outline-none-imp dc__no-border p-0 bc-n50 flex", onClick: handleClearSearch, "data-testid": "clear-search" }, { children: jsxRuntime.jsx(SvgIcErrorCross, { className: "icon-dim-20 icon-n6" }) }))), children] })));
23425
+ }
23426
+
23427
+ // This is meant to be a reusable component that will provide a grid like dynamic layout where xs is the number of columns out of 12 that the item will take up
23428
+ function Grid(_a) {
23429
+ var container = _a.container, _b = _a.spacing, spacing = _b === void 0 ? 0 : _b, item = _a.item, xs = _a.xs, _c = _a.containerClass, containerClass = _c === void 0 ? '' : _c, _d = _a.itemClass, itemClass = _d === void 0 ? '' : _d, children = _a.children;
23430
+ var containerStyles = container ? { gap: spacing + 'px' } : {};
23431
+ if (item) {
23432
+ var getColumnWidth = function () {
23433
+ var percentageWidth = (xs / 12) * 100;
23434
+ // DONT CHANGE IT FROM CALC SINCE CALC CONVERTS TO PX which is needed to handle text overflow
23435
+ return "calc(".concat(percentageWidth, "%)");
23436
+ };
23437
+ var itemStyles = {
23438
+ flex: "1 1 ".concat(getColumnWidth()),
23439
+ };
23440
+ return (jsxRuntime.jsx("div", __assign({ className: "p-0 ".concat(itemClass), style: itemStyles }, { children: children })));
23441
+ }
23442
+ return (jsxRuntime.jsx("div", __assign({ className: "flex-wrap flexbox ".concat(container ? containerClass : ''), style: containerStyles }, { children: children })));
23443
+ }
23444
+
23351
23445
  exports.BreadCrumb = BreadCrumb;
23352
23446
  exports.BreadcrumbStore = Store;
23353
23447
  exports.BuildStageVariable = BuildStageVariable;
@@ -23361,6 +23455,7 @@ exports.CustomSelect = CustomSelect;
23361
23455
  exports.DEFAULT_TAG_DATA = DEFAULT_TAG_DATA;
23362
23456
  exports.DOCUMENTATION = DOCUMENTATION;
23363
23457
  exports.DOCUMENTATION_HOME_PAGE = DOCUMENTATION_HOME_PAGE;
23458
+ exports.DebouncedSearch = DebouncedSearch;
23364
23459
  exports.DeleteComponent = DeleteComponent;
23365
23460
  exports.DeleteDialog = DeleteDialog;
23366
23461
  exports.DetailsProgressing = DetailsProgressing;
@@ -23373,6 +23468,7 @@ exports.ErrorScreenManager = ErrorScreenManager;
23373
23468
  exports.ErrorScreenNotAuthorized = ErrorScreenNotAuthorized;
23374
23469
  exports.ForceDeleteDialog = ForceDeleteDialog;
23375
23470
  exports.GenericEmptyState = GenericEmptyState;
23471
+ exports.Grid = Grid;
23376
23472
  exports.Host = Host;
23377
23473
  exports.ImageTagButton = ImageTagButton;
23378
23474
  exports.ImageTagsContainer = ImageTagsContainer;
@@ -23416,6 +23512,7 @@ exports.TriggerTypeMap = TriggerTypeMap;
23416
23512
  exports.URLS = URLS;
23417
23513
  exports.VisibleModal = VisibleModal;
23418
23514
  exports.VisibleModal2 = VisibleModal2;
23515
+ exports.closeOnEscKeyPressed = closeOnEscKeyPressed;
23419
23516
  exports.createGitCommitUrl = createGitCommitUrl;
23420
23517
  exports.extractImage = extractImage;
23421
23518
  exports.get = get;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.25",
3
+ "version": "0.0.26-beta-3",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
2
+ <g fill="none" fill-rule="evenodd">
3
+ <g transform="translate(2.667 2.667)">
4
+ <rect width="26.667" height="26.667" class="fill-color" fill="#596168" rx="13.333"/>
5
+ <path fill="#FFF" fill-rule="nonzero" d="M8.62 8.62c.52-.521 1.364-.521 1.885 0l2.828 2.827 2.829-2.828a1.334 1.334 0 0 1 1.777-.097l.108.097c.521.521.521 1.365 0 1.886l-2.828 2.828 2.828 2.829c.486.486.519 1.254.098 1.777l-.098.108c-.52.521-1.365.521-1.885 0l-2.83-2.828-2.827 2.828a1.334 1.334 0 0 1-1.777.098l-.109-.098a1.333 1.333 0 0 1 0-1.885l2.828-2.83-2.828-2.827a1.334 1.334 0 0 1-.097-1.777z"/>
6
+ </g>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,75 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useDebouncedEffect } from './Utils'
3
+ import { ReactComponent as ICClear } from '../../Assets/Icon/ic-error-cross.svg'
4
+ import { DebouncedSearchProps } from './Types'
5
+
6
+ /**
7
+ * @param onSearch - Callback function to be called on search
8
+ * @param Icon - (Optional) Icon to be shown before the input
9
+ * @param iconClass - (Optional) Class for the icon
10
+ * @param children - (Optional) In case we want to add another button or any other element
11
+ * @param placeholder - (Optional) Placeholder for the input
12
+ * @param containerClass - (Optional) Class for the container
13
+ * @param inputClass - (Optional) Class for the input field
14
+ * @param debounceTimeout - (Optional) Timeout for the debounce with default value of 500ms
15
+ * @param clearSearch - (Optional) To clear the search text
16
+ * @param showClearIcon - (Optional) To show the clear icon default value is true
17
+ */
18
+ export default function DebouncedSearch({
19
+ onSearch,
20
+ Icon,
21
+ children,
22
+ placeholder,
23
+ containerClass = '',
24
+ iconClass = '',
25
+ inputClass = '',
26
+ debounceTimeout = 500,
27
+ clearSearch,
28
+ showClearIcon = true,
29
+ }: DebouncedSearchProps) {
30
+ const [searchText, setSearchText] = useState<string>('')
31
+
32
+ useEffect(() => {
33
+ setSearchText('')
34
+ }, [clearSearch])
35
+
36
+ const handleSearchTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
37
+ setSearchText(e.target.value)
38
+ }
39
+
40
+ const handleClearSearch = () => {
41
+ setSearchText('')
42
+ }
43
+
44
+ useDebouncedEffect(() => onSearch(searchText), debounceTimeout, [searchText, onSearch])
45
+
46
+ return (
47
+ <div className={containerClass}>
48
+ {Icon && <Icon className={iconClass} />}
49
+
50
+ <input
51
+ type="text"
52
+ className={inputClass}
53
+ placeholder={placeholder ?? 'Search'}
54
+ value={searchText}
55
+ onChange={handleSearchTextChange}
56
+ autoFocus
57
+ data-testid="debounced-search"
58
+ />
59
+
60
+ {showClearIcon && !!searchText && (
61
+ <button
62
+ type="button"
63
+ className="dc__outline-none-imp dc__no-border p-0 bc-n50 flex"
64
+ onClick={handleClearSearch}
65
+ data-testid="clear-search"
66
+ >
67
+ <ICClear className="icon-dim-20 icon-n6" />
68
+ </button>
69
+ )}
70
+
71
+ {/* In case we want to add another button or something */}
72
+ {children}
73
+ </div>
74
+ )
75
+ }
@@ -0,0 +1,12 @@
1
+ export interface DebouncedSearchProps {
2
+ onSearch: (query: string) => void
3
+ Icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
4
+ placeholder?: string
5
+ inputClass?: string
6
+ containerClass?: string
7
+ iconClass?: string
8
+ children?: React.ReactNode
9
+ debounceTimeout?: number
10
+ clearSearch?: boolean
11
+ showClearIcon?: boolean
12
+ }
@@ -0,0 +1,19 @@
1
+ import { useEffect, useRef } from 'react'
2
+
3
+ export function useDebouncedEffect(callback, delay, deps: unknown[] = []) {
4
+ // function will be executed only after the specified time once the user stops firing the event.
5
+ const firstUpdate = useRef(true)
6
+ useEffect(() => {
7
+ if (firstUpdate.current) {
8
+ firstUpdate.current = false
9
+ return
10
+ }
11
+ const handler = setTimeout(() => {
12
+ callback()
13
+ }, delay)
14
+
15
+ return () => {
16
+ clearTimeout(handler)
17
+ }
18
+ }, [delay, ...deps])
19
+ }
@@ -0,0 +1,61 @@
1
+ import React from 'react'
2
+ import { render, screen, fireEvent } from '@testing-library/react'
3
+ import { ReactComponent as ICClear } from '../../../../assets/icons/ic-error.svg'
4
+ import DebouncedSearch from '../DebouncedSearch'
5
+
6
+ jest.mock('../../helpers/Helpers', () => ({
7
+ useDebouncedEffect: jest.fn().mockImplementation((fn) => fn()),
8
+ }))
9
+
10
+ describe('When DebouncedSearch mounts', () => {
11
+ it('should have a input field', () => {
12
+ render(<DebouncedSearch onSearch={jest.fn()} />)
13
+ expect(screen.getByRole('textbox')).toBeTruthy()
14
+ })
15
+
16
+ it('should have a clear icon when clearSearch is true and user has typed something', () => {
17
+ const { getByTestId } = render(<DebouncedSearch onSearch={jest.fn()} clearSearch debounceTimeout={0} />)
18
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'test' } })
19
+ expect(getByTestId('clear-search')).toBeTruthy()
20
+ })
21
+
22
+ it('should call onSearch when input value changes', () => {
23
+ const onSearch = jest.fn()
24
+ render(<DebouncedSearch onSearch={onSearch} debounceTimeout={0} />)
25
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'test' } })
26
+ expect(onSearch).toHaveBeenCalled()
27
+ })
28
+
29
+ it('should clear input value when clear icon is clicked', () => {
30
+ const { container } = render(<DebouncedSearch onSearch={jest.fn()} clearSearch debounceTimeout={0} />)
31
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'test' } })
32
+ const inputBar = container.querySelector('input')
33
+ expect(inputBar.value).toBe('test')
34
+ fireEvent.click(screen.getByRole('button'))
35
+ expect(inputBar.value).toBe('')
36
+ })
37
+
38
+ it('should have a placeholder', () => {
39
+ render(<DebouncedSearch onSearch={jest.fn()} placeholder="test" />)
40
+ expect(screen.getByPlaceholderText('test')).toBeTruthy()
41
+ })
42
+
43
+ it('should not show clear icon when showClearIcon is false', () => {
44
+ render(<DebouncedSearch onSearch={jest.fn()} showClearIcon={false} />)
45
+ expect(screen.queryByRole('button')).toBeNull()
46
+ })
47
+
48
+ it('should have a custom Icon', () => {
49
+ const { container } = render(<DebouncedSearch onSearch={jest.fn()} Icon={ICClear} iconClass="icon-class" />)
50
+ expect(container.querySelector('.icon-class')).toBeTruthy()
51
+ })
52
+
53
+ it('should support children', () => {
54
+ render(
55
+ <DebouncedSearch onSearch={jest.fn()}>
56
+ <div>test</div>
57
+ </DebouncedSearch>,
58
+ )
59
+ expect(screen.getByText('test')).toBeTruthy()
60
+ })
61
+ })
@@ -0,0 +1,39 @@
1
+ import React from 'react'
2
+ import { GridProps } from './types'
3
+
4
+ // This is meant to be a reusable component that will provide a grid like dynamic layout where xs is the number of columns out of 12 that the item will take up
5
+ export default function Grid({
6
+ container,
7
+ spacing = 0,
8
+ item,
9
+ xs,
10
+ containerClass = '',
11
+ itemClass = '',
12
+ children,
13
+ }: GridProps) {
14
+ const containerStyles = container ? { gap: spacing + 'px' } : {}
15
+
16
+ if (item) {
17
+ const getColumnWidth = () => {
18
+ const percentageWidth = (xs / 12) * 100
19
+ // DONT CHANGE IT FROM CALC SINCE CALC CONVERTS TO PX which is needed to handle text overflow
20
+ return `calc(${percentageWidth}%)`
21
+ }
22
+
23
+ const itemStyles = {
24
+ flex: `1 1 ${getColumnWidth()}`,
25
+ }
26
+
27
+ return (
28
+ <div className={`p-0 ${itemClass}`} style={itemStyles}>
29
+ {children}
30
+ </div>
31
+ )
32
+ }
33
+
34
+ return (
35
+ <div className={`flex-wrap flexbox ${container ? containerClass : ''}`} style={containerStyles}>
36
+ {children}
37
+ </div>
38
+ )
39
+ }
@@ -0,0 +1,9 @@
1
+ export interface GridProps {
2
+ container?: boolean
3
+ spacing?: number
4
+ item?: boolean
5
+ xs?: number
6
+ containerClass?: string
7
+ itemClass?: string
8
+ children?: React.ReactNode
9
+ }
@@ -369,3 +369,8 @@ export function useSearchString(): UseSearchString {
369
369
  }
370
370
 
371
371
 
372
+ export const closeOnEscKeyPressed = (e: any, actionClose: () => void) => {
373
+ if (e.keyCode === 27 || e.key === 'Escape') {
374
+ actionClose()
375
+ }
376
+ }
@@ -34,4 +34,6 @@ export * from './Policy.Types'
34
34
  export { default as DeleteComponent } from './DeleteComponentModal/DeleteComponent'
35
35
  export * from './ImageTags'
36
36
  export * from './ImageTags.Types'
37
- export * from './ResizableTextarea'
37
+ export * from './ResizableTextarea'
38
+ export { default as DebouncedSearch } from './DebouncedSearch/DebouncedSearch'
39
+ export { default as Grid } from './Grid/Grid'