@brightspace-ui/core 2.80.2 → 2.80.4
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/collapsible-panel/README.md +1 -1
- package/components/collapsible-panel/collapsible-panel.js +3 -3
- package/components/collapsible-panel/demo/collapsible-panel.html +2 -2
- package/components/object-property-list/demo/object-property-list.html +13 -0
- package/components/object-property-list/object-property-list-item.js +25 -3
- package/components/object-property-list/object-property-list.js +22 -4
- package/custom-elements.json +15 -3
- package/package.json +1 -1
|
@@ -130,7 +130,7 @@ The `d2l-collapsible-panel` element is a container that provides specific layout
|
|
|
130
130
|
| `heading-style` | Number | The heading style to use |
|
|
131
131
|
| `heading-level` | Number | Semantic heading level (h1-h4) |
|
|
132
132
|
| `no-sticky` | Boolean | Disables sticky positioning for the header |
|
|
133
|
-
| `padding` | String | Optionally set horizontal padding of inline panels |
|
|
133
|
+
| `padding-type` | String | Optionally set horizontal padding of inline panels |
|
|
134
134
|
| `panel-title` | String | The title of the panel |
|
|
135
135
|
| `type` | String | The type of collapsible panel |
|
|
136
136
|
<!-- docs: end hidden content -->
|
|
@@ -68,7 +68,7 @@ class CollapsiblePanel extends RtlMixin(LitElement) {
|
|
|
68
68
|
* @type {'default'|'large'}
|
|
69
69
|
* @default "default"
|
|
70
70
|
*/
|
|
71
|
-
|
|
71
|
+
paddingType: { attribute: 'padding-type', type: String, reflect: true },
|
|
72
72
|
/**
|
|
73
73
|
* Disables sticky positioning for the header
|
|
74
74
|
* @type {boolean}
|
|
@@ -93,7 +93,7 @@ class CollapsiblePanel extends RtlMixin(LitElement) {
|
|
|
93
93
|
:host([hidden]) {
|
|
94
94
|
display: none;
|
|
95
95
|
}
|
|
96
|
-
:host([padding="large"][type="inline"]) {
|
|
96
|
+
:host([padding-type="large"][type="inline"]) {
|
|
97
97
|
--d2l-collapsible-panel-spacing-inline: 2rem;
|
|
98
98
|
}
|
|
99
99
|
.d2l-collapsible-panel {
|
|
@@ -248,7 +248,7 @@ class CollapsiblePanel extends RtlMixin(LitElement) {
|
|
|
248
248
|
this.expanded = false;
|
|
249
249
|
this.headingLevel = defaultHeading;
|
|
250
250
|
this.headingStyle = defaultHeading;
|
|
251
|
-
this.
|
|
251
|
+
this.paddingType = 'default';
|
|
252
252
|
this.type = 'default';
|
|
253
253
|
this.noSticky = false;
|
|
254
254
|
this._focused = false;
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
|
|
78
78
|
<h2>Inline with large padding</h2>
|
|
79
79
|
<d2l-demo-snippet>
|
|
80
|
-
<d2l-collapsible-panel panel-title="Availability Dates and Conditions" type="inline" padding="large">
|
|
80
|
+
<d2l-collapsible-panel panel-title="Availability Dates and Conditions" type="inline" padding-type="large">
|
|
81
81
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas odio ligula, aliquam efficitur sollicitudin non, dignissim quis nisl. Nullam rutrum, lectus sed finibus consectetur, dolor leo blandit lorem, vitae consectetur arcu enim ornare tortor. Praesent lobortis libero in libero sagittis consectetur. Maecenas ut velit efficitur, consectetur augue vitae, finibus turpis. In id tempor quam.
|
|
82
82
|
</d2l-collapsible-panel>
|
|
83
|
-
<d2l-collapsible-panel panel-title="Availability Dates and Conditions" type="inline" padding="large">
|
|
83
|
+
<d2l-collapsible-panel panel-title="Availability Dates and Conditions" type="inline" padding-type="large">
|
|
84
84
|
<d2l-collapsible-panel-summary-item slot="summary" text="Availability starts 8/16/2022 and ends 8/12/2022"></d2l-collapsible-panel-summary-item>
|
|
85
85
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas odio ligula, aliquam efficitur sollicitudin non, dignissim quis nisl. Nullam rutrum, lectus sed finibus consectetur, dolor leo blandit lorem, vitae consectetur arcu enim ornare tortor. Praesent lobortis libero in libero sagittis consectetur. Maecenas ut velit efficitur, consectetur augue vitae, finibus turpis. In id tempor quam.
|
|
86
86
|
</d2l-collapsible-panel>
|
|
@@ -59,6 +59,19 @@
|
|
|
59
59
|
</template>
|
|
60
60
|
</d2l-demo-snippet>
|
|
61
61
|
|
|
62
|
+
<h2>Object Property List: Hidden items</h2>
|
|
63
|
+
|
|
64
|
+
<d2l-demo-snippet overflow-hidden>
|
|
65
|
+
<template>
|
|
66
|
+
<d2l-object-property-list>
|
|
67
|
+
<d2l-object-property-list-item text="Item 1"></d2l-object-property-list-item>
|
|
68
|
+
<d2l-object-property-list-item text="Item 2 (Hidden)" hidden></d2l-object-property-list-item>
|
|
69
|
+
<d2l-object-property-list-item text="Item 3"></d2l-object-property-list-item>
|
|
70
|
+
<d2l-object-property-list-item text="Item 4 (Hidden)" hidden></d2l-object-property-list-item>
|
|
71
|
+
</d2l-object-property-list>
|
|
72
|
+
</template>
|
|
73
|
+
</d2l-demo-snippet>
|
|
74
|
+
|
|
62
75
|
<h2>Object Property List: No external whitespace (still contains internal whitespace in the component renderers)</h2>
|
|
63
76
|
|
|
64
77
|
<d2l-demo-snippet overflow-hidden>
|
|
@@ -11,6 +11,10 @@ import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
|
|
11
11
|
export class ObjectPropertyListItem extends SkeletonMixin(LitElement) {
|
|
12
12
|
static get properties() {
|
|
13
13
|
return {
|
|
14
|
+
/**
|
|
15
|
+
* @ignore
|
|
16
|
+
*/
|
|
17
|
+
hidden: { type: Boolean },
|
|
14
18
|
/**
|
|
15
19
|
* Name of an optional icon to display
|
|
16
20
|
* @type {string}
|
|
@@ -21,6 +25,7 @@ export class ObjectPropertyListItem extends SkeletonMixin(LitElement) {
|
|
|
21
25
|
* @type {string}
|
|
22
26
|
*/
|
|
23
27
|
text: { type: String },
|
|
28
|
+
_showSeparator: { state: true },
|
|
24
29
|
};
|
|
25
30
|
}
|
|
26
31
|
|
|
@@ -29,12 +34,14 @@ export class ObjectPropertyListItem extends SkeletonMixin(LitElement) {
|
|
|
29
34
|
:host {
|
|
30
35
|
vertical-align: middle;
|
|
31
36
|
}
|
|
37
|
+
:host([hidden]) {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
32
40
|
d2l-icon {
|
|
33
41
|
height: 1.2857em; /* 18px desired height at main font size (14px), but using em to scale properly at smaller breakpoint. */
|
|
34
42
|
width: 1.2857em;
|
|
35
43
|
}
|
|
36
44
|
.separator {
|
|
37
|
-
display: var(--d2l-object-property-list-item-separator-display, inline);
|
|
38
45
|
margin: 0 -0.05rem; /* 10px desired margin, subtract 5px arbitrary whitespace and 6px whitespace inside bullet icon. */
|
|
39
46
|
}
|
|
40
47
|
.separator d2l-icon {
|
|
@@ -57,6 +64,11 @@ export class ObjectPropertyListItem extends SkeletonMixin(LitElement) {
|
|
|
57
64
|
`];
|
|
58
65
|
}
|
|
59
66
|
|
|
67
|
+
constructor() {
|
|
68
|
+
super();
|
|
69
|
+
this._showSeparator = true;
|
|
70
|
+
}
|
|
71
|
+
|
|
60
72
|
render() {
|
|
61
73
|
return html`
|
|
62
74
|
${this._renderIcon()}
|
|
@@ -65,17 +77,27 @@ export class ObjectPropertyListItem extends SkeletonMixin(LitElement) {
|
|
|
65
77
|
`;
|
|
66
78
|
}
|
|
67
79
|
|
|
80
|
+
updated(changedProperties) {
|
|
81
|
+
super.updated(changedProperties);
|
|
82
|
+
if (changedProperties.has('hidden')) this._onHidden();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_onHidden() {
|
|
86
|
+
/** Dispatched when the visibility of the item changes */
|
|
87
|
+
this.dispatchEvent(new CustomEvent('d2l-object-property-list-item-visibility-change', { bubbles: true, composed: true }));
|
|
88
|
+
}
|
|
89
|
+
|
|
68
90
|
_renderIcon() {
|
|
69
91
|
return this.icon && !this.skeleton ? html`<d2l-icon icon="${this.icon}" class="item-icon"></d2l-icon>` : nothing;
|
|
70
92
|
}
|
|
71
93
|
|
|
72
94
|
_renderSeparator() {
|
|
73
|
-
return html`
|
|
95
|
+
return this._showSeparator ? html`
|
|
74
96
|
<span class="separator">
|
|
75
97
|
<d2l-screen-reader-pause></d2l-screen-reader-pause>
|
|
76
98
|
<d2l-icon icon="tier1:bullet"></d2l-icon>
|
|
77
99
|
</span>
|
|
78
|
-
|
|
100
|
+
` : nothing;
|
|
79
101
|
}
|
|
80
102
|
|
|
81
103
|
_renderText() {
|
|
@@ -28,9 +28,6 @@ class ObjectPropertyList extends LocalizeCoreElement(SkeletonMixin(LitElement))
|
|
|
28
28
|
:host([hidden]) {
|
|
29
29
|
display: none;
|
|
30
30
|
}
|
|
31
|
-
::slotted(:last-child), slot :last-child {
|
|
32
|
-
--d2l-object-property-list-item-separator-display: none;
|
|
33
|
-
}
|
|
34
31
|
::slotted([slot="status"]) {
|
|
35
32
|
display: none;
|
|
36
33
|
}
|
|
@@ -41,6 +38,13 @@ class ObjectPropertyList extends LocalizeCoreElement(SkeletonMixin(LitElement))
|
|
|
41
38
|
`];
|
|
42
39
|
}
|
|
43
40
|
|
|
41
|
+
firstUpdated() {
|
|
42
|
+
this.addEventListener('d2l-object-property-list-item-visibility-change', () => this._onItemsChanged());
|
|
43
|
+
|
|
44
|
+
const slot = this.shadowRoot.querySelector('slot:not([name])');
|
|
45
|
+
if (slot.childElementCount) this._setItemSeparatorVisibility(slot);
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
render() {
|
|
45
49
|
const slotContents = this.skeleton && this.skeletonCount > 0 ? [...Array(this.skeletonCount)].map(() => html`
|
|
46
50
|
<d2l-object-property-list-item text="${this.localize('components.object-property-list.item-placeholder-text')}" skeleton></d2l-object-property-list-item>
|
|
@@ -50,10 +54,24 @@ class ObjectPropertyList extends LocalizeCoreElement(SkeletonMixin(LitElement))
|
|
|
50
54
|
<div class="d2l-body-small">
|
|
51
55
|
<slot name="status"></slot>
|
|
52
56
|
<d2l-screen-reader-pause></d2l-screen-reader-pause>
|
|
53
|
-
<slot>${slotContents}</slot>
|
|
57
|
+
<slot @slotchange="${this._onItemsChanged}">${slotContents}</slot>
|
|
54
58
|
</div>
|
|
55
59
|
`;
|
|
56
60
|
}
|
|
61
|
+
|
|
62
|
+
_onItemsChanged(e) {
|
|
63
|
+
const slot = e?.target || this.shadowRoot.querySelector('slot:not([name])');
|
|
64
|
+
this._setItemSeparatorVisibility(slot);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
_setItemSeparatorVisibility(slot) {
|
|
68
|
+
const slottedElements = slot.assignedElements();
|
|
69
|
+
const elements = slottedElements.length ? slottedElements : [ ...slot.children ];
|
|
70
|
+
const filtered = elements.filter(item => item.tagName?.toLowerCase().includes('d2l-object-property-list-') && !item.hidden);
|
|
71
|
+
|
|
72
|
+
const lastIndex = filtered.length - 1;
|
|
73
|
+
filtered.forEach((item, i) => item._showSeparator = (i !== lastIndex));
|
|
74
|
+
}
|
|
57
75
|
}
|
|
58
76
|
|
|
59
77
|
customElements.define('d2l-object-property-list', ObjectPropertyList);
|
package/custom-elements.json
CHANGED
|
@@ -1100,7 +1100,7 @@
|
|
|
1100
1100
|
"default": "\"\\\"3\\\"\""
|
|
1101
1101
|
},
|
|
1102
1102
|
{
|
|
1103
|
-
"name": "padding",
|
|
1103
|
+
"name": "padding-type",
|
|
1104
1104
|
"description": "Horizontal padding of the panel",
|
|
1105
1105
|
"type": "'default'|'large'",
|
|
1106
1106
|
"default": "\"\\\"default\\\"\""
|
|
@@ -1153,8 +1153,8 @@
|
|
|
1153
1153
|
"default": "\"\\\"3\\\"\""
|
|
1154
1154
|
},
|
|
1155
1155
|
{
|
|
1156
|
-
"name": "
|
|
1157
|
-
"attribute": "padding",
|
|
1156
|
+
"name": "paddingType",
|
|
1157
|
+
"attribute": "padding-type",
|
|
1158
1158
|
"description": "Horizontal padding of the panel",
|
|
1159
1159
|
"type": "'default'|'large'",
|
|
1160
1160
|
"default": "\"\\\"default\\\"\""
|
|
@@ -9498,6 +9498,12 @@
|
|
|
9498
9498
|
"type": "boolean",
|
|
9499
9499
|
"default": "false"
|
|
9500
9500
|
}
|
|
9501
|
+
],
|
|
9502
|
+
"events": [
|
|
9503
|
+
{
|
|
9504
|
+
"name": "d2l-object-property-list-item-visibility-change",
|
|
9505
|
+
"description": "Dispatched when the visibility of the item changes"
|
|
9506
|
+
}
|
|
9501
9507
|
]
|
|
9502
9508
|
},
|
|
9503
9509
|
{
|
|
@@ -9542,6 +9548,12 @@
|
|
|
9542
9548
|
"type": "boolean",
|
|
9543
9549
|
"default": "false"
|
|
9544
9550
|
}
|
|
9551
|
+
],
|
|
9552
|
+
"events": [
|
|
9553
|
+
{
|
|
9554
|
+
"name": "d2l-object-property-list-item-visibility-change",
|
|
9555
|
+
"description": "Dispatched when the visibility of the item changes"
|
|
9556
|
+
}
|
|
9545
9557
|
]
|
|
9546
9558
|
},
|
|
9547
9559
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.80.
|
|
3
|
+
"version": "2.80.4",
|
|
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",
|