glacia-native 0.5.1 → 0.5.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/LICENSE +29 -4
- package/README.md +27 -0
- package/lib/module/Bars.js +10 -9
- package/lib/module/Button.js +11 -8
- package/lib/module/Card.js +2 -2
- package/lib/module/Dialog.js +16 -17
- package/lib/module/Display.js +8 -7
- package/lib/module/Feedback.js +24 -15
- package/lib/module/Form.js +29 -33
- package/lib/module/Forms2.js +38 -21
- package/lib/module/Glass.js +2 -2
- package/lib/module/Input.js +12 -10
- package/lib/module/Message.js +11 -15
- package/lib/module/Overlays.js +22 -6
- package/lib/module/Pickers.js +16 -16
- package/lib/module/SegmentedControl.js +19 -10
- package/lib/module/Slider.js +18 -9
- package/lib/module/Switch.js +21 -9
- package/lib/module/TabBar.js +18 -12
- package/lib/module/Table.js +4 -3
- package/lib/module/Tabs.js +3 -2
- package/lib/module/ai.js +18 -15
- package/lib/module/charts/BarChart.js +11 -3
- package/lib/module/internal/GlassView.js +2 -2
- package/lib/module/internal/blur.js +78 -0
- package/lib/module/internal/fallback.js +110 -20
- package/lib/module/internal/glow.js +36 -0
- package/lib/module/internal/lens.js +70 -0
- package/lib/module/internal/material.js +64 -0
- package/lib/module/internal/primitives.js +1 -0
- package/lib/module/internal/rim.js +35 -0
- package/lib/module/internal/tokens.js +34 -2
- package/lib/typescript/Message.d.ts +5 -9
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/internal/GlassView.d.ts +13 -0
- package/lib/typescript/internal/blur.d.ts +24 -0
- package/lib/typescript/internal/fallback.d.ts +27 -2
- package/lib/typescript/internal/glow.d.ts +11 -0
- package/lib/typescript/internal/lens.d.ts +47 -0
- package/lib/typescript/internal/material.d.ts +27 -0
- package/lib/typescript/internal/primitives.d.ts +2 -0
- package/lib/typescript/internal/rim.d.ts +16 -0
- package/lib/typescript/internal/tokens.d.ts +36 -0
- package/package.json +12 -3
- package/src/Bars.tsx +12 -2
- package/src/Button.tsx +16 -9
- package/src/Card.tsx +2 -2
- package/src/Dialog.tsx +37 -26
- package/src/Display.tsx +8 -5
- package/src/Feedback.tsx +36 -13
- package/src/Form.tsx +60 -40
- package/src/Forms2.tsx +65 -24
- package/src/Glass.tsx +4 -0
- package/src/Input.tsx +15 -11
- package/src/Message.tsx +15 -16
- package/src/Overlays.tsx +25 -6
- package/src/Pickers.tsx +11 -6
- package/src/SegmentedControl.tsx +33 -9
- package/src/Slider.tsx +19 -10
- package/src/Switch.tsx +24 -10
- package/src/TabBar.tsx +33 -12
- package/src/Table.tsx +4 -3
- package/src/Tabs.tsx +5 -0
- package/src/ai.tsx +28 -20
- package/src/charts/BarChart.tsx +41 -3
- package/src/index.ts +1 -0
- package/src/internal/GlassView.tsx +17 -0
- package/src/internal/blur.ts +90 -0
- package/src/internal/fallback.tsx +158 -20
- package/src/internal/glow.tsx +62 -0
- package/src/internal/lens.tsx +105 -0
- package/src/internal/material.ts +92 -0
- package/src/internal/primitives.ts +3 -0
- package/src/internal/rim.tsx +79 -0
- package/src/internal/tokens.ts +34 -1
package/src/Form.tsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { forwardRef, useState, type ReactNode } from "react";
|
|
2
2
|
import type { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
|
+
import { Glass } from "./Glass";
|
|
4
5
|
import { colors, radii } from "./internal/tokens";
|
|
5
6
|
import { primitives } from "./internal/primitives";
|
|
6
7
|
import { useIsDark } from "./internal/motion";
|
|
8
|
+
import { SelectedLens, lensFill } from "./internal/lens";
|
|
7
9
|
|
|
8
10
|
export interface LabelProps {
|
|
9
11
|
children?: ReactNode;
|
|
@@ -35,7 +37,7 @@ export const Label = forwardRef<any, LabelProps>(function Label(
|
|
|
35
37
|
accessibilityRole="text"
|
|
36
38
|
style={{
|
|
37
39
|
fontSize: 13,
|
|
38
|
-
fontWeight: "
|
|
40
|
+
fontWeight: "500",
|
|
39
41
|
color: disabled ? theme.muted : theme.foreground,
|
|
40
42
|
opacity: disabled ? 0.6 : 1,
|
|
41
43
|
...(style as TextStyle),
|
|
@@ -80,7 +82,7 @@ export function Field({
|
|
|
80
82
|
const message = error ?? description;
|
|
81
83
|
|
|
82
84
|
return (
|
|
83
|
-
<View style={{ gap:
|
|
85
|
+
<View style={{ gap: 7, ...(style as ViewStyle) }}>
|
|
84
86
|
{label && (
|
|
85
87
|
<Label required={required} disabled={disabled} isDark={isDark}>
|
|
86
88
|
{label}
|
|
@@ -93,7 +95,7 @@ export function Field({
|
|
|
93
95
|
<Text
|
|
94
96
|
accessibilityRole={error ? "alert" : "text"}
|
|
95
97
|
style={{
|
|
96
|
-
fontSize:
|
|
98
|
+
fontSize: 12,
|
|
97
99
|
color: error ? theme.destructive : theme.muted,
|
|
98
100
|
}}
|
|
99
101
|
>
|
|
@@ -165,28 +167,28 @@ export function Checkbox({
|
|
|
165
167
|
...(style as ViewStyle),
|
|
166
168
|
}}
|
|
167
169
|
>
|
|
168
|
-
<
|
|
170
|
+
<Glass
|
|
171
|
+
surface="control"
|
|
172
|
+
isDark={isDark}
|
|
169
173
|
style={{
|
|
170
174
|
width: 20,
|
|
171
175
|
height: 20,
|
|
172
176
|
borderRadius: 6,
|
|
173
|
-
|
|
174
|
-
borderColor: theme.edge,
|
|
175
|
-
backgroundColor: filled ? theme.fill : "transparent",
|
|
177
|
+
backgroundColor: filled ? theme.fill : undefined,
|
|
176
178
|
alignItems: "center",
|
|
177
179
|
justifyContent: "center",
|
|
178
180
|
marginTop: 1,
|
|
179
181
|
}}
|
|
180
182
|
>
|
|
181
183
|
{indeterminate ? (
|
|
182
|
-
<View style={{ width: 10, height: 2, borderRadius: 1, backgroundColor:
|
|
184
|
+
<View style={{ width: 10, height: 2, borderRadius: 1, backgroundColor: theme.onTint }} />
|
|
183
185
|
) : checked ? (
|
|
184
186
|
// A glyph rather than an icon dependency: one text node, no package.
|
|
185
|
-
<Text style={{ color:
|
|
187
|
+
<Text style={{ color: theme.onTint, fontSize: 12, fontWeight: "700", lineHeight: 14 }}>
|
|
186
188
|
✓
|
|
187
189
|
</Text>
|
|
188
190
|
) : null}
|
|
189
|
-
</
|
|
191
|
+
</Glass>
|
|
190
192
|
|
|
191
193
|
{(label || description) && (
|
|
192
194
|
<View style={{ flex: 1 }}>
|
|
@@ -194,7 +196,7 @@ export function Checkbox({
|
|
|
194
196
|
<Text style={{ fontSize: 14, color: theme.foreground, fontWeight: "500" }}>{label}</Text>
|
|
195
197
|
)}
|
|
196
198
|
{description && (
|
|
197
|
-
<Text style={{ fontSize:
|
|
199
|
+
<Text style={{ fontSize: 12, color: theme.muted, marginTop: 2 }}>{description}</Text>
|
|
198
200
|
)}
|
|
199
201
|
</View>
|
|
200
202
|
)}
|
|
@@ -279,20 +281,32 @@ export function RadioGroup({
|
|
|
279
281
|
opacity: isDisabled ? 0.45 : 1,
|
|
280
282
|
}}
|
|
281
283
|
>
|
|
282
|
-
|
|
284
|
+
{/* A glass circle with a white dot when chosen, rather than a
|
|
285
|
+
border that grows: the web draws the dot, and a thickening
|
|
286
|
+
border reads as a different control. */}
|
|
287
|
+
<Glass
|
|
288
|
+
surface="control"
|
|
289
|
+
isDark={isDark}
|
|
283
290
|
style={{
|
|
284
291
|
width: 20,
|
|
285
292
|
height: 20,
|
|
286
293
|
borderRadius: 10,
|
|
287
|
-
|
|
288
|
-
|
|
294
|
+
backgroundColor: isSelected ? theme.fill : undefined,
|
|
295
|
+
alignItems: "center",
|
|
296
|
+
justifyContent: "center",
|
|
289
297
|
marginTop: 1,
|
|
290
298
|
}}
|
|
291
|
-
|
|
299
|
+
>
|
|
300
|
+
{isSelected ? (
|
|
301
|
+
<View
|
|
302
|
+
style={{ width: 8, height: 8, borderRadius: 4, backgroundColor: theme.onTint }}
|
|
303
|
+
/>
|
|
304
|
+
) : null}
|
|
305
|
+
</Glass>
|
|
292
306
|
<View style={{ flex: 1 }}>
|
|
293
307
|
<Text style={{ fontSize: 14, color: theme.foreground }}>{option.label}</Text>
|
|
294
308
|
{option.description && (
|
|
295
|
-
<Text style={{ fontSize:
|
|
309
|
+
<Text style={{ fontSize: 12, color: theme.muted, marginTop: 2 }}>
|
|
296
310
|
{option.description}
|
|
297
311
|
</Text>
|
|
298
312
|
)}
|
|
@@ -366,34 +380,36 @@ export function Select({
|
|
|
366
380
|
accessibilityLabel={selected?.label ?? placeholder}
|
|
367
381
|
disabled={disabled}
|
|
368
382
|
onPress={() => setOpen(!open)}
|
|
369
|
-
style={{
|
|
370
|
-
minHeight: 42,
|
|
371
|
-
flexDirection: "row",
|
|
372
|
-
alignItems: "center",
|
|
373
|
-
justifyContent: "space-between",
|
|
374
|
-
paddingHorizontal: 12,
|
|
375
|
-
borderRadius: radii.md,
|
|
376
|
-
borderWidth: 1,
|
|
377
|
-
borderColor: theme.edge,
|
|
378
|
-
backgroundColor: theme.glass,
|
|
379
|
-
opacity: disabled ? 0.5 : 1,
|
|
380
|
-
}}
|
|
383
|
+
style={{ opacity: disabled ? 0.5 : 1 }}
|
|
381
384
|
>
|
|
382
|
-
<
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
385
|
+
<Glass
|
|
386
|
+
surface="field"
|
|
387
|
+
isDark={isDark}
|
|
388
|
+
style={{
|
|
389
|
+
minHeight: 34,
|
|
390
|
+
flexDirection: "row",
|
|
391
|
+
alignItems: "center",
|
|
392
|
+
justifyContent: "space-between",
|
|
393
|
+
paddingHorizontal: 14,
|
|
394
|
+
}}
|
|
395
|
+
>
|
|
396
|
+
<Text style={{ fontSize: 15, color: selected ? theme.foreground : theme.muted }}>
|
|
397
|
+
{selected?.label ?? placeholder}
|
|
398
|
+
</Text>
|
|
399
|
+
<Text style={{ fontSize: 10, color: theme.muted }}>{open ? "▲" : "▼"}</Text>
|
|
400
|
+
</Glass>
|
|
386
401
|
</Pressable>
|
|
387
402
|
|
|
388
403
|
{open && (
|
|
389
|
-
<
|
|
404
|
+
<Glass
|
|
405
|
+
surface="overlay"
|
|
406
|
+
isDark={isDark}
|
|
390
407
|
style={{
|
|
391
408
|
marginTop: 6,
|
|
392
409
|
borderRadius: radii.md,
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
overflow: "hidden",
|
|
410
|
+
shadowOpacity: 0.12,
|
|
411
|
+
shadowRadius: 30,
|
|
412
|
+
shadowOffset: { width: 0, height: 10 },
|
|
397
413
|
}}
|
|
398
414
|
>
|
|
399
415
|
{options.map((option) => {
|
|
@@ -409,16 +425,20 @@ export function Select({
|
|
|
409
425
|
setOpen(false);
|
|
410
426
|
}}
|
|
411
427
|
style={{
|
|
412
|
-
|
|
428
|
+
minHeight: 32,
|
|
413
429
|
paddingHorizontal: 12,
|
|
414
|
-
|
|
430
|
+
borderRadius: 10,
|
|
431
|
+
backgroundColor: "transparent",
|
|
415
432
|
}}
|
|
416
433
|
>
|
|
434
|
+
{isSelected ? (
|
|
435
|
+
<SelectedLens radius={10} isDark={isDark} style={lensFill} />
|
|
436
|
+
) : null}
|
|
417
437
|
<Text style={{ fontSize: 14, color: theme.foreground }}>{option.label}</Text>
|
|
418
438
|
</Pressable>
|
|
419
439
|
);
|
|
420
440
|
})}
|
|
421
|
-
</
|
|
441
|
+
</Glass>
|
|
422
442
|
)}
|
|
423
443
|
</View>
|
|
424
444
|
);
|
package/src/Forms2.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import { Text } from "./Text";
|
|
|
6
6
|
import { colors, controlSizes, palette as tokenPalette, radii } from "./internal/tokens";
|
|
7
7
|
import { primitives } from "./internal/primitives";
|
|
8
8
|
import { useIsDark } from "./internal/motion";
|
|
9
|
+
import { SelectedLens, lensFill } from "./internal/lens";
|
|
9
10
|
|
|
10
11
|
// ---------------------------------------------------------------------------
|
|
11
12
|
// Stepper
|
|
@@ -82,9 +83,9 @@ export const Stepper = forwardRef<any, StepperProps>(function Stepper(
|
|
|
82
83
|
accessibilityState={{ disabled: disabled || blocked }}
|
|
83
84
|
disabled={disabled || blocked}
|
|
84
85
|
onPress={action}
|
|
85
|
-
style={{ width:
|
|
86
|
+
style={{ width: 46, height: 34, alignItems: "center", justifyContent: "center", opacity: disabled || blocked ? 0.38 : 1 }}
|
|
86
87
|
>
|
|
87
|
-
<RNText style={{ fontSize:
|
|
88
|
+
<RNText style={{ fontSize: 17, fontWeight: "500", color: theme.foreground, lineHeight: 20 }}>
|
|
88
89
|
{sign}
|
|
89
90
|
</RNText>
|
|
90
91
|
</Pressable>
|
|
@@ -94,6 +95,7 @@ export const Stepper = forwardRef<any, StepperProps>(function Stepper(
|
|
|
94
95
|
<Glass
|
|
95
96
|
ref={ref}
|
|
96
97
|
effect="regular"
|
|
98
|
+
surface="control"
|
|
97
99
|
isDark={isDark}
|
|
98
100
|
testID={testID}
|
|
99
101
|
accessibilityRole="adjustable"
|
|
@@ -108,6 +110,7 @@ export const Stepper = forwardRef<any, StepperProps>(function Stepper(
|
|
|
108
110
|
flexDirection: "row",
|
|
109
111
|
alignItems: "center",
|
|
110
112
|
alignSelf: "flex-start",
|
|
113
|
+
height: 34,
|
|
111
114
|
borderRadius: radii.pill,
|
|
112
115
|
paddingHorizontal: 2,
|
|
113
116
|
opacity: disabled ? 0.38 : 1,
|
|
@@ -148,7 +151,7 @@ export interface ToggleProps {
|
|
|
148
151
|
testID?: string;
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
const toggleSizes = { sm: 30, md:
|
|
154
|
+
const toggleSizes = { sm: 30, md: 34, lg: 44 };
|
|
152
155
|
|
|
153
156
|
/**
|
|
154
157
|
* A button that stays pressed.
|
|
@@ -185,6 +188,8 @@ export const Toggle = forwardRef<any, ToggleProps>(function Toggle(
|
|
|
185
188
|
const [internal, setInternal] = useState(defaultPressed);
|
|
186
189
|
const isPressed = controlled !== undefined ? controlled : internal;
|
|
187
190
|
|
|
191
|
+
const [held, setHeld] = useState(false);
|
|
192
|
+
|
|
188
193
|
const dimension = toggleSizes[size];
|
|
189
194
|
|
|
190
195
|
const handlePress = () => {
|
|
@@ -202,11 +207,15 @@ export const Toggle = forwardRef<any, ToggleProps>(function Toggle(
|
|
|
202
207
|
accessibilityState={{ selected: isPressed, disabled }}
|
|
203
208
|
disabled={disabled}
|
|
204
209
|
onPress={handlePress}
|
|
210
|
+
onPressIn={() => setHeld(true)}
|
|
211
|
+
onPressOut={() => setHeld(false)}
|
|
205
212
|
style={({ pressed }: { pressed: boolean }) => ({ alignSelf: "flex-start", opacity: disabled ? 0.38 : pressed ? 0.8 : 1 })}
|
|
206
213
|
{...props}
|
|
207
214
|
>
|
|
208
215
|
<Glass
|
|
209
216
|
effect={variant === "ghost" ? "none" : "regular"}
|
|
217
|
+
surface="control"
|
|
218
|
+
pressed={held}
|
|
210
219
|
interactive={!disabled && variant !== "ghost"}
|
|
211
220
|
isDark={isDark}
|
|
212
221
|
tintColor={isPressed && variant !== "ghost" ? theme.glassActive : undefined}
|
|
@@ -228,7 +237,7 @@ export const Toggle = forwardRef<any, ToggleProps>(function Toggle(
|
|
|
228
237
|
<RNText
|
|
229
238
|
numberOfLines={1}
|
|
230
239
|
style={{
|
|
231
|
-
fontSize: size === "sm" ? 12 : size === "lg" ? 15 :
|
|
240
|
+
fontSize: size === "sm" ? 12 : size === "lg" ? 15 : 14,
|
|
232
241
|
fontWeight: isPressed ? "600" : "500",
|
|
233
242
|
color: isPressed ? theme.foreground : theme.muted,
|
|
234
243
|
}}
|
|
@@ -322,6 +331,7 @@ export const ToggleGroup = forwardRef<any, ToggleGroupProps>(function ToggleGrou
|
|
|
322
331
|
<Glass
|
|
323
332
|
ref={ref}
|
|
324
333
|
effect="regular"
|
|
334
|
+
surface="control"
|
|
325
335
|
isDark={isDark}
|
|
326
336
|
testID={testID}
|
|
327
337
|
accessibilityRole="radiogroup"
|
|
@@ -333,6 +343,12 @@ export const ToggleGroup = forwardRef<any, ToggleGroupProps>(function ToggleGrou
|
|
|
333
343
|
padding: 3,
|
|
334
344
|
gap: 3,
|
|
335
345
|
borderRadius: radii.pill,
|
|
346
|
+
// The web makes the group's own surface near-solid for legibility; the
|
|
347
|
+
// selected item is the glass lens on top of it.
|
|
348
|
+
backgroundColor: theme.surface,
|
|
349
|
+
shadowOpacity: 0.08,
|
|
350
|
+
shadowRadius: 8,
|
|
351
|
+
shadowOffset: { width: 0, height: 2 },
|
|
336
352
|
...(style as ViewStyle),
|
|
337
353
|
}}
|
|
338
354
|
{...props}
|
|
@@ -358,11 +374,11 @@ export const ToggleGroup = forwardRef<any, ToggleGroupProps>(function ToggleGrou
|
|
|
358
374
|
alignItems: "center",
|
|
359
375
|
justifyContent: "center",
|
|
360
376
|
gap: 6,
|
|
361
|
-
backgroundColor:
|
|
362
|
-
borderWidth: on ? 0.5 : 0,
|
|
363
|
-
borderColor: theme.edge,
|
|
377
|
+
backgroundColor: "transparent",
|
|
364
378
|
}}
|
|
365
379
|
>
|
|
380
|
+
{/* The chosen item is a lens; the group's rail is the glass. */}
|
|
381
|
+
{on ? <SelectedLens radius={radii.pill} isDark={isDark} style={lensFill} /> : null}
|
|
366
382
|
{item.icon ? <View>{item.icon}</View> : null}
|
|
367
383
|
<RNText
|
|
368
384
|
numberOfLines={1}
|
|
@@ -453,6 +469,7 @@ export const InputOTP = forwardRef<any, InputOTPProps>(function InputOTP(
|
|
|
453
469
|
<Glass
|
|
454
470
|
key={index}
|
|
455
471
|
effect="regular"
|
|
472
|
+
surface="field"
|
|
456
473
|
isDark={isDark}
|
|
457
474
|
tintColor={isActive ? theme.glassActive : undefined}
|
|
458
475
|
style={{
|
|
@@ -582,6 +599,7 @@ export const ButtonGroup = forwardRef<any, ButtonGroupProps>(function ButtonGrou
|
|
|
582
599
|
>
|
|
583
600
|
<Glass
|
|
584
601
|
effect="regular"
|
|
602
|
+
surface="control"
|
|
585
603
|
interactive={!item.disabled}
|
|
586
604
|
isDark={isDark}
|
|
587
605
|
style={{
|
|
@@ -959,25 +977,45 @@ export const Combobox = forwardRef<any, ComboboxProps>(function Combobox(
|
|
|
959
977
|
|
|
960
978
|
return (
|
|
961
979
|
<View ref={ref} testID={testID} style={{ ...(style as ViewStyle) }}>
|
|
962
|
-
<
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
placeholder={placeholder}
|
|
966
|
-
accessibilityLabel={label ?? placeholder}
|
|
967
|
-
accessibilityState={{ disabled }}
|
|
968
|
-
editable={!disabled}
|
|
980
|
+
<Glass
|
|
981
|
+
surface="field"
|
|
982
|
+
isDark={isDark}
|
|
969
983
|
style={{
|
|
970
|
-
|
|
971
|
-
paddingHorizontal:
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
color: theme.foreground,
|
|
975
|
-
backgroundColor: disabled ? theme.muted : theme.fieldWash,
|
|
984
|
+
minHeight: 34,
|
|
985
|
+
paddingHorizontal: 14,
|
|
986
|
+
justifyContent: "center",
|
|
987
|
+
opacity: disabled ? 0.5 : 1,
|
|
976
988
|
}}
|
|
977
|
-
|
|
989
|
+
>
|
|
990
|
+
<TextInput
|
|
991
|
+
value={query}
|
|
992
|
+
onChangeText={(text: string) => setQuery(text)}
|
|
993
|
+
placeholder={placeholder}
|
|
994
|
+
accessibilityLabel={label ?? placeholder}
|
|
995
|
+
accessibilityState={{ disabled }}
|
|
996
|
+
editable={!disabled}
|
|
997
|
+
style={{
|
|
998
|
+
paddingVertical: 8,
|
|
999
|
+
fontSize: 15,
|
|
1000
|
+
color: theme.foreground,
|
|
1001
|
+
}}
|
|
1002
|
+
/>
|
|
1003
|
+
</Glass>
|
|
978
1004
|
{/* The dropdown: opens once there is something to match. */}
|
|
979
1005
|
{query.length > 0 ? (
|
|
980
|
-
<
|
|
1006
|
+
<Glass
|
|
1007
|
+
surface="overlay"
|
|
1008
|
+
isDark={isDark}
|
|
1009
|
+
style={{
|
|
1010
|
+
marginTop: 6,
|
|
1011
|
+
borderRadius: radii.md,
|
|
1012
|
+
// The web dropdown floats on its own shadow rather than sitting
|
|
1013
|
+
// flush on the page.
|
|
1014
|
+
shadowOpacity: 0.4,
|
|
1015
|
+
shadowRadius: 32,
|
|
1016
|
+
shadowOffset: { width: 0, height: 12 },
|
|
1017
|
+
}}
|
|
1018
|
+
>
|
|
981
1019
|
{matches.length === 0 ? (
|
|
982
1020
|
<View style={{ paddingHorizontal: 12, paddingVertical: 10 }}>
|
|
983
1021
|
<RNText style={{ fontSize: 14, color: theme.muted }}>No matches</RNText>
|
|
@@ -995,8 +1033,11 @@ export const Combobox = forwardRef<any, ComboboxProps>(function Combobox(
|
|
|
995
1033
|
setValue(option.value);
|
|
996
1034
|
setQuery("");
|
|
997
1035
|
}}
|
|
998
|
-
style={{ flexDirection: "row", alignItems: "center", paddingHorizontal: 12, paddingVertical: 10, backgroundColor:
|
|
1036
|
+
style={{ flexDirection: "row", alignItems: "center", paddingHorizontal: 12, paddingVertical: 10, backgroundColor: "transparent" }}
|
|
999
1037
|
>
|
|
1038
|
+
{isSelected ? (
|
|
1039
|
+
<SelectedLens radius={8} isDark={isDark} style={lensFill} />
|
|
1040
|
+
) : null}
|
|
1000
1041
|
<View style={{ flex: 1 }}>
|
|
1001
1042
|
<RNText style={{ fontSize: 15, color: theme.foreground }}>{option.label}</RNText>
|
|
1002
1043
|
{option.description ? (
|
|
@@ -1007,7 +1048,7 @@ export const Combobox = forwardRef<any, ComboboxProps>(function Combobox(
|
|
|
1007
1048
|
);
|
|
1008
1049
|
})
|
|
1009
1050
|
)}
|
|
1010
|
-
</
|
|
1051
|
+
</Glass>
|
|
1011
1052
|
) : null}
|
|
1012
1053
|
</View>
|
|
1013
1054
|
);
|
package/src/Glass.tsx
CHANGED
|
@@ -21,6 +21,8 @@ export const Glass = forwardRef<any, GlassProps>(function Glass(
|
|
|
21
21
|
effect = "regular",
|
|
22
22
|
tintColor,
|
|
23
23
|
interactive = false,
|
|
24
|
+
surface,
|
|
25
|
+
pressed,
|
|
24
26
|
testID,
|
|
25
27
|
style,
|
|
26
28
|
children,
|
|
@@ -36,6 +38,8 @@ export const Glass = forwardRef<any, GlassProps>(function Glass(
|
|
|
36
38
|
effect={effect}
|
|
37
39
|
tintColor={tintColor}
|
|
38
40
|
interactive={interactive}
|
|
41
|
+
surface={surface}
|
|
42
|
+
pressed={pressed}
|
|
39
43
|
testID={testID}
|
|
40
44
|
isDark={isDark}
|
|
41
45
|
style={style}
|
package/src/Input.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { forwardRef, useState, type ReactNode } from "react";
|
|
2
2
|
import type { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
|
+
import { Glass } from "./Glass";
|
|
4
5
|
import { colors, radii } from "./internal/tokens";
|
|
5
6
|
import { primitives } from "./internal/primitives";
|
|
6
7
|
import { useIsDark } from "./internal/motion";
|
|
@@ -38,7 +39,7 @@ export interface InputProps {
|
|
|
38
39
|
onBlur?: () => void;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
const heights = { sm:
|
|
42
|
+
const heights = { sm: 28, md: 34, lg: 44 };
|
|
42
43
|
const fontSizes = { sm: 14, md: 15, lg: 16 };
|
|
43
44
|
|
|
44
45
|
/**
|
|
@@ -100,24 +101,27 @@ export const Input = forwardRef<any, InputProps>(function Input(
|
|
|
100
101
|
|
|
101
102
|
const fieldStyle: TextStyle = {
|
|
102
103
|
flex: 1,
|
|
103
|
-
paddingVertical: height_padding(size),
|
|
104
|
+
paddingVertical: multiline ? 0 : height_padding(size),
|
|
104
105
|
paddingHorizontal: 0,
|
|
105
106
|
fontSize: fontSizes[size],
|
|
106
107
|
color: theme.foreground,
|
|
107
108
|
};
|
|
108
109
|
|
|
109
110
|
return (
|
|
110
|
-
<
|
|
111
|
+
<Glass
|
|
112
|
+
surface="field"
|
|
113
|
+
isDark={isDark}
|
|
111
114
|
style={{
|
|
112
115
|
flexDirection: "row",
|
|
113
116
|
alignItems: multiline ? "flex-start" : "center",
|
|
114
117
|
gap: 8,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
// Fields are pills on the web; a multi-line field relaxes to the
|
|
119
|
+
// stack radius (18) because a pill around wrapped text reads wrong.
|
|
120
|
+
borderRadius: multiline ? 18 : radii.pill,
|
|
121
|
+
minHeight: multiline ? 84 : heights[size],
|
|
122
|
+
paddingHorizontal: 14,
|
|
123
|
+
paddingVertical: multiline ? 10 : 0,
|
|
124
|
+
borderColor: invalid ? theme.destructive : undefined,
|
|
121
125
|
opacity: disabled ? 0.5 : 1,
|
|
122
126
|
...(style as ViewStyle),
|
|
123
127
|
}}
|
|
@@ -165,13 +169,13 @@ export const Input = forwardRef<any, InputProps>(function Input(
|
|
|
165
169
|
</View>
|
|
166
170
|
|
|
167
171
|
{suffix}
|
|
168
|
-
</
|
|
172
|
+
</Glass>
|
|
169
173
|
);
|
|
170
174
|
});
|
|
171
175
|
|
|
172
176
|
/** Vertical padding tuned per size so the text sits optically centred. */
|
|
173
177
|
function height_padding(size: "sm" | "md" | "lg") {
|
|
174
|
-
return size === "sm" ?
|
|
178
|
+
return size === "sm" ? 4 : size === "lg" ? 10 : 7;
|
|
175
179
|
}
|
|
176
180
|
|
|
177
181
|
export interface TextareaProps extends Omit<InputProps, "size" | "multiline" | "minLines"> {
|
package/src/Message.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { forwardRef, type ReactNode } from "react";
|
|
|
2
2
|
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { Avatar } from "./Display";
|
|
5
|
+
import { Glass } from "./Glass";
|
|
5
6
|
import { colors, radii } from "./internal/tokens";
|
|
6
7
|
import { primitives } from "./internal/primitives";
|
|
7
8
|
import { useIsDark } from "./internal/motion";
|
|
@@ -21,15 +22,11 @@ export interface MessageBubbleProps {
|
|
|
21
22
|
/**
|
|
22
23
|
* One message's bubble.
|
|
23
24
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Incoming messages take the theme's wash; outgoing take `glassActive`, the
|
|
31
|
-
* same tint the library uses for any selected surface, so a transcript reads
|
|
32
|
-
* consistently with the rest of Glacia.
|
|
25
|
+
* The bubble is a glass surface like the rest of the library (panel profile),
|
|
26
|
+
* so it carries the same blurred backdrop, lit rim and shadow as a card. The
|
|
27
|
+
* outgoing direction is tinted with `glassActive` — the theme's selected
|
|
28
|
+
* tint — and the incoming one uses the plain glass token, which is what keeps
|
|
29
|
+
* the two directions distinguishable without a second material.
|
|
33
30
|
*/
|
|
34
31
|
export const MessageBubble = forwardRef<any, MessageBubbleProps>(function MessageBubble(
|
|
35
32
|
{ outgoing = false, children, style, isDark: isDarkProp, testID, ...props },
|
|
@@ -40,22 +37,24 @@ export const MessageBubble = forwardRef<any, MessageBubbleProps>(function Messag
|
|
|
40
37
|
const { View } = primitives();
|
|
41
38
|
|
|
42
39
|
return (
|
|
43
|
-
<
|
|
40
|
+
<Glass
|
|
44
41
|
ref={ref}
|
|
45
42
|
testID={testID}
|
|
43
|
+
surface="panel"
|
|
44
|
+
isDark={isDark}
|
|
45
|
+
tintColor={outgoing ? theme.glassActive : undefined}
|
|
46
46
|
style={{
|
|
47
47
|
alignSelf: outgoing ? "flex-end" : "flex-start",
|
|
48
48
|
maxWidth: "82%",
|
|
49
|
-
paddingHorizontal:
|
|
50
|
-
paddingVertical:
|
|
49
|
+
paddingHorizontal: 14,
|
|
50
|
+
paddingVertical: 10,
|
|
51
51
|
borderRadius: radii.lg,
|
|
52
|
-
backgroundColor: outgoing ? theme.glassActive : theme.wash,
|
|
53
52
|
...(style as ViewStyle),
|
|
54
53
|
}}
|
|
55
54
|
{...props}
|
|
56
55
|
>
|
|
57
56
|
{children}
|
|
58
|
-
</
|
|
57
|
+
</Glass>
|
|
59
58
|
);
|
|
60
59
|
});
|
|
61
60
|
|
|
@@ -111,8 +110,8 @@ export const MessageAttachment = forwardRef<any, MessageAttachmentProps>(
|
|
|
111
110
|
const chipStyle: ViewStyle = {
|
|
112
111
|
flexDirection: "row",
|
|
113
112
|
alignItems: "center",
|
|
114
|
-
paddingHorizontal:
|
|
115
|
-
paddingVertical:
|
|
113
|
+
paddingHorizontal: 12,
|
|
114
|
+
paddingVertical: 8,
|
|
116
115
|
borderRadius: radii.md,
|
|
117
116
|
backgroundColor: theme.wash,
|
|
118
117
|
borderWidth: 0.5,
|
package/src/Overlays.tsx
CHANGED
|
@@ -123,9 +123,21 @@ export const Menu = forwardRef<any, MenuProps>(function Menu(
|
|
|
123
123
|
const popover = (
|
|
124
124
|
<Glass
|
|
125
125
|
effect="regular"
|
|
126
|
+
surface="overlay"
|
|
126
127
|
isDark={isDark}
|
|
127
128
|
testID={testID ? `${testID}-popover` : undefined}
|
|
128
|
-
style={{
|
|
129
|
+
style={{
|
|
130
|
+
width,
|
|
131
|
+
borderRadius: radii.lg,
|
|
132
|
+
paddingVertical: 4,
|
|
133
|
+
// The web menu is deliberately near-solid so its labels stay legible
|
|
134
|
+
// over any backdrop, and it floats on a real shadow.
|
|
135
|
+
backgroundColor: theme.surface,
|
|
136
|
+
shadowOpacity: 0.12,
|
|
137
|
+
shadowRadius: 40,
|
|
138
|
+
shadowOffset: { width: 0, height: 12 },
|
|
139
|
+
...(style as ViewStyle),
|
|
140
|
+
}}
|
|
129
141
|
>
|
|
130
142
|
{items.map((item, index) => (
|
|
131
143
|
<Pressable
|
|
@@ -138,7 +150,7 @@ export const Menu = forwardRef<any, MenuProps>(function Menu(
|
|
|
138
150
|
setOpen(false);
|
|
139
151
|
item.onPress();
|
|
140
152
|
}}
|
|
141
|
-
style={{ flexDirection: "row", alignItems: "center", gap: 10, paddingVertical:
|
|
153
|
+
style={{ flexDirection: "row", alignItems: "center", gap: 10, minHeight: 40, paddingVertical: 8, paddingHorizontal: 12, opacity: item.disabled ? 0.38 : 1 }}
|
|
142
154
|
>
|
|
143
155
|
{item.icon ? <View>{item.icon}</View> : null}
|
|
144
156
|
<RNText
|
|
@@ -487,6 +499,7 @@ function SheetPanel({
|
|
|
487
499
|
return (
|
|
488
500
|
<Glass
|
|
489
501
|
effect="regular"
|
|
502
|
+
surface="overlay"
|
|
490
503
|
isDark={isDark}
|
|
491
504
|
testID={testID}
|
|
492
505
|
style={{
|
|
@@ -494,7 +507,12 @@ function SheetPanel({
|
|
|
494
507
|
borderTopRightRadius: radii.xl,
|
|
495
508
|
borderBottomLeftRadius: 0,
|
|
496
509
|
borderBottomRightRadius: 0,
|
|
497
|
-
paddingBottom:
|
|
510
|
+
paddingBottom: 24,
|
|
511
|
+
// The web sheet carries a deep, soft shadow so it reads as a layer
|
|
512
|
+
// above the page rather than a rectangle painted on it.
|
|
513
|
+
shadowOpacity: 0.5,
|
|
514
|
+
shadowRadius: 40,
|
|
515
|
+
shadowOffset: { width: 0, height: 0 },
|
|
498
516
|
// A snap point fixes the height; without one the panel is natural.
|
|
499
517
|
...(height != null ? { height } : { maxHeight: 560 }),
|
|
500
518
|
...(style as ViewStyle),
|
|
@@ -510,14 +528,14 @@ function SheetPanel({
|
|
|
510
528
|
</View>
|
|
511
529
|
) : null}
|
|
512
530
|
{title ? (
|
|
513
|
-
<View style={{ paddingHorizontal:
|
|
531
|
+
<View style={{ paddingHorizontal: 24, paddingVertical: 10 }}>
|
|
514
532
|
<RNText accessibilityRole="heading" style={{ fontSize: 17, fontWeight: "600", color: theme.foreground }}>
|
|
515
533
|
{title}
|
|
516
534
|
</RNText>
|
|
517
535
|
</View>
|
|
518
536
|
) : null}
|
|
519
|
-
<View style={{ paddingHorizontal:
|
|
520
|
-
{footer ? <View style={{ paddingHorizontal:
|
|
537
|
+
<View style={{ paddingHorizontal: 24 }}>{children}</View>
|
|
538
|
+
{footer ? <View style={{ paddingHorizontal: 24, paddingTop: 12, gap: 8 }}>{footer}</View> : null}
|
|
521
539
|
</Glass>
|
|
522
540
|
);
|
|
523
541
|
}
|
|
@@ -637,6 +655,7 @@ export const Drawer = forwardRef<any, DrawerProps>(function Drawer(
|
|
|
637
655
|
const panel = (
|
|
638
656
|
<Glass
|
|
639
657
|
effect="regular"
|
|
658
|
+
surface="overlay"
|
|
640
659
|
isDark={isDark}
|
|
641
660
|
testID={testID}
|
|
642
661
|
style={{
|