@onsvisual/svelte-components 1.1.57 → 1.1.59

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.
@@ -23,6 +23,11 @@
23
23
  * @type {boolean}
24
24
  */
25
25
  export let hideLabel = false;
26
+ /**
27
+ * An optional description to help users know what to enter
28
+ * @type {string|null}
29
+ */
30
+ export let description = null;
26
31
  /**
27
32
  * An optional placeholder text
28
33
  * @type {string}
@@ -52,7 +57,20 @@
52
57
 
53
58
  <div class="ons-field {cls}">
54
59
  {#if label}
55
- <label class="ons-label" for={id} class:ons-u-vh={hideLabel}>{label}</label>
60
+ <label
61
+ class="ons-label"
62
+ class:ons-label--with-description={description}
63
+ class:ons-u-vh={hideLabel}
64
+ aria-describedby={description ? `${id}-description-hint` : null}
65
+ for={id}
66
+ >
67
+ {label}
68
+ </label>
69
+ {/if}
70
+ {#if description}
71
+ <span id="{id}-description-hint" class="ons-label__description ons-input--with-description">
72
+ {description}
73
+ </span>
56
74
  {/if}
57
75
  <select
58
76
  {id}
@@ -8,6 +8,7 @@ export default class Dropdown extends SvelteComponentTyped<{
8
8
  label?: string | null | undefined;
9
9
  name?: string | null | undefined;
10
10
  hideLabel?: boolean | undefined;
11
+ description?: string | null | undefined;
11
12
  value?: object | null | undefined;
12
13
  placeholder?: string | undefined;
13
14
  options?: object[] | undefined;
@@ -31,6 +32,7 @@ declare const __propDef: {
31
32
  label?: string | null | undefined;
32
33
  name?: string | null | undefined;
33
34
  hideLabel?: boolean | undefined;
35
+ description?: string | null | undefined;
34
36
  value?: object | null | undefined;
35
37
  placeholder?: string | undefined;
36
38
  options?: object[] | undefined;
@@ -54,6 +54,11 @@
54
54
  * @type {boolean}
55
55
  */
56
56
  export let hideLabel = false;
57
+ /**
58
+ * An optional description to help users know what to enter
59
+ * @type {string|null}
60
+ */
61
+ export let description = null;
57
62
  /**
58
63
  * An optional placeholder text
59
64
  * @type {string}
@@ -216,7 +221,22 @@
216
221
  {/if}
217
222
  {:else}
218
223
  <div class="ons-field {cls}">
219
- {#if label}<label for={id} class="ons-label" class:ons-u-vh={hideLabel}>{label}</label>{/if}
224
+ {#if label}
225
+ <label
226
+ class="ons-label"
227
+ class:ons-label--with-description={description}
228
+ class:ons-u-vh={hideLabel}
229
+ aria-describedby={description ? `${id}-description-hint` : null}
230
+ for={id}
231
+ >
232
+ {label}
233
+ </label>
234
+ {/if}
235
+ {#if description}
236
+ <span id="{id}-description-hint" class="ons-label__description ons-input--with-description">
237
+ {description}
238
+ </span>
239
+ {/if}
220
240
  <div class="ons-autocomplete-wrapper">
221
241
  {#if mounted}
222
242
  <div
@@ -7,6 +7,7 @@ export default class Select extends SvelteComponentTyped<{
7
7
  label?: string | null | undefined;
8
8
  name?: string | undefined;
9
9
  hideLabel?: boolean | undefined;
10
+ description?: string | null | undefined;
10
11
  value?: object | undefined;
11
12
  placeholder?: string | undefined;
12
13
  options?: array;
@@ -38,6 +39,7 @@ declare const __propDef: {
38
39
  label?: string | null | undefined;
39
40
  name?: string | undefined;
40
41
  hideLabel?: boolean | undefined;
42
+ description?: string | null | undefined;
41
43
  value?: object | undefined;
42
44
  placeholder?: string | undefined;
43
45
  options?: array;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onsvisual/svelte-components",
3
- "version": "1.1.57",
3
+ "version": "1.1.59",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "npm run build:package && npm run build:docs",