@brightspace-ui/core 3.103.1 → 3.105.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/components/dialog/demo/dialog.html +33 -0
- package/components/dialog/dialog-mixin.js +5 -1
- package/components/dialog/dialog-styles.js +1 -1
- package/components/inputs/demo/input-checkbox.html +8 -1
- package/components/inputs/docs/input-checkbox.md +4 -0
- package/components/inputs/input-checkbox.js +24 -3
- package/custom-elements.json +43 -0
- package/package.json +1 -1
@@ -15,6 +15,7 @@
|
|
15
15
|
import '../../filter/filter.js';
|
16
16
|
import '../../filter/filter-dimension-set.js';
|
17
17
|
import '../../filter/filter-dimension-set-value.js';
|
18
|
+
import '../../inputs/input-checkbox.js';
|
18
19
|
import '../../list/demo/demo-list.js';
|
19
20
|
import '../dialog.js';
|
20
21
|
import './dialog-async-content.js';
|
@@ -296,6 +297,38 @@
|
|
296
297
|
</template>
|
297
298
|
</d2l-demo-snippet>
|
298
299
|
|
300
|
+
<h2>Dialog (no content scrolling)</h2>
|
301
|
+
|
302
|
+
<d2l-demo-snippet>
|
303
|
+
<template>
|
304
|
+
<d2l-button id="openNoScrollDialog">Show Dialog</d2l-button>
|
305
|
+
<d2l-dialog id="noScrollDialog" title-text="Dialog Title">
|
306
|
+
<d2l-input-checkbox id="noScroll">Show extra paragraphs</d2l-input-checkbox>
|
307
|
+
<div>
|
308
|
+
<p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
|
309
|
+
<p id="p2" style="display: none;">Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
|
310
|
+
<p id="p3" style="display: none;">Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
|
311
|
+
</div>
|
312
|
+
<d2l-button slot="footer" primary data-dialog-action="ok">Click Me!</d2l-button>
|
313
|
+
<d2l-button slot="footer" data-dialog-action>Cancel</d2l-button>
|
314
|
+
</d2l-dialog>
|
315
|
+
<script>
|
316
|
+
document.querySelector('#noScroll').addEventListener('change', async(e) => {
|
317
|
+
const dialog = document.querySelector('#noScrollDialog');
|
318
|
+
dialog.noContentScroll = true;
|
319
|
+
const display = e.target.checked ? 'block' : 'none';
|
320
|
+
dialog.querySelector('#p2').style.display = display;
|
321
|
+
dialog.querySelector('#p3').style.display = display;
|
322
|
+
await dialog.resize();
|
323
|
+
dialog.noContentScroll = false;
|
324
|
+
});
|
325
|
+
document.querySelector('#openNoScrollDialog').addEventListener('click', () => {
|
326
|
+
document.querySelector('#noScrollDialog').opened = true;
|
327
|
+
});
|
328
|
+
</script>
|
329
|
+
</template>
|
330
|
+
</d2l-demo-snippet>
|
331
|
+
|
299
332
|
</d2l-demo-page>
|
300
333
|
</body>
|
301
334
|
</html>
|
@@ -41,7 +41,10 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
41
41
|
* Whether or not the dialog is open
|
42
42
|
*/
|
43
43
|
opened: { type: Boolean, reflect: true },
|
44
|
-
|
44
|
+
/**
|
45
|
+
* ADVANCED: Opt out of dialog content scrolling
|
46
|
+
*/
|
47
|
+
noContentScroll: { type: Boolean, attribute: 'no-content-scroll', reflect: true },
|
45
48
|
/**
|
46
49
|
* The optional title for the dialog
|
47
50
|
*/
|
@@ -68,6 +71,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
68
71
|
constructor() {
|
69
72
|
super();
|
70
73
|
this.focusableContentElemPresent = false;
|
74
|
+
this.noContentScroll = false;
|
71
75
|
this.opened = false;
|
72
76
|
this._autoSize = true;
|
73
77
|
this._dialogId = getUniqueId();
|
@@ -55,9 +55,16 @@
|
|
55
55
|
</template>
|
56
56
|
</d2l-demo-snippet>
|
57
57
|
|
58
|
-
<h2>Checkbox with label and
|
58
|
+
<h2>Checkbox with label and supporting content</h2>
|
59
59
|
<d2l-demo-snippet>
|
60
60
|
<template>
|
61
|
+
<d2l-input-checkbox>
|
62
|
+
Label for checkbox
|
63
|
+
<div slot="supporting" style="color: #999999;">
|
64
|
+
Additional content can go here and will<br>
|
65
|
+
also line up nicely with the checkbox.
|
66
|
+
</div>
|
67
|
+
</d2l-input-checkbox>
|
61
68
|
<d2l-input-checkbox>Label for checkbox</d2l-input-checkbox>
|
62
69
|
<d2l-input-checkbox-spacer style="color: #999999;">
|
63
70
|
Additional content can go here and will<br>
|
@@ -77,6 +77,7 @@ checkbox.addEventListener('change', (e) => {
|
|
77
77
|
|
78
78
|
* `default`: Primary text that will appear next to the input box and function as the label for the checkbox.
|
79
79
|
* `inline-help`: Help text that will appear below the input. Use this only when other helpful cues are not sufficient, such as a carefully-worded label.
|
80
|
+
* `supporting`: Supporting information which will appear below and be aligned with the checkbox.
|
80
81
|
<!-- docs: end hidden content -->
|
81
82
|
|
82
83
|
### Methods
|
@@ -85,6 +86,9 @@ checkbox.addEventListener('change', (e) => {
|
|
85
86
|
|
86
87
|
## Checkbox Spacer [d2l-input-checkbox-spacer]
|
87
88
|
|
89
|
+
> [!NOTE]
|
90
|
+
> Spacer is obsolete. Use the `supporting` slot instead.
|
91
|
+
|
88
92
|
To align related content below checkboxes, the `d2l-input-checkbox-spacer` element can be used:
|
89
93
|
|
90
94
|
<!-- docs: demo code display:block -->
|
@@ -63,6 +63,7 @@ export const checkboxStyles = css`
|
|
63
63
|
* A component that can be used to show a checkbox and optional visible label.
|
64
64
|
* @slot - Checkbox information (e.g., text)
|
65
65
|
* @slot inline-help - Help text that will appear below the input. Use this only when other helpful cues are not sufficient, such as a carefully-worded label.
|
66
|
+
* @slot supporting - Supporting information which will appear below and be aligned with the checkbox.
|
66
67
|
* @fires change - Dispatched when the checkbox's state changes
|
67
68
|
*/
|
68
69
|
class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitElement))) {
|
@@ -114,6 +115,7 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
|
|
114
115
|
* @type {string}
|
115
116
|
*/
|
116
117
|
value: { type: String },
|
118
|
+
_hasSupporting: { state: true },
|
117
119
|
_isHovered: { state: true },
|
118
120
|
};
|
119
121
|
}
|
@@ -123,7 +125,6 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
|
|
123
125
|
css`
|
124
126
|
:host {
|
125
127
|
display: block;
|
126
|
-
line-height: ${cssSizes.inputBoxSize}rem;
|
127
128
|
margin-bottom: 0.9rem;
|
128
129
|
}
|
129
130
|
:host([hidden]) {
|
@@ -135,6 +136,7 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
|
|
135
136
|
}
|
136
137
|
label {
|
137
138
|
display: flex;
|
139
|
+
line-height: ${cssSizes.inputBoxSize}rem;
|
138
140
|
overflow-wrap: anywhere;
|
139
141
|
}
|
140
142
|
.d2l-input-checkbox-wrapper {
|
@@ -156,7 +158,8 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
|
|
156
158
|
bottom: 0.3rem;
|
157
159
|
top: 0.3rem;
|
158
160
|
}
|
159
|
-
.d2l-input-inline-help
|
161
|
+
.d2l-input-inline-help,
|
162
|
+
.d2l-input-checkbox-supporting {
|
160
163
|
margin-inline-start: ${cssSizes.inputBoxSize + cssSizes.checkboxMargin}rem;
|
161
164
|
}
|
162
165
|
.d2l-input-checkbox-text-disabled {
|
@@ -168,6 +171,13 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
|
|
168
171
|
input[type="checkbox"].d2l-input-checkbox {
|
169
172
|
vertical-align: top;
|
170
173
|
}
|
174
|
+
.d2l-input-checkbox-supporting {
|
175
|
+
display: none;
|
176
|
+
margin-block: 0.9rem;
|
177
|
+
}
|
178
|
+
.d2l-input-checkbox-supporting-visible {
|
179
|
+
display: block;
|
180
|
+
}
|
171
181
|
`
|
172
182
|
];
|
173
183
|
}
|
@@ -180,6 +190,7 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
|
|
180
190
|
this.name = '';
|
181
191
|
this.notTabbable = false;
|
182
192
|
this.value = 'on';
|
193
|
+
this._hasSupporting = false;
|
183
194
|
this._isHovered = false;
|
184
195
|
}
|
185
196
|
|
@@ -189,6 +200,10 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
|
|
189
200
|
|
190
201
|
render() {
|
191
202
|
const tabindex = this.notTabbable ? -1 : undefined;
|
203
|
+
const supportingClasses = {
|
204
|
+
'd2l-input-checkbox-supporting': true,
|
205
|
+
'd2l-input-checkbox-supporting-visible': this._hasSupporting
|
206
|
+
};
|
192
207
|
const textClasses = {
|
193
208
|
'd2l-input-checkbox-text': true,
|
194
209
|
'd2l-skeletize': true,
|
@@ -221,8 +236,9 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
|
|
221
236
|
.value="${this.value}"></span><span class="${classMap(textClasses)}"><slot></slot></span>
|
222
237
|
</label>
|
223
238
|
${this._renderInlineHelp(this.#inlineHelpId)}
|
224
|
-
|
239
|
+
${offscreenContainer}
|
225
240
|
${disabledTooltip}
|
241
|
+
<div class="${classMap(supportingClasses)}"><slot name="supporting" @slotchange="${this.#handleSupportingSlotChange}"></slot></div>
|
226
242
|
`;
|
227
243
|
}
|
228
244
|
|
@@ -260,5 +276,10 @@ class InputCheckbox extends InputInlineHelpMixin(FocusMixin(SkeletonMixin(LitEle
|
|
260
276
|
this._isHovered = false;
|
261
277
|
}
|
262
278
|
|
279
|
+
#handleSupportingSlotChange(e) {
|
280
|
+
const content = e.target.assignedNodes({ flatten: true });
|
281
|
+
this._hasSupporting = content?.length > 0;
|
282
|
+
}
|
283
|
+
|
263
284
|
}
|
264
285
|
customElements.define('d2l-input-checkbox', InputCheckbox);
|
package/custom-elements.json
CHANGED
@@ -2072,6 +2072,12 @@
|
|
2072
2072
|
"description": "The optional title for the dialog",
|
2073
2073
|
"type": "string"
|
2074
2074
|
},
|
2075
|
+
{
|
2076
|
+
"name": "no-content-scroll",
|
2077
|
+
"description": "ADVANCED: Opt out of dialog content scrolling",
|
2078
|
+
"type": "boolean",
|
2079
|
+
"default": "false"
|
2080
|
+
},
|
2075
2081
|
{
|
2076
2082
|
"name": "opened",
|
2077
2083
|
"description": "Whether or not the dialog is open",
|
@@ -2104,6 +2110,13 @@
|
|
2104
2110
|
"type": "boolean",
|
2105
2111
|
"default": "false"
|
2106
2112
|
},
|
2113
|
+
{
|
2114
|
+
"name": "noContentScroll",
|
2115
|
+
"attribute": "no-content-scroll",
|
2116
|
+
"description": "ADVANCED: Opt out of dialog content scrolling",
|
2117
|
+
"type": "boolean",
|
2118
|
+
"default": "false"
|
2119
|
+
},
|
2107
2120
|
{
|
2108
2121
|
"name": "opened",
|
2109
2122
|
"attribute": "opened",
|
@@ -2161,6 +2174,12 @@
|
|
2161
2174
|
"description": "REQUIRED: the title for the dialog",
|
2162
2175
|
"type": "string"
|
2163
2176
|
},
|
2177
|
+
{
|
2178
|
+
"name": "no-content-scroll",
|
2179
|
+
"description": "ADVANCED: Opt out of dialog content scrolling",
|
2180
|
+
"type": "boolean",
|
2181
|
+
"default": "false"
|
2182
|
+
},
|
2164
2183
|
{
|
2165
2184
|
"name": "opened",
|
2166
2185
|
"description": "Whether or not the dialog is open",
|
@@ -2210,6 +2229,13 @@
|
|
2210
2229
|
"type": "boolean",
|
2211
2230
|
"default": "false"
|
2212
2231
|
},
|
2232
|
+
{
|
2233
|
+
"name": "noContentScroll",
|
2234
|
+
"attribute": "no-content-scroll",
|
2235
|
+
"description": "ADVANCED: Opt out of dialog content scrolling",
|
2236
|
+
"type": "boolean",
|
2237
|
+
"default": "false"
|
2238
|
+
},
|
2213
2239
|
{
|
2214
2240
|
"name": "opened",
|
2215
2241
|
"attribute": "opened",
|
@@ -2283,6 +2309,12 @@
|
|
2283
2309
|
"description": "REQUIRED: the title for the dialog",
|
2284
2310
|
"type": "string"
|
2285
2311
|
},
|
2312
|
+
{
|
2313
|
+
"name": "no-content-scroll",
|
2314
|
+
"description": "ADVANCED: Opt out of dialog content scrolling",
|
2315
|
+
"type": "boolean",
|
2316
|
+
"default": "false"
|
2317
|
+
},
|
2286
2318
|
{
|
2287
2319
|
"name": "opened",
|
2288
2320
|
"description": "Whether or not the dialog is open",
|
@@ -2346,6 +2378,13 @@
|
|
2346
2378
|
"type": "boolean",
|
2347
2379
|
"default": "false"
|
2348
2380
|
},
|
2381
|
+
{
|
2382
|
+
"name": "noContentScroll",
|
2383
|
+
"attribute": "no-content-scroll",
|
2384
|
+
"description": "ADVANCED: Opt out of dialog content scrolling",
|
2385
|
+
"type": "boolean",
|
2386
|
+
"default": "false"
|
2387
|
+
},
|
2349
2388
|
{
|
2350
2389
|
"name": "opened",
|
2351
2390
|
"attribute": "opened",
|
@@ -5184,6 +5223,10 @@
|
|
5184
5223
|
{
|
5185
5224
|
"name": "inline-help",
|
5186
5225
|
"description": "Help text that will appear below the input. Use this only when other helpful cues are not sufficient, such as a carefully-worded label."
|
5226
|
+
},
|
5227
|
+
{
|
5228
|
+
"name": "supporting",
|
5229
|
+
"description": "Supporting information which will appear below and be aligned with the checkbox."
|
5187
5230
|
}
|
5188
5231
|
]
|
5189
5232
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.105.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",
|