@react-aria/datepicker 3.0.0-nightly.3175 → 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 +215 -193
- package/dist/main.js.map +1 -1
- package/dist/module.js +216 -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 +4 -1
- package/src/useDatePickerGroup.ts +3 -3
- package/src/useDateRangePicker.ts +8 -11
- package/src/useDateSegment.ts +14 -8
package/dist/main.js
CHANGED
|
@@ -2,9 +2,9 @@ var $IwcIq$reactariafocus = require("@react-aria/focus");
|
|
|
2
2
|
var $IwcIq$reactariautils = require("@react-aria/utils");
|
|
3
3
|
var $IwcIq$reactarialabel = require("@react-aria/label");
|
|
4
4
|
var $IwcIq$reactariai18n = require("@react-aria/i18n");
|
|
5
|
+
var $IwcIq$react = require("react");
|
|
5
6
|
var $IwcIq$reactariainteractions = require("@react-aria/interactions");
|
|
6
7
|
var $IwcIq$internationalizednumber = require("@internationalized/number");
|
|
7
|
-
var $IwcIq$react = require("react");
|
|
8
8
|
var $IwcIq$reactariaspinbutton = require("@react-aria/spinbutton");
|
|
9
9
|
var $IwcIq$internationalizedmessage = require("@internationalized/message");
|
|
10
10
|
|
|
@@ -216,10 +216,13 @@ $c7d0e80b992ca68a$exports = {
|
|
|
216
216
|
|
|
217
217
|
|
|
218
218
|
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
219
222
|
function $715562ad3b4cced4$export$4a931266a3838b86(state, ref1) {
|
|
220
223
|
// Open the popover on alt + arrow down
|
|
221
224
|
let onKeyDown = (e)=>{
|
|
222
|
-
if (e.altKey && e.key === 'ArrowDown' && 'setOpen' in state) {
|
|
225
|
+
if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {
|
|
223
226
|
e.preventDefault();
|
|
224
227
|
e.stopPropagation();
|
|
225
228
|
state.setOpen(true);
|
|
@@ -269,6 +272,85 @@ function $715562ad3b4cced4$export$4a931266a3838b86(state, ref1) {
|
|
|
269
272
|
|
|
270
273
|
|
|
271
274
|
|
|
275
|
+
const $4acc2f407c169e55$export$653eddfc964b0f8a = new WeakMap();
|
|
276
|
+
const $4acc2f407c169e55$export$300019f83c56d282 = '__role_' + Date.now();
|
|
277
|
+
const $4acc2f407c169e55$export$7b3062cd49e80452 = '__focusManager_' + Date.now();
|
|
278
|
+
function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
279
|
+
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $IwcIq$reactarialabel.useField({
|
|
280
|
+
...props,
|
|
281
|
+
labelElementType: 'span'
|
|
282
|
+
});
|
|
283
|
+
let groupProps = $715562ad3b4cced4$export$4a931266a3838b86(state, ref);
|
|
284
|
+
let { focusWithinProps: focusWithinProps } = $IwcIq$reactariainteractions.useFocusWithin({
|
|
285
|
+
onBlurWithin () {
|
|
286
|
+
state.confirmPlaceholder();
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
let descProps = $IwcIq$reactariautils.useDescription(state.formatValue({
|
|
290
|
+
month: 'long'
|
|
291
|
+
}));
|
|
292
|
+
// If within a date picker or date range picker, the date field will have role="presentation" and an aria-describedby
|
|
293
|
+
// will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.
|
|
294
|
+
let describedBy = props[$4acc2f407c169e55$export$300019f83c56d282] === 'presentation' ? fieldProps['aria-describedby'] : [
|
|
295
|
+
descProps['aria-describedby'],
|
|
296
|
+
fieldProps['aria-describedby']
|
|
297
|
+
].filter(Boolean).join(' ') || undefined;
|
|
298
|
+
let propsFocusManager = props[$4acc2f407c169e55$export$7b3062cd49e80452];
|
|
299
|
+
let focusManager = $IwcIq$react.useMemo(()=>propsFocusManager || $IwcIq$reactariafocus.createFocusManager(ref)
|
|
300
|
+
, [
|
|
301
|
+
propsFocusManager,
|
|
302
|
+
ref
|
|
303
|
+
]);
|
|
304
|
+
// Pass labels and other information to segments.
|
|
305
|
+
$4acc2f407c169e55$export$653eddfc964b0f8a.set(state, {
|
|
306
|
+
ariaLabel: props['aria-label'],
|
|
307
|
+
ariaLabelledBy: [
|
|
308
|
+
props['aria-labelledby'],
|
|
309
|
+
labelProps.id
|
|
310
|
+
].filter(Boolean).join(' ') || undefined,
|
|
311
|
+
ariaDescribedBy: describedBy,
|
|
312
|
+
focusManager: focusManager
|
|
313
|
+
});
|
|
314
|
+
let autoFocusRef = $IwcIq$react.useRef(props.autoFocus);
|
|
315
|
+
// When used within a date picker or date range picker, the field gets role="presentation"
|
|
316
|
+
// rather than role="group". Since the date picker/date range picker already has a role="group"
|
|
317
|
+
// with a label and description, and the segments are already labeled by this as well, this
|
|
318
|
+
// avoids very verbose duplicate announcements.
|
|
319
|
+
let fieldDOMProps;
|
|
320
|
+
if (props[$4acc2f407c169e55$export$300019f83c56d282] === 'presentation') fieldDOMProps = {
|
|
321
|
+
role: 'presentation'
|
|
322
|
+
};
|
|
323
|
+
else fieldDOMProps = $IwcIq$reactariautils.mergeProps(fieldProps, {
|
|
324
|
+
role: 'group',
|
|
325
|
+
'aria-disabled': props.isDisabled || undefined,
|
|
326
|
+
'aria-describedby': describedBy
|
|
327
|
+
});
|
|
328
|
+
$IwcIq$react.useEffect(()=>{
|
|
329
|
+
if (autoFocusRef.current) focusManager.focusFirst();
|
|
330
|
+
autoFocusRef.current = false;
|
|
331
|
+
}, [
|
|
332
|
+
focusManager
|
|
333
|
+
]);
|
|
334
|
+
return {
|
|
335
|
+
labelProps: {
|
|
336
|
+
...labelProps,
|
|
337
|
+
onClick: ()=>{
|
|
338
|
+
focusManager.focusFirst();
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
fieldProps: $IwcIq$reactariautils.mergeProps(fieldDOMProps, groupProps, focusWithinProps),
|
|
342
|
+
descriptionProps: descriptionProps,
|
|
343
|
+
errorMessageProps: errorMessageProps
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function $4acc2f407c169e55$export$4c842f6a241dc825(props, state, ref) {
|
|
347
|
+
return $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
272
354
|
function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
273
355
|
let buttonId = $IwcIq$reactariautils.useId();
|
|
274
356
|
let dialogId = $IwcIq$reactariautils.useId();
|
|
@@ -288,7 +370,7 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
288
370
|
fieldProps['aria-describedby']
|
|
289
371
|
].filter(Boolean).join(' ') || undefined;
|
|
290
372
|
return {
|
|
291
|
-
groupProps: $IwcIq$reactariautils.mergeProps(groupProps, descProps, {
|
|
373
|
+
groupProps: $IwcIq$reactariautils.mergeProps(groupProps, fieldProps, descProps, {
|
|
292
374
|
role: 'group',
|
|
293
375
|
'aria-disabled': props.isDisabled || null,
|
|
294
376
|
'aria-labelledby': labelledBy,
|
|
@@ -303,6 +385,8 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
303
385
|
},
|
|
304
386
|
fieldProps: {
|
|
305
387
|
...fieldProps,
|
|
388
|
+
[$4acc2f407c169e55$export$300019f83c56d282]: 'presentation',
|
|
389
|
+
'aria-describedby': ariaDescribedBy,
|
|
306
390
|
value: state.value,
|
|
307
391
|
onChange: state.setValue,
|
|
308
392
|
minValue: props.minValue,
|
|
@@ -353,191 +437,6 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
353
437
|
|
|
354
438
|
|
|
355
439
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
const $20f695b1b69e6b9e$export$7b3062cd49e80452 = '__focusManager_' + Date.now();
|
|
362
|
-
function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
363
|
-
var ref1, ref2;
|
|
364
|
-
let formatMessage = $IwcIq$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($c7d0e80b992ca68a$exports)));
|
|
365
|
-
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $IwcIq$reactarialabel.useField({
|
|
366
|
-
...props,
|
|
367
|
-
labelElementType: 'span'
|
|
368
|
-
});
|
|
369
|
-
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
370
|
-
let { locale: locale } = $IwcIq$reactariai18n.useLocale();
|
|
371
|
-
let description = state.formatValue(locale, {
|
|
372
|
-
month: 'long'
|
|
373
|
-
});
|
|
374
|
-
let descProps = $IwcIq$reactariautils.useDescription(description);
|
|
375
|
-
let startFieldProps = $IwcIq$reactariautils.useLabels({
|
|
376
|
-
'aria-label': formatMessage('startDate'),
|
|
377
|
-
'aria-labelledby': labelledBy
|
|
378
|
-
});
|
|
379
|
-
let endFieldProps = $IwcIq$reactariautils.useLabels({
|
|
380
|
-
'aria-label': formatMessage('endDate'),
|
|
381
|
-
'aria-labelledby': labelledBy
|
|
382
|
-
});
|
|
383
|
-
let buttonId = $IwcIq$reactariautils.useId();
|
|
384
|
-
let dialogId = $IwcIq$reactariautils.useId();
|
|
385
|
-
let groupProps = $715562ad3b4cced4$export$4a931266a3838b86(state, ref);
|
|
386
|
-
let { focusWithinProps: focusWithinProps } = $IwcIq$reactariainteractions.useFocusWithin({
|
|
387
|
-
onBlurWithin () {
|
|
388
|
-
state.confirmPlaceholder();
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
let ariaDescribedBy = [
|
|
392
|
-
descProps['aria-describedby'],
|
|
393
|
-
fieldProps['aria-describedby']
|
|
394
|
-
].filter(Boolean).join(' ') || undefined;
|
|
395
|
-
let focusManager = $IwcIq$react.useMemo(()=>$IwcIq$reactariafocus.createFocusManager(ref)
|
|
396
|
-
, [
|
|
397
|
-
ref
|
|
398
|
-
]);
|
|
399
|
-
let commonFieldProps = {
|
|
400
|
-
[$20f695b1b69e6b9e$export$7b3062cd49e80452]: focusManager,
|
|
401
|
-
minValue: props.minValue,
|
|
402
|
-
maxValue: props.maxValue,
|
|
403
|
-
placeholderValue: props.placeholderValue,
|
|
404
|
-
hideTimeZone: props.hideTimeZone,
|
|
405
|
-
hourCycle: props.hourCycle,
|
|
406
|
-
granularity: props.granularity,
|
|
407
|
-
isDisabled: props.isDisabled,
|
|
408
|
-
isReadOnly: props.isReadOnly,
|
|
409
|
-
isRequired: props.isRequired,
|
|
410
|
-
validationState: state.validationState
|
|
411
|
-
};
|
|
412
|
-
return {
|
|
413
|
-
groupProps: $IwcIq$reactariautils.mergeProps(groupProps, fieldProps, descProps, focusWithinProps, {
|
|
414
|
-
role: 'group',
|
|
415
|
-
'aria-disabled': props.isDisabled || null,
|
|
416
|
-
'aria-describedby': ariaDescribedBy
|
|
417
|
-
}),
|
|
418
|
-
labelProps: {
|
|
419
|
-
...labelProps,
|
|
420
|
-
onClick: ()=>{
|
|
421
|
-
focusManager.focusFirst();
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
buttonProps: {
|
|
425
|
-
...descProps,
|
|
426
|
-
id: buttonId,
|
|
427
|
-
excludeFromTabOrder: true,
|
|
428
|
-
'aria-haspopup': 'dialog',
|
|
429
|
-
'aria-label': formatMessage('calendar'),
|
|
430
|
-
'aria-labelledby': `${labelledBy} ${buttonId}`,
|
|
431
|
-
'aria-describedby': ariaDescribedBy,
|
|
432
|
-
onPress: ()=>state.setOpen(true)
|
|
433
|
-
},
|
|
434
|
-
dialogProps: {
|
|
435
|
-
id: dialogId,
|
|
436
|
-
'aria-labelledby': `${labelledBy} ${buttonId}`
|
|
437
|
-
},
|
|
438
|
-
startFieldProps: {
|
|
439
|
-
...startFieldProps,
|
|
440
|
-
...commonFieldProps,
|
|
441
|
-
'aria-describedby': fieldProps['aria-describedby'],
|
|
442
|
-
value: (ref1 = state.value) === null || ref1 === void 0 ? void 0 : ref1.start,
|
|
443
|
-
onChange: (start)=>state.setDateTime('start', start)
|
|
444
|
-
,
|
|
445
|
-
autoFocus: props.autoFocus
|
|
446
|
-
},
|
|
447
|
-
endFieldProps: {
|
|
448
|
-
...endFieldProps,
|
|
449
|
-
...commonFieldProps,
|
|
450
|
-
'aria-describedby': fieldProps['aria-describedby'],
|
|
451
|
-
value: (ref2 = state.value) === null || ref2 === void 0 ? void 0 : ref2.end,
|
|
452
|
-
onChange: (end)=>state.setDateTime('end', end)
|
|
453
|
-
},
|
|
454
|
-
descriptionProps: descriptionProps,
|
|
455
|
-
errorMessageProps: errorMessageProps,
|
|
456
|
-
calendarProps: {
|
|
457
|
-
autoFocus: true,
|
|
458
|
-
value: state.dateRange,
|
|
459
|
-
onChange: state.setDateRange,
|
|
460
|
-
minValue: props.minValue,
|
|
461
|
-
maxValue: props.maxValue,
|
|
462
|
-
isDisabled: props.isDisabled,
|
|
463
|
-
isReadOnly: props.isReadOnly,
|
|
464
|
-
isDateUnavailable: props.isDateUnavailable,
|
|
465
|
-
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
466
|
-
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
const $4acc2f407c169e55$export$653eddfc964b0f8a = new WeakMap();
|
|
479
|
-
function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
480
|
-
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $IwcIq$reactarialabel.useField({
|
|
481
|
-
...props,
|
|
482
|
-
labelElementType: 'span'
|
|
483
|
-
});
|
|
484
|
-
let groupProps = $715562ad3b4cced4$export$4a931266a3838b86(state, ref);
|
|
485
|
-
let { focusWithinProps: focusWithinProps } = $IwcIq$reactariainteractions.useFocusWithin({
|
|
486
|
-
onBlurWithin () {
|
|
487
|
-
state.confirmPlaceholder();
|
|
488
|
-
}
|
|
489
|
-
});
|
|
490
|
-
let formatter = $IwcIq$reactariai18n.useDateFormatter(state.getFormatOptions({
|
|
491
|
-
month: 'long'
|
|
492
|
-
}));
|
|
493
|
-
let descProps = $IwcIq$reactariautils.useDescription(state.value ? formatter.format(state.dateValue) : null);
|
|
494
|
-
let segmentLabelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
495
|
-
let describedBy = [
|
|
496
|
-
descProps['aria-describedby'],
|
|
497
|
-
fieldProps['aria-describedby']
|
|
498
|
-
].filter(Boolean).join(' ') || undefined;
|
|
499
|
-
let propsFocusManager = props[$20f695b1b69e6b9e$export$7b3062cd49e80452];
|
|
500
|
-
let focusManager = $IwcIq$react.useMemo(()=>propsFocusManager || $IwcIq$reactariafocus.createFocusManager(ref)
|
|
501
|
-
, [
|
|
502
|
-
propsFocusManager,
|
|
503
|
-
ref
|
|
504
|
-
]);
|
|
505
|
-
$4acc2f407c169e55$export$653eddfc964b0f8a.set(state, {
|
|
506
|
-
ariaLabelledBy: segmentLabelledBy,
|
|
507
|
-
ariaDescribedBy: describedBy,
|
|
508
|
-
focusManager: focusManager
|
|
509
|
-
});
|
|
510
|
-
let autoFocusRef = $IwcIq$react.useRef(props.autoFocus);
|
|
511
|
-
$IwcIq$react.useEffect(()=>{
|
|
512
|
-
if (autoFocusRef.current) focusManager.focusFirst();
|
|
513
|
-
autoFocusRef.current = false;
|
|
514
|
-
}, [
|
|
515
|
-
focusManager
|
|
516
|
-
]);
|
|
517
|
-
return {
|
|
518
|
-
labelProps: {
|
|
519
|
-
...labelProps,
|
|
520
|
-
onClick: ()=>{
|
|
521
|
-
focusManager.focusFirst();
|
|
522
|
-
}
|
|
523
|
-
},
|
|
524
|
-
fieldProps: $IwcIq$reactariautils.mergeProps(fieldProps, descProps, groupProps, focusWithinProps, {
|
|
525
|
-
role: 'group',
|
|
526
|
-
'aria-disabled': props.isDisabled || undefined,
|
|
527
|
-
'aria-describedby': describedBy
|
|
528
|
-
}),
|
|
529
|
-
descriptionProps: descriptionProps,
|
|
530
|
-
errorMessageProps: errorMessageProps
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
function $4acc2f407c169e55$export$4c842f6a241dc825(props, state, ref) {
|
|
534
|
-
return $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
440
|
var $934ac650a0aceb4b$exports = {};
|
|
542
441
|
|
|
543
442
|
$parcel$export($934ac650a0aceb4b$exports, "useDisplayNames", () => $934ac650a0aceb4b$export$d42c60378c8168f8);
|
|
@@ -579,7 +478,7 @@ function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
|
579
478
|
let enteredKeys = $IwcIq$react.useRef('');
|
|
580
479
|
let { locale: locale , direction: direction } = $IwcIq$reactariai18n.useLocale();
|
|
581
480
|
let displayNames = $934ac650a0aceb4b$export$d42c60378c8168f8();
|
|
582
|
-
let { ariaLabelledBy: ariaLabelledBy , ariaDescribedBy: ariaDescribedBy , focusManager: focusManager } = $4acc2f407c169e55$export$653eddfc964b0f8a.get(state);
|
|
481
|
+
let { ariaLabel: ariaLabel , ariaLabelledBy: ariaLabelledBy , ariaDescribedBy: ariaDescribedBy , focusManager: focusManager } = $4acc2f407c169e55$export$653eddfc964b0f8a.get(state);
|
|
583
482
|
let textValue = segment.text;
|
|
584
483
|
let options = $IwcIq$react.useMemo(()=>state.dateFormatter.resolvedOptions()
|
|
585
484
|
, [
|
|
@@ -597,7 +496,7 @@ function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
|
597
496
|
if (segment.type === 'month') {
|
|
598
497
|
let monthTextValue = monthDateFormatter.format(state.dateValue);
|
|
599
498
|
textValue = monthTextValue !== textValue ? `${textValue} – ${monthTextValue}` : monthTextValue;
|
|
600
|
-
} else if (segment.type === 'hour'
|
|
499
|
+
} else if (segment.type === 'hour') textValue = hourDateFormatter.format(state.dateValue);
|
|
601
500
|
let { spinButtonProps: spinButtonProps } = $IwcIq$reactariaspinbutton.useSpinButton({
|
|
602
501
|
value: segment.value,
|
|
603
502
|
textValue: textValue,
|
|
@@ -841,6 +740,13 @@ function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
|
841
740
|
if (segment !== firstSegment && state.validationState !== 'invalid') ariaDescribedBy = undefined;
|
|
842
741
|
let id = $IwcIq$reactariautils.useId();
|
|
843
742
|
let isEditable = !state.isDisabled && !state.isReadOnly && segment.isEditable;
|
|
743
|
+
// Prepend the label passed from the field to each segment name.
|
|
744
|
+
// This is needed because VoiceOver on iOS does not announce groups.
|
|
745
|
+
let name = segment.type === 'literal' ? '' : displayNames.of(segment.type);
|
|
746
|
+
let labelProps = $IwcIq$reactariautils.useLabels({
|
|
747
|
+
'aria-label': (ariaLabel ? ariaLabel + ' ' : '') + name,
|
|
748
|
+
'aria-labelledby': ariaLabelledBy
|
|
749
|
+
});
|
|
844
750
|
// Literal segments should not be visible to screen readers. We don't really need any of the above,
|
|
845
751
|
// but the rules of hooks mean hooks cannot be conditional so we have to put this condition here.
|
|
846
752
|
if (segment.type === 'literal') return {
|
|
@@ -849,12 +755,10 @@ function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
|
849
755
|
}
|
|
850
756
|
};
|
|
851
757
|
return {
|
|
852
|
-
segmentProps: $IwcIq$reactariautils.mergeProps(spinButtonProps, pressProps, {
|
|
758
|
+
segmentProps: $IwcIq$reactariautils.mergeProps(spinButtonProps, pressProps, labelProps, {
|
|
853
759
|
id: id,
|
|
854
760
|
...touchPropOverrides,
|
|
855
761
|
'aria-invalid': state.validationState === 'invalid' ? 'true' : undefined,
|
|
856
|
-
'aria-label': displayNames.of(segment.type),
|
|
857
|
-
'aria-labelledby': `${ariaLabelledBy} ${id}`,
|
|
858
762
|
'aria-describedby': ariaDescribedBy,
|
|
859
763
|
'aria-placeholder': segment.isPlaceholder ? segment.text : undefined,
|
|
860
764
|
'aria-readonly': state.isReadOnly || !segment.isEditable ? 'true' : undefined,
|
|
@@ -880,6 +784,124 @@ function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
|
880
784
|
|
|
881
785
|
|
|
882
786
|
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
795
|
+
var ref1, ref2;
|
|
796
|
+
let formatMessage = $IwcIq$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($c7d0e80b992ca68a$exports)));
|
|
797
|
+
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $IwcIq$reactarialabel.useField({
|
|
798
|
+
...props,
|
|
799
|
+
labelElementType: 'span'
|
|
800
|
+
});
|
|
801
|
+
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
802
|
+
let { locale: locale } = $IwcIq$reactariai18n.useLocale();
|
|
803
|
+
let description = state.formatValue(locale, {
|
|
804
|
+
month: 'long'
|
|
805
|
+
});
|
|
806
|
+
let descProps = $IwcIq$reactariautils.useDescription(description);
|
|
807
|
+
let startFieldProps = {
|
|
808
|
+
'aria-label': formatMessage('startDate'),
|
|
809
|
+
'aria-labelledby': labelledBy
|
|
810
|
+
};
|
|
811
|
+
let endFieldProps = {
|
|
812
|
+
'aria-label': formatMessage('endDate'),
|
|
813
|
+
'aria-labelledby': labelledBy
|
|
814
|
+
};
|
|
815
|
+
let buttonId = $IwcIq$reactariautils.useId();
|
|
816
|
+
let dialogId = $IwcIq$reactariautils.useId();
|
|
817
|
+
let groupProps = $715562ad3b4cced4$export$4a931266a3838b86(state, ref);
|
|
818
|
+
let { focusWithinProps: focusWithinProps } = $IwcIq$reactariainteractions.useFocusWithin({
|
|
819
|
+
onBlurWithin () {
|
|
820
|
+
state.confirmPlaceholder();
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
let ariaDescribedBy = [
|
|
824
|
+
descProps['aria-describedby'],
|
|
825
|
+
fieldProps['aria-describedby']
|
|
826
|
+
].filter(Boolean).join(' ') || undefined;
|
|
827
|
+
let focusManager = $IwcIq$react.useMemo(()=>$IwcIq$reactariafocus.createFocusManager(ref)
|
|
828
|
+
, [
|
|
829
|
+
ref
|
|
830
|
+
]);
|
|
831
|
+
let commonFieldProps = {
|
|
832
|
+
[$4acc2f407c169e55$export$7b3062cd49e80452]: focusManager,
|
|
833
|
+
[$4acc2f407c169e55$export$300019f83c56d282]: 'presentation',
|
|
834
|
+
'aria-describedby': ariaDescribedBy,
|
|
835
|
+
minValue: props.minValue,
|
|
836
|
+
maxValue: props.maxValue,
|
|
837
|
+
placeholderValue: props.placeholderValue,
|
|
838
|
+
hideTimeZone: props.hideTimeZone,
|
|
839
|
+
hourCycle: props.hourCycle,
|
|
840
|
+
granularity: props.granularity,
|
|
841
|
+
isDisabled: props.isDisabled,
|
|
842
|
+
isReadOnly: props.isReadOnly,
|
|
843
|
+
isRequired: props.isRequired,
|
|
844
|
+
validationState: state.validationState
|
|
845
|
+
};
|
|
846
|
+
return {
|
|
847
|
+
groupProps: $IwcIq$reactariautils.mergeProps(groupProps, fieldProps, descProps, focusWithinProps, {
|
|
848
|
+
role: 'group',
|
|
849
|
+
'aria-disabled': props.isDisabled || null,
|
|
850
|
+
'aria-describedby': ariaDescribedBy
|
|
851
|
+
}),
|
|
852
|
+
labelProps: {
|
|
853
|
+
...labelProps,
|
|
854
|
+
onClick: ()=>{
|
|
855
|
+
focusManager.focusFirst();
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
buttonProps: {
|
|
859
|
+
...descProps,
|
|
860
|
+
id: buttonId,
|
|
861
|
+
excludeFromTabOrder: true,
|
|
862
|
+
'aria-haspopup': 'dialog',
|
|
863
|
+
'aria-label': formatMessage('calendar'),
|
|
864
|
+
'aria-labelledby': `${labelledBy} ${buttonId}`,
|
|
865
|
+
'aria-describedby': ariaDescribedBy,
|
|
866
|
+
onPress: ()=>state.setOpen(true)
|
|
867
|
+
},
|
|
868
|
+
dialogProps: {
|
|
869
|
+
id: dialogId,
|
|
870
|
+
'aria-labelledby': `${labelledBy} ${buttonId}`
|
|
871
|
+
},
|
|
872
|
+
startFieldProps: {
|
|
873
|
+
...startFieldProps,
|
|
874
|
+
...commonFieldProps,
|
|
875
|
+
value: (ref1 = state.value) === null || ref1 === void 0 ? void 0 : ref1.start,
|
|
876
|
+
onChange: (start)=>state.setDateTime('start', start)
|
|
877
|
+
,
|
|
878
|
+
autoFocus: props.autoFocus
|
|
879
|
+
},
|
|
880
|
+
endFieldProps: {
|
|
881
|
+
...endFieldProps,
|
|
882
|
+
...commonFieldProps,
|
|
883
|
+
value: (ref2 = state.value) === null || ref2 === void 0 ? void 0 : ref2.end,
|
|
884
|
+
onChange: (end)=>state.setDateTime('end', end)
|
|
885
|
+
},
|
|
886
|
+
descriptionProps: descriptionProps,
|
|
887
|
+
errorMessageProps: errorMessageProps,
|
|
888
|
+
calendarProps: {
|
|
889
|
+
autoFocus: true,
|
|
890
|
+
value: state.dateRange,
|
|
891
|
+
onChange: state.setDateRange,
|
|
892
|
+
minValue: props.minValue,
|
|
893
|
+
maxValue: props.maxValue,
|
|
894
|
+
isDisabled: props.isDisabled,
|
|
895
|
+
isReadOnly: props.isReadOnly,
|
|
896
|
+
isDateUnavailable: props.isDateUnavailable,
|
|
897
|
+
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
898
|
+
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
883
905
|
$parcel$exportWildcard(module.exports, $934ac650a0aceb4b$exports);
|
|
884
906
|
|
|
885
907
|
|