@everchron/ec-shards 2.2.4 → 3.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everchron/ec-shards",
3
- "version": "2.2.4",
3
+ "version": "3.1.0",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -0,0 +1,4 @@
1
+ <svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M13.375 19.3334L9.04167 15.0001L13.375 10.6667" vector-effect="non-scaling-stroke" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M20.9584 20.4166L15.5417 14.9999L20.9584 9.58325" vector-effect="non-scaling-stroke" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M16.625 19.3334L20.9583 15.0001L16.625 10.6667" vector-effect="non-scaling-stroke" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M9.04163 20.4166L14.4583 14.9999L9.04163 9.58325" vector-effect="non-scaling-stroke" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
4
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M18.7458 7.5L11.25 15.0225L18.75 22.5" vector-effect="non-scaling-stroke" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M11.2542 7.5L18.75 15.0225L11.25 22.5" vector-effect="non-scaling-stroke" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -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;
@@ -19,7 +19,7 @@
19
19
  justify-content: space-between;
20
20
  min-height: 50px;
21
21
  border-bottom: 1px solid $color-gray-3;
22
- margin-bottom: 30px;
22
+ margin-bottom: $spacing-30;
23
23
 
24
24
  &-main{
25
25
  display: flex;
@@ -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
  };
@@ -1,66 +1,62 @@
1
1
  <template>
2
2
  <div class="ecs-pagination" :class="[ floating ? 'ecs-pagination-floating' : '' ]">
3
- <div class="ecs-pagination-nav">
4
- <ecs-button-toolbar-group>
5
- <ecs-button-toolbar
6
- @click="$emit('prevPage', $event)"
7
- :disabled="loading || currentPage === 1"
8
- icon="back"
9
- data-test="pagination-previous-button">
10
- Previous Page
11
- </ecs-button-toolbar>
12
- <ecs-button-toolbar
13
- @click="$emit('nextPage', $event)"
14
- :disabled="loading || currentPage === totalPages"
15
- icon="next"
16
- icon-position="right"
17
- data-test="pagination-next-button">
18
- Next Page
19
- </ecs-button-toolbar>
20
- </ecs-button-toolbar-group>
21
-
22
- <div class="ecs-pagination-dropdown">
23
- <span>Page</span>
24
- <div @click="toggleDropdown" class="ecs-pagination-dropdown-button" :class="[dropdownShown ? 'active' : '', totalPages ? '' : 'disabled']">
25
- <template v-if="currentPage">{{ currentPage }}</template>
26
- <template v-else>-</template>
27
-
28
- <transition name="dropdown">
29
- <div v-if="dropdownShown && totalPages" class="ecs-pagination-select scrollbar scrollbar-sml">
30
- <ecs-popover-list>
31
- <ecs-popover-list-item
32
- @click="$emit('update:page', n), hideDropdown"
33
- v-for="n in totalPages"
34
- :key="n"
35
- :selected="n === currentPage">
36
- {{ n }}
37
- </ecs-popover-list-item>
38
- </ecs-popover-list>
39
- </div>
40
- </transition>
41
- </div>
42
- <span v-if="totalPages" class="total">of {{ totalPages }}</span>
43
- </div>
44
- </div>
45
- <div>
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>
27
+ </ecs-flex-row>
28
+
29
+ <div class="ecs-pagination-tabs">
46
30
  <!-- @slot Slot for a sheet tab bar. -->
47
31
  <slot name="tabs"></slot>
48
32
  </div>
33
+
34
+ <ecs-flex-row v-if="showItemsPerPage && type == 'paginated'" :gap="4" class="ecs-pagination-items">
35
+ <span>Items per page</span>
36
+ <ecs-select @change="$emit('itemsPerPage', $event.target.value)" :disabled="loading" size="sml">
37
+ <option v-for="n in itemsPerPage" :key="n" :value="n" :selected="n === itemsPerPageSelected">{{ n }}</option>
38
+ </ecs-select>
39
+ </ecs-flex-row>
40
+
41
+ <ecs-flex-row v-if="$slots.controls" :gap="4" class="ecs-pagination-controls">
42
+ <!-- @slot Slot for a additional controls, such as a settings button. -->
43
+ <slot name="controls"></slot>
44
+ </ecs-flex-row>
49
45
  </div>
50
46
  </template>
51
47
 
52
48
  <script>
53
- import EcsButtonToolbarGroup from '../button-toolbar-group/button-toolbar-group'
54
- import EcsButtonToolbar from '../button-toolbar/button-toolbar'
55
- import EcsPopoverList from '../popover-list/popover-list'
56
- import EcsPopoverListItem from '../popover-list-item/popover-list-item'
49
+ import EcsButton from '../button/button'
50
+ import EcsSelect from '../select/select'
51
+ import EcsFlexRow from '../flex/flex-row'
52
+ import EcsIcon from '../icon/icon'
57
53
 
58
54
  export default {
59
55
  components: {
60
- EcsButtonToolbarGroup,
61
- EcsButtonToolbar,
62
- EcsPopoverList,
63
- EcsPopoverListItem
56
+ EcsButton,
57
+ EcsSelect,
58
+ EcsFlexRow,
59
+ EcsIcon
64
60
  },
65
61
 
66
62
  props: {
@@ -69,6 +65,12 @@
69
65
  type: Boolean,
70
66
  default: false
71
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
+ },
72
74
  /** Briefly disables all controls while ongoing navigation. */
73
75
  loading: {
74
76
  type: Boolean,
@@ -81,23 +83,28 @@
81
83
  /** The total pages of the index. */
82
84
  totalPages: {
83
85
  type: Number,
84
- }
85
- },
86
-
87
- data() {
88
- return {
89
- dropdownShown: false
90
- }
91
- },
92
-
93
- methods: {
94
- toggleDropdown(){
95
- if(this.totalPages)
96
- this.dropdownShown = !this.dropdownShown
97
86
  },
98
-
99
- hideDropdown(){
100
- this.dropdownShown = false
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. */
88
+ tabsSpacing: {
89
+ type: Number,
90
+ default: 400
91
+ },
92
+ /** Determines if the selector for items per page should be shown. */
93
+ showItemsPerPage: {
94
+ type: Boolean,
95
+ default: true
96
+ },
97
+ /** The options to be show as selectable in the items per page dropdown. Requires an array with Numbers. Default: `[25, 50, 100]` */
98
+ itemsPerPage: {
99
+ type: Array,
100
+ default() {
101
+ return [25, 50, 100]
102
+ }
103
+ },
104
+ /** The selected option in the items per page dropdown. */
105
+ itemsPerPageSelected: {
106
+ type: Number,
107
+ default: 100
101
108
  }
102
109
  }
103
110
  }
@@ -116,6 +123,9 @@
116
123
  box-shadow: 0 -1px 0 $color-gray-4;
117
124
  position: relative;
118
125
  z-index: 2;
126
+ font-size: $type-scale-2-font-size;
127
+ line-height: $type-scale-2-line-height;
128
+ color: $color-gray-15;
119
129
 
120
130
  &-floating{
121
131
  border-radius: $border-radius-small;
@@ -123,94 +133,51 @@
123
133
  }
124
134
 
125
135
  &-nav{
126
- display: flex;
127
- align-items: center;
128
136
  height: 40px;
129
- margin-right: 24px;
130
- }
131
137
 
132
- .ecs-toolbar-button-group{
133
- margin-right: 32px;
138
+ .ecs-form-select{
139
+ width: 52px;
140
+ }
134
141
  }
135
142
 
136
- .ecs-toolbar-button-icon{
137
- font-size: $type-scale-2-font-size;
143
+ &-tabs{
144
+ flex: 1;
138
145
  }
139
146
 
140
- &-dropdown{
141
- display: flex;
142
- align-items: center;
143
- font-size: $type-scale-2-font-size;
144
- color: $color-gray-9;
145
-
146
- .total{
147
- color: $color-gray-15;
147
+ &-items{
148
+ padding-right: $spacing-5;
149
+
150
+ .ecs-form-select{
151
+ width: 52px;
148
152
  }
153
+ }
149
154
 
150
- &-button{
151
- background: #FFF;
152
- display: flex;
153
- align-items: center;
154
- border: 1px solid $color-gray-3;
155
- padding: 0 8px;
156
- height: 32px;
157
- transition: .2s;
158
- border-radius: $border-radius-small;
159
- margin: 0 6px;
160
- cursor: pointer;
161
- position: relative;
162
- color: $color-gray-15;
163
-
164
- &:after{
165
- content: "";
166
- background: svg-uri('<svg xmlns="http://www.w3.org/2000/svg" width="8" height="5" viewBox="0 0 8 5"><polyline fill="none" stroke="#858E9E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" points="0 0 3 3 6 0" transform="translate(1 .8)"/></svg>');
167
- width: 8px;
168
- height: 5px;
169
- margin-left: 6px;
170
- }
171
-
172
- &:hover{
173
- border: 1px solid $color-gray-4;
174
- box-shadow: 0 1px 1px rgba($color-gray-4, .25);
175
- }
155
+ &-controls{
156
+ margin-left: $spacing-10;
157
+ }
176
158
 
177
- &.active{
178
- border: 1px solid $color-gray-5;
179
- box-shadow: 0 1px 0 rgba($color-gray-2, .1) inset;
180
- background: rgba($color-gray-5, .1);
181
- }
159
+ .separator{
160
+ width: 1px;
161
+ background: $color-gray-4;
162
+ height: $spacing-20;
163
+ }
182
164
 
183
- &.disabled{
184
- border: 1px solid $color-gray-3;
185
- box-shadow: none;
186
- cursor: not-allowed;
187
- color: $color-gray-7;
188
- }
189
- }
165
+ .ecs-spinner{
166
+ margin-left: $spacing-5;
190
167
  }
191
168
 
192
- &-select{
193
- position: absolute;
194
- left: 0;
195
- right: auto;
196
- bottom: 34px;
197
- z-index: 1000;
198
- background-color: #fff;
199
- box-shadow: 0 0 0 1px rgba($color-gray-15, .08), 0 1px 3px 0 rgba($color-gray-15, 0.15);
200
- border-radius: $border-radius-small;
201
- max-height: 30vh;
202
- overflow: auto;
169
+ .push-right{
170
+ margin-left: auto;
171
+ padding-right: $spacing-10;
203
172
  }
204
173
  }
205
174
 
206
- .dropdown-enter-active,
207
- .dropdown-leave-active {
208
- transition: all .3s;
175
+ .fade-enter-active, .fade-leave-active {
176
+ transition: all .15s;
209
177
  }
210
178
 
211
- .dropdown-enter,
212
- .dropdown-leave-to {
179
+ .fade-enter, .fade-leave-to {
213
180
  opacity: 0;
214
- transform: translateY(10px);
181
+ transform: scale(.2);
215
182
  }
216
183
  </style>
@@ -24,7 +24,7 @@
24
24
  type: Boolean,
25
25
  default: false
26
26
  },
27
- /** Allows to overwrite the text color. Accepts predefined theme names: `positive`, `negative`, as well as any color HEX or variable. */
27
+ /** Allows to overwrite the text color. Accepts predefined theme names: `positive`, `negative`, `warning`, as well as any color HEX or variable. */
28
28
  color: {
29
29
  type: String
30
30
  }
@@ -68,6 +68,8 @@
68
68
  return '#ED223C'
69
69
  else if (this.color == 'positive')
70
70
  return '#019049'
71
+ else if (this.color == 'warning')
72
+ return '#835D2A'
71
73
  else
72
74
  return this.color
73
75
  }
@@ -6,6 +6,31 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 3.1.0 (24 November 2022)
10
+
11
+ ### Fixes
12
+
13
+ - Added `type` prop to EcsPagination component
14
+ - Added loading indicator to EcsPagination component
15
+
16
+ ## Version 3.0.0 (21 November 2022)
17
+
18
+ ### Breaking Changes
19
+
20
+ - Refactored EcsPagination component
21
+ - New First/Last page buttons
22
+ - Added optional controls slot
23
+ - Added optional "items per page" dropdown
24
+
25
+ ### Features
26
+
27
+ - Added 4 new chevron type icons
28
+
29
+ ### Fixes
30
+
31
+ - Added `warning` type to EcsText component
32
+ - Fixed some spacings on EcsFormHeadline
33
+
9
34
  ## Version 2.2.4 (8 November 2022)
10
35
 
11
36
  ### Fixes
@@ -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
+ });