@energysage/es-ds-components 0.0.1 → 3.0.0-alpha.10

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 (234) hide show
  1. package/.eslintignore +9 -0
  2. package/.eslintrc.json +3 -0
  3. package/.prettierrc.json +10 -0
  4. package/README.md +0 -3
  5. package/components/es-accordion-list.vue +117 -0
  6. package/components/es-accordion.vue +7 -0
  7. package/components/es-badge.vue +20 -0
  8. package/components/es-breadcrumbs.vue +73 -0
  9. package/components/es-button.vue +122 -0
  10. package/components/es-card.vue +64 -0
  11. package/components/es-carousel.vue +316 -0
  12. package/components/es-col.vue +27 -0
  13. package/components/es-collapse.vue +83 -0
  14. package/components/es-container.vue +14 -0
  15. package/components/es-cta-banner.vue +95 -0
  16. package/components/es-cta-card.vue +60 -0
  17. package/components/es-data-table-simple.vue +73 -0
  18. package/components/es-data-table.vue +128 -0
  19. package/components/es-error-page.vue +120 -0
  20. package/components/es-file-input.vue +334 -0
  21. package/components/es-file-preview-modal.vue +61 -0
  22. package/components/es-footer.vue +163 -0
  23. package/components/es-form-checkbox.vue +40 -0
  24. package/components/es-form-input.vue +130 -0
  25. package/components/es-form-msg.vue +81 -0
  26. package/components/es-form-radio-card.vue +57 -0
  27. package/components/es-form-radio-cards.vue +78 -0
  28. package/components/es-form-textarea.vue +124 -0
  29. package/components/es-form.vue +16 -0
  30. package/components/es-modal.vue +103 -0
  31. package/components/es-nav-bar-account-menu.vue +70 -0
  32. package/components/es-nav-bar-featured-article.vue +60 -0
  33. package/components/es-nav-bar-link.vue +27 -0
  34. package/components/es-nav-bar-product-menu.vue +219 -0
  35. package/components/es-nav-bar-top-level-menu.vue +194 -0
  36. package/components/es-nav-bar-topic-menu.vue +197 -0
  37. package/components/es-nav-bar.vue +411 -0
  38. package/components/es-pagination.vue +67 -0
  39. package/components/es-popover.vue +113 -0
  40. package/components/es-progress-circle.vue +81 -0
  41. package/components/es-progress.vue +36 -0
  42. package/components/es-radio-button-group.vue +53 -0
  43. package/components/es-radio-button.vue +57 -0
  44. package/components/es-rating.vue +120 -0
  45. package/components/es-reviews-io-card-carousel.vue +279 -0
  46. package/components/es-row.vue +5 -0
  47. package/components/es-skeleton-img.vue +38 -0
  48. package/components/es-skeleton-wrapper.vue +17 -0
  49. package/components/es-skeleton.vue +97 -0
  50. package/components/es-slider.vue +218 -0
  51. package/components/es-spinner.vue +22 -0
  52. package/components/es-support-card.vue +150 -0
  53. package/components/es-support.vue +66 -0
  54. package/components/es-tab.vue +7 -0
  55. package/components/es-tabs.vue +70 -0
  56. package/components/es-verification-code.vue +94 -0
  57. package/components/es-video.vue +60 -0
  58. package/components/es-view-more.vue +64 -0
  59. package/components/es-zip-code-form.vue +204 -0
  60. package/components/icon/arrow-clockwise.vue +51 -0
  61. package/components/icon/arrow-counter-clockwise.vue +37 -0
  62. package/components/icon/arrow-cycle.vue +43 -0
  63. package/components/icon/arrow-left.vue +39 -0
  64. package/components/icon/arrow-right.vue +39 -0
  65. package/components/icon/arrow-up.vue +39 -0
  66. package/components/icon/arrow.vue +68 -0
  67. package/components/icon/bank.vue +38 -0
  68. package/components/icon/battery.vue +40 -0
  69. package/components/icon/bell.vue +42 -0
  70. package/components/icon/block.vue +46 -0
  71. package/components/icon/bolt.vue +38 -0
  72. package/components/icon/business.vue +42 -0
  73. package/components/icon/calculator.vue +37 -0
  74. package/components/icon/calendar.vue +46 -0
  75. package/components/icon/cart.vue +46 -0
  76. package/components/icon/chat-add.vue +44 -0
  77. package/components/icon/chat-approve.vue +42 -0
  78. package/components/icon/chat-bubble.vue +40 -0
  79. package/components/icon/chat-dots.vue +42 -0
  80. package/components/icon/check.vue +39 -0
  81. package/components/icon/chevron-down.vue +39 -0
  82. package/components/icon/chevron-horizontal.vue +39 -0
  83. package/components/icon/chevron-left.vue +39 -0
  84. package/components/icon/chevron-right.vue +39 -0
  85. package/components/icon/chevron-up.vue +39 -0
  86. package/components/icon/circle-alert.vue +46 -0
  87. package/components/icon/circle-check.vue +46 -0
  88. package/components/icon/circle-chevron-down.vue +47 -0
  89. package/components/icon/circle-chevron-left.vue +46 -0
  90. package/components/icon/circle-chevron-right.vue +46 -0
  91. package/components/icon/circle-chevron-up.vue +46 -0
  92. package/components/icon/circle-minus.vue +46 -0
  93. package/components/icon/circle-plus.vue +46 -0
  94. package/components/icon/circle-x.vue +46 -0
  95. package/components/icon/circle.vue +42 -0
  96. package/components/icon/clock.vue +46 -0
  97. package/components/icon/community-solar.vue +37 -0
  98. package/components/icon/companies.vue +43 -0
  99. package/components/icon/contact-us.vue +37 -0
  100. package/components/icon/copy.vue +45 -0
  101. package/components/icon/credit-card.vue +37 -0
  102. package/components/icon/document.vue +45 -0
  103. package/components/icon/electric-vehicle.vue +37 -0
  104. package/components/icon/electricity-circle.vue +39 -0
  105. package/components/icon/envelope.vue +45 -0
  106. package/components/icon/es-leaf.vue +39 -0
  107. package/components/icon/eye.vue +41 -0
  108. package/components/icon/facebook.vue +41 -0
  109. package/components/icon/file-doc.vue +72 -0
  110. package/components/icon/file-docx.vue +72 -0
  111. package/components/icon/file-pdf.vue +72 -0
  112. package/components/icon/flag.vue +37 -0
  113. package/components/icon/folder.vue +41 -0
  114. package/components/icon/gear.vue +37 -0
  115. package/components/icon/gift.vue +37 -0
  116. package/components/icon/hamburger.vue +38 -0
  117. package/components/icon/heart.vue +39 -0
  118. package/components/icon/heat-pump.vue +41 -0
  119. package/components/icon/image.vue +45 -0
  120. package/components/icon/info-blog-post.vue +47 -0
  121. package/components/icon/info.vue +45 -0
  122. package/components/icon/instagram.vue +49 -0
  123. package/components/icon/light-bulb.vue +36 -0
  124. package/components/icon/link-out.vue +38 -0
  125. package/components/icon/linkedin.vue +41 -0
  126. package/components/icon/location.vue +45 -0
  127. package/components/icon/lock-off.vue +45 -0
  128. package/components/icon/lock-on.vue +48 -0
  129. package/components/icon/marketplace.vue +43 -0
  130. package/components/icon/minus.vue +38 -0
  131. package/components/icon/money-bag.vue +37 -0
  132. package/components/icon/money.vue +35 -0
  133. package/components/icon/open-envelope.vue +45 -0
  134. package/components/icon/paper.vue +45 -0
  135. package/components/icon/payback.vue +37 -0
  136. package/components/icon/pencil.vue +45 -0
  137. package/components/icon/person-add.vue +41 -0
  138. package/components/icon/person-check.vue +41 -0
  139. package/components/icon/person-cross.vue +41 -0
  140. package/components/icon/person.vue +41 -0
  141. package/components/icon/phone.vue +41 -0
  142. package/components/icon/play.vue +41 -0
  143. package/components/icon/plus.vue +38 -0
  144. package/components/icon/roof.vue +37 -0
  145. package/components/icon/rooftop-solar.vue +37 -0
  146. package/components/icon/saving.vue +37 -0
  147. package/components/icon/search.vue +43 -0
  148. package/components/icon/settings-horizontal.vue +57 -0
  149. package/components/icon/settings-vertical.vue +57 -0
  150. package/components/icon/shield-with-check.vue +38 -0
  151. package/components/icon/shield.vue +41 -0
  152. package/components/icon/shopping-bag.vue +39 -0
  153. package/components/icon/solar.vue +37 -0
  154. package/components/icon/sound-down.vue +45 -0
  155. package/components/icon/sound-off.vue +41 -0
  156. package/components/icon/sound-on.vue +41 -0
  157. package/components/icon/sound-up.vue +41 -0
  158. package/components/icon/star-empty.vue +38 -0
  159. package/components/icon/star-full.vue +36 -0
  160. package/components/icon/star-half.vue +55 -0
  161. package/components/icon/state-ak.vue +53 -0
  162. package/components/icon/state-al.vue +38 -0
  163. package/components/icon/state-ar.vue +38 -0
  164. package/components/icon/state-az.vue +38 -0
  165. package/components/icon/state-ca.vue +38 -0
  166. package/components/icon/state-co.vue +38 -0
  167. package/components/icon/state-ct.vue +38 -0
  168. package/components/icon/state-dc.vue +52 -0
  169. package/components/icon/state-de.vue +38 -0
  170. package/components/icon/state-fl.vue +38 -0
  171. package/components/icon/state-ga.vue +38 -0
  172. package/components/icon/state-hi.vue +59 -0
  173. package/components/icon/state-ia.vue +38 -0
  174. package/components/icon/state-id.vue +38 -0
  175. package/components/icon/state-il.vue +38 -0
  176. package/components/icon/state-in.vue +38 -0
  177. package/components/icon/state-ks.vue +38 -0
  178. package/components/icon/state-ky.vue +38 -0
  179. package/components/icon/state-la.vue +38 -0
  180. package/components/icon/state-ma.vue +38 -0
  181. package/components/icon/state-md.vue +39 -0
  182. package/components/icon/state-me.vue +38 -0
  183. package/components/icon/state-mi.vue +38 -0
  184. package/components/icon/state-mn.vue +38 -0
  185. package/components/icon/state-mo.vue +38 -0
  186. package/components/icon/state-ms.vue +38 -0
  187. package/components/icon/state-mt.vue +38 -0
  188. package/components/icon/state-nc.vue +38 -0
  189. package/components/icon/state-nd.vue +38 -0
  190. package/components/icon/state-ne.vue +38 -0
  191. package/components/icon/state-nh.vue +38 -0
  192. package/components/icon/state-nj.vue +37 -0
  193. package/components/icon/state-nm.vue +38 -0
  194. package/components/icon/state-nv.vue +38 -0
  195. package/components/icon/state-ny.vue +41 -0
  196. package/components/icon/state-oh.vue +38 -0
  197. package/components/icon/state-ok.vue +38 -0
  198. package/components/icon/state-or.vue +38 -0
  199. package/components/icon/state-pa.vue +38 -0
  200. package/components/icon/state-ri.vue +38 -0
  201. package/components/icon/state-sc.vue +38 -0
  202. package/components/icon/state-sd.vue +38 -0
  203. package/components/icon/state-tn.vue +38 -0
  204. package/components/icon/state-tx.vue +38 -0
  205. package/components/icon/state-ut.vue +38 -0
  206. package/components/icon/state-va.vue +38 -0
  207. package/components/icon/state-vt.vue +38 -0
  208. package/components/icon/state-wa.vue +38 -0
  209. package/components/icon/state-wi.vue +38 -0
  210. package/components/icon/state-wv.vue +38 -0
  211. package/components/icon/state-wy.vue +38 -0
  212. package/components/icon/thumbs-up.vue +39 -0
  213. package/components/icon/trash-can.vue +41 -0
  214. package/components/icon/tree.vue +37 -0
  215. package/components/icon/twitter.vue +43 -0
  216. package/components/icon/upload.vue +41 -0
  217. package/components/icon/verified.vue +40 -0
  218. package/components/icon/video-play.vue +41 -0
  219. package/components/icon/wifi.vue +38 -0
  220. package/components/icon/x.vue +38 -0
  221. package/components/icon/youtube.vue +45 -0
  222. package/composables/forms.ts +124 -0
  223. package/nuxt.config.ts +83 -1
  224. package/package.json +47 -13
  225. package/tsconfig.json +4 -0
  226. package/types/es-carousel.ts +12 -0
  227. package/types/index.ts +1 -0
  228. package/utils/forms.ts +120 -0
  229. package/utils/get-es-footer-content.ts +90 -0
  230. package/utils/get-es-nav-bar-account-content.ts +55 -0
  231. package/utils/get-es-nav-bar-global-content.ts +482 -0
  232. package/utils/mime-type-finder.ts +48 -0
  233. package/utils/vuelidate-keys.ts +39 -0
  234. package/components/TestComponent.vue +0 -5
@@ -0,0 +1,38 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'IconWifi',
4
+ props: {
5
+ /**
6
+ * Width
7
+ */
8
+ width: {
9
+ type: String,
10
+ default: '24px',
11
+ required: false,
12
+ },
13
+ /**
14
+ * Height
15
+ */
16
+ height: {
17
+ type: String,
18
+ default: '24px',
19
+ required: false,
20
+ },
21
+ },
22
+ };
23
+ </script>
24
+ <template>
25
+ <svg
26
+ :style="{
27
+ height: height,
28
+ width: width,
29
+ }"
30
+ xmlns="http://www.w3.org/2000/svg"
31
+ viewBox="0 0 24 24"
32
+ fill="currentColor">
33
+ <path
34
+ fill-rule="evenodd"
35
+ clip-rule="evenodd"
36
+ d="M12 6c-3.161 0-6.406 1.5-9.257 4.669A1 1 0 1 1 1.257 9.33C4.406 5.831 8.16 4 12 4c3.839 0 7.594 1.832 10.743 5.331a1 1 0 1 1-1.486 1.338C18.406 7.5 15.16 5.999 12 5.999Zm0 6c-1.761 0-3.606.835-5.257 2.669a1 1 0 1 1-1.486-1.338C7.206 11.165 9.56 10 12 10s4.794 1.165 6.743 3.331a1 1 0 1 1-1.486 1.338C15.606 12.835 13.76 12 12 12Zm-2 6a2 2 0 1 1 4 0 2 2 0 0 1-4 0Z" />
37
+ </svg>
38
+ </template>
@@ -0,0 +1,38 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'XIcon',
4
+ props: {
5
+ /**
6
+ * Width
7
+ */
8
+ width: {
9
+ type: String,
10
+ default: '24px',
11
+ required: false,
12
+ },
13
+ /**
14
+ * Height
15
+ */
16
+ height: {
17
+ type: String,
18
+ default: '24px',
19
+ required: false,
20
+ },
21
+ },
22
+ };
23
+ </script>
24
+ <template>
25
+ <svg
26
+ :style="{
27
+ height: height,
28
+ width: width,
29
+ }"
30
+ xmlns="http://www.w3.org/2000/svg"
31
+ viewBox="0 0 24 24"
32
+ fill="currentColor">
33
+ <path
34
+ fill-rule="evenodd"
35
+ clip-rule="evenodd"
36
+ d="M5.293 5.293a1 1 0 0 1 1.414 0L12 10.586l5.293-5.293a1 1 0 1 1 1.414 1.414L13.414 12l5.293 5.293a1 1 0 0 1-1.414 1.414L12 13.414l-5.293 5.293a1 1 0 0 1-1.414-1.414L10.586 12 5.293 6.707a1 1 0 0 1 0-1.414Z" />
37
+ </svg>
38
+ </template>
@@ -0,0 +1,45 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'IconYoutube',
4
+ props: {
5
+ /**
6
+ * Width
7
+ */
8
+ width: {
9
+ type: String,
10
+ default: '31px',
11
+ required: false,
12
+ },
13
+ /**
14
+ * Height
15
+ */
16
+ height: {
17
+ type: String,
18
+ default: '32px',
19
+ required: false,
20
+ },
21
+ },
22
+ };
23
+ </script>
24
+ <template>
25
+ <svg
26
+ :style="{
27
+ height: height,
28
+ width: width,
29
+ }"
30
+ xmlns="http://www.w3.org/2000/svg"
31
+ viewBox="0 0 31 32"
32
+ fill="currentColor">
33
+ <path
34
+ fill="none"
35
+ d="M0 .4h31v31H0z" />
36
+ <path
37
+ fill-rule="evenodd"
38
+ clip-rule="evenodd"
39
+ d="m13.4 19 5.5-3-5.5-3.3v6.4Z" />
40
+ <path
41
+ fill-rule="evenodd"
42
+ clip-rule="evenodd"
43
+ d="M15.5.4a15.5 15.5 0 1 0 0 31 15.5 15.5 0 0 0 0-31ZM26.1 15V16.9a18 18 0 0 1-.4 4c0 .5-.3.9-.6 1.2-.4.4-.9.6-1.4.7-1 .3-2.7.5-6.3.5h-1.6c-8.6 0-8.7-.3-9.6-1l-.2-.2-.7-1a17.5 17.5 0 0 1-.4-4.3V14.9c0-1.4.1-2.7.4-4 .1-.5.3-.9.7-1.2.3-.4.8-.6 1.3-.7 1-.3 2.8-.5 6.3-.5h1.6c8.6 0 8.7.3 9.6 1l.2.2c.3.3.6.7.7 1.1A17.5 17.5 0 0 1 26 15Z" />
44
+ </svg>
45
+ </template>
@@ -0,0 +1,124 @@
1
+ import { type ErrorObject, useVuelidate, type ValidationArgs } from '@vuelidate/core';
2
+ import type { ToRefs, Ref } from 'vue';
3
+
4
+ export function useEsForms<
5
+ // eslint-disable-next-line no-unused-vars, no-use-before-define, @typescript-eslint/no-explicit-any
6
+ T extends { [key in keyof Vargs]: any },
7
+ Vargs extends ValidationArgs = ValidationArgs,
8
+ >(validationsArgs: Ref<Vargs> | Vargs, state: T | Ref<T> | ToRefs<T>) {
9
+ const v$ = useVuelidate(validationsArgs, state);
10
+
11
+ const submitInProgress = ref(false);
12
+ const formShowSuccess = ref(false);
13
+ const formShowError = ref(false);
14
+ const formMsgVariant = ref('danger');
15
+
16
+ const isSubmitInProgress = computed(() => submitInProgress.value);
17
+
18
+ const getFields = (obj: any, valueKey = 'obj') => {
19
+ let objKeys = null;
20
+ try {
21
+ objKeys = Object.keys(obj);
22
+ // eslint-disable-next-line no-console
23
+ console.log('objKeys: ', objKeys);
24
+ } catch {
25
+ return [];
26
+ }
27
+ return objKeys.filter((name) => !name.startsWith('$')).map((name) => ({ name, [valueKey]: obj[name] }));
28
+ };
29
+
30
+ const formErrors = computed(() => {
31
+ const errors = v$.value.$errors.map((error) => error);
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ return errors.reduce((acc: any, error: ErrorObject) => {
34
+ if (!(error.$property in acc)) {
35
+ // eslint-disable-next-line no-param-reassign
36
+ acc[error.$property] = [];
37
+ }
38
+ acc[error.$property].push(error.$validator);
39
+ return acc;
40
+ }, {});
41
+ });
42
+
43
+ const getValidatorField = (dotPath: string) => {
44
+ const validatorField = dotPath.split('.').reduce((acc, field) => {
45
+ // eslint-disable-next-line no-param-reassign
46
+ acc = acc[field];
47
+ return acc;
48
+ }, v$.value);
49
+ if (!validatorField) {
50
+ return null;
51
+ }
52
+ if (!['$dirty', '$error'].map((key) => Object.prototype.hasOwnProperty.call(validatorField, key))) {
53
+ return null;
54
+ }
55
+ return validatorField;
56
+ };
57
+
58
+ const validateState = (dotPath: string) => {
59
+ const validatorField = getValidatorField(dotPath);
60
+ if (!validatorField) {
61
+ return null;
62
+ }
63
+ const { $dirty, $error } = validatorField;
64
+ return $dirty ? !$error : null;
65
+ };
66
+
67
+ const touchOnChange = (dotPath: string) => {
68
+ const validatorField = getValidatorField(dotPath);
69
+ if (!validatorField) {
70
+ return;
71
+ }
72
+ if (validatorField.$dirty) {
73
+ validatorField.$touch();
74
+ }
75
+ };
76
+
77
+ const showFormError = () => {
78
+ formMsgVariant.value = 'danger';
79
+ formShowError.value = true;
80
+ };
81
+
82
+ const showFormSuccess = () => {
83
+ formMsgVariant.value = 'success';
84
+ formShowSuccess.value = true;
85
+ };
86
+
87
+ const hideFormError = () => {
88
+ formShowError.value = false;
89
+ };
90
+
91
+ const hideFormSuccess = () => {
92
+ formShowSuccess.value = false;
93
+ };
94
+
95
+ const startSubmit = () => {
96
+ submitInProgress.value = true;
97
+ formShowSuccess.value = false;
98
+ formShowError.value = false;
99
+ };
100
+
101
+ const stopSubmit = () => {
102
+ submitInProgress.value = false;
103
+ };
104
+
105
+ return {
106
+ v$,
107
+ submitInProgress,
108
+ formShowSuccess,
109
+ formShowError,
110
+ formMsgVariant,
111
+ isSubmitInProgress,
112
+ formErrors,
113
+ getValidatorField,
114
+ validateState,
115
+ touchOnChange,
116
+ showFormError,
117
+ showFormSuccess,
118
+ hideFormError,
119
+ hideFormSuccess,
120
+ startSubmit,
121
+ stopSubmit,
122
+ getFields,
123
+ };
124
+ }
package/nuxt.config.ts CHANGED
@@ -1,2 +1,84 @@
1
1
  // https://nuxt.com/docs/api/configuration/nuxt-config
2
- export default defineNuxtConfig({})
2
+ export default defineNuxtConfig({
3
+ compatibilityDate: '2024-04-03',
4
+
5
+ // https://nuxt.com/docs/getting-started/styling#the-css-property
6
+ css: ['@energysage/es-ds-styles/scss/bootstrap.scss'],
7
+
8
+ // https://google-fonts.nuxtjs.org/options
9
+ googleFonts: {
10
+ preload: true,
11
+ download: false,
12
+ display: 'swap',
13
+ families: {
14
+ 'Plus+Jakarta+Sans': {
15
+ wght: '200..800',
16
+ ital: '200..800',
17
+ },
18
+ },
19
+ },
20
+
21
+ // Configure how Nuxt auto-imports composables into your application.
22
+ imports: {
23
+ dirs: ['composables', 'types'],
24
+ },
25
+
26
+ modules: [
27
+ // https://google-fonts.nuxtjs.org/getting-started/setup
28
+ '@nuxtjs/google-fonts',
29
+ // https://v3.primevue.org/nuxt
30
+ 'nuxt-primevue',
31
+ ],
32
+
33
+ primevue: {
34
+ components: {
35
+ include: [],
36
+ },
37
+ options: {
38
+ unstyled: true,
39
+ },
40
+ },
41
+
42
+ sourcemap: {
43
+ server: true,
44
+ client: true,
45
+ },
46
+
47
+ // Per suggestion from https://github.com/nuxt/nuxt/issues/26783#issuecomment-2058966800
48
+ // See also:
49
+ // - https://github.com/nuxt/nuxt/issues/24196#issuecomment-1853870504
50
+ vite: {
51
+ optimizeDeps: {
52
+ include: [
53
+ '@vuelidate/core',
54
+ '@vuelidate/validators',
55
+ 'html-truncate',
56
+ '@vueuse/core',
57
+ 'primevue/accordion',
58
+ 'primevue/accordiontab',
59
+ 'primevue/breadcrumb',
60
+ 'primevue/button',
61
+ 'primevue/carousel',
62
+ 'primevue/column',
63
+ 'primevue/datatable',
64
+ 'primevue/dialog',
65
+ 'primevue/inputmask',
66
+ 'primevue/inputotp',
67
+ 'primevue/inputtext',
68
+ 'primevue/overlaypanel',
69
+ 'primevue/paginator',
70
+ 'primevue/panel',
71
+ 'primevue/progressbar',
72
+ 'primevue/radiobutton',
73
+ 'primevue/rating',
74
+ 'primevue/skeleton',
75
+ 'primevue/slider',
76
+ 'primevue/tabpanel',
77
+ 'primevue/tabview',
78
+ ],
79
+ },
80
+ },
81
+ typescript: {
82
+ typeCheck: true,
83
+ },
84
+ });
package/package.json CHANGED
@@ -1,15 +1,49 @@
1
1
  {
2
- "name": "@energysage/es-ds-components",
3
- "version": "0.0.1",
4
- "private": false,
5
- "description": "An EnergySage Vue component library",
6
- "main": "./nuxt.config.ts",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1"
9
- },
10
- "author": "EnergySage",
11
- "license": "MIT",
12
- "devDependencies": {
13
- "nuxt": "^3.12.4"
14
- }
2
+ "name": "@energysage/es-ds-components",
3
+ "version": "3.0.0-alpha.10",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "An EnergySage Vue component library",
7
+ "main": "./nuxt.config.ts",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1",
10
+ "lint:eslint": "eslint .",
11
+ "lint:prettier": "prettier --check .",
12
+ "lint": "npm run lint:eslint && npm run lint:prettier",
13
+ "format:prettier": "prettier --write --list-different .",
14
+ "format:eslint": "npm run lint:eslint -- --fix",
15
+ "format": "npm run format:prettier && npm run format:eslint"
16
+ },
17
+ "author": "EnergySage",
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "@energysage/es-ds-styles": "^3.0.0-alpha.8",
21
+ "@nuxtjs/google-fonts": "^3.2.0",
22
+ "@vuelidate/core": "^2.0.3",
23
+ "@vuelidate/validators": "^2.0.4",
24
+ "@vueuse/core": "^11.1.0",
25
+ "html-truncate": "^1.2.2",
26
+ "nuxt": "^3.13.2",
27
+ "nuxt-primevue": "^3.0.0",
28
+ "primevue": "^3.53.0",
29
+ "prismjs": "^1.29.0",
30
+ "vue": "^3.5.6"
31
+ },
32
+ "devDependencies": {
33
+ "@eslint/js": "^9.9.0",
34
+ "@types/eslint__js": "^8.42.3",
35
+ "eslint": "^8.57.0",
36
+ "eslint-config-airbnb-base": "^15.0.0",
37
+ "eslint-config-prettier": "^9.1.0",
38
+ "eslint-import-resolver-typescript": "^3.6.1",
39
+ "eslint-plugin-import": "^2.29.1",
40
+ "eslint-plugin-vitest": "^0.5.4",
41
+ "eslint-plugin-vue": "^9.27.0",
42
+ "nuxt-primevue": "^3.0.0",
43
+ "prettier": "^3.3.3",
44
+ "sass": "^1.77.8",
45
+ "typescript": "^5.5.4",
46
+ "typescript-eslint": "^8.2.0",
47
+ "vue-tsc": "^2.0.29"
48
+ }
15
49
  }
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ // https://nuxt.com/docs/guide/concepts/typescript
3
+ "extends": "../es-ds-docs/.nuxt/tsconfig.json"
4
+ }
@@ -0,0 +1,12 @@
1
+ export interface EsCarouselBreakpointInterface {
2
+ numScroll?: number;
3
+ numVisible: number;
4
+ }
5
+
6
+ export interface EsCarouselBreakpointsInterface {
7
+ sm?: EsCarouselBreakpointInterface;
8
+ md?: EsCarouselBreakpointInterface;
9
+ lg?: EsCarouselBreakpointInterface;
10
+ xl?: EsCarouselBreakpointInterface;
11
+ xxl?: EsCarouselBreakpointInterface;
12
+ }
package/types/index.ts ADDED
@@ -0,0 +1 @@
1
+ export type * from './es-carousel';
package/utils/forms.ts ADDED
@@ -0,0 +1,120 @@
1
+ import {
2
+ helpers,
3
+ required,
4
+ minValue,
5
+ maxValue,
6
+ requiredIf,
7
+ numeric,
8
+ integer,
9
+ minLength,
10
+ maxLength,
11
+ } from '@vuelidate/validators';
12
+
13
+ // Only some vuelidate validators can be reused; others don't work well
14
+ export const vuelidateRequired = required;
15
+ export const vuelidateMinValue = minValue;
16
+ export const vuelidateMaxValue = maxValue;
17
+ export const vuelidateRequiredIf = requiredIf;
18
+ export const vuelidateNumeric = numeric;
19
+ export const vuelidateInteger = integer;
20
+ export const vuelidateMinLength = minLength;
21
+ export const vuelidateMaxLength = maxLength;
22
+ export const vuelidateHelpers = helpers;
23
+
24
+ /**
25
+ * @returns a function that takes a number, and returns another function which takes a string param
26
+ * that will ultimately be what you're comparing the pattern against N times.
27
+ */
28
+ // eslint-disable-next-line max-len
29
+ const matchesPatternNTimes =
30
+ (pattern: RegExp) =>
31
+ (N = 1) =>
32
+ (param: string) =>
33
+ [...String(param).matchAll(pattern)].length >= N;
34
+
35
+ /**
36
+ * @param { Number } number of times the resulting function will need to match
37
+ * @returns { Function } function that will take a string param that will compare against a
38
+ * pattern N times. The pattern is defined in the functional closure.
39
+ *
40
+ * Usage: hasNumber(1)('s0me string')
41
+ */
42
+ const hasNumber = matchesPatternNTimes(/[0-9]/g);
43
+
44
+ /**
45
+ * @param { Number } number of times the resulting function will need to match
46
+ * @returns { Function } function that will take a string param that will compare against a
47
+ * pattern N times. The pattern is defined in the functional closure.
48
+ *
49
+ * Usage: hasSpecialCharacter(1)('some $tring')
50
+ */
51
+ const hasSpecialCharacter = matchesPatternNTimes(/\W|_/g);
52
+
53
+ /**
54
+ * @param { Number } number of times the resulting function will need to match
55
+ * @returns { Function } function that will take a string param that will compare against a
56
+ * pattern N times. The pattern is defined in the functional closure.
57
+ *
58
+ * Usage: hasUppercaseLetter(1)('some String')
59
+ */
60
+ const hasUppercaseLetter = matchesPatternNTimes(/[A-Z]/g);
61
+
62
+ /**
63
+ * @param { Number } number of times the resulting function will need to match
64
+ * @returns { Function } function that will take a string param that will compare against a
65
+ * pattern N times. The pattern is defined in the functional closure.
66
+ *
67
+ * Usage: hasLowercaseLetter(1)('some String')
68
+ */
69
+ const hasLowercaseLetter = matchesPatternNTimes(/[a-z]/g);
70
+
71
+ /**
72
+ * @param emailAddress Email Address
73
+ * @returns if valid
74
+ */
75
+ export function vuelidateEmail(emailAddress: string) {
76
+ const valid = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z][\w]{1,}$/i.test(emailAddress);
77
+ return !helpers.req(emailAddress) || valid;
78
+ }
79
+
80
+ /**
81
+ * @param number US Based phone number
82
+ * @returns if valid
83
+ */
84
+ export function vuelidatePhone(number: string) {
85
+ return !helpers.req(number) || /^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,6}$/.test(number);
86
+ }
87
+
88
+ /**
89
+ * @returns if not required or string contains a number
90
+ */
91
+ // eslint-disable-next-line max-len
92
+ export const vuelidateHasNumber = (X: number) =>
93
+ helpers.withParams({ type: 'xTimes', value: X }, (value: string) => !helpers.req(value) || hasNumber(X)(value));
94
+
95
+ /**
96
+ * @returns if not required or string contains a special character
97
+ */
98
+ export const vuelidateHasSpecialCharacter = (X: number) =>
99
+ helpers.withParams(
100
+ { type: 'xTimes', value: X },
101
+ (value: string) => !helpers.req(value) || hasSpecialCharacter(X)(value),
102
+ );
103
+
104
+ /**
105
+ * @returns if not required or string contains an uppercase letter
106
+ */
107
+ export const vuelidateHasUppercaseLetter = (X: number) =>
108
+ helpers.withParams(
109
+ { type: 'xTimes', value: X },
110
+ (value: string) => !helpers.req(value) || hasUppercaseLetter(X)(value),
111
+ );
112
+
113
+ /**
114
+ * @returns if not required or string contains an lowercase letter
115
+ */
116
+ export const vuelidateHasLowercaseLetter = (X: number) =>
117
+ helpers.withParams(
118
+ { type: 'xTimes', value: X },
119
+ (value: string) => !helpers.req(value) || hasLowercaseLetter(X)(value),
120
+ );
@@ -0,0 +1,90 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ /* eslint-disable no-unused-vars */
3
+ // keeping COMMUNITY_SOLAR_DOMAIN, HEAT_PUMPS_DOMAIN and NEWS_DOMAIN for now to keep function argument order intact
4
+ // and to minimize breaking change to consuming applications, but they are now deprecated in this function
5
+ export default (
6
+ ES_DOMAIN = process.env.ES_DOMAIN || 'https://www.energysage.com',
7
+ NEWS_DOMAIN = process.env.NEWS_DOMAIN || 'https://www.energysage.com',
8
+ COMMUNITY_SOLAR_DOMAIN = process.env.COMMUNITY_SOLAR_DOMAIN || 'https://communitysolar.energysage.com',
9
+ HEAT_PUMPS_DOMAIN = process.env.HEAT_PUMPS_DOMAIN || 'https://heatpumps.energysage.com',
10
+ ) => ({
11
+ banner: {
12
+ headline: 'Make an impact.',
13
+ subHeadline: "It's never been easier.",
14
+ body: `We developed our one-of-a-kind marketplace with funding from the U.S. Department of Energy to make
15
+ clean home energy solutions affordable and accessible to all.`,
16
+ },
17
+ home: {
18
+ name: 'EnergySage',
19
+ link: ES_DOMAIN,
20
+ },
21
+ columns: [
22
+ // TODO: remove new tab option once other verticals adopt global nav
23
+ {
24
+ title: 'Our offerings',
25
+ links: [
26
+ { text: 'Home solar', url: `${ES_DOMAIN}/shop/home-solar/` },
27
+ { text: 'Community solar', url: `${ES_DOMAIN}/shop/community-solar/` },
28
+ { text: 'Heating & cooling', url: `${ES_DOMAIN}/shop/heat-pumps/` },
29
+ { text: 'Backup power', url: `${ES_DOMAIN}/energy-storage/` },
30
+ { text: 'EV charging', url: `${ES_DOMAIN}/ev-charging/` },
31
+ { text: 'For your business', url: `${ES_DOMAIN}/businesses/` },
32
+ { text: 'Other energy options', url: `${ES_DOMAIN}/other-clean-options/` },
33
+ ],
34
+ },
35
+ {
36
+ title: 'Resources',
37
+ links: [
38
+ { text: 'Solar calculator', url: `${ES_DOMAIN}/solar/calculator/` },
39
+ { text: 'Solar rebates', url: `${ES_DOMAIN}/market/equipment-rebates/` },
40
+ { text: 'News', url: `${ES_DOMAIN}/blog/` },
41
+ { text: 'Home solar guide', url: `${ES_DOMAIN}/shop/home-solar/` },
42
+ { text: 'Market intel', url: `${ES_DOMAIN}/data/` },
43
+ { text: 'Refer a friend', url: `${ES_DOMAIN}/refer-a-friend/` },
44
+ ],
45
+ },
46
+ {
47
+ title: 'About us',
48
+ links: [
49
+ { text: 'Mission & values', url: `${ES_DOMAIN}/about-us/company/` },
50
+ { text: 'How it works', url: `${ES_DOMAIN}/shop/home-solar/` },
51
+ { text: 'Careers', url: `${ES_DOMAIN}/about-us/careers/` },
52
+ { text: 'Contact us', url: `${ES_DOMAIN}/contact/` },
53
+ { text: 'Editorial guidelines', url: `${ES_DOMAIN}/editorial-guidelines/` },
54
+ ],
55
+ },
56
+ {
57
+ title: 'Work with us',
58
+ links: [
59
+ { text: 'Solar & HVAC installers', url: `${ES_DOMAIN}/installers/` },
60
+ { text: 'Corporate partnerships', url: `${ES_DOMAIN}/partners/corporations` },
61
+ { text: 'Community programs', url: `${ES_DOMAIN}/partners/non-profits` },
62
+ { text: 'Utility programs', url: `${ES_DOMAIN}/partners/utilities` },
63
+ { text: 'Others', url: `${ES_DOMAIN}/partners/` },
64
+ ],
65
+ },
66
+ ],
67
+ socialLinks: [
68
+ { text: 'Facebook', url: 'https://www.facebook.com/EnergySage', icon: 'icon-facebook' },
69
+ { text: 'LinkedIn', url: 'https://www.linkedin.com/company/energysage/', icon: 'icon-linkedin' },
70
+ { text: 'Instagram', url: 'https://www.instagram.com/energysage_official/', icon: 'icon-instagram' },
71
+ { text: 'X', url: 'https://X.com/energysage', icon: 'icon-twitter' },
72
+ { text: 'YouTube', url: 'https://www.youtube.com/c/EnergySage', icon: 'icon-youtube' },
73
+ ],
74
+ legalLinks: [
75
+ { text: 'Terms of use', url: `${ES_DOMAIN}/terms-of-use/` },
76
+ { text: 'Privacy policy', url: `${ES_DOMAIN}/privacy-policy/` },
77
+ { text: 'Mobile terms of use', url: `${ES_DOMAIN}/mobile-terms-of-use/` },
78
+ { text: 'Non-discrimination policy', url: `${ES_DOMAIN}/nondiscrimination/` },
79
+ ],
80
+ copyrightText: '© Copyright 2009-{currentYear} EnergySage, Inc. All rights reserved.',
81
+ trademarkText: `ENERGYSAGE is a registered trademark and the EnergySage logo is a trademark of EnergySage, Inc.
82
+ Other trademarks are the property of either EnergySage, Inc. or our licensors and are used with permission.`,
83
+ departmentOfEnergy: {
84
+ learnMore: {
85
+ link: 'https://www.energy.gov/eere/solar/articles/eere-success-story-doe-funding-helps-build-one-stop-shop-rooftop-pv-systems',
86
+ text: 'Learn more about our success working with the U.S. Department of Energy.',
87
+ },
88
+ logoUrl: 'https://www-static.energysage.com/static/img/doe/doe-logo-179.943fe6467b04.png',
89
+ },
90
+ });