@energysage/es-ds-components 0.0.1 → 3.0.0-alpha.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.
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <div
3
+ class="col"
4
+ :class="{
5
+ [`col-${cols}`]: cols,
6
+ [`col-sm-${sm}`]: sm,
7
+ [`col-md-${md}`]: md,
8
+ [`col-lg-${lg}`]: lg,
9
+ [`col-xl-${xl}`]: xl,
10
+ [`col-xxl-${xxl}`]: xxl,
11
+ }">
12
+ <slot />
13
+ </div>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ const props = defineProps<{
18
+ cols?: string,
19
+ sm?: string,
20
+ md?: string,
21
+ lg?: string,
22
+ xl?: string,
23
+ xxl?: string
24
+ }>();
25
+ </script>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="container">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="row">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <breadcrumb
3
+ :model="model"
4
+ :pt="{
5
+ menu: 'breadcrumb',
6
+ menuitem: 'breadcrumb-item'
7
+ }">
8
+ <template #item="{ item, props }">
9
+ <!--
10
+ primevue breadcrumb doesn't support an active non-link state out of the box,
11
+ so we have to implement it via this slot
12
+ https://v3.primevue.org/breadcrumb/#api.options.MenuItem
13
+ -->
14
+ <span v-if="item.active" aria-current="location" class="font-weight-bold">
15
+ {{ item.label }}
16
+ </span>
17
+ <!--
18
+ primevue breadcrumb doesn't support NuxtLink out of the box,
19
+ so we have to implement it via this slot
20
+ https://v3.primevue.org/breadcrumb/#router
21
+ -->
22
+ <nuxt-link v-else-if="item.to" :to="item.to">
23
+ {{ item.label }}
24
+ </nuxt-link>
25
+ <a v-else-if="item.url" :href="item.url" :target="item.target">
26
+ {{ item.label }}
27
+ </a>
28
+ <span v-else>
29
+ {{ item.label }}
30
+ </span>
31
+ </template>
32
+ <template #separator>
33
+ <span aria-hidden class="mx-50">/</span>
34
+ </template>
35
+ </breadcrumb>
36
+ </template>
37
+
38
+ <script setup lang="ts">
39
+ const props = defineProps({
40
+ items: {
41
+ type: Array,
42
+ required: true
43
+ }
44
+ });
45
+
46
+ const route = useRoute();
47
+ const model = computed(() => {
48
+ if (!props.items) {
49
+ return [];
50
+ }
51
+
52
+ return props.items.map(item => ({
53
+ ...item,
54
+ // mark breadcrumb as active if manually set or if it matches this route
55
+ active: item.active || route.path === item.to || route.path === item.href,
56
+ label: item.text,
57
+ url: item.href
58
+ }));
59
+ });
60
+ </script>
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <panel
3
+ :collapsed="!expanded"
4
+ :pt="{
5
+ header: 'align-items-center d-flex justify-content-between position-relative py-100',
6
+ icons: 'h-100 position-absolute w-100',
7
+ root: border ? 'border-bottom border-top' : '',
8
+ toggler: {
9
+ class: 'es-collapse-toggler align-items-center btn btn-link d-flex h-100 inline justify-content-end rounded-0 p-0 position-absolute text-body w-100',
10
+ },
11
+ // https://vuejs.org/guide/built-ins/transition
12
+ transition: {
13
+ enterActiveClass: 'es-collapse-enter-active',
14
+ enterFromClass: 'es-collapse-enter-from',
15
+ enterToClass: 'es-collapse-enter-to',
16
+ leaveActiveClass: 'es-collapse-leave-active',
17
+ leaveFromClass: 'es-collapse-leave-from',
18
+ leaveToClass: 'es-collapse-leave-to'
19
+ },
20
+ }"
21
+ toggleable
22
+ @toggle="onClick">
23
+ <template #header>
24
+ <slot name="title" />
25
+ </template>
26
+ <template #togglericon>
27
+ <icon-chevron-down />
28
+ </template>
29
+ <slot />
30
+ </panel>
31
+ </template>
32
+
33
+ <script setup lang="ts">
34
+ const emit = defineEmits(['toggled', 'userClick']);
35
+ const model = defineModel();
36
+ const props = defineProps({
37
+ border: {
38
+ type: Boolean,
39
+ default: true,
40
+ },
41
+ isProgrammaticUntilUserInput: {
42
+ type: Boolean,
43
+ default: true
44
+ },
45
+ visible: {
46
+ type: Boolean,
47
+ default: false
48
+ }
49
+ });
50
+
51
+ const userDeterminedState = ref(null);
52
+
53
+ // directly determines the expanded/collapsed state of the panel
54
+ const expanded = computed(() => {
55
+ // if we are meant to start ignoring the programmatic incoming state as soon as the
56
+ // user interacts with the collapse, and if the user has interacted with the collapse,
57
+ // use the value from the user's interaction
58
+ if (props.isProgrammaticUntilUserInput && userDeterminedState.value !== null) {
59
+ return userDeterminedState.value;
60
+ }
61
+
62
+ // otherwise, use the one-way visible prop or the two-way v-model value
63
+ return props.visible || model.value;
64
+ });
65
+
66
+ const onClick = ({ value }) => {
67
+ // save the state toggled by the user
68
+ // convert from "collapsed" semantics internal to the primevue panel
69
+ // to the "expanded" semantics exposed by this component
70
+ userDeterminedState.value = !value;
71
+
72
+ // inform the v-model (if any) that the state has changed
73
+ model.value = !value;
74
+
75
+ // emit events indicating the state has changed
76
+ emit('toggled', !value);
77
+ emit('userClick', !value);
78
+ };
79
+ </script>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <svg
3
+ :style="{
4
+ height: height,
5
+ width: width,
6
+ }"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 24 24"
9
+ fill="currentColor">
10
+ <path
11
+ fill-rule="evenodd"
12
+ clip-rule="evenodd"
13
+ d="M3.293 8.293a1 1 0 0 1 1.414 0L12 15.586l7.293-7.293a1 1 0 1 1 1.414 1.414l-8 8a1 1 0 0 1-1.414 0l-8-8a1 1 0 0 1 0-1.414Z" />
14
+ </svg>
15
+ </template>
16
+
17
+ <script>
18
+ export default {
19
+ name: 'IconChevronDown',
20
+ props: {
21
+ /**
22
+ * Width
23
+ */
24
+ width: {
25
+ type: String,
26
+ default: '24px',
27
+ required: false,
28
+ },
29
+ /**
30
+ * Height
31
+ */
32
+ height: {
33
+ type: String,
34
+ default: '24px',
35
+ required: false,
36
+ },
37
+ },
38
+ };
39
+ </script>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <svg
3
+ :style="{
4
+ height: height,
5
+ width: width,
6
+ }"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 24 24"
9
+ fill="currentColor">
10
+ <path
11
+ fill-rule="evenodd"
12
+ clip-rule="evenodd"
13
+ d="M7.293 3.293a1 1 0 0 1 1.414 0l8 8a1 1 0 0 1 0 1.414l-8 8a1 1 0 0 1-1.414-1.414L14.586 12 7.293 4.707a1 1 0 0 1 0-1.414Z" />
14
+ </svg>
15
+ </template>
16
+
17
+ <script>
18
+ export default {
19
+ name: 'IconChevronRight',
20
+ props: {
21
+ /**
22
+ * Width
23
+ */
24
+ width: {
25
+ type: String,
26
+ default: '24px',
27
+ required: false,
28
+ },
29
+ /**
30
+ * Height
31
+ */
32
+ height: {
33
+ type: String,
34
+ default: '24px',
35
+ required: false,
36
+ },
37
+ },
38
+ };
39
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energysage/es-ds-components",
3
- "version": "0.0.1",
3
+ "version": "3.0.0-alpha.0",
4
4
  "private": false,
5
5
  "description": "An EnergySage Vue component library",
6
6
  "main": "./nuxt.config.ts",
@@ -1,5 +0,0 @@
1
- <template>
2
- <div>
3
- This is a test component from es-ds-components
4
- </div>
5
- </template>