odaptos_design_system 2.0.325 → 2.0.326
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 +13 -141
- 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 +18 -145
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -63,8 +63,6 @@ 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);
|
|
68
66
|
let __mui_x_date_pickers_DesktopDateTimePicker = require("@mui/x-date-pickers/DesktopDateTimePicker");
|
|
69
67
|
__mui_x_date_pickers_DesktopDateTimePicker = __toESM(__mui_x_date_pickers_DesktopDateTimePicker);
|
|
70
68
|
let __mui_material_Modal = require("@mui/material/Modal");
|
|
@@ -15681,13 +15679,13 @@ const CssTextField$11 = (0, __mui_material_styles.styled)(__mui_material.TextFie
|
|
|
15681
15679
|
}
|
|
15682
15680
|
}
|
|
15683
15681
|
});
|
|
15684
|
-
const NumberInput = ({ className, inputCode, inputNumber, isValid
|
|
15682
|
+
const NumberInput = ({ className, inputCode, inputNumber, isValid, userValue, setUserValue, setIsValid, maxElement, placeholder,...props$1 }) => {
|
|
15685
15683
|
const [value, setValue] = (0, react.useState)("");
|
|
15686
15684
|
return /* @__PURE__ */ react.default.createElement(CssTextField$11, {
|
|
15687
15685
|
value,
|
|
15688
15686
|
onKeyDown: (event) => {
|
|
15689
15687
|
if (event.key === "Backspace") {
|
|
15690
|
-
let newValidity = [...isValid
|
|
15688
|
+
let newValidity = [...isValid];
|
|
15691
15689
|
setValue("");
|
|
15692
15690
|
let newUserValue = [...userValue];
|
|
15693
15691
|
newUserValue[inputNumber] = "";
|
|
@@ -15695,7 +15693,7 @@ const NumberInput = ({ className, inputCode, inputNumber, isValid: isValid$1, us
|
|
|
15695
15693
|
setIsValid([...newValidity]);
|
|
15696
15694
|
}
|
|
15697
15695
|
if (Number(event.key) || Number(event.key) === 0) {
|
|
15698
|
-
let newValidity = [...isValid
|
|
15696
|
+
let newValidity = [...isValid];
|
|
15699
15697
|
setValue(event.key);
|
|
15700
15698
|
newValidity[inputNumber] = event.key === inputCode;
|
|
15701
15699
|
let newUserValue = [...userValue];
|
|
@@ -15715,13 +15713,13 @@ const NumberInput = ({ className, inputCode, inputNumber, isValid: isValid$1, us
|
|
|
15715
15713
|
});
|
|
15716
15714
|
};
|
|
15717
15715
|
/** Figma link : https://www.figma.com/file/fjnhhbL12HvKccPmJchVnr/Atomic-Library?type=design&node-id=131-253&mode=dev */
|
|
15718
|
-
const NumbersCode = ({ className, code, userValue, setUserValue, isValid
|
|
15716
|
+
const NumbersCode = ({ className, code, userValue, setUserValue, isValid, setIsValid, containerClassname, placeholder = "_", number = 6 }) => {
|
|
15719
15717
|
const children = [];
|
|
15720
15718
|
for (let i = 0; i < number; i += 1) children.push(/* @__PURE__ */ react.default.createElement(NumberInput, {
|
|
15721
15719
|
userValue,
|
|
15722
15720
|
setUserValue,
|
|
15723
15721
|
setIsValid,
|
|
15724
|
-
isValid
|
|
15722
|
+
isValid,
|
|
15725
15723
|
inputCode: code ? code.charAt(i) : "",
|
|
15726
15724
|
className,
|
|
15727
15725
|
inputNumber: i,
|
|
@@ -73108,142 +73106,12 @@ style_inject_es_default(css_248z$19);
|
|
|
73108
73106
|
|
|
73109
73107
|
//#endregion
|
|
73110
73108
|
//#region src/Organisms/DatePicker/DatePicker.tsx
|
|
73111
|
-
const DatePicker = ({ className, label, topLabel, topLabelWeight, topLabelSize, value,
|
|
73109
|
+
const DatePicker = ({ className, label, topLabel, topLabelWeight, topLabelSize, value, openTo = "day", format, disabled, disableFuture, disablePast, loading, locale = "enUS", maxDate, minDate, required, error, errorText, helperText, views = [
|
|
73112
73110
|
"day",
|
|
73113
73111
|
"month",
|
|
73114
73112
|
"year"
|
|
73115
73113
|
], renderLoading, onChange, onBlur, isMobile }) => {
|
|
73116
|
-
|
|
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, {
|
|
73114
|
+
return /* @__PURE__ */ react.default.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ react.default.createElement(__mui_x_date_pickers.LocalizationProvider, {
|
|
73247
73115
|
dateAdapter: __mui_x_date_pickers_AdapterDateFnsV3.AdapterDateFns,
|
|
73248
73116
|
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
|
|
73249
73117
|
}, /* @__PURE__ */ react.default.createElement("div", { className: `${DatePicker_modules_default.date_picker} ${className ? className : void 0}` }, topLabel && /* @__PURE__ */ react.default.createElement(Text, {
|
|
@@ -73257,13 +73125,17 @@ const DatePicker = ({ className, label, topLabel, topLabelWeight, topLabelSize,
|
|
|
73257
73125
|
value,
|
|
73258
73126
|
views,
|
|
73259
73127
|
format,
|
|
73260
|
-
|
|
73128
|
+
openTo,
|
|
73129
|
+
slots: {
|
|
73130
|
+
openPickerIcon: isMobile ? () => /* @__PURE__ */ react.default.createElement(AgendaIcon, { fill: disabled ? colors.neutral_500 : colors.black }) : () => null,
|
|
73131
|
+
clearIcon: isMobile ? () => /* @__PURE__ */ react.default.createElement(RemoveCircledIcon, { fill: disabled ? colors.neutral_500 : colors.black }) : () => null
|
|
73132
|
+
},
|
|
73261
73133
|
slotProps: { textField: {
|
|
73262
73134
|
label: topLabel === void 0 ? label : "",
|
|
73263
73135
|
required,
|
|
73264
73136
|
onBlur,
|
|
73265
73137
|
fullWidth: true,
|
|
73266
|
-
InputProps: { endAdornment:
|
|
73138
|
+
...!isMobile ? { InputProps: { endAdornment: void 0 } } : {},
|
|
73267
73139
|
InputLabelProps: {
|
|
73268
73140
|
required,
|
|
73269
73141
|
sx: { "& .MuiFormLabel-asterisk": { color: "#F54C4C" } }
|