@everchron/ec-shards 2.1.9 → 2.2.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": "2.1.9",
3
+ "version": "2.2.1",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -2,14 +2,19 @@
2
2
  <div class="ecs-comment">
3
3
  <div class="ecs-comment-header">
4
4
  <div class="ecs-comment-autor">
5
- <ecs-avatar :name="userName" :image="userImage" :size="30" rounded />
6
- <div class="ecs-comment-meta">
5
+ <ecs-skeleton-loader v-if="loading" type="circle" :width="32" :height="32" />
6
+ <ecs-avatar v-else :name="userName" :image="userImage" :size="32" rounded />
7
+ <div v-if="!loading" class="ecs-comment-meta">
7
8
  <span class="ecs-comment-meta-name">{{userName}}</span>
8
9
  <span class="ecs-comment-meta-time">
9
10
  <!-- @slot Slot for the comment date/time. -->
10
11
  <slot name="commentdate"></slot>
11
12
  </span>
12
13
  </div>
14
+ <div v-else class="ecs-comment-meta loading">
15
+ <ecs-skeleton-loader type="single" :line-height="3" :width="50" />
16
+ <ecs-skeleton-loader type="single" :line-height="2" :width="60" />
17
+ </div>
13
18
  </div>
14
19
  <div v-if="canEdit" class="ecs-comment-actions">
15
20
  <ecs-button @click="$emit('edit', $event)" type="secondary" size="sml" icon="edit" icon-only title="Edit Comment" />
@@ -17,11 +22,13 @@
17
22
  </div>
18
23
  </div>
19
24
 
20
- <ecs-formatted v-if="!$slots.editform" class="ecs-comment-body">
25
+ <ecs-formatted v-if="!$slots.editform && !loading" class="ecs-comment-body">
21
26
  <!-- @slot Comment text (rich text). -->
22
27
  <slot></slot>
23
28
  </ecs-formatted>
24
29
 
30
+ <ecs-skeleton-loader v-else-if="loading" type="multi" :count="2" class="ecs-comment-body" />
31
+
25
32
  <div v-else class="ecs-comment-edit">
26
33
  <!-- @slot Contains the form to edit the comment. When this slot is not empty, the form will show up instead of the comment text. -->
27
34
  <slot name="editform"></slot>
@@ -33,9 +40,10 @@
33
40
  import EcsAvatar from '../avatar/avatar'
34
41
  import EcsButton from '../button/button'
35
42
  import EcsFormatted from '../formatted/formatted'
43
+ import EcsSkeletonLoader from '../skeleton-loader/skeleton-loader'
36
44
 
37
45
  export default {
38
- components: { EcsAvatar, EcsButton, EcsFormatted },
46
+ components: { EcsAvatar, EcsButton, EcsFormatted, EcsSkeletonLoader },
39
47
  props: {
40
48
  /** Name of the user that is the comment author. */
41
49
  userName: {
@@ -51,6 +59,11 @@
51
59
  canEdit: {
52
60
  type: Boolean,
53
61
  default: false
62
+ },
63
+ /** Shows the whole comment in skeleton loading state. */
64
+ loading: {
65
+ type: Boolean,
66
+ default: false
54
67
  }
55
68
  }
56
69
  };
@@ -65,19 +78,14 @@
65
78
  &-header{
66
79
  display: flex;
67
80
  align-items: center;
68
- justify-content: space-between;
69
81
  margin-bottom: 10px;
70
82
  }
71
83
 
72
- &-from{
73
- font-size: $type-scale-2-font-size;
74
- color: $color-gray-8;
75
- }
76
-
77
84
  &-autor{
78
85
  display: flex;
79
86
  text-decoration: none;
80
87
  color: $color-blue-10;
88
+ flex: 1;
81
89
 
82
90
  &:hover{
83
91
  color: darken($color-blue-10, 5%);
@@ -89,13 +97,21 @@
89
97
 
90
98
  &-name{
91
99
  font-size: $type-scale-3-font-size;
100
+ line-height: $type-scale-3-line-height;
92
101
  font-weight: $font-weight-medium;
93
102
  display: block;
94
103
  }
95
104
 
96
105
  &-time{
97
106
  font-size: $type-scale-2-font-size;
107
+ line-height: $type-scale-2-line-height;
98
108
  color: $color-gray-8;
109
+ display: block;
110
+ }
111
+
112
+ &.loading{
113
+ width: 100%;
114
+ max-width: 200px;
99
115
  }
100
116
  }
101
117
 
@@ -108,7 +124,7 @@
108
124
  }
109
125
 
110
126
  &-body{
111
- padding-left: 40px;
127
+ padding-left: 42px;
112
128
  }
113
129
  }
114
130
  </style>
@@ -6,9 +6,11 @@
6
6
 
7
7
 
8
8
  <style lang="scss">
9
+ @import "../../tokens/build/scss/tokens.scss";
10
+
9
11
  .ecs-comment-list{
10
- > div{
11
- margin-bottom: 30px;
12
+ > .ecs-comment{
13
+ margin-bottom: $spacing-20;
12
14
  }
13
15
  }
14
16
  </style>
@@ -210,15 +210,15 @@
210
210
  padding: 10px 20px;
211
211
  }
212
212
 
213
- &.loading .ecs-data-card-row-inner > *:not(.skeleton){
213
+ &.loading .ecs-data-card-row-inner > *:not(.ecs-skeleton){
214
214
  opacity: 0;
215
215
  }
216
216
 
217
- .skeleton{
217
+ .ecs-skeleton{
218
218
  position: absolute;
219
219
  }
220
220
 
221
- .ecs-data-card-row .skeleton{
221
+ .ecs-data-card-row .ecs-skeleton{
222
222
  margin-left: 6px;
223
223
  }
224
224
  }
@@ -296,6 +296,7 @@
296
296
  &-mono{
297
297
  font-family: $font-family-monospace;
298
298
  font-size: $type-scale-2-font-size;
299
+ line-height: $type-scale-3-line-height;
299
300
  }
300
301
 
301
302
  &-escape{
@@ -339,8 +340,8 @@
339
340
  }
340
341
  }
341
342
 
342
- .skeleton{
343
- margin-top: 6px;
343
+ .ecs-skeleton{
344
+ margin-top: 2px;
344
345
  }
345
346
  }
346
347
  }
@@ -206,7 +206,7 @@
206
206
  }
207
207
 
208
208
  .icon,
209
- .skeleton-rectangle{
209
+ .ecs-skeleton{
210
210
  margin-right: 4px;
211
211
  }
212
212
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="ecs-formatted" :class="small ? `ecs-formatted-sml` : ''">
3
3
  <slot v-if="!loading"></slot>
4
- <ecs-skeleton-loader v-else type="multi" :count="skeletonCount" />
4
+ <ecs-skeleton-loader v-else type="multi" :line-height="small ? 1 : 2" :count="skeletonCount" />
5
5
  </div>
6
6
  </template>
7
7
 
@@ -6,8 +6,7 @@
6
6
  <ecs-skeleton-loader v-if="loading" type="single" :width="40" class="skeleton-text" />
7
7
  <slot v-else></slot>
8
8
  </div>
9
- <ecs-skeleton-loader v-if="loading && meta" type="single" :width="15" class="skeleton-text" />
10
- <div v-else-if="meta" class="ecs-log-message-meta">
9
+ <div v-if="meta && !loading" class="ecs-log-message-meta">
11
10
  {{ meta }}
12
11
  </div>
13
12
  </ecs-flex-row>
@@ -152,8 +151,4 @@ export default {
152
151
  border-color: $color-green-2;
153
152
  color: $color-green-15;
154
153
  }
155
-
156
- .skeleton-text{
157
- margin-top: 5px !important;
158
- }
159
154
  </style>
@@ -280,7 +280,7 @@
280
280
  }
281
281
 
282
282
  &.control{
283
- padding: 11px 12px;
283
+ padding: 10px 12px;
284
284
 
285
285
  .ecs-form-check{
286
286
  margin-bottom: 0;
@@ -292,6 +292,7 @@
292
292
 
293
293
  .ecs-switch-wrapper{
294
294
  margin: -7px 0;
295
+ padding: 5px 0;
295
296
  }
296
297
 
297
298
  .after{
@@ -6,7 +6,7 @@
6
6
  <span v-if="label" class="label" :class="loading ? 'loading' : ''">{{ labelText }}</span>
7
7
 
8
8
  <ecs-skeleton-loader v-if="loading" type="rect" :width="20" :height="20" />
9
- <ecs-skeleton-loader v-if="loading && label" type="single" style="width:calc(100% - 30px)" />
9
+ <ecs-skeleton-loader v-if="loading && label" type="single" :width="100" style="width:calc(100% - 30px)" />
10
10
  </div>
11
11
  </template>
12
12
 
@@ -214,12 +214,12 @@
214
214
  }
215
215
  }
216
216
 
217
- .skeleton{
217
+ .ecs-skeleton{
218
218
  position: absolute;
219
+ }
219
220
 
220
- &-single{
221
- left: 28px;
222
- }
221
+ .skeleton-wrap{
222
+ left: 28px;
223
223
  }
224
224
 
225
225
  &.disabled{
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="ecs-rating-read" :class="[sizeClass]">
3
3
  <div v-if="!loading" class="ecs-stars-read" :data-maximum="maximum" :data-rating="rating"></div>
4
- <ecs-skeleton-loader v-else type="single" :width="100" />
4
+ <ecs-skeleton-loader v-else type="single" :line-height="3" :width="100" />
5
5
  </div>
6
6
  </template>
7
7
 
@@ -112,10 +112,10 @@ $star-read-width: 18px;
112
112
  }
113
113
  }
114
114
 
115
- .skeleton{
115
+ .ecs-skeleton{
116
116
  position: absolute;
117
117
  top: 50%;
118
- margin-top: -3px;
118
+ margin-top: -10px;
119
119
  }
120
120
  }
121
121
  </style>
@@ -1,9 +1,13 @@
1
1
  <template>
2
- <div v-if="type === 'rect'" class="skeleton skeleton-rectangle" :style="{ width: width + 'px', 'height': height + 'px' }" />
3
- <div v-else-if="type === 'multi'" class="skeletons">
4
- <div v-for="n in parseInt(count)" :key="n" class="skeleton skeleton-single" />
2
+ <div v-if="type === 'rect' || type === 'circle'" class="ecs-skeleton skeleton" :class="rectClass" :style="{ width: width + 'px', 'height': height + 'px' }" />
3
+ <div v-else-if="type === 'multi'" class="ecs-skeleton skeletons">
4
+ <div v-for="n in parseInt(count)" :key="n" class="skeleton-wrap" :class="'skeleton-line-height-'+lineHeight">
5
+ <div class="skeleton skeleton-single" />
6
+ </div>
7
+ </div>
8
+ <div v-else class="ecs-skeleton skeleton-wrap" :class="'skeleton-line-height-'+lineHeight">
9
+ <div class="skeleton skeleton-single" :style="{ width: width + '%' }" />
5
10
  </div>
6
- <div v-else class="skeleton skeleton-single" :style="{ width: width + '%' }" />
7
11
  </template>
8
12
 
9
13
  <script>
@@ -12,7 +16,7 @@
12
16
  /** Determines the type of skeleton shape: `single` replicates a single line of text, `multi` a multi line text, and `rect` a generic rectangle shape. */
13
17
  type: {
14
18
  type: String,
15
- validator: v => ['single', 'multi', 'rect'].includes(v),
19
+ validator: v => ['single', 'multi', 'rect', 'circle'].includes(v),
16
20
  default: 'single'
17
21
  },
18
22
  /** Only used together with the `multi` type. Determines the amount of text lines. */
@@ -25,10 +29,24 @@
25
29
  type: Number,
26
30
  default: 20
27
31
  },
28
- /** Sets the height of the `single` type in percentage. Sets the width of the `rect` type in pixels. */
32
+ /** Sets the height of the `rect` and `circle` type in pixels. */
29
33
  height: {
30
34
  type: Number,
31
35
  default: 20
36
+ },
37
+ /** Aligns the height and size of the single & multi types with our common line-height type scales. */
38
+ lineHeight: {
39
+ type: Number,
40
+ validator: v => [1, 2, 3, 4, 5, 6].includes(v),
41
+ default: 2
42
+ }
43
+ },
44
+
45
+ computed: {
46
+ rectClass() {
47
+ if (this.type && this.type !== '')
48
+ return `skeleton-${this.type}`
49
+ return this.type
32
50
  }
33
51
  }
34
52
  }
@@ -44,17 +62,76 @@
44
62
  }
45
63
  }
46
64
 
65
+ .skeleton-wrap{
66
+ width: 100%;
67
+ }
68
+
69
+ .skeleton-line-height{
70
+ &-1{
71
+ padding: 5px 0;
72
+
73
+ .skeleton{
74
+ height: 4px;
75
+ }
76
+ }
77
+
78
+ &-2{
79
+ padding: 5px 0;
80
+
81
+ .skeleton{
82
+ height: 6px;
83
+ }
84
+ }
85
+
86
+ &-3{
87
+ padding: 6px 0;
88
+
89
+ .skeleton{
90
+ height: 8px;
91
+ }
92
+ }
93
+
94
+ &-4{
95
+ padding: 8px 0;
96
+
97
+ .skeleton{
98
+ height: 8px;
99
+ }
100
+ }
101
+
102
+ &-5{
103
+ padding: 9px 0;
104
+
105
+ .skeleton{
106
+ height: 10px;
107
+ }
108
+ }
109
+
110
+ &-6{
111
+ padding: 10px 0;
112
+
113
+ .skeleton{
114
+ height: 12px;
115
+ }
116
+ }
117
+ }
118
+
47
119
  .skeleton{
48
- border-radius: $border-radius-medium;
120
+ border-radius: 16px;
49
121
  background: $color-gray-3;
50
122
  width: 100%;
51
- height: 6px;
52
123
  overflow: hidden;
53
124
  position: relative;
54
125
  cursor: wait;
55
126
 
56
- &-rectangle{
127
+ &-rect{
57
128
  border-radius: $border-radius-small;
129
+ flex-shrink: 0;
130
+ }
131
+
132
+ &-circle{
133
+ border-radius: 100%;
134
+ flex-shrink: 0;
58
135
  }
59
136
 
60
137
  &:after{
@@ -74,13 +151,8 @@
74
151
  .skeletons{
75
152
  cursor: wait;
76
153
 
77
- .skeleton{
78
- margin-bottom: 15px;
79
-
80
- &:last-child{
81
- width: 65%;
82
- margin-bottom: 0;
83
- }
154
+ .skeleton-wrap:last-child{
155
+ width: 65%;
84
156
  }
85
157
  }
86
158
  </style>
@@ -10,7 +10,7 @@
10
10
 
11
11
  <slot></slot>
12
12
  <span class="count" v-if="count">{{count}}</span>
13
- <ecs-skeleton-loader v-if="loading" type="single" style="width: calc(100% - 20px)" />
13
+ <ecs-skeleton-loader v-if="loading" type="single" :width="100" style="width: calc(100% - 20px)" />
14
14
  </span>
15
15
  </template>
16
16
 
@@ -246,10 +246,10 @@
246
246
  transition: none;
247
247
  }
248
248
 
249
- .skeleton{
249
+ .ecs-skeleton{
250
250
  position: absolute;
251
251
  top: 50%;
252
- margin-top: -3px;
252
+ margin-top: -8px;
253
253
  left: 10px;
254
254
  }
255
255
  }
@@ -6,6 +6,25 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 2.2.1 (4 November 2022)
10
+
11
+ ### Fixes
12
+
13
+ - Fix broken skeleton instances introduced in 2.2.0
14
+
15
+ ## Version 2.2.0 (4 November 2022)
16
+
17
+ ### Features
18
+
19
+ - Added `circle` variant to skeleton loader component
20
+ - Added `loading` state to comment component
21
+ - Added line height scales to EcsSkeletonLoader component, to match common text line heights
22
+
23
+ ### Fixes
24
+
25
+ - Style fixes in EcsCommentsList component
26
+ - Fixed line height in EcsDataListItem
27
+
9
28
  ## Version 2.1.9 (1 November 2022)
10
29
 
11
30
  ### Features
@@ -25,3 +25,13 @@ export const commentEdit = () => ({
25
25
  </ecs-comment>
26
26
  </ecs-comment-list>`,
27
27
  });
28
+
29
+ export const commentLoading = () => ({
30
+ components: { EcsCommentList, EcsComment },
31
+ template: `<ecs-comment-list>
32
+ <ecs-comment loading user-name="Ivo Mynttinen">
33
+ This is my comment.
34
+ <template slot="commentdate">Apr 13, 2021 at 3:42 pm</template>
35
+ </ecs-comment>
36
+ </ecs-comment-list>`,
37
+ });
@@ -10,6 +10,18 @@ export const singleLine = () => ({
10
10
  template: `<ecs-skeleton-loader type="single" />`,
11
11
  });
12
12
 
13
+ export const typeScales = () => ({
14
+ components: { EcsSkeletonLoader },
15
+ template: `<main>
16
+ <ecs-skeleton-loader type="single" :line-height="1" />
17
+ <ecs-skeleton-loader type="single" :line-height="2" />
18
+ <ecs-skeleton-loader type="single" :line-height="3" />
19
+ <ecs-skeleton-loader type="single" :line-height="4" />
20
+ <ecs-skeleton-loader type="single" :line-height="5" />
21
+ <ecs-skeleton-loader type="single" :line-height="6" />
22
+ </main>`,
23
+ });
24
+
13
25
  export const multiLine = () => ({
14
26
  components: { EcsSkeletonLoader },
15
27
  template: `<ecs-skeleton-loader type="multi" :count="4" />`,
@@ -19,3 +31,8 @@ export const rectangle = () => ({
19
31
  components: { EcsSkeletonLoader },
20
32
  template: `<ecs-skeleton-loader type="rect" :width="22" :height="22" />`,
21
33
  });
34
+
35
+ export const circle = () => ({
36
+ components: { EcsSkeletonLoader },
37
+ template: `<ecs-skeleton-loader type="circle" :width="22" :height="22" />`,
38
+ });