@energysage/es-ds-components 3.1.2 → 3.1.3

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.
@@ -1,33 +1,30 @@
1
1
  <script setup lang="ts">
2
2
  import PrimeDialog from 'primevue/dialog';
3
3
 
4
- const props = defineProps({
5
- id: {
6
- type: String,
7
- required: true,
8
- },
9
- hideFooter: {
10
- type: Boolean,
11
- default: false,
12
- },
13
- size: {
14
- type: String,
15
- default: 'md',
16
- validator: (val: string) => ['sm', 'md', 'lg', 'xl'].includes(val),
17
- },
18
- bodyClass: {
19
- type: String,
20
- required: false,
21
- default: '',
22
- },
4
+ interface Props {
5
+ bodyClass?: string;
6
+ closable?: boolean;
7
+ hideFooter?: boolean;
8
+ id: string;
9
+ showFooterSeparator?: boolean;
10
+ size?: 'sm' | 'md' | 'lg' | 'xl';
11
+ }
12
+ const props = withDefaults(defineProps<Props>(), {
13
+ bodyClass: '',
14
+ closable: true,
15
+ hideFooter: false,
16
+ showFooterSeparator: true,
17
+ size: 'md',
23
18
  });
24
19
 
20
+ const slots = useSlots();
21
+
25
22
  const modalPt = {
26
23
  root: {
27
24
  class: 'modal-dialog modal-dialog-scrollable modal-content',
28
25
  },
29
26
  header: {
30
- class: 'modal-header',
27
+ class: slots['modal-title'] ? 'modal-header' : '',
31
28
  },
32
29
  title: {
33
30
  class: 'modal-title',
@@ -39,7 +36,7 @@ const modalPt = {
39
36
  class: `modal-body ${props.bodyClass}`,
40
37
  },
41
38
  footer: {
42
- class: 'modal-footer',
39
+ class: `modal-footer ${props.showFooterSeparator ? 'footer-separator' : ''}`,
43
40
  },
44
41
  mask: {
45
42
  class: 'es-modal-mask',
@@ -64,7 +61,7 @@ const onChange = (visible: boolean) => {
64
61
  };
65
62
 
66
63
  const getSizeClass = computed(() => {
67
- const modalSize = props.size === '' ? 'modal-md' : `modal-${props.size}`;
64
+ const modalSize = `modal-${props.size}`;
68
65
  return modalSize;
69
66
  });
70
67
  </script>
@@ -75,9 +72,12 @@ const getSizeClass = computed(() => {
75
72
  modal
76
73
  :class="getSizeClass"
77
74
  :pt="modalPt"
75
+ :closable="closable"
78
76
  dismissable-mask
79
77
  @update:visible="onChange">
80
- <template #header>
78
+ <template
79
+ v-if="slots['modal-title']"
80
+ #header>
81
81
  <h5
82
82
  :id="`${id}_header`"
83
83
  class="modal-title h2">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energysage/es-ds-components",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "An EnergySage Vue component library",