zabi-components 1.0.4 → 1.0.6
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 +498 -93
- package/dist/{Tabs-CQvsdYPW.js → Tabs-Tv_48hdh.js} +305 -309
- package/dist/{ToastManager-6EGReI73.js → ToastManager-Q990X_Ag.js} +60 -62
- package/dist/Toggle-BidBFl7X.js +2276 -0
- package/dist/{Tooltip-B-wUMg6c.js → Tooltip-BA4NYwx_.js} +139 -144
- package/dist/atoms/index.d.ts +5 -0
- package/dist/atoms/index.js +2 -2
- package/dist/index/index.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/molecules/index.d.ts +3 -2
- package/dist/molecules/index.js +2 -2
- package/dist/organisms/index.d.ts +2 -0
- package/dist/organisms/index.js +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +1 -0
- package/dist/zabi-components.css +1 -0
- package/package.json +7 -6
- package/dist/Toggle-DuPArdKN.js +0 -2315
package/README.md
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
# Zabi Components
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A comprehensive Svelte component library built with TypeScript and Tailwind CSS, designed for easy integration across multiple Svelte projects.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- 🎨 **
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
- ♿ **
|
|
11
|
-
-
|
|
12
|
-
-
|
|
7
|
+
- 🎨 **Consistent Design System** - Standardized props, events, and styling across all components
|
|
8
|
+
- 🎯 **TypeScript First** - Full TypeScript support with comprehensive type definitions
|
|
9
|
+
- 🎨 **Tailwind CSS Integration** - Built with Tailwind CSS and CSS custom properties for easy theming
|
|
10
|
+
- ♿ **Accessibility First** - ARIA compliant components with keyboard navigation support
|
|
11
|
+
- 📱 **Responsive Design** - Mobile-first approach with responsive utilities
|
|
12
|
+
- 🎭 **Dark Mode Support** - Built-in dark mode support with CSS custom properties
|
|
13
|
+
- 🧩 **Slot Support** - Flexible slot system for custom content
|
|
14
|
+
- 📦 **Tree Shakeable** - Import only what you need
|
|
15
|
+
- ✅ **Production Ready** - Fully tested and optimized for production use
|
|
13
16
|
|
|
14
17
|
## Installation
|
|
15
18
|
|
|
@@ -17,130 +20,532 @@ A modern SvelteKit component library with TypeScript and Tailwind CSS support.
|
|
|
17
20
|
npm install zabi-components
|
|
18
21
|
```
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
### Peer Dependencies
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
Make sure you have the required peer dependencies installed:
|
|
23
26
|
|
|
24
|
-
```
|
|
25
|
-
|
|
27
|
+
```bash
|
|
28
|
+
npm install svelte@^4.0.0 || ^5.0.0
|
|
29
|
+
npm install @sveltejs/kit@^2.0.0 # Optional, for SvelteKit projects
|
|
26
30
|
```
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
## Import Methods
|
|
29
33
|
|
|
34
|
+
Zabi Components supports multiple import patterns:
|
|
35
|
+
|
|
36
|
+
### Main Import (All Components)
|
|
30
37
|
```typescript
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
import { Button, Input, Card, Alert, Badge, Modal } from 'zabi-components';
|
|
39
|
+
```
|
|
33
40
|
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
### Subpath Imports (Recommended for Tree Shaking)
|
|
42
|
+
```typescript
|
|
43
|
+
// Import from specific categories
|
|
44
|
+
import { Button, Input, Badge } from 'zabi-components/atoms';
|
|
45
|
+
import { Alert, Modal, Dropdown } from 'zabi-components/molecules';
|
|
46
|
+
import { Navbar, ToastManager } from 'zabi-components/organisms';
|
|
36
47
|
|
|
37
|
-
//
|
|
38
|
-
import {
|
|
48
|
+
// Import types separately
|
|
49
|
+
import type { ButtonEvents, InputEvents } from 'zabi-components/types';
|
|
39
50
|
```
|
|
40
51
|
|
|
41
|
-
|
|
52
|
+
## Quick Start
|
|
42
53
|
|
|
43
54
|
```svelte
|
|
44
55
|
<script lang="ts">
|
|
45
|
-
import { Button, Card,
|
|
56
|
+
import { Button, Input, Card, Alert } from 'zabi-components';
|
|
46
57
|
|
|
47
58
|
let name = '';
|
|
48
|
-
let
|
|
59
|
+
let showAlert = false;
|
|
60
|
+
|
|
61
|
+
function handleSubmit(event: CustomEvent) {
|
|
62
|
+
console.log('Form submitted!', event.detail.value);
|
|
63
|
+
showAlert = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function handleInput(event: CustomEvent) {
|
|
67
|
+
console.log('Input changed:', event.detail.value);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function handleClose() {
|
|
71
|
+
showAlert = false;
|
|
72
|
+
}
|
|
49
73
|
</script>
|
|
50
74
|
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
|
|
75
|
+
<Card>
|
|
76
|
+
<div slot="header">
|
|
77
|
+
<h2>User Form</h2>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<Input
|
|
81
|
+
bind:value={name}
|
|
82
|
+
label="Name"
|
|
83
|
+
placeholder="Enter your name"
|
|
84
|
+
on:input={handleInput}
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<Button on:click={handleSubmit}>
|
|
88
|
+
Submit
|
|
89
|
+
</Button>
|
|
90
|
+
|
|
91
|
+
<div slot="footer">
|
|
92
|
+
{#if showAlert}
|
|
93
|
+
<Alert variant="success" closable on:close={handleClose}>
|
|
94
|
+
Form submitted successfully!
|
|
95
|
+
</Alert>
|
|
96
|
+
{/if}
|
|
97
|
+
</div>
|
|
98
|
+
</Card>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Component API
|
|
102
|
+
|
|
103
|
+
### Button Component
|
|
104
|
+
|
|
105
|
+
```svelte
|
|
106
|
+
<Button
|
|
107
|
+
variant="primary" | "secondary" | "danger" | "success" | "warning" | "info"
|
|
108
|
+
size="sm" | "md" | "lg"
|
|
109
|
+
disabled={boolean}
|
|
110
|
+
loading={boolean}
|
|
111
|
+
type="button" | "submit" | "reset"
|
|
112
|
+
className={string}
|
|
113
|
+
on:click={(e) => console.log(e.detail.value, e.detail.event)}
|
|
114
|
+
>
|
|
115
|
+
Button Content
|
|
54
116
|
</Button>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Props:**
|
|
120
|
+
- `variant`: Button style variant (default: "primary")
|
|
121
|
+
- `size`: Button size (default: "md")
|
|
122
|
+
- `disabled`: Disable the button (default: false)
|
|
123
|
+
- `loading`: Show loading state (default: false)
|
|
124
|
+
- `type`: HTML button type (default: "button")
|
|
125
|
+
- `className`: Additional CSS classes
|
|
126
|
+
|
|
127
|
+
**Events:**
|
|
128
|
+
- `click`: Fired when button is clicked - `{ detail: { value: true, event: MouseEvent } }`
|
|
129
|
+
|
|
130
|
+
### Input Component
|
|
131
|
+
|
|
132
|
+
```svelte
|
|
133
|
+
<Input
|
|
134
|
+
bind:value={string}
|
|
135
|
+
type={string}
|
|
136
|
+
label={string}
|
|
137
|
+
placeholder={string}
|
|
138
|
+
required={boolean}
|
|
139
|
+
disabled={boolean}
|
|
140
|
+
size="sm" | "md" | "lg"
|
|
141
|
+
variant="default" | "error" | "success"
|
|
142
|
+
error={string}
|
|
143
|
+
success={string}
|
|
144
|
+
helpText={string}
|
|
145
|
+
className={string}
|
|
146
|
+
id={string}
|
|
147
|
+
on:input={(e) => console.log(e.detail.value, e.detail.event)}
|
|
148
|
+
on:change={(e) => console.log(e.detail.value, e.detail.event)}
|
|
149
|
+
/>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Props:**
|
|
153
|
+
- `value`: Input value (bindable)
|
|
154
|
+
- `type`: Input type (default: "text")
|
|
155
|
+
- `label`: Input label
|
|
156
|
+
- `placeholder`: Input placeholder
|
|
157
|
+
- `required`: Mark as required (default: false)
|
|
158
|
+
- `disabled`: Disable the input (default: false)
|
|
159
|
+
- `size`: Input size (default: "md")
|
|
160
|
+
- `variant`: Input variant (default: "default")
|
|
161
|
+
- `error`: Error message
|
|
162
|
+
- `success`: Success message
|
|
163
|
+
- `helpText`: Helper text
|
|
164
|
+
- `className`: Additional CSS classes
|
|
165
|
+
- `id`: Input ID
|
|
166
|
+
|
|
167
|
+
**Events:**
|
|
168
|
+
- `input`: Fired on input - `{ detail: { value: string, event: InputEvent } }`
|
|
169
|
+
- `change`: Fired on change - `{ detail: { value: string, event: Event } }`
|
|
170
|
+
|
|
171
|
+
### Card Component
|
|
172
|
+
|
|
173
|
+
```svelte
|
|
174
|
+
<Card
|
|
175
|
+
variant="default" | "elevated" | "outlined"
|
|
176
|
+
density="comfortable" | "compact"
|
|
177
|
+
disabled={boolean}
|
|
178
|
+
loading={boolean}
|
|
179
|
+
className={string}
|
|
180
|
+
on:click={(e) => console.log(e.detail.value, e.detail.event)}
|
|
181
|
+
>
|
|
182
|
+
<div slot="header">Header Content</div>
|
|
183
|
+
Main Content
|
|
184
|
+
<div slot="footer">Footer Content</div>
|
|
185
|
+
</Card>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Props:**
|
|
189
|
+
- `variant`: Card style variant (default: "default")
|
|
190
|
+
- `density`: Card density (default: "comfortable")
|
|
191
|
+
- `disabled`: Disable interactions (default: false)
|
|
192
|
+
- `loading`: Show loading state (default: false)
|
|
193
|
+
- `className`: Additional CSS classes
|
|
194
|
+
|
|
195
|
+
**Slots:**
|
|
196
|
+
- `header`: Card header content
|
|
197
|
+
- `default`: Main card content
|
|
198
|
+
- `footer`: Card footer content
|
|
199
|
+
|
|
200
|
+
**Events:**
|
|
201
|
+
- `click`: Fired when card is clicked - `{ detail: { value: true, event: MouseEvent } }`
|
|
202
|
+
|
|
203
|
+
### Alert Component
|
|
204
|
+
|
|
205
|
+
```svelte
|
|
206
|
+
<Alert
|
|
207
|
+
variant="info" | "success" | "warning" | "error"
|
|
208
|
+
title={string}
|
|
209
|
+
message={string}
|
|
210
|
+
closable={boolean}
|
|
211
|
+
className={string}
|
|
212
|
+
on:close={(e) => console.log(e.detail.value, e.detail.event)}
|
|
213
|
+
>
|
|
214
|
+
Custom Alert Content
|
|
215
|
+
</Alert>
|
|
216
|
+
```
|
|
55
217
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- `
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
218
|
+
**Props:**
|
|
219
|
+
- `variant`: Alert type (default: "info")
|
|
220
|
+
- `title`: Alert title
|
|
221
|
+
- `message`: Alert message
|
|
222
|
+
- `closable`: Show close button (default: false)
|
|
223
|
+
- `className`: Additional CSS classes
|
|
224
|
+
|
|
225
|
+
**Slots:**
|
|
226
|
+
- `default`: Custom alert content (overrides message prop)
|
|
227
|
+
|
|
228
|
+
**Events:**
|
|
229
|
+
- `close`: Fired when alert is closed - `{ detail: { value: true, event: Event } }`
|
|
230
|
+
|
|
231
|
+
## Theming
|
|
232
|
+
|
|
233
|
+
Zabi Components uses CSS custom properties for easy theming. You can customize the appearance by overriding these variables:
|
|
234
|
+
|
|
235
|
+
```css
|
|
236
|
+
:root {
|
|
237
|
+
/* Primary Colors */
|
|
238
|
+
--zabi-primary: theme('colors.blue.600');
|
|
239
|
+
--zabi-primary-hover: theme('colors.blue.700');
|
|
240
|
+
--zabi-primary-active: theme('colors.blue.800');
|
|
241
|
+
|
|
242
|
+
/* Secondary Colors */
|
|
243
|
+
--zabi-secondary: theme('colors.gray.600');
|
|
244
|
+
--zabi-secondary-hover: theme('colors.gray.700');
|
|
245
|
+
|
|
246
|
+
/* Success Colors */
|
|
247
|
+
--zabi-success: theme('colors.green.600');
|
|
248
|
+
--zabi-success-hover: theme('colors.green.700');
|
|
249
|
+
|
|
250
|
+
/* Warning Colors */
|
|
251
|
+
--zabi-warning: theme('colors.yellow.600');
|
|
252
|
+
--zabi-warning-hover: theme('colors.yellow.700');
|
|
253
|
+
|
|
254
|
+
/* Error Colors */
|
|
255
|
+
--zabi-error: theme('colors.red.600');
|
|
256
|
+
--zabi-error-hover: theme('colors.red.700');
|
|
257
|
+
|
|
258
|
+
/* Info Colors */
|
|
259
|
+
--zabi-info: theme('colors.blue.600');
|
|
260
|
+
--zabi-info-hover: theme('colors.blue.700');
|
|
261
|
+
|
|
262
|
+
/* Surface Colors */
|
|
263
|
+
--zabi-surface: theme('colors.white');
|
|
264
|
+
--zabi-surface-hover: theme('colors.gray.50');
|
|
265
|
+
|
|
266
|
+
/* Border Colors */
|
|
267
|
+
--zabi-border: theme('colors.gray.300');
|
|
268
|
+
--zabi-border-hover: theme('colors.gray.400');
|
|
269
|
+
--zabi-border-focus: theme('colors.blue.500');
|
|
270
|
+
|
|
271
|
+
/* Text Colors */
|
|
272
|
+
--zabi-text: theme('colors.gray.900');
|
|
273
|
+
--zabi-text-muted: theme('colors.gray.600');
|
|
274
|
+
--zabi-text-placeholder: theme('colors.gray.400');
|
|
275
|
+
--zabi-text-inverse: theme('colors.white');
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Dark Mode
|
|
280
|
+
|
|
281
|
+
Dark mode is automatically supported through CSS custom properties:
|
|
282
|
+
|
|
283
|
+
```css
|
|
284
|
+
.dark {
|
|
285
|
+
--zabi-surface: theme('colors.gray.900');
|
|
286
|
+
--zabi-surface-hover: theme('colors.gray.800');
|
|
287
|
+
--zabi-text: theme('colors.gray.100');
|
|
288
|
+
--zabi-text-muted: theme('colors.gray.400');
|
|
289
|
+
--zabi-border: theme('colors.gray.700');
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Event Structure
|
|
294
|
+
|
|
295
|
+
All components follow a consistent event structure:
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
interface BaseEventDetail<T = any> {
|
|
299
|
+
value: T;
|
|
300
|
+
event?: Event;
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Examples:**
|
|
305
|
+
- Button click: `{ detail: { value: true, event: MouseEvent } }`
|
|
306
|
+
- Input change: `{ detail: { value: string, event: Event } }`
|
|
307
|
+
- Checkbox change: `{ detail: { value: boolean, event: Event } }`
|
|
93
308
|
|
|
94
309
|
## TypeScript Support
|
|
95
310
|
|
|
96
|
-
|
|
311
|
+
Full TypeScript definitions are included with proper event typing:
|
|
97
312
|
|
|
98
313
|
```typescript
|
|
99
|
-
import type {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
314
|
+
import type { ButtonEvents, InputEvents, CardEvents, AlertEvents } from 'zabi-components';
|
|
315
|
+
|
|
316
|
+
// Event handlers with proper typing
|
|
317
|
+
function handleButtonClick(event: CustomEvent<{ value: boolean; event?: MouseEvent }>) {
|
|
318
|
+
console.log('Button clicked:', event.detail.value);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function handleInputChange(event: CustomEvent<{ value: string; event?: InputEvent }>) {
|
|
322
|
+
console.log('Input changed:', event.detail.value);
|
|
323
|
+
}
|
|
109
324
|
```
|
|
110
325
|
|
|
111
|
-
|
|
326
|
+
### Event Types
|
|
112
327
|
|
|
113
|
-
|
|
328
|
+
All components use standardized event types:
|
|
114
329
|
|
|
115
|
-
```
|
|
116
|
-
|
|
330
|
+
```typescript
|
|
331
|
+
// Base event structure
|
|
332
|
+
interface BaseEventDetail<T = any> {
|
|
333
|
+
value: T;
|
|
334
|
+
event?: Event;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Specific event types
|
|
338
|
+
interface ClickEventDetail extends BaseEventDetail<boolean> {
|
|
339
|
+
event?: MouseEvent | KeyboardEvent;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
interface InputEventDetail extends BaseEventDetail<string> {
|
|
343
|
+
event?: InputEvent;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
interface ChangeEventDetail extends BaseEventDetail<string> {
|
|
347
|
+
event?: Event;
|
|
348
|
+
}
|
|
117
349
|
```
|
|
118
350
|
|
|
119
|
-
|
|
351
|
+
### Component Event Interfaces
|
|
120
352
|
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
|
|
353
|
+
```typescript
|
|
354
|
+
interface ButtonEvents {
|
|
355
|
+
click: ClickEventDetail;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
interface InputEvents {
|
|
359
|
+
input: InputEventDetail;
|
|
360
|
+
change: ChangeEventDetail;
|
|
361
|
+
focus: { event: FocusEvent };
|
|
362
|
+
blur: { event: FocusEvent };
|
|
363
|
+
keydown: { event: KeyboardEvent };
|
|
364
|
+
keyup: { event: KeyboardEvent };
|
|
365
|
+
clear: { event: Event };
|
|
366
|
+
}
|
|
367
|
+
```
|
|
124
368
|
|
|
125
|
-
|
|
126
|
-
npm run dev
|
|
369
|
+
## Advanced Usage
|
|
127
370
|
|
|
128
|
-
|
|
129
|
-
npm run build:lib
|
|
371
|
+
### Custom Styling
|
|
130
372
|
|
|
131
|
-
|
|
132
|
-
|
|
373
|
+
```svelte
|
|
374
|
+
<Button
|
|
375
|
+
variant="primary"
|
|
376
|
+
size="lg"
|
|
377
|
+
className="w-full shadow-lg hover:shadow-xl"
|
|
378
|
+
on:click={(e) => console.log('Clicked!', e.detail.value)}
|
|
379
|
+
>
|
|
380
|
+
Custom Button
|
|
381
|
+
</Button>
|
|
133
382
|
```
|
|
134
383
|
|
|
135
|
-
|
|
384
|
+
### Form Integration
|
|
136
385
|
|
|
137
|
-
|
|
386
|
+
```svelte
|
|
387
|
+
<script lang="ts">
|
|
388
|
+
import { Button, Input, Card, Alert } from 'zabi-components';
|
|
389
|
+
|
|
390
|
+
interface FormData {
|
|
391
|
+
name: string;
|
|
392
|
+
email: string;
|
|
393
|
+
message: string;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
interface FormErrors {
|
|
397
|
+
name?: string;
|
|
398
|
+
email?: string;
|
|
399
|
+
message?: string;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
let formData: FormData = {
|
|
403
|
+
name: '',
|
|
404
|
+
email: '',
|
|
405
|
+
message: ''
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
let errors: FormErrors = {};
|
|
409
|
+
let showSuccess = false;
|
|
410
|
+
|
|
411
|
+
function validateForm(): boolean {
|
|
412
|
+
errors = {};
|
|
413
|
+
if (!formData.name) errors.name = 'Name is required';
|
|
414
|
+
if (!formData.email) errors.email = 'Email is required';
|
|
415
|
+
return Object.keys(errors).length === 0;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
function handleSubmit(event: CustomEvent) {
|
|
419
|
+
if (validateForm()) {
|
|
420
|
+
showSuccess = true;
|
|
421
|
+
// Submit form
|
|
422
|
+
console.log('Form submitted:', formData);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
</script>
|
|
138
426
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
427
|
+
<Card>
|
|
428
|
+
<div slot="header">
|
|
429
|
+
<h2>Contact Form</h2>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
<form on:submit|preventDefault={handleSubmit}>
|
|
433
|
+
<Input
|
|
434
|
+
bind:value={formData.name}
|
|
435
|
+
label="Name"
|
|
436
|
+
placeholder="Enter your name"
|
|
437
|
+
required
|
|
438
|
+
error={errors.name}
|
|
439
|
+
/>
|
|
440
|
+
|
|
441
|
+
<Input
|
|
442
|
+
bind:value={formData.email}
|
|
443
|
+
type="email"
|
|
444
|
+
label="Email"
|
|
445
|
+
placeholder="Enter your email"
|
|
446
|
+
required
|
|
447
|
+
error={errors.email}
|
|
448
|
+
/>
|
|
449
|
+
|
|
450
|
+
<Input
|
|
451
|
+
bind:value={formData.message}
|
|
452
|
+
label="Message"
|
|
453
|
+
placeholder="Enter your message"
|
|
454
|
+
helpText="Tell us what you think"
|
|
455
|
+
/>
|
|
456
|
+
|
|
457
|
+
<Button type="submit" variant="primary">
|
|
458
|
+
Send Message
|
|
459
|
+
</Button>
|
|
460
|
+
</form>
|
|
461
|
+
|
|
462
|
+
<div slot="footer">
|
|
463
|
+
<Alert variant="success" closable bind:show={showSuccess}>
|
|
464
|
+
Message sent successfully!
|
|
465
|
+
</Alert>
|
|
466
|
+
</div>
|
|
467
|
+
</Card>
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
## Contributing
|
|
471
|
+
|
|
472
|
+
1. Fork the repository
|
|
473
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
474
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
475
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
476
|
+
5. Open a Pull Request
|
|
143
477
|
|
|
144
478
|
## License
|
|
145
479
|
|
|
146
|
-
MIT
|
|
480
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
481
|
+
|
|
482
|
+
## Changelog
|
|
483
|
+
|
|
484
|
+
### v1.0.5 (Latest)
|
|
485
|
+
|
|
486
|
+
#### 🐛 Bug Fixes
|
|
487
|
+
- **Fixed Package Exports**: Resolved "Package subpath './atoms' is not defined" errors
|
|
488
|
+
- **Fixed Runtime Errors**: Eliminated null reference errors that caused application crashes
|
|
489
|
+
- **Fixed TypeScript Types**: Properly typed event handlers and component props
|
|
490
|
+
- **Fixed Slot Definitions**: Ensured slots work correctly with proper typing
|
|
491
|
+
- **Fixed Main Export**: Ensured zabi-components main import works correctly
|
|
492
|
+
|
|
493
|
+
#### ✨ Improvements
|
|
494
|
+
- Enhanced TypeScript support with comprehensive event type definitions
|
|
495
|
+
- Improved build configuration for better tree shaking
|
|
496
|
+
- Added proper type generation for all component categories
|
|
497
|
+
- Standardized event structure across all components
|
|
498
|
+
|
|
499
|
+
#### 📦 Package Structure
|
|
500
|
+
- Added support for subpath imports (`zabi-components/atoms`, `zabi-components/molecules`, etc.)
|
|
501
|
+
- Improved type definitions with proper event interfaces
|
|
502
|
+
- Enhanced build output with proper ES module exports
|
|
503
|
+
|
|
504
|
+
## Troubleshooting
|
|
505
|
+
|
|
506
|
+
### Common Issues
|
|
507
|
+
|
|
508
|
+
#### Import Errors
|
|
509
|
+
If you encounter import errors like "Package subpath './atoms' is not defined", make sure you're using the latest version:
|
|
510
|
+
|
|
511
|
+
```bash
|
|
512
|
+
npm install zabi-components@latest
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
#### TypeScript Event Handler Errors
|
|
516
|
+
If you see TypeScript errors with event handlers, make sure to use proper typing:
|
|
517
|
+
|
|
518
|
+
```typescript
|
|
519
|
+
// ✅ Correct
|
|
520
|
+
function handleClick(event: CustomEvent) {
|
|
521
|
+
console.log(event.detail.value);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// ❌ Incorrect - missing event parameter
|
|
525
|
+
function handleClick() {
|
|
526
|
+
console.log('clicked');
|
|
527
|
+
}
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
#### Runtime Errors
|
|
531
|
+
If you encounter runtime errors, ensure you have the correct peer dependencies:
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
npm install svelte@^5.0.0 @sveltejs/kit@^2.0.0
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### Migration from Previous Versions
|
|
538
|
+
|
|
539
|
+
If you're upgrading from a previous version, note these changes:
|
|
540
|
+
|
|
541
|
+
1. **Event Structure**: All events now follow the standardized `{ detail: { value, event? } }` structure
|
|
542
|
+
2. **Import Paths**: Subpath imports are now fully supported (`zabi-components/atoms`, etc.)
|
|
543
|
+
3. **TypeScript**: Enhanced type definitions with proper event typing
|
|
544
|
+
|
|
545
|
+
## Support
|
|
546
|
+
|
|
547
|
+
For support, please open an issue on GitHub or contact the maintainers.
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
Built with ❤️ using Svelte, TypeScript, and Tailwind CSS.
|