@oxy.so/bloom 2.0.0 → 2.2.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 (92) hide show
  1. package/README.md +3 -3
  2. package/docs/auth-card.mdx +1 -1
  3. package/docs/migrating-to-2.0.mdx +21 -3
  4. package/docs/page-header.mdx +101 -0
  5. package/docs/social-button.mdx +20 -3
  6. package/lib/commonjs/index.js +128 -116
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/commonjs/index.web.js +128 -116
  9. package/lib/commonjs/index.web.js.map +1 -1
  10. package/lib/commonjs/page-header/PageHeader.js +286 -0
  11. package/lib/commonjs/page-header/PageHeader.js.map +1 -0
  12. package/lib/commonjs/page-header/index.js +13 -0
  13. package/lib/commonjs/page-header/index.js.map +1 -0
  14. package/lib/commonjs/page-header/types.js +6 -0
  15. package/lib/commonjs/page-header/types.js.map +1 -0
  16. package/lib/commonjs/social-button/OxyMark.js +61 -0
  17. package/lib/commonjs/social-button/OxyMark.js.map +1 -0
  18. package/lib/commonjs/social-button/SocialButton.js +26 -2
  19. package/lib/commonjs/social-button/SocialButton.js.map +1 -1
  20. package/lib/commonjs/social-button/index.js +6 -0
  21. package/lib/commonjs/social-button/index.js.map +1 -1
  22. package/lib/commonjs/social-button/providers.js +11 -0
  23. package/lib/commonjs/social-button/providers.js.map +1 -1
  24. package/lib/module/index.js +1 -0
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/module/index.web.js +1 -0
  27. package/lib/module/index.web.js.map +1 -1
  28. package/lib/module/page-header/PageHeader.js +281 -0
  29. package/lib/module/page-header/PageHeader.js.map +1 -0
  30. package/lib/module/page-header/index.js +4 -0
  31. package/lib/module/page-header/index.js.map +1 -0
  32. package/lib/module/page-header/types.js +4 -0
  33. package/lib/module/page-header/types.js.map +1 -0
  34. package/lib/module/social-button/OxyMark.js +55 -0
  35. package/lib/module/social-button/OxyMark.js.map +1 -0
  36. package/lib/module/social-button/SocialButton.js +25 -2
  37. package/lib/module/social-button/SocialButton.js.map +1 -1
  38. package/lib/module/social-button/index.js +1 -0
  39. package/lib/module/social-button/index.js.map +1 -1
  40. package/lib/module/social-button/providers.js +12 -0
  41. package/lib/module/social-button/providers.js.map +1 -1
  42. package/lib/typescript/commonjs/index.d.ts +1 -0
  43. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  44. package/lib/typescript/commonjs/index.web.d.ts +1 -0
  45. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  46. package/lib/typescript/commonjs/page-header/PageHeader.d.ts +6 -0
  47. package/lib/typescript/commonjs/page-header/PageHeader.d.ts.map +1 -0
  48. package/lib/typescript/commonjs/page-header/index.d.ts +3 -0
  49. package/lib/typescript/commonjs/page-header/index.d.ts.map +1 -0
  50. package/lib/typescript/commonjs/page-header/types.d.ts +55 -0
  51. package/lib/typescript/commonjs/page-header/types.d.ts.map +1 -0
  52. package/lib/typescript/commonjs/social-button/OxyMark.d.ts +17 -0
  53. package/lib/typescript/commonjs/social-button/OxyMark.d.ts.map +1 -0
  54. package/lib/typescript/commonjs/social-button/SocialButton.d.ts +3 -1
  55. package/lib/typescript/commonjs/social-button/SocialButton.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/social-button/index.d.ts +2 -1
  57. package/lib/typescript/commonjs/social-button/index.d.ts.map +1 -1
  58. package/lib/typescript/commonjs/social-button/providers.d.ts +10 -0
  59. package/lib/typescript/commonjs/social-button/providers.d.ts.map +1 -1
  60. package/lib/typescript/commonjs/social-button/types.d.ts +10 -3
  61. package/lib/typescript/commonjs/social-button/types.d.ts.map +1 -1
  62. package/lib/typescript/module/index.d.ts +1 -0
  63. package/lib/typescript/module/index.d.ts.map +1 -1
  64. package/lib/typescript/module/index.web.d.ts +1 -0
  65. package/lib/typescript/module/index.web.d.ts.map +1 -1
  66. package/lib/typescript/module/page-header/PageHeader.d.ts +6 -0
  67. package/lib/typescript/module/page-header/PageHeader.d.ts.map +1 -0
  68. package/lib/typescript/module/page-header/index.d.ts +3 -0
  69. package/lib/typescript/module/page-header/index.d.ts.map +1 -0
  70. package/lib/typescript/module/page-header/types.d.ts +55 -0
  71. package/lib/typescript/module/page-header/types.d.ts.map +1 -0
  72. package/lib/typescript/module/social-button/OxyMark.d.ts +17 -0
  73. package/lib/typescript/module/social-button/OxyMark.d.ts.map +1 -0
  74. package/lib/typescript/module/social-button/SocialButton.d.ts +3 -1
  75. package/lib/typescript/module/social-button/SocialButton.d.ts.map +1 -1
  76. package/lib/typescript/module/social-button/index.d.ts +2 -1
  77. package/lib/typescript/module/social-button/index.d.ts.map +1 -1
  78. package/lib/typescript/module/social-button/providers.d.ts +10 -0
  79. package/lib/typescript/module/social-button/providers.d.ts.map +1 -1
  80. package/lib/typescript/module/social-button/types.d.ts +10 -3
  81. package/lib/typescript/module/social-button/types.d.ts.map +1 -1
  82. package/package.json +15 -1
  83. package/src/index.ts +1 -0
  84. package/src/index.web.ts +1 -0
  85. package/src/page-header/PageHeader.tsx +319 -0
  86. package/src/page-header/index.ts +3 -0
  87. package/src/page-header/types.ts +62 -0
  88. package/src/social-button/OxyMark.tsx +47 -0
  89. package/src/social-button/SocialButton.tsx +35 -3
  90. package/src/social-button/index.ts +2 -0
  91. package/src/social-button/providers.ts +12 -0
  92. package/src/social-button/types.ts +11 -3
@@ -0,0 +1,319 @@
1
+ import React, { memo, useContext, useEffect, useMemo, useState } from 'react';
2
+ import {
3
+ Platform,
4
+ StyleSheet,
5
+ View,
6
+ useWindowDimensions,
7
+ type LayoutChangeEvent,
8
+ } from 'react-native';
9
+ import Animated, {
10
+ Extrapolation,
11
+ interpolate,
12
+ useAnimatedStyle,
13
+ useSharedValue,
14
+ } from 'react-native-reanimated';
15
+ import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
16
+
17
+ import { Button } from '../button';
18
+ import { BUTTON_SHADOW, mixColor, resolveButtonRamps } from '../button/shared';
19
+ import { RiArrowLeftLine } from '../icons/remix';
20
+ import { BREAKPOINTS } from '../styles/breakpoints';
21
+ import { WEB_POSITION_STICKY, type WebCssStyle } from '../styles/web-view-style';
22
+ import { Z_INDEX } from '../styles/z-index';
23
+ import { useTheme } from '../theme/use-theme';
24
+ import { Text } from '../typography';
25
+ import type { PageHeaderProps } from './types';
26
+
27
+ /**
28
+ * `PageHeader`: a screen's top bar — back button, title (+ subtitle), leading
29
+ * node and actions, composed from the vocabulary Bloom's template headers and
30
+ * the settings modal's compact header use:
31
+ *
32
+ * bar min-height 56, side inset 16 (below `sm`) / 24, gap 8
33
+ * back secondary medium icon button (36, pill, shadow-xs), RiArrowLeftLine 20
34
+ * start group gap 6 (template header `gap-1.5`)
35
+ * title headline-medium, text-primary, px 4 (template `px-1`), one line
36
+ * subtitle body-2-regular, text-secondary (neutral-500), one line
37
+ * actions gap 10 (template `gap-2.5`)
38
+ * background background/full — card / dark neutral-925
39
+ * separator 1px separator-border — neutral-200 / dark neutral-800
40
+ * shadow shadow-xs, fading in with scroll
41
+ *
42
+ * Scroll-linked, not timed: border (`auto`), background (`transparent`) and
43
+ * shadow (and, when `transparent`, the title) interpolate over `[0, scrollThreshold]` of `scrollY` — the caller's
44
+ * shared value, else `window.scrollY` on web. No press scale.
45
+ */
46
+
47
+ const BAR_HEIGHT = 56;
48
+ const INSET_COMPACT = 16;
49
+ const INSET_WIDE = 24;
50
+ const START_GAP = 6;
51
+ const ROW_GAP = 8;
52
+ const ACTIONS_GAP = 10;
53
+ const TITLE_PADDING = 4;
54
+ const DEFAULT_THRESHOLD = 20;
55
+
56
+ const NO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 };
57
+
58
+ function PageHeaderComponent({
59
+ title,
60
+ subtitle,
61
+ titleAlign = 'start',
62
+ headingLevel = 1,
63
+ onBack,
64
+ backLabel = 'Back',
65
+ leading,
66
+ actions,
67
+ border = 'auto',
68
+ transparent = false,
69
+ scrollY: externalScrollY,
70
+ scrollThreshold = DEFAULT_THRESHOLD,
71
+ sticky = true,
72
+ safeArea,
73
+ style,
74
+ testID,
75
+ }: PageHeaderProps) {
76
+ const isWeb = Platform.OS === 'web';
77
+ const theme = useTheme();
78
+ const { width } = useWindowDimensions();
79
+ const insets = useContext(SafeAreaInsetsContext) ?? NO_INSETS;
80
+ const padTop = (safeArea ?? !isWeb) ? insets.top : 0;
81
+ const sideInset = width >= BREAKPOINTS.sm ? INSET_WIDE : INSET_COMPACT;
82
+
83
+ const paint = useMemo(() => {
84
+ const { neutral } = resolveButtonRamps(theme);
85
+ return theme.isDark
86
+ ? {
87
+ background: mixColor(neutral[900], neutral[950], 0.4),
88
+ separator: neutral[800],
89
+ textSecondary: neutral[500],
90
+ shadow: BUTTON_SHADOW.dark,
91
+ }
92
+ : {
93
+ background: theme.colors.card,
94
+ separator: neutral[200],
95
+ textSecondary: neutral[500],
96
+ shadow: BUTTON_SHADOW.light,
97
+ };
98
+ }, [theme]);
99
+
100
+ const internalScrollY = useSharedValue(0);
101
+ const scrollY = externalScrollY ?? internalScrollY;
102
+
103
+ // Web fallback: the document is the scroll owner, as in the fleet headers.
104
+ useEffect(() => {
105
+ if (!isWeb || externalScrollY || typeof window === 'undefined') return undefined;
106
+ const onScroll = () => {
107
+ internalScrollY.value = window.scrollY;
108
+ };
109
+ onScroll();
110
+ window.addEventListener('scroll', onScroll, { passive: true });
111
+ return () => window.removeEventListener('scroll', onScroll);
112
+ }, [isWeb, externalScrollY, internalScrollY]);
113
+
114
+ const threshold = Math.max(1, scrollThreshold);
115
+
116
+ const shadowStyle = useAnimatedStyle(() => ({
117
+ opacity: interpolate(scrollY.value, [0, threshold], [0, 1], Extrapolation.CLAMP),
118
+ }), [scrollY, threshold]);
119
+
120
+ const backgroundStyle = useAnimatedStyle(() => ({
121
+ opacity: transparent
122
+ ? interpolate(scrollY.value, [0, threshold], [0, 1], Extrapolation.CLAMP)
123
+ : 1,
124
+ }), [scrollY, threshold, transparent]);
125
+
126
+ // Over media the title would sit on the photo; it arrives with the bar.
127
+ const titleStyle = useAnimatedStyle(() => ({
128
+ opacity: transparent
129
+ ? interpolate(scrollY.value, [0, threshold], [0, 1], Extrapolation.CLAMP)
130
+ : 1,
131
+ }), [scrollY, threshold, transparent]);
132
+
133
+ const borderStyle = useAnimatedStyle(() => ({
134
+ opacity:
135
+ border === 'always'
136
+ ? 1
137
+ : border === 'none'
138
+ ? 0
139
+ : interpolate(scrollY.value, [0, threshold], [0, 1], Extrapolation.CLAMP),
140
+ }), [scrollY, threshold, border]);
141
+
142
+ // Centred title: inset it by the wider side so it sits on the bar's centre
143
+ // whatever the two sides hold.
144
+ const [startWidth, setStartWidth] = useState(0);
145
+ const [endWidth, setEndWidth] = useState(0);
146
+ const centered = titleAlign === 'center';
147
+ const onStartLayout = (e: LayoutChangeEvent) => setStartWidth(e.nativeEvent.layout.width);
148
+ const onEndLayout = (e: LayoutChangeEvent) => setEndWidth(e.nativeEvent.layout.width);
149
+ const centerInset = Math.max(startWidth, endWidth) + ROW_GAP;
150
+
151
+ const titleBlock =
152
+ title != null || subtitle != null ? (
153
+ <Animated.View
154
+ style={[
155
+ styles.titleBlock,
156
+ centered ? styles.titleBlockCentered : styles.titleBlockStart,
157
+ titleStyle,
158
+ ]}
159
+ testID={testID ? `${testID}-title-block` : undefined}
160
+ >
161
+ {typeof title === 'string' || typeof title === 'number' ? (
162
+ <Text
163
+ role="heading"
164
+ aria-level={headingLevel}
165
+ variant="headline-medium"
166
+ numberOfLines={1}
167
+ style={{ color: theme.colors.text, textAlign: centered ? 'center' : 'left' }}
168
+ testID={testID ? `${testID}-title` : undefined}
169
+ >
170
+ {title}
171
+ </Text>
172
+ ) : (
173
+ title
174
+ )}
175
+ {typeof subtitle === 'string' || typeof subtitle === 'number' ? (
176
+ <Text
177
+ variant="body-2-regular"
178
+ numberOfLines={1}
179
+ style={{ color: paint.textSecondary, textAlign: centered ? 'center' : 'left' }}
180
+ testID={testID ? `${testID}-subtitle` : undefined}
181
+ >
182
+ {subtitle}
183
+ </Text>
184
+ ) : (
185
+ subtitle
186
+ )}
187
+ </Animated.View>
188
+ ) : null;
189
+
190
+ const containerWeb: WebCssStyle | null =
191
+ isWeb && sticky ? { position: WEB_POSITION_STICKY, top: 0, zIndex: Z_INDEX.floating } : null;
192
+
193
+ return (
194
+ <View
195
+ testID={testID}
196
+ style={[styles.container, { paddingTop: padTop }, containerWeb, style]}
197
+ >
198
+ <Animated.View
199
+ pointerEvents="none"
200
+ style={[StyleSheet.absoluteFill, { boxShadow: paint.shadow }, shadowStyle]}
201
+ testID={testID ? `${testID}-shadow` : undefined}
202
+ />
203
+ <Animated.View
204
+ pointerEvents="none"
205
+ style={[StyleSheet.absoluteFill, { backgroundColor: paint.background }, backgroundStyle]}
206
+ testID={testID ? `${testID}-background` : undefined}
207
+ />
208
+ <Animated.View
209
+ pointerEvents="none"
210
+ style={[styles.border, { backgroundColor: paint.separator }, borderStyle]}
211
+ testID={testID ? `${testID}-border` : undefined}
212
+ />
213
+ <View
214
+ style={[styles.bar, { paddingLeft: sideInset, paddingRight: sideInset }]}
215
+ testID={testID ? `${testID}-bar` : undefined}
216
+ >
217
+ <View
218
+ style={[styles.start, !centered && styles.startFill]}
219
+ onLayout={centered ? onStartLayout : undefined}
220
+ testID={testID ? `${testID}-start` : undefined}
221
+ >
222
+ {onBack ? (
223
+ <Button
224
+ variant="secondary"
225
+ size="medium"
226
+ iconOnly
227
+ leadingIcon={RiArrowLeftLine}
228
+ accessibilityLabel={backLabel}
229
+ onPress={onBack}
230
+ testID={testID ? `${testID}-back` : undefined}
231
+ />
232
+ ) : null}
233
+ {leading}
234
+ {centered ? null : titleBlock}
235
+ </View>
236
+ {centered ? <View style={styles.spacer} /> : null}
237
+ {actions ? (
238
+ <View
239
+ style={styles.actions}
240
+ onLayout={centered ? onEndLayout : undefined}
241
+ testID={testID ? `${testID}-actions` : undefined}
242
+ >
243
+ {actions}
244
+ </View>
245
+ ) : null}
246
+ {centered && titleBlock ? (
247
+ <View
248
+ pointerEvents="box-none"
249
+ style={[styles.centerSlot, { left: sideInset + centerInset, right: sideInset + centerInset }]}
250
+ testID={testID ? `${testID}-center` : undefined}
251
+ >
252
+ {titleBlock}
253
+ </View>
254
+ ) : null}
255
+ </View>
256
+ </View>
257
+ );
258
+ }
259
+
260
+ const styles = StyleSheet.create({
261
+ container: {
262
+ width: '100%',
263
+ position: 'relative',
264
+ },
265
+ border: {
266
+ position: 'absolute',
267
+ left: 0,
268
+ right: 0,
269
+ bottom: 0,
270
+ height: 1,
271
+ },
272
+ bar: {
273
+ minHeight: BAR_HEIGHT,
274
+ flexDirection: 'row',
275
+ alignItems: 'center',
276
+ gap: ROW_GAP,
277
+ paddingTop: 8,
278
+ paddingBottom: 8,
279
+ },
280
+ start: {
281
+ flexDirection: 'row',
282
+ alignItems: 'center',
283
+ gap: START_GAP,
284
+ minWidth: 0,
285
+ },
286
+ startFill: {
287
+ flex: 1,
288
+ },
289
+ spacer: {
290
+ flex: 1,
291
+ },
292
+ titleBlock: {
293
+ minWidth: 0,
294
+ paddingLeft: TITLE_PADDING,
295
+ paddingRight: TITLE_PADDING,
296
+ },
297
+ titleBlockStart: {
298
+ flex: 1,
299
+ },
300
+ titleBlockCentered: {
301
+ alignItems: 'center',
302
+ },
303
+ centerSlot: {
304
+ position: 'absolute',
305
+ top: 0,
306
+ bottom: 0,
307
+ justifyContent: 'center',
308
+ },
309
+ actions: {
310
+ flexDirection: 'row',
311
+ alignItems: 'center',
312
+ justifyContent: 'flex-end',
313
+ gap: ACTIONS_GAP,
314
+ flexShrink: 0,
315
+ },
316
+ });
317
+
318
+ export const PageHeader = memo(PageHeaderComponent);
319
+ PageHeader.displayName = 'PageHeader';
@@ -0,0 +1,3 @@
1
+ export { PageHeader } from './PageHeader';
2
+
3
+ export type { PageHeaderBorder, PageHeaderProps, PageHeaderTitleAlign } from './types';
@@ -0,0 +1,62 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
+ import type { SharedValue } from 'react-native-reanimated';
4
+
5
+ /** Where the title sits: after the back button, or centred on the bar. */
6
+ export type PageHeaderTitleAlign = 'start' | 'center';
7
+
8
+ /**
9
+ * The bottom separator: `auto` fades it in once the page has scrolled past
10
+ * `scrollThreshold`, `always` draws it at rest, `none` never draws it.
11
+ */
12
+ export type PageHeaderBorder = 'auto' | 'always' | 'none';
13
+
14
+ export interface PageHeaderProps {
15
+ /** A string renders as the heading; a node renders as-is (and owns its own semantics). */
16
+ title?: ReactNode;
17
+ /** A string renders as a secondary line under the title; a node renders as-is. */
18
+ subtitle?: ReactNode;
19
+ /** Default `start`. */
20
+ titleAlign?: PageHeaderTitleAlign;
21
+ /** The title's heading level. Default 1. */
22
+ headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
23
+
24
+ /**
25
+ * Renders the back button and is called when it is pressed. The header is
26
+ * router-agnostic: pass `router.back`, or your app's safe-back helper.
27
+ */
28
+ onBack?: () => void;
29
+ /** The back button's accessible name. Default "Back". */
30
+ backLabel?: string;
31
+
32
+ /** Rendered after the back button, before the title (an avatar, a logo). */
33
+ leading?: ReactNode;
34
+ /** Rendered at the end of the bar, 10 apart — typically Bloom `Button`s. */
35
+ actions?: ReactNode;
36
+
37
+ /** Default `auto`. */
38
+ border?: PageHeaderBorder;
39
+ /**
40
+ * The bar's background, shadow and title fade in with scroll instead of
41
+ * showing at rest — for a header over media. The back button and actions
42
+ * stay visible (their own fill reads over any image).
43
+ */
44
+ transparent?: boolean;
45
+ /**
46
+ * The scroll offset driving `border="auto"`, `transparent` and the shadow.
47
+ * Pass it from a Reanimated scroll handler on native or for any scroll
48
+ * container. Omitted on web, the header follows `window.scrollY`; omitted on
49
+ * native, the header stays at rest.
50
+ */
51
+ scrollY?: SharedValue<number>;
52
+ /** The offset (px) over which border, background and shadow fade in. Default 20. */
53
+ scrollThreshold?: number;
54
+
55
+ /** Web only: pin the bar to the top of its scroll container. Default true. */
56
+ sticky?: boolean;
57
+ /** Pad the top by the safe-area inset. Default true on native, false on web. */
58
+ safeArea?: boolean;
59
+
60
+ style?: StyleProp<ViewStyle>;
61
+ testID?: string;
62
+ }
@@ -0,0 +1,47 @@
1
+ import React, { useId } from 'react';
2
+ import Svg, { ClipPath, Defs, G, Path } from 'react-native-svg';
3
+
4
+ /**
5
+ * The Oxy mark for `SocialButton` — the same drawing the Oxy SDK ships.
6
+ *
7
+ * Unlike the single-colour provider glyphs it is two-tone: the mark, and the
8
+ * letters knocked out of it. `color` paints the mark and `letterColor` the
9
+ * letters, so on a filled button the letters take the button's own fill.
10
+ */
11
+
12
+ export const OXY_MARK_VIEW_BOX = '80.58 263.58 1009.84 1002.84';
13
+
14
+ /** The mark's outer silhouette — the monochrome glyph in `SOCIAL_PROVIDERS`. */
15
+ export const OXY_MARK_OUTER_PATH =
16
+ 'M520.4336 284.25c-48.73438 5.57422-93.89844 40.73047-120.91016 93.60938-13.57422 26.72656-22.57813 60.8828-24.4375 92.32421l-.85547 15.29297-12.29297-6.28906c-34.8711-17.72266-66.16797-25.4414-103.75781-25.58203-33.15625-.14453-56.59375 4.85937-81.3164 17.14844-37.73048 18.86718-61.59767 48.16406-72.46095 88.60937-4 15.0039-4.42968 47.30469-.85546 63.59766 8.28906 36.8711 26.72656 70.74218 54.30859 99.46875 13.71875 14.14843 36.01562 32.30078 48.01953 39.01562 3.14453 1.85938 5.85938 3.71485 5.85938 4.14453 0 .4297-2.57422 2.28907-5.71875 4.14454-12.28907 7.0039-34.29688 25.01171-47.875 39.16015-59.88282 62.16797-74.60157 144.77344-36.30079 203.51172 21.4375 32.8711 55.3086 54.3086 99.1836 62.88281 17.57812 3.42969 53.44922 3.42969 72.74219 0 23.72656-4.28906 45.44921-11.57422 67.88671-22.86719l13.00391-6.57421v8.28906c0 19.15234 4.85938 46.44922 12.29297 68.88672 29.72656 90.03515 106.32812 140.6289 182.64453 120.76172 35.44531-9.28907 69.3164-35.15625 92.32422-70.7422 19.72266-30.58202 33.01562-72.60155 35.30078-111.7578l.85938-15.15235 12.71875 6.4336c36.01562 18.0078 66.74218 25.4375 105.47265 25.29687 36.15625-.14453 62.59766-6.86328 90.75-23.29687 14.71875-8.57422 36.30078-29.8711 44.875-44.16016 14.00781-23.29688 19.00781-41.875 19.15234-70.3164.14063-29.15235-3.85937-46.16016-17.57812-75.31641-16.57813-35.01563-49.02344-71.17188-83.17969-92.32422-5.28515-3.28516-9.71875-6.28906-9.71875-6.71484 0-.4297 4.4336-3.4297 9.71875-6.71875 24.15235-15.00391 52.45313-42.44532 68.17188-66.16797 25.4375-38.16016 36.8711-79.32032 32.30078-116.6211-7.71875-62.16797-52.02344-106.75781-119.48047-120.05078-19.00781-3.85547-54.8789-3.57031-75.7461.57422-21.72265 4.28516-39.73046 10.28906-60.30859 20.29297l-17.57812 8.4336v-8.14844c0-40.30079-16.57813-91.89454-40.16016-125.33594-27.72656-39.01563-64.88281-62.45313-107.61719-67.88672-12.71875-1.57031-14.14843-1.57031-29.4375.14453zm0 0';
17
+
18
+ const INNER_PATH =
19
+ 'M347.55328 964.6769c-49.26953 3.6211-93.6914-5.95703-133.25781-28.73437-36.3789-20.9414-67.09375-49.97656-92.14453-87.10547-23.0039-34.08984-41.0586-73.63281-54.16407-118.63281-12.41406-42.61719-20.35937-87.60156-23.83984-134.94922-3.27734-44.58203-1.6836-90.02734 4.78125-136.34375 6.73828-48.27734 19.41406-92.66406 38.02344-133.15625 19.95703-43.41797 46.86719-79.98047 80.73047-109.6875 38.33984-33.63672 84.80078-52.46094 139.38281-56.46875 54.17969-3.98437 101.57031 7.91797 142.17969 35.69922 35.92187 24.57422 65.29687 57.1836 88.13281 97.82031 20.57031 36.60938 36.33203 77.66797 47.28516 123.17969 10.30078 42.79687 17.04297 85.88672 20.23047 129.25781 3.62109 49.26953 2.11718 96.4414-4.51563 141.52344-6.98438 47.47266-19.98828 90.26563-39.00781 128.375-20.59375 41.27344-48.125 75.05078-82.58594 101.33594-36.99219 28.21093-80.73828 44.17578-131.23047 47.88672zm-10.72656-145.91796c21.5625-1.58594 39.30469-7.6875 53.22656-18.30469 16.45313-12.55078 29.91797-29.32813 40.40235-50.33203 12.0625-24.16797 20.44921-52.28125 25.16796-84.33984 5.06641-34.44922 6.1836-70.94922 3.35157-109.5-2.60547-35.4375-8.125-70.6875-16.5625-105.75-7.78907-32.34766-18.65235-60.9297-32.58985-85.7422-11.67578-20.77734-26.07422-37.02343-43.19531-48.73827-12.42969-8.50391-28.71094-12.01563-48.83984-10.53516-21.97657 1.61328-39.85157 8.46094-53.6172 20.53516-18.24218 16.0039-33 36.27343-44.27343 60.80468-12.61719 27.45313-21.30469 58.21485-26.0625 92.28125-5.02734 36.03516-6.28516 71.16407-3.76953 105.39454 2.72656 37.09375 8.85937 72.01171 18.39453 104.7539 8.84375 30.35938 20.5039 56.26563 34.97656 77.71875 12.42188 18.41016 27.03907 32.45703 43.84766 42.13281 13.6211 7.83985 30.13672 11.04688 49.54297 9.6211zm-13.76953-326.00781c5.33594-.39063 10.48047-1.96094 15.4336-4.70313 4.35155-2.41016 7.85546-5.32812 10.51171-8.75-1.22266 1.57422-2.5664 4.92188-4.03125 10.05078-2.5625 8.94922-4.1836 19.3789-4.86328 31.29688-.8086 14.15625-.6875 28.37109.36328 42.64453 1.21875 16.58984 3.5039 33.11328 6.86328 49.57031 3.08594 15.1289 6.90234 28.3125 11.44531 39.55078 2.89844 7.16016 5.48828 11.98047 7.77735 14.46094-2.85547-3.09375-6.64844-5.66797-11.38672-7.71875-6.2461-2.70703-12.67578-3.8164-19.28125-3.32813-7.82422.57422-15.04688 3.29688-21.66797 8.17188-4.82812 3.55469-8.26953 7.39844-10.32031 11.53516 3.17578-6.39844 5.63672-14.89063 7.38672-25.46875 2.29687-13.86329 3.46093-28.15625 3.49218-42.88282.03907-16.83593-.33203-30.52734-1.10546-41.07031-.91016-12.3711-2.70313-25.53906-5.37891-39.4961-2.34766-12.23046-5.45313-23.22265-9.3164-32.97656-2.39454-6.03515-4.7461-10.35547-7.0625-12.96093 3.26952 3.67968 7.53906 6.64453 12.80859 8.88671 6.05859 2.57813 12.17187 3.64063 18.33203 3.1875zm-10.72266-145.91797c17.42188-1.28125 33.98047 1.41797 49.6836 8.10156 14.90624 6.34375 28.0078 15.8711 39.29687 28.58594 13.73047 15.45703 24.95703 34.1914 33.67969 56.20703 7.2539 18.29687 12.91797 38.07031 16.99218 59.32812 3.7461 19.52735 6.28125 38.30469 7.60547 56.33203 1.04688 14.22266 1.54688 31.59766 1.5 52.1211-.05078 22.63672-1.87109 44.78515-5.45312 66.44531-4.1289 24.9414-11.01563 47.13672-20.65625 66.58203-8.46094 17.0586-19.80078 30.82422-34.02735 41.29297-16.01953 11.78906-34.1328 18.42969-54.33984 19.91406-17.30078 1.26953-33.82812-1.5039-49.57422-8.32031-14.23828-6.16406-26.9336-15.30078-38.08984-27.40625-14.3164-15.54297-26.2539-35.1211-35.8086-58.74219-7.90234-19.54297-14.29296-41.26562-19.16796-65.17187-4.60547-22.57422-7.7461-45.26953-9.42578-68.08594-1.51563-20.6289-1.6875-41.19922-.51563-61.71484 1.30078-22.75391 4.72266-43.82032 10.26953-63.20313 6.63672-23.19922 16.32422-43.01562 29.0625-59.44531 9.63672-12.42969 21.04688-22.29297 34.23828-29.59766 13.78906-7.63672 28.69922-12.04687 44.73047-13.22265zm0 0';
20
+
21
+ const LETTERS_PATH =
22
+ 'M342.19 891.70425c-34.34375 2.53125-64.8125-3.85547-91.40625-19.15625-26.59375-15.3125-49.26172-36.85156-68-64.625-18.73047-27.78125-33.58594-60.5039-44.5625-98.17188-10.96875-37.67578-18.0039-77.625-21.10938-119.84375-2.89453-39.40625-1.46874-79.6953 4.28126-120.875 5.75-41.17578 16.42578-78.75 32.03124-112.71875 15.61329-33.97656 36.44532-62.39453 62.5-85.25 26.05079-22.85156 58.21875-35.6875 96.5-38.5 37.14454-2.72656 68.97657 4.98047 95.5 23.125 26.51954 18.13672 48.40625 42.5625 65.65625 73.28126 17.25782 30.71093 30.57032 65.53125 39.9375 104.46875 9.375 38.92968 15.50782 78.09375 18.40626 117.5 3.22656 43.90625 1.91406 85.74609-3.9375 125.51562-5.84375 39.76172-16.53907 75.21094-32.07813 106.34375-15.54297 31.13672-36.04297 56.41406-61.5 75.82813-25.44922 19.40625-56.1875 30.42968-92.21875 33.07812zm-24.5-471.89063c-10.69922.78125-19.53906 5.67188-26.51563 14.67188-6.98046 8.99219-12.49609 20.57031-16.54687 34.73438-4.04297 14.16796-6.5625 29.92187-7.5625 47.26562-.99219 17.33594-.84375 34.73047.4375 52.1875 1.44531 19.69922 4.16016 39.30469 8.14063 58.8125 3.98828 19.51172 9.09375 36.96484 15.3125 52.35938 6.22656 15.39843 13.49218 27.60156 21.79687 36.60937 8.30078 9 17.80078 13.10938 28.5 12.32813 12.38281-.91407 21.78125-7.83204 28.1875-20.75 6.40625-12.91407 11.07813-28.25391 14.01563-46.01563 2.9453-17.75781 4.4414-35.97656 4.48437-54.65625.03906-18.6875-.39844-34.21875-1.3125-46.59375-1.11719-15.19531-3.28125-31.17188-6.5-47.92188-3.21094-16.75-7.59375-32.1328-13.15625-46.15625-5.55469-14.01953-12.33984-25.54687-20.35938-34.57812-8.02343-9.03125-17.66406-13.1289-28.92187-12.29688z';
23
+
24
+ export interface OxyMarkProps {
25
+ size: number;
26
+ color: string;
27
+ letterColor: string;
28
+ }
29
+
30
+ export function OxyMark({ size, color, letterColor }: OxyMarkProps) {
31
+ // Two marks on one page must not resolve each other's clip path.
32
+ const clipId = `bloom-oxy-mark-${useId().replace(/[^a-zA-Z0-9]/g, '')}`;
33
+ return (
34
+ <Svg width={size} height={size} viewBox={OXY_MARK_VIEW_BOX} aria-hidden>
35
+ <Defs>
36
+ <ClipPath id={clipId}>
37
+ <Path d="M0 0h1427v1151H0z" />
38
+ </ClipPath>
39
+ </Defs>
40
+ <Path d={OXY_MARK_OUTER_PATH} fill={color} />
41
+ <G clipPath={`url(#${clipId})`} transform="translate(465 188)">
42
+ <Path d={INNER_PATH} fill={color} />
43
+ <Path d={LETTERS_PATH} fill={letterColor} />
44
+ </G>
45
+ </Svg>
46
+ );
47
+ }
@@ -19,8 +19,15 @@ import { interactiveWebCss, useInteractiveWebCss } from '../styles/interactive-w
19
19
  import { StyledPressable } from '../styles/styled-primitives';
20
20
  import type { WebCssStyle } from '../styles/web-view-style';
21
21
  import { SOCIAL_COLOR_LOGOS } from './color-logos';
22
+ import { OxyMark } from './OxyMark';
22
23
  import { SOCIAL_PROVIDERS, type SocialColorLogo, type SocialProvider } from './providers';
23
- import type { SocialBrand, SocialButtonAppearance, SocialButtonProps, SocialButtonSize } from './types';
24
+ import type {
25
+ SocialBrand,
26
+ SocialButtonAction,
27
+ SocialButtonAppearance,
28
+ SocialButtonProps,
29
+ SocialButtonSize,
30
+ } from './types';
24
31
 
25
32
  /**
26
33
  * The social sign-in button (`base/social-button`).
@@ -48,6 +55,10 @@ import type { SocialBrand, SocialButtonAppearance, SocialButtonProps, SocialButt
48
55
  * draw in near-black, so dark mode repaints their paths white.
49
56
  * disabled the whole button at 60% opacity.
50
57
  *
58
+ * oxy the Oxy mark, two-tone: the mark in the glyph colour and its
59
+ * letters in the fill behind it (the accent on `colorful`,
60
+ * neutral-950 on `black`, white on `white`).
61
+ *
51
62
  * No press scale on this control.
52
63
  */
53
64
 
@@ -125,6 +136,17 @@ export interface SocialButtonPaint {
125
136
 
126
137
  const TRANSPARENT = 'rgba(0, 0, 0, 0)';
127
138
 
139
+ const ACTION_PHRASE: Record<SocialButtonAction, string> = {
140
+ continue: 'Continue with',
141
+ signIn: 'Sign in with',
142
+ signUp: 'Sign up with',
143
+ };
144
+
145
+ /** The default label and icon-only accessible name: `"Sign in with Oxy"`. */
146
+ export function socialButtonLabel(brandLabel: string, action: SocialButtonAction = 'continue'): string {
147
+ return `${ACTION_PHRASE[action]} ${brandLabel}`;
148
+ }
149
+
128
150
  /**
129
151
  * The `oklch(from <fill> calc(l - 0.04) calc(c + 0.01) h)` transform — down in
130
152
  * lightness and up slightly in chroma, which is what blue-500 → blue-600 does.
@@ -362,6 +384,7 @@ const SocialButtonComponent: React.FC<SocialButtonProps> = ({
362
384
  appearance = 'colorful',
363
385
  iconOnly = false,
364
386
  fullWidth = false,
387
+ action = 'continue',
365
388
  children,
366
389
  onPress,
367
390
  href,
@@ -450,6 +473,14 @@ const SocialButtonComponent: React.FC<SocialButtonProps> = ({
450
473
  let glyph: React.ReactNode;
451
474
  if (custom) {
452
475
  glyph = config?.icon;
476
+ } else if (brand === 'oxy') {
477
+ glyph = (
478
+ <OxyMark
479
+ size={geometry.glyph}
480
+ color={paint.glyph}
481
+ letterColor={appearance === 'white' ? '#FFFFFF' : paint.rest.background}
482
+ />
483
+ );
453
484
  } else if (colorLogo) {
454
485
  glyph = (
455
486
  <ColorLogo
@@ -478,7 +509,8 @@ const SocialButtonComponent: React.FC<SocialButtonProps> = ({
478
509
  const isLink = href != null;
479
510
  // The visible label already names the brand; when it is hidden the control
480
511
  // needs that name back, or it announces as an unlabelled button.
481
- const name = accessibilityLabel ?? (iconOnly ? `Continue with ${label}` : undefined);
512
+ const phrase = socialButtonLabel(label, action);
513
+ const name = accessibilityLabel ?? (iconOnly ? phrase : undefined);
482
514
 
483
515
  return (
484
516
  <StyledPressable
@@ -524,7 +556,7 @@ const SocialButtonComponent: React.FC<SocialButtonProps> = ({
524
556
  </View>
525
557
  {iconOnly ? null : typeof children === 'string' || children == null ? (
526
558
  <Text variant="body-medium" numberOfLines={1} style={[labelStyle, textStyle]}>
527
- {children ?? `Continue with ${label}`}
559
+ {children ?? phrase}
528
560
  </Text>
529
561
  ) : (
530
562
  children
@@ -1,8 +1,10 @@
1
1
  export { SocialButton } from './SocialButton';
2
2
  export { SOCIAL_PROVIDERS } from './providers';
3
+ export { socialButtonLabel } from './SocialButton';
3
4
  export type { SocialProvider } from './providers';
4
5
  export type {
5
6
  SocialBrand,
7
+ SocialButtonAction,
6
8
  SocialBrandConfig,
7
9
  SocialButtonAppearance,
8
10
  SocialButtonProps,
@@ -15,11 +15,17 @@
15
15
  * #4285F4, since the two side by side read as a mistake. The multi-colour G
16
16
  * of `appearance="white"` stays Google's own.
17
17
  *
18
+ * `oxy` is Oxy's own mark (the drawing the Oxy SDK ships), not an upstream
19
+ * glyph. Like Google it paints `colorful` with the theme accent, and the
20
+ * button draws it two-tone (`OxyMark.tsx`); `path` is its outer silhouette.
21
+ *
18
22
  * The logos are trademarks of their owners. Several providers (Google and Apple
19
23
  * in particular) publish sign-in button guidelines covering colour, clear space
20
24
  * and wording; check them before shipping a production login.
21
25
  */
22
26
 
27
+ import { OXY_MARK_OUTER_PATH, OXY_MARK_VIEW_BOX } from './OxyMark';
28
+
23
29
  export interface SocialProviderMeta {
24
30
  label: string;
25
31
  /** Fill for `colorful`; `null` = the theme accent (the primary button). */
@@ -52,6 +58,12 @@ export interface SocialColorLogo {
52
58
  }
53
59
 
54
60
  export const SOCIAL_PROVIDERS = {
61
+ "oxy": {
62
+ label: "Oxy",
63
+ brand: null,
64
+ viewBox: OXY_MARK_VIEW_BOX,
65
+ path: OXY_MARK_OUTER_PATH,
66
+ },
55
67
  "google": {
56
68
  label: "Google",
57
69
  brand: null,
@@ -17,6 +17,12 @@ export type SocialButtonSize = 'medium' | 'small';
17
17
  */
18
18
  export type SocialButtonAppearance = 'colorful' | 'black' | 'white';
19
19
 
20
+ /**
21
+ * The verb of the default label: `continue` — "Continue with Google" (the
22
+ * default), `signIn` — "Sign in with Google", `signUp` — "Sign up with Google".
23
+ */
24
+ export type SocialButtonAction = 'continue' | 'signIn' | 'signUp';
25
+
20
26
  /** Everything a brand needs, for providers that are not built in. */
21
27
  export interface SocialBrandConfig {
22
28
  /** The logo, rendered inside the glyph box (18 / 16). */
@@ -43,7 +49,9 @@ export interface SocialButtonProps {
43
49
  iconOnly?: boolean;
44
50
  /** Drop the fixed width and fill the container instead. */
45
51
  fullWidth?: boolean;
46
- /** The label. Defaults to `"Continue with <Brand>"`. */
52
+ /** The verb of the default label and accessible name. Defaults to `'continue'`. */
53
+ action?: SocialButtonAction;
54
+ /** The label. Defaults to the `action` phrase, e.g. `"Continue with <Brand>"`. */
47
55
  children?: ReactNode;
48
56
  onPress?: () => void;
49
57
  /**
@@ -59,8 +67,8 @@ export interface SocialButtonProps {
59
67
  textStyle?: StyleProp<TextStyle>;
60
68
  className?: string;
61
69
  /**
62
- * Overrides the accessible name. Defaults to the visible label, or to
63
- * `"Continue with <Brand>"` when `iconOnly`.
70
+ * Overrides the accessible name. Defaults to the visible label, or to the
71
+ * `action` phrase (`"Continue with <Brand>"`) when `iconOnly`.
64
72
  */
65
73
  accessibilityLabel?: string;
66
74
  accessibilityHint?: string;