@justeattakeaway/pie-divider 0.13.8 → 0.13.9

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.
@@ -76,18 +76,12 @@
76
76
  {
77
77
  "kind": "field",
78
78
  "name": "variant",
79
- "type": {
80
- "text": "DividerProps['variant']"
81
- },
82
79
  "privacy": "public",
83
80
  "attribute": "variant"
84
81
  },
85
82
  {
86
83
  "kind": "field",
87
84
  "name": "orientation",
88
- "type": {
89
- "text": "DividerProps['orientation']"
90
- },
91
85
  "privacy": "public",
92
86
  "attribute": "orientation"
93
87
  }
@@ -95,16 +89,10 @@
95
89
  "attributes": [
96
90
  {
97
91
  "name": "variant",
98
- "type": {
99
- "text": "DividerProps['variant']"
100
- },
101
92
  "fieldName": "variant"
102
93
  },
103
94
  {
104
95
  "name": "orientation",
105
- "type": {
106
- "text": "DividerProps['orientation']"
107
- },
108
96
  "fieldName": "orientation"
109
97
  }
110
98
  ],
package/dist/index.d.ts CHANGED
@@ -24,8 +24,8 @@ export declare const orientations: readonly ["horizontal", "vertical"];
24
24
  * @tagname pie-divider
25
25
  */
26
26
  export declare class PieDivider extends LitElement implements DividerProps {
27
- variant: DividerProps['variant'];
28
- orientation: DividerProps['orientation'];
27
+ variant: "default" | "inverse";
28
+ orientation: "horizontal" | "vertical";
29
29
  render(): TemplateResult<1>;
30
30
  static styles: CSSResult;
31
31
  }
package/dist/index.js CHANGED
@@ -1,46 +1,48 @@
1
1
  import { unsafeCSS as h, LitElement as f, html as u } from "lit";
2
2
  import { property as c } from "lit/decorators.js";
3
+ import { classMap as m } from "lit/directives/class-map.js";
3
4
  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 = {
5
+ const b = `*,*: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.c-divider--inverse{--divider-bg-color: var(--dt-color-divider-inverse)}.c-divider.c-divider--vertical{--divider-width: 1px;--divider-height: 100%}
6
+ `, y = ["default", "inverse"], P = ["horizontal", "vertical"], o = {
6
7
  variant: "default",
7
8
  orientation: "horizontal"
8
9
  };
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;
10
+ var w = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, p = (n, r, e, t) => {
11
+ for (var i = t > 1 ? void 0 : t ? _(r, e) : r, a = n.length - 1, v; a >= 0; a--)
12
+ (v = n[a]) && (i = (t ? v(r, e, i) : v(i)) || i);
13
+ return t && i && w(r, e, i), i;
13
14
  };
14
15
  const s = "pie-divider";
15
- class n extends f {
16
+ class d extends f {
16
17
  constructor() {
17
18
  super(...arguments), this.variant = o.variant, this.orientation = o.orientation;
18
19
  }
19
20
  render() {
20
- const { variant: r, orientation: t } = this;
21
+ const { variant: r, orientation: e } = this;
21
22
  return u`
22
23
  <hr
23
24
  data-test-id="pie-divider"
24
25
  aria-hidden="true"
25
- class="c-divider"
26
- variant=${r}
27
- orientation=${t}
28
- />`;
26
+ class="${m({
27
+ "c-divider": !0,
28
+ "c-divider--inverse": r === "inverse",
29
+ "c-divider--vertical": e === "vertical"
30
+ })}" />`;
29
31
  }
30
32
  }
31
- n.styles = h(m);
33
+ d.styles = h(b);
32
34
  p([
33
35
  c({ type: String }),
34
- l(s, b, o.variant)
35
- ], n.prototype, "variant", 2);
36
+ l(s, y, o.variant)
37
+ ], d.prototype, "variant", 2);
36
38
  p([
37
39
  c({ type: String }),
38
- l(s, y, o.orientation)
39
- ], n.prototype, "orientation", 2);
40
- g(s, n);
40
+ l(s, P, o.orientation)
41
+ ], d.prototype, "orientation", 2);
42
+ g(s, d);
41
43
  export {
42
- n as PieDivider,
44
+ d as PieDivider,
43
45
  o as defaultProps,
44
- y as orientations,
45
- b as variants
46
+ P as orientations,
47
+ y as variants
46
48
  };
package/dist/react.d.ts CHANGED
@@ -27,8 +27,8 @@ export declare const PieDivider: React_2.ForwardRefExoticComponent<DividerProps
27
27
  * @tagname pie-divider
28
28
  */
29
29
  declare class PieDivider_2 extends LitElement implements DividerProps {
30
- variant: DividerProps['variant'];
31
- orientation: DividerProps['orientation'];
30
+ variant: "default" | "inverse";
31
+ orientation: "horizontal" | "vertical";
32
32
  render(): TemplateResult<1>;
33
33
  static styles: CSSResult;
34
34
  }
package/dist/react.js CHANGED
@@ -1,9 +1,10 @@
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 { defaultProps as c, orientations as P, variants as f } from "./index.js";
4
+ import { defaultProps as P, orientations as f, variants as D } from "./index.js";
5
5
  import "lit";
6
6
  import "lit/decorators.js";
7
+ import "lit/directives/class-map.js";
7
8
  import "@justeattakeaway/pie-webc-core";
8
9
  const t = i({
9
10
  displayName: "PieDivider",
@@ -11,10 +12,10 @@ const t = i({
11
12
  react: e,
12
13
  tagName: "pie-divider",
13
14
  events: {}
14
- }), d = t;
15
+ }), n = t;
15
16
  export {
16
- d as PieDivider,
17
- c as defaultProps,
18
- P as orientations,
19
- f as variants
17
+ n as PieDivider,
18
+ P as defaultProps,
19
+ f as orientations,
20
+ D as variants
20
21
  };
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.8",
4
+ "version": "0.13.9",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
package/src/defs-react.ts CHANGED
@@ -1,3 +1,3 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
 
3
3
  export type ReactBaseType = React.HTMLAttributes<HTMLHRElement>
package/src/divider.scss CHANGED
@@ -11,19 +11,11 @@
11
11
  height: var(--divider-height);
12
12
  background-color: var(--divider-bg-color);
13
13
 
14
- &[variant='default'] {
15
- /* Same as default styles */
16
- }
17
-
18
- &[variant='inverse'] {
14
+ &.c-divider--inverse {
19
15
  --divider-bg-color: var(--dt-color-divider-inverse);
20
16
  }
21
17
 
22
- &[orientation='horizontal'] {
23
- /* Same as default styles */
24
- }
25
-
26
- &[orientation='vertical'] {
18
+ &.c-divider--vertical {
27
19
  --divider-width: 1px;
28
20
  --divider-height: 100%;
29
21
  }
package/src/index.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { LitElement, html, unsafeCSS } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
- import { validPropertyValues, defineCustomElement } from '@justeattakeaway/pie-webc-core';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import { defineCustomElement, validPropertyValues } from '@justeattakeaway/pie-webc-core';
4
5
  import styles from './divider.scss?inline';
5
6
  import {
6
- DividerProps, variants, orientations, defaultProps,
7
+ type DividerProps, defaultProps, orientations, variants,
7
8
  } from './defs';
8
9
 
9
10
  // Valid values available to consumers
@@ -17,23 +18,26 @@ const componentSelector = 'pie-divider';
17
18
  export class PieDivider extends LitElement implements DividerProps {
18
19
  @property({ type: String })
19
20
  @validPropertyValues(componentSelector, variants, defaultProps.variant)
20
- public variant: DividerProps['variant'] = defaultProps.variant;
21
+ public variant = defaultProps.variant;
21
22
 
22
23
  @property({ type: String })
23
24
  @validPropertyValues(componentSelector, orientations, defaultProps.orientation)
24
- public orientation : DividerProps['orientation'] = defaultProps.orientation;
25
+ public orientation = defaultProps.orientation;
25
26
 
26
27
  render () {
27
28
  const { variant, orientation } = this;
28
29
 
30
+ const classes = {
31
+ 'c-divider': true,
32
+ 'c-divider--inverse': variant === 'inverse',
33
+ 'c-divider--vertical': orientation === 'vertical',
34
+ };
35
+
29
36
  return html`
30
37
  <hr
31
38
  data-test-id="pie-divider"
32
39
  aria-hidden="true"
33
- class="c-divider"
34
- variant=${variant}
35
- orientation=${orientation}
36
- />`;
40
+ class="${classMap(classes)}" />`;
37
41
  }
38
42
 
39
43
  // Renders a `CSSResult` generated from SCSS by Vite