@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,246 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
type GetProps,
|
|
4
|
+
SizableText,
|
|
5
|
+
ThemeableStack,
|
|
6
|
+
createStyledContext,
|
|
7
|
+
styled,
|
|
8
|
+
} from '@hanzo/gui'
|
|
9
|
+
|
|
10
|
+
// Reproduce GitHub issue #3676 - Context Values Not Accessible in Children Styles
|
|
11
|
+
// Parent component style properties like `color` cannot be accessed by child components
|
|
12
|
+
|
|
13
|
+
// Create a custom button with styled context
|
|
14
|
+
export const CustomButtonContext = createStyledContext<{
|
|
15
|
+
size?: any
|
|
16
|
+
color?: string
|
|
17
|
+
}>({
|
|
18
|
+
size: '$4',
|
|
19
|
+
color: undefined,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const CustomButtonFrame = styled(ThemeableStack, {
|
|
23
|
+
name: 'CustomButton',
|
|
24
|
+
context: CustomButtonContext,
|
|
25
|
+
render: 'button',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
flexDirection: 'row',
|
|
29
|
+
cursor: 'pointer',
|
|
30
|
+
padding: '$3',
|
|
31
|
+
borderRadius: '$4',
|
|
32
|
+
backgroundColor: '$background',
|
|
33
|
+
|
|
34
|
+
variants: {
|
|
35
|
+
color: {
|
|
36
|
+
green: {
|
|
37
|
+
// This should propagate to children via context
|
|
38
|
+
color: 'green',
|
|
39
|
+
},
|
|
40
|
+
red: {
|
|
41
|
+
color: 'red',
|
|
42
|
+
},
|
|
43
|
+
blue: {
|
|
44
|
+
color: 'blue',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
} as const,
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const CustomButtonText = styled(SizableText, {
|
|
51
|
+
name: 'CustomButtonText',
|
|
52
|
+
context: CustomButtonContext,
|
|
53
|
+
|
|
54
|
+
variants: {
|
|
55
|
+
color: {
|
|
56
|
+
green: {
|
|
57
|
+
color: 'green',
|
|
58
|
+
},
|
|
59
|
+
red: {
|
|
60
|
+
color: 'red',
|
|
61
|
+
},
|
|
62
|
+
blue: {
|
|
63
|
+
color: 'blue',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
} as const,
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
// This is the key pattern from issue #3676 - using $color to reference context value
|
|
70
|
+
// The child should use $color to reference the parent's color value from context
|
|
71
|
+
const ContextRefButtonFrame = styled(ThemeableStack, {
|
|
72
|
+
name: 'ContextRefButton',
|
|
73
|
+
context: CustomButtonContext,
|
|
74
|
+
render: 'button',
|
|
75
|
+
justifyContent: 'center',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
flexDirection: 'row',
|
|
78
|
+
cursor: 'pointer',
|
|
79
|
+
padding: '$3',
|
|
80
|
+
borderRadius: '$4',
|
|
81
|
+
backgroundColor: '$background',
|
|
82
|
+
|
|
83
|
+
variants: {
|
|
84
|
+
variant: {
|
|
85
|
+
link: {
|
|
86
|
+
// Sets color in context via variant - this is the issue!
|
|
87
|
+
// The variant's color should propagate to context and children should receive it
|
|
88
|
+
color: 'green',
|
|
89
|
+
hoverStyle: { color: 'red' },
|
|
90
|
+
},
|
|
91
|
+
primary: {
|
|
92
|
+
color: 'blue',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
} as const,
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
// Child that references parent's context color using $color syntax
|
|
99
|
+
// This pattern mimics ButtonText which uses `color: '$color'` to inherit from parent
|
|
100
|
+
const ContextRefButtonText = styled(SizableText, {
|
|
101
|
+
name: 'ContextRefButtonText',
|
|
102
|
+
context: CustomButtonContext,
|
|
103
|
+
|
|
104
|
+
variants: {
|
|
105
|
+
// Using unstyled pattern like ButtonText does
|
|
106
|
+
unstyled: {
|
|
107
|
+
false: {
|
|
108
|
+
// This $color should reference the parent's color value from context
|
|
109
|
+
color: '$color',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
} as const,
|
|
113
|
+
|
|
114
|
+
defaultVariants: {
|
|
115
|
+
unstyled: false,
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
type CustomButtonProps = GetProps<typeof CustomButtonFrame> & {
|
|
120
|
+
children?: React.ReactNode
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const CustomButtonComponent = CustomButtonFrame.styleable<CustomButtonProps>(
|
|
124
|
+
function CustomButton(props, ref) {
|
|
125
|
+
const { children, ...rest } = props
|
|
126
|
+
return (
|
|
127
|
+
<CustomButtonFrame {...rest} ref={ref}>
|
|
128
|
+
<CustomButtonText>{children}</CustomButtonText>
|
|
129
|
+
</CustomButtonFrame>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
type ContextRefButtonProps = GetProps<typeof ContextRefButtonFrame> & {
|
|
135
|
+
children?: React.ReactNode
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const ContextRefButtonComponent = ContextRefButtonFrame.styleable<ContextRefButtonProps>(
|
|
139
|
+
function ContextRefButton(props, ref) {
|
|
140
|
+
const { children, ...rest } = props
|
|
141
|
+
return (
|
|
142
|
+
<ContextRefButtonFrame {...rest} ref={ref}>
|
|
143
|
+
<ContextRefButtonText>{children}</ContextRefButtonText>
|
|
144
|
+
</ContextRefButtonFrame>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
// Issue #3670 - pressStyle color not propagating to children
|
|
150
|
+
// Button with pressStyle that changes color - should propagate to text on press
|
|
151
|
+
// Note: This only works with animation drivers that re-render on press (not CSS driver)
|
|
152
|
+
const PressStyleButtonFrame = styled(ThemeableStack, {
|
|
153
|
+
name: 'PressStyleButton',
|
|
154
|
+
context: CustomButtonContext,
|
|
155
|
+
render: 'button',
|
|
156
|
+
justifyContent: 'center',
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
flexDirection: 'row',
|
|
159
|
+
cursor: 'pointer',
|
|
160
|
+
padding: '$3',
|
|
161
|
+
borderRadius: '$4',
|
|
162
|
+
backgroundColor: '$background',
|
|
163
|
+
color: 'green',
|
|
164
|
+
|
|
165
|
+
pressStyle: {
|
|
166
|
+
// @ts-ignore TODO
|
|
167
|
+
color: 'red',
|
|
168
|
+
},
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
const PressStyleButtonText = styled(SizableText, {
|
|
172
|
+
name: 'PressStyleButtonText',
|
|
173
|
+
context: CustomButtonContext,
|
|
174
|
+
|
|
175
|
+
variants: {
|
|
176
|
+
color: {
|
|
177
|
+
green: { color: 'green' },
|
|
178
|
+
red: { color: 'red' },
|
|
179
|
+
},
|
|
180
|
+
} as const,
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
type PressStyleButtonProps = GetProps<typeof PressStyleButtonFrame> & {
|
|
184
|
+
children?: React.ReactNode
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const PressStyleButtonComponent = PressStyleButtonFrame.styleable<PressStyleButtonProps>(
|
|
188
|
+
function PressStyleButton(props, ref) {
|
|
189
|
+
const { children, ...rest } = props
|
|
190
|
+
return (
|
|
191
|
+
<PressStyleButtonFrame {...rest} ref={ref}>
|
|
192
|
+
<PressStyleButtonText>{children}</PressStyleButtonText>
|
|
193
|
+
</PressStyleButtonFrame>
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
export function StyledContextColor() {
|
|
199
|
+
return (
|
|
200
|
+
<>
|
|
201
|
+
{/* Test 1: Using the standard Button with color prop */}
|
|
202
|
+
<Button testID="standard-button-green">
|
|
203
|
+
<Button.Text color="green">Standard Button Green</Button.Text>
|
|
204
|
+
</Button>
|
|
205
|
+
|
|
206
|
+
{/* Test 2: Custom button with color variant - should propagate to text */}
|
|
207
|
+
<CustomButtonComponent testID="custom-button-green" color="green">
|
|
208
|
+
Custom Button Green
|
|
209
|
+
</CustomButtonComponent>
|
|
210
|
+
|
|
211
|
+
<CustomButtonComponent testID="custom-button-red" color="red">
|
|
212
|
+
Custom Button Red
|
|
213
|
+
</CustomButtonComponent>
|
|
214
|
+
|
|
215
|
+
{/* Test 3: Manual context provider */}
|
|
216
|
+
<CustomButtonContext.Provider color="blue">
|
|
217
|
+
<CustomButtonFrame testID="context-frame-blue">
|
|
218
|
+
<CustomButtonText testID="context-text-blue">
|
|
219
|
+
Context Provided Blue
|
|
220
|
+
</CustomButtonText>
|
|
221
|
+
</CustomButtonFrame>
|
|
222
|
+
</CustomButtonContext.Provider>
|
|
223
|
+
|
|
224
|
+
{/* Test 4: Issue #3676 - $color reference should get parent's color from context */}
|
|
225
|
+
{/* Direct color prop - this should work like Button */}
|
|
226
|
+
<CustomButtonContext.Provider color="green">
|
|
227
|
+
<ContextRefButtonFrame testID="context-ref-button-link">
|
|
228
|
+
<ContextRefButtonText testID="context-ref-text-link">
|
|
229
|
+
Context Ref Link Text (via Provider)
|
|
230
|
+
</ContextRefButtonText>
|
|
231
|
+
</ContextRefButtonFrame>
|
|
232
|
+
</CustomButtonContext.Provider>
|
|
233
|
+
|
|
234
|
+
{/* Using variant to set color - this is the problematic case */}
|
|
235
|
+
<ContextRefButtonComponent testID="context-ref-button-primary" variant="primary">
|
|
236
|
+
Context Ref Primary Button (via variant)
|
|
237
|
+
</ContextRefButtonComponent>
|
|
238
|
+
|
|
239
|
+
{/* Test 5: Issue #3670 - pressStyle color should propagate to children on press */}
|
|
240
|
+
{/* Note: Requires disableClassName to force runtime press handling */}
|
|
241
|
+
<PressStyleButtonComponent testID="press-style-button" disableClassName>
|
|
242
|
+
Press Style Button (green → red on press)
|
|
243
|
+
</PressStyleButtonComponent>
|
|
244
|
+
</>
|
|
245
|
+
)
|
|
246
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { View, Text, createStyledContext, styled, useMedia } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Test case for styled context token preservation (issues #3670, #3676)
|
|
5
|
+
*
|
|
6
|
+
* This tests that when a parent component sets a context value via a variant,
|
|
7
|
+
* the child's functional variant receives the original token string (like '$4')
|
|
8
|
+
* instead of the resolved CSS variable (like 'var(--t-space-4)').
|
|
9
|
+
*
|
|
10
|
+
* The child uses a functional variant that looks up the gap token value
|
|
11
|
+
* to calculate width. If it receives 'var(--t-space-4)' instead of '$4',
|
|
12
|
+
* the token lookup fails.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const GridContext = createStyledContext({
|
|
16
|
+
gap: '$4' as string,
|
|
17
|
+
columns: 2 as number,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const GridParent = styled(View, {
|
|
21
|
+
name: 'GridParent',
|
|
22
|
+
context: GridContext,
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
flexWrap: 'wrap',
|
|
25
|
+
|
|
26
|
+
variants: {
|
|
27
|
+
spacing: {
|
|
28
|
+
small: {
|
|
29
|
+
gap: '$2',
|
|
30
|
+
},
|
|
31
|
+
medium: {
|
|
32
|
+
gap: '$4',
|
|
33
|
+
},
|
|
34
|
+
large: {
|
|
35
|
+
gap: '$8',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
} as const,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const GridChild = styled(View, {
|
|
42
|
+
name: 'GridChild',
|
|
43
|
+
context: GridContext,
|
|
44
|
+
height: 50,
|
|
45
|
+
backgroundColor: '$blue10',
|
|
46
|
+
|
|
47
|
+
variants: {
|
|
48
|
+
columns: {
|
|
49
|
+
// Functional variant that uses context props
|
|
50
|
+
':number': (columns, { props, tokens }) => {
|
|
51
|
+
const gapToken = props.gap as string
|
|
52
|
+
|
|
53
|
+
// Test: gapToken should be '$2', '$4', or '$8' - NOT 'var(--t-space-X)'
|
|
54
|
+
// If it's a CSS variable, the token lookup below will fail
|
|
55
|
+
const isTokenString = gapToken?.startsWith('$')
|
|
56
|
+
|
|
57
|
+
// Try to get the gap value from tokens
|
|
58
|
+
let gapValue = 0
|
|
59
|
+
if (isTokenString && gapToken) {
|
|
60
|
+
const tokenKey = gapToken.slice(1) // remove '$'
|
|
61
|
+
const spaceToken = tokens.space[`$${tokenKey}`]
|
|
62
|
+
if (spaceToken) {
|
|
63
|
+
gapValue = typeof spaceToken.val === 'number' ? spaceToken.val : 0
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Calculate width based on columns and gap
|
|
68
|
+
// width = (100% / columns) - (gap * (columns - 1) / columns)
|
|
69
|
+
const widthPercent = 100 / columns
|
|
70
|
+
const gapAdjustment = (gapValue * (columns - 1)) / columns
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
width: `calc(${widthPercent}% - ${gapAdjustment}px)`,
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
} as const,
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
// Component that displays debug info about the context props
|
|
81
|
+
const DebugInfo = styled(Text, {
|
|
82
|
+
name: 'DebugInfo',
|
|
83
|
+
context: GridContext,
|
|
84
|
+
fontSize: 12,
|
|
85
|
+
fontFamily: '$mono',
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
function DebugDisplay({ id }: { id: string }) {
|
|
89
|
+
// Access context to show what values the child receives
|
|
90
|
+
const context = GridContext.useStyledContext()
|
|
91
|
+
const isToken = context.gap?.startsWith('$')
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<View id={id} padding="$2" backgroundColor={isToken ? '$green5' : '$red5'}>
|
|
95
|
+
<DebugInfo>gap: {context.gap}</DebugInfo>
|
|
96
|
+
<DebugInfo>isToken: {String(isToken)}</DebugInfo>
|
|
97
|
+
<DebugInfo id={`${id}-gap-value`}>{context.gap}</DebugInfo>
|
|
98
|
+
</View>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function StyledContextTokens() {
|
|
103
|
+
const media = useMedia()
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<View padding="$4" gap="$4">
|
|
107
|
+
<Text fontWeight="bold">Styled Context Token Preservation Test</Text>
|
|
108
|
+
|
|
109
|
+
{/* Test 1: Variant sets gap to $2 */}
|
|
110
|
+
<View>
|
|
111
|
+
<Text>Test 1: spacing="small" should set gap="$2"</Text>
|
|
112
|
+
<GridParent spacing="small" id="test-small">
|
|
113
|
+
<DebugDisplay id="debug-small" />
|
|
114
|
+
<GridChild columns={2} id="child-small-1" />
|
|
115
|
+
<GridChild columns={2} id="child-small-2" />
|
|
116
|
+
</GridParent>
|
|
117
|
+
</View>
|
|
118
|
+
|
|
119
|
+
{/* Test 2: Variant sets gap to $8 */}
|
|
120
|
+
<View>
|
|
121
|
+
<Text>Test 2: spacing="large" should set gap="$8"</Text>
|
|
122
|
+
<GridParent spacing="large" id="test-large">
|
|
123
|
+
<DebugDisplay id="debug-large" />
|
|
124
|
+
<GridChild columns={2} id="child-large-1" />
|
|
125
|
+
<GridChild columns={2} id="child-large-2" />
|
|
126
|
+
</GridParent>
|
|
127
|
+
</View>
|
|
128
|
+
|
|
129
|
+
{/* Test 3: Default gap (no variant) */}
|
|
130
|
+
<View>
|
|
131
|
+
<Text>Test 3: no spacing prop, default gap="$4"</Text>
|
|
132
|
+
<GridParent id="test-default">
|
|
133
|
+
<DebugDisplay id="debug-default" />
|
|
134
|
+
<GridChild columns={2} id="child-default-1" />
|
|
135
|
+
<GridChild columns={2} id="child-default-2" />
|
|
136
|
+
</GridParent>
|
|
137
|
+
</View>
|
|
138
|
+
|
|
139
|
+
{/* Show current media state for debugging */}
|
|
140
|
+
<View padding="$2" backgroundColor="$gray5">
|
|
141
|
+
<Text fontSize={10}>
|
|
142
|
+
Media: sm={String(media.sm)} md={String(media.md)} lg={String(media.lg)}
|
|
143
|
+
</Text>
|
|
144
|
+
</View>
|
|
145
|
+
</View>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { H1, Label, Text, styled } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
const X1 = styled(Label, {
|
|
4
|
+
name: 'MyLabel',
|
|
5
|
+
color: '$color',
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
const X2 = styled(Text, {
|
|
9
|
+
name: 'MyLabel',
|
|
10
|
+
color: '$color',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const StyledHOCNamed = () => {
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<X1 testID="text-named">hi</X1>
|
|
17
|
+
<X2 testID="label-named">hi</X2>
|
|
18
|
+
</>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { styled } from '@hanzogui/core'
|
|
2
|
+
|
|
3
|
+
// Test: styled.a() with proper href typing
|
|
4
|
+
const StyledAnchor = styled.a({
|
|
5
|
+
color: '$blue10',
|
|
6
|
+
textDecorationLine: 'underline',
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
// Test: styled.button() with proper type/disabled typing
|
|
10
|
+
const StyledButton = styled.button({
|
|
11
|
+
padding: '$4',
|
|
12
|
+
backgroundColor: '$background',
|
|
13
|
+
borderRadius: '$4',
|
|
14
|
+
cursor: 'pointer',
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
// Test: styled.div() basic
|
|
18
|
+
const StyledDiv = styled.div({
|
|
19
|
+
padding: '$2',
|
|
20
|
+
backgroundColor: '$backgroundHover',
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
// Test: styled.span() text-like element
|
|
24
|
+
const StyledSpan = styled.span({
|
|
25
|
+
color: '$color',
|
|
26
|
+
fontWeight: 'bold',
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
// Test: styled.input() with proper input attributes
|
|
30
|
+
const StyledInput = styled.input({
|
|
31
|
+
padding: '$2',
|
|
32
|
+
borderWidth: 1,
|
|
33
|
+
borderColor: '$borderColor',
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
// Test: styled.form() with proper form attributes
|
|
37
|
+
const StyledForm = styled.form({
|
|
38
|
+
gap: '$3',
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
// Test: styled.label() with proper htmlFor typing
|
|
42
|
+
const StyledLabel = styled.label({
|
|
43
|
+
fontSize: '$3',
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
// Test: styled.nav/main/section/article/footer semantic elements
|
|
47
|
+
const StyledNav = styled.nav({
|
|
48
|
+
padding: '$2',
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const StyledMain = styled.main({
|
|
52
|
+
padding: '$2',
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const StyledSection = styled.section({
|
|
56
|
+
padding: '$3',
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
// Test: styled.a() with variants
|
|
60
|
+
const StyledAnchorWithVariants = styled.a({
|
|
61
|
+
color: '$blue10',
|
|
62
|
+
|
|
63
|
+
variants: {
|
|
64
|
+
size: {
|
|
65
|
+
small: { fontSize: '$2' },
|
|
66
|
+
large: { fontSize: '$6' },
|
|
67
|
+
},
|
|
68
|
+
underline: {
|
|
69
|
+
true: { textDecorationLine: 'underline' },
|
|
70
|
+
false: { textDecorationLine: 'none' },
|
|
71
|
+
},
|
|
72
|
+
} as const,
|
|
73
|
+
|
|
74
|
+
defaultVariants: {
|
|
75
|
+
underline: true,
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
export function StyledHtmlCase() {
|
|
80
|
+
return (
|
|
81
|
+
<StyledDiv data-testid="styled-html-container">
|
|
82
|
+
{/* Test styled.a() */}
|
|
83
|
+
<StyledAnchor
|
|
84
|
+
data-testid="styled-a"
|
|
85
|
+
href="https://example.com"
|
|
86
|
+
target="_blank"
|
|
87
|
+
rel="noopener"
|
|
88
|
+
>
|
|
89
|
+
Anchor Link
|
|
90
|
+
</StyledAnchor>
|
|
91
|
+
|
|
92
|
+
{/* Test styled.button() */}
|
|
93
|
+
<StyledButton data-testid="styled-button" type="submit" disabled={false}>
|
|
94
|
+
Submit Button
|
|
95
|
+
</StyledButton>
|
|
96
|
+
|
|
97
|
+
{/* Test styled.div() */}
|
|
98
|
+
<StyledDiv data-testid="styled-div">Styled Div</StyledDiv>
|
|
99
|
+
|
|
100
|
+
{/* Test styled.span() */}
|
|
101
|
+
<StyledSpan data-testid="styled-span">Styled Span</StyledSpan>
|
|
102
|
+
|
|
103
|
+
{/* Test styled.input() */}
|
|
104
|
+
<StyledInput
|
|
105
|
+
data-testid="styled-input"
|
|
106
|
+
type="text"
|
|
107
|
+
placeholder="Enter text"
|
|
108
|
+
maxLength={100}
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
{/* Test styled.form() */}
|
|
112
|
+
<StyledForm data-testid="styled-form" action="/submit" method="post">
|
|
113
|
+
<StyledLabel data-testid="styled-label" htmlFor="test-input">
|
|
114
|
+
Label
|
|
115
|
+
</StyledLabel>
|
|
116
|
+
</StyledForm>
|
|
117
|
+
|
|
118
|
+
{/* Test semantic elements */}
|
|
119
|
+
<StyledNav data-testid="styled-nav">Navigation</StyledNav>
|
|
120
|
+
|
|
121
|
+
<StyledMain data-testid="styled-main">Main Content</StyledMain>
|
|
122
|
+
|
|
123
|
+
<StyledSection data-testid="styled-section">Section Content</StyledSection>
|
|
124
|
+
|
|
125
|
+
{/* Test styled.a() with variants */}
|
|
126
|
+
<StyledAnchorWithVariants
|
|
127
|
+
data-testid="styled-a-variants"
|
|
128
|
+
href="/internal"
|
|
129
|
+
size="large"
|
|
130
|
+
underline={false}
|
|
131
|
+
>
|
|
132
|
+
Large Link No Underline
|
|
133
|
+
</StyledAnchorWithVariants>
|
|
134
|
+
|
|
135
|
+
<StyledAnchorWithVariants
|
|
136
|
+
data-testid="styled-a-variants-small"
|
|
137
|
+
href="/small"
|
|
138
|
+
size="small"
|
|
139
|
+
>
|
|
140
|
+
Small Link With Underline
|
|
141
|
+
</StyledAnchorWithVariants>
|
|
142
|
+
</StyledDiv>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Check } from '@hanzogui/lucide-icons-2'
|
|
2
|
+
import { styled, YStack } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
const RedCheck = styled(Check, {
|
|
5
|
+
color: 'red',
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
const GreenCheck = styled(Check, {
|
|
9
|
+
color: 'green',
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const StyledIconColor = () => (
|
|
13
|
+
<YStack gap="$4" padding="$4">
|
|
14
|
+
<Check color="blue" testID="direct-blue" />
|
|
15
|
+
<RedCheck testID="styled-red" />
|
|
16
|
+
<GreenCheck testID="styled-green" />
|
|
17
|
+
<RedCheck color="purple" testID="override-purple" />
|
|
18
|
+
</YStack>
|
|
19
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Input, styled } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
const StyledInput = styled(Input, {
|
|
4
|
+
borderColor: 'red',
|
|
5
|
+
borderWidth: 5,
|
|
6
|
+
|
|
7
|
+
variants: {
|
|
8
|
+
test: {
|
|
9
|
+
true: {
|
|
10
|
+
focusStyle: {
|
|
11
|
+
borderWidth: 10,
|
|
12
|
+
borderColor: 'blue',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
} as const,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export function StyledInputFocusStyle() {
|
|
20
|
+
return <StyledInput test />
|
|
21
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
export function StyledInputOnFocus() {
|
|
21
|
+
const [onFocus, setOnFocus] = React.useState(false)
|
|
22
|
+
return (
|
|
23
|
+
<StyledInput
|
|
24
|
+
test
|
|
25
|
+
data-onfocus={onFocus}
|
|
26
|
+
id="onFocus"
|
|
27
|
+
onFocus={() => setOnFocus(true)}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|