@@ -10,6 +10,7 @@ import {
10
10
IconFileText ,
11
11
IconFolder ,
12
12
IconSearch ,
13
+ IconSelect ,
13
14
IconSettings ,
14
15
} from '@tabler/icons-react' ;
15
16
import React , { useState } from 'react' ;
@@ -135,36 +136,42 @@ const basicCommands = [
135
136
label : 'Copy' ,
136
137
description : 'Copy selected text' ,
137
138
hotkeys : 'Ctrl+C' ,
139
+ icon : < IconCopy /> ,
138
140
} ,
139
141
{
140
142
key : 'paste' ,
141
143
label : 'Paste' ,
142
144
description : 'Paste from clipboard' ,
143
145
hotkeys : 'Ctrl+V' ,
146
+ icon : < IconClipboard /> ,
144
147
} ,
145
148
{
146
149
key : 'cut' ,
147
150
label : 'Cut' ,
148
151
description : 'Cut selected text' ,
149
152
hotkeys : 'Ctrl+X' ,
153
+ icon : < IconCut /> ,
150
154
} ,
151
155
{
152
156
key : 'undo' ,
153
157
label : 'Undo' ,
154
158
description : 'Undo last action' ,
155
159
hotkeys : 'Ctrl+Z' ,
160
+ icon : < IconArrowBack /> ,
156
161
} ,
157
162
{
158
163
key : 'redo' ,
159
164
label : 'Redo' ,
160
165
description : 'Redo last action' ,
161
166
hotkeys : 'Ctrl+Y' ,
167
+ icon : < IconArrowForward /> ,
162
168
} ,
163
169
{
164
170
key : 'select-all' ,
165
171
label : 'Select All' ,
166
172
description : 'Select all text' ,
167
173
hotkeys : 'Ctrl+A' ,
174
+ icon : < IconSelect /> ,
168
175
} ,
169
176
] ;
170
177
@@ -291,6 +298,7 @@ export const Default: StoryFn<CubeCommandMenuProps<any>> = (args) => (
291
298
key = { command . key }
292
299
description = { command . description }
293
300
hotkeys = { command . hotkeys }
301
+ icon = { command . icon }
294
302
>
295
303
{ command . label }
296
304
</ CommandMenu . Item >
@@ -349,6 +357,7 @@ export const WithMenuTrigger: StoryFn<CubeCommandMenuProps<any>> = (args) => (
349
357
key = { command . key }
350
358
description = { command . description }
351
359
hotkeys = { command . hotkeys }
360
+ icon = { command . icon }
352
361
>
353
362
{ command . label }
354
363
</ CommandMenu . Item >
@@ -411,6 +420,7 @@ export const ControlledSearch: StoryFn<CubeCommandMenuProps<any>> = (args) => {
411
420
key = { command . key }
412
421
description = { command . description }
413
422
hotkeys = { command . hotkeys }
423
+ icon = { command . icon }
414
424
>
415
425
{ command . label }
416
426
</ CommandMenu . Item >
@@ -432,6 +442,7 @@ export const LoadingState: StoryFn<CubeCommandMenuProps<any>> = (args) => (
432
442
key = { command . key }
433
443
description = { command . description }
434
444
hotkeys = { command . hotkeys }
445
+ icon = { command . icon }
435
446
>
436
447
{ command . label }
437
448
</ CommandMenu . Item >
@@ -469,6 +480,7 @@ export const CustomFilter: StoryFn<CubeCommandMenuProps<any>> = (args) => (
469
480
key = { command . key }
470
481
description = { command . description }
471
482
hotkeys = { command . hotkeys }
483
+ icon = { command . icon }
472
484
>
473
485
{ command . label }
474
486
</ CommandMenu . Item >
@@ -516,6 +528,7 @@ export const ForceMountItems: StoryFn<CubeCommandMenuProps<any>> = (args) => (
516
528
key = { command . key }
517
529
description = { command . description }
518
530
hotkeys = { command . hotkeys }
531
+ icon = { command . icon }
519
532
>
520
533
{ command . label }
521
534
</ CommandMenu . Item >
@@ -560,6 +573,7 @@ export const MultipleSelection: StoryFn<CubeCommandMenuProps<any>> = (args) => {
560
573
key = { command . key }
561
574
description = { command . description }
562
575
hotkeys = { command . hotkeys }
576
+ icon = { command . icon }
563
577
>
564
578
{ command . label }
565
579
</ CommandMenu . Item >
@@ -595,6 +609,7 @@ export const SingleSelection: StoryFn<CubeCommandMenuProps<any>> = (args) => {
595
609
key = { command . key }
596
610
description = { command . description }
597
611
hotkeys = { command . hotkeys }
612
+ icon = { command . icon }
598
613
>
599
614
{ command . label }
600
615
</ CommandMenu . Item >
@@ -627,6 +642,7 @@ export const CustomStyling: StoryFn<CubeCommandMenuProps<any>> = (args) => (
627
642
key = { command . key }
628
643
description = { command . description }
629
644
hotkeys = { command . hotkeys }
645
+ icon = { command . icon }
630
646
>
631
647
{ command . label }
632
648
</ CommandMenu . Item >
@@ -688,6 +704,7 @@ export const HotkeyTesting: StoryFn<CubeCommandMenuProps<any>> = (args) => {
688
704
key = { command . key }
689
705
description = { command . description }
690
706
hotkeys = { command . hotkeys }
707
+ icon = { command . icon }
691
708
>
692
709
{ command . label }
693
710
</ CommandMenu . Item >
@@ -709,6 +726,7 @@ export const MediumSize: StoryFn<CubeCommandMenuProps<any>> = (args) => (
709
726
key = { command . key }
710
727
description = { command . description }
711
728
hotkeys = { command . hotkeys }
729
+ icon = { command . icon }
712
730
>
713
731
{ command . label }
714
732
</ CommandMenu . Item >
@@ -731,6 +749,7 @@ export const WithDialog: StoryFn<CubeCommandMenuProps<any>> = (args) => (
731
749
key = { command . key }
732
750
description = { command . description }
733
751
hotkeys = { command . hotkeys }
752
+ icon = { command . icon }
734
753
>
735
754
{ command . label }
736
755
</ CommandMenu . Item >
@@ -781,6 +800,7 @@ function CommandMenuDialogContent({
781
800
key = { command . key }
782
801
description = { command . description }
783
802
hotkeys = { command . hotkeys }
803
+ icon = { command . icon }
784
804
>
785
805
{ command . label }
786
806
</ CommandMenu . Item >
@@ -825,106 +845,3 @@ WithDialogContainer.play = async ({ canvasElement }) => {
825
845
canvas . getByPlaceholderText ( 'Search commands...' ) ;
826
846
} ) ;
827
847
} ;
828
-
829
- export const WithIcons : StoryFn < CubeCommandMenuProps < any > > = ( args ) => (
830
- < CommandMenu { ...args } >
831
- < Menu . Section title = "File Operations" >
832
- < CommandMenu . Item
833
- key = "new-file"
834
- icon = { < IconFile /> }
835
- description = "Create a new file"
836
- hotkeys = "Ctrl+N"
837
- >
838
- New File
839
- </ CommandMenu . Item >
840
- < CommandMenu . Item
841
- key = "open-file"
842
- icon = { < IconFolder /> }
843
- description = "Open an existing file"
844
- hotkeys = "Ctrl+O"
845
- >
846
- Open File
847
- </ CommandMenu . Item >
848
- < CommandMenu . Item
849
- key = "save-file"
850
- icon = { < IconDeviceFloppy /> }
851
- description = "Save current file"
852
- hotkeys = "Ctrl+S"
853
- >
854
- Save File
855
- </ CommandMenu . Item >
856
- </ Menu . Section >
857
-
858
- < Menu . Section title = "Edit Operations" >
859
- < CommandMenu . Item
860
- key = "copy"
861
- icon = { < IconCopy /> }
862
- description = "Copy selected text"
863
- hotkeys = "Ctrl+C"
864
- keywords = { [ 'duplicate' , 'clone' ] }
865
- >
866
- Copy
867
- </ CommandMenu . Item >
868
- < CommandMenu . Item
869
- key = "paste"
870
- icon = { < IconClipboard /> }
871
- description = "Paste from clipboard"
872
- hotkeys = "Ctrl+V"
873
- keywords = { [ 'insert' ] }
874
- >
875
- Paste
876
- </ CommandMenu . Item >
877
- < CommandMenu . Item
878
- key = "cut"
879
- icon = { < IconCut /> }
880
- description = "Cut selected text"
881
- hotkeys = "Ctrl+X"
882
- >
883
- Cut
884
- </ CommandMenu . Item >
885
- < CommandMenu . Item
886
- key = "undo"
887
- icon = { < IconArrowBack /> }
888
- description = "Undo last action"
889
- hotkeys = "Ctrl+Z"
890
- >
891
- Undo
892
- </ CommandMenu . Item >
893
- < CommandMenu . Item
894
- key = "redo"
895
- icon = { < IconArrowForward /> }
896
- description = "Redo last action"
897
- hotkeys = "Ctrl+Y"
898
- >
899
- Redo
900
- </ CommandMenu . Item >
901
- </ Menu . Section >
902
-
903
- < Menu . Section title = "Tools" >
904
- < CommandMenu . Item
905
- key = "search"
906
- icon = { < IconSearch /> }
907
- description = "Search in files"
908
- hotkeys = "Ctrl+F"
909
- >
910
- Search
911
- </ CommandMenu . Item >
912
- < CommandMenu . Item
913
- key = "settings"
914
- icon = { < IconSettings /> }
915
- description = "Open settings"
916
- hotkeys = "Ctrl+."
917
- >
918
- Settings
919
- </ CommandMenu . Item >
920
- < CommandMenu . Item key = "documents" description = "View all documents" >
921
- Documents
922
- </ CommandMenu . Item >
923
- </ Menu . Section >
924
- </ CommandMenu >
925
- ) ;
926
-
927
- WithIcons . args = {
928
- searchPlaceholder : 'Search commands with icons...' ,
929
- autoFocus : true ,
930
- } ;
0 commit comments