@instructure/ui-date-input 11.7.8 → 11.7.9-pr-snapshot-1792147648392

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.
@@ -1,26 +1,40 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- const allowedProps = ['renderLabel', 'value', 'size', 'placeholder', 'onChange', 'onBlur', 'interaction', 'isRequired', 'isInline', 'assistiveText', 'layout', 'width', 'display', 'inputRef', 'messages', 'placement', 'isShowingCalendar', 'onRequestValidateDate', 'onRequestShowCalendar', 'onRequestHideCalendar', 'onRequestSelectNextDay', 'onRequestSelectPrevDay', 'onRequestRenderNextMonth', 'onRequestRenderPrevMonth', 'renderNavigationLabel', 'renderWeekdayLabels', 'renderNextMonthButton', 'renderPrevMonthButton', 'children', 'disabledDates', 'currentDate', 'disabledDateErrorMessage', 'invalidDateErrorMessage', 'locale', 'timezone', 'withYearPicker', 'selectedLabel'];
26
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'renderLabel',
3
+ 'value',
4
+ 'size',
5
+ 'placeholder',
6
+ 'onChange',
7
+ 'onBlur',
8
+ 'interaction',
9
+ 'isRequired',
10
+ 'isInline',
11
+ 'assistiveText',
12
+ 'layout',
13
+ 'width',
14
+ 'display',
15
+ 'inputRef',
16
+ 'messages',
17
+ 'placement',
18
+ 'isShowingCalendar',
19
+ 'onRequestValidateDate',
20
+ 'onRequestShowCalendar',
21
+ 'onRequestHideCalendar',
22
+ 'onRequestSelectNextDay',
23
+ 'onRequestSelectPrevDay',
24
+ 'onRequestRenderNextMonth',
25
+ 'onRequestRenderPrevMonth',
26
+ 'renderNavigationLabel',
27
+ 'renderWeekdayLabels',
28
+ 'renderNextMonthButton',
29
+ 'renderPrevMonthButton',
30
+ 'children',
31
+ 'disabledDates',
32
+ 'currentDate',
33
+ 'disabledDateErrorMessage',
34
+ 'invalidDateErrorMessage',
35
+ 'locale',
36
+ 'timezone',
37
+ 'withYearPicker',
38
+ 'selectedLabel'
39
+ ];
40
+ export { allowedProps };
@@ -1,46 +1,13 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- /**
26
- * ---
27
- * private: true
28
- * ---
29
- * Generates the style object from the theme and provided additional information
30
- * @param _componentTheme The theme variable object.
31
- * @param props the props of the component, the style is applied to
32
- * @return The final style object, which will be used in the component
33
- */
34
- const generateStyle = (_componentTheme, props) => {
35
- return {
36
- dateInput: {
37
- label: 'dateInput',
38
- display: props.display
39
- },
40
- assistiveText: {
41
- label: 'dateInput__assistiveText',
42
- display: 'none'
43
- }
44
- };
1
+ const generateStyle = (_componentTheme, props)=>{
2
+ return {
3
+ dateInput: {
4
+ label: 'dateInput',
5
+ display: props.display
6
+ },
7
+ assistiveText: {
8
+ label: 'dateInput__assistiveText',
9
+ display: 'none'
10
+ }
11
+ };
45
12
  };
46
- export default generateStyle;
13
+ export default generateStyle;
@@ -1,27 +1,4 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
25
2
  import { useState, useEffect, forwardRef } from 'react';
26
3
  import { Calendar } from '@instructure/ui-calendar/latest';
27
4
  import { IconButton } from '@instructure/ui-buttons/latest';
@@ -30,262 +7,202 @@ import { Popover } from '@instructure/ui-popover/latest';
30
7
  import { TextInput } from '@instructure/ui-text-input/latest';
31
8
  import { callRenderProp, passthroughProps, useDeterministicId } from '@instructure/ui-react-utils';
32
9
  import { getLocale, getTimezone } from '@instructure/ui-i18n';
33
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
34
10
  function parseLocaleDate(dateString = '', locale, timeZone) {
35
- // This function may seem complicated but it basically does one thing:
36
- // Given a dateString, a locale and a timeZone. The dateString is assumed to be formatted according
37
- // to the locale. So if the locale is `en-us` the dateString is expected to be in the format of M/D/YYYY.
38
- // The dateString is also assumed to be in the given timeZone, so "1/1/2020" in "America/Los_Angeles" timezone is
39
- // expected to be "2020-01-01T08:00:00.000Z" in UTC time.
40
- // This function tries to parse the dateString taking these variables into account and return a javascript Date object
41
- // that is adjusted to be in UTC.
42
-
43
- // Split string on '.', whitespace, '/', ',' or '-' using regex: /[.\s/.-]+/.
44
- // The '+' allows splitting on consecutive delimiters.
45
- // `.filter(Boolean)` is needed because some locales have a delimeter at the end (e.g.: hungarian dates are formatted as `2024. 09. 19.`)
46
- const splitDate = dateString.split(/[,.\s/.-]+/).filter(Boolean);
47
-
48
- // create a locale formatted new date to later extract the order and delimeter information
49
- const localeDate = new Intl.DateTimeFormat(locale).formatToParts(new Date());
50
- let index = 0;
51
- let day, month, year;
52
- localeDate.forEach(part => {
53
- if (part.type === 'month') {
54
- month = parseInt(splitDate[index], 10);
55
- index++;
56
- } else if (part.type === 'day') {
57
- day = parseInt(splitDate[index], 10);
58
- index++;
59
- } else if (part.type === 'year') {
60
- year = parseInt(splitDate[index], 10);
61
- index++;
62
- }
63
- });
64
-
65
- // sensible limitations
66
- if (!year || !month || !day || year < 1000 || year > 9999) return null;
67
-
68
- // create utc date from year, month (zero indexed) and day
69
- const date = new Date(Date.UTC(year, month - 1, day));
70
-
71
- // Format date string in the provided timezone. The locale here is irrelevant, we only care about how to time is adjusted for the timezone.
72
- const parts = new Intl.DateTimeFormat('en-US', {
73
- timeZone,
74
- year: 'numeric',
75
- month: '2-digit',
76
- day: '2-digit',
77
- hour: '2-digit',
78
- minute: '2-digit',
79
- second: '2-digit',
80
- hour12: false
81
- }).formatToParts(date);
82
-
83
- // Extract the date and time parts from the formatted string
84
- const dateStringInTimezone = parts.reduce((acc, part) => {
85
- return part.type === 'literal' ? acc : {
86
- ...acc,
87
- [part.type]: part.value
88
- };
89
- }, {});
90
-
91
- // Create a date string in the format 'YYYY-MM-DDTHH:mm:ss'
92
- const dateInTimezone = `${dateStringInTimezone.year}-${dateStringInTimezone.month}-${dateStringInTimezone.day}T${dateStringInTimezone.hour}:${dateStringInTimezone.minute}:${dateStringInTimezone.second}`;
93
-
94
- // Calculate time difference for timezone offset
95
- const timeDiff = new Date(dateInTimezone + 'Z').getTime() - date.getTime();
96
- const utcTime = new Date(date.getTime() - timeDiff);
97
- // Return the UTC Date corresponding to the time in the specified timezone
98
- return utcTime;
99
- }
100
-
101
- /**
102
- ---
103
- category: components
104
- ---
105
- **/
106
- const DateInput = /*#__PURE__*/forwardRef(({
107
- renderLabel,
108
- screenReaderLabels,
109
- isRequired = false,
110
- interaction = 'enabled',
111
- isInline = false,
112
- value,
113
- messages,
114
- width,
115
- onChange,
116
- onBlur,
117
- withYearPicker,
118
- invalidDateErrorMessage,
119
- locale,
120
- timezone,
121
- placeholder,
122
- dateFormat,
123
- onRequestValidateDate,
124
- disabledDates,
125
- renderCalendarIcon,
126
- margin,
127
- inputRef,
128
- ...rest
129
- }, ref) => {
130
- const userLocale = locale || getLocale();
131
- const userTimezone = timezone || getTimezone();
132
- const [inputMessages, setInputMessages] = useState(messages || []);
133
- const [showPopover, setShowPopover] = useState(false);
134
- useEffect(() => {
135
- // don't set input messages if there is an internal error set already
136
- if (inputMessages.find(m => m.text === invalidDateErrorMessage)) return;
137
- setInputMessages(messages || []);
138
- }, [messages]);
139
- useEffect(() => {
140
- const [, utcIsoDate] = parseDate(value);
141
- // clear error messages if date becomes valid
142
- if (utcIsoDate || !value) {
143
- setInputMessages(messages || []);
144
- }
145
- }, [value]);
146
- const parseDate = (dateString = '') => {
147
- let date = null;
148
- if (dateFormat) {
149
- if (typeof dateFormat === 'string') {
150
- // use dateFormat instead of the user locale
151
- date = parseLocaleDate(dateString, dateFormat, userTimezone);
152
- } else if (dateFormat.parser) {
153
- date = dateFormat.parser(dateString);
154
- }
155
- } else {
156
- // no dateFormat prop passed, use locale for formatting
157
- date = parseLocaleDate(dateString, userLocale, userTimezone);
158
- }
159
- return date ? [formatDate(date), date.toISOString()] : ['', ''];
160
- };
161
- const formatDate = (date, timeZone = userTimezone) => {
162
- // use formatter function if provided
163
- if (typeof dateFormat !== 'string' && dateFormat?.formatter) {
164
- return dateFormat.formatter(date);
165
- }
166
- // if dateFormat set to a locale, use that, otherwise default to the user's locale
167
- return date.toLocaleDateString(typeof dateFormat === 'string' ? dateFormat : userLocale, {
168
- timeZone,
169
- calendar: 'gregory',
170
- numberingSystem: 'latn'
11
+ const splitDate = dateString.split(/[,.\s/.-]+/).filter(Boolean);
12
+ const localeDate = new Intl.DateTimeFormat(locale).formatToParts(new Date());
13
+ let index = 0;
14
+ let day, month, year;
15
+ localeDate.forEach((part)=>{
16
+ if (part.type === 'month') {
17
+ month = parseInt(splitDate[index], 10);
18
+ index++;
19
+ } else if (part.type === 'day') {
20
+ day = parseInt(splitDate[index], 10);
21
+ index++;
22
+ } else if (part.type === 'year') {
23
+ year = parseInt(splitDate[index], 10);
24
+ index++;
25
+ }
171
26
  });
172
- };
173
- const getDateFormatHint = () => {
174
- const exampleDate = new Date('2024-09-01');
175
- const formattedDate = formatDate(exampleDate, 'UTC'); // exampleDate is in UTC so format it as such
176
-
177
- // Create a regular expression to find the exact match of the number
178
- const regex = n => {
179
- return new RegExp(`(?<!\\d)0*${n}(?!\\d)`, 'g');
27
+ if (!year || !month || !day || year < 1000 || year > 9999) return null;
28
+ const date = new Date(Date.UTC(year, month - 1, day));
29
+ const parts = new Intl.DateTimeFormat('en-US', {
30
+ timeZone,
31
+ year: 'numeric',
32
+ month: '2-digit',
33
+ day: '2-digit',
34
+ hour: '2-digit',
35
+ minute: '2-digit',
36
+ second: '2-digit',
37
+ hour12: false
38
+ }).formatToParts(date);
39
+ const dateStringInTimezone = parts.reduce((acc, part)=>{
40
+ return part.type === 'literal' ? acc : {
41
+ ...acc,
42
+ [part.type]: part.value
43
+ };
44
+ }, {});
45
+ const dateInTimezone = `${dateStringInTimezone.year}-${dateStringInTimezone.month}-${dateStringInTimezone.day}T${dateStringInTimezone.hour}:${dateStringInTimezone.minute}:${dateStringInTimezone.second}`;
46
+ const timeDiff = new Date(dateInTimezone + 'Z').getTime() - date.getTime();
47
+ const utcTime = new Date(date.getTime() - timeDiff);
48
+ return utcTime;
49
+ }
50
+ const DateInput = /*#__PURE__*/ forwardRef(({ renderLabel, screenReaderLabels, isRequired = false, interaction = 'enabled', isInline = false, value, messages, width, onChange, onBlur, withYearPicker, invalidDateErrorMessage, locale, timezone, placeholder, dateFormat, onRequestValidateDate, disabledDates, renderCalendarIcon, margin, inputRef, ...rest }, ref)=>{
51
+ const userLocale = locale || getLocale();
52
+ const userTimezone = timezone || getTimezone();
53
+ const [inputMessages, setInputMessages] = useState(messages || []);
54
+ const [showPopover, setShowPopover] = useState(false);
55
+ useEffect(()=>{
56
+ if (inputMessages.find((m)=>m.text === invalidDateErrorMessage)) return;
57
+ setInputMessages(messages || []);
58
+ }, [
59
+ messages
60
+ ]);
61
+ useEffect(()=>{
62
+ const [, utcIsoDate] = parseDate(value);
63
+ if (utcIsoDate || !value) {
64
+ setInputMessages(messages || []);
65
+ }
66
+ }, [
67
+ value
68
+ ]);
69
+ const parseDate = (dateString = '')=>{
70
+ let date = null;
71
+ if (dateFormat) {
72
+ if (typeof dateFormat === 'string') {
73
+ date = parseLocaleDate(dateString, dateFormat, userTimezone);
74
+ } else if (dateFormat.parser) {
75
+ date = dateFormat.parser(dateString);
76
+ }
77
+ } else {
78
+ date = parseLocaleDate(dateString, userLocale, userTimezone);
79
+ }
80
+ return date ? [
81
+ formatDate(date),
82
+ date.toISOString()
83
+ ] : [
84
+ '',
85
+ ''
86
+ ];
87
+ };
88
+ const formatDate = (date, timeZone = userTimezone)=>{
89
+ if (typeof dateFormat !== 'string' && dateFormat?.formatter) {
90
+ return dateFormat.formatter(date);
91
+ }
92
+ return date.toLocaleDateString(typeof dateFormat === 'string' ? dateFormat : userLocale, {
93
+ timeZone,
94
+ calendar: 'gregory',
95
+ numberingSystem: 'latn'
96
+ });
180
97
  };
181
-
182
- // Replace the matched number with the same number of dashes
183
- const year = '2024';
184
- const month = '9';
185
- const day = '1';
186
- return formattedDate.replace(regex(year), match => 'Y'.repeat(match.length)).replace(regex(month), match => 'M'.repeat(match.length)).replace(regex(day), match => 'D'.repeat(match.length));
187
- };
188
- const handleInputChange = (e, newValue) => {
189
- const [, utcIsoDate] = parseDate(newValue);
190
- onChange?.(e, newValue, utcIsoDate);
191
- };
192
- const handleDateSelected = (dateString, _momentDate, e) => {
193
- setShowPopover(false);
194
- const newValue = formatDate(new Date(dateString));
195
- onChange?.(e, newValue, dateString);
196
- onRequestValidateDate?.(e, newValue, dateString);
197
- };
198
- const handleBlur = e => {
199
- const [localeDate, utcIsoDate] = parseDate(value);
200
- if (localeDate) {
201
- if (localeDate !== value) {
202
- onChange?.(e, localeDate, utcIsoDate);
203
- }
204
- } else if (value && invalidDateErrorMessage) {
205
- setInputMessages([{
206
- type: 'error',
207
- text: invalidDateErrorMessage
208
- }]);
209
- }
210
- onRequestValidateDate?.(e, value || '', utcIsoDate);
211
- onBlur?.(e, value || '', utcIsoDate);
212
- };
213
- const selectedDate = parseDate(value)[1];
214
- const labelId = useDeterministicId('TextInput-label')();
215
- return _jsx(TextInput, {
216
- ...passthroughProps(rest),
217
- ref: ref,
218
- inputRef: inputRef,
219
- renderLabel: renderLabel,
220
- labelId: labelId,
221
- "aria-labelledby": labelId,
222
- onChange: handleInputChange,
223
- onBlur: handleBlur,
224
- isRequired: isRequired,
225
- value: value,
226
- placeholder: placeholder ?? getDateFormatHint(),
227
- width: width,
228
- display: isInline ? 'inline-block' : 'block',
229
- messages: inputMessages,
230
- interaction: interaction,
231
- margin: margin,
232
- renderAfterInput: _jsx(Popover, {
233
- renderTrigger: _jsx(IconButton, {
234
- size: "condensedMedium",
235
- withBackground: false,
236
- withBorder: false,
237
- screenReaderLabel: screenReaderLabels.calendarIcon,
98
+ const getDateFormatHint = ()=>{
99
+ const exampleDate = new Date('2024-09-01');
100
+ const formattedDate = formatDate(exampleDate, 'UTC');
101
+ const regex = (n)=>{
102
+ return new RegExp(`(?<!\\d)0*${n}(?!\\d)`, 'g');
103
+ };
104
+ const year = '2024';
105
+ const month = '9';
106
+ const day = '1';
107
+ return formattedDate.replace(regex(year), (match)=>'Y'.repeat(match.length)).replace(regex(month), (match)=>'M'.repeat(match.length)).replace(regex(day), (match)=>'D'.repeat(match.length));
108
+ };
109
+ const handleInputChange = (e, newValue)=>{
110
+ const [, utcIsoDate] = parseDate(newValue);
111
+ onChange?.(e, newValue, utcIsoDate);
112
+ };
113
+ const handleDateSelected = (dateString, _momentDate, e)=>{
114
+ setShowPopover(false);
115
+ const newValue = formatDate(new Date(dateString));
116
+ onChange?.(e, newValue, dateString);
117
+ onRequestValidateDate?.(e, newValue, dateString);
118
+ };
119
+ const handleBlur = (e)=>{
120
+ const [localeDate, utcIsoDate] = parseDate(value);
121
+ if (localeDate) {
122
+ if (localeDate !== value) {
123
+ onChange?.(e, localeDate, utcIsoDate);
124
+ }
125
+ } else if (value && invalidDateErrorMessage) {
126
+ setInputMessages([
127
+ {
128
+ type: 'error',
129
+ text: invalidDateErrorMessage
130
+ }
131
+ ]);
132
+ }
133
+ onRequestValidateDate?.(e, value || '', utcIsoDate);
134
+ onBlur?.(e, value || '', utcIsoDate);
135
+ };
136
+ const selectedDate = parseDate(value)[1];
137
+ const labelId = useDeterministicId('TextInput-label')();
138
+ return /*#__PURE__*/ _jsx(TextInput, {
139
+ ...passthroughProps(rest),
140
+ ref: ref,
141
+ inputRef: inputRef,
142
+ renderLabel: renderLabel,
143
+ labelId: labelId,
144
+ "aria-labelledby": labelId,
145
+ onChange: handleInputChange,
146
+ onBlur: handleBlur,
147
+ isRequired: isRequired,
148
+ value: value,
149
+ placeholder: placeholder ?? getDateFormatHint(),
150
+ width: width,
151
+ display: isInline ? 'inline-block' : 'block',
152
+ messages: inputMessages,
238
153
  interaction: interaction,
239
- children: renderCalendarIcon ? callRenderProp(renderCalendarIcon) : _jsx(CalendarInstUIIcon, {
240
- color: "baseColor"
241
- })
242
- }),
243
- isShowingContent: showPopover,
244
- onShowContent: () => setShowPopover(true),
245
- onHideContent: () => setShowPopover(false),
246
- on: "click",
247
- shouldContainFocus: true,
248
- shouldReturnFocus: true,
249
- shouldCloseOnDocumentClick: true,
250
- shouldScrollContent: true,
251
- screenReaderLabel: screenReaderLabels.datePickerDialog,
252
- children: _jsx(Calendar, {
253
- withYearPicker: withYearPicker,
254
- onDateSelected: handleDateSelected,
255
- selectedDate: selectedDate,
256
- selectedLabel: screenReaderLabels.selectedLabel,
257
- disabledDates: disabledDates,
258
- visibleMonth: selectedDate,
259
- locale: userLocale,
260
- timezone: userTimezone,
261
- renderNextMonthButton: ({
262
- targetMonthSrLabel
263
- }) => _jsx(IconButton, {
264
- size: "small",
265
- withBackground: false,
266
- withBorder: false,
267
- renderIcon: _jsx(ChevronRightInstUIIcon, {
268
- color: "baseColor"
269
- }),
270
- screenReaderLabel: `${screenReaderLabels.nextMonthButton}, ${targetMonthSrLabel}`
271
- }),
272
- renderPrevMonthButton: ({
273
- targetMonthSrLabel
274
- }) => _jsx(IconButton, {
275
- size: "small",
276
- withBackground: false,
277
- withBorder: false,
278
- renderIcon: _jsx(ChevronLeftInstUIIcon, {
279
- color: "baseColor"
280
- }),
281
- screenReaderLabel: `${screenReaderLabels.prevMonthButton}, ${targetMonthSrLabel}`
154
+ margin: margin,
155
+ renderAfterInput: /*#__PURE__*/ _jsx(Popover, {
156
+ renderTrigger: /*#__PURE__*/ _jsx(IconButton, {
157
+ size: "condensedMedium",
158
+ withBackground: false,
159
+ withBorder: false,
160
+ screenReaderLabel: screenReaderLabels.calendarIcon,
161
+ interaction: interaction,
162
+ children: renderCalendarIcon ? callRenderProp(renderCalendarIcon) : /*#__PURE__*/ _jsx(CalendarInstUIIcon, {
163
+ color: "baseColor"
164
+ })
165
+ }),
166
+ isShowingContent: showPopover,
167
+ onShowContent: ()=>setShowPopover(true),
168
+ onHideContent: ()=>setShowPopover(false),
169
+ on: "click",
170
+ shouldContainFocus: true,
171
+ shouldReturnFocus: true,
172
+ shouldCloseOnDocumentClick: true,
173
+ shouldScrollContent: true,
174
+ screenReaderLabel: screenReaderLabels.datePickerDialog,
175
+ children: /*#__PURE__*/ _jsx(Calendar, {
176
+ withYearPicker: withYearPicker,
177
+ onDateSelected: handleDateSelected,
178
+ selectedDate: selectedDate,
179
+ selectedLabel: screenReaderLabels.selectedLabel,
180
+ disabledDates: disabledDates,
181
+ visibleMonth: selectedDate,
182
+ locale: userLocale,
183
+ timezone: userTimezone,
184
+ renderNextMonthButton: ({ targetMonthSrLabel })=>/*#__PURE__*/ _jsx(IconButton, {
185
+ size: "small",
186
+ withBackground: false,
187
+ withBorder: false,
188
+ renderIcon: /*#__PURE__*/ _jsx(ChevronRightInstUIIcon, {
189
+ color: "baseColor"
190
+ }),
191
+ screenReaderLabel: `${screenReaderLabels.nextMonthButton}, ${targetMonthSrLabel}`
192
+ }),
193
+ renderPrevMonthButton: ({ targetMonthSrLabel })=>/*#__PURE__*/ _jsx(IconButton, {
194
+ size: "small",
195
+ withBackground: false,
196
+ withBorder: false,
197
+ renderIcon: /*#__PURE__*/ _jsx(ChevronLeftInstUIIcon, {
198
+ color: "baseColor"
199
+ }),
200
+ screenReaderLabel: `${screenReaderLabels.prevMonthButton}, ${targetMonthSrLabel}`
201
+ })
202
+ })
282
203
  })
283
- })
284
- })
285
- });
204
+ });
286
205
  });
287
-
288
- // TODO this is probably needed?
289
206
  DateInput.displayName = 'DateInput';
290
207
  export default DateInput;
291
- export { DateInput };
208
+ export { DateInput };
@@ -1 +1 @@
1
- export {};
1
+ export { };