@juspay/svelte-ui-components 2.92.0 → 2.93.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.
@@ -37,6 +37,7 @@
37
37
  onKeyDown = () => {},
38
38
  classes,
39
39
  role,
40
+ ariaLabel,
40
41
  ariaExpanded,
41
42
  ariaAutocomplete,
42
43
  ariaControls,
@@ -256,6 +257,7 @@
256
257
  <textarea
257
258
  {value}
258
259
  {placeholder}
260
+ aria-label={ariaLabel}
259
261
  autocomplete={autoComplete}
260
262
  inputmode={inputMode}
261
263
  {name}
@@ -287,6 +289,7 @@
287
289
  type={dataType}
288
290
  {value}
289
291
  {placeholder}
292
+ aria-label={ariaLabel}
290
293
  autocomplete={autoComplete}
291
294
  inputmode={inputMode}
292
295
  {name}
@@ -52,6 +52,8 @@ export type OptionalInputProperties = {
52
52
  testId?: string;
53
53
  classes?: string;
54
54
  role?: string;
55
+ /** Accessible name applied to the native input/textarea (aria-label). */
56
+ ariaLabel?: string | null;
55
57
  ariaExpanded?: boolean;
56
58
  ariaAutocomplete?: 'none' | 'inline' | 'list' | 'both';
57
59
  ariaControls?: string | null;
@@ -274,6 +274,9 @@
274
274
  {:else if column.type === 'input'}
275
275
  {@const inputData = asInputCellData(value)}
276
276
  {#if inputData}
277
+ {#snippet inputLeadingIcon()}
278
+ <img class="builtin-input-icon" src={inputData.iconUrl} alt="" />
279
+ {/snippet}
277
280
  <!-- svelte-ignore a11y_no_static_element_interactions -->
278
281
  <span
279
282
  class="builtin-interactive"
@@ -283,6 +286,7 @@
283
286
  <Input
284
287
  value={inputData.value ?? ''}
285
288
  placeholder={inputData.placeholder ?? ''}
289
+ ariaLabel={inputData.ariaLabel ?? null}
286
290
  disable={inputData.disabled ?? false}
287
291
  testId={inputData.testId ?? ''}
288
292
  dataType={asInputDataType(inputData.dataType ?? null)}
@@ -292,6 +296,7 @@
292
296
  onErrorMessage={inputData.onErrorMessage ?? null}
293
297
  actionInput={false}
294
298
  onInput={(newValue) => column.onInput?.(rowIndex, newValue, originalIndex)}
299
+ {...inputData.iconUrl ? { leftIcon: inputLeadingIcon } : {}}
295
300
  />
296
301
  </span>
297
302
  {:else}
@@ -589,6 +594,12 @@
589
594
  width: var(--table-interactive-width, auto);
590
595
  }
591
596
 
597
+ .builtin-input-icon {
598
+ display: block;
599
+ width: var(--table-cell-input-icon-size, 16px);
600
+ height: var(--table-cell-input-icon-size, 16px);
601
+ }
602
+
592
603
  .builtin-action-group {
593
604
  gap: var(--table-cell-inline-gap, 8px);
594
605
  }
@@ -157,6 +157,12 @@ export const asInputCellData = (value) => {
157
157
  if (typeof record.testId === 'string') {
158
158
  inputData.testId = record.testId;
159
159
  }
160
+ if (typeof record.ariaLabel === 'string') {
161
+ inputData.ariaLabel = record.ariaLabel;
162
+ }
163
+ if (typeof record.iconUrl === 'string') {
164
+ inputData.iconUrl = record.iconUrl;
165
+ }
160
166
  if (typeof record.dataType === 'string') {
161
167
  inputData.dataType = record.dataType;
162
168
  }
@@ -107,6 +107,17 @@ export type TableInputCellData = {
107
107
  placeholder?: string;
108
108
  disabled?: boolean;
109
109
  testId?: string;
110
+ /**
111
+ * Accessible name forwarded to the rendered Input's native element
112
+ * (aria-label). Recommended whenever the cell has no visible label —
113
+ * required in practice for icon-bearing inputs.
114
+ */
115
+ ariaLabel?: string;
116
+ /**
117
+ * URL of a passive leading icon rendered inside the input field (e.g. a
118
+ * currency glyph). Sized via `--table-cell-input-icon-size` (default 16px).
119
+ */
120
+ iconUrl?: string;
110
121
  /** Input dataType forwarded to the rendered Input ('text' | 'tel' | 'number' | …). */
111
122
  dataType?: string;
112
123
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "2.92.0",
3
+ "version": "2.93.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",