@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
|
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
4
|
|
|
5
5
|
import { InputGroup } from './InputGroup';
|
|
6
|
-
import
|
|
6
|
+
import { TextFieldInput } from '../text-field';
|
|
7
7
|
import { Button } from '../button';
|
|
8
8
|
import { Kbd } from '../kbd';
|
|
9
9
|
|
|
@@ -22,7 +22,7 @@ export const TextAddons: Story = {
|
|
|
22
22
|
<View style={{ width: 360 }}>
|
|
23
23
|
<InputGroup>
|
|
24
24
|
<InputGroup.Addon>https://</InputGroup.Addon>
|
|
25
|
-
<
|
|
25
|
+
<TextFieldInput label="Domain" value={v} onChangeText={setV} placeholder="oxy" />
|
|
26
26
|
<InputGroup.Addon>.so</InputGroup.Addon>
|
|
27
27
|
</InputGroup>
|
|
28
28
|
</View>
|
|
@@ -36,7 +36,7 @@ export const ButtonAddon: Story = {
|
|
|
36
36
|
return (
|
|
37
37
|
<View style={{ width: 360 }}>
|
|
38
38
|
<InputGroup>
|
|
39
|
-
<
|
|
39
|
+
<TextFieldInput label="Invite" value={v} onChangeText={setV} placeholder="email" />
|
|
40
40
|
<InputGroup.Addon divider noPadding>
|
|
41
41
|
<Button variant="ghost" size="small" onPress={() => {}}>
|
|
42
42
|
Send
|
|
@@ -54,7 +54,7 @@ export const ShortcutHint: Story = {
|
|
|
54
54
|
return (
|
|
55
55
|
<View style={{ width: 360 }}>
|
|
56
56
|
<InputGroup>
|
|
57
|
-
<
|
|
57
|
+
<TextFieldInput label="Search" value={v} onChangeText={setV} placeholder="Search…" />
|
|
58
58
|
<InputGroup.Addon>
|
|
59
59
|
<Kbd size="sm">⌘K</Kbd>
|
|
60
60
|
</InputGroup.Addon>
|
|
@@ -79,7 +79,7 @@ Addon.displayName = 'InputGroup.Addon';
|
|
|
79
79
|
* ```tsx
|
|
80
80
|
* <InputGroup>
|
|
81
81
|
* <InputGroup.Addon>https://</InputGroup.Addon>
|
|
82
|
-
* <
|
|
82
|
+
* <TextFieldInput label="Domain" value={v} onChangeText={setV} />
|
|
83
83
|
* <InputGroup.Addon divider>
|
|
84
84
|
* <Button size="small" variant="ghost" onPress={go}>Go</Button>
|
|
85
85
|
* </InputGroup.Addon>
|
package/src/input-group/types.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface InputGroupAddonProps {
|
|
|
21
21
|
export interface InputGroupProps {
|
|
22
22
|
/**
|
|
23
23
|
* Group children. Place `InputGroup.Addon` elements before/after the input
|
|
24
|
-
* (a Bloom `
|
|
24
|
+
* (a Bloom `TextFieldInput`, a `SearchInput`, or any control). The middle
|
|
25
25
|
* child stretches to fill.
|
|
26
26
|
*/
|
|
27
27
|
children: React.ReactNode;
|
|
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
4
|
|
|
5
5
|
import { Button } from '../button';
|
|
6
|
-
import
|
|
6
|
+
import { Menu, MenuContent, MenuGroup, MenuItem, MenuItemText, MenuTrigger } from './index';
|
|
7
7
|
|
|
8
8
|
const meta: Meta = {
|
|
9
9
|
title: 'Components/Menu',
|
|
@@ -15,49 +15,49 @@ type Story = StoryObj;
|
|
|
15
15
|
|
|
16
16
|
function BasicMenu() {
|
|
17
17
|
return (
|
|
18
|
-
<Menu
|
|
19
|
-
<
|
|
18
|
+
<Menu>
|
|
19
|
+
<MenuTrigger label="Open menu">
|
|
20
20
|
{({ props }) => (
|
|
21
21
|
<Button onPress={props.onPress}>Open menu</Button>
|
|
22
22
|
)}
|
|
23
|
-
</
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
</
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
</
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
</
|
|
35
|
-
</
|
|
36
|
-
</
|
|
37
|
-
</Menu
|
|
23
|
+
</MenuTrigger>
|
|
24
|
+
<MenuContent>
|
|
25
|
+
<MenuGroup>
|
|
26
|
+
<MenuItem label="Profile" onPress={() => {}}>
|
|
27
|
+
<MenuItemText>Profile</MenuItemText>
|
|
28
|
+
</MenuItem>
|
|
29
|
+
<MenuItem label="Settings" onPress={() => {}}>
|
|
30
|
+
<MenuItemText>Settings</MenuItemText>
|
|
31
|
+
</MenuItem>
|
|
32
|
+
<MenuItem label="Sign out" onPress={() => {}}>
|
|
33
|
+
<MenuItemText>Sign out</MenuItemText>
|
|
34
|
+
</MenuItem>
|
|
35
|
+
</MenuGroup>
|
|
36
|
+
</MenuContent>
|
|
37
|
+
</Menu>
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
function MenuWithDisabledItem() {
|
|
42
42
|
return (
|
|
43
|
-
<Menu
|
|
44
|
-
<
|
|
43
|
+
<Menu>
|
|
44
|
+
<MenuTrigger label="Open menu with disabled item">
|
|
45
45
|
{({ props }) => <Button onPress={props.onPress}>Open</Button>}
|
|
46
|
-
</
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
</
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
</
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
</
|
|
58
|
-
</
|
|
59
|
-
</
|
|
60
|
-
</Menu
|
|
46
|
+
</MenuTrigger>
|
|
47
|
+
<MenuContent>
|
|
48
|
+
<MenuGroup>
|
|
49
|
+
<MenuItem label="Edit" onPress={() => {}}>
|
|
50
|
+
<MenuItemText>Edit</MenuItemText>
|
|
51
|
+
</MenuItem>
|
|
52
|
+
<MenuItem label="Duplicate" onPress={() => {}} disabled>
|
|
53
|
+
<MenuItemText>Duplicate (disabled)</MenuItemText>
|
|
54
|
+
</MenuItem>
|
|
55
|
+
<MenuItem label="Delete" onPress={() => {}}>
|
|
56
|
+
<MenuItemText>Delete</MenuItemText>
|
|
57
|
+
</MenuItem>
|
|
58
|
+
</MenuGroup>
|
|
59
|
+
</MenuContent>
|
|
60
|
+
</Menu>
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
|
package/src/menu/context.ts
CHANGED
|
@@ -11,7 +11,7 @@ ItemContext.displayName = 'BloomMenuItemContext';
|
|
|
11
11
|
export function useMenuContext(): MenuContextType {
|
|
12
12
|
const context = useContext(MenuContext);
|
|
13
13
|
if (!context) {
|
|
14
|
-
throw new Error('useMenuContext must be used within a Menu
|
|
14
|
+
throw new Error('useMenuContext must be used within a Menu component');
|
|
15
15
|
}
|
|
16
16
|
return context;
|
|
17
17
|
}
|
|
@@ -19,7 +19,7 @@ export function useMenuContext(): MenuContextType {
|
|
|
19
19
|
export function useMenuItemContext(): ItemContextType {
|
|
20
20
|
const context = useContext(ItemContext);
|
|
21
21
|
if (!context) {
|
|
22
|
-
throw new Error('useMenuItemContext must be used within a
|
|
22
|
+
throw new Error('useMenuItemContext must be used within a MenuItem component');
|
|
23
23
|
}
|
|
24
24
|
return context;
|
|
25
25
|
}
|
package/src/menu/index.tsx
CHANGED
|
@@ -15,18 +15,18 @@ import {
|
|
|
15
15
|
} from './context';
|
|
16
16
|
import type {
|
|
17
17
|
MenuContextType,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
MenuGroupProps,
|
|
19
|
+
MenuItemIconProps,
|
|
20
|
+
MenuItemProps,
|
|
21
|
+
MenuItemTextProps,
|
|
22
|
+
MenuTriggerProps,
|
|
23
23
|
} from './types';
|
|
24
24
|
|
|
25
25
|
export type { DialogControlProps as MenuControlProps } from '../dialog/types';
|
|
26
26
|
export { useDialogControl as useMenuControl } from '../dialog/context';
|
|
27
27
|
export { useMenuContext };
|
|
28
28
|
|
|
29
|
-
export function
|
|
29
|
+
export function Menu({
|
|
30
30
|
children,
|
|
31
31
|
control,
|
|
32
32
|
}: React.PropsWithChildren<{
|
|
@@ -47,12 +47,12 @@ export function Root({
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export function
|
|
50
|
+
export function MenuTrigger({
|
|
51
51
|
children,
|
|
52
52
|
label,
|
|
53
53
|
role = 'button',
|
|
54
54
|
hint,
|
|
55
|
-
}:
|
|
55
|
+
}: MenuTriggerProps) {
|
|
56
56
|
const context = useMenuContext();
|
|
57
57
|
const [focused, setFocused] = useState(false);
|
|
58
58
|
const [pressed, setPressed] = useState(false);
|
|
@@ -75,7 +75,7 @@ export function Trigger({
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
export function
|
|
78
|
+
export function MenuContent({
|
|
79
79
|
children,
|
|
80
80
|
showCancel,
|
|
81
81
|
}: React.PropsWithChildren<{
|
|
@@ -96,7 +96,7 @@ export function Outer({
|
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
export function
|
|
99
|
+
export function MenuItem({ children, label, style, onPress, ...rest }: MenuItemProps) {
|
|
100
100
|
const theme = useTheme();
|
|
101
101
|
const context = useMenuContext();
|
|
102
102
|
const [focused, setFocused] = useState(false);
|
|
@@ -148,7 +148,7 @@ export function Item({ children, label, style, onPress, ...rest }: ItemProps) {
|
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export function
|
|
151
|
+
export function MenuItemText({ children, style }: MenuItemTextProps) {
|
|
152
152
|
const theme = useTheme();
|
|
153
153
|
const { disabled } = useMenuItemContext();
|
|
154
154
|
|
|
@@ -167,7 +167,7 @@ export function ItemText({ children, style }: ItemTextProps) {
|
|
|
167
167
|
);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
export function
|
|
170
|
+
export function MenuItemIcon({ icon: Comp, fill }: MenuItemIconProps) {
|
|
171
171
|
const theme = useTheme();
|
|
172
172
|
const { disabled } = useMenuItemContext();
|
|
173
173
|
|
|
@@ -185,7 +185,7 @@ export function ItemIcon({ icon: Comp, fill }: ItemIconProps) {
|
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
export function
|
|
188
|
+
export function MenuGroup({ children, style }: MenuGroupProps) {
|
|
189
189
|
const theme = useTheme();
|
|
190
190
|
|
|
191
191
|
const childArray = React.Children.toArray(children).filter(isValidElement);
|
|
@@ -199,7 +199,7 @@ export function Group({ children, style }: GroupProps) {
|
|
|
199
199
|
]}
|
|
200
200
|
>
|
|
201
201
|
{childArray.map((child, i) => {
|
|
202
|
-
if (child.type ===
|
|
202
|
+
if (child.type === MenuItem) {
|
|
203
203
|
return (
|
|
204
204
|
<Fragment key={i}>
|
|
205
205
|
{i > 0 && (
|
|
@@ -225,7 +225,7 @@ export function Group({ children, style }: GroupProps) {
|
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
export function
|
|
228
|
+
export function MenuDivider() {
|
|
229
229
|
return null;
|
|
230
230
|
}
|
|
231
231
|
|
package/src/menu/index.web.tsx
CHANGED
|
@@ -25,11 +25,11 @@ import {
|
|
|
25
25
|
} from './context';
|
|
26
26
|
import type {
|
|
27
27
|
MenuContextType,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
MenuGroupProps,
|
|
29
|
+
MenuItemIconProps,
|
|
30
|
+
MenuItemProps,
|
|
31
|
+
MenuItemTextProps,
|
|
32
|
+
MenuTriggerProps,
|
|
33
33
|
} from './types';
|
|
34
34
|
|
|
35
35
|
export { useMenuContext };
|
|
@@ -92,7 +92,7 @@ function useMenuControlAsDialogControl(
|
|
|
92
92
|
}, [menuControl]);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
export function
|
|
95
|
+
export function Menu({
|
|
96
96
|
children,
|
|
97
97
|
control,
|
|
98
98
|
}: React.PropsWithChildren<{
|
|
@@ -157,12 +157,12 @@ export function Root({
|
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
export function
|
|
160
|
+
export function MenuTrigger({
|
|
161
161
|
children,
|
|
162
162
|
label,
|
|
163
163
|
role = 'button',
|
|
164
164
|
hint,
|
|
165
|
-
}:
|
|
165
|
+
}: MenuTriggerProps) {
|
|
166
166
|
const { control, triggerRef } = useMenuContext();
|
|
167
167
|
const [hovered, setHovered] = useState(false);
|
|
168
168
|
const [focused, setFocused] = useState(false);
|
|
@@ -186,7 +186,7 @@ export function Trigger({
|
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
export function
|
|
189
|
+
export function MenuContent({
|
|
190
190
|
children,
|
|
191
191
|
style,
|
|
192
192
|
}: React.PropsWithChildren<{
|
|
@@ -268,7 +268,7 @@ export function Outer({
|
|
|
268
268
|
);
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
export function
|
|
271
|
+
export function MenuItem({ children, label, onPress, style, ...rest }: MenuItemProps) {
|
|
272
272
|
const theme = useTheme();
|
|
273
273
|
const { control } = useMenuContext();
|
|
274
274
|
const [hovered, setHovered] = useState(false);
|
|
@@ -321,7 +321,7 @@ export function Item({ children, label, onPress, style, ...rest }: ItemProps) {
|
|
|
321
321
|
);
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
export function
|
|
324
|
+
export function MenuItemText({ children, style }: MenuItemTextProps) {
|
|
325
325
|
const theme = useTheme();
|
|
326
326
|
const { disabled } = useMenuItemContext();
|
|
327
327
|
|
|
@@ -338,7 +338,7 @@ export function ItemText({ children, style }: ItemTextProps) {
|
|
|
338
338
|
);
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
-
export function
|
|
341
|
+
export function MenuItemIcon({ icon: Comp, position = 'left', fill }: MenuItemIconProps) {
|
|
342
342
|
const theme = useTheme();
|
|
343
343
|
const { disabled } = useMenuItemContext();
|
|
344
344
|
|
|
@@ -363,11 +363,11 @@ export function ItemIcon({ icon: Comp, position = 'left', fill }: ItemIconProps)
|
|
|
363
363
|
);
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
export function
|
|
366
|
+
export function MenuGroup({ children }: MenuGroupProps) {
|
|
367
367
|
return <>{children}</>;
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
export function
|
|
370
|
+
export function MenuDivider() {
|
|
371
371
|
const theme = useTheme();
|
|
372
372
|
|
|
373
373
|
return (
|
package/src/menu/types.ts
CHANGED
|
@@ -48,14 +48,14 @@ export type TriggerChildProps = {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
export type
|
|
51
|
+
export type MenuTriggerProps = {
|
|
52
52
|
children: (props: TriggerChildProps) => React.ReactNode;
|
|
53
53
|
label: string;
|
|
54
54
|
hint?: string;
|
|
55
55
|
role?: AccessibilityRole;
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
export type
|
|
58
|
+
export type MenuItemProps = React.PropsWithChildren<
|
|
59
59
|
Omit<PressableProps, 'style'> & {
|
|
60
60
|
label: string;
|
|
61
61
|
onPress: (e: GestureResponderEvent) => void;
|
|
@@ -63,16 +63,16 @@ export type ItemProps = React.PropsWithChildren<
|
|
|
63
63
|
}
|
|
64
64
|
>;
|
|
65
65
|
|
|
66
|
-
export type
|
|
66
|
+
export type MenuItemTextProps = React.PropsWithChildren<{
|
|
67
67
|
style?: TextStyle;
|
|
68
68
|
}>;
|
|
69
69
|
|
|
70
|
-
export type
|
|
70
|
+
export type MenuItemIconProps = {
|
|
71
71
|
icon: React.ComponentType<SVGIconProps>;
|
|
72
72
|
position?: 'left' | 'right';
|
|
73
73
|
fill?: (props: { disabled: boolean }) => string;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
export type
|
|
76
|
+
export type MenuGroupProps = React.PropsWithChildren<{
|
|
77
77
|
style?: StyleProp<ViewStyle>;
|
|
78
78
|
}>;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { Popover, PopoverTrigger, PopoverContent } from './index';
|
|
6
6
|
import { Button } from '../button';
|
|
7
7
|
import { Item } from '../item';
|
|
8
8
|
import { Text } from '../typography';
|
|
@@ -18,22 +18,22 @@ type Story = StoryObj;
|
|
|
18
18
|
export const Basic: Story = {
|
|
19
19
|
render: () => (
|
|
20
20
|
<View style={{ padding: 80 }}>
|
|
21
|
-
<Popover
|
|
22
|
-
<
|
|
21
|
+
<Popover>
|
|
22
|
+
<PopoverTrigger label="Open popover">
|
|
23
23
|
{({ props }) => (
|
|
24
24
|
<Button {...props} onPress={props.onPress}>
|
|
25
25
|
Open popover
|
|
26
26
|
</Button>
|
|
27
27
|
)}
|
|
28
|
-
</
|
|
29
|
-
<
|
|
28
|
+
</PopoverTrigger>
|
|
29
|
+
<PopoverContent label="Account actions" placement="bottom-start">
|
|
30
30
|
<View style={{ minWidth: 200 }}>
|
|
31
31
|
<Item title="Edit profile" density="compact" onPress={() => {}} />
|
|
32
32
|
<Item title="Settings" density="compact" onPress={() => {}} />
|
|
33
33
|
<Item title="Sign out" density="compact" destructive onPress={() => {}} />
|
|
34
34
|
</View>
|
|
35
|
-
</
|
|
36
|
-
</Popover
|
|
35
|
+
</PopoverContent>
|
|
36
|
+
</Popover>
|
|
37
37
|
</View>
|
|
38
38
|
),
|
|
39
39
|
};
|
|
@@ -41,21 +41,21 @@ export const Basic: Story = {
|
|
|
41
41
|
export const RichContent: Story = {
|
|
42
42
|
render: () => (
|
|
43
43
|
<View style={{ padding: 80 }}>
|
|
44
|
-
<Popover
|
|
45
|
-
<
|
|
44
|
+
<Popover>
|
|
45
|
+
<PopoverTrigger label="Details">
|
|
46
46
|
{({ props }) => (
|
|
47
47
|
<Button {...props} variant="secondary" onPress={props.onPress}>
|
|
48
48
|
Details
|
|
49
49
|
</Button>
|
|
50
50
|
)}
|
|
51
|
-
</
|
|
52
|
-
<
|
|
51
|
+
</PopoverTrigger>
|
|
52
|
+
<PopoverContent label="Details" placement="bottom" maxWidth={280}>
|
|
53
53
|
<View style={{ padding: 12, gap: 6 }}>
|
|
54
54
|
<Text style={{ fontWeight: '600' }}>Storage</Text>
|
|
55
55
|
<Text>4.2 GB of 10 GB used.</Text>
|
|
56
56
|
</View>
|
|
57
|
-
</
|
|
58
|
-
</Popover
|
|
57
|
+
</PopoverContent>
|
|
58
|
+
</Popover>
|
|
59
59
|
</View>
|
|
60
60
|
),
|
|
61
61
|
};
|
package/src/popover/context.ts
CHANGED
|
@@ -20,7 +20,7 @@ PopoverContext.displayName = 'PopoverContext';
|
|
|
20
20
|
export function usePopoverContext(): PopoverContextValue {
|
|
21
21
|
const ctx = useContext(PopoverContext);
|
|
22
22
|
if (!ctx) {
|
|
23
|
-
throw new Error('Popover components must be used within a <Popover
|
|
23
|
+
throw new Error('Popover components must be used within a <Popover>');
|
|
24
24
|
}
|
|
25
25
|
return ctx;
|
|
26
26
|
}
|
package/src/popover/index.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { PopoverContext, usePopoverContext } from './context';
|
|
|
7
7
|
import type {
|
|
8
8
|
PopoverContentProps,
|
|
9
9
|
PopoverControlProps,
|
|
10
|
-
|
|
10
|
+
PopoverProps,
|
|
11
11
|
PopoverTriggerProps,
|
|
12
12
|
} from './types';
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ export type {
|
|
|
15
15
|
PopoverControlProps,
|
|
16
16
|
PopoverContentProps,
|
|
17
17
|
PopoverTriggerProps,
|
|
18
|
-
|
|
18
|
+
PopoverProps,
|
|
19
19
|
PopoverPlacement,
|
|
20
20
|
PopoverTriggerRenderProps,
|
|
21
21
|
PopoverTriggerState,
|
|
@@ -29,7 +29,7 @@ export { usePopoverContext };
|
|
|
29
29
|
* established native-overlay convention, shared with `Menu`/`Select`). The
|
|
30
30
|
* web fork (`index.web.tsx`) anchors a floating panel to the trigger.
|
|
31
31
|
*/
|
|
32
|
-
export function
|
|
32
|
+
export function Popover({ children, control }: PopoverProps) {
|
|
33
33
|
const defaultControl = useDialogControl();
|
|
34
34
|
const triggerRef = useRef<View | null>(null);
|
|
35
35
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -64,7 +64,7 @@ export function Root({ children, control }: PopoverRootProps) {
|
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
export function
|
|
67
|
+
export function PopoverTrigger({ children, label }: PopoverTriggerProps) {
|
|
68
68
|
const { control, triggerRef } = usePopoverContext();
|
|
69
69
|
const [focused, setFocused] = useState(false);
|
|
70
70
|
const [pressed, setPressed] = useState(false);
|
|
@@ -89,7 +89,7 @@ export function Trigger({ children, label }: PopoverTriggerProps) {
|
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
export function
|
|
92
|
+
export function PopoverContent({
|
|
93
93
|
children,
|
|
94
94
|
label = 'Popover',
|
|
95
95
|
style,
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
PopoverContentProps,
|
|
18
18
|
PopoverControlProps,
|
|
19
19
|
PopoverPlacement,
|
|
20
|
-
|
|
20
|
+
PopoverProps,
|
|
21
21
|
PopoverTriggerProps,
|
|
22
22
|
} from './types';
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ export type {
|
|
|
25
25
|
PopoverControlProps,
|
|
26
26
|
PopoverContentProps,
|
|
27
27
|
PopoverTriggerProps,
|
|
28
|
-
|
|
28
|
+
PopoverProps,
|
|
29
29
|
PopoverPlacement,
|
|
30
30
|
PopoverTriggerRenderProps,
|
|
31
31
|
PopoverTriggerState,
|
|
@@ -69,7 +69,7 @@ interface Rect {
|
|
|
69
69
|
height: number;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export function
|
|
72
|
+
export function Popover({ children, control }: PopoverProps) {
|
|
73
73
|
const id = useId();
|
|
74
74
|
const [isOpen, setIsOpen] = useState(false);
|
|
75
75
|
const triggerRef = useRef<View | null>(null);
|
|
@@ -121,7 +121,7 @@ export function Root({ children, control }: PopoverRootProps) {
|
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
export function
|
|
124
|
+
export function PopoverTrigger({ children, label }: PopoverTriggerProps) {
|
|
125
125
|
const { control, triggerRef, isOpen } = usePopoverContext();
|
|
126
126
|
const [hovered, setHovered] = useState(false);
|
|
127
127
|
const [focused, setFocused] = useState(false);
|
|
@@ -191,7 +191,7 @@ function resolvePosition(
|
|
|
191
191
|
return { left, top };
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
export function
|
|
194
|
+
export function PopoverContent({
|
|
195
195
|
children,
|
|
196
196
|
label = 'Popover',
|
|
197
197
|
placement = 'bottom-start',
|
package/src/popover/types.ts
CHANGED
|
@@ -53,7 +53,7 @@ export interface PopoverContentProps {
|
|
|
53
53
|
testID?: string;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export interface
|
|
56
|
+
export interface PopoverProps {
|
|
57
57
|
children: React.ReactNode;
|
|
58
58
|
/** Optionally supply your own control (from `usePopoverControl`). */
|
|
59
59
|
control?: PopoverControlProps;
|
|
@@ -4,12 +4,12 @@ import { Platform, type TextInput, View } from 'react-native';
|
|
|
4
4
|
import { useTheme } from '../theme/use-theme';
|
|
5
5
|
import { atoms as a } from '../styles';
|
|
6
6
|
import { Button } from '../button';
|
|
7
|
-
import
|
|
7
|
+
import { TextField, TextFieldIcon, TextFieldInput, type TextFieldInputProps } from '../text-field';
|
|
8
8
|
import { MagnifyingGlass_Stroke2_Corner0_Rounded as MagnifyingGlassIcon } from '../icons/MagnifyingGlass';
|
|
9
9
|
import { TimesLarge_Stroke2_Corner0_Rounded as X } from '../icons/Times';
|
|
10
10
|
|
|
11
|
-
type SearchInputProps = Omit<
|
|
12
|
-
label?:
|
|
11
|
+
type SearchInputProps = Omit<TextFieldInputProps, 'label'> & {
|
|
12
|
+
label?: TextFieldInputProps['label'];
|
|
13
13
|
/**
|
|
14
14
|
* Called when the user presses the clear (X) button.
|
|
15
15
|
*/
|
|
@@ -23,9 +23,9 @@ export const SearchInput = forwardRef<TextInput, SearchInputProps>(
|
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<View style={[a.w_full, a.relative]}>
|
|
26
|
-
<TextField
|
|
27
|
-
<
|
|
28
|
-
<
|
|
26
|
+
<TextField>
|
|
27
|
+
<TextFieldIcon icon={MagnifyingGlassIcon} />
|
|
28
|
+
<TextFieldInput
|
|
29
29
|
inputRef={ref}
|
|
30
30
|
label={label}
|
|
31
31
|
value={value}
|
|
@@ -41,7 +41,7 @@ export const SearchInput = forwardRef<TextInput, SearchInputProps>(
|
|
|
41
41
|
style={showClear ? { paddingRight: 24 } : undefined}
|
|
42
42
|
{...rest}
|
|
43
43
|
/>
|
|
44
|
-
</TextField
|
|
44
|
+
</TextField>
|
|
45
45
|
|
|
46
46
|
{showClear && (
|
|
47
47
|
<View
|