@astryxdesign/core 0.7.16-canary.ge95b87c → 0.7.16
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/CHANGELOG.md +90 -0
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +38 -88
- package/dist/BottomSheet/BottomSheetPanel.d.ts +14 -6
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +26 -14
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +78 -3
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +3 -0
- package/dist/DateInput/DateInput.d.ts +24 -0
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +12 -5
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.d.ts.map +1 -1
- package/dist/DateInput/useTypedDate.d.ts +12 -5
- package/dist/DateInput/useTypedDate.d.ts.map +1 -1
- package/dist/DateInput/useTypedDate.js +18 -16
- package/dist/DateTimeInput/DateTimeInput.d.ts +25 -0
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +10 -3
- package/dist/DateTimeInput/NativeTimeSegment.d.ts +3 -1
- package/dist/DateTimeInput/NativeTimeSegment.d.ts.map +1 -1
- package/dist/DateTimeInput/NativeTimeSegment.js +10 -1
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +3 -0
- package/dist/Field/useEntryErrorBehavior.d.ts +8 -0
- package/dist/Field/useEntryErrorBehavior.d.ts.map +1 -0
- package/dist/Field/useEntryErrorBehavior.js +30 -0
- package/dist/FormLayout/FormLayout.d.ts +21 -2
- package/dist/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/FormLayout/FormLayout.js +5 -2
- package/dist/FormLayout/FormLayoutContext.d.ts +18 -2
- package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
- package/dist/FormLayout/FormLayoutContext.js +22 -4
- package/dist/FormLayout/index.d.ts +1 -1
- package/dist/FormLayout/index.d.ts.map +1 -1
- package/dist/Layer/inputHold.d.ts +11 -1
- package/dist/Layer/inputHold.d.ts.map +1 -1
- package/dist/Layer/inputHold.js +114 -2
- package/dist/Layer/layerEntranceSide.d.ts.map +1 -1
- package/dist/Layer/layerEntranceSide.js +2 -1
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +63 -148
- package/dist/Lightbox/useZoomCore.d.ts +2 -13
- package/dist/Lightbox/useZoomCore.d.ts.map +1 -1
- package/dist/Lightbox/useZoomCore.js +7 -33
- package/dist/Lightbox/useZoomStage.d.ts.map +1 -1
- package/dist/Lightbox/useZoomStage.js +3 -9
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +7 -0
- package/dist/MetadataList/MetadataList.d.ts +2 -1
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +1 -1
- package/dist/NumberInput/NumberInput.d.ts +20 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +4 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.d.ts.map +1 -1
- package/dist/Outline/useOutlineFromDOM.d.ts.map +1 -1
- package/dist/Outline/useOutlineFromDOM.js +1 -0
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +1 -0
- package/dist/Popover/popoverSurfaceFrame.d.ts +4 -16
- package/dist/Popover/popoverSurfaceFrame.d.ts.map +1 -1
- package/dist/Popover/popoverSurfaceFrame.js +16 -31
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +3 -0
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +4 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedTouchTracking.js +18 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +0 -2
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +2 -0
- package/dist/Thumbnail/Thumbnail.d.ts +2 -2
- package/dist/TimeInput/TimeInput.d.ts +24 -4
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +10 -4
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.d.ts.map +1 -1
- package/dist/TimeInput/useTypedTime.d.ts +17 -6
- package/dist/TimeInput/useTypedTime.d.ts.map +1 -1
- package/dist/TimeInput/useTypedTime.js +41 -18
- package/dist/Toast/Toast.d.ts +6 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +17 -1
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +10 -9
- package/dist/astryx.css +36 -6
- package/dist/hooks/containerReveal.stylex.d.ts.map +1 -1
- package/dist/hooks/containerReveal.stylex.js +18 -15
- package/dist/hooks/useAnnounceRenderedText.d.ts +9 -3
- package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
- package/dist/hooks/useAnnounceRenderedText.js +9 -7
- package/dist/hooks/useContainerReveal.d.ts +8 -5
- package/dist/hooks/useContainerReveal.d.ts.map +1 -1
- package/dist/hooks/useContainerReveal.js +2 -1
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +1 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
- package/dist/internal/shared-context.d.ts +15 -0
- package/dist/internal/shared-context.d.ts.map +1 -0
- package/dist/internal/shared-context.js +15 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +2 -17
- package/dist/motion/linearEasing.d.ts +9 -0
- package/dist/motion/linearEasing.d.ts.map +1 -0
- package/dist/motion/linearEasing.js +32 -0
- package/dist/motion/resolveMotion.d.ts +16 -0
- package/dist/motion/resolveMotion.d.ts.map +1 -1
- package/dist/motion/resolveMotion.js +40 -1
- package/locales/en.json +15 -11
- package/locales/pseudo.json +3 -0
- package/package.json +10 -5
- package/src/BottomSheet/BottomSheet.tsx +43 -101
- package/src/BottomSheet/BottomSheetPanel.tsx +46 -23
- package/src/Button/Button.tsx +132 -5
- package/src/Chat/ChatComposerInput.tsx +4 -0
- package/src/ContextMenu/ContextMenu.tsx +13 -0
- package/src/DateInput/DateInput.doc.mjs +18 -0
- package/src/DateInput/DateInput.tsx +35 -3
- package/src/DateInput/index.ts +1 -0
- package/src/DateInput/useTypedDate.ts +50 -12
- package/src/DateTimeInput/DateTimeInput.doc.mjs +18 -0
- package/src/DateTimeInput/DateTimeInput.tsx +38 -2
- package/src/DateTimeInput/NativeTimeSegment.tsx +16 -1
- package/src/DateTimeInput/index.ts +1 -0
- package/src/Dialog/Dialog.tsx +13 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +13 -0
- package/src/Field/useEntryErrorBehavior.ts +34 -0
- package/src/FormLayout/FormLayout.doc.mjs +14 -0
- package/src/FormLayout/FormLayout.tsx +24 -2
- package/src/FormLayout/FormLayoutContext.ts +24 -4
- package/src/FormLayout/index.ts +5 -1
- package/src/Layer/inputHold.ts +137 -2
- package/src/Layer/layerEntranceSide.ts +2 -1
- package/src/Lightbox/Lightbox.doc.mjs +1 -1
- package/src/Lightbox/Lightbox.tsx +226 -357
- package/src/Lightbox/useZoomCore.ts +6 -49
- package/src/Lightbox/useZoomStage.ts +7 -17
- package/src/Markdown/Markdown.tsx +6 -0
- package/src/MetadataList/MetadataList.doc.mjs +16 -0
- package/src/MetadataList/MetadataList.tsx +3 -2
- package/src/NumberInput/NumberInput.doc.mjs +18 -0
- package/src/NumberInput/NumberInput.tsx +22 -1
- package/src/NumberInput/index.ts +1 -0
- package/src/Outline/useOutlineFromDOM.doc.mjs +99 -0
- package/src/Outline/useOutlineFromDOM.ts +1 -0
- package/src/Pagination/Pagination.tsx +1 -0
- package/src/Popover/popoverSurfaceFrame.ts +18 -41
- package/src/Popover/usePopover.tsx +13 -0
- package/src/PowerSearch/PowerSearchValueEditor.tsx +4 -0
- package/src/SegmentedControl/useSegmentedTouchTracking.ts +15 -0
- package/src/Selector/Selector.tsx +0 -1
- package/src/Table/plugins/filtering/useTableFiltering.tsx +2 -0
- package/src/Thumbnail/Thumbnail.doc.mjs +2 -2
- package/src/Thumbnail/Thumbnail.tsx +2 -2
- package/src/TimeInput/TimeInput.doc.mjs +21 -3
- package/src/TimeInput/TimeInput.tsx +38 -8
- package/src/TimeInput/index.ts +1 -0
- package/src/TimeInput/useTypedTime.ts +60 -18
- package/src/Toast/Toast.tsx +33 -2
- package/src/Toast/ToastViewport.tsx +14 -9
- package/src/hooks/containerReveal.stylex.ts +17 -15
- package/src/hooks/useAnnounceRenderedText.ts +18 -6
- package/src/hooks/useContainerReveal.doc.mjs +3 -3
- package/src/hooks/useContainerReveal.ts +8 -5
- package/src/i18n/generated-locales/en.generated.ts +1 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
- package/src/internal/shared-context.ts +15 -0
- package/src/motion/README.md +1 -0
- package/src/motion/animatedLayout.ts +6 -21
- package/src/motion/linearEasing.ts +35 -0
- package/src/motion/resolveMotion.ts +42 -1
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
import {useDevWarning} from '../hooks/useDevWarning';
|
|
78
78
|
import {useScrollLock} from '../hooks/useScrollLock';
|
|
79
79
|
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
80
|
-
import {
|
|
80
|
+
import {holdInput} from '../Layer/inputHold';
|
|
81
81
|
import {mergeProps} from '../utils/mergeProps';
|
|
82
82
|
import {LayerDepthProvider} from '../Layer/LayerDepthContext';
|
|
83
83
|
import {ModalAnnounceProvider} from '../hooks/ModalAnnounceProvider';
|
|
@@ -93,6 +93,7 @@ import {
|
|
|
93
93
|
BottomSheetPanel,
|
|
94
94
|
type BottomSheetPanelMotion,
|
|
95
95
|
type BottomSheetPanelState,
|
|
96
|
+
type ScrimFade,
|
|
96
97
|
} from './BottomSheetPanel';
|
|
97
98
|
import {BottomSheetEdgeTint} from './BottomSheetEdgeTint';
|
|
98
99
|
import {
|
|
@@ -212,17 +213,14 @@ const styles = stylex.create({
|
|
|
212
213
|
* The dim leaves with the sheet, on a matching curve. A fade covers no
|
|
213
214
|
* distance, so `--ease-standard` would end it early: 90% faded after 163ms
|
|
214
215
|
* of a 410ms close, under a sheet that is still sliding. `linear` uses the
|
|
215
|
-
* whole duration.
|
|
216
|
+
* whole duration. A touch drag's close writes its spring's progress as the
|
|
217
|
+
* easing instead, so the dim clears as the sheet slides out.
|
|
216
218
|
*/
|
|
217
219
|
scrimClosing: {
|
|
218
220
|
'::backdrop': {
|
|
219
|
-
transitionTimingFunction: 'linear',
|
|
221
|
+
transitionTimingFunction: 'var(--_sheet-scrim-easing, linear)',
|
|
220
222
|
},
|
|
221
223
|
},
|
|
222
|
-
// A closing sheet that keeps focus takes no pointer input during its exit.
|
|
223
|
-
exitHoldingFocus: {
|
|
224
|
-
pointerEvents: 'none',
|
|
225
|
-
},
|
|
226
224
|
positioner: {
|
|
227
225
|
position: 'absolute',
|
|
228
226
|
insetInline: 0,
|
|
@@ -271,24 +269,6 @@ function stackPositionerStyles(view: BottomSheetStackView) {
|
|
|
271
269
|
}
|
|
272
270
|
|
|
273
271
|
/** The `data-sheet-stack` value for a host: only set while sheets stack. */
|
|
274
|
-
/** Stops a click, from any input, before it reaches its target. */
|
|
275
|
-
function ignoreActivation(event: React.MouseEvent): void {
|
|
276
|
-
event.preventDefault();
|
|
277
|
-
event.stopPropagation();
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Stops every key except Tab before it reaches the focused control, so no
|
|
282
|
-
* key handler runs and no text changes (a search field's Enter, a typed
|
|
283
|
-
* letter, Backspace, an arrow that reopens a list). Tab still moves focus.
|
|
284
|
-
*/
|
|
285
|
-
function ignoreKeyDuringExit(event: React.KeyboardEvent): void {
|
|
286
|
-
if (event.key !== 'Tab') {
|
|
287
|
-
event.preventDefault();
|
|
288
|
-
event.stopPropagation();
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
272
|
function stackStateAttribute(
|
|
293
273
|
view: BottomSheetStackView,
|
|
294
274
|
isOpen: boolean,
|
|
@@ -309,23 +289,24 @@ function scrimOpacityForView(view: BottomSheetStackView): '0' | '1' {
|
|
|
309
289
|
|
|
310
290
|
/**
|
|
311
291
|
* Writes the fade a touch drag's close paces on `dialog`'s scrim, or clears
|
|
312
|
-
* it when `
|
|
313
|
-
* removes only that
|
|
292
|
+
* it when `fade` is null. `written` keeps the duration the host wrote, so a
|
|
293
|
+
* clear removes only that fade.
|
|
314
294
|
*/
|
|
315
|
-
function
|
|
295
|
+
function writeScrimFade(
|
|
316
296
|
dialog: HTMLDialogElement | null,
|
|
317
|
-
|
|
297
|
+
fade: ScrimFade | null,
|
|
318
298
|
written: {current: string | null},
|
|
319
299
|
): void {
|
|
320
300
|
if (dialog == null) {
|
|
321
301
|
return;
|
|
322
302
|
}
|
|
323
303
|
const current = dialog.style.getPropertyValue('--_sheet-scrim-duration');
|
|
324
|
-
if (
|
|
325
|
-
// Remove only the
|
|
304
|
+
if (fade == null) {
|
|
305
|
+
// Remove only the fade this host wrote. A stack's 0s pin written since
|
|
326
306
|
// then stays.
|
|
327
307
|
if (written.current != null && current === written.current) {
|
|
328
308
|
dialog.style.removeProperty('--_sheet-scrim-duration');
|
|
309
|
+
dialog.style.removeProperty('--_sheet-scrim-easing');
|
|
329
310
|
}
|
|
330
311
|
written.current = null;
|
|
331
312
|
return;
|
|
@@ -334,8 +315,9 @@ function writeScrimFadeDuration(
|
|
|
334
315
|
if (current === '0s') {
|
|
335
316
|
return;
|
|
336
317
|
}
|
|
337
|
-
written.current = `${
|
|
318
|
+
written.current = `${fade.durationMs}ms`;
|
|
338
319
|
dialog.style.setProperty('--_sheet-scrim-duration', written.current);
|
|
320
|
+
dialog.style.setProperty('--_sheet-scrim-easing', fade.easing);
|
|
339
321
|
}
|
|
340
322
|
|
|
341
323
|
interface BottomSheetSharedProps extends BaseProps<HTMLDivElement> {
|
|
@@ -523,14 +505,10 @@ function StandaloneBottomSheet({
|
|
|
523
505
|
// `isOpen` restarts the flag during render, and the layout effect below
|
|
524
506
|
// settles a close.
|
|
525
507
|
const [isCloseSettled, setIsCloseSettled] = useState(false);
|
|
526
|
-
// Whether focus was inside the sheet when it closed. Such a sheet stays out
|
|
527
|
-
// of `inert` and `aria-hidden` until its exit ends and focus has left.
|
|
528
|
-
const [isExitFocusHeld, setIsExitFocusHeld] = useState(false);
|
|
529
508
|
const [settledIsOpen, setSettledIsOpen] = useState(isOpen);
|
|
530
509
|
if (settledIsOpen !== isOpen) {
|
|
531
510
|
setSettledIsOpen(isOpen);
|
|
532
511
|
setIsCloseSettled(false);
|
|
533
|
-
setIsExitFocusHeld(false);
|
|
534
512
|
}
|
|
535
513
|
const panelState: BottomSheetPanelState = isOpen
|
|
536
514
|
? {kind: 'open', entering: stackView.isReplacing}
|
|
@@ -589,13 +567,13 @@ function StandaloneBottomSheet({
|
|
|
589
567
|
}, []);
|
|
590
568
|
// The fade duration a touch drag's close wrote, until that close ends.
|
|
591
569
|
const scrimFadeRef = useRef<string | null>(null);
|
|
592
|
-
const
|
|
593
|
-
(panel: HTMLElement,
|
|
570
|
+
const handleScrimFade = useCallback(
|
|
571
|
+
(panel: HTMLElement, fade: ScrimFade | null) => {
|
|
594
572
|
const view = stackViewRef.current;
|
|
595
573
|
if (view.isStacked && !view.ownsScrim) {
|
|
596
574
|
return;
|
|
597
575
|
}
|
|
598
|
-
|
|
576
|
+
writeScrimFade(panel.closest('dialog'), fade, scrimFadeRef);
|
|
599
577
|
},
|
|
600
578
|
[],
|
|
601
579
|
);
|
|
@@ -721,8 +699,6 @@ function StandaloneBottomSheet({
|
|
|
721
699
|
// that was not paired as a replace is an exit from here on.
|
|
722
700
|
// eslint-disable-next-line @eslint-react/set-state-in-effect -- settles the close once the registry has answered
|
|
723
701
|
setIsCloseSettled(true);
|
|
724
|
-
// Read with the close, before the sheet can go inert.
|
|
725
|
-
setIsExitFocusHeld(hadFocusAtCloseRef.current);
|
|
726
702
|
}
|
|
727
703
|
}, [hasScrim, isOpen, shouldPresent]);
|
|
728
704
|
|
|
@@ -826,44 +802,7 @@ function StandaloneBottomSheet({
|
|
|
826
802
|
);
|
|
827
803
|
|
|
828
804
|
const {ref: modalityRef} = useInteractionModalityTracking();
|
|
829
|
-
|
|
830
|
-
// dropped to the page because the focused control was removed or disabled.
|
|
831
|
-
// Native listeners, because React drops the `focusout` a browser sends while
|
|
832
|
-
// React removes the focused element, and Firefox and WebKit send no
|
|
833
|
-
// `focusout` for a removed element at all, so a subtree change is read too.
|
|
834
|
-
// Each reads the focus after the event. They attach only while a closing
|
|
835
|
-
// sheet holds focus, so a closed or open sheet observes nothing.
|
|
836
|
-
const isWatchingExitFocus =
|
|
837
|
-
!isOpen && isPresented && !isReplaced && isExitFocusHeld;
|
|
838
|
-
const exitFocusRef = useCallback(
|
|
839
|
-
(dialog: HTMLDialogElement | null) => {
|
|
840
|
-
if (dialog == null || !isWatchingExitFocus) {
|
|
841
|
-
return;
|
|
842
|
-
}
|
|
843
|
-
const releaseIfFocusLeft = () => {
|
|
844
|
-
if (!dialog.contains(dialog.ownerDocument.activeElement)) {
|
|
845
|
-
setIsExitFocusHeld(false);
|
|
846
|
-
}
|
|
847
|
-
};
|
|
848
|
-
const onFocusOut = () => queueMicrotask(releaseIfFocusLeft);
|
|
849
|
-
dialog.addEventListener('focusout', onFocusOut);
|
|
850
|
-
const unobserve = observeMutations(
|
|
851
|
-
dialog,
|
|
852
|
-
{
|
|
853
|
-
childList: true,
|
|
854
|
-
subtree: true,
|
|
855
|
-
attributeFilter: ['disabled', 'hidden', 'inert'],
|
|
856
|
-
},
|
|
857
|
-
releaseIfFocusLeft,
|
|
858
|
-
);
|
|
859
|
-
return () => {
|
|
860
|
-
dialog.removeEventListener('focusout', onFocusOut);
|
|
861
|
-
unobserve();
|
|
862
|
-
};
|
|
863
|
-
},
|
|
864
|
-
[isWatchingExitFocus],
|
|
865
|
-
);
|
|
866
|
-
const dialogComposedRef = useMergedRefs(dialogRef, modalityRef, exitFocusRef);
|
|
805
|
+
const dialogComposedRef = useMergedRefs(dialogRef, modalityRef);
|
|
867
806
|
useScrollLock(shouldPresent && hasScrim);
|
|
868
807
|
useDevWarning(
|
|
869
808
|
'BottomSheet',
|
|
@@ -932,17 +871,26 @@ function StandaloneBottomSheet({
|
|
|
932
871
|
// makes everything outside it inert, this dialog included. A covered sheet
|
|
933
872
|
// that contains no presented sheet is marked inert and hidden as well, so
|
|
934
873
|
// the state is explicit; one that does contain the top sheet is left alone,
|
|
935
|
-
// because inert on it would reach the top sheet too.
|
|
936
|
-
// A sheet that
|
|
937
|
-
//
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
//
|
|
942
|
-
// first commit of a close never
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
874
|
+
// because inert on it would reach the top sheet too. A replaced sheet is
|
|
875
|
+
// inert through its handoff. A sheet that exits otherwise is held by the
|
|
876
|
+
// layer runtime's input hold below.
|
|
877
|
+
const isInert = (isExiting && isReplaced) || stackView.isBlocked;
|
|
878
|
+
const isExitHeld = isExiting && !isReplaced && isCloseSettled;
|
|
879
|
+
|
|
880
|
+
// Syncs the exit with the layer runtime's input hold. Until the close
|
|
881
|
+
// settles, no closing sheet is held, so the first commit of a close never
|
|
882
|
+
// hides focus.
|
|
883
|
+
useLayoutEffect(() => {
|
|
884
|
+
const dialog = dialogRef.current;
|
|
885
|
+
if (!isExitHeld || dialog == null) {
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
return holdInput(dialog, {
|
|
889
|
+
until: new Promise<never>(() => {}),
|
|
890
|
+
scope: 'layer',
|
|
891
|
+
focus: 'kept-inside',
|
|
892
|
+
});
|
|
893
|
+
}, [isExitHeld]);
|
|
946
894
|
|
|
947
895
|
return (
|
|
948
896
|
<dialog
|
|
@@ -957,7 +905,6 @@ function StandaloneBottomSheet({
|
|
|
957
905
|
hasScrim && styles.scrim,
|
|
958
906
|
hasScrim && isEntrySettled && styles.scrimSettled,
|
|
959
907
|
hasScrim && isExiting && styles.scrimClosing,
|
|
960
|
-
isExitHoldingFocus && styles.exitHoldingFocus,
|
|
961
908
|
!hasScrim && styles.dialogNonModal,
|
|
962
909
|
)}
|
|
963
910
|
ref={dialogComposedRef}
|
|
@@ -979,11 +926,6 @@ function StandaloneBottomSheet({
|
|
|
979
926
|
hasScrim && stackView.depth > 0 ? stackView.depth : undefined
|
|
980
927
|
}
|
|
981
928
|
onCancel={handleCancel}
|
|
982
|
-
// A closing sheet that keeps focus takes no activation during its
|
|
983
|
-
// exit: no click and no key but Tab reaches the control that has focus.
|
|
984
|
-
onClickCapture={isExitHoldingFocus ? ignoreActivation : undefined}
|
|
985
|
-
onKeyDownCapture={isExitHoldingFocus ? ignoreKeyDuringExit : undefined}
|
|
986
|
-
onKeyUpCapture={isExitHoldingFocus ? ignoreKeyDuringExit : undefined}
|
|
987
929
|
// Presses inside the sheet do not reach handlers around where it is
|
|
988
930
|
// written. The dialog, not the panel, is the root, as in a switcher.
|
|
989
931
|
{...layerClickBoundary({onClick: handleClick})}>
|
|
@@ -1002,7 +944,7 @@ function StandaloneBottomSheet({
|
|
|
1002
944
|
xstyle={xstyle}
|
|
1003
945
|
onDismiss={dismissOnLightInteraction}
|
|
1004
946
|
onScrimOpacity={handleScrimOpacity}
|
|
1005
|
-
|
|
947
|
+
onScrimFade={handleScrimFade}
|
|
1006
948
|
onElementChange={handlePanelElementChange}
|
|
1007
949
|
handleRef={outletRef}
|
|
1008
950
|
onMotionStart={handleMotionStart}
|
|
@@ -1157,9 +1099,9 @@ function SwitcherBottomSheetItem({
|
|
|
1157
1099
|
// close ends. The step a drag closes becomes the flow's retained step, so
|
|
1158
1100
|
// its backdrop is the flow's scrim.
|
|
1159
1101
|
const scrimFadeRef = useRef<string | null>(null);
|
|
1160
|
-
const
|
|
1161
|
-
(panel: HTMLElement,
|
|
1162
|
-
|
|
1102
|
+
const handleScrimFade = useCallback(
|
|
1103
|
+
(panel: HTMLElement, fade: ScrimFade | null) => {
|
|
1104
|
+
writeScrimFade(panel.closest('dialog'), fade, scrimFadeRef);
|
|
1163
1105
|
},
|
|
1164
1106
|
[],
|
|
1165
1107
|
);
|
|
@@ -1365,7 +1307,7 @@ function SwitcherBottomSheetItem({
|
|
|
1365
1307
|
xstyle={xstyle}
|
|
1366
1308
|
onDismiss={dismissOnSwipe}
|
|
1367
1309
|
onScrimOpacity={handleScrimOpacity}
|
|
1368
|
-
|
|
1310
|
+
onScrimFade={handleScrimFade}
|
|
1369
1311
|
onElementChange={handlePanelElementChange}
|
|
1370
1312
|
onMotionStart={handleMotionStart}
|
|
1371
1313
|
onMotionComplete={handleMotionComplete}>
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
type BottomSheetSnapPoint,
|
|
72
72
|
} from './snapOffsets';
|
|
73
73
|
import {animatorFor, SETTLE_THRESHOLD} from '../motion/animator';
|
|
74
|
-
import {
|
|
74
|
+
import {resolveMoveTiming} from '../motion/resolveMotion';
|
|
75
75
|
import {springs} from '../motion/uikit/springs';
|
|
76
76
|
import {useMobileKeyboard} from '../keyboard/useMobileKeyboard';
|
|
77
77
|
import {
|
|
@@ -130,6 +130,15 @@ function hasStyles(xstyle: unknown): boolean {
|
|
|
130
130
|
: xstyle != null && typeof xstyle === 'object';
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* The scrim's fade under a touch drag's close: the close's duration in ms,
|
|
135
|
+
* and its progress as CSS easing, so the fade follows the sheet.
|
|
136
|
+
*/
|
|
137
|
+
export interface ScrimFade {
|
|
138
|
+
readonly durationMs: number;
|
|
139
|
+
readonly easing: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
133
142
|
function supportsWebAnimations(): boolean {
|
|
134
143
|
return (
|
|
135
144
|
typeof Element !== 'undefined' &&
|
|
@@ -138,16 +147,29 @@ function supportsWebAnimations(): boolean {
|
|
|
138
147
|
}
|
|
139
148
|
|
|
140
149
|
/**
|
|
141
|
-
* How
|
|
142
|
-
*
|
|
150
|
+
* How a drag's close plays: the close spring's move from where the finger
|
|
151
|
+
* left the sheet, timed as the shared animator times it, and its progress
|
|
152
|
+
* toward the point where the sheet leaves view. The sheet's surface reaches
|
|
153
|
+
* below the screen (the reserve), so it leaves view before the close ends,
|
|
154
|
+
* and the scrim is clear when it does.
|
|
143
155
|
*/
|
|
144
|
-
function
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
156
|
+
function dragExitFade(element: Element, exit: SheetDragExit): ScrimFade {
|
|
157
|
+
const viewportHeight = element.ownerDocument.defaultView?.innerHeight ?? 0;
|
|
158
|
+
const shown = Math.max(
|
|
159
|
+
0,
|
|
160
|
+
viewportHeight - element.getBoundingClientRect().top,
|
|
161
|
+
);
|
|
162
|
+
return resolveMoveTiming(
|
|
163
|
+
element,
|
|
164
|
+
springs.sheetDismissSwipe,
|
|
165
|
+
{
|
|
166
|
+
from: 0,
|
|
167
|
+
to: exit.distance,
|
|
168
|
+
velocity: exit.velocity,
|
|
169
|
+
epsilon: SETTLE_THRESHOLD.y,
|
|
170
|
+
},
|
|
171
|
+
Math.min(exit.distance, shown),
|
|
172
|
+
);
|
|
151
173
|
}
|
|
152
174
|
|
|
153
175
|
/** The running fade that clears the scrim behind `panel`, if any. */
|
|
@@ -372,6 +394,7 @@ const styles = stylex.create({
|
|
|
372
394
|
// inheritance, so the restyle stops here.
|
|
373
395
|
'--_sheet-scrim-opacity': 'initial',
|
|
374
396
|
'--_sheet-scrim-duration': 'initial',
|
|
397
|
+
'--_sheet-scrim-easing': 'initial',
|
|
375
398
|
},
|
|
376
399
|
// A sheet present on page load opens where it rests (spec:AST-013 FR13):
|
|
377
400
|
// the collapse reduced motion uses, so the transition still ends.
|
|
@@ -586,12 +609,12 @@ interface BottomSheetPanelProps extends BaseProps<HTMLDivElement> {
|
|
|
586
609
|
onDismiss: () => void;
|
|
587
610
|
onScrimOpacity: (opacity: number) => void;
|
|
588
611
|
/**
|
|
589
|
-
* The scrim's fade under a touch drag's close,
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
*
|
|
612
|
+
* The scrim's fade under a touch drag's close, or null once that close
|
|
613
|
+
* ends or a reopen takes the sheet back. `panel` is the sheet's element:
|
|
614
|
+
* the commit that starts the close can detach the host's dialog ref while
|
|
615
|
+
* this runs.
|
|
593
616
|
*/
|
|
594
|
-
|
|
617
|
+
onScrimFade?: (panel: HTMLElement, fade: ScrimFade | null) => void;
|
|
595
618
|
onElementChange?: (element: HTMLDivElement | null) => void;
|
|
596
619
|
/**
|
|
597
620
|
* A ref for the grab handle's element. The handle stays mounted with the
|
|
@@ -774,7 +797,7 @@ export function BottomSheetPanel({
|
|
|
774
797
|
isPageScrollLocked = false,
|
|
775
798
|
onDismiss,
|
|
776
799
|
onScrimOpacity,
|
|
777
|
-
|
|
800
|
+
onScrimFade,
|
|
778
801
|
onElementChange,
|
|
779
802
|
handleRef,
|
|
780
803
|
onMotionStart,
|
|
@@ -787,7 +810,7 @@ export function BottomSheetPanel({
|
|
|
787
810
|
>(null);
|
|
788
811
|
const onMotionStartRef = useCommittedRef(onMotionStart);
|
|
789
812
|
const onMotionCompleteRef = useCommittedRef(onMotionComplete);
|
|
790
|
-
const
|
|
813
|
+
const onScrimFadeRef = useCommittedRef(onScrimFade);
|
|
791
814
|
const startedMotionRef = useRef<BottomSheetPanelMotion | null>(null);
|
|
792
815
|
const pendingMotionCompleteRef = useRef<BottomSheetPanelMotion | null>(null);
|
|
793
816
|
|
|
@@ -991,14 +1014,14 @@ export function BottomSheetPanel({
|
|
|
991
1014
|
return;
|
|
992
1015
|
}
|
|
993
1016
|
// The host's current callback hears the fade end, as it heard its start.
|
|
994
|
-
const reportFade = (
|
|
995
|
-
|
|
1017
|
+
const reportFade = (fade: ScrimFade | null) => {
|
|
1018
|
+
onScrimFadeRef.current?.(element, fade);
|
|
996
1019
|
};
|
|
997
|
-
reportFade(
|
|
1020
|
+
reportFade(dragExitFade(element, playedDragExit));
|
|
998
1021
|
return () => {
|
|
999
1022
|
reportFade(null);
|
|
1000
1023
|
};
|
|
1001
|
-
}, [
|
|
1024
|
+
}, [onScrimFadeRef, playedDragExit]);
|
|
1002
1025
|
// Syncs the motion with the panel's CSS transition, or a drag's exit with
|
|
1003
1026
|
// the shared animator. The motion completes when that one ends.
|
|
1004
1027
|
useLayoutEffect(() => {
|
|
@@ -1057,7 +1080,7 @@ export function BottomSheetPanel({
|
|
|
1057
1080
|
});
|
|
1058
1081
|
void exit.finished.then(() => {
|
|
1059
1082
|
isFinished = true;
|
|
1060
|
-
|
|
1083
|
+
onScrimFadeRef.current?.(element, null);
|
|
1061
1084
|
if (isCurrent) {
|
|
1062
1085
|
complete();
|
|
1063
1086
|
}
|
|
@@ -1090,7 +1113,7 @@ export function BottomSheetPanel({
|
|
|
1090
1113
|
playedDragExit,
|
|
1091
1114
|
isReactivatedEntrance,
|
|
1092
1115
|
onMotionCompleteRef,
|
|
1093
|
-
|
|
1116
|
+
onScrimFadeRef,
|
|
1094
1117
|
]);
|
|
1095
1118
|
// The snap is transform-only; the layout height reconciles when it lands.
|
|
1096
1119
|
// waitForTransition — the same helper the motion states use — resolves that
|
package/src/Button/Button.tsx
CHANGED
|
@@ -322,11 +322,10 @@ const variants = stylex.create({
|
|
|
322
322
|
destructive: {
|
|
323
323
|
backgroundColor: colorVars['--color-error'],
|
|
324
324
|
color: colorVars['--color-on-error'],
|
|
325
|
-
// Forced colors replace the fill with ButtonFace;
|
|
326
|
-
// destructive fill's shape visible
|
|
327
|
-
//
|
|
328
|
-
|
|
329
|
-
borderStyle: {default: 'none', '@media (forced-colors: active)': 'solid'},
|
|
325
|
+
// Forced colors replace the fill with ButtonFace; the solid-variant edge
|
|
326
|
+
// (`forcedColorsEdge`) keeps the destructive fill's shape visible
|
|
327
|
+
// (architecture:theme-tokens INV11), in this color. A border, not an
|
|
328
|
+
// outline, leaves the shared focus ring intact.
|
|
330
329
|
borderColor: {
|
|
331
330
|
default: null,
|
|
332
331
|
'@media (forced-colors: active)': 'CanvasText',
|
|
@@ -634,6 +633,115 @@ const groupStyles = stylex.create({
|
|
|
634
633
|
},
|
|
635
634
|
});
|
|
636
635
|
|
|
636
|
+
/**
|
|
637
|
+
* A solid variant's edge in forced colors. These variants separate themselves
|
|
638
|
+
* from the page with a fill alone and have no border; forced colors discards
|
|
639
|
+
* the fill, which would leave plain text with no perceivable boundary
|
|
640
|
+
* (WCAG 1.4.11). `ButtonText` is the platform's own button edge. `ghost` is
|
|
641
|
+
* flat by design and keeps none.
|
|
642
|
+
*
|
|
643
|
+
* Outside forced colors a standalone button keeps the base's borderless
|
|
644
|
+
* values, and a grouped button's longhands are `null`, so the group's own
|
|
645
|
+
* values stay. A grouped button gets only the longhands its group does not own: the group's
|
|
646
|
+
* dividers stay where they are under both StyleX style resolutions, and the
|
|
647
|
+
* group's first and last buttons close its outer edge.
|
|
648
|
+
*/
|
|
649
|
+
const FORCED_COLORS = '@media (forced-colors: active)';
|
|
650
|
+
|
|
651
|
+
const forcedColorsEdge = stylex.create({
|
|
652
|
+
standalone: {
|
|
653
|
+
// Repeats the base's 0 and none: these keys replace the base's own.
|
|
654
|
+
borderWidth: {default: 0, [FORCED_COLORS]: '1px'},
|
|
655
|
+
borderStyle: {default: 'none', [FORCED_COLORS]: 'solid'},
|
|
656
|
+
borderColor: {default: null, [FORCED_COLORS]: 'ButtonText'},
|
|
657
|
+
},
|
|
658
|
+
groupHorizontal: {
|
|
659
|
+
borderBlockStartWidth: {default: null, [FORCED_COLORS]: '1px'},
|
|
660
|
+
borderBlockStartStyle: {default: null, [FORCED_COLORS]: 'solid'},
|
|
661
|
+
borderBlockEndWidth: {default: null, [FORCED_COLORS]: '1px'},
|
|
662
|
+
borderBlockEndStyle: {default: null, [FORCED_COLORS]: 'solid'},
|
|
663
|
+
// Repeats the group's divider and gives the first button a leading edge.
|
|
664
|
+
borderInlineStartWidth: {
|
|
665
|
+
default: borderVars['--border-width'],
|
|
666
|
+
':first-child': {default: 0, [FORCED_COLORS]: '1px'},
|
|
667
|
+
},
|
|
668
|
+
borderInlineStartStyle: {
|
|
669
|
+
default: 'solid',
|
|
670
|
+
':first-child': {default: 'none', [FORCED_COLORS]: 'solid'},
|
|
671
|
+
},
|
|
672
|
+
borderInlineEndWidth: {
|
|
673
|
+
default: null,
|
|
674
|
+
[IS_LAST_ITEM]: {default: null, [FORCED_COLORS]: '1px'},
|
|
675
|
+
},
|
|
676
|
+
borderInlineEndStyle: {
|
|
677
|
+
default: null,
|
|
678
|
+
[IS_LAST_ITEM]: {default: null, [FORCED_COLORS]: 'solid'},
|
|
679
|
+
},
|
|
680
|
+
},
|
|
681
|
+
groupVertical: {
|
|
682
|
+
borderInlineStartWidth: {default: null, [FORCED_COLORS]: '1px'},
|
|
683
|
+
borderInlineStartStyle: {default: null, [FORCED_COLORS]: 'solid'},
|
|
684
|
+
borderInlineEndWidth: {default: null, [FORCED_COLORS]: '1px'},
|
|
685
|
+
borderInlineEndStyle: {default: null, [FORCED_COLORS]: 'solid'},
|
|
686
|
+
// Repeats the group's divider and gives the first button a leading edge.
|
|
687
|
+
borderBlockStartWidth: {
|
|
688
|
+
default: borderVars['--border-width'],
|
|
689
|
+
':first-child': {default: 0, [FORCED_COLORS]: '1px'},
|
|
690
|
+
},
|
|
691
|
+
borderBlockStartStyle: {
|
|
692
|
+
default: 'solid',
|
|
693
|
+
':first-child': {default: 'none', [FORCED_COLORS]: 'solid'},
|
|
694
|
+
},
|
|
695
|
+
borderBlockEndWidth: {
|
|
696
|
+
default: null,
|
|
697
|
+
[IS_LAST_ITEM]: {default: null, [FORCED_COLORS]: '1px'},
|
|
698
|
+
},
|
|
699
|
+
borderBlockEndStyle: {
|
|
700
|
+
default: null,
|
|
701
|
+
[IS_LAST_ITEM]: {default: null, [FORCED_COLORS]: 'solid'},
|
|
702
|
+
},
|
|
703
|
+
},
|
|
704
|
+
});
|
|
705
|
+
|
|
706
|
+
// The color of a grouped button's forced-colors edge: `destructive` takes
|
|
707
|
+
// `CanvasText`, the others `ButtonText`. These are the same longhands the
|
|
708
|
+
// edge sets, so the color holds whichever order a build puts shorthands and
|
|
709
|
+
// longhands in.
|
|
710
|
+
const forcedColorsEdgeColor = stylex.create({
|
|
711
|
+
horizontal: {
|
|
712
|
+
borderBlockStartColor: {default: null, [FORCED_COLORS]: 'ButtonText'},
|
|
713
|
+
borderBlockEndColor: {default: null, [FORCED_COLORS]: 'ButtonText'},
|
|
714
|
+
borderInlineEndColor: {
|
|
715
|
+
default: null,
|
|
716
|
+
[IS_LAST_ITEM]: {default: null, [FORCED_COLORS]: 'ButtonText'},
|
|
717
|
+
},
|
|
718
|
+
},
|
|
719
|
+
horizontalOnError: {
|
|
720
|
+
borderBlockStartColor: {default: null, [FORCED_COLORS]: 'CanvasText'},
|
|
721
|
+
borderBlockEndColor: {default: null, [FORCED_COLORS]: 'CanvasText'},
|
|
722
|
+
borderInlineEndColor: {
|
|
723
|
+
default: null,
|
|
724
|
+
[IS_LAST_ITEM]: {default: null, [FORCED_COLORS]: 'CanvasText'},
|
|
725
|
+
},
|
|
726
|
+
},
|
|
727
|
+
vertical: {
|
|
728
|
+
borderInlineStartColor: {default: null, [FORCED_COLORS]: 'ButtonText'},
|
|
729
|
+
borderInlineEndColor: {default: null, [FORCED_COLORS]: 'ButtonText'},
|
|
730
|
+
borderBlockEndColor: {
|
|
731
|
+
default: null,
|
|
732
|
+
[IS_LAST_ITEM]: {default: null, [FORCED_COLORS]: 'ButtonText'},
|
|
733
|
+
},
|
|
734
|
+
},
|
|
735
|
+
verticalOnError: {
|
|
736
|
+
borderInlineStartColor: {default: null, [FORCED_COLORS]: 'CanvasText'},
|
|
737
|
+
borderInlineEndColor: {default: null, [FORCED_COLORS]: 'CanvasText'},
|
|
738
|
+
borderBlockEndColor: {
|
|
739
|
+
default: null,
|
|
740
|
+
[IS_LAST_ITEM]: {default: null, [FORCED_COLORS]: 'CanvasText'},
|
|
741
|
+
},
|
|
742
|
+
},
|
|
743
|
+
});
|
|
744
|
+
|
|
637
745
|
/**
|
|
638
746
|
* Whether `node` adds nothing to a content name: nothing renders, or an Icon
|
|
639
747
|
* with no label. Any other node can add text.
|
|
@@ -705,6 +813,10 @@ export function Button({
|
|
|
705
813
|
const t = useComponentTranslator();
|
|
706
814
|
const size = useSize(sizeProp, 'md');
|
|
707
815
|
const buttonGroup = useButtonGroup();
|
|
816
|
+
const isSolidVariant =
|
|
817
|
+
variant === 'primary' ||
|
|
818
|
+
variant === 'secondary' ||
|
|
819
|
+
variant === 'destructive';
|
|
708
820
|
// A tracking group's tracker paints this button's pointer press. A menu
|
|
709
821
|
// trigger is not tracked: it keeps its own press and opening.
|
|
710
822
|
const groupPointers = use(PressGroupContext);
|
|
@@ -866,6 +978,21 @@ export function Button({
|
|
|
866
978
|
// by the ButtonGroup so the shared surface lifts as one unit.
|
|
867
979
|
!buttonGroup && elevationStyles[elevation],
|
|
868
980
|
width != null && dynamicStyles.width(width),
|
|
981
|
+
isSolidVariant &&
|
|
982
|
+
(buttonGroup == null
|
|
983
|
+
? forcedColorsEdge.standalone
|
|
984
|
+
: buttonGroup.orientation === 'horizontal'
|
|
985
|
+
? forcedColorsEdge.groupHorizontal
|
|
986
|
+
: forcedColorsEdge.groupVertical),
|
|
987
|
+
isSolidVariant &&
|
|
988
|
+
buttonGroup != null &&
|
|
989
|
+
(buttonGroup.orientation === 'horizontal'
|
|
990
|
+
? variant === 'destructive'
|
|
991
|
+
? forcedColorsEdgeColor.horizontalOnError
|
|
992
|
+
: forcedColorsEdgeColor.horizontal
|
|
993
|
+
: variant === 'destructive'
|
|
994
|
+
? forcedColorsEdgeColor.verticalOnError
|
|
995
|
+
: forcedColorsEdgeColor.vertical),
|
|
869
996
|
// AFTER the shared focus outline: the outline supplies width/style/offset
|
|
870
997
|
// for every variant, and `destructive` re-colors just the ring to match
|
|
871
998
|
// its own surface. Ordering is the mechanism — StyleX is last-wins.
|
|
@@ -278,6 +278,10 @@ const styles = stylex.create({
|
|
|
278
278
|
minHeight: `${LINE_HEIGHT_PX}px`,
|
|
279
279
|
},
|
|
280
280
|
editable: {
|
|
281
|
+
// The editable is a flex item that scrolls, so its automatic minimum
|
|
282
|
+
// height is 0. An empty one can then lay out at 0px after a restyle,
|
|
283
|
+
// and a click on the input no longer reaches it.
|
|
284
|
+
minHeight: `${LINE_HEIGHT_PX}px`,
|
|
281
285
|
outline: 'none',
|
|
282
286
|
whiteSpace: 'pre-wrap',
|
|
283
287
|
wordBreak: 'break-word',
|
|
@@ -162,6 +162,19 @@ const styles = stylex.create({
|
|
|
162
162
|
borderRadius: 'var(--_dropdown-menu-radius)',
|
|
163
163
|
backgroundColor: colorVars['--color-background-popover'],
|
|
164
164
|
boxShadow: shadowVars['--shadow-low'],
|
|
165
|
+
// Forced colors removes box-shadow, which is this surface's only edge.
|
|
166
|
+
borderWidth: {
|
|
167
|
+
default: null,
|
|
168
|
+
'@media (forced-colors: active)': '1px',
|
|
169
|
+
},
|
|
170
|
+
borderStyle: {
|
|
171
|
+
default: null,
|
|
172
|
+
'@media (forced-colors: active)': 'solid',
|
|
173
|
+
},
|
|
174
|
+
borderColor: {
|
|
175
|
+
default: null,
|
|
176
|
+
'@media (forced-colors: active)': 'CanvasText',
|
|
177
|
+
},
|
|
165
178
|
opacity: 1,
|
|
166
179
|
transitionProperty: 'opacity',
|
|
167
180
|
transitionDuration: durationVars['--duration-fast'],
|
|
@@ -123,6 +123,14 @@ export const docs = {
|
|
|
123
123
|
description:
|
|
124
124
|
"Called each time the field's rejection of typed text changes, and with null when the rejection ends. kind is 'unreadable', 'incomplete' (part of a date that Enter or blur cannot finish), 'nonexistent' (a date the calendar does not have), 'outOfRange' (before min or after max), or 'unavailable' (a day dateConstraints rules out); text is the typed text; date is the Gregorian ISO date the text names, for 'outOfRange' and 'unavailable'. It also runs when a new min, max, dateConstraints, or value, a calendar pick, disabling the field, or Enter or blur changes the rejection, and never twice for the same rejection; it reports null when the typed field leaves while its rejection stands, as when a presentation or pointer change shows the native or touch picker. With it, an error status with a message replaces the field's own message, and a rejection that starts under an unchanged error message announces that message once. The native and touch pickers take no typed text, so it never reports a rejection there.",
|
|
125
125
|
},
|
|
126
|
+
{
|
|
127
|
+
name: 'entryErrorBehavior',
|
|
128
|
+
type: "'complete' | 'blur-or-enter'",
|
|
129
|
+
description:
|
|
130
|
+
"When the field shows its own entry error: a typed date it rejects, as onEntryErrorChange reports it. It sets when the error shows, not when validation runs, so it is not React Aria's validationBehavior (native versus ARIA validation), and it never changes a caller status. 'complete' shows a date the calendar does not have, or one outside min, max, or dateConstraints, as soon as the typed date is complete, and unreadable or unfinished text at Enter or blur. 'blur-or-enter' holds every rejection until Enter or blur: the message, aria-invalid, the invalid styling, the announcement, and the onEntryErrorChange report then appear together. Under both values, an edit that makes the text a date or empties it clears the error at once; under 'blur-or-enter', an edit that leaves the text wrong keeps the shown error until the next Enter or blur. A date the native control refuses shows at Enter or blur under both values. The field's own value wins over the nearest FormLayout's defaultEntryErrorBehavior.",
|
|
131
|
+
default:
|
|
132
|
+
"the nearest FormLayout's defaultEntryErrorBehavior, else 'complete'",
|
|
133
|
+
},
|
|
126
134
|
{
|
|
127
135
|
name: 'statusVariant',
|
|
128
136
|
type: "'attached' | 'detached' | 'tooltip'",
|
|
@@ -508,6 +516,14 @@ export const docsZh = {
|
|
|
508
516
|
description:
|
|
509
517
|
"每当字段对输入文本的拒绝发生变化时调用,拒绝结束时传入 null。kind 为 'unreadable'、'incomplete'(按 Enter 或失焦也无法补全的部分日期)、'nonexistent'(该日历中不存在的日期)、'outOfRange'(早于 min 或晚于 max)或 'unavailable'(被 dateConstraints 排除的日期);text 为输入的文本;date 为文本所指的公历 ISO 日期,用于 'outOfRange' 和 'unavailable'。新的 min、max、dateConstraints 或 value、在日历中选择日期、禁用字段,或按 Enter、失焦改变拒绝时也会调用;同一拒绝不会重复调用;拒绝仍存在时若输入字段被替换(例如展示方式或指针类型改变而显示原生或触控选择器),会传入 null。传入此回调后,带消息的 error 状态会替代字段自身的错误消息;若拒绝开始时该错误消息未变,字段会再播报一次该消息。原生和触控选择器不接受输入文本,因此不会报告拒绝。",
|
|
510
518
|
},
|
|
519
|
+
{
|
|
520
|
+
name: 'entryErrorBehavior',
|
|
521
|
+
type: "'complete' | 'blur-or-enter'",
|
|
522
|
+
description:
|
|
523
|
+
"字段何时显示自身的输入错误:即字段拒绝的输入日期,也就是 onEntryErrorChange 报告的拒绝。它设定错误何时显示,而不是何时校验,因此不同于 React Aria 的 validationBehavior(原生校验与 ARIA 校验之分),也不会改变调用方的 status。'complete' 在输入的日期完整后立即显示日历中不存在的日期,或超出 min、max 或 dateConstraints 的日期;无法识别或未完成的文本在按 Enter 或失焦时显示。'blur-or-enter' 将每个拒绝保留到按 Enter 或失焦:届时消息、aria-invalid、无效样式、播报和 onEntryErrorChange 报告一起出现。两种取值下,使文本成为有效日期或清空文本的编辑都会立即清除错误;在 'blur-or-enter' 下,文本仍然错误的编辑会保留已显示的错误,直到下一次按 Enter 或失焦。原生控件拒绝的日期在两种取值下都在按 Enter 或失焦时显示。字段自身的取值优先于最近的 FormLayout 的 defaultEntryErrorBehavior。",
|
|
524
|
+
default:
|
|
525
|
+
"最近的 FormLayout 的 defaultEntryErrorBehavior,否则为 'complete'",
|
|
526
|
+
},
|
|
511
527
|
{
|
|
512
528
|
name: 'statusVariant',
|
|
513
529
|
type: "'attached' | 'detached' | 'tooltip'",
|
|
@@ -710,6 +726,8 @@ export const docsDense = {
|
|
|
710
726
|
'error/warning/success status w/ message; a rejected date (typed or native) or kept unreadable/unfinished text shows its own error instead, unless onEntryErrorChange is set and status is an error w/ message',
|
|
711
727
|
onEntryErrorChange:
|
|
712
728
|
"(error|null) on each typed-rejection change: kind 'unreadable'|'incomplete'|'nonexistent'|'outOfRange' (min/max)|'unavailable' (dateConstraints), text, date (Gregorian ISO, outOfRange/unavailable); also on new min/max/dateConstraints/value, calendar pick, disable, Enter/blur; never twice for one rejection; null when the typed field leaves mid-rejection (presentation/pointer switch); with it an error status w/ message replaces the field's own message, re-announced once if unchanged when a rejection starts; never a rejection on native/touch pickers",
|
|
729
|
+
entryErrorBehavior:
|
|
730
|
+
"'complete'|'blur-or-enter': when the field's own rejection shows (not when validation runs; not React Aria validationBehavior; never changes status). complete: nonexistent/out-of-range date as soon as complete, unreadable/unfinished at Enter/blur. blur-or-enter: message, aria-invalid, styling, announcement and onEntryErrorChange report all wait for Enter/blur. Valid or emptied text clears at once; still-wrong edit keeps a shown error (blur-or-enter). Native refusals wait for Enter/blur under both. Default: nearest FormLayout defaultEntryErrorBehavior, else complete",
|
|
713
731
|
statusVariant:
|
|
714
732
|
'How status message is placed: attached overlaps below input; detached floats below w/ spacing; tooltip hides the box and shows it on the status icon.',
|
|
715
733
|
labelTooltip: 'tooltip text via info icon at label end',
|