@oxyhq/bloom 0.6.6 → 0.6.8

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 (90) hide show
  1. package/lib/commonjs/badge/Badge.js +5 -1
  2. package/lib/commonjs/badge/Badge.js.map +1 -1
  3. package/lib/commonjs/button/Button.js +1 -1
  4. package/lib/commonjs/button/Button.js.map +1 -1
  5. package/lib/commonjs/checkbox/Checkbox.js +5 -1
  6. package/lib/commonjs/checkbox/Checkbox.js.map +1 -1
  7. package/lib/commonjs/chip/Chip.js +6 -1
  8. package/lib/commonjs/chip/Chip.js.map +1 -1
  9. package/lib/commonjs/dialog/Dialog.js +2 -2
  10. package/lib/commonjs/dialog/Dialog.js.map +1 -1
  11. package/lib/commonjs/dialog/Dialog.web.js +2 -2
  12. package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
  13. package/lib/commonjs/hooks/mergeRefs.js +11 -0
  14. package/lib/commonjs/hooks/mergeRefs.js.map +1 -1
  15. package/lib/commonjs/prompt-input/SubmitButton.js +2 -2
  16. package/lib/commonjs/prompt-input/SubmitButton.js.map +1 -1
  17. package/lib/commonjs/radio-indicator/RadioIndicator.js +5 -1
  18. package/lib/commonjs/radio-indicator/RadioIndicator.js.map +1 -1
  19. package/lib/commonjs/tabs/Tabs.js +1 -1
  20. package/lib/commonjs/tabs/Tabs.js.map +1 -1
  21. package/lib/commonjs/text-field/index.js +16 -12
  22. package/lib/commonjs/text-field/index.js.map +1 -1
  23. package/lib/commonjs/theme/BloomThemeProvider.js +2 -0
  24. package/lib/commonjs/theme/BloomThemeProvider.js.map +1 -1
  25. package/lib/commonjs/theme/adaptive-colors.js +2 -0
  26. package/lib/commonjs/theme/adaptive-colors.js.map +1 -1
  27. package/lib/module/badge/Badge.js +5 -1
  28. package/lib/module/badge/Badge.js.map +1 -1
  29. package/lib/module/button/Button.js +1 -1
  30. package/lib/module/button/Button.js.map +1 -1
  31. package/lib/module/checkbox/Checkbox.js +5 -1
  32. package/lib/module/checkbox/Checkbox.js.map +1 -1
  33. package/lib/module/chip/Chip.js +6 -1
  34. package/lib/module/chip/Chip.js.map +1 -1
  35. package/lib/module/dialog/Dialog.js +2 -2
  36. package/lib/module/dialog/Dialog.js.map +1 -1
  37. package/lib/module/dialog/Dialog.web.js +2 -2
  38. package/lib/module/dialog/Dialog.web.js.map +1 -1
  39. package/lib/module/hooks/mergeRefs.js +11 -0
  40. package/lib/module/hooks/mergeRefs.js.map +1 -1
  41. package/lib/module/prompt-input/SubmitButton.js +2 -2
  42. package/lib/module/prompt-input/SubmitButton.js.map +1 -1
  43. package/lib/module/radio-indicator/RadioIndicator.js +5 -1
  44. package/lib/module/radio-indicator/RadioIndicator.js.map +1 -1
  45. package/lib/module/tabs/Tabs.js +1 -1
  46. package/lib/module/tabs/Tabs.js.map +1 -1
  47. package/lib/module/text-field/index.js +16 -12
  48. package/lib/module/text-field/index.js.map +1 -1
  49. package/lib/module/theme/BloomThemeProvider.js +2 -0
  50. package/lib/module/theme/BloomThemeProvider.js.map +1 -1
  51. package/lib/module/theme/adaptive-colors.js +2 -0
  52. package/lib/module/theme/adaptive-colors.js.map +1 -1
  53. package/lib/typescript/commonjs/badge/Badge.d.ts.map +1 -1
  54. package/lib/typescript/commonjs/checkbox/Checkbox.d.ts.map +1 -1
  55. package/lib/typescript/commonjs/chip/Chip.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/hooks/mergeRefs.d.ts +13 -2
  57. package/lib/typescript/commonjs/hooks/mergeRefs.d.ts.map +1 -1
  58. package/lib/typescript/commonjs/radio-indicator/RadioIndicator.d.ts.map +1 -1
  59. package/lib/typescript/commonjs/text-field/index.d.ts.map +1 -1
  60. package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/theme/adaptive-colors.d.ts.map +1 -1
  62. package/lib/typescript/commonjs/theme/types.d.ts +1 -0
  63. package/lib/typescript/commonjs/theme/types.d.ts.map +1 -1
  64. package/lib/typescript/module/badge/Badge.d.ts.map +1 -1
  65. package/lib/typescript/module/checkbox/Checkbox.d.ts.map +1 -1
  66. package/lib/typescript/module/chip/Chip.d.ts.map +1 -1
  67. package/lib/typescript/module/hooks/mergeRefs.d.ts +13 -2
  68. package/lib/typescript/module/hooks/mergeRefs.d.ts.map +1 -1
  69. package/lib/typescript/module/radio-indicator/RadioIndicator.d.ts.map +1 -1
  70. package/lib/typescript/module/text-field/index.d.ts.map +1 -1
  71. package/lib/typescript/module/theme/BloomThemeProvider.d.ts.map +1 -1
  72. package/lib/typescript/module/theme/adaptive-colors.d.ts.map +1 -1
  73. package/lib/typescript/module/theme/types.d.ts +1 -0
  74. package/lib/typescript/module/theme/types.d.ts.map +1 -1
  75. package/package.json +1 -1
  76. package/src/__tests__/theme.test.ts +20 -0
  77. package/src/badge/Badge.tsx +5 -1
  78. package/src/button/Button.tsx +1 -1
  79. package/src/checkbox/Checkbox.tsx +5 -1
  80. package/src/chip/Chip.tsx +6 -1
  81. package/src/dialog/Dialog.tsx +2 -2
  82. package/src/dialog/Dialog.web.tsx +2 -2
  83. package/src/hooks/mergeRefs.ts +15 -4
  84. package/src/prompt-input/SubmitButton.tsx +2 -2
  85. package/src/radio-indicator/RadioIndicator.tsx +5 -1
  86. package/src/tabs/Tabs.tsx +1 -1
  87. package/src/text-field/index.tsx +6 -7
  88. package/src/theme/BloomThemeProvider.tsx +2 -0
  89. package/src/theme/adaptive-colors.ts +2 -0
  90. package/src/theme/types.ts +1 -0
@@ -256,11 +256,11 @@ function getActionPalette(
256
256
  case 'cancel':
257
257
  return { background: colors.contrast50, foreground: colors.text };
258
258
  case 'default':
259
- return { background: colors.primary, foreground: '#FFFFFF' };
259
+ return { background: colors.primary, foreground: colors.primaryForeground };
260
260
  /* c8 ignore next 2 -- TS exhaustiveness check guards this branch */
261
261
  default: {
262
262
  const _exhaustive: never = color;
263
- return { background: colors.primary, foreground: '#FFFFFF' };
263
+ return { background: colors.primary, foreground: colors.primaryForeground };
264
264
  }
265
265
  }
266
266
  }
@@ -330,11 +330,11 @@ function getActionPalette(
330
330
  case 'cancel':
331
331
  return { background: colors.contrast50, foreground: colors.text };
332
332
  case 'default':
333
- return { background: colors.primary, foreground: '#FFFFFF' };
333
+ return { background: colors.primary, foreground: colors.primaryForeground };
334
334
  /* c8 ignore next 3 -- TS exhaustiveness guard */
335
335
  default: {
336
336
  const _exhaustive: never = color;
337
- return { background: colors.primary, foreground: '#FFFFFF' };
337
+ return { background: colors.primary, foreground: colors.primaryForeground };
338
338
  }
339
339
  }
340
340
  }
@@ -1,17 +1,28 @@
1
- import React from 'react';
1
+ import type { Ref, RefObject } from 'react';
2
2
 
3
3
  /**
4
4
  * Merges multiple React refs into a single callback ref.
5
+ *
6
+ * The returned callback is annotated as `(instance: T | null) => void`
7
+ * rather than `React.RefCallback<T>`. `RefCallback<T>` permits a cleanup
8
+ * return (`() => VoidOrUndefinedOnly`), and `VoidOrUndefinedOnly` is built on
9
+ * a `unique symbol` that is distinct per copy of `@types/react`. When a
10
+ * consumer resolves two copies of the React types (e.g. Bloom's pinned
11
+ * `@types/react` and the app's own), TypeScript reports the cleanup branch as
12
+ * "two different types with this name exist, but they are unrelated" and the
13
+ * host element's `ref` overload fails to match. A plain `void` return carries
14
+ * no copy-specific identity, so the callback stays assignable to `Ref<T>` from
15
+ * any copy of the types.
5
16
  */
6
17
  export function mergeRefs<T>(
7
- refs: Array<React.Ref<T> | null | undefined>,
8
- ): React.RefCallback<T> {
18
+ refs: Array<Ref<T> | null | undefined>,
19
+ ): (instance: T | null) => void {
9
20
  return (instance: T | null) => {
10
21
  for (const ref of refs) {
11
22
  if (typeof ref === 'function') {
12
23
  ref(instance);
13
24
  } else if (ref != null) {
14
- (ref as React.MutableRefObject<T | null>).current = instance;
25
+ (ref as RefObject<T | null>).current = instance;
15
26
  }
16
27
  }
17
28
  };
@@ -37,7 +37,7 @@ export function PromptInputSubmitButton({
37
37
  testID={testID}
38
38
  >
39
39
  {stopIcon ?? (
40
- <Text style={{ fontSize: 12, color: '#FFFFFF', fontWeight: '700' }}>■</Text>
40
+ <Text style={{ fontSize: 12, color: theme.colors.primaryForeground, fontWeight: '700' }}>■</Text>
41
41
  )}
42
42
  </TouchableOpacity>
43
43
  );
@@ -67,7 +67,7 @@ export function PromptInputSubmitButton({
67
67
  testID={testID}
68
68
  >
69
69
  {submitIcon ?? (
70
- <Text style={{ fontSize: 16, color: '#FFFFFF', fontWeight: '700' }}>↑</Text>
70
+ <Text style={{ fontSize: 16, color: theme.colors.primaryForeground, fontWeight: '700' }}>↑</Text>
71
71
  )}
72
72
  </TouchableOpacity>
73
73
  );
@@ -15,6 +15,10 @@ const RadioIndicatorComponent: React.FC<RadioIndicatorProps> = ({
15
15
  const theme = useTheme();
16
16
  const resolvedSelectedColor = selectedColor ?? theme.colors.primary;
17
17
  const resolvedBorderColor = borderColor ?? theme.colors.border;
18
+ // The inner dot sits on `resolvedSelectedColor`. When that is the theme
19
+ // primary, use the preset's readable foreground (white for blue, black for
20
+ // yellow). A caller-supplied custom color falls back to white.
21
+ const dotColor = selectedColor == null ? theme.colors.primaryForeground : '#FFFFFF';
18
22
  const dotSize = size * 0.5;
19
23
 
20
24
  return (
@@ -40,7 +44,7 @@ const RadioIndicatorComponent: React.FC<RadioIndicatorProps> = ({
40
44
  width: dotSize,
41
45
  height: dotSize,
42
46
  borderRadius: dotSize / 2,
43
- backgroundColor: '#FFFFFF',
47
+ backgroundColor: dotColor,
44
48
  }}
45
49
  />
46
50
  )}
package/src/tabs/Tabs.tsx CHANGED
@@ -154,7 +154,7 @@ const TabComponent: React.FC<TabProps> = ({
154
154
  };
155
155
 
156
156
  if (variant === 'outlined' && isSelected) {
157
- base.color = '#fff';
157
+ base.color = theme.colors.primaryForeground;
158
158
  } else if (isSelected) {
159
159
  base.color = theme.colors.primary;
160
160
  } else {
@@ -22,7 +22,7 @@ import {
22
22
  type TextStyleProp,
23
23
  type ViewStyleProp,
24
24
  } from '../styles';
25
- import { type Props as SVGIconProps } from '../icons/common';
25
+ import { type IconStyle, type Props as SVGIconProps } from '../icons/common';
26
26
  import { Text } from '../typography';
27
27
 
28
28
  const Context = createContext<{
@@ -270,12 +270,11 @@ export function Icon({ icon: Comp }: { icon: React.ComponentType<SVGIconProps> }
270
270
  const ctx = useContext(Context);
271
271
 
272
272
  const { hover, focus, errorHover, errorFocus } = useMemo(() => {
273
- return {
274
- hover: { color: theme.colors.text } as TextStyle,
275
- focus: { color: theme.colors.primary } as TextStyle,
276
- errorHover: { color: theme.colors.error } as TextStyle,
277
- errorFocus: { color: theme.colors.error } as TextStyle,
278
- };
273
+ const hover: IconStyle = { color: theme.colors.text };
274
+ const focus: IconStyle = { color: theme.colors.primary };
275
+ const errorHover: IconStyle = { color: theme.colors.error };
276
+ const errorFocus: IconStyle = { color: theme.colors.error };
277
+ return { hover, focus, errorHover, errorFocus };
279
278
  }, [theme]);
280
279
 
281
280
  return (
@@ -53,6 +53,7 @@ export function buildTheme(appColor: AppColorName, resolved: 'light' | 'dark', i
53
53
  const mutedForeground = hslVarToCSS(vars['--muted-foreground'] ?? '0 0% 50%');
54
54
 
55
55
  const primaryColor = hslVarToCSS(vars['--primary'] ?? '0 0% 50%');
56
+ const primaryForeground = hslVarToCSS(vars['--primary-foreground'] ?? '0 0% 100%');
56
57
 
57
58
  themeColors = {
58
59
  background,
@@ -67,6 +68,7 @@ export function buildTheme(appColor: AppColorName, resolved: 'light' | 'dark', i
67
68
  borderLight: hslVarToCSS(vars['--input'] ?? '0 0% 20%'),
68
69
 
69
70
  primary: primaryColor,
71
+ primaryForeground,
70
72
  primaryLight: surface,
71
73
  primaryDark: background,
72
74
 
@@ -19,6 +19,7 @@ function getAndroidColors(): ThemeColors | null {
19
19
  border: c(d.outlineVariant),
20
20
  borderLight: c(d.outline),
21
21
  primary: c(d.primary),
22
+ primaryForeground: c(d.onPrimary),
22
23
  primaryLight: c(d.primaryContainer),
23
24
  primaryDark: c(d.onPrimaryContainer),
24
25
  secondary: c(d.secondary),
@@ -61,6 +62,7 @@ function getIOSColors(): ThemeColors | null {
61
62
  border: c(i.separator),
62
63
  borderLight: c(i.opaqueSeparator),
63
64
  primary: c(i.systemBlue),
65
+ primaryForeground: '#FFFFFF',
64
66
  primaryLight: c(i.systemGray6),
65
67
  primaryDark: c(i.systemBlue),
66
68
  secondary: c(i.systemPurple),
@@ -13,6 +13,7 @@ export interface ThemeColors {
13
13
  borderLight: string;
14
14
 
15
15
  primary: string;
16
+ primaryForeground: string;
16
17
  primaryLight: string;
17
18
  primaryDark: string;
18
19