arengibook 2.4.41 → 2.4.44
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.js +43 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12770,7 +12770,7 @@ function styleInject(css, ref) {
|
|
|
12770
12770
|
var css_248z = "/* Force une largeur à 100% de l'input Calendar */\n.datepicker-fullwidth {\n width: 100%;\n}\n\n.datepicker-fullwidth > .p-calendar {\n width: 100%;\n}\n\n.datepickerbook .p-datepicker-calendar th {\n text-align: center !important;\n}\n\n/* Neutralise les styles hérités */\n.datepickerbook table,\n.datepickerbook tbody,\n.datepickerbook tr,\n.datepickerbook td,\n.datepickerbook th {\n background-color: unset !important;\n color: inherit !important;\n border: none;\n}\n\n/* Restaure les couleurs et l'entete du calendrier */\n.datepickerbook .p-datepicker {\n background-color: #fff !important;\n color: #333 !important;\n border-radius: 6px;\n box-shadow: 0 0 8px rgba(0,0,0,0.1);\n}\n\n.datepickerbook .p-datepicker-calendar td {\n text-align: center;\n background-color: transparent !important;\n color: #333;\n}\n\n.datepickerbook .p-datepicker-calendar td.p-highlight {\n background-color: #6366f1 !important;\n color: #fff !important;\n}\n\n.datepickerbook .p-datepicker-calendar th {\n text-align: center !important;\n color: #000;\n}\n\nbody .p-datepicker {\n width: 405px !important;\n min-width: 405px !important;\n max-width: 405px !important;\n}\n\n\n";
|
|
12771
12771
|
styleInject(css_248z);
|
|
12772
12772
|
|
|
12773
|
-
var _excluded$3 = ["value", "onChange", "placeholder", "dateFormat", "view", "invalid", "errorMessage", "disabled", "locale", "showTime", "showIcon", "icon", "iconBgButton", "iconPos", "name", "id", "fullWidth", "inputProps"];
|
|
12773
|
+
var _excluded$3 = ["value", "onChange", "placeholder", "dateFormat", "view", "invalid", "errorMessage", "disabled", "locale", "showTime", "showIcon", "icon", "iconBgButton", "iconPos", "name", "id", "fullWidth", "inputProps", "onBlur", "onSelect", "onClick"];
|
|
12774
12774
|
var normalizeDate = function normalizeDate(v) {
|
|
12775
12775
|
if (!v) return null;
|
|
12776
12776
|
return v instanceof Date ? v : new Date(v);
|
|
@@ -12811,7 +12811,10 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
12811
12811
|
_ref$fullWidth = _ref.fullWidth,
|
|
12812
12812
|
fullWidth = _ref$fullWidth === void 0 ? true : _ref$fullWidth,
|
|
12813
12813
|
_ref$inputProps = _ref.inputProps,
|
|
12814
|
-
inputProps = _ref$inputProps === void 0 ? {} : _ref$inputProps
|
|
12814
|
+
inputProps = _ref$inputProps === void 0 ? {} : _ref$inputProps,
|
|
12815
|
+
onBlur = _ref.onBlur,
|
|
12816
|
+
onSelect = _ref.onSelect,
|
|
12817
|
+
onClick = _ref.onClick;
|
|
12815
12818
|
_objectWithoutProperties$1(_ref, _excluded$3);
|
|
12816
12819
|
var _useState = useState(function () {
|
|
12817
12820
|
return normalizeDate(value);
|
|
@@ -12846,14 +12849,41 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
12846
12849
|
borderRadius: '6px'
|
|
12847
12850
|
};
|
|
12848
12851
|
var localLanguage = locale !== null && locale !== void 0 ? locale : 'fr';
|
|
12852
|
+
|
|
12853
|
+
// const handleChange = (e) => {
|
|
12854
|
+
// const newDate = e.value;
|
|
12855
|
+
// setValeur(newDate);
|
|
12856
|
+
// if (onChange) {
|
|
12857
|
+
// onChange({ value: newDate });
|
|
12858
|
+
// }
|
|
12859
|
+
//
|
|
12860
|
+
// if (inputRef.current) {
|
|
12861
|
+
// const event = new Event('datePickerChange', { bubbles: true });
|
|
12862
|
+
// inputRef.current.dispatchEvent(event);
|
|
12863
|
+
// }
|
|
12864
|
+
//
|
|
12865
|
+
// };
|
|
12866
|
+
|
|
12849
12867
|
var handleChange = function handleChange(e) {
|
|
12850
12868
|
var newDate = e.value;
|
|
12851
12869
|
setValeur(newDate);
|
|
12870
|
+
|
|
12871
|
+
// 1. onChange standard (Storybook usage)
|
|
12852
12872
|
if (onChange) {
|
|
12853
12873
|
onChange({
|
|
12854
12874
|
value: newDate
|
|
12855
12875
|
});
|
|
12856
12876
|
}
|
|
12877
|
+
|
|
12878
|
+
// 2. onSelect custom (simule react-datepicker)
|
|
12879
|
+
if (onSelect) {
|
|
12880
|
+
var syntheticEvent = e.originalEvent || new Event('select', {
|
|
12881
|
+
bubbles: true
|
|
12882
|
+
});
|
|
12883
|
+
onSelect(newDate, syntheticEvent);
|
|
12884
|
+
}
|
|
12885
|
+
|
|
12886
|
+
// 3. DOM event natif
|
|
12857
12887
|
if (inputRef.current) {
|
|
12858
12888
|
var event = new Event('datePickerChange', {
|
|
12859
12889
|
bubbles: true
|
|
@@ -12861,6 +12891,11 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
12861
12891
|
inputRef.current.dispatchEvent(event);
|
|
12862
12892
|
}
|
|
12863
12893
|
};
|
|
12894
|
+
var handleBlur = function handleBlur(e) {
|
|
12895
|
+
if (onBlur) {
|
|
12896
|
+
onBlur(e);
|
|
12897
|
+
}
|
|
12898
|
+
};
|
|
12864
12899
|
useEffect(function () {
|
|
12865
12900
|
if (inputRef.current) {
|
|
12866
12901
|
// Créer et déclencher un événement personnalisé
|
|
@@ -12889,7 +12924,10 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
12889
12924
|
inputId: id,
|
|
12890
12925
|
name: name,
|
|
12891
12926
|
ref: inputRef,
|
|
12892
|
-
panelClassName: "datepickerbook"
|
|
12927
|
+
panelClassName: "datepickerbook",
|
|
12928
|
+
onBlur: handleBlur,
|
|
12929
|
+
onClick: onClick,
|
|
12930
|
+
onSelect: onSelect
|
|
12893
12931
|
}), invalid && /*#__PURE__*/React__default.createElement("small", {
|
|
12894
12932
|
style: {
|
|
12895
12933
|
color: 'red',
|
|
@@ -12907,14 +12945,12 @@ var DatePickerPresets = {
|
|
|
12907
12945
|
MonthOnly: {
|
|
12908
12946
|
placeholder: 'Choisissez un mois',
|
|
12909
12947
|
dateFormat: 'mm/yy',
|
|
12910
|
-
view: 'month'
|
|
12911
|
-
iconBgButton: '#6366f1'
|
|
12948
|
+
view: 'month'
|
|
12912
12949
|
},
|
|
12913
12950
|
YearOnly: {
|
|
12914
12951
|
placeholder: 'Choisissez une année',
|
|
12915
12952
|
dateFormat: 'yy',
|
|
12916
|
-
view: 'year'
|
|
12917
|
-
iconBgButton: '#6366f1'
|
|
12953
|
+
view: 'year'
|
|
12918
12954
|
},
|
|
12919
12955
|
Invalid: {
|
|
12920
12956
|
placeholder: 'Date non valide',
|