@instructure/ui-date-time-input 8.36.1-snapshot-20 → 8.36.1-snapshot-26
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 +6 -1
- package/es/DateTimeInput/index.js +7 -3
- package/es/DateTimeInput/props.js +3 -2
- package/lib/DateTimeInput/index.js +7 -3
- package/lib/DateTimeInput/props.js +3 -2
- package/package.json +18 -18
- package/src/DateTimeInput/README.md +3 -0
- package/src/DateTimeInput/index.tsx +5 -2
- package/src/DateTimeInput/props.ts +13 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateTimeInput/index.d.ts +1 -0
- package/types/DateTimeInput/index.d.ts.map +1 -1
- package/types/DateTimeInput/props.d.ts +9 -0
- package/types/DateTimeInput/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [8.36.1-snapshot-
|
|
6
|
+
## [8.36.1-snapshot-26](https://github.com/instructure/instructure-ui/compare/v8.36.0...v8.36.1-snapshot-26) (2023-04-24)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
@@ -11,6 +11,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
* **ui-date-time-input:** dateTimeInput does not trigger invalidDateTimeMessage on blur ([307a3f4](https://github.com/instructure/instructure-ui/commit/307a3f4e288aefcc8ae01ef4c39e30015d2c021f))
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **ui-date-time-input:** allow the user to enter non-step divisible time values ([2cf6c9d](https://github.com/instructure/instructure-ui/commit/2cf6c9d60b09f8279ab618c895be5515f3c5b965))
|
|
17
|
+
|
|
18
|
+
|
|
14
19
|
|
|
15
20
|
|
|
16
21
|
|
|
@@ -422,7 +422,8 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
|
|
|
422
422
|
colSpacing = _this$props3.colSpacing,
|
|
423
423
|
isRequired = _this$props3.isRequired,
|
|
424
424
|
interaction = _this$props3.interaction,
|
|
425
|
-
renderWeekdayLabels = _this$props3.renderWeekdayLabels
|
|
425
|
+
renderWeekdayLabels = _this$props3.renderWeekdayLabels,
|
|
426
|
+
allowNonStepInput = _this$props3.allowNonStepInput;
|
|
426
427
|
return /*#__PURE__*/React.createElement(FormFieldGroup, {
|
|
427
428
|
description: description,
|
|
428
429
|
layout: layout,
|
|
@@ -462,7 +463,8 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
|
|
|
462
463
|
step: timeStep,
|
|
463
464
|
timezone: timezone,
|
|
464
465
|
inputRef: timeInputRef,
|
|
465
|
-
interaction: interaction
|
|
466
|
+
interaction: interaction,
|
|
467
|
+
allowNonStepInput: allowNonStepInput
|
|
466
468
|
}));
|
|
467
469
|
}
|
|
468
470
|
}, _class2.displayName = "DateTimeInput", _class2.DEFAULT_MESSAGE_FORMAT = 'LLLL', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
@@ -472,7 +474,9 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
|
|
|
472
474
|
timeStep: 30,
|
|
473
475
|
messageFormat: _class2.DEFAULT_MESSAGE_FORMAT,
|
|
474
476
|
isRequired: false,
|
|
475
|
-
dateFormat: 'LL'
|
|
477
|
+
dateFormat: 'LL',
|
|
478
|
+
// Localized date with full month, e.g. "August 6, 2014"
|
|
479
|
+
allowNonStepInput: false
|
|
476
480
|
}, _class2.contextType = ApplyLocaleContext, _class2)) || _class);
|
|
477
481
|
export default DateTimeInput;
|
|
478
482
|
export { DateTimeInput };
|
|
@@ -54,7 +54,8 @@ const propTypes = {
|
|
|
54
54
|
timeInputRef: PropTypes.func,
|
|
55
55
|
onBlur: PropTypes.func,
|
|
56
56
|
disabledDates: PropTypes.oneOfType([PropTypes.func, PropTypes.arrayOf(PropTypes.string)]),
|
|
57
|
-
disabledDateTimeMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
|
|
57
|
+
disabledDateTimeMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
58
|
+
allowNonStepInput: PropTypes.bool
|
|
58
59
|
};
|
|
59
|
-
const allowedProps = ['description', 'dateRenderLabel', 'prevMonthLabel', 'nextMonthLabel', 'datePlaceholder', 'dateFormat', 'interaction', 'timeRenderLabel', 'timeStep', 'timeFormat', 'locale', 'timezone', 'invalidDateTimeMessage', 'messages', 'messageFormat', 'layout', 'rowSpacing', 'colSpacing', 'value', 'defaultValue', 'renderWeekdayLabels', 'isRequired', 'onChange', 'dateInputRef', 'timeInputRef', 'onBlur', 'disabledDates', 'disabledDateTimeMessage'];
|
|
60
|
+
const allowedProps = ['description', 'dateRenderLabel', 'prevMonthLabel', 'nextMonthLabel', 'datePlaceholder', 'dateFormat', 'interaction', 'timeRenderLabel', 'timeStep', 'timeFormat', 'locale', 'timezone', 'invalidDateTimeMessage', 'messages', 'messageFormat', 'layout', 'rowSpacing', 'colSpacing', 'value', 'defaultValue', 'renderWeekdayLabels', 'isRequired', 'onChange', 'dateInputRef', 'timeInputRef', 'onBlur', 'disabledDates', 'disabledDateTimeMessage', 'allowNonStepInput'];
|
|
60
61
|
export { propTypes, allowedProps };
|
|
@@ -430,7 +430,8 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
430
430
|
colSpacing = _this$props3.colSpacing,
|
|
431
431
|
isRequired = _this$props3.isRequired,
|
|
432
432
|
interaction = _this$props3.interaction,
|
|
433
|
-
renderWeekdayLabels = _this$props3.renderWeekdayLabels
|
|
433
|
+
renderWeekdayLabels = _this$props3.renderWeekdayLabels,
|
|
434
|
+
allowNonStepInput = _this$props3.allowNonStepInput;
|
|
434
435
|
return /*#__PURE__*/_react.default.createElement(_FormFieldGroup.FormFieldGroup, {
|
|
435
436
|
description: description,
|
|
436
437
|
layout: layout,
|
|
@@ -470,7 +471,8 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
470
471
|
step: timeStep,
|
|
471
472
|
timezone: timezone,
|
|
472
473
|
inputRef: timeInputRef,
|
|
473
|
-
interaction: interaction
|
|
474
|
+
interaction: interaction,
|
|
475
|
+
allowNonStepInput: allowNonStepInput
|
|
474
476
|
}));
|
|
475
477
|
}
|
|
476
478
|
}, _class2.displayName = "DateTimeInput", _class2.DEFAULT_MESSAGE_FORMAT = 'LLLL', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
@@ -480,7 +482,9 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
480
482
|
timeStep: 30,
|
|
481
483
|
messageFormat: _class2.DEFAULT_MESSAGE_FORMAT,
|
|
482
484
|
isRequired: false,
|
|
483
|
-
dateFormat: 'LL'
|
|
485
|
+
dateFormat: 'LL',
|
|
486
|
+
// Localized date with full month, e.g. "August 6, 2014"
|
|
487
|
+
allowNonStepInput: false
|
|
484
488
|
}, _class2.contextType = _ApplyLocaleContext.ApplyLocaleContext, _class2)) || _class);
|
|
485
489
|
exports.DateTimeInput = DateTimeInput;
|
|
486
490
|
var _default = DateTimeInput;
|
|
@@ -61,8 +61,9 @@ const propTypes = {
|
|
|
61
61
|
timeInputRef: _propTypes.default.func,
|
|
62
62
|
onBlur: _propTypes.default.func,
|
|
63
63
|
disabledDates: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
64
|
-
disabledDateTimeMessage: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func])
|
|
64
|
+
disabledDateTimeMessage: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]),
|
|
65
|
+
allowNonStepInput: _propTypes.default.bool
|
|
65
66
|
};
|
|
66
67
|
exports.propTypes = propTypes;
|
|
67
|
-
const allowedProps = ['description', 'dateRenderLabel', 'prevMonthLabel', 'nextMonthLabel', 'datePlaceholder', 'dateFormat', 'interaction', 'timeRenderLabel', 'timeStep', 'timeFormat', 'locale', 'timezone', 'invalidDateTimeMessage', 'messages', 'messageFormat', 'layout', 'rowSpacing', 'colSpacing', 'value', 'defaultValue', 'renderWeekdayLabels', 'isRequired', 'onChange', 'dateInputRef', 'timeInputRef', 'onBlur', 'disabledDates', 'disabledDateTimeMessage'];
|
|
68
|
+
const allowedProps = ['description', 'dateRenderLabel', 'prevMonthLabel', 'nextMonthLabel', 'datePlaceholder', 'dateFormat', 'interaction', 'timeRenderLabel', 'timeStep', 'timeFormat', 'locale', 'timezone', 'invalidDateTimeMessage', 'messages', 'messageFormat', 'layout', 'rowSpacing', 'colSpacing', 'value', 'defaultValue', 'renderWeekdayLabels', 'isRequired', 'onChange', 'dateInputRef', 'timeInputRef', 'onBlur', 'disabledDates', 'disabledDateTimeMessage', 'allowNonStepInput'];
|
|
68
69
|
exports.allowedProps = allowedProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-date-time-input",
|
|
3
|
-
"version": "8.36.1-snapshot-
|
|
3
|
+
"version": "8.36.1-snapshot-26",
|
|
4
4
|
"description": "A UI component that allows to select date and time.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,26 +23,26 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.36.1-snapshot-
|
|
27
|
-
"@instructure/ui-test-locator": "8.36.1-snapshot-
|
|
28
|
-
"@instructure/ui-test-utils": "8.36.1-snapshot-
|
|
26
|
+
"@instructure/ui-babel-preset": "8.36.1-snapshot-26",
|
|
27
|
+
"@instructure/ui-test-locator": "8.36.1-snapshot-26",
|
|
28
|
+
"@instructure/ui-test-utils": "8.36.1-snapshot-26"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "^7.21.0",
|
|
32
|
-
"@instructure/debounce": "8.36.1-snapshot-
|
|
33
|
-
"@instructure/emotion": "8.36.1-snapshot-
|
|
34
|
-
"@instructure/ui-a11y-content": "8.36.1-snapshot-
|
|
35
|
-
"@instructure/ui-buttons": "8.36.1-snapshot-
|
|
36
|
-
"@instructure/ui-calendar": "8.36.1-snapshot-
|
|
37
|
-
"@instructure/ui-date-input": "8.36.1-snapshot-
|
|
38
|
-
"@instructure/ui-form-field": "8.36.1-snapshot-
|
|
39
|
-
"@instructure/ui-i18n": "8.36.1-snapshot-
|
|
40
|
-
"@instructure/ui-icons": "8.36.1-snapshot-
|
|
41
|
-
"@instructure/ui-prop-types": "8.36.1-snapshot-
|
|
42
|
-
"@instructure/ui-react-utils": "8.36.1-snapshot-
|
|
43
|
-
"@instructure/ui-testable": "8.36.1-snapshot-
|
|
44
|
-
"@instructure/ui-time-select": "8.36.1-snapshot-
|
|
45
|
-
"@instructure/ui-utils": "8.36.1-snapshot-
|
|
32
|
+
"@instructure/debounce": "8.36.1-snapshot-26",
|
|
33
|
+
"@instructure/emotion": "8.36.1-snapshot-26",
|
|
34
|
+
"@instructure/ui-a11y-content": "8.36.1-snapshot-26",
|
|
35
|
+
"@instructure/ui-buttons": "8.36.1-snapshot-26",
|
|
36
|
+
"@instructure/ui-calendar": "8.36.1-snapshot-26",
|
|
37
|
+
"@instructure/ui-date-input": "8.36.1-snapshot-26",
|
|
38
|
+
"@instructure/ui-form-field": "8.36.1-snapshot-26",
|
|
39
|
+
"@instructure/ui-i18n": "8.36.1-snapshot-26",
|
|
40
|
+
"@instructure/ui-icons": "8.36.1-snapshot-26",
|
|
41
|
+
"@instructure/ui-prop-types": "8.36.1-snapshot-26",
|
|
42
|
+
"@instructure/ui-react-utils": "8.36.1-snapshot-26",
|
|
43
|
+
"@instructure/ui-testable": "8.36.1-snapshot-26",
|
|
44
|
+
"@instructure/ui-time-select": "8.36.1-snapshot-26",
|
|
45
|
+
"@instructure/ui-utils": "8.36.1-snapshot-26",
|
|
46
46
|
"prop-types": "^15.8.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -47,6 +47,8 @@ render(<Example />)
|
|
|
47
47
|
|
|
48
48
|
#### A required DateInput with `stacked` layout that warns if the value in the past:
|
|
49
49
|
|
|
50
|
+
This sample code also allows the user to enter an arbitrary time value by setting `allowNonStepInput` to `true`.
|
|
51
|
+
|
|
50
52
|
```js
|
|
51
53
|
---
|
|
52
54
|
example: true
|
|
@@ -95,6 +97,7 @@ class Example extends React.Component {
|
|
|
95
97
|
value={this.state.value}
|
|
96
98
|
invalidDateTimeMessage="Invalid date!"
|
|
97
99
|
messages={this.state.messages}
|
|
100
|
+
allowNonStepInput={true}
|
|
98
101
|
isRequired
|
|
99
102
|
/>
|
|
100
103
|
</div>
|
|
@@ -60,7 +60,8 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
60
60
|
timeStep: 30,
|
|
61
61
|
messageFormat: DateTimeInput.DEFAULT_MESSAGE_FORMAT,
|
|
62
62
|
isRequired: false,
|
|
63
|
-
dateFormat: 'LL' // Localized date with full month, e.g. "August 6, 2014"
|
|
63
|
+
dateFormat: 'LL', // Localized date with full month, e.g. "August 6, 2014"
|
|
64
|
+
allowNonStepInput: false
|
|
64
65
|
} as const
|
|
65
66
|
|
|
66
67
|
declare context: React.ContextType<typeof ApplyLocaleContext>
|
|
@@ -515,7 +516,8 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
515
516
|
colSpacing,
|
|
516
517
|
isRequired,
|
|
517
518
|
interaction,
|
|
518
|
-
renderWeekdayLabels
|
|
519
|
+
renderWeekdayLabels,
|
|
520
|
+
allowNonStepInput
|
|
519
521
|
} = this.props
|
|
520
522
|
|
|
521
523
|
return (
|
|
@@ -573,6 +575,7 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
573
575
|
timezone={timezone}
|
|
574
576
|
inputRef={timeInputRef}
|
|
575
577
|
interaction={interaction}
|
|
578
|
+
allowNonStepInput={allowNonStepInput}
|
|
576
579
|
/>
|
|
577
580
|
</FormFieldGroup>
|
|
578
581
|
)
|
|
@@ -220,6 +220,15 @@ type DateTimeInputProps = {
|
|
|
220
220
|
* If not specified the component will show the `invalidDateTimeMessage`.
|
|
221
221
|
*/
|
|
222
222
|
disabledDateTimeMessage?: string | ((rawDateValue: string) => string)
|
|
223
|
+
/**
|
|
224
|
+
* Whether to allow the user to enter non-step divisible values in the time
|
|
225
|
+
* input field. Note that even if this is set to false one can enter non-step
|
|
226
|
+
* divisible values programmatically. The user will need to enter the value
|
|
227
|
+
* exactly (except for lower/uppercase) as specified by the `timeFormat` prop
|
|
228
|
+
* for it to be accepted.
|
|
229
|
+
* Default is `undefined` which equals to `false`
|
|
230
|
+
*/
|
|
231
|
+
allowNonStepInput?: boolean
|
|
223
232
|
}
|
|
224
233
|
|
|
225
234
|
type DateTimeInputState = {
|
|
@@ -288,7 +297,8 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
288
297
|
disabledDateTimeMessage: PropTypes.oneOfType([
|
|
289
298
|
PropTypes.string,
|
|
290
299
|
PropTypes.func
|
|
291
|
-
])
|
|
300
|
+
]),
|
|
301
|
+
allowNonStepInput: PropTypes.bool
|
|
292
302
|
}
|
|
293
303
|
|
|
294
304
|
const allowedProps: AllowedPropKeys = [
|
|
@@ -319,7 +329,8 @@ const allowedProps: AllowedPropKeys = [
|
|
|
319
329
|
'timeInputRef',
|
|
320
330
|
'onBlur',
|
|
321
331
|
'disabledDates',
|
|
322
|
-
'disabledDateTimeMessage'
|
|
332
|
+
'disabledDateTimeMessage',
|
|
333
|
+
'allowNonStepInput'
|
|
323
334
|
]
|
|
324
335
|
|
|
325
336
|
export type { DateTimeInputProps, DateTimeInputState }
|