@energysage/es-ds-components 5.1.0 → 5.3.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 (98) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/app/components/es-logo.vue +50 -0
  3. package/app/components/es-mobile-nav-content.vue +308 -0
  4. package/app/components/es-mobile-nav-custom-item.vue +9 -0
  5. package/app/components/es-mobile-nav-link.vue +62 -0
  6. package/app/components/es-mobile-nav-trigger.vue +29 -0
  7. package/app/components/es-mobile-nav.vue +219 -0
  8. package/app/components/es-mobile-sub-nav.vue +243 -0
  9. package/app/components/es-nav-cta-card.vue +113 -0
  10. package/app/components/es-sticky-bar.vue +3 -1
  11. package/app/components/icon/arrow-clockwise.vue +13 -48
  12. package/app/components/icon/arrow-counter-clockwise.vue +13 -34
  13. package/app/components/icon/arrow-cycle.vue +13 -40
  14. package/app/components/icon/arrow-down.vue +16 -0
  15. package/app/components/icon/arrow-left.vue +13 -36
  16. package/app/components/icon/arrow-right.vue +13 -36
  17. package/app/components/icon/arrow-up.vue +13 -36
  18. package/app/components/icon/battery-charging-vertical.vue +16 -0
  19. package/app/components/icon/bell.vue +13 -39
  20. package/app/components/icon/block.vue +13 -43
  21. package/app/components/icon/bolt.vue +12 -34
  22. package/app/components/icon/calculator.vue +13 -34
  23. package/app/components/icon/calendar.vue +13 -43
  24. package/app/components/icon/cart.vue +13 -43
  25. package/app/components/icon/charging-station.vue +16 -0
  26. package/app/components/icon/chat-bubble.vue +13 -37
  27. package/app/components/icon/chat-dots.vue +13 -39
  28. package/app/components/icon/check.vue +13 -36
  29. package/app/components/icon/chevron-down.vue +13 -36
  30. package/app/components/icon/chevron-horizontal.vue +13 -36
  31. package/app/components/icon/chevron-left.vue +13 -36
  32. package/app/components/icon/chevron-right.vue +13 -36
  33. package/app/components/icon/chevron-up.vue +13 -36
  34. package/app/components/icon/circle-alert.vue +13 -43
  35. package/app/components/icon/circle-check.vue +13 -43
  36. package/app/components/icon/circle-chevron-down.vue +12 -43
  37. package/app/components/icon/circle-chevron-left.vue +13 -43
  38. package/app/components/icon/circle-chevron-right.vue +13 -43
  39. package/app/components/icon/circle-chevron-up.vue +13 -43
  40. package/app/components/icon/circle-minus.vue +13 -43
  41. package/app/components/icon/circle-plus.vue +13 -43
  42. package/app/components/icon/circle-x.vue +13 -43
  43. package/app/components/icon/circle.vue +13 -39
  44. package/app/components/icon/clock.vue +13 -43
  45. package/app/components/icon/copy.vue +13 -42
  46. package/app/components/icon/envelope.vue +13 -42
  47. package/app/components/icon/eye.vue +13 -38
  48. package/app/components/icon/flag.vue +13 -34
  49. package/app/components/icon/folder.vue +13 -38
  50. package/app/components/icon/gear.vue +12 -33
  51. package/app/components/icon/hamburger.vue +13 -35
  52. package/app/components/icon/heart.vue +13 -36
  53. package/app/components/icon/house-line.vue +16 -0
  54. package/app/components/icon/image.vue +13 -42
  55. package/app/components/icon/info.vue +13 -42
  56. package/app/components/icon/light-bulb.vue +13 -33
  57. package/app/components/icon/link-out.vue +13 -35
  58. package/app/components/icon/location.vue +13 -42
  59. package/app/components/icon/lock-off.vue +13 -42
  60. package/app/components/icon/lock-on.vue +13 -45
  61. package/app/components/icon/minus.vue +13 -35
  62. package/app/components/icon/money-bag.vue +12 -33
  63. package/app/components/icon/open-envelope.vue +13 -42
  64. package/app/components/icon/paper.vue +13 -42
  65. package/app/components/icon/pencil.vue +13 -42
  66. package/app/components/icon/person-add.vue +13 -38
  67. package/app/components/icon/person-check.vue +13 -38
  68. package/app/components/icon/person-cross.vue +13 -38
  69. package/app/components/icon/person.vue +13 -38
  70. package/app/components/icon/phone.vue +13 -38
  71. package/app/components/icon/play.vue +13 -38
  72. package/app/components/icon/plus.vue +13 -35
  73. package/app/components/icon/roof.vue +12 -33
  74. package/app/components/icon/search.vue +12 -39
  75. package/app/components/icon/settings-horizontal.vue +13 -54
  76. package/app/components/icon/settings-vertical.vue +13 -54
  77. package/app/components/icon/shield-with-check.vue +12 -34
  78. package/app/components/icon/shield.vue +13 -38
  79. package/app/components/icon/shopping-bag.vue +13 -36
  80. package/app/components/icon/solar.vue +12 -33
  81. package/app/components/icon/sound-down.vue +13 -42
  82. package/app/components/icon/sound-off.vue +13 -38
  83. package/app/components/icon/sound-on.vue +13 -38
  84. package/app/components/icon/sound-up.vue +13 -38
  85. package/app/components/icon/star-empty.vue +13 -35
  86. package/app/components/icon/star-full.vue +15 -33
  87. package/app/components/icon/star-half.vue +15 -52
  88. package/app/components/icon/thumbs-up.vue +13 -36
  89. package/app/components/icon/trash-can.vue +13 -38
  90. package/app/components/icon/tree.vue +12 -33
  91. package/app/components/icon/upload.vue +12 -37
  92. package/app/components/icon/verified.vue +13 -37
  93. package/app/components/icon/wifi.vue +13 -35
  94. package/app/components/icon/x.vue +13 -35
  95. package/app/composables/breakpoints.ts +75 -0
  96. package/nuxt.config.ts +1 -1
  97. package/package.json +3 -2
  98. package/app/components/icon/arrow.vue +0 -68
@@ -0,0 +1,75 @@
1
+ import type { Ref } from 'vue';
2
+ import { ref, onMounted, onUnmounted, computed } from 'vue';
3
+ import sassBreakpoints from '@energysage/es-ds-styles/scss/modules/breakpoints.module.scss';
4
+
5
+ interface Breakpoints {
6
+ [key: string]: string;
7
+ }
8
+
9
+ const BREAKPOINTS: Breakpoints = {
10
+ xs: sassBreakpoints.xs!,
11
+ sm: sassBreakpoints.sm!,
12
+ md: sassBreakpoints.md!,
13
+ lg: sassBreakpoints.lg!,
14
+ xl: sassBreakpoints.xl!,
15
+ xxl: sassBreakpoints.xxl!,
16
+ };
17
+
18
+ /**
19
+ * This composable provides reactive properties for each breakpoint, as well as device categories.
20
+ * It should only be used for functional purposes, and not for styling or layout.
21
+ * Meaning, don't use it to show/hide elements, or to change the layout of elements.
22
+ */
23
+ export function useBreakpointChecks() {
24
+ const breakpointMediaQueries: { [key in keyof Breakpoints]?: MediaQueryList } = {};
25
+ const breakpointChangeListeners: { [key: string]: () => void } = {};
26
+ const breakpointMatches: { [key: string]: Ref<boolean> } = {};
27
+
28
+ if (import.meta.client) {
29
+ // Set up media queries, reactive references and event listeners for each breakpoint
30
+ Object.entries(BREAKPOINTS).forEach(([key, value]) => {
31
+ const mediaQueryList = window.matchMedia(`(min-width: ${value})`) as MediaQueryList;
32
+ breakpointMediaQueries[key] = mediaQueryList;
33
+ breakpointMatches[key] = ref<boolean>(mediaQueryList?.matches || false);
34
+ breakpointChangeListeners[key] = () => {
35
+ breakpointMatches[key]!.value = mediaQueryList?.matches || false;
36
+ };
37
+ });
38
+ }
39
+
40
+ // On component mount, add change event listeners for each breakpoint
41
+ onMounted(() => {
42
+ Object.keys(breakpointMatches).forEach((key) => {
43
+ breakpointMediaQueries[key]?.addEventListener('change', breakpointChangeListeners[key]!);
44
+ });
45
+ });
46
+
47
+ // On component unmount, remove the event listeners
48
+ onUnmounted(() => {
49
+ Object.keys(breakpointMatches).forEach((key) => {
50
+ breakpointMediaQueries[key]?.removeEventListener('change', breakpointChangeListeners[key]!);
51
+ });
52
+ });
53
+
54
+ // Individual breakpoint computed properties
55
+ const isXS = computed(() => breakpointMatches.xs?.value || false);
56
+ const isSM = computed(() => breakpointMatches.sm?.value || false);
57
+ const isMD = computed(() => breakpointMatches.md?.value || false);
58
+ const isLG = computed(() => breakpointMatches.lg?.value || false);
59
+ const isXL = computed(() => breakpointMatches.xl?.value || false);
60
+ const isXXL = computed(() => breakpointMatches.xxl?.value || false);
61
+
62
+ // Compute values for device categories
63
+ const isDesktop = computed(() => breakpointMatches.lg?.value || false);
64
+ const isTablet = computed(() => (breakpointMatches.md?.value && !breakpointMatches.lg?.value) || false);
65
+ const isMobile = computed(
66
+ () =>
67
+ ((breakpointMatches.xs?.value || breakpointMatches.sm?.value) &&
68
+ !breakpointMatches.lg?.value &&
69
+ !breakpointMatches.md?.value) ||
70
+ false,
71
+ );
72
+
73
+ // TODO: Be nice to namespace this but it ends up being a cyclic dependency somehow
74
+ return { isXS, isSM, isMD, isLG, isXL, isXXL, isDesktop, isTablet, isMobile };
75
+ }
package/nuxt.config.ts CHANGED
@@ -4,7 +4,7 @@ export default defineNuxtConfig({
4
4
 
5
5
  // prevents "Cannot read properties of null (reading 'ce')" in SSR/SSG with reka-ui
6
6
  build: {
7
- transpile: ['reka-ui'],
7
+ transpile: ['@phosphor-icons', 'reka-ui'],
8
8
  },
9
9
 
10
10
  // https://nuxt.com/docs/getting-started/styling#the-css-property
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energysage/es-ds-components",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "An EnergySage Vue component library",
@@ -17,8 +17,9 @@
17
17
  "author": "EnergySage",
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "@energysage/es-ds-styles": "^3.3.4",
20
+ "@energysage/es-ds-styles": "^3.4.0",
21
21
  "@nuxtjs/google-fonts": "^3.2.0",
22
+ "@phosphor-icons/vue": "^2.2.1",
22
23
  "@vuelidate/core": "^2.0.3",
23
24
  "@vuelidate/validators": "^2.0.4",
24
25
  "@vueuse/core": "^13.9.0",
@@ -1,68 +0,0 @@
1
- <!-- eslint-disable max-len -->
2
- <script lang="ts">
3
- export default {
4
- name: 'IconArrow',
5
- props: {
6
- /**
7
- * Width
8
- */
9
- width: {
10
- type: String,
11
- default: '24px',
12
- required: false,
13
- },
14
- /**
15
- * Height
16
- */
17
- height: {
18
- type: String,
19
- default: '24px',
20
- required: false,
21
- },
22
- orientation: {
23
- type: String,
24
- default: 'top',
25
- required: false,
26
- },
27
- },
28
- computed: {
29
- classFromOrientation() {
30
- return `orientation-${this.orientation}`;
31
- },
32
- },
33
- };
34
- </script>
35
- <template>
36
- <svg
37
- :style="{
38
- height: height,
39
- width: width,
40
- }"
41
- :class="classFromOrientation"
42
- xmlns="http://www.w3.org/2000/svg"
43
- viewBox="0 0 24 24"
44
- fill="currentColor">
45
- <path
46
- fill-rule="evenodd"
47
- clip-rule="evenodd"
48
- d="M12 3a1 1 0 0 1 1 1v13.586l5.293-5.293a1 1 0 0 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 1 1 1.414-1.414L11 17.586V4a1 1 0 0 1 1-1Z" />
49
- </svg>
50
- </template>
51
-
52
- <style lang="scss" scoped>
53
- .orientation-down {
54
- transform: rotate(0deg);
55
- }
56
-
57
- .orientation-left {
58
- transform: rotate(90deg);
59
- }
60
-
61
- .orientation-top {
62
- transform: rotate(180deg);
63
- }
64
-
65
- .orientation-right {
66
- transform: rotate(270deg);
67
- }
68
- </style>