@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,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stress page for profiling Hanzo GUI component render performance.
|
|
3
|
+
*
|
|
4
|
+
* Renders a diverse set of components to simulate a realistic page:
|
|
5
|
+
* styled components with defaults + variants, token values, theme tokens,
|
|
6
|
+
* nested themes, text with font resolution, lists with many repeated items.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* http://localhost:9000/?test=StressPage
|
|
10
|
+
* http://localhost:9000/?test=StressPage&profile=true
|
|
11
|
+
*
|
|
12
|
+
* With profile=true:
|
|
13
|
+
* - sets up @hanzogui/timer on globalThis.time so all internal
|
|
14
|
+
* getSplitStyles / createComponent checkpoints are captured
|
|
15
|
+
* - exposes window.__PERF_RESULT__ with wall-clock + breakdown data
|
|
16
|
+
*/
|
|
17
|
+
import { timer } from '@hanzogui/timer'
|
|
18
|
+
import React from 'react'
|
|
19
|
+
import {
|
|
20
|
+
Button,
|
|
21
|
+
Card,
|
|
22
|
+
H1,
|
|
23
|
+
H2,
|
|
24
|
+
H3,
|
|
25
|
+
Input,
|
|
26
|
+
Label,
|
|
27
|
+
Paragraph,
|
|
28
|
+
Separator,
|
|
29
|
+
SizableText,
|
|
30
|
+
Switch,
|
|
31
|
+
Theme,
|
|
32
|
+
View,
|
|
33
|
+
XStack,
|
|
34
|
+
YStack,
|
|
35
|
+
styled,
|
|
36
|
+
} from '@hanzo/gui'
|
|
37
|
+
|
|
38
|
+
const shouldProfile =
|
|
39
|
+
typeof window !== 'undefined' &&
|
|
40
|
+
new URLSearchParams(window.location.search).get('profile') === 'true'
|
|
41
|
+
|
|
42
|
+
// set up the timer globally so createComponent/getSplitStyles checkpoints fire
|
|
43
|
+
// (bypasses the broken require('@hanzogui/timer') in the built @hanzogui/web dist)
|
|
44
|
+
if (shouldProfile) {
|
|
45
|
+
const t = timer()
|
|
46
|
+
;(globalThis as any).time = t.start()
|
|
47
|
+
;(globalThis as any).__TIMER__ = t
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// styled components with variants
|
|
51
|
+
const StyledCard = styled(Card, {
|
|
52
|
+
padding: '$4',
|
|
53
|
+
borderRadius: '$4',
|
|
54
|
+
backgroundColor: '$background',
|
|
55
|
+
borderWidth: 1,
|
|
56
|
+
borderColor: '$borderColor',
|
|
57
|
+
elevation: '$2',
|
|
58
|
+
|
|
59
|
+
variants: {
|
|
60
|
+
highlighted: {
|
|
61
|
+
true: {
|
|
62
|
+
backgroundColor: '$blue2',
|
|
63
|
+
borderColor: '$blue6',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
size: {
|
|
67
|
+
sm: { padding: '$2' },
|
|
68
|
+
md: { padding: '$4' },
|
|
69
|
+
lg: { padding: '$6' },
|
|
70
|
+
},
|
|
71
|
+
} as const,
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const Badge = styled(View, {
|
|
75
|
+
paddingHorizontal: '$2',
|
|
76
|
+
paddingVertical: '$1',
|
|
77
|
+
borderRadius: '$10',
|
|
78
|
+
backgroundColor: '$blue4',
|
|
79
|
+
|
|
80
|
+
variants: {
|
|
81
|
+
color: {
|
|
82
|
+
green: { backgroundColor: '$green4' },
|
|
83
|
+
red: { backgroundColor: '$red4' },
|
|
84
|
+
orange: { backgroundColor: '$orange4' },
|
|
85
|
+
},
|
|
86
|
+
} as const,
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const StatBox = styled(YStack, {
|
|
90
|
+
padding: '$3',
|
|
91
|
+
borderRadius: '$3',
|
|
92
|
+
backgroundColor: '$backgroundHover',
|
|
93
|
+
gap: '$1',
|
|
94
|
+
flex: 1,
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
const items = Array.from({ length: 50 }, (_, i) => ({
|
|
98
|
+
id: i,
|
|
99
|
+
title: `Item ${i + 1}`,
|
|
100
|
+
desc: `Description for item ${i + 1} with some extra text`,
|
|
101
|
+
badge: (['green', 'red', 'orange'] as const)[i % 3],
|
|
102
|
+
}))
|
|
103
|
+
|
|
104
|
+
const stats = [
|
|
105
|
+
{ label: 'Users', value: '12,345' },
|
|
106
|
+
{ label: 'Revenue', value: '$98.7k' },
|
|
107
|
+
{ label: 'Orders', value: '3,456' },
|
|
108
|
+
{ label: 'Growth', value: '+23%' },
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
function Header() {
|
|
112
|
+
return (
|
|
113
|
+
<YStack gap="$2" padding="$4" backgroundColor="$background">
|
|
114
|
+
<H1 color="$color" fontWeight="800">
|
|
115
|
+
Dashboard
|
|
116
|
+
</H1>
|
|
117
|
+
<Paragraph color="$color8" size="$4">
|
|
118
|
+
Overview of your application metrics and recent activity
|
|
119
|
+
</Paragraph>
|
|
120
|
+
<XStack gap="$2" flexWrap="wrap">
|
|
121
|
+
{['All', 'Active', 'Pending', 'Archived'].map((tab) => (
|
|
122
|
+
<Button key={tab} size="$3" variant={tab === 'All' ? undefined : 'outlined'}>
|
|
123
|
+
{tab}
|
|
124
|
+
</Button>
|
|
125
|
+
))}
|
|
126
|
+
</XStack>
|
|
127
|
+
</YStack>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function StatsRow() {
|
|
132
|
+
return (
|
|
133
|
+
<XStack gap="$3" paddingHorizontal="$4" flexWrap="wrap">
|
|
134
|
+
{stats.map((s) => (
|
|
135
|
+
<StatBox key={s.label}>
|
|
136
|
+
<SizableText size="$2" color="$color8">
|
|
137
|
+
{s.label}
|
|
138
|
+
</SizableText>
|
|
139
|
+
<SizableText size="$8" fontWeight="700" color="$color">
|
|
140
|
+
{s.value}
|
|
141
|
+
</SizableText>
|
|
142
|
+
</StatBox>
|
|
143
|
+
))}
|
|
144
|
+
</XStack>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function ItemRow({ item }: { item: (typeof items)[0] }) {
|
|
149
|
+
return (
|
|
150
|
+
<XStack
|
|
151
|
+
padding="$3"
|
|
152
|
+
gap="$3"
|
|
153
|
+
alignItems="center"
|
|
154
|
+
borderBottomColor="$borderColor"
|
|
155
|
+
borderBottomWidth={1}
|
|
156
|
+
hoverStyle={{ backgroundColor: '$backgroundHover' }}
|
|
157
|
+
>
|
|
158
|
+
<View width={40} height={40} borderRadius="$10" backgroundColor="$blue5" />
|
|
159
|
+
<YStack flex={1} gap="$1">
|
|
160
|
+
<SizableText fontWeight="600" size="$4">
|
|
161
|
+
{item.title}
|
|
162
|
+
</SizableText>
|
|
163
|
+
<SizableText size="$2" color="$color8" numberOfLines={1}>
|
|
164
|
+
{item.desc}
|
|
165
|
+
</SizableText>
|
|
166
|
+
</YStack>
|
|
167
|
+
<Badge color={item.badge}>
|
|
168
|
+
<SizableText size="$1" color="white">
|
|
169
|
+
{item.badge}
|
|
170
|
+
</SizableText>
|
|
171
|
+
</Badge>
|
|
172
|
+
</XStack>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function ItemList() {
|
|
177
|
+
return (
|
|
178
|
+
<StyledCard size="md">
|
|
179
|
+
<H3 marginBottom="$2">Recent Activity</H3>
|
|
180
|
+
<YStack>
|
|
181
|
+
{items.map((item) => (
|
|
182
|
+
<ItemRow key={item.id} item={item} />
|
|
183
|
+
))}
|
|
184
|
+
</YStack>
|
|
185
|
+
</StyledCard>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function FormSection() {
|
|
190
|
+
return (
|
|
191
|
+
<StyledCard highlighted size="md">
|
|
192
|
+
<H3 marginBottom="$3">Settings</H3>
|
|
193
|
+
<YStack gap="$3">
|
|
194
|
+
{['Name', 'Email', 'Company', 'Role'].map((field) => (
|
|
195
|
+
<YStack key={field} gap="$1">
|
|
196
|
+
<Label size="$3">{field}</Label>
|
|
197
|
+
<Input size="$3" placeholder={`Enter ${field.toLowerCase()}`} />
|
|
198
|
+
</YStack>
|
|
199
|
+
))}
|
|
200
|
+
<XStack gap="$3" alignItems="center">
|
|
201
|
+
<Switch size="$3" />
|
|
202
|
+
<SizableText size="$3">Enable notifications</SizableText>
|
|
203
|
+
</XStack>
|
|
204
|
+
<Button size="$4">Save Changes</Button>
|
|
205
|
+
</YStack>
|
|
206
|
+
</StyledCard>
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function ThemedSection() {
|
|
211
|
+
return (
|
|
212
|
+
<Theme name="blue">
|
|
213
|
+
<YStack gap="$3" padding="$4" backgroundColor="$background" borderRadius="$4">
|
|
214
|
+
<H2 color="$color">Themed Section</H2>
|
|
215
|
+
<XStack gap="$2" flexWrap="wrap">
|
|
216
|
+
{Array.from({ length: 12 }, (_, i) => (
|
|
217
|
+
<Theme key={i} name={i % 2 === 0 ? 'surface1' : 'surface2'}>
|
|
218
|
+
<View
|
|
219
|
+
width={80}
|
|
220
|
+
height={60}
|
|
221
|
+
borderRadius="$3"
|
|
222
|
+
backgroundColor="$background"
|
|
223
|
+
padding="$2"
|
|
224
|
+
>
|
|
225
|
+
<SizableText size="$1" color="$color">
|
|
226
|
+
Card {i + 1}
|
|
227
|
+
</SizableText>
|
|
228
|
+
</View>
|
|
229
|
+
</Theme>
|
|
230
|
+
))}
|
|
231
|
+
</XStack>
|
|
232
|
+
</YStack>
|
|
233
|
+
</Theme>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function Footer() {
|
|
238
|
+
return (
|
|
239
|
+
<XStack
|
|
240
|
+
padding="$4"
|
|
241
|
+
gap="$4"
|
|
242
|
+
justifyContent="space-between"
|
|
243
|
+
borderTopColor="$borderColor"
|
|
244
|
+
borderTopWidth={1}
|
|
245
|
+
>
|
|
246
|
+
{['About', 'Privacy', 'Terms', 'Contact', 'Help', 'Status'].map((link) => (
|
|
247
|
+
<SizableText key={link} size="$2" color="$color8" cursor="pointer">
|
|
248
|
+
{link}
|
|
249
|
+
</SizableText>
|
|
250
|
+
))}
|
|
251
|
+
</XStack>
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function StressPage() {
|
|
256
|
+
// render profiling: mark start before React render, measure in effect after commit
|
|
257
|
+
if (shouldProfile) {
|
|
258
|
+
performance.mark('stress-render-start')
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
React.useEffect(() => {
|
|
262
|
+
if (!shouldProfile) return
|
|
263
|
+
performance.mark('stress-render-end')
|
|
264
|
+
performance.measure('stress-render', 'stress-render-start', 'stress-render-end')
|
|
265
|
+
const measure = performance.getEntriesByName('stress-render', 'measure')[0]
|
|
266
|
+
|
|
267
|
+
const t = (globalThis as any).__TIMER__
|
|
268
|
+
const profile = t?.profile()
|
|
269
|
+
|
|
270
|
+
const result = {
|
|
271
|
+
renderMs: Math.round(measure.duration * 100) / 100,
|
|
272
|
+
breakdown: profile?.timings,
|
|
273
|
+
runs: profile?.runs,
|
|
274
|
+
timestamp: Date.now(),
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
;(window as any).__PERF_RESULT__ = result
|
|
278
|
+
t?.print()
|
|
279
|
+
console.log(`[StressPage] render: ${result.renderMs}ms`)
|
|
280
|
+
}, [])
|
|
281
|
+
|
|
282
|
+
return (
|
|
283
|
+
<YStack width="100%" maxWidth={900} gap="$4" paddingBottom="$6">
|
|
284
|
+
<Header />
|
|
285
|
+
<Separator />
|
|
286
|
+
<StatsRow />
|
|
287
|
+
<Separator />
|
|
288
|
+
<XStack gap="$4" paddingHorizontal="$4" flexWrap="wrap">
|
|
289
|
+
<YStack flex={2} minWidth={400} gap="$4">
|
|
290
|
+
<ItemList />
|
|
291
|
+
</YStack>
|
|
292
|
+
<YStack flex={1} minWidth={280} gap="$4">
|
|
293
|
+
<FormSection />
|
|
294
|
+
<ThemedSection />
|
|
295
|
+
</YStack>
|
|
296
|
+
</XStack>
|
|
297
|
+
<Separator />
|
|
298
|
+
<Footer />
|
|
299
|
+
</YStack>
|
|
300
|
+
)
|
|
301
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { View } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
export function StylePlatform() {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<View
|
|
7
|
+
id="style-platform"
|
|
8
|
+
$platform-web={{
|
|
9
|
+
my: 10,
|
|
10
|
+
overflowY: 'scroll',
|
|
11
|
+
backgroundColor: 'red',
|
|
12
|
+
}}
|
|
13
|
+
/>
|
|
14
|
+
<View
|
|
15
|
+
id="style-platform-hover"
|
|
16
|
+
width={100}
|
|
17
|
+
height={100}
|
|
18
|
+
backgroundColor="blue"
|
|
19
|
+
hoverStyle={{
|
|
20
|
+
backgroundColor: 'yellow',
|
|
21
|
+
}}
|
|
22
|
+
$platform-web={{
|
|
23
|
+
hoverStyle: {
|
|
24
|
+
backgroundColor: 'green',
|
|
25
|
+
},
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
</>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { View } from '@hanzogui/core'
|
|
2
|
+
|
|
3
|
+
export function StyleProp(test) {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<View
|
|
7
|
+
testID="style-prop"
|
|
8
|
+
style={{
|
|
9
|
+
background: 'radial-gradient(var(--color9), transparent 70%)',
|
|
10
|
+
}}
|
|
11
|
+
/>
|
|
12
|
+
<View
|
|
13
|
+
testID="class-name"
|
|
14
|
+
className="test-bg"
|
|
15
|
+
pointerEvents={!test ? 'none' : 'auto'}
|
|
16
|
+
cursor="pointer"
|
|
17
|
+
onPress={() => {}}
|
|
18
|
+
width={100}
|
|
19
|
+
height={100}
|
|
20
|
+
/>
|
|
21
|
+
<style
|
|
22
|
+
type="text/css"
|
|
23
|
+
dangerouslySetInnerHTML={{
|
|
24
|
+
__html: `.test-bg { background: red; }`,
|
|
25
|
+
}}
|
|
26
|
+
></style>
|
|
27
|
+
</>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Anchor, styled } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
const StyledAnchor1 = styled(Anchor, {
|
|
4
|
+
color: 'red',
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
const StyledAnchor2 = styled(Anchor, {
|
|
8
|
+
target: '_blank',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export function StyledAnchor() {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<StyledAnchor1
|
|
15
|
+
testID="test-anchor"
|
|
16
|
+
href="https://gui.hanzo.ai/test-link"
|
|
17
|
+
target="_blank"
|
|
18
|
+
>
|
|
19
|
+
hi
|
|
20
|
+
</StyledAnchor1>
|
|
21
|
+
|
|
22
|
+
<StyledAnchor2 testID="test-anchor2" href="https://gui.hanzo.ai/test-link">
|
|
23
|
+
hi
|
|
24
|
+
</StyledAnchor2>
|
|
25
|
+
</>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { getSize, getSpace } from '@hanzogui/get-token'
|
|
3
|
+
import type { GetProps, SizeTokens } from '@hanzogui/web'
|
|
4
|
+
import {
|
|
5
|
+
View,
|
|
6
|
+
Text,
|
|
7
|
+
createStyledContext,
|
|
8
|
+
styled,
|
|
9
|
+
useTheme,
|
|
10
|
+
withStaticProperties,
|
|
11
|
+
} from '@hanzogui/web'
|
|
12
|
+
|
|
13
|
+
export const ButtonContext = createStyledContext({
|
|
14
|
+
size: '$md' as SizeTokens,
|
|
15
|
+
})
|
|
16
|
+
export const ButtonFrame = styled(View, {
|
|
17
|
+
name: 'Button',
|
|
18
|
+
context: ButtonContext,
|
|
19
|
+
backgroundColor: '$background',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
flexDirection: 'row',
|
|
22
|
+
|
|
23
|
+
// Here is the issue: <---------------------------------------------------
|
|
24
|
+
height: 'auto',
|
|
25
|
+
transition: 'bouncy',
|
|
26
|
+
pressStyle: {
|
|
27
|
+
scale: 0.97,
|
|
28
|
+
opacity: 0.9,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
variants: {
|
|
32
|
+
size: {
|
|
33
|
+
'...size': (name, { tokens }) => {
|
|
34
|
+
return {
|
|
35
|
+
height: tokens.size[name],
|
|
36
|
+
|
|
37
|
+
borderRadius: tokens.radius[name],
|
|
38
|
+
|
|
39
|
+
// note the getSpace and getSize helpers will let you shift down/up token sizes
|
|
40
|
+
|
|
41
|
+
// whereas with gap we just multiply by 0.2
|
|
42
|
+
|
|
43
|
+
// this is a stylistic choice, and depends on your design system values
|
|
44
|
+
|
|
45
|
+
gap: tokens.space[name].val * 0.2,
|
|
46
|
+
|
|
47
|
+
paddingHorizontal: getSpace(name, {
|
|
48
|
+
shift: -1,
|
|
49
|
+
}),
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
} as const,
|
|
54
|
+
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
size: '$5',
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
type ButtonProps = GetProps<typeof ButtonFrame>
|
|
60
|
+
export const ButtonText = styled(Text, {
|
|
61
|
+
name: 'ButtonText',
|
|
62
|
+
context: ButtonContext,
|
|
63
|
+
color: '$color',
|
|
64
|
+
userSelect: 'none',
|
|
65
|
+
variants: {
|
|
66
|
+
size: {
|
|
67
|
+
'...fontSize': (name, { font }) => ({
|
|
68
|
+
fontSize: font?.size[name],
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
71
|
+
} as const,
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const ButtonIcon = (props: { children: any }) => {
|
|
75
|
+
const { size } = React.useContext(ButtonContext.context)
|
|
76
|
+
|
|
77
|
+
const smaller = getSize(size, {
|
|
78
|
+
shift: -2,
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const theme = useTheme()
|
|
82
|
+
|
|
83
|
+
return React.cloneElement(props.children, {
|
|
84
|
+
size: smaller.val * 0.5,
|
|
85
|
+
color: theme.color.get(),
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const Button = withStaticProperties(ButtonFrame, {
|
|
90
|
+
Props: ButtonContext.Provider,
|
|
91
|
+
Text: ButtonText,
|
|
92
|
+
Icon: ButtonIcon,
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
export const StyledButtonAnimationAuto = () => (
|
|
96
|
+
<Button id="test">
|
|
97
|
+
<Button.Text>test</Button.Text>
|
|
98
|
+
</Button>
|
|
99
|
+
)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { GetProps, ButtonProps as GuiButtonProps } from '@hanzo/gui'
|
|
2
|
+
import { Button, styled, useTheme, useThemeName } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
const CustomButtonFrame = styled(Button.Frame, {})
|
|
5
|
+
|
|
6
|
+
const CustomButtonText = styled(Button.Text, {
|
|
7
|
+
// ...
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
type CustomButtonFrameProps = GetProps<typeof CustomButtonFrame>
|
|
11
|
+
type CustomButtonTextProps = GetProps<typeof CustomButtonText>
|
|
12
|
+
|
|
13
|
+
export type CustomButtonProps = GuiButtonProps &
|
|
14
|
+
CustomButtonFrameProps &
|
|
15
|
+
CustomButtonTextProps
|
|
16
|
+
|
|
17
|
+
export const CustomButton = CustomButtonFrame.styleable<CustomButtonProps>(
|
|
18
|
+
(propsIn, ref) => {
|
|
19
|
+
return (
|
|
20
|
+
<CustomButtonFrame {...propsIn} ref={ref}>
|
|
21
|
+
<CustomButtonText>{propsIn.children}</CustomButtonText>
|
|
22
|
+
</CustomButtonFrame>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
const CustomButtonFrame2 = styled(Button.Frame, {
|
|
28
|
+
name: 'Test123',
|
|
29
|
+
backgroundColor: 'black',
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const CustomButtonText2 = styled(Button.Text, {
|
|
33
|
+
// ...
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
type CustomButtonFrameProps2 = GetProps<typeof CustomButtonFrame>
|
|
37
|
+
type CustomButtonTextProps2 = GetProps<typeof CustomButtonText>
|
|
38
|
+
|
|
39
|
+
export type CustomButtonProps2 = GuiButtonProps &
|
|
40
|
+
CustomButtonFrameProps2 &
|
|
41
|
+
CustomButtonTextProps2
|
|
42
|
+
|
|
43
|
+
export const CustomButton2 = CustomButtonFrame2.styleable<CustomButtonProps2>(
|
|
44
|
+
(propsIn, ref) => {
|
|
45
|
+
return (
|
|
46
|
+
<CustomButtonFrame2 {...propsIn} ref={ref}>
|
|
47
|
+
<CustomButtonText2>{propsIn.children}</CustomButtonText2>
|
|
48
|
+
</CustomButtonFrame2>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
export const StyledButtonTheme = () => (
|
|
54
|
+
<>
|
|
55
|
+
<CustomButton id="test" theme="green">
|
|
56
|
+
test2
|
|
57
|
+
</CustomButton>
|
|
58
|
+
|
|
59
|
+
<CustomButton2 id="test2" theme="green">
|
|
60
|
+
test2
|
|
61
|
+
</CustomButton2>
|
|
62
|
+
</>
|
|
63
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Button, styled } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
const StyledButton = styled(Button, {
|
|
4
|
+
variants: {
|
|
5
|
+
reddish: {
|
|
6
|
+
true: {
|
|
7
|
+
backgroundColor: 'yellow',
|
|
8
|
+
|
|
9
|
+
pressStyle: {
|
|
10
|
+
backgroundColor: 'red',
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
hoverStyle: {
|
|
14
|
+
backgroundColor: 'green',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
} as const,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const StyledButtonVariantPseudo = () => (
|
|
22
|
+
<StyledButton id="test" reddish>
|
|
23
|
+
test
|
|
24
|
+
</StyledButton>
|
|
25
|
+
)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Button, Theme, YStack, styled } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
const StyledButton = styled(Button, {
|
|
4
|
+
pressStyle: {
|
|
5
|
+
scale: 0.5,
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
variants: {
|
|
9
|
+
reddish: {
|
|
10
|
+
true: {
|
|
11
|
+
pressStyle: {
|
|
12
|
+
backgroundColor: 'red',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
bigGreen: {
|
|
18
|
+
true: {
|
|
19
|
+
pressStyle: {
|
|
20
|
+
backgroundColor: 'green',
|
|
21
|
+
scale: 1.2,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
} as const,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const DoubleStyledButtonNoVariants = styled(StyledButton, {})
|
|
29
|
+
|
|
30
|
+
const StyledButtonVariantTheme = styled(Button, {
|
|
31
|
+
pressStyle: {
|
|
32
|
+
scale: 0.5,
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
variants: {
|
|
36
|
+
testVariant: {
|
|
37
|
+
true: {
|
|
38
|
+
backgroundColor: '$background',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
} as const,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
export const StyledButtonVariantPseudoMerge = () => (
|
|
45
|
+
<>
|
|
46
|
+
<StyledButton id="test" reddish>
|
|
47
|
+
test
|
|
48
|
+
</StyledButton>
|
|
49
|
+
|
|
50
|
+
<StyledButton id="animated" reddish transition="quick">
|
|
51
|
+
animated
|
|
52
|
+
</StyledButton>
|
|
53
|
+
|
|
54
|
+
<StyledButton id="variant-merge">variant-merge</StyledButton>
|
|
55
|
+
<StyledButton id="variant-merge-red" reddish>
|
|
56
|
+
variant-merge-red
|
|
57
|
+
</StyledButton>
|
|
58
|
+
<StyledButton id="variant-merge-green" reddish bigGreen>
|
|
59
|
+
variant-merge-green
|
|
60
|
+
</StyledButton>
|
|
61
|
+
<StyledButton id="variant-merge-green-red" bigGreen reddish>
|
|
62
|
+
variant-merge-green-red
|
|
63
|
+
</StyledButton>
|
|
64
|
+
|
|
65
|
+
<DoubleStyledButtonNoVariants reddish id="double-styled">
|
|
66
|
+
double-styled
|
|
67
|
+
</DoubleStyledButtonNoVariants>
|
|
68
|
+
|
|
69
|
+
<Theme name="light">
|
|
70
|
+
<YStack theme="green">
|
|
71
|
+
<StyledButtonVariantTheme id="variant-theme" testVariant>
|
|
72
|
+
variant-theme
|
|
73
|
+
</StyledButtonVariantTheme>
|
|
74
|
+
</YStack>
|
|
75
|
+
</Theme>
|
|
76
|
+
</>
|
|
77
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Check } from '@hanzogui/lucide-icons-2'
|
|
2
|
+
import { Checkbox as GuiCheckbox, styled, withStaticProperties } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
export const Checkbox = withStaticProperties(
|
|
5
|
+
styled(GuiCheckbox, {
|
|
6
|
+
theme: 'green',
|
|
7
|
+
}),
|
|
8
|
+
{
|
|
9
|
+
Indicator() {
|
|
10
|
+
return (
|
|
11
|
+
<GuiCheckbox.Indicator>
|
|
12
|
+
<Check color="$color12" />
|
|
13
|
+
</GuiCheckbox.Indicator>
|
|
14
|
+
)
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
export const StyledCheckboxTheme = () => (
|
|
20
|
+
<Checkbox defaultChecked={true} theme="green">
|
|
21
|
+
<Checkbox.Indicator />
|
|
22
|
+
</Checkbox>
|
|
23
|
+
)
|