@hanzogui/kitchen-sink 3.0.5
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/.detoxrc.js +130 -0
- package/.env.production +2 -0
- package/.maestro/config.yaml +4 -0
- package/.maestro/flows/shorthand-variables.yaml +23 -0
- package/.watchmanconfig +1 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/app.json +43 -0
- package/assets/adaptive-icon.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/icon.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.js +25 -0
- package/e2e/CompilerExtraction.test.ts +147 -0
- package/e2e/GroupPressNative.test.ts +167 -0
- package/e2e/MediaQueryGtMd.test.ts +71 -0
- package/e2e/NativePortal.test.ts +113 -0
- package/e2e/PointerEvents.test.ts +116 -0
- package/e2e/PressStyleNative.noRngh.test.ts +191 -0
- package/e2e/PressStyleNative.test.ts +231 -0
- package/e2e/SafeArea.test.ts +57 -0
- package/e2e/SelectAndroidOnPress.test.ts +181 -0
- package/e2e/SelectRemount.test.ts +137 -0
- package/e2e/SheetDragResist.test.ts +370 -0
- package/e2e/SheetKeyboardDrag.test.ts +249 -0
- package/e2e/SheetScrollableDrag.test.ts +560 -0
- package/e2e/ShorthandVariables.test.ts +53 -0
- package/e2e/ThemeChangeBasic.test.ts +123 -0
- package/e2e/ThemeMutation.test.ts +80 -0
- package/e2e/check-rngh-status.test.ts +31 -0
- package/e2e/jest.config.js +19 -0
- package/e2e/utils/colors.ts +75 -0
- package/e2e/utils/navigation.ts +53 -0
- package/eas.json +22 -0
- package/flows/AlertDialog.yaml +17 -0
- package/flows/OpenApp.yaml +25 -0
- package/flows/Select.yaml +13 -0
- package/flows/Sheet.yaml +12 -0
- package/flows/Tabs.yaml +13 -0
- package/flows/Toast.yaml +14 -0
- package/flows/WarmUp.yaml +24 -0
- package/index.html +21 -0
- package/index.js +17 -0
- package/metro.config.js +64 -0
- package/next-router-shim.ts +9 -0
- package/package.json +118 -0
- package/plans/toast-2.md +471 -0
- package/playwright.config.ts +71 -0
- package/plugins/expo-modules-core-swift6.js +76 -0
- package/pod-install.sh +7 -0
- package/public/favicon.svg +70 -0
- package/public/fonts/inter.css +15 -0
- package/public/fonts/noto-cn.otf +0 -0
- package/public/gui-icon.svg +68 -0
- package/run-detox.sh +230 -0
- package/run-native-tests.sh +4 -0
- package/run-tests-parallel.ts +195 -0
- package/screenshots/Screenshotter.test.tsx +48 -0
- package/src/AnimationDemos.tsx +131 -0
- package/src/App.native.tsx +121 -0
- package/src/App.tsx +121 -0
- package/src/Navigation.tsx +98 -0
- package/src/Sandbox.tsx +87 -0
- package/src/TestDynamicEval.tsx +33 -0
- package/src/TestNativeSheet.tsx +100 -0
- package/src/components/TimedRender.tsx +18 -0
- package/src/constants/test-ids.ts +52 -0
- package/src/features/demos/demo-screen.tsx +72 -0
- package/src/features/home/ColorSchemeListItem.tsx +41 -0
- package/src/features/home/TestBuildAButton.tsx +102 -0
- package/src/features/home/TestSeparator.tsx +0 -0
- package/src/features/home/screen.tsx +285 -0
- package/src/features/testcases/screen.tsx +59 -0
- package/src/features/testcases/test-screen.tsx +50 -0
- package/src/generatedV5Theme.ts +112 -0
- package/src/gui.config.ts +411 -0
- package/src/guy.png +0 -0
- package/src/index.tsx +6 -0
- package/src/provider/index.tsx +18 -0
- package/src/test-gui-stack.tsx +11 -0
- package/src/test.tsx +3 -0
- package/src/useKitchenSinkTheme.tsx +15 -0
- package/src/usecases/ActionsSheetComparison.tsx +194 -0
- package/src/usecases/AnimatePresenceEnterExitCase.tsx +255 -0
- package/src/usecases/AnimatePresenceExitTest.tsx +69 -0
- package/src/usecases/AnimatedByProp.tsx +39 -0
- package/src/usecases/AnimationComprehensiveCase.tsx +2515 -0
- package/src/usecases/AnimationValueLoggingCase.tsx +526 -0
- package/src/usecases/AnimationsWithMediaQueriesCase.tsx +110 -0
- package/src/usecases/Benchmark.tsx +148 -0
- package/src/usecases/BenchmarkSelect.tsx +34 -0
- package/src/usecases/ButtonCircular.tsx +3 -0
- package/src/usecases/ButtonCustom.tsx +33 -0
- package/src/usecases/ButtonIconColor.tsx +18 -0
- package/src/usecases/ButtonInverse.tsx +30 -0
- package/src/usecases/ButtonUnstyled.tsx +31 -0
- package/src/usecases/CheckboxDisabledOnPress.tsx +62 -0
- package/src/usecases/ClickDuringEnterCase.tsx +59 -0
- package/src/usecases/CodeExamplesInput.tsx +9 -0
- package/src/usecases/ColorTokenFallback.tsx +52 -0
- package/src/usecases/CompilerExtraction.tsx +380 -0
- package/src/usecases/ComplexVariants.tsx +164 -0
- package/src/usecases/CrashAdaptSheet.tsx +98 -0
- package/src/usecases/CustomStyledAnimatedPopover.tsx +42 -0
- package/src/usecases/CustomStyledAnimatedTooltip.tsx +72 -0
- package/src/usecases/DOMNodeAPIs.tsx +154 -0
- package/src/usecases/DialogFocusScopeCase.tsx +277 -0
- package/src/usecases/DialogFocusScopeDebug.tsx +85 -0
- package/src/usecases/DialogNestedCase.tsx +121 -0
- package/src/usecases/DialogOpenControlled.tsx +49 -0
- package/src/usecases/DialogPointerEventsCase.tsx +58 -0
- package/src/usecases/DialogScopedCase.tsx +106 -0
- package/src/usecases/DialogSheetAdaptCase.tsx +178 -0
- package/src/usecases/DialogSheetAdaptResizeCase.tsx +98 -0
- package/src/usecases/DismissLayerStackingCase.tsx +223 -0
- package/src/usecases/DriverDisableAnimationPropsCase.tsx +44 -0
- package/src/usecases/Example.tsx +10 -0
- package/src/usecases/ExitCompletionCase.tsx +713 -0
- package/src/usecases/FocusVisibleButton.tsx +14 -0
- package/src/usecases/FocusVisibleButtonPointer.tsx +13 -0
- package/src/usecases/FocusVisibleButtonWithFocusStyle.tsx +16 -0
- package/src/usecases/FocusWithinCase.tsx +55 -0
- package/src/usecases/FontTokensInVariants.tsx +14 -0
- package/src/usecases/FormButtonTypeCase.tsx +34 -0
- package/src/usecases/GlobalScopedTriggerIsolationCase.tsx +178 -0
- package/src/usecases/GroupHoverMobile.tsx +39 -0
- package/src/usecases/GroupPressInVariant.tsx +92 -0
- package/src/usecases/GroupPressNative.tsx +200 -0
- package/src/usecases/GroupProp.tsx +96 -0
- package/src/usecases/GroupPseudoVariantOverride.tsx +56 -0
- package/src/usecases/GroupUseCases.tsx +94 -0
- package/src/usecases/HeightMediaQueryOverrideCase.tsx +183 -0
- package/src/usecases/InputAutoFocusAfterMenuCase.tsx +105 -0
- package/src/usecases/InputAutoFocusStyledCase.tsx +39 -0
- package/src/usecases/KeyboardControllerTest.tsx +146 -0
- package/src/usecases/ListItem.tsx +123 -0
- package/src/usecases/MediaQueriesV5.tsx +137 -0
- package/src/usecases/MediaQueryGtMd.tsx +73 -0
- package/src/usecases/MenuAboveDialogCase.tsx +75 -0
- package/src/usecases/MenuAccessibilityCase.tsx +133 -0
- package/src/usecases/MenuAnimatePositionCase.tsx +41 -0
- package/src/usecases/MenuArrowAnimatePresenceCase.tsx +98 -0
- package/src/usecases/MenuAsChildPositionCase.tsx +24 -0
- package/src/usecases/MenuAutoResizeCase.tsx +57 -0
- package/src/usecases/MenuBottomCase.tsx +55 -0
- package/src/usecases/MenuFocusLeaveCase.tsx +135 -0
- package/src/usecases/MenuHighlightCase.tsx +44 -0
- package/src/usecases/MenuItemFocusCase.tsx +79 -0
- package/src/usecases/MenuItemPseudoOverrideCase.tsx +270 -0
- package/src/usecases/MenuMultiTriggerCase.tsx +47 -0
- package/src/usecases/MenuOverflowCase.tsx +60 -0
- package/src/usecases/MenuSubCase.tsx +223 -0
- package/src/usecases/MenuSubLeftCase.tsx +178 -0
- package/src/usecases/MenuSubNestedPositionCase.tsx +171 -0
- package/src/usecases/MenuSubStyledCase.tsx +145 -0
- package/src/usecases/MenuThemeCase.tsx +50 -0
- package/src/usecases/MenuUnstyledCase.tsx +52 -0
- package/src/usecases/MultiDriverAnimation.tsx +118 -0
- package/src/usecases/NativePortalTest.tsx +179 -0
- package/src/usecases/NewInputBasic.tsx +16 -0
- package/src/usecases/NewInputEvents.tsx +29 -0
- package/src/usecases/NonGuiTextStyledType.tsx +23 -0
- package/src/usecases/OnLayoutCase.tsx +134 -0
- package/src/usecases/OnLayoutScaleCase.tsx +88 -0
- package/src/usecases/OnLayoutStressCase.tsx +353 -0
- package/src/usecases/OpacityModifierCase.tsx +113 -0
- package/src/usecases/OverlayStyled.tsx +66 -0
- package/src/usecases/ParagraphSpanFontInheritance.tsx +53 -0
- package/src/usecases/PlaceholderTextColor.tsx +20 -0
- package/src/usecases/PointerEventsCase.tsx +100 -0
- package/src/usecases/PopoverAndMenuMultiTriggerCase.tsx +138 -0
- package/src/usecases/PopoverCase.tsx +222 -0
- package/src/usecases/PopoverContentStyledPlusAnimations.tsx +44 -0
- package/src/usecases/PopoverFocusScopeCase.tsx +171 -0
- package/src/usecases/PopoverHoverableCase.tsx +167 -0
- package/src/usecases/PopoverHoverableDisableClickCase.tsx +118 -0
- package/src/usecases/PopoverHoverableRapidCase.tsx +103 -0
- package/src/usecases/PopoverHoverableScopedCase.tsx +135 -0
- package/src/usecases/PopoverScopedCase.tsx +76 -0
- package/src/usecases/PopoverTriggerIsolationCase.tsx +80 -0
- package/src/usecases/PressStyleNative.tsx +143 -0
- package/src/usecases/PseudoStyleMerge.tsx +25 -0
- package/src/usecases/PseudoTransitionCase.tsx +174 -0
- package/src/usecases/RawAnimatedValueCase.tsx +231 -0
- package/src/usecases/RemoveScrollCase.tsx +66 -0
- package/src/usecases/RenderPropCase.tsx +263 -0
- package/src/usecases/SafeAreaCase.tsx +236 -0
- package/src/usecases/ScrollViewRefCase.tsx +88 -0
- package/src/usecases/SecondPage.tsx +5 -0
- package/src/usecases/SelectAndroidOnPress.tsx +129 -0
- package/src/usecases/SelectFocusScopeCase.tsx +270 -0
- package/src/usecases/SelectRemount.tsx +136 -0
- package/src/usecases/Shadows.tsx +5 -0
- package/src/usecases/SheetAnimationCase.tsx +155 -0
- package/src/usecases/SheetDragCase.tsx +183 -0
- package/src/usecases/SheetDragResistCase.tsx +433 -0
- package/src/usecases/SheetDragResistCase.web.tsx +359 -0
- package/src/usecases/SheetKeyboardDragCase.tsx +328 -0
- package/src/usecases/SheetKeyboardFitContentCase.tsx +165 -0
- package/src/usecases/SheetOnAnimationCompleteCase.tsx +54 -0
- package/src/usecases/SheetScrollLockCase.tsx +166 -0
- package/src/usecases/SheetScrollableDrag.tsx +249 -0
- package/src/usecases/SheetSnapPointsFitCase.tsx +393 -0
- package/src/usecases/ShorthandVariables.tsx +49 -0
- package/src/usecases/SlowThemeReRender.tsx +48 -0
- package/src/usecases/SpinnerCustomColors.tsx +34 -0
- package/src/usecases/StackZIndex.tsx +82 -0
- package/src/usecases/StressPage.tsx +301 -0
- package/src/usecases/StylePlatform.tsx +30 -0
- package/src/usecases/StyleProp.tsx +29 -0
- package/src/usecases/StyledAnchor.tsx +27 -0
- package/src/usecases/StyledButtonAnimationAuto.tsx +99 -0
- package/src/usecases/StyledButtonTheme.tsx +63 -0
- package/src/usecases/StyledButtonVariantPseudo.tsx +25 -0
- package/src/usecases/StyledButtonVariantPseudoMerge.tsx +77 -0
- package/src/usecases/StyledCheckboxTheme.tsx +23 -0
- package/src/usecases/StyledContextColor.tsx +246 -0
- package/src/usecases/StyledContextTokens.tsx +147 -0
- package/src/usecases/StyledHOCNamed.tsx +20 -0
- package/src/usecases/StyledHtmlCase.tsx +144 -0
- package/src/usecases/StyledIconColor.tsx +19 -0
- package/src/usecases/StyledInputFocusStyle.tsx +21 -0
- package/src/usecases/StyledInputOnFocus.tsx +30 -0
- package/src/usecases/StyledMediaQueryMerge.tsx +95 -0
- package/src/usecases/StyledOverridePsuedo.tsx +26 -0
- package/src/usecases/StyledRNW.tsx +61 -0
- package/src/usecases/StyledStyleableInputOnFocus.tsx +34 -0
- package/src/usecases/StyledStyleableInputVariant.tsx +48 -0
- package/src/usecases/StyledStyledStyleableInputOnFocus.tsx +36 -0
- package/src/usecases/StyledVariantTextColor.tsx +25 -0
- package/src/usecases/StyledViewOnFocus.tsx +32 -0
- package/src/usecases/TabHoverAnimationCase.tsx +212 -0
- package/src/usecases/TextNestedInheritance.tsx +80 -0
- package/src/usecases/ThemeChange.tsx +100 -0
- package/src/usecases/ThemeChangeBasic.tsx +52 -0
- package/src/usecases/ThemeComponentResolution.tsx +119 -0
- package/src/usecases/ThemeConditionalName.tsx +31 -0
- package/src/usecases/ThemeMediaAnimationCase.tsx +39 -0
- package/src/usecases/ThemeMutation.tsx +86 -0
- package/src/usecases/ThemeNested.tsx +103 -0
- package/src/usecases/ThemeReset.tsx +62 -0
- package/src/usecases/ThemeShallowCase.tsx +83 -0
- package/src/usecases/ToastCase.tsx +46 -0
- package/src/usecases/ToggleGroupActiveProps.tsx +40 -0
- package/src/usecases/ToggleGroupXGroupCase.tsx +104 -0
- package/src/usecases/TooltipAnimationCase.tsx +99 -0
- package/src/usecases/TooltipCase.tsx +32 -0
- package/src/usecases/TooltipGlobalPatternCase.tsx +83 -0
- package/src/usecases/TooltipGroupCase.tsx +102 -0
- package/src/usecases/TooltipMultiTriggerCase.tsx +88 -0
- package/src/usecases/TooltipPositionJumpCase.tsx +91 -0
- package/src/usecases/TooltipTriggerInlineCase.tsx +60 -0
- package/src/usecases/TransformMediaQueryMerge.tsx +98 -0
- package/src/usecases/UseCases.tsx +409 -0
- package/src/usecases/UseTheme.tsx +41 -0
- package/src/usecases/V5ThemeBuilderOutput.tsx +231 -0
- package/src/usecases/VariantFontFamily.tsx +25 -0
- package/src/usecases/VariantsOrder.tsx +117 -0
- package/src/usecases/ZIndex.tsx +155 -0
- package/src/usecases/helpers.tsx +44 -0
- package/src/usecases/index.native.ts +122 -0
- package/src/usecases/index.ts +3 -0
- package/src/usecases/index.web.ts +177 -0
- package/tests/AnimatePresenceEnterExit.animated.test.tsx +176 -0
- package/tests/AnimatedByProp.animated.test.tsx +138 -0
- package/tests/AnimationBehavior.animated.test.tsx +543 -0
- package/tests/AnimationTiming.animated.test.tsx +195 -0
- package/tests/AnimationsWithMediaQueries.animated.test.tsx +154 -0
- package/tests/BuildAButton.test.tsx +87 -0
- package/tests/ButtonCircular.test.tsx +17 -0
- package/tests/ButtonCustom.test.tsx +17 -0
- package/tests/ButtonIconColor.test.tsx +23 -0
- package/tests/ButtonUnstyled.test.tsx +56 -0
- package/tests/ClickDuringEnter.animated.test.tsx +174 -0
- package/tests/ColorTokenFallback.test.tsx +45 -0
- package/tests/DOMNodeAPIs.test.tsx +161 -0
- package/tests/DialogFocusScope.animated.test.tsx +309 -0
- package/tests/DialogNested.test.tsx +128 -0
- package/tests/DialogOpenControlled.test.tsx +42 -0
- package/tests/DialogPointerEvents.animated.test.tsx +108 -0
- package/tests/DialogScoped.test.tsx +137 -0
- package/tests/DialogSheetAdapt.test.tsx +68 -0
- package/tests/DialogSheetAdaptResize.test.tsx +161 -0
- package/tests/DismissLayerStacking.test.tsx +292 -0
- package/tests/DriverDisableAnimationProps.animated.test.tsx +157 -0
- package/tests/ExitCompletion.animated.test.tsx +425 -0
- package/tests/ExitTimingCheck.animated.test.ts +34 -0
- package/tests/FocusVisibleButton.test.tsx +41 -0
- package/tests/FocusVisibleButtonPointerFocus.test.tsx +23 -0
- package/tests/FocusVisibleButtonPointerFocusWithFocusStyle.test.tsx +40 -0
- package/tests/FocusWithinStyle.animated.test.tsx +66 -0
- package/tests/FocusWithinStyle.test.tsx +60 -0
- package/tests/FormButtonType.test.tsx +42 -0
- package/tests/GlobalScopedTriggerIsolation.test.tsx +89 -0
- package/tests/GroupHoverMobile.test.tsx +52 -0
- package/tests/GroupPressInVariant.test.tsx +82 -0
- package/tests/GroupProp.test.tsx +30 -0
- package/tests/GroupPseudoVariantOverride.test.tsx +57 -0
- package/tests/GroupUseCases.test.tsx +111 -0
- package/tests/GuiSiteMotion.test.ts +481 -0
- package/tests/HeightMediaQueryOverride.test.tsx +112 -0
- package/tests/InputAutoFocusAfterMenu.test.tsx +55 -0
- package/tests/InputAutoFocusStyled.test.tsx +22 -0
- package/tests/ListItem.test.tsx +129 -0
- package/tests/MediaQueriesV5.test.tsx +113 -0
- package/tests/MediaQueryGtMd.test.tsx +84 -0
- package/tests/MenuAboveDialog.test.tsx +108 -0
- package/tests/MenuAccessibility.test.tsx +346 -0
- package/tests/MenuAnimatePosition.animated.test.tsx +57 -0
- package/tests/MenuArrowAnimatePresence.animated.test.tsx +71 -0
- package/tests/MenuAsChildPosition.test.tsx +16 -0
- package/tests/MenuAutoResize.test.tsx +54 -0
- package/tests/MenuFocusLeave.test.tsx +181 -0
- package/tests/MenuHighlight.test.tsx +165 -0
- package/tests/MenuHoverKeyboardBugs.test.tsx +252 -0
- package/tests/MenuItemFocus.test.tsx +59 -0
- package/tests/MenuItemPseudoOverride.test.tsx +231 -0
- package/tests/MenuMultiTrigger.test.tsx +101 -0
- package/tests/MenuOverflow.test.tsx +93 -0
- package/tests/MenuStayInFrame.test.tsx +102 -0
- package/tests/MenuSubKeyboardFocus.test.tsx +220 -0
- package/tests/MenuSubLeftSafePolygon.test.tsx +88 -0
- package/tests/MenuSubNestedPosition.test.tsx +48 -0
- package/tests/MenuSubSafePolygon.test.tsx +97 -0
- package/tests/MenuSubStyled.test.tsx +40 -0
- package/tests/MenuTheme.test.tsx +34 -0
- package/tests/MenuUnstyled.test.tsx +56 -0
- package/tests/MultiDriverAnimation.test.tsx +207 -0
- package/tests/NewInputBasic.test.tsx +50 -0
- package/tests/NewInputEvents.test.tsx +55 -0
- package/tests/OnLayout.test.tsx +163 -0
- package/tests/OnLayoutScale.test.tsx +100 -0
- package/tests/OnLayoutStress.test.tsx +304 -0
- package/tests/ParagraphSpanFontInheritance.test.tsx +73 -0
- package/tests/PointerEvents.test.tsx +123 -0
- package/tests/Popover.animated.test.tsx +234 -0
- package/tests/PopoverAndMenuMultiTrigger.test.tsx +184 -0
- package/tests/PopoverAnimatePosition.animated.test.tsx +51 -0
- package/tests/PopoverClickDuringEnter.animated.test.tsx +197 -0
- package/tests/PopoverFocusScope.test.tsx +242 -0
- package/tests/PopoverHoverable.test.tsx +383 -0
- package/tests/PopoverHoverableDisableClick.test.tsx +106 -0
- package/tests/PopoverHoverableRapid.test.tsx +129 -0
- package/tests/PopoverHoverableReposition.test.tsx +111 -0
- package/tests/PopoverHoverableScoped.animated.test.tsx +103 -0
- package/tests/PopoverHoverableStress.test.tsx +169 -0
- package/tests/PopoverInitialPosition.animated.test.tsx +82 -0
- package/tests/PopoverMiddlewareSkipRegression.animated.test.tsx +221 -0
- package/tests/PopoverScoped.test.tsx +128 -0
- package/tests/PopoverScopedPositionGlitch.animated.test.tsx +184 -0
- package/tests/PopoverTriggerIsolation.test.tsx +62 -0
- package/tests/PseudoTransition.animated.test.tsx +319 -0
- package/tests/RawAnimatedValue.test.tsx +147 -0
- package/tests/RemoveScroll.test.tsx +223 -0
- package/tests/RenderProp.test.tsx +293 -0
- package/tests/ScrollViewRef.test.tsx +39 -0
- package/tests/SelectClickHold.test.tsx +147 -0
- package/tests/SelectFocusScope.test.tsx +176 -0
- package/tests/SelectInnerPositioning.test.tsx +82 -0
- package/tests/SelectKeyboardNav.test.tsx +173 -0
- package/tests/SelectPositioning.test.tsx +56 -0
- package/tests/SelectTypeahead.test.tsx +63 -0
- package/tests/Shadows.test.tsx +14 -0
- package/tests/SheetAnimation.animated.test.tsx +413 -0
- package/tests/SheetDrag.animated.test.tsx +223 -0
- package/tests/SheetDragResist.animated.test.tsx +393 -0
- package/tests/SheetOnAnimationComplete.animated.test.tsx +62 -0
- package/tests/SheetScrollLock.animated.test.tsx +287 -0
- package/tests/SheetScrollableDrag.animated.test.tsx +1264 -0
- package/tests/SheetSnapPointsFit.animated.test.tsx +259 -0
- package/tests/ShorthandVariables.test.tsx +44 -0
- package/tests/SpinnerCustomColors.test.tsx +67 -0
- package/tests/StackZIndex.test.tsx +51 -0
- package/tests/StressPagePerf.test.tsx +76 -0
- package/tests/StylePlatform.test.tsx +38 -0
- package/tests/StyleProp.test.tsx +20 -0
- package/tests/StyledAnchor.test.tsx +17 -0
- package/tests/StyledButtonTheme.test.tsx +22 -0
- package/tests/StyledButtonVariantPseudo.test.tsx +20 -0
- package/tests/StyledButtonVariantPseudoMerge.animated.test.tsx +33 -0
- package/tests/StyledCheckboxTheme.test.tsx +16 -0
- package/tests/StyledContextColor.test.tsx +119 -0
- package/tests/StyledContextTokens.test.tsx +56 -0
- package/tests/StyledHOCNamed.test.tsx +16 -0
- package/tests/StyledHtml.test.tsx +161 -0
- package/tests/StyledIconColor.test.tsx +32 -0
- package/tests/StyledInputFocusStyle.test.tsx +19 -0
- package/tests/StyledInputOnFocus.test.tsx +27 -0
- package/tests/StyledMediaQueryMerge.test.tsx +66 -0
- package/tests/StyledRNW.test.tsx +17 -0
- package/tests/StyledStyleableInputOnFocus.test.tsx +27 -0
- package/tests/StyledStyleableInputVariant.test.tsx +22 -0
- package/tests/StyledStyledStyleableInputOnFocus.test.tsx +27 -0
- package/tests/StyledVariantTextColor.test.tsx +24 -0
- package/tests/StyledViewOnFocus.test.tsx +27 -0
- package/tests/TabHoverAnimation.animated.test.tsx +468 -0
- package/tests/TabHoverPositionSmooth.animated.test.tsx +129 -0
- package/tests/TextNestedInheritance.test.tsx +93 -0
- package/tests/ThemeChange.test.tsx +70 -0
- package/tests/ThemeComponentResolution.test.tsx +82 -0
- package/tests/ThemeConditionalName.test.tsx +34 -0
- package/tests/ThemeMediaAnimation.test.tsx +65 -0
- package/tests/ThemeNested.test.tsx +141 -0
- package/tests/ThemeReset.test.tsx +63 -0
- package/tests/ThemeShallow.test.tsx +95 -0
- package/tests/Toast.test.tsx +106 -0
- package/tests/ToggleGroup.test.tsx +61 -0
- package/tests/ToggleGroupActiveProps.test.tsx +38 -0
- package/tests/ToggleGroupXGroup.test.tsx +172 -0
- package/tests/TooltipAnimation.animated.test.tsx +260 -0
- package/tests/TooltipEnterInterrupt.animated.test.tsx +76 -0
- package/tests/TooltipGlobalPattern.animated.test.tsx +208 -0
- package/tests/TooltipGroup.animated.test.tsx +79 -0
- package/tests/TooltipMultiTrigger.test.tsx +116 -0
- package/tests/TooltipPositionJump.animated.test.tsx +229 -0
- package/tests/TooltipPositionJumpNotes.md +219 -0
- package/tests/TooltipRapidSwitch.animated.test.tsx +399 -0
- package/tests/TooltipTriggerInline.test.tsx +65 -0
- package/tests/TransformMediaQueryMerge.test.tsx +104 -0
- package/tests/TransitionEnterExit.animated.test.tsx +311 -0
- package/tests/UseTheme.test.tsx +16 -0
- package/tests/V5ThemeBuilderOutput.test.tsx +164 -0
- package/tests/VariantFontFamily.test.tsx +11 -0
- package/tests/VariantsOrder.test.tsx +53 -0
- package/tests/_debug_position.mjs +52 -0
- package/tests/test-utils.ts +106 -0
- package/tests/utils.tsx +54 -0
- package/tsconfig.json +45 -0
- package/vite-env.d.ts +1 -0
- package/vite.config.ts +14 -0
- package/webpack.config.js +139 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { X } from '@hanzogui/lucide-icons-2'
|
|
2
|
+
import {
|
|
3
|
+
Adapt,
|
|
4
|
+
Button,
|
|
5
|
+
Dialog,
|
|
6
|
+
Paragraph,
|
|
7
|
+
Sheet,
|
|
8
|
+
Unspaced,
|
|
9
|
+
XStack,
|
|
10
|
+
YStack,
|
|
11
|
+
} from '@hanzo/gui'
|
|
12
|
+
|
|
13
|
+
export function DialogNestedCase() {
|
|
14
|
+
return (
|
|
15
|
+
<YStack gap="$4" justifyContent="center" alignItems="center" padding="$4">
|
|
16
|
+
<DialogInstance />
|
|
17
|
+
</YStack>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function DialogInstance({ level = 1 }: { level?: number }) {
|
|
22
|
+
const testId = level === 1 ? 'parent' : level === 2 ? 'nested' : `level-${level}`
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Dialog modal>
|
|
26
|
+
<Dialog.Trigger asChild>
|
|
27
|
+
<Button data-testid={`${testId}-dialog-trigger`}>
|
|
28
|
+
<Button.Text>Show Dialog (Level {level})</Button.Text>
|
|
29
|
+
</Button>
|
|
30
|
+
</Dialog.Trigger>
|
|
31
|
+
|
|
32
|
+
<Adapt when="maxMd" platform="touch">
|
|
33
|
+
<Sheet
|
|
34
|
+
transition="medium"
|
|
35
|
+
zIndex={200000}
|
|
36
|
+
modal
|
|
37
|
+
dismissOnSnapToBottom
|
|
38
|
+
unmountChildrenWhenHidden
|
|
39
|
+
>
|
|
40
|
+
<Sheet.Frame padding="$4" gap="$4">
|
|
41
|
+
<Adapt.Contents />
|
|
42
|
+
</Sheet.Frame>
|
|
43
|
+
<Sheet.Overlay
|
|
44
|
+
transition="lazy"
|
|
45
|
+
enterStyle={{ opacity: 0 }}
|
|
46
|
+
exitStyle={{ opacity: 0 }}
|
|
47
|
+
/>
|
|
48
|
+
</Sheet>
|
|
49
|
+
</Adapt>
|
|
50
|
+
|
|
51
|
+
<Dialog.Portal>
|
|
52
|
+
<Dialog.Overlay
|
|
53
|
+
key="overlay"
|
|
54
|
+
transition="quick"
|
|
55
|
+
opacity={0.5}
|
|
56
|
+
enterStyle={{ opacity: 0 }}
|
|
57
|
+
exitStyle={{ opacity: 0 }}
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
<Dialog.Content
|
|
61
|
+
bordered
|
|
62
|
+
elevate
|
|
63
|
+
key="content"
|
|
64
|
+
transition={[
|
|
65
|
+
'quick',
|
|
66
|
+
{
|
|
67
|
+
opacity: {
|
|
68
|
+
overshootClamping: true,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
]}
|
|
72
|
+
enterStyle={{ x: 0, y: -20, opacity: 0, scale: 0.9 }}
|
|
73
|
+
exitStyle={{ x: 0, y: 10, opacity: 0, scale: 0.95 }}
|
|
74
|
+
width={450}
|
|
75
|
+
padding="$6"
|
|
76
|
+
gap="$4"
|
|
77
|
+
>
|
|
78
|
+
<YStack data-testid={`${testId}-dialog-content`} gap="$4">
|
|
79
|
+
<Dialog.Title>Dialog Level {level}</Dialog.Title>
|
|
80
|
+
<Dialog.Description>
|
|
81
|
+
This is dialog level {level}.{' '}
|
|
82
|
+
{level < 3 ? 'You can open another dialog inside.' : ''}
|
|
83
|
+
</Dialog.Description>
|
|
84
|
+
|
|
85
|
+
<Paragraph data-testid={`${testId}-dialog-paragraph`}>
|
|
86
|
+
Content for level {level}
|
|
87
|
+
</Paragraph>
|
|
88
|
+
|
|
89
|
+
<XStack alignSelf="flex-end" gap="$4">
|
|
90
|
+
{/* Nested dialog - only show if level is less than 3 */}
|
|
91
|
+
{level < 3 && <DialogInstance level={level + 1} />}
|
|
92
|
+
|
|
93
|
+
<Dialog.Close displayWhenAdapted asChild>
|
|
94
|
+
<Button
|
|
95
|
+
theme="blue"
|
|
96
|
+
aria-label="Close"
|
|
97
|
+
data-testid={`${testId}-dialog-close`}
|
|
98
|
+
>
|
|
99
|
+
Close
|
|
100
|
+
</Button>
|
|
101
|
+
</Dialog.Close>
|
|
102
|
+
</XStack>
|
|
103
|
+
|
|
104
|
+
<Unspaced>
|
|
105
|
+
<Dialog.Close asChild>
|
|
106
|
+
<Button
|
|
107
|
+
position="absolute"
|
|
108
|
+
right="$3"
|
|
109
|
+
top="$3"
|
|
110
|
+
size="$2"
|
|
111
|
+
circular
|
|
112
|
+
icon={X}
|
|
113
|
+
/>
|
|
114
|
+
</Dialog.Close>
|
|
115
|
+
</Unspaced>
|
|
116
|
+
</YStack>
|
|
117
|
+
</Dialog.Content>
|
|
118
|
+
</Dialog.Portal>
|
|
119
|
+
</Dialog>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Button, Dialog, View, YStack } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Test case for issue #3565
|
|
5
|
+
* This tests that Dialog works when controlled with open={true}
|
|
6
|
+
* In JSDOM (Jest), this would fail with "node.show is not a function"
|
|
7
|
+
* because JSDOM doesn't implement the HTMLDialogElement.show() method
|
|
8
|
+
*/
|
|
9
|
+
export function DialogOpenControlled() {
|
|
10
|
+
return (
|
|
11
|
+
<YStack padding="$4" gap="$4">
|
|
12
|
+
{/* Dialog that starts open - this is the problematic case in JSDOM */}
|
|
13
|
+
<Dialog open={true} modal>
|
|
14
|
+
<Dialog.Trigger asChild>
|
|
15
|
+
<Button data-testid="dialog-trigger">Show Dialog</Button>
|
|
16
|
+
</Dialog.Trigger>
|
|
17
|
+
<Dialog.Portal>
|
|
18
|
+
<Dialog.Overlay
|
|
19
|
+
key="overlay"
|
|
20
|
+
transition="quick"
|
|
21
|
+
opacity={0.5}
|
|
22
|
+
enterStyle={{ opacity: 0 }}
|
|
23
|
+
exitStyle={{ opacity: 0 }}
|
|
24
|
+
/>
|
|
25
|
+
<Dialog.Content
|
|
26
|
+
key="content"
|
|
27
|
+
bordered
|
|
28
|
+
elevate
|
|
29
|
+
transition="quick"
|
|
30
|
+
enterStyle={{ x: 0, y: -20, opacity: 0, scale: 0.9 }}
|
|
31
|
+
exitStyle={{ x: 0, y: 10, opacity: 0, scale: 0.95 }}
|
|
32
|
+
width={400}
|
|
33
|
+
padding="$6"
|
|
34
|
+
gap="$4"
|
|
35
|
+
>
|
|
36
|
+
<Dialog.Title>Dialog Test</Dialog.Title>
|
|
37
|
+
<Dialog.Description>
|
|
38
|
+
This dialog is controlled with open=true
|
|
39
|
+
</Dialog.Description>
|
|
40
|
+
<View data-testid="dialog-content">Hiya!</View>
|
|
41
|
+
<Dialog.Close asChild>
|
|
42
|
+
<Button data-testid="dialog-close">Close</Button>
|
|
43
|
+
</Dialog.Close>
|
|
44
|
+
</Dialog.Content>
|
|
45
|
+
</Dialog.Portal>
|
|
46
|
+
</Dialog>
|
|
47
|
+
</YStack>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Button, Dialog, View, YStack } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Test case for dialog pointer events unlock timing
|
|
6
|
+
* Uses a slow exit animation to verify that pointer events on elements
|
|
7
|
+
* behind the dialog are restored immediately when the dialog closes,
|
|
8
|
+
* NOT after the animation completes.
|
|
9
|
+
*/
|
|
10
|
+
export function DialogPointerEventsCase() {
|
|
11
|
+
const [open, setOpen] = useState(false)
|
|
12
|
+
const [clickCount, setClickCount] = useState(0)
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<YStack padding="$4" gap="$4">
|
|
16
|
+
<Button data-testid="background-button" onPress={() => setClickCount((c) => c + 1)}>
|
|
17
|
+
Background Button (clicked: {clickCount})
|
|
18
|
+
</Button>
|
|
19
|
+
|
|
20
|
+
<View data-testid="click-count">{clickCount}</View>
|
|
21
|
+
|
|
22
|
+
<Dialog open={open} onOpenChange={setOpen} modal>
|
|
23
|
+
<Dialog.Trigger asChild>
|
|
24
|
+
<Button data-testid="dialog-trigger">Open Dialog</Button>
|
|
25
|
+
</Dialog.Trigger>
|
|
26
|
+
<Dialog.Portal>
|
|
27
|
+
<Dialog.Overlay
|
|
28
|
+
key="overlay"
|
|
29
|
+
transition="lazy"
|
|
30
|
+
opacity={0.5}
|
|
31
|
+
enterStyle={{ opacity: 0 }}
|
|
32
|
+
exitStyle={{ opacity: 0 }}
|
|
33
|
+
/>
|
|
34
|
+
<Dialog.Content
|
|
35
|
+
key="content"
|
|
36
|
+
bordered
|
|
37
|
+
elevate
|
|
38
|
+
transition="lazy"
|
|
39
|
+
enterStyle={{ x: 0, y: -20, opacity: 0, scale: 0.9 }}
|
|
40
|
+
exitStyle={{ x: 0, y: 10, opacity: 0, scale: 0.95 }}
|
|
41
|
+
width={400}
|
|
42
|
+
padding="$6"
|
|
43
|
+
gap="$4"
|
|
44
|
+
>
|
|
45
|
+
<Dialog.Title>Slow Animation Dialog</Dialog.Title>
|
|
46
|
+
<Dialog.Description>
|
|
47
|
+
This dialog has a slow exit animation. When closed, the background button
|
|
48
|
+
should be clickable immediately, not after the animation finishes.
|
|
49
|
+
</Dialog.Description>
|
|
50
|
+
<Dialog.Close asChild>
|
|
51
|
+
<Button data-testid="dialog-close">Close</Button>
|
|
52
|
+
</Dialog.Close>
|
|
53
|
+
</Dialog.Content>
|
|
54
|
+
</Dialog.Portal>
|
|
55
|
+
</Dialog>
|
|
56
|
+
</YStack>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Adapt, Button, Dialog, Input, Label, Sheet, XStack, YStack } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
export function DialogScopedCase() {
|
|
4
|
+
const shouldAdapt = window.location.search.includes('adapt=true')
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<YStack padding="$4" gap="$4">
|
|
8
|
+
<Dialog modal>
|
|
9
|
+
<TestDialogContent name="plain" shouldAdapt={shouldAdapt} />
|
|
10
|
+
<Dialog.Trigger asChild>
|
|
11
|
+
<Button data-testid={`plain-trigger`}>Open Plain</Button>
|
|
12
|
+
</Dialog.Trigger>
|
|
13
|
+
</Dialog>
|
|
14
|
+
|
|
15
|
+
<Dialog scope="DialogA" modal>
|
|
16
|
+
<TestDialogContent name="a" shouldAdapt={shouldAdapt} />
|
|
17
|
+
|
|
18
|
+
<Dialog scope="DialogB" modal>
|
|
19
|
+
<TestDialogContent name="b" shouldAdapt={shouldAdapt} />
|
|
20
|
+
|
|
21
|
+
<Dialog.Trigger asChild scope="DialogA">
|
|
22
|
+
<Button data-testid={`a-trigger`}>Open A</Button>
|
|
23
|
+
</Dialog.Trigger>
|
|
24
|
+
|
|
25
|
+
<Dialog.Trigger asChild scope="DialogB">
|
|
26
|
+
<Button data-testid={`b-trigger`}>Open B</Button>
|
|
27
|
+
</Dialog.Trigger>
|
|
28
|
+
</Dialog>
|
|
29
|
+
</Dialog>
|
|
30
|
+
</YStack>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const TestDialogContent = ({ name, shouldAdapt }) => {
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<Dialog.Portal>
|
|
38
|
+
<Dialog.Overlay
|
|
39
|
+
key="overlay"
|
|
40
|
+
transition="quick"
|
|
41
|
+
opacity={0.5}
|
|
42
|
+
enterStyle={{ opacity: 0 }}
|
|
43
|
+
exitStyle={{ opacity: 0 }}
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<Dialog.Content
|
|
47
|
+
bordered
|
|
48
|
+
elevate
|
|
49
|
+
key="content"
|
|
50
|
+
transition={[
|
|
51
|
+
'quick',
|
|
52
|
+
{
|
|
53
|
+
opacity: {
|
|
54
|
+
overshootClamping: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
]}
|
|
58
|
+
enterStyle={{ x: 0, y: -20, opacity: 0, scale: 0.9 }}
|
|
59
|
+
exitStyle={{ x: 0, y: 10, opacity: 0, scale: 0.95 }}
|
|
60
|
+
width={400}
|
|
61
|
+
height={300}
|
|
62
|
+
padding="$6"
|
|
63
|
+
gap="$4"
|
|
64
|
+
>
|
|
65
|
+
<YStack data-testid={`${name}-dialog-content`} gap="$4">
|
|
66
|
+
<Dialog.Title>Dialog {name}</Dialog.Title>
|
|
67
|
+
<Dialog.Description>
|
|
68
|
+
This is a test dialog for scoped behavior - {name}
|
|
69
|
+
</Dialog.Description>
|
|
70
|
+
|
|
71
|
+
<YStack gap="$3">
|
|
72
|
+
<Label htmlFor={`name-${name}`}>Name</Label>
|
|
73
|
+
<Input id={`name-${name}`} placeholder="Enter name" />
|
|
74
|
+
</YStack>
|
|
75
|
+
|
|
76
|
+
<XStack gap="$3" justifyContent="flex-end">
|
|
77
|
+
<Dialog.Close asChild>
|
|
78
|
+
<Button variant="outlined" data-testid={`${name}-dialog-close`}>
|
|
79
|
+
Cancel
|
|
80
|
+
</Button>
|
|
81
|
+
</Dialog.Close>
|
|
82
|
+
<Button data-testid={`dialog-save`}>Save</Button>
|
|
83
|
+
</XStack>
|
|
84
|
+
</YStack>
|
|
85
|
+
</Dialog.Content>
|
|
86
|
+
</Dialog.Portal>
|
|
87
|
+
|
|
88
|
+
{shouldAdapt && (
|
|
89
|
+
<Adapt when={true}>
|
|
90
|
+
<Sheet transition="medium" modal dismissOnSnapToBottom>
|
|
91
|
+
<Sheet.Frame data-testid={`${name}-sheet-contents`} padding="$4">
|
|
92
|
+
<Adapt.Contents />
|
|
93
|
+
</Sheet.Frame>
|
|
94
|
+
<Sheet.Overlay
|
|
95
|
+
id={`${name}-sheet-overlay`}
|
|
96
|
+
backgroundColor="$shadowColor"
|
|
97
|
+
transition="lazy"
|
|
98
|
+
enterStyle={{ opacity: 0 }}
|
|
99
|
+
exitStyle={{ opacity: 0 }}
|
|
100
|
+
/>
|
|
101
|
+
</Sheet>
|
|
102
|
+
</Adapt>
|
|
103
|
+
)}
|
|
104
|
+
</>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Adapt,
|
|
4
|
+
Button,
|
|
5
|
+
Dialog,
|
|
6
|
+
Input,
|
|
7
|
+
Paragraph,
|
|
8
|
+
Sheet,
|
|
9
|
+
styled,
|
|
10
|
+
XStack,
|
|
11
|
+
YStack,
|
|
12
|
+
} from '@hanzo/gui'
|
|
13
|
+
|
|
14
|
+
const CONTENT_RADIUS = '$6' as const
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Test case for Dialog with onPress on Overlay - Android crash reproduction
|
|
18
|
+
*
|
|
19
|
+
* BUG: Adding `onPress` to `Dialog.Overlay` crashes on Android only (iOS works fine)
|
|
20
|
+
*
|
|
21
|
+
* Error: "Cannot read property '_internalInstanceHandle' of null"
|
|
22
|
+
* Location: ReactFabricPublicInstance.js:145, createComponent.native.js:109
|
|
23
|
+
*
|
|
24
|
+
* Root cause:
|
|
25
|
+
* - On Android with Fabric, when onPress is added to Dialog.Overlay inside Dialog.Portal
|
|
26
|
+
* - The gesture handler setup tries to access the native view's internal handle
|
|
27
|
+
* - During AnimatePresence mount/unmount, publicInstance._internalInstanceHandle is null
|
|
28
|
+
* - iOS handles this timing differently and doesn't crash
|
|
29
|
+
*
|
|
30
|
+
* To reproduce the crash, add onPress to Dialog.Overlay:
|
|
31
|
+
* ```
|
|
32
|
+
* <Dialog.Overlay onPress={() => onOpenChange(false)} />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function DialogSheetAdaptCase() {
|
|
36
|
+
const [dialogState, setDialogState] = useState<{ open: boolean } | null>(null)
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<YStack padding="$4" gap="$4" items="center">
|
|
40
|
+
<Button testID="open-dialog" onPress={() => setDialogState({ open: true })}>
|
|
41
|
+
Open Dialog (Adapt to Sheet)
|
|
42
|
+
</Button>
|
|
43
|
+
|
|
44
|
+
{/* Always-mounted dialog pattern matching takeout3 */}
|
|
45
|
+
<TakeoutStyleDialog
|
|
46
|
+
open={!!dialogState?.open}
|
|
47
|
+
onOpenChange={(open) => {
|
|
48
|
+
if (!open) {
|
|
49
|
+
setDialogState(null)
|
|
50
|
+
}
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
53
|
+
</YStack>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* This component matches the takeout3 Dialog pattern exactly
|
|
59
|
+
* Key characteristics:
|
|
60
|
+
* - Always mounted at layout level
|
|
61
|
+
* - Controlled via external state (starts closed)
|
|
62
|
+
* - Uses Dialog.Adapt with Sheet for mobile/touch
|
|
63
|
+
* - Sheet uses moveOnKeyboardChange which requires gesture handler
|
|
64
|
+
*/
|
|
65
|
+
function TakeoutStyleDialog({
|
|
66
|
+
open,
|
|
67
|
+
onOpenChange,
|
|
68
|
+
}: {
|
|
69
|
+
open: boolean
|
|
70
|
+
onOpenChange: (open: boolean) => void
|
|
71
|
+
}) {
|
|
72
|
+
return (
|
|
73
|
+
<Dialog modal open={open} onOpenChange={onOpenChange}>
|
|
74
|
+
{/* Simplified to match DialogDemo exactly */}
|
|
75
|
+
<Adapt platform="touch" when="maxMd">
|
|
76
|
+
<Sheet
|
|
77
|
+
transition="medium"
|
|
78
|
+
zIndex={200000}
|
|
79
|
+
modal
|
|
80
|
+
dismissOnSnapToBottom
|
|
81
|
+
unmountChildrenWhenHidden
|
|
82
|
+
>
|
|
83
|
+
<Sheet.Frame p="$4" gap="$4">
|
|
84
|
+
<Adapt.Contents />
|
|
85
|
+
</Sheet.Frame>
|
|
86
|
+
<Sheet.Overlay
|
|
87
|
+
bg="$background"
|
|
88
|
+
opacity={0.5}
|
|
89
|
+
transition="lazy"
|
|
90
|
+
enterStyle={{ opacity: 0 }}
|
|
91
|
+
exitStyle={{ opacity: 0 }}
|
|
92
|
+
/>
|
|
93
|
+
</Sheet>
|
|
94
|
+
</Adapt>
|
|
95
|
+
|
|
96
|
+
<Dialog.Portal z={500_000}>
|
|
97
|
+
<DialogOverlay
|
|
98
|
+
key="overlay"
|
|
99
|
+
bg="$shadow6"
|
|
100
|
+
transition="quick"
|
|
101
|
+
enterStyle={{ opacity: 0 }}
|
|
102
|
+
exitStyle={{ opacity: 0 }}
|
|
103
|
+
onPress={() => {
|
|
104
|
+
console.log('Overlay pressed')
|
|
105
|
+
}}
|
|
106
|
+
/>
|
|
107
|
+
|
|
108
|
+
<Dialog.FocusScope focusOnIdle>
|
|
109
|
+
<DialogContent key="content" rounded={CONTENT_RADIUS} overflow="hidden" p="$3">
|
|
110
|
+
<YStack pointerEvents="box-none" gap="$2">
|
|
111
|
+
<Dialog.Title fontFamily="$mono" size="$5" text="center">
|
|
112
|
+
Dialog with Sheet Adapt
|
|
113
|
+
</Dialog.Title>
|
|
114
|
+
<Dialog.Description size="$4" color="$color10">
|
|
115
|
+
On mobile/touch, this adapts to a Sheet with gesture handling.
|
|
116
|
+
</Dialog.Description>
|
|
117
|
+
</YStack>
|
|
118
|
+
|
|
119
|
+
<Input placeholder="Enter your name" />
|
|
120
|
+
|
|
121
|
+
<YStack gap="$3">
|
|
122
|
+
<Paragraph>
|
|
123
|
+
This tests the gesture handler integration when Sheet renders inside
|
|
124
|
+
AnimatePresence via Dialog.Adapt.
|
|
125
|
+
</Paragraph>
|
|
126
|
+
</YStack>
|
|
127
|
+
|
|
128
|
+
<XStack justify="flex-end" gap="$3">
|
|
129
|
+
<Dialog.Close asChild displayWhenAdapted>
|
|
130
|
+
<Button testID="close-dialog" theme="accent">
|
|
131
|
+
Close
|
|
132
|
+
</Button>
|
|
133
|
+
</Dialog.Close>
|
|
134
|
+
</XStack>
|
|
135
|
+
</DialogContent>
|
|
136
|
+
</Dialog.FocusScope>
|
|
137
|
+
</Dialog.Portal>
|
|
138
|
+
</Dialog>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const DialogOverlay = styled(Dialog.Overlay, {
|
|
143
|
+
transition: '200ms',
|
|
144
|
+
opacity: 1,
|
|
145
|
+
backdropFilter: 'blur(3px)',
|
|
146
|
+
enterStyle: { opacity: 0 },
|
|
147
|
+
exitStyle: { opacity: 0 },
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
const DialogContent = styled(Dialog.Content, {
|
|
151
|
+
unstyled: true,
|
|
152
|
+
z: 1000000,
|
|
153
|
+
transition: '200ms',
|
|
154
|
+
bg: 'transparent',
|
|
155
|
+
borderWidth: 0.5,
|
|
156
|
+
rounded: CONTENT_RADIUS,
|
|
157
|
+
borderColor: '$color3',
|
|
158
|
+
position: 'relative',
|
|
159
|
+
backdropFilter: 'blur(25px)',
|
|
160
|
+
shadowColor: '$shadow3',
|
|
161
|
+
shadowRadius: 20,
|
|
162
|
+
shadowOffset: { height: 20, width: 0 },
|
|
163
|
+
maxH: 600,
|
|
164
|
+
width: '60%',
|
|
165
|
+
minW: 200,
|
|
166
|
+
maxW: 500,
|
|
167
|
+
p: '$4',
|
|
168
|
+
opacity: 1,
|
|
169
|
+
y: 0,
|
|
170
|
+
enterStyle: { x: 0, y: -5, opacity: 0, scale: 0.985 },
|
|
171
|
+
exitStyle: { x: 0, y: 5, opacity: 0 },
|
|
172
|
+
|
|
173
|
+
focusStyle: {
|
|
174
|
+
outlineWidth: 2,
|
|
175
|
+
outlineColor: '$background02',
|
|
176
|
+
outlineStyle: 'solid',
|
|
177
|
+
},
|
|
178
|
+
})
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Button, Dialog, Paragraph, ScrollView, Sheet, XStack, YStack } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Test case for Dialog → Sheet adapt on viewport resize
|
|
6
|
+
*
|
|
7
|
+
* BUG: When a Dialog is open and the viewport resizes from wide (Dialog) to narrow
|
|
8
|
+
* (Sheet via Adapt), the Sheet appears empty - the portal content is not transferred.
|
|
9
|
+
*
|
|
10
|
+
* Expected: Dialog content should appear inside the Sheet after resize
|
|
11
|
+
* Actual: Sheet is empty after resize
|
|
12
|
+
*
|
|
13
|
+
* To reproduce:
|
|
14
|
+
* 1. Open at wide viewport (> 768px) - Dialog appears
|
|
15
|
+
* 2. Resize viewport to narrow (< 768px) - Sheet should appear with content
|
|
16
|
+
* 3. Content is missing from the Sheet
|
|
17
|
+
*/
|
|
18
|
+
export function DialogSheetAdaptResizeCase() {
|
|
19
|
+
const [open, setOpen] = useState(false)
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<YStack padding="$4" gap="$4" items="center">
|
|
23
|
+
<Button testID="open-dialog" onPress={() => setOpen(true)}>
|
|
24
|
+
Open Dialog
|
|
25
|
+
</Button>
|
|
26
|
+
|
|
27
|
+
<Dialog modal open={open} onOpenChange={setOpen}>
|
|
28
|
+
{/* adapt to sheet on narrow viewports */}
|
|
29
|
+
<Dialog.Adapt when="maxMd">
|
|
30
|
+
<Sheet zIndex={200000} modal dismissOnSnapToBottom>
|
|
31
|
+
<Sheet.Frame padding="$4" gap="$4">
|
|
32
|
+
<Sheet.ScrollView>
|
|
33
|
+
<Dialog.Adapt.Contents />
|
|
34
|
+
</Sheet.ScrollView>
|
|
35
|
+
</Sheet.Frame>
|
|
36
|
+
<Sheet.Overlay
|
|
37
|
+
bg="$shadow4"
|
|
38
|
+
transition="lazy"
|
|
39
|
+
enterStyle={{ opacity: 0 }}
|
|
40
|
+
exitStyle={{ opacity: 0 }}
|
|
41
|
+
/>
|
|
42
|
+
</Sheet>
|
|
43
|
+
</Dialog.Adapt>
|
|
44
|
+
|
|
45
|
+
<Dialog.Portal>
|
|
46
|
+
<Dialog.Overlay
|
|
47
|
+
key="overlay"
|
|
48
|
+
transition="medium"
|
|
49
|
+
enterStyle={{ opacity: 0 }}
|
|
50
|
+
exitStyle={{ opacity: 0 }}
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
<Dialog.Content
|
|
54
|
+
bordered
|
|
55
|
+
elevate
|
|
56
|
+
key="content"
|
|
57
|
+
transition="quick"
|
|
58
|
+
enterStyle={{ y: -10, opacity: 0, scale: 0.975 }}
|
|
59
|
+
exitStyle={{ y: 10, opacity: 0, scale: 0.975 }}
|
|
60
|
+
width="90%"
|
|
61
|
+
maxWidth={600}
|
|
62
|
+
>
|
|
63
|
+
<ScrollView>
|
|
64
|
+
<YStack gap="$4" padding="$2">
|
|
65
|
+
<Dialog.Title testID="dialog-title">Dialog Title</Dialog.Title>
|
|
66
|
+
|
|
67
|
+
<Dialog.Description testID="dialog-description">
|
|
68
|
+
This content should be visible both when shown as a Dialog (wide
|
|
69
|
+
viewport) and when adapted to a Sheet (narrow viewport).
|
|
70
|
+
</Dialog.Description>
|
|
71
|
+
|
|
72
|
+
<Paragraph testID="dialog-content">
|
|
73
|
+
If you can see this text in both the Dialog and the Sheet after
|
|
74
|
+
resizing, the portal logic is working correctly.
|
|
75
|
+
</Paragraph>
|
|
76
|
+
|
|
77
|
+
<YStack gap="$2">
|
|
78
|
+
<Paragraph>Additional content to make the test more robust:</Paragraph>
|
|
79
|
+
<Paragraph testID="extra-content-1">Extra content line 1</Paragraph>
|
|
80
|
+
<Paragraph testID="extra-content-2">Extra content line 2</Paragraph>
|
|
81
|
+
<Paragraph testID="extra-content-3">Extra content line 3</Paragraph>
|
|
82
|
+
</YStack>
|
|
83
|
+
</YStack>
|
|
84
|
+
</ScrollView>
|
|
85
|
+
|
|
86
|
+
<XStack justify="flex-end" gap="$3" padding="$2">
|
|
87
|
+
<Dialog.Close asChild displayWhenAdapted>
|
|
88
|
+
<Button testID="close-dialog" theme="accent">
|
|
89
|
+
Close
|
|
90
|
+
</Button>
|
|
91
|
+
</Dialog.Close>
|
|
92
|
+
</XStack>
|
|
93
|
+
</Dialog.Content>
|
|
94
|
+
</Dialog.Portal>
|
|
95
|
+
</Dialog>
|
|
96
|
+
</YStack>
|
|
97
|
+
)
|
|
98
|
+
}
|