@opencode/ui 0.0.0-dev-825 → 0.0.0-dev-828
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DropdownMenu } from "@kobalte/core/dropdown-menu";
|
|
1
|
+
import { DropdownMenu, type DropdownMenuTriggerProps } from "@kobalte/core/dropdown-menu";
|
|
2
2
|
import { ContextMenu } from "@kobalte/core/context-menu";
|
|
3
|
-
import
|
|
3
|
+
import type { PolymorphicProps } from "@kobalte/core/polymorphic";
|
|
4
|
+
import { type ComponentProps, type JSX, type ParentProps, type ValidComponent } from "solid-js";
|
|
4
5
|
import "./menu.css";
|
|
5
6
|
export type MenuAppearance = "standard" | "compact";
|
|
6
7
|
export interface MenuItemProps extends ComponentProps<typeof DropdownMenu.Item> {
|
|
@@ -30,6 +31,7 @@ declare function MenuSubTrigger(props: ParentProps<MenuSubTriggerProps>): JSX.El
|
|
|
30
31
|
declare function MenuSubContent(props: ComponentProps<typeof DropdownMenu.SubContent>): JSX.Element;
|
|
31
32
|
declare function MenuGroupLabel(props: ComponentProps<typeof DropdownMenu.GroupLabel>): JSX.Element;
|
|
32
33
|
declare function MenuSeparator(props: ComponentProps<typeof DropdownMenu.Separator>): JSX.Element;
|
|
34
|
+
declare function MenuTrigger<T extends ValidComponent = "button">(props: PolymorphicProps<T, DropdownMenuTriggerProps<T>>): JSX.Element;
|
|
33
35
|
declare function MenuContent(props: ComponentProps<typeof DropdownMenu.Content>): JSX.Element;
|
|
34
36
|
export interface MenuProps extends ComponentProps<typeof DropdownMenu> {
|
|
35
37
|
appearance?: MenuAppearance;
|
|
@@ -41,7 +43,7 @@ export interface MenuContextProps extends ComponentProps<typeof ContextMenu> {
|
|
|
41
43
|
declare function MenuContextRoot(props: MenuContextProps): JSX.Element;
|
|
42
44
|
declare function MenuContextContent(props: ComponentProps<typeof ContextMenu.Content>): JSX.Element;
|
|
43
45
|
export declare const Menu: typeof MenuRoot & {
|
|
44
|
-
Trigger: typeof
|
|
46
|
+
Trigger: typeof MenuTrigger;
|
|
45
47
|
Portal: typeof import("@kobalte/core/context-menu").Portal;
|
|
46
48
|
Content: typeof MenuContent;
|
|
47
49
|
Item: typeof MenuItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencode/ui",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-828",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
"dependencies": {
|
|
301
301
|
"@kitlangton/solid-motion": "0.2.2",
|
|
302
302
|
"@kobalte/core": "0.13.13",
|
|
303
|
-
"@opencode/util": "0.0.0-dev-
|
|
303
|
+
"@opencode/util": "0.0.0-dev-828",
|
|
304
304
|
"@pierre/diffs": "1.6.1",
|
|
305
305
|
"@pierre/highlights": "0.2.0",
|
|
306
306
|
"@solid-primitives/event-listener": "2.4.6",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DropdownMenu } from "@kobalte/core/dropdown-menu"
|
|
1
|
+
import { DropdownMenu, type DropdownMenuTriggerProps } from "@kobalte/core/dropdown-menu"
|
|
2
2
|
import { ContextMenu } from "@kobalte/core/context-menu"
|
|
3
|
+
import type { PolymorphicProps } from "@kobalte/core/polymorphic"
|
|
3
4
|
import {
|
|
4
5
|
createComputed,
|
|
5
6
|
createContext,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
type ComponentProps,
|
|
14
15
|
type JSX,
|
|
15
16
|
type ParentProps,
|
|
17
|
+
type ValidComponent,
|
|
16
18
|
} from "solid-js"
|
|
17
19
|
import {
|
|
18
20
|
createMenuState,
|
|
@@ -316,6 +318,14 @@ function MenuSeparator(props: ComponentProps<typeof DropdownMenu.Separator>) {
|
|
|
316
318
|
)
|
|
317
319
|
}
|
|
318
320
|
|
|
321
|
+
// Kobalte drops `data-expanded` as the menu closes but returns focus to the trigger a task later, so for a frame the
|
|
322
|
+
// trigger is neither expanded nor focused. `data-closing` covers that gap for UI revealed by either.
|
|
323
|
+
function MenuTrigger<T extends ValidComponent = "button">(props: PolymorphicProps<T, DropdownMenuTriggerProps<T>>) {
|
|
324
|
+
const ctx = useMenuContext()
|
|
325
|
+
|
|
326
|
+
return <DropdownMenu.Trigger {...props} data-closing={ctx.state().status === "closing" ? "" : undefined} />
|
|
327
|
+
}
|
|
328
|
+
|
|
319
329
|
function MenuContent(props: ComponentProps<typeof DropdownMenu.Content>) {
|
|
320
330
|
const ctx = useMenuContext()
|
|
321
331
|
const [s, r] = splitProps(props, ["class", "classList", "onCloseAutoFocus", "onInteractOutside"])
|
|
@@ -439,7 +449,7 @@ const MenuContext = Object.assign(MenuContextRoot, {
|
|
|
439
449
|
})
|
|
440
450
|
|
|
441
451
|
export const Menu = Object.assign(MenuRoot, {
|
|
442
|
-
Trigger:
|
|
452
|
+
Trigger: MenuTrigger,
|
|
443
453
|
Portal: DropdownMenu.Portal,
|
|
444
454
|
Content: MenuContent,
|
|
445
455
|
Item: MenuItem,
|