@energysage/es-ds-components 3.0.0-alpha.8 → 3.0.0

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 (183) hide show
  1. package/README.md +0 -3
  2. package/components/es-accordion-list.vue +29 -7
  3. package/components/es-breadcrumbs.vue +1 -1
  4. package/components/es-button.vue +13 -3
  5. package/components/es-carousel.vue +524 -69
  6. package/components/es-col.vue +5 -5
  7. package/components/es-collapse.vue +2 -2
  8. package/components/es-container.vue +10 -1
  9. package/components/es-cta-banner.vue +1 -1
  10. package/components/es-cta-card.vue +1 -1
  11. package/components/es-data-table-column.vue +20 -0
  12. package/components/es-data-table-simple.vue +1 -1
  13. package/components/es-data-table.vue +35 -86
  14. package/components/es-file-input.vue +8 -5
  15. package/components/es-footer.vue +33 -4
  16. package/components/es-modal.vue +1 -1
  17. package/components/es-nav-bar-account-menu.vue +4 -1
  18. package/components/es-nav-bar-featured-article.vue +1 -1
  19. package/components/es-nav-bar-link.vue +1 -1
  20. package/components/es-nav-bar-product-menu.vue +5 -1
  21. package/components/es-nav-bar-top-level-menu.vue +2 -1
  22. package/components/es-nav-bar-topic-menu.vue +4 -1
  23. package/components/es-nav-bar.vue +19 -4
  24. package/components/es-pagination.vue +1 -0
  25. package/components/es-reviews-io-card-carousel.vue +5 -1
  26. package/components/es-segmented-control.vue +237 -0
  27. package/components/es-tabs.vue +13 -3
  28. package/components/es-video.vue +4 -2
  29. package/components/es-view-more.vue +1 -0
  30. package/components/es-zip-code-form.vue +2 -2
  31. package/components/icon/arrow-clockwise.vue +1 -1
  32. package/components/icon/arrow-counter-clockwise.vue +1 -1
  33. package/components/icon/arrow-cycle.vue +1 -1
  34. package/components/icon/arrow-left.vue +1 -1
  35. package/components/icon/arrow-right.vue +1 -1
  36. package/components/icon/arrow-up.vue +1 -1
  37. package/components/icon/arrow.vue +1 -1
  38. package/components/icon/bank.vue +1 -1
  39. package/components/icon/bell.vue +1 -1
  40. package/components/icon/block.vue +1 -1
  41. package/components/icon/calculator.vue +1 -1
  42. package/components/icon/calendar.vue +1 -1
  43. package/components/icon/cart.vue +1 -1
  44. package/components/icon/ccpa-opt-out.vue +61 -0
  45. package/components/icon/chat-add.vue +1 -1
  46. package/components/icon/chat-approve.vue +1 -1
  47. package/components/icon/chat-bubble.vue +1 -1
  48. package/components/icon/chat-dots.vue +1 -1
  49. package/components/icon/check.vue +1 -1
  50. package/components/icon/chevron-down.vue +1 -1
  51. package/components/icon/chevron-horizontal.vue +1 -1
  52. package/components/icon/chevron-left.vue +1 -1
  53. package/components/icon/chevron-right.vue +1 -1
  54. package/components/icon/chevron-up.vue +1 -1
  55. package/components/icon/circle-alert.vue +1 -1
  56. package/components/icon/circle-check.vue +1 -1
  57. package/components/icon/circle-chevron-down.vue +1 -1
  58. package/components/icon/circle-chevron-left.vue +1 -1
  59. package/components/icon/circle-chevron-right.vue +1 -1
  60. package/components/icon/circle-chevron-up.vue +1 -1
  61. package/components/icon/circle-minus.vue +1 -1
  62. package/components/icon/circle-plus.vue +1 -1
  63. package/components/icon/circle-x.vue +1 -1
  64. package/components/icon/circle.vue +1 -1
  65. package/components/icon/clock.vue +1 -1
  66. package/components/icon/companies.vue +1 -1
  67. package/components/icon/contact-us.vue +1 -1
  68. package/components/icon/copy.vue +1 -1
  69. package/components/icon/credit-card.vue +1 -1
  70. package/components/icon/document.vue +1 -1
  71. package/components/icon/electricity-circle.vue +1 -1
  72. package/components/icon/envelope.vue +1 -1
  73. package/components/icon/es-leaf.vue +1 -1
  74. package/components/icon/eye.vue +1 -1
  75. package/components/icon/facebook.vue +1 -1
  76. package/components/icon/flag.vue +1 -1
  77. package/components/icon/folder.vue +1 -1
  78. package/components/icon/gift.vue +1 -1
  79. package/components/icon/hamburger.vue +1 -1
  80. package/components/icon/heart.vue +1 -1
  81. package/components/icon/image.vue +1 -1
  82. package/components/icon/info-blog-post.vue +1 -1
  83. package/components/icon/info.vue +1 -1
  84. package/components/icon/instagram.vue +1 -1
  85. package/components/icon/light-bulb.vue +1 -1
  86. package/components/icon/link-out.vue +1 -1
  87. package/components/icon/linkedin.vue +1 -1
  88. package/components/icon/location.vue +1 -1
  89. package/components/icon/lock-off.vue +1 -1
  90. package/components/icon/lock-on.vue +1 -1
  91. package/components/icon/marketplace.vue +1 -1
  92. package/components/icon/minus.vue +1 -1
  93. package/components/icon/open-envelope.vue +1 -1
  94. package/components/icon/paper.vue +1 -1
  95. package/components/icon/pencil.vue +1 -1
  96. package/components/icon/person-add.vue +1 -1
  97. package/components/icon/person-check.vue +1 -1
  98. package/components/icon/person-cross.vue +1 -1
  99. package/components/icon/person.vue +1 -1
  100. package/components/icon/phone.vue +1 -1
  101. package/components/icon/play.vue +1 -1
  102. package/components/icon/plus.vue +1 -1
  103. package/components/icon/settings-horizontal.vue +1 -1
  104. package/components/icon/settings-vertical.vue +1 -1
  105. package/components/icon/shield-with-check.vue +1 -1
  106. package/components/icon/shield.vue +1 -1
  107. package/components/icon/shopping-bag.vue +1 -1
  108. package/components/icon/sound-down.vue +1 -1
  109. package/components/icon/sound-off.vue +1 -1
  110. package/components/icon/sound-on.vue +1 -1
  111. package/components/icon/sound-up.vue +1 -1
  112. package/components/icon/star-empty.vue +1 -1
  113. package/components/icon/star-full.vue +1 -1
  114. package/components/icon/star-half.vue +1 -1
  115. package/components/icon/state-ak.vue +1 -1
  116. package/components/icon/state-al.vue +1 -1
  117. package/components/icon/state-ar.vue +1 -1
  118. package/components/icon/state-az.vue +1 -1
  119. package/components/icon/state-ca.vue +1 -1
  120. package/components/icon/state-co.vue +1 -1
  121. package/components/icon/state-ct.vue +1 -1
  122. package/components/icon/state-dc.vue +1 -1
  123. package/components/icon/state-de.vue +1 -1
  124. package/components/icon/state-fl.vue +1 -1
  125. package/components/icon/state-ga.vue +1 -1
  126. package/components/icon/state-hi.vue +1 -1
  127. package/components/icon/state-ia.vue +1 -1
  128. package/components/icon/state-id.vue +1 -1
  129. package/components/icon/state-il.vue +1 -1
  130. package/components/icon/state-in.vue +1 -1
  131. package/components/icon/state-ks.vue +1 -1
  132. package/components/icon/state-ky.vue +1 -1
  133. package/components/icon/state-la.vue +1 -1
  134. package/components/icon/state-ma.vue +1 -1
  135. package/components/icon/state-md.vue +1 -1
  136. package/components/icon/state-me.vue +1 -1
  137. package/components/icon/state-mi.vue +1 -1
  138. package/components/icon/state-mn.vue +1 -1
  139. package/components/icon/state-mo.vue +1 -1
  140. package/components/icon/state-ms.vue +1 -1
  141. package/components/icon/state-mt.vue +1 -1
  142. package/components/icon/state-nc.vue +1 -1
  143. package/components/icon/state-nd.vue +1 -1
  144. package/components/icon/state-ne.vue +1 -1
  145. package/components/icon/state-nh.vue +1 -1
  146. package/components/icon/state-nj.vue +1 -1
  147. package/components/icon/state-nm.vue +1 -1
  148. package/components/icon/state-nv.vue +1 -1
  149. package/components/icon/state-ny.vue +1 -1
  150. package/components/icon/state-oh.vue +1 -1
  151. package/components/icon/state-ok.vue +1 -1
  152. package/components/icon/state-or.vue +1 -1
  153. package/components/icon/state-pa.vue +1 -1
  154. package/components/icon/state-ri.vue +1 -1
  155. package/components/icon/state-sc.vue +1 -1
  156. package/components/icon/state-sd.vue +1 -1
  157. package/components/icon/state-tn.vue +1 -1
  158. package/components/icon/state-tx.vue +1 -1
  159. package/components/icon/state-ut.vue +1 -1
  160. package/components/icon/state-va.vue +1 -1
  161. package/components/icon/state-vt.vue +1 -1
  162. package/components/icon/state-wa.vue +1 -1
  163. package/components/icon/state-wi.vue +1 -1
  164. package/components/icon/state-wv.vue +1 -1
  165. package/components/icon/state-wy.vue +1 -1
  166. package/components/icon/thumbs-up.vue +1 -1
  167. package/components/icon/trash-can.vue +1 -1
  168. package/components/icon/twitter.vue +1 -1
  169. package/components/icon/verified.vue +1 -1
  170. package/components/icon/wifi.vue +1 -1
  171. package/components/icon/x.vue +1 -1
  172. package/components/icon/youtube.vue +1 -1
  173. package/composables/forms.ts +1 -1
  174. package/nuxt.config.ts +9 -0
  175. package/package.json +2 -1
  176. package/types/es-carousel.ts +12 -0
  177. package/types/index.ts +1 -0
  178. package/utils/forms.ts +120 -0
  179. package/utils/{get-es-footer-content.js → get-es-footer-content.ts} +1 -0
  180. package/{lib-utils/mime-type-finder.js → utils/mime-type-finder.ts} +2 -2
  181. package/utils/vuelidate-keys.ts +39 -0
  182. /package/utils/{get-es-nav-bar-account-content.js → get-es-nav-bar-account-content.ts} +0 -0
  183. /package/utils/{get-es-nav-bar-global-content.js → get-es-nav-bar-global-content.ts} +0 -0
package/README.md CHANGED
@@ -8,9 +8,6 @@ An EnergySage Nuxt layer library with design system components
8
8
  npm install @energysage/es-ds-components
9
9
  ```
10
10
 
11
- _*Note: this library is in pre-release development, so the above command won't yet work, as this package
12
- is not yet published to NPM.*_
13
-
14
11
  Once the package is installed, you'll need to add a reference to it in your nuxt.config.ts like so:
15
12
 
16
13
  ```
@@ -14,12 +14,23 @@ const props = withDefaults(defineProps<Props>(), {
14
14
  variant: 'default',
15
15
  });
16
16
 
17
- // eslint-disable-next-line vue/require-prop-types
18
- const model = defineModel();
17
+ const model = defineModel<string>();
19
18
 
20
- const children = useSlots().default?.() || [];
19
+ // get the list of elements provided as children to the default slot
20
+ const initialChildren = useSlots().default?.() || [];
21
+ const children: any[] = [];
22
+ initialChildren.forEach((child) => {
23
+ // unless this has a v-for element and we instead need to access its children
24
+ if (typeof child.type === 'symbol' && Array.isArray(child.children)) {
25
+ children.push(...child.children);
26
+ } else {
27
+ children.push(child);
28
+ }
29
+ });
30
+
31
+ type ActiveChildren = null | number | number[];
21
32
 
22
- const activeIndex = ref();
33
+ const activeIndex: Ref<ActiveChildren> = ref(null);
23
34
 
24
35
  watch(model, (newVal) => {
25
36
  if (newVal) {
@@ -29,19 +40,30 @@ watch(model, (newVal) => {
29
40
 
30
41
  const accordionTabs = children.map((child, index) => {
31
42
  if (child.props.id === props.initialExpandedId || child.props.id === model.value) {
32
- activeIndex.value = index;
43
+ if (props.allowMultipleExpand) {
44
+ activeIndex.value = [index];
45
+ } else {
46
+ activeIndex.value = index;
47
+ }
33
48
  }
34
49
  return child.children;
35
50
  });
36
51
 
37
- const updateActiveIndex = (index) => {
52
+ const updateActiveIndex = (index: ActiveChildren) => {
38
53
  if (model.value) {
39
- model.value = children[index]?.props.id || '';
54
+ if (typeof index === 'number') {
55
+ model.value = children[index]?.props.id || '';
56
+ } else if (index === null) {
57
+ model.value = '';
58
+ }
59
+ // There's another case where index will be an array. In that case, v-model is unsupported as specified
60
+ // in the documentation, so no update is made
40
61
  }
41
62
  };
42
63
  </script>
43
64
 
44
65
  <template>
66
+ <!-- @vue-expect-error PrimeVue's type information is wrong -->
45
67
  <accordion
46
68
  :multiple="allowMultipleExpand"
47
69
  :active-index="activeIndex"
@@ -13,7 +13,7 @@ const model = computed(() => {
13
13
  return [];
14
14
  }
15
15
 
16
- return props.items.map((item) => ({
16
+ return props.items.map((item: any) => ({
17
17
  ...item,
18
18
  // mark breadcrumb as active if manually set or if it matches this route
19
19
  active: item.active || route.path === item.to || route.path === item.href,
@@ -83,10 +83,20 @@ const getRootClasses = computed(() => {
83
83
  </script>
84
84
 
85
85
  <template>
86
+ <!--
87
+ <a> is needed for href because a root-relative link like /market/start/
88
+ that is passed to <nuxt-link :to="" /> will attempt to internally navigate
89
+ within a micro frontend, which will result in a 404
90
+ -->
91
+ <a
92
+ v-if="props.href"
93
+ :class="getRootClasses"
94
+ :href="props.href">
95
+ <slot />
96
+ </a>
86
97
  <nuxt-link
87
- v-if="props.href || props.to"
88
- :href="props.href || undefined"
89
- :to="props.to || undefined"
98
+ v-else-if="props.to"
99
+ :to="props.to"
90
100
  :class="getRootClasses">
91
101
  <slot />
92
102
  </nuxt-link>