glacia-native 0.5.0 → 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.
Files changed (100) hide show
  1. package/LICENSE +29 -4
  2. package/README.md +27 -0
  3. package/lib/module/Bars.js +103 -9
  4. package/lib/module/Button.js +11 -8
  5. package/lib/module/Card.js +2 -2
  6. package/lib/module/Dialog.js +16 -17
  7. package/lib/module/Display.js +86 -8
  8. package/lib/module/Feedback.js +244 -21
  9. package/lib/module/Form.js +29 -33
  10. package/lib/module/Forms2.js +257 -13
  11. package/lib/module/Glass.js +2 -2
  12. package/lib/module/Input.js +12 -10
  13. package/lib/module/Message.js +84 -0
  14. package/lib/module/Overlays.js +195 -17
  15. package/lib/module/Pickers.js +16 -16
  16. package/lib/module/SegmentedControl.js +24 -11
  17. package/lib/module/Slider.js +24 -10
  18. package/lib/module/Switch.js +25 -10
  19. package/lib/module/TabBar.js +23 -13
  20. package/lib/module/Table.js +4 -3
  21. package/lib/module/Tabs.js +3 -2
  22. package/lib/module/ai.js +26 -18
  23. package/lib/module/charts/BarChart.js +11 -3
  24. package/lib/module/index.js +23 -2
  25. package/lib/module/internal/GlassContainer.js +54 -0
  26. package/lib/module/internal/GlassView.js +10 -2
  27. package/lib/module/internal/a11y.js +94 -0
  28. package/lib/module/internal/blur.js +78 -0
  29. package/lib/module/internal/fallback.js +120 -19
  30. package/lib/module/internal/glass-routing.js +7 -0
  31. package/lib/module/internal/glow.js +36 -0
  32. package/lib/module/internal/haptics.js +54 -0
  33. package/lib/module/internal/lens.js +70 -0
  34. package/lib/module/internal/material.js +64 -0
  35. package/lib/module/internal/motion.js +10 -1
  36. package/lib/module/internal/primitives.js +70 -4
  37. package/lib/module/internal/rim.js +35 -0
  38. package/lib/module/internal/tokens.js +80 -2
  39. package/lib/typescript/Bars.d.ts +67 -0
  40. package/lib/typescript/Display.d.ts +59 -0
  41. package/lib/typescript/Feedback.d.ts +58 -0
  42. package/lib/typescript/Forms2.d.ts +81 -0
  43. package/lib/typescript/Message.d.ts +67 -0
  44. package/lib/typescript/Overlays.d.ts +41 -0
  45. package/lib/typescript/SegmentedControl.d.ts +2 -0
  46. package/lib/typescript/Slider.d.ts +2 -0
  47. package/lib/typescript/Switch.d.ts +2 -0
  48. package/lib/typescript/TabBar.d.ts +2 -0
  49. package/lib/typescript/index.d.ts +9 -6
  50. package/lib/typescript/internal/GlassContainer.d.ts +37 -0
  51. package/lib/typescript/internal/GlassView.d.ts +21 -0
  52. package/lib/typescript/internal/a11y.d.ts +19 -0
  53. package/lib/typescript/internal/blur.d.ts +24 -0
  54. package/lib/typescript/internal/fallback.d.ts +32 -2
  55. package/lib/typescript/internal/glass-routing.d.ts +10 -0
  56. package/lib/typescript/internal/glow.d.ts +11 -0
  57. package/lib/typescript/internal/haptics.d.ts +7 -0
  58. package/lib/typescript/internal/lens.d.ts +47 -0
  59. package/lib/typescript/internal/material.d.ts +27 -0
  60. package/lib/typescript/internal/motion.d.ts +4 -0
  61. package/lib/typescript/internal/primitives.d.ts +23 -0
  62. package/lib/typescript/internal/rim.d.ts +16 -0
  63. package/lib/typescript/internal/tokens.d.ts +89 -0
  64. package/package.json +12 -3
  65. package/src/Bars.tsx +239 -2
  66. package/src/Button.tsx +16 -9
  67. package/src/Card.tsx +2 -2
  68. package/src/Dialog.tsx +37 -26
  69. package/src/Display.tsx +237 -6
  70. package/src/Feedback.tsx +448 -35
  71. package/src/Form.tsx +60 -40
  72. package/src/Forms2.tsx +455 -8
  73. package/src/Glass.tsx +4 -0
  74. package/src/Input.tsx +15 -11
  75. package/src/Message.tsx +218 -0
  76. package/src/Overlays.tsx +269 -39
  77. package/src/Pickers.tsx +11 -6
  78. package/src/SegmentedControl.tsx +39 -9
  79. package/src/Slider.tsx +26 -10
  80. package/src/Switch.tsx +29 -10
  81. package/src/TabBar.tsx +39 -12
  82. package/src/Table.tsx +4 -3
  83. package/src/Tabs.tsx +5 -0
  84. package/src/ai.tsx +37 -23
  85. package/src/charts/BarChart.tsx +41 -3
  86. package/src/index.ts +43 -1
  87. package/src/internal/GlassContainer.tsx +82 -0
  88. package/src/internal/GlassView.tsx +25 -0
  89. package/src/internal/a11y.ts +105 -0
  90. package/src/internal/blur.ts +90 -0
  91. package/src/internal/fallback.tsx +170 -15
  92. package/src/internal/glass-routing.ts +17 -0
  93. package/src/internal/glow.tsx +62 -0
  94. package/src/internal/haptics.ts +59 -0
  95. package/src/internal/lens.tsx +105 -0
  96. package/src/internal/material.ts +92 -0
  97. package/src/internal/motion.ts +10 -1
  98. package/src/internal/primitives.ts +83 -4
  99. package/src/internal/rim.tsx +79 -0
  100. package/src/internal/tokens.ts +82 -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: "600",
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: 6, ...(style as ViewStyle) }}>
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: 11,
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
- <View
170
+ <Glass
171
+ surface="control"
172
+ isDark={isDark}
169
173
  style={{
170
174
  width: 20,
171
175
  height: 20,
172
176
  borderRadius: 6,
173
- borderWidth: filled ? 0 : 1.5,
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: "#fff" }} />
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: "#fff", fontSize: 12, fontWeight: "700", lineHeight: 14 }}>
187
+ <Text style={{ color: theme.onTint, fontSize: 12, fontWeight: "700", lineHeight: 14 }}>
186
188
  ✓
187
189
  </Text>
188
190
  ) : null}
189
- </View>
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: 11, color: theme.muted, marginTop: 2 }}>{description}</Text>
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
- <View
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
- borderWidth: isSelected ? 6 : 1.5,
288
- borderColor: isSelected ? theme.fill : theme.edge,
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: 11, color: theme.muted, marginTop: 2 }}>
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
- <Text style={{ fontSize: 15, color: selected ? theme.foreground : theme.muted }}>
383
- {selected?.label ?? placeholder}
384
- </Text>
385
- <Text style={{ fontSize: 10, color: theme.muted }}>{open ? "▲" : "▼"}</Text>
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
- <View
404
+ <Glass
405
+ surface="overlay"
406
+ isDark={isDark}
390
407
  style={{
391
408
  marginTop: 6,
392
409
  borderRadius: radii.md,
393
- borderWidth: 1,
394
- borderColor: theme.edge,
395
- backgroundColor: theme.glass,
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
- paddingVertical: 10,
428
+ minHeight: 32,
413
429
  paddingHorizontal: 12,
414
- backgroundColor: isSelected ? theme.glassActive : "transparent",
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
- </View>
441
+ </Glass>
422
442
  )}
423
443
  </View>
424
444
  );