@ceed/cds 1.5.4-next.1 → 1.5.4-next.2

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.
@@ -21,7 +21,6 @@ interface BaseMonthPickerProps {
21
21
  disablePast?: boolean;
22
22
  format?: string;
23
23
  displayFormat?: string;
24
- readonly?: boolean;
25
24
  }
26
25
  export type MonthPickerProps = BaseMonthPickerProps & Omit<React.ComponentProps<typeof Input>, "onChange" | "value" | "defaultValue">;
27
26
  declare const MonthPicker: React.ForwardRefExoticComponent<Omit<MonthPickerProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
package/dist/index.cjs CHANGED
@@ -4570,16 +4570,17 @@ var formatValueString3 = (date, format) => {
4570
4570
  const year = date.getFullYear().toString();
4571
4571
  const month = (date.getMonth() + 1).toString().padStart(2, "0");
4572
4572
  const monthName = getMonthName2(date);
4573
- const day = date.getDate().toString().padStart(2, "0");
4573
+ const day = "01";
4574
4574
  return format.replace(/MMMM/g, monthName).replace(/MM/g, month).replace(/DD/g, day).replace(/YYYY/g, year);
4575
4575
  };
4576
4576
  function parseDate3(dateString, format) {
4577
- const formatParts = format.split(/[-./\s]/);
4578
4577
  const dateParts = dateString.split(/[-./\s]/);
4578
+ const formatParts = format.split(/[-./\s]/);
4579
4579
  if (formatParts.length !== dateParts.length) {
4580
4580
  throw new Error("Invalid date string or format");
4581
4581
  }
4582
- let day = 1, month, year;
4582
+ let month, year;
4583
+ const day = 1;
4583
4584
  for (let i = 0; i < formatParts.length; i++) {
4584
4585
  const value = parseInt(dateParts[i], 10);
4585
4586
  switch (formatParts[i]) {
@@ -4589,9 +4590,6 @@ function parseDate3(dateString, format) {
4589
4590
  case "YYYY":
4590
4591
  year = value;
4591
4592
  break;
4592
- case "DD":
4593
- day = 1;
4594
- break;
4595
4593
  }
4596
4594
  }
4597
4595
  const result = new Date(year, month, day);
@@ -4615,8 +4613,7 @@ var MonthPicker = (0, import_react33.forwardRef)(
4615
4613
  sx,
4616
4614
  className,
4617
4615
  format = "YYYY/MM/DD",
4618
- displayFormat = "YYYY/MM/DD",
4619
- readOnly,
4616
+ displayFormat = "YYYY/MM",
4620
4617
  size,
4621
4618
  ...innerProps
4622
4619
  } = props;
@@ -4713,7 +4710,7 @@ var MonthPicker = (0, import_react33.forwardRef)(
4713
4710
  IconButton_default,
4714
4711
  {
4715
4712
  variant: "plain",
4716
- onClick: readOnly ? void 0 : handleCalendarToggle,
4713
+ onClick: handleCalendarToggle,
4717
4714
  "aria-label": "Toggle Calendar",
4718
4715
  "aria-controls": "month-picker-popper",
4719
4716
  "aria-haspopup": "dialog",
@@ -4723,8 +4720,7 @@ var MonthPicker = (0, import_react33.forwardRef)(
4723
4720
  /* @__PURE__ */ import_react33.default.createElement(import_CalendarToday3.default, null)
4724
4721
  ),
4725
4722
  label,
4726
- helperText,
4727
- readOnly
4723
+ helperText
4728
4724
  }
4729
4725
  ), open && /* @__PURE__ */ import_react33.default.createElement(import_base4.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react33.default.createElement(
4730
4726
  StyledPopper3,
@@ -4752,11 +4748,10 @@ var MonthPicker = (0, import_react33.forwardRef)(
4752
4748
  views: ["month"],
4753
4749
  value: !Number.isNaN(new Date(value).getTime()) ? [new Date(value), void 0] : void 0,
4754
4750
  onChange: ([date]) => {
4755
- const monthDate = new Date(date.getFullYear(), date.getMonth(), 1);
4756
4751
  handleChange({
4757
4752
  target: {
4758
4753
  name: props.name,
4759
- value: formatValueString3(monthDate, format)
4754
+ value: formatValueString3(date, format)
4760
4755
  }
4761
4756
  });
4762
4757
  setAnchorEl(null);
package/dist/index.js CHANGED
@@ -4566,16 +4566,17 @@ var formatValueString3 = (date, format) => {
4566
4566
  const year = date.getFullYear().toString();
4567
4567
  const month = (date.getMonth() + 1).toString().padStart(2, "0");
4568
4568
  const monthName = getMonthName2(date);
4569
- const day = date.getDate().toString().padStart(2, "0");
4569
+ const day = "01";
4570
4570
  return format.replace(/MMMM/g, monthName).replace(/MM/g, month).replace(/DD/g, day).replace(/YYYY/g, year);
4571
4571
  };
4572
4572
  function parseDate3(dateString, format) {
4573
- const formatParts = format.split(/[-./\s]/);
4574
4573
  const dateParts = dateString.split(/[-./\s]/);
4574
+ const formatParts = format.split(/[-./\s]/);
4575
4575
  if (formatParts.length !== dateParts.length) {
4576
4576
  throw new Error("Invalid date string or format");
4577
4577
  }
4578
- let day = 1, month, year;
4578
+ let month, year;
4579
+ const day = 1;
4579
4580
  for (let i = 0; i < formatParts.length; i++) {
4580
4581
  const value = parseInt(dateParts[i], 10);
4581
4582
  switch (formatParts[i]) {
@@ -4585,9 +4586,6 @@ function parseDate3(dateString, format) {
4585
4586
  case "YYYY":
4586
4587
  year = value;
4587
4588
  break;
4588
- case "DD":
4589
- day = 1;
4590
- break;
4591
4589
  }
4592
4590
  }
4593
4591
  const result = new Date(year, month, day);
@@ -4611,8 +4609,7 @@ var MonthPicker = forwardRef9(
4611
4609
  sx,
4612
4610
  className,
4613
4611
  format = "YYYY/MM/DD",
4614
- displayFormat = "YYYY/MM/DD",
4615
- readOnly,
4612
+ displayFormat = "YYYY/MM",
4616
4613
  size,
4617
4614
  ...innerProps
4618
4615
  } = props;
@@ -4709,7 +4706,7 @@ var MonthPicker = forwardRef9(
4709
4706
  IconButton_default,
4710
4707
  {
4711
4708
  variant: "plain",
4712
- onClick: readOnly ? void 0 : handleCalendarToggle,
4709
+ onClick: handleCalendarToggle,
4713
4710
  "aria-label": "Toggle Calendar",
4714
4711
  "aria-controls": "month-picker-popper",
4715
4712
  "aria-haspopup": "dialog",
@@ -4719,8 +4716,7 @@ var MonthPicker = forwardRef9(
4719
4716
  /* @__PURE__ */ React31.createElement(CalendarTodayIcon3, null)
4720
4717
  ),
4721
4718
  label,
4722
- helperText,
4723
- readOnly
4719
+ helperText
4724
4720
  }
4725
4721
  ), open && /* @__PURE__ */ React31.createElement(ClickAwayListener3, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ React31.createElement(
4726
4722
  StyledPopper3,
@@ -4748,11 +4744,10 @@ var MonthPicker = forwardRef9(
4748
4744
  views: ["month"],
4749
4745
  value: !Number.isNaN(new Date(value).getTime()) ? [new Date(value), void 0] : void 0,
4750
4746
  onChange: ([date]) => {
4751
- const monthDate = new Date(date.getFullYear(), date.getMonth(), 1);
4752
4747
  handleChange({
4753
4748
  target: {
4754
4749
  name: props.name,
4755
- value: formatValueString3(monthDate, format)
4750
+ value: formatValueString3(date, format)
4756
4751
  }
4757
4752
  });
4758
4753
  setAnchorEl(null);