@juspay/svelte-ui-components 4.9.2 → 4.10.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.
@@ -19,10 +19,19 @@
19
19
  classes
20
20
  }: CommandMenuProperties = $props();
21
21
 
22
+ // Stable per-instance ids keep ARIA references distinct across menus.
23
+ const uid = $props.id();
24
+ const listboxId = `command-menu-listbox-${uid}`;
25
+
22
26
  let query = $state('');
23
27
  let activeIndex = $state(0);
24
28
  let inputElement: HTMLInputElement | null = $state(null);
25
29
  let listElement: HTMLDivElement | null = $state(null);
30
+ let dialogElement: HTMLDivElement | null = $state(null);
31
+ // Captured when the dialog opens, consumed once it unmounts — mirrors
32
+ // Gallery.svelte's lightboxAction so focus returns to whatever opened the
33
+ // command menu instead of falling back to <body>.
34
+ let openerElement: HTMLElement | null = null;
26
35
 
27
36
  let filteredItems = $derived.by(() => {
28
37
  if (query.trim() === '') {
@@ -68,6 +77,13 @@
68
77
  return map;
69
78
  });
70
79
 
80
+ // aria-activedescendant must point at the id of the highlighted option, which
81
+ // is keyed by its flat index (see the option's own id below) — null once the
82
+ // list is empty, since there is then no option to describe.
83
+ let activeDescendantId = $derived(
84
+ flatItems.length > 0 ? `command-menu-option-${uid}-${activeIndex}` : null
85
+ );
86
+
71
87
  function close() {
72
88
  open = false;
73
89
  query = '';
@@ -132,9 +148,47 @@
132
148
  close();
133
149
  break;
134
150
  }
151
+ case 'Tab': {
152
+ // aria-modal="true" promises focus stays inside, so Tab cycles rather
153
+ // than escaping. Cycle over whatever is actually tabbable instead of
154
+ // pinning to the input: today the input is the only tab stop (options
155
+ // are tabindex="-1" and are reached with arrows), so the two are
156
+ // equivalent — but pinning would silently break the moment the dialog
157
+ // gains a second tab stop, such as a close button.
158
+ const tabbable = tabbableElements();
159
+ if (tabbable.length === 0) {
160
+ break;
161
+ }
162
+ event.preventDefault();
163
+ const active = document.activeElement;
164
+ const current = active instanceof HTMLElement ? tabbable.indexOf(active) : -1;
165
+ const step = event.shiftKey ? -1 : 1;
166
+ const next = (current + step + tabbable.length) % tabbable.length;
167
+ tabbable.at(next)?.focus();
168
+ break;
169
+ }
135
170
  }
136
171
  }
137
172
 
173
+ // Everything inside the dialog that Tab would normally reach. `tabindex="-1"`
174
+ // is excluded because those are arrow-key targets, not tab stops.
175
+ function tabbableElements(): HTMLElement[] {
176
+ if (dialogElement === null) {
177
+ return [];
178
+ }
179
+ const candidates = dialogElement.querySelectorAll<HTMLElement>(
180
+ 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]'
181
+ );
182
+ return [...candidates].filter(
183
+ (el) =>
184
+ // The options are real <button>s held out of the tab order with
185
+ // tabindex="-1"; they are arrow-key targets. Excluding -1 only in the
186
+ // `[tabindex]` selector would still match them as buttons.
187
+ el.getAttribute('tabindex') !== '-1' &&
188
+ (el.offsetParent !== null || el === document.activeElement)
189
+ );
190
+ }
191
+
138
192
  async function scrollActiveIntoView() {
139
193
  await tick();
140
194
  if (listElement !== null) {
@@ -167,6 +221,9 @@
167
221
  // onDestroy below must NOT unlock as well: with a shared reference count a second
168
222
  // decrement would release a lock another open surface still needs.
169
223
  function scrollLockAction(_node: HTMLElement) {
224
+ if (openerElement === null && document.activeElement instanceof HTMLElement) {
225
+ openerElement = document.activeElement;
226
+ }
170
227
  lockBodyScroll();
171
228
  tick().then(() => {
172
229
  if (inputElement !== null) {
@@ -176,6 +233,10 @@
176
233
  return {
177
234
  destroy() {
178
235
  unlockBodyScroll();
236
+ if (openerElement !== null) {
237
+ openerElement.focus();
238
+ openerElement = null;
239
+ }
179
240
  }
180
241
  };
181
242
  }
@@ -204,7 +265,7 @@
204
265
  data-pw={typeof testId === 'string' ? testId : null}
205
266
  testID={typeof testId === 'string' ? testId : null}
206
267
  >
207
- <div class="command-menu-dialog">
268
+ <div class="command-menu-dialog" bind:this={dialogElement}>
208
269
  <div class="command-menu-input-wrapper">
209
270
  {#if typeof searchIcon === 'function'}
210
271
  {@render searchIcon()}
@@ -223,6 +284,11 @@
223
284
  {placeholder}
224
285
  autocomplete="off"
225
286
  spellcheck="false"
287
+ role="combobox"
288
+ aria-expanded={flatItems.length > 0}
289
+ aria-controls={listboxId}
290
+ aria-autocomplete="list"
291
+ aria-activedescendant={activeDescendantId}
226
292
  data-pw={typeof testId === 'string' ? `${testId}-input` : null}
227
293
  testID={typeof testId === 'string' ? `${testId}-input` : null}
228
294
  />
@@ -230,7 +296,7 @@
230
296
 
231
297
  <div class="command-menu-separator"></div>
232
298
 
233
- <div class="command-menu-list" bind:this={listElement} role="listbox">
299
+ <div class="command-menu-list" bind:this={listElement} id={listboxId} role="listbox">
234
300
  {#if flatItems.length === 0}
235
301
  <div class="command-menu-empty">
236
302
  {emptyText}
@@ -244,6 +310,7 @@
244
310
  {@const index = flatIndexLookup.get(item.value) ?? -1}
245
311
  <button
246
312
  type="button"
313
+ id={`command-menu-option-${uid}-${index}`}
247
314
  class="command-menu-item"
248
315
  class:active={index === activeIndex}
249
316
  class:disabled={item.disabled}
@@ -19,27 +19,66 @@
19
19
  let focusedIndex: number = $state(-1);
20
20
  let posX: number = $state(0);
21
21
  let posY: number = $state(0);
22
+ // Captured when the menu opens, consumed once on close — the element that had
23
+ // focus (or triggered the native contextmenu event) is where focus belongs once
24
+ // the menu goes away, matching Menu.svelte's own restore-on-close contract.
25
+ let openerElement: HTMLElement | null = $state(null);
22
26
 
23
27
  let selectableItems: ContextMenuItem[] = $derived(
24
28
  items.filter((item) => !item.separator && !item.disabled)
25
29
  );
26
30
 
31
+ // The frame that moves focus into the freshly-opened menu, kept so closing can
32
+ // cancel it. Escape pressed between the right-click and that frame used to
33
+ // leave the callback queued: it ran after the menu was gone, moved focus onto
34
+ // an item that no longer existed, and left the page with nothing focused at
35
+ // all — worse than never restoring, because the user's place is simply lost.
36
+ let openFrame: number | null = null;
37
+
38
+ function cancelOpenFrame() {
39
+ if (openFrame !== null) {
40
+ cancelAnimationFrame(openFrame);
41
+ openFrame = null;
42
+ }
43
+ }
44
+
27
45
  function openMenu(x: number, y: number) {
28
46
  posX = x;
29
47
  posY = y;
30
48
  open = true;
31
49
  focusedIndex = 0;
32
50
  onopen?.();
33
- requestAnimationFrame(() => {
51
+ cancelOpenFrame();
52
+ openFrame = requestAnimationFrame(() => {
53
+ openFrame = null;
34
54
  adjustPosition();
35
55
  focusItem(0);
36
56
  });
37
57
  }
38
58
 
39
59
  function close() {
60
+ cancelOpenFrame();
40
61
  open = false;
41
62
  focusedIndex = -1;
42
63
  onclose?.();
64
+
65
+ const opener = openerElement;
66
+ openerElement = null;
67
+ if (opener === null) {
68
+ return;
69
+ }
70
+
71
+ // Only take focus back if nothing else has claimed it. Closing by clicking a
72
+ // focusable element outside means the browser has already moved focus there,
73
+ // and pulling it back to the opener would fight the user and lose their
74
+ // place. Focus still inside the dying menu, or fallen to <body>, is loose and
75
+ // does belong to the opener.
76
+ const active = document.activeElement;
77
+ const focusIsLoose =
78
+ active === null || active === document.body || (menuEl?.contains(active) ?? false);
79
+ if (focusIsLoose) {
80
+ opener.focus();
81
+ }
43
82
  }
44
83
 
45
84
  function selectMenuItem(item: ContextMenuItem) {
@@ -90,6 +129,12 @@
90
129
 
91
130
  function handleContextMenu(event: MouseEvent) {
92
131
  event.preventDefault();
132
+ // A right-click usually leaves <body> as the active element, and "restore
133
+ // focus to <body>" is not a restoration — it is the same as doing nothing,
134
+ // but it also discards whatever the browser would have done. Capture only a
135
+ // real element.
136
+ const active = document.activeElement;
137
+ openerElement = active instanceof HTMLElement && active !== document.body ? active : null;
93
138
  openMenu(event.clientX, event.clientY);
94
139
  }
95
140
 
@@ -147,13 +192,28 @@
147
192
  }
148
193
  }
149
194
 
195
+ // Escape is handled on the document as well as on the menu, because for one
196
+ // frame after the right-click the menu is open but focus has not moved into it
197
+ // yet. A menu-only handler does nothing during that window: the keystroke is
198
+ // swallowed, the menu stays open, and the pending frame then pulls focus into
199
+ // it — so a quick Escape appeared to do the opposite of what it asked for. An
200
+ // open menu should close on Escape wherever focus happens to be.
201
+ function handleDocumentKeydown(event: KeyboardEvent) {
202
+ if (open && event.key === 'Escape') {
203
+ event.preventDefault();
204
+ close();
205
+ }
206
+ }
207
+
150
208
  onMount(() => {
151
209
  document.addEventListener('click', handleClickOutside);
210
+ document.addEventListener('keydown', handleDocumentKeydown);
152
211
  });
153
212
 
154
213
  onDestroy(() => {
155
214
  if (typeof window !== 'undefined') {
156
215
  document.removeEventListener('click', handleClickOutside);
216
+ document.removeEventListener('keydown', handleDocumentKeydown);
157
217
  }
158
218
  });
159
219
  </script>
@@ -162,7 +222,7 @@
162
222
  class="context-menu-container {classes ?? ''}"
163
223
  bind:this={containerEl}
164
224
  oncontextmenu={handleContextMenu}
165
- role="application"
225
+ {...open ? { role: 'application' } : {}}
166
226
  data-pw={testId}
167
227
  testID={testId}
168
228
  >
@@ -10,6 +10,7 @@
10
10
  showValue = false,
11
11
  labelFormatter,
12
12
  ariaLabel,
13
+ ariaLabelledby,
13
14
  testId,
14
15
  onchange,
15
16
  oninput,
@@ -44,6 +45,7 @@
44
45
  {value}
45
46
  {disabled}
46
47
  aria-label={typeof ariaLabel === 'string' ? ariaLabel : null}
48
+ aria-labelledby={typeof ariaLabel === 'string' ? null : (ariaLabelledby ?? null)}
47
49
  data-pw={typeof testId === 'string' ? testId : null}
48
50
  testID={typeof testId === 'string' ? testId : null}
49
51
  oninput={handleInput}
@@ -14,6 +14,13 @@ export type OptionalSliderProperties = {
14
14
  * so a control whose purpose is not carried by adjacent visible text needs this.
15
15
  */
16
16
  ariaLabel?: string;
17
+ /**
18
+ * Ids of the elements that name the range input (aria-labelledby). Use this
19
+ * instead of `ariaLabel` when the name is already on screen, so the two cannot
20
+ * drift apart. `ariaLabel` wins if both are given, matching how the platform
21
+ * resolves them.
22
+ */
23
+ ariaLabelledby?: string;
17
24
  testId?: string;
18
25
  classes?: string;
19
26
  };
@@ -16,6 +16,12 @@
16
16
  onkeydown
17
17
  }: StepProperties = $props();
18
18
 
19
+ // Per-instance, because `step-label-${stepIndex}` collides across two Steppers
20
+ // on one page and `aria-labelledby` then resolves to whichever matching id
21
+ // comes first in the document — naming a step after a different Stepper's.
22
+ const uid = $props.id();
23
+ const labelId = `step-label-${uid}`;
24
+
19
25
  const handleStepClick = (): void => {
20
26
  onclick?.({ selectedIndex: stepIndex });
21
27
  };
@@ -59,7 +65,7 @@
59
65
  role={suppressRoleAndTabindex ? null : 'button'}
60
66
  tabindex={suppressRoleAndTabindex ? null : 0}
61
67
  aria-label={ariaLabel ?? null}
62
- aria-labelledby={ariaLabel ? null : `step-label-${stepIndex}`}
68
+ aria-labelledby={ariaLabel ? null : labelId}
63
69
  aria-current={status === 'active' ? 'step' : null}
64
70
  >
65
71
  {#if typeof icon === 'string' && icon.length > 0}
@@ -99,7 +105,7 @@
99
105
  </div>
100
106
  {/if}
101
107
 
102
- <div class="step-text" id="step-label-{stepIndex}">
108
+ <div class="step-text" id={labelId}>
103
109
  {label}
104
110
  </div>
105
111
 
package/dist-wc/index.js CHANGED
@@ -7196,14 +7196,14 @@ var root$73 = /* @__PURE__ */ from_html("<span class=\"slider-value svelte-17e64
7196
7196
  };
7197
7197
  function Slider(e, t) {
7198
7198
  push(t, !0), append_styles$1(e, $$css$73);
7199
- let n = prop(t, "value", 15, 0), i = prop(t, "min", 7, 0), a = prop(t, "max", 7, 100), o = prop(t, "step", 7, 1), s = prop(t, "disabled", 7, !1), c = prop(t, "showValue", 7, !1), l = prop(t, "labelFormatter", 7), u = prop(t, "ariaLabel", 7), f = prop(t, "testId", 7), p = prop(t, "onchange", 7), h = prop(t, "oninput", 7), S = prop(t, "classes", 7), C = /* @__PURE__ */ user_derived(() => (n() - i()) / (a() - i()) * 100), k = /* @__PURE__ */ user_derived(() => l() ? l()(n()) : String(n()));
7200
- function R(e) {
7201
- e.target instanceof HTMLInputElement && (n(Number(e.target.value)), h()?.(n()));
7202
- }
7199
+ let n = prop(t, "value", 15, 0), i = prop(t, "min", 7, 0), a = prop(t, "max", 7, 100), o = prop(t, "step", 7, 1), s = prop(t, "disabled", 7, !1), c = prop(t, "showValue", 7, !1), l = prop(t, "labelFormatter", 7), u = prop(t, "ariaLabel", 7), f = prop(t, "ariaLabelledby", 7), p = prop(t, "testId", 7), h = prop(t, "onchange", 7), S = prop(t, "oninput", 7), C = prop(t, "classes", 7), k = /* @__PURE__ */ user_derived(() => (n() - i()) / (a() - i()) * 100), R = /* @__PURE__ */ user_derived(() => l() ? l()(n()) : String(n()));
7203
7200
  function G(e) {
7204
- e.target instanceof HTMLInputElement && (n(Number(e.target.value)), p()?.(n()));
7201
+ e.target instanceof HTMLInputElement && (n(Number(e.target.value)), S()?.(n()));
7205
7202
  }
7206
- var te = {
7203
+ function te(e) {
7204
+ e.target instanceof HTMLInputElement && (n(Number(e.target.value)), h()?.(n()));
7205
+ }
7206
+ var ne = {
7207
7207
  get value() {
7208
7208
  return n();
7209
7209
  },
@@ -7252,43 +7252,49 @@ function Slider(e, t) {
7252
7252
  set ariaLabel(e) {
7253
7253
  u(e), flushSync();
7254
7254
  },
7255
- get testId() {
7255
+ get ariaLabelledby() {
7256
7256
  return f();
7257
7257
  },
7258
- set testId(e) {
7258
+ set ariaLabelledby(e) {
7259
7259
  f(e), flushSync();
7260
7260
  },
7261
- get onchange() {
7261
+ get testId() {
7262
7262
  return p();
7263
7263
  },
7264
- set onchange(e) {
7264
+ set testId(e) {
7265
7265
  p(e), flushSync();
7266
7266
  },
7267
- get oninput() {
7267
+ get onchange() {
7268
7268
  return h();
7269
7269
  },
7270
- set oninput(e) {
7270
+ set onchange(e) {
7271
7271
  h(e), flushSync();
7272
7272
  },
7273
- get classes() {
7273
+ get oninput() {
7274
7274
  return S();
7275
7275
  },
7276
- set classes(e) {
7276
+ set oninput(e) {
7277
7277
  S(e), flushSync();
7278
+ },
7279
+ get classes() {
7280
+ return C();
7281
+ },
7282
+ set classes(e) {
7283
+ C(e), flushSync();
7278
7284
  }
7279
- }, ne = root_1$62();
7280
- let re;
7281
- var be = child(ne);
7282
- remove_input_defaults(be);
7283
- var Me = sibling(be, 2), Re = (e) => {
7285
+ }, re = root_1$62();
7286
+ let be;
7287
+ var Me = child(re);
7288
+ remove_input_defaults(Me);
7289
+ var Re = sibling(Me, 2), Ue = (e) => {
7284
7290
  var t = root$73(), n = child(t, !0);
7285
- reset(t), template_effect(() => set_text(n, get(k))), append(e, t);
7291
+ reset(t), template_effect(() => set_text(n, get(R))), append(e, t);
7286
7292
  };
7287
- return if_block(Me, (e) => {
7288
- c() && e(Re);
7289
- }), reset(ne), template_effect(() => {
7290
- re = set_class(ne, 1, `slider-container ${S() ?? "" ?? ""}`, "svelte-17e64va", re, { disabled: s() }), set_attribute(be, "min", i()), set_attribute(be, "max", a()), set_attribute(be, "step", o()), set_value(be, n()), be.disabled = s(), set_attribute(be, "aria-label", typeof u() == "string" ? u() : null), set_attribute(be, "data-pw", typeof f() == "string" ? f() : null), set_attribute(be, "testid", typeof f() == "string" ? f() : null), set_style(be, `--slider-fill-percent: ${get(C) ?? ""}%`);
7291
- }), delegated("input", be, R), delegated("change", be, G), append(e, ne), pop(te);
7293
+ return if_block(Re, (e) => {
7294
+ c() && e(Ue);
7295
+ }), reset(re), template_effect(() => {
7296
+ be = set_class(re, 1, `slider-container ${C() ?? "" ?? ""}`, "svelte-17e64va", be, { disabled: s() }), set_attribute(Me, "min", i()), set_attribute(Me, "max", a()), set_attribute(Me, "step", o()), set_value(Me, n()), Me.disabled = s(), set_attribute(Me, "aria-label", typeof u() == "string" ? u() : null), set_attribute(Me, "aria-labelledby", typeof u() == "string" ? null : f() ?? null), set_attribute(Me, "data-pw", typeof p() == "string" ? p() : null), set_attribute(Me, "testid", typeof p() == "string" ? p() : null), set_style(Me, `--slider-fill-percent: ${get(k) ?? ""}%`);
7297
+ }), delegated("input", Me, G), delegated("change", Me, te), append(e, re), pop(ne);
7292
7298
  }
7293
7299
  delegate(["input", "change"]), create_custom_element(Slider, {
7294
7300
  value: {},
@@ -7299,6 +7305,7 @@ delegate(["input", "change"]), create_custom_element(Slider, {
7299
7305
  showValue: {},
7300
7306
  labelFormatter: {},
7301
7307
  ariaLabel: {},
7308
+ ariaLabelledby: {},
7302
7309
  testId: {},
7303
7310
  onchange: {},
7304
7311
  oninput: {},
@@ -8668,197 +8675,209 @@ customElements.define("sui-combobox", create_custom_element(Combobox_wc, {
8668
8675
  }, [], [], { mode: "open" }));
8669
8676
  //#endregion
8670
8677
  //#region src/lib/assets/search.svg?raw
8671
- var search_default = "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"></circle>\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line>\n</svg>\n", root$69 = /* @__PURE__ */ from_html("<span class=\"command-menu-search-icon svelte-rk55q\"></span>"), root_1$58 = /* @__PURE__ */ from_html("<div class=\"command-menu-empty svelte-rk55q\"> </div>"), root_2$44 = /* @__PURE__ */ from_html("<div class=\"command-menu-group-heading svelte-rk55q\"> </div>"), root_3$39 = /* @__PURE__ */ from_html("<span class=\"command-menu-item-icon svelte-rk55q\"><!></span>"), root_4$31 = /* @__PURE__ */ from_html("<div class=\"command-menu-item-icon-img-wrapper svelte-rk55q\"><!></div>"), root_5$26 = /* @__PURE__ */ from_html("<kbd class=\"command-menu-kbd svelte-rk55q\"> </kbd>"), root_6$22 = /* @__PURE__ */ from_html("<span class=\"command-menu-item-shortcut svelte-rk55q\"></span>"), root_7$19 = /* @__PURE__ */ from_html("<button type=\"button\" role=\"option\" tabindex=\"-1\"><!> <span class=\"command-menu-item-label svelte-rk55q\"> </span> <!></button>"), root_8$17 = /* @__PURE__ */ from_html("<!> <!>", 1), root_9$12 = /* @__PURE__ */ from_html("<div role=\"dialog\" aria-modal=\"true\" aria-label=\"Command menu\" tabindex=\"-1\"><div class=\"command-menu-dialog svelte-rk55q\"><div class=\"command-menu-input-wrapper svelte-rk55q\"><!> <input type=\"text\" class=\"command-menu-input svelte-rk55q\" autocomplete=\"off\" spellcheck=\"false\"/></div> <div class=\"command-menu-separator svelte-rk55q\"></div> <div class=\"command-menu-list svelte-rk55q\" role=\"listbox\"><!></div></div></div>"), $$css$69 = {
8678
+ var search_default = "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"></circle>\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line>\n</svg>\n", root$69 = /* @__PURE__ */ from_html("<span class=\"command-menu-search-icon svelte-rk55q\"></span>"), root_1$58 = /* @__PURE__ */ from_html("<div class=\"command-menu-empty svelte-rk55q\"> </div>"), root_2$44 = /* @__PURE__ */ from_html("<div class=\"command-menu-group-heading svelte-rk55q\"> </div>"), root_3$39 = /* @__PURE__ */ from_html("<span class=\"command-menu-item-icon svelte-rk55q\"><!></span>"), root_4$31 = /* @__PURE__ */ from_html("<div class=\"command-menu-item-icon-img-wrapper svelte-rk55q\"><!></div>"), root_5$26 = /* @__PURE__ */ from_html("<kbd class=\"command-menu-kbd svelte-rk55q\"> </kbd>"), root_6$22 = /* @__PURE__ */ from_html("<span class=\"command-menu-item-shortcut svelte-rk55q\"></span>"), root_7$19 = /* @__PURE__ */ from_html("<button type=\"button\" role=\"option\" tabindex=\"-1\"><!> <span class=\"command-menu-item-label svelte-rk55q\"> </span> <!></button>"), root_8$17 = /* @__PURE__ */ from_html("<!> <!>", 1), root_9$12 = /* @__PURE__ */ from_html("<div role=\"dialog\" aria-modal=\"true\" aria-label=\"Command menu\" tabindex=\"-1\"><div class=\"command-menu-dialog svelte-rk55q\"><div class=\"command-menu-input-wrapper svelte-rk55q\"><!> <input type=\"text\" class=\"command-menu-input svelte-rk55q\" autocomplete=\"off\" spellcheck=\"false\" role=\"combobox\" aria-autocomplete=\"list\"/></div> <div class=\"command-menu-separator svelte-rk55q\"></div> <div class=\"command-menu-list svelte-rk55q\" role=\"listbox\"><!></div></div></div>"), $$css$69 = {
8672
8679
  hash: "svelte-rk55q",
8673
8680
  code: ".command-menu-overlay.svelte-rk55q {position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--command-menu-overlay-background, rgba(0, 0, 0, 0.5));display:flex;align-items:var(--command-menu-overlay-align, flex-start);justify-content:center;padding-top:var(--command-menu-overlay-padding-top, 20vh);z-index:var(--command-menu-z-index, 50);-webkit-tap-highlight-color:transparent;}.command-menu-dialog.svelte-rk55q {background-color:var(--command-menu-background, #ffffff);border-radius:var(--command-menu-border-radius, var(--radius, 4px));box-shadow:var(--command-menu-box-shadow, 0 16px 70px rgba(0, 0, 0, 0.2));width:var(--command-menu-width, 560px);max-width:var(--command-menu-max-width, 90vw);max-height:var(--command-menu-max-height, 60vh);display:flex;flex-direction:column;overflow:hidden;border:var(--command-menu-border, 1px solid #e2e8f0);}.command-menu-input-wrapper.svelte-rk55q {display:flex;align-items:center;padding:var(--command-menu-input-wrapper-padding, 12px 16px);gap:var(--command-menu-input-wrapper-gap, 10px);}.command-menu-search-icon.svelte-rk55q {display:inline-flex;align-items:center;justify-content:center;width:var(--command-menu-search-icon-size, 20px);height:var(--command-menu-search-icon-size, 20px);color:var(--command-menu-search-icon-color, #94a3b8);flex-shrink:0;}.command-menu-search-icon.svelte-rk55q svg {width:100%;height:100%;}.command-menu-input.svelte-rk55q {flex:1;border:none;outline:none;background:transparent;font-size:var(--command-menu-input-font-size, 16px);font-family:var(--command-menu-input-font-family, inherit);font-weight:var(--command-menu-input-font-weight, 400);color:var(--command-menu-input-color, #1e293b);caret-color:var(--command-menu-input-caret-color, #3b82f6);}.command-menu-input.svelte-rk55q::placeholder {color:var(--command-menu-input-placeholder-color, #94a3b8);}.command-menu-separator.svelte-rk55q {height:var(--command-menu-separator-height, 1px);background-color:var(--command-menu-separator-color, #e2e8f0);flex-shrink:0;}.command-menu-list.svelte-rk55q {overflow-y:auto;padding:var(--command-menu-list-padding, 8px);scrollbar-width:var(--command-menu-scrollbar-width, thin);}.command-menu-empty.svelte-rk55q {padding:var(--command-menu-empty-padding, 32px 16px);text-align:center;color:var(--command-menu-empty-color, #94a3b8);font-size:var(--command-menu-empty-font-size, 14px);font-style:var(--command-menu-empty-font-style, normal);}.command-menu-group-heading.svelte-rk55q {padding:var(--command-menu-group-heading-padding, 8px 12px 4px);font-size:var(--command-menu-group-heading-font-size, 12px);font-weight:var(--command-menu-group-heading-font-weight, 600);color:var(--command-menu-group-heading-color, #94a3b8);text-transform:var(--command-menu-group-heading-text-transform, uppercase);letter-spacing:var(--command-menu-group-heading-letter-spacing, 0.05em);}.command-menu-item.svelte-rk55q {display:flex;align-items:center;padding:var(--command-menu-item-padding, 10px 12px);border-radius:var(--command-menu-item-border-radius, var(--radius, 4px));cursor:pointer;gap:var(--command-menu-item-gap, 10px);font-size:var(--command-menu-item-font-size, 14px);color:var(--command-menu-item-color, #334155);transition:background-color 0.1s;background:none;border:none;width:100%;text-align:left;font-family:inherit;}.command-menu-item.active.svelte-rk55q {background-color:var(--command-menu-item-active-background, #f1f5f9);color:var(--command-menu-item-active-color, #0f172a);}.command-menu-item.disabled.svelte-rk55q {opacity:var(--command-menu-item-disabled-opacity, 0.4);cursor:not-allowed;}.command-menu-item-icon.svelte-rk55q {display:flex;align-items:center;justify-content:center;flex-shrink:0;}.command-menu-item-icon-img-wrapper.svelte-rk55q {--image-width: var(--command-menu-item-icon-size, 20px);--image-height: var(--command-menu-item-icon-size, 20px);\n\n /* Mirrors --command-menu-search-icon-color, which this component already had. */color:var(--command-menu-item-icon-color, inherit);flex-shrink:0;display:flex;align-items:center;justify-content:center;}.command-menu-item-label.svelte-rk55q {flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.command-menu-item-shortcut.svelte-rk55q {display:flex;align-items:center;gap:var(--command-menu-shortcut-gap, 4px);flex-shrink:0;}.command-menu-kbd.svelte-rk55q {display:inline-flex;align-items:center;justify-content:center;min-width:var(--command-menu-kbd-min-width, 24px);height:var(--command-menu-kbd-height, 22px);padding:var(--command-menu-kbd-padding, 0 6px);border-radius:var(--command-menu-kbd-border-radius, var(--radius, 4px));background-color:var(--command-menu-kbd-background, #f1f5f9);border:var(--command-menu-kbd-border, 1px solid #e2e8f0);color:var(--command-menu-kbd-color, #64748b);font-size:var(--command-menu-kbd-font-size, 11px);font-family:var(--command-menu-kbd-font-family, inherit);font-weight:var(--command-menu-kbd-font-weight, 500);box-shadow:var(--command-menu-kbd-box-shadow, 0 1px 0 #e2e8f0);}"
8674
8681
  };
8675
8682
  function CommandMenu(e, t) {
8683
+ let n = props_id();
8676
8684
  push(t, !0), append_styles$1(e, $$css$69);
8677
- let n = prop(t, "items", 7), i = prop(t, "open", 15, !1), a = prop(t, "placeholder", 7, "Search commands..."), o = prop(t, "emptyText", 7, "No results found."), s = prop(t, "testId", 7), c = prop(t, "itemIcon", 7), l = prop(t, "searchIcon", 7), u = prop(t, "onselect", 7), f = prop(t, "onclose", 7), p = prop(t, "classes", 7), h = /* @__PURE__ */ state(""), S = /* @__PURE__ */ state(0), C = /* @__PURE__ */ state(null), k = /* @__PURE__ */ state(null), R = /* @__PURE__ */ user_derived(() => {
8678
- if (get(h).trim() === "") return n();
8679
- let e = get(h).toLowerCase();
8680
- return n().filter((t) => t.label.toLowerCase().includes(e));
8681
- }), G = /* @__PURE__ */ user_derived(() => {
8685
+ let i = prop(t, "items", 7), a = prop(t, "open", 15, !1), o = prop(t, "placeholder", 7, "Search commands..."), s = prop(t, "emptyText", 7, "No results found."), c = prop(t, "testId", 7), l = prop(t, "itemIcon", 7), u = prop(t, "searchIcon", 7), f = prop(t, "onselect", 7), p = prop(t, "onclose", 7), h = prop(t, "classes", 7), S = `command-menu-listbox-${n}`, C = /* @__PURE__ */ state(""), k = /* @__PURE__ */ state(0), R = /* @__PURE__ */ state(null), G = /* @__PURE__ */ state(null), te = /* @__PURE__ */ state(null), ne = null, re = /* @__PURE__ */ user_derived(() => {
8686
+ if (get(C).trim() === "") return i();
8687
+ let e = get(C).toLowerCase();
8688
+ return i().filter((t) => t.label.toLowerCase().includes(e));
8689
+ }), be = /* @__PURE__ */ user_derived(() => {
8682
8690
  let e = new SvelteMap();
8683
- for (let t of get(R)) {
8691
+ for (let t of get(re)) {
8684
8692
  let n = t.group ?? "";
8685
8693
  e.has(n) || e.set(n, []);
8686
8694
  let i = e.get(n);
8687
8695
  Array.isArray(i) && i.push(t);
8688
8696
  }
8689
8697
  return e;
8690
- }), te = /* @__PURE__ */ user_derived(() => {
8698
+ }), Me = /* @__PURE__ */ user_derived(() => {
8691
8699
  let e = [];
8692
- for (let [, t] of get(G)) for (let n of t) e.push(n);
8700
+ for (let [, t] of get(be)) for (let n of t) e.push(n);
8693
8701
  return e;
8694
- }), ne = /* @__PURE__ */ user_derived(() => {
8702
+ }), Re = /* @__PURE__ */ user_derived(() => {
8695
8703
  let e = new SvelteMap();
8696
- for (let t = 0; t < get(te).length; t++) {
8697
- let n = get(te).at(t);
8704
+ for (let t = 0; t < get(Me).length; t++) {
8705
+ let n = get(Me).at(t);
8698
8706
  typeof n == "object" && e.set(n.value, t);
8699
8707
  }
8700
8708
  return e;
8701
- });
8702
- function re() {
8703
- i(!1), set(h, ""), set(S, 0), f()?.();
8709
+ }), Ue = /* @__PURE__ */ user_derived(() => get(Me).length > 0 ? `command-menu-option-${n}-${get(k)}` : null);
8710
+ function it() {
8711
+ a(!1), set(C, ""), set(k, 0), p()?.();
8704
8712
  }
8705
- function be(e) {
8706
- e.disabled || (u()?.(e), re());
8713
+ function at(e) {
8714
+ e.disabled || (f()?.(e), it());
8707
8715
  }
8708
- function Me(e, t) {
8716
+ function ot(e, t) {
8709
8717
  let n = e + t;
8710
- for (; n >= 0 && n < get(te).length;) {
8711
- let e = get(te).at(n);
8718
+ for (; n >= 0 && n < get(Me).length;) {
8719
+ let e = get(Me).at(n);
8712
8720
  if (typeof e == "object" && !e.disabled) return n;
8713
8721
  n += t;
8714
8722
  }
8715
8723
  return -1;
8716
8724
  }
8717
- function Re(e) {
8718
- if (i()) switch (e.key) {
8725
+ function ct(e) {
8726
+ if (a()) switch (e.key) {
8719
8727
  case "ArrowDown": {
8720
8728
  e.preventDefault();
8721
- let t = Me(get(S), 1);
8722
- t >= 0 && (set(S, t, !0), Ue());
8729
+ let t = ot(get(k), 1);
8730
+ t >= 0 && (set(k, t, !0), ut());
8723
8731
  break;
8724
8732
  }
8725
8733
  case "ArrowUp": {
8726
8734
  e.preventDefault();
8727
- let t = Me(get(S), -1);
8728
- t >= 0 && (set(S, t, !0), Ue());
8735
+ let t = ot(get(k), -1);
8736
+ t >= 0 && (set(k, t, !0), ut());
8729
8737
  break;
8730
8738
  }
8731
8739
  case "Enter": {
8732
8740
  e.preventDefault();
8733
- let t = get(te).at(get(S));
8734
- typeof t == "object" && !t.disabled && be(t);
8741
+ let t = get(Me).at(get(k));
8742
+ typeof t == "object" && !t.disabled && at(t);
8735
8743
  break;
8736
8744
  }
8737
8745
  case "Escape":
8738
- e.preventDefault(), re();
8746
+ e.preventDefault(), it();
8747
+ break;
8748
+ case "Tab": {
8749
+ let t = lt();
8750
+ if (t.length === 0) break;
8751
+ e.preventDefault();
8752
+ let n = document.activeElement, i = ((n instanceof HTMLElement ? t.indexOf(n) : -1) + (e.shiftKey ? -1 : 1) + t.length) % t.length;
8753
+ t.at(i)?.focus();
8739
8754
  break;
8755
+ }
8740
8756
  }
8741
8757
  }
8742
- async function Ue() {
8743
- if (await tick(), get(k) !== null) {
8744
- let e = get(k).querySelector("[data-active=\"true\"]");
8758
+ function lt() {
8759
+ return get(te) === null ? [] : [...get(te).querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]")].filter((e) => e.getAttribute("tabindex") !== "-1" && (e.offsetParent !== null || e === document.activeElement));
8760
+ }
8761
+ async function ut() {
8762
+ if (await tick(), get(G) !== null) {
8763
+ let e = get(G).querySelector("[data-active=\"true\"]");
8745
8764
  e !== null && e.scrollIntoView({ block: "nearest" });
8746
8765
  }
8747
8766
  }
8748
- function it(e) {
8749
- e.target === e.currentTarget && re();
8767
+ function dt(e) {
8768
+ e.target === e.currentTarget && it();
8750
8769
  }
8751
- function at(e) {
8752
- (e.metaKey || e.ctrlKey) && e.key === "k" && (e.preventDefault(), i() ? re() : i(!0));
8770
+ function ft(e) {
8771
+ (e.metaKey || e.ctrlKey) && e.key === "k" && (e.preventDefault(), a() ? it() : a(!0));
8753
8772
  }
8754
- function ot(e) {
8755
- return lockBodyScroll(), tick().then(() => {
8756
- get(C) !== null && get(C).focus();
8773
+ function pt(e) {
8774
+ return ne === null && document.activeElement instanceof HTMLElement && (ne = document.activeElement), lockBodyScroll(), tick().then(() => {
8775
+ get(R) !== null && get(R).focus();
8757
8776
  }), { destroy() {
8758
- unlockBodyScroll();
8777
+ unlockBodyScroll(), ne !== null && (ne.focus(), ne = null);
8759
8778
  } };
8760
8779
  }
8761
8780
  onMount(() => {
8762
- window.addEventListener("keydown", at);
8781
+ window.addEventListener("keydown", ft);
8763
8782
  }), onDestroy(() => {
8764
- typeof window < "u" && window.removeEventListener("keydown", at);
8783
+ typeof window < "u" && window.removeEventListener("keydown", ft);
8765
8784
  });
8766
- var ct = {
8785
+ var mt = {
8767
8786
  get items() {
8768
- return n();
8787
+ return i();
8769
8788
  },
8770
8789
  set items(e) {
8771
- n(e), flushSync();
8790
+ i(e), flushSync();
8772
8791
  },
8773
8792
  get open() {
8774
- return i();
8793
+ return a();
8775
8794
  },
8776
8795
  set open(e = !1) {
8777
- i(e), flushSync();
8796
+ a(e), flushSync();
8778
8797
  },
8779
8798
  get placeholder() {
8780
- return a();
8799
+ return o();
8781
8800
  },
8782
8801
  set placeholder(e = "Search commands...") {
8783
- a(e), flushSync();
8802
+ o(e), flushSync();
8784
8803
  },
8785
8804
  get emptyText() {
8786
- return o();
8805
+ return s();
8787
8806
  },
8788
8807
  set emptyText(e = "No results found.") {
8789
- o(e), flushSync();
8808
+ s(e), flushSync();
8790
8809
  },
8791
8810
  get testId() {
8792
- return s();
8811
+ return c();
8793
8812
  },
8794
8813
  set testId(e) {
8795
- s(e), flushSync();
8814
+ c(e), flushSync();
8796
8815
  },
8797
8816
  get itemIcon() {
8798
- return c();
8817
+ return l();
8799
8818
  },
8800
8819
  set itemIcon(e) {
8801
- c(e), flushSync();
8820
+ l(e), flushSync();
8802
8821
  },
8803
8822
  get searchIcon() {
8804
- return l();
8823
+ return u();
8805
8824
  },
8806
8825
  set searchIcon(e) {
8807
- l(e), flushSync();
8826
+ u(e), flushSync();
8808
8827
  },
8809
8828
  get onselect() {
8810
- return u();
8829
+ return f();
8811
8830
  },
8812
8831
  set onselect(e) {
8813
- u(e), flushSync();
8832
+ f(e), flushSync();
8814
8833
  },
8815
8834
  get onclose() {
8816
- return f();
8835
+ return p();
8817
8836
  },
8818
8837
  set onclose(e) {
8819
- f(e), flushSync();
8838
+ p(e), flushSync();
8820
8839
  },
8821
8840
  get classes() {
8822
- return p();
8841
+ return h();
8823
8842
  },
8824
8843
  set classes(e) {
8825
- p(e), flushSync();
8844
+ h(e), flushSync();
8826
8845
  }
8827
- }, lt = comment(), ut = first_child(lt), dt = (e) => {
8828
- var t = root_9$12(), n = child(t), i = child(n), u = child(i), f = (e) => {
8846
+ }, ht = comment(), gt = first_child(ht), _t = (e) => {
8847
+ var t = root_9$12(), i = child(t), a = child(i), f = child(a), p = (e) => {
8829
8848
  var t = comment();
8830
- snippet(first_child(t), l), append(e, t);
8831
- }, R = (e) => {
8849
+ snippet(first_child(t), u), append(e, t);
8850
+ }, ne = (e) => {
8832
8851
  var t = root$69();
8833
8852
  html(t, () => search_default, !0), reset(t), append(e, t);
8834
8853
  };
8835
- if_block(u, (e) => {
8836
- typeof l() == "function" ? e(f) : e(R, -1);
8854
+ if_block(f, (e) => {
8855
+ typeof u() == "function" ? e(p) : e(ne, -1);
8837
8856
  });
8838
- var re = sibling(u, 2);
8839
- remove_input_defaults(re), bind_this(re, (e) => set(C, e), () => get(C)), reset(i);
8840
- var Me = sibling(i, 4), Ue = child(Me), at = (e) => {
8857
+ var re = sibling(f, 2);
8858
+ remove_input_defaults(re), bind_this(re, (e) => set(R, e), () => get(R)), reset(a);
8859
+ var it = sibling(a, 4), ot = child(it), lt = (e) => {
8841
8860
  var t = root_1$58(), n = child(t, !0);
8842
- reset(t), template_effect(() => set_text(n, o())), append(e, t);
8843
- }, ct = (e) => {
8861
+ reset(t), template_effect(() => set_text(n, s())), append(e, t);
8862
+ }, ut = (e) => {
8844
8863
  var t = comment();
8845
- each(first_child(t), 17, () => get(G), ([e, t]) => e, (e, t) => {
8846
- var n = /* @__PURE__ */ user_derived(() => to_array(get(t), 2));
8847
- let i = () => get(n)[0], a = () => get(n)[1];
8848
- var o = root_8$17(), l = first_child(o), u = (e) => {
8864
+ each(first_child(t), 17, () => get(be), ([e, t]) => e, (e, t) => {
8865
+ var i = /* @__PURE__ */ user_derived(() => to_array(get(t), 2));
8866
+ let a = () => get(i)[0], o = () => get(i)[1];
8867
+ var s = root_8$17(), u = first_child(s), f = (e) => {
8849
8868
  var t = root_2$44(), n = child(t, !0);
8850
- reset(t), template_effect(() => set_text(n, i())), append(e, t);
8869
+ reset(t), template_effect(() => set_text(n, a())), append(e, t);
8851
8870
  };
8852
- if_block(l, (e) => {
8853
- i() !== "" && e(u);
8854
- }), each(sibling(l, 2), 17, a, (e) => e.value, (e, t) => {
8855
- let n = /* @__PURE__ */ user_derived(() => get(ne).get(get(t).value) ?? -1);
8856
- var i = root_7$19();
8857
- let a;
8858
- var o = child(i), l = (e) => {
8871
+ if_block(u, (e) => {
8872
+ a() !== "" && e(f);
8873
+ }), each(sibling(u, 2), 17, o, (e) => e.value, (e, t) => {
8874
+ let i = /* @__PURE__ */ user_derived(() => get(Re).get(get(t).value) ?? -1);
8875
+ var a = root_7$19();
8876
+ let o;
8877
+ var s = child(a), u = (e) => {
8859
8878
  var n = root_3$39();
8860
- snippet(child(n), c, () => get(t)), reset(n), append(e, n);
8861
- }, u = (e) => {
8879
+ snippet(child(n), l, () => get(t)), reset(n), append(e, n);
8880
+ }, f = (e) => {
8862
8881
  var n = root_4$31();
8863
8882
  Img(child(n), {
8864
8883
  inlineSvg: !0,
@@ -8868,42 +8887,42 @@ function CommandMenu(e, t) {
8868
8887
  alt: ""
8869
8888
  }), reset(n), append(e, n);
8870
8889
  };
8871
- if_block(o, (e) => {
8872
- typeof c() == "function" ? e(l) : typeof get(t).icon == "string" && get(t).icon.length > 0 && e(u, 1);
8890
+ if_block(s, (e) => {
8891
+ typeof l() == "function" ? e(u) : typeof get(t).icon == "string" && get(t).icon.length > 0 && e(f, 1);
8873
8892
  });
8874
- var f = sibling(o, 2), p = child(f, !0);
8875
- reset(f);
8876
- var h = sibling(f, 2), C = (e) => {
8893
+ var p = sibling(s, 2), h = child(p, !0);
8894
+ reset(p);
8895
+ var S = sibling(p, 2), C = (e) => {
8877
8896
  var n = root_6$22();
8878
8897
  each(n, 21, () => get(t).shortcut.split("+"), index, (e, t) => {
8879
8898
  var n = root_5$26(), i = child(n, !0);
8880
8899
  reset(n), template_effect((e) => set_text(i, e), [() => get(t).trim()]), append(e, n);
8881
8900
  }), reset(n), append(e, n);
8882
8901
  };
8883
- if_block(h, (e) => {
8902
+ if_block(S, (e) => {
8884
8903
  typeof get(t).shortcut == "string" && get(t).shortcut.length > 0 && e(C);
8885
- }), reset(i), template_effect(() => {
8886
- a = set_class(i, 1, "command-menu-item svelte-rk55q", null, a, {
8887
- active: get(n) === get(S),
8904
+ }), reset(a), template_effect(() => {
8905
+ set_attribute(a, "id", `command-menu-option-${n}-${get(i)}`), o = set_class(a, 1, "command-menu-item svelte-rk55q", null, o, {
8906
+ active: get(i) === get(k),
8888
8907
  disabled: get(t).disabled
8889
- }), set_attribute(i, "data-active", get(n) === get(S)), set_attribute(i, "aria-selected", get(n) === get(S)), set_attribute(i, "aria-disabled", get(t).disabled), set_attribute(i, "data-pw", typeof s() == "string" ? `${s()}-item-${get(t).value}` : null), set_attribute(i, "testid", typeof s() == "string" ? `${s()}-item-${get(t).value}` : null), set_text(p, get(t).label);
8890
- }), delegated("click", i, () => be(get(t))), event("mouseenter", i, () => {
8891
- get(t).disabled || set(S, get(n), !0);
8892
- }), append(e, i);
8893
- }), append(e, o);
8908
+ }), set_attribute(a, "data-active", get(i) === get(k)), set_attribute(a, "aria-selected", get(i) === get(k)), set_attribute(a, "aria-disabled", get(t).disabled), set_attribute(a, "data-pw", typeof c() == "string" ? `${c()}-item-${get(t).value}` : null), set_attribute(a, "testid", typeof c() == "string" ? `${c()}-item-${get(t).value}` : null), set_text(h, get(t).label);
8909
+ }), delegated("click", a, () => at(get(t))), event("mouseenter", a, () => {
8910
+ get(t).disabled || set(k, get(i), !0);
8911
+ }), append(e, a);
8912
+ }), append(e, s);
8894
8913
  }), append(e, t);
8895
8914
  };
8896
- if_block(Ue, (e) => {
8897
- get(te).length === 0 ? e(at) : e(ct, -1);
8898
- }), reset(Me), bind_this(Me, (e) => set(k, e), () => get(k)), reset(n), reset(t), action(t, (e) => ot?.(e)), template_effect(() => {
8899
- set_class(t, 1, `command-menu-overlay ${p() ?? "" ?? ""}`, "svelte-rk55q"), set_attribute(t, "data-pw", typeof s() == "string" ? s() : null), set_attribute(t, "testid", typeof s() == "string" ? s() : null), set_attribute(re, "placeholder", a()), set_attribute(re, "data-pw", typeof s() == "string" ? `${s()}-input` : null), set_attribute(re, "testid", typeof s() == "string" ? `${s()}-input` : null);
8900
- }), delegated("click", t, it), delegated("keydown", t, Re), delegated("input", re, () => {
8901
- set(S, 0);
8902
- }), bind_value(re, () => get(h), (e) => set(h, e)), append(e, t);
8915
+ if_block(ot, (e) => {
8916
+ get(Me).length === 0 ? e(lt) : e(ut, -1);
8917
+ }), reset(it), bind_this(it, (e) => set(G, e), () => get(G)), reset(i), bind_this(i, (e) => set(te, e), () => get(te)), reset(t), action(t, (e) => pt?.(e)), template_effect(() => {
8918
+ set_class(t, 1, `command-menu-overlay ${h() ?? "" ?? ""}`, "svelte-rk55q"), set_attribute(t, "data-pw", typeof c() == "string" ? c() : null), set_attribute(t, "testid", typeof c() == "string" ? c() : null), set_attribute(re, "placeholder", o()), set_attribute(re, "aria-expanded", get(Me).length > 0), set_attribute(re, "aria-controls", S), set_attribute(re, "aria-activedescendant", get(Ue)), set_attribute(re, "data-pw", typeof c() == "string" ? `${c()}-input` : null), set_attribute(re, "testid", typeof c() == "string" ? `${c()}-input` : null), set_attribute(it, "id", S);
8919
+ }), delegated("click", t, dt), delegated("keydown", t, ct), delegated("input", re, () => {
8920
+ set(k, 0);
8921
+ }), bind_value(re, () => get(C), (e) => set(C, e)), append(e, t);
8903
8922
  };
8904
- return if_block(ut, (e) => {
8905
- i() && e(dt);
8906
- }), append(e, lt), pop(ct);
8923
+ return if_block(gt, (e) => {
8924
+ a() && e(_t);
8925
+ }), append(e, ht), pop(mt);
8907
8926
  }
8908
8927
  delegate([
8909
8928
  "click",
@@ -11010,21 +11029,49 @@ var rest_excludes$57 = new Set([
11010
11029
  "$$events",
11011
11030
  "$$legacy",
11012
11031
  "$$host",
11013
- "sliderAriaLabel"
11032
+ "sliderAriaLabel",
11033
+ "sliderAriaLabelledby"
11014
11034
  ]);
11015
11035
  function Slider_wc(e, t) {
11016
11036
  push(t, !0);
11017
- let n = prop(t, "sliderAriaLabel", 7), i = /* @__PURE__ */ rest_props(t, rest_excludes$57);
11018
- return Slider(e, spread_props(() => i, { get ariaLabel() {
11019
- return n();
11020
- } })), pop({
11037
+ let n = prop(t, "sliderAriaLabel", 7), i = prop(t, "sliderAriaLabelledby", 7), a = /* @__PURE__ */ rest_props(t, rest_excludes$57), o = t.$$host;
11038
+ function s(e) {
11039
+ if (typeof e != "string" || e.trim() === "") return;
11040
+ let t = o.getRootNode();
11041
+ if (!(t instanceof Document) && !(t instanceof ShadowRoot)) return;
11042
+ let n = e.trim().split(/\s+/).map((e) => t.getElementById(e)?.textContent?.trim() ?? "").filter((e) => e !== "").join(" ");
11043
+ if (n !== "") return n;
11044
+ }
11045
+ let c = /* @__PURE__ */ state(void 0);
11046
+ user_effect(() => {
11047
+ set(c, s(i()), !0);
11048
+ });
11049
+ var l = {
11021
11050
  get sliderAriaLabel() {
11022
11051
  return n();
11023
11052
  },
11024
11053
  set sliderAriaLabel(e) {
11025
11054
  n(e), flushSync();
11055
+ },
11056
+ get sliderAriaLabelledby() {
11057
+ return i();
11058
+ },
11059
+ set sliderAriaLabelledby(e) {
11060
+ i(e), flushSync();
11026
11061
  }
11027
- });
11062
+ };
11063
+ {
11064
+ let t = /* @__PURE__ */ user_derived(() => n() ?? get(c));
11065
+ Slider(e, spread_props(() => a, {
11066
+ get ariaLabel() {
11067
+ return get(t);
11068
+ },
11069
+ get ariaLabelledby() {
11070
+ return i();
11071
+ }
11072
+ }));
11073
+ }
11074
+ return pop(l);
11028
11075
  }
11029
11076
  customElements.define("sui-slider", create_custom_element(Slider_wc, {
11030
11077
  value: {
@@ -11057,13 +11104,17 @@ customElements.define("sui-slider", create_custom_element(Slider_wc, {
11057
11104
  type: "String"
11058
11105
  },
11059
11106
  classes: { type: "String" },
11060
- oninput: { type: "Object" },
11061
- onchange: { type: "Object" },
11062
- labelFormatter: { type: "Object" },
11063
11107
  sliderAriaLabel: {
11064
11108
  attribute: "aria-label",
11065
11109
  type: "String"
11066
- }
11110
+ },
11111
+ sliderAriaLabelledby: {
11112
+ attribute: "aria-labelledby",
11113
+ type: "String"
11114
+ },
11115
+ oninput: { type: "Object" },
11116
+ onchange: { type: "Object" },
11117
+ labelFormatter: { type: "Object" }
11067
11118
  }, [], [], { mode: "open" }));
11068
11119
  //#endregion
11069
11120
  //#region src/wc/components/SplitInput.wc.svelte
@@ -11334,120 +11385,121 @@ var root$54 = /* @__PURE__ */ from_html("<div class=\"step-icon-container svelte
11334
11385
  code: ".step.svelte-z5hug7 {display:flex;flex-direction:var(--step-flex-direction, row);align-items:center;\n /* Lets a step's own box grow to fill a --step-container-flex share of the\n Stepper row — a prerequisite for the separator below to have any free\n space to grow into. Default 0 keeps a step sized to its content. */flex-grow:var(--step-flex-grow, 0);}.step-vertical.svelte-z5hug7 {--step-flex-direction: column;align-items:flex-start;}\n\n /* Mirrors Stepper.svelte's per-status remapping so a bare Step themes itself. Only the\n tokens Step actually renders are set here; the separator is Stepper's to draw. Each\n chain terminates in the same literal Stepper uses, so the two agree by construction. */.status-completed.svelte-z5hug7 {--step-text-color: var(--step-text-completed-color, #24aa5a);--step-index-container-background-color: var(\n --step-index-container-completed-background-color,\n #24aa5a\n );--step-index-container-border: var(--step-index-container-completed-border, none);}.status-active.svelte-z5hug7 {--step-text-color: var(--step-text-active-color, #2f3841);--step-index-container-background-color: var(\n --step-index-container-active-background-color,\n #2f3841\n );--step-index-container-border: var(--step-index-container-active-border, none);}.status-failure.svelte-z5hug7 {--step-text-color: var(--step-text-failure-color, #e53935);--step-index-container-background-color: var(\n --step-index-container-failure-background-color,\n var(--stepper-status-failure-color, #e53935)\n );--step-index-container-border: var(--step-index-container-failure-border, none);}.status-in-progress.svelte-z5hug7 {--step-text-color: var(--step-text-in-progress-color, #f59e0b);--step-index-container-background-color: var(\n --step-index-container-in-progress-background-color,\n var(--stepper-status-in-progress-color, #f59e0b)\n );--step-index-container-border: var(--step-index-container-in-progress-border, none);}.status-muted.svelte-z5hug7 {--step-text-color: var(--step-text-muted-color, #667080);--step-index-container-background-color: var(\n --step-index-container-muted-background-color,\n #c9d2db\n );\n /* The circle is pale, so the numeral cannot inherit the white used on every other\n status — that measured 1.53:1. #2f3841 is the same literal the active status\n already uses for text, and reads at 7.79:1 here. */--step-index-color: var(--step-index-muted-color, #2f3841);--step-index-container-border: var(--step-index-container-muted-border, none);--step-index-container-height: var(--step-index-container-muted-height, 20px);--step-index-container-width: var(--step-index-container-muted-width, 20px);--step-index-font-size: var(--step-index-muted-font-size, 10px);}\n\n /* status-pending sets nothing — it is the neutral default already in .step-index-container. */.step-index-container.svelte-z5hug7 {display:flex;justify-content:center;align-items:center;height:var(--step-index-container-height, 30px);width:var(--step-index-container-width, 30px);border-radius:var(--step-index-container-radius, 50%);background-color:var(--step-index-container-background-color, #798fa5cc);\n /* No border today, so the fallback is `none` — an existing consumer that sets\n nothing renders byte-identically. Shared with .step-icon-container below so\n a status override (see Stepper.svelte) themes the circle whichever of the\n two mutually-exclusive renders is showing. */border:var(--step-index-container-border, none);color:var(--step-index-color, white);flex-shrink:0;}.step-icon-container.svelte-z5hug7 {display:flex;justify-content:center;align-items:center;height:var(--step-index-container-height, 30px);width:var(--step-index-container-width, 30px);border-radius:var(--step-index-container-radius, 50%);background-color:var(--step-index-container-background-color, #798fa5cc);border:var(--step-index-container-border, none);flex-shrink:0;overflow:hidden;}.step-icon.svelte-z5hug7 {width:var(--step-icon-size, 18px);height:var(--step-icon-size, 18px);object-fit:contain;}.step-spinner.svelte-z5hug7 {width:var(--step-spinner-size, 18px);height:var(--step-spinner-size, 18px);\n animation: svelte-z5hug7-stepper-spin 0.8s linear infinite;}\n\n @keyframes svelte-z5hug7-stepper-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }.separator.svelte-z5hug7 {display:var(--stepper-separator-display, var(--separator-display, block));height:var(--stepper-separator-height, var(--separator-height, 1px));width:var(--stepper-separator-width, var(--separator-width, 50px));\n /* 0 keeps the separator pinned to its width above; set alongside --step-flex-grow\n and --step-container-flex to let it stretch into a card's remaining width. */flex-grow:var(--stepper-separator-flex-grow, 0);margin:var(--stepper-separator-margin, var(--separator-margin, 0px 12px 0px 12px));background-image:var(\n --stepper-separator-background-image,\n var(\n --separator-background-image,\n repeating-linear-gradient(\n to right,\n var(\n --stepper-separator-background-image-color,\n var(--separator-background-image-color, #798fa5cc)\n ),\n var(\n --stepper-separator-background-image-color,\n var(--separator-background-image-color, #798fa5cc)\n )\n 6px,\n transparent 6px,\n transparent 10px\n )\n )\n );}.step-vertical.svelte-z5hug7 .separator:where(.svelte-z5hug7) {height:var(--stepper-separator-vertical-height, 32px);width:var(--stepper-separator-vertical-width, 1px);margin:var(--stepper-separator-vertical-margin, 4px 0px 4px 14px);background-image:repeating-linear-gradient(\n to bottom,\n var(\n --stepper-separator-background-image-color,\n var(--separator-background-image-color, #798fa5cc)\n ),\n var(\n --stepper-separator-background-image-color,\n var(--separator-background-image-color, #798fa5cc)\n )\n 6px,\n transparent 6px,\n transparent 10px\n );}.step-text.svelte-z5hug7 {margin:var(--step-text-margin, 0px 0px 0px 12px);font-size:var(--step-text-font-size, 12px);\n /* No font-weight is set today, so the div inherits the browser default\n `normal` — that is the literal fallback, keeping an existing consumer\n byte-identical. */font-weight:var(--step-text-font-weight, normal);color:var(--step-text-color, #798fa5cc);}.step-vertical.svelte-z5hug7 .step-text:where(.svelte-z5hug7) {margin:var(--step-text-vertical-margin, 4px 0px 0px 0px);}.step-index-text.svelte-z5hug7 {font-size:var(--step-index-font-size, 14px);color:var(--step-index-color, white);}.step-badge.svelte-z5hug7 {margin:var(--step-badge-margin, 0 0 0 4px);}.step-vertical.svelte-z5hug7 .step-badge:where(.svelte-z5hug7) {margin:var(--step-badge-vertical-margin, 4px 0 0 0);}"
11335
11386
  };
11336
11387
  function Step(e, t) {
11388
+ let n = props_id();
11337
11389
  push(t, !0), append_styles$1(e, $$css$54);
11338
- let n = prop(t, "stepIndex", 7), i = prop(t, "label", 7), a = prop(t, "icon", 7), o = prop(t, "status", 7), s = prop(t, "badge", 7), c = prop(t, "orientation", 7, "horizontal"), l = prop(t, "classes", 7), u = prop(t, "ariaLabel", 7), f = prop(t, "testId", 7), p = prop(t, "suppressRoleAndTabindex", 7), h = prop(t, "onclick", 7), S = prop(t, "onkeydown", 7), C = () => {
11339
- h()?.({ selectedIndex: n() });
11340
- }, k = (e) => {
11341
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), C()), S()?.(e);
11342
- }, R = /* @__PURE__ */ user_derived(() => c() === "vertical"), G = /* @__PURE__ */ user_derived(() => [
11390
+ let i = prop(t, "stepIndex", 7), a = prop(t, "label", 7), o = prop(t, "icon", 7), s = prop(t, "status", 7), c = prop(t, "badge", 7), l = prop(t, "orientation", 7, "horizontal"), u = prop(t, "classes", 7), f = prop(t, "ariaLabel", 7), p = prop(t, "testId", 7), h = prop(t, "suppressRoleAndTabindex", 7), S = prop(t, "onclick", 7), C = prop(t, "onkeydown", 7), k = `step-label-${n}`, R = () => {
11391
+ S()?.({ selectedIndex: i() });
11392
+ }, G = (e) => {
11393
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), R()), C()?.(e);
11394
+ }, te = /* @__PURE__ */ user_derived(() => l() === "vertical"), ne = /* @__PURE__ */ user_derived(() => [
11343
11395
  "step",
11344
- get(R) ? "step-vertical" : "",
11345
- l() ?? ""
11396
+ get(te) ? "step-vertical" : "",
11397
+ u() ?? ""
11346
11398
  ].filter((e) => e.length > 0).join(" "));
11347
- var te = {
11399
+ var re = {
11348
11400
  get stepIndex() {
11349
- return n();
11401
+ return i();
11350
11402
  },
11351
11403
  set stepIndex(e) {
11352
- n(e), flushSync();
11404
+ i(e), flushSync();
11353
11405
  },
11354
11406
  get label() {
11355
- return i();
11407
+ return a();
11356
11408
  },
11357
11409
  set label(e) {
11358
- i(e), flushSync();
11410
+ a(e), flushSync();
11359
11411
  },
11360
11412
  get icon() {
11361
- return a();
11413
+ return o();
11362
11414
  },
11363
11415
  set icon(e) {
11364
- a(e), flushSync();
11416
+ o(e), flushSync();
11365
11417
  },
11366
11418
  get status() {
11367
- return o();
11419
+ return s();
11368
11420
  },
11369
11421
  set status(e) {
11370
- o(e), flushSync();
11422
+ s(e), flushSync();
11371
11423
  },
11372
11424
  get badge() {
11373
- return s();
11425
+ return c();
11374
11426
  },
11375
11427
  set badge(e) {
11376
- s(e), flushSync();
11428
+ c(e), flushSync();
11377
11429
  },
11378
11430
  get orientation() {
11379
- return c();
11431
+ return l();
11380
11432
  },
11381
11433
  set orientation(e = "horizontal") {
11382
- c(e), flushSync();
11434
+ l(e), flushSync();
11383
11435
  },
11384
11436
  get classes() {
11385
- return l();
11437
+ return u();
11386
11438
  },
11387
11439
  set classes(e) {
11388
- l(e), flushSync();
11440
+ u(e), flushSync();
11389
11441
  },
11390
11442
  get ariaLabel() {
11391
- return u();
11443
+ return f();
11392
11444
  },
11393
11445
  set ariaLabel(e) {
11394
- u(e), flushSync();
11446
+ f(e), flushSync();
11395
11447
  },
11396
11448
  get testId() {
11397
- return f();
11449
+ return p();
11398
11450
  },
11399
11451
  set testId(e) {
11400
- f(e), flushSync();
11452
+ p(e), flushSync();
11401
11453
  },
11402
11454
  get suppressRoleAndTabindex() {
11403
- return p();
11455
+ return h();
11404
11456
  },
11405
11457
  set suppressRoleAndTabindex(e) {
11406
- p(e), flushSync();
11458
+ h(e), flushSync();
11407
11459
  },
11408
11460
  get onclick() {
11409
- return h();
11461
+ return S();
11410
11462
  },
11411
11463
  set onclick(e) {
11412
- h(e), flushSync();
11464
+ S(e), flushSync();
11413
11465
  },
11414
11466
  get onkeydown() {
11415
- return S();
11467
+ return C();
11416
11468
  },
11417
11469
  set onkeydown(e) {
11418
- S(e), flushSync();
11470
+ C(e), flushSync();
11419
11471
  }
11420
- }, ne = root_4$29();
11421
- let re;
11422
- var be = child(ne), Me = (e) => {
11472
+ }, be = root_4$29();
11473
+ let Me;
11474
+ var Re = child(be), Ue = (e) => {
11423
11475
  var t = root$54(), n = child(t);
11424
- reset(t), template_effect(() => set_attribute(n, "src", a())), append(e, t);
11425
- }, Re = (e) => {
11476
+ reset(t), template_effect(() => set_attribute(n, "src", o())), append(e, t);
11477
+ }, it = (e) => {
11426
11478
  append(e, root_1$47());
11427
- }, Ue = (e) => {
11428
- var t = root_2$38(), i = child(t), a = child(i, !0);
11429
- reset(i), reset(t), template_effect(() => set_text(a, n())), append(e, t);
11479
+ }, at = (e) => {
11480
+ var t = root_2$38(), n = child(t), a = child(n, !0);
11481
+ reset(n), reset(t), template_effect(() => set_text(a, i())), append(e, t);
11430
11482
  };
11431
- if_block(be, (e) => {
11432
- typeof a() == "string" && a().length > 0 ? e(Me) : o() === "in-progress" ? e(Re, 1) : e(Ue, -1);
11483
+ if_block(Re, (e) => {
11484
+ typeof o() == "string" && o().length > 0 ? e(Ue) : s() === "in-progress" ? e(it, 1) : e(at, -1);
11433
11485
  });
11434
- var it = sibling(be, 2), at = child(it, !0);
11435
- reset(it);
11436
- var ot = sibling(it, 2), ct = (e) => {
11486
+ var ot = sibling(Re, 2), ct = child(ot, !0);
11487
+ reset(ot);
11488
+ var lt = sibling(ot, 2), ut = (e) => {
11437
11489
  var t = root_3$35();
11438
- snippet(child(t), s), reset(t), append(e, t);
11490
+ snippet(child(t), c), reset(t), append(e, t);
11439
11491
  };
11440
- return if_block(ot, (e) => {
11441
- typeof s() == "function" && e(ct);
11442
- }), next(2), reset(ne), template_effect(() => {
11443
- re = set_class(ne, 1, clsx(get(G)), "svelte-z5hug7", re, {
11444
- "status-completed": o() === "completed",
11445
- "status-active": o() === "active",
11446
- "status-failure": o() === "failure",
11447
- "status-in-progress": o() === "in-progress",
11448
- "status-muted": o() === "muted"
11449
- }), set_attribute(ne, "data-pw", typeof f() == "string" ? f() : null), set_attribute(ne, "testid", typeof f() == "string" ? f() : null), set_attribute(ne, "role", p() ? null : "button"), set_attribute(ne, "tabindex", p() ? null : 0), set_attribute(ne, "aria-label", u() ?? null), set_attribute(ne, "aria-labelledby", u() ? null : `step-label-${n()}`), set_attribute(ne, "aria-current", o() === "active" ? "step" : null), set_attribute(it, "id", `step-label-${n() ?? ""}`), set_text(at, i());
11450
- }), delegated("click", ne, C), delegated("keydown", ne, k), append(e, ne), pop(te);
11492
+ return if_block(lt, (e) => {
11493
+ typeof c() == "function" && e(ut);
11494
+ }), next(2), reset(be), template_effect(() => {
11495
+ Me = set_class(be, 1, clsx(get(ne)), "svelte-z5hug7", Me, {
11496
+ "status-completed": s() === "completed",
11497
+ "status-active": s() === "active",
11498
+ "status-failure": s() === "failure",
11499
+ "status-in-progress": s() === "in-progress",
11500
+ "status-muted": s() === "muted"
11501
+ }), set_attribute(be, "data-pw", typeof p() == "string" ? p() : null), set_attribute(be, "testid", typeof p() == "string" ? p() : null), set_attribute(be, "role", h() ? null : "button"), set_attribute(be, "tabindex", h() ? null : 0), set_attribute(be, "aria-label", f() ?? null), set_attribute(be, "aria-labelledby", f() ? null : k), set_attribute(be, "aria-current", s() === "active" ? "step" : null), set_attribute(ot, "id", k), set_text(ct, a());
11502
+ }), delegated("click", be, R), delegated("keydown", be, G), append(e, be), pop(re);
11451
11503
  }
11452
11504
  delegate(["click", "keydown"]), create_custom_element(Step, {
11453
11505
  stepIndex: {},
@@ -14133,81 +14185,93 @@ delegate(["click"]), customElements.define("sui-file-input", create_custom_eleme
14133
14185
  }, ["trigger"], [], { mode: "open" }));
14134
14186
  //#endregion
14135
14187
  //#region src/lib/ContextMenu/ContextMenu.svelte
14136
- var root$40 = /* @__PURE__ */ from_html("<div class=\"context-menu-separator svelte-1hf60pq\" role=\"separator\"></div>"), root_1$36 = /* @__PURE__ */ from_html("<img class=\"context-menu-item-icon svelte-1hf60pq\" alt=\"\"/>"), root_2$30 = /* @__PURE__ */ from_html("<span class=\"context-menu-item-shortcut svelte-1hf60pq\"> </span>"), root_3$28 = /* @__PURE__ */ from_html("<div role=\"menuitem\"><!> <span class=\"context-menu-item-label svelte-1hf60pq\"> </span> <!></div>"), root_4$24 = /* @__PURE__ */ from_html("<div class=\"context-menu-dropdown svelte-1hf60pq\" role=\"menu\" tabindex=\"-1\"></div>"), root_5$22 = /* @__PURE__ */ from_html("<div role=\"application\"><!></div> <!>", 1), $$css$41 = {
14188
+ var root$40 = /* @__PURE__ */ from_html("<div class=\"context-menu-separator svelte-1hf60pq\" role=\"separator\"></div>"), root_1$36 = /* @__PURE__ */ from_html("<img class=\"context-menu-item-icon svelte-1hf60pq\" alt=\"\"/>"), root_2$30 = /* @__PURE__ */ from_html("<span class=\"context-menu-item-shortcut svelte-1hf60pq\"> </span>"), root_3$28 = /* @__PURE__ */ from_html("<div role=\"menuitem\"><!> <span class=\"context-menu-item-label svelte-1hf60pq\"> </span> <!></div>"), root_4$24 = /* @__PURE__ */ from_html("<div class=\"context-menu-dropdown svelte-1hf60pq\" role=\"menu\" tabindex=\"-1\"></div>"), root_5$22 = /* @__PURE__ */ from_html("<div><!></div> <!>", 1), $$css$41 = {
14137
14189
  hash: "svelte-1hf60pq",
14138
14190
  code: ".context-menu-container.svelte-1hf60pq {display:var(--context-menu-container-display, contents);}.context-menu-dropdown.svelte-1hf60pq {position:fixed;z-index:var(--context-menu-z-index, 1000);background-color:var(--context-menu-background-color, #ffffff);border:var(--context-menu-border, 1px solid #e0e0e0);border-radius:var(--context-menu-border-radius, var(--radius, 4px));box-shadow:var(--context-menu-box-shadow, 0px 4px 16px rgba(0, 0, 0, 0.12));min-width:var(--context-menu-min-width, 160px);max-height:var(--context-menu-max-height, 240px);overflow-y:auto;padding:var(--context-menu-padding, 4px 0);font-family:var(--context-menu-font-family, inherit);font-size:var(--context-menu-font-size, 14px);}.context-menu-item.svelte-1hf60pq {display:flex;align-items:center;padding:var(--context-menu-item-padding, 8px 12px);cursor:pointer;color:var(--context-menu-item-color, #333333);background-color:var(--context-menu-item-background-color, transparent);gap:var(--context-menu-item-gap, 8px);white-space:var(--context-menu-item-white-space, nowrap);-webkit-tap-highlight-color:transparent;}.context-menu-item.svelte-1hf60pq:hover {background-color:var(--context-menu-item-hover-background-color, #f5f5f5);color:var(--context-menu-item-hover-color, var(--context-menu-item-color, #333333));}.context-menu-item.svelte-1hf60pq:focus {background-color:var(--context-menu-item-focus-background-color, #f0f0f0);outline:var(--context-menu-item-focus-outline, none);}.context-menu-item-danger.svelte-1hf60pq {color:var(--context-menu-item-danger-color, #dc3545);}.context-menu-item-danger.svelte-1hf60pq:hover {background-color:var(--context-menu-item-danger-hover-background-color, #fff0f0);color:var(\n --context-menu-item-danger-hover-color,\n var(--context-menu-item-danger-color, #dc3545)\n );}.context-menu-item-danger.svelte-1hf60pq:focus {background-color:var(--context-menu-item-danger-focus-background-color, #fff0f0);}.context-menu-item-disabled.svelte-1hf60pq {opacity:var(--context-menu-item-disabled-opacity, 0.4);cursor:var(--context-menu-item-disabled-cursor, not-allowed);pointer-events:none;}.context-menu-separator.svelte-1hf60pq {height:var(--context-menu-separator-height, 1px);background-color:var(--context-menu-separator-color, #e0e0e0);margin:var(--context-menu-separator-margin, 4px 0);}.context-menu-item-icon.svelte-1hf60pq {height:var(--context-menu-item-icon-height, 16px);width:var(--context-menu-item-icon-width, 16px);flex-shrink:0;}.context-menu-item-label.svelte-1hf60pq {flex:1;font-weight:var(--context-menu-item-font-weight, 400);line-height:var(--context-menu-item-line-height, 1.4);}.context-menu-item-shortcut.svelte-1hf60pq {color:var(--context-menu-item-shortcut-color, #999999);font-size:var(--context-menu-item-shortcut-font-size, 12px);font-weight:var(--context-menu-item-shortcut-font-weight, 400);margin-left:var(--context-menu-item-shortcut-margin-left, 16px);}"
14139
14191
  };
14140
14192
  function ContextMenu(e, t) {
14141
14193
  push(t, !0), append_styles$1(e, $$css$41);
14142
- let n = prop(t, "items", 7), i = prop(t, "open", 15, !1), a = prop(t, "maxHeight", 7, "240px"), o = prop(t, "testId", 7), s = prop(t, "children", 7), c = prop(t, "onselect", 7), l = prop(t, "onopen", 7), u = prop(t, "onclose", 7), f = prop(t, "classes", 7), p = /* @__PURE__ */ state(null), h = /* @__PURE__ */ state(null), S = /* @__PURE__ */ state(-1), C = /* @__PURE__ */ state(0), k = /* @__PURE__ */ state(0), R = /* @__PURE__ */ user_derived(() => n().filter((e) => !e.separator && !e.disabled));
14143
- function G(e, t) {
14144
- set(C, e, !0), set(k, t, !0), i(!0), set(S, 0), l()?.(), requestAnimationFrame(() => {
14145
- re(), be(0);
14194
+ let n = prop(t, "items", 7), i = prop(t, "open", 15, !1), a = prop(t, "maxHeight", 7, "240px"), o = prop(t, "testId", 7), s = prop(t, "children", 7), c = prop(t, "onselect", 7), l = prop(t, "onopen", 7), u = prop(t, "onclose", 7), f = prop(t, "classes", 7), p = /* @__PURE__ */ state(null), h = /* @__PURE__ */ state(null), S = /* @__PURE__ */ state(-1), C = /* @__PURE__ */ state(0), k = /* @__PURE__ */ state(0), R = /* @__PURE__ */ state(null), G = /* @__PURE__ */ user_derived(() => n().filter((e) => !e.separator && !e.disabled)), te = null;
14195
+ function ne() {
14196
+ te !== null && (cancelAnimationFrame(te), te = null);
14197
+ }
14198
+ function re(e, t) {
14199
+ set(C, e, !0), set(k, t, !0), i(!0), set(S, 0), l()?.(), ne(), te = requestAnimationFrame(() => {
14200
+ te = null, Re(), Ue(0);
14146
14201
  });
14147
14202
  }
14148
- function te() {
14149
- i(!1), set(S, -1), u()?.();
14203
+ function be() {
14204
+ ne(), i(!1), set(S, -1), u()?.();
14205
+ let e = get(R);
14206
+ if (set(R, null), e === null) return;
14207
+ let t = document.activeElement;
14208
+ (t === null || t === document.body || (get(p)?.contains(t) ?? !1)) && e.focus();
14150
14209
  }
14151
- function ne(e) {
14152
- e.disabled || (c()?.(e), te());
14210
+ function Me(e) {
14211
+ e.disabled || (c()?.(e), be());
14153
14212
  }
14154
- function re() {
14213
+ function Re() {
14155
14214
  if (get(p) === null) return;
14156
14215
  let e = get(p).getBoundingClientRect(), t = window.innerWidth, n = window.innerHeight;
14157
14216
  get(C) + e.width > t && set(C, t - e.width - 4), get(k) + e.height > n && set(k, n - e.height - 4), get(C) < 0 && set(C, 4), get(k) < 0 && set(k, 4);
14158
14217
  }
14159
- function be(e) {
14218
+ function Ue(e) {
14160
14219
  if (get(p) === null) return;
14161
14220
  let t = get(p).querySelectorAll("[role=\"menuitem\"]:not([aria-disabled=\"true\"])");
14162
14221
  e >= 0 && e < t.length && t[e].focus();
14163
14222
  }
14164
- function Me(e) {
14165
- return get(R).indexOf(e);
14223
+ function it(e) {
14224
+ return get(G).indexOf(e);
14166
14225
  }
14167
- function Re(e) {
14168
- e.preventDefault(), G(e.clientX, e.clientY);
14226
+ function at(e) {
14227
+ e.preventDefault();
14228
+ let t = document.activeElement;
14229
+ set(R, t instanceof HTMLElement && t !== document.body ? t : null, !0), re(e.clientX, e.clientY);
14169
14230
  }
14170
- function Ue(e) {
14231
+ function ot(e) {
14171
14232
  switch (e.key) {
14172
14233
  case "ArrowDown": {
14173
14234
  e.preventDefault();
14174
14235
  let t = get(S) + 1;
14175
- set(S, t >= get(R).length ? 0 : t, !0), be(get(S));
14236
+ set(S, t >= get(G).length ? 0 : t, !0), Ue(get(S));
14176
14237
  break;
14177
14238
  }
14178
14239
  case "ArrowUp": {
14179
14240
  e.preventDefault();
14180
14241
  let t = get(S) - 1;
14181
- set(S, t < 0 ? get(R).length - 1 : t, !0), be(get(S));
14242
+ set(S, t < 0 ? get(G).length - 1 : t, !0), Ue(get(S));
14182
14243
  break;
14183
14244
  }
14184
14245
  case "Home":
14185
- e.preventDefault(), set(S, 0), be(get(S));
14246
+ e.preventDefault(), set(S, 0), Ue(get(S));
14186
14247
  break;
14187
14248
  case "End":
14188
- e.preventDefault(), set(S, get(R).length - 1), be(get(S));
14249
+ e.preventDefault(), set(S, get(G).length - 1), Ue(get(S));
14189
14250
  break;
14190
14251
  case "Enter":
14191
14252
  case " ":
14192
- e.preventDefault(), get(S) >= 0 && get(S) < get(R).length && ne(get(R)[get(S)]);
14253
+ e.preventDefault(), get(S) >= 0 && get(S) < get(G).length && Me(get(G)[get(S)]);
14193
14254
  break;
14194
14255
  case "Escape":
14195
- e.preventDefault(), te();
14256
+ e.preventDefault(), be();
14196
14257
  break;
14197
14258
  case "Tab":
14198
- te();
14259
+ be();
14199
14260
  break;
14200
14261
  }
14201
14262
  }
14202
- function it(e) {
14203
- e.target instanceof Node && get(p) && !get(p).contains(e.target) && te();
14263
+ function ct(e) {
14264
+ e.target instanceof Node && get(p) && !get(p).contains(e.target) && be();
14265
+ }
14266
+ function lt(e) {
14267
+ i() && e.key === "Escape" && (e.preventDefault(), be());
14204
14268
  }
14205
14269
  onMount(() => {
14206
- document.addEventListener("click", it);
14270
+ document.addEventListener("click", ct), document.addEventListener("keydown", lt);
14207
14271
  }), onDestroy(() => {
14208
- typeof window < "u" && document.removeEventListener("click", it);
14272
+ typeof window < "u" && (document.removeEventListener("click", ct), document.removeEventListener("keydown", lt));
14209
14273
  });
14210
- var at = {
14274
+ var ut = {
14211
14275
  get items() {
14212
14276
  return n();
14213
14277
  },
@@ -14262,14 +14326,22 @@ function ContextMenu(e, t) {
14262
14326
  set classes(e) {
14263
14327
  f(e), flushSync();
14264
14328
  }
14265
- }, ot = root_5$22(), ct = first_child(ot), lt = child(ct), ut = (e) => {
14329
+ }, dt = root_5$22(), ft = first_child(dt);
14330
+ attribute_effect(ft, () => ({
14331
+ class: `context-menu-container ${f() ?? "" ?? ""}`,
14332
+ oncontextmenu: at,
14333
+ ...i() ? { role: "application" } : {},
14334
+ "data-pw": o(),
14335
+ testID: o()
14336
+ }), void 0, void 0, void 0, "svelte-1hf60pq");
14337
+ var pt = child(ft), mt = (e) => {
14266
14338
  var t = comment();
14267
14339
  snippet(first_child(t), s), append(e, t);
14268
14340
  };
14269
- if_block(lt, (e) => {
14270
- typeof s() == "function" && e(ut);
14271
- }), reset(ct), bind_this(ct, (e) => set(h, e), () => get(h));
14272
- var dt = sibling(ct, 2), ft = (e) => {
14341
+ if_block(pt, (e) => {
14342
+ typeof s() == "function" && e(mt);
14343
+ }), reset(ft), bind_this(ft, (e) => set(h, e), () => get(h));
14344
+ var ht = sibling(ft, 2), gt = (e) => {
14273
14345
  var t = root_4$24();
14274
14346
  each(t, 21, n, (e) => e.value, (e, t) => {
14275
14347
  var n = comment(), i = first_child(n), a = (e) => {
@@ -14297,28 +14369,22 @@ function ContextMenu(e, t) {
14297
14369
  "context-menu-item-danger": get(t).danger,
14298
14370
  "context-menu-item-disabled": get(t).disabled
14299
14371
  }), set_attribute(n, "tabindex", get(t).disabled ? -1 : 0), set_attribute(n, "aria-disabled", get(t).disabled ? "true" : null), set_attribute(n, "data-pw", o() ? `${o()}-item-${get(t).value}` : null), set_attribute(n, "testid", o() ? `${o()}-item-${get(t).value}` : null), set_text(l, get(t).label);
14300
- }), delegated("click", n, () => ne(get(t))), delegated("keydown", n, (e) => {
14301
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), ne(get(t)));
14372
+ }), delegated("click", n, () => Me(get(t))), delegated("keydown", n, (e) => {
14373
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Me(get(t)));
14302
14374
  }), event("focus", n, () => {
14303
- get(t).disabled || set(S, Me(get(t)), !0);
14375
+ get(t).disabled || set(S, it(get(t)), !0);
14304
14376
  }), append(e, n);
14305
14377
  };
14306
14378
  if_block(i, (e) => {
14307
14379
  get(t).separator ? e(a) : e(s, -1);
14308
14380
  }), append(e, n);
14309
- }), reset(t), bind_this(t, (e) => set(p, e), () => get(p)), template_effect(() => set_style(t, `left: ${get(C) ?? ""}px; top: ${get(k) ?? ""}px; --context-menu-max-height: ${a() ?? ""};`)), delegated("keydown", t, Ue), append(e, t);
14381
+ }), reset(t), bind_this(t, (e) => set(p, e), () => get(p)), template_effect(() => set_style(t, `left: ${get(C) ?? ""}px; top: ${get(k) ?? ""}px; --context-menu-max-height: ${a() ?? ""};`)), delegated("keydown", t, ot), append(e, t);
14310
14382
  };
14311
- return if_block(dt, (e) => {
14312
- i() && e(ft);
14313
- }), template_effect(() => {
14314
- set_class(ct, 1, `context-menu-container ${f() ?? "" ?? ""}`, "svelte-1hf60pq"), set_attribute(ct, "data-pw", o()), set_attribute(ct, "testid", o());
14315
- }), delegated("contextmenu", ct, Re), append(e, ot), pop(at);
14383
+ return if_block(ht, (e) => {
14384
+ i() && e(gt);
14385
+ }), append(e, dt), pop(ut);
14316
14386
  }
14317
- delegate([
14318
- "contextmenu",
14319
- "keydown",
14320
- "click"
14321
- ]), create_custom_element(ContextMenu, {
14387
+ delegate(["keydown", "click"]), create_custom_element(ContextMenu, {
14322
14388
  items: {},
14323
14389
  open: {},
14324
14390
  maxHeight: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "4.9.2",
3
+ "version": "4.10.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",