@hanzo/ui 5.0.2 → 5.1.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/dist/accordion.js +1 -0
- package/dist/accordion.mjs +1 -0
- package/dist/alert-dialog.js +1 -0
- package/dist/alert-dialog.mjs +1 -0
- package/dist/alert.js +1 -0
- package/dist/alert.mjs +1 -0
- package/dist/avatar.js +1 -0
- package/dist/avatar.mjs +1 -0
- package/dist/badge.js +1 -0
- package/dist/badge.mjs +1 -0
- package/dist/breadcrumb.js +1 -0
- package/dist/breadcrumb.mjs +1 -0
- package/dist/calendar.js +1 -0
- package/dist/calendar.mjs +1 -0
- package/dist/carousel.js +1 -0
- package/dist/carousel.mjs +1 -0
- package/dist/checkbox.js +1 -0
- package/dist/checkbox.mjs +1 -0
- package/dist/chunk-3H5S2OQ3.mjs +1 -0
- package/dist/chunk-5GRJ7UQX.js +1 -0
- package/dist/chunk-63HNMH7C.js +1 -0
- package/dist/chunk-72TOQ4DM.mjs +1 -0
- package/dist/chunk-7AEFTV5R.mjs +1 -0
- package/dist/chunk-7M4AVV2R.js +1 -0
- package/dist/chunk-DKPVJSBC.js +1 -0
- package/dist/chunk-EI7MMDWY.js +1 -0
- package/dist/chunk-GANGDIZG.mjs +1 -0
- package/dist/chunk-GRGT2Z4K.js +1 -0
- package/dist/chunk-JCUUC6NY.mjs +1 -0
- package/dist/chunk-JUQMWLIN.js +1 -0
- package/dist/chunk-PRVEIITE.js +1 -0
- package/dist/chunk-SH52AKNZ.js +1 -0
- package/dist/chunk-TU67EJEW.mjs +1 -0
- package/dist/chunk-WN5KN73U.mjs +1 -0
- package/dist/chunk-YSXGDEY5.mjs +1 -0
- package/dist/chunk-Z76OOVUE.mjs +1 -0
- package/dist/collapsible.js +1 -0
- package/dist/collapsible.mjs +1 -0
- package/dist/command.js +1 -0
- package/dist/command.mjs +1 -0
- package/dist/context-menu.js +1 -0
- package/dist/context-menu.mjs +1 -0
- package/dist/dialog.js +1 -0
- package/dist/dialog.mjs +1 -0
- package/dist/drawer.js +1 -0
- package/dist/drawer.mjs +1 -0
- package/dist/dropdown-menu.js +1 -0
- package/dist/dropdown-menu.mjs +1 -0
- package/dist/form.js +1 -0
- package/dist/form.mjs +1 -0
- package/dist/hover-card.js +1 -0
- package/dist/hover-card.mjs +1 -0
- package/dist/index.js +1 -9079
- package/dist/index.mjs +1 -8700
- package/dist/input-otp.js +1 -0
- package/dist/input-otp.mjs +1 -0
- package/dist/lib/utils.js +1 -0
- package/dist/lib/utils.mjs +1 -0
- package/dist/navigation-menu.js +1 -0
- package/dist/navigation-menu.mjs +1 -0
- package/dist/popover.js +1 -0
- package/dist/popover.mjs +1 -0
- package/dist/progress.js +1 -0
- package/dist/progress.mjs +1 -0
- package/dist/radio-group.js +1 -0
- package/dist/radio-group.mjs +1 -0
- package/dist/resizable.js +1 -0
- package/dist/resizable.mjs +1 -0
- package/dist/scroll-area.js +1 -0
- package/dist/scroll-area.mjs +1 -0
- package/dist/select.js +1 -0
- package/dist/select.mjs +1 -0
- package/dist/separator.js +1 -0
- package/dist/separator.mjs +1 -0
- package/dist/sheet.js +1 -0
- package/dist/sheet.mjs +1 -0
- package/dist/skeleton.js +1 -0
- package/dist/skeleton.mjs +1 -0
- package/dist/slider.js +1 -0
- package/dist/slider.mjs +1 -0
- package/dist/sonner.js +1 -0
- package/dist/sonner.mjs +1 -0
- package/dist/src/utils.js +1 -0
- package/dist/src/utils.mjs +1 -0
- package/dist/switch.js +1 -0
- package/dist/switch.mjs +1 -0
- package/dist/table.js +1 -0
- package/dist/table.mjs +1 -0
- package/dist/tabs.js +1 -0
- package/dist/tabs.mjs +1 -0
- package/dist/tailwind/index.js +1 -0
- package/dist/tailwind/index.mjs +1 -0
- package/dist/textarea.js +1 -0
- package/dist/textarea.mjs +1 -0
- package/dist/toggle-group.js +1 -0
- package/dist/toggle-group.mjs +1 -0
- package/dist/toggle.js +1 -0
- package/dist/toggle.mjs +1 -0
- package/dist/tooltip.js +1 -0
- package/dist/tooltip.mjs +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +110 -81
- package/assets/ai-icons.tsx +0 -207
- package/assets/crypto.tsx +0 -33
- package/assets/file-type-icon.tsx +0 -66
- package/assets/file.tsx +0 -45
- package/assets/general.tsx +0 -2318
- package/assets/hanzo-logo.svg +0 -9
- package/assets/hanzo-logo.tsx +0 -17
- package/assets/index.ts +0 -122
- package/assets/index.tsx +0 -4
- package/assets/llm-provider.tsx +0 -1094
- package/blocks/auth/index.ts +0 -6
- package/blocks/auth/login-2fa.tsx +0 -165
- package/blocks/auth/login-basic.tsx +0 -94
- package/blocks/auth/login-social.tsx +0 -148
- package/blocks/auth/magic-link.tsx +0 -129
- package/blocks/auth/password-reset.tsx +0 -97
- package/blocks/auth/signup.tsx +0 -157
- 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/data-display/activity-feed.tsx +0 -242
- package/blocks/data-display/data-table.tsx +0 -235
- package/blocks/data-display/stats-grid.tsx +0 -194
- 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/ecommerce/checkout.tsx +0 -242
- package/blocks/ecommerce/index.ts +0 -7
- package/blocks/ecommerce/product-detail.tsx +0 -257
- package/blocks/ecommerce/product-grid.tsx +0 -148
- package/blocks/ecommerce/shopping-cart.tsx +0 -181
- package/blocks/index.ts +0 -2
- package/blocks/marketing/cta-section.tsx +0 -207
- package/blocks/marketing/faq.tsx +0 -159
- package/blocks/marketing/features-grid.tsx +0 -156
- package/blocks/marketing/hero-section.tsx +0 -192
- package/blocks/marketing/index.ts +0 -6
- package/blocks/marketing/pricing-table.tsx +0 -121
- package/blocks/marketing/testimonials.tsx +0 -196
- package/components/index.ts +0 -9
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/tailwind.js +0 -2025
- package/dist/tailwind.js.map +0 -1
- package/dist/tailwind.mjs +0 -2013
- package/dist/tailwind.mjs.map +0 -1
- package/dist/types.js +0 -59
- package/dist/types.js.map +0 -1
- package/dist/types.mjs +0 -53
- package/dist/types.mjs.map +0 -1
- package/dist/utils.js +0 -30
- package/dist/utils.js.map +0 -1
- package/dist/utils.mjs +0 -26
- package/dist/utils.mjs.map +0 -1
- package/frameworks/core/index.ts +0 -6
- package/frameworks/core/utils/index.ts +0 -64
- package/frameworks/react/components/button.tsx +0 -26
- package/frameworks/react/components/index.ts +0 -5
- package/frameworks/react/hooks/index.ts +0 -5
- package/frameworks/react/index.ts +0 -9
- package/frameworks/react/package.json +0 -8
- package/frameworks/react/utils/index.ts +0 -2
- package/frameworks/react-native/index.ts +0 -9
- package/frameworks/react-native/package.json +0 -8
- package/frameworks/registry.json +0 -371
- package/frameworks/setup.sh +0 -69
- package/frameworks/svelte/index.ts +0 -9
- package/frameworks/svelte/package.json +0 -8
- package/frameworks/tracker.json +0 -1854
- package/frameworks/vue/index.ts +0 -9
- package/frameworks/vue/package.json +0 -8
- package/helpers/file.ts +0 -33
- package/helpers/memoization.ts +0 -40
- package/primitives/accordion.tsx +0 -74
- package/primitives/action-button.tsx +0 -42
- package/primitives/alert-dialog.tsx +0 -185
- package/primitives/alert.tsx +0 -74
- package/primitives/apply-typography.tsx +0 -55
- package/primitives/aspect-ratio.tsx +0 -5
- package/primitives/avatar.tsx +0 -57
- package/primitives/background-beams.tsx +0 -142
- package/primitives/badge.tsx +0 -45
- package/primitives/breadcrumb.tsx +0 -130
- package/primitives/breakpoint-indicator.tsx +0 -19
- package/primitives/button.tsx +0 -72
- package/primitives/calendar.tsx +0 -72
- package/primitives/card.tsx +0 -97
- package/primitives/carousel.tsx +0 -238
- package/primitives/chat/chat-input-area.tsx +0 -88
- package/primitives/chat/chat-input.tsx +0 -71
- package/primitives/chat/files-preview.tsx +0 -331
- package/primitives/chat/index.ts +0 -6
- package/primitives/chat/json-form.tsx +0 -8
- package/primitives/chat/message-list.tsx +0 -308
- package/primitives/chat/message.tsx +0 -569
- package/primitives/chat/sqlite-preview.tsx +0 -215
- package/primitives/checkbox.tsx +0 -32
- package/primitives/collapsible.tsx +0 -9
- package/primitives/combobox.tsx +0 -239
- package/primitives/command.tsx +0 -151
- package/primitives/context-menu.tsx +0 -206
- package/primitives/copy-to-clipboard-icon.tsx +0 -60
- package/primitives/dialog-video-controller.tsx +0 -38
- package/primitives/dialog.tsx +0 -128
- package/primitives/dot-pattern.tsx +0 -57
- package/primitives/dots-loader.tsx +0 -13
- package/primitives/drawer.tsx +0 -113
- package/primitives/dropdown-menu.tsx +0 -199
- package/primitives/error-message.tsx +0 -19
- package/primitives/file-uploader.tsx +0 -203
- package/primitives/form.tsx +0 -185
- package/primitives/hover-card.tsx +0 -28
- 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-client.ts +0 -4
- package/primitives/index-common.ts +0 -304
- package/primitives/index-next.ts +0 -4
- package/primitives/input-otp.tsx +0 -65
- package/primitives/input.tsx +0 -128
- package/primitives/label.tsx +0 -21
- package/primitives/list-adaptor.ts +0 -12
- package/primitives/list-box.tsx +0 -74
- package/primitives/loading-spinner.tsx +0 -33
- package/primitives/markdown-preview.tsx +0 -612
- package/primitives/mermaid.tsx +0 -196
- package/primitives/navigation-menu.tsx +0 -147
- package/primitives/next/image.tsx +0 -91
- 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 -52
- package/primitives/next/nav-items.tsx +0 -45
- package/primitives/next/youtube-embed.tsx +0 -83
- package/primitives/pagination.tsx +0 -117
- package/primitives/popover.tsx +0 -34
- package/primitives/pretty-json-print.tsx +0 -28
- package/primitives/progress.tsx +0 -27
- package/primitives/prompt-textarea.tsx +0 -72
- package/primitives/qr-code.tsx +0 -112
- package/primitives/radio-group.tsx +0 -42
- package/primitives/resizable.tsx +0 -47
- package/primitives/scroll-area.tsx +0 -57
- package/primitives/search-input.tsx +0 -66
- package/primitives/select.tsx +0 -122
- package/primitives/separator.tsx +0 -26
- package/primitives/sheet.tsx +0 -139
- package/primitives/skeleton.tsx +0 -18
- package/primitives/slider.tsx +0 -63
- package/primitives/sonner.tsx +0 -35
- package/primitives/step-indicator.tsx +0 -69
- package/primitives/stepper.tsx +0 -272
- package/primitives/switch.tsx +0 -27
- package/primitives/table.tsx +0 -105
- package/primitives/tabs.tsx +0 -50
- package/primitives/text-area.tsx +0 -26
- package/primitives/text-link.tsx +0 -27
- package/primitives/textarea.tsx +0 -64
- package/primitives/textfield.tsx +0 -78
- package/primitives/toast.tsx +0 -30
- package/primitives/toggle-group.tsx +0 -63
- package/primitives/toggle.tsx +0 -44
- package/primitives/tooltip.tsx +0 -47
- package/primitives/video-player.tsx +0 -23
- package/src/button.ts +0 -1
- package/src/hooks/index.ts +0 -7
- package/src/hooks/use-click-away.ts +0 -31
- package/src/hooks/use-combined-refs.ts +0 -22
- package/src/hooks/use-copy-clipboard.ts +0 -30
- package/src/hooks/use-debounce.ts +0 -17
- package/src/hooks/use-fill-ids.ts +0 -25
- package/src/hooks/use-map.ts +0 -26
- package/src/hooks/use-measure.ts +0 -42
- package/src/hooks/use-reverse-video-playback.ts +0 -43
- package/src/hooks/use-scroll-restoration.ts +0 -50
- package/src/index-lean.ts +0 -87
- package/src/index.ts +0 -54
- 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/src/utils.ts +0 -19
- 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/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 -30
- 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/blob.ts +0 -33
- package/util/copy-to-clipboard.ts +0 -17
- package/util/create-shadow-root.ts +0 -22
- package/util/date.ts +0 -84
- package/util/debounce.ts +0 -11
- package/util/file.ts +0 -15
- package/util/format-and-abbreviate-as-currency.ts +0 -125
- package/util/format-text.ts +0 -34
- package/util/format-to-max-char.ts +0 -68
- package/util/index-client.ts +0 -3
- package/util/index.ts +0 -112
- package/util/number-abbreviate.ts +0 -49
- package/util/specifier.ts +0 -43
- package/util/spread-to-transform.ts +0 -25
- package/util/step-animation.ts +0 -90
- package/util/timing.ts +0 -3
- package/util/toasts.tsx +0 -17
- package/util/two-way-map.ts +0 -19
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React, { useEffect, useLayoutEffect, useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import Image from 'next/image'
|
|
5
|
-
|
|
6
|
-
import type { Dimensions, TShirtSize, TShirtDimensions } from '../../types'
|
|
7
|
-
import { constrain, asNum, cn } from '../../util'
|
|
8
|
-
import type { VideoBlock } from '../def'
|
|
9
|
-
import { VideoPlayer } from '../../primitives/index-common'
|
|
10
|
-
|
|
11
|
-
import type BlockComponentProps from './block-component-props'
|
|
12
|
-
|
|
13
|
-
const VideoBlockComponent: React.FC<BlockComponentProps & {
|
|
14
|
-
usePoster?: boolean
|
|
15
|
-
size?: TShirtSize
|
|
16
|
-
constrainTo?: Dimensions
|
|
17
|
-
}> = ({
|
|
18
|
-
block,
|
|
19
|
-
className='',
|
|
20
|
-
agent,
|
|
21
|
-
usePoster=false,
|
|
22
|
-
size='md',
|
|
23
|
-
constrainTo
|
|
24
|
-
}) => {
|
|
25
|
-
|
|
26
|
-
const [_dim, setDim] = useState<Dimensions | undefined>(undefined)
|
|
27
|
-
|
|
28
|
-
const onResize = () => {
|
|
29
|
-
setDim({
|
|
30
|
-
w: window.innerWidth,
|
|
31
|
-
h: window.innerHeight
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const windowDefined = typeof window !== 'undefined'
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (window && agent === 'desktop') {
|
|
39
|
-
window.addEventListener('resize', onResize)
|
|
40
|
-
return () => window.removeEventListener('resize', onResize)
|
|
41
|
-
}
|
|
42
|
-
}, [windowDefined])
|
|
43
|
-
|
|
44
|
-
useLayoutEffect(() => {
|
|
45
|
-
onResize()
|
|
46
|
-
}, [])
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (block.blockType !== 'video') {
|
|
50
|
-
return <>video block required</>
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const b = block as VideoBlock
|
|
54
|
-
const ar = b.dim.md.w / b.dim.md.h
|
|
55
|
-
if (agent === 'phone') {
|
|
56
|
-
if (b.sizing?.mobile?.vw) {
|
|
57
|
-
// serverside, or at least while the video is loading,
|
|
58
|
-
// generate the css for the correctly sized poster image
|
|
59
|
-
if (!_dim) {
|
|
60
|
-
const width = `${b.sizing.mobile.vw}vw`
|
|
61
|
-
return <div className='dummy-div' style={{
|
|
62
|
-
maxWidth: '100%',
|
|
63
|
-
maxHeight: '100%',
|
|
64
|
-
width,
|
|
65
|
-
height: `calc(${width}/${ar})`,
|
|
66
|
-
backgroundImage: `url(${b.poster!})`,
|
|
67
|
-
backgroundSize: 'contain',
|
|
68
|
-
backgroundRepeat: 'no-repeat',
|
|
69
|
-
}} />
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
const width = ((b.sizing.mobile.vw / 100) * _dim.w)
|
|
73
|
-
const dim = {
|
|
74
|
-
h: width / ar,
|
|
75
|
-
w: width
|
|
76
|
-
}
|
|
77
|
-
return ((
|
|
78
|
-
<VideoPlayer
|
|
79
|
-
className={cn('mx-auto', className)}
|
|
80
|
-
sources={b.sources}
|
|
81
|
-
width={dim.w}
|
|
82
|
-
height={dim.h}
|
|
83
|
-
{...b.videoProps}
|
|
84
|
-
/>
|
|
85
|
-
))
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else if (b.sizing?.vh) {
|
|
90
|
-
// serverside, generate the css for the correctly sized poster image
|
|
91
|
-
if (!_dim) {
|
|
92
|
-
const height = `${b.sizing.vh}vh`
|
|
93
|
-
return <div className='dummy-div' style={{
|
|
94
|
-
maxWidth: '100%',
|
|
95
|
-
maxHeight: '100%',
|
|
96
|
-
height: height,
|
|
97
|
-
width: `calc(${height}*${ar})`,
|
|
98
|
-
backgroundImage: `url(${b.poster!})`,
|
|
99
|
-
backgroundSize: 'contain',
|
|
100
|
-
backgroundRepeat: 'no-repeat',
|
|
101
|
-
}} />
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
|
|
105
|
-
const height = ((b.sizing.vh / 100) * _dim.h)
|
|
106
|
-
const dim = {
|
|
107
|
-
h: height,
|
|
108
|
-
w: height * ar
|
|
109
|
-
}
|
|
110
|
-
return ((
|
|
111
|
-
<VideoPlayer
|
|
112
|
-
className={cn('mx-auto', className)}
|
|
113
|
-
sources={b.sources}
|
|
114
|
-
width={dim.w}
|
|
115
|
-
height={dim.h}
|
|
116
|
-
{...b.videoProps}
|
|
117
|
-
/>
|
|
118
|
-
))
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const videoDims = b.dim as TShirtDimensions
|
|
123
|
-
const dim = ((size && size in videoDims) ? videoDims[size] : videoDims.md) as Dimensions
|
|
124
|
-
const conDim = (constrainTo ? constrain(dim, constrainTo) : dim)
|
|
125
|
-
return usePoster ? (
|
|
126
|
-
<Image src={b.poster!} alt='image' width={conDim.w} height={conDim.h} className={className}/>
|
|
127
|
-
) : (
|
|
128
|
-
<VideoPlayer
|
|
129
|
-
className={cn('mx-auto', className)}
|
|
130
|
-
sources={b.sources}
|
|
131
|
-
width={conDim.w}
|
|
132
|
-
height={conDim.h}
|
|
133
|
-
{...b.videoProps}
|
|
134
|
-
/>
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export default VideoBlockComponent
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { cn } from '@hanzo/ui/util'
|
|
4
|
-
import { Avatar, AvatarFallback, AvatarImage } from '@hanzo/ui/primitives'
|
|
5
|
-
import { Badge } from '@hanzo/ui/primitives'
|
|
6
|
-
import { Card, CardContent, CardHeader, CardTitle } from '@hanzo/ui/primitives'
|
|
7
|
-
import type { LucideIcon } from 'lucide-react'
|
|
8
|
-
|
|
9
|
-
interface Activity {
|
|
10
|
-
id: string | number
|
|
11
|
-
user: {
|
|
12
|
-
name: string
|
|
13
|
-
avatar?: string
|
|
14
|
-
email?: string
|
|
15
|
-
}
|
|
16
|
-
action: string
|
|
17
|
-
target?: string
|
|
18
|
-
timestamp: Date | string
|
|
19
|
-
type?: 'default' | 'success' | 'warning' | 'error' | 'info'
|
|
20
|
-
icon?: LucideIcon
|
|
21
|
-
metadata?: Record<string, any>
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface ActivityFeedProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
25
|
-
activities: Activity[]
|
|
26
|
-
title?: string
|
|
27
|
-
variant?: 'default' | 'timeline' | 'compact'
|
|
28
|
-
showDate?: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function ActivityFeed({
|
|
32
|
-
className,
|
|
33
|
-
activities,
|
|
34
|
-
title,
|
|
35
|
-
variant = 'default',
|
|
36
|
-
showDate = true,
|
|
37
|
-
...props
|
|
38
|
-
}: ActivityFeedProps) {
|
|
39
|
-
const formatTime = (timestamp: Date | string) => {
|
|
40
|
-
const date = new Date(timestamp)
|
|
41
|
-
const now = new Date()
|
|
42
|
-
const diff = now.getTime() - date.getTime()
|
|
43
|
-
|
|
44
|
-
const minutes = Math.floor(diff / 60000)
|
|
45
|
-
const hours = Math.floor(diff / 3600000)
|
|
46
|
-
const days = Math.floor(diff / 86400000)
|
|
47
|
-
|
|
48
|
-
if (minutes < 1) return 'Just now'
|
|
49
|
-
if (minutes < 60) return `${minutes} minute${minutes > 1 ? 's' : ''} ago`
|
|
50
|
-
if (hours < 24) return `${hours} hour${hours > 1 ? 's' : ''} ago`
|
|
51
|
-
if (days < 7) return `${days} day${days > 1 ? 's' : ''} ago`
|
|
52
|
-
|
|
53
|
-
return date.toLocaleDateString()
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const getTypeStyles = (type?: Activity['type']) => {
|
|
57
|
-
switch (type) {
|
|
58
|
-
case 'success':
|
|
59
|
-
return 'border-green-500 bg-green-50 text-green-900 dark:bg-green-950 dark:text-green-100'
|
|
60
|
-
case 'warning':
|
|
61
|
-
return 'border-yellow-500 bg-yellow-50 text-yellow-900 dark:bg-yellow-950 dark:text-yellow-100'
|
|
62
|
-
case 'error':
|
|
63
|
-
return 'border-red-500 bg-red-50 text-red-900 dark:bg-red-950 dark:text-red-100'
|
|
64
|
-
case 'info':
|
|
65
|
-
return 'border-blue-500 bg-blue-50 text-blue-900 dark:bg-blue-950 dark:text-blue-100'
|
|
66
|
-
default:
|
|
67
|
-
return ''
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const getUserInitials = (name: string) => {
|
|
72
|
-
return name
|
|
73
|
-
.split(' ')
|
|
74
|
-
.map((n) => n[0])
|
|
75
|
-
.join('')
|
|
76
|
-
.toUpperCase()
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (variant === 'timeline') {
|
|
80
|
-
return (
|
|
81
|
-
<div className={cn('space-y-4', className)} {...props}>
|
|
82
|
-
{title && <h3 className="text-lg font-semibold">{title}</h3>}
|
|
83
|
-
<div className="relative">
|
|
84
|
-
<div className="absolute left-6 top-0 h-full w-0.5 bg-border" />
|
|
85
|
-
<div className="space-y-6">
|
|
86
|
-
{activities.map((activity, i) => {
|
|
87
|
-
const Icon = activity.icon
|
|
88
|
-
return (
|
|
89
|
-
<div key={activity.id || i} className="relative flex gap-4">
|
|
90
|
-
<div className="relative z-10 flex h-12 w-12 items-center justify-center">
|
|
91
|
-
<div className="absolute h-3 w-3 rounded-full bg-background border-2 border-primary" />
|
|
92
|
-
</div>
|
|
93
|
-
<div className="flex-1 space-y-1">
|
|
94
|
-
<div className="flex items-start justify-between">
|
|
95
|
-
<div className="space-y-1">
|
|
96
|
-
<p className="text-sm">
|
|
97
|
-
<span className="font-semibold">{activity.user.name}</span>{' '}
|
|
98
|
-
{activity.action}
|
|
99
|
-
{activity.target && (
|
|
100
|
-
<span className="font-medium"> {activity.target}</span>
|
|
101
|
-
)}
|
|
102
|
-
</p>
|
|
103
|
-
{activity.metadata && (
|
|
104
|
-
<div className="flex flex-wrap gap-2">
|
|
105
|
-
{Object.entries(activity.metadata).map(([key, value]) => (
|
|
106
|
-
<Badge key={key} variant="secondary" className="text-xs">
|
|
107
|
-
{key}: {value}
|
|
108
|
-
</Badge>
|
|
109
|
-
))}
|
|
110
|
-
</div>
|
|
111
|
-
)}
|
|
112
|
-
</div>
|
|
113
|
-
{Icon && <Icon className="h-4 w-4 text-muted-foreground" />}
|
|
114
|
-
</div>
|
|
115
|
-
{showDate && (
|
|
116
|
-
<p className="text-xs text-muted-foreground">
|
|
117
|
-
{formatTime(activity.timestamp)}
|
|
118
|
-
</p>
|
|
119
|
-
)}
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
)
|
|
123
|
-
})}
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (variant === 'compact') {
|
|
131
|
-
return (
|
|
132
|
-
<Card className={className} {...props}>
|
|
133
|
-
{title && (
|
|
134
|
-
<CardHeader>
|
|
135
|
-
<CardTitle>{title}</CardTitle>
|
|
136
|
-
</CardHeader>
|
|
137
|
-
)}
|
|
138
|
-
<CardContent className="p-0">
|
|
139
|
-
<div className="divide-y">
|
|
140
|
-
{activities.map((activity, i) => {
|
|
141
|
-
const Icon = activity.icon
|
|
142
|
-
return (
|
|
143
|
-
<div
|
|
144
|
-
key={activity.id || i}
|
|
145
|
-
className={cn(
|
|
146
|
-
'flex items-center gap-3 px-6 py-3',
|
|
147
|
-
getTypeStyles(activity.type)
|
|
148
|
-
)}
|
|
149
|
-
>
|
|
150
|
-
<Avatar className="h-8 w-8">
|
|
151
|
-
<AvatarImage src={activity.user.avatar} />
|
|
152
|
-
<AvatarFallback className="text-xs">
|
|
153
|
-
{getUserInitials(activity.user.name)}
|
|
154
|
-
</AvatarFallback>
|
|
155
|
-
</Avatar>
|
|
156
|
-
<div className="flex-1 min-w-0">
|
|
157
|
-
<p className="text-sm truncate">
|
|
158
|
-
<span className="font-medium">{activity.user.name}</span>{' '}
|
|
159
|
-
{activity.action}
|
|
160
|
-
{activity.target && (
|
|
161
|
-
<span className="font-medium"> {activity.target}</span>
|
|
162
|
-
)}
|
|
163
|
-
</p>
|
|
164
|
-
</div>
|
|
165
|
-
<div className="flex items-center gap-2">
|
|
166
|
-
{Icon && <Icon className="h-4 w-4 text-muted-foreground" />}
|
|
167
|
-
{showDate && (
|
|
168
|
-
<p className="text-xs text-muted-foreground">
|
|
169
|
-
{formatTime(activity.timestamp)}
|
|
170
|
-
</p>
|
|
171
|
-
)}
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
)
|
|
175
|
-
})}
|
|
176
|
-
</div>
|
|
177
|
-
</CardContent>
|
|
178
|
-
</Card>
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Default variant
|
|
183
|
-
return (
|
|
184
|
-
<div className={cn('space-y-4', className)} {...props}>
|
|
185
|
-
{title && <h3 className="text-lg font-semibold">{title}</h3>}
|
|
186
|
-
<div className="space-y-4">
|
|
187
|
-
{activities.map((activity, i) => {
|
|
188
|
-
const Icon = activity.icon
|
|
189
|
-
return (
|
|
190
|
-
<div
|
|
191
|
-
key={activity.id || i}
|
|
192
|
-
className={cn(
|
|
193
|
-
'flex gap-4 rounded-lg border p-4',
|
|
194
|
-
getTypeStyles(activity.type)
|
|
195
|
-
)}
|
|
196
|
-
>
|
|
197
|
-
<Avatar>
|
|
198
|
-
<AvatarImage src={activity.user.avatar} />
|
|
199
|
-
<AvatarFallback>
|
|
200
|
-
{getUserInitials(activity.user.name)}
|
|
201
|
-
</AvatarFallback>
|
|
202
|
-
</Avatar>
|
|
203
|
-
<div className="flex-1 space-y-1">
|
|
204
|
-
<div className="flex items-start justify-between">
|
|
205
|
-
<div>
|
|
206
|
-
<p className="text-sm">
|
|
207
|
-
<span className="font-semibold">{activity.user.name}</span>{' '}
|
|
208
|
-
{activity.action}
|
|
209
|
-
{activity.target && (
|
|
210
|
-
<span className="font-medium"> {activity.target}</span>
|
|
211
|
-
)}
|
|
212
|
-
</p>
|
|
213
|
-
{activity.user.email && (
|
|
214
|
-
<p className="text-xs text-muted-foreground">
|
|
215
|
-
{activity.user.email}
|
|
216
|
-
</p>
|
|
217
|
-
)}
|
|
218
|
-
</div>
|
|
219
|
-
{Icon && <Icon className="h-4 w-4 text-muted-foreground" />}
|
|
220
|
-
</div>
|
|
221
|
-
{activity.metadata && (
|
|
222
|
-
<div className="flex flex-wrap gap-2 pt-2">
|
|
223
|
-
{Object.entries(activity.metadata).map(([key, value]) => (
|
|
224
|
-
<Badge key={key} variant="secondary" className="text-xs">
|
|
225
|
-
{key}: {value}
|
|
226
|
-
</Badge>
|
|
227
|
-
))}
|
|
228
|
-
</div>
|
|
229
|
-
)}
|
|
230
|
-
{showDate && (
|
|
231
|
-
<p className="text-xs text-muted-foreground">
|
|
232
|
-
{formatTime(activity.timestamp)}
|
|
233
|
-
</p>
|
|
234
|
-
)}
|
|
235
|
-
</div>
|
|
236
|
-
</div>
|
|
237
|
-
)
|
|
238
|
-
})}
|
|
239
|
-
</div>
|
|
240
|
-
</div>
|
|
241
|
-
)
|
|
242
|
-
}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useState } from 'react'
|
|
4
|
-
import { cn } from '@hanzo/ui/util'
|
|
5
|
-
import {
|
|
6
|
-
Table,
|
|
7
|
-
TableBody,
|
|
8
|
-
TableCell,
|
|
9
|
-
TableHead,
|
|
10
|
-
TableHeader,
|
|
11
|
-
TableRow,
|
|
12
|
-
} from '@hanzo/ui/primitives'
|
|
13
|
-
import { Button } from '@hanzo/ui/primitives'
|
|
14
|
-
import { Input } from '@hanzo/ui/primitives'
|
|
15
|
-
import {
|
|
16
|
-
Select,
|
|
17
|
-
SelectContent,
|
|
18
|
-
SelectItem,
|
|
19
|
-
SelectTrigger,
|
|
20
|
-
SelectValue,
|
|
21
|
-
} from '@hanzo/ui/primitives'
|
|
22
|
-
import { ChevronUp, ChevronDown, Search } from 'lucide-react'
|
|
23
|
-
|
|
24
|
-
interface Column<T> {
|
|
25
|
-
key: string
|
|
26
|
-
header: string
|
|
27
|
-
accessor: (row: T) => any
|
|
28
|
-
sortable?: boolean
|
|
29
|
-
searchable?: boolean
|
|
30
|
-
render?: (value: any, row: T) => React.ReactNode
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface DataTableProps<T> extends React.ComponentPropsWithoutRef<'div'> {
|
|
34
|
-
data: T[]
|
|
35
|
-
columns: Column<T>[]
|
|
36
|
-
pageSize?: number
|
|
37
|
-
searchable?: boolean
|
|
38
|
-
title?: string
|
|
39
|
-
description?: string
|
|
40
|
-
onRowClick?: (row: T) => void
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function DataTable<T>({
|
|
44
|
-
className,
|
|
45
|
-
data,
|
|
46
|
-
columns,
|
|
47
|
-
pageSize = 10,
|
|
48
|
-
searchable = true,
|
|
49
|
-
title,
|
|
50
|
-
description,
|
|
51
|
-
onRowClick,
|
|
52
|
-
...props
|
|
53
|
-
}: DataTableProps<T>) {
|
|
54
|
-
const [currentPage, setCurrentPage] = useState(1)
|
|
55
|
-
const [searchTerm, setSearchTerm] = useState('')
|
|
56
|
-
const [sortColumn, setSortColumn] = useState<string | null>(null)
|
|
57
|
-
const [sortDirection, setSortDirection] = useState<'asc' | 'desc'>('asc')
|
|
58
|
-
const [itemsPerPage, setItemsPerPage] = useState(pageSize)
|
|
59
|
-
|
|
60
|
-
// Filter data based on search
|
|
61
|
-
const filteredData = searchTerm
|
|
62
|
-
? data.filter((row) =>
|
|
63
|
-
columns.some((column) => {
|
|
64
|
-
if (column.searchable === false) return false
|
|
65
|
-
const value = column.accessor(row)
|
|
66
|
-
return value?.toString().toLowerCase().includes(searchTerm.toLowerCase())
|
|
67
|
-
})
|
|
68
|
-
)
|
|
69
|
-
: data
|
|
70
|
-
|
|
71
|
-
// Sort data
|
|
72
|
-
const sortedData = [...filteredData].sort((a, b) => {
|
|
73
|
-
if (!sortColumn) return 0
|
|
74
|
-
|
|
75
|
-
const column = columns.find((col) => col.key === sortColumn)
|
|
76
|
-
if (!column) return 0
|
|
77
|
-
|
|
78
|
-
const aValue = column.accessor(a)
|
|
79
|
-
const bValue = column.accessor(b)
|
|
80
|
-
|
|
81
|
-
if (aValue === bValue) return 0
|
|
82
|
-
|
|
83
|
-
const comparison = aValue < bValue ? -1 : 1
|
|
84
|
-
return sortDirection === 'asc' ? comparison : -comparison
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
// Paginate data
|
|
88
|
-
const totalPages = Math.ceil(sortedData.length / itemsPerPage)
|
|
89
|
-
const startIndex = (currentPage - 1) * itemsPerPage
|
|
90
|
-
const paginatedData = sortedData.slice(startIndex, startIndex + itemsPerPage)
|
|
91
|
-
|
|
92
|
-
const handleSort = (columnKey: string) => {
|
|
93
|
-
if (sortColumn === columnKey) {
|
|
94
|
-
setSortDirection(sortDirection === 'asc' ? 'desc' : 'asc')
|
|
95
|
-
} else {
|
|
96
|
-
setSortColumn(columnKey)
|
|
97
|
-
setSortDirection('asc')
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<div className={cn('space-y-4', className)} {...props}>
|
|
103
|
-
{(title || description || searchable) && (
|
|
104
|
-
<div className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
|
105
|
-
<div>
|
|
106
|
-
{title && <h3 className="text-lg font-semibold">{title}</h3>}
|
|
107
|
-
{description && (
|
|
108
|
-
<p className="text-sm text-muted-foreground">{description}</p>
|
|
109
|
-
)}
|
|
110
|
-
</div>
|
|
111
|
-
{searchable && (
|
|
112
|
-
<div className="relative w-full sm:w-64">
|
|
113
|
-
<Search className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
|
|
114
|
-
<Input
|
|
115
|
-
placeholder="Search..."
|
|
116
|
-
value={searchTerm}
|
|
117
|
-
onChange={(e) => {
|
|
118
|
-
setSearchTerm(e.target.value)
|
|
119
|
-
setCurrentPage(1)
|
|
120
|
-
}}
|
|
121
|
-
className="pl-8"
|
|
122
|
-
/>
|
|
123
|
-
</div>
|
|
124
|
-
)}
|
|
125
|
-
</div>
|
|
126
|
-
)}
|
|
127
|
-
|
|
128
|
-
<div className="rounded-md border">
|
|
129
|
-
<Table>
|
|
130
|
-
<TableHeader>
|
|
131
|
-
<TableRow>
|
|
132
|
-
{columns.map((column) => (
|
|
133
|
-
<TableHead
|
|
134
|
-
key={column.key}
|
|
135
|
-
className={column.sortable ? 'cursor-pointer select-none' : ''}
|
|
136
|
-
onClick={() => column.sortable && handleSort(column.key)}
|
|
137
|
-
>
|
|
138
|
-
<div className="flex items-center gap-2">
|
|
139
|
-
{column.header}
|
|
140
|
-
{column.sortable && sortColumn === column.key && (
|
|
141
|
-
<>
|
|
142
|
-
{sortDirection === 'asc' ? (
|
|
143
|
-
<ChevronUp className="h-4 w-4" />
|
|
144
|
-
) : (
|
|
145
|
-
<ChevronDown className="h-4 w-4" />
|
|
146
|
-
)}
|
|
147
|
-
</>
|
|
148
|
-
)}
|
|
149
|
-
</div>
|
|
150
|
-
</TableHead>
|
|
151
|
-
))}
|
|
152
|
-
</TableRow>
|
|
153
|
-
</TableHeader>
|
|
154
|
-
<TableBody>
|
|
155
|
-
{paginatedData.length === 0 ? (
|
|
156
|
-
<TableRow>
|
|
157
|
-
<TableCell
|
|
158
|
-
colSpan={columns.length}
|
|
159
|
-
className="h-24 text-center"
|
|
160
|
-
>
|
|
161
|
-
No data available
|
|
162
|
-
</TableCell>
|
|
163
|
-
</TableRow>
|
|
164
|
-
) : (
|
|
165
|
-
paginatedData.map((row, i) => (
|
|
166
|
-
<TableRow
|
|
167
|
-
key={i}
|
|
168
|
-
className={onRowClick ? 'cursor-pointer' : ''}
|
|
169
|
-
onClick={() => onRowClick?.(row)}
|
|
170
|
-
>
|
|
171
|
-
{columns.map((column) => (
|
|
172
|
-
<TableCell key={column.key}>
|
|
173
|
-
{column.render
|
|
174
|
-
? column.render(column.accessor(row), row)
|
|
175
|
-
: column.accessor(row)}
|
|
176
|
-
</TableCell>
|
|
177
|
-
))}
|
|
178
|
-
</TableRow>
|
|
179
|
-
))
|
|
180
|
-
)}
|
|
181
|
-
</TableBody>
|
|
182
|
-
</Table>
|
|
183
|
-
</div>
|
|
184
|
-
|
|
185
|
-
{totalPages > 1 && (
|
|
186
|
-
<div className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
|
187
|
-
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
|
188
|
-
<span>Rows per page:</span>
|
|
189
|
-
<Select
|
|
190
|
-
value={itemsPerPage.toString()}
|
|
191
|
-
onValueChange={(value) => {
|
|
192
|
-
setItemsPerPage(parseInt(value))
|
|
193
|
-
setCurrentPage(1)
|
|
194
|
-
}}
|
|
195
|
-
>
|
|
196
|
-
<SelectTrigger className="h-8 w-16">
|
|
197
|
-
<SelectValue />
|
|
198
|
-
</SelectTrigger>
|
|
199
|
-
<SelectContent>
|
|
200
|
-
<SelectItem value="5">5</SelectItem>
|
|
201
|
-
<SelectItem value="10">10</SelectItem>
|
|
202
|
-
<SelectItem value="25">25</SelectItem>
|
|
203
|
-
<SelectItem value="50">50</SelectItem>
|
|
204
|
-
</SelectContent>
|
|
205
|
-
</Select>
|
|
206
|
-
</div>
|
|
207
|
-
|
|
208
|
-
<div className="flex items-center gap-2">
|
|
209
|
-
<span className="text-sm text-muted-foreground">
|
|
210
|
-
Showing {startIndex + 1}-{Math.min(startIndex + itemsPerPage, sortedData.length)} of {sortedData.length}
|
|
211
|
-
</span>
|
|
212
|
-
<div className="flex gap-1">
|
|
213
|
-
<Button
|
|
214
|
-
variant="outline"
|
|
215
|
-
size="sm"
|
|
216
|
-
onClick={() => setCurrentPage(currentPage - 1)}
|
|
217
|
-
disabled={currentPage === 1}
|
|
218
|
-
>
|
|
219
|
-
Previous
|
|
220
|
-
</Button>
|
|
221
|
-
<Button
|
|
222
|
-
variant="outline"
|
|
223
|
-
size="sm"
|
|
224
|
-
onClick={() => setCurrentPage(currentPage + 1)}
|
|
225
|
-
disabled={currentPage === totalPages}
|
|
226
|
-
>
|
|
227
|
-
Next
|
|
228
|
-
</Button>
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
</div>
|
|
232
|
-
)}
|
|
233
|
-
</div>
|
|
234
|
-
)
|
|
235
|
-
}
|