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,350 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, forwardRef, useContext, useId, useMemo } from 'react';
|
|
4
|
+
import { Pressable, StyleSheet } from 'react-native';
|
|
5
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
6
|
+
import { Box } from "../box/index.js";
|
|
7
|
+
import { Button } from "../button/index.js";
|
|
8
|
+
import { Icon } from "../icon/index.js";
|
|
9
|
+
import { Surface } from "../surface/index.js";
|
|
10
|
+
import { Text } from "../text/index.js";
|
|
11
|
+
import { hideToast, showToast } from "./utils/controller.js";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const ToastContext = /*#__PURE__*/createContext(null);
|
|
14
|
+
function useToastContext() {
|
|
15
|
+
const context = useContext(ToastContext);
|
|
16
|
+
if (!context) {
|
|
17
|
+
throw new Error('Toast compound components must be rendered inside <Toast>.');
|
|
18
|
+
}
|
|
19
|
+
return context;
|
|
20
|
+
}
|
|
21
|
+
function getToastColors(variant, theme) {
|
|
22
|
+
const c = theme.color;
|
|
23
|
+
const get = key => c[key] ?? '';
|
|
24
|
+
const base = {
|
|
25
|
+
bg: get('surface.default'),
|
|
26
|
+
border: get('border.subtle'),
|
|
27
|
+
description: get('text.muted')
|
|
28
|
+
};
|
|
29
|
+
switch (variant) {
|
|
30
|
+
case 'accent':
|
|
31
|
+
return {
|
|
32
|
+
...base,
|
|
33
|
+
title: get('action.fg.subtle'),
|
|
34
|
+
icon: get('text.accent'),
|
|
35
|
+
actionBg: get('action.bg.primary'),
|
|
36
|
+
actionFg: get('action.fg.primary')
|
|
37
|
+
};
|
|
38
|
+
case 'info':
|
|
39
|
+
case 'success':
|
|
40
|
+
case 'warning':
|
|
41
|
+
case 'danger':
|
|
42
|
+
return {
|
|
43
|
+
...base,
|
|
44
|
+
title: get(`status.bg.${variant}`),
|
|
45
|
+
icon: get(`status.bg.${variant}`),
|
|
46
|
+
actionBg: get(`status.bg.${variant}`),
|
|
47
|
+
actionFg: get(`status.fg.${variant}`)
|
|
48
|
+
};
|
|
49
|
+
case 'default':
|
|
50
|
+
return {
|
|
51
|
+
...base,
|
|
52
|
+
title: get('text.default'),
|
|
53
|
+
icon: get('text.subtle'),
|
|
54
|
+
actionBg: get('action.bg.neutral.hover'),
|
|
55
|
+
actionFg: get('action.fg.neutral')
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const ToastRoot = /*#__PURE__*/forwardRef(function Toast({
|
|
60
|
+
variant = 'default',
|
|
61
|
+
id,
|
|
62
|
+
hide,
|
|
63
|
+
onClose,
|
|
64
|
+
children,
|
|
65
|
+
nativeID: nativeIDProp,
|
|
66
|
+
style,
|
|
67
|
+
accessibilityRole = 'alert',
|
|
68
|
+
...rest
|
|
69
|
+
}, ref) {
|
|
70
|
+
const {
|
|
71
|
+
theme
|
|
72
|
+
} = useUnistyles();
|
|
73
|
+
const generatedNativeID = useId();
|
|
74
|
+
const nativeID = nativeIDProp ?? String(id ?? generatedNativeID);
|
|
75
|
+
const colors = getToastColors(variant, theme);
|
|
76
|
+
const contextValue = useMemo(() => ({
|
|
77
|
+
nativeID,
|
|
78
|
+
variant,
|
|
79
|
+
id,
|
|
80
|
+
hide,
|
|
81
|
+
onClose
|
|
82
|
+
}), [nativeID, variant, id, hide, onClose]);
|
|
83
|
+
return /*#__PURE__*/_jsx(ToastContext.Provider, {
|
|
84
|
+
value: contextValue,
|
|
85
|
+
children: /*#__PURE__*/_jsx(Surface, {
|
|
86
|
+
ref: ref,
|
|
87
|
+
variant: "raised",
|
|
88
|
+
elevation: "md",
|
|
89
|
+
radius: "xl",
|
|
90
|
+
p: "4",
|
|
91
|
+
row: true,
|
|
92
|
+
align: "center",
|
|
93
|
+
gap: "3",
|
|
94
|
+
accessibilityRole: accessibilityRole,
|
|
95
|
+
accessibilityLiveRegion: "polite",
|
|
96
|
+
borderWidth: "hairline",
|
|
97
|
+
nativeID: nativeID,
|
|
98
|
+
style: [styles.root, {
|
|
99
|
+
backgroundColor: colors.bg,
|
|
100
|
+
borderColor: colors.border
|
|
101
|
+
}, style],
|
|
102
|
+
...rest,
|
|
103
|
+
children: children
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
const ToastTitle = /*#__PURE__*/forwardRef(function ToastTitle({
|
|
108
|
+
accessibilityRole = 'header',
|
|
109
|
+
color,
|
|
110
|
+
nativeID,
|
|
111
|
+
variant = 'label-lg',
|
|
112
|
+
weight,
|
|
113
|
+
...rest
|
|
114
|
+
}, ref) {
|
|
115
|
+
const {
|
|
116
|
+
theme
|
|
117
|
+
} = useUnistyles();
|
|
118
|
+
const {
|
|
119
|
+
nativeID: rootNativeID,
|
|
120
|
+
variant: toastVariant
|
|
121
|
+
} = useToastContext();
|
|
122
|
+
const colors = getToastColors(toastVariant, theme);
|
|
123
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
124
|
+
ref: ref,
|
|
125
|
+
accessibilityRole: accessibilityRole,
|
|
126
|
+
color: color ?? colors.title,
|
|
127
|
+
nativeID: nativeID ?? `${rootNativeID}_label`,
|
|
128
|
+
variant: variant,
|
|
129
|
+
weight: weight ?? 'semibold',
|
|
130
|
+
...rest
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
const ToastDescription = /*#__PURE__*/forwardRef(function ToastDescription({
|
|
134
|
+
color,
|
|
135
|
+
nativeID,
|
|
136
|
+
variant = 'body-sm',
|
|
137
|
+
...rest
|
|
138
|
+
}, ref) {
|
|
139
|
+
const {
|
|
140
|
+
theme
|
|
141
|
+
} = useUnistyles();
|
|
142
|
+
const {
|
|
143
|
+
nativeID: rootNativeID,
|
|
144
|
+
variant: toastVariant
|
|
145
|
+
} = useToastContext();
|
|
146
|
+
const colors = getToastColors(toastVariant, theme);
|
|
147
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
148
|
+
ref: ref,
|
|
149
|
+
color: color ?? colors.description,
|
|
150
|
+
nativeID: nativeID ?? `${rootNativeID}_desc`,
|
|
151
|
+
variant: variant,
|
|
152
|
+
...rest
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
function renderActionChildren(children, color) {
|
|
156
|
+
if (typeof children === 'string' || typeof children === 'number') {
|
|
157
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
158
|
+
variant: "label-lg",
|
|
159
|
+
weight: "semibold",
|
|
160
|
+
style: {
|
|
161
|
+
color
|
|
162
|
+
},
|
|
163
|
+
children: children
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return children;
|
|
167
|
+
}
|
|
168
|
+
const ToastAction = /*#__PURE__*/forwardRef(function ToastAction({
|
|
169
|
+
children,
|
|
170
|
+
variant,
|
|
171
|
+
fullWidth = false,
|
|
172
|
+
isDisabled = false,
|
|
173
|
+
size = 'sm',
|
|
174
|
+
style,
|
|
175
|
+
onPress,
|
|
176
|
+
...rest
|
|
177
|
+
}, ref) {
|
|
178
|
+
const {
|
|
179
|
+
theme
|
|
180
|
+
} = useUnistyles();
|
|
181
|
+
const {
|
|
182
|
+
variant: toastVariant
|
|
183
|
+
} = useToastContext();
|
|
184
|
+
const colors = getToastColors(variant ?? toastVariant, theme);
|
|
185
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
186
|
+
ref: ref,
|
|
187
|
+
accessibilityRole: "button",
|
|
188
|
+
accessibilityState: {
|
|
189
|
+
disabled: isDisabled
|
|
190
|
+
},
|
|
191
|
+
disabled: isDisabled,
|
|
192
|
+
onPress: isDisabled ? undefined : onPress,
|
|
193
|
+
...rest,
|
|
194
|
+
style: state => [styles.action, styles[`action_${size}`], fullWidth ? styles.actionFullWidth : null, {
|
|
195
|
+
backgroundColor: colors.actionBg,
|
|
196
|
+
opacity: state.pressed && !isDisabled ? theme.opacity.pressed : isDisabled ? theme.opacity.disabled : 1
|
|
197
|
+
}, typeof style === 'function' ? style(state) : style],
|
|
198
|
+
children: renderActionChildren(children, colors.actionFg)
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
const ToastClose = /*#__PURE__*/forwardRef(function ToastClose({
|
|
202
|
+
children,
|
|
203
|
+
iconProps,
|
|
204
|
+
size = 'sm',
|
|
205
|
+
fullWidth = false,
|
|
206
|
+
isIconOnly = true,
|
|
207
|
+
variant = 'ghost',
|
|
208
|
+
accessibilityLabel = 'Close',
|
|
209
|
+
onPress,
|
|
210
|
+
...rest
|
|
211
|
+
}, ref) {
|
|
212
|
+
const {
|
|
213
|
+
theme
|
|
214
|
+
} = useUnistyles();
|
|
215
|
+
const {
|
|
216
|
+
id,
|
|
217
|
+
hide,
|
|
218
|
+
onClose,
|
|
219
|
+
variant: toastVariant
|
|
220
|
+
} = useToastContext();
|
|
221
|
+
const colors = getToastColors(toastVariant, theme);
|
|
222
|
+
const handlePress = event => {
|
|
223
|
+
if (id !== undefined) hide?.(id);
|
|
224
|
+
onClose?.();
|
|
225
|
+
onPress?.(event);
|
|
226
|
+
};
|
|
227
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
228
|
+
ref: ref,
|
|
229
|
+
accessibilityLabel: accessibilityLabel,
|
|
230
|
+
fullWidth: fullWidth,
|
|
231
|
+
isIconOnly: isIconOnly,
|
|
232
|
+
onPress: handlePress,
|
|
233
|
+
size: size,
|
|
234
|
+
compact: true,
|
|
235
|
+
variant: variant,
|
|
236
|
+
...rest,
|
|
237
|
+
children: children ?? /*#__PURE__*/_jsx(Icon, {
|
|
238
|
+
name: "navigation.close",
|
|
239
|
+
size: iconProps?.size ?? 20,
|
|
240
|
+
color: iconProps?.color ?? colors.icon,
|
|
241
|
+
strokeWidth: iconProps?.strokeWidth,
|
|
242
|
+
style: iconProps?.style
|
|
243
|
+
})
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
const VARIANT_ICON = {
|
|
247
|
+
info: 'status.info',
|
|
248
|
+
success: 'status.success',
|
|
249
|
+
warning: 'status.warning',
|
|
250
|
+
danger: 'status.danger'
|
|
251
|
+
};
|
|
252
|
+
const ToastIcon = /*#__PURE__*/forwardRef(function ToastIcon({
|
|
253
|
+
name,
|
|
254
|
+
color,
|
|
255
|
+
size = 20,
|
|
256
|
+
...rest
|
|
257
|
+
}, ref) {
|
|
258
|
+
const {
|
|
259
|
+
theme
|
|
260
|
+
} = useUnistyles();
|
|
261
|
+
const {
|
|
262
|
+
variant
|
|
263
|
+
} = useToastContext();
|
|
264
|
+
const colors = getToastColors(variant, theme);
|
|
265
|
+
const iconName = name ?? VARIANT_ICON[variant] ?? 'status.info';
|
|
266
|
+
return /*#__PURE__*/_jsx(Icon, {
|
|
267
|
+
ref: ref,
|
|
268
|
+
color: color ?? colors.icon,
|
|
269
|
+
name: iconName,
|
|
270
|
+
size: size,
|
|
271
|
+
...rest
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
export function DefaultToast({
|
|
275
|
+
label,
|
|
276
|
+
description,
|
|
277
|
+
actionLabel,
|
|
278
|
+
onActionPress,
|
|
279
|
+
icon,
|
|
280
|
+
showCloseButton,
|
|
281
|
+
id,
|
|
282
|
+
hide,
|
|
283
|
+
variant = 'default',
|
|
284
|
+
...rest
|
|
285
|
+
}) {
|
|
286
|
+
const shouldRenderIcon = icon !== false && (icon || variant !== 'default');
|
|
287
|
+
const handleActionPress = () => {
|
|
288
|
+
onActionPress?.({
|
|
289
|
+
id,
|
|
290
|
+
hide
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
return /*#__PURE__*/_jsxs(ToastRoot, {
|
|
294
|
+
id: id,
|
|
295
|
+
hide: hide,
|
|
296
|
+
variant: variant,
|
|
297
|
+
...rest,
|
|
298
|
+
children: [shouldRenderIcon ? /*#__PURE__*/_jsx(Box, {
|
|
299
|
+
alignSelf: "start",
|
|
300
|
+
children: icon ?? /*#__PURE__*/_jsx(ToastIcon, {})
|
|
301
|
+
}) : null, /*#__PURE__*/_jsxs(Box, {
|
|
302
|
+
flex: 1,
|
|
303
|
+
gap: "1",
|
|
304
|
+
children: [label ? /*#__PURE__*/_jsx(ToastTitle, {
|
|
305
|
+
children: label
|
|
306
|
+
}) : null, description ? /*#__PURE__*/_jsx(ToastDescription, {
|
|
307
|
+
children: description
|
|
308
|
+
}) : null]
|
|
309
|
+
}), actionLabel ? /*#__PURE__*/_jsx(ToastAction, {
|
|
310
|
+
onPress: handleActionPress,
|
|
311
|
+
children: actionLabel
|
|
312
|
+
}) : null, showCloseButton ? /*#__PURE__*/_jsx(ToastClose, {}) : null]
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
export const Toast = ToastRoot;
|
|
316
|
+
Toast.Title = ToastTitle;
|
|
317
|
+
Toast.Description = ToastDescription;
|
|
318
|
+
Toast.Action = ToastAction;
|
|
319
|
+
Toast.Close = ToastClose;
|
|
320
|
+
Toast.Icon = ToastIcon;
|
|
321
|
+
Toast.show = showToast;
|
|
322
|
+
Toast.hide = hideToast;
|
|
323
|
+
const styles = StyleSheet.create({
|
|
324
|
+
root: {
|
|
325
|
+
alignSelf: 'stretch',
|
|
326
|
+
minHeight: 64
|
|
327
|
+
},
|
|
328
|
+
action: {
|
|
329
|
+
alignItems: 'center',
|
|
330
|
+
alignSelf: 'flex-start',
|
|
331
|
+
borderRadius: 9999,
|
|
332
|
+
justifyContent: 'center'
|
|
333
|
+
},
|
|
334
|
+
action_sm: {
|
|
335
|
+
minHeight: 36,
|
|
336
|
+
paddingHorizontal: 14
|
|
337
|
+
},
|
|
338
|
+
action_md: {
|
|
339
|
+
minHeight: 44,
|
|
340
|
+
paddingHorizontal: 16
|
|
341
|
+
},
|
|
342
|
+
action_lg: {
|
|
343
|
+
minHeight: 52,
|
|
344
|
+
paddingHorizontal: 20
|
|
345
|
+
},
|
|
346
|
+
actionFullWidth: {
|
|
347
|
+
alignSelf: 'stretch'
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","forwardRef","useContext","useId","useMemo","Pressable","StyleSheet","useUnistyles","Box","Button","Icon","Surface","Text","hideToast","showToast","jsx","_jsx","jsxs","_jsxs","ToastContext","useToastContext","context","Error","getToastColors","variant","theme","c","color","get","key","base","bg","border","description","title","icon","actionBg","actionFg","ToastRoot","Toast","id","hide","onClose","children","nativeID","nativeIDProp","style","accessibilityRole","rest","ref","generatedNativeID","String","colors","contextValue","Provider","value","elevation","radius","p","row","align","gap","accessibilityLiveRegion","borderWidth","styles","root","backgroundColor","borderColor","ToastTitle","weight","rootNativeID","toastVariant","ToastDescription","renderActionChildren","ToastAction","fullWidth","isDisabled","size","onPress","accessibilityState","disabled","undefined","state","action","actionFullWidth","opacity","pressed","ToastClose","iconProps","isIconOnly","accessibilityLabel","handlePress","event","compact","name","strokeWidth","VARIANT_ICON","info","success","warning","danger","ToastIcon","iconName","DefaultToast","label","actionLabel","onActionPress","showCloseButton","shouldRenderIcon","handleActionPress","alignSelf","flex","Title","Description","Action","Close","show","create","minHeight","alignItems","borderRadius","justifyContent","action_sm","paddingHorizontal","action_md","action_lg"],"sourceRoot":"../../../../src","sources":["components/toast/Toast.tsx"],"mappings":";;AAAA,SAEEA,aAAa,EACbC,UAAU,EAEVC,UAAU,EACVC,KAAK,EACLC,OAAO,QACF,OAAO;AAEd,SAASC,SAAS,EAAEC,UAAU,QAAQ,cAAc;AAEpD,SAASC,YAAY,QAAQ,wBAAwB;AAIrD,SAASC,GAAG,QAAQ,iBAAQ;AAC5B,SAASC,MAAM,QAA0B,oBAAW;AACpD,SAASC,IAAI,QAAwB,kBAAS;AAC9C,SAASC,OAAO,QAA2B,qBAAY;AACvD,SAASC,IAAI,QAAwB,kBAAS;AAE9C,SAASC,SAAS,EAAEC,SAAS,QAAQ,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAuB1D,MAAMC,YAAY,gBAAGnB,aAAa,CAA2B,IAAI,CAAC;AAElE,SAASoB,eAAeA,CAAA,EAAsB;EAC5C,MAAMC,OAAO,GAAGnB,UAAU,CAACiB,YAAY,CAAC;EACxC,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CACb,4DACF,CAAC;EACH;EACA,OAAOD,OAAO;AAChB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,gBACVzF,IAAA,CAAC0D,WAAW;MAACI,OAAO,EAAE+B,iBAAkB;MAAAlE,QAAA,EAAE8D;IAAW,CAAc,CAAC,GAClE,IAAI,EACPE,eAAe,gBAAG3F,IAAA,CAACuE,UAAU,IAAE,CAAC,GAAG,IAAI;EAAA,CAC/B,CAAC;AAEhB;AAYA,OAAO,MAAMhD,KAAK,GAAGD,SAA2B;AAChDC,KAAK,CAACyE,KAAK,GAAG5C,UAAU;AACxB7B,KAAK,CAAC0E,WAAW,GAAGzC,gBAAgB;AACpCjC,KAAK,CAAC2E,MAAM,GAAGxC,WAAW;AAC1BnC,KAAK,CAAC4E,KAAK,GAAG5B,UAAU;AACxBhD,KAAK,CAAC7B,IAAI,GAAG2F,SAAS;AACtB9D,KAAK,CAAC6E,IAAI,GAAGtG,SAAS;AACtByB,KAAK,CAACE,IAAI,GAAG5B,SAAS;AAEtB,MAAMmD,MAAM,GAAG1D,UAAU,CAAC+G,MAAM,CAAC;EAC/BpD,IAAI,EAAE;IACJ6C,SAAS,EAAE,SAAS;IACpBQ,SAAS,EAAE;EACb,CAAC;EACDnC,MAAM,EAAE;IACNoC,UAAU,EAAE,QAAQ;IACpBT,SAAS,EAAE,YAAY;IACvBU,YAAY,EAAE,IAAI;IAClBC,cAAc,EAAE;EAClB,CAAC;EACDC,SAAS,EAAE;IACTJ,SAAS,EAAE,EAAE;IACbK,iBAAiB,EAAE;EACrB,CAAC;EACDC,SAAS,EAAE;IACTN,SAAS,EAAE,EAAE;IACbK,iBAAiB,EAAE;EACrB,CAAC;EACDE,SAAS,EAAE;IACTP,SAAS,EAAE,EAAE;IACbK,iBAAiB,EAAE;EACrB,CAAC;EACDvC,eAAe,EAAE;IACf0B,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useReducer, useRef } from 'react';
|
|
4
|
+
import { Keyboard, Platform } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
6
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
7
|
+
import { ToastAnimatedItem } from "./parts/ToastAnimatedItem.js";
|
|
8
|
+
import { DefaultToast } from "./Toast.js";
|
|
9
|
+
import { setToastManager } from "./utils/controller.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
const DEFAULT_DURATION = 4000;
|
|
12
|
+
const DEFAULT_MAX_VISIBLE_TOASTS = 3;
|
|
13
|
+
const ToastManagerContext = /*#__PURE__*/createContext(null);
|
|
14
|
+
function toastReducer(state, action) {
|
|
15
|
+
switch (action.type) {
|
|
16
|
+
case 'show':
|
|
17
|
+
return [...state.filter(toast => toast.id !== action.item.id), action.item];
|
|
18
|
+
case 'hide':
|
|
19
|
+
return state.filter(toast => !action.ids.some(id => id === toast.id));
|
|
20
|
+
case 'hideAll':
|
|
21
|
+
return [];
|
|
22
|
+
case 'hidePlacement':
|
|
23
|
+
return state.filter(toast => toast.placement !== action.placement);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function createDefaultToastComponent(config, manager) {
|
|
27
|
+
return ({
|
|
28
|
+
id,
|
|
29
|
+
hide
|
|
30
|
+
}) => /*#__PURE__*/_jsx(DefaultToast, {
|
|
31
|
+
id: id,
|
|
32
|
+
hide: toastId => hide(String(toastId)),
|
|
33
|
+
variant: config.variant,
|
|
34
|
+
label: config.label,
|
|
35
|
+
description: config.description,
|
|
36
|
+
icon: config.icon,
|
|
37
|
+
actionLabel: config.actionLabel,
|
|
38
|
+
showCloseButton: config.showCloseButton,
|
|
39
|
+
onActionPress: () => config.onActionPress?.(manager)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function isCustomToast(options) {
|
|
43
|
+
return typeof options === 'object' && options !== null && 'component' in options;
|
|
44
|
+
}
|
|
45
|
+
function normalizePlacement(placement, fallback) {
|
|
46
|
+
return placement ?? fallback;
|
|
47
|
+
}
|
|
48
|
+
function normalizeDuration(duration, fallback) {
|
|
49
|
+
return duration ?? fallback;
|
|
50
|
+
}
|
|
51
|
+
function toastId(counter) {
|
|
52
|
+
return `toast-${Date.now()}-${counter}`;
|
|
53
|
+
}
|
|
54
|
+
export function ToastProvider({
|
|
55
|
+
children,
|
|
56
|
+
defaultPlacement = 'top',
|
|
57
|
+
defaultDuration = DEFAULT_DURATION,
|
|
58
|
+
maxVisibleToasts = DEFAULT_MAX_VISIBLE_TOASTS,
|
|
59
|
+
offset
|
|
60
|
+
}) {
|
|
61
|
+
const [toasts, dispatch] = useReducer(toastReducer, []);
|
|
62
|
+
const toastsRef = useRef([]);
|
|
63
|
+
const counterRef = useRef(0);
|
|
64
|
+
const timeoutsRef = useRef(new Map());
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
toastsRef.current = toasts;
|
|
67
|
+
}, [toasts]);
|
|
68
|
+
const clearToastTimeout = useCallback(id => {
|
|
69
|
+
const timeout = timeoutsRef.current.get(id);
|
|
70
|
+
if (timeout) clearTimeout(timeout);
|
|
71
|
+
timeoutsRef.current.delete(id);
|
|
72
|
+
}, []);
|
|
73
|
+
const hide = useCallback(id => {
|
|
74
|
+
if (id === 'all') {
|
|
75
|
+
for (const toast of toastsRef.current) {
|
|
76
|
+
clearToastTimeout(toast.id);
|
|
77
|
+
toast.onHide?.();
|
|
78
|
+
}
|
|
79
|
+
toastsRef.current = [];
|
|
80
|
+
dispatch({
|
|
81
|
+
type: 'hideAll'
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const lastToastId = toastsRef.current[toastsRef.current.length - 1]?.id;
|
|
86
|
+
const ids = id === undefined ? lastToastId ? [lastToastId] : [] : Array.isArray(id) ? id : [id];
|
|
87
|
+
if (ids.length === 0) return;
|
|
88
|
+
for (const toastId of ids) {
|
|
89
|
+
clearToastTimeout(toastId);
|
|
90
|
+
toastsRef.current.find(toast => toast.id === toastId)?.onHide?.();
|
|
91
|
+
}
|
|
92
|
+
toastsRef.current = toastsRef.current.filter(toast => !ids.some(toastId => toastId === toast.id));
|
|
93
|
+
dispatch({
|
|
94
|
+
type: 'hide',
|
|
95
|
+
ids
|
|
96
|
+
});
|
|
97
|
+
}, [clearToastTimeout]);
|
|
98
|
+
const managerRef = useRef({
|
|
99
|
+
show: () => '',
|
|
100
|
+
hide
|
|
101
|
+
});
|
|
102
|
+
const show = useCallback(options => {
|
|
103
|
+
const nextId = typeof options === 'object' && options !== null && 'id' in options ? options.id ?? toastId(counterRef.current++) : toastId(counterRef.current++);
|
|
104
|
+
const item = typeof options === 'string' ? {
|
|
105
|
+
id: nextId,
|
|
106
|
+
component: createDefaultToastComponent({
|
|
107
|
+
label: options
|
|
108
|
+
}, managerRef.current),
|
|
109
|
+
duration: defaultDuration,
|
|
110
|
+
placement: defaultPlacement
|
|
111
|
+
} : isCustomToast(options) ? {
|
|
112
|
+
id: nextId,
|
|
113
|
+
component: options.component,
|
|
114
|
+
duration: normalizeDuration(options.duration, defaultDuration),
|
|
115
|
+
placement: normalizePlacement(options.placement, defaultPlacement),
|
|
116
|
+
onHide: options.onHide
|
|
117
|
+
} : {
|
|
118
|
+
id: nextId,
|
|
119
|
+
component: createDefaultToastComponent(options, managerRef.current),
|
|
120
|
+
duration: normalizeDuration(options.duration, defaultDuration),
|
|
121
|
+
placement: normalizePlacement(options.placement, defaultPlacement),
|
|
122
|
+
onHide: options.onHide
|
|
123
|
+
};
|
|
124
|
+
const oppositePlacement = item.placement === 'top' ? 'bottom' : 'top';
|
|
125
|
+
const oppositeToasts = toastsRef.current.filter(t => t.placement === oppositePlacement);
|
|
126
|
+
if (oppositeToasts.length > 0) {
|
|
127
|
+
for (const t of oppositeToasts) {
|
|
128
|
+
clearToastTimeout(t.id);
|
|
129
|
+
t.onHide?.();
|
|
130
|
+
}
|
|
131
|
+
toastsRef.current = toastsRef.current.filter(t => t.placement !== oppositePlacement);
|
|
132
|
+
dispatch({
|
|
133
|
+
type: 'hidePlacement',
|
|
134
|
+
placement: oppositePlacement
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
clearToastTimeout(item.id);
|
|
138
|
+
toastsRef.current = [...toastsRef.current.filter(toast => toast.id !== item.id), item];
|
|
139
|
+
dispatch({
|
|
140
|
+
type: 'show',
|
|
141
|
+
item
|
|
142
|
+
});
|
|
143
|
+
if (typeof options === 'object' && options !== null && 'onShow' in options) {
|
|
144
|
+
options.onShow?.();
|
|
145
|
+
}
|
|
146
|
+
if (item.duration !== 'persistent' && Number.isFinite(item.duration) && item.duration > 0) {
|
|
147
|
+
const timeout = setTimeout(() => hide(item.id), item.duration);
|
|
148
|
+
timeoutsRef.current.set(item.id, timeout);
|
|
149
|
+
}
|
|
150
|
+
return item.id;
|
|
151
|
+
}, [clearToastTimeout, defaultDuration, defaultPlacement, hide]);
|
|
152
|
+
const manager = useMemo(() => ({
|
|
153
|
+
show,
|
|
154
|
+
hide
|
|
155
|
+
}), [show, hide]);
|
|
156
|
+
managerRef.current = manager;
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
setToastManager(manager);
|
|
159
|
+
return () => {
|
|
160
|
+
setToastManager(null);
|
|
161
|
+
for (const timeout of timeoutsRef.current.values()) {
|
|
162
|
+
clearTimeout(timeout);
|
|
163
|
+
}
|
|
164
|
+
timeoutsRef.current.clear();
|
|
165
|
+
};
|
|
166
|
+
}, [manager]);
|
|
167
|
+
const topToasts = toasts.filter(toast => toast.placement === 'top');
|
|
168
|
+
const bottomToasts = toasts.filter(toast => toast.placement === 'bottom');
|
|
169
|
+
return /*#__PURE__*/_jsxs(ToastManagerContext.Provider, {
|
|
170
|
+
value: manager,
|
|
171
|
+
children: [children, /*#__PURE__*/_jsx(ToastViewport, {
|
|
172
|
+
placement: "top",
|
|
173
|
+
toasts: topToasts,
|
|
174
|
+
manager: manager,
|
|
175
|
+
maxVisibleToasts: maxVisibleToasts,
|
|
176
|
+
offset: offset
|
|
177
|
+
}), /*#__PURE__*/_jsx(ToastViewport, {
|
|
178
|
+
placement: "bottom",
|
|
179
|
+
toasts: bottomToasts,
|
|
180
|
+
manager: manager,
|
|
181
|
+
maxVisibleToasts: maxVisibleToasts,
|
|
182
|
+
offset: offset
|
|
183
|
+
})]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function ToastViewport({
|
|
187
|
+
placement,
|
|
188
|
+
toasts,
|
|
189
|
+
manager,
|
|
190
|
+
maxVisibleToasts,
|
|
191
|
+
offset
|
|
192
|
+
}) {
|
|
193
|
+
const safeAreaInsets = useSafeAreaInsets();
|
|
194
|
+
const heights = useSharedValue({});
|
|
195
|
+
const total = useSharedValue(0);
|
|
196
|
+
const keyboardHeight = useSharedValue(0);
|
|
197
|
+
const baseBottom = offset?.bottom ?? safeAreaInsets.bottom + (Platform.OS === 'ios' ? 6 : 12);
|
|
198
|
+
const baseTop = offset?.top ?? safeAreaInsets.top + (Platform.OS === 'ios' ? 0 : 12);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
if (placement !== 'bottom') return;
|
|
201
|
+
const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
|
|
202
|
+
const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
|
|
203
|
+
const showSub = Keyboard.addListener(showEvent, e => {
|
|
204
|
+
keyboardHeight.value = withTiming(e.endCoordinates.height);
|
|
205
|
+
});
|
|
206
|
+
const hideSub = Keyboard.addListener(hideEvent, () => {
|
|
207
|
+
keyboardHeight.value = withTiming(0);
|
|
208
|
+
});
|
|
209
|
+
return () => {
|
|
210
|
+
showSub.remove();
|
|
211
|
+
hideSub.remove();
|
|
212
|
+
};
|
|
213
|
+
}, [keyboardHeight, placement]);
|
|
214
|
+
const gap = Platform.OS === 'ios' ? 6 : 12;
|
|
215
|
+
const keyboardStyle = useAnimatedStyle(() => {
|
|
216
|
+
if (placement === 'top') return {
|
|
217
|
+
top: baseTop
|
|
218
|
+
};
|
|
219
|
+
if (keyboardHeight.value > 0) {
|
|
220
|
+
return {
|
|
221
|
+
bottom: keyboardHeight.value + gap
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
bottom: baseBottom
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
total.value = toasts.length;
|
|
230
|
+
const activeIds = new Set(toasts.map(toast => toast.id));
|
|
231
|
+
const nextHeights = {};
|
|
232
|
+
for (const [id, height] of Object.entries(heights.value)) {
|
|
233
|
+
if (activeIds.has(id)) {
|
|
234
|
+
nextHeights[id] = height;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
heights.value = nextHeights;
|
|
238
|
+
}, [heights, toasts, total]);
|
|
239
|
+
if (toasts.length === 0) return null;
|
|
240
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
241
|
+
pointerEvents: "box-none",
|
|
242
|
+
style: [{
|
|
243
|
+
position: 'absolute',
|
|
244
|
+
zIndex: 9999,
|
|
245
|
+
elevation: 9999,
|
|
246
|
+
left: offset?.left ?? safeAreaInsets.left + 12,
|
|
247
|
+
right: offset?.right ?? safeAreaInsets.right + 12
|
|
248
|
+
}, keyboardStyle],
|
|
249
|
+
children: toasts.map((toast, index) => /*#__PURE__*/_jsx(ToastAnimatedItem, {
|
|
250
|
+
heights: heights,
|
|
251
|
+
id: toast.id,
|
|
252
|
+
index: index,
|
|
253
|
+
maxVisibleToasts: maxVisibleToasts,
|
|
254
|
+
placement: placement,
|
|
255
|
+
total: total,
|
|
256
|
+
children: toast.component({
|
|
257
|
+
id: toast.id,
|
|
258
|
+
index,
|
|
259
|
+
hide: manager.hide,
|
|
260
|
+
show: manager.show
|
|
261
|
+
})
|
|
262
|
+
}, toast.id))
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
export function useToast() {
|
|
266
|
+
const manager = useContext(ToastManagerContext);
|
|
267
|
+
if (!manager) {
|
|
268
|
+
throw new Error('useToast must be used within <TerraUIProvider>.');
|
|
269
|
+
}
|
|
270
|
+
return manager;
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=ToastProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useCallback","useContext","useEffect","useMemo","useReducer","useRef","Keyboard","Platform","Animated","useAnimatedStyle","useSharedValue","withTiming","useSafeAreaInsets","ToastAnimatedItem","DefaultToast","setToastManager","jsx","_jsx","jsxs","_jsxs","DEFAULT_DURATION","DEFAULT_MAX_VISIBLE_TOASTS","ToastManagerContext","toastReducer","state","action","type","filter","toast","id","item","ids","some","placement","createDefaultToastComponent","config","manager","hide","toastId","String","variant","label","description","icon","actionLabel","showCloseButton","onActionPress","isCustomToast","options","normalizePlacement","fallback","normalizeDuration","duration","counter","Date","now","ToastProvider","children","defaultPlacement","defaultDuration","maxVisibleToasts","offset","toasts","dispatch","toastsRef","counterRef","timeoutsRef","Map","current","clearToastTimeout","timeout","get","clearTimeout","delete","onHide","lastToastId","length","undefined","Array","isArray","find","managerRef","show","nextId","component","oppositePlacement","oppositeToasts","t","onShow","Number","isFinite","setTimeout","set","values","clear","topToasts","bottomToasts","Provider","value","ToastViewport","safeAreaInsets","heights","total","keyboardHeight","baseBottom","bottom","OS","baseTop","top","showEvent","hideEvent","showSub","addListener","e","endCoordinates","height","hideSub","remove","gap","keyboardStyle","activeIds","Set","map","nextHeights","Object","entries","has","View","pointerEvents","style","position","zIndex","elevation","left","right","index","useToast","Error"],"sourceRoot":"../../../../src","sources":["components/toast/ToastProvider.tsx"],"mappings":";;AAAA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,UAAU,EACVC,MAAM,QACD,OAAO;AACd,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,cAAc;AAEjD,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,Q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Z0G,KAAK;QACLlG,IAAI,EAAED,OAAO,CAACC,IAAI;QAClB6C,IAAI,EAAE9C,OAAO,CAAC8C;MAChB,CAAC;IAAC,GAbGtD,KAAK,CAACC,EAcM,CACpB;EAAC,CACW,CAAC;AAEpB;AAEA,OAAO,SAAS2G,QAAQA,CAAA,EAAiB;EACvC,MAAMpG,OAAO,GAAGnC,UAAU,CAACqB,mBAAmB,CAAC;EAC/C,IAAI,CAACc,OAAO,EAAE;IACZ,MAAM,IAAIqG,KAAK,CAAC,iDAAiD,CAAC;EACpE;EACA,OAAOrG,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DefaultToast","Toast","ToastProvider","useToast"],"sourceRoot":"../../../../src","sources":["components/toast/index.ts"],"mappings":";;AAWA,SAASA,YAAY,EAAEC,KAAK,QAAQ,YAAS;AAC7C,SAASC,aAAa,EAAEC,QAAQ,QAAQ,oBAAiB","ignoreList":[]}
|