@astryxdesign/core 0.7.5-canary.b023d1c → 0.7.5-canary.b58ca63
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/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +7 -3
- package/dist/ComplexSelector/ComplexSelector.d.ts +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +17 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +48 -13
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +12 -5
- package/dist/DateInput/NativeDateField.d.ts.map +1 -1
- package/dist/DateInput/NativeDateField.js +2 -1
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +2 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +32 -20
- package/dist/DropdownMenu/MenuBottomSheet.d.ts +11 -4
- package/dist/DropdownMenu/MenuBottomSheet.d.ts.map +1 -1
- package/dist/DropdownMenu/MenuBottomSheet.js +35 -9
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts +2 -0
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -1
- package/dist/DropdownMenu/lazyMenuBottomSheet.js +25 -3
- package/dist/DropdownMenu/menuBottomSheet.stylex.d.ts +23 -0
- package/dist/DropdownMenu/menuBottomSheet.stylex.d.ts.map +1 -0
- package/dist/DropdownMenu/menuBottomSheet.stylex.js +29 -0
- package/dist/DropdownMenu/useMenuDrillIn.d.ts.map +1 -1
- package/dist/DropdownMenu/useMenuDrillIn.js +7 -5
- package/dist/InputGroup/InputGroup.d.ts +1 -1
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +46 -36
- package/dist/InputGroup/InputGroupInternalContext.d.ts +4 -0
- package/dist/InputGroup/InputGroupInternalContext.d.ts.map +1 -0
- package/dist/InputGroup/InputGroupInternalContext.js +15 -0
- package/dist/InputGroup/InputGroupText.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupText.js +2 -0
- package/dist/InputGroup/groupStyles.d.ts +9 -0
- package/dist/InputGroup/groupStyles.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.js +28 -14
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +8 -4
- package/dist/NumberInput/NumberInput.d.ts +1 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +7 -3
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +8 -4
- package/dist/TextInput/TextInput.d.ts +1 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +8 -4
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +12 -4
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +2 -1
- package/dist/Typeahead/Typeahead.d.ts +1 -1
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +7 -3
- package/dist/astryx.css +12 -7
- package/dist/gestures/GestureArena.d.ts +175 -0
- package/dist/gestures/GestureArena.d.ts.map +1 -0
- package/dist/gestures/GestureArena.js +816 -0
- package/dist/gestures/GestureRecognizer.d.ts +239 -0
- package/dist/gestures/GestureRecognizer.d.ts.map +1 -0
- package/dist/gestures/GestureRecognizer.js +487 -0
- package/dist/gestures/types.d.ts +139 -0
- package/dist/gestures/types.d.ts.map +1 -0
- package/dist/gestures/types.js +67 -0
- package/dist/hooks/useAdaptivePresentation.d.ts +1 -1
- package/dist/hooks/useAdaptivePresentation.d.ts.map +1 -1
- package/dist/hooks/useAdaptivePresentation.js +9 -6
- package/dist/motion/decay.d.ts +41 -0
- package/dist/motion/decay.d.ts.map +1 -0
- package/dist/motion/decay.js +90 -0
- package/dist/motion/projection.d.ts +47 -0
- package/dist/motion/projection.d.ts.map +1 -0
- package/dist/motion/projection.js +116 -0
- package/dist/motion/rubberBand.d.ts +20 -0
- package/dist/motion/rubberBand.d.ts.map +1 -0
- package/dist/motion/rubberBand.js +91 -0
- package/dist/motion/spring.d.ts +193 -0
- package/dist/motion/spring.d.ts.map +1 -0
- package/dist/motion/spring.js +442 -0
- package/dist/motion/uikit/gestures.d.ts +592 -0
- package/dist/motion/uikit/gestures.d.ts.map +1 -0
- package/dist/motion/uikit/gestures.js +403 -0
- package/dist/motion/uikit/index.d.ts +23 -0
- package/dist/motion/uikit/index.d.ts.map +1 -0
- package/dist/motion/uikit/index.js +25 -0
- package/dist/motion/uikit/navigation.d.ts +71 -0
- package/dist/motion/uikit/navigation.d.ts.map +1 -0
- package/dist/motion/uikit/navigation.js +73 -0
- package/dist/motion/uikit/scroll.d.ts +124 -0
- package/dist/motion/uikit/scroll.d.ts.map +1 -0
- package/dist/motion/uikit/scroll.js +129 -0
- package/dist/motion/uikit/springs.d.ts +346 -0
- package/dist/motion/uikit/springs.d.ts.map +1 -0
- package/dist/motion/uikit/springs.js +387 -0
- package/dist/motion/uikit/timing.d.ts +209 -0
- package/dist/motion/uikit/timing.d.ts.map +1 -0
- package/dist/motion/uikit/timing.js +161 -0
- package/dist/utils/touchPresentation.d.ts +48 -0
- package/dist/utils/touchPresentation.d.ts.map +1 -0
- package/dist/utils/touchPresentation.js +133 -0
- package/package.json +3 -3
- package/src/Avatar/Avatar.spec.md +253 -0
- package/src/Avatar/AvatarStatusDot.spec.md +96 -79
- package/src/BottomSheet/BottomSheet.spec.md +256 -38
- package/src/BottomSheet/BottomSheetSwitcher.spec.md +139 -41
- package/src/Button/Button.test.tsx +1 -1
- package/src/Button/Button.tsx +15 -2
- package/src/CodeBlock/CodeBlock.spec.md +48 -45
- package/src/ComplexSelector/ComplexSelector.test.tsx +116 -1
- package/src/ComplexSelector/ComplexSelector.tsx +18 -1
- package/src/ContextMenu/ContextMenu.doc.mjs +1 -1
- package/src/ContextMenu/ContextMenu.test.tsx +189 -11
- package/src/ContextMenu/ContextMenu.tsx +75 -17
- package/src/ContextMenu/__tests__/ContextMenuLongPress.a11y.chromium.spec.ts +117 -0
- package/src/DateInput/DateInput.tsx +9 -4
- package/src/DateInput/NativeDateField.tsx +2 -1
- package/src/DateInput/TouchDateField.tsx +2 -1
- package/src/DropdownMenu/DropdownMenu.test.tsx +37 -4
- package/src/DropdownMenu/DropdownMenu.tsx +47 -21
- package/src/DropdownMenu/DropdownMenuSheetFirstOpen.test.tsx +72 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +57 -0
- package/src/DropdownMenu/MenuBottomSheet.tsx +42 -7
- package/src/DropdownMenu/lazyMenuBottomSheet.ts +28 -2
- package/src/DropdownMenu/menuBottomSheet.stylex.ts +33 -0
- package/src/DropdownMenu/modules/useMenuPress.spec.md +54 -30
- package/src/DropdownMenu/useMenuDrillIn.tsx +7 -5
- package/src/InputGroup/InputGroup.test.tsx +120 -0
- package/src/InputGroup/InputGroup.tsx +59 -52
- package/src/InputGroup/InputGroupInternalContext.ts +15 -0
- package/src/InputGroup/InputGroupText.tsx +2 -0
- package/src/InputGroup/groupStyles.ts +22 -11
- package/src/Markdown/Markdown.spec.md +56 -51
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -2
- package/src/MultiSelector/MultiSelector.test.tsx +3 -2
- package/src/MultiSelector/MultiSelector.tsx +8 -3
- package/src/NumberInput/NumberInput.tsx +7 -2
- package/src/Popover/Popover.spec.md +17 -0
- package/src/Selector/Selector.test.tsx +3 -2
- package/src/Selector/Selector.tsx +8 -3
- package/src/SideNav/SideNav.spec.md +5 -3
- package/src/SideNav/SideNavCollapseButton.spec.md +161 -0
- package/src/SideNav/SideNavHeading.spec.md +219 -0
- package/src/SideNav/SideNavItem.spec.md +246 -0
- package/src/SideNav/SideNavSection.spec.md +153 -0
- package/src/TextInput/TextInput.tsx +8 -3
- package/src/TimeInput/TimeInput.tsx +12 -4
- package/src/TimeInput/TouchTimeField.tsx +2 -1
- package/src/ToggleButton/ToggleButton.spec.md +256 -0
- package/src/ToggleButton/ToggleButtonGroup.spec.md +194 -0
- package/src/TopNav/TopNavItem.spec.md +31 -23
- package/src/Typeahead/Typeahead.tsx +7 -2
- package/src/gestures/GestureArena.ts +966 -0
- package/src/gestures/GestureRecognizer.ts +626 -0
- package/src/gestures/__tests__/arena.test.ts +824 -0
- package/src/gestures/__tests__/harness.ts +204 -0
- package/src/gestures/types.ts +161 -0
- package/src/hooks/__tests__/MenuPressShadowRoot.a11y.chromium.spec.ts +97 -4
- package/src/hooks/useAdaptivePresentation.ts +14 -7
- package/src/motion/MEASUREMENTS.md +268 -0
- package/src/motion/README.md +105 -0
- package/src/motion/decay.test.ts +120 -0
- package/src/motion/decay.ts +126 -0
- package/src/motion/projection.test.ts +139 -0
- package/src/motion/projection.ts +148 -0
- package/src/motion/rubberBand.test.ts +88 -0
- package/src/motion/rubberBand.ts +115 -0
- package/src/motion/spring.test.ts +650 -0
- package/src/motion/spring.ts +551 -0
- package/src/motion/uikit/gestures.test.ts +89 -0
- package/src/motion/uikit/gestures.ts +340 -0
- package/src/motion/uikit/index.ts +43 -0
- package/src/motion/uikit/navigation.ts +73 -0
- package/src/motion/uikit/scroll.ts +124 -0
- package/src/motion/uikit/springs.ts +330 -0
- package/src/motion/uikit/timing.ts +162 -0
- package/src/motion/uikit/uikit.test.ts +301 -0
- package/src/motion/uikit/values.test.ts +110 -0
- package/src/utils/touchPresentation.test.ts +323 -0
- package/src/utils/touchPresentation.ts +153 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO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GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,SAAS,CAqTzB;yBA9Ue,MAAM"}
|
package/dist/Button/Button.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Last synced props: label, variant, size, isDisabled, isLoading, isInterruptible, clickAction, icon, isIconOnly, width, children, tooltip, endContent, href, as, target, rel
|
|
19
19
|
*/
|
|
20
|
-
import { useEffect, useRef, useState, useTransition } from 'react';
|
|
20
|
+
import { use, useEffect, useRef, useState, useTransition } from 'react';
|
|
21
21
|
import * as stylex from '@stylexjs/stylex';
|
|
22
22
|
import { useTooltip } from "../Tooltip/useTooltip.js";
|
|
23
23
|
import "../theme/tokens.stylex.js";
|
|
@@ -30,7 +30,8 @@ import { EDGE_COMP_ATTR } from "../Layout/edgeCompensation.stylex.js";
|
|
|
30
30
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
31
31
|
import { useButtonGroup } from "../ButtonGroup/ButtonGroupContext.js";
|
|
32
32
|
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
33
|
-
import {
|
|
33
|
+
import { InputGroupInternalContext } from "../InputGroup/InputGroupInternalContext.js";
|
|
34
|
+
import { groupStyles as inputGroupStyles, inputGroupItemProps } from "../InputGroup/groupStyles.js";
|
|
34
35
|
import { mergeProps } from "../utils/index.js";
|
|
35
36
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
36
37
|
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
@@ -377,7 +378,8 @@ export function Button({
|
|
|
377
378
|
// the consumer is deliberately showing it.
|
|
378
379
|
const delaySpinner = isPending || isInterruptible;
|
|
379
380
|
const groupDisabled = buttonGroup?.isDisabled ?? false;
|
|
380
|
-
const
|
|
381
|
+
const inputGroupState = use(InputGroupInternalContext);
|
|
382
|
+
const isTrueDisabled = isDisabled || groupDisabled || inputGroupState.isDisabled;
|
|
381
383
|
// Busy-only: the button can't fire again purely because an action is in
|
|
382
384
|
// flight, not because it's genuinely isDisabled/group-disabled. Per the API
|
|
383
385
|
// Conventions "Disabled vs Busy" rule, busy is visual-only (aria-busy +
|
|
@@ -549,6 +551,7 @@ export function Button({
|
|
|
549
551
|
href: href,
|
|
550
552
|
target: target,
|
|
551
553
|
rel: rel,
|
|
554
|
+
...(inputGroup != null && buttonGroup == null ? inputGroupItemProps : undefined),
|
|
552
555
|
...sharedMergedProps,
|
|
553
556
|
...pressFeedback,
|
|
554
557
|
...props,
|
|
@@ -570,6 +573,7 @@ export function Button({
|
|
|
570
573
|
ref: mergedButtonRef,
|
|
571
574
|
type: type,
|
|
572
575
|
disabled: useAriaDisabled ? undefined : buttonDisabled,
|
|
576
|
+
...(inputGroup != null && buttonGroup == null ? inputGroupItemProps : undefined),
|
|
573
577
|
...sharedMergedProps,
|
|
574
578
|
...pressFeedback,
|
|
575
579
|
...props,
|
|
@@ -136,7 +136,7 @@ export interface ComplexSelectorProps<Value> extends Omit<FieldInputBaseProps, '
|
|
|
136
136
|
isOptional?: boolean;
|
|
137
137
|
/** Marks the field required. */
|
|
138
138
|
isRequired?: boolean;
|
|
139
|
-
/**
|
|
139
|
+
/** Blocks opening and value commits, including from an already-open popup. */
|
|
140
140
|
isDisabled?: boolean;
|
|
141
141
|
/** Shows loading state on the trigger. */
|
|
142
142
|
isLoading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComplexSelector.d.ts","sourceRoot":"","sources":["../../src/ComplexSelector/ComplexSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ComplexSelector.d.ts","sourceRoot":"","sources":["../../src/ComplexSelector/ComplexSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAQZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAA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G,CAAC,qBAAqB,CAAC,CAAC;IAC7C;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,iCAAiC,KAAK,SAAS,CAAC;IACxE;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,qDAAqD;IACrD,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,EACrC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,WAAW,EAAE,oBAAoB,EACjC,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,SAAiB,EACjB,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,IAAW,EACX,OAAiB,EACjB,SAAS,EACT,KAAK,EACL,SAAmB,EACnB,SAAmB,EACnB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,EAAE,EACF,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,kBAAkB,EAAE,mBAAmB,EACvC,GAAG,SAAS,EACb,EAAE,oBAAoB,CAAC,KAAK,CAAC,qBA4X7B;yBAnae,eAAe"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - /apps/storybook/stories/ComplexSelector.stories.tsx
|
|
16
16
|
* - /packages/cli/assets/templates/blocks/components/ComplexSelector/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
|
-
import React, { useCallback, useId, useImperativeHandle, useOptimistic, useRef, useTransition } from 'react';
|
|
18
|
+
import React, { useCallback, useId, useImperativeHandle, useInsertionEffect, useOptimistic, useRef, useTransition } from 'react';
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
20
|
import { useFieldInputStyling } from "../Field/fieldParts.js";
|
|
21
21
|
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
@@ -367,7 +367,23 @@ export function ComplexSelector({
|
|
|
367
367
|
},
|
|
368
368
|
isOpen: () => popover.isOpen
|
|
369
369
|
}), [isDisabled, popover]);
|
|
370
|
+
|
|
371
|
+
// The helper reads the selector's availability when it runs, not the
|
|
372
|
+
// render it came from: content may keep a helper from an earlier render
|
|
373
|
+
// (after an await, say) across a change either way. The insertion effect
|
|
374
|
+
// runs before any layout effect of the content, so a commit from the
|
|
375
|
+
// content's own layout effect in the render that changes it sees the new
|
|
376
|
+
// availability too.
|
|
377
|
+
const isDisabledRef = useRef(isDisabled);
|
|
378
|
+
useInsertionEffect(() => {
|
|
379
|
+
isDisabledRef.current = isDisabled;
|
|
380
|
+
}, [isDisabled]);
|
|
370
381
|
const commitValue = useCallback(nextValue => {
|
|
382
|
+
// Caller-owned popup controls may remain mounted after disablement.
|
|
383
|
+
// Guard the supplied commit boundary, not just the trigger.
|
|
384
|
+
if (isDisabledRef.current) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
371
387
|
onChange?.(nextValue);
|
|
372
388
|
if (changeAction) {
|
|
373
389
|
startTransition(async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../src/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KASN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../src/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;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,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,oBAAqB,SAAQ,oBAAoB;IACzD,gDAAgD;IAChD,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,UAAU,wBAAyB,SAAQ,oBAAoB;IAC7D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,+CAA+C;IAC/C,WAAW,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,wBAAwB,CAAC;AAM/E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,IAAW,EACX,KAAK,EAAE,cAAc,EACrB,UAAkB,EAClB,YAAY,EACZ,YAAwB,EACxB,SAAiB,EACjB,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,aAAa,EACb,aAAa,EAAE,iBAAiB,EAChC,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,eAAe,EAC5B,UAAU,EAAE,cAAc,EAC1B,aAAa,EAAE,iBAAiB,EAChC,aAAa,EAAE,MAAM,EACrB,GAAG,IAAI,EACR,EAAE,gBAAgB,qBA8hBlB;yBAnjBe,WAAW"}
|
|
@@ -41,7 +41,9 @@ import { Icon } from "../Icon/index.js";
|
|
|
41
41
|
import { useLayer } from "../Layer/useLayer.js";
|
|
42
42
|
import { LayerDepthProvider } from "../Layer/LayerDepthContext.js";
|
|
43
43
|
import { useLayerDismissal } from "../Layer/useLayerDismissal.js";
|
|
44
|
+
import { currentGesture } from "../Layer/gestureCounter.js";
|
|
44
45
|
import { MenuBottomSheetActionList } from "../DropdownMenu/MenuBottomSheetActionList.js";
|
|
46
|
+
import { menuBottomSheetStyles } from "../DropdownMenu/menuBottomSheet.stylex.js";
|
|
45
47
|
import { renderDropdownItems } from "../DropdownMenu/renderDropdownItems.js";
|
|
46
48
|
import { DropdownMenuContext, DropdownMenuRootOpenContext } from "../DropdownMenu/DropdownMenuContext.js";
|
|
47
49
|
import { MENU_ITEM_ROLES, MENU_ITEM_SELECTOR, MENU_BOUNDARY_SELECTOR, activateMenuItem } from "../DropdownMenu/menuItemRoles.js";
|
|
@@ -126,6 +128,16 @@ const styles = {
|
|
|
126
128
|
kfSwDN: "x87ps6o",
|
|
127
129
|
$$css: true
|
|
128
130
|
},
|
|
131
|
+
sheetMenuInset: {
|
|
132
|
+
kLKAdn: "x1132dcy",
|
|
133
|
+
kGO01o: "xy143xn",
|
|
134
|
+
kg3NbH: "x1xd259c",
|
|
135
|
+
"--container-padding-block-start": "x1hhi95j",
|
|
136
|
+
"--container-padding-block-end": "x57a7ii",
|
|
137
|
+
"--container-padding-inline-start": "x1v11cex",
|
|
138
|
+
"--container-padding-inline-end": "x58lb0f",
|
|
139
|
+
$$css: true
|
|
140
|
+
},
|
|
129
141
|
sheetRootHeading: {
|
|
130
142
|
keTefX: "x6i7dpz",
|
|
131
143
|
$$css: true
|
|
@@ -233,6 +245,11 @@ export function ContextMenu({
|
|
|
233
245
|
// Element focused before the menu opened, restored when it closes so focus
|
|
234
246
|
// does not fall to <body> after Escape or outside-click dismissal.
|
|
235
247
|
const triggerFocusRef = useRef(null);
|
|
248
|
+
// The gesture of the finger press that opened the menu (`Layer/
|
|
249
|
+
// gestureCounter`), null when a mouse or the keyboard opened it: the
|
|
250
|
+
// browser's compatibility mouse events for that same press are not presses
|
|
251
|
+
// outside.
|
|
252
|
+
const openingGestureRef = useRef(null);
|
|
236
253
|
const [isOpen, setIsOpen] = useState(false);
|
|
237
254
|
const [submenuPath, setSubmenuPath] = useState([]);
|
|
238
255
|
const currentSubmenu = submenuPath.at(-1);
|
|
@@ -322,7 +339,10 @@ export function ContextMenu({
|
|
|
322
339
|
// Dismiss on any click outside the menu. We use popover="manual" (not
|
|
323
340
|
// "auto") because the native light-dismiss treats the mouseup from the
|
|
324
341
|
// opening right-click as a dismiss event. Handling it ourselves via
|
|
325
|
-
// mousedown avoids that race.
|
|
342
|
+
// mousedown avoids that race. A touch's compatibility mousedown for the
|
|
343
|
+
// press that opened the menu (sent mid-hold by iOS, or as a long press
|
|
344
|
+
// lifts by Chromium) belongs to that press's gesture, so it is not read as
|
|
345
|
+
// a press outside; any later press is a new gesture and closes as before.
|
|
326
346
|
useEffect(() => {
|
|
327
347
|
if (!isOpen || usesBottomSheet) {
|
|
328
348
|
return;
|
|
@@ -339,6 +359,9 @@ export function ContextMenu({
|
|
|
339
359
|
return;
|
|
340
360
|
}
|
|
341
361
|
judged.add(e);
|
|
362
|
+
if (currentGesture() === openingGestureRef.current) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
342
365
|
if (menu && !menu.contains(e.target)) {
|
|
343
366
|
closeMenu();
|
|
344
367
|
}
|
|
@@ -433,6 +456,11 @@ export function ContextMenu({
|
|
|
433
456
|
// the anchor lives inside the (scrollable) trigger context.
|
|
434
457
|
const localX = isKeyboardInvoked || !rect ? 0 : e.clientX - rect.left;
|
|
435
458
|
const localY = isKeyboardInvoked || !rect ? rect?.height ?? 0 : e.clientY - rect.top;
|
|
459
|
+
// A finger's long press reaches here as a pointer `contextmenu` where
|
|
460
|
+
// the browser sends one (Chromium); its compatibility mousedown then
|
|
461
|
+
// belongs to the opening press. A mouse or the keyboard opens without
|
|
462
|
+
// one, so every later mousedown is a press outside.
|
|
463
|
+
openingGestureRef.current = e.nativeEvent.pointerType === 'touch' ? currentGesture() : null;
|
|
436
464
|
openAtLocalPoint(localX, localY, e.currentTarget);
|
|
437
465
|
}, [isDisabled, openAtLocalPoint, getAnchorBaseRect]);
|
|
438
466
|
|
|
@@ -451,6 +479,9 @@ export function ContextMenu({
|
|
|
451
479
|
disabled: isDisabled,
|
|
452
480
|
onLongPress: useCallback(point => {
|
|
453
481
|
const rect = getAnchorBaseRect();
|
|
482
|
+
// The finger is still down: the compatibility mousedown iOS sends
|
|
483
|
+
// mid-hold, or Chromium as it lifts, belongs to this press.
|
|
484
|
+
openingGestureRef.current = currentGesture();
|
|
454
485
|
openAtLocalPoint(rect ? point.x - rect.left : point.x, rect ? point.y - rect.top : point.y, triggerRef.current);
|
|
455
486
|
}, [openAtLocalPoint, getAnchorBaseRect])
|
|
456
487
|
});
|
|
@@ -514,7 +545,7 @@ export function ContextMenu({
|
|
|
514
545
|
onKeyDown: listKeyDown,
|
|
515
546
|
onContextMenu: e => e.preventDefault(),
|
|
516
547
|
...menuPress.menuProps,
|
|
517
|
-
...mergeProps(themeProps('context-menu'), stylex.props(usesBottomSheet ? styles.sheetMenu : styles.menu, !usesBottomSheet && (hasOverflow ? styles.touchPanYPinchZoom : styles.touchPinchZoom), xstyle), className, style),
|
|
548
|
+
...mergeProps(themeProps('context-menu'), stylex.props(usesBottomSheet ? [styles.sheetMenu, menuBottomSheetStyles.content, styles.sheetMenuInset] : styles.menu, !usesBottomSheet && (hasOverflow ? styles.touchPanYPinchZoom : styles.touchPinchZoom), xstyle), className, style),
|
|
518
549
|
children: /*#__PURE__*/_jsx(DropdownMenuContext, {
|
|
519
550
|
value: contextValue,
|
|
520
551
|
children: /*#__PURE__*/_jsx(DropdownMenuRootOpenContext, {
|
|
@@ -523,16 +554,26 @@ export function ContextMenu({
|
|
|
523
554
|
})
|
|
524
555
|
})
|
|
525
556
|
});
|
|
557
|
+
|
|
558
|
+
// The root view's heading stands alone; a sub-menu's sits in a row with its
|
|
559
|
+
// back button.
|
|
560
|
+
const sheetViewHeading = /*#__PURE__*/_jsx(Heading, {
|
|
561
|
+
ref: setSheetHeadingRef,
|
|
562
|
+
level: 3,
|
|
563
|
+
tabIndex: -1,
|
|
564
|
+
xstyle: [styles.sheetViewHeading, submenuPath.length === 0 && [styles.sheetRootHeading, menuBottomSheetStyles.headingAlone]],
|
|
565
|
+
children: currentTitle
|
|
566
|
+
});
|
|
526
567
|
const renderedBottomSheetContent = itemsProp !== undefined ? /*#__PURE__*/_jsxs("div", {
|
|
527
568
|
ref: listRef,
|
|
528
569
|
"data-autofocus": "",
|
|
529
570
|
tabIndex: 0,
|
|
530
|
-
...mergeProps(themeProps('context-menu'), stylex.props(styles.sheetMenu, xstyle), className, style),
|
|
531
|
-
children: [/*#__PURE__*/_jsxs("div", {
|
|
571
|
+
...mergeProps(themeProps('context-menu'), stylex.props(styles.sheetMenu, menuBottomSheetStyles.content, styles.sheetMenuInset, xstyle), className, style),
|
|
572
|
+
children: [submenuPath.length > 0 ? /*#__PURE__*/_jsxs("div", {
|
|
532
573
|
...{
|
|
533
574
|
className: "x78zum5 x1q0g3np x6s0dn4 xzye2dw x1p37lm5"
|
|
534
575
|
},
|
|
535
|
-
children: [
|
|
576
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
536
577
|
label: backLabel,
|
|
537
578
|
variant: "ghost",
|
|
538
579
|
size: "sm",
|
|
@@ -543,14 +584,8 @@ export function ContextMenu({
|
|
|
543
584
|
}),
|
|
544
585
|
isIconOnly: true,
|
|
545
586
|
onClick: () => setSubmenuPath(path => path.slice(0, -1))
|
|
546
|
-
}),
|
|
547
|
-
|
|
548
|
-
level: 3,
|
|
549
|
-
tabIndex: -1,
|
|
550
|
-
xstyle: [styles.sheetViewHeading, submenuPath.length === 0 && styles.sheetRootHeading],
|
|
551
|
-
children: currentTitle
|
|
552
|
-
})]
|
|
553
|
-
}), /*#__PURE__*/_jsx(MenuBottomSheetActionList, {
|
|
587
|
+
}), sheetViewHeading]
|
|
588
|
+
}) : sheetViewHeading, /*#__PURE__*/_jsx(MenuBottomSheetActionList, {
|
|
554
589
|
items: currentItems,
|
|
555
590
|
onSelect: handleBottomSheetSelect,
|
|
556
591
|
onOpenSubmenu: item => setSubmenuPath(path => [...path, item])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../src/DateInput/DateInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","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C;IAEvB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,MAAM,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC,CAAC;IAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAErC;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC;AA8hBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BA0B9C;yBA1Be,SAAS"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - /apps/storybook/stories/DateInput.stories.tsx (storybook stories)
|
|
16
16
|
* - /packages/cli/assets/templates/blocks/components/DateInput/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
|
-
import { useId, useState, useCallback, useRef, useOptimistic, useTransition } from 'react';
|
|
18
|
+
import { use, useId, useState, useCallback, useRef, useOptimistic, useTransition } from 'react';
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
20
|
import "../theme/tokens.stylex.js";
|
|
21
21
|
import { colorVars, sizeVars, radiusVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
@@ -23,7 +23,8 @@ import { Field, InputClearButton, inputWrapperStyles, inputStatusBorderStyles, i
|
|
|
23
23
|
import { Icon } from "../Icon/index.js";
|
|
24
24
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
25
25
|
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
26
|
-
import {
|
|
26
|
+
import { InputGroupInternalContext } from "../InputGroup/InputGroupInternalContext.js";
|
|
27
|
+
import { groupStyles, inputGroupItemProps } from "../InputGroup/groupStyles.js";
|
|
27
28
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
28
29
|
import { Spinner } from "../Spinner/index.js";
|
|
29
30
|
import { Calendar } from "../Calendar/index.js";
|
|
@@ -452,6 +453,7 @@ function PointerDateField({
|
|
|
452
453
|
// compose, so attaching unconditionally is safe.
|
|
453
454
|
disabledMessageTooltip.ref(el);
|
|
454
455
|
},
|
|
456
|
+
...(inputGroup ? inputGroupItemProps : undefined),
|
|
455
457
|
...mergeProps(themeProps('date-input', {
|
|
456
458
|
size,
|
|
457
459
|
status: status?.type ?? null,
|
|
@@ -628,6 +630,8 @@ PointerDateField.displayName = 'PointerDateField';
|
|
|
628
630
|
* ```
|
|
629
631
|
*/
|
|
630
632
|
export function DateInput(props) {
|
|
633
|
+
const inputGroupState = use(InputGroupInternalContext);
|
|
634
|
+
const isDisabled = props.isDisabled || inputGroupState.isDisabled;
|
|
631
635
|
const isTouch = useMediaQuery(TOUCH_POINTER_QUERY);
|
|
632
636
|
useDevWarning('DateInput', '`nativePicker` is deprecated; use `presentation` instead (`touch` → `adaptive-native`, `always` → `native`, `never` → `adaptive-bottom-sheet`). `presentation` wins when both are set.', props.nativePicker !== undefined);
|
|
633
637
|
const surface = resolvePickerPresentation(effectivePickerPresentation(props.presentation, props.nativePicker), isTouch);
|
|
@@ -639,15 +643,18 @@ export function DateInput(props) {
|
|
|
639
643
|
switch (surface) {
|
|
640
644
|
case 'native':
|
|
641
645
|
return /*#__PURE__*/_jsx(NativeDateField, {
|
|
642
|
-
...rest
|
|
646
|
+
...rest,
|
|
647
|
+
isDisabled: isDisabled
|
|
643
648
|
});
|
|
644
649
|
case 'sheet':
|
|
645
650
|
return /*#__PURE__*/_jsx(TouchDateField, {
|
|
646
|
-
...rest
|
|
651
|
+
...rest,
|
|
652
|
+
isDisabled: isDisabled
|
|
647
653
|
});
|
|
648
654
|
case 'desktop':
|
|
649
655
|
return /*#__PURE__*/_jsx(PointerDateField, {
|
|
650
|
-
...rest
|
|
656
|
+
...rest,
|
|
657
|
+
isDisabled: isDisabled
|
|
651
658
|
});
|
|
652
659
|
}
|
|
653
660
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeDateField.d.ts","sourceRoot":"","sources":["../../src/DateInput/NativeDateField.tsx"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AA0NhD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,QAAgB,EAGhB,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,aAAa,EAC3B,MAAoB,EACpB,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,GAAG,SAAS,EACb,EAAE,cAAc,+
|
|
1
|
+
{"version":3,"file":"NativeDateField.d.ts","sourceRoot":"","sources":["../../src/DateInput/NativeDateField.tsx"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AA0NhD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,QAAgB,EAGhB,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,aAAa,EAC3B,MAAoB,EACpB,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,GAAG,SAAS,EACb,EAAE,cAAc,+BAwbhB;yBA3de,eAAe"}
|
|
@@ -39,7 +39,7 @@ import { useLocale, useTranslator } from "../i18n/index.js";
|
|
|
39
39
|
import { useInputGroup } from "../InputGroup/index.js";
|
|
40
40
|
import { useFieldInputStyling } from "../Field/fieldParts.js";
|
|
41
41
|
import { joinAriaIDs } from "../utils/inputAria.js";
|
|
42
|
-
import { groupStyles } from "../InputGroup/groupStyles.js";
|
|
42
|
+
import { groupStyles, inputGroupItemProps } from "../InputGroup/groupStyles.js";
|
|
43
43
|
import { useSize } from "../SizeContext/index.js";
|
|
44
44
|
import { Spinner } from "../Spinner/index.js";
|
|
45
45
|
import "../theme/tokens.stylex.js";
|
|
@@ -401,6 +401,7 @@ export function NativeDateField({
|
|
|
401
401
|
ref: el => {
|
|
402
402
|
disabledMessageTooltip.ref(el);
|
|
403
403
|
},
|
|
404
|
+
...(inputGroup ? inputGroupItemProps : undefined),
|
|
404
405
|
...mergeProps(themeProps('date-input', {
|
|
405
406
|
size,
|
|
406
407
|
status: status?.type ?? null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TouchDateField.d.ts","sourceRoot":"","sources":["../../src/DateInput/TouchDateField.tsx"],"names":[],"mappings":"AAgEA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AA6ehD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,QAAgB,EAIhB,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,gBAAoB,EAClC,MAAoB,EACpB,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,GAAG,SAAS,EACb,EAAE,cAAc,+
|
|
1
|
+
{"version":3,"file":"TouchDateField.d.ts","sourceRoot":"","sources":["../../src/DateInput/TouchDateField.tsx"],"names":[],"mappings":"AAgEA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AA6ehD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,QAAgB,EAIhB,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,gBAAoB,EAClC,MAAoB,EACpB,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,GAAG,SAAS,EACb,EAAE,cAAc,+BAswBhB;yBA1yBe,cAAc"}
|
|
@@ -62,7 +62,7 @@ import { useLocale, useTranslator } from "../i18n/index.js";
|
|
|
62
62
|
import { useInputGroup } from "../InputGroup/index.js";
|
|
63
63
|
import { useFieldInputStyling } from "../Field/fieldParts.js";
|
|
64
64
|
import { joinAriaIDs } from "../utils/inputAria.js";
|
|
65
|
-
import { groupStyles } from "../InputGroup/groupStyles.js";
|
|
65
|
+
import { groupStyles, inputGroupItemProps } from "../InputGroup/groupStyles.js";
|
|
66
66
|
import { useSize } from "../SizeContext/index.js";
|
|
67
67
|
import { Spinner } from "../Spinner/index.js";
|
|
68
68
|
import "../theme/tokens.stylex.js";
|
|
@@ -798,6 +798,7 @@ export function TouchDateField({
|
|
|
798
798
|
// Gated internally by isEnabled, so attaching unconditionally is safe.
|
|
799
799
|
disabledMessageTooltip.ref(el);
|
|
800
800
|
},
|
|
801
|
+
...(inputGroup ? inputGroupItemProps : undefined),
|
|
801
802
|
...mergeProps(themeProps('date-input', {
|
|
802
803
|
size,
|
|
803
804
|
status: status?.type ?? null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAS,KAAK,WAAW,EAAC,MAAM,WAAW,CAAC;AAKnD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AA6B9D,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAS,KAAK,WAAW,EAAC,MAAM,WAAW,CAAC;AAKnD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AA6B9D,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;AAS1C,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAStE,OAAO,KAAK,EAAC,SAAS,EAAC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YAAY,CAAC,EAAE,wBAAwB,CAAC;IACxC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,yBAA0B,SAAQ,qBAAqB;IAC/D,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAC3B,qBAAqB,GAAG,yBAAyB,CAAC;AAgwCpD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBA4CpD;yBA5Ce,YAAY"}
|
|
@@ -59,7 +59,8 @@ import "../Layer/layerViewportInset.stylex.js";
|
|
|
59
59
|
import { layerViewportInset } from "../Layer/layerViewportInset.stylex.js";
|
|
60
60
|
import { useAdaptivePresentation } from "../hooks/useAdaptivePresentation.js";
|
|
61
61
|
// Loaded on demand: only the bottom-sheet presentation renders the sheet.
|
|
62
|
-
import { MenuBottomSheet, MenuBottomSheetActionList } from "./lazyMenuBottomSheet.js";
|
|
62
|
+
import { MenuBottomSheet, MenuBottomSheetActionList, preloadMenuBottomSheetActionList } from "./lazyMenuBottomSheet.js";
|
|
63
|
+
import { menuBottomSheetStyles } from "./menuBottomSheet.stylex.js";
|
|
63
64
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
64
65
|
import "../theme/tokens.stylex.js";
|
|
65
66
|
import { spacingVars, colorVars, radiusVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
@@ -78,11 +79,12 @@ const MENU_MAX_BLOCK_SIZE_FALLBACK = `min(${MENU_BLOCK_CAP}, ${layerViewportInse
|
|
|
78
79
|
const MENU_TRIGGER_OPEN_BACKGROUND = `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`;
|
|
79
80
|
|
|
80
81
|
// A sub-menu's drilled-in view with a header or footer renders in the surface
|
|
81
|
-
// host that follows the menu, as the frame
|
|
82
|
-
// `data-astryx-submenu-regions="view"` (hidden while a deeper view
|
|
83
|
-
// While one shows, the menu and its header and footer step aside. The
|
|
84
|
-
// reads that from the DOM, so no state mirrors which view shows
|
|
85
|
-
|
|
82
|
+
// host that follows the menu (marked `data-astryx-submenu-host`), as the frame
|
|
83
|
+
// marked `data-astryx-submenu-regions="view"` (hidden while a deeper view
|
|
84
|
+
// shows). While one shows, the menu and its header and footer step aside. The
|
|
85
|
+
// rule reads that from the DOM, so no state mirrors which view shows; it names
|
|
86
|
+
// the host by its marker rather than a universal selector.
|
|
87
|
+
const STEPS_ASIDE_FOR_VIEW = ':has(~ [data-astryx-submenu-host] > [data-astryx-submenu-regions="view"]:not([hidden]))';
|
|
86
88
|
const _temp = {
|
|
87
89
|
kzqmXN: "x1uyokj7",
|
|
88
90
|
"$$css": true
|
|
@@ -99,7 +101,7 @@ const styles = {
|
|
|
99
101
|
},
|
|
100
102
|
dropdown: {
|
|
101
103
|
kB7OPa: "x9f619",
|
|
102
|
-
k1xSpc: "x78zum5
|
|
104
|
+
k1xSpc: "x78zum5 x6ptruj",
|
|
103
105
|
kXwgrk: "xdt5ytf",
|
|
104
106
|
kOIVth: "x1lsbc85",
|
|
105
107
|
kI3sdo: "x1a2a7pz",
|
|
@@ -389,6 +391,11 @@ function DropdownMenuBottomSheet({
|
|
|
389
391
|
setSubmenuPath([]);
|
|
390
392
|
}
|
|
391
393
|
}
|
|
394
|
+
// The closed sheet renders nothing, so load its rows at rest: the first
|
|
395
|
+
// open shows the actions at once.
|
|
396
|
+
useEffect(() => {
|
|
397
|
+
preloadMenuBottomSheetActionList();
|
|
398
|
+
}, []);
|
|
392
399
|
const currentSubmenu = submenuPath.at(-1);
|
|
393
400
|
const currentItems = currentSubmenu?.items ?? items;
|
|
394
401
|
const currentTitle = currentSubmenu?.label ?? button.label;
|
|
@@ -496,6 +503,16 @@ function DropdownMenuBottomSheet({
|
|
|
496
503
|
onClick?.();
|
|
497
504
|
setOpen(!isOpen);
|
|
498
505
|
};
|
|
506
|
+
|
|
507
|
+
// The root view's heading stands alone; a sub-menu's sits in a row with its
|
|
508
|
+
// back button.
|
|
509
|
+
const viewHeading = /*#__PURE__*/_jsx(Heading, {
|
|
510
|
+
ref: viewHeadingRef,
|
|
511
|
+
level: 3,
|
|
512
|
+
tabIndex: -1,
|
|
513
|
+
xstyle: [bottomSheetStyles.viewHeading, submenuPath.length === 0 && [bottomSheetStyles.rootHeading, menuBottomSheetStyles.headingAlone]],
|
|
514
|
+
children: currentTitle
|
|
515
|
+
});
|
|
499
516
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
500
517
|
children: [renderTrigger != null ? renderTrigger({
|
|
501
518
|
ref: el => {
|
|
@@ -544,12 +561,12 @@ function DropdownMenuBottomSheet({
|
|
|
544
561
|
...rest,
|
|
545
562
|
...mergeProps(themeProps('dropdown-menu', {
|
|
546
563
|
presentation: 'bottom-sheet'
|
|
547
|
-
}), stylex.props(bottomSheetStyles.content, xstyle), className, style),
|
|
548
|
-
children: [/*#__PURE__*/_jsxs("div", {
|
|
564
|
+
}), stylex.props(bottomSheetStyles.content, menuBottomSheetStyles.content, xstyle), className, style),
|
|
565
|
+
children: [submenuPath.length > 0 ? /*#__PURE__*/_jsxs("div", {
|
|
549
566
|
...{
|
|
550
567
|
className: "x78zum5 x1q0g3np x6s0dn4 xzye2dw x1p37lm5"
|
|
551
568
|
},
|
|
552
|
-
children: [
|
|
569
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
553
570
|
label: backLabel,
|
|
554
571
|
variant: "ghost",
|
|
555
572
|
size: "sm",
|
|
@@ -560,14 +577,8 @@ function DropdownMenuBottomSheet({
|
|
|
560
577
|
}),
|
|
561
578
|
isIconOnly: true,
|
|
562
579
|
onClick: () => setSubmenuPath(path => path.slice(0, -1))
|
|
563
|
-
}),
|
|
564
|
-
|
|
565
|
-
level: 3,
|
|
566
|
-
tabIndex: -1,
|
|
567
|
-
xstyle: [bottomSheetStyles.viewHeading, submenuPath.length === 0 && bottomSheetStyles.rootHeading],
|
|
568
|
-
children: currentTitle
|
|
569
|
-
})]
|
|
570
|
-
}), isRenderable(header) && /*#__PURE__*/_jsx("div", {
|
|
580
|
+
}), viewHeading]
|
|
581
|
+
}) : viewHeading, isRenderable(header) && /*#__PURE__*/_jsx("div", {
|
|
571
582
|
...{
|
|
572
583
|
className: "xrrkdod xce4md1"
|
|
573
584
|
},
|
|
@@ -1146,6 +1157,7 @@ function DropdownMenuPopover({
|
|
|
1146
1157
|
// the regions step aside (STEPS_ASIDE_FOR_VIEW).
|
|
1147
1158
|
const surfaceHostElement = /*#__PURE__*/_jsx("div", {
|
|
1148
1159
|
ref: attachSurfaceHost,
|
|
1160
|
+
"data-astryx-submenu-host": "",
|
|
1149
1161
|
...{
|
|
1150
1162
|
className: "xjp7ctv"
|
|
1151
1163
|
}
|
|
@@ -1156,14 +1168,14 @@ function DropdownMenuPopover({
|
|
|
1156
1168
|
ref: headerRef,
|
|
1157
1169
|
onKeyDown: handleRegionKeyDown,
|
|
1158
1170
|
...{
|
|
1159
|
-
className: "x2lah0s x9epnlk
|
|
1171
|
+
className: "x2lah0s x9epnlk x6ptruj"
|
|
1160
1172
|
},
|
|
1161
1173
|
children: header
|
|
1162
1174
|
}), menu, isRenderable(footer) && /*#__PURE__*/_jsx("div", {
|
|
1163
1175
|
ref: footerRef,
|
|
1164
1176
|
onKeyDown: handleRegionKeyDown,
|
|
1165
1177
|
...{
|
|
1166
|
-
className: "x2lah0s x9epnlk
|
|
1178
|
+
className: "x2lah0s x9epnlk x6ptruj"
|
|
1167
1179
|
},
|
|
1168
1180
|
children: footer
|
|
1169
1181
|
}), surfaceHostElement]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file MenuBottomSheet.tsx
|
|
3
|
-
* @input Uses BottomSheet
|
|
4
|
-
* @output Internal action-sheet host for menu content
|
|
3
|
+
* @input Uses BottomSheet
|
|
4
|
+
* @output Internal action-sheet host for menu content; nothing of the sheet renders while it is closed
|
|
5
5
|
* @position Shared by DropdownMenu and ContextMenu adaptive presentations
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
8
8
|
interface MenuBottomSheetProps {
|
|
9
9
|
finalFocusRef?: RefObject<HTMLElement | null>;
|
|
10
10
|
isOpen: boolean;
|
|
@@ -12,7 +12,14 @@ interface MenuBottomSheetProps {
|
|
|
12
12
|
label: string;
|
|
13
13
|
children: ReactNode;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The sheet renders nothing at rest (architecture:component-style-authoring
|
|
17
|
+
* INV7): it mounts as it opens, and after it closes it stays only until its
|
|
18
|
+
* dialog has closed, so the exit plays out and focus returns to the trigger.
|
|
19
|
+
* The sheet has no content padding: callers inset their content with
|
|
20
|
+
* menuBottomSheetStyles.content, so no wrapper sits between the sheet and it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function MenuBottomSheet({ finalFocusRef, isOpen, onOpenChange, label, children, }: MenuBottomSheetProps): import("react").JSX.Element | null;
|
|
16
23
|
export declare namespace MenuBottomSheet {
|
|
17
24
|
var displayName: string;
|
|
18
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuBottomSheet.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/MenuBottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"MenuBottomSheet.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/MenuBottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,UAAU,oBAAoB;IAC5B,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,MAAM,EACN,YAAY,EACZ,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,sCAqCtB;yBA3Ce,eAAe"}
|