@betterstart/cli 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -0
- package/dist/cli.d.ts +1 -9
- package/dist/cli.js +13585 -367
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +24 -266
- package/dist/index.js +4 -11378
- package/dist/index.js.map +1 -1
- package/package.json +29 -42
- package/templates/schema.json +959 -0
- package/templates/tiptap/hooks/use-composed-ref.ts +43 -0
- package/templates/tiptap/hooks/use-cursor-visibility.ts +68 -0
- package/templates/tiptap/hooks/use-element-rect.ts +166 -0
- package/templates/tiptap/hooks/use-is-breakpoint.ts +32 -0
- package/templates/tiptap/hooks/use-menu-navigation.ts +182 -0
- package/templates/tiptap/hooks/use-scrolling.ts +64 -0
- package/templates/tiptap/hooks/use-throttled-callback.ts +146 -0
- package/templates/tiptap/hooks/use-tiptap-editor.ts +46 -0
- package/templates/tiptap/hooks/use-unmount.ts +21 -0
- package/templates/tiptap/hooks/use-window-size.ts +87 -0
- package/templates/tiptap/lib/tiptap-utils.ts +587 -0
- package/templates/tiptap/styles/_keyframe-animations.scss +91 -0
- package/templates/tiptap/styles/_variables.scss +296 -0
- package/templates/tiptap/tiptap-extension/node-background-extension.ts +138 -0
- package/templates/tiptap/tiptap-icons/align-center-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-justify-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-left-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-right-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/arrow-left-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/ban-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/blockquote-icon.tsx +44 -0
- package/templates/tiptap/tiptap-icons/bold-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/chevron-down-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/close-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/code-block-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/code2-icon.tsx +32 -0
- package/templates/tiptap/tiptap-icons/corner-down-left-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/external-link-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-five-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-four-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/heading-one-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-six-icon.tsx +30 -0
- package/templates/tiptap/tiptap-icons/heading-three-icon.tsx +36 -0
- package/templates/tiptap/tiptap-icons/heading-two-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/highlighter-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/image-plus-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/italic-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/link-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/list-icon.tsx +56 -0
- package/templates/tiptap/tiptap-icons/list-ordered-icon.tsx +56 -0
- package/templates/tiptap/tiptap-icons/list-todo-icon.tsx +50 -0
- package/templates/tiptap/tiptap-icons/moon-star-icon.tsx +30 -0
- package/templates/tiptap/tiptap-icons/redo2-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/strike-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/subscript-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/sun-icon.tsx +58 -0
- package/templates/tiptap/tiptap-icons/superscript-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/trash-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/underline-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/undo2-icon.tsx +26 -0
- package/templates/tiptap/tiptap-node/blockquote-node/blockquote-node.scss +37 -0
- package/templates/tiptap/tiptap-node/code-block-node/code-block-node.scss +54 -0
- package/templates/tiptap/tiptap-node/heading-node/heading-node.scss +45 -0
- package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.ts +10 -0
- package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node.scss +25 -0
- package/templates/tiptap/tiptap-node/image-node/image-node.scss +35 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node-extension.ts +154 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.scss +249 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.tsx +522 -0
- package/templates/tiptap/tiptap-node/image-upload-node/index.tsx +1 -0
- package/templates/tiptap/tiptap-node/list-node/list-node.scss +208 -0
- package/templates/tiptap/tiptap-node/paragraph-node/paragraph-node.scss +273 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/blockquote-button.tsx +104 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/use-blockquote.ts +252 -0
- package/templates/tiptap/tiptap-ui/code-block-button/code-block-button.tsx +106 -0
- package/templates/tiptap/tiptap-ui/code-block-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/code-block-button/use-code-block.ts +261 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.scss +49 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.tsx +153 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/use-color-highlight.ts +345 -0
- package/templates/tiptap/tiptap-ui/color-highlight-popover/color-highlight-popover.tsx +207 -0
- package/templates/tiptap/tiptap-ui/color-highlight-popover/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui/heading-button/heading-button.tsx +107 -0
- package/templates/tiptap/tiptap-ui/heading-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/heading-button/use-heading.ts +314 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.tsx +131 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.ts +130 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/image-upload-button.tsx +114 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/use-image-upload.ts +192 -0
- package/templates/tiptap/tiptap-ui/link-popover/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/link-popover/link-popover.tsx +285 -0
- package/templates/tiptap/tiptap-ui/link-popover/use-link-popover.ts +286 -0
- package/templates/tiptap/tiptap-ui/list-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/list-button/list-button.tsx +108 -0
- package/templates/tiptap/tiptap-ui/list-button/use-list.ts +329 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/list-dropdown-menu.tsx +123 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.ts +203 -0
- package/templates/tiptap/tiptap-ui/mark-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/mark-button/mark-button.tsx +107 -0
- package/templates/tiptap/tiptap-ui/mark-button/use-mark.ts +206 -0
- package/templates/tiptap/tiptap-ui/text-align-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/text-align-button/text-align-button.tsx +118 -0
- package/templates/tiptap/tiptap-ui/text-align-button/use-text-align.ts +212 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/undo-redo-button.tsx +105 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/use-undo-redo.ts +173 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge-colors.scss +395 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge-group.scss +16 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge.scss +99 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge.tsx +46 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button-colors.scss +429 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button-group.scss +22 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button.scss +314 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button.tsx +102 -0
- package/templates/tiptap/tiptap-ui-primitive/button/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/card/card.scss +77 -0
- package/templates/tiptap/tiptap-ui-primitive/card/card.tsx +59 -0
- package/templates/tiptap/tiptap-ui-primitive/card/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.scss +63 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.tsx +95 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/input/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/input/input.scss +45 -0
- package/templates/tiptap/tiptap-ui-primitive/input/input.tsx +18 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/popover.scss +63 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/popover.tsx +33 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/separator.scss +23 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/separator.tsx +33 -0
- package/templates/tiptap/tiptap-ui-primitive/spacer/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/spacer/spacer.tsx +21 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.scss +98 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.tsx +113 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.scss +43 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.tsx +223 -0
- package/templates/ui/accordion.tsx +52 -0
- package/templates/ui/alert-dialog.tsx +116 -0
- package/templates/ui/alert.tsx +48 -0
- package/templates/ui/aspect-ratio.tsx +7 -0
- package/templates/ui/avatar.tsx +46 -0
- package/templates/ui/badge.tsx +32 -0
- package/templates/ui/breadcrumb.tsx +98 -0
- package/templates/ui/button-group.tsx +77 -0
- package/templates/ui/button.tsx +48 -0
- package/templates/ui/calendar.tsx +176 -0
- package/templates/ui/card.tsx +54 -0
- package/templates/ui/carousel.tsx +234 -0
- package/templates/ui/chart.tsx +349 -0
- package/templates/ui/checkbox.tsx +27 -0
- package/templates/ui/collapsible.tsx +11 -0
- package/templates/ui/command.tsx +142 -0
- package/templates/ui/context-menu.tsx +188 -0
- package/templates/ui/curriculum-editor.tsx +601 -0
- package/templates/ui/date-picker.tsx +70 -0
- package/templates/ui/dialog.tsx +103 -0
- package/templates/ui/drawer.tsx +99 -0
- package/templates/ui/dropdown-menu.tsx +185 -0
- package/templates/ui/dynamic-list-field.tsx +95 -0
- package/templates/ui/empty.tsx +90 -0
- package/templates/ui/field.tsx +231 -0
- package/templates/ui/file-upload-example.tsx +113 -0
- package/templates/ui/form.tsx +172 -0
- package/templates/ui/hover-card.tsx +28 -0
- package/templates/ui/icon-picker.tsx +435 -0
- package/templates/ui/icons-data.ts +6 -0
- package/templates/ui/image-upload-field.tsx +360 -0
- package/templates/ui/input-group.tsx +160 -0
- package/templates/ui/input-otp.tsx +70 -0
- package/templates/ui/input.tsx +21 -0
- package/templates/ui/item.tsx +171 -0
- package/templates/ui/kbd.tsx +28 -0
- package/templates/ui/label.tsx +20 -0
- package/templates/ui/logo.tsx +113 -0
- package/templates/ui/markdown-editor.tsx +303 -0
- package/templates/ui/markdown-utils.ts +128 -0
- package/templates/ui/media-upload-field.tsx +255 -0
- package/templates/ui/menubar.tsx +230 -0
- package/templates/ui/navigation-menu.tsx +119 -0
- package/templates/ui/pagination.tsx +96 -0
- package/templates/ui/placeholder.tsx +25 -0
- package/templates/ui/popover.tsx +32 -0
- package/templates/ui/progress.tsx +24 -0
- package/templates/ui/radio-group.tsx +37 -0
- package/templates/ui/resizable.tsx +41 -0
- package/templates/ui/rich-text-editor.tsx +374 -0
- package/templates/ui/scroll-area.tsx +45 -0
- package/templates/ui/select.tsx +151 -0
- package/templates/ui/separator.tsx +25 -0
- package/templates/ui/sheet.tsx +120 -0
- package/templates/ui/sidebar.tsx +687 -0
- package/templates/ui/skeleton.tsx +7 -0
- package/templates/ui/slider.tsx +24 -0
- package/templates/ui/sonner.tsx +29 -0
- package/templates/ui/spinner.tsx +15 -0
- package/templates/ui/switch.tsx +28 -0
- package/templates/ui/table.tsx +93 -0
- package/templates/ui/tabs.tsx +54 -0
- package/templates/ui/textarea.tsx +20 -0
- package/templates/ui/toast.tsx +127 -0
- package/templates/ui/toggle-group.tsx +56 -0
- package/templates/ui/toggle.tsx +43 -0
- package/templates/ui/tooltip.tsx +31 -0
- package/templates/ui/use-mobile.tsx +19 -0
- package/templates/ui/video-upload-field.tsx +368 -0
- package/dist/chunk-EIH4RRIJ.js +0 -183
- package/dist/chunk-EIH4RRIJ.js.map +0 -1
- package/dist/chunk-NKRQYAS6.js +0 -260
- package/dist/chunk-NKRQYAS6.js.map +0 -1
- package/dist/chunk-QLVSHP7X.js +0 -235
- package/dist/chunk-QLVSHP7X.js.map +0 -1
- package/dist/chunk-WY6BC55D.js +0 -357
- package/dist/chunk-WY6BC55D.js.map +0 -1
- package/dist/config/index.d.ts +0 -93
- package/dist/config/index.js +0 -58
- package/dist/config/index.js.map +0 -1
- package/dist/core/index.d.ts +0 -415
- package/dist/core/index.js +0 -906
- package/dist/core/index.js.map +0 -1
- package/dist/import-resolver-BaZ-rzkH.d.ts +0 -123
- package/dist/logger-awLb347n.d.ts +0 -81
- package/dist/plugins/index.d.ts +0 -213
- package/dist/plugins/index.js +0 -365
- package/dist/plugins/index.js.map +0 -1
- package/dist/types-ByX_gl6y.d.ts +0 -232
- package/dist/types-eI549DEG.d.ts +0 -331
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
autoUpdate,
|
|
5
|
+
FloatingDelayGroup,
|
|
6
|
+
FloatingPortal,
|
|
7
|
+
flip,
|
|
8
|
+
offset,
|
|
9
|
+
type Placement,
|
|
10
|
+
type ReferenceType,
|
|
11
|
+
shift,
|
|
12
|
+
type UseFloatingReturn,
|
|
13
|
+
useDismiss,
|
|
14
|
+
useFloating,
|
|
15
|
+
useFocus,
|
|
16
|
+
useHover,
|
|
17
|
+
useInteractions,
|
|
18
|
+
useMergeRefs,
|
|
19
|
+
useRole
|
|
20
|
+
} from '@floating-ui/react'
|
|
21
|
+
import {
|
|
22
|
+
cloneElement,
|
|
23
|
+
createContext,
|
|
24
|
+
forwardRef,
|
|
25
|
+
isValidElement,
|
|
26
|
+
useContext,
|
|
27
|
+
useMemo,
|
|
28
|
+
useState,
|
|
29
|
+
version
|
|
30
|
+
} from 'react'
|
|
31
|
+
import './tooltip.scss'
|
|
32
|
+
|
|
33
|
+
interface TooltipProviderProps {
|
|
34
|
+
children: React.ReactNode
|
|
35
|
+
initialOpen?: boolean
|
|
36
|
+
placement?: Placement
|
|
37
|
+
open?: boolean
|
|
38
|
+
onOpenChange?: (open: boolean) => void
|
|
39
|
+
delay?: number
|
|
40
|
+
closeDelay?: number
|
|
41
|
+
timeout?: number
|
|
42
|
+
useDelayGroup?: boolean
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface TooltipTriggerProps extends Omit<React.HTMLProps<HTMLElement>, 'ref'> {
|
|
46
|
+
asChild?: boolean
|
|
47
|
+
children: React.ReactNode
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface TooltipContentProps extends Omit<React.HTMLProps<HTMLDivElement>, 'ref'> {
|
|
51
|
+
children?: React.ReactNode
|
|
52
|
+
portal?: boolean
|
|
53
|
+
portalProps?: Omit<React.ComponentProps<typeof FloatingPortal>, 'children'>
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface TooltipContextValue extends UseFloatingReturn<ReferenceType> {
|
|
57
|
+
open: boolean
|
|
58
|
+
setOpen: (open: boolean) => void
|
|
59
|
+
getReferenceProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>
|
|
60
|
+
getFloatingProps: (userProps?: React.HTMLProps<HTMLDivElement>) => Record<string, unknown>
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function useTooltip({
|
|
64
|
+
initialOpen = false,
|
|
65
|
+
placement = 'top',
|
|
66
|
+
open: controlledOpen,
|
|
67
|
+
onOpenChange: setControlledOpen,
|
|
68
|
+
delay = 600,
|
|
69
|
+
closeDelay = 0
|
|
70
|
+
}: Omit<TooltipProviderProps, 'children'> = {}) {
|
|
71
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState<boolean>(initialOpen)
|
|
72
|
+
|
|
73
|
+
const open = controlledOpen ?? uncontrolledOpen
|
|
74
|
+
const setOpen = setControlledOpen ?? setUncontrolledOpen
|
|
75
|
+
|
|
76
|
+
const data = useFloating({
|
|
77
|
+
placement,
|
|
78
|
+
open,
|
|
79
|
+
onOpenChange: setOpen,
|
|
80
|
+
whileElementsMounted: autoUpdate,
|
|
81
|
+
middleware: [
|
|
82
|
+
offset(4),
|
|
83
|
+
flip({
|
|
84
|
+
crossAxis: placement.includes('-'),
|
|
85
|
+
fallbackAxisSideDirection: 'start',
|
|
86
|
+
padding: 4
|
|
87
|
+
}),
|
|
88
|
+
shift({ padding: 4 })
|
|
89
|
+
]
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const context = data.context
|
|
93
|
+
|
|
94
|
+
const hover = useHover(context, {
|
|
95
|
+
mouseOnly: true,
|
|
96
|
+
move: false,
|
|
97
|
+
restMs: delay,
|
|
98
|
+
enabled: controlledOpen == null,
|
|
99
|
+
delay: {
|
|
100
|
+
close: closeDelay
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
const focus = useFocus(context, {
|
|
104
|
+
enabled: controlledOpen == null
|
|
105
|
+
})
|
|
106
|
+
const dismiss = useDismiss(context)
|
|
107
|
+
const role = useRole(context, { role: 'tooltip' })
|
|
108
|
+
|
|
109
|
+
const interactions = useInteractions([hover, focus, dismiss, role])
|
|
110
|
+
|
|
111
|
+
return useMemo(
|
|
112
|
+
() => ({
|
|
113
|
+
open,
|
|
114
|
+
setOpen,
|
|
115
|
+
...interactions,
|
|
116
|
+
...data
|
|
117
|
+
}),
|
|
118
|
+
[open, setOpen, interactions, data]
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const TooltipContext = createContext<TooltipContextValue | null>(null)
|
|
123
|
+
|
|
124
|
+
function useTooltipContext() {
|
|
125
|
+
const context = useContext(TooltipContext)
|
|
126
|
+
|
|
127
|
+
if (context == null) {
|
|
128
|
+
throw new Error('Tooltip components must be wrapped in <TooltipProvider />')
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return context
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function Tooltip({ children, ...props }: TooltipProviderProps) {
|
|
135
|
+
const tooltip = useTooltip(props)
|
|
136
|
+
|
|
137
|
+
if (!props.useDelayGroup) {
|
|
138
|
+
return <TooltipContext.Provider value={tooltip}>{children}</TooltipContext.Provider>
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<FloatingDelayGroup
|
|
143
|
+
delay={{ open: props.delay ?? 0, close: props.closeDelay ?? 0 }}
|
|
144
|
+
timeoutMs={props.timeout}
|
|
145
|
+
>
|
|
146
|
+
<TooltipContext.Provider value={tooltip}>{children}</TooltipContext.Provider>
|
|
147
|
+
</FloatingDelayGroup>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export const TooltipTrigger = forwardRef<HTMLElement, TooltipTriggerProps>(function TooltipTrigger(
|
|
152
|
+
{ children, asChild = false, ...props },
|
|
153
|
+
propRef
|
|
154
|
+
) {
|
|
155
|
+
const context = useTooltipContext()
|
|
156
|
+
const childrenRef = isValidElement(children)
|
|
157
|
+
? parseInt(version, 10) >= 19
|
|
158
|
+
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
+
(children as { props: { ref?: React.Ref<any> } }).props.ref
|
|
160
|
+
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
161
|
+
(children as any).ref
|
|
162
|
+
: undefined
|
|
163
|
+
const ref = useMergeRefs([context.refs.setReference, propRef, childrenRef])
|
|
164
|
+
|
|
165
|
+
if (asChild && isValidElement(children)) {
|
|
166
|
+
const dataAttributes = {
|
|
167
|
+
'data-tooltip-state': context.open ? 'open' : 'closed'
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return cloneElement(
|
|
171
|
+
children,
|
|
172
|
+
context.getReferenceProps({
|
|
173
|
+
ref,
|
|
174
|
+
...props,
|
|
175
|
+
...(typeof children.props === 'object' ? children.props : {}),
|
|
176
|
+
...dataAttributes
|
|
177
|
+
})
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<button
|
|
183
|
+
ref={ref}
|
|
184
|
+
data-tooltip-state={context.open ? 'open' : 'closed'}
|
|
185
|
+
{...context.getReferenceProps(props)}
|
|
186
|
+
>
|
|
187
|
+
{children}
|
|
188
|
+
</button>
|
|
189
|
+
)
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
export const TooltipContent = forwardRef<HTMLDivElement, TooltipContentProps>(
|
|
193
|
+
function TooltipContent({ style, children, portal = true, portalProps = {}, ...props }, propRef) {
|
|
194
|
+
const context = useTooltipContext()
|
|
195
|
+
const ref = useMergeRefs([context.refs.setFloating, propRef])
|
|
196
|
+
|
|
197
|
+
if (!context.open) return null
|
|
198
|
+
|
|
199
|
+
const content = (
|
|
200
|
+
<div
|
|
201
|
+
ref={ref}
|
|
202
|
+
style={{
|
|
203
|
+
...context.floatingStyles,
|
|
204
|
+
...style
|
|
205
|
+
}}
|
|
206
|
+
{...context.getFloatingProps(props)}
|
|
207
|
+
className="tiptap-tooltip"
|
|
208
|
+
>
|
|
209
|
+
{children}
|
|
210
|
+
</div>
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
if (portal) {
|
|
214
|
+
return <FloatingPortal {...portalProps}>{content}</FloatingPortal>
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return content
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
Tooltip.displayName = 'Tooltip'
|
|
222
|
+
TooltipTrigger.displayName = 'TooltipTrigger'
|
|
223
|
+
TooltipContent.displayName = 'TooltipContent'
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { cn } from '@cms/utils/cn'
|
|
4
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion'
|
|
5
|
+
import { ChevronDown } from 'lucide-react'
|
|
6
|
+
import * as React from 'react'
|
|
7
|
+
|
|
8
|
+
const Accordion = AccordionPrimitive.Root
|
|
9
|
+
|
|
10
|
+
const AccordionItem = React.forwardRef<
|
|
11
|
+
React.ElementRef<typeof AccordionPrimitive.Item>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
|
13
|
+
>(({ className, ...props }, ref) => (
|
|
14
|
+
<AccordionPrimitive.Item ref={ref} className={cn('border-b', className)} {...props} />
|
|
15
|
+
))
|
|
16
|
+
AccordionItem.displayName = 'AccordionItem'
|
|
17
|
+
|
|
18
|
+
const AccordionTrigger = React.forwardRef<
|
|
19
|
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
20
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
|
|
21
|
+
>(({ className, children, ...props }, ref) => (
|
|
22
|
+
<AccordionPrimitive.Header className="flex">
|
|
23
|
+
<AccordionPrimitive.Trigger
|
|
24
|
+
ref={ref}
|
|
25
|
+
className={cn(
|
|
26
|
+
'flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180',
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
<ChevronDown className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
|
|
33
|
+
</AccordionPrimitive.Trigger>
|
|
34
|
+
</AccordionPrimitive.Header>
|
|
35
|
+
))
|
|
36
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
|
|
37
|
+
|
|
38
|
+
const AccordionContent = React.forwardRef<
|
|
39
|
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
|
40
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
|
41
|
+
>(({ className, children, ...props }, ref) => (
|
|
42
|
+
<AccordionPrimitive.Content
|
|
43
|
+
ref={ref}
|
|
44
|
+
className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
<div className={cn('pb-4 pt-0', className)}>{children}</div>
|
|
48
|
+
</AccordionPrimitive.Content>
|
|
49
|
+
))
|
|
50
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName
|
|
51
|
+
|
|
52
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { cn } from '@cms/utils/cn'
|
|
4
|
+
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
|
|
5
|
+
import * as React from 'react'
|
|
6
|
+
import { buttonVariants } from './button'
|
|
7
|
+
|
|
8
|
+
const AlertDialog = AlertDialogPrimitive.Root
|
|
9
|
+
|
|
10
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
|
11
|
+
|
|
12
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
|
13
|
+
|
|
14
|
+
const AlertDialogOverlay = React.forwardRef<
|
|
15
|
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
16
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
17
|
+
>(({ className, ...props }, ref) => (
|
|
18
|
+
<AlertDialogPrimitive.Overlay
|
|
19
|
+
className={cn(
|
|
20
|
+
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
ref={ref}
|
|
25
|
+
/>
|
|
26
|
+
))
|
|
27
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
|
28
|
+
|
|
29
|
+
const AlertDialogContent = React.forwardRef<
|
|
30
|
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
31
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
|
32
|
+
>(({ className, ...props }, ref) => (
|
|
33
|
+
<AlertDialogPortal>
|
|
34
|
+
<AlertDialogOverlay />
|
|
35
|
+
<AlertDialogPrimitive.Content
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={cn(
|
|
38
|
+
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
</AlertDialogPortal>
|
|
44
|
+
))
|
|
45
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
|
46
|
+
|
|
47
|
+
const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
48
|
+
<div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props} />
|
|
49
|
+
)
|
|
50
|
+
AlertDialogHeader.displayName = 'AlertDialogHeader'
|
|
51
|
+
|
|
52
|
+
const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
53
|
+
<div
|
|
54
|
+
className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
AlertDialogFooter.displayName = 'AlertDialogFooter'
|
|
59
|
+
|
|
60
|
+
const AlertDialogTitle = React.forwardRef<
|
|
61
|
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
|
62
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
63
|
+
>(({ className, ...props }, ref) => (
|
|
64
|
+
<AlertDialogPrimitive.Title
|
|
65
|
+
ref={ref}
|
|
66
|
+
className={cn('text-lg font-semibold', className)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
))
|
|
70
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
|
71
|
+
|
|
72
|
+
const AlertDialogDescription = React.forwardRef<
|
|
73
|
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
|
74
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
75
|
+
>(({ className, ...props }, ref) => (
|
|
76
|
+
<AlertDialogPrimitive.Description
|
|
77
|
+
ref={ref}
|
|
78
|
+
className={cn('text-sm text-muted-foreground', className)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
))
|
|
82
|
+
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName
|
|
83
|
+
|
|
84
|
+
const AlertDialogAction = React.forwardRef<
|
|
85
|
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
86
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
|
87
|
+
>(({ className, ...props }, ref) => (
|
|
88
|
+
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
|
|
89
|
+
))
|
|
90
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
|
91
|
+
|
|
92
|
+
const AlertDialogCancel = React.forwardRef<
|
|
93
|
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
|
94
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
|
95
|
+
>(({ className, ...props }, ref) => (
|
|
96
|
+
<AlertDialogPrimitive.Cancel
|
|
97
|
+
ref={ref}
|
|
98
|
+
className={cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', className)}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
))
|
|
102
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
|
103
|
+
|
|
104
|
+
export {
|
|
105
|
+
AlertDialog,
|
|
106
|
+
AlertDialogPortal,
|
|
107
|
+
AlertDialogOverlay,
|
|
108
|
+
AlertDialogTrigger,
|
|
109
|
+
AlertDialogContent,
|
|
110
|
+
AlertDialogHeader,
|
|
111
|
+
AlertDialogFooter,
|
|
112
|
+
AlertDialogTitle,
|
|
113
|
+
AlertDialogDescription,
|
|
114
|
+
AlertDialogAction,
|
|
115
|
+
AlertDialogCancel
|
|
116
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { cn } from '@cms/utils/cn'
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
const alertVariants = cva(
|
|
6
|
+
'relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7',
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'bg-background text-foreground',
|
|
11
|
+
destructive:
|
|
12
|
+
'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: 'default'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const Alert = React.forwardRef<
|
|
22
|
+
HTMLDivElement,
|
|
23
|
+
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
|
24
|
+
>(({ className, variant, ...props }, ref) => (
|
|
25
|
+
<div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
|
|
26
|
+
))
|
|
27
|
+
Alert.displayName = 'Alert'
|
|
28
|
+
|
|
29
|
+
const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
|
30
|
+
({ className, ...props }, ref) => (
|
|
31
|
+
<h5
|
|
32
|
+
ref={ref}
|
|
33
|
+
className={cn('mb-1 font-medium leading-none tracking-tight', className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
AlertTitle.displayName = 'AlertTitle'
|
|
39
|
+
|
|
40
|
+
const AlertDescription = React.forwardRef<
|
|
41
|
+
HTMLParagraphElement,
|
|
42
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
43
|
+
>(({ className, ...props }, ref) => (
|
|
44
|
+
<div ref={ref} className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} />
|
|
45
|
+
))
|
|
46
|
+
AlertDescription.displayName = 'AlertDescription'
|
|
47
|
+
|
|
48
|
+
export { Alert, AlertTitle, AlertDescription }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { cn } from '@cms/utils/cn'
|
|
4
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar'
|
|
5
|
+
import * as React from 'react'
|
|
6
|
+
|
|
7
|
+
const Avatar = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
|
10
|
+
>(({ className, ...props }, ref) => (
|
|
11
|
+
<AvatarPrimitive.Root
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
))
|
|
17
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName
|
|
18
|
+
|
|
19
|
+
const AvatarImage = React.forwardRef<
|
|
20
|
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
21
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
22
|
+
>(({ className, ...props }, ref) => (
|
|
23
|
+
<AvatarPrimitive.Image
|
|
24
|
+
ref={ref}
|
|
25
|
+
className={cn('aspect-square h-full w-full', className)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
))
|
|
29
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName
|
|
30
|
+
|
|
31
|
+
const AvatarFallback = React.forwardRef<
|
|
32
|
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
33
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
34
|
+
>(({ className, ...props }, ref) => (
|
|
35
|
+
<AvatarPrimitive.Fallback
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={cn(
|
|
38
|
+
'flex h-full w-full items-center justify-center rounded-full bg-muted',
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
))
|
|
44
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
|
|
45
|
+
|
|
46
|
+
export { Avatar, AvatarImage, AvatarFallback }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cn } from '@cms/utils/cn'
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
+
import type * as React from 'react'
|
|
4
|
+
|
|
5
|
+
const badgeVariants = cva(
|
|
6
|
+
'inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
|
|
11
|
+
secondary:
|
|
12
|
+
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
13
|
+
destructive:
|
|
14
|
+
'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
|
|
15
|
+
outline: 'text-foreground'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: 'default'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
export interface BadgeProps
|
|
25
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
26
|
+
VariantProps<typeof badgeVariants> {}
|
|
27
|
+
|
|
28
|
+
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
29
|
+
return <div className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Badge, badgeVariants }
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { cn } from '@cms/utils/cn'
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot'
|
|
3
|
+
import { ChevronRight, MoreHorizontal } from 'lucide-react'
|
|
4
|
+
import * as React from 'react'
|
|
5
|
+
|
|
6
|
+
const Breadcrumb = React.forwardRef<
|
|
7
|
+
HTMLElement,
|
|
8
|
+
React.ComponentPropsWithoutRef<'nav'> & {
|
|
9
|
+
separator?: React.ReactNode
|
|
10
|
+
}
|
|
11
|
+
>(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />)
|
|
12
|
+
Breadcrumb.displayName = 'Breadcrumb'
|
|
13
|
+
|
|
14
|
+
const BreadcrumbList = React.forwardRef<HTMLOListElement, React.ComponentPropsWithoutRef<'ol'>>(
|
|
15
|
+
({ className, ...props }, ref) => (
|
|
16
|
+
<ol
|
|
17
|
+
ref={ref}
|
|
18
|
+
className={cn(
|
|
19
|
+
'flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5',
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
)
|
|
26
|
+
BreadcrumbList.displayName = 'BreadcrumbList'
|
|
27
|
+
|
|
28
|
+
const BreadcrumbItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<'li'>>(
|
|
29
|
+
({ className, ...props }, ref) => (
|
|
30
|
+
<li ref={ref} className={cn('inline-flex items-center gap-1.5', className)} {...props} />
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
BreadcrumbItem.displayName = 'BreadcrumbItem'
|
|
34
|
+
|
|
35
|
+
const BreadcrumbLink = React.forwardRef<
|
|
36
|
+
HTMLAnchorElement,
|
|
37
|
+
React.ComponentPropsWithoutRef<'a'> & {
|
|
38
|
+
asChild?: boolean
|
|
39
|
+
}
|
|
40
|
+
>(({ asChild, className, ...props }, ref) => {
|
|
41
|
+
const Comp = asChild ? Slot : 'a'
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Comp
|
|
45
|
+
ref={ref}
|
|
46
|
+
className={cn('transition-colors hover:text-foreground', className)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
})
|
|
51
|
+
BreadcrumbLink.displayName = 'BreadcrumbLink'
|
|
52
|
+
|
|
53
|
+
const BreadcrumbPage = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<'span'>>(
|
|
54
|
+
({ className, ...props }, ref) => (
|
|
55
|
+
<span
|
|
56
|
+
ref={ref}
|
|
57
|
+
aria-current="page"
|
|
58
|
+
className={cn('font-normal text-foreground', className)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
BreadcrumbPage.displayName = 'BreadcrumbPage'
|
|
64
|
+
|
|
65
|
+
const BreadcrumbSeparator = ({ children, className, ...props }: React.ComponentProps<'li'>) => (
|
|
66
|
+
<li
|
|
67
|
+
role="presentation"
|
|
68
|
+
aria-hidden="true"
|
|
69
|
+
className={cn('[&>svg]:w-3.5 [&>svg]:h-3.5', className)}
|
|
70
|
+
{...props}
|
|
71
|
+
>
|
|
72
|
+
{children ?? <ChevronRight />}
|
|
73
|
+
</li>
|
|
74
|
+
)
|
|
75
|
+
BreadcrumbSeparator.displayName = 'BreadcrumbSeparator'
|
|
76
|
+
|
|
77
|
+
const BreadcrumbEllipsis = ({ className, ...props }: React.ComponentProps<'span'>) => (
|
|
78
|
+
<span
|
|
79
|
+
role="presentation"
|
|
80
|
+
aria-hidden="true"
|
|
81
|
+
className={cn('flex h-9 w-9 items-center justify-center', className)}
|
|
82
|
+
{...props}
|
|
83
|
+
>
|
|
84
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
85
|
+
<span className="sr-only">More</span>
|
|
86
|
+
</span>
|
|
87
|
+
)
|
|
88
|
+
BreadcrumbEllipsis.displayName = 'BreadcrumbElipssis'
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
Breadcrumb,
|
|
92
|
+
BreadcrumbList,
|
|
93
|
+
BreadcrumbItem,
|
|
94
|
+
BreadcrumbLink,
|
|
95
|
+
BreadcrumbPage,
|
|
96
|
+
BreadcrumbSeparator,
|
|
97
|
+
BreadcrumbEllipsis
|
|
98
|
+
}
|