@hanzo/ui 0.5.10
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/assets/lux-site-icons/android-chrome-192x192.png +0 -0
- package/assets/lux-site-icons/android-chrome-512x512.png +0 -0
- package/assets/lux-site-icons/apple-touch-icon.png +0 -0
- package/assets/lux-site-icons/favicon-16x16.png +0 -0
- package/assets/lux-site-icons/favicon-32x32.png +0 -0
- package/assets/lux-site-icons/favicon.ico +0 -0
- package/assets/standard-docs/LUX-NFT-Terms-and-Conditions.pdf +0 -0
- package/assets/standard-docs/LUX-Privacy-Policy.pdf +0 -0
- package/blocks/components/accordian-block.tsx +48 -0
- package/blocks/components/block-component-props.ts +11 -0
- package/blocks/components/bullet-cards-block.tsx +43 -0
- package/blocks/components/card-block.tsx +213 -0
- package/blocks/components/carte-blanche-block/index.tsx +98 -0
- package/blocks/components/content.tsx +70 -0
- package/blocks/components/cta-block.tsx +98 -0
- package/blocks/components/enh-heading-block.tsx +194 -0
- package/blocks/components/grid-block/grid-block-mutator.ts +12 -0
- package/blocks/components/grid-block/index.tsx +83 -0
- package/blocks/components/grid-block/mutator-registry.ts +10 -0
- package/blocks/components/grid-block/table-borders.mutator.ts +47 -0
- package/blocks/components/group-block.tsx +83 -0
- package/blocks/components/heading-block.tsx +88 -0
- package/blocks/components/image-block.tsx +108 -0
- package/blocks/components/index.ts +30 -0
- package/blocks/components/screenful-block/content.tsx +115 -0
- package/blocks/components/screenful-block/index.tsx +77 -0
- package/blocks/components/screenful-block/poster-background.tsx +34 -0
- package/blocks/components/screenful-block/video-background.tsx +45 -0
- package/blocks/components/space-block.tsx +66 -0
- package/blocks/components/video-block.tsx +137 -0
- package/blocks/def/accordian-block.ts +14 -0
- package/blocks/def/block.ts +7 -0
- package/blocks/def/bullet-cards-block.ts +20 -0
- package/blocks/def/card-block.ts +24 -0
- package/blocks/def/carte-blanche-block.ts +20 -0
- package/blocks/def/cta-block.ts +19 -0
- package/blocks/def/element-block.ts +11 -0
- package/blocks/def/enh-heading-block.ts +45 -0
- package/blocks/def/grid-block.ts +16 -0
- package/blocks/def/group-block.ts +11 -0
- package/blocks/def/heading-block.ts +15 -0
- package/blocks/def/image-block.ts +36 -0
- package/blocks/def/index.ts +35 -0
- package/blocks/def/screenful-block.ts +51 -0
- package/blocks/def/space-block.ts +64 -0
- package/blocks/def/video-block.ts +28 -0
- package/blocks/index.ts +2 -0
- package/common/chat-widget.tsx +75 -0
- package/common/contact-dialog/contact-form.tsx +111 -0
- package/common/contact-dialog/disclaimer.tsx +13 -0
- package/common/contact-dialog/index.tsx +48 -0
- package/common/copyright.tsx +21 -0
- package/common/drawer-menu.tsx +51 -0
- package/common/footer.tsx +77 -0
- package/common/head-metadata/from-next/metadata-types.ts +158 -0
- package/common/head-metadata/from-next/opengraph-types.ts +267 -0
- package/common/head-metadata/from-next/twitter-types.ts +92 -0
- package/common/head-metadata/index.tsx +208 -0
- package/common/header/index.tsx +57 -0
- package/common/header/mobile-nav.tsx +72 -0
- package/common/header/theme-toggle.tsx +26 -0
- package/common/icons/github.tsx +14 -0
- package/common/icons/index.tsx +34 -0
- package/common/icons/lux-logo.tsx +10 -0
- package/common/icons/secure-delivery.tsx +13 -0
- package/common/icons/social-icon.tsx +35 -0
- package/common/icons/youtube-logo.tsx +59 -0
- package/common/index.ts +14 -0
- package/common/logo.tsx +71 -0
- package/common/mini-chart/index.tsx +8 -0
- package/common/mini-chart/mini-chart-props.ts +44 -0
- package/common/mini-chart/mini-chart.tsx +76 -0
- package/common/mini-chart/wrapper.tsx +23 -0
- package/context-providers/index.ts +1 -0
- package/context-providers/theme-provider.tsx +20 -0
- package/next/README.md +11 -0
- package/next/determine-device-middleware.ts +16 -0
- package/next/fonts/DrukTextWide-Bold-Trial.otf +0 -0
- package/next/fonts/DrukTextWide-Heavy-Trial.otf +0 -0
- package/next/fonts/DrukTextWide-Medium-Trial.otf +0 -0
- package/next/get-app-router-font-classes.ts +12 -0
- package/next/load-and-return-lux-next-fonts-on-import.ts +68 -0
- package/next/next-font-desc.ts +28 -0
- package/next/not-found-content.mdx +4 -0
- package/next/not-found.tsx +23 -0
- package/next/pages-router-font-vars.tsx +18 -0
- package/next/root-layout.tsx +53 -0
- package/package.json +105 -0
- package/primitives/accordion.tsx +61 -0
- package/primitives/action-button.tsx +46 -0
- package/primitives/apply-typography.tsx +55 -0
- package/primitives/avatar.tsx +49 -0
- package/primitives/badge.tsx +36 -0
- package/primitives/button.tsx +73 -0
- package/primitives/calendar.tsx +72 -0
- package/primitives/card.tsx +83 -0
- package/primitives/checkbox.tsx +32 -0
- package/primitives/command.tsx +155 -0
- package/primitives/dialog-video-controller.tsx +38 -0
- package/primitives/dialog.tsx +152 -0
- package/primitives/form.tsx +179 -0
- package/primitives/index.ts +144 -0
- package/primitives/inline-icon.tsx +37 -0
- package/primitives/input.tsx +30 -0
- package/primitives/label.tsx +28 -0
- package/primitives/link-element.tsx +104 -0
- package/primitives/main.tsx +17 -0
- package/primitives/mdx-link.tsx +22 -0
- package/primitives/nav-items.tsx +48 -0
- package/primitives/popover.tsx +35 -0
- package/primitives/progress.tsx +27 -0
- package/primitives/scroll-area.tsx +47 -0
- package/primitives/select.tsx +169 -0
- package/primitives/separator.tsx +29 -0
- package/primitives/sheet.tsx +175 -0
- package/primitives/skeleton.tsx +15 -0
- package/primitives/switch.tsx +33 -0
- package/primitives/table.tsx +117 -0
- package/primitives/tabs.tsx +60 -0
- package/primitives/tailwind-indicator.tsx +19 -0
- package/primitives/text-area.tsx +26 -0
- package/primitives/toast.tsx +129 -0
- package/primitives/toaster.tsx +37 -0
- package/primitives/use-toast.ts +192 -0
- package/primitives/video-player.tsx +26 -0
- package/primitives/youtube-embed.tsx +83 -0
- package/siteDef/footer/community.tsx +67 -0
- package/siteDef/footer/company.ts +37 -0
- package/siteDef/footer/ecosystem.ts +37 -0
- package/siteDef/footer/index.tsx +26 -0
- package/siteDef/footer/legal.ts +28 -0
- package/siteDef/footer/network.ts +33 -0
- package/siteDef/footer/svg/warpcast-logo.svg +12 -0
- package/siteDef/main-nav.ts +35 -0
- package/style/globals.css +13 -0
- package/style/hanzo-common.css +32 -0
- package/style/hanzo-default-colors.css +79 -0
- package/style/social-svg.css +3 -0
- package/tailwind/colors.tailwind.js +46 -0
- package/tailwind/fonts.tailwind.ts +31 -0
- package/tailwind/index.ts +18 -0
- package/tailwind/lux-tw-fonts.ts +32 -0
- package/tailwind/safelist.tailwind.js +26 -0
- package/tailwind/screens.tailwind.js +8 -0
- package/tailwind/spacing.tailwind.js +57 -0
- package/tailwind/tailwind.config.base.js +905 -0
- package/tailwind/tw-font-desc.ts +15 -0
- package/tailwind/typo-plugin/get-plugin-styles.js +676 -0
- package/tailwind/typo-plugin/index.d.ts +9 -0
- package/tailwind/typo-plugin/index.js +141 -0
- package/tailwind/typo-plugin/utils.js +60 -0
- package/tailwind/typography-test.mdx +36 -0
- package/types/breakpoints.ts +11 -0
- package/types/bullet-item.ts +10 -0
- package/types/button-def.ts +39 -0
- package/types/contact-info.ts +11 -0
- package/types/dimensions.ts +20 -0
- package/types/grid-def.ts +37 -0
- package/types/icon.ts +10 -0
- package/types/image-def.ts +28 -0
- package/types/index.ts +29 -0
- package/types/link-def.ts +59 -0
- package/types/site-def.ts +31 -0
- package/types/t-shirt-size.ts +5 -0
- package/util/index.ts +76 -0
- package/util/specifier.ts +43 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useRef } from 'react'
|
|
4
|
+
import { type MiniChartProps } from './mini-chart-props'
|
|
5
|
+
|
|
6
|
+
const MiniChart: React.FC<MiniChartProps> = ({
|
|
7
|
+
widgetProps,
|
|
8
|
+
containerStyles = {}
|
|
9
|
+
}) => {
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
symbol,
|
|
13
|
+
exchange,
|
|
14
|
+
lineColor,
|
|
15
|
+
topGradientColor,
|
|
16
|
+
bottomGradientColor,
|
|
17
|
+
width,
|
|
18
|
+
height,
|
|
19
|
+
autosize,
|
|
20
|
+
locale,
|
|
21
|
+
...rest
|
|
22
|
+
} = widgetProps
|
|
23
|
+
|
|
24
|
+
const symbolString = (exchange) ? `${exchange}:${symbol}` : symbol
|
|
25
|
+
|
|
26
|
+
const containerRef = useRef<HTMLDivElement | null>(null)
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!containerRef.current) {
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
const script = document.createElement('script')
|
|
33
|
+
script.type = 'text/javascript'
|
|
34
|
+
script.src = 'https://s3.tradingview.com/external-embedding/embed-widget-mini-symbol-overview.js'
|
|
35
|
+
script.async = true
|
|
36
|
+
script.onload = async () => {
|
|
37
|
+
const iframe = containerRef.current?.querySelector('iframe')
|
|
38
|
+
if (iframe && iframe instanceof Element) iframe.style.colorScheme = 'normal'
|
|
39
|
+
|
|
40
|
+
const copyDiv = document.querySelector('.tradingview-widget-copyright')
|
|
41
|
+
if (copyDiv) {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
copyDiv.classList.remove('invisible')
|
|
44
|
+
}, 1200) // from experimentation
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const config = JSON.stringify({
|
|
48
|
+
symbol: symbolString,
|
|
49
|
+
width: autosize ? '100%' : (width || 350),
|
|
50
|
+
height: autosize ? '100%' : (height || 220),
|
|
51
|
+
locale: locale ?? 'en',
|
|
52
|
+
isTransparent: 'true',
|
|
53
|
+
trendLineColor: lineColor || 'rgba(41, 98, 255, 1)',
|
|
54
|
+
underLineColor: topGradientColor || 'rgba(41, 98, 255, 0.3)',
|
|
55
|
+
underLineBottomColor: bottomGradientColor || 'rgba(41, 98, 255, 0)',
|
|
56
|
+
...rest,
|
|
57
|
+
})
|
|
58
|
+
script.innerHTML = config
|
|
59
|
+
containerRef.current.appendChild(script)
|
|
60
|
+
return () => {
|
|
61
|
+
while (containerRef.current?.firstChild) {
|
|
62
|
+
containerRef.current.removeChild(containerRef.current.firstChild)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, [ JSON.stringify(widgetProps) ])
|
|
66
|
+
|
|
67
|
+
return (<>
|
|
68
|
+
<div style={containerStyles} className='tradingview-widget-container h-[150px]' ref={containerRef} />
|
|
69
|
+
<div className='tradingview-widget-copyright border-t w-full invisible'>
|
|
70
|
+
<a href={`https://www.tradingview.com/symbols/${symbol}${exchange ? `/?exchange=${exchange}` : '' }`} rel="noopener" target="_blank">
|
|
71
|
+
<span className="text-[--secondary-2]">{symbol} quotes</span></a> by TradingView
|
|
72
|
+
</div>
|
|
73
|
+
</>)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default MiniChart
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import BaseChart from './mini-chart'
|
|
4
|
+
|
|
5
|
+
const Wrapper: React.FC<{
|
|
6
|
+
symbol: string,
|
|
7
|
+
exchange?: string
|
|
8
|
+
}> = ({
|
|
9
|
+
symbol,
|
|
10
|
+
exchange
|
|
11
|
+
}) => (
|
|
12
|
+
<BaseChart widgetProps ={{
|
|
13
|
+
symbol,
|
|
14
|
+
exchange,
|
|
15
|
+
autosize: true,
|
|
16
|
+
colorTheme: 'dark',
|
|
17
|
+
lineColor: "rgb(114, 27, 228)",
|
|
18
|
+
bottomGradientColor: "rgba(255, 255, 255, 0.1)",
|
|
19
|
+
dateRange: '60M',
|
|
20
|
+
}}/>
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
export default Wrapper
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ThemeProvider } from './theme-provider'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import React from "react"
|
|
4
|
+
import { ThemeProvider as NextThemesProvider } from "next-themes"
|
|
5
|
+
import { type ThemeProviderProps } from "next-themes/dist/types"
|
|
6
|
+
|
|
7
|
+
const ThemeProvider: React.FC<ThemeProviderProps> = ({ children, ...props }) => (
|
|
8
|
+
<NextThemesProvider
|
|
9
|
+
attribute="class"
|
|
10
|
+
{...props}
|
|
11
|
+
value={{
|
|
12
|
+
light: 'lux-light-theme',
|
|
13
|
+
dark: 'lux-dark-theme'
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
</NextThemesProvider>
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
export default ThemeProvider
|
package/next/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Next related Lux helpers
|
|
2
|
+
|
|
3
|
+
### no `index.ts` file, and `load-and-return-lux-next-fonts-on-import.ts`
|
|
4
|
+
|
|
5
|
+
Next font loading requires the fonts to be assigned to const's in module scope (ie, loaded when the module is evaluated, exactly once).
|
|
6
|
+
|
|
7
|
+
If there was an `index.ts` "barrel file", and the client code imported anything from this package, it would have resulted in evaluting all the packages imported including the that loaded the fonts. Without the index, the client code knows what modules import it and thus when it happens.
|
|
8
|
+
|
|
9
|
+
tl;dr: See [this article from Vercel](https://vercel.com/blog/how-we-optimized-package-imports-in-next-js) about this issue.
|
|
10
|
+
|
|
11
|
+
(Previously, not having this safegaurd caused a serious bug becuase the fonts were loaded far too early.)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NextRequest, NextResponse, userAgent } from 'next/server'
|
|
2
|
+
import { getSelectorsByUserAgent } from 'react-device-detect'
|
|
3
|
+
|
|
4
|
+
// writed this way so they can be chained :)
|
|
5
|
+
const determineDeviceMiddleware = async (request: NextRequest) => {
|
|
6
|
+
|
|
7
|
+
const ua = userAgent(request)
|
|
8
|
+
const { isMobileOnly, isTablet, isDesktop } = getSelectorsByUserAgent(ua.ua)
|
|
9
|
+
const agent = isMobileOnly ? 'phone' : (isTablet ? 'tablet' : (isDesktop ? 'desktop' : 'unknown'))
|
|
10
|
+
const { nextUrl: url } = request
|
|
11
|
+
//console.log(`\n=== from ${url.href} on a *${agent && agent.toUpperCase()}* device. ===\n`)
|
|
12
|
+
url.searchParams.set('agent', agent)
|
|
13
|
+
return NextResponse.rewrite(url)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default determineDeviceMiddleware
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import nextFonts from './load-and-return-lux-next-fonts-on-import'
|
|
2
|
+
import type NextFontDesc from './next-font-desc'
|
|
3
|
+
|
|
4
|
+
// These will be injected for <body> in app router app that uses our RootLayout
|
|
5
|
+
|
|
6
|
+
// First is assumed to be mapped to the default font and is injected into <body>
|
|
7
|
+
// as a normal tw font family class.
|
|
8
|
+
export default () => (
|
|
9
|
+
nextFonts.map(
|
|
10
|
+
(desc: NextFontDesc) => (desc.nextFont!.variable)
|
|
11
|
+
).join(' ') + ` font-${nextFonts[0].twName}`
|
|
12
|
+
)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Inter } from 'next/font/google'
|
|
2
|
+
import localFont from 'next/font/local'
|
|
3
|
+
|
|
4
|
+
import type NextFontDesc from './next-font-desc'
|
|
5
|
+
import type TwFontDesc from '../tailwind/tw-font-desc'
|
|
6
|
+
|
|
7
|
+
import twFonts from '../tailwind/lux-tw-fonts'
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
Creating NextFontDesc's and TwFontDesc's has to be seperated because they are needed
|
|
11
|
+
at different times during the next compile / build. Otherwise a nasty
|
|
12
|
+
race condition happens!
|
|
13
|
+
|
|
14
|
+
Also, requires that "Font loaders must be called and assigned to a const in the module scope"
|
|
15
|
+
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const drukTextWide = localFont({
|
|
19
|
+
src: [
|
|
20
|
+
{
|
|
21
|
+
path: './fonts/DrukTextWide-Medium-Trial.otf',
|
|
22
|
+
weight: '500',
|
|
23
|
+
style: 'normal'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
path: './fonts/DrukTextWide-Bold-Trial.otf',
|
|
27
|
+
weight: '700',
|
|
28
|
+
style: 'normal'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
path: './fonts/DrukTextWide-Heavy-Trial.otf',
|
|
32
|
+
weight: '800',
|
|
33
|
+
style: 'normal',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
display: 'swap',
|
|
37
|
+
variable: '--font-druk-text-wide' ,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const inter = Inter({
|
|
41
|
+
subsets: ["latin"],
|
|
42
|
+
variable: "--font-inter",
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
export default [
|
|
46
|
+
{
|
|
47
|
+
font: inter,
|
|
48
|
+
twName: 'sans'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
font: drukTextWide,
|
|
52
|
+
twName: 'heading'
|
|
53
|
+
}
|
|
54
|
+
].map (
|
|
55
|
+
(el) => {
|
|
56
|
+
const twFont: TwFontDesc | undefined = twFonts.find((twf: TwFontDesc) => (el.twName === twf.twName))
|
|
57
|
+
if (!twFont) {
|
|
58
|
+
throw new Error('lux-next-fonts: Next font is not paired to a TW font!')
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return ({
|
|
62
|
+
...twFont,
|
|
63
|
+
nextFont: el.font,
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
) as NextFontDesc[]
|
|
67
|
+
|
|
68
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type TwFontDesc from '../tailwind/tw-font-desc'
|
|
2
|
+
|
|
3
|
+
// from next repo
|
|
4
|
+
type NextFont = {
|
|
5
|
+
className: string
|
|
6
|
+
style: { fontFamily: string; fontWeight?: number; fontStyle?: string }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// from next repo
|
|
10
|
+
type NextFontWithVariable = NextFont & {
|
|
11
|
+
variable: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
NextFontDesc and TwFontDesc have to be seperate because they are needed
|
|
17
|
+
at different times during the next compile / build. Otherwise a nasty
|
|
18
|
+
race condition happens! That's why they are in different files.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface NextFontDesc extends TwFontDesc {
|
|
22
|
+
nextFont: NextFontWithVariable
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
type NextFontDesc as default,
|
|
27
|
+
type NextFontWithVariable,
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import Main from '../primitives/main'
|
|
4
|
+
import Footer from '../common/footer'
|
|
5
|
+
import { ApplyTypography } from '../primitives'
|
|
6
|
+
|
|
7
|
+
import NotFoundMDX from './not-found-content.mdx'
|
|
8
|
+
import type { SiteDef } from '../types'
|
|
9
|
+
|
|
10
|
+
const NotFound: React.FC<{
|
|
11
|
+
siteDef: SiteDef
|
|
12
|
+
}> = ({
|
|
13
|
+
siteDef
|
|
14
|
+
}) => (<>
|
|
15
|
+
<Main className='h-[700px]'>
|
|
16
|
+
<ApplyTypography className='mt-[200px] flex flex-col md:gap-8 '>
|
|
17
|
+
<NotFoundMDX />
|
|
18
|
+
</ApplyTypography>
|
|
19
|
+
</Main>
|
|
20
|
+
<Footer siteDef={siteDef}/>
|
|
21
|
+
</>)
|
|
22
|
+
|
|
23
|
+
export default NotFound
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import nextFonts from './load-and-return-lux-next-fonts-on-import'
|
|
3
|
+
import type NextFontDesc from './next-font-desc'
|
|
4
|
+
|
|
5
|
+
const PagesRouterFontVars: React.FC = () => {
|
|
6
|
+
|
|
7
|
+
const fontVars = nextFonts.map((fd: NextFontDesc) => (
|
|
8
|
+
`${fd.cssVar}: ${fd.nextFont.style.fontFamily};`
|
|
9
|
+
)).join('\n')
|
|
10
|
+
|
|
11
|
+
return <style jsx global>{`
|
|
12
|
+
html {
|
|
13
|
+
${fontVars}
|
|
14
|
+
}
|
|
15
|
+
`}</style>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default PagesRouterFontVars
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { type PropsWithChildren } from 'react'
|
|
2
|
+
|
|
3
|
+
import Header from '../common/header'
|
|
4
|
+
import type { SiteDef } from '../types'
|
|
5
|
+
import getAppRouterBodyFontClasses from './get-app-router-font-classes'
|
|
6
|
+
|
|
7
|
+
// Next 14: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#use-viewport-export
|
|
8
|
+
const viewport = {
|
|
9
|
+
themeColor: [
|
|
10
|
+
{ media: '(prefers-color-scheme: light)', color: 'white' },
|
|
11
|
+
{ media: '(prefers-color-scheme: dark)', color: 'black' },
|
|
12
|
+
],
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
These '.variable' fields are actually autogenerate css classnames that *define* the actual
|
|
17
|
+
css variables ('--<ugly-name>') that one asks for in the tailwind classes.
|
|
18
|
+
They are what make them available in the global scope. So this MUST
|
|
19
|
+
be done like this for the tailwind font classes to work.
|
|
20
|
+
|
|
21
|
+
(...not to be confused with the css var itself. This field should be named something else!)
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
re body: overflow-y-hidden overflow-x-hidden, h-full
|
|
26
|
+
We cannot have these on body tag for scroll-snap to work on iOS!
|
|
27
|
+
*/
|
|
28
|
+
const bodyClasses = 'bg-background text-foreground flex flex-col min-h-full ' + getAppRouterBodyFontClasses()
|
|
29
|
+
|
|
30
|
+
const RootLayout: React.FC<PropsWithChildren & {
|
|
31
|
+
siteDef: SiteDef
|
|
32
|
+
header?: boolean
|
|
33
|
+
}> = ({
|
|
34
|
+
header = true,
|
|
35
|
+
siteDef,
|
|
36
|
+
children,
|
|
37
|
+
}) => (
|
|
38
|
+
<html lang='en' suppressHydrationWarning className='lux-dark-theme'>
|
|
39
|
+
<head >
|
|
40
|
+
{/* https://stackoverflow.com/a/75716588/11645689 */ }
|
|
41
|
+
<base target='_blank' />
|
|
42
|
+
</head>
|
|
43
|
+
<body className={bodyClasses}>
|
|
44
|
+
{header && <Header siteDef={siteDef}/>}
|
|
45
|
+
{children}
|
|
46
|
+
</body>
|
|
47
|
+
</html>
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
RootLayout as default,
|
|
52
|
+
viewport
|
|
53
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hanzo/ui",
|
|
3
|
+
"version": "0.5.10",
|
|
4
|
+
"description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"registry": "https://registry.npmjs.org/",
|
|
7
|
+
"access": "public",
|
|
8
|
+
"scope": "@hanzo"
|
|
9
|
+
},
|
|
10
|
+
"author": "Hanzo AI, Inc.",
|
|
11
|
+
"license": "BSD-3-Clause",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/hanzoai/ui.git",
|
|
15
|
+
"directory": "pkgs/hanzo-ui"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"assets",
|
|
19
|
+
"blocks",
|
|
20
|
+
"common",
|
|
21
|
+
"context-providers",
|
|
22
|
+
"dist",
|
|
23
|
+
"next",
|
|
24
|
+
"primitives",
|
|
25
|
+
"siteDef",
|
|
26
|
+
"style",
|
|
27
|
+
"tailwind",
|
|
28
|
+
"types",
|
|
29
|
+
"util"
|
|
30
|
+
],
|
|
31
|
+
"keywords": [
|
|
32
|
+
"components",
|
|
33
|
+
"ui",
|
|
34
|
+
"radix-ui",
|
|
35
|
+
"hanzoai",
|
|
36
|
+
"hanzo"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"latest": "npm show @hanzo/ui version",
|
|
40
|
+
"pub": "npm publish",
|
|
41
|
+
"build": "tsc",
|
|
42
|
+
"tc": "tsc",
|
|
43
|
+
"clean": "rm -rf dist && rm -rf node_modules"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@hookform/resolvers": "^3.3.2",
|
|
47
|
+
"@radix-ui/react-accordion": "^1.1.2",
|
|
48
|
+
"@radix-ui/react-avatar": "^1.0.3",
|
|
49
|
+
"@radix-ui/react-checkbox": "^1.0.4",
|
|
50
|
+
"@radix-ui/react-dialog": "^1.0.5",
|
|
51
|
+
"@radix-ui/react-icons": "^1.3.0",
|
|
52
|
+
"@radix-ui/react-label": "^2.0.2",
|
|
53
|
+
"@radix-ui/react-popover": "^1.0.6",
|
|
54
|
+
"@radix-ui/react-progress": "^1.0.3",
|
|
55
|
+
"@radix-ui/react-scroll-area": "^1.0.5",
|
|
56
|
+
"@radix-ui/react-select": "^2.0.0",
|
|
57
|
+
"@radix-ui/react-separator": "^1.0.3",
|
|
58
|
+
"@radix-ui/react-slot": "^1.0.2",
|
|
59
|
+
"@radix-ui/react-switch": "^1.0.3",
|
|
60
|
+
"@radix-ui/react-tabs": "^1.0.4",
|
|
61
|
+
"@radix-ui/react-toast": "^1.1.5",
|
|
62
|
+
"@tailwindcss/container-queries": "^0.1.1",
|
|
63
|
+
"class-variance-authority": "^0.7.0",
|
|
64
|
+
"clsx": "^2.1.0",
|
|
65
|
+
"cmdk": "^0.2.0",
|
|
66
|
+
"lodash.castarray": "^4.4.0",
|
|
67
|
+
"lodash.isplainobject": "^4.0.6",
|
|
68
|
+
"lodash.merge": "^4.6.2",
|
|
69
|
+
"lucide-react": "^0.307.0",
|
|
70
|
+
"markdown-to-jsx": "^7.3.2",
|
|
71
|
+
"postcss-selector-parser": "^6.0.13",
|
|
72
|
+
"react-day-picker": "^8.7.1",
|
|
73
|
+
"react-device-detect": "^2.2.3",
|
|
74
|
+
"react-hook-form": "^7.47.0",
|
|
75
|
+
"react-intersection-observer": "^9.7.0",
|
|
76
|
+
"react-social-icons": "^6.4.0",
|
|
77
|
+
"tailwind-merge": "^2.2.0",
|
|
78
|
+
"tailwindcss-animate": "^1.0.6",
|
|
79
|
+
"tailwindcss-interaction-media": "^0.1.0",
|
|
80
|
+
"validator": "^13.11.0",
|
|
81
|
+
"zod": "3.21.4"
|
|
82
|
+
},
|
|
83
|
+
"peerDependencies": {
|
|
84
|
+
"@next/mdx": "^14.1.0",
|
|
85
|
+
"next": "^14.1.0",
|
|
86
|
+
"next-themes": "^0.2.1",
|
|
87
|
+
"react": "^18.2.0",
|
|
88
|
+
"react-dom": "^18.2.0"
|
|
89
|
+
},
|
|
90
|
+
"devDependencies": {
|
|
91
|
+
"@mdx-js/esbuild": "^3.0.0",
|
|
92
|
+
"@mdx-js/loader": "^3.0.0",
|
|
93
|
+
"@mdx-js/react": "^3.0.0",
|
|
94
|
+
"@types/lodash.merge": "^4.6.9",
|
|
95
|
+
"@types/mdx": "^2.0.9",
|
|
96
|
+
"@types/react": "^18.2.48",
|
|
97
|
+
"@types/react-dom": "^18.2.18",
|
|
98
|
+
"autoprefixer": "^10.4.16",
|
|
99
|
+
"path": "^0.12.7",
|
|
100
|
+
"postcss": "^8.4.33",
|
|
101
|
+
"postcss-import": "^16.0.0",
|
|
102
|
+
"tailwindcss": "^3.4.1",
|
|
103
|
+
"typescript": "^5.3.3"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
"use client"
|
|
3
|
+
|
|
4
|
+
import * as React from "react"
|
|
5
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
|
6
|
+
import { ChevronDown } from "lucide-react"
|
|
7
|
+
|
|
8
|
+
import { cn } from "../util"
|
|
9
|
+
|
|
10
|
+
const Accordion = AccordionPrimitive.Root
|
|
11
|
+
|
|
12
|
+
const AccordionItem = React.forwardRef<
|
|
13
|
+
React.ElementRef<typeof AccordionPrimitive.Item>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
|
15
|
+
>(({ className, ...props }, ref) => (
|
|
16
|
+
<AccordionPrimitive.Item
|
|
17
|
+
ref={ref}
|
|
18
|
+
className={cn("border-b", className)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
))
|
|
22
|
+
AccordionItem.displayName = "AccordionItem"
|
|
23
|
+
|
|
24
|
+
const AccordionTrigger = React.forwardRef<
|
|
25
|
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
26
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
|
|
27
|
+
>(({ className, children, ...props }, ref) => (
|
|
28
|
+
<AccordionPrimitive.Header className="flex">
|
|
29
|
+
<AccordionPrimitive.Trigger
|
|
30
|
+
ref={ref}
|
|
31
|
+
className={cn(
|
|
32
|
+
"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
<ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
|
|
39
|
+
</AccordionPrimitive.Trigger>
|
|
40
|
+
</AccordionPrimitive.Header>
|
|
41
|
+
))
|
|
42
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
|
|
43
|
+
|
|
44
|
+
const AccordionContent = React.forwardRef<
|
|
45
|
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
|
46
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
|
47
|
+
>(({ className, children, ...props }, ref) => (
|
|
48
|
+
<AccordionPrimitive.Content
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn(
|
|
51
|
+
"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
|
|
52
|
+
className
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</AccordionPrimitive.Content>
|
|
58
|
+
))
|
|
59
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName
|
|
60
|
+
|
|
61
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import dynamic from 'next/dynamic'
|
|
3
|
+
|
|
4
|
+
import { cn } from '../util'
|
|
5
|
+
|
|
6
|
+
import type { ButtonDef, ButtonModalDef } from '../types'
|
|
7
|
+
import type { ButtonSizes } from './button'
|
|
8
|
+
|
|
9
|
+
// The DVC must be rendered client-side since it accesses the DOM directly.
|
|
10
|
+
// There is no need for a loading UI since the dialog only opens
|
|
11
|
+
// once it's been rendered and the user is already waiting.
|
|
12
|
+
// https://nextjs.org/docs/app/building-your-application/optimizing/lazy-loading
|
|
13
|
+
const DynamicDVC = dynamic(() => (import('./dialog-video-controller')), {ssr: false})
|
|
14
|
+
|
|
15
|
+
const ActionButton: React.FC<{
|
|
16
|
+
def: ButtonDef
|
|
17
|
+
size?: ButtonSizes
|
|
18
|
+
className?: string
|
|
19
|
+
}> = ({
|
|
20
|
+
def,
|
|
21
|
+
size, // no default. overrides!
|
|
22
|
+
className=''
|
|
23
|
+
}) => {
|
|
24
|
+
if (def.action.type === 'modal') {
|
|
25
|
+
const m = def.action.def as ButtonModalDef
|
|
26
|
+
const Modal = m.Comp
|
|
27
|
+
const sizeToSpread = size ? {size} : {}
|
|
28
|
+
return (
|
|
29
|
+
<DynamicDVC>
|
|
30
|
+
<Modal
|
|
31
|
+
title={m.title}
|
|
32
|
+
byline={m.byline}
|
|
33
|
+
buttonText={def.text}
|
|
34
|
+
buttonProps={{...def.props, ...sizeToSpread, className: cn((def.props?.className ?? ''), className)}}
|
|
35
|
+
action={m.action}
|
|
36
|
+
actionEnclosure={m.actionEnclosure}
|
|
37
|
+
{...m.props}
|
|
38
|
+
/>
|
|
39
|
+
</DynamicDVC>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
// no other types supported yet
|
|
43
|
+
return <></>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default ActionButton
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { type PropsWithChildren } from 'react'
|
|
2
|
+
|
|
3
|
+
import { cn } from '../util'
|
|
4
|
+
|
|
5
|
+
type TypographySize = 'responsive' | 'sm' | 'base' | 'lg' | 'xl' // if t-shirt size, do *not* be responsive
|
|
6
|
+
|
|
7
|
+
const ApplyTypography: React.FC<
|
|
8
|
+
PropsWithChildren & {
|
|
9
|
+
className?: string,
|
|
10
|
+
asTag?: 'div' | 'section' | 'nav' | 'main' | 'article',
|
|
11
|
+
size?: TypographySize
|
|
12
|
+
}
|
|
13
|
+
> = ({
|
|
14
|
+
children,
|
|
15
|
+
className='',
|
|
16
|
+
asTag='div',
|
|
17
|
+
size='responsive'
|
|
18
|
+
}) => {
|
|
19
|
+
|
|
20
|
+
// responsive version by default
|
|
21
|
+
let typoClasses =
|
|
22
|
+
'typography gap-3 ' +
|
|
23
|
+
'xs:typography-sm ' +
|
|
24
|
+
'sm:typography sm:gap-4 ' +
|
|
25
|
+
'lg:typography-lg lg:gap-5 ' +
|
|
26
|
+
'xl:typography-xl xl:gap-6 ' +
|
|
27
|
+
'typography-headings:font-heading ' // only effects h1-h3 (in plugin)
|
|
28
|
+
|
|
29
|
+
switch (size) {
|
|
30
|
+
case 'sm': {
|
|
31
|
+
typoClasses = 'typography typography-sm gap-3 typography-headings:font-heading typography-p:text-sm '
|
|
32
|
+
} break
|
|
33
|
+
case 'base': {
|
|
34
|
+
typoClasses = 'typography gap-4 typography-headings:font-heading '
|
|
35
|
+
} break
|
|
36
|
+
case 'lg': {
|
|
37
|
+
typoClasses = 'typography typography-lg gap-5 typography-headings:font-heading typography-p:text-lg '
|
|
38
|
+
} break
|
|
39
|
+
case 'xl': {
|
|
40
|
+
typoClasses = 'typography typography-xl gap-6 typography-headings:font-heading typography-p:text-lg '
|
|
41
|
+
} break
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const Tag = asTag
|
|
45
|
+
return (
|
|
46
|
+
<Tag className={cn(typoClasses, className)}>
|
|
47
|
+
{children}
|
|
48
|
+
</Tag>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
type TypographySize,
|
|
54
|
+
ApplyTypography as default
|
|
55
|
+
}
|