@justeattakeaway/pie-modal 0.6.0 → 0.6.1
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/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[
|
|
1
|
+
[2:38:36 PM] @custom-elements-manifest/analyzer: Created new manifest.
|
|
2
2
|
react wrapper has been added!
|
|
3
3
|
[36mvite v4.3.9 [32mbuilding for production...[36m[39m
|
|
4
4
|
transforming...
|
|
@@ -14,6 +14,6 @@ computing gzip size...
|
|
|
14
14
|
[7m27[0m _dialog: HTMLDialogElement;
|
|
15
15
|
[7m [0m [91m ~~~~~~~[0m
|
|
16
16
|
|
|
17
|
-
[32m✓ built in
|
|
18
|
-
[32m[36m[vite:dts][32m Declaration files built in
|
|
17
|
+
[32m✓ built in 23.71s[39m
|
|
18
|
+
[32m[36m[vite:dts][32m Declaration files built in 21869ms.
|
|
19
19
|
[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @justeattakeaway/pie-modal
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [Changed] - Updated defs to use different array type syntax ([#566](https://github.com/justeattakeaway/pie/pull/566)) by [@ashleynolan](https://github.com/ashleynolan)
|
|
8
|
+
|
|
3
9
|
## 0.6.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -17,65 +17,92 @@
|
|
|
17
17
|
|
|
18
18
|
# pie-modal
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
`pie-modal` is a Web Component built using the Lit library. It offers a simple and accessible modal component for web applications, which uses the native HTML `dialog` element under the hood.
|
|
21
|
+
|
|
22
|
+
This component can be easily integrated into various frontend frameworks and customized through a set of properties.
|
|
21
23
|
|
|
22
24
|
## Local development
|
|
23
25
|
|
|
24
|
-
Install dependencies
|
|
25
|
-
|
|
26
|
+
Install the dependencies. Note that this, and the following commands below, should be run from the **root of the monorepo**:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
26
29
|
yarn
|
|
27
30
|
```
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
cd packages/components/pie-modal
|
|
32
|
-
yarn build
|
|
33
|
-
```
|
|
32
|
+
To build the `pie-modal` package, run the following command:
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
```bash
|
|
35
|
+
yarn build --filter=pie-modal
|
|
36
36
|
```
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
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:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
yarn watch --filter=pie-modal
|
|
42
|
+
|
|
43
|
+
# in a separate terminal tab, run
|
|
44
|
+
yarn dev --filter=pie-storybook
|
|
38
45
|
```
|
|
39
46
|
|
|
40
47
|
### Importing the component
|
|
41
48
|
|
|
42
|
-
```
|
|
49
|
+
```js
|
|
43
50
|
// default
|
|
44
|
-
import { PieModal } from '@justeattakeaway/pie-
|
|
51
|
+
import { PieModal } from '@justeattakeaway/pie-modal';
|
|
45
52
|
|
|
46
53
|
// react
|
|
47
|
-
import { PieModal } from '@justeattakeaway/pie-
|
|
54
|
+
import { PieModal } from '@justeattakeaway/pie-modal/dist/react';
|
|
48
55
|
```
|
|
49
56
|
|
|
50
57
|
## Props
|
|
51
58
|
|
|
52
|
-
| Property
|
|
53
|
-
|
|
54
|
-
| isOpen
|
|
55
|
-
| heading*
|
|
56
|
-
| headingLevel | `String`
|
|
59
|
+
| Property | Type | Default | Description |
|
|
60
|
+
|----------------|-----------|---------|-------------------------------------------------------|
|
|
61
|
+
| isOpen | `Boolean` | `false` | Controls if the modal element is open or closed |
|
|
62
|
+
| heading* | `String` | - | Sets the heading of the modal |
|
|
63
|
+
| headingLevel | `String` | `h2` | Allows you to set the heading tag (from `h1` to `h6`) |
|
|
64
|
+
|
|
57
65
|
|
|
66
|
+
In your markup or JSX, you can then use these to set the properties for the `pie-modal` component:
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<!-- Native HTML -->
|
|
70
|
+
<pie-modal heading='My Awesome Heading' headingLevel='h3'>Click me!</pie-modal>
|
|
71
|
+
|
|
72
|
+
<!-- JSX -->
|
|
73
|
+
<PieModal heading='My Awesome Heading' headingLevel='h3'>Click me!</PieModal>
|
|
74
|
+
```
|
|
58
75
|
|
|
59
76
|
## Testing
|
|
60
77
|
|
|
61
|
-
###
|
|
78
|
+
### Browser tests
|
|
79
|
+
|
|
80
|
+
To run the browser tests, run the following command from the root of the monorepo:
|
|
62
81
|
|
|
63
|
-
|
|
82
|
+
```bash
|
|
83
|
+
yarn test:browsers --filter=pie-modal
|
|
64
84
|
```
|
|
85
|
+
|
|
86
|
+
### Visual tests
|
|
87
|
+
|
|
88
|
+
To run the visual regression tests, run the following command from the root of the monorepo:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
65
91
|
yarn test:visual --filter=pie-modal
|
|
66
92
|
```
|
|
67
93
|
|
|
68
94
|
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.
|
|
69
95
|
|
|
70
|
-
|
|
96
|
+
#### Setup via bash
|
|
71
97
|
|
|
72
|
-
```
|
|
98
|
+
```bash
|
|
73
99
|
export PERCY_TOKEN_PIE_MODAL=abcde
|
|
74
100
|
```
|
|
75
101
|
|
|
76
|
-
|
|
102
|
+
#### Setup via package.json
|
|
77
103
|
|
|
78
104
|
Under scripts `test:visual` replace the environment variable with the below:
|
|
79
105
|
|
|
80
|
-
```
|
|
106
|
+
```bash
|
|
81
107
|
PERCY_TOKEN_PIE_MODAL=abcde
|
|
108
|
+
```
|
|
@@ -17,7 +17,7 @@ export interface ModalProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* Modal heading levels/tags
|
|
19
19
|
*/
|
|
20
|
-
export declare const headingLevels: ModalProps['headingLevel']
|
|
20
|
+
export declare const headingLevels: Array<ModalProps['headingLevel']>;
|
|
21
21
|
/**
|
|
22
22
|
* Event name for when the modal is closed.
|
|
23
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../src/defs.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,YAAY,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACtD;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../src/defs.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,YAAY,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACtD;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAwC,CAAC;AAErG;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,oBAAoB,CAAC"}
|
package/package.json
CHANGED
package/src/defs.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface ModalProps {
|
|
|
18
18
|
/**
|
|
19
19
|
* Modal heading levels/tags
|
|
20
20
|
*/
|
|
21
|
-
export const headingLevels: ModalProps['headingLevel']
|
|
21
|
+
export const headingLevels: Array<ModalProps['headingLevel']> = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Event name for when the modal is closed.
|