@getmicdrop/svelte-components 2.3.0 → 2.4.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.
Files changed (55) hide show
  1. package/dist/components/Accordion/AccordionItem.svelte +13 -1
  2. package/dist/components/Accordion/AccordionItem.svelte.d.ts +4 -0
  3. package/dist/components/Accordion/AccordionItem.svelte.d.ts.map +1 -1
  4. package/dist/components/Drawer/Drawer.svelte +18 -6
  5. package/dist/components/Drawer/Drawer.svelte.d.ts +6 -0
  6. package/dist/components/Drawer/Drawer.svelte.d.ts.map +1 -1
  7. package/dist/components/Dropdown/Dropdown.svelte +129 -0
  8. package/dist/components/Dropdown/Dropdown.svelte.d.ts +48 -0
  9. package/dist/components/Dropdown/Dropdown.svelte.d.ts.map +1 -0
  10. package/dist/components/Dropdown/DropdownItem.svelte +111 -0
  11. package/dist/components/Dropdown/DropdownItem.svelte.d.ts +48 -0
  12. package/dist/components/Dropdown/DropdownItem.svelte.d.ts.map +1 -0
  13. package/dist/components/Input/Input.svelte.d.ts +2 -2
  14. package/dist/components/Input/MultiSelect.svelte +4 -5
  15. package/dist/components/Input/MultiSelect.svelte.d.ts +2 -2
  16. package/dist/components/Input/MultiSelect.svelte.d.ts.map +1 -1
  17. package/dist/components/Input/Search.svelte +173 -0
  18. package/dist/components/Input/Search.svelte.d.ts +68 -0
  19. package/dist/components/Input/Search.svelte.d.ts.map +1 -0
  20. package/dist/components/Input/Select.svelte +4 -5
  21. package/dist/components/Input/Select.svelte.d.ts +2 -2
  22. package/dist/components/Input/Select.svelte.d.ts.map +1 -1
  23. package/dist/components/Input/Textarea.svelte +160 -0
  24. package/dist/components/Input/Textarea.svelte.d.ts +69 -0
  25. package/dist/components/Input/Textarea.svelte.d.ts.map +1 -0
  26. package/dist/components/Label/Label.svelte +60 -0
  27. package/dist/components/Label/Label.svelte.d.ts +48 -0
  28. package/dist/components/Label/Label.svelte.d.ts.map +1 -0
  29. package/dist/components/Modal/InputModal.svelte +2 -1
  30. package/dist/components/Modal/InputModal.svelte.d.ts +2 -0
  31. package/dist/components/Modal/InputModal.svelte.d.ts.map +1 -1
  32. package/dist/components/Modal/Modal.svelte +3 -2
  33. package/dist/components/Modal/Modal.svelte.d.ts +2 -0
  34. package/dist/components/Modal/Modal.svelte.d.ts.map +1 -1
  35. package/dist/components/OrderSummary/OrderSummary.svelte +2 -2
  36. package/dist/components/OrderSummary/OrderSummary.svelte.d.ts.map +1 -1
  37. package/dist/components/Pagination/Pagination.svelte +27 -8
  38. package/dist/components/Pagination/Pagination.svelte.d.ts +16 -2
  39. package/dist/components/Pagination/Pagination.svelte.d.ts.map +1 -1
  40. package/dist/components/Radio/Radio.svelte +5 -2
  41. package/dist/components/Radio/Radio.svelte.d.ts +2 -0
  42. package/dist/components/Radio/Radio.svelte.d.ts.map +1 -1
  43. package/dist/components/Skeleton/Skeleton.svelte +11 -2
  44. package/dist/components/Skeleton/Skeleton.svelte.d.ts +2 -0
  45. package/dist/components/Skeleton/Skeleton.svelte.d.ts.map +1 -1
  46. package/dist/components/Tabs/TabItem.svelte +39 -0
  47. package/dist/components/Tabs/TabItem.svelte.d.ts +52 -0
  48. package/dist/components/Tabs/TabItem.svelte.d.ts.map +1 -0
  49. package/dist/components/Tabs/Tabs.svelte +181 -0
  50. package/dist/components/Tabs/Tabs.svelte.d.ts +46 -0
  51. package/dist/components/Tabs/Tabs.svelte.d.ts.map +1 -0
  52. package/dist/components/pages/performers/ShowItemCard.svelte.d.ts +2 -2
  53. package/dist/index.d.ts +7 -0
  54. package/dist/index.js +9 -0
  55. package/package.json +1 -1
@@ -7,6 +7,10 @@
7
7
  /** @type {string} Additional CSS classes */
8
8
  let className = "";
9
9
  export { className as class };
10
+ /** @type {boolean} Whether to show border (flowbite API compatibility) */
11
+ export let border = true;
12
+ /** @type {string} CSS classes to apply when item is open (flowbite API compatibility) */
13
+ export let borderOpenClass = "";
10
14
 
11
15
  const { openItems, toggle } = getContext("accordion");
12
16
 
@@ -26,7 +30,7 @@
26
30
  }
27
31
  </script>
28
32
 
29
- <div class="accordion-item {className}" class:accordion-item--open={isOpen}>
33
+ <div class="accordion-item {className} {isOpen && borderOpenClass ? borderOpenClass : ''}" class:accordion-item--open={isOpen} class:accordion-item--no-border={!border}>
30
34
  <button
31
35
  type="button"
32
36
  class="accordion-item__header"
@@ -126,4 +130,12 @@
126
130
  font-size: 0.875rem;
127
131
  line-height: 1.5;
128
132
  }
133
+
134
+ .accordion-item--no-border {
135
+ border-bottom: none;
136
+ }
137
+
138
+ .accordion-item--no-border:last-child {
139
+ border-bottom: none;
140
+ }
129
141
  </style>
@@ -2,6 +2,8 @@ export default AccordionItem;
2
2
  type AccordionItem = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
3
  class?: string | undefined;
4
4
  open?: boolean | undefined;
5
+ border?: boolean | undefined;
6
+ borderOpenClass?: string | undefined;
5
7
  }, {
6
8
  header: {};
7
9
  default: {};
@@ -16,6 +18,8 @@ type AccordionItem = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
16
18
  declare const AccordionItem: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
17
19
  class?: string | undefined;
18
20
  open?: boolean | undefined;
21
+ border?: boolean | undefined;
22
+ borderOpenClass?: string | undefined;
19
23
  }, {
20
24
  header: {};
21
25
  default: {};
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionItem.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Accordion/AccordionItem.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAyEA;;;;;;;;;;;eAAiJ;sCAT3G,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,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,QAAQ,CAAC"}
@@ -5,6 +5,8 @@
5
5
 
6
6
  /** @type {boolean} Whether the drawer is visible */
7
7
  export let show = false;
8
+ /** @type {boolean} Flowbite-style hidden prop (inverse of show) */
9
+ export let hidden = true;
8
10
  /** @type {string} Optional title for the drawer header */
9
11
  export let title = "";
10
12
  /** @type {'left' | 'right' | 'top' | 'bottom'} Which side the drawer slides from */
@@ -19,10 +21,19 @@
19
21
  export let closeOnBackdropClick = true;
20
22
  /** @type {boolean} Whether pressing Escape closes the drawer */
21
23
  export let closeOnEscape = true;
24
+ /** @type {string} Optional id for the drawer element */
25
+ export let id = "";
26
+ /** @type {object|undefined} Custom transition params (flowbite API) */
27
+ export let transitionParams = undefined;
22
28
 
23
29
  const dispatch = createEventDispatcher();
24
30
 
31
+ // Support both show and hidden props (flowbite uses hidden)
32
+ $: isVisible = show || !hidden;
33
+
25
34
  function close() {
35
+ hidden = true;
36
+ show = false;
26
37
  dispatch("close");
27
38
  }
28
39
 
@@ -33,13 +44,13 @@
33
44
  }
34
45
 
35
46
  function handleKeydown(e) {
36
- if (closeOnEscape && e.key === "Escape" && show) {
47
+ if (closeOnEscape && e.key === "Escape" && isVisible) {
37
48
  close();
38
49
  }
39
50
  }
40
51
 
41
- // Calculate transition params based on placement
42
- $: transitionParams = (() => {
52
+ // Calculate transition params based on placement (use custom if provided)
53
+ $: computedTransitionParams = transitionParams || (() => {
43
54
  switch (placement) {
44
55
  case "left":
45
56
  return { x: -320, duration, easing: cubicOut };
@@ -56,7 +67,7 @@
56
67
 
57
68
  // Lock body scroll when drawer is open
58
69
  $: if (typeof document !== "undefined") {
59
- if (show) {
70
+ if (isVisible) {
60
71
  document.body.style.overflow = "hidden";
61
72
  } else {
62
73
  document.body.style.overflow = "";
@@ -72,7 +83,7 @@
72
83
 
73
84
  <svelte:window on:keydown={handleKeydown} />
74
85
 
75
- {#if show}
86
+ {#if isVisible}
76
87
  <!-- svelte-ignore a11y-click-events-have-key-events -->
77
88
  <!-- svelte-ignore a11y-no-static-element-interactions -->
78
89
  <div
@@ -81,10 +92,11 @@
81
92
  transition:fade={{ duration: 150 }}
82
93
  >
83
94
  <div
95
+ {id}
84
96
  class="drawer drawer--{placement}"
85
97
  style="--drawer-width: {width}; --drawer-height: {height};"
86
98
  on:click|stopPropagation
87
- transition:fly={transitionParams}
99
+ transition:fly={computedTransitionParams}
88
100
  >
89
101
  <!-- Optional header with title -->
90
102
  {#if title || $$slots.header}
@@ -3,11 +3,14 @@ type Drawer = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
3
  duration?: number | undefined;
4
4
  title?: string | undefined;
5
5
  show?: boolean | undefined;
6
+ hidden?: boolean | undefined;
6
7
  placement?: "left" | "right" | "top" | "bottom" | undefined;
7
8
  width?: string | undefined;
8
9
  height?: string | undefined;
9
10
  closeOnBackdropClick?: boolean | undefined;
10
11
  closeOnEscape?: boolean | undefined;
12
+ id?: string | undefined;
13
+ transitionParams?: object | undefined;
11
14
  }, {
12
15
  header: {};
13
16
  default: {};
@@ -28,11 +31,14 @@ declare const Drawer: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWit
28
31
  duration?: number | undefined;
29
32
  title?: string | undefined;
30
33
  show?: boolean | undefined;
34
+ hidden?: boolean | undefined;
31
35
  placement?: "left" | "right" | "top" | "bottom" | undefined;
32
36
  width?: string | undefined;
33
37
  height?: string | undefined;
34
38
  closeOnBackdropClick?: boolean | undefined;
35
39
  closeOnEscape?: boolean | undefined;
40
+ id?: string | undefined;
41
+ transitionParams?: object | undefined;
36
42
  }, {
37
43
  header: {};
38
44
  default: {};
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Drawer/Drawer.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0IA;;;;;;;;;;;;;;;;;;;;;;eAAyN;sCATnL,KAAK,EAAE,KAAK;;;;;6CALL,KAAK,SAAS,MAAM,CAAC,MAAM,EA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O,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,129 @@
1
+ <script>
2
+ import { createEventDispatcher, onMount, onDestroy } from "svelte";
3
+
4
+ /** @type {boolean} Whether the dropdown is open */
5
+ export let open = false;
6
+ /** @type {string} Current active URL for highlighting (flowbite API) */
7
+ export let activeUrl = "";
8
+ /** @type {'bottom-start' | 'bottom-end' | 'bottom' | 'top-start' | 'top-end' | 'top'} Placement */
9
+ export let placement = "bottom-start";
10
+ /** @type {string} Additional CSS classes */
11
+ let className = "";
12
+ export { className as class };
13
+
14
+ const dispatch = createEventDispatcher();
15
+
16
+ let dropdownRef;
17
+
18
+ function handleClickOutside(event) {
19
+ if (dropdownRef && !dropdownRef.contains(event.target)) {
20
+ // Check if click was on the trigger button (previous sibling)
21
+ const parent = dropdownRef.parentElement;
22
+ if (parent) {
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
+ }
31
+ }
32
+ open = false;
33
+ }
34
+ }
35
+
36
+ function handleKeydown(event) {
37
+ if (event.key === "Escape" && open) {
38
+ open = false;
39
+ }
40
+ }
41
+
42
+ onMount(() => {
43
+ document.addEventListener("click", handleClickOutside, true);
44
+ document.addEventListener("keydown", handleKeydown);
45
+ });
46
+
47
+ onDestroy(() => {
48
+ if (typeof document !== "undefined") {
49
+ document.removeEventListener("click", handleClickOutside, true);
50
+ document.removeEventListener("keydown", handleKeydown);
51
+ }
52
+ });
53
+
54
+ // Provide context for DropdownItem
55
+ import { setContext } from "svelte";
56
+ setContext("dropdown", {
57
+ activeUrl,
58
+ close: () => { open = false; }
59
+ });
60
+ </script>
61
+
62
+ {#if open}
63
+ <div
64
+ bind:this={dropdownRef}
65
+ class="dropdown dropdown--{placement} {className}"
66
+ role="menu"
67
+ {...$$restProps}
68
+ >
69
+ <slot />
70
+ </div>
71
+ {/if}
72
+
73
+ <style>
74
+ .dropdown {
75
+ position: absolute;
76
+ z-index: 50;
77
+ min-width: 10rem;
78
+ background-color: hsl(var(--BG-Primary, 0 0% 100%));
79
+ border: 1px solid hsl(var(--Stroke-Primary, 220 13% 85%));
80
+ border-radius: 0.5rem;
81
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
82
+ padding: 0.25rem 0;
83
+ margin-top: 0.25rem;
84
+ }
85
+
86
+ .dropdown--bottom-start {
87
+ top: 100%;
88
+ left: 0;
89
+ }
90
+
91
+ .dropdown--bottom-end {
92
+ top: 100%;
93
+ right: 0;
94
+ }
95
+
96
+ .dropdown--bottom {
97
+ top: 100%;
98
+ left: 50%;
99
+ transform: translateX(-50%);
100
+ }
101
+
102
+ .dropdown--top-start {
103
+ bottom: 100%;
104
+ left: 0;
105
+ margin-top: 0;
106
+ margin-bottom: 0.25rem;
107
+ }
108
+
109
+ .dropdown--top-end {
110
+ bottom: 100%;
111
+ right: 0;
112
+ margin-top: 0;
113
+ margin-bottom: 0.25rem;
114
+ }
115
+
116
+ .dropdown--top {
117
+ bottom: 100%;
118
+ left: 50%;
119
+ transform: translateX(-50%);
120
+ margin-top: 0;
121
+ margin-bottom: 0.25rem;
122
+ }
123
+
124
+ /* Dark mode */
125
+ :global(.dark) .dropdown {
126
+ background-color: hsl(var(--BG-Primary, 220 13% 15%));
127
+ border-color: hsl(var(--Stroke-Primary, 220 13% 30%));
128
+ }
129
+ </style>
@@ -0,0 +1,48 @@
1
+ export default Dropdown;
2
+ type Dropdown = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
+ [x: string]: any;
4
+ class?: string | undefined;
5
+ open?: boolean | undefined;
6
+ placement?: "top" | "bottom" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | undefined;
7
+ activeUrl?: string | undefined;
8
+ }, {
9
+ default: {};
10
+ }>, {
11
+ [evt: string]: CustomEvent<any>;
12
+ }, {
13
+ default: {};
14
+ }> & {
15
+ $$bindings?: string | undefined;
16
+ };
17
+ declare const Dropdown: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
18
+ [x: string]: any;
19
+ class?: string | undefined;
20
+ open?: boolean | undefined;
21
+ placement?: "top" | "bottom" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | undefined;
22
+ activeUrl?: string | undefined;
23
+ }, {
24
+ default: {};
25
+ }>, {
26
+ [evt: string]: CustomEvent<any>;
27
+ }, {
28
+ default: {};
29
+ }, {}, string>;
30
+ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
31
+ default: any;
32
+ } ? Props extends Record<string, never> ? any : {
33
+ children?: any;
34
+ } : {});
35
+ 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> {
36
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
37
+ $$bindings?: Bindings;
38
+ } & Exports;
39
+ (internal: unknown, props: Props & {
40
+ $$events?: Events;
41
+ $$slots?: Slots;
42
+ }): Exports & {
43
+ $set?: any;
44
+ $on?: any;
45
+ };
46
+ z_$$bindings?: Bindings;
47
+ }
48
+ //# sourceMappingURL=Dropdown.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Dropdown/Dropdown.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgGA;;;;;;;;;;;;eAA6K;sCATvI,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,111 @@
1
+ <script>
2
+ import { getContext, createEventDispatcher } from "svelte";
3
+
4
+ /** @type {string|undefined} Optional href to make the item a link */
5
+ export let href = undefined;
6
+ /** @type {boolean} Whether the item is disabled */
7
+ export let disabled = false;
8
+ /** @type {string} Additional CSS classes */
9
+ let className = "";
10
+ export { className as class };
11
+
12
+ const dispatch = createEventDispatcher();
13
+ const context = getContext("dropdown");
14
+
15
+ $: isActive = context?.activeUrl && href && context.activeUrl === href;
16
+
17
+ function handleClick(event) {
18
+ if (disabled) {
19
+ event.preventDefault();
20
+ return;
21
+ }
22
+ dispatch("click", event);
23
+ // Close dropdown after click (unless it's a link that will navigate)
24
+ if (!href && context?.close) {
25
+ context.close();
26
+ }
27
+ }
28
+
29
+ function handleKeydown(event) {
30
+ if (event.key === "Enter" || event.key === " ") {
31
+ handleClick(event);
32
+ }
33
+ }
34
+ </script>
35
+
36
+ {#if href}
37
+ <a
38
+ {href}
39
+ class="dropdown-item {className}"
40
+ class:dropdown-item--active={isActive}
41
+ class:dropdown-item--disabled={disabled}
42
+ role="menuitem"
43
+ tabindex={disabled ? -1 : 0}
44
+ on:click={handleClick}
45
+ on:keydown={handleKeydown}
46
+ >
47
+ <slot />
48
+ </a>
49
+ {:else}
50
+ <button
51
+ type="button"
52
+ class="dropdown-item {className}"
53
+ class:dropdown-item--disabled={disabled}
54
+ role="menuitem"
55
+ tabindex={disabled ? -1 : 0}
56
+ {disabled}
57
+ on:click={handleClick}
58
+ on:keydown={handleKeydown}
59
+ >
60
+ <slot />
61
+ </button>
62
+ {/if}
63
+
64
+ <style>
65
+ .dropdown-item {
66
+ display: flex;
67
+ align-items: center;
68
+ width: 100%;
69
+ padding: 0.5rem 1rem;
70
+ font-size: 0.875rem;
71
+ color: hsl(var(--Text-Primary, 220 13% 13%));
72
+ background: transparent;
73
+ border: none;
74
+ text-align: left;
75
+ cursor: pointer;
76
+ text-decoration: none;
77
+ transition: background-color 0.15s ease;
78
+ }
79
+
80
+ .dropdown-item:hover:not(.dropdown-item--disabled) {
81
+ background-color: hsl(var(--BG-Secondary, 220 14% 96%));
82
+ }
83
+
84
+ .dropdown-item:focus {
85
+ outline: none;
86
+ background-color: hsl(var(--BG-Secondary, 220 14% 96%));
87
+ }
88
+
89
+ .dropdown-item--active {
90
+ background-color: hsl(var(--Brand-Primary, 221 83% 53%) / 0.1);
91
+ color: hsl(var(--Brand-Primary, 221 83% 53%));
92
+ }
93
+
94
+ .dropdown-item--disabled {
95
+ opacity: 0.5;
96
+ cursor: not-allowed;
97
+ }
98
+
99
+ /* Dark mode */
100
+ :global(.dark) .dropdown-item {
101
+ color: hsl(var(--Text-Primary, 0 0% 95%));
102
+ }
103
+
104
+ :global(.dark) .dropdown-item:hover:not(.dropdown-item--disabled) {
105
+ background-color: hsl(var(--BG-Secondary, 220 13% 20%));
106
+ }
107
+
108
+ :global(.dark) .dropdown-item:focus {
109
+ background-color: hsl(var(--BG-Secondary, 220 13% 20%));
110
+ }
111
+ </style>
@@ -0,0 +1,48 @@
1
+ export default DropdownItem;
2
+ type DropdownItem = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
+ class?: string | undefined;
4
+ disabled?: boolean | undefined;
5
+ href?: string | undefined;
6
+ }, {
7
+ default: {};
8
+ }>, {
9
+ click: CustomEvent<any>;
10
+ } & {
11
+ [evt: string]: CustomEvent<any>;
12
+ }, {
13
+ default: {};
14
+ }> & {
15
+ $$bindings?: string | undefined;
16
+ };
17
+ declare const DropdownItem: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
18
+ class?: string | undefined;
19
+ disabled?: boolean | undefined;
20
+ href?: string | undefined;
21
+ }, {
22
+ default: {};
23
+ }>, {
24
+ click: CustomEvent<any>;
25
+ } & {
26
+ [evt: string]: CustomEvent<any>;
27
+ }, {
28
+ default: {};
29
+ }, {}, string>;
30
+ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
31
+ default: any;
32
+ } ? Props extends Record<string, never> ? any : {
33
+ children?: any;
34
+ } : {});
35
+ 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> {
36
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
37
+ $$bindings?: Bindings;
38
+ } & Exports;
39
+ (internal: unknown, props: Props & {
40
+ $$events?: Events;
41
+ $$slots?: Slots;
42
+ }): Exports & {
43
+ $set?: any;
44
+ $on?: any;
45
+ };
46
+ z_$$bindings?: Bindings;
47
+ }
48
+ //# sourceMappingURL=DropdownItem.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownItem.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Dropdown/DropdownItem.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuEA;;;WAjBW,MAAM,GAAC,SAAS;;;;;;;;;eAiBgI;sCATrH,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"}
@@ -7,6 +7,7 @@ type Input = SvelteComponent<{
7
7
  value?: string | undefined;
8
8
  name?: string | undefined;
9
9
  label?: string | undefined;
10
+ id?: string | undefined;
10
11
  icon?: null | undefined;
11
12
  required?: boolean | undefined;
12
13
  optional?: boolean | undefined;
@@ -15,7 +16,6 @@ type Input = SvelteComponent<{
15
16
  maxlength?: null | undefined;
16
17
  minlength?: null | undefined;
17
18
  placeholder?: string | undefined;
18
- id?: string | undefined;
19
19
  textareaSize?: string | undefined;
20
20
  errorText?: string | undefined;
21
21
  helperText?: string | undefined;
@@ -55,6 +55,7 @@ declare const Input: $$__sveltets_2_IsomorphicComponent<{
55
55
  value?: string | undefined;
56
56
  name?: string | undefined;
57
57
  label?: string | undefined;
58
+ id?: string | undefined;
58
59
  icon?: null | undefined;
59
60
  required?: boolean | undefined;
60
61
  optional?: boolean | undefined;
@@ -63,7 +64,6 @@ declare const Input: $$__sveltets_2_IsomorphicComponent<{
63
64
  maxlength?: null | undefined;
64
65
  minlength?: null | undefined;
65
66
  placeholder?: string | undefined;
66
- id?: string | undefined;
67
67
  textareaSize?: string | undefined;
68
68
  errorText?: string | undefined;
69
69
  helperText?: string | undefined;
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { createEventDispatcher, onMount, onDestroy } from "svelte";
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
- onDestroy(() => {
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
+ id?: string | undefined;
8
9
  required?: boolean | undefined;
9
10
  placeholder?: string | undefined;
10
- id?: string | 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
+ id?: string | undefined;
27
28
  required?: boolean | undefined;
28
29
  placeholder?: string | undefined;
29
- id?: string | 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":";;;;;;;;;;;;;;;;;;;;AAuNA;;;;;;;;;;;;;;;;mBAAqO;6CATxL,KAAK,SAAS,MAAM,CAAC,MAAM,EAA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