@brightspace-ui/core 2.103.0 → 2.104.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.
Files changed (118) hide show
  1. package/README.md +7 -7
  2. package/components/alert/alert.js +1 -1
  3. package/components/breadcrumbs/breadcrumb.js +2 -2
  4. package/components/breadcrumbs/breadcrumbs.js +1 -1
  5. package/components/button/button-icon.js +3 -3
  6. package/components/button/button-mixin.js +1 -1
  7. package/components/button/button-move.js +2 -2
  8. package/components/button/button-subtle.js +1 -1
  9. package/components/button/floating-buttons.js +1 -1
  10. package/components/calendar/calendar.js +1 -1
  11. package/components/card/card-footer-link.js +2 -2
  12. package/components/card/card.js +2 -2
  13. package/components/collapsible-panel/collapsible-panel.js +2 -2
  14. package/components/count-badge/count-badge-icon.js +1 -1
  15. package/components/count-badge/count-badge-mixin.js +1 -1
  16. package/components/count-badge/count-badge.js +1 -1
  17. package/components/dialog/dialog-mixin.js +1 -1
  18. package/components/dropdown/dropdown-button.js +1 -1
  19. package/components/dropdown/dropdown-content-mixin.js +1 -1
  20. package/components/dropdown/dropdown-context-menu.js +1 -1
  21. package/components/dropdown/dropdown-menu.js +1 -1
  22. package/components/dropdown/dropdown-more.js +1 -1
  23. package/components/empty-state/empty-state-simple.js +1 -1
  24. package/components/filter/filter-overflow-group.js +1 -1
  25. package/components/filter/filter.js +2 -2
  26. package/components/focus-trap/focus-trap.js +1 -1
  27. package/components/form/form-errory-summary.js +1 -1
  28. package/components/html-block/demo/html-block.html +1 -1
  29. package/components/html-block/html-block.js +1 -1
  30. package/components/icons/icon-custom.js +1 -1
  31. package/components/icons/icon.js +1 -1
  32. package/components/inputs/README.md +1 -1
  33. package/components/inputs/demo/input-radio-label-simple-test.js +1 -1
  34. package/components/inputs/demo/input-radio-label-test.js +1 -1
  35. package/components/inputs/demo/input-select-test.js +1 -1
  36. package/components/inputs/docs/input-radio.md +1 -1
  37. package/components/inputs/docs/input-select-styles.md +1 -1
  38. package/components/inputs/input-checkbox-spacer.js +1 -1
  39. package/components/inputs/input-checkbox.js +2 -2
  40. package/components/inputs/input-color.js +1 -1
  41. package/components/inputs/input-date-range.js +2 -2
  42. package/components/inputs/input-date-time-range.js +2 -2
  43. package/components/inputs/input-date-time.js +3 -3
  44. package/components/inputs/input-date.js +2 -2
  45. package/components/inputs/input-fieldset.js +1 -1
  46. package/components/inputs/input-number.js +2 -2
  47. package/components/inputs/input-percent.js +3 -3
  48. package/components/inputs/input-radio-spacer.js +1 -1
  49. package/components/inputs/input-search.js +2 -2
  50. package/components/inputs/input-text.js +3 -3
  51. package/components/inputs/input-textarea.js +3 -3
  52. package/components/inputs/input-time-range.js +2 -2
  53. package/components/inputs/input-time.js +2 -2
  54. package/components/link/link.js +1 -1
  55. package/components/list/list-item-drag-handle.js +2 -2
  56. package/components/list/list-item-drag-image.js +1 -1
  57. package/components/list/list-item-generic-layout.js +2 -3
  58. package/components/list/list-item-mixin.js +2 -2
  59. package/components/list/list-item-placement-marker.js +1 -1
  60. package/components/menu/menu-item-checkbox.js +1 -1
  61. package/components/menu/menu-item-radio.js +1 -1
  62. package/components/menu/menu-item-return.js +1 -1
  63. package/components/menu/menu.js +1 -1
  64. package/components/meter/meter-circle.js +1 -1
  65. package/components/meter/meter-linear.js +1 -1
  66. package/components/meter/meter-radial.js +1 -1
  67. package/components/object-property-list/object-property-list-item-link.js +1 -1
  68. package/components/offscreen/offscreen.js +1 -1
  69. package/components/overflow-group/overflow-group.js +1 -1
  70. package/components/paging/pager-load-more.js +1 -1
  71. package/components/scroll-wrapper/demo/scroll-wrapper-test.js +1 -1
  72. package/components/scroll-wrapper/scroll-wrapper.js +1 -1
  73. package/components/selection/selection-action-dropdown.js +1 -1
  74. package/components/selection/selection-action.js +1 -1
  75. package/components/selection/selection-controls.js +1 -1
  76. package/components/selection/selection-input.js +1 -1
  77. package/components/selection/selection-mixin.js +1 -1
  78. package/components/selection/selection-select-all-pages.js +1 -1
  79. package/components/selection/selection-select-all.js +1 -1
  80. package/components/skeleton/skeleton-mixin.js +1 -1
  81. package/components/switch/switch-mixin.js +2 -2
  82. package/components/table/demo/table-test.js +1 -1
  83. package/components/table/table-col-sort-button.js +1 -1
  84. package/components/table/table-wrapper.js +1 -1
  85. package/components/tabs/tab-internal.js +1 -1
  86. package/components/tabs/tabs.js +2 -2
  87. package/components/tag-list/tag-list-item-mixin.js +1 -1
  88. package/components/tag-list/tag-list.js +2 -2
  89. package/components/tooltip/tooltip-help.js +1 -1
  90. package/components/tooltip/tooltip.js +1 -1
  91. package/helpers/demo/prism.html +3 -3
  92. package/mixins/{arrow-keys-mixin.md → arrow-keys/README.md} +2 -2
  93. package/mixins/arrow-keys/arrow-keys-mixin.js +125 -0
  94. package/mixins/{demo → arrow-keys/demo}/arrow-keys-mixin.html +2 -2
  95. package/mixins/{demo → arrow-keys/demo}/arrow-keys-test.js +1 -1
  96. package/mixins/arrow-keys-mixin.js +1 -125
  97. package/mixins/{focus-mixin.md → focus/README.md} +1 -1
  98. package/mixins/focus/focus-mixin.js +43 -0
  99. package/mixins/focus-mixin.js +1 -43
  100. package/mixins/{interactive-mixin.md → interactive/README.md} +1 -1
  101. package/mixins/{interactive-mixin.js → interactive/interactive-mixin.js} +4 -4
  102. package/mixins/{labelled-mixin.md → labelled/README.md} +2 -2
  103. package/mixins/{demo → labelled/demo}/labelled-mixin.html +3 -3
  104. package/mixins/labelled/labelled-mixin.js +215 -0
  105. package/mixins/labelled-mixin.js +1 -215
  106. package/mixins/{provider-mixin.md → provider/README.md} +3 -3
  107. package/mixins/provider/provider-mixin.js +35 -0
  108. package/mixins/provider-mixin.js +1 -35
  109. package/mixins/{rtl-mixin.md → rtl/README.md} +1 -1
  110. package/mixins/rtl/rtl-mixin.js +40 -0
  111. package/mixins/rtl-mixin.js +1 -40
  112. package/mixins/theme/theme-mixin.js +19 -0
  113. package/mixins/theme-mixin.js +1 -19
  114. package/mixins/{visible-on-ancestor-mixin.md → visible-on-ancestor/README.md} +1 -1
  115. package/mixins/visible-on-ancestor/visible-on-ancestor-mixin.js +160 -0
  116. package/mixins/visible-on-ancestor-mixin.js +1 -160
  117. package/package.json +1 -1
  118. package/templates/primary-secondary/primary-secondary.js +1 -1
@@ -1,160 +1 @@
1
- import { findComposedAncestor, isComposedAncestor } from '../helpers/dom.js';
2
- import { css } from 'lit';
3
-
4
- const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
5
-
6
- export const visibleOnAncestorStyles = css`
7
-
8
- :host([__voa-state="hidden"]),
9
- :host([__voa-state="hiding"]) {
10
- opacity: 0 !important;
11
- transform: translateY(-10px) !important;
12
- }
13
- :host([__voa-state="showing"]),
14
- :host([__voa-state="hiding"]) {
15
- transition: transform 200ms ease-out, opacity 200ms ease-out !important;
16
- }
17
-
18
- @media only screen and (hover: none), only screen and (-moz-touch-enabled: 1) {
19
- :host([__voa-state="hidden"]),
20
- :host([__voa-state="hiding"]) {
21
- opacity: 1 !important;
22
- transform: translateY(0) !important;
23
- }
24
- :host([__voa-state="hidden"][d2l-visible-on-ancestor-no-hover-hide]),
25
- :host([__voa-state="hiding"][d2l-visible-on-ancestor-no-hover-hide]) {
26
- opacity: 0 !important;
27
- transform: translateY(-10px) !important;
28
- }
29
- }
30
-
31
- `;
32
-
33
- export const VisibleOnAncestorMixin = superclass => class extends superclass {
34
-
35
- static get properties() {
36
- return {
37
- /**
38
- * @ignore
39
- */
40
- visibleOnAncestor: { type: Boolean, reflect: true, attribute: 'visible-on-ancestor' },
41
- __voaState: { type: String, reflect: true, attribute: '__voa-state' }
42
- };
43
- }
44
-
45
- constructor() {
46
- super();
47
-
48
- this.visibleOnAncestor = false;
49
- }
50
-
51
- attributeChangedCallback(name, oldval, newval) {
52
- if (name === 'visible-on-ancestor' && this.__voaAttached) {
53
- if (newval) this.__voaInit();
54
- else this.__voaUninit();
55
- }
56
- super.attributeChangedCallback(name, oldval, newval);
57
- }
58
-
59
- connectedCallback() {
60
- super.connectedCallback();
61
- this.__voaAttached = true;
62
- if (this.visibleOnAncestor) {
63
- requestAnimationFrame(() => this.__voaInit());
64
- } else this.__voaState = null;
65
- }
66
-
67
- disconnectedCallback() {
68
- this.__voaAttached = false;
69
- this.__voaUninit();
70
- super.disconnectedCallback();
71
- }
72
-
73
- __voaHandleBlur(e) {
74
- if (isComposedAncestor(this.__voaTarget, e.relatedTarget)) return;
75
- this.__voaFocusIn = false;
76
- this.__voaHide();
77
- }
78
-
79
- __voaHandleFocus() {
80
- this.__voaFocusIn = true;
81
- this.__voaShow();
82
- }
83
-
84
- __voaHandleMouseEnter() {
85
- this.__voaMouseOver = true;
86
- this.__voaShow();
87
- }
88
-
89
- __voaHandleMouseLeave() {
90
- this.__voaMouseOver = false;
91
- this.__voaHide();
92
- }
93
-
94
- __voaHide() {
95
- if (this.__voaFocusIn || this.__voaMouseOver) return;
96
- if (reduceMotion) {
97
- this.__voaState = 'hidden';
98
- } else {
99
- const handleTransitionEnd = (e) => {
100
- if (e.propertyName !== 'transform') return;
101
- this.removeEventListener('transitionend', handleTransitionEnd);
102
- this.__voaState = 'hidden';
103
- };
104
- this.addEventListener('transitionend', handleTransitionEnd);
105
- this.__voaState = 'hiding';
106
- }
107
- }
108
-
109
- __voaInit() {
110
-
111
- if (!this.visibleOnAncestor) return;
112
-
113
- this.__voaTarget = findComposedAncestor(this, (node) => {
114
- if (!node || node.nodeType !== 1) return false;
115
- return (node.classList.contains('d2l-visible-on-ancestor-target'));
116
- });
117
- if (!this.__voaTarget) {
118
- this.__voaState = null;
119
- return;
120
- }
121
-
122
- this.__voaHandleBlur = this.__voaHandleBlur.bind(this);
123
- this.__voaHandleFocus = this.__voaHandleFocus.bind(this);
124
- this.__voaHandleMouseEnter = this.__voaHandleMouseEnter.bind(this);
125
- this.__voaHandleMouseLeave = this.__voaHandleMouseLeave.bind(this);
126
-
127
- this.__voaTarget.addEventListener('focus', this.__voaHandleFocus, true);
128
- this.__voaTarget.addEventListener('blur', this.__voaHandleBlur, true);
129
- this.__voaTarget.addEventListener('mouseenter', this.__voaHandleMouseEnter);
130
- this.__voaTarget.addEventListener('mouseleave', this.__voaHandleMouseLeave);
131
-
132
- this.__voaState = 'hidden';
133
-
134
- }
135
-
136
- __voaShow() {
137
- if (reduceMotion) {
138
- this.__voaState = 'shown';
139
- } else {
140
- const handleTransitionEnd = (e) => {
141
- if (e.propertyName !== 'transform') return;
142
- this.removeEventListener('transitionend', handleTransitionEnd);
143
- this.__voaState = 'shown';
144
- };
145
- this.addEventListener('transitionend', handleTransitionEnd);
146
- this.__voaState = 'showing';
147
- }
148
- }
149
-
150
- __voaUninit() {
151
- this.__voaState = null;
152
- if (!this.__voaTarget) return;
153
- this.__voaTarget.removeEventListener('focus', this.__voaHandleFocus, true);
154
- this.__voaTarget.removeEventListener('blur', this.__voaHandleBlur, true);
155
- this.__voaTarget.removeEventListener('mouseenter', this.__voaHandleMouseEnter);
156
- this.__voaTarget.removeEventListener('mouseleave', this.__voaHandleMouseLeave);
157
- this.__voaTarget = null;
158
- }
159
-
160
- };
1
+ export { VisibleOnAncestorMixin, visibleOnAncestorStyles } from './visible-on-ancestor/visible-on-ancestor-mixin.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.103.0",
3
+ "version": "2.104.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",
@@ -9,7 +9,7 @@ import { getUniqueId } from '../../helpers/uniqueId.js';
9
9
  import { ifDefined } from 'lit/directives/if-defined.js';
10
10
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
11
11
  import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
12
- import { RtlMixin } from '../../mixins/rtl-mixin.js';
12
+ import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
13
13
  import { styleMap } from 'lit/directives/style-map.js';
14
14
 
15
15
  const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;