@brightspace-ui/core 2.187.3 → 2.187.5

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.
@@ -1,20 +1,34 @@
1
1
  import '../input-radio-spacer.js';
2
2
  import { html, LitElement } from 'lit';
3
+ import { inlineHelpStyles } from '../input-inline-help.js';
3
4
  import { radioStyles } from '../input-radio-styles.js';
4
5
 
5
6
  class TestInputRadioSpacer extends LitElement {
6
7
 
7
8
  static get styles() {
8
- return radioStyles;
9
+ return [ radioStyles, inlineHelpStyles ];
9
10
  }
10
11
 
11
12
  render() {
12
13
  return html`
13
- <input type="radio" class="d2l-input-radio" aria-label="Option 1"> Option 1
14
- <d2l-input-radio-spacer>
15
- Additional content can go here and will
16
- line up nicely with the edge of the radio.
17
- </d2l-input-radio-spacer>
14
+ <div>
15
+ <label class="d2l-input-radio-label">
16
+ <input type="radio" aria-describedby="desc1" name="myGroup" value="normal">
17
+ Option 1
18
+ </label>
19
+ <d2l-input-radio-spacer id="desc1" class="d2l-input-inline-help">
20
+ Additional content can go here and will line up nicely with the edge of the radio.
21
+ </d2l-input-radio-spacer>
22
+ </div>
23
+ <div>
24
+ <label class="d2l-input-radio-label">
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
+ </label>
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.
30
+ </d2l-input-radio-spacer>
31
+ </div>
18
32
  `;
19
33
  }
20
34
 
@@ -116,28 +116,31 @@ If you'd like to manually link the radio input with a label, or use an ARIA labe
116
116
 
117
117
  ## Radio Spacer [d2l-input-radio-spacer]
118
118
 
119
- To align related content below radio buttons, the `d2l-input-radio-spacer` element can be used:
119
+ To align related content below radio buttons, the `d2l-input-radio-spacer` element can be used in conjunction with the `d2l-input-radio-label` class:
120
120
 
121
121
  <!-- docs: demo code display:block -->
122
122
  ```html
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
- <input type="radio" class="d2l-input-radio" aria-label="Option 1"> Option 1
137
- <d2l-input-radio-spacer>
138
- Additional content can go here and will
139
- line up nicely with the edge of the radio.
140
- </d2l-input-radio-spacer>
137
+ <label class="d2l-input-radio-label">
138
+ <input type="radio" aria-describedby="desc1" value="normal" checked>
139
+ Option 1
140
+ </label>
141
+ <d2l-input-radio-spacer id="desc1" class="d2l-input-inline-help">
142
+ Additional content can go here and will line up nicely with the edge of the radio.
143
+ </d2l-input-radio-spacer>
141
144
  `;
142
145
  }
143
146
 
@@ -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.3",
3
+ "version": "2.187.5",
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",