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