@internetarchive/modal-manager 0.2.8 → 0.2.9-alpha.2

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.
Files changed (73) hide show
  1. package/.editorconfig +29 -29
  2. package/.eslintrc.js +14 -14
  3. package/.github/workflows/ci.yml +26 -26
  4. package/LICENSE +661 -661
  5. package/README.md +139 -139
  6. package/custom-elements.json +170 -170
  7. package/demo/index.html +278 -278
  8. package/dist/index.d.ts +7 -7
  9. package/dist/index.js +5 -5
  10. package/dist/index.js.map +1 -1
  11. package/dist/src/modal-config.d.ts +92 -92
  12. package/dist/src/modal-config.js +22 -22
  13. package/dist/src/modal-config.js.map +1 -1
  14. package/dist/src/modal-manager-host-bridge-interface.d.ts +12 -12
  15. package/dist/src/modal-manager-host-bridge-interface.js.map +1 -1
  16. package/dist/src/modal-manager-host-bridge.d.ts +34 -34
  17. package/dist/src/modal-manager-host-bridge.js +62 -62
  18. package/dist/src/modal-manager-host-bridge.js.map +1 -1
  19. package/dist/src/modal-manager-interface.d.ts +25 -25
  20. package/dist/src/modal-manager-interface.js.map +1 -1
  21. package/dist/src/modal-manager-mode.d.ts +10 -10
  22. package/dist/src/modal-manager-mode.js +11 -11
  23. package/dist/src/modal-manager-mode.js.map +1 -1
  24. package/dist/src/modal-manager.d.ts +108 -108
  25. package/dist/src/modal-manager.js +189 -189
  26. package/dist/src/modal-manager.js.map +1 -1
  27. package/dist/src/modal-template.d.ts +32 -32
  28. package/dist/src/modal-template.js +276 -276
  29. package/dist/src/modal-template.js.map +1 -1
  30. package/dist/test/modal-config.test.d.ts +1 -1
  31. package/dist/test/modal-config.test.js +61 -61
  32. package/dist/test/modal-config.test.js.map +1 -1
  33. package/dist/test/modal-manager.test.d.ts +1 -1
  34. package/dist/test/modal-manager.test.js +200 -200
  35. package/dist/test/modal-manager.test.js.map +1 -1
  36. package/dist/test/modal-template.test.d.ts +1 -1
  37. package/dist/test/modal-template.test.js +95 -95
  38. package/dist/test/modal-template.test.js.map +1 -1
  39. package/docs/assets/css/main.css +2678 -2678
  40. package/docs/classes/_src_modal_config_.modalconfig.html +429 -429
  41. package/docs/classes/_src_modal_manager_.modalmanager.html +7702 -7702
  42. package/docs/classes/_src_modal_manager_host_bridge_.modalmanagerhostbridge.html +409 -409
  43. package/docs/classes/_src_modal_template_.modaltemplate.html +7096 -7096
  44. package/docs/enums/_src_modal_manager_mode_.modalmanagermode.html +196 -196
  45. package/docs/globals.html +150 -150
  46. package/docs/index.html +252 -252
  47. package/docs/interfaces/_src_modal_manager_host_bridge_interface_.modalmanagerhostbridgeinterface.html +210 -210
  48. package/docs/interfaces/_src_modal_manager_interface_.modalmanagerinterface.html +7095 -7095
  49. package/docs/modules/_index_.html +208 -208
  50. package/docs/modules/_src_modal_config_.html +146 -146
  51. package/docs/modules/_src_modal_manager_.html +146 -146
  52. package/docs/modules/_src_modal_manager_host_bridge_.html +146 -146
  53. package/docs/modules/_src_modal_manager_host_bridge_interface_.html +146 -146
  54. package/docs/modules/_src_modal_manager_interface_.html +146 -146
  55. package/docs/modules/_src_modal_manager_mode_.html +146 -146
  56. package/docs/modules/_src_modal_template_.html +146 -146
  57. package/docs/modules/_test_modal_config_test_.html +106 -106
  58. package/docs/modules/_test_modal_manager_test_.html +106 -106
  59. package/docs/modules/_test_modal_template_test_.html +106 -106
  60. package/index.ts +7 -7
  61. package/karma.conf.js +24 -24
  62. package/package.json +82 -82
  63. package/src/modal-config.ts +117 -117
  64. package/src/modal-manager-host-bridge-interface.ts +13 -13
  65. package/src/modal-manager-host-bridge.ts +82 -82
  66. package/src/modal-manager-interface.ts +28 -28
  67. package/src/modal-manager-mode.ts +10 -10
  68. package/src/modal-manager.ts +228 -228
  69. package/src/modal-template.ts +279 -279
  70. package/test/modal-config.test.ts +69 -69
  71. package/test/modal-manager.test.ts +245 -245
  72. package/test/modal-template.test.ts +111 -111
  73. package/tsconfig.json +20 -20
package/README.md CHANGED
@@ -1,139 +1,139 @@
1
- ![Build Status](https://github.com/internetarchive/iaux-modal-manager/actions/workflows/ci.yml/badge.svg) [![codecov](https://codecov.io/gh/internetarchive/iaux-modal-manager/branch/master/graph/badge.svg)](https://codecov.io/gh/internetarchive/iaux-modal-manager)
2
-
3
- # Modal Manager Component
4
-
5
- A modal manager built on LitElement with support for custom content and light DOM elements.
6
-
7
- ![Modal Manager](./assets/modal-screenshot.jpg "Modal Manager Demo")
8
-
9
- ## Installation
10
- ```bash
11
- npm install --save @internetarchive/modal-manager
12
- ```
13
-
14
- ## Usage
15
- ```html
16
- <!-- index.html -->
17
- <script type="module">
18
- import '@internetarchive/modal-manager';
19
- import { ModalConfig } from '@internetarchive/modal-manager';
20
- </script>
21
-
22
- <style>
23
- /* add the following styles to ensure proper modal visibility */
24
- body.modal-manager-open {
25
- overflow: hidden;
26
- }
27
-
28
- modal-manager {
29
- display: none;
30
- }
31
-
32
- modal-manager[mode='open'] {
33
- display: block;
34
- }
35
- </style>
36
-
37
- <modal-manager></modal-manager>
38
-
39
- <script>
40
- // show a simple modal
41
- const manager = document.querySelector('modal-manager');
42
- const config = new ModalConfig();
43
- config.headline = 'Hi, Everybody!';
44
- config.message = 'Hi, Doctor Nick!';
45
- manager.showModal(config)
46
-
47
- // to hide the modal call `closeModal()`:
48
- manager.closeModal();
49
- </script>
50
- ```
51
-
52
- ## Advanced Usage
53
-
54
- ### Markup Content
55
-
56
- You can pass in custom HTML into the `ModalConfig`:
57
-
58
- ```html
59
- <script type="module">
60
- import { html } from 'lit-html';
61
- </script>
62
-
63
- <modal-manager></modal-manager>
64
-
65
- <script>
66
- const manager = document.querySelector('modal-manager');
67
- const config = new ModalConfig();
68
- config.title = 'Internet Archive';
69
- config.subtitle = '';
70
- config.headline = 'Thanks for your Support!';
71
- config.message = html`
72
- <p>Thanks for your donation!</p>
73
- <p>Please click <a href="">here</a> to complete!</p>
74
- `;
75
- config.headerColor = '#36A483';
76
- manager.showModal(config);
77
- </script>
78
- ```
79
-
80
- ### Custom Content
81
-
82
- Display completely custom content in the modal body, including light DOM content like a PayPal button.
83
-
84
- ```html
85
- <modal-manager></modal-manager>
86
-
87
- <script>
88
- const manager = document.querySelector('modal-manager');
89
- const config = new ModalConfig();
90
- const customContent = html`
91
- Can contain any markup, including web components. Event listeners also work. Try clicking on the picture.
92
- <div style="text-align: center">
93
- <div class="sr-only">Visible for screen-readers only</div>
94
- <a href="https://fillmurray.com" style="display: block">Fill Murray</a>
95
- <img src="100x100.jpg" @click=${showBillAlert} />
96
- </div>
97
- `;
98
-
99
- // customContent used to render as slotted content, it can also use .sr-only class
100
- modalManager.showModal(config, customContent);
101
- </script>
102
- ```
103
-
104
- ### Config Options
105
-
106
- All of the config options:
107
-
108
- ```javascript
109
- const config = new ModalConfig();
110
- config.title = 'Internet Archive';
111
- config.subtitle = '';
112
- config.headline = '<div class="sr-only">Visible for screen-readers only</div>Thanks for your Support!';
113
- config.message = 'Thank you for supporting the Internet Archive!';
114
- config.headerColor = '#36A483';
115
- config.showProcessingIndicator = false;
116
- config.processingImageMode = 'processing'; // or `complete`
117
- ```
118
-
119
- # Development
120
-
121
- ## Prerequisite
122
- ```bash
123
- npm install
124
- ```
125
-
126
- ## Start Development Server
127
- ```bash
128
- npm start
129
- ```
130
-
131
- ## Testing
132
- ```bash
133
- npm test
134
- ```
135
-
136
- ## Linting
137
- ```bash
138
- npm lint
139
- ```
1
+ ![Build Status](https://github.com/internetarchive/iaux-modal-manager/actions/workflows/ci.yml/badge.svg) [![codecov](https://codecov.io/gh/internetarchive/iaux-modal-manager/branch/master/graph/badge.svg)](https://codecov.io/gh/internetarchive/iaux-modal-manager)
2
+
3
+ # Modal Manager Component
4
+
5
+ A modal manager built on LitElement with support for custom content and light DOM elements.
6
+
7
+ ![Modal Manager](./assets/modal-screenshot.jpg "Modal Manager Demo")
8
+
9
+ ## Installation
10
+ ```bash
11
+ npm install --save @internetarchive/modal-manager
12
+ ```
13
+
14
+ ## Usage
15
+ ```html
16
+ <!-- index.html -->
17
+ <script type="module">
18
+ import '@internetarchive/modal-manager';
19
+ import { ModalConfig } from '@internetarchive/modal-manager';
20
+ </script>
21
+
22
+ <style>
23
+ /* add the following styles to ensure proper modal visibility */
24
+ body.modal-manager-open {
25
+ overflow: hidden;
26
+ }
27
+
28
+ modal-manager {
29
+ display: none;
30
+ }
31
+
32
+ modal-manager[mode='open'] {
33
+ display: block;
34
+ }
35
+ </style>
36
+
37
+ <modal-manager></modal-manager>
38
+
39
+ <script>
40
+ // show a simple modal
41
+ const manager = document.querySelector('modal-manager');
42
+ const config = new ModalConfig();
43
+ config.headline = 'Hi, Everybody!';
44
+ config.message = 'Hi, Doctor Nick!';
45
+ manager.showModal(config)
46
+
47
+ // to hide the modal call `closeModal()`:
48
+ manager.closeModal();
49
+ </script>
50
+ ```
51
+
52
+ ## Advanced Usage
53
+
54
+ ### Markup Content
55
+
56
+ You can pass in custom HTML into the `ModalConfig`:
57
+
58
+ ```html
59
+ <script type="module">
60
+ import { html } from 'lit-html';
61
+ </script>
62
+
63
+ <modal-manager></modal-manager>
64
+
65
+ <script>
66
+ const manager = document.querySelector('modal-manager');
67
+ const config = new ModalConfig();
68
+ config.title = 'Internet Archive';
69
+ config.subtitle = '';
70
+ config.headline = 'Thanks for your Support!';
71
+ config.message = html`
72
+ <p>Thanks for your donation!</p>
73
+ <p>Please click <a href="">here</a> to complete!</p>
74
+ `;
75
+ config.headerColor = '#36A483';
76
+ manager.showModal(config);
77
+ </script>
78
+ ```
79
+
80
+ ### Custom Content
81
+
82
+ Display completely custom content in the modal body, including light DOM content like a PayPal button.
83
+
84
+ ```html
85
+ <modal-manager></modal-manager>
86
+
87
+ <script>
88
+ const manager = document.querySelector('modal-manager');
89
+ const config = new ModalConfig();
90
+ const customContent = html`
91
+ Can contain any markup, including web components. Event listeners also work. Try clicking on the picture.
92
+ <div style="text-align: center">
93
+ <div class="sr-only">Visible for screen-readers only</div>
94
+ <a href="https://fillmurray.com" style="display: block">Fill Murray</a>
95
+ <img src="100x100.jpg" @click=${showBillAlert} />
96
+ </div>
97
+ `;
98
+
99
+ // customContent used to render as slotted content, it can also use .sr-only class
100
+ modalManager.showModal(config, customContent);
101
+ </script>
102
+ ```
103
+
104
+ ### Config Options
105
+
106
+ All of the config options:
107
+
108
+ ```javascript
109
+ const config = new ModalConfig();
110
+ config.title = 'Internet Archive';
111
+ config.subtitle = '';
112
+ config.headline = '<div class="sr-only">Visible for screen-readers only</div>Thanks for your Support!';
113
+ config.message = 'Thank you for supporting the Internet Archive!';
114
+ config.headerColor = '#36A483';
115
+ config.showProcessingIndicator = false;
116
+ config.processingImageMode = 'processing'; // or `complete`
117
+ ```
118
+
119
+ # Development
120
+
121
+ ## Prerequisite
122
+ ```bash
123
+ npm install
124
+ ```
125
+
126
+ ## Start Development Server
127
+ ```bash
128
+ npm start
129
+ ```
130
+
131
+ ## Testing
132
+ ```bash
133
+ npm test
134
+ ```
135
+
136
+ ## Linting
137
+ ```bash
138
+ npm lint
139
+ ```
@@ -1,170 +1,170 @@
1
- {
2
- "version": 2,
3
- "tags": [
4
- {
5
- "name": "modal-manager",
6
- "description": "A LitElement modal manager",
7
- "properties": [
8
- {
9
- "name": "mode",
10
- "type": "ModalManagerMode",
11
- "description": "The current mode of the modal manager (open/closed)",
12
- "default": "ModalManagerMode.Closed"
13
- },
14
- {
15
- "name": "customModalContent",
16
- "type": "TemplateResult",
17
- "description": "Custom content to be displayed in the modal content slot",
18
- "default": "undefined"
19
- },
20
- {
21
- "name": "hostBridge",
22
- "type": "ModalManagerHostBridgeInterface",
23
- "description": "A handler for host-specific functionality like CSS modifications",
24
- "default": "default ModalManagerHostBridge"
25
- }
26
- ],
27
- "events": [
28
- {
29
- "name": "modeChanged",
30
- "description": "Dispatched when the modal opens or closes"
31
- }
32
- ],
33
- "slots": [],
34
- "cssProperties": [
35
- {
36
- "name": "--modalBackdropColor",
37
- "description": "Backdrop color",
38
- "type": "String",
39
- "default": "rgba(10, 10, 10, 0.9)"
40
- },
41
- {
42
- "name": "--modalBackdropZindex",
43
- "description": "Backdrop z-index",
44
- "type": "Number",
45
- "default": "1000"
46
- },
47
- {
48
- "name": "--modalWidth",
49
- "description": "Modal width",
50
- "type": "String",
51
- "default": "32rem"
52
- },
53
- {
54
- "name": "--modalMaxWidth",
55
- "description": "Modal maximum width",
56
- "type": "String",
57
- "default": "95%"
58
- },
59
- {
60
- "name": "--modalZindex",
61
- "description": "Modal z-index",
62
- "type": "Number",
63
- "default": "2000"
64
- },
65
- {
66
- "name": "--modalLogoSize",
67
- "description": "The modal logo size",
68
- "type": "String",
69
- "default": "6.5rem"
70
- },
71
- {
72
- "name": "--processingImageSize",
73
- "description": "The processing image size",
74
- "type": "String",
75
- "default": "7.5rem"
76
- },
77
- {
78
- "name": "--modalCornerRadius",
79
- "description": "Modal corner radius",
80
- "type": "String",
81
- "default": "2.5rem"
82
- },
83
- {
84
- "name": "--modalBorder",
85
- "description": "The modal border",
86
- "type": "String",
87
- "default": "2px solid black"
88
- },
89
- {
90
- "name": "--modalBottomMargin",
91
- "description": "The space between the bottom of the screen and the bottom of the modal",
92
- "type": "String",
93
- "default": "2.5rem"
94
- },
95
- {
96
- "name": "--modalTopMargin",
97
- "description": "The space between the top of the screen and the top of the modal",
98
- "type": "String",
99
- "default": "2.5rem"
100
- },
101
- {
102
- "name": "--modalHeaderBottomPadding",
103
- "description": "The padding on the bottom of the modal header",
104
- "type": "String",
105
- "default": "0.5rem"
106
- },
107
- {
108
- "name": "--modalBottomPadding",
109
- "description": "The padding on the bottom of the modal",
110
- "type": "String",
111
- "default": "20px"
112
- },
113
- {
114
- "name": "--modalScrollOffset",
115
- "description": "Adds a bit of extra padding to the scrollable area so the scrollbar doesn't always show",
116
- "type": "String",
117
- "default": "5px"
118
- },
119
- {
120
- "name": "--modalTitleFontSize",
121
- "description": "Modal title font size",
122
- "type": "String",
123
- "default": "1.8rem"
124
- },
125
- {
126
- "name": "--modalSubtitleFontSize",
127
- "description": "Modal subtitle font size",
128
- "type": "String",
129
- "default": "1.4rem"
130
- },
131
- {
132
- "name": "--modalHeadlineFontSize",
133
- "description": "Modal headline font size",
134
- "type": "String",
135
- "default": "1.6rem"
136
- },
137
- {
138
- "name": "--modalMessageFontSize",
139
- "description": "Modal message font size",
140
- "type": "String",
141
- "default": "1.4rem"
142
- },
143
- {
144
- "name": "--modalTitleLineHeight",
145
- "description": "Modal title line height",
146
- "type": "String",
147
- "default": "normal"
148
- },
149
- {
150
- "name": "--modalSubtitleLineHeight",
151
- "description": "Modal subtitle line height",
152
- "type": "String",
153
- "default": "normal"
154
- },
155
- {
156
- "name": "--modalHeadlineLineHeight",
157
- "description": "Modal headline line height",
158
- "type": "String",
159
- "default": "normal"
160
- },
161
- {
162
- "name": "--modalMessageLineHeight",
163
- "description": "Modal message line height",
164
- "type": "String",
165
- "default": "normal"
166
- }
167
- ]
168
- }
169
- ]
170
- }
1
+ {
2
+ "version": 2,
3
+ "tags": [
4
+ {
5
+ "name": "modal-manager",
6
+ "description": "A LitElement modal manager",
7
+ "properties": [
8
+ {
9
+ "name": "mode",
10
+ "type": "ModalManagerMode",
11
+ "description": "The current mode of the modal manager (open/closed)",
12
+ "default": "ModalManagerMode.Closed"
13
+ },
14
+ {
15
+ "name": "customModalContent",
16
+ "type": "TemplateResult",
17
+ "description": "Custom content to be displayed in the modal content slot",
18
+ "default": "undefined"
19
+ },
20
+ {
21
+ "name": "hostBridge",
22
+ "type": "ModalManagerHostBridgeInterface",
23
+ "description": "A handler for host-specific functionality like CSS modifications",
24
+ "default": "default ModalManagerHostBridge"
25
+ }
26
+ ],
27
+ "events": [
28
+ {
29
+ "name": "modeChanged",
30
+ "description": "Dispatched when the modal opens or closes"
31
+ }
32
+ ],
33
+ "slots": [],
34
+ "cssProperties": [
35
+ {
36
+ "name": "--modalBackdropColor",
37
+ "description": "Backdrop color",
38
+ "type": "String",
39
+ "default": "rgba(10, 10, 10, 0.9)"
40
+ },
41
+ {
42
+ "name": "--modalBackdropZindex",
43
+ "description": "Backdrop z-index",
44
+ "type": "Number",
45
+ "default": "1000"
46
+ },
47
+ {
48
+ "name": "--modalWidth",
49
+ "description": "Modal width",
50
+ "type": "String",
51
+ "default": "32rem"
52
+ },
53
+ {
54
+ "name": "--modalMaxWidth",
55
+ "description": "Modal maximum width",
56
+ "type": "String",
57
+ "default": "95%"
58
+ },
59
+ {
60
+ "name": "--modalZindex",
61
+ "description": "Modal z-index",
62
+ "type": "Number",
63
+ "default": "2000"
64
+ },
65
+ {
66
+ "name": "--modalLogoSize",
67
+ "description": "The modal logo size",
68
+ "type": "String",
69
+ "default": "6.5rem"
70
+ },
71
+ {
72
+ "name": "--processingImageSize",
73
+ "description": "The processing image size",
74
+ "type": "String",
75
+ "default": "7.5rem"
76
+ },
77
+ {
78
+ "name": "--modalCornerRadius",
79
+ "description": "Modal corner radius",
80
+ "type": "String",
81
+ "default": "2.5rem"
82
+ },
83
+ {
84
+ "name": "--modalBorder",
85
+ "description": "The modal border",
86
+ "type": "String",
87
+ "default": "2px solid black"
88
+ },
89
+ {
90
+ "name": "--modalBottomMargin",
91
+ "description": "The space between the bottom of the screen and the bottom of the modal",
92
+ "type": "String",
93
+ "default": "2.5rem"
94
+ },
95
+ {
96
+ "name": "--modalTopMargin",
97
+ "description": "The space between the top of the screen and the top of the modal",
98
+ "type": "String",
99
+ "default": "2.5rem"
100
+ },
101
+ {
102
+ "name": "--modalHeaderBottomPadding",
103
+ "description": "The padding on the bottom of the modal header",
104
+ "type": "String",
105
+ "default": "0.5rem"
106
+ },
107
+ {
108
+ "name": "--modalBottomPadding",
109
+ "description": "The padding on the bottom of the modal",
110
+ "type": "String",
111
+ "default": "20px"
112
+ },
113
+ {
114
+ "name": "--modalScrollOffset",
115
+ "description": "Adds a bit of extra padding to the scrollable area so the scrollbar doesn't always show",
116
+ "type": "String",
117
+ "default": "5px"
118
+ },
119
+ {
120
+ "name": "--modalTitleFontSize",
121
+ "description": "Modal title font size",
122
+ "type": "String",
123
+ "default": "1.8rem"
124
+ },
125
+ {
126
+ "name": "--modalSubtitleFontSize",
127
+ "description": "Modal subtitle font size",
128
+ "type": "String",
129
+ "default": "1.4rem"
130
+ },
131
+ {
132
+ "name": "--modalHeadlineFontSize",
133
+ "description": "Modal headline font size",
134
+ "type": "String",
135
+ "default": "1.6rem"
136
+ },
137
+ {
138
+ "name": "--modalMessageFontSize",
139
+ "description": "Modal message font size",
140
+ "type": "String",
141
+ "default": "1.4rem"
142
+ },
143
+ {
144
+ "name": "--modalTitleLineHeight",
145
+ "description": "Modal title line height",
146
+ "type": "String",
147
+ "default": "normal"
148
+ },
149
+ {
150
+ "name": "--modalSubtitleLineHeight",
151
+ "description": "Modal subtitle line height",
152
+ "type": "String",
153
+ "default": "normal"
154
+ },
155
+ {
156
+ "name": "--modalHeadlineLineHeight",
157
+ "description": "Modal headline line height",
158
+ "type": "String",
159
+ "default": "normal"
160
+ },
161
+ {
162
+ "name": "--modalMessageLineHeight",
163
+ "description": "Modal message line height",
164
+ "type": "String",
165
+ "default": "normal"
166
+ }
167
+ ]
168
+ }
169
+ ]
170
+ }