@instructure/ui-date-time-input 10.26.1 → 11.0.1-snapshot-0
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 +30 -1
- package/es/DateTimeInput/index.js +13 -6
- package/es/DateTimeInput/props.js +1 -49
- package/lib/DateTimeInput/index.js +13 -5
- package/lib/DateTimeInput/props.js +1 -50
- package/package.json +16 -19
- package/src/DateTimeInput/index.tsx +2 -4
- package/src/DateTimeInput/props.ts +2 -75
- package/tsconfig.build.json +0 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateTimeInput/index.d.ts +0 -1
- package/types/DateTimeInput/index.d.ts.map +1 -1
- package/types/DateTimeInput/props.d.ts +2 -3
- 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
|
-
## [
|
|
6
|
+
## [11.0.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v11.0.0...v11.0.1-snapshot-0) (2025-10-07)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-date-time-input
|
|
9
9
|
|
|
@@ -11,6 +11,35 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
# [11.0.0](https://github.com/instructure/instructure-ui/compare/v10.26.0...v11.0.0) (2025-10-06)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* **many:** InstUI v11 contains the following breaking changes:
|
|
25
|
+
- React 16 and 17 are no longer supported
|
|
26
|
+
- remove `PropTypes` from all packages
|
|
27
|
+
- remove `CodeEditor` component
|
|
28
|
+
- remove `@instui/theme-registry` package
|
|
29
|
+
- remove `@testable`, `@experimental`, `@hack` decorators
|
|
30
|
+
- InstUISettingsProvider's `as` prop is removed
|
|
31
|
+
- `canvas.use()`, `canvasHighContrast.use()` functions are removed
|
|
32
|
+
- `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
|
|
33
|
+
- `variables` field on theme objects are removed
|
|
34
|
+
- remove deprecated props from Table: Row's `isStacked`, Body's
|
|
35
|
+
`isStacked`, `hover`, and `headers`
|
|
36
|
+
- `Table`'s `caption` prop is now required
|
|
37
|
+
- `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
14
43
|
# [10.26.0](https://github.com/instructure/instructure-ui/compare/v10.25.0...v10.26.0) (2025-10-01)
|
|
15
44
|
|
|
16
45
|
**Note:** Version bump only for package @instructure/ui-date-time-input
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _DateTimeInput, _IconArrowOpenStartSo, _IconArrowOpenEndSoli;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -29,11 +29,10 @@ import { FormFieldGroup } from '@instructure/ui-form-field';
|
|
|
29
29
|
import { DateInput } from '@instructure/ui-date-input';
|
|
30
30
|
import { TimeSelect } from '@instructure/ui-time-select';
|
|
31
31
|
import { Calendar } from '@instructure/ui-calendar';
|
|
32
|
-
import { testable } from '@instructure/ui-testable';
|
|
33
32
|
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
34
33
|
import { IconButton } from '@instructure/ui-buttons';
|
|
35
34
|
import { IconArrowOpenEndSolid, IconArrowOpenStartSolid } from '@instructure/ui-icons';
|
|
36
|
-
import {
|
|
35
|
+
import { allowedProps } from './props';
|
|
37
36
|
import { error } from '@instructure/console';
|
|
38
37
|
|
|
39
38
|
/**
|
|
@@ -42,7 +41,7 @@ category: components
|
|
|
42
41
|
---
|
|
43
42
|
**/
|
|
44
43
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
45
|
-
|
|
44
|
+
class DateTimeInput extends Component {
|
|
46
45
|
constructor(props) {
|
|
47
46
|
super(props);
|
|
48
47
|
// State needs to be calculated because render could be called before
|
|
@@ -474,6 +473,7 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_DateTimeInput = class Da
|
|
|
474
473
|
elementRef: this.handleRef,
|
|
475
474
|
isGroup: false,
|
|
476
475
|
messages: [...(showMessages && this.state.message ? [this.state.message] : []), ...(messages || [])],
|
|
476
|
+
"data-cid": "DateTimeInput",
|
|
477
477
|
children: [_jsx(DateInput, {
|
|
478
478
|
display: "block",
|
|
479
479
|
value: this.state.dateInputText,
|
|
@@ -521,7 +521,13 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_DateTimeInput = class Da
|
|
|
521
521
|
})]
|
|
522
522
|
});
|
|
523
523
|
}
|
|
524
|
-
}
|
|
524
|
+
}
|
|
525
|
+
_DateTimeInput = DateTimeInput;
|
|
526
|
+
DateTimeInput.displayName = "DateTimeInput";
|
|
527
|
+
// extra verbose localized date and time
|
|
528
|
+
DateTimeInput.DEFAULT_MESSAGE_FORMAT = 'LLLL';
|
|
529
|
+
DateTimeInput.allowedProps = allowedProps;
|
|
530
|
+
DateTimeInput.defaultProps = {
|
|
525
531
|
layout: 'inline',
|
|
526
532
|
colSpacing: 'medium',
|
|
527
533
|
rowSpacing: 'small',
|
|
@@ -532,6 +538,7 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_DateTimeInput = class Da
|
|
|
532
538
|
dateFormat: 'LL',
|
|
533
539
|
// Localized date with full month, e.g. "August 6, 2014"
|
|
534
540
|
allowNonStepInput: false
|
|
535
|
-
}
|
|
541
|
+
};
|
|
542
|
+
DateTimeInput.contextType = ApplyLocaleContext;
|
|
536
543
|
export default DateTimeInput;
|
|
537
544
|
export { DateTimeInput };
|
|
@@ -22,53 +22,5 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import { FormPropTypes } from '@instructure/ui-form-field';
|
|
26
|
-
import { I18nPropTypes } from '@instructure/ui-i18n';
|
|
27
|
-
import PropTypes from 'prop-types';
|
|
28
|
-
import { controllable } from '@instructure/ui-prop-types';
|
|
29
|
-
const hourMinuteValidator = function (props, propName, componentName, location) {
|
|
30
|
-
const propValue = props[propName];
|
|
31
|
-
if (typeof propValue === 'undefined' || propValue === '') return null;
|
|
32
|
-
const hourMinuteRegex = /^\d{2}:\d{2}$/;
|
|
33
|
-
if (typeof propValue === 'string' && !propValue.match(hourMinuteRegex)) {
|
|
34
|
-
return new Error(`Invalid ${location} \`${propName}\` \`${propValue}\` supplied to \`${componentName}\`, expected ` + `a HH:MM formatted string.`);
|
|
35
|
-
}
|
|
36
|
-
return null;
|
|
37
|
-
};
|
|
38
|
-
const propTypes = {
|
|
39
|
-
description: PropTypes.node.isRequired,
|
|
40
|
-
dateRenderLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
|
|
41
|
-
prevMonthLabel: PropTypes.string.isRequired,
|
|
42
|
-
nextMonthLabel: PropTypes.string.isRequired,
|
|
43
|
-
datePlaceholder: PropTypes.string,
|
|
44
|
-
timePlaceholder: PropTypes.string,
|
|
45
|
-
dateFormat: PropTypes.string,
|
|
46
|
-
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
47
|
-
timeRenderLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
|
|
48
|
-
timeStep: PropTypes.oneOf([5, 10, 15, 20, 30, 60]),
|
|
49
|
-
timeFormat: PropTypes.string,
|
|
50
|
-
locale: PropTypes.string,
|
|
51
|
-
timezone: PropTypes.string,
|
|
52
|
-
invalidDateTimeMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired,
|
|
53
|
-
showMessages: PropTypes.bool,
|
|
54
|
-
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
55
|
-
messageFormat: PropTypes.string,
|
|
56
|
-
layout: PropTypes.oneOf(['stacked', 'columns', 'inline']),
|
|
57
|
-
rowSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
|
|
58
|
-
colSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
|
|
59
|
-
value: controllable(I18nPropTypes.iso8601, 'onChange'),
|
|
60
|
-
defaultValue: I18nPropTypes.iso8601,
|
|
61
|
-
renderWeekdayLabels: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.node])),
|
|
62
|
-
isRequired: PropTypes.bool,
|
|
63
|
-
onChange: PropTypes.func,
|
|
64
|
-
dateInputRef: PropTypes.func,
|
|
65
|
-
timeInputRef: PropTypes.func,
|
|
66
|
-
onBlur: PropTypes.func,
|
|
67
|
-
disabledDates: PropTypes.oneOfType([PropTypes.func, PropTypes.arrayOf(PropTypes.string)]),
|
|
68
|
-
disabledDateTimeMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
69
|
-
allowNonStepInput: PropTypes.bool,
|
|
70
|
-
reset: PropTypes.func,
|
|
71
|
-
initialTimeForNewDate: hourMinuteValidator
|
|
72
|
-
};
|
|
73
25
|
const allowedProps = ['description', 'dateRenderLabel', 'prevMonthLabel', 'nextMonthLabel', 'datePlaceholder', 'timePlaceholder', 'dateFormat', 'interaction', 'timeRenderLabel', 'timeStep', 'timeFormat', 'locale', 'timezone', 'invalidDateTimeMessage', 'showMessages', 'messages', 'messageFormat', 'layout', 'rowSpacing', 'colSpacing', 'value', 'defaultValue', 'renderWeekdayLabels', 'isRequired', 'onChange', 'dateInputRef', 'timeInputRef', 'onBlur', 'disabledDates', 'disabledDateTimeMessage', 'allowNonStepInput', 'reset'];
|
|
74
|
-
export {
|
|
26
|
+
export { allowedProps };
|
|
@@ -12,7 +12,6 @@ var _FormFieldGroup = require("@instructure/ui-form-field/lib/FormFieldGroup");
|
|
|
12
12
|
var _DateInput = require("@instructure/ui-date-input/lib/DateInput");
|
|
13
13
|
var _TimeSelect = require("@instructure/ui-time-select/lib/TimeSelect");
|
|
14
14
|
var _Calendar = require("@instructure/ui-calendar/lib/Calendar");
|
|
15
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
16
15
|
var _AccessibleContent = require("@instructure/ui-a11y-content/lib/AccessibleContent");
|
|
17
16
|
var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
|
|
18
17
|
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
@@ -20,7 +19,7 @@ var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/IconArrowOpenS
|
|
|
20
19
|
var _props = require("./props");
|
|
21
20
|
var _console = require("@instructure/console");
|
|
22
21
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
23
|
-
var
|
|
22
|
+
var _DateTimeInput, _IconArrowOpenStartSo, _IconArrowOpenEndSoli;
|
|
24
23
|
/*
|
|
25
24
|
* The MIT License (MIT)
|
|
26
25
|
*
|
|
@@ -49,7 +48,7 @@ var _dec, _class, _DateTimeInput, _IconArrowOpenStartSo, _IconArrowOpenEndSoli;
|
|
|
49
48
|
category: components
|
|
50
49
|
---
|
|
51
50
|
**/
|
|
52
|
-
|
|
51
|
+
class DateTimeInput extends _react.Component {
|
|
53
52
|
constructor(props) {
|
|
54
53
|
super(props);
|
|
55
54
|
// State needs to be calculated because render could be called before
|
|
@@ -481,6 +480,7 @@ let DateTimeInput = exports.DateTimeInput = (_dec = (0, _testable.testable)(), _
|
|
|
481
480
|
elementRef: this.handleRef,
|
|
482
481
|
isGroup: false,
|
|
483
482
|
messages: [...(showMessages && this.state.message ? [this.state.message] : []), ...(messages || [])],
|
|
483
|
+
"data-cid": "DateTimeInput",
|
|
484
484
|
children: [(0, _jsxRuntime.jsx)(_DateInput.DateInput, {
|
|
485
485
|
display: "block",
|
|
486
486
|
value: this.state.dateInputText,
|
|
@@ -528,7 +528,14 @@ let DateTimeInput = exports.DateTimeInput = (_dec = (0, _testable.testable)(), _
|
|
|
528
528
|
})]
|
|
529
529
|
});
|
|
530
530
|
}
|
|
531
|
-
}
|
|
531
|
+
}
|
|
532
|
+
exports.DateTimeInput = DateTimeInput;
|
|
533
|
+
_DateTimeInput = DateTimeInput;
|
|
534
|
+
DateTimeInput.displayName = "DateTimeInput";
|
|
535
|
+
// extra verbose localized date and time
|
|
536
|
+
DateTimeInput.DEFAULT_MESSAGE_FORMAT = 'LLLL';
|
|
537
|
+
DateTimeInput.allowedProps = _props.allowedProps;
|
|
538
|
+
DateTimeInput.defaultProps = {
|
|
532
539
|
layout: 'inline',
|
|
533
540
|
colSpacing: 'medium',
|
|
534
541
|
rowSpacing: 'small',
|
|
@@ -539,5 +546,6 @@ let DateTimeInput = exports.DateTimeInput = (_dec = (0, _testable.testable)(), _
|
|
|
539
546
|
dateFormat: 'LL',
|
|
540
547
|
// Localized date with full month, e.g. "August 6, 2014"
|
|
541
548
|
allowNonStepInput: false
|
|
542
|
-
}
|
|
549
|
+
};
|
|
550
|
+
DateTimeInput.contextType = _ApplyLocaleContext.ApplyLocaleContext;
|
|
543
551
|
var _default = exports.default = DateTimeInput;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
|
|
9
|
-
var _I18nPropTypes = require("@instructure/ui-i18n/lib/I18nPropTypes.js");
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
6
|
+
exports.allowedProps = void 0;
|
|
12
7
|
/*
|
|
13
8
|
* The MIT License (MIT)
|
|
14
9
|
*
|
|
@@ -33,48 +28,4 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
|
33
28
|
* SOFTWARE.
|
|
34
29
|
*/
|
|
35
30
|
|
|
36
|
-
const hourMinuteValidator = function (props, propName, componentName, location) {
|
|
37
|
-
const propValue = props[propName];
|
|
38
|
-
if (typeof propValue === 'undefined' || propValue === '') return null;
|
|
39
|
-
const hourMinuteRegex = /^\d{2}:\d{2}$/;
|
|
40
|
-
if (typeof propValue === 'string' && !propValue.match(hourMinuteRegex)) {
|
|
41
|
-
return new Error(`Invalid ${location} \`${propName}\` \`${propValue}\` supplied to \`${componentName}\`, expected ` + `a HH:MM formatted string.`);
|
|
42
|
-
}
|
|
43
|
-
return null;
|
|
44
|
-
};
|
|
45
|
-
const propTypes = exports.propTypes = {
|
|
46
|
-
description: _propTypes.default.node.isRequired,
|
|
47
|
-
dateRenderLabel: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]).isRequired,
|
|
48
|
-
prevMonthLabel: _propTypes.default.string.isRequired,
|
|
49
|
-
nextMonthLabel: _propTypes.default.string.isRequired,
|
|
50
|
-
datePlaceholder: _propTypes.default.string,
|
|
51
|
-
timePlaceholder: _propTypes.default.string,
|
|
52
|
-
dateFormat: _propTypes.default.string,
|
|
53
|
-
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
54
|
-
timeRenderLabel: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]).isRequired,
|
|
55
|
-
timeStep: _propTypes.default.oneOf([5, 10, 15, 20, 30, 60]),
|
|
56
|
-
timeFormat: _propTypes.default.string,
|
|
57
|
-
locale: _propTypes.default.string,
|
|
58
|
-
timezone: _propTypes.default.string,
|
|
59
|
-
invalidDateTimeMessage: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]).isRequired,
|
|
60
|
-
showMessages: _propTypes.default.bool,
|
|
61
|
-
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
|
|
62
|
-
messageFormat: _propTypes.default.string,
|
|
63
|
-
layout: _propTypes.default.oneOf(['stacked', 'columns', 'inline']),
|
|
64
|
-
rowSpacing: _propTypes.default.oneOf(['none', 'small', 'medium', 'large']),
|
|
65
|
-
colSpacing: _propTypes.default.oneOf(['none', 'small', 'medium', 'large']),
|
|
66
|
-
value: (0, _controllable.controllable)(_I18nPropTypes.I18nPropTypes.iso8601, 'onChange'),
|
|
67
|
-
defaultValue: _I18nPropTypes.I18nPropTypes.iso8601,
|
|
68
|
-
renderWeekdayLabels: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node])),
|
|
69
|
-
isRequired: _propTypes.default.bool,
|
|
70
|
-
onChange: _propTypes.default.func,
|
|
71
|
-
dateInputRef: _propTypes.default.func,
|
|
72
|
-
timeInputRef: _propTypes.default.func,
|
|
73
|
-
onBlur: _propTypes.default.func,
|
|
74
|
-
disabledDates: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
75
|
-
disabledDateTimeMessage: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]),
|
|
76
|
-
allowNonStepInput: _propTypes.default.bool,
|
|
77
|
-
reset: _propTypes.default.func,
|
|
78
|
-
initialTimeForNewDate: hourMinuteValidator
|
|
79
|
-
};
|
|
80
31
|
const allowedProps = exports.allowedProps = ['description', 'dateRenderLabel', 'prevMonthLabel', 'nextMonthLabel', 'datePlaceholder', 'timePlaceholder', 'dateFormat', 'interaction', 'timeRenderLabel', 'timeStep', 'timeFormat', 'locale', 'timezone', 'invalidDateTimeMessage', 'showMessages', 'messages', 'messageFormat', 'layout', 'rowSpacing', 'colSpacing', 'value', 'defaultValue', 'renderWeekdayLabels', 'isRequired', 'onChange', 'dateInputRef', 'timeInputRef', 'onBlur', 'disabledDates', 'disabledDateTimeMessage', 'allowNonStepInput', 'reset'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-date-time-input",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.1-snapshot-0",
|
|
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,32 +23,29 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "
|
|
26
|
+
"@instructure/ui-babel-preset": "11.0.1-snapshot-0",
|
|
27
27
|
"@testing-library/jest-dom": "^6.6.3",
|
|
28
|
-
"@testing-library/react": "
|
|
28
|
+
"@testing-library/react": "15.0.7",
|
|
29
29
|
"@testing-library/user-event": "^14.6.1",
|
|
30
30
|
"vitest": "^3.2.2"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.27.6",
|
|
34
|
-
"@instructure/console": "
|
|
35
|
-
"@instructure/shared-types": "
|
|
36
|
-
"@instructure/ui-a11y-content": "
|
|
37
|
-
"@instructure/ui-buttons": "
|
|
38
|
-
"@instructure/ui-calendar": "
|
|
39
|
-
"@instructure/ui-date-input": "
|
|
40
|
-
"@instructure/ui-form-field": "
|
|
41
|
-
"@instructure/ui-i18n": "
|
|
42
|
-
"@instructure/ui-icons": "
|
|
43
|
-
"@instructure/ui-
|
|
44
|
-
"@instructure/ui-
|
|
45
|
-
"@instructure/ui-
|
|
46
|
-
"@instructure/ui-time-select": "10.26.1",
|
|
47
|
-
"@instructure/ui-utils": "10.26.1",
|
|
48
|
-
"prop-types": "^15.8.1"
|
|
34
|
+
"@instructure/console": "11.0.1-snapshot-0",
|
|
35
|
+
"@instructure/shared-types": "11.0.1-snapshot-0",
|
|
36
|
+
"@instructure/ui-a11y-content": "11.0.1-snapshot-0",
|
|
37
|
+
"@instructure/ui-buttons": "11.0.1-snapshot-0",
|
|
38
|
+
"@instructure/ui-calendar": "11.0.1-snapshot-0",
|
|
39
|
+
"@instructure/ui-date-input": "11.0.1-snapshot-0",
|
|
40
|
+
"@instructure/ui-form-field": "11.0.1-snapshot-0",
|
|
41
|
+
"@instructure/ui-i18n": "11.0.1-snapshot-0",
|
|
42
|
+
"@instructure/ui-icons": "11.0.1-snapshot-0",
|
|
43
|
+
"@instructure/ui-react-utils": "11.0.1-snapshot-0",
|
|
44
|
+
"@instructure/ui-time-select": "11.0.1-snapshot-0",
|
|
45
|
+
"@instructure/ui-utils": "11.0.1-snapshot-0"
|
|
49
46
|
},
|
|
50
47
|
"peerDependencies": {
|
|
51
|
-
"react": ">=
|
|
48
|
+
"react": ">=18 <=19"
|
|
52
49
|
},
|
|
53
50
|
"publishConfig": {
|
|
54
51
|
"access": "public"
|
|
@@ -31,7 +31,6 @@ import type { FormMessage } from '@instructure/ui-form-field'
|
|
|
31
31
|
import { DateInput } from '@instructure/ui-date-input'
|
|
32
32
|
import { TimeSelect } from '@instructure/ui-time-select'
|
|
33
33
|
import { Calendar } from '@instructure/ui-calendar'
|
|
34
|
-
import { testable } from '@instructure/ui-testable'
|
|
35
34
|
import { AccessibleContent } from '@instructure/ui-a11y-content'
|
|
36
35
|
import { IconButton } from '@instructure/ui-buttons'
|
|
37
36
|
import {
|
|
@@ -39,7 +38,7 @@ import {
|
|
|
39
38
|
IconArrowOpenStartSolid
|
|
40
39
|
} from '@instructure/ui-icons'
|
|
41
40
|
import type { DateTimeInputProps, DateTimeInputState } from './props'
|
|
42
|
-
import {
|
|
41
|
+
import { allowedProps } from './props'
|
|
43
42
|
import { error } from '@instructure/console'
|
|
44
43
|
|
|
45
44
|
/**
|
|
@@ -47,11 +46,9 @@ import { error } from '@instructure/console'
|
|
|
47
46
|
category: components
|
|
48
47
|
---
|
|
49
48
|
**/
|
|
50
|
-
@testable()
|
|
51
49
|
class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
52
50
|
// extra verbose localized date and time
|
|
53
51
|
private static readonly DEFAULT_MESSAGE_FORMAT = 'LLLL'
|
|
54
|
-
static propTypes = propTypes
|
|
55
52
|
static allowedProps = allowedProps
|
|
56
53
|
static defaultProps = {
|
|
57
54
|
layout: 'inline',
|
|
@@ -591,6 +588,7 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
591
588
|
...(showMessages && this.state.message ? [this.state.message] : []),
|
|
592
589
|
...(messages || [])
|
|
593
590
|
]}
|
|
591
|
+
data-cid="DateTimeInput"
|
|
594
592
|
>
|
|
595
593
|
<DateInput
|
|
596
594
|
display="block"
|
|
@@ -23,14 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { SyntheticEvent } from 'react'
|
|
26
|
-
import { FormPropTypes } from '@instructure/ui-form-field'
|
|
27
26
|
import type { FormMessage } from '@instructure/ui-form-field'
|
|
28
27
|
import type { InteractionType } from '@instructure/ui-react-utils'
|
|
29
|
-
import { I18nPropTypes } from '@instructure/ui-i18n'
|
|
30
28
|
import type { Moment } from '@instructure/ui-i18n'
|
|
31
|
-
import
|
|
32
|
-
import { controllable } from '@instructure/ui-prop-types'
|
|
33
|
-
import type { PropValidators, Renderable } from '@instructure/shared-types'
|
|
29
|
+
import type { Renderable } from '@instructure/shared-types'
|
|
34
30
|
|
|
35
31
|
type DateTimeInputProps = {
|
|
36
32
|
/**
|
|
@@ -281,75 +277,6 @@ type DateTimeInputState = {
|
|
|
281
277
|
type PropKeys = keyof DateTimeInputProps
|
|
282
278
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
283
279
|
|
|
284
|
-
const hourMinuteValidator: Validator<string> = function (
|
|
285
|
-
props,
|
|
286
|
-
propName,
|
|
287
|
-
componentName,
|
|
288
|
-
location
|
|
289
|
-
) {
|
|
290
|
-
const propValue = props[propName]
|
|
291
|
-
if (typeof propValue === 'undefined' || propValue === '') return null
|
|
292
|
-
|
|
293
|
-
const hourMinuteRegex = /^\d{2}:\d{2}$/
|
|
294
|
-
|
|
295
|
-
if (typeof propValue === 'string' && !propValue.match(hourMinuteRegex)) {
|
|
296
|
-
return new Error(
|
|
297
|
-
`Invalid ${location} \`${propName}\` \`${propValue}\` supplied to \`${componentName}\`, expected ` +
|
|
298
|
-
`a HH:MM formatted string.`
|
|
299
|
-
)
|
|
300
|
-
}
|
|
301
|
-
return null
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
305
|
-
description: PropTypes.node.isRequired,
|
|
306
|
-
dateRenderLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.node])
|
|
307
|
-
.isRequired,
|
|
308
|
-
prevMonthLabel: PropTypes.string.isRequired,
|
|
309
|
-
nextMonthLabel: PropTypes.string.isRequired,
|
|
310
|
-
datePlaceholder: PropTypes.string,
|
|
311
|
-
timePlaceholder: PropTypes.string,
|
|
312
|
-
dateFormat: PropTypes.string,
|
|
313
|
-
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
314
|
-
timeRenderLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.node])
|
|
315
|
-
.isRequired,
|
|
316
|
-
timeStep: PropTypes.oneOf([5, 10, 15, 20, 30, 60]),
|
|
317
|
-
timeFormat: PropTypes.string,
|
|
318
|
-
locale: PropTypes.string,
|
|
319
|
-
timezone: PropTypes.string,
|
|
320
|
-
invalidDateTimeMessage: PropTypes.oneOfType([
|
|
321
|
-
PropTypes.string,
|
|
322
|
-
PropTypes.func
|
|
323
|
-
]).isRequired,
|
|
324
|
-
showMessages: PropTypes.bool,
|
|
325
|
-
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
326
|
-
messageFormat: PropTypes.string,
|
|
327
|
-
layout: PropTypes.oneOf(['stacked', 'columns', 'inline']),
|
|
328
|
-
rowSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
|
|
329
|
-
colSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
|
|
330
|
-
value: controllable(I18nPropTypes.iso8601, 'onChange'),
|
|
331
|
-
defaultValue: I18nPropTypes.iso8601,
|
|
332
|
-
renderWeekdayLabels: PropTypes.arrayOf(
|
|
333
|
-
PropTypes.oneOfType([PropTypes.func, PropTypes.node])
|
|
334
|
-
),
|
|
335
|
-
isRequired: PropTypes.bool,
|
|
336
|
-
onChange: PropTypes.func,
|
|
337
|
-
dateInputRef: PropTypes.func,
|
|
338
|
-
timeInputRef: PropTypes.func,
|
|
339
|
-
onBlur: PropTypes.func,
|
|
340
|
-
disabledDates: PropTypes.oneOfType([
|
|
341
|
-
PropTypes.func,
|
|
342
|
-
PropTypes.arrayOf(PropTypes.string)
|
|
343
|
-
]),
|
|
344
|
-
disabledDateTimeMessage: PropTypes.oneOfType([
|
|
345
|
-
PropTypes.string,
|
|
346
|
-
PropTypes.func
|
|
347
|
-
]),
|
|
348
|
-
allowNonStepInput: PropTypes.bool,
|
|
349
|
-
reset: PropTypes.func,
|
|
350
|
-
initialTimeForNewDate: hourMinuteValidator
|
|
351
|
-
}
|
|
352
|
-
|
|
353
280
|
const allowedProps: AllowedPropKeys = [
|
|
354
281
|
'description',
|
|
355
282
|
'dateRenderLabel',
|
|
@@ -386,4 +313,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
386
313
|
]
|
|
387
314
|
|
|
388
315
|
export type { DateTimeInputProps, DateTimeInputState }
|
|
389
|
-
export {
|
|
316
|
+
export { allowedProps }
|
package/tsconfig.build.json
CHANGED
|
@@ -15,10 +15,8 @@
|
|
|
15
15
|
{ "path": "../ui-i18n/tsconfig.build.json" },
|
|
16
16
|
{ "path": "../ui-icons/tsconfig.build.json" },
|
|
17
17
|
{ "path": "../ui-a11y-content/tsconfig.build.json" },
|
|
18
|
-
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
19
18
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
20
19
|
{ "path": "../shared-types/tsconfig.build.json" },
|
|
21
|
-
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
22
20
|
{ "path": "../ui-time-select/tsconfig.build.json" },
|
|
23
21
|
{ "path": "../ui-utils/tsconfig.build.json" },
|
|
24
22
|
{ "path": "../console/tsconfig.build.json" }
|