cecomponent 1.0.165 → 1.0.167

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.
@@ -39999,28 +39999,34 @@ const CESkeletonTable = ({ columns: e, rows: t }) => /* @__PURE__ */ jsxRuntimeE
39999
39999
  disabled: d = !1,
40000
40000
  minDate: m = ""
40001
40001
  }) => {
40002
- const [g, _] = useState(""), [S, E] = useState(""), [b, T] = useState(!1), [C, R] = useState(""), A = m ? new Date(m).toISOString().split("T")[0] : void 0, O = (N) => {
40003
- !N.currentTarget.value && !g && !S && T(!1);
40004
- }, I = (N, D) => {
40005
- if (t == null || t({ startDate: N || "", endDate: D || "" }), N && !D || !N && D) {
40002
+ const [g, _] = useState(""), [S, E] = useState(""), [b, T] = useState(!1), [C, R] = useState(""), A = m ? new Date(m).toISOString().split("T")[0] : void 0, O = (D) => {
40003
+ !D.currentTarget.value && !g && !S && T(!1);
40004
+ }, I = (D, F) => {
40005
+ if (t == null || t({ startDate: D || "", endDate: F || "" }), D && !F || !D && F) {
40006
40006
  R("Both start and end dates must be selected");
40007
40007
  return;
40008
40008
  }
40009
- if (N && D && new Date(D) < new Date(N)) {
40009
+ if (D && F && new Date(F) < new Date(D)) {
40010
40010
  R("End date must be after or equal to start date");
40011
40011
  return;
40012
40012
  }
40013
40013
  R("");
40014
+ }, j = (D) => {
40015
+ if (!D) return D;
40016
+ const F = D.split("-");
40017
+ if (F.length === 0) return D;
40018
+ const q = F[0].slice(0, 4), z = F.slice(1);
40019
+ return z.length ? `${q}-${z.join("-")}` : q;
40014
40020
  };
40015
40021
  useEffect(() => {
40016
- p && (p.startDate && _(p.startDate), p.endDate && E(p.endDate));
40022
+ p && (p.startDate && _(j(p.startDate)), p.endDate && E(j(p.endDate)));
40017
40023
  }, [p]);
40018
- const j = (N) => {
40019
- const D = N.target.value;
40020
- _(D), I(D, S);
40021
- }, M = (N) => {
40022
- const D = N.target.value;
40023
- E(D), I(g, D);
40024
+ const M = (D) => {
40025
+ const F = D.target.value, q = j(F);
40026
+ _(q), I(q, S);
40027
+ }, N = (D) => {
40028
+ const F = D.target.value, q = j(F);
40029
+ E(q), I(g, q);
40024
40030
  };
40025
40031
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
40026
40032
  "div",
@@ -40039,12 +40045,12 @@ const CESkeletonTable = ({ columns: e, rows: t }) => /* @__PURE__ */ jsxRuntimeE
40039
40045
  name: u,
40040
40046
  "data-testid": l ? `${l}-input` : void 0,
40041
40047
  min: A,
40042
- onChange: (N) => {
40043
- const D = N.target.value;
40044
- _(D), t == null || t({ startDate: D, endDate: "" });
40048
+ onChange: (D) => {
40049
+ const F = D.target.value, q = j(F);
40050
+ _(q), t == null || t({ startDate: q, endDate: "" });
40045
40051
  },
40046
40052
  onFocus: () => T(!0),
40047
- onBlur: (N) => O(N),
40053
+ onBlur: (D) => O(D),
40048
40054
  disabled: d
40049
40055
  }
40050
40056
  ),
@@ -40058,9 +40064,9 @@ const CESkeletonTable = ({ columns: e, rows: t }) => /* @__PURE__ */ jsxRuntimeE
40058
40064
  value: g,
40059
40065
  name: u ? `${u}-from` : void 0,
40060
40066
  "data-testid": l ? `${l}-from` : void 0,
40061
- onChange: j,
40067
+ onChange: M,
40062
40068
  onFocus: () => T(!0),
40063
- onBlur: (N) => O(N),
40069
+ onBlur: (D) => O(D),
40064
40070
  disabled: d
40065
40071
  }
40066
40072
  ),
@@ -40075,9 +40081,9 @@ const CESkeletonTable = ({ columns: e, rows: t }) => /* @__PURE__ */ jsxRuntimeE
40075
40081
  value: S,
40076
40082
  name: u ? `${u}-to` : void 0,
40077
40083
  "data-testid": l ? `${l}-to` : void 0,
40078
- onChange: M,
40084
+ onChange: N,
40079
40085
  onFocus: () => T(!0),
40080
- onBlur: (N) => O(N),
40086
+ onBlur: (D) => O(D),
40081
40087
  disabled: d
40082
40088
  }
40083
40089
  ),
@@ -63790,19 +63796,20 @@ const CEBarChart = ({
63790
63796
  refreshKey: t = 0,
63791
63797
  statusOrder: n,
63792
63798
  statusColor: i,
63793
- height: o = 300
63799
+ height: o = 300,
63800
+ onBarClick: l
63794
63801
  }) => {
63795
- const l = ({ active: u, payload: f, label: p }) => {
63796
- if (u && f && f.length) {
63797
- const d = f.reduce(
63798
- (m, g) => m + (g.value || 0),
63802
+ const u = ({ active: f, payload: p, label: d }) => {
63803
+ if (f && p && p.length) {
63804
+ const m = p.reduce(
63805
+ (g, _) => g + (_.value || 0),
63799
63806
  0
63800
63807
  );
63801
63808
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "stacked-barchart-tooltip", children: [
63802
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "fstacked-barchart-tooltip-title", children: `${p}: ${d} total orders` }),
63803
- f.filter((m) => m.value > 0).sort(
63804
- (m, g) => n.indexOf(m.dataKey) - n.indexOf(g.dataKey)
63805
- ).map((m, g) => /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm", style: { color: m.color }, children: `${m.dataKey}: ${m.value} orders` }, g))
63809
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "fstacked-barchart-tooltip-title", children: `${d}: ${m} total orders` }),
63810
+ p.filter((g) => g.value > 0).sort(
63811
+ (g, _) => n.indexOf(g.dataKey) - n.indexOf(_.dataKey)
63812
+ ).map((g, _) => /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm", style: { color: g.color }, children: `${g.dataKey}: ${g.value} orders` }, _))
63806
63813
  ] });
63807
63814
  }
63808
63815
  return null;
@@ -63811,17 +63818,18 @@ const CEBarChart = ({
63811
63818
  /* @__PURE__ */ jsxRuntimeExports.jsx(CartesianGrid, { strokeDasharray: "3 3" }),
63812
63819
  /* @__PURE__ */ jsxRuntimeExports.jsx(XAxis, { dataKey: "name" }),
63813
63820
  /* @__PURE__ */ jsxRuntimeExports.jsx(YAxis, {}),
63814
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { content: /* @__PURE__ */ jsxRuntimeExports.jsx(l, {}) }),
63821
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { content: /* @__PURE__ */ jsxRuntimeExports.jsx(u, {}) }),
63815
63822
  /* @__PURE__ */ jsxRuntimeExports.jsx(Legend, {}),
63816
- n.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx(
63823
+ n.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsx(
63817
63824
  Bar,
63818
63825
  {
63819
- dataKey: u,
63826
+ dataKey: f,
63820
63827
  stackId: "age",
63821
- fill: i[u] || "#6b7280",
63822
- name: u
63828
+ fill: i[f] || "#6b7280",
63829
+ name: f,
63830
+ onClick: () => l(f)
63823
63831
  },
63824
- u
63832
+ f
63825
63833
  ))
63826
63834
  ] }) }) }, t);
63827
63835
  }, LINE_OF_BUSINESS_COLORS = {
@@ -8,6 +8,7 @@ interface CEStackedBarChartProps {
8
8
  refreshKey?: number;
9
9
  statusColor: Record<string, string>;
10
10
  height?: number;
11
+ onBarClick?: (status: string) => void;
11
12
  }
12
13
  declare const CEStackedBarChart: React.FC<CEStackedBarChartProps>;
13
14
  export default CEStackedBarChart;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cecomponent",
3
3
  "description": "A React component library for building modern UIs for Cleanearth",
4
- "version": "1.0.165",
4
+ "version": "1.0.167",
5
5
  "main": "dist/ce-component-lib.js",
6
6
  "module": "dist/ce-component-lib.mjs",
7
7
  "types": "dist/idex.d.ts",