@vvedantb/native-ui 0.35.0 → 0.36.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/README.md +16 -1
- package/dist/Button.jsx +29 -18
- package/dist/DropdownMenu.jsx +89 -39
- package/dist/ExpoWebRoot.jsx +42 -21
- package/dist/Field.jsx +309 -0
- package/dist/FloatingTabBar.jsx +98 -94
- package/dist/IconButton.jsx +74 -51
- package/dist/ai/conversation.jsx +1 -1
- package/dist/ai/icon-button.jsx +67 -60
- package/dist/ai/prompt-input.jsx +9 -8
- package/dist/blur.js +6 -0
- package/dist/controlStyles.js +24 -2
- package/dist/entries/primitives.js +1 -0
- package/dist/examples/ParityGallery.jsx +488 -475
- package/dist/glassBlur.jsx +1 -1
- package/dist/index.js +1 -0
- package/dist/primitives/window-layer.jsx +35 -28
- package/package.json +27 -3
- package/src/Button.tsx +18 -7
- package/src/DropdownMenu.tsx +53 -7
- package/src/ExpoWebRoot.tsx +18 -3
- package/src/Field.tsx +105 -0
- package/src/FloatingTabBar.tsx +17 -12
- package/src/IconButton.tsx +7 -4
- package/src/Spinner.tsx +2 -2
- package/src/ai/conversation.tsx +1 -1
- package/src/ai/icon-button.tsx +5 -4
- package/src/ai/message.tsx +2 -2
- package/src/ai/prompt-input.tsx +6 -4
- package/src/auth/AccountScreens.tsx +4 -4
- package/src/auth/SignInScreen.tsx +4 -4
- package/src/blur.ts +8 -0
- package/src/controlStyles.ts +29 -2
- package/src/entries/primitives.ts +2 -0
- package/src/examples/ParityGallery.tsx +22 -1
- package/src/glassBlur.tsx +5 -7
- package/src/index.ts +2 -0
- package/src/primitives/sheet-gesture.tsx +1 -2
- package/src/primitives/web-click-guard.ts +3 -3
- package/src/primitives/window-layer.tsx +8 -6
- package/src/tabBarRoutes.ts +4 -3
- package/src/webview/HtmlView.tsx +5 -2
package/dist/IconButton.jsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
2
4
|
import { touchSlop } from "./controlStyles";
|
|
3
5
|
import { AnimatedPressable, usePressScale } from "./pressScale";
|
|
4
6
|
import { withAlpha } from "./palette";
|
|
@@ -40,8 +42,8 @@ export function iconButtonColors(variant, scheme) {
|
|
|
40
42
|
* 32, `md` 40) and 48, each reaching 44 with its hit slop. Not the AI chat
|
|
41
43
|
* `ChatIconButton`.
|
|
42
44
|
*/
|
|
43
|
-
export function IconButton(t0) {
|
|
44
|
-
const $ = _c(
|
|
45
|
+
export const IconButton = forwardRef(function IconButton(t0, ref) {
|
|
46
|
+
const $ = _c(41);
|
|
45
47
|
const {
|
|
46
48
|
icon: Icon,
|
|
47
49
|
label,
|
|
@@ -96,76 +98,97 @@ export function IconButton(t0) {
|
|
|
96
98
|
}
|
|
97
99
|
const press = usePressScale(t6);
|
|
98
100
|
let t7;
|
|
99
|
-
if ($[9] !==
|
|
101
|
+
if ($[9] !== diameter) {
|
|
100
102
|
t7 = {
|
|
101
|
-
|
|
103
|
+
width: diameter,
|
|
104
|
+
height: diameter
|
|
102
105
|
};
|
|
103
|
-
$[9] =
|
|
106
|
+
$[9] = diameter;
|
|
104
107
|
$[10] = t7;
|
|
105
108
|
} else {
|
|
106
109
|
t7 = $[10];
|
|
107
110
|
}
|
|
108
111
|
let t8;
|
|
109
|
-
if ($[11] !==
|
|
110
|
-
t8 =
|
|
111
|
-
|
|
112
|
+
if ($[11] !== disabled) {
|
|
113
|
+
t8 = {
|
|
114
|
+
disabled
|
|
115
|
+
};
|
|
116
|
+
$[11] = disabled;
|
|
112
117
|
$[12] = t8;
|
|
113
118
|
} else {
|
|
114
119
|
t8 = $[12];
|
|
115
120
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
let t9;
|
|
122
|
+
if ($[13] !== diameter) {
|
|
123
|
+
t9 = touchSlop(diameter);
|
|
124
|
+
$[13] = diameter;
|
|
125
|
+
$[14] = t9;
|
|
126
|
+
} else {
|
|
127
|
+
t9 = $[14];
|
|
128
|
+
}
|
|
129
|
+
const t10 = diameter / 2;
|
|
130
|
+
let t11;
|
|
131
|
+
if ($[15] !== diameter || $[16] !== frame || $[17] !== t10) {
|
|
132
|
+
t11 = {
|
|
120
133
|
width: diameter,
|
|
121
134
|
height: diameter,
|
|
122
|
-
borderRadius:
|
|
135
|
+
borderRadius: t10,
|
|
123
136
|
borderWidth: 1,
|
|
124
137
|
...frame
|
|
125
138
|
};
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
139
|
+
$[15] = diameter;
|
|
140
|
+
$[16] = frame;
|
|
141
|
+
$[17] = t10;
|
|
142
|
+
$[18] = t11;
|
|
130
143
|
} else {
|
|
131
|
-
|
|
144
|
+
t11 = $[18];
|
|
132
145
|
}
|
|
133
|
-
let
|
|
134
|
-
if ($[
|
|
135
|
-
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
146
|
+
let t12;
|
|
147
|
+
if ($[19] !== press.style || $[20] !== t11) {
|
|
148
|
+
t12 = [t11, press.style];
|
|
149
|
+
$[19] = press.style;
|
|
150
|
+
$[20] = t11;
|
|
151
|
+
$[21] = t12;
|
|
139
152
|
} else {
|
|
140
|
-
|
|
153
|
+
t12 = $[21];
|
|
141
154
|
}
|
|
142
|
-
const
|
|
143
|
-
let
|
|
144
|
-
if ($[
|
|
145
|
-
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
155
|
+
const t13 = iconColor ?? color;
|
|
156
|
+
let t14;
|
|
157
|
+
if ($[22] !== Icon || $[23] !== iconSize || $[24] !== t13) {
|
|
158
|
+
t14 = <Icon size={iconSize} color={t13} />;
|
|
159
|
+
$[22] = Icon;
|
|
160
|
+
$[23] = iconSize;
|
|
161
|
+
$[24] = t13;
|
|
162
|
+
$[25] = t14;
|
|
150
163
|
} else {
|
|
151
|
-
|
|
164
|
+
t14 = $[25];
|
|
152
165
|
}
|
|
153
|
-
let
|
|
154
|
-
if ($[
|
|
155
|
-
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
166
|
+
let t15;
|
|
167
|
+
if ($[26] !== disabled || $[27] !== label || $[28] !== onPress || $[29] !== press.onPressIn || $[30] !== press.onPressOut || $[31] !== t12 || $[32] !== t14 || $[33] !== t8 || $[34] !== t9 || $[35] !== testID) {
|
|
168
|
+
t15 = <AnimatedPressable testID={testID} accessibilityRole="button" accessibilityLabel={label} accessibilityState={t8} hitSlop={t9} disabled={disabled} onPress={onPress} onPressIn={press.onPressIn} onPressOut={press.onPressOut} className="items-center justify-center" style={t12}>{t14}</AnimatedPressable>;
|
|
169
|
+
$[26] = disabled;
|
|
170
|
+
$[27] = label;
|
|
171
|
+
$[28] = onPress;
|
|
172
|
+
$[29] = press.onPressIn;
|
|
173
|
+
$[30] = press.onPressOut;
|
|
174
|
+
$[31] = t12;
|
|
175
|
+
$[32] = t14;
|
|
176
|
+
$[33] = t8;
|
|
177
|
+
$[34] = t9;
|
|
178
|
+
$[35] = testID;
|
|
179
|
+
$[36] = t15;
|
|
167
180
|
} else {
|
|
168
|
-
|
|
181
|
+
t15 = $[36];
|
|
169
182
|
}
|
|
170
|
-
|
|
171
|
-
|
|
183
|
+
let t16;
|
|
184
|
+
if ($[37] !== ref || $[38] !== t15 || $[39] !== t7) {
|
|
185
|
+
t16 = <View ref={ref} collapsable={false} style={t7}>{t15}</View>;
|
|
186
|
+
$[37] = ref;
|
|
187
|
+
$[38] = t15;
|
|
188
|
+
$[39] = t7;
|
|
189
|
+
$[40] = t16;
|
|
190
|
+
} else {
|
|
191
|
+
t16 = $[40];
|
|
192
|
+
}
|
|
193
|
+
return t16;
|
|
194
|
+
});
|
package/dist/ai/conversation.jsx
CHANGED
|
@@ -399,7 +399,7 @@ export function ConversationList({
|
|
|
399
399
|
// only if the element takes a `style`: draw it the right way up instead.
|
|
400
400
|
if (inverted && !hasRows) {
|
|
401
401
|
const Empty = props.ListEmptyComponent;
|
|
402
|
-
return <View style={styles.fill}>{isValidElement(Empty) ? Empty : Empty ? <Empty /> : null}</View>;
|
|
402
|
+
return <View style={styles.fill}>{isValidElement(Empty) ? Empty : typeof Empty === "function" ? <Empty /> : null}</View>;
|
|
403
403
|
}
|
|
404
404
|
// The newest message's offset: inverted, 0 less the space before it.
|
|
405
405
|
const end = () => inverted ? size.current.inset > 0 ? -size.current.inset : 0 : Math.max(0, size.current.content + size.current.inset - size.current.view);
|
package/dist/ai/icon-button.jsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
2
3
|
import { Button } from "../Button";
|
|
3
4
|
import { cn } from "../cn";
|
|
4
5
|
import { MIN_TOUCH_TARGET, buttonColors, touchSlop } from "../controlStyles";
|
|
@@ -45,8 +46,8 @@ const CHAT_ICON_BUTTON = {
|
|
|
45
46
|
* actions, the composer tools and its send button, and the code copy button.
|
|
46
47
|
* Round from the `Button` pill default; `shape="rounded"` gives radius 16.
|
|
47
48
|
*/
|
|
48
|
-
export function ChatIconButton(t0) {
|
|
49
|
-
const $ = _c(
|
|
49
|
+
export const ChatIconButton = forwardRef(function ChatIconButton(t0, ref) {
|
|
50
|
+
const $ = _c(45);
|
|
50
51
|
let Icon;
|
|
51
52
|
let className;
|
|
52
53
|
let iconColor;
|
|
@@ -98,82 +99,88 @@ export function ChatIconButton(t0) {
|
|
|
98
99
|
let t6;
|
|
99
100
|
let t7;
|
|
100
101
|
let t8;
|
|
101
|
-
|
|
102
|
+
let t9;
|
|
103
|
+
if ($[9] !== className || $[10] !== iconColor || $[11] !== label || $[12] !== largerText || $[13] !== ref || $[14] !== scheme || $[15] !== size || $[16] !== slop || $[17] !== variant) {
|
|
102
104
|
metrics = largerText ? {
|
|
103
105
|
side: MIN_TOUCH_TARGET,
|
|
104
106
|
icon: 20,
|
|
105
107
|
className: "h-11 w-11"
|
|
106
108
|
} : CHAT_ICON_BUTTON[size];
|
|
107
|
-
let
|
|
108
|
-
if ($[
|
|
109
|
-
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
109
|
+
let t10;
|
|
110
|
+
if ($[27] !== iconColor || $[28] !== scheme || $[29] !== variant) {
|
|
111
|
+
t10 = iconColor ?? buttonColors(variant, scheme)?.color ?? tokens.color.foreground[scheme];
|
|
112
|
+
$[27] = iconColor;
|
|
113
|
+
$[28] = scheme;
|
|
114
|
+
$[29] = variant;
|
|
115
|
+
$[30] = t10;
|
|
114
116
|
} else {
|
|
115
|
-
|
|
117
|
+
t10 = $[30];
|
|
116
118
|
}
|
|
117
|
-
color =
|
|
119
|
+
color = t10;
|
|
118
120
|
T0 = Button;
|
|
119
|
-
t4 =
|
|
120
|
-
t5 =
|
|
121
|
-
t6 =
|
|
122
|
-
t7 =
|
|
121
|
+
t4 = ref;
|
|
122
|
+
t5 = variant;
|
|
123
|
+
t6 = "icon";
|
|
124
|
+
t7 = label;
|
|
125
|
+
t8 = slop === "square" ? touchSlop(metrics.side) : {
|
|
123
126
|
...touchSlop(MIN_TOUCH_TARGET, metrics.side),
|
|
124
127
|
...(slop === "vertical" ? null : slop)
|
|
125
128
|
};
|
|
126
|
-
|
|
129
|
+
t9 = cn(metrics.className, className);
|
|
127
130
|
$[9] = className;
|
|
128
131
|
$[10] = iconColor;
|
|
129
132
|
$[11] = label;
|
|
130
133
|
$[12] = largerText;
|
|
131
|
-
$[13] =
|
|
132
|
-
$[14] =
|
|
133
|
-
$[15] =
|
|
134
|
-
$[16] =
|
|
135
|
-
$[17] =
|
|
136
|
-
$[18] =
|
|
137
|
-
$[19] =
|
|
138
|
-
$[20] =
|
|
139
|
-
$[21] =
|
|
140
|
-
$[22] =
|
|
141
|
-
$[23] =
|
|
142
|
-
$[24] =
|
|
134
|
+
$[13] = ref;
|
|
135
|
+
$[14] = scheme;
|
|
136
|
+
$[15] = size;
|
|
137
|
+
$[16] = slop;
|
|
138
|
+
$[17] = variant;
|
|
139
|
+
$[18] = T0;
|
|
140
|
+
$[19] = color;
|
|
141
|
+
$[20] = metrics;
|
|
142
|
+
$[21] = t4;
|
|
143
|
+
$[22] = t5;
|
|
144
|
+
$[23] = t6;
|
|
145
|
+
$[24] = t7;
|
|
146
|
+
$[25] = t8;
|
|
147
|
+
$[26] = t9;
|
|
143
148
|
} else {
|
|
144
|
-
T0 = $[
|
|
145
|
-
color = $[
|
|
146
|
-
metrics = $[
|
|
147
|
-
t4 = $[
|
|
148
|
-
t5 = $[
|
|
149
|
-
t6 = $[
|
|
150
|
-
t7 = $[
|
|
151
|
-
t8 = $[
|
|
149
|
+
T0 = $[18];
|
|
150
|
+
color = $[19];
|
|
151
|
+
metrics = $[20];
|
|
152
|
+
t4 = $[21];
|
|
153
|
+
t5 = $[22];
|
|
154
|
+
t6 = $[23];
|
|
155
|
+
t7 = $[24];
|
|
156
|
+
t8 = $[25];
|
|
157
|
+
t9 = $[26];
|
|
152
158
|
}
|
|
153
|
-
let
|
|
154
|
-
if ($[
|
|
155
|
-
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
159
|
+
let t10;
|
|
160
|
+
if ($[31] !== Icon || $[32] !== color || $[33] !== metrics.icon) {
|
|
161
|
+
t10 = <Icon size={metrics.icon} color={color} />;
|
|
162
|
+
$[31] = Icon;
|
|
163
|
+
$[32] = color;
|
|
164
|
+
$[33] = metrics.icon;
|
|
165
|
+
$[34] = t10;
|
|
160
166
|
} else {
|
|
161
|
-
|
|
167
|
+
t10 = $[34];
|
|
162
168
|
}
|
|
163
|
-
let
|
|
164
|
-
if ($[
|
|
165
|
-
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
169
|
+
let t11;
|
|
170
|
+
if ($[35] !== T0 || $[36] !== props || $[37] !== t10 || $[38] !== t4 || $[39] !== t5 || $[40] !== t6 || $[41] !== t7 || $[42] !== t8 || $[43] !== t9) {
|
|
171
|
+
t11 = <T0 ref={t4} variant={t5} size={t6} accessibilityLabel={t7} hitSlop={t8} className={t9} {...props}>{t10}</T0>;
|
|
172
|
+
$[35] = T0;
|
|
173
|
+
$[36] = props;
|
|
174
|
+
$[37] = t10;
|
|
175
|
+
$[38] = t4;
|
|
176
|
+
$[39] = t5;
|
|
177
|
+
$[40] = t6;
|
|
178
|
+
$[41] = t7;
|
|
179
|
+
$[42] = t8;
|
|
180
|
+
$[43] = t9;
|
|
181
|
+
$[44] = t11;
|
|
175
182
|
} else {
|
|
176
|
-
|
|
183
|
+
t11 = $[44];
|
|
177
184
|
}
|
|
178
|
-
return
|
|
179
|
-
}
|
|
185
|
+
return t11;
|
|
186
|
+
});
|
package/dist/ai/prompt-input.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import { useContext, useState } from "react";
|
|
2
|
+
import { forwardRef, useContext, useState } from "react";
|
|
3
3
|
import { Platform, Pressable, Text, View, useWindowDimensions } from "react-native";
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
import { IconArrowUp, IconChevronDown, IconPlayerStopFilled } from "@tabler/icons-react-native";
|
|
@@ -75,18 +75,19 @@ export function PromptInputSubmit(t0) {
|
|
|
75
75
|
return t3;
|
|
76
76
|
}
|
|
77
77
|
/** A ghost tool button for the composer `toolbar`, such as attach (web `PromptInputButton`). Give it `icon` and `label`. */
|
|
78
|
-
export function PromptInputButton(props) {
|
|
79
|
-
const $ = _c(
|
|
78
|
+
export const PromptInputButton = forwardRef(function PromptInputButton(props, ref) {
|
|
79
|
+
const $ = _c(3);
|
|
80
80
|
let t0;
|
|
81
|
-
if ($[0] !== props) {
|
|
82
|
-
t0 = <ChatIconButton variant="ghost" {...props} />;
|
|
81
|
+
if ($[0] !== props || $[1] !== ref) {
|
|
82
|
+
t0 = <ChatIconButton ref={ref} variant="ghost" {...props} />;
|
|
83
83
|
$[0] = props;
|
|
84
|
-
$[1] =
|
|
84
|
+
$[1] = ref;
|
|
85
|
+
$[2] = t0;
|
|
85
86
|
} else {
|
|
86
|
-
t0 = $[
|
|
87
|
+
t0 = $[2];
|
|
87
88
|
}
|
|
88
89
|
return t0;
|
|
89
|
-
}
|
|
90
|
+
});
|
|
90
91
|
|
|
91
92
|
/**
|
|
92
93
|
* The web `ModelPicker` trigger (`model-picker.tsx` `TRIGGER_CLASS`), the
|
package/dist/blur.js
CHANGED
package/dist/controlStyles.js
CHANGED
|
@@ -12,8 +12,15 @@ import { tokens } from "./tokens";
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* `primary` and `default` are the same (`default` is the web name). `outline`
|
|
15
|
-
* is the web bordered neutral button. `
|
|
16
|
-
*
|
|
15
|
+
* is the web bordered neutral button. `tertiary` is the web name for `ghost`
|
|
16
|
+
* and `danger` for `destructive`. `success`, `warning` and `flat` match the web
|
|
17
|
+
* variants. `tinted` is a legacy alias: the pink tint that `outline` drew
|
|
18
|
+
* before 0.3.0 (it keeps its NativeWind classes).
|
|
19
|
+
*
|
|
20
|
+
* Hierarchy: `primary`/`default` is the one main action, `secondary` an
|
|
21
|
+
* alternative, `tertiary`/`ghost` a dismissive action, `destructive`/`danger`
|
|
22
|
+
* a destructive action, `success` and `warning` show status, and `outline`,
|
|
23
|
+
* `link` and `flat` are visual.
|
|
17
24
|
*/
|
|
18
25
|
|
|
19
26
|
/**
|
|
@@ -37,17 +44,32 @@ export function buttonColors(variant, scheme) {
|
|
|
37
44
|
color: tokens.color.foreground[scheme]
|
|
38
45
|
};
|
|
39
46
|
case "destructive":
|
|
47
|
+
case "danger":
|
|
40
48
|
return {
|
|
41
49
|
backgroundColor: palette.destructive,
|
|
42
50
|
borderColor: none,
|
|
43
51
|
color: tokens.color.white
|
|
44
52
|
};
|
|
45
53
|
case "ghost":
|
|
54
|
+
case "tertiary":
|
|
55
|
+
case "flat":
|
|
46
56
|
return {
|
|
47
57
|
backgroundColor: none,
|
|
48
58
|
borderColor: none,
|
|
49
59
|
color: tokens.color.muted[scheme]
|
|
50
60
|
};
|
|
61
|
+
case "success":
|
|
62
|
+
return {
|
|
63
|
+
backgroundColor: palette.success[scheme],
|
|
64
|
+
borderColor: none,
|
|
65
|
+
color: palette.successForeground[scheme]
|
|
66
|
+
};
|
|
67
|
+
case "warning":
|
|
68
|
+
return {
|
|
69
|
+
backgroundColor: palette.warning[scheme],
|
|
70
|
+
borderColor: none,
|
|
71
|
+
color: palette.warningForeground[scheme]
|
|
72
|
+
};
|
|
51
73
|
case "link":
|
|
52
74
|
return {
|
|
53
75
|
backgroundColor: none,
|
|
@@ -9,6 +9,7 @@ export { SearchInput } from "../SearchInput";
|
|
|
9
9
|
export { PasswordInput } from "../PasswordInput";
|
|
10
10
|
export { Textarea } from "../Textarea";
|
|
11
11
|
export { Label } from "../Label";
|
|
12
|
+
export { Field, FieldControl, FieldDescription, FieldError, FieldLabel } from "../Field";
|
|
12
13
|
export { Select } from "../Select";
|
|
13
14
|
export { Switch } from "../Switch";
|
|
14
15
|
export { LabeledSwitchRow } from "../LabeledSwitchRow";
|