@brightspace-ui/core 2.173.2 → 2.174.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.
@@ -105,6 +105,34 @@
105
105
  </template>
106
106
  </d2l-demo-snippet>
107
107
 
108
+ <h2>Inline Help</h2>
109
+ <d2l-demo-snippet>
110
+ <template>
111
+ <d2l-input-number label="Age" value="18">
112
+ <div slot="inline-help">
113
+ Help text <b>right here</b>!
114
+ </div>
115
+ </d2l-input-number>
116
+ </template>
117
+ </d2l-demo-snippet>
118
+
119
+ <h2>Inline Help (multiline)</h2>
120
+ <d2l-demo-snippet>
121
+ <template>
122
+ <d2l-input-number label="Age" value="18">
123
+ <div slot="inline-help">
124
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit,
125
+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
126
+ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
127
+ nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
128
+ reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
129
+ pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
130
+ qui officia deserunt mollit anim id est laborum.
131
+ </div>
132
+ </d2l-input-number>
133
+ </template>
134
+ </d2l-demo-snippet>
135
+
108
136
  </d2l-demo-page>
109
137
  <script>
110
138
  document.body.addEventListener('change', e => console.log('change', e.srcElement.value));
@@ -36,6 +36,34 @@
36
36
  </template>
37
37
  </d2l-demo-snippet>
38
38
 
39
+ <h2>Search Input with Inline Help</h2>
40
+ <d2l-demo-snippet>
41
+ <template>
42
+ <d2l-input-search label="Search" value="apples" placeholder="Search for some stuff">
43
+ <div slot="inline-help">
44
+ Help text <b>right here</b>!
45
+ </div>
46
+ </d2l-input-search>
47
+ </template>
48
+ </d2l-demo-snippet>
49
+
50
+ <h2>Search Input with Inline Help (multiline)</h2>
51
+ <d2l-demo-snippet>
52
+ <template>
53
+ <d2l-input-search label="Search" value="apples" placeholder="Search for some stuff">
54
+ <div slot="inline-help">
55
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit,
56
+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
57
+ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
58
+ nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
59
+ reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
60
+ pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
61
+ qui officia deserunt mollit anim id est laborum.
62
+ </div>
63
+ </d2l-input-search>
64
+ </template>
65
+ </d2l-demo-snippet>
66
+
39
67
  <script>
40
68
  document.body.addEventListener('d2l-input-search-searched', (e) => {
41
69
  // eslint-disable-next-line no-console
@@ -136,6 +136,34 @@
136
136
  </template>
137
137
  </d2l-demo-snippet>
138
138
 
139
+ <h2>Inline Help</h2>
140
+ <d2l-demo-snippet>
141
+ <template>
142
+ <d2l-input-text label="Name">
143
+ <div slot="inline-help">
144
+ Help text <b>right here</b>!
145
+ </div>
146
+ </d2l-input-text>
147
+ </template>
148
+ </d2l-demo-snippet>
149
+
150
+ <h2>Inline help (multiline) checkbox</h2>
151
+ <d2l-demo-snippet>
152
+ <template>
153
+ <d2l-input-text label="Name">
154
+ <div slot="inline-help">
155
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit,
156
+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
157
+ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
158
+ nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
159
+ reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
160
+ pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
161
+ qui officia deserunt mollit anim id est laborum.
162
+ </div>
163
+ </d2l-input-text>
164
+ </template>
165
+ </d2l-demo-snippet>
166
+
139
167
  </d2l-demo-page>
140
168
  </body>
141
169
  </html>
@@ -363,6 +363,7 @@ class InputNumber extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixi
363
363
  <slot slot="left" name="left"></slot>
364
364
  <slot slot="right" name="right"></slot>
365
365
  <slot slot="after" name="after"></slot>
366
+ <slot slot="inline-help" name="inline-help"></slot>
366
367
  </d2l-input-text>
367
368
  ${this._getTooltip()}
368
369
  `;
@@ -140,6 +140,7 @@ class InputSearch extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement)))
140
140
  type="search"
141
141
  .value="${this.value}">
142
142
  ${search}
143
+ <slot slot="inline-help" name="inline-help"></slot>
143
144
  </d2l-input-text>
144
145
  `;
145
146
  }
@@ -7,6 +7,7 @@ import { formatNumber } from '@brightspace-ui/intl/lib/number.js';
7
7
  import { FormElementMixin } from '../form/form-element-mixin.js';
8
8
  import { getUniqueId } from '../../helpers/uniqueId.js';
9
9
  import { ifDefined } from 'lit/directives/if-defined.js';
10
+ import { InputInlineHelpMixin } from './input-inline-help-mixin.js';
10
11
  import { inputLabelStyles } from './input-label-styles.js';
11
12
  import { inputStyles } from './input-styles.js';
12
13
  import { LabelledMixin } from '../../mixins/labelled/labelled-mixin.js';
@@ -25,7 +26,7 @@ import { styleMap } from 'lit/directives/style-map.js';
25
26
  * @fires change - Dispatched when an alteration to the value is committed (typically after focus is lost) by the user
26
27
  * @fires input - Dispatched immediately after changes by the user
27
28
  */
28
- class InputText extends PropertyRequiredMixin(FocusMixin(LabelledMixin(FormElementMixin(SkeletonMixin(RtlMixin(LitElement)))))) {
29
+ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(LabelledMixin(FormElementMixin(SkeletonMixin(RtlMixin(LitElement))))))) {
29
30
 
30
31
  static get properties() {
31
32
  return {
@@ -278,6 +279,7 @@ class InputText extends PropertyRequiredMixin(FocusMixin(LabelledMixin(FormEleme
278
279
  this._focused = false;
279
280
  this._hasAfterContent = false;
280
281
  this._hovered = false;
282
+ this._inlineHelpId = getUniqueId();
281
283
  this._inputId = getUniqueId();
282
284
  this._intersectionObserver = null;
283
285
  this._isIntersecting = false;
@@ -427,11 +429,13 @@ class InputText extends PropertyRequiredMixin(FocusMixin(LabelledMixin(FormEleme
427
429
  const unit = this.unit
428
430
  ? html`<span aria-hidden="true" class="d2l-input-unit" @click="${this._handleUnitClick}">${this.unit}</span>`
429
431
  : null;
432
+ const ariaDescribedByIds = `${this.description ? this._descriptionId : ''} ${this._hasInlineHelp ? this._inlineHelpId : ''}`.trim();
430
433
 
431
434
  const input = html`
432
435
  <div class="d2l-input-container">
433
436
  <div class="d2l-input-text-container d2l-skeletize" style="${styleMap(inputContainerStyles)}">
434
- <input aria-describedby="${ifDefined(this.description ? this._descriptionId : undefined)}"
437
+ <input
438
+ aria-describedby="${ifDefined(ariaDescribedByIds.length > 0 ? ariaDescribedByIds : undefined)}"
435
439
  aria-haspopup="${ifDefined(this.ariaHaspopup)}"
436
440
  aria-invalid="${ifDefined(ariaInvalid)}"
437
441
  aria-label="${ifDefined(this._getAriaLabel())}"
@@ -465,6 +469,7 @@ class InputText extends PropertyRequiredMixin(FocusMixin(LabelledMixin(FormEleme
465
469
  ${ (!isValid && !this.hideInvalidIcon && !this._focused) ? html`<div class="d2l-input-text-invalid-icon" style="${styleMap(invalidIconStyles)}" @click="${this._handleInvalidIconClick}"></div>` : null}
466
470
  </div><div id="after-slot" class="d2l-skeletize" ?hidden="${!this._hasAfterContent}"><slot name="after" @slotchange="${this._handleAfterSlotChange}"></slot></div>
467
471
  </div>
472
+ ${this._renderInlineHelp(this._inlineHelpId)}
468
473
  ${offscreenContainer}
469
474
  `;
470
475
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.173.2",
3
+ "version": "2.174.1",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",