@everchron/ec-shards 3.0.0 → 3.1.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everchron/ec-shards",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -157,6 +157,7 @@
157
157
  display: flex;
158
158
  align-items: center;
159
159
  justify-content: center;
160
+ font-size: $type-scale-3-font-size;
160
161
  cursor: pointer;
161
162
  flex-shrink: 0;
162
163
 
@@ -191,7 +192,6 @@
191
192
 
192
193
  &-icon{
193
194
  padding: 0 8px 0 4px;
194
- font-size: $type-scale-3-font-size;
195
195
 
196
196
  .icon{
197
197
  margin-right: 4px;
@@ -2,8 +2,8 @@
2
2
  <svg class="icon" :class="[spinning ? 'ecs-spinner' : '']"
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  viewBox="0 0 30 30"
5
- :width="width"
6
- :height="height"
5
+ :width="computedSize"
6
+ :height="computedSize"
7
7
  :color="color"
8
8
  role="presentation">
9
9
  <title v-if="title">{{ title }}</title>
@@ -20,16 +20,20 @@
20
20
  type: String,
21
21
  required: true
22
22
  },
23
- /** Width of the icon, supports pixel and percentage values. */
23
+ /** Width of the icon, supports pixel and percentage values. **This prop will be deprecated soon.** */
24
24
  width: {
25
25
  type: String,
26
26
  default: '30'
27
27
  },
28
- /** Height of the icon, supports pixel and percentage values. */
28
+ /** Height of the icon, supports pixel and percentage values. **This prop will be deprecated soon.** */
29
29
  height: {
30
30
  type: String,
31
31
  default: '30'
32
32
  },
33
+ /** Sets the height and width of the icon, supports pixel and percentage values. */
34
+ size: {
35
+ type: String
36
+ },
33
37
  /** Sets the color of the icon. By default, icons will always be colored by the inherited css color value. */
34
38
  color: {
35
39
  type: String,
@@ -48,6 +52,13 @@
48
52
  computed: {
49
53
  href() {
50
54
  return `#${this.type}`;
55
+ },
56
+
57
+ computedSize() {
58
+ if (this.size && this.size !== '' || this.size != null)
59
+ return this.size
60
+ else
61
+ return this.width
51
62
  }
52
63
  },
53
64
  };
@@ -17,7 +17,7 @@
17
17
  </div>
18
18
  </div>
19
19
 
20
- <div v-if="$slots.sidebar" class="ecs-index-layout-sidebar" :class="[overlaySidebar ? 'overlay' : '']">
20
+ <div v-if="$slots.sidebar" class="ecs-index-layout-sidebar" :class="[overlaySidebar ? 'overlay' : '']" :style="sidebarPosition">
21
21
  <!-- @slot Slot for the sidebar. -->
22
22
  <slot name="sidebar"></slot>
23
23
  </div>
@@ -43,7 +43,16 @@
43
43
  type: Boolean,
44
44
  default: false
45
45
  }
46
- }
46
+ },
47
+
48
+ computed: {
49
+ sidebarPosition() {
50
+ if (this.overlaySidebar && this.$slots.sidebar)
51
+ return `bottom: 40px;`
52
+ else
53
+ return `bottom: 0px;`
54
+ },
55
+ },
47
56
  }
48
57
  </script>
49
58
 
@@ -99,10 +108,6 @@
99
108
  overflow: auto;
100
109
  }
101
110
 
102
- &-pagination{
103
- padding: 0 5px 5px 5px;
104
- }
105
-
106
111
  &-sidebar{
107
112
  &.overlay{
108
113
  position: absolute;
@@ -1,21 +1,29 @@
1
1
  <template>
2
2
  <div class="ecs-pagination" :class="[ floating ? 'ecs-pagination-floating' : '' ]">
3
- <ecs-flex-row :gap="8" class="ecs-pagination-nav" :style="{minWidth: tabsSpacing}">
4
- <ecs-flex-row>
5
- <ecs-button @click="$emit('firstPage', $event)" :disabled="loading || currentPage === 1" icon="chevron-double-left" icon-only type="secondary" title="First Page" data-test="pagination-first-button" />
6
- <ecs-button @click="$emit('prevPage', $event)" :disabled="loading || currentPage === 1" icon="chevron-left" icon-only type="secondary" title="Previous Page" data-test="pagination-previous-button" />
7
- </ecs-flex-row>
8
- <ecs-flex-row :gap="4">
9
- <span>Page</span>
10
- <ecs-select @change="$emit('update:page', $event.target.value)" :disabled="!totalPages" size="sml">
11
- <option v-for="n in totalPages" :key="n" :value="n" :selected="n === currentPage">{{ n }}</option>
12
- </ecs-select>
13
- <span v-if="totalPages" class="total">of {{ totalPages }}</span>
14
- </ecs-flex-row>
15
- <ecs-flex-row>
16
- <ecs-button @click="$emit('nextPage', $event)" :disabled="loading || currentPage === totalPages" icon="chevron-right" icon-only type="secondary" title="Next Page" data-test="pagination-next-button" />
17
- <ecs-button @click="$emit('lastPage', $event)" :disabled="loading || currentPage === totalPages" icon="chevron-double-right" icon-only type="secondary" title="Last Page" data-test="pagination-last-button" />
18
- </ecs-flex-row>
3
+ <ecs-flex-row :gap="8" class="ecs-pagination-nav" :style="{minWidth: tabsSpacing - 4 + 'px'}">
4
+ <template v-if="type == 'paginated'">
5
+ <ecs-flex-row>
6
+ <ecs-button @click="$emit('firstPage', $event)" :disabled="loading || currentPage === 1" icon="chevron-double-left" icon-only type="secondary" title="First Page" data-test="pagination-first-button" />
7
+ <ecs-button @click="$emit('prevPage', $event)" :disabled="loading || currentPage === 1" icon="chevron-left" icon-only type="secondary" title="Previous Page" data-test="pagination-previous-button" />
8
+ </ecs-flex-row>
9
+ <ecs-flex-row :gap="4">
10
+ <span>Page</span>
11
+ <ecs-select @change="$emit('updatePage', $event.target.value)" :disabled="!totalPages" size="sml">
12
+ <option v-for="n in totalPages" :key="n" :value="n" :selected="n === currentPage">{{ n }}</option>
13
+ </ecs-select>
14
+ <span v-if="totalPages" class="total">of {{ totalPages }}</span>
15
+ </ecs-flex-row>
16
+ <ecs-flex-row>
17
+ <ecs-button @click="$emit('nextPage', $event)" :disabled="loading || currentPage === totalPages" icon="chevron-right" icon-only type="secondary" title="Next Page" data-test="pagination-next-button" />
18
+ <ecs-button @click="$emit('lastPage', $event)" :disabled="loading || currentPage === totalPages" icon="chevron-double-right" icon-only type="secondary" title="Last Page" data-test="pagination-last-button" />
19
+ </ecs-flex-row>
20
+ </template>
21
+ <transition name="fade">
22
+ <ecs-flex-row v-if="loading" :gap="4" :class="$slots.tabs && type =='paginated' ? 'push-right' : ''">
23
+ <div v-if="!$slots.tabs && type =='paginated'" class="separator" />
24
+ <ecs-icon type="loading" spinning size="24" color="#858E9E" />
25
+ </ecs-flex-row>
26
+ </transition>
19
27
  </ecs-flex-row>
20
28
 
21
29
  <div class="ecs-pagination-tabs">
@@ -23,7 +31,7 @@
23
31
  <slot name="tabs"></slot>
24
32
  </div>
25
33
 
26
- <ecs-flex-row v-if="showItemsPerPage" :gap="4" class="ecs-pagination-items">
34
+ <ecs-flex-row v-if="showItemsPerPage && type == 'paginated'" :gap="4" class="ecs-pagination-items">
27
35
  <span>Items per page</span>
28
36
  <ecs-select @change="$emit('itemsPerPage', $event.target.value)" :disabled="loading" size="sml">
29
37
  <option v-for="n in itemsPerPage" :key="n" :value="n" :selected="n === itemsPerPageSelected">{{ n }}</option>
@@ -41,12 +49,14 @@
41
49
  import EcsButton from '../button/button'
42
50
  import EcsSelect from '../select/select'
43
51
  import EcsFlexRow from '../flex/flex-row'
52
+ import EcsIcon from '../icon/icon'
44
53
 
45
54
  export default {
46
55
  components: {
47
56
  EcsButton,
48
57
  EcsSelect,
49
- EcsFlexRow
58
+ EcsFlexRow,
59
+ EcsIcon
50
60
  },
51
61
 
52
62
  props: {
@@ -55,6 +65,12 @@
55
65
  type: Boolean,
56
66
  default: false
57
67
  },
68
+ /** Determines which elements are visible in the pagination component. */
69
+ type: {
70
+ type: String,
71
+ validator: v => ['paginated', 'infinite'].includes(v),
72
+ default: 'paginated'
73
+ },
58
74
  /** Briefly disables all controls while ongoing navigation. */
59
75
  loading: {
60
76
  type: Boolean,
@@ -68,10 +84,10 @@
68
84
  totalPages: {
69
85
  type: Number,
70
86
  },
71
- /** The width of the area left to the tab area in pixels or percentage. This is used to align the tab bar with a column in the table. Not needed when tabs aren't in use. */
87
+ /** The width of the area left to the tab area in pixels. This is used to align the tab bar with a column in the table. Not needed when tabs aren't in use. */
72
88
  tabsSpacing: {
73
- type: String,
74
- default: '400px'
89
+ type: Number,
90
+ default: 400
75
91
  },
76
92
  /** Determines if the selector for items per page should be shown. */
77
93
  showItemsPerPage: {
@@ -118,7 +134,6 @@
118
134
 
119
135
  &-nav{
120
136
  height: 40px;
121
- margin-right: -$spacing-5;
122
137
 
123
138
  .ecs-form-select{
124
139
  width: 52px;
@@ -140,5 +155,29 @@
140
155
  &-controls{
141
156
  margin-left: $spacing-10;
142
157
  }
158
+
159
+ .separator{
160
+ width: 1px;
161
+ background: $color-gray-4;
162
+ height: $spacing-20;
163
+ }
164
+
165
+ .ecs-spinner{
166
+ margin-left: $spacing-5;
167
+ }
168
+
169
+ .push-right{
170
+ margin-left: auto;
171
+ padding-right: $spacing-10;
172
+ }
173
+ }
174
+
175
+ .fade-enter-active, .fade-leave-active {
176
+ transition: all .15s;
177
+ }
178
+
179
+ .fade-enter, .fade-leave-to {
180
+ opacity: 0;
181
+ transform: scale(.2);
143
182
  }
144
183
  </style>
@@ -6,6 +6,20 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 3.1.1 (29 November 2022)
10
+
11
+ ### Fixes
12
+
13
+ - Fixed padding of pagination slot in EcsLayoutIndex component
14
+ - Fixed position of sidebar in EcsLayoutIndex component
15
+
16
+ ## Version 3.1.0 (24 November 2022)
17
+
18
+ ### Fixes
19
+
20
+ - Added `type` prop to EcsPagination component
21
+ - Added loading indicator to EcsPagination component
22
+
9
23
  ## Version 3.0.0 (21 November 2022)
10
24
 
11
25
  ### Breaking Changes
@@ -29,8 +29,16 @@ export const color = () => ({
29
29
  export const size = () => ({
30
30
  components: { EcsIcon },
31
31
  template: `<main>
32
- <ecs-icon type="marker" width="20" height="20" />
32
+ <ecs-icon type="marker" size="20" />
33
33
  <ecs-icon type="marker" />
34
- <ecs-icon type="marker" width="40" height="40" />
34
+ <ecs-icon type="marker" size="40" />
35
+ </main>`,
36
+ });
37
+
38
+ export const spinning = () => ({
39
+ components: { EcsIcon },
40
+ template: `<main>
41
+ <ecs-icon type="loading" spinning color="rgba(133,142,158,.9)" />
42
+ <ecs-icon type="refresh" spinning color="rgba(133,142,158,.9)" />
35
43
  </main>`,
36
44
  });
@@ -35,3 +35,18 @@ export const tabPagination = () => ({
35
35
  </ecs-pagination>
36
36
  </div>`,
37
37
  });
38
+
39
+ export const infiniteScroll = () => ({
40
+ components: { EcsPagination, EcsTabBar, EcsTabButton },
41
+ template: `<div style="display:flex;flex-direction:column;height: 200px;justify-content: flex-end;">
42
+ <ecs-pagination type="infinite" :current-page="2" :total-pages="10" loading>
43
+ <template slot="tabs">
44
+ <ecs-tab-bar type="sheet">
45
+ <ecs-tab-button show>Settings</ecs-tab-button>
46
+ <ecs-tab-button>Calendar</ecs-tab-button>
47
+ <ecs-tab-button>Versions</ecs-tab-button>
48
+ </ecs-tab-bar>
49
+ </template>
50
+ </ecs-pagination>
51
+ </div>`,
52
+ });