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 @@
|
|
|
1
|
+
{"version":3,"names":["DOT_SIZE","GAP","RING_SIZE","RING_STROKE","RING_RADIUS","DOT_INDICATOR_GEOMETRY","dotSize","slot","crossSize","Math","max","ringSize","ringStroke","ringRadius","ringCircumference","PI","inactiveOpacity","pageIndicatorDotCenter","index"],"sourceRoot":"../../../../../../src","sources":["components/page-indicator/variants/DotIndicator/utils.ts"],"mappings":";;AAAA;AACA,MAAMA,QAAQ,GAAG,CAAC;AAClB,MAAMC,GAAG,GAAG,CAAC;AACb,MAAMC,SAAS,GAAG,EAAE;AACpB,MAAMC,WAAW,GAAG,GAAG;AACvB,MAAMC,WAAW,GAAG,CAACF,SAAS,GAAGC,WAAW,IAAI,CAAC;;AAEjD;AACA,OAAO,MAAME,sBAAsB,GAAG;EACpCC,OAAO,EAAEN,QAAQ;EACjBO,IAAI,EAAEP,QAAQ,GAAGC,GAAG;EACpBO,SAAS,EAAEC,IAAI,CAACC,GAAG,CAACR,SAAS,EAAEF,QAAQ,CAAC;EACxCW,QAAQ,EAAET,SAAS;EACnBU,UAAU,EAAET,WAAW;EACvBU,UAAU,EAAET,WAAW;EACvBU,iBAAiB,EAAE,CAAC,GAAGL,IAAI,CAACM,EAAE,GAAGX,WAAW;EAC5CY,eAAe,EAAE;AACnB,CAAU;;AAEV;AACA,OAAO,SAASC,sBAAsBA,CACpCC,KAAa,EACbX,IAAY,EACZD,OAAe,EACP;EACR,SAAS;;EACT,OAAOY,KAAK,GAAGX,IAAI,GAAGD,OAAO,GAAG,CAAC;AACnC","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Animated, { Extrapolation, interpolate, interpolateColor, useAnimatedStyle } from 'react-native-reanimated';
|
|
4
|
+
import { pageIndicatorWindowScale } from "../../utils.js";
|
|
5
|
+
import { PILL_INDICATOR_GEOMETRY, pillIndicatorDotDistance, pillIndicatorJumpDisplayProgress, readPillJumpState } from "./utils.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export function PillIndicatorDot({
|
|
8
|
+
activeColor,
|
|
9
|
+
inactiveColor,
|
|
10
|
+
count,
|
|
11
|
+
index,
|
|
12
|
+
maxVisible,
|
|
13
|
+
overflows,
|
|
14
|
+
pillJump,
|
|
15
|
+
progress,
|
|
16
|
+
vertical
|
|
17
|
+
}) {
|
|
18
|
+
const {
|
|
19
|
+
dotSize,
|
|
20
|
+
activeWidth,
|
|
21
|
+
inactiveOpacity,
|
|
22
|
+
inactiveScale,
|
|
23
|
+
slot
|
|
24
|
+
} = PILL_INDICATOR_GEOMETRY;
|
|
25
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
26
|
+
const jump = readPillJumpState(pillJump);
|
|
27
|
+
const displayProgress = pillIndicatorJumpDisplayProgress(progress.value, jump.active, jump.from, jump.to, jump.t);
|
|
28
|
+
const distance = pillIndicatorDotDistance(index, progress.value, jump.active, jump.from, jump.to, jump.t);
|
|
29
|
+
const mainSize = interpolate(distance, [0, 1], [activeWidth, dotSize], Extrapolation.CLAMP);
|
|
30
|
+
const activeScale = interpolate(distance, [0, 1], [1, inactiveScale], Extrapolation.CLAMP);
|
|
31
|
+
const edgeScale = overflows ? pageIndicatorWindowScale(index, displayProgress, count, slot, dotSize, maxVisible, activeWidth) : 1;
|
|
32
|
+
return {
|
|
33
|
+
...(vertical ? {
|
|
34
|
+
width: dotSize,
|
|
35
|
+
height: mainSize
|
|
36
|
+
} : {
|
|
37
|
+
width: mainSize,
|
|
38
|
+
height: dotSize
|
|
39
|
+
}),
|
|
40
|
+
opacity: interpolate(distance, [0, 1], [1, inactiveOpacity], Extrapolation.CLAMP),
|
|
41
|
+
transform: [{
|
|
42
|
+
scale: activeScale * edgeScale
|
|
43
|
+
}],
|
|
44
|
+
backgroundColor: interpolateColor(distance, [0, 1], [activeColor, inactiveColor])
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
48
|
+
style: [{
|
|
49
|
+
borderRadius: 999
|
|
50
|
+
}, animatedStyle]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=PillIndicatorDot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Animated","Extrapolation","interpolate","interpolateColor","useAnimatedStyle","pageIndicatorWindowScale","PILL_INDICATOR_GEOMETRY","pillIndicatorDotDistance","pillIndicatorJumpDisplayProgress","readPillJumpState","jsx","_jsx","PillIndicatorDot","activeColor","inactiveColor","count","index","maxVisible","overflows","pillJump","progress","vertical","dotSize","activeWidth","inactiveOpacity","inactiveScale","slot","animatedStyle","jump","displayProgress","value","active","from","to","t","distance","mainSize","CLAMP","activeScale","edgeScale","width","height","opacity","transform","scale","backgroundColor","View","style","borderRadius"],"sourceRoot":"../../../../../../src","sources":["components/page-indicator/variants/PillIndicator/PillIndicatorDot.tsx"],"mappings":";;AAAA,OAAOA,QAAQ,IACbC,aAAa,EACbC,WAAW,EACXC,gBAAgB,EAEhBC,gBAAgB,QACX,yBAAyB;AAGhC,SAASC,wBAAwB,QAAQ,gBAAa;AAEtD,SACEC,uBAAuB,EACvBC,wBAAwB,EACxBC,gCAAgC,EAChCC,iBAAiB,QACZ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAcjB,OAAO,SAASC,gBAAgBA,CAAC;EAC/BC,WAAW;EACXC,aAAa;EACbC,KAAK;EACLC,KAAK;EACLC,UAAU;EACVC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRC;AACqB,CAAC,EAAE;EACxB,MAAM;IAAEC,OAAO;IAAEC,WAAW;IAAEC,eAAe;IAAEC,aAAa;IAAEC;EAAK,CAAC,GAClEpB,uBAAuB;EAEzB,MAAMqB,aAAa,GAAGvB,gBAAgB,CAAC,MAAM;IAC3C,MAAMwB,IAAI,GAAGnB,iBAAiB,CAACU,QAAQ,CAAC;IACxC,MAAMU,eAAe,GAAGrB,gCAAgC,CACtDY,QAAQ,CAACU,KAAK,EACdF,IAAI,CAACG,MAAM,EACXH,IAAI,CAACI,IAAI,EACTJ,IAAI,CAACK,EAAE,EACPL,IAAI,CAACM,CACP,CAAC;IACD,MAAM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AAE,CAAC;MAAEC,YAAY,EAAE;IAAI,CAAC,EAAErB,aAAa;EAAE,CAAE,CAAC;AACzE","ignoreList":[]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
5
|
+
import { usePageIndicatorCore } from "../../hooks/use-page-indicator-core.js";
|
|
6
|
+
import { PageIndicatorRoot } from "../../PageIndicatorRoot.js";
|
|
7
|
+
import { computePageIndicatorWindowTranslate, DEFAULT_PAGE_INDICATOR_MAX_VISIBLE, PAGE_INDICATOR_SINGLE_PAGE_DURATION, pageIndicatorAxisTranslateStyle, pageIndicatorTrackMainSize, pageIndicatorViewportMainSize } from "../../utils.js";
|
|
8
|
+
import { PillIndicatorDot } from "./PillIndicatorDot.js";
|
|
9
|
+
import { PILL_INDICATOR_GEOMETRY, pillIndicatorJumpDisplayProgress } from "./utils.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
export function PillIndicator({
|
|
12
|
+
count,
|
|
13
|
+
current = 0,
|
|
14
|
+
duration = PAGE_INDICATOR_SINGLE_PAGE_DURATION,
|
|
15
|
+
activeColor,
|
|
16
|
+
inactiveColor,
|
|
17
|
+
vertical = false,
|
|
18
|
+
maxVisible = DEFAULT_PAGE_INDICATOR_MAX_VISIBLE,
|
|
19
|
+
style
|
|
20
|
+
}) {
|
|
21
|
+
const {
|
|
22
|
+
colors,
|
|
23
|
+
pillJump,
|
|
24
|
+
progress
|
|
25
|
+
} = usePageIndicatorCore(count, current, 'pill', duration, {
|
|
26
|
+
activeColor,
|
|
27
|
+
inactiveColor
|
|
28
|
+
});
|
|
29
|
+
const {
|
|
30
|
+
dotSize,
|
|
31
|
+
gap,
|
|
32
|
+
slot,
|
|
33
|
+
activeWidth
|
|
34
|
+
} = PILL_INDICATOR_GEOMETRY;
|
|
35
|
+
const viewportMainSize = pageIndicatorViewportMainSize(count, slot, dotSize, maxVisible, activeWidth);
|
|
36
|
+
const fullTrackMainSize = pageIndicatorTrackMainSize(count, slot, dotSize, activeWidth);
|
|
37
|
+
const overflows = count > maxVisible;
|
|
38
|
+
const indices = useMemo(() => Array.from({
|
|
39
|
+
length: count
|
|
40
|
+
}, (_, index) => index), [count]);
|
|
41
|
+
const trackStyle = useAnimatedStyle(() => {
|
|
42
|
+
const displayProgress = pillIndicatorJumpDisplayProgress(progress.value, pillJump.active.value, pillJump.from.value, pillJump.to.value, pillJump.t.value);
|
|
43
|
+
const translate = computePageIndicatorWindowTranslate(count, displayProgress, slot, dotSize, maxVisible, activeWidth);
|
|
44
|
+
return pageIndicatorAxisTranslateStyle(vertical, translate);
|
|
45
|
+
});
|
|
46
|
+
return /*#__PURE__*/_jsx(PageIndicatorRoot, {
|
|
47
|
+
style: style,
|
|
48
|
+
vertical: vertical,
|
|
49
|
+
viewportMainSize: viewportMainSize,
|
|
50
|
+
overflows: overflows,
|
|
51
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
52
|
+
style: [{
|
|
53
|
+
flexDirection: vertical ? 'column' : 'row',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
gap,
|
|
56
|
+
...(overflows ? vertical ? {
|
|
57
|
+
height: fullTrackMainSize
|
|
58
|
+
} : {
|
|
59
|
+
width: fullTrackMainSize
|
|
60
|
+
} : undefined)
|
|
61
|
+
}, overflows ? trackStyle : null],
|
|
62
|
+
children: indices.map(index => /*#__PURE__*/_jsx(PillIndicatorDot, {
|
|
63
|
+
activeColor: colors.activeColor,
|
|
64
|
+
inactiveColor: colors.inactiveColor,
|
|
65
|
+
count: count,
|
|
66
|
+
index: index,
|
|
67
|
+
pillJump: pillJump,
|
|
68
|
+
progress: progress,
|
|
69
|
+
vertical: vertical,
|
|
70
|
+
overflows: overflows,
|
|
71
|
+
maxVisible: maxVisible
|
|
72
|
+
}, index))
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","Animated","useAnimatedStyle","usePageIndicatorCore","PageIndicatorRoot","computePageIndicatorWindowTranslate","DEFAULT_PAGE_INDICATOR_MAX_VISIBLE","PAGE_INDICATOR_SINGLE_PAGE_DURATION","pageIndicatorAxisTranslateStyle","pageIndicatorTrackMainSize","pageIndicatorViewportMainSize","PillIndicatorDot","PILL_INDICATOR_GEOMETRY","pillIndicatorJumpDisplayProgress","jsx","_jsx","PillIndicator","count","current","duration","activeColor","inactiveColor","vertical","maxVisible","style","colors","pillJump","progress","dotSize","gap","slot","activeWidth","viewportMainSize","fullTrackMainSize","overflows","indices","Array","from","length","_","index","trackStyle","displayProgress","value","active","to","t","translate","children","View","flexDirection","alignItems","height","width","undefined","map"],"sourceRoot":"../../../../../../src","sources":["components/page-indicator/variants/PillIndicator/index.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAI/B,OAAOC,QAAQ,IAAIC,gBAAgB,QAAQ,yBAAyB;AAIpE,SAASC,oBAAoB,QAAQ,wCAAqC;AAC1E,SAASC,iBAAiB,QAAQ,4BAAyB;AAC3D,SACEC,mCAAmC,EACnCC,kCAAkC,EAClCC,mCAAmC,EACnCC,+BAA+B,EAC/BC,0BAA0B,EAC1BC,6BAA6B,QACxB,gBAAa;AAEpB,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SACEC,uBAAuB,EACvBC,gCAAgC,QAC3B,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA0BjB,OAAO,SAASC,aAAaA,CAAC;EAC5BC,KAAK;EACLC,OAAO,GAAG,CAAC;EACXC,QAAQ,GAAGZ,mCAAmC;EAC9Ca,WAAW;EACXC,aAAa;EACbC,QAAQ,GAAG,KAAK;EAChBC,UAAU,GAAGjB,kCAAkC;EAC/CkB;AACkB,CAAC,EAAE;EACrB,MAAM;IAAEC,MAAM;IA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gB,EAAEA,gBAAiB;IACnCE,SAAS,EAAEA,SAAU;IAAAc,QAAA,eAErBjC,IAAA,CAACd,QAAQ,CAACgD,IAAI;MACZzB,KAAK,EAAE,CACL;QACE0B,aAAa,EAAE5B,QAAQ,GAAG,QAAQ,GAAG,KAAK;QAC1C6B,UAAU,EAAE,QAAQ;QACpBtB,GAAG;QACH,IAAIK,SAAS,GACTZ,QAAQ,GACN;UAAE8B,MAAM,EAAEnB;QAAkB,CAAC,GAC7B;UAAEoB,KAAK,EAAEpB;QAAkB,CAAC,GAC9BqB,SAAS;MACf,CAAC,EACDpB,SAAS,GAAGO,UAAU,GAAG,IAAI,CAC7B;MAAAO,QAAA,EAEDb,OAAO,CAACoB,GAAG,CAAEf,KAAK,iBACjBzB,IAAA,CAACJ,gBAAgB;QAEfS,WAAW,EAAEK,MAAM,CAACL,WAAY;QAChCC,aAAa,EAAEI,MAAM,CAACJ,aAAc;QACpCJ,KAAK,EAAEA,KAAM;QACbuB,KAAK,EAAEA,KAAM;QACbd,QAAQ,EAAEA,QAAS;QACnBC,QAAQ,EAAEA,QAAS;QACnBL,QAAQ,EAAEA,QAAS;QACnBY,SAAS,EAAEA,SAAU;QACrBX,UAAU,EAAEA;MAAW,GATlBiB,KAUN,CACF;IAAC,CACW;EAAC,CACC,CAAC;AAExB","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const DOT_SIZE = 8;
|
|
4
|
+
const GAP = 8;
|
|
5
|
+
|
|
6
|
+
/** Precomputed geometry shared by PillIndicator sub-components. */
|
|
7
|
+
export const PILL_INDICATOR_GEOMETRY = {
|
|
8
|
+
dotSize: DOT_SIZE,
|
|
9
|
+
gap: GAP,
|
|
10
|
+
slot: DOT_SIZE + GAP,
|
|
11
|
+
activeWidth: 24,
|
|
12
|
+
inactiveOpacity: 0.42,
|
|
13
|
+
inactiveScale: 0.9
|
|
14
|
+
};
|
|
15
|
+
export function readPillJumpState(jump) {
|
|
16
|
+
'worklet';
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
active: jump.active.value,
|
|
20
|
+
from: jump.from.value,
|
|
21
|
+
to: jump.to.value,
|
|
22
|
+
t: jump.t.value
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function pillIndicatorDotDistance(index, progress, jumpActive, jumpFrom, jumpTo, jumpT) {
|
|
26
|
+
'worklet';
|
|
27
|
+
|
|
28
|
+
if (!jumpActive) {
|
|
29
|
+
return Math.min(Math.abs(progress - index), 1);
|
|
30
|
+
}
|
|
31
|
+
if (index === jumpFrom) {
|
|
32
|
+
return jumpT;
|
|
33
|
+
}
|
|
34
|
+
if (index === jumpTo) {
|
|
35
|
+
return 1 - jumpT;
|
|
36
|
+
}
|
|
37
|
+
return 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Progress for window translation during a multi-page pill jump. */
|
|
41
|
+
export function pillIndicatorJumpDisplayProgress(progress, jumpActive, jumpFrom, jumpTo, jumpT) {
|
|
42
|
+
'worklet';
|
|
43
|
+
|
|
44
|
+
if (!jumpActive) return progress;
|
|
45
|
+
return jumpFrom + jumpT * (jumpTo - jumpFrom);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DOT_SIZE","GAP","PILL_INDICATOR_GEOMETRY","dotSize","gap","slot","activeWidth","inactiveOpacity","inactiveScale","readPillJumpState","jump","active","value","from","to","t","pillIndicatorDotDistance","index","progress","jumpActive","jumpFrom","jumpTo","jumpT","Math","min","abs","pillIndicatorJumpDisplayProgress"],"sourceRoot":"../../../../../../src","sources":["components/page-indicator/variants/PillIndicator/utils.ts"],"mappings":";;AAEA,MAAMA,QAAQ,GAAG,CAAC;AAClB,MAAMC,GAAG,GAAG,CAAC;;AAEb;AACA,OAAO,MAAMC,uBAAuB,GAAG;EACrCC,OAAO,EAAEH,QAAQ;EACjBI,GAAG,EAAEH,GAAG;EACRI,IAAI,EAAEL,QAAQ,GAAGC,GAAG;EACpBK,WAAW,EAAE,EAAE;EACfC,eAAe,EAAE,IAAI;EACrBC,aAAa,EAAE;AACjB,CAAU;AAIV,OAAO,SAASC,iBAAiBA,CAACC,IAAmB,EAAE;EACrD,SAAS;;EACT,OAAO;IACLC,MAAM,EAAED,IAAI,CAACC,MAAM,CAACC,KAAK;IACzBC,IAAI,EAAEH,IAAI,CAACG,IAAI,CAACD,KAAK;IACrBE,EAAE,EAAEJ,IAAI,CAACI,EAAE,CAACF,KAAK;IACjBG,CAAC,EAAEL,IAAI,CAACK,CAAC,CAACH;EACZ,CAAC;AACH;AAEA,OAAO,SAASI,wBAAwBA,CACtCC,KAAa,EACbC,QAAgB,EAChBC,UAAmB,EACnBC,QAAgB,EAChBC,MAAc,EACdC,KAAa,EACL;EACR,SAAS;;EACT,IAAI,CAACH,UAAU,EAAE;IACf,OAAOI,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACP,QAAQ,GAAGD,KAAK,CAAC,EAAE,CAAC,CAAC;EAChD;EAEA,IAAIA,KAAK,KAAKG,QAAQ,EAAE;IACtB,OAAOE,KAAK;EACd;EAEA,IAAIL,KAAK,KAAKI,MAAM,EAAE;IACpB,OAAO,CAAC,GAAGC,KAAK;EAClB;EAEA,OAAO,CAAC;AACV;;AAEA;AACA,OAAO,SAASI,gCAAgCA,CAC9CR,QAAgB,EAChBC,UAAmB,EACnBC,QAAgB,EAChBC,MAAc,EACdC,KAAa,EACL;EACR,SAAS;;EACT,IAAI,CAACH,UAAU,EAAE,OAAOD,QAAQ;EAChC,OAAOE,QAAQ,GAAGE,KAAK,IAAID,MAAM,GAAGD,QAAQ,CAAC;AAC/C","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
export const PortalContext = /*#__PURE__*/createContext(null);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Access the nearest {@link PortalProvider}. Used by components that need to
|
|
8
|
+
* teleport content into a `PortalHost` rendered elsewhere in the tree (e.g. the
|
|
9
|
+
* large-title header injecting its title into the scroll content).
|
|
10
|
+
*
|
|
11
|
+
* @throws if called outside a `PortalProvider`.
|
|
12
|
+
*/
|
|
13
|
+
export function usePortal() {
|
|
14
|
+
const context = useContext(PortalContext);
|
|
15
|
+
if (!context) {
|
|
16
|
+
throw new Error('usePortal must be used within a PortalProvider');
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=PortalContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","PortalContext","usePortal","context","Error"],"sourceRoot":"../../../../src","sources":["components/portal/PortalContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAkBC,UAAU,QAAQ,OAAO;AAWjE,OAAO,MAAMC,aAAa,gBAAGF,aAAa,CAA4B,IAAI,CAAC;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,SAASA,CAAA,EAAuB;EAC9C,MAAMC,OAAO,GAAGH,UAAU,CAACC,aAAa,CAAC;EACzC,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,gDAAgD,CAAC;EACnE;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { usePortal } from "./PortalContext.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders every node currently registered with the nearest
|
|
8
|
+
* {@link PortalProvider}, in insertion order. Place it where teleported content
|
|
9
|
+
* should appear (e.g. at the top of a `Screen.ScrollView`).
|
|
10
|
+
*/
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
export function PortalHost() {
|
|
13
|
+
const {
|
|
14
|
+
contents
|
|
15
|
+
} = usePortal();
|
|
16
|
+
return /*#__PURE__*/_jsx(View, {
|
|
17
|
+
collapsable: false,
|
|
18
|
+
children: Array.from(contents.entries()).map(([id, content]) => /*#__PURE__*/_jsx(View, {
|
|
19
|
+
children: content
|
|
20
|
+
}, id))
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=PortalHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","usePortal","jsx","_jsx","PortalHost","contents","collapsable","children","Array","from","entries","map","id","content"],"sourceRoot":"../../../../src","sources":["components/portal/PortalHost.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,cAAc;AAEnC,SAASC,SAAS,QAAQ,oBAAiB;;AAE3C;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA;AAKA,OAAO,SAASC,UAAUA,CAAA,EAAG;EAC3B,MAAM;IAAEC;EAAS,CAAC,GAAGJ,SAAS,CAAC,CAAC;EAEhC,oBACEE,IAAA,CAACH,IAAI;IAACM,WAAW,EAAE,KAAM;IAAAC,QAAA,EACtBC,KAAK,CAACC,IAAI,CAACJ,QAAQ,CAACK,OAAO,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,EAAE,EAAEC,OAAO,CAAC,kBAChDV,IAAA,CAACH,IAAI;MAAAO,QAAA,EAAWM;IAAO,GAAZD,EAAmB,CAC/B;EAAC,CACE,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
4
|
+
import { PortalContext } from "./PortalContext.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
/**
|
|
7
|
+
* Holds a registry of teleported content. Children register/unregister nodes by
|
|
8
|
+
* id (see {@link usePortal}); a `PortalHost` placed anywhere below renders them.
|
|
9
|
+
* Context-only — no animation dependency.
|
|
10
|
+
*/
|
|
11
|
+
export function PortalProvider({
|
|
12
|
+
children
|
|
13
|
+
}) {
|
|
14
|
+
const [contents, setContents] = useState(() => new Map());
|
|
15
|
+
const registerContent = useCallback((id, content) => {
|
|
16
|
+
setContents(prev => {
|
|
17
|
+
const next = new Map(prev);
|
|
18
|
+
next.set(id, content);
|
|
19
|
+
return next;
|
|
20
|
+
});
|
|
21
|
+
}, []);
|
|
22
|
+
const unregisterContent = useCallback(id => {
|
|
23
|
+
setContents(prev => {
|
|
24
|
+
if (!prev.has(id)) return prev;
|
|
25
|
+
const next = new Map(prev);
|
|
26
|
+
next.delete(id);
|
|
27
|
+
return next;
|
|
28
|
+
});
|
|
29
|
+
}, []);
|
|
30
|
+
const value = useMemo(() => ({
|
|
31
|
+
registerContent,
|
|
32
|
+
unregisterContent,
|
|
33
|
+
contents
|
|
34
|
+
}), [registerContent, unregisterContent, contents]);
|
|
35
|
+
return /*#__PURE__*/_jsx(PortalContext.Provider, {
|
|
36
|
+
value: value,
|
|
37
|
+
children: children
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=PortalProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useState","PortalContext","jsx","_jsx","PortalProvider","children","contents","setContents","Map","registerContent","id","content","prev","next","set","unregisterContent","has","delete","value","Provider"],"sourceRoot":"../../../../src","sources":["components/portal/PortalProvider.tsx"],"mappings":";;AAAA,SAAyBA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEtE,SAASC,aAAa,QAAiC,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMzE;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAA8B,CAAC,EAAE;EAChE,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGP,QAAQ,CACtC,MAAM,IAAIQ,GAAG,CAAC,CAChB,CAAC;EAED,MAAMC,eAAe,GAAGX,WAAW,CAAC,CAACY,EAAU,EAAEC,OAAkB,KAAK;IACtEJ,WAAW,CAAEK,IAAI,IAAK;MACpB,MAAMC,IAAI,GAAG,IAAIL,GAAG,CAACI,IAAI,CAAC;MAC1BC,IAAI,CAACC,GAAG,CAACJ,EAAE,EAAEC,OAAO,CAAC;MACrB,OAAOE,IAAI;IACb,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,iBAAiB,GAAGjB,WAAW,CAAEY,EAAU,IAAK;IACpDH,WAAW,CAAEK,IAAI,IAAK;MACpB,IAAI,CAACA,IAAI,CAACI,GAAG,CAACN,EAAE,CAAC,EAAE,OAAOE,IAAI;MAC9B,MAAMC,IAAI,GAAG,IAAIL,GAAG,CAACI,IAAI,CAAC;MAC1BC,IAAI,CAACI,MAAM,CAACP,EAAE,CAAC;MACf,OAAOG,IAAI;IACb,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMK,KAAK,GAAGnB,OAAO,CACnB,OAAO;IAAEU,eAAe;IAAEM,iBAAiB;IAAET;EAAS,CAAC,CAAC,EACxD,CAACG,eAAe,EAAEM,iBAAiB,EAAET,QAAQ,CAC/C,CAAC;EAED,oBACEH,IAAA,CAACF,aAAa,CAACkB,QAAQ;IAACD,KAAK,EAAEA,KAAM;IAAAb,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAE7E","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["usePortal","PortalHost","PortalProvider"],"sourceRoot":"../../../../src","sources":["components/portal/index.ts"],"mappings":";;AACA,SAASA,SAAS,QAAQ,oBAAiB;AAC3C,SAASC,UAAU,QAAQ,iBAAc;AAEzC,SAASC,cAAc,QAAQ,qBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Children, Fragment, forwardRef, isValidElement, useMemo } from 'react';
|
|
4
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
5
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
6
|
+
import { resolveThemeColor } from '#utils/resolve-theme-color';
|
|
7
|
+
import { PortalProvider } from "../portal/index.js";
|
|
8
|
+
import { ScreenScrollProvider } from "./ScreenContext.js";
|
|
9
|
+
import { ScreenFlatList } from "./ScreenFlatList.js";
|
|
10
|
+
import { ScreenScrollView } from "./ScreenScrollView.js";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* Marker slot identifying the screen's header — its purpose is to let
|
|
14
|
+
* `Screen` detect a header synchronously and drop the `top` safe-area edge
|
|
15
|
+
* (the header manages its own top inset).
|
|
16
|
+
*
|
|
17
|
+
* Place a `Header.Title` / `Header.LargeTitle` (or any custom header) inside it.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Screen.Header as={Header.Title} title="Meditate" />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
function ScreenHeader({
|
|
25
|
+
children,
|
|
26
|
+
as,
|
|
27
|
+
...rest
|
|
28
|
+
}) {
|
|
29
|
+
const Component = as ?? Fragment;
|
|
30
|
+
return /*#__PURE__*/_jsx(Component, {
|
|
31
|
+
...rest,
|
|
32
|
+
children: children
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** True if `children` directly contains a `Screen.Header`. */
|
|
37
|
+
function hasScreenHeader(children) {
|
|
38
|
+
let found = false;
|
|
39
|
+
Children.forEach(children, child => {
|
|
40
|
+
if (found) return;
|
|
41
|
+
if (/*#__PURE__*/isValidElement(child) && child.type === ScreenHeader) found = true;
|
|
42
|
+
});
|
|
43
|
+
return found;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Themed page container: solid themed background, safe-area handling, and a
|
|
47
|
+
* shared scroll context for headers. Pair with `Screen.ScrollView` /
|
|
48
|
+
* `Screen.FlatList` and a `Header.LargeTitle` / `Header.Title`.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <Screen>
|
|
53
|
+
* <Screen.Header as={Header.LargeTitle} title="Meditate" />
|
|
54
|
+
* <Screen.ScrollView>{content}</Screen.ScrollView>
|
|
55
|
+
* </Screen>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
const ScreenBase = /*#__PURE__*/forwardRef(function Screen({
|
|
59
|
+
children,
|
|
60
|
+
bg = 'background',
|
|
61
|
+
edges,
|
|
62
|
+
inTabView = false,
|
|
63
|
+
margins = true,
|
|
64
|
+
style,
|
|
65
|
+
...rest
|
|
66
|
+
}, ref) {
|
|
67
|
+
const {
|
|
68
|
+
theme
|
|
69
|
+
} = useUnistyles();
|
|
70
|
+
const backgroundColor = resolveThemeColor(bg, theme) ?? theme.color.background;
|
|
71
|
+
const hasHeader = useMemo(() => hasScreenHeader(children), [children]);
|
|
72
|
+
const safeEdges = useMemo(() => {
|
|
73
|
+
if (edges) {
|
|
74
|
+
return hasHeader ? edges.filter(edge => edge !== 'top') : edges;
|
|
75
|
+
}
|
|
76
|
+
return hasHeader ? [] : ['top', 'bottom'];
|
|
77
|
+
}, [edges, hasHeader]);
|
|
78
|
+
return /*#__PURE__*/_jsx(ScreenScrollProvider, {
|
|
79
|
+
isInTabView: inTabView,
|
|
80
|
+
margins: margins,
|
|
81
|
+
hasHeader: hasHeader,
|
|
82
|
+
children: /*#__PURE__*/_jsx(PortalProvider, {
|
|
83
|
+
children: /*#__PURE__*/_jsx(SafeAreaView, {
|
|
84
|
+
ref: ref,
|
|
85
|
+
edges: safeEdges,
|
|
86
|
+
style: [{
|
|
87
|
+
flex: 1,
|
|
88
|
+
backgroundColor
|
|
89
|
+
}, style],
|
|
90
|
+
...rest,
|
|
91
|
+
children: children
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
ScreenBase.Header = ScreenHeader;
|
|
97
|
+
ScreenBase.ScrollView = ScreenScrollView;
|
|
98
|
+
ScreenBase.FlatList = ScreenFlatList;
|
|
99
|
+
export const Screen = ScreenBase;
|
|
100
|
+
//# sourceMappingURL=Screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Children","Fragment","forwardRef","isValidElement","useMemo","SafeAreaView","useUnistyles","resolveThemeColor","PortalProvider","ScreenScrollProvider","ScreenFlatList","ScreenScrollView","jsx","_jsx","ScreenHeader","children","as","rest","Component","hasScreenHeader","found","forEach","child","type","ScreenBase","Screen","bg","edges","inTabView","margins","style","ref","theme","backgroundColor","color","background","hasHeader","safeEdges","filter","edge","isInTabView","flex","Header","ScrollView","FlatList"],"sourceRoot":"../../../../src","sources":["components/screen/Screen.tsx"],"mappings":";;AAAA,SACEA,QAAQ,EAIRC,QAAQ,EACRC,UAAU,EACVC,cAAc,EAGdC,OAAO,QACF,OAAO;AACd,SAEEC,YAAY,QAEP,gCAAgC;AACvC,SAASC,YAAY,QAAQ,wBAAwB;AAGrD,SAASC,iBAAiB,QAAQ,4BAA4B;AAE9D,SAASC,cAAc,QAAQ,oBAAW;AAC1C,SAASC,oBAAoB,QAAQ,oBAAiB;AACtD,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,gBAAgB,QAAQ,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AActD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,YAAYA,CAA0C;EAC7DC,QAAQ;EACRC,EAAE;EACF,GAAGC;AACiB,CAAC,EAAE;EACvB,MAAMC,SAAS,GAAGF,EAAE,IAAIf,QAAQ;EAChC,oBAAOY,IAAA,CAACK,SAAS;IAAA,GAAKD,IAAI;IAAAF,QAAA,EAAGA;EAAQ,CAAY,CAAC;AACpD;;AAEA;AACA,SAASI,eAAe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;IACjBO,SAAS,EAAEA,SAAU;IAAArB,QAAA,eAErBF,IAAA,CAACL,cAAc;MAAAO,QAAA,eACbF,IAAA,CAACR,YAAY;QACX0B,GAAG,EAAEA,GAAI;QACTJ,KAAK,EAAEU,SAAU;QACjBP,KAAK,EAAE,CAAC;UAAEW,IAAI,EAAE,CAAC;UAAER;QAAgB,CAAC,EAAEH,KAAK,CAAE;QAAA,GACzCb,IAAI;QAAAF,QAAA,EAEPA;MAAQ,CACG;IAAC,CACD;EAAC,CACG,CAAC;AAE3B,CACF,CAAoB;AAEpBS,UAAU,CAACkB,MAAM,GAAG5B,YAAY;AAChCU,UAAU,CAACmB,UAAU,GAAGhC,gBAAgB;AACxCa,UAAU,CAACoB,QAAQ,GAAGlC,cAAc;AAEpC,OAAO,MAAMe,MAAM,GAAGD,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useCallback, useContext, useMemo, useState } from 'react';
|
|
4
|
+
import { useAnimatedRef, useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export const ScreenContext = /*#__PURE__*/createContext(null);
|
|
7
|
+
/**
|
|
8
|
+
* Owns the screen's shared scroll ref, offset, snap offsets, and header collapse
|
|
9
|
+
* metrics. Header variants call {@link ScreenContextValue.setHeaderCollapseHeight};
|
|
10
|
+
* scroll containers bind the ref via {@link useScreen}.
|
|
11
|
+
*/
|
|
12
|
+
export function ScreenScrollProvider({
|
|
13
|
+
children,
|
|
14
|
+
isInTabView,
|
|
15
|
+
margins = true,
|
|
16
|
+
hasHeader = false
|
|
17
|
+
}) {
|
|
18
|
+
const scrollY = useSharedValue(0);
|
|
19
|
+
const headerCollapseHeight = useSharedValue(0);
|
|
20
|
+
const [headerSnapOffsets, setHeaderSnapOffsets] = useState();
|
|
21
|
+
const scrollRef = useAnimatedRef();
|
|
22
|
+
const setHeaderCollapseHeight = useCallback(height => {
|
|
23
|
+
const rounded = Math.round(height);
|
|
24
|
+
headerCollapseHeight.value = rounded;
|
|
25
|
+
setHeaderSnapOffsets(rounded > 0 ? [0, rounded] : undefined);
|
|
26
|
+
}, [headerCollapseHeight]);
|
|
27
|
+
const scrollHandler = useAnimatedScrollHandler({
|
|
28
|
+
onScroll: event => {
|
|
29
|
+
scrollY.value = event.contentOffset.y;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const value = useMemo(() => ({
|
|
33
|
+
margins,
|
|
34
|
+
hasHeader,
|
|
35
|
+
scrollY,
|
|
36
|
+
headerCollapseHeight,
|
|
37
|
+
headerSnapOffsets,
|
|
38
|
+
setHeaderCollapseHeight,
|
|
39
|
+
scrollRef,
|
|
40
|
+
scrollHandler,
|
|
41
|
+
isInTabView
|
|
42
|
+
}), [margins, hasHeader, scrollY, headerCollapseHeight, headerSnapOffsets, setHeaderCollapseHeight, scrollRef, scrollHandler, isInTabView]);
|
|
43
|
+
return /*#__PURE__*/_jsx(ScreenContext.Provider, {
|
|
44
|
+
value: value,
|
|
45
|
+
children: children
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Access the enclosing `Screen`'s shared scroll state, ref, and snap offsets.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* const { scrollY, scrollRef, headerSnapOffsets } = useScreen();
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @throws if called outside a `Screen`.
|
|
58
|
+
*/
|
|
59
|
+
export function useScreen() {
|
|
60
|
+
const context = useContext(ScreenContext);
|
|
61
|
+
if (!context) {
|
|
62
|
+
throw new Error('useScreen must be used within a Screen component');
|
|
63
|
+
}
|
|
64
|
+
return context;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=ScreenContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useCallback","useContext","useMemo","useState","useAnimatedRef","useAnimatedScrollHandler","useSharedValue","jsx","_jsx","ScreenContext","ScreenScrollProvider","children","isInTabView","margins","hasHeader","scrollY","headerCollapseHeight","headerSnapOffsets","setHeaderSnapOffsets","scrollRef","setHeaderCollapseHeight","height","rounded","Math","round","value","undefined","scrollHandler","onScroll","event","contentOffset","y","Provider","useScreen","context","Error"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenContext.tsx"],"mappings":";;AAAA,SACEA,aAAa,EAEbC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QACH,OAAO;AAEd,SAIEC,cAAc,EACdC,wBAAwB,EACxBC,cAAc,QACT,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAuCjC,OAAO,MAAMC,aAAa,gBAAGV,aAAa,CAA4B,IAAI,CAAC;AAW3E;AACA;AACA;AACA;AACA;AACA,OAAO,SAASW,oBAAoBA,CAAC;EACnCC,QAAQ;EACRC,WAAW;EACXC,OAAO,GAAG,IAAI;EACdC,SAAS,GAAG;AACa,CAAC,EAAE;EAC5B,MAAMC,OAAO,GAAGT,cAAc,CAAC,CAAC,CAAC;EACjC,MAAMU,oBAAoB,GAAGV,cAAc,CAAC,CAAC,CAAC;EAC9C,MAAM,CAACW,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGf,QAAQ,CAAW,CAAC;EACtE,MAAMgB,SAAS,GAAGf,cAAc,CAAsB,CAAC;EAEvD,MAAMgB,uBAAuB,GAAGpB,WAAW,CACxCqB,MAAc,IAAK;IAClB,MAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,MAAM,CAAC;IAClCL,oBAAoB,CAACS,KAAK,GAAGH,OAAO;IACpCJ,oBAAoB,CAACI,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAEA,OAAO,CAAC,GAAGI,SAAS,CAAC;EAC9D,CAAC,EACD,CAACV,oBAAoB,CACvB,CAAC;EAED,MAAMW,aAAa,GAAGtB,wBAAwB,CAAC;IAC7CuB,QAAQ,EAAGC,KAAK,IAAK;MACnBd,OAAO,CAACU,KAAK,GAAGI,KAAK,CAACC,aAAa,CAACC,CAAC;IACvC;EACF,CAAC,CAAC;EAEF,MAAMN,KAAK,GAAGvB,OAAO,CACnB,OAAO;IACLW,OAAO;IACPC,SAAS;IACTC,OAAO;IACPC,oBAAoB;IACpBC,iBAAiB;IACjBG,uBAAuB;IACvBD,SAAS;IACTQ,aAAa;IACbf;EACF,CAAC,CAAC,EACF,CACEC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,oBAAoB,EACpBC,iBAAiB,EACjBG,uBAAuB,EACvBD,SAAS,EACTQ,aAAa,EACbf,WAAW,CAEf,CAAC;EAED,oBACEJ,IAAA,CAACC,aAAa,CAACuB,QAAQ;IAACP,KAAK,EAAEA,KAAM;IAAAd,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAE7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASsB,SAASA,CAAA,EAAuB;EAC9C,MAAMC,OAAO,GAAGjC,UAAU,CAACQ,aAAa,CAAC;EACzC,IAAI,CAACyB,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,kDAAkD,CAAC;EACrE;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createElement, isValidElement } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedScrollHandler, useComposedEventHandler } from 'react-native-reanimated';
|
|
6
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
7
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
8
|
+
import { PortalHost } from "../portal/index.js";
|
|
9
|
+
import { useScreen } from "./ScreenContext.js";
|
|
10
|
+
import { resolveScreenContentInsets } from "./utils.js";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
function renderListHeader(ListHeaderComponent) {
|
|
13
|
+
if (!ListHeaderComponent) return null;
|
|
14
|
+
if (/*#__PURE__*/isValidElement(ListHeaderComponent)) return ListHeaderComponent;
|
|
15
|
+
return /*#__PURE__*/createElement(ListHeaderComponent);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* `FlatList` variant of `Screen.ScrollView`: binds the screen's shared scroll
|
|
20
|
+
* ref, mirrors offset into `scrollY`, hosts the portal target above the list,
|
|
21
|
+
* and applies token-driven content padding.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Screen.FlatList data={items} renderItem={({ item }) => <Row item={item} />} />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export function ScreenFlatList({
|
|
29
|
+
style,
|
|
30
|
+
contentContainerStyle,
|
|
31
|
+
ListHeaderComponent,
|
|
32
|
+
margins,
|
|
33
|
+
bottomInset,
|
|
34
|
+
onScroll,
|
|
35
|
+
...rest
|
|
36
|
+
}) {
|
|
37
|
+
const {
|
|
38
|
+
theme
|
|
39
|
+
} = useUnistyles();
|
|
40
|
+
const {
|
|
41
|
+
top
|
|
42
|
+
} = useSafeAreaInsets();
|
|
43
|
+
const {
|
|
44
|
+
scrollRef,
|
|
45
|
+
scrollHandler,
|
|
46
|
+
headerSnapOffsets,
|
|
47
|
+
margins: screenMargins,
|
|
48
|
+
hasHeader
|
|
49
|
+
} = useScreen();
|
|
50
|
+
const margin = theme.layout.screen.margin;
|
|
51
|
+
const marginsEnabled = margins ?? screenMargins;
|
|
52
|
+
const compactHeaderHeight = hasHeader ? top + theme.layout.header.height : 0;
|
|
53
|
+
const {
|
|
54
|
+
contentPadding
|
|
55
|
+
} = resolveScreenContentInsets(margin, marginsEnabled, bottomInset, compactHeaderHeight);
|
|
56
|
+
const jsScrollHandler = useAnimatedScrollHandler(event => {
|
|
57
|
+
if (onScroll) onScroll(event);
|
|
58
|
+
}, [onScroll]);
|
|
59
|
+
const composedHandler = useComposedEventHandler([scrollHandler, jsScrollHandler]);
|
|
60
|
+
const headerComponent = /*#__PURE__*/_jsxs(View, {
|
|
61
|
+
children: [/*#__PURE__*/_jsx(PortalHost, {}), renderListHeader(ListHeaderComponent)]
|
|
62
|
+
});
|
|
63
|
+
return /*#__PURE__*/_jsx(Animated.FlatList, {
|
|
64
|
+
ref: scrollRef,
|
|
65
|
+
style: style,
|
|
66
|
+
contentContainerStyle: [contentPadding, contentContainerStyle],
|
|
67
|
+
ListHeaderComponent: headerComponent,
|
|
68
|
+
showsVerticalScrollIndicator: false,
|
|
69
|
+
scrollEventThrottle: 16,
|
|
70
|
+
snapToOffsets: headerSnapOffsets,
|
|
71
|
+
...rest,
|
|
72
|
+
onScroll: composedHandler
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=ScreenFlatList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createElement","isValidElement","View","Animated","useAnimatedScrollHandler","useComposedEventHandler","useSafeAreaInsets","useUnistyles","PortalHost","useScreen","resolveScreenContentInsets","jsx","_jsx","jsxs","_jsxs","renderListHeader","ListHeaderComponent","ScreenFlatList","style","contentContainerStyle","margins","bottomInset","onScroll","rest","theme","top","scrollRef","scrollHandler","headerSnapOffsets","screenMargins","hasHeader","margin","layout","screen","marginsEnabled","compactHeaderHeight","header","height","contentPadding","jsScrollHandler","event","composedHandler","headerComponent","children","FlatList","ref","showsVerticalScrollIndicator","scrollEventThrottle","snapToOffsets"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenFlatList.tsx"],"mappings":";;AAAA,SACEA,aAAa,EAEbC,cAAc,QAET,OAAO;AACd,SAIEC,IAAI,QACC,cAAc;AAErB,OAAOC,QAAQ,IAEbC,wBAAwB,EACxBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,gCAAgC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