react-native-terra-ui 0.5.1 → 0.7.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/CHANGELOG.md +86 -0
- package/lib/module/components/avatar/Avatar.js +60 -60
- package/lib/module/components/avatar/Avatar.js.map +1 -1
- package/lib/module/components/box/Box.js +2 -2
- package/lib/module/components/box/Box.js.map +1 -1
- package/lib/module/components/box/utils.js +19 -19
- package/lib/module/components/box/utils.js.map +1 -1
- package/lib/module/components/button/Button.js +54 -48
- package/lib/module/components/button/Button.js.map +1 -1
- package/lib/module/components/chip/Chip.js +94 -94
- package/lib/module/components/chip/Chip.js.map +1 -1
- package/lib/module/components/chip/utils.js +3 -3
- package/lib/module/components/empty-state/EmptyState.js +40 -40
- package/lib/module/components/empty-state/EmptyState.js.map +1 -1
- package/lib/module/components/header/header-buttons.js +5 -5
- package/lib/module/components/header/header-buttons.js.map +1 -1
- package/lib/module/components/header/parts/HeaderGradientOverlay.js +82 -12
- package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -1
- package/lib/module/components/header/variants/LargeTitleHeader/index.js +64 -60
- package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
- package/lib/module/components/header/variants/TitleHeader/index.js +33 -29
- package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
- package/lib/module/components/icon/Icon.js +6 -6
- package/lib/module/components/icon/Icon.js.map +1 -1
- package/lib/module/components/image/Image.js +6 -6
- package/lib/module/components/image/Image.js.map +1 -1
- package/lib/module/components/page-indicator/PageIndicator.js +1 -1
- package/lib/module/components/page-indicator/PageIndicatorRoot.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js +8 -8
- package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-core.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js +6 -6
- package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js.map +1 -1
- package/lib/module/components/page-indicator/utils.js +8 -8
- package/lib/module/components/page-indicator/utils.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js +2 -2
- package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js +9 -9
- package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js +2 -2
- package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js +3 -3
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/utils.js +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/utils.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js +5 -5
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/utils.js +3 -3
- package/lib/module/components/portal/Portal.js +1 -1
- package/lib/module/components/portal/PortalContext.js +1 -1
- package/lib/module/components/portal/PortalHost.js +1 -1
- package/lib/module/components/portal/PortalProvider.js +1 -1
- package/lib/module/components/portal/PortalProvider.js.map +1 -1
- package/lib/module/components/screen/Screen.js +8 -8
- package/lib/module/components/screen/Screen.js.map +1 -1
- package/lib/module/components/screen/ScreenContext.js +6 -6
- package/lib/module/components/screen/ScreenContext.js.map +1 -1
- package/lib/module/components/screen/ScreenFlatList.js +3 -3
- package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
- package/lib/module/components/screen/ScreenList.js +5 -5
- package/lib/module/components/screen/ScreenList.js.map +1 -1
- package/lib/module/components/screen/ScreenScrollView.js +6 -6
- package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
- package/lib/module/components/screen/parts/BottomSafeArea.js +1 -1
- package/lib/module/components/screen/parts/BottomSafeArea.js.map +1 -1
- package/lib/module/components/screen/parts/ScreenPlaceholder.js +3 -3
- package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -1
- package/lib/module/components/screen/utils.js +3 -3
- package/lib/module/components/screen/utils.js.map +1 -1
- package/lib/module/components/slot/Slot.js +2 -2
- package/lib/module/components/slot/Slot.js.map +1 -1
- package/lib/module/components/slot/utils.js +3 -3
- package/lib/module/components/slot/utils.js.map +1 -1
- package/lib/module/components/spinner/Spinner.js +10 -10
- package/lib/module/components/spinner/Spinner.js.map +1 -1
- package/lib/module/components/surface/Surface.js +14 -14
- package/lib/module/components/surface/Surface.js.map +1 -1
- package/lib/module/components/text/Text.js +13 -13
- package/lib/module/components/text/Text.js.map +1 -1
- package/lib/module/components/toast/Toast.js +46 -46
- package/lib/module/components/toast/Toast.js.map +1 -1
- package/lib/module/components/toast/ToastProvider.js +32 -32
- package/lib/module/components/toast/ToastProvider.js.map +1 -1
- package/lib/module/components/toast/parts/ToastAnimatedItem.js +10 -10
- package/lib/module/components/toast/parts/ToastAnimatedItem.js.map +1 -1
- package/lib/module/components/toast/utils/controller.js +2 -2
- package/lib/module/components/toast/utils/controller.js.map +1 -1
- package/lib/module/components/toolbar/Toolbar.js +103 -33
- package/lib/module/components/toolbar/Toolbar.js.map +1 -1
- package/lib/module/context/ThemeProvider.js +5 -5
- package/lib/module/context/ThemeProvider.js.map +1 -1
- package/lib/module/theme/breakpoints.js.map +1 -1
- package/lib/module/theme/defaults/icons.js +11 -11
- package/lib/module/theme/defaults/icons.js.map +1 -1
- package/lib/module/theme/defaults/image.js +7 -7
- package/lib/module/theme/defaults/image.js.map +1 -1
- package/lib/module/theme/registry.js +11 -11
- package/lib/module/theme/registry.js.map +1 -1
- package/lib/module/theme/runtime.js +3 -3
- package/lib/module/theme/runtime.js.map +1 -1
- package/lib/module/theme/theme.js +9 -9
- package/lib/module/theme/theme.js.map +1 -1
- package/lib/module/theme/tokens/dark.js +67 -67
- package/lib/module/theme/tokens/dark.js.map +1 -1
- package/lib/module/theme/tokens/light.js +67 -67
- package/lib/module/theme/tokens/primitives.js +417 -417
- package/lib/module/utils/accent-utils.js +16 -16
- package/lib/module/utils/accent-utils.js.map +1 -1
- package/lib/module/utils/color-utils.js +3 -3
- package/lib/module/utils/deep-merge.js +1 -1
- package/lib/module/utils/resolve-theme-color.js +2 -2
- package/lib/module/utils/resolve-theme-color.js.map +1 -1
- package/lib/module/utils/typography.js +5 -5
- package/lib/module/utils/typography.js.map +1 -1
- package/lib/module/utils/unflatten.js +2 -2
- package/lib/typescript/src/components/avatar/Avatar.d.ts +1 -1
- package/lib/typescript/src/components/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/src/components/avatar/index.d.ts +2 -2
- package/lib/typescript/src/components/avatar/types.d.ts +7 -7
- package/lib/typescript/src/components/avatar/types.d.ts.map +1 -1
- package/lib/typescript/src/components/box/Box.d.ts +2 -2
- package/lib/typescript/src/components/box/Box.d.ts.map +1 -1
- package/lib/typescript/src/components/box/index.d.ts +3 -3
- package/lib/typescript/src/components/box/utils.d.ts +7 -7
- package/lib/typescript/src/components/box/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/button/Button.d.ts +15 -8
- package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +2 -2
- package/lib/typescript/src/components/chip/Chip.d.ts +5 -5
- package/lib/typescript/src/components/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/index.d.ts +3 -3
- package/lib/typescript/src/components/chip/types.d.ts +3 -3
- package/lib/typescript/src/components/chip/utils.d.ts +1 -1
- package/lib/typescript/src/components/empty-state/EmptyState.d.ts +5 -5
- package/lib/typescript/src/components/empty-state/EmptyState.d.ts.map +1 -1
- package/lib/typescript/src/components/empty-state/index.d.ts +3 -3
- package/lib/typescript/src/components/empty-state/types.d.ts +1 -1
- package/lib/typescript/src/components/header/Header.d.ts +2 -2
- package/lib/typescript/src/components/header/header-buttons.d.ts +3 -3
- package/lib/typescript/src/components/header/header-buttons.d.ts.map +1 -1
- package/lib/typescript/src/components/header/index.d.ts +6 -6
- package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts +19 -2
- package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts.map +1 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +1 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +4 -4
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/icon/Icon.d.ts +3 -3
- package/lib/typescript/src/components/icon/Icon.d.ts.map +1 -1
- package/lib/typescript/src/components/icon/index.d.ts +2 -2
- package/lib/typescript/src/components/image/Image.d.ts +1 -1
- package/lib/typescript/src/components/image/Image.d.ts.map +1 -1
- package/lib/typescript/src/components/image/index.d.ts +2 -2
- package/lib/typescript/src/components/image/types.d.ts +1 -1
- package/lib/typescript/src/components/index.d.ts +17 -17
- package/lib/typescript/src/components/page-indicator/PageIndicator.d.ts +10 -10
- package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/utils.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/utils.d.ts +1 -1
- package/lib/typescript/src/components/portal/Portal.d.ts +3 -3
- package/lib/typescript/src/components/portal/PortalContext.d.ts +1 -1
- package/lib/typescript/src/components/portal/PortalHost.d.ts +2 -2
- package/lib/typescript/src/components/portal/PortalProvider.d.ts +1 -1
- package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/portal/index.d.ts +7 -7
- package/lib/typescript/src/components/screen/Screen.d.ts +10 -10
- package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenContext.d.ts +3 -3
- package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +3 -3
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenList.d.ts +5 -5
- package/lib/typescript/src/components/screen/ScreenList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +5 -5
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/index.d.ts +11 -11
- package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +3 -3
- package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/types.d.ts +2 -2
- package/lib/typescript/src/components/screen/utils.d.ts +2 -2
- package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/slot/Slot.d.ts +2 -2
- package/lib/typescript/src/components/slot/Slot.d.ts.map +1 -1
- package/lib/typescript/src/components/slot/index.d.ts +3 -3
- package/lib/typescript/src/components/slot/utils.d.ts +1 -1
- package/lib/typescript/src/components/slot/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/spinner/Spinner.d.ts +2 -2
- package/lib/typescript/src/components/spinner/Spinner.d.ts.map +1 -1
- package/lib/typescript/src/components/spinner/index.d.ts +2 -2
- package/lib/typescript/src/components/surface/Surface.d.ts +4 -4
- package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -1
- package/lib/typescript/src/components/surface/index.d.ts +2 -2
- package/lib/typescript/src/components/text/Text.d.ts +4 -4
- package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
- package/lib/typescript/src/components/text/index.d.ts +2 -2
- package/lib/typescript/src/components/toast/Toast.d.ts +18 -18
- package/lib/typescript/src/components/toast/Toast.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/ToastProvider.d.ts +1 -1
- package/lib/typescript/src/components/toast/ToastProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/index.d.ts +4 -4
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts +3 -3
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/types.d.ts +10 -10
- package/lib/typescript/src/components/toast/types.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/utils/controller.d.ts +2 -2
- package/lib/typescript/src/components/toast/utils/controller.d.ts.map +1 -1
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts +5 -5
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/typescript/src/components/toolbar/index.d.ts +2 -2
- package/lib/typescript/src/context/ThemeProvider.d.ts +3 -3
- package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/context/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts +3 -3
- package/lib/typescript/src/theme/breakpoints.d.ts +2 -2
- package/lib/typescript/src/theme/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/theme/defaults/icons.d.ts +1 -1
- package/lib/typescript/src/theme/defaults/icons.d.ts.map +1 -1
- package/lib/typescript/src/theme/defaults/image.d.ts +1 -1
- package/lib/typescript/src/theme/defaults/image.d.ts.map +1 -1
- package/lib/typescript/src/theme/index.d.ts +14 -14
- package/lib/typescript/src/theme/registry.d.ts +2 -2
- package/lib/typescript/src/theme/registry.d.ts.map +1 -1
- package/lib/typescript/src/theme/runtime.d.ts +1 -1
- package/lib/typescript/src/theme/runtime.d.ts.map +1 -1
- package/lib/typescript/src/theme/screen-margin.d.ts +2 -2
- package/lib/typescript/src/theme/theme.d.ts +2 -2
- package/lib/typescript/src/theme/theme.d.ts.map +1 -1
- package/lib/typescript/src/theme/tokens/dark.d.ts +67 -67
- package/lib/typescript/src/theme/tokens/light.d.ts +67 -67
- package/lib/typescript/src/theme/tokens/primitives.d.ts +417 -417
- package/lib/typescript/src/theme/types.d.ts +84 -84
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/accent-utils.d.ts +1 -1
- package/lib/typescript/src/utils/accent-utils.d.ts.map +1 -1
- package/lib/typescript/src/utils/resolve-theme-color.d.ts +1 -1
- package/lib/typescript/src/utils/resolve-theme-color.d.ts.map +1 -1
- package/lib/typescript/src/utils/typography.d.ts +2 -2
- package/lib/typescript/src/utils/typography.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/avatar/Avatar.tsx +66 -71
- package/src/components/avatar/index.ts +2 -2
- package/src/components/avatar/types.ts +7 -12
- package/src/components/box/Box.tsx +7 -18
- package/src/components/box/index.ts +3 -3
- package/src/components/box/utils.ts +59 -81
- package/src/components/button/Button.tsx +119 -144
- package/src/components/button/index.ts +2 -2
- package/src/components/chip/Chip.tsx +107 -143
- package/src/components/chip/index.ts +3 -3
- package/src/components/chip/types.ts +7 -7
- package/src/components/chip/utils.ts +5 -5
- package/src/components/empty-state/EmptyState.tsx +44 -60
- package/src/components/empty-state/index.ts +3 -3
- package/src/components/empty-state/types.ts +1 -1
- package/src/components/header/Header.ts +2 -2
- package/src/components/header/header-buttons.tsx +10 -18
- package/src/components/header/index.ts +6 -6
- package/src/components/header/parts/HeaderGradientOverlay.tsx +77 -11
- package/src/components/header/variants/LargeTitleHeader/index.tsx +79 -142
- package/src/components/header/variants/TitleHeader/index.tsx +45 -63
- package/src/components/icon/Icon.tsx +31 -39
- package/src/components/icon/index.ts +2 -2
- package/src/components/image/Image.tsx +12 -10
- package/src/components/image/index.ts +2 -2
- package/src/components/image/types.ts +1 -1
- package/src/components/index.ts +17 -17
- package/src/components/page-indicator/PageIndicator.tsx +14 -14
- package/src/components/page-indicator/PageIndicatorRoot.tsx +4 -12
- package/src/components/page-indicator/hooks/use-page-indicator-colors.ts +17 -35
- package/src/components/page-indicator/hooks/use-page-indicator-core.ts +6 -8
- package/src/components/page-indicator/hooks/use-page-indicator-progress.ts +10 -30
- package/src/components/page-indicator/index.ts +3 -3
- package/src/components/page-indicator/utils.ts +20 -48
- package/src/components/page-indicator/variants/DotIndicator/InactiveDot.tsx +5 -16
- package/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.tsx +21 -63
- package/src/components/page-indicator/variants/DotIndicator/TravelingPill.tsx +6 -16
- package/src/components/page-indicator/variants/DotIndicator/index.tsx +20 -38
- package/src/components/page-indicator/variants/DotIndicator/utils.ts +2 -6
- package/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.tsx +12 -50
- package/src/components/page-indicator/variants/PillIndicator/index.tsx +19 -41
- package/src/components/page-indicator/variants/PillIndicator/utils.ts +4 -4
- package/src/components/portal/Portal.tsx +4 -4
- package/src/components/portal/PortalContext.tsx +1 -1
- package/src/components/portal/PortalHost.tsx +4 -4
- package/src/components/portal/PortalProvider.tsx +24 -35
- package/src/components/portal/index.ts +7 -7
- package/src/components/screen/Screen.tsx +45 -52
- package/src/components/screen/ScreenContext.tsx +8 -17
- package/src/components/screen/ScreenFlatList.tsx +17 -36
- package/src/components/screen/ScreenList.tsx +31 -63
- package/src/components/screen/ScreenScrollView.tsx +17 -30
- package/src/components/screen/index.ts +11 -11
- package/src/components/screen/parts/BottomSafeArea.tsx +5 -6
- package/src/components/screen/parts/ScreenPlaceholder.tsx +9 -14
- package/src/components/screen/types.ts +2 -2
- package/src/components/screen/utils.ts +6 -19
- package/src/components/slot/Slot.tsx +5 -20
- package/src/components/slot/index.ts +3 -3
- package/src/components/slot/utils.ts +5 -8
- package/src/components/spinner/Spinner.tsx +19 -52
- package/src/components/spinner/index.ts +2 -2
- package/src/components/surface/Surface.tsx +34 -43
- package/src/components/surface/index.ts +2 -2
- package/src/components/text/Text.tsx +75 -85
- package/src/components/text/index.ts +2 -2
- package/src/components/toast/Toast.tsx +195 -251
- package/src/components/toast/ToastProvider.tsx +61 -136
- package/src/components/toast/index.ts +4 -4
- package/src/components/toast/parts/ToastAnimatedItem.tsx +14 -22
- package/src/components/toast/types.ts +11 -14
- package/src/components/toast/utils/controller.ts +4 -6
- package/src/components/toolbar/Toolbar.tsx +117 -72
- package/src/components/toolbar/index.ts +2 -2
- package/src/context/ThemeProvider.tsx +13 -28
- package/src/context/index.ts +2 -2
- package/src/index.tsx +3 -3
- package/src/theme/breakpoints.ts +3 -5
- package/src/theme/defaults/icons.tsx +15 -30
- package/src/theme/defaults/image.tsx +9 -14
- package/src/theme/index.ts +14 -14
- package/src/theme/registry.ts +30 -49
- package/src/theme/runtime.ts +6 -7
- package/src/theme/screen-margin.ts +3 -3
- package/src/theme/theme.ts +39 -60
- package/src/theme/tokens/dark.ts +67 -67
- package/src/theme/tokens/light.ts +67 -67
- package/src/theme/tokens/primitives.ts +417 -417
- package/src/theme/types.ts +123 -135
- package/src/utils/accent-utils.ts +21 -30
- package/src/utils/color-utils.ts +3 -3
- package/src/utils/deep-merge.ts +1 -1
- package/src/utils/resolve-theme-color.ts +8 -11
- package/src/utils/typography.ts +7 -10
- package/src/utils/unflatten.ts +2 -2
|
@@ -6,29 +6,22 @@ import {
|
|
|
6
6
|
useContext,
|
|
7
7
|
useId,
|
|
8
8
|
useMemo,
|
|
9
|
-
} from
|
|
10
|
-
import type { GestureResponderEvent, PressableProps, View } from
|
|
11
|
-
import { Pressable, StyleSheet } from
|
|
12
|
-
|
|
13
|
-
import { useUnistyles } from
|
|
14
|
-
|
|
15
|
-
import type { TerraIconName, TerraTheme } from
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export type ToastVariant =
|
|
26
|
-
| 'default'
|
|
27
|
-
| 'accent'
|
|
28
|
-
| 'info'
|
|
29
|
-
| 'success'
|
|
30
|
-
| 'warning'
|
|
31
|
-
| 'danger';
|
|
9
|
+
} from "react";
|
|
10
|
+
import type { GestureResponderEvent, PressableProps, View } from "react-native";
|
|
11
|
+
import { Pressable, StyleSheet } from "react-native";
|
|
12
|
+
|
|
13
|
+
import { useUnistyles } from "react-native-unistyles";
|
|
14
|
+
|
|
15
|
+
import type { TerraIconName, TerraTheme } from "#theme/types";
|
|
16
|
+
import { Box } from "../box";
|
|
17
|
+
import { Button, type ButtonProps } from "../button";
|
|
18
|
+
import { Icon, type IconProps } from "../icon";
|
|
19
|
+
import { Surface, type SurfaceProps } from "../surface";
|
|
20
|
+
import { Text, type TextProps } from "../text";
|
|
21
|
+
import type { ToastId as StackToastId, ToastShowOptions } from "./types";
|
|
22
|
+
import { hideToast, showToast } from "./utils/controller";
|
|
23
|
+
|
|
24
|
+
export type ToastVariant = "default" | "accent" | "info" | "success" | "warning" | "danger";
|
|
32
25
|
|
|
33
26
|
type ToastInstanceId = string | number;
|
|
34
27
|
|
|
@@ -48,9 +41,7 @@ const ToastContext = createContext<ToastContextValue | null>(null);
|
|
|
48
41
|
function useToastContext(): ToastContextValue {
|
|
49
42
|
const context = useContext(ToastContext);
|
|
50
43
|
if (!context) {
|
|
51
|
-
throw new Error(
|
|
52
|
-
'Toast compound components must be rendered inside <Toast>.'
|
|
53
|
-
);
|
|
44
|
+
throw new Error("Toast compound components must be rendered inside <Toast>.");
|
|
54
45
|
}
|
|
55
46
|
return context;
|
|
56
47
|
}
|
|
@@ -67,26 +58,26 @@ interface ToastColors {
|
|
|
67
58
|
|
|
68
59
|
function getToastColors(variant: ToastVariant, theme: TerraTheme): ToastColors {
|
|
69
60
|
const c = theme.color as unknown as Record<string, string | undefined>;
|
|
70
|
-
const get = (key: string): string => c[key] ??
|
|
61
|
+
const get = (key: string): string => c[key] ?? "";
|
|
71
62
|
const base = {
|
|
72
|
-
bg: get(
|
|
73
|
-
border: get(
|
|
74
|
-
description: get(
|
|
63
|
+
bg: get("surface.default"),
|
|
64
|
+
border: get("border.subtle"),
|
|
65
|
+
description: get("text.muted"),
|
|
75
66
|
};
|
|
76
67
|
|
|
77
68
|
switch (variant) {
|
|
78
|
-
case
|
|
69
|
+
case "accent":
|
|
79
70
|
return {
|
|
80
71
|
...base,
|
|
81
|
-
title: get(
|
|
82
|
-
icon: get(
|
|
83
|
-
actionBg: get(
|
|
84
|
-
actionFg: get(
|
|
72
|
+
title: get("action.fg.primary.subtle"),
|
|
73
|
+
icon: get("text.accent"),
|
|
74
|
+
actionBg: get("action.bg.primary"),
|
|
75
|
+
actionFg: get("action.fg.primary"),
|
|
85
76
|
};
|
|
86
|
-
case
|
|
87
|
-
case
|
|
88
|
-
case
|
|
89
|
-
case
|
|
77
|
+
case "info":
|
|
78
|
+
case "success":
|
|
79
|
+
case "warning":
|
|
80
|
+
case "danger":
|
|
90
81
|
return {
|
|
91
82
|
...base,
|
|
92
83
|
title: get(`status.${variant}.bg`),
|
|
@@ -94,18 +85,18 @@ function getToastColors(variant: ToastVariant, theme: TerraTheme): ToastColors {
|
|
|
94
85
|
actionBg: get(`status.${variant}.bg`),
|
|
95
86
|
actionFg: get(`status.${variant}.fg`),
|
|
96
87
|
};
|
|
97
|
-
case
|
|
88
|
+
case "default":
|
|
98
89
|
return {
|
|
99
90
|
...base,
|
|
100
|
-
title: get(
|
|
101
|
-
icon: get(
|
|
102
|
-
actionBg: get(
|
|
103
|
-
actionFg: get(
|
|
91
|
+
title: get("text.default"),
|
|
92
|
+
icon: get("text.subtle"),
|
|
93
|
+
actionBg: get("action.bg.secondary"),
|
|
94
|
+
actionFg: get("action.fg.secondary"),
|
|
104
95
|
};
|
|
105
96
|
}
|
|
106
97
|
}
|
|
107
98
|
|
|
108
|
-
export interface ToastProps extends Omit<SurfaceProps,
|
|
99
|
+
export interface ToastProps extends Omit<SurfaceProps, "id" | "variant"> {
|
|
109
100
|
/** Visual tone for the toast. Defaults to `default`. */
|
|
110
101
|
variant?: ToastVariant;
|
|
111
102
|
/** Optional identifier passed back to `hide` when `Toast.Close` is pressed. */
|
|
@@ -116,101 +107,64 @@ export interface ToastProps extends Omit<SurfaceProps, 'id' | 'variant'> {
|
|
|
116
107
|
onClose?: () => void;
|
|
117
108
|
}
|
|
118
109
|
|
|
119
|
-
const ToastRoot = forwardRef<ComponentRef<typeof View>, ToastProps>(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
return (
|
|
144
|
-
<ToastContext.Provider value={contextValue}>
|
|
145
|
-
<Surface
|
|
146
|
-
ref={ref}
|
|
147
|
-
variant="raised"
|
|
148
|
-
elevation="md"
|
|
149
|
-
radius="xl"
|
|
150
|
-
p="4"
|
|
151
|
-
row
|
|
152
|
-
align="center"
|
|
153
|
-
gap="2"
|
|
154
|
-
accessibilityRole={accessibilityRole}
|
|
155
|
-
accessibilityLiveRegion="polite"
|
|
156
|
-
borderWidth="hairline"
|
|
157
|
-
nativeID={nativeID}
|
|
158
|
-
style={[
|
|
159
|
-
styles.root,
|
|
160
|
-
{
|
|
161
|
-
backgroundColor: colors.bg,
|
|
162
|
-
borderColor: colors.border,
|
|
163
|
-
},
|
|
164
|
-
style,
|
|
165
|
-
]}
|
|
166
|
-
{...rest}
|
|
167
|
-
>
|
|
168
|
-
{children}
|
|
169
|
-
</Surface>
|
|
170
|
-
</ToastContext.Provider>
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
export interface ToastTitleProps extends TextProps {}
|
|
176
|
-
|
|
177
|
-
const ToastTitle = forwardRef<ComponentRef<typeof Text>, ToastTitleProps>(
|
|
178
|
-
function ToastTitle(
|
|
179
|
-
{
|
|
180
|
-
accessibilityRole = 'header',
|
|
181
|
-
color,
|
|
182
|
-
nativeID,
|
|
183
|
-
variant = 'label-lg',
|
|
184
|
-
weight,
|
|
185
|
-
...rest
|
|
186
|
-
},
|
|
187
|
-
ref
|
|
188
|
-
) {
|
|
189
|
-
const { theme } = useUnistyles();
|
|
190
|
-
const { nativeID: rootNativeID, variant: toastVariant } = useToastContext();
|
|
191
|
-
const colors = getToastColors(toastVariant, theme);
|
|
110
|
+
const ToastRoot = forwardRef<ComponentRef<typeof View>, ToastProps>(function Toast(
|
|
111
|
+
{
|
|
112
|
+
variant = "default",
|
|
113
|
+
id,
|
|
114
|
+
hide,
|
|
115
|
+
onClose,
|
|
116
|
+
children,
|
|
117
|
+
nativeID: nativeIDProp,
|
|
118
|
+
style,
|
|
119
|
+
accessibilityRole = "alert",
|
|
120
|
+
...rest
|
|
121
|
+
},
|
|
122
|
+
ref
|
|
123
|
+
) {
|
|
124
|
+
const { theme } = useUnistyles();
|
|
125
|
+
const generatedNativeID = useId();
|
|
126
|
+
const nativeID = nativeIDProp ?? String(id ?? generatedNativeID);
|
|
127
|
+
const colors = getToastColors(variant, theme);
|
|
128
|
+
const contextValue = useMemo<ToastContextValue>(
|
|
129
|
+
() => ({ nativeID, variant, id, hide, onClose }),
|
|
130
|
+
[nativeID, variant, id, hide, onClose]
|
|
131
|
+
);
|
|
192
132
|
|
|
193
|
-
|
|
194
|
-
|
|
133
|
+
return (
|
|
134
|
+
<ToastContext.Provider value={contextValue}>
|
|
135
|
+
<Surface
|
|
195
136
|
ref={ref}
|
|
137
|
+
variant="raised"
|
|
138
|
+
elevation="md"
|
|
139
|
+
radius="xl"
|
|
140
|
+
p="4"
|
|
141
|
+
row
|
|
142
|
+
align="center"
|
|
143
|
+
gap="2"
|
|
196
144
|
accessibilityRole={accessibilityRole}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
145
|
+
accessibilityLiveRegion="polite"
|
|
146
|
+
borderWidth="hairline"
|
|
147
|
+
nativeID={nativeID}
|
|
148
|
+
style={[
|
|
149
|
+
styles.root,
|
|
150
|
+
{
|
|
151
|
+
backgroundColor: colors.bg,
|
|
152
|
+
borderColor: colors.border,
|
|
153
|
+
},
|
|
154
|
+
style,
|
|
155
|
+
]}
|
|
201
156
|
{...rest}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
157
|
+
>
|
|
158
|
+
{children}
|
|
159
|
+
</Surface>
|
|
160
|
+
</ToastContext.Provider>
|
|
161
|
+
);
|
|
162
|
+
});
|
|
206
163
|
|
|
207
|
-
export interface
|
|
164
|
+
export interface ToastTitleProps extends TextProps {}
|
|
208
165
|
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
ToastDescriptionProps
|
|
212
|
-
>(function ToastDescription(
|
|
213
|
-
{ color, nativeID, variant = 'body-sm', ...rest },
|
|
166
|
+
const ToastTitle = forwardRef<ComponentRef<typeof Text>, ToastTitleProps>(function ToastTitle(
|
|
167
|
+
{ accessibilityRole = "header", color, nativeID, variant = "label-lg", weight, ...rest },
|
|
214
168
|
ref
|
|
215
169
|
) {
|
|
216
170
|
const { theme } = useUnistyles();
|
|
@@ -220,27 +174,48 @@ const ToastDescription = forwardRef<
|
|
|
220
174
|
return (
|
|
221
175
|
<Text
|
|
222
176
|
ref={ref}
|
|
223
|
-
|
|
224
|
-
|
|
177
|
+
accessibilityRole={accessibilityRole}
|
|
178
|
+
color={color ?? colors.title}
|
|
179
|
+
nativeID={nativeID ?? `${rootNativeID}_label`}
|
|
225
180
|
variant={variant}
|
|
181
|
+
weight={weight ?? "semibold"}
|
|
226
182
|
{...rest}
|
|
227
183
|
/>
|
|
228
184
|
);
|
|
229
185
|
});
|
|
230
186
|
|
|
231
|
-
export interface
|
|
232
|
-
|
|
187
|
+
export interface ToastDescriptionProps extends TextProps {}
|
|
188
|
+
|
|
189
|
+
const ToastDescription = forwardRef<ComponentRef<typeof Text>, ToastDescriptionProps>(
|
|
190
|
+
function ToastDescription({ color, nativeID, variant = "body-sm", ...rest }, ref) {
|
|
191
|
+
const { theme } = useUnistyles();
|
|
192
|
+
const { nativeID: rootNativeID, variant: toastVariant } = useToastContext();
|
|
193
|
+
const colors = getToastColors(toastVariant, theme);
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<Text
|
|
197
|
+
ref={ref}
|
|
198
|
+
color={color ?? colors.description}
|
|
199
|
+
nativeID={nativeID ?? `${rootNativeID}_desc`}
|
|
200
|
+
variant={variant}
|
|
201
|
+
{...rest}
|
|
202
|
+
/>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
export interface ToastActionProps extends Omit<PressableProps, "children" | "disabled" | "style"> {
|
|
233
208
|
children?: ReactNode;
|
|
234
209
|
/** Override the action button colour. Defaults to the parent Toast variant. */
|
|
235
210
|
variant?: ToastVariant;
|
|
236
211
|
fullWidth?: boolean;
|
|
237
212
|
isDisabled?: boolean;
|
|
238
|
-
size?:
|
|
239
|
-
style?: PressableProps[
|
|
213
|
+
size?: "sm" | "md" | "lg";
|
|
214
|
+
style?: PressableProps["style"];
|
|
240
215
|
}
|
|
241
216
|
|
|
242
217
|
function renderActionChildren(children: ReactNode, color: string): ReactNode {
|
|
243
|
-
if (typeof children ===
|
|
218
|
+
if (typeof children === "string" || typeof children === "number") {
|
|
244
219
|
return (
|
|
245
220
|
<Text variant="label-md" weight="semibold" style={{ color }}>
|
|
246
221
|
{children}
|
|
@@ -250,20 +225,8 @@ function renderActionChildren(children: ReactNode, color: string): ReactNode {
|
|
|
250
225
|
return children;
|
|
251
226
|
}
|
|
252
227
|
|
|
253
|
-
const ToastAction = forwardRef<
|
|
254
|
-
|
|
255
|
-
ToastActionProps
|
|
256
|
-
>(function ToastAction(
|
|
257
|
-
{
|
|
258
|
-
children,
|
|
259
|
-
variant,
|
|
260
|
-
fullWidth = false,
|
|
261
|
-
isDisabled = false,
|
|
262
|
-
size = 'sm',
|
|
263
|
-
style,
|
|
264
|
-
onPress,
|
|
265
|
-
...rest
|
|
266
|
-
},
|
|
228
|
+
const ToastAction = forwardRef<ComponentRef<typeof Pressable>, ToastActionProps>(function ToastAction(
|
|
229
|
+
{ children, variant, fullWidth = false, isDisabled = false, size = "sm", style, onPress, ...rest },
|
|
267
230
|
ref
|
|
268
231
|
) {
|
|
269
232
|
const { theme } = useUnistyles();
|
|
@@ -285,13 +248,9 @@ const ToastAction = forwardRef<
|
|
|
285
248
|
{
|
|
286
249
|
backgroundColor: colors.actionBg,
|
|
287
250
|
opacity:
|
|
288
|
-
state.pressed && !isDisabled
|
|
289
|
-
? theme.opacity.pressed
|
|
290
|
-
: isDisabled
|
|
291
|
-
? theme.opacity.disabled
|
|
292
|
-
: 1,
|
|
251
|
+
state.pressed && !isDisabled ? theme.opacity.pressed : isDisabled ? theme.opacity.disabled : 1,
|
|
293
252
|
},
|
|
294
|
-
typeof style ===
|
|
253
|
+
typeof style === "function" ? style(state) : style,
|
|
295
254
|
]}
|
|
296
255
|
>
|
|
297
256
|
{renderActionChildren(children, colors.actionFg)}
|
|
@@ -299,92 +258,83 @@ const ToastAction = forwardRef<
|
|
|
299
258
|
);
|
|
300
259
|
});
|
|
301
260
|
|
|
302
|
-
export interface ToastCloseProps extends Omit<ButtonProps,
|
|
261
|
+
export interface ToastCloseProps extends Omit<ButtonProps, "children"> {
|
|
303
262
|
children?: ReactNode;
|
|
304
|
-
iconProps?: Omit<IconProps,
|
|
263
|
+
iconProps?: Omit<IconProps, "name">;
|
|
305
264
|
}
|
|
306
265
|
|
|
307
|
-
const ToastClose = forwardRef<ComponentRef<typeof Button>, ToastCloseProps>(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
};
|
|
266
|
+
const ToastClose = forwardRef<ComponentRef<typeof Button>, ToastCloseProps>(function ToastClose(
|
|
267
|
+
{
|
|
268
|
+
children,
|
|
269
|
+
iconProps,
|
|
270
|
+
size = "sm",
|
|
271
|
+
fullWidth = false,
|
|
272
|
+
isIconOnly = true,
|
|
273
|
+
variant = "ghost",
|
|
274
|
+
accessibilityLabel = "Close",
|
|
275
|
+
onPress,
|
|
276
|
+
...rest
|
|
277
|
+
},
|
|
278
|
+
ref
|
|
279
|
+
) {
|
|
280
|
+
const { theme } = useUnistyles();
|
|
281
|
+
const { id, hide, onClose, variant: toastVariant } = useToastContext();
|
|
282
|
+
const colors = getToastColors(toastVariant, theme);
|
|
283
|
+
const handlePress = (event: GestureResponderEvent) => {
|
|
284
|
+
if (id !== undefined) hide?.(id);
|
|
285
|
+
onClose?.();
|
|
286
|
+
onPress?.(event);
|
|
287
|
+
};
|
|
330
288
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
);
|
|
289
|
+
return (
|
|
290
|
+
<Button
|
|
291
|
+
ref={ref}
|
|
292
|
+
accessibilityLabel={accessibilityLabel}
|
|
293
|
+
fullWidth={fullWidth}
|
|
294
|
+
isIconOnly={isIconOnly}
|
|
295
|
+
onPress={handlePress}
|
|
296
|
+
size={size}
|
|
297
|
+
compact
|
|
298
|
+
variant={variant}
|
|
299
|
+
{...rest}
|
|
300
|
+
>
|
|
301
|
+
{children ?? (
|
|
302
|
+
<Icon
|
|
303
|
+
name="navigation.close"
|
|
304
|
+
size={iconProps?.size ?? 20}
|
|
305
|
+
color={iconProps?.color ?? colors.icon}
|
|
306
|
+
strokeWidth={iconProps?.strokeWidth}
|
|
307
|
+
style={iconProps?.style}
|
|
308
|
+
/>
|
|
309
|
+
)}
|
|
310
|
+
</Button>
|
|
311
|
+
);
|
|
312
|
+
});
|
|
356
313
|
|
|
357
|
-
export interface ToastIconProps extends Omit<IconProps,
|
|
314
|
+
export interface ToastIconProps extends Omit<IconProps, "name"> {
|
|
358
315
|
name?: TerraIconName;
|
|
359
316
|
}
|
|
360
317
|
|
|
361
318
|
const VARIANT_ICON: Partial<Record<ToastVariant, TerraIconName>> = {
|
|
362
|
-
info:
|
|
363
|
-
success:
|
|
364
|
-
warning:
|
|
365
|
-
danger:
|
|
319
|
+
info: "status.info",
|
|
320
|
+
success: "status.success",
|
|
321
|
+
warning: "status.warning",
|
|
322
|
+
danger: "status.danger",
|
|
366
323
|
};
|
|
367
324
|
|
|
368
|
-
const ToastIcon = forwardRef<ComponentRef<typeof View>, ToastIconProps>(
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
325
|
+
const ToastIcon = forwardRef<ComponentRef<typeof View>, ToastIconProps>(function ToastIcon(
|
|
326
|
+
{ name, color, size = 20, ...rest },
|
|
327
|
+
ref
|
|
328
|
+
) {
|
|
329
|
+
const { theme } = useUnistyles();
|
|
330
|
+
const { variant } = useToastContext();
|
|
331
|
+
const colors = getToastColors(variant, theme);
|
|
332
|
+
const iconName = name ?? VARIANT_ICON[variant] ?? "status.info";
|
|
374
333
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
ref={ref}
|
|
378
|
-
color={color ?? colors.icon}
|
|
379
|
-
name={iconName}
|
|
380
|
-
size={size}
|
|
381
|
-
{...rest}
|
|
382
|
-
/>
|
|
383
|
-
);
|
|
384
|
-
}
|
|
385
|
-
);
|
|
334
|
+
return <Icon ref={ref} color={color ?? colors.icon} name={iconName} size={size} {...rest} />;
|
|
335
|
+
});
|
|
386
336
|
|
|
387
|
-
export interface DefaultToastProps extends Omit<ToastProps,
|
|
337
|
+
export interface DefaultToastProps extends Omit<ToastProps, "children"> {
|
|
388
338
|
label?: ReactNode;
|
|
389
339
|
description?: ReactNode;
|
|
390
340
|
actionLabel?: ReactNode;
|
|
@@ -402,28 +352,22 @@ export function DefaultToast({
|
|
|
402
352
|
showCloseButton,
|
|
403
353
|
id,
|
|
404
354
|
hide,
|
|
405
|
-
variant =
|
|
355
|
+
variant = "default",
|
|
406
356
|
...rest
|
|
407
357
|
}: DefaultToastProps) {
|
|
408
|
-
const shouldRenderIcon = icon !== false && (icon || variant !==
|
|
358
|
+
const shouldRenderIcon = icon !== false && (icon || variant !== "default");
|
|
409
359
|
const handleActionPress = () => {
|
|
410
360
|
onActionPress?.({ id, hide });
|
|
411
361
|
};
|
|
412
362
|
|
|
413
363
|
return (
|
|
414
364
|
<ToastRoot id={id} hide={hide} variant={variant} {...rest}>
|
|
415
|
-
{shouldRenderIcon ?
|
|
416
|
-
<Box alignSelf="start">{icon ?? <ToastIcon />}</Box>
|
|
417
|
-
) : null}
|
|
365
|
+
{shouldRenderIcon ? <Box alignSelf="start">{icon ?? <ToastIcon />}</Box> : null}
|
|
418
366
|
<Box flex={1} gap="0">
|
|
419
367
|
{label ? <ToastTitle>{label}</ToastTitle> : null}
|
|
420
|
-
{description ?
|
|
421
|
-
<ToastDescription>{description}</ToastDescription>
|
|
422
|
-
) : null}
|
|
368
|
+
{description ? <ToastDescription>{description}</ToastDescription> : null}
|
|
423
369
|
</Box>
|
|
424
|
-
{actionLabel ?
|
|
425
|
-
<ToastAction onPress={handleActionPress}>{actionLabel}</ToastAction>
|
|
426
|
-
) : null}
|
|
370
|
+
{actionLabel ? <ToastAction onPress={handleActionPress}>{actionLabel}</ToastAction> : null}
|
|
427
371
|
{showCloseButton ? <ToastClose /> : null}
|
|
428
372
|
</ToastRoot>
|
|
429
373
|
);
|
|
@@ -436,7 +380,7 @@ type ToastComponent = typeof ToastRoot & {
|
|
|
436
380
|
Close: typeof ToastClose;
|
|
437
381
|
Icon: typeof ToastIcon;
|
|
438
382
|
show: (options: ToastShowOptions) => StackToastId;
|
|
439
|
-
hide: (id?: StackToastId | StackToastId[] |
|
|
383
|
+
hide: (id?: StackToastId | StackToastId[] | "all") => void;
|
|
440
384
|
};
|
|
441
385
|
|
|
442
386
|
export const Toast = ToastRoot as ToastComponent;
|
|
@@ -450,14 +394,14 @@ Toast.hide = hideToast;
|
|
|
450
394
|
|
|
451
395
|
const styles = StyleSheet.create({
|
|
452
396
|
root: {
|
|
453
|
-
alignSelf:
|
|
397
|
+
alignSelf: "stretch",
|
|
454
398
|
minHeight: 64,
|
|
455
399
|
},
|
|
456
400
|
action: {
|
|
457
|
-
alignItems:
|
|
458
|
-
alignSelf:
|
|
401
|
+
alignItems: "center",
|
|
402
|
+
alignSelf: "flex-start",
|
|
459
403
|
borderRadius: 9999,
|
|
460
|
-
justifyContent:
|
|
404
|
+
justifyContent: "center",
|
|
461
405
|
},
|
|
462
406
|
action_sm: {
|
|
463
407
|
minHeight: 36,
|
|
@@ -472,6 +416,6 @@ const styles = StyleSheet.create({
|
|
|
472
416
|
paddingHorizontal: 20,
|
|
473
417
|
},
|
|
474
418
|
actionFullWidth: {
|
|
475
|
-
alignSelf:
|
|
419
|
+
alignSelf: "stretch",
|
|
476
420
|
},
|
|
477
421
|
});
|