@everchron/ec-shards 0.7.56 → 0.7.57
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/dist/ec-shards.common.js +206 -0
- package/dist/ec-shards.common.js.map +1 -1
- package/dist/ec-shards.css +1 -1
- package/dist/ec-shards.umd.js +206 -0
- package/dist/ec-shards.umd.js.map +1 -1
- package/dist/ec-shards.umd.min.js +2 -2
- package/dist/ec-shards.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/collection-control/collection-control.vue +199 -0
- package/src/components/index.js +2 -0
- package/src/stories/Introduction.stories.mdx +4 -4
- package/src/stories/collection-control/collection-control.stories.js +101 -0
- package/src/stories/collection-control/collection-control.stories.mdx +66 -0
package/package.json
CHANGED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ecs-collection-control" :class="[
|
|
3
|
+
noBorder ? '' : 'bordered',
|
|
4
|
+
isVisible ? '' : 'collapsed',
|
|
5
|
+
size
|
|
6
|
+
]">
|
|
7
|
+
<div @click="toggleCollapse" class="ecs-collection-control-header" :class="isVisible ? '' : 'collapsed'">
|
|
8
|
+
<ecs-icon v-if="icon" :type="icon" color="#858E9E" :width="iconSize" :height="iconSize" />
|
|
9
|
+
<div class="description" v-if="label">{{ label }}</div>
|
|
10
|
+
<div class="collection" :title="fullTooltip">
|
|
11
|
+
<span v-for="item in collection" :key="item.name" v-if="item.value">{{ item.name }}</span>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div :class="isVisible ? 'collapse-show' : 'collapse-hide'" class="collapse">
|
|
15
|
+
<div class="ecs-collection-control-list scrollbar scrollbar-sml" :style="listMaxHeight">
|
|
16
|
+
<slot></slot>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import EcsIcon from '../icon/icon'
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
components: { EcsIcon },
|
|
27
|
+
props: {
|
|
28
|
+
icon: {
|
|
29
|
+
type: String
|
|
30
|
+
},
|
|
31
|
+
size: {
|
|
32
|
+
type: String,
|
|
33
|
+
validator: v => ['md', 'lg'].includes(v),
|
|
34
|
+
default: 'lg'
|
|
35
|
+
},
|
|
36
|
+
visible: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
label: {
|
|
41
|
+
type: String
|
|
42
|
+
},
|
|
43
|
+
noBorder: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
},
|
|
47
|
+
collection: {
|
|
48
|
+
type: Array,
|
|
49
|
+
required: true
|
|
50
|
+
},
|
|
51
|
+
maxHeight: {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: null
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
data() {
|
|
58
|
+
return {
|
|
59
|
+
isVisible: this.visible
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
computed: {
|
|
64
|
+
iconSize() {
|
|
65
|
+
return this.size === 'md' ? '24px' : '30px'
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
fullTooltip() {
|
|
69
|
+
// FIX ME: should only join items that are value true
|
|
70
|
+
return this.collection.map(item => item.name).join(', ')
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
listMaxHeight() {
|
|
74
|
+
return this.maxHeight ? `max-height: ${ this.maxHeight }px` : null
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
methods: {
|
|
79
|
+
toggleCollapse(){
|
|
80
|
+
this.isVisible = !this.isVisible
|
|
81
|
+
this.$emit('toggled', this.id, this.isVisible)
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
watch: {
|
|
86
|
+
visible(){
|
|
87
|
+
this.isVisible = this.visible
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<style lang="scss" scoped>
|
|
94
|
+
@import "../tokens/tokens";
|
|
95
|
+
@import "../mixins/svg-uri";
|
|
96
|
+
|
|
97
|
+
.ecs-collection-control{
|
|
98
|
+
border-radius: 4px;
|
|
99
|
+
|
|
100
|
+
&.bordered{
|
|
101
|
+
border: 1px solid $gray-4;
|
|
102
|
+
transition: .2s;
|
|
103
|
+
|
|
104
|
+
&.collapsed:hover{
|
|
105
|
+
box-shadow: 0 1px 1px rgba(#474B60, .08);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&.md{
|
|
110
|
+
.ecs-collection-control-header{
|
|
111
|
+
padding: 3px 24px 3px 0;
|
|
112
|
+
margin: 0 8px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ecs-collection-control-list{
|
|
116
|
+
padding: 0 0 2px 0;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.lg{
|
|
121
|
+
.ecs-collection-control-header{
|
|
122
|
+
padding: 4px 24px 4px 0;
|
|
123
|
+
margin: 0 12px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ecs-collection-control-list{
|
|
127
|
+
padding: 2px 4px;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&-header{
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
font-size: 14px;
|
|
135
|
+
line-height: 20px;
|
|
136
|
+
position: relative;
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
transition: .2s;
|
|
139
|
+
user-select: none;
|
|
140
|
+
|
|
141
|
+
&:not(.collapsed){
|
|
142
|
+
box-shadow: 0 1px 0 0 $gray-3;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.icon{
|
|
146
|
+
margin-right: 4px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.description{
|
|
150
|
+
color: $gray-10;
|
|
151
|
+
margin-right: 4px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.collection{
|
|
155
|
+
color: $gray-15;
|
|
156
|
+
|
|
157
|
+
> span:not(:last-child){
|
|
158
|
+
&:after{
|
|
159
|
+
content: ", ";
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:after{
|
|
165
|
+
content: "";
|
|
166
|
+
position: absolute;
|
|
167
|
+
width: 18px;
|
|
168
|
+
height: 18px;
|
|
169
|
+
background: svg-uri('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><path fill="#{$gray-8}" d="M881.010919,595 L886.687546,588.842677 C886.864064,588.651212 886.864064,588.356318 886.687546,588.164852 L886.00296,587.422296 C885.815784,587.219269 885.499462,587.20642 885.296436,587.393597 C885.286526,587.402733 885.276989,587.412266 885.26785,587.422173 L881.010919,592.036499 L876.73215,587.398487 C876.544907,587.195522 876.228581,587.182778 876.025617,587.370022 C876.015709,587.379161 876.006176,587.388698 875.997039,587.398608 L875.312454,588.141164 C875.135936,588.33263 875.135936,588.627524 875.312454,588.818989 L881.010919,595 Z" transform="translate(-872 -582)"/></svg>');
|
|
170
|
+
right: 0;
|
|
171
|
+
top: 50%;
|
|
172
|
+
margin-top: -9px;
|
|
173
|
+
transition: .35s;
|
|
174
|
+
opacity: .7;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&.collapsed:after{
|
|
178
|
+
transform: rotate(-90deg);
|
|
179
|
+
opacity: 1;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&-list{
|
|
184
|
+
overflow: auto;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.ecs-popover-list{
|
|
188
|
+
padding: 0;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.collapse-show{
|
|
193
|
+
display: block;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.collapse-hide{
|
|
197
|
+
display: none;
|
|
198
|
+
}
|
|
199
|
+
</style>
|
package/src/components/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import EcsButtonToolbarIcon from "./button-toolbar-icon/button-toolbar-icon.vue"
|
|
|
20
20
|
import EcsCard from "./card/card.vue"
|
|
21
21
|
import EcsCheckbox from "./checkbox/checkbox.vue"
|
|
22
22
|
import EcsCollapse from "./collapse/collapse.vue"
|
|
23
|
+
import EcsCollectionControl from "./collection-control/collection-control.vue"
|
|
23
24
|
import EcsComment from "./comment/comment.vue"
|
|
24
25
|
//import EcsCommentForm from "./comment-form/comment-form.vue"
|
|
25
26
|
import EcsCommentList from "./comment-list/comment-list.vue"
|
|
@@ -127,6 +128,7 @@ const Components = {
|
|
|
127
128
|
EcsCheckbox,
|
|
128
129
|
EcsCard,
|
|
129
130
|
EcsCollapse,
|
|
131
|
+
EcsCollectionControl,
|
|
130
132
|
EcsComment,
|
|
131
133
|
// EcsCommentForm,
|
|
132
134
|
EcsCommentList,
|
|
@@ -21,13 +21,13 @@ import { Meta } from '@storybook/addon-docs/blocks';
|
|
|
21
21
|
<span>Building blocks for putting your interface together.</span>
|
|
22
22
|
</a>
|
|
23
23
|
|
|
24
|
-
<a href="https://
|
|
25
|
-
<span>
|
|
26
|
-
<span>Flexible
|
|
24
|
+
<a href="https://www.figma.com/file/VdnGdnfdtYLkcVjXFDpKSx/Core?node-id=15%3A312" target="_blank">
|
|
25
|
+
<span>Figma Library</span>
|
|
26
|
+
<span>Flexible Figma components, that match their implemented counterparts.</span>
|
|
27
27
|
</a>
|
|
28
28
|
|
|
29
29
|
<a href="https://everchron.com/brand" target="_blank" style={{ marginLeft: '20px' }}>
|
|
30
30
|
<span>Brand Guidelines</span>
|
|
31
31
|
<span>Everchron basic branding and marketing guidelines.</span>
|
|
32
32
|
</a>
|
|
33
|
-
</aside>
|
|
33
|
+
</aside>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import EcsCollectionControl from '@components/collection-control/collection-control';
|
|
2
|
+
import EcsPopoverList from '@components/popover-list/popover-list';
|
|
3
|
+
import EcsPopoverListItem from '@components/popover-list-item/popover-list-item';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Forms/Collection Control',
|
|
7
|
+
component: EcsCollectionControl
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const collectionControl = () => ({
|
|
11
|
+
components: { EcsCollectionControl, EcsPopoverList, EcsPopoverListItem },
|
|
12
|
+
data() {
|
|
13
|
+
return {
|
|
14
|
+
collection: [
|
|
15
|
+
{ name: 'Editors', value: true },
|
|
16
|
+
{ name: 'Clients', value: true },
|
|
17
|
+
{ name: 'Translation Agency', value: false }
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
template: `<div>
|
|
22
|
+
<ecs-collection-control :collection="collection" label="Grant Access:" icon="parties" style="margin-bottom:24px">
|
|
23
|
+
<ecs-popover-list>
|
|
24
|
+
<ecs-popover-list-item @input="accessToggle" v-for="item in collection" :value="item.value" type="checkbox">{{ item.name }}</ecs-popover-list-item>
|
|
25
|
+
</ecs-popover-list>
|
|
26
|
+
</ecs-collection-control>
|
|
27
|
+
|
|
28
|
+
<ecs-collection-control size="md" :collection="collection" label="Grant Access:" icon="parties">
|
|
29
|
+
<ecs-popover-list>
|
|
30
|
+
<ecs-popover-list-item @input="accessToggle" v-for="item in collection" :value="item.value" type="checkbox">{{ item.name }}</ecs-popover-list-item>
|
|
31
|
+
</ecs-popover-list>
|
|
32
|
+
</ecs-collection-control>
|
|
33
|
+
</div>`,
|
|
34
|
+
methods: {
|
|
35
|
+
accessToggle(value) {
|
|
36
|
+
this.$emit('access', value)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const collectionControlWithoutBorders = () => ({
|
|
42
|
+
components: { EcsCollectionControl, EcsPopoverList, EcsPopoverListItem },
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
collection: [
|
|
46
|
+
{ name: 'Editors', value: true },
|
|
47
|
+
{ name: 'Clients', value: true },
|
|
48
|
+
{ name: 'Translation Agency', value: false }
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
template: `<div>
|
|
53
|
+
<ecs-collection-control no-border :collection="collection" label="Grant Access:" icon="parties" style="margin-bottom:24px">
|
|
54
|
+
<ecs-popover-list>
|
|
55
|
+
<ecs-popover-list-item @input="accessToggle" v-for="item in collection" :value="item.value" type="checkbox">{{ item.name }}</ecs-popover-list-item>
|
|
56
|
+
</ecs-popover-list>
|
|
57
|
+
</ecs-collection-control>
|
|
58
|
+
|
|
59
|
+
<ecs-collection-control no-border size="md" :collection="collection" label="Grant Access:" icon="parties">
|
|
60
|
+
<ecs-popover-list>
|
|
61
|
+
<ecs-popover-list-item @input="accessToggle" v-for="item in collection" :value="item.value" type="checkbox">{{ item.name }}</ecs-popover-list-item>
|
|
62
|
+
</ecs-popover-list>
|
|
63
|
+
</ecs-collection-control>
|
|
64
|
+
</div>`,
|
|
65
|
+
methods: {
|
|
66
|
+
accessToggle(value) {
|
|
67
|
+
this.$emit('access', value)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const collectionControlLimitedHeight = () => ({
|
|
73
|
+
components: { EcsCollectionControl, EcsPopoverList, EcsPopoverListItem },
|
|
74
|
+
data() {
|
|
75
|
+
return {
|
|
76
|
+
collection: [
|
|
77
|
+
{ name: 'Editors', value: true },
|
|
78
|
+
{ name: 'Clients', value: true },
|
|
79
|
+
{ name: 'Translation Agency', value: false }
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
template: `<div>
|
|
84
|
+
<ecs-collection-control :max-height="80" :collection="collection" label="Grant Access:" icon="parties" style="margin-bottom:24px">
|
|
85
|
+
<ecs-popover-list>
|
|
86
|
+
<ecs-popover-list-item @input="accessToggle" v-for="item in collection" :value="item.value" type="checkbox">{{ item.name }}</ecs-popover-list-item>
|
|
87
|
+
</ecs-popover-list>
|
|
88
|
+
</ecs-collection-control>
|
|
89
|
+
|
|
90
|
+
<ecs-collection-control :max-height="80" size="md" :collection="collection" label="Grant Access:" icon="parties">
|
|
91
|
+
<ecs-popover-list>
|
|
92
|
+
<ecs-popover-list-item @input="accessToggle" v-for="item in collection" :value="item.value" type="checkbox">{{ item.name }}</ecs-popover-list-item>
|
|
93
|
+
</ecs-popover-list>
|
|
94
|
+
</ecs-collection-control>
|
|
95
|
+
</div>`,
|
|
96
|
+
methods: {
|
|
97
|
+
accessToggle(value) {
|
|
98
|
+
this.$emit('access', value)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Meta, Story, ArgsTable, Canvas, Description } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import EcsCollectionControl from '@components/collection-control/collection-control';
|
|
3
|
+
import * as stories from './collection-control.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title="Forms/Collection Control"
|
|
7
|
+
component={EcsCollectionControl} />
|
|
8
|
+
|
|
9
|
+
# Collection Control `EcsCollectionControl`
|
|
10
|
+
|
|
11
|
+
Collection controls are lists of controls that can be toggled on or off. There are two sizes available: `md` and `lg`.
|
|
12
|
+
|
|
13
|
+
<Canvas withSource="none" withToolbar={true}>
|
|
14
|
+
<Story name="Collection Control" height="240px">
|
|
15
|
+
{stories.collectionControl()}
|
|
16
|
+
</Story>
|
|
17
|
+
</Canvas>
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
collection: [
|
|
23
|
+
{ name: 'Editors', value: true },
|
|
24
|
+
{ name: 'Clients', value: true },
|
|
25
|
+
{ name: 'Translation Agency', value: false }
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
<ecs-collection-control :collection="collection" label="Grant Access:" icon="parties">
|
|
31
|
+
<ecs-popover-list>
|
|
32
|
+
<ecs-popover-list-item @input="accessToggle" v-for="item in collection" :value="item.value" type="checkbox">{{ item.name }}</ecs-popover-list-item>
|
|
33
|
+
</ecs-popover-list>
|
|
34
|
+
</ecs-collection-control>
|
|
35
|
+
|
|
36
|
+
<ecs-collection-control size="md" :collection="collection" label="Grant Access:" icon="parties">
|
|
37
|
+
<ecs-popover-list>
|
|
38
|
+
<ecs-popover-list-item @input="accessToggle" v-for="item in collection" :value="item.value" type="checkbox">{{ item.name }}</ecs-popover-list-item>
|
|
39
|
+
</ecs-popover-list>
|
|
40
|
+
</ecs-collection-control>
|
|
41
|
+
</div>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Without Borders
|
|
45
|
+
|
|
46
|
+
By adding the `no-border` attribute, the border will be removed.
|
|
47
|
+
|
|
48
|
+
<Canvas withSource="none" withToolbar={true}>
|
|
49
|
+
<Story name="Collection Control Without Borders" height="240px">
|
|
50
|
+
{stories.collectionControlWithoutBorders()}
|
|
51
|
+
</Story>
|
|
52
|
+
</Canvas>
|
|
53
|
+
|
|
54
|
+
## Limited Height
|
|
55
|
+
|
|
56
|
+
You can control the maximum height of the (scrollable) collection list by setting the `max-height` attribute (number).
|
|
57
|
+
|
|
58
|
+
<Canvas withSource="none" withToolbar={true}>
|
|
59
|
+
<Story name="Collection Control Limited Height" height="240px">
|
|
60
|
+
{stories.collectionControlLimitedHeight()}
|
|
61
|
+
</Story>
|
|
62
|
+
</Canvas>
|
|
63
|
+
|
|
64
|
+
## Props and Slots
|
|
65
|
+
|
|
66
|
+
<ArgsTable of={EcsCollectionControl} />
|