@everchron/ec-shards 0.7.55 → 0.7.58
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 +670 -27
- package/dist/ec-shards.common.js.map +1 -1
- package/dist/ec-shards.css +1 -1
- package/dist/ec-shards.umd.js +670 -27
- 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/assets/icons/open-external.svg +5 -0
- package/src/components/collection-control/collection-control.vue +199 -0
- package/src/components/index.js +6 -0
- package/src/components/input-search/input-search.vue +206 -0
- package/src/components/layout-data-table/layout-data-table.vue +1 -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/src/stories/input-search/input-search.stories.js +72 -0
- package/src/stories/input-search/input-search.stories.mdx +59 -0
package/package.json
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path vector-effect="non-scaling-stroke" d="M19.3333 5.25H24.75V10.6667" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path vector-effect="non-scaling-stroke" d="M17.1667 12.8333L24.75 5.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path vector-effect="non-scaling-stroke" d="M22.5833 17.1667V22.5834C22.5833 23.7804 21.6138 24.75 20.4167 24.75H7.41667C6.21958 24.75 5.25 23.7804 5.25 22.5834V9.58335C5.25 8.38627 6.21958 7.41669 7.41667 7.41669H12.8333" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
</svg>
|
|
@@ -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"
|
|
@@ -32,6 +33,7 @@ import EcsDialogHeader from "./dialog-header/dialog-header.vue"
|
|
|
32
33
|
import EcsDocumentState from "./document-state/document-state.vue"
|
|
33
34
|
import EcsDropzone from "./dropzone/dropzone.vue"
|
|
34
35
|
import EcsEmptyState from "./empty-state/empty-state.vue"
|
|
36
|
+
import EcsExcerptSnippet from "./excerpt-snippet/excerpt-snippet.vue"
|
|
35
37
|
import EcsFileIcon from "./file-icon/file-icon.vue"
|
|
36
38
|
import EcsFileList from "./file-list/file-list.vue"
|
|
37
39
|
import EcsFileListItem from "./file-list-item/file-list-item.vue"
|
|
@@ -50,6 +52,7 @@ import EcsInputClear from "./input-clear/input-clear.vue"
|
|
|
50
52
|
import EcsInputConnector from "./input-connector/input-connector.vue"
|
|
51
53
|
import EcsInputFloat from "./input-float/input-float.vue"
|
|
52
54
|
import EcsInputGroup from "./input-group/input-group.vue"
|
|
55
|
+
import EcsInputSearch from "./input-search/input-search.vue"
|
|
53
56
|
import EcsJumperDocument from "./jumper-document/jumper-document.vue"
|
|
54
57
|
import EcsJumperIndex from "./jumper-index/jumper-index.vue"
|
|
55
58
|
import EcsJumperPage from "./jumper-page/jumper-page.vue"
|
|
@@ -126,6 +129,7 @@ const Components = {
|
|
|
126
129
|
EcsCheckbox,
|
|
127
130
|
EcsCard,
|
|
128
131
|
EcsCollapse,
|
|
132
|
+
EcsCollectionControl,
|
|
129
133
|
EcsComment,
|
|
130
134
|
// EcsCommentForm,
|
|
131
135
|
EcsCommentList,
|
|
@@ -138,12 +142,14 @@ const Components = {
|
|
|
138
142
|
EcsDocumentState,
|
|
139
143
|
EcsDropzone,
|
|
140
144
|
EcsEmptyState,
|
|
145
|
+
EcsExcerptSnippet,
|
|
141
146
|
EcsFileIcon,
|
|
142
147
|
EcsFileList,
|
|
143
148
|
EcsFileListItem,
|
|
144
149
|
EcsFlag,
|
|
145
150
|
EcsFormCheck,
|
|
146
151
|
EcsFormGroup,
|
|
152
|
+
EcsInputSearch,
|
|
147
153
|
EcsFormHeadline,
|
|
148
154
|
EcsFormatted,
|
|
149
155
|
EcsFormSet,
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ecs-search-group">
|
|
3
|
+
<ecs-icon type="search" color="#B9BCC2" :width="iconSize" :height="iconSize" />
|
|
4
|
+
<input ref="input"
|
|
5
|
+
:name="name"
|
|
6
|
+
:disabled="disabled"
|
|
7
|
+
:placeholder="placeholder"
|
|
8
|
+
:autocomplete="autocomplete"
|
|
9
|
+
:value="value"
|
|
10
|
+
v-bind="$attrs"
|
|
11
|
+
@input="onInput"
|
|
12
|
+
@change="onChange"
|
|
13
|
+
:class="[
|
|
14
|
+
'ecs-search-input',
|
|
15
|
+
sizeClass,
|
|
16
|
+
typeClass
|
|
17
|
+
]"
|
|
18
|
+
/>
|
|
19
|
+
<ecs-input-clear v-if="showClear" @click="clearSearch" />
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import EcsIcon from '../icon/icon'
|
|
25
|
+
import EcsInputClear from '../input-clear/input-clear'
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
components: {
|
|
29
|
+
EcsIcon,
|
|
30
|
+
EcsInputClear
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
props: {
|
|
34
|
+
placeholder: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'Search...'
|
|
37
|
+
},
|
|
38
|
+
autocomplete: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: null
|
|
41
|
+
},
|
|
42
|
+
value: {
|
|
43
|
+
type: [String, Number],
|
|
44
|
+
default: ''
|
|
45
|
+
},
|
|
46
|
+
name: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: null
|
|
49
|
+
},
|
|
50
|
+
disabled: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
showClear: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
size: {
|
|
59
|
+
type: String,
|
|
60
|
+
validator: v => ['md', 'lg', 'sml', null].includes(v),
|
|
61
|
+
default: 'md'
|
|
62
|
+
},
|
|
63
|
+
type: {
|
|
64
|
+
type: String,
|
|
65
|
+
validator: v => ['subtle', 'naked', null].includes(v),
|
|
66
|
+
default: null
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
computed: {
|
|
71
|
+
sizeClass() {
|
|
72
|
+
return this.size ? `ecs-search-input-${this.size}` : null
|
|
73
|
+
},
|
|
74
|
+
typeClass() {
|
|
75
|
+
return this.type ? `ecs-search-input-${this.type}` : null
|
|
76
|
+
},
|
|
77
|
+
iconSize() {
|
|
78
|
+
if(this.size === 'sml') {
|
|
79
|
+
return '24px'
|
|
80
|
+
} else {
|
|
81
|
+
return '30px'
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
methods: {
|
|
87
|
+
setValue(value) {
|
|
88
|
+
this.$refs.input.value = value
|
|
89
|
+
this.$emit('input', value)
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
onInput(e) {
|
|
93
|
+
this.setValue(e.target.value)
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
onChange(e) {
|
|
97
|
+
this.setValue(e.target.value)
|
|
98
|
+
this.$emit('change', e.target.value)
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
clearSearch() {
|
|
102
|
+
this.setValue('')
|
|
103
|
+
this.$emit('input', '')
|
|
104
|
+
this.$emit('change', '')
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
watch: {
|
|
109
|
+
value (newVal) {
|
|
110
|
+
this.setValue(newVal)
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
mounted() {
|
|
115
|
+
if (this.value) {
|
|
116
|
+
this.setValue(this.value)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<style lang="scss" scoped>
|
|
123
|
+
@import "../tokens/tokens";
|
|
124
|
+
@import "../mixins/svg-uri";
|
|
125
|
+
|
|
126
|
+
.ecs-search-group{
|
|
127
|
+
position: relative;
|
|
128
|
+
|
|
129
|
+
.ecs-input-clear{
|
|
130
|
+
position: absolute;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.icon{
|
|
134
|
+
position: absolute;
|
|
135
|
+
top: 50%;
|
|
136
|
+
left: 0;
|
|
137
|
+
transform: translateY(-50%);
|
|
138
|
+
pointer-events: none;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.ecs-search-input{
|
|
143
|
+
display: block;
|
|
144
|
+
width: 100%;
|
|
145
|
+
padding: 7px 32px;
|
|
146
|
+
font-size: 14px;
|
|
147
|
+
font-family: $sf;
|
|
148
|
+
line-height: 16px;
|
|
149
|
+
color: $gray-15;
|
|
150
|
+
background-color: #FFF;
|
|
151
|
+
background-clip: padding-box;
|
|
152
|
+
border: $input-border-width solid rgba($gray-8, .4);
|
|
153
|
+
border-radius: 3px;
|
|
154
|
+
transition: .2s;
|
|
155
|
+
box-shadow: none;
|
|
156
|
+
|
|
157
|
+
&:focus{
|
|
158
|
+
border-color: rgba($blue-8, .5);
|
|
159
|
+
box-shadow: 0 0 0 2px rgba($blue-8, .15);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&-subtle{
|
|
163
|
+
background-color: rgba($gray-10, .15);
|
|
164
|
+
border: none;
|
|
165
|
+
|
|
166
|
+
&:focus{
|
|
167
|
+
background-color: rgba($gray-10, .1);
|
|
168
|
+
box-shadow: none;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&-naked{
|
|
173
|
+
background-color: transparent;
|
|
174
|
+
border: none;
|
|
175
|
+
|
|
176
|
+
&:focus{
|
|
177
|
+
box-shadow: none;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
+ .ecs-input-clear{
|
|
182
|
+
top: 0;
|
|
183
|
+
right: 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&-lg{
|
|
187
|
+
padding: 11px 32px;
|
|
188
|
+
|
|
189
|
+
+ .ecs-input-clear{
|
|
190
|
+
top: 4px;
|
|
191
|
+
right: 4px;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&-sml{
|
|
196
|
+
font-size: 12px;
|
|
197
|
+
padding: 3px 24px;
|
|
198
|
+
line-height: 16px;
|
|
199
|
+
|
|
200
|
+
+ .ecs-input-clear{
|
|
201
|
+
top: -4px;
|
|
202
|
+
right: -4px;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
</style>
|
|
@@ -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} />
|