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
|
@@ -6,21 +6,15 @@ import {
|
|
|
6
6
|
type ReactNode,
|
|
7
7
|
useContext,
|
|
8
8
|
useMemo,
|
|
9
|
-
} from
|
|
10
|
-
import {
|
|
11
|
-
Pressable,
|
|
12
|
-
type PressableProps,
|
|
13
|
-
View,
|
|
14
|
-
type ViewProps,
|
|
15
|
-
} from 'react-native';
|
|
16
|
-
|
|
17
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
9
|
+
} from "react";
|
|
10
|
+
import { Pressable, type PressableProps, View, type ViewProps } from "react-native";
|
|
18
11
|
|
|
19
|
-
import
|
|
20
|
-
import { resolveThemeColor } from '#utils/resolve-theme-color';
|
|
12
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
21
13
|
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
14
|
+
import type { ColorToken, SpacingKey, TerraIconName } from "#theme/types";
|
|
15
|
+
import { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
16
|
+
import { Icon } from "../icon";
|
|
17
|
+
import { Text } from "../text";
|
|
24
18
|
|
|
25
19
|
// ─── Context (lets Toolbar.Button inherit the group's paint) ──────────────────
|
|
26
20
|
//
|
|
@@ -44,8 +38,8 @@ interface ToolbarGroupContextValue {
|
|
|
44
38
|
|
|
45
39
|
/** Non-null default, so a bare `Toolbar.Button` still paints its own circle. */
|
|
46
40
|
const ToolbarGroupContext = createContext<ToolbarGroupContextValue>({
|
|
47
|
-
background:
|
|
48
|
-
tint:
|
|
41
|
+
background: "surface.default",
|
|
42
|
+
tint: "text.default",
|
|
49
43
|
isGrouped: false,
|
|
50
44
|
});
|
|
51
45
|
|
|
@@ -56,12 +50,11 @@ const ITEM_SIZE = 40;
|
|
|
56
50
|
const HIT_SLOP = 8;
|
|
57
51
|
|
|
58
52
|
/** Typographic role of a text item's label. */
|
|
59
|
-
const LABEL_VARIANT =
|
|
53
|
+
const LABEL_VARIANT = "label-md";
|
|
60
54
|
|
|
61
55
|
// ─── Button ───────────────────────────────────────────────────────────────────
|
|
62
56
|
|
|
63
|
-
interface ToolbarButtonBaseProps
|
|
64
|
-
extends Omit<PressableProps, 'children' | 'style'> {
|
|
57
|
+
interface ToolbarButtonBaseProps extends Omit<PressableProps, "children" | "style"> {
|
|
65
58
|
/** Icon to render, before the label when both are given. */
|
|
66
59
|
icon?: TerraIconName;
|
|
67
60
|
/** Icon size in density-independent pixels. Defaults to `20`. */
|
|
@@ -88,7 +81,7 @@ interface ToolbarButtonBaseProps
|
|
|
88
81
|
* pinned over a hero image) without a wrapper view. Supports `Pressable`'s
|
|
89
82
|
* function form for press-state styling.
|
|
90
83
|
*/
|
|
91
|
-
style?: PressableProps[
|
|
84
|
+
style?: PressableProps["style"];
|
|
92
85
|
}
|
|
93
86
|
|
|
94
87
|
/**
|
|
@@ -124,17 +117,13 @@ export function ToolbarButton({
|
|
|
124
117
|
style,
|
|
125
118
|
...rest
|
|
126
119
|
}: ToolbarButtonProps) {
|
|
127
|
-
const {
|
|
128
|
-
background: groupBackground,
|
|
129
|
-
tint: groupTint,
|
|
130
|
-
isGrouped,
|
|
131
|
-
} = useContext(ToolbarGroupContext);
|
|
120
|
+
const { background: groupBackground, tint: groupTint, isGrouped } = useContext(ToolbarGroupContext);
|
|
132
121
|
|
|
133
122
|
// Tokens, not resolved values: `Icon` and `Text` each resolve against the
|
|
134
123
|
// live theme, so they keep their own subscriptions.
|
|
135
124
|
const fg = tint ?? groupTint;
|
|
136
125
|
const bg = background ?? groupBackground;
|
|
137
|
-
const shape = Children.count(children) > 0 ?
|
|
126
|
+
const shape = Children.count(children) > 0 ? "label" : "icon";
|
|
138
127
|
|
|
139
128
|
styles.useVariants({ shape, grouped: isGrouped });
|
|
140
129
|
|
|
@@ -156,7 +145,7 @@ export function ToolbarButton({
|
|
|
156
145
|
style={(state) => [
|
|
157
146
|
cell,
|
|
158
147
|
styles.fill(bg, state.pressed),
|
|
159
|
-
typeof style ===
|
|
148
|
+
typeof style === "function" ? style(state) : style,
|
|
160
149
|
]}
|
|
161
150
|
>
|
|
162
151
|
{icon !== undefined && <Icon size={iconSize} color={fg} name={icon} />}
|
|
@@ -168,14 +157,14 @@ export function ToolbarButton({
|
|
|
168
157
|
/** Auto-wraps text children in the button's tint, as `Chip` does its label. */
|
|
169
158
|
function renderLabel(children: ReactNode, tint: ColorToken): ReactNode {
|
|
170
159
|
return Children.map(children, (child) => {
|
|
171
|
-
if (typeof child ===
|
|
160
|
+
if (typeof child === "string") {
|
|
172
161
|
return child.trim().length > 0 ? (
|
|
173
162
|
<Text variant={LABEL_VARIANT} color={tint} weight="bold">
|
|
174
163
|
{child}
|
|
175
164
|
</Text>
|
|
176
165
|
) : null;
|
|
177
166
|
}
|
|
178
|
-
if (typeof child ===
|
|
167
|
+
if (typeof child === "number") {
|
|
179
168
|
return (
|
|
180
169
|
<Text variant={LABEL_VARIANT} color={tint} weight="bold">
|
|
181
170
|
{child}
|
|
@@ -216,21 +205,12 @@ export interface ToolbarGroupProps extends ViewProps {
|
|
|
216
205
|
* </Toolbar.Group>
|
|
217
206
|
* ```
|
|
218
207
|
*/
|
|
219
|
-
export const ToolbarGroup = forwardRef<
|
|
220
|
-
|
|
221
|
-
ToolbarGroupProps
|
|
222
|
-
>(function ToolbarGroup(
|
|
223
|
-
{
|
|
224
|
-
background = 'surface.default',
|
|
225
|
-
tint = 'text.default',
|
|
226
|
-
children,
|
|
227
|
-
style,
|
|
228
|
-
...rest
|
|
229
|
-
},
|
|
208
|
+
export const ToolbarGroup = forwardRef<ComponentRef<typeof View>, ToolbarGroupProps>(function ToolbarGroup(
|
|
209
|
+
{ background = "surface.default", tint = "text.default", children, style, ...rest },
|
|
230
210
|
ref
|
|
231
211
|
) {
|
|
232
212
|
const context = useMemo<ToolbarGroupContextValue>(
|
|
233
|
-
() => ({ background:
|
|
213
|
+
() => ({ background: "transparent", tint, isGrouped: true }),
|
|
234
214
|
[tint]
|
|
235
215
|
);
|
|
236
216
|
|
|
@@ -271,15 +251,16 @@ export interface ToolbarProps extends ViewProps {
|
|
|
271
251
|
* </Toolbar>
|
|
272
252
|
* ```
|
|
273
253
|
*/
|
|
274
|
-
const ToolbarRoot = forwardRef<ComponentRef<typeof View>, ToolbarProps>(
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
);
|
|
254
|
+
const ToolbarRoot = forwardRef<ComponentRef<typeof View>, ToolbarProps>(function Toolbar(
|
|
255
|
+
{ gap = "2", children, style, ...rest },
|
|
256
|
+
ref
|
|
257
|
+
) {
|
|
258
|
+
return (
|
|
259
|
+
<View ref={ref} style={[styles.row(gap), style]} {...rest}>
|
|
260
|
+
{children}
|
|
261
|
+
</View>
|
|
262
|
+
);
|
|
263
|
+
});
|
|
283
264
|
|
|
284
265
|
type ToolbarComponent = typeof ToolbarRoot & {
|
|
285
266
|
Group: typeof ToolbarGroup;
|
|
@@ -294,22 +275,22 @@ Toolbar.Button = ToolbarButton;
|
|
|
294
275
|
|
|
295
276
|
const styles = StyleSheet.create((theme) => ({
|
|
296
277
|
row: (gap: SpacingKey) => ({
|
|
297
|
-
flexDirection:
|
|
298
|
-
alignItems:
|
|
278
|
+
flexDirection: "row",
|
|
279
|
+
alignItems: "center",
|
|
299
280
|
gap: theme.spacing[gap],
|
|
300
281
|
}),
|
|
301
282
|
// `background` is an open `ColorToken` — it accepts raw literals, so it cannot
|
|
302
283
|
// be enumerated as a variant. Resolving inside the factory keeps the fill tied
|
|
303
284
|
// to the live theme.
|
|
304
285
|
capsule: (background: ColorToken) => ({
|
|
305
|
-
flexDirection:
|
|
306
|
-
alignItems:
|
|
307
|
-
gap: theme.spacing[
|
|
286
|
+
flexDirection: "row",
|
|
287
|
+
alignItems: "center",
|
|
288
|
+
gap: theme.spacing["5"],
|
|
308
289
|
paddingHorizontal: 10,
|
|
309
290
|
borderRadius: theme.radius.full,
|
|
310
291
|
backgroundColor: resolveThemeColor(background, theme),
|
|
311
292
|
borderWidth: StyleSheet.hairlineWidth,
|
|
312
|
-
borderColor: theme.color[
|
|
293
|
+
borderColor: theme.color["border.subtle"],
|
|
313
294
|
...theme.elevation.xs,
|
|
314
295
|
}),
|
|
315
296
|
// Geometry is two finite axes, so it belongs in `variants` rather than in
|
|
@@ -318,14 +299,14 @@ const styles = StyleSheet.create((theme) => ({
|
|
|
318
299
|
// supplies it.
|
|
319
300
|
button: {
|
|
320
301
|
height: ITEM_SIZE,
|
|
321
|
-
flexDirection:
|
|
322
|
-
alignItems:
|
|
323
|
-
justifyContent:
|
|
302
|
+
flexDirection: "row",
|
|
303
|
+
alignItems: "center",
|
|
304
|
+
justifyContent: "center",
|
|
324
305
|
borderRadius: theme.radius.full,
|
|
325
306
|
variants: {
|
|
326
307
|
shape: {
|
|
327
308
|
icon: { width: ITEM_SIZE },
|
|
328
|
-
label: { gap: theme.spacing[
|
|
309
|
+
label: { gap: theme.spacing["1"] },
|
|
329
310
|
},
|
|
330
311
|
grouped: {
|
|
331
312
|
true: { paddingHorizontal: 0 },
|
|
@@ -333,14 +314,14 @@ const styles = StyleSheet.create((theme) => ({
|
|
|
333
314
|
minWidth: ITEM_SIZE,
|
|
334
315
|
paddingHorizontal: 10,
|
|
335
316
|
borderWidth: StyleSheet.hairlineWidth,
|
|
336
|
-
borderColor: theme.color[
|
|
317
|
+
borderColor: theme.color["border.subtle"],
|
|
337
318
|
...theme.elevation.xs,
|
|
338
319
|
},
|
|
339
320
|
},
|
|
340
321
|
},
|
|
341
322
|
compoundVariants: [
|
|
342
323
|
{
|
|
343
|
-
shape:
|
|
324
|
+
shape: "icon",
|
|
344
325
|
grouped: true,
|
|
345
326
|
styles: { width: undefined },
|
|
346
327
|
},
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from
|
|
9
|
-
import {
|
|
10
|
-
import { useUnistyles } from 'react-native-unistyles';
|
|
11
|
-
import { bootstrapTerraUI } from '../theme/registry';
|
|
12
|
-
import { applyAccent, applyScheme, getCurrentAccent } from '../theme/runtime';
|
|
13
|
-
import {
|
|
14
|
-
type ResolvedScreenMargin,
|
|
15
|
-
resolveScreenMargin,
|
|
16
|
-
} from '../theme/screen-margin';
|
|
17
|
-
import type { Scheme, TerraTheme } from '../theme/types';
|
|
1
|
+
import { createContext, type PropsWithChildren, useCallback, useContext, useMemo, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
4
|
+
import { useUnistyles } from "react-native-unistyles";
|
|
5
|
+
|
|
6
|
+
import { bootstrapTerraUI } from "../theme/registry";
|
|
7
|
+
import { applyAccent, applyScheme, getCurrentAccent } from "../theme/runtime";
|
|
8
|
+
import { type ResolvedScreenMargin, resolveScreenMargin } from "../theme/screen-margin";
|
|
9
|
+
import type { Scheme, TerraTheme } from "../theme/types";
|
|
18
10
|
|
|
19
11
|
// Ensure the default theme is registered on first import. An app that calls
|
|
20
12
|
// `configureTerraUI` itself still wins, whichever module the bundler evaluates
|
|
@@ -37,19 +29,14 @@ const ThemeContext = createContext<ThemeContextValue | null>(null);
|
|
|
37
29
|
* </TerraUIProvider>
|
|
38
30
|
*/
|
|
39
31
|
export const TerraUIProvider = ({ children }: PropsWithChildren) => {
|
|
40
|
-
const [accent, setAccentState] = useState<string | undefined>(() =>
|
|
41
|
-
getCurrentAccent()
|
|
42
|
-
);
|
|
32
|
+
const [accent, setAccentState] = useState<string | undefined>(() => getCurrentAccent());
|
|
43
33
|
|
|
44
34
|
const setAccent = useCallback((name: string) => {
|
|
45
35
|
applyAccent(name);
|
|
46
36
|
setAccentState(name);
|
|
47
37
|
}, []);
|
|
48
38
|
|
|
49
|
-
const value = useMemo<ThemeContextValue>(
|
|
50
|
-
() => ({ accent, setAccent }),
|
|
51
|
-
[accent, setAccent]
|
|
52
|
-
);
|
|
39
|
+
const value = useMemo<ThemeContextValue>(() => ({ accent, setAccent }), [accent, setAccent]);
|
|
53
40
|
|
|
54
41
|
return (
|
|
55
42
|
<ThemeContext.Provider value={value}>
|
|
@@ -85,7 +72,7 @@ export function useTheme(): UseThemeResult {
|
|
|
85
72
|
|
|
86
73
|
return {
|
|
87
74
|
theme,
|
|
88
|
-
scheme: (rt.themeName ??
|
|
75
|
+
scheme: (rt.themeName ?? "light") as Scheme,
|
|
89
76
|
setScheme,
|
|
90
77
|
accent: ctx?.accent,
|
|
91
78
|
setAccent: ctx?.setAccent ?? noopSetAccent,
|
|
@@ -105,8 +92,6 @@ export function useScreenMargin(): ResolvedScreenMargin {
|
|
|
105
92
|
|
|
106
93
|
const noopSetAccent = (_name: string): void => {
|
|
107
94
|
if (__DEV__) {
|
|
108
|
-
console.warn(
|
|
109
|
-
'[react-native-terra-ui] setAccent called outside <TerraUIProvider>.'
|
|
110
|
-
);
|
|
95
|
+
console.warn("[react-native-terra-ui] setAccent called outside <TerraUIProvider>.");
|
|
111
96
|
}
|
|
112
97
|
};
|
package/src/context/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { UseThemeResult } from
|
|
2
|
-
export { TerraUIProvider, useScreenMargin, useTheme } from
|
|
1
|
+
export type { UseThemeResult } from "./ThemeProvider";
|
|
2
|
+
export { TerraUIProvider, useScreenMargin, useTheme } from "./ThemeProvider";
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// biome-ignore-all assist/source/organizeImports: ./context must be first so it
|
|
2
2
|
// configures the default theme before any StyleSheet.create runs.
|
|
3
|
-
export * from
|
|
3
|
+
export * from "./context";
|
|
4
4
|
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
5
|
+
export * from "./components";
|
|
6
|
+
export * from "./theme";
|
package/src/theme/breakpoints.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UnistylesBreakpoints } from
|
|
1
|
+
import type { UnistylesBreakpoints } from "react-native-unistyles";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Viewport-width breakpoints (dp), registered with Unistyles via
|
|
@@ -16,7 +16,7 @@ export const breakpoints = {
|
|
|
16
16
|
export type AppBreakpoints = typeof breakpoints;
|
|
17
17
|
export type BreakpointName = keyof AppBreakpoints;
|
|
18
18
|
|
|
19
|
-
declare module
|
|
19
|
+
declare module "react-native-unistyles" {
|
|
20
20
|
export interface UnistylesBreakpoints extends AppBreakpoints {}
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -35,7 +35,5 @@ export function resolveBreakpointValue<T>(
|
|
|
35
35
|
values: Record<BreakpointName, T>,
|
|
36
36
|
breakpoint: keyof UnistylesBreakpoints | undefined
|
|
37
37
|
): T {
|
|
38
|
-
return breakpoint !== undefined && breakpoint in values
|
|
39
|
-
? values[breakpoint as BreakpointName]
|
|
40
|
-
: values.xs;
|
|
38
|
+
return breakpoint !== undefined && breakpoint in values ? values[breakpoint as BreakpointName] : values.xs;
|
|
41
39
|
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import Svg, { Circle, Path } from
|
|
1
|
+
import Svg, { Circle, Path } from "react-native-svg";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
TerraIconComponent,
|
|
5
|
-
TerraIconProps,
|
|
6
|
-
TerraSemanticIconName,
|
|
7
|
-
} from '../types';
|
|
3
|
+
import type { TerraIconComponent, TerraIconProps, TerraSemanticIconName } from "../types";
|
|
8
4
|
|
|
9
5
|
const DEFAULT_SIZE = 20;
|
|
10
|
-
const DEFAULT_COLOR =
|
|
6
|
+
const DEFAULT_COLOR = "#000000";
|
|
11
7
|
const DEFAULT_STROKE_WIDTH = 2;
|
|
12
8
|
|
|
13
9
|
const resolveIconProps = ({
|
|
@@ -19,17 +15,11 @@ const resolveIconProps = ({
|
|
|
19
15
|
const strokeProps = (color: string, strokeWidth: number) => ({
|
|
20
16
|
stroke: color,
|
|
21
17
|
strokeWidth,
|
|
22
|
-
strokeLinecap:
|
|
23
|
-
strokeLinejoin:
|
|
18
|
+
strokeLinecap: "round" as const,
|
|
19
|
+
strokeLinejoin: "round" as const,
|
|
24
20
|
});
|
|
25
21
|
|
|
26
|
-
const SvgIcon = ({
|
|
27
|
-
size,
|
|
28
|
-
children,
|
|
29
|
-
}: {
|
|
30
|
-
size: number;
|
|
31
|
-
children: React.ReactNode;
|
|
32
|
-
}) => (
|
|
22
|
+
const SvgIcon = ({ size, children }: { size: number; children: React.ReactNode }) => (
|
|
33
23
|
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
34
24
|
{children}
|
|
35
25
|
</Svg>
|
|
@@ -64,9 +54,7 @@ const ForwardIcon: TerraIconComponent = (props) => (
|
|
|
64
54
|
/>
|
|
65
55
|
);
|
|
66
56
|
|
|
67
|
-
const CloseIcon: TerraIconComponent = (props) =>
|
|
68
|
-
<PathIcon d="M18 6L6 18M6 6l12 12" {...props} />
|
|
69
|
-
);
|
|
57
|
+
const CloseIcon: TerraIconComponent = (props) => <PathIcon d="M18 6L6 18M6 6l12 12" {...props} />;
|
|
70
58
|
|
|
71
59
|
const InfoIcon: TerraIconComponent = (props) => {
|
|
72
60
|
const { color, size, strokeWidth } = resolveIconProps(props);
|
|
@@ -99,10 +87,7 @@ const WarningIcon: TerraIconComponent = (props) => {
|
|
|
99
87
|
|
|
100
88
|
return (
|
|
101
89
|
<SvgIcon size={size}>
|
|
102
|
-
<Path
|
|
103
|
-
d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"
|
|
104
|
-
{...stroke}
|
|
105
|
-
/>
|
|
90
|
+
<Path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" {...stroke} />
|
|
106
91
|
<Path d="M12 9v4" {...stroke} />
|
|
107
92
|
<Path d="M12 17h.01" {...stroke} />
|
|
108
93
|
</SvgIcon>
|
|
@@ -136,12 +121,12 @@ export const PersonIcon: TerraIconComponent = (props) => {
|
|
|
136
121
|
};
|
|
137
122
|
|
|
138
123
|
export const defaultIcons: Record<TerraSemanticIconName, TerraIconComponent> = {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
124
|
+
"navigation.back": BackIcon,
|
|
125
|
+
"navigation.forward": ForwardIcon,
|
|
126
|
+
"navigation.close": CloseIcon,
|
|
127
|
+
"status.info": InfoIcon,
|
|
128
|
+
"status.success": SuccessIcon,
|
|
129
|
+
"status.warning": WarningIcon,
|
|
130
|
+
"status.danger": DangerIcon,
|
|
146
131
|
person: PersonIcon,
|
|
147
132
|
};
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import { createElement } from
|
|
2
|
-
import { Image, Platform } from
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { Image, Platform } from "react-native";
|
|
3
3
|
|
|
4
|
-
import type { TerraImageComponent, TerraImageContentFit } from
|
|
4
|
+
import type { TerraImageComponent, TerraImageContentFit } from "../types";
|
|
5
5
|
|
|
6
6
|
const CONTENT_FIT_MAP = {
|
|
7
|
-
cover:
|
|
8
|
-
contain:
|
|
9
|
-
fill:
|
|
10
|
-
} as const satisfies Record<
|
|
11
|
-
TerraImageContentFit,
|
|
12
|
-
'cover' | 'contain' | 'stretch'
|
|
13
|
-
>;
|
|
7
|
+
cover: "cover",
|
|
8
|
+
contain: "contain",
|
|
9
|
+
fill: "stretch",
|
|
10
|
+
} as const satisfies Record<TerraImageContentFit, "cover" | "contain" | "stretch">;
|
|
14
11
|
|
|
15
12
|
/** Default image implementation, backed by React Native's `Image`. */
|
|
16
13
|
export const defaultImage: TerraImageComponent = ({
|
|
17
|
-
contentFit =
|
|
14
|
+
contentFit = "cover",
|
|
18
15
|
source,
|
|
19
16
|
style,
|
|
20
17
|
accessibilityLabel,
|
|
@@ -29,9 +26,7 @@ export const defaultImage: TerraImageComponent = ({
|
|
|
29
26
|
// `defaultSource` (iOS only) and `loadingIndicatorSource` (Android only).
|
|
30
27
|
// Only one may be set — Android's Image throws outright when it is handed
|
|
31
28
|
// both — so the placeholder goes to whichever this platform reads.
|
|
32
|
-
...(Platform.OS ===
|
|
33
|
-
? { loadingIndicatorSource: placeholder }
|
|
34
|
-
: { defaultSource: placeholder }),
|
|
29
|
+
...(Platform.OS === "android" ? { loadingIndicatorSource: placeholder } : { defaultSource: placeholder }),
|
|
35
30
|
resizeMode: CONTENT_FIT_MAP[contentFit],
|
|
36
31
|
onError: onError ? () => onError() : undefined,
|
|
37
32
|
});
|
package/src/theme/index.ts
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
// resolved `defaultLightTheme` / `defaultDarkTheme` are the public surface.
|
|
7
7
|
|
|
8
8
|
// ─── Utilities (color resolution + accent/merge/typography helpers) ──────────
|
|
9
|
-
export { normalizeAccent } from
|
|
10
|
-
export { readableOn, shade, withAlpha } from
|
|
11
|
-
export type { DeepPartial } from
|
|
12
|
-
export { deepMerge } from
|
|
13
|
-
export { resolveThemeColor } from
|
|
14
|
-
export { FONT_WEIGHT_VALUE, SYSTEM_FONT } from
|
|
9
|
+
export { normalizeAccent } from "#utils/accent-utils";
|
|
10
|
+
export { readableOn, shade, withAlpha } from "#utils/color-utils";
|
|
11
|
+
export type { DeepPartial } from "#utils/deep-merge";
|
|
12
|
+
export { deepMerge } from "#utils/deep-merge";
|
|
13
|
+
export { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
14
|
+
export { FONT_WEIGHT_VALUE, SYSTEM_FONT } from "#utils/typography";
|
|
15
15
|
// ─── Breakpoints ─────────────────────────────────────────────────────────────
|
|
16
|
-
export type { AppBreakpoints, BreakpointName } from
|
|
17
|
-
export { breakpoints, resolveBreakpointValue } from
|
|
16
|
+
export type { AppBreakpoints, BreakpointName } from "./breakpoints";
|
|
17
|
+
export { breakpoints, resolveBreakpointValue } from "./breakpoints";
|
|
18
18
|
// ─── Config + runtime ───────────────────────────────────────────────────────
|
|
19
19
|
export {
|
|
20
20
|
configureTerraUI,
|
|
@@ -26,12 +26,12 @@ export {
|
|
|
26
26
|
getRequiredIcon,
|
|
27
27
|
getSurfaceElevation,
|
|
28
28
|
resolveTheme,
|
|
29
|
-
} from
|
|
30
|
-
export { applyAccent, applyScheme, getCurrentAccent } from
|
|
31
|
-
export type { ResolvedScreenMargin } from
|
|
32
|
-
export { resolveScreenMargin } from
|
|
29
|
+
} from "./registry";
|
|
30
|
+
export { applyAccent, applyScheme, getCurrentAccent } from "./runtime";
|
|
31
|
+
export type { ResolvedScreenMargin } from "./screen-margin";
|
|
32
|
+
export { resolveScreenMargin } from "./screen-margin";
|
|
33
33
|
// ─── Default themes ───────────────────────────────────────────────────────────
|
|
34
|
-
export { defaultDarkTheme, defaultLightTheme } from
|
|
34
|
+
export { defaultDarkTheme, defaultLightTheme } from "./theme";
|
|
35
35
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
36
36
|
export type {
|
|
37
37
|
Accent,
|
|
@@ -74,4 +74,4 @@ export type {
|
|
|
74
74
|
ThemeRadiusOverride,
|
|
75
75
|
TypeStyle,
|
|
76
76
|
Typography,
|
|
77
|
-
} from
|
|
77
|
+
} from "./types";
|