@brightspace-ui/core 3.123.3 → 3.124.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.
@@ -26,20 +26,18 @@
26
26
  <d2l-form>
27
27
  <d2l-input-group>
28
28
  <d2l-input-text label="Name" required></d2l-input-text>
29
- <d2l-input-fieldset label="Options">
30
- <d2l-input-checkbox-group>
31
- <d2l-input-checkbox>Option 1</d2l-input-checkbox>
32
- <d2l-input-checkbox checked>Option 2</d2l-input-checkbox>
33
- <d2l-input-checkbox>Option 3</d2l-input-checkbox>
34
- </d2l-input-checkbox-group>
35
- </d2l-input-fieldset>
36
- <d2l-input-fieldset label="Address" label-hidden>
29
+ <d2l-input-textarea label="Description" rows="3"></d2l-input-textarea>
30
+ <d2l-input-checkbox-group label="Options">
31
+ <d2l-input-checkbox>Option 1</d2l-input-checkbox>
32
+ <d2l-input-checkbox checked>Option 2</d2l-input-checkbox>
33
+ <d2l-input-checkbox>Option 3</d2l-input-checkbox>
34
+ </d2l-input-checkbox-group>
35
+ <d2l-input-fieldset label="Address" label-style="heading">
37
36
  <d2l-input-group>
38
37
  <d2l-input-text label="Street" required></d2l-input-text>
39
38
  <d2l-input-text label="City" required></d2l-input-text>
40
39
  </d2l-input-group>
41
40
  </d2l-input-fieldset>
42
- <d2l-input-textarea label="Description" rows="3"></d2l-input-textarea>
43
41
  </d2l-input-group>
44
42
  </d2l-form>
45
43
  <d2l-floating-buttons>
@@ -7,6 +7,14 @@ import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
7
7
  import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
8
8
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
9
9
 
10
+ function debounce(func, delay) {
11
+ let timer = 0;
12
+ return function() {
13
+ clearTimeout(timer);
14
+ timer = setTimeout(func, delay);
15
+ };
16
+ }
17
+
10
18
  class InputDateTimeRangeTo extends SkeletonMixin(LocalizeCoreElement(LitElement)) {
11
19
 
12
20
  static get properties() {
@@ -169,13 +177,13 @@ class InputDateTimeRangeTo extends SkeletonMixin(LocalizeCoreElement(LitElement)
169
177
  this._leftElemResizeObserver.disconnect();
170
178
  this._leftElemResizeObserver.observe(leftElem);
171
179
 
172
- this._parentElemResizeObserver = this._parentElemResizeObserver || new ResizeObserver(async() => {
180
+ this._parentElemResizeObserver = this._parentElemResizeObserver || new ResizeObserver(debounce(async() => {
173
181
  this._blockDisplay = false;
174
182
  await this.updateComplete;
175
183
  const height = Math.ceil(parseFloat(getComputedStyle(container).getPropertyValue('height')));
176
184
  if (height >= (leftElemHeight * 2)) this._blockDisplay = true; // switch to _blockDisplay styles if content has wrapped (needed for "to" to occupy its own line)
177
185
  else this._blockDisplay = false;
178
- });
186
+ }, 5).bind(this));
179
187
  this._parentElemResizeObserver.disconnect();
180
188
  this._parentElemResizeObserver.observe(this._parentNode);
181
189
  }
@@ -1,6 +1,7 @@
1
1
  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
+ import { heading4Styles } from '../typography/styles.js';
4
5
  import { ifDefined } from 'lit/directives/if-defined.js';
5
6
  import { InputInlineHelpMixin } from './input-inline-help.js';
6
7
  import { inputLabelStyles } from './input-label-styles.js';
@@ -26,6 +27,11 @@ class InputFieldset extends PropertyRequiredMixin(InputInlineHelpMixin(SkeletonM
26
27
  * @type {boolean}
27
28
  */
28
29
  labelHidden: { type: Boolean, attribute: 'label-hidden', reflect: true },
30
+ /**
31
+ * Style of the fieldset label
32
+ * @type {'default'|'heading'}
33
+ */
34
+ labelStyle: { type: String, attribute: 'label-style', reflect: true },
29
35
  /**
30
36
  * Indicates that a value is required for inputs in the fieldset
31
37
  * @type {boolean}
@@ -35,7 +41,7 @@ class InputFieldset extends PropertyRequiredMixin(InputInlineHelpMixin(SkeletonM
35
41
  }
36
42
 
37
43
  static get styles() {
38
- return [ super.styles, inputLabelStyles, offscreenStyles,
44
+ return [ super.styles, heading4Styles, inputLabelStyles, offscreenStyles,
39
45
  css`
40
46
  :host {
41
47
  display: block;
@@ -43,6 +49,13 @@ class InputFieldset extends PropertyRequiredMixin(InputInlineHelpMixin(SkeletonM
43
49
  :host([hidden]) {
44
50
  display: none;
45
51
  }
52
+ :host([label-style="heading"]:not([label-hidden])) {
53
+ margin-block-start: 0.3rem;
54
+ }
55
+ legend.d2l-heading-4 {
56
+ margin-block: 0 0.6rem;
57
+ padding: 0;
58
+ }
46
59
  `
47
60
  ];
48
61
  }
@@ -50,21 +63,22 @@ class InputFieldset extends PropertyRequiredMixin(InputInlineHelpMixin(SkeletonM
50
63
  constructor() {
51
64
  super();
52
65
  this.labelHidden = false;
66
+ this.labelStyle = 'default';
53
67
  this.required = false;
54
68
  this._inlineHelpId = getUniqueId();
55
69
  }
56
70
 
57
71
  render() {
58
72
  const legendClasses = {
59
- 'd2l-input-label': true,
73
+ 'd2l-heading-4': this.labelStyle === 'heading',
74
+ 'd2l-input-label': this.labelStyle !== 'heading',
60
75
  'd2l-offscreen': this.labelHidden,
61
76
  'd2l-skeletize': true
62
77
  };
63
78
  return html`
64
79
  <fieldset
65
80
  class="d2l-input-label-fieldset"
66
- aria-describedby="${ifDefined(this._hasInlineHelp ? this._inlineHelpId : undefined)}"
67
- >
81
+ aria-describedby="${ifDefined(this._hasInlineHelp ? this._inlineHelpId : undefined)}">
68
82
  <legend class="${classMap(legendClasses)}">${this.label}</legend>
69
83
  <slot></slot>
70
84
  ${this._renderInlineHelp(this._inlineHelpId)}
@@ -11,7 +11,7 @@ class InputGroup extends LitElement {
11
11
  :host {
12
12
  display: flex;
13
13
  flex-direction: column;
14
- gap: 1rem;
14
+ gap: 0.9rem;
15
15
  }
16
16
  :host([hidden]) {
17
17
  display: none;
@@ -6406,6 +6406,12 @@
6406
6406
  "type": "boolean",
6407
6407
  "default": "false"
6408
6408
  },
6409
+ {
6410
+ "name": "label-style",
6411
+ "description": "Style of the fieldset label",
6412
+ "type": "'default'|'heading'",
6413
+ "default": "\"default\""
6414
+ },
6409
6415
  {
6410
6416
  "name": "required",
6411
6417
  "description": "Indicates that a value is required for inputs in the fieldset",
@@ -6432,6 +6438,13 @@
6432
6438
  "type": "boolean",
6433
6439
  "default": "false"
6434
6440
  },
6441
+ {
6442
+ "name": "labelStyle",
6443
+ "attribute": "label-style",
6444
+ "description": "Style of the fieldset label",
6445
+ "type": "'default'|'heading'",
6446
+ "default": "\"default\""
6447
+ },
6435
6448
  {
6436
6449
  "name": "required",
6437
6450
  "attribute": "required",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.123.3",
3
+ "version": "3.124.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",