@energysage/es-ds-components 3.0.9 → 3.0.11

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.
@@ -20,6 +20,7 @@ const props = defineProps({
20
20
  });
21
21
 
22
22
  const userDeterminedState: Ref<boolean | null> = ref(null);
23
+ const uniqueId = useId();
23
24
 
24
25
  // directly determines the expanded/collapsed state of the panel
25
26
  const expanded = computed(() => {
@@ -52,7 +53,7 @@ const onClick = ({ value }: { value: boolean }) => {
52
53
  <template>
53
54
  <panel
54
55
  :collapsed="!expanded"
55
- :header="expanded ? 'click to collapse content' : 'click to expand content'"
56
+ :toggle-button-props="{ 'aria-labelledby': uniqueId }"
56
57
  :pt="{
57
58
  header: 'd-flex flex-column justify-content-center position-relative py-100',
58
59
  icons: 'h-100 position-absolute w-100',
@@ -74,7 +75,9 @@ const onClick = ({ value }: { value: boolean }) => {
74
75
  toggleable
75
76
  @toggle="onClick">
76
77
  <template #header>
77
- <slot name="title" />
78
+ <div :id="uniqueId">
79
+ <slot name="title" />
80
+ </div>
78
81
  </template>
79
82
  <template #togglericon>
80
83
  <icon-chevron-down />
@@ -1,21 +1,26 @@
1
1
  <script setup lang="ts">
2
- const props = defineProps({
3
- dark: {
4
- type: Boolean,
5
- default: false,
6
- },
7
- hasButton: {
8
- type: Boolean,
9
- default: false,
10
- },
11
- // default or wide
12
- variant: {
13
- type: String,
14
- default: 'default',
15
- },
2
+ interface Props {
3
+ alignMobile?: 'left' | 'center' | 'right';
4
+ background?: 'none' | 'blue-300-radial' | 'dark-blue';
5
+ hasButton?: boolean;
6
+ variant?: 'default' | 'stacked' | 'wide';
7
+ // deprecated
8
+ dark?: boolean;
9
+ }
10
+ const props = withDefaults(defineProps<Props>(), {
11
+ alignMobile: 'center',
12
+ background: 'none',
13
+ hasButton: false,
14
+ variant: 'default',
15
+ // deprecated
16
+ dark: false,
16
17
  });
17
18
 
18
19
  const lgFirst = computed(() => {
20
+ if (props.variant === 'stacked') {
21
+ return '12';
22
+ }
23
+
19
24
  if (props.variant === 'wide') {
20
25
  return props.hasButton ? '8' : '6';
21
26
  }
@@ -24,6 +29,10 @@ const lgFirst = computed(() => {
24
29
  });
25
30
 
26
31
  const lgSecond = computed(() => {
32
+ if (props.variant === 'stacked') {
33
+ return '12';
34
+ }
35
+
27
36
  if (props.variant === 'wide') {
28
37
  return props.hasButton ? '4' : '6';
29
38
  }
@@ -32,6 +41,10 @@ const lgSecond = computed(() => {
32
41
  });
33
42
 
34
43
  const xxlFirst = computed(() => {
44
+ if (props.variant === 'stacked') {
45
+ return '12';
46
+ }
47
+
35
48
  if (props.variant === 'wide') {
36
49
  return props.hasButton ? '8' : '6';
37
50
  }
@@ -40,6 +53,10 @@ const xxlFirst = computed(() => {
40
53
  });
41
54
 
42
55
  const xxlSecond = computed(() => {
56
+ if (props.variant === 'stacked') {
57
+ return '12';
58
+ }
59
+
43
60
  if (props.variant === 'wide') {
44
61
  return props.hasButton ? '4' : '6';
45
62
  }
@@ -52,7 +69,8 @@ const xxlSecond = computed(() => {
52
69
  <es-card
53
70
  :class="[
54
71
  {
55
- 'bg-dark-blue border-dark-blue text-white': dark,
72
+ 'bg-dark-blue border-dark-blue text-white': dark || background === 'dark-blue',
73
+ 'bg-blue-300-radial-gradient': background === 'blue-300-radial',
56
74
  'px-100 px-lg-200': variant === 'default',
57
75
  'px-100 px-lg-300': variant === 'wide',
58
76
  },
@@ -60,7 +78,12 @@ const xxlSecond = computed(() => {
60
78
  v-bind="$attrs">
61
79
  <es-row>
62
80
  <es-col
63
- class="mb-200 my-lg-auto text-center text-lg-left"
81
+ class="text-lg-left"
82
+ :class="{
83
+ [`text-${alignMobile}`]: true,
84
+ 'mb-100': variant === 'stacked',
85
+ 'mb-200 my-lg-auto': variant !== 'stacked',
86
+ }"
64
87
  :lg="lgFirst"
65
88
  :xxl="xxlFirst">
66
89
  <!-- avoiding use of an <h2> tag here for long-form content SEO reasons,
@@ -70,10 +93,10 @@ const xxlSecond = computed(() => {
70
93
  aria-level="2"
71
94
  class="font-weight-semibold"
72
95
  :class="{
73
- 'font-size-300': variant === 'default',
96
+ 'font-size-300': variant === 'default' || variant === 'stacked',
74
97
  'mb-50': $slots.subtitle,
75
98
  'mb-0': !$slots.subtitle,
76
- 'text-white': dark,
99
+ 'text-white': dark || background === 'dark-blue',
77
100
  h2: variant === 'wide',
78
101
  }">
79
102
  <slot name="heading"> Easily find what solar costs in your area </slot>
@@ -85,7 +108,10 @@ const xxlSecond = computed(() => {
85
108
  </p>
86
109
  </es-col>
87
110
  <es-col
88
- class="d-flex justify-content-center justify-content-lg-end my-auto"
111
+ class="d-flex justify-content-center my-auto"
112
+ :class="{
113
+ 'justify-content-lg-end': variant !== 'stacked',
114
+ }"
89
115
  :lg="lgSecond"
90
116
  :xxl="xxlSecond">
91
117
  <slot name="cta" />
@@ -93,3 +119,19 @@ const xxlSecond = computed(() => {
93
119
  </es-row>
94
120
  </es-card>
95
121
  </template>
122
+
123
+ <style lang="scss" scoped>
124
+ @use '@energysage/es-ds-styles/scss/mixins/breakpoints' as breakpoints;
125
+ @use '@energysage/es-ds-styles/scss/variables' as variables;
126
+
127
+ .bg-blue-300-radial-gradient {
128
+ background:
129
+ radial-gradient(44.92% 45.42% at 5.14% 6.4%, rgba(133, 178, 255, 0) 0%, variables.$blue-300 100%), #fff;
130
+
131
+ @include breakpoints.media-breakpoint-up(md) {
132
+ background:
133
+ radial-gradient(95.61% 111.81% at -0.65% 0%, rgba(133, 178, 255, 0) 0%, variables.$blue-300 100%),
134
+ variables.$white;
135
+ }
136
+ }
137
+ </style>
@@ -1,12 +1,15 @@
1
1
  <script setup lang="ts">
2
2
  import TabPanel from 'primevue/tabpanel';
3
3
  import TabView from 'primevue/tabview';
4
+ import { Comment } from 'vue';
4
5
 
5
6
  // allow use of v-model on this component
6
7
  const model = defineModel<number>();
7
8
 
8
- // get the list of elements provided as children to the default slot
9
- const initialChildren = useSlots().default?.() || [];
9
+ // get the list of elements provided as children to the default slot - filtering out comments
10
+ const rawChildren = useSlots().default?.() || [];
11
+ const initialChildren = rawChildren.filter((child) => child.type !== Comment);
12
+
10
13
  const panels: any[] = [];
11
14
  initialChildren.forEach((child) => {
12
15
  // unless this has a v-for element and we instead need to access its children
@@ -12,7 +12,7 @@ const showVideo = ref(false);
12
12
 
13
13
  // Methods
14
14
  function getVideoIdFromUrl(url: string) {
15
- const embedPattern = /https:\/\/www\.youtube\.com\/embed\/(?<videoId>[A-Za-z0-9-]+)/;
15
+ const embedPattern = /https:\/\/www\.youtube\.com\/embed\/(?<videoId>[_A-Za-z0-9-]+)/;
16
16
  const parsedUrl = embedPattern.exec(url);
17
17
  if (parsedUrl) {
18
18
  return parsedUrl?.groups?.videoId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energysage/es-ds-components",
3
- "version": "3.0.9",
3
+ "version": "3.0.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "An EnergySage Vue component library",