glacia-native 0.3.5 → 0.5.0

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 (121) hide show
  1. package/lib/module/Bars.js +176 -0
  2. package/lib/module/Button.js +15 -2
  3. package/lib/module/Card.js +29 -14
  4. package/lib/module/Carousel.js +103 -0
  5. package/lib/module/Dialog.js +43 -32
  6. package/lib/module/Display.js +240 -0
  7. package/lib/module/Feedback.js +172 -0
  8. package/lib/module/Form.js +51 -12
  9. package/lib/module/Forms2.js +227 -0
  10. package/lib/module/Glass.js +11 -2
  11. package/lib/module/Input.js +19 -7
  12. package/lib/module/Overlays.js +166 -0
  13. package/lib/module/Pickers.js +243 -0
  14. package/lib/module/SegmentedControl.js +65 -21
  15. package/lib/module/Slider.js +121 -25
  16. package/lib/module/Switch.js +33 -15
  17. package/lib/module/TabBar.js +63 -25
  18. package/lib/module/Table.js +24 -6
  19. package/lib/module/Tabs.js +55 -33
  20. package/lib/module/Text.js +37 -0
  21. package/lib/module/ai.js +49 -20
  22. package/lib/module/charts/BarChart.js +4 -2
  23. package/lib/module/charts/FunnelChart.js +4 -2
  24. package/lib/module/charts/HeatmapChart.js +4 -2
  25. package/lib/module/charts/LineChart.js +4 -2
  26. package/lib/module/charts/PlotChart.js +11 -3
  27. package/lib/module/charts/RadarChart.js +4 -2
  28. package/lib/module/charts/RingChart.js +4 -2
  29. package/lib/module/charts/ScatterChart.js +20 -3
  30. package/lib/module/charts/WaterfallChart.js +12 -3
  31. package/lib/module/charts/advanced.js +12 -6
  32. package/lib/module/charts/extra.js +6 -3
  33. package/lib/module/index.js +58 -1
  34. package/lib/module/internal/GlassView.js +31 -17
  35. package/lib/module/internal/fallback.js +14 -3
  36. package/lib/module/internal/glass-routing.js +56 -0
  37. package/lib/module/internal/motion.js +55 -0
  38. package/lib/module/internal/primitives.js +413 -0
  39. package/lib/module/internal/tokens.js +55 -1
  40. package/lib/typescript/Bars.d.ts +121 -0
  41. package/lib/typescript/Button.d.ts +11 -1
  42. package/lib/typescript/Card.d.ts +20 -8
  43. package/lib/typescript/Carousel.d.ts +47 -0
  44. package/lib/typescript/Dialog.d.ts +19 -6
  45. package/lib/typescript/Display.d.ts +119 -0
  46. package/lib/typescript/Feedback.d.ts +138 -0
  47. package/lib/typescript/Form.d.ts +27 -11
  48. package/lib/typescript/Forms2.d.ts +128 -0
  49. package/lib/typescript/Glass.d.ts +10 -1
  50. package/lib/typescript/Input.d.ts +11 -1
  51. package/lib/typescript/Overlays.d.ts +105 -0
  52. package/lib/typescript/Pickers.d.ts +105 -0
  53. package/lib/typescript/SegmentedControl.d.ts +11 -1
  54. package/lib/typescript/Slider.d.ts +13 -1
  55. package/lib/typescript/Switch.d.ts +12 -1
  56. package/lib/typescript/TabBar.d.ts +13 -1
  57. package/lib/typescript/Table.d.ts +14 -5
  58. package/lib/typescript/Tabs.d.ts +8 -5
  59. package/lib/typescript/Text.d.ts +28 -0
  60. package/lib/typescript/ai.d.ts +12 -9
  61. package/lib/typescript/charts/BarChart.d.ts +1 -1
  62. package/lib/typescript/charts/FunnelChart.d.ts +1 -1
  63. package/lib/typescript/charts/HeatmapChart.d.ts +1 -1
  64. package/lib/typescript/charts/LineChart.d.ts +1 -1
  65. package/lib/typescript/charts/PlotChart.d.ts +1 -1
  66. package/lib/typescript/charts/RadarChart.d.ts +1 -1
  67. package/lib/typescript/charts/RingChart.d.ts +1 -1
  68. package/lib/typescript/charts/ScatterChart.d.ts +1 -1
  69. package/lib/typescript/charts/WaterfallChart.d.ts +1 -1
  70. package/lib/typescript/charts/advanced.d.ts +5 -5
  71. package/lib/typescript/charts/extra.d.ts +2 -2
  72. package/lib/typescript/index.d.ts +9 -1
  73. package/lib/typescript/internal/GlassView.d.ts +21 -4
  74. package/lib/typescript/internal/fallback.d.ts +10 -1
  75. package/lib/typescript/internal/glass-routing.d.ts +30 -0
  76. package/lib/typescript/internal/motion.d.ts +19 -0
  77. package/lib/typescript/internal/primitives.d.ts +41 -0
  78. package/lib/typescript/internal/tokens.d.ts +61 -0
  79. package/package.json +2 -2
  80. package/src/Bars.tsx +570 -0
  81. package/src/Button.tsx +47 -22
  82. package/src/Card.tsx +52 -31
  83. package/src/Carousel.tsx +233 -0
  84. package/src/Dialog.tsx +99 -64
  85. package/src/Display.tsx +550 -0
  86. package/src/Feedback.tsx +579 -0
  87. package/src/Form.tsx +90 -25
  88. package/src/Forms2.tsx +608 -0
  89. package/src/Glass.tsx +24 -1
  90. package/src/Input.tsx +33 -12
  91. package/src/Overlays.tsx +474 -0
  92. package/src/Pickers.tsx +590 -0
  93. package/src/SegmentedControl.tsx +104 -32
  94. package/src/Slider.tsx +151 -47
  95. package/src/Switch.tsx +56 -32
  96. package/src/TabBar.tsx +100 -30
  97. package/src/Table.tsx +38 -14
  98. package/src/Tabs.tsx +85 -32
  99. package/src/Text.tsx +83 -0
  100. package/src/ai.tsx +77 -31
  101. package/src/charts/BarChart.tsx +4 -2
  102. package/src/charts/FunnelChart.tsx +4 -2
  103. package/src/charts/HeatmapChart.tsx +4 -2
  104. package/src/charts/LineChart.tsx +4 -2
  105. package/src/charts/PlotChart.tsx +23 -3
  106. package/src/charts/RadarChart.tsx +4 -2
  107. package/src/charts/RingChart.tsx +4 -2
  108. package/src/charts/ScatterChart.tsx +24 -3
  109. package/src/charts/WaterfallChart.tsx +21 -3
  110. package/src/charts/advanced.tsx +12 -6
  111. package/src/charts/extra.tsx +6 -3
  112. package/src/index.ts +101 -1
  113. package/src/internal/GlassView.tsx +51 -19
  114. package/src/internal/fallback.tsx +23 -8
  115. package/src/internal/glass-routing.ts +68 -0
  116. package/src/internal/motion.ts +60 -0
  117. package/src/internal/primitives.ts +482 -0
  118. package/src/internal/tokens.ts +62 -0
  119. package/lib/module/charts/primitives.js +0 -212
  120. package/lib/typescript/charts/primitives.d.ts +0 -23
  121. package/src/charts/primitives.ts +0 -262
@@ -21,7 +21,7 @@ export interface NativePolarAreaChartProps {
21
21
  * one dimension (radius) rather than area. Each wedge is separately tappable
22
22
  * because a phone has no hover.
23
23
  */
24
- export declare function NativePolarAreaChart({ segments, size, max, isDark, palette, style, onSegmentPress, }: NativePolarAreaChartProps): import("react").JSX.Element;
24
+ export declare function NativePolarAreaChart({ segments, size, max, isDark: isDarkProp, palette, style, onSegmentPress, }: NativePolarAreaChartProps): import("react").JSX.Element;
25
25
  export interface NativePyramidLevel {
26
26
  label: string;
27
27
  value: number;
@@ -43,7 +43,7 @@ export interface NativePyramidChartProps {
43
43
  * Bands are Views rather than SVG: each is a centred rectangle whose width is
44
44
  * the band's share of the widest level, which native layout computes exactly.
45
45
  */
46
- export declare function NativePyramidChart({ levels, levelHeight, width, isDark, palette, style, onLevelPress, }: NativePyramidChartProps): import("react").JSX.Element;
46
+ export declare function NativePyramidChart({ levels, levelHeight, width, isDark: isDarkProp, palette, style, onLevelPress, }: NativePyramidChartProps): import("react").JSX.Element;
47
47
  export interface NativeLiveLineChartProps {
48
48
  labels: string[];
49
49
  series: NativeLineSeries[];
@@ -12,5 +12,13 @@ export { Dialog, DialogTrigger, AlertDialog, ActionSheet, type DialogProps, type
12
12
  export { NativePlan, NativeSources, NativeResponse, NativeTask, NativeSoundwave, NativeThinkingOrb, NativePanelside, NativeAIInput, NativeImageGeneration, type NativePlanProps, type NativePlanStep, type NativeSourcesProps, type NativeSource, type NativeResponseProps, type NativeTaskProps, type NativeSoundwaveProps, type NativeThinkingOrbProps, type NativePanelsideProps, type NativePanelNavItem, type NativeAIInputProps, type NativeImageGenerationProps, type NativeGeneratedImage, } from "./ai";
13
13
  export { NativeTable, NativeScrollArea, type NativeTableProps, type NativeTableColumn, type NativeTableRow, type NativeScrollAreaProps, } from "./Table";
14
14
  export * from "./charts";
15
+ export { Text, type TextProps, type TextVariant } from "./Text";
16
+ export { Avatar, Badge, Separator, Skeleton, Spinner, Progress, initialsOf, type AvatarProps, type AvatarSize, type BadgeProps, type SeparatorProps, type SkeletonProps, type SpinnerProps, type SpinnerSize, type ProgressProps, type ProgressVariant, } from "./Display";
17
+ export { Toast, Banner, List, ListItem, ListSection, Accordion, type ToastProps, type ToastAction, type BannerProps, type ListProps, type ListItemProps, type ListSectionProps, type AccordionProps, type AccordionSection, } from "./Feedback";
18
+ export { SearchBar, Chip, FAB, IconButton, AppBar, type SearchBarProps, type ChipProps, type FABProps, type IconButtonProps, type AppBarProps, type AppBarAction, } from "./Bars";
19
+ export { Menu, Sheet, Drawer, anchorPopover, type MenuProps, type MenuItem, type SheetProps, type DrawerProps, } from "./Overlays";
20
+ export { Carousel, PageControl, type CarouselProps, type PageControlProps, } from "./Carousel";
21
+ export { Stepper, Toggle, ToggleGroup, InputOTP, ButtonGroup, type StepperProps, type ToggleProps, type ToggleGroupProps, type ToggleGroupItem, type InputOTPProps, type ButtonGroupProps, type ButtonGroupItem, } from "./Forms2";
22
+ export { Calendar, DatePicker, TimePicker, monthGrid, startOfDay, sameDay, parseTime, formatTime, WEEKDAYS, MONTHS, type CalendarProps, type CalendarCell, type DatePickerProps, type TimePickerProps, } from "./Pickers";
15
23
  export { isGlassSupported } from "./internal/GlassView";
16
- export { colors, radii, springs } from "./internal/tokens";
24
+ export { colors, radii, springs, typeScale, toneColor, type Tone } from "./internal/tokens";
@@ -1,15 +1,32 @@
1
1
  import { type ReactNode } from "react";
2
+ import type { StyleProp, ViewStyle } from "react-native";
2
3
  export interface NativeGlassProps {
3
4
  effect?: "clear" | "regular" | "none";
4
5
  tintColor?: string;
5
6
  interactive?: boolean;
6
- style?: any;
7
+ /** Passed to whichever surface renders, so tests can find the glass itself. */
8
+ testID?: string;
9
+ style?: StyleProp<ViewStyle>;
7
10
  children?: ReactNode;
11
+ /**
12
+ * Explicit dark override for the fallback tint. When omitted the phone's
13
+ * colour scheme decides, so developers never thread this prop themselves.
14
+ */
15
+ isDark?: boolean;
16
+ /**
17
+ * Any further React Native view prop (accessibility, onLayout, pointer
18
+ * events, …) is passed straight through to whichever surface renders, so a
19
+ * component can put its own accessibility contract on the glass itself.
20
+ */
21
+ [prop: string]: any;
8
22
  }
23
+ /** Clears the memoised decision. Only tests call this, to drive both branches. */
24
+ export declare function resetGlassRouter(): void;
25
+ /** Whether this build renders Apple's glass. */
9
26
  export declare const isGlassSupported: boolean;
10
27
  /**
11
- * Platform Glass View:
28
+ * Platform Glass View — the single place a glass surface is chosen:
12
29
  * - iOS 26+: Real UIGlassEffect via @callstack/liquid-glass
13
- * - iOS < 26 / Android / Expo Go / Fallback: Smooth translucent tint View with identical layout
30
+ * - iOS < 26 / Android / Expo Go: translucent tint View with identical layout
14
31
  */
15
- export declare const GlassView: import("react").ForwardRefExoticComponent<NativeGlassProps & import("react").RefAttributes<any>>;
32
+ export declare const GlassView: import("react").ForwardRefExoticComponent<Omit<NativeGlassProps, "ref"> & import("react").RefAttributes<any>>;
@@ -1,9 +1,18 @@
1
1
  import { type ReactNode } from "react";
2
+ import type { StyleProp, ViewStyle } from "react-native";
2
3
  export interface FallbackGlassProps {
3
4
  effect?: "clear" | "regular" | "none";
4
5
  tintColor?: string;
5
- style?: any;
6
+ testID?: string;
7
+ style?: StyleProp<ViewStyle>;
6
8
  children?: ReactNode;
7
9
  isDark?: boolean;
8
10
  }
11
+ /**
12
+ * Glacia's own glass surface for every platform where Apple's material is not
13
+ * available: Android, iOS before 26, and Expo Go.
14
+ *
15
+ * It renders the resolver's real React Native `View` with the same shape and
16
+ * layout as the native glass, so switching branches never shifts the layout.
17
+ */
9
18
  export declare const FallbackGlassView: import("react").ForwardRefExoticComponent<FallbackGlassProps & import("react").RefAttributes<any>>;
@@ -0,0 +1,30 @@
1
+ export interface LiquidGlassModule {
2
+ LiquidGlassView?: any;
3
+ isLiquidGlassSupported?: boolean;
4
+ }
5
+ /** The routing decision for one glass surface. */
6
+ export interface GlassRouter {
7
+ /** True when Apple's real glass renders this surface. */
8
+ supported: boolean;
9
+ /** Apple's `LiquidGlassView`, or null when the fallback renders instead. */
10
+ LiquidGlassView: any;
11
+ }
12
+ /**
13
+ * Reads a liquid-glass module and decides which branch renders.
14
+ *
15
+ * A module only counts as supported when it exports the view *and* reports
16
+ * support; a missing export falls back rather than crashing.
17
+ */
18
+ export declare function routerFor(module: LiquidGlassModule | null | undefined): GlassRouter;
19
+ /**
20
+ * Loads `@callstack/liquid-glass` at runtime.
21
+ *
22
+ * Resolved through `require` rather than a static import so the package stays
23
+ * importable where the native module is absent (jsdom tests, web preview).
24
+ * `isLiquidGlassSupported` is a constant baked by the package's own platform
25
+ * resolution: its iOS build reads the native module and answers true only on
26
+ * iOS 26+; the default build answers false.
27
+ */
28
+ export declare function loadLiquidGlass(): LiquidGlassModule | null;
29
+ /** The installed module's routing decision, computed once per process. */
30
+ export declare function defaultRouter(): GlassRouter;
@@ -0,0 +1,19 @@
1
+ import { springs } from "./tokens";
2
+ /**
3
+ * Resolves the theme. An explicit `isDark` always wins; otherwise the phone's
4
+ * colour scheme decides, defaulting to light when it is unknown.
5
+ */
6
+ export declare function useIsDark(isDark?: boolean): boolean;
7
+ export type SpringName = keyof typeof springs;
8
+ /**
9
+ * A value that springs towards `target` whenever it changes.
10
+ *
11
+ * Returns the `Animated.Value` to put in a style, plus whether motion is real
12
+ * on this platform. A caller that gets `animated === false` renders the target
13
+ * directly, so the DOM preview and tests show the settled state rather than an
14
+ * animation the environment cannot advance.
15
+ */
16
+ export declare function useSpring(target: number, spring?: SpringName): {
17
+ value: any;
18
+ animated: boolean;
19
+ };
@@ -0,0 +1,41 @@
1
+ /** Minimal shapes of the React Native primitives the package uses. */
2
+ export interface RNPrimitives {
3
+ View: any;
4
+ Text: any;
5
+ Pressable: any;
6
+ Svg: any;
7
+ G: any;
8
+ Line: any;
9
+ Path: any;
10
+ Circle: any;
11
+ Rect: any;
12
+ Polygon: any;
13
+ SvgText: any;
14
+ TextInput: any;
15
+ Modal: any;
16
+ Image: any;
17
+ /** React Native's Animated API, or a no-op animation shim off-device. */
18
+ Animated: any;
19
+ /** React Native's Easing curves, used with Animated.spring. */
20
+ Easing: any;
21
+ /** React Native's ScrollView, or null when it is unavailable. */
22
+ getScrollView: () => any;
23
+ /** React Native's BackHandler, or null outside a native runtime. */
24
+ getBackHandler: () => any;
25
+ /** True when the returned primitives are React Native's own. */
26
+ isNative: boolean;
27
+ /** React Native's PanResponder, or a DOM stand-in off-device. */
28
+ PanResponder: any;
29
+ /** React Native's useColorScheme, or null outside a native runtime. */
30
+ useColorScheme: (() => "light" | "dark" | null | undefined) | null;
31
+ }
32
+ /**
33
+ * Records an element's width for gesture maths when the environment has no
34
+ * layout events (the DOM preview). A device never needs it: React Native
35
+ * reports width through `onLayout`.
36
+ */
37
+ export declare function measurePreviewWidth(node: any, widthRef: {
38
+ current: number;
39
+ }): void;
40
+ /** The resolved primitives, computed once per process. */
41
+ export declare function primitives(): RNPrimitives;
@@ -22,6 +22,47 @@ export declare const springs: {
22
22
  readonly mass: 1;
23
23
  };
24
24
  };
25
+ /**
26
+ * The package's type scale, in React Native points.
27
+ *
28
+ * Text maps its variants onto these names so every component in the library —
29
+ * and every app built on it — sizes type the same way.
30
+ */
31
+ export declare const typeScale: {
32
+ title: {
33
+ fontSize: number;
34
+ lineHeight: number;
35
+ fontWeight: "700";
36
+ };
37
+ heading: {
38
+ fontSize: number;
39
+ lineHeight: number;
40
+ fontWeight: "600";
41
+ };
42
+ body: {
43
+ fontSize: number;
44
+ lineHeight: number;
45
+ fontWeight: "400";
46
+ };
47
+ label: {
48
+ fontSize: number;
49
+ lineHeight: number;
50
+ fontWeight: "600";
51
+ };
52
+ caption: {
53
+ fontSize: number;
54
+ lineHeight: number;
55
+ fontWeight: "400";
56
+ };
57
+ };
58
+ /**
59
+ * Theme colours in the form React Native accepts.
60
+ *
61
+ * The shared tokens express colours as CSS colour strings (`rgb(r g b / a)`),
62
+ * which is right for the web package and rejected by React Native. The values
63
+ * below are the same colours written as `rgba(...)`/hex, sourced from the same
64
+ * token file, so the two platforms stay in step.
65
+ */
25
66
  export declare const colors: {
26
67
  light: {
27
68
  foreground: string;
@@ -29,8 +70,15 @@ export declare const colors: {
29
70
  glass: string;
30
71
  glassActive: string;
31
72
  edge: string;
73
+ separator: string;
32
74
  fill: string;
33
75
  destructive: string;
76
+ on: string;
77
+ warning: string;
78
+ info: string;
79
+ scrim: string;
80
+ onTint: string;
81
+ skeleton: string;
34
82
  axis: string;
35
83
  };
36
84
  dark: {
@@ -39,8 +87,21 @@ export declare const colors: {
39
87
  glass: string;
40
88
  glassActive: string;
41
89
  edge: string;
90
+ separator: string;
42
91
  fill: string;
43
92
  destructive: string;
93
+ on: string;
94
+ warning: string;
95
+ info: string;
96
+ scrim: string;
97
+ onTint: string;
98
+ skeleton: string;
44
99
  axis: string;
45
100
  };
46
101
  };
102
+ /** Keeps the shared token file honest if a colour is added there first. */
103
+ export type ThemeColors = typeof colors.light;
104
+ /** The semantic tone of a feedback component (Banner, Toast). */
105
+ export type Tone = "info" | "success" | "warning" | "error";
106
+ /** Resolves a tone to its theme colour. */
107
+ export declare function toneColor(theme: ThemeColors, tone: Tone): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glacia-native",
3
- "version": "0.3.5",
3
+ "version": "0.5.0",
4
4
  "description": "Liquid Glass UI components for React Native — real iOS 26 glass, with a clean fallback on Android and older iOS.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,7 +27,7 @@
27
27
  "react-native-svg": ">=13"
28
28
  },
29
29
  "dependencies": {
30
- "glacia-tokens": "0.3.5"
30
+ "glacia-tokens": "0.5.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@testing-library/react": "^16.3.3",