@everchron/ec-shards 0.7.60 → 0.7.63

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.7.60",
3
+ "version": "0.7.63",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -1,17 +1,23 @@
1
1
  <template>
2
2
  <div class="ecs-collection-control" :class="[
3
3
  noBorder ? '' : 'bordered',
4
- isVisible ? '' : 'collapsed',
4
+ isVisible || nonInteractive ? '' : 'collapsed',
5
5
  size
6
6
  ]">
7
- <div @click="toggleCollapse" class="ecs-collection-control-header" :class="isVisible ? '' : 'collapsed'">
7
+ <div @click="toggleCollapse" class="ecs-collection-control-header" :class="[
8
+ isVisible || nonInteractive ? '' : 'collapsed',
9
+ nonInteractive ? '' : 'interactive',
10
+ ]">
8
11
  <ecs-icon v-if="icon" :type="icon" color="#858E9E" :width="iconSize" :height="iconSize" />
9
12
  <div class="description" v-if="label">{{ label }}</div>
10
- <div class="collection" :title="fullTooltip">
13
+ <div class="collection"
14
+ @mouseover="toggleTooltip"
15
+ @mouseleave="toggleTooltip"
16
+ :title="fullTooltip">
11
17
  <span v-for="item in collection" :key="item.name" v-if="item.value">{{ item.name }}</span>
12
18
  </div>
13
19
  </div>
14
- <div :class="isVisible ? 'collapse-show' : 'collapse-hide'" class="collapse">
20
+ <div :class="isVisible || nonInteractive ? 'collapse-show' : 'collapse-hide'" class="collapse">
15
21
  <div class="ecs-collection-control-list scrollbar scrollbar-sml" :style="listMaxHeight">
16
22
  <slot></slot>
17
23
  </div>
@@ -51,6 +57,10 @@
51
57
  maxHeight: {
52
58
  type: Number,
53
59
  default: null
60
+ },
61
+ nonInteractive: {
62
+ type: Boolean,
63
+ default: false
54
64
  }
55
65
  },
56
66
 
@@ -66,8 +76,8 @@
66
76
  },
67
77
 
68
78
  fullTooltip() {
69
- // FIX ME: should only join items that are value true
70
- return this.collection.map(item => item.name).join(', ')
79
+ const filterItems = this.collection.filter(o => o.value)
80
+ return filterItems.map((item) => item.name).join(', ')
71
81
  },
72
82
 
73
83
  listMaxHeight() {
@@ -79,6 +89,10 @@
79
89
  toggleCollapse(){
80
90
  this.isVisible = !this.isVisible
81
91
  this.$emit('toggled', this.id, this.isVisible)
92
+ },
93
+
94
+ toggleTooltip() {
95
+ this.$emit('collectionTooltip', this.fullTooltip)
82
96
  }
83
97
  },
84
98
 
@@ -134,10 +148,13 @@
134
148
  font-size: 14px;
135
149
  line-height: 20px;
136
150
  position: relative;
137
- cursor: pointer;
138
151
  transition: .2s;
139
152
  user-select: none;
140
153
 
154
+ &.interactive{
155
+ cursor: pointer;
156
+ }
157
+
141
158
  &:not(.collapsed){
142
159
  box-shadow: 0 1px 0 0 $gray-3;
143
160
  }
@@ -149,10 +166,15 @@
149
166
  .description{
150
167
  color: $gray-10;
151
168
  margin-right: 4px;
169
+ white-space: nowrap;
152
170
  }
153
171
 
154
172
  .collection{
155
173
  color: $gray-15;
174
+ white-space: nowrap;
175
+ flex: 1;
176
+ overflow: hidden;
177
+ text-overflow: ellipsis;
156
178
 
157
179
  > span:not(:last-child){
158
180
  &:after{
@@ -161,7 +183,7 @@
161
183
  }
162
184
  }
163
185
 
164
- &:after{
186
+ &.interactive:after{
165
187
  content: "";
166
188
  position: absolute;
167
189
  width: 18px;
@@ -174,7 +196,7 @@
174
196
  opacity: .7;
175
197
  }
176
198
 
177
- &.collapsed:after{
199
+ &.interactive.collapsed:after{
178
200
  transform: rotate(-90deg);
179
201
  opacity: 1;
180
202
  }
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <div class="ecs-directory-entry">
3
+ <ecs-icon :type="icon" color="#A1A6B0" />
4
+ <div v-if="indicator" class="indicator" :style="`background-color:`+indicator" />
5
+ <div class="items">
6
+ <slot></slot>
7
+ </div>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+ import EcsIcon from '../icon/icon'
13
+
14
+ export default {
15
+ components: {
16
+ EcsIcon
17
+ },
18
+ props: {
19
+ icon: {
20
+ type: String,
21
+ required: true
22
+ },
23
+ indicator: {
24
+ type: String,
25
+ }
26
+ }
27
+ }
28
+ </script>
29
+
30
+ <style lang="scss" scoped>
31
+ @import "../tokens/tokens";
32
+
33
+ .ecs-directory-entry{
34
+ display: flex;
35
+ position: relative;
36
+ margin-bottom: 8px;
37
+
38
+ &:last-child{
39
+ margin-bottom: 0;
40
+ }
41
+
42
+ .indicator{
43
+ position: absolute;
44
+ top: 16px;
45
+ left: 16px;
46
+ width: 12px;
47
+ height: 12px;
48
+ border: 2px solid #FFF;
49
+ border-radius: 100%;
50
+ }
51
+
52
+ .items{
53
+ line-height: 20px;
54
+ font-size: 14px;
55
+ padding: 5px 0;
56
+ margin-left: 8px;
57
+ color: $gray-15;
58
+ display: flex;
59
+ flex-direction: column;
60
+ word-break: break-word;
61
+
62
+ a{
63
+ color: $gray-15;
64
+ display: inline-block;
65
+ position: relative;
66
+ z-index: 1;
67
+
68
+ &:after{
69
+ content: "";
70
+ position: absolute;
71
+ top: -2px;
72
+ left: -4px;
73
+ bottom: -2px;
74
+ right: -4px;
75
+ opacity: 0;
76
+ transform: scale(.6);
77
+ transition: opacity .15s ease-in-out, transform .3s cubic-bezier(0.3, 0.76, 0.27, 1.5);
78
+ border-radius: 4px;
79
+ z-index: -1;
80
+ pointer-events: none;
81
+ background: rgba($gray-8, .1);
82
+ }
83
+
84
+ &:hover:after{
85
+ opacity: 1;
86
+ transform: scale(1);
87
+ }
88
+ }
89
+ }
90
+ }
91
+ </style>
@@ -30,6 +30,7 @@ import EcsDataList from "./data-list/data-list.vue"
30
30
  import EcsDataListItem from "./data-list-item/data-list-item.vue"
31
31
  import EcsDialog from "./dialog/dialog.vue"
32
32
  import EcsDialogHeader from "./dialog-header/dialog-header.vue"
33
+ import EcsDirectoryEntry from "./directory-entry/directory-entry.vue"
33
34
  import EcsDocumentState from "./document-state/document-state.vue"
34
35
  import EcsDropzone from "./dropzone/dropzone.vue"
35
36
  import EcsEmptyState from "./empty-state/empty-state.vue"
@@ -139,6 +140,7 @@ const Components = {
139
140
  EcsDataListItem,
140
141
  EcsDialog,
141
142
  EcsDialogHeader,
143
+ EcsDirectoryEntry,
142
144
  EcsDocumentState,
143
145
  EcsDropzone,
144
146
  EcsEmptyState,
@@ -50,7 +50,7 @@ export const collectionControlWithoutBorders = () => ({
50
50
  }
51
51
  },
52
52
  template: `<div>
53
- <ecs-collection-control no-border :collection="collection" label="Grant Access:" icon="parties" style="margin-bottom:24px">
53
+ <ecs-collection-control non-interactive no-border :collection="collection" label="Grant Access:" icon="parties" style="margin-bottom:24px">
54
54
  <ecs-popover-list>
55
55
  <ecs-popover-list-item @input="accessToggle" v-for="item in collection" :value="item.value" type="checkbox">{{ item.name }}</ecs-popover-list-item>
56
56
  </ecs-popover-list>
@@ -41,9 +41,10 @@ data() {
41
41
  </div>
42
42
  ```
43
43
 
44
- ## Without Borders
44
+ ## Without Borders and no Interactivity
45
45
 
46
46
  By adding the `no-border` attribute, the border will be removed.
47
+ Sometimes you may want to disable to collapse functionality, this can be done by adding the `non-interactive` attribute.
47
48
 
48
49
  <Canvas withSource="none" withToolbar={true}>
49
50
  <Story name="Collection Control Without Borders" height="240px">
@@ -0,0 +1,30 @@
1
+ import EcsDirectoryEntry from '@components/directory-entry/directory-entry';
2
+
3
+ export default {
4
+ title: 'Content Structures/Directory Entry',
5
+ component: EcsDirectoryEntry
6
+ };
7
+
8
+
9
+ export const directoryEntry = () => ({
10
+ components: { EcsDirectoryEntry },
11
+ template: `<div>
12
+ <ecs-directory-entry icon="mail">
13
+ <a href="mailto:info@everchron.com">info@everchron.com</a>
14
+ </ecs-directory-entry>
15
+ <ecs-directory-entry icon="mail">
16
+ <ul>
17
+ <li><a href="https://everchron.com">everchron.com</a></li>
18
+ <li><a href="https://google.com">google.com</a></li>
19
+ <li><a href="https://twitter.com">twitter.com</a></li>
20
+ </ul>
21
+ </ecs-directory-entry>
22
+ </div>`,
23
+ });
24
+
25
+ export const directoryEntryIndicator = () => ({
26
+ components: { EcsDirectoryEntry },
27
+ template: `<ecs-directory-entry icon="person" indicator="#0EBA65">
28
+ Active
29
+ </ecs-directory-entry>`,
30
+ });
@@ -0,0 +1,48 @@
1
+ import { Meta, Story, ArgsTable, Canvas, Description } from '@storybook/addon-docs/blocks';
2
+ import { EcsDirectoryEntry } from '@components/directory-entry/directory-entry';
3
+ import * as stories from './directory-entry.stories.js';
4
+
5
+ <Meta
6
+ title="Content Structures/Directory Entry"
7
+ component={EcsDirectoryEntry} />
8
+
9
+ # Directory Entry `EcsDirectoryEntry`
10
+
11
+ A directory can display a single point of data, or a collection of data (usually links or phone numbers). Directory entries do always have an icon.
12
+
13
+ <Canvas withSource="none" withToolbar={true}>
14
+ <Story name="Directory Entry" height="200px">
15
+ {stories.directoryEntry()}
16
+ </Story>
17
+ </Canvas>
18
+
19
+ ```js
20
+ <ecs-directory-entry icon="mail">
21
+ <a href="mailto:info@everchron.com">info@everchron.com</a>
22
+ </ecs-directory-entry>
23
+ <ecs-directory-entry icon="mail">
24
+ <ul>
25
+ <li><a href="https://everchron.com">everchron.com</a></li>
26
+ <li><a href="https://google.com">google.com</a></li>
27
+ <li><a href="https://twitter.com">twitter.com</a></li>
28
+ </ul>
29
+ </ecs-directory-entry>
30
+ ```
31
+
32
+ ## Indicator
33
+
34
+ Optionally you can add an indicator to the directory entry icon. Use the `indicator` prop to set the indicator to a specific color (HEX or RGB, no alpha values).
35
+
36
+ <Canvas withSource="none" withToolbar={true}>
37
+ <Story name="Directory Entry Indicator" height="200px">
38
+ {stories.directoryEntryIndicator()}
39
+ </Story>
40
+ </Canvas>
41
+
42
+ ```js
43
+ <ecs-directory-entry icon="person" indicator="#0EBA65">Active</ecs-directory-entry>
44
+ ```
45
+
46
+ ## Props
47
+
48
+ <ArgsTable of={EcsDirectoryEntry} />