@hanzo/ui 4.5.4 → 4.7.0

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 (203) hide show
  1. package/README.md +229 -0
  2. package/bin/create-registry.js +1 -1
  3. package/bin/test-mcp.sh +1 -1
  4. package/bin/update-registry.js +2 -2
  5. package/dist/index.d.mts +16 -0
  6. package/dist/index.d.ts +16 -0
  7. package/dist/index.js +9458 -0
  8. package/dist/index.mjs +9449 -0
  9. package/dist/lib/utils.d.mts +2 -0
  10. package/dist/lib/utils.d.ts +2 -0
  11. package/dist/lib/utils.js +47 -0
  12. package/dist/lib/utils.mjs +28 -0
  13. package/dist/src/utils.d.mts +7 -0
  14. package/dist/src/utils.d.ts +7 -0
  15. package/dist/src/utils.js +47 -0
  16. package/dist/src/utils.mjs +28 -0
  17. package/dist/tailwind/index.d.mts +2 -0
  18. package/dist/tailwind/index.d.ts +2 -0
  19. package/dist/tailwind/index.js +2048 -0
  20. package/dist/tailwind/index.mjs +2017 -0
  21. package/dist/types/index.d.mts +12 -0
  22. package/dist/types/index.d.ts +12 -0
  23. package/dist/types/index.js +79 -0
  24. package/dist/types/index.mjs +56 -0
  25. package/package.json +170 -23
  26. package/style/theme-provider.tsx +1 -1
  27. package/MCP-INSTRUCTIONS.md +0 -73
  28. package/README-MCP.md +0 -175
  29. package/blocks/components/accordian-block.tsx +0 -48
  30. package/blocks/components/block-component-props.ts +0 -11
  31. package/blocks/components/bullet-cards-block.tsx +0 -46
  32. package/blocks/components/card-block/index.tsx +0 -171
  33. package/blocks/components/card-block/link-out-button.tsx +0 -20
  34. package/blocks/components/card-block/util.ts +0 -28
  35. package/blocks/components/carte-blanche-block/index.tsx +0 -127
  36. package/blocks/components/carte-blanche-block/variant-content-left.tsx +0 -49
  37. package/blocks/components/content.tsx +0 -70
  38. package/blocks/components/cta-block.tsx +0 -115
  39. package/blocks/components/enh-heading-block.tsx +0 -204
  40. package/blocks/components/grid-block/grid-block-mutator.ts +0 -12
  41. package/blocks/components/grid-block/index.tsx +0 -83
  42. package/blocks/components/grid-block/mutator-registry.ts +0 -10
  43. package/blocks/components/grid-block/table-borders.mutator.ts +0 -47
  44. package/blocks/components/group-block.tsx +0 -83
  45. package/blocks/components/heading-block.tsx +0 -88
  46. package/blocks/components/image-block.tsx +0 -111
  47. package/blocks/components/index.ts +0 -30
  48. package/blocks/components/screenful-block/content.tsx +0 -123
  49. package/blocks/components/screenful-block/index.tsx +0 -107
  50. package/blocks/components/screenful-block/poster-background.tsx +0 -34
  51. package/blocks/components/screenful-block/video-background.tsx +0 -45
  52. package/blocks/components/space-block.tsx +0 -66
  53. package/blocks/components/video-block.tsx +0 -138
  54. package/blocks/def/accordian-block.ts +0 -14
  55. package/blocks/def/block.ts +0 -7
  56. package/blocks/def/bullet-cards-block.ts +0 -22
  57. package/blocks/def/card-block.ts +0 -22
  58. package/blocks/def/carte-blanche-block.ts +0 -21
  59. package/blocks/def/cta-block.ts +0 -19
  60. package/blocks/def/element-block.ts +0 -11
  61. package/blocks/def/enh-heading-block.ts +0 -44
  62. package/blocks/def/grid-block.ts +0 -16
  63. package/blocks/def/group-block.ts +0 -11
  64. package/blocks/def/heading-block.ts +0 -15
  65. package/blocks/def/image-block.ts +0 -31
  66. package/blocks/def/index.ts +0 -35
  67. package/blocks/def/screenful-block.ts +0 -54
  68. package/blocks/def/space-block.ts +0 -64
  69. package/blocks/def/video-block.ts +0 -9
  70. package/blocks/index.ts +0 -2
  71. package/dist/mcp/enhanced-server.d.ts +0 -29
  72. package/dist/mcp/enhanced-server.js +0 -1128
  73. package/dist/mcp/index.d.ts +0 -28
  74. package/dist/mcp/index.js +0 -436
  75. package/dist/registry/api.d.ts +0 -37
  76. package/dist/registry/api.js +0 -129
  77. package/dist/registry/index.d.ts +0 -353
  78. package/dist/registry/index.js +0 -45
  79. package/environment.d.ts +0 -6
  80. package/primitives/accordion.tsx +0 -66
  81. package/primitives/action-button.tsx +0 -42
  82. package/primitives/apply-typography.tsx +0 -55
  83. package/primitives/aspect-ratio.tsx +0 -5
  84. package/primitives/avatar.tsx +0 -49
  85. package/primitives/badge.tsx +0 -36
  86. package/primitives/breadcrumb.tsx +0 -115
  87. package/primitives/breakpoint-indicator.tsx +0 -19
  88. package/primitives/button.tsx +0 -85
  89. package/primitives/calendar.tsx +0 -72
  90. package/primitives/card.tsx +0 -83
  91. package/primitives/carousel.tsx +0 -237
  92. package/primitives/checkbox.tsx +0 -32
  93. package/primitives/combobox.tsx +0 -239
  94. package/primitives/command.tsx +0 -157
  95. package/primitives/context-menu.tsx +0 -200
  96. package/primitives/dialog-video-controller.tsx +0 -38
  97. package/primitives/dialog.tsx +0 -157
  98. package/primitives/drawer.tsx +0 -138
  99. package/primitives/form.tsx +0 -178
  100. package/primitives/icons/github.tsx +0 -14
  101. package/primitives/icons/index.ts +0 -18
  102. package/primitives/icons/youtube-logo.tsx +0 -59
  103. package/primitives/index-common.ts +0 -224
  104. package/primitives/index-next.ts +0 -2
  105. package/primitives/input-otp.tsx +0 -65
  106. package/primitives/input.tsx +0 -30
  107. package/primitives/label.tsx +0 -28
  108. package/primitives/list-adaptor.ts +0 -12
  109. package/primitives/list-box.tsx +0 -74
  110. package/primitives/loading-spinner.tsx +0 -33
  111. package/primitives/navigation-menu.tsx +0 -147
  112. package/primitives/next/image.tsx +0 -90
  113. package/primitives/next/index.ts +0 -7
  114. package/primitives/next/inline-icon.tsx +0 -36
  115. package/primitives/next/link-element.tsx +0 -109
  116. package/primitives/next/mdx-link.tsx +0 -22
  117. package/primitives/next/media-stack.tsx +0 -69
  118. package/primitives/next/nav-items.tsx +0 -45
  119. package/primitives/next/youtube-embed.tsx +0 -83
  120. package/primitives/popover.tsx +0 -37
  121. package/primitives/progress.tsx +0 -27
  122. package/primitives/radio-group.tsx +0 -56
  123. package/primitives/scroll-area.tsx +0 -47
  124. package/primitives/select.tsx +0 -169
  125. package/primitives/separator.tsx +0 -29
  126. package/primitives/sheet.tsx +0 -178
  127. package/primitives/skeleton.tsx +0 -20
  128. package/primitives/slider.tsx +0 -72
  129. package/primitives/sonner.tsx +0 -35
  130. package/primitives/step-indicator.tsx +0 -69
  131. package/primitives/switch.tsx +0 -35
  132. package/primitives/table.tsx +0 -117
  133. package/primitives/tabs.tsx +0 -60
  134. package/primitives/text-area.tsx +0 -26
  135. package/primitives/toggle-group.tsx +0 -63
  136. package/primitives/toggle.tsx +0 -73
  137. package/primitives/tooltip.tsx +0 -48
  138. package/primitives/video-player.tsx +0 -23
  139. package/public/r/accordion.json +0 -11
  140. package/public/r/alert.json +0 -11
  141. package/public/r/avatar.json +0 -11
  142. package/public/r/badge.json +0 -11
  143. package/public/r/button.json +0 -11
  144. package/public/r/card.json +0 -11
  145. package/public/r/checkbox.json +0 -11
  146. package/public/r/default.json +0 -6
  147. package/public/r/dialog.json +0 -11
  148. package/public/r/input.json +0 -11
  149. package/public/r/label.json +0 -11
  150. package/public/r/new-york.json +0 -6
  151. package/public/r/popover.json +0 -11
  152. package/public/r/select.json +0 -11
  153. package/public/r/table.json +0 -11
  154. package/public/r/tabs.json +0 -11
  155. package/public/r/toast.json +0 -11
  156. package/registry.json +0 -184
  157. package/src/mcp/README.md +0 -141
  158. package/src/mcp/enhanced-server.ts +0 -1208
  159. package/src/mcp/index.ts +0 -518
  160. package/src/mcp/package.json +0 -10
  161. package/src/registry/api.ts +0 -164
  162. package/src/registry/index.ts +0 -60
  163. package/src/registry/package.json +0 -10
  164. package/tailwind/colors.tailwind.js +0 -53
  165. package/tailwind/fontFamily.tailwind.ts +0 -7
  166. package/tailwind/fontSize.tailwind.ts +0 -13
  167. package/tailwind/index.ts +0 -7
  168. package/tailwind/safelist.tailwind.js +0 -26
  169. package/tailwind/screens.tailwind.js +0 -8
  170. package/tailwind/spacing.tailwind.js +0 -65
  171. package/tailwind/tailwind.config.hanzo-preset.d.ts +0 -5
  172. package/tailwind/tailwind.config.hanzo-preset.js +0 -915
  173. package/tailwind/tw-font-desc.ts +0 -15
  174. package/tailwind/typo-plugin/get-plugin-styles.js +0 -679
  175. package/tailwind/typo-plugin/index.d.ts +0 -9
  176. package/tailwind/typo-plugin/index.js +0 -141
  177. package/tailwind/typo-plugin/utils.js +0 -60
  178. package/tailwind/typography-test.mdx +0 -35
  179. package/tailwind/z-index.tailwind.js +0 -71
  180. package/test/test-registry.js +0 -73
  181. package/tsconfig.json +0 -22
  182. package/types/animation-def.ts +0 -3
  183. package/types/breakpoints.ts +0 -11
  184. package/types/bullet-item.ts +0 -10
  185. package/types/button-def.ts +0 -39
  186. package/types/dimensions.ts +0 -8
  187. package/types/grid-def.ts +0 -56
  188. package/types/image-def.ts +0 -32
  189. package/types/index.ts +0 -29
  190. package/types/link-def.ts +0 -56
  191. package/types/media-stack-def.ts +0 -31
  192. package/types/t-shirt-size.ts +0 -5
  193. package/types/tshirt-dimensions.ts +0 -20
  194. package/types/video-def.ts +0 -25
  195. package/util/format-and-abbreviate-as-currency.ts +0 -125
  196. package/util/format-to-max-char.ts +0 -68
  197. package/util/index-client.ts +0 -3
  198. package/util/index.ts +0 -78
  199. package/util/number-abbreviate.ts +0 -49
  200. package/util/specifier.ts +0 -43
  201. package/util/spread-to-transform.ts +0 -24
  202. package/util/step-animation.ts +0 -90
  203. package/util/two-way-map.ts +0 -19
@@ -1,239 +0,0 @@
1
- 'use client'
2
- import React, { useState } from 'react'
3
-
4
- import { Check, ChevronDown } from 'lucide-react'
5
-
6
- import { cn } from '../util'
7
- import Button from './button'
8
- import {
9
- Command,
10
- CommandEmpty,
11
- CommandGroup,
12
- CommandInput,
13
- CommandItem,
14
- CommandList,
15
- } from './command'
16
-
17
- import {
18
- Popover,
19
- PopoverContent,
20
- PopoverTrigger,
21
- } from './popover'
22
-
23
- import type ListAdaptor from './list-adaptor'
24
-
25
- const DEFAULT_IMAGE_SIZE = 32
26
-
27
- interface ComboboxTriggerProps<T> {
28
- current: T | null
29
- currentLabel: string | null
30
- imageUrl: string | null
31
- placeholder?: string
32
- buttonClx?: string
33
- imageClx?: string
34
- disabled?: boolean
35
- imageSize?: number
36
- noChevron?: boolean
37
- open: boolean
38
- }
39
-
40
- const DefaultTriggerInner = <T,>(
41
- {
42
- current,
43
- currentLabel,
44
- imageUrl,
45
- buttonClx='',
46
- imageClx='',
47
- placeholder='(select)',
48
- disabled=false,
49
- imageSize=DEFAULT_IMAGE_SIZE,
50
- noChevron=false,
51
- open,
52
- ...rest
53
- }: ComboboxTriggerProps<T>,
54
- ref: React.ForwardedRef<HTMLButtonElement>
55
- ) => (
56
- <Button
57
- ref={ref}
58
- {...rest}
59
- variant='outline'
60
- role='combobox'
61
- aria-expanded={open}
62
- className={cn(
63
- 'flex',
64
- noChevron ? 'justify-start' : 'justify-between',
65
- buttonClx
66
- )}
67
- disabled={disabled}
68
- >
69
- <div className='flex justify-start items-center gap-2'>
70
- {(current && imageUrl) ? (
71
- <img
72
- src={imageUrl}
73
- alt={currentLabel + ' image'}
74
- height={imageSize}
75
- width={imageSize}
76
- loading="eager"
77
- className={cn('block', imageClx)}
78
- />
79
- ) : (
80
- <div style={{width: imageSize, height: imageSize}} />
81
- )}
82
- <span className='block'>{currentLabel}</span>
83
- </div>
84
- {!noChevron && (<ChevronDown className={cn('block', open ? '' : 'opacity-50')} />)}
85
- </Button>
86
- )
87
-
88
- const DefaultTrigger = React.forwardRef(DefaultTriggerInner) as <T, P>(props: P & { ref?: React.ForwardedRef<HTMLButtonElement> }) => React.ReactNode
89
-
90
- const Combobox = <T, P extends ComboboxTriggerProps<T>>({
91
- elements,
92
- initial,
93
- current,
94
- setCurrent,
95
- closeOnSelect=true,
96
- adaptor,
97
- popoverClx='',
98
- listItemClx='',
99
- listItemSelectedClx='',
100
- listItemDisabledClx='',
101
- noCheckmark=false,
102
- listItemImageClx='',
103
- searchPlaceholder='Search...',
104
- noneFoundMessage='None found.',
105
- listItemImageSize=DEFAULT_IMAGE_SIZE,
106
- noSearch=false,
107
- popoverAlign = 'center',
108
- popoverSideOffset = 4,
109
- Trigger,
110
- triggerProps
111
- }: {
112
- elements: T[]
113
- initial?: T | null
114
- current?: T | null
115
- setCurrent: (c: T | null) => void
116
- closeOnSelect?: boolean
117
- adaptor: ListAdaptor<T>
118
- popoverClx?: string
119
- listItemClx?: string
120
- listItemSelectedClx?: string
121
- listItemDisabledClx?: string
122
- listItemImageClx?: string
123
- listItemImageSize?: number
124
- noCheckmark?: boolean
125
- searchPlaceholder?: string
126
- noneFoundMessage?: string
127
- noSearch?: boolean
128
- popoverAlign?: "center" | "end" | "start"
129
- popoverSideOffset?: number
130
- /** If (custom) Trigger is not supplied,
131
- * passed to default trigger */
132
- triggerProps: P
133
- Trigger?:
134
- <T, P>(props: P & { ref?: React.ForwardedRef<HTMLButtonElement> }) => React.ReactNode
135
- }) => {
136
-
137
- const [_open, _setOpen] = useState<boolean>(false)
138
- // for non-controlled base (must declare the hook either way)
139
- const [_current, _setCurrent] = useState<T | null>(initial ?? null)
140
-
141
- const handleSelect = (selString: string) => {
142
-
143
- const found = elements.find((el: T) => (adaptor.valueEquals(el, selString)))
144
- if (found) {
145
- // non-controlled ('initial' supplied (may have been null))
146
- if (initial !== undefined) {
147
- _setCurrent(found)
148
- }
149
- setCurrent(found)
150
- }
151
- if (closeOnSelect) {
152
- _setOpen(false)
153
- }
154
- }
155
-
156
- const isCurrent = (el: T): boolean => {
157
-
158
- // non-controlled?
159
- const curr = (current === undefined) ? _current : current
160
- return !!curr && adaptor.equals(el, curr)
161
- }
162
-
163
- const _triggerProps = current ? {
164
- ...triggerProps,
165
- current,
166
- currentLabel: adaptor.getLabel ? adaptor.getLabel(current) : adaptor.getValue(current),
167
- imageUrl: adaptor.getImageUrl ? adaptor.getImageUrl(current) : null,
168
- open: _open
169
- } : {
170
- ...triggerProps,
171
- current: null,
172
- currentLabel: null,
173
- imageUrl: null,
174
- open: _open
175
- }
176
-
177
- return (
178
- <Popover open={_open} onOpenChange={_setOpen}>
179
- <PopoverTrigger asChild>
180
- {Trigger ? (
181
- <Trigger<T, P> {..._triggerProps} />
182
- ) : (
183
- <DefaultTrigger<T, P> {..._triggerProps} />
184
- )}
185
- </PopoverTrigger>
186
- <PopoverContent className={cn('p-0', popoverClx)} align={popoverAlign} sideOffset={popoverSideOffset}>
187
- <Command>
188
- {!noSearch && (<CommandInput placeholder={searchPlaceholder} />)}
189
- <CommandList>
190
- <CommandEmpty>{noneFoundMessage}</CommandEmpty>
191
- <CommandGroup>
192
- {elements.map((el) => (
193
- <CommandItem
194
- key={adaptor.getValue(el)}
195
- value={adaptor.getValue(el)}
196
- onSelect={handleSelect}
197
- disabled={adaptor.isDisabled ? adaptor.isDisabled(el) : false}
198
- className={cn(
199
- 'flex',
200
- noCheckmark ? 'justify-start' : 'justify-between',
201
- listItemClx,
202
- (isCurrent(el) ? listItemSelectedClx : ''),
203
- ((adaptor.isDisabled && adaptor.isDisabled(el)) ? listItemDisabledClx : '')
204
- )}
205
- >
206
- <div className='flex justify-start items-center gap-2'>
207
- { (adaptor.getImageUrl && adaptor.getImageUrl(el)) ? (
208
- <img
209
- src={adaptor.getImageUrl(el)!}
210
- alt={adaptor.getValue(el) + ' image'}
211
- height={listItemImageSize}
212
- width={listItemImageSize}
213
- loading="eager"
214
- className={listItemImageClx}
215
- />
216
- ) : (
217
- <div style={{width: listItemImageSize, height: listItemImageSize}} />
218
- )}
219
- <span>{ adaptor.getLabel ? adaptor.getLabel(el) : adaptor.getValue(el) }</span>
220
- </div>
221
- {!noCheckmark && (
222
- <div>
223
- <Check className={cn('ml-auto', (isCurrent(el)) ? '' : 'invisible' )} />
224
- </div>
225
- )}
226
- </CommandItem>
227
- ))}
228
- </CommandGroup>
229
- </CommandList>
230
- </Command>
231
- </PopoverContent>
232
- </Popover>
233
- )
234
- }
235
-
236
- export {
237
- Combobox as default,
238
- type ComboboxTriggerProps
239
- }
@@ -1,157 +0,0 @@
1
- "use client"
2
- import React from "react"
3
-
4
- import { type DialogProps } from "@radix-ui/react-dialog"
5
- import { Command as CommandPrimitive } from "cmdk"
6
- import { Search } from "lucide-react"
7
-
8
- import { cn } from "../util"
9
- import { Dialog, DialogContent } from "./dialog"
10
-
11
- const Command = React.forwardRef<
12
- React.ElementRef<typeof CommandPrimitive>,
13
- React.ComponentPropsWithoutRef<typeof CommandPrimitive>
14
- >(({ className, ...props }, ref) => (
15
- <CommandPrimitive
16
- ref={ref}
17
- className={cn(
18
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-level-1 text-foreground",
19
- className
20
- )}
21
- {...props}
22
- />
23
- ))
24
- Command.displayName = CommandPrimitive.displayName
25
-
26
- interface CommandDialogProps extends DialogProps {}
27
-
28
- const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
29
- return (
30
- <Dialog {...props}>
31
- <DialogContent className="overflow-hidden p-0 shadow-lg">
32
- <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-1 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
33
- {children}
34
- </Command>
35
- </DialogContent>
36
- </Dialog>
37
- )
38
- }
39
-
40
- const CommandInput = React.forwardRef<
41
- React.ElementRef<typeof CommandPrimitive.Input>,
42
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
43
- >(({ className, ...props }, ref) => (
44
- <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
45
- <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
46
- <CommandPrimitive.Input
47
- ref={ref}
48
- className={cn(
49
- "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-2 disabled:cursor-not-allowed disabled:opacity-50",
50
- className
51
- )}
52
- {...props}
53
- />
54
- </div>
55
- ))
56
-
57
- CommandInput.displayName = CommandPrimitive.Input.displayName
58
-
59
- const CommandList = React.forwardRef<
60
- React.ElementRef<typeof CommandPrimitive.List>,
61
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
62
- >(({ className, ...props }, ref) => (
63
- <CommandPrimitive.List
64
- ref={ref}
65
- className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
66
- {...props}
67
- />
68
- ))
69
-
70
- CommandList.displayName = CommandPrimitive.List.displayName
71
-
72
- const CommandEmpty = React.forwardRef<
73
- React.ElementRef<typeof CommandPrimitive.Empty>,
74
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
75
- >((props, ref) => (
76
- <CommandPrimitive.Empty
77
- ref={ref}
78
- className="py-6 text-center text-sm"
79
- {...props}
80
- />
81
- ))
82
-
83
- CommandEmpty.displayName = CommandPrimitive.Empty.displayName
84
-
85
- const CommandGroup = React.forwardRef<
86
- React.ElementRef<typeof CommandPrimitive.Group>,
87
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
88
- >(({ className, ...props }, ref) => (
89
- <CommandPrimitive.Group
90
- ref={ref}
91
- className={cn(
92
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted",
93
- className
94
- )}
95
- {...props}
96
- />
97
- ))
98
-
99
- CommandGroup.displayName = CommandPrimitive.Group.displayName
100
-
101
- const CommandSeparator = React.forwardRef<
102
- React.ElementRef<typeof CommandPrimitive.Separator>,
103
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
104
- >(({ className, ...props }, ref) => (
105
- <CommandPrimitive.Separator
106
- ref={ref}
107
- className={cn("-mx-1 h-px bg-border", className)}
108
- {...props}
109
- />
110
- ))
111
- CommandSeparator.displayName = CommandPrimitive.Separator.displayName
112
-
113
- const CommandItem = React.forwardRef<
114
- React.ElementRef<typeof CommandPrimitive.Item>,
115
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
116
- >(({ className, ...props }, ref) => (
117
- <CommandPrimitive.Item
118
- ref={ref}
119
- className={cn(
120
- 'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none',
121
- 'data-selected:bg-level-3 aria-selected:text-accent',
122
- 'data-[disabled]:pointer-events-none data-[disabled]:opacity-35',
123
- className
124
- )}
125
- {...props}
126
- />
127
- ))
128
-
129
- CommandItem.displayName = CommandPrimitive.Item.displayName
130
-
131
- const CommandShortcut = ({
132
- className,
133
- ...props
134
- }: React.HTMLAttributes<HTMLSpanElement>) => {
135
- return (
136
- <span
137
- className={cn(
138
- "ml-auto text-xs tracking-widest text-muted",
139
- className
140
- )}
141
- {...props}
142
- />
143
- )
144
- }
145
- CommandShortcut.displayName = "CommandShortcut"
146
-
147
- export {
148
- Command,
149
- CommandDialog,
150
- CommandInput,
151
- CommandList,
152
- CommandEmpty,
153
- CommandGroup,
154
- CommandItem,
155
- CommandShortcut,
156
- CommandSeparator,
157
- }
@@ -1,200 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
5
- import { Check, ChevronRight, Circle } from "lucide-react"
6
-
7
- import { cn } from "../util"
8
-
9
- const ContextMenu = ContextMenuPrimitive.Root
10
- const ContextMenuTrigger = ContextMenuPrimitive.Trigger
11
- const ContextMenuGroup = ContextMenuPrimitive.Group
12
- const ContextMenuPortal = ContextMenuPrimitive.Portal
13
- const ContextMenuSub = ContextMenuPrimitive.Sub
14
- const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
15
-
16
- const ContextMenuSubTrigger = React.forwardRef<
17
- React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
18
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
19
- inset?: boolean
20
- }
21
- >(({ className, inset, children, ...props }, ref) => (
22
- <ContextMenuPrimitive.SubTrigger
23
- ref={ref}
24
- className={cn(
25
- 'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none ' +
26
- 'focus:bg-level-1 focus:text-accent data-[state=open]:bg-level-1 data-[state=open]:text-accent',
27
- inset && "pl-8",
28
- className
29
- )}
30
- {...props}
31
- >
32
- {children}
33
- <ChevronRight className="ml-auto h-4 w-4" />
34
- </ContextMenuPrimitive.SubTrigger>
35
- ))
36
- ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
37
-
38
- const ContextMenuSubContent = React.forwardRef<
39
- React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
40
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
41
- >(({ className, ...props }, ref) => (
42
- <ContextMenuPrimitive.SubContent
43
- ref={ref}
44
- className={cn(
45
- 'z-popup min-w-[8rem] overflow-hidden rounded-md border bg-background p-1 text-foreground shadow-md ' +
46
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 ' +
47
- 'data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 ' +
48
- 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 ' +
49
- 'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
50
- className
51
- )}
52
- {...props}
53
- />
54
- ))
55
- ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
56
-
57
- const ContextMenuContent = React.forwardRef<
58
- React.ElementRef<typeof ContextMenuPrimitive.Content>,
59
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
60
- >(({ className, ...props }, ref) => (
61
- <ContextMenuPrimitive.Portal>
62
- <ContextMenuPrimitive.Content
63
- ref={ref}
64
- className={cn(
65
- "z-popup min-w-[8rem] overflow-hidden rounded-md border bg-background p-1 text-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
66
- className
67
- )}
68
- {...props}
69
- />
70
- </ContextMenuPrimitive.Portal>
71
- ))
72
- ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
73
-
74
- const ContextMenuItem = React.forwardRef<
75
- React.ElementRef<typeof ContextMenuPrimitive.Item>,
76
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
77
- inset?: boolean
78
- }
79
- >(({ className, inset, ...props }, ref) => (
80
- <ContextMenuPrimitive.Item
81
- ref={ref}
82
- className={cn(
83
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-level-1 focus:text-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
84
- inset && "pl-8",
85
- className
86
- )}
87
- {...props}
88
- />
89
- ))
90
- ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
91
-
92
- const ContextMenuCheckboxItem = React.forwardRef<
93
- React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
94
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
95
- >(({ className, children, checked, ...props }, ref) => (
96
- <ContextMenuPrimitive.CheckboxItem
97
- ref={ref}
98
- className={cn(
99
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-level-1 focus:text-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
100
- className
101
- )}
102
- checked={checked}
103
- {...props}
104
- >
105
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
106
- <ContextMenuPrimitive.ItemIndicator>
107
- <Check className="h-4 w-4" />
108
- </ContextMenuPrimitive.ItemIndicator>
109
- </span>
110
- {children}
111
- </ContextMenuPrimitive.CheckboxItem>
112
- ))
113
- ContextMenuCheckboxItem.displayName =
114
- ContextMenuPrimitive.CheckboxItem.displayName
115
-
116
- const ContextMenuRadioItem = React.forwardRef<
117
- React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
118
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
119
- >(({ className, children, ...props }, ref) => (
120
- <ContextMenuPrimitive.RadioItem
121
- ref={ref}
122
- className={cn(
123
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-level-1 focus:text-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
124
- className
125
- )}
126
- {...props}
127
- >
128
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
129
- <ContextMenuPrimitive.ItemIndicator>
130
- <Circle className="h-2 w-2 fill-current" />
131
- </ContextMenuPrimitive.ItemIndicator>
132
- </span>
133
- {children}
134
- </ContextMenuPrimitive.RadioItem>
135
- ))
136
- ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
137
-
138
- const ContextMenuLabel = React.forwardRef<
139
- React.ElementRef<typeof ContextMenuPrimitive.Label>,
140
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
141
- inset?: boolean
142
- }
143
- >(({ className, inset, ...props }, ref) => (
144
- <ContextMenuPrimitive.Label
145
- ref={ref}
146
- className={cn(
147
- "px-2 py-1.5 text-sm font-semibold text-foreground",
148
- inset && "pl-8",
149
- className
150
- )}
151
- {...props}
152
- />
153
- ))
154
- ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
155
-
156
- const ContextMenuSeparator = React.forwardRef<
157
- React.ElementRef<typeof ContextMenuPrimitive.Separator>,
158
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
159
- >(({ className, ...props }, ref) => (
160
- <ContextMenuPrimitive.Separator
161
- ref={ref}
162
- className={cn("-mx-1 my-1 h-px bg-border", className)}
163
- {...props}
164
- />
165
- ))
166
- ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
167
-
168
- const ContextMenuShortcut = ({
169
- className,
170
- ...props
171
- }: React.HTMLAttributes<HTMLSpanElement>) => {
172
- return (
173
- <span
174
- className={cn(
175
- "ml-auto text-xs tracking-widest text-muted",
176
- className
177
- )}
178
- {...props}
179
- />
180
- )
181
- }
182
- ContextMenuShortcut.displayName = "ContextMenuShortcut"
183
-
184
- export {
185
- ContextMenu,
186
- ContextMenuTrigger,
187
- ContextMenuContent,
188
- ContextMenuItem,
189
- ContextMenuCheckboxItem,
190
- ContextMenuRadioItem,
191
- ContextMenuLabel,
192
- ContextMenuSeparator,
193
- ContextMenuShortcut,
194
- ContextMenuGroup,
195
- ContextMenuPortal,
196
- ContextMenuSub,
197
- ContextMenuSubContent,
198
- ContextMenuSubTrigger,
199
- ContextMenuRadioGroup,
200
- }
@@ -1,38 +0,0 @@
1
- 'use client'
2
-
3
- import React, { type PropsWithChildren, useState } from 'react'
4
-
5
- const DialogVideoController: React.FC<PropsWithChildren> = ({
6
- children,
7
- }) => {
8
-
9
- const [open, setOpen] = useState<boolean>(false)
10
-
11
- const onOpenChange = (b: boolean) => {
12
- setOpen(b)
13
- const videos = document.getElementsByTagName('video')
14
- const videoArray = Array.from(videos)
15
- videoArray.forEach((v) => {
16
- if (b) {
17
- v.pause()
18
- }
19
- else {
20
- v.play()
21
- }
22
- })
23
- }
24
-
25
- // https://stackoverflow.com/a/49052730/11645689
26
- const updatedChildren = React.Children.map(
27
- children,
28
- (child) => (React.cloneElement(
29
- child as any, { open, onOpenChange }
30
- ))
31
- )
32
-
33
- return (<>
34
- {updatedChildren}
35
- </>)
36
- }
37
-
38
- export default DialogVideoController