@oxyhq/bloom 0.16.2 → 0.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/README.md +54 -16
- package/lib/commonjs/admonition/index.js +24 -23
- package/lib/commonjs/admonition/index.js.map +1 -1
- package/lib/commonjs/combobox/Combobox.js +7 -7
- package/lib/commonjs/combobox/Combobox.js.map +1 -1
- package/lib/commonjs/context-menu/context.js +2 -2
- package/lib/commonjs/context-menu/context.js.map +1 -1
- package/lib/commonjs/context-menu/index.js +25 -25
- package/lib/commonjs/context-menu/index.js.map +1 -1
- package/lib/commonjs/context-menu/index.web.js +27 -27
- package/lib/commonjs/context-menu/index.web.js.map +1 -1
- package/lib/commonjs/dialog/SheetShell.js +1 -1
- package/lib/commonjs/index.js +134 -38
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +134 -38
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/input-group/InputGroup.js +1 -1
- package/lib/commonjs/menu/context.js +2 -2
- package/lib/commonjs/menu/context.js.map +1 -1
- package/lib/commonjs/menu/index.js +17 -17
- package/lib/commonjs/menu/index.js.map +1 -1
- package/lib/commonjs/menu/index.web.js +16 -16
- package/lib/commonjs/menu/index.web.js.map +1 -1
- package/lib/commonjs/popover/context.js +1 -1
- package/lib/commonjs/popover/context.js.map +1 -1
- package/lib/commonjs/popover/index.js +6 -6
- package/lib/commonjs/popover/index.js.map +1 -1
- package/lib/commonjs/popover/index.web.js +6 -6
- package/lib/commonjs/popover/index.web.js.map +1 -1
- package/lib/commonjs/search-input/index.js +4 -5
- package/lib/commonjs/search-input/index.js.map +1 -1
- package/lib/commonjs/segmented-control/index.js +18 -18
- package/lib/commonjs/segmented-control/index.js.map +1 -1
- package/lib/commonjs/select/common.js +2 -2
- package/lib/commonjs/select/common.js.map +1 -1
- package/lib/commonjs/select/index.js +34 -38
- package/lib/commonjs/select/index.js.map +1 -1
- package/lib/commonjs/select/index.web.js +31 -35
- package/lib/commonjs/select/index.web.js.map +1 -1
- package/lib/commonjs/tabs/Tabs.js +7 -7
- package/lib/commonjs/tabs/Tabs.js.map +1 -1
- package/lib/commonjs/tabs/index.js +6 -6
- package/lib/commonjs/text-field/index.js +14 -14
- package/lib/commonjs/text-field/index.js.map +1 -1
- package/lib/commonjs/theme/color-scope/style-builder.js +6 -6
- package/lib/commonjs/theme/index.js +7 -0
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/commonjs/theme/use-navigation-theme.js +54 -0
- package/lib/commonjs/theme/use-navigation-theme.js.map +1 -0
- package/lib/commonjs/tooltip/index.js +11 -11
- package/lib/commonjs/tooltip/index.js.map +1 -1
- package/lib/commonjs/tooltip/index.web.js +11 -11
- package/lib/commonjs/tooltip/index.web.js.map +1 -1
- package/lib/module/admonition/index.js +18 -17
- package/lib/module/admonition/index.js.map +1 -1
- package/lib/module/combobox/Combobox.js +7 -7
- package/lib/module/combobox/Combobox.js.map +1 -1
- package/lib/module/context-menu/context.js +2 -2
- package/lib/module/context-menu/context.js.map +1 -1
- package/lib/module/context-menu/index.js +17 -17
- package/lib/module/context-menu/index.js.map +1 -1
- package/lib/module/context-menu/index.web.js +19 -19
- package/lib/module/context-menu/index.web.js.map +1 -1
- package/lib/module/dialog/SheetShell.js +1 -1
- package/lib/module/index.js +11 -11
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +11 -11
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/input-group/InputGroup.js +1 -1
- package/lib/module/menu/context.js +2 -2
- package/lib/module/menu/context.js.map +1 -1
- package/lib/module/menu/index.js +9 -9
- package/lib/module/menu/index.js.map +1 -1
- package/lib/module/menu/index.web.js +8 -8
- package/lib/module/menu/index.web.js.map +1 -1
- package/lib/module/popover/context.js +1 -1
- package/lib/module/popover/context.js.map +1 -1
- package/lib/module/popover/index.js +3 -3
- package/lib/module/popover/index.js.map +1 -1
- package/lib/module/popover/index.web.js +3 -3
- package/lib/module/popover/index.web.js.map +1 -1
- package/lib/module/search-input/index.js +4 -4
- package/lib/module/search-input/index.js.map +1 -1
- package/lib/module/segmented-control/index.js +15 -15
- package/lib/module/segmented-control/index.js.map +1 -1
- package/lib/module/select/common.js +1 -1
- package/lib/module/select/common.js.map +1 -1
- package/lib/module/select/index.js +25 -29
- package/lib/module/select/index.js.map +1 -1
- package/lib/module/select/index.web.js +22 -26
- package/lib/module/select/index.web.js.map +1 -1
- package/lib/module/tabs/Tabs.js +6 -6
- package/lib/module/tabs/Tabs.js.map +1 -1
- package/lib/module/tabs/index.js +1 -1
- package/lib/module/tabs/index.js.map +1 -1
- package/lib/module/text-field/index.js +8 -8
- package/lib/module/text-field/index.js.map +1 -1
- package/lib/module/theme/color-scope/style-builder.js +6 -6
- package/lib/module/theme/index.js +1 -0
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/theme/use-navigation-theme.js +50 -0
- package/lib/module/theme/use-navigation-theme.js.map +1 -0
- package/lib/module/tooltip/index.js +6 -6
- package/lib/module/tooltip/index.js.map +1 -1
- package/lib/module/tooltip/index.web.js +6 -6
- package/lib/module/tooltip/index.web.js.map +1 -1
- package/lib/typescript/commonjs/admonition/index.d.ts +14 -13
- package/lib/typescript/commonjs/admonition/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/combobox/Combobox.d.ts +7 -7
- package/lib/typescript/commonjs/combobox/Combobox.d.ts.map +1 -1
- package/lib/typescript/commonjs/context-menu/index.d.ts +9 -9
- package/lib/typescript/commonjs/context-menu/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/context-menu/index.web.d.ts +9 -9
- package/lib/typescript/commonjs/context-menu/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/context-menu/types.d.ts +6 -6
- package/lib/typescript/commonjs/context-menu/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/SheetShell.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts +11 -11
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +11 -11
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/input-group/types.d.ts +1 -1
- package/lib/typescript/commonjs/menu/index.d.ts +9 -9
- package/lib/typescript/commonjs/menu/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/menu/index.web.d.ts +9 -9
- package/lib/typescript/commonjs/menu/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/menu/types.d.ts +5 -5
- package/lib/typescript/commonjs/menu/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/popover/index.d.ts +5 -5
- package/lib/typescript/commonjs/popover/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/popover/index.web.d.ts +5 -5
- package/lib/typescript/commonjs/popover/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/popover/types.d.ts +1 -1
- package/lib/typescript/commonjs/popover/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/search-input/index.d.ts +3 -3
- package/lib/typescript/commonjs/search-input/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/segmented-control/index.d.ts +13 -13
- package/lib/typescript/commonjs/segmented-control/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/common.d.ts +1 -1
- package/lib/typescript/commonjs/select/common.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/index.d.ts +12 -12
- package/lib/typescript/commonjs/select/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/index.web.d.ts +12 -12
- package/lib/typescript/commonjs/select/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/types.d.ts +10 -10
- package/lib/typescript/commonjs/select/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/tabs/Tabs.d.ts +4 -4
- package/lib/typescript/commonjs/tabs/Tabs.d.ts.map +1 -1
- package/lib/typescript/commonjs/tabs/index.d.ts +2 -2
- package/lib/typescript/commonjs/tabs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/tabs/types.d.ts +3 -3
- package/lib/typescript/commonjs/tabs/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/text-field/index.d.ts +8 -8
- package/lib/typescript/commonjs/text-field/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts +6 -6
- package/lib/typescript/commonjs/theme/index.d.ts +2 -0
- package/lib/typescript/commonjs/theme/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/use-navigation-theme.d.ts +31 -0
- package/lib/typescript/commonjs/theme/use-navigation-theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/tooltip/index.d.ts +6 -6
- package/lib/typescript/commonjs/tooltip/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/tooltip/index.web.d.ts +6 -6
- package/lib/typescript/commonjs/tooltip/index.web.d.ts.map +1 -1
- package/lib/typescript/module/admonition/index.d.ts +14 -13
- package/lib/typescript/module/admonition/index.d.ts.map +1 -1
- package/lib/typescript/module/combobox/Combobox.d.ts +7 -7
- package/lib/typescript/module/combobox/Combobox.d.ts.map +1 -1
- package/lib/typescript/module/context-menu/index.d.ts +9 -9
- package/lib/typescript/module/context-menu/index.d.ts.map +1 -1
- package/lib/typescript/module/context-menu/index.web.d.ts +9 -9
- package/lib/typescript/module/context-menu/index.web.d.ts.map +1 -1
- package/lib/typescript/module/context-menu/types.d.ts +6 -6
- package/lib/typescript/module/context-menu/types.d.ts.map +1 -1
- package/lib/typescript/module/dialog/SheetShell.d.ts +1 -1
- package/lib/typescript/module/index.d.ts +11 -11
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +11 -11
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/input-group/types.d.ts +1 -1
- package/lib/typescript/module/menu/index.d.ts +9 -9
- package/lib/typescript/module/menu/index.d.ts.map +1 -1
- package/lib/typescript/module/menu/index.web.d.ts +9 -9
- package/lib/typescript/module/menu/index.web.d.ts.map +1 -1
- package/lib/typescript/module/menu/types.d.ts +5 -5
- package/lib/typescript/module/menu/types.d.ts.map +1 -1
- package/lib/typescript/module/popover/index.d.ts +5 -5
- package/lib/typescript/module/popover/index.d.ts.map +1 -1
- package/lib/typescript/module/popover/index.web.d.ts +5 -5
- package/lib/typescript/module/popover/index.web.d.ts.map +1 -1
- package/lib/typescript/module/popover/types.d.ts +1 -1
- package/lib/typescript/module/popover/types.d.ts.map +1 -1
- package/lib/typescript/module/search-input/index.d.ts +3 -3
- package/lib/typescript/module/search-input/index.d.ts.map +1 -1
- package/lib/typescript/module/segmented-control/index.d.ts +13 -13
- package/lib/typescript/module/segmented-control/index.d.ts.map +1 -1
- package/lib/typescript/module/select/common.d.ts +1 -1
- package/lib/typescript/module/select/common.d.ts.map +1 -1
- package/lib/typescript/module/select/index.d.ts +12 -12
- package/lib/typescript/module/select/index.d.ts.map +1 -1
- package/lib/typescript/module/select/index.web.d.ts +12 -12
- package/lib/typescript/module/select/index.web.d.ts.map +1 -1
- package/lib/typescript/module/select/types.d.ts +10 -10
- package/lib/typescript/module/select/types.d.ts.map +1 -1
- package/lib/typescript/module/tabs/Tabs.d.ts +4 -4
- package/lib/typescript/module/tabs/Tabs.d.ts.map +1 -1
- package/lib/typescript/module/tabs/index.d.ts +2 -2
- package/lib/typescript/module/tabs/index.d.ts.map +1 -1
- package/lib/typescript/module/tabs/types.d.ts +3 -3
- package/lib/typescript/module/tabs/types.d.ts.map +1 -1
- package/lib/typescript/module/text-field/index.d.ts +8 -8
- package/lib/typescript/module/text-field/index.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-scope/style-builder.d.ts +6 -6
- package/lib/typescript/module/theme/index.d.ts +2 -0
- package/lib/typescript/module/theme/index.d.ts.map +1 -1
- package/lib/typescript/module/theme/use-navigation-theme.d.ts +31 -0
- package/lib/typescript/module/theme/use-navigation-theme.d.ts.map +1 -0
- package/lib/typescript/module/tooltip/index.d.ts +6 -6
- package/lib/typescript/module/tooltip/index.d.ts.map +1 -1
- package/lib/typescript/module/tooltip/index.web.d.ts +6 -6
- package/lib/typescript/module/tooltip/index.web.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/public-api-contract.test.ts +54 -0
- package/src/__tests__/useNavigationTheme.test.tsx +227 -0
- package/src/admonition/index.tsx +22 -21
- package/src/combobox/Combobox.tsx +14 -14
- package/src/context-menu/ContextMenu.stories.tsx +26 -18
- package/src/context-menu/context.ts +2 -2
- package/src/context-menu/index.tsx +24 -24
- package/src/context-menu/index.web.tsx +26 -26
- package/src/context-menu/types.ts +6 -6
- package/src/dialog/SheetShell.tsx +1 -1
- package/src/field/Field.stories.tsx +3 -3
- package/src/index.ts +11 -11
- package/src/index.web.ts +11 -11
- package/src/input-group/InputGroup.stories.tsx +4 -4
- package/src/input-group/InputGroup.tsx +1 -1
- package/src/input-group/types.ts +1 -1
- package/src/menu/Menu.stories.tsx +35 -35
- package/src/menu/context.ts +2 -2
- package/src/menu/index.tsx +15 -15
- package/src/menu/index.web.tsx +14 -14
- package/src/menu/types.ts +5 -5
- package/src/popover/Popover.stories.tsx +13 -13
- package/src/popover/context.ts +1 -1
- package/src/popover/index.tsx +5 -5
- package/src/popover/index.web.tsx +5 -5
- package/src/popover/types.ts +1 -1
- package/src/search-input/index.tsx +7 -7
- package/src/segmented-control/index.tsx +15 -15
- package/src/select/Select.stories.tsx +32 -23
- package/src/select/common.ts +1 -1
- package/src/select/index.tsx +39 -43
- package/src/select/index.web.tsx +33 -37
- package/src/select/types.ts +10 -10
- package/src/tabs/Tabs.tsx +9 -9
- package/src/tabs/index.ts +2 -2
- package/src/tabs/types.ts +3 -3
- package/src/text-field/TextField.stories.tsx +5 -5
- package/src/text-field/index.tsx +12 -12
- package/src/theme/color-scope/style-builder.ts +6 -6
- package/src/theme/index.ts +2 -0
- package/src/theme/use-navigation-theme.ts +59 -0
- package/src/tooltip/index.tsx +6 -6
- package/src/tooltip/index.web.tsx +6 -6
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { type AccessibilityProps, TextInput, type TextInputProps, type ViewStyle } from 'react-native';
|
|
2
2
|
import { type TextStyleProp, type ViewStyleProp } from '../styles';
|
|
3
3
|
import { type Props as SVGIconProps } from '../icons/common';
|
|
4
|
-
export type
|
|
4
|
+
export type TextFieldProps = React.PropsWithChildren<{
|
|
5
5
|
isInvalid?: boolean;
|
|
6
6
|
} & ViewStyleProp>;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function TextField({ children, isInvalid, style }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare function useSharedInputStyles(): {
|
|
9
9
|
chromeHover: ViewStyle;
|
|
10
10
|
chromeFocus: ViewStyle;
|
|
11
11
|
chromeError: ViewStyle;
|
|
12
12
|
chromeErrorHover: ViewStyle;
|
|
13
13
|
};
|
|
14
|
-
export type
|
|
14
|
+
export type TextFieldInputProps = Omit<TextInputProps, 'value' | 'onChangeText' | 'placeholder'> & {
|
|
15
15
|
label: string;
|
|
16
16
|
value?: string;
|
|
17
17
|
onChangeText?: (value: string) => void;
|
|
@@ -19,18 +19,18 @@ export type InputProps = Omit<TextInputProps, 'value' | 'onChangeText' | 'placeh
|
|
|
19
19
|
inputRef?: React.RefObject<TextInput | null> | React.ForwardedRef<TextInput>;
|
|
20
20
|
placeholder?: string | null | undefined;
|
|
21
21
|
};
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function
|
|
22
|
+
export declare function TextFieldInput({ label, placeholder, value, onChangeText, onFocus, onBlur, isInvalid, inputRef, style, ...rest }: TextFieldInputProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function TextFieldLabel({ nativeID, children, }: React.PropsWithChildren<{
|
|
24
24
|
nativeID?: string;
|
|
25
25
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export declare function
|
|
26
|
+
export declare function TextFieldIcon({ icon: Comp }: {
|
|
27
27
|
icon: React.ComponentType<SVGIconProps>;
|
|
28
28
|
}): import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function TextFieldSuffix({ children, label, accessibilityHint, style, }: React.PropsWithChildren<TextStyleProp & {
|
|
30
30
|
label: string;
|
|
31
31
|
accessibilityHint?: AccessibilityProps['accessibilityHint'];
|
|
32
32
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function TextFieldGhost({ children, value, }: {
|
|
34
34
|
children: string;
|
|
35
35
|
value: string;
|
|
36
36
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/text-field/index.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAGvB,SAAS,EACT,KAAK,cAAc,EAGnB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAKtB,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAkB,KAAK,KAAK,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAwB7E,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/text-field/index.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAGvB,SAAS,EACT,KAAK,cAAc,EAGnB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAKtB,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAkB,KAAK,KAAK,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAwB7E,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,iBAAiB,CAClD;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CACxC,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,SAAiB,EAAE,KAAK,EAAE,EAAE,cAAc,2CA0C/E;AAED,wBAAgB,oBAAoB;;;;;EA0BnC;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,cAAc,EACd,OAAO,GAAG,cAAc,GAAG,aAAa,CACzC,GAAG;IACF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC7E,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,WAAW,EACX,KAAK,EACL,YAAY,EACZ,OAAO,EACP,MAAM,EACN,SAAS,EACT,QAAQ,EACR,KAAK,EACL,GAAG,IAAI,EACR,EAAE,mBAAmB,2CAmGrB;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,2CAchD;AAED,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;CAAE,2CA8BxF;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,2CAqBA;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,2CAkDA"}
|
|
@@ -42,12 +42,12 @@ export declare function getVariableContextProvider(): VariableContextProviderCom
|
|
|
42
42
|
* provider writes vars to `documentElement` instead) or when `nativewind` is
|
|
43
43
|
* not installed.
|
|
44
44
|
*
|
|
45
|
-
*
|
|
46
|
-
* when applied to an interop className
|
|
47
|
-
* on matched className style rules).
|
|
48
|
-
* dropped silently.
|
|
49
|
-
*
|
|
50
|
-
*
|
|
45
|
+
* Caveat — prefer `getVariableContextProvider()`: under react-native-css@3,
|
|
46
|
+
* `vars()` only propagates to a subtree when applied to an interop className
|
|
47
|
+
* component (the runtime gates propagation on matched className style rules).
|
|
48
|
+
* Applied to a plain `<View>` the vars are dropped silently. This is retained
|
|
49
|
+
* as the escape-hatch contract of `useColorScopeStyle`, where the caller owns
|
|
50
|
+
* the host element and is expected to be a className component.
|
|
51
51
|
*/
|
|
52
52
|
export declare function buildNativePresetStyle(colorPreset: AppColorName, mode: 'light' | 'dark'): StyleProp<ViewStyle>;
|
|
53
53
|
//# sourceMappingURL=style-builder.d.ts.map
|
|
@@ -4,6 +4,8 @@ export { BloomColorScope, useColorScopeStyle } from './color-scope';
|
|
|
4
4
|
export type { BloomColorScopeProps } from './color-scope';
|
|
5
5
|
export { buildTheme, STATUS_COLORS } from './build-theme';
|
|
6
6
|
export { useTheme, useThemeColor, useBloomTheme } from './use-theme';
|
|
7
|
+
export { useNavigationTheme } from './use-navigation-theme';
|
|
8
|
+
export type { NavigationTheme, NavigationThemeFont } from './use-navigation-theme';
|
|
7
9
|
export type { Theme, ThemeColors, ThemeMode } from './types';
|
|
8
10
|
export type { AppColorName, AppColorPreset, PresetTokens } from './color-presets';
|
|
9
11
|
export { APP_COLOR_NAMES, PREMIUM_COLOR_NAMES, APP_COLOR_PRESETS, HEX_TO_APP_COLOR, hexToAppColorName, } from './color-presets';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7D,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACnF,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7D,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface NavigationThemeFont {
|
|
2
|
+
fontFamily: string;
|
|
3
|
+
fontWeight: '400' | '500' | '700' | '900';
|
|
4
|
+
}
|
|
5
|
+
export interface NavigationTheme {
|
|
6
|
+
dark: boolean;
|
|
7
|
+
colors: {
|
|
8
|
+
primary: string;
|
|
9
|
+
background: string;
|
|
10
|
+
card: string;
|
|
11
|
+
text: string;
|
|
12
|
+
border: string;
|
|
13
|
+
notification: string;
|
|
14
|
+
};
|
|
15
|
+
fonts: {
|
|
16
|
+
regular: NavigationThemeFont;
|
|
17
|
+
medium: NavigationThemeFont;
|
|
18
|
+
bold: NavigationThemeFont;
|
|
19
|
+
heavy: NavigationThemeFont;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Projects Bloom's resolved theme into a react-navigation `Theme` POJO for
|
|
24
|
+
* expo-router's <ThemeProvider>. Keeps Bloom the single source of truth for
|
|
25
|
+
* navigator chrome (Stack headers, screen backgrounds, modal) so it tracks
|
|
26
|
+
* the active color preset. Returns a structural object — no react-navigation
|
|
27
|
+
* import — so Bloom stays decoupled. Replaces the per-app copies in
|
|
28
|
+
* test-app-expo / inbox / accounts.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useNavigationTheme(): NavigationTheme;
|
|
31
|
+
//# sourceMappingURL=use-navigation-theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-navigation-theme.d.ts","sourceRoot":"","sources":["../../../../src/theme/use-navigation-theme.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CAC3C;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,EAAE;QACL,OAAO,EAAE,mBAAmB,CAAC;QAC7B,MAAM,EAAE,mBAAmB,CAAC;QAC5B,IAAI,EAAE,mBAAmB,CAAC;QAC1B,KAAK,EAAE,mBAAmB,CAAC;KAC5B,CAAC;CACH;AASD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAiBpD"}
|
|
@@ -4,26 +4,26 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Only really necessary on iOS but can work on Android.
|
|
6
6
|
*/
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function TooltipSheetCompatProvider({ children, }: {
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare namespace
|
|
10
|
+
export declare namespace TooltipSheetCompatProvider {
|
|
11
11
|
var displayName: string;
|
|
12
12
|
}
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function Tooltip({ children, position, visible: requestVisible, onVisibleChange, }: {
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
position?: 'top' | 'bottom';
|
|
16
16
|
visible: boolean;
|
|
17
17
|
onVisibleChange: (visible: boolean) => void;
|
|
18
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function TooltipTrigger({ children }: {
|
|
20
20
|
children: React.ReactNode;
|
|
21
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export declare function
|
|
22
|
+
export declare function TooltipContent({ children, label, }: {
|
|
23
23
|
children: React.ReactNode;
|
|
24
24
|
label: string;
|
|
25
25
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const TooltipTextBubble: ({ children }: {
|
|
27
27
|
children: React.ReactNode;
|
|
28
28
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tooltip/index.tsx"],"names":[],"mappings":"AAoEA;;;;;GAKG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tooltip/index.tsx"],"names":[],"mappings":"AAoEA;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAEA;yBANe,0BAA0B;;;AAS1C,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,QAAmB,EACnB,OAAO,EAAE,cAAc,EACvB,eAAe,GAChB,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C,2CAsCA;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAuBzE;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,kDAoBA;AAgND,eAAO,MAAM,iBAAiB;;6CAAmC,CAAC"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* No-op on web. Portal Provider is only needed on native.
|
|
3
3
|
*/
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function TooltipSheetCompatProvider({ children, }: {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare namespace
|
|
7
|
+
export declare namespace TooltipSheetCompatProvider {
|
|
8
8
|
var displayName: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function Tooltip({ children, position, visible, onVisibleChange, }: {
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
position?: 'top' | 'bottom';
|
|
13
13
|
visible: boolean;
|
|
14
14
|
onVisibleChange: (visible: boolean) => void;
|
|
15
15
|
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function TooltipTrigger({ children }: {
|
|
17
17
|
children: React.ReactNode;
|
|
18
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function TooltipContent({ children, label, }: {
|
|
20
20
|
children: React.ReactNode;
|
|
21
21
|
label: string;
|
|
22
22
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const TooltipTextBubble: ({ children }: {
|
|
24
24
|
children: React.ReactNode;
|
|
25
25
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/tooltip/index.web.tsx"],"names":[],"mappings":"AA0BA;;GAEG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/tooltip/index.web.tsx"],"names":[],"mappings":"AA0BA;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAEA;yBANe,0BAA0B;;;AAS1C,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,QAAmB,EACnB,OAAO,EACP,eAAe,GAChB,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C,2CAkBA;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAMzE;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,kDAgEA;AAED,eAAO,MAAM,iBAAiB;;6CAAmC,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as Bloom from '../index';
|
|
2
|
+
|
|
3
|
+
type AnyExports = Record<string, unknown>;
|
|
4
|
+
const api = Bloom as AnyExports;
|
|
5
|
+
|
|
6
|
+
// Collections / generic-colliding part names that intentionally STAY namespaced.
|
|
7
|
+
const ALLOWED_NAMESPACES = ['Icons', 'Typography', 'Skeleton', 'Grid', 'Code', 'Fonts'] as const;
|
|
8
|
+
|
|
9
|
+
// Compound families converted to flat: the top-level name is the root component.
|
|
10
|
+
const FLATTENED_ROOTS = [
|
|
11
|
+
'Tabs', 'Accordion', 'Select', 'Menu', 'ContextMenu', 'Popover',
|
|
12
|
+
'Tooltip', 'SegmentedControl', 'TextField', 'Admonition', 'PromptInput',
|
|
13
|
+
] as const;
|
|
14
|
+
|
|
15
|
+
// One renamed part per converted family — proves the flat rename landed.
|
|
16
|
+
const REPRESENTATIVE_PARTS = [
|
|
17
|
+
'TabsTrigger', 'AccordionItem', 'SelectItem', 'MenuItem', 'ContextMenuItem',
|
|
18
|
+
'PopoverTrigger', 'TooltipTrigger', 'SegmentedControlItem', 'TextFieldInput',
|
|
19
|
+
'AdmonitionIcon', 'PromptInputTextarea',
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A flat React component export is either a plain function component or a wrapped
|
|
24
|
+
* component object (React.memo / forwardRef), which carries a `$$typeof` symbol.
|
|
25
|
+
* A `export * as X` namespace is a plain object WITHOUT `$$typeof`.
|
|
26
|
+
*/
|
|
27
|
+
function isReactComponent(value: unknown): boolean {
|
|
28
|
+
if (typeof value === 'function') return true;
|
|
29
|
+
if (typeof value === 'object' && value !== null) {
|
|
30
|
+
return typeof (value as { $$typeof?: unknown }).$$typeof === 'symbol';
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
describe('public API contract', () => {
|
|
36
|
+
it('keeps the six collection families as namespace objects (not components)', () => {
|
|
37
|
+
for (const ns of ALLOWED_NAMESPACES) {
|
|
38
|
+
expect(typeof api[ns]).toBe('object');
|
|
39
|
+
expect(isReactComponent(api[ns])).toBe(false);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('exposes each compound family root as a flat component (not a namespace)', () => {
|
|
44
|
+
for (const name of FLATTENED_ROOTS) {
|
|
45
|
+
expect(isReactComponent(api[name])).toBe(true);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('exposes compound parts as flat prefixed components', () => {
|
|
50
|
+
for (const name of REPRESENTATIVE_PARTS) {
|
|
51
|
+
expect(isReactComponent(api[name])).toBe(true);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { Text, View } from 'react-native';
|
|
3
|
+
import { render } from '@testing-library/react-native';
|
|
4
|
+
|
|
5
|
+
let mockColorScheme: 'light' | 'dark' | null = 'light';
|
|
6
|
+
|
|
7
|
+
jest.mock('react-native', () => {
|
|
8
|
+
const actual = jest.requireActual('react-native');
|
|
9
|
+
return {
|
|
10
|
+
...actual,
|
|
11
|
+
useColorScheme: () => mockColorScheme,
|
|
12
|
+
Appearance: {
|
|
13
|
+
...actual.Appearance,
|
|
14
|
+
setColorScheme: jest.fn(),
|
|
15
|
+
getColorScheme: () => mockColorScheme,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
import { BloomThemeProvider } from '../theme/BloomThemeProvider';
|
|
21
|
+
import { useTheme } from '../theme/use-theme';
|
|
22
|
+
import { useNavigationTheme } from '../theme/use-navigation-theme';
|
|
23
|
+
import type { NavigationTheme } from '../theme/use-navigation-theme';
|
|
24
|
+
|
|
25
|
+
// Probe that captures both the navigation theme and the raw bloom theme
|
|
26
|
+
// into external refs so tests can inspect them after render.
|
|
27
|
+
function Probe({
|
|
28
|
+
navRef,
|
|
29
|
+
bloomRef,
|
|
30
|
+
}: {
|
|
31
|
+
navRef: React.MutableRefObject<NavigationTheme | null>;
|
|
32
|
+
bloomRef: React.MutableRefObject<ReturnType<typeof useTheme> | null>;
|
|
33
|
+
}) {
|
|
34
|
+
const nav = useNavigationTheme();
|
|
35
|
+
const bloom = useTheme();
|
|
36
|
+
navRef.current = nav;
|
|
37
|
+
bloomRef.current = bloom;
|
|
38
|
+
return (
|
|
39
|
+
<View>
|
|
40
|
+
<Text testID="dark">{String(nav.dark)}</Text>
|
|
41
|
+
<Text testID="primary">{nav.colors.primary}</Text>
|
|
42
|
+
<Text testID="notification">{nav.colors.notification}</Text>
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Probe that captures the navigation theme reference twice across renders,
|
|
48
|
+
// storing it in an array so the test can assert referential stability.
|
|
49
|
+
function MemoProbe({
|
|
50
|
+
capturesRef,
|
|
51
|
+
triggerProp,
|
|
52
|
+
}: {
|
|
53
|
+
capturesRef: React.MutableRefObject<NavigationTheme[]>;
|
|
54
|
+
triggerProp: number;
|
|
55
|
+
}) {
|
|
56
|
+
void triggerProp; // read the prop so React re-renders when it changes
|
|
57
|
+
const nav = useNavigationTheme();
|
|
58
|
+
capturesRef.current.push(nav);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
beforeEach(() => {
|
|
63
|
+
mockColorScheme = 'light';
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe('useNavigationTheme', () => {
|
|
67
|
+
describe('dark flag', () => {
|
|
68
|
+
it('returns dark=false under explicit light mode', () => {
|
|
69
|
+
const navRef = { current: null as NavigationTheme | null };
|
|
70
|
+
const bloomRef = { current: null as ReturnType<typeof useTheme> | null };
|
|
71
|
+
render(
|
|
72
|
+
<BloomThemeProvider mode="light">
|
|
73
|
+
<Probe navRef={navRef} bloomRef={bloomRef} />
|
|
74
|
+
</BloomThemeProvider>,
|
|
75
|
+
);
|
|
76
|
+
expect(navRef.current?.dark).toBe(false);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('returns dark=true under explicit dark mode', () => {
|
|
80
|
+
const navRef = { current: null as NavigationTheme | null };
|
|
81
|
+
const bloomRef = { current: null as ReturnType<typeof useTheme> | null };
|
|
82
|
+
render(
|
|
83
|
+
<BloomThemeProvider mode="dark">
|
|
84
|
+
<Probe navRef={navRef} bloomRef={bloomRef} />
|
|
85
|
+
</BloomThemeProvider>,
|
|
86
|
+
);
|
|
87
|
+
expect(navRef.current?.dark).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('returns dark=false when system mode resolves to light', () => {
|
|
91
|
+
mockColorScheme = 'light';
|
|
92
|
+
const navRef = { current: null as NavigationTheme | null };
|
|
93
|
+
const bloomRef = { current: null as ReturnType<typeof useTheme> | null };
|
|
94
|
+
render(
|
|
95
|
+
<BloomThemeProvider mode="system">
|
|
96
|
+
<Probe navRef={navRef} bloomRef={bloomRef} />
|
|
97
|
+
</BloomThemeProvider>,
|
|
98
|
+
);
|
|
99
|
+
expect(navRef.current?.dark).toBe(false);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('returns dark=true when system mode resolves to dark', () => {
|
|
103
|
+
mockColorScheme = 'dark';
|
|
104
|
+
const navRef = { current: null as NavigationTheme | null };
|
|
105
|
+
const bloomRef = { current: null as ReturnType<typeof useTheme> | null };
|
|
106
|
+
render(
|
|
107
|
+
<BloomThemeProvider mode="system">
|
|
108
|
+
<Probe navRef={navRef} bloomRef={bloomRef} />
|
|
109
|
+
</BloomThemeProvider>,
|
|
110
|
+
);
|
|
111
|
+
expect(navRef.current?.dark).toBe(true);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('color mapping', () => {
|
|
116
|
+
it('maps primary/background/card/text/border 1:1 from useTheme().colors', () => {
|
|
117
|
+
const navRef = { current: null as NavigationTheme | null };
|
|
118
|
+
const bloomRef = { current: null as ReturnType<typeof useTheme> | null };
|
|
119
|
+
render(
|
|
120
|
+
<BloomThemeProvider mode="light" colorPreset="blue">
|
|
121
|
+
<Probe navRef={navRef} bloomRef={bloomRef} />
|
|
122
|
+
</BloomThemeProvider>,
|
|
123
|
+
);
|
|
124
|
+
const nav = navRef.current;
|
|
125
|
+
const bloom = bloomRef.current;
|
|
126
|
+
expect(nav).not.toBeNull();
|
|
127
|
+
expect(bloom).not.toBeNull();
|
|
128
|
+
expect(nav!.colors.primary).toBe(bloom!.colors.primary);
|
|
129
|
+
expect(nav!.colors.background).toBe(bloom!.colors.background);
|
|
130
|
+
expect(nav!.colors.card).toBe(bloom!.colors.card);
|
|
131
|
+
expect(nav!.colors.text).toBe(bloom!.colors.text);
|
|
132
|
+
expect(nav!.colors.border).toBe(bloom!.colors.border);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('maps notification to colors.error (not a direct key)', () => {
|
|
136
|
+
const navRef = { current: null as NavigationTheme | null };
|
|
137
|
+
const bloomRef = { current: null as ReturnType<typeof useTheme> | null };
|
|
138
|
+
render(
|
|
139
|
+
<BloomThemeProvider mode="light" colorPreset="blue">
|
|
140
|
+
<Probe navRef={navRef} bloomRef={bloomRef} />
|
|
141
|
+
</BloomThemeProvider>,
|
|
142
|
+
);
|
|
143
|
+
expect(navRef.current!.colors.notification).toBe(
|
|
144
|
+
bloomRef.current!.colors.error,
|
|
145
|
+
);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('colors differ between light and dark presets (sanity check)', () => {
|
|
149
|
+
const lightNavRef = { current: null as NavigationTheme | null };
|
|
150
|
+
const lightBloomRef = { current: null as ReturnType<typeof useTheme> | null };
|
|
151
|
+
const { unmount } = render(
|
|
152
|
+
<BloomThemeProvider mode="light" colorPreset="teal">
|
|
153
|
+
<Probe navRef={lightNavRef} bloomRef={lightBloomRef} />
|
|
154
|
+
</BloomThemeProvider>,
|
|
155
|
+
);
|
|
156
|
+
const lightBg = lightNavRef.current!.colors.background;
|
|
157
|
+
unmount();
|
|
158
|
+
|
|
159
|
+
const darkNavRef = { current: null as NavigationTheme | null };
|
|
160
|
+
const darkBloomRef = { current: null as ReturnType<typeof useTheme> | null };
|
|
161
|
+
render(
|
|
162
|
+
<BloomThemeProvider mode="dark" colorPreset="teal">
|
|
163
|
+
<Probe navRef={darkNavRef} bloomRef={darkBloomRef} />
|
|
164
|
+
</BloomThemeProvider>,
|
|
165
|
+
);
|
|
166
|
+
const darkBg = darkNavRef.current!.colors.background;
|
|
167
|
+
|
|
168
|
+
expect(lightBg).not.toBe(darkBg);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
describe('fonts shape', () => {
|
|
173
|
+
it('has all four font variants with System fontFamily', () => {
|
|
174
|
+
const navRef = { current: null as NavigationTheme | null };
|
|
175
|
+
const bloomRef = { current: null as ReturnType<typeof useTheme> | null };
|
|
176
|
+
render(
|
|
177
|
+
<BloomThemeProvider mode="light">
|
|
178
|
+
<Probe navRef={navRef} bloomRef={bloomRef} />
|
|
179
|
+
</BloomThemeProvider>,
|
|
180
|
+
);
|
|
181
|
+
const fonts = navRef.current!.fonts;
|
|
182
|
+
for (const key of ['regular', 'medium', 'bold', 'heavy'] as const) {
|
|
183
|
+
expect(fonts[key].fontFamily).toBe('System');
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('has correct fontWeight values for each variant', () => {
|
|
188
|
+
const navRef = { current: null as NavigationTheme | null };
|
|
189
|
+
const bloomRef = { current: null as ReturnType<typeof useTheme> | null };
|
|
190
|
+
render(
|
|
191
|
+
<BloomThemeProvider mode="light">
|
|
192
|
+
<Probe navRef={navRef} bloomRef={bloomRef} />
|
|
193
|
+
</BloomThemeProvider>,
|
|
194
|
+
);
|
|
195
|
+
const fonts = navRef.current!.fonts;
|
|
196
|
+
expect(fonts.regular.fontWeight).toBe('400');
|
|
197
|
+
expect(fonts.medium.fontWeight).toBe('500');
|
|
198
|
+
expect(fonts.bold.fontWeight).toBe('700');
|
|
199
|
+
expect(fonts.heavy.fontWeight).toBe('900');
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
describe('memo stability', () => {
|
|
204
|
+
it('returns a referentially-equal object on re-render when theme is unchanged', () => {
|
|
205
|
+
const capturesRef: React.MutableRefObject<NavigationTheme[]> = {
|
|
206
|
+
current: [],
|
|
207
|
+
};
|
|
208
|
+
const { rerender } = render(
|
|
209
|
+
<BloomThemeProvider mode="light">
|
|
210
|
+
<MemoProbe capturesRef={capturesRef} triggerProp={0} />
|
|
211
|
+
</BloomThemeProvider>,
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
// Re-render without changing mode or colorPreset — memo should hold.
|
|
215
|
+
rerender(
|
|
216
|
+
<BloomThemeProvider mode="light">
|
|
217
|
+
<MemoProbe capturesRef={capturesRef} triggerProp={1} />
|
|
218
|
+
</BloomThemeProvider>,
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
expect(capturesRef.current.length).toBeGreaterThanOrEqual(2);
|
|
222
|
+
const first = capturesRef.current[0];
|
|
223
|
+
const second = capturesRef.current[1];
|
|
224
|
+
expect(Object.is(first, second)).toBe(true);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
});
|
package/src/admonition/index.tsx
CHANGED
|
@@ -28,7 +28,7 @@ const ICON_MAP = {
|
|
|
28
28
|
apology: EmojiSadIcon,
|
|
29
29
|
} as const;
|
|
30
30
|
|
|
31
|
-
export function
|
|
31
|
+
export function AdmonitionIcon() {
|
|
32
32
|
const theme = useTheme();
|
|
33
33
|
const { type } = useContext(AdmonitionContext);
|
|
34
34
|
|
|
@@ -44,9 +44,9 @@ export function Icon() {
|
|
|
44
44
|
|
|
45
45
|
return <IconComponent fill={fillMap[type]} size="md" />;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
AdmonitionIcon.displayName = 'AdmonitionIcon';
|
|
48
48
|
|
|
49
|
-
export function
|
|
49
|
+
export function AdmonitionContent({
|
|
50
50
|
children,
|
|
51
51
|
style,
|
|
52
52
|
}: {
|
|
@@ -59,9 +59,9 @@ export function Content({
|
|
|
59
59
|
</View>
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
AdmonitionContent.displayName = 'AdmonitionContent';
|
|
63
63
|
|
|
64
|
-
export function
|
|
64
|
+
export function AdmonitionText({
|
|
65
65
|
children,
|
|
66
66
|
style,
|
|
67
67
|
}: {
|
|
@@ -74,9 +74,9 @@ export function Text({
|
|
|
74
74
|
</BaseText>
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
AdmonitionText.displayName = 'AdmonitionText';
|
|
78
78
|
|
|
79
|
-
export function
|
|
79
|
+
export function AdmonitionButton({
|
|
80
80
|
children,
|
|
81
81
|
...props
|
|
82
82
|
}: Omit<ButtonProps, 'size' | 'variant'>) {
|
|
@@ -86,9 +86,9 @@ export function Button({
|
|
|
86
86
|
</BaseButton>
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
AdmonitionButton.displayName = 'AdmonitionButton';
|
|
90
90
|
|
|
91
|
-
export function
|
|
91
|
+
export function AdmonitionRow({
|
|
92
92
|
children,
|
|
93
93
|
style,
|
|
94
94
|
}: {
|
|
@@ -101,9 +101,9 @@ export function Row({
|
|
|
101
101
|
</View>
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
AdmonitionRow.displayName = 'AdmonitionRow';
|
|
105
105
|
|
|
106
|
-
export function
|
|
106
|
+
export function AdmonitionRoot({
|
|
107
107
|
children,
|
|
108
108
|
type = 'info',
|
|
109
109
|
style,
|
|
@@ -139,11 +139,12 @@ export function Outer({
|
|
|
139
139
|
</AdmonitionContext.Provider>
|
|
140
140
|
);
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
AdmonitionRoot.displayName = 'AdmonitionRoot';
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* Simple all-in-one Admonition component for common use cases.
|
|
146
|
-
* For more control, compose with
|
|
146
|
+
* For more control, compose with AdmonitionRoot, AdmonitionRow, AdmonitionIcon,
|
|
147
|
+
* AdmonitionContent, AdmonitionText, and AdmonitionButton.
|
|
147
148
|
*/
|
|
148
149
|
export function Admonition({
|
|
149
150
|
children,
|
|
@@ -155,14 +156,14 @@ export function Admonition({
|
|
|
155
156
|
style?: StyleProp<ViewStyle>;
|
|
156
157
|
}) {
|
|
157
158
|
return (
|
|
158
|
-
<
|
|
159
|
-
<
|
|
160
|
-
<
|
|
161
|
-
<
|
|
162
|
-
<
|
|
163
|
-
</
|
|
164
|
-
</
|
|
165
|
-
</
|
|
159
|
+
<AdmonitionRoot type={type} style={style}>
|
|
160
|
+
<AdmonitionRow>
|
|
161
|
+
<AdmonitionIcon />
|
|
162
|
+
<AdmonitionContent>
|
|
163
|
+
<AdmonitionText>{children}</AdmonitionText>
|
|
164
|
+
</AdmonitionContent>
|
|
165
|
+
</AdmonitionRow>
|
|
166
|
+
</AdmonitionRoot>
|
|
166
167
|
);
|
|
167
168
|
}
|
|
168
169
|
Admonition.displayName = 'Admonition';
|