@zango-core/components 0.2.0-rc.3 → 0.2.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.
- package/LICENSE +21 -0
- package/NOTICE +29 -0
- package/README.md +56 -376
- package/dist/components/Accordion/Accordion.d.ts +3 -1
- package/dist/components/Accordion/index.d.ts +1 -1
- package/dist/components/Alert/Alert.d.ts +14 -0
- package/dist/components/Alert/index.d.ts +1 -1
- package/dist/components/Avatar/Avatar.d.ts +13 -0
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/Badge/Badge.d.ts +8 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +24 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Card/Card.d.ts +34 -0
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +6 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +33 -1
- package/dist/components/ContextMenu/index.d.ts +1 -1
- package/dist/components/Dialog/index.d.ts +1 -1
- package/dist/components/Divider/Divider.d.ts +12 -0
- package/dist/components/Divider/index.d.ts +1 -1
- package/dist/components/Drawer/Drawer.d.ts +2 -0
- package/dist/components/Drawer/index.d.ts +1 -1
- package/dist/components/Empty/Empty.d.ts +9 -0
- package/dist/components/Empty/index.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +34 -0
- package/dist/components/Form/index.d.ts +1 -1
- package/dist/components/FormWidgets/index.d.ts +4 -4
- package/dist/components/InfoSection/InfoSection.d.ts +35 -0
- package/dist/components/InfoSection/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +12 -1
- package/dist/components/Layout/Layout.d.ts +36 -0
- package/dist/components/Layout/index.d.ts +1 -1
- package/dist/components/Loader/Loader.d.ts +0 -1
- package/dist/components/Loader/index.d.ts +1 -0
- package/dist/components/MobileInput/MobileInput.d.ts +9 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +6 -1
- package/dist/components/PhoneNumberInput/PhoneNumberInput.d.ts +45 -0
- package/dist/components/PhoneNumberInput/PhoneNumberInput.example.d.ts +7 -5
- package/dist/components/PhoneNumberInput/index.d.ts +1 -1
- package/dist/components/Progress/Progress.d.ts +18 -0
- package/dist/components/Progress/index.d.ts +1 -1
- package/dist/components/Result/Result.d.ts +11 -0
- package/dist/components/Result/index.d.ts +1 -1
- package/dist/components/Segmented/Segmented.d.ts +16 -0
- package/dist/components/Segmented/index.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +30 -2
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Space/Space.d.ts +11 -0
- package/dist/components/Space/index.d.ts +1 -1
- package/dist/components/Spin/Spin.d.ts +10 -0
- package/dist/components/Spin/index.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +18 -0
- package/dist/components/Tabs/index.d.ts +1 -1
- package/dist/components/Tag/Tag.d.ts +11 -0
- package/dist/components/Tag/index.d.ts +1 -1
- package/dist/components/Textarea/Textarea.d.ts +7 -0
- package/dist/components/Timeline/Timeline.d.ts +31 -6
- package/dist/components/Timeline/index.d.ts +1 -1
- package/dist/components/Toast/Toast.d.ts +29 -0
- package/dist/components/Toast/index.d.ts +1 -1
- package/dist/components/Typography/Typography.d.ts +26 -1
- package/dist/components/Typography/index.d.ts +1 -1
- package/dist/demo/App.d.ts +1 -1
- package/dist/index.d.ts +45 -46
- package/dist/test/axe.d.ts +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/utils/cn.d.ts +6 -0
- package/dist/utils/gradient.d.ts +30 -0
- package/dist/zango-components.js +5894 -4281
- package/dist/zango-components.js.map +1 -1
- package/dist/zango-components.umd.cjs +36 -97
- package/dist/zango-components.umd.cjs.map +1 -1
- package/package.json +70 -28
- package/dist/components/Message/Message.d.ts +0 -35
- package/dist/components/Message/index.d.ts +0 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Healthlane Technologies Pvt. Ltd. ("Zango")
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@zango-core/components
|
|
2
|
+
Copyright 2024 Healthlane Technologies Pvt. Ltd.
|
|
3
|
+
|
|
4
|
+
This product is licensed under the MIT License. A copy of the License is
|
|
5
|
+
provided in the LICENSE file at the root of this project.
|
|
6
|
+
|
|
7
|
+
This library is part of the Zango framework
|
|
8
|
+
(https://github.com/Healthlane-Technologies/Zango), whose licensing terms
|
|
9
|
+
provide that all client-side JavaScript is licensed under the MIT License.
|
|
10
|
+
|
|
11
|
+
--------------------------------------------------------------------------------
|
|
12
|
+
Third-party components
|
|
13
|
+
--------------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
This product depends on the following third-party open-source software. Each is
|
|
16
|
+
distributed under its own license; the copyright and license notices below are
|
|
17
|
+
reproduced in accordance with those licenses.
|
|
18
|
+
|
|
19
|
+
- @radix-ui/react-dialog (MIT License)
|
|
20
|
+
Copyright (c) WorkOS
|
|
21
|
+
https://github.com/radix-ui/primitives
|
|
22
|
+
|
|
23
|
+
- lucide-react (ISC License)
|
|
24
|
+
Copyright (c) Lucide Contributors
|
|
25
|
+
https://github.com/lucide-icons/lucide
|
|
26
|
+
|
|
27
|
+
- sonner (MIT License)
|
|
28
|
+
Copyright (c) Emil Kowalski
|
|
29
|
+
https://github.com/emilkowalski/sonner
|
package/README.md
CHANGED
|
@@ -1,426 +1,106 @@
|
|
|
1
1
|
# Zango Components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@zango-core/components)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
[](https://www.npmjs.com/package/@zango-core/components)
|
|
6
|
+
[](https://github.com/Healthlane-Technologies/zango-react-components/actions/workflows/ci.yml)
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
A React component library built with Tailwind CSS. 30+ accessible components,
|
|
9
|
+
fully typed, themeable through CSS variables.
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
- **Color Inheritance**: CSS variables allow parent applications to override colors
|
|
9
|
-
- **TypeScript Support**: Full type definitions for all components
|
|
10
|
-
- **Responsive Design**: Components adapt to different screen sizes
|
|
11
|
-
- **Accessibility**: Proper ARIA attributes and keyboard navigation
|
|
12
|
-
- **Storybook Documentation**: Interactive component documentation
|
|
13
|
-
|
|
14
|
-
## 📦 Installation
|
|
11
|
+
## Installation
|
|
15
12
|
|
|
16
13
|
```bash
|
|
17
|
-
npm install @zango/components
|
|
14
|
+
npm install @zango-core/components
|
|
18
15
|
```
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### Peer Dependencies
|
|
24
|
-
|
|
25
|
-
Make sure you have the following peer dependencies installed:
|
|
17
|
+
Peer dependencies — React 16.8 or newer, if your project does not already
|
|
18
|
+
have it:
|
|
26
19
|
|
|
27
20
|
```bash
|
|
28
|
-
npm install react react-dom
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Optional: Tailwind CSS Integration
|
|
32
|
-
|
|
33
|
-
If your project uses Tailwind CSS, you can optionally add the library to your content scanning for better integration:
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
// tailwind.config.js
|
|
37
|
-
module.exports = {
|
|
38
|
-
content: [
|
|
39
|
-
"./src/**/*.{js,jsx,ts,tsx}",
|
|
40
|
-
"./node_modules/@zango/components/dist/**/*.{js,jsx,ts,tsx}", // Optional: for better integration
|
|
41
|
-
],
|
|
42
|
-
theme: {
|
|
43
|
-
extend: {
|
|
44
|
-
// You can extend or override colors here
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
plugins: [],
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
**Note**: This step is optional. The library works perfectly without any Tailwind configuration in your project.
|
|
52
|
-
|
|
53
|
-
## 🎯 Usage
|
|
54
|
-
|
|
55
|
-
### Basic Usage
|
|
56
|
-
|
|
57
|
-
```tsx
|
|
58
|
-
import { Button, Badge, Accordion } from '@zango/components';
|
|
59
|
-
// CSS is automatically included - no separate import needed!
|
|
60
|
-
|
|
61
|
-
function App() {
|
|
62
|
-
return (
|
|
63
|
-
<div className="p-4">
|
|
64
|
-
<Button variant="primary" size="medium">
|
|
65
|
-
Click me
|
|
66
|
-
</Button>
|
|
67
|
-
|
|
68
|
-
<Badge variant="success">Active</Badge>
|
|
69
|
-
|
|
70
|
-
<Accordion
|
|
71
|
-
items={[
|
|
72
|
-
{
|
|
73
|
-
key: "item1",
|
|
74
|
-
title: "Accordion Item",
|
|
75
|
-
content: "This is the content"
|
|
76
|
-
}
|
|
77
|
-
]}
|
|
78
|
-
/>
|
|
79
|
-
</div>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### With Custom Colors
|
|
85
|
-
|
|
86
|
-
```css
|
|
87
|
-
/* Override colors in your CSS */
|
|
88
|
-
:root {
|
|
89
|
-
--color-Brand-500: #3b82f6;
|
|
90
|
-
--color-Brand-600: #2563eb;
|
|
91
|
-
--color-Brand-700: #1d4ed8;
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
```tsx
|
|
96
|
-
// Components will automatically use your custom colors
|
|
97
|
-
<Button variant="primary">Custom Colored Button</Button>
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## 🧩 Available Components
|
|
101
|
-
|
|
102
|
-
### Button
|
|
103
|
-
|
|
104
|
-
A versatile button component with multiple variants and sizes.
|
|
105
|
-
|
|
106
|
-
```tsx
|
|
107
|
-
<Button
|
|
108
|
-
variant="primary"
|
|
109
|
-
size="medium"
|
|
110
|
-
fullWidth={false}
|
|
111
|
-
disabled={false}
|
|
112
|
-
>
|
|
113
|
-
Button Text
|
|
114
|
-
</Button>
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
**Props:**
|
|
118
|
-
- `variant`: `'primary' | 'secondary' | 'ghost' | 'outline' | 'destructive' | 'danger' | 'success'`
|
|
119
|
-
- `size`: `'small' | 'medium' | 'large' | 'sm' | 'md' | 'lg'`
|
|
120
|
-
- `fullWidth`: `boolean`
|
|
121
|
-
- All standard HTML button attributes
|
|
122
|
-
|
|
123
|
-
### Badge
|
|
124
|
-
|
|
125
|
-
Status indicators with multiple variants.
|
|
126
|
-
|
|
127
|
-
```tsx
|
|
128
|
-
<Badge variant="success">Success</Badge>
|
|
129
|
-
<Badge variant="warning">Warning</Badge>
|
|
130
|
-
<Badge variant="danger">Error</Badge>
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**Props:**
|
|
134
|
-
- `variant`: `'success' | 'low' | 'warning' | 'medium' | 'danger' | 'high' | 'critical' | 'neutral' | 'default' | 'outline'`
|
|
135
|
-
|
|
136
|
-
### Accordion
|
|
137
|
-
|
|
138
|
-
Expandable content sections with smooth animations.
|
|
139
|
-
|
|
140
|
-
```tsx
|
|
141
|
-
<Accordion
|
|
142
|
-
items={[
|
|
143
|
-
{
|
|
144
|
-
key: "item1",
|
|
145
|
-
title: "First Item",
|
|
146
|
-
content: <p>Content goes here</p>,
|
|
147
|
-
icon: <IconComponent />,
|
|
148
|
-
subtitle: "Optional subtitle"
|
|
149
|
-
}
|
|
150
|
-
]}
|
|
151
|
-
multiple={true}
|
|
152
|
-
collapsible={true}
|
|
153
|
-
/>
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### Context Menu
|
|
157
|
-
|
|
158
|
-
Dropdown menus with customizable items.
|
|
159
|
-
|
|
160
|
-
```tsx
|
|
161
|
-
<ContextMenu
|
|
162
|
-
trigger={<Button>Open Menu</Button>}
|
|
163
|
-
align="right"
|
|
164
|
-
>
|
|
165
|
-
<ContextMenuItem onClick={() => console.log('clicked')}>
|
|
166
|
-
Menu Item
|
|
167
|
-
</ContextMenuItem>
|
|
168
|
-
<ContextMenuSeparator />
|
|
169
|
-
<ContextMenuItem danger>Delete</ContextMenuItem>
|
|
170
|
-
</ContextMenu>
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Info Section
|
|
174
|
-
|
|
175
|
-
Flexible information display with multiple layouts.
|
|
176
|
-
|
|
177
|
-
```tsx
|
|
178
|
-
<InfoSection
|
|
179
|
-
title="Section Title"
|
|
180
|
-
subtitle="Subtitle"
|
|
181
|
-
description="Description text"
|
|
182
|
-
variant="card"
|
|
183
|
-
size="medium"
|
|
184
|
-
icon={<IconComponent />}
|
|
185
|
-
badge={<Badge variant="success">New</Badge>}
|
|
186
|
-
actions={<Button size="small">Edit</Button>}
|
|
187
|
-
>
|
|
188
|
-
<InfoGrid columns={2}>
|
|
189
|
-
<InfoItem label="Label" value="Value" />
|
|
190
|
-
<InfoItem label="Status" value="Active" />
|
|
191
|
-
</InfoGrid>
|
|
192
|
-
</InfoSection>
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
### Timeline
|
|
196
|
-
|
|
197
|
-
Event timeline with date grouping.
|
|
198
|
-
|
|
199
|
-
```tsx
|
|
200
|
-
<Timeline
|
|
201
|
-
sections={[
|
|
202
|
-
{
|
|
203
|
-
date: "Today",
|
|
204
|
-
events: [
|
|
205
|
-
{
|
|
206
|
-
id: "1",
|
|
207
|
-
type: "status_change",
|
|
208
|
-
title: "Status Updated",
|
|
209
|
-
description: "Changed to active",
|
|
210
|
-
timestamp: "2:30 PM",
|
|
211
|
-
date: "Dec 15",
|
|
212
|
-
icon: "activity"
|
|
213
|
-
}
|
|
214
|
-
]
|
|
215
|
-
}
|
|
216
|
-
]}
|
|
217
|
-
/>
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### Drawer
|
|
221
|
-
|
|
222
|
-
Sliding panel overlay for displaying additional content.
|
|
223
|
-
|
|
224
|
-
```tsx
|
|
225
|
-
<Drawer
|
|
226
|
-
open={open}
|
|
227
|
-
onClose={() => setOpen(false)}
|
|
228
|
-
title="Drawer Title"
|
|
229
|
-
size="md"
|
|
230
|
-
position="right"
|
|
231
|
-
>
|
|
232
|
-
<p>Drawer content</p>
|
|
233
|
-
</Drawer>
|
|
21
|
+
npm install react react-dom
|
|
234
22
|
```
|
|
235
23
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
- `size`: `'sm' | 'md' | 'lg' | 'xl' | 'full'`
|
|
240
|
-
- `position`: `'right' | 'left' | 'top' | 'bottom'`
|
|
241
|
-
- `title`: `string`
|
|
242
|
-
- `showBackButton`: `boolean`
|
|
243
|
-
- `onBack`: `() => void`
|
|
24
|
+
Everything else the library needs (`@radix-ui/react-dialog`, `lucide-react`,
|
|
25
|
+
`sonner`, `tailwind-merge`) ships as a regular dependency and installs
|
|
26
|
+
automatically.
|
|
244
27
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
### Toast
|
|
248
|
-
|
|
249
|
-
Beautiful toast notifications powered by Sonner with customizable variants, positions, and actions.
|
|
28
|
+
## Usage
|
|
250
29
|
|
|
251
30
|
```tsx
|
|
252
|
-
import {
|
|
31
|
+
import { Button, Badge } from '@zango-core/components';
|
|
32
|
+
// CSS is bundled and injected automatically — no separate import needed.
|
|
253
33
|
|
|
254
|
-
// Add Toaster to your app root
|
|
255
34
|
function App() {
|
|
256
35
|
return (
|
|
257
36
|
<>
|
|
258
|
-
<
|
|
259
|
-
<
|
|
37
|
+
<Button variant="primary">Click me</Button>
|
|
38
|
+
<Badge variant="success">Active</Badge>
|
|
260
39
|
</>
|
|
261
40
|
);
|
|
262
41
|
}
|
|
263
|
-
|
|
264
|
-
// Use toast in your components
|
|
265
|
-
function MyComponent() {
|
|
266
|
-
const { success, error, warning, info } = useToast();
|
|
267
|
-
|
|
268
|
-
return (
|
|
269
|
-
<Button onClick={() => success('Operation successful!')}>
|
|
270
|
-
Show Toast
|
|
271
|
-
</Button>
|
|
272
|
-
);
|
|
273
|
-
}
|
|
274
42
|
```
|
|
275
43
|
|
|
276
|
-
|
|
277
|
-
```tsx
|
|
278
|
-
toast.success({
|
|
279
|
-
title: 'Success toast message',
|
|
280
|
-
description: 'Optional description text',
|
|
281
|
-
duration: 5000,
|
|
282
|
-
icon: <CustomIcon />,
|
|
283
|
-
primaryAction: {
|
|
284
|
-
label: 'Undo',
|
|
285
|
-
onClick: () => console.log('Undo clicked')
|
|
286
|
-
},
|
|
287
|
-
secondaryAction: {
|
|
288
|
-
label: 'Dismiss',
|
|
289
|
-
onClick: () => console.log('Dismissed')
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
**Props:**
|
|
295
|
-
- `position`: `'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'`
|
|
296
|
-
- `duration`: `number` (milliseconds)
|
|
297
|
-
- `variant`: `'success' | 'error' | 'warning' | 'info' | 'default'`
|
|
298
|
-
- Custom icons and actions supported
|
|
44
|
+
## Theming
|
|
299
45
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
The component library uses CSS variables that can be overridden in your application:
|
|
46
|
+
Override CSS variables to re-theme the library. Unset variables fall back to
|
|
47
|
+
their defaults, so declare only what you want to change.
|
|
303
48
|
|
|
304
49
|
```css
|
|
305
50
|
:root {
|
|
306
|
-
|
|
307
|
-
--
|
|
308
|
-
--
|
|
309
|
-
--color-
|
|
310
|
-
|
|
311
|
-
/* Gray colors */
|
|
312
|
-
--color-Gray-100: #your-gray-light;
|
|
313
|
-
--color-Gray-500: #your-gray-medium;
|
|
314
|
-
--color-Gray-900: #your-gray-dark;
|
|
315
|
-
|
|
316
|
-
/* Status colors */
|
|
317
|
-
--color-success-500: #your-success-color;
|
|
318
|
-
--color-error-500: #your-error-color;
|
|
319
|
-
--color-warning-500: #your-warning-color;
|
|
320
|
-
|
|
321
|
-
/* Base colors */
|
|
322
|
-
--color-Base-white: #ffffff;
|
|
323
|
-
--color-Base-black: #000000;
|
|
51
|
+
--color-brand-500: #3b82f6;
|
|
52
|
+
--zango-border-radius-md: 8px;
|
|
53
|
+
--zango-control-height-md: 36px;
|
|
54
|
+
--zango-border-color-default: #d4d6d9;
|
|
324
55
|
}
|
|
325
56
|
```
|
|
326
57
|
|
|
327
|
-
##
|
|
328
|
-
|
|
329
|
-
### Prerequisites
|
|
58
|
+
## Documentation
|
|
330
59
|
|
|
331
|
-
-
|
|
332
|
-
-
|
|
60
|
+
- [Components](./docs/COMPONENTS.md) — usage examples for every component
|
|
61
|
+
- [CSS variables](./docs/CSS_VARIABLES.md) — full theming reference
|
|
62
|
+
- [Development setup](./docs/DEV_SETUP.md)
|
|
333
63
|
|
|
334
|
-
|
|
64
|
+
Run Storybook for interactive demos and the complete prop reference:
|
|
335
65
|
|
|
336
66
|
```bash
|
|
337
|
-
# Clone the repository
|
|
338
|
-
git clone https://github.com/yourusername/zango-react-components.git
|
|
339
|
-
cd zango-react-components
|
|
340
|
-
|
|
341
|
-
# Install dependencies
|
|
342
|
-
npm install
|
|
343
|
-
|
|
344
|
-
# Start development server
|
|
345
|
-
npm run dev
|
|
346
|
-
|
|
347
|
-
# Run Storybook for component development
|
|
348
67
|
npm run storybook
|
|
349
|
-
|
|
350
|
-
# Build the library
|
|
351
|
-
npm run build
|
|
352
|
-
|
|
353
|
-
# Type check
|
|
354
|
-
npm run type-check
|
|
355
|
-
|
|
356
|
-
# Lint code
|
|
357
|
-
npm run lint
|
|
358
68
|
```
|
|
359
69
|
|
|
360
|
-
|
|
70
|
+
## Development
|
|
361
71
|
|
|
362
|
-
|
|
363
|
-
src/
|
|
364
|
-
├── components/ # Component source files
|
|
365
|
-
│ ├── Button/
|
|
366
|
-
│ ├── Badge/
|
|
367
|
-
│ ├── Accordion/
|
|
368
|
-
│ ├── ContextMenu/
|
|
369
|
-
│ ├── InfoSection/
|
|
370
|
-
│ ├── Timeline/
|
|
371
|
-
│ └── Drawer/
|
|
372
|
-
├── styles/
|
|
373
|
-
│ ├── index.css # Main Tailwind CSS file
|
|
374
|
-
│ └── variables.css # CSS variables
|
|
375
|
-
├── utils/
|
|
376
|
-
│ └── cn.ts # Class name utility
|
|
377
|
-
└── index.ts # Main export file
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
### Available Scripts
|
|
381
|
-
|
|
382
|
-
- `npm run dev` - Start development server
|
|
383
|
-
- `npm run build` - Build the library for production
|
|
384
|
-
- `npm run storybook` - Start Storybook development server
|
|
385
|
-
- `npm run build-storybook` - Build Storybook for production
|
|
386
|
-
- `npm run type-check` - Run TypeScript type checking
|
|
387
|
-
- `npm run lint` - Run ESLint
|
|
388
|
-
|
|
389
|
-
### Building for Production
|
|
72
|
+
Requires Node.js 22+ and npm.
|
|
390
73
|
|
|
391
74
|
```bash
|
|
392
|
-
|
|
75
|
+
git clone https://github.com/Healthlane-Technologies/zango-react-components.git
|
|
76
|
+
cd zango-react-components
|
|
77
|
+
npm install
|
|
78
|
+
npm run dev
|
|
393
79
|
```
|
|
394
80
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
## 🤝 Contributing
|
|
405
|
-
|
|
406
|
-
1. Fork the repository
|
|
407
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
408
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
409
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
410
|
-
5. Open a Pull Request
|
|
81
|
+
| Script | Description |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `npm run dev` | Start the development server |
|
|
84
|
+
| `npm run storybook` | Start Storybook |
|
|
85
|
+
| `npm run build` | Build the library |
|
|
86
|
+
| `npm run test` | Run the test suite |
|
|
87
|
+
| `npm run type-check` | Type-check without emitting |
|
|
88
|
+
| `npm run check` | Lint, format, and organize imports |
|
|
411
89
|
|
|
412
|
-
##
|
|
90
|
+
## Browser support
|
|
413
91
|
|
|
414
|
-
|
|
92
|
+
All modern evergreen browsers (last 2 versions of Chrome, Firefox, Safari, and
|
|
93
|
+
Edge). The library ships ES2020 output. Internet Explorer is not supported.
|
|
415
94
|
|
|
416
|
-
##
|
|
95
|
+
## Contributing
|
|
417
96
|
|
|
418
|
-
|
|
97
|
+
Contributions are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) to get
|
|
98
|
+
started, and please follow our [Code of Conduct](./CODE_OF_CONDUCT.md).
|
|
419
99
|
|
|
420
|
-
|
|
421
|
-
2. Search [existing issues](https://github.com/yourusername/zango-react-components/issues)
|
|
422
|
-
3. Create a [new issue](https://github.com/yourusername/zango-react-components/issues/new) if needed
|
|
100
|
+
## License
|
|
423
101
|
|
|
424
|
-
|
|
102
|
+
MIT — see [LICENSE](./LICENSE).
|
|
425
103
|
|
|
426
|
-
|
|
104
|
+
This library is part of the [Zango framework](https://github.com/Healthlane-Technologies/Zango),
|
|
105
|
+
whose licensing terms provide that all client-side JavaScript is licensed under
|
|
106
|
+
the MIT License.
|
|
@@ -24,6 +24,8 @@ interface AccordionProps {
|
|
|
24
24
|
}
|
|
25
25
|
export declare const Accordion: React.FC<AccordionProps>;
|
|
26
26
|
interface AccordionItemProps {
|
|
27
|
+
/** Unique key for this item. Required so items don't collide in the list. */
|
|
28
|
+
key: string;
|
|
27
29
|
title: React.ReactNode;
|
|
28
30
|
children?: React.ReactNode;
|
|
29
31
|
icon?: React.ReactNode;
|
|
@@ -32,5 +34,5 @@ interface AccordionItemProps {
|
|
|
32
34
|
actions?: React.ReactNode;
|
|
33
35
|
hasFilter?: boolean;
|
|
34
36
|
}
|
|
35
|
-
export declare const AccordionItem: ({ title, children, icon, subtitle, badge, actions, hasFilter }: AccordionItemProps) => AccordionItemData;
|
|
37
|
+
export declare const AccordionItem: ({ key, title, children, icon, subtitle, badge, actions, hasFilter, }: AccordionItemProps) => AccordionItemData;
|
|
36
38
|
export {};
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
3
|
export interface AlertProps {
|
|
4
|
+
/** Severity type that controls color and icon */
|
|
4
5
|
type?: 'success' | 'info' | 'warning' | 'error';
|
|
6
|
+
/** Primary message content displayed in the alert */
|
|
5
7
|
message: React.ReactNode;
|
|
8
|
+
/** Optional secondary description rendered below the message */
|
|
6
9
|
description?: React.ReactNode;
|
|
10
|
+
/** Whether to render the built-in type icon */
|
|
7
11
|
showIcon?: boolean;
|
|
12
|
+
/** Whether to show a close button */
|
|
8
13
|
closable?: boolean;
|
|
14
|
+
/** Custom content for the close trigger; defaults to × */
|
|
9
15
|
closeText?: React.ReactNode;
|
|
16
|
+
/** Callback fired when the close button is clicked */
|
|
10
17
|
onClose?: () => void;
|
|
18
|
+
/** Optional action element rendered on the right side */
|
|
11
19
|
action?: React.ReactNode;
|
|
20
|
+
/** Additional className for the root element */
|
|
12
21
|
className?: string;
|
|
22
|
+
/** Inline styles for the root element */
|
|
13
23
|
style?: React.CSSProperties;
|
|
14
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Alert displays a contextual feedback message with optional icon, description, action, and close button.
|
|
27
|
+
* Supports four severity types — success, info, warning, and error — each with distinct color styling.
|
|
28
|
+
*/
|
|
15
29
|
export declare const Alert: React.FC<AlertProps>;
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
3
|
export interface AvatarProps {
|
|
4
|
+
/** Preset size or explicit pixel dimension */
|
|
4
5
|
size?: 'small' | 'default' | 'large' | number;
|
|
6
|
+
/** Icon node rendered when no image src is provided */
|
|
5
7
|
icon?: React.ReactNode;
|
|
8
|
+
/** URL of the avatar image */
|
|
6
9
|
src?: string;
|
|
10
|
+
/** Alt text for the avatar image */
|
|
7
11
|
alt?: string;
|
|
12
|
+
/** Fallback content (e.g. initials) shown when no src or icon is set */
|
|
8
13
|
children?: React.ReactNode;
|
|
14
|
+
/** Whether the avatar is circular or square */
|
|
9
15
|
shape?: 'circle' | 'square';
|
|
16
|
+
/** Additional className for the root element */
|
|
10
17
|
className?: string;
|
|
18
|
+
/** Inline styles for the root element */
|
|
11
19
|
style?: React.CSSProperties;
|
|
20
|
+
/** Click handler; when provided the avatar receives button semantics */
|
|
12
21
|
onClick?: () => void;
|
|
13
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Avatar renders a user representation using an image, icon, or initials fallback.
|
|
25
|
+
* Supports circle and square shapes, preset or numeric sizes, and optional click interaction with button semantics.
|
|
26
|
+
*/
|
|
14
27
|
export declare const Avatar: React.FC<AvatarProps>;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
|
-
export type BadgeVariant =
|
|
3
|
+
export type BadgeVariant = 'success' | 'low' | 'warning' | 'medium' | 'danger' | 'high' | 'critical' | 'neutral' | 'default' | 'outline';
|
|
4
4
|
export interface BadgeProps {
|
|
5
|
+
/** Label content rendered inside the badge */
|
|
5
6
|
children: React.ReactNode;
|
|
7
|
+
/** Visual style variant controlling color and border */
|
|
6
8
|
variant?: BadgeVariant;
|
|
9
|
+
/** Additional className for the badge element */
|
|
7
10
|
className?: string;
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Badge renders a small inline label used to convey status, priority, or category.
|
|
14
|
+
* Color and border are controlled by the variant prop.
|
|
15
|
+
*/
|
|
9
16
|
export declare const Badge: React.FC<BadgeProps>;
|
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { GradientDirection, GradientType } from '../../utils/gradient';
|
|
2
3
|
|
|
3
4
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
-
|
|
5
|
+
/** Visual style variant */
|
|
6
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'outline' | 'destructive' | 'danger' | 'success' | 'gradient' | 'link';
|
|
7
|
+
/**
|
|
8
|
+
* Preset gradient stops; only applies when variant is "gradient".
|
|
9
|
+
* 'soft' = brand-50→white, 'solid' = brand-500→brand-700 (default).
|
|
10
|
+
*/
|
|
11
|
+
gradientType?: GradientType;
|
|
12
|
+
/** Custom gradient start color (any CSS color). Requires gradientTo; overrides gradientType. */
|
|
13
|
+
gradientFrom?: string;
|
|
14
|
+
/** Custom gradient end color (any CSS color). Requires gradientFrom; overrides gradientType. */
|
|
15
|
+
gradientTo?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Gradient direction; only applies when variant is "gradient".
|
|
18
|
+
* Maps to Tailwind `bg-gradient-to-*` utilities.
|
|
19
|
+
*/
|
|
20
|
+
gradientDirection?: GradientDirection;
|
|
21
|
+
/** Button size; sm/md/lg are aliases for small/medium/large */
|
|
5
22
|
size?: 'small' | 'medium' | 'large' | 'sm' | 'md' | 'lg';
|
|
23
|
+
/** Whether the button stretches to fill its container width */
|
|
6
24
|
fullWidth?: boolean;
|
|
25
|
+
/** Button label or child elements */
|
|
7
26
|
children: React.ReactNode;
|
|
8
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Button renders a clickable action element with variant, size, and full-width options.
|
|
30
|
+
* Forwards refs and extends native button attributes.
|
|
31
|
+
*/
|
|
9
32
|
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|