@react-aria/datepicker 3.0.0-nightly.3168 → 3.0.0-nightly.3180
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/dist/main.js +216 -193
- package/dist/main.js.map +1 -1
- package/dist/module.js +217 -194
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +42 -42
- package/dist/types.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/useDateField.ts +37 -16
- package/src/useDatePicker.ts +5 -2
- package/src/useDatePickerGroup.ts +3 -3
- package/src/useDateRangePicker.ts +10 -12
- package/src/useDateSegment.ts +14 -8
package/dist/module.js
CHANGED
|
@@ -2,9 +2,9 @@ import {createFocusManager as $cIPI0$createFocusManager, getFocusableTreeWalker
|
|
|
2
2
|
import {useId as $cIPI0$useId, useDescription as $cIPI0$useDescription, mergeProps as $cIPI0$mergeProps, isMac as $cIPI0$isMac, scrollIntoView as $cIPI0$scrollIntoView, getScrollParent as $cIPI0$getScrollParent, useEvent as $cIPI0$useEvent, isIOS as $cIPI0$isIOS, useLabels as $cIPI0$useLabels} from "@react-aria/utils";
|
|
3
3
|
import {useField as $cIPI0$useField} from "@react-aria/label";
|
|
4
4
|
import {useMessageFormatter as $cIPI0$useMessageFormatter, useLocale as $cIPI0$useLocale, useDateFormatter as $cIPI0$useDateFormatter, useFilter as $cIPI0$useFilter} from "@react-aria/i18n";
|
|
5
|
-
import {
|
|
5
|
+
import $cIPI0$react, {useMemo as $cIPI0$useMemo, useRef as $cIPI0$useRef, useEffect as $cIPI0$useEffect} from "react";
|
|
6
|
+
import {useFocusWithin as $cIPI0$useFocusWithin, usePress as $cIPI0$usePress} from "@react-aria/interactions";
|
|
6
7
|
import {NumberParser as $cIPI0$NumberParser} from "@internationalized/number";
|
|
7
|
-
import $cIPI0$react, {useRef as $cIPI0$useRef, useMemo as $cIPI0$useMemo, useEffect as $cIPI0$useEffect} from "react";
|
|
8
8
|
import {useSpinButton as $cIPI0$useSpinButton} from "@react-aria/spinbutton";
|
|
9
9
|
import {MessageDictionary as $cIPI0$MessageDictionary} from "@internationalized/message";
|
|
10
10
|
|
|
@@ -194,10 +194,13 @@ $204383cf4f6b0d06$exports = {
|
|
|
194
194
|
|
|
195
195
|
|
|
196
196
|
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
197
200
|
function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref1) {
|
|
198
201
|
// Open the popover on alt + arrow down
|
|
199
202
|
let onKeyDown = (e)=>{
|
|
200
|
-
if (e.altKey && e.key === 'ArrowDown' && 'setOpen' in state) {
|
|
203
|
+
if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {
|
|
201
204
|
e.preventDefault();
|
|
202
205
|
e.stopPropagation();
|
|
203
206
|
state.setOpen(true);
|
|
@@ -247,6 +250,85 @@ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref1) {
|
|
|
247
250
|
|
|
248
251
|
|
|
249
252
|
|
|
253
|
+
const $16f0b7bb276bc17e$export$653eddfc964b0f8a = new WeakMap();
|
|
254
|
+
const $16f0b7bb276bc17e$export$300019f83c56d282 = '__role_' + Date.now();
|
|
255
|
+
const $16f0b7bb276bc17e$export$7b3062cd49e80452 = '__focusManager_' + Date.now();
|
|
256
|
+
function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
257
|
+
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $cIPI0$useField({
|
|
258
|
+
...props,
|
|
259
|
+
labelElementType: 'span'
|
|
260
|
+
});
|
|
261
|
+
let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref);
|
|
262
|
+
let { focusWithinProps: focusWithinProps } = $cIPI0$useFocusWithin({
|
|
263
|
+
onBlurWithin () {
|
|
264
|
+
state.confirmPlaceholder();
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
let descProps = $cIPI0$useDescription(state.formatValue({
|
|
268
|
+
month: 'long'
|
|
269
|
+
}));
|
|
270
|
+
// If within a date picker or date range picker, the date field will have role="presentation" and an aria-describedby
|
|
271
|
+
// will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.
|
|
272
|
+
let describedBy = props[$16f0b7bb276bc17e$export$300019f83c56d282] === 'presentation' ? fieldProps['aria-describedby'] : [
|
|
273
|
+
descProps['aria-describedby'],
|
|
274
|
+
fieldProps['aria-describedby']
|
|
275
|
+
].filter(Boolean).join(' ') || undefined;
|
|
276
|
+
let propsFocusManager = props[$16f0b7bb276bc17e$export$7b3062cd49e80452];
|
|
277
|
+
let focusManager = $cIPI0$useMemo(()=>propsFocusManager || $cIPI0$createFocusManager(ref)
|
|
278
|
+
, [
|
|
279
|
+
propsFocusManager,
|
|
280
|
+
ref
|
|
281
|
+
]);
|
|
282
|
+
// Pass labels and other information to segments.
|
|
283
|
+
$16f0b7bb276bc17e$export$653eddfc964b0f8a.set(state, {
|
|
284
|
+
ariaLabel: props['aria-label'],
|
|
285
|
+
ariaLabelledBy: [
|
|
286
|
+
props['aria-labelledby'],
|
|
287
|
+
labelProps.id
|
|
288
|
+
].filter(Boolean).join(' ') || undefined,
|
|
289
|
+
ariaDescribedBy: describedBy,
|
|
290
|
+
focusManager: focusManager
|
|
291
|
+
});
|
|
292
|
+
let autoFocusRef = $cIPI0$useRef(props.autoFocus);
|
|
293
|
+
// When used within a date picker or date range picker, the field gets role="presentation"
|
|
294
|
+
// rather than role="group". Since the date picker/date range picker already has a role="group"
|
|
295
|
+
// with a label and description, and the segments are already labeled by this as well, this
|
|
296
|
+
// avoids very verbose duplicate announcements.
|
|
297
|
+
let fieldDOMProps;
|
|
298
|
+
if (props[$16f0b7bb276bc17e$export$300019f83c56d282] === 'presentation') fieldDOMProps = {
|
|
299
|
+
role: 'presentation'
|
|
300
|
+
};
|
|
301
|
+
else fieldDOMProps = $cIPI0$mergeProps(fieldProps, {
|
|
302
|
+
role: 'group',
|
|
303
|
+
'aria-disabled': props.isDisabled || undefined,
|
|
304
|
+
'aria-describedby': describedBy
|
|
305
|
+
});
|
|
306
|
+
$cIPI0$useEffect(()=>{
|
|
307
|
+
if (autoFocusRef.current) focusManager.focusFirst();
|
|
308
|
+
autoFocusRef.current = false;
|
|
309
|
+
}, [
|
|
310
|
+
focusManager
|
|
311
|
+
]);
|
|
312
|
+
return {
|
|
313
|
+
labelProps: {
|
|
314
|
+
...labelProps,
|
|
315
|
+
onClick: ()=>{
|
|
316
|
+
focusManager.focusFirst();
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
fieldProps: $cIPI0$mergeProps(fieldDOMProps, groupProps, focusWithinProps),
|
|
320
|
+
descriptionProps: descriptionProps,
|
|
321
|
+
errorMessageProps: errorMessageProps
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function $16f0b7bb276bc17e$export$4c842f6a241dc825(props, state, ref) {
|
|
325
|
+
return $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
250
332
|
function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
251
333
|
let buttonId = $cIPI0$useId();
|
|
252
334
|
let dialogId = $cIPI0$useId();
|
|
@@ -266,7 +348,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
266
348
|
fieldProps['aria-describedby']
|
|
267
349
|
].filter(Boolean).join(' ') || undefined;
|
|
268
350
|
return {
|
|
269
|
-
groupProps: $cIPI0$mergeProps(groupProps, descProps, {
|
|
351
|
+
groupProps: $cIPI0$mergeProps(groupProps, fieldProps, descProps, {
|
|
270
352
|
role: 'group',
|
|
271
353
|
'aria-disabled': props.isDisabled || null,
|
|
272
354
|
'aria-labelledby': labelledBy,
|
|
@@ -281,6 +363,8 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
281
363
|
},
|
|
282
364
|
fieldProps: {
|
|
283
365
|
...fieldProps,
|
|
366
|
+
[$16f0b7bb276bc17e$export$300019f83c56d282]: 'presentation',
|
|
367
|
+
'aria-describedby': ariaDescribedBy,
|
|
284
368
|
value: state.value,
|
|
285
369
|
onChange: state.setValue,
|
|
286
370
|
minValue: props.minValue,
|
|
@@ -319,7 +403,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
319
403
|
maxValue: props.maxValue,
|
|
320
404
|
isDisabled: props.isDisabled,
|
|
321
405
|
isReadOnly: props.isReadOnly,
|
|
322
|
-
|
|
406
|
+
isDateUnavailable: props.isDateUnavailable,
|
|
323
407
|
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue
|
|
324
408
|
}
|
|
325
409
|
};
|
|
@@ -331,190 +415,6 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
331
415
|
|
|
332
416
|
|
|
333
417
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
const $887cac91b7cc8801$export$7b3062cd49e80452 = '__focusManager_' + Date.now();
|
|
340
|
-
function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
341
|
-
var ref1, ref2;
|
|
342
|
-
let formatMessage = $cIPI0$useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($204383cf4f6b0d06$exports)));
|
|
343
|
-
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $cIPI0$useField({
|
|
344
|
-
...props,
|
|
345
|
-
labelElementType: 'span'
|
|
346
|
-
});
|
|
347
|
-
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
348
|
-
let { locale: locale } = $cIPI0$useLocale();
|
|
349
|
-
let description = state.formatValue(locale, {
|
|
350
|
-
month: 'long'
|
|
351
|
-
});
|
|
352
|
-
let descProps = $cIPI0$useDescription(description);
|
|
353
|
-
let startFieldProps = $cIPI0$useLabels({
|
|
354
|
-
'aria-label': formatMessage('startDate'),
|
|
355
|
-
'aria-labelledby': labelledBy
|
|
356
|
-
});
|
|
357
|
-
let endFieldProps = $cIPI0$useLabels({
|
|
358
|
-
'aria-label': formatMessage('endDate'),
|
|
359
|
-
'aria-labelledby': labelledBy
|
|
360
|
-
});
|
|
361
|
-
let buttonId = $cIPI0$useId();
|
|
362
|
-
let dialogId = $cIPI0$useId();
|
|
363
|
-
let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref);
|
|
364
|
-
let { focusWithinProps: focusWithinProps } = $cIPI0$useFocusWithin({
|
|
365
|
-
onBlurWithin () {
|
|
366
|
-
state.confirmPlaceholder();
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
let ariaDescribedBy = [
|
|
370
|
-
descProps['aria-describedby'],
|
|
371
|
-
fieldProps['aria-describedby']
|
|
372
|
-
].filter(Boolean).join(' ') || undefined;
|
|
373
|
-
let focusManager = $cIPI0$useMemo(()=>$cIPI0$createFocusManager(ref)
|
|
374
|
-
, [
|
|
375
|
-
ref
|
|
376
|
-
]);
|
|
377
|
-
let commonFieldProps = {
|
|
378
|
-
[$887cac91b7cc8801$export$7b3062cd49e80452]: focusManager,
|
|
379
|
-
minValue: props.minValue,
|
|
380
|
-
maxValue: props.maxValue,
|
|
381
|
-
placeholderValue: props.placeholderValue,
|
|
382
|
-
hideTimeZone: props.hideTimeZone,
|
|
383
|
-
hourCycle: props.hourCycle,
|
|
384
|
-
granularity: props.granularity,
|
|
385
|
-
isDisabled: props.isDisabled,
|
|
386
|
-
isReadOnly: props.isReadOnly,
|
|
387
|
-
isRequired: props.isRequired,
|
|
388
|
-
validationState: state.validationState
|
|
389
|
-
};
|
|
390
|
-
return {
|
|
391
|
-
groupProps: $cIPI0$mergeProps(groupProps, fieldProps, descProps, focusWithinProps, {
|
|
392
|
-
role: 'group',
|
|
393
|
-
'aria-disabled': props.isDisabled || null,
|
|
394
|
-
'aria-describedby': ariaDescribedBy
|
|
395
|
-
}),
|
|
396
|
-
labelProps: {
|
|
397
|
-
...labelProps,
|
|
398
|
-
onClick: ()=>{
|
|
399
|
-
focusManager.focusFirst();
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
buttonProps: {
|
|
403
|
-
...descProps,
|
|
404
|
-
id: buttonId,
|
|
405
|
-
excludeFromTabOrder: true,
|
|
406
|
-
'aria-haspopup': 'dialog',
|
|
407
|
-
'aria-label': formatMessage('calendar'),
|
|
408
|
-
'aria-labelledby': `${labelledBy} ${buttonId}`,
|
|
409
|
-
'aria-describedby': ariaDescribedBy,
|
|
410
|
-
onPress: ()=>state.setOpen(true)
|
|
411
|
-
},
|
|
412
|
-
dialogProps: {
|
|
413
|
-
id: dialogId,
|
|
414
|
-
'aria-labelledby': `${labelledBy} ${buttonId}`
|
|
415
|
-
},
|
|
416
|
-
startFieldProps: {
|
|
417
|
-
...startFieldProps,
|
|
418
|
-
...commonFieldProps,
|
|
419
|
-
'aria-describedby': fieldProps['aria-describedby'],
|
|
420
|
-
value: (ref1 = state.value) === null || ref1 === void 0 ? void 0 : ref1.start,
|
|
421
|
-
onChange: (start)=>state.setDateTime('start', start)
|
|
422
|
-
,
|
|
423
|
-
autoFocus: props.autoFocus
|
|
424
|
-
},
|
|
425
|
-
endFieldProps: {
|
|
426
|
-
...endFieldProps,
|
|
427
|
-
...commonFieldProps,
|
|
428
|
-
'aria-describedby': fieldProps['aria-describedby'],
|
|
429
|
-
value: (ref2 = state.value) === null || ref2 === void 0 ? void 0 : ref2.end,
|
|
430
|
-
onChange: (end)=>state.setDateTime('end', end)
|
|
431
|
-
},
|
|
432
|
-
descriptionProps: descriptionProps,
|
|
433
|
-
errorMessageProps: errorMessageProps,
|
|
434
|
-
calendarProps: {
|
|
435
|
-
autoFocus: true,
|
|
436
|
-
value: state.dateRange,
|
|
437
|
-
onChange: state.setDateRange,
|
|
438
|
-
minValue: props.minValue,
|
|
439
|
-
maxValue: props.maxValue,
|
|
440
|
-
isDisabled: props.isDisabled,
|
|
441
|
-
isReadOnly: props.isReadOnly,
|
|
442
|
-
isDateDisabled: props.isDateDisabled,
|
|
443
|
-
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
const $16f0b7bb276bc17e$export$653eddfc964b0f8a = new WeakMap();
|
|
456
|
-
function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
457
|
-
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $cIPI0$useField({
|
|
458
|
-
...props,
|
|
459
|
-
labelElementType: 'span'
|
|
460
|
-
});
|
|
461
|
-
let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref);
|
|
462
|
-
let { focusWithinProps: focusWithinProps } = $cIPI0$useFocusWithin({
|
|
463
|
-
onBlurWithin () {
|
|
464
|
-
state.confirmPlaceholder();
|
|
465
|
-
}
|
|
466
|
-
});
|
|
467
|
-
let formatter = $cIPI0$useDateFormatter(state.getFormatOptions({
|
|
468
|
-
month: 'long'
|
|
469
|
-
}));
|
|
470
|
-
let descProps = $cIPI0$useDescription(state.value ? formatter.format(state.dateValue) : null);
|
|
471
|
-
let segmentLabelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
472
|
-
let describedBy = [
|
|
473
|
-
descProps['aria-describedby'],
|
|
474
|
-
fieldProps['aria-describedby']
|
|
475
|
-
].filter(Boolean).join(' ') || undefined;
|
|
476
|
-
let propsFocusManager = props[$887cac91b7cc8801$export$7b3062cd49e80452];
|
|
477
|
-
let focusManager = $cIPI0$useMemo(()=>propsFocusManager || $cIPI0$createFocusManager(ref)
|
|
478
|
-
, [
|
|
479
|
-
propsFocusManager,
|
|
480
|
-
ref
|
|
481
|
-
]);
|
|
482
|
-
$16f0b7bb276bc17e$export$653eddfc964b0f8a.set(state, {
|
|
483
|
-
ariaLabelledBy: segmentLabelledBy,
|
|
484
|
-
ariaDescribedBy: describedBy,
|
|
485
|
-
focusManager: focusManager
|
|
486
|
-
});
|
|
487
|
-
let autoFocusRef = $cIPI0$useRef(props.autoFocus);
|
|
488
|
-
$cIPI0$useEffect(()=>{
|
|
489
|
-
if (autoFocusRef.current) focusManager.focusFirst();
|
|
490
|
-
autoFocusRef.current = false;
|
|
491
|
-
}, [
|
|
492
|
-
focusManager
|
|
493
|
-
]);
|
|
494
|
-
return {
|
|
495
|
-
labelProps: {
|
|
496
|
-
...labelProps,
|
|
497
|
-
onClick: ()=>{
|
|
498
|
-
focusManager.focusFirst();
|
|
499
|
-
}
|
|
500
|
-
},
|
|
501
|
-
fieldProps: $cIPI0$mergeProps(fieldProps, descProps, groupProps, focusWithinProps, {
|
|
502
|
-
role: 'group',
|
|
503
|
-
'aria-disabled': props.isDisabled || undefined,
|
|
504
|
-
'aria-describedby': describedBy
|
|
505
|
-
}),
|
|
506
|
-
descriptionProps: descriptionProps,
|
|
507
|
-
errorMessageProps: errorMessageProps
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
function $16f0b7bb276bc17e$export$4c842f6a241dc825(props, state, ref) {
|
|
511
|
-
return $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref);
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
418
|
var $3aeceb3a64eb8358$exports = {};
|
|
519
419
|
|
|
520
420
|
$parcel$export($3aeceb3a64eb8358$exports, "useDisplayNames", () => $3aeceb3a64eb8358$export$d42c60378c8168f8);
|
|
@@ -556,7 +456,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
556
456
|
let enteredKeys = $cIPI0$useRef('');
|
|
557
457
|
let { locale: locale , direction: direction } = $cIPI0$useLocale();
|
|
558
458
|
let displayNames = $3aeceb3a64eb8358$export$d42c60378c8168f8();
|
|
559
|
-
let { ariaLabelledBy: ariaLabelledBy , ariaDescribedBy: ariaDescribedBy , focusManager: focusManager } = $16f0b7bb276bc17e$export$653eddfc964b0f8a.get(state);
|
|
459
|
+
let { ariaLabel: ariaLabel , ariaLabelledBy: ariaLabelledBy , ariaDescribedBy: ariaDescribedBy , focusManager: focusManager } = $16f0b7bb276bc17e$export$653eddfc964b0f8a.get(state);
|
|
560
460
|
let textValue = segment.text;
|
|
561
461
|
let options = $cIPI0$useMemo(()=>state.dateFormatter.resolvedOptions()
|
|
562
462
|
, [
|
|
@@ -574,7 +474,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
574
474
|
if (segment.type === 'month') {
|
|
575
475
|
let monthTextValue = monthDateFormatter.format(state.dateValue);
|
|
576
476
|
textValue = monthTextValue !== textValue ? `${textValue} – ${monthTextValue}` : monthTextValue;
|
|
577
|
-
} else if (segment.type === 'hour'
|
|
477
|
+
} else if (segment.type === 'hour') textValue = hourDateFormatter.format(state.dateValue);
|
|
578
478
|
let { spinButtonProps: spinButtonProps } = $cIPI0$useSpinButton({
|
|
579
479
|
value: segment.value,
|
|
580
480
|
textValue: textValue,
|
|
@@ -818,6 +718,13 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
818
718
|
if (segment !== firstSegment && state.validationState !== 'invalid') ariaDescribedBy = undefined;
|
|
819
719
|
let id = $cIPI0$useId();
|
|
820
720
|
let isEditable = !state.isDisabled && !state.isReadOnly && segment.isEditable;
|
|
721
|
+
// Prepend the label passed from the field to each segment name.
|
|
722
|
+
// This is needed because VoiceOver on iOS does not announce groups.
|
|
723
|
+
let name = segment.type === 'literal' ? '' : displayNames.of(segment.type);
|
|
724
|
+
let labelProps = $cIPI0$useLabels({
|
|
725
|
+
'aria-label': (ariaLabel ? ariaLabel + ' ' : '') + name,
|
|
726
|
+
'aria-labelledby': ariaLabelledBy
|
|
727
|
+
});
|
|
821
728
|
// Literal segments should not be visible to screen readers. We don't really need any of the above,
|
|
822
729
|
// but the rules of hooks mean hooks cannot be conditional so we have to put this condition here.
|
|
823
730
|
if (segment.type === 'literal') return {
|
|
@@ -826,12 +733,10 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
826
733
|
}
|
|
827
734
|
};
|
|
828
735
|
return {
|
|
829
|
-
segmentProps: $cIPI0$mergeProps(spinButtonProps, pressProps, {
|
|
736
|
+
segmentProps: $cIPI0$mergeProps(spinButtonProps, pressProps, labelProps, {
|
|
830
737
|
id: id,
|
|
831
738
|
...touchPropOverrides,
|
|
832
739
|
'aria-invalid': state.validationState === 'invalid' ? 'true' : undefined,
|
|
833
|
-
'aria-label': displayNames.of(segment.type),
|
|
834
|
-
'aria-labelledby': `${ariaLabelledBy} ${id}`,
|
|
835
740
|
'aria-describedby': ariaDescribedBy,
|
|
836
741
|
'aria-placeholder': segment.isPlaceholder ? segment.text : undefined,
|
|
837
742
|
'aria-readonly': state.isReadOnly || !segment.isEditable ? 'true' : undefined,
|
|
@@ -859,5 +764,123 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
859
764
|
|
|
860
765
|
|
|
861
766
|
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
773
|
+
var ref1, ref2;
|
|
774
|
+
let formatMessage = $cIPI0$useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($204383cf4f6b0d06$exports)));
|
|
775
|
+
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $cIPI0$useField({
|
|
776
|
+
...props,
|
|
777
|
+
labelElementType: 'span'
|
|
778
|
+
});
|
|
779
|
+
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
780
|
+
let { locale: locale } = $cIPI0$useLocale();
|
|
781
|
+
let description = state.formatValue(locale, {
|
|
782
|
+
month: 'long'
|
|
783
|
+
});
|
|
784
|
+
let descProps = $cIPI0$useDescription(description);
|
|
785
|
+
let startFieldProps = {
|
|
786
|
+
'aria-label': formatMessage('startDate'),
|
|
787
|
+
'aria-labelledby': labelledBy
|
|
788
|
+
};
|
|
789
|
+
let endFieldProps = {
|
|
790
|
+
'aria-label': formatMessage('endDate'),
|
|
791
|
+
'aria-labelledby': labelledBy
|
|
792
|
+
};
|
|
793
|
+
let buttonId = $cIPI0$useId();
|
|
794
|
+
let dialogId = $cIPI0$useId();
|
|
795
|
+
let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref);
|
|
796
|
+
let { focusWithinProps: focusWithinProps } = $cIPI0$useFocusWithin({
|
|
797
|
+
onBlurWithin () {
|
|
798
|
+
state.confirmPlaceholder();
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
let ariaDescribedBy = [
|
|
802
|
+
descProps['aria-describedby'],
|
|
803
|
+
fieldProps['aria-describedby']
|
|
804
|
+
].filter(Boolean).join(' ') || undefined;
|
|
805
|
+
let focusManager = $cIPI0$useMemo(()=>$cIPI0$createFocusManager(ref)
|
|
806
|
+
, [
|
|
807
|
+
ref
|
|
808
|
+
]);
|
|
809
|
+
let commonFieldProps = {
|
|
810
|
+
[$16f0b7bb276bc17e$export$7b3062cd49e80452]: focusManager,
|
|
811
|
+
[$16f0b7bb276bc17e$export$300019f83c56d282]: 'presentation',
|
|
812
|
+
'aria-describedby': ariaDescribedBy,
|
|
813
|
+
minValue: props.minValue,
|
|
814
|
+
maxValue: props.maxValue,
|
|
815
|
+
placeholderValue: props.placeholderValue,
|
|
816
|
+
hideTimeZone: props.hideTimeZone,
|
|
817
|
+
hourCycle: props.hourCycle,
|
|
818
|
+
granularity: props.granularity,
|
|
819
|
+
isDisabled: props.isDisabled,
|
|
820
|
+
isReadOnly: props.isReadOnly,
|
|
821
|
+
isRequired: props.isRequired,
|
|
822
|
+
validationState: state.validationState
|
|
823
|
+
};
|
|
824
|
+
return {
|
|
825
|
+
groupProps: $cIPI0$mergeProps(groupProps, fieldProps, descProps, focusWithinProps, {
|
|
826
|
+
role: 'group',
|
|
827
|
+
'aria-disabled': props.isDisabled || null,
|
|
828
|
+
'aria-describedby': ariaDescribedBy
|
|
829
|
+
}),
|
|
830
|
+
labelProps: {
|
|
831
|
+
...labelProps,
|
|
832
|
+
onClick: ()=>{
|
|
833
|
+
focusManager.focusFirst();
|
|
834
|
+
}
|
|
835
|
+
},
|
|
836
|
+
buttonProps: {
|
|
837
|
+
...descProps,
|
|
838
|
+
id: buttonId,
|
|
839
|
+
excludeFromTabOrder: true,
|
|
840
|
+
'aria-haspopup': 'dialog',
|
|
841
|
+
'aria-label': formatMessage('calendar'),
|
|
842
|
+
'aria-labelledby': `${labelledBy} ${buttonId}`,
|
|
843
|
+
'aria-describedby': ariaDescribedBy,
|
|
844
|
+
onPress: ()=>state.setOpen(true)
|
|
845
|
+
},
|
|
846
|
+
dialogProps: {
|
|
847
|
+
id: dialogId,
|
|
848
|
+
'aria-labelledby': `${labelledBy} ${buttonId}`
|
|
849
|
+
},
|
|
850
|
+
startFieldProps: {
|
|
851
|
+
...startFieldProps,
|
|
852
|
+
...commonFieldProps,
|
|
853
|
+
value: (ref1 = state.value) === null || ref1 === void 0 ? void 0 : ref1.start,
|
|
854
|
+
onChange: (start)=>state.setDateTime('start', start)
|
|
855
|
+
,
|
|
856
|
+
autoFocus: props.autoFocus
|
|
857
|
+
},
|
|
858
|
+
endFieldProps: {
|
|
859
|
+
...endFieldProps,
|
|
860
|
+
...commonFieldProps,
|
|
861
|
+
value: (ref2 = state.value) === null || ref2 === void 0 ? void 0 : ref2.end,
|
|
862
|
+
onChange: (end)=>state.setDateTime('end', end)
|
|
863
|
+
},
|
|
864
|
+
descriptionProps: descriptionProps,
|
|
865
|
+
errorMessageProps: errorMessageProps,
|
|
866
|
+
calendarProps: {
|
|
867
|
+
autoFocus: true,
|
|
868
|
+
value: state.dateRange,
|
|
869
|
+
onChange: state.setDateRange,
|
|
870
|
+
minValue: props.minValue,
|
|
871
|
+
maxValue: props.maxValue,
|
|
872
|
+
isDisabled: props.isDisabled,
|
|
873
|
+
isReadOnly: props.isReadOnly,
|
|
874
|
+
isDateUnavailable: props.isDateUnavailable,
|
|
875
|
+
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
876
|
+
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
862
885
|
export {$6057a3d2a53a12fd$export$42df105a73306d51 as useDatePicker, $32489daedd52963e$export$1315d136e6f7581 as useDateSegment, $16f0b7bb276bc17e$export$5591b0b878c1a989 as useDateField, $16f0b7bb276bc17e$export$4c842f6a241dc825 as useTimeField, $887cac91b7cc8801$export$12fd5f0e9f4bb192 as useDateRangePicker, $3aeceb3a64eb8358$export$d42c60378c8168f8 as useDisplayNames};
|
|
863
886
|
//# sourceMappingURL=module.js.map
|