@react-aria/datepicker 3.0.0-nightly.3134 → 3.0.0-nightly.3156
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 +248 -135
- package/dist/main.js.map +1 -1
- package/dist/module.js +243 -132
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +66 -27
- package/dist/types.d.ts.map +1 -1
- package/package.json +16 -15
- package/src/index.ts +4 -4
- package/src/useDateField.ts +43 -8
- package/src/useDatePicker.ts +48 -9
- package/src/useDatePickerGroup.ts +31 -8
- package/src/useDateRangePicker.ts +63 -13
- package/src/useDateSegment.ts +44 -31
package/dist/main.js
CHANGED
|
@@ -8,6 +8,9 @@ var $IwcIq$react = require("react");
|
|
|
8
8
|
var $IwcIq$reactariaspinbutton = require("@react-aria/spinbutton");
|
|
9
9
|
var $IwcIq$internationalizedmessage = require("@internationalized/message");
|
|
10
10
|
|
|
11
|
+
function $parcel$export(e, n, v, s) {
|
|
12
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
|
+
}
|
|
11
14
|
function $parcel$exportWildcard(dest, source) {
|
|
12
15
|
Object.keys(source).forEach(function(key) {
|
|
13
16
|
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
@@ -27,12 +30,12 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
27
30
|
function $parcel$interopDefault(a) {
|
|
28
31
|
return a && a.__esModule ? a.default : a;
|
|
29
32
|
}
|
|
30
|
-
function $parcel$export(e, n, v, s) {
|
|
31
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
32
|
-
}
|
|
33
|
-
var $e90ae7c26a69c6b1$exports = {};
|
|
34
33
|
|
|
35
|
-
$parcel$export(
|
|
34
|
+
$parcel$export(module.exports, "useDatePicker", () => $e90ae7c26a69c6b1$export$42df105a73306d51);
|
|
35
|
+
$parcel$export(module.exports, "useDateSegment", () => $5c015c6316d1904d$export$1315d136e6f7581);
|
|
36
|
+
$parcel$export(module.exports, "useDateField", () => $4acc2f407c169e55$export$5591b0b878c1a989);
|
|
37
|
+
$parcel$export(module.exports, "useTimeField", () => $4acc2f407c169e55$export$4c842f6a241dc825);
|
|
38
|
+
$parcel$export(module.exports, "useDateRangePicker", () => $20f695b1b69e6b9e$export$12fd5f0e9f4bb192);
|
|
36
39
|
|
|
37
40
|
var $c7d0e80b992ca68a$exports = {};
|
|
38
41
|
var $aa344be62785b256$exports = {};
|
|
@@ -212,7 +215,8 @@ $c7d0e80b992ca68a$exports = {
|
|
|
212
215
|
|
|
213
216
|
|
|
214
217
|
|
|
215
|
-
|
|
218
|
+
|
|
219
|
+
function $715562ad3b4cced4$export$4a931266a3838b86(state, ref1) {
|
|
216
220
|
// Open the popover on alt + arrow down
|
|
217
221
|
let onKeyDown = (e)=>{
|
|
218
222
|
if (e.altKey && e.key === 'ArrowDown' && 'setOpen' in state) {
|
|
@@ -223,12 +227,31 @@ function $715562ad3b4cced4$export$4a931266a3838b86(state, ref) {
|
|
|
223
227
|
};
|
|
224
228
|
// Focus the first placeholder segment from the end on mouse down/touch up in the field.
|
|
225
229
|
let focusLast = ()=>{
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
var ref;
|
|
231
|
+
// Try to find the segment prior to the element that was clicked on.
|
|
232
|
+
let target = (ref = window.event) === null || ref === void 0 ? void 0 : ref.target;
|
|
233
|
+
let walker = $IwcIq$reactariafocus.getFocusableTreeWalker(ref1.current, {
|
|
234
|
+
tabbable: true
|
|
235
|
+
});
|
|
236
|
+
if (target) {
|
|
237
|
+
walker.currentNode = target;
|
|
238
|
+
target = walker.previousNode();
|
|
239
|
+
}
|
|
240
|
+
// If no target found, find the last element from the end.
|
|
241
|
+
if (!target) {
|
|
242
|
+
let last;
|
|
243
|
+
do {
|
|
244
|
+
last = walker.lastChild();
|
|
245
|
+
if (last) target = last;
|
|
246
|
+
}while (last)
|
|
247
|
+
}
|
|
248
|
+
// Now go backwards until we find an element that is not a placeholder.
|
|
249
|
+
while(target === null || target === void 0 ? void 0 : target.getAttribute('aria-placeholder')){
|
|
250
|
+
let prev = walker.previousNode();
|
|
251
|
+
if (prev && prev.getAttribute('aria-placeholder')) target = prev;
|
|
252
|
+
else break;
|
|
253
|
+
}
|
|
254
|
+
if (target) target.focus();
|
|
232
255
|
};
|
|
233
256
|
let { pressProps: pressProps } = $IwcIq$reactariainteractions.usePress({
|
|
234
257
|
onPressStart (e) {
|
|
@@ -278,7 +301,22 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
278
301
|
focusManager.focusFirst();
|
|
279
302
|
}
|
|
280
303
|
},
|
|
281
|
-
fieldProps:
|
|
304
|
+
fieldProps: {
|
|
305
|
+
...fieldProps,
|
|
306
|
+
value: state.value,
|
|
307
|
+
onChange: state.setValue,
|
|
308
|
+
minValue: props.minValue,
|
|
309
|
+
maxValue: props.maxValue,
|
|
310
|
+
placeholderValue: props.placeholderValue,
|
|
311
|
+
hideTimeZone: props.hideTimeZone,
|
|
312
|
+
hourCycle: props.hourCycle,
|
|
313
|
+
granularity: props.granularity,
|
|
314
|
+
isDisabled: props.isDisabled,
|
|
315
|
+
isReadOnly: props.isReadOnly,
|
|
316
|
+
isRequired: props.isRequired,
|
|
317
|
+
validationState: state.validationState,
|
|
318
|
+
autoFocus: props.autoFocus
|
|
319
|
+
},
|
|
282
320
|
descriptionProps: descriptionProps,
|
|
283
321
|
errorMessageProps: errorMessageProps,
|
|
284
322
|
buttonProps: {
|
|
@@ -288,31 +326,155 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
288
326
|
'aria-haspopup': 'dialog',
|
|
289
327
|
'aria-label': formatMessage('calendar'),
|
|
290
328
|
'aria-labelledby': `${labelledBy} ${buttonId}`,
|
|
291
|
-
'aria-describedby': ariaDescribedBy
|
|
329
|
+
'aria-describedby': ariaDescribedBy,
|
|
330
|
+
onPress: ()=>state.setOpen(true)
|
|
292
331
|
},
|
|
293
332
|
dialogProps: {
|
|
294
333
|
id: dialogId,
|
|
295
334
|
'aria-labelledby': `${labelledBy} ${buttonId}`
|
|
335
|
+
},
|
|
336
|
+
calendarProps: {
|
|
337
|
+
autoFocus: true,
|
|
338
|
+
value: state.dateValue,
|
|
339
|
+
onChange: state.setDateValue,
|
|
340
|
+
minValue: props.minValue,
|
|
341
|
+
maxValue: props.maxValue,
|
|
342
|
+
isDisabled: props.isDisabled,
|
|
343
|
+
isReadOnly: props.isReadOnly,
|
|
344
|
+
isDateDisabled: props.isDateDisabled,
|
|
345
|
+
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue
|
|
296
346
|
}
|
|
297
347
|
};
|
|
298
348
|
}
|
|
299
349
|
|
|
300
350
|
|
|
301
|
-
var $5c015c6316d1904d$exports = {};
|
|
302
351
|
|
|
303
|
-
$parcel$export($5c015c6316d1904d$exports, "useDateSegment", () => $5c015c6316d1904d$export$1315d136e6f7581);
|
|
304
352
|
|
|
305
|
-
var $4acc2f407c169e55$exports = {};
|
|
306
353
|
|
|
307
|
-
$parcel$export($4acc2f407c169e55$exports, "labelIds", () => $4acc2f407c169e55$export$beb2340c1222c6d);
|
|
308
|
-
$parcel$export($4acc2f407c169e55$exports, "useDateField", () => $4acc2f407c169e55$export$5591b0b878c1a989);
|
|
309
354
|
|
|
310
355
|
|
|
311
356
|
|
|
312
357
|
|
|
313
358
|
|
|
314
359
|
|
|
315
|
-
|
|
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
|
+
isDateDisabled: props.isDateDisabled,
|
|
465
|
+
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
const $4acc2f407c169e55$export$653eddfc964b0f8a = new WeakMap();
|
|
316
478
|
function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
317
479
|
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $IwcIq$reactarialabel.useField({
|
|
318
480
|
...props,
|
|
@@ -333,15 +495,28 @@ function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
|
333
495
|
descProps['aria-describedby'],
|
|
334
496
|
fieldProps['aria-describedby']
|
|
335
497
|
].filter(Boolean).join(' ') || undefined;
|
|
336
|
-
$
|
|
498
|
+
let propsFocusManager = props[$20f695b1b69e6b9e$export$7b3062cd49e80452];
|
|
499
|
+
let focusManager = $IwcIq$react.useMemo(()=>propsFocusManager || $IwcIq$reactariafocus.createFocusManager(ref)
|
|
500
|
+
, [
|
|
501
|
+
propsFocusManager,
|
|
502
|
+
ref
|
|
503
|
+
]);
|
|
504
|
+
$4acc2f407c169e55$export$653eddfc964b0f8a.set(state, {
|
|
337
505
|
ariaLabelledBy: segmentLabelledBy,
|
|
338
|
-
ariaDescribedBy: describedBy
|
|
506
|
+
ariaDescribedBy: describedBy,
|
|
507
|
+
focusManager: focusManager
|
|
339
508
|
});
|
|
509
|
+
let autoFocusRef = $IwcIq$react.useRef(props.autoFocus);
|
|
510
|
+
$IwcIq$react.useEffect(()=>{
|
|
511
|
+
if (autoFocusRef.current) focusManager.focusFirst();
|
|
512
|
+
autoFocusRef.current = false;
|
|
513
|
+
}, [
|
|
514
|
+
focusManager
|
|
515
|
+
]);
|
|
340
516
|
return {
|
|
341
517
|
labelProps: {
|
|
342
518
|
...labelProps,
|
|
343
519
|
onClick: ()=>{
|
|
344
|
-
let focusManager = $IwcIq$reactariafocus.createFocusManager(ref);
|
|
345
520
|
focusManager.focusFirst();
|
|
346
521
|
}
|
|
347
522
|
},
|
|
@@ -354,6 +529,9 @@ function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
|
354
529
|
errorMessageProps: errorMessageProps
|
|
355
530
|
};
|
|
356
531
|
}
|
|
532
|
+
function $4acc2f407c169e55$export$4c842f6a241dc825(props, state, ref) {
|
|
533
|
+
return $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref);
|
|
534
|
+
}
|
|
357
535
|
|
|
358
536
|
|
|
359
537
|
|
|
@@ -396,12 +574,11 @@ class $934ac650a0aceb4b$var$DisplayNamesPolyfill {
|
|
|
396
574
|
|
|
397
575
|
|
|
398
576
|
|
|
399
|
-
|
|
400
|
-
function $5c015c6316d1904d$export$1315d136e6f7581(props, segment, state, ref) {
|
|
577
|
+
function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
401
578
|
let enteredKeys = $IwcIq$react.useRef('');
|
|
402
579
|
let { locale: locale , direction: direction } = $IwcIq$reactariai18n.useLocale();
|
|
403
580
|
let displayNames = $934ac650a0aceb4b$export$d42c60378c8168f8();
|
|
404
|
-
let focusManager = $
|
|
581
|
+
let { ariaLabelledBy: ariaLabelledBy , ariaDescribedBy: ariaDescribedBy , focusManager: focusManager } = $4acc2f407c169e55$export$653eddfc964b0f8a.get(state);
|
|
405
582
|
let textValue = segment.text;
|
|
406
583
|
let options = $IwcIq$react.useMemo(()=>state.dateFormatter.resolvedOptions()
|
|
407
584
|
, [
|
|
@@ -425,9 +602,9 @@ function $5c015c6316d1904d$export$1315d136e6f7581(props, segment, state, ref) {
|
|
|
425
602
|
textValue: textValue,
|
|
426
603
|
minValue: segment.minValue,
|
|
427
604
|
maxValue: segment.maxValue,
|
|
428
|
-
isDisabled:
|
|
429
|
-
isReadOnly:
|
|
430
|
-
isRequired:
|
|
605
|
+
isDisabled: state.isDisabled,
|
|
606
|
+
isReadOnly: state.isReadOnly || !segment.isEditable,
|
|
607
|
+
isRequired: state.isRequired,
|
|
431
608
|
onIncrement: ()=>{
|
|
432
609
|
enteredKeys.current = '';
|
|
433
610
|
state.increment(segment.type);
|
|
@@ -460,7 +637,7 @@ function $5c015c6316d1904d$export$1315d136e6f7581(props, segment, state, ref) {
|
|
|
460
637
|
locale
|
|
461
638
|
]);
|
|
462
639
|
let backspace = ()=>{
|
|
463
|
-
if (parser.isValidPartialNumber(segment.text) && !
|
|
640
|
+
if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly && !segment.isPlaceholder) {
|
|
464
641
|
let newValue = segment.text.slice(0, -1);
|
|
465
642
|
let parsed = parser.parse(newValue);
|
|
466
643
|
if (newValue.length === 0 || parsed === 0) state.clearSegment(segment.type);
|
|
@@ -477,20 +654,30 @@ function $5c015c6316d1904d$export$1315d136e6f7581(props, segment, state, ref) {
|
|
|
477
654
|
case 'ArrowLeft':
|
|
478
655
|
e.preventDefault();
|
|
479
656
|
e.stopPropagation();
|
|
480
|
-
if (direction === 'rtl') focusManager.focusNext(
|
|
481
|
-
|
|
657
|
+
if (direction === 'rtl') focusManager.focusNext({
|
|
658
|
+
tabbable: true
|
|
659
|
+
});
|
|
660
|
+
else focusManager.focusPrevious({
|
|
661
|
+
tabbable: true
|
|
662
|
+
});
|
|
482
663
|
break;
|
|
483
664
|
case 'ArrowRight':
|
|
484
665
|
e.preventDefault();
|
|
485
666
|
e.stopPropagation();
|
|
486
|
-
if (direction === 'rtl') focusManager.focusPrevious(
|
|
487
|
-
|
|
667
|
+
if (direction === 'rtl') focusManager.focusPrevious({
|
|
668
|
+
tabbable: true
|
|
669
|
+
});
|
|
670
|
+
else focusManager.focusNext({
|
|
671
|
+
tabbable: true
|
|
672
|
+
});
|
|
488
673
|
break;
|
|
489
674
|
case 'Enter':
|
|
490
675
|
e.preventDefault();
|
|
491
676
|
e.stopPropagation();
|
|
492
|
-
if (segment.isPlaceholder && !
|
|
493
|
-
focusManager.focusNext(
|
|
677
|
+
if (segment.isPlaceholder && !state.isReadOnly) state.confirmPlaceholder(segment.type);
|
|
678
|
+
focusManager.focusNext({
|
|
679
|
+
tabbable: true
|
|
680
|
+
});
|
|
494
681
|
break;
|
|
495
682
|
case 'Tab':
|
|
496
683
|
break;
|
|
@@ -528,14 +715,16 @@ function $5c015c6316d1904d$export$1315d136e6f7581(props, segment, state, ref) {
|
|
|
528
715
|
amPmFormatter
|
|
529
716
|
]);
|
|
530
717
|
let onInput = (key)=>{
|
|
531
|
-
if (
|
|
718
|
+
if (state.isDisabled || state.isReadOnly) return;
|
|
532
719
|
let newValue = enteredKeys.current + key;
|
|
533
720
|
switch(segment.type){
|
|
534
721
|
case 'dayPeriod':
|
|
535
722
|
if (startsWith(am, key)) state.setSegment('dayPeriod', 0);
|
|
536
723
|
else if (startsWith(pm, key)) state.setSegment('dayPeriod', 12);
|
|
537
724
|
else break;
|
|
538
|
-
focusManager.focusNext(
|
|
725
|
+
focusManager.focusNext({
|
|
726
|
+
tabbable: true
|
|
727
|
+
});
|
|
539
728
|
break;
|
|
540
729
|
case 'day':
|
|
541
730
|
case 'hour':
|
|
@@ -565,7 +754,9 @@ function $5c015c6316d1904d$export$1315d136e6f7581(props, segment, state, ref) {
|
|
|
565
754
|
if (shouldSetValue) state.setSegment(segment.type, segmentValue);
|
|
566
755
|
if (Number(numberValue + '0') > segment.maxValue || newValue.length >= String(segment.maxValue).length) {
|
|
567
756
|
enteredKeys.current = '';
|
|
568
|
-
if (shouldSetValue) focusManager.focusNext(
|
|
757
|
+
if (shouldSetValue) focusManager.focusNext({
|
|
758
|
+
tabbable: true
|
|
759
|
+
});
|
|
569
760
|
} else enteredKeys.current = newValue;
|
|
570
761
|
break;
|
|
571
762
|
}
|
|
@@ -588,7 +779,7 @@ function $5c015c6316d1904d$export$1315d136e6f7581(props, segment, state, ref) {
|
|
|
588
779
|
switch(e.inputType){
|
|
589
780
|
case 'deleteContentBackward':
|
|
590
781
|
case 'deleteContentForward':
|
|
591
|
-
if (parser.isValidPartialNumber(segment.text) && !
|
|
782
|
+
if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly) backspace();
|
|
592
783
|
break;
|
|
593
784
|
case 'insertCompositionText':
|
|
594
785
|
// insertCompositionText cannot be canceled.
|
|
@@ -639,7 +830,6 @@ function $5c015c6316d1904d$export$1315d136e6f7581(props, segment, state, ref) {
|
|
|
639
830
|
'aria-valuenow': null
|
|
640
831
|
} : {
|
|
641
832
|
};
|
|
642
|
-
let { ariaLabelledBy: ariaLabelledBy , ariaDescribedBy: ariaDescribedBy } = $4acc2f407c169e55$export$beb2340c1222c6d.get(state);
|
|
643
833
|
// Only apply aria-describedby to the first segment, unless the field is invalid. This avoids it being
|
|
644
834
|
// read every time the user navigates to a new segment.
|
|
645
835
|
let firstSegment = $IwcIq$react.useMemo(()=>state.segments.find((s)=>s.isEditable
|
|
@@ -648,20 +838,25 @@ function $5c015c6316d1904d$export$1315d136e6f7581(props, segment, state, ref) {
|
|
|
648
838
|
state.segments
|
|
649
839
|
]);
|
|
650
840
|
if (segment !== firstSegment && state.validationState !== 'invalid') ariaDescribedBy = undefined;
|
|
651
|
-
let id = $IwcIq$reactariautils.useId(
|
|
652
|
-
let isEditable = !
|
|
841
|
+
let id = $IwcIq$reactariautils.useId();
|
|
842
|
+
let isEditable = !state.isDisabled && !state.isReadOnly && segment.isEditable;
|
|
843
|
+
// Literal segments should not be visible to screen readers. We don't really need any of the above,
|
|
844
|
+
// but the rules of hooks mean hooks cannot be conditional so we have to put this condition here.
|
|
845
|
+
if (segment.type === 'literal') return {
|
|
846
|
+
segmentProps: {
|
|
847
|
+
'aria-hidden': true
|
|
848
|
+
}
|
|
849
|
+
};
|
|
653
850
|
return {
|
|
654
851
|
segmentProps: $IwcIq$reactariautils.mergeProps(spinButtonProps, pressProps, {
|
|
655
852
|
id: id,
|
|
656
853
|
...touchPropOverrides,
|
|
657
|
-
'aria-controls': props['aria-controls'],
|
|
658
|
-
// 'aria-haspopup': props['aria-haspopup'], // deprecated in ARIA 1.2
|
|
659
854
|
'aria-invalid': state.validationState === 'invalid' ? 'true' : undefined,
|
|
660
|
-
'aria-label':
|
|
855
|
+
'aria-label': displayNames.of(segment.type),
|
|
661
856
|
'aria-labelledby': `${ariaLabelledBy} ${id}`,
|
|
662
857
|
'aria-describedby': ariaDescribedBy,
|
|
663
858
|
'aria-placeholder': segment.isPlaceholder ? segment.text : undefined,
|
|
664
|
-
'aria-readonly':
|
|
859
|
+
'aria-readonly': state.isReadOnly || !segment.isEditable ? 'true' : undefined,
|
|
665
860
|
contentEditable: isEditable,
|
|
666
861
|
suppressContentEditableWarning: isEditable,
|
|
667
862
|
spellCheck: isEditable ? 'false' : undefined,
|
|
@@ -669,103 +864,21 @@ function $5c015c6316d1904d$export$1315d136e6f7581(props, segment, state, ref) {
|
|
|
669
864
|
autoCorrect: isEditable ? 'off' : undefined,
|
|
670
865
|
// Capitalization was changed in React 17...
|
|
671
866
|
[parseInt(($parcel$interopDefault($IwcIq$react)).version, 10) >= 17 ? 'enterKeyHint' : 'enterkeyhint']: isEditable ? 'next' : undefined,
|
|
672
|
-
inputMode:
|
|
673
|
-
tabIndex:
|
|
867
|
+
inputMode: state.isDisabled || segment.type === 'dayPeriod' || !isEditable ? undefined : 'numeric',
|
|
868
|
+
tabIndex: state.isDisabled ? undefined : 0,
|
|
674
869
|
onKeyDown: onKeyDown,
|
|
675
|
-
onFocus: onFocus
|
|
870
|
+
onFocus: onFocus,
|
|
871
|
+
style: {
|
|
872
|
+
caretColor: 'transparent'
|
|
873
|
+
}
|
|
676
874
|
})
|
|
677
875
|
};
|
|
678
876
|
}
|
|
679
877
|
|
|
680
878
|
|
|
681
879
|
|
|
682
|
-
var $20f695b1b69e6b9e$exports = {};
|
|
683
|
-
|
|
684
|
-
$parcel$export($20f695b1b69e6b9e$exports, "useDateRangePicker", () => $20f695b1b69e6b9e$export$12fd5f0e9f4bb192);
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
693
|
-
let formatMessage = $IwcIq$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($c7d0e80b992ca68a$exports)));
|
|
694
|
-
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $IwcIq$reactarialabel.useField({
|
|
695
|
-
...props,
|
|
696
|
-
labelElementType: 'span'
|
|
697
|
-
});
|
|
698
|
-
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
699
|
-
let { locale: locale } = $IwcIq$reactariai18n.useLocale();
|
|
700
|
-
let description = state.formatValue(locale, {
|
|
701
|
-
month: 'long'
|
|
702
|
-
});
|
|
703
|
-
let descProps = $IwcIq$reactariautils.useDescription(description);
|
|
704
|
-
let startFieldProps = $IwcIq$reactariautils.useLabels({
|
|
705
|
-
'aria-label': formatMessage('startDate'),
|
|
706
|
-
'aria-labelledby': labelledBy
|
|
707
|
-
});
|
|
708
|
-
let endFieldProps = $IwcIq$reactariautils.useLabels({
|
|
709
|
-
'aria-label': formatMessage('endDate'),
|
|
710
|
-
'aria-labelledby': labelledBy
|
|
711
|
-
});
|
|
712
|
-
let buttonId = $IwcIq$reactariautils.useId();
|
|
713
|
-
let dialogId = $IwcIq$reactariautils.useId();
|
|
714
|
-
let groupProps = $715562ad3b4cced4$export$4a931266a3838b86(state, ref);
|
|
715
|
-
let { focusWithinProps: focusWithinProps } = $IwcIq$reactariainteractions.useFocusWithin({
|
|
716
|
-
onBlurWithin () {
|
|
717
|
-
state.confirmPlaceholder();
|
|
718
|
-
}
|
|
719
|
-
});
|
|
720
|
-
let ariaDescribedBy = [
|
|
721
|
-
descProps['aria-describedby'],
|
|
722
|
-
fieldProps['aria-describedby']
|
|
723
|
-
].filter(Boolean).join(' ') || undefined;
|
|
724
|
-
return {
|
|
725
|
-
groupProps: $IwcIq$reactariautils.mergeProps(groupProps, fieldProps, descProps, focusWithinProps, {
|
|
726
|
-
role: 'group',
|
|
727
|
-
'aria-disabled': props.isDisabled || null,
|
|
728
|
-
'aria-describedby': ariaDescribedBy
|
|
729
|
-
}),
|
|
730
|
-
labelProps: {
|
|
731
|
-
...labelProps,
|
|
732
|
-
onClick: ()=>{
|
|
733
|
-
let focusManager = $IwcIq$reactariafocus.createFocusManager(ref);
|
|
734
|
-
focusManager.focusFirst();
|
|
735
|
-
}
|
|
736
|
-
},
|
|
737
|
-
buttonProps: {
|
|
738
|
-
...descProps,
|
|
739
|
-
id: buttonId,
|
|
740
|
-
excludeFromTabOrder: true,
|
|
741
|
-
'aria-haspopup': 'dialog',
|
|
742
|
-
'aria-label': formatMessage('calendar'),
|
|
743
|
-
'aria-labelledby': `${labelledBy} ${buttonId}`,
|
|
744
|
-
'aria-describedby': ariaDescribedBy
|
|
745
|
-
},
|
|
746
|
-
dialogProps: {
|
|
747
|
-
id: dialogId,
|
|
748
|
-
'aria-labelledby': `${labelledBy} ${buttonId}`
|
|
749
|
-
},
|
|
750
|
-
startFieldProps: {
|
|
751
|
-
...startFieldProps,
|
|
752
|
-
'aria-describedby': fieldProps['aria-describedby']
|
|
753
|
-
},
|
|
754
|
-
endFieldProps: {
|
|
755
|
-
...endFieldProps,
|
|
756
|
-
'aria-describedby': fieldProps['aria-describedby']
|
|
757
|
-
},
|
|
758
|
-
descriptionProps: descriptionProps,
|
|
759
|
-
errorMessageProps: errorMessageProps
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
|
|
763
880
|
|
|
764
881
|
|
|
765
|
-
$parcel$exportWildcard(module.exports, $e90ae7c26a69c6b1$exports);
|
|
766
|
-
$parcel$exportWildcard(module.exports, $5c015c6316d1904d$exports);
|
|
767
|
-
$parcel$exportWildcard(module.exports, $4acc2f407c169e55$exports);
|
|
768
|
-
$parcel$exportWildcard(module.exports, $20f695b1b69e6b9e$exports);
|
|
769
882
|
$parcel$exportWildcard(module.exports, $934ac650a0aceb4b$exports);
|
|
770
883
|
|
|
771
884
|
|