@brightspace-ui/core 3.196.0 → 3.197.1
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.
|
@@ -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)}"
|
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/lang/vi.js
CHANGED
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
=0 {Chưa áp dụng bộ lọc nào.}
|
|
29
29
|
other {{number} bộ lọc đã áp dụng.}
|
|
30
30
|
}`,
|
|
31
|
-
"components.filter.filters": "
|
|
31
|
+
"components.filter.filters": "Bộ lọc",
|
|
32
32
|
"components.filter.loading": "Đang tải các bộ lọc",
|
|
33
33
|
"components.filter.noFilters": "Không có bộ lọc nào khả dụng",
|
|
34
34
|
"components.filter.searchResults":
|
|
@@ -164,7 +164,7 @@ export default {
|
|
|
164
164
|
other {Vô hiệu hóa khi chọn nhiều hơn {countFormatted} mục}
|
|
165
165
|
}`,
|
|
166
166
|
"components.selection.action-required-hint": "Chọn một mục để thực hiện tác vụ này",
|
|
167
|
-
"components.selection.select-all": "Chọn
|
|
167
|
+
"components.selection.select-all": "Chọn Tất cả",
|
|
168
168
|
"components.selection.select-all-items":
|
|
169
169
|
`{count, plural,
|
|
170
170
|
=1 {Chọn mục}
|
|
@@ -188,17 +188,17 @@ export default {
|
|
|
188
188
|
other {Sắp xếp từ cũ đến mới}
|
|
189
189
|
}}
|
|
190
190
|
numbers {{direction, select,
|
|
191
|
-
desc {
|
|
192
|
-
other {
|
|
191
|
+
desc {Sắp xếp từ cao đến thấp}
|
|
192
|
+
other {Sắp xếp từ thấp đến cao}
|
|
193
193
|
}}
|
|
194
194
|
words {{direction, select,
|
|
195
|
-
desc {
|
|
196
|
-
other {
|
|
195
|
+
desc {Sắp xếp từ Z đến A}
|
|
196
|
+
other {Sắp xếp theo thứ tự A đến Z}
|
|
197
197
|
}}
|
|
198
|
-
value {
|
|
198
|
+
value {Đã sắp xếp {selectedMenuItemText}}
|
|
199
199
|
other {{direction, select,
|
|
200
|
-
desc {
|
|
201
|
-
other {
|
|
200
|
+
desc {Sắp xếp giảm dần}
|
|
201
|
+
other {Sắp xếp tăng dần}
|
|
202
202
|
}}
|
|
203
203
|
}`,
|
|
204
204
|
"components.table-controls.label": "Các tác vụ cho bảng",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.197.1",
|
|
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",
|