@instructure/ui-date-input 10.26.1-snapshot-2 → 10.26.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 +5 -18
- package/es/DateInput/index.js +7 -9
- package/es/DateInput/props.js +44 -1
- package/es/DateInput2/index.js +3 -3
- package/es/DateInput2/props.js +51 -1
- package/lib/DateInput/index.js +6 -8
- package/lib/DateInput/props.js +46 -1
- package/lib/DateInput2/index.js +3 -3
- package/lib/DateInput2/props.js +53 -1
- package/package.json +22 -19
- package/src/DateInput/index.tsx +5 -5
- package/src/DateInput/props.ts +69 -6
- package/src/DateInput2/index.tsx +10 -3
- package/src/DateInput2/props.ts +46 -5
- package/tsconfig.build.json +2 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateInput/index.d.ts +45 -0
- package/types/DateInput/index.d.ts.map +1 -1
- package/types/DateInput/props.d.ts +9 -6
- package/types/DateInput/props.d.ts.map +1 -1
- package/types/DateInput2/index.d.ts.map +1 -1
- package/types/DateInput2/props.d.ts +10 -5
- package/types/DateInput2/props.d.ts.map +1 -1
package/src/DateInput2/index.tsx
CHANGED
@@ -22,7 +22,13 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
import {
|
25
|
+
import {
|
26
|
+
useState,
|
27
|
+
useEffect,
|
28
|
+
forwardRef,
|
29
|
+
ForwardedRef,
|
30
|
+
ValidationMap
|
31
|
+
} from 'react'
|
26
32
|
import type { SyntheticEvent } from 'react'
|
27
33
|
import { Calendar } from '@instructure/ui-calendar'
|
28
34
|
import { IconButton } from '@instructure/ui-buttons'
|
@@ -36,6 +42,7 @@ import { TextInput } from '@instructure/ui-text-input'
|
|
36
42
|
import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils'
|
37
43
|
import { getLocale, getTimezone } from '@instructure/ui-i18n'
|
38
44
|
|
45
|
+
import { propTypes } from './props'
|
39
46
|
import type { DateInput2Props } from './props'
|
40
47
|
import type { FormMessage } from '@instructure/ui-form-field'
|
41
48
|
import type { Moment } from '@instructure/ui-i18n'
|
@@ -123,6 +130,7 @@ function parseLocaleDate(
|
|
123
130
|
category: components
|
124
131
|
---
|
125
132
|
**/
|
133
|
+
// eslint-disable-next-line react/display-name
|
126
134
|
const DateInput2 = forwardRef(
|
127
135
|
(
|
128
136
|
{
|
@@ -333,8 +341,7 @@ const DateInput2 = forwardRef(
|
|
333
341
|
}
|
334
342
|
)
|
335
343
|
|
336
|
-
|
337
|
-
DateInput2.displayName = 'DateInput2'
|
344
|
+
DateInput2.propTypes = propTypes as ValidationMap<DateInput2Props>
|
338
345
|
|
339
346
|
export default DateInput2
|
340
347
|
export { DateInput2 }
|
package/src/DateInput2/props.ts
CHANGED
@@ -22,9 +22,17 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
+
import PropTypes from 'prop-types'
|
25
26
|
import type { SyntheticEvent, InputHTMLAttributes } from 'react'
|
27
|
+
|
28
|
+
import { controllable } from '@instructure/ui-prop-types'
|
29
|
+
import { FormPropTypes } from '@instructure/ui-form-field'
|
26
30
|
import type { FormMessage } from '@instructure/ui-form-field'
|
27
|
-
import type {
|
31
|
+
import type {
|
32
|
+
OtherHTMLAttributes,
|
33
|
+
Renderable,
|
34
|
+
PropValidators
|
35
|
+
} from '@instructure/shared-types'
|
28
36
|
import type { Spacing } from '@instructure/emotion'
|
29
37
|
|
30
38
|
type DateInput2OwnProps = {
|
@@ -82,10 +90,12 @@ type DateInput2OwnProps = {
|
|
82
90
|
*/
|
83
91
|
width?: string
|
84
92
|
/**
|
85
|
-
* Displays
|
86
|
-
*
|
87
|
-
*
|
88
|
-
*
|
93
|
+
* Displays messages and validation for the input. It should be an object
|
94
|
+
* with the following shape:
|
95
|
+
* `{
|
96
|
+
* text: PropTypes.node,
|
97
|
+
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
98
|
+
* }`
|
89
99
|
*/
|
90
100
|
messages?: FormMessage[]
|
91
101
|
/**
|
@@ -178,9 +188,40 @@ type DateInput2OwnProps = {
|
|
178
188
|
inputRef?: (inputElement: HTMLInputElement | null) => void
|
179
189
|
}
|
180
190
|
|
191
|
+
type PropKeys = keyof DateInput2OwnProps
|
192
|
+
|
181
193
|
type DateInput2Props = DateInput2OwnProps &
|
182
194
|
OtherHTMLAttributes<
|
183
195
|
DateInput2OwnProps,
|
184
196
|
InputHTMLAttributes<DateInput2OwnProps & Element>
|
185
197
|
>
|
198
|
+
|
199
|
+
const propTypes: PropValidators<PropKeys> = {
|
200
|
+
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
201
|
+
screenReaderLabels: PropTypes.object.isRequired,
|
202
|
+
value: controllable(PropTypes.string),
|
203
|
+
placeholder: PropTypes.string,
|
204
|
+
onChange: PropTypes.func,
|
205
|
+
onBlur: PropTypes.func,
|
206
|
+
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
207
|
+
isRequired: PropTypes.bool,
|
208
|
+
isInline: PropTypes.bool,
|
209
|
+
width: PropTypes.string,
|
210
|
+
messages: PropTypes.arrayOf(FormPropTypes.message),
|
211
|
+
invalidDateErrorMessage: PropTypes.oneOfType([
|
212
|
+
PropTypes.func,
|
213
|
+
PropTypes.string
|
214
|
+
]),
|
215
|
+
locale: PropTypes.string,
|
216
|
+
timezone: PropTypes.string,
|
217
|
+
withYearPicker: PropTypes.object,
|
218
|
+
dateFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
219
|
+
onRequestValidateDate: PropTypes.func,
|
220
|
+
renderCalendarIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
221
|
+
margin: PropTypes.string,
|
222
|
+
disabledDates: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
|
223
|
+
inputRef: PropTypes.func
|
224
|
+
}
|
225
|
+
|
186
226
|
export type { DateInput2Props }
|
227
|
+
export { propTypes }
|
package/tsconfig.build.json
CHANGED
@@ -15,9 +15,11 @@
|
|
15
15
|
{ "path": "../ui-icons/tsconfig.build.json" },
|
16
16
|
{ "path": "../ui-popover/tsconfig.build.json" },
|
17
17
|
{ "path": "../ui-position/tsconfig.build.json" },
|
18
|
+
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
18
19
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
19
20
|
{ "path": "../ui-selectable/tsconfig.build.json" },
|
20
21
|
{ "path": "../shared-types/tsconfig.build.json" },
|
22
|
+
{ "path": "../ui-testable/tsconfig.build.json" },
|
21
23
|
{ "path": "../ui-text-input/tsconfig.build.json" },
|
22
24
|
{ "path": "../ui-utils/tsconfig.build.json" },
|
23
25
|
{ "path": "../ui-i18n/tsconfig.build.json" },
|