@instructure/ui-date-input 9.6.1-snapshot-2 → 9.7.2
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/CHANGELOG.md +18 -2
- package/es/DateInput2/index.js +150 -86
- package/es/DateInput2/props.js +2 -3
- package/lib/DateInput2/index.js +150 -86
- package/lib/DateInput2/props.js +2 -3
- package/package.json +20 -20
- package/src/DateInput/README.md +1 -1
- package/src/DateInput2/README.md +183 -176
- package/src/DateInput2/index.tsx +147 -89
- package/src/DateInput2/props.ts +20 -31
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateInput2/index.d.ts +8 -6
- package/types/DateInput2/index.d.ts.map +1 -1
- package/types/DateInput2/props.d.ts +14 -18
- package/types/DateInput2/props.d.ts.map +1 -1
@@ -10,7 +10,7 @@ category: components
|
|
10
10
|
@module experimental
|
11
11
|
**/
|
12
12
|
declare const DateInput2: {
|
13
|
-
({ renderLabel, screenReaderLabels, isRequired, interaction,
|
13
|
+
({ renderLabel, screenReaderLabels, isRequired, interaction, isInline, value, messages, width, onChange, onBlur, withYearPicker, invalidDateErrorMessage, locale, timezone, placeholder, dateFormat, onRequestValidateDate, ...rest }: DateInput2Props): jsx.JSX.Element;
|
14
14
|
propTypes: import("@instructure/shared-types").PropValidators<keyof {
|
15
15
|
renderLabel: import("@instructure/shared-types").Renderable;
|
16
16
|
screenReaderLabels: {
|
@@ -19,16 +19,14 @@ declare const DateInput2: {
|
|
19
19
|
nextMonthButton: string;
|
20
20
|
};
|
21
21
|
value?: string;
|
22
|
-
size?: "small" | "medium" | "large";
|
23
22
|
placeholder?: string;
|
24
|
-
onChange?: (event: React.SyntheticEvent,
|
25
|
-
onBlur?: (event: React.SyntheticEvent) => void;
|
23
|
+
onChange?: (event: React.SyntheticEvent, inputValue: string, utcDateString: string) => void;
|
24
|
+
onBlur?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
|
26
25
|
interaction?: "enabled" | "disabled" | "readonly";
|
27
26
|
isRequired?: boolean;
|
28
27
|
isInline?: boolean;
|
29
28
|
width?: string;
|
30
29
|
messages?: FormMessage[];
|
31
|
-
onRequestValidateDate?: (isoDateString?: string, internalValidationPassed?: boolean) => void | FormMessage[];
|
32
30
|
invalidDateErrorMessage?: string;
|
33
31
|
locale?: string;
|
34
32
|
timezone?: string;
|
@@ -38,7 +36,11 @@ declare const DateInput2: {
|
|
38
36
|
startYear: number;
|
39
37
|
endYear: number;
|
40
38
|
};
|
41
|
-
|
39
|
+
dateFormat?: {
|
40
|
+
parser: (input: string) => Date | null;
|
41
|
+
formatter: (date: Date) => string;
|
42
|
+
} | string;
|
43
|
+
onRequestValidateDate?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
|
42
44
|
}>;
|
43
45
|
};
|
44
46
|
export default DateInput2;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput2/index.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAa3C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAG1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput2/index.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAa3C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAG1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AA8E7D;;;;;;GAMG;AACH,QAAA,MAAM,UAAU;2OAoBb,eAAe;;;;;;;;;;2BAtGmE,MAAO,cACrF;yBAC+E,MAAQ,cAC3F;;;;;;;;;;;+BAmEmB,CAAA;;;;;;;;wCAiCpB,MAAM,cAAa;;CA4LpB,CAAA;AAID,eAAe,UAAU,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
@@ -12,26 +12,21 @@ type DateInput2OwnProps = {
|
|
12
12
|
nextMonthButton: string;
|
13
13
|
};
|
14
14
|
/**
|
15
|
-
* Specifies the input value
|
15
|
+
* Specifies the input value.
|
16
16
|
*/
|
17
17
|
value?: string;
|
18
18
|
/**
|
19
|
-
*
|
20
|
-
*/
|
21
|
-
size?: 'small' | 'medium' | 'large';
|
22
|
-
/**
|
23
|
-
* Html placeholder text to display when the input has no value. This should
|
24
|
-
* be hint text, not a label replacement.
|
19
|
+
* Placeholder text for the input field. If it's left undefined it will display a hint for the date format (like `DD/MM/YYYY`).
|
25
20
|
*/
|
26
21
|
placeholder?: string;
|
27
22
|
/**
|
28
23
|
* Callback fired when the input changes.
|
29
24
|
*/
|
30
|
-
onChange?: (event: React.SyntheticEvent,
|
25
|
+
onChange?: (event: React.SyntheticEvent, inputValue: string, utcDateString: string) => void;
|
31
26
|
/**
|
32
27
|
* Callback executed when the input fires a blur event.
|
33
28
|
*/
|
34
|
-
onBlur?: (event: React.SyntheticEvent) => void;
|
29
|
+
onBlur?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
|
35
30
|
/**
|
36
31
|
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
37
32
|
* When "disabled", the input changes visibly to indicate that it cannot
|
@@ -61,12 +56,6 @@ type DateInput2OwnProps = {
|
|
61
56
|
* }`
|
62
57
|
*/
|
63
58
|
messages?: FormMessage[];
|
64
|
-
/**
|
65
|
-
* Callback fired when the input is blurred or a date is selected from the calendar.
|
66
|
-
* Feedback should be provided to the user when this function is called if the selected date or input
|
67
|
-
* value is invalid. The component has an internal check whether the date can be parsed to a valid date.
|
68
|
-
*/
|
69
|
-
onRequestValidateDate?: (isoDateString?: string, internalValidationPassed?: boolean) => void | FormMessage[];
|
70
59
|
/**
|
71
60
|
* The message shown to the user when the date is invalid. If this prop is not set, validation is bypassed.
|
72
61
|
* If it's set to an empty string, validation happens and the input border changes to red if validation hasn't passed.
|
@@ -94,7 +83,7 @@ type DateInput2OwnProps = {
|
|
94
83
|
* This property can also be set via a context property and if both are set
|
95
84
|
* then the component property takes precedence over the context property.
|
96
85
|
*
|
97
|
-
* The
|
86
|
+
* The system timezone will be used if no value is set via a component
|
98
87
|
* property or a context property.
|
99
88
|
**/
|
100
89
|
timezone?: string;
|
@@ -116,9 +105,16 @@ type DateInput2OwnProps = {
|
|
116
105
|
endYear: number;
|
117
106
|
};
|
118
107
|
/**
|
119
|
-
|
108
|
+
* By default the date format is determined by the locale but can be changed via this prop to an alternate locale (passing it in as a string) or a custom parser and formatter (both as functions)
|
109
|
+
*/
|
110
|
+
dateFormat?: {
|
111
|
+
parser: (input: string) => Date | null;
|
112
|
+
formatter: (date: Date) => string;
|
113
|
+
} | string;
|
114
|
+
/**
|
115
|
+
* Callback executed when the input fires a blur event or a date is selected from the picker.
|
120
116
|
*/
|
121
|
-
|
117
|
+
onRequestValidateDate?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
|
122
118
|
};
|
123
119
|
type PropKeys = keyof DateInput2OwnProps;
|
124
120
|
type DateInput2Props = DateInput2OwnProps & OtherHTMLAttributes<DateInput2OwnProps, InputHTMLAttributes<DateInput2OwnProps & Element>>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/DateInput2/props.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAIhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,cAAc,EACf,MAAM,2BAA2B,CAAA;AAElC,KAAK,kBAAkB,GAAG;IACxB;;OAEG;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