react-native-terra-ui 0.1.1 → 0.2.1
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 +96 -0
- package/lib/module/components/avatar/Avatar.js +118 -35
- package/lib/module/components/avatar/Avatar.js.map +1 -1
- package/lib/module/components/box/Box.js +15 -2
- package/lib/module/components/box/Box.js.map +1 -1
- package/lib/module/components/box/utils.js +4 -1
- package/lib/module/components/box/utils.js.map +1 -1
- package/lib/module/components/button/Button.js +7 -14
- package/lib/module/components/button/Button.js.map +1 -1
- package/lib/module/components/chip/Chip.js +372 -0
- package/lib/module/components/chip/Chip.js.map +1 -0
- package/lib/module/components/chip/index.js +4 -0
- package/lib/module/components/chip/index.js.map +1 -0
- package/lib/module/components/chip/types.js +2 -0
- package/lib/module/components/chip/types.js.map +1 -0
- package/lib/module/components/chip/utils.js +36 -0
- package/lib/module/components/chip/utils.js.map +1 -0
- package/lib/module/components/empty-state/EmptyState.js +200 -0
- package/lib/module/components/empty-state/EmptyState.js.map +1 -0
- package/lib/module/components/empty-state/index.js +4 -0
- package/lib/module/components/empty-state/index.js.map +1 -0
- package/lib/module/components/empty-state/types.js +2 -0
- package/lib/module/components/empty-state/types.js.map +1 -0
- package/lib/module/components/header/header-buttons.js +31 -36
- package/lib/module/components/header/header-buttons.js.map +1 -1
- package/lib/module/components/header/index.js +1 -1
- package/lib/module/components/header/index.js.map +1 -1
- package/lib/module/components/header/parts/HeaderGradientOverlay.js +38 -0
- package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -0
- package/lib/module/components/header/variants/LargeTitleHeader/index.js +69 -99
- package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
- package/lib/module/components/header/variants/TitleHeader/index.js +32 -63
- package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
- package/lib/module/components/icon/Icon.js +20 -8
- package/lib/module/components/icon/Icon.js.map +1 -1
- package/lib/module/components/image/Image.js +54 -0
- package/lib/module/components/image/Image.js.map +1 -0
- package/lib/module/components/image/index.js +4 -0
- package/lib/module/components/image/index.js.map +1 -0
- package/lib/module/components/image/types.js +4 -0
- package/lib/module/components/image/types.js.map +1 -0
- package/lib/module/components/index.js +4 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/portal/Portal.js +42 -0
- package/lib/module/components/portal/Portal.js.map +1 -0
- package/lib/module/components/portal/PortalContext.js +1 -16
- package/lib/module/components/portal/PortalContext.js.map +1 -1
- package/lib/module/components/portal/PortalHost.js +16 -14
- package/lib/module/components/portal/PortalHost.js.map +1 -1
- package/lib/module/components/portal/PortalProvider.js +51 -19
- package/lib/module/components/portal/PortalProvider.js.map +1 -1
- package/lib/module/components/portal/index.js +1 -1
- package/lib/module/components/portal/index.js.map +1 -1
- package/lib/module/components/screen/Screen.js +25 -28
- package/lib/module/components/screen/Screen.js.map +1 -1
- package/lib/module/components/screen/ScreenContext.js +7 -5
- package/lib/module/components/screen/ScreenContext.js.map +1 -1
- package/lib/module/components/screen/ScreenFlashList.js +144 -0
- package/lib/module/components/screen/ScreenFlashList.js.map +1 -0
- package/lib/module/components/screen/ScreenFlatList.js +88 -27
- package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
- package/lib/module/components/screen/ScreenScrollView.js +101 -34
- package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
- package/lib/module/components/screen/index.js +1 -0
- package/lib/module/components/screen/index.js.map +1 -1
- package/lib/module/components/screen/parts/BottomSafeArea.js +62 -0
- package/lib/module/components/screen/parts/BottomSafeArea.js.map +1 -0
- package/lib/module/components/screen/parts/ScreenPlaceholder.js +50 -0
- package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -0
- package/lib/module/components/screen/types.js +4 -0
- package/lib/module/components/screen/types.js.map +1 -0
- package/lib/module/components/screen/utils.js +12 -9
- package/lib/module/components/screen/utils.js.map +1 -1
- package/lib/module/components/surface/Surface.js +16 -9
- package/lib/module/components/surface/Surface.js.map +1 -1
- package/lib/module/components/text/Text.js +23 -5
- package/lib/module/components/text/Text.js.map +1 -1
- package/lib/module/components/toast/Toast.js +8 -8
- package/lib/module/components/toast/Toast.js.map +1 -1
- package/lib/module/components/toolbar/Toolbar.js +268 -0
- package/lib/module/components/toolbar/Toolbar.js.map +1 -0
- package/lib/module/components/toolbar/index.js +4 -0
- package/lib/module/components/toolbar/index.js.map +1 -0
- package/lib/module/context/ThemeProvider.js +5 -2
- package/lib/module/context/ThemeProvider.js.map +1 -1
- package/lib/module/{components/icon/utils.js → theme/defaults/icons.js} +1 -1
- package/lib/module/theme/defaults/icons.js.map +1 -0
- package/lib/module/theme/defaults/image.js +30 -0
- package/lib/module/theme/defaults/image.js.map +1 -0
- package/lib/module/theme/index.js +1 -1
- package/lib/module/theme/{configure.js → registry.js} +21 -28
- package/lib/module/theme/registry.js.map +1 -0
- package/lib/module/theme/runtime.js +1 -1
- package/lib/module/theme/theme.js +91 -10
- package/lib/module/theme/theme.js.map +1 -1
- package/lib/module/theme/tokens/dark.js +59 -68
- package/lib/module/theme/tokens/dark.js.map +1 -1
- package/lib/module/theme/tokens/light.js +49 -67
- package/lib/module/theme/tokens/light.js.map +1 -1
- package/lib/module/theme/tokens/primitives.js +241 -20
- package/lib/module/theme/tokens/primitives.js.map +1 -1
- package/lib/module/utils/accent-utils.js +4 -4
- package/lib/module/utils/accent-utils.js.map +1 -1
- package/lib/typescript/src/components/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/src/components/avatar/types.d.ts +4 -4
- package/lib/typescript/src/components/avatar/types.d.ts.map +1 -1
- package/lib/typescript/src/components/box/Box.d.ts.map +1 -1
- package/lib/typescript/src/components/box/utils.d.ts +6 -1
- package/lib/typescript/src/components/box/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/button/Button.d.ts +1 -1
- package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/Chip.d.ts +24 -0
- package/lib/typescript/src/components/chip/Chip.d.ts.map +1 -0
- package/lib/typescript/src/components/chip/index.d.ts +4 -0
- package/lib/typescript/src/components/chip/index.d.ts.map +1 -0
- package/lib/typescript/src/components/chip/types.d.ts +8 -0
- package/lib/typescript/src/components/chip/types.d.ts.map +1 -0
- package/lib/typescript/src/components/chip/utils.d.ts +8 -0
- package/lib/typescript/src/components/chip/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/empty-state/EmptyState.d.ts +45 -0
- package/lib/typescript/src/components/empty-state/EmptyState.d.ts.map +1 -0
- package/lib/typescript/src/components/empty-state/index.d.ts +4 -0
- package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -0
- package/lib/typescript/src/components/empty-state/types.d.ts +6 -0
- package/lib/typescript/src/components/empty-state/types.d.ts.map +1 -0
- package/lib/typescript/src/components/header/header-buttons.d.ts +27 -0
- package/lib/typescript/src/components/header/header-buttons.d.ts.map +1 -1
- package/lib/typescript/src/components/header/index.d.ts +1 -1
- package/lib/typescript/src/components/header/index.d.ts.map +1 -1
- package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts +7 -0
- package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts.map +1 -0
- 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 +18 -7
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/icon/Icon.d.ts.map +1 -1
- package/lib/typescript/src/components/image/Image.d.ts +16 -0
- package/lib/typescript/src/components/image/Image.d.ts.map +1 -0
- package/lib/typescript/src/components/image/index.d.ts +3 -0
- package/lib/typescript/src/components/image/index.d.ts.map +1 -0
- package/lib/typescript/src/components/image/types.d.ts +7 -0
- package/lib/typescript/src/components/image/types.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +4 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/portal/Portal.d.ts +26 -0
- package/lib/typescript/src/components/portal/Portal.d.ts.map +1 -0
- package/lib/typescript/src/components/portal/PortalContext.d.ts +11 -14
- package/lib/typescript/src/components/portal/PortalContext.d.ts.map +1 -1
- package/lib/typescript/src/components/portal/PortalHost.d.ts +9 -4
- package/lib/typescript/src/components/portal/PortalHost.d.ts.map +1 -1
- package/lib/typescript/src/components/portal/PortalProvider.d.ts +3 -3
- package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/portal/index.d.ts +4 -2
- package/lib/typescript/src/components/portal/index.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/Screen.d.ts +18 -13
- package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenContext.d.ts +12 -9
- package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenFlashList.d.ts +43 -0
- package/lib/typescript/src/components/screen/ScreenFlashList.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +17 -7
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +51 -16
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/index.d.ts +3 -0
- package/lib/typescript/src/components/screen/index.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts +30 -0
- package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +22 -0
- package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/types.d.ts +42 -0
- package/lib/typescript/src/components/screen/types.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/utils.d.ts +9 -9
- package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/surface/Surface.d.ts +7 -0
- package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -1
- package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts +115 -0
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts.map +1 -0
- package/lib/typescript/src/components/toolbar/index.d.ts +3 -0
- package/lib/typescript/src/components/toolbar/index.d.ts.map +1 -0
- package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/{components/icon/utils.d.ts → theme/defaults/icons.d.ts} +2 -2
- package/lib/typescript/src/theme/defaults/icons.d.ts.map +1 -0
- package/lib/typescript/src/theme/defaults/image.d.ts +4 -0
- package/lib/typescript/src/theme/defaults/image.d.ts.map +1 -0
- package/lib/typescript/src/theme/index.d.ts +1 -1
- package/lib/typescript/src/theme/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/{configure.d.ts → registry.d.ts} +1 -1
- package/lib/typescript/src/theme/registry.d.ts.map +1 -0
- package/lib/typescript/src/theme/theme.d.ts +21 -1
- package/lib/typescript/src/theme/theme.d.ts.map +1 -1
- package/lib/typescript/src/theme/tokens/dark.d.ts +41 -64
- package/lib/typescript/src/theme/tokens/dark.d.ts.map +1 -1
- package/lib/typescript/src/theme/tokens/light.d.ts +44 -65
- package/lib/typescript/src/theme/tokens/light.d.ts.map +1 -1
- package/lib/typescript/src/theme/tokens/primitives.d.ts +228 -17
- package/lib/typescript/src/theme/tokens/primitives.d.ts.map +1 -1
- package/lib/typescript/src/theme/types.d.ts +65 -35
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/package.json +24 -12
- package/skills/terra-ui/SKILL.md +193 -0
- package/skills/terra-ui/references/recipes.md +198 -0
- package/skills/terra-ui/references/troubleshooting.md +112 -0
- package/src/components/avatar/Avatar.tsx +128 -38
- package/src/components/avatar/types.ts +5 -5
- package/src/components/box/Box.tsx +13 -1
- package/src/components/box/utils.ts +10 -0
- package/src/components/button/Button.tsx +7 -15
- package/src/components/chip/Chip.tsx +444 -0
- package/src/components/chip/index.ts +3 -0
- package/src/components/chip/types.ts +15 -0
- package/src/components/chip/utils.ts +34 -0
- package/src/components/empty-state/EmptyState.tsx +209 -0
- package/src/components/empty-state/index.ts +3 -0
- package/src/components/empty-state/types.ts +5 -0
- package/src/components/header/header-buttons.tsx +33 -45
- package/src/components/header/index.ts +2 -0
- package/src/components/header/parts/HeaderGradientOverlay.tsx +29 -0
- package/src/components/header/variants/LargeTitleHeader/index.tsx +68 -102
- package/src/components/header/variants/TitleHeader/index.tsx +47 -56
- package/src/components/icon/Icon.tsx +20 -15
- package/src/components/image/Image.tsx +48 -0
- package/src/components/image/index.ts +2 -0
- package/src/components/image/types.ts +7 -0
- package/src/components/index.ts +4 -0
- package/src/components/portal/Portal.tsx +55 -0
- package/src/components/portal/PortalContext.tsx +14 -22
- package/src/components/portal/PortalHost.tsx +17 -10
- package/src/components/portal/PortalProvider.tsx +58 -21
- package/src/components/portal/index.ts +4 -2
- package/src/components/screen/Screen.tsx +45 -59
- package/src/components/screen/ScreenContext.tsx +19 -12
- package/src/components/screen/ScreenFlashList.tsx +196 -0
- package/src/components/screen/ScreenFlatList.tsx +100 -39
- package/src/components/screen/ScreenScrollView.tsx +114 -53
- package/src/components/screen/index.ts +3 -0
- package/src/components/screen/parts/BottomSafeArea.tsx +60 -0
- package/src/components/screen/parts/ScreenPlaceholder.tsx +55 -0
- package/src/components/screen/types.ts +43 -0
- package/src/components/screen/utils.ts +29 -15
- package/src/components/surface/Surface.tsx +17 -20
- package/src/components/text/Text.tsx +23 -5
- package/src/components/toast/Toast.tsx +8 -8
- package/src/components/toolbar/Toolbar.tsx +353 -0
- package/src/components/toolbar/index.ts +6 -0
- package/src/context/ThemeProvider.tsx +5 -4
- package/src/{components/icon/utils.tsx → theme/defaults/icons.tsx} +1 -1
- package/src/theme/defaults/image.tsx +34 -0
- package/src/theme/index.ts +1 -1
- package/src/theme/{configure.ts → registry.ts} +19 -34
- package/src/theme/runtime.ts +1 -1
- package/src/theme/theme.ts +127 -13
- package/src/theme/tokens/dark.ts +60 -69
- package/src/theme/tokens/light.ts +50 -68
- package/src/theme/tokens/primitives.ts +248 -20
- package/src/theme/types.ts +67 -35
- package/src/utils/accent-utils.ts +4 -4
- package/lib/module/components/icon/utils.js.map +0 -1
- package/lib/module/theme/configure.js.map +0 -1
- package/lib/typescript/src/components/icon/utils.d.ts.map +0 -1
- package/lib/typescript/src/theme/configure.d.ts.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { useId } from 'react';
|
|
4
3
|
import { Text, View } from 'react-native';
|
|
5
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
-
import Svg, { Defs, Rect, Stop, LinearGradient as SvgLinearGradient } from 'react-native-svg';
|
|
7
4
|
import { StyleSheet, useUnistyles } from 'react-native-unistyles';
|
|
8
5
|
import { resolveThemeColor } from "../../../../utils/resolve-theme-color.js";
|
|
9
6
|
import { FONT_WEIGHT_VALUE } from "../../../../utils/typography.js";
|
|
7
|
+
import { Toolbar } from "../../../toolbar/index.js";
|
|
10
8
|
import { HeaderDismissButton } from "../../header-buttons.js";
|
|
9
|
+
import { HeaderGradientOverlay } from "../../parts/HeaderGradientOverlay.js";
|
|
11
10
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
11
|
/**
|
|
13
12
|
* Compact title bar (leading slot · title · trailing slot) with a top safe-area
|
|
@@ -17,14 +16,19 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
17
16
|
* @example
|
|
18
17
|
* ```tsx
|
|
19
18
|
* <Screen.Header>
|
|
20
|
-
* <Header.Title
|
|
19
|
+
* <Header.Title
|
|
20
|
+
* title="Stats"
|
|
21
|
+
* RightToolbar={
|
|
22
|
+
* <Toolbar.Button icon="add" accessibilityLabel="Add" onPress={add} />
|
|
23
|
+
* }
|
|
24
|
+
* />
|
|
21
25
|
* </Screen.Header>
|
|
22
26
|
* ```
|
|
23
27
|
*/
|
|
24
28
|
export function TitleHeader({
|
|
25
29
|
title,
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
LeftToolbar,
|
|
31
|
+
RightToolbar,
|
|
28
32
|
dismissAction = 'none',
|
|
29
33
|
navigation,
|
|
30
34
|
onDismiss,
|
|
@@ -34,11 +38,7 @@ export function TitleHeader({
|
|
|
34
38
|
const {
|
|
35
39
|
theme
|
|
36
40
|
} = useUnistyles();
|
|
37
|
-
const
|
|
38
|
-
top
|
|
39
|
-
} = useSafeAreaInsets();
|
|
40
|
-
const gradientId = useId();
|
|
41
|
-
const bgColor = resolveThemeColor(bg, theme);
|
|
41
|
+
const bgColor = resolveThemeColor(bg, theme) ?? theme.color['surface.default'] ?? '';
|
|
42
42
|
const isTransparent = bgColor === 'transparent';
|
|
43
43
|
const gradientColor = isTransparent ? theme.color['surface.default'] : bgColor;
|
|
44
44
|
styles.useVariants({
|
|
@@ -49,55 +49,28 @@ export function TitleHeader({
|
|
|
49
49
|
dismissAction: dismissAction,
|
|
50
50
|
navigation: navigation,
|
|
51
51
|
onDismiss: onDismiss
|
|
52
|
-
}),
|
|
53
|
-
}) :
|
|
52
|
+
}), LeftToolbar]
|
|
53
|
+
}) : LeftToolbar;
|
|
54
54
|
const trailing = dismissAction === 'close' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
55
|
-
children: [
|
|
55
|
+
children: [RightToolbar, /*#__PURE__*/_jsx(HeaderDismissButton, {
|
|
56
56
|
dismissAction: dismissAction,
|
|
57
57
|
navigation: navigation,
|
|
58
58
|
onDismiss: onDismiss
|
|
59
59
|
})]
|
|
60
|
-
}) :
|
|
60
|
+
}) : RightToolbar;
|
|
61
61
|
return /*#__PURE__*/_jsxs(View, {
|
|
62
|
-
style: styles.
|
|
62
|
+
style: styles.container,
|
|
63
63
|
children: [/*#__PURE__*/_jsx(View, {
|
|
64
|
-
style:
|
|
65
|
-
height: top,
|
|
66
|
-
backgroundColor: isTransparent ? 'transparent' : bgColor
|
|
67
|
-
}
|
|
64
|
+
style: styles.safeArea(isTransparent, bgColor)
|
|
68
65
|
}), /*#__PURE__*/_jsxs(View, {
|
|
69
66
|
style: styles.bar,
|
|
70
67
|
children: [/*#__PURE__*/_jsx(View, {
|
|
71
68
|
style: styles.gradient,
|
|
72
69
|
pointerEvents: "none",
|
|
73
|
-
children: /*#__PURE__*/
|
|
74
|
-
|
|
75
|
-
width: "100%",
|
|
76
|
-
children: [/*#__PURE__*/_jsx(Defs, {
|
|
77
|
-
children: /*#__PURE__*/_jsxs(SvgLinearGradient, {
|
|
78
|
-
id: gradientId,
|
|
79
|
-
x1: "0",
|
|
80
|
-
y1: "0.4",
|
|
81
|
-
x2: "0",
|
|
82
|
-
y2: "1",
|
|
83
|
-
children: [/*#__PURE__*/_jsx(Stop, {
|
|
84
|
-
offset: "0",
|
|
85
|
-
stopColor: gradientColor,
|
|
86
|
-
stopOpacity: "0.9"
|
|
87
|
-
}), /*#__PURE__*/_jsx(Stop, {
|
|
88
|
-
offset: "0.9",
|
|
89
|
-
stopColor: gradientColor,
|
|
90
|
-
stopOpacity: "0.1"
|
|
91
|
-
})]
|
|
92
|
-
})
|
|
93
|
-
}), /*#__PURE__*/_jsx(Rect, {
|
|
94
|
-
width: "100%",
|
|
95
|
-
height: "100%",
|
|
96
|
-
fill: `url(#${gradientId})`
|
|
97
|
-
})]
|
|
70
|
+
children: /*#__PURE__*/_jsx(HeaderGradientOverlay, {
|
|
71
|
+
color: gradientColor
|
|
98
72
|
})
|
|
99
|
-
}), leading != null && /*#__PURE__*/_jsx(
|
|
100
|
-
style: styles.slot,
|
|
73
|
+
}), leading != null && /*#__PURE__*/_jsx(Toolbar, {
|
|
101
74
|
children: leading
|
|
102
75
|
}), /*#__PURE__*/_jsx(View, {
|
|
103
76
|
style: styles.titleContainer,
|
|
@@ -106,21 +79,25 @@ export function TitleHeader({
|
|
|
106
79
|
style: styles.title,
|
|
107
80
|
children: title
|
|
108
81
|
})
|
|
109
|
-
}), trailing != null && /*#__PURE__*/_jsx(
|
|
110
|
-
style: styles.
|
|
82
|
+
}), trailing != null && /*#__PURE__*/_jsx(Toolbar, {
|
|
83
|
+
style: styles.trailing,
|
|
111
84
|
children: trailing
|
|
112
85
|
})]
|
|
113
86
|
})]
|
|
114
87
|
});
|
|
115
88
|
}
|
|
116
|
-
const styles = StyleSheet.create(theme => ({
|
|
117
|
-
|
|
89
|
+
const styles = StyleSheet.create((theme, runtime) => ({
|
|
90
|
+
container: {
|
|
118
91
|
position: 'absolute',
|
|
119
92
|
top: 0,
|
|
120
93
|
left: 0,
|
|
121
94
|
right: 0,
|
|
122
95
|
zIndex: 1000
|
|
123
96
|
},
|
|
97
|
+
safeArea: (isTransparent, bgColor) => ({
|
|
98
|
+
height: runtime.insets.top,
|
|
99
|
+
backgroundColor: isTransparent ? 'transparent' : bgColor
|
|
100
|
+
}),
|
|
124
101
|
gradient: {
|
|
125
102
|
position: 'absolute',
|
|
126
103
|
top: 0,
|
|
@@ -132,20 +109,12 @@ const styles = StyleSheet.create(theme => ({
|
|
|
132
109
|
height: theme.layout.header.height,
|
|
133
110
|
flexDirection: 'row',
|
|
134
111
|
alignItems: 'center',
|
|
135
|
-
justifyContent: 'space-between',
|
|
136
112
|
paddingHorizontal: theme.layout.screen.margin.x,
|
|
137
|
-
gap: theme.spacing['3']
|
|
113
|
+
gap: theme.spacing['3'],
|
|
114
|
+
justifyContent: 'space-between'
|
|
138
115
|
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
alignItems: 'center',
|
|
142
|
-
gap: theme.spacing['2']
|
|
143
|
-
},
|
|
144
|
-
slotEnd: {
|
|
145
|
-
flexDirection: 'row',
|
|
146
|
-
alignItems: 'center',
|
|
147
|
-
justifyContent: 'flex-end',
|
|
148
|
-
gap: theme.spacing['2']
|
|
116
|
+
trailing: {
|
|
117
|
+
justifyContent: 'flex-end'
|
|
149
118
|
},
|
|
150
119
|
titleContainer: {
|
|
151
120
|
variants: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Text","View","StyleSheet","useUnistyles","resolveThemeColor","FONT_WEIGHT_VALUE","Toolbar","HeaderDismissButton","HeaderGradientOverlay","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TitleHeader","title","LeftToolbar","RightToolbar","dismissAction","navigation","onDismiss","titleAlignment","bg","theme","bgColor","color","isTransparent","gradientColor","styles","useVariants","leading","children","trailing","style","container","safeArea","bar","gradient","pointerEvents","titleContainer","create","runtime","position","top","left","right","zIndex","height","insets","backgroundColor","bottom","layout","header","flexDirection","alignItems","paddingHorizontal","screen","margin","x","gap","spacing","justifyContent","variants","center","flex","fontSize","typography","lineHeight","letterSpacing","fontWeight","textAlign"],"sourceRoot":"../../../../../../src","sources":["components/header/variants/TitleHeader/index.tsx"],"mappings":";;AACA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAEzC,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAGjE,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAE1B,SAASC,OAAO;AAChB,SACEC,mBAAmB;AAGrB,SAASC,qBAAqB;AAA4C,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAoB1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAC;EAC1BC,KAAK;EACLC,WAAW;EACXC,YAAY;EACZC,aAAa,GAAG,MAAM;EACtBC,UAAU;EACVC,SAAS;EACTC,cAAc,GAAG,QAAQ;EACzBC,EAAE,GAAG;AACW,CAAC,EAAE;EACnB,MAAM;IAAEC;EAAM,CAAC,GAAGrB,YAAY,CAAC,CAAC;EAEhC,MAAMs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
5
|
-
import { useUnistyles } from 'react-native-unistyles';
|
|
6
|
-
import { getIcon } from "../../theme/
|
|
5
|
+
import { StyleSheet, useUnistyles } from 'react-native-unistyles';
|
|
6
|
+
import { getIcon } from "../../theme/registry.js";
|
|
7
7
|
import { resolveThemeColor } from "../../utils/resolve-theme-color.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
/**
|
|
@@ -36,12 +36,7 @@ export const Icon = /*#__PURE__*/forwardRef(function Icon({
|
|
|
36
36
|
const resolvedColor = resolveThemeColor(color, theme) ?? theme.color['text.default'] ?? '';
|
|
37
37
|
return /*#__PURE__*/_jsx(View, {
|
|
38
38
|
ref: ref,
|
|
39
|
-
style: [
|
|
40
|
-
width: size,
|
|
41
|
-
height: size,
|
|
42
|
-
alignItems: 'center',
|
|
43
|
-
justifyContent: 'center'
|
|
44
|
-
}, style],
|
|
39
|
+
style: [styles.container(size), style],
|
|
45
40
|
...rest,
|
|
46
41
|
children: /*#__PURE__*/_jsx(IconComponent, {
|
|
47
42
|
color: resolvedColor,
|
|
@@ -50,4 +45,21 @@ export const Icon = /*#__PURE__*/forwardRef(function Icon({
|
|
|
50
45
|
})
|
|
51
46
|
});
|
|
52
47
|
});
|
|
48
|
+
|
|
49
|
+
// ─── Styles ───────────────────────────────────────────────────────────────────
|
|
50
|
+
//
|
|
51
|
+
// This stylesheet is also what makes the Unistyles Babel plugin swap the `View`
|
|
52
|
+
// imported above for its Unistyles-aware counterpart, which registers the
|
|
53
|
+
// ShadowNode natively. Without it, a Unistyles style passed in through `style`
|
|
54
|
+
// would freeze at whichever theme was active when it was created — `Icon` does
|
|
55
|
+
// not re-render on theme change unless something it reads from the theme
|
|
56
|
+
// happens to change.
|
|
57
|
+
const styles = StyleSheet.create(() => ({
|
|
58
|
+
container: size => ({
|
|
59
|
+
width: size,
|
|
60
|
+
height: size,
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
justifyContent: 'center'
|
|
63
|
+
})
|
|
64
|
+
}));
|
|
53
65
|
//# sourceMappingURL=Icon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","View","useUnistyles","getIcon","resolveThemeColor","jsx","_jsx","Icon","name","size","color","strokeWidth","style","rest","ref","theme","IconComponent","__DEV__","console","warn","resolvedColor","width","height","alignItems","justifyContent"
|
|
1
|
+
{"version":3,"names":["forwardRef","View","StyleSheet","useUnistyles","getIcon","resolveThemeColor","jsx","_jsx","Icon","name","size","color","strokeWidth","style","rest","ref","theme","IconComponent","__DEV__","console","warn","resolvedColor","styles","container","children","create","width","height","alignItems","justifyContent"],"sourceRoot":"../../../../src","sources":["components/icon/Icon.tsx"],"mappings":";;AACA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,IAAI,QAAwB,cAAc;AAEnD,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAEjE,SAASC,OAAO;AAEhB,SAASC,iBAAiB;AAAqC,SAAAC,GAAA,IAAAC,IAAA;AAY/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,IAAI,gBAAGR,UAAU,CAC5B,SAASQ,IAAIA,CACX;EAAEC,IAAI;EAAEC,IAAI,GAAG,EAAE;EAAEC,KAAK,GAAG,cAAc;EAAEC,WAAW;EAAEC,KAAK;EAAE,GAAGC;AAAK,CAAC,EACxEC,GAAG,EACH;EACA,MAAM;IAAEC;EAAM,CAAC,GAAGb,YAAY,CAAC,CAAC;EAChC,MAAMc,aAAa,GAAGb,OAAO,CAACK,IAAI,CAAC;EAEnC,IAAI,CAACQ,aAAa,EAAE;IAClB,IAAIC,OAAO,EAAE;MACXC,OAAO,CAACC,IAAI,CAAC,yCAAyCX,IAAI,IAAI,CAAC;IACjE;IACA,OAAO,IAAI;EACb;EAEA,MAAMY,aAAa,GACjBhB,iBAAiB,CAACM,KAAK,EAAEK,KAAK,CAAC,IAC9BA,KAAK,CAACL,KAAK,CACV,cAAc,CACf,IACD,EAAE;EAEJ,oBACEJ,IAAA,CAACN,IAAI;IAACc,GAAG,EAAEA,GAAI;IAACF,KAAK,EAAE,CAACS,MAAM,CAACC,SAAS,CAACb,IAAI,CAAC,EAAEG,KAAK,CAAE;IAAA,GAAKC,IAAI;IAAAU,QAAA,eAC9DjB,IAAA,CAACU,aAAa;MACZN,KAAK,EAAEU,aAAc;MACrBX,IAAI,EAAEA,IAAK;MACXE,WAAW,EAAEA;IAAY,CAC1B;EAAC,CACE,CAAC;AAEX,CACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMU,MAAM,GAAGpB,UAAU,CAACuB,MAAM,CAAC,OAAO;EACtCF,SAAS,EAAGb,IAAY,KAAM;IAC5BgB,KAAK,EAAEhB,IAAI;IACXiB,MAAM,EAAEjB,IAAI;IACZkB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;AACH,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
+
import { getImageComponent } from "../../theme/registry.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* Renders the image implementation configured via
|
|
9
|
+
* `configureTerraUI({ image })` (defaults to React Native's `Image`).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Image
|
|
14
|
+
* source={{ uri: 'https://example.com/photo.jpg' }}
|
|
15
|
+
* contentFit="cover"
|
|
16
|
+
* style={{ width: 40, height: 40 }}
|
|
17
|
+
* />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function Image({
|
|
21
|
+
contentFit = 'cover',
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
radius = 'none',
|
|
25
|
+
style,
|
|
26
|
+
...rest
|
|
27
|
+
}) {
|
|
28
|
+
const ImageComponent = getImageComponent();
|
|
29
|
+
return /*#__PURE__*/_jsx(View, {
|
|
30
|
+
style: [styles.container(width, height, radius), style],
|
|
31
|
+
children: /*#__PURE__*/_jsx(ImageComponent, {
|
|
32
|
+
contentFit: contentFit,
|
|
33
|
+
style: styles.image,
|
|
34
|
+
...rest
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const styles = StyleSheet.create(_theme => ({
|
|
39
|
+
container: (w, h, r) => ({
|
|
40
|
+
...(w ? {
|
|
41
|
+
width: w
|
|
42
|
+
} : {}),
|
|
43
|
+
...(h ? {
|
|
44
|
+
height: h
|
|
45
|
+
} : {}),
|
|
46
|
+
borderRadius: _theme.radius[r],
|
|
47
|
+
overflow: 'hidden'
|
|
48
|
+
}),
|
|
49
|
+
image: {
|
|
50
|
+
width: '100%',
|
|
51
|
+
height: '100%'
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
//# sourceMappingURL=Image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","StyleSheet","getImageComponent","jsx","_jsx","Image","contentFit","width","height","radius","style","rest","ImageComponent","styles","container","children","image","create","_theme","w","h","r","borderRadius","overflow"],"sourceRoot":"../../../../src","sources":["components/image/Image.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,cAAc;AACnC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,iBAAiB;AAA0B,SAAAC,GAAA,IAAAC,IAAA;AAIpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,KAAKA,CAAC;EACpBC,UAAU,GAAG,OAAO;EACpBC,KAAK;EACLC,MAAM;EACNC,MAAM,GAAG,MAAM;EACfC,KAAK;EACL,GAAGC;AACO,CAAC,EAAE;EACb,MAAMC,cAAc,GAAGV,iBAAiB,CAAC,CAAC;EAE1C,oBACEE,IAAA,CAACJ,IAAI;IAACU,KAAK,EAAE,CAACG,MAAM,CAACC,SAAS,CAACP,KAAK,EAAEC,MAAM,EAAEC,MAAM,CAAC,EAAEC,KAAK,CAAE;IAAAK,QAAA,eAC5DX,IAAA,CAACQ,cAAc;MAACN,UAAU,EAAEA,UAAW;MAACI,KAAK,EAAEG,MAAM,CAACG,KAAM;MAAA,GAAKL;IAAI,CAAG;EAAC,CACrE,CAAC;AAEX;AAEA,MAAME,MAAM,GAAGZ,UAAU,CAACgB,MAAM,CAAEC,MAAM,KAAM;EAC5CJ,SAAS,EAAEA,CAACK,CAAqB,EAAEC,CAAqB,EAAEC,CAAY,MAAM;IAC1E,IAAIF,CAAC,GAAG;MAAEZ,KAAK,EAAEY;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,IAAIC,CAAC,GAAG;MAAEZ,MAAM,EAAEY;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3BE,YAAY,EAAEJ,MAAM,CAACT,MAAM,CAACY,CAAC,CAAC;IAC9BE,QAAQ,EAAE;EACZ,CAAC,CAAC;EACFP,KAAK,EAAE;IACLT,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE;EACV;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Image"],"sourceRoot":"../../../../src","sources":["components/image/index.ts"],"mappings":";;AAAA,SAASA,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/image/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
export * from "./avatar/index.js";
|
|
4
4
|
export * from "./box/index.js";
|
|
5
5
|
export * from "./button/index.js";
|
|
6
|
+
export * from "./chip/index.js";
|
|
7
|
+
export * from "./empty-state/index.js";
|
|
6
8
|
export * from "./header/index.js";
|
|
7
9
|
export * from "./icon/index.js";
|
|
10
|
+
export * from "./image/index.js";
|
|
8
11
|
export * from "./page-indicator/index.js";
|
|
9
12
|
export * from "./portal/index.js";
|
|
10
13
|
export * from "./screen/index.js";
|
|
@@ -13,4 +16,5 @@ export * from "./spinner/index.js";
|
|
|
13
16
|
export * from "./surface/index.js";
|
|
14
17
|
export * from "./text/index.js";
|
|
15
18
|
export * from "./toast/index.js";
|
|
19
|
+
export * from "./toolbar/index.js";
|
|
16
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useContext, useEffect, useRef } from 'react';
|
|
4
|
+
import { PortalContext } from "./PortalContext.js";
|
|
5
|
+
import { PortalHost } from "./PortalHost.js";
|
|
6
|
+
import { PortalProvider } from "./PortalProvider.js";
|
|
7
|
+
let nextPortalKey = 1;
|
|
8
|
+
const PortalComponent = ({
|
|
9
|
+
hostName,
|
|
10
|
+
children
|
|
11
|
+
}) => {
|
|
12
|
+
const context = useContext(PortalContext);
|
|
13
|
+
const upsertPortal = context?.upsertPortal;
|
|
14
|
+
const removePortal = context?.removePortal;
|
|
15
|
+
const portalKeyRef = useRef(nextPortalKey++);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!upsertPortal || !removePortal) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
upsertPortal(hostName, portalKeyRef.current, children ?? null);
|
|
21
|
+
return () => {
|
|
22
|
+
removePortal(hostName, portalKeyRef.current);
|
|
23
|
+
};
|
|
24
|
+
}, [children, hostName, removePortal, upsertPortal]);
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Declaratively teleports `children` into the `PortalHost` named `hostName`,
|
|
29
|
+
* for as long as this component stays mounted.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Portal hostName="screen-header">
|
|
34
|
+
* <LargeTitle />
|
|
35
|
+
* </Portal>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export const Portal = Object.assign(PortalComponent, {
|
|
39
|
+
Provider: PortalProvider,
|
|
40
|
+
Host: PortalHost
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=Portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useContext","useEffect","useRef","PortalContext","PortalHost","PortalProvider","nextPortalKey","PortalComponent","hostName","children","context","upsertPortal","removePortal","portalKeyRef","current","Portal","Object","assign","Provider","Host"],"sourceRoot":"../../../../src","sources":["components/portal/Portal.tsx"],"mappings":";;AAAA,SAAkCA,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAE9E,SAASC,aAAa;AACtB,SAASC,UAAU;AACnB,SAASC,cAAc;AAEvB,IAAIC,aAAa,GAAG,CAAC;AAQrB,MAAMC,eAAgC,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAK;EACnE,MAAMC,OAAO,GAAGV,UAAU,CAACG,aAAa,CAAC;EACzC,MAAMQ,YAAY,GAAGD,OAAO,EAAEC,YAAY;EAC1C,MAAMC,YAAY,GAAGF,OAAO,EAAEE,YAAY;EAC1C,MAAMC,YAAY,GAAGX,MAAM,CAASI,aAAa,EAAE,CAAC;EAEpDL,SAAS,CAAC,MAAM;IACd,IAAI,CAACU,YAAY,IAAI,CAACC,YAAY,EAAE;MAClC;IACF;IAEAD,YAAY,CAACH,QAAQ,EAAEK,YAAY,CAACC,OAAO,EAAEL,QAAQ,IAAI,IAAI,CAAC;IAE9D,OAAO,MAAM;MACXG,YAAY,CAACJ,QAAQ,EAAEK,YAAY,CAACC,OAAO,CAAC;IAC9C,CAAC;EACH,CAAC,EAAE,CAACL,QAAQ,EAAED,QAAQ,EAAEI,YAAY,EAAED,YAAY,CAAC,CAAC;EAEpD,OAAO,IAAI;AACb,CAAC;AAOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,MAAM,GAAGC,MAAM,CAACC,MAAM,CAACV,eAAe,EAAE;EACnDW,QAAQ,EAAEb,cAAc;EACxBc,IAAI,EAAEf;AACR,CAAC,CAAwB","ignoreList":[]}
|
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { createContext
|
|
3
|
+
import { createContext } from 'react';
|
|
4
4
|
export const PortalContext = /*#__PURE__*/createContext(null);
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Access the nearest {@link PortalProvider}. Used by components that need to
|
|
8
|
-
* teleport content into a `PortalHost` rendered elsewhere in the tree (e.g. the
|
|
9
|
-
* large-title header injecting its title into the scroll content).
|
|
10
|
-
*
|
|
11
|
-
* @throws if called outside a `PortalProvider`.
|
|
12
|
-
*/
|
|
13
|
-
export function usePortal() {
|
|
14
|
-
const context = useContext(PortalContext);
|
|
15
|
-
if (!context) {
|
|
16
|
-
throw new Error('usePortal must be used within a PortalProvider');
|
|
17
|
-
}
|
|
18
|
-
return context;
|
|
19
|
-
}
|
|
20
5
|
//# sourceMappingURL=PortalContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","
|
|
1
|
+
{"version":3,"names":["createContext","PortalContext"],"sourceRoot":"../../../../src","sources":["components/portal/PortalContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAwB,OAAO;AAkBrD,OAAO,MAAMC,aAAa,gBAAGD,aAAa,CAA4B,IAAI,CAAC","ignoreList":[]}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { Fragment, useContext } from 'react';
|
|
3
4
|
import { View } from 'react-native';
|
|
4
|
-
import {
|
|
5
|
-
|
|
5
|
+
import { PortalContext } from "./PortalContext.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
/**
|
|
7
|
-
* Renders every
|
|
8
|
-
* {@link PortalProvider}
|
|
9
|
-
*
|
|
8
|
+
* Renders every entry currently registered under `name` on the nearest
|
|
9
|
+
* {@link PortalProvider}. Place it where teleported content should appear
|
|
10
|
+
* (e.g. at the top of a `Screen.ScrollView`).
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export function PortalHost({
|
|
13
|
+
name,
|
|
14
|
+
...viewProps
|
|
15
|
+
}) {
|
|
16
|
+
const context = useContext(PortalContext);
|
|
17
|
+
const hostPortals = context?.portals[name] ?? [];
|
|
16
18
|
return /*#__PURE__*/_jsx(View, {
|
|
17
|
-
|
|
18
|
-
children:
|
|
19
|
-
children:
|
|
20
|
-
},
|
|
19
|
+
...viewProps,
|
|
20
|
+
children: hostPortals.map(entry => /*#__PURE__*/_jsx(Fragment, {
|
|
21
|
+
children: entry.node
|
|
22
|
+
}, entry.key))
|
|
21
23
|
});
|
|
22
24
|
}
|
|
23
25
|
//# sourceMappingURL=PortalHost.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","
|
|
1
|
+
{"version":3,"names":["Fragment","useContext","View","PortalContext","jsx","_jsx","PortalHost","name","viewProps","context","hostPortals","portals","children","map","entry","node","key"],"sourceRoot":"../../../../src","sources":["components/portal/PortalHost.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,UAAU,QAAQ,OAAO;AAC5C,SAASC,IAAI,QAAwB,cAAc;AAEnD,SAASC,aAAa;AAA0B,SAAAC,GAAA,IAAAC,IAAA;AAOhD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAC;EAAEC,IAAI;EAAE,GAAGC;AAA2B,CAAC,EAAE;EAClE,MAAMC,OAAO,GAAGR,UAAU,CAACE,aAAa,CAAC;EACzC,MAAMO,WAAW,GAAGD,OAAO,EAAEE,OAAO,CAACJ,IAAI,CAAC,IAAI,EAAE;EAEhD,oBACEF,IAAA,CAACH,IAAI;IAAA,GAAKM,SAAS;IAAAI,QAAA,EAChBF,WAAW,CAACG,GAAG,CAAEC,KAAK,iBACrBT,IAAA,CAACL,QAAQ;MAAAY,QAAA,EAAkBE,KAAK,CAACC;IAAI,GAAtBD,KAAK,CAACE,GAA2B,CACjD;EAAC,CACE,CAAC;AAEX","ignoreList":[]}
|
|
@@ -4,34 +4,66 @@ import { useCallback, useMemo, useState } from 'react';
|
|
|
4
4
|
import { PortalContext } from "./PortalContext.js";
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
/**
|
|
7
|
-
* Holds a registry of teleported content
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Holds a registry of teleported content, keyed by host name. Descendant
|
|
8
|
+
* `Portal` components register/unregister entries; a `PortalHost` placed
|
|
9
|
+
* anywhere below renders the entries for its `name`.
|
|
10
10
|
*/
|
|
11
11
|
export function PortalProvider({
|
|
12
12
|
children
|
|
13
13
|
}) {
|
|
14
|
-
const [
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const [portals, setPortals] = useState({});
|
|
15
|
+
const upsertPortal = useCallback((hostName, key, node) => {
|
|
16
|
+
setPortals(prev => {
|
|
17
|
+
const hostPortals = prev[hostName] ?? [];
|
|
18
|
+
const existingIndex = hostPortals.findIndex(entry => entry.key === key);
|
|
19
|
+
if (existingIndex === -1) {
|
|
20
|
+
return {
|
|
21
|
+
...prev,
|
|
22
|
+
[hostName]: [...hostPortals, {
|
|
23
|
+
key,
|
|
24
|
+
node
|
|
25
|
+
}]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (hostPortals[existingIndex]?.node === node) {
|
|
29
|
+
return prev;
|
|
30
|
+
}
|
|
31
|
+
const nextHostPortals = [...hostPortals];
|
|
32
|
+
nextHostPortals[existingIndex] = {
|
|
33
|
+
key,
|
|
34
|
+
node
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
...prev,
|
|
38
|
+
[hostName]: nextHostPortals
|
|
39
|
+
};
|
|
20
40
|
});
|
|
21
41
|
}, []);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
42
|
+
const removePortal = useCallback((hostName, key) => {
|
|
43
|
+
setPortals(prev => {
|
|
44
|
+
const hostPortals = prev[hostName] ?? [];
|
|
45
|
+
const nextHostPortals = hostPortals.filter(entry => entry.key !== key);
|
|
46
|
+
if (nextHostPortals.length === hostPortals.length) {
|
|
47
|
+
return prev;
|
|
48
|
+
}
|
|
49
|
+
if (nextHostPortals.length === 0) {
|
|
50
|
+
const {
|
|
51
|
+
[hostName]: _removed,
|
|
52
|
+
...rest
|
|
53
|
+
} = prev;
|
|
54
|
+
return rest;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
...prev,
|
|
58
|
+
[hostName]: nextHostPortals
|
|
59
|
+
};
|
|
28
60
|
});
|
|
29
61
|
}, []);
|
|
30
62
|
const value = useMemo(() => ({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}), [
|
|
63
|
+
portals,
|
|
64
|
+
upsertPortal,
|
|
65
|
+
removePortal
|
|
66
|
+
}), [portals, removePortal, upsertPortal]);
|
|
35
67
|
return /*#__PURE__*/_jsx(PortalContext.Provider, {
|
|
36
68
|
value: value,
|
|
37
69
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useMemo","useState","PortalContext","jsx","_jsx","PortalProvider","children","
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useState","PortalContext","jsx","_jsx","PortalProvider","children","portals","setPortals","upsertPortal","hostName","key","node","prev","hostPortals","existingIndex","findIndex","entry","nextHostPortals","removePortal","filter","length","_removed","rest","value","Provider"],"sourceRoot":"../../../../src","sources":["components/portal/PortalProvider.tsx"],"mappings":";;AAAA,SAAyBA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEtE,SACEC,aAAa;AAGU,SAAAC,GAAA,IAAAC,IAAA;AAMzB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAA8B,CAAC,EAAE;EAChE,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGP,QAAQ,CAAc,CAAC,CAAC,CAAC;EAEvD,MAAMQ,YAAY,GAAGV,WAAW,CAC9B,CAACW,QAAgB,EAAEC,GAAW,EAAEC,IAAe,KAAK;IAClDJ,UAAU,CAAEK,IAAI,IAAK;MACnB,MAAMC,WAAW,GAAGD,IAAI,CAACH,QAAQ,CAAC,IAAI,EAAE;MACxC,MAAMK,aAAa,GAAGD,WAAW,CAACE,SAAS,CACxCC,KAAK,IAAKA,KAAK,CAACN,GAAG,KAAKA,GAC3B,CAAC;MAED,IAAII,aAAa,KAAK,CAAC,CAAC,EAAE;QACxB,OAAO;UACL,GAAGF,IAAI;UACP,CAACH,QAAQ,GAAG,CAAC,GAAGI,WAAW,EAAE;YAAEH,GAAG;YAAEC;UAAK,CAAC;QAC5C,CAAC;MACH;MAEA,IAAIE,WAAW,CAACC,aAAa,CAAC,EAAEH,IAAI,KAAKA,IAAI,EAAE;QAC7C,OAAOC,IAAI;MACb;MAEA,MAAMK,eAAe,GAAG,CAAC,GAAGJ,WAAW,CAAC;MACxCI,eAAe,CAACH,aAAa,CAAC,GAAG;QAAEJ,GAAG;QAAEC;MAAK,CAAC;MAE9C,OAAO;QACL,GAAGC,IAAI;QACP,CAACH,QAAQ,GAAGQ;MACd,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,EACD,EACF,CAAC;EAED,MAAMC,YAAY,GAAGpB,WAAW,CAAC,CAACW,QAAgB,EAAEC,GAAW,KAAK;IAClEH,UAAU,CAAEK,IAAI,IAAK;MACnB,MAAMC,WAAW,GAAGD,IAAI,CAACH,QAAQ,CAAC,IAAI,EAAE;MACxC,MAAMQ,eAAe,GAAGJ,WAAW,CAACM,MAAM,CAAEH,KAAK,IAAKA,KAAK,CAACN,GAAG,KAAKA,GAAG,CAAC;MAExE,IAAIO,eAAe,CAACG,MAAM,KAAKP,WAAW,CAACO,MAAM,EAAE;QACjD,OAAOR,IAAI;MACb;MAEA,IAAIK,eAAe,CAACG,MAAM,KAAK,CAAC,EAAE;QAChC,MAAM;UAAE,CAACX,QAAQ,GAAGY,QAAQ;UAAE,GAAGC;QAAK,CAAC,GAAGV,IAAI;QAC9C,OAAOU,IAAI;MACb;MAEA,OAAO;QACL,GAAGV,IAAI;QACP,CAACH,QAAQ,GAAGQ;MACd,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMM,KAAK,GAAGxB,OAAO,CACnB,OAAO;IAAEO,OAAO;IAAEE,YAAY;IAAEU;EAAa,CAAC,CAAC,EAC/C,CAACZ,OAAO,EAAEY,YAAY,EAAEV,YAAY,CACtC,CAAC;EAED,oBACEL,IAAA,CAACF,aAAa,CAACuB,QAAQ;IAACD,KAAK,EAAEA,KAAM;IAAAlB,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAE7E","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Portal","PortalHost","PortalProvider"],"sourceRoot":"../../../../src","sources":["components/portal/index.ts"],"mappings":";;AACA,SAASA,MAAM;AAGf,SAASC,UAAU;AAEnB,SAASC,cAAc","ignoreList":[]}
|