@everchron/ec-shards 0.8.12 → 0.8.15

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.12",
3
+ "version": "0.8.15",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -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="M14.9878 16C15.5767 16.0021 16.1532 15.8311 16.6455 15.5081C17.1379 15.1851 17.5243 14.7244 17.7566 14.1835C17.9889 13.6426 18.0569 13.0453 17.9521 12.4661C17.8473 11.8868 17.5743 11.3512 17.1671 10.9258C16.76 10.5005 16.2366 10.2044 15.6623 10.0742C15.088 9.94409 14.488 9.98572 13.9372 10.1939C13.3864 10.4022 12.909 10.7678 12.5645 11.2452C12.2201 11.7227 12.0237 12.2909 12 12.8791" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path vector-effect="non-scaling-stroke" d="M21.9485 8.9485L18.8848 5.88483C18.4786 5.47848 17.9276 5.25012 17.353 5.25H9.58333C9.00869 5.25 8.45759 5.47827 8.05127 5.8846C7.64494 6.29093 7.41666 6.84203 7.41666 7.41667V22.5833C7.41666 23.158 7.64494 23.7091 8.05127 24.1154C8.45759 24.5217 9.00869 24.75 9.58333 24.75H20.4167C20.9913 24.75 21.5424 24.5217 21.9487 24.1154C22.3551 23.7091 22.5833 23.158 22.5833 22.5833V10.4803C22.5832 9.90574 22.3549 9.35473 21.9485 8.9485V8.9485Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <circle vector-effect="non-scaling-stroke" cx="15" cy="19.5" r="0.5" stroke="currentColor"/>
5
+ </svg>
@@ -0,0 +1,131 @@
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
+
95
+ &-header{
96
+ display: flex;
97
+ align-content: center;
98
+ padding-top: 4px;
99
+ padding-bottom: 4px;
100
+ margin-bottom: 4px;
101
+ padding-right: 2px;
102
+ }
103
+
104
+ &-search{
105
+ flex: 1;
106
+ }
107
+
108
+ &-add{
109
+ margin-left: 16px;
110
+ }
111
+
112
+ &-border{
113
+ border-radius: 6px;
114
+ border: 1px solid #D7DAE1;
115
+
116
+ .ecs-folder-selector-header{
117
+ padding-left: 8px;
118
+ padding-right: 8px;
119
+ margin: 0;
120
+ border-bottom: 1px solid #ECEDF2;
121
+ }
122
+ }
123
+
124
+ .empty-list{
125
+ padding: 8px 4px;
126
+ color: #858E9E;
127
+ font-size: 14px;
128
+ }
129
+ }
130
+ </style>
131
+
@@ -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
+ });