@srcroot/ui 0.0.1

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.
Files changed (44) hide show
  1. package/README.md +151 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +640 -0
  4. package/package.json +43 -0
  5. package/registry/accordion.tsx +158 -0
  6. package/registry/alert-dialog.tsx +206 -0
  7. package/registry/alert.tsx +73 -0
  8. package/registry/aspect-ratio.tsx +44 -0
  9. package/registry/avatar.tsx +94 -0
  10. package/registry/badge.tsx +68 -0
  11. package/registry/breadcrumb.tsx +151 -0
  12. package/registry/button-group.tsx +84 -0
  13. package/registry/button.tsx +102 -0
  14. package/registry/calendar.tsx +238 -0
  15. package/registry/card.tsx +114 -0
  16. package/registry/carousel.tsx +169 -0
  17. package/registry/checkbox.tsx +79 -0
  18. package/registry/collapsible.tsx +110 -0
  19. package/registry/container.tsx +60 -0
  20. package/registry/dialog.tsx +264 -0
  21. package/registry/dropdown-menu.tsx +387 -0
  22. package/registry/image.tsx +144 -0
  23. package/registry/input.tsx +44 -0
  24. package/registry/label.tsx +34 -0
  25. package/registry/loading-spinner.tsx +108 -0
  26. package/registry/otp-input.tsx +152 -0
  27. package/registry/pagination.tsx +146 -0
  28. package/registry/popover.tsx +135 -0
  29. package/registry/progress.tsx +49 -0
  30. package/registry/radio.tsx +99 -0
  31. package/registry/search.tsx +146 -0
  32. package/registry/select.tsx +190 -0
  33. package/registry/separator.tsx +44 -0
  34. package/registry/sheet.tsx +180 -0
  35. package/registry/skeleton.tsx +26 -0
  36. package/registry/slider.tsx +115 -0
  37. package/registry/star-rating.tsx +131 -0
  38. package/registry/switch.tsx +70 -0
  39. package/registry/table.tsx +136 -0
  40. package/registry/tabs.tsx +122 -0
  41. package/registry/text.tsx +70 -0
  42. package/registry/textarea.tsx +39 -0
  43. package/registry/toast.tsx +95 -0
  44. package/registry/tooltip.tsx +122 -0
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # @srcroot/ui
2
+
3
+ A **shadcn-like** React UI library for building accessible, polymorphic web applications.
4
+ This library provides a collection of re-usable components that you can copy and paste into your apps.
5
+
6
+ ## Features
7
+
8
+ - **Polymorphic**: Most components support an `as` prop (e.g., render a `Button` as an `a` tag).
9
+ - **Accessible**: Built on standard HTML elements and WAI-ARIA patterns.
10
+ - **Copy/Paste**: Not a dependency you install, but code you own.
11
+ - **Styled**: Beautiful defaults using Tailwind CSS and `class-variance-authority`.
12
+
13
+ ## Installation
14
+
15
+ This library is distributed via a CLI that initializes your project and adds components directly to your source code.
16
+
17
+ ### 1. Initialize
18
+
19
+ Run the `init` command to set up the necessary dependencies and structural files (like `cn` utility) in your project.
20
+
21
+ ```bash
22
+ npx @srcroot/ui init
23
+ ```
24
+
25
+ This will ask a few questions to configure your project structure (e.g., where to put components).
26
+
27
+ ### 2. Add Components
28
+
29
+ Use the `add` command to install components. You can do this in three ways:
30
+
31
+ **Interactive Mode:**
32
+ Run without arguments to select components from a list.
33
+ ```bash
34
+ npx @srcroot/ui add
35
+ ```
36
+
37
+ **Specific Components:**
38
+ Add one or more components by name.
39
+ ```bash
40
+ npx @srcroot/ui add button card input
41
+ ```
42
+
43
+ **Add All:**
44
+ Install every available component at once.
45
+ ```bash
46
+ npx @srcroot/ui add --all
47
+ ```
48
+
49
+ This will copy the component files to your `components/ui` directory and install any necessary peer dependencies (like `lucide-react` or `clsx`).
50
+
51
+ ### 3. Usage
52
+
53
+ Import components directly from your project folder:
54
+
55
+ ```tsx
56
+ import { Button } from "@/components/ui/button"
57
+
58
+ export default function Home() {
59
+ return (
60
+ <Button variant="destructive" onClick={() => alert("Clicked!")}>
61
+ Click Me
62
+ </Button>
63
+ )
64
+ }
65
+ ```
66
+
67
+ ## Available Components
68
+
69
+ run `npx @srcroot/ui list` to see all available components.
70
+
71
+ ### Core
72
+ - `button` - Polymorphic button with variants.
73
+ - `badge` - Status indicators.
74
+ - `avatar` - User profile images with fallbacks.
75
+ - `separator` - Visual divider.
76
+ - `button-group` - Attached or spaced button sets.
77
+
78
+ ### Forms
79
+ - `input` - Basic text input.
80
+ - `textarea` - Multi-line text input.
81
+ - `checkbox` - Toggle selection.
82
+ - `radio` - Single selection from list.
83
+ - `switch` - Toggle switch.
84
+ - `select` - Dropdown selection.
85
+ - `slider` - Range input.
86
+ - `otp-input` - One-time password verification.
87
+ - `search` - Search input with debounce support.
88
+ - `calendar` - Date and range picker.
89
+
90
+ ### Layout
91
+ - `card` - Content container with header/content/footer.
92
+ - `container` - Centered layout wrapper.
93
+ - `aspect-ratio` - Maintain element proportions.
94
+
95
+ ### Data Display
96
+ - `text` - Polymorphic typography component.
97
+ - `label` - Accessible form label.
98
+ - `table` - Responsive data table.
99
+ - `accordion` - Collapsible content sections.
100
+ - `collapsible` - Expandable panel.
101
+ - `tabs` - Tabbed content switcher.
102
+ - `progress` - Progress bar.
103
+ - `skeleton` - Loading placeholder state.
104
+ - `image` - Enhanced img with fallback and loading state.
105
+ - `carousel` - Content slider with autoplay.
106
+
107
+ ### Feedback
108
+ - `loading-spinner` - SVG spinner with variants.
109
+ - `star-rating` - Interactive rating component.
110
+ - `toast` - Transient notifications.
111
+ - `alert` - Critical information banner.
112
+
113
+ ### Overlays
114
+ - `dialog` - Modal dialog.
115
+ - `alert-dialog` - Modal for confirming actions.
116
+ - `sheet` - Side-panel overlay.
117
+ - `popover` - Content appearing over trigger.
118
+ - `tooltip` - Hover information.
119
+ - `dropdown-menu` - Menu for actions/navigation.
120
+
121
+ ### Navigation
122
+ - `breadcrumb` - Navigation trail.
123
+ - `pagination` - Page navigation controls.
124
+
125
+ ## Polymorphism
126
+
127
+ Our components accept an `as` prop to change the underlying HTML element while maintaining styles and behavior.
128
+
129
+ ```tsx
130
+ // Renders as an <a> tag but looks like a button
131
+ <Button as="a" href="/login">
132
+ Login
133
+ </Button>
134
+
135
+ // Renders as a specialized text variant
136
+ <Text as="h1" variant="h1">
137
+ Page Title
138
+ </Text>
139
+ ```
140
+
141
+ ## Local Development
142
+
143
+ To run the documentation/playground locally:
144
+
145
+ ```bash
146
+ cd examples/playground
147
+ npm install
148
+ npm run dev
149
+ ```
150
+
151
+ Visit `http://localhost:3001` to view the component showcase.
@@ -0,0 +1,2 @@
1
+
2
+ export { }