react-native-terra-ui 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/lib/module/components/avatar/Avatar.js +60 -60
- package/lib/module/components/avatar/Avatar.js.map +1 -1
- package/lib/module/components/box/Box.js +2 -2
- package/lib/module/components/box/Box.js.map +1 -1
- package/lib/module/components/box/utils.js +19 -19
- package/lib/module/components/box/utils.js.map +1 -1
- package/lib/module/components/button/Button.js +54 -48
- package/lib/module/components/button/Button.js.map +1 -1
- package/lib/module/components/chip/Chip.js +94 -94
- package/lib/module/components/chip/Chip.js.map +1 -1
- package/lib/module/components/chip/utils.js +3 -3
- package/lib/module/components/empty-state/EmptyState.js +40 -40
- package/lib/module/components/empty-state/EmptyState.js.map +1 -1
- package/lib/module/components/header/header-buttons.js +5 -5
- package/lib/module/components/header/header-buttons.js.map +1 -1
- package/lib/module/components/header/parts/HeaderGradientOverlay.js +2 -2
- package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -1
- package/lib/module/components/header/variants/LargeTitleHeader/index.js +58 -58
- package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
- package/lib/module/components/header/variants/TitleHeader/index.js +27 -27
- package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
- package/lib/module/components/icon/Icon.js +6 -6
- package/lib/module/components/icon/Icon.js.map +1 -1
- package/lib/module/components/image/Image.js +11 -6
- package/lib/module/components/image/Image.js.map +1 -1
- package/lib/module/components/page-indicator/PageIndicator.js +1 -1
- package/lib/module/components/page-indicator/PageIndicatorRoot.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js +8 -8
- package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-core.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js +6 -6
- package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js.map +1 -1
- package/lib/module/components/page-indicator/utils.js +8 -8
- package/lib/module/components/page-indicator/utils.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js +2 -2
- package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js +9 -9
- package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js +2 -2
- package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js +3 -3
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/utils.js +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/utils.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js +5 -5
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/utils.js +3 -3
- package/lib/module/components/portal/Portal.js +1 -1
- package/lib/module/components/portal/PortalContext.js +1 -1
- package/lib/module/components/portal/PortalHost.js +1 -1
- package/lib/module/components/portal/PortalProvider.js +1 -1
- package/lib/module/components/portal/PortalProvider.js.map +1 -1
- package/lib/module/components/screen/Screen.js +8 -8
- package/lib/module/components/screen/Screen.js.map +1 -1
- package/lib/module/components/screen/ScreenContext.js +6 -6
- package/lib/module/components/screen/ScreenContext.js.map +1 -1
- package/lib/module/components/screen/ScreenFlatList.js +3 -3
- package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
- package/lib/module/components/screen/ScreenList.js +5 -5
- package/lib/module/components/screen/ScreenList.js.map +1 -1
- package/lib/module/components/screen/ScreenScrollView.js +6 -6
- package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
- package/lib/module/components/screen/parts/BottomSafeArea.js +1 -1
- package/lib/module/components/screen/parts/BottomSafeArea.js.map +1 -1
- package/lib/module/components/screen/parts/ScreenPlaceholder.js +3 -3
- package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -1
- package/lib/module/components/screen/utils.js +3 -3
- package/lib/module/components/screen/utils.js.map +1 -1
- package/lib/module/components/slot/Slot.js +2 -2
- package/lib/module/components/slot/Slot.js.map +1 -1
- package/lib/module/components/slot/utils.js +3 -3
- package/lib/module/components/slot/utils.js.map +1 -1
- package/lib/module/components/spinner/Spinner.js +10 -10
- package/lib/module/components/spinner/Spinner.js.map +1 -1
- package/lib/module/components/surface/Surface.js +14 -14
- package/lib/module/components/surface/Surface.js.map +1 -1
- package/lib/module/components/text/Text.js +13 -13
- package/lib/module/components/text/Text.js.map +1 -1
- package/lib/module/components/toast/Toast.js +46 -46
- package/lib/module/components/toast/Toast.js.map +1 -1
- package/lib/module/components/toast/ToastProvider.js +32 -32
- package/lib/module/components/toast/ToastProvider.js.map +1 -1
- package/lib/module/components/toast/parts/ToastAnimatedItem.js +10 -10
- package/lib/module/components/toast/parts/ToastAnimatedItem.js.map +1 -1
- package/lib/module/components/toast/utils/controller.js +2 -2
- package/lib/module/components/toast/utils/controller.js.map +1 -1
- package/lib/module/components/toolbar/Toolbar.js +25 -25
- package/lib/module/components/toolbar/Toolbar.js.map +1 -1
- package/lib/module/context/ThemeProvider.js +5 -5
- package/lib/module/context/ThemeProvider.js.map +1 -1
- package/lib/module/theme/breakpoints.js.map +1 -1
- package/lib/module/theme/defaults/icons.js +11 -11
- package/lib/module/theme/defaults/icons.js.map +1 -1
- package/lib/module/theme/defaults/image.js +7 -7
- package/lib/module/theme/defaults/image.js.map +1 -1
- package/lib/module/theme/registry.js +11 -11
- package/lib/module/theme/registry.js.map +1 -1
- package/lib/module/theme/runtime.js +3 -3
- package/lib/module/theme/runtime.js.map +1 -1
- package/lib/module/theme/theme.js +9 -9
- package/lib/module/theme/theme.js.map +1 -1
- package/lib/module/theme/tokens/dark.js +67 -67
- package/lib/module/theme/tokens/light.js +67 -67
- package/lib/module/theme/tokens/primitives.js +417 -417
- package/lib/module/utils/accent-utils.js +16 -16
- package/lib/module/utils/accent-utils.js.map +1 -1
- package/lib/module/utils/color-utils.js +3 -3
- package/lib/module/utils/deep-merge.js +1 -1
- package/lib/module/utils/resolve-theme-color.js +2 -2
- package/lib/module/utils/resolve-theme-color.js.map +1 -1
- package/lib/module/utils/typography.js +5 -5
- package/lib/module/utils/typography.js.map +1 -1
- package/lib/module/utils/unflatten.js +2 -2
- package/lib/typescript/src/components/avatar/Avatar.d.ts +1 -1
- package/lib/typescript/src/components/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/src/components/avatar/index.d.ts +2 -2
- package/lib/typescript/src/components/avatar/types.d.ts +7 -7
- package/lib/typescript/src/components/avatar/types.d.ts.map +1 -1
- package/lib/typescript/src/components/box/Box.d.ts +2 -2
- package/lib/typescript/src/components/box/Box.d.ts.map +1 -1
- package/lib/typescript/src/components/box/index.d.ts +3 -3
- package/lib/typescript/src/components/box/utils.d.ts +7 -7
- package/lib/typescript/src/components/box/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/button/Button.d.ts +15 -8
- package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +2 -2
- package/lib/typescript/src/components/chip/Chip.d.ts +5 -5
- package/lib/typescript/src/components/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/index.d.ts +3 -3
- package/lib/typescript/src/components/chip/types.d.ts +3 -3
- package/lib/typescript/src/components/chip/utils.d.ts +1 -1
- package/lib/typescript/src/components/empty-state/EmptyState.d.ts +5 -5
- package/lib/typescript/src/components/empty-state/EmptyState.d.ts.map +1 -1
- package/lib/typescript/src/components/empty-state/index.d.ts +3 -3
- package/lib/typescript/src/components/empty-state/types.d.ts +1 -1
- package/lib/typescript/src/components/header/Header.d.ts +2 -2
- package/lib/typescript/src/components/header/header-buttons.d.ts +3 -3
- package/lib/typescript/src/components/header/header-buttons.d.ts.map +1 -1
- package/lib/typescript/src/components/header/index.d.ts +6 -6
- package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts.map +1 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +1 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +4 -4
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/icon/Icon.d.ts +3 -3
- package/lib/typescript/src/components/icon/Icon.d.ts.map +1 -1
- package/lib/typescript/src/components/icon/index.d.ts +2 -2
- package/lib/typescript/src/components/image/Image.d.ts +2 -2
- package/lib/typescript/src/components/image/Image.d.ts.map +1 -1
- package/lib/typescript/src/components/image/index.d.ts +2 -2
- package/lib/typescript/src/components/image/types.d.ts +1 -1
- package/lib/typescript/src/components/index.d.ts +17 -17
- package/lib/typescript/src/components/page-indicator/PageIndicator.d.ts +10 -10
- package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/utils.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/utils.d.ts +1 -1
- package/lib/typescript/src/components/portal/Portal.d.ts +3 -3
- package/lib/typescript/src/components/portal/PortalContext.d.ts +1 -1
- package/lib/typescript/src/components/portal/PortalHost.d.ts +2 -2
- package/lib/typescript/src/components/portal/PortalProvider.d.ts +1 -1
- package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/portal/index.d.ts +7 -7
- package/lib/typescript/src/components/screen/Screen.d.ts +10 -10
- package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenContext.d.ts +3 -3
- package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +3 -3
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenList.d.ts +5 -5
- package/lib/typescript/src/components/screen/ScreenList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +5 -5
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/index.d.ts +11 -11
- package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +3 -3
- package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/types.d.ts +2 -2
- package/lib/typescript/src/components/screen/utils.d.ts +2 -2
- package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/slot/Slot.d.ts +2 -2
- package/lib/typescript/src/components/slot/Slot.d.ts.map +1 -1
- package/lib/typescript/src/components/slot/index.d.ts +3 -3
- package/lib/typescript/src/components/slot/utils.d.ts +1 -1
- package/lib/typescript/src/components/slot/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/spinner/Spinner.d.ts +2 -2
- package/lib/typescript/src/components/spinner/Spinner.d.ts.map +1 -1
- package/lib/typescript/src/components/spinner/index.d.ts +2 -2
- package/lib/typescript/src/components/surface/Surface.d.ts +4 -4
- package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -1
- package/lib/typescript/src/components/surface/index.d.ts +2 -2
- package/lib/typescript/src/components/text/Text.d.ts +4 -4
- package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
- package/lib/typescript/src/components/text/index.d.ts +2 -2
- package/lib/typescript/src/components/toast/Toast.d.ts +18 -18
- package/lib/typescript/src/components/toast/Toast.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/ToastProvider.d.ts +1 -1
- package/lib/typescript/src/components/toast/ToastProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/index.d.ts +4 -4
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts +3 -3
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/types.d.ts +10 -10
- package/lib/typescript/src/components/toast/types.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/utils/controller.d.ts +2 -2
- package/lib/typescript/src/components/toast/utils/controller.d.ts.map +1 -1
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts +5 -5
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/typescript/src/components/toolbar/index.d.ts +2 -2
- package/lib/typescript/src/context/ThemeProvider.d.ts +3 -3
- package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/context/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts +3 -3
- package/lib/typescript/src/theme/breakpoints.d.ts +2 -2
- package/lib/typescript/src/theme/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/theme/defaults/icons.d.ts +1 -1
- package/lib/typescript/src/theme/defaults/icons.d.ts.map +1 -1
- package/lib/typescript/src/theme/defaults/image.d.ts +1 -1
- package/lib/typescript/src/theme/defaults/image.d.ts.map +1 -1
- package/lib/typescript/src/theme/index.d.ts +14 -14
- package/lib/typescript/src/theme/registry.d.ts +2 -2
- package/lib/typescript/src/theme/registry.d.ts.map +1 -1
- package/lib/typescript/src/theme/runtime.d.ts +1 -1
- package/lib/typescript/src/theme/runtime.d.ts.map +1 -1
- package/lib/typescript/src/theme/screen-margin.d.ts +2 -2
- package/lib/typescript/src/theme/theme.d.ts +2 -2
- package/lib/typescript/src/theme/theme.d.ts.map +1 -1
- package/lib/typescript/src/theme/tokens/dark.d.ts +67 -67
- package/lib/typescript/src/theme/tokens/light.d.ts +67 -67
- package/lib/typescript/src/theme/tokens/primitives.d.ts +417 -417
- package/lib/typescript/src/theme/types.d.ts +99 -84
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/accent-utils.d.ts +1 -1
- package/lib/typescript/src/utils/accent-utils.d.ts.map +1 -1
- package/lib/typescript/src/utils/resolve-theme-color.d.ts +1 -1
- package/lib/typescript/src/utils/resolve-theme-color.d.ts.map +1 -1
- package/lib/typescript/src/utils/typography.d.ts +2 -2
- package/lib/typescript/src/utils/typography.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/avatar/Avatar.tsx +66 -71
- package/src/components/avatar/index.ts +2 -2
- package/src/components/avatar/types.ts +7 -12
- package/src/components/box/Box.tsx +7 -18
- package/src/components/box/index.ts +3 -3
- package/src/components/box/utils.ts +59 -81
- package/src/components/button/Button.tsx +119 -144
- package/src/components/button/index.ts +2 -2
- package/src/components/chip/Chip.tsx +107 -143
- package/src/components/chip/index.ts +3 -3
- package/src/components/chip/types.ts +7 -7
- package/src/components/chip/utils.ts +5 -5
- package/src/components/empty-state/EmptyState.tsx +44 -60
- package/src/components/empty-state/index.ts +3 -3
- package/src/components/empty-state/types.ts +1 -1
- package/src/components/header/Header.ts +2 -2
- package/src/components/header/header-buttons.tsx +10 -18
- package/src/components/header/index.ts +6 -6
- package/src/components/header/parts/HeaderGradientOverlay.tsx +3 -7
- package/src/components/header/variants/LargeTitleHeader/index.tsx +75 -139
- package/src/components/header/variants/TitleHeader/index.tsx +40 -62
- package/src/components/icon/Icon.tsx +31 -39
- package/src/components/icon/index.ts +2 -2
- package/src/components/image/Image.tsx +22 -11
- package/src/components/image/index.ts +2 -2
- package/src/components/image/types.ts +1 -1
- package/src/components/index.ts +17 -17
- package/src/components/page-indicator/PageIndicator.tsx +14 -14
- package/src/components/page-indicator/PageIndicatorRoot.tsx +4 -12
- package/src/components/page-indicator/hooks/use-page-indicator-colors.ts +17 -35
- package/src/components/page-indicator/hooks/use-page-indicator-core.ts +6 -8
- package/src/components/page-indicator/hooks/use-page-indicator-progress.ts +10 -30
- package/src/components/page-indicator/index.ts +3 -3
- package/src/components/page-indicator/utils.ts +20 -48
- package/src/components/page-indicator/variants/DotIndicator/InactiveDot.tsx +5 -16
- package/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.tsx +21 -63
- package/src/components/page-indicator/variants/DotIndicator/TravelingPill.tsx +6 -16
- package/src/components/page-indicator/variants/DotIndicator/index.tsx +20 -38
- package/src/components/page-indicator/variants/DotIndicator/utils.ts +2 -6
- package/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.tsx +12 -50
- package/src/components/page-indicator/variants/PillIndicator/index.tsx +19 -41
- package/src/components/page-indicator/variants/PillIndicator/utils.ts +4 -4
- package/src/components/portal/Portal.tsx +4 -4
- package/src/components/portal/PortalContext.tsx +1 -1
- package/src/components/portal/PortalHost.tsx +4 -4
- package/src/components/portal/PortalProvider.tsx +24 -35
- package/src/components/portal/index.ts +7 -7
- package/src/components/screen/Screen.tsx +45 -52
- package/src/components/screen/ScreenContext.tsx +8 -17
- package/src/components/screen/ScreenFlatList.tsx +17 -36
- package/src/components/screen/ScreenList.tsx +31 -63
- package/src/components/screen/ScreenScrollView.tsx +17 -30
- package/src/components/screen/index.ts +11 -11
- package/src/components/screen/parts/BottomSafeArea.tsx +5 -6
- package/src/components/screen/parts/ScreenPlaceholder.tsx +9 -14
- package/src/components/screen/types.ts +2 -2
- package/src/components/screen/utils.ts +6 -19
- package/src/components/slot/Slot.tsx +5 -20
- package/src/components/slot/index.ts +3 -3
- package/src/components/slot/utils.ts +5 -8
- package/src/components/spinner/Spinner.tsx +19 -52
- package/src/components/spinner/index.ts +2 -2
- package/src/components/surface/Surface.tsx +34 -43
- package/src/components/surface/index.ts +2 -2
- package/src/components/text/Text.tsx +75 -85
- package/src/components/text/index.ts +2 -2
- package/src/components/toast/Toast.tsx +195 -251
- package/src/components/toast/ToastProvider.tsx +61 -136
- package/src/components/toast/index.ts +4 -4
- package/src/components/toast/parts/ToastAnimatedItem.tsx +14 -22
- package/src/components/toast/types.ts +11 -14
- package/src/components/toast/utils/controller.ts +4 -6
- package/src/components/toolbar/Toolbar.tsx +42 -61
- package/src/components/toolbar/index.ts +2 -2
- package/src/context/ThemeProvider.tsx +13 -28
- package/src/context/index.ts +2 -2
- package/src/index.tsx +3 -3
- package/src/theme/breakpoints.ts +3 -5
- package/src/theme/defaults/icons.tsx +15 -30
- package/src/theme/defaults/image.tsx +9 -14
- package/src/theme/index.ts +14 -14
- package/src/theme/registry.ts +30 -49
- package/src/theme/runtime.ts +6 -7
- package/src/theme/screen-margin.ts +3 -3
- package/src/theme/theme.ts +39 -60
- package/src/theme/tokens/dark.ts +67 -67
- package/src/theme/tokens/light.ts +67 -67
- package/src/theme/tokens/primitives.ts +417 -417
- package/src/theme/types.ts +138 -135
- package/src/utils/accent-utils.ts +21 -30
- package/src/utils/color-utils.ts +3 -3
- package/src/utils/deep-merge.ts +1 -1
- package/src/utils/resolve-theme-color.ts +8 -11
- package/src/utils/typography.ts +7 -10
- package/src/utils/unflatten.ts +2 -2
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
StyleSheet,
|
|
13
|
-
useUnistyles,
|
|
14
|
-
withUnistyles,
|
|
15
|
-
} from 'react-native-unistyles';
|
|
16
|
-
|
|
17
|
-
import type { ColorToken, RoleTextVariant, TerraIconName } from '#theme/types';
|
|
18
|
-
import { resolveThemeColor } from '#utils/resolve-theme-color';
|
|
19
|
-
import { FONT_WEIGHT_VALUE, SYSTEM_FONT } from '#utils/typography';
|
|
20
|
-
|
|
21
|
-
import { Icon } from '../icon';
|
|
22
|
-
import type { ChipColor, ChipSize, ChipVariant } from './types';
|
|
23
|
-
import { type CustomChipColors, getCustomColorColors } from './utils';
|
|
1
|
+
import { Children, type ComponentRef, createContext, forwardRef, type ReactNode, useContext } from "react";
|
|
2
|
+
import { Text as RNText, View, type ViewProps } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { StyleSheet, useUnistyles, withUnistyles } from "react-native-unistyles";
|
|
5
|
+
|
|
6
|
+
import type { ColorToken, RoleTextVariant, TerraIconName } from "#theme/types";
|
|
7
|
+
import { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
8
|
+
import { FONT_WEIGHT_VALUE, SYSTEM_FONT } from "#utils/typography";
|
|
9
|
+
import { Icon } from "../icon";
|
|
10
|
+
import type { ChipColor, ChipSize, ChipVariant } from "./types";
|
|
11
|
+
import { type CustomChipColors, getCustomColorColors } from "./utils";
|
|
24
12
|
|
|
25
13
|
export interface ChipProps extends ViewProps {
|
|
26
14
|
size?: ChipSize;
|
|
@@ -43,8 +31,8 @@ interface ChipContextValue {
|
|
|
43
31
|
}
|
|
44
32
|
|
|
45
33
|
const ChipContext = createContext<ChipContextValue>({
|
|
46
|
-
color:
|
|
47
|
-
size:
|
|
34
|
+
color: "text.default",
|
|
35
|
+
size: "md",
|
|
48
36
|
});
|
|
49
37
|
|
|
50
38
|
// ─── Colors ─────────────────────────────────────────────────────────────────
|
|
@@ -63,50 +51,44 @@ const ChipContext = createContext<ChipContextValue>({
|
|
|
63
51
|
// can't be a compound variant condition — see `getCustomColorColors` in
|
|
64
52
|
// `utils.ts` for how it's derived instead.
|
|
65
53
|
|
|
66
|
-
const SCHEME_NAMES = new Set([
|
|
67
|
-
'primary',
|
|
68
|
-
'secondary',
|
|
69
|
-
'success',
|
|
70
|
-
'warning',
|
|
71
|
-
'danger',
|
|
72
|
-
]);
|
|
54
|
+
const SCHEME_NAMES = new Set(["primary", "secondary", "success", "warning", "danger"]);
|
|
73
55
|
|
|
74
|
-
type ChipScheme =
|
|
75
|
-
type ChipPaintedVariant = Exclude<ChipVariant,
|
|
56
|
+
type ChipScheme = "primary" | "secondary" | "success" | "warning" | "danger";
|
|
57
|
+
type ChipPaintedVariant = Exclude<ChipVariant, "ghost">;
|
|
76
58
|
|
|
77
59
|
// `ghost` is `outline` with its border taken away, so it has no colors of its
|
|
78
60
|
// own — it borrows outline's foreground. Only the *paint* differs, and that
|
|
79
61
|
// comes from the `ghost` style variant, never from here.
|
|
80
62
|
function paintedVariant(variant: ChipVariant): ChipPaintedVariant {
|
|
81
|
-
return variant ===
|
|
63
|
+
return variant === "ghost" ? "outline" : variant;
|
|
82
64
|
}
|
|
83
65
|
|
|
84
66
|
/** Foreground token per (scheme, variant) — mirrors the spec's token table. */
|
|
85
67
|
const FG_TOKEN: Record<ChipScheme, Record<ChipPaintedVariant, ColorToken>> = {
|
|
86
68
|
primary: {
|
|
87
|
-
solid:
|
|
88
|
-
soft:
|
|
89
|
-
outline:
|
|
69
|
+
solid: "action.fg.primary",
|
|
70
|
+
soft: "action.fg.primary.subtle",
|
|
71
|
+
outline: "text.accent",
|
|
90
72
|
},
|
|
91
73
|
secondary: {
|
|
92
|
-
solid:
|
|
93
|
-
soft:
|
|
94
|
-
outline:
|
|
74
|
+
solid: "action.fg.secondary",
|
|
75
|
+
soft: "action.fg.secondary.subtle",
|
|
76
|
+
outline: "text.default",
|
|
95
77
|
},
|
|
96
78
|
success: {
|
|
97
|
-
solid:
|
|
98
|
-
soft:
|
|
99
|
-
outline:
|
|
79
|
+
solid: "status.success.fg",
|
|
80
|
+
soft: "status.success.fg.subtle",
|
|
81
|
+
outline: "status.success.fg.subtle",
|
|
100
82
|
},
|
|
101
83
|
warning: {
|
|
102
|
-
solid:
|
|
103
|
-
soft:
|
|
104
|
-
outline:
|
|
84
|
+
solid: "status.warning.fg",
|
|
85
|
+
soft: "status.warning.fg.subtle",
|
|
86
|
+
outline: "status.warning.fg.subtle",
|
|
105
87
|
},
|
|
106
88
|
danger: {
|
|
107
|
-
solid:
|
|
108
|
-
soft:
|
|
109
|
-
outline:
|
|
89
|
+
solid: "status.danger.fg",
|
|
90
|
+
soft: "status.danger.fg.subtle",
|
|
91
|
+
outline: "status.danger.fg.subtle",
|
|
110
92
|
},
|
|
111
93
|
};
|
|
112
94
|
|
|
@@ -123,9 +105,9 @@ function resolveForeground(
|
|
|
123
105
|
// ─── Label sub-component ───────────────────────────────────────────────────────
|
|
124
106
|
|
|
125
107
|
const LABEL_VARIANT: Record<ChipSize, RoleTextVariant> = {
|
|
126
|
-
sm:
|
|
127
|
-
md:
|
|
128
|
-
lg:
|
|
108
|
+
sm: "label-sm",
|
|
109
|
+
md: "label-md",
|
|
110
|
+
lg: "label-lg",
|
|
129
111
|
};
|
|
130
112
|
|
|
131
113
|
// Renders through React Native's `Text` rather than the `Text` primitive: a
|
|
@@ -143,9 +125,7 @@ const ChipLabel = ({ children }: { children: ReactNode }) => {
|
|
|
143
125
|
return (
|
|
144
126
|
<RNText
|
|
145
127
|
style={[styles.label, { color: resolveThemeColor(color, theme) }]}
|
|
146
|
-
maxFontSizeMultiplier={
|
|
147
|
-
theme.typography.variants[LABEL_VARIANT[size]].maxFontSizeMultiplier
|
|
148
|
-
}
|
|
128
|
+
maxFontSizeMultiplier={theme.typography.variants[LABEL_VARIANT[size]].maxFontSizeMultiplier}
|
|
149
129
|
>
|
|
150
130
|
{children}
|
|
151
131
|
</RNText>
|
|
@@ -160,21 +140,14 @@ const ICON_SIZE: Record<ChipSize, number> = {
|
|
|
160
140
|
lg: 20,
|
|
161
141
|
};
|
|
162
142
|
|
|
163
|
-
export interface ChipIconProps extends Omit<ViewProps,
|
|
143
|
+
export interface ChipIconProps extends Omit<ViewProps, "children"> {
|
|
164
144
|
name: TerraIconName;
|
|
165
145
|
size?: number;
|
|
166
146
|
color?: ColorToken;
|
|
167
147
|
strokeWidth?: number;
|
|
168
148
|
}
|
|
169
149
|
|
|
170
|
-
const ChipIcon = ({
|
|
171
|
-
name,
|
|
172
|
-
size: sizeProp,
|
|
173
|
-
color,
|
|
174
|
-
strokeWidth,
|
|
175
|
-
style,
|
|
176
|
-
...rest
|
|
177
|
-
}: ChipIconProps) => {
|
|
150
|
+
const ChipIcon = ({ name, size: sizeProp, color, strokeWidth, style, ...rest }: ChipIconProps) => {
|
|
178
151
|
const { color: contextColor, size } = useContext(ChipContext);
|
|
179
152
|
|
|
180
153
|
return (
|
|
@@ -191,10 +164,10 @@ const ChipIcon = ({
|
|
|
191
164
|
|
|
192
165
|
function renderChildren(children: ReactNode): ReactNode {
|
|
193
166
|
return Children.map(children, (child) => {
|
|
194
|
-
if (typeof child ===
|
|
167
|
+
if (typeof child === "string") {
|
|
195
168
|
return child.trim().length > 0 ? <ChipLabel>{child}</ChipLabel> : null;
|
|
196
169
|
}
|
|
197
|
-
if (typeof child ===
|
|
170
|
+
if (typeof child === "number") {
|
|
198
171
|
return <ChipLabel>{child}</ChipLabel>;
|
|
199
172
|
}
|
|
200
173
|
return child;
|
|
@@ -204,14 +177,7 @@ function renderChildren(children: ReactNode): ReactNode {
|
|
|
204
177
|
// ─── Component ────────────────────────────────────────────────────────────────
|
|
205
178
|
|
|
206
179
|
const ChipRoot = forwardRef<ComponentRef<typeof View>, ChipProps>(function Chip(
|
|
207
|
-
{
|
|
208
|
-
size = 'md',
|
|
209
|
-
variant = 'soft',
|
|
210
|
-
color = 'secondary',
|
|
211
|
-
children,
|
|
212
|
-
style,
|
|
213
|
-
...rest
|
|
214
|
-
},
|
|
180
|
+
{ size = "md", variant = "soft", color = "secondary", children, style, ...rest },
|
|
215
181
|
ref
|
|
216
182
|
) {
|
|
217
183
|
// Compound variants only match the 5 named schemes above — an arbitrary
|
|
@@ -220,16 +186,14 @@ const ChipRoot = forwardRef<ComponentRef<typeof View>, ChipProps>(function Chip(
|
|
|
220
186
|
styles.useVariants({ color: color as ChipScheme, variant, size });
|
|
221
187
|
|
|
222
188
|
const isCustomColor = !SCHEME_NAMES.has(color);
|
|
223
|
-
const customColors = isCustomColor
|
|
224
|
-
? getCustomColorColors(color, paintedVariant(variant))
|
|
225
|
-
: null;
|
|
189
|
+
const customColors = isCustomColor ? getCustomColorColors(color, paintedVariant(variant)) : null;
|
|
226
190
|
|
|
227
191
|
const fg = resolveForeground(color, variant, customColors);
|
|
228
192
|
// Ghost takes outline's foreground but none of its paint — its transparent
|
|
229
193
|
// background and absent border come from the `ghost` style variant, so
|
|
230
194
|
// applying the derived paint here would hand it outline's border back.
|
|
231
195
|
const customPaint =
|
|
232
|
-
customColors && variant !==
|
|
196
|
+
customColors && variant !== "ghost"
|
|
233
197
|
? {
|
|
234
198
|
backgroundColor: customColors.bg,
|
|
235
199
|
borderColor: customColors.border,
|
|
@@ -297,27 +261,27 @@ const styles = StyleSheet.create((theme) => {
|
|
|
297
261
|
variants: {
|
|
298
262
|
size: {
|
|
299
263
|
sm: {
|
|
300
|
-
fontSize: theme.typography.variants[
|
|
301
|
-
lineHeight: theme.typography.variants[
|
|
302
|
-
letterSpacing: theme.typography.variants[
|
|
264
|
+
fontSize: theme.typography.variants["label-sm"].fontSize,
|
|
265
|
+
lineHeight: theme.typography.variants["label-sm"].lineHeight,
|
|
266
|
+
letterSpacing: theme.typography.variants["label-sm"].letterSpacing,
|
|
303
267
|
},
|
|
304
268
|
md: {
|
|
305
|
-
fontSize: theme.typography.variants[
|
|
306
|
-
lineHeight: theme.typography.variants[
|
|
307
|
-
letterSpacing: theme.typography.variants[
|
|
269
|
+
fontSize: theme.typography.variants["label-md"].fontSize,
|
|
270
|
+
lineHeight: theme.typography.variants["label-md"].lineHeight,
|
|
271
|
+
letterSpacing: theme.typography.variants["label-md"].letterSpacing,
|
|
308
272
|
},
|
|
309
273
|
lg: {
|
|
310
|
-
fontSize: theme.typography.variants[
|
|
311
|
-
lineHeight: theme.typography.variants[
|
|
312
|
-
letterSpacing: theme.typography.variants[
|
|
274
|
+
fontSize: theme.typography.variants["label-lg"].fontSize,
|
|
275
|
+
lineHeight: theme.typography.variants["label-lg"].lineHeight,
|
|
276
|
+
letterSpacing: theme.typography.variants["label-lg"].letterSpacing,
|
|
313
277
|
},
|
|
314
278
|
},
|
|
315
279
|
},
|
|
316
280
|
},
|
|
317
281
|
base: {
|
|
318
|
-
flexDirection:
|
|
319
|
-
alignItems:
|
|
320
|
-
alignSelf:
|
|
282
|
+
flexDirection: "row",
|
|
283
|
+
alignItems: "center",
|
|
284
|
+
alignSelf: "flex-start",
|
|
321
285
|
borderRadius: theme.radius.full,
|
|
322
286
|
variants: {
|
|
323
287
|
size: {
|
|
@@ -352,135 +316,135 @@ const styles = StyleSheet.create((theme) => {
|
|
|
352
316
|
soft: {},
|
|
353
317
|
outline: {},
|
|
354
318
|
ghost: {
|
|
355
|
-
backgroundColor:
|
|
356
|
-
borderColor:
|
|
319
|
+
backgroundColor: "transparent",
|
|
320
|
+
borderColor: "transparent",
|
|
357
321
|
borderWidth: 0,
|
|
358
322
|
},
|
|
359
323
|
},
|
|
360
324
|
},
|
|
361
325
|
compoundVariants: [
|
|
362
326
|
{
|
|
363
|
-
color:
|
|
364
|
-
variant:
|
|
327
|
+
color: "primary",
|
|
328
|
+
variant: "solid",
|
|
365
329
|
styles: {
|
|
366
|
-
backgroundColor: c[
|
|
330
|
+
backgroundColor: c["action.bg.primary"],
|
|
367
331
|
borderWidth: 0,
|
|
368
332
|
},
|
|
369
333
|
},
|
|
370
334
|
{
|
|
371
|
-
color:
|
|
372
|
-
variant:
|
|
335
|
+
color: "primary",
|
|
336
|
+
variant: "soft",
|
|
373
337
|
styles: {
|
|
374
|
-
backgroundColor: c[
|
|
338
|
+
backgroundColor: c["action.bg.primary.subtle"],
|
|
375
339
|
borderWidth: 0,
|
|
376
340
|
},
|
|
377
341
|
},
|
|
378
342
|
{
|
|
379
|
-
color:
|
|
380
|
-
variant:
|
|
343
|
+
color: "primary",
|
|
344
|
+
variant: "outline",
|
|
381
345
|
styles: {
|
|
382
|
-
backgroundColor:
|
|
383
|
-
borderColor: c[
|
|
346
|
+
backgroundColor: "transparent",
|
|
347
|
+
borderColor: c["action.bg.primary.subtle"],
|
|
384
348
|
borderWidth: 1,
|
|
385
349
|
},
|
|
386
350
|
},
|
|
387
351
|
{
|
|
388
|
-
color:
|
|
389
|
-
variant:
|
|
352
|
+
color: "secondary",
|
|
353
|
+
variant: "solid",
|
|
390
354
|
styles: {
|
|
391
|
-
backgroundColor: c[
|
|
355
|
+
backgroundColor: c["action.bg.secondary"],
|
|
392
356
|
borderWidth: 0,
|
|
393
357
|
},
|
|
394
358
|
},
|
|
395
359
|
{
|
|
396
|
-
color:
|
|
397
|
-
variant:
|
|
360
|
+
color: "secondary",
|
|
361
|
+
variant: "soft",
|
|
398
362
|
styles: {
|
|
399
|
-
backgroundColor: c[
|
|
363
|
+
backgroundColor: c["action.bg.secondary.subtle"],
|
|
400
364
|
borderWidth: 0,
|
|
401
365
|
},
|
|
402
366
|
},
|
|
403
367
|
{
|
|
404
|
-
color:
|
|
405
|
-
variant:
|
|
368
|
+
color: "secondary",
|
|
369
|
+
variant: "outline",
|
|
406
370
|
styles: {
|
|
407
|
-
backgroundColor:
|
|
408
|
-
borderColor: c[
|
|
371
|
+
backgroundColor: "transparent",
|
|
372
|
+
borderColor: c["action.bg.secondary.subtle"],
|
|
409
373
|
borderWidth: 1,
|
|
410
374
|
},
|
|
411
375
|
},
|
|
412
376
|
{
|
|
413
|
-
color:
|
|
414
|
-
variant:
|
|
377
|
+
color: "success",
|
|
378
|
+
variant: "solid",
|
|
415
379
|
styles: {
|
|
416
|
-
backgroundColor: c[
|
|
380
|
+
backgroundColor: c["status.success.bg"],
|
|
417
381
|
borderWidth: 0,
|
|
418
382
|
},
|
|
419
383
|
},
|
|
420
384
|
{
|
|
421
|
-
color:
|
|
422
|
-
variant:
|
|
385
|
+
color: "success",
|
|
386
|
+
variant: "soft",
|
|
423
387
|
styles: {
|
|
424
|
-
backgroundColor: c[
|
|
388
|
+
backgroundColor: c["status.success.bg.subtle"],
|
|
425
389
|
borderWidth: 0,
|
|
426
390
|
},
|
|
427
391
|
},
|
|
428
392
|
{
|
|
429
|
-
color:
|
|
430
|
-
variant:
|
|
393
|
+
color: "success",
|
|
394
|
+
variant: "outline",
|
|
431
395
|
styles: {
|
|
432
|
-
backgroundColor:
|
|
433
|
-
borderColor: c[
|
|
396
|
+
backgroundColor: "transparent",
|
|
397
|
+
borderColor: c["status.success.bg.subtle"],
|
|
434
398
|
borderWidth: 1,
|
|
435
399
|
},
|
|
436
400
|
},
|
|
437
401
|
{
|
|
438
|
-
color:
|
|
439
|
-
variant:
|
|
402
|
+
color: "warning",
|
|
403
|
+
variant: "solid",
|
|
440
404
|
styles: {
|
|
441
|
-
backgroundColor: c[
|
|
405
|
+
backgroundColor: c["status.warning.bg"],
|
|
442
406
|
borderWidth: 0,
|
|
443
407
|
},
|
|
444
408
|
},
|
|
445
409
|
{
|
|
446
|
-
color:
|
|
447
|
-
variant:
|
|
410
|
+
color: "warning",
|
|
411
|
+
variant: "soft",
|
|
448
412
|
styles: {
|
|
449
|
-
backgroundColor: c[
|
|
413
|
+
backgroundColor: c["status.warning.bg.subtle"],
|
|
450
414
|
borderWidth: 0,
|
|
451
415
|
},
|
|
452
416
|
},
|
|
453
417
|
{
|
|
454
|
-
color:
|
|
455
|
-
variant:
|
|
418
|
+
color: "warning",
|
|
419
|
+
variant: "outline",
|
|
456
420
|
styles: {
|
|
457
|
-
backgroundColor:
|
|
458
|
-
borderColor: c[
|
|
421
|
+
backgroundColor: "transparent",
|
|
422
|
+
borderColor: c["status.warning.bg.subtle"],
|
|
459
423
|
borderWidth: 1,
|
|
460
424
|
},
|
|
461
425
|
},
|
|
462
426
|
{
|
|
463
|
-
color:
|
|
464
|
-
variant:
|
|
427
|
+
color: "danger",
|
|
428
|
+
variant: "solid",
|
|
465
429
|
styles: {
|
|
466
|
-
backgroundColor: c[
|
|
430
|
+
backgroundColor: c["status.danger.bg"],
|
|
467
431
|
borderWidth: 0,
|
|
468
432
|
},
|
|
469
433
|
},
|
|
470
434
|
{
|
|
471
|
-
color:
|
|
472
|
-
variant:
|
|
435
|
+
color: "danger",
|
|
436
|
+
variant: "soft",
|
|
473
437
|
styles: {
|
|
474
|
-
backgroundColor: c[
|
|
438
|
+
backgroundColor: c["status.danger.bg.subtle"],
|
|
475
439
|
borderWidth: 0,
|
|
476
440
|
},
|
|
477
441
|
},
|
|
478
442
|
{
|
|
479
|
-
color:
|
|
480
|
-
variant:
|
|
443
|
+
color: "danger",
|
|
444
|
+
variant: "outline",
|
|
481
445
|
styles: {
|
|
482
|
-
backgroundColor:
|
|
483
|
-
borderColor: c[
|
|
446
|
+
backgroundColor: "transparent",
|
|
447
|
+
borderColor: c["status.danger.bg.subtle"],
|
|
484
448
|
borderWidth: 1,
|
|
485
449
|
},
|
|
486
450
|
},
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { ChipIconProps, ChipProps } from
|
|
2
|
-
export { Chip } from
|
|
3
|
-
export type { ChipColor, ChipSize, ChipVariant } from
|
|
1
|
+
export type { ChipIconProps, ChipProps } from "./Chip";
|
|
2
|
+
export { Chip } from "./Chip";
|
|
3
|
+
export type { ChipColor, ChipSize, ChipVariant } from "./types";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export type ChipSize =
|
|
2
|
-
export type ChipVariant =
|
|
1
|
+
export type ChipSize = "sm" | "md" | "lg";
|
|
2
|
+
export type ChipVariant = "solid" | "soft" | "outline" | "ghost";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Semantic color scheme, or a raw CSS color literal (`#fff`, `rgb(...)`, `hsl(...)`).
|
|
6
6
|
* Has no effect when `variant="ghost"` — ghost always renders `text.default`.
|
|
7
7
|
*/
|
|
8
8
|
export type ChipColor =
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
9
|
+
| "primary"
|
|
10
|
+
| "secondary"
|
|
11
|
+
| "success"
|
|
12
|
+
| "warning"
|
|
13
|
+
| "danger"
|
|
14
14
|
// literals last so scheme-name autocomplete still surfaces
|
|
15
15
|
| (string & {});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readableOn, withAlpha } from
|
|
1
|
+
import { readableOn, withAlpha } from "#utils/color-utils";
|
|
2
2
|
|
|
3
3
|
// A custom color literal (hex/rgb/hsl) can't be a unistyles compound variant
|
|
4
4
|
// condition (it's not a bounded set of options), so it's derived here
|
|
@@ -16,19 +16,19 @@ const CUSTOM_COLOR_SOFT_ALPHA = 0.16;
|
|
|
16
16
|
|
|
17
17
|
export function getCustomColorColors(
|
|
18
18
|
literal: string,
|
|
19
|
-
variant:
|
|
19
|
+
variant: "solid" | "soft" | "outline"
|
|
20
20
|
): CustomChipColors {
|
|
21
21
|
// Outline borrows the `soft` background as its border, so the two variants
|
|
22
22
|
// read as the same weight of colour — one filled, one drawn.
|
|
23
|
-
if (variant ===
|
|
23
|
+
if (variant === "outline") {
|
|
24
24
|
return {
|
|
25
|
-
bg:
|
|
25
|
+
bg: "transparent",
|
|
26
26
|
border: withAlpha(literal, CUSTOM_COLOR_SOFT_ALPHA),
|
|
27
27
|
borderWidth: 1,
|
|
28
28
|
fg: literal,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
if (variant ===
|
|
31
|
+
if (variant === "soft") {
|
|
32
32
|
const bg = withAlpha(literal, CUSTOM_COLOR_SOFT_ALPHA);
|
|
33
33
|
return { bg, border: bg, borderWidth: 0, fg: literal };
|
|
34
34
|
}
|