@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.
Files changed (166) hide show
  1. package/assets/lux-site-icons/android-chrome-192x192.png +0 -0
  2. package/assets/lux-site-icons/android-chrome-512x512.png +0 -0
  3. package/assets/lux-site-icons/apple-touch-icon.png +0 -0
  4. package/assets/lux-site-icons/favicon-16x16.png +0 -0
  5. package/assets/lux-site-icons/favicon-32x32.png +0 -0
  6. package/assets/lux-site-icons/favicon.ico +0 -0
  7. package/assets/standard-docs/LUX-NFT-Terms-and-Conditions.pdf +0 -0
  8. package/assets/standard-docs/LUX-Privacy-Policy.pdf +0 -0
  9. package/blocks/components/accordian-block.tsx +48 -0
  10. package/blocks/components/block-component-props.ts +11 -0
  11. package/blocks/components/bullet-cards-block.tsx +43 -0
  12. package/blocks/components/card-block.tsx +213 -0
  13. package/blocks/components/carte-blanche-block/index.tsx +98 -0
  14. package/blocks/components/content.tsx +70 -0
  15. package/blocks/components/cta-block.tsx +98 -0
  16. package/blocks/components/enh-heading-block.tsx +194 -0
  17. package/blocks/components/grid-block/grid-block-mutator.ts +12 -0
  18. package/blocks/components/grid-block/index.tsx +83 -0
  19. package/blocks/components/grid-block/mutator-registry.ts +10 -0
  20. package/blocks/components/grid-block/table-borders.mutator.ts +47 -0
  21. package/blocks/components/group-block.tsx +83 -0
  22. package/blocks/components/heading-block.tsx +88 -0
  23. package/blocks/components/image-block.tsx +108 -0
  24. package/blocks/components/index.ts +30 -0
  25. package/blocks/components/screenful-block/content.tsx +115 -0
  26. package/blocks/components/screenful-block/index.tsx +77 -0
  27. package/blocks/components/screenful-block/poster-background.tsx +34 -0
  28. package/blocks/components/screenful-block/video-background.tsx +45 -0
  29. package/blocks/components/space-block.tsx +66 -0
  30. package/blocks/components/video-block.tsx +137 -0
  31. package/blocks/def/accordian-block.ts +14 -0
  32. package/blocks/def/block.ts +7 -0
  33. package/blocks/def/bullet-cards-block.ts +20 -0
  34. package/blocks/def/card-block.ts +24 -0
  35. package/blocks/def/carte-blanche-block.ts +20 -0
  36. package/blocks/def/cta-block.ts +19 -0
  37. package/blocks/def/element-block.ts +11 -0
  38. package/blocks/def/enh-heading-block.ts +45 -0
  39. package/blocks/def/grid-block.ts +16 -0
  40. package/blocks/def/group-block.ts +11 -0
  41. package/blocks/def/heading-block.ts +15 -0
  42. package/blocks/def/image-block.ts +36 -0
  43. package/blocks/def/index.ts +35 -0
  44. package/blocks/def/screenful-block.ts +51 -0
  45. package/blocks/def/space-block.ts +64 -0
  46. package/blocks/def/video-block.ts +28 -0
  47. package/blocks/index.ts +2 -0
  48. package/common/chat-widget.tsx +75 -0
  49. package/common/contact-dialog/contact-form.tsx +111 -0
  50. package/common/contact-dialog/disclaimer.tsx +13 -0
  51. package/common/contact-dialog/index.tsx +48 -0
  52. package/common/copyright.tsx +21 -0
  53. package/common/drawer-menu.tsx +51 -0
  54. package/common/footer.tsx +77 -0
  55. package/common/head-metadata/from-next/metadata-types.ts +158 -0
  56. package/common/head-metadata/from-next/opengraph-types.ts +267 -0
  57. package/common/head-metadata/from-next/twitter-types.ts +92 -0
  58. package/common/head-metadata/index.tsx +208 -0
  59. package/common/header/index.tsx +57 -0
  60. package/common/header/mobile-nav.tsx +72 -0
  61. package/common/header/theme-toggle.tsx +26 -0
  62. package/common/icons/github.tsx +14 -0
  63. package/common/icons/index.tsx +34 -0
  64. package/common/icons/lux-logo.tsx +10 -0
  65. package/common/icons/secure-delivery.tsx +13 -0
  66. package/common/icons/social-icon.tsx +35 -0
  67. package/common/icons/youtube-logo.tsx +59 -0
  68. package/common/index.ts +14 -0
  69. package/common/logo.tsx +71 -0
  70. package/common/mini-chart/index.tsx +8 -0
  71. package/common/mini-chart/mini-chart-props.ts +44 -0
  72. package/common/mini-chart/mini-chart.tsx +76 -0
  73. package/common/mini-chart/wrapper.tsx +23 -0
  74. package/context-providers/index.ts +1 -0
  75. package/context-providers/theme-provider.tsx +20 -0
  76. package/next/README.md +11 -0
  77. package/next/determine-device-middleware.ts +16 -0
  78. package/next/fonts/DrukTextWide-Bold-Trial.otf +0 -0
  79. package/next/fonts/DrukTextWide-Heavy-Trial.otf +0 -0
  80. package/next/fonts/DrukTextWide-Medium-Trial.otf +0 -0
  81. package/next/get-app-router-font-classes.ts +12 -0
  82. package/next/load-and-return-lux-next-fonts-on-import.ts +68 -0
  83. package/next/next-font-desc.ts +28 -0
  84. package/next/not-found-content.mdx +4 -0
  85. package/next/not-found.tsx +23 -0
  86. package/next/pages-router-font-vars.tsx +18 -0
  87. package/next/root-layout.tsx +53 -0
  88. package/package.json +105 -0
  89. package/primitives/accordion.tsx +61 -0
  90. package/primitives/action-button.tsx +46 -0
  91. package/primitives/apply-typography.tsx +55 -0
  92. package/primitives/avatar.tsx +49 -0
  93. package/primitives/badge.tsx +36 -0
  94. package/primitives/button.tsx +73 -0
  95. package/primitives/calendar.tsx +72 -0
  96. package/primitives/card.tsx +83 -0
  97. package/primitives/checkbox.tsx +32 -0
  98. package/primitives/command.tsx +155 -0
  99. package/primitives/dialog-video-controller.tsx +38 -0
  100. package/primitives/dialog.tsx +152 -0
  101. package/primitives/form.tsx +179 -0
  102. package/primitives/index.ts +144 -0
  103. package/primitives/inline-icon.tsx +37 -0
  104. package/primitives/input.tsx +30 -0
  105. package/primitives/label.tsx +28 -0
  106. package/primitives/link-element.tsx +104 -0
  107. package/primitives/main.tsx +17 -0
  108. package/primitives/mdx-link.tsx +22 -0
  109. package/primitives/nav-items.tsx +48 -0
  110. package/primitives/popover.tsx +35 -0
  111. package/primitives/progress.tsx +27 -0
  112. package/primitives/scroll-area.tsx +47 -0
  113. package/primitives/select.tsx +169 -0
  114. package/primitives/separator.tsx +29 -0
  115. package/primitives/sheet.tsx +175 -0
  116. package/primitives/skeleton.tsx +15 -0
  117. package/primitives/switch.tsx +33 -0
  118. package/primitives/table.tsx +117 -0
  119. package/primitives/tabs.tsx +60 -0
  120. package/primitives/tailwind-indicator.tsx +19 -0
  121. package/primitives/text-area.tsx +26 -0
  122. package/primitives/toast.tsx +129 -0
  123. package/primitives/toaster.tsx +37 -0
  124. package/primitives/use-toast.ts +192 -0
  125. package/primitives/video-player.tsx +26 -0
  126. package/primitives/youtube-embed.tsx +83 -0
  127. package/siteDef/footer/community.tsx +67 -0
  128. package/siteDef/footer/company.ts +37 -0
  129. package/siteDef/footer/ecosystem.ts +37 -0
  130. package/siteDef/footer/index.tsx +26 -0
  131. package/siteDef/footer/legal.ts +28 -0
  132. package/siteDef/footer/network.ts +33 -0
  133. package/siteDef/footer/svg/warpcast-logo.svg +12 -0
  134. package/siteDef/main-nav.ts +35 -0
  135. package/style/globals.css +13 -0
  136. package/style/hanzo-common.css +32 -0
  137. package/style/hanzo-default-colors.css +79 -0
  138. package/style/social-svg.css +3 -0
  139. package/tailwind/colors.tailwind.js +46 -0
  140. package/tailwind/fonts.tailwind.ts +31 -0
  141. package/tailwind/index.ts +18 -0
  142. package/tailwind/lux-tw-fonts.ts +32 -0
  143. package/tailwind/safelist.tailwind.js +26 -0
  144. package/tailwind/screens.tailwind.js +8 -0
  145. package/tailwind/spacing.tailwind.js +57 -0
  146. package/tailwind/tailwind.config.base.js +905 -0
  147. package/tailwind/tw-font-desc.ts +15 -0
  148. package/tailwind/typo-plugin/get-plugin-styles.js +676 -0
  149. package/tailwind/typo-plugin/index.d.ts +9 -0
  150. package/tailwind/typo-plugin/index.js +141 -0
  151. package/tailwind/typo-plugin/utils.js +60 -0
  152. package/tailwind/typography-test.mdx +36 -0
  153. package/types/breakpoints.ts +11 -0
  154. package/types/bullet-item.ts +10 -0
  155. package/types/button-def.ts +39 -0
  156. package/types/contact-info.ts +11 -0
  157. package/types/dimensions.ts +20 -0
  158. package/types/grid-def.ts +37 -0
  159. package/types/icon.ts +10 -0
  160. package/types/image-def.ts +28 -0
  161. package/types/index.ts +29 -0
  162. package/types/link-def.ts +59 -0
  163. package/types/site-def.ts +31 -0
  164. package/types/t-shirt-size.ts +5 -0
  165. package/util/index.ts +76 -0
  166. package/util/specifier.ts +43 -0
@@ -0,0 +1,179 @@
1
+ // @ts-nocheck
2
+ 'use client'
3
+ import * as React from "react"
4
+ import * as LabelPrimitive from "@radix-ui/react-label"
5
+ import { Slot } from "@radix-ui/react-slot"
6
+
7
+ import {
8
+ Controller,
9
+ type ControllerProps,
10
+ FieldPath,
11
+ type FieldValues,
12
+ FormProvider,
13
+ useFormContext,
14
+ } from "react-hook-form"
15
+
16
+ import { cn } from "../util"
17
+ import Label from "./label"
18
+
19
+ const Form = FormProvider
20
+
21
+ type FormFieldContextValue<
22
+ TFieldValues extends FieldValues = FieldValues,
23
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
24
+ > = {
25
+ name: TName
26
+ }
27
+
28
+ const FormFieldContext = React.createContext<FormFieldContextValue>(
29
+ {} as FormFieldContextValue
30
+ )
31
+
32
+ const FormField = <
33
+ TFieldValues extends FieldValues = FieldValues,
34
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
35
+ >({
36
+ ...props
37
+ }: ControllerProps<TFieldValues, TName>) => {
38
+ return (
39
+ <FormFieldContext.Provider value={{ name: props.name }}>
40
+ <Controller {...props} />
41
+ </FormFieldContext.Provider>
42
+ )
43
+ }
44
+
45
+ const useFormField = () => {
46
+ const fieldContext = React.useContext(FormFieldContext)
47
+ const itemContext = React.useContext(FormItemContext)
48
+ const { getFieldState, formState } = useFormContext()
49
+
50
+ const fieldState = getFieldState(fieldContext.name, formState)
51
+
52
+ if (!fieldContext) {
53
+ throw new Error("useFormField should be used within <FormField>")
54
+ }
55
+
56
+ const { id } = itemContext
57
+
58
+ return {
59
+ id,
60
+ name: fieldContext.name,
61
+ formItemId: `${id}-form-item`,
62
+ formDescriptionId: `${id}-form-item-description`,
63
+ formMessageId: `${id}-form-item-message`,
64
+ ...fieldState,
65
+ }
66
+ }
67
+
68
+ type FormItemContextValue = {
69
+ id: string
70
+ }
71
+
72
+ const FormItemContext = React.createContext<FormItemContextValue>(
73
+ {} as FormItemContextValue
74
+ )
75
+
76
+ const FormItem = React.forwardRef<
77
+ HTMLDivElement,
78
+ React.HTMLAttributes<HTMLDivElement>
79
+ >(({ className, ...props }, ref) => {
80
+ const id = React.useId()
81
+
82
+ return (
83
+ <FormItemContext.Provider value={{ id }}>
84
+ <div ref={ref} className={cn("space-y-2", className)} {...props} />
85
+ </FormItemContext.Provider>
86
+ )
87
+ })
88
+ FormItem.displayName = "FormItem"
89
+
90
+ const FormLabel = React.forwardRef<
91
+ React.ElementRef<typeof LabelPrimitive.Root>,
92
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
93
+ >(({ className, ...props }, ref) => {
94
+ const { error, formItemId } = useFormField()
95
+
96
+ return (
97
+ <Label
98
+ ref={ref}
99
+ className={cn(error && "text-destructive", className)}
100
+ htmlFor={formItemId}
101
+ {...props}
102
+ />
103
+ )
104
+ })
105
+ FormLabel.displayName = "FormLabel"
106
+
107
+ const FormControl = React.forwardRef<
108
+ React.ElementRef<typeof Slot>,
109
+ React.ComponentPropsWithoutRef<typeof Slot>
110
+ >(({ ...props }, ref) => {
111
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
112
+
113
+ return (
114
+ <Slot
115
+ ref={ref}
116
+ id={formItemId}
117
+ aria-describedby={
118
+ !error
119
+ ? `${formDescriptionId}`
120
+ : `${formDescriptionId} ${formMessageId}`
121
+ }
122
+ aria-invalid={!!error}
123
+ {...props}
124
+ />
125
+ )
126
+ })
127
+ FormControl.displayName = "FormControl"
128
+
129
+ const FormDescription = React.forwardRef<
130
+ HTMLParagraphElement,
131
+ React.HTMLAttributes<HTMLParagraphElement>
132
+ >(({ className, ...props }, ref) => {
133
+ const { formDescriptionId } = useFormField()
134
+
135
+ return (
136
+ <p
137
+ ref={ref}
138
+ id={formDescriptionId}
139
+ className={cn("text-sm text-muted-1", className)}
140
+ {...props}
141
+ />
142
+ )
143
+ })
144
+ FormDescription.displayName = "FormDescription"
145
+
146
+ const FormMessage = React.forwardRef<
147
+ HTMLParagraphElement,
148
+ React.HTMLAttributes<HTMLParagraphElement>
149
+ >(({ className, children, ...props }, ref) => {
150
+ const { error, formMessageId } = useFormField()
151
+ const body = error ? String(error?.message) : children
152
+
153
+ const classes = 'text-xs font-medium py-1 ' +
154
+ (error ? 'text-destructive' : 'text-muted-1') +
155
+ (body ? '' : ' invisible') // Hold space in the layout
156
+
157
+ return (
158
+ <p
159
+ ref={ref}
160
+ id={formMessageId}
161
+ className={cn(classes, className)}
162
+ {...props}
163
+ >
164
+ {body ? body : 'dummy'}
165
+ </p>
166
+ )
167
+ })
168
+ FormMessage.displayName = "FormMessage"
169
+
170
+ export {
171
+ useFormField,
172
+ Form,
173
+ FormItem,
174
+ FormLabel,
175
+ FormControl,
176
+ FormDescription,
177
+ FormMessage,
178
+ FormField,
179
+ }
@@ -0,0 +1,144 @@
1
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './accordion'
2
+ export { default as ApplyTypography, type TypographySize} from './apply-typography'
3
+ export { default as ActionButton } from './action-button'
4
+
5
+ export {
6
+ default as Button,
7
+ type ButtonProps,
8
+ type ButtonVariants,
9
+ type ButtonSizes,
10
+ buttonVariants,
11
+ } from './button'
12
+
13
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from './card'
14
+ export { default as DialogVideoController } from './dialog-video-controller'
15
+ export {
16
+ Dialog,
17
+ DialogPortal,
18
+ DialogOverlay,
19
+ DialogClose,
20
+ DialogTrigger,
21
+ DialogContent,
22
+ DialogHeader,
23
+ DialogFooter,
24
+ DialogTitle,
25
+ DialogDescription,
26
+ } from './dialog'
27
+
28
+ export {
29
+ useFormField,
30
+ Form,
31
+ FormItem,
32
+ FormLabel,
33
+ FormControl,
34
+ FormDescription,
35
+ FormMessage,
36
+ FormField,
37
+ } from './form'
38
+
39
+ export { default as Input } from './input'
40
+ export { default as Label } from './label'
41
+ export { default as LinkElement } from './link-element'
42
+ export { default as MDXLink } from './mdx-link'
43
+
44
+ export {
45
+ Sheet,
46
+ SheetPortal,
47
+ SheetOverlay,
48
+ SheetTrigger,
49
+ SheetClose,
50
+ SheetContent,
51
+ SheetHeader,
52
+ SheetFooter,
53
+ SheetTitle,
54
+ SheetDescription,
55
+ } from './sheet'
56
+
57
+ export {
58
+ Table,
59
+ TableHeader,
60
+ TableBody,
61
+ TableFooter,
62
+ TableHead,
63
+ TableRow,
64
+ TableCell,
65
+ TableCaption,
66
+ } from './table'
67
+
68
+ export { default as TailwindIndicator } from './tailwind-indicator'
69
+
70
+ export {
71
+ type ToastProps,
72
+ type ToastActionElement,
73
+ ToastProvider,
74
+ ToastViewport,
75
+ Toast,
76
+ ToastTitle,
77
+ ToastDescription,
78
+ ToastClose,
79
+ ToastAction,
80
+ } from './toast'
81
+
82
+ export {
83
+ Select,
84
+ SelectGroup,
85
+ SelectValue,
86
+ SelectTrigger,
87
+ SelectContent,
88
+ SelectLabel,
89
+ SelectItem,
90
+ SelectSeparator,
91
+ SelectScrollUpButton,
92
+ SelectScrollDownButton,
93
+ } from './select'
94
+
95
+ export {
96
+ Popover,
97
+ PopoverTrigger,
98
+ PopoverContent,
99
+ PopoverAnchor
100
+ } from './popover'
101
+
102
+ export {
103
+ Command,
104
+ CommandDialog,
105
+ CommandInput,
106
+ CommandList,
107
+ CommandEmpty,
108
+ CommandGroup,
109
+ CommandItem,
110
+ CommandShortcut,
111
+ CommandSeparator,
112
+ } from './command'
113
+
114
+ export {
115
+ Tabs,
116
+ TabsList,
117
+ TabsTrigger,
118
+ TabsContent
119
+ } from './tabs'
120
+
121
+ export {
122
+ Avatar,
123
+ AvatarImage,
124
+ AvatarFallback
125
+ } from './avatar'
126
+
127
+ export { ScrollArea, ScrollBar } from './scroll-area'
128
+
129
+ export { Toaster } from './toaster'
130
+ export { useToast, toast } from './use-toast'
131
+
132
+ export { default as VideoPlayer } from './video-player'
133
+ export { default as YouTubeEmbed } from './youtube-embed'
134
+ export { default as Switch } from './switch'
135
+ export { default as TextArea } from './text-area'
136
+ export { default as Calendar } from './calendar'
137
+ export { default as Checkbox } from './checkbox'
138
+ export { default as Progress } from './progress'
139
+ export { default as Separator } from './separator'
140
+ export { default as Skeleton } from './skeleton'
141
+ export { default as InlineIcon } from './inline-icon'
142
+ export { default as NavItems} from './nav-items'
143
+ export { default as Main } from './main'
144
+
@@ -0,0 +1,37 @@
1
+ import React from 'react'
2
+ import Image from 'next/image'
3
+
4
+ import type { Icon } from '../types'
5
+
6
+ const InlineIcon: React.FC<{
7
+ /**
8
+ * If a ReactNode is passed in, it should be set to 'w-full h-auto' so that it can be sized
9
+ * according to width of parent.
10
+ */
11
+ icon: Icon | string
12
+ /** default should be handled by calling code. */
13
+ size?: number
14
+
15
+ agent?: string,
16
+ className?: string
17
+ }> = ({
18
+ icon,
19
+ size,
20
+ agent,
21
+ className=''
22
+ }) => {
23
+ if (!icon) return null
24
+
25
+ const phone = agent === 'phone'
26
+ if (typeof icon === 'string') {
27
+ const _size = (phone && size) ? (size * .75) : size
28
+ return (<Image src={icon} width={_size} height={_size} alt='icon' className={className}/>)
29
+ }
30
+ return (
31
+ <div className={className}>
32
+ {icon as Icon}
33
+ </div>
34
+ )
35
+ }
36
+
37
+ export default InlineIcon
@@ -0,0 +1,30 @@
1
+ 'use client'
2
+
3
+ import React from "react"
4
+
5
+ import { cn } from "../util"
6
+
7
+ export interface InputProps
8
+ extends React.InputHTMLAttributes<HTMLInputElement> {}
9
+
10
+ const Input = React.forwardRef<HTMLInputElement, InputProps>(
11
+ ({ className, type, ...props }, ref) => {
12
+ return (
13
+ <input
14
+ type={type}
15
+ className={cn(
16
+ 'flex h-10 w-full rounded-md border border-input bg-inherit px-3 py-2 text-sm ring-offset-background ' +
17
+ 'file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-1 ' +
18
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ' +
19
+ 'first-letter:disabled:cursor-not-allowed disabled:opacity-50',
20
+ className
21
+ )}
22
+ ref={ref}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+ )
28
+ Input.displayName = "Input"
29
+
30
+ export default Input
@@ -0,0 +1,28 @@
1
+ // @ts-nocheck
2
+ "use client"
3
+
4
+ import React from "react"
5
+ // @ts-ignore
6
+ import * as LabelPrimitive from "@radix-ui/react-label"
7
+ import { cva, type VariantProps } from "class-variance-authority"
8
+
9
+ import { cn } from "../util"
10
+
11
+ const labelVariants = cva(
12
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
13
+ )
14
+
15
+ const Label = React.forwardRef<
16
+ React.ElementRef<typeof LabelPrimitive.Root>,
17
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
18
+ VariantProps<typeof labelVariants>
19
+ >(({ className, ...props }, ref) => (
20
+ <LabelPrimitive.Root
21
+ ref={ref}
22
+ className={cn(labelVariants(), className)}
23
+ {...props}
24
+ />
25
+ ))
26
+ Label.displayName = LabelPrimitive.Root.displayName
27
+
28
+ export default Label
@@ -0,0 +1,104 @@
1
+ import React, { type PropsWithChildren } from 'react'
2
+ import Link from 'next/link'
3
+
4
+ import type { LinkDef, Icon } from '../types'
5
+ import { buttonVariants, type ButtonSizes, type ButtonVariants } from './button'
6
+ import { cn } 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<PropsWithChildren & {
14
+ def: LinkDef,
15
+ /** overrides def */
16
+ variant? : ButtonVariants
17
+ /** overrides def */
18
+ size?: ButtonSizes
19
+ /** To trigger other events in addition to the
20
+ * link action itself. (eg, to also close a drawer menu)
21
+ */
22
+ onClick?: () => void
23
+ /** overrides def (eg, for title area)*/
24
+ icon?: Icon
25
+ /** overrides def */
26
+ iconAfter?: boolean
27
+ className?: string,
28
+ }> = ({
29
+ def,
30
+ // DO NOT provide a default to any of the props that also appear in def!
31
+ size,
32
+ onClick,
33
+ variant,
34
+ icon,
35
+ iconAfter,
36
+ className = '',
37
+ children,
38
+ } ) => {
39
+
40
+ const {
41
+ href,
42
+ newTab,
43
+ variant: defVariant,
44
+ size: defSize,
45
+ title
46
+ } = def
47
+
48
+ const linkProps: any = {}
49
+
50
+ // As per LinkDef docs
51
+ if (href.startsWith('http') || href.startsWith('mailto')) {
52
+ linkProps.rel = 'noreferrer noopener'
53
+ if (newTab !== undefined || newTab === true) {
54
+ linkProps.target = '_blank'
55
+ }
56
+ }
57
+ else if (newTab !== undefined && newTab === true) {
58
+ linkProps.target = '_blank'
59
+ }
60
+
61
+ const toSpread = {
62
+ href,
63
+ ...(onClick ? { onClick } : {}),
64
+ ...linkProps
65
+ }
66
+
67
+ const Contents: React.FC = () => {
68
+
69
+ if (React.Children.count(children) > 0) return children
70
+
71
+ // Props > def fields > defaults.
72
+ const _icon = (icon) ? icon : (def.icon) ? def.icon : undefined
73
+ const _iconAfter = (iconAfter) ? iconAfter : (def.iconAfter) ? def.iconAfter : false
74
+
75
+ // 'title' is not guaranteed as it could be an icon only button / link
76
+ return (<>
77
+ {_icon && !_iconAfter && (<div className='pr-1'>{_icon}</div>)}
78
+ {title && (<div>{title}</div>)}
79
+ {_icon && _iconAfter && (<div className='pl-1'>{_icon}</div>)}
80
+ </>)
81
+ }
82
+
83
+ return (
84
+ <Link
85
+ className={cn(
86
+ buttonVariants({
87
+ variant: variant ? variant : (defVariant ? defVariant : 'link'),
88
+ size: (!defVariant || defVariant.includes('link') || variant?.includes('link')) ?
89
+ 'link'
90
+ :
91
+ (size ? size : defSize)
92
+ }),
93
+ // This is a "label only" LinkDef. cf: footer"
94
+ ((href.length > 0 || onClick) ? '' : 'pointer-events-none'),
95
+ className
96
+ )}
97
+ {...toSpread}
98
+ >
99
+ <Contents />
100
+ </Link>
101
+ )
102
+ }
103
+
104
+ export default LinkElement
@@ -0,0 +1,17 @@
1
+ import React, { type PropsWithChildren } from 'react'
2
+ import { cn } from '../util'
3
+
4
+ const c = 'max-w-screen-2xl 2xl:w-[1500px] lg:mx-auto ' +
5
+ 'flex flex-col justify-start items-stretch ' +
6
+ 'p-4 md:px-6 lg:px-8 '
7
+
8
+ const Main: React.FC<PropsWithChildren & { className?: string }> = ({
9
+ children,
10
+ className='',
11
+ }) => (
12
+ <main className={cn(c, className)}>
13
+ {children}
14
+ </main>
15
+ )
16
+
17
+ export default Main
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,48 @@
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
+ if (currentAs && currentAs === item.href) {
39
+ internalClx += 'pointer-events-none '
40
+ }
41
+
42
+ const _itemClx = (itemClx) ? (typeof itemClx === 'string' ? itemClx : itemClx(item)) : ''
43
+ return (<LinkElement def={item} key={index} className={cn( internalClx, _itemClx)} />)
44
+ })}
45
+ </Tag>) : null
46
+ )
47
+
48
+ export default NavItems
@@ -0,0 +1,35 @@
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 PopoverAnchor = PopoverPrimitive.Anchor
10
+
11
+ const PopoverContent = React.forwardRef<
12
+ React.ElementRef<typeof PopoverPrimitive.Content>,
13
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
14
+ >(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
15
+
16
+ <PopoverPrimitive.Portal>
17
+ <PopoverPrimitive.Content
18
+ ref={ref}
19
+ align={align}
20
+ sideOffset={sideOffset}
21
+ className={cn(
22
+ 'z-50 w-72 rounded-md border bg-level-1 p-4 text-foreground shadow-md outline-none ' +
23
+ 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 ' +
24
+ 'data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 ' +
25
+ 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 ' +
26
+ 'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
27
+ className
28
+ )}
29
+ {...props}
30
+ />
31
+ </PopoverPrimitive.Portal>
32
+ ))
33
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName
34
+
35
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
@@ -0,0 +1,27 @@
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