@brightspace-ui/core 2.187.4 → 2.188.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.
@@ -168,15 +168,10 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
168
168
  top: 2px;
169
169
  }
170
170
  .d2l-collapsible-panel-title {
171
- -webkit-box-orient: vertical;
172
- display: -webkit-box;
173
171
  flex: 1;
174
- -webkit-line-clamp: 2;
175
172
  margin: 0.3rem;
176
173
  margin-inline-start: var(--d2l-collapsible-panel-spacing-inline);
177
174
  overflow-wrap: anywhere;
178
- overflow-x: hidden;
179
- overflow-y: hidden;
180
175
  user-select: none;
181
176
  }
182
177
  .d2l-collapsible-panel.has-before .d2l-collapsible-panel-title {
@@ -390,7 +385,7 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
390
385
 
391
386
  _handleExpandCollapse(e) {
392
387
  const eventPromise = this.expanded ? e.detail.expandComplete : e.detail.collapseComplete;
393
- const event = `d2l-collapsible-panel-${this.expanded ? 'expand' : 'collapse' }`;
388
+ const event = this.expanded ? 'd2l-collapsible-panel-expand' : 'd2l-collapsible-panel-collapse';
394
389
 
395
390
  this.dispatchEvent(new CustomEvent(
396
391
  event, { bubbles: false, composed: false, detail: { complete: eventPromise } }
@@ -1,41 +1,32 @@
1
1
  import '../input-radio-spacer.js';
2
2
  import { html, LitElement } from 'lit';
3
- import { bodySmallStyles } from '../../typography/styles.js';
3
+ import { inlineHelpStyles } from '../input-inline-help.js';
4
4
  import { radioStyles } from '../input-radio-styles.js';
5
5
 
6
6
  class TestInputRadioSpacer extends LitElement {
7
7
 
8
8
  static get styles() {
9
- return [ radioStyles, bodySmallStyles ];
9
+ return [ radioStyles, inlineHelpStyles ];
10
10
  }
11
11
 
12
12
  render() {
13
13
  return html`
14
14
  <div>
15
15
  <label class="d2l-input-radio-label">
16
- <input type="radio" name="myGroup" value="normal" checked>
16
+ <input type="radio" aria-describedby="desc1" name="myGroup" value="normal">
17
17
  Option 1
18
18
  </label>
19
- <d2l-input-radio-spacer>
19
+ <d2l-input-radio-spacer id="desc1" class="d2l-input-inline-help">
20
20
  Additional content can go here and will line up nicely with the edge of the radio.
21
21
  </d2l-input-radio-spacer>
22
22
  </div>
23
23
  <div>
24
24
  <label class="d2l-input-radio-label">
25
- <input type="radio" name="myGroup" value="normal">
26
- Option 1 (A really really long label that will wrap to the next line where the indentation will be applied. All the text should align.)
25
+ <input type="radio" aria-describedby="desc2" name="myGroup" value="normal">
26
+ Option 1 (Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker.)
27
27
  </label>
28
- <d2l-input-radio-spacer>
29
- Additional content can go here and will line up nicely with the edge of the radio.
30
- </d2l-input-radio-spacer>
31
- </div>
32
- <div>
33
- <label class="d2l-input-radio-label">
34
- <input type="radio" name="myGroup" value="normal">
35
- Option 1
36
- </label>
37
- <d2l-input-radio-spacer>
38
- <div class="d2l-body-small">Additional content can go here and will line up nicely with the edge of the radio.</div>
28
+ <d2l-input-radio-spacer id="desc2" class="d2l-input-inline-help">
29
+ Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.
39
30
  </d2l-input-radio-spacer>
40
31
  </div>
41
32
  `;
@@ -123,21 +123,22 @@ To align related content below radio buttons, the `d2l-input-radio-spacer` eleme
123
123
  <script type="module">
124
124
  import '@brightspace-ui/core/components/inputs/input-radio-spacer.js';
125
125
  import { html, LitElement } from 'lit';
126
+ import { inlineHelpStyles } from '@brightspace-ui/core/components/inputs/input-inline-help.js';
126
127
  import { radioStyles } from '@brightspace-ui/core/components/inputs/input-radio-styles.js';
127
128
 
128
129
  class MyRadioElem extends LitElement {
129
130
 
130
131
  static get styles() {
131
- return radioStyles;
132
+ return [ radioStyles, inlineHelpStyles ];
132
133
  }
133
134
 
134
135
  render() {
135
136
  return html`
136
137
  <label class="d2l-input-radio-label">
137
- <input type="radio" value="normal" checked>
138
+ <input type="radio" aria-describedby="desc1" value="normal" checked>
138
139
  Option 1
139
140
  </label>
140
- <d2l-input-radio-spacer>
141
+ <d2l-input-radio-spacer id="desc1" class="d2l-input-inline-help">
141
142
  Additional content can go here and will line up nicely with the edge of the radio.
142
143
  </d2l-input-radio-spacer>
143
144
  `;
@@ -4,7 +4,7 @@ import { classMap } from 'lit/directives/class-map.js';
4
4
  import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
5
5
  import { getUniqueId } from '../../helpers/uniqueId.js';
6
6
  import { ifDefined } from 'lit/directives/if-defined.js';
7
- import { InputInlineHelpMixin } from './input-inline-help-mixin.js';
7
+ import { InputInlineHelpMixin } from './input-inline-help.js';
8
8
  import { offscreenStyles } from '../offscreen/offscreen.js';
9
9
  import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
10
10
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
@@ -10,7 +10,7 @@ import { getFocusPseudoClass } from '../../helpers/focus.js';
10
10
  import { getUniqueId } from '../../helpers/uniqueId.js';
11
11
  import { getValidHexColor } from '../../helpers/color.js';
12
12
  import { ifDefined } from 'lit/directives/if-defined.js';
13
- import { InputInlineHelpMixin } from './input-inline-help-mixin.js';
13
+ import { InputInlineHelpMixin } from './input-inline-help.js';
14
14
  import { inputLabelStyles } from './input-label-styles.js';
15
15
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
16
16
  import { PropertyRequiredMixin } from '../../mixins/property-required/property-required-mixin.js';
@@ -2,7 +2,7 @@ import { css, html, LitElement } from 'lit';
2
2
  import { classMap } from 'lit/directives/class-map.js';
3
3
  import { getUniqueId } from '../../helpers/uniqueId.js';
4
4
  import { ifDefined } from 'lit/directives/if-defined.js';
5
- import { InputInlineHelpMixin } from './input-inline-help-mixin.js';
5
+ import { InputInlineHelpMixin } from './input-inline-help.js';
6
6
  import { inputLabelStyles } from './input-label-styles.js';
7
7
  import { offscreenStyles } from '../offscreen/offscreen.js';
8
8
  import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
@@ -1,7 +1,17 @@
1
1
  import { css, html } from 'lit';
2
- import { bodySmallStyles } from '../typography/styles.js';
2
+ import { _generateBodySmallStyles } from '../typography/styles.js';
3
3
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
4
4
 
5
+ export const inlineHelpStyles = [
6
+ _generateBodySmallStyles('.d2l-input-inline-help'),
7
+ css`
8
+ .d2l-input-inline-help {
9
+ margin-top: 0.3rem !important;
10
+ overflow-wrap: anywhere;
11
+ }
12
+ `
13
+ ];
14
+
5
15
  export const InputInlineHelpMixin = superclass => class extends SkeletonMixin(superclass) {
6
16
 
7
17
  static get properties() {
@@ -11,14 +21,12 @@ export const InputInlineHelpMixin = superclass => class extends SkeletonMixin(su
11
21
  }
12
22
 
13
23
  static get styles() {
14
- const styles = [ bodySmallStyles, css`
24
+ const styles = [ inlineHelpStyles, css`
15
25
  :host([_has-inline-help]) .d2l-input-inline-help {
16
26
  display: block;
17
27
  }
18
28
  .d2l-input-inline-help {
19
29
  display: none;
20
- margin-top: 0.3rem !important;
21
- overflow-wrap: anywhere;
22
30
  }
23
31
  `];
24
32
 
@@ -38,7 +46,7 @@ export const InputInlineHelpMixin = superclass => class extends SkeletonMixin(su
38
46
 
39
47
  _renderInlineHelp(id) {
40
48
  return html`
41
- <div id="${id}" class="d2l-body-small d2l-input-inline-help d2l-skeletize">
49
+ <div id="${id}" class="d2l-input-inline-help d2l-skeletize">
42
50
  <slot name="inline-help" @slotchange="${this._handleInlineHelpSlotChange}"></slot>
43
51
  </div>
44
52
  `;
@@ -19,6 +19,9 @@ class InputRadioSpacer extends RtlMixin(LitElement) {
19
19
  padding-left: 0;
20
20
  padding-right: 1.7rem;
21
21
  }
22
+ :host(.d2l-input-inline-help) {
23
+ margin-bottom: 0.9rem !important;
24
+ }
22
25
  `;
23
26
  }
24
27
 
@@ -7,7 +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
+ import { InputInlineHelpMixin } from './input-inline-help.js';
11
11
  import { inputLabelStyles } from './input-label-styles.js';
12
12
  import { inputStyles } from './input-styles.js';
13
13
  import { LabelledMixin } from '../../mixins/labelled/labelled-mixin.js';
@@ -6,7 +6,7 @@ import { formatNumber } from '@brightspace-ui/intl/lib/number.js';
6
6
  import { FormElementMixin } from '../form/form-element-mixin.js';
7
7
  import { getUniqueId } from '../../helpers/uniqueId.js';
8
8
  import { ifDefined } from 'lit/directives/if-defined.js';
9
- import { InputInlineHelpMixin } from './input-inline-help-mixin.js';
9
+ import { InputInlineHelpMixin } from './input-inline-help.js';
10
10
  import { inputLabelStyles } from './input-label-styles.js';
11
11
  import { inputStyles } from './input-styles.js';
12
12
  import { LabelledMixin } from '../../mixins/labelled/labelled-mixin.js';
@@ -11,7 +11,7 @@ import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
11
11
  import { FormElementMixin } from '../form/form-element-mixin.js';
12
12
  import { getUniqueId } from '../../helpers/uniqueId.js';
13
13
  import { ifDefined } from 'lit/directives/if-defined.js';
14
- import { InputInlineHelpMixin } from './input-inline-help-mixin.js';
14
+ import { InputInlineHelpMixin } from './input-inline-help.js';
15
15
  import { inputLabelStyles } from './input-label-styles.js';
16
16
  import { inputStyles } from './input-styles.js';
17
17
  import { LabelledMixin } from '../../mixins/labelled/labelled-mixin.js';
@@ -79,47 +79,57 @@ export const _generateBodyCompactStyles = (selector) => {
79
79
 
80
80
  export const bodyCompactStyles = _generateBodyCompactStyles('.d2l-body-compact');
81
81
 
82
- export const bodySmallStyles = css`
83
- .d2l-body-small {
84
- color: var(--d2l-color-tungsten);
85
- font-size: 0.7rem;
86
- font-weight: 400;
87
- line-height: 1rem;
88
- margin: auto;
89
- }
90
- :host([skeleton]) .d2l-body-small.d2l-skeletize::before {
91
- bottom: 0.25rem;
92
- top: 0.2rem;
93
- }
94
- :host([skeleton]) .d2l-body-small.d2l-skeletize-paragraph-2 {
95
- max-height: 2rem;
96
- }
97
- :host([skeleton]) .d2l-body-small.d2l-skeletize-paragraph-3 {
98
- max-height: 3rem;
99
- }
100
- :host([skeleton]) .d2l-body-small.d2l-skeletize-paragraph-5 {
101
- max-height: 5rem;
102
- }
103
- @media (max-width: 615px) {
104
- .d2l-body-small {
105
- font-size: 0.6rem;
106
- line-height: 0.9rem;
82
+ /**
83
+ * A private helper method that should not be used by general consumers
84
+ */
85
+ export const _generateBodySmallStyles = (selector) => {
86
+ if (!_isValidCssSelector(selector)) return;
87
+
88
+ selector = unsafeCSS(selector);
89
+ return css`
90
+ ${selector} {
91
+ color: var(--d2l-color-tungsten);
92
+ font-size: 0.7rem;
93
+ font-weight: 400;
94
+ line-height: 1rem;
95
+ margin: auto;
107
96
  }
108
- :host([skeleton]) .d2l-body-small.d2l-skeletize::before {
97
+ :host([skeleton]) ${selector}.d2l-skeletize::before {
109
98
  bottom: 0.25rem;
110
99
  top: 0.2rem;
111
100
  }
112
- :host([skeleton]) .d2l-body-small.d2l-skeletize-paragraph-2 {
113
- max-height: 1.8rem;
101
+ :host([skeleton]) ${selector}.d2l-skeletize-paragraph-2 {
102
+ max-height: 2rem;
103
+ }
104
+ :host([skeleton]) ${selector}.d2l-skeletize-paragraph-3 {
105
+ max-height: 3rem;
114
106
  }
115
- :host([skeleton]) .d2l-body-small.d2l-skeletize-paragraph-3 {
116
- max-height: 2.7rem;
107
+ :host([skeleton]) ${selector}.d2l-skeletize-paragraph-5 {
108
+ max-height: 5rem;
117
109
  }
118
- :host([skeleton]) .d2l-body-small.d2l-skeletize-paragraph-5 {
119
- max-height: 4.5rem;
110
+ @media (max-width: 615px) {
111
+ ${selector} {
112
+ font-size: 0.6rem;
113
+ line-height: 0.9rem;
114
+ }
115
+ :host([skeleton]) ${selector}.d2l-skeletize::before {
116
+ bottom: 0.25rem;
117
+ top: 0.2rem;
118
+ }
119
+ :host([skeleton]) ${selector}.d2l-skeletize-paragraph-2 {
120
+ max-height: 1.8rem;
121
+ }
122
+ :host([skeleton]) ${selector}.d2l-skeletize-paragraph-3 {
123
+ max-height: 2.7rem;
124
+ }
125
+ :host([skeleton]) ${selector}.d2l-skeletize-paragraph-5 {
126
+ max-height: 4.5rem;
127
+ }
120
128
  }
121
- }
122
- `;
129
+ `;
130
+ };
131
+
132
+ export const bodySmallStyles = _generateBodySmallStyles('.d2l-body-small');
123
133
 
124
134
  export const heading1Styles = css`
125
135
  .d2l-heading-1 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.187.4",
3
+ "version": "2.188.0",
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",