@getmicdrop/svelte-components 2.4.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/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/Dropdown/Dropdown.svelte +78 -14
- package/dist/components/Dropdown/Dropdown.svelte.d.ts +2 -0
- package/dist/components/Dropdown/Dropdown.svelte.d.ts.map +1 -1
- 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 +10 -6
- package/dist/components/Input/Input.svelte.d.ts.map +1 -1
- package/dist/components/Input/MultiSelect.svelte.d.ts +2 -2
- package/dist/components/Input/Select.svelte.d.ts +2 -2
- package/dist/components/Input/Textarea.svelte.d.ts +2 -2
- 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/StatusModal.svelte.d.ts +2 -2
- package/dist/components/Tabs/Tabs.svelte.d.ts +2 -2
- 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/settings/tabs/CustomImageDropzone.svelte.d.ts +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default Checkbox;
|
|
2
2
|
type Checkbox = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
|
|
3
3
|
class?: string | undefined;
|
|
4
|
+
color?: string | undefined;
|
|
4
5
|
disabled?: boolean | undefined;
|
|
5
6
|
checked?: boolean | undefined;
|
|
6
7
|
value?: string | undefined;
|
|
@@ -8,6 +9,11 @@ type Checkbox = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
|
|
|
8
9
|
}, {
|
|
9
10
|
default: {};
|
|
10
11
|
}>, {
|
|
12
|
+
click: PointerEvent;
|
|
13
|
+
focus: FocusEvent;
|
|
14
|
+
blur: FocusEvent;
|
|
15
|
+
keydown: KeyboardEvent;
|
|
16
|
+
keyup: KeyboardEvent;
|
|
11
17
|
change: CustomEvent<any>;
|
|
12
18
|
} & {
|
|
13
19
|
[evt: string]: CustomEvent<any>;
|
|
@@ -18,6 +24,7 @@ type Checkbox = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
|
|
|
18
24
|
};
|
|
19
25
|
declare const Checkbox: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
20
26
|
class?: string | undefined;
|
|
27
|
+
color?: string | undefined;
|
|
21
28
|
disabled?: boolean | undefined;
|
|
22
29
|
checked?: boolean | undefined;
|
|
23
30
|
value?: string | undefined;
|
|
@@ -25,6 +32,11 @@ declare const Checkbox: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsW
|
|
|
25
32
|
}, {
|
|
26
33
|
default: {};
|
|
27
34
|
}>, {
|
|
35
|
+
click: PointerEvent;
|
|
36
|
+
focus: FocusEvent;
|
|
37
|
+
blur: FocusEvent;
|
|
38
|
+
keydown: KeyboardEvent;
|
|
39
|
+
keyup: KeyboardEvent;
|
|
28
40
|
change: CustomEvent<any>;
|
|
29
41
|
} & {
|
|
30
42
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Checkbox/Checkbox.svelte.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Checkbox.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Checkbox/Checkbox.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgFA;;;;;;;;;;;;;;;;;;;;eAAiL;sCAT3I,KAAK,EAAE,KAAK;;;;;6CALL,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, onDestroy } from "svelte";
|
|
2
|
+
import { createEventDispatcher, onMount, onDestroy, tick } from "svelte";
|
|
3
3
|
|
|
4
4
|
/** @type {boolean} Whether the dropdown is open */
|
|
5
5
|
export let open = false;
|
|
@@ -10,33 +10,96 @@
|
|
|
10
10
|
/** @type {string} Additional CSS classes */
|
|
11
11
|
let className = "";
|
|
12
12
|
export { className as class };
|
|
13
|
+
/** @type {string} Accessible label for the dropdown menu */
|
|
14
|
+
export let ariaLabel = "Menu";
|
|
13
15
|
|
|
14
16
|
const dispatch = createEventDispatcher();
|
|
15
17
|
|
|
16
18
|
let dropdownRef;
|
|
19
|
+
let focusedIndex = -1;
|
|
20
|
+
let menuItems = [];
|
|
21
|
+
|
|
22
|
+
// Update menu items when dropdown opens
|
|
23
|
+
async function updateMenuItems() {
|
|
24
|
+
await tick();
|
|
25
|
+
if (dropdownRef) {
|
|
26
|
+
menuItems = Array.from(dropdownRef.querySelectorAll('[role="menuitem"]:not([disabled])'));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Focus a specific menu item by index
|
|
31
|
+
function focusItem(index) {
|
|
32
|
+
if (menuItems.length === 0) return;
|
|
33
|
+
if (index < 0) index = menuItems.length - 1;
|
|
34
|
+
if (index >= menuItems.length) index = 0;
|
|
35
|
+
focusedIndex = index;
|
|
36
|
+
menuItems[focusedIndex]?.focus();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Get trigger element (previous sibling)
|
|
40
|
+
function getTriggerElement() {
|
|
41
|
+
const parent = dropdownRef?.parentElement;
|
|
42
|
+
if (parent) {
|
|
43
|
+
const siblings = Array.from(parent.children);
|
|
44
|
+
const dropdownIndex = siblings.indexOf(dropdownRef);
|
|
45
|
+
if (dropdownIndex > 0) {
|
|
46
|
+
return siblings[dropdownIndex - 1];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
17
51
|
|
|
18
52
|
function handleClickOutside(event) {
|
|
19
53
|
if (dropdownRef && !dropdownRef.contains(event.target)) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const siblings = Array.from(parent.children);
|
|
24
|
-
const dropdownIndex = siblings.indexOf(dropdownRef);
|
|
25
|
-
if (dropdownIndex > 0) {
|
|
26
|
-
const trigger = siblings[dropdownIndex - 1];
|
|
27
|
-
if (trigger.contains(event.target)) {
|
|
28
|
-
return; // Let the trigger handle toggling
|
|
29
|
-
}
|
|
30
|
-
}
|
|
54
|
+
const trigger = getTriggerElement();
|
|
55
|
+
if (trigger?.contains(event.target)) {
|
|
56
|
+
return; // Let the trigger handle toggling
|
|
31
57
|
}
|
|
32
58
|
open = false;
|
|
33
59
|
}
|
|
34
60
|
}
|
|
35
61
|
|
|
36
62
|
function handleKeydown(event) {
|
|
37
|
-
if (
|
|
38
|
-
|
|
63
|
+
if (!open) return;
|
|
64
|
+
|
|
65
|
+
// Only handle if event originated from within this dropdown or its trigger
|
|
66
|
+
const trigger = getTriggerElement();
|
|
67
|
+
if (!dropdownRef?.contains(event.target) && !trigger?.contains(event.target)) {
|
|
68
|
+
return;
|
|
39
69
|
}
|
|
70
|
+
|
|
71
|
+
switch (event.key) {
|
|
72
|
+
case "Escape":
|
|
73
|
+
open = false;
|
|
74
|
+
trigger?.focus();
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
break;
|
|
77
|
+
case "ArrowDown":
|
|
78
|
+
focusItem(focusedIndex + 1);
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
break;
|
|
81
|
+
case "ArrowUp":
|
|
82
|
+
focusItem(focusedIndex - 1);
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
break;
|
|
85
|
+
case "Home":
|
|
86
|
+
focusItem(0);
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
break;
|
|
89
|
+
case "End":
|
|
90
|
+
focusItem(menuItems.length - 1);
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
break;
|
|
93
|
+
case "Tab":
|
|
94
|
+
open = false;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Watch for open state changes
|
|
100
|
+
$: if (open) {
|
|
101
|
+
focusedIndex = -1;
|
|
102
|
+
updateMenuItems();
|
|
40
103
|
}
|
|
41
104
|
|
|
42
105
|
onMount(() => {
|
|
@@ -64,6 +127,7 @@
|
|
|
64
127
|
bind:this={dropdownRef}
|
|
65
128
|
class="dropdown dropdown--{placement} {className}"
|
|
66
129
|
role="menu"
|
|
130
|
+
aria-label={ariaLabel}
|
|
67
131
|
{...$$restProps}
|
|
68
132
|
>
|
|
69
133
|
<slot />
|
|
@@ -5,6 +5,7 @@ type Dropdown = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
|
|
|
5
5
|
open?: boolean | undefined;
|
|
6
6
|
placement?: "top" | "bottom" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | undefined;
|
|
7
7
|
activeUrl?: string | undefined;
|
|
8
|
+
ariaLabel?: string | undefined;
|
|
8
9
|
}, {
|
|
9
10
|
default: {};
|
|
10
11
|
}>, {
|
|
@@ -20,6 +21,7 @@ declare const Dropdown: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsW
|
|
|
20
21
|
open?: boolean | undefined;
|
|
21
22
|
placement?: "top" | "bottom" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | undefined;
|
|
22
23
|
activeUrl?: string | undefined;
|
|
24
|
+
ariaLabel?: string | undefined;
|
|
23
25
|
}, {
|
|
24
26
|
default: {};
|
|
25
27
|
}>, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Dropdown/Dropdown.svelte.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dropdown.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Dropdown/Dropdown.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgKA;;;;;;;;;;;;;eAAyL;sCATnJ,KAAK,EAAE,KAAK;;;;;6CALL,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,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>;
|