@idds/react 1.5.40 → 1.5.42
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.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +38 -16
- package/dist/index.umd.js +1 -1
- package/dist/types/components/TimePicker.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -5025,8 +5025,8 @@ function PhoneInput({
|
|
|
5025
5025
|
"ina-phone-input__country-chevron",
|
|
5026
5026
|
isCountryDropdownOpen && "ina-phone-input__country-chevron--open"
|
|
5027
5027
|
),
|
|
5028
|
-
width: "
|
|
5029
|
-
height: "
|
|
5028
|
+
width: "16",
|
|
5029
|
+
height: "16",
|
|
5030
5030
|
viewBox: "0 0 24 24",
|
|
5031
5031
|
fill: "none",
|
|
5032
5032
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6675,23 +6675,23 @@ const TimePicker = forwardRef(
|
|
|
6675
6675
|
}
|
|
6676
6676
|
return hours * 60 + minutes;
|
|
6677
6677
|
};
|
|
6678
|
-
const isTimeDisabled = (hours, minutes, seconds, period) => {
|
|
6678
|
+
const isTimeDisabled = (hours, minutes, seconds, period, options = {}) => {
|
|
6679
6679
|
const timeStr = formatTime(hours, minutes, seconds, period);
|
|
6680
6680
|
const timeInMinutes = parseTimeToMinutes(timeStr);
|
|
6681
|
-
if (disabledBackTime) {
|
|
6681
|
+
if (disabledBackTime && !options.ignoreBefore) {
|
|
6682
6682
|
const now = /* @__PURE__ */ new Date();
|
|
6683
6683
|
const currentTimeInMinutes = now.getHours() * 60 + now.getMinutes();
|
|
6684
6684
|
if (timeInMinutes < currentTimeInMinutes) {
|
|
6685
6685
|
return true;
|
|
6686
6686
|
}
|
|
6687
6687
|
}
|
|
6688
|
-
if (disabledTimeBefore) {
|
|
6688
|
+
if (disabledTimeBefore && !options.ignoreBefore) {
|
|
6689
6689
|
const beforeTimeInMinutes = parseTimeToMinutes(disabledTimeBefore);
|
|
6690
6690
|
if (timeInMinutes < beforeTimeInMinutes) {
|
|
6691
6691
|
return true;
|
|
6692
6692
|
}
|
|
6693
6693
|
}
|
|
6694
|
-
if (disabledTimeAfter) {
|
|
6694
|
+
if (disabledTimeAfter && !options.ignoreAfter) {
|
|
6695
6695
|
const afterTimeInMinutes = parseTimeToMinutes(disabledTimeAfter);
|
|
6696
6696
|
if (timeInMinutes > afterTimeInMinutes) {
|
|
6697
6697
|
return true;
|
|
@@ -6822,12 +6822,22 @@ const TimePicker = forwardRef(
|
|
|
6822
6822
|
children: options.map((option) => {
|
|
6823
6823
|
let isDisabled = false;
|
|
6824
6824
|
if (type === "hour") {
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6825
|
+
const hourValue = use12Hours ? option === 12 ? 0 : option : option;
|
|
6826
|
+
const isTooEarly = isTimeDisabled(
|
|
6827
|
+
hourValue,
|
|
6828
|
+
59,
|
|
6829
|
+
59,
|
|
6830
|
+
use12Hours ? currentTime.period : void 0,
|
|
6831
|
+
{ ignoreAfter: true }
|
|
6832
|
+
);
|
|
6833
|
+
const isTooLate = isTimeDisabled(
|
|
6834
|
+
hourValue,
|
|
6835
|
+
0,
|
|
6836
|
+
0,
|
|
6837
|
+
use12Hours ? currentTime.period : void 0,
|
|
6838
|
+
{ ignoreBefore: true }
|
|
6830
6839
|
);
|
|
6840
|
+
isDisabled = isTooEarly || isTooLate;
|
|
6831
6841
|
} else if (type === "minute") {
|
|
6832
6842
|
isDisabled = isTimeDisabled(
|
|
6833
6843
|
currentTime.hours,
|
|
@@ -6949,16 +6959,28 @@ const TimePicker = forwardRef(
|
|
|
6949
6959
|
...props
|
|
6950
6960
|
}
|
|
6951
6961
|
),
|
|
6952
|
-
allowClear && internalValue && !disabled
|
|
6953
|
-
"
|
|
6962
|
+
allowClear && internalValue && !disabled && /* @__PURE__ */ jsx(
|
|
6963
|
+
"div",
|
|
6954
6964
|
{
|
|
6955
|
-
type: "button",
|
|
6956
6965
|
className: "ina-time-picker__clear-button",
|
|
6957
|
-
onClick:
|
|
6966
|
+
onClick: (e) => {
|
|
6967
|
+
e.stopPropagation();
|
|
6968
|
+
handleClear();
|
|
6969
|
+
},
|
|
6958
6970
|
"aria-label": "Clear time",
|
|
6959
6971
|
children: /* @__PURE__ */ jsx(IconX, { size: 16 })
|
|
6960
6972
|
}
|
|
6961
|
-
)
|
|
6973
|
+
),
|
|
6974
|
+
suffixIcon && /* @__PURE__ */ jsx(
|
|
6975
|
+
"div",
|
|
6976
|
+
{
|
|
6977
|
+
className: "ina-time-picker__suffix-icon",
|
|
6978
|
+
style: {
|
|
6979
|
+
visibility: allowClear && internalValue && !disabled ? "hidden" : "visible"
|
|
6980
|
+
},
|
|
6981
|
+
children: suffixIcon
|
|
6982
|
+
}
|
|
6983
|
+
)
|
|
6962
6984
|
]
|
|
6963
6985
|
}
|
|
6964
6986
|
),
|