@vvedantb/native-ui 0.23.0 → 0.24.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 +5 -5
- package/dist/BottomSheetContainer.jsx +242 -149
- 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/FloatingFAB.jsx +71 -55
- package/dist/IconButton.jsx +62 -48
- package/dist/PinnedBotTile.jsx +87 -72
- package/dist/SearchInput.jsx +313 -50
- package/dist/Sheet.jsx +1 -1
- package/dist/ai/card-button.jsx +116 -147
- package/dist/ai/file-chip.jsx +46 -22
- package/dist/ai/message-action-sheet.jsx +1 -1
- package/dist/entries/bottom-sheet.js +2 -1
- package/dist/pressScale.js +131 -0
- package/dist/primitives/select.jsx +5 -1
- package/package.json +1 -10
- package/src/BottomSheetContainer.tsx +105 -93
- 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/FloatingFAB.tsx +20 -13
- package/src/IconButton.tsx +8 -6
- package/src/PinnedBotTile.tsx +9 -5
- package/src/SearchInput.tsx +40 -12
- package/src/Sheet.tsx +1 -1
- package/src/ai/card-button.tsx +17 -11
- package/src/ai/file-chip.tsx +13 -4
- package/src/ai/message-action-sheet.tsx +1 -1
- package/src/entries/bottom-sheet.ts +2 -1
- package/src/pressScale.ts +72 -0
- package/src/primitives/select.tsx +7 -2
- package/dist/NativeBottomSheetContainer.jsx +0 -303
- package/dist/entries/native-bottom-sheet.js +0 -4
- package/src/NativeBottomSheetContainer.tsx +0 -157
- package/src/entries/native-bottom-sheet.ts +0 -4
package/dist/ai/card-button.jsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Text } from "react-native";
|
|
3
3
|
import { cn } from "../cn";
|
|
4
4
|
import { buttonColors, MIN_TOUCH_TARGET, sizeStyle, touchSlop, typeStyle } from "../controlStyles";
|
|
5
|
+
import { AnimatedPressable, usePressScale } from "../pressScale";
|
|
5
6
|
import { useLargerText } from "../theme";
|
|
6
7
|
import { useScheme } from "../useScheme";
|
|
7
8
|
import { chatTextSize } from "./chat-text";
|
|
@@ -10,7 +11,7 @@ import { chatTextSize } from "./chat-text";
|
|
|
10
11
|
* high, label in the `small` chat size (steps up with larger text). Internal.
|
|
11
12
|
*/
|
|
12
13
|
export function CardButton(t0) {
|
|
13
|
-
const $ = _c(
|
|
14
|
+
const $ = _c(38);
|
|
14
15
|
const {
|
|
15
16
|
label,
|
|
16
17
|
variant,
|
|
@@ -21,168 +22,136 @@ export function CardButton(t0) {
|
|
|
21
22
|
} = t0;
|
|
22
23
|
const scheme = useScheme();
|
|
23
24
|
const largerText = useLargerText();
|
|
24
|
-
|
|
25
|
-
let T1;
|
|
26
|
-
let colors;
|
|
25
|
+
const size = chatTextSize("small", largerText);
|
|
27
26
|
let t1;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
if ($[0] !== scheme || $[1] !== variant) {
|
|
28
|
+
t1 = buttonColors(variant, scheme);
|
|
29
|
+
$[0] = scheme;
|
|
30
|
+
$[1] = variant;
|
|
31
|
+
$[2] = t1;
|
|
32
|
+
} else {
|
|
33
|
+
t1 = $[2];
|
|
34
|
+
}
|
|
35
|
+
const colors = t1;
|
|
36
|
+
const t2 = disabled ? 0.5 : 1;
|
|
37
|
+
const t3 = !!disabled;
|
|
32
38
|
let t4;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
if ($[3] !== t2 || $[4] !== t3) {
|
|
40
|
+
t4 = {
|
|
41
|
+
restOpacity: t2,
|
|
42
|
+
disabled: t3
|
|
43
|
+
};
|
|
44
|
+
$[3] = t2;
|
|
45
|
+
$[4] = t3;
|
|
46
|
+
$[5] = t4;
|
|
47
|
+
} else {
|
|
48
|
+
t4 = $[5];
|
|
49
|
+
}
|
|
50
|
+
const press = usePressScale(t4);
|
|
51
|
+
const T0 = AnimatedPressable;
|
|
52
|
+
const t5 = "button";
|
|
53
|
+
const t6 = accessibilityLabel ?? label;
|
|
54
|
+
const t7 = !!disabled;
|
|
36
55
|
let t8;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
$[22] = scheme;
|
|
44
|
-
$[23] = variant;
|
|
45
|
-
$[24] = t12;
|
|
46
|
-
} else {
|
|
47
|
-
t12 = $[24];
|
|
48
|
-
}
|
|
49
|
-
colors = t12;
|
|
50
|
-
T1 = Pressable;
|
|
51
|
-
t3 = testID;
|
|
52
|
-
t4 = "button";
|
|
53
|
-
t5 = accessibilityLabel ?? label;
|
|
54
|
-
const t13 = !!disabled;
|
|
55
|
-
if ($[25] !== t13) {
|
|
56
|
-
t6 = {
|
|
57
|
-
disabled: t13
|
|
58
|
-
};
|
|
59
|
-
$[25] = t13;
|
|
60
|
-
$[26] = t6;
|
|
61
|
-
} else {
|
|
62
|
-
t6 = $[26];
|
|
63
|
-
}
|
|
64
|
-
t7 = disabled;
|
|
65
|
-
t8 = onPress;
|
|
66
|
-
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
67
|
-
t9 = touchSlop(MIN_TOUCH_TARGET);
|
|
68
|
-
t10 = cn("items-center justify-center rounded-full border px-4 active:opacity-70");
|
|
69
|
-
$[27] = t10;
|
|
70
|
-
$[28] = t9;
|
|
71
|
-
} else {
|
|
72
|
-
t10 = $[27];
|
|
73
|
-
t9 = $[28];
|
|
74
|
-
}
|
|
75
|
-
const t14 = disabled ? 0.5 : 1;
|
|
76
|
-
if ($[29] !== colors.backgroundColor || $[30] !== colors.borderColor || $[31] !== t14) {
|
|
77
|
-
t11 = {
|
|
78
|
-
minHeight: MIN_TOUCH_TARGET,
|
|
79
|
-
minWidth: MIN_TOUCH_TARGET,
|
|
80
|
-
backgroundColor: colors.backgroundColor,
|
|
81
|
-
borderColor: colors.borderColor,
|
|
82
|
-
opacity: t14
|
|
83
|
-
};
|
|
84
|
-
$[29] = colors.backgroundColor;
|
|
85
|
-
$[30] = colors.borderColor;
|
|
86
|
-
$[31] = t14;
|
|
87
|
-
$[32] = t11;
|
|
88
|
-
} else {
|
|
89
|
-
t11 = $[32];
|
|
90
|
-
}
|
|
91
|
-
T0 = Text;
|
|
92
|
-
t2 = cn(size, "font-instrument-sans-semibold");
|
|
93
|
-
t1 = sizeStyle(size);
|
|
94
|
-
$[0] = accessibilityLabel;
|
|
95
|
-
$[1] = disabled;
|
|
96
|
-
$[2] = label;
|
|
97
|
-
$[3] = largerText;
|
|
98
|
-
$[4] = onPress;
|
|
99
|
-
$[5] = scheme;
|
|
100
|
-
$[6] = testID;
|
|
101
|
-
$[7] = variant;
|
|
102
|
-
$[8] = T0;
|
|
103
|
-
$[9] = T1;
|
|
104
|
-
$[10] = colors;
|
|
105
|
-
$[11] = t1;
|
|
106
|
-
$[12] = t10;
|
|
107
|
-
$[13] = t11;
|
|
108
|
-
$[14] = t2;
|
|
109
|
-
$[15] = t3;
|
|
110
|
-
$[16] = t4;
|
|
111
|
-
$[17] = t5;
|
|
112
|
-
$[18] = t6;
|
|
113
|
-
$[19] = t7;
|
|
114
|
-
$[20] = t8;
|
|
115
|
-
$[21] = t9;
|
|
56
|
+
if ($[6] !== t7) {
|
|
57
|
+
t8 = {
|
|
58
|
+
disabled: t7
|
|
59
|
+
};
|
|
60
|
+
$[6] = t7;
|
|
61
|
+
$[7] = t8;
|
|
116
62
|
} else {
|
|
117
|
-
|
|
118
|
-
T1 = $[9];
|
|
119
|
-
colors = $[10];
|
|
120
|
-
t1 = $[11];
|
|
121
|
-
t10 = $[12];
|
|
122
|
-
t11 = $[13];
|
|
123
|
-
t2 = $[14];
|
|
124
|
-
t3 = $[15];
|
|
125
|
-
t4 = $[16];
|
|
126
|
-
t5 = $[17];
|
|
127
|
-
t6 = $[18];
|
|
128
|
-
t7 = $[19];
|
|
129
|
-
t8 = $[20];
|
|
130
|
-
t9 = $[21];
|
|
63
|
+
t8 = $[7];
|
|
131
64
|
}
|
|
132
|
-
let
|
|
133
|
-
if ($[
|
|
134
|
-
|
|
135
|
-
$[
|
|
65
|
+
let t9;
|
|
66
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
67
|
+
t9 = touchSlop(MIN_TOUCH_TARGET);
|
|
68
|
+
$[8] = t9;
|
|
136
69
|
} else {
|
|
137
|
-
|
|
70
|
+
t9 = $[8];
|
|
138
71
|
}
|
|
72
|
+
const t10 = press.onPressIn;
|
|
73
|
+
const t11 = press.onPressOut;
|
|
74
|
+
const t12 = "items-center justify-center rounded-full border px-4";
|
|
139
75
|
let t13;
|
|
140
|
-
if ($[
|
|
76
|
+
if ($[9] !== colors.backgroundColor || $[10] !== colors.borderColor) {
|
|
141
77
|
t13 = {
|
|
142
|
-
|
|
78
|
+
minHeight: MIN_TOUCH_TARGET,
|
|
79
|
+
minWidth: MIN_TOUCH_TARGET,
|
|
80
|
+
backgroundColor: colors.backgroundColor,
|
|
81
|
+
borderColor: colors.borderColor
|
|
143
82
|
};
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
83
|
+
$[9] = colors.backgroundColor;
|
|
84
|
+
$[10] = colors.borderColor;
|
|
85
|
+
$[11] = t13;
|
|
146
86
|
} else {
|
|
147
|
-
t13 = $[
|
|
87
|
+
t13 = $[11];
|
|
148
88
|
}
|
|
149
89
|
let t14;
|
|
150
|
-
if ($[
|
|
151
|
-
t14 = [
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
90
|
+
if ($[12] !== press.style || $[13] !== t13) {
|
|
91
|
+
t14 = [t13, press.style];
|
|
92
|
+
$[12] = press.style;
|
|
93
|
+
$[13] = t13;
|
|
94
|
+
$[14] = t14;
|
|
95
|
+
} else {
|
|
96
|
+
t14 = $[14];
|
|
97
|
+
}
|
|
98
|
+
const T1 = Text;
|
|
99
|
+
const t15 = cn(size, "font-instrument-sans-semibold");
|
|
100
|
+
const t16 = sizeStyle(size);
|
|
101
|
+
let t17;
|
|
102
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
103
|
+
t17 = typeStyle("semibold");
|
|
104
|
+
$[15] = t17;
|
|
105
|
+
} else {
|
|
106
|
+
t17 = $[15];
|
|
107
|
+
}
|
|
108
|
+
let t18;
|
|
109
|
+
if ($[16] !== colors.color) {
|
|
110
|
+
t18 = {
|
|
111
|
+
color: colors.color
|
|
112
|
+
};
|
|
113
|
+
$[16] = colors.color;
|
|
114
|
+
$[17] = t18;
|
|
115
|
+
} else {
|
|
116
|
+
t18 = $[17];
|
|
117
|
+
}
|
|
118
|
+
let t19;
|
|
119
|
+
if ($[18] !== t16 || $[19] !== t18) {
|
|
120
|
+
t19 = [t16, t17, t18];
|
|
121
|
+
$[18] = t16;
|
|
122
|
+
$[19] = t18;
|
|
123
|
+
$[20] = t19;
|
|
155
124
|
} else {
|
|
156
|
-
|
|
125
|
+
t19 = $[20];
|
|
157
126
|
}
|
|
158
|
-
let
|
|
159
|
-
if ($[
|
|
160
|
-
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
127
|
+
let t20;
|
|
128
|
+
if ($[21] !== T1 || $[22] !== label || $[23] !== t15 || $[24] !== t19) {
|
|
129
|
+
t20 = <T1 className={t15} style={t19}>{label}</T1>;
|
|
130
|
+
$[21] = T1;
|
|
131
|
+
$[22] = label;
|
|
132
|
+
$[23] = t15;
|
|
133
|
+
$[24] = t19;
|
|
134
|
+
$[25] = t20;
|
|
166
135
|
} else {
|
|
167
|
-
|
|
136
|
+
t20 = $[25];
|
|
168
137
|
}
|
|
169
|
-
let
|
|
170
|
-
if ($[
|
|
171
|
-
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
138
|
+
let t21;
|
|
139
|
+
if ($[26] !== T0 || $[27] !== disabled || $[28] !== onPress || $[29] !== press.onPressIn || $[30] !== press.onPressOut || $[31] !== t14 || $[32] !== t20 || $[33] !== t6 || $[34] !== t8 || $[35] !== t9 || $[36] !== testID) {
|
|
140
|
+
t21 = <T0 testID={testID} accessibilityRole={t5} accessibilityLabel={t6} accessibilityState={t8} disabled={disabled} onPress={onPress} hitSlop={t9} onPressIn={t10} onPressOut={t11} className={t12} style={t14}>{t20}</T0>;
|
|
141
|
+
$[26] = T0;
|
|
142
|
+
$[27] = disabled;
|
|
143
|
+
$[28] = onPress;
|
|
144
|
+
$[29] = press.onPressIn;
|
|
145
|
+
$[30] = press.onPressOut;
|
|
146
|
+
$[31] = t14;
|
|
147
|
+
$[32] = t20;
|
|
148
|
+
$[33] = t6;
|
|
149
|
+
$[34] = t8;
|
|
150
|
+
$[35] = t9;
|
|
151
|
+
$[36] = testID;
|
|
152
|
+
$[37] = t21;
|
|
184
153
|
} else {
|
|
185
|
-
|
|
154
|
+
t21 = $[37];
|
|
186
155
|
}
|
|
187
|
-
return
|
|
156
|
+
return t21;
|
|
188
157
|
}
|
package/dist/ai/file-chip.jsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Text, View } from "react-native";
|
|
3
3
|
import { IconFile } from "@tabler/icons-react-native";
|
|
4
4
|
import { cn } from "../cn";
|
|
5
5
|
import { MIN_TOUCH_TARGET, sizeStyle, textStyle, touchSlop } from "../controlStyles";
|
|
6
|
+
import { AnimatedPressable, usePressScale } from "../pressScale";
|
|
6
7
|
import { palette } from "../palette";
|
|
7
8
|
import { useLargerText } from "../theme";
|
|
8
9
|
import { tokens } from "../tokens";
|
|
@@ -142,7 +143,7 @@ function FileChipLabel(t0) {
|
|
|
142
143
|
* otherwise. Long names are cut in the middle, so the extension shows.
|
|
143
144
|
*/
|
|
144
145
|
export function FileChip(t0) {
|
|
145
|
-
const $ = _c(
|
|
146
|
+
const $ = _c(6);
|
|
146
147
|
const {
|
|
147
148
|
name,
|
|
148
149
|
path,
|
|
@@ -160,39 +161,62 @@ export function FileChip(t0) {
|
|
|
160
161
|
return t1;
|
|
161
162
|
}
|
|
162
163
|
let t1;
|
|
163
|
-
if ($[2]
|
|
164
|
+
if ($[2] !== name || $[3] !== onOpenFile || $[4] !== path) {
|
|
165
|
+
t1 = <FileChipButton name={name} path={path} onOpenFile={onOpenFile} />;
|
|
166
|
+
$[2] = name;
|
|
167
|
+
$[3] = onOpenFile;
|
|
168
|
+
$[4] = path;
|
|
169
|
+
$[5] = t1;
|
|
170
|
+
} else {
|
|
171
|
+
t1 = $[5];
|
|
172
|
+
}
|
|
173
|
+
return t1;
|
|
174
|
+
}
|
|
175
|
+
function FileChipButton(t0) {
|
|
176
|
+
const $ = _c(14);
|
|
177
|
+
const {
|
|
178
|
+
name,
|
|
179
|
+
path,
|
|
180
|
+
onOpenFile
|
|
181
|
+
} = t0;
|
|
182
|
+
const press = usePressScale();
|
|
183
|
+
let t1;
|
|
184
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
164
185
|
t1 = touchSlop(MIN_TOUCH_TARGET, CHIP_HEIGHT);
|
|
165
|
-
$[
|
|
186
|
+
$[0] = t1;
|
|
166
187
|
} else {
|
|
167
|
-
t1 = $[
|
|
188
|
+
t1 = $[0];
|
|
168
189
|
}
|
|
169
190
|
let t2;
|
|
170
|
-
if ($[
|
|
191
|
+
if ($[1] !== onOpenFile || $[2] !== path) {
|
|
171
192
|
t2 = () => onOpenFile(path);
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
193
|
+
$[1] = onOpenFile;
|
|
194
|
+
$[2] = path;
|
|
195
|
+
$[3] = t2;
|
|
175
196
|
} else {
|
|
176
|
-
t2 = $[
|
|
197
|
+
t2 = $[3];
|
|
177
198
|
}
|
|
178
199
|
let t3;
|
|
179
|
-
if ($[
|
|
200
|
+
if ($[4] !== name) {
|
|
180
201
|
t3 = <FileChipLabel name={name} />;
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
202
|
+
$[4] = name;
|
|
203
|
+
$[5] = t3;
|
|
183
204
|
} else {
|
|
184
|
-
t3 = $[
|
|
205
|
+
t3 = $[5];
|
|
185
206
|
}
|
|
186
207
|
let t4;
|
|
187
|
-
if ($[
|
|
188
|
-
t4 = <
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
208
|
+
if ($[6] !== name || $[7] !== path || $[8] !== press.onPressIn || $[9] !== press.onPressOut || $[10] !== press.style || $[11] !== t2 || $[12] !== t3) {
|
|
209
|
+
t4 = <AnimatedPressable accessibilityRole="button" accessibilityLabel={name} accessibilityHint={path} hitSlop={t1} onPress={t2} onPressIn={press.onPressIn} onPressOut={press.onPressOut} style={press.style} className="min-w-0 max-w-full">{t3}</AnimatedPressable>;
|
|
210
|
+
$[6] = name;
|
|
211
|
+
$[7] = path;
|
|
212
|
+
$[8] = press.onPressIn;
|
|
213
|
+
$[9] = press.onPressOut;
|
|
214
|
+
$[10] = press.style;
|
|
215
|
+
$[11] = t2;
|
|
216
|
+
$[12] = t3;
|
|
217
|
+
$[13] = t4;
|
|
194
218
|
} else {
|
|
195
|
-
t4 = $[
|
|
219
|
+
t4 = $[13];
|
|
196
220
|
}
|
|
197
221
|
return t4;
|
|
198
222
|
}
|
|
@@ -18,7 +18,7 @@ import { chatTextSize } from "./chat-text";
|
|
|
18
18
|
export const MESSAGE_ACTIONS_TITLE = "Message actions";
|
|
19
19
|
/**
|
|
20
20
|
* The sheet that opens on a long press of a chat message: a bottom sheet in
|
|
21
|
-
* an RN `Modal` (no
|
|
21
|
+
* an RN `Modal` (no bottom-sheet library) with one pressable row per action
|
|
22
22
|
* and a Cancel row. It closes on the backdrop, Cancel, Android back and after
|
|
23
23
|
* an action. A `selectionHaptic()` fires when it opens (`expo-haptics` is an
|
|
24
24
|
* optional peer). Row testIDs are `{testID}-action-{key}`.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { cssInterop } from "nativewind";
|
|
3
|
+
import { useCallback, useEffect } from "react";
|
|
4
|
+
import { Pressable } from "react-native";
|
|
5
|
+
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
6
|
+
import { EASE_OUT } from "./motion";
|
|
7
|
+
import { useReduceMotion } from "./useReduceMotion";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A `Pressable` whose `style` can take the style from `usePressScale`.
|
|
11
|
+
* NativeWind maps `className` only for components it knows, so it is told
|
|
12
|
+
* about this one, or the classes would be dropped.
|
|
13
|
+
*/
|
|
14
|
+
export const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
15
|
+
cssInterop(AnimatedPressable, {
|
|
16
|
+
className: "style"
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Press feedback for a small control: a scale and a light dim that ease in on
|
|
20
|
+
* press-in and ease back on release. Pass `onPressIn` and `onPressOut` to the
|
|
21
|
+
* `Pressable` and `style` to the animated view that should scale (an
|
|
22
|
+
* `AnimatedPressable`, or an `Animated.View` inside the `Pressable`). One
|
|
23
|
+
* shared value on the UI thread drives transform and opacity only. A new press
|
|
24
|
+
* or release starts from the current value, so a fast tap never sticks. With
|
|
25
|
+
* Reduce Motion nothing animates and nothing scales: the dim switches on and
|
|
26
|
+
* off at once.
|
|
27
|
+
*/
|
|
28
|
+
export function usePressScale(t0) {
|
|
29
|
+
const $ = _c(18);
|
|
30
|
+
let t1;
|
|
31
|
+
if ($[0] !== t0) {
|
|
32
|
+
t1 = t0 === undefined ? {} : t0;
|
|
33
|
+
$[0] = t0;
|
|
34
|
+
$[1] = t1;
|
|
35
|
+
} else {
|
|
36
|
+
t1 = $[1];
|
|
37
|
+
}
|
|
38
|
+
const {
|
|
39
|
+
scale: t2,
|
|
40
|
+
dim: t3,
|
|
41
|
+
reducedDim: t4,
|
|
42
|
+
restOpacity: t5,
|
|
43
|
+
pressInMs: t6,
|
|
44
|
+
pressOutMs: t7,
|
|
45
|
+
disabled: t8
|
|
46
|
+
} = t1;
|
|
47
|
+
const scale = t2 === undefined ? 0.97 : t2;
|
|
48
|
+
const dim = t3 === undefined ? 0.7 : t3;
|
|
49
|
+
const reducedDim = t4 === undefined ? dim : t4;
|
|
50
|
+
const restOpacity = t5 === undefined ? 1 : t5;
|
|
51
|
+
const pressInMs = t6 === undefined ? 120 : t6;
|
|
52
|
+
const pressOutMs = t7 === undefined ? 160 : t7;
|
|
53
|
+
const disabled = t8 === undefined ? false : t8;
|
|
54
|
+
const reduceMotion = useReduceMotion();
|
|
55
|
+
const progress = useSharedValue(0);
|
|
56
|
+
const target = reduceMotion ? reducedDim : dim;
|
|
57
|
+
let t9;
|
|
58
|
+
if ($[2] !== pressInMs || $[3] !== progress || $[4] !== reduceMotion) {
|
|
59
|
+
t9 = () => {
|
|
60
|
+
progress.set(reduceMotion ? 1 : withTiming(1, {
|
|
61
|
+
duration: pressInMs,
|
|
62
|
+
easing: EASE_OUT
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
$[2] = pressInMs;
|
|
66
|
+
$[3] = progress;
|
|
67
|
+
$[4] = reduceMotion;
|
|
68
|
+
$[5] = t9;
|
|
69
|
+
} else {
|
|
70
|
+
t9 = $[5];
|
|
71
|
+
}
|
|
72
|
+
const onPressIn = t9;
|
|
73
|
+
let t10;
|
|
74
|
+
if ($[6] !== pressOutMs || $[7] !== progress || $[8] !== reduceMotion) {
|
|
75
|
+
t10 = () => {
|
|
76
|
+
progress.set(reduceMotion ? 0 : withTiming(0, {
|
|
77
|
+
duration: pressOutMs,
|
|
78
|
+
easing: EASE_OUT
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
81
|
+
$[6] = pressOutMs;
|
|
82
|
+
$[7] = progress;
|
|
83
|
+
$[8] = reduceMotion;
|
|
84
|
+
$[9] = t10;
|
|
85
|
+
} else {
|
|
86
|
+
t10 = $[9];
|
|
87
|
+
}
|
|
88
|
+
const onPressOut = t10;
|
|
89
|
+
let t11;
|
|
90
|
+
let t12;
|
|
91
|
+
if ($[10] !== disabled || $[11] !== progress) {
|
|
92
|
+
t11 = () => {
|
|
93
|
+
if (disabled) {
|
|
94
|
+
progress.set(0);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
t12 = [disabled, progress];
|
|
98
|
+
$[10] = disabled;
|
|
99
|
+
$[11] = progress;
|
|
100
|
+
$[12] = t11;
|
|
101
|
+
$[13] = t12;
|
|
102
|
+
} else {
|
|
103
|
+
t11 = $[12];
|
|
104
|
+
t12 = $[13];
|
|
105
|
+
}
|
|
106
|
+
useEffect(t11, t12);
|
|
107
|
+
const style = useAnimatedStyle(() => {
|
|
108
|
+
const p = progress.get();
|
|
109
|
+
return {
|
|
110
|
+
opacity: restOpacity * (1 - p * (1 - target)),
|
|
111
|
+
transform: [{
|
|
112
|
+
scale: reduceMotion ? 1 : 1 - p * (1 - scale)
|
|
113
|
+
}]
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
let t13;
|
|
117
|
+
if ($[14] !== onPressIn || $[15] !== onPressOut || $[16] !== style) {
|
|
118
|
+
t13 = {
|
|
119
|
+
style,
|
|
120
|
+
onPressIn,
|
|
121
|
+
onPressOut
|
|
122
|
+
};
|
|
123
|
+
$[14] = onPressIn;
|
|
124
|
+
$[15] = onPressOut;
|
|
125
|
+
$[16] = style;
|
|
126
|
+
$[17] = t13;
|
|
127
|
+
} else {
|
|
128
|
+
t13 = $[17];
|
|
129
|
+
}
|
|
130
|
+
return t13;
|
|
131
|
+
}
|
|
@@ -6,6 +6,7 @@ import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react-n
|
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { Platform, ScrollView, StyleSheet, Text, View } from "react-native";
|
|
8
8
|
import { FadeIn, FadeOut } from "react-native-reanimated";
|
|
9
|
+
import { EASE_OUT } from "../motion";
|
|
9
10
|
import { NativeOnlyAnimatedView } from "./native-only-animated-view";
|
|
10
11
|
import { SelectHost } from "./select-host";
|
|
11
12
|
import { TextClassContext } from "./text";
|
|
@@ -155,6 +156,9 @@ const SelectTrigger = React.forwardRef((t0, ref) => {
|
|
|
155
156
|
}
|
|
156
157
|
return t8;
|
|
157
158
|
});
|
|
159
|
+
/** The popover fades in and out on the strong ease-out. */
|
|
160
|
+
const SELECT_ENTER = FadeIn.duration(150).easing(EASE_OUT);
|
|
161
|
+
const SELECT_EXIT = FadeOut.duration(100).easing(EASE_OUT);
|
|
158
162
|
const SelectContent = React.forwardRef((t0, ref) => {
|
|
159
163
|
const $ = _c(31);
|
|
160
164
|
let children;
|
|
@@ -252,7 +256,7 @@ const SelectContent = React.forwardRef((t0, ref) => {
|
|
|
252
256
|
}
|
|
253
257
|
let t11;
|
|
254
258
|
if ($[18] !== position || $[19] !== props || $[20] !== ref || $[21] !== t4 || $[22] !== t9) {
|
|
255
|
-
t11 = <SelectPrimitive.Overlay style={overlayFill}><TextClassContext.Provider value="text-popover-foreground"><NativeOnlyAnimatedView entering={
|
|
259
|
+
t11 = <SelectPrimitive.Overlay style={overlayFill}><TextClassContext.Provider value="text-popover-foreground"><NativeOnlyAnimatedView entering={SELECT_ENTER} exiting={SELECT_EXIT} className="z-50" style={overlayFill} pointerEvents={t3}><SelectPrimitive.Content ref={ref} position={position} className={t4} {...props}>{t5}{t6}{t9}{t10}</SelectPrimitive.Content></NativeOnlyAnimatedView></TextClassContext.Provider></SelectPrimitive.Overlay>;
|
|
256
260
|
$[18] = position;
|
|
257
261
|
$[19] = props;
|
|
258
262
|
$[20] = ref;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/native-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, overlays, toasts, settings chrome, tab bar, AI chat parts, the family app marks, a NativeWind preset, the Expo web root and Clerk + Convex auth screens.",
|
|
6
6
|
"type": "module",
|
|
@@ -89,11 +89,6 @@
|
|
|
89
89
|
"source": "./src/entries/bottom-sheet.ts",
|
|
90
90
|
"default": "./dist/entries/bottom-sheet.js"
|
|
91
91
|
},
|
|
92
|
-
"./native-bottom-sheet": {
|
|
93
|
-
"types": "./src/entries/native-bottom-sheet.ts",
|
|
94
|
-
"source": "./src/entries/native-bottom-sheet.ts",
|
|
95
|
-
"default": "./dist/entries/native-bottom-sheet.js"
|
|
96
|
-
},
|
|
97
92
|
"./gesture-handler": {
|
|
98
93
|
"types": "./src/entries/gesture-handler.ts",
|
|
99
94
|
"source": "./src/entries/gesture-handler.ts",
|
|
@@ -191,7 +186,6 @@
|
|
|
191
186
|
"peerDependencies": {
|
|
192
187
|
"@clerk/clerk-expo": "*",
|
|
193
188
|
"@expo/vector-icons": "*",
|
|
194
|
-
"@gorhom/bottom-sheet": ">=5",
|
|
195
189
|
"@json-render/core": ">=0.21.0",
|
|
196
190
|
"@json-render/react-native": ">=0.21.0",
|
|
197
191
|
"@react-native-community/datetimepicker": "*",
|
|
@@ -234,9 +228,6 @@
|
|
|
234
228
|
"@clerk/clerk-expo": {
|
|
235
229
|
"optional": true
|
|
236
230
|
},
|
|
237
|
-
"@gorhom/bottom-sheet": {
|
|
238
|
-
"optional": true
|
|
239
|
-
},
|
|
240
231
|
"@swmansion/react-native-bottom-sheet": {
|
|
241
232
|
"optional": true
|
|
242
233
|
},
|