react-native-terra-ui 0.1.0
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/README.md +70 -0
- package/lib/module/components/avatar/Avatar.js +121 -0
- package/lib/module/components/avatar/Avatar.js.map +1 -0
- package/lib/module/components/avatar/index.js +4 -0
- package/lib/module/components/avatar/index.js.map +1 -0
- package/lib/module/components/avatar/types.js +4 -0
- package/lib/module/components/avatar/types.js.map +1 -0
- package/lib/module/components/box/Box.js +49 -0
- package/lib/module/components/box/Box.js.map +1 -0
- package/lib/module/components/box/index.js +4 -0
- package/lib/module/components/box/index.js.map +1 -0
- package/lib/module/components/box/utils.js +95 -0
- package/lib/module/components/box/utils.js.map +1 -0
- package/lib/module/components/button/Button.js +281 -0
- package/lib/module/components/button/Button.js.map +1 -0
- package/lib/module/components/button/index.js +4 -0
- package/lib/module/components/button/index.js.map +1 -0
- package/lib/module/components/header/Header.js +25 -0
- package/lib/module/components/header/Header.js.map +1 -0
- package/lib/module/components/header/header-buttons.js +65 -0
- package/lib/module/components/header/header-buttons.js.map +1 -0
- package/lib/module/components/header/index.js +7 -0
- package/lib/module/components/header/index.js.map +1 -0
- package/lib/module/components/header/variants/LargeTitleHeader/index.js +335 -0
- package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -0
- package/lib/module/components/header/variants/TitleHeader/index.js +184 -0
- package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -0
- package/lib/module/components/icon/Icon.js +53 -0
- package/lib/module/components/icon/Icon.js.map +1 -0
- package/lib/module/components/icon/index.js +4 -0
- package/lib/module/components/icon/index.js.map +1 -0
- package/lib/module/components/icon/utils.js +188 -0
- package/lib/module/components/icon/utils.js.map +1 -0
- package/lib/module/components/index.js +16 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/components/page-indicator/PageIndicator.js +49 -0
- package/lib/module/components/page-indicator/PageIndicator.js.map +1 -0
- package/lib/module/components/page-indicator/PageIndicatorRoot.js +24 -0
- package/lib/module/components/page-indicator/PageIndicatorRoot.js.map +1 -0
- package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js +24 -0
- package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js.map +1 -0
- package/lib/module/components/page-indicator/hooks/use-page-indicator-core.js +20 -0
- package/lib/module/components/page-indicator/hooks/use-page-indicator-core.js.map +1 -0
- package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js +68 -0
- package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js.map +1 -0
- package/lib/module/components/page-indicator/index.js +5 -0
- package/lib/module/components/page-indicator/index.js.map +1 -0
- package/lib/module/components/page-indicator/utils.js +127 -0
- package/lib/module/components/page-indicator/utils.js.map +1 -0
- package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js +50 -0
- package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js.map +1 -0
- package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js +165 -0
- package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js.map +1 -0
- package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js +60 -0
- package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js.map +1 -0
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js +87 -0
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js.map +1 -0
- package/lib/module/components/page-indicator/variants/DotIndicator/utils.js +28 -0
- package/lib/module/components/page-indicator/variants/DotIndicator/utils.js.map +1 -0
- package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js +53 -0
- package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js.map +1 -0
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js +76 -0
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js.map +1 -0
- package/lib/module/components/page-indicator/variants/PillIndicator/utils.js +47 -0
- package/lib/module/components/page-indicator/variants/PillIndicator/utils.js.map +1 -0
- package/lib/module/components/portal/PortalContext.js +20 -0
- package/lib/module/components/portal/PortalContext.js.map +1 -0
- package/lib/module/components/portal/PortalHost.js +23 -0
- package/lib/module/components/portal/PortalHost.js.map +1 -0
- package/lib/module/components/portal/PortalProvider.js +40 -0
- package/lib/module/components/portal/PortalProvider.js.map +1 -0
- package/lib/module/components/portal/index.js +6 -0
- package/lib/module/components/portal/index.js.map +1 -0
- package/lib/module/components/screen/Screen.js +100 -0
- package/lib/module/components/screen/Screen.js.map +1 -0
- package/lib/module/components/screen/ScreenContext.js +66 -0
- package/lib/module/components/screen/ScreenContext.js.map +1 -0
- package/lib/module/components/screen/ScreenFlatList.js +75 -0
- package/lib/module/components/screen/ScreenFlatList.js.map +1 -0
- package/lib/module/components/screen/ScreenScrollView.js +82 -0
- package/lib/module/components/screen/ScreenScrollView.js.map +1 -0
- package/lib/module/components/screen/index.js +7 -0
- package/lib/module/components/screen/index.js.map +1 -0
- package/lib/module/components/screen/utils.js +13 -0
- package/lib/module/components/screen/utils.js.map +1 -0
- package/lib/module/components/slot/Slot.js +38 -0
- package/lib/module/components/slot/Slot.js.map +1 -0
- package/lib/module/components/slot/index.js +10 -0
- package/lib/module/components/slot/index.js.map +1 -0
- package/lib/module/components/slot/utils.js +55 -0
- package/lib/module/components/slot/utils.js.map +1 -0
- package/lib/module/components/spinner/Spinner.js +132 -0
- package/lib/module/components/spinner/Spinner.js.map +1 -0
- package/lib/module/components/spinner/index.js +4 -0
- package/lib/module/components/spinner/index.js.map +1 -0
- package/lib/module/components/surface/Surface.js +74 -0
- package/lib/module/components/surface/Surface.js.map +1 -0
- package/lib/module/components/surface/index.js +4 -0
- package/lib/module/components/surface/index.js.map +1 -0
- package/lib/module/components/text/Text.js +67 -0
- package/lib/module/components/text/Text.js.map +1 -0
- package/lib/module/components/text/index.js +4 -0
- package/lib/module/components/text/index.js.map +1 -0
- package/lib/module/components/toast/Toast.js +350 -0
- package/lib/module/components/toast/Toast.js.map +1 -0
- package/lib/module/components/toast/ToastProvider.js +272 -0
- package/lib/module/components/toast/ToastProvider.js.map +1 -0
- package/lib/module/components/toast/index.js +5 -0
- package/lib/module/components/toast/index.js.map +1 -0
- package/lib/module/components/toast/parts/ToastAnimatedItem.js +168 -0
- package/lib/module/components/toast/parts/ToastAnimatedItem.js.map +1 -0
- package/lib/module/components/toast/types.js +4 -0
- package/lib/module/components/toast/types.js.map +1 -0
- package/lib/module/components/toast/utils/controller.js +19 -0
- package/lib/module/components/toast/utils/controller.js.map +1 -0
- package/lib/module/context/ThemeProvider.js +66 -0
- package/lib/module/context/ThemeProvider.js.map +1 -0
- package/lib/module/context/index.js +4 -0
- package/lib/module/context/index.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/theme/configure.js +152 -0
- package/lib/module/theme/configure.js.map +1 -0
- package/lib/module/theme/index.js +22 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/runtime.js +25 -0
- package/lib/module/theme/runtime.js.map +1 -0
- package/lib/module/theme/theme.js +121 -0
- package/lib/module/theme/theme.js.map +1 -0
- package/lib/module/theme/tokens/dark.js +109 -0
- package/lib/module/theme/tokens/dark.js.map +1 -0
- package/lib/module/theme/tokens/light.js +115 -0
- package/lib/module/theme/tokens/light.js.map +1 -0
- package/lib/module/theme/tokens/primitives.js +228 -0
- package/lib/module/theme/tokens/primitives.js.map +1 -0
- package/lib/module/theme/types.js +4 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/accent-utils.js +52 -0
- package/lib/module/utils/accent-utils.js.map +1 -0
- package/lib/module/utils/color-utils.js +53 -0
- package/lib/module/utils/color-utils.js.map +1 -0
- package/lib/module/utils/deep-merge.js +28 -0
- package/lib/module/utils/deep-merge.js.map +1 -0
- package/lib/module/utils/resolve-theme-color.js +20 -0
- package/lib/module/utils/resolve-theme-color.js.map +1 -0
- package/lib/module/utils/typography.js +13 -0
- package/lib/module/utils/typography.js.map +1 -0
- package/lib/module/utils/unflatten.js +35 -0
- package/lib/module/utils/unflatten.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/components/avatar/Avatar.d.ts +3 -0
- package/lib/typescript/src/components/avatar/Avatar.d.ts.map +1 -0
- package/lib/typescript/src/components/avatar/index.d.ts +3 -0
- package/lib/typescript/src/components/avatar/index.d.ts.map +1 -0
- package/lib/typescript/src/components/avatar/types.d.ts +30 -0
- package/lib/typescript/src/components/avatar/types.d.ts.map +1 -0
- package/lib/typescript/src/components/box/Box.d.ts +12 -0
- package/lib/typescript/src/components/box/Box.d.ts.map +1 -0
- package/lib/typescript/src/components/box/index.d.ts +4 -0
- package/lib/typescript/src/components/box/index.d.ts.map +1 -0
- package/lib/typescript/src/components/box/utils.d.ts +39 -0
- package/lib/typescript/src/components/box/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/button/Button.d.ts +46 -0
- package/lib/typescript/src/components/button/Button.d.ts.map +1 -0
- package/lib/typescript/src/components/button/index.d.ts +3 -0
- package/lib/typescript/src/components/button/index.d.ts.map +1 -0
- package/lib/typescript/src/components/header/Header.d.ts +22 -0
- package/lib/typescript/src/components/header/Header.d.ts.map +1 -0
- package/lib/typescript/src/components/header/header-buttons.d.ts +16 -0
- package/lib/typescript/src/components/header/header-buttons.d.ts.map +1 -0
- package/lib/typescript/src/components/header/index.d.ts +7 -0
- package/lib/typescript/src/components/header/index.d.ts.map +1 -0
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +25 -0
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -0
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +28 -0
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -0
- package/lib/typescript/src/components/icon/Icon.d.ts +22 -0
- package/lib/typescript/src/components/icon/Icon.d.ts.map +1 -0
- package/lib/typescript/src/components/icon/index.d.ts +3 -0
- package/lib/typescript/src/components/icon/index.d.ts.map +1 -0
- package/lib/typescript/src/components/icon/utils.d.ts +4 -0
- package/lib/typescript/src/components/icon/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +14 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/PageIndicator.d.ts +48 -0
- package/lib/typescript/src/components/page-indicator/PageIndicator.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts +13 -0
- package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts +14 -0
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts +11 -0
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts +19 -0
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/index.d.ts +4 -0
- package/lib/typescript/src/components/page-indicator/index.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/utils.d.ts +36 -0
- package/lib/typescript/src/components/page-indicator/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts +14 -0
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts +11 -0
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts +15 -0
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts +32 -0
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/utils.d.ts +14 -0
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts +16 -0
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts +28 -0
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts.map +1 -0
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/utils.d.ts +21 -0
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/portal/PortalContext.d.ts +19 -0
- package/lib/typescript/src/components/portal/PortalContext.d.ts.map +1 -0
- package/lib/typescript/src/components/portal/PortalHost.d.ts +7 -0
- package/lib/typescript/src/components/portal/PortalHost.d.ts.map +1 -0
- package/lib/typescript/src/components/portal/PortalProvider.d.ts +11 -0
- package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -0
- package/lib/typescript/src/components/portal/index.d.ts +6 -0
- package/lib/typescript/src/components/portal/index.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/Screen.d.ts +53 -0
- package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/ScreenContext.d.ts +64 -0
- package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +26 -0
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +36 -0
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/index.d.ts +9 -0
- package/lib/typescript/src/components/screen/index.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/utils.d.ts +10 -0
- package/lib/typescript/src/components/screen/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/slot/Slot.d.ts +17 -0
- package/lib/typescript/src/components/slot/Slot.d.ts.map +1 -0
- package/lib/typescript/src/components/slot/index.d.ts +8 -0
- package/lib/typescript/src/components/slot/index.d.ts.map +1 -0
- package/lib/typescript/src/components/slot/utils.d.ts +17 -0
- package/lib/typescript/src/components/slot/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/spinner/Spinner.d.ts +18 -0
- package/lib/typescript/src/components/spinner/Spinner.d.ts.map +1 -0
- package/lib/typescript/src/components/spinner/index.d.ts +3 -0
- package/lib/typescript/src/components/spinner/index.d.ts.map +1 -0
- package/lib/typescript/src/components/surface/Surface.d.ts +31 -0
- package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -0
- package/lib/typescript/src/components/surface/index.d.ts +3 -0
- package/lib/typescript/src/components/surface/index.d.ts.map +1 -0
- package/lib/typescript/src/components/text/Text.d.ts +23 -0
- package/lib/typescript/src/components/text/Text.d.ts.map +1 -0
- package/lib/typescript/src/components/text/index.d.ts +3 -0
- package/lib/typescript/src/components/text/index.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/Toast.d.ts +71 -0
- package/lib/typescript/src/components/toast/Toast.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/ToastProvider.d.ts +4 -0
- package/lib/typescript/src/components/toast/ToastProvider.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/index.d.ts +5 -0
- package/lib/typescript/src/components/toast/index.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts +18 -0
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/types.d.ts +62 -0
- package/lib/typescript/src/components/toast/types.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/utils/controller.d.ts +5 -0
- package/lib/typescript/src/components/toast/utils/controller.d.ts.map +1 -0
- package/lib/typescript/src/context/ThemeProvider.d.ts +29 -0
- package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/src/context/index.d.ts +3 -0
- package/lib/typescript/src/context/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/configure.d.ts +47 -0
- package/lib/typescript/src/theme/configure.d.ts.map +1 -0
- package/lib/typescript/src/theme/index.d.ts +11 -0
- package/lib/typescript/src/theme/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/runtime.d.ts +7 -0
- package/lib/typescript/src/theme/runtime.d.ts.map +1 -0
- package/lib/typescript/src/theme/theme.d.ts +22 -0
- package/lib/typescript/src/theme/theme.d.ts.map +1 -0
- package/lib/typescript/src/theme/tokens/dark.d.ts +100 -0
- package/lib/typescript/src/theme/tokens/dark.d.ts.map +1 -0
- package/lib/typescript/src/theme/tokens/light.d.ts +106 -0
- package/lib/typescript/src/theme/tokens/light.d.ts.map +1 -0
- package/lib/typescript/src/theme/tokens/primitives.d.ts +212 -0
- package/lib/typescript/src/theme/tokens/primitives.d.ts.map +1 -0
- package/lib/typescript/src/theme/types.d.ts +273 -0
- package/lib/typescript/src/theme/types.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +4 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/accent-utils.d.ts +4 -0
- package/lib/typescript/src/utils/accent-utils.d.ts.map +1 -0
- package/lib/typescript/src/utils/color-utils.d.ts +11 -0
- package/lib/typescript/src/utils/color-utils.d.ts.map +1 -0
- package/lib/typescript/src/utils/deep-merge.d.ts +11 -0
- package/lib/typescript/src/utils/deep-merge.d.ts.map +1 -0
- package/lib/typescript/src/utils/resolve-theme-color.d.ts +12 -0
- package/lib/typescript/src/utils/resolve-theme-color.d.ts.map +1 -0
- package/lib/typescript/src/utils/typography.d.ts +6 -0
- package/lib/typescript/src/utils/typography.d.ts.map +1 -0
- package/lib/typescript/src/utils/unflatten.d.ts +12 -0
- package/lib/typescript/src/utils/unflatten.d.ts.map +1 -0
- package/package.json +137 -0
- package/src/components/avatar/Avatar.tsx +146 -0
- package/src/components/avatar/index.ts +8 -0
- package/src/components/avatar/types.ts +35 -0
- package/src/components/box/Box.tsx +59 -0
- package/src/components/box/index.ts +8 -0
- package/src/components/box/utils.ts +181 -0
- package/src/components/button/Button.tsx +313 -0
- package/src/components/button/index.ts +8 -0
- package/src/components/header/Header.ts +22 -0
- package/src/components/header/header-buttons.tsx +103 -0
- package/src/components/header/index.ts +11 -0
- package/src/components/header/variants/LargeTitleHeader/index.tsx +390 -0
- package/src/components/header/variants/TitleHeader/index.tsx +194 -0
- package/src/components/icon/Icon.tsx +74 -0
- package/src/components/icon/index.ts +2 -0
- package/src/components/icon/utils.tsx +147 -0
- package/src/components/index.ts +13 -0
- package/src/components/page-indicator/PageIndicator.tsx +100 -0
- package/src/components/page-indicator/PageIndicatorRoot.tsx +41 -0
- package/src/components/page-indicator/hooks/use-page-indicator-colors.ts +65 -0
- package/src/components/page-indicator/hooks/use-page-indicator-core.ts +34 -0
- package/src/components/page-indicator/hooks/use-page-indicator-progress.ts +122 -0
- package/src/components/page-indicator/index.ts +13 -0
- package/src/components/page-indicator/utils.ts +208 -0
- package/src/components/page-indicator/variants/DotIndicator/InactiveDot.tsx +70 -0
- package/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.tsx +201 -0
- package/src/components/page-indicator/variants/DotIndicator/TravelingPill.tsx +80 -0
- package/src/components/page-indicator/variants/DotIndicator/index.tsx +145 -0
- package/src/components/page-indicator/variants/DotIndicator/utils.ts +28 -0
- package/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.tsx +107 -0
- package/src/components/page-indicator/variants/PillIndicator/index.tsx +149 -0
- package/src/components/page-indicator/variants/PillIndicator/utils.ts +63 -0
- package/src/components/portal/PortalContext.tsx +27 -0
- package/src/components/portal/PortalHost.tsx +20 -0
- package/src/components/portal/PortalProvider.tsx +44 -0
- package/src/components/portal/index.ts +5 -0
- package/src/components/screen/Screen.tsx +163 -0
- package/src/components/screen/ScreenContext.tsx +144 -0
- package/src/components/screen/ScreenFlatList.tsx +121 -0
- package/src/components/screen/ScreenScrollView.tsx +130 -0
- package/src/components/screen/index.ts +8 -0
- package/src/components/screen/utils.ts +17 -0
- package/src/components/slot/Slot.tsx +56 -0
- package/src/components/slot/index.ts +8 -0
- package/src/components/slot/utils.ts +61 -0
- package/src/components/spinner/Spinner.tsx +153 -0
- package/src/components/spinner/index.ts +2 -0
- package/src/components/surface/Surface.tsx +100 -0
- package/src/components/surface/index.ts +2 -0
- package/src/components/text/Text.tsx +115 -0
- package/src/components/text/index.ts +2 -0
- package/src/components/toast/Toast.tsx +477 -0
- package/src/components/toast/ToastProvider.tsx +403 -0
- package/src/components/toast/index.ts +26 -0
- package/src/components/toast/parts/ToastAnimatedItem.tsx +184 -0
- package/src/components/toast/types.ts +75 -0
- package/src/components/toast/utils/controller.ts +23 -0
- package/src/context/ThemeProvider.tsx +97 -0
- package/src/context/index.ts +2 -0
- package/src/index.tsx +6 -0
- package/src/theme/configure.ts +215 -0
- package/src/theme/index.ts +72 -0
- package/src/theme/runtime.ts +27 -0
- package/src/theme/theme.ts +152 -0
- package/src/theme/tokens/dark.ts +117 -0
- package/src/theme/tokens/light.ts +123 -0
- package/src/theme/tokens/primitives.ts +232 -0
- package/src/theme/types.ts +384 -0
- package/src/types.ts +1 -0
- package/src/utils/accent-utils.ts +58 -0
- package/src/utils/color-utils.ts +51 -0
- package/src/utils/deep-merge.ts +36 -0
- package/src/utils/resolve-theme-color.ts +27 -0
- package/src/utils/typography.ts +15 -0
- package/src/utils/unflatten.ts +36 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import Animated, { useAnimatedScrollHandler, useComposedEventHandler } from 'react-native-reanimated';
|
|
5
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
7
|
+
import { PortalHost } from "../portal/index.js";
|
|
8
|
+
import { useScreen } from "./ScreenContext.js";
|
|
9
|
+
import { resolveScreenContentInsets } from "./utils.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
/**
|
|
12
|
+
* Scrollable content container for a `Screen`. Binds the screen's shared scroll
|
|
13
|
+
* ref, mirrors offset into `scrollY`, hosts the portal target at the top (where
|
|
14
|
+
* header content is injected), and applies token-driven content padding.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Screen.ScrollView>
|
|
19
|
+
* <Text>Scrollable content</Text>
|
|
20
|
+
* </Screen.ScrollView>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function ScreenScrollView({
|
|
24
|
+
children,
|
|
25
|
+
style,
|
|
26
|
+
contentContainerStyle,
|
|
27
|
+
hasMargins,
|
|
28
|
+
bottomInset,
|
|
29
|
+
scrollHandler: externalScrollHandler,
|
|
30
|
+
onScroll: onScrollProp,
|
|
31
|
+
horizontal = false,
|
|
32
|
+
...rest
|
|
33
|
+
}) {
|
|
34
|
+
const {
|
|
35
|
+
theme
|
|
36
|
+
} = useUnistyles();
|
|
37
|
+
const {
|
|
38
|
+
top
|
|
39
|
+
} = useSafeAreaInsets();
|
|
40
|
+
const {
|
|
41
|
+
scrollRef,
|
|
42
|
+
scrollHandler: screenScrollHandler,
|
|
43
|
+
headerSnapOffsets,
|
|
44
|
+
margins: screenMargins,
|
|
45
|
+
hasHeader
|
|
46
|
+
} = useScreen();
|
|
47
|
+
const jsScrollHandler = useAnimatedScrollHandler(onScrollProp ? {
|
|
48
|
+
onScroll: event => {
|
|
49
|
+
onScrollProp({
|
|
50
|
+
nativeEvent: event
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
} : {});
|
|
54
|
+
const handlers = [screenScrollHandler, ...(externalScrollHandler ? [externalScrollHandler] : []), ...(onScrollProp ? [jsScrollHandler] : [])];
|
|
55
|
+
const composedHandler = useComposedEventHandler(handlers);
|
|
56
|
+
const margin = theme.layout.screen.margin;
|
|
57
|
+
const marginsEnabled = hasMargins ?? screenMargins;
|
|
58
|
+
const compactHeaderHeight = hasHeader ? top + theme.layout.header.height : 0;
|
|
59
|
+
const {
|
|
60
|
+
contentPadding
|
|
61
|
+
} = resolveScreenContentInsets(margin, marginsEnabled, bottomInset, compactHeaderHeight);
|
|
62
|
+
return /*#__PURE__*/_jsxs(Animated.ScrollView, {
|
|
63
|
+
ref: scrollRef,
|
|
64
|
+
style: style,
|
|
65
|
+
horizontal: horizontal,
|
|
66
|
+
showsVerticalScrollIndicator: false,
|
|
67
|
+
scrollEventThrottle: 16,
|
|
68
|
+
contentContainerStyle: contentPadding,
|
|
69
|
+
snapToOffsets: headerSnapOffsets,
|
|
70
|
+
...rest,
|
|
71
|
+
onScroll: composedHandler,
|
|
72
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
73
|
+
children: /*#__PURE__*/_jsx(PortalHost, {})
|
|
74
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
75
|
+
style: [contentContainerStyle, {
|
|
76
|
+
flexDirection: horizontal ? 'row' : 'column'
|
|
77
|
+
}],
|
|
78
|
+
children: children
|
|
79
|
+
})]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=ScreenScrollView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","Animated","useAnimatedScrollHandler","useComposedEventHandler","useSafeAreaInsets","useUnistyles","PortalHost","useScreen","resolveScreenContentInsets","jsx","_jsx","jsxs","_jsxs","ScreenScrollView","children","style","contentContainerStyle","hasMargins","bottomInset","scrollHandler","externalScrollHandler","onScroll","onScrollProp","horizontal","rest","theme","top","scrollRef","screenScrollHandler","headerSnapOffsets","margins","screenMargins","hasHeader","jsScrollHandler","event","nativeEvent","handlers","composedHandler","margin","layout","screen","marginsEnabled","compactHeaderHeight","header","height","contentPadding","ScrollView","ref","showsVerticalScrollIndicator","scrollEventThrottle","snapToOffsets","flexDirection"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenScrollView.tsx"],"mappings":";;AACA,SAIEA,IAAI,QACC,cAAc;AAErB,OAAOC,QAAQ,IAEbC,wBAAwB,EACxBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,YAAY,QAAQ,wBAAwB;AAErD,SAASC,UAAU,QAAQ,oBAAW;AACtC,SAASC,SAAS,QAAQ,oBAAiB;AAC3C,SAASC,0BAA0B,QAAQ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAsBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAC;EAC/BC,QAAQ;EACRC,KAAK;EACLC,qBAAqB;EACrBC,UAAU;EACVC,WAAW;EACXC,aAAa,EAAEC,qBAAqB;EACpCC,QAAQ,EAAEC,YAAY;EACtBC,UAAU,GAAG,KAAK;EAClB,GAAGC;AACkB,CAAC,EAAE;EACxB,MAAM;IAAEC;EAAM,CAAC,GAAGpB,YAAY,CAAC,CAAC;EAChC,MAAM;IAAEqB;EAAI,CAAC,GAAGtB,iBAAiB,CAAC,CAAC;EACnC,MAAM;IACJuB,SAAS;IACTR,aAAa,EAAES,mBAAmB;IAClCC,iBAAiB;IACjBC,OAAO,EAAEC,aAAa;IACtBC;EACF,CAAC,GAAGzB,SAAS,CAAC,CAAC;EAEf,MAAM0B,eAAe,GAAG/B,wBAAwB,CAC9CoB,YAAY,GACR;IACED,QAAQ,EAAGa,KAAK,IAAK;MACnBZ,YAAY,CAAC;QACXa,WAAW,EAAED;MACf,CAAuD,CAAC;IAC1D;EACF,CAAC,GACD,CAAC,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ScreenFlatList","ScreenScrollView"],"sourceRoot":"../../../../src","sources":["components/screen/index.ts"],"mappings":";;AACA,SAASA,MAAM,QAAQ,aAAU;AAEjC,SAASC,SAAS,QAAQ,oBAAiB;AAE3C,SAASC,cAAc,QAAQ,qBAAkB;AAEjD,SAASC,gBAAgB,QAAQ,uBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function resolveScreenContentInsets(margin, margins, bottomInset, topInset) {
|
|
4
|
+
return {
|
|
5
|
+
contentPadding: {
|
|
6
|
+
flexGrow: 1,
|
|
7
|
+
paddingTop: topInset ?? 0,
|
|
8
|
+
paddingHorizontal: margins ? margin.x : 0,
|
|
9
|
+
paddingBottom: bottomInset ?? (margins ? margin.y : 0)
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["resolveScreenContentInsets","margin","margins","bottomInset","topInset","contentPadding","flexGrow","paddingTop","paddingHorizontal","x","paddingBottom","y"],"sourceRoot":"../../../../src","sources":["components/screen/utils.ts"],"mappings":";;AAEA,OAAO,SAASA,0BAA0BA,CACxCC,MAAwC,EACxCC,OAAgB,EAChBC,WAAoB,EACpBC,QAAiB,EACjB;EACA,OAAO;IACLC,cAAc,EAAE;MACdC,QAAQ,EAAE,CAAU;MACpBC,UAAU,EAAEH,QAAQ,IAAI,CAAC;MACzBI,iBAAiB,EAAEN,OAAO,GAAGD,MAAM,CAACQ,CAAC,GAAG,CAAC;MACzCC,aAAa,EAAEP,WAAW,KAAKD,OAAO,GAAGD,MAAM,CAACU,CAAC,GAAG,CAAC;IACvD;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { cloneElement, isValidElement } from 'react';
|
|
4
|
+
import { composeRefs, mergeProps } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* Radix-style Slot: merges `slotProps` onto a single child element instead of
|
|
7
|
+
* rendering a wrapper. Composes `on*` handlers (child first), `style`
|
|
8
|
+
* (`[slotStyle, childStyle]`), and refs.
|
|
9
|
+
*/
|
|
10
|
+
export function Slot({
|
|
11
|
+
slotProps,
|
|
12
|
+
ownerName = 'Component',
|
|
13
|
+
children
|
|
14
|
+
}) {
|
|
15
|
+
if (! /*#__PURE__*/isValidElement(children)) {
|
|
16
|
+
if (__DEV__ && children != null) {
|
|
17
|
+
console.error(`[${ownerName}] \`asChild\` expects exactly one React element child.`);
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const child = children;
|
|
22
|
+
const childProps = child.props ?? {};
|
|
23
|
+
const {
|
|
24
|
+
ref: slotRef,
|
|
25
|
+
...restSlotProps
|
|
26
|
+
} = slotProps;
|
|
27
|
+
const {
|
|
28
|
+
ref: childRef,
|
|
29
|
+
...restChildProps
|
|
30
|
+
} = childProps;
|
|
31
|
+
const merged = mergeProps(restSlotProps, restChildProps);
|
|
32
|
+
const composedRef = composeRefs(slotRef, childRef);
|
|
33
|
+
return /*#__PURE__*/cloneElement(child, {
|
|
34
|
+
...merged,
|
|
35
|
+
ref: composedRef
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=Slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["cloneElement","isValidElement","composeRefs","mergeProps","Slot","slotProps","ownerName","children","__DEV__","console","error","child","childProps","props","ref","slotRef","restSlotProps","childRef","restChildProps","merged","composedRef"],"sourceRoot":"../../../../src","sources":["components/slot/Slot.tsx"],"mappings":";;AAAA,SACEA,YAAY,EACZC,cAAc,QAIT,OAAO;AAEd,SAASC,WAAW,EAAEC,UAAU,QAAQ,YAAS;AAYjD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,IAAIA,CAAC;EACnBC,SAAS;EACTC,SAAS,GAAG,WAAW;EACvBC;AACS,CAAC,EAAuB;EACjC,IAAI,eAACN,cAAc,CAACM,QAAQ,CAAC,EAAE;IAC7B,IAAIC,OAAO,IAAID,QAAQ,IAAI,IAAI,EAAE;MAC/BE,OAAO,CAACC,KAAK,CACX,IAAIJ,SAAS,wDACf,CAAC;IACH;IACA,OAAO,IAAI;EACb;EAEA,MAAMK,KAAK,GAAGJ,QAAwB;EACtC,MAAMK,UAAU,GAAID,KAAK,CAACE,KAAK,IAAI,CAAC,CAAc;EAElD,MAAM;IAAEC,GAAG,EAAEC,OAAO;IAAE,GAAGC;EAAc,CAAC,GAAGX,SAAS;EACpD,MAAM;IAAES,GAAG,EAAEG,QAAQ;IAAE,GAAGC;EAAe,CAAC,GAAGN,UAAU;EAEvD,MAAMO,MAAM,GAAGhB,UAAU,CAACa,aAAa,EAAEE,cAAc,CAAC;EACxD,MAAME,WAAW,GAAGlB,WAAW,CAC7Ba,OAAO,EACPE,QACF,CAAC;EAED,oBAAOjB,YAAY,CAACW,KAAK,EAAE;IACzB,GAAGQ,MAAM;IACTL,GAAG,EAAEM;EACP,CAAgC,CAAC;AACnC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Low-level composition helpers for advanced use cases (custom primitives,
|
|
5
|
+
* `asChild` patterns). Most apps should use component APIs directly.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { Slot } from "./Slot.js";
|
|
9
|
+
export { composeRefs, mergeProps } from "./utils.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Slot","composeRefs","mergeProps"],"sourceRoot":"../../../../src","sources":["components/slot/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAGA,SAASA,IAAI,QAAQ,WAAQ;AAC7B,SAASC,WAAW,EAAEC,UAAU,QAAQ,YAAS","ignoreList":[]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function assignRef(ref, value) {
|
|
4
|
+
if (typeof ref === 'function') {
|
|
5
|
+
ref(value);
|
|
6
|
+
} else if (ref != null) {
|
|
7
|
+
ref.current = value;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Composes multiple refs so each receives the node. */
|
|
12
|
+
export function composeRefs(...refs) {
|
|
13
|
+
return node => {
|
|
14
|
+
for (const ref of refs) {
|
|
15
|
+
assignRef(ref, node);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const isEventHandler = key => /^on[A-Z]/.test(key);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Merges slot props with the child's own props (child wins), following the
|
|
23
|
+
* Radix Slot rules:
|
|
24
|
+
* - `on*` handlers are composed (child runs first, then slot),
|
|
25
|
+
* - `style` is merged as `[slotStyle, childStyle]`,
|
|
26
|
+
* - all other child props override slot props.
|
|
27
|
+
*
|
|
28
|
+
* `ref`/`style` are intentionally not handled here — the caller composes refs
|
|
29
|
+
* and passes a pre-merged `style` via `slotProps`.
|
|
30
|
+
*/
|
|
31
|
+
export function mergeProps(slotProps, childProps) {
|
|
32
|
+
const merged = {
|
|
33
|
+
...slotProps
|
|
34
|
+
};
|
|
35
|
+
for (const key of Object.keys(childProps)) {
|
|
36
|
+
const slotValue = slotProps[key];
|
|
37
|
+
const childValue = childProps[key];
|
|
38
|
+
if (isEventHandler(key)) {
|
|
39
|
+
if (typeof slotValue === 'function' && typeof childValue === 'function') {
|
|
40
|
+
merged[key] = (...args) => {
|
|
41
|
+
childValue(...args);
|
|
42
|
+
slotValue(...args);
|
|
43
|
+
};
|
|
44
|
+
} else {
|
|
45
|
+
merged[key] = childValue ?? slotValue;
|
|
46
|
+
}
|
|
47
|
+
} else if (key === 'style') {
|
|
48
|
+
merged.style = [slotValue, childValue].filter(Boolean);
|
|
49
|
+
} else {
|
|
50
|
+
merged[key] = childValue;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return merged;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["assignRef","ref","value","current","composeRefs","refs","node","isEventHandler","key","test","mergeProps","slotProps","childProps","merged","Object","keys","slotValue","childValue","args","style","filter","Boolean"],"sourceRoot":"../../../../src","sources":["components/slot/utils.ts"],"mappings":";;AAEA,SAASA,SAASA,CAAIC,GAAuB,EAAEC,KAAe,EAAQ;EACpE,IAAI,OAAOD,GAAG,KAAK,UAAU,EAAE;IAC7BA,GAAG,CAACC,KAAK,CAAC;EACZ,CAAC,MAAM,IAAID,GAAG,IAAI,IAAI,EAAE;IACrBA,GAAG,CAAgCE,OAAO,GAAGD,KAAK;EACrD;AACF;;AAEA;AACA,OAAO,SAASE,WAAWA,CAAI,GAAGC,IAA4B,EAAU;EACtE,OAAQC,IAAc,IAAK;IACzB,KAAK,MAAML,GAAG,IAAII,IAAI,EAAE;MACtBL,SAAS,CAACC,GAAG,EAAEK,IAAI,CAAC;IACtB;EACF,CAAC;AACH;AAIA,MAAMC,cAAc,GAAIC,GAAW,IAAc,UAAU,CAACC,IAAI,CAACD,GAAG,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,UAAUA,CACxBC,SAAmB,EACnBC,UAAoB,EACV;EACV,MAAMC,MAAgB,GAAG;IAAE,GAAGF;EAAU,CAAC;EAEzC,KAAK,MAAMH,GAAG,IAAIM,MAAM,CAACC,IAAI,CAACH,UAAU,CAAC,EAAE;IACzC,MAAMI,SAAS,GAAGL,SAAS,CAACH,GAAG,CAAC;IAChC,MAAMS,UAAU,GAAGL,UAAU,CAACJ,GAAG,CAAC;IAElC,IAAID,cAAc,CAACC,GAAG,CAAC,EAAE;MACvB,IAAI,OAAOQ,SAAS,KAAK,UAAU,IAAI,OAAOC,UAAU,KAAK,UAAU,EAAE;QACvEJ,MAAM,CAACL,GAAG,CAAC,GAAG,CAAC,GAAGU,IAAe,KAAK;UACnCD,UAAU,CAA+B,GAAGC,IAAI,CAAC;UACjDF,SAAS,CAA+B,GAAGE,IAAI,CAAC;QACnD,CAAC;MACH,CAAC,MAAM;QACLL,MAAM,CAACL,GAAG,CAAC,GAAGS,UAAU,IAAID,SAAS;MACvC;IACF,CAAC,MAAM,IAAIR,GAAG,KAAK,OAAO,EAAE;MAC1BK,MAAM,CAACM,KAAK,GAAG,CAACH,SAAS,EAAEC,UAAU,CAAC,CAACG,MAAM,CAACC,OAAO,CAAC;IACxD,CAAC,MAAM;MACLR,MAAM,CAACL,GAAG,CAAC,GAAGS,UAAU;IAC1B;EACF;EAEA,OAAOJ,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { memo, useEffect, useId } from 'react';
|
|
4
|
+
import Animated, { cancelAnimation, Easing, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
|
|
5
|
+
import Svg, { Defs, G, LinearGradient, Path, Stop } from 'react-native-svg';
|
|
6
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
7
|
+
import { resolveThemeColor } from '#utils/resolve-theme-color';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const DIMENSION = {
|
|
10
|
+
sm: 16,
|
|
11
|
+
md: 24,
|
|
12
|
+
lg: 32
|
|
13
|
+
};
|
|
14
|
+
const ROTATION_DURATION = 900;
|
|
15
|
+
|
|
16
|
+
// HeroUI spinner arcs — two gradient-filled segments in a 24×24 viewBox.
|
|
17
|
+
const LEFT_ARC = 'M8.749.021a1.5 1.5 0 0 1 .497 2.958A7.5 7.5 0 0 0 3 10.375a7.5 7.5 0 0 0 7.5 7.5v3c-5.799 0-10.5-4.7-10.5-10.5C0 5.23 3.726.865 8.749.021';
|
|
18
|
+
const RIGHT_ARC = 'M15.392 2.673a1.5 1.5 0 0 1 2.119-.115A10.48 10.48 0 0 1 21 10.375c0 5.8-4.701 10.5-10.5 10.5v-3a7.5 7.5 0 0 0 5.007-13.084a1.5 1.5 0 0 1-.115-2.118';
|
|
19
|
+
const ARC_TRANSFORM = 'translate(1.5 1.625)';
|
|
20
|
+
const SpinnerIcon = /*#__PURE__*/memo(function SpinnerIcon({
|
|
21
|
+
size,
|
|
22
|
+
color,
|
|
23
|
+
gradientId1,
|
|
24
|
+
gradientId2
|
|
25
|
+
}) {
|
|
26
|
+
return /*#__PURE__*/_jsxs(Svg, {
|
|
27
|
+
width: size,
|
|
28
|
+
height: size,
|
|
29
|
+
viewBox: "0 0 24 24",
|
|
30
|
+
children: [/*#__PURE__*/_jsxs(Defs, {
|
|
31
|
+
children: [/*#__PURE__*/_jsxs(LinearGradient, {
|
|
32
|
+
id: gradientId1,
|
|
33
|
+
x1: "50%",
|
|
34
|
+
x2: "50%",
|
|
35
|
+
y1: "5.271%",
|
|
36
|
+
y2: "91.793%",
|
|
37
|
+
children: [/*#__PURE__*/_jsx(Stop, {
|
|
38
|
+
offset: "0%",
|
|
39
|
+
stopColor: color
|
|
40
|
+
}), /*#__PURE__*/_jsx(Stop, {
|
|
41
|
+
offset: "100%",
|
|
42
|
+
stopColor: color,
|
|
43
|
+
stopOpacity: 0.55
|
|
44
|
+
})]
|
|
45
|
+
}), /*#__PURE__*/_jsxs(LinearGradient, {
|
|
46
|
+
id: gradientId2,
|
|
47
|
+
x1: "50%",
|
|
48
|
+
x2: "50%",
|
|
49
|
+
y1: "15.24%",
|
|
50
|
+
y2: "87.15%",
|
|
51
|
+
children: [/*#__PURE__*/_jsx(Stop, {
|
|
52
|
+
offset: "0%",
|
|
53
|
+
stopColor: color,
|
|
54
|
+
stopOpacity: 0
|
|
55
|
+
}), /*#__PURE__*/_jsx(Stop, {
|
|
56
|
+
offset: "100%",
|
|
57
|
+
stopColor: color,
|
|
58
|
+
stopOpacity: 0.55
|
|
59
|
+
})]
|
|
60
|
+
})]
|
|
61
|
+
}), /*#__PURE__*/_jsxs(G, {
|
|
62
|
+
fill: "none",
|
|
63
|
+
children: [/*#__PURE__*/_jsx(Path, {
|
|
64
|
+
d: LEFT_ARC,
|
|
65
|
+
fill: `url(#${gradientId1})`,
|
|
66
|
+
transform: ARC_TRANSFORM
|
|
67
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
68
|
+
d: RIGHT_ARC,
|
|
69
|
+
fill: `url(#${gradientId2})`,
|
|
70
|
+
transform: ARC_TRANSFORM
|
|
71
|
+
})]
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Animated loading spinner. Used by `Button` when `isLoading` is set.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* <Spinner size="md" color="content.accent" />
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export function Spinner({
|
|
85
|
+
size = 'md',
|
|
86
|
+
color = 'text.accent'
|
|
87
|
+
}) {
|
|
88
|
+
const {
|
|
89
|
+
theme
|
|
90
|
+
} = useUnistyles();
|
|
91
|
+
const id = useId();
|
|
92
|
+
const gradientId1 = `spinner-def-1-${id}`;
|
|
93
|
+
const gradientId2 = `spinner-def-2-${id}`;
|
|
94
|
+
const resolvedColor = resolveThemeColor(color, theme) ?? theme.color['text.accent'] ?? '';
|
|
95
|
+
const dim = DIMENSION[size];
|
|
96
|
+
const rotation = useSharedValue(0);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
// Fast refresh can remount without running cleanup — cancel any stale loop first.
|
|
99
|
+
cancelAnimation(rotation);
|
|
100
|
+
rotation.value = 0;
|
|
101
|
+
rotation.value = withRepeat(withTiming(360, {
|
|
102
|
+
duration: ROTATION_DURATION,
|
|
103
|
+
easing: Easing.linear
|
|
104
|
+
}), -1, false);
|
|
105
|
+
return () => {
|
|
106
|
+
cancelAnimation(rotation);
|
|
107
|
+
rotation.value = 0;
|
|
108
|
+
};
|
|
109
|
+
}, [rotation]);
|
|
110
|
+
const animStyle = useAnimatedStyle(() => ({
|
|
111
|
+
transform: [{
|
|
112
|
+
rotate: `${rotation.value}deg`
|
|
113
|
+
}]
|
|
114
|
+
}));
|
|
115
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
116
|
+
accessible: true,
|
|
117
|
+
accessibilityRole: "progressbar",
|
|
118
|
+
accessibilityLabel: "Loading",
|
|
119
|
+
collapsable: false,
|
|
120
|
+
style: [{
|
|
121
|
+
width: dim,
|
|
122
|
+
height: dim
|
|
123
|
+
}, animStyle],
|
|
124
|
+
children: /*#__PURE__*/_jsx(SpinnerIcon, {
|
|
125
|
+
size: dim,
|
|
126
|
+
color: resolvedColor,
|
|
127
|
+
gradientId1: gradientId1,
|
|
128
|
+
gradientId2: gradientId2
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=Spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memo","useEffect","useId","Animated","cancelAnimation","Easing","useAnimatedStyle","useSharedValue","withRepeat","withTiming","Svg","Defs","G","LinearGradient","Path","Stop","useUnistyles","resolveThemeColor","jsx","_jsx","jsxs","_jsxs","DIMENSION","sm","md","lg","ROTATION_DURATION","LEFT_ARC","RIGHT_ARC","ARC_TRANSFORM","SpinnerIcon","size","color","gradientId1","gradientId2","width","height","viewBox","children","id","x1","x2","y1","y2","offset","stopColor","stopOpacity","fill","d","transform","Spinner","theme","resolvedColor","dim","rotation","value","duration","easing","linear","animStyle","rotate","View","accessible","accessibilityRole","accessibilityLabel","collapsable","style"],"sourceRoot":"../../../../src","sources":["components/spinner/Spinner.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,SAAS,EAAEC,KAAK,QAAQ,OAAO;AAE9C,OAAO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@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Spinner"],"sourceRoot":"../../../../src","sources":["components/spinner/index.ts"],"mappings":";;AACA,SAASA,OAAO,QAAQ,cAAW","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
5
|
+
import { getDefaultRadius, getSurfaceElevation } from '#theme/configure';
|
|
6
|
+
import { Box } from "../box/index.js";
|
|
7
|
+
|
|
8
|
+
/** Background level of a {@link Surface}. */
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const VARIANT_BG = {
|
|
11
|
+
base: 'surface.default',
|
|
12
|
+
raised: 'surface.raised',
|
|
13
|
+
sunken: 'surface.sunken',
|
|
14
|
+
transparent: 'transparent'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** Variant-aware hairline borders improve edge definition when fills are close. */
|
|
18
|
+
const VARIANT_BORDER = {
|
|
19
|
+
base: {},
|
|
20
|
+
raised: {
|
|
21
|
+
borderWidth: 'hairline',
|
|
22
|
+
borderColor: 'border.subtle'
|
|
23
|
+
},
|
|
24
|
+
sunken: {
|
|
25
|
+
borderWidth: 'hairline',
|
|
26
|
+
borderColor: 'border.default'
|
|
27
|
+
},
|
|
28
|
+
transparent: {}
|
|
29
|
+
};
|
|
30
|
+
const resolveElevation = (variant, elevation) => {
|
|
31
|
+
if (elevation !== undefined) return elevation;
|
|
32
|
+
if (variant === 'raised') return 'sm';
|
|
33
|
+
return getSurfaceElevation();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Themed container built on {@link Box}. Picks its background from a semantic
|
|
38
|
+
* surface `variant`, its corner radius from the configured `surface`
|
|
39
|
+
* default (overridable via `radius`), and an optional drop shadow via
|
|
40
|
+
* `elevation`. All other Box style-props are accepted.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <Surface variant="raised" elevation="md" p="4" radius="lg">
|
|
45
|
+
* <Text variant="title-sm">Card title</Text>
|
|
46
|
+
* </Surface>
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export const Surface = /*#__PURE__*/forwardRef(function Surface({
|
|
50
|
+
variant = 'base',
|
|
51
|
+
elevation,
|
|
52
|
+
radius,
|
|
53
|
+
borderWidth,
|
|
54
|
+
borderColor,
|
|
55
|
+
style,
|
|
56
|
+
...rest
|
|
57
|
+
}, ref) {
|
|
58
|
+
const {
|
|
59
|
+
theme
|
|
60
|
+
} = useUnistyles();
|
|
61
|
+
const resolvedElevation = resolveElevation(variant, elevation);
|
|
62
|
+
const variantBorder = VARIANT_BORDER[variant];
|
|
63
|
+
const shadowStyle = variant !== 'transparent' && resolvedElevation !== 'none' ? theme.elevation[resolvedElevation] : undefined;
|
|
64
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
65
|
+
ref: ref,
|
|
66
|
+
bg: VARIANT_BG[variant],
|
|
67
|
+
radius: radius ?? getDefaultRadius('surface'),
|
|
68
|
+
borderWidth: borderWidth ?? variantBorder.borderWidth,
|
|
69
|
+
borderColor: borderColor ?? variantBorder.borderColor,
|
|
70
|
+
style: shadowStyle ? [shadowStyle, style] : style,
|
|
71
|
+
...rest
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=Surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useUnistyles","getDefaultRadius","getSurfaceElevation","Box","jsx","_jsx","VARIANT_BG","base","raised","sunken","transparent","VARIANT_BORDER","borderWidth","borderColor","resolveElevation","variant","elevation","undefined","Surface","radius","style","rest","ref","theme","resolvedElevation","variantBorder","shadowStyle","bg"],"sourceRoot":"../../../../src","sources":["components/surface/Surface.tsx"],"mappings":";;AAAA,SAA4BA,UAAU,QAAQ,OAAO;AAGrD,SAASC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a,IAAIS,iBAAiB,KAAK,MAAM,GACpDD,KAAK,CAACP,SAAS,CAACQ,iBAAiB,CAAC,GACnCP,SAAS;EAEf,oBACEZ,IAAA,CAACF,GAAG;IACFmB,GAAG,EAAEA,GAAI;IACTK,EAAE,EAAErB,UAAU,CAACS,OAAO,CAAE;IACxBI,MAAM,EAAEA,MAAM,IAAIlB,gBAAgB,CAAC,SAAS,CAAE;IAC9CW,WAAW,EAAEA,WAAW,IAAIa,aAAa,CAACb,WAAY;IACtDC,WAAW,EAAEA,WAAW,IAAIY,aAAa,CAACZ,WAAY;IACtDO,KAAK,EAAEM,WAAW,GAAG,CAACA,WAAW,EAAEN,KAAK,CAAC,GAAGA,KAAM;IAAA,GAC9CC;EAAI,CACT,CAAC;AAEN,CACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Surface"],"sourceRoot":"../../../../src","sources":["components/surface/index.ts"],"mappings":";;AACA,SAASA,OAAO,QAAQ,cAAW","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { Text as RNText } from 'react-native';
|
|
5
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
6
|
+
import { resolveThemeColor } from '#utils/resolve-theme-color';
|
|
7
|
+
import { FONT_WEIGHT_VALUE, SYSTEM_FONT } from '#utils/typography';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const HEADING_VARIANT_ALIAS = {
|
|
10
|
+
h1: 'headline-lg',
|
|
11
|
+
h2: 'headline-md',
|
|
12
|
+
h3: 'title-lg',
|
|
13
|
+
h4: 'title-md',
|
|
14
|
+
h5: 'title-sm',
|
|
15
|
+
h6: 'label-lg'
|
|
16
|
+
};
|
|
17
|
+
function resolveTextVariant(variant) {
|
|
18
|
+
return variant in HEADING_VARIANT_ALIAS ? HEADING_VARIANT_ALIAS[variant] : variant;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Themed text primitive. Reads its scale from `theme.typography` and resolves
|
|
22
|
+
* fonts by weight, honoring Dynamic Type with a per-variant scaling cap.
|
|
23
|
+
*/
|
|
24
|
+
export const Text = /*#__PURE__*/forwardRef(function Text({
|
|
25
|
+
variant = 'body-md',
|
|
26
|
+
color,
|
|
27
|
+
weight,
|
|
28
|
+
align,
|
|
29
|
+
italic,
|
|
30
|
+
underline,
|
|
31
|
+
strikeThrough,
|
|
32
|
+
isTruncated,
|
|
33
|
+
style,
|
|
34
|
+
numberOfLines,
|
|
35
|
+
ellipsizeMode,
|
|
36
|
+
maxFontSizeMultiplier,
|
|
37
|
+
...rest
|
|
38
|
+
}, ref) {
|
|
39
|
+
const {
|
|
40
|
+
theme
|
|
41
|
+
} = useUnistyles();
|
|
42
|
+
const resolvedVariant = resolveTextVariant(variant);
|
|
43
|
+
const v = theme.typography.variants[resolvedVariant];
|
|
44
|
+
const effectiveWeight = weight ?? v.fontWeight;
|
|
45
|
+
const fontFamily = theme.typography.fonts[effectiveWeight];
|
|
46
|
+
const isSystemFont = fontFamily === SYSTEM_FONT;
|
|
47
|
+
const base = {
|
|
48
|
+
fontSize: v.fontSize,
|
|
49
|
+
lineHeight: v.lineHeight,
|
|
50
|
+
letterSpacing: v.letterSpacing,
|
|
51
|
+
color: resolveThemeColor(color, theme) ?? theme.color['text.default'] ?? ''
|
|
52
|
+
};
|
|
53
|
+
// System font: apply numeric weight. Custom font: family encodes the weight.
|
|
54
|
+
if (isSystemFont) base.fontWeight = FONT_WEIGHT_VALUE[effectiveWeight];else base.fontFamily = fontFamily;
|
|
55
|
+
if (align) base.textAlign = align;
|
|
56
|
+
if (italic) base.fontStyle = 'italic';
|
|
57
|
+
if (underline && strikeThrough) base.textDecorationLine = 'underline line-through';else if (underline) base.textDecorationLine = 'underline';else if (strikeThrough) base.textDecorationLine = 'line-through';
|
|
58
|
+
return /*#__PURE__*/_jsx(RNText, {
|
|
59
|
+
ref: ref,
|
|
60
|
+
style: [base, style],
|
|
61
|
+
maxFontSizeMultiplier: maxFontSizeMultiplier ?? v.maxFontSizeMultiplier,
|
|
62
|
+
numberOfLines: isTruncated ? 1 : numberOfLines,
|
|
63
|
+
ellipsizeMode: isTruncated ? 'tail' : ellipsizeMode,
|
|
64
|
+
...rest
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=Text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","Text","RNText","useUnistyles","resolveThemeColor","FONT_WEIGHT_VALUE","SYSTEM_FONT","jsx","_jsx","HEADING_VARIANT_ALIAS","h1","h2","h3","h4","h5","h6","resolveTextVariant","variant","color","weight","align","italic","underline","strikeThrough","isTruncated","style","numberOfLines","ellipsizeMode","maxFontSizeMultiplier","rest","ref","theme","resolvedVariant","v","typography","variants","effectiveWeight","fontWeight","fontFamily","fonts","isSystemFont","base","fontSize","lineHeight","letterSpacing","textAlign","fontStyle","textDecorationLine"],"sourceRoot":"../../../../src","sources":["components/text/Text.tsx"],"mappings":";;AAAA,SAA4BA,UAAU,QAAQ,OAAO;AACrD,SACEC,IAAI,IAAIC,MAAM,QAGT,cAAc;AAErB,SAASC,YAAY,QAAQ,wBAAwB;AASrD,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,iBAAiB,EAAEC,WAAW,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAInE,MAAMC,qBAAkE,GAAG;EACzEC,EAAE,EAAE,aAAa;EACjBC,EAAE,EAAE,aAAa;EACjBC,EAAE,EAAE,UAAU;EACdC,EAAE,EAAE,UAAU;EACdC,EAAE,EAAE,UAAU;EACdC,EAAE,EAAE;AACN,CAAC;AAED,SAASC,kBAAkBA,CAACC,OAAoB,EAAmB;EACjE,OAAOA,OAAO,IAAIR,qBAAqB,GACnCA,qBAAqB,CAACQ,OAAO,CAAuB,GACnDA,OAA2B;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IAAI,CAACM,kBAAkB,GAAG,wBAAwB,CAAC,KAChD,IAAIzB,SAAS,EAAEmB,IAAI,CAACM,kBAAkB,GAAG,WAAW,CAAC,KACrD,IAAIxB,aAAa,EAAEkB,IAAI,CAACM,kBAAkB,GAAG,cAAc;EAEhE,oBACEvC,IAAA,CAACN,MAAM;IACL4B,GAAG,EAAEA,GAAI;IACTL,KAAK,EAAE,CAACgB,IAAI,EAAEhB,KAAK,CAAE;IACrBG,qBAAqB,EAAEA,qBAAqB,IAAIK,CAAC,CAACL,qBAAsB;IACxEF,aAAa,EAAEF,WAAW,GAAG,CAAC,GAAGE,aAAc;IAC/CC,aAAa,EAAEH,WAAW,GAAG,MAAM,GAAGG,aAAc;IAAA,GAChDE;EAAI,CACT,CAAC;AAEN,CACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Text"],"sourceRoot":"../../../../src","sources":["components/text/index.ts"],"mappings":";;AACA,SAASA,IAAI,QAAQ,WAAQ","ignoreList":[]}
|