@ceed/cds 1.5.3 → 1.5.4-next.1

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.
@@ -20,6 +20,8 @@ interface BaseMonthPickerProps {
20
20
  disableFuture?: boolean;
21
21
  disablePast?: boolean;
22
22
  format?: string;
23
+ displayFormat?: string;
24
+ readonly?: boolean;
23
25
  }
24
26
  export type MonthPickerProps = BaseMonthPickerProps & Omit<React.ComponentProps<typeof Input>, "onChange" | "value" | "defaultValue">;
25
27
  declare const MonthPicker: React.ForwardRefExoticComponent<Omit<MonthPickerProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
package/dist/index.cjs CHANGED
@@ -4538,7 +4538,6 @@ MenuButton.displayName = "MenuButton";
4538
4538
 
4539
4539
  // src/components/MonthPicker/MonthPicker.tsx
4540
4540
  var import_react33 = __toESM(require("react"));
4541
- var import_react_imask3 = require("react-imask");
4542
4541
  var import_CalendarToday3 = __toESM(require("@mui/icons-material/CalendarToday"));
4543
4542
  var import_joy46 = require("@mui/joy");
4544
4543
  var import_base4 = require("@mui/base");
@@ -4564,60 +4563,40 @@ var MonthPickerRoot = (0, import_joy46.styled)("div", {
4564
4563
  })({
4565
4564
  width: "100%"
4566
4565
  });
4566
+ function getMonthName2(date) {
4567
+ return new Intl.DateTimeFormat("en-US", { month: "long" }).format(date);
4568
+ }
4567
4569
  var formatValueString3 = (date, format) => {
4568
- let month = `${date.getMonth() + 1}`;
4569
- const year = date.getFullYear();
4570
- if (Number(month) < 10) month = "0" + month;
4571
- return format.replace(/YYYY/g, year.toString()).replace(/MM/g, month);
4572
- };
4573
- var formatToPattern3 = (format) => {
4574
- return format.replace(/YYYY/g, "Y").replace(/MM/g, "M").replace(/[^YM\s]/g, (match) => `${match}\``);
4570
+ const year = date.getFullYear().toString();
4571
+ const month = (date.getMonth() + 1).toString().padStart(2, "0");
4572
+ const monthName = getMonthName2(date);
4573
+ const day = date.getDate().toString().padStart(2, "0");
4574
+ return format.replace(/MMMM/g, monthName).replace(/MM/g, month).replace(/DD/g, day).replace(/YYYY/g, year);
4575
4575
  };
4576
- function parseDate3(dateString) {
4577
- let month, year;
4578
- const cleanDateString = dateString.replace(/[^\d]/g, "");
4579
- if (dateString.match(/\d{1,2}.\d{4}/)) {
4580
- month = cleanDateString.slice(0, 2);
4581
- year = cleanDateString.slice(2);
4582
- } else if (dateString.match(/\d{4}.\d{1,2}/)) {
4583
- year = cleanDateString.slice(0, 4);
4584
- month = cleanDateString.slice(4);
4576
+ function parseDate3(dateString, format) {
4577
+ const formatParts = format.split(/[-./\s]/);
4578
+ const dateParts = dateString.split(/[-./\s]/);
4579
+ if (formatParts.length !== dateParts.length) {
4580
+ throw new Error("Invalid date string or format");
4585
4581
  }
4586
- const date = /* @__PURE__ */ new Date(`${year}/${month}`);
4587
- return date;
4588
- }
4589
- var TextMaskAdapter7 = import_react33.default.forwardRef(
4590
- function TextMaskAdapter8(props, ref) {
4591
- const { onChange, format, ...other } = props;
4592
- return /* @__PURE__ */ import_react33.default.createElement(
4593
- import_react_imask3.IMaskInput,
4594
- {
4595
- ...other,
4596
- inputRef: ref,
4597
- onAccept: (value) => onChange({ target: { name: props.name, value } }),
4598
- mask: Date,
4599
- pattern: formatToPattern3(format),
4600
- blocks: {
4601
- M: {
4602
- mask: import_react_imask3.IMask.MaskedRange,
4603
- from: 1,
4604
- to: 12,
4605
- maxLength: 2
4606
- },
4607
- Y: {
4608
- mask: import_react_imask3.IMask.MaskedRange,
4609
- from: 1900,
4610
- to: 9999
4611
- }
4612
- },
4613
- format: (date) => formatValueString3(date, format),
4614
- parse: parseDate3,
4615
- autofix: "pad",
4616
- overwrite: true
4617
- }
4618
- );
4582
+ let day = 1, month, year;
4583
+ for (let i = 0; i < formatParts.length; i++) {
4584
+ const value = parseInt(dateParts[i], 10);
4585
+ switch (formatParts[i]) {
4586
+ case "MM":
4587
+ month = value - 1;
4588
+ break;
4589
+ case "YYYY":
4590
+ year = value;
4591
+ break;
4592
+ case "DD":
4593
+ day = 1;
4594
+ break;
4595
+ }
4619
4596
  }
4620
- );
4597
+ const result = new Date(year, month, day);
4598
+ return result;
4599
+ }
4621
4600
  var MonthPicker = (0, import_react33.forwardRef)(
4622
4601
  (inProps, ref) => {
4623
4602
  const props = (0, import_joy46.useThemeProps)({ props: inProps, name: "MonthPicker" });
@@ -4635,11 +4614,14 @@ var MonthPicker = (0, import_react33.forwardRef)(
4635
4614
  // NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
4636
4615
  sx,
4637
4616
  className,
4638
- format = "YYYY/MM",
4617
+ format = "YYYY/MM/DD",
4618
+ displayFormat = "YYYY/MM/DD",
4619
+ readOnly,
4639
4620
  size,
4640
4621
  ...innerProps
4641
4622
  } = props;
4642
4623
  const innerRef = (0, import_react33.useRef)(null);
4624
+ const buttonRef = (0, import_react33.useRef)(null);
4643
4625
  const [value, setValue] = useControlledState(
4644
4626
  props.value,
4645
4627
  props.defaultValue || "",
@@ -4649,6 +4631,9 @@ var MonthPicker = (0, import_react33.forwardRef)(
4649
4631
  ),
4650
4632
  { disableStrict: true }
4651
4633
  );
4634
+ const [displayValue, setDisplayValue] = (0, import_react33.useState)(
4635
+ () => value ? formatValueString3(parseDate3(value, format), displayFormat) : ""
4636
+ );
4652
4637
  const [anchorEl, setAnchorEl] = (0, import_react33.useState)(null);
4653
4638
  const open = Boolean(anchorEl);
4654
4639
  (0, import_react33.useEffect)(() => {
@@ -4659,11 +4644,26 @@ var MonthPicker = (0, import_react33.forwardRef)(
4659
4644
  (0, import_react33.useImperativeHandle)(ref, () => innerRef.current, [
4660
4645
  innerRef
4661
4646
  ]);
4647
+ (0, import_react33.useEffect)(() => {
4648
+ if (value === "") {
4649
+ setDisplayValue("");
4650
+ return;
4651
+ }
4652
+ const formattedValue = formatValueString3(
4653
+ parseDate3(value, format),
4654
+ displayFormat
4655
+ );
4656
+ setDisplayValue(formattedValue);
4657
+ }, [displayFormat, format, value]);
4662
4658
  const handleChange = (0, import_react33.useCallback)(
4663
4659
  (event) => {
4664
- setValue(event.target.value);
4660
+ const value2 = event.target.value;
4661
+ setDisplayValue(
4662
+ value2 ? formatValueString3(parseDate3(value2, format), displayFormat) : value2
4663
+ );
4664
+ setValue(value2);
4665
4665
  },
4666
- [setValue]
4666
+ [displayFormat, format, setValue]
4667
4667
  );
4668
4668
  const handleCalendarToggle = (0, import_react33.useCallback)(
4669
4669
  (event) => {
@@ -4672,6 +4672,13 @@ var MonthPicker = (0, import_react33.forwardRef)(
4672
4672
  },
4673
4673
  [anchorEl, setAnchorEl, innerRef]
4674
4674
  );
4675
+ const handleInputMouseDown = (0, import_react33.useCallback)(
4676
+ (event) => {
4677
+ event.preventDefault();
4678
+ buttonRef.current?.focus();
4679
+ },
4680
+ [buttonRef]
4681
+ );
4675
4682
  return /* @__PURE__ */ import_react33.default.createElement(MonthPickerRoot, null, /* @__PURE__ */ import_react33.default.createElement(import_base4.FocusTrap, { open: true }, /* @__PURE__ */ import_react33.default.createElement(import_react33.default.Fragment, null, /* @__PURE__ */ import_react33.default.createElement(
4676
4683
  Input_default,
4677
4684
  {
@@ -4679,13 +4686,21 @@ var MonthPicker = (0, import_react33.forwardRef)(
4679
4686
  color: error ? "danger" : innerProps.color,
4680
4687
  ref: innerRef,
4681
4688
  size,
4682
- value,
4683
- onChange: handleChange,
4684
- placeholder: format,
4689
+ value: displayValue,
4690
+ placeholder: displayFormat,
4685
4691
  disabled,
4686
4692
  required,
4687
4693
  slotProps: {
4688
- input: { component: TextMaskAdapter7, ref: innerRef, format }
4694
+ input: {
4695
+ ref: innerRef,
4696
+ format: displayFormat,
4697
+ sx: {
4698
+ "&:hover": {
4699
+ cursor: "default"
4700
+ }
4701
+ },
4702
+ onMouseDown: handleInputMouseDown
4703
+ }
4689
4704
  },
4690
4705
  error,
4691
4706
  className,
@@ -4698,16 +4713,18 @@ var MonthPicker = (0, import_react33.forwardRef)(
4698
4713
  IconButton_default,
4699
4714
  {
4700
4715
  variant: "plain",
4701
- onClick: handleCalendarToggle,
4716
+ onClick: readOnly ? void 0 : handleCalendarToggle,
4702
4717
  "aria-label": "Toggle Calendar",
4703
4718
  "aria-controls": "month-picker-popper",
4704
4719
  "aria-haspopup": "dialog",
4705
- "aria-expanded": open
4720
+ "aria-expanded": open,
4721
+ disabled
4706
4722
  },
4707
4723
  /* @__PURE__ */ import_react33.default.createElement(import_CalendarToday3.default, null)
4708
4724
  ),
4709
4725
  label,
4710
- helperText
4726
+ helperText,
4727
+ readOnly
4711
4728
  }
4712
4729
  ), open && /* @__PURE__ */ import_react33.default.createElement(import_base4.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react33.default.createElement(
4713
4730
  StyledPopper3,
@@ -4735,10 +4752,11 @@ var MonthPicker = (0, import_react33.forwardRef)(
4735
4752
  views: ["month"],
4736
4753
  value: !Number.isNaN(new Date(value).getTime()) ? [new Date(value), void 0] : void 0,
4737
4754
  onChange: ([date]) => {
4755
+ const monthDate = new Date(date.getFullYear(), date.getMonth(), 1);
4738
4756
  handleChange({
4739
4757
  target: {
4740
4758
  name: props.name,
4741
- value: formatValueString3(date, format)
4759
+ value: formatValueString3(monthDate, format)
4742
4760
  }
4743
4761
  });
4744
4762
  setAnchorEl(null);
@@ -4780,7 +4798,7 @@ var MonthPicker = (0, import_react33.forwardRef)(
4780
4798
 
4781
4799
  // src/components/MonthRangePicker/MonthRangePicker.tsx
4782
4800
  var import_react34 = __toESM(require("react"));
4783
- var import_react_imask4 = require("react-imask");
4801
+ var import_react_imask3 = require("react-imask");
4784
4802
  var import_CalendarToday4 = __toESM(require("@mui/icons-material/CalendarToday"));
4785
4803
  var import_joy47 = require("@mui/joy");
4786
4804
  var import_base5 = require("@mui/base");
@@ -4834,29 +4852,29 @@ var parseDates2 = (str) => {
4834
4852
  const date2 = str.split(" - ")[1] || "";
4835
4853
  return [parseDate4(date1), parseDate4(date2)];
4836
4854
  };
4837
- var formatToPattern4 = (format) => {
4855
+ var formatToPattern3 = (format) => {
4838
4856
  return `${format} - ${format}`.replace(/YYYY/g, "Y").replace(/MM/g, "m").replace(/[^YMm\s]/g, (match) => `${match}\``);
4839
4857
  };
4840
- var TextMaskAdapter9 = import_react34.default.forwardRef(
4841
- function TextMaskAdapter10(props, ref) {
4858
+ var TextMaskAdapter7 = import_react34.default.forwardRef(
4859
+ function TextMaskAdapter8(props, ref) {
4842
4860
  const { onChange, format, ...other } = props;
4843
4861
  return /* @__PURE__ */ import_react34.default.createElement(
4844
- import_react_imask4.IMaskInput,
4862
+ import_react_imask3.IMaskInput,
4845
4863
  {
4846
4864
  ...other,
4847
4865
  inputRef: ref,
4848
4866
  onAccept: (value) => onChange({ target: { name: props.name, value } }),
4849
4867
  mask: Date,
4850
- pattern: formatToPattern4(format),
4868
+ pattern: formatToPattern3(format),
4851
4869
  blocks: {
4852
4870
  m: {
4853
- mask: import_react_imask4.IMask.MaskedRange,
4871
+ mask: import_react_imask3.IMask.MaskedRange,
4854
4872
  from: 1,
4855
4873
  to: 12,
4856
4874
  maxLength: 2
4857
4875
  },
4858
4876
  Y: {
4859
- mask: import_react_imask4.IMask.MaskedRange,
4877
+ mask: import_react_imask3.IMask.MaskedRange,
4860
4878
  from: 1900,
4861
4879
  to: 9999
4862
4880
  }
@@ -4948,7 +4966,7 @@ var MonthRangePicker = (0, import_react34.forwardRef)(
4948
4966
  required,
4949
4967
  placeholder: `${format} - ${format}`,
4950
4968
  slotProps: {
4951
- input: { component: TextMaskAdapter9, ref: innerRef, format }
4969
+ input: { component: TextMaskAdapter7, ref: innerRef, format }
4952
4970
  },
4953
4971
  error,
4954
4972
  className,
@@ -5149,8 +5167,8 @@ var padDecimal = (value, decimalScale) => {
5149
5167
  const [integer, decimal = ""] = `${value}`.split(".");
5150
5168
  return Number(`${integer}${decimal.padEnd(decimalScale, "0")}`);
5151
5169
  };
5152
- var TextMaskAdapter11 = import_react38.default.forwardRef(
5153
- function TextMaskAdapter12(props, ref) {
5170
+ var TextMaskAdapter9 = import_react38.default.forwardRef(
5171
+ function TextMaskAdapter10(props, ref) {
5154
5172
  const { onChange, min, max, ...innerProps } = props;
5155
5173
  return /* @__PURE__ */ import_react38.default.createElement(
5156
5174
  import_react_number_format2.NumericFormat,
@@ -5246,7 +5264,7 @@ var PercentageInput = import_react38.default.forwardRef(function PercentageInput
5246
5264
  helperText,
5247
5265
  slotProps: {
5248
5266
  input: {
5249
- component: TextMaskAdapter11,
5267
+ component: TextMaskAdapter9,
5250
5268
  "aria-label": innerProps["aria-label"],
5251
5269
  decimalScale: maxDecimalScale
5252
5270
  }
package/dist/index.js CHANGED
@@ -4534,7 +4534,6 @@ import React31, {
4534
4534
  useRef as useRef6,
4535
4535
  useState as useState9
4536
4536
  } from "react";
4537
- import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
4538
4537
  import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
4539
4538
  import { styled as styled20, useThemeProps as useThemeProps6 } from "@mui/joy";
4540
4539
  import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper4 } from "@mui/base";
@@ -4560,60 +4559,40 @@ var MonthPickerRoot = styled20("div", {
4560
4559
  })({
4561
4560
  width: "100%"
4562
4561
  });
4562
+ function getMonthName2(date) {
4563
+ return new Intl.DateTimeFormat("en-US", { month: "long" }).format(date);
4564
+ }
4563
4565
  var formatValueString3 = (date, format) => {
4564
- let month = `${date.getMonth() + 1}`;
4565
- const year = date.getFullYear();
4566
- if (Number(month) < 10) month = "0" + month;
4567
- return format.replace(/YYYY/g, year.toString()).replace(/MM/g, month);
4568
- };
4569
- var formatToPattern3 = (format) => {
4570
- return format.replace(/YYYY/g, "Y").replace(/MM/g, "M").replace(/[^YM\s]/g, (match) => `${match}\``);
4566
+ const year = date.getFullYear().toString();
4567
+ const month = (date.getMonth() + 1).toString().padStart(2, "0");
4568
+ const monthName = getMonthName2(date);
4569
+ const day = date.getDate().toString().padStart(2, "0");
4570
+ return format.replace(/MMMM/g, monthName).replace(/MM/g, month).replace(/DD/g, day).replace(/YYYY/g, year);
4571
4571
  };
4572
- function parseDate3(dateString) {
4573
- let month, year;
4574
- const cleanDateString = dateString.replace(/[^\d]/g, "");
4575
- if (dateString.match(/\d{1,2}.\d{4}/)) {
4576
- month = cleanDateString.slice(0, 2);
4577
- year = cleanDateString.slice(2);
4578
- } else if (dateString.match(/\d{4}.\d{1,2}/)) {
4579
- year = cleanDateString.slice(0, 4);
4580
- month = cleanDateString.slice(4);
4572
+ function parseDate3(dateString, format) {
4573
+ const formatParts = format.split(/[-./\s]/);
4574
+ const dateParts = dateString.split(/[-./\s]/);
4575
+ if (formatParts.length !== dateParts.length) {
4576
+ throw new Error("Invalid date string or format");
4581
4577
  }
4582
- const date = /* @__PURE__ */ new Date(`${year}/${month}`);
4583
- return date;
4584
- }
4585
- var TextMaskAdapter7 = React31.forwardRef(
4586
- function TextMaskAdapter8(props, ref) {
4587
- const { onChange, format, ...other } = props;
4588
- return /* @__PURE__ */ React31.createElement(
4589
- IMaskInput3,
4590
- {
4591
- ...other,
4592
- inputRef: ref,
4593
- onAccept: (value) => onChange({ target: { name: props.name, value } }),
4594
- mask: Date,
4595
- pattern: formatToPattern3(format),
4596
- blocks: {
4597
- M: {
4598
- mask: IMask3.MaskedRange,
4599
- from: 1,
4600
- to: 12,
4601
- maxLength: 2
4602
- },
4603
- Y: {
4604
- mask: IMask3.MaskedRange,
4605
- from: 1900,
4606
- to: 9999
4607
- }
4608
- },
4609
- format: (date) => formatValueString3(date, format),
4610
- parse: parseDate3,
4611
- autofix: "pad",
4612
- overwrite: true
4613
- }
4614
- );
4578
+ let day = 1, month, year;
4579
+ for (let i = 0; i < formatParts.length; i++) {
4580
+ const value = parseInt(dateParts[i], 10);
4581
+ switch (formatParts[i]) {
4582
+ case "MM":
4583
+ month = value - 1;
4584
+ break;
4585
+ case "YYYY":
4586
+ year = value;
4587
+ break;
4588
+ case "DD":
4589
+ day = 1;
4590
+ break;
4591
+ }
4615
4592
  }
4616
- );
4593
+ const result = new Date(year, month, day);
4594
+ return result;
4595
+ }
4617
4596
  var MonthPicker = forwardRef9(
4618
4597
  (inProps, ref) => {
4619
4598
  const props = useThemeProps6({ props: inProps, name: "MonthPicker" });
@@ -4631,11 +4610,14 @@ var MonthPicker = forwardRef9(
4631
4610
  // NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
4632
4611
  sx,
4633
4612
  className,
4634
- format = "YYYY/MM",
4613
+ format = "YYYY/MM/DD",
4614
+ displayFormat = "YYYY/MM/DD",
4615
+ readOnly,
4635
4616
  size,
4636
4617
  ...innerProps
4637
4618
  } = props;
4638
4619
  const innerRef = useRef6(null);
4620
+ const buttonRef = useRef6(null);
4639
4621
  const [value, setValue] = useControlledState(
4640
4622
  props.value,
4641
4623
  props.defaultValue || "",
@@ -4645,6 +4627,9 @@ var MonthPicker = forwardRef9(
4645
4627
  ),
4646
4628
  { disableStrict: true }
4647
4629
  );
4630
+ const [displayValue, setDisplayValue] = useState9(
4631
+ () => value ? formatValueString3(parseDate3(value, format), displayFormat) : ""
4632
+ );
4648
4633
  const [anchorEl, setAnchorEl] = useState9(null);
4649
4634
  const open = Boolean(anchorEl);
4650
4635
  useEffect8(() => {
@@ -4655,11 +4640,26 @@ var MonthPicker = forwardRef9(
4655
4640
  useImperativeHandle4(ref, () => innerRef.current, [
4656
4641
  innerRef
4657
4642
  ]);
4643
+ useEffect8(() => {
4644
+ if (value === "") {
4645
+ setDisplayValue("");
4646
+ return;
4647
+ }
4648
+ const formattedValue = formatValueString3(
4649
+ parseDate3(value, format),
4650
+ displayFormat
4651
+ );
4652
+ setDisplayValue(formattedValue);
4653
+ }, [displayFormat, format, value]);
4658
4654
  const handleChange = useCallback11(
4659
4655
  (event) => {
4660
- setValue(event.target.value);
4656
+ const value2 = event.target.value;
4657
+ setDisplayValue(
4658
+ value2 ? formatValueString3(parseDate3(value2, format), displayFormat) : value2
4659
+ );
4660
+ setValue(value2);
4661
4661
  },
4662
- [setValue]
4662
+ [displayFormat, format, setValue]
4663
4663
  );
4664
4664
  const handleCalendarToggle = useCallback11(
4665
4665
  (event) => {
@@ -4668,6 +4668,13 @@ var MonthPicker = forwardRef9(
4668
4668
  },
4669
4669
  [anchorEl, setAnchorEl, innerRef]
4670
4670
  );
4671
+ const handleInputMouseDown = useCallback11(
4672
+ (event) => {
4673
+ event.preventDefault();
4674
+ buttonRef.current?.focus();
4675
+ },
4676
+ [buttonRef]
4677
+ );
4671
4678
  return /* @__PURE__ */ React31.createElement(MonthPickerRoot, null, /* @__PURE__ */ React31.createElement(FocusTrap3, { open: true }, /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(
4672
4679
  Input_default,
4673
4680
  {
@@ -4675,13 +4682,21 @@ var MonthPicker = forwardRef9(
4675
4682
  color: error ? "danger" : innerProps.color,
4676
4683
  ref: innerRef,
4677
4684
  size,
4678
- value,
4679
- onChange: handleChange,
4680
- placeholder: format,
4685
+ value: displayValue,
4686
+ placeholder: displayFormat,
4681
4687
  disabled,
4682
4688
  required,
4683
4689
  slotProps: {
4684
- input: { component: TextMaskAdapter7, ref: innerRef, format }
4690
+ input: {
4691
+ ref: innerRef,
4692
+ format: displayFormat,
4693
+ sx: {
4694
+ "&:hover": {
4695
+ cursor: "default"
4696
+ }
4697
+ },
4698
+ onMouseDown: handleInputMouseDown
4699
+ }
4685
4700
  },
4686
4701
  error,
4687
4702
  className,
@@ -4694,16 +4709,18 @@ var MonthPicker = forwardRef9(
4694
4709
  IconButton_default,
4695
4710
  {
4696
4711
  variant: "plain",
4697
- onClick: handleCalendarToggle,
4712
+ onClick: readOnly ? void 0 : handleCalendarToggle,
4698
4713
  "aria-label": "Toggle Calendar",
4699
4714
  "aria-controls": "month-picker-popper",
4700
4715
  "aria-haspopup": "dialog",
4701
- "aria-expanded": open
4716
+ "aria-expanded": open,
4717
+ disabled
4702
4718
  },
4703
4719
  /* @__PURE__ */ React31.createElement(CalendarTodayIcon3, null)
4704
4720
  ),
4705
4721
  label,
4706
- helperText
4722
+ helperText,
4723
+ readOnly
4707
4724
  }
4708
4725
  ), open && /* @__PURE__ */ React31.createElement(ClickAwayListener3, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ React31.createElement(
4709
4726
  StyledPopper3,
@@ -4731,10 +4748,11 @@ var MonthPicker = forwardRef9(
4731
4748
  views: ["month"],
4732
4749
  value: !Number.isNaN(new Date(value).getTime()) ? [new Date(value), void 0] : void 0,
4733
4750
  onChange: ([date]) => {
4751
+ const monthDate = new Date(date.getFullYear(), date.getMonth(), 1);
4734
4752
  handleChange({
4735
4753
  target: {
4736
4754
  name: props.name,
4737
- value: formatValueString3(date, format)
4755
+ value: formatValueString3(monthDate, format)
4738
4756
  }
4739
4757
  });
4740
4758
  setAnchorEl(null);
@@ -4784,7 +4802,7 @@ import React32, {
4784
4802
  useRef as useRef7,
4785
4803
  useState as useState10
4786
4804
  } from "react";
4787
- import { IMaskInput as IMaskInput4, IMask as IMask4 } from "react-imask";
4805
+ import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
4788
4806
  import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
4789
4807
  import { styled as styled21, useThemeProps as useThemeProps7 } from "@mui/joy";
4790
4808
  import { FocusTrap as FocusTrap4, ClickAwayListener as ClickAwayListener4, Popper as Popper5 } from "@mui/base";
@@ -4838,29 +4856,29 @@ var parseDates2 = (str) => {
4838
4856
  const date2 = str.split(" - ")[1] || "";
4839
4857
  return [parseDate4(date1), parseDate4(date2)];
4840
4858
  };
4841
- var formatToPattern4 = (format) => {
4859
+ var formatToPattern3 = (format) => {
4842
4860
  return `${format} - ${format}`.replace(/YYYY/g, "Y").replace(/MM/g, "m").replace(/[^YMm\s]/g, (match) => `${match}\``);
4843
4861
  };
4844
- var TextMaskAdapter9 = React32.forwardRef(
4845
- function TextMaskAdapter10(props, ref) {
4862
+ var TextMaskAdapter7 = React32.forwardRef(
4863
+ function TextMaskAdapter8(props, ref) {
4846
4864
  const { onChange, format, ...other } = props;
4847
4865
  return /* @__PURE__ */ React32.createElement(
4848
- IMaskInput4,
4866
+ IMaskInput3,
4849
4867
  {
4850
4868
  ...other,
4851
4869
  inputRef: ref,
4852
4870
  onAccept: (value) => onChange({ target: { name: props.name, value } }),
4853
4871
  mask: Date,
4854
- pattern: formatToPattern4(format),
4872
+ pattern: formatToPattern3(format),
4855
4873
  blocks: {
4856
4874
  m: {
4857
- mask: IMask4.MaskedRange,
4875
+ mask: IMask3.MaskedRange,
4858
4876
  from: 1,
4859
4877
  to: 12,
4860
4878
  maxLength: 2
4861
4879
  },
4862
4880
  Y: {
4863
- mask: IMask4.MaskedRange,
4881
+ mask: IMask3.MaskedRange,
4864
4882
  from: 1900,
4865
4883
  to: 9999
4866
4884
  }
@@ -4952,7 +4970,7 @@ var MonthRangePicker = forwardRef10(
4952
4970
  required,
4953
4971
  placeholder: `${format} - ${format}`,
4954
4972
  slotProps: {
4955
- input: { component: TextMaskAdapter9, ref: innerRef, format }
4973
+ input: { component: TextMaskAdapter7, ref: innerRef, format }
4956
4974
  },
4957
4975
  error,
4958
4976
  className,
@@ -5166,8 +5184,8 @@ var padDecimal = (value, decimalScale) => {
5166
5184
  const [integer, decimal = ""] = `${value}`.split(".");
5167
5185
  return Number(`${integer}${decimal.padEnd(decimalScale, "0")}`);
5168
5186
  };
5169
- var TextMaskAdapter11 = React36.forwardRef(
5170
- function TextMaskAdapter12(props, ref) {
5187
+ var TextMaskAdapter9 = React36.forwardRef(
5188
+ function TextMaskAdapter10(props, ref) {
5171
5189
  const { onChange, min, max, ...innerProps } = props;
5172
5190
  return /* @__PURE__ */ React36.createElement(
5173
5191
  NumericFormat2,
@@ -5263,7 +5281,7 @@ var PercentageInput = React36.forwardRef(function PercentageInput2(inProps, ref)
5263
5281
  helperText,
5264
5282
  slotProps: {
5265
5283
  input: {
5266
- component: TextMaskAdapter11,
5284
+ component: TextMaskAdapter9,
5267
5285
  "aria-label": innerProps["aria-label"],
5268
5286
  decimalScale: maxDecimalScale
5269
5287
  }