@everchron/ec-shards 0.6.76 → 0.6.77

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": "0.6.76",
3
+ "version": "0.6.77",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -4,15 +4,18 @@
4
4
  :class="[
5
5
  active ? 'active' : '',
6
6
  hasLabel,
7
- subtle ? 'subtle' : ''
7
+ subtle ? 'subtle' : '',
8
+ pale ? 'pale' : '',
9
+ sizeClass
8
10
  ]"
9
11
  :disabled="disabled"
10
12
  @click="$emit('click', $event)"
11
13
  @mouseover="$emit('mouseover', $event)"
12
14
  @mouseleave="$emit('mouseleave', $event)">
13
15
 
14
- <ecs-icon v-if="icon" :type="icon" width="20" height="20" />
15
- <div v-if="label != null">{{ label }}</div>
16
+ <ecs-icon v-if="icon" :type="icon" :width="iconSize" :height="iconSize" />
17
+ <div v-if="label != null" class="label">{{ label }}</div>
18
+ <div v-if="chevron" class="chevron" :class="active ? 'expand' : ''" />
16
19
  </button>
17
20
  </template>
18
21
 
@@ -30,6 +33,15 @@
30
33
  type: Boolean,
31
34
  default: false
32
35
  },
36
+ pale: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ size: {
41
+ type: String,
42
+ validator: v => ['md', 'sml', null].includes(v),
43
+ default: 'md'
44
+ },
33
45
  icon: {
34
46
  type: String
35
47
  },
@@ -39,6 +51,10 @@
39
51
  disabled: {
40
52
  type: Boolean,
41
53
  default: false
54
+ },
55
+ chevron: {
56
+ type: Boolean,
57
+ default: false
42
58
  }
43
59
  },
44
60
 
@@ -47,6 +63,19 @@
47
63
  if (this.label && this.label !== '' || this.label != null)
48
64
  return `has-label`
49
65
  return this.label
66
+ },
67
+
68
+ sizeClass() {
69
+ if (this.size && this.size !== '')
70
+ return `ecs-button-table-${this.size}`
71
+ return this.size
72
+ },
73
+
74
+ iconSize() {
75
+ if (this.size == 'sml')
76
+ return '16'
77
+ else
78
+ return '20'
50
79
  }
51
80
  }
52
81
  }
@@ -63,24 +92,53 @@
63
92
  background: rgba($gray-7, .1);
64
93
  color: $gray-14;
65
94
  transition: .2s;
66
- font-size: 14px;
67
- padding: 1px;
68
95
  cursor: pointer;
69
96
  position: relative;
70
97
  z-index: 1;
71
98
  flex-shrink: 0;
72
99
 
100
+ &-md{
101
+ font-size: 14px;
102
+ padding: 1px;
103
+ height: 22px;
104
+
105
+ .label{
106
+ padding: 0 6px;
107
+ }
108
+
109
+ &.has-label{
110
+ padding: 4px;
111
+ height: 28px;
112
+ }
113
+ }
114
+
115
+ &-sml{
116
+ padding: 2px;
117
+ font-size: 12px;
118
+ height: 20px;
119
+
120
+ .label{
121
+ padding: 0 4px;
122
+ }
123
+ }
124
+
73
125
  .icon{
74
126
  color: $gray-8;
75
127
  transition: .2s;
76
128
  }
77
129
 
78
- > div{
79
- padding: 0 6px;
80
- }
130
+ .chevron{
131
+ width: 16px;
132
+ height: 16px;
133
+ background: svg-uri('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><polyline fill="none" stroke="#858E9E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" points="-2 2 2 6 6 2" transform="rotate(-90 7.2 3.2)"/></svg>');
134
+ transition: .2s;
135
+ opacity: .6;
136
+ margin: 0 -1px 0 -2px;
81
137
 
82
- &.has-label{
83
- padding: 4px;
138
+ &.expand{
139
+ transform: rotate(90deg);
140
+ opacity: 1;
141
+ }
84
142
  }
85
143
 
86
144
  &.subtle{
@@ -128,6 +186,33 @@
128
186
  }
129
187
  }
130
188
 
189
+ &.pale{
190
+ color: $gray-10;
191
+ background: rgba($gray-7, .08);
192
+
193
+ .icon{
194
+ color: $gray-6;
195
+ }
196
+
197
+ &:hover{
198
+ color: $gray-11;
199
+ background: rgba($gray-7, .14);
200
+
201
+ .icon{
202
+ color: $gray-7;
203
+ }
204
+ }
205
+
206
+ &.active{
207
+ background: rgba($gray-8, .16);
208
+ color: $gray-11;
209
+
210
+ .icon{
211
+ color: $gray-7;
212
+ }
213
+ }
214
+ }
215
+
131
216
  &:disabled{
132
217
  opacity: .5;
133
218
  cursor: default;
@@ -5,6 +5,7 @@
5
5
  $slots.actions ? 'ecs-data-card-hover' : '',
6
6
  hover ? 'ecs-data-card-hover' : '',
7
7
  active ? 'active' : '',
8
+ isExpanded ? 'expanded' : '',
8
9
  loading ? 'loading' : ''
9
10
  ]">
10
11
 
@@ -24,6 +25,7 @@
24
25
  <div v-if="$slots.actions" class="ecs-data-card-actions">
25
26
  <slot name="actions"></slot>
26
27
  </div>
28
+ <ecs-button-table @click="isExpanded = !isExpanded" v-if="expandable" pale chevron size="sml" :active="isExpanded" :icon="expandIcon" :label="expandLabel" class="expand-button" />
27
29
  </div>
28
30
  <div v-if="$slots.meta" class="ecs-data-card-row">
29
31
  <div class="ecs-data-card-row-inner">
@@ -31,6 +33,11 @@
31
33
  <ecs-skeleton-loader v-if="loading" type="single" :width="skeletonWidth(15, 30)" />
32
34
  </div>
33
35
  </div>
36
+ <div v-if="$slots.expand" v-show="isExpanded" class="ecs-data-card-expand">
37
+ <div class="ecs-data-card-expand-inner">
38
+ <slot name="expand"></slot>
39
+ </div>
40
+ </div>
34
41
  </div>
35
42
  </div>
36
43
  </template>
@@ -38,9 +45,10 @@
38
45
  <script>
39
46
  import EcsIcon from '../icon/icon'
40
47
  import EcsSkeletonLoader from '../skeleton-loader/skeleton-loader'
48
+ import EcsButtonTable from '../button-table/button-table'
41
49
 
42
50
  export default {
43
- components: { EcsIcon, EcsSkeletonLoader },
51
+ components: { EcsIcon, EcsSkeletonLoader, EcsButtonTable },
44
52
 
45
53
  props: {
46
54
  icon: {
@@ -68,6 +76,26 @@
68
76
  spinning: {
69
77
  type: Boolean,
70
78
  default: false
79
+ },
80
+ expandable: {
81
+ type: Boolean,
82
+ default: false
83
+ },
84
+ expanded: {
85
+ type: Boolean,
86
+ default: false
87
+ },
88
+ expandIcon: {
89
+ type: String
90
+ },
91
+ expandLabel: {
92
+ type: String
93
+ }
94
+ },
95
+
96
+ data () {
97
+ return {
98
+ isExpanded: this.expanded
71
99
  }
72
100
  },
73
101
 
@@ -121,6 +149,10 @@
121
149
  background: rgba($gray-8, .04);
122
150
  }
123
151
 
152
+ &.expanded{
153
+ background: $gray-1;
154
+ }
155
+
124
156
  &.active{
125
157
  background: rgba(#0661EB, .05);
126
158
  cursor: default;
@@ -184,6 +216,16 @@
184
216
  }
185
217
  }
186
218
 
219
+ &-expand{
220
+ padding-top: 12px;
221
+
222
+ &-inner{
223
+ background: #FFF;
224
+ border: 1px solid $gray-3;
225
+ border-radius: 4px;
226
+ }
227
+ }
228
+
187
229
  .small{
188
230
  font-size: 12px;
189
231
  }
@@ -235,6 +277,10 @@
235
277
  color: $gray-10;
236
278
  }
237
279
 
280
+ .expand-button{
281
+ margin-left: 8px;
282
+ }
283
+
238
284
  .chained{
239
285
  display: inline-flex;
240
286
 
@@ -7,7 +7,12 @@ export default {
7
7
 
8
8
  export const text = () => ({
9
9
  components: { EcsButtonTable },
10
- template: `<ecs-button-table icon="parties" label="5"></ecs-button-table>`,
10
+ template: `<main>
11
+ <ecs-button-table size="md" icon="parties" label="5" />
12
+ <ecs-button-table size="sml" icon="parties" label="5" />
13
+ <ecs-button-table size="md" chevron pale icon="parties" label="5" />
14
+ <ecs-button-table size="sml" chevron pale icon="parties" label="5" active />
15
+ </main>`,
11
16
  });
12
17
 
13
18
  export const iconOnly = () => ({
@@ -21,7 +21,10 @@ Add text (usually a count) by using the `label` attribute. An icon should always
21
21
  </Canvas>
22
22
 
23
23
  ```js
24
- <ecs-button-table icon="parties" label="4"></ecs-button-table>
24
+ <ecs-button-table size="md" icon="parties" label="5" />
25
+ <ecs-button-table size="sml" icon="parties" label="5" />
26
+ <ecs-button-table size="md" chevron pale icon="parties" label="5" />
27
+ <ecs-button-table size="sml" chevron pale icon="parties" label="5" active />
25
28
  ```
26
29
 
27
30
  ## Icon Only
@@ -50,4 +53,4 @@ Add text (usually a count) by using the `label` attribute. An icon should always
50
53
 
51
54
  ## Props and Events
52
55
 
53
- <ArgsTable of={EcsButtonTable} />
56
+ <ArgsTable of={EcsButtonTable} />
@@ -132,6 +132,20 @@ export const doubleAction = () => ({
132
132
  </ecs-data-card>`
133
133
  });
134
134
 
135
+ export const expandable = () => ({
136
+ components: { EcsDataCard, EcsButtonMore },
137
+ template: `<ecs-data-card expandable expand-icon="link" expand-label="2">
138
+ <span>Added last 2 months</span>
139
+ <span class="subtle">4h ago</span>
140
+ <template slot="meta">
141
+ <span class="subtle"><span class="color-venta-1">32 documents</span> added by Marie Walsh</span>
142
+ </template>
143
+ <template slot="expand">
144
+ test
145
+ </template>
146
+ </ecs-data-card>`
147
+ });
148
+
135
149
  export const loading = () => ({
136
150
  components: { EcsDataCardList, EcsDataCard },
137
151
  template: `<ecs-data-card-list>
@@ -200,6 +200,16 @@ The `control` prop and slot allows to show a simple control (checkbox, radiobutt
200
200
  </ecs-data-card-list>
201
201
  ```
202
202
 
203
+ ### Expandable Area
204
+
205
+ The `expand` slot allows you to add an expandable area to the data card. Please note that if the expand slot is used, the props `expandable` (bool), `expandIcon` (String, icon for expand button) and `expandLabel` (String, label for expand button) will be required.
206
+
207
+ <Canvas withSource="none" withToolbar={true}>
208
+ <Story name="Expandable" height="200px">
209
+ {stories.expandable()}
210
+ </Story>
211
+ </Canvas>
212
+
203
213
  ### Loading States
204
214
 
205
215
  Add a dynamic skeleton loading state to each data card by using the `loading` attribute. Note that this requires content within the data card, so if no content exists yet, you need to place some text as a placeholder.