@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.
@@ -1,10 +1,11 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import * as React from "react";
3
- import { Pressable, useWindowDimensions, View } from "react-native";
3
+ import { useWindowDimensions, View } from "react-native";
4
4
  import { IconSearch, IconX } from "@tabler/icons-react-native";
5
5
  import { Input as PrimitiveInput } from "./primitives/input";
6
6
  import { cn } from "./cn";
7
7
  import { fieldStyle, fieldTextStyle, scaledFieldHeight, searchInputSize, sizeStyle, touchSlop, typeStyle } from "./controlStyles";
8
+ import { AnimatedPressable, usePressScale } from "./pressScale";
8
9
  import { palette } from "./palette";
9
10
  import { tokens } from "./tokens";
10
11
  import { useLargerText } from "./theme";
@@ -30,7 +31,7 @@ export function searchChange(onChange, onClear) {
30
31
  * keyboard is up. The web `shortcut` hint and `toolbar` variant are not ported.
31
32
  */
32
33
  const SearchInput = React.forwardRef((t0, ref) => {
33
- const $ = _c(33);
34
+ const $ = _c(108);
34
35
  let className;
35
36
  let onChange;
36
37
  let onClear;
@@ -93,58 +94,320 @@ const SearchInput = React.forwardRef((t0, ref) => {
93
94
  const {
94
95
  fontScale
95
96
  } = useWindowDimensions();
97
+ let T0;
98
+ let T1;
99
+ let change;
100
+ let filled;
101
+ let metrics;
102
+ let muted;
103
+ let t10;
104
+ let t11;
105
+ let t12;
106
+ let t13;
107
+ let t14;
108
+ let t15;
109
+ let t16;
110
+ let t17;
111
+ let t18;
112
+ let t19;
113
+ let t20;
114
+ let t21;
96
115
  let t4;
97
- if ($[13] !== className || $[14] !== clearLabel || $[15] !== fontScale || $[16] !== label || $[17] !== largerText || $[18] !== onChange || $[19] !== onClear || $[20] !== placeholder || $[21] !== placeholderTextColor || $[22] !== props || $[23] !== ref || $[24] !== scheme || $[25] !== size || $[26] !== style || $[27] !== value || $[28] !== wrapperClassName) {
98
- const metrics = searchInputSize(size, largerText);
99
- let t5;
100
- if ($[30] !== onChange || $[31] !== onClear) {
101
- t5 = searchChange(onChange, onClear);
102
- $[30] = onChange;
103
- $[31] = onClear;
104
- $[32] = t5;
116
+ let t5;
117
+ let t6;
118
+ let t7;
119
+ let t8;
120
+ let t9;
121
+ if ($[13] !== className || $[14] !== fontScale || $[15] !== label || $[16] !== largerText || $[17] !== onChange || $[18] !== onClear || $[19] !== placeholder || $[20] !== placeholderTextColor || $[21] !== ref || $[22] !== scheme || $[23] !== size || $[24] !== value || $[25] !== wrapperClassName) {
122
+ metrics = searchInputSize(size, largerText);
123
+ let t22;
124
+ if ($[50] !== onChange || $[51] !== onClear) {
125
+ t22 = searchChange(onChange, onClear);
126
+ $[50] = onChange;
127
+ $[51] = onClear;
128
+ $[52] = t22;
105
129
  } else {
106
- t5 = $[32];
130
+ t22 = $[52];
107
131
  }
108
- const change = t5;
109
- const filled = value.length > 0;
110
- const muted = tokens.color.muted[scheme];
111
- t4 = <View className={wrapperClassName}><PrimitiveInput ref={ref} value={value} onChangeText={change} accessibilityLabel={label} placeholder={placeholder ?? label} placeholderTextColor={placeholderTextColor ?? palette.fieldPlaceholder[scheme]} returnKeyType="search" className={cn("border font-instrument-sans", metrics.text, largerText && "font-instrument-sans-medium", className)} style={[fieldStyle(scheme), fieldTextStyle(scheme), {
112
- minHeight: metrics.minHeight,
113
- height: scaledFieldHeight(metrics.height, fontScale),
114
- paddingTop: metrics.paddingY,
115
- paddingBottom: metrics.paddingY,
116
- paddingLeft: metrics.paddingLeft,
117
- paddingRight: filled ? metrics.filledPaddingRight : metrics.paddingRight,
118
- fontSize: sizeStyle(metrics.text).fontSize
119
- }, largerText ? typeStyle("medium") : null, style]} {...props} /><View pointerEvents="none" className="absolute bottom-0 top-0 justify-center" style={{
120
- left: metrics.iconLeft
121
- }}><IconSearch size={metrics.icon} color={muted} /></View>{filled && props.editable !== false ? <View pointerEvents="box-none" className="absolute bottom-0 top-0 justify-center" style={{
122
- right: metrics.clearRight
123
- }}><Pressable testID="search-input-clear" accessibilityRole="button" accessibilityLabel={clearLabel} hitSlop={touchSlop(metrics.clear)} onPress={() => change("")} className="items-center justify-center rounded-md active:opacity-70" style={{
124
- width: metrics.clear,
125
- height: metrics.clear
126
- }}><IconX size={metrics.clearIcon} color={muted} strokeWidth={1.75} /></Pressable></View> : null}</View>;
132
+ change = t22;
133
+ filled = value.length > 0;
134
+ muted = tokens.color.muted[scheme];
135
+ T1 = View;
136
+ t21 = wrapperClassName;
137
+ T0 = PrimitiveInput;
138
+ t13 = ref;
139
+ t14 = value;
140
+ t15 = change;
141
+ t16 = label;
142
+ t17 = placeholder ?? label;
143
+ t18 = placeholderTextColor ?? palette.fieldPlaceholder[scheme];
144
+ t19 = "search";
145
+ t20 = cn("border font-instrument-sans", metrics.text, largerText && "font-instrument-sans-medium", className);
146
+ if ($[53] !== scheme) {
147
+ t11 = fieldStyle(scheme);
148
+ $[53] = scheme;
149
+ $[54] = t11;
150
+ } else {
151
+ t11 = $[54];
152
+ }
153
+ if ($[55] !== scheme) {
154
+ t12 = fieldTextStyle(scheme);
155
+ $[55] = scheme;
156
+ $[56] = t12;
157
+ } else {
158
+ t12 = $[56];
159
+ }
160
+ t4 = metrics.minHeight;
161
+ t5 = scaledFieldHeight(metrics.height, fontScale);
162
+ t6 = metrics.paddingY;
163
+ t7 = metrics.paddingY;
164
+ t8 = metrics.paddingLeft;
165
+ t9 = filled ? metrics.filledPaddingRight : metrics.paddingRight;
166
+ t10 = sizeStyle(metrics.text);
127
167
  $[13] = className;
128
- $[14] = clearLabel;
129
- $[15] = fontScale;
130
- $[16] = label;
131
- $[17] = largerText;
132
- $[18] = onChange;
133
- $[19] = onClear;
134
- $[20] = placeholder;
135
- $[21] = placeholderTextColor;
136
- $[22] = props;
137
- $[23] = ref;
138
- $[24] = scheme;
139
- $[25] = size;
140
- $[26] = style;
141
- $[27] = value;
142
- $[28] = wrapperClassName;
143
- $[29] = t4;
144
- } else {
145
- t4 = $[29];
146
- }
147
- return t4;
168
+ $[14] = fontScale;
169
+ $[15] = label;
170
+ $[16] = largerText;
171
+ $[17] = onChange;
172
+ $[18] = onClear;
173
+ $[19] = placeholder;
174
+ $[20] = placeholderTextColor;
175
+ $[21] = ref;
176
+ $[22] = scheme;
177
+ $[23] = size;
178
+ $[24] = value;
179
+ $[25] = wrapperClassName;
180
+ $[26] = T0;
181
+ $[27] = T1;
182
+ $[28] = change;
183
+ $[29] = filled;
184
+ $[30] = metrics;
185
+ $[31] = muted;
186
+ $[32] = t10;
187
+ $[33] = t11;
188
+ $[34] = t12;
189
+ $[35] = t13;
190
+ $[36] = t14;
191
+ $[37] = t15;
192
+ $[38] = t16;
193
+ $[39] = t17;
194
+ $[40] = t18;
195
+ $[41] = t19;
196
+ $[42] = t20;
197
+ $[43] = t21;
198
+ $[44] = t4;
199
+ $[45] = t5;
200
+ $[46] = t6;
201
+ $[47] = t7;
202
+ $[48] = t8;
203
+ $[49] = t9;
204
+ } else {
205
+ T0 = $[26];
206
+ T1 = $[27];
207
+ change = $[28];
208
+ filled = $[29];
209
+ metrics = $[30];
210
+ muted = $[31];
211
+ t10 = $[32];
212
+ t11 = $[33];
213
+ t12 = $[34];
214
+ t13 = $[35];
215
+ t14 = $[36];
216
+ t15 = $[37];
217
+ t16 = $[38];
218
+ t17 = $[39];
219
+ t18 = $[40];
220
+ t19 = $[41];
221
+ t20 = $[42];
222
+ t21 = $[43];
223
+ t4 = $[44];
224
+ t5 = $[45];
225
+ t6 = $[46];
226
+ t7 = $[47];
227
+ t8 = $[48];
228
+ t9 = $[49];
229
+ }
230
+ let t22;
231
+ if ($[57] !== t10.fontSize || $[58] !== t4 || $[59] !== t5 || $[60] !== t6 || $[61] !== t7 || $[62] !== t8 || $[63] !== t9) {
232
+ t22 = {
233
+ minHeight: t4,
234
+ height: t5,
235
+ paddingTop: t6,
236
+ paddingBottom: t7,
237
+ paddingLeft: t8,
238
+ paddingRight: t9,
239
+ fontSize: t10.fontSize
240
+ };
241
+ $[57] = t10.fontSize;
242
+ $[58] = t4;
243
+ $[59] = t5;
244
+ $[60] = t6;
245
+ $[61] = t7;
246
+ $[62] = t8;
247
+ $[63] = t9;
248
+ $[64] = t22;
249
+ } else {
250
+ t22 = $[64];
251
+ }
252
+ let t23;
253
+ if ($[65] !== largerText) {
254
+ t23 = largerText ? typeStyle("medium") : null;
255
+ $[65] = largerText;
256
+ $[66] = t23;
257
+ } else {
258
+ t23 = $[66];
259
+ }
260
+ let t24;
261
+ if ($[67] !== style || $[68] !== t11 || $[69] !== t12 || $[70] !== t22 || $[71] !== t23) {
262
+ t24 = [t11, t12, t22, t23, style];
263
+ $[67] = style;
264
+ $[68] = t11;
265
+ $[69] = t12;
266
+ $[70] = t22;
267
+ $[71] = t23;
268
+ $[72] = t24;
269
+ } else {
270
+ t24 = $[72];
271
+ }
272
+ let t25;
273
+ if ($[73] !== T0 || $[74] !== props || $[75] !== t13 || $[76] !== t14 || $[77] !== t15 || $[78] !== t16 || $[79] !== t17 || $[80] !== t18 || $[81] !== t19 || $[82] !== t20 || $[83] !== t24) {
274
+ t25 = <T0 ref={t13} value={t14} onChangeText={t15} accessibilityLabel={t16} placeholder={t17} placeholderTextColor={t18} returnKeyType={t19} className={t20} style={t24} {...props} />;
275
+ $[73] = T0;
276
+ $[74] = props;
277
+ $[75] = t13;
278
+ $[76] = t14;
279
+ $[77] = t15;
280
+ $[78] = t16;
281
+ $[79] = t17;
282
+ $[80] = t18;
283
+ $[81] = t19;
284
+ $[82] = t20;
285
+ $[83] = t24;
286
+ $[84] = t25;
287
+ } else {
288
+ t25 = $[84];
289
+ }
290
+ let t26;
291
+ if ($[85] !== metrics.iconLeft) {
292
+ t26 = {
293
+ left: metrics.iconLeft
294
+ };
295
+ $[85] = metrics.iconLeft;
296
+ $[86] = t26;
297
+ } else {
298
+ t26 = $[86];
299
+ }
300
+ let t27;
301
+ if ($[87] !== metrics.icon || $[88] !== muted) {
302
+ t27 = <IconSearch size={metrics.icon} color={muted} />;
303
+ $[87] = metrics.icon;
304
+ $[88] = muted;
305
+ $[89] = t27;
306
+ } else {
307
+ t27 = $[89];
308
+ }
309
+ let t28;
310
+ if ($[90] !== t26 || $[91] !== t27) {
311
+ t28 = <View pointerEvents="none" className="absolute bottom-0 top-0 justify-center" style={t26}>{t27}</View>;
312
+ $[90] = t26;
313
+ $[91] = t27;
314
+ $[92] = t28;
315
+ } else {
316
+ t28 = $[92];
317
+ }
318
+ let t29;
319
+ if ($[93] !== change || $[94] !== clearLabel || $[95] !== filled || $[96] !== metrics.clear || $[97] !== metrics.clearIcon || $[98] !== metrics.clearRight || $[99] !== muted || $[100] !== props) {
320
+ t29 = filled && props.editable !== false ? <View pointerEvents="box-none" className="absolute bottom-0 top-0 justify-center" style={{
321
+ right: metrics.clearRight
322
+ }}><ClearButton label={clearLabel} size={metrics.clear} iconSize={metrics.clearIcon} color={muted} onPress={() => change("")} /></View> : null;
323
+ $[93] = change;
324
+ $[94] = clearLabel;
325
+ $[95] = filled;
326
+ $[96] = metrics.clear;
327
+ $[97] = metrics.clearIcon;
328
+ $[98] = metrics.clearRight;
329
+ $[99] = muted;
330
+ $[100] = props;
331
+ $[101] = t29;
332
+ } else {
333
+ t29 = $[101];
334
+ }
335
+ let t30;
336
+ if ($[102] !== T1 || $[103] !== t21 || $[104] !== t25 || $[105] !== t28 || $[106] !== t29) {
337
+ t30 = <T1 className={t21}>{t25}{t28}{t29}</T1>;
338
+ $[102] = T1;
339
+ $[103] = t21;
340
+ $[104] = t25;
341
+ $[105] = t28;
342
+ $[106] = t29;
343
+ $[107] = t30;
344
+ } else {
345
+ t30 = $[107];
346
+ }
347
+ return t30;
148
348
  });
149
349
  SearchInput.displayName = "SearchInput";
350
+ function ClearButton(t0) {
351
+ const $ = _c(18);
352
+ const {
353
+ label,
354
+ size,
355
+ iconSize,
356
+ color,
357
+ onPress
358
+ } = t0;
359
+ const press = usePressScale();
360
+ let t1;
361
+ if ($[0] !== size) {
362
+ t1 = touchSlop(size);
363
+ $[0] = size;
364
+ $[1] = t1;
365
+ } else {
366
+ t1 = $[1];
367
+ }
368
+ let t2;
369
+ if ($[2] !== size) {
370
+ t2 = {
371
+ width: size,
372
+ height: size
373
+ };
374
+ $[2] = size;
375
+ $[3] = t2;
376
+ } else {
377
+ t2 = $[3];
378
+ }
379
+ let t3;
380
+ if ($[4] !== press.style || $[5] !== t2) {
381
+ t3 = [t2, press.style];
382
+ $[4] = press.style;
383
+ $[5] = t2;
384
+ $[6] = t3;
385
+ } else {
386
+ t3 = $[6];
387
+ }
388
+ let t4;
389
+ if ($[7] !== color || $[8] !== iconSize) {
390
+ t4 = <IconX size={iconSize} color={color} strokeWidth={1.75} />;
391
+ $[7] = color;
392
+ $[8] = iconSize;
393
+ $[9] = t4;
394
+ } else {
395
+ t4 = $[9];
396
+ }
397
+ let t5;
398
+ if ($[10] !== label || $[11] !== onPress || $[12] !== press.onPressIn || $[13] !== press.onPressOut || $[14] !== t1 || $[15] !== t3 || $[16] !== t4) {
399
+ t5 = <AnimatedPressable testID="search-input-clear" accessibilityRole="button" accessibilityLabel={label} hitSlop={t1} onPress={onPress} onPressIn={press.onPressIn} onPressOut={press.onPressOut} className="items-center justify-center rounded-md" style={t3}>{t4}</AnimatedPressable>;
400
+ $[10] = label;
401
+ $[11] = onPress;
402
+ $[12] = press.onPressIn;
403
+ $[13] = press.onPressOut;
404
+ $[14] = t1;
405
+ $[15] = t3;
406
+ $[16] = t4;
407
+ $[17] = t5;
408
+ } else {
409
+ t5 = $[17];
410
+ }
411
+ return t5;
412
+ }
150
413
  export { SearchInput };
package/dist/Sheet.jsx CHANGED
@@ -11,7 +11,7 @@ import { SheetDragView } from "./primitives/sheet-drag";
11
11
  import { OverlayClose, OverlayModal, OverlayRoot, OverlayTrigger } from "./primitives/overlay";
12
12
  const SHEET_RADIUS = tokens.radius.card;
13
13
  /**
14
- * Bottom sheet in an RN `Modal`, with no `@gorhom/bottom-sheet`. Same open
14
+ * Bottom sheet in an RN `Modal`, with no bottom-sheet library. Same open
15
15
  * state API as `Dialog`.
16
16
  */
17
17
  export function Sheet(props) {