@justeattakeaway/pie-radio-group 1.2.1 → 1.2.3
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/README.md +2 -34
- package/dist/index.js +7 -7
- package/package.json +5 -5
- package/src/radio-group.scss +0 -4
package/README.md
CHANGED
|
@@ -118,41 +118,9 @@ import { PieFormLabel } from '@justeattakeaway/pie-webc/react/form-label.js';
|
|
|
118
118
|
|
|
119
119
|
### List items in a radio group
|
|
120
120
|
|
|
121
|
-
For a list-style layout (each option on its own row with primary and secondary text, and dividers between rows), wrap each `pie-radio` in a
|
|
121
|
+
For a list-style layout (each option on its own row with primary and secondary text, and dividers between rows), wrap each `pie-radio` in a `pie-list-item` with `interactionType="radio"` and place them inside the group. The radio goes in the item's `leading` (or `trailing`) slot, and you provide the label through the item's `primaryText` rather than as the radio's content.
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
- the item takes a `presentation` role, so the group still owns its `radio` children directly;
|
|
126
|
-
- the item's `primaryText` becomes the radio's accessible name (`aria-label`), and its `secondaryText` and `metaText` its `aria-description`, so you do not pass label text to the radio itself;
|
|
127
|
-
- the visible item text is hidden from assistive technology so it is not announced twice;
|
|
128
|
-
- clicking anywhere on a row selects that row's radio.
|
|
129
|
-
|
|
130
|
-
Keyboard navigation, focus management and selection are identical to a standard radio group.
|
|
131
|
-
|
|
132
|
-
```js
|
|
133
|
-
import '@justeattakeaway/pie-webc/components/radio-group.js';
|
|
134
|
-
import '@justeattakeaway/pie-webc/components/radio.js';
|
|
135
|
-
import '@justeattakeaway/pie-webc/components/form-label.js';
|
|
136
|
-
import '@justeattakeaway/pie-webc/components/list-item.js';
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
```html
|
|
140
|
-
<pie-radio-group name="delivery">
|
|
141
|
-
<pie-form-label slot="label">Delivery method</pie-form-label>
|
|
142
|
-
<pie-list-item selection-type="radio" primaryText="Standard delivery" secondaryText="3 to 5 working days" metaText="Free">
|
|
143
|
-
<pie-radio slot="leading" value="standard"></pie-radio>
|
|
144
|
-
</pie-list-item>
|
|
145
|
-
<pie-list-item selection-type="radio" primaryText="Express delivery" secondaryText="Next working day" metaText="£4.99">
|
|
146
|
-
<pie-radio slot="leading" value="express"></pie-radio>
|
|
147
|
-
</pie-list-item>
|
|
148
|
-
<pie-list-item selection-type="radio" disabled primaryText="Collection" secondaryText="Collect from a nearby store">
|
|
149
|
-
<pie-radio slot="leading" value="collection" disabled></pie-radio>
|
|
150
|
-
</pie-list-item>
|
|
151
|
-
<pie-list-item selection-type="radio" primaryText="Locker" secondaryText="Pick up from a parcel locker" metaText="£1.99">
|
|
152
|
-
<pie-radio slot="leading" value="locker"></pie-radio>
|
|
153
|
-
</pie-list-item>
|
|
154
|
-
</pie-radio-group>
|
|
155
|
-
```
|
|
123
|
+
For full usage details and code examples, see the [`pie-list` documentation](https://webc.pie.design/?path=/docs/components-list--overview).
|
|
156
124
|
|
|
157
125
|
## Questions and Support
|
|
158
126
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement as x, isServer as C, html as p, nothing as
|
|
1
|
+
import { LitElement as x, isServer as C, html as p, nothing as g, unsafeCSS as y } from "lit";
|
|
2
2
|
import { state as _, property as u } from "lit/decorators.js";
|
|
3
3
|
import { FormControlMixin as w, RtlMixin as T, parentDisabledContext as R, wrapNativeEvent as S, validPropertyValues as E, safeCustomElement as I } from "@justeattakeaway/pie-webc-core";
|
|
4
4
|
import { ifDefined as L } from "lit/directives/if-defined.js";
|
|
@@ -9,7 +9,7 @@ const b = class b extends x {
|
|
|
9
9
|
this.getAttribute("v") || this.setAttribute("v", b.v);
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
b.v = "1.2.
|
|
12
|
+
b.v = "1.2.3";
|
|
13
13
|
let f = b;
|
|
14
14
|
/**
|
|
15
15
|
* @license
|
|
@@ -85,7 +85,7 @@ class F extends D {
|
|
|
85
85
|
this.host.dispatchEvent(new N(this.context, this.host));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
const P = "*,*:after,*:before{box-sizing:inherit}:host{display:block}
|
|
88
|
+
const P = "*,*:after,*:before{box-sizing:inherit}:host{display:block}.c-radioGroup{--radio-group-gap: var(--dt-spacing-c);--radio-group-gap--inline: var(--dt-spacing-c) var(--dt-spacing-e);margin:0;padding:0;border:0;min-width:0;display:flex;flex-flow:column wrap}.c-radioGroup>legend{margin-block-end:var(--dt-spacing-b)}.c-radioGroup.c-radioGroup--inline{flex-flow:row wrap;gap:var(--radio-group-gap--inline)}.c-radioGroup.c-radioGroup--hasAssistiveText{margin-block-end:var(--dt-spacing-a)}.c-radioGroup:not(.c-radioGroup--inline) ::slotted(pie-radio:not(:first-of-type)){margin-block-start:var(--radio-group-gap)}", G = ["default", "success", "error"], $ = "pie-radio-group-disabled", c = {
|
|
89
89
|
status: "default",
|
|
90
90
|
disabled: !1,
|
|
91
91
|
isInline: !1,
|
|
@@ -96,7 +96,7 @@ var k = Object.defineProperty, B = Object.getOwnPropertyDescriptor, d = (t, e, s
|
|
|
96
96
|
(a = t[r]) && (o = (i ? a(e, s, o) : a(o)) || o);
|
|
97
97
|
return i && o && k(e, s, o), o;
|
|
98
98
|
};
|
|
99
|
-
const q = "pie-radio-group",
|
|
99
|
+
const q = "pie-radio-group", m = "assistive-text";
|
|
100
100
|
let l = class extends w(T(f)) {
|
|
101
101
|
constructor() {
|
|
102
102
|
super(...arguments), this._hasLabel = !1, this._fieldSetTabIndex = 0, this._allRadiosDisabled = !1, this.value = c.value, this.isInline = c.isInline, this.disabled = c.disabled, this._disabledProvider = C ? void 0 : new F(this, { context: R, initialValue: c.disabled }), this.status = c.status;
|
|
@@ -320,18 +320,18 @@ let l = class extends w(T(f)) {
|
|
|
320
320
|
name=${L(t)}
|
|
321
321
|
?disabled=${s}
|
|
322
322
|
data-test-id="pie-radio-group-fieldset"
|
|
323
|
-
aria-describedby=${n ?
|
|
323
|
+
aria-describedby=${n ? m : g}
|
|
324
324
|
class="${O(h)}">
|
|
325
325
|
${this._renderWrappedLabel()}
|
|
326
326
|
<slot @slotchange=${this._handleRadioSlotChange}></slot>
|
|
327
327
|
</fieldset>
|
|
328
328
|
${n ? p`
|
|
329
329
|
<pie-assistive-text
|
|
330
|
-
id=${
|
|
330
|
+
id=${m}
|
|
331
331
|
variant=${i}
|
|
332
332
|
message=${o}
|
|
333
333
|
data-test-id="pie-radio-group-assistive-text">
|
|
334
|
-
</pie-assistive-text>` :
|
|
334
|
+
</pie-assistive-text>` : g}
|
|
335
335
|
`;
|
|
336
336
|
}
|
|
337
337
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-radio-group",
|
|
3
3
|
"description": "PIE Design System Radio Group built using Web Components",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.3",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/justeattakeaway/pie",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"license": "Apache-2.0",
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@justeattakeaway/pie-components-config": "0.21.3",
|
|
47
|
-
"@justeattakeaway/pie-css": "1.3.
|
|
47
|
+
"@justeattakeaway/pie-css": "1.3.3",
|
|
48
48
|
"@justeattakeaway/pie-monorepo-utils": "0.9.8",
|
|
49
|
-
"@justeattakeaway/pie-radio": "1.2.
|
|
49
|
+
"@justeattakeaway/pie-radio": "1.2.1"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@justeattakeaway/pie-assistive-text": "1.0.
|
|
53
|
-
"@justeattakeaway/pie-webc-core": "16.1.
|
|
52
|
+
"@justeattakeaway/pie-assistive-text": "1.0.7",
|
|
53
|
+
"@justeattakeaway/pie-webc-core": "16.1.1",
|
|
54
54
|
"@lit/context": "1.1.6"
|
|
55
55
|
},
|
|
56
56
|
"customElements": "custom-elements.json",
|
package/src/radio-group.scss
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
|
-
|
|
6
|
-
// Applies the divider between adjacent `pie-list-item`s when radios are wrapped in them.
|
|
7
|
-
// Direct-child radios are unaffected (the selector only matches `pie-list-item`).
|
|
8
|
-
@include p.list-item-divider;
|
|
9
5
|
}
|
|
10
6
|
|
|
11
7
|
.c-radioGroup {
|