@instructure/ui-date-input 11.7.9-snapshot-0 → 11.7.9-snapshot-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/lib/DateInput/v1/index.js +22 -26
- package/lib/DateInput/v2/index.js +7 -10
- package/lib/DateInput2/v1/index.js +7 -9
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
## [11.7.9-snapshot-
|
|
6
|
+
## [11.7.9-snapshot-1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-1) (2026-10-06)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-date-input
|
|
9
9
|
|
|
@@ -7,17 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.DateInput = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _v11_ = require("@instructure/ui-calendar/v11_6");
|
|
10
|
-
var
|
|
10
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
11
11
|
var _v11_2 = require("@instructure/ui-popover/v11_6");
|
|
12
|
-
var
|
|
12
|
+
var _uiSelectable = require("@instructure/ui-selectable");
|
|
13
13
|
var _v11_3 = require("@instructure/ui-text-input/v11_6");
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
18
|
-
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
19
|
-
var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
|
|
20
|
-
var _Locale = require("@instructure/ui-i18n/lib/Locale.js");
|
|
14
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
15
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
16
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
21
17
|
var _emotion = require("@instructure/emotion");
|
|
22
18
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
23
19
|
var _props = require("./props.js");
|
|
@@ -82,7 +78,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
82
78
|
} else if (this.context && this.context.locale) {
|
|
83
79
|
return this.context.locale;
|
|
84
80
|
}
|
|
85
|
-
return
|
|
81
|
+
return _uiI18n.Locale.browserLocale();
|
|
86
82
|
}
|
|
87
83
|
timezone() {
|
|
88
84
|
if (this.props.timezone) {
|
|
@@ -90,7 +86,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
90
86
|
} else if (this.context && this.context.timezone) {
|
|
91
87
|
return this.context.timezone;
|
|
92
88
|
}
|
|
93
|
-
return
|
|
89
|
+
return _uiI18n.DateTime.browserTimeZone();
|
|
94
90
|
}
|
|
95
91
|
componentDidMount() {
|
|
96
92
|
this.props.makeStyles?.();
|
|
@@ -112,7 +108,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
112
108
|
return selectedDateId;
|
|
113
109
|
}
|
|
114
110
|
get interaction() {
|
|
115
|
-
return (0,
|
|
111
|
+
return (0, _uiReactUtils.getInteraction)({
|
|
116
112
|
props: this.props
|
|
117
113
|
});
|
|
118
114
|
}
|
|
@@ -157,7 +153,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
157
153
|
const {
|
|
158
154
|
disabledDates
|
|
159
155
|
} = this.props;
|
|
160
|
-
if (typeof disabledDates === 'function' && disabledDates(date) || Array.isArray(disabledDates) && disabledDates.find(dateString =>
|
|
156
|
+
if (typeof disabledDates === 'function' && disabledDates(date) || Array.isArray(disabledDates) && disabledDates.find(dateString => _uiI18n.DateTime.parse(dateString, this.locale(), this.timezone()).isSame(_uiI18n.DateTime.parse(date, this.locale(), this.timezone()), 'day'))) {
|
|
161
157
|
messages.push(typeof disabledDateErrorMessage === 'function' ? disabledDateErrorMessage(date) : {
|
|
162
158
|
type: 'error',
|
|
163
159
|
text: disabledDateErrorMessage
|
|
@@ -165,7 +161,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
165
161
|
}
|
|
166
162
|
|
|
167
163
|
// check if date is valid
|
|
168
|
-
if (!
|
|
164
|
+
if (!_uiI18n.DateTime.parse(date, this.locale(), this.timezone(), [_uiI18n.DateTime.momentISOFormat, 'llll', 'LLLL', 'lll', 'LLL', 'll', 'LL', 'l', 'L'], true).isValid()) {
|
|
169
165
|
messages.push(typeof invalidDateErrorMessage === 'function' ? invalidDateErrorMessage(date) : {
|
|
170
166
|
type: 'error',
|
|
171
167
|
text: invalidDateErrorMessage
|
|
@@ -204,14 +200,14 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
204
200
|
value,
|
|
205
201
|
currentDate
|
|
206
202
|
} = this.props;
|
|
207
|
-
const isValueValid = value &&
|
|
203
|
+
const isValueValid = value && _uiI18n.DateTime.parse(value, this.locale(), this.timezone()).isValid();
|
|
208
204
|
if (direction === -1) {
|
|
209
205
|
if (onRequestSelectPrevDay) {
|
|
210
206
|
onRequestSelectPrevDay?.(event);
|
|
211
207
|
} else {
|
|
212
208
|
// @ts-expect-error TODO
|
|
213
209
|
onChange(event, {
|
|
214
|
-
value:
|
|
210
|
+
value: _uiI18n.DateTime.parse(isValueValid ? value : currentDate, this.locale(), this.timezone()).subtract(1, 'day').format('MMMM D, YYYY')
|
|
215
211
|
});
|
|
216
212
|
this.setState({
|
|
217
213
|
messages: []
|
|
@@ -224,7 +220,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
224
220
|
} else {
|
|
225
221
|
// @ts-expect-error TODO
|
|
226
222
|
onChange(event, {
|
|
227
|
-
value:
|
|
223
|
+
value: _uiI18n.DateTime.parse(isValueValid ? value : currentDate, this.locale(), this.timezone()).add(1, 'day').format('MMMM D, YYYY')
|
|
228
224
|
});
|
|
229
225
|
this.setState({
|
|
230
226
|
messages: []
|
|
@@ -238,7 +234,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
238
234
|
renderNextMonthButton
|
|
239
235
|
} = this.props;
|
|
240
236
|
const button = type === 'prev' ? renderPrevMonthButton : renderNextMonthButton;
|
|
241
|
-
return button && (0,
|
|
237
|
+
return button && (0, _uiReactUtils.safeCloneElement)((0, _uiReactUtils.callRenderProp)(button), {
|
|
242
238
|
tabIndex: -1
|
|
243
239
|
});
|
|
244
240
|
}
|
|
@@ -260,7 +256,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
260
256
|
onClick: optionProps.onClick,
|
|
261
257
|
role: 'presentation'
|
|
262
258
|
} : optionProps;
|
|
263
|
-
return (0,
|
|
259
|
+
return (0, _uiReactUtils.safeCloneElement)(day, propsAdded);
|
|
264
260
|
});
|
|
265
261
|
}
|
|
266
262
|
renderCalendar({
|
|
@@ -278,7 +274,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
278
274
|
currentDate,
|
|
279
275
|
selectedLabel
|
|
280
276
|
} = this.props;
|
|
281
|
-
const isValidDate = value ?
|
|
277
|
+
const isValidDate = value ? _uiI18n.DateTime.parse(value, this.locale(), this.timezone()).isValid() : false;
|
|
282
278
|
const noChildrenProps = this.props.children ? {} : {
|
|
283
279
|
disabledDates,
|
|
284
280
|
currentDate,
|
|
@@ -340,9 +336,9 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
340
336
|
const messages = this.props.messages || this.state.messages;
|
|
341
337
|
return (0, _jsxRuntime.jsx)(_v11_3.TextInput, {
|
|
342
338
|
...triggerProps,
|
|
343
|
-
...(0,
|
|
339
|
+
...(0, _uiReactUtils.passthroughProps)(rest),
|
|
344
340
|
...getInputProps({
|
|
345
|
-
renderLabel: (0,
|
|
341
|
+
renderLabel: (0, _uiReactUtils.callRenderProp)(renderLabel),
|
|
346
342
|
value,
|
|
347
343
|
placeholder,
|
|
348
344
|
size,
|
|
@@ -350,12 +346,12 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
350
346
|
width,
|
|
351
347
|
messages,
|
|
352
348
|
onChange: this.handleInputChange,
|
|
353
|
-
onBlur: (0,
|
|
354
|
-
inputRef: (0,
|
|
349
|
+
onBlur: (0, _uiUtils.createChainedFunction)(onBlur, this.handleHideCalendar),
|
|
350
|
+
inputRef: (0, _uiUtils.createChainedFunction)(ref, this.handleInputRef),
|
|
355
351
|
interaction,
|
|
356
352
|
isRequired,
|
|
357
353
|
display: isInline ? 'inline-block' : 'block',
|
|
358
|
-
renderAfterInput: (0, _jsxRuntime.jsx)(
|
|
354
|
+
renderAfterInput: (0, _jsxRuntime.jsx)(_uiIcons.IconCalendarMonthLine, {
|
|
359
355
|
inline: false
|
|
360
356
|
})
|
|
361
357
|
}),
|
|
@@ -378,7 +374,7 @@ let DateInput = exports.DateInput = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
378
374
|
styles
|
|
379
375
|
} = this.props;
|
|
380
376
|
const isShowingCalendar = this.shouldShowCalendar();
|
|
381
|
-
return (0, _jsxRuntime.jsx)(
|
|
377
|
+
return (0, _jsxRuntime.jsx)(_uiSelectable.Selectable, {
|
|
382
378
|
isShowingOptions: isShowingCalendar,
|
|
383
379
|
onRequestShowOptions: this.handleShowCalendar,
|
|
384
380
|
onRequestHideOptions: this.handleHideCalendar,
|
|
@@ -10,11 +10,8 @@ var _latest2 = require("@instructure/ui-buttons/latest");
|
|
|
10
10
|
var _uiIcons = require("@instructure/ui-icons");
|
|
11
11
|
var _latest3 = require("@instructure/ui-popover/latest");
|
|
12
12
|
var _latest4 = require("@instructure/ui-text-input/latest");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _useDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/useDeterministicId.js");
|
|
16
|
-
var _getLocale = require("@instructure/ui-i18n/lib/getLocale.js");
|
|
17
|
-
var _getTimezone = require("@instructure/ui-i18n/lib/getTimezone.js");
|
|
13
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
14
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
18
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
16
|
/*
|
|
20
17
|
* The MIT License (MIT)
|
|
@@ -136,8 +133,8 @@ const DateInput = exports.DateInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
136
133
|
inputRef,
|
|
137
134
|
...rest
|
|
138
135
|
}, ref) => {
|
|
139
|
-
const userLocale = locale || (0,
|
|
140
|
-
const userTimezone = timezone || (0,
|
|
136
|
+
const userLocale = locale || (0, _uiI18n.getLocale)();
|
|
137
|
+
const userTimezone = timezone || (0, _uiI18n.getTimezone)();
|
|
141
138
|
const [inputMessages, setInputMessages] = (0, _react.useState)(messages || []);
|
|
142
139
|
const [showPopover, setShowPopover] = (0, _react.useState)(false);
|
|
143
140
|
(0, _react.useEffect)(() => {
|
|
@@ -220,9 +217,9 @@ const DateInput = exports.DateInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
220
217
|
onBlur?.(e, value || '', utcIsoDate);
|
|
221
218
|
};
|
|
222
219
|
const selectedDate = parseDate(value)[1];
|
|
223
|
-
const labelId = (0,
|
|
220
|
+
const labelId = (0, _uiReactUtils.useDeterministicId)('TextInput-label')();
|
|
224
221
|
return (0, _jsxRuntime.jsx)(_latest4.TextInput, {
|
|
225
|
-
...(0,
|
|
222
|
+
...(0, _uiReactUtils.passthroughProps)(rest),
|
|
226
223
|
ref: ref,
|
|
227
224
|
inputRef: inputRef,
|
|
228
225
|
renderLabel: renderLabel,
|
|
@@ -245,7 +242,7 @@ const DateInput = exports.DateInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
245
242
|
withBorder: false,
|
|
246
243
|
screenReaderLabel: screenReaderLabels.calendarIcon,
|
|
247
244
|
interaction: interaction,
|
|
248
|
-
children: renderCalendarIcon ? (0,
|
|
245
|
+
children: renderCalendarIcon ? (0, _uiReactUtils.callRenderProp)(renderCalendarIcon) : (0, _jsxRuntime.jsx)(_uiIcons.CalendarInstUIIcon, {
|
|
249
246
|
color: "baseColor"
|
|
250
247
|
})
|
|
251
248
|
}),
|
|
@@ -10,10 +10,8 @@ var _v11_2 = require("@instructure/ui-buttons/v11_6");
|
|
|
10
10
|
var _uiIcons = require("@instructure/ui-icons");
|
|
11
11
|
var _v11_3 = require("@instructure/ui-popover/v11_6");
|
|
12
12
|
var _v11_4 = require("@instructure/ui-text-input/v11_6");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _getLocale = require("@instructure/ui-i18n/lib/getLocale.js");
|
|
16
|
-
var _getTimezone = require("@instructure/ui-i18n/lib/getTimezone.js");
|
|
13
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
14
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
17
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
18
16
|
/*
|
|
19
17
|
* The MIT License (MIT)
|
|
@@ -135,8 +133,8 @@ const DateInput2 = exports.DateInput2 = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
135
133
|
inputRef,
|
|
136
134
|
...rest
|
|
137
135
|
}, ref) => {
|
|
138
|
-
const userLocale = locale || (0,
|
|
139
|
-
const userTimezone = timezone || (0,
|
|
136
|
+
const userLocale = locale || (0, _uiI18n.getLocale)();
|
|
137
|
+
const userTimezone = timezone || (0, _uiI18n.getTimezone)();
|
|
140
138
|
const [inputMessages, setInputMessages] = (0, _react.useState)(messages || []);
|
|
141
139
|
const [showPopover, setShowPopover] = (0, _react.useState)(false);
|
|
142
140
|
(0, _react.useEffect)(() => {
|
|
@@ -220,10 +218,10 @@ const DateInput2 = exports.DateInput2 = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
220
218
|
};
|
|
221
219
|
const selectedDate = parseDate(value)[1];
|
|
222
220
|
return (0, _jsxRuntime.jsx)(_v11_4.TextInput, {
|
|
223
|
-
...(0,
|
|
221
|
+
...(0, _uiReactUtils.passthroughProps)(rest),
|
|
224
222
|
ref: ref,
|
|
225
223
|
inputRef: inputRef,
|
|
226
|
-
"aria-label": (0,
|
|
224
|
+
"aria-label": (0, _uiReactUtils.callRenderProp)(renderLabel),
|
|
227
225
|
renderLabel: renderLabel,
|
|
228
226
|
onChange: handleInputChange,
|
|
229
227
|
onBlur: handleBlur,
|
|
@@ -241,7 +239,7 @@ const DateInput2 = exports.DateInput2 = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
241
239
|
withBorder: false,
|
|
242
240
|
screenReaderLabel: screenReaderLabels.calendarIcon,
|
|
243
241
|
interaction: interaction,
|
|
244
|
-
children: renderCalendarIcon ? (0,
|
|
242
|
+
children: renderCalendarIcon ? (0, _uiReactUtils.callRenderProp)(renderCalendarIcon) : (0, _jsxRuntime.jsx)(_uiIcons.CalendarInstUIIcon, {
|
|
245
243
|
color: "baseColor"
|
|
246
244
|
})
|
|
247
245
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-date-input",
|
|
3
|
-
"version": "11.7.9-snapshot-
|
|
3
|
+
"version": "11.7.9-snapshot-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",
|
|
@@ -15,24 +15,24 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/emotion": "11.7.9-snapshot-
|
|
19
|
-
"@instructure/shared-types": "11.7.9-snapshot-
|
|
20
|
-
"@instructure/ui-buttons": "11.7.9-snapshot-
|
|
21
|
-
"@instructure/ui-
|
|
22
|
-
"@instructure/ui-
|
|
23
|
-
"@instructure/ui-
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-utils": "11.7.9-snapshot-
|
|
18
|
+
"@instructure/emotion": "11.7.9-snapshot-1",
|
|
19
|
+
"@instructure/shared-types": "11.7.9-snapshot-1",
|
|
20
|
+
"@instructure/ui-buttons": "11.7.9-snapshot-1",
|
|
21
|
+
"@instructure/ui-form-field": "11.7.9-snapshot-1",
|
|
22
|
+
"@instructure/ui-calendar": "11.7.9-snapshot-1",
|
|
23
|
+
"@instructure/ui-i18n": "11.7.9-snapshot-1",
|
|
24
|
+
"@instructure/ui-icons": "11.7.9-snapshot-1",
|
|
25
|
+
"@instructure/ui-popover": "11.7.9-snapshot-1",
|
|
26
|
+
"@instructure/ui-position": "11.7.9-snapshot-1",
|
|
27
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-1",
|
|
28
|
+
"@instructure/ui-selectable": "11.7.9-snapshot-1",
|
|
29
|
+
"@instructure/ui-text-input": "11.7.9-snapshot-1",
|
|
30
|
+
"@instructure/ui-utils": "11.7.9-snapshot-1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"vitest": "^5.0.0",
|
|
34
|
-
"@instructure/ui-babel-preset": "11.7.9-snapshot-
|
|
35
|
-
"@instructure/ui-scripts": "11.7.9-snapshot-
|
|
34
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-1",
|
|
35
|
+
"@instructure/ui-scripts": "11.7.9-snapshot-1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=18 <=19"
|