@apexcura/ui-components 0.0.11-Beta161 → 0.0.11-Beta163

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,19 +650,35 @@ var import_antd15 = 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)("");
653
+ const [date, setDate] = (0, import_react20.useState)();
654
654
  const handleChange = (value, datestring) => {
655
- const formatedDate = (0, import_moment.default)(datestring).format("lll");
656
- setDate(formatedDate);
657
- if (props.onChange) {
658
- props.onChange(date);
655
+ if (value) {
656
+ const formattedDate = (0, import_moment.default)(datestring).format("lll");
657
+ setDate(value);
658
+ if (props.onChange) {
659
+ props.onChange(formattedDate);
660
+ }
661
+ } else {
662
+ setDate("");
659
663
  }
660
664
  };
661
665
  const onHandleDecrement = () => {
662
- setDate((0, import_moment.default)(date).subtract(1, "days").calendar());
666
+ if (date) {
667
+ const newDate = (0, import_moment.default)(date).subtract(1, "days");
668
+ setDate(newDate.format("lll"));
669
+ if (props.onChange) {
670
+ props.onChange(newDate.format("lll"));
671
+ }
672
+ }
663
673
  };
664
674
  const onHandleIncrement = () => {
665
- setDate((0, import_moment.default)(date).add(1, "days").calendar());
675
+ if (date) {
676
+ const newDate = (0, import_moment.default)(date).add(1, "days");
677
+ setDate(newDate.format("lll"));
678
+ if (props.onChange) {
679
+ props.onChange(newDate.format("lll"));
680
+ }
681
+ }
666
682
  };
667
683
  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_antd15.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)));
668
684
  };
package/dist/index.mjs CHANGED
@@ -599,19 +599,35 @@ 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("");
602
+ const [date, setDate] = useState5();
603
603
  const handleChange = (value, datestring) => {
604
- const formatedDate = moment(datestring).format("lll");
605
- setDate(formatedDate);
606
- if (props.onChange) {
607
- props.onChange(date);
604
+ if (value) {
605
+ const formattedDate = moment(datestring).format("lll");
606
+ setDate(value);
607
+ if (props.onChange) {
608
+ props.onChange(formattedDate);
609
+ }
610
+ } else {
611
+ setDate("");
608
612
  }
609
613
  };
610
614
  const onHandleDecrement = () => {
611
- setDate(moment(date).subtract(1, "days").calendar());
615
+ if (date) {
616
+ const newDate = moment(date).subtract(1, "days");
617
+ setDate(newDate.format("lll"));
618
+ if (props.onChange) {
619
+ props.onChange(newDate.format("lll"));
620
+ }
621
+ }
612
622
  };
613
623
  const onHandleIncrement = () => {
614
- setDate(moment(date).add(1, "days").calendar());
624
+ if (date) {
625
+ const newDate = moment(date).add(1, "days");
626
+ setDate(newDate.format("lll"));
627
+ if (props.onChange) {
628
+ props.onChange(newDate.format("lll"));
629
+ }
630
+ }
615
631
  };
616
632
  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)));
617
633
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta161",
3
+ "version": "0.0.11-Beta163",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",