@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,353 @@
|
|
|
1
|
+
import { memo, useCallback, useRef, useState, useMemo } from 'react'
|
|
2
|
+
import { Button, Text, View, XStack, YStack, ScrollView } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
type Stats = {
|
|
5
|
+
totalCallbacks: number
|
|
6
|
+
totalTime: number
|
|
7
|
+
maxTime: number
|
|
8
|
+
lastBatchSize: number
|
|
9
|
+
lastBatchTime: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// deeply nested component tree
|
|
13
|
+
const GRAY_COLORS = ['$gray2', '$gray3', '$gray4', '$gray5', '$gray6', '$gray7'] as const
|
|
14
|
+
const GRID_COLORS = ['$red5', '$green5', '$blue5', '$purple5', '$orange5'] as const
|
|
15
|
+
const SIBLING_COLORS = ['$red4', '$green4', '$blue4'] as const
|
|
16
|
+
|
|
17
|
+
const DeepChild = memo(
|
|
18
|
+
({
|
|
19
|
+
depth,
|
|
20
|
+
id,
|
|
21
|
+
onLayoutFired,
|
|
22
|
+
}: {
|
|
23
|
+
depth: number
|
|
24
|
+
id: string
|
|
25
|
+
onLayoutFired: () => void
|
|
26
|
+
}) => {
|
|
27
|
+
const handleLayout = useCallback(() => {
|
|
28
|
+
onLayoutFired()
|
|
29
|
+
}, [onLayoutFired])
|
|
30
|
+
|
|
31
|
+
if (depth === 0) {
|
|
32
|
+
return (
|
|
33
|
+
<View
|
|
34
|
+
testID={`deep-${id}`}
|
|
35
|
+
onLayout={handleLayout}
|
|
36
|
+
width={20 + (parseInt(id.split('-')[1] || '0') % 5) * 10}
|
|
37
|
+
height={15}
|
|
38
|
+
backgroundColor="$blue5"
|
|
39
|
+
/>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<View
|
|
45
|
+
testID={`deep-wrapper-${id}-${depth}`}
|
|
46
|
+
onLayout={handleLayout}
|
|
47
|
+
padding={2}
|
|
48
|
+
backgroundColor={GRAY_COLORS[Math.min(5, depth)] || '$gray5'}
|
|
49
|
+
>
|
|
50
|
+
<DeepChild depth={depth - 1} id={id} onLayoutFired={onLayoutFired} />
|
|
51
|
+
</View>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
// grid item with variable sizes
|
|
57
|
+
const GridItem = memo(
|
|
58
|
+
({
|
|
59
|
+
id,
|
|
60
|
+
sizeMultiplier,
|
|
61
|
+
onLayoutFired,
|
|
62
|
+
}: {
|
|
63
|
+
id: number
|
|
64
|
+
sizeMultiplier: number
|
|
65
|
+
onLayoutFired: () => void
|
|
66
|
+
}) => {
|
|
67
|
+
const handleLayout = useCallback(() => {
|
|
68
|
+
onLayoutFired()
|
|
69
|
+
}, [onLayoutFired])
|
|
70
|
+
|
|
71
|
+
const baseSize = 30 + (id % 4) * 15
|
|
72
|
+
const size = baseSize * sizeMultiplier
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<View
|
|
76
|
+
testID={`grid-${id}`}
|
|
77
|
+
onLayout={handleLayout}
|
|
78
|
+
width={size}
|
|
79
|
+
height={size * 0.6}
|
|
80
|
+
backgroundColor={GRID_COLORS[id % 5]}
|
|
81
|
+
margin={2}
|
|
82
|
+
/>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
// list item that changes height
|
|
88
|
+
const ListItem = memo(
|
|
89
|
+
({
|
|
90
|
+
id,
|
|
91
|
+
expanded,
|
|
92
|
+
onLayoutFired,
|
|
93
|
+
}: {
|
|
94
|
+
id: number
|
|
95
|
+
expanded: boolean
|
|
96
|
+
onLayoutFired: () => void
|
|
97
|
+
}) => {
|
|
98
|
+
const handleLayout = useCallback(() => {
|
|
99
|
+
onLayoutFired()
|
|
100
|
+
}, [onLayoutFired])
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<View
|
|
104
|
+
testID={`list-${id}`}
|
|
105
|
+
onLayout={handleLayout}
|
|
106
|
+
width="100%"
|
|
107
|
+
height={expanded ? 60 : 30}
|
|
108
|
+
backgroundColor={id % 2 === 0 ? '$background' : '$backgroundHover'}
|
|
109
|
+
borderBottomWidth={1}
|
|
110
|
+
borderBottomColor="$borderColor"
|
|
111
|
+
padding="$2"
|
|
112
|
+
>
|
|
113
|
+
<Text fontSize={12}>Item {id}</Text>
|
|
114
|
+
</View>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
// sibling groups that all need layout
|
|
120
|
+
const SiblingGroup = memo(
|
|
121
|
+
({
|
|
122
|
+
groupId,
|
|
123
|
+
count,
|
|
124
|
+
widthMultiplier,
|
|
125
|
+
onLayoutFired,
|
|
126
|
+
}: {
|
|
127
|
+
groupId: number
|
|
128
|
+
count: number
|
|
129
|
+
widthMultiplier: number
|
|
130
|
+
onLayoutFired: () => void
|
|
131
|
+
}) => {
|
|
132
|
+
return (
|
|
133
|
+
<XStack testID={`sibling-group-${groupId}`} flexWrap="wrap">
|
|
134
|
+
{Array.from({ length: count }, (_, i) => (
|
|
135
|
+
<View
|
|
136
|
+
key={i}
|
|
137
|
+
testID={`sibling-${groupId}-${i}`}
|
|
138
|
+
onLayout={onLayoutFired}
|
|
139
|
+
width={25 * widthMultiplier}
|
|
140
|
+
height={20}
|
|
141
|
+
backgroundColor={SIBLING_COLORS[i % 3]}
|
|
142
|
+
margin={1}
|
|
143
|
+
/>
|
|
144
|
+
))}
|
|
145
|
+
</XStack>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
export function OnLayoutStressCase() {
|
|
151
|
+
const [stats, setStats] = useState<Stats>({
|
|
152
|
+
totalCallbacks: 0,
|
|
153
|
+
totalTime: 0,
|
|
154
|
+
maxTime: 0,
|
|
155
|
+
lastBatchSize: 0,
|
|
156
|
+
lastBatchTime: 0,
|
|
157
|
+
})
|
|
158
|
+
const [widthMultiplier, setWidthMultiplier] = useState(1)
|
|
159
|
+
const [expanded, setExpanded] = useState(false)
|
|
160
|
+
const [gridSize, setGridSize] = useState(1)
|
|
161
|
+
const [containerWidth, setContainerWidth] = useState(600)
|
|
162
|
+
|
|
163
|
+
// batch tracking
|
|
164
|
+
const batchStart = useRef(0)
|
|
165
|
+
const batchCount = useRef(0)
|
|
166
|
+
const batchTimeout = useRef<any>(null)
|
|
167
|
+
|
|
168
|
+
const onLayoutFired = useCallback(() => {
|
|
169
|
+
const now = performance.now()
|
|
170
|
+
|
|
171
|
+
if (batchCount.current === 0) {
|
|
172
|
+
batchStart.current = now
|
|
173
|
+
}
|
|
174
|
+
batchCount.current++
|
|
175
|
+
|
|
176
|
+
// debounce to capture full batch
|
|
177
|
+
if (batchTimeout.current) {
|
|
178
|
+
clearTimeout(batchTimeout.current)
|
|
179
|
+
}
|
|
180
|
+
batchTimeout.current = setTimeout(() => {
|
|
181
|
+
const batchTime = performance.now() - batchStart.current
|
|
182
|
+
const count = batchCount.current
|
|
183
|
+
|
|
184
|
+
setStats((s) => ({
|
|
185
|
+
totalCallbacks: s.totalCallbacks + count,
|
|
186
|
+
totalTime: s.totalTime + batchTime,
|
|
187
|
+
maxTime: Math.max(s.maxTime, batchTime),
|
|
188
|
+
lastBatchSize: count,
|
|
189
|
+
lastBatchTime: Math.round(batchTime),
|
|
190
|
+
}))
|
|
191
|
+
|
|
192
|
+
batchCount.current = 0
|
|
193
|
+
}, 100)
|
|
194
|
+
}, [])
|
|
195
|
+
|
|
196
|
+
const resetStats = useCallback(() => {
|
|
197
|
+
setStats({
|
|
198
|
+
totalCallbacks: 0,
|
|
199
|
+
totalTime: 0,
|
|
200
|
+
maxTime: 0,
|
|
201
|
+
lastBatchSize: 0,
|
|
202
|
+
lastBatchTime: 0,
|
|
203
|
+
})
|
|
204
|
+
}, [])
|
|
205
|
+
|
|
206
|
+
// create deep tree items
|
|
207
|
+
const deepItems = useMemo(
|
|
208
|
+
() =>
|
|
209
|
+
Array.from({ length: 10 }, (_, i) => (
|
|
210
|
+
<DeepChild key={i} depth={5} id={`deep-${i}`} onLayoutFired={onLayoutFired} />
|
|
211
|
+
)),
|
|
212
|
+
[onLayoutFired]
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
// create grid items (40 items)
|
|
216
|
+
const gridItems = useMemo(
|
|
217
|
+
() =>
|
|
218
|
+
Array.from({ length: 40 }, (_, i) => (
|
|
219
|
+
<GridItem
|
|
220
|
+
key={i}
|
|
221
|
+
id={i}
|
|
222
|
+
sizeMultiplier={gridSize}
|
|
223
|
+
onLayoutFired={onLayoutFired}
|
|
224
|
+
/>
|
|
225
|
+
)),
|
|
226
|
+
[gridSize, onLayoutFired]
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
// create list items (20 items)
|
|
230
|
+
const listItems = useMemo(
|
|
231
|
+
() =>
|
|
232
|
+
Array.from({ length: 20 }, (_, i) => (
|
|
233
|
+
<ListItem key={i} id={i} expanded={expanded} onLayoutFired={onLayoutFired} />
|
|
234
|
+
)),
|
|
235
|
+
[expanded, onLayoutFired]
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
// create sibling groups (5 groups x 10 items = 50 items)
|
|
239
|
+
const siblingGroups = useMemo(
|
|
240
|
+
() =>
|
|
241
|
+
Array.from({ length: 5 }, (_, i) => (
|
|
242
|
+
<SiblingGroup
|
|
243
|
+
key={i}
|
|
244
|
+
groupId={i}
|
|
245
|
+
count={10}
|
|
246
|
+
widthMultiplier={widthMultiplier}
|
|
247
|
+
onLayoutFired={onLayoutFired}
|
|
248
|
+
/>
|
|
249
|
+
)),
|
|
250
|
+
[widthMultiplier, onLayoutFired]
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
return (
|
|
254
|
+
<YStack flex={1} padding="$2">
|
|
255
|
+
{/* controls */}
|
|
256
|
+
<XStack gap="$2" flexWrap="wrap" padding="$2" backgroundColor="$background">
|
|
257
|
+
<Button
|
|
258
|
+
testID="btn-resize-width"
|
|
259
|
+
size="$2"
|
|
260
|
+
onPress={() => setWidthMultiplier((v) => (v === 1 ? 1.5 : 1))}
|
|
261
|
+
>
|
|
262
|
+
toggle width ({widthMultiplier}x)
|
|
263
|
+
</Button>
|
|
264
|
+
<Button
|
|
265
|
+
testID="btn-toggle-expand"
|
|
266
|
+
size="$2"
|
|
267
|
+
onPress={() => setExpanded((v) => !v)}
|
|
268
|
+
>
|
|
269
|
+
toggle expand ({expanded ? 'on' : 'off'})
|
|
270
|
+
</Button>
|
|
271
|
+
<Button
|
|
272
|
+
testID="btn-resize-grid"
|
|
273
|
+
size="$2"
|
|
274
|
+
onPress={() => setGridSize((v) => (v === 1 ? 1.3 : 1))}
|
|
275
|
+
>
|
|
276
|
+
toggle grid ({gridSize}x)
|
|
277
|
+
</Button>
|
|
278
|
+
<Button
|
|
279
|
+
testID="btn-resize-container"
|
|
280
|
+
size="$2"
|
|
281
|
+
onPress={() => setContainerWidth((v) => (v === 600 ? 400 : 600))}
|
|
282
|
+
>
|
|
283
|
+
container ({containerWidth}px)
|
|
284
|
+
</Button>
|
|
285
|
+
<Button testID="btn-reset-stats" size="$2" onPress={resetStats}>
|
|
286
|
+
reset stats
|
|
287
|
+
</Button>
|
|
288
|
+
</XStack>
|
|
289
|
+
|
|
290
|
+
{/* stats readout */}
|
|
291
|
+
<XStack gap="$3" padding="$2" backgroundColor="$backgroundHover" flexWrap="wrap">
|
|
292
|
+
<Text testID="stat-total" fontSize={11}>
|
|
293
|
+
total: {stats.totalCallbacks}
|
|
294
|
+
</Text>
|
|
295
|
+
<Text testID="stat-avg" fontSize={11}>
|
|
296
|
+
avg:{' '}
|
|
297
|
+
{stats.totalCallbacks > 0
|
|
298
|
+
? Math.round((stats.totalTime / stats.totalCallbacks) * 100) / 100
|
|
299
|
+
: 0}
|
|
300
|
+
ms
|
|
301
|
+
</Text>
|
|
302
|
+
<Text testID="stat-max" fontSize={11}>
|
|
303
|
+
max: {Math.round(stats.maxTime)}ms
|
|
304
|
+
</Text>
|
|
305
|
+
<Text testID="stat-last-batch" fontSize={11}>
|
|
306
|
+
lastBatch: {stats.lastBatchSize}
|
|
307
|
+
</Text>
|
|
308
|
+
<Text testID="stat-last-time" fontSize={11}>
|
|
309
|
+
lastTime: {stats.lastBatchTime}ms
|
|
310
|
+
</Text>
|
|
311
|
+
</XStack>
|
|
312
|
+
|
|
313
|
+
{/* scrollable content */}
|
|
314
|
+
<ScrollView flex={1}>
|
|
315
|
+
<YStack testID="stress-container" width={containerWidth} gap="$3">
|
|
316
|
+
{/* section 1: deeply nested (10 items x 6 depth = ~60 onLayout nodes) */}
|
|
317
|
+
<YStack testID="section-deep">
|
|
318
|
+
<Text fontSize={12} fontWeight="bold">
|
|
319
|
+
Deep Nesting (10x6 depth)
|
|
320
|
+
</Text>
|
|
321
|
+
<XStack flexWrap="wrap" gap="$1">
|
|
322
|
+
{deepItems}
|
|
323
|
+
</XStack>
|
|
324
|
+
</YStack>
|
|
325
|
+
|
|
326
|
+
{/* section 2: grid layout (40 items) */}
|
|
327
|
+
<YStack testID="section-grid">
|
|
328
|
+
<Text fontSize={12} fontWeight="bold">
|
|
329
|
+
Grid (40 items)
|
|
330
|
+
</Text>
|
|
331
|
+
<XStack flexWrap="wrap">{gridItems}</XStack>
|
|
332
|
+
</YStack>
|
|
333
|
+
|
|
334
|
+
{/* section 3: list with varying heights (20 items) */}
|
|
335
|
+
<YStack testID="section-list">
|
|
336
|
+
<Text fontSize={12} fontWeight="bold">
|
|
337
|
+
List (20 items)
|
|
338
|
+
</Text>
|
|
339
|
+
<YStack>{listItems}</YStack>
|
|
340
|
+
</YStack>
|
|
341
|
+
|
|
342
|
+
{/* section 4: sibling groups (50 items) */}
|
|
343
|
+
<YStack testID="section-siblings">
|
|
344
|
+
<Text fontSize={12} fontWeight="bold">
|
|
345
|
+
Sibling Groups (5x10)
|
|
346
|
+
</Text>
|
|
347
|
+
<YStack gap="$2">{siblingGroups}</YStack>
|
|
348
|
+
</YStack>
|
|
349
|
+
</YStack>
|
|
350
|
+
</ScrollView>
|
|
351
|
+
</YStack>
|
|
352
|
+
)
|
|
353
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Button, Text, View, XStack, YStack, styled } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
const TransparentBox = styled(View, {
|
|
5
|
+
width: 100,
|
|
6
|
+
height: 100,
|
|
7
|
+
|
|
8
|
+
variants: {
|
|
9
|
+
faded: {
|
|
10
|
+
true: {
|
|
11
|
+
backgroundColor: '$customRed/50' as any,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
} as const,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export function OpacityModifierCase() {
|
|
18
|
+
const [toggled, setToggled] = useState(false)
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<YStack gap="$4" padding="$4">
|
|
22
|
+
{/* static background colors with opacity modifiers */}
|
|
23
|
+
<XStack gap="$2">
|
|
24
|
+
<View
|
|
25
|
+
data-testid="opacity-bg-red-50"
|
|
26
|
+
backgroundColor={'$customRed/50' as any}
|
|
27
|
+
width={100}
|
|
28
|
+
height={100}
|
|
29
|
+
/>
|
|
30
|
+
<View
|
|
31
|
+
data-testid="opacity-bg-blue-75"
|
|
32
|
+
backgroundColor={'$customBlue/75' as any}
|
|
33
|
+
width={100}
|
|
34
|
+
height={100}
|
|
35
|
+
/>
|
|
36
|
+
<View
|
|
37
|
+
data-testid="opacity-bg-green-25"
|
|
38
|
+
backgroundColor={'$customGreen/25' as any}
|
|
39
|
+
width={100}
|
|
40
|
+
height={100}
|
|
41
|
+
/>
|
|
42
|
+
</XStack>
|
|
43
|
+
|
|
44
|
+
{/* text color with opacity */}
|
|
45
|
+
<View data-testid="opacity-text-container">
|
|
46
|
+
<Text data-testid="opacity-text" color={'$customRed/50' as any} fontSize="$6">
|
|
47
|
+
50% red text
|
|
48
|
+
</Text>
|
|
49
|
+
</View>
|
|
50
|
+
|
|
51
|
+
{/* border color with opacity */}
|
|
52
|
+
<View
|
|
53
|
+
data-testid="opacity-border"
|
|
54
|
+
borderColor={'$customRed/30' as any}
|
|
55
|
+
borderWidth={2}
|
|
56
|
+
width={100}
|
|
57
|
+
height={100}
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
{/* $token/100 should be same as no modifier */}
|
|
61
|
+
<View
|
|
62
|
+
data-testid="opacity-bg-full"
|
|
63
|
+
backgroundColor={'$customRed/100' as any}
|
|
64
|
+
width={100}
|
|
65
|
+
height={100}
|
|
66
|
+
/>
|
|
67
|
+
|
|
68
|
+
{/* $token/0 should be fully transparent */}
|
|
69
|
+
<View
|
|
70
|
+
data-testid="opacity-bg-zero"
|
|
71
|
+
backgroundColor={'$customRed/0' as any}
|
|
72
|
+
width={100}
|
|
73
|
+
height={100}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
{/* variant with opacity modifier */}
|
|
77
|
+
<TransparentBox data-testid="opacity-variant" faded={true as any} />
|
|
78
|
+
|
|
79
|
+
{/* hover state with opacity modifier */}
|
|
80
|
+
<View
|
|
81
|
+
data-testid="opacity-hover"
|
|
82
|
+
backgroundColor={'$customBlue/100' as any}
|
|
83
|
+
hoverStyle={{
|
|
84
|
+
backgroundColor: '$customBlue/50' as any,
|
|
85
|
+
}}
|
|
86
|
+
width={100}
|
|
87
|
+
height={100}
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
{/* animated color with opacity modifier */}
|
|
91
|
+
<View
|
|
92
|
+
{...({
|
|
93
|
+
'data-testid': 'opacity-animated',
|
|
94
|
+
animation: '500ms',
|
|
95
|
+
backgroundColor: toggled ? '$customBlue/75' : '$customRed/50',
|
|
96
|
+
width: 100,
|
|
97
|
+
height: 100,
|
|
98
|
+
} as any)}
|
|
99
|
+
/>
|
|
100
|
+
<Button data-testid="opacity-toggle" onPress={() => setToggled((v) => !v)}>
|
|
101
|
+
Toggle
|
|
102
|
+
</Button>
|
|
103
|
+
|
|
104
|
+
{/* theme value with opacity modifier */}
|
|
105
|
+
<View
|
|
106
|
+
data-testid="opacity-theme-bg"
|
|
107
|
+
backgroundColor={'$background/50' as any}
|
|
108
|
+
width={100}
|
|
109
|
+
height={100}
|
|
110
|
+
/>
|
|
111
|
+
</YStack>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Button, XStack } from '@hanzo/gui'
|
|
2
|
+
import { AlertDialog, styled } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
export const MyOverlay = styled(AlertDialog.Overlay, {
|
|
5
|
+
transition: 'quick',
|
|
6
|
+
backgroundColor: 'gray',
|
|
7
|
+
opacity: 0.7,
|
|
8
|
+
enterStyle: { opacity: 0 },
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const MyAlert = AlertDialog
|
|
12
|
+
|
|
13
|
+
export function OverlayStyled() {
|
|
14
|
+
return (
|
|
15
|
+
<XStack p="$10" gap="$4">
|
|
16
|
+
<WorkingExample />
|
|
17
|
+
<NotWorkingExample />
|
|
18
|
+
</XStack>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const WorkingExample = () => {
|
|
23
|
+
return (
|
|
24
|
+
<MyAlert>
|
|
25
|
+
<MyAlert.Trigger asChild>
|
|
26
|
+
<Button>Open working</Button>
|
|
27
|
+
</MyAlert.Trigger>
|
|
28
|
+
<MyAlert.Portal>
|
|
29
|
+
<MyAlert.Overlay
|
|
30
|
+
key="overlay"
|
|
31
|
+
transition="quick"
|
|
32
|
+
backgroundColor="gray"
|
|
33
|
+
opacity={0.7}
|
|
34
|
+
enterStyle={{ opacity: 0 }}
|
|
35
|
+
/>
|
|
36
|
+
<MyAlert.Content>
|
|
37
|
+
<MyAlert.Title>Test</MyAlert.Title>
|
|
38
|
+
<MyAlert.Description>Lorem ipsum dolor sit amet</MyAlert.Description>
|
|
39
|
+
<MyAlert.Cancel asChild>
|
|
40
|
+
<Button>OK</Button>
|
|
41
|
+
</MyAlert.Cancel>
|
|
42
|
+
</MyAlert.Content>
|
|
43
|
+
</MyAlert.Portal>
|
|
44
|
+
</MyAlert>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const NotWorkingExample = () => {
|
|
49
|
+
return (
|
|
50
|
+
<MyAlert>
|
|
51
|
+
<MyAlert.Trigger asChild>
|
|
52
|
+
<Button>Open not working </Button>
|
|
53
|
+
</MyAlert.Trigger>
|
|
54
|
+
<MyAlert.Portal>
|
|
55
|
+
<MyOverlay key="overlay" />
|
|
56
|
+
<MyAlert.Content>
|
|
57
|
+
<MyAlert.Title>Test</MyAlert.Title>
|
|
58
|
+
<MyAlert.Description>Lorem ipsum dolor sit amet</MyAlert.Description>
|
|
59
|
+
<MyAlert.Cancel asChild>
|
|
60
|
+
<Button>OK</Button>
|
|
61
|
+
</MyAlert.Cancel>
|
|
62
|
+
</MyAlert.Content>
|
|
63
|
+
</MyAlert.Portal>
|
|
64
|
+
</MyAlert>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Paragraph, SizableText, Span, Text } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
// Test case: Span inside Paragraph should inherit fontFamily
|
|
4
|
+
// Issue: When Span is nested inside Paragraph with fontFamily="$mono",
|
|
5
|
+
// the Span does not inherit the mono font family
|
|
6
|
+
|
|
7
|
+
export function ParagraphSpanFontInheritance() {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
{/* Test 1: Span should inherit $mono fontFamily from Paragraph */}
|
|
11
|
+
<Paragraph testID="parent-mono" fontFamily="$mono">
|
|
12
|
+
mono paragraph with <Span testID="nested-span-mono">span text</Span> inside
|
|
13
|
+
</Paragraph>
|
|
14
|
+
|
|
15
|
+
{/* Test 2: Span should inherit $body fontFamily from Paragraph */}
|
|
16
|
+
<Paragraph testID="parent-body" fontFamily="$body">
|
|
17
|
+
body paragraph with <Span testID="nested-span-body">span text</Span> inside
|
|
18
|
+
</Paragraph>
|
|
19
|
+
|
|
20
|
+
{/* Test 3: Text inside Text (for comparison) */}
|
|
21
|
+
<Text testID="parent-text-mono" fontFamily="$mono">
|
|
22
|
+
mono text with <Text testID="nested-text-mono">nested text</Text> inside
|
|
23
|
+
</Text>
|
|
24
|
+
|
|
25
|
+
{/* Test 4: Span with explicit fontFamily override */}
|
|
26
|
+
<Paragraph testID="parent-mono-override" fontFamily="$mono">
|
|
27
|
+
mono paragraph with{' '}
|
|
28
|
+
<Span testID="nested-span-override" fontFamily="$body">
|
|
29
|
+
span with body font
|
|
30
|
+
</Span>{' '}
|
|
31
|
+
inside
|
|
32
|
+
</Paragraph>
|
|
33
|
+
|
|
34
|
+
{/* Test 5: SizableText (which explicitly sets fontFamily) should keep its explicit font */}
|
|
35
|
+
<Text testID="parent-mono-sizable" fontFamily="$mono">
|
|
36
|
+
mono text with{' '}
|
|
37
|
+
<SizableText testID="nested-sizable-body">
|
|
38
|
+
sizable text with body font
|
|
39
|
+
</SizableText>{' '}
|
|
40
|
+
inside
|
|
41
|
+
</Text>
|
|
42
|
+
|
|
43
|
+
{/* Test 6: Text (like Link) inside Paragraph should inherit fontFamily */}
|
|
44
|
+
<Paragraph testID="parent-para-link" fontFamily="$mono">
|
|
45
|
+
mono paragraph with{' '}
|
|
46
|
+
<Text testID="nested-link-text" render="a" cursor="pointer">
|
|
47
|
+
link text
|
|
48
|
+
</Text>{' '}
|
|
49
|
+
inside
|
|
50
|
+
</Paragraph>
|
|
51
|
+
</>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Input, Text, YStack } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
export const PlaceholderTextColor = () => (
|
|
4
|
+
<YStack gap="$3" p="$4">
|
|
5
|
+
<Text>Token "$red10":</Text>
|
|
6
|
+
<Input placeholder="should be red" placeholderTextColor="$red10" />
|
|
7
|
+
|
|
8
|
+
<Text>Token "$green10":</Text>
|
|
9
|
+
<Input placeholder="should be green" placeholderTextColor="$green10" />
|
|
10
|
+
|
|
11
|
+
<Text>Token "$color10":</Text>
|
|
12
|
+
<Input placeholder="should be $color10" placeholderTextColor="$color10" />
|
|
13
|
+
|
|
14
|
+
<Text>Token "$blue10":</Text>
|
|
15
|
+
<Input placeholder="should be blue" placeholderTextColor="$blue10" />
|
|
16
|
+
|
|
17
|
+
<Text>No placeholderTextColor (default):</Text>
|
|
18
|
+
<Input placeholder="default placeholder color" />
|
|
19
|
+
</YStack>
|
|
20
|
+
)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Square, Text, XStack, YStack } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
export function PointerEventsCase() {
|
|
5
|
+
const [counts, setCounts] = useState({
|
|
6
|
+
down: 0,
|
|
7
|
+
up: 0,
|
|
8
|
+
move: 0,
|
|
9
|
+
cancel: 0,
|
|
10
|
+
enter: 0,
|
|
11
|
+
leave: 0,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
// separate counters for capture test
|
|
15
|
+
const [captureMove, setCaptureMove] = useState(0)
|
|
16
|
+
|
|
17
|
+
// box-none test counters
|
|
18
|
+
const [boxNoneCounts, setBoxNoneCounts] = useState({
|
|
19
|
+
parent: 0,
|
|
20
|
+
child: 0,
|
|
21
|
+
behind: 0,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<YStack testID="pointer-events-root" padding="$4" gap="$4">
|
|
26
|
+
<Square
|
|
27
|
+
testID="pointer-target"
|
|
28
|
+
size={200}
|
|
29
|
+
backgroundColor="$blue5"
|
|
30
|
+
onPointerDown={() => setCounts((c) => ({ ...c, down: c.down + 1 }))}
|
|
31
|
+
onPointerUp={() => setCounts((c) => ({ ...c, up: c.up + 1 }))}
|
|
32
|
+
onPointerMove={() => setCounts((c) => ({ ...c, move: c.move + 1 }))}
|
|
33
|
+
onPointerCancel={() => setCounts((c) => ({ ...c, cancel: c.cancel + 1 }))}
|
|
34
|
+
onPointerEnter={() => setCounts((c) => ({ ...c, enter: c.enter + 1 }))}
|
|
35
|
+
onPointerLeave={() => setCounts((c) => ({ ...c, leave: c.leave + 1 }))}
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
{/* capture test: should receive moves outside bounds when captured */}
|
|
39
|
+
<Square
|
|
40
|
+
testID="capture-target"
|
|
41
|
+
size={200}
|
|
42
|
+
backgroundColor="$green5"
|
|
43
|
+
onPointerDown={(e: any) => {
|
|
44
|
+
e.target.setPointerCapture(e.pointerId)
|
|
45
|
+
}}
|
|
46
|
+
onPointerMove={() => setCaptureMove((c) => c + 1)}
|
|
47
|
+
onPointerUp={(e: any) => {
|
|
48
|
+
e.target.releasePointerCapture(e.pointerId)
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
{/* box-none test: parent should not receive clicks, but child and element behind should */}
|
|
53
|
+
<YStack position="relative" width={300} height={200}>
|
|
54
|
+
{/* element behind the box-none parent */}
|
|
55
|
+
<Square
|
|
56
|
+
testID="box-none-behind"
|
|
57
|
+
position="absolute"
|
|
58
|
+
top={20}
|
|
59
|
+
left={20}
|
|
60
|
+
size={100}
|
|
61
|
+
backgroundColor="$red5"
|
|
62
|
+
onPress={() => setBoxNoneCounts((c) => ({ ...c, behind: c.behind + 1 }))}
|
|
63
|
+
/>
|
|
64
|
+
{/* box-none parent covering part of behind element */}
|
|
65
|
+
<XStack
|
|
66
|
+
testID="box-none-parent"
|
|
67
|
+
pointerEvents="box-none"
|
|
68
|
+
position="absolute"
|
|
69
|
+
top={0}
|
|
70
|
+
left={0}
|
|
71
|
+
width={200}
|
|
72
|
+
height={150}
|
|
73
|
+
backgroundColor="$purple5"
|
|
74
|
+
opacity={0.5}
|
|
75
|
+
onPress={() => setBoxNoneCounts((c) => ({ ...c, parent: c.parent + 1 }))}
|
|
76
|
+
>
|
|
77
|
+
{/* child inside box-none parent */}
|
|
78
|
+
<Square
|
|
79
|
+
testID="box-none-child"
|
|
80
|
+
size={60}
|
|
81
|
+
backgroundColor="$green5"
|
|
82
|
+
onPress={() => setBoxNoneCounts((c) => ({ ...c, child: c.child + 1 }))}
|
|
83
|
+
/>
|
|
84
|
+
</XStack>
|
|
85
|
+
</YStack>
|
|
86
|
+
|
|
87
|
+
<XStack gap="$2" flexWrap="wrap">
|
|
88
|
+
<Text testID="down-count">Down: {counts.down}</Text>
|
|
89
|
+
<Text testID="up-count">Up: {counts.up}</Text>
|
|
90
|
+
<Text testID="move-count">Move: {counts.move}</Text>
|
|
91
|
+
<Text testID="enter-count">Enter: {counts.enter}</Text>
|
|
92
|
+
<Text testID="leave-count">Leave: {counts.leave}</Text>
|
|
93
|
+
<Text testID="capture-move-count">CapMove: {captureMove}</Text>
|
|
94
|
+
<Text testID="box-none-parent-count">BoxNoneParent: {boxNoneCounts.parent}</Text>
|
|
95
|
+
<Text testID="box-none-child-count">BoxNoneChild: {boxNoneCounts.child}</Text>
|
|
96
|
+
<Text testID="box-none-behind-count">BoxNoneBehind: {boxNoneCounts.behind}</Text>
|
|
97
|
+
</XStack>
|
|
98
|
+
</YStack>
|
|
99
|
+
)
|
|
100
|
+
}
|