Skip to content

Commit 9303d74

Browse files
authored
Apply changes from code browser
Apply changes from code browser
1 parent 122fa2f commit 9303d74

File tree

1 file changed

+61
-61
lines changed
  • apps/code/src/renderer/features/command/components

1 file changed

+61
-61
lines changed
Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,161 +1,161 @@
1-
import {
2-
CommandDialog,
3-
CommandEmpty,
4-
CommandGroup,
5-
CommandInput,
6-
CommandItem,
7-
CommandList,
8-
CommandRoot,
9-
} from "cmdk";
1+
import { Command as CmdkCommand } from "cmdk";
102
import React from "react";
113
import "./Command.css";
124

13-
type CommandRootProps = React.ComponentPropsWithoutRef<typeof CommandRoot> & {
5+
interface CommandRootProps extends React.ComponentProps<typeof CmdkCommand> {
146
className?: string;
15-
};
7+
}
168

17-
const CommandRootWrapper = React.forwardRef<
18-
React.ElementRef<typeof CommandRoot>,
9+
const CommandRoot = React.forwardRef<
10+
React.ElementRef<typeof CmdkCommand>,
1911
CommandRootProps
2012
>(({ className, ...props }, ref) => {
2113
return (
22-
<CommandRoot
14+
<CmdkCommand
2315
ref={ref}
2416
className={`flex h-full w-full flex-col overflow-hidden ${className || ""}`}
2517
{...props}
2618
/>
2719
);
2820
});
2921

30-
CommandRootWrapper.displayName = "CommandRoot";
22+
CommandRoot.displayName = "CommandRoot";
3123

32-
type CommandInputProps = React.ComponentPropsWithoutRef<typeof CommandInput> & {
24+
interface CommandInputProps
25+
extends React.ComponentProps<typeof CmdkCommand.Input> {
3326
className?: string;
34-
};
27+
}
3528

36-
const CommandInputWrapper = React.forwardRef<
37-
React.ElementRef<typeof CommandInput>,
29+
const CommandInput = React.forwardRef<
30+
React.ElementRef<typeof CmdkCommand.Input>,
3831
CommandInputProps
3932
>(({ className, ...props }, ref) => {
40-
return <CommandInput ref={ref} className={className} {...props} />;
33+
return <CmdkCommand.Input ref={ref} className={className} {...props} />;
4134
});
4235

43-
CommandInputWrapper.displayName = "CommandInput";
36+
CommandInput.displayName = "CommandInput";
4437

45-
type CommandListProps = React.ComponentPropsWithoutRef<typeof CommandList> & {
38+
interface CommandListProps
39+
extends React.ComponentProps<typeof CmdkCommand.List> {
4640
className?: string;
47-
};
41+
}
4842

49-
const CommandListWrapper = React.forwardRef<
50-
React.ElementRef<typeof CommandList>,
43+
const CommandList = React.forwardRef<
44+
React.ElementRef<typeof CmdkCommand.List>,
5145
CommandListProps
5246
>(({ className, ...props }, ref) => {
5347
return (
54-
<CommandList
48+
<CmdkCommand.List
5549
ref={ref}
5650
className={`overflow-y-auto ${className || ""}`}
5751
{...props}
5852
/>
5953
);
6054
});
6155

62-
CommandListWrapper.displayName = "CommandList";
56+
CommandList.displayName = "CommandList";
6357

64-
type CommandItemProps = React.ComponentPropsWithoutRef<typeof CommandItem> & {
58+
interface CommandItemProps
59+
extends React.ComponentProps<typeof CmdkCommand.Item> {
6560
className?: string;
66-
};
61+
}
6762

68-
const CommandItemWrapper = React.forwardRef<
69-
React.ElementRef<typeof CommandItem>,
63+
const CommandItem = React.forwardRef<
64+
React.ElementRef<typeof CmdkCommand.Item>,
7065
CommandItemProps
7166
>(({ className, ...props }, ref) => {
7267
return (
73-
<CommandItem
68+
<CmdkCommand.Item
7469
ref={ref}
7570
className={`relative flex cursor-pointer select-none items-center px-3 py-2 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent-3 data-[disabled=true]:opacity-50 ${className || ""}`}
7671
{...props}
7772
/>
7873
);
7974
});
8075

81-
CommandItemWrapper.displayName = "CommandItem";
76+
CommandItem.displayName = "CommandItem";
8277

83-
type CommandGroupProps = React.ComponentPropsWithoutRef<typeof CommandGroup> & {
78+
interface CommandGroupProps
79+
extends React.ComponentProps<typeof CmdkCommand.Group> {
8480
className?: string;
8581
heading?: string;
86-
};
82+
}
8783

88-
const CommandGroupWrapper = React.forwardRef<
89-
React.ElementRef<typeof CommandGroup>,
84+
const CommandGroup = React.forwardRef<
85+
React.ElementRef<typeof CmdkCommand.Group>,
9086
CommandGroupProps
9187
>(({ className, heading, children, ...props }, ref) => {
9288
return (
93-
<CommandGroup ref={ref} className={`p-1 ${className || ""}`} {...props}>
89+
<CmdkCommand.Group
90+
ref={ref}
91+
className={`p-1 ${className || ""}`}
92+
{...props}
93+
>
9494
{heading && (
9595
<div className="px-2 py-1.5 text-gray-11" style={{ fontSize: "14px" }}>
9696
{heading}
9797
</div>
9898
)}
9999
{children}
100-
</CommandGroup>
100+
</CmdkCommand.Group>
101101
);
102102
});
103103

104-
CommandGroupWrapper.displayName = "CommandGroup";
104+
CommandGroup.displayName = "CommandGroup";
105105

106-
type CommandEmptyProps = React.ComponentPropsWithoutRef<typeof CommandEmpty> & {
106+
interface CommandEmptyProps
107+
extends React.ComponentProps<typeof CmdkCommand.Empty> {
107108
className?: string;
108-
};
109+
}
109110

110-
const CommandEmptyWrapper = React.forwardRef<
111-
React.ElementRef<typeof CommandEmpty>,
111+
const CommandEmpty = React.forwardRef<
112+
React.ElementRef<typeof CmdkCommand.Empty>,
112113
CommandEmptyProps
113114
>(({ className, ...props }, ref) => {
114115
return (
115-
<CommandEmpty
116+
<CmdkCommand.Empty
116117
ref={ref}
117118
className={`py-6 text-center text-sm ${className || ""}`}
118119
{...props}
119120
/>
120121
);
121122
});
122123

123-
CommandEmptyWrapper.displayName = "CommandEmpty";
124+
CommandEmpty.displayName = "CommandEmpty";
124125

125-
type CommandDialogProps = React.ComponentPropsWithoutRef<
126-
typeof CommandDialog
127-
> & {
126+
interface CommandDialogProps
127+
extends React.ComponentProps<typeof CmdkCommand.Dialog> {
128128
className?: string;
129129
contentClassName?: string;
130-
};
130+
}
131131

132-
const CommandDialogWrapper = ({
132+
const CommandDialog = ({
133133
className,
134134
contentClassName,
135135
children,
136136
...props
137137
}: CommandDialogProps) => {
138138
return (
139-
<CommandDialog
139+
<CmdkCommand.Dialog
140140
label="Command menu"
141141
className={className}
142142
contentClassName={`command-dialog-content ${contentClassName || ""}`}
143143
overlayClassName="command-dialog-overlay"
144144
{...props}
145145
>
146146
{children}
147-
</CommandDialog>
147+
</CmdkCommand.Dialog>
148148
);
149149
};
150150

151-
CommandDialogWrapper.displayName = "CommandDialog";
151+
CommandDialog.displayName = "CommandDialog";
152152

153153
export const Command = {
154-
Root: CommandRootWrapper,
155-
Dialog: CommandDialogWrapper,
156-
Input: CommandInputWrapper,
157-
List: CommandListWrapper,
158-
Item: CommandItemWrapper,
159-
Group: CommandGroupWrapper,
160-
Empty: CommandEmptyWrapper,
154+
Root: CommandRoot,
155+
Dialog: CommandDialog,
156+
Input: CommandInput,
157+
List: CommandList,
158+
Item: CommandItem,
159+
Group: CommandGroup,
160+
Empty: CommandEmpty,
161161
};

0 commit comments

Comments
 (0)