ui-arreya-components 0.0.15 → 0.1.2
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 +61 -106
- package/.storybook/main.ts +0 -18
- package/.storybook/preview.ts +0 -16
- package/.storybook/vitest.setup.ts +0 -9
- package/README.md +0 -54
- package/components.json +0 -21
- package/dist/styles.css +0 -3
- package/dist/ui.cjs.js +0 -119
- package/dist/ui.es.js +0 -7364
- package/dist/ui.umd.js +0 -119
- package/eslint.config.js +0 -28
- package/postcss.config.js +0 -6
- package/scripts/template.sh +0 -57
- 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/index.ts +0 -1
- 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/index.ts +0 -1
- 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 -140
- 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 -3509
- 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 -96
- 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,363 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as RechartsPrimitive from "recharts"
|
|
3
|
-
|
|
4
|
-
import { cn } from "@/lib/utils"
|
|
5
|
-
|
|
6
|
-
// Format: { THEME_NAME: CSS_SELECTOR }
|
|
7
|
-
const THEMES = { light: "", dark: ".dark" } as const
|
|
8
|
-
|
|
9
|
-
export type ChartConfig = {
|
|
10
|
-
[k in string]: {
|
|
11
|
-
label?: React.ReactNode
|
|
12
|
-
icon?: React.ComponentType
|
|
13
|
-
} & (
|
|
14
|
-
| { color?: string; theme?: never }
|
|
15
|
-
| { color?: never; theme: Record<keyof typeof THEMES, string> }
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
type ChartContextProps = {
|
|
20
|
-
config: ChartConfig
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const ChartContext = React.createContext<ChartContextProps | null>(null)
|
|
24
|
-
|
|
25
|
-
function useChart() {
|
|
26
|
-
const context = React.useContext(ChartContext)
|
|
27
|
-
|
|
28
|
-
if (!context) {
|
|
29
|
-
throw new Error("useChart must be used within a <ChartContainer />")
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return context
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const ChartContainer = React.forwardRef<
|
|
36
|
-
HTMLDivElement,
|
|
37
|
-
React.ComponentProps<"div"> & {
|
|
38
|
-
config: ChartConfig
|
|
39
|
-
children: React.ComponentProps<
|
|
40
|
-
typeof RechartsPrimitive.ResponsiveContainer
|
|
41
|
-
>["children"]
|
|
42
|
-
}
|
|
43
|
-
>(({ id, className, children, config, ...props }, ref) => {
|
|
44
|
-
const uniqueId = React.useId()
|
|
45
|
-
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<ChartContext.Provider value={{ config }}>
|
|
49
|
-
<div
|
|
50
|
-
data-chart={chartId}
|
|
51
|
-
ref={ref}
|
|
52
|
-
className={cn(
|
|
53
|
-
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
|
|
54
|
-
className
|
|
55
|
-
)}
|
|
56
|
-
{...props}
|
|
57
|
-
>
|
|
58
|
-
<ChartStyle id={chartId} config={config} />
|
|
59
|
-
<RechartsPrimitive.ResponsiveContainer>
|
|
60
|
-
{children}
|
|
61
|
-
</RechartsPrimitive.ResponsiveContainer>
|
|
62
|
-
</div>
|
|
63
|
-
</ChartContext.Provider>
|
|
64
|
-
)
|
|
65
|
-
})
|
|
66
|
-
ChartContainer.displayName = "Chart"
|
|
67
|
-
|
|
68
|
-
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
|
69
|
-
const colorConfig = Object.entries(config).filter(
|
|
70
|
-
([, config]) => config.theme || config.color
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
if (!colorConfig.length) {
|
|
74
|
-
return null
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<style
|
|
79
|
-
dangerouslySetInnerHTML={{
|
|
80
|
-
__html: Object.entries(THEMES)
|
|
81
|
-
.map(
|
|
82
|
-
([theme, prefix]) => `
|
|
83
|
-
${prefix} [data-chart=${id}] {
|
|
84
|
-
${colorConfig
|
|
85
|
-
.map(([key, itemConfig]) => {
|
|
86
|
-
const color =
|
|
87
|
-
itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
|
|
88
|
-
itemConfig.color
|
|
89
|
-
return color ? ` --color-${key}: ${color};` : null
|
|
90
|
-
})
|
|
91
|
-
.join("\n")}
|
|
92
|
-
}
|
|
93
|
-
`
|
|
94
|
-
)
|
|
95
|
-
.join("\n"),
|
|
96
|
-
}}
|
|
97
|
-
/>
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const ChartTooltip = RechartsPrimitive.Tooltip
|
|
102
|
-
|
|
103
|
-
const ChartTooltipContent = React.forwardRef<
|
|
104
|
-
HTMLDivElement,
|
|
105
|
-
React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
|
|
106
|
-
React.ComponentProps<"div"> & {
|
|
107
|
-
hideLabel?: boolean
|
|
108
|
-
hideIndicator?: boolean
|
|
109
|
-
indicator?: "line" | "dot" | "dashed"
|
|
110
|
-
nameKey?: string
|
|
111
|
-
labelKey?: string
|
|
112
|
-
}
|
|
113
|
-
>(
|
|
114
|
-
(
|
|
115
|
-
{
|
|
116
|
-
active,
|
|
117
|
-
payload,
|
|
118
|
-
className,
|
|
119
|
-
indicator = "dot",
|
|
120
|
-
hideLabel = false,
|
|
121
|
-
hideIndicator = false,
|
|
122
|
-
label,
|
|
123
|
-
labelFormatter,
|
|
124
|
-
labelClassName,
|
|
125
|
-
formatter,
|
|
126
|
-
color,
|
|
127
|
-
nameKey,
|
|
128
|
-
labelKey,
|
|
129
|
-
},
|
|
130
|
-
ref
|
|
131
|
-
) => {
|
|
132
|
-
const { config } = useChart()
|
|
133
|
-
|
|
134
|
-
const tooltipLabel = React.useMemo(() => {
|
|
135
|
-
if (hideLabel || !payload?.length) {
|
|
136
|
-
return null
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const [item] = payload
|
|
140
|
-
const key = `${labelKey || item?.dataKey || item?.name || "value"}`
|
|
141
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
142
|
-
const value =
|
|
143
|
-
!labelKey && typeof label === "string"
|
|
144
|
-
? config[label as keyof typeof config]?.label || label
|
|
145
|
-
: itemConfig?.label
|
|
146
|
-
|
|
147
|
-
if (labelFormatter) {
|
|
148
|
-
return (
|
|
149
|
-
<div className={cn("font-medium", labelClassName)}>
|
|
150
|
-
{labelFormatter(value, payload)}
|
|
151
|
-
</div>
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (!value) {
|
|
156
|
-
return null
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return <div className={cn("font-medium", labelClassName)}>{value}</div>
|
|
160
|
-
}, [
|
|
161
|
-
label,
|
|
162
|
-
labelFormatter,
|
|
163
|
-
payload,
|
|
164
|
-
hideLabel,
|
|
165
|
-
labelClassName,
|
|
166
|
-
config,
|
|
167
|
-
labelKey,
|
|
168
|
-
])
|
|
169
|
-
|
|
170
|
-
if (!active || !payload?.length) {
|
|
171
|
-
return null
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const nestLabel = payload.length === 1 && indicator !== "dot"
|
|
175
|
-
|
|
176
|
-
return (
|
|
177
|
-
<div
|
|
178
|
-
ref={ref}
|
|
179
|
-
className={cn(
|
|
180
|
-
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
|
181
|
-
className
|
|
182
|
-
)}
|
|
183
|
-
>
|
|
184
|
-
{!nestLabel ? tooltipLabel : null}
|
|
185
|
-
<div className="grid gap-1.5">
|
|
186
|
-
{payload.map((item, index) => {
|
|
187
|
-
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
|
188
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
189
|
-
const indicatorColor = color || item.payload.fill || item.color
|
|
190
|
-
|
|
191
|
-
return (
|
|
192
|
-
<div
|
|
193
|
-
key={item.dataKey}
|
|
194
|
-
className={cn(
|
|
195
|
-
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
|
196
|
-
indicator === "dot" && "items-center"
|
|
197
|
-
)}
|
|
198
|
-
>
|
|
199
|
-
{formatter && item?.value !== undefined && item.name ? (
|
|
200
|
-
formatter(item.value, item.name, item, index, item.payload)
|
|
201
|
-
) : (
|
|
202
|
-
<>
|
|
203
|
-
{itemConfig?.icon ? (
|
|
204
|
-
<itemConfig.icon />
|
|
205
|
-
) : (
|
|
206
|
-
!hideIndicator && (
|
|
207
|
-
<div
|
|
208
|
-
className={cn(
|
|
209
|
-
"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
|
|
210
|
-
{
|
|
211
|
-
"h-2.5 w-2.5": indicator === "dot",
|
|
212
|
-
"w-1": indicator === "line",
|
|
213
|
-
"w-0 border-[1.5px] border-dashed bg-transparent":
|
|
214
|
-
indicator === "dashed",
|
|
215
|
-
"my-0.5": nestLabel && indicator === "dashed",
|
|
216
|
-
}
|
|
217
|
-
)}
|
|
218
|
-
style={
|
|
219
|
-
{
|
|
220
|
-
"--color-bg": indicatorColor,
|
|
221
|
-
"--color-border": indicatorColor,
|
|
222
|
-
} as React.CSSProperties
|
|
223
|
-
}
|
|
224
|
-
/>
|
|
225
|
-
)
|
|
226
|
-
)}
|
|
227
|
-
<div
|
|
228
|
-
className={cn(
|
|
229
|
-
"flex flex-1 justify-between leading-none",
|
|
230
|
-
nestLabel ? "items-end" : "items-center"
|
|
231
|
-
)}
|
|
232
|
-
>
|
|
233
|
-
<div className="grid gap-1.5">
|
|
234
|
-
{nestLabel ? tooltipLabel : null}
|
|
235
|
-
<span className="text-muted-foreground">
|
|
236
|
-
{itemConfig?.label || item.name}
|
|
237
|
-
</span>
|
|
238
|
-
</div>
|
|
239
|
-
{item.value && (
|
|
240
|
-
<span className="font-mono font-medium tabular-nums text-foreground">
|
|
241
|
-
{item.value.toLocaleString()}
|
|
242
|
-
</span>
|
|
243
|
-
)}
|
|
244
|
-
</div>
|
|
245
|
-
</>
|
|
246
|
-
)}
|
|
247
|
-
</div>
|
|
248
|
-
)
|
|
249
|
-
})}
|
|
250
|
-
</div>
|
|
251
|
-
</div>
|
|
252
|
-
)
|
|
253
|
-
}
|
|
254
|
-
)
|
|
255
|
-
ChartTooltipContent.displayName = "ChartTooltip"
|
|
256
|
-
|
|
257
|
-
const ChartLegend = RechartsPrimitive.Legend
|
|
258
|
-
|
|
259
|
-
const ChartLegendContent = React.forwardRef<
|
|
260
|
-
HTMLDivElement,
|
|
261
|
-
React.ComponentProps<"div"> &
|
|
262
|
-
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
263
|
-
hideIcon?: boolean
|
|
264
|
-
nameKey?: string
|
|
265
|
-
}
|
|
266
|
-
>(
|
|
267
|
-
(
|
|
268
|
-
{ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey },
|
|
269
|
-
ref
|
|
270
|
-
) => {
|
|
271
|
-
const { config } = useChart()
|
|
272
|
-
|
|
273
|
-
if (!payload?.length) {
|
|
274
|
-
return null
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
return (
|
|
278
|
-
<div
|
|
279
|
-
ref={ref}
|
|
280
|
-
className={cn(
|
|
281
|
-
"flex items-center justify-center gap-4",
|
|
282
|
-
verticalAlign === "top" ? "pb-3" : "pt-3",
|
|
283
|
-
className
|
|
284
|
-
)}
|
|
285
|
-
>
|
|
286
|
-
{payload.map((item) => {
|
|
287
|
-
const key = `${nameKey || item.dataKey || "value"}`
|
|
288
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
289
|
-
|
|
290
|
-
return (
|
|
291
|
-
<div
|
|
292
|
-
key={item.value}
|
|
293
|
-
className={cn(
|
|
294
|
-
"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
|
|
295
|
-
)}
|
|
296
|
-
>
|
|
297
|
-
{itemConfig?.icon && !hideIcon ? (
|
|
298
|
-
<itemConfig.icon />
|
|
299
|
-
) : (
|
|
300
|
-
<div
|
|
301
|
-
className="h-2 w-2 shrink-0 rounded-[2px]"
|
|
302
|
-
style={{
|
|
303
|
-
backgroundColor: item.color,
|
|
304
|
-
}}
|
|
305
|
-
/>
|
|
306
|
-
)}
|
|
307
|
-
{itemConfig?.label}
|
|
308
|
-
</div>
|
|
309
|
-
)
|
|
310
|
-
})}
|
|
311
|
-
</div>
|
|
312
|
-
)
|
|
313
|
-
}
|
|
314
|
-
)
|
|
315
|
-
ChartLegendContent.displayName = "ChartLegend"
|
|
316
|
-
|
|
317
|
-
// Helper to extract item config from a payload.
|
|
318
|
-
function getPayloadConfigFromPayload(
|
|
319
|
-
config: ChartConfig,
|
|
320
|
-
payload: unknown,
|
|
321
|
-
key: string
|
|
322
|
-
) {
|
|
323
|
-
if (typeof payload !== "object" || payload === null) {
|
|
324
|
-
return undefined
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
const payloadPayload =
|
|
328
|
-
"payload" in payload &&
|
|
329
|
-
typeof payload.payload === "object" &&
|
|
330
|
-
payload.payload !== null
|
|
331
|
-
? payload.payload
|
|
332
|
-
: undefined
|
|
333
|
-
|
|
334
|
-
let configLabelKey: string = key
|
|
335
|
-
|
|
336
|
-
if (
|
|
337
|
-
key in payload &&
|
|
338
|
-
typeof payload[key as keyof typeof payload] === "string"
|
|
339
|
-
) {
|
|
340
|
-
configLabelKey = payload[key as keyof typeof payload] as string
|
|
341
|
-
} else if (
|
|
342
|
-
payloadPayload &&
|
|
343
|
-
key in payloadPayload &&
|
|
344
|
-
typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
|
|
345
|
-
) {
|
|
346
|
-
configLabelKey = payloadPayload[
|
|
347
|
-
key as keyof typeof payloadPayload
|
|
348
|
-
] as string
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return configLabelKey in config
|
|
352
|
-
? config[configLabelKey]
|
|
353
|
-
: config[key as keyof typeof config]
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
export {
|
|
357
|
-
ChartContainer,
|
|
358
|
-
ChartTooltip,
|
|
359
|
-
ChartTooltipContent,
|
|
360
|
-
ChartLegend,
|
|
361
|
-
ChartLegendContent,
|
|
362
|
-
ChartStyle,
|
|
363
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Checkbox,
|
|
5
|
-
} from "./checkbox"
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
title: "Components/Checkbox",
|
|
9
|
-
component: Checkbox,
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: "centered",
|
|
12
|
-
},
|
|
13
|
-
tags: ["autodocs"],
|
|
14
|
-
} satisfies Meta<typeof Checkbox>
|
|
15
|
-
|
|
16
|
-
export default meta
|
|
17
|
-
type Story = StoryObj<typeof meta>
|
|
18
|
-
|
|
19
|
-
export const Default: Story = {
|
|
20
|
-
render: () => (
|
|
21
|
-
<Checkbox />
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const CheckboxWithText: Story = {
|
|
26
|
-
render: () => (
|
|
27
|
-
<div className="items-top flex space-x-2">
|
|
28
|
-
<Checkbox id="terms1" />
|
|
29
|
-
<div className="grid gap-1.5 leading-none">
|
|
30
|
-
<label
|
|
31
|
-
htmlFor="terms1"
|
|
32
|
-
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
33
|
-
>
|
|
34
|
-
Accept terms and conditions
|
|
35
|
-
</label>
|
|
36
|
-
<p className="text-sm text-muted-foreground">
|
|
37
|
-
You agree to our Terms of Service and Privacy Policy.
|
|
38
|
-
</p>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const Disabled: Story = {
|
|
45
|
-
render: () => (
|
|
46
|
-
<div className="flex items-center space-x-2">
|
|
47
|
-
<Checkbox id="terms2" disabled />
|
|
48
|
-
<label
|
|
49
|
-
htmlFor="terms2"
|
|
50
|
-
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
51
|
-
>
|
|
52
|
-
Accept terms and conditions
|
|
53
|
-
</label>
|
|
54
|
-
</div>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
|
3
|
-
import { Check } from "lucide-react"
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils"
|
|
6
|
-
|
|
7
|
-
const Checkbox = React.forwardRef<
|
|
8
|
-
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
9
|
-
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
10
|
-
>(({ className, ...props }, ref) => (
|
|
11
|
-
<CheckboxPrimitive.Root
|
|
12
|
-
ref={ref}
|
|
13
|
-
className={cn(
|
|
14
|
-
"peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
15
|
-
className
|
|
16
|
-
)}
|
|
17
|
-
{...props}
|
|
18
|
-
>
|
|
19
|
-
<CheckboxPrimitive.Indicator
|
|
20
|
-
className={cn("flex items-center justify-center text-current")}
|
|
21
|
-
>
|
|
22
|
-
<Check className="h-4 w-4" />
|
|
23
|
-
</CheckboxPrimitive.Indicator>
|
|
24
|
-
</CheckboxPrimitive.Root>
|
|
25
|
-
))
|
|
26
|
-
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
|
27
|
-
|
|
28
|
-
export { Checkbox }
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Collapsible,
|
|
5
|
-
CollapsibleTrigger,
|
|
6
|
-
CollapsibleContent
|
|
7
|
-
} from "./collapsible"
|
|
8
|
-
import {
|
|
9
|
-
Button
|
|
10
|
-
} from "./button"
|
|
11
|
-
|
|
12
|
-
import { ChevronsUpDown } from 'lucide-react'
|
|
13
|
-
|
|
14
|
-
const meta = {
|
|
15
|
-
title: "Components/Collapsible",
|
|
16
|
-
component: Collapsible,
|
|
17
|
-
parameters: {
|
|
18
|
-
layout: "centered",
|
|
19
|
-
},
|
|
20
|
-
tags: ["autodocs"],
|
|
21
|
-
} satisfies Meta<typeof Collapsible>
|
|
22
|
-
|
|
23
|
-
export default meta
|
|
24
|
-
type Story = StoryObj<typeof meta>
|
|
25
|
-
|
|
26
|
-
export const Default: Story = {
|
|
27
|
-
render: () => (
|
|
28
|
-
<Collapsible
|
|
29
|
-
open={ false }
|
|
30
|
-
className="w-[350px] space-y-2"
|
|
31
|
-
>
|
|
32
|
-
<div className="flex items-center justify-between space-x-4 px-4">
|
|
33
|
-
<h4 className="text-sm font-semibold">
|
|
34
|
-
@peduarte starred 3 repositories
|
|
35
|
-
</h4>
|
|
36
|
-
<CollapsibleTrigger asChild>
|
|
37
|
-
<Button variant="ghost" size="sm">
|
|
38
|
-
<ChevronsUpDown className="h-4 w-4" />
|
|
39
|
-
<span className="sr-only">Toggle</span>
|
|
40
|
-
</Button>
|
|
41
|
-
</CollapsibleTrigger>
|
|
42
|
-
</div>
|
|
43
|
-
<div className="rounded-md border px-4 py-2 font-mono text-sm shadow-sm">
|
|
44
|
-
@radix-ui/primitives
|
|
45
|
-
</div>
|
|
46
|
-
<CollapsibleContent className="space-y-2">
|
|
47
|
-
<div className="rounded-md border px-4 py-2 font-mono text-sm shadow-sm">
|
|
48
|
-
@radix-ui/colors
|
|
49
|
-
</div>
|
|
50
|
-
<div className="rounded-md border px-4 py-2 font-mono text-sm shadow-sm">
|
|
51
|
-
@stitches/react
|
|
52
|
-
</div>
|
|
53
|
-
</CollapsibleContent>
|
|
54
|
-
</Collapsible>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
|
2
|
-
|
|
3
|
-
const Collapsible = CollapsiblePrimitive.Root
|
|
4
|
-
|
|
5
|
-
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
|
|
6
|
-
|
|
7
|
-
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
|
|
8
|
-
|
|
9
|
-
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ContextMenu,
|
|
5
|
-
ContextMenuContent,
|
|
6
|
-
ContextMenuItem,
|
|
7
|
-
ContextMenuTrigger,
|
|
8
|
-
} from "./context-menu"
|
|
9
|
-
|
|
10
|
-
const meta = {
|
|
11
|
-
title: "Components/ContextMenu",
|
|
12
|
-
component: ContextMenu,
|
|
13
|
-
parameters: {
|
|
14
|
-
layout: "centered",
|
|
15
|
-
},
|
|
16
|
-
tags: ["autodocs"],
|
|
17
|
-
} satisfies Meta<typeof ContextMenu>
|
|
18
|
-
|
|
19
|
-
export default meta
|
|
20
|
-
type Story = StoryObj<typeof meta>
|
|
21
|
-
|
|
22
|
-
export const Default: Story = {
|
|
23
|
-
render: () => (
|
|
24
|
-
<ContextMenu>
|
|
25
|
-
<ContextMenuTrigger>Right click</ContextMenuTrigger>
|
|
26
|
-
<ContextMenuContent>
|
|
27
|
-
<ContextMenuItem>Profile</ContextMenuItem>
|
|
28
|
-
<ContextMenuItem>Billing</ContextMenuItem>
|
|
29
|
-
<ContextMenuItem>Team</ContextMenuItem>
|
|
30
|
-
<ContextMenuItem>Subscription</ContextMenuItem>
|
|
31
|
-
</ContextMenuContent>
|
|
32
|
-
</ContextMenu>
|
|
33
|
-
)
|
|
34
|
-
}
|