@oxy.so/bloom 7.24.1 → 7.26.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.
- package/docs/adoption-matrix.mdx +6 -6
- package/docs/radio.mdx +32 -0
- package/docs/screen.mdx +7 -2
- package/lib/commonjs/page-header/PageHeader.js +3 -1
- package/lib/commonjs/page-header/PageHeader.js.map +1 -1
- package/lib/commonjs/radio/Radio.js +63 -16
- package/lib/commonjs/radio/Radio.js.map +1 -1
- package/lib/commonjs/radio/RadioCard.js +14 -5
- package/lib/commonjs/radio/RadioCard.js.map +1 -1
- package/lib/commonjs/radio/RadioChip.js +169 -0
- package/lib/commonjs/radio/RadioChip.js.map +1 -0
- package/lib/commonjs/radio/RadioHost.js +153 -0
- package/lib/commonjs/radio/RadioHost.js.map +1 -0
- package/lib/commonjs/radio/index.js +7 -0
- package/lib/commonjs/radio/index.js.map +1 -1
- package/lib/commonjs/screen/Screen.js +18 -13
- package/lib/commonjs/screen/Screen.js.map +1 -1
- package/lib/commonjs/screen/context.js +4 -1
- package/lib/commonjs/screen/context.js.map +1 -1
- package/lib/module/page-header/PageHeader.js +4 -2
- package/lib/module/page-header/PageHeader.js.map +1 -1
- package/lib/module/radio/Radio.js +65 -18
- package/lib/module/radio/Radio.js.map +1 -1
- package/lib/module/radio/RadioCard.js +15 -6
- package/lib/module/radio/RadioCard.js.map +1 -1
- package/lib/module/radio/RadioChip.js +164 -0
- package/lib/module/radio/RadioChip.js.map +1 -0
- package/lib/module/radio/RadioHost.js +147 -0
- package/lib/module/radio/RadioHost.js.map +1 -0
- package/lib/module/radio/index.js +1 -0
- package/lib/module/radio/index.js.map +1 -1
- package/lib/module/screen/Screen.js +20 -15
- package/lib/module/screen/Screen.js.map +1 -1
- package/lib/module/screen/context.js +3 -0
- package/lib/module/screen/context.js.map +1 -1
- package/lib/typescript/commonjs/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/Radio.d.ts +1 -1
- package/lib/typescript/commonjs/radio/Radio.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/RadioCard.d.ts +1 -1
- package/lib/typescript/commonjs/radio/RadioCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/RadioChip.d.ts +5 -0
- package/lib/typescript/commonjs/radio/RadioChip.d.ts.map +1 -0
- package/lib/typescript/commonjs/radio/RadioHost.d.ts +59 -0
- package/lib/typescript/commonjs/radio/RadioHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/radio/index.d.ts +2 -1
- package/lib/typescript/commonjs/radio/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/types.d.ts +22 -4
- package/lib/typescript/commonjs/radio/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/screen/Screen.d.ts.map +1 -1
- package/lib/typescript/commonjs/screen/context.d.ts +2 -0
- package/lib/typescript/commonjs/screen/context.d.ts.map +1 -1
- package/lib/typescript/module/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/module/radio/Radio.d.ts +1 -1
- package/lib/typescript/module/radio/Radio.d.ts.map +1 -1
- package/lib/typescript/module/radio/RadioCard.d.ts +1 -1
- package/lib/typescript/module/radio/RadioCard.d.ts.map +1 -1
- package/lib/typescript/module/radio/RadioChip.d.ts +5 -0
- package/lib/typescript/module/radio/RadioChip.d.ts.map +1 -0
- package/lib/typescript/module/radio/RadioHost.d.ts +59 -0
- package/lib/typescript/module/radio/RadioHost.d.ts.map +1 -0
- package/lib/typescript/module/radio/index.d.ts +2 -1
- package/lib/typescript/module/radio/index.d.ts.map +1 -1
- package/lib/typescript/module/radio/types.d.ts +22 -4
- package/lib/typescript/module/radio/types.d.ts.map +1 -1
- package/lib/typescript/module/screen/Screen.d.ts.map +1 -1
- package/lib/typescript/module/screen/context.d.ts +2 -0
- package/lib/typescript/module/screen/context.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/page-header/PageHeader.tsx +4 -2
- package/src/radio/Radio.tsx +45 -15
- package/src/radio/RadioCard.tsx +11 -6
- package/src/radio/RadioChip.tsx +84 -0
- package/src/radio/RadioHost.tsx +94 -0
- package/src/radio/index.ts +2 -1
- package/src/radio/types.ts +23 -4
- package/src/screen/Screen.tsx +7 -6
- package/src/screen/context.ts +3 -0
package/src/radio/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode, ReactElement, RefObject } from 'react';
|
|
2
|
-
import type { BloomSize } from '../appearance';
|
|
2
|
+
import type { BloomAppearance, BloomSize } from '../appearance';
|
|
3
3
|
import type { BloomTone } from '../appearance';
|
|
4
4
|
import type { StyleProp, ViewStyle, TextStyle, View } from 'react-native';
|
|
5
5
|
|
|
@@ -33,6 +33,8 @@ export interface RadioProps<Value extends string = string> {
|
|
|
33
33
|
disabled?: boolean;
|
|
34
34
|
/** Colour of the checked indicator. Uses the theme primary by default. */
|
|
35
35
|
tone?: BloomTone;
|
|
36
|
+
className?: string;
|
|
37
|
+
labelClassName?: string;
|
|
36
38
|
style?: StyleProp<ViewStyle>;
|
|
37
39
|
labelStyle?: StyleProp<TextStyle>;
|
|
38
40
|
accessibilityLabel?: string;
|
|
@@ -44,6 +46,12 @@ export interface RadioProps<Value extends string = string> {
|
|
|
44
46
|
testID?: string;
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
/** A pill-shaped radio with no separate indicator. */
|
|
50
|
+
export interface RadioChipProps<Value extends string = string> extends RadioProps<Value> {
|
|
51
|
+
/** Paint of the selected option. Unselected chips retain a neutral outline. */
|
|
52
|
+
appearance?: BloomAppearance;
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
/** One option, as data, for {@link RadioGroupProps}. */
|
|
48
56
|
export interface RadioOption<Value extends string = string> {
|
|
49
57
|
value: Value;
|
|
@@ -91,14 +99,22 @@ export interface RadioGroupProps<Value extends string = string> {
|
|
|
91
99
|
tone?: BloomTone;
|
|
92
100
|
style?: StyleProp<ViewStyle>;
|
|
93
101
|
labelStyle?: StyleProp<TextStyle>;
|
|
94
|
-
/**
|
|
102
|
+
/** Class recipe on the group layout; replaces its default layout. */
|
|
103
|
+
className?: string;
|
|
104
|
+
/** Class recipes for owned options and their built-in string labels. */
|
|
105
|
+
optionClassName?: string | ((state: Readonly<RadioOptionState>) => string | undefined);
|
|
106
|
+
optionLabelClassName?: string | ((state: Readonly<RadioOptionState>) => string | undefined);
|
|
107
|
+
/** Selected chip paint; used with variant="chip". Defaults to outline. */
|
|
108
|
+
appearance?: BloomAppearance;
|
|
109
|
+
/** Layout/style on each owned Radio, RadioCard or RadioChip. */
|
|
95
110
|
optionStyle?: StyleProp<ViewStyle>;
|
|
96
111
|
/**
|
|
97
112
|
* `default` renders each option as a `Radio` row; `card` as a `RadioCard`
|
|
98
113
|
* (title + description left, the dot right, the whole
|
|
99
|
-
* card selectable).
|
|
114
|
+
* card selectable). `chip` renders a wrapping row of pill-shaped radios
|
|
115
|
+
* without an indicator. A card's title is the option's `label`.
|
|
100
116
|
*/
|
|
101
|
-
variant?: 'default' | 'card';
|
|
117
|
+
variant?: 'default' | 'card' | 'chip';
|
|
102
118
|
testID?: string;
|
|
103
119
|
}
|
|
104
120
|
|
|
@@ -119,6 +135,9 @@ export interface RadioCardProps<Value extends string = string> {
|
|
|
119
135
|
disabled?: boolean;
|
|
120
136
|
/** Accent for the checked dot. Uses the theme primary by default. */
|
|
121
137
|
tone?: BloomTone;
|
|
138
|
+
className?: string;
|
|
139
|
+
labelClassName?: string;
|
|
140
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
122
141
|
style?: StyleProp<ViewStyle>;
|
|
123
142
|
accessibilityLabel?: string;
|
|
124
143
|
testID?: string;
|
package/src/screen/Screen.tsx
CHANGED
|
@@ -3,16 +3,16 @@ import { Keyboard, Platform, View } from 'react-native';
|
|
|
3
3
|
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
|
4
4
|
import { windowEdgeGap } from '../layout/edge';
|
|
5
5
|
import { useSharedValue } from 'react-native-reanimated';
|
|
6
|
-
import {
|
|
7
|
-
import { WEB_POSITION_STICKY, WEB_VIEWPORT_HEIGHT } from '../styles/web-view-style';
|
|
6
|
+
import { useSurfaceFill } from '../styles/surface-levels';
|
|
7
|
+
import { WEB_POSITION_STICKY, WEB_SURFACE_STICKY_TOP, WEB_VIEWPORT_HEIGHT, type WebCssStyle } from '../styles/web-view-style';
|
|
8
8
|
import { Z_INDEX } from '../styles/z-index';
|
|
9
|
-
import { ScreenContext, ScreenNavigationContext } from './context';
|
|
9
|
+
import { ScreenContext, ScreenHeaderContext, ScreenNavigationContext } from './context';
|
|
10
10
|
import { useScreenWindowBinding } from './use-screen-window-scroll';
|
|
11
11
|
import type { ScreenProps } from './types';
|
|
12
12
|
|
|
13
13
|
/** One continuous canvas; chrome overlays it and content reserves its measured footprint. */
|
|
14
14
|
export function Screen({ header, bottomBar, primaryAction, active: requestedActive = true, navigationScope = 'inherit', documentScroll = false, headerHeight, bottomBarHeight, contentClearance = 16, children, style, testID, ...props }: ScreenProps) {
|
|
15
|
-
const
|
|
15
|
+
const surfaceFill = useSurfaceFill();
|
|
16
16
|
const parentScreen = useContext(ScreenContext);
|
|
17
17
|
const active = requestedActive && (navigationScope === 'isolated' ? true : parentScreen?.active ?? true);
|
|
18
18
|
const scrollY = useSharedValue(0);
|
|
@@ -40,12 +40,13 @@ export function Screen({ header, bottomBar, primaryAction, active: requestedActi
|
|
|
40
40
|
contentInsetsHandled: document, topInset: header ? top : 0, bottomInset: keyboardVisible ? contentClearance : hasBottom ? bottom + contentClearance : navigationScope === 'inherit' ? inheritedNavigation?.bottomInset ?? contentClearance : contentClearance,
|
|
41
41
|
}), [active, scrollY, collapseProgress, collapseTarget, activeScrollerId, header, hasBottom, top, bottom, contentClearance, navigationScope, inheritedNavigation?.bottomInset, document, keyboardVisible]);
|
|
42
42
|
useScreenWindowBinding(value, { active: document });
|
|
43
|
-
const
|
|
43
|
+
const documentHeaderStyle: WebCssStyle = { position: WEB_POSITION_STICKY, top: WEB_SURFACE_STICKY_TOP, zIndex: Z_INDEX.floating, marginBottom: -top, transitionProperty: 'top', transitionDuration: 'var(--bloom-panel-inset-duration, 0ms)', transitionTimingFunction: 'ease-in-out' };
|
|
44
|
+
const headerNode = header ? <View testID={testID ? `${testID}-header` : undefined} pointerEvents="box-none" onLayout={event => setTop(event.nativeEvent.layout.height)} style={document ? documentHeaderStyle : { position: 'absolute', top: 0, left: 0, right: 0 }}><ScreenHeaderContext.Provider value={value}>{header}</ScreenHeaderContext.Provider></View> : null;
|
|
44
45
|
const bottomNode = hasBottom ? <View testID={testID ? `${testID}-bottom` : undefined} pointerEvents="box-none" onLayout={event => setBottom(event.nativeEvent.layout.height)} style={document ? { position: WEB_POSITION_STICKY, bottom: 0, zIndex: Z_INDEX.floating, marginTop: -bottom } : { position: 'absolute', bottom: 0, left: 0, right: 0 }}>{bottomBar ?? <View pointerEvents="box-none" style={{ alignItems: 'flex-end', paddingHorizontal: 16, paddingBottom: windowEdgeGap(insets?.bottom ?? 0), minHeight: bottom }}>{primaryAction}</View>}</View> : null;
|
|
45
46
|
return (
|
|
46
47
|
<ScreenNavigationContext.Provider value={navigationScope === 'inherit' ? inheritedNavigation : { ...navigation, bottomInset: value.bottomInset }}>
|
|
47
48
|
<ScreenContext.Provider value={value}>
|
|
48
|
-
<View {...props} testID={testID} style={[document ? { minHeight: WEB_VIEWPORT_HEIGHT, width: '100%', position: 'relative', backgroundColor:
|
|
49
|
+
<View {...props} testID={testID} style={[document ? { minHeight: WEB_VIEWPORT_HEIGHT, width: '100%', position: 'relative', backgroundColor: surfaceFill } : { flex: 1, minHeight: 0, position: 'relative', backgroundColor: surfaceFill }, style]}>
|
|
49
50
|
{document ? headerNode : null}
|
|
50
51
|
{document ? <View testID={testID ? `${testID}-content` : undefined} style={{
|
|
51
52
|
flexGrow: 1, flexShrink: 0,
|
package/src/screen/context.ts
CHANGED
|
@@ -16,6 +16,9 @@ export interface ScreenContextValue {
|
|
|
16
16
|
export type ScreenNavigationState = Pick<ScreenContextValue, 'collapseProgress' | 'collapseTarget' | 'activeScrollerId'> & { bottomInset?: number };
|
|
17
17
|
export const ScreenNavigationContext = createContext<ScreenNavigationState | null>(null);
|
|
18
18
|
|
|
19
|
+
/** Only the Screen header slot owns chrome positioning; content headers remain independent. */
|
|
20
|
+
export const ScreenHeaderContext = createContext<ScreenContextValue | null>(null);
|
|
21
|
+
|
|
19
22
|
export const ScreenContext = createContext<ScreenContextValue | null>(null);
|
|
20
23
|
export function useScreenContext() { return useContext(ScreenContext); }
|
|
21
24
|
export function useScreen(): ScreenContextValue {
|