@justeattakeaway/pie-assistive-text 0.3.6 → 0.3.7

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.
@@ -19,6 +19,14 @@
19
19
  "text": "['default', 'error', 'success']"
20
20
  },
21
21
  "default": "['default', 'error', 'success']"
22
+ },
23
+ {
24
+ "kind": "variable",
25
+ "name": "defaultProps",
26
+ "type": {
27
+ "text": "DefaultProps"
28
+ },
29
+ "default": "{\n variant: 'default',\n}"
22
30
  }
23
31
  ],
24
32
  "exports": [
@@ -29,6 +37,14 @@
29
37
  "name": "variants",
30
38
  "module": "src/defs.js"
31
39
  }
40
+ },
41
+ {
42
+ "kind": "js",
43
+ "name": "defaultProps",
44
+ "declaration": {
45
+ "name": "defaultProps",
46
+ "module": "src/defs.js"
47
+ }
32
48
  }
33
49
  ]
34
50
  },
@@ -54,7 +70,6 @@
54
70
  "text": "AssistiveTextProps['variant'] | undefined"
55
71
  },
56
72
  "privacy": "public",
57
- "default": "'default'",
58
73
  "attribute": "variant"
59
74
  },
60
75
  {
@@ -75,7 +90,6 @@
75
90
  "type": {
76
91
  "text": "AssistiveTextProps['variant'] | undefined"
77
92
  },
78
- "default": "'default'",
79
93
  "fieldName": "variant"
80
94
  }
81
95
  ],
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ComponentDefaultPropsGeneric } from '@justeattakeaway/pie-webc-core';
1
2
  import type { CSSResult } from 'lit';
2
3
  import type { LitElement } from 'lit';
3
4
  import type { TemplateResult } from 'lit';
@@ -9,6 +10,10 @@ export declare interface AssistiveTextProps {
9
10
  variant?: typeof variants[number];
10
11
  }
11
12
 
13
+ export declare type DefaultProps = ComponentDefaultPropsGeneric<AssistiveTextProps, 'variant'>;
14
+
15
+ export declare const defaultProps: DefaultProps;
16
+
12
17
  /**
13
18
  * @tagname pie-assistive-text
14
19
  * @slot - Default slot
package/dist/index.js CHANGED
@@ -1,20 +1,22 @@
1
- import { unsafeCSS as p, LitElement as f, html as i, nothing as l } from "lit";
2
- import { property as d } from "lit/decorators.js";
3
- import { validPropertyValues as x, defineCustomElement as m } from "@justeattakeaway/pie-webc-core";
4
- import { ifDefined as h } from "lit/directives/if-defined.js";
1
+ import { unsafeCSS as f, LitElement as d, html as i, nothing as l } from "lit";
2
+ import { property as x } from "lit/decorators.js";
3
+ import { validPropertyValues as m, defineCustomElement as h } from "@justeattakeaway/pie-webc-core";
4
+ import { ifDefined as u } from "lit/directives/if-defined.js";
5
5
  import "@justeattakeaway/pie-icons-webc/dist/IconAlertCircle.js";
6
6
  import "@justeattakeaway/pie-icons-webc/dist/IconCheckCircle.js";
7
- const u = `*,*:after,*:before{box-sizing:inherit}.c-assistiveText{--assistive-text-color: var(--dt-color-content-default);margin:0;padding-block-start:var(--dt-spacing-a);color:var(--assistive-text-color);font-family:var(--dt-font-body-s-family);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);gap:var(--dt-spacing-b);display:flex;align-items:flex-start;overflow-wrap:anywhere}.c-assistiveText[variant=success]{--assistive-text-color: var(--dt-color-content-positive)}.c-assistiveText[variant=error]{--assistive-text-color: var(--dt-color-content-error)}.c-assistiveText .c-assistiveText-icon{display:inline-flex}
8
- `, y = ["default", "error", "success"];
9
- var g = Object.defineProperty, b = Object.getOwnPropertyDescriptor, T = (r, t, o, s) => {
10
- for (var e = s > 1 ? void 0 : s ? b(t, o) : t, a = r.length - 1, c; a >= 0; a--)
11
- (c = r[a]) && (e = (s ? c(t, o, e) : c(e)) || e);
12
- return s && e && g(t, o, e), e;
7
+ const y = `*,*:after,*:before{box-sizing:inherit}.c-assistiveText{--assistive-text-color: var(--dt-color-content-default);margin:0;padding-block-start:var(--dt-spacing-a);color:var(--assistive-text-color);font-family:var(--dt-font-body-s-family);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);gap:var(--dt-spacing-b);display:flex;align-items:flex-start;overflow-wrap:anywhere}.c-assistiveText[variant=success]{--assistive-text-color: var(--dt-color-content-positive)}.c-assistiveText[variant=error]{--assistive-text-color: var(--dt-color-content-error)}.c-assistiveText .c-assistiveText-icon{display:inline-flex}
8
+ `, g = ["default", "error", "success"], v = {
9
+ variant: "default"
13
10
  };
14
- const v = "pie-assistive-text";
15
- class n extends f {
11
+ var b = Object.defineProperty, T = Object.getOwnPropertyDescriptor, w = (r, t, o, s) => {
12
+ for (var e = s > 1 ? void 0 : s ? T(t, o) : t, a = r.length - 1, n; a >= 0; a--)
13
+ (n = r[a]) && (e = (s ? n(t, o, e) : n(e)) || e);
14
+ return s && e && b(t, o, e), e;
15
+ };
16
+ const p = "pie-assistive-text";
17
+ class c extends d {
16
18
  constructor() {
17
- super(...arguments), this.variant = "default";
19
+ super(...arguments), this.variant = v.variant;
18
20
  }
19
21
  /**
20
22
  * Renders the assistive-text icon content.
@@ -34,19 +36,20 @@ class n extends f {
34
36
  <p
35
37
  class="c-assistiveText"
36
38
  data-test-id="pie-assistive-text"
37
- variant=${h(t)}>
39
+ variant=${u(t)}>
38
40
  ${this.renderIcon()}
39
41
  <slot></slot>
40
42
  </p>`;
41
43
  }
42
44
  }
43
- n.styles = p(u);
44
- T([
45
- d({ type: String }),
46
- x(v, y, "default")
47
- ], n.prototype, "variant", 2);
48
- m(v, n);
45
+ c.styles = f(y);
46
+ w([
47
+ x({ type: String }),
48
+ m(p, g, v.variant)
49
+ ], c.prototype, "variant", 2);
50
+ h(p, c);
49
51
  export {
50
- n as PieAssistiveText,
51
- y as variants
52
+ c as PieAssistiveText,
53
+ v as defaultProps,
54
+ g as variants
52
55
  };
package/dist/react.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ComponentDefaultPropsGeneric } from '@justeattakeaway/pie-webc-core';
1
2
  import type { CSSResult } from 'lit';
2
3
  import type { LitElement } from 'lit';
3
4
  import * as React_2 from 'react';
@@ -10,6 +11,10 @@ export declare interface AssistiveTextProps {
10
11
  variant?: typeof variants[number];
11
12
  }
12
13
 
14
+ export declare type DefaultProps = ComponentDefaultPropsGeneric<AssistiveTextProps, 'variant'>;
15
+
16
+ export declare const defaultProps: DefaultProps;
17
+
13
18
  export declare const PieAssistiveText: React_2.ForwardRefExoticComponent<AssistiveTextProps & React_2.RefAttributes<PieAssistiveText_2> & ReactBaseType>;
14
19
 
15
20
  /**
package/dist/react.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as t from "react";
2
2
  import { createComponent as e } from "@lit/react";
3
3
  import { PieAssistiveText as i } from "./index.js";
4
- import { variants as T } from "./index.js";
4
+ import { defaultProps as A, variants as T } from "./index.js";
5
5
  import "lit";
6
6
  import "lit/decorators.js";
7
7
  import "@justeattakeaway/pie-webc-core";
@@ -17,5 +17,6 @@ const s = e({
17
17
  }), c = s;
18
18
  export {
19
19
  c as PieAssistiveText,
20
+ A as defaultProps,
20
21
  T as variants
21
22
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-assistive-text",
3
3
  "description": "PIE Design System Assistive Text built using Web Components",
4
- "version": "0.3.6",
4
+ "version": "0.3.7",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,8 +40,8 @@
40
40
  "cem-plugin-module-file-extensions": "0.0.5"
41
41
  },
42
42
  "dependencies": {
43
- "@justeattakeaway/pie-icons-webc": "0.23.1",
44
- "@justeattakeaway/pie-webc-core": "0.22.0"
43
+ "@justeattakeaway/pie-icons-webc": "0.24.0",
44
+ "@justeattakeaway/pie-webc-core": "0.23.0"
45
45
  },
46
46
  "volta": {
47
47
  "extends": "../../../package.json"
package/src/defs.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { type ComponentDefaultPropsGeneric } from '@justeattakeaway/pie-webc-core';
2
+
1
3
  export const variants = ['default', 'error', 'success'] as const;
2
4
 
3
5
  export interface AssistiveTextProps {
@@ -6,3 +8,9 @@ export interface AssistiveTextProps {
6
8
  */
7
9
  variant?: typeof variants[number];
8
10
  }
11
+
12
+ export type DefaultProps = ComponentDefaultPropsGeneric<AssistiveTextProps, 'variant'>;
13
+
14
+ export const defaultProps: DefaultProps = {
15
+ variant: 'default',
16
+ };
package/src/index.ts CHANGED
@@ -9,7 +9,7 @@ import '@justeattakeaway/pie-icons-webc/dist/IconAlertCircle.js';
9
9
  import '@justeattakeaway/pie-icons-webc/dist/IconCheckCircle.js';
10
10
 
11
11
  import styles from './assistive-text.scss?inline';
12
- import { AssistiveTextProps, variants } from './defs';
12
+ import { AssistiveTextProps, variants, defaultProps } from './defs';
13
13
 
14
14
  // Valid values available to consumers
15
15
  export * from './defs';
@@ -22,8 +22,8 @@ const componentSelector = 'pie-assistive-text';
22
22
  */
23
23
  export class PieAssistiveText extends LitElement implements AssistiveTextProps {
24
24
  @property({ type: String })
25
- @validPropertyValues(componentSelector, variants, 'default')
26
- public variant?: AssistiveTextProps['variant'] = 'default';
25
+ @validPropertyValues(componentSelector, variants, defaultProps.variant)
26
+ public variant?: AssistiveTextProps['variant'] = defaultProps.variant;
27
27
 
28
28
  /**
29
29
  * Renders the assistive-text icon content.