@justeattakeaway/pie-divider 0.13.4 → 0.13.6

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
@@ -20,16 +20,14 @@ This component can be easily integrated into various frontend frameworks and cus
20
20
  To install `pie-divider` in your application, run the following on your command line:
21
21
 
22
22
  ```bash
23
- # npm
24
- $ npm i @justeattakeaway/pie-divider
23
+ npm i @justeattakeaway/pie-divider
25
24
 
26
- # yarn
27
- $ yarn add @justeattakeaway/pie-divider
25
+ yarn add @justeattakeaway/pie-divider
28
26
  ```
29
27
 
30
28
  ## Documentation
31
29
 
32
- Visit [Divider | PIE Design System](https://pie.design/components/divider/overview) to view more information on this component.
30
+ Visit [Divider | PIE Design System](https://pie.design/components/divider) to view more information on this component.
33
31
 
34
32
  ## Questions
35
33
 
@@ -27,6 +27,14 @@
27
27
  "text": "['horizontal', 'vertical']"
28
28
  },
29
29
  "default": "['horizontal', 'vertical']"
30
+ },
31
+ {
32
+ "kind": "variable",
33
+ "name": "defaultProps",
34
+ "type": {
35
+ "text": "DefaultProps"
36
+ },
37
+ "default": "{\n variant: 'default',\n orientation: 'horizontal',\n}"
30
38
  }
31
39
  ],
32
40
  "exports": [
@@ -45,6 +53,14 @@
45
53
  "name": "orientations",
46
54
  "module": "src/defs.js"
47
55
  }
56
+ },
57
+ {
58
+ "kind": "js",
59
+ "name": "defaultProps",
60
+ "declaration": {
61
+ "name": "defaultProps",
62
+ "module": "src/defs.js"
63
+ }
48
64
  }
49
65
  ]
50
66
  },
@@ -64,7 +80,6 @@
64
80
  "text": "DividerProps['variant']"
65
81
  },
66
82
  "privacy": "public",
67
- "default": "'default'",
68
83
  "attribute": "variant"
69
84
  },
70
85
  {
@@ -74,7 +89,6 @@
74
89
  "text": "DividerProps['orientation']"
75
90
  },
76
91
  "privacy": "public",
77
- "default": "'horizontal'",
78
92
  "attribute": "orientation"
79
93
  }
80
94
  ],
@@ -84,7 +98,6 @@
84
98
  "type": {
85
99
  "text": "DividerProps['variant']"
86
100
  },
87
- "default": "'default'",
88
101
  "fieldName": "variant"
89
102
  },
90
103
  {
@@ -92,7 +105,6 @@
92
105
  "type": {
93
106
  "text": "DividerProps['orientation']"
94
107
  },
95
- "default": "'horizontal'",
96
108
  "fieldName": "orientation"
97
109
  }
98
110
  ],
package/dist/index.d.ts CHANGED
@@ -1,7 +1,12 @@
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-html';
4
5
 
6
+ export declare type DefaultProps = ComponentDefaultPropsGeneric<DividerProps, 'variant' | 'orientation'>;
7
+
8
+ export declare const defaultProps: DefaultProps;
9
+
5
10
  export declare interface DividerProps {
6
11
  /**
7
12
  * What style variant the divider should be such as default or vertical.
package/dist/index.js CHANGED
@@ -1,42 +1,46 @@
1
- import { unsafeCSS as h, LitElement as p, html as f } from "lit";
2
- import { property as s } from "lit/decorators.js";
3
- import { validPropertyValues as l, defineCustomElement as u } from "@justeattakeaway/pie-webc-core";
4
- const g = `*,*:after,*:before{box-sizing:inherit}.c-divider{--divider-bg-color: var(--dt-color-divider-default);--divider-width: 100%;--divider-height: 1px;margin:0;border:0;width:var(--divider-width);height:var(--divider-height);background-color:var(--divider-bg-color)}.c-divider[variant=inverse]{--divider-bg-color: var(--dt-color-divider-inverse)}.c-divider[orientation=vertical]{--divider-width: 1px;--divider-height: 100%}
5
- `, m = ["default", "inverse"], b = ["horizontal", "vertical"];
6
- var y = Object.defineProperty, w = Object.getOwnPropertyDescriptor, c = (d, r, e, t) => {
7
- for (var i = t > 1 ? void 0 : t ? w(r, e) : r, n = d.length - 1, a; n >= 0; n--)
8
- (a = d[n]) && (i = (t ? a(r, e, i) : a(i)) || i);
9
- return t && i && y(r, e, i), i;
1
+ import { unsafeCSS as h, LitElement as f, html as u } from "lit";
2
+ import { property as c } from "lit/decorators.js";
3
+ import { validPropertyValues as l, defineCustomElement as g } from "@justeattakeaway/pie-webc-core";
4
+ const m = `*,*:after,*:before{box-sizing:inherit}.c-divider{--divider-bg-color: var(--dt-color-divider-default);--divider-width: 100%;--divider-height: 1px;margin:0;border:0;width:var(--divider-width);height:var(--divider-height);background-color:var(--divider-bg-color)}.c-divider[variant=inverse]{--divider-bg-color: var(--dt-color-divider-inverse)}.c-divider[orientation=vertical]{--divider-width: 1px;--divider-height: 100%}
5
+ `, b = ["default", "inverse"], y = ["horizontal", "vertical"], o = {
6
+ variant: "default",
7
+ orientation: "horizontal"
10
8
  };
11
- const v = "pie-divider";
12
- class o extends p {
9
+ var P = Object.defineProperty, w = Object.getOwnPropertyDescriptor, p = (a, r, t, e) => {
10
+ for (var i = e > 1 ? void 0 : e ? w(r, t) : r, d = a.length - 1, v; d >= 0; d--)
11
+ (v = a[d]) && (i = (e ? v(r, t, i) : v(i)) || i);
12
+ return e && i && P(r, t, i), i;
13
+ };
14
+ const s = "pie-divider";
15
+ class n extends f {
13
16
  constructor() {
14
- super(...arguments), this.variant = "default", this.orientation = "horizontal";
17
+ super(...arguments), this.variant = o.variant, this.orientation = o.orientation;
15
18
  }
16
19
  render() {
17
- const { variant: r, orientation: e } = this;
18
- return f`
20
+ const { variant: r, orientation: t } = this;
21
+ return u`
19
22
  <hr
20
23
  data-test-id="pie-divider"
21
24
  aria-hidden="true"
22
25
  class="c-divider"
23
- variant=${r || "default"}
24
- orientation=${e || "horizontal"}
26
+ variant=${r}
27
+ orientation=${t}
25
28
  />`;
26
29
  }
27
30
  }
28
- o.styles = h(g);
29
- c([
30
- s({ type: String }),
31
- l(v, m, "default")
32
- ], o.prototype, "variant", 2);
33
- c([
34
- s({ type: String }),
35
- l(v, b, "horizontal")
36
- ], o.prototype, "orientation", 2);
37
- u(v, o);
31
+ n.styles = h(m);
32
+ p([
33
+ c({ type: String }),
34
+ l(s, b, o.variant)
35
+ ], n.prototype, "variant", 2);
36
+ p([
37
+ c({ type: String }),
38
+ l(s, y, o.orientation)
39
+ ], n.prototype, "orientation", 2);
40
+ g(s, n);
38
41
  export {
39
- o as PieDivider,
40
- b as orientations,
41
- m as variants
42
+ n as PieDivider,
43
+ o as defaultProps,
44
+ y as orientations,
45
+ b as variants
42
46
  };
package/dist/react.d.ts CHANGED
@@ -1,8 +1,13 @@
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';
4
5
  import type { TemplateResult } from 'lit-html';
5
6
 
7
+ export declare type DefaultProps = ComponentDefaultPropsGeneric<DividerProps, 'variant' | 'orientation'>;
8
+
9
+ export declare const defaultProps: DefaultProps;
10
+
6
11
  export declare interface DividerProps {
7
12
  /**
8
13
  * What style variant the divider should be such as default or vertical.
package/dist/react.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as e from "react";
2
2
  import { createComponent as i } from "@lit/react";
3
3
  import { PieDivider as r } from "./index.js";
4
- import { orientations as c, variants as D } from "./index.js";
4
+ import { defaultProps as c, orientations as P, variants as f } from "./index.js";
5
5
  import "lit";
6
6
  import "lit/decorators.js";
7
7
  import "@justeattakeaway/pie-webc-core";
@@ -11,9 +11,10 @@ const t = i({
11
11
  react: e,
12
12
  tagName: "pie-divider",
13
13
  events: {}
14
- }), n = t;
14
+ }), d = t;
15
15
  export {
16
- n as PieDivider,
17
- c as orientations,
18
- D as variants
16
+ d as PieDivider,
17
+ c as defaultProps,
18
+ P as orientations,
19
+ f as variants
19
20
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-divider",
3
3
  "description": "PIE Design System Divider built using Web Components",
4
- "version": "0.13.4",
4
+ "version": "0.13.6",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -37,11 +37,11 @@
37
37
  "devDependencies": {
38
38
  "@custom-elements-manifest/analyzer": "0.9.0",
39
39
  "@justeattakeaway/pie-components-config": "0.16.0",
40
- "@justeattakeaway/pie-wrapper-react": "0.14.0",
40
+ "@justeattakeaway/pie-wrapper-react": "0.14.1",
41
41
  "cem-plugin-module-file-extensions": "0.0.5"
42
42
  },
43
43
  "dependencies": {
44
- "@justeattakeaway/pie-webc-core": "0.22.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', 'inverse'] as const;
2
4
  export const orientations = ['horizontal', 'vertical'] as const;
3
5
 
@@ -11,3 +13,10 @@ export interface DividerProps {
11
13
  */
12
14
  orientation?: typeof orientations[number];
13
15
  }
16
+
17
+ export type DefaultProps = ComponentDefaultPropsGeneric<DividerProps, 'variant' | 'orientation'>;
18
+
19
+ export const defaultProps: DefaultProps = {
20
+ variant: 'default',
21
+ orientation: 'horizontal',
22
+ };
package/src/index.ts CHANGED
@@ -2,7 +2,9 @@ import { LitElement, html, unsafeCSS } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
3
  import { validPropertyValues, defineCustomElement } from '@justeattakeaway/pie-webc-core';
4
4
  import styles from './divider.scss?inline';
5
- import { DividerProps, variants, orientations } from './defs';
5
+ import {
6
+ DividerProps, variants, orientations, defaultProps,
7
+ } from './defs';
6
8
 
7
9
  // Valid values available to consumers
8
10
  export * from './defs';
@@ -14,12 +16,12 @@ const componentSelector = 'pie-divider';
14
16
  */
15
17
  export class PieDivider extends LitElement implements DividerProps {
16
18
  @property({ type: String })
17
- @validPropertyValues(componentSelector, variants, 'default')
18
- public variant: DividerProps['variant'] = 'default';
19
+ @validPropertyValues(componentSelector, variants, defaultProps.variant)
20
+ public variant: DividerProps['variant'] = defaultProps.variant;
19
21
 
20
22
  @property({ type: String })
21
- @validPropertyValues(componentSelector, orientations, 'horizontal')
22
- public orientation : DividerProps['orientation'] = 'horizontal';
23
+ @validPropertyValues(componentSelector, orientations, defaultProps.orientation)
24
+ public orientation : DividerProps['orientation'] = defaultProps.orientation;
23
25
 
24
26
  render () {
25
27
  const { variant, orientation } = this;
@@ -29,8 +31,8 @@ export class PieDivider extends LitElement implements DividerProps {
29
31
  data-test-id="pie-divider"
30
32
  aria-hidden="true"
31
33
  class="c-divider"
32
- variant=${variant || 'default'}
33
- orientation=${orientation || 'horizontal'}
34
+ variant=${variant}
35
+ orientation=${orientation}
34
36
  />`;
35
37
  }
36
38