@everchron/ec-shards 0.8.13 → 0.8.16

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.8.13",
3
+ "version": "0.8.16",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -0,0 +1,132 @@
1
+ <template>
2
+ <div class="ecs-folder-selector" :class="[framed ? 'ecs-folder-selector-border' : '']" :style="{height: isFullHeight}">
3
+ <div v-if="searchable || create" class="ecs-folder-selector-header">
4
+ <ecs-input-search v-if="searchable" v-model="searchInputValue" @input="searchInput" type="naked" :show-clear="showClear" class="ecs-folder-selector-search" placeholder="Search for folders..." />
5
+ <ecs-button v-if="create" @click="handleAddFolder" icon="folder-new" size="sml" class="ecs-folder-selector-add">Add Folder</ecs-button>
6
+ </div>
7
+ <ecs-scroll-container :height="height" :padding="framed ? '8px' : '0'" borderless>
8
+ <!-- @slot Should always contain an EcsTreeList with the selectable options. -->
9
+ <slot v-if="$slots.default"></slot>
10
+ <div v-else class="empty-list">{{ emptyMessage }}</div>
11
+ </ecs-scroll-container>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ import EcsInputSearch from '../input-search/input-search'
17
+ import EcsScrollContainer from '../scroll-container/scroll-container'
18
+ import EcsButton from '../button/button'
19
+
20
+ export default {
21
+ components: {
22
+ EcsInputSearch,
23
+ EcsScrollContainer,
24
+ EcsButton
25
+ },
26
+
27
+ props: {
28
+ /** Determines if the folder selector control has a search bar to filter by folder name. */
29
+ searchable: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ /** Determines if the folder selector control has an Add Folder button to create a new folder on the fly. */
34
+ create: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ /** Determines if the folder selector should have a border and paddings. */
39
+ framed: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ /** Determines the maximum height of the scrollable area. Note: when `searchable` or `create` are set, the header bar adds around 40 pixels to the defined `height`. */
44
+ height: {
45
+ type: String,
46
+ default: '100%'
47
+ },
48
+ emptyMessage: {
49
+ type: String,
50
+ default: 'There are no folders in the Master File.'
51
+ }
52
+ },
53
+
54
+ data () {
55
+ return {
56
+ searchInputValue: ''
57
+ }
58
+ },
59
+
60
+ computed: {
61
+ showClear() {
62
+ return this.searchInputValue.length > 0;
63
+ },
64
+
65
+ isFullHeight() {
66
+ if(this.height === '100%') {
67
+ return '100%'
68
+ }
69
+ }
70
+ },
71
+
72
+ methods: {
73
+ searchInput(e) {
74
+ /** Emitted when the value of the search input is changed. Passes the current search input field value. */
75
+ this.$emit('search', this.searchInputValue)
76
+ },
77
+
78
+ handleAddFolder() {
79
+ /** Emitted on clicking the add folder button. */
80
+ this.$emit('add', $event)
81
+ }
82
+ }
83
+ }
84
+ </script>
85
+
86
+ <style lang="scss" scoped>
87
+ @import "../tokens/tokens";
88
+ @import "../mixins/svg-uri";
89
+
90
+ .ecs-folder-selector{
91
+ display: flex;
92
+ flex-direction: column;
93
+ overflow: hidden;
94
+ background: #FFF;
95
+
96
+ &-header{
97
+ display: flex;
98
+ align-content: center;
99
+ padding-top: 4px;
100
+ padding-bottom: 4px;
101
+ margin-bottom: 4px;
102
+ padding-right: 2px;
103
+ }
104
+
105
+ &-search{
106
+ flex: 1;
107
+ }
108
+
109
+ &-add{
110
+ margin-left: 16px;
111
+ }
112
+
113
+ &-border{
114
+ border-radius: 6px;
115
+ border: 1px solid #D7DAE1;
116
+
117
+ .ecs-folder-selector-header{
118
+ padding-left: 8px;
119
+ padding-right: 8px;
120
+ margin: 0;
121
+ border-bottom: 1px solid #ECEDF2;
122
+ }
123
+ }
124
+
125
+ .empty-list{
126
+ padding: 8px 4px;
127
+ color: #858E9E;
128
+ font-size: 14px;
129
+ }
130
+ }
131
+ </style>
132
+
@@ -40,6 +40,7 @@ import EcsFileIcon from "./file-icon/file-icon.vue"
40
40
  import EcsFileList from "./file-list/file-list.vue"
41
41
  import EcsFileListItem from "./file-list-item/file-list-item.vue"
42
42
  import EcsFlag from "./flag/flag.vue"
43
+ import EcsFolderSelector from "./folder-selector/folder-selector.vue"
43
44
  import EcsFormCheck from "./form-check/form-check.vue"
44
45
  import EcsFormGroup from "./form-group/form-group.vue"
45
46
  import EcsFormHeadline from "./form-headline/form-headline.vue"
@@ -152,6 +153,7 @@ const Components = {
152
153
  EcsFileList,
153
154
  EcsFileListItem,
154
155
  EcsFlag,
156
+ EcsFolderSelector,
155
157
  EcsFormCheck,
156
158
  EcsFormGroup,
157
159
  EcsInputSearch,
@@ -204,5 +204,10 @@
204
204
  right: -4px;
205
205
  }
206
206
  }
207
+
208
+ &::placeholder {
209
+ color: #858E9E;
210
+ opacity: 1;
211
+ }
207
212
  }
208
213
  </style>
@@ -1,10 +1,9 @@
1
1
  <template>
2
- <div :class="[isScrolledBottom ? 'scrolled-bottom' : '', isScrolledTop ? 'scrolled-top' : '']" ref="outerContainer" class="ecs-scroll-container">
3
- <div @scroll="onScroll" class="scrollbar scrollbar-sml" :style="{ maxHeight: height }">
4
- <div ref="innerContainer">
5
- <slot></slot>
6
- </div>
7
- </div>
2
+ <div class="ecs-scroll-container"
3
+ :style="{ maxHeight: height, padding: padding }"
4
+ :class="[borderless ? '' : 'ecs-scroll-container-border',
5
+ hideShadows ? '' : 'ecs-scroll-container-shadows']">
6
+ <slot></slot>
8
7
  </div>
9
8
  </template>
10
9
 
@@ -16,37 +15,21 @@
16
15
  height: {
17
16
  type: String,
18
17
  default: "300px"
19
- }
20
- },
21
-
22
- data() {
23
- return {
24
- isScrolledTop: true,
25
- isScrolledBottom: false
26
- }
27
- },
28
-
29
- mounted(){
30
- let innerHeight = this.$refs.innerContainer.clientHeight;
31
- let outerHeight = this.$refs.outerContainer.clientHeight;
32
-
33
- if ((innerHeight + 20) <= outerHeight){
34
- this.isScrolledBottom = true
35
- }
36
- },
37
-
38
- methods: {
39
- onScroll ({ target: { scrollTop, clientHeight, scrollHeight }}) {
40
- if (scrollTop + clientHeight >= scrollHeight) {
41
- this.isScrolledBottom = true
42
- } else {
43
- this.isScrolledBottom = false
44
- }
45
- if (scrollTop == 0) {
46
- this.isScrolledTop = true
47
- } else {
48
- this.isScrolledTop = false
49
- }
18
+ },
19
+ /** Hides the shadows at the top and bottom on scroll. */
20
+ hideShadows: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ /** Hides the outer border of the scroll container. */
25
+ borderless: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ /** Inner padding of the scroll container, in pixels. */
30
+ padding: {
31
+ type: String,
32
+ default: '8px'
50
33
  }
51
34
  }
52
35
  }
@@ -57,46 +40,25 @@
57
40
  @import "../mixins/svg-uri";
58
41
 
59
42
  .ecs-scroll-container{
60
- border-radius: 6px;
61
- border: 1px solid $gray-4;
62
43
  position: relative;
44
+ overflow: auto;
63
45
 
64
- >div{
65
- overflow: auto;
66
- padding: 10px;
67
- }
68
-
69
- &:before,
70
- &:after{
71
- content: "";
72
- pointer-events: none;
73
- position: absolute;
74
- height: 10px;
75
- width: 100%;
76
- opacity: 1;
77
- transition: .3s;
78
- }
79
-
80
- &:before{
81
- top: 0;
82
- left: 0;
83
- border-radius: 6px 6px 0 0;
84
- background-image: linear-gradient(180deg, rgba(53,63,82,0.07) 0%, rgba(53,63,82,0) 100%);
85
- }
86
-
87
- &:after{
88
- bottom: 0;
89
- left: 0;
90
- border-radius: 0 0 6px 6px;
91
- background-image: linear-gradient(180deg, rgba(53,63,82,0) 0%, rgba(53,63,82,0.07) 100%);
92
- }
46
+ &-shadows{
47
+ background:
48
+ linear-gradient(#FFF 30%, rgba(255, 255, 255, 0)),
49
+ linear-gradient(rgba(255, 255, 255, 0), #FFF 70%) 0 100%,
50
+ linear-gradient( 180deg,rgba(110, 116, 146, 0.07) 0%,rgba(110, 116, 146, 0) 100%),
51
+ linear-gradient(180deg,rgba(110, 116, 146, 0) 0%,rgba(110, 116, 146, 0.07) 100%) 0 100%;
93
52
 
94
- &.scrolled-top:before{
95
- opacity: 0;
53
+ background-color: #FFF;
54
+ background-repeat: no-repeat;
55
+ background-size: 100% 40px, 100% 40px, 100% 6px, 100% 6px;
56
+ background-attachment: local, local, scroll, scroll;
96
57
  }
97
58
 
98
- &.scrolled-bottom:after{
99
- opacity: 0;
59
+ &-border{
60
+ border-radius: 6px;
61
+ border: 1px solid $gray-4;
100
62
  }
101
63
  }
102
64
  </style>
@@ -0,0 +1,40 @@
1
+ import EcsFolderSelector from '@components/folder-selector/folder-selector';
2
+
3
+ export default {
4
+ title: 'Input/Folder Selector',
5
+ component: EcsFolderSelector
6
+ };
7
+
8
+ export const folderSelector = () => ({
9
+ components: { EcsFolderSelector },
10
+ methods: {
11
+ searchValue(value) {
12
+ console.log(value)
13
+ }
14
+ },
15
+ template: `<div style="height:400px">
16
+ <ecs-folder-selector framed searchable create @search="searchValue">
17
+ Folder Tree List Slot
18
+ </ecs-folder-selector>
19
+ </div>`,
20
+ });
21
+
22
+ export const folderSelectorWithoutBorder = () => ({
23
+ components: { EcsFolderSelector },
24
+ template: `<ecs-folder-selector searchable create height="300px">
25
+ Folder Tree List Slot
26
+ </ecs-folder-selector>`,
27
+ });
28
+
29
+ export const folderSelectorNoCreate = () => ({
30
+ components: { EcsFolderSelector },
31
+ template: `<ecs-folder-selector framed searchable height="300px">
32
+ Folder Tree List Slot
33
+ </ecs-folder-selector>`,
34
+ });
35
+
36
+ export const folderSelectorEmptySlot = () => ({
37
+ components: { EcsFolderSelector },
38
+ template: `<ecs-folder-selector framed searchable height="300px">
39
+ </ecs-folder-selector>`,
40
+ });
@@ -9,3 +9,13 @@ export const scrollContainer = () => ({
9
9
  components: { EcsScrollContainer },
10
10
  template: `<ecs-scroll-container><div style="height:400px">content</div></ecs-scroll-container>`,
11
11
  });
12
+
13
+ export const scrollContainerWithoutBorders = () => ({
14
+ components: { EcsScrollContainer },
15
+ template: `<ecs-scroll-container borderless><div style="height:400px">content</div></ecs-scroll-container>`,
16
+ });
17
+
18
+ export const scrollContainerWithoutShadows = () => ({
19
+ components: { EcsScrollContainer },
20
+ template: `<ecs-scroll-container hide-shadows><div style="height:400px">content</div></ecs-scroll-container>`,
21
+ });