@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
|
@@ -1 +1 @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KAAK,IAAI,CAAC;IAChD,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,IAAI,CACjB,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,mBAAmB,GAAG,UAAU,GAAG,cAAc,CACxD,CAAC;CACH,CAAC;AAEF,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,EAChC,EAAE,EACF,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,WAAW,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAoB,EACpB,GAAG,EACH,GAAG,EACH,UAAU,EACV,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,MAAM,EACN,UAAU,EACV,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,EAAE,sBAAsB,+
|
|
1
|
+
{"version":3,"file":"NativeTimeSegment.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/NativeTimeSegment.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAM9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,UAAU,CAAC;AAoBlB,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,KAAK,IAAI,CAAC;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,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
|
ariaDescribedBy,
|
|
68
68
|
isRejected,
|
|
69
69
|
onRejectedChange,
|
|
70
|
+
onCommit,
|
|
70
71
|
alertMessage,
|
|
71
72
|
controlProps
|
|
72
73
|
}) {
|
|
73
74
|
const {
|
|
74
75
|
onFocus: onFocusProp,
|
|
75
76
|
onBlur: onBlurProp,
|
|
77
|
+
onKeyDown: onKeyDownProp,
|
|
76
78
|
...inputProps
|
|
77
79
|
} = controlProps ?? {};
|
|
78
80
|
const locale = useLocale();
|
|
@@ -191,7 +193,13 @@ export function NativeTimeSegment({
|
|
|
191
193
|
commitValue(domValue);
|
|
192
194
|
}
|
|
193
195
|
lastCommitRef.current = null;
|
|
194
|
-
|
|
196
|
+
onCommit();
|
|
197
|
+
}, [commitValue, nativeValue, isRejected, onCommit]);
|
|
198
|
+
const handleKeyDown = useCallback(e => {
|
|
199
|
+
if (e.key === 'Enter') {
|
|
200
|
+
onCommit();
|
|
201
|
+
}
|
|
202
|
+
}, [onCommit]);
|
|
195
203
|
const openPicker = useCallback(() => {
|
|
196
204
|
if (isEffectivelyDisabled) {
|
|
197
205
|
return;
|
|
@@ -237,6 +245,7 @@ export function NativeTimeSegment({
|
|
|
237
245
|
onChange: handleChange,
|
|
238
246
|
onFocus: chainEventHandlers(handleFocus, onFocusProp),
|
|
239
247
|
onBlur: chainEventHandlers(handleBlur, onBlurProp),
|
|
248
|
+
onKeyDown: chainEventHandlers(handleKeyDown, onKeyDownProp),
|
|
240
249
|
min: min,
|
|
241
250
|
max: max,
|
|
242
251
|
step: 60,
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* @position Package entry point for DateTimeInput
|
|
6
6
|
*/
|
|
7
7
|
export { DateTimeInput } from './DateTimeInput.js';
|
|
8
|
-
export type { DateTimeInputProps, DateTimeInputSize, DateTimeInputHourFormat, DateTimeInputNativePicker, DateTimeInputPresentation, DateTimeInputTimeIncrement, DateTimeInputTimeOptionInterval, DateTimeInputStatus, DateTimeInputStatusType, DateInputEntryError, ISODateTimeString, } from './DateTimeInput.js';
|
|
8
|
+
export type { DateTimeInputProps, DateTimeInputSize, DateTimeInputHourFormat, DateTimeInputNativePicker, DateTimeInputPresentation, DateTimeInputTimeIncrement, DateTimeInputTimeOptionInterval, DateTimeInputStatus, DateTimeInputStatusType, DateInputEntryError, EntryErrorBehavior, ISODateTimeString, } from './DateTimeInput.js';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KA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H,wBAAgB,MAAM,CAAC,EACrB,MAAM,EAAE,UAAU,EAClB,QAAgB,EAChB,YAAY,EACZ,KAAW,EACX,SAAmB,EACnB,QAAQ,EACR,OAAoB,EACpB,OAAgB,EAChB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,sCAmcb;yBAnde,MAAM"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -210,12 +210,13 @@ const styles = {
|
|
|
210
210
|
},
|
|
211
211
|
inlineWrapper: {
|
|
212
212
|
kmVPX3: "x1717udv",
|
|
213
|
-
kMzoRj: "xc342km",
|
|
214
|
-
ksu8eU: "xng3xce",
|
|
215
213
|
kWkggS: "x10xzikg",
|
|
216
214
|
"--_dialog-radius": "xvuvksw",
|
|
217
215
|
kaIpWk: "xuacgfc",
|
|
218
216
|
kGVxlE: "x1kcpxr7",
|
|
217
|
+
kMzoRj: "xc342km x13rsnn2",
|
|
218
|
+
ksu8eU: "xng3xce xx61lck",
|
|
219
|
+
kVAM5u: "x1w1tqly",
|
|
219
220
|
k1xSpc: "x78zum5",
|
|
220
221
|
kXwgrk: "xdt5ytf",
|
|
221
222
|
kZKoxP: "xg7h5cd",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuSubMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuSubMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AA0C5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"DropdownMenuSubMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/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,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,wBAAyB,SAAQ,4BAA4B;IAC5E;;;;;;;;OAQG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AA6CD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,GAC9B,SAAS,CAs5BX;yBAx5Be,mBAAmB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type EntryErrorBehavior } from '../FormLayout/FormLayoutContext.js';
|
|
2
|
+
/**
|
|
3
|
+
* The entry error behavior of a field: its own prop, else the nearest
|
|
4
|
+
* FormLayout's default, else `'complete'`. A layer starts a new FormLayout
|
|
5
|
+
* scope, so a field in a Dialog opened from a form takes no default from it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useEntryErrorBehavior(entryErrorBehavior: EntryErrorBehavior | undefined): EntryErrorBehavior;
|
|
8
|
+
//# sourceMappingURL=useEntryErrorBehavior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntryErrorBehavior.d.ts","sourceRoot":"","sources":["../../src/Field/useEntryErrorBehavior.ts"],"names":[],"mappings":"AAkBA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AAEzC;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,GACjD,kBAAkB,CAGpB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useEntryErrorBehavior.ts
|
|
7
|
+
* @input A field's own entryErrorBehavior and the nearest FormLayout's
|
|
8
|
+
* defaultEntryErrorBehavior
|
|
9
|
+
* @output The entry error behavior that the field follows
|
|
10
|
+
* @position Shared internal hook of the input-field family; used by DateInput,
|
|
11
|
+
* DateTimeInput, and TimeInput
|
|
12
|
+
*
|
|
13
|
+
* SYNC: When modified, update:
|
|
14
|
+
* - /packages/core/src/FormLayout/FormLayoutContext.ts (EntryErrorBehavior)
|
|
15
|
+
* - /packages/core/src/FormLayout/FormLayout.test.tsx (precedence tests)
|
|
16
|
+
*/
|
|
17
|
+
import { use } from 'react';
|
|
18
|
+
import { FormLayoutContext } from "../FormLayout/FormLayoutContext.js";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The entry error behavior of a field: its own prop, else the nearest
|
|
22
|
+
* FormLayout's default, else `'complete'`. A layer starts a new FormLayout
|
|
23
|
+
* scope, so a field in a Dialog opened from a form takes no default from it.
|
|
24
|
+
*/
|
|
25
|
+
export function useEntryErrorBehavior(entryErrorBehavior) {
|
|
26
|
+
const {
|
|
27
|
+
defaultEntryErrorBehavior
|
|
28
|
+
} = use(FormLayoutContext);
|
|
29
|
+
return entryErrorBehavior ?? defaultEntryErrorBehavior ?? 'complete';
|
|
30
|
+
}
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
* - /packages/core/src/FormLayout/FormLayout.doc.mjs (props table)
|
|
11
11
|
* - /packages/core/src/FormLayout/index.ts (exports if types change)
|
|
12
12
|
* - /packages/core/src/Field/FieldLabel.tsx (defaultOptionality indicator resolution)
|
|
13
|
+
* - /packages/core/src/Field/useEntryErrorBehavior.ts (defaultEntryErrorBehavior resolution)
|
|
13
14
|
* - /apps/storybook/stories/FormLayout.stories.tsx (storybook stories)
|
|
14
15
|
* - /packages/cli/assets/templates/blocks/components/FormLayout/ (showcase blocks)
|
|
15
16
|
*/
|
|
16
17
|
import { type ReactNode } from 'react';
|
|
17
18
|
import type { BaseProps } from '../BaseProps.js';
|
|
18
|
-
import { type FormLayoutDirection, type FormOptionality } from './FormLayoutContext.js';
|
|
19
|
+
import { type EntryErrorBehavior, type FormLayoutDirection, type FormOptionality } from './FormLayoutContext.js';
|
|
19
20
|
export interface FormLayoutProps extends BaseProps<HTMLDivElement> {
|
|
20
21
|
/** Ref forwarded to the root element */
|
|
21
22
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -60,6 +61,24 @@ export interface FormLayoutProps extends BaseProps<HTMLDivElement> {
|
|
|
60
61
|
* `'optional'`) shows nothing. An inner `FormLayout` shadows an outer one.
|
|
61
62
|
*/
|
|
62
63
|
defaultOptionality?: FormOptionality;
|
|
64
|
+
/**
|
|
65
|
+
* When DateInput, DateTimeInput, TimeInput, and NumberInput fields in this
|
|
66
|
+
* layout show their own entry errors: a date, time, or number that the
|
|
67
|
+
* field rejects. It sets when the error shows, not when validation runs, so
|
|
68
|
+
* it is not React Aria's `validationBehavior` (native versus ARIA
|
|
69
|
+
* validation). It does not change a caller's `status`.
|
|
70
|
+
*
|
|
71
|
+
* - `'complete'` — each field shows the error at its own moment.
|
|
72
|
+
* - `'blur-or-enter'` — each field holds every sign of the error until the
|
|
73
|
+
* person presses Enter or leaves the field.
|
|
74
|
+
* - unset — the same as `'complete'`.
|
|
75
|
+
*
|
|
76
|
+
* NumberInput shows its errors only at Enter or blur under both values.
|
|
77
|
+
* A field's own `entryErrorBehavior` wins. An inner `FormLayout` replaces
|
|
78
|
+
* the default for its fields, and unset there means `'complete'`. Content
|
|
79
|
+
* in a layer, such as a Dialog opened from the form, starts without it.
|
|
80
|
+
*/
|
|
81
|
+
defaultEntryErrorBehavior?: EntryErrorBehavior;
|
|
63
82
|
}
|
|
64
83
|
/**
|
|
65
84
|
* Spatial layout container for form fields.
|
|
@@ -79,7 +98,7 @@ export interface FormLayoutProps extends BaseProps<HTMLDivElement> {
|
|
|
79
98
|
* </FormLayout>
|
|
80
99
|
* ```
|
|
81
100
|
*/
|
|
82
|
-
export declare function FormLayout({ children, direction, defaultOptionality, xstyle, className, style, ref, ...props }: FormLayoutProps): import("react").JSX.Element;
|
|
101
|
+
export declare function FormLayout({ children, direction, defaultOptionality, defaultEntryErrorBehavior, xstyle, className, style, ref, ...props }: FormLayoutProps): import("react").JSX.Element;
|
|
83
102
|
export declare namespace FormLayout {
|
|
84
103
|
var displayName: string;
|
|
85
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayout.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayout.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"FormLayout.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayout.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AA2C7B,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAEhC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC;IAErC;;;;;;;;;;;;;;;;OAgBG;IACH,yBAAyB,CAAC,EAAE,kBAAkB,CAAC;CAChD;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,eAAe,+BA0BjB;yBApCe,UAAU"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* - /packages/core/src/FormLayout/FormLayout.doc.mjs (props table)
|
|
15
15
|
* - /packages/core/src/FormLayout/index.ts (exports if types change)
|
|
16
16
|
* - /packages/core/src/Field/FieldLabel.tsx (defaultOptionality indicator resolution)
|
|
17
|
+
* - /packages/core/src/Field/useEntryErrorBehavior.ts (defaultEntryErrorBehavior resolution)
|
|
17
18
|
* - /apps/storybook/stories/FormLayout.stories.tsx (storybook stories)
|
|
18
19
|
* - /packages/cli/assets/templates/blocks/components/FormLayout/ (showcase blocks)
|
|
19
20
|
*/
|
|
@@ -91,6 +92,7 @@ export function FormLayout({
|
|
|
91
92
|
children,
|
|
92
93
|
direction = 'vertical',
|
|
93
94
|
defaultOptionality,
|
|
95
|
+
defaultEntryErrorBehavior,
|
|
94
96
|
xstyle,
|
|
95
97
|
className,
|
|
96
98
|
style,
|
|
@@ -99,8 +101,9 @@ export function FormLayout({
|
|
|
99
101
|
}) {
|
|
100
102
|
const contextValue = useMemo(() => ({
|
|
101
103
|
direction,
|
|
102
|
-
defaultOptionality
|
|
103
|
-
|
|
104
|
+
defaultOptionality,
|
|
105
|
+
defaultEntryErrorBehavior
|
|
106
|
+
}), [direction, defaultOptionality, defaultEntryErrorBehavior]);
|
|
104
107
|
return /*#__PURE__*/_jsx(FormLayoutContext, {
|
|
105
108
|
value: contextValue,
|
|
106
109
|
children: /*#__PURE__*/_jsx("div", {
|
|
@@ -17,14 +17,30 @@ export type FormLayoutDirection = 'vertical' | 'horizontal' | 'horizontal-labels
|
|
|
17
17
|
* only optional fields show an indicator.
|
|
18
18
|
*/
|
|
19
19
|
export type FormOptionality = 'optional' | 'required';
|
|
20
|
+
/**
|
|
21
|
+
* When an input that checks its own entries shows its entry error: a date,
|
|
22
|
+
* time, or number that it rejects. It sets when the error shows, not when
|
|
23
|
+
* validation runs; validation runs on every edit.
|
|
24
|
+
*
|
|
25
|
+
* - `'complete'` — the input shows the error at its own moment, as it does
|
|
26
|
+
* without the setting. DateInput shows a date the calendar does not have, or
|
|
27
|
+
* one outside its bounds, as soon as the typed date is complete.
|
|
28
|
+
* - `'blur-or-enter'` — the input holds the message, `aria-invalid`, the
|
|
29
|
+
* invalid styling, the announcement, and the `onEntryErrorChange` report
|
|
30
|
+
* until the person presses Enter or leaves the field. An edit that makes
|
|
31
|
+
* the entry valid or empty clears the error at once.
|
|
32
|
+
*/
|
|
33
|
+
export type EntryErrorBehavior = 'complete' | 'blur-or-enter';
|
|
20
34
|
/**
|
|
21
35
|
* Context for detecting which form layout a component is rendered in. Children
|
|
22
36
|
* can use this to adapt their rendering based on the parent layout — direction
|
|
23
|
-
* for spatial arrangement,
|
|
24
|
-
* indicator that merely restates the form-wide default
|
|
37
|
+
* for spatial arrangement, `defaultOptionality` so a field can suppress the
|
|
38
|
+
* indicator that merely restates the form-wide default, and
|
|
39
|
+
* `defaultEntryErrorBehavior` for inputs that set no `entryErrorBehavior`.
|
|
25
40
|
*/
|
|
26
41
|
export declare const FormLayoutContext: import("react").Context<{
|
|
27
42
|
direction: FormLayoutDirection;
|
|
28
43
|
defaultOptionality?: FormOptionality;
|
|
44
|
+
defaultEntryErrorBehavior?: EntryErrorBehavior;
|
|
29
45
|
}>;
|
|
30
46
|
//# sourceMappingURL=FormLayoutContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayoutContext.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayoutContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormLayoutContext.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayoutContext.ts"],"names":[],"mappings":"AAqBA;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAC7B,UAAU,GAAG,YAAY,GAAG,mBAAmB,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,eAAe,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;eACjB,mBAAmB;yBACT,eAAe;gCACR,kBAAkB;EACG,CAAC"}
|
|
@@ -5,12 +5,15 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file FormLayoutContext.ts
|
|
7
7
|
* @input Layer-scoped React context
|
|
8
|
-
* @output Exports FormLayoutContext, FormLayoutDirection,
|
|
9
|
-
*
|
|
8
|
+
* @output Exports FormLayoutContext, FormLayoutDirection, FormOptionality, and
|
|
9
|
+
* EntryErrorBehavior types
|
|
10
|
+
* @position Context for form layout direction, default optionality, and the
|
|
11
|
+
* default entry error behavior
|
|
10
12
|
*
|
|
11
13
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
14
|
* - /packages/core/src/FormLayout/FormLayout.tsx (prop + context value)
|
|
13
15
|
* - /packages/core/src/Field/FieldLabel.tsx (indicator resolution)
|
|
16
|
+
* - /packages/core/src/Field/useEntryErrorBehavior.ts (entry error behavior resolution)
|
|
14
17
|
* - /packages/core/src/FormLayout/index.ts (exports if types change)
|
|
15
18
|
*/
|
|
16
19
|
import { createLayerScopedContext } from "../Layer/layerScopedContext.js";
|
|
@@ -34,11 +37,26 @@ import { createLayerScopedContext } from "../Layer/layerScopedContext.js";
|
|
|
34
37
|
* only optional fields show an indicator.
|
|
35
38
|
*/
|
|
36
39
|
|
|
40
|
+
/**
|
|
41
|
+
* When an input that checks its own entries shows its entry error: a date,
|
|
42
|
+
* time, or number that it rejects. It sets when the error shows, not when
|
|
43
|
+
* validation runs; validation runs on every edit.
|
|
44
|
+
*
|
|
45
|
+
* - `'complete'` — the input shows the error at its own moment, as it does
|
|
46
|
+
* without the setting. DateInput shows a date the calendar does not have, or
|
|
47
|
+
* one outside its bounds, as soon as the typed date is complete.
|
|
48
|
+
* - `'blur-or-enter'` — the input holds the message, `aria-invalid`, the
|
|
49
|
+
* invalid styling, the announcement, and the `onEntryErrorChange` report
|
|
50
|
+
* until the person presses Enter or leaves the field. An edit that makes
|
|
51
|
+
* the entry valid or empty clears the error at once.
|
|
52
|
+
*/
|
|
53
|
+
|
|
37
54
|
/**
|
|
38
55
|
* Context for detecting which form layout a component is rendered in. Children
|
|
39
56
|
* can use this to adapt their rendering based on the parent layout — direction
|
|
40
|
-
* for spatial arrangement,
|
|
41
|
-
* indicator that merely restates the form-wide default
|
|
57
|
+
* for spatial arrangement, `defaultOptionality` so a field can suppress the
|
|
58
|
+
* indicator that merely restates the form-wide default, and
|
|
59
|
+
* `defaultEntryErrorBehavior` for inputs that set no `entryErrorBehavior`.
|
|
42
60
|
*/
|
|
43
61
|
export const FormLayoutContext = createLayerScopedContext('FormLayoutContext', 1, {
|
|
44
62
|
direction: 'vertical'
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { FormLayout } from './FormLayout.js';
|
|
10
10
|
export type { FormLayoutProps } from './FormLayout.js';
|
|
11
|
-
export type { FormLayoutDirection, FormOptionality } from './FormLayoutContext.js';
|
|
11
|
+
export type { EntryErrorBehavior, FormLayoutDirection, FormOptionality, } from './FormLayoutContext.js';
|
|
12
12
|
export { FormLayoutContext } from './FormLayoutContext.js';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormLayout/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAClD,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormLayout/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAClD,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC"}
|
|
@@ -17,6 +17,16 @@ export interface InputHoldOptions {
|
|
|
17
17
|
* while a non-modal layer presents.
|
|
18
18
|
*/
|
|
19
19
|
scope: InputHoldScope;
|
|
20
|
+
/**
|
|
21
|
+
* What a `'layer'` hold does with focus inside the layer. `'blur'` (the
|
|
22
|
+
* default) makes the content inert at once and moves focus out.
|
|
23
|
+
* `'kept-inside'` keeps the page live: no shield and no press hold, and
|
|
24
|
+
* the layer lets every pointer through. While focus stays inside, the
|
|
25
|
+
* content stays exposed, and no click and no key but Tab reaches it. When
|
|
26
|
+
* focus leaves, or when it was not inside, the layer itself becomes
|
|
27
|
+
* `inert` and `aria-hidden` until the hold ends.
|
|
28
|
+
*/
|
|
29
|
+
focus?: 'blur' | 'kept-inside';
|
|
20
30
|
}
|
|
21
31
|
/**
|
|
22
32
|
* Whether `node` is the shield of a live hold. A hit test that must see past
|
|
@@ -45,5 +55,5 @@ export declare function holdsTouch(target: Node): boolean;
|
|
|
45
55
|
* own pointer, never by the primary pointer. So a mouse on a touch screen
|
|
46
56
|
* keeps its clicks during a presentation.
|
|
47
57
|
*/
|
|
48
|
-
export declare function holdInput(layer: Element, { until, scope }: InputHoldOptions): () => void;
|
|
58
|
+
export declare function holdInput(layer: Element, { until, scope, focus }: InputHoldOptions): () => void;
|
|
49
59
|
//# sourceMappingURL=inputHold.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputHold.d.ts","sourceRoot":"","sources":["../../src/Layer/inputHold.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inputHold.d.ts","sourceRoot":"","sources":["../../src/Layer/inputHold.ts"],"names":[],"mappings":"AAkCA;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9D,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GACtB,WAAW,CAAC,OAAO,CAAC,GAAG;IAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAAC,CAAC;AAEnE,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,KAAK,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAqDD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,CAExD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,CAW1D;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAyBhD;AAuPD;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,OAAO,EACd,EAAC,KAAK,EAAE,KAAK,EAAE,KAAc,EAAC,EAAE,gBAAgB,GAC/C,MAAM,IAAI,CAyFZ"}
|
package/dist/Layer/inputHold.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* @input A layer root, what ends its hold (a promise or an animator handle),
|
|
8
8
|
* and the hold's scope
|
|
9
9
|
* @output holdInput, holdsTouch, isInHeldLayer and isInputShield: input held
|
|
10
|
-
* away from a layer while it presents or dismisses
|
|
10
|
+
* away from a layer while it presents or dismisses, or while it dismisses
|
|
11
|
+
* with focus kept inside
|
|
11
12
|
* @position The Layer module's one input hold, for components whose layer
|
|
12
13
|
* presents under a finger
|
|
13
14
|
*
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
import { containsAlongFlatTree, deepActiveElement, parentAcrossShadow } from "../utils/flatTree.js";
|
|
18
19
|
import { getDownPresses, getLastMousePoint, getLastPointerType, subscribeInput } from "../utils/inputStream.js";
|
|
19
20
|
import { isDocument, isElement, isHTMLElement, isNode } from "../utils/nodeType.js";
|
|
21
|
+
import { observeMutations } from "../utils/sharedMutationObserver.js";
|
|
20
22
|
import { realmValue, sharedKey } from "../utils/sharedRealm.js";
|
|
21
23
|
|
|
22
24
|
/**
|
|
@@ -336,8 +338,12 @@ function openToEarlierPresses(state, doc) {
|
|
|
336
338
|
*/
|
|
337
339
|
export function holdInput(layer, {
|
|
338
340
|
until,
|
|
339
|
-
scope
|
|
341
|
+
scope,
|
|
342
|
+
focus = 'blur'
|
|
340
343
|
}) {
|
|
344
|
+
if (scope === 'layer' && focus === 'kept-inside') {
|
|
345
|
+
return holdKeptInside(layer, until);
|
|
346
|
+
}
|
|
341
347
|
let state = held.get(layer);
|
|
342
348
|
if (state == null) {
|
|
343
349
|
state = {
|
|
@@ -419,6 +425,112 @@ export function holdInput(layer, {
|
|
|
419
425
|
void Promise.resolve(end).then(release, release);
|
|
420
426
|
return release;
|
|
421
427
|
}
|
|
428
|
+
|
|
429
|
+
/** The keys a dismissing layer that keeps focus lets through. */
|
|
430
|
+
const KEPT_INSIDE_KEYS = new Set(['Tab']);
|
|
431
|
+
|
|
432
|
+
/** The `'kept-inside'` dismissal hold (see `InputHoldOptions.focus`). */
|
|
433
|
+
function holdKeptInside(layer, until) {
|
|
434
|
+
const doc = layer.ownerDocument;
|
|
435
|
+
const style = isHTMLElement(layer) ? layer.style : null;
|
|
436
|
+
const previousPointerEvents = style?.pointerEvents ?? '';
|
|
437
|
+
if (style != null) {
|
|
438
|
+
style.pointerEvents = 'none';
|
|
439
|
+
}
|
|
440
|
+
const wasInert = layer.hasAttribute('inert');
|
|
441
|
+
const previousAriaHidden = layer.getAttribute('aria-hidden');
|
|
442
|
+
let isInert = false;
|
|
443
|
+
const stops = [];
|
|
444
|
+
const hasFocusInside = () => {
|
|
445
|
+
const focused = deepActiveElement(doc);
|
|
446
|
+
return focused != null && containsAlongFlatTree(layer, focused);
|
|
447
|
+
};
|
|
448
|
+
const stopWatching = () => {
|
|
449
|
+
for (const stop of stops.splice(0)) {
|
|
450
|
+
stop();
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
const makeInert = () => {
|
|
454
|
+
if (isInert) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
isInert = true;
|
|
458
|
+
stopWatching();
|
|
459
|
+
layer.setAttribute('inert', '');
|
|
460
|
+
layer.setAttribute('aria-hidden', 'true');
|
|
461
|
+
};
|
|
462
|
+
if (!hasFocusInside()) {
|
|
463
|
+
makeInert();
|
|
464
|
+
} else {
|
|
465
|
+
// Stopped on the document's capture phase. The interaction-modality
|
|
466
|
+
// tracker listens there from the first consumer's mount, before any hold,
|
|
467
|
+
// so it still hears the key. React's root and everything inside the layer
|
|
468
|
+
// do not, capture handlers included.
|
|
469
|
+
const isInLayer = event => {
|
|
470
|
+
const target = typeof event.composedPath === 'function' ? event.composedPath()[0] : event.target;
|
|
471
|
+
return isNode(target) && containsAlongFlatTree(layer, target);
|
|
472
|
+
};
|
|
473
|
+
const stopActivation = event => {
|
|
474
|
+
if (isInLayer(event)) {
|
|
475
|
+
event.preventDefault();
|
|
476
|
+
event.stopImmediatePropagation();
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
const stopKey = event => {
|
|
480
|
+
if (!KEPT_INSIDE_KEYS.has(event.key)) {
|
|
481
|
+
stopActivation(event);
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
const captures = [['click', stopActivation], ['keydown', stopKey], ['keyup', stopKey]];
|
|
485
|
+
for (const [type, listener] of captures) {
|
|
486
|
+
doc.addEventListener(type, listener, {
|
|
487
|
+
capture: true
|
|
488
|
+
});
|
|
489
|
+
stops.push(() => doc.removeEventListener(type, listener, {
|
|
490
|
+
capture: true
|
|
491
|
+
}));
|
|
492
|
+
}
|
|
493
|
+
const makeInertIfFocusLeft = () => {
|
|
494
|
+
if (!hasFocusInside()) {
|
|
495
|
+
makeInert();
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
// Read after the event, when focus has landed. Firefox and WebKit send no
|
|
499
|
+
// `focusout` for a removed element, so a subtree change is read too.
|
|
500
|
+
const onFocusOut = () => queueMicrotask(makeInertIfFocusLeft);
|
|
501
|
+
layer.addEventListener('focusout', onFocusOut);
|
|
502
|
+
stops.push(() => layer.removeEventListener('focusout', onFocusOut));
|
|
503
|
+
stops.push(observeMutations(layer, {
|
|
504
|
+
childList: true,
|
|
505
|
+
subtree: true,
|
|
506
|
+
attributeFilter: ['disabled', 'hidden', 'inert']
|
|
507
|
+
}, makeInertIfFocusLeft));
|
|
508
|
+
}
|
|
509
|
+
let isReleased = false;
|
|
510
|
+
const release = () => {
|
|
511
|
+
if (isReleased) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
isReleased = true;
|
|
515
|
+
stopWatching();
|
|
516
|
+
if (style != null) {
|
|
517
|
+
style.pointerEvents = previousPointerEvents;
|
|
518
|
+
}
|
|
519
|
+
if (isInert) {
|
|
520
|
+
if (!wasInert) {
|
|
521
|
+
layer.removeAttribute('inert');
|
|
522
|
+
}
|
|
523
|
+
if (previousAriaHidden == null) {
|
|
524
|
+
layer.removeAttribute('aria-hidden');
|
|
525
|
+
} else {
|
|
526
|
+
layer.setAttribute('aria-hidden', previousAriaHidden);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
const end = 'finished' in until ? until.finished : until;
|
|
531
|
+
void Promise.resolve(end).then(release, release);
|
|
532
|
+
return release;
|
|
533
|
+
}
|
|
422
534
|
const HELD_POINTERS = new Set(['touch', 'pen']);
|
|
423
535
|
|
|
424
536
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerEntranceSide.d.ts","sourceRoot":"","sources":["../../src/Layer/layerEntranceSide.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layerEntranceSide.d.ts","sourceRoot":"","sources":["../../src/Layer/layerEntranceSide.ts"],"names":[],"mappings":"AAmBA,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAChE,8DAA8D;AAC9D,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAChE,kEAAkE;AAClE,eAAO,MAAM,2BAA2B,iCAAiC,CAAC;AAC1E,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AAEpE,UAAU,GAAG;IACX,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,GAAG,GACV,iBAAiB,GAAG,IAAI,CAuD1B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,OAAO,GACd,iBAAiB,GAAG,IAAI,CAG1B;AAID;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,iBAAiB,GAAG,IAAI,GAC7B,IAAI,CAmBN"}
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
* `writeLayerEntranceSide` gives that side to the layer's entrance.
|
|
9
9
|
* @position Layer runtime: runs in the task that shows a layer, before its
|
|
10
10
|
* first frame. The entrance in layerAnimations.stylex.ts reads the custom
|
|
11
|
-
* properties it writes.
|
|
11
|
+
* properties it writes. Popover's touch growth grows from the same point.
|
|
12
12
|
*
|
|
13
13
|
* SYNC: When modified, update:
|
|
14
14
|
* - /packages/core/src/Layer/layerAnimations.stylex.ts
|
|
15
|
+
* - /packages/core/src/Popover/popoverSurfaceFrame.ts
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
import { settledBox } from "./settledBox.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lightbox.d.ts","sourceRoot":"","sources":["../../src/Lightbox/Lightbox.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAWL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Lightbox.d.ts","sourceRoot":"","sources":["../../src/Lightbox/Lightbox.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAWL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAsBf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgD5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,OAAO,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IACjE,+CAA+C;IAC/C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;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