buildgrid-ui 1.1.0-alpha.6 → 1.1.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildgrid-ui.es.js +4496 -3662
- package/dist/buildgrid-ui.umd.js +83 -58
- package/dist/components/adaptive-input/index.d.ts +1 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +20 -0
- package/dist/components/alert-dialog/index.d.ts +1 -0
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/currency-input/currency-input.d.ts +10 -0
- package/dist/components/currency-input/index.d.ts +1 -0
- package/dist/components/index.d.ts +6 -1
- package/dist/components/password-input/index.d.ts +1 -0
- package/dist/components/password-input/password-input.d.ts +16 -0
- package/dist/components/progress/index.d.ts +1 -0
- package/dist/components/progress/progress.d.ts +4 -0
- package/dist/components/switch/index.d.ts +1 -0
- package/dist/components/switch/switch.d.ts +4 -0
- package/dist/index.d.ts +2 -12
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/utils/formatters.d.ts +8 -0
- package/package.json +12 -2
- package/.editorconfig +0 -5
- package/.eslintrc.json +0 -3
- package/.github/workflows/release.yml +0 -25
- package/.husky/commit-msg +0 -1
- package/.prettierignore +0 -6
- package/.prettierrc +0 -6
- package/.releaserc.json +0 -40
- package/.storybook/main.ts +0 -26
- package/.storybook/preview.ts +0 -15
- package/commitlint.config.js +0 -3
- package/components.json +0 -21
- package/dist/components/adaptative-input/index.d.ts +0 -1
- package/eslint.config.mjs +0 -13
- package/postcss.config.js +0 -6
- package/src/components/adaptative-input/adaptative-input.stories.tsx +0 -30
- package/src/components/adaptative-input/adaptative-input.tsx +0 -66
- package/src/components/adaptative-input/index.ts +0 -1
- package/src/components/autocomplete/autocomplete.stories.tsx +0 -85
- package/src/components/autocomplete/autocomplete.tsx +0 -136
- package/src/components/autocomplete/index.ts +0 -1
- package/src/components/avatar/avatar.stories.tsx +0 -29
- package/src/components/avatar/avatar.tsx +0 -48
- package/src/components/avatar/index.ts +0 -1
- package/src/components/badge/badge.stories.tsx +0 -30
- package/src/components/badge/badge.tsx +0 -34
- package/src/components/badge/index.ts +0 -1
- package/src/components/button/button.stories.tsx +0 -62
- package/src/components/button/button.tsx +0 -82
- package/src/components/button/index.ts +0 -1
- package/src/components/card/card.stories.tsx +0 -41
- package/src/components/card/card.tsx +0 -61
- package/src/components/card/index.ts +0 -1
- package/src/components/checkbox/checkbox.stories.tsx +0 -36
- package/src/components/checkbox/checkbox.tsx +0 -28
- package/src/components/checkbox/index.ts +0 -1
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +0 -90
- package/src/components/dropdown-menu/dropdown-menu.tsx +0 -192
- package/src/components/dropdown-menu/index.ts +0 -1
- package/src/components/index.ts +0 -11
- package/src/components/input/index.ts +0 -1
- package/src/components/input/input.stories.tsx +0 -22
- package/src/components/input/input.tsx +0 -41
- package/src/components/popover/index.ts +0 -1
- package/src/components/popover/popover.stories.tsx +0 -32
- package/src/components/popover/popover.tsx +0 -30
- package/src/components/skeleton/index.ts +0 -1
- package/src/components/skeleton/skeleton.stories.tsx +0 -24
- package/src/components/skeleton/skeleton.tsx +0 -19
- package/src/index.ts +0 -12
- package/src/lib/index.ts +0 -1
- package/src/lib/utils/cn.ts +0 -6
- package/src/styles/tailwind.css +0 -66
- package/tailwind.config.js +0 -57
- package/tsconfig.app.json +0 -10
- package/tsconfig.json +0 -29
- package/vite.config.ts +0 -34
- /package/dist/components/{adaptative-input/adaptative-input.d.ts → adaptive-input/adaptive-input.d.ts} +0 -0
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { Search } from 'lucide-react'
|
|
2
|
-
import { useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/lib'
|
|
5
|
-
import { AdaptiveInput } from '../adaptative-input'
|
|
6
|
-
import { Popover, PopoverContent, PopoverTrigger } from '../popover'
|
|
7
|
-
|
|
8
|
-
interface Option {
|
|
9
|
-
value: string
|
|
10
|
-
label: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface AutoCompleteProps {
|
|
14
|
-
value?: string
|
|
15
|
-
onChange?: (value: string) => void
|
|
16
|
-
options: Option[]
|
|
17
|
-
className?: string
|
|
18
|
-
placeholder?: string
|
|
19
|
-
emptyMessage?: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function Autocomplete(props: AutoCompleteProps) {
|
|
23
|
-
const {
|
|
24
|
-
value = '',
|
|
25
|
-
onChange,
|
|
26
|
-
options: staticOptions,
|
|
27
|
-
className,
|
|
28
|
-
placeholder = 'Search...',
|
|
29
|
-
emptyMessage = 'Nothing found',
|
|
30
|
-
} = props
|
|
31
|
-
|
|
32
|
-
const [query, setQuery] = useState(value)
|
|
33
|
-
const [suggestions, setSuggestions] = useState<Option[]>(staticOptions)
|
|
34
|
-
const [selectedIndex, setSelectedIndex] = useState(-1)
|
|
35
|
-
const [isFocused, setIsFocused] = useState(false)
|
|
36
|
-
|
|
37
|
-
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
38
|
-
const newValue = e.target.value
|
|
39
|
-
setQuery(newValue)
|
|
40
|
-
onChange?.(newValue)
|
|
41
|
-
setSelectedIndex(-1)
|
|
42
|
-
setIsFocused(true)
|
|
43
|
-
|
|
44
|
-
if (newValue.trim() === '') {
|
|
45
|
-
setSuggestions(staticOptions)
|
|
46
|
-
} else {
|
|
47
|
-
setSuggestions(
|
|
48
|
-
staticOptions.filter((option) =>
|
|
49
|
-
option.label.toLowerCase().includes(newValue.toLowerCase()),
|
|
50
|
-
),
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
56
|
-
if (e.key === 'ArrowDown') {
|
|
57
|
-
e.preventDefault()
|
|
58
|
-
setSelectedIndex((prev) => (prev < suggestions.length - 1 ? prev + 1 : prev))
|
|
59
|
-
} else if (e.key === 'ArrowUp') {
|
|
60
|
-
e.preventDefault()
|
|
61
|
-
setSelectedIndex((prev) => (prev > 0 ? prev - 1 : -1))
|
|
62
|
-
} else if (e.key === 'Enter' && selectedIndex >= 0) {
|
|
63
|
-
const selectedOption = suggestions[selectedIndex]
|
|
64
|
-
setQuery(selectedOption.label)
|
|
65
|
-
onChange?.(selectedOption.value)
|
|
66
|
-
setSuggestions([])
|
|
67
|
-
setSelectedIndex(-1)
|
|
68
|
-
setIsFocused(false)
|
|
69
|
-
} else if (e.key === 'Escape') {
|
|
70
|
-
setSuggestions([])
|
|
71
|
-
setSelectedIndex(-1)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const handleSuggestionClick = (option: Option) => {
|
|
76
|
-
setIsFocused(false)
|
|
77
|
-
setQuery(option.label)
|
|
78
|
-
onChange?.(option.value)
|
|
79
|
-
setSuggestions(staticOptions)
|
|
80
|
-
setSelectedIndex(-1)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const handleFocus = () => {
|
|
84
|
-
setIsFocused(true)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const handleBlur = () => {
|
|
88
|
-
setIsFocused(false)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
<Popover open={isFocused}>
|
|
93
|
-
<PopoverTrigger asChild>
|
|
94
|
-
<div className="relative w-fit">
|
|
95
|
-
<AdaptiveInput
|
|
96
|
-
type="text"
|
|
97
|
-
placeholder={placeholder}
|
|
98
|
-
value={query}
|
|
99
|
-
onChange={handleInputChange}
|
|
100
|
-
onKeyDown={handleKeyDown}
|
|
101
|
-
onClick={handleFocus}
|
|
102
|
-
onFocus={handleFocus}
|
|
103
|
-
onBlur={handleBlur}
|
|
104
|
-
className={cn('pr-10', className)}
|
|
105
|
-
aria-label="Search field"
|
|
106
|
-
aria-autocomplete="list"
|
|
107
|
-
aria-controls="suggestions-list"
|
|
108
|
-
aria-expanded={suggestions.length > 0}
|
|
109
|
-
leftIcon={<Search className="w-4 h-4" />}
|
|
110
|
-
/>
|
|
111
|
-
</div>
|
|
112
|
-
</PopoverTrigger>
|
|
113
|
-
<PopoverContent className="p-0 w-[var(--radix-popover-trigger-width)] max-h-96 overflow-y-auto">
|
|
114
|
-
{suggestions.length > 0 ? (
|
|
115
|
-
<ul id="suggestions-list" role="listbox">
|
|
116
|
-
{suggestions.map((option, index) => (
|
|
117
|
-
<li
|
|
118
|
-
key={option.value}
|
|
119
|
-
className={`px-4 py-2 cursor-pointer hover:bg-muted ${
|
|
120
|
-
index === selectedIndex ? 'bg-muted' : ''
|
|
121
|
-
}`}
|
|
122
|
-
onClick={() => handleSuggestionClick(option)}
|
|
123
|
-
role="option"
|
|
124
|
-
aria-selected={index === selectedIndex}
|
|
125
|
-
>
|
|
126
|
-
{option.label}
|
|
127
|
-
</li>
|
|
128
|
-
))}
|
|
129
|
-
</ul>
|
|
130
|
-
) : (
|
|
131
|
-
<span className="px-4 py-2 block">{emptyMessage}</span>
|
|
132
|
-
)}
|
|
133
|
-
</PopoverContent>
|
|
134
|
-
</Popover>
|
|
135
|
-
)
|
|
136
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './autocomplete'
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
|
|
5
|
-
import { Avatar, AvatarFallback, AvatarImage } from './avatar'
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Avatar> = {
|
|
8
|
-
component: Avatar,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
type Story = StoryObj<typeof Avatar>
|
|
13
|
-
|
|
14
|
-
const Template = () => {
|
|
15
|
-
return (
|
|
16
|
-
<Avatar className="w-24 h-24">
|
|
17
|
-
<AvatarImage
|
|
18
|
-
src="https://upload.wikimedia.org/wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png?20150327203541"
|
|
19
|
-
alt="User avatar"
|
|
20
|
-
/>
|
|
21
|
-
<AvatarFallback>NS</AvatarFallback>
|
|
22
|
-
</Avatar>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const Default: Story = {
|
|
27
|
-
render: Template.bind({}),
|
|
28
|
-
args: {},
|
|
29
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as AvatarPrimitive from '@radix-ui/react-avatar'
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/lib/utils/cn'
|
|
5
|
-
|
|
6
|
-
const Avatar = React.forwardRef<
|
|
7
|
-
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
8
|
-
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
|
9
|
-
>(({ className, ...props }, ref) => (
|
|
10
|
-
<AvatarPrimitive.Root
|
|
11
|
-
ref={ref}
|
|
12
|
-
className={cn(
|
|
13
|
-
'relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full',
|
|
14
|
-
className,
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
))
|
|
19
|
-
Avatar.displayName = AvatarPrimitive.Root.displayName
|
|
20
|
-
|
|
21
|
-
const AvatarImage = React.forwardRef<
|
|
22
|
-
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
23
|
-
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
24
|
-
>(({ className, ...props }, ref) => (
|
|
25
|
-
<AvatarPrimitive.Image
|
|
26
|
-
ref={ref}
|
|
27
|
-
className={cn('aspect-square h-full w-full', className)}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
))
|
|
31
|
-
AvatarImage.displayName = AvatarPrimitive.Image.displayName
|
|
32
|
-
|
|
33
|
-
const AvatarFallback = React.forwardRef<
|
|
34
|
-
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
35
|
-
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
36
|
-
>(({ className, ...props }, ref) => (
|
|
37
|
-
<AvatarPrimitive.Fallback
|
|
38
|
-
ref={ref}
|
|
39
|
-
className={cn(
|
|
40
|
-
'flex h-full w-full items-center justify-center rounded-full bg-muted',
|
|
41
|
-
className,
|
|
42
|
-
)}
|
|
43
|
-
{...props}
|
|
44
|
-
/>
|
|
45
|
-
))
|
|
46
|
-
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
|
|
47
|
-
|
|
48
|
-
export { Avatar, AvatarFallback, AvatarImage }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './avatar'
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
|
|
5
|
-
import { Badge, BadgeProps, badgeVariants } from './badge'
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Badge> = {
|
|
8
|
-
component: Badge,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
type Story = StoryObj<typeof Badge>
|
|
13
|
-
|
|
14
|
-
const Template = (args: BadgeProps) => {
|
|
15
|
-
const variants = ['default', 'secondary', 'destructive', 'outline']
|
|
16
|
-
return (
|
|
17
|
-
<div className="flex gap-2">
|
|
18
|
-
{Object.values(variants).map((variant) => (
|
|
19
|
-
<Badge {...args} variant={variant as BadgeProps['variant']}>
|
|
20
|
-
{variant}
|
|
21
|
-
</Badge>
|
|
22
|
-
))}
|
|
23
|
-
</div>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const Default: Story = {
|
|
28
|
-
render: Template.bind({}),
|
|
29
|
-
args: {},
|
|
30
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/lib'
|
|
5
|
-
|
|
6
|
-
const badgeVariants = cva(
|
|
7
|
-
'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',
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
default:
|
|
12
|
-
'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
|
|
13
|
-
secondary:
|
|
14
|
-
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
15
|
-
destructive:
|
|
16
|
-
'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
|
|
17
|
-
outline: 'text-foreground',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
defaultVariants: {
|
|
21
|
-
variant: 'default',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
export interface BadgeProps
|
|
27
|
-
extends React.HTMLAttributes<HTMLDivElement>,
|
|
28
|
-
VariantProps<typeof badgeVariants> {}
|
|
29
|
-
|
|
30
|
-
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
31
|
-
return <div className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { Badge, badgeVariants }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './badge'
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
import { Button, ButtonProps } from './button'
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Button> = {
|
|
7
|
-
component: Button,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default meta
|
|
11
|
-
type Story = StoryObj<typeof Button>
|
|
12
|
-
|
|
13
|
-
const variants: Array<ButtonProps['variant']> = [
|
|
14
|
-
'default',
|
|
15
|
-
'secondary',
|
|
16
|
-
'destructive',
|
|
17
|
-
'outline',
|
|
18
|
-
'ghost',
|
|
19
|
-
'link',
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
-
const Template = (args: ButtonProps) => {
|
|
23
|
-
return (
|
|
24
|
-
<div className="flex gap-2 flex-wrap">
|
|
25
|
-
{Object.values(variants).map((variant) => (
|
|
26
|
-
<Button
|
|
27
|
-
{...args}
|
|
28
|
-
variant={variant as ButtonProps['variant']}
|
|
29
|
-
className="capitalize"
|
|
30
|
-
>
|
|
31
|
-
{variant}
|
|
32
|
-
</Button>
|
|
33
|
-
))}
|
|
34
|
-
</div>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const Default: Story = {
|
|
39
|
-
render: Template.bind({}),
|
|
40
|
-
args: {},
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const TemplateIsLoading = () => {
|
|
44
|
-
return (
|
|
45
|
-
<div className="flex gap-2 flex-wrap">
|
|
46
|
-
{Object.values(variants).map((variant) => (
|
|
47
|
-
<Button
|
|
48
|
-
isLoading
|
|
49
|
-
variant={variant as ButtonProps['variant']}
|
|
50
|
-
className="capitalize"
|
|
51
|
-
>
|
|
52
|
-
{variant}
|
|
53
|
-
</Button>
|
|
54
|
-
))}
|
|
55
|
-
</div>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export const Loading: Story = {
|
|
60
|
-
render: TemplateIsLoading.bind({}),
|
|
61
|
-
args: {},
|
|
62
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Slot } from '@radix-ui/react-slot'
|
|
2
|
-
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
import { cn } from '../../lib/utils/cn'
|
|
5
|
-
|
|
6
|
-
const buttonVariants = cva(
|
|
7
|
-
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',
|
|
12
|
-
destructive:
|
|
13
|
-
'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
|
|
14
|
-
outline:
|
|
15
|
-
'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
|
|
16
|
-
secondary:
|
|
17
|
-
'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
|
|
18
|
-
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
19
|
-
link: 'text-primary underline-offset-4 hover:underline',
|
|
20
|
-
},
|
|
21
|
-
size: {
|
|
22
|
-
default: 'h-9 px-4 py-2',
|
|
23
|
-
sm: 'h-8 rounded-md px-3 text-xs',
|
|
24
|
-
lg: 'h-10 rounded-md px-8',
|
|
25
|
-
xl: 'h-12 rounded-md px-10 text-xl',
|
|
26
|
-
icon: 'h-9 w-9',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
defaultVariants: {
|
|
30
|
-
variant: 'default',
|
|
31
|
-
size: 'default',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
export interface ButtonProps
|
|
37
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
38
|
-
VariantProps<typeof buttonVariants> {
|
|
39
|
-
isLoading?: boolean
|
|
40
|
-
asChild?: boolean
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
44
|
-
({ className, variant, size, isLoading = false, asChild = false, ...props }, ref) => {
|
|
45
|
-
const Comp = asChild ? Slot : 'button'
|
|
46
|
-
return (
|
|
47
|
-
<Comp
|
|
48
|
-
className={cn(buttonVariants({ variant, size, className }))}
|
|
49
|
-
ref={ref}
|
|
50
|
-
{...props}
|
|
51
|
-
disabled={isLoading || props.disabled}
|
|
52
|
-
>
|
|
53
|
-
{isLoading && (
|
|
54
|
-
<svg
|
|
55
|
-
className="animate-spin -ml-1 h-5 w-5"
|
|
56
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
57
|
-
fill="none"
|
|
58
|
-
viewBox="0 0 24 24"
|
|
59
|
-
>
|
|
60
|
-
<circle
|
|
61
|
-
className="opacity-25"
|
|
62
|
-
cx="12"
|
|
63
|
-
cy="12"
|
|
64
|
-
r="10"
|
|
65
|
-
stroke="currentColor"
|
|
66
|
-
strokeWidth="4"
|
|
67
|
-
/>
|
|
68
|
-
<path
|
|
69
|
-
className="opacity-75"
|
|
70
|
-
fill="currentColor"
|
|
71
|
-
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
72
|
-
/>
|
|
73
|
-
</svg>
|
|
74
|
-
)}
|
|
75
|
-
{props.children}
|
|
76
|
-
</Comp>
|
|
77
|
-
)
|
|
78
|
-
},
|
|
79
|
-
)
|
|
80
|
-
Button.displayName = 'Button'
|
|
81
|
-
|
|
82
|
-
export { Button, buttonVariants }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './button'
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
import {
|
|
5
|
-
Card,
|
|
6
|
-
CardContent,
|
|
7
|
-
CardDescription,
|
|
8
|
-
CardFooter,
|
|
9
|
-
CardHeader,
|
|
10
|
-
CardTitle,
|
|
11
|
-
} from './Card'
|
|
12
|
-
import { Button } from '../button/button'
|
|
13
|
-
|
|
14
|
-
const meta: Meta<typeof Card> = {
|
|
15
|
-
component: Card,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default meta
|
|
19
|
-
type Story = StoryObj<typeof Button>
|
|
20
|
-
|
|
21
|
-
const Template = () => {
|
|
22
|
-
return (
|
|
23
|
-
<Card className="w-96">
|
|
24
|
-
<CardHeader>
|
|
25
|
-
<CardTitle>Title</CardTitle>
|
|
26
|
-
<CardDescription>Description</CardDescription>
|
|
27
|
-
</CardHeader>
|
|
28
|
-
<CardContent className="px-0 pt-2">
|
|
29
|
-
<div className="bg-gray-200 w-full h-40 p-6">Content goes here</div>
|
|
30
|
-
</CardContent>
|
|
31
|
-
<CardFooter>
|
|
32
|
-
<Button variant="outline">Close</Button>
|
|
33
|
-
</CardFooter>
|
|
34
|
-
</Card>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const Default: Story = {
|
|
39
|
-
render: Template.bind({}),
|
|
40
|
-
args: {},
|
|
41
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/lib/utils/cn'
|
|
4
|
-
|
|
5
|
-
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
6
|
-
({ className, ...props }, ref) => (
|
|
7
|
-
<div
|
|
8
|
-
ref={ref}
|
|
9
|
-
className={cn('rounded-xl border bg-card text-card-foreground shadow', className)}
|
|
10
|
-
{...props}
|
|
11
|
-
/>
|
|
12
|
-
),
|
|
13
|
-
)
|
|
14
|
-
Card.displayName = 'Card'
|
|
15
|
-
|
|
16
|
-
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
17
|
-
({ className, ...props }, ref) => (
|
|
18
|
-
<div
|
|
19
|
-
ref={ref}
|
|
20
|
-
className={cn('flex flex-col space-y-1.5 p-6', className)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
),
|
|
24
|
-
)
|
|
25
|
-
CardHeader.displayName = 'CardHeader'
|
|
26
|
-
|
|
27
|
-
const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
28
|
-
({ className, ...props }, ref) => (
|
|
29
|
-
<div
|
|
30
|
-
ref={ref}
|
|
31
|
-
className={cn('font-semibold leading-none tracking-tight pb-4', className)}
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
),
|
|
35
|
-
)
|
|
36
|
-
CardTitle.displayName = 'CardTitle'
|
|
37
|
-
|
|
38
|
-
const CardDescription = React.forwardRef<
|
|
39
|
-
HTMLDivElement,
|
|
40
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
41
|
-
>(({ className, ...props }, ref) => (
|
|
42
|
-
<div ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
|
|
43
|
-
))
|
|
44
|
-
CardDescription.displayName = 'CardDescription'
|
|
45
|
-
|
|
46
|
-
const CardContent = React.forwardRef<
|
|
47
|
-
HTMLDivElement,
|
|
48
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
49
|
-
>(({ className, ...props }, ref) => (
|
|
50
|
-
<div ref={ref} className={cn('p-6 py-0', className)} {...props} />
|
|
51
|
-
))
|
|
52
|
-
CardContent.displayName = 'CardContent'
|
|
53
|
-
|
|
54
|
-
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
55
|
-
({ className, ...props }, ref) => (
|
|
56
|
-
<div ref={ref} className={cn('flex items-center p-6 pt-6', className)} {...props} />
|
|
57
|
-
),
|
|
58
|
-
)
|
|
59
|
-
CardFooter.displayName = 'CardFooter'
|
|
60
|
-
|
|
61
|
-
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './card'
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
|
|
5
|
-
import { Checkbox } from './checkbox'
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Checkbox> = {
|
|
8
|
-
component: Checkbox,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
type Story = StoryObj<typeof Checkbox>
|
|
13
|
-
|
|
14
|
-
const Template = () => {
|
|
15
|
-
return (
|
|
16
|
-
<div className="items-top flex space-x-2">
|
|
17
|
-
<Checkbox id="terms1" />
|
|
18
|
-
<div className="grid gap-1.5 leading-none">
|
|
19
|
-
<label
|
|
20
|
-
htmlFor="terms1"
|
|
21
|
-
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
22
|
-
>
|
|
23
|
-
Accept terms and conditions
|
|
24
|
-
</label>
|
|
25
|
-
<p className="text-sm text-muted-foreground">
|
|
26
|
-
You agree to our Terms of Service and Privacy Policy.
|
|
27
|
-
</p>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const Default: Story = {
|
|
34
|
-
render: Template.bind({}),
|
|
35
|
-
args: {},
|
|
36
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
|
|
2
|
-
import { Check } from 'lucide-react'
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/lib/utils/cn'
|
|
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 +0,0 @@
|
|
|
1
|
-
export * from './checkbox'
|