@ceed/cds 1.5.4-next.2 → 1.5.4
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/components/MonthPicker/MonthPicker.d.ts +0 -1
- package/dist/index.cjs +70 -83
- package/dist/index.js +70 -83
- package/framer/index.js +37 -37
- package/package.json +2 -3
|
@@ -20,7 +20,6 @@ interface BaseMonthPickerProps {
|
|
|
20
20
|
disableFuture?: boolean;
|
|
21
21
|
disablePast?: boolean;
|
|
22
22
|
format?: string;
|
|
23
|
-
displayFormat?: string;
|
|
24
23
|
}
|
|
25
24
|
export type MonthPickerProps = BaseMonthPickerProps & Omit<React.ComponentProps<typeof Input>, "onChange" | "value" | "defaultValue">;
|
|
26
25
|
declare const MonthPicker: React.ForwardRefExoticComponent<Omit<MonthPickerProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
package/dist/index.cjs
CHANGED
|
@@ -4538,6 +4538,7 @@ 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");
|
|
4541
4542
|
var import_CalendarToday3 = __toESM(require("@mui/icons-material/CalendarToday"));
|
|
4542
4543
|
var import_joy46 = require("@mui/joy");
|
|
4543
4544
|
var import_base4 = require("@mui/base");
|
|
@@ -4563,38 +4564,60 @@ var MonthPickerRoot = (0, import_joy46.styled)("div", {
|
|
|
4563
4564
|
})({
|
|
4564
4565
|
width: "100%"
|
|
4565
4566
|
});
|
|
4566
|
-
function getMonthName2(date) {
|
|
4567
|
-
return new Intl.DateTimeFormat("en-US", { month: "long" }).format(date);
|
|
4568
|
-
}
|
|
4569
4567
|
var formatValueString3 = (date, format) => {
|
|
4570
|
-
|
|
4571
|
-
const
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
return format.replace(/MMMM/g, monthName).replace(/MM/g, month).replace(/DD/g, day).replace(/YYYY/g, year);
|
|
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);
|
|
4575
4572
|
};
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
throw new Error("Invalid date string or format");
|
|
4581
|
-
}
|
|
4573
|
+
var formatToPattern3 = (format) => {
|
|
4574
|
+
return format.replace(/YYYY/g, "Y").replace(/MM/g, "M").replace(/[^YM\s]/g, (match) => `${match}\``);
|
|
4575
|
+
};
|
|
4576
|
+
function parseDate3(dateString) {
|
|
4582
4577
|
let month, year;
|
|
4583
|
-
const
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
case "YYYY":
|
|
4591
|
-
year = value;
|
|
4592
|
-
break;
|
|
4593
|
-
}
|
|
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);
|
|
4594
4585
|
}
|
|
4595
|
-
const
|
|
4596
|
-
return
|
|
4586
|
+
const date = /* @__PURE__ */ new Date(`${year}/${month}`);
|
|
4587
|
+
return date;
|
|
4597
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
|
+
);
|
|
4619
|
+
}
|
|
4620
|
+
);
|
|
4598
4621
|
var MonthPicker = (0, import_react33.forwardRef)(
|
|
4599
4622
|
(inProps, ref) => {
|
|
4600
4623
|
const props = (0, import_joy46.useThemeProps)({ props: inProps, name: "MonthPicker" });
|
|
@@ -4612,13 +4635,11 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
4612
4635
|
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
4613
4636
|
sx,
|
|
4614
4637
|
className,
|
|
4615
|
-
format = "YYYY/MM
|
|
4616
|
-
displayFormat = "YYYY/MM",
|
|
4638
|
+
format = "YYYY/MM",
|
|
4617
4639
|
size,
|
|
4618
4640
|
...innerProps
|
|
4619
4641
|
} = props;
|
|
4620
4642
|
const innerRef = (0, import_react33.useRef)(null);
|
|
4621
|
-
const buttonRef = (0, import_react33.useRef)(null);
|
|
4622
4643
|
const [value, setValue] = useControlledState(
|
|
4623
4644
|
props.value,
|
|
4624
4645
|
props.defaultValue || "",
|
|
@@ -4628,9 +4649,6 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
4628
4649
|
),
|
|
4629
4650
|
{ disableStrict: true }
|
|
4630
4651
|
);
|
|
4631
|
-
const [displayValue, setDisplayValue] = (0, import_react33.useState)(
|
|
4632
|
-
() => value ? formatValueString3(parseDate3(value, format), displayFormat) : ""
|
|
4633
|
-
);
|
|
4634
4652
|
const [anchorEl, setAnchorEl] = (0, import_react33.useState)(null);
|
|
4635
4653
|
const open = Boolean(anchorEl);
|
|
4636
4654
|
(0, import_react33.useEffect)(() => {
|
|
@@ -4641,26 +4659,11 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
4641
4659
|
(0, import_react33.useImperativeHandle)(ref, () => innerRef.current, [
|
|
4642
4660
|
innerRef
|
|
4643
4661
|
]);
|
|
4644
|
-
(0, import_react33.useEffect)(() => {
|
|
4645
|
-
if (value === "") {
|
|
4646
|
-
setDisplayValue("");
|
|
4647
|
-
return;
|
|
4648
|
-
}
|
|
4649
|
-
const formattedValue = formatValueString3(
|
|
4650
|
-
parseDate3(value, format),
|
|
4651
|
-
displayFormat
|
|
4652
|
-
);
|
|
4653
|
-
setDisplayValue(formattedValue);
|
|
4654
|
-
}, [displayFormat, format, value]);
|
|
4655
4662
|
const handleChange = (0, import_react33.useCallback)(
|
|
4656
4663
|
(event) => {
|
|
4657
|
-
|
|
4658
|
-
setDisplayValue(
|
|
4659
|
-
value2 ? formatValueString3(parseDate3(value2, format), displayFormat) : value2
|
|
4660
|
-
);
|
|
4661
|
-
setValue(value2);
|
|
4664
|
+
setValue(event.target.value);
|
|
4662
4665
|
},
|
|
4663
|
-
[
|
|
4666
|
+
[setValue]
|
|
4664
4667
|
);
|
|
4665
4668
|
const handleCalendarToggle = (0, import_react33.useCallback)(
|
|
4666
4669
|
(event) => {
|
|
@@ -4669,13 +4672,6 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
4669
4672
|
},
|
|
4670
4673
|
[anchorEl, setAnchorEl, innerRef]
|
|
4671
4674
|
);
|
|
4672
|
-
const handleInputMouseDown = (0, import_react33.useCallback)(
|
|
4673
|
-
(event) => {
|
|
4674
|
-
event.preventDefault();
|
|
4675
|
-
buttonRef.current?.focus();
|
|
4676
|
-
},
|
|
4677
|
-
[buttonRef]
|
|
4678
|
-
);
|
|
4679
4675
|
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(
|
|
4680
4676
|
Input_default,
|
|
4681
4677
|
{
|
|
@@ -4683,21 +4679,13 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
4683
4679
|
color: error ? "danger" : innerProps.color,
|
|
4684
4680
|
ref: innerRef,
|
|
4685
4681
|
size,
|
|
4686
|
-
value
|
|
4687
|
-
|
|
4682
|
+
value,
|
|
4683
|
+
onChange: handleChange,
|
|
4684
|
+
placeholder: format,
|
|
4688
4685
|
disabled,
|
|
4689
4686
|
required,
|
|
4690
4687
|
slotProps: {
|
|
4691
|
-
input: {
|
|
4692
|
-
ref: innerRef,
|
|
4693
|
-
format: displayFormat,
|
|
4694
|
-
sx: {
|
|
4695
|
-
"&:hover": {
|
|
4696
|
-
cursor: "default"
|
|
4697
|
-
}
|
|
4698
|
-
},
|
|
4699
|
-
onMouseDown: handleInputMouseDown
|
|
4700
|
-
}
|
|
4688
|
+
input: { component: TextMaskAdapter7, ref: innerRef, format }
|
|
4701
4689
|
},
|
|
4702
4690
|
error,
|
|
4703
4691
|
className,
|
|
@@ -4714,8 +4702,7 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
4714
4702
|
"aria-label": "Toggle Calendar",
|
|
4715
4703
|
"aria-controls": "month-picker-popper",
|
|
4716
4704
|
"aria-haspopup": "dialog",
|
|
4717
|
-
"aria-expanded": open
|
|
4718
|
-
disabled
|
|
4705
|
+
"aria-expanded": open
|
|
4719
4706
|
},
|
|
4720
4707
|
/* @__PURE__ */ import_react33.default.createElement(import_CalendarToday3.default, null)
|
|
4721
4708
|
),
|
|
@@ -4793,7 +4780,7 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
4793
4780
|
|
|
4794
4781
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
4795
4782
|
var import_react34 = __toESM(require("react"));
|
|
4796
|
-
var
|
|
4783
|
+
var import_react_imask4 = require("react-imask");
|
|
4797
4784
|
var import_CalendarToday4 = __toESM(require("@mui/icons-material/CalendarToday"));
|
|
4798
4785
|
var import_joy47 = require("@mui/joy");
|
|
4799
4786
|
var import_base5 = require("@mui/base");
|
|
@@ -4847,29 +4834,29 @@ var parseDates2 = (str) => {
|
|
|
4847
4834
|
const date2 = str.split(" - ")[1] || "";
|
|
4848
4835
|
return [parseDate4(date1), parseDate4(date2)];
|
|
4849
4836
|
};
|
|
4850
|
-
var
|
|
4837
|
+
var formatToPattern4 = (format) => {
|
|
4851
4838
|
return `${format} - ${format}`.replace(/YYYY/g, "Y").replace(/MM/g, "m").replace(/[^YMm\s]/g, (match) => `${match}\``);
|
|
4852
4839
|
};
|
|
4853
|
-
var
|
|
4854
|
-
function
|
|
4840
|
+
var TextMaskAdapter9 = import_react34.default.forwardRef(
|
|
4841
|
+
function TextMaskAdapter10(props, ref) {
|
|
4855
4842
|
const { onChange, format, ...other } = props;
|
|
4856
4843
|
return /* @__PURE__ */ import_react34.default.createElement(
|
|
4857
|
-
|
|
4844
|
+
import_react_imask4.IMaskInput,
|
|
4858
4845
|
{
|
|
4859
4846
|
...other,
|
|
4860
4847
|
inputRef: ref,
|
|
4861
4848
|
onAccept: (value) => onChange({ target: { name: props.name, value } }),
|
|
4862
4849
|
mask: Date,
|
|
4863
|
-
pattern:
|
|
4850
|
+
pattern: formatToPattern4(format),
|
|
4864
4851
|
blocks: {
|
|
4865
4852
|
m: {
|
|
4866
|
-
mask:
|
|
4853
|
+
mask: import_react_imask4.IMask.MaskedRange,
|
|
4867
4854
|
from: 1,
|
|
4868
4855
|
to: 12,
|
|
4869
4856
|
maxLength: 2
|
|
4870
4857
|
},
|
|
4871
4858
|
Y: {
|
|
4872
|
-
mask:
|
|
4859
|
+
mask: import_react_imask4.IMask.MaskedRange,
|
|
4873
4860
|
from: 1900,
|
|
4874
4861
|
to: 9999
|
|
4875
4862
|
}
|
|
@@ -4961,7 +4948,7 @@ var MonthRangePicker = (0, import_react34.forwardRef)(
|
|
|
4961
4948
|
required,
|
|
4962
4949
|
placeholder: `${format} - ${format}`,
|
|
4963
4950
|
slotProps: {
|
|
4964
|
-
input: { component:
|
|
4951
|
+
input: { component: TextMaskAdapter9, ref: innerRef, format }
|
|
4965
4952
|
},
|
|
4966
4953
|
error,
|
|
4967
4954
|
className,
|
|
@@ -5162,8 +5149,8 @@ var padDecimal = (value, decimalScale) => {
|
|
|
5162
5149
|
const [integer, decimal = ""] = `${value}`.split(".");
|
|
5163
5150
|
return Number(`${integer}${decimal.padEnd(decimalScale, "0")}`);
|
|
5164
5151
|
};
|
|
5165
|
-
var
|
|
5166
|
-
function
|
|
5152
|
+
var TextMaskAdapter11 = import_react38.default.forwardRef(
|
|
5153
|
+
function TextMaskAdapter12(props, ref) {
|
|
5167
5154
|
const { onChange, min, max, ...innerProps } = props;
|
|
5168
5155
|
return /* @__PURE__ */ import_react38.default.createElement(
|
|
5169
5156
|
import_react_number_format2.NumericFormat,
|
|
@@ -5259,7 +5246,7 @@ var PercentageInput = import_react38.default.forwardRef(function PercentageInput
|
|
|
5259
5246
|
helperText,
|
|
5260
5247
|
slotProps: {
|
|
5261
5248
|
input: {
|
|
5262
|
-
component:
|
|
5249
|
+
component: TextMaskAdapter11,
|
|
5263
5250
|
"aria-label": innerProps["aria-label"],
|
|
5264
5251
|
decimalScale: maxDecimalScale
|
|
5265
5252
|
}
|
package/dist/index.js
CHANGED
|
@@ -4534,6 +4534,7 @@ 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";
|
|
4537
4538
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
4538
4539
|
import { styled as styled20, useThemeProps as useThemeProps6 } from "@mui/joy";
|
|
4539
4540
|
import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper4 } from "@mui/base";
|
|
@@ -4559,38 +4560,60 @@ var MonthPickerRoot = styled20("div", {
|
|
|
4559
4560
|
})({
|
|
4560
4561
|
width: "100%"
|
|
4561
4562
|
});
|
|
4562
|
-
function getMonthName2(date) {
|
|
4563
|
-
return new Intl.DateTimeFormat("en-US", { month: "long" }).format(date);
|
|
4564
|
-
}
|
|
4565
4563
|
var formatValueString3 = (date, format) => {
|
|
4566
|
-
|
|
4567
|
-
const
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
return format.replace(/MMMM/g, monthName).replace(/MM/g, month).replace(/DD/g, day).replace(/YYYY/g, year);
|
|
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);
|
|
4571
4568
|
};
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
throw new Error("Invalid date string or format");
|
|
4577
|
-
}
|
|
4569
|
+
var formatToPattern3 = (format) => {
|
|
4570
|
+
return format.replace(/YYYY/g, "Y").replace(/MM/g, "M").replace(/[^YM\s]/g, (match) => `${match}\``);
|
|
4571
|
+
};
|
|
4572
|
+
function parseDate3(dateString) {
|
|
4578
4573
|
let month, year;
|
|
4579
|
-
const
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
case "YYYY":
|
|
4587
|
-
year = value;
|
|
4588
|
-
break;
|
|
4589
|
-
}
|
|
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);
|
|
4590
4581
|
}
|
|
4591
|
-
const
|
|
4592
|
-
return
|
|
4582
|
+
const date = /* @__PURE__ */ new Date(`${year}/${month}`);
|
|
4583
|
+
return date;
|
|
4593
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
|
+
);
|
|
4615
|
+
}
|
|
4616
|
+
);
|
|
4594
4617
|
var MonthPicker = forwardRef9(
|
|
4595
4618
|
(inProps, ref) => {
|
|
4596
4619
|
const props = useThemeProps6({ props: inProps, name: "MonthPicker" });
|
|
@@ -4608,13 +4631,11 @@ var MonthPicker = forwardRef9(
|
|
|
4608
4631
|
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
4609
4632
|
sx,
|
|
4610
4633
|
className,
|
|
4611
|
-
format = "YYYY/MM
|
|
4612
|
-
displayFormat = "YYYY/MM",
|
|
4634
|
+
format = "YYYY/MM",
|
|
4613
4635
|
size,
|
|
4614
4636
|
...innerProps
|
|
4615
4637
|
} = props;
|
|
4616
4638
|
const innerRef = useRef6(null);
|
|
4617
|
-
const buttonRef = useRef6(null);
|
|
4618
4639
|
const [value, setValue] = useControlledState(
|
|
4619
4640
|
props.value,
|
|
4620
4641
|
props.defaultValue || "",
|
|
@@ -4624,9 +4645,6 @@ var MonthPicker = forwardRef9(
|
|
|
4624
4645
|
),
|
|
4625
4646
|
{ disableStrict: true }
|
|
4626
4647
|
);
|
|
4627
|
-
const [displayValue, setDisplayValue] = useState9(
|
|
4628
|
-
() => value ? formatValueString3(parseDate3(value, format), displayFormat) : ""
|
|
4629
|
-
);
|
|
4630
4648
|
const [anchorEl, setAnchorEl] = useState9(null);
|
|
4631
4649
|
const open = Boolean(anchorEl);
|
|
4632
4650
|
useEffect8(() => {
|
|
@@ -4637,26 +4655,11 @@ var MonthPicker = forwardRef9(
|
|
|
4637
4655
|
useImperativeHandle4(ref, () => innerRef.current, [
|
|
4638
4656
|
innerRef
|
|
4639
4657
|
]);
|
|
4640
|
-
useEffect8(() => {
|
|
4641
|
-
if (value === "") {
|
|
4642
|
-
setDisplayValue("");
|
|
4643
|
-
return;
|
|
4644
|
-
}
|
|
4645
|
-
const formattedValue = formatValueString3(
|
|
4646
|
-
parseDate3(value, format),
|
|
4647
|
-
displayFormat
|
|
4648
|
-
);
|
|
4649
|
-
setDisplayValue(formattedValue);
|
|
4650
|
-
}, [displayFormat, format, value]);
|
|
4651
4658
|
const handleChange = useCallback11(
|
|
4652
4659
|
(event) => {
|
|
4653
|
-
|
|
4654
|
-
setDisplayValue(
|
|
4655
|
-
value2 ? formatValueString3(parseDate3(value2, format), displayFormat) : value2
|
|
4656
|
-
);
|
|
4657
|
-
setValue(value2);
|
|
4660
|
+
setValue(event.target.value);
|
|
4658
4661
|
},
|
|
4659
|
-
[
|
|
4662
|
+
[setValue]
|
|
4660
4663
|
);
|
|
4661
4664
|
const handleCalendarToggle = useCallback11(
|
|
4662
4665
|
(event) => {
|
|
@@ -4665,13 +4668,6 @@ var MonthPicker = forwardRef9(
|
|
|
4665
4668
|
},
|
|
4666
4669
|
[anchorEl, setAnchorEl, innerRef]
|
|
4667
4670
|
);
|
|
4668
|
-
const handleInputMouseDown = useCallback11(
|
|
4669
|
-
(event) => {
|
|
4670
|
-
event.preventDefault();
|
|
4671
|
-
buttonRef.current?.focus();
|
|
4672
|
-
},
|
|
4673
|
-
[buttonRef]
|
|
4674
|
-
);
|
|
4675
4671
|
return /* @__PURE__ */ React31.createElement(MonthPickerRoot, null, /* @__PURE__ */ React31.createElement(FocusTrap3, { open: true }, /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(
|
|
4676
4672
|
Input_default,
|
|
4677
4673
|
{
|
|
@@ -4679,21 +4675,13 @@ var MonthPicker = forwardRef9(
|
|
|
4679
4675
|
color: error ? "danger" : innerProps.color,
|
|
4680
4676
|
ref: innerRef,
|
|
4681
4677
|
size,
|
|
4682
|
-
value
|
|
4683
|
-
|
|
4678
|
+
value,
|
|
4679
|
+
onChange: handleChange,
|
|
4680
|
+
placeholder: format,
|
|
4684
4681
|
disabled,
|
|
4685
4682
|
required,
|
|
4686
4683
|
slotProps: {
|
|
4687
|
-
input: {
|
|
4688
|
-
ref: innerRef,
|
|
4689
|
-
format: displayFormat,
|
|
4690
|
-
sx: {
|
|
4691
|
-
"&:hover": {
|
|
4692
|
-
cursor: "default"
|
|
4693
|
-
}
|
|
4694
|
-
},
|
|
4695
|
-
onMouseDown: handleInputMouseDown
|
|
4696
|
-
}
|
|
4684
|
+
input: { component: TextMaskAdapter7, ref: innerRef, format }
|
|
4697
4685
|
},
|
|
4698
4686
|
error,
|
|
4699
4687
|
className,
|
|
@@ -4710,8 +4698,7 @@ var MonthPicker = forwardRef9(
|
|
|
4710
4698
|
"aria-label": "Toggle Calendar",
|
|
4711
4699
|
"aria-controls": "month-picker-popper",
|
|
4712
4700
|
"aria-haspopup": "dialog",
|
|
4713
|
-
"aria-expanded": open
|
|
4714
|
-
disabled
|
|
4701
|
+
"aria-expanded": open
|
|
4715
4702
|
},
|
|
4716
4703
|
/* @__PURE__ */ React31.createElement(CalendarTodayIcon3, null)
|
|
4717
4704
|
),
|
|
@@ -4797,7 +4784,7 @@ import React32, {
|
|
|
4797
4784
|
useRef as useRef7,
|
|
4798
4785
|
useState as useState10
|
|
4799
4786
|
} from "react";
|
|
4800
|
-
import { IMaskInput as
|
|
4787
|
+
import { IMaskInput as IMaskInput4, IMask as IMask4 } from "react-imask";
|
|
4801
4788
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
4802
4789
|
import { styled as styled21, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
4803
4790
|
import { FocusTrap as FocusTrap4, ClickAwayListener as ClickAwayListener4, Popper as Popper5 } from "@mui/base";
|
|
@@ -4851,29 +4838,29 @@ var parseDates2 = (str) => {
|
|
|
4851
4838
|
const date2 = str.split(" - ")[1] || "";
|
|
4852
4839
|
return [parseDate4(date1), parseDate4(date2)];
|
|
4853
4840
|
};
|
|
4854
|
-
var
|
|
4841
|
+
var formatToPattern4 = (format) => {
|
|
4855
4842
|
return `${format} - ${format}`.replace(/YYYY/g, "Y").replace(/MM/g, "m").replace(/[^YMm\s]/g, (match) => `${match}\``);
|
|
4856
4843
|
};
|
|
4857
|
-
var
|
|
4858
|
-
function
|
|
4844
|
+
var TextMaskAdapter9 = React32.forwardRef(
|
|
4845
|
+
function TextMaskAdapter10(props, ref) {
|
|
4859
4846
|
const { onChange, format, ...other } = props;
|
|
4860
4847
|
return /* @__PURE__ */ React32.createElement(
|
|
4861
|
-
|
|
4848
|
+
IMaskInput4,
|
|
4862
4849
|
{
|
|
4863
4850
|
...other,
|
|
4864
4851
|
inputRef: ref,
|
|
4865
4852
|
onAccept: (value) => onChange({ target: { name: props.name, value } }),
|
|
4866
4853
|
mask: Date,
|
|
4867
|
-
pattern:
|
|
4854
|
+
pattern: formatToPattern4(format),
|
|
4868
4855
|
blocks: {
|
|
4869
4856
|
m: {
|
|
4870
|
-
mask:
|
|
4857
|
+
mask: IMask4.MaskedRange,
|
|
4871
4858
|
from: 1,
|
|
4872
4859
|
to: 12,
|
|
4873
4860
|
maxLength: 2
|
|
4874
4861
|
},
|
|
4875
4862
|
Y: {
|
|
4876
|
-
mask:
|
|
4863
|
+
mask: IMask4.MaskedRange,
|
|
4877
4864
|
from: 1900,
|
|
4878
4865
|
to: 9999
|
|
4879
4866
|
}
|
|
@@ -4965,7 +4952,7 @@ var MonthRangePicker = forwardRef10(
|
|
|
4965
4952
|
required,
|
|
4966
4953
|
placeholder: `${format} - ${format}`,
|
|
4967
4954
|
slotProps: {
|
|
4968
|
-
input: { component:
|
|
4955
|
+
input: { component: TextMaskAdapter9, ref: innerRef, format }
|
|
4969
4956
|
},
|
|
4970
4957
|
error,
|
|
4971
4958
|
className,
|
|
@@ -5179,8 +5166,8 @@ var padDecimal = (value, decimalScale) => {
|
|
|
5179
5166
|
const [integer, decimal = ""] = `${value}`.split(".");
|
|
5180
5167
|
return Number(`${integer}${decimal.padEnd(decimalScale, "0")}`);
|
|
5181
5168
|
};
|
|
5182
|
-
var
|
|
5183
|
-
function
|
|
5169
|
+
var TextMaskAdapter11 = React36.forwardRef(
|
|
5170
|
+
function TextMaskAdapter12(props, ref) {
|
|
5184
5171
|
const { onChange, min, max, ...innerProps } = props;
|
|
5185
5172
|
return /* @__PURE__ */ React36.createElement(
|
|
5186
5173
|
NumericFormat2,
|
|
@@ -5276,7 +5263,7 @@ var PercentageInput = React36.forwardRef(function PercentageInput2(inProps, ref)
|
|
|
5276
5263
|
helperText,
|
|
5277
5264
|
slotProps: {
|
|
5278
5265
|
input: {
|
|
5279
|
-
component:
|
|
5266
|
+
component: TextMaskAdapter11,
|
|
5280
5267
|
"aria-label": innerProps["aria-label"],
|
|
5281
5268
|
decimalScale: maxDecimalScale
|
|
5282
5269
|
}
|