@juspay/svelte-ui-components 2.120.2 → 2.121.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.
@@ -263,7 +263,7 @@
263
263
  </span>
264
264
  {:else if typeof item.icon === 'string' && item.icon.length > 0}
265
265
  <div class="command-menu-item-icon-img-wrapper">
266
- <Img src={item.icon} alt="" />
266
+ <Img inlineSvg src={item.icon} alt="" />
267
267
  </div>
268
268
  {/if}
269
269
  <span class="command-menu-item-label">{item.label}</span>
@@ -416,6 +416,9 @@
416
416
  .command-menu-item-icon-img-wrapper {
417
417
  --image-width: var(--command-menu-item-icon-size, 20px);
418
418
  --image-height: var(--command-menu-item-icon-size, 20px);
419
+
420
+ /* Mirrors --command-menu-search-icon-color, which this component already had. */
421
+ color: var(--command-menu-item-icon-color, inherit);
419
422
  flex-shrink: 0;
420
423
  display: flex;
421
424
  align-items: center;
@@ -17,7 +17,7 @@
17
17
  {#if compact}
18
18
  <div class="file-dropzone-trigger-compact {classes ?? ''}">
19
19
  <div class="file-dropzone-trigger-icon-sm" aria-hidden="true">
20
- <Img src={icon} alt="" fallback="" classes="file-dropzone-trigger-icon-sm-img" />
20
+ <Img inlineSvg src={icon} alt="" fallback="" classes="file-dropzone-trigger-icon-sm-img" />
21
21
  </div>
22
22
  <span class="file-dropzone-trigger-heading" data-pw={testId} testID={testId}>{heading}</span>
23
23
  </div>
@@ -28,7 +28,7 @@
28
28
  {...typeof testId === 'string' ? { testId } : {}}
29
29
  >
30
30
  <div class="file-dropzone-trigger-icon" aria-hidden="true">
31
- <Img src={icon} alt="" fallback="" classes="file-dropzone-trigger-icon-img" />
31
+ <Img inlineSvg src={icon} alt="" fallback="" classes="file-dropzone-trigger-icon-img" />
32
32
  </div>
33
33
  <p class="file-dropzone-trigger-heading-wrap">
34
34
  <span class="file-dropzone-trigger-heading">{heading}</span>
@@ -57,11 +57,17 @@
57
57
  .file-dropzone-trigger-icon-sm :global(.file-dropzone-trigger-icon-sm-img) {
58
58
  --image-width: var(--file-dropzone-trigger-icon-sm-size, 16px);
59
59
  --image-height: var(--file-dropzone-trigger-icon-sm-size, 16px);
60
+
61
+ color: var(--file-dropzone-trigger-icon-color, inherit);
60
62
  }
61
63
 
62
64
  .file-dropzone-trigger-icon :global(.file-dropzone-trigger-icon-img) {
63
65
  --image-width: var(--file-dropzone-trigger-icon-size, 24px);
64
66
  --image-height: var(--file-dropzone-trigger-icon-size, 24px);
67
+
68
+ /* Both sizes share one colour token deliberately: they are the same icon at two
69
+ scales, and splitting them would invite the two to drift apart. */
70
+ color: var(--file-dropzone-trigger-icon-color, inherit);
65
71
  }
66
72
 
67
73
  .file-dropzone-trigger-heading {
@@ -406,8 +406,10 @@
406
406
  >
407
407
  {#if typeof leftIcon === 'string' && leftIcon.length > 0}
408
408
  <Img
409
+ inlineSvg
409
410
  src={leftIcon}
410
411
  alt=""
412
+ fallback=""
411
413
  classes="select-left-icon"
412
414
  {...typeof leftIconTestId === 'string' ? { testId: leftIconTestId } : {}}
413
415
  />
@@ -601,7 +603,13 @@
601
603
  {/if}
602
604
  {/if}
603
605
  {#if typeof row.item.icon === 'string' && row.item.icon.length > 0}
604
- <Img src={row.item.icon} alt="" fallback="" classes="select-option-icon" />
606
+ <Img
607
+ inlineSvg
608
+ src={row.item.icon}
609
+ alt=""
610
+ fallback=""
611
+ classes="select-option-icon"
612
+ />
605
613
  {/if}
606
614
  <span class="select-option-label">{row.item.label}</span>
607
615
  {#if showSelectedTick && !multiple && value.includes(row.item.id)}
@@ -656,6 +664,13 @@
656
664
  --image-width: var(--select-left-icon-size, 16px);
657
665
  --image-height: var(--select-left-icon-size, 16px);
658
666
  --image-object-fit: contain;
667
+
668
+ /* The icon inlines, so a currentColor asset resolves against this. Defaults to
669
+ `inherit` — the trigger's text colour, which is what it already did — so this is
670
+ a hook, not a change. Without it a consumer cannot tint the icon independently
671
+ of the label, and an icon migrated to currentColor is forced to match its label
672
+ exactly, flattening any deliberate muted-icon/strong-label hierarchy. */
673
+ color: var(--select-left-icon-color, inherit);
659
674
  flex: none;
660
675
  }
661
676
 
@@ -777,6 +792,7 @@
777
792
  --image-height: var(--select-option-icon-size, 16px);
778
793
  --image-object-fit: contain;
779
794
 
795
+ color: var(--select-option-icon-color, inherit);
780
796
  vertical-align: middle;
781
797
  margin-right: var(--select-option-icon-gap, 8px);
782
798
  }
@@ -9,6 +9,8 @@ export type SelectItem = {
9
9
  * Optional image src (URL or data URI) rendered at the left of the option row,
10
10
  * before the label — for icon pickers and any list whose options carry a glyph.
11
11
  * Size is controlled by the `--select-option-icon-size` CSS variable (default 16px).
12
+ * An SVG source is inlined, so an icon drawn with `currentColor` inherits the
13
+ * option row's text colour; anything else renders as a plain `<img>`.
12
14
  * Pair with the trigger's `leftIcon` (driven by the selected option's icon) to show
13
15
  * the current selection in the closed trigger.
14
16
  */
@@ -70,7 +72,12 @@ export type OptionalSelectProperties = {
70
72
  }]>;
71
73
  /** Visual hierarchy of the trigger. `'ghost'` renders a transparent, borderless trigger — useful when the Select is embedded in a toolbar or header where a full bordered input would be visually heavy. Defaults to `'default'`. */
72
74
  hierarchy?: SelectHierarchy;
73
- /** Optional image src (URL or data URI) rendered at the left of the trigger. Size is controlled by the `--select-left-icon-size` CSS variable (default 16px). */
75
+ /**
76
+ * Optional image src (URL or data URI) rendered at the left of the trigger.
77
+ * Size is controlled by the `--select-left-icon-size` CSS variable (default 16px).
78
+ * An SVG source is inlined, so an icon drawn with `currentColor` inherits the
79
+ * trigger's text colour; anything else renders as a plain `<img>`.
80
+ */
74
81
  leftIcon?: string;
75
82
  /** `data-pw` test id forwarded to the leading icon `<Img>` element. */
76
83
  leftIconTestId?: string;
@@ -25,7 +25,7 @@
25
25
  {#if icon}
26
26
  {@render icon()}
27
27
  {:else}
28
- <Img src={statusIcon} alt="status" />
28
+ <Img inlineSvg src={statusIcon} alt="status" />
29
29
  {/if}
30
30
  </div>
31
31
  <div class="status-text">{statusText}</div>
@@ -54,6 +54,7 @@
54
54
  }
55
55
 
56
56
  .status-image {
57
+ color: var(--status-icon-color, inherit);
57
58
  display: flex;
58
59
  margin-bottom: 25px;
59
60
  }
@@ -146,7 +146,7 @@
146
146
  data-pw={column.testId ? `${column.testId}-icon-${iconIndex}` : null}
147
147
  testID={column.testId ? `${column.testId}-icon-${iconIndex}` : null}
148
148
  >
149
- <Img src={String(iconSrc)} alt="" fallback="" />
149
+ <Img inlineSvg src={String(iconSrc)} alt="" fallback="" />
150
150
  </span>
151
151
  {/each}
152
152
  <span>{typeof data.label === 'string' ? data.label : '-'}</span>
@@ -589,6 +589,8 @@
589
589
  .builtin-icon-label-icon :global(svg) {
590
590
  width: var(--table-cell-icon-size, 16px);
591
591
  height: var(--table-cell-icon-size, 16px);
592
+
593
+ color: var(--table-cell-icon-color, inherit);
592
594
  display: block;
593
595
  }
594
596
 
@@ -281,7 +281,7 @@
281
281
  })}
282
282
  {:else}
283
283
  {#if typeof tabItem?.icon === 'string' && tabItem.icon.length > 0}
284
- <Img src={tabItem.icon} alt="" fallback="" classes="tabs-item-icon" />
284
+ <Img inlineSvg src={tabItem.icon} alt="" fallback="" classes="tabs-item-icon" />
285
285
  {/if}
286
286
  <span class="tabs-item-label" data-text={label}>{label}</span>
287
287
  {#if tabItem?.status && tabItem.status !== 'none'}
@@ -445,6 +445,7 @@
445
445
  --image-height: var(--tabs-item-icon-size, 16px);
446
446
  --image-object-fit: contain;
447
447
 
448
+ color: var(--tabs-item-icon-color, inherit);
448
449
  flex-shrink: 0;
449
450
  }
450
451
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "2.120.2",
3
+ "version": "2.121.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",