@justeattakeaway/pie-link 1.4.0 → 1.5.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 CHANGED
@@ -46,7 +46,7 @@ Ideally, you should install the component using the **`@justeattakeaway/pie-webc
46
46
  | `isStandalone` | `true`, `false` | If true, sets the link as a block element. | `false` |
47
47
  | `hasVisited` | `true`, `false` | If true, the link will apply the styles for the visited state. Only takes effect if `tag` is `"a"`. | `false` |
48
48
  | `iconPlacement` | `"leading"`, `"trailing"` | Sets the position of the icon relative to the text. Leading comes before the text and trailing comes after, taking writing direction into account. To use this, you must pass an icon into the [icon slot](#slots). **Will have no effect if `isStandalone` is false.** | `undefined` |
49
- | `aria` | `{ label?: string }` | Aria properties for the link to help with making it accessible. | `undefined` |
49
+ | `aria` | `{ label?: string, expanded?: boolean }` | Aria properties for the link to help with making it accessible. | `undefined` |
50
50
 
51
51
 
52
52
  ### Slots
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import { TemplateResult } from 'lit-html';
5
5
 
6
6
  declare type AriaProps = {
7
7
  label?: string;
8
+ expanded?: boolean;
8
9
  };
9
10
 
10
11
  export declare const buttonTypes: readonly ["submit", "button", "reset", "menu"];
@@ -17,7 +18,7 @@ export declare const iconPlacements: readonly ["leading", "trailing"];
17
18
 
18
19
  export declare interface LinkProps {
19
20
  /**
20
- * The ARIA labels used for the link.
21
+ * ARIA properties used for the link.
21
22
  */
22
23
  aria?: AriaProps;
23
24
  /**
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { LitElement as b, unsafeCSS as x, nothing as y, html as d } from "lit";
1
+ import { LitElement as b, unsafeCSS as x, nothing as y, html as p } from "lit";
2
2
  import { property as e } from "lit/decorators.js";
3
3
  import { classMap as u } from "lit/directives/class-map.js";
4
4
  import { ifDefined as a } from "lit/directives/if-defined.js";
5
- import { validPropertyValues as s, safeCustomElement as m } from "@justeattakeaway/pie-webc-core";
6
- const p = class p extends b {
5
+ import { validPropertyValues as c, safeCustomElement as m } from "@justeattakeaway/pie-webc-core";
6
+ const h = class h extends b {
7
7
  willUpdate() {
8
- this.getAttribute("v") || this.setAttribute("v", p.v);
8
+ this.getAttribute("v") || this.setAttribute("v", h.v);
9
9
  }
10
10
  };
11
- p.v = "1.4.0";
12
- let g = p;
11
+ h.v = "1.5.0";
12
+ let g = h;
13
13
  const z = "*,*:after,*:before{box-sizing:inherit}:host{display:inline-block;--link-font-weight: var(--dt-font-body-l-link-weight);--link-text-color: var(--dt-color-content-link);--link-text-decoration: var(--dt-font-body-l-link-text-decoration)}:host([isstandalone]){display:block}.c-link{--link-font-family: var(--dt-font-interactive-l-family);--link-font-size: calc(var(--dt-font-body-l-link-size) * 1px);--link-line-height: calc(var(--dt-font-body-l-link-line-height) * 1px);--link-icon-size: 16px;--link-icon-offset-top: var(--dt-spacing-a);display:inline-block;font-family:var(--link-font-family);font-size:var(--link-font-size);line-height:var(--link-line-height);font-weight:var(--link-font-weight);color:var(--link-text-color);text-decoration:var(--link-text-decoration);cursor:pointer}.c-link:hover,.c-link:active{--link-text-decoration: none}.c-link ::slotted(.c-pieIcon){pointer-events:none}.c-link.c-link--high-visibility{--link-text-color: var(--dt-color-content-link-distinct)}.c-link.c-link--inverse{--link-text-color: var(--dt-color-content-link-inverse)}.c-link.c-link--inverse-light{--link-text-color: var(--dt-color-content-link-light)}.c-link.c-link--xsmall{--link-font-size: calc(var(--dt-font-caption-link-size) * 1px);--link-line-height: calc(var(--dt-font-caption-link-line-height) * 1px);--link-font-weight: var(--dt-font-caption-link-weight);--link-text-decoration: var(--dt-font-caption-link-text-decoration);--link-icon-offset-top: 0}.c-link.c-link--small{--link-font-size: calc(var(--dt-font-body-s-link-size) * 1px);--link-line-height: calc(var(--dt-font-body-s-link-line-height) * 1px);--link-font-weight: var(--dt-font-body-s-link-weight);--link-text-decoration: var(--dt-font-body-s-link-text-decoration);--link-icon-offset-top: 2px}.c-link.c-link--underline-reversed.c-link--standalone{--link-text-decoration: none}.c-link.c-link--underline-reversed.c-link--standalone:hover,.c-link.c-link--underline-reversed.c-link--standalone:active{--link-text-decoration: var(--dt-font-body-l-link-text-decoration)}.c-link.c-link--bold{--link-font-size: calc(var(--dt-font-body-strong-l-link-size) * 1px);--link-line-height: calc(var(--dt-font-body-strong-l-link-line-height) * 1px);--link-font-weight: var(--dt-font-body-strong-l-link-weight)}.c-link.c-link--bold.c-link--small{--link-font-size: calc(var(--dt-font-body-strong-s-link-size) * 1px);--link-line-height: calc(var(--dt-font-body-strong-s-link-line-height) * 1px);--link-font-weight: var(--dt-font-body-strong-s-link-weight)}.c-link.c-link--bold.c-link--xsmall{--link-font-size: calc(var(--dt-font-caption-strong-link-size) * 1px);--link-line-height: calc(var(--dt-font-caption-strong-link-line-height) * 1px);--link-font-weight: var(--dt-font-caption-strong-link-weight)}.c-link.c-link--standalone{display:block;width:fit-content}.c-link.has-visited:visited{color:var(--dt-color-content-link-visited)}.c-link.has-visited:visited.c-link--inverse{color:var(--dt-color-content-link-visited-inverse)}.c-link:focus-visible{outline:none;border-radius:2px;box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer)}button.c-link{outline:none;border:none;-webkit-user-select:none;user-select:none;background:transparent;padding:0}.c-link-content{display:flex;gap:var(--dt-spacing-a)}::slotted(.c-pieIcon),::slotted(svg){display:inline-flex;margin-block-start:var(--link-icon-offset-top);height:var(--link-icon-size);width:var(--link-icon-size)}", w = ["default", "high-visibility", "inverse", "inverse-light"], S = ["xsmall", "small", "medium"], $ = ["leading", "trailing"], P = ["a", "button"], B = ["submit", "button", "reset", "menu"], C = ["default", "reversed"], n = {
14
14
  tag: "a",
15
15
  variant: "default",
@@ -21,12 +21,12 @@ const z = "*,*:after,*:before{box-sizing:inherit}:host{display:inline-block;--li
21
21
  iconPlacement: "leading",
22
22
  type: "submit"
23
23
  };
24
- var V = Object.defineProperty, O = Object.getOwnPropertyDescriptor, i = (l, o, h, k) => {
25
- for (var r = k > 1 ? void 0 : k ? O(o, h) : o, f = l.length - 1, v; f >= 0; f--)
26
- (v = l[f]) && (r = (k ? v(o, h, r) : v(r)) || r);
27
- return k && r && V(o, h, r), r;
24
+ var V = Object.defineProperty, O = Object.getOwnPropertyDescriptor, i = (l, o, r, k) => {
25
+ for (var s = k > 1 ? void 0 : k ? O(o, r) : o, f = l.length - 1, v; f >= 0; f--)
26
+ (v = l[f]) && (s = (k ? v(o, r, s) : v(s)) || s);
27
+ return k && s && V(o, r, s), s;
28
28
  };
29
- const c = "pie-link";
29
+ const d = "pie-link";
30
30
  let t = class extends g {
31
31
  constructor() {
32
32
  super(...arguments), this.tag = n.tag, this.variant = n.variant, this.size = n.size, this.underline = n.underline, this.iconPlacement = n.iconPlacement, this.isBold = n.isBold, this.isStandalone = n.isStandalone, this.hasVisited = n.hasVisited, this.type = n.type;
@@ -38,11 +38,11 @@ let t = class extends g {
38
38
  */
39
39
  renderContent() {
40
40
  const { iconPlacement: l, isStandalone: o } = this;
41
- return d`
41
+ return p`
42
42
  <span class="c-link-content">
43
- ${o && l === "leading" ? d`<slot name="icon"></slot>` : y}
43
+ ${o && l === "leading" ? p`<slot name="icon"></slot>` : y}
44
44
  <slot></slot>
45
- ${o && l === "trailing" ? d`<slot name="icon"></slot>` : y}
45
+ ${o && l === "trailing" ? p`<slot name="icon"></slot>` : y}
46
46
  </span>`;
47
47
  }
48
48
  /**
@@ -51,13 +51,14 @@ let t = class extends g {
51
51
  * @private
52
52
  */
53
53
  renderButton(l) {
54
- var o;
55
- return d`
54
+ var o, r;
55
+ return p`
56
56
  <button
57
57
  data-test-id="pie-link-button"
58
58
  class="${u(l)}"
59
59
  type=${this.type}
60
60
  aria-label=${a((o = this.aria) == null ? void 0 : o.label)}
61
+ aria-expanded=${a((r = this.aria) == null ? void 0 : r.expanded)}
61
62
  part="base">
62
63
  ${this.renderContent()}
63
64
  </button>`;
@@ -68,8 +69,8 @@ let t = class extends g {
68
69
  * @private
69
70
  */
70
71
  renderAnchor(l) {
71
- var o;
72
- return d`
72
+ var o, r;
73
+ return p`
73
74
  <a
74
75
  data-test-id="pie-link-anchor"
75
76
  class="${u(l)}"
@@ -78,6 +79,7 @@ let t = class extends g {
78
79
  rel=${a(this.rel)}
79
80
  download="${a(this.download)}"
80
81
  aria-label=${a((o = this.aria) == null ? void 0 : o.label)}
82
+ aria-expanded=${a((r = this.aria) == null ? void 0 : r.expanded)}
81
83
  part="base">
82
84
  ${this.renderContent()}
83
85
  </a>`;
@@ -98,23 +100,23 @@ let t = class extends g {
98
100
  t.styles = x(z);
99
101
  i([
100
102
  e({ type: String }),
101
- s(c, P, n.tag)
103
+ c(d, P, n.tag)
102
104
  ], t.prototype, "tag", 2);
103
105
  i([
104
106
  e({ type: String }),
105
- s(c, w, n.variant)
107
+ c(d, w, n.variant)
106
108
  ], t.prototype, "variant", 2);
107
109
  i([
108
110
  e({ type: String }),
109
- s(c, S, n.size)
111
+ c(d, S, n.size)
110
112
  ], t.prototype, "size", 2);
111
113
  i([
112
114
  e({ type: String }),
113
- s(c, C, n.underline)
115
+ c(d, C, n.underline)
114
116
  ], t.prototype, "underline", 2);
115
117
  i([
116
118
  e({ type: String }),
117
- s(c, $, n.iconPlacement)
119
+ c(d, $, n.iconPlacement)
118
120
  ], t.prototype, "iconPlacement", 2);
119
121
  i([
120
122
  e({ type: String, reflect: !0 })
@@ -139,7 +141,7 @@ i([
139
141
  ], t.prototype, "hasVisited", 2);
140
142
  i([
141
143
  e({ type: String }),
142
- s(c, B, n.type)
144
+ c(d, B, n.type)
143
145
  ], t.prototype, "type", 2);
144
146
  i([
145
147
  e({ type: Object })
package/dist/react.d.ts CHANGED
@@ -6,6 +6,7 @@ import { TemplateResult } from 'lit-html';
6
6
 
7
7
  declare type AriaProps = {
8
8
  label?: string;
9
+ expanded?: boolean;
9
10
  };
10
11
 
11
12
  export declare const buttonTypes: readonly ["submit", "button", "reset", "menu"];
@@ -18,7 +19,7 @@ export declare const iconPlacements: readonly ["leading", "trailing"];
18
19
 
19
20
  export declare interface LinkProps {
20
21
  /**
21
- * The ARIA labels used for the link.
22
+ * ARIA properties used for the link.
22
23
  */
23
24
  aria?: AriaProps;
24
25
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-link",
3
3
  "description": "PIE Design System Link built using Web Components",
4
- "version": "1.4.0",
4
+ "version": "1.5.0",
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.2",
47
+ "@justeattakeaway/pie-css": "1.4.0",
48
48
  "@justeattakeaway/pie-monorepo-utils": "0.9.8",
49
49
  "@justeattakeaway/pie-wrapper-react": "0.14.5"
50
50
  },
51
51
  "dependencies": {
52
- "@justeattakeaway/pie-icons-webc": "1.27.1",
53
- "@justeattakeaway/pie-webc-core": "16.1.0"
52
+ "@justeattakeaway/pie-icons-webc": "1.27.3",
53
+ "@justeattakeaway/pie-webc-core": "17.0.0"
54
54
  },
55
55
  "customElements": "custom-elements.json",
56
56
  "sideEffects": [
package/src/defs.ts CHANGED
@@ -9,11 +9,12 @@ export const underlineTypes = ['default', 'reversed'] as const;
9
9
 
10
10
  type AriaProps = {
11
11
  label?: string;
12
+ expanded?: boolean;
12
13
  };
13
14
 
14
15
  export interface LinkProps {
15
16
  /**
16
- * The ARIA labels used for the link.
17
+ * ARIA properties used for the link.
17
18
  */
18
19
  aria?: AriaProps;
19
20
  /**
package/src/index.ts CHANGED
@@ -106,6 +106,7 @@ export class PieLink extends PieElement implements LinkProps {
106
106
  class="${classMap(classes)}"
107
107
  type=${this.type}
108
108
  aria-label=${ifDefined(this.aria?.label)}
109
+ aria-expanded=${ifDefined(this.aria?.expanded)}
109
110
  part="base">
110
111
  ${this.renderContent()}
111
112
  </button>`;
@@ -126,6 +127,7 @@ export class PieLink extends PieElement implements LinkProps {
126
127
  rel=${ifDefined(this.rel)}
127
128
  download="${ifDefined(this.download)}"
128
129
  aria-label=${ifDefined(this.aria?.label)}
130
+ aria-expanded=${ifDefined(this.aria?.expanded)}
129
131
  part="base">
130
132
  ${this.renderContent()}
131
133
  </a>`;