cecomponent 1.0.105 → 1.0.106

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.
@@ -52543,30 +52543,46 @@ const CEInputBox$1 = ({
52543
52543
  onChange: t,
52544
52544
  size: i = "medium",
52545
52545
  style: n,
52546
- inputGroupStyle: s
52546
+ inputGroupStyle: s,
52547
+ mode: a = "range"
52547
52548
  }) => {
52548
- const [a, o] = useState(""), [l, c] = useState(""), [f, u] = useState(!1), [y, d] = useState(""), g = (x) => {
52549
- !x.currentTarget.value && !a && !l && u(!1);
52550
- }, m = (x, _) => {
52551
- x && _ && new Date(_) < new Date(x) ? d("End date must be after or equal to start date") : (d(""), t == null || t({ startDate: x, endDate: _ }));
52552
- }, p = (x) => {
52553
- const _ = x.target.value;
52554
- o(_), m(_, l);
52555
- }, S = (x) => {
52556
- const _ = x.target.value;
52557
- c(_), m(a, _);
52549
+ const [o, l] = useState(""), [c, f] = useState(""), [u, y] = useState(!1), [d, g] = useState(""), m = (_) => {
52550
+ !_.currentTarget.value && !o && !c && y(!1);
52551
+ }, p = (_, E) => {
52552
+ _ && E && new Date(E) < new Date(_) ? g("End date must be after or equal to start date") : (g(""), t == null || t({ startDate: _, endDate: E }));
52553
+ }, S = (_) => {
52554
+ const E = _.target.value;
52555
+ l(E), p(E, c);
52556
+ }, x = (_) => {
52557
+ const E = _.target.value;
52558
+ f(E), p(o, E);
52558
52559
  };
52559
52560
  return /* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", { className: "date-range-picker", style: n, children: [
52560
- /* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", { className: "date-range-field-group", style: s, children: [
52561
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { className: "date-range-field-group", style: s, children: a === "single" ? /* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", { className: "field-box float", children: [
52562
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx(
52563
+ "input",
52564
+ {
52565
+ type: "date",
52566
+ value: o,
52567
+ onChange: (_) => {
52568
+ const E = _.target.value;
52569
+ l(E), t == null || t({ startDate: E, endDate: "" });
52570
+ },
52571
+ onFocus: () => y(!0),
52572
+ onBlur: (_) => m(_)
52573
+ }
52574
+ ),
52575
+ /* @__PURE__ */ jsxRuntimeExports$1.jsx("label", { className: "floating-label-box", children: e || "Select Date" })
52576
+ ] }) : /* @__PURE__ */ jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [
52561
52577
  /* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", { className: "field-box float", children: [
52562
52578
  /* @__PURE__ */ jsxRuntimeExports$1.jsx(
52563
52579
  "input",
52564
52580
  {
52565
52581
  type: "date",
52566
- value: a,
52567
- onChange: p,
52568
- onFocus: () => u(!0),
52569
- onBlur: (x) => g(x)
52582
+ value: o,
52583
+ onChange: S,
52584
+ onFocus: () => y(!0),
52585
+ onBlur: (_) => m(_)
52570
52586
  }
52571
52587
  ),
52572
52588
  /* @__PURE__ */ jsxRuntimeExports$1.jsx("label", { className: "floating-label-box", children: "From" })
@@ -52577,16 +52593,16 @@ const CEInputBox$1 = ({
52577
52593
  "input",
52578
52594
  {
52579
52595
  type: "date",
52580
- value: l,
52581
- onChange: S,
52582
- onFocus: () => u(!0),
52583
- onBlur: (x) => g(x)
52596
+ value: c,
52597
+ onChange: x,
52598
+ onFocus: () => y(!0),
52599
+ onBlur: (_) => m(_)
52584
52600
  }
52585
52601
  ),
52586
52602
  /* @__PURE__ */ jsxRuntimeExports$1.jsx("label", { className: "floating-label-box", children: "To" })
52587
52603
  ] })
52588
- ] }),
52589
- y && /* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { className: "error-text", children: y })
52604
+ ] }) }),
52605
+ d && a !== "single" && /* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { className: "error-text", children: d })
52590
52606
  ] });
52591
52607
  }, FieldsInput = ({
52592
52608
  label: e,
@@ -10,6 +10,7 @@ interface CEDateRangePickerProps {
10
10
  size?: Size;
11
11
  style?: React.CSSProperties;
12
12
  inputGroupStyle?: React.CSSProperties;
13
+ mode?: "range" | "single";
13
14
  }
14
15
  declare const CEDateRangePicker: React.FC<CEDateRangePickerProps>;
15
16
  export default CEDateRangePicker;
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.105",
4
+ "version": "1.0.106",
5
5
  "main": "dist/ce-component-lib.js",
6
6
  "module": "dist/ce-component-lib.mjs",
7
7
  "types": "dist/index.d.ts",