react-native-terra-ui 0.5.1 → 0.7.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 +86 -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 +82 -12
- package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -1
- package/lib/module/components/header/variants/LargeTitleHeader/index.js +64 -60
- package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
- package/lib/module/components/header/variants/TitleHeader/index.js +33 -29
- 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 +103 -33
- 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/dark.js.map +1 -1
- 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 +19 -2
- 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 +77 -11
- package/src/components/header/variants/LargeTitleHeader/index.tsx +79 -142
- package/src/components/header/variants/TitleHeader/index.tsx +45 -63
- 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 +117 -72
- 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,4 +1,4 @@
|
|
|
1
|
-
import { useEffect } from
|
|
1
|
+
import { useEffect } from "react";
|
|
2
2
|
|
|
3
3
|
import Animated, {
|
|
4
4
|
Extrapolation,
|
|
@@ -8,32 +8,25 @@ import Animated, {
|
|
|
8
8
|
useAnimatedStyle,
|
|
9
9
|
useFrameCallback,
|
|
10
10
|
useSharedValue,
|
|
11
|
-
} from
|
|
12
|
-
import Svg, { Circle } from
|
|
11
|
+
} from "react-native-reanimated";
|
|
12
|
+
import Svg, { Circle } from "react-native-svg";
|
|
13
13
|
|
|
14
|
-
import { DOT_INDICATOR_GEOMETRY, pageIndicatorDotCenter } from
|
|
14
|
+
import { DOT_INDICATOR_GEOMETRY, pageIndicatorDotCenter } from "./utils";
|
|
15
15
|
|
|
16
16
|
const ORBIT_ARCS = [
|
|
17
|
-
{ id:
|
|
18
|
-
{ id:
|
|
19
|
-
{ id:
|
|
17
|
+
{ id: "arc-1", arcDegrees: 120, duration: 800, delay: 0 },
|
|
18
|
+
{ id: "arc-2", arcDegrees: 60, duration: 1200, delay: 50 },
|
|
19
|
+
{ id: "arc-3", arcDegrees: 30, duration: 1600, delay: 200 },
|
|
20
20
|
] as const;
|
|
21
21
|
|
|
22
|
-
const ORBIT_LOOP_DURATION = Math.max(
|
|
23
|
-
...ORBIT_ARCS.map((arc) => arc.delay + arc.duration)
|
|
24
|
-
);
|
|
22
|
+
const ORBIT_LOOP_DURATION = Math.max(...ORBIT_ARCS.map((arc) => arc.delay + arc.duration));
|
|
25
23
|
|
|
26
24
|
const ORBIT_SETTLE_THRESHOLD = 0.04;
|
|
27
25
|
|
|
28
26
|
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
29
27
|
|
|
30
|
-
function computeSweepArcState(
|
|
31
|
-
|
|
32
|
-
delay: number,
|
|
33
|
-
duration: number,
|
|
34
|
-
arcDegrees: number
|
|
35
|
-
) {
|
|
36
|
-
'worklet';
|
|
28
|
+
function computeSweepArcState(clock: number, delay: number, duration: number, arcDegrees: number) {
|
|
29
|
+
"worklet";
|
|
37
30
|
const elapsed = clock * ORBIT_LOOP_DURATION;
|
|
38
31
|
const localProgress = Math.min(Math.max((elapsed - delay) / duration, 0), 1);
|
|
39
32
|
const leadTravel = 360 + arcDegrees;
|
|
@@ -53,23 +46,11 @@ interface SweepArcProps {
|
|
|
53
46
|
clock: SharedValue<number>;
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
function SweepArc({
|
|
57
|
-
|
|
58
|
-
arcDegrees,
|
|
59
|
-
duration,
|
|
60
|
-
delay,
|
|
61
|
-
clock,
|
|
62
|
-
}: SweepArcProps) {
|
|
63
|
-
const { ringSize, ringStroke, ringRadius, ringCircumference } =
|
|
64
|
-
DOT_INDICATOR_GEOMETRY;
|
|
49
|
+
function SweepArc({ color, arcDegrees, duration, delay, clock }: SweepArcProps) {
|
|
50
|
+
const { ringSize, ringStroke, ringRadius, ringCircumference } = DOT_INDICATOR_GEOMETRY;
|
|
65
51
|
|
|
66
52
|
const containerStyle = useAnimatedStyle(() => {
|
|
67
|
-
const { tailVisible, visibleDegrees } = computeSweepArcState(
|
|
68
|
-
clock.value,
|
|
69
|
-
delay,
|
|
70
|
-
duration,
|
|
71
|
-
arcDegrees
|
|
72
|
-
);
|
|
53
|
+
const { tailVisible, visibleDegrees } = computeSweepArcState(clock.value, delay, duration, arcDegrees);
|
|
73
54
|
|
|
74
55
|
return {
|
|
75
56
|
opacity: visibleDegrees > 0.01 ? 1 : 0,
|
|
@@ -78,12 +59,7 @@ function SweepArc({
|
|
|
78
59
|
});
|
|
79
60
|
|
|
80
61
|
const animatedProps = useAnimatedProps(() => {
|
|
81
|
-
const { visibleDegrees } = computeSweepArcState(
|
|
82
|
-
clock.value,
|
|
83
|
-
delay,
|
|
84
|
-
duration,
|
|
85
|
-
arcDegrees
|
|
86
|
-
);
|
|
62
|
+
const { visibleDegrees } = computeSweepArcState(clock.value, delay, duration, arcDegrees);
|
|
87
63
|
const dash = (ringCircumference * visibleDegrees) / 360;
|
|
88
64
|
|
|
89
65
|
return { strokeDasharray: [dash, ringCircumference] };
|
|
@@ -92,10 +68,7 @@ function SweepArc({
|
|
|
92
68
|
return (
|
|
93
69
|
<Animated.View
|
|
94
70
|
pointerEvents="none"
|
|
95
|
-
style={[
|
|
96
|
-
{ position: 'absolute', width: ringSize, height: ringSize },
|
|
97
|
-
containerStyle,
|
|
98
|
-
]}
|
|
71
|
+
style={[{ position: "absolute", width: ringSize, height: ringSize }, containerStyle]}
|
|
99
72
|
>
|
|
100
73
|
<Svg width={ringSize} height={ringSize}>
|
|
101
74
|
<AnimatedCircle
|
|
@@ -121,13 +94,7 @@ interface LoadingOrbitProps {
|
|
|
121
94
|
vertical: boolean;
|
|
122
95
|
}
|
|
123
96
|
|
|
124
|
-
export function LoadingOrbit({
|
|
125
|
-
color,
|
|
126
|
-
count,
|
|
127
|
-
loading,
|
|
128
|
-
progress,
|
|
129
|
-
vertical,
|
|
130
|
-
}: LoadingOrbitProps) {
|
|
97
|
+
export function LoadingOrbit({ color, count, loading, progress, vertical }: LoadingOrbitProps) {
|
|
131
98
|
const { dotSize, slot, crossSize, ringSize } = DOT_INDICATOR_GEOMETRY;
|
|
132
99
|
const crossOffset = (crossSize - ringSize) / 2;
|
|
133
100
|
const clock = useSharedValue(0);
|
|
@@ -140,10 +107,7 @@ export function LoadingOrbit({
|
|
|
140
107
|
const frameCallback = useFrameCallback((frame) => {
|
|
141
108
|
if (!loadingActive.value) return;
|
|
142
109
|
|
|
143
|
-
const activeIndex = Math.min(
|
|
144
|
-
Math.max(Math.round(progress.value), 0),
|
|
145
|
-
count - 1
|
|
146
|
-
);
|
|
110
|
+
const activeIndex = Math.min(Math.max(Math.round(progress.value), 0), count - 1);
|
|
147
111
|
const settleDistance = Math.abs(progress.value - activeIndex);
|
|
148
112
|
|
|
149
113
|
if (settleDistance >= ORBIT_SETTLE_THRESHOLD) return;
|
|
@@ -157,19 +121,13 @@ export function LoadingOrbit({
|
|
|
157
121
|
}, [frameCallback, loading]);
|
|
158
122
|
|
|
159
123
|
const containerStyle = useAnimatedStyle(() => {
|
|
160
|
-
const activeIndex = Math.min(
|
|
161
|
-
Math.max(Math.round(progress.value), 0),
|
|
162
|
-
count - 1
|
|
163
|
-
);
|
|
124
|
+
const activeIndex = Math.min(Math.max(Math.round(progress.value), 0), count - 1);
|
|
164
125
|
const settleDistance = Math.abs(progress.value - activeIndex);
|
|
165
|
-
const mainOffset =
|
|
166
|
-
pageIndicatorDotCenter(activeIndex, slot, dotSize) - ringSize / 2;
|
|
126
|
+
const mainOffset = pageIndicatorDotCenter(activeIndex, slot, dotSize) - ringSize / 2;
|
|
167
127
|
|
|
168
128
|
return {
|
|
169
129
|
...(vertical ? { top: mainOffset } : { left: mainOffset }),
|
|
170
|
-
opacity: loadingActive.value
|
|
171
|
-
? interpolate(settleDistance, [0, 0.12], [1, 0], Extrapolation.CLAMP)
|
|
172
|
-
: 0,
|
|
130
|
+
opacity: loadingActive.value ? interpolate(settleDistance, [0, 0.12], [1, 0], Extrapolation.CLAMP) : 0,
|
|
173
131
|
};
|
|
174
132
|
});
|
|
175
133
|
|
|
@@ -178,7 +136,7 @@ export function LoadingOrbit({
|
|
|
178
136
|
pointerEvents="none"
|
|
179
137
|
style={[
|
|
180
138
|
{
|
|
181
|
-
position:
|
|
139
|
+
position: "absolute",
|
|
182
140
|
...(vertical
|
|
183
141
|
? { left: crossOffset, width: ringSize, height: ringSize }
|
|
184
142
|
: { top: crossOffset, width: ringSize, height: ringSize }),
|
|
@@ -3,9 +3,9 @@ import Animated, {
|
|
|
3
3
|
interpolate,
|
|
4
4
|
type SharedValue,
|
|
5
5
|
useAnimatedStyle,
|
|
6
|
-
} from
|
|
6
|
+
} from "react-native-reanimated";
|
|
7
7
|
|
|
8
|
-
import { DOT_INDICATOR_GEOMETRY, pageIndicatorDotCenter } from
|
|
8
|
+
import { DOT_INDICATOR_GEOMETRY, pageIndicatorDotCenter } from "./utils";
|
|
9
9
|
|
|
10
10
|
interface TravelingPillProps {
|
|
11
11
|
activeColor: string;
|
|
@@ -19,21 +19,13 @@ interface TravelingPillProps {
|
|
|
19
19
|
* its leading edge advances first (stretch), then its trailing edge catches up
|
|
20
20
|
* (collapse).
|
|
21
21
|
*/
|
|
22
|
-
export function TravelingPill({
|
|
23
|
-
activeColor,
|
|
24
|
-
count,
|
|
25
|
-
progress,
|
|
26
|
-
vertical,
|
|
27
|
-
}: TravelingPillProps) {
|
|
22
|
+
export function TravelingPill({ activeColor, count, progress, vertical }: TravelingPillProps) {
|
|
28
23
|
const { dotSize, slot, crossSize } = DOT_INDICATOR_GEOMETRY;
|
|
29
24
|
const crossOffset = (crossSize - dotSize) / 2;
|
|
30
25
|
|
|
31
26
|
const animatedStyle = useAnimatedStyle(() => {
|
|
32
27
|
const maxSegment = Math.max(0, count - 2);
|
|
33
|
-
const segment = Math.min(
|
|
34
|
-
Math.max(Math.floor(progress.value), 0),
|
|
35
|
-
maxSegment
|
|
36
|
-
);
|
|
28
|
+
const segment = Math.min(Math.max(Math.floor(progress.value), 0), maxSegment);
|
|
37
29
|
const frac = progress.value - segment;
|
|
38
30
|
|
|
39
31
|
const from = pageIndicatorDotCenter(segment, slot, dotSize);
|
|
@@ -65,10 +57,8 @@ export function TravelingPill({
|
|
|
65
57
|
pointerEvents="none"
|
|
66
58
|
style={[
|
|
67
59
|
{
|
|
68
|
-
position:
|
|
69
|
-
...(vertical
|
|
70
|
-
? { left: crossOffset, width: dotSize }
|
|
71
|
-
: { top: crossOffset, height: dotSize }),
|
|
60
|
+
position: "absolute",
|
|
61
|
+
...(vertical ? { left: crossOffset, width: dotSize } : { top: crossOffset, height: dotSize }),
|
|
72
62
|
borderRadius: 999,
|
|
73
63
|
backgroundColor: activeColor,
|
|
74
64
|
zIndex: 2,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { useMemo } from
|
|
2
|
-
import type { StyleProp, ViewStyle } from
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
|
-
import type { SharedValue } from
|
|
5
|
-
import Animated, { useAnimatedStyle } from
|
|
4
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
5
|
+
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
6
6
|
|
|
7
|
-
import type { ColorToken } from
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import { PageIndicatorRoot } from '../../PageIndicatorRoot';
|
|
7
|
+
import type { ColorToken } from "#theme/types";
|
|
8
|
+
import { usePageIndicatorCore } from "../../hooks/use-page-indicator-core";
|
|
9
|
+
import { PageIndicatorRoot } from "../../PageIndicatorRoot";
|
|
11
10
|
import {
|
|
12
11
|
computePageIndicatorWindowTranslate,
|
|
13
12
|
DEFAULT_PAGE_INDICATOR_MAX_VISIBLE,
|
|
@@ -15,12 +14,11 @@ import {
|
|
|
15
14
|
pageIndicatorAxisTranslateStyle,
|
|
16
15
|
pageIndicatorTrackMainSize,
|
|
17
16
|
pageIndicatorViewportMainSize,
|
|
18
|
-
} from
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { DOT_INDICATOR_GEOMETRY } from './utils';
|
|
17
|
+
} from "../../utils";
|
|
18
|
+
import { InactiveDot } from "./InactiveDot";
|
|
19
|
+
import { LoadingOrbit } from "./LoadingOrbit";
|
|
20
|
+
import { TravelingPill } from "./TravelingPill";
|
|
21
|
+
import { DOT_INDICATOR_GEOMETRY } from "./utils";
|
|
24
22
|
|
|
25
23
|
export interface DotIndicatorProps {
|
|
26
24
|
/** Number of pages represented by the indicator. */
|
|
@@ -62,37 +60,21 @@ export function DotIndicator({
|
|
|
62
60
|
maxVisible = DEFAULT_PAGE_INDICATOR_MAX_VISIBLE,
|
|
63
61
|
style,
|
|
64
62
|
}: DotIndicatorProps) {
|
|
65
|
-
const { colors, progress } = usePageIndicatorCore(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{ activeColor, inactiveColor, loadingColor }
|
|
71
|
-
);
|
|
63
|
+
const { colors, progress } = usePageIndicatorCore(count, current, "dot", duration, {
|
|
64
|
+
activeColor,
|
|
65
|
+
inactiveColor,
|
|
66
|
+
loadingColor,
|
|
67
|
+
});
|
|
72
68
|
|
|
73
69
|
const { dotSize, slot, crossSize, inactiveOpacity } = DOT_INDICATOR_GEOMETRY;
|
|
74
|
-
const viewportMainSize = pageIndicatorViewportMainSize(
|
|
75
|
-
count,
|
|
76
|
-
slot,
|
|
77
|
-
dotSize,
|
|
78
|
-
maxVisible
|
|
79
|
-
);
|
|
70
|
+
const viewportMainSize = pageIndicatorViewportMainSize(count, slot, dotSize, maxVisible);
|
|
80
71
|
const fullTrackMainSize = pageIndicatorTrackMainSize(count, slot, dotSize);
|
|
81
72
|
const overflows = count > maxVisible;
|
|
82
73
|
|
|
83
|
-
const indices = useMemo(
|
|
84
|
-
() => Array.from({ length: count }, (_, index) => index),
|
|
85
|
-
[count]
|
|
86
|
-
);
|
|
74
|
+
const indices = useMemo(() => Array.from({ length: count }, (_, index) => index), [count]);
|
|
87
75
|
|
|
88
76
|
const trackStyle = useAnimatedStyle(() => {
|
|
89
|
-
const translate = computePageIndicatorWindowTranslate(
|
|
90
|
-
count,
|
|
91
|
-
progress.value,
|
|
92
|
-
slot,
|
|
93
|
-
dotSize,
|
|
94
|
-
maxVisible
|
|
95
|
-
);
|
|
77
|
+
const translate = computePageIndicatorWindowTranslate(count, progress.value, slot, dotSize, maxVisible);
|
|
96
78
|
|
|
97
79
|
return pageIndicatorAxisTranslateStyle(vertical, translate);
|
|
98
80
|
});
|
|
@@ -18,11 +18,7 @@ export const DOT_INDICATOR_GEOMETRY = {
|
|
|
18
18
|
} as const;
|
|
19
19
|
|
|
20
20
|
/** Main-axis center of dot `index` within the track. */
|
|
21
|
-
export function pageIndicatorDotCenter(
|
|
22
|
-
|
|
23
|
-
slot: number,
|
|
24
|
-
dotSize: number
|
|
25
|
-
): number {
|
|
26
|
-
'worklet';
|
|
21
|
+
export function pageIndicatorDotCenter(index: number, slot: number, dotSize: number): number {
|
|
22
|
+
"worklet";
|
|
27
23
|
return index * slot + dotSize / 2;
|
|
28
24
|
}
|
|
@@ -4,17 +4,16 @@ import Animated, {
|
|
|
4
4
|
interpolateColor,
|
|
5
5
|
type SharedValue,
|
|
6
6
|
useAnimatedStyle,
|
|
7
|
-
} from
|
|
8
|
-
|
|
9
|
-
import type { PillJumpState } from '../../hooks/use-page-indicator-progress';
|
|
10
|
-
import { pageIndicatorWindowScale } from '../../utils';
|
|
7
|
+
} from "react-native-reanimated";
|
|
11
8
|
|
|
9
|
+
import type { PillJumpState } from "../../hooks/use-page-indicator-progress";
|
|
10
|
+
import { pageIndicatorWindowScale } from "../../utils";
|
|
12
11
|
import {
|
|
13
12
|
PILL_INDICATOR_GEOMETRY,
|
|
14
13
|
pillIndicatorDotDistance,
|
|
15
14
|
pillIndicatorJumpDisplayProgress,
|
|
16
15
|
readPillJumpState,
|
|
17
|
-
} from
|
|
16
|
+
} from "./utils";
|
|
18
17
|
|
|
19
18
|
interface PillIndicatorDotProps {
|
|
20
19
|
activeColor: string;
|
|
@@ -39,8 +38,7 @@ export function PillIndicatorDot({
|
|
|
39
38
|
progress,
|
|
40
39
|
vertical,
|
|
41
40
|
}: PillIndicatorDotProps) {
|
|
42
|
-
const { dotSize, activeWidth, inactiveOpacity, inactiveScale, slot } =
|
|
43
|
-
PILL_INDICATOR_GEOMETRY;
|
|
41
|
+
const { dotSize, activeWidth, inactiveOpacity, inactiveScale, slot } = PILL_INDICATOR_GEOMETRY;
|
|
44
42
|
|
|
45
43
|
const animatedStyle = useAnimatedStyle(() => {
|
|
46
44
|
const jump = readPillJumpState(pillJump);
|
|
@@ -51,55 +49,19 @@ export function PillIndicatorDot({
|
|
|
51
49
|
jump.to,
|
|
52
50
|
jump.t
|
|
53
51
|
);
|
|
54
|
-
const distance = pillIndicatorDotDistance(
|
|
55
|
-
index,
|
|
56
|
-
progress.value,
|
|
57
|
-
jump.active,
|
|
58
|
-
jump.from,
|
|
59
|
-
jump.to,
|
|
60
|
-
jump.t
|
|
61
|
-
);
|
|
52
|
+
const distance = pillIndicatorDotDistance(index, progress.value, jump.active, jump.from, jump.to, jump.t);
|
|
62
53
|
|
|
63
|
-
const mainSize = interpolate(
|
|
64
|
-
|
|
65
|
-
[0, 1],
|
|
66
|
-
[activeWidth, dotSize],
|
|
67
|
-
Extrapolation.CLAMP
|
|
68
|
-
);
|
|
69
|
-
const activeScale = interpolate(
|
|
70
|
-
distance,
|
|
71
|
-
[0, 1],
|
|
72
|
-
[1, inactiveScale],
|
|
73
|
-
Extrapolation.CLAMP
|
|
74
|
-
);
|
|
54
|
+
const mainSize = interpolate(distance, [0, 1], [activeWidth, dotSize], Extrapolation.CLAMP);
|
|
55
|
+
const activeScale = interpolate(distance, [0, 1], [1, inactiveScale], Extrapolation.CLAMP);
|
|
75
56
|
const edgeScale = overflows
|
|
76
|
-
? pageIndicatorWindowScale(
|
|
77
|
-
index,
|
|
78
|
-
displayProgress,
|
|
79
|
-
count,
|
|
80
|
-
slot,
|
|
81
|
-
dotSize,
|
|
82
|
-
maxVisible,
|
|
83
|
-
activeWidth
|
|
84
|
-
)
|
|
57
|
+
? pageIndicatorWindowScale(index, displayProgress, count, slot, dotSize, maxVisible, activeWidth)
|
|
85
58
|
: 1;
|
|
86
59
|
|
|
87
60
|
return {
|
|
88
|
-
...(vertical
|
|
89
|
-
|
|
90
|
-
: { width: mainSize, height: dotSize }),
|
|
91
|
-
opacity: interpolate(
|
|
92
|
-
distance,
|
|
93
|
-
[0, 1],
|
|
94
|
-
[1, inactiveOpacity],
|
|
95
|
-
Extrapolation.CLAMP
|
|
96
|
-
),
|
|
61
|
+
...(vertical ? { width: dotSize, height: mainSize } : { width: mainSize, height: dotSize }),
|
|
62
|
+
opacity: interpolate(distance, [0, 1], [1, inactiveOpacity], Extrapolation.CLAMP),
|
|
97
63
|
transform: [{ scale: activeScale * edgeScale }],
|
|
98
|
-
backgroundColor: interpolateColor(
|
|
99
|
-
distance,
|
|
100
|
-
[0, 1],
|
|
101
|
-
[activeColor, inactiveColor]
|
|
102
|
-
),
|
|
64
|
+
backgroundColor: interpolateColor(distance, [0, 1], [activeColor, inactiveColor]),
|
|
103
65
|
};
|
|
104
66
|
});
|
|
105
67
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { useMemo } from
|
|
2
|
-
import type { StyleProp, ViewStyle } from
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
|
-
import type { SharedValue } from
|
|
5
|
-
import Animated, { useAnimatedStyle } from
|
|
4
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
5
|
+
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
6
6
|
|
|
7
|
-
import type { ColorToken } from
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import { PageIndicatorRoot } from '../../PageIndicatorRoot';
|
|
7
|
+
import type { ColorToken } from "#theme/types";
|
|
8
|
+
import { usePageIndicatorCore } from "../../hooks/use-page-indicator-core";
|
|
9
|
+
import { PageIndicatorRoot } from "../../PageIndicatorRoot";
|
|
11
10
|
import {
|
|
12
11
|
computePageIndicatorWindowTranslate,
|
|
13
12
|
DEFAULT_PAGE_INDICATOR_MAX_VISIBLE,
|
|
@@ -15,13 +14,9 @@ import {
|
|
|
15
14
|
pageIndicatorAxisTranslateStyle,
|
|
16
15
|
pageIndicatorTrackMainSize,
|
|
17
16
|
pageIndicatorViewportMainSize,
|
|
18
|
-
} from
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
PILL_INDICATOR_GEOMETRY,
|
|
23
|
-
pillIndicatorJumpDisplayProgress,
|
|
24
|
-
} from './utils';
|
|
17
|
+
} from "../../utils";
|
|
18
|
+
import { PillIndicatorDot } from "./PillIndicatorDot";
|
|
19
|
+
import { PILL_INDICATOR_GEOMETRY, pillIndicatorJumpDisplayProgress } from "./utils";
|
|
25
20
|
|
|
26
21
|
export interface PillIndicatorProps {
|
|
27
22
|
/** Number of pages represented by the indicator. */
|
|
@@ -57,34 +52,17 @@ export function PillIndicator({
|
|
|
57
52
|
maxVisible = DEFAULT_PAGE_INDICATOR_MAX_VISIBLE,
|
|
58
53
|
style,
|
|
59
54
|
}: PillIndicatorProps) {
|
|
60
|
-
const { colors, pillJump, progress } = usePageIndicatorCore(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
duration,
|
|
65
|
-
{ activeColor, inactiveColor }
|
|
66
|
-
);
|
|
55
|
+
const { colors, pillJump, progress } = usePageIndicatorCore(count, current, "pill", duration, {
|
|
56
|
+
activeColor,
|
|
57
|
+
inactiveColor,
|
|
58
|
+
});
|
|
67
59
|
|
|
68
60
|
const { dotSize, gap, slot, activeWidth } = PILL_INDICATOR_GEOMETRY;
|
|
69
|
-
const viewportMainSize = pageIndicatorViewportMainSize(
|
|
70
|
-
|
|
71
|
-
slot,
|
|
72
|
-
dotSize,
|
|
73
|
-
maxVisible,
|
|
74
|
-
activeWidth
|
|
75
|
-
);
|
|
76
|
-
const fullTrackMainSize = pageIndicatorTrackMainSize(
|
|
77
|
-
count,
|
|
78
|
-
slot,
|
|
79
|
-
dotSize,
|
|
80
|
-
activeWidth
|
|
81
|
-
);
|
|
61
|
+
const viewportMainSize = pageIndicatorViewportMainSize(count, slot, dotSize, maxVisible, activeWidth);
|
|
62
|
+
const fullTrackMainSize = pageIndicatorTrackMainSize(count, slot, dotSize, activeWidth);
|
|
82
63
|
const overflows = count > maxVisible;
|
|
83
64
|
|
|
84
|
-
const indices = useMemo(
|
|
85
|
-
() => Array.from({ length: count }, (_, index) => index),
|
|
86
|
-
[count]
|
|
87
|
-
);
|
|
65
|
+
const indices = useMemo(() => Array.from({ length: count }, (_, index) => index), [count]);
|
|
88
66
|
|
|
89
67
|
const trackStyle = useAnimatedStyle(() => {
|
|
90
68
|
const displayProgress = pillIndicatorJumpDisplayProgress(
|
|
@@ -117,8 +95,8 @@ export function PillIndicator({
|
|
|
117
95
|
<Animated.View
|
|
118
96
|
style={[
|
|
119
97
|
{
|
|
120
|
-
flexDirection: vertical ?
|
|
121
|
-
alignItems:
|
|
98
|
+
flexDirection: vertical ? "column" : "row",
|
|
99
|
+
alignItems: "center",
|
|
122
100
|
gap,
|
|
123
101
|
...(overflows
|
|
124
102
|
? vertical
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PillJumpState } from
|
|
1
|
+
import type { PillJumpState } from "../../hooks/use-page-indicator-progress";
|
|
2
2
|
|
|
3
3
|
const DOT_SIZE = 8;
|
|
4
4
|
const GAP = 8;
|
|
@@ -16,7 +16,7 @@ export const PILL_INDICATOR_GEOMETRY = {
|
|
|
16
16
|
export type PillIndicatorGeometry = typeof PILL_INDICATOR_GEOMETRY;
|
|
17
17
|
|
|
18
18
|
export function readPillJumpState(jump: PillJumpState) {
|
|
19
|
-
|
|
19
|
+
"worklet";
|
|
20
20
|
return {
|
|
21
21
|
active: jump.active.value,
|
|
22
22
|
from: jump.from.value,
|
|
@@ -33,7 +33,7 @@ export function pillIndicatorDotDistance(
|
|
|
33
33
|
jumpTo: number,
|
|
34
34
|
jumpT: number
|
|
35
35
|
): number {
|
|
36
|
-
|
|
36
|
+
"worklet";
|
|
37
37
|
if (!jumpActive) {
|
|
38
38
|
return Math.min(Math.abs(progress - index), 1);
|
|
39
39
|
}
|
|
@@ -57,7 +57,7 @@ export function pillIndicatorJumpDisplayProgress(
|
|
|
57
57
|
jumpTo: number,
|
|
58
58
|
jumpT: number
|
|
59
59
|
): number {
|
|
60
|
-
|
|
60
|
+
"worklet";
|
|
61
61
|
if (!jumpActive) return progress;
|
|
62
62
|
return jumpFrom + jumpT * (jumpTo - jumpFrom);
|
|
63
63
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type FC, type ReactNode, useContext, useEffect, useRef } from
|
|
1
|
+
import { type FC, type ReactNode, useContext, useEffect, useRef } from "react";
|
|
2
2
|
|
|
3
|
-
import { PortalContext } from
|
|
4
|
-
import { PortalHost, type PortalHostProps } from
|
|
5
|
-
import { PortalProvider, type PortalProviderProps } from
|
|
3
|
+
import { PortalContext } from "./PortalContext";
|
|
4
|
+
import { PortalHost, type PortalHostProps } from "./PortalHost";
|
|
5
|
+
import { PortalProvider, type PortalProviderProps } from "./PortalProvider";
|
|
6
6
|
|
|
7
7
|
let nextPortalKey = 1;
|
|
8
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Fragment, useContext } from
|
|
2
|
-
import { View, type ViewProps } from
|
|
1
|
+
import { Fragment, useContext } from "react";
|
|
2
|
+
import { View, type ViewProps } from "react-native";
|
|
3
3
|
|
|
4
|
-
import { PortalContext } from
|
|
4
|
+
import { PortalContext } from "./PortalContext";
|
|
5
5
|
|
|
6
|
-
export type PortalHostProps = Omit<ViewProps,
|
|
6
|
+
export type PortalHostProps = Omit<ViewProps, "children"> & {
|
|
7
7
|
/** Renders every `Portal` registered under this host name, in insertion order. */
|
|
8
8
|
name: string;
|
|
9
9
|
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { type ReactNode, useCallback, useMemo, useState } from
|
|
1
|
+
import { type ReactNode, useCallback, useMemo, useState } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
PortalContext,
|
|
5
|
-
type PortalContextValue,
|
|
6
|
-
type PortalStore,
|
|
7
|
-
} from './PortalContext';
|
|
3
|
+
import { PortalContext, type PortalContextValue, type PortalStore } from "./PortalContext";
|
|
8
4
|
|
|
9
5
|
export interface PortalProviderProps {
|
|
10
6
|
children: ReactNode;
|
|
@@ -18,36 +14,31 @@ export interface PortalProviderProps {
|
|
|
18
14
|
export function PortalProvider({ children }: PortalProviderProps) {
|
|
19
15
|
const [portals, setPortals] = useState<PortalStore>({});
|
|
20
16
|
|
|
21
|
-
const upsertPortal = useCallback(
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const existingIndex = hostPortals.findIndex(
|
|
26
|
-
(entry) => entry.key === key
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
if (existingIndex === -1) {
|
|
30
|
-
return {
|
|
31
|
-
...prev,
|
|
32
|
-
[hostName]: [...hostPortals, { key, node }],
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (hostPortals[existingIndex]?.node === node) {
|
|
37
|
-
return prev;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const nextHostPortals = [...hostPortals];
|
|
41
|
-
nextHostPortals[existingIndex] = { key, node };
|
|
17
|
+
const upsertPortal = useCallback((hostName: string, key: number, node: ReactNode) => {
|
|
18
|
+
setPortals((prev) => {
|
|
19
|
+
const hostPortals = prev[hostName] ?? [];
|
|
20
|
+
const existingIndex = hostPortals.findIndex((entry) => entry.key === key);
|
|
42
21
|
|
|
22
|
+
if (existingIndex === -1) {
|
|
43
23
|
return {
|
|
44
24
|
...prev,
|
|
45
|
-
[hostName]:
|
|
25
|
+
[hostName]: [...hostPortals, { key, node }],
|
|
46
26
|
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (hostPortals[existingIndex]?.node === node) {
|
|
30
|
+
return prev;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const nextHostPortals = [...hostPortals];
|
|
34
|
+
nextHostPortals[existingIndex] = { key, node };
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
...prev,
|
|
38
|
+
[hostName]: nextHostPortals,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}, []);
|
|
51
42
|
|
|
52
43
|
const removePortal = useCallback((hostName: string, key: number) => {
|
|
53
44
|
setPortals((prev) => {
|
|
@@ -75,7 +66,5 @@ export function PortalProvider({ children }: PortalProviderProps) {
|
|
|
75
66
|
[portals, removePortal, upsertPortal]
|
|
76
67
|
);
|
|
77
68
|
|
|
78
|
-
return
|
|
79
|
-
<PortalContext.Provider value={value}>{children}</PortalContext.Provider>
|
|
80
|
-
);
|
|
69
|
+
return <PortalContext.Provider value={value}>{children}</PortalContext.Provider>;
|
|
81
70
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type { PortalProps } from
|
|
2
|
-
export { Portal } from
|
|
3
|
-
export type { PortalContextValue, PortalEntry } from
|
|
4
|
-
export type { PortalHostProps } from
|
|
5
|
-
export { PortalHost } from
|
|
6
|
-
export type { PortalProviderProps } from
|
|
7
|
-
export { PortalProvider } from
|
|
1
|
+
export type { PortalProps } from "./Portal";
|
|
2
|
+
export { Portal } from "./Portal";
|
|
3
|
+
export type { PortalContextValue, PortalEntry } from "./PortalContext";
|
|
4
|
+
export type { PortalHostProps } from "./PortalHost";
|
|
5
|
+
export { PortalHost } from "./PortalHost";
|
|
6
|
+
export type { PortalProviderProps } from "./PortalProvider";
|
|
7
|
+
export { PortalProvider } from "./PortalProvider";
|