mywhy-ui 0.1.0 → 0.2.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 +136 -28
- package/dist/index.cjs +1453 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +288 -1
- package/dist/index.d.ts +288 -1
- package/dist/index.js +1415 -4
- package/dist/index.js.map +1 -1
- package/package.json +19 -4
package/README.md
CHANGED
|
@@ -40,15 +40,45 @@ import 'mywhy-ui/globals.css'
|
|
|
40
40
|
## Usage
|
|
41
41
|
|
|
42
42
|
```tsx
|
|
43
|
-
import {
|
|
43
|
+
import {
|
|
44
|
+
Button, Input, Select, Switch, Badge,
|
|
45
|
+
Alert, Tabs, FormControl, Progress,
|
|
46
|
+
FileUploader, StatusBadge, useToast
|
|
47
|
+
} from 'mywhy-ui'
|
|
44
48
|
|
|
45
49
|
function App() {
|
|
50
|
+
const { toast } = useToast()
|
|
51
|
+
|
|
46
52
|
return (
|
|
47
|
-
<div>
|
|
48
|
-
|
|
53
|
+
<div className="space-y-4">
|
|
54
|
+
{/* Foundation */}
|
|
55
|
+
<Button variant="solid" theme="brand" onClick={() => toast('Welcome!')}>
|
|
56
|
+
Launch Robot
|
|
57
|
+
</Button>
|
|
49
58
|
<Input label="Robot Name" placeholder="Enter name" />
|
|
50
|
-
<
|
|
59
|
+
<Switch label="Enable ROS Bridge" />
|
|
60
|
+
|
|
61
|
+
{/* Alerts & Status */}
|
|
62
|
+
<Alert theme="success" title="Connected" isDismissible>
|
|
63
|
+
Robot is online and ready
|
|
64
|
+
</Alert>
|
|
51
65
|
<StatusBadge status="online" label="Base Station" />
|
|
66
|
+
|
|
67
|
+
{/* Forms */}
|
|
68
|
+
<FormControl label="Upload Configuration" required>
|
|
69
|
+
<FileUploader accept=".yaml,.yml" />
|
|
70
|
+
</FormControl>
|
|
71
|
+
|
|
72
|
+
{/* Tabs with Content */}
|
|
73
|
+
<Tabs
|
|
74
|
+
tabs={[
|
|
75
|
+
{ label: 'Settings', value: 'settings', content: <div>Settings panel</div> },
|
|
76
|
+
{ label: 'Status', value: 'status', content: <div>Status panel</div> },
|
|
77
|
+
]}
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
{/* Progress & Rating */}
|
|
81
|
+
<Progress value={65} label="Upload Progress" />
|
|
52
82
|
</div>
|
|
53
83
|
)
|
|
54
84
|
}
|
|
@@ -56,32 +86,56 @@ function App() {
|
|
|
56
86
|
|
|
57
87
|
## Components
|
|
58
88
|
|
|
59
|
-
### Foundation
|
|
60
|
-
- **Button** — Variants: `solid`, `subtle`, `outline`, `ghost`. Themes: `brand`, `gray`, `
|
|
61
|
-
- **Input** —
|
|
62
|
-
- **Select** — Dropdown with label and error state.
|
|
63
|
-
- **
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- **
|
|
68
|
-
- **
|
|
69
|
-
- **
|
|
70
|
-
- **
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
- **
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- **
|
|
77
|
-
|
|
78
|
-
###
|
|
79
|
-
- **
|
|
89
|
+
### Foundation (5)
|
|
90
|
+
- **Button** — Variants: `solid`, `subtle`, `outline`, `ghost`, `link`. Themes: `brand`, `success`, `danger`, `warning`, `gray`. Sizes: `xs`, `sm`, `md`, `lg`.
|
|
91
|
+
- **Input** — Text input with label, error state, prefix/suffix icons, and size variants.
|
|
92
|
+
- **Select** — Dropdown select with label and error state.
|
|
93
|
+
- **Switch** — Toggle switch with label, description, and error handling.
|
|
94
|
+
- **Spinner** — Loading indicator with customizable size and color.
|
|
95
|
+
|
|
96
|
+
### Core UI (7)
|
|
97
|
+
- **Badge** — Status labels with semantic color themes.
|
|
98
|
+
- **Avatar** — User avatars with initials fallback, multiple sizes and shapes.
|
|
99
|
+
- **Card** — Container component with optional title and subtitle.
|
|
100
|
+
- **Checkbox** — Labeled checkbox with description and error support.
|
|
101
|
+
- **Textarea** — Multi-line text input with sizes and error states.
|
|
102
|
+
- **Alert** — Dismissible alert messages with themes: `info`, `success`, `warning`, `danger`.
|
|
103
|
+
- **MultiSelect** — Multi-value select with search, clearable, and file-like tag display.
|
|
104
|
+
|
|
105
|
+
### Form Components (1)
|
|
106
|
+
- **FormControl** — Wrapper component for form fields with label, description, error, and helper text.
|
|
107
|
+
|
|
108
|
+
### Navigation (3)
|
|
109
|
+
- **Tabs** — Tab navigation with variants: `underline`, `soft`. Keyboard accessible.
|
|
110
|
+
- **Breadcrumbs** — Hierarchical navigation trail with separator customization.
|
|
111
|
+
- **Dropdown** — Menu dropdown with icons, disabled states, and danger styling.
|
|
112
|
+
|
|
113
|
+
### Overlays (4)
|
|
114
|
+
- **Dialog** — Modal dialog with backdrop and focus management.
|
|
115
|
+
- **Toast / ToastContainer** — Notification toasts with automatic dismiss.
|
|
116
|
+
- **Tooltip** — Hover tooltips with placement control: `top`, `bottom`, `left`, `right`.
|
|
117
|
+
- **Link** — Styled anchor with brand colors and hover effects.
|
|
118
|
+
|
|
119
|
+
### Pickers (2)
|
|
120
|
+
- **DatePicker** — Date selection with formatted display and min/max constraints.
|
|
121
|
+
- **TimePicker** — Time selection with 12h/24h format support.
|
|
122
|
+
|
|
123
|
+
### Advanced UI (4)
|
|
124
|
+
- **Progress** — Progress bar with themes, sizes, and optional labels.
|
|
125
|
+
- **Rating** — Star rating component with interactive selection and readonly mode.
|
|
126
|
+
- **Slider** — Range input with visual feedback and customizable styling.
|
|
127
|
+
- **Sidebar** — Collapsible navigation sidebar with sections, icons, and badges.
|
|
128
|
+
|
|
129
|
+
### File Handling (1)
|
|
130
|
+
- **FileUploader** — Drag-and-drop file uploader with size validation and preview.
|
|
131
|
+
|
|
132
|
+
### Robotics (2)
|
|
133
|
+
- **StatusBadge** — Robot status badge with pulse animation (`online`, `warning`, `error`, `offline`, `connecting`).
|
|
80
134
|
- **ConnectionIndicator / ConnectionIcon** — WebSocket connection status display.
|
|
81
135
|
|
|
82
|
-
### Hooks
|
|
83
|
-
- **useDisclosure** — Toggle state for modals/drawers.
|
|
84
|
-
- **useToast** — Programmatic toast
|
|
136
|
+
### Hooks (2)
|
|
137
|
+
- **useDisclosure** — Toggle state management for modals/drawers/disclosure components.
|
|
138
|
+
- **useToast** — Programmatic toast notification creation and management.
|
|
85
139
|
|
|
86
140
|
## Design Tokens
|
|
87
141
|
|
|
@@ -97,6 +151,60 @@ The Tailwind preset provides semantic color tokens:
|
|
|
97
151
|
| `role-*` | User roles (admin, operator, viewer) |
|
|
98
152
|
| `ros-*` | ROS2 accents (topic, service, action, parameter) |
|
|
99
153
|
|
|
154
|
+
## Development
|
|
155
|
+
|
|
156
|
+
### Commands
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Build the library
|
|
160
|
+
npm run build
|
|
161
|
+
|
|
162
|
+
# Watch mode during development
|
|
163
|
+
npm run dev
|
|
164
|
+
|
|
165
|
+
# Type checking
|
|
166
|
+
npm run type-check
|
|
167
|
+
|
|
168
|
+
# Storybook (component documentation)
|
|
169
|
+
npm run storybook
|
|
170
|
+
|
|
171
|
+
# Run tests
|
|
172
|
+
npm test
|
|
173
|
+
|
|
174
|
+
# Run tests with UI
|
|
175
|
+
npm run test:ui
|
|
176
|
+
|
|
177
|
+
# Coverage report
|
|
178
|
+
npm run test:coverage
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Project Structure
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
src/
|
|
185
|
+
├── components/ # All UI components
|
|
186
|
+
│ ├── Button/
|
|
187
|
+
│ ├── Input/
|
|
188
|
+
│ ├── Tabs/
|
|
189
|
+
│ └── ...
|
|
190
|
+
├── hooks/ # Custom React hooks
|
|
191
|
+
├── test/ # Test utilities and setup
|
|
192
|
+
├── globals.css # Global styles and CSS variables
|
|
193
|
+
├── index.ts # Main entry point
|
|
194
|
+
└── tailwind-preset.js # Tailwind configuration
|
|
195
|
+
|
|
196
|
+
.storybook/ # Storybook configuration
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Adding New Components
|
|
200
|
+
|
|
201
|
+
1. Create a new folder: `src/components/ComponentName/`
|
|
202
|
+
2. Add `ComponentName.tsx` with the component implementation
|
|
203
|
+
3. Add `index.ts` for exports
|
|
204
|
+
4. Add `ComponentName.stories.tsx` for Storybook documentation
|
|
205
|
+
5. Add `ComponentName.test.tsx` for unit tests
|
|
206
|
+
6. Export from `src/index.ts`
|
|
207
|
+
|
|
100
208
|
## License
|
|
101
209
|
|
|
102
210
|
MIT
|