@getmicdrop/svelte-components 2.3.0 → 2.6.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/dist/components/Accordion/AccordionItem.svelte +13 -1
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +4 -0
- package/dist/components/Accordion/AccordionItem.svelte.d.ts.map +1 -1
- package/dist/components/Badges/Badge.svelte +139 -14
- package/dist/components/Badges/Badge.svelte.d.ts +10 -0
- package/dist/components/Badges/Badge.svelte.d.ts.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.svelte +1 -1
- package/dist/components/Button/Button.svelte +135 -3
- package/dist/components/Button/Button.svelte.d.ts +2 -0
- package/dist/components/Button/Button.svelte.d.ts.map +1 -1
- package/dist/components/Card.svelte +2 -2
- package/dist/components/Card.svelte.d.ts +2 -2
- package/dist/components/Card.svelte.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.svelte +32 -58
- package/dist/components/Checkbox/Checkbox.svelte.d.ts +12 -0
- package/dist/components/Checkbox/Checkbox.svelte.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.svelte +18 -6
- package/dist/components/Drawer/Drawer.svelte.d.ts +6 -0
- package/dist/components/Drawer/Drawer.svelte.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.svelte +193 -0
- package/dist/components/Dropdown/Dropdown.svelte.d.ts +50 -0
- package/dist/components/Dropdown/Dropdown.svelte.d.ts.map +1 -0
- package/dist/components/Dropdown/DropdownItem.svelte +111 -0
- package/dist/components/Dropdown/DropdownItem.svelte.d.ts +48 -0
- package/dist/components/Dropdown/DropdownItem.svelte.d.ts.map +1 -0
- package/dist/components/Dropdown/SelectDropdown.svelte +301 -0
- package/dist/components/Dropdown/SelectDropdown.svelte.d.ts +51 -0
- package/dist/components/Dropdown/SelectDropdown.svelte.d.ts.map +1 -0
- package/dist/components/EmptyState/EmptyState.svelte +80 -0
- package/dist/components/EmptyState/EmptyState.svelte.d.ts +37 -0
- package/dist/components/EmptyState/EmptyState.svelte.d.ts.map +1 -0
- package/dist/components/ErrorDisplay.svelte.d.ts +2 -2
- package/dist/components/Input/Input.svelte +6 -1
- package/dist/components/Input/Input.svelte.d.ts +12 -8
- package/dist/components/Input/Input.svelte.d.ts.map +1 -1
- package/dist/components/Input/MultiSelect.svelte +4 -5
- package/dist/components/Input/MultiSelect.svelte.d.ts +4 -4
- package/dist/components/Input/MultiSelect.svelte.d.ts.map +1 -1
- package/dist/components/Input/Search.svelte +173 -0
- package/dist/components/Input/Search.svelte.d.ts +68 -0
- package/dist/components/Input/Search.svelte.d.ts.map +1 -0
- package/dist/components/Input/Select.svelte +4 -5
- package/dist/components/Input/Select.svelte.d.ts +4 -4
- package/dist/components/Input/Select.svelte.d.ts.map +1 -1
- package/dist/components/Input/Textarea.svelte +160 -0
- package/dist/components/Input/Textarea.svelte.d.ts +69 -0
- package/dist/components/Input/Textarea.svelte.d.ts.map +1 -0
- package/dist/components/Label/Label.svelte +60 -0
- package/dist/components/Label/Label.svelte.d.ts +48 -0
- package/dist/components/Label/Label.svelte.d.ts.map +1 -0
- package/dist/components/Layout/PageLayout.svelte +64 -0
- package/dist/components/Layout/PageLayout.svelte.d.ts +58 -0
- package/dist/components/Layout/PageLayout.svelte.d.ts.map +1 -0
- package/dist/components/Modal/InputModal.svelte +2 -1
- package/dist/components/Modal/InputModal.svelte.d.ts +2 -0
- package/dist/components/Modal/InputModal.svelte.d.ts.map +1 -1
- package/dist/components/Modal/Modal.svelte +3 -2
- package/dist/components/Modal/Modal.svelte.d.ts +2 -0
- package/dist/components/Modal/Modal.svelte.d.ts.map +1 -1
- package/dist/components/Modal/StatusModal.svelte.d.ts +2 -2
- package/dist/components/OrderSummary/OrderSummary.svelte +2 -2
- package/dist/components/OrderSummary/OrderSummary.svelte.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.svelte +27 -8
- package/dist/components/Pagination/Pagination.svelte.d.ts +16 -2
- package/dist/components/Pagination/Pagination.svelte.d.ts.map +1 -1
- package/dist/components/Radio/Radio.svelte +5 -2
- package/dist/components/Radio/Radio.svelte.d.ts +2 -0
- package/dist/components/Radio/Radio.svelte.d.ts.map +1 -1
- package/dist/components/Skeleton/Skeleton.svelte +11 -2
- package/dist/components/Skeleton/Skeleton.svelte.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.svelte.d.ts.map +1 -1
- package/dist/components/Tabs/TabItem.svelte +39 -0
- package/dist/components/Tabs/TabItem.svelte.d.ts +52 -0
- package/dist/components/Tabs/TabItem.svelte.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.svelte +181 -0
- package/dist/components/Tabs/Tabs.svelte.d.ts +46 -0
- package/dist/components/Tabs/Tabs.svelte.d.ts.map +1 -0
- package/dist/components/Typography/Typography.svelte +50 -0
- package/dist/components/Typography/Typography.svelte.d.ts +48 -0
- package/dist/components/Typography/Typography.svelte.d.ts.map +1 -0
- package/dist/components/pages/performers/ShowDetails.svelte.d.ts +2 -2
- package/dist/components/pages/performers/ShowItemCard.svelte.d.ts +2 -2
- package/dist/components/pages/settings/tabs/CustomImageDropzone.svelte.d.ts +2 -2
- package/dist/index.d.ts +11 -0
- package/dist/index.js +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* SelectDropdown - A self-contained dropdown with trigger button and option selection.
|
|
4
|
+
* Includes full keyboard navigation (Arrow keys, Home, End, Escape).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <SelectDropdown
|
|
8
|
+
* options={[{ label: 'Option 1', value: 'opt1' }, { label: 'Option 2', value: 'opt2' }]}
|
|
9
|
+
* bind:selected
|
|
10
|
+
* placeholder="Select an option"
|
|
11
|
+
* on:select={(e) => console.log(e.detail)}
|
|
12
|
+
* />
|
|
13
|
+
*/
|
|
14
|
+
import { createEventDispatcher, onMount, onDestroy, tick } from "svelte";
|
|
15
|
+
|
|
16
|
+
/** @type {Array<{label: string, value: string}>} Options to display */
|
|
17
|
+
export let options = [];
|
|
18
|
+
/** @type {{label: string, value: string}|null} Currently selected option */
|
|
19
|
+
export let selected = null;
|
|
20
|
+
/** @type {string} Placeholder text when no option is selected */
|
|
21
|
+
export let placeholder = "Select";
|
|
22
|
+
/** @type {string} Additional CSS classes for the container */
|
|
23
|
+
let className = "";
|
|
24
|
+
export { className as class };
|
|
25
|
+
/** @type {boolean} Whether the dropdown is disabled */
|
|
26
|
+
export let disabled = false;
|
|
27
|
+
|
|
28
|
+
const dispatch = createEventDispatcher();
|
|
29
|
+
|
|
30
|
+
let isOpen = false;
|
|
31
|
+
let triggerRef;
|
|
32
|
+
let menuRef;
|
|
33
|
+
let focusedIndex = -1;
|
|
34
|
+
let optionElements = [];
|
|
35
|
+
|
|
36
|
+
async function toggleDropdown() {
|
|
37
|
+
if (disabled) return;
|
|
38
|
+
isOpen = !isOpen;
|
|
39
|
+
if (isOpen) {
|
|
40
|
+
focusedIndex = -1;
|
|
41
|
+
await tick();
|
|
42
|
+
updateOptionElements();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function updateOptionElements() {
|
|
47
|
+
if (menuRef) {
|
|
48
|
+
optionElements = Array.from(menuRef.querySelectorAll('[role="option"]'));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function focusOption(index) {
|
|
53
|
+
if (optionElements.length === 0) return;
|
|
54
|
+
if (index < 0) index = optionElements.length - 1;
|
|
55
|
+
if (index >= optionElements.length) index = 0;
|
|
56
|
+
focusedIndex = index;
|
|
57
|
+
optionElements[focusedIndex]?.focus();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function selectOption(option) {
|
|
61
|
+
selected = option;
|
|
62
|
+
dispatch("select", option);
|
|
63
|
+
isOpen = false;
|
|
64
|
+
triggerRef?.focus();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function handleClickOutside(event) {
|
|
68
|
+
if (
|
|
69
|
+
triggerRef &&
|
|
70
|
+
!triggerRef.contains(event.target) &&
|
|
71
|
+
menuRef &&
|
|
72
|
+
!menuRef.contains(event.target)
|
|
73
|
+
) {
|
|
74
|
+
isOpen = false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function handleKeyDown(event) {
|
|
79
|
+
if (!isOpen) return;
|
|
80
|
+
|
|
81
|
+
// Only handle if event originated from within this dropdown
|
|
82
|
+
if (!menuRef?.contains(event.target) && !triggerRef?.contains(event.target)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
switch (event.key) {
|
|
87
|
+
case "Escape":
|
|
88
|
+
isOpen = false;
|
|
89
|
+
triggerRef?.focus();
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
break;
|
|
92
|
+
case "ArrowDown":
|
|
93
|
+
focusOption(focusedIndex + 1);
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
break;
|
|
96
|
+
case "ArrowUp":
|
|
97
|
+
focusOption(focusedIndex - 1);
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
break;
|
|
100
|
+
case "Home":
|
|
101
|
+
focusOption(0);
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
break;
|
|
104
|
+
case "End":
|
|
105
|
+
focusOption(optionElements.length - 1);
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
break;
|
|
108
|
+
case "Tab":
|
|
109
|
+
isOpen = false;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
onMount(() => {
|
|
115
|
+
if (typeof window !== "undefined") {
|
|
116
|
+
window.addEventListener("click", handleClickOutside);
|
|
117
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
onDestroy(() => {
|
|
122
|
+
if (typeof window !== "undefined") {
|
|
123
|
+
window.removeEventListener("click", handleClickOutside);
|
|
124
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<div class="select-dropdown {className}">
|
|
130
|
+
<button
|
|
131
|
+
bind:this={triggerRef}
|
|
132
|
+
type="button"
|
|
133
|
+
class="select-dropdown__trigger"
|
|
134
|
+
class:select-dropdown__trigger--disabled={disabled}
|
|
135
|
+
on:click|preventDefault={toggleDropdown}
|
|
136
|
+
aria-haspopup="listbox"
|
|
137
|
+
aria-expanded={isOpen}
|
|
138
|
+
aria-label={placeholder}
|
|
139
|
+
{disabled}
|
|
140
|
+
>
|
|
141
|
+
<span class="select-dropdown__value">
|
|
142
|
+
{selected?.label || placeholder}
|
|
143
|
+
</span>
|
|
144
|
+
<svg
|
|
145
|
+
class="select-dropdown__icon"
|
|
146
|
+
class:select-dropdown__icon--open={isOpen}
|
|
147
|
+
fill="none"
|
|
148
|
+
stroke="currentColor"
|
|
149
|
+
viewBox="0 0 24 24"
|
|
150
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
151
|
+
>
|
|
152
|
+
<path
|
|
153
|
+
stroke-linecap="round"
|
|
154
|
+
stroke-linejoin="round"
|
|
155
|
+
stroke-width="2"
|
|
156
|
+
d="M19 9l-7 7-7-7"
|
|
157
|
+
/>
|
|
158
|
+
</svg>
|
|
159
|
+
</button>
|
|
160
|
+
|
|
161
|
+
{#if isOpen}
|
|
162
|
+
<div
|
|
163
|
+
bind:this={menuRef}
|
|
164
|
+
class="select-dropdown__menu"
|
|
165
|
+
role="listbox"
|
|
166
|
+
aria-label={placeholder}
|
|
167
|
+
>
|
|
168
|
+
{#each options as option}
|
|
169
|
+
<button
|
|
170
|
+
type="button"
|
|
171
|
+
class="select-dropdown__option"
|
|
172
|
+
class:select-dropdown__option--selected={selected?.value === option.value}
|
|
173
|
+
on:click|preventDefault={() => selectOption(option)}
|
|
174
|
+
role="option"
|
|
175
|
+
aria-selected={selected?.value === option.value}
|
|
176
|
+
>
|
|
177
|
+
{option.label}
|
|
178
|
+
</button>
|
|
179
|
+
{/each}
|
|
180
|
+
</div>
|
|
181
|
+
{/if}
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
<style>
|
|
185
|
+
.select-dropdown {
|
|
186
|
+
position: relative;
|
|
187
|
+
display: inline-block;
|
|
188
|
+
font-size: 0.75rem;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.select-dropdown__trigger {
|
|
192
|
+
display: flex;
|
|
193
|
+
align-items: center;
|
|
194
|
+
padding: 0.5rem 1rem;
|
|
195
|
+
text-align: left;
|
|
196
|
+
background-color: hsl(var(--BG-Primary, 0 0% 100%));
|
|
197
|
+
color: hsl(var(--Text-Primary, 220 13% 13%));
|
|
198
|
+
border: 1px solid hsl(var(--Stroke-Primary, 220 13% 85%));
|
|
199
|
+
border-radius: 0.375rem;
|
|
200
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
201
|
+
cursor: pointer;
|
|
202
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.select-dropdown__trigger:hover:not(:disabled) {
|
|
206
|
+
border-color: hsl(var(--Stroke-Secondary, 220 13% 75%));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.select-dropdown__trigger:focus {
|
|
210
|
+
outline: none;
|
|
211
|
+
border-color: hsl(var(--Brand-Primary, 221 83% 53%));
|
|
212
|
+
box-shadow: 0 0 0 2px hsl(var(--Brand-Primary, 221 83% 53%) / 0.2);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.select-dropdown__trigger--disabled {
|
|
216
|
+
opacity: 0.5;
|
|
217
|
+
cursor: not-allowed;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.select-dropdown__value {
|
|
221
|
+
flex: 1;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.select-dropdown__icon {
|
|
225
|
+
width: 1rem;
|
|
226
|
+
height: 1rem;
|
|
227
|
+
margin-left: 0.5rem;
|
|
228
|
+
transition: transform 0.15s ease;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.select-dropdown__icon--open {
|
|
232
|
+
transform: rotate(180deg);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.select-dropdown__menu {
|
|
236
|
+
position: absolute;
|
|
237
|
+
top: 100%;
|
|
238
|
+
left: 0;
|
|
239
|
+
z-index: 50;
|
|
240
|
+
display: flex;
|
|
241
|
+
flex-direction: column;
|
|
242
|
+
min-width: 100%;
|
|
243
|
+
margin-top: 0.25rem;
|
|
244
|
+
background-color: hsl(var(--BG-Primary, 0 0% 100%));
|
|
245
|
+
border: 1px solid hsl(var(--Stroke-Primary, 220 13% 85%));
|
|
246
|
+
border-radius: 0.375rem;
|
|
247
|
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
248
|
+
max-height: 200px;
|
|
249
|
+
overflow-y: auto;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.select-dropdown__menu::-webkit-scrollbar {
|
|
253
|
+
display: none;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.select-dropdown__option {
|
|
257
|
+
width: 100%;
|
|
258
|
+
padding: 0.5rem 1rem;
|
|
259
|
+
text-align: left;
|
|
260
|
+
background: transparent;
|
|
261
|
+
border: none;
|
|
262
|
+
color: hsl(var(--Text-Primary, 220 13% 13%));
|
|
263
|
+
cursor: pointer;
|
|
264
|
+
transition: background-color 0.15s ease;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.select-dropdown__option:hover {
|
|
268
|
+
background-color: hsl(var(--BG-Secondary, 220 14% 96%));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.select-dropdown__option:focus {
|
|
272
|
+
outline: none;
|
|
273
|
+
background-color: hsl(var(--BG-Secondary, 220 14% 96%));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.select-dropdown__option--selected {
|
|
277
|
+
background-color: hsl(var(--Brand-Primary, 221 83% 53%) / 0.1);
|
|
278
|
+
color: hsl(var(--Brand-Primary, 221 83% 53%));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* Dark mode */
|
|
282
|
+
:global(.dark) .select-dropdown__trigger {
|
|
283
|
+
background-color: hsl(var(--BG-Primary, 220 13% 15%));
|
|
284
|
+
color: hsl(var(--Text-Primary, 0 0% 95%));
|
|
285
|
+
border-color: hsl(var(--Stroke-Primary, 220 13% 30%));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
:global(.dark) .select-dropdown__menu {
|
|
289
|
+
background-color: hsl(var(--BG-Primary, 220 13% 15%));
|
|
290
|
+
border-color: hsl(var(--Stroke-Primary, 220 13% 30%));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
:global(.dark) .select-dropdown__option {
|
|
294
|
+
color: hsl(var(--Text-Primary, 0 0% 95%));
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
:global(.dark) .select-dropdown__option:hover,
|
|
298
|
+
:global(.dark) .select-dropdown__option:focus {
|
|
299
|
+
background-color: hsl(var(--BG-Secondary, 220 13% 20%));
|
|
300
|
+
}
|
|
301
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export default SelectDropdown;
|
|
2
|
+
type SelectDropdown = SvelteComponent<{
|
|
3
|
+
class?: string | undefined;
|
|
4
|
+
disabled?: boolean | undefined;
|
|
5
|
+
options?: {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}[] | undefined;
|
|
9
|
+
selected?: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
} | null | undefined;
|
|
13
|
+
placeholder?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
select: CustomEvent<any>;
|
|
16
|
+
} & {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
}, {}> & {
|
|
19
|
+
$$bindings?: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
declare const SelectDropdown: $$__sveltets_2_IsomorphicComponent<{
|
|
22
|
+
class?: string | undefined;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
options?: {
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
selected?: {
|
|
29
|
+
label: string;
|
|
30
|
+
value: string;
|
|
31
|
+
} | null | undefined;
|
|
32
|
+
placeholder?: string | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
select: CustomEvent<any>;
|
|
35
|
+
} & {
|
|
36
|
+
[evt: string]: CustomEvent<any>;
|
|
37
|
+
}, {}, {}, string>;
|
|
38
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
39
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
40
|
+
$$bindings?: Bindings;
|
|
41
|
+
} & Exports;
|
|
42
|
+
(internal: unknown, props: Props & {
|
|
43
|
+
$$events?: Events;
|
|
44
|
+
$$slots?: Slots;
|
|
45
|
+
}): Exports & {
|
|
46
|
+
$set?: any;
|
|
47
|
+
$on?: any;
|
|
48
|
+
};
|
|
49
|
+
z_$$bindings?: Bindings;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=SelectDropdown.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectDropdown.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Dropdown/SelectDropdown.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA6KA;;;;eAdyB,MAAM;eAAS,MAAM;;;eAC3B,MAAM;eAAS,MAAM;;;;;;;mBAa2I;6CATtI,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* EmptyState - Display an empty state message with optional icon
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <EmptyState message="No results found" />
|
|
7
|
+
* <EmptyState message="No events" subtext="Create your first event to get started" />
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** @type {string} Main message to display */
|
|
11
|
+
export let message = 'No results found';
|
|
12
|
+
/** @type {string} Secondary descriptive text */
|
|
13
|
+
export let subtext = '';
|
|
14
|
+
/** @type {any} Icon component or image path */
|
|
15
|
+
export let icon = null;
|
|
16
|
+
/** @type {'component' | 'image'} Type of icon provided */
|
|
17
|
+
export let iconType = 'component';
|
|
18
|
+
/** @type {string} Size classes for the icon */
|
|
19
|
+
export let iconSize = 'w-20 h-20';
|
|
20
|
+
/** @type {string} Additional CSS classes */
|
|
21
|
+
let className = '';
|
|
22
|
+
export { className as class };
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class="empty-state {className}">
|
|
26
|
+
{#if icon}
|
|
27
|
+
{#if iconType === 'component'}
|
|
28
|
+
<svelte:component this={icon} class="empty-state__icon {iconSize}" />
|
|
29
|
+
{:else if iconType === 'image'}
|
|
30
|
+
<img src={icon} alt="" class="empty-state__icon {iconSize}" />
|
|
31
|
+
{/if}
|
|
32
|
+
{/if}
|
|
33
|
+
|
|
34
|
+
<h3 class="empty-state__message">{message}</h3>
|
|
35
|
+
{#if subtext}
|
|
36
|
+
<p class="empty-state__subtext">{subtext}</p>
|
|
37
|
+
{/if}
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<style>
|
|
41
|
+
.empty-state {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
padding: 2.5rem 1.5rem;
|
|
47
|
+
text-align: center;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.empty-state__icon {
|
|
51
|
+
margin-bottom: 0.75rem;
|
|
52
|
+
color: hsl(var(--Text-Tertiary, 220 9% 46%));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.empty-state__message {
|
|
56
|
+
font-size: 1.125rem;
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
color: hsl(var(--Text-Primary, 220 13% 18%));
|
|
59
|
+
margin: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.empty-state__subtext {
|
|
63
|
+
font-size: 0.875rem;
|
|
64
|
+
color: hsl(var(--Text-Secondary, 220 9% 46%));
|
|
65
|
+
margin: 0.25rem 0 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Dark mode */
|
|
69
|
+
:global(.dark) .empty-state__icon {
|
|
70
|
+
color: hsl(var(--Text-Tertiary, 220 9% 60%));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:global(.dark) .empty-state__message {
|
|
74
|
+
color: hsl(var(--Text-Primary, 0 0% 95%));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:global(.dark) .empty-state__subtext {
|
|
78
|
+
color: hsl(var(--Text-Secondary, 220 9% 70%));
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export default EmptyState;
|
|
2
|
+
type EmptyState = SvelteComponent<{
|
|
3
|
+
class?: string | undefined;
|
|
4
|
+
message?: string | undefined;
|
|
5
|
+
icon?: any;
|
|
6
|
+
subtext?: string | undefined;
|
|
7
|
+
iconType?: "image" | "component" | undefined;
|
|
8
|
+
iconSize?: string | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
}, {}> & {
|
|
12
|
+
$$bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
declare const EmptyState: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
class?: string | undefined;
|
|
16
|
+
message?: string | undefined;
|
|
17
|
+
icon?: any;
|
|
18
|
+
subtext?: string | undefined;
|
|
19
|
+
iconType?: "image" | "component" | undefined;
|
|
20
|
+
iconSize?: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
}, {}, {}, string>;
|
|
24
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
25
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
26
|
+
$$bindings?: Bindings;
|
|
27
|
+
} & Exports;
|
|
28
|
+
(internal: unknown, props: Props & {
|
|
29
|
+
$$events?: Events;
|
|
30
|
+
$$slots?: Slots;
|
|
31
|
+
}): Exports & {
|
|
32
|
+
$set?: any;
|
|
33
|
+
$on?: any;
|
|
34
|
+
};
|
|
35
|
+
z_$$bindings?: Bindings;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=EmptyState.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyState.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/EmptyState/EmptyState.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;AA6DA;;;WAbW,GAAG;;;;;;mBAaoK;6CATrI,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,eAAe,QAAQ,CAAC"}
|
|
@@ -3,9 +3,9 @@ type ErrorDisplay = SvelteComponent<{
|
|
|
3
3
|
className?: string | undefined;
|
|
4
4
|
error?: string | undefined;
|
|
5
5
|
show?: boolean | undefined;
|
|
6
|
-
shake?: boolean | undefined;
|
|
7
6
|
icon?: string | undefined;
|
|
8
7
|
iconSize?: string | undefined;
|
|
8
|
+
shake?: boolean | undefined;
|
|
9
9
|
}, {
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
}, {}> & {
|
|
@@ -15,9 +15,9 @@ declare const ErrorDisplay: $$__sveltets_2_IsomorphicComponent<{
|
|
|
15
15
|
className?: string | undefined;
|
|
16
16
|
error?: string | undefined;
|
|
17
17
|
show?: boolean | undefined;
|
|
18
|
-
shake?: boolean | undefined;
|
|
19
18
|
icon?: string | undefined;
|
|
20
19
|
iconSize?: string | undefined;
|
|
20
|
+
shake?: boolean | undefined;
|
|
21
21
|
}, {
|
|
22
22
|
[evt: string]: CustomEvent<any>;
|
|
23
23
|
}, {}, {}, string>;
|
|
@@ -457,6 +457,11 @@
|
|
|
457
457
|
{:else}
|
|
458
458
|
<!-- Standard Input Layout -->
|
|
459
459
|
<div class="relative flex items-center w-full">
|
|
460
|
+
{#if $$slots.leftIcon}
|
|
461
|
+
<div class="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 z-10 pointer-events-none">
|
|
462
|
+
<slot name="leftIcon" />
|
|
463
|
+
</div>
|
|
464
|
+
{/if}
|
|
460
465
|
<input
|
|
461
466
|
bind:this={inputElement}
|
|
462
467
|
{id}
|
|
@@ -471,7 +476,7 @@
|
|
|
471
476
|
on:keydown={handleSearchKeyDown}
|
|
472
477
|
{maxlength}
|
|
473
478
|
{minlength}
|
|
474
|
-
class="input-field flex-1 {icon || (showClearButton && inputValue)
|
|
479
|
+
class="input-field flex-1 {$$slots.leftIcon ? 'pl-10' : ''} {icon || (showClearButton && inputValue)
|
|
475
480
|
? 'pr-10'
|
|
476
481
|
: ''} {getContentFloatClass()} {displayErrorText
|
|
477
482
|
? 'input-error'
|
|
@@ -4,18 +4,18 @@ type Input = SvelteComponent<{
|
|
|
4
4
|
size?: string | undefined;
|
|
5
5
|
className?: string | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
|
+
icon?: null | undefined;
|
|
7
8
|
value?: string | undefined;
|
|
8
9
|
name?: string | undefined;
|
|
9
10
|
label?: string | undefined;
|
|
10
|
-
|
|
11
|
+
id?: string | undefined;
|
|
12
|
+
placeholder?: string | undefined;
|
|
11
13
|
required?: boolean | undefined;
|
|
12
14
|
optional?: boolean | undefined;
|
|
13
15
|
buttonIcon?: null | undefined;
|
|
14
16
|
buttonText?: null | undefined;
|
|
15
17
|
maxlength?: null | undefined;
|
|
16
18
|
minlength?: null | undefined;
|
|
17
|
-
placeholder?: string | undefined;
|
|
18
|
-
id?: string | undefined;
|
|
19
19
|
textareaSize?: string | undefined;
|
|
20
20
|
errorText?: string | undefined;
|
|
21
21
|
helperText?: string | undefined;
|
|
@@ -44,7 +44,9 @@ type Input = SvelteComponent<{
|
|
|
44
44
|
search: CustomEvent<any>;
|
|
45
45
|
} & {
|
|
46
46
|
[evt: string]: CustomEvent<any>;
|
|
47
|
-
}, {
|
|
47
|
+
}, {
|
|
48
|
+
leftIcon: {};
|
|
49
|
+
}> & {
|
|
48
50
|
$$bindings?: string | undefined;
|
|
49
51
|
};
|
|
50
52
|
declare const Input: $$__sveltets_2_IsomorphicComponent<{
|
|
@@ -52,18 +54,18 @@ declare const Input: $$__sveltets_2_IsomorphicComponent<{
|
|
|
52
54
|
size?: string | undefined;
|
|
53
55
|
className?: string | undefined;
|
|
54
56
|
disabled?: boolean | undefined;
|
|
57
|
+
icon?: null | undefined;
|
|
55
58
|
value?: string | undefined;
|
|
56
59
|
name?: string | undefined;
|
|
57
60
|
label?: string | undefined;
|
|
58
|
-
|
|
61
|
+
id?: string | undefined;
|
|
62
|
+
placeholder?: string | undefined;
|
|
59
63
|
required?: boolean | undefined;
|
|
60
64
|
optional?: boolean | undefined;
|
|
61
65
|
buttonIcon?: null | undefined;
|
|
62
66
|
buttonText?: null | undefined;
|
|
63
67
|
maxlength?: null | undefined;
|
|
64
68
|
minlength?: null | undefined;
|
|
65
|
-
placeholder?: string | undefined;
|
|
66
|
-
id?: string | undefined;
|
|
67
69
|
textareaSize?: string | undefined;
|
|
68
70
|
errorText?: string | undefined;
|
|
69
71
|
helperText?: string | undefined;
|
|
@@ -92,7 +94,9 @@ declare const Input: $$__sveltets_2_IsomorphicComponent<{
|
|
|
92
94
|
search: CustomEvent<any>;
|
|
93
95
|
} & {
|
|
94
96
|
[evt: string]: CustomEvent<any>;
|
|
95
|
-
}, {
|
|
97
|
+
}, {
|
|
98
|
+
leftIcon: {};
|
|
99
|
+
}, {}, string>;
|
|
96
100
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
97
101
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
98
102
|
$$bindings?: Bindings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Input/Input.svelte.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Input.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Input/Input.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkdA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAAwnB;6CAd3kB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,eAAe,QAAQ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { createEventDispatcher, onMount
|
|
2
|
+
import { createEventDispatcher, onMount } from "svelte";
|
|
3
3
|
|
|
4
4
|
const dispatch = createEventDispatcher();
|
|
5
5
|
|
|
@@ -117,10 +117,9 @@
|
|
|
117
117
|
|
|
118
118
|
onMount(() => {
|
|
119
119
|
document.addEventListener("click", handleClickOutside);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
document.removeEventListener("click", handleClickOutside);
|
|
120
|
+
return () => {
|
|
121
|
+
document.removeEventListener("click", handleClickOutside);
|
|
122
|
+
};
|
|
124
123
|
});
|
|
125
124
|
</script>
|
|
126
125
|
|
|
@@ -5,9 +5,9 @@ type MultiSelect = SvelteComponent<{
|
|
|
5
5
|
value?: any[] | undefined;
|
|
6
6
|
name?: string | undefined;
|
|
7
7
|
label?: string | undefined;
|
|
8
|
-
required?: boolean | undefined;
|
|
9
|
-
placeholder?: string | undefined;
|
|
10
8
|
id?: string | undefined;
|
|
9
|
+
placeholder?: string | undefined;
|
|
10
|
+
required?: boolean | undefined;
|
|
11
11
|
animateFocus?: boolean | undefined;
|
|
12
12
|
items?: any[] | undefined;
|
|
13
13
|
hideClear?: boolean | undefined;
|
|
@@ -24,9 +24,9 @@ declare const MultiSelect: $$__sveltets_2_IsomorphicComponent<{
|
|
|
24
24
|
value?: any[] | undefined;
|
|
25
25
|
name?: string | undefined;
|
|
26
26
|
label?: string | undefined;
|
|
27
|
-
required?: boolean | undefined;
|
|
28
|
-
placeholder?: string | undefined;
|
|
29
27
|
id?: string | undefined;
|
|
28
|
+
placeholder?: string | undefined;
|
|
29
|
+
required?: boolean | undefined;
|
|
30
30
|
animateFocus?: boolean | undefined;
|
|
31
31
|
items?: any[] | undefined;
|
|
32
32
|
hideClear?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Input/MultiSelect.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"MultiSelect.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Input/MultiSelect.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAsNA;;;;;;;;;;;;;;;;mBAAqO;6CATxL,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,eAAe,QAAQ,CAAC"}
|