panelui-native 0.96.0 → 0.97.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/lib/module/providers/panel-ui-provider.js +23 -5
- package/lib/module/providers/panel-ui-provider.js.map +1 -1
- package/lib/typescript/src/providers/panel-ui-provider.d.ts +20 -1
- package/lib/typescript/src/providers/panel-ui-provider.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/providers/panel-ui-provider.tsx +51 -7
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Fragment } from 'react';
|
|
4
3
|
import { Platform, StyleSheet, TurboModuleRegistry, View } from 'react-native';
|
|
5
4
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
6
5
|
import { PortalHost, PortalProvider, useModalIsolationActive } from "../primitives/portal.js";
|
|
@@ -31,16 +30,31 @@ import { cn } from "../utils/cn.js";
|
|
|
31
30
|
* afterwards. The result is cached so the component type is stable: swapping it
|
|
32
31
|
* between renders would unmount and rebuild everything below it.
|
|
33
32
|
*/
|
|
34
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
34
|
+
/**
|
|
35
|
+
* The pass-through, which has to be a component rather than `Fragment`.
|
|
36
|
+
*
|
|
37
|
+
* `Fragment` accepts `key` and `children` and warns about anything else, so
|
|
38
|
+
* once the window flags below are forwarded it would warn in every project
|
|
39
|
+
* that does not have the controller installed — which is the one case the
|
|
40
|
+
* pass-through exists to keep quiet.
|
|
41
|
+
*/
|
|
42
|
+
function KeyboardPassthrough({
|
|
43
|
+
children
|
|
44
|
+
}) {
|
|
45
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
46
|
+
children: children
|
|
47
|
+
});
|
|
48
|
+
}
|
|
35
49
|
let keyboardProvider;
|
|
36
50
|
function resolveKeyboardProvider() {
|
|
37
51
|
if (keyboardProvider) return keyboardProvider;
|
|
38
|
-
let resolved =
|
|
52
|
+
let resolved = KeyboardPassthrough;
|
|
39
53
|
try {
|
|
40
54
|
if (TurboModuleRegistry.get('KeyboardController') !== null) {
|
|
41
55
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
42
56
|
const controller = require('react-native-keyboard-controller');
|
|
43
|
-
resolved = controller?.KeyboardProvider ??
|
|
57
|
+
resolved = controller?.KeyboardProvider ?? KeyboardPassthrough;
|
|
44
58
|
}
|
|
45
59
|
} catch {
|
|
46
60
|
// Not installed, or installed without its native half. Either way the
|
|
@@ -64,7 +78,9 @@ function resolveKeyboardProvider() {
|
|
|
64
78
|
export function PanelUIProvider({
|
|
65
79
|
children,
|
|
66
80
|
className,
|
|
67
|
-
background = true
|
|
81
|
+
background = true,
|
|
82
|
+
statusBarTranslucent,
|
|
83
|
+
navigationBarTranslucent
|
|
68
84
|
}) {
|
|
69
85
|
// Resolved once, on the first render of the first provider in the app, and
|
|
70
86
|
// cached from there. See {@link resolveKeyboardProvider}.
|
|
@@ -72,6 +88,8 @@ export function PanelUIProvider({
|
|
|
72
88
|
return /*#__PURE__*/_jsx(GestureHandlerRootView, {
|
|
73
89
|
style: styles.root,
|
|
74
90
|
children: /*#__PURE__*/_jsx(KeyboardProvider, {
|
|
91
|
+
statusBarTranslucent: statusBarTranslucent,
|
|
92
|
+
navigationBarTranslucent: navigationBarTranslucent,
|
|
75
93
|
children: /*#__PURE__*/_jsx(PortalProvider, {
|
|
76
94
|
children: /*#__PURE__*/_jsx(ProviderSurface, {
|
|
77
95
|
background: background,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Platform","StyleSheet","TurboModuleRegistry","View","GestureHandlerRootView","PortalHost","PortalProvider","useModalIsolationActive","ToastViewport","cn","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","KeyboardPassthrough","children","keyboardProvider","resolveKeyboardProvider","resolved","get","controller","require","KeyboardProvider","PanelUIProvider","className","background","statusBarTranslucent","navigationBarTranslucent","style","styles","root","ProviderSurface","modalActive","isolateApp","OS","collapsable","content","importantForAccessibility","create","flex"],"sourceRoot":"../../../src","sources":["providers/panel-ui-provider.tsx"],"mappings":";;AACA,SAASA,QAAQ,EAAEC,UAAU,EAAEC,mBAAmB,EAAEC,IAAI,QAAQ,cAAc;AAC9E,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SACEC,UAAU,EACVC,cAAc,EACdC,uBAAuB,QAClB,yBAAsB;AAC7B,SAASC,aAAa,QAAQ,8BAAqB;AACnD,SAASC,EAAE,QAAQ,gBAAa;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA8BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAAC;EAAEC;AAA4B,CAAC,EAAE;EAC5D,oBAAOJ,IAAA,CAAAF,SAAA;IAAAM,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB;AAEA,IAAIC,gBAA8D;AAElE,SAASC,uBAAuBA,CAAA,EAAqC;EACnE,IAAID,gBAAgB,EAAE,OAAOA,gBAAgB;EAE7C,IAAIE,QAA0C,GAAGJ,mBAAmB;EACpE,IAAI;IACF,IAAId,mBAAmB,CAACmB,GAAG,CAAC,oBAAoB,CAAC,KAAK,IAAI,EAAE;MAC1D;MACA,MAAMC,UAAU,GAAGC,OAAO,CAAC,kCAAkC,CAAC;MAC9DH,QAAQ,GAAGE,UAAU,EAAEE,gBAAgB,IAAIR,mBAAmB;IAChE;EACF,CAAC,CAAC,MAAM;IACN;IACA;EAAA;EAGFE,gBAAgB,GAAGE,QAAQ;EAC3B,OAAOA,QAAQ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,IAAE,CAAC;EAAA,CACV,CAAC;AAEX;AAEA,MAAM0B,MAAM,GAAG9B,UAAU,CAACuC,MAAM,CAAC;EAC/BR,IAAI,EAAE;IAAES,IAAI,EAAE;EAAE,CAAC;EACjBH,OAAO,EAAE;IAAEG,IAAI,EAAE;EAAE;AACrB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -11,6 +11,25 @@ export interface PanelUIProviderProps {
|
|
|
11
11
|
* if you paint the app background yourself.
|
|
12
12
|
*/
|
|
13
13
|
background?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Tell the keyboard controller that the Android status bar is translucent,
|
|
16
|
+
* so it measures the keyboard against the right window inset.
|
|
17
|
+
*
|
|
18
|
+
* Reach for it only where the app draws under the status bar without being
|
|
19
|
+
* edge-to-edge. Under edge-to-edge — the default from Expo SDK 54 — the
|
|
20
|
+
* controller detects that for itself and this is ignored, so leave it unset
|
|
21
|
+
* there rather than passing `false`: a value it has to ignore is a warning
|
|
22
|
+
* in development.
|
|
23
|
+
*
|
|
24
|
+
* Android only, and inert without `react-native-keyboard-controller`.
|
|
25
|
+
*/
|
|
26
|
+
statusBarTranslucent?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The same, for a translucent Android navigation bar.
|
|
29
|
+
*
|
|
30
|
+
* Android only, and inert without `react-native-keyboard-controller`.
|
|
31
|
+
*/
|
|
32
|
+
navigationBarTranslucent?: boolean;
|
|
14
33
|
}
|
|
15
34
|
/**
|
|
16
35
|
* Root provider for PanelUI. Owns three things:
|
|
@@ -24,5 +43,5 @@ export interface PanelUIProviderProps {
|
|
|
24
43
|
* Theme switching is handled natively by Uniwind — use the `useTheme()` hook
|
|
25
44
|
* exported from panelui-native.
|
|
26
45
|
*/
|
|
27
|
-
export declare function PanelUIProvider({ children, className, background, }: PanelUIProviderProps): import("react").JSX.Element;
|
|
46
|
+
export declare function PanelUIProvider({ children, className, background, statusBarTranslucent, navigationBarTranslucent, }: PanelUIProviderProps): import("react").JSX.Element;
|
|
28
47
|
//# sourceMappingURL=panel-ui-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel-ui-provider.d.ts","sourceRoot":"","sources":["../../../../src/providers/panel-ui-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"panel-ui-provider.d.ts","sourceRoot":"","sources":["../../../../src/providers/panel-ui-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AA0E3D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,SAAS,EACT,UAAiB,EACjB,oBAAoB,EACpB,wBAAwB,GACzB,EAAE,oBAAoB,+BA0BtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "panelui-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"description": "High-performance React Native UI components for Expo. Semantic design tokens, powered by Uniwind (Tailwind v4) and Reanimated.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ComponentType, type ReactNode } from 'react';
|
|
2
2
|
import { Platform, StyleSheet, TurboModuleRegistry, View } from 'react-native';
|
|
3
3
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
4
4
|
import {
|
|
@@ -33,17 +33,35 @@ import { cn } from '../utils/cn';
|
|
|
33
33
|
* afterwards. The result is cached so the component type is stable: swapping it
|
|
34
34
|
* between renders would unmount and rebuild everything below it.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
interface KeyboardHostProps {
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
statusBarTranslucent?: boolean;
|
|
39
|
+
navigationBarTranslucent?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The pass-through, which has to be a component rather than `Fragment`.
|
|
44
|
+
*
|
|
45
|
+
* `Fragment` accepts `key` and `children` and warns about anything else, so
|
|
46
|
+
* once the window flags below are forwarded it would warn in every project
|
|
47
|
+
* that does not have the controller installed — which is the one case the
|
|
48
|
+
* pass-through exists to keep quiet.
|
|
49
|
+
*/
|
|
50
|
+
function KeyboardPassthrough({ children }: KeyboardHostProps) {
|
|
51
|
+
return <>{children}</>;
|
|
52
|
+
}
|
|
37
53
|
|
|
38
|
-
|
|
54
|
+
let keyboardProvider: ComponentType<KeyboardHostProps> | undefined;
|
|
55
|
+
|
|
56
|
+
function resolveKeyboardProvider(): ComponentType<KeyboardHostProps> {
|
|
39
57
|
if (keyboardProvider) return keyboardProvider;
|
|
40
58
|
|
|
41
|
-
let resolved: ComponentType<
|
|
59
|
+
let resolved: ComponentType<KeyboardHostProps> = KeyboardPassthrough;
|
|
42
60
|
try {
|
|
43
61
|
if (TurboModuleRegistry.get('KeyboardController') !== null) {
|
|
44
62
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
45
63
|
const controller = require('react-native-keyboard-controller');
|
|
46
|
-
resolved = controller?.KeyboardProvider ??
|
|
64
|
+
resolved = controller?.KeyboardProvider ?? KeyboardPassthrough;
|
|
47
65
|
}
|
|
48
66
|
} catch {
|
|
49
67
|
// Not installed, or installed without its native half. Either way the
|
|
@@ -66,6 +84,25 @@ export interface PanelUIProviderProps {
|
|
|
66
84
|
* if you paint the app background yourself.
|
|
67
85
|
*/
|
|
68
86
|
background?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Tell the keyboard controller that the Android status bar is translucent,
|
|
89
|
+
* so it measures the keyboard against the right window inset.
|
|
90
|
+
*
|
|
91
|
+
* Reach for it only where the app draws under the status bar without being
|
|
92
|
+
* edge-to-edge. Under edge-to-edge — the default from Expo SDK 54 — the
|
|
93
|
+
* controller detects that for itself and this is ignored, so leave it unset
|
|
94
|
+
* there rather than passing `false`: a value it has to ignore is a warning
|
|
95
|
+
* in development.
|
|
96
|
+
*
|
|
97
|
+
* Android only, and inert without `react-native-keyboard-controller`.
|
|
98
|
+
*/
|
|
99
|
+
statusBarTranslucent?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The same, for a translucent Android navigation bar.
|
|
102
|
+
*
|
|
103
|
+
* Android only, and inert without `react-native-keyboard-controller`.
|
|
104
|
+
*/
|
|
105
|
+
navigationBarTranslucent?: boolean;
|
|
69
106
|
}
|
|
70
107
|
|
|
71
108
|
/**
|
|
@@ -84,6 +121,8 @@ export function PanelUIProvider({
|
|
|
84
121
|
children,
|
|
85
122
|
className,
|
|
86
123
|
background = true,
|
|
124
|
+
statusBarTranslucent,
|
|
125
|
+
navigationBarTranslucent,
|
|
87
126
|
}: PanelUIProviderProps) {
|
|
88
127
|
// Resolved once, on the first render of the first provider in the app, and
|
|
89
128
|
// cached from there. See {@link resolveKeyboardProvider}.
|
|
@@ -92,8 +131,13 @@ export function PanelUIProvider({
|
|
|
92
131
|
return (
|
|
93
132
|
<GestureHandlerRootView style={styles.root}>
|
|
94
133
|
{/* Outermost of ours, so every field below it can avoid the keyboard.
|
|
95
|
-
A
|
|
96
|
-
|
|
134
|
+
A pass-through when the controller is not installed. */}
|
|
135
|
+
{/* Passed through rather than defaulted: the controller warns about a
|
|
136
|
+
value it has to ignore, and under edge-to-edge it ignores both. */}
|
|
137
|
+
<KeyboardProvider
|
|
138
|
+
statusBarTranslucent={statusBarTranslucent}
|
|
139
|
+
navigationBarTranslucent={navigationBarTranslucent}
|
|
140
|
+
>
|
|
97
141
|
<PortalProvider>
|
|
98
142
|
<ProviderSurface
|
|
99
143
|
background={background}
|