@juspay/svelte-ui-components 4.53.1 → 4.54.1

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.
@@ -134,15 +134,27 @@
134
134
  let slashSelected = $state(0);
135
135
  let slashList: HTMLUListElement | null = $state(null);
136
136
 
137
+ // A command opens on the first character of its name: "/model" on "/",
138
+ // "@support" on "@". Letters, digits and whitespace never trigger, so a
139
+ // plain word typed into the composer never opens the menu. Read as a whole
140
+ // code point, so an emoji trigger is never split into half a surrogate pair.
141
+ function slashTrigger(text: string): string | null {
142
+ const [first = ''] = text;
143
+ return /^[^\p{L}\p{N}\s]$/u.test(first) ? first : null;
144
+ }
145
+
137
146
  const slashMatches = $derived.by((): ChatComposerSlashCommand[] => {
138
- if (slashCommands === null || slashDismissed || !/^\/\S*$/.test(value)) {
147
+ const trigger = slashTrigger(value);
148
+ if (slashCommands === null || slashDismissed || trigger === null || /\s/.test(value)) {
139
149
  return [];
140
150
  }
141
151
  const query = value.toLowerCase();
142
152
  return slashCommands.filter(
143
153
  (command) =>
144
- command.name.toLowerCase().startsWith(query) ||
145
- (query.length > 1 && (command.description ?? '').toLowerCase().includes(query.slice(1)))
154
+ slashTrigger(command.name) === trigger &&
155
+ (command.name.toLowerCase().startsWith(query) ||
156
+ (query.length > trigger.length &&
157
+ (command.description ?? '').toLowerCase().includes(query.slice(trigger.length))))
146
158
  );
147
159
  });
148
160
  const slashArg = $derived.by(
@@ -150,8 +162,8 @@
150
162
  if (slashCommands === null || slashDismissed) {
151
163
  return null;
152
164
  }
153
- const parsed = /^(\/\S+)\s(\S*)$/.exec(value);
154
- if (parsed === null) {
165
+ const parsed = /^(\S+)\s(\S*)$/.exec(value);
166
+ if (parsed === null || slashTrigger(parsed[1] ?? '') === null) {
155
167
  return null;
156
168
  }
157
169
  const name = (parsed[1] ?? '').toLowerCase();
@@ -100,9 +100,11 @@ export type OptionalChatComposerProperties = {
100
100
  /** Test id on the status region (see `statusText`). */
101
101
  statusTestId?: string;
102
102
  /**
103
- * Opt-in slash-command menu. With commands passed, typing "/" opens a
104
- * listbox of the ones that match (name prefix, or the text after "/" found
105
- * in a description); arrows move, Tab completes, Enter picks (Enter on a
103
+ * Opt-in slash-command menu. With commands passed, typing a command's
104
+ * trigger -- the first character of its name, "/" for "/model" or "@" for
105
+ * "@support" -- opens a listbox of the commands sharing that trigger that
106
+ * match (name prefix, or the text after the trigger found in a
107
+ * description); arrows move, Tab completes, Enter picks (Enter on a
106
108
  * complete match submits), Escape dismisses -- through the shared
107
109
  * dismissible stack, so an overlay above the composer closes first. A
108
110
  * command with `choices` keeps the menu open past the space for a second
@@ -197,7 +199,11 @@ export type ChatComposerSlashCommandChoice = {
197
199
  };
198
200
  /** One entry of ChatComposer's slash-command menu. */
199
201
  export type ChatComposerSlashCommand = {
200
- /** Including the slash, e.g. "/model". */
202
+ /**
203
+ * Including its trigger character, e.g. "/model" or "@support". The first
204
+ * character opens the menu, so it must be punctuation or a symbol: a name
205
+ * starting with a letter, digit or space is never offered.
206
+ */
201
207
  name: string;
202
208
  description?: string;
203
209
  /** Shown after the name, e.g. "[model]". */
@@ -134,6 +134,14 @@
134
134
  transform: rotate(90deg);
135
135
  }
136
136
 
137
+ /* The rotate still happens. Only the 120ms slide is removed, so a reduced-motion
138
+ user gets the open or closed chevron immediately instead of watching it turn. */
139
+ @media (prefers-reduced-motion: reduce) {
140
+ .chevron {
141
+ transition: none;
142
+ }
143
+ }
144
+
137
145
  .counts {
138
146
  display: flex;
139
147
  gap: var(--diff-small-gap, 8px);
package/dist/utils.js CHANGED
@@ -444,7 +444,15 @@ export function acquireScrollLock(container = typeof document === 'undefined' ?
444
444
  export function resolveScrollContainer(node, container) {
445
445
  const resolved = typeof container === 'function' ? container() : container;
446
446
  if (typeof resolved === 'object') {
447
- return resolved !== null && resolved.nodeType === 1 && typeof resolved.style === 'object'
447
+ // A custom-element Object property can be a JSON lookalike with nodeType 1
448
+ // and a plain style object. acquireScrollLock calls style.setProperty, so
449
+ // that lookalike must resolve to null instead of throwing.
450
+ return resolved !== null &&
451
+ resolved.nodeType === 1 &&
452
+ typeof resolved.getRootNode === 'function' &&
453
+ typeof resolved.style === 'object' &&
454
+ resolved.style !== null &&
455
+ typeof resolved.style.setProperty === 'function'
448
456
  ? resolved
449
457
  : null;
450
458
  }
package/dist-wc/index.js CHANGED
@@ -7114,7 +7114,7 @@ function acquireScrollLock(e = typeof document > "u" ? null : document.body) {
7114
7114
  }
7115
7115
  function resolveScrollContainer(e, t) {
7116
7116
  let n = typeof t == "function" ? t() : t;
7117
- return typeof n == "object" ? n !== null && n.nodeType === 1 && typeof n.style == "object" ? n : null : t === void 0 ? e?.ownerDocument.body ?? (typeof document > "u" ? null : document.body) : null;
7117
+ return typeof n == "object" ? n !== null && n.nodeType === 1 && typeof n.getRootNode == "function" && typeof n.style == "object" && n.style !== null && typeof n.style.setProperty == "function" ? n : null : t === void 0 ? e?.ownerDocument.body ?? (typeof document > "u" ? null : document.body) : null;
7118
7118
  }
7119
7119
  function lockBodyScroll() {
7120
7120
  typeof document < "u" && bodyScrollReleases.push(acquireScrollLock(document.body));
@@ -12468,129 +12468,152 @@ var rest_excludes$80 = new Set([
12468
12468
  };
12469
12469
  function Input_wc(e, t) {
12470
12470
  push(t, !0), append_styles$1(e, $$css$160);
12471
- let n = prop(t, "inputAriaLabel", 7), i = prop(t, "inputId", 7), a = prop(t, "inputAutofocus", 7), o = /* @__PURE__ */ rest_props(t, rest_excludes$80), s = t.$$host, c = /* @__PURE__ */ user_derived(() => dispatchEvents(s, o)), l = (e) => {
12471
+ let n = (e) => {
12472
+ var n = comment(), i = first_child(n), a = (e) => {
12473
+ var n = comment();
12474
+ snippet(first_child(n), () => t.labelSuffix), append(e, n);
12475
+ }, o = (e) => {
12476
+ var n = comment();
12477
+ slot(first_child(n), t, "label-suffix", {}, null), append(e, n);
12478
+ };
12479
+ if_block(i, (e) => {
12480
+ t.labelSuffix ? e(a) : e(o, -1);
12481
+ }), append(e, n);
12482
+ }, i = prop(t, "inputAriaLabel", 7), a = prop(t, "inputId", 7), o = prop(t, "inputAutofocus", 7), s = /* @__PURE__ */ rest_props(t, rest_excludes$80), c = t.$$host, l = /* @__PURE__ */ user_derived(() => dispatchEvents(c, s)), u = (e) => {
12472
12483
  if (e == null) return null;
12473
12484
  if (typeof e == "boolean") return e;
12474
12485
  let t = String(e).trim().toLowerCase();
12475
12486
  return t === "false" ? !1 : t === "" || t === "true" || t === "spellcheck" ? !0 : null;
12476
- }, u = t.$$host.querySelector("[slot=\"left-icon\"]") !== null, f = t.$$host.querySelector("[slot=\"right-icon\"]") !== null;
12477
- var p = {
12487
+ }, f = t.$$host.querySelector("[slot=\"left-icon\"]") !== null, p = t.$$host.querySelector("[slot=\"right-icon\"]") !== null, h = t.$$host.querySelector("[slot=\"label-suffix\"]") !== null;
12488
+ var S = {
12478
12489
  get inputAriaLabel() {
12479
- return n();
12490
+ return i();
12480
12491
  },
12481
12492
  set inputAriaLabel(e) {
12482
- n(e), flushSync();
12493
+ i(e), flushSync();
12483
12494
  },
12484
12495
  get inputId() {
12485
- return i();
12496
+ return a();
12486
12497
  },
12487
12498
  set inputId(e) {
12488
- i(e), flushSync();
12499
+ a(e), flushSync();
12489
12500
  },
12490
12501
  get inputAutofocus() {
12491
- return a();
12502
+ return o();
12492
12503
  },
12493
12504
  set inputAutofocus(e) {
12494
- a(e), flushSync();
12505
+ o(e), flushSync();
12495
12506
  }
12496
- }, h = comment(), S = first_child(h), C = (e) => {
12507
+ }, C = comment(), k = first_child(C), R = (e) => {
12497
12508
  {
12498
- let s = (e) => {
12509
+ let c = (e) => {
12499
12510
  var n = comment();
12500
12511
  slot(first_child(n), t, "left-icon", {}, null), append(e, n);
12501
- }, u = (e) => {
12512
+ }, f = (e) => {
12502
12513
  var n = comment();
12503
12514
  slot(first_child(n), t, "right-icon", {}, null), append(e, n);
12504
- }, f = /* @__PURE__ */ user_derived(() => l(t.spellcheck));
12505
- Input(e, spread_props(() => o, () => get(c), {
12515
+ }, p = /* @__PURE__ */ user_derived(() => u(t.spellcheck)), S = /* @__PURE__ */ user_derived(() => h ? n : t.labelSuffix);
12516
+ Input(e, spread_props(() => s, () => get(l), {
12506
12517
  get id() {
12507
- return i();
12518
+ return a();
12508
12519
  },
12509
12520
  get ariaLabel() {
12510
- return n();
12521
+ return i();
12511
12522
  },
12512
12523
  get autofocus() {
12513
- return a();
12524
+ return o();
12514
12525
  },
12515
12526
  get spellcheck() {
12516
- return get(f);
12527
+ return get(p);
12528
+ },
12529
+ get labelSuffix() {
12530
+ return get(S);
12517
12531
  },
12518
- leftIcon: s,
12519
- rightIcon: u,
12532
+ leftIcon: c,
12533
+ rightIcon: f,
12520
12534
  $$slots: {
12521
12535
  leftIcon: !0,
12522
12536
  rightIcon: !0
12523
12537
  }
12524
12538
  }));
12525
12539
  }
12526
- }, k = (e) => {
12540
+ }, G = (e) => {
12527
12541
  {
12528
- let s = (e) => {
12542
+ let c = (e) => {
12529
12543
  var n = comment();
12530
12544
  slot(first_child(n), t, "left-icon", {}, null), append(e, n);
12531
- }, u = /* @__PURE__ */ user_derived(() => l(t.spellcheck));
12532
- Input(e, spread_props(() => o, () => get(c), {
12545
+ }, f = /* @__PURE__ */ user_derived(() => u(t.spellcheck)), p = /* @__PURE__ */ user_derived(() => h ? n : t.labelSuffix);
12546
+ Input(e, spread_props(() => s, () => get(l), {
12533
12547
  get id() {
12534
- return i();
12548
+ return a();
12535
12549
  },
12536
12550
  get ariaLabel() {
12537
- return n();
12551
+ return i();
12538
12552
  },
12539
12553
  get autofocus() {
12540
- return a();
12554
+ return o();
12541
12555
  },
12542
12556
  get spellcheck() {
12543
- return get(u);
12557
+ return get(f);
12558
+ },
12559
+ get labelSuffix() {
12560
+ return get(p);
12544
12561
  },
12545
- leftIcon: s,
12562
+ leftIcon: c,
12546
12563
  $$slots: { leftIcon: !0 }
12547
12564
  }));
12548
12565
  }
12549
- }, R = (e) => {
12566
+ }, te = (e) => {
12550
12567
  {
12551
- let s = (e) => {
12568
+ let c = (e) => {
12552
12569
  var n = comment();
12553
12570
  slot(first_child(n), t, "right-icon", {}, null), append(e, n);
12554
- }, u = /* @__PURE__ */ user_derived(() => l(t.spellcheck));
12555
- Input(e, spread_props(() => o, () => get(c), {
12571
+ }, f = /* @__PURE__ */ user_derived(() => u(t.spellcheck)), p = /* @__PURE__ */ user_derived(() => h ? n : t.labelSuffix);
12572
+ Input(e, spread_props(() => s, () => get(l), {
12556
12573
  get id() {
12557
- return i();
12574
+ return a();
12558
12575
  },
12559
12576
  get ariaLabel() {
12560
- return n();
12577
+ return i();
12561
12578
  },
12562
12579
  get autofocus() {
12563
- return a();
12580
+ return o();
12564
12581
  },
12565
12582
  get spellcheck() {
12566
- return get(u);
12583
+ return get(f);
12567
12584
  },
12568
- rightIcon: s,
12585
+ get labelSuffix() {
12586
+ return get(p);
12587
+ },
12588
+ rightIcon: c,
12569
12589
  $$slots: { rightIcon: !0 }
12570
12590
  }));
12571
12591
  }
12572
- }, G = (e) => {
12592
+ }, ne = (e) => {
12573
12593
  {
12574
- let s = /* @__PURE__ */ user_derived(() => l(t.spellcheck));
12575
- Input(e, spread_props(() => o, () => get(c), {
12594
+ let c = /* @__PURE__ */ user_derived(() => u(t.spellcheck)), f = /* @__PURE__ */ user_derived(() => h ? n : t.labelSuffix);
12595
+ Input(e, spread_props(() => s, () => get(l), {
12576
12596
  get id() {
12577
- return i();
12597
+ return a();
12578
12598
  },
12579
12599
  get ariaLabel() {
12580
- return n();
12600
+ return i();
12581
12601
  },
12582
12602
  get autofocus() {
12583
- return a();
12603
+ return o();
12584
12604
  },
12585
12605
  get spellcheck() {
12586
- return get(s);
12606
+ return get(c);
12607
+ },
12608
+ get labelSuffix() {
12609
+ return get(f);
12587
12610
  }
12588
12611
  }));
12589
12612
  }
12590
12613
  };
12591
- return if_block(S, (e) => {
12592
- u && f ? e(C) : u ? e(k, 1) : f ? e(R, 2) : e(G, -1);
12593
- }), append(e, h), pop(p);
12614
+ return if_block(k, (e) => {
12615
+ f && p ? e(R) : f ? e(G, 1) : p ? e(te, 2) : e(ne, -1);
12616
+ }), append(e, C), pop(S);
12594
12617
  }
12595
12618
  customElements.define("sui-input", create_custom_element(Input_wc, {
12596
12619
  value: {
@@ -12765,7 +12788,11 @@ customElements.define("sui-input", create_custom_element(Input_wc, {
12765
12788
  attribute: "input-autofocus",
12766
12789
  type: "Boolean"
12767
12790
  }
12768
- }, ["left-icon", "right-icon"], [], { mode: "open" }, formAssociated({ disabled: "disable" })));
12791
+ }, [
12792
+ "label-suffix",
12793
+ "left-icon",
12794
+ "right-icon"
12795
+ ], [], { mode: "open" }, formAssociated({ disabled: "disable" })));
12769
12796
  //#endregion
12770
12797
  //#region src/lib/KeyboardInput/KeyboardInput.svelte
12771
12798
  var root$82 = /* @__PURE__ */ from_html("<span class=\"separator svelte-14lwsom\"> </span>"), root_1$76 = /* @__PURE__ */ from_html("<!> <kbd class=\"key svelte-14lwsom\"> </kbd>", 1), root_2$60 = /* @__PURE__ */ from_html("<span></span>"), $$css$159 = {
@@ -13520,9 +13547,70 @@ var rest_excludes$74 = new Set([
13520
13547
  code: "\n /* A custom element defaults to `display: inline`, which has no definite\n width for a percentage to resolve against -- so a component sizing itself\n with `width: 100%` resolved against the wrong ancestor, and layout depended\n on the consumer's surrounding markup rather than on the component. The value\n matches this component's own root element (block-level), and is a token so a\n consumer can change it without reaching inside the shadow root -- which they\n could not do, since a stylesheet cannot add a rule there. */:host {display:var(--sui-progress-display, block);}"
13521
13548
  };
13522
13549
  function Progress_wc(e, t) {
13523
- append_styles$1(e, $$css$150);
13524
- let n = /* @__PURE__ */ rest_props(t, rest_excludes$74);
13525
- Progress(e, spread_props(() => n));
13550
+ push(t, !0), append_styles$1(e, $$css$150);
13551
+ let n = (e) => {
13552
+ var n = comment(), i = first_child(n), a = (e) => {
13553
+ var n = comment();
13554
+ snippet(first_child(n), () => t.leadingLabel), append(e, n);
13555
+ }, o = (e) => {
13556
+ var n = comment();
13557
+ slot(first_child(n), t, "leading-label", {}, null), append(e, n);
13558
+ };
13559
+ if_block(i, (e) => {
13560
+ t.leadingLabel ? e(a) : e(o, -1);
13561
+ }), append(e, n);
13562
+ }, i = (e) => {
13563
+ var n = comment(), i = first_child(n), a = (e) => {
13564
+ var n = comment();
13565
+ snippet(first_child(n), () => t.headerStart), append(e, n);
13566
+ }, o = (e) => {
13567
+ var n = comment();
13568
+ slot(first_child(n), t, "header-start", {}, null), append(e, n);
13569
+ };
13570
+ if_block(i, (e) => {
13571
+ t.headerStart ? e(a) : e(o, -1);
13572
+ }), append(e, n);
13573
+ }, a = (e) => {
13574
+ var n = comment(), i = first_child(n), a = (e) => {
13575
+ var n = comment();
13576
+ snippet(first_child(n), () => t.headerEnd), append(e, n);
13577
+ }, o = (e) => {
13578
+ var n = comment();
13579
+ slot(first_child(n), t, "header-end", {}, null), append(e, n);
13580
+ };
13581
+ if_block(i, (e) => {
13582
+ t.headerEnd ? e(a) : e(o, -1);
13583
+ }), append(e, n);
13584
+ }, o = (e) => {
13585
+ var n = comment(), i = first_child(n), a = (e) => {
13586
+ var n = comment();
13587
+ snippet(first_child(n), () => t.note), append(e, n);
13588
+ }, o = (e) => {
13589
+ var n = comment();
13590
+ slot(first_child(n), t, "note", {}, null), append(e, n);
13591
+ };
13592
+ if_block(i, (e) => {
13593
+ t.note ? e(a) : e(o, -1);
13594
+ }), append(e, n);
13595
+ }, s = /* @__PURE__ */ rest_props(t, rest_excludes$74), c = t.$$host.querySelector("[slot=\"leading-label\"]") !== null, l = t.$$host.querySelector("[slot=\"header-start\"]") !== null, u = t.$$host.querySelector("[slot=\"header-end\"]") !== null, f = t.$$host.querySelector("[slot=\"note\"]") !== null;
13596
+ {
13597
+ let p = /* @__PURE__ */ user_derived(() => c ? n : t.leadingLabel), h = /* @__PURE__ */ user_derived(() => l ? i : t.headerStart), S = /* @__PURE__ */ user_derived(() => u ? a : t.headerEnd), C = /* @__PURE__ */ user_derived(() => f ? o : t.note);
13598
+ Progress(e, spread_props(() => s, {
13599
+ get leadingLabel() {
13600
+ return get(p);
13601
+ },
13602
+ get headerStart() {
13603
+ return get(h);
13604
+ },
13605
+ get headerEnd() {
13606
+ return get(S);
13607
+ },
13608
+ get note() {
13609
+ return get(C);
13610
+ }
13611
+ }));
13612
+ }
13613
+ pop();
13526
13614
  }
13527
13615
  customElements.define("sui-progress", create_custom_element(Progress_wc, {
13528
13616
  value: {
@@ -13552,7 +13640,12 @@ customElements.define("sui-progress", create_custom_element(Progress_wc, {
13552
13640
  headerStart: { type: "Object" },
13553
13641
  headerEnd: { type: "Object" },
13554
13642
  note: { type: "Object" }
13555
- }, [], [], { mode: "open" }));
13643
+ }, [
13644
+ "leading-label",
13645
+ "header-start",
13646
+ "header-end",
13647
+ "note"
13648
+ ], [], { mode: "open" }));
13556
13649
  //#endregion
13557
13650
  //#region src/lib/Radio/Radio.svelte
13558
13651
  var root$78 = /* @__PURE__ */ from_html("<span> </span>"), root_1$72 = /* @__PURE__ */ from_html("<div role=\"alert\" class=\"field-error svelte-14bh706\"> </div>"), root_2$57 = /* @__PURE__ */ from_html("<div class=\"field-info svelte-14bh706\"> </div>"), root_3$51 = /* @__PURE__ */ from_html("<label><input type=\"radio\" class=\"radio-input svelte-14bh706\"/> <span><span></span></span> <!></label> <!> <!>", 1), $$css$149 = {
@@ -54780,7 +54873,7 @@ function ChatComposer(e, t) {
54780
54873
  var i = sibling(n, 2);
54781
54874
  bind_this(i, (e) => set(mn, e), () => get(mn)), reset(t), template_effect(() => {
54782
54875
  set_attribute(i, "accept", mt()), i.multiple = ht();
54783
- }), delegated("change", i, Un), append(e, t);
54876
+ }), delegated("change", i, Wn), append(e, t);
54784
54877
  };
54785
54878
  if_block(n, (e) => {
54786
54879
  get(vn) && e(i);
@@ -54794,9 +54887,9 @@ function ChatComposer(e, t) {
54794
54887
  }), append(e, t);
54795
54888
  }, a = (e) => {
54796
54889
  var t = root_3$6();
54797
- remove_textarea_child(t), bind_this(t, (e) => set(hn, e), () => get(hn)), effect(() => bind_value(t, s)), action(t, (e, t) => Gn?.(e, t), s), template_effect(() => {
54798
- set_attribute(t, "data-pw", an() ?? null), set_attribute(t, "placeholder", u()), t.disabled = get(bn), set_attribute(t, "aria-label", on() ?? (u().length > 0 ? u() : "Message")), set_attribute(t, "role", jt() === null ? null : "combobox"), set_attribute(t, "aria-expanded", jt() === null ? null : get(jn)), set_attribute(t, "aria-controls", get(jn) ? Nn : null), set_attribute(t, "aria-autocomplete", jt() === null ? null : "list"), set_attribute(t, "aria-activedescendant", get(Pn)), set_attribute(t, "maxlength", k() > 0 ? k() : null);
54799
- }), delegated("input", t, Hn), event("focus", t, (e) => Ht()?.(e)), delegated("keydown", t, Vn), event("paste", t, (e) => qt()?.(e)), append(e, t);
54890
+ remove_textarea_child(t), bind_this(t, (e) => set(hn, e), () => get(hn)), effect(() => bind_value(t, s)), action(t, (e, t) => Kn?.(e, t), s), template_effect(() => {
54891
+ set_attribute(t, "data-pw", an() ?? null), set_attribute(t, "placeholder", u()), t.disabled = get(bn), set_attribute(t, "aria-label", on() ?? (u().length > 0 ? u() : "Message")), set_attribute(t, "role", jt() === null ? null : "combobox"), set_attribute(t, "aria-expanded", jt() === null ? null : get(Mn)), set_attribute(t, "aria-controls", get(Mn) ? Pn : null), set_attribute(t, "aria-autocomplete", jt() === null ? null : "list"), set_attribute(t, "aria-activedescendant", get(Fn)), set_attribute(t, "maxlength", k() > 0 ? k() : null);
54892
+ }), delegated("input", t, Un), event("focus", t, (e) => Ht()?.(e)), delegated("keydown", t, Hn), event("paste", t, (e) => qt()?.(e)), append(e, t);
54800
54893
  }, o = (e) => {
54801
54894
  var t = root_8$4(), n = first_child(t), i = (e) => {
54802
54895
  var t = root_4$5();
@@ -54900,7 +54993,7 @@ function ChatComposer(e, t) {
54900
54993
  {
54901
54994
  let e = /* @__PURE__ */ user_derived(() => !get(wn));
54902
54995
  Button(n, {
54903
- onclick: Bn,
54996
+ onclick: Vn,
54904
54997
  get disabled() {
54905
54998
  return get(e);
54906
54999
  },
@@ -54939,14 +55032,20 @@ function ChatComposer(e, t) {
54939
55032
  }), append(e, t);
54940
55033
  }, s = prop(t, "value", 15, ""), c = prop(t, "layout", 7, "row"), l = prop(t, "variant", 7, "default"), u = prop(t, "placeholder", 7, ""), f = prop(t, "disabled", 7, !1), p = prop(t, "textDisabled", 7, null), h = prop(t, "voiceDisabled", 7, null), S = prop(t, "sendDisabled", 7, null), C = prop(t, "submitOnEnter", 7, !0), k = prop(t, "maxLength", 7, 0), R = prop(t, "streaming", 7, !1), G = prop(t, "recording", 7, !1), te = prop(t, "attachments", 31, () => proxy([])), ne = prop(t, "attachmentsPreview", 7), re = prop(t, "richImages", 23, () => []), be = prop(t, "richFiles", 23, () => []), Me = prop(t, "richVideos", 23, () => []), Re = prop(t, "richImageTooltip", 7), Ue = prop(t, "richVideoTooltip", 7), it = prop(t, "richRemoveIcon", 7), at = prop(t, "richFileIcon", 7), ot = prop(t, "onremoverichimage", 7), ct = prop(t, "onremoverichfile", 7), lt = prop(t, "onremoverichvideo", 7), ut = prop(t, "onopenrichimage", 7), dt = prop(t, "onopenrichvideo", 7), ft = prop(t, "onopenrichfile", 7), pt = prop(t, "sendable", 7, null), mt = prop(t, "accept", 7, ""), ht = prop(t, "multiple", 7, !1), gt = prop(t, "sendLabel", 7, "Send message"), _t = prop(t, "stopLabel", 7, "Stop generating"), vt = prop(t, "voiceLabel", 7, "Voice input"), yt = prop(t, "attachLabel", 7, "Attach files"), bt = prop(t, "sendIcon", 7), xt = prop(t, "stopIcon", 7), St = prop(t, "voiceIcon", 7), Ct = prop(t, "attachIcon", 7), wt = prop(t, "actionIcon", 7), Tt = prop(t, "actionLabel", 7, "Voice conversation"), Et = prop(t, "actionText", 7), Dt = prop(t, "leading", 7), Ot = prop(t, "trailing", 7), kt = prop(t, "statusText", 7), At = prop(t, "statusTestId", 7), jt = prop(t, "slashCommands", 7, null), Mt = prop(t, "slashMenuAriaLabel", 7, "slash commands"), Nt = prop(t, "slashMenuHint", 7, "↑↓ move · tab complete · ↵ select · esc dismiss"), Pt = prop(t, "slashMenuClasses", 7), It = prop(t, "slashItemClasses", 7), Lt = prop(t, "slashSelectedItemClasses", 7), Rt = prop(t, "slashItem", 7), zt = prop(t, "onsubmit", 7), Bt = prop(t, "oninput", 7), Ht = prop(t, "oninputfocus", 7), Gt = prop(t, "onkeydown", 7), qt = prop(t, "onpaste", 7), Zt = prop(t, "onstop", 7), Qt = prop(t, "onvoice", 7), $t = prop(t, "oncanceldictation", 7), en = prop(t, "onattach", 7), tn = prop(t, "onattachclick", 7), nn = prop(t, "onaction", 7), rn = prop(t, "testId", 7), an = prop(t, "inputTestId", 7), on = prop(t, "inputAriaLabel", 7), sn = prop(t, "sendTestId", 7), cn = prop(t, "sendSlotTestId", 7), ln = prop(t, "stopTestId", 7), un = prop(t, "voiceTestId", 7), dn = prop(t, "attachTestId", 7), fn = prop(t, "actionTestId", 7), pn = prop(t, "classes", 7), mn = /* @__PURE__ */ state(null), hn = /* @__PURE__ */ state(null), gn = (e) => {
54941
55034
  get(hn)?.focus(e);
54942
- }, _n = /* @__PURE__ */ user_derived(() => typeof Qt() == "function"), vn = /* @__PURE__ */ user_derived(() => typeof en() == "function" || typeof tn() == "function"), yn = /* @__PURE__ */ user_derived(() => re().length > 0 || Me().length > 0 || be().length > 0), bn = /* @__PURE__ */ user_derived(() => resolveControlDisabled(p(), f())), xn = /* @__PURE__ */ user_derived(() => normalizeDictationState(G())), Sn = /* @__PURE__ */ user_derived(() => resolveControlDisabled(h(), f()) || get(xn) === "busy"), Cn = /* @__PURE__ */ user_derived(() => resolveControlDisabled(S(), f())), wn = /* @__PURE__ */ user_derived(() => !get(Cn) && (pt() ?? (s().trim().length > 0 || te().length > 0 || get(yn)))), Tn = /* @__PURE__ */ state(!1), En = /* @__PURE__ */ state(0), Dn = /* @__PURE__ */ state(null), On = /* @__PURE__ */ user_derived(() => {
54943
- if (jt() === null || get(Tn) || !/^\/\S*$/.test(s())) return [];
54944
- let e = s().toLowerCase();
54945
- return jt().filter((t) => t.name.toLowerCase().startsWith(e) || e.length > 1 && (t.description ?? "").toLowerCase().includes(e.slice(1)));
54946
- }), kn = /* @__PURE__ */ user_derived(() => {
55035
+ }, _n = /* @__PURE__ */ user_derived(() => typeof Qt() == "function"), vn = /* @__PURE__ */ user_derived(() => typeof en() == "function" || typeof tn() == "function"), yn = /* @__PURE__ */ user_derived(() => re().length > 0 || Me().length > 0 || be().length > 0), bn = /* @__PURE__ */ user_derived(() => resolveControlDisabled(p(), f())), xn = /* @__PURE__ */ user_derived(() => normalizeDictationState(G())), Sn = /* @__PURE__ */ user_derived(() => resolveControlDisabled(h(), f()) || get(xn) === "busy"), Cn = /* @__PURE__ */ user_derived(() => resolveControlDisabled(S(), f())), wn = /* @__PURE__ */ user_derived(() => !get(Cn) && (pt() ?? (s().trim().length > 0 || te().length > 0 || get(yn)))), Tn = /* @__PURE__ */ state(!1), En = /* @__PURE__ */ state(0), Dn = /* @__PURE__ */ state(null);
55036
+ function On(e) {
55037
+ let [t = ""] = e;
55038
+ return /^[^\p{L}\p{N}\s]$/u.test(t) ? t : null;
55039
+ }
55040
+ let kn = /* @__PURE__ */ user_derived(() => {
55041
+ let e = On(s());
55042
+ if (jt() === null || get(Tn) || e === null || /\s/.test(s())) return [];
55043
+ let t = s().toLowerCase();
55044
+ return jt().filter((n) => On(n.name) === e && (n.name.toLowerCase().startsWith(t) || t.length > e.length && (n.description ?? "").toLowerCase().includes(t.slice(e.length))));
55045
+ }), An = /* @__PURE__ */ user_derived(() => {
54947
55046
  if (jt() === null || get(Tn)) return null;
54948
- let e = /^(\/\S+)\s(\S*)$/.exec(s());
54949
- if (e === null) return null;
55047
+ let e = /^(\S+)\s(\S*)$/.exec(s());
55048
+ if (e === null || On(e[1] ?? "") === null) return null;
54950
55049
  let t = (e[1] ?? "").toLowerCase(), n = jt().find((e) => e.name.toLowerCase() === t && (e.choices?.length ?? 0) > 0);
54951
55050
  if (typeof n != "object") return null;
54952
55051
  let i = (e[2] ?? "").toLowerCase();
@@ -54954,35 +55053,35 @@ function ChatComposer(e, t) {
54954
55053
  command: n,
54955
55054
  choices: (n.choices ?? []).filter((e) => e.value.toLowerCase().startsWith(i))
54956
55055
  };
54957
- }), An = /* @__PURE__ */ user_derived(() => get(kn) === null ? get(On) : get(kn).choices.map((e) => typeof e.description == "string" ? {
55056
+ }), jn = /* @__PURE__ */ user_derived(() => get(An) === null ? get(kn) : get(An).choices.map((e) => typeof e.description == "string" ? {
54958
55057
  name: e.value,
54959
55058
  description: e.description
54960
- } : { name: e.value })), jn = /* @__PURE__ */ user_derived(() => get(An).length > 0), Mn = /* @__PURE__ */ user_derived(() => Math.min(get(En), Math.max(0, get(An).length - 1))), Nn = `chat-composer-slash-listbox-${n}`, Pn = /* @__PURE__ */ user_derived(() => get(jn) ? `chat-composer-slash-option-${n}-${get(Mn)}` : null);
54961
- function Fn(e) {
54962
- if (get(kn) !== null) {
54963
- let t = get(kn).choices.at(e);
54964
- return typeof t == "object" ? `${get(kn).command.name} ${t.value}` : null;
55059
+ } : { name: e.value })), Mn = /* @__PURE__ */ user_derived(() => get(jn).length > 0), Nn = /* @__PURE__ */ user_derived(() => Math.min(get(En), Math.max(0, get(jn).length - 1))), Pn = `chat-composer-slash-listbox-${n}`, Fn = /* @__PURE__ */ user_derived(() => get(Mn) ? `chat-composer-slash-option-${n}-${get(Nn)}` : null);
55060
+ function In(e) {
55061
+ if (get(An) !== null) {
55062
+ let t = get(An).choices.at(e);
55063
+ return typeof t == "object" ? `${get(An).command.name} ${t.value}` : null;
54965
55064
  }
54966
- return get(An).at(e)?.name ?? null;
55065
+ return get(jn).at(e)?.name ?? null;
54967
55066
  }
54968
- function In(e) {
54969
- if (get(kn) !== null) {
54970
- let t = get(kn).choices.at(e);
54971
- typeof t == "object" && (s(`${get(kn).command.name} ${t.value}`), set(En, 0));
55067
+ function Ln(e) {
55068
+ if (get(An) !== null) {
55069
+ let t = get(An).choices.at(e);
55070
+ typeof t == "object" && (s(`${get(An).command.name} ${t.value}`), set(En, 0));
54972
55071
  return;
54973
55072
  }
54974
- let t = get(On).at(e);
55073
+ let t = get(kn).at(e);
54975
55074
  typeof t == "object" && (s(`${t.name} `), set(Tn, (t.choices?.length ?? 0) === 0), set(En, 0));
54976
55075
  }
54977
- function Ln() {
55076
+ function Rn() {
54978
55077
  tick().then(() => {
54979
- (get(Dn)?.children.item(get(Mn)))?.scrollIntoView({ block: "nearest" });
55078
+ (get(Dn)?.children.item(get(Nn)))?.scrollIntoView({ block: "nearest" });
54980
55079
  });
54981
55080
  }
54982
- function Rn(e) {
54983
- return e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), set(En, e.key === "ArrowDown" ? Math.min(get(Mn) + 1, get(An).length - 1) : Math.max(get(Mn) - 1, 0), !0), Ln(), !0) : e.key === "Tab" && !e.shiftKey ? (e.preventDefault(), In(get(Mn)), !0) : e.key === "Enter" && !e.shiftKey && !e.isComposing ? (e.preventDefault(), s().trim() === Fn(get(Mn)) ? Bn() : In(get(Mn)), !0) : !1;
54984
- }
54985
55081
  function zn(e) {
55082
+ return e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), set(En, e.key === "ArrowDown" ? Math.min(get(Nn) + 1, get(jn).length - 1) : Math.max(get(Nn) - 1, 0), !0), Rn(), !0) : e.key === "Tab" && !e.shiftKey ? (e.preventDefault(), Ln(get(Nn)), !0) : e.key === "Enter" && !e.shiftKey && !e.isComposing ? (e.preventDefault(), s().trim() === In(get(Nn)) ? Vn() : Ln(get(Nn)), !0) : !1;
55083
+ }
55084
+ function Bn(e) {
54986
55085
  return { destroy: registerDismissible({
54987
55086
  element: () => e,
54988
55087
  onEscape: () => {
@@ -54990,7 +55089,7 @@ function ChatComposer(e, t) {
54990
55089
  }
54991
55090
  }) };
54992
55091
  }
54993
- function Bn() {
55092
+ function Vn() {
54994
55093
  if (!get(wn)) return;
54995
55094
  set(Tn, !1);
54996
55095
  let e = {
@@ -55011,26 +55110,26 @@ function ChatComposer(e, t) {
55011
55110
  attachments: te()
55012
55111
  }) && (s(""), te([]));
55013
55112
  }
55014
- function Vn(e) {
55015
- !(get(jn) && Rn(e)) && C() && e.key === "Enter" && !e.shiftKey && !e.isComposing && !R() && (e.preventDefault(), Bn()), e.key === "Escape" && get(xn) === "recording" && (e.preventDefault(), $t()?.()), Gt()?.(e);
55016
- }
55017
55113
  function Hn(e) {
55018
- set(Tn, !1), set(En, 0), Bt()?.(e.currentTarget.value, e);
55114
+ !(get(Mn) && zn(e)) && C() && e.key === "Enter" && !e.shiftKey && !e.isComposing && !R() && (e.preventDefault(), Vn()), e.key === "Escape" && get(xn) === "recording" && (e.preventDefault(), $t()?.()), Gt()?.(e);
55019
55115
  }
55020
55116
  function Un(e) {
55117
+ set(Tn, !1), set(En, 0), Bt()?.(e.currentTarget.value, e);
55118
+ }
55119
+ function Wn(e) {
55021
55120
  let t = Array.from(e.currentTarget.files ?? []);
55022
55121
  t.length > 0 && (te([...te(), ...t]), en()?.(t)), e.currentTarget.value = "";
55023
55122
  }
55024
- function Wn(e) {
55123
+ function Gn(e) {
55025
55124
  te(te().filter((t, n) => n !== e));
55026
55125
  }
55027
- let Gn = (e) => {
55126
+ let Kn = (e) => {
55028
55127
  function t() {
55029
55128
  e.style.height = "0px", e.style.height = `${e.scrollHeight}px`;
55030
55129
  }
55031
55130
  return t(), { update: t };
55032
55131
  };
55033
- var Kn = {
55132
+ var qn = {
55034
55133
  focus: gn,
55035
55134
  get value() {
55036
55135
  return s();
@@ -55470,26 +55569,26 @@ function ChatComposer(e, t) {
55470
55569
  set classes(e) {
55471
55570
  pn(e), flushSync();
55472
55571
  }
55473
- }, qn = root_19$2();
55474
- let Jn;
55475
- var Yn = child(qn), Xn = (e) => {
55572
+ }, Jn = root_19$2();
55573
+ let Yn;
55574
+ var Xn = child(Jn), Zn = (e) => {
55476
55575
  var t = root_14$2(), i = child(t);
55477
- each(i, 23, () => get(An), (e) => e.name, (e, t, i) => {
55576
+ each(i, 23, () => get(jn), (e) => e.name, (e, t, i) => {
55478
55577
  var a = root_13$2();
55479
55578
  let o;
55480
55579
  var s = child(a);
55481
55580
  {
55482
- let e = /* @__PURE__ */ user_derived(() => [It(), get(i) === get(Mn) ? Lt() : ""].filter((e) => typeof e == "string" && e.length > 0).join(" "));
55581
+ let e = /* @__PURE__ */ user_derived(() => [It(), get(i) === get(Nn) ? Lt() : ""].filter((e) => typeof e == "string" && e.length > 0).join(" "));
55483
55582
  Button(s, {
55484
55583
  type: "button",
55485
55584
  get classes() {
55486
55585
  return get(e);
55487
55586
  },
55488
- onclick: () => In(get(i)),
55587
+ onclick: () => Ln(get(i)),
55489
55588
  children: (e, n) => {
55490
55589
  var a = comment(), o = first_child(a), s = (e) => {
55491
55590
  var n = comment();
55492
- snippet(first_child(n), Rt, () => get(t), () => get(i) === get(Mn)), append(e, n);
55591
+ snippet(first_child(n), Rt, () => get(t), () => get(i) === get(Nn)), append(e, n);
55493
55592
  }, c = (e) => {
55494
55593
  var n = root_12$2(), i = first_child(n), a = child(i, !0);
55495
55594
  reset(i);
@@ -55523,30 +55622,30 @@ function ChatComposer(e, t) {
55523
55622
  });
55524
55623
  }
55525
55624
  reset(a), template_effect(() => {
55526
- set_attribute(a, "id", `chat-composer-slash-option-${n}-${get(i)}`), set_attribute(a, "aria-selected", get(i) === get(Mn)), o = set_class(a, 1, "svelte-xpd394", null, o, { "slash-item-selected-default": get(i) === get(Mn) && typeof Lt() != "string" });
55625
+ set_attribute(a, "id", `chat-composer-slash-option-${n}-${get(i)}`), set_attribute(a, "aria-selected", get(i) === get(Nn)), o = set_class(a, 1, "svelte-xpd394", null, o, { "slash-item-selected-default": get(i) === get(Nn) && typeof Lt() != "string" });
55527
55626
  }), event("mouseenter", a, () => set(En, get(i), !0)), append(e, a);
55528
55627
  }), reset(i), bind_this(i, (e) => set(Dn, e), () => get(Dn));
55529
55628
  var a = sibling(i, 2), o = child(a, !0);
55530
- reset(a), reset(t), action(t, (e) => zn?.(e)), template_effect(() => {
55531
- set_class(t, 1, `slash-menu ${Pt() ?? "" ?? ""}`, "svelte-xpd394"), set_attribute(t, "id", Nn), set_attribute(t, "aria-label", Mt()), set_text(o, Nt());
55629
+ reset(a), reset(t), action(t, (e) => Bn?.(e)), template_effect(() => {
55630
+ set_class(t, 1, `slash-menu ${Pt() ?? "" ?? ""}`, "svelte-xpd394"), set_attribute(t, "id", Pn), set_attribute(t, "aria-label", Mt()), set_text(o, Nt());
55532
55631
  }), append(e, t);
55533
55632
  };
55534
- if_block(Yn, (e) => {
55535
- get(jn) && e(Xn);
55633
+ if_block(Xn, (e) => {
55634
+ get(Mn) && e(Zn);
55536
55635
  });
55537
- var Zn = sibling(Yn, 2), Qn = (e) => {
55636
+ var Qn = sibling(Xn, 2), $n = (e) => {
55538
55637
  var t = root_15$2(), n = child(t, !0);
55539
55638
  reset(t), template_effect(() => {
55540
55639
  set_attribute(t, "data-pw", At() ?? null), set_text(n, kt());
55541
55640
  }), append(e, t);
55542
55641
  };
55543
- if_block(Zn, (e) => {
55544
- typeof kt() == "string" && e(Qn);
55642
+ if_block(Qn, (e) => {
55643
+ typeof kt() == "string" && e($n);
55545
55644
  });
55546
- var $n = sibling(Zn, 2), er = (e) => {
55645
+ var er = sibling(Qn, 2), tr = (e) => {
55547
55646
  var t = comment();
55548
55647
  snippet(first_child(t), ne), append(e, t);
55549
- }, tr = (e) => {
55648
+ }, nr = (e) => {
55550
55649
  var t = root_16$2(), n = child(t);
55551
55650
  {
55552
55651
  let e = /* @__PURE__ */ user_derived(() => rn() && `${rn()}-rich-attachments`);
@@ -55596,7 +55695,7 @@ function ChatComposer(e, t) {
55596
55695
  });
55597
55696
  }
55598
55697
  reset(t), append(e, t);
55599
- }, nr = (e) => {
55698
+ }, rr = (e) => {
55600
55699
  var t = root_17$2();
55601
55700
  each(t, 23, te, (e, t) => e.name + t, (e, t, n) => {
55602
55701
  Pill(e, {
@@ -55604,34 +55703,34 @@ function ChatComposer(e, t) {
55604
55703
  return get(t).name;
55605
55704
  },
55606
55705
  dismissible: !0,
55607
- ondismiss: () => Wn(get(n))
55706
+ ondismiss: () => Gn(get(n))
55608
55707
  });
55609
55708
  }), reset(t), append(e, t);
55610
55709
  };
55611
- if_block($n, (e) => {
55612
- typeof ne() == "function" ? e(er) : get(yn) ? e(tr, 1) : te().length > 0 && e(nr, 2);
55710
+ if_block(er, (e) => {
55711
+ typeof ne() == "function" ? e(tr) : get(yn) ? e(nr, 1) : te().length > 0 && e(rr, 2);
55613
55712
  });
55614
- var rr = sibling($n, 2);
55615
- let ir;
55616
- var ar = child(rr), or = (e) => {
55713
+ var ir = sibling(er, 2);
55714
+ let ar;
55715
+ var or = child(ir), sr = (e) => {
55617
55716
  var t = root_18$2(), n = first_child(t);
55618
55717
  a(child(n)), reset(n);
55619
55718
  var s = sibling(n, 2), c = child(s);
55620
55719
  i(c), o(sibling(c, 4)), reset(s), append(e, t);
55621
- }, sr = (e) => {
55720
+ }, cr = (e) => {
55622
55721
  var t = root_8$4(), n = first_child(t);
55623
55722
  i(n);
55624
55723
  var s = sibling(n, 2);
55625
55724
  a(s), o(sibling(s, 2)), append(e, t);
55626
55725
  };
55627
- return if_block(ar, (e) => {
55628
- c() === "stacked" ? e(or) : e(sr, -1);
55629
- }), reset(rr), reset(qn), template_effect(() => {
55630
- Jn = set_class(qn, 1, `chat-composer ${pn() ?? "" ?? ""}`, "svelte-xpd394", Jn, {
55726
+ return if_block(or, (e) => {
55727
+ c() === "stacked" ? e(sr) : e(cr, -1);
55728
+ }), reset(ir), reset(Jn), template_effect(() => {
55729
+ Yn = set_class(Jn, 1, `chat-composer ${pn() ?? "" ?? ""}`, "svelte-xpd394", Yn, {
55631
55730
  disabled: f(),
55632
55731
  pill: l() === "pill"
55633
- }), set_attribute(qn, "data-has-slash", jt() === null ? null : ""), set_attribute(qn, "data-pw", typeof rn() == "string" ? rn() : null), set_attribute(qn, "testid", typeof rn() == "string" ? rn() : null), ir = set_class(rr, 1, "input-row svelte-xpd394", null, ir, { stacked: c() === "stacked" });
55634
- }), append(e, qn), pop(Kn);
55732
+ }), set_attribute(Jn, "data-has-slash", jt() === null ? null : ""), set_attribute(Jn, "data-pw", typeof rn() == "string" ? rn() : null), set_attribute(Jn, "testid", typeof rn() == "string" ? rn() : null), ar = set_class(ir, 1, "input-row svelte-xpd394", null, ar, { stacked: c() === "stacked" });
55733
+ }), append(e, Jn), pop(qn);
55635
55734
  }
55636
55735
  delegate([
55637
55736
  "change",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "4.53.1",
3
+ "version": "4.54.1",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",