@instructure/ui-date-input 10.16.1-pr-snapshot-1744893671793 → 10.16.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 +1 -1
- package/es/DateInput/__new-tests__/DateInput.test.js +129 -167
- package/es/DateInput/index.js +58 -71
- package/es/DateInput2/__new-tests__/DateInput2.test.js +19 -20
- package/es/DateInput2/index.js +35 -37
- package/lib/DateInput/__new-tests__/DateInput.test.js +191 -228
- package/lib/DateInput/index.js +58 -70
- package/lib/DateInput2/__new-tests__/DateInput2.test.js +20 -20
- package/lib/DateInput2/index.js +35 -37
- package/package.json +20 -20
- package/src/DateInput/__new-tests__/DateInput.test.tsx +1 -1
- package/src/DateInput/index.tsx +3 -2
- package/src/DateInput/props.ts +1 -1
- package/src/DateInput2/__new-tests__/DateInput2.test.tsx +1 -1
- package/src/DateInput2/index.tsx +2 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateInput/index.d.ts +17 -15
- 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 +2 -1
- package/types/DateInput2/index.d.ts.map +1 -1
package/lib/DateInput/index.js
CHANGED
@@ -1,12 +1,13 @@
|
|
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;
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.default = exports.DateInput = void 0;
|
8
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
9
|
-
var _react = require("react");
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
10
11
|
var _Calendar = require("@instructure/ui-calendar/lib/Calendar");
|
11
12
|
var _IconCalendarMonthLine = require("@instructure/ui-icons/lib/IconCalendarMonthLine.js");
|
12
13
|
var _Popover = require("@instructure/ui-popover/lib/Popover");
|
@@ -23,7 +24,6 @@ var _Locale = require("@instructure/ui-i18n/lib/Locale.js");
|
|
23
24
|
var _emotion = require("@instructure/emotion");
|
24
25
|
var _styles = _interopRequireDefault(require("./styles"));
|
25
26
|
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,6 +50,7 @@ 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 */
|
53
54
|
/**
|
54
55
|
---
|
55
56
|
category: components
|
@@ -281,18 +282,14 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
281
282
|
this.handleHideCalendar(e, dateString);
|
282
283
|
}
|
283
284
|
};
|
284
|
-
return (0,
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
}),
|
293
|
-
...noChildrenProps,
|
294
|
-
children: this.renderDays(getOptionProps)
|
295
|
-
});
|
285
|
+
return (0, _emotion.jsx)(_Calendar.Calendar, Object.assign({}, getListProps({
|
286
|
+
onRequestRenderNextMonth,
|
287
|
+
onRequestRenderPrevMonth,
|
288
|
+
renderNavigationLabel,
|
289
|
+
renderWeekdayLabels,
|
290
|
+
renderNextMonthButton: this.renderMonthNavigationButton('next'),
|
291
|
+
renderPrevMonthButton: this.renderMonthNavigationButton('prev')
|
292
|
+
}), noChildrenProps), this.renderDays(getOptionProps));
|
296
293
|
}
|
297
294
|
renderInput({
|
298
295
|
getInputProps,
|
@@ -321,27 +318,24 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
321
318
|
ref = _getTriggerProps.ref,
|
322
319
|
triggerProps = (0, _objectWithoutProperties2.default)(_getTriggerProps, _excluded2);
|
323
320
|
const messages = this.props.messages || this.state.messages;
|
324
|
-
return (0,
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
inline: false
|
343
|
-
}))
|
344
|
-
}),
|
321
|
+
return (0, _emotion.jsx)(_TextInput.TextInput, Object.assign({}, triggerProps, (0, _passthroughProps.passthroughProps)(rest), getInputProps({
|
322
|
+
renderLabel: (0, _callRenderProp.callRenderProp)(renderLabel),
|
323
|
+
value,
|
324
|
+
placeholder,
|
325
|
+
size,
|
326
|
+
layout,
|
327
|
+
width,
|
328
|
+
messages,
|
329
|
+
onChange: this.handleInputChange,
|
330
|
+
onBlur: (0, _createChainedFunction.createChainedFunction)(onBlur, this.handleHideCalendar),
|
331
|
+
inputRef: (0, _createChainedFunction.createChainedFunction)(ref, this.handleInputRef),
|
332
|
+
interaction,
|
333
|
+
isRequired,
|
334
|
+
display: isInline ? 'inline-block' : 'block',
|
335
|
+
renderAfterInput: _IconCalendarMonthLin || (_IconCalendarMonthLin = (0, _emotion.jsx)(_IconCalendarMonthLine.IconCalendarMonthLine, {
|
336
|
+
inline: false
|
337
|
+
}))
|
338
|
+
}), {
|
345
339
|
onKeyDown: e => {
|
346
340
|
var _triggerProps$onKeyDo;
|
347
341
|
if (!this.props.children) {
|
@@ -352,7 +346,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
352
346
|
}
|
353
347
|
(_triggerProps$onKeyDo = triggerProps.onKeyDown) === null || _triggerProps$onKeyDo === void 0 ? void 0 : _triggerProps$onKeyDo.call(triggerProps, e);
|
354
348
|
}
|
355
|
-
});
|
349
|
+
}));
|
356
350
|
}
|
357
351
|
render() {
|
358
352
|
const _this$props13 = this.props,
|
@@ -360,46 +354,40 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
360
354
|
assistiveText = _this$props13.assistiveText,
|
361
355
|
styles = _this$props13.styles;
|
362
356
|
const isShowingCalendar = this.shouldShowCalendar();
|
363
|
-
return (0,
|
357
|
+
return (0, _emotion.jsx)(_Selectable.Selectable, {
|
364
358
|
isShowingOptions: isShowingCalendar,
|
365
359
|
onRequestShowOptions: this.handleShowCalendar,
|
366
360
|
onRequestHideOptions: this.handleHideCalendar,
|
367
361
|
onRequestHighlightOption: this.handleHighlightOption,
|
368
362
|
onRequestSelectOption: e => this.handleHideCalendar(e),
|
369
363
|
selectedOptionId: this.selectedDateId,
|
370
|
-
highlightedOptionId: this.selectedDateId
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
getListProps,
|
398
|
-
getOptionProps
|
399
|
-
})
|
400
|
-
})]
|
401
|
-
})
|
402
|
-
});
|
364
|
+
highlightedOptionId: this.selectedDateId
|
365
|
+
}, ({
|
366
|
+
getRootProps,
|
367
|
+
getInputProps,
|
368
|
+
getTriggerProps,
|
369
|
+
getListProps,
|
370
|
+
getOptionProps,
|
371
|
+
getDescriptionProps
|
372
|
+
}) => (0, _emotion.jsx)("span", Object.assign({}, getRootProps({
|
373
|
+
css: styles === null || styles === void 0 ? void 0 : styles.dateInput
|
374
|
+
}), {
|
375
|
+
ref: el => this.ref = el
|
376
|
+
}), this.renderInput({
|
377
|
+
getInputProps,
|
378
|
+
getTriggerProps
|
379
|
+
}), (0, _emotion.jsx)("span", Object.assign({}, getDescriptionProps(), {
|
380
|
+
css: styles === null || styles === void 0 ? void 0 : styles.assistiveText
|
381
|
+
}), assistiveText), (0, _emotion.jsx)(_Popover.Popover, {
|
382
|
+
placement: placement,
|
383
|
+
isShowingContent: isShowingCalendar,
|
384
|
+
positionTarget: this._input,
|
385
|
+
shouldReturnFocus: false,
|
386
|
+
shouldFocusContentOnTriggerBlur: true
|
387
|
+
}, this.renderCalendar({
|
388
|
+
getListProps,
|
389
|
+
getOptionProps
|
390
|
+
}))));
|
403
391
|
}
|
404
392
|
}, _DateInput.displayName = "DateInput", _DateInput.componentId = 'DateInput', _DateInput.Day = _Calendar.Calendar.Day, _DateInput.propTypes = _props2.propTypes, _DateInput.allowedProps = _props2.allowedProps, _DateInput.defaultProps = {
|
405
393
|
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;
|
4
5
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
5
|
-
var _react = require("react");
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
6
7
|
var _react2 = require("@testing-library/react");
|
7
8
|
var _vitest = require("vitest");
|
8
9
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
9
10
|
require("@testing-library/jest-dom");
|
10
11
|
var _IconHeartLine2 = require("@instructure/ui-icons/lib/IconHeartLine.js");
|
11
12
|
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 /*#__PURE__*/_react.default.createElement(_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 = /*#__PURE__*/_react.default.createElement(DateInputExample, null))),
|
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 = /*#__PURE__*/_react.default.createElement(DateInputExample, null))),
|
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)(/*#__PURE__*/_react.default.createElement(_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)(/*#__PURE__*/_react.default.createElement(_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)(/*#__PURE__*/_react.default.createElement(_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 = /*#__PURE__*/_react.default.createElement(_IconHeartLine2.IconHeartLine, null))
|
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 = /*#__PURE__*/_react.default.createElement(DateInputExample, null)));
|
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 = /*#__PURE__*/_react.default.createElement(DateInputExample, null)));
|
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)(/*#__PURE__*/_react.default.createElement(_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)(/*#__PURE__*/_react.default.createElement(_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)(/*#__PURE__*/_react.default.createElement(_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)(/*#__PURE__*/_react.default.createElement(_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)(/*#__PURE__*/_react.default.createElement(_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)(/*#__PURE__*/_react.default.createElement(_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 /*#__PURE__*/_react.default.createElement(_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)(/*#__PURE__*/_react.default.createElement(Example, null));
|
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)(/*#__PURE__*/_react.default.createElement(_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");
|
21
22
|
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,6 +44,7 @@ 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 */
|
47
48
|
function parseLocaleDate(dateString = '', locale, timeZone) {
|
48
49
|
// This function may seem complicated but it basically does one thing:
|
49
50
|
// Given a dateString, a locale and a timeZone. The dateString is assumed to be formatted according
|
@@ -258,8 +259,7 @@ const DateInput2 = ({
|
|
258
259
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e, value || '', utcIsoDate);
|
259
260
|
};
|
260
261
|
const selectedDate = parseDate(value)[1];
|
261
|
-
return (0,
|
262
|
-
...(0, _passthroughProps.passthroughProps)(rest),
|
262
|
+
return (0, _emotion.jsx)(_TextInput.TextInput, Object.assign({}, (0, _passthroughProps.passthroughProps)(rest), {
|
263
263
|
inputRef: inputRef,
|
264
264
|
renderLabel: renderLabel,
|
265
265
|
onChange: handleInputChange,
|
@@ -272,51 +272,49 @@ const DateInput2 = ({
|
|
272
272
|
messages: inputMessages,
|
273
273
|
interaction: interaction,
|
274
274
|
margin: margin,
|
275
|
-
renderAfterInput: (0,
|
276
|
-
renderTrigger: (0,
|
275
|
+
renderAfterInput: (0, _emotion.jsx)(_Popover.Popover, {
|
276
|
+
renderTrigger: (0, _emotion.jsx)(_IconButton.IconButton, {
|
277
277
|
withBackground: false,
|
278
278
|
withBorder: false,
|
279
279
|
screenReaderLabel: screenReaderLabels.calendarIcon,
|
280
280
|
shape: "circle",
|
281
|
-
interaction: interaction
|
282
|
-
|
283
|
-
}),
|
281
|
+
interaction: interaction
|
282
|
+
}, renderCalendarIcon ? (0, _callRenderProp.callRenderProp)(renderCalendarIcon) : _IconCalendarMonthLin || (_IconCalendarMonthLin = (0, _emotion.jsx)(_IconCalendarMonthLine.IconCalendarMonthLine, null))),
|
284
283
|
isShowingContent: showPopover,
|
285
284
|
onShowContent: () => setShowPopover(true),
|
286
285
|
onHideContent: () => setShowPopover(false),
|
287
286
|
on: "click",
|
288
287
|
shouldContainFocus: true,
|
289
288
|
shouldReturnFocus: true,
|
290
|
-
shouldCloseOnDocumentClick: true
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
})
|
289
|
+
shouldCloseOnDocumentClick: true
|
290
|
+
}, (0, _emotion.jsx)(_Calendar.Calendar, {
|
291
|
+
withYearPicker: withYearPicker,
|
292
|
+
onDateSelected: handleDateSelected,
|
293
|
+
selectedDate: selectedDate,
|
294
|
+
disabledDates: disabledDates,
|
295
|
+
visibleMonth: selectedDate,
|
296
|
+
locale: getLocale(),
|
297
|
+
timezone: getTimezone(),
|
298
|
+
renderNextMonthButton: (0, _emotion.jsx)(_IconButton.IconButton, {
|
299
|
+
size: "small",
|
300
|
+
withBackground: false,
|
301
|
+
withBorder: false,
|
302
|
+
renderIcon: _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = (0, _emotion.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, {
|
303
|
+
color: "primary"
|
304
|
+
})),
|
305
|
+
screenReaderLabel: screenReaderLabels.nextMonthButton
|
306
|
+
}),
|
307
|
+
renderPrevMonthButton: (0, _emotion.jsx)(_IconButton.IconButton, {
|
308
|
+
size: "small",
|
309
|
+
withBackground: false,
|
310
|
+
withBorder: false,
|
311
|
+
renderIcon: _IconArrowOpenStartSo || (_IconArrowOpenStartSo = (0, _emotion.jsx)(_IconArrowOpenStartSolid.IconArrowOpenStartSolid, {
|
312
|
+
color: "primary"
|
313
|
+
})),
|
314
|
+
screenReaderLabel: screenReaderLabels.prevMonthButton
|
317
315
|
})
|
318
|
-
})
|
319
|
-
});
|
316
|
+
}))
|
317
|
+
}));
|
320
318
|
};
|
321
319
|
exports.DateInput2 = DateInput2;
|
322
320
|
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-snapshot-0",
|
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-snapshot-0",
|
27
|
+
"@instructure/ui-babel-preset": "10.16.1-snapshot-0",
|
28
|
+
"@instructure/ui-buttons": "10.16.1-snapshot-0",
|
29
|
+
"@instructure/ui-scripts": "10.16.1-snapshot-0",
|
30
|
+
"@instructure/ui-test-utils": "10.16.1-snapshot-0",
|
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-snapshot-0",
|
39
|
+
"@instructure/shared-types": "10.16.1-snapshot-0",
|
40
|
+
"@instructure/ui-calendar": "10.16.1-snapshot-0",
|
41
|
+
"@instructure/ui-form-field": "10.16.1-snapshot-0",
|
42
|
+
"@instructure/ui-i18n": "10.16.1-snapshot-0",
|
43
|
+
"@instructure/ui-icons": "10.16.1-snapshot-0",
|
44
|
+
"@instructure/ui-popover": "10.16.1-snapshot-0",
|
45
|
+
"@instructure/ui-position": "10.16.1-snapshot-0",
|
46
|
+
"@instructure/ui-prop-types": "10.16.1-snapshot-0",
|
47
|
+
"@instructure/ui-react-utils": "10.16.1-snapshot-0",
|
48
|
+
"@instructure/ui-selectable": "10.16.1-snapshot-0",
|
49
|
+
"@instructure/ui-testable": "10.16.1-snapshot-0",
|
50
|
+
"@instructure/ui-text-input": "10.16.1-snapshot-0",
|
51
|
+
"@instructure/ui-utils": "10.16.1-snapshot-0",
|
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
|
+
import React from 'react'
|
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,7 +22,8 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
|
25
|
+
/** @jsx jsx */
|
26
|
+
import React, { Children, Component, ReactElement } from 'react'
|
26
27
|
|
27
28
|
import { Calendar } from '@instructure/ui-calendar'
|
28
29
|
import type { CalendarProps, CalendarDayProps } from '@instructure/ui-calendar'
|
@@ -46,7 +47,7 @@ import { testable } from '@instructure/ui-testable'
|
|
46
47
|
|
47
48
|
import { DateTime, ApplyLocaleContext, Locale } from '@instructure/ui-i18n'
|
48
49
|
|
49
|
-
import { withStyle } from '@instructure/emotion'
|
50
|
+
import { withStyle, jsx } from '@instructure/emotion'
|
50
51
|
|
51
52
|
import generateStyle from './styles'
|
52
53
|
|
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 { InputHTMLAttributes, ReactElement, SyntheticEvent } from 'react'
|
43
|
+
import React, { 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 { useState } from 'react'
|
24
|
+
import React, { 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,6 +22,7 @@
|
|
22
22
|
* SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
+
/** @jsx jsx */
|
25
26
|
import { useState, useEffect, useContext } from 'react'
|
26
27
|
import type { SyntheticEvent } from 'react'
|
27
28
|
import { Calendar } from '@instructure/ui-calendar'
|
@@ -36,6 +37,7 @@ import { TextInput } from '@instructure/ui-text-input'
|
|
36
37
|
import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils'
|
37
38
|
|
38
39
|
import { ApplyLocaleContext, Locale } from '@instructure/ui-i18n'
|
40
|
+
import { jsx } from '@instructure/emotion'
|
39
41
|
|
40
42
|
import { propTypes } from './props'
|
41
43
|
import type { DateInput2Props } from './props'
|