@cakemail-org/ui-components-v2 2.0.57 → 2.0.58

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,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "./styles.scss";
3
3
  import { TFilterBar } from "./types";
4
- export declare function FilterBar({ operatorOptions, initOperatorValue, operatorValue, onSave, saveTxt, onClear, clearTxt, onUpdate, addFilterTxt, filterTerms, initFilterTerms, dropMenuOptions, dropMenuProps, replacePartial }: TFilterBar): React.JSX.Element;
4
+ export declare function FilterBar({ operatorOptions, initOperatorValue, operatorValue, onSave, saveTxt, onClear, clearTxt, onUpdate, onSearchUpdate, loading, addFilterTxt, filterTerms, initFilterTerms, dropMenuOptions, dropMenuProps, replacePartial }: TFilterBar): React.JSX.Element;
5
5
  export default FilterBar;
6
6
  export * from "./types";
@@ -30,12 +30,18 @@ export type TFilterBar = {
30
30
  disabledTabs?: string[];
31
31
  };
32
32
  replacePartial?: boolean;
33
+ onSearchUpdate?: ({ value, tab }: TFilterBarSearchUpdate) => void;
34
+ loading?: boolean;
33
35
  };
34
36
  export type TFilterBarUpdate = ({ filterTerms, operator }: TFilterBarupdateReturn) => void;
35
37
  export type TFilterBarupdateReturn = {
36
38
  filterTerms: TFilterBarFilterTerm[];
37
39
  operator: EOperatorTypes;
38
40
  };
41
+ export type TFilterBarSearchUpdate = {
42
+ value: string;
43
+ tab: string;
44
+ };
39
45
  export type TFilterBarFilterTerm = {
40
46
  value: string;
41
47
  text?: string;
package/dist/cjs/index.js CHANGED
@@ -8749,7 +8749,7 @@ styleInject(css_248z$9);
8749
8749
 
8750
8750
  function FilterBar(_a) {
8751
8751
  var _b, _c, _d, _e, _f;
8752
- var operatorOptions = _a.operatorOptions, initOperatorValue = _a.initOperatorValue, operatorValue = _a.operatorValue, onSave = _a.onSave, saveTxt = _a.saveTxt, onClear = _a.onClear, clearTxt = _a.clearTxt, onUpdate = _a.onUpdate, addFilterTxt = _a.addFilterTxt, filterTerms = _a.filterTerms, initFilterTerms = _a.initFilterTerms, dropMenuOptions = _a.dropMenuOptions, dropMenuProps = _a.dropMenuProps, replacePartial = _a.replacePartial;
8752
+ var operatorOptions = _a.operatorOptions, initOperatorValue = _a.initOperatorValue, operatorValue = _a.operatorValue, onSave = _a.onSave, saveTxt = _a.saveTxt, onClear = _a.onClear, clearTxt = _a.clearTxt, onUpdate = _a.onUpdate, onSearchUpdate = _a.onSearchUpdate, loading = _a.loading, addFilterTxt = _a.addFilterTxt, filterTerms = _a.filterTerms, initFilterTerms = _a.initFilterTerms, dropMenuOptions = _a.dropMenuOptions, dropMenuProps = _a.dropMenuProps, replacePartial = _a.replacePartial;
8753
8753
  var _g = React.useState(false), showSearch = _g[0], setShowSearch = _g[1];
8754
8754
  var _h = React.useState(""), search = _h[0], setSearch = _h[1];
8755
8755
  var _j = React.useState((_c = (_b = dropMenuProps === null || dropMenuProps === void 0 ? void 0 : dropMenuProps.tabs) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.name), selectedTab = _j[0], setSelectedTab = _j[1];
@@ -8773,6 +8773,7 @@ function FilterBar(_a) {
8773
8773
  if (search === "") {
8774
8774
  handleShowSearch();
8775
8775
  }
8776
+ onSearchUpdate && onSearchUpdate({ value: search || "", tab: selectedTab || "" });
8776
8777
  }
8777
8778
  function handleRemoveTerm(termValue) {
8778
8779
  var updatedTerms = cFilterTerms.filter(function (t) { return t.value !== termValue; });
@@ -8867,7 +8868,7 @@ function FilterBar(_a) {
8867
8868
  return __assign(__assign({}, t), { disabled: (_a = dropMenuProps === null || dropMenuProps === void 0 ? void 0 : dropMenuProps.disabledTabs) === null || _a === void 0 ? void 0 : _a.includes(t.name) });
8868
8869
  });
8869
8870
  }
8870
- return React.createElement(material.Stack, { className: "filter-bar-component-v2", direction: "row" },
8871
+ return React.createElement(material.Stack, { className: "filter-bar-component-v2 ".concat(loading ? "loading" : ""), direction: "row" },
8871
8872
  React.createElement(material.Stack, { direction: "row", className: "DDItem", alignItems: "center", justifyContent: "center" },
8872
8873
  React.createElement(Dropdown, { menuPlacement: "bottom-left", value: cOperatorValue, prefixIcon: "Filter14", variant: "standard", options: operatorOptions, color: "body1", onChange: handleOperatorDD })),
8873
8874
  React.createElement(material.Stack, { className: "addFilterBox", alignItems: "center", justifyContent: "center" },
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "./styles.scss";
3
3
  import { TFilterBar } from "./types";
4
- export declare function FilterBar({ operatorOptions, initOperatorValue, operatorValue, onSave, saveTxt, onClear, clearTxt, onUpdate, addFilterTxt, filterTerms, initFilterTerms, dropMenuOptions, dropMenuProps, replacePartial }: TFilterBar): React.JSX.Element;
4
+ export declare function FilterBar({ operatorOptions, initOperatorValue, operatorValue, onSave, saveTxt, onClear, clearTxt, onUpdate, onSearchUpdate, loading, addFilterTxt, filterTerms, initFilterTerms, dropMenuOptions, dropMenuProps, replacePartial }: TFilterBar): React.JSX.Element;
5
5
  export default FilterBar;
6
6
  export * from "./types";
@@ -30,12 +30,18 @@ export type TFilterBar = {
30
30
  disabledTabs?: string[];
31
31
  };
32
32
  replacePartial?: boolean;
33
+ onSearchUpdate?: ({ value, tab }: TFilterBarSearchUpdate) => void;
34
+ loading?: boolean;
33
35
  };
34
36
  export type TFilterBarUpdate = ({ filterTerms, operator }: TFilterBarupdateReturn) => void;
35
37
  export type TFilterBarupdateReturn = {
36
38
  filterTerms: TFilterBarFilterTerm[];
37
39
  operator: EOperatorTypes;
38
40
  };
41
+ export type TFilterBarSearchUpdate = {
42
+ value: string;
43
+ tab: string;
44
+ };
39
45
  export type TFilterBarFilterTerm = {
40
46
  value: string;
41
47
  text?: string;
package/dist/esm/index.js CHANGED
@@ -8729,7 +8729,7 @@ styleInject(css_248z$9);
8729
8729
 
8730
8730
  function FilterBar(_a) {
8731
8731
  var _b, _c, _d, _e, _f;
8732
- var operatorOptions = _a.operatorOptions, initOperatorValue = _a.initOperatorValue, operatorValue = _a.operatorValue, onSave = _a.onSave, saveTxt = _a.saveTxt, onClear = _a.onClear, clearTxt = _a.clearTxt, onUpdate = _a.onUpdate, addFilterTxt = _a.addFilterTxt, filterTerms = _a.filterTerms, initFilterTerms = _a.initFilterTerms, dropMenuOptions = _a.dropMenuOptions, dropMenuProps = _a.dropMenuProps, replacePartial = _a.replacePartial;
8732
+ var operatorOptions = _a.operatorOptions, initOperatorValue = _a.initOperatorValue, operatorValue = _a.operatorValue, onSave = _a.onSave, saveTxt = _a.saveTxt, onClear = _a.onClear, clearTxt = _a.clearTxt, onUpdate = _a.onUpdate, onSearchUpdate = _a.onSearchUpdate, loading = _a.loading, addFilterTxt = _a.addFilterTxt, filterTerms = _a.filterTerms, initFilterTerms = _a.initFilterTerms, dropMenuOptions = _a.dropMenuOptions, dropMenuProps = _a.dropMenuProps, replacePartial = _a.replacePartial;
8733
8733
  var _g = useState(false), showSearch = _g[0], setShowSearch = _g[1];
8734
8734
  var _h = useState(""), search = _h[0], setSearch = _h[1];
8735
8735
  var _j = useState((_c = (_b = dropMenuProps === null || dropMenuProps === void 0 ? void 0 : dropMenuProps.tabs) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.name), selectedTab = _j[0], setSelectedTab = _j[1];
@@ -8753,6 +8753,7 @@ function FilterBar(_a) {
8753
8753
  if (search === "") {
8754
8754
  handleShowSearch();
8755
8755
  }
8756
+ onSearchUpdate && onSearchUpdate({ value: search || "", tab: selectedTab || "" });
8756
8757
  }
8757
8758
  function handleRemoveTerm(termValue) {
8758
8759
  var updatedTerms = cFilterTerms.filter(function (t) { return t.value !== termValue; });
@@ -8847,7 +8848,7 @@ function FilterBar(_a) {
8847
8848
  return __assign(__assign({}, t), { disabled: (_a = dropMenuProps === null || dropMenuProps === void 0 ? void 0 : dropMenuProps.disabledTabs) === null || _a === void 0 ? void 0 : _a.includes(t.name) });
8848
8849
  });
8849
8850
  }
8850
- return React__default.createElement(Stack$1, { className: "filter-bar-component-v2", direction: "row" },
8851
+ return React__default.createElement(Stack$1, { className: "filter-bar-component-v2 ".concat(loading ? "loading" : ""), direction: "row" },
8851
8852
  React__default.createElement(Stack$1, { direction: "row", className: "DDItem", alignItems: "center", justifyContent: "center" },
8852
8853
  React__default.createElement(Dropdown, { menuPlacement: "bottom-left", value: cOperatorValue, prefixIcon: "Filter14", variant: "standard", options: operatorOptions, color: "body1", onChange: handleOperatorDD })),
8853
8854
  React__default.createElement(Stack$1, { className: "addFilterBox", alignItems: "center", justifyContent: "center" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cakemail-org/ui-components-v2",
3
- "version": "2.0.57",
3
+ "version": "2.0.58",
4
4
  "description": "ui library kit made with material UI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",