@djangocfg/ui-core 2.1.381 → 2.1.383

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.
Files changed (78) hide show
  1. package/README.md +85 -21
  2. package/package.json +5 -12
  3. package/src/components/boundary/Boundary.tsx +204 -33
  4. package/src/components/boundary/README.md +249 -0
  5. package/src/components/boundary/index.ts +9 -2
  6. package/src/components/index.ts +9 -2
  7. package/src/components/select/combobox.tsx +47 -19
  8. package/src/hooks/audio/createSoundBus.ts +172 -0
  9. package/src/hooks/audio/index.ts +21 -0
  10. package/src/hooks/audio/useAudioPrefs.ts +91 -0
  11. package/src/hooks/audio/useNotificationSounds.ts +271 -0
  12. package/src/hooks/audio/useSoundEffect.ts +78 -0
  13. package/src/hooks/hotkey/formatHotkey.ts +96 -0
  14. package/src/hooks/hotkey/index.ts +10 -0
  15. package/src/hooks/hotkey/useHotkey.ts +106 -34
  16. package/src/hooks/hotkey/useHotkeyChord.ts +96 -0
  17. package/src/hooks/hotkey/useHotkeyHelp.ts +68 -0
  18. package/src/hooks/index.ts +1 -0
  19. package/src/components/boundary/boundary.story.tsx +0 -109
  20. package/src/components/data/avatar/avatar.story.tsx +0 -115
  21. package/src/components/data/badge/badge.story.tsx +0 -56
  22. package/src/components/data/calendar/calendar.story.tsx +0 -127
  23. package/src/components/data/carousel/carousel.story.tsx +0 -122
  24. package/src/components/data/progress/progress.story.tsx +0 -97
  25. package/src/components/data/table/table.story.tsx +0 -148
  26. package/src/components/data/toggle/toggle.story.tsx +0 -104
  27. package/src/components/data/toggle-group/toggle-group.story.tsx +0 -118
  28. package/src/components/feedback/alert/alert.story.tsx +0 -77
  29. package/src/components/feedback/empty/empty.story.tsx +0 -115
  30. package/src/components/feedback/preloader/preloader.story.tsx +0 -86
  31. package/src/components/feedback/spinner/spinner.story.tsx +0 -66
  32. package/src/components/forms/button/button.story.tsx +0 -116
  33. package/src/components/forms/button-download/button-download.story.tsx +0 -112
  34. package/src/components/forms/button-group/button-group.story.tsx +0 -79
  35. package/src/components/forms/checkbox/checkbox.story.tsx +0 -89
  36. package/src/components/forms/input/input.story.tsx +0 -77
  37. package/src/components/forms/input-group/input-group.story.tsx +0 -119
  38. package/src/components/forms/input-otp/input-otp.story.tsx +0 -105
  39. package/src/components/forms/label/label.story.tsx +0 -52
  40. package/src/components/forms/radio-group/radio-group.story.tsx +0 -113
  41. package/src/components/forms/slider/slider.story.tsx +0 -134
  42. package/src/components/forms/switch/switch.story.tsx +0 -98
  43. package/src/components/forms/textarea/textarea.story.tsx +0 -94
  44. package/src/components/layout/aspect-ratio/aspect-ratio.story.tsx +0 -94
  45. package/src/components/layout/card/card.story.tsx +0 -105
  46. package/src/components/layout/resizable/resizable.story.tsx +0 -119
  47. package/src/components/layout/scroll-area/scroll-area.story.tsx +0 -172
  48. package/src/components/layout/separator/separator.story.tsx +0 -69
  49. package/src/components/layout/skeleton/skeleton.story.tsx +0 -101
  50. package/src/components/navigation/accordion/accordion.story.tsx +0 -110
  51. package/src/components/navigation/collapsible/collapsible.story.tsx +0 -133
  52. package/src/components/navigation/command/command.story.tsx +0 -121
  53. package/src/components/navigation/context-menu/context-menu.story.tsx +0 -125
  54. package/src/components/navigation/dropdown-menu/dropdown-menu.story.tsx +0 -208
  55. package/src/components/navigation/menubar/menubar.story.tsx +0 -152
  56. package/src/components/navigation/navigation-menu/navigation-menu.story.tsx +0 -154
  57. package/src/components/navigation/tabs/tabs.story.tsx +0 -98
  58. package/src/components/overlay/alert-dialog/alert-dialog.story.tsx +0 -104
  59. package/src/components/overlay/dialog/dialog.story.tsx +0 -212
  60. package/src/components/overlay/drawer/drawer.story.tsx +0 -359
  61. package/src/components/overlay/hover-card/hover-card.story.tsx +0 -102
  62. package/src/components/overlay/popover/popover.story.tsx +0 -127
  63. package/src/components/overlay/responsive-sheet/responsive-sheet.story.tsx +0 -117
  64. package/src/components/overlay/sheet/sheet.story.tsx +0 -148
  65. package/src/components/overlay/tooltip/tooltip.story.tsx +0 -139
  66. package/src/components/select/combobox-async.story.tsx +0 -215
  67. package/src/components/select/combobox.story.tsx +0 -226
  68. package/src/components/select/country-select.story.tsx +0 -261
  69. package/src/components/select/language-select.story.tsx +0 -264
  70. package/src/components/select/multi-select.story.tsx +0 -122
  71. package/src/components/select/select.story.tsx +0 -112
  72. package/src/components/specialized/copy/copy.story.tsx +0 -77
  73. package/src/components/specialized/flag/flag.story.tsx +0 -82
  74. package/src/components/specialized/image-with-fallback/image-with-fallback.story.tsx +0 -105
  75. package/src/components/specialized/kbd/kbd.story.tsx +0 -113
  76. package/src/lib/dialog-service/dialog-service.story.tsx +0 -263
  77. package/src/stories/index.ts +0 -28
  78. package/src/styles/theme/theme-tokens.story.tsx +0 -157
@@ -1,69 +0,0 @@
1
- import { defineStory } from '@djangocfg/playground';
2
- import { Separator } from '.';
3
-
4
- export default defineStory({
5
- title: 'Core/Separator',
6
- component: Separator,
7
- description: 'Visual divider between content sections.',
8
- });
9
-
10
- export const Default = () => (
11
- <div>
12
- <div className="space-y-1">
13
- <h4 className="text-sm font-medium leading-none">Radix Primitives</h4>
14
- <p className="text-sm text-muted-foreground">
15
- An open-source UI component library.
16
- </p>
17
- </div>
18
- <Separator className="my-4" />
19
- <div className="flex h-5 items-center space-x-4 text-sm">
20
- <div>Blog</div>
21
- <Separator orientation="vertical" />
22
- <div>Docs</div>
23
- <Separator orientation="vertical" />
24
- <div>Source</div>
25
- </div>
26
- </div>
27
- );
28
-
29
- export const Horizontal = () => (
30
- <div className="max-w-md">
31
- <p className="text-sm text-muted-foreground">First section</p>
32
- <Separator className="my-4" />
33
- <p className="text-sm text-muted-foreground">Second section</p>
34
- <Separator className="my-4" />
35
- <p className="text-sm text-muted-foreground">Third section</p>
36
- </div>
37
- );
38
-
39
- export const Vertical = () => (
40
- <div className="flex h-5 items-center space-x-4 text-sm">
41
- <div>Home</div>
42
- <Separator orientation="vertical" />
43
- <div>About</div>
44
- <Separator orientation="vertical" />
45
- <div>Products</div>
46
- <Separator orientation="vertical" />
47
- <div>Contact</div>
48
- </div>
49
- );
50
-
51
- export const InCard = () => (
52
- <div className="rounded-lg border p-4 max-w-sm">
53
- <h4 className="font-medium">Card Title</h4>
54
- <Separator className="my-3" />
55
- <p className="text-sm text-muted-foreground">
56
- This is some card content below the separator.
57
- </p>
58
- </div>
59
- );
60
-
61
- export const WithLabels = () => (
62
- <div className="max-w-md">
63
- <div className="flex items-center gap-4">
64
- <Separator className="flex-1" />
65
- <span className="text-sm text-muted-foreground">OR</span>
66
- <Separator className="flex-1" />
67
- </div>
68
- </div>
69
- );
@@ -1,101 +0,0 @@
1
- import { defineStory } from '@djangocfg/playground';
2
- import { Skeleton } from '.';
3
-
4
- export default defineStory({
5
- title: 'Core/Skeleton',
6
- component: Skeleton,
7
- description: 'Loading placeholder for content.',
8
- });
9
-
10
- export const Default = () => (
11
- <div className="flex items-center space-x-4">
12
- <Skeleton className="h-12 w-12 rounded-full" />
13
- <div className="space-y-2">
14
- <Skeleton className="h-4 w-[250px]" />
15
- <Skeleton className="h-4 w-[200px]" />
16
- </div>
17
- </div>
18
- );
19
-
20
- export const Card = () => (
21
- <div className="flex flex-col space-y-3">
22
- <Skeleton className="h-[125px] w-[250px] rounded-xl" />
23
- <div className="space-y-2">
24
- <Skeleton className="h-4 w-[250px]" />
25
- <Skeleton className="h-4 w-[200px]" />
26
- </div>
27
- </div>
28
- );
29
-
30
- export const Table = () => (
31
- <div className="space-y-2">
32
- <div className="flex gap-4">
33
- <Skeleton className="h-8 w-[100px]" />
34
- <Skeleton className="h-8 w-[150px]" />
35
- <Skeleton className="h-8 w-[100px]" />
36
- <Skeleton className="h-8 w-[80px]" />
37
- </div>
38
- {[...Array(5)].map((_, i) => (
39
- <div key={i} className="flex gap-4">
40
- <Skeleton className="h-6 w-[100px]" />
41
- <Skeleton className="h-6 w-[150px]" />
42
- <Skeleton className="h-6 w-[100px]" />
43
- <Skeleton className="h-6 w-[80px]" />
44
- </div>
45
- ))}
46
- </div>
47
- );
48
-
49
- export const Profile = () => (
50
- <div className="flex items-start space-x-4">
51
- <Skeleton className="h-16 w-16 rounded-full" />
52
- <div className="space-y-2">
53
- <Skeleton className="h-5 w-[180px]" />
54
- <Skeleton className="h-4 w-[120px]" />
55
- <Skeleton className="h-4 w-[220px]" />
56
- </div>
57
- </div>
58
- );
59
-
60
- export const Article = () => (
61
- <div className="space-y-4 max-w-lg">
62
- <Skeleton className="h-8 w-3/4" />
63
- <Skeleton className="h-4 w-1/4" />
64
- <Skeleton className="h-[200px] w-full rounded-lg" />
65
- <div className="space-y-2">
66
- <Skeleton className="h-4 w-full" />
67
- <Skeleton className="h-4 w-full" />
68
- <Skeleton className="h-4 w-3/4" />
69
- </div>
70
- </div>
71
- );
72
-
73
- export const Grid = () => (
74
- <div className="grid grid-cols-3 gap-4">
75
- {[...Array(6)].map((_, i) => (
76
- <div key={i} className="space-y-2">
77
- <Skeleton className="h-[120px] w-full rounded-lg" />
78
- <Skeleton className="h-4 w-3/4" />
79
- <Skeleton className="h-4 w-1/2" />
80
- </div>
81
- ))}
82
- </div>
83
- );
84
-
85
- export const Form = () => (
86
- <div className="space-y-4 max-w-sm">
87
- <div className="space-y-2">
88
- <Skeleton className="h-4 w-20" />
89
- <Skeleton className="h-10 w-full" />
90
- </div>
91
- <div className="space-y-2">
92
- <Skeleton className="h-4 w-20" />
93
- <Skeleton className="h-10 w-full" />
94
- </div>
95
- <div className="space-y-2">
96
- <Skeleton className="h-4 w-20" />
97
- <Skeleton className="h-24 w-full" />
98
- </div>
99
- <Skeleton className="h-10 w-24" />
100
- </div>
101
- );
@@ -1,110 +0,0 @@
1
- import { defineStory } from '@djangocfg/playground';
2
- import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '.';
3
-
4
- export default defineStory({
5
- title: 'Core/Accordion',
6
- component: Accordion,
7
- description: 'Collapsible content sections.',
8
- });
9
-
10
- export const Default = () => (
11
- <Accordion type="single" collapsible className="w-full max-w-md">
12
- <AccordionItem value="item-1">
13
- <AccordionTrigger>Is it accessible?</AccordionTrigger>
14
- <AccordionContent>
15
- Yes. It adheres to the WAI-ARIA design pattern.
16
- </AccordionContent>
17
- </AccordionItem>
18
- <AccordionItem value="item-2">
19
- <AccordionTrigger>Is it styled?</AccordionTrigger>
20
- <AccordionContent>
21
- Yes. It comes with default styles that matches the other components.
22
- </AccordionContent>
23
- </AccordionItem>
24
- <AccordionItem value="item-3">
25
- <AccordionTrigger>Is it animated?</AccordionTrigger>
26
- <AccordionContent>
27
- Yes. It's animated by default, but you can disable it if you prefer.
28
- </AccordionContent>
29
- </AccordionItem>
30
- </Accordion>
31
- );
32
-
33
- export const Multiple = () => (
34
- <Accordion type="multiple" className="w-full max-w-md">
35
- <AccordionItem value="item-1">
36
- <AccordionTrigger>Section 1</AccordionTrigger>
37
- <AccordionContent>
38
- Content for section 1. Multiple sections can be open at the same time.
39
- </AccordionContent>
40
- </AccordionItem>
41
- <AccordionItem value="item-2">
42
- <AccordionTrigger>Section 2</AccordionTrigger>
43
- <AccordionContent>
44
- Content for section 2.
45
- </AccordionContent>
46
- </AccordionItem>
47
- <AccordionItem value="item-3">
48
- <AccordionTrigger>Section 3</AccordionTrigger>
49
- <AccordionContent>
50
- Content for section 3.
51
- </AccordionContent>
52
- </AccordionItem>
53
- </Accordion>
54
- );
55
-
56
- export const FAQ = () => (
57
- <Accordion type="single" collapsible className="w-full max-w-lg">
58
- <AccordionItem value="faq-1">
59
- <AccordionTrigger>What payment methods do you accept?</AccordionTrigger>
60
- <AccordionContent>
61
- We accept all major credit cards (Visa, MasterCard, American Express),
62
- PayPal, and bank transfers. All payments are processed securely.
63
- </AccordionContent>
64
- </AccordionItem>
65
- <AccordionItem value="faq-2">
66
- <AccordionTrigger>How long does shipping take?</AccordionTrigger>
67
- <AccordionContent>
68
- Standard shipping takes 5-7 business days. Express shipping is available
69
- for 2-3 business day delivery. International shipping times vary by location.
70
- </AccordionContent>
71
- </AccordionItem>
72
- <AccordionItem value="faq-3">
73
- <AccordionTrigger>What is your return policy?</AccordionTrigger>
74
- <AccordionContent>
75
- We offer a 30-day return policy for all unused items in original packaging.
76
- Please contact our support team to initiate a return.
77
- </AccordionContent>
78
- </AccordionItem>
79
- <AccordionItem value="faq-4">
80
- <AccordionTrigger>Do you offer international shipping?</AccordionTrigger>
81
- <AccordionContent>
82
- Yes, we ship to over 100 countries worldwide. Shipping costs and delivery
83
- times vary by destination. You can see exact costs at checkout.
84
- </AccordionContent>
85
- </AccordionItem>
86
- </Accordion>
87
- );
88
-
89
- export const WithDefaultOpen = () => (
90
- <Accordion type="single" defaultValue="item-2" className="w-full max-w-md">
91
- <AccordionItem value="item-1">
92
- <AccordionTrigger>First Item</AccordionTrigger>
93
- <AccordionContent>
94
- This item is closed by default.
95
- </AccordionContent>
96
- </AccordionItem>
97
- <AccordionItem value="item-2">
98
- <AccordionTrigger>Second Item (Default Open)</AccordionTrigger>
99
- <AccordionContent>
100
- This item is open by default.
101
- </AccordionContent>
102
- </AccordionItem>
103
- <AccordionItem value="item-3">
104
- <AccordionTrigger>Third Item</AccordionTrigger>
105
- <AccordionContent>
106
- This item is also closed by default.
107
- </AccordionContent>
108
- </AccordionItem>
109
- </Accordion>
110
- );
@@ -1,133 +0,0 @@
1
- import { useState } from 'react';
2
- import { defineStory } from '@djangocfg/playground';
3
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '.';
4
- import { Button } from '../../forms/button';
5
- import { ChevronsUpDown } from 'lucide-react';
6
-
7
- export default defineStory({
8
- title: 'Core/Collapsible',
9
- component: Collapsible,
10
- description: 'Expandable/collapsible content section.',
11
- });
12
-
13
- export const Default = () => {
14
- const [isOpen, setIsOpen] = useState(false);
15
-
16
- return (
17
- <Collapsible
18
- open={isOpen}
19
- onOpenChange={setIsOpen}
20
- className="w-[350px] space-y-2"
21
- >
22
- <div className="flex items-center justify-between space-x-4 px-4">
23
- <h4 className="text-sm font-semibold">
24
- @peduarte starred 3 repositories
25
- </h4>
26
- <CollapsibleTrigger asChild>
27
- <Button variant="ghost" size="sm" className="w-9 p-0">
28
- <ChevronsUpDown className="h-4 w-4" />
29
- <span className="sr-only">Toggle</span>
30
- </Button>
31
- </CollapsibleTrigger>
32
- </div>
33
- <div className="rounded-md border px-4 py-3 font-mono text-sm">
34
- @radix-ui/primitives
35
- </div>
36
- <CollapsibleContent className="space-y-2">
37
- <div className="rounded-md border px-4 py-3 font-mono text-sm">
38
- @radix-ui/colors
39
- </div>
40
- <div className="rounded-md border px-4 py-3 font-mono text-sm">
41
- @stitches/react
42
- </div>
43
- </CollapsibleContent>
44
- </Collapsible>
45
- );
46
- };
47
-
48
- export const OpenByDefault = () => {
49
- const [isOpen, setIsOpen] = useState(true);
50
-
51
- return (
52
- <Collapsible
53
- open={isOpen}
54
- onOpenChange={setIsOpen}
55
- className="w-[350px] space-y-2"
56
- >
57
- <div className="flex items-center justify-between space-x-4 px-4">
58
- <h4 className="text-sm font-semibold">Notifications</h4>
59
- <CollapsibleTrigger asChild>
60
- <Button variant="ghost" size="sm">
61
- {isOpen ? 'Hide' : 'Show'}
62
- </Button>
63
- </CollapsibleTrigger>
64
- </div>
65
- <CollapsibleContent className="space-y-2">
66
- <div className="rounded-md border px-4 py-3 text-sm">
67
- You have 3 new notifications
68
- </div>
69
- <div className="rounded-md border px-4 py-3 text-sm">
70
- Your order has been shipped
71
- </div>
72
- <div className="rounded-md border px-4 py-3 text-sm">
73
- New comment on your post
74
- </div>
75
- </CollapsibleContent>
76
- </Collapsible>
77
- );
78
- };
79
-
80
- export const Simple = () => (
81
- <Collapsible className="w-[350px]">
82
- <CollapsibleTrigger asChild>
83
- <Button variant="outline" className="w-full justify-between">
84
- Can I use this in my project?
85
- <ChevronsUpDown className="h-4 w-4" />
86
- </Button>
87
- </CollapsibleTrigger>
88
- <CollapsibleContent className="pt-2">
89
- <p className="text-sm text-muted-foreground px-1">
90
- Yes! This component is free to use in your personal and commercial projects.
91
- No attribution required.
92
- </p>
93
- </CollapsibleContent>
94
- </Collapsible>
95
- );
96
-
97
- export const Multiple = () => (
98
- <div className="w-[350px] space-y-2">
99
- <Collapsible>
100
- <CollapsibleTrigger asChild>
101
- <Button variant="ghost" className="w-full justify-between">
102
- Section 1
103
- <ChevronsUpDown className="h-4 w-4" />
104
- </Button>
105
- </CollapsibleTrigger>
106
- <CollapsibleContent className="px-4 py-2">
107
- Content for section 1
108
- </CollapsibleContent>
109
- </Collapsible>
110
- <Collapsible>
111
- <CollapsibleTrigger asChild>
112
- <Button variant="ghost" className="w-full justify-between">
113
- Section 2
114
- <ChevronsUpDown className="h-4 w-4" />
115
- </Button>
116
- </CollapsibleTrigger>
117
- <CollapsibleContent className="px-4 py-2">
118
- Content for section 2
119
- </CollapsibleContent>
120
- </Collapsible>
121
- <Collapsible>
122
- <CollapsibleTrigger asChild>
123
- <Button variant="ghost" className="w-full justify-between">
124
- Section 3
125
- <ChevronsUpDown className="h-4 w-4" />
126
- </Button>
127
- </CollapsibleTrigger>
128
- <CollapsibleContent className="px-4 py-2">
129
- Content for section 3
130
- </CollapsibleContent>
131
- </Collapsible>
132
- </div>
133
- );
@@ -1,121 +0,0 @@
1
- import { defineStory } from '@djangocfg/playground';
2
- import {
3
- Command,
4
- CommandDialog,
5
- CommandEmpty,
6
- CommandGroup,
7
- CommandInput,
8
- CommandItem,
9
- CommandList,
10
- CommandSeparator,
11
- CommandShortcut,
12
- } from '.';
13
- import { useState } from 'react';
14
- import { Button } from '../../forms/button';
15
- import { Calendar, Smile, Calculator, User, CreditCard, Settings } from 'lucide-react';
16
-
17
- export default defineStory({
18
- title: 'Core/Command',
19
- component: Command,
20
- description: 'Command palette for search and quick actions.',
21
- });
22
-
23
- export const Default = () => (
24
- <Command className="rounded-lg border shadow-md max-w-md">
25
- <CommandInput placeholder="Type a command or search..." />
26
- <CommandList>
27
- <CommandEmpty>No results found.</CommandEmpty>
28
- <CommandGroup heading="Suggestions">
29
- <CommandItem>
30
- <Calendar className="mr-2 h-4 w-4" />
31
- <span>Calendar</span>
32
- </CommandItem>
33
- <CommandItem>
34
- <Smile className="mr-2 h-4 w-4" />
35
- <span>Search Emoji</span>
36
- </CommandItem>
37
- <CommandItem>
38
- <Calculator className="mr-2 h-4 w-4" />
39
- <span>Calculator</span>
40
- </CommandItem>
41
- </CommandGroup>
42
- <CommandSeparator />
43
- <CommandGroup heading="Settings">
44
- <CommandItem>
45
- <User className="mr-2 h-4 w-4" />
46
- <span>Profile</span>
47
- <CommandShortcut>⌘P</CommandShortcut>
48
- </CommandItem>
49
- <CommandItem>
50
- <CreditCard className="mr-2 h-4 w-4" />
51
- <span>Billing</span>
52
- <CommandShortcut>⌘B</CommandShortcut>
53
- </CommandItem>
54
- <CommandItem>
55
- <Settings className="mr-2 h-4 w-4" />
56
- <span>Settings</span>
57
- <CommandShortcut>⌘S</CommandShortcut>
58
- </CommandItem>
59
- </CommandGroup>
60
- </CommandList>
61
- </Command>
62
- );
63
-
64
- export const Dialog = () => {
65
- const [open, setOpen] = useState(false);
66
-
67
- return (
68
- <>
69
- <Button onClick={() => setOpen(true)}>
70
- Open Command Palette
71
- </Button>
72
- <CommandDialog open={open} onOpenChange={setOpen}>
73
- <CommandInput placeholder="Type a command or search..." />
74
- <CommandList>
75
- <CommandEmpty>No results found.</CommandEmpty>
76
- <CommandGroup heading="Suggestions">
77
- <CommandItem onSelect={() => setOpen(false)}>
78
- <Calendar className="mr-2 h-4 w-4" />
79
- <span>Calendar</span>
80
- </CommandItem>
81
- <CommandItem onSelect={() => setOpen(false)}>
82
- <Smile className="mr-2 h-4 w-4" />
83
- <span>Search Emoji</span>
84
- </CommandItem>
85
- <CommandItem onSelect={() => setOpen(false)}>
86
- <Calculator className="mr-2 h-4 w-4" />
87
- <span>Calculator</span>
88
- </CommandItem>
89
- </CommandGroup>
90
- <CommandSeparator />
91
- <CommandGroup heading="Settings">
92
- <CommandItem onSelect={() => setOpen(false)}>
93
- <User className="mr-2 h-4 w-4" />
94
- <span>Profile</span>
95
- <CommandShortcut>⌘P</CommandShortcut>
96
- </CommandItem>
97
- <CommandItem onSelect={() => setOpen(false)}>
98
- <Settings className="mr-2 h-4 w-4" />
99
- <span>Settings</span>
100
- <CommandShortcut>⌘S</CommandShortcut>
101
- </CommandItem>
102
- </CommandGroup>
103
- </CommandList>
104
- </CommandDialog>
105
- </>
106
- );
107
- };
108
-
109
- export const Simple = () => (
110
- <Command className="rounded-lg border max-w-sm">
111
- <CommandInput placeholder="Search..." />
112
- <CommandList>
113
- <CommandEmpty>No results.</CommandEmpty>
114
- <CommandGroup>
115
- <CommandItem>Item 1</CommandItem>
116
- <CommandItem>Item 2</CommandItem>
117
- <CommandItem>Item 3</CommandItem>
118
- </CommandGroup>
119
- </CommandList>
120
- </Command>
121
- );
@@ -1,125 +0,0 @@
1
- import { useState } from 'react';
2
- import { defineStory } from '@djangocfg/playground';
3
- import {
4
- ContextMenu,
5
- ContextMenuTrigger,
6
- ContextMenuContent,
7
- ContextMenuItem,
8
- ContextMenuSeparator,
9
- ContextMenuShortcut,
10
- ContextMenuSub,
11
- ContextMenuSubTrigger,
12
- ContextMenuSubContent,
13
- ContextMenuCheckboxItem,
14
- ContextMenuRadioGroup,
15
- ContextMenuRadioItem,
16
- ContextMenuLabel,
17
- } from '.';
18
-
19
- export default defineStory({
20
- title: 'Core/ContextMenu',
21
- component: ContextMenu,
22
- description: 'Right-click context menu.',
23
- });
24
-
25
- export const Default = () => (
26
- <ContextMenu>
27
- <ContextMenuTrigger className="flex h-40 w-80 items-center justify-center rounded-md border border-dashed text-sm">
28
- Right click here
29
- </ContextMenuTrigger>
30
- <ContextMenuContent className="w-64">
31
- <ContextMenuItem>
32
- Back
33
- <ContextMenuShortcut>⌘[</ContextMenuShortcut>
34
- </ContextMenuItem>
35
- <ContextMenuItem disabled>
36
- Forward
37
- <ContextMenuShortcut>⌘]</ContextMenuShortcut>
38
- </ContextMenuItem>
39
- <ContextMenuItem>
40
- Reload
41
- <ContextMenuShortcut>⌘R</ContextMenuShortcut>
42
- </ContextMenuItem>
43
- <ContextMenuSeparator />
44
- <ContextMenuItem>
45
- Save Page As...
46
- <ContextMenuShortcut>⌘S</ContextMenuShortcut>
47
- </ContextMenuItem>
48
- <ContextMenuItem>Print...</ContextMenuItem>
49
- </ContextMenuContent>
50
- </ContextMenu>
51
- );
52
-
53
- export const WithSubMenu = () => (
54
- <ContextMenu>
55
- <ContextMenuTrigger className="flex h-40 w-80 items-center justify-center rounded-md border border-dashed text-sm">
56
- Right click here
57
- </ContextMenuTrigger>
58
- <ContextMenuContent className="w-64">
59
- <ContextMenuItem>New Tab</ContextMenuItem>
60
- <ContextMenuItem>New Window</ContextMenuItem>
61
- <ContextMenuSeparator />
62
- <ContextMenuSub>
63
- <ContextMenuSubTrigger>More Tools</ContextMenuSubTrigger>
64
- <ContextMenuSubContent className="w-48">
65
- <ContextMenuItem>Save Page As...</ContextMenuItem>
66
- <ContextMenuItem>Create Shortcut...</ContextMenuItem>
67
- <ContextMenuItem>Name Window...</ContextMenuItem>
68
- <ContextMenuSeparator />
69
- <ContextMenuItem>Developer Tools</ContextMenuItem>
70
- </ContextMenuSubContent>
71
- </ContextMenuSub>
72
- <ContextMenuSeparator />
73
- <ContextMenuItem>Settings</ContextMenuItem>
74
- </ContextMenuContent>
75
- </ContextMenu>
76
- );
77
-
78
- export const WithCheckboxes = () => {
79
- const [showBookmarks, setShowBookmarks] = useState(true);
80
- const [showFullUrls, setShowFullUrls] = useState(false);
81
-
82
- return (
83
- <ContextMenu>
84
- <ContextMenuTrigger className="flex h-40 w-80 items-center justify-center rounded-md border border-dashed text-sm">
85
- Right click here
86
- </ContextMenuTrigger>
87
- <ContextMenuContent className="w-64">
88
- <ContextMenuCheckboxItem
89
- checked={showBookmarks}
90
- onCheckedChange={setShowBookmarks}
91
- >
92
- Show Bookmarks Bar
93
- <ContextMenuShortcut>⌘⇧B</ContextMenuShortcut>
94
- </ContextMenuCheckboxItem>
95
- <ContextMenuCheckboxItem
96
- checked={showFullUrls}
97
- onCheckedChange={setShowFullUrls}
98
- >
99
- Show Full URLs
100
- </ContextMenuCheckboxItem>
101
- </ContextMenuContent>
102
- </ContextMenu>
103
- );
104
- };
105
-
106
- export const WithRadioGroup = () => {
107
- const [person, setPerson] = useState('pedro');
108
-
109
- return (
110
- <ContextMenu>
111
- <ContextMenuTrigger className="flex h-40 w-80 items-center justify-center rounded-md border border-dashed text-sm">
112
- Right click here
113
- </ContextMenuTrigger>
114
- <ContextMenuContent className="w-64">
115
- <ContextMenuLabel>People</ContextMenuLabel>
116
- <ContextMenuSeparator />
117
- <ContextMenuRadioGroup value={person} onValueChange={setPerson}>
118
- <ContextMenuRadioItem value="pedro">Pedro Duarte</ContextMenuRadioItem>
119
- <ContextMenuRadioItem value="colm">Colm Tuite</ContextMenuRadioItem>
120
- <ContextMenuRadioItem value="jamie">Jamie Kyle</ContextMenuRadioItem>
121
- </ContextMenuRadioGroup>
122
- </ContextMenuContent>
123
- </ContextMenu>
124
- );
125
- };