@everchron/ec-shards 2.1.8 → 2.2.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.1.8",
3
+ "version": "2.2.0",
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="30" :height="30" />
6
+ <ecs-avatar v-else :name="userName" :image="userImage" :size="30" 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
 
@@ -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>
@@ -4,10 +4,12 @@
4
4
  :class="[
5
5
  small ? 'ecs-data-list-item-sml' : '',
6
6
  full ? 'ecs-data-list-item-full' : '',
7
- plain ? '' : 'indent'
7
+ plain ? 'plain' : 'filled',
8
+ indent ? 'indent' : '',
9
+ plain && bordered ? 'bordered' : ''
8
10
  ]">
9
- <div class="ecs-data-list-identifier">
10
- {{identifier}}
11
+ <div v-if="hasIdentifier" class="ecs-data-list-identifier">
12
+ {{ identifier }}
11
13
  <ecs-button-more type="ellipsis"
12
14
  v-if="$slots.collapse"
13
15
  class="ecs-data-list-expand-button"
@@ -43,8 +45,7 @@
43
45
  props: {
44
46
  /** The label that shows up to the left of the list item. Usually describes the content to the left, e.g.: "Type", "Profiles", etc. */
45
47
  identifier: {
46
- type: String,
47
- required: true
48
+ type: String
48
49
  },
49
50
  /** Renders the list item in a smaller variant. */
50
51
  small: {
@@ -90,6 +91,16 @@
90
91
  plain: {
91
92
  type: Boolean,
92
93
  default: false
94
+ },
95
+ /** Adds a border bottom to each item (except the last in the list). **Important** the border is only applied when used in combination with the `plain` prop. */
96
+ bordered: {
97
+ type: Boolean,
98
+ default: false
99
+ },
100
+ /** Determines if there should be a left/right padding in the content areas. */
101
+ indent: {
102
+ type: Boolean,
103
+ default: true
93
104
  }
94
105
  },
95
106
 
@@ -104,7 +115,12 @@
104
115
  if (this.type && this.type !== '')
105
116
  return `data-list-data-${this.type}`
106
117
  return this.type
107
- }
118
+ },
119
+
120
+ hasIdentifier() {
121
+ if ((this.identifier && this.identifier !== '') || this.$slots.collapse)
122
+ return true
123
+ },
108
124
  },
109
125
 
110
126
  methods : {
@@ -195,10 +211,15 @@
195
211
  }
196
212
  }
197
213
 
198
- &.indent{
214
+ &.filled{
199
215
  .ecs-data-list-identifier{
200
216
  background: rgba($color-gray-6, .1);
201
217
  color: $color-gray-10;
218
+ }
219
+ }
220
+
221
+ &.indent{
222
+ .ecs-data-list-identifier{
202
223
  padding: 6px 8px;
203
224
  }
204
225
 
@@ -206,24 +227,37 @@
206
227
  padding: 6px 0 6px 8px;
207
228
  }
208
229
  }
230
+
231
+ &.bordered{
232
+ border-bottom: 1px solid $color-gray-3;
233
+ margin-bottom: 0;
234
+ }
209
235
  }
210
236
 
211
237
  > div{
212
- &:first-child > .ecs-data-list-item .ecs-data-list-identifier{
213
- border-top-left-radius: $border-radius-small;
238
+ &:first-child{
239
+ > .ecs-data-list-item .ecs-data-list-identifier{
240
+ border-top-left-radius: $border-radius-small;
241
+ }
242
+
243
+ > .ecs-data-list-item.ecs-data-list-item-full .ecs-data-list-identifier{
244
+ border-top-left-radius: $border-radius-small;
245
+ border-top-right-radius: $border-radius-small;
246
+ }
214
247
  }
215
248
 
216
- &:last-child > .ecs-data-list-item .ecs-data-list-identifier{
217
- border-bottom-left-radius: $border-radius-small;
218
- }
249
+ &:last-child{
250
+ > .ecs-data-list-item .ecs-data-list-identifier{
251
+ border-bottom-left-radius: $border-radius-small;
252
+ }
219
253
 
220
- &:first-child > .ecs-data-list-item.ecs-data-list-item-full .ecs-data-list-identifier{
221
- border-top-left-radius: $border-radius-small;
222
- border-top-right-radius: $border-radius-small;
223
- }
254
+ > .ecs-data-list-item.ecs-data-list-item-full .ecs-data-list-identifier{
255
+ border-bottom-left-radius: 0;
256
+ }
224
257
 
225
- &:last-child > .ecs-data-list-item.ecs-data-list-item-full .ecs-data-list-identifier{
226
- border-bottom-left-radius: 0;
258
+ .ecs-data-list-item.bordered{
259
+ border-bottom: none;
260
+ }
227
261
  }
228
262
  }
229
263
 
@@ -250,7 +284,7 @@
250
284
  }
251
285
 
252
286
  &-data{
253
- width: calc(100% - 145px);
287
+ flex: 1;
254
288
  padding: 6px 0;
255
289
  position: relative;
256
290
  z-index: 0;
@@ -262,6 +296,7 @@
262
296
  &-mono{
263
297
  font-family: $font-family-monospace;
264
298
  font-size: $type-scale-2-font-size;
299
+ line-height: $type-scale-3-line-height;
265
300
  }
266
301
 
267
302
  &-escape{
@@ -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{
@@ -1,9 +1,13 @@
1
1
  <template>
2
- <div v-if="type === 'rect'" class="skeleton skeleton-rectangle" :style="{ width: width + 'px', 'height': height + 'px' }" />
2
+ <div v-if="type === 'rect' || type === 'circle'" class="skeleton" :class="rectClass" :style="{ width: width + 'px', 'height': height + 'px' }" />
3
3
  <div v-else-if="type === 'multi'" class="skeletons">
4
- <div v-for="n in parseInt(count)" :key="n" class="skeleton skeleton-single" />
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="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,19 +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;
58
129
  }
59
130
 
131
+ &-circle{
132
+ border-radius: 100%;
133
+ }
134
+
60
135
  &:after{
61
136
  background: linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.8),hsla(0,0%,100%,0));
62
137
  animation: skeleton 2.5s infinite;
@@ -74,13 +149,8 @@
74
149
  .skeletons{
75
150
  cursor: wait;
76
151
 
77
- .skeleton{
78
- margin-bottom: 15px;
79
-
80
- &:last-child{
81
- width: 65%;
82
- margin-bottom: 0;
83
- }
152
+ .skeleton-wrap:last-child{
153
+ width: 65%;
84
154
  }
85
155
  }
86
156
  </style>
@@ -6,6 +6,25 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 2.2.0 (4 November 2022)
10
+
11
+ ### Features
12
+
13
+ - Added `circle` variant to skeleton loader component
14
+ - Added `loading` state to comment component
15
+ - Added line height scales to EcsSkeletonLoader component, to match common text line heights
16
+
17
+ ### Fixes
18
+
19
+ - Style fixes in EcsCommentsList component
20
+ - Fixed line height in EcsDataListItem
21
+
22
+ ## Version 2.1.9 (1 November 2022)
23
+
24
+ ### Features
25
+
26
+ - Added `indent` and `bordered` props to EcsDataListItem for more variants in possible style.
27
+
9
28
  ## Version 2.1.8 (30 October 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
+ });
@@ -11,7 +11,7 @@ export const dataListItem = () => ({
11
11
  components: { EcsDataList, EcsDataListItem, EcsButton },
12
12
  template: `<ecs-data-list>
13
13
  <ecs-data-list-item identifier="Identifier">Data</ecs-data-list-item>
14
- <ecs-data-list-item identifier="Identifier">Data</ecs-data-list-item>
14
+ <ecs-data-list-item escape identifier="Identifier">Data</ecs-data-list-item>
15
15
  <ecs-data-list-item identifier="Identifier"><a href="https://google.com" target="_blank">Google</a></ecs-data-list-item>
16
16
  </ecs-data-list>`
17
17
  });
@@ -25,6 +25,24 @@ export const dataListItemFull = () => ({
25
25
  </ecs-data-list>`
26
26
  });
27
27
 
28
+ export const dataListItemPlain = () => ({
29
+ components: { EcsDataList, EcsDataListItem, EcsButton },
30
+ template: `<ecs-data-list>
31
+ <ecs-data-list-item plain identifier="Identifier">Data</ecs-data-list-item>
32
+ <ecs-data-list-item plain full identifier="Identifier">Full Data</ecs-data-list-item>
33
+ <ecs-data-list-item plain identifier="Identifier"><a href="https://google.com" target="_blank">Google</a></ecs-data-list-item>
34
+ </ecs-data-list>`
35
+ });
36
+
37
+ export const dataListItemPlainBordered = () => ({
38
+ components: { EcsDataList, EcsDataListItem, EcsButton },
39
+ template: `<ecs-data-list>
40
+ <ecs-data-list-item plain bordered identifier="Identifier">Data</ecs-data-list-item>
41
+ <ecs-data-list-item plain bordered full identifier="Identifier">Full Data</ecs-data-list-item>
42
+ <ecs-data-list-item plain bordered identifier="Identifier"><a href="https://google.com" target="_blank">Google</a></ecs-data-list-item>
43
+ </ecs-data-list>`
44
+ });
45
+
28
46
  export const dataListItemExpandable = () => ({
29
47
  components: { EcsDataList, EcsDataListItem },
30
48
  template: `<ecs-data-list>
@@ -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
+ });