@instructure/ui-date-time-input 10.16.1-snapshot-0 → 10.16.1
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 +1 -1
- package/es/DateTimeInput/__new-tests__/DateTimeInput.test.js +88 -62
- package/es/DateTimeInput/index.js +79 -70
- package/lib/DateTimeInput/__new-tests__/DateTimeInput.test.js +152 -126
- package/lib/DateTimeInput/index.js +79 -71
- package/package.json +17 -17
- package/src/DateTimeInput/__new-tests__/DateTimeInput.test.tsx +0 -1
- package/src/DateTimeInput/index.tsx +1 -1
- package/src/DateTimeInput/props.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateTimeInput/__new-tests__/DateTimeInput.test.d.ts.map +1 -1
- package/types/DateTimeInput/index.d.ts +6 -6
- package/types/DateTimeInput/index.d.ts.map +1 -1
- package/types/DateTimeInput/props.d.ts +1 -1
- package/types/DateTimeInput/props.d.ts.map +1 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = exports.DateTimeInput = void 0;
|
|
8
|
-
var _react =
|
|
7
|
+
var _react = require("react");
|
|
9
8
|
var _Locale = require("@instructure/ui-i18n/lib/Locale.js");
|
|
10
9
|
var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
|
|
11
10
|
var _ApplyLocaleContext = require("@instructure/ui-i18n/lib/ApplyLocale/ApplyLocaleContext.js");
|
|
@@ -20,6 +19,7 @@ var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEnd
|
|
|
20
19
|
var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/IconArrowOpenStartSolid.js");
|
|
21
20
|
var _props = require("./props");
|
|
22
21
|
var _console = require("@instructure/console");
|
|
22
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
23
23
|
var _dec, _class, _DateTimeInput, _IconArrowOpenStartSo, _IconArrowOpenEndSoli;
|
|
24
24
|
/*
|
|
25
25
|
* The MIT License (MIT)
|
|
@@ -382,8 +382,7 @@ let DateTimeInput = exports.DateTimeInput = (_dec = (0, _testable.testable)(), _
|
|
|
382
382
|
}
|
|
383
383
|
return arr.map(date => {
|
|
384
384
|
const dateStr = date.toISOString();
|
|
385
|
-
return
|
|
386
|
-
key: dateStr,
|
|
385
|
+
return (0, _jsxRuntime.jsx)(_DateInput.DateInput.Day, {
|
|
387
386
|
date: dateStr,
|
|
388
387
|
isSelected: this.state.calendarSelectedDate ? date.isSame(this.state.calendarSelectedDate, 'day') : false,
|
|
389
388
|
isToday: date.isSame(_DateTime.DateTime.now(this.locale(), this.timezone()), 'day'),
|
|
@@ -391,8 +390,9 @@ let DateTimeInput = exports.DateTimeInput = (_dec = (0, _testable.testable)(), _
|
|
|
391
390
|
label: date.format('D MMMM YYYY') // used by screen readers
|
|
392
391
|
,
|
|
393
392
|
onClick: this.handleDayClick,
|
|
394
|
-
interaction: this.isDisabledDate(date) ? 'disabled' : 'enabled'
|
|
395
|
-
|
|
393
|
+
interaction: this.isDisabledDate(date) ? 'disabled' : 'enabled',
|
|
394
|
+
children: date.format('DD')
|
|
395
|
+
}, dateStr);
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
398
|
|
|
@@ -404,40 +404,40 @@ let DateTimeInput = exports.DateTimeInput = (_dec = (0, _testable.testable)(), _
|
|
|
404
404
|
}
|
|
405
405
|
const shortDayNames = _DateTime.DateTime.getLocalDayNamesOfTheWeek(this.locale(), 'short');
|
|
406
406
|
const longDayNames = _DateTime.DateTime.getLocalDayNamesOfTheWeek(this.locale(), 'long');
|
|
407
|
-
return [
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
},
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
},
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
},
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
},
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
},
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
},
|
|
407
|
+
return [(0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
408
|
+
alt: longDayNames[0],
|
|
409
|
+
children: shortDayNames[0]
|
|
410
|
+
}, 1), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
411
|
+
alt: longDayNames[1],
|
|
412
|
+
children: shortDayNames[1]
|
|
413
|
+
}, 2), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
414
|
+
alt: longDayNames[2],
|
|
415
|
+
children: shortDayNames[2]
|
|
416
|
+
}, 3), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
417
|
+
alt: longDayNames[3],
|
|
418
|
+
children: shortDayNames[3]
|
|
419
|
+
}, 4), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
420
|
+
alt: longDayNames[4],
|
|
421
|
+
children: shortDayNames[4]
|
|
422
|
+
}, 5), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
423
|
+
alt: longDayNames[5],
|
|
424
|
+
children: shortDayNames[5]
|
|
425
|
+
}, 6), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
426
|
+
alt: longDayNames[6],
|
|
427
|
+
children: shortDayNames[6]
|
|
428
|
+
}, 7)];
|
|
429
429
|
}
|
|
430
430
|
renderNextPrevMonthButton(type) {
|
|
431
431
|
if (!this.state.isShowingCalendar) {
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
|
-
return
|
|
434
|
+
return (0, _jsxRuntime.jsx)(_IconButton.IconButton, {
|
|
435
435
|
size: "small",
|
|
436
436
|
withBackground: false,
|
|
437
437
|
withBorder: false,
|
|
438
|
-
renderIcon: type === 'prev' ? _IconArrowOpenStartSo || (_IconArrowOpenStartSo =
|
|
438
|
+
renderIcon: type === 'prev' ? _IconArrowOpenStartSo || (_IconArrowOpenStartSo = (0, _jsxRuntime.jsx)(_IconArrowOpenStartSolid.IconArrowOpenStartSolid, {
|
|
439
439
|
color: "primary"
|
|
440
|
-
})) : _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli =
|
|
440
|
+
})) : _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = (0, _jsxRuntime.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, {
|
|
441
441
|
color: "primary"
|
|
442
442
|
})),
|
|
443
443
|
screenReaderLabel: type === 'prev' ? this.props.prevMonthLabel : this.props.nextMonthLabel
|
|
@@ -472,7 +472,7 @@ let DateTimeInput = exports.DateTimeInput = (_dec = (0, _testable.testable)(), _
|
|
|
472
472
|
type: 'newError',
|
|
473
473
|
text: ''
|
|
474
474
|
}] : [];
|
|
475
|
-
return
|
|
475
|
+
return (0, _jsxRuntime.jsxs)(_FormFieldGroup.FormFieldGroup, {
|
|
476
476
|
description: description,
|
|
477
477
|
layout: layout,
|
|
478
478
|
rowSpacing: rowSpacing,
|
|
@@ -480,45 +480,53 @@ let DateTimeInput = exports.DateTimeInput = (_dec = (0, _testable.testable)(), _
|
|
|
480
480
|
vAlign: "top",
|
|
481
481
|
elementRef: this.handleRef,
|
|
482
482
|
isGroup: false,
|
|
483
|
-
messages: [...(showMessages && this.state.message ? [this.state.message] : []), ...(messages || [])]
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
483
|
+
messages: [...(showMessages && this.state.message ? [this.state.message] : []), ...(messages || [])],
|
|
484
|
+
children: [(0, _jsxRuntime.jsx)(_DateInput.DateInput, {
|
|
485
|
+
display: "block",
|
|
486
|
+
value: this.state.dateInputText,
|
|
487
|
+
onChange: this.handleDateTextChange,
|
|
488
|
+
onBlur: this.handleBlur,
|
|
489
|
+
inputRef: dateInputRef,
|
|
490
|
+
placeholder: datePlaceholder,
|
|
491
|
+
renderLabel: dateRenderLabel,
|
|
492
|
+
renderWeekdayLabels: renderWeekdayLabels ? renderWeekdayLabels : this.defaultWeekdays,
|
|
493
|
+
onRequestShowCalendar: this.handleShowCalendar,
|
|
494
|
+
onRequestHideCalendar: this.handleHideCalendar,
|
|
495
|
+
isShowingCalendar: this.state.isShowingCalendar,
|
|
496
|
+
renderNextMonthButton: this.renderNextPrevMonthButton('next'),
|
|
497
|
+
renderPrevMonthButton: this.renderNextPrevMonthButton('prev'),
|
|
498
|
+
onRequestSelectNextDay: this.handleSelectNextDay,
|
|
499
|
+
onRequestSelectPrevDay: this.handleSelectPrevDay,
|
|
500
|
+
onRequestRenderNextMonth: this.handleRenderNextMonth,
|
|
501
|
+
onRequestRenderPrevMonth: this.handleRenderPrevMonth,
|
|
502
|
+
isRequired: isRequired,
|
|
503
|
+
messages: subComponentMessages,
|
|
504
|
+
interaction: interaction,
|
|
505
|
+
renderNavigationLabel: (0, _jsxRuntime.jsxs)("span", {
|
|
506
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
507
|
+
children: this.state.renderedDate.format('MMMM')
|
|
508
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
509
|
+
children: this.state.renderedDate.format('y')
|
|
510
|
+
})]
|
|
511
|
+
}),
|
|
512
|
+
children: this.renderDays()
|
|
513
|
+
}), (0, _jsxRuntime.jsx)(_TimeSelect.TimeSelect, {
|
|
514
|
+
value: this.state.timeSelectValue,
|
|
515
|
+
onChange: this.updateStateBasedOnTimeSelect,
|
|
516
|
+
placeholder: timePlaceholder,
|
|
517
|
+
onBlur: this.handleBlur,
|
|
518
|
+
renderLabel: timeRenderLabel,
|
|
519
|
+
locale: locale,
|
|
520
|
+
format: timeFormat,
|
|
521
|
+
step: timeStep,
|
|
522
|
+
timezone: timezone,
|
|
523
|
+
inputRef: timeInputRef,
|
|
524
|
+
interaction: interaction,
|
|
525
|
+
allowNonStepInput: allowNonStepInput,
|
|
526
|
+
isRequired: isRequired,
|
|
527
|
+
messages: subComponentMessages
|
|
528
|
+
})]
|
|
529
|
+
});
|
|
522
530
|
}
|
|
523
531
|
}, _DateTimeInput.displayName = "DateTimeInput", _DateTimeInput.DEFAULT_MESSAGE_FORMAT = 'LLLL', _DateTimeInput.propTypes = _props.propTypes, _DateTimeInput.allowedProps = _props.allowedProps, _DateTimeInput.defaultProps = {
|
|
524
532
|
layout: 'inline',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-date-time-input",
|
|
3
|
-
"version": "10.16.1
|
|
3
|
+
"version": "10.16.1",
|
|
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,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "10.16.1
|
|
27
|
-
"@instructure/ui-test-utils": "10.16.1
|
|
26
|
+
"@instructure/ui-babel-preset": "10.16.1",
|
|
27
|
+
"@instructure/ui-test-utils": "10.16.1",
|
|
28
28
|
"@testing-library/jest-dom": "^6.6.3",
|
|
29
29
|
"@testing-library/react": "^16.0.1",
|
|
30
30
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -32,20 +32,20 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.26.0",
|
|
35
|
-
"@instructure/console": "10.16.1
|
|
36
|
-
"@instructure/shared-types": "10.16.1
|
|
37
|
-
"@instructure/ui-a11y-content": "10.16.1
|
|
38
|
-
"@instructure/ui-buttons": "10.16.1
|
|
39
|
-
"@instructure/ui-calendar": "10.16.1
|
|
40
|
-
"@instructure/ui-date-input": "10.16.1
|
|
41
|
-
"@instructure/ui-form-field": "10.16.1
|
|
42
|
-
"@instructure/ui-i18n": "10.16.1
|
|
43
|
-
"@instructure/ui-icons": "10.16.1
|
|
44
|
-
"@instructure/ui-prop-types": "10.16.1
|
|
45
|
-
"@instructure/ui-react-utils": "10.16.1
|
|
46
|
-
"@instructure/ui-testable": "10.16.1
|
|
47
|
-
"@instructure/ui-time-select": "10.16.1
|
|
48
|
-
"@instructure/ui-utils": "10.16.1
|
|
35
|
+
"@instructure/console": "10.16.1",
|
|
36
|
+
"@instructure/shared-types": "10.16.1",
|
|
37
|
+
"@instructure/ui-a11y-content": "10.16.1",
|
|
38
|
+
"@instructure/ui-buttons": "10.16.1",
|
|
39
|
+
"@instructure/ui-calendar": "10.16.1",
|
|
40
|
+
"@instructure/ui-date-input": "10.16.1",
|
|
41
|
+
"@instructure/ui-form-field": "10.16.1",
|
|
42
|
+
"@instructure/ui-i18n": "10.16.1",
|
|
43
|
+
"@instructure/ui-icons": "10.16.1",
|
|
44
|
+
"@instructure/ui-prop-types": "10.16.1",
|
|
45
|
+
"@instructure/ui-react-utils": "10.16.1",
|
|
46
|
+
"@instructure/ui-testable": "10.16.1",
|
|
47
|
+
"@instructure/ui-time-select": "10.16.1",
|
|
48
|
+
"@instructure/ui-utils": "10.16.1",
|
|
49
49
|
"prop-types": "^15.8.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import
|
|
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
28
|
import { FormFieldGroup } from '@instructure/ui-form-field'
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import
|
|
25
|
+
import { SyntheticEvent } from 'react'
|
|
26
26
|
import { FormPropTypes } from '@instructure/ui-form-field'
|
|
27
27
|
import type { FormMessage } from '@instructure/ui-form-field'
|
|
28
28
|
import type { InteractionType } from '@instructure/ui-react-utils'
|