@juspay/svelte-ui-components 3.3.2 → 3.4.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.
@@ -10,6 +10,7 @@
10
10
  testId,
11
11
  title,
12
12
  dismissIcon,
13
+ dismissLabel,
13
14
  leadingIcon,
14
15
  onclick,
15
16
  ondismiss: ondismissLegacy,
@@ -30,6 +31,9 @@
30
31
  }
31
32
 
32
33
  function handleKeydown(event: KeyboardEvent): void {
34
+ if (event.target !== event.currentTarget) {
35
+ return;
36
+ }
33
37
  if (event.key === 'Enter' || event.key === ' ') {
34
38
  event.preventDefault();
35
39
  if (event.currentTarget instanceof HTMLElement) {
@@ -66,10 +70,12 @@
66
70
  <span class="pill-text">{text}</span>
67
71
  {#if dismissible}
68
72
  <div class="pill-dismiss">
73
+ <!-- A dismiss action is a bare icon, not a primary call to action. -->
69
74
  <Button
75
+ variant="ghost"
70
76
  {disabled}
71
77
  onclick={handleDismiss}
72
- ariaLabel="Dismiss"
78
+ ariaLabel={dismissLabel?.trim() || 'Dismiss'}
73
79
  {...typeof testId === 'string' ? { testId: `${testId}-dismiss` } : {}}
74
80
  >
75
81
  {#if typeof dismissIcon === 'function'}
@@ -147,6 +153,25 @@
147
153
  flex-shrink: 0;
148
154
  }
149
155
 
156
+ /* Consumer themes can set Button tokens on its container, beating inherited
157
+ wrapper values. Pin the painting element too so the chip owns its enabled
158
+ glyph; leave disabled colours and focus indicators to the consumer theme. */
159
+ .pill-dismiss :global(.button-container),
160
+ .pill-dismiss :global(.button-el) {
161
+ --button-color: transparent;
162
+ --button-background: none;
163
+ --button-active-background: transparent;
164
+ --button-border: none;
165
+ --button-padding: 0;
166
+ --button-text-color: var(--pill-dismiss-color, currentColor);
167
+ --button-hover-color: transparent;
168
+ --button-hover-border: none;
169
+ --button-hover-text-color: var(
170
+ --pill-dismiss-hover-color,
171
+ var(--pill-dismiss-color, currentColor)
172
+ );
173
+ }
174
+
150
175
  .pill-dismiss :global(svg) {
151
176
  width: var(--pill-dismiss-size, 14px);
152
177
  height: var(--pill-dismiss-size, 14px);
@@ -9,6 +9,11 @@ export type OptionalPillProperties = {
9
9
  testId?: string;
10
10
  title?: string;
11
11
  dismissIcon?: Snippet;
12
+ /**
13
+ * Accessible name of the dismiss control. Defaults to "Dismiss"; pass a translated
14
+ * string for localised products. Blank values fall back to the default.
15
+ */
16
+ dismissLabel?: string;
12
17
  /**
13
18
  * A Svelte snippet rendered immediately before the text label inside a
14
19
  * `<span class="pill-leading-icon">` wrapper. Use for icons, logos, or any
@@ -7,6 +7,9 @@
7
7
  disabled = false,
8
8
  testId,
9
9
  classes,
10
+ id,
11
+ ariaLabel,
12
+ ariaLabelledby,
10
13
  onclick: onclickLegacy,
11
14
  onClick
12
15
  }: ToggleProperties = $props();
@@ -14,6 +17,10 @@
14
17
  // Event-casing phase 1: both spellings accepted, the correct one wins.
15
18
  const onclick = $derived(onClick ?? onclickLegacy);
16
19
 
20
+ // Stable across hydration so the hidden input stays named and text remains clickable.
21
+ const generatedId = $props.id();
22
+ const inputId = $derived(id?.trim() || `toggle-${generatedId}`);
23
+
17
24
  const handleCheckboxClick = (e: MouseEvent): void => {
18
25
  if (e.target instanceof HTMLInputElement && typeof e.target.checked === 'boolean') {
19
26
  checked = e.target.checked;
@@ -29,13 +36,16 @@
29
36
  data-pw={testId}
30
37
  testID={testId}
31
38
  >
32
- <div class="text" hidden={text.length === 0}>{text}</div>
39
+ <label class="text" for={inputId} hidden={text.length === 0}>{text}</label>
33
40
  <label class="switch">
34
41
  <input
42
+ id={inputId}
35
43
  class="input-checkbox"
36
44
  type="checkbox"
37
45
  {checked}
38
46
  {disabled}
47
+ aria-label={ariaLabel?.trim() || null}
48
+ aria-labelledby={ariaLabelledby?.trim() || null}
39
49
  onclick={handleCheckboxClick}
40
50
  />
41
51
  <span class="slider round"></span>
@@ -5,6 +5,20 @@ export type OptionalToggleProperties = {
5
5
  disabled?: boolean;
6
6
  testId?: string;
7
7
  classes?: string;
8
+ /**
9
+ * Native `id` of the checkbox input, so a consumer can point its own `<label for>`
10
+ * at the control. Generated when omitted or blank, which is what wires `text` up as a real
11
+ * label rather than adjacent text.
12
+ */
13
+ id?: string;
14
+ /** Names the switch for assistive technology when it has no visible text. */
15
+ ariaLabel?: string;
16
+ /**
17
+ * References a label in the same DOM root as the checkbox. `<sui-toggle>` exposes this as
18
+ * `inputAriaLabelledby` (`input-aria-labelledby`); it cannot reach the host document, so use
19
+ * `text` or `inputAriaLabel` for labels outside the shadow root.
20
+ */
21
+ ariaLabelledby?: string;
8
22
  };
9
23
  export type ToggleEventProperties = {
10
24
  onclick?: (checked: boolean) => void;
package/dist-wc/index.js CHANGED
@@ -6755,21 +6755,21 @@ delegate([
6755
6755
  //#region src/lib/assets/close.svg?raw
6756
6756
  var close_default = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", root$77 = /* @__PURE__ */ from_html("<span class=\"pill-leading-icon svelte-13eug5u\"><!></span>"), root_1$64 = /* @__PURE__ */ from_html("<div class=\"pill-dismiss svelte-13eug5u\"><!></div>"), root_2$48 = /* @__PURE__ */ from_html("<div><!> <span class=\"pill-text svelte-13eug5u\"> </span> <!></div>"), $$css$75 = {
6757
6757
  hash: "svelte-13eug5u",
6758
- code: ".pill.svelte-13eug5u {display:inline-flex;align-items:center;\n /* A pill is content-width by default. A caller stacking pills into a menu needs\n them to fill the column and align their labels left, which is a layout choice\n the call site owns — hence tokens rather than a variant. */width:var(--pill-width, auto);justify-content:var(--pill-justify-content, center);text-align:var(--pill-text-align, center);gap:var(--pill-gap, 4px);background-color:var(--pill-background, #e0e0e0);color:var(--pill-color, #333333);font-size:var(--pill-font-size, 13px);font-weight:var(--pill-font-weight, 500);font-family:var(--pill-font-family);padding:var(--pill-padding, 6px 10px);border-radius:var(--pill-border-radius, 999px);border:var(--pill-border, none);cursor:var(--pill-cursor, pointer);max-width:var(--pill-max-width);line-height:var(--pill-line-height, 1);flex-shrink:var(--pill-flex-shrink);}.pill.svelte-13eug5u:hover:not(.disabled) {background-color:var(--pill-hover-background, var(--pill-background, #d0d0d0));color:var(--pill-hover-color, var(--pill-color, #333333));}.pill.disabled.svelte-13eug5u {opacity:var(--pill-disabled-opacity, 0.4);cursor:var(--pill-disabled-cursor, not-allowed);}.pill-text.svelte-13eug5u {overflow:hidden;text-overflow:var(--pill-text-overflow, ellipsis);white-space:var(--pill-text-white-space, nowrap);}.pill-leading-icon.svelte-13eug5u {display:inline-flex;align-items:center;flex-shrink:0;}.pill-dismiss.svelte-13eug5u {--button-color: transparent;--button-border: none;--button-padding: 0;--button-text-color: var(--pill-dismiss-color, currentColor);--button-hover-color: transparent;--button-hover-text-color: var(\n --pill-dismiss-hover-color,\n var(--pill-dismiss-color, currentColor)\n );--cursor: inherit;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;}.pill-dismiss.svelte-13eug5u svg {width:var(--pill-dismiss-size, 14px);height:var(--pill-dismiss-size, 14px);}"
6758
+ code: ".pill.svelte-13eug5u {display:inline-flex;align-items:center;\n /* A pill is content-width by default. A caller stacking pills into a menu needs\n them to fill the column and align their labels left, which is a layout choice\n the call site owns — hence tokens rather than a variant. */width:var(--pill-width, auto);justify-content:var(--pill-justify-content, center);text-align:var(--pill-text-align, center);gap:var(--pill-gap, 4px);background-color:var(--pill-background, #e0e0e0);color:var(--pill-color, #333333);font-size:var(--pill-font-size, 13px);font-weight:var(--pill-font-weight, 500);font-family:var(--pill-font-family);padding:var(--pill-padding, 6px 10px);border-radius:var(--pill-border-radius, 999px);border:var(--pill-border, none);cursor:var(--pill-cursor, pointer);max-width:var(--pill-max-width);line-height:var(--pill-line-height, 1);flex-shrink:var(--pill-flex-shrink);}.pill.svelte-13eug5u:hover:not(.disabled) {background-color:var(--pill-hover-background, var(--pill-background, #d0d0d0));color:var(--pill-hover-color, var(--pill-color, #333333));}.pill.disabled.svelte-13eug5u {opacity:var(--pill-disabled-opacity, 0.4);cursor:var(--pill-disabled-cursor, not-allowed);}.pill-text.svelte-13eug5u {overflow:hidden;text-overflow:var(--pill-text-overflow, ellipsis);white-space:var(--pill-text-white-space, nowrap);}.pill-leading-icon.svelte-13eug5u {display:inline-flex;align-items:center;flex-shrink:0;}.pill-dismiss.svelte-13eug5u {--button-color: transparent;--button-border: none;--button-padding: 0;--button-text-color: var(--pill-dismiss-color, currentColor);--button-hover-color: transparent;--button-hover-text-color: var(\n --pill-dismiss-hover-color,\n var(--pill-dismiss-color, currentColor)\n );--cursor: inherit;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;}\n\n /* Consumer themes can set Button tokens on its container, beating inherited\n wrapper values. Pin the painting element too so the chip owns its enabled\n glyph; leave disabled colours and focus indicators to the consumer theme. */.pill-dismiss.svelte-13eug5u .button-container,\n .pill-dismiss.svelte-13eug5u .button-el {--button-color: transparent;--button-background: none;--button-active-background: transparent;--button-border: none;--button-padding: 0;--button-text-color: var(--pill-dismiss-color, currentColor);--button-hover-color: transparent;--button-hover-border: none;--button-hover-text-color: var(\n --pill-dismiss-hover-color,\n var(--pill-dismiss-color, currentColor)\n );}.pill-dismiss.svelte-13eug5u svg {width:var(--pill-dismiss-size, 14px);height:var(--pill-dismiss-size, 14px);}"
6759
6759
  };
6760
6760
  function Pill(e, t) {
6761
6761
  push(t, !0), append_styles$1(e, $$css$75);
6762
- let n = prop(t, "text", 7), i = prop(t, "dismissible", 7, !1), a = prop(t, "disabled", 7, !1), o = prop(t, "testId", 7), s = prop(t, "title", 7), c = prop(t, "dismissIcon", 7), l = prop(t, "leadingIcon", 7), u = prop(t, "onclick", 7), f = prop(t, "ondismiss", 7), p = prop(t, "onDismiss", 7), h = prop(t, "classes", 7), S = /* @__PURE__ */ user_derived(() => p() ?? f()), C = /* @__PURE__ */ user_derived(() => typeof u() == "function");
6763
- function k(e) {
6764
- a() || u()?.(e);
6765
- }
6762
+ let n = prop(t, "text", 7), i = prop(t, "dismissible", 7, !1), a = prop(t, "disabled", 7, !1), o = prop(t, "testId", 7), s = prop(t, "title", 7), c = prop(t, "dismissIcon", 7), l = prop(t, "dismissLabel", 7), u = prop(t, "leadingIcon", 7), f = prop(t, "onclick", 7), p = prop(t, "ondismiss", 7), h = prop(t, "onDismiss", 7), S = prop(t, "classes", 7), C = /* @__PURE__ */ user_derived(() => h() ?? p()), k = /* @__PURE__ */ user_derived(() => typeof f() == "function");
6766
6763
  function R(e) {
6767
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.currentTarget instanceof HTMLElement && e.currentTarget.click());
6764
+ a() || f()?.(e);
6768
6765
  }
6769
6766
  function G(e) {
6770
- e.stopPropagation(), !a() && get(S)?.();
6767
+ e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.currentTarget instanceof HTMLElement && e.currentTarget.click());
6771
6768
  }
6772
- var te = {
6769
+ function te(e) {
6770
+ e.stopPropagation(), !a() && get(C)?.();
6771
+ }
6772
+ var ne = {
6773
6773
  get text() {
6774
6774
  return n();
6775
6775
  },
@@ -6806,80 +6806,93 @@ function Pill(e, t) {
6806
6806
  set dismissIcon(e) {
6807
6807
  c(e), flushSync();
6808
6808
  },
6809
- get leadingIcon() {
6809
+ get dismissLabel() {
6810
6810
  return l();
6811
6811
  },
6812
- set leadingIcon(e) {
6812
+ set dismissLabel(e) {
6813
6813
  l(e), flushSync();
6814
6814
  },
6815
- get onclick() {
6815
+ get leadingIcon() {
6816
6816
  return u();
6817
6817
  },
6818
- set onclick(e) {
6818
+ set leadingIcon(e) {
6819
6819
  u(e), flushSync();
6820
6820
  },
6821
- get ondismiss() {
6821
+ get onclick() {
6822
6822
  return f();
6823
6823
  },
6824
- set ondismiss(e) {
6824
+ set onclick(e) {
6825
6825
  f(e), flushSync();
6826
6826
  },
6827
- get onDismiss() {
6827
+ get ondismiss() {
6828
6828
  return p();
6829
6829
  },
6830
- set onDismiss(e) {
6830
+ set ondismiss(e) {
6831
6831
  p(e), flushSync();
6832
6832
  },
6833
- get classes() {
6833
+ get onDismiss() {
6834
6834
  return h();
6835
6835
  },
6836
- set classes(e) {
6836
+ set onDismiss(e) {
6837
6837
  h(e), flushSync();
6838
+ },
6839
+ get classes() {
6840
+ return S();
6841
+ },
6842
+ set classes(e) {
6843
+ S(e), flushSync();
6838
6844
  }
6839
- }, ne = root_2$48();
6840
- let re;
6841
- var be = child(ne), Me = (e) => {
6845
+ }, re = root_2$48();
6846
+ let be;
6847
+ var Me = child(re), Re = (e) => {
6842
6848
  var t = root$77();
6843
- snippet(child(t), l), reset(t), append(e, t);
6849
+ snippet(child(t), u), reset(t), append(e, t);
6844
6850
  };
6845
- if_block(be, (e) => {
6846
- typeof l() == "function" && e(Me);
6851
+ if_block(Me, (e) => {
6852
+ typeof u() == "function" && e(Re);
6847
6853
  });
6848
- var Re = sibling(be, 2), Ue = child(Re, !0);
6849
- reset(Re);
6850
- var it = sibling(Re, 2), at = (e) => {
6851
- var t = root_1$64();
6852
- Button(child(t), spread_props({
6853
- get disabled() {
6854
- return a();
6855
- },
6856
- onclick: G,
6857
- ariaLabel: "Dismiss"
6858
- }, () => typeof o() == "string" ? { testId: `${o()}-dismiss` } : {}, {
6859
- children: (e, t) => {
6860
- var n = comment(), i = first_child(n), a = (e) => {
6861
- var t = comment();
6862
- snippet(first_child(t), c), append(e, t);
6863
- }, o = (e) => {
6864
- var t = comment();
6865
- html(first_child(t), () => close_default), append(e, t);
6866
- };
6867
- if_block(i, (e) => {
6868
- typeof c() == "function" ? e(a) : e(o, -1);
6869
- }), append(e, n);
6870
- },
6871
- $$slots: { default: !0 }
6872
- })), reset(t), append(e, t);
6854
+ var Ue = sibling(Me, 2), it = child(Ue, !0);
6855
+ reset(Ue);
6856
+ var at = sibling(Ue, 2), ot = (e) => {
6857
+ var t = root_1$64(), n = child(t);
6858
+ {
6859
+ let e = /* @__PURE__ */ user_derived(() => l()?.trim() || "Dismiss");
6860
+ Button(n, spread_props({
6861
+ variant: "ghost",
6862
+ get disabled() {
6863
+ return a();
6864
+ },
6865
+ onclick: te,
6866
+ get ariaLabel() {
6867
+ return get(e);
6868
+ }
6869
+ }, () => typeof o() == "string" ? { testId: `${o()}-dismiss` } : {}, {
6870
+ children: (e, t) => {
6871
+ var n = comment(), i = first_child(n), a = (e) => {
6872
+ var t = comment();
6873
+ snippet(first_child(t), c), append(e, t);
6874
+ }, o = (e) => {
6875
+ var t = comment();
6876
+ html(first_child(t), () => close_default), append(e, t);
6877
+ };
6878
+ if_block(i, (e) => {
6879
+ typeof c() == "function" ? e(a) : e(o, -1);
6880
+ }), append(e, n);
6881
+ },
6882
+ $$slots: { default: !0 }
6883
+ }));
6884
+ }
6885
+ reset(t), append(e, t);
6873
6886
  };
6874
- return if_block(it, (e) => {
6875
- i() && e(at);
6876
- }), reset(ne), template_effect(() => {
6877
- re = set_class(ne, 1, `pill ${h() ?? "" ?? ""}`, "svelte-13eug5u", re, { disabled: a() }), set_attribute(ne, "role", get(C) ? "button" : null), set_attribute(ne, "tabindex", get(C) ? 0 : null), set_attribute(ne, "aria-disabled", get(C) && a() ? !0 : null), set_attribute(ne, "data-pw", typeof o() == "string" ? o() : null), set_attribute(ne, "title", s() ?? null), set_attribute(ne, "testid", typeof o() == "string" ? o() : null), set_text(Ue, n());
6878
- }), delegated("click", ne, function(...e) {
6879
- (get(C) ? k : null)?.apply(this, e);
6880
- }), delegated("keydown", ne, function(...e) {
6881
- (get(C) ? R : null)?.apply(this, e);
6882
- }), append(e, ne), pop(te);
6887
+ return if_block(at, (e) => {
6888
+ i() && e(ot);
6889
+ }), reset(re), template_effect(() => {
6890
+ be = set_class(re, 1, `pill ${S() ?? "" ?? ""}`, "svelte-13eug5u", be, { disabled: a() }), set_attribute(re, "role", get(k) ? "button" : null), set_attribute(re, "tabindex", get(k) ? 0 : null), set_attribute(re, "aria-disabled", get(k) && a() ? !0 : null), set_attribute(re, "data-pw", typeof o() == "string" ? o() : null), set_attribute(re, "title", s() ?? null), set_attribute(re, "testid", typeof o() == "string" ? o() : null), set_text(it, n());
6891
+ }), delegated("click", re, function(...e) {
6892
+ (get(k) ? R : null)?.apply(this, e);
6893
+ }), delegated("keydown", re, function(...e) {
6894
+ (get(k) ? G : null)?.apply(this, e);
6895
+ }), append(e, re), pop(ne);
6883
6896
  }
6884
6897
  delegate(["click", "keydown"]), create_custom_element(Pill, {
6885
6898
  text: {},
@@ -6888,6 +6901,7 @@ delegate(["click", "keydown"]), create_custom_element(Pill, {
6888
6901
  testId: {},
6889
6902
  title: {},
6890
6903
  dismissIcon: {},
6904
+ dismissLabel: {},
6891
6905
  leadingIcon: {},
6892
6906
  onclick: {},
6893
6907
  ondismiss: {},
@@ -10339,7 +10353,10 @@ function Pill_wc(e, t) {
10339
10353
  },
10340
10354
  dismissIcon: (e) => {
10341
10355
  var n = comment();
10342
- slot(first_child(n), t, "dismiss-icon", {}, null), append(e, n);
10356
+ slot(first_child(n), t, "dismiss-icon", {}, (e) => {
10357
+ var t = comment();
10358
+ html(first_child(t), () => close_default), append(e, t);
10359
+ }), append(e, n);
10343
10360
  },
10344
10361
  $$slots: {
10345
10362
  leadingIcon: !0,
@@ -10370,6 +10387,10 @@ customElements.define("sui-pill", create_custom_element(Pill_wc, {
10370
10387
  },
10371
10388
  leadingIcon: { type: "Object" },
10372
10389
  dismissIcon: { type: "Object" },
10390
+ dismissLabel: {
10391
+ attribute: "dismiss-label",
10392
+ type: "String"
10393
+ },
10373
10394
  classes: { type: "String" },
10374
10395
  onclick: { type: "Object" },
10375
10396
  ondismiss: { type: "Object" },
@@ -12286,66 +12307,85 @@ customElements.define("sui-theme-switcher", create_custom_element(ThemeSwitcher_
12286
12307
  }, [], [], { mode: "open" }));
12287
12308
  //#endregion
12288
12309
  //#region src/lib/Toggle/Toggle.svelte
12289
- var root$52 = /* @__PURE__ */ from_html("<div><div class=\"text svelte-1kpnf4s\"> </div> <label class=\"switch svelte-1kpnf4s\"><input class=\"input-checkbox svelte-1kpnf4s\" type=\"checkbox\"/> <span class=\"slider round svelte-1kpnf4s\"></span></label></div>"), $$css$50 = {
12310
+ var root$52 = /* @__PURE__ */ from_html("<div><label class=\"text svelte-1kpnf4s\"> </label> <label class=\"switch svelte-1kpnf4s\"><input class=\"input-checkbox svelte-1kpnf4s\" type=\"checkbox\"/> <span class=\"slider round svelte-1kpnf4s\"></span></label></div>"), $$css$50 = {
12290
12311
  hash: "svelte-1kpnf4s",
12291
12312
  code: ".container.svelte-1kpnf4s {display:var(--toggle-container-display, flex);align-items:var(--toggle-container-align-items, center);gap:var(--toggle-container-gap, 8px);}.container.disabled.svelte-1kpnf4s {opacity:var(--toggle-disabled-opacity, 0.4);cursor:not-allowed;pointer-events:none;}.text.svelte-1kpnf4s {font-size:var(--toggle-text-font-size, 14px);font-weight:var(--toggle-text-font-weight, 400);color:var(--toggle-text-color, #4a4a4a);margin:var(--toggle-text-margin, 0px 8px 0px 0px);order:var(--toggle-text-order, 0);}.switch.svelte-1kpnf4s {position:relative;display:inline-block;width:var(--toggle-switch-width, 46px);height:var(--toggle-switch-height, 25px);}.switch.svelte-1kpnf4s .input-checkbox:where(.svelte-1kpnf4s) {opacity:0;width:0;height:0;}.slider.svelte-1kpnf4s {position:absolute;cursor:pointer;top:var(--toggle-slider-top, 0);left:var(--toggle-slider-left, 0);right:var(--toggle-slider-right, 0);bottom:var(--toggle-slider-bottom, 0);background-color:var(--slider-unchecked-color, #ccc);-webkit-transition:var(--toggle-slider-transition, 0.4s);transition:var(--toggle-slider-transition, 0.4s);}.slider.svelte-1kpnf4s:before {position:absolute;content:'';height:var(--toggle-ball-height, 23px);width:var(--toggle-ball-width, 23px);left:var(--toggle-slider-before-left, 2px);bottom:var(--toggle-slider-before-bottom, 1px);top:var(--toggle-slider-before-top, 1px);background-color:var(--toggle-slider-before-background-color, white);-webkit-transition:var(--toggle-slider-transition, 0.4s);transition:var(--toggle-slider-transition, 0.4s);}.input-checkbox.svelte-1kpnf4s:checked + .slider:where(.svelte-1kpnf4s) {background-color:var(--slider-checked-color, #2196f3);}.input-checkbox.svelte-1kpnf4s:focus + .slider:where(.svelte-1kpnf4s) {box-shadow:0 0 1px #171717;}.input-checkbox.svelte-1kpnf4s:checked + .slider:where(.svelte-1kpnf4s):before {-webkit-transform:translateX(19px);-ms-transform:translateX(19px);transform:translateX(19px);}.slider.round.svelte-1kpnf4s {border-radius:var(--slider-border-radius, 23px);}.slider.round.svelte-1kpnf4s:before {border-radius:var(--slider-border-radius-before, 50%);}"
12292
12313
  };
12293
12314
  function Toggle(e, t) {
12315
+ let n = props_id();
12294
12316
  push(t, !0), append_styles$1(e, $$css$50);
12295
- let n = prop(t, "checked", 7, !1), i = prop(t, "text", 7, ""), a = prop(t, "disabled", 7, !1), o = prop(t, "testId", 7), s = prop(t, "classes", 7), c = prop(t, "onclick", 7), l = prop(t, "onClick", 7), u = /* @__PURE__ */ user_derived(() => l() ?? c()), f = (e) => {
12296
- e.target instanceof HTMLInputElement && typeof e.target.checked == "boolean" && n(e.target.checked), get(u)?.(n());
12317
+ let i = prop(t, "checked", 7, !1), a = prop(t, "text", 7, ""), o = prop(t, "disabled", 7, !1), s = prop(t, "testId", 7), c = prop(t, "classes", 7), l = prop(t, "id", 7), u = prop(t, "ariaLabel", 7), f = prop(t, "ariaLabelledby", 7), p = prop(t, "onclick", 7), h = prop(t, "onClick", 7), S = /* @__PURE__ */ user_derived(() => h() ?? p()), C = /* @__PURE__ */ user_derived(() => l()?.trim() || `toggle-${n}`), k = (e) => {
12318
+ e.target instanceof HTMLInputElement && typeof e.target.checked == "boolean" && i(e.target.checked), get(S)?.(i());
12297
12319
  };
12298
- var p = {
12320
+ var R = {
12299
12321
  get checked() {
12300
- return n();
12322
+ return i();
12301
12323
  },
12302
12324
  set checked(e = !1) {
12303
- n(e), flushSync();
12325
+ i(e), flushSync();
12304
12326
  },
12305
12327
  get text() {
12306
- return i();
12328
+ return a();
12307
12329
  },
12308
12330
  set text(e = "") {
12309
- i(e), flushSync();
12331
+ a(e), flushSync();
12310
12332
  },
12311
12333
  get disabled() {
12312
- return a();
12334
+ return o();
12313
12335
  },
12314
12336
  set disabled(e = !1) {
12315
- a(e), flushSync();
12337
+ o(e), flushSync();
12316
12338
  },
12317
12339
  get testId() {
12318
- return o();
12340
+ return s();
12319
12341
  },
12320
12342
  set testId(e) {
12321
- o(e), flushSync();
12343
+ s(e), flushSync();
12322
12344
  },
12323
12345
  get classes() {
12324
- return s();
12346
+ return c();
12325
12347
  },
12326
12348
  set classes(e) {
12327
- s(e), flushSync();
12349
+ c(e), flushSync();
12350
+ },
12351
+ get id() {
12352
+ return l();
12353
+ },
12354
+ set id(e) {
12355
+ l(e), flushSync();
12356
+ },
12357
+ get ariaLabel() {
12358
+ return u();
12359
+ },
12360
+ set ariaLabel(e) {
12361
+ u(e), flushSync();
12362
+ },
12363
+ get ariaLabelledby() {
12364
+ return f();
12365
+ },
12366
+ set ariaLabelledby(e) {
12367
+ f(e), flushSync();
12328
12368
  },
12329
12369
  get onclick() {
12330
- return c();
12370
+ return p();
12331
12371
  },
12332
12372
  set onclick(e) {
12333
- c(e), flushSync();
12373
+ p(e), flushSync();
12334
12374
  },
12335
12375
  get onClick() {
12336
- return l();
12376
+ return h();
12337
12377
  },
12338
12378
  set onClick(e) {
12339
- l(e), flushSync();
12379
+ h(e), flushSync();
12340
12380
  }
12341
- }, h = root$52();
12342
- let S;
12343
- var C = child(h), k = child(C, !0);
12344
- reset(C);
12345
- var R = sibling(C, 2), G = child(R);
12346
- return remove_input_defaults(G), next(2), reset(R), reset(h), template_effect(() => {
12347
- S = set_class(h, 1, `container ${s() ?? "" ?? ""}`, "svelte-1kpnf4s", S, { disabled: a() }), set_attribute(h, "aria-disabled", a()), set_attribute(h, "data-pw", o()), set_attribute(h, "testid", o()), set_attribute(C, "hidden", i().length === 0), set_text(k, i()), set_checked(G, n()), G.disabled = a();
12348
- }), delegated("click", G, f), append(e, h), pop(p);
12381
+ }, G = root$52();
12382
+ let te;
12383
+ var ne = child(G), re = child(ne, !0);
12384
+ reset(ne);
12385
+ var be = sibling(ne, 2), Me = child(be);
12386
+ return remove_input_defaults(Me), next(2), reset(be), reset(G), template_effect((e, t) => {
12387
+ te = set_class(G, 1, `container ${c() ?? "" ?? ""}`, "svelte-1kpnf4s", te, { disabled: o() }), set_attribute(G, "aria-disabled", o()), set_attribute(G, "data-pw", s()), set_attribute(G, "testid", s()), set_attribute(ne, "for", get(C)), set_attribute(ne, "hidden", a().length === 0), set_text(re, a()), set_attribute(Me, "id", get(C)), set_checked(Me, i()), Me.disabled = o(), set_attribute(Me, "aria-label", e), set_attribute(Me, "aria-labelledby", t);
12388
+ }, [() => u()?.trim() || null, () => f()?.trim() || null]), delegated("click", Me, k), append(e, G), pop(R);
12349
12389
  }
12350
12390
  delegate(["click"]), create_custom_element(Toggle, {
12351
12391
  checked: {},
@@ -12353,6 +12393,9 @@ delegate(["click"]), create_custom_element(Toggle, {
12353
12393
  disabled: {},
12354
12394
  testId: {},
12355
12395
  classes: {},
12396
+ id: {},
12397
+ ariaLabel: {},
12398
+ ariaLabelledby: {},
12356
12399
  onclick: {},
12357
12400
  onClick: {}
12358
12401
  }, [], [], { mode: "open" });
@@ -12362,11 +12405,44 @@ var rest_excludes$51 = new Set([
12362
12405
  "$$slots",
12363
12406
  "$$events",
12364
12407
  "$$legacy",
12365
- "$$host"
12408
+ "$$host",
12409
+ "inputId",
12410
+ "inputAriaLabel",
12411
+ "inputAriaLabelledby"
12366
12412
  ]);
12367
12413
  function Toggle_wc(e, t) {
12368
- let n = /* @__PURE__ */ rest_props(t, rest_excludes$51);
12369
- Toggle(e, spread_props(() => n));
12414
+ push(t, !0);
12415
+ let n = prop(t, "inputId", 7, ""), i = prop(t, "inputAriaLabel", 7, ""), a = prop(t, "inputAriaLabelledby", 7, ""), o = /* @__PURE__ */ rest_props(t, rest_excludes$51);
12416
+ return Toggle(e, spread_props(() => o, {
12417
+ get id() {
12418
+ return n();
12419
+ },
12420
+ get ariaLabel() {
12421
+ return i();
12422
+ },
12423
+ get ariaLabelledby() {
12424
+ return a();
12425
+ }
12426
+ })), pop({
12427
+ get inputId() {
12428
+ return n();
12429
+ },
12430
+ set inputId(e = "") {
12431
+ n(e), flushSync();
12432
+ },
12433
+ get inputAriaLabel() {
12434
+ return i();
12435
+ },
12436
+ set inputAriaLabel(e = "") {
12437
+ i(e), flushSync();
12438
+ },
12439
+ get inputAriaLabelledby() {
12440
+ return a();
12441
+ },
12442
+ set inputAriaLabelledby(e = "") {
12443
+ a(e), flushSync();
12444
+ }
12445
+ });
12370
12446
  }
12371
12447
  customElements.define("sui-toggle", create_custom_element(Toggle_wc, {
12372
12448
  checked: {
@@ -12387,7 +12463,19 @@ customElements.define("sui-toggle", create_custom_element(Toggle_wc, {
12387
12463
  attribute: "test-id",
12388
12464
  type: "String"
12389
12465
  },
12390
- onClick: { type: "Object" }
12466
+ onClick: { type: "Object" },
12467
+ inputId: {
12468
+ attribute: "input-id",
12469
+ type: "String"
12470
+ },
12471
+ inputAriaLabel: {
12472
+ attribute: "input-aria-label",
12473
+ type: "String"
12474
+ },
12475
+ inputAriaLabelledby: {
12476
+ attribute: "input-aria-labelledby",
12477
+ type: "String"
12478
+ }
12391
12479
  }, [], [], { mode: "open" }));
12392
12480
  //#endregion
12393
12481
  //#region src/lib/Accordion/Accordion.svelte
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "3.3.2",
3
+ "version": "3.4.1",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",