@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,90 +0,0 @@
1
- import React from 'react'
2
- import NextImage from 'next/image'
3
-
4
- import type { ImageDef, Dimensions, MediaTransform } from '../../types'
5
- import { constrain, cn, spreadToTransform } from '../../util'
6
-
7
- const Image: React.FC<{
8
- def: ImageDef
9
- constrainTo?: Dimensions
10
- transform?: MediaTransform
11
- fullWidth?: boolean
12
- className?: string
13
- preload?: boolean
14
- }> = ({
15
- def,
16
- constrainTo,
17
- transform={},
18
- fullWidth=false,
19
- className='',
20
- preload=false
21
- }) => {
22
-
23
- const {
24
- src,
25
- alt: _alt,
26
- dim,
27
- sizes,
28
- svgFillClass: _svgFillClass,
29
- } = def
30
-
31
- const toSpread: any = {}
32
- if (fullWidth) {
33
- toSpread.style = {
34
- width: '100%',
35
- height: 'auto',
36
- ...spreadToTransform(transform)
37
- }
38
- if (constrainTo) {
39
- toSpread.style.maxWidth = constrainTo.w
40
- toSpread.style.maxHeight = constrainTo.h
41
- }
42
- }
43
- else {
44
- const resolved = constrainTo ? constrain(dim, constrainTo) : dim
45
- toSpread.width = resolved.w
46
- toSpread.height = resolved.h
47
- toSpread.style = {...spreadToTransform(transform)}
48
- }
49
-
50
- if (sizes) {
51
- toSpread.sizes = sizes
52
- }
53
-
54
- // Note: cannot be spread (a Next thing)
55
- let alt: string
56
- if (_alt) {
57
- alt = _alt
58
- }
59
- else {
60
- const tokens = src.split('/')
61
- // Something remotely meaningful
62
- alt = (tokens.length > 0) ? tokens[tokens.length - 1] : src
63
- }
64
-
65
- const svgFillClass = _svgFillClass ?? ''
66
-
67
- return (fullWidth) ? (
68
- <div className='relative flex flex-col items-center justify-center w-full'>
69
- <NextImage
70
- src={src}
71
- alt={alt}
72
- {...toSpread}
73
- priority={preload}
74
- loading={preload ? 'eager' : 'lazy'}
75
- className={cn(svgFillClass, className)}
76
- />
77
- </div>
78
- ) : (
79
- <NextImage
80
- src={src}
81
- alt={alt}
82
- {...toSpread}
83
- priority={preload}
84
- loading={preload ? 'eager' : 'lazy'}
85
- className={cn(svgFillClass, className)}
86
- />
87
- )
88
- }
89
-
90
- export default Image
@@ -1,7 +0,0 @@
1
- export { default as Image } from './image'
2
- export { default as InlineIcon } from './inline-icon'
3
- export { default as LinkElement } from './link-element'
4
- export { default as MDXLink } from './mdx-link'
5
- export { default as MediaStack } from './media-stack'
6
- export { default as NavItems } from './nav-items'
7
- export { default as YouTubeEmbed } from './youtube-embed'
@@ -1,36 +0,0 @@
1
- import React from 'react'
2
- import Image from 'next/image'
3
-
4
-
5
- const InlineIcon: React.FC<{
6
- /**
7
- * If a ReactNode is passed in, it should be set to 'w-full h-auto' so that it can be sized
8
- * according to width of parent.
9
- */
10
- icon: React.ReactNode
11
- /** default should be handled by calling code. */
12
- size?: number
13
-
14
- agent?: string,
15
- className?: string
16
- }> = ({
17
- icon,
18
- size,
19
- agent,
20
- className=''
21
- }) => {
22
- if (!icon) return null
23
-
24
- const phone = agent === 'phone'
25
- if (typeof icon === 'string') {
26
- const _size = (phone && size) ? (size * .75) : size
27
- return (<Image src={icon} width={_size} height={_size} alt='icon' className={className}/>)
28
- }
29
- return (
30
- <div className={className}>
31
- {icon}
32
- </div>
33
- )
34
- }
35
-
36
- export default InlineIcon
@@ -1,109 +0,0 @@
1
- import React, { type PropsWithChildren } from 'react'
2
- import Link from 'next/link'
3
-
4
- import type { LinkDef } from '../../types'
5
- import { buttonVariants } from '../button'
6
- import { cn, type VariantProps } from '../../util'
7
-
8
- /**
9
- * If this is rendered directly (and not auto generated in a Block)
10
- * and it has any children, title, icon, and iconAfter
11
- * are ignore.
12
- */
13
- const LinkElement: React.FC<
14
- PropsWithChildren &
15
- VariantProps<typeof buttonVariants> &
16
- {
17
- def: LinkDef,
18
-
19
- /**
20
- * Use to trigger other events in addition to the
21
- * link action itself. For example, to also close a drawer menu.
22
- */
23
- onClick?: () => void
24
-
25
- /** overrides def (eg, for title area)*/
26
- icon?: React.ReactNode
27
- /** overrides def */
28
- iconAfter?: boolean
29
- className?: string,
30
- }> = ({
31
- def,
32
- // DO NOT provide a default to any of the props that also appear in def!
33
- onClick,
34
- size,
35
- variant,
36
- rounded,
37
- icon,
38
- iconAfter,
39
- className = '',
40
- children,
41
- } ) => {
42
-
43
- const {
44
- href,
45
- newTab,
46
- variant: defVariant,
47
- size: defSize,
48
- rounded: defRounded,
49
- title
50
- } = def
51
-
52
- const linkProps: any = {}
53
-
54
- // As per LinkDef docs
55
- if (href.startsWith('http') || href.startsWith('mailto')) {
56
- linkProps.rel = 'noreferrer noopener'
57
- if (newTab ?? true) {
58
- linkProps.target = '_blank'
59
- }
60
- }
61
- else if (newTab) {
62
- linkProps.target = '_blank'
63
- }
64
-
65
- const toSpread = {
66
- href,
67
- ...(onClick ? { onClick } : {}),
68
- ...linkProps
69
- }
70
-
71
- const Contents: React.FC = () => {
72
-
73
- if (React.Children.count(children) > 0) return children
74
-
75
- // Props > def fields > defaults.
76
- const _icon = (icon) ? icon : (def.icon) ? def.icon : undefined
77
- const _iconAfter = (iconAfter) ? iconAfter : (def.iconAfter) ? def.iconAfter : false
78
-
79
- // 'title' is not guaranteed as it could be an icon only button / link
80
- return (<>
81
- {_icon && !_iconAfter && (<div className='pr-1'>{_icon}</div>)}
82
- {title && (<div>{title}</div>)}
83
- {_icon && _iconAfter && (<div className='pl-1'>{_icon}</div>)}
84
- </>)
85
- }
86
-
87
- return (
88
- <Link
89
- className={cn(
90
- buttonVariants({
91
- variant: variant ? variant : (defVariant ? defVariant : 'link'),
92
- size: (!defVariant || defVariant.includes('link') || variant?.includes('link')) ?
93
- 'link'
94
- :
95
- (size ? size : defSize),
96
- rounded: rounded ? rounded : (defRounded ? defRounded : 'md'),
97
- }),
98
- // This is a "label only" LinkDef. cf: footer"
99
- ((href.length > 0 || onClick) ? '' : 'pointer-events-none'),
100
- className
101
- )}
102
- {...toSpread}
103
- >
104
- <Contents />
105
- </Link>
106
- )
107
- }
108
-
109
- export default LinkElement
@@ -1,22 +0,0 @@
1
- import React, { type AnchorHTMLAttributes, type PropsWithChildren } from 'react'
2
- import Link from 'next/link'
3
-
4
- const MDXLink: React.FC<AnchorHTMLAttributes<HTMLAnchorElement> > = ({
5
- href,
6
- children,
7
- ...rest
8
- }) => {
9
-
10
- // internal link
11
- if (href && (href.startsWith('/'))) {
12
- return (
13
- <Link href={href} {...rest}>
14
- {children}
15
- </Link>
16
- )
17
- }
18
-
19
- return <a target="_blank" href={href} {...rest} >{children}</a>
20
- }
21
-
22
- export default MDXLink
@@ -1,69 +0,0 @@
1
- 'use client'
2
- import React from 'react'
3
-
4
- import Spline from '@splinetool/react-spline'
5
-
6
- import { cn, constrain, spreadToTransform } from '../../util'
7
- import type { MediaStackDef, Dimensions } from '../../types'
8
-
9
- import Image from './image'
10
- import VideoPlayer from '../video-player'
11
-
12
- const MediaStack: React.FC<{
13
- media: MediaStackDef
14
- constrainTo?: Dimensions
15
- clx?: string
16
- }> = ({
17
- media,
18
- constrainTo: cnst = {w: 250, h: 250},
19
- clx=''
20
- }) => {
21
- const {img, video, animation, mediaTransform} = media
22
-
23
- const transform = mediaTransform ?? {}
24
-
25
- // Order of precedence: 3D > MP4 > Image
26
- if (animation) {
27
- return (
28
- <Spline
29
- scene={animation}
30
- className={cn(clx, 'pointer-events-none')}
31
- data-vaul-no-drag
32
- style={{
33
- // // !aspect-[12/10]
34
- width: (6/5 * (typeof cnst.h === 'number' ? cnst.h as number : parseInt(cnst.h as string)) ),
35
- height: cnst.h,
36
- ...spreadToTransform(transform)
37
- }}
38
- />
39
- )
40
- }
41
- if (video) {
42
- const dim = constrain(video.dim.md, cnst)
43
- return (
44
- <VideoPlayer
45
- className={clx}
46
- sources={video.sources}
47
- width={dim.w}
48
- height={dim.h}
49
- style={{
50
- minHeight: dim.h, // prevents layout jumps
51
- ...spreadToTransform(transform)
52
- }}
53
- {...video.videoProps}
54
- />
55
- )
56
- }
57
- return img ? (
58
- <Image
59
- def={img}
60
- constrainTo={cnst}
61
- className={clx}
62
- transform={transform}
63
- />
64
- ) : (
65
- <div style={{width: cnst.w, height: cnst.h}} className={cn('bg-level-2', clx)} />
66
- )
67
- }
68
-
69
- export default MediaStack
@@ -1,45 +0,0 @@
1
- import React from 'react'
2
-
3
- import type { LinkDef } from '../../types'
4
- import LinkElement from './link-element'
5
- import { cn } from '../../util'
6
-
7
- const NavItems: React.FC<{
8
- items: LinkDef[]
9
- className?: string,
10
- as?: React.ElementType
11
- itemClx?: string | ((def: LinkDef) => string),
12
- currentAs?: string
13
- }> = ({
14
- items,
15
- className='',
16
- itemClx,
17
- as: Tag='nav',
18
- currentAs
19
- }) => ( items.length ? (
20
- <Tag className={className} >
21
- {items.map((item, index) => {
22
-
23
- const variant = item.variant ?? 'link'
24
- let internalClx = ''
25
-
26
- // note that linkFG (or any other variant of 'link')
27
- // will not get assigned these classes,
28
- // and will remain styles is 'foreground' (hence the name)
29
- if (variant === 'link') {
30
- internalClx += 'text-nav hover:text-nav-hover '
31
- if (currentAs && currentAs === item.href) {
32
- internalClx += 'text-nav-current '
33
- }
34
- }
35
- else {
36
- internalClx += 'min-w-0 lg:min-w-0 '
37
- }
38
-
39
- const _itemClx = (itemClx) ? (typeof itemClx === 'string' ? itemClx : itemClx(item)) : ''
40
- return (<LinkElement def={item} key={index} className={cn( internalClx, _itemClx)} />)
41
- })}
42
- </Tag>) : null
43
- )
44
-
45
- export default NavItems
@@ -1,83 +0,0 @@
1
- 'use client'
2
-
3
- import { useState } from 'react'
4
- import Image from 'next/image'
5
-
6
- import * as Icons from '../icons'
7
-
8
- // Concept based on https://www.youtube.com/watch?v=lLqRchtjN00
9
- // (https://github.com/a-trost/fableton)
10
-
11
- const YouTubeEmbed: React.FC<{
12
- youtubeID: string
13
- width: number
14
- height: number
15
- buttonSize?: number
16
- timeAt?: string // '5s'
17
- title?: string
18
- caption?: string
19
- className?: string
20
- }> = ({
21
- youtubeID,
22
- width,
23
- height,
24
- buttonSize=100,
25
- timeAt,
26
- title,
27
- caption,
28
- className=''
29
- }) => {
30
-
31
- const [showVideo, setShowVideo] = useState(false)
32
-
33
- // re autoplay: https://stackoverflow.com/a/45610557/11645689
34
- return (
35
- <div className={className}>
36
- {showVideo ? (
37
- <iframe
38
- width={width}
39
- height={height}
40
- src={`https://www.youtube-nocookie.com/embed/${youtubeID + ((timeAt) ? `?t=${timeAt}&` : '?')}rel=0&autoplay=1`}
41
- allow='accelerometer ; autoplay *; clipboard-write *; encrypted-media *; gyroscope *; picture-in-picture *;'
42
- allowFullScreen
43
- title={title || 'Youtube video'}
44
- className='aspect-[16/9] h-full w-full p-0 border-0 '
45
- />
46
- ) : (
47
- <button
48
- type='button'
49
- onClick={() => setShowVideo(true)}
50
- className='relative aspect-[16/9] w-full'
51
- aria-label={`Play video ${title}`}
52
- >
53
- <Image
54
- src={`https://img.youtube.com/vi/${youtubeID}/maxresdefault.jpg`}
55
- alt=''
56
- className='h-full w-full'
57
- width={width}
58
- height={height}
59
- loading='lazy'
60
- />
61
- <div
62
- className={ //https://stackoverflow.com/a/23384995/11645689
63
- 'absolute z-above-content-2 left-[50%] top-[50%] -translate-y-2/4 -translate-x-2/4 ' +
64
- 'grid place-items-center ' +
65
- 'text-xl text-white opacity-90'
66
- }
67
- >
68
- <Icons.youtube
69
- width={buttonSize}
70
- height={buttonSize}
71
- role='img'
72
- className='transform transition hover:scale-110'
73
- {...{'aria-hidden': true}}
74
- />
75
- </div>
76
- {caption && <p className='hidden md:block whitespace-nowrap typography absolute z-above-content left-[50%] top-[20px] -translate-x-2/4 '>{caption}</p>}
77
- </button>
78
- )}
79
- </div>
80
- )
81
- }
82
-
83
- export default YouTubeEmbed
@@ -1,37 +0,0 @@
1
- 'use client'
2
- import React from 'react'
3
- import * as PopoverPrimitive from '@radix-ui/react-popover'
4
-
5
- import { cn } from '../util'
6
-
7
- const Popover = PopoverPrimitive.Root
8
- const PopoverTrigger = PopoverPrimitive.Trigger
9
- const PopoverClose = PopoverPrimitive.Close
10
- const PopoverAnchor = PopoverPrimitive.Anchor
11
- const PopoverArrow = PopoverPrimitive.Arrow
12
-
13
- const PopoverContent = React.forwardRef<
14
- React.ElementRef<typeof PopoverPrimitive.Content>,
15
- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
16
- >(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
17
-
18
- <PopoverPrimitive.Portal>
19
- <PopoverPrimitive.Content
20
- ref={ref}
21
- align={align}
22
- sideOffset={sideOffset}
23
- className={cn(
24
- 'z-above-modal-2 w-72 rounded-md border bg-level-1 p-4 text-foreground shadow-md outline-none ' +
25
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 ' +
26
- 'data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 ' +
27
- 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 ' +
28
- 'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
29
- className
30
- )}
31
- {...props}
32
- />
33
- </PopoverPrimitive.Portal>
34
- ))
35
- PopoverContent.displayName = PopoverPrimitive.Content.displayName
36
-
37
- export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverClose, PopoverArrow }
@@ -1,27 +0,0 @@
1
- 'use client'
2
- import React from 'react'
3
- import * as ProgressPrimitive from '@radix-ui/react-progress'
4
-
5
- import { cn } from '../util'
6
-
7
- const Progress = React.forwardRef<
8
- React.ElementRef<typeof ProgressPrimitive.Root>,
9
- React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
10
- >(({ className, value, ...props }, ref) => (
11
- <ProgressPrimitive.Root
12
- ref={ref}
13
- className={cn(
14
- 'relative h-4 w-full overflow-hidden rounded-full bg-level-2',
15
- className
16
- )}
17
- {...props}
18
- >
19
- <ProgressPrimitive.Indicator
20
- className='h-full w-full flex-1 bg-accent transition-all'
21
- style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
22
- />
23
- </ProgressPrimitive.Root>
24
- ))
25
- Progress.displayName = ProgressPrimitive.Root.displayName
26
-
27
- export default Progress
@@ -1,56 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
5
- import { Circle } from "lucide-react"
6
-
7
- import { cn } from "../util"
8
-
9
- const RadioGroup = React.forwardRef<
10
- React.ElementRef<typeof RadioGroupPrimitive.Root>,
11
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
12
- >(({ className, ...props }, ref) => {
13
- return (
14
- <RadioGroupPrimitive.Root
15
- className={cn("grid gap-2", className)}
16
- {...props}
17
- ref={ref}
18
- />
19
- )
20
- })
21
- RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
22
-
23
- const RadioGroupItem = React.forwardRef<
24
- React.ElementRef<typeof RadioGroupPrimitive.Item>,
25
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> & {
26
- larger?: boolean
27
- }
28
- >(({
29
- larger=false,
30
- className,
31
- ...props
32
- }, ref) => {
33
- return (
34
- <RadioGroupPrimitive.Item
35
- ref={ref}
36
- className={cn(
37
- larger ? 'h-5 w-5' : 'h-4 w-4',
38
- 'aspect-square rounded-full border border-muted text-foreground ring-offset-background ' ,
39
- 'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
40
- 'disabled:cursor-not-allowed disabled:opacity-50',
41
- className
42
- )}
43
- {...props}
44
- >
45
- <RadioGroupPrimitive.Indicator className="w-full h-full flex items-center justify-center">
46
- <div className={cn(
47
- larger ? 'h-[70%] w-[70%] ' : 'h-[75%] w-[75%]',
48
- 'rounded-full aspect-square bg-foreground' ,
49
- )}/>
50
- </RadioGroupPrimitive.Indicator>
51
- </RadioGroupPrimitive.Item>
52
- )
53
- })
54
- RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
55
-
56
- export { RadioGroup, RadioGroupItem }
@@ -1,47 +0,0 @@
1
- 'use client'
2
- import React from 'react'
3
- import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'
4
-
5
- import { cn } from '../util'
6
-
7
- const ScrollArea = React.forwardRef<
8
- React.ElementRef<typeof ScrollAreaPrimitive.Root>,
9
- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
10
- >(({ className, children, ...props }, ref) => (
11
- <ScrollAreaPrimitive.Root
12
- ref={ref}
13
- className={cn('relative overflow-hidden', className)}
14
- {...props}
15
- >
16
- <ScrollAreaPrimitive.Viewport className='h-full w-full rounded-[inherit]'>
17
- {children}
18
- </ScrollAreaPrimitive.Viewport>
19
- <ScrollBar />
20
- <ScrollAreaPrimitive.Corner />
21
- </ScrollAreaPrimitive.Root>
22
- ))
23
- ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
24
-
25
- const ScrollBar = React.forwardRef<
26
- React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
27
- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
28
- >(({ className, orientation = 'vertical', ...props }, ref) => (
29
- <ScrollAreaPrimitive.ScrollAreaScrollbar
30
- ref={ref}
31
- orientation={orientation}
32
- className={cn(
33
- 'flex touch-none select-none transition-colors',
34
- orientation === 'vertical' &&
35
- 'h-full w-2.5 border-l border-l-transparent p-[1px]',
36
- orientation === 'horizontal' &&
37
- 'h-2.5 flex-col border-t border-t-transparent p-[1px]',
38
- className
39
- )}
40
- {...props}
41
- >
42
- <ScrollAreaPrimitive.ScrollAreaThumb className='relative flex-1 rounded-full bg-muted-2' />
43
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
44
- ))
45
- ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
46
-
47
- export { ScrollArea, ScrollBar }