react-native-terra-ui 0.5.0 → 0.6.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 +31 -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 +2 -2
- package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -1
- package/lib/module/components/header/variants/LargeTitleHeader/index.js +58 -58
- package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
- package/lib/module/components/header/variants/TitleHeader/index.js +27 -27
- 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 +11 -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 +25 -25
- 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/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.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 +2 -2
- 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 +99 -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 +3 -7
- package/src/components/header/variants/LargeTitleHeader/index.tsx +75 -139
- package/src/components/header/variants/TitleHeader/index.tsx +40 -62
- package/src/components/icon/Icon.tsx +31 -39
- package/src/components/icon/index.ts +2 -2
- package/src/components/image/Image.tsx +22 -11
- 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 +42 -61
- 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 +138 -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
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import { useEffect } from
|
|
2
|
-
import { Text, View } from
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { Text, View } from "react-native";
|
|
3
3
|
|
|
4
|
-
import Animated, {
|
|
5
|
-
|
|
6
|
-
useAnimatedStyle,
|
|
7
|
-
useSharedValue,
|
|
8
|
-
} from 'react-native-reanimated';
|
|
9
|
-
import { StyleSheet, useUnistyles } from 'react-native-unistyles';
|
|
4
|
+
import Animated, { interpolate, useAnimatedStyle, useSharedValue } from "react-native-reanimated";
|
|
5
|
+
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
|
10
6
|
|
|
11
|
-
import { resolveThemeColor } from
|
|
12
|
-
import { FONT_WEIGHT_VALUE } from
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from
|
|
19
|
-
import { Toolbar } from '../../../toolbar';
|
|
20
|
-
import { HeaderDismissButton } from '../../header-buttons';
|
|
21
|
-
import { HeaderGradientOverlay } from '../../parts/HeaderGradientOverlay';
|
|
22
|
-
import type { TitleHeaderProps } from '../TitleHeader';
|
|
7
|
+
import { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
8
|
+
import { FONT_WEIGHT_VALUE } from "#utils/typography";
|
|
9
|
+
import { Portal } from "../../../portal";
|
|
10
|
+
import { SCREEN_HEADER_PORTAL_HOST, useScreen } from "../../../screen/ScreenContext";
|
|
11
|
+
import { Toolbar } from "../../../toolbar";
|
|
12
|
+
import { HeaderDismissButton } from "../../header-buttons";
|
|
13
|
+
import { HeaderGradientOverlay } from "../../parts/HeaderGradientOverlay";
|
|
14
|
+
import type { TitleHeaderProps } from "../TitleHeader";
|
|
23
15
|
|
|
24
16
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
25
17
|
|
|
@@ -41,11 +33,8 @@ function LargeTitlePortalContent({
|
|
|
41
33
|
title,
|
|
42
34
|
overline,
|
|
43
35
|
subtitle,
|
|
44
|
-
titleAlignment =
|
|
45
|
-
}: Pick<
|
|
46
|
-
LargeTitleHeaderProps,
|
|
47
|
-
'title' | 'overline' | 'subtitle' | 'titleAlignment'
|
|
48
|
-
>) {
|
|
36
|
+
titleAlignment = "center",
|
|
37
|
+
}: Pick<LargeTitleHeaderProps, "title" | "overline" | "subtitle" | "titleAlignment">) {
|
|
49
38
|
const { theme } = useUnistyles();
|
|
50
39
|
const { scrollY } = useScreen();
|
|
51
40
|
styles.useVariants({ titleAlignment });
|
|
@@ -59,15 +48,10 @@ function LargeTitlePortalContent({
|
|
|
59
48
|
}
|
|
60
49
|
|
|
61
50
|
return {
|
|
62
|
-
opacity: interpolate(scrollY.value, [0, height], [1, 0],
|
|
51
|
+
opacity: interpolate(scrollY.value, [0, height], [1, 0], "clamp"),
|
|
63
52
|
transform: [
|
|
64
53
|
{
|
|
65
|
-
translateY: interpolate(
|
|
66
|
-
scrollY.value,
|
|
67
|
-
[0, height],
|
|
68
|
-
[0, -LARGE_TITLE_SLIDE_OFFSET],
|
|
69
|
-
'clamp'
|
|
70
|
-
),
|
|
54
|
+
translateY: interpolate(scrollY.value, [0, height], [0, -LARGE_TITLE_SLIDE_OFFSET], "clamp"),
|
|
71
55
|
},
|
|
72
56
|
],
|
|
73
57
|
};
|
|
@@ -78,27 +62,21 @@ function LargeTitlePortalContent({
|
|
|
78
62
|
{!!overline && (
|
|
79
63
|
<Text
|
|
80
64
|
style={styles.overline}
|
|
81
|
-
maxFontSizeMultiplier={
|
|
82
|
-
theme.typography.variants['label-sm'].maxFontSizeMultiplier
|
|
83
|
-
}
|
|
65
|
+
maxFontSizeMultiplier={theme.typography.variants["label-sm"].maxFontSizeMultiplier}
|
|
84
66
|
>
|
|
85
67
|
{overline}
|
|
86
68
|
</Text>
|
|
87
69
|
)}
|
|
88
70
|
<Text
|
|
89
71
|
style={styles.largeTitle}
|
|
90
|
-
maxFontSizeMultiplier={
|
|
91
|
-
theme.typography.variants['headline-lg'].maxFontSizeMultiplier
|
|
92
|
-
}
|
|
72
|
+
maxFontSizeMultiplier={theme.typography.variants["headline-lg"].maxFontSizeMultiplier}
|
|
93
73
|
>
|
|
94
74
|
{title}
|
|
95
75
|
</Text>
|
|
96
76
|
{!!subtitle && (
|
|
97
77
|
<Text
|
|
98
78
|
style={styles.subtitle}
|
|
99
|
-
maxFontSizeMultiplier={
|
|
100
|
-
theme.typography.variants['body-lg'].maxFontSizeMultiplier
|
|
101
|
-
}
|
|
79
|
+
maxFontSizeMultiplier={theme.typography.variants["body-lg"].maxFontSizeMultiplier}
|
|
102
80
|
>
|
|
103
81
|
{subtitle}
|
|
104
82
|
</Text>
|
|
@@ -133,23 +111,21 @@ export function LargeTitleHeader({
|
|
|
133
111
|
subtitle,
|
|
134
112
|
LeftToolbar,
|
|
135
113
|
RightToolbar,
|
|
136
|
-
dismissAction =
|
|
114
|
+
dismissAction = "none",
|
|
137
115
|
navigation,
|
|
138
116
|
onDismiss,
|
|
139
|
-
titleAlignment =
|
|
117
|
+
titleAlignment = "center",
|
|
140
118
|
isLargeTitleHidden = false,
|
|
141
|
-
bg =
|
|
119
|
+
bg = "surface.default",
|
|
142
120
|
}: LargeTitleHeaderProps) {
|
|
143
121
|
const { theme } = useUnistyles();
|
|
144
122
|
|
|
145
123
|
const bgColor =
|
|
146
124
|
resolveThemeColor(bg, theme) ??
|
|
147
|
-
(theme.color as unknown as Record<string, string | undefined>)[
|
|
148
|
-
|
|
149
|
-
] ??
|
|
150
|
-
'';
|
|
125
|
+
(theme.color as unknown as Record<string, string | undefined>)["surface.default"] ??
|
|
126
|
+
"";
|
|
151
127
|
|
|
152
|
-
const isTransparent = bgColor ===
|
|
128
|
+
const isTransparent = bgColor === "transparent";
|
|
153
129
|
const gradientColor = isTransparent ? theme.color.background : bgColor;
|
|
154
130
|
const { scrollY } = useScreen();
|
|
155
131
|
const isLargeTitleHiddenValue = useSharedValue(isLargeTitleHidden);
|
|
@@ -166,7 +142,7 @@ export function LargeTitleHeader({
|
|
|
166
142
|
return { opacity: 0 };
|
|
167
143
|
}
|
|
168
144
|
return {
|
|
169
|
-
opacity: interpolate(scrollY.value, [0, height], [0, 1],
|
|
145
|
+
opacity: interpolate(scrollY.value, [0, height], [0, 1], "clamp"),
|
|
170
146
|
};
|
|
171
147
|
});
|
|
172
148
|
|
|
@@ -184,15 +160,10 @@ export function LargeTitleHeader({
|
|
|
184
160
|
}
|
|
185
161
|
|
|
186
162
|
return {
|
|
187
|
-
opacity: interpolate(scrollY.value, [0, height], [0, 1],
|
|
163
|
+
opacity: interpolate(scrollY.value, [0, height], [0, 1], "clamp"),
|
|
188
164
|
transform: [
|
|
189
165
|
{
|
|
190
|
-
translateY: interpolate(
|
|
191
|
-
scrollY.value,
|
|
192
|
-
[0, height],
|
|
193
|
-
[COMPACT_TITLE_SLIDE_OFFSET, 0],
|
|
194
|
-
'clamp'
|
|
195
|
-
),
|
|
166
|
+
translateY: interpolate(scrollY.value, [0, height], [COMPACT_TITLE_SLIDE_OFFSET, 0], "clamp"),
|
|
196
167
|
},
|
|
197
168
|
],
|
|
198
169
|
};
|
|
@@ -203,13 +174,9 @@ export function LargeTitleHeader({
|
|
|
203
174
|
}, [isLargeTitleHidden, isLargeTitleHiddenValue]);
|
|
204
175
|
|
|
205
176
|
const leading =
|
|
206
|
-
dismissAction ===
|
|
177
|
+
dismissAction === "back" ? (
|
|
207
178
|
<>
|
|
208
|
-
<HeaderDismissButton
|
|
209
|
-
dismissAction={dismissAction}
|
|
210
|
-
navigation={navigation}
|
|
211
|
-
onDismiss={onDismiss}
|
|
212
|
-
/>
|
|
179
|
+
<HeaderDismissButton dismissAction={dismissAction} navigation={navigation} onDismiss={onDismiss} />
|
|
213
180
|
{LeftToolbar}
|
|
214
181
|
</>
|
|
215
182
|
) : (
|
|
@@ -217,14 +184,10 @@ export function LargeTitleHeader({
|
|
|
217
184
|
);
|
|
218
185
|
|
|
219
186
|
const trailing =
|
|
220
|
-
dismissAction ===
|
|
187
|
+
dismissAction === "close" ? (
|
|
221
188
|
<>
|
|
222
189
|
{RightToolbar}
|
|
223
|
-
<HeaderDismissButton
|
|
224
|
-
dismissAction={dismissAction}
|
|
225
|
-
navigation={navigation}
|
|
226
|
-
onDismiss={onDismiss}
|
|
227
|
-
/>
|
|
190
|
+
<HeaderDismissButton dismissAction={dismissAction} navigation={navigation} onDismiss={onDismiss} />
|
|
228
191
|
</>
|
|
229
192
|
) : (
|
|
230
193
|
RightToolbar
|
|
@@ -242,33 +205,21 @@ export function LargeTitleHeader({
|
|
|
242
205
|
/>
|
|
243
206
|
</Portal>
|
|
244
207
|
)}
|
|
245
|
-
<Animated.View
|
|
246
|
-
style={[styles.safeArea(gradientColor), gradientOpacityStyle]}
|
|
247
|
-
/>
|
|
208
|
+
<Animated.View style={[styles.safeArea(gradientColor), gradientOpacityStyle]} />
|
|
248
209
|
<View style={styles.bar}>
|
|
249
|
-
<Animated.View
|
|
250
|
-
style={[styles.gradient, gradientOpacityStyle]}
|
|
251
|
-
pointerEvents="none"
|
|
252
|
-
>
|
|
210
|
+
<Animated.View style={[styles.gradient, gradientOpacityStyle]} pointerEvents="none">
|
|
253
211
|
<HeaderGradientOverlay color={gradientColor} />
|
|
254
212
|
</Animated.View>
|
|
255
213
|
{leading != null && <Toolbar>{leading}</Toolbar>}
|
|
256
|
-
<Animated.View
|
|
257
|
-
style={[styles.titleContainer, compactTitleAnimatedStyle]}
|
|
258
|
-
pointerEvents="none"
|
|
259
|
-
>
|
|
214
|
+
<Animated.View style={[styles.titleContainer, compactTitleAnimatedStyle]} pointerEvents="none">
|
|
260
215
|
<AnimatedText
|
|
261
216
|
style={styles.compactTitle}
|
|
262
|
-
maxFontSizeMultiplier={
|
|
263
|
-
theme.typography.variants['title-md'].maxFontSizeMultiplier
|
|
264
|
-
}
|
|
217
|
+
maxFontSizeMultiplier={theme.typography.variants["title-md"].maxFontSizeMultiplier}
|
|
265
218
|
>
|
|
266
219
|
{title}
|
|
267
220
|
</AnimatedText>
|
|
268
221
|
</Animated.View>
|
|
269
|
-
{trailing != null &&
|
|
270
|
-
<Toolbar style={styles.trailing}>{trailing}</Toolbar>
|
|
271
|
-
)}
|
|
222
|
+
{trailing != null && <Toolbar style={styles.trailing}>{trailing}</Toolbar>}
|
|
272
223
|
</View>
|
|
273
224
|
</View>
|
|
274
225
|
);
|
|
@@ -276,7 +227,7 @@ export function LargeTitleHeader({
|
|
|
276
227
|
|
|
277
228
|
const styles = StyleSheet.create((theme, runtime) => ({
|
|
278
229
|
container: {
|
|
279
|
-
position:
|
|
230
|
+
position: "absolute",
|
|
280
231
|
top: 0,
|
|
281
232
|
left: 0,
|
|
282
233
|
right: 0,
|
|
@@ -287,7 +238,7 @@ const styles = StyleSheet.create((theme, runtime) => ({
|
|
|
287
238
|
backgroundColor: bgColor,
|
|
288
239
|
}),
|
|
289
240
|
gradient: {
|
|
290
|
-
position:
|
|
241
|
+
position: "absolute",
|
|
291
242
|
top: 0,
|
|
292
243
|
left: 0,
|
|
293
244
|
right: 0,
|
|
@@ -295,85 +246,70 @@ const styles = StyleSheet.create((theme, runtime) => ({
|
|
|
295
246
|
},
|
|
296
247
|
bar: {
|
|
297
248
|
height: theme.layout.header.height,
|
|
298
|
-
flexDirection:
|
|
299
|
-
alignItems:
|
|
249
|
+
flexDirection: "row",
|
|
250
|
+
alignItems: "center",
|
|
300
251
|
paddingHorizontal: theme.layout.screen.margin.x,
|
|
301
|
-
gap: theme.spacing[
|
|
302
|
-
justifyContent:
|
|
252
|
+
gap: theme.spacing["3"],
|
|
253
|
+
justifyContent: "space-between",
|
|
303
254
|
},
|
|
304
255
|
trailing: {
|
|
305
|
-
justifyContent:
|
|
256
|
+
justifyContent: "flex-end",
|
|
306
257
|
},
|
|
307
258
|
portalContent: {
|
|
308
259
|
gap: 2,
|
|
309
260
|
minHeight: theme.layout.header.height,
|
|
310
261
|
// paddingTop: theme.spacing['1'],
|
|
311
|
-
paddingBottom: theme.spacing[
|
|
262
|
+
paddingBottom: theme.spacing["3"],
|
|
312
263
|
paddingHorizontal: theme.layout.screen.margin.x,
|
|
313
264
|
},
|
|
314
265
|
overline: {
|
|
315
|
-
fontSize: theme.typography.variants[
|
|
316
|
-
lineHeight: theme.typography.variants[
|
|
317
|
-
letterSpacing: theme.typography.variants[
|
|
318
|
-
fontWeight:
|
|
319
|
-
|
|
320
|
-
color:
|
|
321
|
-
(theme.color as unknown as Record<string, string | undefined>)[
|
|
322
|
-
'text.subtle'
|
|
323
|
-
] ?? '',
|
|
266
|
+
fontSize: theme.typography.variants["label-sm"].fontSize,
|
|
267
|
+
lineHeight: theme.typography.variants["label-sm"].lineHeight,
|
|
268
|
+
letterSpacing: theme.typography.variants["label-sm"].letterSpacing,
|
|
269
|
+
fontWeight: FONT_WEIGHT_VALUE[theme.typography.variants["label-sm"].fontWeight],
|
|
270
|
+
color: (theme.color as unknown as Record<string, string | undefined>)["text.subtle"] ?? "",
|
|
324
271
|
variants: {
|
|
325
272
|
titleAlignment: {
|
|
326
|
-
center: { textAlign:
|
|
327
|
-
left: { textAlign:
|
|
273
|
+
center: { textAlign: "center" },
|
|
274
|
+
left: { textAlign: "left" },
|
|
328
275
|
},
|
|
329
276
|
},
|
|
330
277
|
},
|
|
331
278
|
largeTitle: {
|
|
332
|
-
fontSize: theme.typography.variants[
|
|
333
|
-
lineHeight: theme.typography.variants[
|
|
334
|
-
letterSpacing: theme.typography.variants[
|
|
335
|
-
fontWeight:
|
|
336
|
-
|
|
337
|
-
color:
|
|
338
|
-
(theme.color as unknown as Record<string, string | undefined>)[
|
|
339
|
-
'text.default'
|
|
340
|
-
] ?? '',
|
|
279
|
+
fontSize: theme.typography.variants["headline-lg"].fontSize,
|
|
280
|
+
lineHeight: theme.typography.variants["headline-lg"].lineHeight,
|
|
281
|
+
letterSpacing: theme.typography.variants["headline-lg"].letterSpacing,
|
|
282
|
+
fontWeight: FONT_WEIGHT_VALUE[theme.typography.variants["headline-lg"].fontWeight],
|
|
283
|
+
color: (theme.color as unknown as Record<string, string | undefined>)["text.default"] ?? "",
|
|
341
284
|
variants: {
|
|
342
285
|
titleAlignment: {
|
|
343
|
-
center: { textAlign:
|
|
344
|
-
left: { textAlign:
|
|
286
|
+
center: { textAlign: "center" },
|
|
287
|
+
left: { textAlign: "left" },
|
|
345
288
|
},
|
|
346
289
|
},
|
|
347
290
|
},
|
|
348
291
|
subtitle: {
|
|
349
|
-
fontSize: theme.typography.variants[
|
|
350
|
-
lineHeight: theme.typography.variants[
|
|
351
|
-
letterSpacing: theme.typography.variants[
|
|
352
|
-
color:
|
|
353
|
-
(theme.color as unknown as Record<string, string | undefined>)[
|
|
354
|
-
'text.subtle'
|
|
355
|
-
] ?? '',
|
|
292
|
+
fontSize: theme.typography.variants["body-lg"].fontSize,
|
|
293
|
+
lineHeight: theme.typography.variants["body-lg"].lineHeight,
|
|
294
|
+
letterSpacing: theme.typography.variants["body-lg"].letterSpacing,
|
|
295
|
+
color: (theme.color as unknown as Record<string, string | undefined>)["text.subtle"] ?? "",
|
|
356
296
|
variants: {
|
|
357
297
|
titleAlignment: {
|
|
358
|
-
center: { textAlign:
|
|
359
|
-
left: { textAlign:
|
|
298
|
+
center: { textAlign: "center" },
|
|
299
|
+
left: { textAlign: "left" },
|
|
360
300
|
},
|
|
361
301
|
},
|
|
362
302
|
},
|
|
363
303
|
compactTitle: {
|
|
364
|
-
fontSize: theme.typography.variants[
|
|
365
|
-
lineHeight: theme.typography.variants[
|
|
366
|
-
letterSpacing: theme.typography.variants[
|
|
367
|
-
fontWeight:
|
|
368
|
-
|
|
369
|
-
color:
|
|
370
|
-
(theme.color as unknown as Record<string, string | undefined>)[
|
|
371
|
-
'text.default'
|
|
372
|
-
] ?? '',
|
|
304
|
+
fontSize: theme.typography.variants["title-md"].fontSize,
|
|
305
|
+
lineHeight: theme.typography.variants["title-md"].lineHeight,
|
|
306
|
+
letterSpacing: theme.typography.variants["title-md"].letterSpacing,
|
|
307
|
+
fontWeight: FONT_WEIGHT_VALUE[theme.typography.variants["title-md"].fontWeight],
|
|
308
|
+
color: (theme.color as unknown as Record<string, string | undefined>)["text.default"] ?? "",
|
|
373
309
|
variants: {
|
|
374
310
|
titleAlignment: {
|
|
375
|
-
center: { textAlign:
|
|
376
|
-
left: { textAlign:
|
|
311
|
+
center: { textAlign: "center" },
|
|
312
|
+
left: { textAlign: "left" },
|
|
377
313
|
},
|
|
378
314
|
},
|
|
379
315
|
},
|
|
@@ -382,14 +318,14 @@ const styles = StyleSheet.create((theme, runtime) => ({
|
|
|
382
318
|
variants: {
|
|
383
319
|
titleAlignment: {
|
|
384
320
|
center: {
|
|
385
|
-
position:
|
|
321
|
+
position: "absolute",
|
|
386
322
|
left: 0,
|
|
387
323
|
right: 0,
|
|
388
|
-
alignItems:
|
|
324
|
+
alignItems: "center",
|
|
389
325
|
},
|
|
390
326
|
left: {
|
|
391
327
|
flex: 1,
|
|
392
|
-
alignItems:
|
|
328
|
+
alignItems: "flex-start",
|
|
393
329
|
},
|
|
394
330
|
},
|
|
395
331
|
},
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import type { ReactNode } from
|
|
2
|
-
import { Text, View } from
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { Text, View } from "react-native";
|
|
3
3
|
|
|
4
|
-
import { StyleSheet, useUnistyles } from
|
|
4
|
+
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
|
5
5
|
|
|
6
|
-
import type { ColorToken } from
|
|
7
|
-
import { resolveThemeColor } from
|
|
8
|
-
import { FONT_WEIGHT_VALUE } from
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
HeaderDismissButton,
|
|
13
|
-
type HeaderDismissProps,
|
|
14
|
-
} from '../../header-buttons';
|
|
15
|
-
import { HeaderGradientOverlay } from '../../parts/HeaderGradientOverlay';
|
|
6
|
+
import type { ColorToken } from "#theme/types";
|
|
7
|
+
import { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
8
|
+
import { FONT_WEIGHT_VALUE } from "#utils/typography";
|
|
9
|
+
import { Toolbar } from "../../../toolbar";
|
|
10
|
+
import { HeaderDismissButton, type HeaderDismissProps } from "../../header-buttons";
|
|
11
|
+
import { HeaderGradientOverlay } from "../../parts/HeaderGradientOverlay";
|
|
16
12
|
|
|
17
13
|
export interface TitleHeaderProps extends HeaderDismissProps {
|
|
18
14
|
title?: string;
|
|
@@ -27,7 +23,7 @@ export interface TitleHeaderProps extends HeaderDismissProps {
|
|
|
27
23
|
*/
|
|
28
24
|
RightToolbar?: ReactNode;
|
|
29
25
|
/** Title placement within the bar. Defaults to `'center'`. */
|
|
30
|
-
titleAlignment?:
|
|
26
|
+
titleAlignment?: "center" | "left";
|
|
31
27
|
/** Background color token. Defaults to `surface.default`. */
|
|
32
28
|
bg?: ColorToken;
|
|
33
29
|
}
|
|
@@ -53,34 +49,26 @@ export function TitleHeader({
|
|
|
53
49
|
title,
|
|
54
50
|
LeftToolbar,
|
|
55
51
|
RightToolbar,
|
|
56
|
-
dismissAction =
|
|
52
|
+
dismissAction = "none",
|
|
57
53
|
navigation,
|
|
58
54
|
onDismiss,
|
|
59
|
-
titleAlignment =
|
|
60
|
-
bg =
|
|
55
|
+
titleAlignment = "center",
|
|
56
|
+
bg = "surface.default",
|
|
61
57
|
}: TitleHeaderProps) {
|
|
62
58
|
const { theme } = useUnistyles();
|
|
63
59
|
|
|
64
60
|
const bgColor =
|
|
65
61
|
resolveThemeColor(bg, theme) ??
|
|
66
|
-
(theme.color as unknown as Record<string, string | undefined>)[
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const isTransparent = bgColor === 'transparent';
|
|
71
|
-
const gradientColor = isTransparent
|
|
72
|
-
? theme.color['surface.default']
|
|
73
|
-
: bgColor;
|
|
62
|
+
(theme.color as unknown as Record<string, string | undefined>)["surface.default"] ??
|
|
63
|
+
"";
|
|
64
|
+
const isTransparent = bgColor === "transparent";
|
|
65
|
+
const gradientColor = isTransparent ? theme.color["surface.default"] : bgColor;
|
|
74
66
|
styles.useVariants({ titleAlignment });
|
|
75
67
|
|
|
76
68
|
const leading =
|
|
77
|
-
dismissAction ===
|
|
69
|
+
dismissAction === "back" ? (
|
|
78
70
|
<>
|
|
79
|
-
<HeaderDismissButton
|
|
80
|
-
dismissAction={dismissAction}
|
|
81
|
-
navigation={navigation}
|
|
82
|
-
onDismiss={onDismiss}
|
|
83
|
-
/>
|
|
71
|
+
<HeaderDismissButton dismissAction={dismissAction} navigation={navigation} onDismiss={onDismiss} />
|
|
84
72
|
{LeftToolbar}
|
|
85
73
|
</>
|
|
86
74
|
) : (
|
|
@@ -88,14 +76,10 @@ export function TitleHeader({
|
|
|
88
76
|
);
|
|
89
77
|
|
|
90
78
|
const trailing =
|
|
91
|
-
dismissAction ===
|
|
79
|
+
dismissAction === "close" ? (
|
|
92
80
|
<>
|
|
93
81
|
{RightToolbar}
|
|
94
|
-
<HeaderDismissButton
|
|
95
|
-
dismissAction={dismissAction}
|
|
96
|
-
navigation={navigation}
|
|
97
|
-
onDismiss={onDismiss}
|
|
98
|
-
/>
|
|
82
|
+
<HeaderDismissButton dismissAction={dismissAction} navigation={navigation} onDismiss={onDismiss} />
|
|
99
83
|
</>
|
|
100
84
|
) : (
|
|
101
85
|
RightToolbar
|
|
@@ -111,9 +95,7 @@ export function TitleHeader({
|
|
|
111
95
|
<View style={styles.titleContainer} pointerEvents="none">
|
|
112
96
|
{!!title && <Text style={styles.title}>{title}</Text>}
|
|
113
97
|
</View>
|
|
114
|
-
{trailing != null &&
|
|
115
|
-
<Toolbar style={styles.trailing}>{trailing}</Toolbar>
|
|
116
|
-
)}
|
|
98
|
+
{trailing != null && <Toolbar style={styles.trailing}>{trailing}</Toolbar>}
|
|
117
99
|
</View>
|
|
118
100
|
</View>
|
|
119
101
|
);
|
|
@@ -121,7 +103,7 @@ export function TitleHeader({
|
|
|
121
103
|
|
|
122
104
|
const styles = StyleSheet.create((theme, runtime) => ({
|
|
123
105
|
container: {
|
|
124
|
-
position:
|
|
106
|
+
position: "absolute",
|
|
125
107
|
top: 0,
|
|
126
108
|
left: 0,
|
|
127
109
|
right: 0,
|
|
@@ -129,10 +111,10 @@ const styles = StyleSheet.create((theme, runtime) => ({
|
|
|
129
111
|
},
|
|
130
112
|
safeArea: (isTransparent, bgColor) => ({
|
|
131
113
|
height: runtime.insets.top,
|
|
132
|
-
backgroundColor: isTransparent ?
|
|
114
|
+
backgroundColor: isTransparent ? "transparent" : bgColor,
|
|
133
115
|
}),
|
|
134
116
|
gradient: {
|
|
135
|
-
position:
|
|
117
|
+
position: "absolute",
|
|
136
118
|
top: 0,
|
|
137
119
|
left: 0,
|
|
138
120
|
right: 0,
|
|
@@ -140,45 +122,41 @@ const styles = StyleSheet.create((theme, runtime) => ({
|
|
|
140
122
|
},
|
|
141
123
|
bar: {
|
|
142
124
|
height: theme.layout.header.height,
|
|
143
|
-
flexDirection:
|
|
144
|
-
alignItems:
|
|
125
|
+
flexDirection: "row",
|
|
126
|
+
alignItems: "center",
|
|
145
127
|
paddingHorizontal: theme.layout.screen.margin.x,
|
|
146
|
-
gap: theme.spacing[
|
|
147
|
-
justifyContent:
|
|
128
|
+
gap: theme.spacing["3"],
|
|
129
|
+
justifyContent: "space-between",
|
|
148
130
|
},
|
|
149
131
|
trailing: {
|
|
150
|
-
justifyContent:
|
|
132
|
+
justifyContent: "flex-end",
|
|
151
133
|
},
|
|
152
134
|
titleContainer: {
|
|
153
135
|
variants: {
|
|
154
136
|
titleAlignment: {
|
|
155
137
|
center: {
|
|
156
|
-
position:
|
|
138
|
+
position: "absolute",
|
|
157
139
|
left: 0,
|
|
158
140
|
right: 0,
|
|
159
|
-
alignItems:
|
|
141
|
+
alignItems: "center",
|
|
160
142
|
},
|
|
161
143
|
left: {
|
|
162
144
|
flex: 1,
|
|
163
|
-
alignItems:
|
|
145
|
+
alignItems: "flex-start",
|
|
164
146
|
},
|
|
165
147
|
},
|
|
166
148
|
},
|
|
167
149
|
},
|
|
168
150
|
title: {
|
|
169
|
-
fontSize: theme.typography.variants[
|
|
170
|
-
lineHeight: theme.typography.variants[
|
|
171
|
-
letterSpacing: theme.typography.variants[
|
|
172
|
-
fontWeight:
|
|
173
|
-
|
|
174
|
-
color:
|
|
175
|
-
(theme.color as unknown as Record<string, string | undefined>)[
|
|
176
|
-
'text.default'
|
|
177
|
-
] ?? '',
|
|
151
|
+
fontSize: theme.typography.variants["title-md"].fontSize,
|
|
152
|
+
lineHeight: theme.typography.variants["title-md"].lineHeight,
|
|
153
|
+
letterSpacing: theme.typography.variants["title-md"].letterSpacing,
|
|
154
|
+
fontWeight: FONT_WEIGHT_VALUE[theme.typography.variants["title-md"].fontWeight],
|
|
155
|
+
color: (theme.color as unknown as Record<string, string | undefined>)["text.default"] ?? "",
|
|
178
156
|
variants: {
|
|
179
157
|
titleAlignment: {
|
|
180
|
-
center: { textAlign:
|
|
181
|
-
left: { textAlign:
|
|
158
|
+
center: { textAlign: "center" },
|
|
159
|
+
left: { textAlign: "left" },
|
|
182
160
|
},
|
|
183
161
|
},
|
|
184
162
|
},
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { ComponentRef } from
|
|
2
|
-
import { forwardRef } from
|
|
3
|
-
import { View, type ViewProps } from
|
|
1
|
+
import type { ComponentRef } from "react";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { View, type ViewProps } from "react-native";
|
|
4
4
|
|
|
5
|
-
import { StyleSheet, useUnistyles } from
|
|
5
|
+
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
|
6
6
|
|
|
7
|
-
import { getIcon } from
|
|
8
|
-
import type { ColorToken, TerraIconName } from
|
|
9
|
-
import { resolveThemeColor } from
|
|
7
|
+
import { getIcon } from "#theme/registry";
|
|
8
|
+
import type { ColorToken, TerraIconName } from "#theme/types";
|
|
9
|
+
import { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
10
10
|
|
|
11
|
-
export interface IconProps extends Omit<ViewProps,
|
|
11
|
+
export interface IconProps extends Omit<ViewProps, "children"> {
|
|
12
12
|
/** Semantic or configured icon name from the theme registry. */
|
|
13
13
|
name: TerraIconName;
|
|
14
14
|
/** Icon size in density-independent pixels. Defaults to `20`. */
|
|
@@ -27,39 +27,31 @@ export interface IconProps extends Omit<ViewProps, 'children'> {
|
|
|
27
27
|
* <Icon name="navigation.close" size={24} color="text.default" />
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export const Icon = forwardRef<ComponentRef<typeof View>, IconProps>(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const IconComponent = getIcon(name);
|
|
30
|
+
export const Icon = forwardRef<ComponentRef<typeof View>, IconProps>(function Icon(
|
|
31
|
+
{ name, size = 20, color = "text.default", strokeWidth, style, ...rest },
|
|
32
|
+
ref
|
|
33
|
+
) {
|
|
34
|
+
const { theme } = useUnistyles();
|
|
35
|
+
const IconComponent = getIcon(name);
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
37
|
+
if (!IconComponent) {
|
|
38
|
+
if (__DEV__) {
|
|
39
|
+
console.warn(`[react-native-terra-ui] Unknown icon "${name}".`);
|
|
43
40
|
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
] ??
|
|
50
|
-
'';
|
|
44
|
+
const resolvedColor =
|
|
45
|
+
resolveThemeColor(color, theme) ??
|
|
46
|
+
(theme.color as unknown as Record<string, string | undefined>)["text.default"] ??
|
|
47
|
+
"";
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/>
|
|
59
|
-
</View>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
);
|
|
49
|
+
return (
|
|
50
|
+
<View ref={ref} style={[styles.container(size), style]} {...rest}>
|
|
51
|
+
<IconComponent color={resolvedColor} size={size} strokeWidth={strokeWidth} />
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
63
55
|
|
|
64
56
|
// ─── Styles ───────────────────────────────────────────────────────────────────
|
|
65
57
|
//
|
|
@@ -73,7 +65,7 @@ const styles = StyleSheet.create(() => ({
|
|
|
73
65
|
container: (size: number) => ({
|
|
74
66
|
width: size,
|
|
75
67
|
height: size,
|
|
76
|
-
alignItems:
|
|
77
|
-
justifyContent:
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
justifyContent: "center",
|
|
78
70
|
}),
|
|
79
71
|
}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { IconProps } from
|
|
2
|
-
export { Icon } from
|
|
1
|
+
export type { IconProps } from "./Icon";
|
|
2
|
+
export { Icon } from "./Icon";
|