@instructure/ui-date-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/DateInput/__new-tests__/DateInput.test.js +167 -129
- package/es/DateInput/index.js +71 -58
- package/es/DateInput2/__new-tests__/DateInput2.test.js +20 -19
- package/es/DateInput2/index.js +37 -35
- package/lib/DateInput/__new-tests__/DateInput.test.js +228 -191
- package/lib/DateInput/index.js +70 -58
- package/lib/DateInput2/__new-tests__/DateInput2.test.js +20 -20
- package/lib/DateInput2/index.js +37 -35
- package/package.json +20 -20
- package/src/DateInput/__new-tests__/DateInput.test.tsx +1 -1
- package/src/DateInput/index.tsx +2 -3
- package/src/DateInput/props.ts +1 -1
- package/src/DateInput2/__new-tests__/DateInput2.test.tsx +1 -1
- package/src/DateInput2/index.tsx +0 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateInput/index.d.ts +15 -17
- package/types/DateInput/index.d.ts.map +1 -1
- package/types/DateInput/props.d.ts +1 -1
- package/types/DateInput/props.d.ts.map +1 -1
- package/types/DateInput2/index.d.ts +1 -2
- package/types/DateInput2/index.d.ts.map +1 -1
package/lib/DateInput/index.js
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.default = exports.DateInput = void 0;
|
9
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
10
|
-
var _react =
|
9
|
+
var _react = require("react");
|
11
10
|
var _Calendar = require("@instructure/ui-calendar/lib/Calendar");
|
12
11
|
var _IconCalendarMonthLine = require("@instructure/ui-icons/lib/IconCalendarMonthLine.js");
|
13
12
|
var _Popover = require("@instructure/ui-popover/lib/Popover");
|
@@ -24,6 +23,7 @@ var _Locale = require("@instructure/ui-i18n/lib/Locale.js");
|
|
24
23
|
var _emotion = require("@instructure/emotion");
|
25
24
|
var _styles = _interopRequireDefault(require("./styles"));
|
26
25
|
var _props2 = require("./props");
|
26
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
27
27
|
const _excluded = ["renderLabel", "value", "placeholder", "onBlur", "isRequired", "size", "isInline", "layout", "width", "onRequestValidateDate", "onRequestShowCalendar", "onRequestHideCalendar", "onRequestSelectNextDay", "onRequestSelectPrevDay", "onRequestRenderNextMonth", "onRequestRenderPrevMonth"],
|
28
28
|
_excluded2 = ["ref"];
|
29
29
|
var _dec, _dec2, _class, _DateInput, _IconCalendarMonthLin;
|
@@ -50,7 +50,6 @@ var _dec, _dec2, _class, _DateInput, _IconCalendarMonthLin;
|
|
50
50
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
51
51
|
* SOFTWARE.
|
52
52
|
*/
|
53
|
-
/** @jsx jsx */
|
54
53
|
/**
|
55
54
|
---
|
56
55
|
category: components
|
@@ -282,14 +281,18 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
282
281
|
this.handleHideCalendar(e, dateString);
|
283
282
|
}
|
284
283
|
};
|
285
|
-
return (0,
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
284
|
+
return (0, _jsxRuntime.jsx)(_Calendar.Calendar, {
|
285
|
+
...getListProps({
|
286
|
+
onRequestRenderNextMonth,
|
287
|
+
onRequestRenderPrevMonth,
|
288
|
+
renderNavigationLabel,
|
289
|
+
renderWeekdayLabels,
|
290
|
+
renderNextMonthButton: this.renderMonthNavigationButton('next'),
|
291
|
+
renderPrevMonthButton: this.renderMonthNavigationButton('prev')
|
292
|
+
}),
|
293
|
+
...noChildrenProps,
|
294
|
+
children: this.renderDays(getOptionProps)
|
295
|
+
});
|
293
296
|
}
|
294
297
|
renderInput({
|
295
298
|
getInputProps,
|
@@ -318,24 +321,27 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
318
321
|
ref = _getTriggerProps.ref,
|
319
322
|
triggerProps = (0, _objectWithoutProperties2.default)(_getTriggerProps, _excluded2);
|
320
323
|
const messages = this.props.messages || this.state.messages;
|
321
|
-
return (0,
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
324
|
+
return (0, _jsxRuntime.jsx)(_TextInput.TextInput, {
|
325
|
+
...triggerProps,
|
326
|
+
...(0, _passthroughProps.passthroughProps)(rest),
|
327
|
+
...getInputProps({
|
328
|
+
renderLabel: (0, _callRenderProp.callRenderProp)(renderLabel),
|
329
|
+
value,
|
330
|
+
placeholder,
|
331
|
+
size,
|
332
|
+
layout,
|
333
|
+
width,
|
334
|
+
messages,
|
335
|
+
onChange: this.handleInputChange,
|
336
|
+
onBlur: (0, _createChainedFunction.createChainedFunction)(onBlur, this.handleHideCalendar),
|
337
|
+
inputRef: (0, _createChainedFunction.createChainedFunction)(ref, this.handleInputRef),
|
338
|
+
interaction,
|
339
|
+
isRequired,
|
340
|
+
display: isInline ? 'inline-block' : 'block',
|
341
|
+
renderAfterInput: _IconCalendarMonthLin || (_IconCalendarMonthLin = (0, _jsxRuntime.jsx)(_IconCalendarMonthLine.IconCalendarMonthLine, {
|
342
|
+
inline: false
|
343
|
+
}))
|
344
|
+
}),
|
339
345
|
onKeyDown: e => {
|
340
346
|
var _triggerProps$onKeyDo;
|
341
347
|
if (!this.props.children) {
|
@@ -346,7 +352,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
346
352
|
}
|
347
353
|
(_triggerProps$onKeyDo = triggerProps.onKeyDown) === null || _triggerProps$onKeyDo === void 0 ? void 0 : _triggerProps$onKeyDo.call(triggerProps, e);
|
348
354
|
}
|
349
|
-
})
|
355
|
+
});
|
350
356
|
}
|
351
357
|
render() {
|
352
358
|
const _this$props13 = this.props,
|
@@ -354,40 +360,46 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
354
360
|
assistiveText = _this$props13.assistiveText,
|
355
361
|
styles = _this$props13.styles;
|
356
362
|
const isShowingCalendar = this.shouldShowCalendar();
|
357
|
-
return (0,
|
363
|
+
return (0, _jsxRuntime.jsx)(_Selectable.Selectable, {
|
358
364
|
isShowingOptions: isShowingCalendar,
|
359
365
|
onRequestShowOptions: this.handleShowCalendar,
|
360
366
|
onRequestHideOptions: this.handleHideCalendar,
|
361
367
|
onRequestHighlightOption: this.handleHighlightOption,
|
362
368
|
onRequestSelectOption: e => this.handleHideCalendar(e),
|
363
369
|
selectedOptionId: this.selectedDateId,
|
364
|
-
highlightedOptionId: this.selectedDateId
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
370
|
+
highlightedOptionId: this.selectedDateId,
|
371
|
+
children: ({
|
372
|
+
getRootProps,
|
373
|
+
getInputProps,
|
374
|
+
getTriggerProps,
|
375
|
+
getListProps,
|
376
|
+
getOptionProps,
|
377
|
+
getDescriptionProps
|
378
|
+
}) => (0, _jsxRuntime.jsxs)("span", {
|
379
|
+
...getRootProps({
|
380
|
+
css: styles === null || styles === void 0 ? void 0 : styles.dateInput
|
381
|
+
}),
|
382
|
+
ref: el => this.ref = el,
|
383
|
+
children: [this.renderInput({
|
384
|
+
getInputProps,
|
385
|
+
getTriggerProps
|
386
|
+
}), (0, _jsxRuntime.jsx)("span", {
|
387
|
+
...getDescriptionProps(),
|
388
|
+
css: styles === null || styles === void 0 ? void 0 : styles.assistiveText,
|
389
|
+
children: assistiveText
|
390
|
+
}), (0, _jsxRuntime.jsx)(_Popover.Popover, {
|
391
|
+
placement: placement,
|
392
|
+
isShowingContent: isShowingCalendar,
|
393
|
+
positionTarget: this._input,
|
394
|
+
shouldReturnFocus: false,
|
395
|
+
shouldFocusContentOnTriggerBlur: true,
|
396
|
+
children: this.renderCalendar({
|
397
|
+
getListProps,
|
398
|
+
getOptionProps
|
399
|
+
})
|
400
|
+
})]
|
401
|
+
})
|
402
|
+
});
|
391
403
|
}
|
392
404
|
}, _DateInput.displayName = "DateInput", _DateInput.componentId = 'DateInput', _DateInput.Day = _Calendar.Calendar.Day, _DateInput.propTypes = _props2.propTypes, _DateInput.allowedProps = _props2.allowedProps, _DateInput.defaultProps = {
|
393
405
|
value: '',
|
@@ -1,15 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
5
4
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
6
|
-
var _react =
|
5
|
+
var _react = require("react");
|
7
6
|
var _react2 = require("@testing-library/react");
|
8
7
|
var _vitest = require("vitest");
|
9
8
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
10
9
|
require("@testing-library/jest-dom");
|
11
10
|
var _IconHeartLine2 = require("@instructure/ui-icons/lib/IconHeartLine.js");
|
12
11
|
var _index = require("../index");
|
12
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
13
13
|
var _DateInputExample, _DateInputExample2, _IconHeartLine, _DateInputExample3, _DateInputExample4;
|
14
14
|
/*
|
15
15
|
* The MIT License (MIT)
|
@@ -40,7 +40,7 @@ const DateInputExample = () => {
|
|
40
40
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
41
41
|
inputValue = _useState2[0],
|
42
42
|
setInputValue = _useState2[1];
|
43
|
-
return
|
43
|
+
return (0, _jsxRuntime.jsx)(_index.DateInput2, {
|
44
44
|
renderLabel: LABEL_TEXT,
|
45
45
|
screenReaderLabels: {
|
46
46
|
calendarIcon: 'Calendar',
|
@@ -66,14 +66,14 @@ describe('<DateInput2 />', () => {
|
|
66
66
|
consoleErrorMock.mockRestore();
|
67
67
|
});
|
68
68
|
it('should render an input', async () => {
|
69
|
-
const _render = (0, _react2.render)(_DateInputExample || (_DateInputExample =
|
69
|
+
const _render = (0, _react2.render)(_DateInputExample || (_DateInputExample = (0, _jsxRuntime.jsx)(DateInputExample, {}))),
|
70
70
|
container = _render.container;
|
71
71
|
const dateInput = container.querySelector('input');
|
72
72
|
expect(dateInput).toBeInTheDocument();
|
73
73
|
expect(dateInput).toHaveAttribute('type', 'text');
|
74
74
|
});
|
75
75
|
it('should render an input label', async () => {
|
76
|
-
const _render2 = (0, _react2.render)(_DateInputExample2 || (_DateInputExample2 =
|
76
|
+
const _render2 = (0, _react2.render)(_DateInputExample2 || (_DateInputExample2 = (0, _jsxRuntime.jsx)(DateInputExample, {}))),
|
77
77
|
container = _render2.container;
|
78
78
|
const label = container.querySelector('label');
|
79
79
|
expect(label).toBeInTheDocument();
|
@@ -81,7 +81,7 @@ describe('<DateInput2 />', () => {
|
|
81
81
|
});
|
82
82
|
it('should render an input placeholder', async () => {
|
83
83
|
const placeholder = 'Placeholder';
|
84
|
-
(0, _react2.render)(
|
84
|
+
(0, _react2.render)((0, _jsxRuntime.jsx)(_index.DateInput2, {
|
85
85
|
renderLabel: "Choose a date",
|
86
86
|
screenReaderLabels: {
|
87
87
|
calendarIcon: 'Calendar',
|
@@ -96,7 +96,7 @@ describe('<DateInput2 />', () => {
|
|
96
96
|
});
|
97
97
|
it('should render a calendar icon with screen reader label', async () => {
|
98
98
|
const iconLabel = 'Calendar icon Label';
|
99
|
-
const _render3 = (0, _react2.render)(
|
99
|
+
const _render3 = (0, _react2.render)((0, _jsxRuntime.jsx)(_index.DateInput2, {
|
100
100
|
renderLabel: "Choose a date",
|
101
101
|
screenReaderLabels: {
|
102
102
|
calendarIcon: iconLabel,
|
@@ -113,7 +113,7 @@ describe('<DateInput2 />', () => {
|
|
113
113
|
});
|
114
114
|
it('should render a custom calendar icon with screen reader label', async () => {
|
115
115
|
const iconLabel = 'Calendar icon Label';
|
116
|
-
const _render4 = (0, _react2.render)(
|
116
|
+
const _render4 = (0, _react2.render)((0, _jsxRuntime.jsx)(_index.DateInput2, {
|
117
117
|
renderLabel: "Choose a date",
|
118
118
|
screenReaderLabels: {
|
119
119
|
calendarIcon: iconLabel,
|
@@ -121,7 +121,7 @@ describe('<DateInput2 />', () => {
|
|
121
121
|
prevMonthButton: 'Previous month'
|
122
122
|
},
|
123
123
|
value: "",
|
124
|
-
renderCalendarIcon: _IconHeartLine || (_IconHeartLine =
|
124
|
+
renderCalendarIcon: _IconHeartLine || (_IconHeartLine = (0, _jsxRuntime.jsx)(_IconHeartLine2.IconHeartLine, {}))
|
125
125
|
})),
|
126
126
|
container = _render4.container;
|
127
127
|
const calendarIcon = container.querySelector('svg[name="IconHeart"]');
|
@@ -130,12 +130,12 @@ describe('<DateInput2 />', () => {
|
|
130
130
|
expect(calendarLabel).toBeInTheDocument();
|
131
131
|
});
|
132
132
|
it('should not show calendar table by default', async () => {
|
133
|
-
(0, _react2.render)(_DateInputExample3 || (_DateInputExample3 =
|
133
|
+
(0, _react2.render)(_DateInputExample3 || (_DateInputExample3 = (0, _jsxRuntime.jsx)(DateInputExample, {})));
|
134
134
|
const calendarTable = _react2.screen.queryByRole('table');
|
135
135
|
expect(calendarTable).not.toBeInTheDocument();
|
136
136
|
});
|
137
137
|
it('should show calendar table when calendar button is clicked', async () => {
|
138
|
-
(0, _react2.render)(_DateInputExample4 || (_DateInputExample4 =
|
138
|
+
(0, _react2.render)(_DateInputExample4 || (_DateInputExample4 = (0, _jsxRuntime.jsx)(DateInputExample, {})));
|
139
139
|
const calendarButton = _react2.screen.getByRole('button');
|
140
140
|
expect(calendarButton).toBeInTheDocument();
|
141
141
|
await _userEvent.default.click(calendarButton);
|
@@ -147,7 +147,7 @@ describe('<DateInput2 />', () => {
|
|
147
147
|
it('should render navigation arrow buttons with screen reader labels', async () => {
|
148
148
|
const nextMonthLabel = 'Next month';
|
149
149
|
const prevMonthLabel = 'Previous month';
|
150
|
-
(0, _react2.render)(
|
150
|
+
(0, _react2.render)((0, _jsxRuntime.jsx)(_index.DateInput2, {
|
151
151
|
renderLabel: "Choose a date",
|
152
152
|
screenReaderLabels: {
|
153
153
|
calendarIcon: 'Calendar',
|
@@ -179,7 +179,7 @@ describe('<DateInput2 />', () => {
|
|
179
179
|
});
|
180
180
|
it('should programmatically set and render the initial value', async () => {
|
181
181
|
const value = '26/03/2024';
|
182
|
-
(0, _react2.render)(
|
182
|
+
(0, _react2.render)((0, _jsxRuntime.jsx)(_index.DateInput2, {
|
183
183
|
renderLabel: "Choose a date",
|
184
184
|
screenReaderLabels: {
|
185
185
|
calendarIcon: 'Calendar',
|
@@ -196,7 +196,7 @@ describe('<DateInput2 />', () => {
|
|
196
196
|
});
|
197
197
|
it('should set interaction type to disabled', async () => {
|
198
198
|
const interactionDisabled = 'disabled';
|
199
|
-
const _render5 = (0, _react2.render)(
|
199
|
+
const _render5 = (0, _react2.render)((0, _jsxRuntime.jsx)(_index.DateInput2, {
|
200
200
|
renderLabel: "Choose a date",
|
201
201
|
screenReaderLabels: {
|
202
202
|
calendarIcon: 'Calendar',
|
@@ -212,7 +212,7 @@ describe('<DateInput2 />', () => {
|
|
212
212
|
});
|
213
213
|
it('should set interaction type to readonly', async () => {
|
214
214
|
const interactionReadOnly = 'readonly';
|
215
|
-
const _render6 = (0, _react2.render)(
|
215
|
+
const _render6 = (0, _react2.render)((0, _jsxRuntime.jsx)(_index.DateInput2, {
|
216
216
|
renderLabel: "Choose a date",
|
217
217
|
screenReaderLabels: {
|
218
218
|
calendarIcon: 'Calendar',
|
@@ -234,7 +234,7 @@ describe('<DateInput2 />', () => {
|
|
234
234
|
});
|
235
235
|
});
|
236
236
|
it('should set required', async () => {
|
237
|
-
const _render7 = (0, _react2.render)(
|
237
|
+
const _render7 = (0, _react2.render)((0, _jsxRuntime.jsx)(_index.DateInput2, {
|
238
238
|
renderLabel: "Choose a date",
|
239
239
|
screenReaderLabels: {
|
240
240
|
calendarIcon: 'Calendar',
|
@@ -250,7 +250,7 @@ describe('<DateInput2 />', () => {
|
|
250
250
|
});
|
251
251
|
it('should call onBlur', async () => {
|
252
252
|
const onBlur = _vitest.vi.fn();
|
253
|
-
(0, _react2.render)(
|
253
|
+
(0, _react2.render)((0, _jsxRuntime.jsx)(_index.DateInput2, {
|
254
254
|
renderLabel: "Choose a date",
|
255
255
|
screenReaderLabels: {
|
256
256
|
calendarIcon: 'Calendar',
|
@@ -273,7 +273,7 @@ describe('<DateInput2 />', () => {
|
|
273
273
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
274
274
|
inputValue = _useState4[0],
|
275
275
|
setInputValue = _useState4[1];
|
276
|
-
return
|
276
|
+
return (0, _jsxRuntime.jsx)(_index.DateInput2, {
|
277
277
|
renderLabel: LABEL_TEXT,
|
278
278
|
screenReaderLabels: {
|
279
279
|
calendarIcon: 'Calendar',
|
@@ -287,7 +287,7 @@ describe('<DateInput2 />', () => {
|
|
287
287
|
invalidDateErrorMessage: errorMsg
|
288
288
|
});
|
289
289
|
};
|
290
|
-
(0, _react2.render)(
|
290
|
+
(0, _react2.render)((0, _jsxRuntime.jsx)(Example, {}));
|
291
291
|
expect(_react2.screen.queryByText(errorMsg)).not.toBeInTheDocument();
|
292
292
|
const dateInput = _react2.screen.getByLabelText(LABEL_TEXT);
|
293
293
|
await _userEvent.default.click(dateInput);
|
@@ -313,7 +313,7 @@ describe('<DateInput2 />', () => {
|
|
313
313
|
type: 'screenreader-only',
|
314
314
|
text: 'Screenreader'
|
315
315
|
}];
|
316
|
-
(0, _react2.render)(
|
316
|
+
(0, _react2.render)((0, _jsxRuntime.jsx)(_index.DateInput2, {
|
317
317
|
renderLabel: "Choose a date",
|
318
318
|
screenReaderLabels: {
|
319
319
|
calendarIcon: 'Calendar',
|
package/lib/DateInput2/index.js
CHANGED
@@ -18,8 +18,8 @@ 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 _ApplyLocaleContext = require("@instructure/ui-i18n/lib/ApplyLocale/ApplyLocaleContext.js");
|
20
20
|
var _Locale = require("@instructure/ui-i18n/lib/Locale.js");
|
21
|
-
var _emotion = require("@instructure/emotion");
|
22
21
|
var _props = require("./props");
|
22
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
23
23
|
var _IconCalendarMonthLin, _IconArrowOpenEndSoli, _IconArrowOpenStartSo;
|
24
24
|
/*
|
25
25
|
* The MIT License (MIT)
|
@@ -44,7 +44,6 @@ var _IconCalendarMonthLin, _IconArrowOpenEndSoli, _IconArrowOpenStartSo;
|
|
44
44
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
45
45
|
* SOFTWARE.
|
46
46
|
*/
|
47
|
-
/** @jsx jsx */
|
48
47
|
function parseLocaleDate(dateString = '', locale, timeZone) {
|
49
48
|
// This function may seem complicated but it basically does one thing:
|
50
49
|
// Given a dateString, a locale and a timeZone. The dateString is assumed to be formatted according
|
@@ -259,7 +258,8 @@ const DateInput2 = ({
|
|
259
258
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e, value || '', utcIsoDate);
|
260
259
|
};
|
261
260
|
const selectedDate = parseDate(value)[1];
|
262
|
-
return (0,
|
261
|
+
return (0, _jsxRuntime.jsx)(_TextInput.TextInput, {
|
262
|
+
...(0, _passthroughProps.passthroughProps)(rest),
|
263
263
|
inputRef: inputRef,
|
264
264
|
renderLabel: renderLabel,
|
265
265
|
onChange: handleInputChange,
|
@@ -272,49 +272,51 @@ const DateInput2 = ({
|
|
272
272
|
messages: inputMessages,
|
273
273
|
interaction: interaction,
|
274
274
|
margin: margin,
|
275
|
-
renderAfterInput: (0,
|
276
|
-
renderTrigger: (0,
|
275
|
+
renderAfterInput: (0, _jsxRuntime.jsx)(_Popover.Popover, {
|
276
|
+
renderTrigger: (0, _jsxRuntime.jsx)(_IconButton.IconButton, {
|
277
277
|
withBackground: false,
|
278
278
|
withBorder: false,
|
279
279
|
screenReaderLabel: screenReaderLabels.calendarIcon,
|
280
280
|
shape: "circle",
|
281
|
-
interaction: interaction
|
282
|
-
|
281
|
+
interaction: interaction,
|
282
|
+
children: renderCalendarIcon ? (0, _callRenderProp.callRenderProp)(renderCalendarIcon) : _IconCalendarMonthLin || (_IconCalendarMonthLin = (0, _jsxRuntime.jsx)(_IconCalendarMonthLine.IconCalendarMonthLine, {}))
|
283
|
+
}),
|
283
284
|
isShowingContent: showPopover,
|
284
285
|
onShowContent: () => setShowPopover(true),
|
285
286
|
onHideContent: () => setShowPopover(false),
|
286
287
|
on: "click",
|
287
288
|
shouldContainFocus: true,
|
288
289
|
shouldReturnFocus: true,
|
289
|
-
shouldCloseOnDocumentClick: true
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
290
|
+
shouldCloseOnDocumentClick: true,
|
291
|
+
children: (0, _jsxRuntime.jsx)(_Calendar.Calendar, {
|
292
|
+
withYearPicker: withYearPicker,
|
293
|
+
onDateSelected: handleDateSelected,
|
294
|
+
selectedDate: selectedDate,
|
295
|
+
disabledDates: disabledDates,
|
296
|
+
visibleMonth: selectedDate,
|
297
|
+
locale: getLocale(),
|
298
|
+
timezone: getTimezone(),
|
299
|
+
renderNextMonthButton: (0, _jsxRuntime.jsx)(_IconButton.IconButton, {
|
300
|
+
size: "small",
|
301
|
+
withBackground: false,
|
302
|
+
withBorder: false,
|
303
|
+
renderIcon: _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = (0, _jsxRuntime.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, {
|
304
|
+
color: "primary"
|
305
|
+
})),
|
306
|
+
screenReaderLabel: screenReaderLabels.nextMonthButton
|
307
|
+
}),
|
308
|
+
renderPrevMonthButton: (0, _jsxRuntime.jsx)(_IconButton.IconButton, {
|
309
|
+
size: "small",
|
310
|
+
withBackground: false,
|
311
|
+
withBorder: false,
|
312
|
+
renderIcon: _IconArrowOpenStartSo || (_IconArrowOpenStartSo = (0, _jsxRuntime.jsx)(_IconArrowOpenStartSolid.IconArrowOpenStartSolid, {
|
313
|
+
color: "primary"
|
314
|
+
})),
|
315
|
+
screenReaderLabel: screenReaderLabels.prevMonthButton
|
316
|
+
})
|
315
317
|
})
|
316
|
-
})
|
317
|
-
})
|
318
|
+
})
|
319
|
+
});
|
318
320
|
};
|
319
321
|
exports.DateInput2 = DateInput2;
|
320
322
|
DateInput2.propTypes = _props.propTypes;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@instructure/ui-date-input",
|
3
|
-
"version": "10.16.1
|
3
|
+
"version": "10.16.1",
|
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,11 +23,11 @@
|
|
23
23
|
},
|
24
24
|
"license": "MIT",
|
25
25
|
"devDependencies": {
|
26
|
-
"@instructure/ui-axe-check": "10.16.1
|
27
|
-
"@instructure/ui-babel-preset": "10.16.1
|
28
|
-
"@instructure/ui-buttons": "10.16.1
|
29
|
-
"@instructure/ui-scripts": "10.16.1
|
30
|
-
"@instructure/ui-test-utils": "10.16.1
|
26
|
+
"@instructure/ui-axe-check": "10.16.1",
|
27
|
+
"@instructure/ui-babel-preset": "10.16.1",
|
28
|
+
"@instructure/ui-buttons": "10.16.1",
|
29
|
+
"@instructure/ui-scripts": "10.16.1",
|
30
|
+
"@instructure/ui-test-utils": "10.16.1",
|
31
31
|
"@testing-library/jest-dom": "^6.6.3",
|
32
32
|
"@testing-library/react": "^16.0.1",
|
33
33
|
"@testing-library/user-event": "^14.5.2",
|
@@ -35,20 +35,20 @@
|
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
37
|
"@babel/runtime": "^7.26.0",
|
38
|
-
"@instructure/emotion": "10.16.1
|
39
|
-
"@instructure/shared-types": "10.16.1
|
40
|
-
"@instructure/ui-calendar": "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-popover": "10.16.1
|
45
|
-
"@instructure/ui-position": "10.16.1
|
46
|
-
"@instructure/ui-prop-types": "10.16.1
|
47
|
-
"@instructure/ui-react-utils": "10.16.1
|
48
|
-
"@instructure/ui-selectable": "10.16.1
|
49
|
-
"@instructure/ui-testable": "10.16.1
|
50
|
-
"@instructure/ui-text-input": "10.16.1
|
51
|
-
"@instructure/ui-utils": "10.16.1
|
38
|
+
"@instructure/emotion": "10.16.1",
|
39
|
+
"@instructure/shared-types": "10.16.1",
|
40
|
+
"@instructure/ui-calendar": "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-popover": "10.16.1",
|
45
|
+
"@instructure/ui-position": "10.16.1",
|
46
|
+
"@instructure/ui-prop-types": "10.16.1",
|
47
|
+
"@instructure/ui-react-utils": "10.16.1",
|
48
|
+
"@instructure/ui-selectable": "10.16.1",
|
49
|
+
"@instructure/ui-testable": "10.16.1",
|
50
|
+
"@instructure/ui-text-input": "10.16.1",
|
51
|
+
"@instructure/ui-utils": "10.16.1",
|
52
52
|
"moment-timezone": "^0.5.45",
|
53
53
|
"prop-types": "^15.8.1"
|
54
54
|
},
|
@@ -21,7 +21,7 @@
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
|
-
|
24
|
+
|
25
25
|
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
26
26
|
import { vi } from 'vitest'
|
27
27
|
import userEvent from '@testing-library/user-event'
|
package/src/DateInput/index.tsx
CHANGED
@@ -22,8 +22,7 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
|
26
|
-
import React, { Children, Component, ReactElement } from 'react'
|
25
|
+
import { Children, Component, ReactElement } from 'react'
|
27
26
|
|
28
27
|
import { Calendar } from '@instructure/ui-calendar'
|
29
28
|
import type { CalendarProps, CalendarDayProps } from '@instructure/ui-calendar'
|
@@ -47,7 +46,7 @@ import { testable } from '@instructure/ui-testable'
|
|
47
46
|
|
48
47
|
import { DateTime, ApplyLocaleContext, Locale } from '@instructure/ui-i18n'
|
49
48
|
|
50
|
-
import { withStyle
|
49
|
+
import { withStyle } from '@instructure/emotion'
|
51
50
|
|
52
51
|
import generateStyle from './styles'
|
53
52
|
|
package/src/DateInput/props.ts
CHANGED
@@ -40,7 +40,7 @@ import type {
|
|
40
40
|
PropValidators
|
41
41
|
} from '@instructure/shared-types'
|
42
42
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
43
|
-
import
|
43
|
+
import { InputHTMLAttributes, ReactElement, SyntheticEvent } from 'react'
|
44
44
|
|
45
45
|
type DateInputOwnProps = {
|
46
46
|
/**
|
@@ -21,7 +21,7 @@
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
|
-
import
|
24
|
+
import { useState } from 'react'
|
25
25
|
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
26
26
|
import { vi, MockInstance } from 'vitest'
|
27
27
|
import userEvent from '@testing-library/user-event'
|
package/src/DateInput2/index.tsx
CHANGED
@@ -22,7 +22,6 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
/** @jsx jsx */
|
26
25
|
import { useState, useEffect, useContext } from 'react'
|
27
26
|
import type { SyntheticEvent } from 'react'
|
28
27
|
import { Calendar } from '@instructure/ui-calendar'
|
@@ -37,7 +36,6 @@ import { TextInput } from '@instructure/ui-text-input'
|
|
37
36
|
import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils'
|
38
37
|
|
39
38
|
import { ApplyLocaleContext, Locale } from '@instructure/ui-i18n'
|
40
|
-
import { jsx } from '@instructure/emotion'
|
41
39
|
|
42
40
|
import { propTypes } from './props'
|
43
41
|
import type { DateInput2Props } from './props'
|