@ikatec/nebula-react 1.0.17 → 1.0.19
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 +31 -18
- package/dist/index.mjs +31 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3717,9 +3717,10 @@ var Calendar = ({
|
|
|
3717
3717
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3718
3718
|
"div",
|
|
3719
3719
|
{
|
|
3720
|
-
className: cn("flex justify-between items-center !h-9
|
|
3720
|
+
className: cn("flex justify-between items-center !h-9", {
|
|
3721
3721
|
"ps-3": numberOfMonths === 1,
|
|
3722
|
-
"mb-0": showMonthGridSelection
|
|
3722
|
+
"mb-0": showMonthGridSelection,
|
|
3723
|
+
"mb-3": !showMonthGridSelection
|
|
3723
3724
|
}),
|
|
3724
3725
|
children: [
|
|
3725
3726
|
!hideNavigation && numberOfMonths > 1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3800,7 +3801,8 @@ var Calendar = ({
|
|
|
3800
3801
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3801
3802
|
Box,
|
|
3802
3803
|
{
|
|
3803
|
-
|
|
3804
|
+
paddingSize: "none",
|
|
3805
|
+
className: "nebula-ds z-40 flex gap-2 flex-col justify-between w-full",
|
|
3804
3806
|
border: false,
|
|
3805
3807
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nebula-ds z-40 grid grid-cols-2 gap-1 bg-inherit pt-2", children: MONTHS.map((monthOption) => {
|
|
3806
3808
|
const monthOptionAsDate = new Date(monthOption);
|
|
@@ -3851,17 +3853,7 @@ var Calendar = ({
|
|
|
3851
3853
|
return /* @__PURE__ */ jsxRuntime.jsx("tr", { ...props2 });
|
|
3852
3854
|
},
|
|
3853
3855
|
Weekday(props2) {
|
|
3854
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3855
|
-
"th",
|
|
3856
|
-
{
|
|
3857
|
-
...props2,
|
|
3858
|
-
className: cn(
|
|
3859
|
-
props2.className,
|
|
3860
|
-
"font-medium text-xs !text-calendar-weekDay-color"
|
|
3861
|
-
),
|
|
3862
|
-
children: String(props2.children)?.toUpperCase()?.[0]
|
|
3863
|
-
}
|
|
3864
|
-
);
|
|
3856
|
+
return /* @__PURE__ */ jsxRuntime.jsx("th", { ...props2, className: cn(props2.className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nebula-ds font-medium text-xs !text-calendar-weekDay-color text-center pb-2", children: String(props2.children)?.toUpperCase()?.[0] }) });
|
|
3865
3857
|
},
|
|
3866
3858
|
Footer(props2) {
|
|
3867
3859
|
if (showMonthGridSelection) return void 0;
|
|
@@ -3925,6 +3917,25 @@ function timeFormatIsValid(timeStr) {
|
|
|
3925
3917
|
const regex = /^(?:[01]\d|2[0-3]):[0-5]\d$/;
|
|
3926
3918
|
return regex.test(timeStr);
|
|
3927
3919
|
}
|
|
3920
|
+
var formatDateToSubmit = (dateStr, timeFallback = "23:59") => {
|
|
3921
|
+
try {
|
|
3922
|
+
if (!dateStr) return;
|
|
3923
|
+
const [date = "", time = timeFallback] = dateStr.split(" ");
|
|
3924
|
+
if (!date) return;
|
|
3925
|
+
const [p1, p2, p3] = date.split("/");
|
|
3926
|
+
const parsedDate = new Date(
|
|
3927
|
+
(() => {
|
|
3928
|
+
if (getNebulaLanguage() === "en-US") {
|
|
3929
|
+
return [p3, p1, p2].join("/") + " " + time;
|
|
3930
|
+
}
|
|
3931
|
+
return [p3, p2, p1].join("/") + " " + time;
|
|
3932
|
+
})().trim()
|
|
3933
|
+
).toString();
|
|
3934
|
+
return dateFns.isValid(new Date(parsedDate)) ? parsedDate : void 0;
|
|
3935
|
+
} catch (error2) {
|
|
3936
|
+
return void 0;
|
|
3937
|
+
}
|
|
3938
|
+
};
|
|
3928
3939
|
var dateIsAvailable = (inputDate, disabledDates) => {
|
|
3929
3940
|
if (!disabledDates || !inputDate) return true;
|
|
3930
3941
|
const dateIsDisabled = (d, matcher) => {
|
|
@@ -3982,10 +3993,11 @@ var InputDatePickerSingle = ({
|
|
|
3982
3993
|
disabledDates,
|
|
3983
3994
|
...rest
|
|
3984
3995
|
}) => {
|
|
3985
|
-
const
|
|
3996
|
+
const formattedDateByLanguage = formatDateToSubmit(value ?? "");
|
|
3986
3997
|
const [innerDate, setInnerDate] = React8.useState(
|
|
3987
|
-
|
|
3998
|
+
formattedDateByLanguage ? new Date(formattedDateByLanguage) : void 0
|
|
3988
3999
|
);
|
|
4000
|
+
const [popoverIsOpen, setPopoverIsOpen] = React8.useState(false);
|
|
3989
4001
|
const { locale } = useNebulaI18n();
|
|
3990
4002
|
const [month, setMonth] = React8.useState(/* @__PURE__ */ new Date());
|
|
3991
4003
|
const handleClearValue = () => {
|
|
@@ -4190,11 +4202,12 @@ var InputDateTimePickerSingle = ({
|
|
|
4190
4202
|
disabledDates,
|
|
4191
4203
|
...rest
|
|
4192
4204
|
}) => {
|
|
4193
|
-
const [popoverIsOpen, setPopoverIsOpen] = React8.useState(false);
|
|
4194
4205
|
const [innerTimeValue, setInnerTimeValue] = React8.useState();
|
|
4206
|
+
const formattedDateByLanguage = formatDateToSubmit(value ?? "");
|
|
4195
4207
|
const [innerDate, setInnerDate] = React8.useState(
|
|
4196
|
-
|
|
4208
|
+
formattedDateByLanguage ? new Date(formattedDateByLanguage) : void 0
|
|
4197
4209
|
);
|
|
4210
|
+
const [popoverIsOpen, setPopoverIsOpen] = React8.useState(false);
|
|
4198
4211
|
const { locale, messages: messages17 } = useNebulaI18n();
|
|
4199
4212
|
const [month, setMonth] = React8.useState(/* @__PURE__ */ new Date());
|
|
4200
4213
|
const inputTimeRef = React8.useRef(null);
|
package/dist/index.mjs
CHANGED
|
@@ -3677,9 +3677,10 @@ var Calendar = ({
|
|
|
3677
3677
|
return /* @__PURE__ */ jsxs(
|
|
3678
3678
|
"div",
|
|
3679
3679
|
{
|
|
3680
|
-
className: cn("flex justify-between items-center !h-9
|
|
3680
|
+
className: cn("flex justify-between items-center !h-9", {
|
|
3681
3681
|
"ps-3": numberOfMonths === 1,
|
|
3682
|
-
"mb-0": showMonthGridSelection
|
|
3682
|
+
"mb-0": showMonthGridSelection,
|
|
3683
|
+
"mb-3": !showMonthGridSelection
|
|
3683
3684
|
}),
|
|
3684
3685
|
children: [
|
|
3685
3686
|
!hideNavigation && numberOfMonths > 1 && /* @__PURE__ */ jsx(
|
|
@@ -3760,7 +3761,8 @@ var Calendar = ({
|
|
|
3760
3761
|
return /* @__PURE__ */ jsx(
|
|
3761
3762
|
Box,
|
|
3762
3763
|
{
|
|
3763
|
-
|
|
3764
|
+
paddingSize: "none",
|
|
3765
|
+
className: "nebula-ds z-40 flex gap-2 flex-col justify-between w-full",
|
|
3764
3766
|
border: false,
|
|
3765
3767
|
children: /* @__PURE__ */ jsx("div", { className: "nebula-ds z-40 grid grid-cols-2 gap-1 bg-inherit pt-2", children: MONTHS.map((monthOption) => {
|
|
3766
3768
|
const monthOptionAsDate = new Date(monthOption);
|
|
@@ -3811,17 +3813,7 @@ var Calendar = ({
|
|
|
3811
3813
|
return /* @__PURE__ */ jsx("tr", { ...props2 });
|
|
3812
3814
|
},
|
|
3813
3815
|
Weekday(props2) {
|
|
3814
|
-
return /* @__PURE__ */ jsx(
|
|
3815
|
-
"th",
|
|
3816
|
-
{
|
|
3817
|
-
...props2,
|
|
3818
|
-
className: cn(
|
|
3819
|
-
props2.className,
|
|
3820
|
-
"font-medium text-xs !text-calendar-weekDay-color"
|
|
3821
|
-
),
|
|
3822
|
-
children: String(props2.children)?.toUpperCase()?.[0]
|
|
3823
|
-
}
|
|
3824
|
-
);
|
|
3816
|
+
return /* @__PURE__ */ jsx("th", { ...props2, className: cn(props2.className), children: /* @__PURE__ */ jsx("div", { className: "nebula-ds font-medium text-xs !text-calendar-weekDay-color text-center pb-2", children: String(props2.children)?.toUpperCase()?.[0] }) });
|
|
3825
3817
|
},
|
|
3826
3818
|
Footer(props2) {
|
|
3827
3819
|
if (showMonthGridSelection) return void 0;
|
|
@@ -3885,6 +3877,25 @@ function timeFormatIsValid(timeStr) {
|
|
|
3885
3877
|
const regex = /^(?:[01]\d|2[0-3]):[0-5]\d$/;
|
|
3886
3878
|
return regex.test(timeStr);
|
|
3887
3879
|
}
|
|
3880
|
+
var formatDateToSubmit = (dateStr, timeFallback = "23:59") => {
|
|
3881
|
+
try {
|
|
3882
|
+
if (!dateStr) return;
|
|
3883
|
+
const [date = "", time = timeFallback] = dateStr.split(" ");
|
|
3884
|
+
if (!date) return;
|
|
3885
|
+
const [p1, p2, p3] = date.split("/");
|
|
3886
|
+
const parsedDate = new Date(
|
|
3887
|
+
(() => {
|
|
3888
|
+
if (getNebulaLanguage() === "en-US") {
|
|
3889
|
+
return [p3, p1, p2].join("/") + " " + time;
|
|
3890
|
+
}
|
|
3891
|
+
return [p3, p2, p1].join("/") + " " + time;
|
|
3892
|
+
})().trim()
|
|
3893
|
+
).toString();
|
|
3894
|
+
return isValid(new Date(parsedDate)) ? parsedDate : void 0;
|
|
3895
|
+
} catch (error2) {
|
|
3896
|
+
return void 0;
|
|
3897
|
+
}
|
|
3898
|
+
};
|
|
3888
3899
|
var dateIsAvailable = (inputDate, disabledDates) => {
|
|
3889
3900
|
if (!disabledDates || !inputDate) return true;
|
|
3890
3901
|
const dateIsDisabled = (d, matcher) => {
|
|
@@ -3942,10 +3953,11 @@ var InputDatePickerSingle = ({
|
|
|
3942
3953
|
disabledDates,
|
|
3943
3954
|
...rest
|
|
3944
3955
|
}) => {
|
|
3945
|
-
const
|
|
3956
|
+
const formattedDateByLanguage = formatDateToSubmit(value ?? "");
|
|
3946
3957
|
const [innerDate, setInnerDate] = useState(
|
|
3947
|
-
|
|
3958
|
+
formattedDateByLanguage ? new Date(formattedDateByLanguage) : void 0
|
|
3948
3959
|
);
|
|
3960
|
+
const [popoverIsOpen, setPopoverIsOpen] = useState(false);
|
|
3949
3961
|
const { locale } = useNebulaI18n();
|
|
3950
3962
|
const [month, setMonth] = useState(/* @__PURE__ */ new Date());
|
|
3951
3963
|
const handleClearValue = () => {
|
|
@@ -4150,11 +4162,12 @@ var InputDateTimePickerSingle = ({
|
|
|
4150
4162
|
disabledDates,
|
|
4151
4163
|
...rest
|
|
4152
4164
|
}) => {
|
|
4153
|
-
const [popoverIsOpen, setPopoverIsOpen] = useState(false);
|
|
4154
4165
|
const [innerTimeValue, setInnerTimeValue] = useState();
|
|
4166
|
+
const formattedDateByLanguage = formatDateToSubmit(value ?? "");
|
|
4155
4167
|
const [innerDate, setInnerDate] = useState(
|
|
4156
|
-
|
|
4168
|
+
formattedDateByLanguage ? new Date(formattedDateByLanguage) : void 0
|
|
4157
4169
|
);
|
|
4170
|
+
const [popoverIsOpen, setPopoverIsOpen] = useState(false);
|
|
4158
4171
|
const { locale, messages: messages17 } = useNebulaI18n();
|
|
4159
4172
|
const [month, setMonth] = useState(/* @__PURE__ */ new Date());
|
|
4160
4173
|
const inputTimeRef = useRef(null);
|