@oxyhq/bloom 0.17.0 → 0.18.1
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/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/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/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/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/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 -7
- package/src/__tests__/public-api-contract.test.ts +19 -7
- 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/tooltip/index.tsx +6 -6
- package/src/tooltip/index.web.tsx +6 -6
|
@@ -23,13 +23,13 @@ import { useInteractionState } from '../hooks/useInteractionState';
|
|
|
23
23
|
import { ItemCtx, useItemContext } from './context';
|
|
24
24
|
import type {
|
|
25
25
|
ContextMenuContextValue,
|
|
26
|
-
|
|
26
|
+
ContextMenuContentProps,
|
|
27
|
+
ContextMenuGroupProps,
|
|
28
|
+
ContextMenuItemIconProps,
|
|
29
|
+
ContextMenuItemProps,
|
|
30
|
+
ContextMenuItemTextProps,
|
|
31
|
+
ContextMenuTriggerProps,
|
|
27
32
|
ItemContextValue,
|
|
28
|
-
ItemIconProps,
|
|
29
|
-
ItemProps,
|
|
30
|
-
ItemTextProps,
|
|
31
|
-
OuterProps,
|
|
32
|
-
TriggerProps,
|
|
33
33
|
} from './types';
|
|
34
34
|
|
|
35
35
|
// ---------------------------------------------------------------------------
|
|
@@ -47,17 +47,17 @@ function useNativeContextMenuContext(): NativeContextMenuContextValue {
|
|
|
47
47
|
const ctx = useContext(NativeContextMenuContext);
|
|
48
48
|
if (!ctx) {
|
|
49
49
|
throw new Error(
|
|
50
|
-
'ContextMenu components must be used within a ContextMenu
|
|
50
|
+
'ContextMenu components must be used within a <ContextMenu>',
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
return ctx;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// ---------------------------------------------------------------------------
|
|
57
|
-
// Root
|
|
57
|
+
// ContextMenu (Root)
|
|
58
58
|
// ---------------------------------------------------------------------------
|
|
59
59
|
|
|
60
|
-
export function
|
|
60
|
+
export function ContextMenu({ children }: { children: React.ReactNode }) {
|
|
61
61
|
const control = useDialogControl();
|
|
62
62
|
|
|
63
63
|
const ctx = useMemo(
|
|
@@ -78,10 +78,10 @@ export function Root({ children }: { children: React.ReactNode }) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// ---------------------------------------------------------------------------
|
|
81
|
-
//
|
|
81
|
+
// ContextMenuTrigger
|
|
82
82
|
// ---------------------------------------------------------------------------
|
|
83
83
|
|
|
84
|
-
export function
|
|
84
|
+
export function ContextMenuTrigger({ children, label, hint, style }: ContextMenuTriggerProps) {
|
|
85
85
|
const { open } = useNativeContextMenuContext();
|
|
86
86
|
const { state: focused, onIn: onFocus, onOut: onBlur } = useInteractionState();
|
|
87
87
|
|
|
@@ -108,10 +108,10 @@ export function Trigger({ children, label, hint, style }: TriggerProps) {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// ---------------------------------------------------------------------------
|
|
111
|
-
//
|
|
111
|
+
// ContextMenuContent (the menu container — uses Bloom Dialog as a bottom sheet)
|
|
112
112
|
// ---------------------------------------------------------------------------
|
|
113
113
|
|
|
114
|
-
export function
|
|
114
|
+
export function ContextMenuContent({ children, style }: ContextMenuContentProps) {
|
|
115
115
|
const { control } = useNativeContextMenuContext();
|
|
116
116
|
|
|
117
117
|
return (
|
|
@@ -131,16 +131,16 @@ export function Outer({ children, style }: OuterProps) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
// ---------------------------------------------------------------------------
|
|
134
|
-
//
|
|
134
|
+
// ContextMenuItem
|
|
135
135
|
// ---------------------------------------------------------------------------
|
|
136
136
|
|
|
137
|
-
export function
|
|
137
|
+
export function ContextMenuItem({
|
|
138
138
|
children,
|
|
139
139
|
label,
|
|
140
140
|
onPress,
|
|
141
141
|
disabled = false,
|
|
142
142
|
style,
|
|
143
|
-
}:
|
|
143
|
+
}: ContextMenuItemProps) {
|
|
144
144
|
const theme = useTheme();
|
|
145
145
|
const { close } = useNativeContextMenuContext();
|
|
146
146
|
const { state: focused, onIn: onFocus, onOut: onBlur } = useInteractionState();
|
|
@@ -191,10 +191,10 @@ export function Item({
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
// ---------------------------------------------------------------------------
|
|
194
|
-
//
|
|
194
|
+
// ContextMenuItemText
|
|
195
195
|
// ---------------------------------------------------------------------------
|
|
196
196
|
|
|
197
|
-
export function
|
|
197
|
+
export function ContextMenuItemText({ children, style }: ContextMenuItemTextProps) {
|
|
198
198
|
const theme = useTheme();
|
|
199
199
|
const { disabled } = useItemContext();
|
|
200
200
|
|
|
@@ -214,10 +214,10 @@ export function ItemText({ children, style }: ItemTextProps) {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
// ---------------------------------------------------------------------------
|
|
217
|
-
//
|
|
217
|
+
// ContextMenuItemIcon
|
|
218
218
|
// ---------------------------------------------------------------------------
|
|
219
219
|
|
|
220
|
-
export function
|
|
220
|
+
export function ContextMenuItemIcon({ icon: Comp }: ContextMenuItemIconProps) {
|
|
221
221
|
const theme = useTheme();
|
|
222
222
|
const { disabled } = useItemContext();
|
|
223
223
|
|
|
@@ -230,18 +230,18 @@ export function ItemIcon({ icon: Comp }: ItemIconProps) {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
// ---------------------------------------------------------------------------
|
|
233
|
-
//
|
|
233
|
+
// ContextMenuGroup
|
|
234
234
|
// ---------------------------------------------------------------------------
|
|
235
235
|
|
|
236
|
-
export function
|
|
236
|
+
export function ContextMenuGroup({ children, style }: ContextMenuGroupProps) {
|
|
237
237
|
return <View style={style}>{children}</View>;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
// ---------------------------------------------------------------------------
|
|
241
|
-
//
|
|
241
|
+
// ContextMenuDivider
|
|
242
242
|
// ---------------------------------------------------------------------------
|
|
243
243
|
|
|
244
|
-
export function
|
|
244
|
+
export function ContextMenuDivider() {
|
|
245
245
|
const theme = useTheme();
|
|
246
246
|
|
|
247
247
|
return (
|
|
@@ -23,13 +23,13 @@ import { createOverlayZIndex } from '../styles/z-index';
|
|
|
23
23
|
import { ItemCtx, useItemContext } from './context';
|
|
24
24
|
import type {
|
|
25
25
|
ContextMenuContextValue,
|
|
26
|
-
|
|
26
|
+
ContextMenuContentProps,
|
|
27
|
+
ContextMenuGroupProps,
|
|
28
|
+
ContextMenuItemIconProps,
|
|
29
|
+
ContextMenuItemProps,
|
|
30
|
+
ContextMenuItemTextProps,
|
|
31
|
+
ContextMenuTriggerProps,
|
|
27
32
|
ItemContextValue,
|
|
28
|
-
ItemIconProps,
|
|
29
|
-
ItemProps,
|
|
30
|
-
ItemTextProps,
|
|
31
|
-
OuterProps,
|
|
32
|
-
TriggerProps,
|
|
33
33
|
} from './types';
|
|
34
34
|
|
|
35
35
|
const contextMenuZIndex = createOverlayZIndex();
|
|
@@ -51,17 +51,17 @@ function useWebContextMenuContext(): WebContextMenuContextValue {
|
|
|
51
51
|
const ctx = useContext(WebContextMenuContext);
|
|
52
52
|
if (!ctx) {
|
|
53
53
|
throw new Error(
|
|
54
|
-
'ContextMenu components must be used within a ContextMenu
|
|
54
|
+
'ContextMenu components must be used within a <ContextMenu>',
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
return ctx;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// ---------------------------------------------------------------------------
|
|
61
|
-
// Root
|
|
61
|
+
// ContextMenu (Root)
|
|
62
62
|
// ---------------------------------------------------------------------------
|
|
63
63
|
|
|
64
|
-
export function
|
|
64
|
+
export function ContextMenu({ children }: { children: React.ReactNode }) {
|
|
65
65
|
const [position, setPosition] = useState<Position | null>(null);
|
|
66
66
|
const isOpen = position !== null;
|
|
67
67
|
|
|
@@ -70,7 +70,7 @@ export function Root({ children }: { children: React.ReactNode }) {
|
|
|
70
70
|
isOpen,
|
|
71
71
|
position,
|
|
72
72
|
open: () => {
|
|
73
|
-
/* open is handled by the
|
|
73
|
+
/* open is handled by the ContextMenuTrigger's contextmenu event */
|
|
74
74
|
},
|
|
75
75
|
close: () => setPosition(null),
|
|
76
76
|
}),
|
|
@@ -78,7 +78,7 @@ export function Root({ children }: { children: React.ReactNode }) {
|
|
|
78
78
|
);
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* We store the setPosition in a ref so the
|
|
81
|
+
* We store the setPosition in a ref so the ContextMenuTrigger can call it
|
|
82
82
|
* without needing a stable identity on `open`.
|
|
83
83
|
*/
|
|
84
84
|
return (
|
|
@@ -96,10 +96,10 @@ const SetPositionContext = createContext<
|
|
|
96
96
|
SetPositionContext.displayName = 'ContextMenuSetPositionContext';
|
|
97
97
|
|
|
98
98
|
// ---------------------------------------------------------------------------
|
|
99
|
-
//
|
|
99
|
+
// ContextMenuTrigger
|
|
100
100
|
// ---------------------------------------------------------------------------
|
|
101
101
|
|
|
102
|
-
export function
|
|
102
|
+
export function ContextMenuTrigger({ children, label, hint, style }: ContextMenuTriggerProps) {
|
|
103
103
|
const ctx = useWebContextMenuContext();
|
|
104
104
|
const setPosition = useContext(SetPositionContext);
|
|
105
105
|
const triggerRef = useRef<View>(null);
|
|
@@ -146,10 +146,10 @@ export function Trigger({ children, label, hint, style }: TriggerProps) {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
// ---------------------------------------------------------------------------
|
|
149
|
-
//
|
|
149
|
+
// ContextMenuContent
|
|
150
150
|
// ---------------------------------------------------------------------------
|
|
151
151
|
|
|
152
|
-
export function
|
|
152
|
+
export function ContextMenuContent({ children, style }: ContextMenuContentProps) {
|
|
153
153
|
const ctx = useWebContextMenuContext();
|
|
154
154
|
const theme = useTheme();
|
|
155
155
|
const { isOpen, close, position } = ctx;
|
|
@@ -197,16 +197,16 @@ export function Outer({ children, style }: OuterProps) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
// ---------------------------------------------------------------------------
|
|
200
|
-
//
|
|
200
|
+
// ContextMenuItem
|
|
201
201
|
// ---------------------------------------------------------------------------
|
|
202
202
|
|
|
203
|
-
export function
|
|
203
|
+
export function ContextMenuItem({
|
|
204
204
|
children,
|
|
205
205
|
label,
|
|
206
206
|
onPress,
|
|
207
207
|
disabled = false,
|
|
208
208
|
style,
|
|
209
|
-
}:
|
|
209
|
+
}: ContextMenuItemProps) {
|
|
210
210
|
const theme = useTheme();
|
|
211
211
|
const { close } = useWebContextMenuContext();
|
|
212
212
|
const {
|
|
@@ -256,10 +256,10 @@ export function Item({
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
// ---------------------------------------------------------------------------
|
|
259
|
-
//
|
|
259
|
+
// ContextMenuItemText
|
|
260
260
|
// ---------------------------------------------------------------------------
|
|
261
261
|
|
|
262
|
-
export function
|
|
262
|
+
export function ContextMenuItemText({ children, style }: ContextMenuItemTextProps) {
|
|
263
263
|
const theme = useTheme();
|
|
264
264
|
const { disabled } = useItemContext();
|
|
265
265
|
|
|
@@ -279,10 +279,10 @@ export function ItemText({ children, style }: ItemTextProps) {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
// ---------------------------------------------------------------------------
|
|
282
|
-
//
|
|
282
|
+
// ContextMenuItemIcon
|
|
283
283
|
// ---------------------------------------------------------------------------
|
|
284
284
|
|
|
285
|
-
export function
|
|
285
|
+
export function ContextMenuItemIcon({ icon: Comp }: ContextMenuItemIconProps) {
|
|
286
286
|
const theme = useTheme();
|
|
287
287
|
const { disabled } = useItemContext();
|
|
288
288
|
|
|
@@ -295,18 +295,18 @@ export function ItemIcon({ icon: Comp }: ItemIconProps) {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
// ---------------------------------------------------------------------------
|
|
298
|
-
//
|
|
298
|
+
// ContextMenuGroup
|
|
299
299
|
// ---------------------------------------------------------------------------
|
|
300
300
|
|
|
301
|
-
export function
|
|
301
|
+
export function ContextMenuGroup({ children }: ContextMenuGroupProps) {
|
|
302
302
|
return <>{children}</>;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
// ---------------------------------------------------------------------------
|
|
306
|
-
//
|
|
306
|
+
// ContextMenuDivider
|
|
307
307
|
// ---------------------------------------------------------------------------
|
|
308
308
|
|
|
309
|
-
export function
|
|
309
|
+
export function ContextMenuDivider() {
|
|
310
310
|
const theme = useTheme();
|
|
311
311
|
|
|
312
312
|
return (
|
|
@@ -18,7 +18,7 @@ export type ItemContextValue = {
|
|
|
18
18
|
disabled: boolean;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export type
|
|
21
|
+
export type ContextMenuTriggerProps = {
|
|
22
22
|
children: (props: TriggerChildProps) => React.ReactNode;
|
|
23
23
|
label: string;
|
|
24
24
|
/** Accessibility hint describing what long-pressing / right-clicking does. */
|
|
@@ -44,25 +44,25 @@ export type TriggerChildProps = {
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
export type
|
|
47
|
+
export type ContextMenuContentProps = React.PropsWithChildren<{
|
|
48
48
|
style?: StyleProp<ViewStyle>;
|
|
49
49
|
}>;
|
|
50
50
|
|
|
51
|
-
export type
|
|
51
|
+
export type ContextMenuItemProps = React.PropsWithChildren<{
|
|
52
52
|
label: string;
|
|
53
53
|
onPress: (e?: GestureResponderEvent) => void;
|
|
54
54
|
disabled?: boolean;
|
|
55
55
|
style?: StyleProp<ViewStyle>;
|
|
56
56
|
}>;
|
|
57
57
|
|
|
58
|
-
export type
|
|
58
|
+
export type ContextMenuItemTextProps = React.PropsWithChildren<{
|
|
59
59
|
style?: TextStyle;
|
|
60
60
|
}>;
|
|
61
61
|
|
|
62
|
-
export type
|
|
62
|
+
export type ContextMenuItemIconProps = {
|
|
63
63
|
icon: React.ComponentType<SVGIconProps>;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export type
|
|
66
|
+
export type ContextMenuGroupProps = React.PropsWithChildren<{
|
|
67
67
|
style?: StyleProp<ViewStyle>;
|
|
68
68
|
}>;
|
|
@@ -31,7 +31,7 @@ export interface SheetShellProps {
|
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Bottom-sheet shell with an embedded drag handle. Exposes the bloom
|
|
34
|
-
* dialog `close()` context to descendants — `
|
|
34
|
+
* dialog `close()` context to descendants — `MenuItem`, `SelectItem`
|
|
35
35
|
* etc. rely on it to dismiss the sheet after selection.
|
|
36
36
|
*/
|
|
37
37
|
export function SheetShell({
|
|
@@ -4,7 +4,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
4
4
|
|
|
5
5
|
import { Field } from './Field';
|
|
6
6
|
import { Switch } from '../switch';
|
|
7
|
-
import
|
|
7
|
+
import { TextFieldInput } from '../text-field';
|
|
8
8
|
|
|
9
9
|
const meta: Meta = {
|
|
10
10
|
title: 'Forms/Field',
|
|
@@ -20,7 +20,7 @@ export const WithInput: Story = {
|
|
|
20
20
|
return (
|
|
21
21
|
<View style={{ width: 360 }}>
|
|
22
22
|
<Field label="Username" description="Choose a unique handle." required>
|
|
23
|
-
<
|
|
23
|
+
<TextFieldInput label="Username" value={v} onChangeText={setV} placeholder="ada" />
|
|
24
24
|
</Field>
|
|
25
25
|
</View>
|
|
26
26
|
);
|
|
@@ -33,7 +33,7 @@ export const WithError: Story = {
|
|
|
33
33
|
return (
|
|
34
34
|
<View style={{ width: 360 }}>
|
|
35
35
|
<Field label="Email" error="Enter a valid email address.">
|
|
36
|
-
<
|
|
36
|
+
<TextFieldInput label="Email" value={v} onChangeText={setV} isInvalid />
|
|
37
37
|
</Field>
|
|
38
38
|
</View>
|
|
39
39
|
);
|
package/src/index.ts
CHANGED
|
@@ -57,7 +57,7 @@ export type { AvatarGroupProps, AvatarGroupItem } from './avatar-group';
|
|
|
57
57
|
export { UserHoverCard } from './user-hover-card';
|
|
58
58
|
export type { UserHoverCardProps, UserHoverCardStat } from './user-hover-card';
|
|
59
59
|
export * from './loading';
|
|
60
|
-
export *
|
|
60
|
+
export * from './prompt-input';
|
|
61
61
|
export * from './switch';
|
|
62
62
|
export { toast, type Toast } from './toast';
|
|
63
63
|
|
|
@@ -71,8 +71,8 @@ export { Fill } from './fill';
|
|
|
71
71
|
export { IconCircle } from './icon-circle';
|
|
72
72
|
|
|
73
73
|
// Form components
|
|
74
|
-
export *
|
|
75
|
-
export *
|
|
74
|
+
export * from './text-field';
|
|
75
|
+
export * from './segmented-control';
|
|
76
76
|
export { SearchInput } from './search-input';
|
|
77
77
|
export { Label } from './label';
|
|
78
78
|
export type { LabelProps } from './label';
|
|
@@ -93,9 +93,9 @@ export type { BottomSheetRef, BottomSheetProps } from './bottom-sheet';
|
|
|
93
93
|
export * from './card';
|
|
94
94
|
export * from './badge';
|
|
95
95
|
export * from './chip';
|
|
96
|
-
export *
|
|
96
|
+
export * from './tabs';
|
|
97
97
|
export * from './checkbox';
|
|
98
|
-
export *
|
|
98
|
+
export * from './accordion';
|
|
99
99
|
|
|
100
100
|
// Settings / Grouped list
|
|
101
101
|
export * from './settings-list';
|
|
@@ -105,12 +105,12 @@ export { Kbd } from './kbd';
|
|
|
105
105
|
export type { KbdProps } from './kbd';
|
|
106
106
|
|
|
107
107
|
// Overlay components
|
|
108
|
-
export *
|
|
109
|
-
export *
|
|
110
|
-
export *
|
|
111
|
-
export *
|
|
112
|
-
export *
|
|
113
|
-
export *
|
|
108
|
+
export * from './admonition';
|
|
109
|
+
export * from './menu';
|
|
110
|
+
export * from './tooltip';
|
|
111
|
+
export * from './select';
|
|
112
|
+
export * from './context-menu';
|
|
113
|
+
export * from './popover';
|
|
114
114
|
export { AlertDialog, AlertDialogHost, confirm } from './alert-dialog';
|
|
115
115
|
export type {
|
|
116
116
|
AlertDialogProps,
|
package/src/index.web.ts
CHANGED
|
@@ -62,7 +62,7 @@ export type { AvatarGroupProps, AvatarGroupItem } from './avatar-group/index.web
|
|
|
62
62
|
export { UserHoverCard } from './user-hover-card';
|
|
63
63
|
export type { UserHoverCardProps, UserHoverCardStat } from './user-hover-card';
|
|
64
64
|
export * from './loading/index.web';
|
|
65
|
-
export *
|
|
65
|
+
export * from './prompt-input';
|
|
66
66
|
export * from './switch';
|
|
67
67
|
export { toast, type Toast } from './toast/index.web';
|
|
68
68
|
|
|
@@ -76,8 +76,8 @@ export { Fill } from './fill';
|
|
|
76
76
|
export { IconCircle } from './icon-circle';
|
|
77
77
|
|
|
78
78
|
// Form components
|
|
79
|
-
export *
|
|
80
|
-
export *
|
|
79
|
+
export * from './text-field';
|
|
80
|
+
export * from './segmented-control';
|
|
81
81
|
export { SearchInput } from './search-input';
|
|
82
82
|
export { Label } from './label';
|
|
83
83
|
export type { LabelProps } from './label';
|
|
@@ -98,9 +98,9 @@ export type { BottomSheetRef, BottomSheetProps } from './bottom-sheet';
|
|
|
98
98
|
export * from './card';
|
|
99
99
|
export * from './badge';
|
|
100
100
|
export * from './chip';
|
|
101
|
-
export *
|
|
101
|
+
export * from './tabs';
|
|
102
102
|
export * from './checkbox';
|
|
103
|
-
export *
|
|
103
|
+
export * from './accordion';
|
|
104
104
|
|
|
105
105
|
// Settings / Grouped list
|
|
106
106
|
export * from './settings-list';
|
|
@@ -110,12 +110,12 @@ export { Kbd } from './kbd';
|
|
|
110
110
|
export type { KbdProps } from './kbd';
|
|
111
111
|
|
|
112
112
|
// Overlay components
|
|
113
|
-
export *
|
|
114
|
-
export *
|
|
115
|
-
export *
|
|
116
|
-
export *
|
|
117
|
-
export *
|
|
118
|
-
export *
|
|
113
|
+
export * from './admonition';
|
|
114
|
+
export * from './menu/index.web';
|
|
115
|
+
export * from './tooltip/index.web';
|
|
116
|
+
export * from './select/index.web';
|
|
117
|
+
export * from './context-menu/index.web';
|
|
118
|
+
export * from './popover/index.web';
|
|
119
119
|
export { AlertDialog, AlertDialogHost, confirm } from './alert-dialog/index.web';
|
|
120
120
|
export type {
|
|
121
121
|
AlertDialogProps,
|
|
@@ -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
|
}
|