@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/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,
|
|
@@ -331,191 +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
|
-
isDateUnavailable: props.isDateUnavailable,
|
|
443
|
-
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
444
|
-
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue
|
|
445
|
-
}
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
const $16f0b7bb276bc17e$export$653eddfc964b0f8a = new WeakMap();
|
|
457
|
-
function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
458
|
-
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $cIPI0$useField({
|
|
459
|
-
...props,
|
|
460
|
-
labelElementType: 'span'
|
|
461
|
-
});
|
|
462
|
-
let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref);
|
|
463
|
-
let { focusWithinProps: focusWithinProps } = $cIPI0$useFocusWithin({
|
|
464
|
-
onBlurWithin () {
|
|
465
|
-
state.confirmPlaceholder();
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
let formatter = $cIPI0$useDateFormatter(state.getFormatOptions({
|
|
469
|
-
month: 'long'
|
|
470
|
-
}));
|
|
471
|
-
let descProps = $cIPI0$useDescription(state.value ? formatter.format(state.dateValue) : null);
|
|
472
|
-
let segmentLabelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
473
|
-
let describedBy = [
|
|
474
|
-
descProps['aria-describedby'],
|
|
475
|
-
fieldProps['aria-describedby']
|
|
476
|
-
].filter(Boolean).join(' ') || undefined;
|
|
477
|
-
let propsFocusManager = props[$887cac91b7cc8801$export$7b3062cd49e80452];
|
|
478
|
-
let focusManager = $cIPI0$useMemo(()=>propsFocusManager || $cIPI0$createFocusManager(ref)
|
|
479
|
-
, [
|
|
480
|
-
propsFocusManager,
|
|
481
|
-
ref
|
|
482
|
-
]);
|
|
483
|
-
$16f0b7bb276bc17e$export$653eddfc964b0f8a.set(state, {
|
|
484
|
-
ariaLabelledBy: segmentLabelledBy,
|
|
485
|
-
ariaDescribedBy: describedBy,
|
|
486
|
-
focusManager: focusManager
|
|
487
|
-
});
|
|
488
|
-
let autoFocusRef = $cIPI0$useRef(props.autoFocus);
|
|
489
|
-
$cIPI0$useEffect(()=>{
|
|
490
|
-
if (autoFocusRef.current) focusManager.focusFirst();
|
|
491
|
-
autoFocusRef.current = false;
|
|
492
|
-
}, [
|
|
493
|
-
focusManager
|
|
494
|
-
]);
|
|
495
|
-
return {
|
|
496
|
-
labelProps: {
|
|
497
|
-
...labelProps,
|
|
498
|
-
onClick: ()=>{
|
|
499
|
-
focusManager.focusFirst();
|
|
500
|
-
}
|
|
501
|
-
},
|
|
502
|
-
fieldProps: $cIPI0$mergeProps(fieldProps, descProps, groupProps, focusWithinProps, {
|
|
503
|
-
role: 'group',
|
|
504
|
-
'aria-disabled': props.isDisabled || undefined,
|
|
505
|
-
'aria-describedby': describedBy
|
|
506
|
-
}),
|
|
507
|
-
descriptionProps: descriptionProps,
|
|
508
|
-
errorMessageProps: errorMessageProps
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
function $16f0b7bb276bc17e$export$4c842f6a241dc825(props, state, ref) {
|
|
512
|
-
return $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
418
|
var $3aeceb3a64eb8358$exports = {};
|
|
520
419
|
|
|
521
420
|
$parcel$export($3aeceb3a64eb8358$exports, "useDisplayNames", () => $3aeceb3a64eb8358$export$d42c60378c8168f8);
|
|
@@ -557,7 +456,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
557
456
|
let enteredKeys = $cIPI0$useRef('');
|
|
558
457
|
let { locale: locale , direction: direction } = $cIPI0$useLocale();
|
|
559
458
|
let displayNames = $3aeceb3a64eb8358$export$d42c60378c8168f8();
|
|
560
|
-
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);
|
|
561
460
|
let textValue = segment.text;
|
|
562
461
|
let options = $cIPI0$useMemo(()=>state.dateFormatter.resolvedOptions()
|
|
563
462
|
, [
|
|
@@ -575,7 +474,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
575
474
|
if (segment.type === 'month') {
|
|
576
475
|
let monthTextValue = monthDateFormatter.format(state.dateValue);
|
|
577
476
|
textValue = monthTextValue !== textValue ? `${textValue} – ${monthTextValue}` : monthTextValue;
|
|
578
|
-
} else if (segment.type === 'hour'
|
|
477
|
+
} else if (segment.type === 'hour') textValue = hourDateFormatter.format(state.dateValue);
|
|
579
478
|
let { spinButtonProps: spinButtonProps } = $cIPI0$useSpinButton({
|
|
580
479
|
value: segment.value,
|
|
581
480
|
textValue: textValue,
|
|
@@ -819,6 +718,13 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
819
718
|
if (segment !== firstSegment && state.validationState !== 'invalid') ariaDescribedBy = undefined;
|
|
820
719
|
let id = $cIPI0$useId();
|
|
821
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
|
+
});
|
|
822
728
|
// Literal segments should not be visible to screen readers. We don't really need any of the above,
|
|
823
729
|
// but the rules of hooks mean hooks cannot be conditional so we have to put this condition here.
|
|
824
730
|
if (segment.type === 'literal') return {
|
|
@@ -827,12 +733,10 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
827
733
|
}
|
|
828
734
|
};
|
|
829
735
|
return {
|
|
830
|
-
segmentProps: $cIPI0$mergeProps(spinButtonProps, pressProps, {
|
|
736
|
+
segmentProps: $cIPI0$mergeProps(spinButtonProps, pressProps, labelProps, {
|
|
831
737
|
id: id,
|
|
832
738
|
...touchPropOverrides,
|
|
833
739
|
'aria-invalid': state.validationState === 'invalid' ? 'true' : undefined,
|
|
834
|
-
'aria-label': displayNames.of(segment.type),
|
|
835
|
-
'aria-labelledby': `${ariaLabelledBy} ${id}`,
|
|
836
740
|
'aria-describedby': ariaDescribedBy,
|
|
837
741
|
'aria-placeholder': segment.isPlaceholder ? segment.text : undefined,
|
|
838
742
|
'aria-readonly': state.isReadOnly || !segment.isEditable ? 'true' : undefined,
|
|
@@ -860,5 +764,123 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
860
764
|
|
|
861
765
|
|
|
862
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
|
+
|
|
863
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};
|
|
864
886
|
//# sourceMappingURL=module.js.map
|