@brightspace-ui/core 3.159.6 → 3.160.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.
@@ -21,3 +21,4 @@ A progress bar communicates information relating to the progress of completion o
21
21
  | `label` | String | Label for the progress bar |
22
22
  | `label-hidden` | Boolean | Hide the bar's label |
23
23
  | `value-hidden` | Boolean | Hide the bar's value |
24
+ <!-- docs: end hidden content -->
@@ -10,11 +10,35 @@ class Progress extends LitElement {
10
10
 
11
11
  static get properties() {
12
12
  return {
13
+ /**
14
+ * The maximum value of the progress bar
15
+ * @type {number}
16
+ */
13
17
  max: { type: Number, attribute: 'max' },
18
+ /**
19
+ * The current value of the progress bar
20
+ * @type {number}
21
+ */
14
22
  value: { type: Number },
23
+ /**
24
+ * Label for the progress bar
25
+ * @type {string}
26
+ */
15
27
  label: { type: String },
28
+ /**
29
+ * Hide the bar's label
30
+ * @type {boolean}
31
+ */
16
32
  labelHidden: { type: Boolean, attribute: 'label-hidden' },
33
+ /**
34
+ * Hide the bar's value
35
+ * @type {boolean}
36
+ */
17
37
  valueHidden: { type: Boolean, attribute: 'value-hidden' },
38
+ /**
39
+ * Use d2l-body-small styles
40
+ * @type {boolean}
41
+ */
18
42
  small: { type: Boolean, reflect: true }
19
43
  };
20
44
  }
@@ -89,6 +113,7 @@ class Progress extends LitElement {
89
113
  this.max = 100;
90
114
  this.value = 0;
91
115
  this.valueHidden = false;
116
+ this.small = false;
92
117
  }
93
118
 
94
119
  render() {
@@ -11733,29 +11733,36 @@
11733
11733
  "attributes": [
11734
11734
  {
11735
11735
  "name": "label",
11736
+ "description": "Label for the progress bar",
11736
11737
  "type": "string"
11737
11738
  },
11738
- {
11739
- "name": "small",
11740
- "type": "boolean"
11741
- },
11742
11739
  {
11743
11740
  "name": "label-hidden",
11741
+ "description": "Hide the bar's label",
11744
11742
  "type": "boolean",
11745
11743
  "default": "false"
11746
11744
  },
11747
11745
  {
11748
11746
  "name": "max",
11747
+ "description": "The maximum value of the progress bar",
11749
11748
  "type": "number",
11750
11749
  "default": "100"
11751
11750
  },
11752
11751
  {
11753
11752
  "name": "value",
11753
+ "description": "The current value of the progress bar",
11754
11754
  "type": "number",
11755
11755
  "default": "0"
11756
11756
  },
11757
11757
  {
11758
11758
  "name": "value-hidden",
11759
+ "description": "Hide the bar's value",
11760
+ "type": "boolean",
11761
+ "default": "false"
11762
+ },
11763
+ {
11764
+ "name": "small",
11765
+ "description": "Use d2l-body-small styles",
11759
11766
  "type": "boolean",
11760
11767
  "default": "false"
11761
11768
  }
@@ -11764,34 +11771,41 @@
11764
11771
  {
11765
11772
  "name": "label",
11766
11773
  "attribute": "label",
11774
+ "description": "Label for the progress bar",
11767
11775
  "type": "string"
11768
11776
  },
11769
- {
11770
- "name": "small",
11771
- "attribute": "small",
11772
- "type": "boolean"
11773
- },
11774
11777
  {
11775
11778
  "name": "labelHidden",
11776
11779
  "attribute": "label-hidden",
11780
+ "description": "Hide the bar's label",
11777
11781
  "type": "boolean",
11778
11782
  "default": "false"
11779
11783
  },
11780
11784
  {
11781
11785
  "name": "max",
11782
11786
  "attribute": "max",
11787
+ "description": "The maximum value of the progress bar",
11783
11788
  "type": "number",
11784
11789
  "default": "100"
11785
11790
  },
11786
11791
  {
11787
11792
  "name": "value",
11788
11793
  "attribute": "value",
11794
+ "description": "The current value of the progress bar",
11789
11795
  "type": "number",
11790
11796
  "default": "0"
11791
11797
  },
11792
11798
  {
11793
11799
  "name": "valueHidden",
11794
11800
  "attribute": "value-hidden",
11801
+ "description": "Hide the bar's value",
11802
+ "type": "boolean",
11803
+ "default": "false"
11804
+ },
11805
+ {
11806
+ "name": "small",
11807
+ "attribute": "small",
11808
+ "description": "Use d2l-body-small styles",
11795
11809
  "type": "boolean",
11796
11810
  "default": "false"
11797
11811
  }
@@ -67,11 +67,13 @@
67
67
  one {There is # person}
68
68
  other {There are # people}
69
69
  }`;
70
+ /* eslint-disable @stylistic/indent */
70
71
  document.querySelector('#complex-no-tag2').value =
71
72
  `{peopleCount, plural,
72
73
  one {There is # person}
73
74
  other {There are # people}
74
75
  }`;
76
+ /* eslint-enable @stylistic/indent */
75
77
  </script>
76
78
  </template>
77
79
  </d2l-demo-snippet>
package/helpers/focus.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { css, unsafeCSS } from 'lit';
2
2
  import { getComposedChildren, getComposedParent, getFirstVisibleAncestor, getNextAncestorSibling, getPreviousAncestorSibling, isVisible } from './dom.js';
3
+ import { getFlag } from './flags.js';
3
4
 
4
5
  const focusableElements = {
5
6
  a: true,
@@ -14,6 +15,8 @@ const focusableElements = {
14
15
  textarea: true
15
16
  };
16
17
 
18
+ const focusVisibleSupportChangesEnabled = getFlag('focus-visible-support-changes-for-focus-rings', true);
19
+
17
20
  export function getComposedActiveElement() {
18
21
  let node = document.activeElement;
19
22
 
@@ -75,19 +78,50 @@ export function getFocusableDescendants(node, options) {
75
78
  export function getFocusPseudoClass() {
76
79
  return isFocusVisibleSupported() ? 'focus-visible' : 'focus';
77
80
  }
78
- export function getFocusRingStyles(selector, { applyOnHover = false, extraStyles = null } = {}) {
79
- const selectorDelegate = typeof selector === 'string' ? pseudoClass => `${selector}:${pseudoClass}` : selector;
80
- const cssSelector = unsafeCSS(`${selectorDelegate(getFocusPseudoClass())}${applyOnHover ? `, ${selectorDelegate('hover')}` : ''}`);
81
- return css`${cssSelector} {
82
- ${extraStyles ?? css``}
83
- outline: 2px solid var(--d2l-focus-ring-color, var(--d2l-color-celestine));
84
- outline-offset: var(--d2l-focus-ring-offset, 2px);
81
+ export function getFocusRingStyles(selector, { extraStyles = null } = {}) {
82
+ // Remove when cleaning up focus-visible-support-changes-for-focus-rings
83
+ if (!focusVisibleSupportChangesEnabled) {
84
+ const selectorDelegate = typeof selector === 'string' ? pseudoClass => `${selector}:${pseudoClass}` : selector;
85
+ const cssSelector = unsafeCSS(selectorDelegate(getFocusPseudoClass()));
86
+ return css`${cssSelector} {
87
+ ${extraStyles ?? css``}
88
+ outline: 2px solid var(--d2l-focus-ring-color, var(--d2l-color-celestine));
89
+ outline-offset: var(--d2l-focus-ring-offset, 2px);
90
+ }
91
+ @media (prefers-contrast: more) {
92
+ ${cssSelector} {
93
+ outline-color: Highlight;
94
+ }
95
+ }`;
85
96
  }
86
- @media (prefers-contrast: more) {
87
- ${cssSelector} {
88
- outline-color: Highlight;
97
+
98
+ const stylesDelegate = selector => css`
99
+ ${selector} {
100
+ ${extraStyles ?? css``}
101
+ outline: 2px solid var(--d2l-focus-ring-color, var(--d2l-color-celestine));
102
+ outline-offset: var(--d2l-focus-ring-offset, 2px);
103
+ }
104
+ @media (prefers-contrast: more) {
105
+ ${selector} {
106
+ outline-color: Highlight;
107
+ }
108
+ }
109
+ `;
110
+ return getFocusVisibleStyles(selector, stylesDelegate);
111
+ }
112
+
113
+ export function getFocusVisibleStyles(selector, stylesDelegate) {
114
+ const selectorDelegate = typeof selector === 'string' ? pseudoClass => `${selector}:${pseudoClass}` : selector;
115
+ const focusSelector = unsafeCSS(selectorDelegate('focus'));
116
+ const focusVisibleSelector = unsafeCSS(selectorDelegate('focus-visible'));
117
+ return unsafeCSS(css`
118
+ @supports not selector(:focus-visible) {
119
+ ${stylesDelegate(focusSelector)}
120
+ }
121
+ @supports selector(:focus-visible) {
122
+ ${stylesDelegate(focusVisibleSelector)}
89
123
  }
90
- }`;
124
+ `);
91
125
  }
92
126
 
93
127
  export function getLastFocusableDescendant(node, includeHidden) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.159.6",
3
+ "version": "3.160.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",