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
package/src/theme/types.ts
CHANGED
|
@@ -4,55 +4,45 @@
|
|
|
4
4
|
* untyped (Figma-generated); these types describe the runtime theme that the
|
|
5
5
|
* data is unflattened into, plus the public configuration surface.
|
|
6
6
|
*/
|
|
7
|
-
import type { ComponentType } from
|
|
8
|
-
import type { ImageStyle, StyleProp } from
|
|
7
|
+
import type { ComponentType } from "react";
|
|
8
|
+
import type { ImageStyle, StyleProp } from "react-native";
|
|
9
9
|
|
|
10
|
-
import type { DeepPartial } from
|
|
11
|
-
|
|
12
|
-
import type { BreakpointName } from './breakpoints';
|
|
10
|
+
import type { DeepPartial } from "#utils/deep-merge";
|
|
11
|
+
import type { BreakpointName } from "./breakpoints";
|
|
13
12
|
|
|
14
13
|
// ─── Scale keys (declared explicitly; token data is untyped) ────────────────
|
|
15
14
|
|
|
16
15
|
/** Spacing scale keys (dp, 4dp base unit). Read as `gap={3}` → string '3'. */
|
|
17
16
|
export type SpacingKey =
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
17
|
+
| "0"
|
|
18
|
+
| "1"
|
|
19
|
+
| "2"
|
|
20
|
+
| "3"
|
|
21
|
+
| "4"
|
|
22
|
+
| "5"
|
|
23
|
+
| "6"
|
|
24
|
+
| "7"
|
|
25
|
+
| "8"
|
|
26
|
+
| "9"
|
|
27
|
+
| "10"
|
|
28
|
+
| "12"
|
|
29
|
+
| "14"
|
|
30
|
+
| "16"
|
|
31
|
+
| "20"
|
|
32
|
+
| "24"
|
|
33
|
+
| "32";
|
|
35
34
|
|
|
36
35
|
/** Border-radius scale keys. */
|
|
37
|
-
export type RadiusKey =
|
|
38
|
-
| 'none'
|
|
39
|
-
| 'xs'
|
|
40
|
-
| 'sm'
|
|
41
|
-
| 'md'
|
|
42
|
-
| 'lg'
|
|
43
|
-
| 'xl'
|
|
44
|
-
| '2xl'
|
|
45
|
-
| '3xl'
|
|
46
|
-
| 'full';
|
|
36
|
+
export type RadiusKey = "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full";
|
|
47
37
|
|
|
48
38
|
/**
|
|
49
39
|
* The radius tokens offered as a component default. Excludes the extreme/rare
|
|
50
40
|
* steps (`xs`, `2xl`, `3xl`).
|
|
51
41
|
*/
|
|
52
|
-
export type DefaultRadiusToken =
|
|
42
|
+
export type DefaultRadiusToken = "sm" | "md" | "lg" | "xl" | "full";
|
|
53
43
|
|
|
54
44
|
/** Components whose default appearance can be configured. */
|
|
55
|
-
export type RadiusComponent =
|
|
45
|
+
export type RadiusComponent = "button" | "surface";
|
|
56
46
|
|
|
57
47
|
// ─── Elevation ──────────────────────────────────────────────────────────────
|
|
58
48
|
|
|
@@ -66,35 +56,35 @@ export interface ElevationStyle {
|
|
|
66
56
|
elevation: number;
|
|
67
57
|
}
|
|
68
58
|
|
|
69
|
-
export type ElevationKey =
|
|
59
|
+
export type ElevationKey = "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
70
60
|
|
|
71
61
|
export type ElevationScale = Record<ElevationKey, ElevationStyle>;
|
|
72
62
|
|
|
73
63
|
// ─── Typography ──────────────────────────────────────────────────────────────
|
|
74
64
|
|
|
75
65
|
export type RoleTextVariant =
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
93
|
-
export type HeadingTextVariant =
|
|
66
|
+
| "display-lg"
|
|
67
|
+
| "display-md"
|
|
68
|
+
| "display-sm"
|
|
69
|
+
| "headline-lg"
|
|
70
|
+
| "headline-md"
|
|
71
|
+
| "headline-sm"
|
|
72
|
+
| "title-lg"
|
|
73
|
+
| "title-md"
|
|
74
|
+
| "title-sm"
|
|
75
|
+
| "body-lg"
|
|
76
|
+
| "body-md"
|
|
77
|
+
| "body-sm"
|
|
78
|
+
| "label-lg"
|
|
79
|
+
| "label-md"
|
|
80
|
+
| "label-sm"
|
|
81
|
+
| "caption";
|
|
82
|
+
|
|
83
|
+
export type HeadingTextVariant = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
94
84
|
|
|
95
85
|
export type TextVariant = RoleTextVariant | HeadingTextVariant;
|
|
96
86
|
|
|
97
|
-
export type FontWeightToken =
|
|
87
|
+
export type FontWeightToken = "regular" | "medium" | "semibold" | "bold";
|
|
98
88
|
|
|
99
89
|
export interface TypeStyle {
|
|
100
90
|
fontSize: number;
|
|
@@ -138,78 +128,78 @@ export interface ThemeColor {
|
|
|
138
128
|
// shadow color (used as elevation.*.shadowColor)
|
|
139
129
|
shadow: string;
|
|
140
130
|
// surfaces
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
131
|
+
"surface.default": string;
|
|
132
|
+
"surface.raised": string;
|
|
133
|
+
"surface.sunken": string;
|
|
134
|
+
"surface.overlay": string;
|
|
135
|
+
"surface.accent": string;
|
|
136
|
+
"surface.accent.subtle": string;
|
|
147
137
|
// text / icons
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
138
|
+
"text.default": string;
|
|
139
|
+
"text.muted": string;
|
|
140
|
+
"text.subtle": string;
|
|
141
|
+
"text.disabled": string;
|
|
142
|
+
"text.inverse": string;
|
|
143
|
+
"text.link": string;
|
|
144
|
+
"text.accent": string;
|
|
145
|
+
"text.on-accent": string;
|
|
146
|
+
"text.on-accent-subtle": string;
|
|
157
147
|
// borders
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
"border.subtle": string;
|
|
149
|
+
"border.default": string;
|
|
150
|
+
"border.strong": string;
|
|
151
|
+
"border.focus": string;
|
|
152
|
+
"border.accent": string;
|
|
163
153
|
// interactive actions
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
154
|
+
"action.bg.primary": string;
|
|
155
|
+
"action.bg.primary.hover": string;
|
|
156
|
+
"action.bg.primary.active": string;
|
|
157
|
+
"action.bg.primary.disabled": string;
|
|
158
|
+
"action.fg.primary": string;
|
|
159
|
+
"action.bg.primary.subtle": string;
|
|
160
|
+
"action.bg.primary.subtle.hover": string;
|
|
161
|
+
"action.bg.primary.subtle.active": string;
|
|
162
|
+
"action.bg.primary.subtle.disabled": string;
|
|
163
|
+
"action.fg.primary.subtle": string;
|
|
164
|
+
"action.bg.secondary": string;
|
|
165
|
+
"action.fg.secondary": string;
|
|
166
|
+
"action.bg.secondary.subtle": string;
|
|
167
|
+
"action.bg.secondary.subtle.hover": string;
|
|
168
|
+
"action.bg.secondary.subtle.active": string;
|
|
169
|
+
"action.bg.secondary.subtle.disabled": string;
|
|
170
|
+
"action.fg.secondary.subtle": string;
|
|
181
171
|
// status — success
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
172
|
+
"status.success": string;
|
|
173
|
+
"status.success.bg": string;
|
|
174
|
+
"status.success.bg.subtle": string;
|
|
175
|
+
"status.success.border": string;
|
|
176
|
+
"status.success.border.subtle": string;
|
|
177
|
+
"status.success.fg": string;
|
|
178
|
+
"status.success.fg.subtle": string;
|
|
189
179
|
// status — warning
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
180
|
+
"status.warning": string;
|
|
181
|
+
"status.warning.bg": string;
|
|
182
|
+
"status.warning.bg.subtle": string;
|
|
183
|
+
"status.warning.border": string;
|
|
184
|
+
"status.warning.border.subtle": string;
|
|
185
|
+
"status.warning.fg": string;
|
|
186
|
+
"status.warning.fg.subtle": string;
|
|
197
187
|
// status — danger
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
188
|
+
"status.danger": string;
|
|
189
|
+
"status.danger.bg": string;
|
|
190
|
+
"status.danger.bg.subtle": string;
|
|
191
|
+
"status.danger.border": string;
|
|
192
|
+
"status.danger.border.subtle": string;
|
|
193
|
+
"status.danger.fg": string;
|
|
194
|
+
"status.danger.fg.subtle": string;
|
|
205
195
|
// status — info
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
196
|
+
"status.info": string;
|
|
197
|
+
"status.info.bg": string;
|
|
198
|
+
"status.info.bg.subtle": string;
|
|
199
|
+
"status.info.border": string;
|
|
200
|
+
"status.info.border.subtle": string;
|
|
201
|
+
"status.info.fg": string;
|
|
202
|
+
"status.info.fg.subtle": string;
|
|
213
203
|
}
|
|
214
204
|
|
|
215
205
|
// ─── Full theme ──────────────────────────────────────────────────────────────
|
|
@@ -253,7 +243,7 @@ export interface TerraTheme {
|
|
|
253
243
|
|
|
254
244
|
// ─── Color token paths (component prop surface) ──────────────────────────────
|
|
255
245
|
|
|
256
|
-
export type BackgroundColorToken =
|
|
246
|
+
export type BackgroundColorToken = "background";
|
|
257
247
|
export type SurfaceColorToken = Extract<keyof ThemeColor, `surface.${string}`>;
|
|
258
248
|
export type TextColorToken = Extract<keyof ThemeColor, `text.${string}`>;
|
|
259
249
|
export type BorderColorToken = Extract<keyof ThemeColor, `border.${string}`>;
|
|
@@ -280,7 +270,7 @@ export type ColorToken =
|
|
|
280
270
|
|
|
281
271
|
// ─── Configuration / accents ─────────────────────────────────────────────────
|
|
282
272
|
|
|
283
|
-
export type Scheme =
|
|
273
|
+
export type Scheme = "light" | "dark";
|
|
284
274
|
|
|
285
275
|
/** A hue shorthand per scheme — expands to primary + accent token patches. */
|
|
286
276
|
export interface AccentShorthand {
|
|
@@ -313,7 +303,7 @@ export type TerraIconComponent = ComponentType<TerraIconProps>;
|
|
|
313
303
|
|
|
314
304
|
// ─── Image ───────────────────────────────────────────────────────────────────
|
|
315
305
|
|
|
316
|
-
export type TerraImageContentFit =
|
|
306
|
+
export type TerraImageContentFit = "cover" | "contain" | "fill";
|
|
317
307
|
|
|
318
308
|
export interface TerraImageProps {
|
|
319
309
|
source: { uri: string } | number;
|
|
@@ -322,6 +312,21 @@ export interface TerraImageProps {
|
|
|
322
312
|
contentFit?: TerraImageContentFit;
|
|
323
313
|
/** Shown while `source` is loading (and if it fails to resolve). */
|
|
324
314
|
placeholder?: { uri: string } | number;
|
|
315
|
+
/**
|
|
316
|
+
* How `placeholder` fits its container. Defaults to matching `contentFit`
|
|
317
|
+
* — the expo-image backend otherwise defaults placeholders to
|
|
318
|
+
* `'scale-down'` regardless of `contentFit`, which renders a
|
|
319
|
+
* same-resolution placeholder visibly smaller than the loaded image.
|
|
320
|
+
* No-op on the default React Native `Image` backend.
|
|
321
|
+
*/
|
|
322
|
+
placeholderContentFit?: TerraImageContentFit;
|
|
323
|
+
/**
|
|
324
|
+
* Identifies this image across recycled views (e.g. FlashList cells).
|
|
325
|
+
* Changing it resets the view to blank/placeholder before the new source
|
|
326
|
+
* loads, instead of holding the previous cell's bitmap during recycling.
|
|
327
|
+
* No-op on the default React Native `Image` backend.
|
|
328
|
+
*/
|
|
329
|
+
recyclingKey?: string | null;
|
|
325
330
|
onError?: () => void;
|
|
326
331
|
}
|
|
327
332
|
|
|
@@ -336,20 +341,20 @@ declare global {
|
|
|
336
341
|
export interface TerraIconRegistry extends TerraUI.IconRegistry {}
|
|
337
342
|
|
|
338
343
|
export type TerraSemanticIconName =
|
|
339
|
-
|
|
|
340
|
-
|
|
|
341
|
-
|
|
|
342
|
-
|
|
|
343
|
-
|
|
|
344
|
-
|
|
|
345
|
-
|
|
|
346
|
-
|
|
|
344
|
+
| "navigation.back"
|
|
345
|
+
| "navigation.forward"
|
|
346
|
+
| "navigation.close"
|
|
347
|
+
| "status.info"
|
|
348
|
+
| "status.success"
|
|
349
|
+
| "status.warning"
|
|
350
|
+
| "status.danger"
|
|
351
|
+
| "person";
|
|
347
352
|
|
|
348
353
|
export type TerraConfiguredIconName = keyof TerraIconRegistry & string;
|
|
349
354
|
|
|
350
355
|
export type TerraIconName = TerraSemanticIconName | TerraConfiguredIconName;
|
|
351
356
|
|
|
352
|
-
export type ThemeRadiusOverride = DeepPartial<TerraTheme[
|
|
357
|
+
export type ThemeRadiusOverride = DeepPartial<TerraTheme["radius"]> & {
|
|
353
358
|
/**
|
|
354
359
|
* Base corner radius in dp — the `lg` (×1) step. The rest of the scale is
|
|
355
360
|
* derived by fixed multipliers (`xs` ×0.25, `sm` ×0.5, `md` ×0.75,
|
|
@@ -359,7 +364,7 @@ export type ThemeRadiusOverride = DeepPartial<TerraTheme['radius']> & {
|
|
|
359
364
|
base?: number;
|
|
360
365
|
};
|
|
361
366
|
|
|
362
|
-
export type ThemeSpacingOverride = DeepPartial<TerraTheme[
|
|
367
|
+
export type ThemeSpacingOverride = DeepPartial<TerraTheme["spacing"]> & {
|
|
363
368
|
/**
|
|
364
369
|
* Base spacing unit in dp. Every step's value is its key multiplied by this
|
|
365
370
|
* base (e.g. `'5'` → `5 × base`). Per-step spacing overrides still win over
|
|
@@ -369,9 +374,7 @@ export type ThemeSpacingOverride = DeepPartial<TerraTheme['spacing']> & {
|
|
|
369
374
|
};
|
|
370
375
|
|
|
371
376
|
/** Theme override accepted at configure time. */
|
|
372
|
-
export type TerraThemeOverride = DeepPartial<
|
|
373
|
-
Omit<TerraTheme, 'radius' | 'spacing'>
|
|
374
|
-
> & {
|
|
377
|
+
export type TerraThemeOverride = DeepPartial<Omit<TerraTheme, "radius" | "spacing">> & {
|
|
375
378
|
radius?: ThemeRadiusOverride;
|
|
376
379
|
spacing?: ThemeSpacingOverride;
|
|
377
380
|
};
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
NormalizedAccent,
|
|
5
|
-
TerraTheme,
|
|
6
|
-
} from '#theme/types';
|
|
7
|
-
|
|
8
|
-
import { readableOn, shade, withAlpha } from './color-utils';
|
|
9
|
-
import type { DeepPartial } from './deep-merge';
|
|
1
|
+
import type { Accent, AccentShorthand, NormalizedAccent, TerraTheme } from "#theme/types";
|
|
2
|
+
import { readableOn, shade, withAlpha } from "./color-utils";
|
|
3
|
+
import type { DeepPartial } from "./deep-merge";
|
|
10
4
|
|
|
11
5
|
const isShorthand = (accent: Accent): accent is AccentShorthand =>
|
|
12
|
-
typeof (accent as AccentShorthand).light ===
|
|
13
|
-
typeof (accent as AccentShorthand).dark ===
|
|
6
|
+
typeof (accent as AccentShorthand).light === "string" ||
|
|
7
|
+
typeof (accent as AccentShorthand).dark === "string";
|
|
14
8
|
|
|
15
9
|
/**
|
|
16
10
|
* Expands a single hue into a fuller per-scheme patch so primary AND subtle
|
|
@@ -21,27 +15,24 @@ const isShorthand = (accent: Accent): accent is AccentShorthand =>
|
|
|
21
15
|
*
|
|
22
16
|
* On `light` the hover/active darken; on `dark` they lighten.
|
|
23
17
|
*/
|
|
24
|
-
function hueToPartial(
|
|
25
|
-
hue: string | undefined,
|
|
26
|
-
scheme: 'light' | 'dark'
|
|
27
|
-
): DeepPartial<TerraTheme> {
|
|
18
|
+
function hueToPartial(hue: string | undefined, scheme: "light" | "dark"): DeepPartial<TerraTheme> {
|
|
28
19
|
if (!hue) return {};
|
|
29
|
-
const dir = scheme ===
|
|
30
|
-
const isLight = scheme ===
|
|
20
|
+
const dir = scheme === "light" ? -1 : 1;
|
|
21
|
+
const isLight = scheme === "light";
|
|
31
22
|
const fg = readableOn(hue);
|
|
32
23
|
// Flat color keys to patch — deepMerge replaces string leaves directly.
|
|
33
24
|
const color = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
25
|
+
"action.bg.primary": hue,
|
|
26
|
+
"action.fg.primary": fg,
|
|
27
|
+
"action.bg.primary.hover": shade(hue, dir * 0.12),
|
|
28
|
+
"action.bg.primary.active": shade(hue, dir * 0.24),
|
|
29
|
+
"action.bg.primary.subtle": withAlpha(hue, isLight ? 0.12 : 0.2),
|
|
30
|
+
"action.fg.primary.subtle": hue,
|
|
31
|
+
"action.bg.primary.subtle.hover": withAlpha(hue, isLight ? 0.18 : 0.28),
|
|
32
|
+
"action.bg.primary.subtle.active": withAlpha(hue, isLight ? 0.24 : 0.36),
|
|
33
|
+
"text.accent": hue,
|
|
34
|
+
"text.link": hue,
|
|
35
|
+
"text.on-accent": fg,
|
|
45
36
|
};
|
|
46
37
|
return { color } as unknown as DeepPartial<TerraTheme>;
|
|
47
38
|
}
|
|
@@ -50,8 +41,8 @@ function hueToPartial(
|
|
|
50
41
|
export function normalizeAccent(accent: Accent): NormalizedAccent {
|
|
51
42
|
if (isShorthand(accent)) {
|
|
52
43
|
return {
|
|
53
|
-
light: hueToPartial(accent.light,
|
|
54
|
-
dark: hueToPartial(accent.dark,
|
|
44
|
+
light: hueToPartial(accent.light, "light"),
|
|
45
|
+
dark: hueToPartial(accent.dark, "dark"),
|
|
55
46
|
};
|
|
56
47
|
}
|
|
57
48
|
return { light: accent.light ?? {}, dark: accent.dark ?? {} };
|
package/src/utils/color-utils.ts
CHANGED
|
@@ -16,7 +16,7 @@ function parseHex(hex: string): RGB | null {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const toHex = ({ r, g, b }: RGB): string =>
|
|
19
|
-
`#${[r, g, b].map((v) => clamp(v).toString(16).padStart(2,
|
|
19
|
+
`#${[r, g, b].map((v) => clamp(v).toString(16).padStart(2, "0")).join("")}`;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Shifts a hex color toward black (negative `amount`) or white (positive),
|
|
@@ -44,8 +44,8 @@ export function withAlpha(hex: string, alpha: number): string {
|
|
|
44
44
|
/** Picks black or white for legible text/icons on top of `hex`. */
|
|
45
45
|
export function readableOn(hex: string): string {
|
|
46
46
|
const c = parseHex(hex);
|
|
47
|
-
if (!c) return
|
|
47
|
+
if (!c) return "#ffffff";
|
|
48
48
|
// Perceived luminance (0–1).
|
|
49
49
|
const luminance = (0.299 * c.r + 0.587 * c.g + 0.114 * c.b) / 255;
|
|
50
|
-
return luminance > 0.6 ?
|
|
50
|
+
return luminance > 0.6 ? "#000000" : "#ffffff";
|
|
51
51
|
}
|
package/src/utils/deep-merge.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type DeepPartial<T> = T extends (infer U)[]
|
|
|
6
6
|
: T;
|
|
7
7
|
|
|
8
8
|
const isPlainObject = (value: unknown): value is Record<string, unknown> =>
|
|
9
|
-
typeof value ===
|
|
9
|
+
typeof value === "object" &&
|
|
10
10
|
value !== null &&
|
|
11
11
|
!Array.isArray(value) &&
|
|
12
12
|
Object.getPrototypeOf(value) === Object.prototype;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ColorToken, TerraTheme } from
|
|
1
|
+
import type { ColorToken, TerraTheme } from "#theme/types";
|
|
2
2
|
|
|
3
3
|
const isColorLiteral = (value: string): boolean =>
|
|
4
|
-
value.startsWith(
|
|
5
|
-
value.startsWith(
|
|
6
|
-
value.startsWith(
|
|
7
|
-
value ===
|
|
8
|
-
value ===
|
|
4
|
+
value.startsWith("#") ||
|
|
5
|
+
value.startsWith("rgb") ||
|
|
6
|
+
value.startsWith("hsl") ||
|
|
7
|
+
value === "transparent" ||
|
|
8
|
+
value === "currentColor";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Resolves a {@link ColorToken} to a concrete color string using the theme.
|
|
@@ -16,12 +16,9 @@ const isColorLiteral = (value: string): boolean =>
|
|
|
16
16
|
* resolveThemeColor('action.bg.primary', theme) // → '#009966'
|
|
17
17
|
* resolveThemeColor('#ff0000', theme) // → '#ff0000'
|
|
18
18
|
*/
|
|
19
|
-
export function resolveThemeColor(
|
|
20
|
-
token: ColorToken | undefined,
|
|
21
|
-
theme: TerraTheme
|
|
22
|
-
): string | undefined {
|
|
19
|
+
export function resolveThemeColor(token: ColorToken | undefined, theme: TerraTheme): string | undefined {
|
|
23
20
|
if (!token) return undefined;
|
|
24
21
|
if (isColorLiteral(token)) return token;
|
|
25
22
|
const value = (theme.color as unknown as Record<string, unknown>)[token];
|
|
26
|
-
return typeof value ===
|
|
23
|
+
return typeof value === "string" ? value : undefined;
|
|
27
24
|
}
|
package/src/utils/typography.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import type { FontWeightToken } from
|
|
1
|
+
import type { FontWeightToken } from "#theme/types";
|
|
2
2
|
|
|
3
3
|
/** RN's sentinel for the platform default font (SF on iOS, Roboto on Android). */
|
|
4
|
-
export const SYSTEM_FONT =
|
|
4
|
+
export const SYSTEM_FONT = "System";
|
|
5
5
|
|
|
6
6
|
/** Numeric fontWeight applied when a weight token maps to the system font. */
|
|
7
|
-
export const FONT_WEIGHT_VALUE: Record<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
medium: '500',
|
|
13
|
-
semibold: '600',
|
|
14
|
-
bold: '700',
|
|
7
|
+
export const FONT_WEIGHT_VALUE: Record<FontWeightToken, "400" | "500" | "600" | "700"> = {
|
|
8
|
+
regular: "400",
|
|
9
|
+
medium: "500",
|
|
10
|
+
semibold: "600",
|
|
11
|
+
bold: "700",
|
|
15
12
|
};
|
package/src/utils/unflatten.ts
CHANGED
|
@@ -12,14 +12,14 @@ export function unflatten<T = unknown>(flat: Record<string, unknown>): T {
|
|
|
12
12
|
const root: Record<string, unknown> = {};
|
|
13
13
|
|
|
14
14
|
for (const [path, value] of Object.entries(flat)) {
|
|
15
|
-
const segments = path.split(
|
|
15
|
+
const segments = path.split(".");
|
|
16
16
|
let node = root;
|
|
17
17
|
|
|
18
18
|
for (let i = 0; i < segments.length - 1; i++) {
|
|
19
19
|
const seg = segments[i];
|
|
20
20
|
if (seg === undefined) continue;
|
|
21
21
|
const next = node[seg];
|
|
22
|
-
if (typeof next ===
|
|
22
|
+
if (typeof next === "object" && next !== null) {
|
|
23
23
|
node = next as Record<string, unknown>;
|
|
24
24
|
} else {
|
|
25
25
|
const created: Record<string, unknown> = {};
|