ui-arreya-components 0.0.16 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +342 -0
- package/dist/index.d.ts +342 -0
- package/dist/index.js +1682 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1495 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +63 -106
- package/.github/workflows/npm-publish.yml +0 -35
- package/.storybook/main.ts +0 -18
- package/.storybook/preview.ts +0 -16
- package/.storybook/vitest.setup.ts +0 -9
- package/README.md +0 -62
- package/components.json +0 -21
- package/dist/styles.css +0 -3
- package/dist/ui.cjs.js +0 -242
- package/dist/ui.es.js +0 -25142
- package/dist/ui.umd.js +0 -242
- package/eslint.config.js +0 -28
- package/postcss.config.js +0 -6
- package/scripts/build-index-ts.sh +0 -16
- package/scripts/template.sh +0 -57
- package/src/components/feature/graph-card.stories.tsx +0 -138
- package/src/components/feature/graph-card.tsx +0 -113
- package/src/components/feature/header.stories.tsx +0 -129
- package/src/components/feature/header.tsx +0 -78
- package/src/components/feature/login-form.stories.tsx +0 -35
- package/src/components/feature/login-form.tsx +0 -97
- package/src/components/feature/search-bar.stories.tsx +0 -35
- package/src/components/feature/search-bar.tsx +0 -141
- package/src/components/feature/wizard.stories.tsx +0 -199
- package/src/components/feature/wizard.tsx +0 -278
- package/src/components/ui/accordion.stories.tsx.disabled +0 -36
- package/src/components/ui/accordion.tsx +0 -55
- package/src/components/ui/alert-dialog.stories.tsx +0 -46
- package/src/components/ui/alert-dialog.tsx +0 -139
- package/src/components/ui/alert.stories.tsx +0 -45
- package/src/components/ui/alert.tsx +0 -59
- package/src/components/ui/aspect-ratio.stories.tsx +0 -24
- package/src/components/ui/aspect-ratio.tsx +0 -5
- package/src/components/ui/avatar.stories.tsx +0 -29
- package/src/components/ui/avatar.tsx +0 -48
- package/src/components/ui/badge.stories.tsx +0 -43
- package/src/components/ui/badge.tsx +0 -36
- package/src/components/ui/breadcrumb.stories.tsx +0 -146
- package/src/components/ui/breadcrumb.tsx +0 -115
- package/src/components/ui/button.stories.tsx +0 -87
- package/src/components/ui/button.tsx +0 -57
- package/src/components/ui/card.stories.tsx +0 -99
- package/src/components/ui/card.tsx +0 -76
- package/src/components/ui/carousel.stories.tsx +0 -47
- package/src/components/ui/carousel.tsx +0 -260
- package/src/components/ui/chart.stories.tsx.disabled +0 -44
- package/src/components/ui/chart.tsx +0 -363
- package/src/components/ui/checkbox.stories.tsx +0 -56
- package/src/components/ui/checkbox.tsx +0 -28
- package/src/components/ui/collapsible.stories.tsx +0 -58
- package/src/components/ui/collapsible.tsx +0 -9
- package/src/components/ui/context-menu.stories.tsx +0 -34
- package/src/components/ui/context-menu.tsx +0 -198
- package/src/components/ui/dialog.stories.tsx +0 -40
- package/src/components/ui/dialog.tsx +0 -120
- package/src/components/ui/drawer.stories.tsx +0 -48
- package/src/components/ui/drawer.tsx +0 -116
- package/src/components/ui/dropdown-menu.stories.tsx +0 -92
- package/src/components/ui/dropdown-menu.tsx +0 -199
- package/src/components/ui/form.tsx +0 -176
- package/src/components/ui/hover-card.stories.tsx +0 -31
- package/src/components/ui/hover-card.tsx +0 -27
- package/src/components/ui/input-otp.tsx +0 -69
- package/src/components/ui/input.stories.tsx +0 -63
- package/src/components/ui/input.tsx +0 -22
- package/src/components/ui/label.tsx +0 -24
- package/src/components/ui/menubar.tsx +0 -254
- package/src/components/ui/navigation-menu.tsx +0 -128
- package/src/components/ui/pagination.tsx +0 -117
- package/src/components/ui/popover.tsx +0 -31
- package/src/components/ui/progress.tsx +0 -26
- package/src/components/ui/radio-group.tsx +0 -42
- package/src/components/ui/resizable.tsx +0 -43
- package/src/components/ui/scroll-area.tsx +0 -46
- package/src/components/ui/select.tsx +0 -157
- package/src/components/ui/separator.tsx +0 -29
- package/src/components/ui/sheet.tsx +0 -138
- package/src/components/ui/sidebar.tsx +0 -771
- package/src/components/ui/skeleton.tsx +0 -15
- package/src/components/ui/slider.tsx +0 -26
- package/src/components/ui/sonner.tsx +0 -29
- package/src/components/ui/switch.tsx +0 -27
- package/src/components/ui/table.tsx +0 -120
- package/src/components/ui/tabs.tsx +0 -53
- package/src/components/ui/textarea.tsx +0 -22
- package/src/components/ui/toast.tsx +0 -127
- package/src/components/ui/toaster.tsx +0 -33
- package/src/components/ui/toggle-group.tsx +0 -59
- package/src/components/ui/toggle.tsx +0 -43
- package/src/components/ui/tooltip.tsx +0 -30
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/hooks/use-toast.ts +0 -194
- package/src/index.css +0 -3633
- package/src/index.ts +0 -51
- package/src/lib/types.ts +0 -5
- package/src/lib/utils.ts +0 -6
- package/src/styles/tailwind.css +0 -100
- package/tailwind.config.js +0 -94
- package/tsconfig.app.json +0 -30
- package/tsconfig.json +0 -13
- package/tsconfig.node.json +0 -24
- package/vite.config.ts +0 -33
- package/vitest.workspace.ts +0 -32
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import React, { useState, createContext, useContext } from "react"
|
|
4
|
-
import { cn } from "@/lib/utils"
|
|
5
|
-
import { Check, ChevronRight } from 'lucide-react'
|
|
6
|
-
import { Button } from "@/components/ui/button"
|
|
7
|
-
|
|
8
|
-
// Types
|
|
9
|
-
export type WizardStepStatus = "upcoming" | "current" | "completed"
|
|
10
|
-
|
|
11
|
-
export interface WizardStep {
|
|
12
|
-
id: string
|
|
13
|
-
title: string
|
|
14
|
-
description?: string
|
|
15
|
-
optional?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface WizardContextValue {
|
|
19
|
-
currentStepIndex: number
|
|
20
|
-
steps: WizardStep[]
|
|
21
|
-
goToStep: (index: number) => void
|
|
22
|
-
nextStep: () => void
|
|
23
|
-
prevStep: () => void
|
|
24
|
-
isFirstStep: boolean
|
|
25
|
-
isLastStep: boolean
|
|
26
|
-
getStepStatus: (index: number) => WizardStepStatus
|
|
27
|
-
completeWizard: () => void
|
|
28
|
-
isComplete: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Context
|
|
32
|
-
const WizardContext = createContext<WizardContextValue | undefined>(undefined)
|
|
33
|
-
|
|
34
|
-
export function useWizard() {
|
|
35
|
-
const context = useContext(WizardContext)
|
|
36
|
-
if (!context) {
|
|
37
|
-
throw new Error("useWizard must be used within a WizardProvider")
|
|
38
|
-
}
|
|
39
|
-
return context
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Provider Component
|
|
43
|
-
interface WizardProviderProps {
|
|
44
|
-
steps: WizardStep[]
|
|
45
|
-
children: React.ReactNode
|
|
46
|
-
onComplete?: () => void
|
|
47
|
-
initialStep?: number
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function WizardProvider({
|
|
51
|
-
steps,
|
|
52
|
-
children,
|
|
53
|
-
onComplete,
|
|
54
|
-
initialStep = 0,
|
|
55
|
-
}: WizardProviderProps) {
|
|
56
|
-
const [currentStepIndex, setCurrentStepIndex] = useState(initialStep)
|
|
57
|
-
const [isComplete, setIsComplete] = useState(false)
|
|
58
|
-
|
|
59
|
-
const goToStep = (index: number) => {
|
|
60
|
-
if (index >= 0 && index < steps.length) {
|
|
61
|
-
setCurrentStepIndex(index)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const nextStep = () => {
|
|
66
|
-
if (currentStepIndex < steps.length - 1) {
|
|
67
|
-
setCurrentStepIndex(currentStepIndex + 1)
|
|
68
|
-
} else {
|
|
69
|
-
completeWizard()
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const prevStep = () => {
|
|
74
|
-
if (currentStepIndex > 0) {
|
|
75
|
-
setCurrentStepIndex(currentStepIndex - 1)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const completeWizard = () => {
|
|
80
|
-
setIsComplete(true)
|
|
81
|
-
onComplete?.()
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const getStepStatus = (index: number): WizardStepStatus => {
|
|
85
|
-
if (isComplete) return "completed"
|
|
86
|
-
if (index < currentStepIndex) return "completed"
|
|
87
|
-
if (index === currentStepIndex) return "current"
|
|
88
|
-
return "upcoming"
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const value = {
|
|
92
|
-
currentStepIndex,
|
|
93
|
-
steps,
|
|
94
|
-
goToStep,
|
|
95
|
-
nextStep,
|
|
96
|
-
prevStep,
|
|
97
|
-
isFirstStep: currentStepIndex === 0,
|
|
98
|
-
isLastStep: currentStepIndex === steps.length - 1,
|
|
99
|
-
getStepStatus,
|
|
100
|
-
completeWizard,
|
|
101
|
-
isComplete,
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return <WizardContext.Provider value={value}>{children}</WizardContext.Provider>
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Wizard Component
|
|
108
|
-
interface WizardProps extends WizardProviderProps {
|
|
109
|
-
className?: string
|
|
110
|
-
showStepIndicator?: boolean
|
|
111
|
-
navigationPosition?: "top" | "bottom" | "both"
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function Wizard({
|
|
115
|
-
steps,
|
|
116
|
-
children,
|
|
117
|
-
onComplete,
|
|
118
|
-
initialStep = 0,
|
|
119
|
-
className,
|
|
120
|
-
showStepIndicator = true,
|
|
121
|
-
navigationPosition = "bottom",
|
|
122
|
-
}: WizardProps) {
|
|
123
|
-
return (
|
|
124
|
-
<WizardProvider steps={steps} onComplete={onComplete} initialStep={initialStep}>
|
|
125
|
-
<div className={cn("w-full", className)}>
|
|
126
|
-
{(navigationPosition === "top" || navigationPosition === "both") && (
|
|
127
|
-
<WizardNavigation className="mb-6" />
|
|
128
|
-
)}
|
|
129
|
-
|
|
130
|
-
{showStepIndicator && <WizardStepIndicator className="mb-8" />}
|
|
131
|
-
|
|
132
|
-
<div className="wizard-content">{children}</div>
|
|
133
|
-
|
|
134
|
-
{(navigationPosition === "bottom" || navigationPosition === "both") && (
|
|
135
|
-
<WizardNavigation className="mt-6" />
|
|
136
|
-
)}
|
|
137
|
-
</div>
|
|
138
|
-
</WizardProvider>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Step Indicator Component
|
|
143
|
-
interface WizardStepIndicatorProps {
|
|
144
|
-
className?: string
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export function WizardStepIndicator({ className }: WizardStepIndicatorProps) {
|
|
148
|
-
const { steps, currentStepIndex, getStepStatus, goToStep } = useWizard()
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<div className={cn("w-full", className)}>
|
|
152
|
-
<div className="relative flex w-full justify-between">
|
|
153
|
-
{/* Progress Bar */}
|
|
154
|
-
<div className="absolute top-1/2 h-0.5 w-full -translate-y-1/2 bg-muted">
|
|
155
|
-
<div
|
|
156
|
-
className="h-full bg-primary transition-all duration-300 ease-in-out"
|
|
157
|
-
style={{ width: `${(currentStepIndex / (steps.length - 1)) * 100}%` }}
|
|
158
|
-
/>
|
|
159
|
-
</div>
|
|
160
|
-
|
|
161
|
-
{/* Step Indicators */}
|
|
162
|
-
{steps.map((step, index) => {
|
|
163
|
-
const status = getStepStatus(index)
|
|
164
|
-
return (
|
|
165
|
-
<div key={step.id} className="relative z-10 flex flex-col items-center">
|
|
166
|
-
<button
|
|
167
|
-
onClick={() => {
|
|
168
|
-
if (status === "completed") {
|
|
169
|
-
goToStep(index)
|
|
170
|
-
}
|
|
171
|
-
}}
|
|
172
|
-
disabled={status === "upcoming"}
|
|
173
|
-
className={cn(
|
|
174
|
-
"flex h-8 w-8 items-center justify-center rounded-full border-2 text-sm font-medium transition-colors",
|
|
175
|
-
status === "completed" && "border-primary bg-primary text-primary-foreground hover:bg-primary/90",
|
|
176
|
-
status === "current" && "border-primary bg-background text-primary",
|
|
177
|
-
status === "upcoming" && "border-muted bg-background text-muted-foreground"
|
|
178
|
-
)}
|
|
179
|
-
aria-current={status === "current" ? "step" : undefined}
|
|
180
|
-
>
|
|
181
|
-
{status === "completed" ? <Check className="h-4 w-4" /> : index + 1}
|
|
182
|
-
</button>
|
|
183
|
-
<div className="mt-2 text-center">
|
|
184
|
-
<div
|
|
185
|
-
className={cn(
|
|
186
|
-
"text-xs font-medium",
|
|
187
|
-
status === "completed" && "text-primary",
|
|
188
|
-
status === "current" && "text-primary",
|
|
189
|
-
status === "upcoming" && "text-muted-foreground"
|
|
190
|
-
)}
|
|
191
|
-
>
|
|
192
|
-
{step.title}
|
|
193
|
-
</div>
|
|
194
|
-
{step.description && (
|
|
195
|
-
<div className="mt-0.5 text-xs text-muted-foreground">
|
|
196
|
-
{step.description}
|
|
197
|
-
</div>
|
|
198
|
-
)}
|
|
199
|
-
</div>
|
|
200
|
-
</div>
|
|
201
|
-
)
|
|
202
|
-
})}
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
)
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Navigation Component
|
|
209
|
-
interface WizardNavigationProps {
|
|
210
|
-
className?: string
|
|
211
|
-
showCancel?: boolean
|
|
212
|
-
onCancel?: () => void
|
|
213
|
-
nextLabel?: string
|
|
214
|
-
backLabel?: string
|
|
215
|
-
completeLabel?: string
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export function WizardNavigation({
|
|
219
|
-
className,
|
|
220
|
-
showCancel = false,
|
|
221
|
-
onCancel,
|
|
222
|
-
nextLabel = "Next",
|
|
223
|
-
backLabel = "Back",
|
|
224
|
-
completeLabel = "Complete",
|
|
225
|
-
}: WizardNavigationProps) {
|
|
226
|
-
const { nextStep, prevStep, isFirstStep, isLastStep, completeWizard } = useWizard()
|
|
227
|
-
|
|
228
|
-
return (
|
|
229
|
-
<div className={cn("flex items-center justify-between", className)}>
|
|
230
|
-
<div>
|
|
231
|
-
{!isFirstStep && (
|
|
232
|
-
<Button variant="outline" onClick={prevStep}>
|
|
233
|
-
{backLabel}
|
|
234
|
-
</Button>
|
|
235
|
-
)}
|
|
236
|
-
{showCancel && isFirstStep && (
|
|
237
|
-
<Button variant="outline" onClick={onCancel}>
|
|
238
|
-
Cancel
|
|
239
|
-
</Button>
|
|
240
|
-
)}
|
|
241
|
-
</div>
|
|
242
|
-
<Button onClick={isLastStep ? completeWizard : nextStep}>
|
|
243
|
-
{isLastStep ? completeLabel : nextLabel}
|
|
244
|
-
{!isLastStep && <ChevronRight className="ml-1 h-4 w-4" />}
|
|
245
|
-
</Button>
|
|
246
|
-
</div>
|
|
247
|
-
)
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Step Component
|
|
251
|
-
interface WizardStepContentProps {
|
|
252
|
-
stepId: string
|
|
253
|
-
children: React.ReactNode
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
export function WizardStepContent({ stepId, children }: WizardStepContentProps) {
|
|
257
|
-
const { steps, currentStepIndex, isComplete } = useWizard()
|
|
258
|
-
const currentStep = steps[currentStepIndex]
|
|
259
|
-
|
|
260
|
-
if (isComplete) return null
|
|
261
|
-
if (currentStep.id !== stepId) return null
|
|
262
|
-
|
|
263
|
-
return <>{children}</>
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// Completion Component
|
|
267
|
-
interface WizardCompletionProps {
|
|
268
|
-
children: React.ReactNode
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export function WizardCompletion({ children }: WizardCompletionProps) {
|
|
272
|
-
const { isComplete } = useWizard()
|
|
273
|
-
|
|
274
|
-
if (!isComplete) return null
|
|
275
|
-
|
|
276
|
-
return <>{children}</>
|
|
277
|
-
}
|
|
278
|
-
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Accordion,
|
|
5
|
-
AccordionTrigger,
|
|
6
|
-
AccordionContent,
|
|
7
|
-
AccordionItem,
|
|
8
|
-
} from "./accordion"
|
|
9
|
-
|
|
10
|
-
const meta = {
|
|
11
|
-
title: "Components/Accordion",
|
|
12
|
-
component: Accordion,
|
|
13
|
-
parameters: {
|
|
14
|
-
layout: "centered",
|
|
15
|
-
},
|
|
16
|
-
tags: ["autodocs"],
|
|
17
|
-
} satisfies Meta<typeof Accordion>
|
|
18
|
-
|
|
19
|
-
export default meta
|
|
20
|
-
type Story = StoryObj<typeof meta>
|
|
21
|
-
|
|
22
|
-
export const Default: Story = {
|
|
23
|
-
args: {
|
|
24
|
-
collapsible: true
|
|
25
|
-
},
|
|
26
|
-
render: () => (
|
|
27
|
-
<Accordion type="single" collapsible>
|
|
28
|
-
<AccordionItem value="item-1">
|
|
29
|
-
<AccordionTrigger>Is it accessible?</AccordionTrigger>
|
|
30
|
-
<AccordionContent>
|
|
31
|
-
Yes. It adheres to the WAI-ARIA design pattern.
|
|
32
|
-
</AccordionContent>
|
|
33
|
-
</AccordionItem>
|
|
34
|
-
</Accordion>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
|
3
|
-
import { ChevronDown } from "lucide-react"
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils"
|
|
6
|
-
|
|
7
|
-
const Accordion = AccordionPrimitive.Root
|
|
8
|
-
|
|
9
|
-
const AccordionItem = React.forwardRef<
|
|
10
|
-
React.ElementRef<typeof AccordionPrimitive.Item>,
|
|
11
|
-
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
|
12
|
-
>(({ className, ...props }, ref) => (
|
|
13
|
-
<AccordionPrimitive.Item
|
|
14
|
-
ref={ref}
|
|
15
|
-
className={cn("border-b", className)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
))
|
|
19
|
-
AccordionItem.displayName = "AccordionItem"
|
|
20
|
-
|
|
21
|
-
const AccordionTrigger = React.forwardRef<
|
|
22
|
-
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
23
|
-
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
|
|
24
|
-
>(({ className, children, ...props }, ref) => (
|
|
25
|
-
<AccordionPrimitive.Header className="flex">
|
|
26
|
-
<AccordionPrimitive.Trigger
|
|
27
|
-
ref={ref}
|
|
28
|
-
className={cn(
|
|
29
|
-
"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",
|
|
30
|
-
className
|
|
31
|
-
)}
|
|
32
|
-
{...props}
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
<ChevronDown className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
|
|
36
|
-
</AccordionPrimitive.Trigger>
|
|
37
|
-
</AccordionPrimitive.Header>
|
|
38
|
-
))
|
|
39
|
-
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
|
|
40
|
-
|
|
41
|
-
const AccordionContent = React.forwardRef<
|
|
42
|
-
React.ElementRef<typeof AccordionPrimitive.Content>,
|
|
43
|
-
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
|
44
|
-
>(({ className, children, ...props }, ref) => (
|
|
45
|
-
<AccordionPrimitive.Content
|
|
46
|
-
ref={ref}
|
|
47
|
-
className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
|
|
48
|
-
{...props}
|
|
49
|
-
>
|
|
50
|
-
<div className={cn("pb-4 pt-0", className)}>{children}</div>
|
|
51
|
-
</AccordionPrimitive.Content>
|
|
52
|
-
))
|
|
53
|
-
AccordionContent.displayName = AccordionPrimitive.Content.displayName
|
|
54
|
-
|
|
55
|
-
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
AlertDialog,
|
|
5
|
-
AlertDialogAction,
|
|
6
|
-
AlertDialogCancel,
|
|
7
|
-
AlertDialogContent,
|
|
8
|
-
AlertDialogDescription,
|
|
9
|
-
AlertDialogFooter,
|
|
10
|
-
AlertDialogHeader,
|
|
11
|
-
AlertDialogTitle,
|
|
12
|
-
AlertDialogTrigger
|
|
13
|
-
} from "./alert-dialog"
|
|
14
|
-
|
|
15
|
-
const meta = {
|
|
16
|
-
title: "Components/AlertDialog",
|
|
17
|
-
component: AlertDialog,
|
|
18
|
-
parameters: {
|
|
19
|
-
layout: "centered",
|
|
20
|
-
},
|
|
21
|
-
tags: ["autodocs"],
|
|
22
|
-
} satisfies Meta<typeof AlertDialog>
|
|
23
|
-
|
|
24
|
-
export default meta
|
|
25
|
-
type Story = StoryObj<typeof meta>
|
|
26
|
-
|
|
27
|
-
export const Default: Story = {
|
|
28
|
-
render: () => (
|
|
29
|
-
<AlertDialog>
|
|
30
|
-
<AlertDialogTrigger>Open</AlertDialogTrigger>
|
|
31
|
-
<AlertDialogContent>
|
|
32
|
-
<AlertDialogHeader>
|
|
33
|
-
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
34
|
-
<AlertDialogDescription>
|
|
35
|
-
This action cannot be undone. This will permanently delete your account
|
|
36
|
-
and remove your data from our servers.
|
|
37
|
-
</AlertDialogDescription>
|
|
38
|
-
</AlertDialogHeader>
|
|
39
|
-
<AlertDialogFooter>
|
|
40
|
-
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
41
|
-
<AlertDialogAction>Continue</AlertDialogAction>
|
|
42
|
-
</AlertDialogFooter>
|
|
43
|
-
</AlertDialogContent>
|
|
44
|
-
</AlertDialog>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
|
3
|
-
|
|
4
|
-
import { cn } from "@/lib/utils"
|
|
5
|
-
import { buttonVariants } from "@/components/ui/button"
|
|
6
|
-
|
|
7
|
-
const AlertDialog = AlertDialogPrimitive.Root
|
|
8
|
-
|
|
9
|
-
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
|
10
|
-
|
|
11
|
-
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
|
12
|
-
|
|
13
|
-
const AlertDialogOverlay = React.forwardRef<
|
|
14
|
-
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
15
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
16
|
-
>(({ className, ...props }, ref) => (
|
|
17
|
-
<AlertDialogPrimitive.Overlay
|
|
18
|
-
className={cn(
|
|
19
|
-
"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",
|
|
20
|
-
className
|
|
21
|
-
)}
|
|
22
|
-
{...props}
|
|
23
|
-
ref={ref}
|
|
24
|
-
/>
|
|
25
|
-
))
|
|
26
|
-
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
|
27
|
-
|
|
28
|
-
const AlertDialogContent = React.forwardRef<
|
|
29
|
-
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
30
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
|
31
|
-
>(({ className, ...props }, ref) => (
|
|
32
|
-
<AlertDialogPortal>
|
|
33
|
-
<AlertDialogOverlay />
|
|
34
|
-
<AlertDialogPrimitive.Content
|
|
35
|
-
ref={ref}
|
|
36
|
-
className={cn(
|
|
37
|
-
"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",
|
|
38
|
-
className
|
|
39
|
-
)}
|
|
40
|
-
{...props}
|
|
41
|
-
/>
|
|
42
|
-
</AlertDialogPortal>
|
|
43
|
-
))
|
|
44
|
-
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
|
45
|
-
|
|
46
|
-
const AlertDialogHeader = ({
|
|
47
|
-
className,
|
|
48
|
-
...props
|
|
49
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
50
|
-
<div
|
|
51
|
-
className={cn(
|
|
52
|
-
"flex flex-col space-y-2 text-center sm:text-left",
|
|
53
|
-
className
|
|
54
|
-
)}
|
|
55
|
-
{...props}
|
|
56
|
-
/>
|
|
57
|
-
)
|
|
58
|
-
AlertDialogHeader.displayName = "AlertDialogHeader"
|
|
59
|
-
|
|
60
|
-
const AlertDialogFooter = ({
|
|
61
|
-
className,
|
|
62
|
-
...props
|
|
63
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
64
|
-
<div
|
|
65
|
-
className={cn(
|
|
66
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
67
|
-
className
|
|
68
|
-
)}
|
|
69
|
-
{...props}
|
|
70
|
-
/>
|
|
71
|
-
)
|
|
72
|
-
AlertDialogFooter.displayName = "AlertDialogFooter"
|
|
73
|
-
|
|
74
|
-
const AlertDialogTitle = React.forwardRef<
|
|
75
|
-
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
|
76
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
77
|
-
>(({ className, ...props }, ref) => (
|
|
78
|
-
<AlertDialogPrimitive.Title
|
|
79
|
-
ref={ref}
|
|
80
|
-
className={cn("text-lg font-semibold", className)}
|
|
81
|
-
{...props}
|
|
82
|
-
/>
|
|
83
|
-
))
|
|
84
|
-
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
|
85
|
-
|
|
86
|
-
const AlertDialogDescription = React.forwardRef<
|
|
87
|
-
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
|
88
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
89
|
-
>(({ className, ...props }, ref) => (
|
|
90
|
-
<AlertDialogPrimitive.Description
|
|
91
|
-
ref={ref}
|
|
92
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
93
|
-
{...props}
|
|
94
|
-
/>
|
|
95
|
-
))
|
|
96
|
-
AlertDialogDescription.displayName =
|
|
97
|
-
AlertDialogPrimitive.Description.displayName
|
|
98
|
-
|
|
99
|
-
const AlertDialogAction = React.forwardRef<
|
|
100
|
-
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
101
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
|
102
|
-
>(({ className, ...props }, ref) => (
|
|
103
|
-
<AlertDialogPrimitive.Action
|
|
104
|
-
ref={ref}
|
|
105
|
-
className={cn(buttonVariants(), className)}
|
|
106
|
-
{...props}
|
|
107
|
-
/>
|
|
108
|
-
))
|
|
109
|
-
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
|
110
|
-
|
|
111
|
-
const AlertDialogCancel = React.forwardRef<
|
|
112
|
-
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
|
113
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
|
114
|
-
>(({ className, ...props }, ref) => (
|
|
115
|
-
<AlertDialogPrimitive.Cancel
|
|
116
|
-
ref={ref}
|
|
117
|
-
className={cn(
|
|
118
|
-
buttonVariants({ variant: "outline" }),
|
|
119
|
-
"mt-2 sm:mt-0",
|
|
120
|
-
className
|
|
121
|
-
)}
|
|
122
|
-
{...props}
|
|
123
|
-
/>
|
|
124
|
-
))
|
|
125
|
-
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
|
126
|
-
|
|
127
|
-
export {
|
|
128
|
-
AlertDialog,
|
|
129
|
-
AlertDialogPortal,
|
|
130
|
-
AlertDialogOverlay,
|
|
131
|
-
AlertDialogTrigger,
|
|
132
|
-
AlertDialogContent,
|
|
133
|
-
AlertDialogHeader,
|
|
134
|
-
AlertDialogFooter,
|
|
135
|
-
AlertDialogTitle,
|
|
136
|
-
AlertDialogDescription,
|
|
137
|
-
AlertDialogAction,
|
|
138
|
-
AlertDialogCancel,
|
|
139
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
|
|
3
|
-
import { AlertCircle, Terminal } from 'lucide-react'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Alert,
|
|
7
|
-
AlertTitle,
|
|
8
|
-
AlertDescription
|
|
9
|
-
} from "./alert"
|
|
10
|
-
|
|
11
|
-
const meta = {
|
|
12
|
-
title: "Components/Alert",
|
|
13
|
-
component: Alert,
|
|
14
|
-
parameters: {
|
|
15
|
-
layout: "centered",
|
|
16
|
-
},
|
|
17
|
-
tags: ["autodocs"],
|
|
18
|
-
} satisfies Meta<typeof Alert>
|
|
19
|
-
|
|
20
|
-
export default meta
|
|
21
|
-
type Story = StoryObj<typeof meta>
|
|
22
|
-
|
|
23
|
-
export const Default: Story = {
|
|
24
|
-
render: () => (
|
|
25
|
-
<Alert>
|
|
26
|
-
<Terminal className="h-4 w-4" />
|
|
27
|
-
<AlertTitle>Heads up!</AlertTitle>
|
|
28
|
-
<AlertDescription>
|
|
29
|
-
You can add components and dependencies to your app using the cli.
|
|
30
|
-
</AlertDescription>
|
|
31
|
-
</Alert>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export const Destructive: Story = {
|
|
36
|
-
render: () => (
|
|
37
|
-
<Alert variant="destructive">
|
|
38
|
-
<AlertCircle className="h-4 w-4" />
|
|
39
|
-
<AlertTitle>Error</AlertTitle>
|
|
40
|
-
<AlertDescription>
|
|
41
|
-
Your session has expired. Please log in again.
|
|
42
|
-
</AlertDescription>
|
|
43
|
-
</Alert>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
-
|
|
4
|
-
import { cn } from "@/lib/utils"
|
|
5
|
-
|
|
6
|
-
const alertVariants = cva(
|
|
7
|
-
"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",
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
default: "bg-background text-foreground",
|
|
12
|
-
destructive:
|
|
13
|
-
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
defaultVariants: {
|
|
17
|
-
variant: "default",
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
const Alert = React.forwardRef<
|
|
23
|
-
HTMLDivElement,
|
|
24
|
-
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
|
25
|
-
>(({ className, variant, ...props }, ref) => (
|
|
26
|
-
<div
|
|
27
|
-
ref={ref}
|
|
28
|
-
role="alert"
|
|
29
|
-
className={cn(alertVariants({ variant }), className)}
|
|
30
|
-
{...props}
|
|
31
|
-
/>
|
|
32
|
-
))
|
|
33
|
-
Alert.displayName = "Alert"
|
|
34
|
-
|
|
35
|
-
const AlertTitle = React.forwardRef<
|
|
36
|
-
HTMLParagraphElement,
|
|
37
|
-
React.HTMLAttributes<HTMLHeadingElement>
|
|
38
|
-
>(({ className, ...props }, ref) => (
|
|
39
|
-
<h5
|
|
40
|
-
ref={ref}
|
|
41
|
-
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
|
42
|
-
{...props}
|
|
43
|
-
/>
|
|
44
|
-
))
|
|
45
|
-
AlertTitle.displayName = "AlertTitle"
|
|
46
|
-
|
|
47
|
-
const AlertDescription = React.forwardRef<
|
|
48
|
-
HTMLParagraphElement,
|
|
49
|
-
React.HTMLAttributes<HTMLParagraphElement>
|
|
50
|
-
>(({ className, ...props }, ref) => (
|
|
51
|
-
<div
|
|
52
|
-
ref={ref}
|
|
53
|
-
className={cn("text-sm [&_p]:leading-relaxed", className)}
|
|
54
|
-
{...props}
|
|
55
|
-
/>
|
|
56
|
-
))
|
|
57
|
-
AlertDescription.displayName = "AlertDescription"
|
|
58
|
-
|
|
59
|
-
export { Alert, AlertTitle, AlertDescription }
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
AspectRatio
|
|
5
|
-
} from "./aspect-ratio"
|
|
6
|
-
|
|
7
|
-
const meta = { title: "Components/AspectRatio",
|
|
8
|
-
component: AspectRatio,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
tags: ["autodocs"],
|
|
13
|
-
} satisfies Meta<typeof AspectRatio>
|
|
14
|
-
|
|
15
|
-
export default meta
|
|
16
|
-
type Story = StoryObj<typeof meta>
|
|
17
|
-
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
render: () => (
|
|
20
|
-
<AspectRatio ratio={16 / 9}>
|
|
21
|
-
<image href="https://github.com/shadcn.png" />
|
|
22
|
-
</AspectRatio>
|
|
23
|
-
)
|
|
24
|
-
}
|