@justeattakeaway/pie-list 0.4.0 → 0.6.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/README.md +123 -21
- package/custom-elements.json +53 -6
- package/dist/{PieElement-CGtUo9tK.js → PieElement-wRsAkkYC.js} +1 -1
- package/dist/index-DpLh8onF.js +344 -0
- package/dist/index.js +14 -14
- package/dist/pie-list-item/defs.d.ts +21 -1
- package/dist/pie-list-item/defs.d.ts.map +1 -1
- package/dist/pie-list-item/index.d.ts +25 -14
- package/dist/pie-list-item/index.d.ts.map +1 -1
- package/dist/pie-list-item/index.js +4 -3
- package/dist/pie-list-item/react.js +2 -2
- package/package.json +3 -3
- package/src/list.scss +0 -2
- package/src/pie-list-item/defs.ts +24 -2
- package/src/pie-list-item/index.ts +57 -18
- package/src/pie-list-item/list-item.scss +68 -15
- package/dist/index-BMp2PPeH.js +0 -307
package/README.md
CHANGED
|
@@ -9,9 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
`@justeattakeaway/pie-list` is a Web Component built using the Lit library. It provides a simple, accessible list built from two elements: a `pie-list` container and one or more `pie-list-item` children.
|
|
11
11
|
|
|
12
|
-
> [!NOTE]
|
|
13
|
-
> This component is still growing. More properties, slots and sub-components will be added over time. This documentation covers what is currently supported.
|
|
14
|
-
|
|
15
12
|
## Table of Contents
|
|
16
13
|
|
|
17
14
|
- [Installation](#installation)
|
|
@@ -37,6 +34,8 @@
|
|
|
37
34
|
- [Multi-select (checkboxes)](#multi-select-checkboxes)
|
|
38
35
|
- [Independent toggles (switches)](#independent-toggles-switches)
|
|
39
36
|
- [Link items](#link-items)
|
|
37
|
+
- [Indicating the current page](#indicating-the-current-page)
|
|
38
|
+
- [Button items](#button-items)
|
|
40
39
|
- [Framework variants](#framework-variants)
|
|
41
40
|
- [Usage Notes and Rules](#usage-notes-and-rules)
|
|
42
41
|
- [Questions and Support](#questions-and-support)
|
|
@@ -50,7 +49,7 @@ Ideally, you should install the component using the **`@justeattakeaway/pie-webc
|
|
|
50
49
|
|
|
51
50
|
## Documentation
|
|
52
51
|
|
|
53
|
-
`pie-list` is a compound component. The `pie-list` element is the container (it applies the `list` role
|
|
52
|
+
`pie-list` is a compound component. The `pie-list` element is the container (it applies the `list` role), and each row is a `pie-list-item` (which applies the `listitem` role). Set `hasDivider` on each item that needs a divider except for the last one.
|
|
54
53
|
|
|
55
54
|
> [!IMPORTANT]
|
|
56
55
|
> Because `pie-list` uses the `list` role, you **must always give it an accessible name** using either `aria-label` or `aria-labelledby`. Without one, screen reader users get no context for what the list contains. See [Accessibility](#accessibility).
|
|
@@ -71,8 +70,10 @@ Ideally, you should install the component using the **`@justeattakeaway/pie-webc
|
|
|
71
70
|
| `isCompact` | `true`, `false` | Decreases the item height to save vertical space. See the [rules](#usage-notes-and-rules) below. | `false` |
|
|
72
71
|
| `isBold` | `true`, `false` | Sets the primary text to a bold font-weight. | `false` |
|
|
73
72
|
| `hasMedia` | `true`, `false` | **Required whenever you slot a media element (e.g. `pie-thumbnail`) into the item.** Reduces the block padding so single-line media sits correctly (this padding adjustment has no effect when `secondaryText` is set, but you should still set `hasMedia`). | `false` |
|
|
74
|
-
| `interactionType` | `"none"`, `"radio"`, `"checkbox"`, `"switch"`, `"link"` | Declares how the **whole row** behaves, and drives its role, accessible naming, click forwarding and interactive states from this one prop. `"none"` is a static item; `"radio"`/`"checkbox"`/`"switch"` host the matching control in the `leading`/`trailing` slot; `"link"` turns the row into a single navigation link (slot an empty `<a slot="link" href="...">`). See [Selectable lists](#selectable-lists)
|
|
73
|
+
| `interactionType` | `"none"`, `"radio"`, `"checkbox"`, `"switch"`, `"link"`, `"button"` | Declares how the **whole row** behaves, and drives its role, accessible naming, click forwarding and interactive states from this one prop. `"none"` is a static item; `"radio"`/`"checkbox"`/`"switch"` host the matching control in the `leading`/`trailing` slot; `"link"` turns the row into a single navigation link (slot an empty `<a slot="link" href="...">`); `"button"` turns the row into a single button for an in-page action (the item renders the button for you - listen for `click`). See [Selectable lists](#selectable-lists), [Link items](#link-items) and [Button items](#button-items). | `"none"` |
|
|
75
74
|
| `disabled` | `true`, `false` | Marks the row as disabled: it takes the disabled styling and stops forwarding row clicks to its control. Set it alongside the slotted control's own `disabled` (the control still governs its own interactivity). No visible effect on a non-selectable (static) item. | `false` |
|
|
75
|
+
| `hasDivider` | `true`, `false` | Renders a bottom divider line on the item. Do not set this to `true` on the last item in a list. | `false` |
|
|
76
|
+
| `aria` | `{ button?: { haspopup?: "menu" \| "listbox" \| "tree" \| "grid" \| "dialog" \| "true" } }` | Additional ARIA properties that the item cannot derive from its text props. `button.haspopup` only applies when `interactionType="button"` and is forwarded to the internal `<button>` element. Set it when the button row triggers a popup such as a dialog or menu. | `undefined` |
|
|
76
77
|
|
|
77
78
|
### Slots
|
|
78
79
|
|
|
@@ -118,7 +119,7 @@ This component does not emit any custom events. To listen for interactions, trea
|
|
|
118
119
|
|
|
119
120
|
```html
|
|
120
121
|
<pie-list aria-label="Payment methods">
|
|
121
|
-
<pie-list-item primaryText="Credit card"></pie-list-item>
|
|
122
|
+
<pie-list-item hasDivider primaryText="Credit card"></pie-list-item>
|
|
122
123
|
<pie-list-item primaryText="PayPal"></pie-list-item>
|
|
123
124
|
</pie-list>
|
|
124
125
|
```
|
|
@@ -128,7 +129,7 @@ This component does not emit any custom events. To listen for interactions, trea
|
|
|
128
129
|
```html
|
|
129
130
|
<h2 id="payment-methods-heading">Payment methods</h2>
|
|
130
131
|
<pie-list aria-labelledby="payment-methods-heading">
|
|
131
|
-
<pie-list-item primaryText="Credit card"></pie-list-item>
|
|
132
|
+
<pie-list-item hasDivider primaryText="Credit card"></pie-list-item>
|
|
132
133
|
<pie-list-item primaryText="PayPal"></pie-list-item>
|
|
133
134
|
</pie-list>
|
|
134
135
|
```
|
|
@@ -141,22 +142,22 @@ This component does not emit any custom events. To listen for interactions, trea
|
|
|
141
142
|
Specifically, for **every** interaction type the item takes care of:
|
|
142
143
|
|
|
143
144
|
- the **role** on the item itself (`listitem`, or `presentation` for radio/checkbox rows so the group owns the control directly) - you never write `role="..."`;
|
|
144
|
-
- the **accessible name and description** of whatever it hosts - you never write `aria-label`, `aria-labelledby`, `aria-description` or `aria-describedby` on the control or
|
|
145
|
+
- the **accessible name and description** of whatever it hosts - you never write `aria-label`, `aria-labelledby`, `aria-description` or `aria-describedby` on the control, anchor or button;
|
|
145
146
|
- **hiding the duplicated visible text** from assistive technology (the item `aria-hidden`s its own text once the name/description have been mirrored onto the interactive element), so nothing is announced twice.
|
|
146
147
|
|
|
147
148
|
The one accessibility attribute you **do** own is the accessible name of the `pie-list` container itself (`aria-label` / `aria-labelledby`), because only you know what the list represents. See the note above.
|
|
148
149
|
|
|
149
150
|
### How the naming is derived
|
|
150
151
|
|
|
151
|
-
When a `pie-list-item` hosts an interactive element (a slotted control set via `interactionType="radio" | "checkbox" | "switch"`,
|
|
152
|
+
When a `pie-list-item` hosts an interactive element (a slotted control set via `interactionType="radio" | "checkbox" | "switch"`, a slotted link anchor via `interactionType="link"`, or the button it renders for `interactionType="button"`) it generates that element's accessibility naming from its own text:
|
|
152
153
|
|
|
153
|
-
- `primaryText` becomes the
|
|
154
|
+
- `primaryText` becomes the element's **accessible name**;
|
|
154
155
|
- `secondaryText` and `metaText` become its **accessible description** (combined with a full stop when both are present);
|
|
155
|
-
- the visible text rendered inside the item is `aria-hidden`, so a screen reader announces the name and description once (via the
|
|
156
|
+
- the visible text rendered inside the item is `aria-hidden`, so a screen reader announces the name and description once (via the interactive element) rather than twice.
|
|
156
157
|
|
|
157
|
-
How the naming reaches the element differs by type, but this is entirely internal - you never do it yourself. Selection controls receive it through a shared context and each applies it to the element that carries its role: `pie-radio` names its host, while `pie-checkbox` and `pie-switch` name their internal `input` (their host is role-less). A link anchor is a plain light-DOM element (not a PIE control), so `pie-list-item` sets `aria-label` and `aria-description` on it directly.
|
|
158
|
+
How the naming reaches the element differs by type, but this is entirely internal - you never do it yourself. Selection controls receive it through a shared context and each applies it to the element that carries its role: `pie-radio` names its host, while `pie-checkbox` and `pie-switch` name their internal `input` (their host is role-less). A link anchor is a plain light-DOM element you slot (not a PIE control), so `pie-list-item` sets `aria-label` and `aria-description` on it directly. A `button` row's button is one the item renders itself, so it is named the same way from within the item.
|
|
158
159
|
|
|
159
|
-
**
|
|
160
|
+
**For slotted elements, anything you set yourself wins.** If a slotted control already has its own name (its `label` or `aria` prop), or the slotted link anchor already has an `aria-label`/`aria-labelledby` (or `aria-description`/`aria-describedby`), the item leaves it untouched and does not overwrite it. This is an escape hatch for the rare case that needs it, not something you normally reach for. (A `button` row's button is rendered and named by the item, so there is nothing for you to set.)
|
|
160
161
|
|
|
161
162
|
## Usage Examples
|
|
162
163
|
|
|
@@ -175,10 +176,12 @@ A basic list with primary, secondary and meta text (note the required `aria-labe
|
|
|
175
176
|
```html
|
|
176
177
|
<pie-list aria-label="Recent orders">
|
|
177
178
|
<pie-list-item
|
|
179
|
+
hasDivider
|
|
178
180
|
primaryText="Primary text"
|
|
179
181
|
secondaryText="Secondary text"
|
|
180
182
|
metaText="Meta text"></pie-list-item>
|
|
181
183
|
<pie-list-item
|
|
184
|
+
hasDivider
|
|
182
185
|
primaryText="Primary text"
|
|
183
186
|
secondaryText="Secondary text"></pie-list-item>
|
|
184
187
|
<pie-list-item primaryText="Primary text"></pie-list-item>
|
|
@@ -242,7 +245,7 @@ Reduced height, see [rules](#usage-notes-and-rules):
|
|
|
242
245
|
|
|
243
246
|
```html
|
|
244
247
|
<pie-list>
|
|
245
|
-
<pie-list-item isCompact primaryText="Primary text">
|
|
248
|
+
<pie-list-item hasDivider isCompact primaryText="Primary text">
|
|
246
249
|
<icon-chevron-right slot="trailing"></icon-chevron-right>
|
|
247
250
|
</pie-list-item>
|
|
248
251
|
<pie-list-item isCompact primaryText="Primary text">
|
|
@@ -324,10 +327,10 @@ import '@justeattakeaway/pie-webc/components/list-item.js';
|
|
|
324
327
|
```
|
|
325
328
|
|
|
326
329
|
```html
|
|
327
|
-
<!-- `interactionType="radio"` makes each row selectable
|
|
328
|
-
|
|
330
|
+
<!-- `interactionType="radio"` makes each row selectable. `value` on the group selects
|
|
331
|
+
the matching radio (here, Express). -->
|
|
329
332
|
<pie-radio-group name="delivery" value="express">
|
|
330
|
-
<pie-list-item interactionType="radio" primaryText="Standard delivery" secondaryText="3 to 5 working days" metaText="Free">
|
|
333
|
+
<pie-list-item hasDivider interactionType="radio" primaryText="Standard delivery" secondaryText="3 to 5 working days" metaText="Free">
|
|
331
334
|
<pie-radio slot="leading" value="standard"></pie-radio>
|
|
332
335
|
</pie-list-item>
|
|
333
336
|
<pie-list-item interactionType="radio" primaryText="Express delivery" secondaryText="Next working day" metaText="£4.99">
|
|
@@ -346,7 +349,7 @@ import '@justeattakeaway/pie-webc/components/list-item.js';
|
|
|
346
349
|
|
|
347
350
|
```html
|
|
348
351
|
<pie-checkbox-group>
|
|
349
|
-
<pie-list-item interactionType="checkbox" primaryText="Cheese" secondaryText="Extra mature" metaText="Free">
|
|
352
|
+
<pie-list-item hasDivider interactionType="checkbox" primaryText="Cheese" secondaryText="Extra mature" metaText="Free">
|
|
350
353
|
<pie-checkbox slot="leading" name="cheese"></pie-checkbox>
|
|
351
354
|
</pie-list-item>
|
|
352
355
|
<pie-list-item interactionType="checkbox" primaryText="Pepperoni" secondaryText="Spicy">
|
|
@@ -367,10 +370,10 @@ import '@justeattakeaway/pie-webc/components/switch.js';
|
|
|
367
370
|
|
|
368
371
|
```html
|
|
369
372
|
<pie-list aria-label="Notification settings">
|
|
370
|
-
<pie-list-item interactionType="switch" primaryText="Email" secondaryText="Order updates and receipts">
|
|
373
|
+
<pie-list-item hasDivider interactionType="switch" primaryText="Email" secondaryText="Order updates and receipts">
|
|
371
374
|
<pie-switch slot="trailing"></pie-switch>
|
|
372
375
|
</pie-list-item>
|
|
373
|
-
<pie-list-item interactionType="switch" primaryText="Push notifications">
|
|
376
|
+
<pie-list-item hasDivider interactionType="switch" primaryText="Push notifications">
|
|
374
377
|
<pie-switch slot="trailing"></pie-switch>
|
|
375
378
|
</pie-list-item>
|
|
376
379
|
<pie-list-item interactionType="switch" primaryText="SMS" disabled>
|
|
@@ -394,7 +397,7 @@ import '@justeattakeaway/pie-webc/components/list-item.js';
|
|
|
394
397
|
|
|
395
398
|
```html
|
|
396
399
|
<pie-list aria-label="Manage your restaurant">
|
|
397
|
-
<pie-list-item interactionType="link" primaryText="Orders" secondaryText="View and manage live orders" metaText="12 active">
|
|
400
|
+
<pie-list-item hasDivider interactionType="link" primaryText="Orders" secondaryText="View and manage live orders" metaText="12 active">
|
|
398
401
|
<a slot="link" href="/orders"></a>
|
|
399
402
|
</pie-list-item>
|
|
400
403
|
<pie-list-item interactionType="link" primaryText="Menu" secondaryText="Edit items, prices and photos">
|
|
@@ -415,6 +418,104 @@ import { PieListItem } from '@justeattakeaway/pie-webc/react/list-item.js';
|
|
|
415
418
|
</PieListItem>
|
|
416
419
|
```
|
|
417
420
|
|
|
421
|
+
#### Indicating the current page
|
|
422
|
+
|
|
423
|
+
To highlight the active link in a navigation list, combine `isBold` on the `pie-list-item` with `aria-current="page"` on the slotted anchor. `isBold` gives the active item a heavier weight visually; `aria-current="page"` communicates the current page to assistive technology. `pie-list-item` only manages the anchor's `aria-label` and `aria-description`, so `aria-current` does not conflict with the item's naming logic and is safe to set yourself.
|
|
424
|
+
|
|
425
|
+
You can also slot a tick icon into the `trailing` slot of the active item as an additional visual indicator. PIE icons render with `role="presentation"` on their SVG, so they are already hidden from assistive technology and no extra `aria-hidden` is needed.
|
|
426
|
+
|
|
427
|
+
```js
|
|
428
|
+
import '@justeattakeaway/pie-icons-webc/dist/IconCheck.js';
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
```html
|
|
432
|
+
<pie-list aria-label="Account navigation">
|
|
433
|
+
<pie-list-item hasDivider interactionType="link" primaryText="Overview">
|
|
434
|
+
<a slot="link" href="/account"></a>
|
|
435
|
+
</pie-list-item>
|
|
436
|
+
<pie-list-item hasDivider interactionType="link" isBold primaryText="Orders">
|
|
437
|
+
<a slot="link" href="/account/orders" aria-current="page"></a>
|
|
438
|
+
<icon-check slot="trailing"></icon-check>
|
|
439
|
+
</pie-list-item>
|
|
440
|
+
<pie-list-item hasDivider interactionType="link" primaryText="Payment methods">
|
|
441
|
+
<a slot="link" href="/account/payment"></a>
|
|
442
|
+
</pie-list-item>
|
|
443
|
+
<pie-list-item interactionType="link" primaryText="Addresses">
|
|
444
|
+
<a slot="link" href="/account/addresses"></a>
|
|
445
|
+
</pie-list-item>
|
|
446
|
+
</pie-list>
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
In React, pass `isBold` as a prop and `aria-current="page"` directly to the `<Link>` component (or raw anchor):
|
|
450
|
+
|
|
451
|
+
```jsx
|
|
452
|
+
import { IconCheck } from '@justeattakeaway/pie-icons-webc/dist/IconCheck.js';
|
|
453
|
+
|
|
454
|
+
<PieListItem interactionType="link" isBold primaryText="Orders">
|
|
455
|
+
<Link slot="link" href="/account/orders" aria-current="page" />
|
|
456
|
+
<IconCheck slot="trailing" />
|
|
457
|
+
</PieListItem>
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Button items
|
|
461
|
+
|
|
462
|
+
Set `interactionType="button"` to turn the whole row into one button. Use this for an **in-page action** (opening a dialog, running a command); use [`link`](#link-items) when the row navigates to another page. Unlike a link, **you do not slot anything** - the item renders the interactive element for you: an invisible, row-sized native `<button type="button">` stretched over the row. A click or tap anywhere on the row activates it, and keyboard focus lands on the row as a whole (the focus ring hugs the row). It is just an action trigger, **not a form control** - it is `type="button"`, so it never submits a form, and it carries no value.
|
|
463
|
+
|
|
464
|
+
The item names the button from its own text: `primaryText` becomes the button's `aria-label` and `secondaryText`/`metaText` its `aria-description`, and the visible text is hidden from assistive technology so nothing is announced twice (see [You never set ARIA on a list item or its slotted content](#you-never-set-aria-on-a-list-item-or-its-slotted-content)).
|
|
465
|
+
|
|
466
|
+
**Handle activation by listening for `click`** on the `pie-list-item` (or on the `pie-list`, since the event bubbles). Because it is a real `<button>`, activation is native: both pointer taps and keyboard (Enter, and Space) fire a `click`, so a single `click` listener covers every input. The row shows a pressed tint while it is pressed - by pointer, or while Space is held on the focused row - and the focus ring on keyboard focus. Give the `pie-list` its own accessible name (e.g. `aria-label`).
|
|
467
|
+
|
|
468
|
+
**When the button opens a popup (dialog, menu, etc.)**, pass the `aria` prop with `button.haspopup` set to the popup type. This is forwarded to the internal `<button>` so assistive technology announces it correctly:
|
|
469
|
+
|
|
470
|
+
```html
|
|
471
|
+
<!-- A row that opens a dialog -->
|
|
472
|
+
<pie-list-item
|
|
473
|
+
interactionType="button"
|
|
474
|
+
primaryText="Delete account"
|
|
475
|
+
secondaryText="Permanently remove your account"
|
|
476
|
+
.aria=${{ button: { haspopup: 'dialog' } }}>
|
|
477
|
+
</pie-list-item>
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
In React:
|
|
481
|
+
|
|
482
|
+
```jsx
|
|
483
|
+
<PieListItem
|
|
484
|
+
interactionType="button"
|
|
485
|
+
primaryText="Delete account"
|
|
486
|
+
secondaryText="Permanently remove your account"
|
|
487
|
+
aria={{ button: { haspopup: 'dialog' } }}
|
|
488
|
+
onClick={openConfirmDialog}
|
|
489
|
+
/>
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
```js
|
|
493
|
+
import '@justeattakeaway/pie-webc/components/list.js';
|
|
494
|
+
import '@justeattakeaway/pie-webc/components/list-item.js';
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
```html
|
|
498
|
+
<pie-list aria-label="Account actions">
|
|
499
|
+
<pie-list-item hasDivider interactionType="button" primaryText="Edit profile" secondaryText="Update your name and photo"></pie-list-item>
|
|
500
|
+
<pie-list-item interactionType="button" primaryText="Sign out" secondaryText="End your session on this device"></pie-list-item>
|
|
501
|
+
</pie-list>
|
|
502
|
+
|
|
503
|
+
<script type="module">
|
|
504
|
+
document.querySelector('pie-list').addEventListener('click', (event) => {
|
|
505
|
+
const item = event.target.closest('pie-list-item');
|
|
506
|
+
if (item) runActionFor(item.primaryText);
|
|
507
|
+
});
|
|
508
|
+
</script>
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
In React, attach an `onClick` to the item:
|
|
512
|
+
|
|
513
|
+
```jsx
|
|
514
|
+
import { PieListItem } from '@justeattakeaway/pie-webc/react/list-item.js';
|
|
515
|
+
|
|
516
|
+
<PieListItem interactionType="button" primaryText="Edit profile" secondaryText="Update your name and photo" onClick={openProfileEditor} />
|
|
517
|
+
```
|
|
518
|
+
|
|
418
519
|
### Framework variants
|
|
419
520
|
|
|
420
521
|
**For Native JS Applications, Vue, Angular, Svelte etc.:**
|
|
@@ -448,6 +549,7 @@ To keep lists consistent and correct, follow these rules:
|
|
|
448
549
|
|
|
449
550
|
- **Always give `pie-list` an accessible name** with `aria-label` or `aria-labelledby` (use `aria-labelledby` when a visible heading exists). This is required for screen reader users to understand the list. See [Accessibility](#accessibility).
|
|
450
551
|
- **Provide `primaryText`** on every `pie-list-item`; it is the item's main line of content.
|
|
552
|
+
- **Do not set `hasDivider` to `true` on the last item in a list.** Setting it on the last item adds a bottom border beneath the list, which breaks the design. Set `hasDivider` on every item except the last.
|
|
451
553
|
- **For selectable lists, use `pie-list-item` inside `pie-radio-group` or `pie-checkbox-group`, not `pie-list`.** `pie-list` is a static container with no selection or keyboard behaviour. See [Selectable lists](#selectable-lists).
|
|
452
554
|
- **`metaText` and the `trailing` slot are mutually exclusive.** If `metaText` is set, any `trailing` slot content is ignored. Choose one.
|
|
453
555
|
- **Slotted `pie-thumbnail` must use `size="40"`.** This is the only size that fits the list-item layout correctly.
|
package/custom-elements.json
CHANGED
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"kind": "variable",
|
|
71
71
|
"name": "interactionTypes",
|
|
72
72
|
"type": {
|
|
73
|
-
"text": "['none', 'radio', 'checkbox', 'switch', 'link']"
|
|
73
|
+
"text": "['none', 'radio', 'checkbox', 'switch', 'link', 'button']"
|
|
74
74
|
},
|
|
75
|
-
"default": "['none', 'radio', 'checkbox', 'switch', 'link']"
|
|
75
|
+
"default": "['none', 'radio', 'checkbox', 'switch', 'link', 'button']"
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
"kind": "variable",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"type": {
|
|
81
81
|
"text": "DefaultProps"
|
|
82
82
|
},
|
|
83
|
-
"default": "{ isCompact: false, isBold: false, hasMedia: false, interactionType: 'none', disabled: false, }"
|
|
83
|
+
"default": "{ isCompact: false, isBold: false, hasMedia: false, interactionType: 'none', disabled: false, hasDivider: false, }"
|
|
84
84
|
}
|
|
85
85
|
],
|
|
86
86
|
"exports": [
|
|
@@ -174,6 +174,19 @@
|
|
|
174
174
|
"name": "disabled",
|
|
175
175
|
"attribute": "disabled"
|
|
176
176
|
},
|
|
177
|
+
{
|
|
178
|
+
"kind": "field",
|
|
179
|
+
"name": "hasDivider",
|
|
180
|
+
"attribute": "hasDivider"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"kind": "field",
|
|
184
|
+
"name": "aria",
|
|
185
|
+
"type": {
|
|
186
|
+
"text": "ListItemProps['aria']"
|
|
187
|
+
},
|
|
188
|
+
"attribute": "aria"
|
|
189
|
+
},
|
|
177
190
|
{
|
|
178
191
|
"kind": "field",
|
|
179
192
|
"name": "_parentDisabled",
|
|
@@ -250,6 +263,24 @@
|
|
|
250
263
|
"privacy": "private",
|
|
251
264
|
"readonly": true
|
|
252
265
|
},
|
|
266
|
+
{
|
|
267
|
+
"kind": "field",
|
|
268
|
+
"name": "_isButtonRow",
|
|
269
|
+
"type": {
|
|
270
|
+
"text": "boolean"
|
|
271
|
+
},
|
|
272
|
+
"privacy": "private",
|
|
273
|
+
"readonly": true
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"kind": "field",
|
|
277
|
+
"name": "_isOverlayRow",
|
|
278
|
+
"type": {
|
|
279
|
+
"text": "boolean"
|
|
280
|
+
},
|
|
281
|
+
"privacy": "private",
|
|
282
|
+
"readonly": true
|
|
283
|
+
},
|
|
253
284
|
{
|
|
254
285
|
"kind": "field",
|
|
255
286
|
"name": "_providesAria",
|
|
@@ -295,7 +326,7 @@
|
|
|
295
326
|
"text": "void"
|
|
296
327
|
}
|
|
297
328
|
},
|
|
298
|
-
"description": "Sets the item's role from `interactionType`: `presentation` for radio/checkbox (so the group\nowns those controls directly), otherwise `listitem` (static items, switches and
|
|
329
|
+
"description": "Sets the item's role from `interactionType`: `presentation` for radio/checkbox (so the group\nowns those controls directly), otherwise `listitem` (static items, switches, links and\nbuttons). A role set explicitly by the consumer is left untouched, even if it is added or\nremoved dynamically after the element connects."
|
|
299
330
|
},
|
|
300
331
|
{
|
|
301
332
|
"kind": "field",
|
|
@@ -304,7 +335,7 @@
|
|
|
304
335
|
"text": "ContextualAria | undefined"
|
|
305
336
|
},
|
|
306
337
|
"privacy": "private",
|
|
307
|
-
"description": "The accessible name and description this item provides to its
|
|
338
|
+
"description": "The accessible name and description this item provides to its interactive element, stitched\nfrom its text. Selection controls consume it via `ariaContext` (each applying it to the\nelement that carries its role); the action button of a `button` row takes it directly as\n`aria-label`/`aria-description` in the template; a link anchor takes it via `_applyLinkAria`.",
|
|
308
339
|
"readonly": true
|
|
309
340
|
},
|
|
310
341
|
{
|
|
@@ -322,7 +353,7 @@
|
|
|
322
353
|
"text": "void"
|
|
323
354
|
}
|
|
324
355
|
},
|
|
325
|
-
"description": "
|
|
356
|
+
"description": "On a link row, names the slotted (empty) anchor from the item's own text: the parent owns the\nchild's aria. The anchor is plain light-DOM, so it cannot reference the shadow-DOM text via\n`aria-labelledby`; and it is not a PIE control that consumes `ariaContext`, so we set the\nattributes imperatively. The visible text is `aria-hidden` in the template, so nothing is\nannounced twice. (A `button` row names its own rendered element in the template instead.)\n\nA consumer-provided name/description always wins: we capture (once) whether the anchor already\ncarries `aria-label`/`aria-labelledby` or `aria-description`/`aria-describedby` and, if so,\nleave that attribute untouched. Otherwise we keep our generated value in sync with the text."
|
|
326
357
|
},
|
|
327
358
|
{
|
|
328
359
|
"kind": "method",
|
|
@@ -331,6 +362,11 @@
|
|
|
331
362
|
{
|
|
332
363
|
"kind": "method",
|
|
333
364
|
"name": "_renderTrailingContent"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"kind": "method",
|
|
368
|
+
"name": "_renderActionButton",
|
|
369
|
+
"description": "The interactive target for a `button` row: an empty, native `<button>` stretched invisibly\nover the whole row (see the SCSS). The item renders and owns it - rather than the consumer\nslotting one - so it can name it from its own text and keep its attributes private (it is just\nan action box, not a configurable control). Being a real button, activation is native: pointer\nclicks and keyboard (Enter/Space) both fire a `click` that bubbles out, so consumers listen for\n`click` on the `pie-list-item`. It is `type=\"button\"`, so it never submits a form."
|
|
334
370
|
}
|
|
335
371
|
],
|
|
336
372
|
"attributes": [
|
|
@@ -374,6 +410,17 @@
|
|
|
374
410
|
{
|
|
375
411
|
"name": "disabled",
|
|
376
412
|
"fieldName": "disabled"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"name": "hasDivider",
|
|
416
|
+
"fieldName": "hasDivider"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"name": "aria",
|
|
420
|
+
"type": {
|
|
421
|
+
"text": "ListItemProps['aria']"
|
|
422
|
+
},
|
|
423
|
+
"fieldName": "aria"
|
|
377
424
|
}
|
|
378
425
|
],
|
|
379
426
|
"superclass": {
|