@vvedantb/native-ui 0.24.0 → 0.24.2
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/dist/CaptureButton.jsx +67 -46
- package/dist/Chip.jsx +42 -34
- package/dist/ColorSwatches.jsx +169 -45
- package/dist/Dialog.jsx +16 -3
- package/dist/DropdownMenu.jsx +245 -116
- package/dist/FloatingFAB.jsx +71 -55
- package/dist/IconButton.jsx +62 -48
- package/dist/PinnedBotTile.jsx +87 -72
- package/dist/SearchInput.jsx +313 -50
- package/dist/ai/card-button.jsx +116 -147
- package/dist/ai/file-chip.jsx +46 -22
- package/dist/ai/message-action-sheet.jsx +182 -202
- package/dist/motion.js +31 -0
- package/dist/pressScale.js +131 -0
- package/dist/primitives/overlay.jsx +162 -101
- package/dist/primitives/select.jsx +5 -1
- package/package.json +1 -1
- package/src/CaptureButton.tsx +15 -9
- package/src/Chip.tsx +9 -4
- package/src/ColorSwatches.tsx +74 -29
- package/src/Dialog.tsx +16 -7
- package/src/DropdownMenu.tsx +71 -16
- package/src/FloatingFAB.tsx +20 -13
- package/src/IconButton.tsx +8 -6
- package/src/PinnedBotTile.tsx +9 -5
- package/src/SearchInput.tsx +40 -12
- package/src/ai/card-button.tsx +17 -11
- package/src/ai/file-chip.tsx +13 -4
- package/src/ai/message-action-sheet.tsx +90 -97
- package/src/motion.ts +15 -0
- package/src/pressScale.ts +72 -0
- package/src/primitives/overlay.tsx +48 -8
- package/src/primitives/select.tsx +7 -2
package/dist/IconButton.jsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import { Pressable } from "react-native";
|
|
3
|
-
import { cn } from "./cn";
|
|
4
2
|
import { touchSlop } from "./controlStyles";
|
|
3
|
+
import { AnimatedPressable, usePressScale } from "./pressScale";
|
|
5
4
|
import { withAlpha } from "./palette";
|
|
6
5
|
import { useLargerText } from "./theme";
|
|
7
6
|
import { tokens } from "./tokens";
|
|
@@ -42,7 +41,7 @@ export function iconButtonColors(variant, scheme) {
|
|
|
42
41
|
* `ChatIconButton`.
|
|
43
42
|
*/
|
|
44
43
|
export function IconButton(t0) {
|
|
45
|
-
const $ = _c(
|
|
44
|
+
const $ = _c(35);
|
|
46
45
|
const {
|
|
47
46
|
icon: Icon,
|
|
48
47
|
label,
|
|
@@ -82,36 +81,41 @@ export function IconButton(t0) {
|
|
|
82
81
|
color = $[4];
|
|
83
82
|
frame = $[5];
|
|
84
83
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
const t5 = disabled ? 0.5 : 1;
|
|
85
|
+
let t6;
|
|
86
|
+
if ($[6] !== disabled || $[7] !== t5) {
|
|
87
|
+
t6 = {
|
|
88
|
+
restOpacity: t5,
|
|
88
89
|
disabled
|
|
89
90
|
};
|
|
90
91
|
$[6] = disabled;
|
|
91
92
|
$[7] = t5;
|
|
93
|
+
$[8] = t6;
|
|
92
94
|
} else {
|
|
93
|
-
|
|
95
|
+
t6 = $[8];
|
|
94
96
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
const press = usePressScale(t6);
|
|
98
|
+
let t7;
|
|
99
|
+
if ($[9] !== disabled) {
|
|
100
|
+
t7 = {
|
|
101
|
+
disabled
|
|
102
|
+
};
|
|
103
|
+
$[9] = disabled;
|
|
104
|
+
$[10] = t7;
|
|
100
105
|
} else {
|
|
101
|
-
|
|
106
|
+
t7 = $[10];
|
|
102
107
|
}
|
|
103
|
-
const t7 = disabled && "opacity-50";
|
|
104
108
|
let t8;
|
|
105
|
-
if ($[
|
|
106
|
-
t8 =
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
+
if ($[11] !== diameter) {
|
|
110
|
+
t8 = touchSlop(diameter);
|
|
111
|
+
$[11] = diameter;
|
|
112
|
+
$[12] = t8;
|
|
109
113
|
} else {
|
|
110
|
-
t8 = $[
|
|
114
|
+
t8 = $[12];
|
|
111
115
|
}
|
|
112
116
|
const t9 = diameter / 2;
|
|
113
117
|
let t10;
|
|
114
|
-
if ($[
|
|
118
|
+
if ($[13] !== diameter || $[14] !== frame || $[15] !== t9) {
|
|
115
119
|
t10 = {
|
|
116
120
|
width: diameter,
|
|
117
121
|
height: diameter,
|
|
@@ -119,39 +123,49 @@ export function IconButton(t0) {
|
|
|
119
123
|
borderWidth: 1,
|
|
120
124
|
...frame
|
|
121
125
|
};
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
+
$[13] = diameter;
|
|
127
|
+
$[14] = frame;
|
|
128
|
+
$[15] = t9;
|
|
129
|
+
$[16] = t10;
|
|
126
130
|
} else {
|
|
127
|
-
t10 = $[
|
|
131
|
+
t10 = $[16];
|
|
128
132
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[18] = t11;
|
|
136
|
-
$[19] = t12;
|
|
133
|
+
let t11;
|
|
134
|
+
if ($[17] !== press.style || $[18] !== t10) {
|
|
135
|
+
t11 = [t10, press.style];
|
|
136
|
+
$[17] = press.style;
|
|
137
|
+
$[18] = t10;
|
|
138
|
+
$[19] = t11;
|
|
137
139
|
} else {
|
|
138
|
-
|
|
140
|
+
t11 = $[19];
|
|
139
141
|
}
|
|
142
|
+
const t12 = iconColor ?? color;
|
|
140
143
|
let t13;
|
|
141
|
-
if ($[20] !==
|
|
142
|
-
t13 = <
|
|
143
|
-
$[20] =
|
|
144
|
-
$[21] =
|
|
145
|
-
$[22] =
|
|
146
|
-
$[23] =
|
|
147
|
-
|
|
148
|
-
$[
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
144
|
+
if ($[20] !== Icon || $[21] !== iconSize || $[22] !== t12) {
|
|
145
|
+
t13 = <Icon size={iconSize} color={t12} />;
|
|
146
|
+
$[20] = Icon;
|
|
147
|
+
$[21] = iconSize;
|
|
148
|
+
$[22] = t12;
|
|
149
|
+
$[23] = t13;
|
|
150
|
+
} else {
|
|
151
|
+
t13 = $[23];
|
|
152
|
+
}
|
|
153
|
+
let t14;
|
|
154
|
+
if ($[24] !== disabled || $[25] !== label || $[26] !== onPress || $[27] !== press.onPressIn || $[28] !== press.onPressOut || $[29] !== t11 || $[30] !== t13 || $[31] !== t7 || $[32] !== t8 || $[33] !== testID) {
|
|
155
|
+
t14 = <AnimatedPressable testID={testID} accessibilityRole="button" accessibilityLabel={label} accessibilityState={t7} hitSlop={t8} disabled={disabled} onPress={onPress} onPressIn={press.onPressIn} onPressOut={press.onPressOut} className="items-center justify-center" style={t11}>{t13}</AnimatedPressable>;
|
|
156
|
+
$[24] = disabled;
|
|
157
|
+
$[25] = label;
|
|
158
|
+
$[26] = onPress;
|
|
159
|
+
$[27] = press.onPressIn;
|
|
160
|
+
$[28] = press.onPressOut;
|
|
161
|
+
$[29] = t11;
|
|
162
|
+
$[30] = t13;
|
|
163
|
+
$[31] = t7;
|
|
164
|
+
$[32] = t8;
|
|
165
|
+
$[33] = testID;
|
|
166
|
+
$[34] = t14;
|
|
153
167
|
} else {
|
|
154
|
-
|
|
168
|
+
t14 = $[34];
|
|
155
169
|
}
|
|
156
|
-
return
|
|
170
|
+
return t14;
|
|
157
171
|
}
|
package/dist/PinnedBotTile.jsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { Children } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { Text, View } from "react-native";
|
|
4
4
|
import { cn } from "./cn";
|
|
5
5
|
import { cardStyle, textStyle, typeStyle } from "./controlStyles";
|
|
6
|
+
import { AnimatedPressable, usePressScale } from "./pressScale";
|
|
6
7
|
import { StatusDot } from "./StatusDot";
|
|
7
8
|
import { Spinner } from "./Spinner";
|
|
8
9
|
import { useLargerText } from "./theme";
|
|
@@ -14,7 +15,7 @@ import { useScheme } from "./useScheme";
|
|
|
14
15
|
* by the title, plus "unread" or "generating".
|
|
15
16
|
*/
|
|
16
17
|
export function PinnedBotTile(t0) {
|
|
17
|
-
const $ = _c(
|
|
18
|
+
const $ = _c(40);
|
|
18
19
|
const {
|
|
19
20
|
title,
|
|
20
21
|
leading,
|
|
@@ -28,6 +29,7 @@ export function PinnedBotTile(t0) {
|
|
|
28
29
|
const generating = t2 === undefined ? false : t2;
|
|
29
30
|
const scheme = useScheme();
|
|
30
31
|
const largerText = useLargerText();
|
|
32
|
+
const press = usePressScale();
|
|
31
33
|
const t3 = unread ? "unread" : null;
|
|
32
34
|
const t4 = generating ? "generating" : null;
|
|
33
35
|
let t5;
|
|
@@ -41,101 +43,114 @@ export function PinnedBotTile(t0) {
|
|
|
41
43
|
}
|
|
42
44
|
const state = t5.join(", ");
|
|
43
45
|
const t6 = state ? `${title}, ${state}` : title;
|
|
44
|
-
const t7 =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
const t7 = press.onPressIn;
|
|
47
|
+
const t8 = press.onPressOut;
|
|
48
|
+
const t9 = largerText ? "min-h-36" : "min-h-28";
|
|
49
|
+
let t10;
|
|
50
|
+
if ($[3] !== t9) {
|
|
51
|
+
t10 = cn("min-w-0 items-center justify-center gap-2 px-3 py-4", t9);
|
|
52
|
+
$[3] = t9;
|
|
53
|
+
$[4] = t10;
|
|
50
54
|
} else {
|
|
51
|
-
|
|
55
|
+
t10 = $[4];
|
|
52
56
|
}
|
|
53
|
-
let
|
|
57
|
+
let t11;
|
|
54
58
|
if ($[5] !== scheme) {
|
|
55
|
-
|
|
59
|
+
t11 = cardStyle(scheme);
|
|
56
60
|
$[5] = scheme;
|
|
57
|
-
$[6] =
|
|
61
|
+
$[6] = t11;
|
|
58
62
|
} else {
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
const t10 = largerText ? "text-lg" : "text-base";
|
|
62
|
-
let t11;
|
|
63
|
-
if ($[7] !== t10) {
|
|
64
|
-
t11 = cn("text-center font-instrument-sans-semibold", t10);
|
|
65
|
-
$[7] = t10;
|
|
66
|
-
$[8] = t11;
|
|
67
|
-
} else {
|
|
68
|
-
t11 = $[8];
|
|
63
|
+
t11 = $[6];
|
|
69
64
|
}
|
|
70
65
|
let t12;
|
|
71
|
-
if ($[
|
|
72
|
-
t12 =
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
75
|
-
|
|
76
|
-
t12 = $[10];
|
|
77
|
-
}
|
|
78
|
-
let t13;
|
|
79
|
-
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
80
|
-
t13 = typeStyle("semibold");
|
|
81
|
-
$[11] = t13;
|
|
66
|
+
if ($[7] !== press.style || $[8] !== t11) {
|
|
67
|
+
t12 = [t11, press.style];
|
|
68
|
+
$[7] = press.style;
|
|
69
|
+
$[8] = t11;
|
|
70
|
+
$[9] = t12;
|
|
82
71
|
} else {
|
|
83
|
-
|
|
72
|
+
t12 = $[9];
|
|
84
73
|
}
|
|
74
|
+
const t13 = largerText ? "text-lg" : "text-base";
|
|
85
75
|
let t14;
|
|
86
|
-
if ($[
|
|
87
|
-
t14 =
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
76
|
+
if ($[10] !== t13) {
|
|
77
|
+
t14 = cn("text-center font-instrument-sans-semibold", t13);
|
|
78
|
+
$[10] = t13;
|
|
79
|
+
$[11] = t14;
|
|
90
80
|
} else {
|
|
91
|
-
t14 = $[
|
|
81
|
+
t14 = $[11];
|
|
92
82
|
}
|
|
93
83
|
let t15;
|
|
94
|
-
if ($[
|
|
95
|
-
t15 =
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[16] = title;
|
|
99
|
-
$[17] = t15;
|
|
84
|
+
if ($[12] !== scheme) {
|
|
85
|
+
t15 = textStyle("foreground", scheme);
|
|
86
|
+
$[12] = scheme;
|
|
87
|
+
$[13] = t15;
|
|
100
88
|
} else {
|
|
101
|
-
t15 = $[
|
|
89
|
+
t15 = $[13];
|
|
102
90
|
}
|
|
103
91
|
let t16;
|
|
104
|
-
if ($[
|
|
105
|
-
t16 =
|
|
106
|
-
$[
|
|
107
|
-
$[19] = unread;
|
|
108
|
-
$[20] = t16;
|
|
92
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
93
|
+
t16 = typeStyle("semibold");
|
|
94
|
+
$[14] = t16;
|
|
109
95
|
} else {
|
|
110
|
-
t16 = $[
|
|
96
|
+
t16 = $[14];
|
|
111
97
|
}
|
|
112
98
|
let t17;
|
|
113
|
-
if ($[
|
|
114
|
-
t17 =
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[23] = t17;
|
|
99
|
+
if ($[15] !== t15) {
|
|
100
|
+
t17 = [t15, t16];
|
|
101
|
+
$[15] = t15;
|
|
102
|
+
$[16] = t17;
|
|
118
103
|
} else {
|
|
119
|
-
t17 = $[
|
|
104
|
+
t17 = $[16];
|
|
120
105
|
}
|
|
121
106
|
let t18;
|
|
122
|
-
if ($[
|
|
123
|
-
t18 = <
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
|
|
129
|
-
$[
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
107
|
+
if ($[17] !== t14 || $[18] !== t17 || $[19] !== title) {
|
|
108
|
+
t18 = <Text numberOfLines={2} className={t14} style={t17}>{title}</Text>;
|
|
109
|
+
$[17] = t14;
|
|
110
|
+
$[18] = t17;
|
|
111
|
+
$[19] = title;
|
|
112
|
+
$[20] = t18;
|
|
113
|
+
} else {
|
|
114
|
+
t18 = $[20];
|
|
115
|
+
}
|
|
116
|
+
let t19;
|
|
117
|
+
if ($[21] !== testID || $[22] !== unread) {
|
|
118
|
+
t19 = unread ? <View className="absolute left-3 top-3" testID={testID ? `${testID}-unread` : undefined}><StatusDot tone="active" size="md" /></View> : null;
|
|
119
|
+
$[21] = testID;
|
|
120
|
+
$[22] = unread;
|
|
121
|
+
$[23] = t19;
|
|
122
|
+
} else {
|
|
123
|
+
t19 = $[23];
|
|
124
|
+
}
|
|
125
|
+
let t20;
|
|
126
|
+
if ($[24] !== generating || $[25] !== testID) {
|
|
127
|
+
t20 = generating ? <View className="absolute right-3 top-3" testID={testID ? `${testID}-generating` : undefined}><Spinner size="sm" decorative={true} /></View> : null;
|
|
128
|
+
$[24] = generating;
|
|
129
|
+
$[25] = testID;
|
|
130
|
+
$[26] = t20;
|
|
131
|
+
} else {
|
|
132
|
+
t20 = $[26];
|
|
133
|
+
}
|
|
134
|
+
let t21;
|
|
135
|
+
if ($[27] !== leading || $[28] !== onLongPress || $[29] !== onPress || $[30] !== press.onPressIn || $[31] !== press.onPressOut || $[32] !== t10 || $[33] !== t12 || $[34] !== t18 || $[35] !== t19 || $[36] !== t20 || $[37] !== t6 || $[38] !== testID) {
|
|
136
|
+
t21 = <AnimatedPressable testID={testID} accessibilityRole="button" accessibilityLabel={t6} onPress={onPress} onLongPress={onLongPress} onPressIn={t7} onPressOut={t8} className={t10} style={t12}>{leading}{t18}{t19}{t20}</AnimatedPressable>;
|
|
137
|
+
$[27] = leading;
|
|
138
|
+
$[28] = onLongPress;
|
|
139
|
+
$[29] = onPress;
|
|
140
|
+
$[30] = press.onPressIn;
|
|
141
|
+
$[31] = press.onPressOut;
|
|
142
|
+
$[32] = t10;
|
|
143
|
+
$[33] = t12;
|
|
134
144
|
$[34] = t18;
|
|
145
|
+
$[35] = t19;
|
|
146
|
+
$[36] = t20;
|
|
147
|
+
$[37] = t6;
|
|
148
|
+
$[38] = testID;
|
|
149
|
+
$[39] = t21;
|
|
135
150
|
} else {
|
|
136
|
-
|
|
151
|
+
t21 = $[39];
|
|
137
152
|
}
|
|
138
|
-
return
|
|
153
|
+
return t21;
|
|
139
154
|
}
|
|
140
155
|
/**
|
|
141
156
|
* Lays `PinnedBotTile`s out two across, wrapping to new rows, with a 12 gap. A
|