Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: upgrade cmd-k to fix html query selector bug crash (#2213)

Myles Scolnickacc6505a4cde
diff --git a/frontend/package.json b/frontend/package.json
index b3a5b1efdb..139383bcf7 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -88,7 +88,7 @@
"ansi_up": "^6.0.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
- "cmdk": "^0.2.1",
+ "cmdk": "^1.0.0",
"codemirror-extension-inline-suggestion": "^0.0.3",
"codemirror-languageserver": "^1.11.0",
"compassql": "^0.21.2",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 1d5a7d1ee6..899fb87e33 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -231,8 +231,8 @@ dependencies:
specifier: ^2.1.1
version: 2.1.1
cmdk:
- specifier: ^0.2.1
+ specifier: ^1.0.0
codemirror-extension-inline-suggestion:
specifier: ^0.0.3
version: 0.0.3(@codemirror/[email protected])(@codemirror/[email protected])
@@ -3770,12 +3770,6 @@ packages:
'@babel/runtime': 7.24.4
dev: false
- /@radix-ui/[email protected]:
- resolution: {integrity: sha512-3e7rn8FDMin4CgeL7Z/49smCA3rFYY3Ha2rUQ7HRWFadS5iCRw08ZgVT1LaNTCNqgvrUiyczLflrVrF0SRQtNA==}
- dependencies:
- '@babel/runtime': 7.24.4
- dev: false
-
/@radix-ui/[email protected]:
resolution: {integrity: sha512-yQ8oGX2GVsEYMWGxcovu1uGWPCxV5BFfeeYxqPmuAzUyLT9qmaMXSAhXpb0WrspIeqYzdJpkh2vHModJPgRIaw==}
dependencies:
@@ -3938,15 +3932,6 @@ packages:
react-dom: 18.3.1([email protected])
dev: false
- resolution: {integrity: sha512-0KaSv6sx787/hK3eF53iOkiSLwAGlFMx5lotrqD2pTjB18KbybKoEIgkNZTKC60YECDQTKGTRcDBILwZVqVKvA==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- react: 18.3.1
- dev: false
-
resolution: {integrity: sha512-fDSBgd44FKHa1FRMU59qBMPFcl2PZE+2nmqunj+BWFyYYjnhIDWL2ItDs3rrbJDQOtzt5nIebLCQc4QRfz6LJw==}
peerDependencies:
@@ -3987,15 +3972,6 @@ packages:
react-dom: 18.3.1([email protected])
dev: false
- resolution: {integrity: sha512-1pVM9RfOQ+n/N5PJK33kRSKsr1glNxomxONs5c49MliinBY6Yw2Q995qfBUUo0/Mbg05B/sGA0gkgPI7kmSHBg==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- react: 18.3.1
- dev: false
-
resolution: {integrity: sha512-ebbrdFoYTcuZ0v4wG5tedGnp9tzcV8awzsxYph7gXUyvnNLuTIcCk1q17JEbnVhXAKG9oX3KtchwiMIAYp9NLg==}
peerDependencies:
@@ -4010,33 +3986,6 @@ packages:
react: 18.3.1
dev: false
- resolution: {integrity: sha512-Yn9YU+QlHYLWwV1XfKiqnGVpWYWk6MeBVM6x/bcoyPvxgjQGoeT35482viLPctTMWoMw0PoHgqfSox7Ig+957Q==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- '@radix-ui/primitive': 1.0.0
- '@radix-ui/react-compose-refs': 1.0.0([email protected])
- '@radix-ui/react-context': 1.0.0([email protected])
- '@radix-ui/react-dismissable-layer': 1.0.0([email protected])([email protected])
- '@radix-ui/react-focus-guards': 1.0.0([email protected])
- '@radix-ui/react-focus-scope': 1.0.0([email protected])([email protected])
- '@radix-ui/react-id': 1.0.0([email protected])
- '@radix-ui/react-portal': 1.0.0([email protected])([email protected])
- '@radix-ui/react-presence': 1.0.0([email protected])([email protected])
- '@radix-ui/react-primitive': 1.0.0([email protected])([email protected])
- '@radix-ui/react-slot': 1.0.0([email protected])
- '@radix-ui/react-use-controllable-state': 1.0.0([email protected])
- aria-hidden: 1.1.3
- react: 18.3.1
- react-dom: 18.3.1([email protected])
- react-remove-scroll: 2.5.4(@types/[email protected])([email protected])
- transitivePeerDependencies:
- - '@types/react'
- dev: false
-
resolution: {integrity: sha512-GjWJX/AUpB703eEBanuBnIWdIXg6NvJFCXcNlSZk4xdszCdhrJgBoUd1cGk67vFO+WdA2pfI/plOpqz/5GUP6Q==}
peerDependencies:
@@ -4085,22 +4034,6 @@ packages:
react: 18.3.1
dev: false
- resolution: {integrity: sha512-n7kDRfx+LB1zLueRDvZ1Pd0bxdJWDUZNQ/GWoxDn2prnuJKRdxsjulejX/ePkOsLi2tTm6P24mDqlMSgQpsT6g==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- '@radix-ui/primitive': 1.0.0
- '@radix-ui/react-compose-refs': 1.0.0([email protected])
- '@radix-ui/react-primitive': 1.0.0([email protected])([email protected])
- '@radix-ui/react-use-callback-ref': 1.0.0([email protected])
- '@radix-ui/react-use-escape-keydown': 1.0.0([email protected])
- react: 18.3.1
- react-dom: 18.3.1([email protected])
- dev: false
-
resolution: {integrity: sha512-7UpBa/RKMoHJYjie1gkF1DlK8l1fdU/VKDpoS3rCCo8YBJR294GwcEHyxHw72yvphJ7ld0AXEcSLAzY2F/WyCg==}
peerDependencies:
@@ -4178,15 +4111,6 @@ packages:
react-dom: 18.3.1([email protected])
dev: false
- resolution: {integrity: sha512-UagjDk4ijOAnGu4WMUPj9ahi7/zJJqNZ9ZAiGPp7waUWJO0O1aWXi/udPphI0IUjvrhBsZJGSN66dR2dsueLWQ==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- react: 18.3.1
- dev: false
-
resolution: {integrity: sha512-Rect2dWbQ8waGzhMavsIbmSVCgYxkXLxxR3ZvCX79JOglzdEy4JXMb98lq4hPxUbLr77nP0UOGf4rcMU+s1pUA==}
peerDependencies:
@@ -4201,20 +4125,6 @@ packages:
react: 18.3.1
dev: false
- resolution: {integrity: sha512-C4SWtsULLGf/2L4oGeIHlvWQx7Rf+7cX/vKOAD2dXW0A1b5QXwi3wWeaEgW+wn+SEVrraMUk05vLU9fZZz5HbQ==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- '@radix-ui/react-compose-refs': 1.0.0([email protected])
- '@radix-ui/react-primitive': 1.0.0([email protected])([email protected])
- '@radix-ui/react-use-callback-ref': 1.0.0([email protected])
- react: 18.3.1
- react-dom: 18.3.1([email protected])
- dev: false
-
resolution: {integrity: sha512-upXdPfqI4islj2CslyfUBNlaJCPybbqRHAi1KER7Isel9Q2AtSJ0zRBZv8mWQiFXD2nyAJ4BhC3yXgZ6kMBSrQ==}
peerDependencies:
@@ -4269,16 +4179,6 @@ packages:
react: 18.3.1
dev: false
- resolution: {integrity: sha512-Q6iAB/U7Tq3NTolBBQbHTgclPmGWE3OlktGGqrClPozSw4vkQ1DfQAOtzgRPecKsMdJINE05iaoDUG8tRzCBjw==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- '@radix-ui/react-use-layout-effect': 1.0.0([email protected])
- react: 18.3.1
- dev: false
-
resolution: {integrity: sha512-tI7sT/kqYp8p96yGWY1OAnLHrqDgzHefRBKQ2YAkBS5ja7QLcZ9Z/uY7bEjPUatf8RomoXM8/1sMj1IJaE5UzQ==}
peerDependencies:
@@ -4482,18 +4382,6 @@ packages:
react-dom: 18.3.1([email protected])
dev: false
- resolution: {integrity: sha512-a8qyFO/Xb99d8wQdu4o7qnigNjTPG123uADNecz0eX4usnQEj7o+cG4ZX4zkqq98NYekT7UoEQIjxBNWIFuqTA==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- '@radix-ui/react-primitive': 1.0.0([email protected])([email protected])
- react: 18.3.1
- react-dom: 18.3.1([email protected])
- dev: false
-
resolution: {integrity: sha512-xLYZeHrWoPmA5mEKEfZZevoVRK/Q43GfzRXkWV6qawIWWK8t6ifIiLQdd7rmQ4Vk1bmI21XhqF9BN3jWf+phpA==}
peerDependencies:
@@ -4536,19 +4424,6 @@ packages:
react-dom: 18.3.1([email protected])
dev: false
- resolution: {integrity: sha512-A+6XEvN01NfVWiKu38ybawfHsBjWum42MRPnEuqPsBZ4eV7e/7K321B5VgYMPv3Xx5An6o1/l9ZuDBgmcmWK3w==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- '@radix-ui/react-compose-refs': 1.0.0([email protected])
- '@radix-ui/react-use-layout-effect': 1.0.0([email protected])
- react: 18.3.1
- react-dom: 18.3.1([email protected])
- dev: false
-
resolution: {integrity: sha512-UXLW4UAbIY5ZjcvzjfRFo5gxva8QirC9hF7wRE4U5gz+TP0DbRk+//qyuAQ1McDxBt1xNMBTaciFGvEmJvAZCg==}
peerDependencies:
@@ -4571,18 +4446,6 @@ packages:
react-dom: 18.3.1([email protected])
dev: false
- resolution: {integrity: sha512-EyXe6mnRlHZ8b6f4ilTDrXmkLShICIuOTTj0GX4w1rp+wSxf3+TD05u1UOITC8VsJ2a9nwHvdXtOXEOl0Cw/zQ==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- '@radix-ui/react-slot': 1.0.0([email protected])
- react: 18.3.1
- react-dom: 18.3.1([email protected])
- dev: false
-
resolution: {integrity: sha512-yi58uVyoAcK/Nq1inRY56ZSjKypBNKTa/1mcL8qdl6oJeEaDbOldlzrGn7P6Q3Id5d+SYNGc5AJgc4vGhjs5+g==}
peerDependencies:
@@ -4819,16 +4682,6 @@ packages:
react-dom: 18.3.1([email protected])
dev: false
- resolution: {integrity: sha512-3mrKauI/tWXo1Ll+gN5dHcxDPdm/Df1ufcDLCecn+pnCIVcdWE7CujXo8QaXOWRJyZyQWWbpB8eFwHzWXlv5mQ==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- '@radix-ui/react-compose-refs': 1.0.0([email protected])
- react: 18.3.1
- dev: false
-
resolution: {integrity: sha512-YeTpuq4deV+6DusvVUW4ivBgnkHwECUu0BiN43L5UCDFgdhsRUWAghhTF5MbvNTPzmiFOx90asDSUjWuCNapwg==}
peerDependencies:
@@ -5040,15 +4893,6 @@ packages:
react-dom: 18.3.1([email protected])
dev: false
- resolution: {integrity: sha512-GZtyzoHz95Rhs6S63D2t/eqvdFCm7I+yHMLVQheKM7nBD8mbZIt+ct1jz4536MDnaOGKIxynJ8eHTkVGVVkoTg==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- react: 18.3.1
- dev: false
-
resolution: {integrity: sha512-D94LjX4Sp0xJFVaoQOd3OO9k7tpBYNOXdVhkltUbGv2Qb9OXdrg/CpsjlZv7ia14Sylv398LswWBVVu5nqKzAQ==}
peerDependencies:
@@ -5063,16 +4907,6 @@ packages:
react: 18.3.1
dev: false
- resolution: {integrity: sha512-FohDoZvk3mEXh9AWAVyRTYR4Sq7/gavuofglmiXB2g1aKyboUD4YtgWxKj8O5n+Uak52gXQ4wKz5IFST4vtJHg==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- '@radix-ui/react-use-callback-ref': 1.0.0([email protected])
- react: 18.3.1
- dev: false
-
resolution: {integrity: sha512-Svl5GY5FQeN758fWKrjM6Qb7asvXeiZltlT4U2gVfl8Gx5UAv2sMR0LWo8yhsIZh2oQ0eFdZ59aoOOMV7b47VA==}
peerDependencies:
@@ -5088,16 +4922,6 @@ packages:
react: 18.3.1
dev: false
- resolution: {integrity: sha512-JwfBCUIfhXRxKExgIqGa4CQsiMemo1Xt0W/B4ei3fpzpvPENKpMKQ8mZSB6Acj3ebrAEgi2xiQvcI1PAAodvyg==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- '@radix-ui/react-use-callback-ref': 1.0.0([email protected])
- react: 18.3.1
- dev: false
-
resolution: {integrity: sha512-vyL82j40hcFicA+M4Ex7hVkB9vHgSse1ZWomAqV2Je3RleKGO5iM8KMOEtfoSB0PnIelMd2lATjTGMYqN5ylTg==}
peerDependencies:
@@ -5113,15 +4937,6 @@ packages:
react: 18.3.1
dev: false
- resolution: {integrity: sha512-6Tpkq+R6LOlmQb1R5NNETLG0B4YP0wc+klfXafpUCj6JGyaUc8il7/kUZ7m59rGbXGczE9Bs+iz2qloqsZBduQ==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- dependencies:
- '@babel/runtime': 7.24.4
- react: 18.3.1
- dev: false
-
resolution: {integrity: sha512-v/5RegiJWYdoCvMnITBkNNx6bCj20fiaJnWtRkU18yITptraXjffz5Qbn05uOiQnOvi+dbkznkoaMltz1GnszQ==}
peerDependencies:
@@ -9907,17 +9722,19 @@ packages:
engines: {node: '>=6'}
dev: false
- resolution: {integrity: sha512-U6//9lQ6JvT47+6OF6Gi8BvkxYQ8SCRRSKIJkthIMsFsLZRG0cKvTtuTaefyIKMQb8rvvXy0wGdpTNq/jPtm+g==}
+ resolution: {integrity: sha512-gDzVf0a09TvoJ5jnuPvygTB77+XdOSwEmJ88L6XPFPlv7T3RxbP9jgenfylrAMD0+Le1aO0nVjQUzl2g+vjz5Q==}
peerDependencies:
react: ^18.0.0
react-dom: ^18.0.0
dependencies:
- '@radix-ui/react-dialog': 1.0.0(@types/[email protected])([email protected])([email protected])
+ '@radix-ui/react-dialog': 1.0.5(@types/[email protected])(@types/[email protected])([email protected])([email protected])
+ '@radix-ui/react-primitive': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])
react: 18.3.1
react-dom: 18.3.1([email protected])
transitivePeerDependencies:
- '@types/react'
+ - '@types/react-dom'
dev: false
@@ -16036,25 +15853,6 @@ packages:
tslib: 2.6.3
dev: false
- resolution: {integrity: sha512-xGVKJJr0SJGQVirVFAUZ2k1QLyO6m+2fy0l8Qawbp5Jgrv3DeLalrfMNBFSlmz5kriGGzsVBtGVnf4pTKIhhWA==}
- engines: {node: '>=10'}
- peerDependencies:
- '@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0
- react: ^16.8.0 || ^17.0.0 || ^18.0.0
- peerDependenciesMeta:
- '@types/react':
- optional: true
- dependencies:
- '@types/react': 18.3.3
- react: 18.3.1
- react-remove-scroll-bar: 2.3.4(@types/[email protected])([email protected])
- react-style-singleton: 2.2.1(@types/[email protected])([email protected])
- tslib: 2.6.3
- use-callback-ref: 1.3.0(@types/[email protected])([email protected])
- use-sidecar: 1.1.2(@types/[email protected])([email protected])
- dev: false
-
resolution: {integrity: sha512-ImKhrzJJsyXJfBZ4bzu8Bwpka14c/fQt0k+cyFp/PBhTfyDnU5hjOtM4AG/0AMyy8oKzOTR0lDgJIM7pYXI0kw==}
engines: {node: '>=10'}
diff --git a/frontend/src/components/editor/cell/cell-actions.tsx b/frontend/src/components/editor/cell/cell-actions.tsx
index e3672ea95a..b7e1930104 100644
--- a/frontend/src/components/editor/cell/cell-actions.tsx
+++ b/frontend/src/components/editor/cell/cell-actions.tsx
@@ -35,6 +35,7 @@ import { useRestoreFocus } from "@/components/ui/use-restore-focus";
import { useAtomValue } from "jotai";
import { cellFocusDetailsAtom } from "@/core/cells/focus";
import type { CellId } from "@/core/cells/ids";
+import { CommandList } from "cmdk";
interface Props extends CellActionButtonProps {
children: React.ReactNode;
@@ -63,40 +64,43 @@ const CellActionsDropdownInternal = (
<PopoverContent className="w-[300px] p-0 pt-1" {...restoreFocus}>
<Command>
<CommandInput placeholder="Search actions..." className="h-6 m-1" />
- <CommandEmpty>No results</CommandEmpty>
- {actions.map((group, i) => (
- <Fragment key={i}>
- <CommandGroup key={i}>
- {group.map((action) => {
- return (
- <CommandItem
- key={action.label}
- onSelect={() => {
- if (action.disableClick) {
- return;
- }
- action.handle();
- setOpen(false);
- }}
- variant={action.variant}
- >
- <div className="flex items-center flex-1">
- {action.icon && (
- <div className="mr-2 w-5">{action.icon}</div>
- )}
- <div className="flex-1">{action.label}</div>
- <div className="flex-shrink-0 text-sm">
- {action.hotkey && renderMinimalShortcut(action.hotkey)}
- {action.rightElement}
+ <CommandList>
+ <CommandEmpty>No results</CommandEmpty>
+ {actions.map((group, i) => (
+ <Fragment key={i}>
+ <CommandGroup key={i}>
+ {group.map((action) => {
+ return (
+ <CommandItem
+ key={action.label}
+ onSelect={() => {
+ if (action.disableClick) {
+ return;
+ }
+ action.handle();
+ setOpen(false);
+ }}
+ variant={action.variant}
+ >
+ <div className="flex items-center flex-1">
+ {action.icon && (
+ <div className="mr-2 w-5">{action.icon}</div>
+ )}
+ <div className="flex-1">{action.label}</div>
+ <div className="flex-shrink-0 text-sm">
+ {action.hotkey &&
+ renderMinimalShortcut(action.hotkey)}
+ {action.rightElement}
+ </div>
</div>
- </div>
- </CommandItem>
- );
- })}
- </CommandGroup>
- {i < actions.length - 1 && <CommandSeparator />}
- </Fragment>
- ))}
+ </CommandItem>
+ );
+ })}
+ </CommandGroup>
+ {i < actions.length - 1 && <CommandSeparator />}
+ </Fragment>
+ ))}
+ </CommandList>
</Command>
</PopoverContent>
);
diff --git a/frontend/src/components/editor/header/filename-input.tsx b/frontend/src/components/editor/header/filename-input.tsx
index 2420696f95..eb7d06d4f8 100644
--- a/frontend/src/components/editor/header/filename-input.tsx
+++ b/frontend/src/components/editor/header/filename-input.tsx
@@ -154,41 +154,43 @@ export const FilenameInput = ({
shouldFilter={false}
className="bg-transparent group filename-input"
>
- <PopoverAnchor>
- <CommandInput
- data-testid="dir-completion-input"
- tabIndex={-1}
- rootClassName="border-none justify-center px-1"
- spellCheck="false"
- value={focused ? searchValue || "" : initialValue || ""}
- onKeyDown={(e) => {
- if (e.key === "Escape") {
- e.currentTarget.blur();
- }
- }}
- icon={null}
- ref={inputRef}
- onValueChange={setSearchValue}
- placeholder={placeholderText}
- autoComplete="off"
- style={flexibleWidth ? { maxWidth: size } : undefined}
+ <CommandList>
+ <PopoverAnchor>
+ <CommandInput
+ data-testid="dir-completion-input"
+ tabIndex={-1}
+ rootClassName="border-none justify-center px-1"
+ spellCheck="false"
+ value={focused ? searchValue || "" : initialValue || ""}
+ onKeyDown={(e) => {
+ if (e.key === "Escape") {
+ e.currentTarget.blur();
+ }
+ }}
+ icon={null}
+ ref={inputRef}
+ onValueChange={setSearchValue}
+ placeholder={placeholderText}
+ autoComplete="off"
+ style={flexibleWidth ? { maxWidth: size } : undefined}
+ className={cn(
+ className,
+ "w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60",
+ )}
+ />
+ </PopoverAnchor>
+
+ <PopoverContent
+ side="bottom"
className={cn(
- className,
- "w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60",
+ "p-0 w-full min-w-80 max-w-80vw hidden",
+ suggestionsList && "group-focus-within:block",
)}
- />
- </PopoverAnchor>
-
- <PopoverContent
- side="bottom"
- className={cn(
- "p-0 w-full min-w-80 max-w-80vw hidden",
- suggestionsList && "group-focus-within:block",
- )}
- portal={false}
- >
- {suggestionsList}
- </PopoverContent>
+ portal={false}
+ >
+ {suggestionsList}
+ </PopoverContent>
+ </CommandList>
</Command>
</Popover>
);
diff --git a/frontend/src/components/ui/command.tsx b/frontend/src/components/ui/command.tsx
index 3f83546b48..5c0569b10d 100644
--- a/frontend/src/components/ui/command.tsx
+++ b/frontend/src/components/ui/command.tsx
@@ -7,12 +7,13 @@ import { Search } from "lucide-react";
import { cn } from "@/utils/cn";
import { Dialog, DialogContent } from "@/components/ui/dialog";
import {
+ MENU_ITEM_DISABLED,
MenuShortcut,
menuItemVariants,
menuSeparatorVariants,
} from "./menu-items";
-import type { VariantProps } from "class-variance-authority";
import { Strings } from "@/utils/strings";
+import type { VariantProps } from "class-variance-authority";
const Command = React.forwardRef<
React.ElementRef<typeof CommandPrimitive>,
@@ -135,7 +136,13 @@ const CommandItem = React.forwardRef<
>(({ className, variant, inset, ...props }, ref) => (
<CommandPrimitive.Item
ref={ref}
- className={cn(menuItemVariants({ variant, inset }), className)}
+ className={cn(
+ menuItemVariants({ variant, inset }).replace(
+ MENU_ITEM_DISABLED,
+ "data-[disabled=false]:pointer-events-all data-[disabled=false]:opacity-100 data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
+ ),
+ className,
+ )}
{...props}
value={Strings.htmlEscape(props.value)}
/>
diff --git a/frontend/src/components/ui/menu-items.tsx b/frontend/src/components/ui/menu-items.tsx
index c7f6f2a012..ba13937195 100644
--- a/frontend/src/components/ui/menu-items.tsx
+++ b/frontend/src/components/ui/menu-items.tsx
@@ -25,14 +25,22 @@ export const menuSubTriggerVariants = cva(
},
);
+export const MENU_ITEM_DISABLED =
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
+
export const menuControlVariants = cva(
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ cn(
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground",
+ MENU_ITEM_DISABLED,
+ ),
{ variants: {} },
);
export const menuControlCheckVariants = cva(
"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
- { variants: {} },
+ {
+ variants: {},
+ },
);
export const menuLabelVariants = cva("px-2 py-1.5 text-sm font-semibold", {
@@ -44,7 +52,10 @@ export const menuLabelVariants = cva("px-2 py-1.5 text-sm font-semibold", {
});
export const menuItemVariants = cva(
- "menu-item relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ cn(
+ "menu-item relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
+ MENU_ITEM_DISABLED,
+ ),
{
variants: {
inset: {
diff --git a/frontend/src/components/ui/select.tsx b/frontend/src/components/ui/select.tsx
index 3f8eebd3e7..57d7f12935 100644
--- a/frontend/src/components/ui/select.tsx
+++ b/frontend/src/components/ui/select.tsx
@@ -13,6 +13,7 @@ import { cn } from "@/utils/cn";
import { selectStyles } from "./native-select";
import type { VariantProps } from "class-variance-authority";
import { withFullScreenAsRoot } from "./fullscreen";
+import { MENU_ITEM_DISABLED } from "./menu-items";
const Select = SelectPrimitive.Root;
@@ -115,7 +116,8 @@ const SelectItem = React.forwardRef<
<SelectPrimitive.Item
ref={ref}
className={cn(
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground",
+ MENU_ITEM_DISABLED,
className,
)}
{...props}