@brightspace-ui/core 3.159.7 → 3.160.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.
@@ -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.7",
3
+ "version": "3.160.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",
@@ -1,7 +1,7 @@
1
1
  # Templates
2
2
  Page templates are used to provide generic ways to arrange content on a page
3
3
 
4
- ## Primary-Secondary [d2l-primary-secondary]
4
+ ## Primary-Secondary [d2l-template-primary-secondary]
5
5
  Two Panel (primary and secondary) page template with header and optional footer
6
6
 
7
7
  Use this template when:
@@ -47,7 +47,7 @@
47
47
  document
48
48
  .querySelector('d2l-button')
49
49
  .addEventListener('click', () => form.submitForm());
50
- form.addEventListener('d2l-form-submit', (e) => {
50
+ form.addEventListener('d2l-template-primary-secondary-form-submit', (e) => {
51
51
  console.log('Form submitted!', e.detail.formData);
52
52
  });
53
53
  </script>