@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 CHANGED
@@ -3,30 +3,17 @@
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
- ## [10.26.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1-snapshot-2) (2025-10-06)
6
+ ## [10.26.2](https://github.com/instructure/instructure-ui/compare/v10.26.1...v10.26.2) (2025-10-13)
7
7
 
8
+ **Note:** Version bump only for package @instructure/ui-date-input
8
9
 
9
- ### Features
10
10
 
11
- * **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
12
11
 
13
12
 
14
- ### BREAKING CHANGES
15
13
 
16
- * **many:** InstUI v11 contains the following breaking changes:
17
- - React 16 and 17 are no longer supported
18
- - remove `PropTypes` from all packages
19
- - remove `CodeEditor` component
20
- - remove `@instui/theme-registry` package
21
- - remove `@testable`, `@experimental`, `@hack` decorators
22
- - InstUISettingsProvider's `as` prop is removed
23
- - `canvas.use()`, `canvasHighContrast.use()` functions are removed
24
- - `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
25
- - `variables` field on theme objects are removed
26
- - remove deprecated props from Table: Row's `isStacked`, Body's
27
- `isStacked`, `hover`, and `headers`
28
- - `Table`'s `caption` prop is now required
29
- - `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
14
+ ## [10.26.1](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
15
+
16
+ **Note:** Version bump only for package @instructure/ui-date-input
30
17
 
31
18
 
32
19
 
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["renderLabel", "value", "placeholder", "onBlur", "isRequired", "size", "isInline", "layout", "width", "onRequestValidateDate", "onRequestShowCalendar", "onRequestHideCalendar", "onRequestSelectNextDay", "onRequestSelectPrevDay", "onRequestRenderNextMonth", "onRequestRenderPrevMonth"],
3
3
  _excluded2 = ["ref"];
4
- var _dec, _class, _DateInput, _IconCalendarMonthLin;
4
+ var _dec, _dec2, _class, _DateInput, _IconCalendarMonthLin;
5
5
  /*
6
6
  * The MIT License (MIT)
7
7
  *
@@ -34,17 +34,18 @@ import { Selectable } from '@instructure/ui-selectable';
34
34
  import { TextInput } from '@instructure/ui-text-input';
35
35
  import { createChainedFunction } from '@instructure/ui-utils';
36
36
  import { getInteraction, callRenderProp, safeCloneElement, passthroughProps } from '@instructure/ui-react-utils';
37
+ import { testable } from '@instructure/ui-testable';
37
38
  import { DateTime, Locale } from '@instructure/ui-i18n';
38
39
  import { withStyle } from '@instructure/emotion';
39
40
  import generateStyle from './styles';
40
- import { allowedProps } from './props';
41
+ import { propTypes, allowedProps } from './props';
41
42
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
42
43
  /**
43
44
  ---
44
45
  category: components
45
46
  ---
46
47
  **/
47
- let DateInput = (_dec = withStyle(generateStyle, null), _dec(_class = (_DateInput = class DateInput extends Component {
48
+ let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_class = _dec2(_class = (_DateInput = class DateInput extends Component {
48
49
  constructor(...args) {
49
50
  super(...args);
50
51
  this.state = {
@@ -368,10 +369,7 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec(_class = (_DateInpu
368
369
  ...getRootProps({
369
370
  css: styles === null || styles === void 0 ? void 0 : styles.dateInput
370
371
  }),
371
- ref: el => {
372
- this.ref = el;
373
- },
374
- "data-cid": "DateInput",
372
+ ref: el => this.ref = el,
375
373
  children: [this.renderInput({
376
374
  getInputProps,
377
375
  getTriggerProps
@@ -393,7 +391,7 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec(_class = (_DateInpu
393
391
  })
394
392
  });
395
393
  }
396
- }, _DateInput.displayName = "DateInput", _DateInput.componentId = 'DateInput', _DateInput.Day = Calendar.Day, _DateInput.allowedProps = allowedProps, _DateInput.defaultProps = {
394
+ }, _DateInput.displayName = "DateInput", _DateInput.componentId = 'DateInput', _DateInput.Day = Calendar.Day, _DateInput.propTypes = propTypes, _DateInput.allowedProps = allowedProps, _DateInput.defaultProps = {
397
395
  value: '',
398
396
  size: 'medium',
399
397
  onBlur: () => {},
@@ -404,6 +402,6 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec(_class = (_DateInpu
404
402
  display: 'inline-block',
405
403
  placement: 'bottom center',
406
404
  isShowingCalendar: false
407
- }, _DateInput)) || _class);
405
+ }, _DateInput)) || _class) || _class);
408
406
  export default DateInput;
409
407
  export { DateInput };
@@ -22,5 +22,48 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import PropTypes from 'prop-types';
26
+ import { controllable, Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
27
+ import { FormPropTypes } from '@instructure/ui-form-field';
28
+ import { PositionPropTypes } from '@instructure/ui-position';
29
+ import { Calendar } from '@instructure/ui-calendar';
30
+ const propTypes = {
31
+ renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
32
+ value: controllable(PropTypes.string),
33
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
34
+ placeholder: PropTypes.string,
35
+ onChange: PropTypes.func,
36
+ onBlur: PropTypes.func,
37
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
38
+ isRequired: PropTypes.bool,
39
+ isInline: PropTypes.bool,
40
+ assistiveText: PropTypes.string,
41
+ layout: PropTypes.oneOf(['stacked', 'inline']),
42
+ width: PropTypes.string,
43
+ display: PropTypes.oneOf(['inline-block', 'block']),
44
+ inputRef: PropTypes.func,
45
+ messages: PropTypes.arrayOf(FormPropTypes.message),
46
+ placement: PositionPropTypes.placement,
47
+ isShowingCalendar: PropTypes.bool,
48
+ onRequestValidateDate: PropTypes.func,
49
+ onRequestShowCalendar: PropTypes.func,
50
+ onRequestHideCalendar: PropTypes.func,
51
+ onRequestSelectNextDay: PropTypes.func,
52
+ onRequestSelectPrevDay: PropTypes.func,
53
+ onRequestRenderNextMonth: PropTypes.func,
54
+ onRequestRenderPrevMonth: PropTypes.func,
55
+ renderNavigationLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
56
+ renderWeekdayLabels: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.node])),
57
+ renderNextMonthButton: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
58
+ renderPrevMonthButton: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
59
+ children: ChildrenPropTypes.oneOf([Calendar.Day]),
60
+ disabledDates: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
61
+ currentDate: PropTypes.string,
62
+ disabledDateErrorMessage: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
63
+ invalidDateErrorMessage: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
64
+ locale: PropTypes.string,
65
+ timezone: PropTypes.string,
66
+ withYearPicker: PropTypes.object
67
+ };
25
68
  const allowedProps = ['renderLabel', 'value', 'size', 'placeholder', 'onChange', 'onBlur', 'interaction', 'isRequired', 'isInline', 'assistiveText', 'layout', 'width', 'display', 'inputRef', 'messages', 'placement', 'isShowingCalendar', 'onRequestValidateDate', 'onRequestShowCalendar', 'onRequestHideCalendar', 'onRequestSelectNextDay', 'onRequestSelectPrevDay', 'onRequestRenderNextMonth', 'onRequestRenderPrevMonth', 'renderNavigationLabel', 'renderWeekdayLabels', 'renderNextMonthButton', 'renderPrevMonthButton', 'children', 'disabledDates', 'currentDate', 'disabledDateErrorMessage', 'invalidDateErrorMessage', 'locale', 'timezone'];
26
- export { allowedProps };
69
+ export { propTypes, allowedProps };
@@ -32,6 +32,7 @@ import { Popover } from '@instructure/ui-popover';
32
32
  import { TextInput } from '@instructure/ui-text-input';
33
33
  import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils';
34
34
  import { getLocale, getTimezone } from '@instructure/ui-i18n';
35
+ import { propTypes } from './props';
35
36
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
36
37
  function parseLocaleDate(dateString = '', locale, timeZone) {
37
38
  // This function may seem complicated but it basically does one thing:
@@ -105,6 +106,7 @@ function parseLocaleDate(dateString = '', locale, timeZone) {
105
106
  category: components
106
107
  ---
107
108
  **/
109
+ // eslint-disable-next-line react/display-name
108
110
  const DateInput2 = /*#__PURE__*/forwardRef(({
109
111
  renderLabel,
110
112
  screenReaderLabels,
@@ -286,8 +288,6 @@ const DateInput2 = /*#__PURE__*/forwardRef(({
286
288
  })
287
289
  });
288
290
  });
289
-
290
- // TODO this is probably needed?
291
- DateInput2.displayName = 'DateInput2';
291
+ DateInput2.propTypes = propTypes;
292
292
  export default DateInput2;
293
293
  export { DateInput2 };
@@ -1 +1,51 @@
1
- export {};
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import PropTypes from 'prop-types';
26
+ import { controllable } from '@instructure/ui-prop-types';
27
+ import { FormPropTypes } from '@instructure/ui-form-field';
28
+ const propTypes = {
29
+ renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
30
+ screenReaderLabels: PropTypes.object.isRequired,
31
+ value: controllable(PropTypes.string),
32
+ placeholder: PropTypes.string,
33
+ onChange: PropTypes.func,
34
+ onBlur: PropTypes.func,
35
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
36
+ isRequired: PropTypes.bool,
37
+ isInline: PropTypes.bool,
38
+ width: PropTypes.string,
39
+ messages: PropTypes.arrayOf(FormPropTypes.message),
40
+ invalidDateErrorMessage: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
41
+ locale: PropTypes.string,
42
+ timezone: PropTypes.string,
43
+ withYearPicker: PropTypes.object,
44
+ dateFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
45
+ onRequestValidateDate: PropTypes.func,
46
+ renderCalendarIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
47
+ margin: PropTypes.string,
48
+ disabledDates: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
49
+ inputRef: PropTypes.func
50
+ };
51
+ export { propTypes };
@@ -17,6 +17,7 @@ var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js
17
17
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
18
18
  var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
19
19
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
20
+ var _testable = require("@instructure/ui-testable/lib/testable.js");
20
21
  var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
21
22
  var _Locale = require("@instructure/ui-i18n/lib/Locale.js");
22
23
  var _emotion = require("@instructure/emotion");
@@ -25,7 +26,7 @@ var _props2 = require("./props");
25
26
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
26
27
  const _excluded = ["renderLabel", "value", "placeholder", "onBlur", "isRequired", "size", "isInline", "layout", "width", "onRequestValidateDate", "onRequestShowCalendar", "onRequestHideCalendar", "onRequestSelectNextDay", "onRequestSelectPrevDay", "onRequestRenderNextMonth", "onRequestRenderPrevMonth"],
27
28
  _excluded2 = ["ref"];
28
- var _dec, _class, _DateInput, _IconCalendarMonthLin;
29
+ var _dec, _dec2, _class, _DateInput, _IconCalendarMonthLin;
29
30
  /*
30
31
  * The MIT License (MIT)
31
32
  *
@@ -54,7 +55,7 @@ var _dec, _class, _DateInput, _IconCalendarMonthLin;
54
55
  category: components
55
56
  ---
56
57
  **/
57
- let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class = (_DateInput = class DateInput extends _react.Component {
58
+ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_DateInput = class DateInput extends _react.Component {
58
59
  constructor(...args) {
59
60
  super(...args);
60
61
  this.state = {
@@ -378,10 +379,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
378
379
  ...getRootProps({
379
380
  css: styles === null || styles === void 0 ? void 0 : styles.dateInput
380
381
  }),
381
- ref: el => {
382
- this.ref = el;
383
- },
384
- "data-cid": "DateInput",
382
+ ref: el => this.ref = el,
385
383
  children: [this.renderInput({
386
384
  getInputProps,
387
385
  getTriggerProps
@@ -403,7 +401,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
403
401
  })
404
402
  });
405
403
  }
406
- }, _DateInput.displayName = "DateInput", _DateInput.componentId = 'DateInput', _DateInput.Day = _Calendar.Calendar.Day, _DateInput.allowedProps = _props2.allowedProps, _DateInput.defaultProps = {
404
+ }, _DateInput.displayName = "DateInput", _DateInput.componentId = 'DateInput', _DateInput.Day = _Calendar.Calendar.Day, _DateInput.propTypes = _props2.propTypes, _DateInput.allowedProps = _props2.allowedProps, _DateInput.defaultProps = {
407
405
  value: '',
408
406
  size: 'medium',
409
407
  onBlur: () => {},
@@ -414,5 +412,5 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
414
412
  display: 'inline-block',
415
413
  placement: 'bottom center',
416
414
  isShowingCalendar: false
417
- }, _DateInput)) || _class);
415
+ }, _DateInput)) || _class) || _class);
418
416
  var _default = exports.default = DateInput;
@@ -1,9 +1,16 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.allowedProps = void 0;
7
+ exports.propTypes = exports.allowedProps = void 0;
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
10
+ var _Children = require("@instructure/ui-prop-types/lib/Children.js");
11
+ var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
12
+ var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
13
+ var _Calendar = require("@instructure/ui-calendar/lib/Calendar");
7
14
  /*
8
15
  * The MIT License (MIT)
9
16
  *
@@ -28,4 +35,42 @@ exports.allowedProps = void 0;
28
35
  * SOFTWARE.
29
36
  */
30
37
 
38
+ const propTypes = exports.propTypes = {
39
+ renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
40
+ value: (0, _controllable.controllable)(_propTypes.default.string),
41
+ size: _propTypes.default.oneOf(['small', 'medium', 'large']),
42
+ placeholder: _propTypes.default.string,
43
+ onChange: _propTypes.default.func,
44
+ onBlur: _propTypes.default.func,
45
+ interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
46
+ isRequired: _propTypes.default.bool,
47
+ isInline: _propTypes.default.bool,
48
+ assistiveText: _propTypes.default.string,
49
+ layout: _propTypes.default.oneOf(['stacked', 'inline']),
50
+ width: _propTypes.default.string,
51
+ display: _propTypes.default.oneOf(['inline-block', 'block']),
52
+ inputRef: _propTypes.default.func,
53
+ messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
54
+ placement: _PositionPropTypes.PositionPropTypes.placement,
55
+ isShowingCalendar: _propTypes.default.bool,
56
+ onRequestValidateDate: _propTypes.default.func,
57
+ onRequestShowCalendar: _propTypes.default.func,
58
+ onRequestHideCalendar: _propTypes.default.func,
59
+ onRequestSelectNextDay: _propTypes.default.func,
60
+ onRequestSelectPrevDay: _propTypes.default.func,
61
+ onRequestRenderNextMonth: _propTypes.default.func,
62
+ onRequestRenderPrevMonth: _propTypes.default.func,
63
+ renderNavigationLabel: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
64
+ renderWeekdayLabels: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node])),
65
+ renderNextMonthButton: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
66
+ renderPrevMonthButton: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
67
+ children: _Children.Children.oneOf([_Calendar.Calendar.Day]),
68
+ disabledDates: _propTypes.default.oneOfType([_propTypes.default.array, _propTypes.default.func]),
69
+ currentDate: _propTypes.default.string,
70
+ disabledDateErrorMessage: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
71
+ invalidDateErrorMessage: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
72
+ locale: _propTypes.default.string,
73
+ timezone: _propTypes.default.string,
74
+ withYearPicker: _propTypes.default.object
75
+ };
31
76
  const allowedProps = exports.allowedProps = ['renderLabel', 'value', 'size', 'placeholder', 'onChange', 'onBlur', 'interaction', 'isRequired', 'isInline', 'assistiveText', 'layout', 'width', 'display', 'inputRef', 'messages', 'placement', 'isShowingCalendar', 'onRequestValidateDate', 'onRequestShowCalendar', 'onRequestHideCalendar', 'onRequestSelectNextDay', 'onRequestSelectPrevDay', 'onRequestRenderNextMonth', 'onRequestRenderPrevMonth', 'renderNavigationLabel', 'renderWeekdayLabels', 'renderNextMonthButton', 'renderPrevMonthButton', 'children', 'disabledDates', 'currentDate', 'disabledDateErrorMessage', 'invalidDateErrorMessage', 'locale', 'timezone'];
@@ -18,6 +18,7 @@ var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js
18
18
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
19
19
  var _getLocale = require("@instructure/ui-i18n/lib/getLocale.js");
20
20
  var _getTimezone = require("@instructure/ui-i18n/lib/getTimezone.js");
21
+ var _props = require("./props");
21
22
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
22
23
  var _IconCalendarMonthLin, _IconArrowOpenEndSoli, _IconArrowOpenStartSo;
23
24
  /*
@@ -115,6 +116,7 @@ function parseLocaleDate(dateString = '', locale, timeZone) {
115
116
  category: components
116
117
  ---
117
118
  **/
119
+ // eslint-disable-next-line react/display-name
118
120
  const DateInput2 = exports.DateInput2 = /*#__PURE__*/(0, _react.forwardRef)(({
119
121
  renderLabel,
120
122
  screenReaderLabels,
@@ -296,7 +298,5 @@ const DateInput2 = exports.DateInput2 = /*#__PURE__*/(0, _react.forwardRef)(({
296
298
  })
297
299
  });
298
300
  });
299
-
300
- // TODO this is probably needed?
301
- DateInput2.displayName = 'DateInput2';
301
+ DateInput2.propTypes = _props.propTypes;
302
302
  var _default = exports.default = DateInput2;
@@ -1,5 +1,57 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
- });
6
+ });
7
+ exports.propTypes = void 0;
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
10
+ var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
11
+ /*
12
+ * The MIT License (MIT)
13
+ *
14
+ * Copyright (c) 2015 - present Instructure, Inc.
15
+ *
16
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
17
+ * of this software and associated documentation files (the "Software"), to deal
18
+ * in the Software without restriction, including without limitation the rights
19
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ * copies of the Software, and to permit persons to whom the Software is
21
+ * furnished to do so, subject to the following conditions:
22
+ *
23
+ * The above copyright notice and this permission notice shall be included in all
24
+ * copies or substantial portions of the Software.
25
+ *
26
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
+ * SOFTWARE.
33
+ */
34
+
35
+ const propTypes = exports.propTypes = {
36
+ renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
37
+ screenReaderLabels: _propTypes.default.object.isRequired,
38
+ value: (0, _controllable.controllable)(_propTypes.default.string),
39
+ placeholder: _propTypes.default.string,
40
+ onChange: _propTypes.default.func,
41
+ onBlur: _propTypes.default.func,
42
+ interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
43
+ isRequired: _propTypes.default.bool,
44
+ isInline: _propTypes.default.bool,
45
+ width: _propTypes.default.string,
46
+ messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
47
+ invalidDateErrorMessage: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
48
+ locale: _propTypes.default.string,
49
+ timezone: _propTypes.default.string,
50
+ withYearPicker: _propTypes.default.object,
51
+ dateFormat: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
52
+ onRequestValidateDate: _propTypes.default.func,
53
+ renderCalendarIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
54
+ margin: _propTypes.default.string,
55
+ disabledDates: _propTypes.default.oneOfType([_propTypes.default.array, _propTypes.default.func]),
56
+ inputRef: _propTypes.default.func
57
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-date-input",
3
- "version": "10.26.1-snapshot-2",
3
+ "version": "10.26.2",
4
4
  "description": "A UI component library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,32 +23,35 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "10.26.1-snapshot-2",
27
- "@instructure/ui-buttons": "10.26.1-snapshot-2",
28
- "@instructure/ui-scripts": "10.26.1-snapshot-2",
26
+ "@instructure/ui-babel-preset": "10.26.2",
27
+ "@instructure/ui-buttons": "10.26.2",
28
+ "@instructure/ui-scripts": "10.26.2",
29
29
  "@testing-library/jest-dom": "^6.6.3",
30
- "@testing-library/react": "15.0.7",
30
+ "@testing-library/react": "^16.0.1",
31
31
  "@testing-library/user-event": "^14.6.1",
32
32
  "vitest": "^3.2.2"
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/runtime": "^7.27.6",
36
- "@instructure/emotion": "10.26.1-snapshot-2",
37
- "@instructure/shared-types": "10.26.1-snapshot-2",
38
- "@instructure/ui-calendar": "10.26.1-snapshot-2",
39
- "@instructure/ui-form-field": "10.26.1-snapshot-2",
40
- "@instructure/ui-i18n": "10.26.1-snapshot-2",
41
- "@instructure/ui-icons": "10.26.1-snapshot-2",
42
- "@instructure/ui-popover": "10.26.1-snapshot-2",
43
- "@instructure/ui-position": "10.26.1-snapshot-2",
44
- "@instructure/ui-react-utils": "10.26.1-snapshot-2",
45
- "@instructure/ui-selectable": "10.26.1-snapshot-2",
46
- "@instructure/ui-text-input": "10.26.1-snapshot-2",
47
- "@instructure/ui-utils": "10.26.1-snapshot-2",
48
- "moment-timezone": "^0.6.0"
36
+ "@instructure/emotion": "10.26.2",
37
+ "@instructure/shared-types": "10.26.2",
38
+ "@instructure/ui-calendar": "10.26.2",
39
+ "@instructure/ui-form-field": "10.26.2",
40
+ "@instructure/ui-i18n": "10.26.2",
41
+ "@instructure/ui-icons": "10.26.2",
42
+ "@instructure/ui-popover": "10.26.2",
43
+ "@instructure/ui-position": "10.26.2",
44
+ "@instructure/ui-prop-types": "10.26.2",
45
+ "@instructure/ui-react-utils": "10.26.2",
46
+ "@instructure/ui-selectable": "10.26.2",
47
+ "@instructure/ui-testable": "10.26.2",
48
+ "@instructure/ui-text-input": "10.26.2",
49
+ "@instructure/ui-utils": "10.26.2",
50
+ "moment-timezone": "^0.6.0",
51
+ "prop-types": "^15.8.1"
49
52
  },
50
53
  "peerDependencies": {
51
- "react": ">=18 <=19"
54
+ "react": ">=16.14 <=18"
52
55
  },
53
56
  "publishConfig": {
54
57
  "access": "public"
@@ -42,6 +42,7 @@ import {
42
42
  safeCloneElement,
43
43
  passthroughProps
44
44
  } from '@instructure/ui-react-utils'
45
+ import { testable } from '@instructure/ui-testable'
45
46
 
46
47
  import { DateTime, ApplyLocaleContext, Locale } from '@instructure/ui-i18n'
47
48
 
@@ -49,7 +50,7 @@ import { withStyle } from '@instructure/emotion'
49
50
 
50
51
  import generateStyle from './styles'
51
52
 
52
- import { allowedProps } from './props'
53
+ import { propTypes, allowedProps } from './props'
53
54
  import type { DateInputProps, DateInputState } from './props'
54
55
  import type { FormMessage } from '@instructure/ui-form-field'
55
56
 
@@ -59,10 +60,12 @@ category: components
59
60
  ---
60
61
  **/
61
62
  @withStyle(generateStyle, null)
63
+ @testable()
62
64
  class DateInput extends Component<DateInputProps, DateInputState> {
63
65
  static readonly componentId = 'DateInput'
64
66
  static Day = Calendar.Day
65
67
  declare context: React.ContextType<typeof ApplyLocaleContext>
68
+ static propTypes = propTypes
66
69
  static allowedProps = allowedProps
67
70
  static defaultProps = {
68
71
  value: '',
@@ -466,10 +469,7 @@ class DateInput extends Component<DateInputProps, DateInputState> {
466
469
  }) => (
467
470
  <span
468
471
  {...getRootProps({ css: styles?.dateInput })}
469
- ref={(el) => {
470
- this.ref = el
471
- }}
472
- data-cid="DateInput"
472
+ ref={(el) => (this.ref = el)}
473
473
  >
474
474
  {this.renderInput({ getInputProps, getTriggerProps })}
475
475
  <span {...getDescriptionProps()} css={styles?.assistiveText}>
@@ -22,10 +22,23 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import PropTypes from 'prop-types'
26
+
27
+ import {
28
+ controllable,
29
+ Children as ChildrenPropTypes
30
+ } from '@instructure/ui-prop-types'
31
+ import { FormPropTypes } from '@instructure/ui-form-field'
32
+ import { PositionPropTypes } from '@instructure/ui-position'
33
+ import { Calendar } from '@instructure/ui-calendar'
25
34
  import type { CalendarDayProps } from '@instructure/ui-calendar'
26
35
  import type { FormMessage } from '@instructure/ui-form-field'
27
36
  import type { PlacementPropValues } from '@instructure/ui-position'
28
- import type { Renderable, OtherHTMLAttributes } from '@instructure/shared-types'
37
+ import type {
38
+ Renderable,
39
+ OtherHTMLAttributes,
40
+ PropValidators
41
+ } from '@instructure/shared-types'
29
42
  import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
30
43
  import { InputHTMLAttributes, ReactElement, SyntheticEvent } from 'react'
31
44
 
@@ -100,10 +113,12 @@ type DateInputOwnProps = {
100
113
  */
101
114
  inputRef?: (element: HTMLInputElement | null) => void
102
115
  /**
103
- * Displays informational and error messages, used for input validation,
104
- * can also display screenreader-only messages.
105
- * Also changes the border color of the component on success/error.
106
- * This is automatically set to `invalidDateErrorMessage` when the date is invalid
116
+ * Displays messages and validation for the input. It should be an object
117
+ * with the following shape:
118
+ * `{
119
+ * text: PropTypes.node,
120
+ * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
121
+ * }`
107
122
  */
108
123
  messages?: FormMessage[]
109
124
  /**
@@ -267,6 +282,54 @@ type DateInputProps = DateInputOwnProps &
267
282
  >
268
283
 
269
284
  type DateInputStyle = ComponentStyle<'dateInput' | 'assistiveText'>
285
+
286
+ const propTypes: PropValidators<PropKeys> = {
287
+ renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
288
+ value: controllable(PropTypes.string),
289
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
290
+ placeholder: PropTypes.string,
291
+ onChange: PropTypes.func,
292
+ onBlur: PropTypes.func,
293
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
294
+ isRequired: PropTypes.bool,
295
+ isInline: PropTypes.bool,
296
+ assistiveText: PropTypes.string,
297
+ layout: PropTypes.oneOf(['stacked', 'inline']),
298
+ width: PropTypes.string,
299
+ display: PropTypes.oneOf(['inline-block', 'block']),
300
+ inputRef: PropTypes.func,
301
+ messages: PropTypes.arrayOf(FormPropTypes.message),
302
+ placement: PositionPropTypes.placement,
303
+ isShowingCalendar: PropTypes.bool,
304
+ onRequestValidateDate: PropTypes.func,
305
+ onRequestShowCalendar: PropTypes.func,
306
+ onRequestHideCalendar: PropTypes.func,
307
+ onRequestSelectNextDay: PropTypes.func,
308
+ onRequestSelectPrevDay: PropTypes.func,
309
+ onRequestRenderNextMonth: PropTypes.func,
310
+ onRequestRenderPrevMonth: PropTypes.func,
311
+ renderNavigationLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
312
+ renderWeekdayLabels: PropTypes.arrayOf(
313
+ PropTypes.oneOfType([PropTypes.func, PropTypes.node])
314
+ ),
315
+ renderNextMonthButton: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
316
+ renderPrevMonthButton: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
317
+ children: ChildrenPropTypes.oneOf([Calendar.Day]),
318
+ disabledDates: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
319
+ currentDate: PropTypes.string,
320
+ disabledDateErrorMessage: PropTypes.oneOfType([
321
+ PropTypes.func,
322
+ PropTypes.string
323
+ ]),
324
+ invalidDateErrorMessage: PropTypes.oneOfType([
325
+ PropTypes.func,
326
+ PropTypes.string
327
+ ]),
328
+ locale: PropTypes.string,
329
+ timezone: PropTypes.string,
330
+ withYearPicker: PropTypes.object
331
+ }
332
+
270
333
  const allowedProps: AllowedPropKeys = [
271
334
  'renderLabel',
272
335
  'value',
@@ -313,4 +376,4 @@ type DateInputState = {
313
376
  }
314
377
 
315
378
  export type { DateInputProps, DateInputStyle, DateInputState }
316
- export { allowedProps }
379
+ export { propTypes, allowedProps }