react-native-terra-ui 0.5.1 → 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 +25 -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 +6 -6
- package/lib/module/components/image/Image.js.map +1 -1
- package/lib/module/components/page-indicator/PageIndicator.js +1 -1
- package/lib/module/components/page-indicator/PageIndicatorRoot.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js +8 -8
- package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-core.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js +6 -6
- package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js.map +1 -1
- package/lib/module/components/page-indicator/utils.js +8 -8
- package/lib/module/components/page-indicator/utils.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js +2 -2
- package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js +9 -9
- package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js +2 -2
- package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js +3 -3
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/utils.js +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/utils.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js +5 -5
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/utils.js +3 -3
- package/lib/module/components/portal/Portal.js +1 -1
- package/lib/module/components/portal/PortalContext.js +1 -1
- package/lib/module/components/portal/PortalHost.js +1 -1
- package/lib/module/components/portal/PortalProvider.js +1 -1
- package/lib/module/components/portal/PortalProvider.js.map +1 -1
- package/lib/module/components/screen/Screen.js +8 -8
- package/lib/module/components/screen/Screen.js.map +1 -1
- package/lib/module/components/screen/ScreenContext.js +6 -6
- package/lib/module/components/screen/ScreenContext.js.map +1 -1
- package/lib/module/components/screen/ScreenFlatList.js +3 -3
- package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
- package/lib/module/components/screen/ScreenList.js +5 -5
- package/lib/module/components/screen/ScreenList.js.map +1 -1
- package/lib/module/components/screen/ScreenScrollView.js +6 -6
- package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
- package/lib/module/components/screen/parts/BottomSafeArea.js +1 -1
- package/lib/module/components/screen/parts/BottomSafeArea.js.map +1 -1
- package/lib/module/components/screen/parts/ScreenPlaceholder.js +3 -3
- package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -1
- package/lib/module/components/screen/utils.js +3 -3
- package/lib/module/components/screen/utils.js.map +1 -1
- package/lib/module/components/slot/Slot.js +2 -2
- package/lib/module/components/slot/Slot.js.map +1 -1
- package/lib/module/components/slot/utils.js +3 -3
- package/lib/module/components/slot/utils.js.map +1 -1
- package/lib/module/components/spinner/Spinner.js +10 -10
- package/lib/module/components/spinner/Spinner.js.map +1 -1
- package/lib/module/components/surface/Surface.js +14 -14
- package/lib/module/components/surface/Surface.js.map +1 -1
- package/lib/module/components/text/Text.js +13 -13
- package/lib/module/components/text/Text.js.map +1 -1
- package/lib/module/components/toast/Toast.js +46 -46
- package/lib/module/components/toast/Toast.js.map +1 -1
- package/lib/module/components/toast/ToastProvider.js +32 -32
- package/lib/module/components/toast/ToastProvider.js.map +1 -1
- package/lib/module/components/toast/parts/ToastAnimatedItem.js +10 -10
- package/lib/module/components/toast/parts/ToastAnimatedItem.js.map +1 -1
- package/lib/module/components/toast/utils/controller.js +2 -2
- package/lib/module/components/toast/utils/controller.js.map +1 -1
- package/lib/module/components/toolbar/Toolbar.js +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 +1 -1
- package/lib/typescript/src/components/image/Image.d.ts.map +1 -1
- package/lib/typescript/src/components/image/index.d.ts +2 -2
- package/lib/typescript/src/components/image/types.d.ts +1 -1
- package/lib/typescript/src/components/index.d.ts +17 -17
- package/lib/typescript/src/components/page-indicator/PageIndicator.d.ts +10 -10
- package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/utils.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/utils.d.ts +1 -1
- package/lib/typescript/src/components/portal/Portal.d.ts +3 -3
- package/lib/typescript/src/components/portal/PortalContext.d.ts +1 -1
- package/lib/typescript/src/components/portal/PortalHost.d.ts +2 -2
- package/lib/typescript/src/components/portal/PortalProvider.d.ts +1 -1
- package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/portal/index.d.ts +7 -7
- package/lib/typescript/src/components/screen/Screen.d.ts +10 -10
- package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenContext.d.ts +3 -3
- package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +3 -3
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenList.d.ts +5 -5
- package/lib/typescript/src/components/screen/ScreenList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +5 -5
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/index.d.ts +11 -11
- package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +3 -3
- package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/types.d.ts +2 -2
- package/lib/typescript/src/components/screen/utils.d.ts +2 -2
- package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/slot/Slot.d.ts +2 -2
- package/lib/typescript/src/components/slot/Slot.d.ts.map +1 -1
- package/lib/typescript/src/components/slot/index.d.ts +3 -3
- package/lib/typescript/src/components/slot/utils.d.ts +1 -1
- package/lib/typescript/src/components/slot/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/spinner/Spinner.d.ts +2 -2
- package/lib/typescript/src/components/spinner/Spinner.d.ts.map +1 -1
- package/lib/typescript/src/components/spinner/index.d.ts +2 -2
- package/lib/typescript/src/components/surface/Surface.d.ts +4 -4
- package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -1
- package/lib/typescript/src/components/surface/index.d.ts +2 -2
- package/lib/typescript/src/components/text/Text.d.ts +4 -4
- package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
- package/lib/typescript/src/components/text/index.d.ts +2 -2
- package/lib/typescript/src/components/toast/Toast.d.ts +18 -18
- package/lib/typescript/src/components/toast/Toast.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/ToastProvider.d.ts +1 -1
- package/lib/typescript/src/components/toast/ToastProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/index.d.ts +4 -4
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts +3 -3
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/types.d.ts +10 -10
- package/lib/typescript/src/components/toast/types.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/utils/controller.d.ts +2 -2
- package/lib/typescript/src/components/toast/utils/controller.d.ts.map +1 -1
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts +5 -5
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/typescript/src/components/toolbar/index.d.ts +2 -2
- package/lib/typescript/src/context/ThemeProvider.d.ts +3 -3
- package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/context/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts +3 -3
- package/lib/typescript/src/theme/breakpoints.d.ts +2 -2
- package/lib/typescript/src/theme/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/theme/defaults/icons.d.ts +1 -1
- package/lib/typescript/src/theme/defaults/icons.d.ts.map +1 -1
- package/lib/typescript/src/theme/defaults/image.d.ts +1 -1
- package/lib/typescript/src/theme/defaults/image.d.ts.map +1 -1
- package/lib/typescript/src/theme/index.d.ts +14 -14
- package/lib/typescript/src/theme/registry.d.ts +2 -2
- package/lib/typescript/src/theme/registry.d.ts.map +1 -1
- package/lib/typescript/src/theme/runtime.d.ts +1 -1
- package/lib/typescript/src/theme/runtime.d.ts.map +1 -1
- package/lib/typescript/src/theme/screen-margin.d.ts +2 -2
- package/lib/typescript/src/theme/theme.d.ts +2 -2
- package/lib/typescript/src/theme/theme.d.ts.map +1 -1
- package/lib/typescript/src/theme/tokens/dark.d.ts +67 -67
- package/lib/typescript/src/theme/tokens/light.d.ts +67 -67
- package/lib/typescript/src/theme/tokens/primitives.d.ts +417 -417
- package/lib/typescript/src/theme/types.d.ts +84 -84
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/accent-utils.d.ts +1 -1
- package/lib/typescript/src/utils/accent-utils.d.ts.map +1 -1
- package/lib/typescript/src/utils/resolve-theme-color.d.ts +1 -1
- package/lib/typescript/src/utils/resolve-theme-color.d.ts.map +1 -1
- package/lib/typescript/src/utils/typography.d.ts +2 -2
- package/lib/typescript/src/utils/typography.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/avatar/Avatar.tsx +66 -71
- package/src/components/avatar/index.ts +2 -2
- package/src/components/avatar/types.ts +7 -12
- package/src/components/box/Box.tsx +7 -18
- package/src/components/box/index.ts +3 -3
- package/src/components/box/utils.ts +59 -81
- package/src/components/button/Button.tsx +119 -144
- package/src/components/button/index.ts +2 -2
- package/src/components/chip/Chip.tsx +107 -143
- package/src/components/chip/index.ts +3 -3
- package/src/components/chip/types.ts +7 -7
- package/src/components/chip/utils.ts +5 -5
- package/src/components/empty-state/EmptyState.tsx +44 -60
- package/src/components/empty-state/index.ts +3 -3
- package/src/components/empty-state/types.ts +1 -1
- package/src/components/header/Header.ts +2 -2
- package/src/components/header/header-buttons.tsx +10 -18
- package/src/components/header/index.ts +6 -6
- package/src/components/header/parts/HeaderGradientOverlay.tsx +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 +12 -10
- package/src/components/image/index.ts +2 -2
- package/src/components/image/types.ts +1 -1
- package/src/components/index.ts +17 -17
- package/src/components/page-indicator/PageIndicator.tsx +14 -14
- package/src/components/page-indicator/PageIndicatorRoot.tsx +4 -12
- package/src/components/page-indicator/hooks/use-page-indicator-colors.ts +17 -35
- package/src/components/page-indicator/hooks/use-page-indicator-core.ts +6 -8
- package/src/components/page-indicator/hooks/use-page-indicator-progress.ts +10 -30
- package/src/components/page-indicator/index.ts +3 -3
- package/src/components/page-indicator/utils.ts +20 -48
- package/src/components/page-indicator/variants/DotIndicator/InactiveDot.tsx +5 -16
- package/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.tsx +21 -63
- package/src/components/page-indicator/variants/DotIndicator/TravelingPill.tsx +6 -16
- package/src/components/page-indicator/variants/DotIndicator/index.tsx +20 -38
- package/src/components/page-indicator/variants/DotIndicator/utils.ts +2 -6
- package/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.tsx +12 -50
- package/src/components/page-indicator/variants/PillIndicator/index.tsx +19 -41
- package/src/components/page-indicator/variants/PillIndicator/utils.ts +4 -4
- package/src/components/portal/Portal.tsx +4 -4
- package/src/components/portal/PortalContext.tsx +1 -1
- package/src/components/portal/PortalHost.tsx +4 -4
- package/src/components/portal/PortalProvider.tsx +24 -35
- package/src/components/portal/index.ts +7 -7
- package/src/components/screen/Screen.tsx +45 -52
- package/src/components/screen/ScreenContext.tsx +8 -17
- package/src/components/screen/ScreenFlatList.tsx +17 -36
- package/src/components/screen/ScreenList.tsx +31 -63
- package/src/components/screen/ScreenScrollView.tsx +17 -30
- package/src/components/screen/index.ts +11 -11
- package/src/components/screen/parts/BottomSafeArea.tsx +5 -6
- package/src/components/screen/parts/ScreenPlaceholder.tsx +9 -14
- package/src/components/screen/types.ts +2 -2
- package/src/components/screen/utils.ts +6 -19
- package/src/components/slot/Slot.tsx +5 -20
- package/src/components/slot/index.ts +3 -3
- package/src/components/slot/utils.ts +5 -8
- package/src/components/spinner/Spinner.tsx +19 -52
- package/src/components/spinner/index.ts +2 -2
- package/src/components/surface/Surface.tsx +34 -43
- package/src/components/surface/index.ts +2 -2
- package/src/components/text/Text.tsx +75 -85
- package/src/components/text/index.ts +2 -2
- package/src/components/toast/Toast.tsx +195 -251
- package/src/components/toast/ToastProvider.tsx +61 -136
- package/src/components/toast/index.ts +4 -4
- package/src/components/toast/parts/ToastAnimatedItem.tsx +14 -22
- package/src/components/toast/types.ts +11 -14
- package/src/components/toast/utils/controller.ts +4 -6
- package/src/components/toolbar/Toolbar.tsx +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 +123 -135
- package/src/utils/accent-utils.ts +21 -30
- package/src/utils/color-utils.ts +3 -3
- package/src/utils/deep-merge.ts +1 -1
- package/src/utils/resolve-theme-color.ts +8 -11
- package/src/utils/typography.ts +7 -10
- package/src/utils/unflatten.ts +2 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { View } from
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import
|
|
1
|
+
import { View } from "react-native";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
4
|
+
|
|
5
|
+
import { getImageComponent } from "#theme/registry";
|
|
6
|
+
import type { RadiusKey } from "#theme/types";
|
|
7
|
+
import type { ImageProps } from "./types";
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Renders the image implementation configured via
|
|
@@ -18,10 +20,10 @@ import type { ImageProps } from './types';
|
|
|
18
20
|
* ```
|
|
19
21
|
*/
|
|
20
22
|
export function Image({
|
|
21
|
-
contentFit =
|
|
23
|
+
contentFit = "cover",
|
|
22
24
|
width,
|
|
23
25
|
height,
|
|
24
|
-
radius =
|
|
26
|
+
radius = "none",
|
|
25
27
|
style,
|
|
26
28
|
// Defaults to `contentFit` here (rather than leaving it to each backend's
|
|
27
29
|
// own default) so a same-resolution placeholder never renders smaller than
|
|
@@ -48,10 +50,10 @@ const styles = StyleSheet.create((_theme) => ({
|
|
|
48
50
|
...(w ? { width: w } : {}),
|
|
49
51
|
...(h ? { height: h } : {}),
|
|
50
52
|
borderRadius: _theme.radius[r],
|
|
51
|
-
overflow:
|
|
53
|
+
overflow: "hidden",
|
|
52
54
|
}),
|
|
53
55
|
image: {
|
|
54
|
-
width:
|
|
55
|
-
height:
|
|
56
|
+
width: "100%",
|
|
57
|
+
height: "100%",
|
|
56
58
|
},
|
|
57
59
|
}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Image } from
|
|
2
|
-
export type { ImageProps } from
|
|
1
|
+
export { Image } from "./Image";
|
|
2
|
+
export type { ImageProps } from "./types";
|
package/src/components/index.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
1
|
+
export * from "./avatar";
|
|
2
|
+
export * from "./box";
|
|
3
|
+
export * from "./button";
|
|
4
|
+
export * from "./chip";
|
|
5
|
+
export * from "./empty-state";
|
|
6
|
+
export * from "./header";
|
|
7
|
+
export * from "./icon";
|
|
8
|
+
export * from "./image";
|
|
9
|
+
export * from "./page-indicator";
|
|
10
|
+
export * from "./portal";
|
|
11
|
+
export * from "./screen";
|
|
12
|
+
export * from "./slot";
|
|
13
|
+
export * from "./spinner";
|
|
14
|
+
export * from "./surface";
|
|
15
|
+
export * from "./text";
|
|
16
|
+
export * from "./toast";
|
|
17
|
+
export * from "./toolbar";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { StyleProp, ViewStyle } from
|
|
1
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
2
2
|
|
|
3
|
-
import type { SharedValue } from
|
|
3
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
4
4
|
|
|
5
|
-
import type { ColorToken } from
|
|
6
|
-
import { DEFAULT_PAGE_INDICATOR_MAX_VISIBLE } from
|
|
7
|
-
import { DotIndicator } from
|
|
8
|
-
import { PillIndicator } from
|
|
5
|
+
import type { ColorToken } from "#theme/types";
|
|
6
|
+
import { DEFAULT_PAGE_INDICATOR_MAX_VISIBLE } from "./utils";
|
|
7
|
+
import { DotIndicator } from "./variants/DotIndicator";
|
|
8
|
+
import { PillIndicator } from "./variants/PillIndicator";
|
|
9
9
|
|
|
10
|
-
export type PageIndicatorVariant =
|
|
10
|
+
export type PageIndicatorVariant = "pill" | "dot";
|
|
11
11
|
|
|
12
12
|
type PageIndicatorCoreProps = {
|
|
13
13
|
/** Number of pages represented by the indicator. */
|
|
@@ -35,14 +35,14 @@ type PageIndicatorCoreProps = {
|
|
|
35
35
|
|
|
36
36
|
/** Pill indicator — active page widens into a pill. Default when `variant` is omitted. */
|
|
37
37
|
export type PageIndicatorPillProps = PageIndicatorCoreProps & {
|
|
38
|
-
variant?:
|
|
38
|
+
variant?: "pill";
|
|
39
39
|
loading?: never;
|
|
40
40
|
loadingColor?: never;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
/** Dot indicator — traveling dot with optional loading ring on the active page. */
|
|
44
44
|
export type PageIndicatorDotProps = PageIndicatorCoreProps & {
|
|
45
|
-
variant:
|
|
45
|
+
variant: "dot";
|
|
46
46
|
/** Loading ring color token. */
|
|
47
47
|
loadingColor?: ColorToken;
|
|
48
48
|
/** Renders a ring around the active dot while loading. */
|
|
@@ -63,7 +63,7 @@ export function PageIndicator(props: PageIndicatorProps) {
|
|
|
63
63
|
style,
|
|
64
64
|
} = props;
|
|
65
65
|
|
|
66
|
-
if (props.variant ===
|
|
66
|
+
if (props.variant === "dot") {
|
|
67
67
|
return (
|
|
68
68
|
<DotIndicator
|
|
69
69
|
count={count}
|
|
@@ -94,7 +94,7 @@ export function PageIndicator(props: PageIndicatorProps) {
|
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
export type { DotIndicatorProps } from
|
|
98
|
-
export { DotIndicator } from
|
|
99
|
-
export type { PillIndicatorProps } from
|
|
100
|
-
export { PillIndicator } from
|
|
97
|
+
export type { DotIndicatorProps } from "./variants/DotIndicator";
|
|
98
|
+
export { DotIndicator } from "./variants/DotIndicator";
|
|
99
|
+
export type { PillIndicatorProps } from "./variants/PillIndicator";
|
|
100
|
+
export { PillIndicator } from "./variants/PillIndicator";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ReactNode } from
|
|
2
|
-
import { type StyleProp, View, type ViewStyle } from
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
|
-
import { pageIndicatorViewportClipStyle } from
|
|
4
|
+
import { pageIndicatorViewportClipStyle } from "./utils";
|
|
5
5
|
|
|
6
6
|
export type PageIndicatorRootProps = {
|
|
7
7
|
children: ReactNode;
|
|
@@ -24,15 +24,7 @@ export function PageIndicatorRoot({
|
|
|
24
24
|
return (
|
|
25
25
|
<View pointerEvents="none" style={style}>
|
|
26
26
|
{overflows ? (
|
|
27
|
-
<View
|
|
28
|
-
style={pageIndicatorViewportClipStyle(
|
|
29
|
-
vertical,
|
|
30
|
-
viewportMainSize,
|
|
31
|
-
crossSize
|
|
32
|
-
)}
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
</View>
|
|
27
|
+
<View style={pageIndicatorViewportClipStyle(vertical, viewportMainSize, crossSize)}>{children}</View>
|
|
36
28
|
) : (
|
|
37
29
|
children
|
|
38
30
|
)}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { useMemo } from
|
|
1
|
+
import { useMemo } from "react";
|
|
2
2
|
|
|
3
|
-
import { useUnistyles } from
|
|
3
|
+
import { useUnistyles } from "react-native-unistyles";
|
|
4
4
|
|
|
5
|
-
import type { ColorToken } from
|
|
6
|
-
|
|
7
|
-
import { resolveThemeColor } from '#utils/resolve-theme-color';
|
|
5
|
+
import type { ColorToken } from "#theme/types";
|
|
6
|
+
import { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
8
7
|
|
|
9
8
|
/** Resolved color strings for Reanimated and SVG (worklets cannot use theme tokens). */
|
|
10
9
|
export interface ResolvedColors {
|
|
@@ -20,45 +19,28 @@ export type PageIndicatorColorInput = {
|
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
const DEFAULT_COLOR_TOKENS: Required<PageIndicatorColorInput> = {
|
|
23
|
-
activeColor:
|
|
24
|
-
inactiveColor:
|
|
25
|
-
loadingColor:
|
|
22
|
+
activeColor: "text.default",
|
|
23
|
+
inactiveColor: "text.disabled",
|
|
24
|
+
loadingColor: "text.disabled",
|
|
26
25
|
};
|
|
27
26
|
|
|
28
|
-
export function usePageIndicatorColors(
|
|
29
|
-
colors: PageIndicatorColorInput = {}
|
|
30
|
-
): ResolvedColors {
|
|
27
|
+
export function usePageIndicatorColors(colors: PageIndicatorColorInput = {}): ResolvedColors {
|
|
31
28
|
const { theme } = useUnistyles();
|
|
32
29
|
|
|
33
30
|
return useMemo(
|
|
34
31
|
() => ({
|
|
35
32
|
activeColor:
|
|
36
|
-
resolveThemeColor(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
) ??
|
|
40
|
-
(theme.color as unknown as Record<string, string | undefined>)[
|
|
41
|
-
'text.default'
|
|
42
|
-
] ??
|
|
43
|
-
'',
|
|
33
|
+
resolveThemeColor(colors.activeColor ?? DEFAULT_COLOR_TOKENS.activeColor, theme) ??
|
|
34
|
+
(theme.color as unknown as Record<string, string | undefined>)["text.default"] ??
|
|
35
|
+
"",
|
|
44
36
|
inactiveColor:
|
|
45
|
-
resolveThemeColor(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
) ??
|
|
49
|
-
(theme.color as unknown as Record<string, string | undefined>)[
|
|
50
|
-
'text.disabled'
|
|
51
|
-
] ??
|
|
52
|
-
'',
|
|
37
|
+
resolveThemeColor(colors.inactiveColor ?? DEFAULT_COLOR_TOKENS.inactiveColor, theme) ??
|
|
38
|
+
(theme.color as unknown as Record<string, string | undefined>)["text.disabled"] ??
|
|
39
|
+
"",
|
|
53
40
|
loadingColor:
|
|
54
|
-
resolveThemeColor(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
) ??
|
|
58
|
-
(theme.color as unknown as Record<string, string | undefined>)[
|
|
59
|
-
'text.disabled'
|
|
60
|
-
] ??
|
|
61
|
-
'',
|
|
41
|
+
resolveThemeColor(colors.loadingColor ?? DEFAULT_COLOR_TOKENS.loadingColor, theme) ??
|
|
42
|
+
(theme.color as unknown as Record<string, string | undefined>)["text.disabled"] ??
|
|
43
|
+
"",
|
|
62
44
|
}),
|
|
63
45
|
[colors.activeColor, colors.inactiveColor, colors.loadingColor, theme]
|
|
64
46
|
);
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { SharedValue } from
|
|
2
|
-
import { isPageIndicatorSharedValue } from '../utils';
|
|
3
|
-
import {
|
|
4
|
-
type PageIndicatorColorInput,
|
|
5
|
-
usePageIndicatorColors,
|
|
6
|
-
} from './use-page-indicator-colors';
|
|
7
|
-
import { usePageIndicatorProgress } from './use-page-indicator-progress';
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
8
2
|
|
|
9
|
-
|
|
3
|
+
import { isPageIndicatorSharedValue } from "../utils";
|
|
4
|
+
import { type PageIndicatorColorInput, usePageIndicatorColors } from "./use-page-indicator-colors";
|
|
5
|
+
import { usePageIndicatorProgress } from "./use-page-indicator-progress";
|
|
6
|
+
|
|
7
|
+
type PageIndicatorVariant = "pill" | "dot";
|
|
10
8
|
|
|
11
9
|
export function usePageIndicatorCore(
|
|
12
10
|
count: number,
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { useEffect, useMemo } from
|
|
1
|
+
import { useEffect, useMemo } from "react";
|
|
2
2
|
|
|
3
|
-
import type { SharedValue } from
|
|
4
|
-
import {
|
|
5
|
-
cancelAnimation,
|
|
6
|
-
Easing,
|
|
7
|
-
useSharedValue,
|
|
8
|
-
withTiming,
|
|
9
|
-
} from 'react-native-reanimated';
|
|
3
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
4
|
+
import { cancelAnimation, Easing, useSharedValue, withTiming } from "react-native-reanimated";
|
|
10
5
|
|
|
11
6
|
import {
|
|
12
7
|
PAGE_INDICATOR_SINGLE_PAGE_DURATION,
|
|
13
8
|
pageIndicatorPageJumpDistance,
|
|
14
9
|
pageIndicatorPageJumpDuration,
|
|
15
|
-
} from
|
|
10
|
+
} from "../utils";
|
|
16
11
|
|
|
17
12
|
function clampPageIndex(page: number, count: number): number {
|
|
18
13
|
if (count <= 0) return 0;
|
|
@@ -37,12 +32,10 @@ export function usePageIndicatorProgress(
|
|
|
37
32
|
count: number,
|
|
38
33
|
progress: SharedValue<number> | undefined,
|
|
39
34
|
page: number | undefined,
|
|
40
|
-
variant:
|
|
35
|
+
variant: "pill" | "dot" = "pill",
|
|
41
36
|
duration = PAGE_INDICATOR_SINGLE_PAGE_DURATION
|
|
42
37
|
): { progress: SharedValue<number>; pillJump: PillJumpState } {
|
|
43
|
-
const internalProgress = useSharedValue(
|
|
44
|
-
page !== undefined ? clampPageIndex(page, count) : 0
|
|
45
|
-
);
|
|
38
|
+
const internalProgress = useSharedValue(page !== undefined ? clampPageIndex(page, count) : 0);
|
|
46
39
|
const pillJumpActive = useSharedValue(false);
|
|
47
40
|
const pillJumpFrom = useSharedValue(0);
|
|
48
41
|
const pillJumpTo = useSharedValue(0);
|
|
@@ -71,7 +64,7 @@ export function usePageIndicatorProgress(
|
|
|
71
64
|
cancelAnimation(pillJumpT);
|
|
72
65
|
pillJumpActive.value = false;
|
|
73
66
|
|
|
74
|
-
if (variant ===
|
|
67
|
+
if (variant === "pill" && distance > 1) {
|
|
75
68
|
const jumpDuration = pageIndicatorPageJumpDuration(from, target);
|
|
76
69
|
|
|
77
70
|
internalProgress.value = from;
|
|
@@ -86,7 +79,7 @@ export function usePageIndicatorProgress(
|
|
|
86
79
|
easing: Easing.bezier(0.33, 0, 0.15, 1),
|
|
87
80
|
},
|
|
88
81
|
(finished) => {
|
|
89
|
-
|
|
82
|
+
"worklet";
|
|
90
83
|
if (finished) {
|
|
91
84
|
internalProgress.value = target;
|
|
92
85
|
pillJumpActive.value = false;
|
|
@@ -97,23 +90,10 @@ export function usePageIndicatorProgress(
|
|
|
97
90
|
}
|
|
98
91
|
|
|
99
92
|
internalProgress.value = withTiming(target, {
|
|
100
|
-
duration:
|
|
101
|
-
variant === 'dot'
|
|
102
|
-
? duration
|
|
103
|
-
: pageIndicatorPageJumpDuration(from, target),
|
|
93
|
+
duration: variant === "dot" ? duration : pageIndicatorPageJumpDuration(from, target),
|
|
104
94
|
easing: Easing.bezier(0.33, 0, 0.15, 1),
|
|
105
95
|
});
|
|
106
|
-
}, [
|
|
107
|
-
count,
|
|
108
|
-
duration,
|
|
109
|
-
internalProgress,
|
|
110
|
-
page,
|
|
111
|
-
pillJumpActive,
|
|
112
|
-
pillJumpFrom,
|
|
113
|
-
pillJumpT,
|
|
114
|
-
pillJumpTo,
|
|
115
|
-
variant,
|
|
116
|
-
]);
|
|
96
|
+
}, [count, duration, internalProgress, page, pillJumpActive, pillJumpFrom, pillJumpT, pillJumpTo, variant]);
|
|
117
97
|
|
|
118
98
|
return {
|
|
119
99
|
progress: progress ?? internalProgress,
|
|
@@ -5,9 +5,9 @@ export type {
|
|
|
5
5
|
PageIndicatorProps,
|
|
6
6
|
PageIndicatorVariant,
|
|
7
7
|
PillIndicatorProps,
|
|
8
|
-
} from
|
|
9
|
-
export { DotIndicator, PageIndicator, PillIndicator } from
|
|
8
|
+
} from "./PageIndicator";
|
|
9
|
+
export { DotIndicator, PageIndicator, PillIndicator } from "./PageIndicator";
|
|
10
10
|
export {
|
|
11
11
|
DEFAULT_PAGE_INDICATOR_MAX_VISIBLE,
|
|
12
12
|
PAGE_INDICATOR_SINGLE_PAGE_DURATION,
|
|
13
|
-
} from
|
|
13
|
+
} from "./utils";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ViewStyle } from
|
|
1
|
+
import type { ViewStyle } from "react-native";
|
|
2
2
|
|
|
3
|
-
import type { SharedValue } from
|
|
3
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
4
4
|
|
|
5
5
|
/** Duration for a single-page `current` transition. */
|
|
6
6
|
export const PAGE_INDICATOR_SINGLE_PAGE_DURATION = 600;
|
|
@@ -19,10 +19,7 @@ const CENTERED_SCALE = [1, 0.9, 0.65, 0.5] as const;
|
|
|
19
19
|
const WINDOW_TAIL_SCALE = 0.5;
|
|
20
20
|
|
|
21
21
|
/** Absolute page delta between two indices. */
|
|
22
|
-
export function pageIndicatorPageJumpDistance(
|
|
23
|
-
from: number,
|
|
24
|
-
to: number
|
|
25
|
-
): number {
|
|
22
|
+
export function pageIndicatorPageJumpDistance(from: number, to: number): number {
|
|
26
23
|
return Math.abs(to - from);
|
|
27
24
|
}
|
|
28
25
|
|
|
@@ -31,16 +28,12 @@ export function pageIndicatorPageJumpDistance(
|
|
|
31
28
|
* snappy; longer jumps get more time (capped) so the pill does not blur
|
|
32
29
|
* through intermediate dots.
|
|
33
30
|
*/
|
|
34
|
-
export function pageIndicatorPageJumpDuration(
|
|
35
|
-
from: number,
|
|
36
|
-
to: number
|
|
37
|
-
): number {
|
|
31
|
+
export function pageIndicatorPageJumpDuration(from: number, to: number): number {
|
|
38
32
|
const distance = pageIndicatorPageJumpDistance(from, to);
|
|
39
33
|
if (distance <= 1) return PAGE_INDICATOR_SINGLE_PAGE_DURATION;
|
|
40
34
|
|
|
41
35
|
return Math.min(
|
|
42
|
-
PAGE_INDICATOR_SINGLE_PAGE_DURATION +
|
|
43
|
-
PAGE_INDICATOR_MULTI_PAGE_DURATION_STEP * (distance - 1),
|
|
36
|
+
PAGE_INDICATOR_SINGLE_PAGE_DURATION + PAGE_INDICATOR_MULTI_PAGE_DURATION_STEP * (distance - 1),
|
|
44
37
|
PAGE_INDICATOR_MULTI_PAGE_DURATION_MAX
|
|
45
38
|
);
|
|
46
39
|
}
|
|
@@ -48,19 +41,14 @@ export function pageIndicatorPageJumpDuration(
|
|
|
48
41
|
export function isPageIndicatorSharedValue(
|
|
49
42
|
value: number | SharedValue<number>
|
|
50
43
|
): value is SharedValue<number> {
|
|
51
|
-
return typeof value ===
|
|
44
|
+
return typeof value === "object" && value !== null && "value" in value;
|
|
52
45
|
}
|
|
53
46
|
|
|
54
47
|
/** Transform style for overflow track scrolling along the main axis. */
|
|
55
|
-
export function pageIndicatorAxisTranslateStyle(
|
|
56
|
-
|
|
57
|
-
translate: number
|
|
58
|
-
) {
|
|
59
|
-
'worklet';
|
|
48
|
+
export function pageIndicatorAxisTranslateStyle(vertical: boolean, translate: number) {
|
|
49
|
+
"worklet";
|
|
60
50
|
return {
|
|
61
|
-
transform: vertical
|
|
62
|
-
? [{ translateY: translate }]
|
|
63
|
-
: [{ translateX: translate }],
|
|
51
|
+
transform: vertical ? [{ translateY: translate }] : [{ translateX: translate }],
|
|
64
52
|
};
|
|
65
53
|
}
|
|
66
54
|
|
|
@@ -74,23 +62,19 @@ export function pageIndicatorViewportClipStyle(
|
|
|
74
62
|
return {
|
|
75
63
|
height: viewportMainSize,
|
|
76
64
|
...(crossSize !== undefined ? { width: crossSize } : {}),
|
|
77
|
-
overflow:
|
|
65
|
+
overflow: "hidden",
|
|
78
66
|
};
|
|
79
67
|
}
|
|
80
68
|
|
|
81
69
|
return {
|
|
82
70
|
width: viewportMainSize,
|
|
83
71
|
...(crossSize !== undefined ? { height: crossSize } : {}),
|
|
84
|
-
overflow:
|
|
72
|
+
overflow: "hidden",
|
|
85
73
|
};
|
|
86
74
|
}
|
|
87
75
|
|
|
88
|
-
function scaleCurveValue(
|
|
89
|
-
|
|
90
|
-
distance: number,
|
|
91
|
-
tailScale: number
|
|
92
|
-
): number {
|
|
93
|
-
'worklet';
|
|
76
|
+
function scaleCurveValue(curve: readonly number[], distance: number, tailScale: number): number {
|
|
77
|
+
"worklet";
|
|
94
78
|
if (distance < curve.length) return curve[distance] ?? tailScale;
|
|
95
79
|
return tailScale;
|
|
96
80
|
}
|
|
@@ -101,7 +85,7 @@ export function pageIndicatorWindowSlotScale(
|
|
|
101
85
|
activeSlot: number,
|
|
102
86
|
maxVisible: number
|
|
103
87
|
): number {
|
|
104
|
-
|
|
88
|
+
"worklet";
|
|
105
89
|
if (positionInWindow === activeSlot) return 1;
|
|
106
90
|
|
|
107
91
|
const dist = Math.abs(positionInWindow - activeSlot);
|
|
@@ -157,19 +141,13 @@ export function computePageIndicatorWindowTranslate(
|
|
|
157
141
|
maxVisible: number,
|
|
158
142
|
activeMainSize = dotSize
|
|
159
143
|
): number {
|
|
160
|
-
|
|
144
|
+
"worklet";
|
|
161
145
|
if (count <= maxVisible) return 0;
|
|
162
146
|
|
|
163
|
-
const viewportMainSize = Math.max(
|
|
164
|
-
dotSize,
|
|
165
|
-
(maxVisible - 1) * slot + activeMainSize
|
|
166
|
-
);
|
|
147
|
+
const viewportMainSize = Math.max(dotSize, (maxVisible - 1) * slot + activeMainSize);
|
|
167
148
|
const trackMainSize = Math.max(dotSize, (count - 1) * slot + activeMainSize);
|
|
168
149
|
const activeCenter = progress * slot + activeMainSize / 2;
|
|
169
|
-
const offset = Math.min(
|
|
170
|
-
Math.max(activeCenter - viewportMainSize / 2, 0),
|
|
171
|
-
trackMainSize - viewportMainSize
|
|
172
|
-
);
|
|
150
|
+
const offset = Math.min(Math.max(activeCenter - viewportMainSize / 2, 0), trackMainSize - viewportMainSize);
|
|
173
151
|
|
|
174
152
|
return -offset;
|
|
175
153
|
}
|
|
@@ -183,7 +161,7 @@ export function pageIndicatorWindowScale(
|
|
|
183
161
|
maxVisible: number,
|
|
184
162
|
activeMainSize = dotSize
|
|
185
163
|
): number {
|
|
186
|
-
|
|
164
|
+
"worklet";
|
|
187
165
|
if (count <= maxVisible) return 1;
|
|
188
166
|
|
|
189
167
|
const translate = computePageIndicatorWindowTranslate(
|
|
@@ -195,14 +173,8 @@ export function pageIndicatorWindowScale(
|
|
|
195
173
|
activeMainSize
|
|
196
174
|
);
|
|
197
175
|
const visibleStart = -translate / slot;
|
|
198
|
-
const activeSlot = Math.min(
|
|
199
|
-
|
|
200
|
-
maxVisible - 1
|
|
201
|
-
);
|
|
202
|
-
const positionInWindow = Math.min(
|
|
203
|
-
Math.max(Math.round(index - visibleStart), 0),
|
|
204
|
-
maxVisible - 1
|
|
205
|
-
);
|
|
176
|
+
const activeSlot = Math.min(Math.max(Math.round(displayProgress - visibleStart), 0), maxVisible - 1);
|
|
177
|
+
const positionInWindow = Math.min(Math.max(Math.round(index - visibleStart), 0), maxVisible - 1);
|
|
206
178
|
|
|
207
179
|
return pageIndicatorWindowSlotScale(positionInWindow, activeSlot, maxVisible);
|
|
208
180
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import Animated, {
|
|
2
|
-
type SharedValue,
|
|
3
|
-
useAnimatedStyle,
|
|
4
|
-
} from 'react-native-reanimated';
|
|
1
|
+
import Animated, { type SharedValue, useAnimatedStyle } from "react-native-reanimated";
|
|
5
2
|
|
|
6
|
-
import { pageIndicatorWindowScale } from
|
|
7
|
-
|
|
8
|
-
import { DOT_INDICATOR_GEOMETRY, pageIndicatorDotCenter } from './utils';
|
|
3
|
+
import { pageIndicatorWindowScale } from "../../utils";
|
|
4
|
+
import { DOT_INDICATOR_GEOMETRY, pageIndicatorDotCenter } from "./utils";
|
|
9
5
|
|
|
10
6
|
interface InactiveDotProps {
|
|
11
7
|
color: string;
|
|
@@ -34,14 +30,7 @@ export function InactiveDot({
|
|
|
34
30
|
const animatedStyle = useAnimatedStyle(() => {
|
|
35
31
|
const center = pageIndicatorDotCenter(index, slot, dotSize);
|
|
36
32
|
const windowScale = overflows
|
|
37
|
-
? pageIndicatorWindowScale(
|
|
38
|
-
index,
|
|
39
|
-
progress.value,
|
|
40
|
-
count,
|
|
41
|
-
slot,
|
|
42
|
-
dotSize,
|
|
43
|
-
maxVisible
|
|
44
|
-
)
|
|
33
|
+
? pageIndicatorWindowScale(index, progress.value, count, slot, dotSize, maxVisible)
|
|
45
34
|
: 1;
|
|
46
35
|
|
|
47
36
|
return {
|
|
@@ -56,7 +45,7 @@ export function InactiveDot({
|
|
|
56
45
|
<Animated.View
|
|
57
46
|
style={[
|
|
58
47
|
{
|
|
59
|
-
position:
|
|
48
|
+
position: "absolute",
|
|
60
49
|
width: dotSize,
|
|
61
50
|
height: dotSize,
|
|
62
51
|
borderRadius: 999,
|