@benqoder/beam 0.1.0 → 0.1.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/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -5
- package/package.json +1 -1
- package/src/beam.css +74 -9
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AAkB9D,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAGD,UAAU,UAAU;IAClB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7E,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACvE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACzE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAClF;AAGD,KAAK,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AAkB9D,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67D5C,CAAA;AAGD,KAAK,YAAY,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;AAE/G,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,IAAI,EAAE,OAAO,SAAS,GAAG;YACvB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAA;SAC/B,CAAA;KACF;CACF"}
|
package/dist/client.js
CHANGED
|
@@ -572,9 +572,10 @@ document.addEventListener('click', (e) => {
|
|
|
572
572
|
if (!checkConfirm(trigger))
|
|
573
573
|
return;
|
|
574
574
|
const modalId = trigger.getAttribute('beam-modal');
|
|
575
|
+
const size = trigger.getAttribute('beam-size') || 'medium';
|
|
575
576
|
const params = getParams(trigger);
|
|
576
577
|
if (modalId) {
|
|
577
|
-
openModal(modalId, params);
|
|
578
|
+
openModal(modalId, params, { size });
|
|
578
579
|
}
|
|
579
580
|
}
|
|
580
581
|
// Close on backdrop click
|
|
@@ -626,7 +627,7 @@ document.addEventListener('keydown', (e) => {
|
|
|
626
627
|
}
|
|
627
628
|
}
|
|
628
629
|
});
|
|
629
|
-
async function openModal(id, params = {}) {
|
|
630
|
+
async function openModal(id, params = {}, options = { size: 'medium' }) {
|
|
630
631
|
try {
|
|
631
632
|
const html = await api.modal(id, params);
|
|
632
633
|
let backdrop = $('#modal-backdrop');
|
|
@@ -635,8 +636,9 @@ async function openModal(id, params = {}) {
|
|
|
635
636
|
backdrop.id = 'modal-backdrop';
|
|
636
637
|
document.body.appendChild(backdrop);
|
|
637
638
|
}
|
|
639
|
+
const { size } = options;
|
|
638
640
|
backdrop.innerHTML = `
|
|
639
|
-
<div id="modal-content" role="dialog" aria-modal="true">
|
|
641
|
+
<div id="modal-content" role="dialog" aria-modal="true" data-size="${size}">
|
|
640
642
|
${html}
|
|
641
643
|
</div>
|
|
642
644
|
`;
|
|
@@ -658,7 +660,7 @@ function closeModal() {
|
|
|
658
660
|
if (backdrop) {
|
|
659
661
|
backdrop.classList.remove('open');
|
|
660
662
|
setTimeout(() => {
|
|
661
|
-
backdrop.
|
|
663
|
+
backdrop.remove();
|
|
662
664
|
}, 200);
|
|
663
665
|
}
|
|
664
666
|
document.body.classList.remove('modal-open');
|
|
@@ -698,7 +700,7 @@ function closeDrawer() {
|
|
|
698
700
|
if (backdrop) {
|
|
699
701
|
backdrop.classList.remove('open');
|
|
700
702
|
setTimeout(() => {
|
|
701
|
-
backdrop.
|
|
703
|
+
backdrop.remove();
|
|
702
704
|
}, 200);
|
|
703
705
|
}
|
|
704
706
|
document.body.classList.remove('drawer-open');
|
package/package.json
CHANGED
package/src/beam.css
CHANGED
|
@@ -120,8 +120,8 @@
|
|
|
120
120
|
#modal-content {
|
|
121
121
|
background: white;
|
|
122
122
|
border-radius: 0.5rem;
|
|
123
|
-
max-width: 32rem;
|
|
124
123
|
width: 100%;
|
|
124
|
+
max-width: 32rem;
|
|
125
125
|
max-height: calc(100vh - 2rem);
|
|
126
126
|
overflow: auto;
|
|
127
127
|
transform: scale(0.95);
|
|
@@ -134,6 +134,28 @@
|
|
|
134
134
|
opacity: 1;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/* Modal sizes */
|
|
138
|
+
#modal-content[data-size="small"] {
|
|
139
|
+
max-width: 24rem;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
#modal-content[data-size="medium"] {
|
|
143
|
+
max-width: 32rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#modal-content[data-size="large"] {
|
|
147
|
+
max-width: 42rem;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
#modal-content[data-size="xl"] {
|
|
151
|
+
max-width: 56rem;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
#modal-content[data-size="full"] {
|
|
155
|
+
max-width: calc(100% - 2rem);
|
|
156
|
+
max-height: calc(100vh - 2rem);
|
|
157
|
+
}
|
|
158
|
+
|
|
137
159
|
/* Drawer backdrop */
|
|
138
160
|
#drawer-backdrop {
|
|
139
161
|
position: fixed;
|
|
@@ -188,42 +210,85 @@
|
|
|
188
210
|
transform: translateX(0) translateY(0);
|
|
189
211
|
}
|
|
190
212
|
|
|
191
|
-
/* Drawer sizes */
|
|
213
|
+
/* Drawer sizes - mobile first with max-width constraint */
|
|
214
|
+
#drawer-content[data-position="left"],
|
|
215
|
+
#drawer-content[data-position="right"] {
|
|
216
|
+
width: 100%;
|
|
217
|
+
max-width: 100%;
|
|
218
|
+
}
|
|
219
|
+
|
|
192
220
|
#drawer-content[data-size="small"] {
|
|
193
|
-
width: 20rem;
|
|
221
|
+
max-width: 20rem;
|
|
194
222
|
}
|
|
195
223
|
|
|
196
224
|
#drawer-content[data-size="medium"] {
|
|
197
|
-
width: 28rem;
|
|
225
|
+
max-width: 28rem;
|
|
198
226
|
}
|
|
199
227
|
|
|
200
228
|
#drawer-content[data-size="large"] {
|
|
201
|
-
width: 36rem;
|
|
229
|
+
max-width: 36rem;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
#drawer-content[data-size="xl"] {
|
|
233
|
+
max-width: 48rem;
|
|
202
234
|
}
|
|
203
235
|
|
|
204
236
|
#drawer-content[data-size="full"] {
|
|
205
|
-
width: 100%;
|
|
237
|
+
max-width: 100%;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* Responsive: on larger screens, use the defined max-width as width */
|
|
241
|
+
@media (min-width: 640px) {
|
|
242
|
+
#drawer-content[data-size="small"] {
|
|
243
|
+
width: 20rem;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
#drawer-content[data-size="medium"] {
|
|
247
|
+
width: 28rem;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
#drawer-content[data-size="large"] {
|
|
251
|
+
width: 36rem;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
#drawer-content[data-size="xl"] {
|
|
255
|
+
width: 48rem;
|
|
256
|
+
}
|
|
206
257
|
}
|
|
207
258
|
|
|
208
259
|
/* Vertical drawers (top/bottom) use height instead */
|
|
260
|
+
#drawer-content[data-position="top"],
|
|
261
|
+
#drawer-content[data-position="bottom"] {
|
|
262
|
+
width: 100%;
|
|
263
|
+
max-width: 100%;
|
|
264
|
+
max-height: 90vh;
|
|
265
|
+
}
|
|
266
|
+
|
|
209
267
|
#drawer-content[data-position="top"][data-size="small"],
|
|
210
268
|
#drawer-content[data-position="bottom"][data-size="small"] {
|
|
211
|
-
width: 100%;
|
|
212
269
|
height: 25vh;
|
|
213
270
|
}
|
|
214
271
|
|
|
215
272
|
#drawer-content[data-position="top"][data-size="medium"],
|
|
216
273
|
#drawer-content[data-position="bottom"][data-size="medium"] {
|
|
217
|
-
width: 100%;
|
|
218
274
|
height: 50vh;
|
|
219
275
|
}
|
|
220
276
|
|
|
221
277
|
#drawer-content[data-position="top"][data-size="large"],
|
|
222
278
|
#drawer-content[data-position="bottom"][data-size="large"] {
|
|
223
|
-
width: 100%;
|
|
224
279
|
height: 75vh;
|
|
225
280
|
}
|
|
226
281
|
|
|
282
|
+
#drawer-content[data-position="top"][data-size="xl"],
|
|
283
|
+
#drawer-content[data-position="bottom"][data-size="xl"] {
|
|
284
|
+
height: 85vh;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
#drawer-content[data-position="top"][data-size="full"],
|
|
288
|
+
#drawer-content[data-position="bottom"][data-size="full"] {
|
|
289
|
+
height: 100vh;
|
|
290
|
+
}
|
|
291
|
+
|
|
227
292
|
/* Prevent body scroll when modal/drawer open */
|
|
228
293
|
body.modal-open,
|
|
229
294
|
body.drawer-open {
|