@onlynative/components 0.1.1-alpha.0 → 0.1.1-alpha.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 (72) hide show
  1. package/dist/appbar/index.d.ts +21 -2
  2. package/dist/appbar/index.js +207 -81
  3. package/dist/button/index.js +125 -33
  4. package/dist/card/index.js +88 -20
  5. package/dist/checkbox/index.js +88 -17
  6. package/dist/chip/index.js +122 -30
  7. package/dist/icon-button/index.js +107 -36
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +409 -270
  10. package/dist/list/index.js +71 -24
  11. package/dist/radio/index.js +43 -14
  12. package/dist/switch/index.js +90 -19
  13. package/dist/text-field/index.js +82 -26
  14. package/package.json +18 -7
  15. package/src/appbar/AppBar.tsx +0 -302
  16. package/src/appbar/index.ts +0 -2
  17. package/src/appbar/styles.ts +0 -92
  18. package/src/appbar/types.ts +0 -67
  19. package/src/button/Button.tsx +0 -133
  20. package/src/button/index.ts +0 -2
  21. package/src/button/styles.ts +0 -287
  22. package/src/button/types.ts +0 -42
  23. package/src/card/Card.tsx +0 -69
  24. package/src/card/index.ts +0 -2
  25. package/src/card/styles.ts +0 -150
  26. package/src/card/types.ts +0 -27
  27. package/src/checkbox/Checkbox.tsx +0 -113
  28. package/src/checkbox/index.ts +0 -2
  29. package/src/checkbox/styles.ts +0 -155
  30. package/src/checkbox/types.ts +0 -20
  31. package/src/chip/Chip.tsx +0 -188
  32. package/src/chip/index.ts +0 -2
  33. package/src/chip/styles.ts +0 -239
  34. package/src/chip/types.ts +0 -58
  35. package/src/icon-button/IconButton.tsx +0 -362
  36. package/src/icon-button/index.ts +0 -6
  37. package/src/icon-button/styles.ts +0 -259
  38. package/src/icon-button/types.ts +0 -55
  39. package/src/index.ts +0 -54
  40. package/src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx +0 -69
  41. package/src/keyboard-avoiding-wrapper/index.ts +0 -2
  42. package/src/keyboard-avoiding-wrapper/styles.ts +0 -10
  43. package/src/keyboard-avoiding-wrapper/types.ts +0 -37
  44. package/src/layout/Box.tsx +0 -99
  45. package/src/layout/Column.tsx +0 -16
  46. package/src/layout/Grid.tsx +0 -49
  47. package/src/layout/Layout.tsx +0 -81
  48. package/src/layout/Row.tsx +0 -22
  49. package/src/layout/index.ts +0 -13
  50. package/src/layout/resolveSpacing.ts +0 -11
  51. package/src/layout/types.ts +0 -82
  52. package/src/list/List.tsx +0 -17
  53. package/src/list/ListDivider.tsx +0 -20
  54. package/src/list/ListItem.tsx +0 -128
  55. package/src/list/index.ts +0 -9
  56. package/src/list/styles.ts +0 -132
  57. package/src/list/types.ts +0 -54
  58. package/src/radio/Radio.tsx +0 -103
  59. package/src/radio/index.ts +0 -2
  60. package/src/radio/styles.ts +0 -139
  61. package/src/radio/types.ts +0 -20
  62. package/src/switch/Switch.tsx +0 -121
  63. package/src/switch/index.ts +0 -2
  64. package/src/switch/styles.ts +0 -172
  65. package/src/switch/types.ts +0 -32
  66. package/src/text-field/TextField.tsx +0 -301
  67. package/src/text-field/index.ts +0 -2
  68. package/src/text-field/styles.ts +0 -239
  69. package/src/text-field/types.ts +0 -49
  70. package/src/typography/Typography.tsx +0 -79
  71. package/src/typography/index.ts +0 -3
  72. package/src/typography/types.ts +0 -17
@@ -6,6 +6,19 @@ import '@expo/vector-icons/MaterialCommunityIcons';
6
6
 
7
7
  /** Size/layout variant of the AppBar. */
8
8
  type AppBarVariant = 'small' | 'center-aligned' | 'medium' | 'large';
9
+ /**
10
+ * Color scheme that determines the default container and content colors.
11
+ *
12
+ * - `'surface'` — `surface` / `onSurface` (default, elevated uses `surfaceContainer`)
13
+ * - `'surfaceContainerLowest'` — `surfaceContainerLowest` / `onSurface`
14
+ * - `'surfaceContainerLow'` — `surfaceContainerLow` / `onSurface`
15
+ * - `'surfaceContainer'` — `surfaceContainer` / `onSurface`
16
+ * - `'surfaceContainerHigh'` — `surfaceContainerHigh` / `onSurface`
17
+ * - `'surfaceContainerHighest'` — `surfaceContainerHighest` / `onSurface`
18
+ * - `'primary'` — `primary` / `onPrimary`
19
+ * - `'primaryContainer'` — `primaryContainer` / `onPrimaryContainer`
20
+ */
21
+ type AppBarColorScheme = 'surface' | 'surfaceContainerLowest' | 'surfaceContainerLow' | 'surfaceContainer' | 'surfaceContainerHigh' | 'surfaceContainerHighest' | 'primary' | 'primaryContainer';
9
22
  /** A single action item rendered in the AppBar trailing slot. */
10
23
  interface AppBarAction {
11
24
  /** MaterialCommunityIcons icon name to render. */
@@ -28,6 +41,12 @@ interface AppBarProps {
28
41
  * @default 'small'
29
42
  */
30
43
  variant?: AppBarVariant;
44
+ /**
45
+ * Color scheme that determines the default container and content colors.
46
+ * `containerColor` and `contentColor` props override these defaults.
47
+ * @default 'surface'
48
+ */
49
+ colorScheme?: AppBarColorScheme;
31
50
  /**
32
51
  * When `true`, renders a back button in the leading slot.
33
52
  * @default false
@@ -66,6 +85,6 @@ interface AppBarProps {
66
85
  style?: StyleProp<ViewStyle>;
67
86
  }
68
87
 
69
- declare function AppBar({ title, variant, canGoBack, onBackPress, insetTop, elevated, leading, trailing, actions, containerColor, contentColor, titleStyle, style, }: AppBarProps): react_jsx_runtime.JSX.Element;
88
+ declare function AppBar({ title, variant, colorScheme, canGoBack, onBackPress, insetTop, elevated, leading, trailing, actions, containerColor, contentColor, titleStyle, style, }: AppBarProps): react_jsx_runtime.JSX.Element;
70
89
 
71
- export { AppBar, type AppBarAction, type AppBarProps, type AppBarVariant };
90
+ export { AppBar, type AppBarAction, type AppBarColorScheme, type AppBarProps, type AppBarVariant };
@@ -26,24 +26,98 @@ module.exports = __toCommonJS(appbar_exports);
26
26
 
27
27
  // src/appbar/AppBar.tsx
28
28
  var import_react3 = require("react");
29
- var import_react_native5 = require("react-native");
29
+ var import_react_native7 = require("react-native");
30
30
  var import_react_native_safe_area_context = require("react-native-safe-area-context");
31
31
  var import_core4 = require("@onlynative/core");
32
32
 
33
33
  // src/icon-button/IconButton.tsx
34
34
  var import_react = require("react");
35
- var import_react_native2 = require("react-native");
35
+ var import_react_native4 = require("react-native");
36
36
  var import_core = require("@onlynative/core");
37
- var import_utils2 = require("@onlynative/utils");
38
37
 
39
- // src/icon-button/styles.ts
38
+ // ../utils/dist/chunk-OQRDRRQA.mjs
39
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
40
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
41
+ }) : x)(function(x) {
42
+ if (typeof require !== "undefined") return require.apply(this, arguments);
43
+ throw Error('Dynamic require of "' + x + '" is not supported');
44
+ });
45
+
46
+ // ../utils/dist/index.mjs
40
47
  var import_react_native = require("react-native");
41
- var import_utils = require("@onlynative/utils");
48
+ var import_react_native2 = require("react-native");
49
+ function parseHexColor(color) {
50
+ const normalized = color.replace("#", "");
51
+ if (normalized.length !== 6 && normalized.length !== 8) {
52
+ return null;
53
+ }
54
+ const r = Number.parseInt(normalized.slice(0, 2), 16);
55
+ const g = Number.parseInt(normalized.slice(2, 4), 16);
56
+ const b = Number.parseInt(normalized.slice(4, 6), 16);
57
+ if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
58
+ return null;
59
+ }
60
+ return { r, g, b };
61
+ }
62
+ function clampAlpha(alpha) {
63
+ return Math.max(0, Math.min(1, alpha));
64
+ }
65
+ function alphaColor(color, alpha) {
66
+ const channels = parseHexColor(color);
67
+ const boundedAlpha = clampAlpha(alpha);
68
+ if (!channels) {
69
+ return color;
70
+ }
71
+ return `rgba(${channels.r}, ${channels.g}, ${channels.b}, ${boundedAlpha})`;
72
+ }
73
+ function blendColor(base, overlay, overlayAlpha) {
74
+ const baseChannels = parseHexColor(base);
75
+ const overlayChannels = parseHexColor(overlay);
76
+ const boundedAlpha = clampAlpha(overlayAlpha);
77
+ if (!baseChannels || !overlayChannels) {
78
+ return alphaColor(overlay, boundedAlpha);
79
+ }
80
+ const r = Math.round(
81
+ (1 - boundedAlpha) * baseChannels.r + boundedAlpha * overlayChannels.r
82
+ );
83
+ const g = Math.round(
84
+ (1 - boundedAlpha) * baseChannels.g + boundedAlpha * overlayChannels.g
85
+ );
86
+ const b = Math.round(
87
+ (1 - boundedAlpha) * baseChannels.b + boundedAlpha * overlayChannels.b
88
+ );
89
+ return `rgb(${r}, ${g}, ${b})`;
90
+ }
91
+ var _MCIcons = null;
92
+ var _resolved = false;
93
+ function getMaterialCommunityIcons() {
94
+ if (!_resolved) {
95
+ _resolved = true;
96
+ try {
97
+ const mod = __require("@expo/vector-icons/MaterialCommunityIcons");
98
+ _MCIcons = mod.default || mod;
99
+ } catch {
100
+ _MCIcons = null;
101
+ }
102
+ }
103
+ if (!_MCIcons) {
104
+ throw new Error(
105
+ "@expo/vector-icons is required for icon support. Install it with: npx expo install @expo/vector-icons"
106
+ );
107
+ }
108
+ return _MCIcons;
109
+ }
110
+ function selectRTL(ltr, rtl) {
111
+ return import_react_native2.I18nManager.isRTL ? rtl : ltr;
112
+ }
113
+
114
+ // src/icon-button/styles.ts
115
+ var import_react_native3 = require("react-native");
42
116
  function createStyles(theme) {
43
- const disabledContainerColor = (0, import_utils.alphaColor)(theme.colors.onSurface, 0.12);
44
- const disabledOutlineColor = (0, import_utils.alphaColor)(theme.colors.onSurface, 0.12);
117
+ const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
118
+ const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
45
119
  const toggleUnselectedContainerColor = theme.colors.surfaceContainerHighest;
46
- return import_react_native.StyleSheet.create({
120
+ return import_react_native3.StyleSheet.create({
47
121
  container: {
48
122
  borderRadius: theme.shape.cornerFull,
49
123
  alignItems: "center",
@@ -109,160 +183,160 @@ function createStyles(theme) {
109
183
  },
110
184
  // Hover states (M3: 8% state layer)
111
185
  hoveredFilled: {
112
- backgroundColor: (0, import_utils.blendColor)(
186
+ backgroundColor: blendColor(
113
187
  theme.colors.primary,
114
188
  theme.colors.onPrimary,
115
189
  theme.stateLayer.hoveredOpacity
116
190
  )
117
191
  },
118
192
  hoveredFilledToggleUnselected: {
119
- backgroundColor: (0, import_utils.blendColor)(
193
+ backgroundColor: blendColor(
120
194
  toggleUnselectedContainerColor,
121
195
  theme.colors.primary,
122
196
  theme.stateLayer.hoveredOpacity
123
197
  )
124
198
  },
125
199
  hoveredFilledToggleSelected: {
126
- backgroundColor: (0, import_utils.blendColor)(
200
+ backgroundColor: blendColor(
127
201
  theme.colors.primary,
128
202
  theme.colors.onPrimary,
129
203
  theme.stateLayer.hoveredOpacity
130
204
  )
131
205
  },
132
206
  hoveredTonal: {
133
- backgroundColor: (0, import_utils.blendColor)(
207
+ backgroundColor: blendColor(
134
208
  theme.colors.secondaryContainer,
135
209
  theme.colors.onSecondaryContainer,
136
210
  theme.stateLayer.hoveredOpacity
137
211
  )
138
212
  },
139
213
  hoveredTonalToggleUnselected: {
140
- backgroundColor: (0, import_utils.blendColor)(
214
+ backgroundColor: blendColor(
141
215
  toggleUnselectedContainerColor,
142
216
  theme.colors.onSurfaceVariant,
143
217
  theme.stateLayer.hoveredOpacity
144
218
  )
145
219
  },
146
220
  hoveredTonalToggleSelected: {
147
- backgroundColor: (0, import_utils.blendColor)(
221
+ backgroundColor: blendColor(
148
222
  theme.colors.secondaryContainer,
149
223
  theme.colors.onSecondaryContainer,
150
224
  theme.stateLayer.hoveredOpacity
151
225
  )
152
226
  },
153
227
  hoveredOutlined: {
154
- backgroundColor: (0, import_utils.alphaColor)(
228
+ backgroundColor: alphaColor(
155
229
  theme.colors.onSurfaceVariant,
156
230
  theme.stateLayer.hoveredOpacity
157
231
  )
158
232
  },
159
233
  hoveredOutlinedToggleUnselected: {
160
- backgroundColor: (0, import_utils.alphaColor)(
234
+ backgroundColor: alphaColor(
161
235
  theme.colors.onSurfaceVariant,
162
236
  theme.stateLayer.hoveredOpacity
163
237
  )
164
238
  },
165
239
  hoveredOutlinedToggleSelected: {
166
- backgroundColor: (0, import_utils.blendColor)(
240
+ backgroundColor: blendColor(
167
241
  theme.colors.inverseSurface,
168
242
  theme.colors.inverseOnSurface,
169
243
  theme.stateLayer.hoveredOpacity
170
244
  )
171
245
  },
172
246
  hoveredStandard: {
173
- backgroundColor: (0, import_utils.alphaColor)(
247
+ backgroundColor: alphaColor(
174
248
  theme.colors.onSurfaceVariant,
175
249
  theme.stateLayer.hoveredOpacity
176
250
  )
177
251
  },
178
252
  hoveredStandardToggleUnselected: {
179
- backgroundColor: (0, import_utils.alphaColor)(
253
+ backgroundColor: alphaColor(
180
254
  theme.colors.onSurfaceVariant,
181
255
  theme.stateLayer.hoveredOpacity
182
256
  )
183
257
  },
184
258
  hoveredStandardToggleSelected: {
185
- backgroundColor: (0, import_utils.alphaColor)(
259
+ backgroundColor: alphaColor(
186
260
  theme.colors.primary,
187
261
  theme.stateLayer.hoveredOpacity
188
262
  )
189
263
  },
190
264
  // Pressed states (M3: 12% state layer)
191
265
  pressedFilled: {
192
- backgroundColor: (0, import_utils.blendColor)(
266
+ backgroundColor: blendColor(
193
267
  theme.colors.primary,
194
268
  theme.colors.onPrimary,
195
269
  theme.stateLayer.pressedOpacity
196
270
  )
197
271
  },
198
272
  pressedFilledToggleUnselected: {
199
- backgroundColor: (0, import_utils.blendColor)(
273
+ backgroundColor: blendColor(
200
274
  toggleUnselectedContainerColor,
201
275
  theme.colors.primary,
202
276
  theme.stateLayer.pressedOpacity
203
277
  )
204
278
  },
205
279
  pressedFilledToggleSelected: {
206
- backgroundColor: (0, import_utils.blendColor)(
280
+ backgroundColor: blendColor(
207
281
  theme.colors.primary,
208
282
  theme.colors.onPrimary,
209
283
  theme.stateLayer.pressedOpacity
210
284
  )
211
285
  },
212
286
  pressedTonal: {
213
- backgroundColor: (0, import_utils.blendColor)(
287
+ backgroundColor: blendColor(
214
288
  theme.colors.secondaryContainer,
215
289
  theme.colors.onSecondaryContainer,
216
290
  theme.stateLayer.pressedOpacity
217
291
  )
218
292
  },
219
293
  pressedTonalToggleUnselected: {
220
- backgroundColor: (0, import_utils.blendColor)(
294
+ backgroundColor: blendColor(
221
295
  toggleUnselectedContainerColor,
222
296
  theme.colors.onSurfaceVariant,
223
297
  theme.stateLayer.pressedOpacity
224
298
  )
225
299
  },
226
300
  pressedTonalToggleSelected: {
227
- backgroundColor: (0, import_utils.blendColor)(
301
+ backgroundColor: blendColor(
228
302
  theme.colors.secondaryContainer,
229
303
  theme.colors.onSecondaryContainer,
230
304
  theme.stateLayer.pressedOpacity
231
305
  )
232
306
  },
233
307
  pressedOutlined: {
234
- backgroundColor: (0, import_utils.alphaColor)(
308
+ backgroundColor: alphaColor(
235
309
  theme.colors.onSurfaceVariant,
236
310
  theme.stateLayer.pressedOpacity
237
311
  )
238
312
  },
239
313
  pressedOutlinedToggleUnselected: {
240
- backgroundColor: (0, import_utils.alphaColor)(
314
+ backgroundColor: alphaColor(
241
315
  theme.colors.onSurfaceVariant,
242
316
  theme.stateLayer.pressedOpacity
243
317
  )
244
318
  },
245
319
  pressedOutlinedToggleSelected: {
246
- backgroundColor: (0, import_utils.blendColor)(
320
+ backgroundColor: blendColor(
247
321
  theme.colors.inverseSurface,
248
322
  theme.colors.inverseOnSurface,
249
323
  theme.stateLayer.pressedOpacity
250
324
  )
251
325
  },
252
326
  pressedStandard: {
253
- backgroundColor: (0, import_utils.alphaColor)(
327
+ backgroundColor: alphaColor(
254
328
  theme.colors.onSurfaceVariant,
255
329
  theme.stateLayer.pressedOpacity
256
330
  )
257
331
  },
258
332
  pressedStandardToggleUnselected: {
259
- backgroundColor: (0, import_utils.alphaColor)(
333
+ backgroundColor: alphaColor(
260
334
  theme.colors.onSurfaceVariant,
261
335
  theme.stateLayer.pressedOpacity
262
336
  )
263
337
  },
264
338
  pressedStandardToggleSelected: {
265
- backgroundColor: (0, import_utils.alphaColor)(
339
+ backgroundColor: alphaColor(
266
340
  theme.colors.primary,
267
341
  theme.stateLayer.pressedOpacity
268
342
  )
@@ -295,7 +369,7 @@ function createStyles(theme) {
295
369
  var import_jsx_runtime = require("react/jsx-runtime");
296
370
  function getIconColor(variant, theme, disabled, isToggle, selected) {
297
371
  if (disabled) {
298
- return (0, import_utils2.alphaColor)(theme.colors.onSurface, 0.38);
372
+ return alphaColor(theme.colors.onSurface, 0.38);
299
373
  }
300
374
  if (isToggle) {
301
375
  if (variant === "filled") {
@@ -445,7 +519,7 @@ function IconButton({
445
519
  ...props
446
520
  }) {
447
521
  var _a;
448
- const MaterialCommunityIcons = (0, import_utils2.getMaterialCommunityIcons)();
522
+ const MaterialCommunityIcons = getMaterialCommunityIcons();
449
523
  const theme = (0, import_core.useTheme)();
450
524
  const styles = (0, import_react.useMemo)(() => createStyles(theme), [theme]);
451
525
  const isDisabled = Boolean(disabled);
@@ -465,14 +539,14 @@ function IconButton({
465
539
  borderWidth: 0
466
540
  },
467
541
  hovered: {
468
- backgroundColor: (0, import_utils2.blendColor)(
542
+ backgroundColor: blendColor(
469
543
  containerColor,
470
544
  overlay,
471
545
  theme.stateLayer.hoveredOpacity
472
546
  )
473
547
  },
474
548
  pressed: {
475
- backgroundColor: (0, import_utils2.blendColor)(
549
+ backgroundColor: blendColor(
476
550
  containerColor,
477
551
  overlay,
478
552
  theme.stateLayer.pressedOpacity
@@ -481,7 +555,7 @@ function IconButton({
481
555
  };
482
556
  }, [containerColor, resolvedIconColor, theme.stateLayer]);
483
557
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
484
- import_react_native2.Pressable,
558
+ import_react_native4.Pressable,
485
559
  {
486
560
  ...props,
487
561
  accessibilityRole: "button",
@@ -524,7 +598,7 @@ function IconButton({
524
598
 
525
599
  // src/typography/Typography.tsx
526
600
  var import_react2 = require("react");
527
- var import_react_native3 = require("react-native");
601
+ var import_react_native5 = require("react-native");
528
602
  var import_core2 = require("@onlynative/core");
529
603
  var import_jsx_runtime2 = require("react/jsx-runtime");
530
604
  var HEADING_VARIANTS = /* @__PURE__ */ new Set([
@@ -540,7 +614,7 @@ function Typography({
540
614
  variant = "bodyMedium",
541
615
  color,
542
616
  style,
543
- as: Component = import_react_native3.Text,
617
+ as: Component = import_react_native5.Text,
544
618
  accessibilityRole,
545
619
  ...textProps
546
620
  }) {
@@ -549,7 +623,7 @@ function Typography({
549
623
  const resolvedRole = accessibilityRole != null ? accessibilityRole : HEADING_VARIANTS.has(variant) ? "header" : void 0;
550
624
  const lineHeightFix = (0, import_react2.useMemo)(() => {
551
625
  if (!style) return void 0;
552
- const flat = import_react_native3.StyleSheet.flatten(style);
626
+ const flat = import_react_native5.StyleSheet.flatten(style);
553
627
  if (!(flat == null ? void 0 : flat.fontSize) || flat.lineHeight) return void 0;
554
628
  const ratio = typographyStyle.lineHeight / typographyStyle.fontSize;
555
629
  return { lineHeight: Math.ceil(flat.fontSize * ratio) };
@@ -571,27 +645,77 @@ function Typography({
571
645
  );
572
646
  }
573
647
 
574
- // src/appbar/AppBar.tsx
575
- var import_utils3 = require("@onlynative/utils");
576
-
577
648
  // src/appbar/styles.ts
578
- var import_react_native4 = require("react-native");
649
+ var import_react_native6 = require("react-native");
579
650
  var import_core3 = require("@onlynative/core");
580
- function createStyles2(theme) {
651
+ function getColorSchemeColors(theme, colorScheme) {
652
+ switch (colorScheme) {
653
+ case "surfaceContainerLowest":
654
+ return {
655
+ containerColor: theme.colors.surfaceContainerLowest,
656
+ elevatedContainerColor: theme.colors.surfaceContainerLowest,
657
+ contentColor: theme.colors.onSurface
658
+ };
659
+ case "surfaceContainerLow":
660
+ return {
661
+ containerColor: theme.colors.surfaceContainerLow,
662
+ elevatedContainerColor: theme.colors.surfaceContainerLow,
663
+ contentColor: theme.colors.onSurface
664
+ };
665
+ case "surfaceContainer":
666
+ return {
667
+ containerColor: theme.colors.surfaceContainer,
668
+ elevatedContainerColor: theme.colors.surfaceContainer,
669
+ contentColor: theme.colors.onSurface
670
+ };
671
+ case "surfaceContainerHigh":
672
+ return {
673
+ containerColor: theme.colors.surfaceContainerHigh,
674
+ elevatedContainerColor: theme.colors.surfaceContainerHigh,
675
+ contentColor: theme.colors.onSurface
676
+ };
677
+ case "surfaceContainerHighest":
678
+ return {
679
+ containerColor: theme.colors.surfaceContainerHighest,
680
+ elevatedContainerColor: theme.colors.surfaceContainerHighest,
681
+ contentColor: theme.colors.onSurface
682
+ };
683
+ case "primary":
684
+ return {
685
+ containerColor: theme.colors.primary,
686
+ elevatedContainerColor: theme.colors.primary,
687
+ contentColor: theme.colors.onPrimary
688
+ };
689
+ case "primaryContainer":
690
+ return {
691
+ containerColor: theme.colors.primaryContainer,
692
+ elevatedContainerColor: theme.colors.primaryContainer,
693
+ contentColor: theme.colors.onPrimaryContainer
694
+ };
695
+ case "surface":
696
+ default:
697
+ return {
698
+ containerColor: theme.colors.surface,
699
+ elevatedContainerColor: theme.colors.surfaceContainer,
700
+ contentColor: theme.colors.onSurface
701
+ };
702
+ }
703
+ }
704
+ function createStyles2(theme, schemeColors) {
581
705
  var _a;
582
706
  const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core3.defaultTopAppBarTokens;
583
- return import_react_native4.StyleSheet.create({
707
+ return import_react_native6.StyleSheet.create({
584
708
  root: {
585
- backgroundColor: theme.colors.surface
709
+ backgroundColor: schemeColors.containerColor
586
710
  },
587
711
  safeArea: {
588
- backgroundColor: theme.colors.surface
712
+ backgroundColor: schemeColors.containerColor
589
713
  },
590
714
  elevatedRoot: {
591
- backgroundColor: theme.colors.surfaceContainer
715
+ backgroundColor: schemeColors.elevatedContainerColor
592
716
  },
593
717
  elevatedSafeArea: {
594
- backgroundColor: theme.colors.surfaceContainer
718
+ backgroundColor: schemeColors.elevatedContainerColor
595
719
  },
596
720
  smallContainer: {
597
721
  height: topAppBar.smallContainerHeight,
@@ -669,10 +793,10 @@ function createStyles2(theme) {
669
793
  // src/appbar/AppBar.tsx
670
794
  var import_jsx_runtime3 = require("react/jsx-runtime");
671
795
  function getBackIcon() {
672
- if (import_react_native5.Platform.OS === "ios") {
673
- return (0, import_utils3.selectRTL)("chevron-left", "chevron-right");
796
+ if (import_react_native7.Platform.OS === "ios") {
797
+ return selectRTL("chevron-left", "chevron-right");
674
798
  }
675
- return (0, import_utils3.selectRTL)("arrow-left", "arrow-right");
799
+ return selectRTL("arrow-left", "arrow-right");
676
800
  }
677
801
  var titleVariantBySize = {
678
802
  small: "titleLarge",
@@ -700,7 +824,7 @@ function withTopInset(enabled, content, style) {
700
824
  if (enabled) {
701
825
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_safe_area_context.SafeAreaView, { edges: ["top"], style, children: content });
702
826
  }
703
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native5.View, { style, children: content });
827
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style, children: content });
704
828
  }
705
829
  function measureWidth(event) {
706
830
  return Math.round(event.nativeEvent.layout.width);
@@ -708,6 +832,7 @@ function measureWidth(event) {
708
832
  function AppBar({
709
833
  title,
710
834
  variant = "small",
835
+ colorScheme = "surface",
711
836
  canGoBack = false,
712
837
  onBackPress,
713
838
  insetTop = false,
@@ -723,12 +848,20 @@ function AppBar({
723
848
  var _a;
724
849
  const theme = (0, import_core4.useTheme)();
725
850
  const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core4.defaultTopAppBarTokens;
726
- const styles = (0, import_react3.useMemo)(() => createStyles2(theme), [theme]);
851
+ const schemeColors = (0, import_react3.useMemo)(
852
+ () => getColorSchemeColors(theme, colorScheme),
853
+ [theme, colorScheme]
854
+ );
855
+ const resolvedContentColor = contentColor != null ? contentColor : schemeColors.contentColor;
856
+ const styles = (0, import_react3.useMemo)(
857
+ () => createStyles2(theme, schemeColors),
858
+ [theme, schemeColors]
859
+ );
727
860
  const [leadingWidth, setLeadingWidth] = (0, import_react3.useState)(0);
728
861
  const [actionsWidth, setActionsWidth] = (0, import_react3.useState)(0);
729
862
  const titleColorStyle = (0, import_react3.useMemo)(
730
- () => ({ color: contentColor != null ? contentColor : theme.colors.onSurface }),
731
- [contentColor, theme.colors.onSurface]
863
+ () => ({ color: resolvedContentColor }),
864
+ [resolvedContentColor]
732
865
  );
733
866
  const size = resolveSize(variant);
734
867
  const titleVariant = titleVariantBySize[size];
@@ -752,25 +885,18 @@ function AppBar({
752
885
  if (!canGoBack) {
753
886
  return null;
754
887
  }
755
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native5.View, { style: styles.iconFrame, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
888
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: styles.iconFrame, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
756
889
  IconButton,
757
890
  {
758
891
  icon: getBackIcon(),
759
892
  size: "medium",
760
893
  variant: "standard",
761
- iconColor: contentColor != null ? contentColor : theme.colors.onSurface,
894
+ iconColor: resolvedContentColor,
762
895
  accessibilityLabel: "Go back",
763
896
  onPress: onBackPress
764
897
  }
765
898
  ) });
766
- }, [
767
- canGoBack,
768
- contentColor,
769
- leading,
770
- onBackPress,
771
- styles.iconFrame,
772
- theme.colors.onSurface
773
- ]);
899
+ }, [canGoBack, resolvedContentColor, leading, onBackPress, styles.iconFrame]);
774
900
  const actionsContent = (0, import_react3.useMemo)(() => {
775
901
  if (trailing) {
776
902
  return trailing;
@@ -778,8 +904,8 @@ function AppBar({
778
904
  if (!actions || actions.length === 0) {
779
905
  return null;
780
906
  }
781
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native5.View, { style: styles.actionsRow, children: actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
782
- import_react_native5.View,
907
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: styles.actionsRow, children: actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
908
+ import_react_native7.View,
783
909
  {
784
910
  style: styles.iconFrame,
785
911
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -788,7 +914,7 @@ function AppBar({
788
914
  icon: action.icon,
789
915
  size: "medium",
790
916
  variant: "standard",
791
- iconColor: contentColor,
917
+ iconColor: resolvedContentColor,
792
918
  accessibilityLabel: action.accessibilityLabel,
793
919
  onPress: action.onPress,
794
920
  disabled: action.disabled
@@ -797,7 +923,7 @@ function AppBar({
797
923
  },
798
924
  `${String(action.icon)}-${index}`
799
925
  )) });
800
- }, [actions, contentColor, styles.actionsRow, styles.iconFrame, trailing]);
926
+ }, [actions, resolvedContentColor, styles.actionsRow, styles.iconFrame, trailing]);
801
927
  const onLeadingLayout = (0, import_react3.useCallback)((event) => {
802
928
  const nextWidth = measureWidth(event);
803
929
  setLeadingWidth((currentWidth) => {
@@ -816,9 +942,9 @@ function AppBar({
816
942
  return nextWidth;
817
943
  });
818
944
  }, []);
819
- const topRow = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native5.View, { style: styles.topRow, children: [
945
+ const topRow = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: styles.topRow, children: [
820
946
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
821
- import_react_native5.View,
947
+ import_react_native7.View,
822
948
  {
823
949
  collapsable: false,
824
950
  onLayout: onLeadingLayout,
@@ -826,9 +952,9 @@ function AppBar({
826
952
  children: leadingContent
827
953
  }
828
954
  ),
829
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native5.View, { style: styles.topRowSpacer }),
955
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: styles.topRowSpacer }),
830
956
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
831
- import_react_native5.View,
957
+ import_react_native7.View,
832
958
  {
833
959
  collapsable: false,
834
960
  onLayout: onActionsLayout,
@@ -850,10 +976,10 @@ function AppBar({
850
976
  containerOverride
851
977
  ];
852
978
  if (isExpanded) {
853
- const content2 = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native5.View, { style: [styles.expandedContainer, getSizeStyle2(styles, size)], children: [
979
+ const content2 = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: [styles.expandedContainer, getSizeStyle2(styles, size)], children: [
854
980
  topRow,
855
981
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
856
- import_react_native5.View,
982
+ import_react_native7.View,
857
983
  {
858
984
  style: [
859
985
  styles.expandedTitleContainer,
@@ -877,11 +1003,11 @@ function AppBar({
877
1003
  }
878
1004
  )
879
1005
  ] });
880
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native5.View, { style: rootStyle, children: withTopInset(insetTop, content2, safeAreaStyle) });
1006
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: rootStyle, children: withTopInset(insetTop, content2, safeAreaStyle) });
881
1007
  }
882
- const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native5.View, { style: styles.smallContainer, children: [
1008
+ const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: styles.smallContainer, children: [
883
1009
  topRow,
884
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native5.View, { style: [styles.overlayTitleContainer, overlayTitleInsetStyle], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1010
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [styles.overlayTitleContainer, overlayTitleInsetStyle], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
885
1011
  Typography,
886
1012
  {
887
1013
  ...APP_BAR_TITLE_TEXT_PROPS,
@@ -896,7 +1022,7 @@ function AppBar({
896
1022
  }
897
1023
  ) })
898
1024
  ] });
899
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native5.View, { style: rootStyle, children: withTopInset(insetTop, content, safeAreaStyle) });
1025
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: rootStyle, children: withTopInset(insetTop, content, safeAreaStyle) });
900
1026
  }
901
1027
  // Annotate the CommonJS export names for ESM import in node:
902
1028
  0 && (module.exports = {