@astryxdesign/core 0.7.17-canary.g49a475f → 0.7.17-canary.g5a3fd39
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/AlertDialog/AlertDialog.d.ts +7 -4
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +41 -12
- package/dist/AlertDialog/useAlertMotion.d.ts +16 -0
- package/dist/AlertDialog/useAlertMotion.d.ts.map +1 -0
- package/dist/AlertDialog/useAlertMotion.js +277 -0
- package/dist/Badge/Badge.d.ts.map +1 -1
- package/dist/Badge/Badge.js +1 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +1 -0
- package/dist/Chat/useChatPasteAsToken.d.ts.map +1 -1
- package/dist/Chat/useChatPasteAsToken.js +1 -0
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +6 -2
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +6 -0
- package/dist/CodeBlock/highlightRanges.d.ts.map +1 -1
- package/dist/CodeBlock/highlightRanges.js +3 -1
- package/dist/CodeBlock/highlightStyles.d.ts.map +1 -1
- package/dist/CodeBlock/highlightStyles.js +9 -3
- package/dist/ContextMenu/ContextMenu.d.ts +3 -2
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +19 -15
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +1 -0
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +1 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +57 -21
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +23 -7
- package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts +2 -1
- package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts.map +1 -1
- package/dist/DropdownMenu/MenuBottomSheetActionList.js +18 -5
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts +2 -2
- package/dist/DropdownMenu/lazyMenuBottomSheet.js +2 -2
- package/dist/Indicator/RadioIndicator.d.ts.map +1 -1
- package/dist/Indicator/RadioIndicator.js +3 -3
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +9 -2
- package/dist/Layer/gestureCounter.d.ts +28 -0
- package/dist/Layer/gestureCounter.d.ts.map +1 -1
- package/dist/Layer/gestureCounter.js +70 -3
- package/dist/Layer/inputHold.d.ts +9 -7
- package/dist/Layer/inputHold.d.ts.map +1 -1
- package/dist/Layer/inputHold.js +74 -24
- package/dist/Layer/layerExitCopy.d.ts +2 -1
- package/dist/Layer/layerExitCopy.d.ts.map +1 -1
- package/dist/Layer/layerExitCopy.js +14 -1
- package/dist/Layer/useLayer.d.ts +6 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +92 -19
- package/dist/Layer/useTouchTrigger.d.ts +1 -30
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +3 -66
- package/dist/Layout/LayoutContent.d.ts.map +1 -1
- package/dist/Layout/LayoutContent.js +2 -1
- package/dist/Layout/LayoutFooter.d.ts.map +1 -1
- package/dist/Layout/LayoutFooter.js +2 -1
- package/dist/Layout/LayoutHeader.d.ts.map +1 -1
- package/dist/Layout/LayoutHeader.js +2 -1
- package/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.js +2 -1
- package/dist/Layout/container.stylex.d.ts +4 -1
- package/dist/Layout/container.stylex.d.ts.map +1 -1
- package/dist/Layout/container.stylex.js +3 -2
- package/dist/Layout/containerBlockBleed.stylex.d.ts +27 -0
- package/dist/Layout/containerBlockBleed.stylex.d.ts.map +1 -0
- package/dist/Layout/containerBlockBleed.stylex.js +31 -0
- package/dist/Layout/layoutReset.d.ts +2 -0
- package/dist/Layout/layoutReset.d.ts.map +1 -1
- package/dist/Layout/overlayPaddingReset.stylex.d.ts +2 -0
- package/dist/Layout/overlayPaddingReset.stylex.d.ts.map +1 -1
- package/dist/Layout/overlayPaddingReset.stylex.js +2 -0
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +129 -8
- package/dist/Markdown/Markdown.d.ts +28 -7
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +1 -0
- package/dist/MobileNav/MobileNav.textColor.a11y.chromium.spec.d.ts.map +1 -0
- package/dist/MobileNav/MobileNavToggle.d.ts +7 -3
- package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
- package/dist/MobileNav/MobileNavToggle.js +7 -3
- package/dist/MoreMenu/MoreMenu.d.ts +3 -2
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +1 -0
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +27 -22
- package/dist/Popover/popoverSurfaceMotion.d.ts.map +1 -1
- package/dist/Popover/popoverSurfaceMotion.js +4 -9
- package/dist/Popover/usePopover.d.ts +5 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +8 -3
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +1 -3
- package/dist/ScrollableArea/ScrollableArea.d.ts.map +1 -1
- package/dist/ScrollableArea/ScrollableArea.js +2 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +1 -0
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +15 -4
- package/dist/Stepper/Step.d.ts.map +1 -1
- package/dist/Stepper/Step.js +5 -1
- package/dist/Swipe/SwipeActionsLayer.d.ts +20 -0
- package/dist/Swipe/SwipeActionsLayer.d.ts.map +1 -1
- package/dist/Swipe/SwipeActionsLayer.js +20 -20
- package/dist/Swipe/useSwipeAction.d.ts +56 -55
- package/dist/Swipe/useSwipeAction.d.ts.map +1 -1
- package/dist/Swipe/useSwipeAction.js +57 -55
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +73 -46
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +4 -4
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +18 -7
- package/dist/Text/TruncationTooltip.js +1 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +6 -4
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +1 -0
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +14 -3
- package/dist/Token/TokenLink.d.ts +2 -1
- package/dist/Token/TokenLink.d.ts.map +1 -1
- package/dist/Tokenizer/TokenizerBottomSheet.js +14 -6
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +1 -1
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +14 -4
- package/dist/astryx.css +19 -7
- package/dist/hooks/mediaSide.d.ts +33 -0
- package/dist/hooks/mediaSide.d.ts.map +1 -0
- package/dist/hooks/mediaSide.js +67 -0
- package/dist/hooks/useAutoMediaMode.d.ts +6 -15
- package/dist/hooks/useAutoMediaMode.d.ts.map +1 -1
- package/dist/hooks/useAutoMediaMode.js +15 -35
- package/dist/hooks/useClipboard.d.ts +4 -2
- package/dist/hooks/useClipboard.d.ts.map +1 -1
- package/dist/hooks/useClipboard.js +87 -3
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +4 -18
- package/dist/hooks/useOverflow.d.ts +15 -3
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +150 -50
- package/dist/i18n/generated-english/Stepper/Step.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Stepper/Step.generated.js +1 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +3 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +3 -0
- package/dist/internal/clipboard-copy.d.ts +15 -0
- package/dist/internal/clipboard-copy.d.ts.map +1 -0
- package/dist/internal/clipboard-copy.js +15 -0
- package/dist/motion/themeTiming.d.ts +11 -4
- package/dist/motion/themeTiming.d.ts.map +1 -1
- package/dist/motion/themeTiming.js +14 -4
- package/dist/privateAttributes/focusOwner.stylex.d.ts +11 -1
- package/dist/privateAttributes/focusOwner.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/focusOwner.stylex.js +20 -8
- package/dist/privateAttributes/layerRoot.stylex.d.ts +2 -0
- package/dist/privateAttributes/layerRoot.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/layerRoot.stylex.js +10 -3
- package/dist/reset.font.a11y.chromium.spec.d.ts.map +1 -0
- package/dist/theme/Theme.js +2 -2
- package/dist/theme/defineTheme.d.ts +7 -6
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +18 -5
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +71 -11
- package/dist/theme/localTokens.d.ts +7 -1
- package/dist/theme/localTokens.d.ts.map +1 -1
- package/dist/theme/localTokens.js +47 -12
- package/dist/theme/mergeComponents.d.ts +13 -6
- package/dist/theme/mergeComponents.d.ts.map +1 -1
- package/dist/theme/mergeComponents.js +58 -6
- package/dist/theme/resolveThemeValues.js +2 -2
- package/dist/theme/themeAdaptations.d.ts.map +1 -1
- package/dist/theme/themeAdaptations.js +33 -13
- package/dist/theme/types.d.ts +8 -2
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/utils/accessibleName.d.ts +13 -0
- package/dist/utils/accessibleName.d.ts.map +1 -1
- package/dist/utils/accessibleName.js +2 -2
- package/dist/utils/nodeType.d.ts +15 -1
- package/dist/utils/nodeType.d.ts.map +1 -1
- package/dist/utils/nodeType.js +29 -1
- package/locales/en.json +12 -0
- package/locales/pseudo.json +9 -0
- package/package.json +10 -5
- package/src/AlertDialog/AlertDialog.doc.mjs +3 -3
- package/src/AlertDialog/AlertDialog.tsx +49 -11
- package/src/AlertDialog/useAlertMotion.ts +313 -0
- package/src/Badge/Badge.doc.mjs +1 -1
- package/src/Badge/Badge.tsx +5 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +4 -0
- package/src/Chat/useChatPasteAsToken.doc.mjs +97 -0
- package/src/Chat/useChatPasteAsToken.ts +1 -0
- package/src/Chat/useSpeechRecognition.doc.mjs +217 -0
- package/src/Chat/useSpeechRecognition.ts +5 -2
- package/src/CodeBlock/CodeBlock.tsx +6 -0
- package/src/CodeBlock/highlightRanges.ts +3 -1
- package/src/CodeBlock/highlightStyles.ts +9 -3
- package/src/ContextMenu/ContextMenu.tsx +24 -18
- package/src/Dialog/Dialog.doc.mjs +3 -3
- package/src/Dialog/Dialog.tsx +4 -0
- package/src/Drawer/Drawer.tsx +4 -0
- package/src/DropdownMenu/DropdownMenu.tsx +61 -21
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +34 -10
- package/src/DropdownMenu/MenuBottomSheetActionList.tsx +31 -5
- package/src/DropdownMenu/lazyMenuBottomSheet.ts +2 -2
- package/src/Indicator/RadioIndicator.tsx +4 -7
- package/src/Item/Item.tsx +15 -2
- package/src/Layer/gestureCounter.ts +92 -3
- package/src/Layer/inputHold.ts +95 -24
- package/src/Layer/layerExitCopy.ts +33 -1
- package/src/Layer/useLayer.tsx +109 -19
- package/src/Layer/useTouchTrigger.ts +2 -89
- package/src/Layout/LayoutContent.tsx +2 -0
- package/src/Layout/LayoutFooter.tsx +2 -0
- package/src/Layout/LayoutHeader.tsx +2 -0
- package/src/Layout/LayoutPanel.tsx +2 -0
- package/src/Layout/container.stylex.ts +3 -0
- package/src/Layout/containerBlockBleed.stylex.ts +42 -0
- package/src/Layout/overlayPaddingReset.stylex.ts +4 -0
- package/src/Lightbox/Lightbox.tsx +200 -11
- package/src/Markdown/Markdown.doc.mjs +36 -5
- package/src/Markdown/Markdown.tsx +28 -7
- package/src/MobileNav/MobileNav.doc.mjs +2 -2
- package/src/MobileNav/MobileNav.tsx +4 -0
- package/src/MobileNav/MobileNavToggle.tsx +7 -3
- package/src/MoreMenu/MoreMenu.doc.mjs +25 -4
- package/src/MoreMenu/MoreMenu.tsx +3 -2
- package/src/MultiSelector/MultiSelector.doc.mjs +1 -1
- package/src/MultiSelector/MultiSelector.tsx +1 -0
- package/src/OverflowList/OverflowList.tsx +44 -36
- package/src/Popover/popoverSurfaceMotion.ts +4 -13
- package/src/Popover/usePopover.tsx +14 -1
- package/src/RadioList/RadioListItem.tsx +2 -2
- package/src/ScrollableArea/ScrollableArea.tsx +2 -0
- package/src/Selector/Selector.doc.mjs +1 -1
- package/src/Selector/Selector.tsx +1 -0
- package/src/Slider/Slider.tsx +26 -3
- package/src/Stepper/Step.tsx +5 -0
- package/src/Swipe/SwipeActionsLayer.tsx +20 -20
- package/src/Swipe/useSwipeAction.ts +56 -55
- package/src/Table/BaseTable.tsx +121 -69
- package/src/Table/Table.tsx +12 -11
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +18 -7
- package/src/Text/TruncationTooltip.tsx +1 -1
- package/src/Toast/Toast.tsx +10 -3
- package/src/Toast/ToastViewport.tsx +3 -0
- package/src/Token/Token.tsx +17 -3
- package/src/Token/TokenLink.tsx +4 -1
- package/src/Tokenizer/TokenizerBottomSheet.tsx +17 -5
- package/src/Tooltip/useTooltip.tsx +2 -3
- package/src/Typeahead/BaseTypeahead.tsx +22 -8
- package/src/Typeahead/Typeahead.doc.mjs +5 -0
- package/src/hooks/mediaSide.ts +87 -0
- package/src/hooks/useAutoMediaMode.ts +32 -48
- package/src/hooks/useClipboard.doc.mjs +2 -2
- package/src/hooks/useClipboard.ts +98 -5
- package/src/hooks/useFocusTrap.ts +8 -18
- package/src/hooks/useOverflow.ts +176 -50
- package/src/i18n/generated-english/Stepper/Step.generated.ts +1 -0
- package/src/i18n/generated-locales/en.generated.ts +3 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +3 -0
- package/src/internal/clipboard-copy.ts +19 -0
- package/src/motion/themeTiming.ts +20 -4
- package/src/privateAttributes/focusOwner.stylex.ts +22 -12
- package/src/privateAttributes/layerRoot.stylex.ts +10 -3
- package/src/reset.css +7 -0
- package/src/theme/Theme.tsx +6 -6
- package/src/theme/defineTheme.ts +28 -6
- package/src/theme/generateThemeRules.ts +86 -14
- package/src/theme/localTokens.ts +48 -10
- package/src/theme/mergeComponents.ts +73 -7
- package/src/theme/resolveThemeValues.ts +2 -2
- package/src/theme/themeAdaptations.ts +47 -17
- package/src/theme/types.ts +8 -2
- package/src/utils/accessibleName.ts +2 -2
- package/src/utils/nodeType.ts +29 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @file AlertDialog.tsx
|
|
3
3
|
* @input Uses React, StyleX, Dialog, Layout, Heading, Text, Button, the
|
|
4
4
|
* action-group tracking (hooks/useActionGroupTracking), the press-group
|
|
5
|
-
* context (hooks/pressGroupContext)
|
|
6
|
-
* (hooks/useGroupPressTracking)
|
|
5
|
+
* context (hooks/pressGroupContext), the group pointers
|
|
6
|
+
* (hooks/useGroupPressTracking) and the touch motion (useAlertMotion)
|
|
7
7
|
* @output Exports AlertDialog component, AlertDialogProps type
|
|
8
8
|
* @position Core implementation; consumed by index.ts, tested by AlertDialog.test.tsx
|
|
9
9
|
*
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* - /packages/core/src/AlertDialog/AlertDialog.test.tsx (tests for new/changed behavior)
|
|
13
13
|
* - /packages/core/src/AlertDialog/index.ts (exports if types change)
|
|
14
14
|
* - /packages/core/src/AlertDialog/__tests__/AlertDialog.interaction.browser.spec.ts (touch tracking)
|
|
15
|
+
* - /packages/core/src/AlertDialog/__tests__/AlertDialog.motion.interaction.browser.spec.ts (touch motion)
|
|
15
16
|
* - /apps/storybook/stories/AlertDialog.stories.tsx (storybook stories)
|
|
16
17
|
* - /packages/cli/assets/templates/blocks/components/AlertDialog/ (showcase blocks)
|
|
17
18
|
*/
|
|
@@ -70,7 +71,9 @@ export interface AlertDialogProps extends BaseProps<HTMLDialogElement> {
|
|
|
70
71
|
onAction: () => unknown;
|
|
71
72
|
/**
|
|
72
73
|
* The width of the dialog.
|
|
73
|
-
* Numbers are treated as pixels, strings are used as-is.
|
|
74
|
+
* Numbers are treated as pixels, strings are used as-is. On a phone (a
|
|
75
|
+
* compact window under a coarse primary pointer) the default is iOS's alert
|
|
76
|
+
* width, 320, in every theme. A width set here wins there too.
|
|
74
77
|
* @default 400
|
|
75
78
|
*/
|
|
76
79
|
width?: number | string;
|
|
@@ -101,7 +104,7 @@ export interface AlertDialogProps extends BaseProps<HTMLDialogElement> {
|
|
|
101
104
|
* />
|
|
102
105
|
* ```
|
|
103
106
|
*/
|
|
104
|
-
export declare function AlertDialog({ ref, isOpen, isInline, onOpenChange, title, description, cancelLabel: cancelLabelFromProps, actionLabel, actionVariant, isActionLoading, onAction, width, xstyle, className, style, 'data-testid': testId, ...rest }: AlertDialogProps): React.JSX.Element;
|
|
107
|
+
export declare function AlertDialog({ ref, isOpen, isInline, onOpenChange, title, description, cancelLabel: cancelLabelFromProps, actionLabel, actionVariant, isActionLoading, onAction, width: widthProp, xstyle, className, style, 'data-testid': testId, ...rest }: AlertDialogProps): React.JSX.Element;
|
|
105
108
|
export declare namespace AlertDialog {
|
|
106
109
|
var displayName: string;
|
|
107
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../src/AlertDialog/AlertDialog.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../src/AlertDialog/AlertDialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAmC,MAAM,OAAO,CAAC;AAUxD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAkD5C,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IACpE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;IAE3C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC;IAExB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,GAAG,EACH,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,WAAW,EACX,WAAW,EAAE,oBAAoB,EACjC,WAAW,EACX,aAA6B,EAC7B,eAAe,EACf,QAAQ,EACR,KAAK,EAAE,SAAS,EAChB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,IAAI,EACR,EAAE,gBAAgB,qBAwIlB;yBA1Je,WAAW"}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @file AlertDialog.tsx
|
|
7
7
|
* @input Uses React, StyleX, Dialog, Layout, Heading, Text, Button, the
|
|
8
8
|
* action-group tracking (hooks/useActionGroupTracking), the press-group
|
|
9
|
-
* context (hooks/pressGroupContext)
|
|
10
|
-
* (hooks/useGroupPressTracking)
|
|
9
|
+
* context (hooks/pressGroupContext), the group pointers
|
|
10
|
+
* (hooks/useGroupPressTracking) and the touch motion (useAlertMotion)
|
|
11
11
|
* @output Exports AlertDialog component, AlertDialogProps type
|
|
12
12
|
* @position Core implementation; consumed by index.ts, tested by AlertDialog.test.tsx
|
|
13
13
|
*
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* - /packages/core/src/AlertDialog/AlertDialog.test.tsx (tests for new/changed behavior)
|
|
17
17
|
* - /packages/core/src/AlertDialog/index.ts (exports if types change)
|
|
18
18
|
* - /packages/core/src/AlertDialog/__tests__/AlertDialog.interaction.browser.spec.ts (touch tracking)
|
|
19
|
+
* - /packages/core/src/AlertDialog/__tests__/AlertDialog.motion.interaction.browser.spec.ts (touch motion)
|
|
19
20
|
* - /apps/storybook/stories/AlertDialog.stories.tsx (storybook stories)
|
|
20
21
|
* - /packages/cli/assets/templates/blocks/components/AlertDialog/ (showcase blocks)
|
|
21
22
|
*/
|
|
@@ -32,6 +33,7 @@ import { Button } from "../Button/Button.js";
|
|
|
32
33
|
import { mergeProps } from "../utils/mergeProps.js";
|
|
33
34
|
import { themeProps } from "../utils/themeProps.js";
|
|
34
35
|
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
36
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
35
37
|
import { useTouchPresentation } from "../utils/touchPresentation.js";
|
|
36
38
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
37
39
|
import english from "../i18n/generated-english/AlertDialog/AlertDialog.generated.js";
|
|
@@ -39,14 +41,23 @@ import { useActionGroupTracking } from "../hooks/useActionGroupTracking.js";
|
|
|
39
41
|
import { PressGroupContext } from "../hooks/pressGroupContext.js";
|
|
40
42
|
import { GROUP_PRESS_POINTERS } from "../hooks/useGroupPressTracking.js";
|
|
41
43
|
import { alertController } from "../motion/uikit/alert.js";
|
|
44
|
+
import { useAlertMotion } from "./useAlertMotion.js";
|
|
42
45
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
43
46
|
registerEnglishFallback(english);
|
|
44
47
|
const SMALL_SCREEN_QUERY = '(max-width: 640px)';
|
|
48
|
+
|
|
49
|
+
/** iOS's alert is 320 px wide on a phone, in every theme. */
|
|
50
|
+
const PHONE_WIDTH = 320;
|
|
45
51
|
const styles = {
|
|
46
52
|
trackingRow: {
|
|
47
53
|
kFalU9: "x1j4r261",
|
|
48
54
|
$$css: true
|
|
49
55
|
},
|
|
56
|
+
touchMotion: {
|
|
57
|
+
kKVMdj: "x1a5igra",
|
|
58
|
+
kAVvgx: "x8ifjc1",
|
|
59
|
+
$$css: true
|
|
60
|
+
},
|
|
50
61
|
action: {
|
|
51
62
|
ks0D6T: "x193iq5w",
|
|
52
63
|
k7Eaqz: "xeuugli",
|
|
@@ -95,7 +106,7 @@ export function AlertDialog({
|
|
|
95
106
|
actionVariant = 'destructive',
|
|
96
107
|
isActionLoading,
|
|
97
108
|
onAction,
|
|
98
|
-
width
|
|
109
|
+
width: widthProp,
|
|
99
110
|
xstyle,
|
|
100
111
|
className,
|
|
101
112
|
style,
|
|
@@ -110,6 +121,29 @@ export function AlertDialog({
|
|
|
110
121
|
// keep narrow visual, DOM, and tab order aligned for its destructive/cancel
|
|
111
122
|
// semantics without coupling action order to pointer or hover capability.
|
|
112
123
|
const isSmallScreen = useMediaQuery(SMALL_SCREEN_QUERY);
|
|
124
|
+
|
|
125
|
+
// Only under the touch presentation does a press slide across the
|
|
126
|
+
// actions, and does the alert scale in and fade out. A desktop press stays
|
|
127
|
+
// the native button's, and a mouse keeps the theme's entrance.
|
|
128
|
+
const {
|
|
129
|
+
isTouch,
|
|
130
|
+
isCompact
|
|
131
|
+
} = useTouchPresentation();
|
|
132
|
+
const width = widthProp ?? (isTouch && isCompact ? PHONE_WIDTH : 400);
|
|
133
|
+
const motion = useAlertMotion({
|
|
134
|
+
isOpen,
|
|
135
|
+
isEnabled: isTouch && isInline !== true
|
|
136
|
+
});
|
|
137
|
+
// While the alert fades out, its content is inert. The dialog's own Escape
|
|
138
|
+
// still fires (inert content does not stop its cancel event), so it is
|
|
139
|
+
// ignored here until the alert is hidden.
|
|
140
|
+
const isLeaving = motion.isDriving && motion.isPresented && !isOpen;
|
|
141
|
+
const handleOpenChange = useCallback(next => {
|
|
142
|
+
if (!isLeaving) {
|
|
143
|
+
onOpenChange(next);
|
|
144
|
+
}
|
|
145
|
+
}, [isLeaving, onOpenChange]);
|
|
146
|
+
const mergedRef = useMergedRefs(ref, motion.ref);
|
|
113
147
|
const handleCancel = useCallback(() => {
|
|
114
148
|
onOpenChange(false);
|
|
115
149
|
}, [onOpenChange]);
|
|
@@ -117,11 +151,6 @@ export function AlertDialog({
|
|
|
117
151
|
// Through the group's context, each action's Button writes the press-group
|
|
118
152
|
// marker from its first render. So the tracker is its only painter.
|
|
119
153
|
const actionsRef = useRef(null);
|
|
120
|
-
// Only under the touch presentation does a press slide across the
|
|
121
|
-
// actions. A desktop press stays the native button's.
|
|
122
|
-
const {
|
|
123
|
-
isTouch
|
|
124
|
-
} = useTouchPresentation();
|
|
125
154
|
const isTracking = isOpen && isInline !== true && isTouch;
|
|
126
155
|
useActionGroupTracking(actionsRef, {
|
|
127
156
|
// The actions row holds only the two buttons.
|
|
@@ -154,10 +183,10 @@ export function AlertDialog({
|
|
|
154
183
|
}, "action");
|
|
155
184
|
return /*#__PURE__*/_jsx(Dialog, {
|
|
156
185
|
...rest,
|
|
157
|
-
ref:
|
|
158
|
-
isOpen:
|
|
186
|
+
ref: mergedRef,
|
|
187
|
+
isOpen: motion.isPresented,
|
|
159
188
|
isInline: isInline,
|
|
160
|
-
onOpenChange:
|
|
189
|
+
onOpenChange: handleOpenChange,
|
|
161
190
|
width: width,
|
|
162
191
|
purpose: "form"
|
|
163
192
|
// `alertdialog` is a modal role: it promises an interruption the user
|
|
@@ -173,7 +202,7 @@ export function AlertDialog({
|
|
|
173
202
|
className,
|
|
174
203
|
style
|
|
175
204
|
}),
|
|
176
|
-
xstyle: xstyle,
|
|
205
|
+
xstyle: [motion.isDriving && styles.touchMotion, xstyle],
|
|
177
206
|
"data-testid": testId,
|
|
178
207
|
children: /*#__PURE__*/_jsx(Layout, {
|
|
179
208
|
content: /*#__PURE__*/_jsxs(LayoutContent, {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface AlertMotionOptions {
|
|
2
|
+
/** The caller's open state. */
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
/** Run the touch motion (under a finger: a coarse primary pointer). */
|
|
5
|
+
isEnabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface AlertMotion {
|
|
8
|
+
/** Whether the Dialog is open: true while the alert is shown or leaving. */
|
|
9
|
+
readonly isPresented: boolean;
|
|
10
|
+
/** True while the motion drives the dialog (its theme entrance is off). */
|
|
11
|
+
readonly isDriving: boolean;
|
|
12
|
+
/** Callback ref for the dialog element. */
|
|
13
|
+
readonly ref: (element: HTMLElement | null) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function useAlertMotion({ isOpen, isEnabled, }: AlertMotionOptions): AlertMotion;
|
|
16
|
+
//# sourceMappingURL=useAlertMotion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAlertMotion.d.ts","sourceRoot":"","sources":["../../src/AlertDialog/useAlertMotion.ts"],"names":[],"mappings":"AA+GA,MAAM,WAAW,kBAAkB;IACjC,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,uEAAuE;IACvE,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;CACrD;AAED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,SAAS,GACV,EAAE,kBAAkB,GAAG,WAAW,CAsLlC"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useAlertMotion.ts
|
|
7
|
+
* @input Whether the alert is open, whether it runs the touch motion, the
|
|
8
|
+
* motion animator, the theme's timing tokens and the layer runtime's input
|
|
9
|
+
* hold (Layer/inputHold)
|
|
10
|
+
* @output Exports useAlertMotion and AlertMotion: when the Dialog is presented
|
|
11
|
+
* (it stays open while the alert leaves), and the callback ref that puts
|
|
12
|
+
* the animators and the input hold on the dialog
|
|
13
|
+
* @position Internal hook of AlertDialog: the touch presentation's motion
|
|
14
|
+
*
|
|
15
|
+
* SYNC: When modified, update useAlertMotion.test.tsx and
|
|
16
|
+
* __tests__/AlertDialog.motion.interaction.browser.spec.ts
|
|
17
|
+
*/
|
|
18
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
19
|
+
import { useCommittedRef } from "../hooks/useCommittedRef.js";
|
|
20
|
+
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
21
|
+
import { createMotionEngine } from "../motion/animator.js";
|
|
22
|
+
import { mapProgress, mapRange } from "../motion/progress.js";
|
|
23
|
+
import { readThemeTimingOrInstant } from "../motion/themeTiming.js";
|
|
24
|
+
import { holdInput } from "../Layer/inputHold.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The presentation plays the theme's entrance easing over its duration step
|
|
28
|
+
* for UIKit's measured 404 ms alert present. A tap opens an alert, and a tap
|
|
29
|
+
* has no velocity, so no spring plays.
|
|
30
|
+
*/
|
|
31
|
+
const ALERT_ENTRANCE_TOKENS = {
|
|
32
|
+
duration: '--duration-medium-max',
|
|
33
|
+
easing: '--ease-entrance'
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** The dismissal plays the exit duration and easing that every overlay shares. */
|
|
37
|
+
const ALERT_EXIT_TOKENS = {
|
|
38
|
+
duration: '--duration-exit',
|
|
39
|
+
easing: '--ease-exit'
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** iOS's alert starts at 1.2 times its size. */
|
|
43
|
+
const PRESENT_SCALE_FROM = 1.2;
|
|
44
|
+
|
|
45
|
+
/** A dialog that misses its exit's end still closes this long after it. */
|
|
46
|
+
const EXIT_BACKSTOP_MS = 100;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The 1.2 start, never wider than the viewport: a wide alert would otherwise
|
|
50
|
+
* start past the screen's edges. One layout read, as the alert opens.
|
|
51
|
+
*/
|
|
52
|
+
function presentScaleFrom(element) {
|
|
53
|
+
const width = element?.offsetWidth ?? 0;
|
|
54
|
+
const viewport = element?.ownerDocument.documentElement.clientWidth ?? 0;
|
|
55
|
+
return width > 0 && viewport > 0 ? Math.max(1, Math.min(PRESENT_SCALE_FROM, viewport / width)) : PRESENT_SCALE_FROM;
|
|
56
|
+
}
|
|
57
|
+
function between(progress, from, to) {
|
|
58
|
+
// Unclamped, so an easing that overshoots carries the value with it.
|
|
59
|
+
return mapProgress(progress, mapRange([0, 1], [from, to], {
|
|
60
|
+
clamp: false
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Fades the alert and its dimming to `opacity` from the values on screen, on
|
|
66
|
+
* `progress`. The scale keeps its own curve if it still moves.
|
|
67
|
+
*/
|
|
68
|
+
function fadeFromHere(panel, backdrop, opacity, progress) {
|
|
69
|
+
backdrop.play({
|
|
70
|
+
opacity: between(progress, backdrop.get('opacity'), opacity)
|
|
71
|
+
});
|
|
72
|
+
return panel.play({
|
|
73
|
+
opacity: between(progress, panel.get('opacity'), opacity)
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Presents the alert and its dimming from their start values on one curve.
|
|
79
|
+
* From rest and with no start time, the browser starts both at the frame that
|
|
80
|
+
* commits them, the frame that first shows the dialog. Under reduced motion
|
|
81
|
+
* the animator plays its own opacity-only cross-fade instead.
|
|
82
|
+
*/
|
|
83
|
+
function present(panel, backdrop, scaleFrom, progress) {
|
|
84
|
+
const handle = panel.play({
|
|
85
|
+
opacity: between(progress, 0, 1),
|
|
86
|
+
scale: between(progress, scaleFrom, 1)
|
|
87
|
+
});
|
|
88
|
+
backdrop.play({
|
|
89
|
+
opacity: between(progress, 0, 1)
|
|
90
|
+
});
|
|
91
|
+
return handle;
|
|
92
|
+
}
|
|
93
|
+
export function useAlertMotion({
|
|
94
|
+
isOpen,
|
|
95
|
+
isEnabled
|
|
96
|
+
}) {
|
|
97
|
+
// The alert stays presented while it leaves. This is set during render, so
|
|
98
|
+
// the Dialog never commits a close before the exit ends.
|
|
99
|
+
const [isLeaving, setIsLeaving] = useState(false);
|
|
100
|
+
const [lastIsOpen, setLastIsOpen] = useState(isOpen);
|
|
101
|
+
if (lastIsOpen !== isOpen) {
|
|
102
|
+
setLastIsOpen(isOpen);
|
|
103
|
+
setIsLeaving(!isOpen && isEnabled);
|
|
104
|
+
}
|
|
105
|
+
const isPresented = isOpen || isLeaving;
|
|
106
|
+
const [animators] = useState(() => ({
|
|
107
|
+
panel: createMotionEngine(null),
|
|
108
|
+
backdrop: createMotionEngine(null, {
|
|
109
|
+
pseudoElement: '::backdrop',
|
|
110
|
+
base: {
|
|
111
|
+
opacity: 1
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
}));
|
|
115
|
+
// Whether the motion drives the dialog, as of the last commit. The callback
|
|
116
|
+
// ref reads it when React attaches the dialog.
|
|
117
|
+
const isEnabledRef = useCommittedRef(isEnabled);
|
|
118
|
+
|
|
119
|
+
// The animators hold the dialog only while the motion drives it, so a mouse
|
|
120
|
+
// presentation keeps its own styles. The callback is stable, so a caller's
|
|
121
|
+
// changing ref does not attach them again on every render.
|
|
122
|
+
const elementRef = useRef(null);
|
|
123
|
+
const ref = useCallback(node => {
|
|
124
|
+
elementRef.current = node;
|
|
125
|
+
const target = isEnabledRef.current ? node : null;
|
|
126
|
+
animators.panel.attach(target);
|
|
127
|
+
animators.backdrop.attach(target);
|
|
128
|
+
}, [animators, isEnabledRef]);
|
|
129
|
+
// Effect: syncs the motion animators' element with the pointer that drives
|
|
130
|
+
// the alert. A finger attaches them, and a mouse gets the dialog back at rest.
|
|
131
|
+
useIsomorphicLayoutEffect(() => {
|
|
132
|
+
const {
|
|
133
|
+
panel,
|
|
134
|
+
backdrop
|
|
135
|
+
} = animators;
|
|
136
|
+
if (isEnabled) {
|
|
137
|
+
panel.attach(elementRef.current);
|
|
138
|
+
backdrop.attach(elementRef.current);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
// A mouse took over from a finger: the theme's styles show again.
|
|
142
|
+
if (panel.element != null) {
|
|
143
|
+
panel.set({
|
|
144
|
+
opacity: 1,
|
|
145
|
+
scale: 1
|
|
146
|
+
});
|
|
147
|
+
backdrop.set({
|
|
148
|
+
opacity: 1
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
panel.attach(null);
|
|
152
|
+
backdrop.attach(null);
|
|
153
|
+
}, [animators, isEnabled]);
|
|
154
|
+
|
|
155
|
+
// Hidden even when mounted open, so a first render that is open presents
|
|
156
|
+
// like any other opening.
|
|
157
|
+
const statusRef = useRef('hidden');
|
|
158
|
+
// Only the exit in flight may hide the dialog when it ends.
|
|
159
|
+
const exitRef = useRef(null);
|
|
160
|
+
const exitMsRef = useRef(0);
|
|
161
|
+
const releaseHoldRef = useRef(null);
|
|
162
|
+
// The action that the dismissal's hold took focus from. A reopen during the
|
|
163
|
+
// exit gives focus back to it.
|
|
164
|
+
const blurredByDismissalRef = useRef(null);
|
|
165
|
+
// Effect: releases the input hold on the dialog at unmount, so the alert
|
|
166
|
+
// goes at once. The alert then counts as hidden again. StrictMode runs
|
|
167
|
+
// every cleanup once and then every effect, and the replay must present it
|
|
168
|
+
// again and place its hold.
|
|
169
|
+
useEffect(() => () => {
|
|
170
|
+
releaseHoldRef.current?.();
|
|
171
|
+
releaseHoldRef.current = null;
|
|
172
|
+
statusRef.current = 'hidden';
|
|
173
|
+
exitRef.current = null;
|
|
174
|
+
blurredByDismissalRef.current = null;
|
|
175
|
+
}, []);
|
|
176
|
+
|
|
177
|
+
// Effect: syncs the dialog's animations and its input hold with the alert's
|
|
178
|
+
// state: hidden, open or leaving.
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
const was = statusRef.current;
|
|
181
|
+
const now = !isPresented ? 'hidden' : isOpen ? 'open' : 'leaving';
|
|
182
|
+
statusRef.current = now;
|
|
183
|
+
if (!isEnabled || was === now) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const {
|
|
187
|
+
panel,
|
|
188
|
+
backdrop
|
|
189
|
+
} = animators;
|
|
190
|
+
const element = elementRef.current;
|
|
191
|
+
// One hold at a time on the alert: a new transition replaces the last.
|
|
192
|
+
const hold = (until, scope) => {
|
|
193
|
+
releaseHoldRef.current?.();
|
|
194
|
+
releaseHoldRef.current = element == null ? null : holdInput(element, {
|
|
195
|
+
until,
|
|
196
|
+
scope
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
if (now === 'open' && was === 'hidden') {
|
|
200
|
+
// The Dialog opened its modal in this flush, before this effect, and
|
|
201
|
+
// nothing has painted it yet. A finger's or a pen's input waits until
|
|
202
|
+
// the alert has entered. Keys and assistive technology stay live.
|
|
203
|
+
const scaleFrom = presentScaleFrom(element);
|
|
204
|
+
panel.set({
|
|
205
|
+
opacity: 0,
|
|
206
|
+
scale: scaleFrom
|
|
207
|
+
});
|
|
208
|
+
backdrop.set({
|
|
209
|
+
opacity: 0
|
|
210
|
+
});
|
|
211
|
+
const handle = present(panel, backdrop, scaleFrom, readThemeTimingOrInstant(element, ALERT_ENTRANCE_TOKENS));
|
|
212
|
+
hold(handle.finished, 'viewport');
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (now === 'open' && was === 'leaving') {
|
|
216
|
+
// Reopened during the exit: it fades back from where it is.
|
|
217
|
+
exitRef.current = null;
|
|
218
|
+
const handle = fadeFromHere(panel, backdrop, 1, readThemeTimingOrInstant(element, ALERT_ENTRANCE_TOKENS));
|
|
219
|
+
hold(handle.finished, 'viewport');
|
|
220
|
+
// The dismissal's hold is released and the content is live again. The
|
|
221
|
+
// action it took focus from gets focus back, unless focus went
|
|
222
|
+
// somewhere else meanwhile.
|
|
223
|
+
const blurred = blurredByDismissalRef.current;
|
|
224
|
+
blurredByDismissalRef.current = null;
|
|
225
|
+
const doc = element?.ownerDocument;
|
|
226
|
+
if (blurred?.isConnected === true && doc != null && (doc.activeElement == null || doc.activeElement === doc.body)) {
|
|
227
|
+
blurred.focus({
|
|
228
|
+
preventScroll: true
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (now === 'leaving') {
|
|
234
|
+
// During the dismissal no input reaches the alert: its content is inert
|
|
235
|
+
// and the hold's shield catches every touch.
|
|
236
|
+
const progress = readThemeTimingOrInstant(element, ALERT_EXIT_TOKENS);
|
|
237
|
+
exitMsRef.current = progress.duration * 1000;
|
|
238
|
+
const handle = fadeFromHere(panel, backdrop, 0, progress);
|
|
239
|
+
const focused = element?.ownerDocument.activeElement;
|
|
240
|
+
blurredByDismissalRef.current = focused instanceof HTMLElement && focused !== element && element?.contains(focused) === true ? focused : null;
|
|
241
|
+
hold(handle.finished, 'layer');
|
|
242
|
+
exitRef.current = handle;
|
|
243
|
+
void handle.finished.then(isDone => {
|
|
244
|
+
if (isDone && exitRef.current === handle) {
|
|
245
|
+
exitRef.current = null;
|
|
246
|
+
setIsLeaving(false);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
// Hidden: the exit ended and the Dialog closed its modal.
|
|
252
|
+
exitRef.current = null;
|
|
253
|
+
blurredByDismissalRef.current = null;
|
|
254
|
+
releaseHoldRef.current?.();
|
|
255
|
+
releaseHoldRef.current = null;
|
|
256
|
+
}, [animators, isEnabled, isOpen, isPresented]);
|
|
257
|
+
|
|
258
|
+
// Effect: a timer that hides the dialog once the exit has had its time. It
|
|
259
|
+
// covers an exit whose end is never reported (animations off, a detached
|
|
260
|
+
// element). An unmount during the exit removes the dialog at once, and the
|
|
261
|
+
// ref detaches the animators.
|
|
262
|
+
useEffect(() => {
|
|
263
|
+
if (!isLeaving) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const backstop = setTimeout(() => {
|
|
267
|
+
exitRef.current = null;
|
|
268
|
+
setIsLeaving(false);
|
|
269
|
+
}, exitMsRef.current + EXIT_BACKSTOP_MS);
|
|
270
|
+
return () => clearTimeout(backstop);
|
|
271
|
+
}, [isLeaving]);
|
|
272
|
+
return {
|
|
273
|
+
isPresented,
|
|
274
|
+
isDriving: isEnabled,
|
|
275
|
+
ref
|
|
276
|
+
};
|
|
277
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/Badge/Badge.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAa5C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/Badge/Badge.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAa5C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AA8J7C;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC5D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,EACpB,OAAmB,EACnB,KAAK,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,UAAU,+BA+CZ;yBAxDe,KAAK"}
|
package/dist/Badge/Badge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetPanel.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EASL,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM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eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D;;;OAGG;IACH,SAAS,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACzD,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC7D;AAyJD,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,KAAK,EACL,eAAe,EACf,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,SAAS,EACT,KAAK,EACL,QAAQ,EACR,MAAM,EACN,cAAsB,EACtB,cAAc,EACd,eAAe,EACf,qBAA4B,EAC5B,kBAA0B,EAC1B,SAAS,EACT,cAAc,EACd,WAAW,EACX,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,qBAAqB,+BA2iBvB;yBArkBe,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChatPasteAsToken.d.ts","sourceRoot":"","sources":["../../src/Chat/useChatPasteAsToken.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useChatPasteAsToken.d.ts","sourceRoot":"","sources":["../../src/Chat/useChatPasteAsToken.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAM7B,MAAM,WAAW,0BAA0B;IACzC,6DAA6D;IAC7D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;IAE1D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,iBAAiB,CAAC;CAC/C;AAED,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAC3E;AAqBD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAe,EACf,OAAwB,GACzB,EAAE,0BAA0B,GAAG,yBAAyB,CAexD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSpeechRecognition.d.ts","sourceRoot":"","sources":["../../src/Chat/useSpeechRecognition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSpeechRecognition.d.ts","sourceRoot":"","sources":["../../src/Chat/useSpeechRecognition.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,2BAA2B;IAC1C,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wEAAwE;IACxE,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,kDAAkD;IAClD,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,2DAA2D;IAC3D,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9D,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,8CAA8C;IAC9C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAC;IAC7D,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,sDAAsD;IACtD,WAAW,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,WAAW,EAAE,OAAO,CAAC;IACrB,kDAAkD;IAClD,UAAU,EAAE,OAAO,CAAC;IACpB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,2CAA2C;IAC3C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gCAAgC;IAChC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,qCAAqC;IACrC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AA8LD,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,2BAAgC,GACxC,0BAA0B,CAgN5B"}
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* providing start/stop/toggle controls, transcript state, and real-time
|
|
13
13
|
* volume level from the microphone via AudioContext analyser.
|
|
14
14
|
*/
|
|
15
|
-
import { useState, useCallback, useEffect,
|
|
15
|
+
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
16
16
|
import { useLocale } from "../i18n/index.js";
|
|
17
|
+
import { useIsHydrating } from "../hooks/useIsHydrating.js";
|
|
17
18
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
18
19
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
19
20
|
import english from "../i18n/generated-english/Chat/useSpeechRecognition.generated.js";
|
|
@@ -169,7 +170,10 @@ export function useSpeechRecognition(options = {}) {
|
|
|
169
170
|
transformTranscript
|
|
170
171
|
} = options;
|
|
171
172
|
const getAudioContext = useCallback(() => externalAudioContext ?? getDefaultAudioContext(), [externalAudioContext]);
|
|
172
|
-
|
|
173
|
+
|
|
174
|
+
// The server and the render that hydrates its markup report no support,
|
|
175
|
+
// so both draw the same tree.
|
|
176
|
+
const isSupported = !useIsHydrating() && getSpeechRecognition() != null;
|
|
173
177
|
const [isListening, setIsListening] = useState(false);
|
|
174
178
|
const [isSpeaking, setIsSpeaking] = useState(false);
|
|
175
179
|
const [volume, setVolume] = useState(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../src/CodeBlock/CodeBlock.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA6B5C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAW5C,OAAO,EAAc,KAAK,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AA6fxE,MAAM,WAAW,cAAe,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC/D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yJAAyJ;IACzJ,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM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AG,IAAI,CAAC;IACnB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,CACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,KACb;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAClD,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC5C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACrC;AA0UD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,QAAsB,EACtB,KAAK,EACL,gBAAuB,EACvB,cAAsB,EACtB,eAAmB,EACnB,cAAc,EACd,MAAc,EACd,aAAoB,EACpB,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAiB,EACjB,SAAS,EACT,aAAqB,EACrB,oBAAyB,EACzB,IAAW,EACX,KAAK,EAAE,SAAyB,EAChC,SAAkB,EAClB,SAAS,EAAE,eAAe,EAC1B,aAAsB,EACtB,WAAW,EACX,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,cAAc,qBAmWhB;yBA/Xe,SAAS"}
|
|
@@ -693,6 +693,12 @@ export function CodeBlock({
|
|
|
693
693
|
getContentProps
|
|
694
694
|
} = useScrollableArea({
|
|
695
695
|
axis: 'both',
|
|
696
|
+
// Nothing inside the code viewport sticks to an outer scroller, so the
|
|
697
|
+
// viewport stays a scroll container while its code fits. A long line, or
|
|
698
|
+
// code past `maxHeight`, then scrolls from the first paint: before script
|
|
699
|
+
// measures it, and in a page that never runs script, such as a rendered
|
|
700
|
+
// file. The Tab stop still follows measured overflow.
|
|
701
|
+
stickyContainment: 'always',
|
|
696
702
|
keyboardAccess: {
|
|
697
703
|
owner: 'viewport',
|
|
698
704
|
role: 'group',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlightRanges.d.ts","sourceRoot":"","sources":["../../src/CodeBlock/highlightRanges.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAc,SAAS,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"highlightRanges.d.ts","sourceRoot":"","sources":["../../src/CodeBlock/highlightRanges.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAc,SAAS,EAAC,MAAM,aAAa,CAAC;AA0GxD,UAAU,UAAU;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;CACtB;AAgDD,iBAAS,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAIjD;AA4BD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,SAAS,EAAE,GACtB,MAAM,IAAI,CAsHZ;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,SAAS,EAAE,EACvB,SAAS,EAAE,MAAM,GAChB,UAAU,EAAE,CAqBd;AAMD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,WAAW,EACf,UAAU,EAAE,SAAS,EAAE,GACtB,MAAM,IAAI,CA2DZ;AAeD;;GAEG;AACH,OAAO,EAAC,aAAa,EAAC,CAAC"}
|
|
@@ -61,7 +61,9 @@ function ensureDynamicHighlightType(tokenType) {
|
|
|
61
61
|
const name = CSS.escape(`astryx-${tokenType}`);
|
|
62
62
|
const colorVar = `var(${CSS.escape(`--color-syntax-${tokenType}`)}, currentColor)`;
|
|
63
63
|
try {
|
|
64
|
-
|
|
64
|
+
// The rule goes in the astryx-base layer, as the static rules do, so
|
|
65
|
+
// theme and app syntax colours win over it.
|
|
66
|
+
dynamicStyleSheet.insertRule(`@layer astryx-base { .astryx-code-block code::highlight(${name}), .astryx-codeeditor code::highlight(${name}) { color: ${colorVar}; } }`);
|
|
65
67
|
} catch {
|
|
66
68
|
// An engine that still refuses the rule costs that type its colour
|
|
67
69
|
// (ranges paint with currentColor) — never the whole code block.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlightStyles.d.ts","sourceRoot":"","sources":["../../src/CodeBlock/highlightStyles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"highlightStyles.d.ts","sourceRoot":"","sources":["../../src/CodeBlock/highlightStyles.ts"],"names":[],"mappings":"AAgFA;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAiB5C;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,4JAcd,CAAC"}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file highlightStyles.ts
|
|
5
5
|
* @input Syntax token defaults from domainTokens
|
|
6
|
-
* @output Injects ::highlight() CSS rules + fallback token values into the
|
|
6
|
+
* @output Injects ::highlight() CSS rules + fallback token values into the
|
|
7
|
+
* document head, inside the astryx-base cascade layer
|
|
7
8
|
* @position Shared utility; consumed by CodeBlock and CodeEditor
|
|
8
9
|
*
|
|
9
10
|
* SYNC: When modified, update:
|
|
@@ -15,7 +16,8 @@ import { syntaxTokenDefaults } from "../theme/index.js";
|
|
|
15
16
|
/**
|
|
16
17
|
* Build the fallback CSS custom properties from the syntax token defaults.
|
|
17
18
|
* These provide colors when no theme explicitly sets --color-syntax-* tokens.
|
|
18
|
-
*
|
|
19
|
+
* They sit in the astryx-base layer, so a theme's astryx-theme layer and
|
|
20
|
+
* unlayered app CSS override them in any load order.
|
|
19
21
|
*/
|
|
20
22
|
const FALLBACK_TOKENS = `:root {\n${Object.entries(syntaxTokenDefaults).map(([name, value]) => ` ${name}: ${value};`).join('\n')}\n}`;
|
|
21
23
|
|
|
@@ -86,7 +88,11 @@ export function ensureHighlightStyles() {
|
|
|
86
88
|
}
|
|
87
89
|
const style = document.createElement('style');
|
|
88
90
|
style.setAttribute('data-astryx-highlight-styles', '');
|
|
89
|
-
|
|
91
|
+
// An unlayered rule beats every layered rule, so the injected rules go in
|
|
92
|
+
// the astryx-base layer like the rest of Core's CSS. The order statement
|
|
93
|
+
// comes first, so this sheet cannot declare astryx-base before reset when
|
|
94
|
+
// it loads before Core's stylesheet.
|
|
95
|
+
style.textContent = `@layer reset, astryx-base, astryx-theme;\n@layer astryx-base {\n${HIGHLIGHT_STYLES}\n}`;
|
|
90
96
|
document.head.appendChild(style);
|
|
91
97
|
inserted = true;
|
|
92
98
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file ContextMenu.tsx
|
|
3
|
-
* @input Uses React, StyleX, useLayer, shared layer dismissal,
|
|
4
|
-
* useListFocus, and the
|
|
3
|
+
* @input Uses React, StyleX, useLayer, shared layer dismissal, the lazily
|
|
4
|
+
* loaded menu sheet (DropdownMenu/lazyMenuBottomSheet), useListFocus, and the
|
|
5
|
+
* shared menu-presentation resolver
|
|
5
6
|
* @output Exports ContextMenu with cursor-popover and touch-sheet presentations
|
|
6
7
|
* @position Core implementation; consumed by index.ts
|
|
7
8
|
*
|