@ceed/ads 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 +39 -39
- 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
|
@@ -4976,6 +4976,7 @@ MenuButton.displayName = "MenuButton";
|
|
|
4976
4976
|
|
|
4977
4977
|
// src/components/MonthPicker/MonthPicker.tsx
|
|
4978
4978
|
var import_react33 = __toESM(require("react"));
|
|
4979
|
+
var import_react_imask3 = require("react-imask");
|
|
4979
4980
|
var import_CalendarToday3 = __toESM(require("@mui/icons-material/CalendarToday"));
|
|
4980
4981
|
var import_joy46 = require("@mui/joy");
|
|
4981
4982
|
var import_base4 = require("@mui/base");
|
|
@@ -5001,38 +5002,60 @@ var MonthPickerRoot = (0, import_joy46.styled)("div", {
|
|
|
5001
5002
|
})({
|
|
5002
5003
|
width: "100%"
|
|
5003
5004
|
});
|
|
5004
|
-
function getMonthName2(date) {
|
|
5005
|
-
return new Intl.DateTimeFormat("en-US", { month: "long" }).format(date);
|
|
5006
|
-
}
|
|
5007
5005
|
var formatValueString3 = (date, format) => {
|
|
5008
|
-
|
|
5009
|
-
const
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
return format.replace(/MMMM/g, monthName).replace(/MM/g, month).replace(/DD/g, day).replace(/YYYY/g, year);
|
|
5006
|
+
let month = `${date.getMonth() + 1}`;
|
|
5007
|
+
const year = date.getFullYear();
|
|
5008
|
+
if (Number(month) < 10) month = "0" + month;
|
|
5009
|
+
return format.replace(/YYYY/g, year.toString()).replace(/MM/g, month);
|
|
5013
5010
|
};
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
throw new Error("Invalid date string or format");
|
|
5019
|
-
}
|
|
5011
|
+
var formatToPattern3 = (format) => {
|
|
5012
|
+
return format.replace(/YYYY/g, "Y").replace(/MM/g, "M").replace(/[^YM\s]/g, (match) => `${match}\``);
|
|
5013
|
+
};
|
|
5014
|
+
function parseDate3(dateString) {
|
|
5020
5015
|
let month, year;
|
|
5021
|
-
const
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
case "YYYY":
|
|
5029
|
-
year = value;
|
|
5030
|
-
break;
|
|
5031
|
-
}
|
|
5016
|
+
const cleanDateString = dateString.replace(/[^\d]/g, "");
|
|
5017
|
+
if (dateString.match(/\d{1,2}.\d{4}/)) {
|
|
5018
|
+
month = cleanDateString.slice(0, 2);
|
|
5019
|
+
year = cleanDateString.slice(2);
|
|
5020
|
+
} else if (dateString.match(/\d{4}.\d{1,2}/)) {
|
|
5021
|
+
year = cleanDateString.slice(0, 4);
|
|
5022
|
+
month = cleanDateString.slice(4);
|
|
5032
5023
|
}
|
|
5033
|
-
const
|
|
5034
|
-
return
|
|
5024
|
+
const date = /* @__PURE__ */ new Date(`${year}/${month}`);
|
|
5025
|
+
return date;
|
|
5035
5026
|
}
|
|
5027
|
+
var TextMaskAdapter7 = import_react33.default.forwardRef(
|
|
5028
|
+
function TextMaskAdapter8(props, ref) {
|
|
5029
|
+
const { onChange, format, ...other } = props;
|
|
5030
|
+
return /* @__PURE__ */ import_react33.default.createElement(
|
|
5031
|
+
import_react_imask3.IMaskInput,
|
|
5032
|
+
{
|
|
5033
|
+
...other,
|
|
5034
|
+
inputRef: ref,
|
|
5035
|
+
onAccept: (value) => onChange({ target: { name: props.name, value } }),
|
|
5036
|
+
mask: Date,
|
|
5037
|
+
pattern: formatToPattern3(format),
|
|
5038
|
+
blocks: {
|
|
5039
|
+
M: {
|
|
5040
|
+
mask: import_react_imask3.IMask.MaskedRange,
|
|
5041
|
+
from: 1,
|
|
5042
|
+
to: 12,
|
|
5043
|
+
maxLength: 2
|
|
5044
|
+
},
|
|
5045
|
+
Y: {
|
|
5046
|
+
mask: import_react_imask3.IMask.MaskedRange,
|
|
5047
|
+
from: 1900,
|
|
5048
|
+
to: 9999
|
|
5049
|
+
}
|
|
5050
|
+
},
|
|
5051
|
+
format: (date) => formatValueString3(date, format),
|
|
5052
|
+
parse: parseDate3,
|
|
5053
|
+
autofix: "pad",
|
|
5054
|
+
overwrite: true
|
|
5055
|
+
}
|
|
5056
|
+
);
|
|
5057
|
+
}
|
|
5058
|
+
);
|
|
5036
5059
|
var MonthPicker = (0, import_react33.forwardRef)(
|
|
5037
5060
|
(inProps, ref) => {
|
|
5038
5061
|
const props = (0, import_joy46.useThemeProps)({ props: inProps, name: "MonthPicker" });
|
|
@@ -5050,13 +5073,11 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
5050
5073
|
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
5051
5074
|
sx,
|
|
5052
5075
|
className,
|
|
5053
|
-
format = "YYYY/MM
|
|
5054
|
-
displayFormat = "YYYY/MM",
|
|
5076
|
+
format = "YYYY/MM",
|
|
5055
5077
|
size,
|
|
5056
5078
|
...innerProps
|
|
5057
5079
|
} = props;
|
|
5058
5080
|
const innerRef = (0, import_react33.useRef)(null);
|
|
5059
|
-
const buttonRef = (0, import_react33.useRef)(null);
|
|
5060
5081
|
const [value, setValue] = useControlledState(
|
|
5061
5082
|
props.value,
|
|
5062
5083
|
props.defaultValue || "",
|
|
@@ -5066,9 +5087,6 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
5066
5087
|
),
|
|
5067
5088
|
{ disableStrict: true }
|
|
5068
5089
|
);
|
|
5069
|
-
const [displayValue, setDisplayValue] = (0, import_react33.useState)(
|
|
5070
|
-
() => value ? formatValueString3(parseDate3(value, format), displayFormat) : ""
|
|
5071
|
-
);
|
|
5072
5090
|
const [anchorEl, setAnchorEl] = (0, import_react33.useState)(null);
|
|
5073
5091
|
const open = Boolean(anchorEl);
|
|
5074
5092
|
(0, import_react33.useEffect)(() => {
|
|
@@ -5079,26 +5097,11 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
5079
5097
|
(0, import_react33.useImperativeHandle)(ref, () => innerRef.current, [
|
|
5080
5098
|
innerRef
|
|
5081
5099
|
]);
|
|
5082
|
-
(0, import_react33.useEffect)(() => {
|
|
5083
|
-
if (value === "") {
|
|
5084
|
-
setDisplayValue("");
|
|
5085
|
-
return;
|
|
5086
|
-
}
|
|
5087
|
-
const formattedValue = formatValueString3(
|
|
5088
|
-
parseDate3(value, format),
|
|
5089
|
-
displayFormat
|
|
5090
|
-
);
|
|
5091
|
-
setDisplayValue(formattedValue);
|
|
5092
|
-
}, [displayFormat, format, value]);
|
|
5093
5100
|
const handleChange = (0, import_react33.useCallback)(
|
|
5094
5101
|
(event) => {
|
|
5095
|
-
|
|
5096
|
-
setDisplayValue(
|
|
5097
|
-
value2 ? formatValueString3(parseDate3(value2, format), displayFormat) : value2
|
|
5098
|
-
);
|
|
5099
|
-
setValue(value2);
|
|
5102
|
+
setValue(event.target.value);
|
|
5100
5103
|
},
|
|
5101
|
-
[
|
|
5104
|
+
[setValue]
|
|
5102
5105
|
);
|
|
5103
5106
|
const handleCalendarToggle = (0, import_react33.useCallback)(
|
|
5104
5107
|
(event) => {
|
|
@@ -5107,13 +5110,6 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
5107
5110
|
},
|
|
5108
5111
|
[anchorEl, setAnchorEl, innerRef]
|
|
5109
5112
|
);
|
|
5110
|
-
const handleInputMouseDown = (0, import_react33.useCallback)(
|
|
5111
|
-
(event) => {
|
|
5112
|
-
event.preventDefault();
|
|
5113
|
-
buttonRef.current?.focus();
|
|
5114
|
-
},
|
|
5115
|
-
[buttonRef]
|
|
5116
|
-
);
|
|
5117
5113
|
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(
|
|
5118
5114
|
Input_default,
|
|
5119
5115
|
{
|
|
@@ -5121,21 +5117,13 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
5121
5117
|
color: error ? "danger" : innerProps.color,
|
|
5122
5118
|
ref: innerRef,
|
|
5123
5119
|
size,
|
|
5124
|
-
value
|
|
5125
|
-
|
|
5120
|
+
value,
|
|
5121
|
+
onChange: handleChange,
|
|
5122
|
+
placeholder: format,
|
|
5126
5123
|
disabled,
|
|
5127
5124
|
required,
|
|
5128
5125
|
slotProps: {
|
|
5129
|
-
input: {
|
|
5130
|
-
ref: innerRef,
|
|
5131
|
-
format: displayFormat,
|
|
5132
|
-
sx: {
|
|
5133
|
-
"&:hover": {
|
|
5134
|
-
cursor: "default"
|
|
5135
|
-
}
|
|
5136
|
-
},
|
|
5137
|
-
onMouseDown: handleInputMouseDown
|
|
5138
|
-
}
|
|
5126
|
+
input: { component: TextMaskAdapter7, ref: innerRef, format }
|
|
5139
5127
|
},
|
|
5140
5128
|
error,
|
|
5141
5129
|
className,
|
|
@@ -5152,8 +5140,7 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
5152
5140
|
"aria-label": "Toggle Calendar",
|
|
5153
5141
|
"aria-controls": "month-picker-popper",
|
|
5154
5142
|
"aria-haspopup": "dialog",
|
|
5155
|
-
"aria-expanded": open
|
|
5156
|
-
disabled
|
|
5143
|
+
"aria-expanded": open
|
|
5157
5144
|
},
|
|
5158
5145
|
/* @__PURE__ */ import_react33.default.createElement(import_CalendarToday3.default, null)
|
|
5159
5146
|
),
|
|
@@ -5231,7 +5218,7 @@ var MonthPicker = (0, import_react33.forwardRef)(
|
|
|
5231
5218
|
|
|
5232
5219
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
5233
5220
|
var import_react34 = __toESM(require("react"));
|
|
5234
|
-
var
|
|
5221
|
+
var import_react_imask4 = require("react-imask");
|
|
5235
5222
|
var import_CalendarToday4 = __toESM(require("@mui/icons-material/CalendarToday"));
|
|
5236
5223
|
var import_joy47 = require("@mui/joy");
|
|
5237
5224
|
var import_base5 = require("@mui/base");
|
|
@@ -5285,29 +5272,29 @@ var parseDates2 = (str) => {
|
|
|
5285
5272
|
const date2 = str.split(" - ")[1] || "";
|
|
5286
5273
|
return [parseDate4(date1), parseDate4(date2)];
|
|
5287
5274
|
};
|
|
5288
|
-
var
|
|
5275
|
+
var formatToPattern4 = (format) => {
|
|
5289
5276
|
return `${format} - ${format}`.replace(/YYYY/g, "Y").replace(/MM/g, "m").replace(/[^YMm\s]/g, (match) => `${match}\``);
|
|
5290
5277
|
};
|
|
5291
|
-
var
|
|
5292
|
-
function
|
|
5278
|
+
var TextMaskAdapter9 = import_react34.default.forwardRef(
|
|
5279
|
+
function TextMaskAdapter10(props, ref) {
|
|
5293
5280
|
const { onChange, format, ...other } = props;
|
|
5294
5281
|
return /* @__PURE__ */ import_react34.default.createElement(
|
|
5295
|
-
|
|
5282
|
+
import_react_imask4.IMaskInput,
|
|
5296
5283
|
{
|
|
5297
5284
|
...other,
|
|
5298
5285
|
inputRef: ref,
|
|
5299
5286
|
onAccept: (value) => onChange({ target: { name: props.name, value } }),
|
|
5300
5287
|
mask: Date,
|
|
5301
|
-
pattern:
|
|
5288
|
+
pattern: formatToPattern4(format),
|
|
5302
5289
|
blocks: {
|
|
5303
5290
|
m: {
|
|
5304
|
-
mask:
|
|
5291
|
+
mask: import_react_imask4.IMask.MaskedRange,
|
|
5305
5292
|
from: 1,
|
|
5306
5293
|
to: 12,
|
|
5307
5294
|
maxLength: 2
|
|
5308
5295
|
},
|
|
5309
5296
|
Y: {
|
|
5310
|
-
mask:
|
|
5297
|
+
mask: import_react_imask4.IMask.MaskedRange,
|
|
5311
5298
|
from: 1900,
|
|
5312
5299
|
to: 9999
|
|
5313
5300
|
}
|
|
@@ -5399,7 +5386,7 @@ var MonthRangePicker = (0, import_react34.forwardRef)(
|
|
|
5399
5386
|
required,
|
|
5400
5387
|
placeholder: `${format} - ${format}`,
|
|
5401
5388
|
slotProps: {
|
|
5402
|
-
input: { component:
|
|
5389
|
+
input: { component: TextMaskAdapter9, ref: innerRef, format }
|
|
5403
5390
|
},
|
|
5404
5391
|
error,
|
|
5405
5392
|
className,
|
|
@@ -5600,8 +5587,8 @@ var padDecimal = (value, decimalScale) => {
|
|
|
5600
5587
|
const [integer, decimal = ""] = `${value}`.split(".");
|
|
5601
5588
|
return Number(`${integer}${decimal.padEnd(decimalScale, "0")}`);
|
|
5602
5589
|
};
|
|
5603
|
-
var
|
|
5604
|
-
function
|
|
5590
|
+
var TextMaskAdapter11 = import_react38.default.forwardRef(
|
|
5591
|
+
function TextMaskAdapter12(props, ref) {
|
|
5605
5592
|
const { onChange, min, max, ...innerProps } = props;
|
|
5606
5593
|
return /* @__PURE__ */ import_react38.default.createElement(
|
|
5607
5594
|
import_react_number_format2.NumericFormat,
|
|
@@ -5697,7 +5684,7 @@ var PercentageInput = import_react38.default.forwardRef(function PercentageInput
|
|
|
5697
5684
|
helperText,
|
|
5698
5685
|
slotProps: {
|
|
5699
5686
|
input: {
|
|
5700
|
-
component:
|
|
5687
|
+
component: TextMaskAdapter11,
|
|
5701
5688
|
"aria-label": innerProps["aria-label"],
|
|
5702
5689
|
decimalScale: maxDecimalScale
|
|
5703
5690
|
}
|
package/dist/index.js
CHANGED
|
@@ -4963,6 +4963,7 @@ import React31, {
|
|
|
4963
4963
|
useRef as useRef7,
|
|
4964
4964
|
useState as useState10
|
|
4965
4965
|
} from "react";
|
|
4966
|
+
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
4966
4967
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
4967
4968
|
import { styled as styled20, useThemeProps as useThemeProps6 } from "@mui/joy";
|
|
4968
4969
|
import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper4 } from "@mui/base";
|
|
@@ -4988,38 +4989,60 @@ var MonthPickerRoot = styled20("div", {
|
|
|
4988
4989
|
})({
|
|
4989
4990
|
width: "100%"
|
|
4990
4991
|
});
|
|
4991
|
-
function getMonthName2(date) {
|
|
4992
|
-
return new Intl.DateTimeFormat("en-US", { month: "long" }).format(date);
|
|
4993
|
-
}
|
|
4994
4992
|
var formatValueString3 = (date, format) => {
|
|
4995
|
-
|
|
4996
|
-
const
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
return format.replace(/MMMM/g, monthName).replace(/MM/g, month).replace(/DD/g, day).replace(/YYYY/g, year);
|
|
4993
|
+
let month = `${date.getMonth() + 1}`;
|
|
4994
|
+
const year = date.getFullYear();
|
|
4995
|
+
if (Number(month) < 10) month = "0" + month;
|
|
4996
|
+
return format.replace(/YYYY/g, year.toString()).replace(/MM/g, month);
|
|
5000
4997
|
};
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
throw new Error("Invalid date string or format");
|
|
5006
|
-
}
|
|
4998
|
+
var formatToPattern3 = (format) => {
|
|
4999
|
+
return format.replace(/YYYY/g, "Y").replace(/MM/g, "M").replace(/[^YM\s]/g, (match) => `${match}\``);
|
|
5000
|
+
};
|
|
5001
|
+
function parseDate3(dateString) {
|
|
5007
5002
|
let month, year;
|
|
5008
|
-
const
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
case "YYYY":
|
|
5016
|
-
year = value;
|
|
5017
|
-
break;
|
|
5018
|
-
}
|
|
5003
|
+
const cleanDateString = dateString.replace(/[^\d]/g, "");
|
|
5004
|
+
if (dateString.match(/\d{1,2}.\d{4}/)) {
|
|
5005
|
+
month = cleanDateString.slice(0, 2);
|
|
5006
|
+
year = cleanDateString.slice(2);
|
|
5007
|
+
} else if (dateString.match(/\d{4}.\d{1,2}/)) {
|
|
5008
|
+
year = cleanDateString.slice(0, 4);
|
|
5009
|
+
month = cleanDateString.slice(4);
|
|
5019
5010
|
}
|
|
5020
|
-
const
|
|
5021
|
-
return
|
|
5011
|
+
const date = /* @__PURE__ */ new Date(`${year}/${month}`);
|
|
5012
|
+
return date;
|
|
5022
5013
|
}
|
|
5014
|
+
var TextMaskAdapter7 = React31.forwardRef(
|
|
5015
|
+
function TextMaskAdapter8(props, ref) {
|
|
5016
|
+
const { onChange, format, ...other } = props;
|
|
5017
|
+
return /* @__PURE__ */ React31.createElement(
|
|
5018
|
+
IMaskInput3,
|
|
5019
|
+
{
|
|
5020
|
+
...other,
|
|
5021
|
+
inputRef: ref,
|
|
5022
|
+
onAccept: (value) => onChange({ target: { name: props.name, value } }),
|
|
5023
|
+
mask: Date,
|
|
5024
|
+
pattern: formatToPattern3(format),
|
|
5025
|
+
blocks: {
|
|
5026
|
+
M: {
|
|
5027
|
+
mask: IMask3.MaskedRange,
|
|
5028
|
+
from: 1,
|
|
5029
|
+
to: 12,
|
|
5030
|
+
maxLength: 2
|
|
5031
|
+
},
|
|
5032
|
+
Y: {
|
|
5033
|
+
mask: IMask3.MaskedRange,
|
|
5034
|
+
from: 1900,
|
|
5035
|
+
to: 9999
|
|
5036
|
+
}
|
|
5037
|
+
},
|
|
5038
|
+
format: (date) => formatValueString3(date, format),
|
|
5039
|
+
parse: parseDate3,
|
|
5040
|
+
autofix: "pad",
|
|
5041
|
+
overwrite: true
|
|
5042
|
+
}
|
|
5043
|
+
);
|
|
5044
|
+
}
|
|
5045
|
+
);
|
|
5023
5046
|
var MonthPicker = forwardRef9(
|
|
5024
5047
|
(inProps, ref) => {
|
|
5025
5048
|
const props = useThemeProps6({ props: inProps, name: "MonthPicker" });
|
|
@@ -5037,13 +5060,11 @@ var MonthPicker = forwardRef9(
|
|
|
5037
5060
|
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
5038
5061
|
sx,
|
|
5039
5062
|
className,
|
|
5040
|
-
format = "YYYY/MM
|
|
5041
|
-
displayFormat = "YYYY/MM",
|
|
5063
|
+
format = "YYYY/MM",
|
|
5042
5064
|
size,
|
|
5043
5065
|
...innerProps
|
|
5044
5066
|
} = props;
|
|
5045
5067
|
const innerRef = useRef7(null);
|
|
5046
|
-
const buttonRef = useRef7(null);
|
|
5047
5068
|
const [value, setValue] = useControlledState(
|
|
5048
5069
|
props.value,
|
|
5049
5070
|
props.defaultValue || "",
|
|
@@ -5053,9 +5074,6 @@ var MonthPicker = forwardRef9(
|
|
|
5053
5074
|
),
|
|
5054
5075
|
{ disableStrict: true }
|
|
5055
5076
|
);
|
|
5056
|
-
const [displayValue, setDisplayValue] = useState10(
|
|
5057
|
-
() => value ? formatValueString3(parseDate3(value, format), displayFormat) : ""
|
|
5058
|
-
);
|
|
5059
5077
|
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5060
5078
|
const open = Boolean(anchorEl);
|
|
5061
5079
|
useEffect9(() => {
|
|
@@ -5066,26 +5084,11 @@ var MonthPicker = forwardRef9(
|
|
|
5066
5084
|
useImperativeHandle4(ref, () => innerRef.current, [
|
|
5067
5085
|
innerRef
|
|
5068
5086
|
]);
|
|
5069
|
-
useEffect9(() => {
|
|
5070
|
-
if (value === "") {
|
|
5071
|
-
setDisplayValue("");
|
|
5072
|
-
return;
|
|
5073
|
-
}
|
|
5074
|
-
const formattedValue = formatValueString3(
|
|
5075
|
-
parseDate3(value, format),
|
|
5076
|
-
displayFormat
|
|
5077
|
-
);
|
|
5078
|
-
setDisplayValue(formattedValue);
|
|
5079
|
-
}, [displayFormat, format, value]);
|
|
5080
5087
|
const handleChange = useCallback12(
|
|
5081
5088
|
(event) => {
|
|
5082
|
-
|
|
5083
|
-
setDisplayValue(
|
|
5084
|
-
value2 ? formatValueString3(parseDate3(value2, format), displayFormat) : value2
|
|
5085
|
-
);
|
|
5086
|
-
setValue(value2);
|
|
5089
|
+
setValue(event.target.value);
|
|
5087
5090
|
},
|
|
5088
|
-
[
|
|
5091
|
+
[setValue]
|
|
5089
5092
|
);
|
|
5090
5093
|
const handleCalendarToggle = useCallback12(
|
|
5091
5094
|
(event) => {
|
|
@@ -5094,13 +5097,6 @@ var MonthPicker = forwardRef9(
|
|
|
5094
5097
|
},
|
|
5095
5098
|
[anchorEl, setAnchorEl, innerRef]
|
|
5096
5099
|
);
|
|
5097
|
-
const handleInputMouseDown = useCallback12(
|
|
5098
|
-
(event) => {
|
|
5099
|
-
event.preventDefault();
|
|
5100
|
-
buttonRef.current?.focus();
|
|
5101
|
-
},
|
|
5102
|
-
[buttonRef]
|
|
5103
|
-
);
|
|
5104
5100
|
return /* @__PURE__ */ React31.createElement(MonthPickerRoot, null, /* @__PURE__ */ React31.createElement(FocusTrap3, { open: true }, /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(
|
|
5105
5101
|
Input_default,
|
|
5106
5102
|
{
|
|
@@ -5108,21 +5104,13 @@ var MonthPicker = forwardRef9(
|
|
|
5108
5104
|
color: error ? "danger" : innerProps.color,
|
|
5109
5105
|
ref: innerRef,
|
|
5110
5106
|
size,
|
|
5111
|
-
value
|
|
5112
|
-
|
|
5107
|
+
value,
|
|
5108
|
+
onChange: handleChange,
|
|
5109
|
+
placeholder: format,
|
|
5113
5110
|
disabled,
|
|
5114
5111
|
required,
|
|
5115
5112
|
slotProps: {
|
|
5116
|
-
input: {
|
|
5117
|
-
ref: innerRef,
|
|
5118
|
-
format: displayFormat,
|
|
5119
|
-
sx: {
|
|
5120
|
-
"&:hover": {
|
|
5121
|
-
cursor: "default"
|
|
5122
|
-
}
|
|
5123
|
-
},
|
|
5124
|
-
onMouseDown: handleInputMouseDown
|
|
5125
|
-
}
|
|
5113
|
+
input: { component: TextMaskAdapter7, ref: innerRef, format }
|
|
5126
5114
|
},
|
|
5127
5115
|
error,
|
|
5128
5116
|
className,
|
|
@@ -5139,8 +5127,7 @@ var MonthPicker = forwardRef9(
|
|
|
5139
5127
|
"aria-label": "Toggle Calendar",
|
|
5140
5128
|
"aria-controls": "month-picker-popper",
|
|
5141
5129
|
"aria-haspopup": "dialog",
|
|
5142
|
-
"aria-expanded": open
|
|
5143
|
-
disabled
|
|
5130
|
+
"aria-expanded": open
|
|
5144
5131
|
},
|
|
5145
5132
|
/* @__PURE__ */ React31.createElement(CalendarTodayIcon3, null)
|
|
5146
5133
|
),
|
|
@@ -5226,7 +5213,7 @@ import React32, {
|
|
|
5226
5213
|
useRef as useRef8,
|
|
5227
5214
|
useState as useState11
|
|
5228
5215
|
} from "react";
|
|
5229
|
-
import { IMaskInput as
|
|
5216
|
+
import { IMaskInput as IMaskInput4, IMask as IMask4 } from "react-imask";
|
|
5230
5217
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
5231
5218
|
import { styled as styled21, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
5232
5219
|
import { FocusTrap as FocusTrap4, ClickAwayListener as ClickAwayListener4, Popper as Popper5 } from "@mui/base";
|
|
@@ -5280,29 +5267,29 @@ var parseDates2 = (str) => {
|
|
|
5280
5267
|
const date2 = str.split(" - ")[1] || "";
|
|
5281
5268
|
return [parseDate4(date1), parseDate4(date2)];
|
|
5282
5269
|
};
|
|
5283
|
-
var
|
|
5270
|
+
var formatToPattern4 = (format) => {
|
|
5284
5271
|
return `${format} - ${format}`.replace(/YYYY/g, "Y").replace(/MM/g, "m").replace(/[^YMm\s]/g, (match) => `${match}\``);
|
|
5285
5272
|
};
|
|
5286
|
-
var
|
|
5287
|
-
function
|
|
5273
|
+
var TextMaskAdapter9 = React32.forwardRef(
|
|
5274
|
+
function TextMaskAdapter10(props, ref) {
|
|
5288
5275
|
const { onChange, format, ...other } = props;
|
|
5289
5276
|
return /* @__PURE__ */ React32.createElement(
|
|
5290
|
-
|
|
5277
|
+
IMaskInput4,
|
|
5291
5278
|
{
|
|
5292
5279
|
...other,
|
|
5293
5280
|
inputRef: ref,
|
|
5294
5281
|
onAccept: (value) => onChange({ target: { name: props.name, value } }),
|
|
5295
5282
|
mask: Date,
|
|
5296
|
-
pattern:
|
|
5283
|
+
pattern: formatToPattern4(format),
|
|
5297
5284
|
blocks: {
|
|
5298
5285
|
m: {
|
|
5299
|
-
mask:
|
|
5286
|
+
mask: IMask4.MaskedRange,
|
|
5300
5287
|
from: 1,
|
|
5301
5288
|
to: 12,
|
|
5302
5289
|
maxLength: 2
|
|
5303
5290
|
},
|
|
5304
5291
|
Y: {
|
|
5305
|
-
mask:
|
|
5292
|
+
mask: IMask4.MaskedRange,
|
|
5306
5293
|
from: 1900,
|
|
5307
5294
|
to: 9999
|
|
5308
5295
|
}
|
|
@@ -5394,7 +5381,7 @@ var MonthRangePicker = forwardRef10(
|
|
|
5394
5381
|
required,
|
|
5395
5382
|
placeholder: `${format} - ${format}`,
|
|
5396
5383
|
slotProps: {
|
|
5397
|
-
input: { component:
|
|
5384
|
+
input: { component: TextMaskAdapter9, ref: innerRef, format }
|
|
5398
5385
|
},
|
|
5399
5386
|
error,
|
|
5400
5387
|
className,
|
|
@@ -5608,8 +5595,8 @@ var padDecimal = (value, decimalScale) => {
|
|
|
5608
5595
|
const [integer, decimal = ""] = `${value}`.split(".");
|
|
5609
5596
|
return Number(`${integer}${decimal.padEnd(decimalScale, "0")}`);
|
|
5610
5597
|
};
|
|
5611
|
-
var
|
|
5612
|
-
function
|
|
5598
|
+
var TextMaskAdapter11 = React36.forwardRef(
|
|
5599
|
+
function TextMaskAdapter12(props, ref) {
|
|
5613
5600
|
const { onChange, min, max, ...innerProps } = props;
|
|
5614
5601
|
return /* @__PURE__ */ React36.createElement(
|
|
5615
5602
|
NumericFormat2,
|
|
@@ -5705,7 +5692,7 @@ var PercentageInput = React36.forwardRef(function PercentageInput2(inProps, ref)
|
|
|
5705
5692
|
helperText,
|
|
5706
5693
|
slotProps: {
|
|
5707
5694
|
input: {
|
|
5708
|
-
component:
|
|
5695
|
+
component: TextMaskAdapter11,
|
|
5709
5696
|
"aria-label": innerProps["aria-label"],
|
|
5710
5697
|
decimalScale: maxDecimalScale
|
|
5711
5698
|
}
|