@oxy.so/bloom 7.16.0 → 7.17.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 +4 -4
- package/docs/carousel.mdx +22 -0
- package/docs/dialog.mdx +15 -0
- package/docs/overlay.mdx +9 -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/dialog/Dialog.js +12 -2
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +26 -4
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/DialogMorph.js +4 -4
- package/lib/commonjs/overlay/ModalKeyboard.js +8 -6
- package/lib/commonjs/overlay/ModalKeyboard.js.map +1 -1
- package/lib/commonjs/overlay/modal-keyboard.js +54 -0
- package/lib/commonjs/overlay/modal-keyboard.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/dialog/Dialog.js +12 -2
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +26 -4
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/DialogMorph.js +4 -4
- package/lib/module/overlay/ModalKeyboard.js +9 -7
- package/lib/module/overlay/ModalKeyboard.js.map +1 -1
- package/lib/module/overlay/modal-keyboard.js +52 -0
- package/lib/module/overlay/modal-keyboard.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/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogMorph.d.ts +4 -4
- package/lib/typescript/commonjs/overlay/ModalKeyboard.d.ts +1 -1
- package/lib/typescript/commonjs/overlay/modal-keyboard.d.ts +4 -0
- package/lib/typescript/commonjs/overlay/modal-keyboard.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/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogMorph.d.ts +4 -4
- package/lib/typescript/module/overlay/ModalKeyboard.d.ts +1 -1
- package/lib/typescript/module/overlay/modal-keyboard.d.ts +4 -0
- package/lib/typescript/module/overlay/modal-keyboard.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/dialog/Dialog.tsx +8 -3
- package/src/dialog/Dialog.web.tsx +39 -23
- package/src/dialog/DialogMorph.tsx +4 -4
- package/src/overlay/ModalKeyboard.tsx +7 -7
- package/src/overlay/modal-keyboard.ts +39 -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
|
@@ -136,10 +136,10 @@ export type DialogMorph = ReturnType<typeof useDialogMorph>;
|
|
|
136
136
|
* declare swaps via {@link useDialogFrame}), measures the content's natural
|
|
137
137
|
* height, and carries the incoming-frame fade.
|
|
138
138
|
*
|
|
139
|
-
*
|
|
140
|
-
* growing
|
|
141
|
-
*
|
|
142
|
-
*
|
|
139
|
+
* With natural-height measurement enabled, render inside the surface's scroll
|
|
140
|
+
* content without a growing style: the incoming frame must report its own
|
|
141
|
+
* height while the panel is pinned at the outgoing one. A surface whose child
|
|
142
|
+
* owns scrolling disables measurement and passes a bounded flex style instead.
|
|
143
143
|
*/
|
|
144
144
|
export declare function DialogMorphContent({ morph, style, children, }: {
|
|
145
145
|
morph: DialogMorph;
|
|
@@ -16,7 +16,7 @@ export interface ModalKeyboardProps {
|
|
|
16
16
|
* and the web `BottomSheet`.
|
|
17
17
|
*
|
|
18
18
|
* - Focus moves INTO the panel when it opens — to whatever the content
|
|
19
|
-
* focused itself (an `autoFocus` field), else the first tabbable, else the
|
|
19
|
+
* focused itself (an `autoFocus` field), else the first visible tabbable, else the
|
|
20
20
|
* panel — and goes BACK to the element that had it once the surface starts
|
|
21
21
|
* closing (or unmounts), unless the host has already put it somewhere else.
|
|
22
22
|
* - Tab and Shift+Tab wrap at the panel's edges.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** The elements inside `node` that Tab can land on, in document order. */
|
|
2
2
|
export declare function tabbablesWithin(node: HTMLElement | null): HTMLElement[];
|
|
3
|
+
/** Initial focus must not scroll long content to an offscreen action. Tab still reaches every control. */
|
|
4
|
+
export declare function initialFocusWithin(node: HTMLElement): HTMLElement;
|
|
3
5
|
/**
|
|
4
6
|
* Keep Tab inside `node`: from the last tabbable (or from outside) forward to
|
|
5
7
|
* the first, from the first (or from outside) backward to the last. Returns
|
|
@@ -14,4 +16,6 @@ export declare function wrapTab(event: KeyboardEvent, node: HTMLElement | null):
|
|
|
14
16
|
* whatever the caller's own bookkeeping says.
|
|
15
17
|
*/
|
|
16
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;
|
|
17
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;;;;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,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.d.ts","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AAO,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;AAC7D,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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'`. */
|
package/src/dialog/Dialog.tsx
CHANGED
|
@@ -304,6 +304,7 @@ function CenteredOrSideDialog({
|
|
|
304
304
|
<SideSheet
|
|
305
305
|
presentation={presentation}
|
|
306
306
|
exitDuration={exitDuration}
|
|
307
|
+
scrollable={scrollableResolved}
|
|
307
308
|
open={sideOpen}
|
|
308
309
|
onDismiss={handleDismiss}
|
|
309
310
|
side={placement}
|
|
@@ -341,7 +342,8 @@ function CenteredOrSideDialog({
|
|
|
341
342
|
// Nav-header mode hides the drag handle (the nav bar sits at the very top)
|
|
342
343
|
// and coordinates the body pan with the scroll so content scrolls.
|
|
343
344
|
showHandle={!header}
|
|
344
|
-
|
|
345
|
+
scrollable={scrollableResolved}
|
|
346
|
+
manualActivation={!!header && scrollableResolved}
|
|
345
347
|
scrollY={header ? headerController.scrollY : undefined}
|
|
346
348
|
headerOverlay={
|
|
347
349
|
header ? (
|
|
@@ -374,6 +376,7 @@ function CenteredOrSideDialog({
|
|
|
374
376
|
// Nav-header mode: the large title + screens own their padding.
|
|
375
377
|
header ? null : { padding: contentPadding },
|
|
376
378
|
{ backgroundColor: 'transparent' },
|
|
379
|
+
scrollableResolved ? null : { flex: 1, minHeight: 0 },
|
|
377
380
|
style,
|
|
378
381
|
panelStyle,
|
|
379
382
|
]}
|
|
@@ -381,7 +384,7 @@ function CenteredOrSideDialog({
|
|
|
381
384
|
{/* The morph layer is its own node INSIDE the class-name'd container:
|
|
382
385
|
a className'd component's `onLayout` never fires on web, and this
|
|
383
386
|
one has to measure the incoming frame. */}
|
|
384
|
-
<DialogMorphContent morph={morphState}>
|
|
387
|
+
<DialogMorphContent morph={morphState} style={scrollableResolved ? undefined : { flex: 1, minHeight: 0 }}>
|
|
385
388
|
{header ? headerBody : bodyNode}
|
|
386
389
|
</DialogMorphContent>
|
|
387
390
|
</StyledView>
|
|
@@ -399,6 +402,7 @@ function CenteredOrSideDialog({
|
|
|
399
402
|
* exit animations are safe (the web `removeChild` crash does not apply).
|
|
400
403
|
*/
|
|
401
404
|
function SideSheet({
|
|
405
|
+
scrollable,
|
|
402
406
|
presentation,
|
|
403
407
|
exitDuration,
|
|
404
408
|
open,
|
|
@@ -424,6 +428,7 @@ function SideSheet({
|
|
|
424
428
|
style,
|
|
425
429
|
children,
|
|
426
430
|
}: {
|
|
431
|
+
scrollable: boolean;
|
|
427
432
|
presentation?: DialogProps['presentation'];
|
|
428
433
|
exitDuration?: number;
|
|
429
434
|
open: boolean;
|
|
@@ -608,7 +613,7 @@ function SideSheet({
|
|
|
608
613
|
<DialogHeaderProvider controller={headerController}>{surfaceChildren}</DialogHeaderProvider>
|
|
609
614
|
</View>
|
|
610
615
|
) : (
|
|
611
|
-
<View style={{ padding: contentPadding, flex: presentation === 'custom' ? 1 : undefined, minHeight: 0, borderRadius: panelRadius, overflow: presentation === 'custom' ? 'visible' : 'hidden' }}>{surfaceChildren}</View>
|
|
616
|
+
<View style={{ padding: contentPadding, flex: presentation === 'custom' || !scrollable ? 1 : undefined, minHeight: 0, borderRadius: panelRadius, overflow: presentation === 'custom' ? 'visible' : 'hidden' }}>{surfaceChildren}</View>
|
|
612
617
|
)}
|
|
613
618
|
</SurfaceLevelProvider>
|
|
614
619
|
</AnimatedStyledView>
|
|
@@ -825,31 +825,47 @@ function SheetSurface({
|
|
|
825
825
|
onDismiss={onDismiss}
|
|
826
826
|
collapse={false}
|
|
827
827
|
/>
|
|
828
|
-
|
|
829
|
-
style={{
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
828
|
+
{scrollable === false ? (
|
|
829
|
+
<View style={{ flex: 1, minHeight: 0, paddingBottom: contentPadding }}>
|
|
830
|
+
<DialogNavBarSpacer controller={headerController} header={header} />
|
|
831
|
+
<DialogHeaderProvider controller={headerController}>
|
|
832
|
+
<DialogBody
|
|
833
|
+
titleId={titleId}
|
|
834
|
+
descriptionId={descriptionId}
|
|
835
|
+
title={title}
|
|
836
|
+
description={description}
|
|
837
|
+
actions={actions}
|
|
838
|
+
>
|
|
839
|
+
{surfaceChildren}
|
|
840
|
+
</DialogBody>
|
|
841
|
+
</DialogHeaderProvider>
|
|
842
|
+
</View>
|
|
843
|
+
) : (
|
|
844
|
+
<ScrollView
|
|
845
|
+
style={{ flexShrink: 1 }}
|
|
846
|
+
contentContainerStyle={{ paddingTop: DIALOG_NAV_BAR_HEIGHT, paddingBottom: contentPadding }}
|
|
847
|
+
showsVerticalScrollIndicator={false}
|
|
848
|
+
scrollEventThrottle={16}
|
|
849
|
+
onScroll={(e) => {
|
|
850
|
+
headerController.scrollY.value = e.nativeEvent.contentOffset.y;
|
|
851
|
+
}}
|
|
852
|
+
>
|
|
853
|
+
<DialogHeaderProvider controller={headerController}>
|
|
854
|
+
<DialogBody
|
|
855
|
+
titleId={titleId}
|
|
856
|
+
descriptionId={descriptionId}
|
|
857
|
+
title={title}
|
|
858
|
+
description={description}
|
|
859
|
+
actions={actions}
|
|
860
|
+
>
|
|
861
|
+
{surfaceChildren}
|
|
862
|
+
</DialogBody>
|
|
863
|
+
</DialogHeaderProvider>
|
|
864
|
+
</ScrollView>
|
|
865
|
+
)}
|
|
850
866
|
</View>
|
|
851
867
|
) : (
|
|
852
|
-
<View style={{ padding: contentPadding }}>
|
|
868
|
+
<View style={[{ padding: contentPadding }, scrollable === false && { flex: 1, minHeight: 0 }]}>
|
|
853
869
|
<DialogBody
|
|
854
870
|
titleId={titleId}
|
|
855
871
|
descriptionId={descriptionId}
|
|
@@ -552,10 +552,10 @@ export type DialogMorph = ReturnType<typeof useDialogMorph>;
|
|
|
552
552
|
* declare swaps via {@link useDialogFrame}), measures the content's natural
|
|
553
553
|
* height, and carries the incoming-frame fade.
|
|
554
554
|
*
|
|
555
|
-
*
|
|
556
|
-
* growing
|
|
557
|
-
*
|
|
558
|
-
*
|
|
555
|
+
* With natural-height measurement enabled, render inside the surface's scroll
|
|
556
|
+
* content without a growing style: the incoming frame must report its own
|
|
557
|
+
* height while the panel is pinned at the outgoing one. A surface whose child
|
|
558
|
+
* owns scrolling disables measurement and passes a bounded flex style instead.
|
|
559
559
|
*/
|
|
560
560
|
export function DialogMorphContent({
|
|
561
561
|
morph,
|
|
@@ -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 { listenForEscape,
|
|
4
|
+
import { initialFocusWithin, listenForEscape, restoreFocusWhenAvailable, wrapTab } from './modal-keyboard';
|
|
5
5
|
import { useOverlayLayerContext } from './Overlay';
|
|
6
6
|
import { isTopmostOverlayLayer } from './stack';
|
|
7
7
|
|
|
@@ -22,7 +22,7 @@ export interface ModalKeyboardProps {
|
|
|
22
22
|
* and the web `BottomSheet`.
|
|
23
23
|
*
|
|
24
24
|
* - Focus moves INTO the panel when it opens — to whatever the content
|
|
25
|
-
* focused itself (an `autoFocus` field), else the first tabbable, else the
|
|
25
|
+
* focused itself (an `autoFocus` field), else the first visible tabbable, else the
|
|
26
26
|
* panel — and goes BACK to the element that had it once the surface starts
|
|
27
27
|
* closing (or unmounts), unless the host has already put it somewhere else.
|
|
28
28
|
* - Tab and Shift+Tab wrap at the panel's edges.
|
|
@@ -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();
|
|
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;
|
|
@@ -60,7 +60,7 @@ export function ModalKeyboard({ panelRef, closing = false, dismissible, dismiss
|
|
|
60
60
|
const frame = requestAnimationFrame(() => {
|
|
61
61
|
const node = panel();
|
|
62
62
|
if (!node || node.contains(document.activeElement) || !isTopmostOverlayLayer(layer)) return;
|
|
63
|
-
(
|
|
63
|
+
initialFocusWithin(node).focus({ preventScroll: true });
|
|
64
64
|
});
|
|
65
65
|
const onTab = (event: KeyboardEvent) => {
|
|
66
66
|
if (event.defaultPrevented || !isTopmostOverlayLayer(layer)) return;
|
|
@@ -59,6 +59,15 @@ export function tabbablesWithin(node: HTMLElement | null): HTMLElement[] {
|
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/** Initial focus must not scroll long content to an offscreen action. Tab still reaches every control. */
|
|
63
|
+
export function initialFocusWithin(node: HTMLElement): HTMLElement {
|
|
64
|
+
const panel = node.getBoundingClientRect();
|
|
65
|
+
return tabbablesWithin(node).find(element => {
|
|
66
|
+
const rect = element.getBoundingClientRect();
|
|
67
|
+
return rect.top >= panel.top && rect.bottom <= panel.bottom && rect.left >= panel.left && rect.right <= panel.right;
|
|
68
|
+
}) ?? node;
|
|
69
|
+
}
|
|
70
|
+
|
|
62
71
|
/**
|
|
63
72
|
* Keep Tab inside `node`: from the last tabbable (or from outside) forward to
|
|
64
73
|
* the first, from the first (or from outside) backward to the last. Returns
|
|
@@ -131,3 +140,33 @@ export function listenForEscape(claim: () => boolean, dismiss: () => void): () =
|
|
|
131
140
|
pending = null;
|
|
132
141
|
};
|
|
133
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
|
+
}
|
package/src/search/Search.tsx
CHANGED
|
@@ -2,6 +2,8 @@ import { forwardRef, useCallback, useMemo, useRef } from 'react';
|
|
|
2
2
|
import { Platform, type TextInput, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { mergeRefs } from '../hooks/merge-refs';
|
|
5
|
+
import { FieldBox } from '../text-field/FieldBox';
|
|
6
|
+
import type { SearchProps } from './types';
|
|
5
7
|
import { useDirectionProps, useIsRtl } from '../hooks/use-is-rtl';
|
|
6
8
|
import { useCommonMessages } from '../locale/common-messages';
|
|
7
9
|
import { useMessages } from '../locale/messages';
|
|
@@ -11,20 +13,12 @@ import { useTheme } from '../theme/use-theme';
|
|
|
11
13
|
import { atoms as a } from '../styles';
|
|
12
14
|
import { borderRadius } from '../styles/tokens';
|
|
13
15
|
import { GlyphButton } from '../button';
|
|
14
|
-
import { TextField, TextFieldIcon, TextFieldInput
|
|
16
|
+
import { TextField, TextFieldIcon, TextFieldInput } from '../text-field';
|
|
15
17
|
import { RiSearchLine as MagnifyingGlassIcon } from '../icons/remix/RiSearchLine';
|
|
16
18
|
import { RiCloseLine as X } from '../icons/remix/RiCloseLine';
|
|
17
19
|
|
|
18
|
-
type SearchProps = Omit<TextFieldInputProps, 'label'> & {
|
|
19
|
-
label?: TextFieldInputProps['label'];
|
|
20
|
-
/**
|
|
21
|
-
* Called when the user presses the clear (X) button.
|
|
22
|
-
*/
|
|
23
|
-
onClearText?: () => void;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
20
|
export const Search = forwardRef<TextInput, SearchProps>(
|
|
27
|
-
function Search({ value, label: labelProp, onClearText, onFocus, onPressIn, ...rest }, ref) {
|
|
21
|
+
function Search({ value, label: labelProp, onClearText, onFocus, onPressIn, fieldClassName, fieldChromeClassName, containerClassName, containerStyle, ...rest }, ref) {
|
|
28
22
|
const theme = useTheme();
|
|
29
23
|
const direction = useDirectionProps();
|
|
30
24
|
const rtl = useIsRtl();
|
|
@@ -69,8 +63,8 @@ export const Search = forwardRef<TextInput, SearchProps>(
|
|
|
69
63
|
);
|
|
70
64
|
|
|
71
65
|
return (
|
|
72
|
-
<
|
|
73
|
-
<TextField radius={borderRadius.full}>
|
|
66
|
+
<FieldBox {...direction} className={containerClassName} style={containerStyle} baseStyle={[a.w_full, a.relative]}>
|
|
67
|
+
<TextField radius={borderRadius.full} className={fieldClassName} chromeClassName={fieldChromeClassName}>
|
|
74
68
|
<TextFieldIcon icon={MagnifyingGlassIcon} />
|
|
75
69
|
<TextFieldInput
|
|
76
70
|
inputRef={refs}
|
|
@@ -113,7 +107,7 @@ export const Search = forwardRef<TextInput, SearchProps>(
|
|
|
113
107
|
/>
|
|
114
108
|
</View>
|
|
115
109
|
)}
|
|
116
|
-
</
|
|
110
|
+
</FieldBox>
|
|
117
111
|
);
|
|
118
112
|
},
|
|
119
113
|
);
|
package/src/search/index.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import type { TextFieldInputProps } from '../text-field/types';
|
|
3
|
+
|
|
4
|
+
export type SearchProps = Omit<TextFieldInputProps, 'label'> & {
|
|
5
|
+
label?: TextFieldInputProps['label'];
|
|
6
|
+
/** Called when the user presses the clear button. */
|
|
7
|
+
onClearText?: () => void;
|
|
8
|
+
/** Field layout classes (height, width and padding). */
|
|
9
|
+
fieldClassName?: string;
|
|
10
|
+
/** Inset surface classes (background, border/ring and radius). */
|
|
11
|
+
fieldChromeClassName?: string;
|
|
12
|
+
/** Classes on the outer layout box, including the clear control. */
|
|
13
|
+
containerClassName?: string;
|
|
14
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
15
|
+
};
|