@apexcura/ui-components 0.0.11-Beta166 → 0.0.11-Beta167

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.
package/dist/index.js CHANGED
@@ -650,22 +650,47 @@ var import_antd14 = require("antd");
650
650
  var import_icons4 = require("@ant-design/icons");
651
651
  var import_moment = __toESM(require("moment"));
652
652
  var DatePickerElement = (props) => {
653
- const [date, setDate] = (0, import_react20.useState)("");
654
- const handleChange = (datestring) => {
655
- console.log("datestring--------", datestring);
656
- const formatedData = (0, import_moment.default)(datestring).format("lll");
657
- if (props.onChange) {
658
- props.onChange(formatedData);
653
+ const [date, setDate] = (0, import_react20.useState)(null);
654
+ const handleChange = (date2) => {
655
+ if (date2) {
656
+ const formattedDate = date2.format("lll");
657
+ setDate(date2);
658
+ if (props.onChange) {
659
+ props.onChange(formattedDate);
660
+ }
661
+ } else {
662
+ setDate(null);
663
+ if (props.onChange) {
664
+ props.onChange("");
665
+ }
659
666
  }
660
- setDate(formatedData);
661
- setDate(formatedData);
662
- console.log("date--------", date);
663
667
  };
664
668
  const onHandleDecrement = () => {
669
+ if (date) {
670
+ const newDate = (0, import_moment.default)(date).subtract(1, "days");
671
+ setDate(newDate);
672
+ if (props.onChange) {
673
+ props.onChange(newDate.format("lll"));
674
+ }
675
+ }
665
676
  };
666
677
  const onHandleIncrement = () => {
678
+ if (date) {
679
+ const newDate = (0, import_moment.default)(date).add(1, "days");
680
+ setDate(newDate);
681
+ if (props.onChange) {
682
+ props.onChange(newDate.format("lll"));
683
+ }
684
+ }
667
685
  };
668
- return /* @__PURE__ */ import_react20.default.createElement("div", null, /* @__PURE__ */ import_react20.default.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ import_react20.default.createElement(import_icons4.LeftOutlined, null)), /* @__PURE__ */ import_react20.default.createElement(import_antd14.DatePicker, { placeholder: props.placeholder, variant: "borderless", value: props.value, defaultValue: true, onChange: handleChange }), /* @__PURE__ */ import_react20.default.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ import_react20.default.createElement(import_icons4.RightOutlined, null)));
686
+ return /* @__PURE__ */ import_react20.default.createElement("div", null, /* @__PURE__ */ import_react20.default.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ import_react20.default.createElement(import_icons4.LeftOutlined, null)), /* @__PURE__ */ import_react20.default.createElement(
687
+ import_antd14.DatePicker,
688
+ {
689
+ placeholder: props.placeholder,
690
+ value: date,
691
+ onChange: handleChange
692
+ }
693
+ ), /* @__PURE__ */ import_react20.default.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ import_react20.default.createElement(import_icons4.RightOutlined, null)));
669
694
  };
670
695
  // Annotate the CommonJS export names for ESM import in node:
671
696
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -599,22 +599,47 @@ import { DatePicker } from "antd";
599
599
  import { LeftOutlined, RightOutlined } from "@ant-design/icons";
600
600
  import moment from "moment";
601
601
  var DatePickerElement = (props) => {
602
- const [date, setDate] = useState5("");
603
- const handleChange = (datestring) => {
604
- console.log("datestring--------", datestring);
605
- const formatedData = moment(datestring).format("lll");
606
- if (props.onChange) {
607
- props.onChange(formatedData);
602
+ const [date, setDate] = useState5(null);
603
+ const handleChange = (date2) => {
604
+ if (date2) {
605
+ const formattedDate = date2.format("lll");
606
+ setDate(date2);
607
+ if (props.onChange) {
608
+ props.onChange(formattedDate);
609
+ }
610
+ } else {
611
+ setDate(null);
612
+ if (props.onChange) {
613
+ props.onChange("");
614
+ }
608
615
  }
609
- setDate(formatedData);
610
- setDate(formatedData);
611
- console.log("date--------", date);
612
616
  };
613
617
  const onHandleDecrement = () => {
618
+ if (date) {
619
+ const newDate = moment(date).subtract(1, "days");
620
+ setDate(newDate);
621
+ if (props.onChange) {
622
+ props.onChange(newDate.format("lll"));
623
+ }
624
+ }
614
625
  };
615
626
  const onHandleIncrement = () => {
627
+ if (date) {
628
+ const newDate = moment(date).add(1, "days");
629
+ setDate(newDate);
630
+ if (props.onChange) {
631
+ props.onChange(newDate.format("lll"));
632
+ }
633
+ }
616
634
  };
617
- return /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ React19.createElement(LeftOutlined, null)), /* @__PURE__ */ React19.createElement(DatePicker, { placeholder: props.placeholder, variant: "borderless", value: props.value, defaultValue: true, onChange: handleChange }), /* @__PURE__ */ React19.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ React19.createElement(RightOutlined, null)));
635
+ return /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ React19.createElement(LeftOutlined, null)), /* @__PURE__ */ React19.createElement(
636
+ DatePicker,
637
+ {
638
+ placeholder: props.placeholder,
639
+ value: date,
640
+ onChange: handleChange
641
+ }
642
+ ), /* @__PURE__ */ React19.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ React19.createElement(RightOutlined, null)));
618
643
  };
619
644
  export {
620
645
  AddMoreTable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta166",
3
+ "version": "0.0.11-Beta167",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",