@instructure/ui-date-input 10.2.3-snapshot-10 → 10.2.3-snapshot-11
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 +5 -2
- package/es/DateInput2/index.js +172 -73
- package/es/DateInput2/props.js +3 -5
- package/lib/DateInput2/index.js +172 -73
- package/lib/DateInput2/props.js +3 -5
- package/package.json +20 -20
- package/src/DateInput/README.md +1 -1
- package/src/DateInput2/README.md +195 -53
- package/src/DateInput2/index.tsx +184 -95
- package/src/DateInput2/props.ts +49 -37
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateInput2/index.d.ts +36 -2
- package/types/DateInput2/index.d.ts.map +1 -1
- package/types/DateInput2/props.d.ts +20 -28
- package/types/DateInput2/props.d.ts.map +1 -1
@@ -1,13 +1,47 @@
|
|
1
|
+
import type { SyntheticEvent } from 'react';
|
1
2
|
import { jsx } from '@instructure/emotion';
|
2
3
|
import type { DateInput2Props } from './props';
|
4
|
+
import type { FormMessage } from '@instructure/ui-form-field';
|
3
5
|
/**
|
4
6
|
---
|
5
7
|
category: components
|
6
8
|
---
|
9
|
+
|
10
|
+
@module experimental
|
7
11
|
**/
|
8
12
|
declare const DateInput2: {
|
9
|
-
({ renderLabel, screenReaderLabels, isRequired, interaction,
|
10
|
-
propTypes: import("@instructure/shared-types").PropValidators<keyof
|
13
|
+
({ renderLabel, screenReaderLabels, isRequired, interaction, isInline, value, messages, width, onChange, onBlur, withYearPicker, invalidDateErrorMessage, locale, timezone, placeholder, dateFormat, onRequestValidateDate, ...rest }: DateInput2Props): jsx.JSX.Element;
|
14
|
+
propTypes: import("@instructure/shared-types").PropValidators<keyof {
|
15
|
+
renderLabel: import("@instructure/shared-types").Renderable;
|
16
|
+
screenReaderLabels: {
|
17
|
+
calendarIcon: string;
|
18
|
+
prevMonthButton: string;
|
19
|
+
nextMonthButton: string;
|
20
|
+
};
|
21
|
+
value?: string;
|
22
|
+
placeholder?: string;
|
23
|
+
onChange?: (event: React.SyntheticEvent, inputValue: string, utcDateString: string) => void;
|
24
|
+
onBlur?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
|
25
|
+
interaction?: "enabled" | "disabled" | "readonly";
|
26
|
+
isRequired?: boolean;
|
27
|
+
isInline?: boolean;
|
28
|
+
width?: string;
|
29
|
+
messages?: FormMessage[];
|
30
|
+
invalidDateErrorMessage?: string;
|
31
|
+
locale?: string;
|
32
|
+
timezone?: string;
|
33
|
+
withYearPicker?: {
|
34
|
+
screenReaderLabel: string;
|
35
|
+
onRequestYearChange?: (e: SyntheticEvent, requestedYear: number) => void;
|
36
|
+
startYear: number;
|
37
|
+
endYear: number;
|
38
|
+
};
|
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;
|
44
|
+
}>;
|
11
45
|
};
|
12
46
|
export default DateInput2;
|
13
47
|
export { DateInput2 };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput2/index.tsx"],"names":[],"mappings":"
|
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;AAsF7D;;;;;;GAMG;AACH,QAAA,MAAM,UAAU;2OAoBb,eAAe;;;;;;;;;;2BA3GJ,MACX,cAAa;yBAEoE,MAAM,cAC1F;;;;;;;;;;;+BAuEkB,CAAA;;;;;;;;wCAiCO,MAAO,cAAc;;CAyL7C,CAAA;AAID,eAAe,UAAU,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import type { SyntheticEvent } from 'react';
|
1
|
+
import type { SyntheticEvent, InputHTMLAttributes } from 'react';
|
2
2
|
import type { FormMessage } from '@instructure/ui-form-field';
|
3
|
-
import type { Renderable, PropValidators } from '@instructure/shared-types';
|
4
|
-
type
|
3
|
+
import type { OtherHTMLAttributes, Renderable, PropValidators } from '@instructure/shared-types';
|
4
|
+
type DateInput2OwnProps = {
|
5
5
|
/**
|
6
6
|
* Specifies the input label.
|
7
7
|
*/
|
@@ -16,22 +16,17 @@ type DateInput2Props = {
|
|
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,21 +56,6 @@ type DateInput2Props = {
|
|
61
56
|
* }`
|
62
57
|
*/
|
63
58
|
messages?: FormMessage[];
|
64
|
-
/**
|
65
|
-
* Callback fired requesting the calendar be shown.
|
66
|
-
*/
|
67
|
-
onRequestShowCalendar?: (event: SyntheticEvent) => void;
|
68
|
-
/**
|
69
|
-
* Callback fired requesting the calendar be hidden.
|
70
|
-
*/
|
71
|
-
onRequestHideCalendar?: (event: SyntheticEvent) => void;
|
72
|
-
/**
|
73
|
-
* Callback fired when the input is blurred. Feedback should be provided
|
74
|
-
* to the user when this function is called if the selected date or input
|
75
|
-
* value is invalid. The component has an internal check whether the date can
|
76
|
-
* be parsed to a valid date.
|
77
|
-
*/
|
78
|
-
onRequestValidateDate?: (value?: string, internalValidationPassed?: boolean) => void | FormMessage[];
|
79
59
|
/**
|
80
60
|
* The message shown to the user when the date is invalid. If this prop is not set, validation is bypassed.
|
81
61
|
* If it's set to an empty string, validation happens and the input border changes to red if validation hasn't passed.
|
@@ -103,7 +83,7 @@ type DateInput2Props = {
|
|
103
83
|
* This property can also be set via a context property and if both are set
|
104
84
|
* then the component property takes precedence over the context property.
|
105
85
|
*
|
106
|
-
* The
|
86
|
+
* The system timezone will be used if no value is set via a component
|
107
87
|
* property or a context property.
|
108
88
|
**/
|
109
89
|
timezone?: string;
|
@@ -124,8 +104,20 @@ type DateInput2Props = {
|
|
124
104
|
startYear: number;
|
125
105
|
endYear: number;
|
126
106
|
};
|
107
|
+
/**
|
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.
|
116
|
+
*/
|
117
|
+
onRequestValidateDate?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
|
127
118
|
};
|
128
|
-
type PropKeys = keyof
|
119
|
+
type PropKeys = keyof DateInput2OwnProps;
|
120
|
+
type DateInput2Props = DateInput2OwnProps & OtherHTMLAttributes<DateInput2OwnProps, InputHTMLAttributes<DateInput2OwnProps & Element>>;
|
129
121
|
declare const propTypes: PropValidators<PropKeys>;
|
130
122
|
export type { DateInput2Props };
|
131
123
|
export { propTypes };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/DateInput2/props.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;
|
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;IACH,WAAW,EAAE,UAAU,CAAA;IACvB,kBAAkB,EAAE;QAClB,YAAY,EAAE,MAAM,CAAA;QACpB,eAAe,EAAE,MAAM,CAAA;QACvB,eAAe,EAAE,MAAM,CAAA;KACxB,CAAA;IACD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE,KAAK,CAAC,cAAc,EAC3B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,KAClB,IAAI,CAAA;IACT;;OAEG;IACH,MAAM,CAAC,EAAE,CACP,KAAK,EAAE,KAAK,CAAC,cAAc,EAC3B,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,KAClB,IAAI,CAAA;IACT;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;IACjD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;OA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