odaptos_design_system 2.0.323 → 2.0.325
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/index.cjs +141 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +145 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -63,6 +63,8 @@ let __mui_x_date_pickers = require("@mui/x-date-pickers");
|
|
|
63
63
|
__mui_x_date_pickers = __toESM(__mui_x_date_pickers);
|
|
64
64
|
let __mui_x_date_pickers_DatePicker = require("@mui/x-date-pickers/DatePicker");
|
|
65
65
|
__mui_x_date_pickers_DatePicker = __toESM(__mui_x_date_pickers_DatePicker);
|
|
66
|
+
let date_fns = require("date-fns");
|
|
67
|
+
date_fns = __toESM(date_fns);
|
|
66
68
|
let __mui_x_date_pickers_DesktopDateTimePicker = require("@mui/x-date-pickers/DesktopDateTimePicker");
|
|
67
69
|
__mui_x_date_pickers_DesktopDateTimePicker = __toESM(__mui_x_date_pickers_DesktopDateTimePicker);
|
|
68
70
|
let __mui_material_Modal = require("@mui/material/Modal");
|
|
@@ -15679,13 +15681,13 @@ const CssTextField$11 = (0, __mui_material_styles.styled)(__mui_material.TextFie
|
|
|
15679
15681
|
}
|
|
15680
15682
|
}
|
|
15681
15683
|
});
|
|
15682
|
-
const NumberInput = ({ className, inputCode, inputNumber, isValid, userValue, setUserValue, setIsValid, maxElement, placeholder,...props$1 }) => {
|
|
15684
|
+
const NumberInput = ({ className, inputCode, inputNumber, isValid: isValid$1, userValue, setUserValue, setIsValid, maxElement, placeholder,...props$1 }) => {
|
|
15683
15685
|
const [value, setValue] = (0, react.useState)("");
|
|
15684
15686
|
return /* @__PURE__ */ react.default.createElement(CssTextField$11, {
|
|
15685
15687
|
value,
|
|
15686
15688
|
onKeyDown: (event) => {
|
|
15687
15689
|
if (event.key === "Backspace") {
|
|
15688
|
-
let newValidity = [...isValid];
|
|
15690
|
+
let newValidity = [...isValid$1];
|
|
15689
15691
|
setValue("");
|
|
15690
15692
|
let newUserValue = [...userValue];
|
|
15691
15693
|
newUserValue[inputNumber] = "";
|
|
@@ -15693,7 +15695,7 @@ const NumberInput = ({ className, inputCode, inputNumber, isValid, userValue, se
|
|
|
15693
15695
|
setIsValid([...newValidity]);
|
|
15694
15696
|
}
|
|
15695
15697
|
if (Number(event.key) || Number(event.key) === 0) {
|
|
15696
|
-
let newValidity = [...isValid];
|
|
15698
|
+
let newValidity = [...isValid$1];
|
|
15697
15699
|
setValue(event.key);
|
|
15698
15700
|
newValidity[inputNumber] = event.key === inputCode;
|
|
15699
15701
|
let newUserValue = [...userValue];
|
|
@@ -15713,13 +15715,13 @@ const NumberInput = ({ className, inputCode, inputNumber, isValid, userValue, se
|
|
|
15713
15715
|
});
|
|
15714
15716
|
};
|
|
15715
15717
|
/** Figma link : https://www.figma.com/file/fjnhhbL12HvKccPmJchVnr/Atomic-Library?type=design&node-id=131-253&mode=dev */
|
|
15716
|
-
const NumbersCode = ({ className, code, userValue, setUserValue, isValid, setIsValid, containerClassname, placeholder = "_", number = 6 }) => {
|
|
15718
|
+
const NumbersCode = ({ className, code, userValue, setUserValue, isValid: isValid$1, setIsValid, containerClassname, placeholder = "_", number = 6 }) => {
|
|
15717
15719
|
const children = [];
|
|
15718
15720
|
for (let i = 0; i < number; i += 1) children.push(/* @__PURE__ */ react.default.createElement(NumberInput, {
|
|
15719
15721
|
userValue,
|
|
15720
15722
|
setUserValue,
|
|
15721
15723
|
setIsValid,
|
|
15722
|
-
isValid,
|
|
15724
|
+
isValid: isValid$1,
|
|
15723
15725
|
inputCode: code ? code.charAt(i) : "",
|
|
15724
15726
|
className,
|
|
15725
15727
|
inputNumber: i,
|
|
@@ -73106,12 +73108,142 @@ style_inject_es_default(css_248z$19);
|
|
|
73106
73108
|
|
|
73107
73109
|
//#endregion
|
|
73108
73110
|
//#region src/Organisms/DatePicker/DatePicker.tsx
|
|
73109
|
-
const DatePicker = ({ className, label, topLabel, topLabelWeight, topLabelSize, value, format, disabled, disableFuture, disablePast, loading, locale = "enUS", maxDate, minDate, required, error, errorText, helperText, views = [
|
|
73111
|
+
const DatePicker = ({ className, label, topLabel, topLabelWeight, topLabelSize, value, format = "dd/MM/yyyy", disabled, disableFuture, disablePast, loading, locale = "enUS", maxDate, minDate, required, error, errorText, helperText, views = [
|
|
73110
73112
|
"day",
|
|
73111
73113
|
"month",
|
|
73112
73114
|
"year"
|
|
73113
|
-
], renderLoading, onChange, onBlur }) => {
|
|
73114
|
-
|
|
73115
|
+
], renderLoading, onChange, onBlur, isMobile }) => {
|
|
73116
|
+
const [inputValue, setInputValue] = react.default.useState(() => {
|
|
73117
|
+
if (value && value instanceof Date && (0, date_fns.isValid)(value)) return (0, date_fns.format)(value, format);
|
|
73118
|
+
return "";
|
|
73119
|
+
});
|
|
73120
|
+
const formatInputValue = (value$1, dateFormat) => {
|
|
73121
|
+
const limitedNumbers = value$1.replace(/\D/g, "").slice(0, 8);
|
|
73122
|
+
const separator = (dateFormat.match(/[^dMy]/g) || [])[0] || "/";
|
|
73123
|
+
const formatParts = dateFormat.split(/[^dMy]/);
|
|
73124
|
+
const positions = [];
|
|
73125
|
+
let currentPos = 0;
|
|
73126
|
+
for (let i = 0; i < formatParts.length - 1; i++) {
|
|
73127
|
+
currentPos += formatParts[i].length;
|
|
73128
|
+
positions.push(currentPos);
|
|
73129
|
+
}
|
|
73130
|
+
let formatted = limitedNumbers;
|
|
73131
|
+
for (let i = positions.length - 1; i >= 0; i--) {
|
|
73132
|
+
const pos = positions[i];
|
|
73133
|
+
if (limitedNumbers.length > pos) formatted = limitedNumbers.slice(0, pos) + separator + limitedNumbers.slice(pos);
|
|
73134
|
+
}
|
|
73135
|
+
return formatted;
|
|
73136
|
+
};
|
|
73137
|
+
const handleInputChange = (event) => {
|
|
73138
|
+
const rawValue = event.target.value;
|
|
73139
|
+
const formattedValue = formatInputValue(rawValue, format);
|
|
73140
|
+
setInputValue(formattedValue);
|
|
73141
|
+
try {
|
|
73142
|
+
const parsedDate = (0, date_fns.parse)(formattedValue, format, /* @__PURE__ */ new Date());
|
|
73143
|
+
if ((0, date_fns.isValid)(parsedDate)) onChange?.(parsedDate);
|
|
73144
|
+
else if (formattedValue === "") onChange?.(null);
|
|
73145
|
+
} catch (error$1) {}
|
|
73146
|
+
};
|
|
73147
|
+
react.default.useEffect(() => {
|
|
73148
|
+
if (value && value instanceof Date && (0, date_fns.isValid)(value)) setInputValue((0, date_fns.format)(value, format));
|
|
73149
|
+
else setInputValue("");
|
|
73150
|
+
}, [value, format]);
|
|
73151
|
+
return /* @__PURE__ */ react.default.createElement("div", { style: { width: "100%" } }, isMobile ? /* @__PURE__ */ react.default.createElement("div", { className: `${DatePicker_modules_default.date_picker} ${className ? className : void 0}` }, topLabel && /* @__PURE__ */ react.default.createElement(Text, {
|
|
73152
|
+
text: `${topLabel ? topLabel : ""}`,
|
|
73153
|
+
weight: topLabelWeight || "bold",
|
|
73154
|
+
size: topLabelSize || "base",
|
|
73155
|
+
className: DatePicker_modules_default.input_top_label,
|
|
73156
|
+
required
|
|
73157
|
+
}), /* @__PURE__ */ react.default.createElement(__mui_material.TextField, {
|
|
73158
|
+
label: topLabel === void 0 ? label : "",
|
|
73159
|
+
value: inputValue,
|
|
73160
|
+
onChange: handleInputChange,
|
|
73161
|
+
onBlur,
|
|
73162
|
+
disabled,
|
|
73163
|
+
required,
|
|
73164
|
+
error,
|
|
73165
|
+
fullWidth: true,
|
|
73166
|
+
placeholder: format?.toUpperCase(),
|
|
73167
|
+
inputProps: {
|
|
73168
|
+
autoComplete: "off",
|
|
73169
|
+
inputMode: "text"
|
|
73170
|
+
},
|
|
73171
|
+
InputLabelProps: {
|
|
73172
|
+
required,
|
|
73173
|
+
sx: { "& .MuiFormLabel-asterisk": { color: "#F54C4C" } }
|
|
73174
|
+
},
|
|
73175
|
+
sx: {
|
|
73176
|
+
width: "100%",
|
|
73177
|
+
"& .MuiFormControl-root": { width: "100%" },
|
|
73178
|
+
"& .MuiTextField-root": { width: "100%" },
|
|
73179
|
+
"& .MuiInputBase-root": { width: "100%" },
|
|
73180
|
+
"& .MuiInputBase-input": {
|
|
73181
|
+
color: "#26292E",
|
|
73182
|
+
fontFamily: "Open Sans !important",
|
|
73183
|
+
fontSize: "1rem"
|
|
73184
|
+
},
|
|
73185
|
+
"& .MuiInputBase-input.Mui-disabled": {
|
|
73186
|
+
color: "#26292E",
|
|
73187
|
+
fontFamily: "Open Sans !important",
|
|
73188
|
+
fontSize: "1rem"
|
|
73189
|
+
},
|
|
73190
|
+
"& .MuiInputBase-input.MuiOutlinedInput-input.Mui-disabled": { WebkitTextFillColor: colors.neutral_600 },
|
|
73191
|
+
"& .Mui-error": { color: "#26292E" },
|
|
73192
|
+
"& .MuiFormHelperText-root": { color: "#F54C4C" },
|
|
73193
|
+
"& .MuiFormLabel-asterisk": { color: "#F54C4C" },
|
|
73194
|
+
"& .MuiOutlinedInput-root.Mui-disabled": {
|
|
73195
|
+
cursor: "not-allowed",
|
|
73196
|
+
color: "#26292E",
|
|
73197
|
+
"& fieldset": { borderColor: "#BCBDBE" },
|
|
73198
|
+
"&:hover fieldset": { borderColor: "#BCBDBE" }
|
|
73199
|
+
},
|
|
73200
|
+
"& label": {
|
|
73201
|
+
color: "#26292E",
|
|
73202
|
+
fontFamily: "Open Sans !important",
|
|
73203
|
+
fontSize: "1rem",
|
|
73204
|
+
transform: inputValue ? "translate(14px, -9px) scale(0.75)" : "translate(14px, 10px) scale(1)",
|
|
73205
|
+
transformOrigin: "top left",
|
|
73206
|
+
transition: "transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms"
|
|
73207
|
+
},
|
|
73208
|
+
"& label.Mui-disabled.Mui-error": {
|
|
73209
|
+
color: "#26292E",
|
|
73210
|
+
opacity: .5,
|
|
73211
|
+
fontFamily: "Open Sans !important",
|
|
73212
|
+
fontSize: "1rem"
|
|
73213
|
+
},
|
|
73214
|
+
"& label.Mui-focused": {
|
|
73215
|
+
color: "#26292E",
|
|
73216
|
+
fontFamily: "Open Sans",
|
|
73217
|
+
fontSize: "1rem",
|
|
73218
|
+
backgroundColor: "transparent",
|
|
73219
|
+
marginRight: 5,
|
|
73220
|
+
paddingRight: 5,
|
|
73221
|
+
transform: "translate(14px, -9px) scale(0.75)",
|
|
73222
|
+
transformOrigin: "top left"
|
|
73223
|
+
},
|
|
73224
|
+
"& .MuiOutlinedInput-root": {
|
|
73225
|
+
fontFamily: "Open Sans",
|
|
73226
|
+
"& fieldset": { borderColor: "#96989A" },
|
|
73227
|
+
"& input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button": { display: "none" },
|
|
73228
|
+
"& input[type=number]": { MozAppearance: "textfield" },
|
|
73229
|
+
"&:hover fieldset": { borderColor: "#0077FF" },
|
|
73230
|
+
"&.Mui-focused fieldset": { borderColor: "#0077FF" },
|
|
73231
|
+
"&.Mui-error fieldset": { borderColor: "#F54C4C" },
|
|
73232
|
+
"&.Mui-disabled .Mui-focused fieldset": { borderColor: "rgba(0, 119, 255, 0.5)" }
|
|
73233
|
+
}
|
|
73234
|
+
}
|
|
73235
|
+
}), error && errorText && /* @__PURE__ */ react.default.createElement(Text, {
|
|
73236
|
+
size: "xs",
|
|
73237
|
+
color: "#F54C4C",
|
|
73238
|
+
italic: true,
|
|
73239
|
+
text: errorText,
|
|
73240
|
+
className: DatePicker_modules_default.text_below
|
|
73241
|
+
}), helperText && /* @__PURE__ */ react.default.createElement(Text, {
|
|
73242
|
+
size: "xs",
|
|
73243
|
+
italic: true,
|
|
73244
|
+
text: helperText,
|
|
73245
|
+
className: DatePicker_modules_default.text_below
|
|
73246
|
+
})) : /* @__PURE__ */ react.default.createElement(__mui_x_date_pickers.LocalizationProvider, {
|
|
73115
73247
|
dateAdapter: __mui_x_date_pickers_AdapterDateFnsV3.AdapterDateFns,
|
|
73116
73248
|
adapterLocale: locale === "enUS" ? date_fns_locale_en_US.enUS : locale === "fr" ? date_fns_locale_fr.fr : locale === "it" ? date_fns_locale_it.it : locale === "de" ? date_fns_locale_de.de : locale === "es" ? date_fns_locale_es.es : date_fns_locale_en_US.enUS
|
|
73117
73249
|
}, /* @__PURE__ */ react.default.createElement("div", { className: `${DatePicker_modules_default.date_picker} ${className ? className : void 0}` }, topLabel && /* @__PURE__ */ react.default.createElement(Text, {
|
|
@@ -73125,11 +73257,7 @@ const DatePicker = ({ className, label, topLabel, topLabelWeight, topLabelSize,
|
|
|
73125
73257
|
value,
|
|
73126
73258
|
views,
|
|
73127
73259
|
format,
|
|
73128
|
-
|
|
73129
|
-
slots: {
|
|
73130
|
-
openPickerIcon: () => null,
|
|
73131
|
-
clearIcon: () => null
|
|
73132
|
-
},
|
|
73260
|
+
slots: { clearIcon: () => null },
|
|
73133
73261
|
slotProps: { textField: {
|
|
73134
73262
|
label: topLabel === void 0 ? label : "",
|
|
73135
73263
|
required,
|