@justeattakeaway/pie-divider 0.7.0 → 0.9.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 +5 -61
- package/dist/index.d.ts +3 -0
- package/dist/index.js +27 -23
- package/dist/react.d.ts +3 -0
- package/package.json +2 -2
- package/src/index.ts +5 -2
package/README.md
CHANGED
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
1. [Introduction](#pie-divider)
|
|
14
14
|
2. [Installation](#installation)
|
|
15
15
|
3. [Importing the component](#importing-the-component)
|
|
16
|
-
4. [
|
|
17
|
-
5. [
|
|
18
|
-
6. [
|
|
19
|
-
7. [Testing](#testing)
|
|
16
|
+
4. [Peer Dependencies](#peer-dependencies)
|
|
17
|
+
5. [Props](#props)
|
|
18
|
+
6. [Contributing](#contributing)
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
## pie-divider
|
|
@@ -57,31 +56,6 @@ import { PieDivider } from '@justeattakeaway/pie-divider/dist/react';
|
|
|
57
56
|
> [!IMPORTANT]
|
|
58
57
|
> When using `pie-divider`, you will also need to include a couple of dependencies to ensure the component renders as expected. See [the PIE Wiki](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components#expected-dependencies) for more information and how to include these in your application.
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
## Local development
|
|
62
|
-
|
|
63
|
-
Install the dependencies. Note that this, and the following commands below, should be run from the **root of the monorepo**:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
yarn
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
To build the `pie-divider` package, run the following command:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
yarn build --filter=pie-divider
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
If you'd like to develop using the component storybook, then you should build the component in `watch` mode, and run storybook in a separate terminal tab:
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
yarn watch --filter=pie-divider
|
|
79
|
-
|
|
80
|
-
# in a separate terminal tab, run
|
|
81
|
-
yarn dev --filter=pie-storybook
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
|
|
85
59
|
## Props
|
|
86
60
|
|
|
87
61
|
| Property | Type | Default | Description |
|
|
@@ -99,36 +73,6 @@ In your markup or JSX, you can then use these to set the properties for the `pie
|
|
|
99
73
|
<PieDivider />
|
|
100
74
|
```
|
|
101
75
|
|
|
102
|
-
##
|
|
103
|
-
|
|
104
|
-
### Browser tests
|
|
105
|
-
|
|
106
|
-
To run the browser tests, run the following command from the root of the monorepo:
|
|
76
|
+
## Contributing
|
|
107
77
|
|
|
108
|
-
|
|
109
|
-
yarn test:browsers --filter=pie-divider
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Visual tests
|
|
113
|
-
|
|
114
|
-
To run the visual regression tests, run the following command from the root of the monorepo:
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
yarn test:visual --filter=pie-divider
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Note: To run these locally, you will need to ensure that any environment variables required are set up on your machine to mirror those on CI (such as Percy tokens). How you achieve this will differ between operating systems.
|
|
121
|
-
|
|
122
|
-
#### Setup via bash
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
export PERCY_TOKEN_PIE_DIVIDER=abcde
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
#### Setup via package.json
|
|
129
|
-
|
|
130
|
-
Under scripts `test:visual` replace the environment variable with the below:
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
PERCY_TOKEN_PIE_DIVIDER=abcde
|
|
134
|
-
```
|
|
78
|
+
Check out our [contributing guide](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide) for more information on [local development](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#local-development) and how to run specific [component tests](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#testing).
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ export declare interface DividerProps {
|
|
|
15
15
|
|
|
16
16
|
export declare const orientations: readonly ["horizontal", "vertical"];
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @tagname pie-divider
|
|
20
|
+
*/
|
|
18
21
|
export declare class PieDivider extends LitElement implements DividerProps {
|
|
19
22
|
variant: DividerProps['variant'];
|
|
20
23
|
orientation: DividerProps['orientation'];
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import { unsafeCSS as u, LitElement as f, html as g } from "lit";
|
|
2
2
|
import { property as c } from "lit/decorators.js";
|
|
3
|
-
const l = (
|
|
4
|
-
const
|
|
5
|
-
Object.defineProperty(
|
|
3
|
+
const l = (i, e, r) => function(t, o) {
|
|
4
|
+
const n = `#${o}`;
|
|
5
|
+
Object.defineProperty(t, o, {
|
|
6
6
|
get() {
|
|
7
|
-
return this[
|
|
7
|
+
return this[n];
|
|
8
8
|
},
|
|
9
9
|
set(s) {
|
|
10
|
-
const p = this[
|
|
11
|
-
|
|
12
|
-
`<${
|
|
13
|
-
`Must be one of: ${
|
|
10
|
+
const p = this[n];
|
|
11
|
+
e.includes(s) ? this[n] = s : (console.error(
|
|
12
|
+
`<${i}> Invalid value "${s}" provided for property "${o}".`,
|
|
13
|
+
`Must be one of: ${e.join(" | ")}.`,
|
|
14
14
|
`Falling back to default value: "${r}"`
|
|
15
|
-
), this[
|
|
15
|
+
), this[n] = r), this.requestUpdate(o, p);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
};
|
|
19
|
+
function m(i, e) {
|
|
20
|
+
customElements.get(i) ? console.warn(`PIE Web Component: "${i}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(i, e);
|
|
21
|
+
}
|
|
22
|
+
const b = `.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%}
|
|
23
|
+
`, P = ["default", "inverse"], y = ["horizontal", "vertical"];
|
|
24
|
+
var $ = Object.defineProperty, w = Object.getOwnPropertyDescriptor, h = (i, e, r, d) => {
|
|
25
|
+
for (var t = d > 1 ? void 0 : d ? w(e, r) : e, o = i.length - 1, n; o >= 0; o--)
|
|
26
|
+
(n = i[o]) && (t = (d ? n(e, r, t) : n(t)) || t);
|
|
27
|
+
return d && t && $(e, r, t), t;
|
|
24
28
|
};
|
|
25
29
|
const v = "pie-divider";
|
|
26
30
|
class a extends f {
|
|
@@ -28,29 +32,29 @@ class a extends f {
|
|
|
28
32
|
super(...arguments), this.variant = "default", this.orientation = "horizontal";
|
|
29
33
|
}
|
|
30
34
|
render() {
|
|
31
|
-
const { variant:
|
|
35
|
+
const { variant: e, orientation: r } = this;
|
|
32
36
|
return g`
|
|
33
37
|
<hr
|
|
34
38
|
data-test-id="pie-divider"
|
|
35
39
|
aria-hidden="true"
|
|
36
40
|
class="c-divider"
|
|
37
|
-
variant=${
|
|
41
|
+
variant=${e}
|
|
38
42
|
orientation=${r}
|
|
39
43
|
/>`;
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
|
-
a.styles = u(
|
|
46
|
+
a.styles = u(b);
|
|
43
47
|
h([
|
|
44
48
|
c({ type: String }),
|
|
45
|
-
l(v,
|
|
49
|
+
l(v, P, "default")
|
|
46
50
|
], a.prototype, "variant", 2);
|
|
47
51
|
h([
|
|
48
52
|
c({ type: String }),
|
|
49
|
-
l(v,
|
|
53
|
+
l(v, y, "horizontal")
|
|
50
54
|
], a.prototype, "orientation", 2);
|
|
51
|
-
|
|
55
|
+
m(v, a);
|
|
52
56
|
export {
|
|
53
57
|
a as PieDivider,
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
y as orientations,
|
|
59
|
+
P as variants
|
|
56
60
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -18,6 +18,9 @@ export declare const orientations: readonly ["horizontal", "vertical"];
|
|
|
18
18
|
|
|
19
19
|
export declare const PieDivider: ReactWebComponent<PieDivider_2, {}>;
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @tagname pie-divider
|
|
23
|
+
*/
|
|
21
24
|
declare class PieDivider_2 extends LitElement implements DividerProps {
|
|
22
25
|
variant: DividerProps['variant'];
|
|
23
26
|
orientation: DividerProps['orientation'];
|
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.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@justeattakeaway/pie-components-config": "0.4.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
34
|
+
"@justeattakeaway/pie-webc-core": "0.11.0"
|
|
35
35
|
},
|
|
36
36
|
"volta": {
|
|
37
37
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, unsafeCSS } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { validPropertyValues } from '@justeattakeaway/pie-webc-core';
|
|
3
|
+
import { validPropertyValues, defineCustomElement } from '@justeattakeaway/pie-webc-core';
|
|
4
4
|
import styles from './divider.scss?inline';
|
|
5
5
|
import { DividerProps, variants, orientations } from './defs';
|
|
6
6
|
|
|
@@ -9,6 +9,9 @@ export * from './defs';
|
|
|
9
9
|
|
|
10
10
|
const componentSelector = 'pie-divider';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @tagname pie-divider
|
|
14
|
+
*/
|
|
12
15
|
export class PieDivider extends LitElement implements DividerProps {
|
|
13
16
|
@property({ type: String })
|
|
14
17
|
@validPropertyValues(componentSelector, variants, 'default')
|
|
@@ -35,7 +38,7 @@ export class PieDivider extends LitElement implements DividerProps {
|
|
|
35
38
|
static styles = unsafeCSS(styles);
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
defineCustomElement(componentSelector, PieDivider);
|
|
39
42
|
|
|
40
43
|
declare global {
|
|
41
44
|
interface HTMLElementTagNameMap {
|