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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.6.0](https://github.com/earthlin9/react-native-terra-ui/compare/v0.5.1...v0.6.0) (2026-09-03)
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* **ui:** Box's `bg` style-prop is renamed to `background` for
|
|
8
|
+
clarity and consistency with the rest of the token-prop API. Surface
|
|
9
|
+
(built on Box) and the showcase screens that used `bg` are updated to
|
|
10
|
+
match.
|
|
11
|
+
* **ui:** Button's sm/md/lg sizes now set a fixed `height`
|
|
12
|
+
(36/44/52) instead of `minHeight`, so content taller than that height
|
|
13
|
+
is clipped/centered instead of growing the button. `compact` continues
|
|
14
|
+
to opt out of the fixed height.
|
|
15
|
+
|
|
16
|
+
Also adds a `background` prop that overrides the variant's resolved
|
|
17
|
+
background color (theme token or raw CSS literal); the label/icon/
|
|
18
|
+
spinner foreground auto-picks light or dark for contrast. `border`/
|
|
19
|
+
`borderWidth` still come from `variant`.
|
|
20
|
+
* **ui:** Screen's `bg` prop is renamed to `background`,
|
|
21
|
+
matching Box's rename for consistency across the library's color-prop
|
|
22
|
+
naming.
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* **ui:** fixed button height, background override, bg→background rename ([#13](https://github.com/earthlin9/react-native-terra-ui/issues/13)) ([22df267](https://github.com/earthlin9/react-native-terra-ui/commit/22df2674bacc6f03f92bb2945894e566f6f1673f))
|
|
27
|
+
|
|
28
|
+
## [0.5.1](https://github.com/earthlin9/react-native-terra-ui/compare/v0.5.0...v0.5.1) (2026-08-30)
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **ui:** [image] default placeholderContentFit to contentFit, add recyclingKey ([da5a6df](https://github.com/earthlin9/react-native-terra-ui/commit/da5a6df2bd62e99436aa2315aaa8a02117af7d25))
|
|
33
|
+
|
|
3
34
|
## [0.5.0](https://github.com/earthlin9/react-native-terra-ui/compare/v0.4.1...v0.5.0) (2026-08-29)
|
|
4
35
|
|
|
5
36
|
### ⚠ BREAKING CHANGES
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { View } from "react-native-unistyles/components/native/View";
|
|
4
4
|
import { Text } from "react-native-unistyles/components/native/Text";
|
|
5
|
-
import { useState } from
|
|
6
|
-
import { StyleSheet, useUnistyles } from
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
|
7
7
|
import { Icon } from "../icon/index.js";
|
|
8
8
|
import { Image } from "../image/index.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -23,13 +23,13 @@ const INITIALS_FONT_SIZE = {
|
|
|
23
23
|
};
|
|
24
24
|
function getInitials(name) {
|
|
25
25
|
const parts = name.trim().split(/\s+/);
|
|
26
|
-
const first = parts[0]?.[0] ??
|
|
27
|
-
const last = parts.length > 1 ? parts[parts.length - 1]?.[0] ??
|
|
26
|
+
const first = parts[0]?.[0] ?? "";
|
|
27
|
+
const last = parts.length > 1 ? parts[parts.length - 1]?.[0] ?? "" : "";
|
|
28
28
|
return (first + last).toUpperCase();
|
|
29
29
|
}
|
|
30
30
|
function getBorderRadius(shape, sizePx, radiusMd) {
|
|
31
|
-
if (shape ===
|
|
32
|
-
if (shape ===
|
|
31
|
+
if (shape === "circle") return sizePx / 2;
|
|
32
|
+
if (shape === "rounded") return radiusMd;
|
|
33
33
|
return 0;
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -38,19 +38,19 @@ function getBorderRadius(shape, sizePx, radiusMd) {
|
|
|
38
38
|
// `'full'` (theme.radius.full) clamps to a circle at any size, same as the
|
|
39
39
|
// container's computed `sizePx / 2`.
|
|
40
40
|
function getImageRadius(shape) {
|
|
41
|
-
if (shape ===
|
|
42
|
-
if (shape ===
|
|
43
|
-
return
|
|
41
|
+
if (shape === "circle") return "full";
|
|
42
|
+
if (shape === "rounded") return "md";
|
|
43
|
+
return "none";
|
|
44
44
|
}
|
|
45
45
|
export function Avatar({
|
|
46
|
-
size =
|
|
47
|
-
shape =
|
|
46
|
+
size = "md",
|
|
47
|
+
shape = "circle",
|
|
48
48
|
source,
|
|
49
49
|
name,
|
|
50
50
|
fallback,
|
|
51
|
-
contentFit =
|
|
52
|
-
color =
|
|
53
|
-
variant =
|
|
51
|
+
contentFit = "cover",
|
|
52
|
+
color = "secondary",
|
|
53
|
+
variant = "solid",
|
|
54
54
|
style,
|
|
55
55
|
...rest
|
|
56
56
|
}) {
|
|
@@ -67,12 +67,12 @@ export function Avatar({
|
|
|
67
67
|
const sizePx = SIZE_PX[size];
|
|
68
68
|
const borderRadius = getBorderRadius(shape, sizePx, theme.radius.md);
|
|
69
69
|
const showFallback = !source || hasError;
|
|
70
|
-
const bg = styles.base.backgroundColor ??
|
|
71
|
-
const fg = styles.base.color ??
|
|
70
|
+
const bg = styles.base.backgroundColor ?? "";
|
|
71
|
+
const fg = styles.base.color ?? "";
|
|
72
72
|
const fallbackContent = fallback !== undefined ? fallback : name ? /*#__PURE__*/_jsx(Text, {
|
|
73
73
|
style: {
|
|
74
74
|
fontSize: INITIALS_FONT_SIZE[size],
|
|
75
|
-
fontWeight:
|
|
75
|
+
fontWeight: "600",
|
|
76
76
|
color: fg,
|
|
77
77
|
includeFontPadding: false
|
|
78
78
|
},
|
|
@@ -90,9 +90,9 @@ export function Avatar({
|
|
|
90
90
|
height: sizePx,
|
|
91
91
|
borderRadius,
|
|
92
92
|
backgroundColor: bg,
|
|
93
|
-
alignItems:
|
|
94
|
-
justifyContent:
|
|
95
|
-
overflow:
|
|
93
|
+
alignItems: "center",
|
|
94
|
+
justifyContent: "center",
|
|
95
|
+
overflow: "hidden"
|
|
96
96
|
}, style],
|
|
97
97
|
children: showFallback ? fallbackContent : /*#__PURE__*/_jsx(Image, {
|
|
98
98
|
source: source,
|
|
@@ -132,74 +132,74 @@ const styles = StyleSheet.create(theme => {
|
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
compoundVariants: [{
|
|
135
|
-
color:
|
|
136
|
-
variant:
|
|
135
|
+
color: "secondary",
|
|
136
|
+
variant: "solid",
|
|
137
137
|
styles: {
|
|
138
|
-
backgroundColor: c[
|
|
139
|
-
color: c[
|
|
138
|
+
backgroundColor: c["action.bg.secondary"],
|
|
139
|
+
color: c["action.fg.secondary"]
|
|
140
140
|
}
|
|
141
141
|
}, {
|
|
142
|
-
color:
|
|
143
|
-
variant:
|
|
142
|
+
color: "secondary",
|
|
143
|
+
variant: "soft",
|
|
144
144
|
styles: {
|
|
145
|
-
backgroundColor: c[
|
|
146
|
-
color: c[
|
|
145
|
+
backgroundColor: c["action.bg.secondary.subtle"],
|
|
146
|
+
color: c["action.fg.secondary.subtle"]
|
|
147
147
|
}
|
|
148
148
|
}, {
|
|
149
|
-
color:
|
|
150
|
-
variant:
|
|
149
|
+
color: "primary",
|
|
150
|
+
variant: "solid",
|
|
151
151
|
styles: {
|
|
152
|
-
backgroundColor: c[
|
|
153
|
-
color: c[
|
|
152
|
+
backgroundColor: c["action.bg.primary"],
|
|
153
|
+
color: c["action.fg.primary"]
|
|
154
154
|
}
|
|
155
155
|
}, {
|
|
156
|
-
color:
|
|
157
|
-
variant:
|
|
156
|
+
color: "primary",
|
|
157
|
+
variant: "soft",
|
|
158
158
|
styles: {
|
|
159
|
-
backgroundColor: c[
|
|
160
|
-
color: c[
|
|
159
|
+
backgroundColor: c["action.bg.primary.subtle"],
|
|
160
|
+
color: c["action.fg.primary.subtle"]
|
|
161
161
|
}
|
|
162
162
|
}, {
|
|
163
|
-
color:
|
|
164
|
-
variant:
|
|
163
|
+
color: "success",
|
|
164
|
+
variant: "solid",
|
|
165
165
|
styles: {
|
|
166
|
-
backgroundColor: c[
|
|
167
|
-
color: c[
|
|
166
|
+
backgroundColor: c["status.success.bg"],
|
|
167
|
+
color: c["status.success.fg"]
|
|
168
168
|
}
|
|
169
169
|
}, {
|
|
170
|
-
color:
|
|
171
|
-
variant:
|
|
170
|
+
color: "success",
|
|
171
|
+
variant: "soft",
|
|
172
172
|
styles: {
|
|
173
|
-
backgroundColor: c[
|
|
174
|
-
color: c[
|
|
173
|
+
backgroundColor: c["status.success.bg.subtle"],
|
|
174
|
+
color: c["status.success.fg.subtle"]
|
|
175
175
|
}
|
|
176
176
|
}, {
|
|
177
|
-
color:
|
|
178
|
-
variant:
|
|
177
|
+
color: "warning",
|
|
178
|
+
variant: "solid",
|
|
179
179
|
styles: {
|
|
180
|
-
backgroundColor: c[
|
|
181
|
-
color: c[
|
|
180
|
+
backgroundColor: c["status.warning.bg"],
|
|
181
|
+
color: c["status.warning.fg"]
|
|
182
182
|
}
|
|
183
183
|
}, {
|
|
184
|
-
color:
|
|
185
|
-
variant:
|
|
184
|
+
color: "warning",
|
|
185
|
+
variant: "soft",
|
|
186
186
|
styles: {
|
|
187
|
-
backgroundColor: c[
|
|
188
|
-
color: c[
|
|
187
|
+
backgroundColor: c["status.warning.bg.subtle"],
|
|
188
|
+
color: c["status.warning.fg.subtle"]
|
|
189
189
|
}
|
|
190
190
|
}, {
|
|
191
|
-
color:
|
|
192
|
-
variant:
|
|
191
|
+
color: "danger",
|
|
192
|
+
variant: "solid",
|
|
193
193
|
styles: {
|
|
194
|
-
backgroundColor: c[
|
|
195
|
-
color: c[
|
|
194
|
+
backgroundColor: c["status.danger.bg"],
|
|
195
|
+
color: c["status.danger.fg"]
|
|
196
196
|
}
|
|
197
197
|
}, {
|
|
198
|
-
color:
|
|
199
|
-
variant:
|
|
198
|
+
color: "danger",
|
|
199
|
+
variant: "soft",
|
|
200
200
|
styles: {
|
|
201
|
-
backgroundColor: c[
|
|
202
|
-
color: c[
|
|
201
|
+
backgroundColor: c["status.danger.bg.subtle"],
|
|
202
|
+
color: c["status.danger.fg.subtle"]
|
|
203
203
|
}
|
|
204
204
|
}],
|
|
205
205
|
uni__dependencies: [4]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useState","StyleSheet","useUnistyles","Icon","Image","jsx","_jsx","SIZE_PX","xs","sm","md","lg","xl","INITIALS_FONT_SIZE","getInitials","name","parts","trim","split","first","last","length","toUpperCase","getBorderRadius","shape","sizePx","radiusMd","getImageRadius","Avatar","size","source","fallback","contentFit","color","variant","style","rest","theme","hasError","setHasError","_styles","styles","useVariants","borderRadius","radius","showFallback","bg","base","backgroundColor","fg","fallbackContent","undefined","Text","fontSize","fontWeight","includeFontPadding","numberOfLines","children","View","width","height","alignItems","justifyContent","overflow","accessibilityLabel","onError","create","c","variants","secondary","primary","success","warning","danger","solid","soft","compoundVariants","uni__dependencies"],"sourceRoot":"../../../../src","sources":["components/avatar/Avatar.tsx"],"mappings":";;;;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAGhC,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;
|
|
1
|
+
{"version":3,"names":["useState","StyleSheet","useUnistyles","Icon","Image","jsx","_jsx","SIZE_PX","xs","sm","md","lg","xl","INITIALS_FONT_SIZE","getInitials","name","parts","trim","split","first","last","length","toUpperCase","getBorderRadius","shape","sizePx","radiusMd","getImageRadius","Avatar","size","source","fallback","contentFit","color","variant","style","rest","theme","hasError","setHasError","_styles","styles","useVariants","borderRadius","radius","showFallback","bg","base","backgroundColor","fg","fallbackContent","undefined","Text","fontSize","fontWeight","includeFontPadding","numberOfLines","children","View","width","height","alignItems","justifyContent","overflow","accessibilityLabel","onError","create","c","variants","secondary","primary","success","warning","danger","solid","soft","compoundVariants","uni__dependencies"],"sourceRoot":"../../../../src","sources":["components/avatar/Avatar.tsx"],"mappings":";;;;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAGhC,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAGjE,SAASC,IAAI;AACb,SAASC,KAAK;AAAmB,SAAAC,GAAA,IAAAC,IAAA;AAGjC,MAAMC,OAAmC,GAAG;EAC1CC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE;AACN,CAAC;AAED,MAAMC,kBAA8C,GAAG;EACrDL,EAAE,EAAE,CAAC;EACLC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE;AACN,CAAC;AAED,SAASE,WAAWA,CAACC,IAAY,EAAU;EACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,KAAK,CAAC;EACtC,MAAMC,KAAK,GAAGH,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;EACjC,MAAMI,IAAI,GAAGJ,KAAK,CAACK,MAAM,GAAG,CAAC,GAAIL,KAAK,CAACA,KAAK,CAACK,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,GAAI,EAAE;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AAe,EAAEmB,CAAC,CAAC,mBAAmB,CAAC;UACvClC,KAAK,EAAEkC,CAAC,CAAC,mBAAmB;QAC9B;MACF,CAAC,EACD;QACElC,KAAK,EAAE,SAAS;QAChBC,OAAO,EAAE,MAAM;QACfO,MAAM,EAAE;UACNO,eAAe,EAAEmB,CAAC,CAAC,0BAA0B,CAAC;UAC9ClC,KAAK,EAAEkC,CAAC,CAAC,0BAA0B;QACrC;MACF,CAAC,EACD;QACElC,KAAK,EAAE,SAAS;QAChBC,OAAO,EAAE,OAAO;QAChBO,MAAM,EAAE;UACNO,eAAe,EAAEmB,CAAC,CAAC,mBAAmB,CAAC;UACvClC,KAAK,EAAEkC,CAAC,CAAC,mBAAmB;QAC9B;MACF,CAAC,EACD;QACElC,KAAK,EAAE,SAAS;QAChBC,OAAO,EAAE,MAAM;QACfO,MAAM,EAAE;UACNO,eAAe,EAAEmB,CAAC,CAAC,0BAA0B,CAAC;UAC9ClC,KAAK,EAAEkC,CAAC,CAAC,0BAA0B;QACrC;MACF,CAAC,EACD;QACElC,KAAK,EAAE,QAAQ;QACfC,OAAO,EAAE,OAAO;QAChBO,MAAM,EAAE;UACNO,eAAe,EAAEmB,CAAC,CAAC,kBAAkB,CAAC;UACtClC,KAAK,EAAEkC,CAAC,CAAC,kBAAkB;QAC7B;MACF,CAAC,EACD;QACElC,KAAK,EAAE,QAAQ;QACfC,OAAO,EAAE,MAAM;QACfO,MAAM,EAAE;UACNO,eAAe,EAAEmB,CAAC,CAAC,yBAAyB,CAAC;UAC7ClC,KAAK,EAAEkC,CAAC,CAAC,yBAAyB;QACpC;MACF,CAAC,CACF;MAAAU,iBAAA;IACH;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { View } from "react-native-unistyles/components/native/View";
|
|
4
|
-
import { forwardRef } from
|
|
5
|
-
import { StyleSheet, useUnistyles } from
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
|
6
6
|
import { Slot } from "../slot/index.js";
|
|
7
7
|
import { BOX_STYLE_PROP_KEYS, resolveBoxStyle } from "./utils.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","StyleSheet","useUnistyles","Slot","BOX_STYLE_PROP_KEYS","resolveBoxStyle","jsx","_jsx","STYLE_KEYS","Set","Box","asChild","style","children","rest","ref","theme","styleProps","viewProps","key","Object","keys","value","has","mergedStyle","styles","root","ownerName","slotProps","View","create"],"sourceRoot":"../../../../src","sources":["components/box/Box.tsx"],"mappings":";;;AAAA,SAA4BA,UAAU,QAAQ,OAAO;AAGrD,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAEjE,SAASC,IAAI;AACb,
|
|
1
|
+
{"version":3,"names":["forwardRef","StyleSheet","useUnistyles","Slot","BOX_STYLE_PROP_KEYS","resolveBoxStyle","jsx","_jsx","STYLE_KEYS","Set","Box","asChild","style","children","rest","ref","theme","styleProps","viewProps","key","Object","keys","value","has","mergedStyle","styles","root","ownerName","slotProps","View","create"],"sourceRoot":"../../../../src","sources":["components/box/Box.tsx"],"mappings":";;;AAAA,SAA4BA,UAAU,QAAQ,OAAO;AAGrD,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAEjE,SAASC,IAAI;AACb,SAASC,mBAAmB,EAAsBC,eAAe;AAAkB,SAAAC,GAAA,IAAAC,IAAA;AAOnF,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAASL,mBAAwC,CAAC;;AAE5E;AACA;AACA;AACA;AACA,OAAO,MAAMM,GAAG,gBAAGV,UAAU,CAAsC,SAASU,GAAGA,CAC7E;EAAEC,OAAO;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAK,CAAC,EACrCC,GAAG,EACH;EACA,MAAM;IAAEC;EAAM,CAAC,GAAGd,YAAY,CAAC,CAAC;EAEhC,MAAMe,UAAmC,GAAG,CAAC,CAAC;EAC9C,MAAMC,SAAkC,GAAG,CAAC,CAAC;EAC7C,KAAK,MAAMC,GAAG,IAAIC,MAAM,CAACC,IAAI,CAACP,IAAI,CAAC,EAAE;IACnC,MAAMQ,KAAK,GAAIR,IAAI,CAA6BK,GAAG,CAAC;IACpD,IAAIX,UAAU,CAACe,GAAG,CAACJ,GAAG,CAAC,EAAEF,UAAU,CAACE,GAAG,CAAC,GAAGG,KAAK,CAAC,KAC5CJ,SAAS,CAACC,GAAG,CAAC,GAAGG,KAAK;EAC7B;EAEA,MAAME,WAAW,GAAG,CAACC,MAAM,CAACC,IAAI,EAAErB,eAAe,CAACY,UAAU,EAAmBD,KAAK,CAAC,EAAEJ,KAAK,CAAC;EAE7F,IAAID,OAAO,EAAE;IACX,oBACEJ,IAAA,CAACJ,IAAI;MAACwB,SAAS,EAAC,KAAK;MAACC,SAAS,EAAE;QAAE,GAAGV,SAAS;QAAEN,KAAK,EAAEY,WAAW;QAAET;MAAI,CAAE;MAAAF,QAAA,EACxEA;IAAQ,CACL,CAAC;EAEX;EAEA,oBACEN,IAAA,CAACsB,IAAI;IAACd,GAAG,EAAEA,GAAI;IAACH,KAAK,EAAEY,WAAY;IAAA,GAAMN,SAAS;IAAAL,QAAA,EAC/CA;EAAQ,CACL,CAAC;AAEX,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMY,MAAM,GAAGxB,UAAU,CAAC6B,MAAM,CAAC,OAAO;EAAEJ,IAAI,EAAE,CAAC;AAAE,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { StyleSheet } from
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
4
|
import { resolveThemeColor } from "../../utils/resolve-theme-color.js";
|
|
5
5
|
|
|
6
6
|
/** Strips `readonly` so the style object can be built by mutation. */
|
|
@@ -8,19 +8,19 @@ import { resolveThemeColor } from "../../utils/resolve-theme-color.js";
|
|
|
8
8
|
/** Token-driven style props accepted by `Box`. */
|
|
9
9
|
|
|
10
10
|
const ALIGN_MAP = {
|
|
11
|
-
start:
|
|
12
|
-
center:
|
|
13
|
-
end:
|
|
14
|
-
stretch:
|
|
15
|
-
baseline:
|
|
11
|
+
start: "flex-start",
|
|
12
|
+
center: "center",
|
|
13
|
+
end: "flex-end",
|
|
14
|
+
stretch: "stretch",
|
|
15
|
+
baseline: "baseline"
|
|
16
16
|
};
|
|
17
17
|
const JUSTIFY_MAP = {
|
|
18
|
-
start:
|
|
19
|
-
center:
|
|
20
|
-
end:
|
|
21
|
-
between:
|
|
22
|
-
around:
|
|
23
|
-
evenly:
|
|
18
|
+
start: "flex-start",
|
|
19
|
+
center: "center",
|
|
20
|
+
end: "flex-end",
|
|
21
|
+
between: "space-between",
|
|
22
|
+
around: "space-around",
|
|
23
|
+
evenly: "space-evenly"
|
|
24
24
|
};
|
|
25
25
|
const space = (theme, key) => key === undefined ? undefined : theme.spacing[key];
|
|
26
26
|
|
|
@@ -65,23 +65,23 @@ export function resolveBoxStyle(props, theme) {
|
|
|
65
65
|
if (gap !== undefined) style.gap = gap;
|
|
66
66
|
|
|
67
67
|
// Layout
|
|
68
|
-
if (props.row !== undefined) style.flexDirection = props.row ?
|
|
68
|
+
if (props.row !== undefined) style.flexDirection = props.row ? "row" : "column";
|
|
69
69
|
if (props.align !== undefined) style.alignItems = ALIGN_MAP[props.align];
|
|
70
70
|
if (props.justify !== undefined) {
|
|
71
71
|
style.justifyContent = JUSTIFY_MAP[props.justify];
|
|
72
72
|
}
|
|
73
|
-
if (props.wrap !== undefined) style.flexWrap = props.wrap ?
|
|
73
|
+
if (props.wrap !== undefined) style.flexWrap = props.wrap ? "wrap" : "nowrap";
|
|
74
74
|
if (props.flex !== undefined) style.flex = props.flex;
|
|
75
75
|
if (props.alignSelf !== undefined) style.alignSelf = ALIGN_MAP[props.alignSelf];
|
|
76
76
|
|
|
77
77
|
// Visual
|
|
78
|
-
if (props.
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
78
|
+
if (props.background !== undefined) {
|
|
79
|
+
const background = resolveThemeColor(props.background, theme);
|
|
80
|
+
if (background !== undefined) style.backgroundColor = background;
|
|
81
81
|
}
|
|
82
82
|
if (props.radius !== undefined) style.borderRadius = theme.radius[props.radius];
|
|
83
83
|
if (props.borderWidth !== undefined) {
|
|
84
|
-
style.borderWidth = props.borderWidth ===
|
|
84
|
+
style.borderWidth = props.borderWidth === "hairline" ? StyleSheet.hairlineWidth : props.borderWidth;
|
|
85
85
|
}
|
|
86
86
|
if (props.borderColor !== undefined) {
|
|
87
87
|
const borderColor = resolveThemeColor(props.borderColor, theme);
|
|
@@ -94,5 +94,5 @@ export function resolveBoxStyle(props, theme) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/** Keys of {@link BoxStyleProps}, used to split style props from view props. */
|
|
97
|
-
export const BOX_STYLE_PROP_KEYS = [
|
|
97
|
+
export const BOX_STYLE_PROP_KEYS = ["p", "px", "py", "pt", "pr", "pb", "pl", "m", "mx", "my", "mt", "mr", "mb", "ml", "gap", "row", "align", "justify", "wrap", "flex", "alignSelf", "background", "radius", "borderWidth", "borderColor", "elevation"];
|
|
98
98
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","resolveThemeColor","ALIGN_MAP","start","center","end","stretch","baseline","JUSTIFY_MAP","between","around","evenly","space","theme","key","undefined","spacing","resolveBoxStyle","props","style","p","px","py","padding","paddingHorizontal","paddingVertical","pt","pr","pb","pl","paddingTop","paddingRight","paddingBottom","paddingLeft","m","mx","my","margin","marginHorizontal","marginVertical","mt","mr","mb","ml","marginTop","marginRight","marginBottom","marginLeft","gap","row","flexDirection","align","alignItems","justify","justifyContent","wrap","flexWrap","flex","alignSelf","
|
|
1
|
+
{"version":3,"names":["StyleSheet","resolveThemeColor","ALIGN_MAP","start","center","end","stretch","baseline","JUSTIFY_MAP","between","around","evenly","space","theme","key","undefined","spacing","resolveBoxStyle","props","style","p","px","py","padding","paddingHorizontal","paddingVertical","pt","pr","pb","pl","paddingTop","paddingRight","paddingBottom","paddingLeft","m","mx","my","margin","marginHorizontal","marginVertical","mt","mr","mb","ml","marginTop","marginRight","marginBottom","marginLeft","gap","row","flexDirection","align","alignItems","justify","justifyContent","wrap","flexWrap","flex","alignSelf","background","backgroundColor","radius","borderRadius","borderWidth","hairlineWidth","borderColor","elevation","Object","assign","BOX_STYLE_PROP_KEYS"],"sourceRoot":"../../../../src","sources":["components/box/utils.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAwB,cAAc;AAGzD,SAASC,iBAAiB;;AAM1B;;AAGA;;AAsCA,MAAMC,SAA8D,GAAG;EACrEC,KAAK,EAAE,YAAY;EACnBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE,UAAU;EACfC,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE;AACZ,CAAC;AAED,MAAMC,WAAsE,GAAG;EAC7EL,KAAK,EAAE,YAAY;EACnBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE,UAAU;EACfI,OAAO,EAAE,eAAe;EACxBC,MAAM,EAAE,cAAc;EACtBC,MAAM,EAAE;AACV,CAAC;AAED,MAAMC,KAAK,GAAGA,CAACC,KAAiB,EAAEC,GAA2B,KAC3DA,GAAG,KAAKC,SAAS,GAAGA,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACF,GAAG,CAAC;;AAEpD;AACA,OAAO,SAASG,eAAeA,CAACC,KAAoB,EAAEL,KAAiB,EAAa;EAClF,MAAMM,KAAyB,GAAG,CAAC,CAAC;;EAEpC;EACA,MAAMC,CAAC,GAAGR,KAAK,CAACC,KAAK,EAAEK,KAAK,CAACE,CAAC,CAAC;EAC/B,MAAMC,EAAE,GAAGT,KAAK,CAACC,K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EACA,IAAI/C,KAAK,CAACgD,SAAS,KAAKnD,SAAS,EAAE;IACjCoD,MAAM,CAACC,MAAM,CAACjD,KAAK,EAAEN,KAAK,CAACqD,SAAS,CAAChD,KAAK,CAACgD,SAAS,CAAC,CAAC;EACxD;EAEA,OAAO/C,KAAK;AACd;;AAEA;AACA,OAAO,MAAMkD,mBAAqD,GAAG,CACnE,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,MAAM,EACN,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,aAAa,EACb,WAAW,CACZ","ignoreList":[]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Pressable } from "react-native-unistyles/components/native/Pressable";
|
|
4
|
-
import { Children, createContext, forwardRef, useContext } from
|
|
5
|
-
import { StyleSheet, useUnistyles } from
|
|
4
|
+
import { Children, createContext, forwardRef, useContext } from "react";
|
|
5
|
+
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
|
6
6
|
import { getDefaultRadius } from "../../theme/registry.js";
|
|
7
|
+
import { readableOn } from "../../utils/color-utils.js";
|
|
8
|
+
import { resolveThemeColor } from "../../utils/resolve-theme-color.js";
|
|
7
9
|
import { Icon } from "../icon/index.js";
|
|
8
10
|
import { Spinner } from "../spinner/index.js";
|
|
9
11
|
import { Text } from "../text/index.js";
|
|
@@ -11,8 +13,8 @@ import { Text } from "../text/index.js";
|
|
|
11
13
|
// ─── Context (lets icons/labels read the resolved foreground + size) ───────────
|
|
12
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
15
|
const ButtonContext = /*#__PURE__*/createContext({
|
|
14
|
-
color:
|
|
15
|
-
size:
|
|
16
|
+
color: "",
|
|
17
|
+
size: "md"
|
|
16
18
|
});
|
|
17
19
|
export const useButtonContext = () => useContext(ButtonContext);
|
|
18
20
|
|
|
@@ -20,42 +22,42 @@ export const useButtonContext = () => useContext(ButtonContext);
|
|
|
20
22
|
|
|
21
23
|
function getColors(variant, theme) {
|
|
22
24
|
const c = theme.color;
|
|
23
|
-
const get = key => c[key] ??
|
|
25
|
+
const get = key => c[key] ?? "";
|
|
24
26
|
switch (variant) {
|
|
25
|
-
case
|
|
27
|
+
case "primary":
|
|
26
28
|
return {
|
|
27
|
-
bg: get(
|
|
28
|
-
border: get(
|
|
29
|
+
bg: get("action.bg.primary"),
|
|
30
|
+
border: get("action.bg.primary"),
|
|
29
31
|
borderWidth: 0,
|
|
30
|
-
fg: get(
|
|
32
|
+
fg: get("action.fg.primary")
|
|
31
33
|
};
|
|
32
|
-
case
|
|
34
|
+
case "secondary":
|
|
33
35
|
return {
|
|
34
|
-
bg: get(
|
|
35
|
-
border: get(
|
|
36
|
+
bg: get("action.bg.secondary"),
|
|
37
|
+
border: get("action.bg.secondary"),
|
|
36
38
|
borderWidth: 0,
|
|
37
|
-
fg: get(
|
|
39
|
+
fg: get("action.fg.secondary")
|
|
38
40
|
};
|
|
39
|
-
case
|
|
41
|
+
case "outline":
|
|
40
42
|
return {
|
|
41
|
-
bg:
|
|
42
|
-
border: get(
|
|
43
|
+
bg: "transparent",
|
|
44
|
+
border: get("border.default"),
|
|
43
45
|
borderWidth: 1,
|
|
44
|
-
fg: get(
|
|
46
|
+
fg: get("text.default")
|
|
45
47
|
};
|
|
46
|
-
case
|
|
48
|
+
case "ghost":
|
|
47
49
|
return {
|
|
48
|
-
bg:
|
|
49
|
-
border:
|
|
50
|
+
bg: "transparent",
|
|
51
|
+
border: "transparent",
|
|
50
52
|
borderWidth: 0,
|
|
51
|
-
fg: get(
|
|
53
|
+
fg: get("text.default")
|
|
52
54
|
};
|
|
53
|
-
case
|
|
55
|
+
case "danger":
|
|
54
56
|
return {
|
|
55
|
-
bg: get(
|
|
56
|
-
border: get(
|
|
57
|
+
bg: get("status.danger.bg"),
|
|
58
|
+
border: get("status.danger.bg"),
|
|
57
59
|
borderWidth: 0,
|
|
58
|
-
fg: get(
|
|
60
|
+
fg: get("status.danger.fg")
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -64,16 +66,16 @@ function getColors(variant, theme) {
|
|
|
64
66
|
|
|
65
67
|
const LABEL_TYPOGRAPHY = {
|
|
66
68
|
sm: {
|
|
67
|
-
variant:
|
|
68
|
-
weight:
|
|
69
|
+
variant: "label-md",
|
|
70
|
+
weight: "semibold"
|
|
69
71
|
},
|
|
70
72
|
md: {
|
|
71
|
-
variant:
|
|
72
|
-
weight:
|
|
73
|
+
variant: "label-lg",
|
|
74
|
+
weight: "semibold"
|
|
73
75
|
},
|
|
74
76
|
lg: {
|
|
75
|
-
variant:
|
|
76
|
-
weight:
|
|
77
|
+
variant: "label-lg",
|
|
78
|
+
weight: "bold"
|
|
77
79
|
}
|
|
78
80
|
};
|
|
79
81
|
const ButtonLabel = ({
|
|
@@ -120,12 +122,12 @@ const ButtonIcon = ({
|
|
|
120
122
|
};
|
|
121
123
|
function renderChildren(children) {
|
|
122
124
|
return Children.map(children, child => {
|
|
123
|
-
if (typeof child ===
|
|
125
|
+
if (typeof child === "string") {
|
|
124
126
|
return child.trim().length > 0 ? /*#__PURE__*/_jsx(ButtonLabel, {
|
|
125
127
|
children: child
|
|
126
128
|
}) : null;
|
|
127
129
|
}
|
|
128
|
-
if (typeof child ===
|
|
130
|
+
if (typeof child === "number") {
|
|
129
131
|
return /*#__PURE__*/_jsx(ButtonLabel, {
|
|
130
132
|
children: child
|
|
131
133
|
});
|
|
@@ -137,14 +139,15 @@ function renderChildren(children) {
|
|
|
137
139
|
// ─── Component ────────────────────────────────────────────────────────────────
|
|
138
140
|
|
|
139
141
|
const ButtonRoot = /*#__PURE__*/forwardRef(function Button({
|
|
140
|
-
variant =
|
|
141
|
-
size =
|
|
142
|
-
radius = getDefaultRadius(
|
|
142
|
+
variant = "primary",
|
|
143
|
+
size = "md",
|
|
144
|
+
radius = getDefaultRadius("button"),
|
|
143
145
|
isDisabled = false,
|
|
144
146
|
isLoading = false,
|
|
145
147
|
isIconOnly = false,
|
|
146
148
|
fullWidth = true,
|
|
147
149
|
compact = false,
|
|
150
|
+
background,
|
|
148
151
|
children,
|
|
149
152
|
onPress,
|
|
150
153
|
...rest
|
|
@@ -161,11 +164,14 @@ const ButtonRoot = /*#__PURE__*/forwardRef(function Button({
|
|
|
161
164
|
iconOnly: isIconOnly
|
|
162
165
|
});
|
|
163
166
|
const {
|
|
164
|
-
bg,
|
|
167
|
+
bg: variantBg,
|
|
165
168
|
border,
|
|
166
169
|
borderWidth,
|
|
167
|
-
fg
|
|
170
|
+
fg: variantFg
|
|
168
171
|
} = getColors(variant, theme);
|
|
172
|
+
const resolvedBackground = background !== undefined ? resolveThemeColor(background, theme) : undefined;
|
|
173
|
+
const bg = resolvedBackground ?? variantBg;
|
|
174
|
+
const fg = resolvedBackground !== undefined ? readableOn(resolvedBackground) : variantFg;
|
|
169
175
|
const blocked = isDisabled || isLoading;
|
|
170
176
|
const {
|
|
171
177
|
style: externalStyle,
|
|
@@ -194,7 +200,7 @@ const ButtonRoot = /*#__PURE__*/forwardRef(function Button({
|
|
|
194
200
|
opacity: theme.opacity.pressed
|
|
195
201
|
} : null, isDisabled ? {
|
|
196
202
|
opacity: theme.opacity.disabled
|
|
197
|
-
} : null, typeof externalStyle ===
|
|
203
|
+
} : null, typeof externalStyle === "function" ? externalStyle(state) : externalStyle],
|
|
198
204
|
children: [isLoading && /*#__PURE__*/_jsx(Spinner, {
|
|
199
205
|
size: "sm",
|
|
200
206
|
color: fg
|
|
@@ -211,24 +217,24 @@ Button.Label = ButtonLabel;
|
|
|
211
217
|
|
|
212
218
|
const styles = StyleSheet.create(theme => ({
|
|
213
219
|
base: {
|
|
214
|
-
flexDirection:
|
|
215
|
-
alignItems:
|
|
216
|
-
justifyContent:
|
|
217
|
-
alignSelf:
|
|
220
|
+
flexDirection: "row",
|
|
221
|
+
alignItems: "center",
|
|
222
|
+
justifyContent: "center",
|
|
223
|
+
alignSelf: "flex-start",
|
|
218
224
|
variants: {
|
|
219
225
|
size: {
|
|
220
226
|
sm: {
|
|
221
|
-
|
|
227
|
+
height: 36,
|
|
222
228
|
paddingHorizontal: 14,
|
|
223
229
|
gap: 6
|
|
224
230
|
},
|
|
225
231
|
md: {
|
|
226
|
-
|
|
232
|
+
height: 44,
|
|
227
233
|
paddingHorizontal: 16,
|
|
228
234
|
gap: 8
|
|
229
235
|
},
|
|
230
236
|
lg: {
|
|
231
|
-
|
|
237
|
+
height: 52,
|
|
232
238
|
paddingHorizontal: 20,
|
|
233
239
|
gap: 8
|
|
234
240
|
}
|
|
@@ -255,7 +261,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
255
261
|
},
|
|
256
262
|
fullWidth: {
|
|
257
263
|
true: {
|
|
258
|
-
alignSelf:
|
|
264
|
+
alignSelf: "stretch"
|
|
259
265
|
},
|
|
260
266
|
false: {}
|
|
261
267
|
},
|
|
@@ -272,7 +278,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
272
278
|
compact: {
|
|
273
279
|
paddingHorizontal: 2,
|
|
274
280
|
paddingVertical: 2,
|
|
275
|
-
|
|
281
|
+
height: undefined
|
|
276
282
|
}
|
|
277
283
|
}));
|
|
278
284
|
//# sourceMappingURL=Button.js.map
|