@brightspace-ui/core 3.195.0 → 3.197.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/inputs/demo/input-radio.html +14 -0
- package/components/inputs/docs/input-radio.md +1 -0
- package/components/inputs/input-radio-group.js +16 -0
- package/components/inputs/input-radio.js +7 -1
- package/components/list/demo/list-layout.html +41 -0
- package/components/list/list.js +9 -0
- package/custom-elements.json +13 -0
- package/package.json +1 -1
|
@@ -100,6 +100,20 @@
|
|
|
100
100
|
<d2l-test-input-radio-label></d2l-test-input-radio-label>
|
|
101
101
|
</d2l-demo-snippet>
|
|
102
102
|
|
|
103
|
+
<h2>Horizontal Layout</h2>
|
|
104
|
+
<d2l-demo-snippet>
|
|
105
|
+
<d2l-input-radio-group horizontal label="Bread">
|
|
106
|
+
<d2l-input-radio label="Super long label that extends and forces wrapping"></d2l-input-radio>
|
|
107
|
+
<d2l-input-radio style="max-width: 200px;" label="Super long label that extends and forces wrapping with max width"></d2l-input-radio>
|
|
108
|
+
<d2l-input-radio label="Whole wheat"></d2l-input-radio>
|
|
109
|
+
<d2l-input-radio label="Baguette"></d2l-input-radio>
|
|
110
|
+
<d2l-input-radio label="Marble Rye"></d2l-input-radio>
|
|
111
|
+
<d2l-input-radio label="Other" checked supporting-hidden-when-unchecked>
|
|
112
|
+
<d2l-input-text label="Other" label-hidden value="Sourdough" slot="supporting"></d2l-input-text>
|
|
113
|
+
</d2l-input-radio>
|
|
114
|
+
</d2l-input-radio-group>
|
|
115
|
+
</d2l-demo-snippet>
|
|
116
|
+
|
|
103
117
|
</d2l-demo-page>
|
|
104
118
|
</body>
|
|
105
119
|
</html>
|
|
@@ -52,6 +52,7 @@ When provided with a `name`, the group will participate in forms with the `value
|
|
|
52
52
|
|
|
53
53
|
| Property | Type | Description |
|
|
54
54
|
|---|---|---|
|
|
55
|
+
| `horizontal` | Boolean | Display the radio buttons horizontally |
|
|
55
56
|
| `label` | String, required | Label for the group of radio inputs |
|
|
56
57
|
| `label-hidden` | Boolean | Hides the label visually |
|
|
57
58
|
| `name` | String | Name of the form control. Submitted with the form as part of a name/value pair. |
|
|
@@ -15,6 +15,11 @@ class InputRadioGroup extends PropertyRequiredMixin(SkeletonMixin(FormElementMix
|
|
|
15
15
|
|
|
16
16
|
static get properties() {
|
|
17
17
|
return {
|
|
18
|
+
/**
|
|
19
|
+
* Display the radio buttons horizontally
|
|
20
|
+
* @type {boolean}
|
|
21
|
+
*/
|
|
22
|
+
horizontal: { type: Boolean, reflect: true },
|
|
18
23
|
/**
|
|
19
24
|
* REQUIRED: Label for the group of radio inputs
|
|
20
25
|
* @type {string}
|
|
@@ -46,6 +51,11 @@ class InputRadioGroup extends PropertyRequiredMixin(SkeletonMixin(FormElementMix
|
|
|
46
51
|
flex-direction: column;
|
|
47
52
|
gap: 0.6rem;
|
|
48
53
|
}
|
|
54
|
+
:host([horizontal]) div[role="radiogroup"] {
|
|
55
|
+
flex-direction: row;
|
|
56
|
+
flex-wrap: wrap;
|
|
57
|
+
}
|
|
58
|
+
|
|
49
59
|
.d2l-input-label[hidden] {
|
|
50
60
|
display: none;
|
|
51
61
|
}
|
|
@@ -57,6 +67,7 @@ class InputRadioGroup extends PropertyRequiredMixin(SkeletonMixin(FormElementMix
|
|
|
57
67
|
|
|
58
68
|
constructor() {
|
|
59
69
|
super();
|
|
70
|
+
this.horizontal = false;
|
|
60
71
|
this.labelHidden = false;
|
|
61
72
|
this.required = false;
|
|
62
73
|
this.setFormValue('');
|
|
@@ -88,6 +99,10 @@ class InputRadioGroup extends PropertyRequiredMixin(SkeletonMixin(FormElementMix
|
|
|
88
99
|
if (changedProperties.has('required')) {
|
|
89
100
|
this.#recalculateState(true);
|
|
90
101
|
}
|
|
102
|
+
if (changedProperties.has('horizontal')) {
|
|
103
|
+
const radios = this.#getRadios();
|
|
104
|
+
radios.forEach(el => el._horizontal = this.horizontal);
|
|
105
|
+
}
|
|
91
106
|
}
|
|
92
107
|
|
|
93
108
|
focus() {
|
|
@@ -218,6 +233,7 @@ class InputRadioGroup extends PropertyRequiredMixin(SkeletonMixin(FormElementMix
|
|
|
218
233
|
if (el._checked) checkedRadios.push(el);
|
|
219
234
|
el._isInitFromGroup = true;
|
|
220
235
|
el._focusable = false;
|
|
236
|
+
el._horizontal = this.horizontal;
|
|
221
237
|
});
|
|
222
238
|
|
|
223
239
|
// only the last checked radio is actually checked
|
|
@@ -8,6 +8,7 @@ import { InputInlineHelpMixin } from './input-inline-help.js';
|
|
|
8
8
|
import { PropertyRequiredMixin } from '../../mixins/property-required/property-required-mixin.js';
|
|
9
9
|
import { radioStyles } from './input-radio-styles.js';
|
|
10
10
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
|
11
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* A radio input within a <d2l-input-radio-group>.
|
|
@@ -56,6 +57,7 @@ class InputRadio extends InputInlineHelpMixin(SkeletonMixin(FocusMixin(PropertyR
|
|
|
56
57
|
_checked: { state: true },
|
|
57
58
|
_focusable: { state: true },
|
|
58
59
|
_hasSupporting: { state: true },
|
|
60
|
+
_horizontal: { state: true },
|
|
59
61
|
_isHovered: { state: true },
|
|
60
62
|
_invalid: { state: true }
|
|
61
63
|
};
|
|
@@ -95,6 +97,7 @@ class InputRadio extends InputInlineHelpMixin(SkeletonMixin(FocusMixin(PropertyR
|
|
|
95
97
|
this._checked = false;
|
|
96
98
|
this._focusable = false;
|
|
97
99
|
this._hasSupporting = false;
|
|
100
|
+
this._horizontal = false;
|
|
98
101
|
this._isHovered = false;
|
|
99
102
|
this._isInitFromGroup = false;
|
|
100
103
|
this._invalid = false;
|
|
@@ -126,6 +129,9 @@ class InputRadio extends InputInlineHelpMixin(SkeletonMixin(FocusMixin(PropertyR
|
|
|
126
129
|
|
|
127
130
|
render() {
|
|
128
131
|
const allowFocus = !this.focusDisabled && this._focusable;
|
|
132
|
+
const labelStyles = {
|
|
133
|
+
alignItems: this._horizontal ? 'flex-start' : undefined
|
|
134
|
+
};
|
|
129
135
|
const labelClasses = {
|
|
130
136
|
'd2l-input-radio-label': true,
|
|
131
137
|
'd2l-input-radio-label-disabled': this.disabled && !this.skeleton,
|
|
@@ -147,7 +153,7 @@ class InputRadio extends InputInlineHelpMixin(SkeletonMixin(FocusMixin(PropertyR
|
|
|
147
153
|
html`<d2l-tooltip align="start" class="vdiff-target" for="${this.#inputId}" ?force-show="${this._isHovered}" position="top">${this.disabledTooltip}</d2l-tooltip>` :
|
|
148
154
|
nothing;
|
|
149
155
|
return html`
|
|
150
|
-
<div class="${classMap(labelClasses)}" @mouseover="${this.#handleMouseOver}" @mouseout="${this.#handleMouseOut}">
|
|
156
|
+
<div class="${classMap(labelClasses)}" style="${styleMap(labelStyles)}" @mouseover="${this.#handleMouseOver}" @mouseout="${this.#handleMouseOut}">
|
|
151
157
|
<div
|
|
152
158
|
aria-checked="${this._checked}"
|
|
153
159
|
aria-describedby="${ifDefined(ariaDescribedByIds.length > 0 ? ariaDescribedByIds : undefined)}"
|
|
@@ -426,6 +426,47 @@
|
|
|
426
426
|
</template>
|
|
427
427
|
</d2l-demo-snippet>
|
|
428
428
|
|
|
429
|
+
<h2>Tile Breaks</h2>
|
|
430
|
+
|
|
431
|
+
<d2l-demo-snippet>
|
|
432
|
+
<template>
|
|
433
|
+
<d2l-button-toggle pressed>
|
|
434
|
+
<d2l-button-subtle slot="not-pressed" icon="tier1:tile-view" text="Tiles"></d2l-button-subtle>
|
|
435
|
+
<d2l-button-subtle slot="pressed" icon="tier1:list-view" text="List"></d2l-button-subtle>
|
|
436
|
+
</d2l-button-toggle>
|
|
437
|
+
<d2l-list layout="tiles">
|
|
438
|
+
<d2l-list-item label="item 1" key="1">
|
|
439
|
+
<img slot="illustration" src="https://s.brightspace.com/course-images/images/38e839b1-37fa-470c-8830-b189ce4ae134/tile-high-density-max-size.jpg"></img>
|
|
440
|
+
<d2l-list-item-content>
|
|
441
|
+
<div>Identify categories of physical activities</div>
|
|
442
|
+
<div slot="secondary">Secondary Information</div>
|
|
443
|
+
<div slot="supporting-info">Specific Expectation A1.2</div>
|
|
444
|
+
</d2l-list-item-content>
|
|
445
|
+
</d2l-list-item>
|
|
446
|
+
<div class="d2l-list-tile-break"></div>
|
|
447
|
+
<d2l-list-item label="item 2" key="2">
|
|
448
|
+
<img slot="illustration" src="https://s.brightspace.com/course-images/images/e5fd575a-bc14-4a80-89e1-46f349a76178/tile-high-density-max-size.jpg"></img>
|
|
449
|
+
<d2l-list-item-content>
|
|
450
|
+
<div>Apply a decision-making process to assess risks and make safe decisions in a variety of situations</div>
|
|
451
|
+
<div slot="secondary">Secondary Information</div>
|
|
452
|
+
<div slot="supporting-info">Specific Expectation B2.1</div>
|
|
453
|
+
</d2l-list-item-content>
|
|
454
|
+
</d2l-list-item>
|
|
455
|
+
<d2l-list-item label="item 3" key="3">
|
|
456
|
+
<img slot="illustration" src="https://s.brightspace.com/course-images/images/63b162ab-b582-4bf9-8c1d-1dad04714121/tile-high-density-max-size.jpg"></img>
|
|
457
|
+
<d2l-list-item-content>
|
|
458
|
+
<div>Retain objects of various shapes and sizes in different ways, while moving around others and equipment</div>
|
|
459
|
+
<div slot="secondary">Secondary Information</div>
|
|
460
|
+
<div slot="supporting-info">Specific Expectation B2.2</div>
|
|
461
|
+
</d2l-list-item-content>
|
|
462
|
+
</d2l-list-item>
|
|
463
|
+
</d2l-list>
|
|
464
|
+
<script data-demo-hide>
|
|
465
|
+
(demo => window.wireupListTileToggle(demo))(document.currentScript.parentNode);
|
|
466
|
+
</script>
|
|
467
|
+
</template>
|
|
468
|
+
</d2l-demo-snippet>
|
|
469
|
+
|
|
429
470
|
</d2l-demo-page>
|
|
430
471
|
</body>
|
|
431
472
|
</html>
|
package/components/list/list.js
CHANGED
|
@@ -146,6 +146,15 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
|
|
|
146
146
|
:host([add-button]) ::slotted([slot="controls"]) {
|
|
147
147
|
margin-bottom: calc(6px + 0.4rem); /* controls section margin-bottom + spacing for add-button */
|
|
148
148
|
}
|
|
149
|
+
|
|
150
|
+
::slotted(.d2l-list-tile-break) {
|
|
151
|
+
display: none;
|
|
152
|
+
}
|
|
153
|
+
:host([layout="tiles"]) ::slotted(.d2l-list-tile-break) {
|
|
154
|
+
display: block;
|
|
155
|
+
flex-basis: 100%;
|
|
156
|
+
height: 0;
|
|
157
|
+
}
|
|
149
158
|
`;
|
|
150
159
|
}
|
|
151
160
|
|
package/custom-elements.json
CHANGED
|
@@ -7084,6 +7084,12 @@
|
|
|
7084
7084
|
"description": "REQUIRED: Label for the group of radio inputs",
|
|
7085
7085
|
"type": "string"
|
|
7086
7086
|
},
|
|
7087
|
+
{
|
|
7088
|
+
"name": "horizontal",
|
|
7089
|
+
"description": "Display the radio buttons horizontally",
|
|
7090
|
+
"type": "boolean",
|
|
7091
|
+
"default": "false"
|
|
7092
|
+
},
|
|
7087
7093
|
{
|
|
7088
7094
|
"name": "label-hidden",
|
|
7089
7095
|
"description": "Hides the label visually",
|
|
@@ -7114,6 +7120,13 @@
|
|
|
7114
7120
|
"description": "REQUIRED: Label for the group of radio inputs",
|
|
7115
7121
|
"type": "string"
|
|
7116
7122
|
},
|
|
7123
|
+
{
|
|
7124
|
+
"name": "horizontal",
|
|
7125
|
+
"attribute": "horizontal",
|
|
7126
|
+
"description": "Display the radio buttons horizontally",
|
|
7127
|
+
"type": "boolean",
|
|
7128
|
+
"default": "false"
|
|
7129
|
+
},
|
|
7117
7130
|
{
|
|
7118
7131
|
"name": "labelHidden",
|
|
7119
7132
|
"attribute": "label-hidden",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.197.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",
|