@mhome/ui 0.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/README.md +188 -0
- package/dist/index.cjs.js +9 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.css +2 -0
- package/dist/index.esm.js +9 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +54 -0
- package/src/common/adaptive-theme-provider.js +19 -0
- package/src/components/accordion.jsx +306 -0
- package/src/components/alert.jsx +137 -0
- package/src/components/app-bar.jsx +105 -0
- package/src/components/autocomplete.jsx +347 -0
- package/src/components/avatar.jsx +160 -0
- package/src/components/box.jsx +165 -0
- package/src/components/button.jsx +104 -0
- package/src/components/card.jsx +156 -0
- package/src/components/checkbox.jsx +63 -0
- package/src/components/chip.jsx +137 -0
- package/src/components/collapse.jsx +188 -0
- package/src/components/container.jsx +67 -0
- package/src/components/date-picker.jsx +528 -0
- package/src/components/dialog-content-text.jsx +27 -0
- package/src/components/dialog.jsx +584 -0
- package/src/components/divider.jsx +192 -0
- package/src/components/drawer.jsx +255 -0
- package/src/components/form-control-label.jsx +89 -0
- package/src/components/form-group.jsx +32 -0
- package/src/components/form-label.jsx +54 -0
- package/src/components/grid.jsx +135 -0
- package/src/components/icon-button.jsx +101 -0
- package/src/components/index.js +78 -0
- package/src/components/input-adornment.jsx +43 -0
- package/src/components/input-label.jsx +55 -0
- package/src/components/list.jsx +239 -0
- package/src/components/menu.jsx +370 -0
- package/src/components/paper.jsx +173 -0
- package/src/components/radio-group.jsx +76 -0
- package/src/components/radio.jsx +108 -0
- package/src/components/select.jsx +308 -0
- package/src/components/slider.jsx +382 -0
- package/src/components/stack.jsx +110 -0
- package/src/components/table.jsx +243 -0
- package/src/components/tabs.jsx +363 -0
- package/src/components/text-field.jsx +289 -0
- package/src/components/toggle-button.jsx +209 -0
- package/src/components/toolbar.jsx +48 -0
- package/src/components/tooltip.jsx +127 -0
- package/src/components/typography.jsx +77 -0
- package/src/global-state.js +29 -0
- package/src/index.css +110 -0
- package/src/index.js +6 -0
- package/src/lib/useMediaQuery.js +37 -0
- package/src/lib/utils.js +113 -0
package/README.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# @mhome/ui
|
|
2
|
+
|
|
3
|
+
A comprehensive React UI component library built with Tailwind CSS, providing a set of reusable and customizable components for building modern web applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Option 1: Install from Git Repository (Recommended for Development)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install github:your-username/pallas-cat-examples#packages/ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or add to your `package.json`:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@mhome/ui": "github:your-username/pallas-cat-examples#packages/ui"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
You can also specify a specific branch or tag:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install github:your-username/pallas-cat-examples#main:packages/ui
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Option 2: Install from NPM (When Published)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @mhome/ui
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
### 1. Import CSS
|
|
38
|
+
|
|
39
|
+
Import the component styles in your main entry file (e.g., `index.js` or `App.jsx`):
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
import '@mhome/ui/dist/index.css';
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Import and Use Components
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
import { Button, Menu, MenuItem, MenuItemText } from '@mhome/ui';
|
|
49
|
+
|
|
50
|
+
function App() {
|
|
51
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
52
|
+
const open = Boolean(anchorEl);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div>
|
|
56
|
+
<Button onClick={(e) => setAnchorEl(e.currentTarget)}>
|
|
57
|
+
Open Menu
|
|
58
|
+
</Button>
|
|
59
|
+
<Menu
|
|
60
|
+
anchorEl={anchorEl}
|
|
61
|
+
open={open}
|
|
62
|
+
onClose={() => setAnchorEl(null)}
|
|
63
|
+
>
|
|
64
|
+
<MenuItem onClick={() => setAnchorEl(null)}>
|
|
65
|
+
<MenuItemText>Profile</MenuItemText>
|
|
66
|
+
</MenuItem>
|
|
67
|
+
<MenuItem onClick={() => setAnchorEl(null)}>
|
|
68
|
+
<MenuItemText>Settings</MenuItemText>
|
|
69
|
+
</MenuItem>
|
|
70
|
+
</Menu>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Requirements
|
|
77
|
+
|
|
78
|
+
- **React** ^18.2.0
|
|
79
|
+
- **React DOM** ^18.2.0
|
|
80
|
+
- **Tailwind CSS** - Must be configured in your project
|
|
81
|
+
|
|
82
|
+
## Available Components
|
|
83
|
+
|
|
84
|
+
### Layout Components
|
|
85
|
+
- `Box` - Container component with flexible styling
|
|
86
|
+
- `Container` - Responsive container component
|
|
87
|
+
- `Stack` - Flexbox layout component
|
|
88
|
+
- `Grid` - Grid layout system
|
|
89
|
+
- `Paper` - Surface component with elevation
|
|
90
|
+
- `Divider` - Separator component
|
|
91
|
+
|
|
92
|
+
### Navigation Components
|
|
93
|
+
- `Menu`, `MenuItem`, `MenuItemIcon`, `MenuItemText` - Menu system
|
|
94
|
+
- `Tabs`, `Tab` - Tab navigation
|
|
95
|
+
- `Drawer` - Side navigation drawer
|
|
96
|
+
- `AppBar` - Application bar
|
|
97
|
+
- `Toolbar` - Toolbar component
|
|
98
|
+
|
|
99
|
+
### Form Components
|
|
100
|
+
- `Button` - Button component with variants
|
|
101
|
+
- `IconButton` - Icon-only button
|
|
102
|
+
- `TextField` - Text input field
|
|
103
|
+
- `Select`, `FormControl`, `SelectMenuItem` - Select dropdown
|
|
104
|
+
- `Checkbox` - Checkbox input
|
|
105
|
+
- `Radio`, `RadioGroup` - Radio button group
|
|
106
|
+
- `Slider` - Range slider
|
|
107
|
+
- `DatePicker` - Date picker component
|
|
108
|
+
- `Autocomplete` - Autocomplete input
|
|
109
|
+
- `FormControlLabel` - Form control with label
|
|
110
|
+
- `FormLabel` - Form label
|
|
111
|
+
- `FormGroup` - Form control group
|
|
112
|
+
- `InputLabel` - Input label
|
|
113
|
+
- `InputAdornment` - Input adornment (icons, text)
|
|
114
|
+
|
|
115
|
+
### Data Display Components
|
|
116
|
+
- `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter`, `CardActionArea` - Card components
|
|
117
|
+
- `List`, `ListItem`, `ListItemIcon`, `ListItemText`, `ListItemButton`, `ListItemAvatar` - List components
|
|
118
|
+
- `Table`, `TableContainer`, `TableHead`, `TableBody`, `TableRow`, `TableCell` - Table components
|
|
119
|
+
- `Chip` - Chip component
|
|
120
|
+
- `Avatar` - Avatar component
|
|
121
|
+
- `Typography` - Typography component
|
|
122
|
+
- `Alert` - Alert/notification component
|
|
123
|
+
|
|
124
|
+
### Feedback Components
|
|
125
|
+
- `Dialog`, `DialogContent`, `DialogHeader`, `DialogFooter`, `DialogTitle`, `DialogDescription`, `DialogActions`, `DialogContentText` - Dialog components
|
|
126
|
+
- `Tooltip` - Tooltip component
|
|
127
|
+
- `Collapse` - Collapsible content
|
|
128
|
+
|
|
129
|
+
### Other Components
|
|
130
|
+
- `Accordion`, `AccordionSummary`, `AccordionDetails` - Accordion component
|
|
131
|
+
- `ToggleButton`, `ToggleButtonGroup` - Toggle button components
|
|
132
|
+
|
|
133
|
+
## Styling
|
|
134
|
+
|
|
135
|
+
This component library uses Tailwind CSS and CSS variables for theming. Make sure your project has Tailwind CSS configured and includes the CSS variables defined in `src/index.css`.
|
|
136
|
+
|
|
137
|
+
### Required CSS Variables
|
|
138
|
+
|
|
139
|
+
The components rely on CSS variables for theming. Ensure your project includes these variables (they are defined in `src/index.css`):
|
|
140
|
+
|
|
141
|
+
```css
|
|
142
|
+
:root {
|
|
143
|
+
--background: 0 0% 100%;
|
|
144
|
+
--foreground: 222.2 84% 4.9%;
|
|
145
|
+
--primary: 222.2 47.4% 11.2%;
|
|
146
|
+
/* ... and more */
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
### Building the Package
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
cd packages/ui
|
|
156
|
+
npm run build
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
This will generate the `dist` directory with:
|
|
160
|
+
- `index.cjs.js` - CommonJS format
|
|
161
|
+
- `index.esm.js` - ES Module format
|
|
162
|
+
- `index.css` - Compiled styles
|
|
163
|
+
|
|
164
|
+
### Project Structure
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
packages/ui/
|
|
168
|
+
├── src/
|
|
169
|
+
│ ├── components/ # Component source files
|
|
170
|
+
│ ├── lib/ # Utility functions
|
|
171
|
+
│ ├── index.js # Main entry point
|
|
172
|
+
│ └── index.css # CSS variables and Tailwind imports
|
|
173
|
+
├── dist/ # Built files (generated)
|
|
174
|
+
├── package.json
|
|
175
|
+
└── README.md
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Examples
|
|
179
|
+
|
|
180
|
+
Visit the Storybook documentation for interactive examples and component API documentation.
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
MIT
|
|
185
|
+
|
|
186
|
+
## Contributing
|
|
187
|
+
|
|
188
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|