zabi-components 5.0.21 → 5.0.22

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 (64) hide show
  1. package/README.md +1 -0
  2. package/dist/atoms/CardContent.svelte +1 -1
  3. package/dist/atoms/CardHeader.svelte +1 -1
  4. package/dist/atoms/Checkbox.svelte +1 -7
  5. package/dist/atoms/CodeBlock.svelte +6 -6
  6. package/dist/atoms/ColorPicker.svelte +80 -72
  7. package/dist/atoms/Input.svelte +14 -10
  8. package/dist/atoms/Input.svelte.d.ts +2 -0
  9. package/dist/atoms/List.svelte +47 -0
  10. package/dist/atoms/List.svelte.d.ts +19 -0
  11. package/dist/atoms/ListItem.svelte +148 -0
  12. package/dist/atoms/ListItem.svelte.d.ts +35 -0
  13. package/dist/atoms/Progress.svelte +3 -5
  14. package/dist/atoms/Select.svelte +59 -16
  15. package/dist/atoms/Select.svelte.d.ts +13 -1
  16. package/dist/atoms/Textarea.svelte +11 -9
  17. package/dist/atoms/Textarea.svelte.d.ts +1 -0
  18. package/dist/atoms/Toggle.svelte +1 -7
  19. package/dist/atoms/Tooltip.svelte +8 -15
  20. package/dist/atoms/index.d.ts +2 -0
  21. package/dist/atoms/index.js +2 -0
  22. package/dist/components/atoms/index.d.ts +2 -0
  23. package/dist/components/atoms/index.d.ts.map +1 -1
  24. package/dist/components/index.d.ts +4 -0
  25. package/dist/components/index.d.ts.map +1 -1
  26. package/dist/components/molecules/index.d.ts +0 -1
  27. package/dist/components/molecules/index.d.ts.map +1 -1
  28. package/dist/components/molecules/navigation-menu-context.d.ts +7 -0
  29. package/dist/components/molecules/navigation-menu-context.d.ts.map +1 -0
  30. package/dist/components/organisms/index.d.ts +2 -0
  31. package/dist/components/organisms/index.d.ts.map +1 -1
  32. package/dist/index.d.ts +4 -0
  33. package/dist/index.js +5 -8
  34. package/dist/molecules/Alert.svelte +8 -3
  35. package/dist/molecules/ContactForm.svelte +63 -31
  36. package/dist/molecules/ContactForm.svelte.d.ts +1 -4
  37. package/dist/molecules/Dropdown.svelte +2 -1
  38. package/dist/molecules/ImageUpload.svelte +26 -3
  39. package/dist/molecules/ImageUpload.svelte.d.ts +1 -0
  40. package/dist/molecules/Modal.svelte +44 -43
  41. package/dist/molecules/NavigationMenu.svelte +7 -10
  42. package/dist/molecules/NavigationMenuContent.svelte +8 -8
  43. package/dist/molecules/NavigationMenuItem.svelte +7 -6
  44. package/dist/molecules/NavigationMenuLink.svelte +7 -5
  45. package/dist/molecules/NavigationMenuList.svelte +0 -7
  46. package/dist/molecules/NavigationMenuTrigger.svelte +7 -7
  47. package/dist/molecules/SlideUp.svelte +30 -0
  48. package/dist/molecules/Tabs.svelte +71 -4
  49. package/dist/molecules/index.d.ts +0 -1
  50. package/dist/molecules/index.js +0 -1
  51. package/dist/molecules/navigation-menu-context.d.ts +6 -0
  52. package/dist/molecules/navigation-menu-context.js +1 -0
  53. package/dist/organisms/Navigation.svelte +7 -4
  54. package/dist/organisms/Navigation.svelte.d.ts +1 -0
  55. package/dist/organisms/SidebarNavigation.svelte +420 -0
  56. package/dist/organisms/SidebarNavigation.svelte.d.ts +44 -0
  57. package/dist/organisms/SidebarProjectPanel.svelte +174 -0
  58. package/dist/organisms/SidebarProjectPanel.svelte.d.ts +32 -0
  59. package/dist/organisms/index.d.ts +2 -0
  60. package/dist/organisms/index.js +2 -0
  61. package/dist/zabi-components.css +302 -0
  62. package/package.json +5 -4
  63. package/dist/molecules/Sidebar.svelte +0 -324
  64. package/dist/molecules/Sidebar.svelte.d.ts +0 -30
@@ -1,324 +0,0 @@
1
- <script lang="ts">
2
- import type { Snippet } from "svelte";
3
- import { onMount, onDestroy } from "svelte";
4
-
5
- interface SidebarItem {
6
- id: string;
7
- label: string;
8
- description?: string;
9
- icon?: any;
10
- onClick?: () => void;
11
- }
12
-
13
- interface SidebarSection {
14
- title?: string;
15
- items: SidebarItem[];
16
- }
17
-
18
- interface Props {
19
- title?: string;
20
- sections?: SidebarSection[];
21
- items?: SidebarItem[];
22
- selectedItemId?: string;
23
- selectedSectionId?: string;
24
- onItemClick?: (item: SidebarItem) => void;
25
- onSectionClick?: (sectionId: string) => void;
26
- className?: string;
27
- header?: Snippet;
28
- footer?: Snippet;
29
- isOpen?: boolean;
30
- onClose?: () => void;
31
- mobileResponsive?: boolean;
32
- }
33
-
34
- let {
35
- title = "",
36
- sections = [],
37
- items = [],
38
- selectedItemId = "",
39
- selectedSectionId = "",
40
- onItemClick,
41
- onSectionClick,
42
- className = "",
43
- header,
44
- footer,
45
- isOpen = true,
46
- onClose,
47
- mobileResponsive = true,
48
- ...restProps
49
- }: Props = $props();
50
-
51
- let isMobile = $state(false);
52
- let sidebarElement = $state<HTMLElement | null>(null);
53
-
54
- function checkMobile() {
55
- if (mobileResponsive) {
56
- isMobile = window.innerWidth < 768;
57
- } else {
58
- isMobile = false;
59
- }
60
- }
61
-
62
- function handleItemClick(item: SidebarItem) {
63
- if (item.onClick) {
64
- item.onClick();
65
- }
66
- if (onItemClick) {
67
- onItemClick(item);
68
- }
69
- // Close sidebar on mobile when item is clicked
70
- if (isMobile && onClose) {
71
- onClose();
72
- }
73
- }
74
-
75
- function handleSectionClick(sectionId: string) {
76
- if (onSectionClick) {
77
- onSectionClick(sectionId);
78
- }
79
- }
80
-
81
- function handleBackdropClick(event: MouseEvent) {
82
- if (event.target === event.currentTarget && onClose) {
83
- onClose();
84
- }
85
- }
86
-
87
- function handleKeydown(event: KeyboardEvent) {
88
- if (event.key === "Escape" && isOpen && isMobile && onClose) {
89
- onClose();
90
- }
91
- }
92
-
93
- onMount(() => {
94
- checkMobile();
95
- if (mobileResponsive) {
96
- window.addEventListener("resize", checkMobile);
97
- return () => window.removeEventListener("resize", checkMobile);
98
- }
99
- });
100
-
101
- const hasSections = $derived(sections.length > 0);
102
- const hasItems = $derived(items.length > 0);
103
- </script>
104
-
105
- {#if isMobile && mobileResponsive}
106
- <!-- Mobile: Overlay and Drawer -->
107
- {#if isOpen}
108
- <div
109
- class="fixed inset-0 bg-overlay z-modal md:hidden"
110
- onclick={handleBackdropClick}
111
- onkeydown={handleKeydown}
112
- role="dialog"
113
- aria-modal="true"
114
- aria-label="Sidebar navigation"
115
- tabindex="-1"
116
- >
117
- <aside
118
- bind:this={sidebarElement}
119
- class="fixed left-0 top-0 bottom-0 w-64 bg-base-100 border-r border-border p-6 h-full overflow-y-auto transform transition-transform duration-300 ease-in-out {isOpen ? 'translate-x-0' : '-translate-x-full'} {className}"
120
- role="complementary"
121
- aria-label="Sidebar navigation"
122
- onclick={(e) => e.stopPropagation()}
123
- {...restProps}
124
- >
125
- <div class="flex items-center justify-between mb-4 md:hidden">
126
- {#if title}
127
- <h2 class="text-lg font-semibold text-headline">{title}</h2>
128
- {/if}
129
- {#if onClose}
130
- <button
131
- type="button"
132
- onclick={onClose}
133
- class="text-description hover:text-headline text-2xl cursor-pointer transition-colors w-8 h-8 flex items-center justify-center rounded-full hover:bg-base-50"
134
- aria-label="Close sidebar"
135
- >
136
- ×
137
- </button>
138
- {/if}
139
- </div>
140
-
141
- {#if header}
142
- <div class="mb-6">
143
- {@render header()}
144
- </div>
145
- {:else if title && !isMobile}
146
- <h2 class="text-lg font-semibold text-headline mb-4">{title}</h2>
147
- {/if}
148
-
149
- {#if hasSections}
150
- {#each sections as section}
151
- {#if section.title}
152
- <div class="mb-4">
153
- <h3 class="text-sm font-medium text-headline mb-2 uppercase tracking-wide">
154
- {section.title}
155
- </h3>
156
- </div>
157
- {/if}
158
-
159
- <nav class="space-y-2 mb-8">
160
- {#each section.items as item}
161
- <button
162
- type="button"
163
- onclick={() => handleItemClick(item)}
164
- class="w-full text-left px-3 py-2 rounded-md transition-colors duration-200 {selectedItemId ===
165
- item.id
166
- ? 'bg-action-primary-subtle text-headline border-l-2 border-action-primary'
167
- : 'text-secondary hover:text-headline hover:bg-base-50'}"
168
- aria-current={selectedItemId === item.id ? "page" : undefined}
169
- >
170
- <div class="flex items-center gap-2">
171
- {#if item.icon}
172
- <div class="shrink-0">
173
- <svelte:component this={item.icon} class="h-4 w-4" />
174
- </div>
175
- {/if}
176
- <div class="flex-1">
177
- <div class="font-medium">{item.label}</div>
178
- {#if item.description}
179
- <div class="text-xs text-description">
180
- {item.description}
181
- </div>
182
- {/if}
183
- </div>
184
- </div>
185
- </button>
186
- {/each}
187
- </nav>
188
- {/each}
189
- {:else if hasItems}
190
- <nav class="space-y-1">
191
- {#each items as item}
192
- <button
193
- type="button"
194
- onclick={() => handleItemClick(item)}
195
- class="w-full text-left px-3 py-2 rounded-md transition-colors duration-200 {selectedItemId ===
196
- item.id
197
- ? 'bg-action-primary-subtle text-headline border-l-2 border-action-primary'
198
- : 'text-secondary hover:text-headline hover:bg-base-50'}"
199
- aria-current={selectedItemId === item.id ? "page" : undefined}
200
- >
201
- <div class="flex items-center gap-2">
202
- {#if item.icon}
203
- <div class="shrink-0">
204
- <svelte:component this={item.icon} class="h-4 w-4" />
205
- </div>
206
- {/if}
207
- <div class="flex-1">
208
- <div class="font-medium">{item.label}</div>
209
- {#if item.description}
210
- <div class="text-xs text-description">
211
- {item.description}
212
- </div>
213
- {/if}
214
- </div>
215
- </div>
216
- </button>
217
- {/each}
218
- </nav>
219
- {/if}
220
-
221
- {#if footer}
222
- <div class="mt-auto pt-6 border-t border-border">
223
- {@render footer()}
224
- </div>
225
- {/if}
226
- </aside>
227
- </div>
228
- {/if}
229
- {:else}
230
- <!-- Desktop: Always visible sidebar -->
231
- <aside
232
- bind:this={sidebarElement}
233
- class="w-64 bg-base-100 border-r border-border p-6 h-full overflow-y-auto {className}"
234
- role="complementary"
235
- aria-label="Sidebar navigation"
236
- {...restProps}
237
- >
238
- {#if header}
239
- <div class="mb-6">
240
- {@render header()}
241
- </div>
242
- {:else if title}
243
- <h2 class="text-lg font-semibold text-headline mb-4">{title}</h2>
244
- {/if}
245
-
246
- {#if hasSections}
247
- {#each sections as section}
248
- {#if section.title}
249
- <div class="mb-4">
250
- <h3 class="text-sm font-medium text-headline mb-2 uppercase tracking-wide">
251
- {section.title}
252
- </h3>
253
- </div>
254
- {/if}
255
-
256
- <nav class="space-y-2 mb-8">
257
- {#each section.items as item}
258
- <button
259
- type="button"
260
- onclick={() => handleItemClick(item)}
261
- class="w-full text-left px-3 py-2 rounded-md transition-colors duration-200 {selectedItemId ===
262
- item.id
263
- ? 'bg-action-primary-subtle text-headline border-l-2 border-action-primary'
264
- : 'text-secondary hover:text-headline hover:bg-base-50'}"
265
- aria-current={selectedItemId === item.id ? "page" : undefined}
266
- >
267
- <div class="flex items-center gap-2">
268
- {#if item.icon}
269
- <div class="shrink-0">
270
- <svelte:component this={item.icon} class="h-4 w-4" />
271
- </div>
272
- {/if}
273
- <div class="flex-1">
274
- <div class="font-medium">{item.label}</div>
275
- {#if item.description}
276
- <div class="text-xs text-description">
277
- {item.description}
278
- </div>
279
- {/if}
280
- </div>
281
- </div>
282
- </button>
283
- {/each}
284
- </nav>
285
- {/each}
286
- {:else if hasItems}
287
- <nav class="space-y-1">
288
- {#each items as item}
289
- <button
290
- type="button"
291
- onclick={() => handleItemClick(item)}
292
- class="w-full text-left px-3 py-2 rounded-md transition-colors duration-200 {selectedItemId ===
293
- item.id
294
- ? 'bg-action-primary-subtle text-headline border-l-2 border-action-primary'
295
- : 'text-secondary hover:text-headline hover:bg-base-50'}"
296
- aria-current={selectedItemId === item.id ? "page" : undefined}
297
- >
298
- <div class="flex items-center gap-2">
299
- {#if item.icon}
300
- <div class="shrink-0">
301
- <svelte:component this={item.icon} class="h-4 w-4" />
302
- </div>
303
- {/if}
304
- <div class="flex-1">
305
- <div class="font-medium">{item.label}</div>
306
- {#if item.description}
307
- <div class="text-xs text-description">
308
- {item.description}
309
- </div>
310
- {/if}
311
- </div>
312
- </div>
313
- </button>
314
- {/each}
315
- </nav>
316
- {/if}
317
-
318
- {#if footer}
319
- <div class="mt-auto pt-6 border-t border-border">
320
- {@render footer()}
321
- </div>
322
- {/if}
323
- </aside>
324
- {/if}
@@ -1,30 +0,0 @@
1
- import type { Snippet } from "svelte";
2
- interface SidebarItem {
3
- id: string;
4
- label: string;
5
- description?: string;
6
- icon?: any;
7
- onClick?: () => void;
8
- }
9
- interface SidebarSection {
10
- title?: string;
11
- items: SidebarItem[];
12
- }
13
- interface Props {
14
- title?: string;
15
- sections?: SidebarSection[];
16
- items?: SidebarItem[];
17
- selectedItemId?: string;
18
- selectedSectionId?: string;
19
- onItemClick?: (item: SidebarItem) => void;
20
- onSectionClick?: (sectionId: string) => void;
21
- className?: string;
22
- header?: Snippet;
23
- footer?: Snippet;
24
- isOpen?: boolean;
25
- onClose?: () => void;
26
- mobileResponsive?: boolean;
27
- }
28
- declare const Sidebar: import("svelte").Component<Props, {}, "">;
29
- type Sidebar = ReturnType<typeof Sidebar>;
30
- export default Sidebar;