buildgrid-ui 1.1.0-dev.9 → 1.1.0
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/blocks/help-carousel/help-carousel.d.ts +9 -0
- package/dist/blocks/help-carousel/index.d.ts +1 -0
- package/dist/blocks/index.d.ts +4 -0
- package/dist/blocks/month-navigator/index.d.ts +1 -0
- package/dist/blocks/month-navigator/month-navigator.d.ts +9 -0
- package/dist/blocks/pagination-controls/index.d.ts +1 -0
- package/dist/blocks/pagination-controls/pagination-controls.d.ts +7 -0
- package/dist/blocks/sidebar/index.d.ts +1 -0
- package/dist/blocks/sidebar/sidebar.d.ts +26 -0
- package/dist/buildgrid-ui.es.js +8281 -2987
- package/dist/buildgrid-ui.umd.js +104 -43
- package/dist/components/autocomplete/autocomplete.d.ts +1 -0
- package/dist/components/calendar/calendar.d.ts +8 -0
- package/dist/components/calendar/index.d.ts +1 -0
- package/dist/components/dialog/dialog.d.ts +19 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/index.d.ts +14 -0
- package/dist/components/label/index.d.ts +1 -0
- package/dist/components/label/label.d.ts +5 -0
- package/dist/components/navigation-menu/index.d.ts +1 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +12 -0
- package/dist/components/pagination/index.d.ts +1 -0
- package/dist/components/pagination/pagination.d.ts +28 -0
- package/dist/components/radio-group/index.d.ts +1 -0
- package/dist/components/radio-group/radio-group.d.ts +5 -0
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/select/select.d.ts +13 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/table.d.ts +10 -0
- package/dist/components/tabs/index.d.ts +1 -0
- package/dist/components/tabs/tabs.d.ts +7 -0
- package/dist/components/textarea/index.d.ts +1 -0
- package/dist/components/textarea/textarea.d.ts +3 -0
- package/dist/components/toaster/index.d.ts +2 -0
- package/dist/components/toaster/toaster.d.ts +9 -0
- package/dist/components/toggle/index.d.ts +1 -0
- package/dist/components/toggle/toggle.d.ts +12 -0
- package/dist/components/toggle-group/index.d.ts +1 -0
- package/dist/components/toggle-group/toggle-group.d.ts +12 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/tooltip.d.ts +7 -0
- package/dist/index.d.ts +3 -1
- package/dist/lib/hooks/index.d.ts +5 -0
- package/dist/lib/hooks/use-debounce.d.ts +2 -0
- package/dist/lib/hooks/use-dialog.d.ts +30 -0
- package/dist/lib/hooks/use-media-query.d.ts +1 -0
- package/dist/lib/hooks/use-mobile.d.ts +1 -0
- package/dist/lib/hooks/use-pwa-install.d.ts +7 -0
- package/dist/lib/utils/index.d.ts +2 -0
- package/package.json +18 -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/CHANGELOG.md +0 -53
- package/commitlint.config.js +0 -3
- package/components.json +0 -21
- package/dist/lib/index.d.ts +0 -2
- package/eslint.config.mjs +0 -13
- package/postcss.config.js +0 -6
- package/src/components/adaptive-input/adaptive-input.stories.tsx +0 -31
- package/src/components/adaptive-input/adaptive-input.tsx +0 -66
- package/src/components/adaptive-input/index.ts +0 -1
- package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -49
- package/src/components/alert-dialog/alert-dialog.tsx +0 -130
- package/src/components/alert-dialog/index.ts +0 -1
- package/src/components/autocomplete/autocomplete.stories.tsx +0 -84
- 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/currency-input/currency-input.stories.tsx +0 -28
- package/src/components/currency-input/currency-input.tsx +0 -93
- package/src/components/currency-input/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 -16
- 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/password-input/index.ts +0 -1
- package/src/components/password-input/password-input.stories.tsx +0 -26
- package/src/components/password-input/password-input.tsx +0 -98
- 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/progress/index.ts +0 -1
- package/src/components/progress/progress.stories.tsx +0 -21
- package/src/components/progress/progress.tsx +0 -26
- 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/components/switch/index.ts +0 -1
- package/src/components/switch/switch.stories.tsx +0 -21
- package/src/components/switch/switch.tsx +0 -26
- package/src/index.ts +0 -2
- package/src/lib/index.ts +0 -2
- package/src/lib/utils/cn.ts +0 -6
- package/src/lib/utils/formatters.ts +0 -55
- 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
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
|
|
2
|
-
import { Check, ChevronRight, Circle } from 'lucide-react'
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/lib/utils/cn'
|
|
6
|
-
|
|
7
|
-
const DropdownMenu = DropdownMenuPrimitive.Root
|
|
8
|
-
|
|
9
|
-
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
10
|
-
|
|
11
|
-
const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
|
12
|
-
|
|
13
|
-
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
14
|
-
|
|
15
|
-
const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
|
16
|
-
|
|
17
|
-
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
|
|
18
|
-
|
|
19
|
-
const DropdownMenuSubTrigger = React.forwardRef<
|
|
20
|
-
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
21
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
22
|
-
inset?: boolean
|
|
23
|
-
}
|
|
24
|
-
>(({ className, inset, children, ...props }, ref) => (
|
|
25
|
-
<DropdownMenuPrimitive.SubTrigger
|
|
26
|
-
ref={ref}
|
|
27
|
-
className={cn(
|
|
28
|
-
'flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
29
|
-
inset && 'pl-8',
|
|
30
|
-
className,
|
|
31
|
-
)}
|
|
32
|
-
{...props}
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
<ChevronRight className="ml-auto" />
|
|
36
|
-
</DropdownMenuPrimitive.SubTrigger>
|
|
37
|
-
))
|
|
38
|
-
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName
|
|
39
|
-
|
|
40
|
-
const DropdownMenuSubContent = React.forwardRef<
|
|
41
|
-
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
42
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
43
|
-
>(({ className, ...props }, ref) => (
|
|
44
|
-
<DropdownMenuPrimitive.SubContent
|
|
45
|
-
ref={ref}
|
|
46
|
-
className={cn(
|
|
47
|
-
'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
48
|
-
className,
|
|
49
|
-
)}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
52
|
-
))
|
|
53
|
-
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName
|
|
54
|
-
|
|
55
|
-
const DropdownMenuContent = React.forwardRef<
|
|
56
|
-
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
57
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
58
|
-
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
59
|
-
<DropdownMenuPrimitive.Portal>
|
|
60
|
-
<DropdownMenuPrimitive.Content
|
|
61
|
-
ref={ref}
|
|
62
|
-
sideOffset={sideOffset}
|
|
63
|
-
className={cn(
|
|
64
|
-
'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md',
|
|
65
|
-
'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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
66
|
-
className,
|
|
67
|
-
)}
|
|
68
|
-
{...props}
|
|
69
|
-
/>
|
|
70
|
-
</DropdownMenuPrimitive.Portal>
|
|
71
|
-
))
|
|
72
|
-
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
|
|
73
|
-
|
|
74
|
-
const DropdownMenuItem = React.forwardRef<
|
|
75
|
-
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
76
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
77
|
-
inset?: boolean
|
|
78
|
-
}
|
|
79
|
-
>(({ className, inset, ...props }, ref) => (
|
|
80
|
-
<DropdownMenuPrimitive.Item
|
|
81
|
-
ref={ref}
|
|
82
|
-
className={cn(
|
|
83
|
-
'relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
84
|
-
inset && 'pl-8',
|
|
85
|
-
className,
|
|
86
|
-
)}
|
|
87
|
-
{...props}
|
|
88
|
-
/>
|
|
89
|
-
))
|
|
90
|
-
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
|
91
|
-
|
|
92
|
-
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
93
|
-
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
94
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
95
|
-
>(({ className, children, checked, ...props }, ref) => (
|
|
96
|
-
<DropdownMenuPrimitive.CheckboxItem
|
|
97
|
-
ref={ref}
|
|
98
|
-
className={cn(
|
|
99
|
-
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
100
|
-
className,
|
|
101
|
-
)}
|
|
102
|
-
checked={checked}
|
|
103
|
-
{...props}
|
|
104
|
-
>
|
|
105
|
-
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
106
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
107
|
-
<Check className="h-4 w-4" />
|
|
108
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
109
|
-
</span>
|
|
110
|
-
{children}
|
|
111
|
-
</DropdownMenuPrimitive.CheckboxItem>
|
|
112
|
-
))
|
|
113
|
-
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName
|
|
114
|
-
|
|
115
|
-
const DropdownMenuRadioItem = React.forwardRef<
|
|
116
|
-
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
117
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
118
|
-
>(({ className, children, ...props }, ref) => (
|
|
119
|
-
<DropdownMenuPrimitive.RadioItem
|
|
120
|
-
ref={ref}
|
|
121
|
-
className={cn(
|
|
122
|
-
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
123
|
-
className,
|
|
124
|
-
)}
|
|
125
|
-
{...props}
|
|
126
|
-
>
|
|
127
|
-
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
128
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
129
|
-
<Circle className="h-2 w-2 fill-current" />
|
|
130
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
131
|
-
</span>
|
|
132
|
-
{children}
|
|
133
|
-
</DropdownMenuPrimitive.RadioItem>
|
|
134
|
-
))
|
|
135
|
-
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
|
|
136
|
-
|
|
137
|
-
const DropdownMenuLabel = React.forwardRef<
|
|
138
|
-
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
139
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
|
140
|
-
inset?: boolean
|
|
141
|
-
}
|
|
142
|
-
>(({ className, inset, ...props }, ref) => (
|
|
143
|
-
<DropdownMenuPrimitive.Label
|
|
144
|
-
ref={ref}
|
|
145
|
-
className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
|
|
146
|
-
{...props}
|
|
147
|
-
/>
|
|
148
|
-
))
|
|
149
|
-
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
|
|
150
|
-
|
|
151
|
-
const DropdownMenuSeparator = React.forwardRef<
|
|
152
|
-
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
153
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
154
|
-
>(({ className, ...props }, ref) => (
|
|
155
|
-
<DropdownMenuPrimitive.Separator
|
|
156
|
-
ref={ref}
|
|
157
|
-
className={cn('-mx-1 my-1 h-px bg-muted', className)}
|
|
158
|
-
{...props}
|
|
159
|
-
/>
|
|
160
|
-
))
|
|
161
|
-
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
|
|
162
|
-
|
|
163
|
-
const DropdownMenuShortcut = ({
|
|
164
|
-
className,
|
|
165
|
-
...props
|
|
166
|
-
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
167
|
-
return (
|
|
168
|
-
<span
|
|
169
|
-
className={cn('ml-auto text-xs tracking-widest opacity-60', className)}
|
|
170
|
-
{...props}
|
|
171
|
-
/>
|
|
172
|
-
)
|
|
173
|
-
}
|
|
174
|
-
DropdownMenuShortcut.displayName = 'DropdownMenuShortcut'
|
|
175
|
-
|
|
176
|
-
export {
|
|
177
|
-
DropdownMenu,
|
|
178
|
-
DropdownMenuCheckboxItem,
|
|
179
|
-
DropdownMenuContent,
|
|
180
|
-
DropdownMenuGroup,
|
|
181
|
-
DropdownMenuItem,
|
|
182
|
-
DropdownMenuLabel,
|
|
183
|
-
DropdownMenuPortal,
|
|
184
|
-
DropdownMenuRadioGroup,
|
|
185
|
-
DropdownMenuRadioItem,
|
|
186
|
-
DropdownMenuSeparator,
|
|
187
|
-
DropdownMenuShortcut,
|
|
188
|
-
DropdownMenuSub,
|
|
189
|
-
DropdownMenuSubContent,
|
|
190
|
-
DropdownMenuSubTrigger,
|
|
191
|
-
DropdownMenuTrigger,
|
|
192
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dropdown-menu'
|
package/src/components/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export * from './adaptive-input'
|
|
2
|
-
export * from './alert-dialog'
|
|
3
|
-
export * from './autocomplete'
|
|
4
|
-
export * from './avatar'
|
|
5
|
-
export * from './badge'
|
|
6
|
-
export * from './button'
|
|
7
|
-
export * from './card'
|
|
8
|
-
export * from './checkbox'
|
|
9
|
-
export * from './currency-input'
|
|
10
|
-
export * from './dropdown-menu'
|
|
11
|
-
export * from './input'
|
|
12
|
-
export * from './password-input'
|
|
13
|
-
export * from './popover'
|
|
14
|
-
export * from './progress'
|
|
15
|
-
export * from './skeleton'
|
|
16
|
-
export * from './switch'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './input'
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
|
|
5
|
-
import { Input } from './input'
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Input> = {
|
|
8
|
-
title: 'Components/input/simple',
|
|
9
|
-
component: Input,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default meta
|
|
13
|
-
type Story = StoryObj<typeof Input>
|
|
14
|
-
|
|
15
|
-
const Template = () => {
|
|
16
|
-
return <Input className="w-64" />
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const Default: Story = {
|
|
20
|
-
render: Template.bind({}),
|
|
21
|
-
args: {},
|
|
22
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { cn } from '@/lib/utils/cn'
|
|
2
|
-
import { cva, VariantProps } from 'class-variance-authority'
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
|
|
5
|
-
const inputVariants = cva(
|
|
6
|
-
'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
|
|
7
|
-
{
|
|
8
|
-
variants: {
|
|
9
|
-
sizing: {
|
|
10
|
-
sm: 'h-8 text-xs px-2',
|
|
11
|
-
md: 'h-10 text-sm px-3',
|
|
12
|
-
lg: 'h-12 text-base px-4',
|
|
13
|
-
xl: 'h-14 text-lg px-5',
|
|
14
|
-
'2xl': 'h-16 text-xl px-6',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
defaultVariants: {
|
|
18
|
-
sizing: 'md',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
export interface InputProps
|
|
24
|
-
extends React.InputHTMLAttributes<HTMLInputElement>,
|
|
25
|
-
VariantProps<typeof inputVariants> {}
|
|
26
|
-
|
|
27
|
-
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
28
|
-
({ className, sizing, type, ...props }, ref) => {
|
|
29
|
-
return (
|
|
30
|
-
<input
|
|
31
|
-
type={type}
|
|
32
|
-
className={cn(inputVariants({ sizing, className }))}
|
|
33
|
-
ref={ref}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
36
|
-
)
|
|
37
|
-
},
|
|
38
|
-
)
|
|
39
|
-
Input.displayName = 'Input'
|
|
40
|
-
|
|
41
|
-
export { Input }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './password-input'
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
|
|
5
|
-
import { PasswordInput } from './password-input'
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof PasswordInput> = {
|
|
8
|
-
title: 'Components/input/password',
|
|
9
|
-
component: PasswordInput,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default meta
|
|
13
|
-
type Story = StoryObj<typeof PasswordInput>
|
|
14
|
-
|
|
15
|
-
const Template = () => {
|
|
16
|
-
return (
|
|
17
|
-
<div className="w-96">
|
|
18
|
-
<PasswordInput />
|
|
19
|
-
</div>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const Default: Story = {
|
|
24
|
-
render: Template.bind({}),
|
|
25
|
-
args: {},
|
|
26
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Eye, EyeOff } from 'lucide-react'
|
|
2
|
-
import React, { InputHTMLAttributes, useState } from 'react'
|
|
3
|
-
import { Button } from '../button'
|
|
4
|
-
import { Input } from '../input'
|
|
5
|
-
import { Progress } from '../progress'
|
|
6
|
-
|
|
7
|
-
interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
8
|
-
showStrengthMeter?: boolean
|
|
9
|
-
strengthLabels?: {
|
|
10
|
-
veryWeak: string
|
|
11
|
-
weak: string
|
|
12
|
-
medium: string
|
|
13
|
-
strong: string
|
|
14
|
-
veryStrong: string
|
|
15
|
-
}
|
|
16
|
-
showPasswordLabel?: string
|
|
17
|
-
hidePasswordLabel?: string
|
|
18
|
-
strengthTitle?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function PasswordInput(props: PasswordInputProps) {
|
|
22
|
-
const {
|
|
23
|
-
showStrengthMeter = true,
|
|
24
|
-
className,
|
|
25
|
-
strengthLabels = {
|
|
26
|
-
veryWeak: 'Very weak',
|
|
27
|
-
weak: 'Weak',
|
|
28
|
-
medium: 'Medium',
|
|
29
|
-
strong: 'Strong',
|
|
30
|
-
veryStrong: 'Very strong',
|
|
31
|
-
},
|
|
32
|
-
showPasswordLabel = 'Show password',
|
|
33
|
-
hidePasswordLabel = 'Hide password',
|
|
34
|
-
strengthTitle = 'Password strength',
|
|
35
|
-
...rest
|
|
36
|
-
} = props
|
|
37
|
-
|
|
38
|
-
const [password, setPassword] = useState('')
|
|
39
|
-
const [showPassword, setShowPassword] = useState(false)
|
|
40
|
-
|
|
41
|
-
const calculateStrength = (password: string): number => {
|
|
42
|
-
let strength = 0
|
|
43
|
-
if (password.length >= 8) strength += 25
|
|
44
|
-
if (password.match(/[a-z]/)) strength += 25
|
|
45
|
-
if (password.match(/[A-Z]/)) strength += 25
|
|
46
|
-
if (password.match(/[0-9]/)) strength += 25
|
|
47
|
-
return strength
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const getStrengthLabel = (strength: number): string => {
|
|
51
|
-
if (strength === 0) return strengthLabels.veryWeak
|
|
52
|
-
if (strength <= 25) return strengthLabels.weak
|
|
53
|
-
if (strength <= 50) return strengthLabels.medium
|
|
54
|
-
if (strength <= 75) return strengthLabels.strong
|
|
55
|
-
return strengthLabels.veryStrong
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const strength = calculateStrength(password)
|
|
59
|
-
const strengthLabel = getStrengthLabel(strength)
|
|
60
|
-
|
|
61
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
62
|
-
setPassword(e.target.value)
|
|
63
|
-
props.onChange?.(e)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div className="w-full space-y-4">
|
|
68
|
-
<div className="relative">
|
|
69
|
-
<Input
|
|
70
|
-
{...rest}
|
|
71
|
-
type={showPassword ? 'text' : 'password'}
|
|
72
|
-
value={password}
|
|
73
|
-
onChange={handleChange}
|
|
74
|
-
className={`pr-10 ${className || ''}`}
|
|
75
|
-
/>
|
|
76
|
-
<Button
|
|
77
|
-
type="button"
|
|
78
|
-
variant="ghost"
|
|
79
|
-
size="icon"
|
|
80
|
-
className="absolute right-0 top-0 h-full"
|
|
81
|
-
onClick={() => setShowPassword(!showPassword)}
|
|
82
|
-
aria-label={showPassword ? hidePasswordLabel : showPasswordLabel}
|
|
83
|
-
>
|
|
84
|
-
{showPassword ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
|
|
85
|
-
</Button>
|
|
86
|
-
</div>
|
|
87
|
-
{showStrengthMeter && (
|
|
88
|
-
<div className="space-y-2">
|
|
89
|
-
<div className="flex justify-between text-sm">
|
|
90
|
-
<span>{strengthTitle}:</span>
|
|
91
|
-
<span>{strengthLabel}</span>
|
|
92
|
-
</div>
|
|
93
|
-
<Progress value={strength} className="h-2" />
|
|
94
|
-
</div>
|
|
95
|
-
)}
|
|
96
|
-
</div>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './popover'
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
|
|
5
|
-
import { Popover, PopoverContent, PopoverTrigger } from './popover'
|
|
6
|
-
import { Button } from '../button/button'
|
|
7
|
-
|
|
8
|
-
const meta: Meta<typeof Popover> = {
|
|
9
|
-
component: Popover,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default meta
|
|
13
|
-
type Story = StoryObj<typeof Popover>
|
|
14
|
-
|
|
15
|
-
const Template = () => {
|
|
16
|
-
const variants = ['default', 'secondary', 'destructive', 'outline']
|
|
17
|
-
return (
|
|
18
|
-
<Popover>
|
|
19
|
-
<PopoverTrigger asChild>
|
|
20
|
-
<Button variant="outline">Open popover</Button>
|
|
21
|
-
</PopoverTrigger>
|
|
22
|
-
<PopoverContent className="w-80">
|
|
23
|
-
<div className="bg-gray-200 p-6 w-full h-20">Popover content</div>
|
|
24
|
-
</PopoverContent>
|
|
25
|
-
</Popover>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const Default: Story = {
|
|
30
|
-
render: Template.bind({}),
|
|
31
|
-
args: {},
|
|
32
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { cn } from '@/lib'
|
|
2
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover'
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
|
|
5
|
-
const Popover = PopoverPrimitive.Root
|
|
6
|
-
|
|
7
|
-
const PopoverTrigger = PopoverPrimitive.Trigger
|
|
8
|
-
|
|
9
|
-
const PopoverAnchor = PopoverPrimitive.Anchor
|
|
10
|
-
|
|
11
|
-
const PopoverContent = React.forwardRef<
|
|
12
|
-
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
13
|
-
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
|
|
14
|
-
>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
|
|
15
|
-
<PopoverPrimitive.Portal>
|
|
16
|
-
<PopoverPrimitive.Content
|
|
17
|
-
ref={ref}
|
|
18
|
-
align={align}
|
|
19
|
-
sideOffset={sideOffset}
|
|
20
|
-
className={cn(
|
|
21
|
-
'z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
22
|
-
className,
|
|
23
|
-
)}
|
|
24
|
-
{...props}
|
|
25
|
-
/>
|
|
26
|
-
</PopoverPrimitive.Portal>
|
|
27
|
-
))
|
|
28
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName
|
|
29
|
-
|
|
30
|
-
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './progress'
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
|
|
5
|
-
import { Progress } from './progress'
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Progress> = {
|
|
8
|
-
component: Progress,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
type Story = StoryObj<typeof Progress>
|
|
13
|
-
|
|
14
|
-
const Template = () => {
|
|
15
|
-
return <Progress value={90} />
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
render: Template.bind({}),
|
|
20
|
-
args: {},
|
|
21
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as ProgressPrimitive from '@radix-ui/react-progress'
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/lib/utils/cn'
|
|
5
|
-
|
|
6
|
-
const Progress = React.forwardRef<
|
|
7
|
-
React.ElementRef<typeof ProgressPrimitive.Root>,
|
|
8
|
-
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
|
|
9
|
-
>(({ className, value, ...props }, ref) => (
|
|
10
|
-
<ProgressPrimitive.Root
|
|
11
|
-
ref={ref}
|
|
12
|
-
className={cn(
|
|
13
|
-
'relative h-2 w-full overflow-hidden rounded-full bg-primary/20',
|
|
14
|
-
className,
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
>
|
|
18
|
-
<ProgressPrimitive.Indicator
|
|
19
|
-
className="h-full w-full flex-1 bg-primary transition-all"
|
|
20
|
-
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
|
21
|
-
/>
|
|
22
|
-
</ProgressPrimitive.Root>
|
|
23
|
-
))
|
|
24
|
-
Progress.displayName = ProgressPrimitive.Root.displayName
|
|
25
|
-
|
|
26
|
-
export { Progress }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './skeleton'
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
import { Skeleton } from './Skeleton'
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Skeleton> = {
|
|
7
|
-
component: Skeleton,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default meta
|
|
11
|
-
type Story = StoryObj<typeof Skeleton>
|
|
12
|
-
|
|
13
|
-
const Template = () => {
|
|
14
|
-
return (
|
|
15
|
-
<div className="space-y-2">
|
|
16
|
-
<Skeleton className="w-96 h-5" repeat={3} />
|
|
17
|
-
</div>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const Default: Story = {
|
|
22
|
-
render: Template.bind({}),
|
|
23
|
-
args: {},
|
|
24
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { cn } from '@/lib/utils/cn'
|
|
2
|
-
|
|
3
|
-
type SkeletonProps = {
|
|
4
|
-
repeat?: number
|
|
5
|
-
} & React.ComponentProps<'div'>
|
|
6
|
-
|
|
7
|
-
export const Skeleton = ({ className, repeat = 1, ...props }: SkeletonProps) => {
|
|
8
|
-
return (
|
|
9
|
-
<>
|
|
10
|
-
{Array.from({ length: repeat ?? 1 }).map((_, index) => (
|
|
11
|
-
<div
|
|
12
|
-
key={index}
|
|
13
|
-
className={cn('animate-pulse rounded-md bg-gray-700/10', className)}
|
|
14
|
-
{...props}
|
|
15
|
-
/>
|
|
16
|
-
))}
|
|
17
|
-
</>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './switch'
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// organize-imports-ignore
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
4
|
-
|
|
5
|
-
import { Switch } from './switch'
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Switch> = {
|
|
8
|
-
component: Switch,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
type Story = StoryObj<typeof Switch>
|
|
13
|
-
|
|
14
|
-
const Template = () => {
|
|
15
|
-
return <Switch />
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
render: Template.bind({}),
|
|
20
|
-
args: {},
|
|
21
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { cn } from '@/lib'
|
|
2
|
-
import * as SwitchPrimitives from '@radix-ui/react-switch'
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
|
|
5
|
-
const Switch = React.forwardRef<
|
|
6
|
-
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
7
|
-
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
8
|
-
>(({ className, ...props }, ref) => (
|
|
9
|
-
<SwitchPrimitives.Root
|
|
10
|
-
className={cn(
|
|
11
|
-
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
|
|
12
|
-
className,
|
|
13
|
-
)}
|
|
14
|
-
{...props}
|
|
15
|
-
ref={ref}
|
|
16
|
-
>
|
|
17
|
-
<SwitchPrimitives.Thumb
|
|
18
|
-
className={cn(
|
|
19
|
-
'pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0',
|
|
20
|
-
)}
|
|
21
|
-
/>
|
|
22
|
-
</SwitchPrimitives.Root>
|
|
23
|
-
))
|
|
24
|
-
Switch.displayName = SwitchPrimitives.Root.displayName
|
|
25
|
-
|
|
26
|
-
export { Switch }
|
package/src/index.ts
DELETED
package/src/lib/index.ts
DELETED