@justeattakeaway/pie-modal 0.17.0 → 0.19.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/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-modal",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "PIE design system modal built using web components",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
- "types": "dist/types/index.d.ts",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "src",
11
+ "dist",
12
+ "**/*.d.ts"
13
+ ],
9
14
  "scripts": {
10
15
  "build": "yarn build:wrapper pie-modal && run -T vite build",
11
16
  "lint:scripts": "run -T eslint .",
package/src/defs.ts CHANGED
@@ -133,3 +133,19 @@ export const ON_MODAL_OPEN_EVENT = 'pie-modal-open';
133
133
  * @constant
134
134
  */
135
135
  export const ON_MODAL_BACK_EVENT = 'pie-modal-back';
136
+
137
+ /**
138
+ * Event name for when the modal leading action is clicked.
139
+ *
140
+ * @constant
141
+ */
142
+ export const ON_MODAL_LEADING_ACTION_CLICK = 'pie-modal-leading-action-click';
143
+
144
+ /**
145
+ * Event name for when the modal supporting action is clicked.
146
+ *
147
+ * @constant
148
+ */
149
+ export const ON_MODAL_SUPPORTING_ACTION_CLICK = 'pie-modal-supporting-action-click';
150
+
151
+ export type ModalActionType = 'leading' | 'supporting';
package/src/index.ts CHANGED
@@ -19,16 +19,19 @@ import {
19
19
  type AriaProps,
20
20
  type ActionProps,
21
21
  type ModalProps,
22
+ type ModalActionType,
22
23
  headingLevels,
23
24
  positions,
24
25
  sizes,
25
26
  ON_MODAL_BACK_EVENT,
26
27
  ON_MODAL_CLOSE_EVENT,
27
28
  ON_MODAL_OPEN_EVENT,
29
+ ON_MODAL_LEADING_ACTION_CLICK,
30
+ ON_MODAL_SUPPORTING_ACTION_CLICK,
28
31
  } from './defs';
29
32
 
30
33
  // Valid values available to consumers
31
- export { type ModalProps, headingLevels, sizes };
34
+ export * from './defs';
32
35
 
33
36
  const componentSelector = 'pie-modal';
34
37
 
@@ -36,6 +39,8 @@ const componentSelector = 'pie-modal';
36
39
  * @event {CustomEvent} pie-modal-open - when the modal is opened.
37
40
  * @event {CustomEvent} pie-modal-close - when the modal is closed.
38
41
  * @event {CustomEvent} pie-modal-back - when the modal back button is clicked.
42
+ * @event {CustomEvent} pie-modal-leading-action-click - when the modal leading action is clicked.
43
+ * @event {CustomEvent} pie-modal-supporting-action-click - when the modal supporting action is clicked.
39
44
  */
40
45
  export class PieModal extends RtlMixin(LitElement) implements ModalProps {
41
46
  @property({ type: Object })
@@ -192,6 +197,16 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
192
197
  }
193
198
  }
194
199
 
200
+ private _handleActionClick (actionType: ModalActionType) : void {
201
+ if (actionType === 'leading') {
202
+ this._dialog?.close('leading');
203
+ this._dispatchModalCustomEvent(ON_MODAL_LEADING_ACTION_CLICK);
204
+ } else if (actionType === 'supporting') {
205
+ this._dialog?.close('supporting');
206
+ this._dispatchModalCustomEvent(ON_MODAL_SUPPORTING_ACTION_CLICK);
207
+ }
208
+ }
209
+
195
210
  /**
196
211
  * Return focus to the specified element, providing the selector is valid
197
212
  * and the chosen element can be found.
@@ -263,7 +278,7 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
263
278
  aria-label="${ariaLabel || nothing}"
264
279
  type="submit"
265
280
  ?isFullWidth="${this.hasStackedActions}"
266
- @click="${() => this._dialog?.close('leading')}"
281
+ @click="${() => this._handleActionClick('leading')}"
267
282
  data-test-id="modal-leading-action">
268
283
  ${text}
269
284
  </pie-button>
@@ -299,7 +314,7 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
299
314
  aria-label="${ariaLabel || nothing}"
300
315
  type="reset"
301
316
  ?isFullWidth="${this.hasStackedActions}"
302
- @click="${() => this._dialog?.close('supporting')}"
317
+ @click="${() => this._handleActionClick('supporting')}"
303
318
  data-test-id="modal-supporting-action">
304
319
  ${text}
305
320
  </pie-button>
package/.eslintignore DELETED
@@ -1,5 +0,0 @@
1
- .turbo
2
- dist
3
- node_modules
4
- lit-browsers-report
5
- lit-visual-report
@@ -1,14 +0,0 @@
1
- [3:19:34 PM] @custom-elements-manifest/analyzer: Created new manifest.
2
- react wrapper has been added!
3
- vite v4.3.9 building for production...
4
- transforming...
5
- ✓ 28 modules transformed.
6
- rendering chunks...
7
- computing gzip size...
8
- dist/react.js 59.27 kB │ gzip: 15.99 kB
9
- dist/index.js 70.71 kB │ gzip: 19.04 kB
10
- 
11
- [vite:dts] Start generate declaration files...
12
- ✓ built in 12.06s
13
- [vite:dts] Declaration files built in 10809ms.
14
- 
package/CHANGELOG.md DELETED
@@ -1,209 +0,0 @@
1
- # @justeattakeaway/pie-modal
2
-
3
- ## 0.17.0
4
-
5
- ### Minor Changes
6
-
7
- - - [Changed] - updated Modal component dependencies adding the `dialog-polyfill` package ([#678](https://github.com/justeattakeaway/pie/pull/678)) by [@fernandofranca](https://github.com/fernandofranca)
8
-
9
- - [Changed] - updated Modal component to use `dialog-polyfill`
10
- - [Changed] - updated Modal documentation regarding the legacy browser support for Dialog element and polyfill usage and limitations
11
- - [Changed] - vanilla example app for testing Modal with `dialog-polyfill`
12
-
13
- ## 0.16.0
14
-
15
- ### Minor Changes
16
-
17
- - [Added] - hasStackedActions to pie-modal action buttons ([#650](https://github.com/justeattakeaway/pie/pull/650)) by [@ashleynolan](https://github.com/ashleynolan)
18
-
19
- - [Fixed] - Prevent tree-shaking of components in storybook ([#667](https://github.com/justeattakeaway/pie/pull/667)) by [@xander-marjoram](https://github.com/xander-marjoram)
20
-
21
- [Removed] - Built webc icons from source control
22
- [Added] - Type declaration files for components
23
- [Added] - Types for pie-icons
24
- [Added] - TS version of pie-icons-configs/config.js (Will be used after DSW-1025)
25
- [Added] - Webc icon tests for width, height and base classes
26
- [Changed] - Update pie-icons-webc build to generate a slightly different template for regular and large icons (using different types, etc.)
27
- [Changed] - Update pie-icons-webc rollup config to remove commonjs build
28
- [Changed] - Use `just-kebab-case` and `just-pascal-case` instead of `kebab-case` and `pascal-case` to simplify usage (and they're more recently maintained)
29
-
30
- - [Added] - New ActionProps type for modal leading/supporting actions ([#670](https://github.com/justeattakeaway/pie/pull/670)) by [@xander-marjoram](https://github.com/xander-marjoram)
31
-
32
- ### Patch Changes
33
-
34
- - [Fixed] - Re-add property decorator for modal position prop ([#676](https://github.com/justeattakeaway/pie/pull/676)) by [@xander-marjoram](https://github.com/xander-marjoram)
35
-
36
- ## 0.15.0
37
-
38
- ### Minor Changes
39
-
40
- - [Added] - isFooterPinned property to modal which offers more scrolling options to consumers ([#648](https://github.com/justeattakeaway/pie/pull/648)) by [@jamieomaguire](https://github.com/jamieomaguire)
41
-
42
- - [Added] - Modal aria labels to close, back and loading elements ([#652](https://github.com/justeattakeaway/pie/pull/652)) by [@kevinrodrigues](https://github.com/kevinrodrigues)
43
-
44
- - [Changed] - Add js/ts linting and fix errors ([#653](https://github.com/justeattakeaway/pie/pull/653)) by [@jamieomaguire](https://github.com/jamieomaguire)
45
-
46
- - [Added] SupportingAction prop to modal ([#643](https://github.com/justeattakeaway/pie/pull/643)) by [@kevinrodrigues](https://github.com/kevinrodrigues)
47
-
48
- ## 0.14.0
49
-
50
- ### Minor Changes
51
-
52
- - [Added] - `position` prop to modal ([#630](https://github.com/justeattakeaway/pie/pull/630)) by [@jamieomaguire](https://github.com/jamieomaguire)
53
-
54
- - [Changed] - Sync modal header styles with figma ([#627](https://github.com/justeattakeaway/pie/pull/627)) by [@jamieomaguire](https://github.com/jamieomaguire)
55
-
56
- - [Added] - prop for `leadingAction` to pie-modal ([#632](https://github.com/justeattakeaway/pie/pull/632)) by [@kevinrodrigues](https://github.com/kevinrodrigues)
57
-
58
- - [Changed] - Moved some tests from Visual to Component ([#613](https://github.com/justeattakeaway/pie/pull/613)) by [@JoshuaNg2332](https://github.com/JoshuaNg2332)
59
-
60
- ## 0.13.0
61
-
62
- ### Minor Changes
63
-
64
- - [Added] - Default modal footer ([#619](https://github.com/justeattakeaway/pie/pull/619)) by [@xander-marjoram](https://github.com/xander-marjoram)
65
-
66
- [Added] - Height styles for the different sizes
67
- [Removed] - Unnecessary `:focus-visible` outline for the modal
68
- [Fixed] - Modal width should be able to exceed 600px for `isFullWidthBelowMid`
69
-
70
- - [Added] - loading spinner to modal ([#628](https://github.com/justeattakeaway/pie/pull/628)) by [@jamieomaguire](https://github.com/jamieomaguire)
71
-
72
- - [Added] - Scroll shadow for modal contents ([#619](https://github.com/justeattakeaway/pie/pull/619)) by [@xander-marjoram](https://github.com/xander-marjoram)
73
-
74
- - [Added] - Tests to validate leading/supporting action buttons ([#619](https://github.com/justeattakeaway/pie/pull/619)) by [@xander-marjoram](https://github.com/xander-marjoram)
75
-
76
- [Added] - Missing tests to check that the modal closes when expected to
77
- [Changed] - Updated tests to verify that the correct event is being triggered
78
-
79
- - [Added] - hasBackButton prop to modal ([#623](https://github.com/justeattakeaway/pie/pull/623)) by [@jamieomaguire](https://github.com/jamieomaguire)
80
-
81
- ## 0.12.0
82
-
83
- ### Minor Changes
84
-
85
- - [Added] - @event jsdoc comments for modal events for react wrapper to analyse ([#612](https://github.com/justeattakeaway/pie/pull/612)) by [@jamieomaguire](https://github.com/jamieomaguire)
86
-
87
- ## 0.11.0
88
-
89
- ### Minor Changes
90
-
91
- - [Changed] - Ensure component implements it's props interface ([#611](https://github.com/justeattakeaway/pie/pull/611)) by [@jamieomaguire](https://github.com/jamieomaguire)
92
-
93
- - [Fixed] - Added IconClose to Visual tests and modal ([#604](https://github.com/justeattakeaway/pie/pull/604)) by [@ashleynolan](https://github.com/ashleynolan)
94
-
95
- ## 0.10.0
96
-
97
- ### Minor Changes
98
-
99
- - [Added] - Add returnFocusAfterCloseSelector prop ([#599](https://github.com/justeattakeaway/pie/pull/599)) by [@xander-marjoram](https://github.com/xander-marjoram)
100
-
101
- [Changed] - Extract `renderTestPieModal` into test helper file so it can be used for component tests too
102
- [Added] - Add README documentation for new props
103
-
104
- - [Fixed] - Fix console errors when switching between stories ([#599](https://github.com/justeattakeaway/pie/pull/599)) by [@xander-marjoram](https://github.com/xander-marjoram)
105
-
106
- - [Added] - New `isFullWidthBelowMid` prop for pie-modal ([#600](https://github.com/justeattakeaway/pie/pull/600)) by [@LTurns](https://github.com/LTurns)
107
-
108
- - [Added] isDismissible prop and tests ([#588](https://github.com/justeattakeaway/pie/pull/588)) by [@kevinrodrigues](https://github.com/kevinrodrigues)
109
-
110
- ## 0.9.0
111
-
112
- ### Minor Changes
113
-
114
- - [Changed] - Set modal props to public ([#597](https://github.com/justeattakeaway/pie/pull/597)) by [@jamieomaguire](https://github.com/jamieomaguire)
115
-
116
- ## 0.8.0
117
-
118
- ### Minor Changes
119
-
120
- - [Added] - New size prop for pie-modal ([#572](https://github.com/justeattakeaway/pie/pull/572)) by [@xander-marjoram](https://github.com/xander-marjoram)
121
-
122
- [Added] - Visual regression test for each size
123
- [Changed] - Modal story to include new size prop
124
-
125
- ## 0.7.0
126
-
127
- ### Minor Changes
128
-
129
- - [Added] - Modal backdrop functionality ([#559](https://github.com/justeattakeaway/pie/pull/559)) by [@kevinrodrigues](https://github.com/kevinrodrigues)
130
-
131
- - [Added] - Scroll locking to modal ([#564](https://github.com/justeattakeaway/pie/pull/564)) by [@jamieomaguire](https://github.com/jamieomaguire)
132
-
133
- ## 0.6.1
134
-
135
- ### Patch Changes
136
-
137
- - [Changed] - Updated defs to use different array type syntax ([#566](https://github.com/justeattakeaway/pie/pull/566)) by [@ashleynolan](https://github.com/ashleynolan)
138
-
139
- ## 0.6.0
140
-
141
- ### Minor Changes
142
-
143
- - [Changed] - Updated styles to use custom props ([#551](https://github.com/justeattakeaway/pie/pull/551)) by [@ashleynolan](https://github.com/ashleynolan)
144
-
145
- - [Added] - close button to modal ([#549](https://github.com/justeattakeaway/pie/pull/549)) by [@kevinrodrigues](https://github.com/kevinrodrigues)
146
-
147
- ## 0.5.0
148
-
149
- ### Minor Changes
150
-
151
- - [Updated] - enum types to string union types to string union types ([#508](https://github.com/justeattakeaway/pie/pull/508)) by [@FayeCarter](https://github.com/FayeCarter)
152
-
153
- ## 0.4.0
154
-
155
- ### Minor Changes
156
-
157
- - [Added] - `heading` and `headingLevel` props to the modal component ([#530](https://github.com/justeattakeaway/pie/pull/530)) by [@raoufswe](https://github.com/raoufswe)
158
-
159
- - [Added] - Modal heading added to component ([#513](https://github.com/justeattakeaway/pie/pull/513)) by [@fernandofranca](https://github.com/fernandofranca)
160
-
161
- [Added] - Basic styling for modal default state
162
-
163
- - [Changed] - moved pie-webc-core dependency to devDependencies in each component ([#499](https://github.com/justeattakeaway/pie/pull/499)) by [@jamieomaguire](https://github.com/jamieomaguire)
164
-
165
- - [Added] - Additional notes on visual tests and environment variables ([#525](https://github.com/justeattakeaway/pie/pull/525)) by [@jamieomaguire](https://github.com/jamieomaguire)
166
-
167
- - [Added] prop to control modal open & close state ([#527](https://github.com/justeattakeaway/pie/pull/527)) by [@kevinrodrigues](https://github.com/kevinrodrigues)
168
-
169
- - [Added] Read me percy config examples ([#529](https://github.com/justeattakeaway/pie/pull/529)) by [@kevinrodrigues](https://github.com/kevinrodrigues)
170
-
171
- ### Patch Changes
172
-
173
- - [Fixed] - PieModal CSS by adding logical property ([#521](https://github.com/justeattakeaway/pie/pull/521)) by [@fernandofranca](https://github.com/fernandofranca)
174
-
175
- ## 0.3.0
176
-
177
- ### Minor Changes
178
-
179
- - [Changed] - Build script to include generating react wrapper ([#426](https://github.com/justeattakeaway/pie/pull/426)) by [@LTurns](https://github.com/LTurns)
180
-
181
- ### Patch Changes
182
-
183
- - [Added] - Missing `test:ci` scripts to package.json ([#492](https://github.com/justeattakeaway/pie/pull/492)) by [@siggerzz](https://github.com/siggerzz)
184
-
185
- - [Updated] - components to use the shared configurations ([#487](https://github.com/justeattakeaway/pie/pull/487)) by [@fernandofranca](https://github.com/fernandofranca)
186
-
187
- - Updated dependencies [[`090354733`](https://github.com/justeattakeaway/pie/commit/090354733f24f0aa52ce287db7f8d13648414150)]:
188
- - @justeattakeaway/pie-webc-core@0.2.0
189
-
190
- ## 0.2.0
191
-
192
- ### Minor Changes
193
-
194
- - [Changed] - use RTL mixin on component ([#478](https://github.com/justeattakeaway/pie/pull/478)) by [@jamieomaguire](https://github.com/jamieomaguire)
195
-
196
- ### Patch Changes
197
-
198
- - Updated dependencies [[`1f79d9d1a`](https://github.com/justeattakeaway/pie/commit/1f79d9d1a6fe9160b244e82d956290136b87187b)]:
199
- - @justeattakeaway/pie-webc-core@0.1.0
200
-
201
- ## 0.1.1
202
-
203
- ### Patch Changes
204
-
205
- - [Added] - PieModal component shell ([#439](https://github.com/justeattakeaway/pie/pull/439)) by [@fernandofranca](https://github.com/fernandofranca)
206
-
207
- [Added] - README and LICENSE files
208
- [Added] - Initial TypeScript and Vite config
209
- [Added] - `declaration.d.ts` file for TypeScript
@@ -1 +0,0 @@
1
- export * from './packages/components/pie-modal/src/index'
@@ -1,110 +0,0 @@
1
- import { RTLComponentProps } from '@justeattakeaway/pie-webc-core';
2
- import { Variant } from '@justeattakeaway/pie-button/src/defs.ts';
3
- export declare const headingLevels: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
4
- export declare const sizes: readonly ["small", "medium", "large"];
5
- export declare const positions: readonly ["top", "center"];
6
- export type AriaProps = {
7
- close?: string;
8
- back?: string;
9
- loading?: string;
10
- };
11
- export type ActionProps = {
12
- /**
13
- * The text to display inside the button.
14
- */
15
- text: string;
16
- /**
17
- * The button variant.
18
- */
19
- variant?: Variant;
20
- /**
21
- * The ARIA label for the button.
22
- */
23
- ariaLabel?: string;
24
- };
25
- export type ModalProps = RTLComponentProps & {
26
- /**
27
- * The ARIA labels used for the modal close and back buttons, as well as loading state.
28
- */
29
- aria?: AriaProps;
30
- /**
31
- * When true, the modal will have a back button. This currently behaves the same as the close button.
32
- */
33
- hasBackButton: boolean;
34
- /**
35
- * When true, the modal will have a back button. This currently behaves the same as the close button.
36
- */
37
- hasStackedActions: boolean;
38
- /**
39
- * The text to display in the modal's heading.
40
- */
41
- heading: string;
42
- /**
43
- * The HTML heading tag to use for the modal's heading. Can be h1-h6.
44
- */
45
- headingLevel: typeof headingLevels[number];
46
- /**
47
- * When true, the modal will be open.
48
- */
49
- isOpen: boolean;
50
- /**
51
- * When set to `true`:
52
- * 1. The close button within the modal will be visible.
53
- * 2. The user can dismiss the modal via the ESCAPE key, clicking the backdrop
54
- * or via a close button.
55
- *
56
- * When set to `false`:
57
- * 1. The close button within the modal will be hidden.
58
- * 2. The user can NOT dismiss the modal via the ESCAPE key or clicking the backdrop.
59
- *
60
- */
61
- isDismissible: boolean;
62
- /**
63
- * When false, the modal footer will scroll with the content inside the modal body.
64
- */
65
- isFooterPinned: boolean;
66
- /**
67
- * This controls whether a *medium-sized* modal will cover the full width of the page when below the mid breakpoint.
68
- */
69
- isFullWidthBelowMid: boolean;
70
- /**
71
- * When true, displays a loading spinner in the modal.
72
- */
73
- isLoading: boolean;
74
- /**
75
- * The leading action configuration for the modal.
76
- */
77
- leadingAction: ActionProps;
78
- position: typeof positions[number];
79
- /**
80
- * The selector for the element that you would like focus to be returned to when the modal is closed, e.g., #skipToMain
81
- */
82
- returnFocusAfterCloseSelector?: string;
83
- /**
84
- * The size of the modal; this controls how wide it will appear on the page.
85
- */
86
- size: typeof sizes[number];
87
- /**
88
- * The supporting action configuration for the modal.
89
- */
90
- supportingAction: ActionProps;
91
- };
92
- /**
93
- * Event name for when the modal is closed.
94
- *
95
- * @constant
96
- */
97
- export declare const ON_MODAL_CLOSE_EVENT = "pie-modal-close";
98
- /**
99
- * Event name for when the modal is opened.
100
- *
101
- * @constant
102
- */
103
- export declare const ON_MODAL_OPEN_EVENT = "pie-modal-open";
104
- /**
105
- * Event name for when the modal back button is clicked.
106
- *
107
- * @constant
108
- */
109
- export declare const ON_MODAL_BACK_EVENT = "pie-modal-back";
110
- //# sourceMappingURL=defs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../src/defs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAElE,eAAO,MAAM,aAAa,+CAAgD,CAAC;AAC3E,eAAO,MAAM,KAAK,uCAAwC,CAAC;AAC3D,eAAO,MAAM,SAAS,4BAA6B,CAAC;AAEpD,MAAM,MAAM,SAAS,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IAClB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG;IACzC;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,YAAY,EAAE,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;IAE3C;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;;;;;;OAUG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,mBAAmB,EAAE,OAAO,CAAC;IAE7B;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,aAAa,EAAE,WAAW,CAAC;IAK3B,QAAQ,EAAE,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAEnC;;OAEG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;IAEvC;;OAEG;IACH,IAAI,EAAE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3B;;OAEG;IACH,gBAAgB,EAAE,WAAW,CAAC;CACjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,mBAAmB,CAAC"}
@@ -1,126 +0,0 @@
1
- import { LitElement, TemplateResult } from 'lit';
2
- import type { DependentMap } from '@justeattakeaway/pie-webc-core';
3
- import { type AriaProps, type ActionProps, type ModalProps, headingLevels, sizes } from './defs';
4
- export { type ModalProps, headingLevels, sizes };
5
- declare const componentSelector = "pie-modal";
6
- declare const PieModal_base: (new (...args: any[]) => {
7
- dir: "ltr" | "rtl" | "auto";
8
- isRTL: boolean;
9
- }) & typeof LitElement;
10
- /**
11
- * @event {CustomEvent} pie-modal-open - when the modal is opened.
12
- * @event {CustomEvent} pie-modal-close - when the modal is closed.
13
- * @event {CustomEvent} pie-modal-back - when the modal back button is clicked.
14
- */
15
- export declare class PieModal extends PieModal_base implements ModalProps {
16
- aria: AriaProps;
17
- heading: string;
18
- headingLevel: ModalProps['headingLevel'];
19
- hasBackButton: boolean;
20
- hasStackedActions: boolean;
21
- isDismissible: boolean;
22
- isFooterPinned: boolean;
23
- isFullWidthBelowMid: boolean;
24
- isLoading: boolean;
25
- isOpen: boolean;
26
- leadingAction: ActionProps;
27
- position: ModalProps['position'];
28
- returnFocusAfterCloseSelector?: string;
29
- size: ModalProps['size'];
30
- supportingAction: ActionProps;
31
- private _dialog?;
32
- private _backButtonClicked;
33
- static styles: import("lit").CSSResult;
34
- constructor();
35
- connectedCallback(): void;
36
- disconnectedCallback(): void;
37
- firstUpdated(changedProperties: DependentMap<ModalProps>): void;
38
- updated(changedProperties: DependentMap<ModalProps>): void;
39
- /**
40
- * Opens the dialog element and disables page scrolling
41
- */
42
- private _handleModalOpened;
43
- /**
44
- * Closes the dialog element and re-enables page scrolling
45
- */
46
- private _handleModalClosed;
47
- /**
48
- * Prevents the user from dismissing the dialog via the `cancel`
49
- * event (ESC key) when `isDismissible` is set to false.
50
- *
51
- * @param {Event} event - The event object.
52
- */
53
- private _handleDialogCancelEvent;
54
- private _handleModalOpenStateOnFirstRender;
55
- private _handleModalOpenStateChanged;
56
- /**
57
- * Return focus to the specified element, providing the selector is valid
58
- * and the chosen element can be found.
59
- */
60
- private _returnFocus;
61
- /**
62
- * Template for the close button element. Called within the
63
- * main render function.
64
- *
65
- * @private
66
- */
67
- private renderCloseButton;
68
- /**
69
- * Template for the back button element. Called within the
70
- * main render function.
71
- *
72
- * @private
73
- */
74
- private renderBackButton;
75
- /**
76
- * Render leadingAction button depending on prop availability.
77
- *
78
- * 1. If the prop `leadingAction` is not provided, the button is not rendered.
79
- * 2. If the prop `leadingAction` is provided but any of the optional properties
80
- * are not provided, they fall back to their default values.
81
- *
82
- * @private
83
- */
84
- private renderLeadingAction;
85
- /**
86
- * Render supportingAction button depending on prop availability.
87
- *
88
- * 1. If the prop `supportingAction` is not provided, the button is not rendered.
89
- * 2. If the prop `supportingAction` is provided but any of the optional properties
90
- * are not provided, they fall back to their default values.
91
- * 3. If `supportingAction` is provided but not `leadingAction`, log a warning and do
92
- * not render `supportingAction`.
93
- *
94
- * @private
95
- */
96
- private renderSupportingAction;
97
- /**
98
- * Renders the modal inner content and footer of the modal.
99
- * @private
100
- */
101
- private renderModalContentAndFooter;
102
- render(): TemplateResult;
103
- /**
104
- * Dismisses the modal on backdrop click if `isDismissible` is `true`.
105
- * @param {MouseEvent} event - the click event targetting the modal/backdrop
106
- */
107
- private _handleDialogLightDismiss;
108
- /**
109
- * Note: We should aim to have a shareable event helper system to allow
110
- * us to share this across components in-future.
111
- *
112
- * Dispatch a custom event.
113
- *
114
- * To be used whenever we have behavioural events we want to
115
- * bubble up through the modal.
116
- *
117
- * @param {string} eventType
118
- */
119
- private _dispatchModalCustomEvent;
120
- }
121
- declare global {
122
- interface HTMLElementTagNameMap {
123
- [componentSelector]: PieModal;
124
- }
125
- }
126
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EAAW,cAAc,EACtC,MAAM,KAAK,CAAC;AAMb,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,yDAAyD,CAAC;AACjE,OAAO,+DAA+D,CAAC;AACvE,OAAO,gEAAgE,CAAC;AAKxE,OAAO,EACH,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,aAAa,EAEb,KAAK,EAIR,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,KAAK,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AAEjD,QAAA,MAAM,iBAAiB,cAAc,CAAC;;;;;AAEtC;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,aAAqB,YAAW,UAAU;IAE7D,IAAI,EAAG,SAAS,CAAC;IAIjB,OAAO,EAAG,MAAM,CAAC;IAIjB,YAAY,EAAE,UAAU,CAAC,cAAc,CAAC,CAAQ;IAGhD,aAAa,UAAS;IAGtB,iBAAiB,UAAS;IAG1B,aAAa,UAAS;IAGtB,cAAc,UAAQ;IAGtB,mBAAmB,UAAS;IAG5B,SAAS,UAAS;IAGlB,MAAM,UAAS;IAGf,aAAa,EAAG,WAAW,CAAC;IAI5B,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,CAAY;IAG5C,6BAA6B,CAAC,EAAE,MAAM,CAAC;IAIvC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAY;IAGpC,gBAAgB,EAAG,WAAW,CAAC;IAGtC,OAAO,CAAC,OAAO,CAAC,CAAoB;IAEpC,OAAO,CAAC,kBAAkB,CAAS;IAGnC,MAAM,CAAC,MAAM,0BAAqB;;IAOlC,iBAAiB,IAAM,IAAI;IAO3B,oBAAoB,IAAM,IAAI;IAO9B,YAAY,CAAE,iBAAiB,EAAE,YAAY,CAAC,UAAU,CAAC,GAAI,IAAI;IAYjE,OAAO,CAAE,iBAAiB,EAAE,YAAY,CAAC,UAAU,CAAC,GAAI,IAAI;IAI5D;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAS1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAM1B;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB,CAI9B;IAGF,OAAO,CAAC,kCAAkC;IAU1C,OAAO,CAAC,4BAA4B;IAkBpC;;;OAGG;IACH,OAAO,CAAC,YAAY;IAQpB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAoB3B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,sBAAsB;IAyB9B;;;OAGG;IACH,OAAO,CAAC,2BAA2B;IAa5B,MAAM;IAuDb;;;OAGG;IACH,OAAO,CAAC,yBAAyB,CAyB/B;IAEF;;;;;;;;;;OAUG;IACH,OAAO,CAAC,yBAAyB,CAO/B;CACL;AAID,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC;KACjC;CACJ"}
@@ -1,8 +0,0 @@
1
- import { EventName } from '@lit-labs/react';
2
- import { PieModal as PieModalReact } from './index';
3
- export declare const PieModal: import("@lit-labs/react").ReactWebComponent<PieModalReact, {
4
- onPieModalOpen: EventName<CustomEvent<any>>;
5
- onPieModalClose: EventName<CustomEvent<any>>;
6
- onPieModalBack: EventName<CustomEvent<any>>;
7
- }>;
8
- //# sourceMappingURL=react.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/react.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,QAAQ;;;;EAUnB,CAAC"}
@@ -1 +0,0 @@
1
- export * from './packages/components/pie-modal/src/react'
@@ -1,56 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <link rel="preload" href="https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Regular-optimised.woff2" as="font" type="font/woff2" crossorigin>
7
- <link rel="preload" href="https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Bold-optimised.woff2" as="font" type="font/woff2" crossorigin>
8
- <link rel="preload" href="https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-ExtraBold-optimised.woff2" as="font" type="font/woff2" crossorigin>
9
- <style>
10
- @font-face {
11
- font-family: JETSansDigital;
12
- src: url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Regular-optimised.woff2') format("woff2"),
13
- url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Regular-optimised.woff') format("woff");
14
- font-weight: 400;
15
- font-display: swap;
16
- }
17
- @font-face {
18
- font-family: JETSansDigital;
19
- src: url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Bold-optimised.woff2') format("woff2"),
20
- url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Bold-optimised.woff') format("woff");
21
- font-weight: 700;
22
- font-display: swap;
23
- }
24
- @font-face {
25
- font-family: JETSansDigital;
26
- src: url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-ExtraBold-optimised.woff2') format("woff2"),
27
- url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-ExtraBold-optimised.woff') format("woff");
28
- font-weight: 800;
29
- font-display: swap;
30
- }
31
- body {
32
- font-feature-settings: "tnum"; /* Enable tabular numbers */
33
- }
34
- /* basic styles to center align components and give them some spacing */
35
- #root {
36
- padding: 1em;
37
- }
38
-
39
- #root > * {
40
- display: block;
41
- margin-inline: auto;
42
- }
43
-
44
- #root > * + * {
45
- margin-top: 1em;
46
- }
47
- </style>
48
- <title>Testing Page</title>
49
- <link rel="stylesheet" type="text/css" href="https://unpkg.com/@justeat/pie-design-tokens/dist/jet.css" />
50
- <link rel="stylesheet" type="text/css" href="https://unpkg.com/@justeat/pie-design-tokens/dist/jet-hsl-colors.css" />
51
- </head>
52
- <body>
53
- <div id="root"></div>
54
- <script type="module" src="./index.ts"></script>
55
- </body>
56
- </html>
@@ -1 +0,0 @@
1
- // Import common styles here