@srcroot/ui 0.0.1 → 0.0.3
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.js +91 -0
- package/package.json +9 -3
- package/registry/badge.tsx +9 -25
- package/registry/breadcrumb.tsx +1 -1
- package/registry/button-group.tsx +9 -29
- package/registry/button.tsx +20 -46
- package/registry/calendar.tsx +416 -142
- package/registry/card.tsx +21 -47
- package/registry/combobox.tsx +171 -0
- package/registry/command.tsx +300 -0
- package/registry/container.tsx +9 -25
- package/registry/context-menu.tsx +221 -0
- package/registry/date-picker.tsx +179 -0
- package/registry/drawer.tsx +241 -0
- package/registry/dropdown-menu.tsx +93 -74
- package/registry/file-upload.tsx +240 -0
- package/registry/hover-card.tsx +165 -0
- package/registry/image.tsx +2 -2
- package/registry/kbd.tsx +60 -0
- package/registry/menubar.tsx +246 -0
- package/registry/native-select.tsx +49 -0
- package/registry/pagination.tsx +3 -0
- package/registry/resizable.tsx +251 -0
- package/registry/scroll-area.tsx +119 -0
- package/registry/search.tsx +2 -1
- package/registry/sheet.tsx +63 -18
- package/registry/sidebar.tsx +512 -0
- package/registry/slider.tsx +133 -54
- package/registry/text.tsx +7 -16
- package/registry/toggle-group.tsx +129 -0
- package/registry/toggle.tsx +72 -0
- package/registry/tooltip.tsx +21 -3
package/dist/index.js
CHANGED
|
@@ -500,6 +500,97 @@ var REGISTRY = {
|
|
|
500
500
|
description: "Date picker",
|
|
501
501
|
category: "Forms",
|
|
502
502
|
dependencies: []
|
|
503
|
+
},
|
|
504
|
+
sidebar: {
|
|
505
|
+
file: "sidebar.tsx",
|
|
506
|
+
description: "Responsive sidebar with mobile drawer",
|
|
507
|
+
category: "Layout",
|
|
508
|
+
dependencies: ["sheet", "button"]
|
|
509
|
+
},
|
|
510
|
+
// Added Components
|
|
511
|
+
combobox: {
|
|
512
|
+
file: "combobox.tsx",
|
|
513
|
+
description: "Searchable select with autocomplete",
|
|
514
|
+
category: "Forms",
|
|
515
|
+
dependencies: ["popover"]
|
|
516
|
+
},
|
|
517
|
+
command: {
|
|
518
|
+
file: "command.tsx",
|
|
519
|
+
description: "Command palette / search menu",
|
|
520
|
+
category: "Navigation",
|
|
521
|
+
dependencies: []
|
|
522
|
+
},
|
|
523
|
+
"context-menu": {
|
|
524
|
+
file: "context-menu.tsx",
|
|
525
|
+
description: "Right-click context menu",
|
|
526
|
+
category: "Overlay / Feedback",
|
|
527
|
+
dependencies: []
|
|
528
|
+
},
|
|
529
|
+
"date-picker": {
|
|
530
|
+
file: "date-picker.tsx",
|
|
531
|
+
description: "Date picker with calendar",
|
|
532
|
+
category: "Forms",
|
|
533
|
+
dependencies: ["calendar", "popover", "button"]
|
|
534
|
+
},
|
|
535
|
+
drawer: {
|
|
536
|
+
file: "drawer.tsx",
|
|
537
|
+
description: "Bottom/top sheet drawer",
|
|
538
|
+
category: "Overlay / Feedback",
|
|
539
|
+
dependencies: []
|
|
540
|
+
},
|
|
541
|
+
"file-upload": {
|
|
542
|
+
file: "file-upload.tsx",
|
|
543
|
+
description: "Drag-and-drop file upload",
|
|
544
|
+
category: "Forms",
|
|
545
|
+
dependencies: []
|
|
546
|
+
},
|
|
547
|
+
"hover-card": {
|
|
548
|
+
file: "hover-card.tsx",
|
|
549
|
+
description: "Hover-triggered popover",
|
|
550
|
+
category: "Overlay / Feedback",
|
|
551
|
+
dependencies: []
|
|
552
|
+
},
|
|
553
|
+
kbd: {
|
|
554
|
+
file: "kbd.tsx",
|
|
555
|
+
description: "Keyboard shortcut display",
|
|
556
|
+
category: "Typography",
|
|
557
|
+
dependencies: []
|
|
558
|
+
},
|
|
559
|
+
menubar: {
|
|
560
|
+
file: "menubar.tsx",
|
|
561
|
+
description: "Horizontal menu with dropdowns",
|
|
562
|
+
category: "Navigation",
|
|
563
|
+
dependencies: []
|
|
564
|
+
},
|
|
565
|
+
"native-select": {
|
|
566
|
+
file: "native-select.tsx",
|
|
567
|
+
description: "Styled browser-native select",
|
|
568
|
+
category: "Forms",
|
|
569
|
+
dependencies: []
|
|
570
|
+
},
|
|
571
|
+
resizable: {
|
|
572
|
+
file: "resizable.tsx",
|
|
573
|
+
description: "Resizable panel layout",
|
|
574
|
+
category: "Layout",
|
|
575
|
+
dependencies: []
|
|
576
|
+
},
|
|
577
|
+
"scroll-area": {
|
|
578
|
+
file: "scroll-area.tsx",
|
|
579
|
+
description: "Custom scrollbar container",
|
|
580
|
+
category: "Layout",
|
|
581
|
+
dependencies: []
|
|
582
|
+
},
|
|
583
|
+
toggle: {
|
|
584
|
+
file: "toggle.tsx",
|
|
585
|
+
description: "Toggle button",
|
|
586
|
+
category: "Forms",
|
|
587
|
+
dependencies: []
|
|
588
|
+
},
|
|
589
|
+
"toggle-group": {
|
|
590
|
+
file: "toggle-group.tsx",
|
|
591
|
+
description: "Grouped toggle buttons",
|
|
592
|
+
category: "Forms",
|
|
593
|
+
dependencies: ["toggle"]
|
|
503
594
|
}
|
|
504
595
|
};
|
|
505
596
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srcroot/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "A shadcn-style CLI UI library with polymorphic, accessible React components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -38,6 +38,12 @@
|
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^18.0.0 || ^19.0.0",
|
|
41
|
-
"react-dom": "^18.0.0 || ^19.0.0"
|
|
41
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
42
|
+
"lucide-react": "^0.300.0",
|
|
43
|
+
"cmdk": "^1.0.0",
|
|
44
|
+
"class-variance-authority": "^0.7.0",
|
|
45
|
+
"clsx": "^2.0.0",
|
|
46
|
+
"tailwind-merge": "^2.0.0",
|
|
47
|
+
"tailwindcss": "^3.0.0"
|
|
42
48
|
}
|
|
43
|
-
}
|
|
49
|
+
}
|
package/registry/badge.tsx
CHANGED
|
@@ -22,15 +22,12 @@ const badgeVariants = cva(
|
|
|
22
22
|
}
|
|
23
23
|
)
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
className?: string
|
|
29
|
-
children?: React.ReactNode
|
|
30
|
-
}
|
|
25
|
+
interface BadgeProps
|
|
26
|
+
extends React.HTMLAttributes<HTMLSpanElement>,
|
|
27
|
+
VariantProps<typeof badgeVariants> { }
|
|
31
28
|
|
|
32
29
|
/**
|
|
33
|
-
*
|
|
30
|
+
* Badge component for status indicators
|
|
34
31
|
*
|
|
35
32
|
* @example
|
|
36
33
|
* // Default badge
|
|
@@ -38,26 +35,13 @@ interface BadgeBaseProps extends BadgeVariants {
|
|
|
38
35
|
*
|
|
39
36
|
* // Destructive variant
|
|
40
37
|
* <Badge variant="destructive">Error</Badge>
|
|
41
|
-
*
|
|
42
|
-
* // As a link
|
|
43
|
-
* <Badge as="a" href="/status">View Status</Badge>
|
|
44
38
|
*/
|
|
45
|
-
const Badge = React.forwardRef(
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
as,
|
|
49
|
-
className,
|
|
50
|
-
variant,
|
|
51
|
-
...props
|
|
52
|
-
}: BadgeBaseProps & { as?: T } & Omit<React.ComponentPropsWithoutRef<T>, keyof BadgeBaseProps | "as">,
|
|
53
|
-
ref: React.ForwardedRef<React.ElementRef<T>>
|
|
54
|
-
) => {
|
|
55
|
-
const Comp = as || "span"
|
|
56
|
-
|
|
39
|
+
const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
|
|
40
|
+
({ className, variant, ...props }, ref) => {
|
|
57
41
|
return (
|
|
58
|
-
<
|
|
59
|
-
ref={ref
|
|
60
|
-
className={cn(badgeVariants({ variant, className
|
|
42
|
+
<span
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(badgeVariants({ variant }), className)}
|
|
61
45
|
{...props}
|
|
62
46
|
/>
|
|
63
47
|
)
|
package/registry/breadcrumb.tsx
CHANGED
|
@@ -33,15 +33,12 @@ const buttonGroupVariants = cva("inline-flex", {
|
|
|
33
33
|
},
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
className?: string
|
|
40
|
-
children?: React.ReactNode
|
|
41
|
-
}
|
|
36
|
+
interface ButtonGroupProps
|
|
37
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
38
|
+
VariantProps<typeof buttonGroupVariants> { }
|
|
42
39
|
|
|
43
40
|
/**
|
|
44
|
-
*
|
|
41
|
+
* ButtonGroup to group buttons together
|
|
45
42
|
*
|
|
46
43
|
* @example
|
|
47
44
|
* <ButtonGroup>
|
|
@@ -49,31 +46,14 @@ interface ButtonGroupBaseProps extends ButtonGroupVariants {
|
|
|
49
46
|
* <Button>Center</Button>
|
|
50
47
|
* <Button>Right</Button>
|
|
51
48
|
* </ButtonGroup>
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* <ButtonGroup attached={false}>
|
|
55
|
-
* <Button>Spaced</Button>
|
|
56
|
-
* <Button>Buttons</Button>
|
|
57
|
-
* </ButtonGroup>
|
|
58
49
|
*/
|
|
59
|
-
const ButtonGroup = React.forwardRef(
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
as,
|
|
63
|
-
className,
|
|
64
|
-
orientation,
|
|
65
|
-
attached,
|
|
66
|
-
...props
|
|
67
|
-
}: ButtonGroupBaseProps & { as?: T } & Omit<React.ComponentPropsWithoutRef<T>, keyof ButtonGroupBaseProps | "as">,
|
|
68
|
-
ref: React.ForwardedRef<React.ElementRef<T>>
|
|
69
|
-
) => {
|
|
70
|
-
const Comp = as || "div"
|
|
71
|
-
|
|
50
|
+
const ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(
|
|
51
|
+
({ className, orientation, attached, ...props }, ref) => {
|
|
72
52
|
return (
|
|
73
|
-
<
|
|
74
|
-
ref={ref
|
|
53
|
+
<div
|
|
54
|
+
ref={ref}
|
|
75
55
|
role="group"
|
|
76
|
-
className={cn(buttonGroupVariants({ orientation, attached, className
|
|
56
|
+
className={cn(buttonGroupVariants({ orientation, attached }), className)}
|
|
77
57
|
{...props}
|
|
78
58
|
/>
|
|
79
59
|
)
|
package/registry/button.tsx
CHANGED
|
@@ -32,68 +32,42 @@ const buttonVariants = cva(
|
|
|
32
32
|
}
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
children?: React.ReactNode
|
|
35
|
+
interface ButtonProps
|
|
36
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
37
|
+
VariantProps<typeof buttonVariants> {
|
|
38
|
+
asChild?: boolean
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
|
-
*
|
|
42
|
+
* Button component
|
|
44
43
|
*
|
|
45
44
|
* @example
|
|
46
|
-
* //
|
|
45
|
+
* // Default button
|
|
47
46
|
* <Button variant="outline">Click me</Button>
|
|
48
47
|
*
|
|
49
|
-
* // As a link
|
|
50
|
-
* <Button as="a" href="/home" variant="link">Go Home</Button>
|
|
51
|
-
*
|
|
52
48
|
* // With loading state
|
|
53
49
|
* <Button disabled>
|
|
54
50
|
* <LoadingSpinner /> Processing...
|
|
55
51
|
* </Button>
|
|
56
52
|
*/
|
|
57
|
-
const Button = React.forwardRef(
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
as
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}: ButtonBaseProps & { as?: T } & Omit<React.ComponentPropsWithoutRef<T>, keyof ButtonBaseProps | "as">,
|
|
66
|
-
ref: React.ForwardedRef<React.ElementRef<T>>
|
|
67
|
-
) => {
|
|
68
|
-
const Comp = as || "button"
|
|
69
|
-
|
|
70
|
-
// Ensure proper keyboard handling for non-button elements
|
|
71
|
-
const handleKeyDown = (e: React.KeyboardEvent) => {
|
|
72
|
-
if (Comp !== "button" && (e.key === "Enter" || e.key === " ")) {
|
|
73
|
-
e.preventDefault()
|
|
74
|
-
; (e.currentTarget as HTMLElement).click()
|
|
75
|
-
}
|
|
76
|
-
// Call original onKeyDown if provided
|
|
77
|
-
const originalOnKeyDown = (props as any).onKeyDown
|
|
78
|
-
if (originalOnKeyDown) {
|
|
79
|
-
originalOnKeyDown(e)
|
|
80
|
-
}
|
|
53
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
54
|
+
({ className, variant, size, asChild = false, children, ...props }, ref) => {
|
|
55
|
+
if (asChild && React.isValidElement(children)) {
|
|
56
|
+
return React.cloneElement(children as React.ReactElement<any>, {
|
|
57
|
+
ref,
|
|
58
|
+
className: cn(buttonVariants({ variant, size }), className),
|
|
59
|
+
...props,
|
|
60
|
+
})
|
|
81
61
|
}
|
|
82
62
|
|
|
83
|
-
// Add role="button" for non-button elements
|
|
84
|
-
const accessibilityProps = Comp !== "button" ? {
|
|
85
|
-
role: "button",
|
|
86
|
-
tabIndex: 0,
|
|
87
|
-
onKeyDown: handleKeyDown,
|
|
88
|
-
} : {}
|
|
89
|
-
|
|
90
63
|
return (
|
|
91
|
-
<
|
|
92
|
-
ref={ref
|
|
93
|
-
className={cn(buttonVariants({ variant, size, className
|
|
94
|
-
{...accessibilityProps}
|
|
64
|
+
<button
|
|
65
|
+
ref={ref}
|
|
66
|
+
className={cn(buttonVariants({ variant, size }), className)}
|
|
95
67
|
{...props}
|
|
96
|
-
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
</button>
|
|
97
71
|
)
|
|
98
72
|
}
|
|
99
73
|
)
|