@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.
- package/lib/commonjs/badge/Badge.js +5 -1
- package/lib/commonjs/badge/Badge.js.map +1 -1
- package/lib/commonjs/button/Button.js +1 -1
- package/lib/commonjs/button/Button.js.map +1 -1
- package/lib/commonjs/checkbox/Checkbox.js +5 -1
- package/lib/commonjs/checkbox/Checkbox.js.map +1 -1
- package/lib/commonjs/chip/Chip.js +6 -1
- package/lib/commonjs/chip/Chip.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.js +2 -2
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +2 -2
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/hooks/mergeRefs.js +11 -0
- package/lib/commonjs/hooks/mergeRefs.js.map +1 -1
- package/lib/commonjs/prompt-input/SubmitButton.js +2 -2
- package/lib/commonjs/prompt-input/SubmitButton.js.map +1 -1
- package/lib/commonjs/radio-indicator/RadioIndicator.js +5 -1
- package/lib/commonjs/radio-indicator/RadioIndicator.js.map +1 -1
- package/lib/commonjs/tabs/Tabs.js +1 -1
- package/lib/commonjs/tabs/Tabs.js.map +1 -1
- package/lib/commonjs/text-field/index.js +16 -12
- package/lib/commonjs/text-field/index.js.map +1 -1
- package/lib/commonjs/theme/BloomThemeProvider.js +2 -0
- package/lib/commonjs/theme/BloomThemeProvider.js.map +1 -1
- package/lib/commonjs/theme/adaptive-colors.js +2 -0
- package/lib/commonjs/theme/adaptive-colors.js.map +1 -1
- package/lib/module/badge/Badge.js +5 -1
- package/lib/module/badge/Badge.js.map +1 -1
- package/lib/module/button/Button.js +1 -1
- package/lib/module/button/Button.js.map +1 -1
- package/lib/module/checkbox/Checkbox.js +5 -1
- package/lib/module/checkbox/Checkbox.js.map +1 -1
- package/lib/module/chip/Chip.js +6 -1
- package/lib/module/chip/Chip.js.map +1 -1
- package/lib/module/dialog/Dialog.js +2 -2
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +2 -2
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/hooks/mergeRefs.js +11 -0
- package/lib/module/hooks/mergeRefs.js.map +1 -1
- package/lib/module/prompt-input/SubmitButton.js +2 -2
- package/lib/module/prompt-input/SubmitButton.js.map +1 -1
- package/lib/module/radio-indicator/RadioIndicator.js +5 -1
- package/lib/module/radio-indicator/RadioIndicator.js.map +1 -1
- package/lib/module/tabs/Tabs.js +1 -1
- package/lib/module/tabs/Tabs.js.map +1 -1
- package/lib/module/text-field/index.js +16 -12
- package/lib/module/text-field/index.js.map +1 -1
- package/lib/module/theme/BloomThemeProvider.js +2 -0
- package/lib/module/theme/BloomThemeProvider.js.map +1 -1
- package/lib/module/theme/adaptive-colors.js +2 -0
- package/lib/module/theme/adaptive-colors.js.map +1 -1
- package/lib/typescript/commonjs/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/commonjs/checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/commonjs/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/mergeRefs.d.ts +13 -2
- package/lib/typescript/commonjs/hooks/mergeRefs.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio-indicator/RadioIndicator.d.ts.map +1 -1
- package/lib/typescript/commonjs/text-field/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/adaptive-colors.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +1 -0
- package/lib/typescript/commonjs/theme/types.d.ts.map +1 -1
- package/lib/typescript/module/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/module/checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/module/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/module/hooks/mergeRefs.d.ts +13 -2
- package/lib/typescript/module/hooks/mergeRefs.d.ts.map +1 -1
- package/lib/typescript/module/radio-indicator/RadioIndicator.d.ts.map +1 -1
- package/lib/typescript/module/text-field/index.d.ts.map +1 -1
- package/lib/typescript/module/theme/BloomThemeProvider.d.ts.map +1 -1
- package/lib/typescript/module/theme/adaptive-colors.d.ts.map +1 -1
- package/lib/typescript/module/theme/types.d.ts +1 -0
- package/lib/typescript/module/theme/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/theme.test.ts +20 -0
- package/src/badge/Badge.tsx +5 -1
- package/src/button/Button.tsx +1 -1
- package/src/checkbox/Checkbox.tsx +5 -1
- package/src/chip/Chip.tsx +6 -1
- package/src/dialog/Dialog.tsx +2 -2
- package/src/dialog/Dialog.web.tsx +2 -2
- package/src/hooks/mergeRefs.ts +15 -4
- package/src/prompt-input/SubmitButton.tsx +2 -2
- package/src/radio-indicator/RadioIndicator.tsx +5 -1
- package/src/tabs/Tabs.tsx +1 -1
- package/src/text-field/index.tsx +6 -7
- package/src/theme/BloomThemeProvider.tsx +2 -0
- package/src/theme/adaptive-colors.ts +2 -0
- package/src/theme/types.ts +1 -0
package/src/dialog/Dialog.tsx
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
337
|
+
return { background: colors.primary, foreground: colors.primaryForeground };
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
}
|
package/src/hooks/mergeRefs.ts
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import
|
|
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<
|
|
8
|
-
):
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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 =
|
|
157
|
+
base.color = theme.colors.primaryForeground;
|
|
158
158
|
} else if (isSelected) {
|
|
159
159
|
base.color = theme.colors.primary;
|
|
160
160
|
} else {
|
package/src/text-field/index.tsx
CHANGED
|
@@ -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
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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),
|