@instructure/ui-date-time-input 11.6.0 → 11.6.1-snapshot-129
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 +33 -281
- package/es/DateTimeInput/{index.js → v1/index.js} +9 -9
- package/es/{index.js → exports/a.js} +1 -1
- package/lib/DateTimeInput/{index.js → v1/index.js} +17 -17
- package/lib/{index.js → exports/a.js} +2 -2
- package/package.json +43 -21
- package/src/DateTimeInput/{index.tsx → v1/index.tsx} +12 -10
- package/src/DateTimeInput/{props.ts → v1/props.ts} +1 -1
- package/src/{index.ts → exports/a.ts} +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateTimeInput/v1/index.d.ts.map +1 -0
- package/types/DateTimeInput/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/DateTimeInput/v1/props.d.ts.map +1 -0
- package/types/exports/a.d.ts +2 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/DateTimeInput/index.d.ts.map +0 -1
- package/types/DateTimeInput/props.d.ts.map +0 -1
- package/types/index.d.ts +0 -2
- package/types/index.d.ts.map +0 -1
- /package/es/DateTimeInput/{props.js → v1/props.js} +0 -0
- /package/lib/DateTimeInput/{props.js → v1/props.js} +0 -0
- /package/src/DateTimeInput/{README.md → v1/README.md} +0 -0
- /package/types/DateTimeInput/{index.d.ts → v1/index.d.ts} +0 -0
|
@@ -8,14 +8,14 @@ var _react = require("react");
|
|
|
8
8
|
var _Locale = require("@instructure/ui-i18n/lib/Locale.js");
|
|
9
9
|
var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
|
|
10
10
|
var _ApplyLocaleContext = require("@instructure/ui-i18n/lib/ApplyLocale/ApplyLocaleContext.js");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
11
|
+
var _v11_ = require("@instructure/ui-form-field/v11_6");
|
|
12
|
+
var _v11_2 = require("@instructure/ui-date-input/v11_6");
|
|
13
|
+
var _v11_3 = require("@instructure/ui-time-select/v11_6");
|
|
14
|
+
var _v11_4 = require("@instructure/ui-calendar/v11_6");
|
|
15
15
|
var _AccessibleContent = require("@instructure/ui-a11y-content/lib/AccessibleContent");
|
|
16
|
-
var
|
|
17
|
-
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
18
|
-
var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/IconArrowOpenStartSolid.js");
|
|
16
|
+
var _v11_5 = require("@instructure/ui-buttons/v11_6");
|
|
17
|
+
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenEndSolid.js");
|
|
18
|
+
var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenStartSolid.js");
|
|
19
19
|
var _props = require("./props");
|
|
20
20
|
var _console = require("@instructure/console");
|
|
21
21
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
@@ -115,7 +115,7 @@ class DateTimeInput extends _react.Component {
|
|
|
115
115
|
// eslint-disable-next-line no-param-reassign
|
|
116
116
|
newState.message = {
|
|
117
117
|
text: text,
|
|
118
|
-
type: '
|
|
118
|
+
type: 'error'
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
if (this.areDifferentDates(this.state.iso, newState.iso)) {
|
|
@@ -256,7 +256,7 @@ class DateTimeInput extends _react.Component {
|
|
|
256
256
|
}
|
|
257
257
|
errorMsg = text ? {
|
|
258
258
|
text,
|
|
259
|
-
type: '
|
|
259
|
+
type: 'error'
|
|
260
260
|
} : void 0;
|
|
261
261
|
return {
|
|
262
262
|
iso: parsed.clone(),
|
|
@@ -359,7 +359,7 @@ class DateTimeInput extends _react.Component {
|
|
|
359
359
|
// Monday in most of the EU.
|
|
360
360
|
const currDate = _DateTime.DateTime.getFirstDayOfWeek(renderedDate.startOf('month'));
|
|
361
361
|
const arr = [];
|
|
362
|
-
for (let i = 0; i <
|
|
362
|
+
for (let i = 0; i < _v11_4.Calendar.DAY_COUNT; i++) {
|
|
363
363
|
// This workaround is needed because moment's `.add({days: 1})` function has a bug that happens when the date added lands perfectly onto the DST cutoff,
|
|
364
364
|
// in these cases adding 1 day results in 23 hours added instead,
|
|
365
365
|
// so `moment.tz('2024-09-07T00:00:00', 'America/Santiago').add({days: 1})` results
|
|
@@ -381,7 +381,7 @@ class DateTimeInput extends _react.Component {
|
|
|
381
381
|
}
|
|
382
382
|
return arr.map(date => {
|
|
383
383
|
const dateStr = date.toISOString();
|
|
384
|
-
return (0, _jsxRuntime.jsx)(
|
|
384
|
+
return (0, _jsxRuntime.jsx)(_v11_2.DateInput.Day, {
|
|
385
385
|
date: dateStr,
|
|
386
386
|
isSelected: this.state.calendarSelectedDate ? date.isSame(this.state.calendarSelectedDate, 'day') : false,
|
|
387
387
|
isToday: date.isSame(_DateTime.DateTime.now(this.locale(), this.timezone()), 'day'),
|
|
@@ -430,7 +430,7 @@ class DateTimeInput extends _react.Component {
|
|
|
430
430
|
if (!this.state.isShowingCalendar) {
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
return (0, _jsxRuntime.jsx)(
|
|
433
|
+
return (0, _jsxRuntime.jsx)(_v11_5.IconButton, {
|
|
434
434
|
size: "small",
|
|
435
435
|
withBackground: false,
|
|
436
436
|
withBorder: false,
|
|
@@ -465,13 +465,13 @@ class DateTimeInput extends _react.Component {
|
|
|
465
465
|
renderWeekdayLabels = _this$props4.renderWeekdayLabels,
|
|
466
466
|
allowNonStepInput = _this$props4.allowNonStepInput;
|
|
467
467
|
const allMessages = [...(showMessages && this.state.message ? [this.state.message] : []), ...(messages || [])];
|
|
468
|
-
const hasError = allMessages.find(m => m.type === 'newError');
|
|
468
|
+
const hasError = allMessages.find(m => m.type === 'newError' || m.type === 'error');
|
|
469
469
|
// if the component is in error state, create an empty error message to pass down to the subcomponents (DateInput and TimeInput) so they get a red outline and red required asterisk
|
|
470
470
|
const subComponentMessages = hasError ? [{
|
|
471
|
-
type: '
|
|
471
|
+
type: 'error',
|
|
472
472
|
text: ''
|
|
473
473
|
}] : [];
|
|
474
|
-
return (0, _jsxRuntime.jsxs)(
|
|
474
|
+
return (0, _jsxRuntime.jsxs)(_v11_.FormFieldGroup, {
|
|
475
475
|
description: description,
|
|
476
476
|
layout: layout,
|
|
477
477
|
rowSpacing: rowSpacing,
|
|
@@ -481,7 +481,7 @@ class DateTimeInput extends _react.Component {
|
|
|
481
481
|
isGroup: false,
|
|
482
482
|
messages: [...(showMessages && this.state.message ? [this.state.message] : []), ...(messages || [])],
|
|
483
483
|
"data-cid": "DateTimeInput",
|
|
484
|
-
children: [(0, _jsxRuntime.jsx)(
|
|
484
|
+
children: [(0, _jsxRuntime.jsx)(_v11_2.DateInput, {
|
|
485
485
|
display: "block",
|
|
486
486
|
value: this.state.dateInputText,
|
|
487
487
|
onChange: this.handleDateTextChange,
|
|
@@ -510,7 +510,7 @@ class DateTimeInput extends _react.Component {
|
|
|
510
510
|
})]
|
|
511
511
|
}),
|
|
512
512
|
children: this.renderDays()
|
|
513
|
-
}), (0, _jsxRuntime.jsx)(
|
|
513
|
+
}), (0, _jsxRuntime.jsx)(_v11_3.TimeSelect, {
|
|
514
514
|
value: this.state.timeSelectValue,
|
|
515
515
|
onChange: this.updateStateBasedOnTimeSelect,
|
|
516
516
|
placeholder: timePlaceholder,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "DateTimeInput", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _v.DateTimeInput;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var
|
|
12
|
+
var _v = require("../DateTimeInput/v1");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-date-time-input",
|
|
3
|
-
"version": "11.6.
|
|
3
|
+
"version": "11.6.1-snapshot-129",
|
|
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",
|
|
@@ -15,25 +15,25 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.27.6",
|
|
18
|
-
"@instructure/shared-types": "11.6.
|
|
19
|
-
"@instructure/console": "11.6.
|
|
20
|
-
"@instructure/ui-buttons": "11.6.
|
|
21
|
-
"@instructure/ui-
|
|
22
|
-
"@instructure/ui-
|
|
23
|
-
"@instructure/ui-date-input": "11.6.
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-icons": "11.6.
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/ui-utils": "11.6.
|
|
29
|
-
"@instructure/ui-
|
|
18
|
+
"@instructure/shared-types": "11.6.1-snapshot-129",
|
|
19
|
+
"@instructure/console": "11.6.1-snapshot-129",
|
|
20
|
+
"@instructure/ui-buttons": "11.6.1-snapshot-129",
|
|
21
|
+
"@instructure/ui-calendar": "11.6.1-snapshot-129",
|
|
22
|
+
"@instructure/ui-a11y-content": "11.6.1-snapshot-129",
|
|
23
|
+
"@instructure/ui-date-input": "11.6.1-snapshot-129",
|
|
24
|
+
"@instructure/ui-form-field": "11.6.1-snapshot-129",
|
|
25
|
+
"@instructure/ui-i18n": "11.6.1-snapshot-129",
|
|
26
|
+
"@instructure/ui-icons": "11.6.1-snapshot-129",
|
|
27
|
+
"@instructure/ui-react-utils": "11.6.1-snapshot-129",
|
|
28
|
+
"@instructure/ui-utils": "11.6.1-snapshot-129",
|
|
29
|
+
"@instructure/ui-time-select": "11.6.1-snapshot-129"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@testing-library/jest-dom": "^6.6.3",
|
|
33
33
|
"@testing-library/react": "15.0.7",
|
|
34
34
|
"@testing-library/user-event": "^14.6.1",
|
|
35
35
|
"vitest": "^3.2.2",
|
|
36
|
-
"@instructure/ui-babel-preset": "11.6.
|
|
36
|
+
"@instructure/ui-babel-preset": "11.6.1-snapshot-129"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": ">=18 <=19"
|
|
@@ -43,17 +43,39 @@
|
|
|
43
43
|
},
|
|
44
44
|
"sideEffects": false,
|
|
45
45
|
"exports": {
|
|
46
|
-
".": {
|
|
47
|
-
"types": "./types/index.d.ts",
|
|
48
|
-
"import": "./es/index.js",
|
|
49
|
-
"require": "./lib/index.js",
|
|
50
|
-
"default": "./es/index.js"
|
|
51
|
-
},
|
|
52
46
|
"./lib/*": "./lib/*",
|
|
53
47
|
"./es/*": "./es/*",
|
|
54
48
|
"./types/*": "./types/*",
|
|
55
49
|
"./package.json": "./package.json",
|
|
56
|
-
"./src/*": "./src/*"
|
|
50
|
+
"./src/*": "./src/*",
|
|
51
|
+
".": {
|
|
52
|
+
"src": "./src/exports/a.ts",
|
|
53
|
+
"types": "./types/exports/a.d.ts",
|
|
54
|
+
"import": "./es/exports/a.js",
|
|
55
|
+
"require": "./lib/exports/a.js",
|
|
56
|
+
"default": "./es/exports/a.js"
|
|
57
|
+
},
|
|
58
|
+
"./v11_6": {
|
|
59
|
+
"src": "./src/exports/a.ts",
|
|
60
|
+
"types": "./types/exports/a.d.ts",
|
|
61
|
+
"import": "./es/exports/a.js",
|
|
62
|
+
"require": "./lib/exports/a.js",
|
|
63
|
+
"default": "./es/exports/a.js"
|
|
64
|
+
},
|
|
65
|
+
"./v11_7": {
|
|
66
|
+
"src": "./src/exports/a.ts",
|
|
67
|
+
"types": "./types/exports/a.d.ts",
|
|
68
|
+
"import": "./es/exports/a.js",
|
|
69
|
+
"require": "./lib/exports/a.js",
|
|
70
|
+
"default": "./es/exports/a.js"
|
|
71
|
+
},
|
|
72
|
+
"./latest": {
|
|
73
|
+
"src": "./src/exports/a.ts",
|
|
74
|
+
"types": "./types/exports/a.d.ts",
|
|
75
|
+
"import": "./es/exports/a.js",
|
|
76
|
+
"require": "./lib/exports/a.js",
|
|
77
|
+
"default": "./es/exports/a.js"
|
|
78
|
+
}
|
|
57
79
|
},
|
|
58
80
|
"scripts": {
|
|
59
81
|
"lint": "ui-scripts lint",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
import { Component, SyntheticEvent, MouseEvent } from 'react'
|
|
26
26
|
import { Locale, DateTime, ApplyLocaleContext } from '@instructure/ui-i18n'
|
|
27
27
|
import type { Moment } from '@instructure/ui-i18n'
|
|
28
|
-
import { FormFieldGroup } from '@instructure/ui-form-field'
|
|
29
|
-
import type { FormMessage } from '@instructure/ui-form-field'
|
|
28
|
+
import { FormFieldGroup } from '@instructure/ui-form-field/v11_6'
|
|
29
|
+
import type { FormMessage } from '@instructure/ui-form-field/v11_6'
|
|
30
30
|
|
|
31
|
-
import { DateInput } from '@instructure/ui-date-input'
|
|
32
|
-
import { TimeSelect } from '@instructure/ui-time-select'
|
|
33
|
-
import { Calendar } from '@instructure/ui-calendar'
|
|
31
|
+
import { DateInput } from '@instructure/ui-date-input/v11_6'
|
|
32
|
+
import { TimeSelect } from '@instructure/ui-time-select/v11_6'
|
|
33
|
+
import { Calendar } from '@instructure/ui-calendar/v11_6'
|
|
34
34
|
import { AccessibleContent } from '@instructure/ui-a11y-content'
|
|
35
|
-
import { IconButton } from '@instructure/ui-buttons'
|
|
35
|
+
import { IconButton } from '@instructure/ui-buttons/v11_6'
|
|
36
36
|
import {
|
|
37
37
|
IconArrowOpenEndSolid,
|
|
38
38
|
IconArrowOpenStartSolid
|
|
@@ -162,7 +162,7 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
162
162
|
? this.props.invalidDateTimeMessage(parsed.toISOString(true))
|
|
163
163
|
: this.props.invalidDateTimeMessage
|
|
164
164
|
}
|
|
165
|
-
errorMsg = text ? { text, type: '
|
|
165
|
+
errorMsg = text ? { text, type: 'error' } : undefined
|
|
166
166
|
return {
|
|
167
167
|
iso: parsed.clone(),
|
|
168
168
|
calendarSelectedDate: parsed.clone(),
|
|
@@ -345,7 +345,7 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
345
345
|
? this.props.invalidDateTimeMessage(dateStr ? dateStr : '')
|
|
346
346
|
: this.props.invalidDateTimeMessage
|
|
347
347
|
// eslint-disable-next-line no-param-reassign
|
|
348
|
-
newState.message = { text: text, type: '
|
|
348
|
+
newState.message = { text: text, type: 'error' }
|
|
349
349
|
}
|
|
350
350
|
if (this.areDifferentDates(this.state.iso, newState.iso)) {
|
|
351
351
|
if (typeof this.props.onChange === 'function') {
|
|
@@ -569,10 +569,12 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
|
569
569
|
...(messages || [])
|
|
570
570
|
]
|
|
571
571
|
|
|
572
|
-
const hasError = allMessages.find(
|
|
572
|
+
const hasError = allMessages.find(
|
|
573
|
+
(m) => m.type === 'newError' || m.type === 'error'
|
|
574
|
+
)
|
|
573
575
|
// if the component is in error state, create an empty error message to pass down to the subcomponents (DateInput and TimeInput) so they get a red outline and red required asterisk
|
|
574
576
|
const subComponentMessages: FormMessage[] = hasError
|
|
575
|
-
? [{ type: '
|
|
577
|
+
? [{ type: 'error', text: '' }]
|
|
576
578
|
: []
|
|
577
579
|
|
|
578
580
|
return (
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { SyntheticEvent } from 'react'
|
|
26
|
-
import type { FormMessage } from '@instructure/ui-form-field'
|
|
26
|
+
import type { FormMessage } from '@instructure/ui-form-field/v11_6'
|
|
27
27
|
import type { InteractionType } from '@instructure/ui-react-utils'
|
|
28
28
|
import type { Moment } from '@instructure/ui-i18n'
|
|
29
29
|
import type { Renderable } from '@instructure/shared-types'
|