@brightspace-ui/core 1.220.5 → 1.222.2
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/components/card/card-footer-link.js +0 -15
- package/components/count-badge/count-badge-icon.js +34 -22
- package/components/dropdown/dropdown-content-mixin.js +9 -5
- package/components/dropdown/dropdown-content-styles.js +3 -3
- package/components/meter/README.md +11 -12
- package/package.json +1 -1
|
@@ -76,19 +76,11 @@ class CardFooterLink extends RtlMixin(LitElement) {
|
|
|
76
76
|
return [offscreenStyles, css`
|
|
77
77
|
:host {
|
|
78
78
|
display: inline-block;
|
|
79
|
-
left: 0.15rem;
|
|
80
|
-
margin-right: 0.3rem;
|
|
81
79
|
position: relative;
|
|
82
80
|
}
|
|
83
81
|
:host[hidden] {
|
|
84
82
|
display: none;
|
|
85
83
|
}
|
|
86
|
-
:host([dir="rtl"]) {
|
|
87
|
-
left: auto;
|
|
88
|
-
margin-left: 0.3rem;
|
|
89
|
-
margin-right: 0;
|
|
90
|
-
right: 0.15rem;
|
|
91
|
-
}
|
|
92
84
|
a {
|
|
93
85
|
box-sizing: border-box;
|
|
94
86
|
display: inline-block;
|
|
@@ -99,13 +91,6 @@ class CardFooterLink extends RtlMixin(LitElement) {
|
|
|
99
91
|
d2l-count-badge-icon {
|
|
100
92
|
text-align: initial;
|
|
101
93
|
}
|
|
102
|
-
::slotted(d2l-tooltip) {
|
|
103
|
-
left: calc(-50% + 11px) !important;
|
|
104
|
-
}
|
|
105
|
-
:host([dir="rtl"]) ::slotted(d2l-tooltip) {
|
|
106
|
-
left: 0;
|
|
107
|
-
right: calc(-50% + 11px) !important;
|
|
108
|
-
}
|
|
109
94
|
`];
|
|
110
95
|
}
|
|
111
96
|
|
|
@@ -29,27 +29,24 @@ class CountBadgeIcon extends CountBadgeMixin(LitElement) {
|
|
|
29
29
|
outline: none;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.d2l-count-badge-wrapper {
|
|
33
|
-
display: inline-block;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
32
|
:host {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
padding-left:
|
|
42
|
-
padding-right: 0;
|
|
33
|
+
/* for long numbers, center the number on the icon */
|
|
34
|
+
--d2l-count-badge-icon-padding: calc(-50% + (var(--d2l-count-badge-icon-height) / 2) + 2px);
|
|
35
|
+
display: inline-block;
|
|
36
|
+
/* symmetrical padding to prevent overflows for most numbers */
|
|
37
|
+
padding-left: 0.5rem;
|
|
38
|
+
padding-right: 0.5rem;
|
|
39
|
+
position: relative;
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
:host([size="large"]) {
|
|
46
|
-
--d2l-count-badge-icon-padding:
|
|
47
|
-
|
|
43
|
+
--d2l-count-badge-icon-padding-top: 0.7rem;
|
|
44
|
+
padding-top: var(--d2l-count-badge-icon-padding-top);
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
:host([size="small"]) {
|
|
51
|
-
--d2l-count-badge-icon-padding:
|
|
52
|
-
|
|
48
|
+
--d2l-count-badge-icon-padding-top: 0.55rem;
|
|
49
|
+
padding-top: var(--d2l-count-badge-icon-padding-top);
|
|
53
50
|
}
|
|
54
51
|
|
|
55
52
|
:host([icon*="tier1:"]) {
|
|
@@ -63,7 +60,7 @@ class CountBadgeIcon extends CountBadgeMixin(LitElement) {
|
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
d2l-tooltip[_open-dir="top"] {
|
|
66
|
-
margin-top: -
|
|
63
|
+
margin-top: calc(0px - var(--d2l-count-badge-icon-padding-top));
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
d2l-icon {
|
|
@@ -79,15 +76,30 @@ class CountBadgeIcon extends CountBadgeMixin(LitElement) {
|
|
|
79
76
|
}
|
|
80
77
|
|
|
81
78
|
render() {
|
|
82
|
-
|
|
83
|
-
const numberStyles = {
|
|
79
|
+
let numberStyles = {
|
|
84
80
|
border: '2px solid white',
|
|
85
|
-
position: '
|
|
86
|
-
|
|
87
|
-
right: this.dir === 'rtl' ? 'var(--d2l-count-badge-icon-padding)' : 0,
|
|
88
|
-
top: numberPadding,
|
|
89
|
-
visibility: this.skeleton ? 'hidden' : undefined
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
visibility: this.skeleton ? 'hidden' : undefined,
|
|
90
83
|
};
|
|
84
|
+
|
|
85
|
+
// center long number strings to prevent overflow
|
|
86
|
+
const centerNumber = this.getNumberString().length >= 4;
|
|
87
|
+
|
|
88
|
+
if (centerNumber) {
|
|
89
|
+
const xPadding = 'var(--d2l-count-badge-icon-padding)';
|
|
90
|
+
numberStyles = {
|
|
91
|
+
... numberStyles,
|
|
92
|
+
transform: this.dir === 'rtl'
|
|
93
|
+
? `translateY(-50%) translateX(calc(0px - ${xPadding}))`
|
|
94
|
+
: `translateY(-50%) translateX(${xPadding})`
|
|
95
|
+
};
|
|
96
|
+
} else {
|
|
97
|
+
numberStyles = {
|
|
98
|
+
... numberStyles,
|
|
99
|
+
[this.dir === 'rtl' ? 'left' : 'right'] : '-0.1rem',
|
|
100
|
+
transform: 'translateY(-50%)'
|
|
101
|
+
};
|
|
102
|
+
}
|
|
91
103
|
const tabbable = (this.tabStop || this.hasTooltip) && !this.skeleton;
|
|
92
104
|
const innerHtml = html`
|
|
93
105
|
${this.renderCount(numberStyles)}
|
|
@@ -14,6 +14,8 @@ import { tryGetIfrauBackdropService } from '../../helpers/ifrauBackdropService.j
|
|
|
14
14
|
const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
15
15
|
const minBackdropHeightMobile = 42;
|
|
16
16
|
const minBackdropWidthMobile = 30;
|
|
17
|
+
const outerMarginTopBottom = 18;
|
|
18
|
+
const defaultVerticalOffset = 16;
|
|
17
19
|
|
|
18
20
|
export const DropdownContentMixin = superclass => class extends LocalizeCoreElement(RtlMixin(superclass)) {
|
|
19
21
|
|
|
@@ -264,6 +266,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
264
266
|
this._hasHeader = false;
|
|
265
267
|
this._hasFooter = false;
|
|
266
268
|
this._showBackdrop = false;
|
|
269
|
+
this._verticalOffset = defaultVerticalOffset;
|
|
267
270
|
|
|
268
271
|
this.__onResize = this.__onResize.bind(this);
|
|
269
272
|
this.__onAutoCloseFocus = this.__onAutoCloseFocus.bind(this);
|
|
@@ -324,9 +327,10 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
324
327
|
if (propName === 'verticalOffset') {
|
|
325
328
|
let newVerticalOffset = parseInt(this.verticalOffset);
|
|
326
329
|
if (isNaN(newVerticalOffset)) {
|
|
327
|
-
newVerticalOffset =
|
|
330
|
+
newVerticalOffset = defaultVerticalOffset;
|
|
328
331
|
}
|
|
329
332
|
this.style.setProperty('--d2l-dropdown-verticaloffset', `${newVerticalOffset}px`);
|
|
333
|
+
this._verticalOffset = newVerticalOffset;
|
|
330
334
|
}
|
|
331
335
|
});
|
|
332
336
|
}
|
|
@@ -616,9 +620,9 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
616
620
|
if (bounded) {
|
|
617
621
|
spaceAround = this._constrainSpaceAround({
|
|
618
622
|
// allow for target offset + outer margin
|
|
619
|
-
above: targetRect.top - boundingContainerRect.top -
|
|
623
|
+
above: targetRect.top - boundingContainerRect.top - this._verticalOffset - outerMarginTopBottom,
|
|
620
624
|
// allow for target offset + outer margin
|
|
621
|
-
below: boundingContainerRect.bottom - targetRect.bottom -
|
|
625
|
+
below: boundingContainerRect.bottom - targetRect.bottom - this._verticalOffset - outerMarginTopBottom,
|
|
622
626
|
// allow for outer margin
|
|
623
627
|
left: targetRect.left - boundingContainerRect.left - 20,
|
|
624
628
|
// allow for outer margin
|
|
@@ -631,9 +635,9 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
631
635
|
} else {
|
|
632
636
|
spaceAround = this._constrainSpaceAround({
|
|
633
637
|
// allow for target offset + outer margin
|
|
634
|
-
above: targetRect.top -
|
|
638
|
+
above: targetRect.top - this._verticalOffset - outerMarginTopBottom,
|
|
635
639
|
// allow for target offset + outer margin
|
|
636
|
-
below: window.innerHeight - targetRect.bottom -
|
|
640
|
+
below: window.innerHeight - targetRect.bottom - this._verticalOffset - outerMarginTopBottom,
|
|
637
641
|
// allow for outer margin
|
|
638
642
|
left: targetRect.left - 20,
|
|
639
643
|
// allow for outer margin
|
|
@@ -16,7 +16,7 @@ export const dropdownContentStyles = css`
|
|
|
16
16
|
left: 0;
|
|
17
17
|
position: absolute;
|
|
18
18
|
text-align: left;
|
|
19
|
-
top: calc(100% + var(--d2l-dropdown-verticaloffset,
|
|
19
|
+
top: calc(100% + var(--d2l-dropdown-verticaloffset, 16px));
|
|
20
20
|
width: 100%;
|
|
21
21
|
z-index: 1000; /* position on top of floating buttons */
|
|
22
22
|
}
|
|
@@ -38,7 +38,7 @@ export const dropdownContentStyles = css`
|
|
|
38
38
|
|
|
39
39
|
:host([opened-above]) {
|
|
40
40
|
animation: var(--d2l-dropdown-above-animation-name) 300ms ease;
|
|
41
|
-
bottom: calc(100% + var(--d2l-dropdown-verticaloffset,
|
|
41
|
+
bottom: calc(100% + var(--d2l-dropdown-verticaloffset, 16px));
|
|
42
42
|
top: auto;
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -49,7 +49,7 @@ export const dropdownContentStyles = css`
|
|
|
49
49
|
|
|
50
50
|
:host([data-mobile][opened-above]:not([mobile-tray])) {
|
|
51
51
|
animation: var(--d2l-dropdown-above-animation-name) 300ms ease;
|
|
52
|
-
bottom: calc(100% + var(--d2l-dropdown-verticaloffset,
|
|
52
|
+
bottom: calc(100% + var(--d2l-dropdown-verticaloffset, 16px));
|
|
53
53
|
top: auto;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -56,12 +56,11 @@ Linear meters show a horizontal progress bar.
|
|
|
56
56
|
* `value` (required, Number): Current number of completed units. A positive, non-zero number that is less than or equal to `max`.
|
|
57
57
|
* `max` (Number, default: `100`): Max number of units that are being measured by this meter. A positive, non-zero number.
|
|
58
58
|
* `percent` Boolean: Shows a percentage instead of `value/max`.
|
|
59
|
-
* `text-inline` Boolean: Keeps the meter to a single line.
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* `
|
|
63
|
-
* **DEPRECATED** `
|
|
64
|
-
* **DEPRECATED** `{y}` in the string will be replaced with `max`
|
|
59
|
+
* `text-inline` Boolean: Keeps the meter to a single line. Adding one of the following between `{}` (e.g., `{x/y}`) causes replacements:
|
|
60
|
+
* `%` in the string will be replaced with percentage value
|
|
61
|
+
* `x/y` in the string will be replaced with fraction with the proper language support
|
|
62
|
+
* **DEPRECATED** `x` in the string will be replaced with `value`
|
|
63
|
+
* **DEPRECATED** `y` in the string will be replaced with `max`
|
|
65
64
|
<!-- docs: end hidden content -->
|
|
66
65
|
|
|
67
66
|
## Radial meter [d2l-meter-radial]
|
|
@@ -89,9 +88,9 @@ Radial meters appear as a half circle. They have more visual weight than a line
|
|
|
89
88
|
* `value` (required, Number): Current number of completed units. A positive, non-zero number that is less than or equal to `max`.
|
|
90
89
|
* `max` (Number, default: `100`): Max number of units that are being measured by this meter. A positive, non-zero number.
|
|
91
90
|
* `percent` (Boolean): Shows a percentage instead of `value/max`.
|
|
92
|
-
* `text` (String): Context information about what the meter is about.
|
|
93
|
-
*
|
|
94
|
-
* `
|
|
91
|
+
* `text` (String): Context information about what the meter is about. Adding one of the following between `{}` (e.g., `{x/y}`) causes replacements:
|
|
92
|
+
* `%` in the string will be replaced with percentage value
|
|
93
|
+
* `x/y` in the string will be replaced with fraction with the proper language support
|
|
95
94
|
<!-- docs: end hidden content -->
|
|
96
95
|
|
|
97
96
|
|
|
@@ -134,7 +133,7 @@ All `meter` components have a `foreground-light` style that ensures accessibl
|
|
|
134
133
|
* `value` (required, Number): Current number of completed units. A positive, non-zero number that is less than or equal to `max`.
|
|
135
134
|
* `max` (Number, default: `100`): Max number of units that are being measured by this meter. A positive, non-zero number.
|
|
136
135
|
* `percent` (Boolean): Shows a percentage instead of `value/max`.
|
|
137
|
-
* `text` (String): Context information about what the meter is about.
|
|
138
|
-
*
|
|
139
|
-
* `
|
|
136
|
+
* `text` (String): Context information about what the meter is about. Adding one of the following between `{}` (e.g., `{x/y}`) causes replacements:
|
|
137
|
+
* `%` in the string will be replaced with percentage value
|
|
138
|
+
* `x/y` in the string will be replaced with fraction with the proper language support
|
|
140
139
|
<!-- docs: end hidden content -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.222.2",
|
|
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",
|