@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.
- package/README.md +229 -0
- package/bin/create-registry.js +1 -1
- package/bin/test-mcp.sh +1 -1
- package/bin/update-registry.js +2 -2
- package/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +9458 -0
- package/dist/index.mjs +9449 -0
- package/dist/lib/utils.d.mts +2 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +47 -0
- package/dist/lib/utils.mjs +28 -0
- package/dist/src/utils.d.mts +7 -0
- package/dist/src/utils.d.ts +7 -0
- package/dist/src/utils.js +47 -0
- package/dist/src/utils.mjs +28 -0
- package/dist/tailwind/index.d.mts +2 -0
- package/dist/tailwind/index.d.ts +2 -0
- package/dist/tailwind/index.js +2048 -0
- package/dist/tailwind/index.mjs +2017 -0
- package/dist/types/index.d.mts +12 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.js +79 -0
- package/dist/types/index.mjs +56 -0
- package/package.json +170 -23
- package/style/theme-provider.tsx +1 -1
- package/MCP-INSTRUCTIONS.md +0 -73
- package/README-MCP.md +0 -175
- package/blocks/components/accordian-block.tsx +0 -48
- package/blocks/components/block-component-props.ts +0 -11
- package/blocks/components/bullet-cards-block.tsx +0 -46
- package/blocks/components/card-block/index.tsx +0 -171
- package/blocks/components/card-block/link-out-button.tsx +0 -20
- package/blocks/components/card-block/util.ts +0 -28
- package/blocks/components/carte-blanche-block/index.tsx +0 -127
- package/blocks/components/carte-blanche-block/variant-content-left.tsx +0 -49
- package/blocks/components/content.tsx +0 -70
- package/blocks/components/cta-block.tsx +0 -115
- package/blocks/components/enh-heading-block.tsx +0 -204
- package/blocks/components/grid-block/grid-block-mutator.ts +0 -12
- package/blocks/components/grid-block/index.tsx +0 -83
- package/blocks/components/grid-block/mutator-registry.ts +0 -10
- package/blocks/components/grid-block/table-borders.mutator.ts +0 -47
- package/blocks/components/group-block.tsx +0 -83
- package/blocks/components/heading-block.tsx +0 -88
- package/blocks/components/image-block.tsx +0 -111
- package/blocks/components/index.ts +0 -30
- package/blocks/components/screenful-block/content.tsx +0 -123
- package/blocks/components/screenful-block/index.tsx +0 -107
- package/blocks/components/screenful-block/poster-background.tsx +0 -34
- package/blocks/components/screenful-block/video-background.tsx +0 -45
- package/blocks/components/space-block.tsx +0 -66
- package/blocks/components/video-block.tsx +0 -138
- package/blocks/def/accordian-block.ts +0 -14
- package/blocks/def/block.ts +0 -7
- package/blocks/def/bullet-cards-block.ts +0 -22
- package/blocks/def/card-block.ts +0 -22
- package/blocks/def/carte-blanche-block.ts +0 -21
- package/blocks/def/cta-block.ts +0 -19
- package/blocks/def/element-block.ts +0 -11
- package/blocks/def/enh-heading-block.ts +0 -44
- package/blocks/def/grid-block.ts +0 -16
- package/blocks/def/group-block.ts +0 -11
- package/blocks/def/heading-block.ts +0 -15
- package/blocks/def/image-block.ts +0 -31
- package/blocks/def/index.ts +0 -35
- package/blocks/def/screenful-block.ts +0 -54
- package/blocks/def/space-block.ts +0 -64
- package/blocks/def/video-block.ts +0 -9
- package/blocks/index.ts +0 -2
- package/dist/mcp/enhanced-server.d.ts +0 -29
- package/dist/mcp/enhanced-server.js +0 -1128
- package/dist/mcp/index.d.ts +0 -28
- package/dist/mcp/index.js +0 -436
- package/dist/registry/api.d.ts +0 -37
- package/dist/registry/api.js +0 -129
- package/dist/registry/index.d.ts +0 -353
- package/dist/registry/index.js +0 -45
- package/environment.d.ts +0 -6
- package/primitives/accordion.tsx +0 -66
- package/primitives/action-button.tsx +0 -42
- package/primitives/apply-typography.tsx +0 -55
- package/primitives/aspect-ratio.tsx +0 -5
- package/primitives/avatar.tsx +0 -49
- package/primitives/badge.tsx +0 -36
- package/primitives/breadcrumb.tsx +0 -115
- package/primitives/breakpoint-indicator.tsx +0 -19
- package/primitives/button.tsx +0 -85
- package/primitives/calendar.tsx +0 -72
- package/primitives/card.tsx +0 -83
- package/primitives/carousel.tsx +0 -237
- package/primitives/checkbox.tsx +0 -32
- package/primitives/combobox.tsx +0 -239
- package/primitives/command.tsx +0 -157
- package/primitives/context-menu.tsx +0 -200
- package/primitives/dialog-video-controller.tsx +0 -38
- package/primitives/dialog.tsx +0 -157
- package/primitives/drawer.tsx +0 -138
- package/primitives/form.tsx +0 -178
- package/primitives/icons/github.tsx +0 -14
- package/primitives/icons/index.ts +0 -18
- package/primitives/icons/youtube-logo.tsx +0 -59
- package/primitives/index-common.ts +0 -224
- package/primitives/index-next.ts +0 -2
- package/primitives/input-otp.tsx +0 -65
- package/primitives/input.tsx +0 -30
- package/primitives/label.tsx +0 -28
- package/primitives/list-adaptor.ts +0 -12
- package/primitives/list-box.tsx +0 -74
- package/primitives/loading-spinner.tsx +0 -33
- package/primitives/navigation-menu.tsx +0 -147
- package/primitives/next/image.tsx +0 -90
- package/primitives/next/index.ts +0 -7
- package/primitives/next/inline-icon.tsx +0 -36
- package/primitives/next/link-element.tsx +0 -109
- package/primitives/next/mdx-link.tsx +0 -22
- package/primitives/next/media-stack.tsx +0 -69
- package/primitives/next/nav-items.tsx +0 -45
- package/primitives/next/youtube-embed.tsx +0 -83
- package/primitives/popover.tsx +0 -37
- package/primitives/progress.tsx +0 -27
- package/primitives/radio-group.tsx +0 -56
- package/primitives/scroll-area.tsx +0 -47
- package/primitives/select.tsx +0 -169
- package/primitives/separator.tsx +0 -29
- package/primitives/sheet.tsx +0 -178
- package/primitives/skeleton.tsx +0 -20
- package/primitives/slider.tsx +0 -72
- package/primitives/sonner.tsx +0 -35
- package/primitives/step-indicator.tsx +0 -69
- package/primitives/switch.tsx +0 -35
- package/primitives/table.tsx +0 -117
- package/primitives/tabs.tsx +0 -60
- package/primitives/text-area.tsx +0 -26
- package/primitives/toggle-group.tsx +0 -63
- package/primitives/toggle.tsx +0 -73
- package/primitives/tooltip.tsx +0 -48
- package/primitives/video-player.tsx +0 -23
- package/public/r/accordion.json +0 -11
- package/public/r/alert.json +0 -11
- package/public/r/avatar.json +0 -11
- package/public/r/badge.json +0 -11
- package/public/r/button.json +0 -11
- package/public/r/card.json +0 -11
- package/public/r/checkbox.json +0 -11
- package/public/r/default.json +0 -6
- package/public/r/dialog.json +0 -11
- package/public/r/input.json +0 -11
- package/public/r/label.json +0 -11
- package/public/r/new-york.json +0 -6
- package/public/r/popover.json +0 -11
- package/public/r/select.json +0 -11
- package/public/r/table.json +0 -11
- package/public/r/tabs.json +0 -11
- package/public/r/toast.json +0 -11
- package/registry.json +0 -184
- package/src/mcp/README.md +0 -141
- package/src/mcp/enhanced-server.ts +0 -1208
- package/src/mcp/index.ts +0 -518
- package/src/mcp/package.json +0 -10
- package/src/registry/api.ts +0 -164
- package/src/registry/index.ts +0 -60
- package/src/registry/package.json +0 -10
- package/tailwind/colors.tailwind.js +0 -53
- package/tailwind/fontFamily.tailwind.ts +0 -7
- package/tailwind/fontSize.tailwind.ts +0 -13
- package/tailwind/index.ts +0 -7
- package/tailwind/safelist.tailwind.js +0 -26
- package/tailwind/screens.tailwind.js +0 -8
- package/tailwind/spacing.tailwind.js +0 -65
- package/tailwind/tailwind.config.hanzo-preset.d.ts +0 -5
- package/tailwind/tailwind.config.hanzo-preset.js +0 -915
- package/tailwind/tw-font-desc.ts +0 -15
- package/tailwind/typo-plugin/get-plugin-styles.js +0 -679
- package/tailwind/typo-plugin/index.d.ts +0 -9
- package/tailwind/typo-plugin/index.js +0 -141
- package/tailwind/typo-plugin/utils.js +0 -60
- package/tailwind/typography-test.mdx +0 -35
- package/tailwind/z-index.tailwind.js +0 -71
- package/test/test-registry.js +0 -73
- package/tsconfig.json +0 -22
- package/types/animation-def.ts +0 -3
- package/types/breakpoints.ts +0 -11
- package/types/bullet-item.ts +0 -10
- package/types/button-def.ts +0 -39
- package/types/dimensions.ts +0 -8
- package/types/grid-def.ts +0 -56
- package/types/image-def.ts +0 -32
- package/types/index.ts +0 -29
- package/types/link-def.ts +0 -56
- package/types/media-stack-def.ts +0 -31
- package/types/t-shirt-size.ts +0 -5
- package/types/tshirt-dimensions.ts +0 -20
- package/types/video-def.ts +0 -25
- package/util/format-and-abbreviate-as-currency.ts +0 -125
- package/util/format-to-max-char.ts +0 -68
- package/util/index-client.ts +0 -3
- package/util/index.ts +0 -78
- package/util/number-abbreviate.ts +0 -49
- package/util/specifier.ts +0 -43
- package/util/spread-to-transform.ts +0 -24
- package/util/step-animation.ts +0 -90
- 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
|
package/primitives/next/index.ts
DELETED
|
@@ -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
|
package/primitives/popover.tsx
DELETED
|
@@ -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 }
|
package/primitives/progress.tsx
DELETED
|
@@ -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 }
|