@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,95 @@
|
|
|
1
|
+
import { XStack, YStack, styled, Text } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
// Test styled component with media queries in definition
|
|
4
|
+
const ContainerWithMedia = styled(XStack, {
|
|
5
|
+
$sm: {
|
|
6
|
+
pt: 100,
|
|
7
|
+
mx: 100,
|
|
8
|
+
height: 100,
|
|
9
|
+
width: 100,
|
|
10
|
+
background: 'red',
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
// Test styled component with pseudo selectors in definition
|
|
15
|
+
const ContainerWithPseudo = styled(XStack, {
|
|
16
|
+
hoverStyle: {
|
|
17
|
+
background: 'yellow',
|
|
18
|
+
scale: 1.1,
|
|
19
|
+
},
|
|
20
|
+
pressStyle: {
|
|
21
|
+
background: 'orange',
|
|
22
|
+
scale: 0.9,
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export const StyledMediaQueryMerge = () => (
|
|
27
|
+
<YStack p="$4">
|
|
28
|
+
<Text style={{ fontSize: 16, fontWeight: 'bold' }}>
|
|
29
|
+
Styled Media Query Merge Test
|
|
30
|
+
</Text>
|
|
31
|
+
|
|
32
|
+
<Text style={{ fontSize: 12, color: '#666' }}>
|
|
33
|
+
Testing that styled definition media queries and pseudo selectors are properly
|
|
34
|
+
merged with runtime props
|
|
35
|
+
</Text>
|
|
36
|
+
|
|
37
|
+
<YStack>
|
|
38
|
+
<Text style={{ fontSize: 14, fontWeight: 'bold' }}>Media Query Test:</Text>
|
|
39
|
+
|
|
40
|
+
{/* Test 1: $sm media query merge */}
|
|
41
|
+
<ContainerWithMedia id="test1" $sm={{ background: 'blue' }}>
|
|
42
|
+
<Text style={{ color: 'white' }}>
|
|
43
|
+
Should have pt: 100, mx: 100, height: 100, width: 100, background: blue
|
|
44
|
+
</Text>
|
|
45
|
+
</ContainerWithMedia>
|
|
46
|
+
|
|
47
|
+
{/* Test 2: $sm media query with different runtime override */}
|
|
48
|
+
<ContainerWithMedia id="test2" $sm={{ background: 'purple' }}>
|
|
49
|
+
<Text style={{ color: 'white' }}>
|
|
50
|
+
Should have pt: 100, mx: 100, height: 100, width: 100, background: purple
|
|
51
|
+
</Text>
|
|
52
|
+
</ContainerWithMedia>
|
|
53
|
+
|
|
54
|
+
{/* Test 3: $sm media query with runtime override */}
|
|
55
|
+
<ContainerWithMedia id="test3" $sm={{ background: 'blue' }}>
|
|
56
|
+
<Text style={{ color: 'white' }}>
|
|
57
|
+
Should merge $sm styled definition with runtime override
|
|
58
|
+
</Text>
|
|
59
|
+
</ContainerWithMedia>
|
|
60
|
+
</YStack>
|
|
61
|
+
|
|
62
|
+
<YStack>
|
|
63
|
+
<Text style={{ fontSize: 14, fontWeight: 'bold' }}>Pseudo Selector Test:</Text>
|
|
64
|
+
|
|
65
|
+
{/* Test 4: Pseudo selector merge */}
|
|
66
|
+
<ContainerWithPseudo
|
|
67
|
+
id="test4"
|
|
68
|
+
hoverStyle={{ background: 'cyan' }}
|
|
69
|
+
pressStyle={{ background: 'magenta' }}
|
|
70
|
+
>
|
|
71
|
+
<Text style={{ color: 'white' }}>
|
|
72
|
+
Hover: yellow + cyan, Press: orange + magenta
|
|
73
|
+
</Text>
|
|
74
|
+
</ContainerWithPseudo>
|
|
75
|
+
</YStack>
|
|
76
|
+
|
|
77
|
+
<YStack>
|
|
78
|
+
<Text style={{ fontSize: 14, fontWeight: 'bold' }}>
|
|
79
|
+
Direct Component Test (Control):
|
|
80
|
+
</Text>
|
|
81
|
+
|
|
82
|
+
{/* Test 5: Direct component for comparison */}
|
|
83
|
+
<XStack id="test5" $sm={{ pt: 50, mx: 50, background: 'brown' }}>
|
|
84
|
+
<Text style={{ color: 'white' }}>
|
|
85
|
+
Direct XStack: pt: 50, mx: 50, background: brown
|
|
86
|
+
</Text>
|
|
87
|
+
</XStack>
|
|
88
|
+
</YStack>
|
|
89
|
+
|
|
90
|
+
<Text style={{ fontSize: 12, color: '#666' }}>
|
|
91
|
+
Expected: All styled definition properties should be preserved and merged with
|
|
92
|
+
runtime properties
|
|
93
|
+
</Text>
|
|
94
|
+
</YStack>
|
|
95
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Input, GuiProvider, YStack, styled } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
const TransparentInput = styled(Input, {
|
|
4
|
+
borderColor: 'red',
|
|
5
|
+
borderWidth: 2,
|
|
6
|
+
outlineColor: 'transparent',
|
|
7
|
+
hoverStyle: {
|
|
8
|
+
borderColor: 'green',
|
|
9
|
+
outlineColor: 'transparent',
|
|
10
|
+
borderWidth: 5,
|
|
11
|
+
},
|
|
12
|
+
focusStyle: {
|
|
13
|
+
borderColor: 'blue',
|
|
14
|
+
outlineColor: 'transparent',
|
|
15
|
+
borderWidth: 0,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export function StyledOverridePsuedo() {
|
|
20
|
+
return (
|
|
21
|
+
<YStack gap="$4">
|
|
22
|
+
<TransparentInput placeholder="transparent border 0px" />
|
|
23
|
+
<Input placeholder="default input" />
|
|
24
|
+
</YStack>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Platform } from 'react-native'
|
|
2
|
+
import { Input as GuiInput, styled, useThemeName } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
export function StyledRNW() {
|
|
5
|
+
return <Input id="styled-rnw-input" aria-label="ok" placeholder="search" />
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// Input accepts text styles at runtime via validStyles but TS doesn't know
|
|
9
|
+
const TextInput = styled(
|
|
10
|
+
GuiInput,
|
|
11
|
+
{
|
|
12
|
+
fontSize: 16,
|
|
13
|
+
fontFamily: '$silkscreen',
|
|
14
|
+
color: '$color5',
|
|
15
|
+
minWidth: 0,
|
|
16
|
+
borderWidth: 0,
|
|
17
|
+
borderColor: 'transparent',
|
|
18
|
+
|
|
19
|
+
variants: {
|
|
20
|
+
unset: {
|
|
21
|
+
false: {
|
|
22
|
+
borderWidth: 2,
|
|
23
|
+
py: 12,
|
|
24
|
+
px: 14,
|
|
25
|
+
borderRadius: 6,
|
|
26
|
+
bg: '$color3',
|
|
27
|
+
focusStyle: {
|
|
28
|
+
bg: '$color4',
|
|
29
|
+
margin: 0,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
} as const,
|
|
34
|
+
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
unset: false,
|
|
37
|
+
},
|
|
38
|
+
} as any,
|
|
39
|
+
{
|
|
40
|
+
inlineProps: new Set(['id', 'testID']),
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
export const Input = GuiInput.styleable(function MyInput({ ...props }, ref) {
|
|
45
|
+
const parentTheme = useThemeName()
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
// @ts-ignore - complex type inference issue with styleable + styled combination
|
|
49
|
+
<TextInput
|
|
50
|
+
unstyled
|
|
51
|
+
keyboardAppearance={parentTheme?.includes('dark') ? 'dark' : 'default'}
|
|
52
|
+
{...props}
|
|
53
|
+
focusStyle={{ margin: 0, ...props.focusStyle }}
|
|
54
|
+
id={Platform.select({
|
|
55
|
+
// on native, this leads to duplicates?
|
|
56
|
+
web: props.id,
|
|
57
|
+
})}
|
|
58
|
+
ref={ref as any}
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
})
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Input, styled } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
const StyledInput = styled(Input, {
|
|
5
|
+
borderColor: 'red',
|
|
6
|
+
borderWidth: 5,
|
|
7
|
+
|
|
8
|
+
variants: {
|
|
9
|
+
test: {
|
|
10
|
+
true: {
|
|
11
|
+
focusStyle: {
|
|
12
|
+
borderWidth: 10,
|
|
13
|
+
borderColor: 'blue',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
} as const,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const MyComponent = StyledInput.styleable((props, ref) => (
|
|
21
|
+
<StyledInput ref={ref as any} {...props} />
|
|
22
|
+
))
|
|
23
|
+
|
|
24
|
+
export function StyledStyleableInputOnFocus() {
|
|
25
|
+
const [onFocus, setOnFocus] = React.useState(false)
|
|
26
|
+
return (
|
|
27
|
+
<MyComponent
|
|
28
|
+
test
|
|
29
|
+
data-onfocus={onFocus}
|
|
30
|
+
id="onFocus"
|
|
31
|
+
onFocus={() => setOnFocus(true)}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Input as GuiInput, styled } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
// Input accepts text styles at runtime via validStyles but TS doesn't know
|
|
4
|
+
const TextInput2 = styled(GuiInput, {
|
|
5
|
+
unstyled: true,
|
|
6
|
+
name: 'bla',
|
|
7
|
+
height: '$5',
|
|
8
|
+
borderRadius: '$1',
|
|
9
|
+
borderWidth: 1,
|
|
10
|
+
fontSize: '$1',
|
|
11
|
+
keyboardAppearance: 'dark',
|
|
12
|
+
paddingHorizontal: '$2',
|
|
13
|
+
placeholderTextColor: 'rgba(255,255,255,0.3)',
|
|
14
|
+
color: 'green',
|
|
15
|
+
|
|
16
|
+
variants: {
|
|
17
|
+
gameplay: {
|
|
18
|
+
true: {
|
|
19
|
+
fontSize: 100,
|
|
20
|
+
lineHeight: '$5',
|
|
21
|
+
letterSpacing: '$5',
|
|
22
|
+
color: 'red',
|
|
23
|
+
borderRadius: 100,
|
|
24
|
+
borderWidth: 2,
|
|
25
|
+
borderColor: 'red',
|
|
26
|
+
cursor: 'pointer',
|
|
27
|
+
|
|
28
|
+
focusStyle: {
|
|
29
|
+
borderColor: 'green',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
gameplayMobile: {
|
|
34
|
+
true: {
|
|
35
|
+
fontSize: '$3',
|
|
36
|
+
letterSpacing: '$3',
|
|
37
|
+
marginTop: -2.35,
|
|
38
|
+
marginBottom: -5.9,
|
|
39
|
+
lineHeight: '$3',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
} as const,
|
|
43
|
+
} as any)
|
|
44
|
+
|
|
45
|
+
export function StyledStyleableInputVariant() {
|
|
46
|
+
// @ts-expect-error - gameplay variant exists but type is lost due to as any cast
|
|
47
|
+
return <TextInput2 id="input" gameplay />
|
|
48
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Input, styled } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
const StyledInput = styled(Input, {
|
|
5
|
+
borderColor: 'red',
|
|
6
|
+
borderWidth: 5,
|
|
7
|
+
|
|
8
|
+
variants: {
|
|
9
|
+
test: {
|
|
10
|
+
true: {
|
|
11
|
+
focusStyle: {
|
|
12
|
+
borderWidth: 10,
|
|
13
|
+
borderColor: 'blue',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
} as const,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const AnotherStyled = styled(StyledInput, {})
|
|
21
|
+
|
|
22
|
+
const MyComponent = AnotherStyled.styleable((props, ref) => (
|
|
23
|
+
<StyledInput ref={ref as any} {...props} />
|
|
24
|
+
))
|
|
25
|
+
|
|
26
|
+
export function StyledStyledStyleableInputOnFocus() {
|
|
27
|
+
const [onFocus, setOnFocus] = React.useState(false)
|
|
28
|
+
return (
|
|
29
|
+
<MyComponent
|
|
30
|
+
test
|
|
31
|
+
data-onfocus={onFocus}
|
|
32
|
+
id="onFocus"
|
|
33
|
+
onFocus={() => setOnFocus(true)}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Tag, Theme } from '@hanzogui/sandbox-ui'
|
|
2
|
+
|
|
3
|
+
// test with flattening and without!
|
|
4
|
+
|
|
5
|
+
export function StyledVariantTextColor() {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<Theme name="blue">
|
|
9
|
+
<Tag testID="default-flat">default-flat</Tag>
|
|
10
|
+
<Tag testID="active-flat" active>
|
|
11
|
+
active-flat
|
|
12
|
+
</Tag>
|
|
13
|
+
|
|
14
|
+
{/* @ts-ignore */}
|
|
15
|
+
<Tag forceNoFlat testID="default">
|
|
16
|
+
default
|
|
17
|
+
</Tag>
|
|
18
|
+
{/* @ts-ignore */}
|
|
19
|
+
<Tag forceNoFlat testID="active" active>
|
|
20
|
+
active
|
|
21
|
+
</Tag>
|
|
22
|
+
</Theme>
|
|
23
|
+
</>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View, styled } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
const StyledView = styled(View, {
|
|
5
|
+
borderColor: 'red',
|
|
6
|
+
borderWidth: 5,
|
|
7
|
+
|
|
8
|
+
variants: {
|
|
9
|
+
testVariant: {
|
|
10
|
+
true: {
|
|
11
|
+
focusStyle: {
|
|
12
|
+
borderWidth: 10,
|
|
13
|
+
borderColor: 'blue',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
} as const,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export function StyledViewOnFocus() {
|
|
21
|
+
const [onFocus, setOnFocus] = React.useState(false)
|
|
22
|
+
return (
|
|
23
|
+
<StyledView
|
|
24
|
+
focusable
|
|
25
|
+
testVariant
|
|
26
|
+
data-onfocus={onFocus}
|
|
27
|
+
id="onFocus"
|
|
28
|
+
onFocus={() => setOnFocus(true)}
|
|
29
|
+
tabIndex={0}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { memo, useEffect, useMemo, useRef, useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
AnimatePresence,
|
|
4
|
+
Button,
|
|
5
|
+
Paragraph,
|
|
6
|
+
Popover,
|
|
7
|
+
SizableText,
|
|
8
|
+
styled,
|
|
9
|
+
XStack,
|
|
10
|
+
YStack,
|
|
11
|
+
} from '@hanzo/gui'
|
|
12
|
+
|
|
13
|
+
const TABS = ['Tab A', 'Tab B', 'Tab C', 'Tab D', 'Tab E']
|
|
14
|
+
|
|
15
|
+
function useHoverableFromParams() {
|
|
16
|
+
return useMemo(() => {
|
|
17
|
+
if (typeof window === 'undefined') return true
|
|
18
|
+
const params = new URLSearchParams(window.location.search)
|
|
19
|
+
const delay = params.get('hoverDelay')
|
|
20
|
+
const restMs = params.get('restMs')
|
|
21
|
+
if (!delay && !restMs) return true
|
|
22
|
+
const config: any = {}
|
|
23
|
+
if (delay) config.delay = Number(delay)
|
|
24
|
+
if (restMs) config.restMs = Number(restMs)
|
|
25
|
+
return config
|
|
26
|
+
}, [])
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function TabHoverAnimationCase() {
|
|
30
|
+
const [open, setOpen] = useState(false)
|
|
31
|
+
const [activeTab, setActiveTab] = useState<string | null>(null)
|
|
32
|
+
const [prevActiveTab, setPrevActiveTab] = useState<string | null>(null)
|
|
33
|
+
const [going, setGoing] = useState(0)
|
|
34
|
+
const hoverable = useHoverableFromParams()
|
|
35
|
+
|
|
36
|
+
const displayTab = useLastValueIf(activeTab, !!activeTab) ?? activeTab
|
|
37
|
+
|
|
38
|
+
// compute going synchronously during render (not in useEffect)
|
|
39
|
+
// so exitStyle has the correct direction immediately
|
|
40
|
+
if (activeTab && prevActiveTab && activeTab !== prevActiveTab) {
|
|
41
|
+
const prevIdx = TABS.indexOf(prevActiveTab)
|
|
42
|
+
const nextIdx = TABS.indexOf(activeTab)
|
|
43
|
+
const nextGoing = nextIdx > prevIdx ? 1 : -1
|
|
44
|
+
if (nextGoing !== going && prevIdx >= 0 && nextIdx >= 0) {
|
|
45
|
+
setGoing(nextGoing)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (activeTab) {
|
|
51
|
+
setPrevActiveTab(activeTab)
|
|
52
|
+
}
|
|
53
|
+
}, [activeTab])
|
|
54
|
+
|
|
55
|
+
// track close events for test instrumentation
|
|
56
|
+
const closeCountRef = useRef(0)
|
|
57
|
+
const handleOpenChange = (val: boolean) => {
|
|
58
|
+
if (!val && open) {
|
|
59
|
+
closeCountRef.current++
|
|
60
|
+
if (typeof window !== 'undefined') {
|
|
61
|
+
;(window as any).__popoverCloseCount = closeCountRef.current
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
setOpen(val)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<YStack gap="$4" padding="$4">
|
|
69
|
+
<SizableText id="going-direction" data-going={going}>
|
|
70
|
+
Direction: {going}
|
|
71
|
+
</SizableText>
|
|
72
|
+
|
|
73
|
+
<Popover
|
|
74
|
+
scope="tab-hover-test"
|
|
75
|
+
open={open}
|
|
76
|
+
onOpenChange={handleOpenChange}
|
|
77
|
+
hoverable={hoverable}
|
|
78
|
+
placement="top"
|
|
79
|
+
offset={8}
|
|
80
|
+
>
|
|
81
|
+
<XStack gap="$2">
|
|
82
|
+
{TABS.map((tab) => (
|
|
83
|
+
<Popover.Trigger
|
|
84
|
+
key={tab}
|
|
85
|
+
scope="tab-hover-test"
|
|
86
|
+
asChild="except-style"
|
|
87
|
+
onMouseEnter={() => setActiveTab(tab)}
|
|
88
|
+
>
|
|
89
|
+
<Button
|
|
90
|
+
id={`tab-${tab.replace(' ', '-').toLowerCase()}`}
|
|
91
|
+
data-testid={`tab-${tab.replace(' ', '-').toLowerCase()}`}
|
|
92
|
+
size="$3"
|
|
93
|
+
theme={activeTab === tab ? 'blue' : undefined}
|
|
94
|
+
>
|
|
95
|
+
{tab}
|
|
96
|
+
</Button>
|
|
97
|
+
</Popover.Trigger>
|
|
98
|
+
))}
|
|
99
|
+
</XStack>
|
|
100
|
+
|
|
101
|
+
<Popover.Content
|
|
102
|
+
id="hover-content"
|
|
103
|
+
data-testid="hover-content"
|
|
104
|
+
animatePosition
|
|
105
|
+
unstyled
|
|
106
|
+
disableFocusScope
|
|
107
|
+
animateOnly={['transform', 'opacity']}
|
|
108
|
+
opacity={1}
|
|
109
|
+
enterStyle={{ opacity: 0, y: -4 }}
|
|
110
|
+
exitStyle={{ opacity: 0, y: 6 }}
|
|
111
|
+
transition="500ms"
|
|
112
|
+
>
|
|
113
|
+
<YStack
|
|
114
|
+
width={250}
|
|
115
|
+
height={120}
|
|
116
|
+
rounded="$4"
|
|
117
|
+
bg="$color3"
|
|
118
|
+
elevation="$4"
|
|
119
|
+
overflow="hidden"
|
|
120
|
+
>
|
|
121
|
+
<AnimatePresence initial={false} custom={{ going }}>
|
|
122
|
+
{open && !!displayTab && (
|
|
123
|
+
<SlideFrame
|
|
124
|
+
key={displayTab}
|
|
125
|
+
going={going}
|
|
126
|
+
id="slide-content"
|
|
127
|
+
data-testid="slide-content"
|
|
128
|
+
data-tab={displayTab}
|
|
129
|
+
data-going={going}
|
|
130
|
+
transition="200ms"
|
|
131
|
+
>
|
|
132
|
+
<TabContent tab={displayTab} />
|
|
133
|
+
</SlideFrame>
|
|
134
|
+
)}
|
|
135
|
+
</AnimatePresence>
|
|
136
|
+
</YStack>
|
|
137
|
+
</Popover.Content>
|
|
138
|
+
</Popover>
|
|
139
|
+
|
|
140
|
+
<ExitTracker />
|
|
141
|
+
</YStack>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const TabContent = memo(({ tab }: { tab: string }) => (
|
|
146
|
+
<YStack gap="$2" padding="$2">
|
|
147
|
+
<SizableText fontWeight="bold" data-testid="tab-content-title">
|
|
148
|
+
{tab}
|
|
149
|
+
</SizableText>
|
|
150
|
+
<Paragraph size="$2">Preview content for {tab}</Paragraph>
|
|
151
|
+
</YStack>
|
|
152
|
+
))
|
|
153
|
+
|
|
154
|
+
const SlideFrame = styled(YStack, {
|
|
155
|
+
position: 'absolute',
|
|
156
|
+
inset: 0,
|
|
157
|
+
z: 1,
|
|
158
|
+
x: 0,
|
|
159
|
+
opacity: 1,
|
|
160
|
+
|
|
161
|
+
variants: {
|
|
162
|
+
going: {
|
|
163
|
+
':number': (going: number) => ({
|
|
164
|
+
enterStyle: {
|
|
165
|
+
x: going === 0 ? 0 : going > 0 ? 100 : -100,
|
|
166
|
+
opacity: 0,
|
|
167
|
+
},
|
|
168
|
+
exitStyle: {
|
|
169
|
+
x: going === 0 ? 0 : going < 0 ? 100 : -100,
|
|
170
|
+
opacity: 0,
|
|
171
|
+
},
|
|
172
|
+
}),
|
|
173
|
+
},
|
|
174
|
+
} as const,
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
// tracks exit completions for test assertions
|
|
178
|
+
function ExitTracker() {
|
|
179
|
+
const [exitCount, setExitCount] = useState(0)
|
|
180
|
+
const [lastExitTime, setLastExitTime] = useState(0)
|
|
181
|
+
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
const handler = () => {
|
|
184
|
+
setExitCount((c) => c + 1)
|
|
185
|
+
setLastExitTime(Date.now())
|
|
186
|
+
}
|
|
187
|
+
window.addEventListener('tab-hover-exit-complete', handler)
|
|
188
|
+
return () => window.removeEventListener('tab-hover-exit-complete', handler)
|
|
189
|
+
}, [])
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<YStack>
|
|
193
|
+
<SizableText
|
|
194
|
+
id="exit-count"
|
|
195
|
+
data-testid="exit-count"
|
|
196
|
+
data-count={exitCount}
|
|
197
|
+
data-last-time={lastExitTime}
|
|
198
|
+
>
|
|
199
|
+
Exits: {exitCount}
|
|
200
|
+
</SizableText>
|
|
201
|
+
</YStack>
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// keeps the last truthy value
|
|
206
|
+
function useLastValueIf<T>(value: T, condition: boolean): T {
|
|
207
|
+
const ref = useRef(value)
|
|
208
|
+
if (condition) {
|
|
209
|
+
ref.current = value
|
|
210
|
+
}
|
|
211
|
+
return ref.current
|
|
212
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Text as CoreText } from '@hanzogui/core'
|
|
2
|
+
import { H1, Text, styled } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
// Test case for GitHub issue #3789: Nested Text breaks inheritance of some styles/props
|
|
5
|
+
|
|
6
|
+
const BoldText = styled(Text, {
|
|
7
|
+
fontWeight: 'bold',
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export function TextNestedInheritance() {
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<H1>text inheritence</H1>
|
|
14
|
+
|
|
15
|
+
{/* Test 1: numberOfLines should apply to nested text */}
|
|
16
|
+
<Text testID="parent-number-of-lines" numberOfLines={1} width={200} color="red">
|
|
17
|
+
This is a very long text that should be truncated with an ellipsis and
|
|
18
|
+
<Text testID="nested-in-number-of-lines" fontWeight="bold">
|
|
19
|
+
{' '}
|
|
20
|
+
this nested bold text
|
|
21
|
+
</Text>{' '}
|
|
22
|
+
should also be truncated
|
|
23
|
+
</Text>
|
|
24
|
+
|
|
25
|
+
{/* Test 2: hanzo-gui Text sets color: '$color', so nested Text should NOT inherit */}
|
|
26
|
+
<Text testID="parent-color" color="blue">
|
|
27
|
+
Parent blue text with
|
|
28
|
+
<Text testID="nested-color" fontWeight="bold">
|
|
29
|
+
{' '}
|
|
30
|
+
nested bold text (should be theme color, not blue)
|
|
31
|
+
</Text>
|
|
32
|
+
</Text>
|
|
33
|
+
|
|
34
|
+
{/* Test 3: core Text does NOT set color, so it should inherit via CSS */}
|
|
35
|
+
<Text testID="parent-core-color" color="blue">
|
|
36
|
+
Parent blue text with
|
|
37
|
+
<CoreText testID="nested-core-color" fontWeight="bold">
|
|
38
|
+
{' '}
|
|
39
|
+
nested core text (should inherit blue)
|
|
40
|
+
</CoreText>
|
|
41
|
+
</Text>
|
|
42
|
+
|
|
43
|
+
{/* Test 4: whiteSpace should inherit (important for numberOfLines) */}
|
|
44
|
+
<Text testID="parent-whitespace" whiteSpace="nowrap" width={200} overflow="hidden">
|
|
45
|
+
Long text that should not wrap because whiteSpace is nowrap and
|
|
46
|
+
<Text testID="nested-whitespace" fontWeight="bold">
|
|
47
|
+
{' '}
|
|
48
|
+
nested text should inherit nowrap
|
|
49
|
+
</Text>
|
|
50
|
+
</Text>
|
|
51
|
+
|
|
52
|
+
{/* Test 5: letterSpacing should inherit */}
|
|
53
|
+
<Text testID="parent-letter-spacing" letterSpacing={5}>
|
|
54
|
+
Spaced text with
|
|
55
|
+
<Text testID="nested-letter-spacing" fontWeight="bold">
|
|
56
|
+
{' '}
|
|
57
|
+
nested text
|
|
58
|
+
</Text>
|
|
59
|
+
</Text>
|
|
60
|
+
|
|
61
|
+
{/* Test 6: Using styled component for nested text - also sets color */}
|
|
62
|
+
<Text testID="parent-styled" color="green">
|
|
63
|
+
Parent green with
|
|
64
|
+
<BoldText testID="nested-styled">
|
|
65
|
+
{' '}
|
|
66
|
+
styled bold child (theme color, not green)
|
|
67
|
+
</BoldText>
|
|
68
|
+
</Text>
|
|
69
|
+
|
|
70
|
+
{/* Test 7: Explicit override should still work */}
|
|
71
|
+
<Text testID="parent-override" color="purple">
|
|
72
|
+
Parent purple with
|
|
73
|
+
<Text testID="nested-override" color="orange">
|
|
74
|
+
{' '}
|
|
75
|
+
nested orange (explicit override)
|
|
76
|
+
</Text>
|
|
77
|
+
</Text>
|
|
78
|
+
</>
|
|
79
|
+
)
|
|
80
|
+
}
|