@anker-in/headless-ui 0.0.10 → 0.0.11
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/cjs/components/badge.js +1 -1
- package/dist/cjs/components/badge.js.map +2 -2
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +2 -2
- package/dist/cjs/components/checkbox.js +1 -1
- package/dist/cjs/components/checkbox.js.map +2 -2
- package/dist/cjs/components/dialog.js +1 -1
- package/dist/cjs/components/dialog.js.map +2 -2
- package/dist/cjs/components/input.js +1 -1
- package/dist/cjs/components/input.js.map +2 -2
- package/dist/cjs/components/popover.js +1 -1
- package/dist/cjs/components/popover.js.map +2 -2
- package/dist/cjs/components/radio.js +1 -1
- package/dist/cjs/components/radio.js.map +2 -2
- package/dist/cjs/components/skeleton.js +1 -1
- package/dist/cjs/components/skeleton.js.map +2 -2
- package/dist/cjs/components/text.d.ts +8 -4
- package/dist/cjs/components/text.js +1 -1
- package/dist/cjs/components/text.js.map +3 -3
- package/dist/cjs/icons/spinner.js +1 -1
- package/dist/cjs/icons/spinner.js.map +2 -2
- package/dist/cjs/stories/badge.stories.js +1 -1
- package/dist/cjs/stories/badge.stories.js.map +2 -2
- package/dist/cjs/stories/button.stories.js +1 -1
- package/dist/cjs/stories/button.stories.js.map +2 -2
- package/dist/cjs/stories/checkbox.stories.js +1 -1
- package/dist/cjs/stories/checkbox.stories.js.map +2 -2
- package/dist/cjs/stories/dialog.stories.js +1 -1
- package/dist/cjs/stories/dialog.stories.js.map +2 -2
- package/dist/cjs/stories/input.stories.js +1 -1
- package/dist/cjs/stories/input.stories.js.map +2 -2
- package/dist/cjs/stories/popover.stories.js +1 -1
- package/dist/cjs/stories/popover.stories.js.map +2 -2
- package/dist/cjs/stories/radio.stories.js +1 -1
- package/dist/cjs/stories/radio.stories.js.map +2 -2
- package/dist/cjs/stories/skeleton.stories.js +1 -1
- package/dist/cjs/stories/skeleton.stories.js.map +2 -2
- package/dist/cjs/stories/text.stories.d.ts +24 -3
- package/dist/cjs/stories/text.stories.js +1 -1
- package/dist/cjs/stories/text.stories.js.map +2 -2
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/components/badge.js +1 -1
- package/dist/esm/components/badge.js.map +2 -2
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/button.js.map +2 -2
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/checkbox.js.map +2 -2
- package/dist/esm/components/dialog.js +1 -1
- package/dist/esm/components/dialog.js.map +2 -2
- package/dist/esm/components/input.js +1 -1
- package/dist/esm/components/input.js.map +2 -2
- package/dist/esm/components/popover.js +1 -1
- package/dist/esm/components/popover.js.map +2 -2
- package/dist/esm/components/radio.js +1 -1
- package/dist/esm/components/radio.js.map +2 -2
- package/dist/esm/components/skeleton.js +1 -1
- package/dist/esm/components/skeleton.js.map +2 -2
- package/dist/esm/components/text.d.ts +8 -4
- package/dist/esm/components/text.js +1 -1
- package/dist/esm/components/text.js.map +3 -3
- package/dist/esm/icons/spinner.js +1 -1
- package/dist/esm/icons/spinner.js.map +2 -2
- package/dist/esm/stories/badge.stories.js +1 -1
- package/dist/esm/stories/badge.stories.js.map +2 -2
- package/dist/esm/stories/button.stories.js +1 -1
- package/dist/esm/stories/button.stories.js.map +2 -2
- package/dist/esm/stories/checkbox.stories.js +1 -1
- package/dist/esm/stories/checkbox.stories.js.map +2 -2
- package/dist/esm/stories/dialog.stories.js +1 -1
- package/dist/esm/stories/dialog.stories.js.map +2 -2
- package/dist/esm/stories/input.stories.js +1 -1
- package/dist/esm/stories/input.stories.js.map +2 -2
- package/dist/esm/stories/popover.stories.js +1 -1
- package/dist/esm/stories/popover.stories.js.map +2 -2
- package/dist/esm/stories/radio.stories.js +1 -1
- package/dist/esm/stories/radio.stories.js.map +2 -2
- package/dist/esm/stories/skeleton.stories.js +1 -1
- package/dist/esm/stories/skeleton.stories.js.map +2 -2
- package/dist/esm/stories/text.stories.d.ts +24 -3
- package/dist/esm/stories/text.stories.js +1 -1
- package/dist/esm/stories/text.stories.js.map +2 -2
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/badge.tsx +5 -5
- package/src/components/button.tsx +14 -14
- package/src/components/checkbox.tsx +3 -3
- package/src/components/dialog.tsx +12 -9
- package/src/components/input.tsx +8 -8
- package/src/components/popover.tsx +1 -1
- package/src/components/radio.tsx +3 -3
- package/src/components/skeleton.tsx +1 -1
- package/src/components/text.tsx +34 -14
- package/src/icons/spinner.tsx +1 -1
- package/src/stories/badge.stories.tsx +1 -1
- package/src/stories/button.stories.tsx +1 -1
- package/src/stories/checkbox.stories.tsx +2 -2
- package/src/stories/dialog.stories.tsx +8 -8
- package/src/stories/input.stories.tsx +2 -2
- package/src/stories/popover.stories.tsx +2 -2
- package/src/stories/radio.stories.tsx +4 -4
- package/src/stories/skeleton.stories.tsx +5 -5
- package/src/stories/text.stories.tsx +26 -1
- package/style.css +180 -171
package/package.json
CHANGED
package/src/components/badge.tsx
CHANGED
|
@@ -4,14 +4,14 @@ import { type VariantProps, cva } from 'class-variance-authority'
|
|
|
4
4
|
import { cn } from '../helpers/index.js'
|
|
5
5
|
|
|
6
6
|
const badgeVariants = cva(
|
|
7
|
-
'inline-flex items-center rounded-[20px] border px-[10px] py-1 text-xs
|
|
7
|
+
'ai-inline-flex ai-items-center ai-font-medium ai-rounded-[20px] ai-border ai-px-[10px] ai-py-1 ai-text-xs ai-transition-colors focus:ai-outline-none',
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
|
-
default: 'bg-badge text-badge-foreground border-transparent',
|
|
12
|
-
secondary: 'bg-secondary text-secondary-foreground border-transparent',
|
|
13
|
-
destructive: 'bg-destructive text-destructive-foreground border-transparent',
|
|
14
|
-
outline: 'text-foreground',
|
|
11
|
+
default: 'ai-bg-badge ai-text-badge-foreground ai-border-transparent',
|
|
12
|
+
secondary: 'ai-bg-secondary ai-text-secondary-foreground ai-border-transparent',
|
|
13
|
+
destructive: 'ai-bg-destructive ai-text-destructive-foreground ai-border-transparent',
|
|
14
|
+
outline: 'ai-text-foreground',
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
defaultVariants: {
|
|
@@ -11,22 +11,22 @@ import { cn } from '../helpers/index.js'
|
|
|
11
11
|
* Button Variants
|
|
12
12
|
*/
|
|
13
13
|
const buttonVariants = cva(
|
|
14
|
-
'ring-offset-background focus-visible:ring-ring rounded-btn inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
14
|
+
'ai-ring-offset-background focus-visible:ai-ring-ring ai-rounded-btn ai-inline-flex ai-items-center ai-justify-center ai-whitespace-nowrap ai-text-sm ai-font-medium ai-transition-colors focus-visible:ai-outline-none focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2 disabled:ai-pointer-events-none disabled:ai-opacity-50',
|
|
15
15
|
{
|
|
16
16
|
variants: {
|
|
17
17
|
variant: {
|
|
18
18
|
primary:
|
|
19
|
-
'bg-btn-primary text-btn-primary-foreground hover:bg-btn-primary-active disabled:bg-btn-primary-disabled disabled:text-btn-primary-disabled-foreground',
|
|
19
|
+
'ai-bg-btn-primary ai-text-btn-primary-foreground hover:ai-bg-btn-primary-active disabled:ai-bg-btn-primary-disabled disabled:ai-text-btn-primary-disabled-foreground',
|
|
20
20
|
secondary:
|
|
21
|
-
'bg-btn-secondary border-primary text-btn-secondary-foreground hover:bg-btn-secondary-active hover:text-btn-secondary disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground border border-solid',
|
|
22
|
-
link: 'text-primary underline-offset-4 hover:underline',
|
|
23
|
-
ghost: 'hover:bg-btn-primary hover:text-btn-primary-foreground',
|
|
21
|
+
'ai-bg-btn-secondary ai-border-primary ai-text-btn-secondary-foreground hover:ai-bg-btn-secondary-active hover:ai-text-btn-secondary disabled:ai-bg-btn-secondary-disabled disabled:ai-text-btn-secondary-disabled-foreground ai-border ai-border-solid',
|
|
22
|
+
link: 'ai-text-primary ai-underline-offset-4 hover:ai-underline',
|
|
23
|
+
ghost: 'hover:ai-bg-btn-primary hover:ai-text-btn-primary-foreground',
|
|
24
24
|
},
|
|
25
25
|
size: {
|
|
26
|
-
sm: 'h-8 px-3 py-1',
|
|
27
|
-
base: 'h-10 px-4 py-2',
|
|
28
|
-
lg: 'h-11 px-8',
|
|
29
|
-
icon: 'size-10 rounded-full',
|
|
26
|
+
sm: 'ai-h-8 ai-px-3 ai-py-1 ai-text-[12px]',
|
|
27
|
+
base: 'ai-h-10 ai-px-4 ai-py-2 ai-text-[14px]',
|
|
28
|
+
lg: 'ai-h-11 ai-px-8 ai-text-[16px]',
|
|
29
|
+
icon: 'ai-size-10 ai-rounded-full',
|
|
30
30
|
},
|
|
31
31
|
/** hover 状态下的动画效果,需要注意不同variant 下的效果 */
|
|
32
32
|
hoverEffect: {
|
|
@@ -39,13 +39,13 @@ const buttonVariants = cva(
|
|
|
39
39
|
variant: 'primary',
|
|
40
40
|
hoverEffect: 'slide',
|
|
41
41
|
class:
|
|
42
|
-
'before:rounded-btn hover
|
|
42
|
+
'ai-z-[1] before:-ai-z-[1] before:ai-rounded-btn hover:!ai-bg-btn-primary before:ai-bg-btn-primary-active ai-relative ai-overflow-hidden before:ai-absolute before:ai-inset-y-0 before:ai-w-full before:-ai-translate-x-full before:ai-transition-transform before:ai-duration-300 before:ai-ease-in-out before:ai-content-[""] hover:before:ai-translate-x-0',
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
variant: 'secondary',
|
|
46
46
|
hoverEffect: 'slide',
|
|
47
47
|
class:
|
|
48
|
-
'before:rounded-btn hover
|
|
48
|
+
'ai-z-[1] before:-ai-z-[1] before:ai-rounded-btn hover:!ai-bg-btn-secondary before:ai-bg-btn-secondary-active ai-relative ai-overflow-hidden before:ai-absolute before:ai-inset-y-0 before:ai-w-full before:-ai-translate-x-full before:ai-transition-transform before:ai-duration-300 before:ai-ease-in-out before:ai-content-[""] hover:before:ai-translate-x-0',
|
|
49
49
|
},
|
|
50
50
|
],
|
|
51
51
|
defaultVariants: {
|
|
@@ -90,7 +90,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
90
90
|
className={cn(
|
|
91
91
|
buttonVariants({ variant, size, hoverEffect }),
|
|
92
92
|
{
|
|
93
|
-
'cursor-not-allowed': disabled,
|
|
93
|
+
'ai-cursor-not-allowed': disabled,
|
|
94
94
|
},
|
|
95
95
|
className
|
|
96
96
|
)}
|
|
@@ -102,13 +102,13 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
102
102
|
<span style={{ display: 'contents', visibility: 'hidden' }} aria-hidden>
|
|
103
103
|
{children}
|
|
104
104
|
</span>
|
|
105
|
-
<span className="absolute">
|
|
105
|
+
<span className="ai-absolute">
|
|
106
106
|
<Spinner />
|
|
107
107
|
</span>
|
|
108
108
|
<VisuallyHidden>{children}</VisuallyHidden>
|
|
109
109
|
</>
|
|
110
110
|
) : (
|
|
111
|
-
|
|
111
|
+
children
|
|
112
112
|
)}
|
|
113
113
|
</Comp>
|
|
114
114
|
)
|
|
@@ -13,13 +13,13 @@ const Checkbox = React.forwardRef<
|
|
|
13
13
|
<CheckboxPrimitive.Root
|
|
14
14
|
ref={ref}
|
|
15
15
|
className={cn(
|
|
16
|
-
'border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground peer size-4 shrink-0 rounded-sm border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
|
|
16
|
+
'ai-border-primary ai-ring-offset-background focus-visible:ai-ring-ring data-[state=checked]:ai-bg-primary data-[state=checked]:ai-text-primary-foreground ai-peer ai-size-4 ai-shrink-0 ai-rounded-sm ai-border focus-visible:ai-outline-none focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2 disabled:ai-cursor-not-allowed disabled:ai-opacity-50',
|
|
17
17
|
className
|
|
18
18
|
)}
|
|
19
19
|
{...props}
|
|
20
20
|
>
|
|
21
|
-
<CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}>
|
|
22
|
-
<CheckIcon className="size-4" />
|
|
21
|
+
<CheckboxPrimitive.Indicator className={cn('ai-flex ai-items-center ai-justify-center ai-text-current')}>
|
|
22
|
+
<CheckIcon className="ai-size-4" />
|
|
23
23
|
</CheckboxPrimitive.Indicator>
|
|
24
24
|
</CheckboxPrimitive.Root>
|
|
25
25
|
))
|
|
@@ -21,7 +21,7 @@ const DialogOverlay = React.forwardRef<
|
|
|
21
21
|
<DialogPrimitive.Overlay
|
|
22
22
|
ref={ref}
|
|
23
23
|
className={cn(
|
|
24
|
-
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80',
|
|
24
|
+
'data-[state=open]:ai-animate-in data-[state=closed]:ai-animate-out data-[state=closed]:ai-fade-out-0 data-[state=open]:ai-fade-in-0 ai-fixed ai-inset-0 ai-z-50 ai-bg-black/80',
|
|
25
25
|
className
|
|
26
26
|
)}
|
|
27
27
|
{...props}
|
|
@@ -38,15 +38,15 @@ const DialogContent = React.forwardRef<
|
|
|
38
38
|
<DialogPrimitive.Content
|
|
39
39
|
ref={ref}
|
|
40
40
|
className={cn(
|
|
41
|
-
'bg-background 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%] fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg',
|
|
41
|
+
'ai-bg-background data-[state=open]:ai-animate-in data-[state=closed]:ai-animate-out data-[state=closed]:ai-fade-out-0 data-[state=open]:ai-fade-in-0 data-[state=closed]:ai-zoom-out-95 data-[state=open]:ai-zoom-in-95 data-[state=closed]:ai-slide-out-to-left-1/2 data-[state=closed]:ai-slide-out-to-top-[48%] data-[state=open]:ai-slide-in-from-left-1/2 data-[state=open]:ai-slide-in-from-top-[48%] ai-fixed ai-left-1/2 ai-top-1/2 ai-z-50 ai-grid ai-w-full ai-max-w-lg -ai-translate-x-1/2 -ai-translate-y-1/2 ai-gap-4 ai-border ai-p-6 ai-shadow-lg ai-duration-200 sm:ai-rounded-lg',
|
|
42
42
|
className
|
|
43
43
|
)}
|
|
44
44
|
{...props}
|
|
45
45
|
>
|
|
46
46
|
{children}
|
|
47
|
-
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none">
|
|
48
|
-
<Cross2Icon className="size-4" />
|
|
49
|
-
<span className="sr-only">Close</span>
|
|
47
|
+
<DialogPrimitive.Close className="ai-ring-offset-background focus:ai-ring-ring data-[state=open]:ai-bg-accent data-[state=open]:ai-text-muted-foreground ai-absolute ai-right-4 ai-top-4 ai-rounded-sm ai-opacity-70 ai-transition-opacity hover:ai-opacity-100 focus:ai-outline-none focus:ai-ring-2 focus:ai-ring-offset-2 disabled:ai-pointer-events-none">
|
|
48
|
+
<Cross2Icon className="ai-size-4" />
|
|
49
|
+
<span className="ai-sr-only">Close</span>
|
|
50
50
|
</DialogPrimitive.Close>
|
|
51
51
|
</DialogPrimitive.Content>
|
|
52
52
|
</DialogPortal>
|
|
@@ -54,12 +54,15 @@ const DialogContent = React.forwardRef<
|
|
|
54
54
|
DialogContent.displayName = DialogPrimitive.Content.displayName
|
|
55
55
|
|
|
56
56
|
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
57
|
-
<div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />
|
|
57
|
+
<div className={cn('ai-flex ai-flex-col ai-space-y-1.5 ai-text-center sm:ai-text-left', className)} {...props} />
|
|
58
58
|
)
|
|
59
59
|
DialogHeader.displayName = 'DialogHeader'
|
|
60
60
|
|
|
61
61
|
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
62
|
-
<div
|
|
62
|
+
<div
|
|
63
|
+
className={cn('ai-flex ai-flex-col-reverse sm:ai-flex-row sm:ai-justify-end sm:ai-space-x-2', className)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
63
66
|
)
|
|
64
67
|
DialogFooter.displayName = 'DialogFooter'
|
|
65
68
|
|
|
@@ -69,7 +72,7 @@ const DialogTitle = React.forwardRef<
|
|
|
69
72
|
>(({ className, ...props }, ref) => (
|
|
70
73
|
<DialogPrimitive.Title
|
|
71
74
|
ref={ref}
|
|
72
|
-
className={cn('text-lg font-semibold leading-none tracking-tight', className)}
|
|
75
|
+
className={cn('ai-text-lg ai-font-semibold ai-leading-none ai-tracking-tight', className)}
|
|
73
76
|
{...props}
|
|
74
77
|
/>
|
|
75
78
|
))
|
|
@@ -79,7 +82,7 @@ const DialogDescription = React.forwardRef<
|
|
|
79
82
|
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
80
83
|
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
81
84
|
>(({ className, ...props }, ref) => (
|
|
82
|
-
<DialogPrimitive.Description ref={ref} className={cn('text-muted-foreground text-sm', className)} {...props} />
|
|
85
|
+
<DialogPrimitive.Description ref={ref} className={cn('ai-text-muted-foreground ai-text-sm', className)} {...props} />
|
|
83
86
|
))
|
|
84
87
|
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
|
85
88
|
|
package/src/components/input.tsx
CHANGED
|
@@ -6,13 +6,13 @@ import type { ComponentPropsWithout, RemovedProps } from '@/helpers/component-pr
|
|
|
6
6
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
7
7
|
|
|
8
8
|
const inputVariants = cva(
|
|
9
|
-
'border-input bg-background focus-visible:ring-ring ring-offset-background flex
|
|
9
|
+
'ai-border-input ai-bg-background focus-visible:ai-ring-ring ai-ring-offset-background ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border ai-px-3 focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2',
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
12
12
|
size: {
|
|
13
|
-
sm: 'h-8',
|
|
14
|
-
base: 'h-10',
|
|
15
|
-
lg: 'h-12',
|
|
13
|
+
sm: 'ai-h-8',
|
|
14
|
+
base: 'ai-h-10',
|
|
15
|
+
lg: 'ai-h-12',
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
defaultVariants: {
|
|
@@ -42,9 +42,9 @@ const InputSlot = React.forwardRef<InputSlotElement, InputSlotProps>((props, for
|
|
|
42
42
|
<div
|
|
43
43
|
ref={forwardedRef}
|
|
44
44
|
{...slotProps}
|
|
45
|
-
className={cn('flex h-full items-center px-2', className, {
|
|
46
|
-
'-order-1 pl-0': side === 'left',
|
|
47
|
-
'order-2 pr-0': side === 'right',
|
|
45
|
+
className={cn('ai-flex ai-h-full ai-items-center ai-px-2', className, {
|
|
46
|
+
'-ai-order-1 ai-pl-0': side === 'left',
|
|
47
|
+
'ai-order-2 ai-pr-0': side === 'right',
|
|
48
48
|
})}
|
|
49
49
|
>
|
|
50
50
|
{children}
|
|
@@ -59,7 +59,7 @@ const Input = React.forwardRef<React.ElementRef<'input'>, InputProps>(
|
|
|
59
59
|
<input
|
|
60
60
|
type={type}
|
|
61
61
|
className={cn(
|
|
62
|
-
'placeholder:text-muted-foreground flex size-full text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50'
|
|
62
|
+
'placeholder:ai-text-muted-foreground ai-flex ai-size-full ai-text-sm file:ai-border-0 file:ai-bg-transparent file:ai-text-sm file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50'
|
|
63
63
|
)}
|
|
64
64
|
ref={ref}
|
|
65
65
|
{...props}
|
|
@@ -19,7 +19,7 @@ const PopoverContent = React.forwardRef<
|
|
|
19
19
|
align={align}
|
|
20
20
|
sideOffset={sideOffset}
|
|
21
21
|
className={cn(
|
|
22
|
-
'bg-popover text-popover-foreground 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 z-50 w-72 rounded-md border p-4 shadow-md outline-none',
|
|
22
|
+
'ai-bg-popover ai-text-popover-foreground data-[state=open]:ai-animate-in data-[state=closed]:ai-animate-out data-[state=closed]:ai-fade-out-0 data-[state=open]:ai-fade-in-0 data-[state=closed]:ai-zoom-out-95 data-[state=open]:ai-zoom-in-95 data-[side=bottom]:ai-slide-in-from-top-2 data-[side=left]:ai-slide-in-from-right-2 data-[side=right]:ai-slide-in-from-left-2 data-[side=top]:ai-slide-in-from-bottom-2 ai-z-50 ai-w-72 ai-rounded-md ai-border ai-p-4 ai-shadow-md ai-outline-none',
|
|
23
23
|
className
|
|
24
24
|
)}
|
|
25
25
|
{...props}
|
package/src/components/radio.tsx
CHANGED
|
@@ -22,13 +22,13 @@ const RadioGroupItem = React.forwardRef<
|
|
|
22
22
|
<RadioGroupPrimitive.Item
|
|
23
23
|
ref={ref}
|
|
24
24
|
className={cn(
|
|
25
|
-
'border-primary text-primary ring-offset-background focus-visible:ring-ring aspect-square size-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
|
|
25
|
+
'ai-border-primary ai-text-primary ai-ring-offset-background focus-visible:ai-ring-ring ai-aspect-square ai-size-4 ai-rounded-full ai-border focus:ai-outline-none focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2 disabled:ai-cursor-not-allowed disabled:ai-opacity-50',
|
|
26
26
|
className
|
|
27
27
|
)}
|
|
28
28
|
{...props}
|
|
29
29
|
>
|
|
30
|
-
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
31
|
-
<CheckIcon className="text-primary size-2.5 fill-current" />
|
|
30
|
+
<RadioGroupPrimitive.Indicator className="ai-flex ai-items-center ai-justify-center">
|
|
31
|
+
<CheckIcon className="ai-text-primary ai-size-2.5 ai-fill-current" />
|
|
32
32
|
</RadioGroupPrimitive.Indicator>
|
|
33
33
|
</RadioGroupPrimitive.Item>
|
|
34
34
|
)
|
|
@@ -2,7 +2,7 @@ import * as React from 'react'
|
|
|
2
2
|
import { cn } from '../helpers/index.js'
|
|
3
3
|
|
|
4
4
|
function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
5
|
-
return <div className={cn('bg-skeleton size-12 animate-pulse', className)} {...props} />
|
|
5
|
+
return <div className={cn('ai-bg-skeleton ai-size-12 ai-animate-pulse', className)} {...props} />
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
Skeleton.displayName = 'Skeleton'
|
package/src/components/text.tsx
CHANGED
|
@@ -6,28 +6,47 @@ import { type VariantProps, cva } from 'class-variance-authority'
|
|
|
6
6
|
const textVariants = cva('', {
|
|
7
7
|
variants: {
|
|
8
8
|
size: {
|
|
9
|
-
1: 'text-xs',
|
|
10
|
-
2: 'text-sm',
|
|
11
|
-
3: 'text-base',
|
|
12
|
-
4: 'text-lg',
|
|
13
|
-
5: 'text-xl',
|
|
14
|
-
6: 'text-2xl',
|
|
15
|
-
7: 'text-3xl',
|
|
16
|
-
8: 'text-4xl',
|
|
17
|
-
9: 'text-5xl',
|
|
9
|
+
1: 'ai-text-xs',
|
|
10
|
+
2: 'ai-text-sm',
|
|
11
|
+
3: 'ai-text-base',
|
|
12
|
+
4: 'ai-text-lg',
|
|
13
|
+
5: 'ai-text-xl',
|
|
14
|
+
6: 'ai-text-2xl',
|
|
15
|
+
7: 'ai-text-3xl',
|
|
16
|
+
8: 'ai-text-4xl',
|
|
17
|
+
9: 'ai-text-5xl',
|
|
18
18
|
},
|
|
19
|
+
weights: {
|
|
20
|
+
light: 'ai-font-light',
|
|
21
|
+
normal: 'ai-font-normal',
|
|
22
|
+
medium: 'ai-font-medium',
|
|
23
|
+
bold: 'ai-font-bold',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
size: 3,
|
|
28
|
+
weights: 'normal',
|
|
19
29
|
},
|
|
20
30
|
})
|
|
21
31
|
|
|
22
32
|
type TextElement = React.ElementRef<'span'>
|
|
23
|
-
interface TextProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
33
|
+
interface TextProps extends React.ComponentPropsWithoutRef<'span'>, VariantProps<typeof textVariants> {
|
|
24
34
|
as?: 'div' | 'label' | 'p' | 'span' | undefined
|
|
25
35
|
asChild?: boolean
|
|
26
36
|
color?: string
|
|
37
|
+
/** 相当于 dangerouslySetInnerHTML */
|
|
38
|
+
html?: string
|
|
27
39
|
}
|
|
28
40
|
|
|
29
|
-
const Text = React.forwardRef<TextElement, TextProps
|
|
30
|
-
const { children, size, className, asChild, as: Tag = 'span', color, ...textProps } = props
|
|
41
|
+
const Text = React.forwardRef<TextElement, TextProps>((props, forwardedRef) => {
|
|
42
|
+
const { children, size, className, asChild, as: Tag = 'span', color, html, ...textProps } = props
|
|
43
|
+
|
|
44
|
+
const htmlContentProps = html
|
|
45
|
+
? {
|
|
46
|
+
dangerouslySetInnerHTML: { __html: html },
|
|
47
|
+
}
|
|
48
|
+
: null
|
|
49
|
+
|
|
31
50
|
return (
|
|
32
51
|
<Slot
|
|
33
52
|
{...textProps}
|
|
@@ -37,10 +56,11 @@ const Text = React.forwardRef<TextElement, TextProps & VariantProps<typeof textV
|
|
|
37
56
|
size: size,
|
|
38
57
|
}),
|
|
39
58
|
className,
|
|
40
|
-
color
|
|
59
|
+
`text-[${color}]`
|
|
41
60
|
)}
|
|
61
|
+
{...htmlContentProps}
|
|
42
62
|
>
|
|
43
|
-
{asChild ? children : <Tag>{children}</Tag>}
|
|
63
|
+
{asChild ? children : <Tag>{htmlContentProps ? null : children}</Tag>}
|
|
44
64
|
</Slot>
|
|
45
65
|
)
|
|
46
66
|
})
|
package/src/icons/spinner.tsx
CHANGED
|
@@ -33,7 +33,7 @@ export const Default: Story = {}
|
|
|
33
33
|
export const Examples: Story = {
|
|
34
34
|
render() {
|
|
35
35
|
return (
|
|
36
|
-
<div className="flex flex-col space-y-4">
|
|
36
|
+
<div className="ai-flex ai-flex-col ai-space-y-4">
|
|
37
37
|
<Badge variant="default">Default</Badge>
|
|
38
38
|
<Badge variant="secondary">Secondary</Badge>
|
|
39
39
|
<Badge variant="destructive">Destructive</Badge>
|
|
@@ -4,11 +4,11 @@ import React from 'react'
|
|
|
4
4
|
export default { title: 'Components/Checkbox' }
|
|
5
5
|
|
|
6
6
|
export const Default = () => (
|
|
7
|
-
<div className="flex items-center space-x-2">
|
|
7
|
+
<div className="ai-flex ai-items-center ai-space-x-2">
|
|
8
8
|
<Checkbox id="terms" />
|
|
9
9
|
<label
|
|
10
10
|
htmlFor="terms"
|
|
11
|
-
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
11
|
+
className="ai-text-sm ai-font-medium ai-leading-none peer-disabled:ai-cursor-not-allowed peer-disabled:ai-opacity-70"
|
|
12
12
|
>
|
|
13
13
|
Accept terms and conditions
|
|
14
14
|
</label>
|
|
@@ -18,23 +18,23 @@ export const Default = () => (
|
|
|
18
18
|
<DialogTrigger asChild>
|
|
19
19
|
<button>Edit Profile</button>
|
|
20
20
|
</DialogTrigger>
|
|
21
|
-
<DialogContent className="sm:max-w-[425px]">
|
|
21
|
+
<DialogContent className="sm:ai-max-w-[425px]">
|
|
22
22
|
<DialogHeader>
|
|
23
23
|
<DialogTitle>Edit profile</DialogTitle>
|
|
24
24
|
<DialogDescription>Make changes to your profile here. Click save when you're done.</DialogDescription>
|
|
25
25
|
</DialogHeader>
|
|
26
|
-
<div className="grid gap-4 py-4">
|
|
27
|
-
<div className="grid grid-cols-4 items-center gap-4">
|
|
28
|
-
<label htmlFor="name" className="text-right">
|
|
26
|
+
<div className="ai-grid ai-gap-4 ai-py-4">
|
|
27
|
+
<div className="ai-grid ai-grid-cols-4 ai-items-center ai-gap-4">
|
|
28
|
+
<label htmlFor="name" className="ai-text-right">
|
|
29
29
|
Name
|
|
30
30
|
</label>
|
|
31
|
-
<Input id="name" defaultValue="Pedro Duarte" className="col-span-3" />
|
|
31
|
+
<Input id="name" defaultValue="Pedro Duarte" className="ai-col-span-3" />
|
|
32
32
|
</div>
|
|
33
|
-
<div className="grid grid-cols-4 items-center gap-4">
|
|
34
|
-
<label htmlFor="username" className="text-right">
|
|
33
|
+
<div className="ai-grid ai-grid-cols-4 ai-items-center ai-gap-4">
|
|
34
|
+
<label htmlFor="username" className="ai-text-right">
|
|
35
35
|
Username
|
|
36
36
|
</label>
|
|
37
|
-
<Input id="username" defaultValue="@peduarte" className="col-span-3" />
|
|
37
|
+
<Input id="username" defaultValue="@peduarte" className="ai-col-span-3" />
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
40
|
<DialogFooter>
|
|
@@ -36,9 +36,9 @@ export const Default: Story = {
|
|
|
36
36
|
export const WithButton: Story = {
|
|
37
37
|
render() {
|
|
38
38
|
return (
|
|
39
|
-
<Input className="rounded-3xl pr-0" placeholder="Enter your email" type="text">
|
|
39
|
+
<Input className="ai-rounded-3xl ai-pr-0" placeholder="Enter your email" type="text">
|
|
40
40
|
<InputSlot side="right">
|
|
41
|
-
<Button className="h-full rounded-none" size="sm">
|
|
41
|
+
<Button className="ai-h-full ai-rounded-none" size="sm">
|
|
42
42
|
subscribe
|
|
43
43
|
</Button>
|
|
44
44
|
</InputSlot>
|
|
@@ -8,8 +8,8 @@ export const Default = () => (
|
|
|
8
8
|
<PopoverTrigger asChild>
|
|
9
9
|
<button>Open popover</button>
|
|
10
10
|
</PopoverTrigger>
|
|
11
|
-
<PopoverContent className="w-80">
|
|
12
|
-
<div className="grid gap-4">
|
|
11
|
+
<PopoverContent className="ai-w-80">
|
|
12
|
+
<div className="ai-grid ai-gap-4">
|
|
13
13
|
<p>
|
|
14
14
|
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
|
|
15
15
|
standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to
|
|
@@ -4,13 +4,13 @@ import React from 'react'
|
|
|
4
4
|
export default { title: 'Components/Radio' }
|
|
5
5
|
|
|
6
6
|
export const Default = () => (
|
|
7
|
-
<div className="flex h-40 w-48 items-center justify-center">
|
|
8
|
-
<RadioGroup defaultValue="option-one">
|
|
9
|
-
<div className="flex items-center space-x-2">
|
|
7
|
+
<div className="ai-flex ai-h-40 ai-w-48 ai-items-center ai-justify-center">
|
|
8
|
+
<RadioGroup defaultValue="ai-option-one">
|
|
9
|
+
<div className="ai-flex ai-items-center ai-space-x-2">
|
|
10
10
|
<RadioGroupItem value="option-one" id="option-one" />
|
|
11
11
|
<label htmlFor="option-one">Option One</label>
|
|
12
12
|
</div>
|
|
13
|
-
<div className="flex items-center space-x-2">
|
|
13
|
+
<div className="ai-flex ai-items-center ai-space-x-2">
|
|
14
14
|
<RadioGroupItem value="option-two" id="option-two" />
|
|
15
15
|
<label htmlFor="option-two">Option Two</label>
|
|
16
16
|
</div>
|
|
@@ -21,12 +21,12 @@ export const Default: Story = {}
|
|
|
21
21
|
export const Example: Story = {
|
|
22
22
|
render() {
|
|
23
23
|
return (
|
|
24
|
-
<div className="flex flex-col items-center justify-center">
|
|
25
|
-
<div className="flex w-full justify-between">
|
|
26
|
-
<Skeleton className="size-12 rounded-full" />
|
|
27
|
-
<Skeleton className="h-12 w-[70%] " />
|
|
24
|
+
<div className="ai-flex ai-flex-col ai-items-center ai-justify-center">
|
|
25
|
+
<div className="ai-flex ai-w-full ai-justify-between">
|
|
26
|
+
<Skeleton className="ai-size-12 ai-rounded-full" />
|
|
27
|
+
<Skeleton className="ai-h-12 ai-w-[70%] " />
|
|
28
28
|
</div>
|
|
29
|
-
<Skeleton className="mt-2 h-40 w-[200px]" />
|
|
29
|
+
<Skeleton className="ai-mt-2 ai-h-40 ai-w-[200px]" />
|
|
30
30
|
</div>
|
|
31
31
|
)
|
|
32
32
|
},
|
|
@@ -10,6 +10,29 @@ const meta = {
|
|
|
10
10
|
layout: 'centered',
|
|
11
11
|
},
|
|
12
12
|
tags: ['autodocs'],
|
|
13
|
+
argTypes: {
|
|
14
|
+
size: {
|
|
15
|
+
control: {
|
|
16
|
+
type: 'select',
|
|
17
|
+
},
|
|
18
|
+
options: [1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
19
|
+
},
|
|
20
|
+
weights: {
|
|
21
|
+
control: {
|
|
22
|
+
type: 'select',
|
|
23
|
+
},
|
|
24
|
+
options: ['light', 'normal', 'medium', 'bold'],
|
|
25
|
+
},
|
|
26
|
+
html: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: '相当于 dangerouslySetInnerHTML',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
args: {
|
|
32
|
+
size: 3,
|
|
33
|
+
weights: 'normal',
|
|
34
|
+
html: '',
|
|
35
|
+
},
|
|
13
36
|
} satisfies Meta<typeof Text>
|
|
14
37
|
|
|
15
38
|
export default meta
|
|
@@ -18,10 +41,12 @@ type Story = StoryObj<typeof meta>
|
|
|
18
41
|
export const Default: Story = {
|
|
19
42
|
args: {
|
|
20
43
|
children: ' The quick brown fox jumps over the lazy dog.',
|
|
44
|
+
size: 3,
|
|
45
|
+
weights: 'normal',
|
|
21
46
|
},
|
|
22
47
|
}
|
|
23
48
|
|
|
24
|
-
const sizes = new Array(
|
|
49
|
+
const sizes = new Array(9).fill(0).map((_, i) => i + 1)
|
|
25
50
|
export const All: Story = {
|
|
26
51
|
render() {
|
|
27
52
|
return (
|