forstok-ui-lib 8.10.3 → 8.10.4
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 +74 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +92 -92
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/date/index.tsx +7 -1
- package/src/components/date/ref.tsx +7 -1
- package/src/components/date/time.tsx +22 -0
package/package.json
CHANGED
|
@@ -4,6 +4,8 @@ import moment from "moment";
|
|
|
4
4
|
import { DateContainer, DateIndicatorContainer } from "./styles";
|
|
5
5
|
import type { TState } from "../../typeds/base.typed";
|
|
6
6
|
|
|
7
|
+
import MinimumTimeInput from "./time";
|
|
8
|
+
|
|
7
9
|
type TDate = {
|
|
8
10
|
dateFormat?: string;
|
|
9
11
|
name: string;
|
|
@@ -83,7 +85,11 @@ const DateComponent = forwardRef(
|
|
|
83
85
|
onKeyDown={(e) => e.preventDefault()}
|
|
84
86
|
ref={ref as any}
|
|
85
87
|
{...(minDate && { minDate: minDate })}
|
|
86
|
-
{
|
|
88
|
+
customTimeInput={
|
|
89
|
+
showTimeInput && minTime ? (
|
|
90
|
+
<MinimumTimeInput minTime={minTime} />
|
|
91
|
+
) : undefined
|
|
92
|
+
}
|
|
87
93
|
/>
|
|
88
94
|
{allowEmpty && _date ? (
|
|
89
95
|
<DateIndicatorContainer
|
|
@@ -8,6 +8,8 @@ import "react-datepicker/dist/react-datepicker.css";
|
|
|
8
8
|
import { DateContainer, DateIndicatorContainer } from "./styles";
|
|
9
9
|
import { TState } from "../../typeds/base.typed";
|
|
10
10
|
|
|
11
|
+
import MinimumTimeInput from "./time";
|
|
12
|
+
|
|
11
13
|
type TDate = {
|
|
12
14
|
dateFormat?: string;
|
|
13
15
|
name: string;
|
|
@@ -109,7 +111,11 @@ const DateRefComponent = forwardRef((props: TDate, ref) => {
|
|
|
109
111
|
{...(disabled && { disabled: true })}
|
|
110
112
|
{...(portalId && { portalId: portalId })}
|
|
111
113
|
{...(minDate && { minDate: minDate })}
|
|
112
|
-
{
|
|
114
|
+
customTimeInput={
|
|
115
|
+
showTimeInput && minTime ? (
|
|
116
|
+
<MinimumTimeInput minTime={minTime} />
|
|
117
|
+
) : undefined
|
|
118
|
+
}
|
|
113
119
|
/>
|
|
114
120
|
{allowEmpty && _date ? (
|
|
115
121
|
<DateIndicatorContainer
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import moment from "moment";
|
|
2
|
+
|
|
3
|
+
type TMinimumTimeInput = {
|
|
4
|
+
value?: string;
|
|
5
|
+
onChange?: (value: string) => void;
|
|
6
|
+
minTime?: Date;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const MinimumTimeInput = ({
|
|
10
|
+
value = "",
|
|
11
|
+
onChange,
|
|
12
|
+
minTime,
|
|
13
|
+
}: TMinimumTimeInput) => (
|
|
14
|
+
<input
|
|
15
|
+
type="time"
|
|
16
|
+
value={value}
|
|
17
|
+
min={minTime ? moment(minTime).format("HH:mm") : undefined}
|
|
18
|
+
onChange={(event) => onChange?.(event.target.value)}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default MinimumTimeInput;
|