@bagelink/vue 0.0.378 → 0.0.384

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.
@@ -5,6 +5,7 @@ export interface ModalOptions {
5
5
  title?: string;
6
6
  dismissable?: boolean;
7
7
  side?: boolean;
8
+ width?: string;
8
9
  actions?: BtnOptions[];
9
10
  class?: string;
10
11
  visible?: boolean;
@@ -13,6 +14,7 @@ export interface ModalFormOptions {
13
14
  side?: boolean;
14
15
  title?: string;
15
16
  visible?: boolean;
17
+ width?: string;
16
18
  dismissable?: boolean;
17
19
  schema: BglFormSchemaT<any> | (() => BglFormSchemaT) | BglFormSchemaT;
18
20
  onSubmit?: (formData: any) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/plugins/modal.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACf,MAAM,KAAK,CAAC;AACb,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhE,MAAM,WAAW,YAAY;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,cAAc,CAAC,GAAG,cAAc,CAAA;IACrE,QAAQ,CAAC,EAA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AC,CAAC;IACpC,SAAS,EAAE,OAAO,GAAG,WAAW,CAAC;IACjC,YAAY,EAAE,YAAY,GAAG,gBAAgB,CAAA;CAC7C;AACD,MAAM,WAAW,uBAAuB;IACvC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,SAAS,EAAE,WAAW,CAAC;IACvB,YAAY,EAAE,gBAAgB,CAAA;CAC9B;AACD,MAAM,WAAW,QAAQ;IACxB,SAAS,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACxE,aAAa,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,uBAAuB,GAAG,SAAS,CAAC;IAC/G,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,QAAQ,CAAmB,CAAC;AAEnE,eAAO,MAAM,QAAQ,QAAO,QAI3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAyCzB,CAAC"}
package/dist/style.css CHANGED
@@ -376,161 +376,161 @@ a[data-v-d09a83c5] {
376
376
  filter: brightness(80%);
377
377
  }
378
378
  .bg-dark {
379
- position: fixed;
380
- top: 0;
381
- right: 0;
382
- left: 0;
383
- bottom: 0;
384
- background-color: rgba(0, 0, 0, 0.7);
385
- z-index: 999;
386
- pointer-events: none;
387
- opacity: 0;
388
- transition: all ease-in-out 0.3s;
389
- max-height: 100vh;
390
- overflow: auto;
391
- margin: 0 auto;
392
- width: 100%;
393
- text-align: center;
394
- display: grid;
395
- align-items: center;
379
+ position: fixed;
380
+ top: 0;
381
+ right: 0;
382
+ left: 0;
383
+ bottom: 0;
384
+ background-color: rgba(0, 0, 0, 0.7);
385
+ z-index: 999;
386
+ pointer-events: none;
387
+ opacity: 0;
388
+ transition: all ease-in-out 0.3s;
389
+ max-height: 100vh;
390
+ overflow: auto;
391
+ margin: 0 auto;
392
+ width: 100%;
393
+ text-align: center;
394
+ display: grid;
395
+ align-items: center;
396
396
  }
397
397
 
398
398
  .bg-lignt {
399
- background-color: var(--bgl-white);
399
+ background-color: var(--bgl-white);
400
400
  }
401
401
 
402
402
  .modal {
403
- width: 96%;
404
- max-width: 680px;
405
- transform: scale(0.5);
406
- opacity: 0;
407
- transition: all ease-in-out 0.15s;
408
- margin-left: auto;
409
- margin-right: auto;
410
- height: fit-content;
403
+ width: 96%;
404
+ max-width: 720px;
405
+ transform: scale(0.5);
406
+ opacity: 0;
407
+ transition: all ease-in-out 0.15s;
408
+ margin-left: auto;
409
+ margin-right: auto;
410
+ height: fit-content;
411
411
  }
412
412
 
413
413
  .small-modal .modal {
414
- max-width: 300px;
415
- text-align: center;
414
+ max-width: 300px;
415
+ text-align: center;
416
416
  }
417
417
 
418
418
  .tool-bar {
419
- margin: -2rem -1rem 1rem;
420
- display: flex;
421
- justify-content: space-between;
422
- position: -webkit-sticky;
423
- position: sticky;
424
- padding-top: 1rem;
425
- top: 0rem;
426
- z-index: 3;
427
- background: var(--bgl-white);
419
+ margin: -2rem -1rem 1rem;
420
+ display: flex;
421
+ justify-content: space-between;
422
+ position: -webkit-sticky;
423
+ position: sticky;
424
+ padding-top: 1rem;
425
+ top: 0rem;
426
+ z-index: 3;
427
+ background: var(--bgl-white);
428
428
  }
429
429
 
430
430
  .modal-size {
431
- cursor: pointer;
431
+ cursor: pointer;
432
432
  }
433
433
 
434
434
  .is-side .modal {
435
- inset-inline-end: -600px;
436
- transform: scale(1);
437
- opacity: 1;
438
- /* position: fixed; */
439
- /* top: 20px; */
440
- /* bottom: 20px; */
441
- max-width: 600px;
442
- width: 90%;
443
- margin-top: 20px;
444
- margin-bottom: 20px;
445
- margin-inline-start: auto;
446
- margin-inline-end: 20px;
447
- min-height: calc(100vh - 40px);
448
- transform: translateX(100%);
435
+ inset-inline-end: -600px;
436
+ transform: scale(1);
437
+ opacity: 1;
438
+ /* position: fixed; */
439
+ /* top: 20px; */
440
+ /* bottom: 20px; */
441
+ max-width: 600px;
442
+ width: 90%;
443
+ margin-top: 20px;
444
+ margin-bottom: 20px;
445
+ margin-inline-start: auto;
446
+ margin-inline-end: 20px;
447
+ min-height: calc(100vh - 40px);
448
+ transform: translateX(100%);
449
449
  }
450
450
 
451
451
  .is-active .modal {
452
- transform: scale(1);
453
- opacity: 1;
454
- box-shadow: 6px 6px 20px 20px #0000001c;
452
+ transform: scale(1);
453
+ opacity: 1;
454
+ box-shadow: 6px 6px 20px 20px #0000001c;
455
455
  }
456
456
 
457
457
  .bg-lignt .modal {
458
- transform: scale(1);
459
- border: 1px solid var(--border-color);
458
+ transform: scale(1);
459
+ border: 1px solid var(--border-color);
460
460
  }
461
461
 
462
462
  .bg-lignt.is-active .modal {
463
- box-shadow: none;
463
+ box-shadow: none;
464
464
  }
465
465
 
466
466
  .is-active.is-side .modal {
467
- inset-inline-end: 20px;
468
- transform: translateX(0%);
467
+ inset-inline-end: 20px;
468
+ transform: translateX(0%);
469
469
  }
470
470
 
471
471
  .bg-dark.is-active {
472
- opacity: 1;
473
- pointer-events: all;
472
+ opacity: 1;
473
+ pointer-events: all;
474
474
  }
475
475
 
476
476
  .is-side.bg-dark.is-active {
477
- opacity: 1;
478
- align-items: stretch;
477
+ opacity: 1;
478
+ align-items: stretch;
479
479
  }
480
480
 
481
481
  .is-side.is-active .modal {
482
- pointer-events: all;
482
+ pointer-events: all;
483
483
  }
484
484
 
485
485
  @media screen and (max-width: 910px) {
486
- .tool-bar {
487
- margin: -1rem 0rem 1rem;
488
- padding-bottom: 1rem;
489
- align-items: center;
490
- }
486
+ .tool-bar {
487
+ margin: -1rem 0rem 1rem;
488
+ padding-bottom: 1rem;
489
+ align-items: center;
490
+ }
491
491
 
492
- .is-active.is-side .modal {
493
- margin-inline-end: 5%;
494
- margin-inline-start: 5%;
495
- }
492
+ .is-active.is-side .modal {
493
+ margin-inline-end: 5%;
494
+ margin-inline-start: 5%;
495
+ }
496
496
  }
497
497
 
498
498
  .modal-title {
499
- text-align: center;
500
- font-weight: 600;
501
- font-size: 20px;
502
- margin-top: 0.5rem;
503
- margin-bottom: 0 !important;
504
- width: 100%;
505
- -webkit-padding-end: 40px;
506
- padding-inline-end: 40px;
507
- line-height: 2;
508
- display: -webkit-box;
509
- max-width: 100%;
510
- -webkit-line-clamp: 1;
511
- -webkit-box-orient: vertical;
512
- overflow: hidden;
513
- text-overflow: ellipsis;
499
+ text-align: center;
500
+ font-weight: 600;
501
+ font-size: 20px;
502
+ margin-top: 0.5rem;
503
+ margin-bottom: 0 !important;
504
+ width: 100%;
505
+ -webkit-padding-end: 40px;
506
+ padding-inline-end: 40px;
507
+ line-height: 2;
508
+ display: -webkit-box;
509
+ max-width: 100%;
510
+ -webkit-line-clamp: 1;
511
+ -webkit-box-orient: vertical;
512
+ overflow: hidden;
513
+ text-overflow: ellipsis;
514
514
  }
515
515
  .modal-footer {
516
- gap: 1rem;
517
- display: flex;
518
- justify-content: space-between;
519
- align-items: center;
516
+ gap: 1rem;
517
+ display: flex;
518
+ justify-content: space-between;
519
+ align-items: center;
520
520
  }
521
- .modal-footer>div {
522
- gap: 1rem;
523
- display: flex;
524
- justify-content: space-between;
525
- align-items: center;
526
- gap: 0;
521
+ .modal-footer > div {
522
+ gap: 1rem;
523
+ display: flex;
524
+ justify-content: space-between;
525
+ align-items: center;
526
+ gap: 0;
527
527
  }
528
528
 
529
- .modal-title[data-v-7e6899c7] {
529
+ .modal-title[data-v-204f5236] {
530
530
  margin-top: 0.5rem;
531
531
  }
532
532
  @media screen and (max-width: 910px) {
533
- .modal-title[data-v-7e6899c7] {
533
+ .modal-title[data-v-204f5236] {
534
534
  margin-top: 1rem;
535
535
  }
536
536
  }
@@ -879,11 +879,15 @@ display: block;
879
879
  color: var(--bgl-red);
880
880
  }
881
881
 
882
- .bgl_vid iframe[data-v-23835d69],
883
- .bgl_vid video[data-v-23835d69] {
884
- width: 100%;
885
- height: auto;
886
- display: block
882
+ .bgl_vid iframe[data-v-bbfc4353],
883
+ .bgl_vid video[data-v-bbfc4353] {
884
+ width: 100%;
885
+ height: auto;
886
+ display: block;
887
+ }
888
+ .bgl_vid.vid_empty[data-v-bbfc4353] {
889
+ padding-top: 56.25%;
890
+ background: #f0f0f0;
887
891
  }
888
892
 
889
893
  .blocker[data-v-068aa914] {
@@ -1477,7 +1481,7 @@ display: block;
1477
1481
  color: var(--bgl-white);
1478
1482
  }
1479
1483
 
1480
- .bagel-input .fileUploadWrap[data-v-3bb24b0c] {
1484
+ .bagel-input .fileUploadWrap[data-v-0dbacaa0] {
1481
1485
  outline: 1px solid var(--border-color);
1482
1486
  border-radius: var(--input-border-radius);
1483
1487
  text-align: center;
@@ -1487,7 +1491,7 @@ display: block;
1487
1491
  height: 132px;
1488
1492
  font-size: var(--input-font-size);
1489
1493
  }
1490
- .previewName[data-v-3bb24b0c] {
1494
+ .previewName[data-v-0dbacaa0] {
1491
1495
  padding: 0.5rem;
1492
1496
  text-align: start;
1493
1497
  color: var(--input-color);
@@ -1496,37 +1500,37 @@ display: block;
1496
1500
  align-items: center;
1497
1501
  padding-inline: 14px;
1498
1502
  }
1499
- .previewName p[data-v-3bb24b0c] {
1503
+ .previewName p[data-v-0dbacaa0] {
1500
1504
  overflow: hidden;
1501
1505
  text-overflow: ellipsis;
1502
1506
  white-space: nowrap;
1503
1507
  }
1504
- .imagePreviewWrap[data-v-3bb24b0c] {
1508
+ .imagePreviewWrap[data-v-0dbacaa0] {
1505
1509
  background: var(--input-bg);
1506
1510
  border-radius: var(--input-border-radius);
1507
1511
  height: 90px;
1508
1512
  padding: 5px;
1509
1513
  }
1510
- img.preview[data-v-3bb24b0c] {
1514
+ img.preview[data-v-0dbacaa0] {
1511
1515
  height: 80px;
1512
1516
  border-radius: var(--input-border-radius);
1513
1517
  object-fit: contain;
1514
1518
  }
1515
- .fileUploadWrap.dragover[data-v-3bb24b0c],
1516
- .fileUploadWrap[data-v-3bb24b0c]:hover {
1519
+ .fileUploadWrap.dragover[data-v-0dbacaa0],
1520
+ .fileUploadWrap[data-v-0dbacaa0]:hover {
1517
1521
  box-shadow: inset 0 0 10px #00000012;
1518
1522
  }
1519
- .bagel-input .fileUploadWrap.fileDropZone[data-v-3bb24b0c] {
1523
+ .bagel-input .fileUploadWrap.fileDropZone[data-v-0dbacaa0] {
1520
1524
  background: var(--input-bg);
1521
1525
  display: flex;
1522
1526
  align-items: center;
1523
1527
  justify-content: center;
1524
1528
  color: var(--bgl-gray);
1525
1529
  }
1526
- .bagel-input .fileUploadWrap.fileDropZone[data-v-3bb24b0c]:after {
1530
+ .bagel-input .fileUploadWrap.fileDropZone[data-v-0dbacaa0]:after {
1527
1531
  content: 'Drop files here or click to upload';
1528
1532
  }
1529
- .pie[data-v-3bb24b0c] {
1533
+ .pie[data-v-0dbacaa0] {
1530
1534
  width: 30px;
1531
1535
  height: 30px;
1532
1536
  position: relative;
@@ -1534,7 +1538,7 @@ img.preview[data-v-3bb24b0c] {
1534
1538
  align-items: center;
1535
1539
  justify-content: center;
1536
1540
  }
1537
- .pie[data-v-3bb24b0c]:before {
1541
+ .pie[data-v-0dbacaa0]:before {
1538
1542
  content: '';
1539
1543
  position: absolute;
1540
1544
  border-radius: 50%;
@@ -1552,26 +1556,26 @@ img.preview[data-v-3bb24b0c] {
1552
1556
  #000 calc(100% - var(--b))
1553
1557
  );
1554
1558
  }
1555
- .pie .success[data-v-3bb24b0c] {
1559
+ .pie .success[data-v-0dbacaa0] {
1556
1560
  transform: scale(0);
1557
1561
  opacity: 0;
1558
1562
  transition: all 0.3s ease-in-out;
1559
1563
  }
1560
- .pie .progress[data-v-3bb24b0c] {
1564
+ .pie .progress[data-v-0dbacaa0] {
1561
1565
  position: absolute;
1562
1566
  font-size: 10px;
1563
1567
  }
1564
- .pie.complete .progress[data-v-3bb24b0c] {
1568
+ .pie.complete .progress[data-v-0dbacaa0] {
1565
1569
  display: none;
1566
1570
  }
1567
- .pie.complete .success[data-v-3bb24b0c] {
1571
+ .pie.complete .success[data-v-0dbacaa0] {
1568
1572
  transform: scale(1.3);
1569
1573
  opacity: 1;
1570
1574
  }
1571
- .pie.complete[data-v-3bb24b0c]:before {
1575
+ .pie.complete[data-v-0dbacaa0]:before {
1572
1576
  background: conic-gradient(var(--bgl-green) calc(var(--p) * 1%), #0000 0);
1573
1577
  }
1574
- .pie.complete[data-v-3bb24b0c] {
1578
+ .pie.complete[data-v-0dbacaa0] {
1575
1579
  color: var(--bgl-green);
1576
1580
  }
1577
1581
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.378",
4
+ "version": "0.0.384",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -61,6 +61,8 @@
61
61
  "@vuepic/vue-datepicker": "^8.0.0",
62
62
  "@tiptap/pm": "^2.2.4",
63
63
  "@tiptap/starter-kit": "^2.2.4",
64
+ "@tiptap/extension-image": "^2.2.4",
65
+ "@tiptap/extension-youtube": "^2.2.4",
64
66
  "@tiptap/vue-3": "^2.2.4",
65
67
  "vue": "*",
66
68
  "vue-draggable-next": "^2.2.1",
@@ -1,57 +1,58 @@
1
1
  <template>
2
- <div class="bgl_vid">
2
+ <div class="bgl_vid" :class="{ vid_empty: !src }">
3
3
  <iframe
4
4
  v-if="embedType"
5
5
  :src="videoUrl"
6
6
  :style="{ aspectRatio }"
7
7
  frameborder="0"
8
8
  allowfullscreen
9
- title="Video"
10
- />
9
+ title="Video" />
11
10
  <video
12
- v-else
11
+ v-else-if="src"
13
12
  :src="src"
14
13
  :autoplay="autoplay"
15
14
  :muted="mute"
16
15
  :loop="loop"
17
16
  :style="{ aspectRatio }"
18
17
  :controls="controls"
19
- playsinline
20
- />
18
+ playsinline />
21
19
  </div>
22
20
  </template>
23
21
 
24
22
  <script setup lang="ts">
25
23
  type Props = {
26
- src: string;
27
- autoplay: boolean;
28
- mute: boolean;
29
- aspectRatio: string;
30
- controls: boolean;
31
- loop: boolean;
24
+ src?: string;
25
+ autoplay?: boolean;
26
+ mute?: boolean;
27
+ aspectRatio?: string;
28
+ controls?: boolean;
29
+ loop?: boolean;
32
30
  };
33
31
 
34
32
  const props = defineProps<Props>();
35
33
 
36
- const aspectRatio = $computed(() => props.aspectRatio.replace(':', '/'));
34
+ const aspectRatio = $computed(
35
+ () => props.aspectRatio?.replace(':', '/') || '16/9'
36
+ );
37
37
 
38
38
  const embedType = $computed<'YouTube' | 'Vimeo' | null>(() => {
39
39
  const youtubeRegex = /youtube\.com|youtu\.be/;
40
- if (youtubeRegex.test(props.src)) return 'YouTube';
40
+ if (youtubeRegex.test(props.src || '')) return 'YouTube';
41
41
  const vimeoRegex = /vimeo\.com/;
42
- if (vimeoRegex.test(props.src)) return 'Vimeo';
42
+ if (vimeoRegex.test(props.src || '')) return 'Vimeo';
43
43
  return null;
44
44
  });
45
45
 
46
46
  const videoUrl = $computed(() => {
47
47
  if (embedType) {
48
48
  if (embedType === 'YouTube') {
49
- const videoId = props.src.split(/v=|youtu\.be\//)?.[1]?.split('&')?.[0];
49
+ const videoId = props.src?.split(/v=|youtu\.be\//)?.[1]?.split('&')?.[0];
50
50
  return `https://www.youtube.com/embed/${videoId}`;
51
51
  }
52
52
  if (embedType === 'Vimeo') {
53
- const vimeoRegex = /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/;
54
- const videoId = props.src.match(vimeoRegex)?.[3];
53
+ const vimeoRegex =
54
+ /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/;
55
+ const videoId = props.src?.match(vimeoRegex)?.[3];
55
56
  return `https://player.vimeo.com/video/${videoId}`;
56
57
  }
57
58
  }
@@ -64,8 +65,13 @@ console.log('Video URL:', videoUrl);
64
65
  <style scoped>
65
66
  .bgl_vid iframe,
66
67
  .bgl_vid video {
67
- width: 100%;
68
- height: auto;
69
- display: block
68
+ width: 100%;
69
+ height: auto;
70
+ display: block;
71
+ }
72
+
73
+ .bgl_vid.vid_empty {
74
+ padding-top: 56.25%;
75
+ background: #f0f0f0;
70
76
  }
71
77
  </style>
@@ -1,17 +1,27 @@
1
1
  <template>
2
2
  <div
3
- class="bg-dark" :class="{ 'is-side': side, 'is-active': isVisible, 'bg-lignt': false }"
4
- @click="() => (dismissable ? closeModal() : '')" @keydown.esc="closeModal"
5
- >
6
- <Card class="modal" @click.stop>
3
+ class="bg-dark"
4
+ :class="{ 'is-side': side, 'is-active': isVisible, 'bg-lignt': false }"
5
+ @click="() => (dismissable ? closeModal() : '')"
6
+ @keydown.esc="closeModal">
7
+ <Card class="modal" @click.stop :style="{ ...maxWidth }">
7
8
  <header class="tool-bar">
8
9
  <slot name="toolbar" />
9
- <Btn :style="{ float: side ? 'left' : 'right' }" flat icon="close" @click="closeModal" />
10
+ <Btn
11
+ :style="{ float: side ? 'left' : 'right' }"
12
+ flat
13
+ icon="close"
14
+ @click="closeModal" />
10
15
  <Title class="modal-title" tag="h3" v-if="title" :label="title" />
11
16
  </header>
12
17
  <slot />
13
18
  <footer class="modal-footer mt-3">
14
- <Btn v-for="(action, i) in actions" :key="i" @click="closeModal" color="gray" v-bind="action" />
19
+ <Btn
20
+ v-for="(action, i) in actions"
21
+ :key="i"
22
+ @click="closeModal"
23
+ color="gray"
24
+ v-bind="action" />
15
25
  <slot name="footer" />
16
26
  </footer>
17
27
  </Card>
@@ -20,26 +30,36 @@
20
30
 
21
31
  <script lang="ts" setup>
22
32
  import { onMounted, onUnmounted, watch } from 'vue';
23
- import {
24
- type BtnOptions, Btn, useEscape, Title, Card,
25
- } from '@bagelink/vue';
33
+ import { type BtnOptions, Btn, useEscape, Title, Card } from '@bagelink/vue';
26
34
  import '../styles/modal.css';
27
35
 
28
36
  const props = defineProps<{
29
- side?: boolean;
30
- title?: string;
31
- dismissable?: boolean;
32
- actions?: BtnOptions[];
33
- visible?: boolean;
37
+ side?: boolean;
38
+ title?: string;
39
+ width?: string;
40
+ dismissable?: boolean;
41
+ actions?: BtnOptions[];
42
+ visible?: boolean;
34
43
  }>();
35
44
 
36
45
  let isVisible = $ref<boolean>(false);
37
46
 
38
- watch(() => props.visible, (val) => {
39
- if (val === isVisible || val === undefined) return;
40
- if (val) openModal();
41
- else closeModal();
42
- }, { immediate: true });
47
+ watch(
48
+ () => props.visible,
49
+ (val) => {
50
+ if (val === isVisible || val === undefined) return;
51
+ if (val) openModal();
52
+ else closeModal();
53
+ },
54
+ { immediate: true }
55
+ );
56
+
57
+ const maxWidth = $computed(() => {
58
+ const { width } = props;
59
+ if (width?.match(/px|em|rem|vw|vh|%/)) return { 'max-width': width };
60
+ if (width?.match(/\d+/)) return { 'max-width': `${width}px` };
61
+ return { 'max-width': '720px' };
62
+ });
43
63
 
44
64
  const emit = defineEmits(['update:visible']);
45
65
 
@@ -50,10 +70,11 @@ const closeModal = () => {
50
70
 
51
71
  defineExpose({ closeModal });
52
72
 
53
- const escapeKeyClose = (e: KeyboardEvent) => props?.dismissable && useEscape(e, () => closeModal());
73
+ const escapeKeyClose = (e: KeyboardEvent) =>
74
+ props?.dismissable && useEscape(e, () => closeModal());
54
75
 
55
76
  function openModal() {
56
- setTimeout(() => isVisible = true, 1);
77
+ setTimeout(() => (isVisible = true), 1);
57
78
  }
58
79
 
59
80
  onMounted(() => document.addEventListener('keydown', escapeKeyClose));
@@ -65,35 +86,35 @@ onUnmounted(() => {
65
86
 
66
87
  <style>
67
88
  .modal-title {
68
- text-align: center;
69
- font-weight: 600;
70
- font-size: 20px;
71
- margin-top: 0.5rem;
72
- margin-bottom: 0 !important;
73
- width: 100%;
74
- -webkit-padding-end: 40px;
75
- padding-inline-end: 40px;
76
- line-height: 2;
77
- display: -webkit-box;
78
- max-width: 100%;
79
- -webkit-line-clamp: 1;
80
- -webkit-box-orient: vertical;
81
- overflow: hidden;
82
- text-overflow: ellipsis;
89
+ text-align: center;
90
+ font-weight: 600;
91
+ font-size: 20px;
92
+ margin-top: 0.5rem;
93
+ margin-bottom: 0 !important;
94
+ width: 100%;
95
+ -webkit-padding-end: 40px;
96
+ padding-inline-end: 40px;
97
+ line-height: 2;
98
+ display: -webkit-box;
99
+ max-width: 100%;
100
+ -webkit-line-clamp: 1;
101
+ -webkit-box-orient: vertical;
102
+ overflow: hidden;
103
+ text-overflow: ellipsis;
83
104
  }
84
105
 
85
106
  .modal-footer {
86
- gap: 1rem;
87
- display: flex;
88
- justify-content: space-between;
89
- align-items: center;
107
+ gap: 1rem;
108
+ display: flex;
109
+ justify-content: space-between;
110
+ align-items: center;
90
111
  }
91
112
 
92
- .modal-footer>div {
93
- gap: 1rem;
94
- display: flex;
95
- justify-content: space-between;
96
- align-items: center;
97
- gap: 0;
113
+ .modal-footer > div {
114
+ gap: 1rem;
115
+ display: flex;
116
+ justify-content: space-between;
117
+ align-items: center;
118
+ gap: 0;
98
119
  }
99
120
  </style>