@brightspace-ui/core 2.102.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.
- package/README.md +7 -7
- package/components/alert/alert.js +1 -1
- package/components/breadcrumbs/breadcrumb.js +2 -2
- package/components/breadcrumbs/breadcrumbs.js +1 -1
- package/components/button/button-icon.js +3 -4
- package/components/button/button-mixin.js +1 -1
- package/components/button/button-move.js +245 -0
- package/components/button/button-subtle.js +1 -1
- package/components/button/demo/button-move.html +46 -0
- package/components/button/floating-buttons.js +1 -1
- package/components/calendar/calendar.js +1 -1
- package/components/card/card-footer-link.js +2 -2
- package/components/card/card.js +2 -2
- package/components/collapsible-panel/collapsible-panel.js +2 -2
- package/components/count-badge/count-badge-icon.js +1 -1
- package/components/count-badge/count-badge-mixin.js +1 -1
- package/components/count-badge/count-badge.js +1 -1
- package/components/dialog/dialog-mixin.js +1 -1
- package/components/dropdown/dropdown-button.js +1 -1
- package/components/dropdown/dropdown-content-mixin.js +1 -1
- package/components/dropdown/dropdown-context-menu.js +1 -1
- package/components/dropdown/dropdown-menu.js +1 -1
- package/components/dropdown/dropdown-more.js +1 -1
- package/components/empty-state/empty-state-simple.js +1 -1
- package/components/filter/filter-overflow-group.js +1 -1
- package/components/filter/filter.js +2 -2
- package/components/focus-trap/focus-trap.js +1 -1
- package/components/form/form-errory-summary.js +1 -1
- package/components/html-block/demo/html-block.html +1 -1
- package/components/html-block/html-block.js +1 -1
- package/components/icons/icon-custom.js +1 -1
- package/components/icons/icon.js +1 -1
- package/components/inputs/README.md +1 -1
- package/components/inputs/demo/input-radio-label-simple-test.js +1 -1
- package/components/inputs/demo/input-radio-label-test.js +1 -1
- package/components/inputs/demo/input-select-test.js +1 -1
- package/components/inputs/docs/input-radio.md +1 -1
- package/components/inputs/docs/input-select-styles.md +1 -1
- package/components/inputs/input-checkbox-spacer.js +1 -1
- package/components/inputs/input-checkbox.js +2 -2
- package/components/inputs/input-color.js +1 -1
- package/components/inputs/input-date-range.js +2 -2
- package/components/inputs/input-date-time-range.js +2 -2
- package/components/inputs/input-date-time.js +3 -3
- package/components/inputs/input-date.js +2 -2
- package/components/inputs/input-fieldset.js +1 -1
- package/components/inputs/input-number.js +2 -2
- package/components/inputs/input-percent.js +3 -3
- package/components/inputs/input-radio-spacer.js +1 -1
- package/components/inputs/input-search.js +2 -2
- package/components/inputs/input-text.js +3 -3
- package/components/inputs/input-textarea.js +3 -3
- package/components/inputs/input-time-range.js +2 -2
- package/components/inputs/input-time.js +2 -2
- package/components/link/link.js +1 -1
- package/components/list/list-item-drag-handle.js +94 -126
- package/components/list/list-item-drag-image.js +1 -1
- package/components/list/list-item-generic-layout.js +2 -3
- package/components/list/list-item-mixin.js +2 -2
- package/components/list/list-item-placement-marker.js +1 -1
- package/components/menu/menu-item-checkbox.js +1 -1
- package/components/menu/menu-item-radio.js +1 -1
- package/components/menu/menu-item-return.js +1 -1
- package/components/menu/menu.js +1 -1
- package/components/meter/meter-circle.js +1 -1
- package/components/meter/meter-linear.js +1 -1
- package/components/meter/meter-radial.js +1 -1
- package/components/object-property-list/object-property-list-item-link.js +1 -1
- package/components/offscreen/offscreen.js +1 -1
- package/components/overflow-group/overflow-group.js +1 -1
- package/components/paging/pager-load-more.js +1 -1
- package/components/scroll-wrapper/demo/scroll-wrapper-test.js +1 -1
- package/components/scroll-wrapper/scroll-wrapper.js +1 -1
- package/components/selection/selection-action-dropdown.js +1 -1
- package/components/selection/selection-action.js +1 -1
- package/components/selection/selection-controls.js +1 -1
- package/components/selection/selection-input.js +1 -1
- package/components/selection/selection-mixin.js +1 -1
- package/components/selection/selection-select-all-pages.js +1 -1
- package/components/selection/selection-select-all.js +1 -1
- package/components/skeleton/skeleton-mixin.js +1 -1
- package/components/switch/switch-mixin.js +2 -2
- package/components/table/demo/table-test.js +1 -1
- package/components/table/table-col-sort-button.js +1 -1
- package/components/table/table-wrapper.js +1 -1
- package/components/tabs/tab-internal.js +1 -1
- package/components/tabs/tabs.js +2 -2
- package/components/tag-list/tag-list-item-mixin.js +1 -1
- package/components/tag-list/tag-list.js +2 -2
- package/components/tooltip/tooltip-help.js +1 -1
- package/components/tooltip/tooltip.js +1 -1
- package/custom-elements.json +60 -0
- package/helpers/demo/prism.html +3 -3
- package/mixins/{arrow-keys-mixin.md → arrow-keys/README.md} +2 -2
- package/mixins/arrow-keys/arrow-keys-mixin.js +125 -0
- package/mixins/{demo → arrow-keys/demo}/arrow-keys-mixin.html +2 -2
- package/mixins/{demo → arrow-keys/demo}/arrow-keys-test.js +1 -1
- package/mixins/arrow-keys-mixin.js +1 -125
- package/mixins/{focus-mixin.md → focus/README.md} +1 -1
- package/mixins/focus/focus-mixin.js +43 -0
- package/mixins/focus-mixin.js +1 -43
- package/mixins/{interactive-mixin.md → interactive/README.md} +1 -1
- package/mixins/{interactive-mixin.js → interactive/interactive-mixin.js} +4 -4
- package/mixins/{labelled-mixin.md → labelled/README.md} +2 -2
- package/mixins/{demo → labelled/demo}/labelled-mixin.html +3 -3
- package/mixins/labelled/labelled-mixin.js +215 -0
- package/mixins/labelled-mixin.js +1 -215
- package/mixins/{provider-mixin.md → provider/README.md} +3 -3
- package/mixins/provider/provider-mixin.js +35 -0
- package/mixins/provider-mixin.js +1 -35
- package/mixins/{rtl-mixin.md → rtl/README.md} +1 -1
- package/mixins/rtl/rtl-mixin.js +40 -0
- package/mixins/rtl-mixin.js +1 -40
- package/mixins/theme/theme-mixin.js +19 -0
- package/mixins/theme-mixin.js +1 -19
- package/mixins/{visible-on-ancestor-mixin.md → visible-on-ancestor/README.md} +1 -1
- package/mixins/visible-on-ancestor/visible-on-ancestor-mixin.js +160 -0
- package/mixins/visible-on-ancestor-mixin.js +1 -160
- package/package.json +1 -1
- package/templates/primary-secondary/primary-secondary.js +1 -1
- package/tools/dom-test-helpers.js +4 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css, html, LitElement } from 'lit';
|
|
2
2
|
import { findComposedAncestor, getNextAncestorSibling, getPreviousAncestorSibling, isComposedAncestor } from '../../helpers/dom.js';
|
|
3
3
|
import { getComposedActiveElement, getFirstFocusableDescendant, getLastFocusableDescendant, getNextFocusable, getPreviousFocusable, isFocusable } from '../../helpers/focus.js';
|
|
4
|
-
import { isInteractiveDescendant } from '../../mixins/interactive-mixin.js';
|
|
5
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
4
|
+
import { isInteractiveDescendant } from '../../mixins/interactive/interactive-mixin.js';
|
|
5
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
6
6
|
|
|
7
7
|
const keyCodes = {
|
|
8
8
|
DOWN: 40,
|
|
@@ -100,7 +100,6 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
100
100
|
}
|
|
101
101
|
::slotted([slot="outside-control"]) {
|
|
102
102
|
grid-column: outside-control-start / outside-control-end;
|
|
103
|
-
width: fit-content;
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
::slotted([slot="expand-collapse"]) {
|
|
@@ -10,14 +10,14 @@ import { composeMixins } from '../../helpers/composeMixins.js';
|
|
|
10
10
|
import { getFirstFocusableDescendant } from '../../helpers/focus.js';
|
|
11
11
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
12
12
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
13
|
-
import { LabelledMixin } from '../../mixins/labelled-mixin.js';
|
|
13
|
+
import { LabelledMixin } from '../../mixins/labelled/labelled-mixin.js';
|
|
14
14
|
import { ListItemCheckboxMixin } from './list-item-checkbox-mixin.js';
|
|
15
15
|
import { ListItemDragDropMixin } from './list-item-drag-drop-mixin.js';
|
|
16
16
|
import { ListItemExpandCollapseMixin } from './list-item-expand-collapse-mixin.js';
|
|
17
17
|
import { ListItemRoleMixin } from './list-item-role-mixin.js';
|
|
18
18
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
19
19
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
20
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
20
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
21
21
|
|
|
22
22
|
let tabPressed = false;
|
|
23
23
|
let tabListenerAdded = false;
|
|
@@ -2,7 +2,7 @@ import '../icons/icon.js';
|
|
|
2
2
|
import { html, LitElement } from 'lit';
|
|
3
3
|
import { MenuItemSelectableMixin } from './menu-item-selectable-mixin.js';
|
|
4
4
|
import { menuItemSelectableStyles } from './menu-item-selectable-styles.js';
|
|
5
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
5
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A menu item component used for selection. Multiple checkboxes can be selected at once.
|
|
@@ -2,7 +2,7 @@ import '../icons/icon.js';
|
|
|
2
2
|
import { html, LitElement } from 'lit';
|
|
3
3
|
import { MenuItemRadioMixin } from './menu-item-radio-mixin.js';
|
|
4
4
|
import { menuItemSelectableStyles } from './menu-item-selectable-styles.js';
|
|
5
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
5
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A menu item component used for radio selection. Only one radio item in a given d2l-menu may be selected at once (i.e., selecting one option will deselect the other selected "d2l-menu-item-radio" item).
|
|
@@ -3,7 +3,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
3
3
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
4
4
|
import { MenuItemMixin } from './menu-item-mixin.js';
|
|
5
5
|
import { menuItemStyles } from './menu-item-styles.js';
|
|
6
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
6
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
7
7
|
|
|
8
8
|
class MenuItemReturn extends RtlMixin(LocalizeCoreElement(MenuItemMixin(LitElement))) {
|
|
9
9
|
|
package/components/menu/menu.js
CHANGED
|
@@ -3,7 +3,7 @@ import '../icons/icon.js';
|
|
|
3
3
|
import './menu-item-return.js';
|
|
4
4
|
import { css, html, LitElement } from 'lit';
|
|
5
5
|
import { HierarchicalViewMixin } from '../hierarchical-view/hierarchical-view-mixin.js';
|
|
6
|
-
import { ThemeMixin } from '../../mixins/theme-mixin.js';
|
|
6
|
+
import { ThemeMixin } from '../../mixins/theme/theme-mixin.js';
|
|
7
7
|
|
|
8
8
|
const keyCodes = {
|
|
9
9
|
DOWN: 40,
|
|
@@ -3,7 +3,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
3
3
|
import { bodyStandardStyles } from '../typography/styles.js';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import { MeterMixin } from './meter-mixin.js';
|
|
6
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
6
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A circular progress indicator.
|
|
@@ -2,7 +2,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
2
2
|
import { bodySmallStyles } from '../typography/styles.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import { MeterMixin } from './meter-mixin.js';
|
|
5
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
5
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A horizontal progress bar.
|
|
@@ -3,7 +3,7 @@ import { bodySmallStyles, heading4Styles } from '../typography/styles.js';
|
|
|
3
3
|
import { css, html, LitElement } from 'lit';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import { MeterMixin } from './meter-mixin.js';
|
|
6
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
6
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A half-circle progress indicator.
|
|
@@ -13,7 +13,7 @@ import '../menu/menu-item-link.js';
|
|
|
13
13
|
import { css, html, LitElement } from 'lit';
|
|
14
14
|
import { OVERFLOW_CLASS, OVERFLOW_MINI_CLASS, OverflowGroupMixin } from './overflow-group-mixin.js';
|
|
15
15
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
16
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
16
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
17
17
|
|
|
18
18
|
const OPENER_STYLE = {
|
|
19
19
|
DEFAULT: 'default',
|
|
@@ -3,7 +3,7 @@ import '../loading-spinner/loading-spinner.js';
|
|
|
3
3
|
import { css, html, LitElement, nothing } from 'lit';
|
|
4
4
|
import { buttonStyles } from '../button/button-styles.js';
|
|
5
5
|
import { findComposedAncestor } from '../../helpers/dom.js';
|
|
6
|
-
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
6
|
+
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
7
7
|
import { formatNumber } from '@brightspace-ui/intl/lib/number.js';
|
|
8
8
|
import { getFirstFocusableDescendant } from '../../helpers/focus.js';
|
|
9
9
|
import { getSeparator } from '@brightspace-ui/intl/lib/list.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../scroll-wrapper.js';
|
|
2
2
|
import { css, html, LitElement } from 'lit';
|
|
3
|
-
import { RtlMixin } from '../../../mixins/rtl-mixin.js';
|
|
3
|
+
import { RtlMixin } from '../../../mixins/rtl/rtl-mixin.js';
|
|
4
4
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
5
5
|
|
|
6
6
|
class TestScrollWrapper extends RtlMixin(LitElement) {
|
|
@@ -4,7 +4,7 @@ import { css, html, LitElement, unsafeCSS } from 'lit';
|
|
|
4
4
|
import { getFocusPseudoClass } from '../../helpers/focus.js';
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
6
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
7
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
7
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
8
8
|
|
|
9
9
|
const RTL_MULTIPLIER = navigator.userAgent.indexOf('Edge/') > 0 ? 1 : -1; /* legacy-Edge doesn't reverse scrolling in RTL */
|
|
10
10
|
const SCROLL_AMOUNT = 0.8;
|
|
@@ -2,7 +2,7 @@ import '../button/button-subtle.js';
|
|
|
2
2
|
import { html, LitElement } from 'lit';
|
|
3
3
|
import { DropdownOpenerMixin } from '../dropdown/dropdown-opener-mixin.js';
|
|
4
4
|
import { dropdownOpenerStyles } from '../dropdown/dropdown-opener-styles.js';
|
|
5
|
-
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
5
|
+
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
6
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
7
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
8
8
|
import { SelectionActionMixin } from './selection-action-mixin.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../button/button-subtle.js';
|
|
2
2
|
import { css, html, LitElement } from 'lit';
|
|
3
3
|
import { ButtonMixin } from '../button/button-mixin.js';
|
|
4
|
-
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
4
|
+
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
6
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
7
7
|
import { SelectionActionMixin } from './selection-action-mixin.js';
|
|
@@ -6,7 +6,7 @@ import { css, html, LitElement, nothing } from 'lit';
|
|
|
6
6
|
import { classMap } from 'lit/directives/class-map.js';
|
|
7
7
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
8
8
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
9
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
9
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
10
10
|
import { SelectionObserverMixin } from './selection-observer-mixin.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -2,7 +2,7 @@ import '../inputs/input-checkbox.js';
|
|
|
2
2
|
import { css, html, LitElement } from 'lit';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
-
import { LabelledMixin } from '../../mixins/labelled-mixin.js';
|
|
5
|
+
import { LabelledMixin } from '../../mixins/labelled/labelled-mixin.js';
|
|
6
6
|
import { radioStyles } from '../inputs/input-radio-styles.js';
|
|
7
7
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../button/button-subtle.js';
|
|
2
2
|
import { css, html, LitElement } from 'lit';
|
|
3
|
-
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
3
|
+
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
4
4
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
5
5
|
import { SelectionInfo } from './selection-mixin.js';
|
|
6
6
|
import { SelectionObserverMixin } from './selection-observer-mixin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../inputs/input-checkbox.js';
|
|
2
2
|
import { css, html, LitElement } from 'lit';
|
|
3
|
-
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
3
|
+
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
5
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
6
6
|
import { SelectionInfo } from './selection-mixin.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
2
|
import { css } from 'lit';
|
|
3
3
|
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
4
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
4
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
5
5
|
|
|
6
6
|
// DE50056: starting in Safari 16, the pulsing animation causes FACE
|
|
7
7
|
// (and possibly elsewhere) to render a blank page
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
2
|
import { css, html, unsafeCSS } from 'lit';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
4
|
+
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
5
5
|
import { getFocusPseudoClass } from '../../helpers/focus.js';
|
|
6
6
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
7
7
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
8
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
8
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
9
9
|
|
|
10
10
|
export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(superclass)) {
|
|
11
11
|
|
|
@@ -12,7 +12,7 @@ import '../../selection/selection-input.js';
|
|
|
12
12
|
import { css, html } from 'lit';
|
|
13
13
|
import { tableStyles, TableWrapper } from '../table-wrapper.js';
|
|
14
14
|
import { DemoPassthroughMixin } from '../../demo/demo-passthrough-mixin.js';
|
|
15
|
-
import { RtlMixin } from '../../../mixins/rtl-mixin.js';
|
|
15
|
+
import { RtlMixin } from '../../../mixins/rtl/rtl-mixin.js';
|
|
16
16
|
|
|
17
17
|
const fruits = ['Apples', 'Oranges', 'Bananas'];
|
|
18
18
|
const thText = ['Additional', 'Placeholder', 'Header', 'Row'];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
2
|
import '../icons/icon.js';
|
|
3
3
|
import { css, html, LitElement, unsafeCSS } from 'lit';
|
|
4
|
-
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
4
|
+
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
5
5
|
import { getFocusPseudoClass } from '../../helpers/focus.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
2
|
import '../scroll-wrapper/scroll-wrapper.js';
|
|
3
3
|
import { css, html, LitElement, nothing } from 'lit';
|
|
4
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
4
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
5
5
|
import { SelectionMixin } from '../selection/selection-mixin.js';
|
|
6
6
|
|
|
7
7
|
export const tableStyles = css`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
2
|
import { css, html, LitElement, unsafeCSS } from 'lit';
|
|
3
3
|
import { getFocusPseudoClass } from '../../helpers/focus.js';
|
|
4
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
4
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
5
5
|
|
|
6
6
|
const keyCodes = {
|
|
7
7
|
ENTER: 13,
|
package/components/tabs/tabs.js
CHANGED
|
@@ -4,14 +4,14 @@ import '../../helpers/queueMicrotask.js';
|
|
|
4
4
|
import './tab-internal.js';
|
|
5
5
|
import { css, html, LitElement, unsafeCSS } from 'lit';
|
|
6
6
|
import { cssEscape, findComposedAncestor } from '../../helpers/dom.js';
|
|
7
|
-
import { ArrowKeysMixin } from '../../mixins/arrow-keys-mixin.js';
|
|
7
|
+
import { ArrowKeysMixin } from '../../mixins/arrow-keys/arrow-keys-mixin.js';
|
|
8
8
|
import { bodyCompactStyles } from '../typography/styles.js';
|
|
9
9
|
import { classMap } from 'lit/directives/class-map.js';
|
|
10
10
|
import { getFocusPseudoClass } from '../../helpers/focus.js';
|
|
11
11
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
12
12
|
import { repeat } from 'lit/directives/repeat.js';
|
|
13
13
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
14
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
14
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
15
15
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
16
16
|
|
|
17
17
|
const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
@@ -8,7 +8,7 @@ import { classMap } from 'lit/directives/class-map.js';
|
|
|
8
8
|
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
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
11
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
12
12
|
|
|
13
13
|
const keyCodes = {
|
|
14
14
|
BACKSPACE: 8,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '../button/button-subtle.js';
|
|
2
2
|
import { css, html, LitElement } from 'lit';
|
|
3
3
|
import { announce } from '../../helpers/announce.js';
|
|
4
|
-
import { ArrowKeysMixin } from '../../mixins/arrow-keys-mixin.js';
|
|
4
|
+
import { ArrowKeysMixin } from '../../mixins/arrow-keys/arrow-keys-mixin.js';
|
|
5
5
|
import { classMap } from 'lit/directives/class-map.js';
|
|
6
6
|
import { getOffsetParent } from '../../helpers/dom.js';
|
|
7
|
-
import { InteractiveMixin } from '../../mixins/interactive-mixin.js';
|
|
7
|
+
import { InteractiveMixin } from '../../mixins/interactive/interactive-mixin.js';
|
|
8
8
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
9
9
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
10
10
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
@@ -3,7 +3,7 @@ import '../tooltip/tooltip.js';
|
|
|
3
3
|
import { css, html, LitElement, nothing, unsafeCSS } from 'lit';
|
|
4
4
|
import { bodySmallStyles } from '../typography/styles.js';
|
|
5
5
|
import { classMap } from 'lit/directives/class-map.js';
|
|
6
|
-
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
6
|
+
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
7
7
|
import { getFocusPseudoClass } from '../../helpers/focus.js';
|
|
8
8
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
9
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
|
@@ -6,7 +6,7 @@ import { bodySmallStyles } from '../typography/styles.js';
|
|
|
6
6
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
7
7
|
import { isFocusable } from '../../helpers/focus.js';
|
|
8
8
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
9
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
9
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
10
10
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
11
11
|
|
|
12
12
|
let logAccessibilityWarning = true;
|
package/custom-elements.json
CHANGED
|
@@ -438,6 +438,66 @@
|
|
|
438
438
|
}
|
|
439
439
|
]
|
|
440
440
|
},
|
|
441
|
+
{
|
|
442
|
+
"name": "d2l-button-move",
|
|
443
|
+
"path": "./components/button/button-move.js",
|
|
444
|
+
"description": "A button component that provides a move action via a single button.",
|
|
445
|
+
"attributes": [
|
|
446
|
+
{
|
|
447
|
+
"name": "description",
|
|
448
|
+
"description": "A description to be added to the button for accessibility when text on button does not provide enough context",
|
|
449
|
+
"type": "string"
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"name": "disabled-tooltip",
|
|
453
|
+
"description": "Tooltip text when disabled",
|
|
454
|
+
"type": "string"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"name": "text",
|
|
458
|
+
"description": "REQUIRED: Accessible text for the button",
|
|
459
|
+
"type": "string"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"name": "disabled",
|
|
463
|
+
"description": "Disables the button",
|
|
464
|
+
"type": "boolean",
|
|
465
|
+
"default": "false"
|
|
466
|
+
}
|
|
467
|
+
],
|
|
468
|
+
"properties": [
|
|
469
|
+
{
|
|
470
|
+
"name": "description",
|
|
471
|
+
"attribute": "description",
|
|
472
|
+
"description": "A description to be added to the button for accessibility when text on button does not provide enough context",
|
|
473
|
+
"type": "string"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"name": "disabledTooltip",
|
|
477
|
+
"attribute": "disabled-tooltip",
|
|
478
|
+
"description": "Tooltip text when disabled",
|
|
479
|
+
"type": "string"
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"name": "text",
|
|
483
|
+
"attribute": "text",
|
|
484
|
+
"description": "REQUIRED: Accessible text for the button",
|
|
485
|
+
"type": "string"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"name": "disabled",
|
|
489
|
+
"attribute": "disabled",
|
|
490
|
+
"description": "Disables the button",
|
|
491
|
+
"type": "boolean",
|
|
492
|
+
"default": "false"
|
|
493
|
+
}
|
|
494
|
+
],
|
|
495
|
+
"events": [
|
|
496
|
+
{
|
|
497
|
+
"name": "d2l-button-move-action"
|
|
498
|
+
}
|
|
499
|
+
]
|
|
500
|
+
},
|
|
441
501
|
{
|
|
442
502
|
"name": "d2l-button-subtle",
|
|
443
503
|
"path": "./components/button/button-subtle.js",
|
package/helpers/demo/prism.html
CHANGED
|
@@ -615,7 +615,7 @@ import { getComposedActiveElement, getFirstFocusableDescendant, getPreviousFocus
|
|
|
615
615
|
import { classMap } from 'lit/directives/class-map.js';
|
|
616
616
|
import { html } from 'lit';
|
|
617
617
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
618
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
618
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
619
619
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
620
620
|
import { tryGetIfrauBackdropService } from '../../helpers/ifrauBackdropService.js';
|
|
621
621
|
|
|
@@ -1768,11 +1768,11 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreE
|
|
|
1768
1768
|
<pre class="d2l-code d2l-code-dark line-numbers"><code class="language-javascript">import '../colors/colors.js';
|
|
1769
1769
|
import { css, html, LitElement } from 'lit';
|
|
1770
1770
|
import { classMap } from 'lit/directives/class-map.js';
|
|
1771
|
-
import { FocusMixin } from '../../mixins/focus-mixin.js';
|
|
1771
|
+
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
1772
1772
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
1773
1773
|
import { offscreenStyles } from '../offscreen/offscreen.js';
|
|
1774
1774
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
1775
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
1775
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
1776
1776
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
1777
1777
|
|
|
1778
1778
|
/**
|
|
@@ -9,7 +9,7 @@ The focusable elements can be provided in one of two ways:
|
|
|
9
9
|
If the elements are known up-front and are in the element's local DOM scope, simply add the d2l-arrowkeys-focusable class.
|
|
10
10
|
|
|
11
11
|
```javascript
|
|
12
|
-
import { ArrowKeysMixin } from '@brightspace-ui/core/mixins/arrow-keys-mixin.js';
|
|
12
|
+
import { ArrowKeysMixin } from '@brightspace-ui/core/mixins/arrow-keys/arrow-keys-mixin.js';
|
|
13
13
|
class MyElement extends ArrowKeysMixin(LitElement) {
|
|
14
14
|
render() {
|
|
15
15
|
return this.arrowKeysContainer(html`
|
|
@@ -28,7 +28,7 @@ customElements.define('my-element', MyElement);
|
|
|
28
28
|
If the elements are not known up front, or the elements cannot be simply queried in the element's local DOM-scope, an async arrowKeysFocusablesProvider may be implemented.
|
|
29
29
|
|
|
30
30
|
```javascript
|
|
31
|
-
import { ArrowKeysMixin } from '@brightspace-ui/core/mixins/arrow-keys-mixin.js';
|
|
31
|
+
import { ArrowKeysMixin } from '@brightspace-ui/core/mixins/arrow-keys/arrow-keys-mixin.js';
|
|
32
32
|
class MyElement extends ArrowKeysMixin(LitElement) {
|
|
33
33
|
render() {
|
|
34
34
|
return this.arrowKeysContainer(html`
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
|
|
3
|
+
const keyCodes = Object.freeze({
|
|
4
|
+
END: 35,
|
|
5
|
+
HOME: 36,
|
|
6
|
+
LEFT: 37,
|
|
7
|
+
UP: 38,
|
|
8
|
+
RIGHT: 39,
|
|
9
|
+
DOWN: 40,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const ArrowKeysMixin = superclass => class extends superclass {
|
|
13
|
+
|
|
14
|
+
static get properties() {
|
|
15
|
+
return {
|
|
16
|
+
/**
|
|
17
|
+
* @ignore
|
|
18
|
+
*/
|
|
19
|
+
arrowKeysDirection: { type: String, attribute: 'arrow-keys-direction' },
|
|
20
|
+
/**
|
|
21
|
+
* @ignore
|
|
22
|
+
*/
|
|
23
|
+
arrowKeysNoWrap: { type: Boolean, attribute: 'arrow-keys-no-wrap' }
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.arrowKeysDirection = 'leftright';
|
|
30
|
+
this.arrowKeysNoWrap = false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
arrowKeysContainer(inner) {
|
|
34
|
+
return html`<div class="arrow-keys-container" @keydown="${this._handleArrowKeys}">
|
|
35
|
+
${inner}
|
|
36
|
+
</div>`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async arrowKeysFocusablesProvider() {
|
|
40
|
+
return this.shadowRoot ?
|
|
41
|
+
[...this.shadowRoot.querySelectorAll('.d2l-arrowkeys-focusable')]
|
|
42
|
+
: [];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async _focus(elem) {
|
|
46
|
+
if (elem) {
|
|
47
|
+
if (this.arrowKeysOnBeforeFocus) await this.arrowKeysOnBeforeFocus(elem);
|
|
48
|
+
elem.focus();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async _focusFirst() {
|
|
53
|
+
const elems = await this.arrowKeysFocusablesProvider();
|
|
54
|
+
if (elems && elems.length > 0) return this._focus(elems[0]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async _focusLast() {
|
|
58
|
+
const elems = await this.arrowKeysFocusablesProvider();
|
|
59
|
+
if (elems && elems.length > 0) return this._focus(elems[elems.length - 1]);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async _focusNext(elem) {
|
|
63
|
+
const elems = await this.arrowKeysFocusablesProvider();
|
|
64
|
+
const next = this._tryGetNextFocusable(elems, elem);
|
|
65
|
+
return this._focus(next);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async _focusPrevious(elem) {
|
|
69
|
+
const elems = await this.arrowKeysFocusablesProvider();
|
|
70
|
+
const previous = this._tryGetPreviousFocusable(elems, elem);
|
|
71
|
+
return this._focus(previous);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
_handleArrowKeys(e) {
|
|
75
|
+
const target = e.target;
|
|
76
|
+
if (this.arrowKeysDirection.indexOf('left') >= 0 && e.keyCode === keyCodes.LEFT) {
|
|
77
|
+
if (getComputedStyle(this).direction === 'rtl') {
|
|
78
|
+
this._focusNext(target);
|
|
79
|
+
} else {
|
|
80
|
+
this._focusPrevious(target);
|
|
81
|
+
}
|
|
82
|
+
} else if (this.arrowKeysDirection.indexOf('right') >= 0 && e.keyCode === keyCodes.RIGHT) {
|
|
83
|
+
if (getComputedStyle(this).direction === 'rtl') {
|
|
84
|
+
this._focusPrevious(target);
|
|
85
|
+
} else {
|
|
86
|
+
this._focusNext(target);
|
|
87
|
+
}
|
|
88
|
+
} else if (this.arrowKeysDirection.indexOf('up') >= 0 && e.keyCode === keyCodes.UP) {
|
|
89
|
+
this._focusPrevious(target);
|
|
90
|
+
} else if (this.arrowKeysDirection.indexOf('down') >= 0 && e.keyCode === keyCodes.DOWN) {
|
|
91
|
+
this._focusNext(target);
|
|
92
|
+
} else if (e.keyCode === keyCodes.HOME) {
|
|
93
|
+
this._focusFirst();
|
|
94
|
+
} else if (e.keyCode === keyCodes.END) {
|
|
95
|
+
this._focusLast();
|
|
96
|
+
} else {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
e.stopPropagation();
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
_tryGetNextFocusable(elems, elem) {
|
|
104
|
+
if (!elems || elems.length === 0) return;
|
|
105
|
+
|
|
106
|
+
const index = elems.indexOf(elem);
|
|
107
|
+
if (index === elems.length - 1) {
|
|
108
|
+
if (this.arrowKeysNoWrap) return;
|
|
109
|
+
return elems[0];
|
|
110
|
+
}
|
|
111
|
+
return elems[index + 1];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
_tryGetPreviousFocusable(elems, elem) {
|
|
115
|
+
if (!elems || elems.length === 0) return;
|
|
116
|
+
|
|
117
|
+
const index = elems.indexOf(elem);
|
|
118
|
+
if (index === 0) {
|
|
119
|
+
if (this.arrowKeysNoWrap) return;
|
|
120
|
+
return elems[elems.length - 1];
|
|
121
|
+
}
|
|
122
|
+
return elems[index - 1];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
};
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
5
|
<meta charset="UTF-8">
|
|
6
|
-
<link rel="stylesheet" href="
|
|
6
|
+
<link rel="stylesheet" href="../../../components/demo/styles.css" type="text/css">
|
|
7
7
|
<script type="module">
|
|
8
|
-
import '
|
|
8
|
+
import '../../../components/demo/demo-page.js';
|
|
9
9
|
import './arrow-keys-test.js';
|
|
10
10
|
</script>
|
|
11
11
|
</head>
|