@juspay/svelte-ui-components 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,8 @@
9
9
  classes,
10
10
  testId,
11
11
  titleSnippet,
12
- descriptionSnippet
12
+ descriptionSnippet,
13
+ density
13
14
  }: EmptyStateProperties = $props();
14
15
  </script>
15
16
 
@@ -17,6 +18,7 @@
17
18
  class="empty-state {classes ?? ''}"
18
19
  data-pw={typeof testId === 'string' ? testId : null}
19
20
  testID={typeof testId === 'string' ? testId : null}
21
+ data-density={typeof density === 'string' ? density : null}
20
22
  >
21
23
  {#if typeof icon === 'function'}
22
24
  <div class="empty-state-icon">
@@ -62,13 +64,28 @@
62
64
  .empty-state {
63
65
  display: flex;
64
66
  flex-direction: column;
65
- align-items: center;
67
+ align-items: var(--empty-state-align-items, center);
66
68
  padding: var(--empty-state-padding, 32px 16px);
67
69
  text-align: var(--empty-state-text-align, center);
68
70
  gap: var(--empty-state-gap, 0px);
69
71
  color: inherit;
70
72
  }
71
73
 
74
+ /* Density-scoped fallbacks. Higher specificity than `.empty-state` alone, so
75
+ these only take over when `data-density` is actually set — no attribute,
76
+ no match, today's defaults above stand untouched. `--empty-state-padding`
77
+ and `--empty-state-gap` are read first in both cases, so an instance-level
78
+ override always wins over either density's default. */
79
+ .empty-state[data-density='page'] {
80
+ padding: var(--empty-state-padding, 48px 24px);
81
+ gap: var(--empty-state-gap, 12px);
82
+ }
83
+
84
+ .empty-state[data-density='panel'] {
85
+ padding: var(--empty-state-padding, 16px 12px);
86
+ gap: var(--empty-state-gap, 4px);
87
+ }
88
+
72
89
  .empty-state-icon {
73
90
  width: var(--empty-state-icon-size, 48px);
74
91
  height: var(--empty-state-icon-size, 48px);
@@ -16,6 +16,16 @@ export type OptionalEmptyStateProperties = {
16
16
  children?: Snippet;
17
17
  classes?: string;
18
18
  testId?: string;
19
+ /**
20
+ * Sets sane padding/gap defaults for the placeholder's context, without
21
+ * requiring a wrapper class. Omit for today's default sizing (unchanged).
22
+ * `'page'` is roomier, for a full route/view standing in for its content.
23
+ * `'panel'` is tighter, for a constrained panel, popover, or rail.
24
+ * Exposed on the root element as `data-density` so a consumer's own CSS can
25
+ * target it too. Either default can still be overridden per-instance with
26
+ * `--empty-state-padding` / `--empty-state-gap`, which always take priority.
27
+ */
28
+ density?: 'page' | 'panel';
19
29
  /**
20
30
  * Optional snippet that replaces the `title` string at render time.
21
31
  * When provided, the mandatory `title` prop is still required for backward-compatibility
package/dist-wc/index.js CHANGED
@@ -13717,12 +13717,12 @@ customElements.define("sui-card", create_custom_element(Card_wc, {
13717
13717
  //#region src/lib/EmptyState/EmptyState.svelte
13718
13718
  var root$44 = /* @__PURE__ */ from_html("<div class=\"empty-state-icon svelte-vmfces\"><!></div>"), root_1$37 = /* @__PURE__ */ from_html("<div class=\"empty-state-description svelte-vmfces\"><!></div>"), root_2$31 = /* @__PURE__ */ from_html("<div class=\"empty-state-description svelte-vmfces\"> </div>"), root_3$29 = /* @__PURE__ */ from_html("<div class=\"empty-state-actions svelte-vmfces\"><!></div>"), root_4$25 = /* @__PURE__ */ from_html("<div><!> <div class=\"empty-state-title svelte-vmfces\"><!></div> <!> <!></div>"), $$css$43 = {
13719
13719
  hash: "svelte-vmfces",
13720
- code: ".empty-state.svelte-vmfces {display:flex;flex-direction:column;align-items:center;padding:var(--empty-state-padding, 32px 16px);text-align:var(--empty-state-text-align, center);gap:var(--empty-state-gap, 0px);color:inherit;}.empty-state-icon.svelte-vmfces {width:var(--empty-state-icon-size, 48px);height:var(--empty-state-icon-size, 48px);color:var(--empty-state-icon-color, currentColor);opacity:var(--empty-state-icon-opacity, 0.4);margin-bottom:var(--empty-state-icon-margin-bottom, 16px);display:flex;align-items:center;justify-content:center;}.empty-state-icon.svelte-vmfces svg {width:100%;height:100%;}.empty-state-title.svelte-vmfces {font-size:var(--empty-state-title-font-size, 16px);font-weight:var(--empty-state-title-font-weight, 600);color:var(--empty-state-title-color, inherit);}.empty-state-description.svelte-vmfces {font-size:var(--empty-state-description-font-size, 14px);color:var(--empty-state-description-color, inherit);opacity:var(--empty-state-description-opacity, 0.6);max-width:var(--empty-state-description-max-width, 360px);margin-top:4px;}.empty-state-actions.svelte-vmfces {display:var(--empty-state-actions-display, block);flex-direction:var(--empty-state-actions-flex-direction, row);align-items:var(--empty-state-actions-align-items, stretch);justify-content:var(--empty-state-actions-justify-content, normal);gap:var(--empty-state-actions-gap, 0);margin-top:var(--empty-state-actions-margin-top, 16px);}"
13720
+ code: ".empty-state.svelte-vmfces {display:flex;flex-direction:column;align-items:var(--empty-state-align-items, center);padding:var(--empty-state-padding, 32px 16px);text-align:var(--empty-state-text-align, center);gap:var(--empty-state-gap, 0px);color:inherit;}\n\n /* Density-scoped fallbacks. Higher specificity than `.empty-state` alone, so\n these only take over when `data-density` is actually set — no attribute,\n no match, today's defaults above stand untouched. `--empty-state-padding`\n and `--empty-state-gap` are read first in both cases, so an instance-level\n override always wins over either density's default. */.empty-state[data-density='page'].svelte-vmfces {padding:var(--empty-state-padding, 48px 24px);gap:var(--empty-state-gap, 12px);}.empty-state[data-density='panel'].svelte-vmfces {padding:var(--empty-state-padding, 16px 12px);gap:var(--empty-state-gap, 4px);}.empty-state-icon.svelte-vmfces {width:var(--empty-state-icon-size, 48px);height:var(--empty-state-icon-size, 48px);color:var(--empty-state-icon-color, currentColor);opacity:var(--empty-state-icon-opacity, 0.4);margin-bottom:var(--empty-state-icon-margin-bottom, 16px);display:flex;align-items:center;justify-content:center;}.empty-state-icon.svelte-vmfces svg {width:100%;height:100%;}.empty-state-title.svelte-vmfces {font-size:var(--empty-state-title-font-size, 16px);font-weight:var(--empty-state-title-font-weight, 600);color:var(--empty-state-title-color, inherit);}.empty-state-description.svelte-vmfces {font-size:var(--empty-state-description-font-size, 14px);color:var(--empty-state-description-color, inherit);opacity:var(--empty-state-description-opacity, 0.6);max-width:var(--empty-state-description-max-width, 360px);margin-top:4px;}.empty-state-actions.svelte-vmfces {display:var(--empty-state-actions-display, block);flex-direction:var(--empty-state-actions-flex-direction, row);align-items:var(--empty-state-actions-align-items, stretch);justify-content:var(--empty-state-actions-justify-content, normal);gap:var(--empty-state-actions-gap, 0);margin-top:var(--empty-state-actions-margin-top, 16px);}"
13721
13721
  };
13722
13722
  function EmptyState(e, t) {
13723
13723
  push(t, !0), append_styles$1(e, $$css$43);
13724
- let n = prop(t, "title", 7), i = prop(t, "description", 7), a = prop(t, "icon", 7), o = prop(t, "children", 7), s = prop(t, "classes", 7), c = prop(t, "testId", 7), l = prop(t, "titleSnippet", 7), u = prop(t, "descriptionSnippet", 7);
13725
- var f = {
13724
+ let n = prop(t, "title", 7), i = prop(t, "description", 7), a = prop(t, "icon", 7), o = prop(t, "children", 7), s = prop(t, "classes", 7), c = prop(t, "testId", 7), l = prop(t, "titleSnippet", 7), u = prop(t, "descriptionSnippet", 7), f = prop(t, "density", 7);
13725
+ var p = {
13726
13726
  get title() {
13727
13727
  return n();
13728
13728
  },
@@ -13770,47 +13770,53 @@ function EmptyState(e, t) {
13770
13770
  },
13771
13771
  set descriptionSnippet(e) {
13772
13772
  u(e), flushSync();
13773
+ },
13774
+ get density() {
13775
+ return f();
13776
+ },
13777
+ set density(e) {
13778
+ f(e), flushSync();
13773
13779
  }
13774
- }, p = root_4$25(), h = child(p), S = (e) => {
13780
+ }, h = root_4$25(), S = child(h), C = (e) => {
13775
13781
  var t = root$44();
13776
13782
  snippet(child(t), a), reset(t), append(e, t);
13777
13783
  };
13778
- if_block(h, (e) => {
13779
- typeof a() == "function" && e(S);
13784
+ if_block(S, (e) => {
13785
+ typeof a() == "function" && e(C);
13780
13786
  });
13781
- var C = sibling(h, 2), k = child(C), R = (e) => {
13787
+ var k = sibling(S, 2), R = child(k), te = (e) => {
13782
13788
  var t = comment();
13783
13789
  snippet(first_child(t), l), append(e, t);
13784
- }, te = (e) => {
13790
+ }, ne = (e) => {
13785
13791
  var t = text();
13786
13792
  template_effect(() => set_text(t, n())), append(e, t);
13787
13793
  };
13788
- if_block(k, (e) => {
13789
- typeof l() == "function" ? e(R) : e(te, -1);
13790
- }), reset(C);
13791
- var ne = sibling(C, 2), re = (e) => {
13794
+ if_block(R, (e) => {
13795
+ typeof l() == "function" ? e(te) : e(ne, -1);
13796
+ }), reset(k);
13797
+ var re = sibling(k, 2), G = (e) => {
13792
13798
  var t = root_1$37();
13793
13799
  snippet(child(t), u), reset(t), template_effect(() => {
13794
13800
  set_attribute(t, "data-pw", typeof c() == "string" ? `${c()}-description` : null), set_attribute(t, "testid", typeof c() == "string" ? `${c()}-description` : null);
13795
13801
  }), append(e, t);
13796
- }, G = (e) => {
13802
+ }, be = (e) => {
13797
13803
  var t = root_2$31(), n = child(t, !0);
13798
13804
  reset(t), template_effect(() => {
13799
13805
  set_attribute(t, "data-pw", typeof c() == "string" ? `${c()}-description` : null), set_attribute(t, "testid", typeof c() == "string" ? `${c()}-description` : null), set_text(n, i());
13800
13806
  }), append(e, t);
13801
13807
  };
13802
- if_block(ne, (e) => {
13803
- typeof u() == "function" ? e(re) : typeof i() == "string" && i().length > 0 && e(G, 1);
13808
+ if_block(re, (e) => {
13809
+ typeof u() == "function" ? e(G) : typeof i() == "string" && i().length > 0 && e(be, 1);
13804
13810
  });
13805
- var be = sibling(ne, 2), Me = (e) => {
13811
+ var Me = sibling(re, 2), Re = (e) => {
13806
13812
  var t = root_3$29();
13807
13813
  snippet(child(t), o), reset(t), append(e, t);
13808
13814
  };
13809
- return if_block(be, (e) => {
13810
- typeof o() == "function" && e(Me);
13811
- }), reset(p), template_effect(() => {
13812
- set_class(p, 1, `empty-state ${s() ?? "" ?? ""}`, "svelte-vmfces"), set_attribute(p, "data-pw", typeof c() == "string" ? c() : null), set_attribute(p, "testid", typeof c() == "string" ? c() : null), set_attribute(C, "data-pw", typeof c() == "string" ? `${c()}-title` : null), set_attribute(C, "testid", typeof c() == "string" ? `${c()}-title` : null);
13813
- }), append(e, p), pop(f);
13815
+ return if_block(Me, (e) => {
13816
+ typeof o() == "function" && e(Re);
13817
+ }), reset(h), template_effect(() => {
13818
+ set_class(h, 1, `empty-state ${s() ?? "" ?? ""}`, "svelte-vmfces"), set_attribute(h, "data-pw", typeof c() == "string" ? c() : null), set_attribute(h, "testid", typeof c() == "string" ? c() : null), set_attribute(h, "data-density", typeof f() == "string" ? f() : null), set_attribute(k, "data-pw", typeof c() == "string" ? `${c()}-title` : null), set_attribute(k, "testid", typeof c() == "string" ? `${c()}-title` : null);
13819
+ }), append(e, h), pop(p);
13814
13820
  }
13815
13821
  create_custom_element(EmptyState, {
13816
13822
  title: {},
@@ -13820,7 +13826,8 @@ create_custom_element(EmptyState, {
13820
13826
  classes: {},
13821
13827
  testId: {},
13822
13828
  titleSnippet: {},
13823
- descriptionSnippet: {}
13829
+ descriptionSnippet: {},
13830
+ density: {}
13824
13831
  }, [], [], { mode: "open" });
13825
13832
  //#endregion
13826
13833
  //#region src/wc/components/EmptyState.wc.svelte
@@ -13884,6 +13891,7 @@ customElements.define("sui-empty-state", create_custom_element(EmptyState_wc, {
13884
13891
  attribute: "test-id",
13885
13892
  type: "String"
13886
13893
  },
13894
+ density: { type: "String" },
13887
13895
  icon: { type: "Object" },
13888
13896
  titleSnippet: { type: "Object" },
13889
13897
  descriptionSnippet: { type: "Object" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",