@oxy.so/bloom 7.16.1 → 7.18.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 +9 -9
- package/docs/carousel.mdx +22 -0
- package/docs/checkbox.mdx +21 -0
- package/docs/media-header.mdx +21 -0
- package/docs/overlay.mdx +9 -0
- package/docs/radio.mdx +20 -0
- package/docs/search.mdx +18 -1
- package/docs/text-field.mdx +15 -0
- package/lib/commonjs/accordion/Accordion.web.js +1 -0
- package/lib/commonjs/accordion/Accordion.web.js.map +1 -1
- package/lib/commonjs/carousel/Carousel.js +50 -20
- package/lib/commonjs/carousel/Carousel.js.map +1 -1
- package/lib/commonjs/checkbox/Checkbox.js +15 -9
- package/lib/commonjs/checkbox/Checkbox.js.map +1 -1
- package/lib/commonjs/hooks/use-choice-space-key.js +37 -0
- package/lib/commonjs/hooks/use-choice-space-key.js.map +1 -0
- package/lib/commonjs/media-header/FollowLabel.js +46 -0
- package/lib/commonjs/media-header/FollowLabel.js.map +1 -0
- package/lib/commonjs/media-header/MediaActionBar.js +19 -13
- package/lib/commonjs/media-header/MediaActionBar.js.map +1 -1
- package/lib/commonjs/overlay/ModalKeyboard.js +4 -6
- package/lib/commonjs/overlay/ModalKeyboard.js.map +1 -1
- package/lib/commonjs/overlay/modal-keyboard.js +44 -0
- package/lib/commonjs/overlay/modal-keyboard.js.map +1 -1
- package/lib/commonjs/radio/Radio.js +14 -3
- package/lib/commonjs/radio/Radio.js.map +1 -1
- package/lib/commonjs/search/Search.js +11 -2
- package/lib/commonjs/search/Search.js.map +1 -1
- package/lib/commonjs/search/types.js +6 -0
- package/lib/commonjs/search/types.js.map +1 -0
- package/lib/commonjs/text-field/FieldBox.js +83 -0
- package/lib/commonjs/text-field/FieldBox.js.map +1 -0
- package/lib/commonjs/text-field/TextField.js +17 -7
- package/lib/commonjs/text-field/TextField.js.map +1 -1
- package/lib/module/accordion/Accordion.web.js +1 -0
- package/lib/module/accordion/Accordion.web.js.map +1 -1
- package/lib/module/carousel/Carousel.js +50 -20
- package/lib/module/carousel/Carousel.js.map +1 -1
- package/lib/module/checkbox/Checkbox.js +15 -9
- package/lib/module/checkbox/Checkbox.js.map +1 -1
- package/lib/module/hooks/use-choice-space-key.js +34 -0
- package/lib/module/hooks/use-choice-space-key.js.map +1 -0
- package/lib/module/media-header/FollowLabel.js +42 -0
- package/lib/module/media-header/FollowLabel.js.map +1 -0
- package/lib/module/media-header/MediaActionBar.js +19 -13
- package/lib/module/media-header/MediaActionBar.js.map +1 -1
- package/lib/module/overlay/ModalKeyboard.js +5 -7
- package/lib/module/overlay/ModalKeyboard.js.map +1 -1
- package/lib/module/overlay/modal-keyboard.js +43 -0
- package/lib/module/overlay/modal-keyboard.js.map +1 -1
- package/lib/module/radio/Radio.js +14 -3
- package/lib/module/radio/Radio.js.map +1 -1
- package/lib/module/search/Search.js +11 -2
- package/lib/module/search/Search.js.map +1 -1
- package/lib/module/search/types.js +4 -0
- package/lib/module/search/types.js.map +1 -0
- package/lib/module/text-field/FieldBox.js +79 -0
- package/lib/module/text-field/FieldBox.js.map +1 -0
- package/lib/module/text-field/TextField.js +17 -7
- package/lib/module/text-field/TextField.js.map +1 -1
- package/lib/typescript/commonjs/carousel/Carousel.d.ts +1 -1
- package/lib/typescript/commonjs/carousel/Carousel.d.ts.map +1 -1
- package/lib/typescript/commonjs/carousel/index.d.ts +1 -1
- package/lib/typescript/commonjs/carousel/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/carousel/types.d.ts +7 -0
- package/lib/typescript/commonjs/carousel/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/commonjs/checkbox/types.d.ts +4 -0
- package/lib/typescript/commonjs/checkbox/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/use-choice-space-key.d.ts +14 -0
- package/lib/typescript/commonjs/hooks/use-choice-space-key.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-header/FollowLabel.d.ts +11 -0
- package/lib/typescript/commonjs/media-header/FollowLabel.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-header/MediaActionBar.d.ts +1 -1
- package/lib/typescript/commonjs/media-header/MediaActionBar.d.ts.map +1 -1
- package/lib/typescript/commonjs/media-header/types.d.ts +10 -0
- package/lib/typescript/commonjs/media-header/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/overlay/modal-keyboard.d.ts +2 -0
- package/lib/typescript/commonjs/overlay/modal-keyboard.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/types.d.ts +4 -0
- package/lib/typescript/commonjs/radio/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/search/Search.d.ts +6 -6
- package/lib/typescript/commonjs/search/Search.d.ts.map +1 -1
- package/lib/typescript/commonjs/search/index.d.ts +1 -0
- package/lib/typescript/commonjs/search/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/search/types.d.ts +15 -0
- package/lib/typescript/commonjs/search/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/text-field/FieldBox.d.ts +19 -0
- package/lib/typescript/commonjs/text-field/FieldBox.d.ts.map +1 -0
- package/lib/typescript/commonjs/text-field/TextField.d.ts +1 -1
- package/lib/typescript/commonjs/text-field/TextField.d.ts.map +1 -1
- package/lib/typescript/commonjs/text-field/types.d.ts +4 -0
- package/lib/typescript/commonjs/text-field/types.d.ts.map +1 -1
- package/lib/typescript/module/carousel/Carousel.d.ts +1 -1
- package/lib/typescript/module/carousel/Carousel.d.ts.map +1 -1
- package/lib/typescript/module/carousel/index.d.ts +1 -1
- package/lib/typescript/module/carousel/index.d.ts.map +1 -1
- package/lib/typescript/module/carousel/types.d.ts +7 -0
- package/lib/typescript/module/carousel/types.d.ts.map +1 -1
- package/lib/typescript/module/checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/module/checkbox/types.d.ts +4 -0
- package/lib/typescript/module/checkbox/types.d.ts.map +1 -1
- package/lib/typescript/module/hooks/use-choice-space-key.d.ts +14 -0
- package/lib/typescript/module/hooks/use-choice-space-key.d.ts.map +1 -0
- package/lib/typescript/module/media-header/FollowLabel.d.ts +11 -0
- package/lib/typescript/module/media-header/FollowLabel.d.ts.map +1 -0
- package/lib/typescript/module/media-header/MediaActionBar.d.ts +1 -1
- package/lib/typescript/module/media-header/MediaActionBar.d.ts.map +1 -1
- package/lib/typescript/module/media-header/types.d.ts +10 -0
- package/lib/typescript/module/media-header/types.d.ts.map +1 -1
- package/lib/typescript/module/overlay/modal-keyboard.d.ts +2 -0
- package/lib/typescript/module/overlay/modal-keyboard.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/types.d.ts +4 -0
- package/lib/typescript/module/radio/types.d.ts.map +1 -1
- package/lib/typescript/module/search/Search.d.ts +6 -6
- package/lib/typescript/module/search/Search.d.ts.map +1 -1
- package/lib/typescript/module/search/index.d.ts +1 -0
- package/lib/typescript/module/search/index.d.ts.map +1 -1
- package/lib/typescript/module/search/types.d.ts +15 -0
- package/lib/typescript/module/search/types.d.ts.map +1 -0
- package/lib/typescript/module/text-field/FieldBox.d.ts +19 -0
- package/lib/typescript/module/text-field/FieldBox.d.ts.map +1 -0
- package/lib/typescript/module/text-field/TextField.d.ts +1 -1
- package/lib/typescript/module/text-field/TextField.d.ts.map +1 -1
- package/lib/typescript/module/text-field/types.d.ts +4 -0
- package/lib/typescript/module/text-field/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.web.tsx +1 -1
- package/src/carousel/Carousel.tsx +37 -12
- package/src/carousel/index.ts +1 -1
- package/src/carousel/types.ts +9 -0
- package/src/checkbox/Checkbox.tsx +13 -3
- package/src/checkbox/types.ts +4 -0
- package/src/hooks/use-choice-space-key.ts +29 -0
- package/src/media-header/FollowLabel.tsx +23 -0
- package/src/media-header/MediaActionBar.tsx +11 -6
- package/src/media-header/types.ts +10 -0
- package/src/overlay/ModalKeyboard.tsx +5 -5
- package/src/overlay/modal-keyboard.ts +30 -0
- package/src/radio/Radio.tsx +13 -3
- package/src/radio/types.ts +4 -0
- package/src/search/Search.tsx +7 -13
- package/src/search/index.ts +2 -0
- package/src/search/types.ts +15 -0
- package/src/text-field/FieldBox.tsx +51 -0
- package/src/text-field/TextField.tsx +15 -7
- package/src/text-field/types.ts +4 -0
|
@@ -16,4 +16,6 @@ export declare function wrapTab(event: KeyboardEvent, node: HTMLElement | null):
|
|
|
16
16
|
* whatever the caller's own bookkeeping says.
|
|
17
17
|
*/
|
|
18
18
|
export declare function listenForEscape(claim: () => boolean, dismiss: () => void): () => void;
|
|
19
|
+
/** A modal may begin closing before its opener stops being inert. */
|
|
20
|
+
export declare function restoreFocusWhenAvailable(target: HTMLElement, panel: HTMLElement | null): () => void;
|
|
19
21
|
//# sourceMappingURL=modal-keyboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-keyboard.d.ts","sourceRoot":"","sources":["../../../../src/overlay/modal-keyboard.ts"],"names":[],"mappings":"AAiDA,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,WAAW,EAAE,CASvE;AAED,0GAA0G;AAC1G,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAMjE;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAa/E;AAYD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAkCrF"}
|
|
1
|
+
{"version":3,"file":"modal-keyboard.d.ts","sourceRoot":"","sources":["../../../../src/overlay/modal-keyboard.ts"],"names":[],"mappings":"AAiDA,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,WAAW,EAAE,CASvE;AAED,0GAA0G;AAC1G,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAMjE;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAa/E;AAYD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAkCrF;AAED,qEAAqE;AACrE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,MAAM,IAAI,CA2BpG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RadioGroupProps, RadioProps } from './types';
|
|
2
|
-
declare const RadioComponent: <Value extends string = string>({ value, checked: checkedProp, onValueChange, label, description, size: sizeProp, disabled, tone: toneProp, style, labelStyle, accessibilityLabel, nativeID, testID, }: RadioProps<Value>) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const RadioComponent: <Value extends string = string>({ value, checked: checkedProp, onValueChange, label, labelContent, description, size: sizeProp, disabled, tone: toneProp, style, labelStyle, accessibilityLabel, nativeID, testID, }: RadioProps<Value>) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare const Radio: typeof RadioComponent;
|
|
4
4
|
/**
|
|
5
5
|
* A set of radios that own one value between them.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../../src/radio/Radio.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../../src/radio/Radio.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAwE3D,QAAA,MAAM,cAAc,GAAkB,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,sLAelE,UAAU,CAAC,KAAK,CAAC,4CAkGnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAA2B,OAAO,cAAc,CAAC;AAEnE;;;;;;;GAOG;AACH,QAAA,MAAM,mBAAmB,GAAuB,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,OAAO,eAAe,CAAC,KAAK,CAAC,4CAmE3G,CAAC;AAEF,eAAO,MAAM,UAAU,EAAgC,OAAO,mBAAmB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import type { BloomSize } from '../appearance';
|
|
2
3
|
import type { BloomTone } from '../appearance';
|
|
3
4
|
import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
@@ -19,6 +20,9 @@ export interface RadioProps<Value extends string = string> {
|
|
|
19
20
|
onValueChange?: (value: Value) => void;
|
|
20
21
|
/** Optional label text. */
|
|
21
22
|
label?: string;
|
|
23
|
+
/** Decorative label layout, rendered in a View instead of Text. Supply
|
|
24
|
+
* `label` or `accessibilityLabel` for its accessible name. Do not nest controls. */
|
|
25
|
+
labelContent?: ReactNode;
|
|
22
26
|
/** Optional description shown below the label. */
|
|
23
27
|
description?: string;
|
|
24
28
|
/** Size preset. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/radio/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,MAAM,SAA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AC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type TextInput } from 'react-native';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
label?: TextFieldInputProps["label"];
|
|
5
|
-
/**
|
|
6
|
-
* Called when the user presses the clear (X) button.
|
|
7
|
-
*/
|
|
2
|
+
export declare const Search: import("react").ForwardRefExoticComponent<Omit<import("..").TextFieldInputProps, "label"> & {
|
|
3
|
+
label?: import("..").TextFieldInputProps["label"];
|
|
8
4
|
onClearText?: () => void;
|
|
5
|
+
fieldClassName?: string;
|
|
6
|
+
fieldChromeClassName?: string;
|
|
7
|
+
containerClassName?: string;
|
|
8
|
+
containerStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
9
9
|
} & import("react").RefAttributes<TextInput>>;
|
|
10
10
|
//# sourceMappingURL=Search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../../src/search/Search.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAQ,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../../src/search/Search.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAQ,MAAM,cAAc,CAAC;AAkB9D,eAAO,MAAM,MAAM;;;;;;;6CA6FlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GACP,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GACP,MAAM,UAAU,CAAC;AAElB,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import type { TextFieldInputProps } from '../text-field/types';
|
|
3
|
+
export type SearchProps = Omit<TextFieldInputProps, 'label'> & {
|
|
4
|
+
label?: TextFieldInputProps['label'];
|
|
5
|
+
/** Called when the user presses the clear button. */
|
|
6
|
+
onClearText?: () => void;
|
|
7
|
+
/** Field layout classes (height, width and padding). */
|
|
8
|
+
fieldClassName?: string;
|
|
9
|
+
/** Inset surface classes (background, border/ring and radius). */
|
|
10
|
+
fieldChromeClassName?: string;
|
|
11
|
+
/** Classes on the outer layout box, including the clear control. */
|
|
12
|
+
containerClassName?: string;
|
|
13
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/search/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,GAAG;IAC7D,KAAK,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACrC,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACvC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
interface FieldBoxProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
baseStyle?: StyleProp<ViewStyle>;
|
|
8
|
+
stateStyle?: StyleProp<ViewStyle>;
|
|
9
|
+
dir?: 'rtl';
|
|
10
|
+
pointerEvents?: 'none' | 'auto';
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
onMouseOver?: () => void;
|
|
13
|
+
onMouseOut?: () => void;
|
|
14
|
+
testID?: string;
|
|
15
|
+
}
|
|
16
|
+
declare function FieldBoxComponent({ children, className, style, baseStyle, stateStyle, dir, pointerEvents, onClick, onMouseOver, onMouseOut, testID }: FieldBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const FieldBox: typeof FieldBoxComponent;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=FieldBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldBox.d.ts","sourceRoot":"","sources":["../../../../src/text-field/FieldBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAc9E,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,GAAG,CAAC,EAAE,KAAK,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AACD,iBAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,EACzG,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,aAAa,2CAmBjD;AAED,eAAO,MAAM,QAAQ,0BAA6D,CAAC"}
|
|
@@ -17,7 +17,7 @@ export interface TextFieldGroupContextValue {
|
|
|
17
17
|
disabled: boolean;
|
|
18
18
|
}
|
|
19
19
|
export declare const TextFieldGroupContext: import("react").Context<TextFieldGroupContextValue | null>;
|
|
20
|
-
export declare function TextField({ children, invalid: invalidNew, isInvalid, disabled: disabledProp, size: sizeProp, radius, leadingAddon, style, }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function TextField({ children, invalid: invalidNew, isInvalid, disabled: disabledProp, size: sizeProp, radius, leadingAddon, className, chromeClassName, style, }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
export declare function TextFieldInput({ label, placeholder, value, onValueChange: onValueChangeProp, onChangeText, onFocus, onBlur, invalid: invalidNew, isInvalid, disabled, size, inputRef, style, floatingLabel, secureTextEntry, revealable, revealLabels, locale, ...rest }: TextFieldInputProps): import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
/**
|
|
23
23
|
* The visible label ABOVE the field: `text-body-medium`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/text-field/TextField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextField.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EACR,OAAO,EAAE,WAAW,EACpB,SAAS,EACT,QAAQ,EACR,KAAK,GACN,EAAE,kBAAkB,2CAmBpB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAoB,EAAE,EAAE,kBAAkB,2CA4BrF;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,KAAK,GACN,EAAE,KAAK,CAAC,iBAAiB,CACxB,aAAa,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CAC7D,CACF,2CAyBA;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,2CAqCA"}
|
|
@@ -4,6 +4,10 @@ import type { Props as SVGIconProps } from '../icons/shared';
|
|
|
4
4
|
import type { TextFieldSize } from './shared';
|
|
5
5
|
export type { TextFieldSize } from './shared';
|
|
6
6
|
export type TextFieldProps = React.PropsWithChildren<{
|
|
7
|
+
/** Classes on the layout host: width, height and padding. */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Classes on the inset surface: background, border/ring and radius. State paint remains authoritative. */
|
|
10
|
+
chromeClassName?: string;
|
|
7
11
|
invalid?: boolean;
|
|
8
12
|
isInvalid?: boolean;
|
|
9
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/text-field/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;A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;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,iBAAiB,CACvD;IACE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,aAAa,CAClB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,iBAAiB,CACtD;IACE,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,aAAa,CAClB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IACxC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CACnC"}
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ const CSS = `@layer base {
|
|
|
21
21
|
function useStyles() { useInteractiveWebCss('bloom-accordion', CSS); }
|
|
22
22
|
|
|
23
23
|
/** RN Animated resolves numeric layout/opacity before this DOM host receives them. */
|
|
24
|
-
const PanelHost = forwardRef<HTMLDivElement, Omit<React.HTMLAttributes<HTMLDivElement>, 'style'> & { style?: StyleProp<ViewStyle
|
|
24
|
+
const PanelHost = forwardRef<HTMLDivElement, Omit<React.HTMLAttributes<HTMLDivElement>, 'style'> & { style?: StyleProp<ViewStyle>; collapsable?: boolean }>(function PanelHost({ style, collapsable: _collapsable, ...props }, ref) {
|
|
25
25
|
return <div {...props} ref={ref} style={resolveNativeWebStyle(style)} />;
|
|
26
26
|
});
|
|
27
27
|
const AnimatedPanel = Animated.createAnimatedComponent(PanelHost);
|
|
@@ -330,6 +330,8 @@ const CarouselComponent = function Carousel({
|
|
|
330
330
|
showArrows = true,
|
|
331
331
|
arrowsPlacement = 'header',
|
|
332
332
|
arrowsVisibility = 'always',
|
|
333
|
+
arrowButtonProps,
|
|
334
|
+
hideUnavailableArrows = false,
|
|
333
335
|
showDots = true,
|
|
334
336
|
align = 'start',
|
|
335
337
|
gap = 16,
|
|
@@ -364,6 +366,8 @@ const CarouselComponent = function Carousel({
|
|
|
364
366
|
controlledIndexRef.current = controlledIndex;
|
|
365
367
|
|
|
366
368
|
const scrollRef = useRef<ScrollView>(null);
|
|
369
|
+
const previousArrowRef = useRef<View>(null);
|
|
370
|
+
const nextArrowRef = useRef<View>(null);
|
|
367
371
|
const offsets = useRef(new Map<string, SlideOffset>());
|
|
368
372
|
const scroll = useRef({ x: 0, contentWidth: 0 });
|
|
369
373
|
const [trackWidth, setTrackWidth] = useState(0);
|
|
@@ -632,19 +636,40 @@ const CarouselComponent = function Carousel({
|
|
|
632
636
|
|
|
633
637
|
const overlay = arrowsPlacement === 'overlay';
|
|
634
638
|
const arrowsVisible = showArrows && count > 0;
|
|
635
|
-
//
|
|
636
|
-
//
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
639
|
+
// Slots stay mounted at the same edges even when their controls are hidden.
|
|
640
|
+
// Hover opacity belongs to the slot, leaving the button's recipe authoritative.
|
|
641
|
+
const arrow = (button: React.ReactElement, unavailable: boolean, ref: React.RefObject<View | null>) => {
|
|
642
|
+
const hidden = hideUnavailableArrows && unavailable;
|
|
643
|
+
return hideUnavailableArrows || (IS_WEB && arrowsVisibility === 'hover')
|
|
644
|
+
? <View ref={ref} {...webDataSet({ bloomCarouselArrow: '' })}
|
|
645
|
+
aria-hidden={hidden || undefined}
|
|
646
|
+
accessibilityElementsHidden={hidden}
|
|
647
|
+
importantForAccessibility={hidden ? 'no-hide-descendants' : 'auto'}
|
|
648
|
+
pointerEvents={hidden ? 'none' : 'auto'}
|
|
649
|
+
style={{ flexShrink: 0, ...(hidden ? { opacity: 0 } : undefined) }}>{button}</View>
|
|
650
|
+
: button;
|
|
651
|
+
};
|
|
652
|
+
useLayoutEffect(() => {
|
|
653
|
+
if (!IS_WEB || !hideUnavailableArrows || typeof HTMLElement === 'undefined') return;
|
|
654
|
+
const activeElement = document.activeElement;
|
|
655
|
+
for (const [unavailable, ref] of [[atStart, previousArrowRef], [atEnd, nextArrowRef]] as const) {
|
|
656
|
+
const slot: unknown = ref.current;
|
|
657
|
+
if (unavailable && slot instanceof HTMLElement && slot.contains(activeElement)) {
|
|
658
|
+
const trackNode: unknown = scrollRef.current?.getScrollableNode();
|
|
659
|
+
if (trackNode instanceof HTMLElement) trackNode.focus({ preventScroll: true });
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}, [atStart, atEnd, hideUnavailableArrows]);
|
|
641
664
|
const arrowButtons = <>
|
|
642
|
-
{arrow(<Button size={overlay ? 'lg' : 'sm'}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
665
|
+
{arrow(<Button size={overlay ? 'lg' : 'sm'} appearance="subtle" tone="neutral" {...arrowButtonProps}
|
|
666
|
+
icon={rtl ? RiArrowRightSLine : RiArrowLeftSLine}
|
|
667
|
+
accessibilityLabel={previousLabel} disabled={atStart} onPress={() => step(-1)} />,
|
|
668
|
+
atStart, previousArrowRef)}
|
|
669
|
+
{arrow(<Button size={overlay ? 'lg' : 'sm'} appearance="subtle" tone="neutral" {...arrowButtonProps}
|
|
670
|
+
icon={rtl ? RiArrowLeftSLine : RiArrowRightSLine}
|
|
671
|
+
accessibilityLabel={nextLabel} disabled={atEnd} onPress={() => step(1)} />,
|
|
672
|
+
atEnd, nextArrowRef)}
|
|
648
673
|
</>;
|
|
649
674
|
// iOS snapping reads physical offsets even though its imperative command and
|
|
650
675
|
// scroll events use logical offsets. Android converts snap offsets internally.
|
package/src/carousel/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Carousel, CarouselItem } from './Carousel';
|
|
2
|
-
export type { CarouselProps, CarouselItemProps } from './types';
|
|
2
|
+
export type { CarouselProps, CarouselItemProps, CarouselArrowButtonProps } from './types';
|
package/src/carousel/types.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { ButtonProps } from '../button/types';
|
|
4
|
+
|
|
5
|
+
/** Visual options only; the carousel retains navigation, names and disabled state. */
|
|
6
|
+
export type CarouselArrowButtonProps = Pick<ButtonProps,
|
|
7
|
+
'className' | 'material' | 'appearance' | 'tone' | 'size' | 'iconSize'>;
|
|
3
8
|
|
|
4
9
|
export interface CarouselProps {
|
|
5
10
|
/** `CarouselItem`s. Each is labelled "N of M" for assistive technology. */
|
|
@@ -25,6 +30,10 @@ export interface CarouselProps {
|
|
|
25
30
|
* them visible. showArrows still controls whether they are rendered.
|
|
26
31
|
*/
|
|
27
32
|
arrowsVisibility?: 'always' | 'hover';
|
|
33
|
+
/** Optional visual recipe for both arrow buttons. Navigation remains carousel-owned. */
|
|
34
|
+
arrowButtonProps?: CarouselArrowButtonProps;
|
|
35
|
+
/** Hide unavailable arrows without moving their slots; hidden controls are not focusable. Defaults to false. */
|
|
36
|
+
hideUnavailableArrows?: boolean;
|
|
28
37
|
/** Position indicator below the track. Defaults to `true`. */
|
|
29
38
|
showDots?: boolean;
|
|
30
39
|
/** Where a slide comes to rest when it snaps. Defaults to `'start'`. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useChoiceSpaceKey } from '../hooks/use-choice-space-key';
|
|
1
2
|
import { useControllableState } from '../hooks/use-controllable-state';
|
|
2
3
|
import { useBloomAppearance } from '../appearance';
|
|
3
4
|
import { resolveBloomColors } from '../appearance/colors';
|
|
@@ -87,6 +88,7 @@ const CheckboxComponent: React.FC<CheckboxProps> = (props) => {
|
|
|
87
88
|
defaultChecked = false,
|
|
88
89
|
onCheckedChange,
|
|
89
90
|
label,
|
|
91
|
+
labelContent,
|
|
90
92
|
description,
|
|
91
93
|
size: sizeProp,
|
|
92
94
|
disabled = false,
|
|
@@ -130,7 +132,8 @@ const CheckboxComponent: React.FC<CheckboxProps> = (props) => {
|
|
|
130
132
|
}
|
|
131
133
|
}, [checked, isDisabled, setChecked]);
|
|
132
134
|
|
|
133
|
-
const
|
|
135
|
+
const hasLabel = labelContent != null || Boolean(label);
|
|
136
|
+
const hasText = hasLabel || Boolean(description);
|
|
134
137
|
|
|
135
138
|
const rowStyle = useMemo(
|
|
136
139
|
(): WebCssStyle => ({
|
|
@@ -146,8 +149,11 @@ const CheckboxComponent: React.FC<CheckboxProps> = (props) => {
|
|
|
146
149
|
|
|
147
150
|
const slop = Math.max(8, Math.ceil((MIN_TOUCH_TARGET - sizeConfig.box) / 2));
|
|
148
151
|
|
|
152
|
+
const spaceKey = useChoiceSpaceKey(isDisabled, handlePress);
|
|
153
|
+
|
|
149
154
|
return (
|
|
150
155
|
<Pressable
|
|
156
|
+
{...spaceKey}
|
|
151
157
|
// The DOM hooks the adopted sheets hang off. Through `dataSet`, because
|
|
152
158
|
// react-native-web drops any prop outside its own fixed list — a literal
|
|
153
159
|
// `'data-bloom-checkbox'` prop never reaches the DOM. See the longer note
|
|
@@ -191,7 +197,11 @@ const CheckboxComponent: React.FC<CheckboxProps> = (props) => {
|
|
|
191
197
|
|
|
192
198
|
{hasText && (
|
|
193
199
|
<View style={{ flex: 1 }}>
|
|
194
|
-
{
|
|
200
|
+
{labelContent != null ? (
|
|
201
|
+
<View pointerEvents="none" aria-hidden accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
|
|
202
|
+
{labelContent}
|
|
203
|
+
</View>
|
|
204
|
+
) : label && (
|
|
195
205
|
<Text variant={sizeConfig.label} style={[{ color: paint.text }, labelStyle]}>
|
|
196
206
|
{label}
|
|
197
207
|
</Text>
|
|
@@ -199,7 +209,7 @@ const CheckboxComponent: React.FC<CheckboxProps> = (props) => {
|
|
|
199
209
|
{description && (
|
|
200
210
|
<Text
|
|
201
211
|
variant={sizeConfig.description}
|
|
202
|
-
style={{ color: paint.description, marginTop:
|
|
212
|
+
style={{ color: paint.description, marginTop: hasLabel ? DESCRIPTION_GAP : 0 }}
|
|
203
213
|
>
|
|
204
214
|
{description}
|
|
205
215
|
</Text>
|
package/src/checkbox/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import type { BloomSize } from '../appearance';
|
|
2
3
|
import type { BloomTone } from '../appearance';
|
|
3
4
|
import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
@@ -12,6 +13,9 @@ export interface CheckboxProps {
|
|
|
12
13
|
onCheckedChange?: (checked: boolean) => void;
|
|
13
14
|
/** Optional label text. */
|
|
14
15
|
label?: string;
|
|
16
|
+
/** Decorative label layout, rendered in a View instead of Text. Supply
|
|
17
|
+
* `label` or `accessibilityLabel` for its accessible name. Do not nest controls. */
|
|
18
|
+
labelContent?: ReactNode;
|
|
15
19
|
/** Optional description shown below the label. */
|
|
16
20
|
description?: string;
|
|
17
21
|
/** Size preset. */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useRef, type KeyboardEvent } from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/** RNW Pressable activates Enter for every role, but Space only for buttons.
|
|
5
|
+
* Checkbox/radio rows own the missing Space gesture. Native keeps Pressable's
|
|
6
|
+
* platform handling. Activation waits for keyup and is cancelled by blur. */
|
|
7
|
+
export function useChoiceSpaceKey(disabled: boolean, activate: () => void) {
|
|
8
|
+
const armed = useRef(false);
|
|
9
|
+
if (Platform.OS !== 'web') return {};
|
|
10
|
+
return {
|
|
11
|
+
onKeyDown(event: KeyboardEvent<HTMLElement>) {
|
|
12
|
+
if (event.key !== ' ' && event.key !== 'Spacebar') return;
|
|
13
|
+
if (event.target !== event.currentTarget || disabled) return;
|
|
14
|
+
event.preventDefault();
|
|
15
|
+
event.stopPropagation();
|
|
16
|
+
if (!event.repeat) armed.current = true;
|
|
17
|
+
},
|
|
18
|
+
onKeyUp(event: KeyboardEvent<HTMLElement>) {
|
|
19
|
+
if (event.key !== ' ' && event.key !== 'Spacebar') return;
|
|
20
|
+
const wasArmed = armed.current;
|
|
21
|
+
armed.current = false;
|
|
22
|
+
if (event.target !== event.currentTarget || disabled || !wasArmed) return;
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
event.stopPropagation();
|
|
25
|
+
activate();
|
|
26
|
+
},
|
|
27
|
+
onBlur() { armed.current = false; },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform, type StyleProp, type TextStyle } from 'react-native';
|
|
3
|
+
import { Text } from '../typography';
|
|
4
|
+
import { resolveNativeWebStyle } from '../styles/resolve-native-web-style';
|
|
5
|
+
|
|
6
|
+
/** The animated label and its measuring copy share one typography owner.
|
|
7
|
+
* RNW's unlayered Text reset would outrank a caller's layered recipe, so the
|
|
8
|
+
* web class slot uses a span. Native delegates class interop to Bloom Text. */
|
|
9
|
+
export function FollowLabel({ children, className, style, numberOfLines }: {
|
|
10
|
+
children: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: StyleProp<TextStyle>;
|
|
13
|
+
numberOfLines?: number;
|
|
14
|
+
}) {
|
|
15
|
+
if (Platform.OS === 'web' && className?.trim()) {
|
|
16
|
+
return <span className={className} style={{
|
|
17
|
+
display: 'block', fontFamily: 'var(--bloom-font-sans)',
|
|
18
|
+
...(numberOfLines === 1 && { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }),
|
|
19
|
+
...resolveNativeWebStyle(style),
|
|
20
|
+
}}>{children}</span>;
|
|
21
|
+
}
|
|
22
|
+
return <Text variant="body-semibold" className={className} style={style} numberOfLines={numberOfLines}>{children}</Text>;
|
|
23
|
+
}
|
|
@@ -22,6 +22,7 @@ import { PlayButton } from '../media-controls/PlayButton';
|
|
|
22
22
|
import { borderRadius, DISABLED_OPACITY } from '../styles/tokens';
|
|
23
23
|
import type { WebCssStyle } from '../styles/web-view-style';
|
|
24
24
|
import { Text } from '../typography';
|
|
25
|
+
import { FollowLabel } from './FollowLabel';
|
|
25
26
|
import { useMediaHeaderPaint } from './parts';
|
|
26
27
|
import { IS_WEB } from './shared';
|
|
27
28
|
import { clamp01 } from '../styles/clamp';
|
|
@@ -293,6 +294,10 @@ function FollowButtonComponent({
|
|
|
293
294
|
accessibilityLabel,
|
|
294
295
|
accessibilityHint,
|
|
295
296
|
color,
|
|
297
|
+
appearance = 'subtle',
|
|
298
|
+
material,
|
|
299
|
+
className,
|
|
300
|
+
labelClassName,
|
|
296
301
|
tone = 'support',
|
|
297
302
|
iconOnly = false,
|
|
298
303
|
size: sizeProp,
|
|
@@ -326,28 +331,28 @@ function FollowButtonComponent({
|
|
|
326
331
|
}, [disabled, following, loading, pressOffset, reducedMotion]);
|
|
327
332
|
const idleLabelStyle = useAnimatedStyle(() => ({ opacity: 1 - progress.value, transform: [{ translateY: -8 * progress.value + pressOffset.value }] }), [progress, pressOffset]);
|
|
328
333
|
const followedLabelStyle = useAnimatedStyle(() => ({ opacity: progress.value, transform: [{ translateY: 8 * (1 - progress.value) + pressOffset.value }] }), [progress, pressOffset]);
|
|
329
|
-
const labelColor = color ?? resolveButtonPalette(
|
|
334
|
+
const labelColor = color ?? resolveButtonPalette(appearance, theme, tone).rest.foreground;
|
|
330
335
|
const visual = (
|
|
331
336
|
<View pointerEvents="none" aria-hidden accessibilityElementsHidden importantForAccessibility="no-hide-descendants"
|
|
332
337
|
style={{ height: 24, overflow: 'hidden', ...(iconOnly ? { width: 20 } : {}), justifyContent: 'center' }}>
|
|
333
338
|
{!iconOnly && <View style={{ height: 0, overflow: 'hidden' }}>
|
|
334
|
-
<
|
|
335
|
-
<
|
|
339
|
+
<FollowLabel className={labelClassName} style={textStyle}>{label}</FollowLabel>
|
|
340
|
+
<FollowLabel className={labelClassName} style={textStyle}>{followingLabel}</FollowLabel>
|
|
336
341
|
</View>}
|
|
337
342
|
<Animated.View testID={testID ? `${testID}-idle-label` : undefined}
|
|
338
343
|
style={[{ position: 'absolute', left: 0, right: 0, alignItems: 'center' }, idleLabelStyle]}>
|
|
339
344
|
{iconOnly ? <RiUserAddLine width={20} height={20} fill={labelColor} />
|
|
340
|
-
: <
|
|
345
|
+
: <FollowLabel className={labelClassName} style={[{ color: color ?? (labelClassName?.trim() ? undefined : labelColor) }, textStyle]} numberOfLines={1}>{label}</FollowLabel>}
|
|
341
346
|
</Animated.View>
|
|
342
347
|
<Animated.View testID={testID ? `${testID}-following-label` : undefined}
|
|
343
348
|
style={[{ position: 'absolute', left: 0, right: 0, alignItems: 'center' }, followedLabelStyle]}>
|
|
344
349
|
{iconOnly ? <RiUserFollowLine width={20} height={20} fill={labelColor} />
|
|
345
|
-
: <
|
|
350
|
+
: <FollowLabel className={labelClassName} style={[{ color: color ?? (labelClassName?.trim() ? undefined : labelColor) }, textStyle]} numberOfLines={1}>{followingLabel}</FollowLabel>}
|
|
346
351
|
</Animated.View>
|
|
347
352
|
</View>
|
|
348
353
|
);
|
|
349
354
|
return (
|
|
350
|
-
<Button appearance=
|
|
355
|
+
<Button appearance={appearance} material={material} className={className} tone={tone} size={size} iconOnly={iconOnly}
|
|
351
356
|
pressed={following} stopPropagation accessibilityLabel={accessibilityLabel ?? label}
|
|
352
357
|
accessibilityHint={accessibilityHint} disabled={disabled} loading={loading}
|
|
353
358
|
onPressIn={previewLabel} onPressOut={restoreLabel}
|
|
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import type { BloomTone } from '../appearance';
|
|
5
|
+
import type { ButtonProps } from '../button/types';
|
|
5
6
|
import type { BloomIconComponent } from '../icons/icon-component';
|
|
6
7
|
import type { WebAriaProps } from '../styles/styled-primitives';
|
|
7
8
|
|
|
@@ -150,6 +151,15 @@ export interface DownloadButtonProps extends ToggleBase {
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
export interface FollowButtonProps extends ToggleBase {
|
|
154
|
+
/** Shared Button surface; defaults to subtle. */
|
|
155
|
+
appearance?: ButtonProps['appearance'];
|
|
156
|
+
/** Shared Button material; preserves the standard surface by default. */
|
|
157
|
+
material?: ButtonProps['material'];
|
|
158
|
+
/** Classes on the Button layout and surface owner. */
|
|
159
|
+
className?: string;
|
|
160
|
+
/** Typography classes on both animated labels and their measuring copies.
|
|
161
|
+
* Text mode only; explicit color/textStyle still take precedence. */
|
|
162
|
+
labelClassName?: string;
|
|
153
163
|
/** Shared Button tone. Defaults to support (secondary). */
|
|
154
164
|
tone?: BloomTone;
|
|
155
165
|
/** Compact toggle with icons and the same accessible name. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { initialFocusWithin, listenForEscape, wrapTab } from './modal-keyboard';
|
|
4
|
+
import { initialFocusWithin, listenForEscape, restoreFocusWhenAvailable, wrapTab } from './modal-keyboard';
|
|
5
5
|
import { useOverlayLayerContext } from './Overlay';
|
|
6
6
|
import { isTopmostOverlayLayer } from './stack';
|
|
7
7
|
|
|
@@ -39,20 +39,20 @@ export function ModalKeyboard({ panelRef, closing = false, dismissible, dismiss
|
|
|
39
39
|
const state = useRef({ closing, dismissible, dismiss });
|
|
40
40
|
state.current = { closing, dismissible, dismiss };
|
|
41
41
|
const opener = useRef<HTMLElement | null>(null);
|
|
42
|
+
const cancelRestore = useRef<(() => void) | undefined>(undefined);
|
|
42
43
|
|
|
43
44
|
const restoreFocus = useCallback(() => {
|
|
44
45
|
const target = opener.current;
|
|
45
46
|
opener.current = null;
|
|
46
47
|
if (!target?.isConnected || typeof document === 'undefined') return;
|
|
47
48
|
const panel = panelRef.current as unknown as HTMLElement | null;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// moved focus on purpose while closing keeps its choice.
|
|
51
|
-
if (!active || active === document.body || panel?.contains(active)) target.focus({ preventScroll: true });
|
|
49
|
+
cancelRestore.current?.();
|
|
50
|
+
cancelRestore.current = restoreFocusWhenAvailable(target, panel);
|
|
52
51
|
}, [panelRef]);
|
|
53
52
|
|
|
54
53
|
useEffect(() => {
|
|
55
54
|
if (typeof window === 'undefined' || typeof document === 'undefined') return;
|
|
55
|
+
cancelRestore.current?.();
|
|
56
56
|
const active = document.activeElement;
|
|
57
57
|
opener.current = active instanceof HTMLElement && active !== document.body ? active : null;
|
|
58
58
|
const panel = () => panelRef.current as unknown as HTMLElement | null;
|
|
@@ -140,3 +140,33 @@ export function listenForEscape(claim: () => boolean, dismiss: () => void): () =
|
|
|
140
140
|
pending = null;
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
+
|
|
144
|
+
/** A modal may begin closing before its opener stops being inert. */
|
|
145
|
+
export function restoreFocusWhenAvailable(target: HTMLElement, panel: HTMLElement | null): () => void {
|
|
146
|
+
if (!hasDom()) return () => {};
|
|
147
|
+
let observer: MutationObserver | undefined;
|
|
148
|
+
let done = false;
|
|
149
|
+
const cancel = () => {
|
|
150
|
+
done = true;
|
|
151
|
+
observer?.disconnect();
|
|
152
|
+
document.removeEventListener('focusin', attempt);
|
|
153
|
+
};
|
|
154
|
+
function attempt() {
|
|
155
|
+
if (done) return;
|
|
156
|
+
if (!target.isConnected) { cancel(); return; }
|
|
157
|
+
const active = document.activeElement;
|
|
158
|
+
// Closing must not steal a host's deliberate destination, or focus from a
|
|
159
|
+
// subsequently opened modal. A removed focused panel leaves body active.
|
|
160
|
+
if (active && active !== document.body && !panel?.contains(active)) { cancel(); return; }
|
|
161
|
+
if (target.closest('[inert]')) return;
|
|
162
|
+
cancel();
|
|
163
|
+
target.focus({ preventScroll: true });
|
|
164
|
+
}
|
|
165
|
+
observer = new MutationObserver(attempt);
|
|
166
|
+
// Watch the actual inert boundary lifecycle, never an assumed exit duration.
|
|
167
|
+
// Child changes also terminate the observer when its opener is removed.
|
|
168
|
+
observer.observe(document.body, { subtree:true, childList:true, attributes:true, attributeFilter:['inert'] });
|
|
169
|
+
document.addEventListener('focusin', attempt);
|
|
170
|
+
attempt();
|
|
171
|
+
return cancel;
|
|
172
|
+
}
|