@justeattakeaway/pie-list 0.6.2 → 0.7.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.
package/README.md CHANGED
@@ -36,6 +36,10 @@
36
36
  - [Link items](#link-items)
37
37
  - [Indicating the current page](#indicating-the-current-page)
38
38
  - [Button items](#button-items)
39
+ - [Disabled states](#disabled-states)
40
+ - [Disabling an individual row](#disabling-an-individual-row)
41
+ - [Disabling via a container group](#disabling-via-a-container-group)
42
+ - [SSR and group-disabled](#ssr-and-group-disabled)
39
43
  - [Framework variants](#framework-variants)
40
44
  - [Usage Notes and Rules](#usage-notes-and-rules)
41
45
  - [Questions and Support](#questions-and-support)
@@ -85,13 +89,13 @@ Slots are provided by `pie-list-item`.
85
89
  | `trailing` | Content displayed at the end of the item, after the text. Intended for a small icon, a `pie-tag`, etc. Not rendered when `metaText` is set. |
86
90
  | `link` | Only rendered when `interactionType="link"`. Slot a single **empty** anchor (`<a slot="link" href="...">`) here. It is stretched over the whole row so the entire item becomes the navigation target. The item supplies the anchor's accessible name and description from its text, so the anchor must contain no text of its own; apply any native anchor attributes you need (`href`, `target`, `rel`, and so on). See [Link items](#link-items). |
87
91
 
88
- The permitted slotted elements are: a PIE WEBC icon, `pie-tag`, `pie-thumbnail`, `pie-avatar`*, `pie-switch`, and native HTML radio/checkbox inputs.
92
+ The permitted slotted elements are: a PIE WEBC icon, `pie-tag`, `pie-thumbnail`, `pie-avatar`*, `pie-switch`, `pie-radio` and `pie-checkbox`.
89
93
  Some slotted content is designed with specific properties being used. So please read the entire readme to understand correct slot usage.
90
94
 
91
95
  > [!NOTE]
92
96
  > `pie-list` is a **static** container: it has no selection state or keyboard behaviour. For a **selectable** list, do not slot the controls into `pie-list`. Place `pie-list-item`s inside a [`pie-radio-group`](https://webc.pie.design/?path=/docs/components-radio-group--overview) (single-select) or a [`pie-checkbox-group`](https://webc.pie.design/?path=/docs/components-checkbox-group--overview) (multi-select) instead. See [Selectable lists](#selectable-lists) below.
93
97
 
94
- > Slotted PIE icons are always sized by `pie-list-item` (24px). Consumers cannot override this size.
98
+ > Slotted PIE icons are always sized by `pie-list-item`. Consumers cannot override this size.
95
99
 
96
100
  > \* `pie-avatar` is a permitted slot element but is not covered by usage examples here yet, as it is not ready for use in lists.
97
101
 
@@ -241,7 +245,7 @@ Renders as trailing text; do not combine with the `trailing` slot:
241
245
 
242
246
  ### Compact list
243
247
 
244
- Reduced height, see [rules](#usage-notes-and-rules):
248
+ Reduced height, see [rules](#usage-notes-and-rules). Leading, trailing and meta content is aligned with the first line of the primary text, so it stays level with that line if the text wraps. If `metaText` is the content that wraps, the row grows and the primary text sits level with the meta text's first line:
245
249
 
246
250
  ```html
247
251
  <pie-list>
@@ -516,6 +520,66 @@ import { PieListItem } from '@justeattakeaway/pie-webc/react/list-item.js';
516
520
  <PieListItem interactionType="button" primaryText="Edit profile" secondaryText="Update your name and photo" onClick={openProfileEditor} />
517
521
  ```
518
522
 
523
+ ### Disabled states
524
+
525
+ Only interactive rows (`interactionType` of `radio`, `checkbox`, `switch`, or `button`) can be disabled. `link` rows do not support `disabled`. Disabled links are generally a UX and accessibility problem, and we recommend reaching for a different pattern. Setting `disabled` on a non-interactive (`interactionType="none"`) item has no visible or functional effect.
526
+
527
+ #### Disabling an individual row
528
+
529
+ Set `disabled` on the `pie-list-item` and also on the slotted control. The item and the control are independent, so each must be disabled explicitly (exactly as you would disable a standalone `pie-checkbox`):
530
+
531
+ ```html
532
+ <!-- Radio -->
533
+ <pie-list-item interactionType="radio" disabled>
534
+ <pie-radio slot="leading" value="collection" disabled></pie-radio>
535
+ </pie-list-item>
536
+
537
+ <!-- Checkbox -->
538
+ <pie-list-item interactionType="checkbox" disabled>
539
+ <pie-checkbox slot="leading" name="mushrooms" disabled></pie-checkbox>
540
+ </pie-list-item>
541
+
542
+ <!-- Switch -->
543
+ <pie-list-item interactionType="switch" disabled>
544
+ <pie-switch slot="trailing" disabled></pie-switch>
545
+ </pie-list-item>
546
+
547
+ <!-- Button (no slotted control; the item renders its own button) -->
548
+ <pie-list-item interactionType="button" primaryText="Sign out" disabled></pie-list-item>
549
+ ```
550
+
551
+ Any component slotted into the row owns its own disabled styling too, so set that explicitly in the same way: `isDimmed` on a `pie-tag`, `disabled` on a `pie-thumbnail`, and so on. This applies to every individually disabled row, including switch rows, which have no container group to propagate from:
552
+
553
+ ```html
554
+ <pie-list-item interactionType="button" disabled primaryText="Mushrooms" secondaryText="Out of season" hasMedia>
555
+ <pie-thumbnail slot="leading" size="40" disabled></pie-thumbnail>
556
+ <pie-tag slot="trailing" isDimmed>Out of stock</pie-tag>
557
+ </pie-list-item>
558
+ ```
559
+
560
+ #### Disabling via a container group
561
+
562
+ Setting `disabled` on a `pie-radio-group` or `pie-checkbox-group` propagates the disabled state automatically to every `pie-list-item`, its slotted control, and any slotted `pie-tag` or `pie-thumbnail` inside the group. You do not need to set `disabled` on each row, or `isDimmed` on each tag, individually:
563
+
564
+ ```html
565
+ <pie-radio-group name="delivery" disabled>
566
+ <pie-list-item interactionType="radio" primaryText="Standard delivery" secondaryText="3 to 5 working days">
567
+ <pie-radio slot="leading" value="standard"></pie-radio>
568
+ <pie-tag slot="trailing">Free</pie-tag>
569
+ </pie-list-item>
570
+ <pie-list-item interactionType="radio" primaryText="Express delivery" secondaryText="Next working day">
571
+ <pie-radio slot="leading" value="express"></pie-radio>
572
+ <pie-tag slot="trailing">£4.99</pie-tag>
573
+ </pie-list-item>
574
+ </pie-radio-group>
575
+ ```
576
+
577
+ Switches have no group, so each switch row must be disabled individually (see above).
578
+
579
+ #### SSR and group-disabled
580
+
581
+ Group-disabled propagation occurs at runtime via Lit context. If you need disabled styles on page load in an SSR environment, set `disabled` directly on each `pie-list-item`, its slotted control and any `pie-thumbnail`, and set `isDimmed` on any `pie-tag`, rather than relying on the group container.
582
+
519
583
  ### Framework variants
520
584
 
521
585
  **For Native JS Applications, Vue, Angular, Svelte etc.:**
@@ -554,7 +618,8 @@ To keep lists consistent and correct, follow these rules:
554
618
  - **`metaText` and the `trailing` slot are mutually exclusive.** If `metaText` is set, any `trailing` slot content is ignored. Choose one.
555
619
  - **Slotted `pie-thumbnail` must use `size="40"`.** This is the only size that fits the list-item layout correctly.
556
620
  - **Always set `hasMedia` when slotting media** (`pie-thumbnail`, and `pie-avatar` in future), whether or not the item has `secondaryText`. This guarantees the item has the correct block padding.
557
- - **Do not combine `isCompact` with `secondaryText` or with slotted media.** Compact items are single-line and too short for these.
621
+ - **Do not combine `isCompact` with `secondaryText` or with slotted media.** Compact items are too short for these.
622
+ - **Keep leading and trailing content in a compact item within one line of primary text.** Taller content cannot be aligned with the first line of the primary text. Icons, `pie-radio`, `pie-checkbox`, `pie-switch` and a large `pie-tag` all fit.
558
623
  - **Only use `center` for `--list-item-alignment`.** Other values are not supported.
559
624
  - **`pie-avatar` is not yet ready** for use in lists. Prefer `pie-thumbnail` for media for now.
560
625
 
@@ -4,7 +4,7 @@ const t = class t extends i {
4
4
  this.getAttribute("v") || this.setAttribute("v", t.v);
5
5
  }
6
6
  };
7
- t.v = "0.6.2";
7
+ t.v = "0.7.1";
8
8
  let s = t;
9
9
  export {
10
10
  s as P
@@ -3,7 +3,7 @@ import { property as c, state as k } from "lit/decorators.js";
3
3
  import { classMap as _ } from "lit/directives/class-map.js";
4
4
  import { ifDefined as m } from "lit/directives/if-defined.js";
5
5
  import { validPropertyValues as I, safeCustomElement as T, ariaContext as w, parentDisabledContext as C } from "@justeattakeaway/pie-webc-core";
6
- import { P as A } from "./PieElement-d0Wz34Fk.js";
6
+ import { P as A } from "./PieElement-CRx84WlS.js";
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2021 Google LLC
@@ -21,11 +21,11 @@ let g = class extends Event {
21
21
  */
22
22
  let f = class {
23
23
  constructor(t, e, o, s) {
24
- if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (r, n) => {
25
- this.unsubscribe && (this.unsubscribe !== n && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = r, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(r, n)), this.unsubscribe = n;
24
+ if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (a, n) => {
25
+ this.unsubscribe && (this.unsubscribe !== n && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = a, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(a, n)), this.unsubscribe = n;
26
26
  }, this.host = t, e.context !== void 0) {
27
- const r = e;
28
- this.context = r.context, this.callback = r.callback, this.subscribe = r.subscribe ?? !1;
27
+ const a = e;
28
+ this.context = a.context, this.callback = a.callback, this.subscribe = a.subscribe ?? !1;
29
29
  } else this.context = e, this.callback = o, this.subscribe = s ?? !1;
30
30
  this.host.addController(this);
31
31
  }
@@ -84,7 +84,7 @@ class L extends Event {
84
84
  }
85
85
  class D extends R {
86
86
  constructor(t, e, o) {
87
- var s, r;
87
+ var s, a;
88
88
  super(e.context !== void 0 ? e.initialValue : o), this.onContextRequest = (n) => {
89
89
  if (n.context !== this.context) return;
90
90
  const b = n.contextTarget ?? n.composedPath()[0];
@@ -94,7 +94,7 @@ class D extends R {
94
94
  const b = /* @__PURE__ */ new Set();
95
95
  for (const [u, { consumerHost: v }] of this.subscriptions) b.has(u) || (b.add(u), v.dispatchEvent(new g(this.context, v, u, !0)));
96
96
  n.stopPropagation();
97
- }, this.host = t, e.context !== void 0 ? this.context = e.context : this.context = e, this.attachListeners(), (r = (s = this.host).addController) == null || r.call(s, this);
97
+ }, this.host = t, e.context !== void 0 ? this.context = e.context : this.context = e, this.attachListeners(), (a = (s = this.host).addController) == null || a.call(s, this);
98
98
  }
99
99
  attachListeners() {
100
100
  this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
@@ -115,8 +115,8 @@ function B({ context: i, subscribe: t }) {
115
115
  e.set.call(this, s);
116
116
  }, subscribe: t });
117
117
  })) : e.constructor.addInitializer(((s) => {
118
- new f(s, { context: i, callback: (r) => {
119
- s[o] = r;
118
+ new f(s, { context: i, callback: (a) => {
119
+ s[o] = a;
120
120
  }, subscribe: t });
121
121
  }));
122
122
  };
@@ -128,14 +128,14 @@ const P = ["none", "radio", "checkbox", "switch", "link", "button"], d = {
128
128
  interactionType: "none",
129
129
  disabled: !1,
130
130
  hasDivider: !1
131
- }, S = "*,*:after,*:before{box-sizing:inherit}:host{--list-item-inline-padding: var(--dt-spacing-d);--list-item-alignment: flex-start;display:block}.c-listItem-container{--list-item-block-padding: var(--dt-spacing-d);padding-inline-start:var(--list-item-inline-padding);padding-inline-end:var(--list-item-inline-padding);padding-block-start:var(--list-item-block-padding);padding-block-end:var(--list-item-block-padding);display:flex;align-items:var(--list-item-alignment);gap:var(--dt-spacing-c);min-height:56px}.c-listItem-container.has-divider{padding-block-end:calc(var(--list-item-block-padding) - 1px);border-bottom:1px solid var(--dt-color-divider-default)}.c-listItem-container:has(.c-listItem-secondaryText){align-items:var(--list-item-alignment);min-height:76px}.c-listItem-container.is-compact{--list-item-block-padding: var(--dt-spacing-c);--list-item-alignment: center;align-items:var(--list-item-alignment);min-height:48px}.c-listItem-container.is-link,.c-listItem-container.is-button{position:relative}.c-listItem-container.is-selectable:not(.is-disabled),.c-listItem-container.is-link,.c-listItem-container.is-button:not(.is-disabled){--list-item-hover-bg: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--dt-color-hover-01));--list-item-active-bg: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--dt-color-active-01))}@supports (background-color: color-mix(in srgb,black,white)){.c-listItem-container.is-selectable:not(.is-disabled),.c-listItem-container.is-link,.c-listItem-container.is-button:not(.is-disabled){--list-item-hover-bg: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), transparent);--list-item-active-bg: color-mix(in srgb, var(--dt-color-active-01-bg) var(--dt-color-active-01), transparent)}}.c-listItem-container.is-selectable:not(.is-disabled),.c-listItem-container.is-link,.c-listItem-container.is-button:not(.is-disabled){cursor:pointer}.c-listItem-container.is-selectable:not(.is-disabled):hover,.c-listItem-container.is-link:hover,.c-listItem-container.is-button:not(.is-disabled):hover{background-color:var(--list-item-hover-bg);--interactive-container-tint: var(--list-item-hover-bg)}.c-listItem-container.is-selectable:not(.is-disabled):active,.c-listItem-container.is-link:active,.c-listItem-container.is-button:not(.is-disabled):active{background-color:var(--list-item-active-bg);--interactive-container-tint: var(--list-item-active-bg)}.c-listItem-container.is-button:has(.c-listItem-action:active){background-color:var(--list-item-active-bg);--interactive-container-tint: var(--list-item-active-bg)}slot[name=link]::slotted(a),.c-listItem-action{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;border-radius:inherit}.c-listItem-action{padding:0;border:none;background:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;font:inherit;cursor:pointer}.c-listItem-action:disabled{cursor:default}slot[name=link]::slotted(a:focus-visible),.c-listItem-action:focus-visible{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-listItem-container.has-media:has(.c-listItem-primaryText:only-child){--list-item-block-padding: var(--dt-spacing-b)}.c-listItem-text{flex:1}slot[name=trailing]::slotted(*),.c-listItem-metaText{padding-inline-start:var(--dt-spacing-a)}.c-listItem-leading,slot[name=leading],.c-listItem-trailing,slot[name=trailing]{display:contents}.c-listItem-text>*{display:block}.c-listItem-trailing{margin-inline-start:auto}.c-listItem-metaText{display:block;max-width:33.3333333333%}::slotted(.c-pieIcon){--icon-size-override: 24px }.c-listItem-container.is-button.is-disabled .c-listItem-primaryText,.c-listItem-container.is-button.is-disabled .c-listItem-secondaryText,.c-listItem-container.is-button.is-disabled .c-listItem-metaText{color:var(--dt-color-content-disabled)}.c-listItem-container.is-button.is-disabled ::slotted(.c-pieIcon){color:var(--dt-color-disabled-01)}.c-listItem-primaryText{font-family:var(--dt-font-body-l-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-l-weight);font-size:calc(var(--dt-font-body-l-size) * 1px);line-height:calc(var(--dt-font-body-l-line-height) * 1px);color:var(--dt-color-content-default)}.c-listItem-container.is-bold .c-listItem-primaryText{font-family:var(--dt-font-body-strong-l-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-strong-l-weight);font-size:calc(var(--dt-font-body-strong-l-size) * 1px);line-height:calc(var(--dt-font-body-strong-l-line-height) * 1px)}.c-listItem-secondaryText,.c-listItem-metaText{font-family:var(--dt-font-body-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-s-weight);font-size:calc(var(--dt-font-body-s-size) * 1px);line-height:calc(var(--dt-font-body-s-line-height) * 1px);color:var(--dt-color-content-subdued)}";
131
+ }, S = "*,*:after,*:before{box-sizing:inherit}:host{--list-item-inline-padding: var(--dt-spacing-d);--list-item-alignment: flex-start;display:block}.c-listItem-container{--list-item-block-padding: var(--dt-spacing-d);padding-inline-start:var(--list-item-inline-padding);padding-inline-end:var(--list-item-inline-padding);padding-block-start:var(--list-item-block-padding);padding-block-end:var(--list-item-block-padding);display:flex;align-items:var(--list-item-alignment);gap:var(--dt-spacing-c);min-height:56px}.c-listItem-container.has-divider{padding-block-end:calc(var(--list-item-block-padding) - 1px);border-bottom:1px solid var(--dt-color-divider-default)}.c-listItem-container:has(.c-listItem-secondaryText){align-items:var(--list-item-alignment);min-height:76px}.c-listItem-container.is-compact{--list-item-first-line-height: calc(var(--dt-font-body-l-line-height) * 1px);--list-item-block-padding: var(--dt-spacing-c);min-height:48px}.c-listItem-container.is-link,.c-listItem-container.is-button{position:relative}.c-listItem-container.is-selectable:not(.is-disabled),.c-listItem-container.is-link,.c-listItem-container.is-button:not(.is-disabled){--list-item-hover-bg: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--dt-color-hover-01));--list-item-active-bg: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--dt-color-active-01))}@supports (background-color: color-mix(in srgb,black,white)){.c-listItem-container.is-selectable:not(.is-disabled),.c-listItem-container.is-link,.c-listItem-container.is-button:not(.is-disabled){--list-item-hover-bg: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), transparent);--list-item-active-bg: color-mix(in srgb, var(--dt-color-active-01-bg) var(--dt-color-active-01), transparent)}}.c-listItem-container.is-selectable:not(.is-disabled),.c-listItem-container.is-link,.c-listItem-container.is-button:not(.is-disabled){cursor:pointer}.c-listItem-container.is-selectable:not(.is-disabled):hover,.c-listItem-container.is-link:hover,.c-listItem-container.is-button:not(.is-disabled):hover{background-color:var(--list-item-hover-bg);--interactive-container-tint: var(--list-item-hover-bg)}.c-listItem-container.is-selectable:not(.is-disabled):active,.c-listItem-container.is-link:active,.c-listItem-container.is-button:not(.is-disabled):active{background-color:var(--list-item-active-bg);--interactive-container-tint: var(--list-item-active-bg)}.c-listItem-container.is-button:has(.c-listItem-action:active){background-color:var(--list-item-active-bg);--interactive-container-tint: var(--list-item-active-bg)}slot[name=link]::slotted(a),.c-listItem-action{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;border-radius:inherit}.c-listItem-action{padding:0;border:none;background:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;font:inherit;cursor:pointer}.c-listItem-action:disabled{cursor:default}slot[name=link]::slotted(a:focus-visible),.c-listItem-action:focus-visible{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-listItem-container.has-media:has(.c-listItem-primaryText:only-child){--list-item-block-padding: var(--dt-spacing-b)}.c-listItem-text{flex:1}slot[name=trailing]::slotted(*),.c-listItem-metaText{padding-inline-start:var(--dt-spacing-a)}.c-listItem-leading,slot[name=leading],.c-listItem-trailing,slot[name=trailing]{display:contents}.c-listItem-text>*{display:block}.c-listItem-trailing{margin-inline-start:auto}.c-listItem-metaText{display:block;max-width:33.3333333333%}::slotted(.c-pieIcon){--icon-size-override: 24px;color:var(--dt-color-content-subdued)}.c-listItem-container.is-button.is-disabled .c-listItem-primaryText,.c-listItem-container.is-button.is-disabled .c-listItem-secondaryText,.c-listItem-container.is-button.is-disabled .c-listItem-metaText,.c-listItem-container.is-selectable.is-disabled .c-listItem-primaryText,.c-listItem-container.is-selectable.is-disabled .c-listItem-secondaryText,.c-listItem-container.is-selectable.is-disabled .c-listItem-metaText{color:var(--dt-color-content-disabled)}.c-listItem-container.is-button.is-disabled ::slotted(.c-pieIcon),.c-listItem-container.is-selectable.is-disabled ::slotted(.c-pieIcon){opacity:.5}.c-listItem-primaryText{font-family:var(--dt-font-body-l-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-l-weight);font-size:calc(var(--dt-font-body-l-size) * 1px);line-height:calc(var(--dt-font-body-l-line-height) * 1px);color:var(--dt-color-content-default)}.c-listItem-container.is-bold .c-listItem-primaryText{font-family:var(--dt-font-body-strong-l-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-strong-l-weight);font-size:calc(var(--dt-font-body-strong-l-size) * 1px);line-height:calc(var(--dt-font-body-strong-l-line-height) * 1px)}.c-listItem-secondaryText,.c-listItem-metaText{font-family:var(--dt-font-body-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-s-weight);font-size:calc(var(--dt-font-body-s-size) * 1px);line-height:calc(var(--dt-font-body-s-line-height) * 1px);color:var(--dt-color-content-subdued)}.c-listItem-container.is-compact .c-listItem-metaText{display:flex;align-items:center;min-height:var(--list-item-first-line-height)}";
132
132
  var $ = Object.defineProperty, q = Object.getOwnPropertyDescriptor, l = (i, t, e, o) => {
133
- for (var s = o > 1 ? void 0 : o ? q(t, e) : t, r = i.length - 1, n; r >= 0; r--)
134
- (n = i[r]) && (s = (o ? n(t, e, s) : n(s)) || s);
133
+ for (var s = o > 1 ? void 0 : o ? q(t, e) : t, a = i.length - 1, n; a >= 0; a--)
134
+ (n = i[a]) && (s = (o ? n(t, e, s) : n(s)) || s);
135
135
  return o && s && $(t, e, s), s;
136
136
  };
137
137
  const z = "pie-list-item";
138
- let a = class extends A {
138
+ let r = class extends A {
139
139
  constructor() {
140
140
  super(...arguments), this.isCompact = d.isCompact, this.isBold = d.isBold, this.hasMedia = d.hasMedia, this.interactionType = d.interactionType, this.disabled = d.disabled, this.hasDivider = d.hasDivider, this._parentDisabled = !1, this._ariaProvider = x ? void 0 : new D(this, { context: w }), this._managedRole = null, this._linkAriaCaptured = !1, this._consumerNamedLink = !1, this._consumerDescribedLink = !1, this._handleHostClick = (i) => {
141
141
  if (!this._isSelectable || this._isDisabled) return;
@@ -298,47 +298,47 @@ let a = class extends A {
298
298
  </div>`;
299
299
  }
300
300
  };
301
- a.styles = y(S);
301
+ r.styles = y(S);
302
302
  l([
303
303
  c({ type: String })
304
- ], a.prototype, "primaryText", 2);
304
+ ], r.prototype, "primaryText", 2);
305
305
  l([
306
306
  c({ type: String })
307
- ], a.prototype, "secondaryText", 2);
307
+ ], r.prototype, "secondaryText", 2);
308
308
  l([
309
309
  c({ type: String })
310
- ], a.prototype, "metaText", 2);
310
+ ], r.prototype, "metaText", 2);
311
311
  l([
312
312
  c({ type: Boolean })
313
- ], a.prototype, "isCompact", 2);
313
+ ], r.prototype, "isCompact", 2);
314
314
  l([
315
315
  c({ type: Boolean })
316
- ], a.prototype, "isBold", 2);
316
+ ], r.prototype, "isBold", 2);
317
317
  l([
318
318
  c({ type: Boolean })
319
- ], a.prototype, "hasMedia", 2);
319
+ ], r.prototype, "hasMedia", 2);
320
320
  l([
321
321
  c({ type: String }),
322
322
  I(z, P, d.interactionType)
323
- ], a.prototype, "interactionType", 2);
323
+ ], r.prototype, "interactionType", 2);
324
324
  l([
325
325
  c({ type: Boolean })
326
- ], a.prototype, "disabled", 2);
326
+ ], r.prototype, "disabled", 2);
327
327
  l([
328
328
  c({ type: Boolean })
329
- ], a.prototype, "hasDivider", 2);
329
+ ], r.prototype, "hasDivider", 2);
330
330
  l([
331
331
  c({ type: Object })
332
- ], a.prototype, "aria", 2);
332
+ ], r.prototype, "aria", 2);
333
333
  l([
334
334
  B({ context: C, subscribe: !0 }),
335
335
  k()
336
- ], a.prototype, "_parentDisabled", 2);
337
- a = l([
336
+ ], r.prototype, "_parentDisabled", 2);
337
+ r = l([
338
338
  T("pie-list-item")
339
- ], a);
339
+ ], r);
340
340
  export {
341
- a as P,
341
+ r as P,
342
342
  d,
343
343
  P as i
344
344
  };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { html as a, unsafeCSS as c } from "lit";
2
- import { P as f } from "./PieElement-d0Wz34Fk.js";
2
+ import { P as f } from "./PieElement-CRx84WlS.js";
3
3
  import { RtlMixin as m, safeCustomElement as p } from "@justeattakeaway/pie-webc-core";
4
4
  const b = "*,*:after,*:before{box-sizing:inherit}:host{display:block}";
5
5
  var u = Object.getOwnPropertyDescriptor, h = (r, l, n, i) => {
@@ -22,7 +22,13 @@ export interface ListItemProps {
22
22
  /**
23
23
  * The height of the component is decreased to reduce the vertical space, and used when space needs to be saved.
24
24
  *
25
+ * Leading, trailing and meta content is aligned with the first line of the primary text, so when the
26
+ * text wraps onto more than one line that content stays level with the first line. If `metaText` is
27
+ * the content that wraps, it is the taller of the two, so the row grows and the primary text sits
28
+ * level with the meta text's first line rather than centred against it.
29
+ *
25
30
  * **Note**: Do not use if you require secondary text, or if you want to slot a pie-avatar, pie-thumbnail or Icon with Background component into the list item.
31
+ * Slotted content should be no taller than a single line of primary text (24px), otherwise it cannot be aligned with the first line.
26
32
  */
27
33
  isCompact?: boolean;
28
34
  /**
@@ -75,7 +81,7 @@ export interface ListItemProps {
75
81
  */
76
82
  aria?: AriaProps;
77
83
  }
78
- export type DefaultProps = ComponentDefaultProps<ListItemProps, keyof Omit<ListItemProps, 'primaryText' | 'secondaryText' | 'metaText'>>;
84
+ export type DefaultProps = ComponentDefaultProps<ListItemProps, keyof Omit<ListItemProps, 'primaryText' | 'secondaryText' | 'metaText' | 'aria'>>;
79
85
  export declare const defaultProps: DefaultProps;
80
86
  export {};
81
87
  //# sourceMappingURL=defs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../src/pie-list-item/defs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,KAAK,SAAS,GAAG;IACb,MAAM,CAAC,EAAE;QACL,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;KACvE,CAAC;CACL,CAAC;AAEF,eAAO,MAAM,gBAAgB,oEAAqE,CAAC;AAEnG,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,eAAe,CAAC,EAAE,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAEjD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,eAAe,GAAG,UAAU,CAAC,CAAC,CAAC;AAEzI,eAAO,MAAM,YAAY,EAAE,YAO1B,CAAC"}
1
+ {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../src/pie-list-item/defs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,KAAK,SAAS,GAAG;IACb,MAAM,CAAC,EAAE;QACL,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;KACvE,CAAC;CACL,CAAC;AAEF,eAAO,MAAM,gBAAgB,oEAAqE,CAAC;AAEnG,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,eAAe,CAAC,EAAE,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAEjD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,eAAe,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC;AAElJ,eAAO,MAAM,YAAY,EAAE,YAO1B,CAAC"}
@@ -2,9 +2,9 @@ import "lit";
2
2
  import "lit/decorators.js";
3
3
  import "lit/directives/class-map.js";
4
4
  import "lit/directives/if-defined.js";
5
- import { P } from "../index-D3r59PKG.js";
5
+ import { P } from "../index-BKlxlwAI.js";
6
6
  import "@justeattakeaway/pie-webc-core";
7
- import "../PieElement-d0Wz34Fk.js";
7
+ import "../PieElement-CRx84WlS.js";
8
8
  export {
9
9
  P as PieListItem
10
10
  };
@@ -1,7 +1,7 @@
1
1
  import * as e from "react";
2
2
  import { createComponent as t } from "@lit/react";
3
- import { P as i } from "../index-D3r59PKG.js";
4
- import { d as n, i as c } from "../index-D3r59PKG.js";
3
+ import { P as i } from "../index-BKlxlwAI.js";
4
+ import { d as n, i as c } from "../index-BKlxlwAI.js";
5
5
  const s = t({
6
6
  displayName: "PieListItem",
7
7
  elementClass: i,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-list",
3
3
  "description": "PIE Design System List built using Web Components",
4
- "version": "0.6.2",
4
+ "version": "0.7.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -42,7 +42,7 @@
42
42
  "@justeattakeaway/pie-monorepo-utils": "0.9.9"
43
43
  },
44
44
  "dependencies": {
45
- "@justeattakeaway/pie-webc-core": "18.0.0",
45
+ "@justeattakeaway/pie-webc-core": "18.1.0",
46
46
  "@lit/context": "1.1.6"
47
47
  },
48
48
  "customElements": "custom-elements.json",
@@ -27,7 +27,13 @@ export interface ListItemProps {
27
27
  /**
28
28
  * The height of the component is decreased to reduce the vertical space, and used when space needs to be saved.
29
29
  *
30
+ * Leading, trailing and meta content is aligned with the first line of the primary text, so when the
31
+ * text wraps onto more than one line that content stays level with the first line. If `metaText` is
32
+ * the content that wraps, it is the taller of the two, so the row grows and the primary text sits
33
+ * level with the meta text's first line rather than centred against it.
34
+ *
30
35
  * **Note**: Do not use if you require secondary text, or if you want to slot a pie-avatar, pie-thumbnail or Icon with Background component into the list item.
36
+ * Slotted content should be no taller than a single line of primary text (24px), otherwise it cannot be aligned with the first line.
31
37
  */
32
38
  isCompact?: boolean
33
39
 
@@ -87,7 +93,7 @@ export interface ListItemProps {
87
93
  aria?: AriaProps
88
94
  }
89
95
 
90
- export type DefaultProps = ComponentDefaultProps<ListItemProps, keyof Omit<ListItemProps, 'primaryText' | 'secondaryText' | 'metaText'>>;
96
+ export type DefaultProps = ComponentDefaultProps<ListItemProps, keyof Omit<ListItemProps, 'primaryText' | 'secondaryText' | 'metaText' | 'aria'>>;
91
97
 
92
98
  export const defaultProps: DefaultProps = {
93
99
  isCompact: false,
@@ -42,12 +42,13 @@
42
42
  min-height: 76px;
43
43
  }
44
44
 
45
+ // Compact items keep their leading, trailing and meta content aligned with the first line of the
46
+ // primary text rather than centred across all of its lines.
45
47
  .c-listItem-container.is-compact {
48
+ // The height of a single line of primary text, used to align content with the first line.
49
+ --list-item-first-line-height: #{p.line-height(--dt-font-body-l-line-height)};
46
50
  --list-item-block-padding: var(--dt-spacing-c);
47
51
 
48
- // Compact items are centre-aligned.
49
- --list-item-alignment: center;
50
- align-items: var(--list-item-alignment);
51
52
  min-height: 48px;
52
53
  }
53
54
 
@@ -183,12 +184,13 @@ slot[name="trailing"]::slotted(*),
183
184
  }
184
185
 
185
186
  ::slotted(.c-pieIcon) {
186
- --icon-size-override: 24px
187
+ --icon-size-override: 24px;
188
+
189
+ color: var(--dt-color-content-subdued);
187
190
  }
188
191
 
189
- // Disabled button row: mute text and icons. Icons use `fill: currentColor`, so setting `color`
190
- // on the host element cascades through the shadow boundary and changes their rendered fill.
191
- .c-listItem-container.is-button.is-disabled {
192
+ .c-listItem-container.is-button.is-disabled,
193
+ .c-listItem-container.is-selectable.is-disabled {
192
194
  .c-listItem-primaryText,
193
195
  .c-listItem-secondaryText,
194
196
  .c-listItem-metaText {
@@ -196,8 +198,9 @@ slot[name="trailing"]::slotted(*),
196
198
  }
197
199
  }
198
200
 
199
- .c-listItem-container.is-button.is-disabled ::slotted(.c-pieIcon) {
200
- color: var(--dt-color-disabled-01);
201
+ .c-listItem-container.is-button.is-disabled ::slotted(.c-pieIcon),
202
+ .c-listItem-container.is-selectable.is-disabled ::slotted(.c-pieIcon) {
203
+ opacity: 0.5;
201
204
  }
202
205
 
203
206
  // typography
@@ -220,3 +223,12 @@ slot[name="trailing"]::slotted(*),
220
223
  @include p.font-theme('font-body-s');
221
224
  color: var(--dt-color-content-subdued);
222
225
  }
226
+
227
+ // `metaText` uses `font-body-s`, so its line box is 20px rather than the primary text's 24px. In a
228
+ // compact row, a one-line-tall centring box sits it on the centre of the first line of primary text
229
+ // instead of 2px above it.
230
+ .c-listItem-container.is-compact .c-listItem-metaText {
231
+ display: flex;
232
+ align-items: center;
233
+ min-height: var(--list-item-first-line-height);
234
+ }