@devtron-labs/devtron-fe-common-lib 0.0.59-beta-10 → 0.0.59-beta-12

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.
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { BulkSelectionProps } from './types';
3
- declare const BulkSelection: <T>({ checkboxValue, isChecked, selectedIdentifiers, handleBulkSelection, showPagination, }: BulkSelectionProps<T>) => JSX.Element;
3
+ declare const BulkSelection: <T>({ showPagination }: BulkSelectionProps) => JSX.Element;
4
4
  export default BulkSelection;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { UseBulkSelectionProps, UseBulkSelectionReturnType } from './types';
3
+ export declare const useBulkSelection: <T>() => UseBulkSelectionReturnType<T>;
4
+ export declare const BulkSelectionProvider: <T>({ children, identifiers, getSelectAllDialogStatus, }: UseBulkSelectionProps<T>) => JSX.Element;
@@ -6,3 +6,4 @@ export declare const BulkSelectionOptionsLabels: {
6
6
  };
7
7
  export declare const SELECT_ALL_ACROSS_PAGES_LOCATOR: "*";
8
8
  export declare const getInvalidActionMessage: (action: string) => string;
9
+ export declare const BULK_SELECTION_CONTEXT_ERROR = "useBulkSelection must be used within BulkSelectionContext";
@@ -1,4 +1,4 @@
1
1
  export { default as BulkSelection } from './BulkSelection';
2
- export { default as useBulkSelection } from './UseBulkSelection';
2
+ export * from './BulkSelectionProvider';
3
3
  export * from './types';
4
4
  export * from './constants';
@@ -16,13 +16,15 @@ export interface HandleBulkSelectionType<T> {
16
16
  identifierObject?: T;
17
17
  };
18
18
  }
19
- export interface UseBulkSelectionReturnType<T> {
19
+ export interface GetBulkSelectionCheckboxValuesType {
20
+ isChecked: boolean;
21
+ checkboxValue: CHECKBOX_VALUE;
22
+ }
23
+ export interface UseBulkSelectionReturnType<T> extends GetBulkSelectionCheckboxValuesType {
20
24
  selectedIdentifiers: T;
21
25
  handleBulkSelection: ({ action, data }: HandleBulkSelectionType<T>) => void;
22
26
  }
23
- export interface BulkSelectionProps<T> extends UseBulkSelectionReturnType<T> {
24
- checkboxValue: CHECKBOX_VALUE;
25
- isChecked: boolean;
27
+ export interface BulkSelectionProps {
26
28
  showPagination: boolean;
27
29
  }
28
30
  export interface BulkSelectionDropdownItemsType {
@@ -31,7 +33,7 @@ export interface BulkSelectionDropdownItemsType {
31
33
  isSelected: boolean;
32
34
  icon: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
33
35
  }
34
- export interface BulkSelectionDropdownItemsProps<T> extends BulkSelectionDropdownItemsType, Pick<BulkSelectionProps<T>, 'handleBulkSelection'> {
36
+ export interface BulkSelectionDropdownItemsProps<T> extends BulkSelectionDropdownItemsType, Pick<UseBulkSelectionReturnType<T>, 'handleBulkSelection'> {
35
37
  }
36
38
  export declare enum SelectAllDialogStatus {
37
39
  OPEN = "OPEN",
@@ -48,4 +50,5 @@ export interface UseBulkSelectionProps<T> {
48
50
  * Act as buffer between select all across pages and select all on page state
49
51
  */
50
52
  getSelectAllDialogStatus: () => SelectAllDialogStatus;
53
+ children?: React.ReactNode;
51
54
  }
package/dist/index.js CHANGED
@@ -12028,7 +12028,7 @@ var Modal = function (_a) {
12028
12028
  }, id: "popup", className: "".concat(rootClassName, " popup ").concat(modal ? 'modal' : ''), style: __assign({}, style) }, { children: children })), document.getElementById('visible-modal'));
12029
12029
  };
12030
12030
 
12031
- var _path$j;
12031
+ var _path$i;
12032
12032
  function _extends$s() { _extends$s = 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$s.apply(this, arguments); }
12033
12033
  var SvgIcCross = function SvgIcCross(props) {
12034
12034
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
@@ -12037,7 +12037,7 @@ var SvgIcCross = function SvgIcCross(props) {
12037
12037
  viewBox: "0 0 24 24",
12038
12038
  fill: "none",
12039
12039
  xmlns: "http://www.w3.org/2000/svg"
12040
- }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
12040
+ }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
12041
12041
  d: "M19.28 5.78a.75.75 0 0 0-1.06-1.06l1.06 1.06ZM4.72 18.22a.75.75 0 1 0 1.06 1.06l-1.06-1.06Zm13.5 1.06a.75.75 0 1 0 1.06-1.06l-1.06 1.06ZM5.78 4.72a.75.75 0 0 0-1.06 1.06l1.06-1.06Zm12.44 0-6.75 6.75 1.06 1.06 6.75-6.75-1.06-1.06Zm-6.75 6.75-6.75 6.75 1.06 1.06 6.75-6.75-1.06-1.06Zm7.81 6.75-6.75-6.75-1.06 1.06 6.75 6.75 1.06-1.06Zm-6.75-6.75L5.78 4.72 4.72 5.78l6.75 6.75 1.06-1.06Z",
12042
12042
  fill: "#596168"
12043
12043
  })));
@@ -16336,7 +16336,7 @@ var index = /*#__PURE__*/forwardRef( /*#__PURE__*/TippyGenerator(tippy));
16336
16336
 
16337
16337
  var Tippy = index;
16338
16338
 
16339
- var _path$i;
16339
+ var _path$h;
16340
16340
  function _extends$r() { _extends$r = 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$r.apply(this, arguments); }
16341
16341
  var SvgIcHelp = function SvgIcHelp(props) {
16342
16342
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
@@ -16344,14 +16344,14 @@ var SvgIcHelp = function SvgIcHelp(props) {
16344
16344
  width: "1em",
16345
16345
  height: "1em",
16346
16346
  viewBox: "0 0 24 24"
16347
- }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
16347
+ }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
16348
16348
  fill: "#767D84",
16349
16349
  fillRule: "evenodd",
16350
16350
  d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm-.205 12.868c-.615 0-1.12.505-1.12 1.12 0 .617.505 1.121 1.12 1.121.615 0 1.12-.504 1.12-1.12 0-.616-.506-1.12-1.12-1.12zM11.863 7c-1.667 0-3.197 1.187-3.196 2.527 0 .546.41.833.888.833 1.325 0 .642-1.803 2.39-1.803.82 0 1.311.438 1.311 1.175 0 1.34-2.39 1.708-2.39 3.334 0 .438.287.915.874.915.902 0 .792-.67 1.12-1.148.438-.642 2.473-1.325 2.473-3.101 0-1.927-1.721-2.732-3.47-2.732z"
16351
16351
  })));
16352
16352
  };
16353
16353
 
16354
- var _path$h;
16354
+ var _path$g;
16355
16355
  function _extends$q() { _extends$q = 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$q.apply(this, arguments); }
16356
16356
  var SvgIcHelpOutline = function SvgIcHelpOutline(props) {
16357
16357
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
@@ -16359,7 +16359,7 @@ var SvgIcHelpOutline = function SvgIcHelpOutline(props) {
16359
16359
  viewBox: "0 0 17 16",
16360
16360
  width: "1em",
16361
16361
  height: "1em"
16362
- }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
16362
+ }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
16363
16363
  fill: "#767D84",
16364
16364
  fillRule: "evenodd",
16365
16365
  d: "M9 1.333a6.667 6.667 0 1 1 0 13.334A6.667 6.667 0 0 1 9 1.333zm0 1.334C6.054 2.667 3.667 5.054 3.667 8S6.054 13.333 9 13.333 14.333 10.946 14.333 8 11.946 2.667 9 2.667zm-.137 7.245c.41 0 .747.337.747.747s-.337.747-.747.747-.747-.336-.747-.747a.75.75 0 0 1 .747-.747zm.046-5.245c1.166 0 2.313.537 2.313 1.82 0 1.185-1.357 1.64-1.648 2.068-.22.319-.146.766-.747.766-.392 0-.583-.319-.583-.61 0-1.085 1.593-1.33 1.593-2.223 0-.492-.327-.783-.873-.783-1.166 0-.711 1.202-1.594 1.202-.319 0-.592-.191-.592-.556 0-.893 1.02-1.684 2.13-1.684z"
@@ -16411,7 +16411,7 @@ function TippyCustomized(props) {
16411
16411
  return (jsxRuntime.jsx(Tippy, __assign({ className: "".concat(isWhiteTheme ? 'tippy-white-container default-white' : 'tippy-black-container default-black', " no-content-padding tippy-shadow ").concat(className), arrow: arrow || false, interactive: interactive || false, placement: placement || 'top', content: getTippyContent(), trigger: trigger || 'mouseenter', onMount: onTippyMount, onClickOutside: closeTippy, showOnCreate: showOnCreate || false, animation: animation || 'fade', duration: duration || 300, visible: props.visible }, { children: children })));
16412
16412
  }
16413
16413
 
16414
- var _path$g, _circle, _path2$2;
16414
+ var _path$f, _circle, _path2$2;
16415
16415
  function _extends$p() { _extends$p = 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$p.apply(this, arguments); }
16416
16416
  var SvgInjectTag = function SvgInjectTag(props) {
16417
16417
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
@@ -16420,7 +16420,7 @@ var SvgInjectTag = function SvgInjectTag(props) {
16420
16420
  viewBox: "0 0 20 20",
16421
16421
  fill: "none",
16422
16422
  xmlns: "http://www.w3.org/2000/svg"
16423
- }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
16423
+ }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
16424
16424
  d: "M10 10H3.333",
16425
16425
  stroke: "#596168",
16426
16426
  strokeWidth: 1.5,
@@ -16448,7 +16448,7 @@ function PropagateTagInfo(_a) {
16448
16448
  return (jsxRuntime.jsx(TippyCustomized, __assign({ theme: exports.TippyTheme.white, className: "w-300", placement: "top", Icon: SvgInjectTag, heading: 'Propagate tags to K8s resources', infoText: "", additionalContent: additionalInfo(), showCloseButton: true, trigger: "click", interactive: true, documentationLink: isCreateApp ? DOCUMENTATION.APP_TAGS : DOCUMENTATION.APP_OVERVIEW_TAGS, documentationLinkText: "View Documentation" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flexbox cursor" }, { children: [jsxRuntime.jsx(SvgInjectTag, { className: "icon-dim-16 mt-2 mr-4" }), jsxRuntime.jsx("span", { children: "Propagate tags" }), jsxRuntime.jsx(SvgIcHelpOutline, { className: "icon-dim-16 mt-2 ml-4" })] })) })));
16449
16449
  }
16450
16450
 
16451
- var _path$f;
16451
+ var _path$e;
16452
16452
  function _extends$o() { _extends$o = 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$o.apply(this, arguments); }
16453
16453
  var SvgIcInfoOutlined = function SvgIcInfoOutlined(props) {
16454
16454
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
@@ -16456,7 +16456,7 @@ var SvgIcInfoOutlined = function SvgIcInfoOutlined(props) {
16456
16456
  width: "1em",
16457
16457
  height: "1em",
16458
16458
  viewBox: "0 0 20 20"
16459
- }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
16459
+ }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
16460
16460
  d: "M10 1.667c4.6 0 8.333 3.733 8.333 8.333S14.6 18.333 10 18.333 1.667 14.6 1.667 10 5.4 1.667 10 1.667zm0 1.666A6.67 6.67 0 0 0 3.333 10 6.67 6.67 0 0 0 10 16.667 6.67 6.67 0 0 0 16.667 10 6.67 6.67 0 0 0 10 3.333zm0 5.834c.46 0 .833.373.833.833v3.333a.834.834 0 1 1-1.666 0V10c0-.46.373-.833.833-.833zm0-3.334A.833.833 0 1 1 10 7.5a.833.833 0 0 1 0-1.667z",
16461
16461
  fill: "#06C",
16462
16462
  fillRule: "evenodd"
@@ -16690,7 +16690,7 @@ var TagDetails = function (_a) {
16690
16690
  return (jsxRuntime.jsxs("div", __assign({ className: "flexbox mb-8" }, { children: [jsxRuntime.jsx("div", __assign({ className: "dc__border h-30 pl-4 pr-4 br-4 mr-8 pointer ".concat(tagData.propagate ? 'bcn-7' : '', " ").concat(tagData.key.startsWith("devtron.ai/") ? 'cursor-not-allowed bcn-1' : ''), onClick: propagateTagToResource, "data-testid": "propagate-tag-".concat(index) }, { children: jsxRuntime.jsx(SvgInjectTag, { className: "icon-dim-20 mt-4 ".concat(tagData.propagate ? 'scn-0' : '') }) })), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.KEY, placeholder: "Enter key", tabIndex: tabIndex - 1, refVar: keyRef, dependentRef: valueRef, tagOptions: suggestedTagsOptions }), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.VALUE, placeholder: "Enter value", tabIndex: tabIndex, refVar: valueRef, dependentRef: keyRef }), jsxRuntime.jsx("div", __assign({ className: "dc__border pl-4 pr-4 dc__right-radius-4 pointer flex top", onClick: deleteTag, "data-testid": "delete-tag-".concat(index) }, { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-20 mt-4" }) }))] })));
16691
16691
  };
16692
16692
 
16693
- var _path$e;
16693
+ var _path$d;
16694
16694
  function _extends$n() { _extends$n = 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$n.apply(this, arguments); }
16695
16695
  var SvgIcAdd = function SvgIcAdd(props) {
16696
16696
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
@@ -16698,7 +16698,7 @@ var SvgIcAdd = function SvgIcAdd(props) {
16698
16698
  width: "1em",
16699
16699
  height: "1em",
16700
16700
  viewBox: "0 0 24 24"
16701
- }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
16701
+ }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
16702
16702
  className: "ic-add_svg__fill-color",
16703
16703
  fill: "#999",
16704
16704
  d: "M18 13h-5v5a1 1 0 0 1-2 0v-5H6a1 1 0 0 1 0-2h5V6a1 1 0 0 1 2 0v5h5a1 1 0 0 1 0 2z"
@@ -24240,7 +24240,7 @@ var SvgIcAppstatusCancelled = function SvgIcAppstatusCancelled(props) {
24240
24240
  }))));
24241
24241
  };
24242
24242
 
24243
- var _path$d;
24243
+ var _path$c;
24244
24244
  function _extends$k() { _extends$k = 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$k.apply(this, arguments); }
24245
24245
  var SvgIcCheck = function SvgIcCheck(props) {
24246
24246
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
@@ -24248,7 +24248,7 @@ var SvgIcCheck = function SvgIcCheck(props) {
24248
24248
  width: "1em",
24249
24249
  height: "1em",
24250
24250
  viewBox: "0 0 24 24"
24251
- }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
24251
+ }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
24252
24252
  stroke: "#06C",
24253
24253
  strokeLinecap: "round",
24254
24254
  strokeLinejoin: "round",
@@ -24948,7 +24948,7 @@ function DeleteComponent(_a) {
24948
24948
  return (jsxRuntime.jsxs("div", { children: [!showCannotDeleteDialogModal && renderDeleteDialog(), showCannotDeleteDialogModal && renderCannotDeleteDialogModal()] }));
24949
24949
  }
24950
24950
 
24951
- var _path$c;
24951
+ var _path$b;
24952
24952
  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); }
24953
24953
  var SvgIcPencil = function SvgIcPencil(props) {
24954
24954
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
@@ -24957,7 +24957,7 @@ var SvgIcPencil = function SvgIcPencil(props) {
24957
24957
  viewBox: "0 0 20 20",
24958
24958
  fill: "none",
24959
24959
  xmlns: "http://www.w3.org/2000/svg"
24960
- }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
24960
+ }, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
24961
24961
  d: "M10.625 5 15 9.375m-7.5 7.5H3.75a.625.625 0 0 1-.625-.625v-3.491a.625.625 0 0 1 .183-.442l9.375-9.375a.625.625 0 0 1 .884 0l3.491 3.491a.625.625 0 0 1 0 .884L7.5 16.875Z",
24962
24962
  stroke: "#596168",
24963
24963
  strokeWidth: 1.5,
@@ -24966,7 +24966,7 @@ var SvgIcPencil = function SvgIcPencil(props) {
24966
24966
  })));
24967
24967
  };
24968
24968
 
24969
- var _path$b, _path2$1, _path3;
24969
+ var _path$a, _path2$1, _path3;
24970
24970
  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); }
24971
24971
  var SvgIcArrowCounterClockwise = function SvgIcArrowCounterClockwise(props) {
24972
24972
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
@@ -24975,7 +24975,7 @@ var SvgIcArrowCounterClockwise = function SvgIcArrowCounterClockwise(props) {
24975
24975
  viewBox: "0 0 12 12",
24976
24976
  fill: "none",
24977
24977
  xmlns: "http://www.w3.org/2000/svg"
24978
- }, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
24978
+ }, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
24979
24979
  d: "M3.742 4.674h-2.25v-2.25",
24980
24980
  fill: "#767D84"
24981
24981
  })), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -24993,7 +24993,7 @@ var SvgIcArrowCounterClockwise = function SvgIcArrowCounterClockwise(props) {
24993
24993
  })));
24994
24994
  };
24995
24995
 
24996
- var _path$a;
24996
+ var _path$9;
24997
24997
  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); }
24998
24998
  var SvgIcMinus = function SvgIcMinus(props) {
24999
24999
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
@@ -25001,7 +25001,7 @@ var SvgIcMinus = function SvgIcMinus(props) {
25001
25001
  width: "1em",
25002
25002
  height: "1em",
25003
25003
  viewBox: "0 0 14 14"
25004
- }, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
25004
+ }, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
25005
25005
  fill: "#959BA1",
25006
25006
  className: "ic-minus_svg__fill-color",
25007
25007
  fillRule: "evenodd",
@@ -25051,7 +25051,7 @@ var SvgIcErrorExclamation = function SvgIcErrorExclamation(props) {
25051
25051
  }))));
25052
25052
  };
25053
25053
 
25054
- var _path$9;
25054
+ var _path$8;
25055
25055
  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); }
25056
25056
  var SvgIcEnter = function SvgIcEnter(props) {
25057
25057
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
@@ -25060,7 +25060,7 @@ var SvgIcEnter = function SvgIcEnter(props) {
25060
25060
  viewBox: "0 0 16 16",
25061
25061
  fill: "none",
25062
25062
  xmlns: "http://www.w3.org/2000/svg"
25063
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
25063
+ }, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
25064
25064
  d: "M12.667 4a.667.667 0 0 0-.667.667v2.666a.667.667 0 0 1-.667.667H4.94l.867-.86a.67.67 0 1 0-.947-.947l-2 2a.667.667 0 0 0-.14.22.667.667 0 0 0 0 .507c.032.082.08.157.14.22l2 2a.666.666 0 0 0 .947 0 .667.667 0 0 0 0-.947l-.867-.86h6.393a2 2 0 0 0 2-2V4.667A.667.667 0 0 0 12.667 4Z",
25065
25065
  fill: "#3B444C"
25066
25066
  })));
@@ -25466,7 +25466,7 @@ function Grid(_a) {
25466
25466
  return (jsxRuntime.jsx("div", __assign({ className: "flex-wrap flexbox ".concat(container ? containerClass : ''), style: containerStyles }, containerDivProps, { children: children })));
25467
25467
  }
25468
25468
 
25469
- var _path$8;
25469
+ var _path$7;
25470
25470
  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); }
25471
25471
  var SvgIcCopy = function SvgIcCopy(props) {
25472
25472
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
@@ -25474,7 +25474,7 @@ var SvgIcCopy = function SvgIcCopy(props) {
25474
25474
  width: "1em",
25475
25475
  height: "1em",
25476
25476
  viewBox: "0 0 20 20"
25477
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
25477
+ }, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
25478
25478
  fill: "#767D84",
25479
25479
  fillRule: "evenodd",
25480
25480
  d: "M15.833 6.917a2.5 2.5 0 0 1 2.5 2.5v6.416a2.5 2.5 0 0 1-2.5 2.5H9.417a2.5 2.5 0 0 1-2.5-2.5V9.417a2.5 2.5 0 0 1 2.5-2.5zm0 1.666H9.417a.833.833 0 0 0-.834.834v6.416c0 .46.373.834.834.834h6.416c.46 0 .834-.373.834-.834V9.417a.833.833 0 0 0-.834-.834zM10.75 1.667c1.24 0 2.256.968 2.33 2.19l.003.143v.75a.833.833 0 0 1-1.66.097l-.006-.097V4c0-.34-.255-.62-.583-.661l-.084-.006H4c-.34 0-.62.255-.661.583L3.333 4v6.75c0 .34.255.62.583.661l.084.006h.75a.833.833 0 0 1 .097 1.66l-.097.006H4a2.333 2.333 0 0 1-2.33-2.19l-.003-.143V4c0-1.24.968-2.256 2.19-2.33L4 1.668h6.75z"
@@ -28306,7 +28306,7 @@ var getInferredTypeFromValueType = function (value) {
28306
28306
  }
28307
28307
  };
28308
28308
 
28309
- var _path$7;
28309
+ var _path$6;
28310
28310
  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); }
28311
28311
  var SvgIcChevronDown = function SvgIcChevronDown(props) {
28312
28312
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
@@ -28314,7 +28314,7 @@ var SvgIcChevronDown = function SvgIcChevronDown(props) {
28314
28314
  width: "1em",
28315
28315
  height: "1em",
28316
28316
  viewBox: "0 0 24 24"
28317
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
28317
+ }, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
28318
28318
  fill: "#999",
28319
28319
  className: "ic-chevron-down_svg__fill-color",
28320
28320
  fillRule: "nonzero",
@@ -28654,7 +28654,7 @@ function DraggableWrapper(_a) {
28654
28654
  } }, { children: children })) })) })));
28655
28655
  }
28656
28656
 
28657
- var _path$6;
28657
+ var _path$5;
28658
28658
  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); }
28659
28659
  var SvgIcDrag = function SvgIcDrag(props) {
28660
28660
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
@@ -28663,7 +28663,7 @@ var SvgIcDrag = function SvgIcDrag(props) {
28663
28663
  viewBox: "0 0 16 16",
28664
28664
  fill: "none",
28665
28665
  xmlns: "http://www.w3.org/2000/svg"
28666
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
28666
+ }, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
28667
28667
  d: "M10.334 9.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5.667 9.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM10.334 5.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5.667 5.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM10.334 13.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5.667 13.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
28668
28668
  fill: "#596168"
28669
28669
  })));
@@ -28785,7 +28785,7 @@ var Pagination = function (_a) {
28785
28785
  jsxRuntime.jsxs("div", __assign({ className: rootClassName || '' }, { children: [jsxRuntime.jsxs("div", __assign({ className: "page-number" }, { children: [offset + 1, " - ", lastPageNo, " of ", size] })), jsxRuntime.jsxs("ul", __assign({ className: "pagination" }, { children: [jsxRuntime.jsx("li", __assign({ className: "page" }, { children: jsxRuntime.jsx("button", __assign({ className: "page__button page__button--icon", disabled: !pageNoIndex, onClick: selectPreviousPage, type: "button", "aria-label": "Previous page" }, { children: jsxRuntime.jsx("span", __assign({ className: "left-icon" }, { children: jsxRuntime.jsx("i", { className: "fa fa-chevron-left" }) })) })) })), visiblePages.map(function (page) { return (jsxRuntime.jsx(PageValueItem, { value: page.value, isSelected: page.selected, selectPage: selectPage }, page.value)); }), jsxRuntime.jsx("li", __assign({ className: "page" }, { children: jsxRuntime.jsx("button", __assign({ className: "page__button page__button--icon", disabled: pageNoIndex === pages.length - 1, onClick: selectNextPage, type: "button", "aria-label": "Next page" }, { children: jsxRuntime.jsx("span", __assign({ className: "left-icon" }, { children: jsxRuntime.jsx("i", { className: "fa fa-chevron-right" }) })) })) }))] })), !isPageSizeFix && (jsxRuntime.jsxs("div", __assign({ className: "select" }, { children: [jsxRuntime.jsx("span", __assign({ className: "select__placeholder" }, { children: "Rows per page" })), jsxRuntime.jsx(PageSizeSelector, { pageSizeOptions: pageSizeOptions, pageSize: pageSize, changePageSize: changePageSize })] })))] })));
28786
28786
  };
28787
28787
 
28788
- var _path$5, _path2;
28788
+ var _path$4, _path2;
28789
28789
  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); }
28790
28790
  var SvgIcCpu = function SvgIcCpu(props) {
28791
28791
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
@@ -28794,7 +28794,7 @@ var SvgIcCpu = function SvgIcCpu(props) {
28794
28794
  height: "1em",
28795
28795
  viewBox: "0 0 20 20",
28796
28796
  fill: "none"
28797
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
28797
+ }, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
28798
28798
  d: "M12.5 5.625h-5m5 2.5h-5m8.125-5v13.75c0 .345-.28.625-.625.625H5a.625.625 0 0 1-.625-.625V3.125c0-.345.28-.625.625-.625h10c.345 0 .625.28.625.625Z",
28799
28799
  stroke: "#596168",
28800
28800
  strokeWidth: 1.5,
@@ -28806,7 +28806,7 @@ var SvgIcCpu = function SvgIcCpu(props) {
28806
28806
  })));
28807
28807
  };
28808
28808
 
28809
- var _path$4;
28809
+ var _path$3;
28810
28810
  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); }
28811
28811
  var SvgIcMemory = function SvgIcMemory(props) {
28812
28812
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
@@ -28815,7 +28815,7 @@ var SvgIcMemory = function SvgIcMemory(props) {
28815
28815
  height: "1em",
28816
28816
  viewBox: "0 0 20 20",
28817
28817
  fill: "none"
28818
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
28818
+ }, props), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
28819
28819
  d: "M16.25 8.125h1.875m-1.875 3.75h1.875m-16.25-3.75H3.75m-1.875 3.75H3.75m8.125 4.375v1.875m-3.75-1.875v1.875m3.75-16.25V3.75m-3.75-1.875V3.75m-.313 4.063h4.375v4.375H7.814V7.811ZM4.376 3.75h11.25c.345 0 .625.28.625.625v11.25c0 .345-.28.625-.625.625H4.375a.625.625 0 0 1-.625-.625V4.375c0-.345.28-.625.625-.625Z",
28820
28820
  stroke: "#596168",
28821
28821
  strokeWidth: 1.5,
@@ -28824,7 +28824,7 @@ var SvgIcMemory = function SvgIcMemory(props) {
28824
28824
  })));
28825
28825
  };
28826
28826
 
28827
- var _path$3;
28827
+ var _path$2;
28828
28828
  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); }
28829
28829
  var SvgIcTimer = function SvgIcTimer(props) {
28830
28830
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
@@ -28833,7 +28833,7 @@ var SvgIcTimer = function SvgIcTimer(props) {
28833
28833
  height: "1em",
28834
28834
  viewBox: "0 0 20 20",
28835
28835
  fill: "none"
28836
- }, props), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
28836
+ }, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
28837
28837
  d: "m10 11.041 3.094-3.093M8.125 1.666h3.75m5 9.376a6.875 6.875 0 1 1-13.75 0 6.875 6.875 0 0 1 13.75 0Z",
28838
28838
  stroke: "#596168",
28839
28839
  strokeWidth: 1.5,
@@ -29253,9 +29253,128 @@ var BulkSelectionOptionsLabels = (_a = {},
29253
29253
  _a);
29254
29254
  // Considering application can not be named as *
29255
29255
  var SELECT_ALL_ACROSS_PAGES_LOCATOR = '*';
29256
- var getInvalidActionMessage = function (action) { return "Invalid action ".concat(action, " passed to useBulkSelection"); };
29256
+ var getInvalidActionMessage = function (action) { return "Invalid action ".concat(action, " passed to useBulkSelection"); };
29257
+ var BULK_SELECTION_CONTEXT_ERROR = 'useBulkSelection must be used within BulkSelectionContext';
29258
+
29259
+ // giving type any here since not exporting this context, rather using it through useBulkSelection hook which is typed
29260
+ var BulkSelectionContext = React.createContext({
29261
+ selectedIdentifiers: {},
29262
+ handleBulkSelection: noop$1,
29263
+ isChecked: false,
29264
+ checkboxValue: exports.CHECKBOX_VALUE.CHECKED,
29265
+ });
29266
+ var useBulkSelection = function () {
29267
+ var context = React.useContext(BulkSelectionContext);
29268
+ if (!context) {
29269
+ throw new Error(BULK_SELECTION_CONTEXT_ERROR);
29270
+ }
29271
+ return context;
29272
+ };
29273
+ var BulkSelectionProvider = function (_a) {
29274
+ var children = _a.children, identifiers = _a.identifiers, getSelectAllDialogStatus = _a.getSelectAllDialogStatus;
29275
+ var _b = __read(React.useState({}), 2), selectedIdentifiers = _b[0], setSelectedIdentifiers = _b[1];
29276
+ var setIdentifiersAfterClear = function (newIdentifiers, selectedIds) {
29277
+ var _newIdentifiers = JSON.parse(JSON.stringify(newIdentifiers));
29278
+ selectedIds.forEach(function (id) {
29279
+ delete _newIdentifiers[id];
29280
+ });
29281
+ setSelectedIdentifiers(_newIdentifiers);
29282
+ };
29283
+ var setIdentifiersAfterPageSelection = function (baseObject) {
29284
+ var _selectedIdentifiers = JSON.parse(JSON.stringify(selectedIdentifiers));
29285
+ // removing bulk selection across pages if present
29286
+ if (_selectedIdentifiers[SELECT_ALL_ACROSS_PAGES_LOCATOR]) {
29287
+ delete _selectedIdentifiers[SELECT_ALL_ACROSS_PAGES_LOCATOR];
29288
+ }
29289
+ setSelectedIdentifiers(__assign(__assign({}, _selectedIdentifiers), baseObject));
29290
+ };
29291
+ var handleBulkSelection = function (_a) {
29292
+ var _b, _c;
29293
+ var _d, _e;
29294
+ var action = _a.action, data = _a.data;
29295
+ var selectedIds = (_d = data === null || data === void 0 ? void 0 : data.identifierIds) !== null && _d !== void 0 ? _d : [];
29296
+ var identifierObject = (_e = data === null || data === void 0 ? void 0 : data.identifierObject) !== null && _e !== void 0 ? _e : {};
29297
+ switch (action) {
29298
+ case exports.BulkSelectionEvents.CLEAR_ALL_SELECTIONS:
29299
+ setSelectedIdentifiers({});
29300
+ break;
29301
+ case exports.BulkSelectionEvents.CLEAR_IDENTIFIERS_AFTER_ACROSS_SELECTION: {
29302
+ setIdentifiersAfterClear(identifiers, selectedIds);
29303
+ break;
29304
+ }
29305
+ case exports.BulkSelectionEvents.CLEAR_IDENTIFIERS: {
29306
+ setIdentifiersAfterClear(selectedIdentifiers, selectedIds);
29307
+ break;
29308
+ }
29309
+ case exports.BulkSelectionEvents.SELECT_ALL_ACROSS_PAGES: {
29310
+ if (selectedIdentifiers[SELECT_ALL_ACROSS_PAGES_LOCATOR]) {
29311
+ return;
29312
+ }
29313
+ var selectedIdentifiersLength = Object.keys(selectedIdentifiers).length;
29314
+ if (selectedIdentifiersLength > 0 && getSelectAllDialogStatus() === exports.SelectAllDialogStatus.OPEN) {
29315
+ return;
29316
+ }
29317
+ setSelectedIdentifiers((_b = {},
29318
+ _b[SELECT_ALL_ACROSS_PAGES_LOCATOR] = true,
29319
+ _b));
29320
+ break;
29321
+ }
29322
+ case exports.BulkSelectionEvents.CLEAR_SELECTIONS_AND_SELECT_ALL_ACROSS_PAGES:
29323
+ setSelectedIdentifiers((_c = {},
29324
+ _c[SELECT_ALL_ACROSS_PAGES_LOCATOR] = true,
29325
+ _c));
29326
+ break;
29327
+ case exports.BulkSelectionEvents.SELECT_ALL_ON_PAGE: {
29328
+ setIdentifiersAfterPageSelection(identifiers);
29329
+ break;
29330
+ }
29331
+ case exports.BulkSelectionEvents.SELECT_IDENTIFIER: {
29332
+ setIdentifiersAfterPageSelection(identifierObject);
29333
+ break;
29334
+ }
29335
+ default:
29336
+ throw new Error(getInvalidActionMessage(action));
29337
+ }
29338
+ };
29339
+ var getBulkSelectionCheckboxValues = function () {
29340
+ var selectedIdentifiersArray = Object.keys(selectedIdentifiers);
29341
+ if (selectedIdentifiersArray.length === 0) {
29342
+ return {
29343
+ isChecked: false,
29344
+ checkboxValue: exports.CHECKBOX_VALUE.CHECKED,
29345
+ };
29346
+ }
29347
+ // if selectedIdentifiers contains select all across pages locator then it means all are selected
29348
+ if (selectedIdentifiers[SELECT_ALL_ACROSS_PAGES_LOCATOR]) {
29349
+ return {
29350
+ isChecked: true,
29351
+ checkboxValue: exports.CHECKBOX_VALUE.BULK_CHECKED,
29352
+ };
29353
+ }
29354
+ // if all the identifiers are selected then CHECKED else intermediate
29355
+ var areAllPresentIdentifiersSelected = selectedIdentifiersArray.every(function (identifierId) { return identifiers[identifierId]; });
29356
+ if (areAllPresentIdentifiersSelected) {
29357
+ return {
29358
+ isChecked: true,
29359
+ checkboxValue: exports.CHECKBOX_VALUE.CHECKED,
29360
+ };
29361
+ }
29362
+ return {
29363
+ isChecked: true,
29364
+ checkboxValue: exports.CHECKBOX_VALUE.INTERMEDIATE,
29365
+ };
29366
+ };
29367
+ var _c = getBulkSelectionCheckboxValues(), isChecked = _c.isChecked, checkboxValue = _c.checkboxValue;
29368
+ var value = React.useMemo(function () { return ({
29369
+ selectedIdentifiers: selectedIdentifiers,
29370
+ handleBulkSelection: handleBulkSelection,
29371
+ isChecked: isChecked,
29372
+ checkboxValue: checkboxValue,
29373
+ }); }, [selectedIdentifiers, handleBulkSelection, isChecked, checkboxValue]);
29374
+ return jsxRuntime.jsx(BulkSelectionContext.Provider, __assign({ value: value }, { children: children }));
29375
+ };
29257
29376
 
29258
- var _rect$1, _path$2;
29377
+ var _rect$1, _path$1;
29259
29378
  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); }
29260
29379
  var SvgIcCheckSquare = function SvgIcCheckSquare(props) {
29261
29380
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
@@ -29274,7 +29393,7 @@ var SvgIcCheckSquare = function SvgIcCheckSquare(props) {
29274
29393
  strokeWidth: 1.5,
29275
29394
  strokeLinecap: "round",
29276
29395
  strokeLinejoin: "round"
29277
- })), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
29396
+ })), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
29278
29397
  d: "m11.208 5.958-4.083 4.083L5.083 8",
29279
29398
  stroke: "#596168",
29280
29399
  strokeWidth: 1.5,
@@ -29283,7 +29402,7 @@ var SvgIcCheckSquare = function SvgIcCheckSquare(props) {
29283
29402
  })));
29284
29403
  };
29285
29404
 
29286
- var _rect, _path$1;
29405
+ var _rect, _path;
29287
29406
  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); }
29288
29407
  var SvgIcCheckAll = function SvgIcCheckAll(props) {
29289
29408
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
@@ -29302,7 +29421,7 @@ var SvgIcCheckAll = function SvgIcCheckAll(props) {
29302
29421
  strokeWidth: 1.5,
29303
29422
  strokeLinecap: "round",
29304
29423
  strokeLinejoin: "round"
29305
- })), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
29424
+ })), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
29306
29425
  d: "M15.467 5.866v5.6a4 4 0 0 1-4 4h-5.6M10.35 5.85l-3.5 3.5L5.1 7.6",
29307
29426
  stroke: "#596168",
29308
29427
  strokeWidth: 1.5,
@@ -29311,26 +29430,29 @@ var SvgIcCheckAll = function SvgIcCheckAll(props) {
29311
29430
  })));
29312
29431
  };
29313
29432
 
29314
- var _path;
29433
+ var _defs, _use;
29315
29434
  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); }
29316
29435
  var SvgIcClose = function SvgIcClose(props) {
29317
29436
  return /*#__PURE__*/React__namespace.createElement("svg", _extends({
29437
+ xmlns: "http://www.w3.org/2000/svg",
29438
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
29318
29439
  width: "1em",
29319
29440
  height: "1em",
29320
- viewBox: "0 0 10 10",
29321
- fill: "none",
29322
- xmlns: "http://www.w3.org/2000/svg"
29323
- }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
29324
- d: "M8.333 1.667 1.667 8.334m6.666 0L1.667 1.667",
29325
- stroke: "#596168",
29326
- strokeWidth: 1.5,
29327
- strokeLinecap: "round",
29328
- strokeLinejoin: "round"
29441
+ viewBox: "0 0 24 24"
29442
+ }, props), _defs || (_defs = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("path", {
29443
+ id: "ic-close_svg__a",
29444
+ className: "ic-close_svg__stroke-color",
29445
+ d: "M18.295 5.705a.997.997 0 0 0-1.41 0L12 10.59 7.115 5.705a.997.997 0 1 0-1.41 1.41L10.59 12l-4.885 4.885a.997.997 0 1 0 1.41 1.41L12 13.41l4.885 4.885a.997.997 0 0 0 1.41-1.41L13.41 12l4.885-4.885a.997.997 0 0 0 0-1.41z"
29446
+ }))), _use || (_use = /*#__PURE__*/React__namespace.createElement("use", {
29447
+ fill: "#999",
29448
+ xlinkHref: "#ic-close_svg__a",
29449
+ fillRule: "evenodd"
29329
29450
  })));
29330
29451
  };
29331
29452
 
29332
29453
  var BulkSelection = function (_a) {
29333
- var checkboxValue = _a.checkboxValue, isChecked = _a.isChecked, selectedIdentifiers = _a.selectedIdentifiers, handleBulkSelection = _a.handleBulkSelection, showPagination = _a.showPagination;
29454
+ var showPagination = _a.showPagination;
29455
+ var _b = useBulkSelection(), handleBulkSelection = _b.handleBulkSelection, selectedIdentifiers = _b.selectedIdentifiers, isChecked = _b.isChecked, checkboxValue = _b.checkboxValue;
29334
29456
  var areOptionsSelected = Object.keys(selectedIdentifiers).length > 0;
29335
29457
  var BulkSelectionItems = __spreadArray(__spreadArray([
29336
29458
  {
@@ -29361,78 +29483,6 @@ var BulkSelection = function (_a) {
29361
29483
  return (jsxRuntime.jsxs(PopupMenu, __assign({ autoClose: true }, { children: [jsxRuntime.jsxs(PopupMenu.Button, __assign({ isKebab: true, rootClassName: "h-20 flexbox p-0 dc__no-background dc__no-border dc__outline-none-imp", dataTestId: BULK_DROPDOWN_TEST_ID }, { children: [jsxRuntime.jsx(Checkbox$1, { isChecked: isChecked, onChange: noop$1, rootClassName: "icon-dim-20", value: checkboxValue }), jsxRuntime.jsx(SvgIcChevronDown, { className: "icon-dim-20 icon-n6" })] })), jsxRuntime.jsx(PopupMenu.Body, __assign({ rootClassName: "dc__top-22 w-150 dc__right-0 pt-4 pb-4 pl-0 pr-0 bcn-0 flex column dc__content-start dc__align-start dc__position-abs bcn-0 dc__border dc__border-radius-4-imp" }, { children: BulkSelectionItems.map(function (item) { return (jsxRuntime.jsx(BulkSelectionDropdownItems, { locator: item.locator, label: item.label, isSelected: item.isSelected, icon: item.icon, handleBulkSelection: handleBulkSelection }, item.locator)); }) }))] })));
29362
29484
  };
29363
29485
 
29364
- var useBulkSelection = function (_a) {
29365
- var identifiers = _a.identifiers, getSelectAllDialogStatus = _a.getSelectAllDialogStatus;
29366
- var _b = __read(React.useState({}), 2), selectedIdentifiers = _b[0], setSelectedIdentifiers = _b[1];
29367
- var setIdentifiersAfterClear = function (newIdentifiers, selectedIds) {
29368
- var _newIdentifiers = JSON.parse(JSON.stringify(newIdentifiers));
29369
- selectedIds.forEach(function (id) {
29370
- delete _newIdentifiers[id];
29371
- });
29372
- setSelectedIdentifiers(_newIdentifiers);
29373
- };
29374
- var setIdentifiersAfterPageSelection = function (baseObject) {
29375
- var _selectedIdentifiers = JSON.parse(JSON.stringify(selectedIdentifiers));
29376
- // removing bulk selection across pages if present
29377
- if (_selectedIdentifiers[SELECT_ALL_ACROSS_PAGES_LOCATOR]) {
29378
- delete _selectedIdentifiers[SELECT_ALL_ACROSS_PAGES_LOCATOR];
29379
- }
29380
- setSelectedIdentifiers(__assign(__assign({}, _selectedIdentifiers), baseObject));
29381
- };
29382
- var handleBulkSelection = function (_a) {
29383
- var _b, _c;
29384
- var _d, _e;
29385
- var action = _a.action, data = _a.data;
29386
- var selectedIds = (_d = data === null || data === void 0 ? void 0 : data.identifierIds) !== null && _d !== void 0 ? _d : [];
29387
- var identifierObject = (_e = data === null || data === void 0 ? void 0 : data.identifierObject) !== null && _e !== void 0 ? _e : {};
29388
- switch (action) {
29389
- case exports.BulkSelectionEvents.CLEAR_ALL_SELECTIONS:
29390
- setSelectedIdentifiers({});
29391
- break;
29392
- case exports.BulkSelectionEvents.CLEAR_IDENTIFIERS_AFTER_ACROSS_SELECTION: {
29393
- setIdentifiersAfterClear(identifiers, selectedIds);
29394
- break;
29395
- }
29396
- case exports.BulkSelectionEvents.CLEAR_IDENTIFIERS: {
29397
- setIdentifiersAfterClear(selectedIdentifiers, selectedIds);
29398
- break;
29399
- }
29400
- case exports.BulkSelectionEvents.SELECT_ALL_ACROSS_PAGES: {
29401
- if (selectedIdentifiers[SELECT_ALL_ACROSS_PAGES_LOCATOR]) {
29402
- return;
29403
- }
29404
- var selectedIdentifiersLength = Object.keys(selectedIdentifiers).length;
29405
- if (selectedIdentifiersLength > 0 && getSelectAllDialogStatus() === exports.SelectAllDialogStatus.OPEN) {
29406
- return;
29407
- }
29408
- setSelectedIdentifiers((_b = {},
29409
- _b[SELECT_ALL_ACROSS_PAGES_LOCATOR] = true,
29410
- _b));
29411
- break;
29412
- }
29413
- case exports.BulkSelectionEvents.CLEAR_SELECTIONS_AND_SELECT_ALL_ACROSS_PAGES:
29414
- setSelectedIdentifiers((_c = {},
29415
- _c[SELECT_ALL_ACROSS_PAGES_LOCATOR] = true,
29416
- _c));
29417
- break;
29418
- case exports.BulkSelectionEvents.SELECT_ALL_ON_PAGE: {
29419
- setIdentifiersAfterPageSelection(identifiers);
29420
- break;
29421
- }
29422
- case exports.BulkSelectionEvents.SELECT_IDENTIFIER: {
29423
- setIdentifiersAfterPageSelection(identifierObject);
29424
- break;
29425
- }
29426
- default:
29427
- throw new Error(getInvalidActionMessage(action));
29428
- }
29429
- };
29430
- return {
29431
- handleBulkSelection: handleBulkSelection,
29432
- selectedIdentifiers: selectedIdentifiers,
29433
- };
29434
- };
29435
-
29436
29486
  var MESSAGES = {
29437
29487
  PROVIDE_A_NUMBER: 'Please provide a number',
29438
29488
  LOWERCASE_ALPHANUMERIC: 'Only lowercase alphanumeric characters, -, _ or . allowed',
@@ -29972,6 +30022,7 @@ exports.BUILD_INFRA_INPUT_CONSTRAINTS = BUILD_INFRA_INPUT_CONSTRAINTS;
29972
30022
  exports.BUILD_INFRA_TEST_IDS = BUILD_INFRA_TEST_IDS;
29973
30023
  exports.BUILD_INFRA_TEXT = BUILD_INFRA_TEXT;
29974
30024
  exports.BULK_DROPDOWN_TEST_ID = BULK_DROPDOWN_TEST_ID;
30025
+ exports.BULK_SELECTION_CONTEXT_ERROR = BULK_SELECTION_CONTEXT_ERROR;
29975
30026
  exports.BreadCrumb = BreadCrumb;
29976
30027
  exports.BreadcrumbStore = Store;
29977
30028
  exports.BuildInfraConfigActionMap = BuildInfraConfigActionMap;
@@ -29981,6 +30032,7 @@ exports.BuildInfraFooter = Footer;
29981
30032
  exports.BuildStageVariable = BuildStageVariable;
29982
30033
  exports.BulkSelection = BulkSelection;
29983
30034
  exports.BulkSelectionOptionsLabels = BulkSelectionOptionsLabels;
30035
+ exports.BulkSelectionProvider = BulkSelectionProvider;
29984
30036
  exports.CDModalTab = CDModalTab;
29985
30037
  exports.CREATE_MODE_REQUIRED_INPUT_FIELDS = CREATE_MODE_REQUIRED_INPUT_FIELDS;
29986
30038
  exports.CREATE_PROFILE_BASE_VALUE = CREATE_PROFILE_BASE_VALUE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.59-beta-10",
3
+ "version": "0.0.59-beta-12",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,3 +1,9 @@
1
- <svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M8.33335 1.66699L1.66669 8.33366M8.33335 8.33366L1.66669 1.66699" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24" viewBox="0 0 24 24">
2
+ <defs>
3
+ <path id="a" class="stroke-color" d="M18.295 5.705a.997.997 0 0 0-1.41 0L12 10.59 7.115 5.705a.997.997 0 1 0-1.41 1.41L10.59 12l-4.885 4.885a.997.997 0 1 0 1.41 1.41L12 13.41l4.885 4.885a.997.997 0 0 0 1.41-1.41L13.41 12l4.885-4.885a.997.997 0 0 0 0-1.41z"/>
4
+ </defs>
5
+ <g fill="none" fill-rule="evenodd">
6
+ <path d=""/>
7
+ <use fill="#999" xlink:href="#a"/>
8
+ </g>
3
9
  </svg>
@@ -1,5 +1,6 @@
1
1
  import BulkSelectionDropdownItems from './BulkSelectionDropdownItems'
2
2
  import { CHECKBOX_VALUE, Checkbox, PopupMenu, noop } from '../../../Common'
3
+ import { useBulkSelection } from './BulkSelectionProvider'
3
4
  import { BulkSelectionDropdownItemsType, BulkSelectionEvents, BulkSelectionProps } from './types'
4
5
  import { BULK_DROPDOWN_TEST_ID, BulkSelectionOptionsLabels } from './constants'
5
6
  import { ReactComponent as ICChevronDown } from '../../../Assets/Icon/ic-chevron-down.svg'
@@ -7,13 +8,8 @@ import { ReactComponent as ICCheckSquare } from '../../../Assets/Icon/ic-check-s
7
8
  import { ReactComponent as ICCheckAll } from '../../../Assets/Icon/ic-check-all.svg'
8
9
  import { ReactComponent as ICClose } from '../../../Assets/Icon/ic-close.svg'
9
10
 
10
- const BulkSelection = <T,>({
11
- checkboxValue,
12
- isChecked,
13
- selectedIdentifiers,
14
- handleBulkSelection,
15
- showPagination,
16
- }: BulkSelectionProps<T>) => {
11
+ const BulkSelection = <T,>({ showPagination }: BulkSelectionProps) => {
12
+ const { handleBulkSelection, selectedIdentifiers, isChecked, checkboxValue } = useBulkSelection<T>()
17
13
  const areOptionsSelected = Object.keys(selectedIdentifiers).length > 0
18
14
  const BulkSelectionItems: BulkSelectionDropdownItemsType[] = [
19
15
  {
@@ -1,17 +1,36 @@
1
- import { useState } from 'react'
2
- import { SELECT_ALL_ACROSS_PAGES_LOCATOR, getInvalidActionMessage } from './constants'
1
+ import { createContext, useContext, useMemo, useState } from 'react'
2
+ import { BULK_SELECTION_CONTEXT_ERROR, SELECT_ALL_ACROSS_PAGES_LOCATOR, getInvalidActionMessage } from './constants'
3
3
  import {
4
4
  BulkSelectionEvents,
5
+ GetBulkSelectionCheckboxValuesType,
5
6
  HandleBulkSelectionType,
6
7
  SelectAllDialogStatus,
7
8
  UseBulkSelectionProps,
8
9
  UseBulkSelectionReturnType,
9
10
  } from './types'
11
+ import { CHECKBOX_VALUE, noop } from '../../../Common'
12
+
13
+ // giving type any here since not exporting this context, rather using it through useBulkSelection hook which is typed
14
+ const BulkSelectionContext = createContext<UseBulkSelectionReturnType<any>>({
15
+ selectedIdentifiers: {},
16
+ handleBulkSelection: noop,
17
+ isChecked: false,
18
+ checkboxValue: CHECKBOX_VALUE.CHECKED,
19
+ })
20
+
21
+ export const useBulkSelection = <T,>() => {
22
+ const context = useContext<UseBulkSelectionReturnType<T>>(BulkSelectionContext)
23
+ if (!context) {
24
+ throw new Error(BULK_SELECTION_CONTEXT_ERROR)
25
+ }
26
+ return context
27
+ }
10
28
 
11
- const useBulkSelection = <T,>({
29
+ export const BulkSelectionProvider = <T,>({
30
+ children,
12
31
  identifiers,
13
32
  getSelectAllDialogStatus,
14
- }: UseBulkSelectionProps<T>): UseBulkSelectionReturnType<T> => {
33
+ }: UseBulkSelectionProps<T>) => {
15
34
  const [selectedIdentifiers, setSelectedIdentifiers] = useState<T>({} as T)
16
35
 
17
36
  const setIdentifiersAfterClear = (newIdentifiers: T, selectedIds: (number | string)[]) => {
@@ -90,10 +109,52 @@ const useBulkSelection = <T,>({
90
109
  }
91
110
  }
92
111
 
93
- return {
94
- handleBulkSelection,
95
- selectedIdentifiers,
112
+ const getBulkSelectionCheckboxValues = (): GetBulkSelectionCheckboxValuesType => {
113
+ const selectedIdentifiersArray = Object.keys(selectedIdentifiers)
114
+ if (selectedIdentifiersArray.length === 0) {
115
+ return {
116
+ isChecked: false,
117
+ checkboxValue: CHECKBOX_VALUE.CHECKED,
118
+ }
119
+ }
120
+
121
+ // if selectedIdentifiers contains select all across pages locator then it means all are selected
122
+ if (selectedIdentifiers[SELECT_ALL_ACROSS_PAGES_LOCATOR]) {
123
+ return {
124
+ isChecked: true,
125
+ checkboxValue: CHECKBOX_VALUE.BULK_CHECKED,
126
+ }
127
+ }
128
+
129
+ // if all the identifiers are selected then CHECKED else intermediate
130
+ const areAllPresentIdentifiersSelected = selectedIdentifiersArray.every(
131
+ (identifierId) => identifiers[identifierId],
132
+ )
133
+
134
+ if (areAllPresentIdentifiersSelected) {
135
+ return {
136
+ isChecked: true,
137
+ checkboxValue: CHECKBOX_VALUE.CHECKED,
138
+ }
139
+ }
140
+
141
+ return {
142
+ isChecked: true,
143
+ checkboxValue: CHECKBOX_VALUE.INTERMEDIATE,
144
+ }
96
145
  }
97
- }
98
146
 
99
- export default useBulkSelection
147
+ const { isChecked, checkboxValue } = getBulkSelectionCheckboxValues()
148
+
149
+ const value = useMemo(
150
+ () => ({
151
+ selectedIdentifiers,
152
+ handleBulkSelection,
153
+ isChecked,
154
+ checkboxValue,
155
+ }),
156
+ [selectedIdentifiers, handleBulkSelection, isChecked, checkboxValue],
157
+ )
158
+
159
+ return <BulkSelectionContext.Provider value={value}>{children}</BulkSelectionContext.Provider>
160
+ }
@@ -10,3 +10,4 @@ export const BulkSelectionOptionsLabels = {
10
10
  // Considering application can not be named as *
11
11
  export const SELECT_ALL_ACROSS_PAGES_LOCATOR = '*' as const
12
12
  export const getInvalidActionMessage = (action: string) => `Invalid action ${action} passed to useBulkSelection`
13
+ export const BULK_SELECTION_CONTEXT_ERROR = 'useBulkSelection must be used within BulkSelectionContext'
@@ -1,4 +1,4 @@
1
1
  export { default as BulkSelection } from './BulkSelection'
2
- export { default as useBulkSelection } from './UseBulkSelection'
2
+ export * from './BulkSelectionProvider'
3
3
  export * from './types'
4
4
  export * from './constants'
@@ -18,14 +18,17 @@ export interface HandleBulkSelectionType<T> {
18
18
  }
19
19
  }
20
20
 
21
- export interface UseBulkSelectionReturnType<T> {
21
+ export interface GetBulkSelectionCheckboxValuesType {
22
+ isChecked: boolean
23
+ checkboxValue: CHECKBOX_VALUE
24
+ }
25
+
26
+ export interface UseBulkSelectionReturnType<T> extends GetBulkSelectionCheckboxValuesType {
22
27
  selectedIdentifiers: T
23
28
  handleBulkSelection: ({ action, data }: HandleBulkSelectionType<T>) => void
24
29
  }
25
30
 
26
- export interface BulkSelectionProps<T> extends UseBulkSelectionReturnType<T> {
27
- checkboxValue: CHECKBOX_VALUE
28
- isChecked: boolean
31
+ export interface BulkSelectionProps {
29
32
  showPagination: boolean
30
33
  }
31
34
 
@@ -38,7 +41,7 @@ export interface BulkSelectionDropdownItemsType {
38
41
 
39
42
  export interface BulkSelectionDropdownItemsProps<T>
40
43
  extends BulkSelectionDropdownItemsType,
41
- Pick<BulkSelectionProps<T>, 'handleBulkSelection'> {}
44
+ Pick<UseBulkSelectionReturnType<T>, 'handleBulkSelection'> {}
42
45
 
43
46
  export enum SelectAllDialogStatus {
44
47
  OPEN = 'OPEN',
@@ -58,4 +61,5 @@ export interface UseBulkSelectionProps<T> {
58
61
  * Act as buffer between select all across pages and select all on page state
59
62
  */
60
63
  getSelectAllDialogStatus: () => SelectAllDialogStatus
64
+ children?: React.ReactNode
61
65
  }
@@ -1,3 +0,0 @@
1
- import { UseBulkSelectionProps, UseBulkSelectionReturnType } from './types';
2
- declare const useBulkSelection: <T>({ identifiers, getSelectAllDialogStatus, }: UseBulkSelectionProps<T>) => UseBulkSelectionReturnType<T>;
3
- export default useBulkSelection;