@juspay/svelte-ui-components 2.9.0 → 2.11.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 (189) hide show
  1. package/README.md +337 -77
  2. package/dist/Accordion/Accordion.svelte +4 -2
  3. package/dist/Accordion/Accordion.svelte.d.ts +2 -4
  4. package/dist/Accordion/properties.d.ts +6 -0
  5. package/dist/Accordion/properties.js +1 -0
  6. package/dist/Animations/ModalAnimation.svelte +11 -9
  7. package/dist/Avatar/Avatar.svelte +122 -0
  8. package/dist/Avatar/Avatar.svelte.d.ts +4 -0
  9. package/dist/Avatar/properties.d.ts +15 -0
  10. package/dist/Avatar/properties.js +1 -0
  11. package/dist/Badge/Badge.svelte +2 -2
  12. package/dist/Badge/properties.d.ts +1 -0
  13. package/dist/Banner/Banner.svelte +132 -48
  14. package/dist/Banner/Banner.svelte.d.ts +1 -1
  15. package/dist/Banner/properties.d.ts +8 -3
  16. package/dist/Book/Book.svelte +281 -0
  17. package/dist/Book/Book.svelte.d.ts +4 -0
  18. package/dist/Book/properties.d.ts +24 -0
  19. package/dist/Book/properties.js +1 -0
  20. package/dist/BrandLoader/BrandLoader.svelte +3 -3
  21. package/dist/BrandLoader/properties.d.ts +1 -0
  22. package/dist/Browser/Browser.svelte +193 -0
  23. package/dist/Browser/Browser.svelte.d.ts +3 -0
  24. package/dist/Browser/properties.d.ts +16 -0
  25. package/dist/Browser/properties.js +1 -0
  26. package/dist/Button/Button.svelte +20 -7
  27. package/dist/Button/properties.d.ts +7 -4
  28. package/dist/Calendar/Calendar.svelte +476 -0
  29. package/dist/Calendar/Calendar.svelte.d.ts +4 -0
  30. package/dist/Calendar/properties.d.ts +30 -0
  31. package/dist/Calendar/properties.js +1 -0
  32. package/dist/Carousel/Carousel.svelte +19 -16
  33. package/dist/Carousel/properties.d.ts +1 -0
  34. package/dist/CheckListItem/CheckListItem.svelte +31 -26
  35. package/dist/CheckListItem/properties.d.ts +4 -1
  36. package/dist/Checkbox/Checkbox.svelte +157 -0
  37. package/dist/Checkbox/Checkbox.svelte.d.ts +4 -0
  38. package/dist/Checkbox/properties.d.ts +17 -0
  39. package/dist/Checkbox/properties.js +1 -0
  40. package/dist/Choicebox/Choicebox.svelte +85 -0
  41. package/dist/Choicebox/Choicebox.svelte.d.ts +4 -0
  42. package/dist/Choicebox/properties.d.ts +14 -0
  43. package/dist/Choicebox/properties.js +1 -0
  44. package/dist/CommandMenu/CommandMenu.svelte +452 -0
  45. package/dist/CommandMenu/CommandMenu.svelte.d.ts +4 -0
  46. package/dist/CommandMenu/properties.d.ts +26 -0
  47. package/dist/CommandMenu/properties.js +1 -0
  48. package/dist/ContextMenu/ContextMenu.svelte +308 -0
  49. package/dist/ContextMenu/ContextMenu.svelte.d.ts +4 -0
  50. package/dist/ContextMenu/properties.d.ts +26 -0
  51. package/dist/ContextMenu/properties.js +1 -0
  52. package/dist/Gauge/Gauge.svelte +70 -0
  53. package/dist/Gauge/Gauge.svelte.d.ts +4 -0
  54. package/dist/Gauge/properties.d.ts +9 -0
  55. package/dist/Gauge/properties.js +1 -0
  56. package/dist/GridItem/GridItem.svelte +5 -4
  57. package/dist/GridItem/properties.d.ts +1 -0
  58. package/dist/Icon/Icon.svelte +3 -3
  59. package/dist/Icon/properties.d.ts +1 -0
  60. package/dist/IconStack/IconStack.svelte +3 -3
  61. package/dist/IconStack/properties.d.ts +1 -0
  62. package/dist/Img/Img.svelte +5 -3
  63. package/dist/Img/properties.d.ts +5 -1
  64. package/dist/Input/Input.svelte +12 -6
  65. package/dist/Input/properties.d.ts +1 -0
  66. package/dist/InputButton/InputButton.svelte +4 -3
  67. package/dist/InputButton/properties.d.ts +5 -6
  68. package/dist/KeyboardInput/KeyboardInput.svelte +93 -0
  69. package/dist/KeyboardInput/KeyboardInput.svelte.d.ts +4 -0
  70. package/dist/KeyboardInput/properties.d.ts +12 -0
  71. package/dist/KeyboardInput/properties.js +1 -0
  72. package/dist/ListItem/ListItem.svelte +31 -28
  73. package/dist/ListItem/properties.d.ts +1 -0
  74. package/dist/Loader/Loader.svelte +10 -6
  75. package/dist/Loader/Loader.svelte.d.ts +3 -25
  76. package/dist/Loader/properties.d.ts +3 -0
  77. package/dist/Loader/properties.js +1 -0
  78. package/dist/LoadingDots/LoadingDots.svelte +64 -0
  79. package/dist/LoadingDots/LoadingDots.svelte.d.ts +3 -0
  80. package/dist/LoadingDots/properties.d.ts +8 -0
  81. package/dist/LoadingDots/properties.js +1 -0
  82. package/dist/Menu/Menu.svelte +349 -0
  83. package/dist/Menu/Menu.svelte.d.ts +4 -0
  84. package/dist/Menu/properties.d.ts +24 -0
  85. package/dist/Menu/properties.js +1 -0
  86. package/dist/Modal/Modal.svelte +10 -9
  87. package/dist/Modal/properties.d.ts +1 -0
  88. package/dist/Pagination/Pagination.svelte +152 -0
  89. package/dist/Pagination/Pagination.svelte.d.ts +4 -0
  90. package/dist/Pagination/properties.d.ts +14 -0
  91. package/dist/Pagination/properties.js +1 -0
  92. package/dist/Phone/Phone.svelte +234 -0
  93. package/dist/Phone/Phone.svelte.d.ts +3 -0
  94. package/dist/Phone/properties.d.ts +11 -0
  95. package/dist/Phone/properties.js +1 -0
  96. package/dist/Pill/Pill.svelte +130 -0
  97. package/dist/Pill/Pill.svelte.d.ts +4 -0
  98. package/dist/Pill/properties.d.ts +16 -0
  99. package/dist/Pill/properties.js +1 -0
  100. package/dist/Progress/Progress.svelte +68 -0
  101. package/dist/Progress/Progress.svelte.d.ts +4 -0
  102. package/dist/Progress/properties.d.ts +10 -0
  103. package/dist/Progress/properties.js +1 -0
  104. package/dist/Radio/Radio.svelte +128 -0
  105. package/dist/Radio/Radio.svelte.d.ts +4 -0
  106. package/dist/Radio/properties.d.ts +15 -0
  107. package/dist/Radio/properties.js +1 -0
  108. package/dist/RelativeTime/RelativeTime.svelte +117 -0
  109. package/dist/RelativeTime/RelativeTime.svelte.d.ts +4 -0
  110. package/dist/RelativeTime/properties.d.ts +13 -0
  111. package/dist/RelativeTime/properties.js +1 -0
  112. package/dist/Scroller/Scroller.svelte +389 -0
  113. package/dist/Scroller/Scroller.svelte.d.ts +4 -0
  114. package/dist/Scroller/properties.d.ts +30 -0
  115. package/dist/Scroller/properties.js +1 -0
  116. package/dist/Select/Select.svelte +382 -344
  117. package/dist/Select/Select.svelte.d.ts +1 -1
  118. package/dist/Select/properties.d.ts +16 -26
  119. package/dist/Sheet/Sheet.svelte +264 -0
  120. package/dist/Sheet/Sheet.svelte.d.ts +4 -0
  121. package/dist/Sheet/properties.d.ts +19 -0
  122. package/dist/Sheet/properties.js +1 -0
  123. package/dist/Shimmer/Shimmer.svelte +44 -0
  124. package/dist/Shimmer/Shimmer.svelte.d.ts +4 -0
  125. package/dist/Shimmer/properties.d.ts +4 -0
  126. package/dist/Shimmer/properties.js +1 -0
  127. package/dist/Slider/Slider.svelte +144 -0
  128. package/dist/Slider/Slider.svelte.d.ts +4 -0
  129. package/dist/Slider/properties.d.ts +17 -0
  130. package/dist/Slider/properties.js +1 -0
  131. package/dist/Snippet/Snippet.svelte +123 -0
  132. package/dist/Snippet/Snippet.svelte.d.ts +4 -0
  133. package/dist/Snippet/properties.d.ts +15 -0
  134. package/dist/Snippet/properties.js +1 -0
  135. package/dist/SplitButton/SplitButton.svelte +135 -0
  136. package/dist/SplitButton/SplitButton.svelte.d.ts +4 -0
  137. package/dist/SplitButton/properties.d.ts +17 -0
  138. package/dist/SplitButton/properties.js +1 -0
  139. package/dist/Status/Status.svelte +5 -3
  140. package/dist/Status/properties.d.ts +1 -0
  141. package/dist/Stepper/Step.svelte +3 -3
  142. package/dist/Stepper/Stepper.svelte +3 -3
  143. package/dist/Stepper/properties.d.ts +2 -0
  144. package/dist/Table/Table.svelte +15 -8
  145. package/dist/Table/properties.d.ts +1 -0
  146. package/dist/Tabs/Tabs.svelte +240 -0
  147. package/dist/Tabs/Tabs.svelte.d.ts +4 -0
  148. package/dist/Tabs/properties.d.ts +16 -0
  149. package/dist/Tabs/properties.js +1 -0
  150. package/dist/ThemeSwitcher/ThemeSwitcher.svelte +249 -0
  151. package/dist/ThemeSwitcher/ThemeSwitcher.svelte.d.ts +4 -0
  152. package/dist/ThemeSwitcher/properties.d.ts +19 -0
  153. package/dist/ThemeSwitcher/properties.js +1 -0
  154. package/dist/Toast/Toast.svelte +25 -30
  155. package/dist/Toast/properties.d.ts +1 -0
  156. package/dist/Toggle/Toggle.svelte +2 -2
  157. package/dist/Toggle/properties.d.ts +1 -0
  158. package/dist/Toolbar/Toolbar.svelte +8 -7
  159. package/dist/Toolbar/properties.d.ts +1 -0
  160. package/dist/Tooltip/Tooltip.svelte +153 -0
  161. package/dist/Tooltip/Tooltip.svelte.d.ts +4 -0
  162. package/dist/Tooltip/properties.d.ts +13 -0
  163. package/dist/Tooltip/properties.js +1 -0
  164. package/dist/assets/battery.svg +5 -0
  165. package/dist/assets/checkmark.svg +3 -0
  166. package/dist/assets/chevron-down-sm.svg +3 -0
  167. package/dist/assets/chevron-down.svg +3 -0
  168. package/dist/assets/chevron-left-lg.svg +3 -0
  169. package/dist/assets/chevron-left.svg +3 -0
  170. package/dist/assets/chevron-right-lg.svg +3 -0
  171. package/dist/assets/chevron-right.svg +3 -0
  172. package/dist/assets/chevron-up.svg +3 -0
  173. package/dist/assets/close.svg +4 -0
  174. package/dist/assets/copy.svg +4 -0
  175. package/dist/assets/error-circle.svg +5 -0
  176. package/dist/assets/lock.svg +3 -0
  177. package/dist/assets/minus.svg +3 -0
  178. package/dist/assets/monitor.svg +5 -0
  179. package/dist/assets/moon.svg +3 -0
  180. package/dist/assets/palette.svg +7 -0
  181. package/dist/assets/search.svg +4 -0
  182. package/dist/assets/signal.svg +6 -0
  183. package/dist/assets/sun.svg +11 -0
  184. package/dist/assets/wifi.svg +3 -0
  185. package/dist/index.d.ts +55 -0
  186. package/dist/index.js +27 -0
  187. package/dist/utils.d.ts +2 -0
  188. package/dist/utils.js +18 -4
  189. package/package.json +26 -1
@@ -0,0 +1,452 @@
1
+ <script lang="ts">
2
+ import type { CommandMenuProperties, CommandItem } from './properties';
3
+ import { tick, onMount, onDestroy } from 'svelte';
4
+ import { SvelteMap } from 'svelte/reactivity';
5
+ import Img from '../Img/Img.svelte';
6
+ import searchSvg from '../assets/search.svg?raw';
7
+
8
+ let {
9
+ items,
10
+ open = $bindable(false),
11
+ placeholder = 'Search commands...',
12
+ emptyText = 'No results found.',
13
+ testId,
14
+ itemIcon,
15
+ searchIcon,
16
+ onselect,
17
+ onclose,
18
+ classes
19
+ }: CommandMenuProperties = $props();
20
+
21
+ let query = $state('');
22
+ let activeIndex = $state(0);
23
+ let inputElement: HTMLInputElement | null = $state(null);
24
+ let listElement: HTMLDivElement | null = $state(null);
25
+
26
+ let filteredItems = $derived.by(() => {
27
+ if (query.trim() === '') {
28
+ return items;
29
+ }
30
+ const lower = query.toLowerCase();
31
+ return items.filter((item) => item.label.toLowerCase().includes(lower));
32
+ });
33
+
34
+ let groupedItems = $derived.by(() => {
35
+ const groups = new SvelteMap<string, CommandItem[]>();
36
+ for (const item of filteredItems) {
37
+ const group = item.group ?? '';
38
+ if (!groups.has(group)) {
39
+ groups.set(group, []);
40
+ }
41
+ const groupList = groups.get(group);
42
+ if (Array.isArray(groupList)) {
43
+ groupList.push(item);
44
+ }
45
+ }
46
+ return groups;
47
+ });
48
+
49
+ let flatItems = $derived.by(() => {
50
+ const result: CommandItem[] = [];
51
+ for (const [, groupItems] of groupedItems) {
52
+ for (const item of groupItems) {
53
+ result.push(item);
54
+ }
55
+ }
56
+ return result;
57
+ });
58
+
59
+ let flatIndexLookup = $derived.by(() => {
60
+ const map = new SvelteMap<string, number>();
61
+ for (let i = 0; i < flatItems.length; i++) {
62
+ const item = flatItems.at(i);
63
+ if (typeof item === 'object') {
64
+ map.set(item.value, i);
65
+ }
66
+ }
67
+ return map;
68
+ });
69
+
70
+ function close() {
71
+ open = false;
72
+ query = '';
73
+ activeIndex = 0;
74
+ onclose?.();
75
+ }
76
+
77
+ function selectItem(item: CommandItem) {
78
+ if (item.disabled) {
79
+ return;
80
+ }
81
+ onselect?.(item);
82
+ close();
83
+ }
84
+
85
+ function findNextActive(from: number, delta: 1 | -1): number {
86
+ let candidate = from + delta;
87
+ while (candidate >= 0 && candidate < flatItems.length) {
88
+ const item = flatItems.at(candidate);
89
+ if (typeof item === 'object' && !item.disabled) {
90
+ return candidate;
91
+ }
92
+ candidate += delta;
93
+ }
94
+ return -1;
95
+ }
96
+
97
+ function handleKeyDown(event: KeyboardEvent) {
98
+ if (!open) {
99
+ return;
100
+ }
101
+
102
+ switch (event.key) {
103
+ case 'ArrowDown': {
104
+ event.preventDefault();
105
+ const next = findNextActive(activeIndex, 1);
106
+ if (next >= 0) {
107
+ activeIndex = next;
108
+ scrollActiveIntoView();
109
+ }
110
+ break;
111
+ }
112
+ case 'ArrowUp': {
113
+ event.preventDefault();
114
+ const prev = findNextActive(activeIndex, -1);
115
+ if (prev >= 0) {
116
+ activeIndex = prev;
117
+ scrollActiveIntoView();
118
+ }
119
+ break;
120
+ }
121
+ case 'Enter': {
122
+ event.preventDefault();
123
+ const item = flatItems.at(activeIndex);
124
+ if (typeof item === 'object' && !item.disabled) {
125
+ selectItem(item);
126
+ }
127
+ break;
128
+ }
129
+ case 'Escape': {
130
+ event.preventDefault();
131
+ close();
132
+ break;
133
+ }
134
+ }
135
+ }
136
+
137
+ async function scrollActiveIntoView() {
138
+ await tick();
139
+ if (listElement !== null) {
140
+ const activeEl = listElement.querySelector('[data-active="true"]');
141
+ if (activeEl !== null) {
142
+ activeEl.scrollIntoView({ block: 'nearest' });
143
+ }
144
+ }
145
+ }
146
+
147
+ function handleOverlayClick(event: MouseEvent) {
148
+ if (event.target === event.currentTarget) {
149
+ close();
150
+ }
151
+ }
152
+
153
+ function handleGlobalKeyDown(event: KeyboardEvent) {
154
+ if ((event.metaKey || event.ctrlKey) && event.key === 'k') {
155
+ event.preventDefault();
156
+ if (open) {
157
+ close();
158
+ } else {
159
+ open = true;
160
+ }
161
+ }
162
+ }
163
+
164
+ function scrollLockAction(_node: HTMLElement) {
165
+ document.body.style.overflow = 'hidden';
166
+ tick().then(() => {
167
+ if (inputElement !== null) {
168
+ inputElement.focus();
169
+ }
170
+ });
171
+ return {
172
+ destroy() {
173
+ document.body.style.overflow = '';
174
+ }
175
+ };
176
+ }
177
+
178
+ onMount(() => {
179
+ window.addEventListener('keydown', handleGlobalKeyDown);
180
+ });
181
+
182
+ onDestroy(() => {
183
+ if (typeof window !== 'undefined') {
184
+ document.body.style.overflow = '';
185
+ window.removeEventListener('keydown', handleGlobalKeyDown);
186
+ }
187
+ });
188
+ </script>
189
+
190
+ {#if open}
191
+ <div
192
+ class="command-menu-overlay {classes ?? ''}"
193
+ use:scrollLockAction
194
+ onclick={handleOverlayClick}
195
+ onkeydown={handleKeyDown}
196
+ role="dialog"
197
+ aria-modal="true"
198
+ aria-label="Command menu"
199
+ tabindex="-1"
200
+ data-pw={typeof testId === 'string' ? testId : null}
201
+ >
202
+ <div class="command-menu-dialog">
203
+ <div class="command-menu-input-wrapper">
204
+ {#if typeof searchIcon === 'function'}
205
+ {@render searchIcon()}
206
+ {:else}
207
+ <!-- eslint-disable svelte/no-at-html-tags -->
208
+ <span class="command-menu-search-icon">{@html searchSvg}</span>
209
+ {/if}
210
+ <input
211
+ bind:this={inputElement}
212
+ bind:value={query}
213
+ oninput={() => {
214
+ activeIndex = 0;
215
+ }}
216
+ type="text"
217
+ class="command-menu-input"
218
+ {placeholder}
219
+ autocomplete="off"
220
+ spellcheck="false"
221
+ data-pw={typeof testId === 'string' ? `${testId}-input` : null}
222
+ />
223
+ </div>
224
+
225
+ <div class="command-menu-separator"></div>
226
+
227
+ <div class="command-menu-list" bind:this={listElement} role="listbox">
228
+ {#if flatItems.length === 0}
229
+ <div class="command-menu-empty">
230
+ {emptyText}
231
+ </div>
232
+ {:else}
233
+ {#each groupedItems as [group, groupItems] (group)}
234
+ {#if group !== ''}
235
+ <div class="command-menu-group-heading">{group}</div>
236
+ {/if}
237
+ {#each groupItems as item (item.value)}
238
+ {@const index = flatIndexLookup.get(item.value) ?? -1}
239
+ <button
240
+ type="button"
241
+ class="command-menu-item"
242
+ class:active={index === activeIndex}
243
+ class:disabled={item.disabled}
244
+ data-active={index === activeIndex}
245
+ onclick={() => selectItem(item)}
246
+ onmouseenter={() => {
247
+ if (!item.disabled) {
248
+ activeIndex = index;
249
+ }
250
+ }}
251
+ role="option"
252
+ aria-selected={index === activeIndex}
253
+ aria-disabled={item.disabled}
254
+ tabindex="-1"
255
+ data-pw={typeof testId === 'string' ? `${testId}-item-${item.value}` : null}
256
+ >
257
+ {#if typeof itemIcon === 'function'}
258
+ <span class="command-menu-item-icon">
259
+ {@render itemIcon(item)}
260
+ </span>
261
+ {:else if typeof item.icon === 'string' && item.icon.length > 0}
262
+ <div class="command-menu-item-icon-img-wrapper">
263
+ <Img src={item.icon} alt="" />
264
+ </div>
265
+ {/if}
266
+ <span class="command-menu-item-label">{item.label}</span>
267
+ {#if typeof item.shortcut === 'string' && item.shortcut.length > 0}
268
+ <span class="command-menu-item-shortcut">
269
+ {#each item.shortcut.split('+') as key, i (i)}
270
+ <kbd class="command-menu-kbd">{key.trim()}</kbd>
271
+ {/each}
272
+ </span>
273
+ {/if}
274
+ </button>
275
+ {/each}
276
+ {/each}
277
+ {/if}
278
+ </div>
279
+ </div>
280
+ </div>
281
+ {/if}
282
+
283
+ <style>
284
+ .command-menu-overlay {
285
+ position: fixed;
286
+ top: 0;
287
+ left: 0;
288
+ right: 0;
289
+ bottom: 0;
290
+ background-color: var(--command-menu-overlay-background, rgba(0, 0, 0, 0.5));
291
+ display: flex;
292
+ align-items: var(--command-menu-overlay-align, flex-start);
293
+ justify-content: center;
294
+ padding-top: var(--command-menu-overlay-padding-top, 20vh);
295
+ z-index: var(--command-menu-z-index, 50);
296
+ -webkit-tap-highlight-color: transparent;
297
+ }
298
+
299
+ .command-menu-dialog {
300
+ background-color: var(--command-menu-background, #ffffff);
301
+ border-radius: var(--command-menu-border-radius, 12px);
302
+ box-shadow: var(--command-menu-box-shadow, 0 16px 70px rgba(0, 0, 0, 0.2));
303
+ width: var(--command-menu-width, 560px);
304
+ max-width: var(--command-menu-max-width, 90vw);
305
+ max-height: var(--command-menu-max-height, 60vh);
306
+ display: flex;
307
+ flex-direction: column;
308
+ overflow: hidden;
309
+ border: var(--command-menu-border, 1px solid #e2e8f0);
310
+ }
311
+
312
+ .command-menu-input-wrapper {
313
+ display: flex;
314
+ align-items: center;
315
+ padding: var(--command-menu-input-wrapper-padding, 12px 16px);
316
+ gap: var(--command-menu-input-wrapper-gap, 10px);
317
+ }
318
+
319
+ .command-menu-search-icon {
320
+ display: inline-flex;
321
+ align-items: center;
322
+ justify-content: center;
323
+ width: var(--command-menu-search-icon-size, 20px);
324
+ height: var(--command-menu-search-icon-size, 20px);
325
+ color: var(--command-menu-search-icon-color, #94a3b8);
326
+ flex-shrink: 0;
327
+ }
328
+
329
+ .command-menu-search-icon :global(svg) {
330
+ width: 100%;
331
+ height: 100%;
332
+ }
333
+
334
+ .command-menu-input {
335
+ flex: 1;
336
+ border: none;
337
+ outline: none;
338
+ background: transparent;
339
+ font-size: var(--command-menu-input-font-size, 16px);
340
+ font-family: var(--command-menu-input-font-family, inherit);
341
+ font-weight: var(--command-menu-input-font-weight, 400);
342
+ color: var(--command-menu-input-color, #1e293b);
343
+ caret-color: var(--command-menu-input-caret-color, #3b82f6);
344
+ }
345
+
346
+ .command-menu-input::placeholder {
347
+ color: var(--command-menu-input-placeholder-color, #94a3b8);
348
+ }
349
+
350
+ .command-menu-separator {
351
+ height: var(--command-menu-separator-height, 1px);
352
+ background-color: var(--command-menu-separator-color, #e2e8f0);
353
+ flex-shrink: 0;
354
+ }
355
+
356
+ .command-menu-list {
357
+ overflow-y: auto;
358
+ padding: var(--command-menu-list-padding, 8px);
359
+ scrollbar-width: var(--command-menu-scrollbar-width, thin);
360
+ }
361
+
362
+ .command-menu-empty {
363
+ padding: var(--command-menu-empty-padding, 32px 16px);
364
+ text-align: center;
365
+ color: var(--command-menu-empty-color, #94a3b8);
366
+ font-size: var(--command-menu-empty-font-size, 14px);
367
+ font-style: var(--command-menu-empty-font-style, normal);
368
+ }
369
+
370
+ .command-menu-group-heading {
371
+ padding: var(--command-menu-group-heading-padding, 8px 12px 4px);
372
+ font-size: var(--command-menu-group-heading-font-size, 12px);
373
+ font-weight: var(--command-menu-group-heading-font-weight, 600);
374
+ color: var(--command-menu-group-heading-color, #94a3b8);
375
+ text-transform: var(--command-menu-group-heading-text-transform, uppercase);
376
+ letter-spacing: var(--command-menu-group-heading-letter-spacing, 0.05em);
377
+ }
378
+
379
+ .command-menu-item {
380
+ display: flex;
381
+ align-items: center;
382
+ padding: var(--command-menu-item-padding, 10px 12px);
383
+ border-radius: var(--command-menu-item-border-radius, 8px);
384
+ cursor: pointer;
385
+ gap: var(--command-menu-item-gap, 10px);
386
+ font-size: var(--command-menu-item-font-size, 14px);
387
+ color: var(--command-menu-item-color, #334155);
388
+ transition: background-color 0.1s;
389
+ background: none;
390
+ border: none;
391
+ width: 100%;
392
+ text-align: left;
393
+ font-family: inherit;
394
+ }
395
+
396
+ .command-menu-item.active {
397
+ background-color: var(--command-menu-item-active-background, #f1f5f9);
398
+ color: var(--command-menu-item-active-color, #0f172a);
399
+ }
400
+
401
+ .command-menu-item.disabled {
402
+ opacity: var(--command-menu-item-disabled-opacity, 0.4);
403
+ cursor: not-allowed;
404
+ }
405
+
406
+ .command-menu-item-icon {
407
+ display: flex;
408
+ align-items: center;
409
+ justify-content: center;
410
+ flex-shrink: 0;
411
+ }
412
+
413
+ .command-menu-item-icon-img-wrapper {
414
+ --image-width: var(--command-menu-item-icon-size, 20px);
415
+ --image-height: var(--command-menu-item-icon-size, 20px);
416
+ flex-shrink: 0;
417
+ display: flex;
418
+ align-items: center;
419
+ justify-content: center;
420
+ }
421
+
422
+ .command-menu-item-label {
423
+ flex: 1;
424
+ overflow: hidden;
425
+ text-overflow: ellipsis;
426
+ white-space: nowrap;
427
+ }
428
+
429
+ .command-menu-item-shortcut {
430
+ display: flex;
431
+ align-items: center;
432
+ gap: var(--command-menu-shortcut-gap, 4px);
433
+ flex-shrink: 0;
434
+ }
435
+
436
+ .command-menu-kbd {
437
+ display: inline-flex;
438
+ align-items: center;
439
+ justify-content: center;
440
+ min-width: var(--command-menu-kbd-min-width, 24px);
441
+ height: var(--command-menu-kbd-height, 22px);
442
+ padding: var(--command-menu-kbd-padding, 0 6px);
443
+ border-radius: var(--command-menu-kbd-border-radius, 4px);
444
+ background-color: var(--command-menu-kbd-background, #f1f5f9);
445
+ border: var(--command-menu-kbd-border, 1px solid #e2e8f0);
446
+ color: var(--command-menu-kbd-color, #64748b);
447
+ font-size: var(--command-menu-kbd-font-size, 11px);
448
+ font-family: var(--command-menu-kbd-font-family, inherit);
449
+ font-weight: var(--command-menu-kbd-font-weight, 500);
450
+ box-shadow: var(--command-menu-kbd-box-shadow, 0 1px 0 #e2e8f0);
451
+ }
452
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { CommandMenuProperties } from './properties';
2
+ declare const CommandMenu: import("svelte").Component<CommandMenuProperties, {}, "open">;
3
+ type CommandMenu = ReturnType<typeof CommandMenu>;
4
+ export default CommandMenu;
@@ -0,0 +1,26 @@
1
+ import type { Snippet } from 'svelte';
2
+ export type CommandItem = {
3
+ label: string;
4
+ value: string;
5
+ group?: string;
6
+ icon?: string;
7
+ shortcut?: string;
8
+ disabled?: boolean;
9
+ };
10
+ export type CommandMenuProperties = MandatoryCommandMenuProperties & OptionalCommandMenuProperties & CommandMenuEventProperties;
11
+ export type MandatoryCommandMenuProperties = {
12
+ items: CommandItem[];
13
+ };
14
+ export type OptionalCommandMenuProperties = {
15
+ open?: boolean;
16
+ placeholder?: string;
17
+ emptyText?: string;
18
+ testId?: string;
19
+ itemIcon?: Snippet<[CommandItem]>;
20
+ searchIcon?: Snippet;
21
+ classes?: string;
22
+ };
23
+ export type CommandMenuEventProperties = {
24
+ onselect?: (item: CommandItem) => void;
25
+ onclose?: () => void;
26
+ };
@@ -0,0 +1 @@
1
+ export {};