@ultraviolet/form 1.8.4 → 1.8.6
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.
|
@@ -23,6 +23,8 @@ const DateField = _ref => {
|
|
|
23
23
|
onFocus,
|
|
24
24
|
formatOnBlur,
|
|
25
25
|
autoFocus = false,
|
|
26
|
+
excludeDates,
|
|
27
|
+
selectsRange,
|
|
26
28
|
'data-testid': dataTestId
|
|
27
29
|
} = _ref;
|
|
28
30
|
const {
|
|
@@ -56,7 +58,7 @@ const DateField = _ref => {
|
|
|
56
58
|
required: required,
|
|
57
59
|
value: input.value,
|
|
58
60
|
onChange: val => {
|
|
59
|
-
if (val) {
|
|
61
|
+
if (val && val instanceof Date) {
|
|
60
62
|
onChange?.(val);
|
|
61
63
|
const newDate = parseDate(val);
|
|
62
64
|
if (isEmpty(input.value)) {
|
|
@@ -66,6 +68,8 @@ const DateField = _ref => {
|
|
|
66
68
|
const currentDate = parseDate(input.value);
|
|
67
69
|
newDate.setHours(currentDate.getHours(), currentDate.getMinutes());
|
|
68
70
|
input.onChange(newDate);
|
|
71
|
+
} else if (Array.isArray(val)) {
|
|
72
|
+
input.onChange(val);
|
|
69
73
|
}
|
|
70
74
|
},
|
|
71
75
|
onBlur: e => {
|
|
@@ -78,11 +82,15 @@ const DateField = _ref => {
|
|
|
78
82
|
},
|
|
79
83
|
maxDate: maxDate,
|
|
80
84
|
minDate: minDate,
|
|
85
|
+
startDate: selectsRange ? input.value[0] : undefined,
|
|
86
|
+
endDate: selectsRange ? input.value[1] : undefined,
|
|
81
87
|
error: error,
|
|
82
88
|
disabled: disabled,
|
|
83
89
|
autoFocus: autoFocus,
|
|
84
90
|
name: input.name,
|
|
85
|
-
"data-testid": dataTestId
|
|
91
|
+
"data-testid": dataTestId,
|
|
92
|
+
excludeDates: excludeDates,
|
|
93
|
+
selectsRange: selectsRange
|
|
86
94
|
});
|
|
87
95
|
};
|
|
88
96
|
|
package/dist/index.d.ts
CHANGED
|
@@ -131,7 +131,8 @@ declare const CheckboxGroupField: {
|
|
|
131
131
|
}) => _emotion_react_jsx_runtime.JSX.Element;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
type
|
|
134
|
+
type DateExtends = Date | [Date | null, Date | null];
|
|
135
|
+
type DateFieldProps = BaseFieldProps<DateExtends> & Omit<ComponentProps<typeof DateInput>, 'maxDate' | 'minDate' | 'disabled' | 'required' | 'locale' | 'name' | 'onChange' | 'onFocus' | 'onBlur' | 'autoFocus'> & {
|
|
135
136
|
name: string;
|
|
136
137
|
maxDate?: Date;
|
|
137
138
|
minDate?: Date;
|
|
@@ -143,7 +144,7 @@ type DateFieldProps = BaseFieldProps<Date> & Omit<ComponentProps<typeof DateInpu
|
|
|
143
144
|
onFocus?: (value: FocusEvent<HTMLElement>) => void;
|
|
144
145
|
autoFocus?: boolean;
|
|
145
146
|
};
|
|
146
|
-
declare const DateField: ({ required, name, label, validate, format, locale, maxDate, minDate, initialValue, disabled, value: inputVal, onChange, onBlur, onFocus, formatOnBlur, autoFocus, "data-testid": dataTestId, }: DateFieldProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
147
|
+
declare const DateField: ({ required, name, label, validate, format, locale, maxDate, minDate, initialValue, disabled, value: inputVal, onChange, onBlur, onFocus, formatOnBlur, autoFocus, excludeDates, selectsRange, "data-testid": dataTestId, }: DateFieldProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
147
148
|
|
|
148
149
|
type FormProps<FormValues = unknown> = {
|
|
149
150
|
children?: ((props: FormRenderProps<FormValues, Partial<FormValues>>) => ReactNode) | ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/form",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.6",
|
|
4
4
|
"description": "Ultraviolet Form",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"react-dom": "18.x"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@babel/core": "7.23.
|
|
41
|
+
"@babel/core": "7.23.2",
|
|
42
42
|
"@types/final-form-focus": "1.1.5",
|
|
43
|
-
"@types/react": "18.2.
|
|
44
|
-
"@types/react-dom": "18.2.
|
|
43
|
+
"@types/react": "18.2.28",
|
|
44
|
+
"@types/react-dom": "18.2.13",
|
|
45
45
|
"react": "18.2.0",
|
|
46
46
|
"react-dom": "18.2.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@babel/runtime": "7.23.
|
|
49
|
+
"@babel/runtime": "7.23.2",
|
|
50
50
|
"@emotion/babel-plugin": "11.11.0",
|
|
51
51
|
"@emotion/react": "11.11.1",
|
|
52
52
|
"@emotion/styled": "11.11.0",
|
|
@@ -55,6 +55,9 @@
|
|
|
55
55
|
"react-final-form": "6.5.9",
|
|
56
56
|
"react-final-form-arrays": "3.1.4",
|
|
57
57
|
"react-select": "5.7.7",
|
|
58
|
-
"@ultraviolet/ui": "1.
|
|
58
|
+
"@ultraviolet/ui": "1.20.1"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "rollup -c ../../rollup.config.mjs"
|
|
59
62
|
}
|
|
60
63
|
}
|