@everchron/ec-shards 0.8.36 → 0.9.2

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.36",
3
+ "version": "0.9.2",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -21,11 +21,12 @@
21
21
 
22
22
  <div class="ecs-pagination-dropdown">
23
23
  <span>Page</span>
24
- <div @click="showDropdown = !showDropdown" class="ecs-pagination-dropdown-button" :class="showDropdown ? `active` : ''">
25
- {{ currentPage }}
24
+ <div @click="toggleDropdown" class="ecs-pagination-dropdown-button" :class="[dropdownShown ? 'active' : '', totalPages ? '' : 'disabled']">
25
+ <template v-if="currentPage">{{ currentPage }}</template>
26
+ <template v-else>-</template>
26
27
 
27
28
  <transition name="dropdown">
28
- <div v-if="showDropdown" class="ecs-pagination-select scrollbar scrollbar-sml">
29
+ <div v-if="dropdownShown && totalPages" class="ecs-pagination-select scrollbar scrollbar-sml">
29
30
  <ecs-popover-list>
30
31
  <ecs-popover-list-item
31
32
  @click="$emit('update:page', n), hideDropdown"
@@ -38,7 +39,7 @@
38
39
  </div>
39
40
  </transition>
40
41
  </div>
41
- <span class="total">of {{ totalPages }}</span>
42
+ <span v-if="totalPages" class="total">of {{ totalPages }}</span>
42
43
  </div>
43
44
  </div>
44
45
  <div>
@@ -72,23 +73,26 @@
72
73
  },
73
74
  currentPage: {
74
75
  type: Number,
75
- required: true
76
76
  },
77
77
  totalPages: {
78
78
  type: Number,
79
- required: true
80
79
  }
81
80
  },
82
81
 
83
82
  data() {
84
83
  return {
85
- showDropdown: false
84
+ dropdownShown: false
86
85
  }
87
86
  },
88
87
 
89
88
  methods: {
89
+ toggleDropdown(){
90
+ if(this.totalPages)
91
+ this.dropdownShown = !this.dropdownShown
92
+ },
93
+
90
94
  hideDropdown(){
91
- showDropdown = false
95
+ this.dropdownShown = false
92
96
  }
93
97
  }
94
98
  }
@@ -146,10 +150,11 @@
146
150
  padding: 0 8px;
147
151
  height: 32px;
148
152
  transition: .2s;
149
- border-radius: 3px;
153
+ border-radius: 4px;
150
154
  margin: 0 6px;
151
155
  cursor: pointer;
152
156
  position: relative;
157
+ color: $gray-15;
153
158
 
154
159
  &:after{
155
160
  content: "";
@@ -169,6 +174,13 @@
169
174
  box-shadow: 0 1px 0 rgba($gray-2, .1) inset;
170
175
  background: rgba($gray-5, .1);
171
176
  }
177
+
178
+ &.disabled{
179
+ border: 1px solid $gray-3;
180
+ box-shadow: none;
181
+ cursor: not-allowed;
182
+ color: $gray-7;
183
+ }
172
184
  }
173
185
  }
174
186
 
@@ -180,7 +192,7 @@
180
192
  z-index: 1000;
181
193
  background-color: #fff;
182
194
  box-shadow: 0 0 0 1px rgba($gray-15, .08), 0 1px 3px 0 rgba($gray-15, 0.15);
183
- border-radius: 4px;
195
+ border-radius: 6px;
184
196
  max-height: 30vh;
185
197
  overflow: auto;
186
198
  }
@@ -1,17 +1,11 @@
1
1
  <template>
2
- <div class="ecs-party-entry"
3
- :class="[
4
- party,
5
- shared ? 'shared' : '',
6
- background ? 'ecs-party-entry-background' : '',
7
- annotationColor ? 'annotation' : ''
8
- ]"
9
- :style="annotationStyles">
2
+ <div class="ecs-party-entry" :class="[ party, shared ? 'shared' : '', (color && background) ? 'ecs-party-entry-colored' : '']" :style="{ color: color }">
10
3
  <ecs-icon v-if="icon && iconPosition == 'left'" :type="iconType" :color="iconColor" :style="'margin-right:'+iconSpacing" :width="iconSize" :height="iconSize" />
11
4
  <span>
12
5
  <slot></slot>
13
6
  </span>
14
7
  <ecs-icon v-if="icon && iconPosition == 'right'" :type="iconType" :color="iconColor" :style="'margin-left:'+iconSpacing" :width="iconSize" :height="iconSize" />
8
+ <div v-if="background" class="ecs-party-entry-background" />
15
9
  </div>
16
10
  </template>
17
11
 
@@ -49,10 +43,9 @@
49
43
  type: String,
50
44
  default: '30px'
51
45
  },
52
- annotationColor: {
53
- type: Number,
54
- default: null
55
- },
46
+ color: {
47
+ type: String
48
+ }
56
49
  },
57
50
 
58
51
  computed: {
@@ -71,84 +64,10 @@
71
64
  }
72
65
  },
73
66
 
74
- annotationBackgroundColor() {
75
- switch (this.annotationColor){
76
- case 1:
77
- return 'rgba(249, 223, 0, 0.2)'
78
- case 2:
79
- return 'rgba(243, 161, 0, 0.2)'
80
- case 3:
81
- return 'rgba(183, 234, 128, 0.2)'
82
- case 4:
83
- return 'rgba(72, 228, 194, 0.2)'
84
- case 5:
85
- return 'rgba(72, 157, 255, 0.2)'
86
- case 6:
87
- return 'rgba(184, 119, 240, 0.2)'
88
- case 7:
89
- return 'rgba(253, 120, 253, 0.2)'
90
- case 8:
91
- return 'rgba(197, 148, 101, 0.2)'
92
- case 9:
93
- return 'rgba(133, 142, 159, 0.2)'
94
- case 10:
95
- return 'rgba(238, 84, 82, 0.2)'
96
- case 11:
97
- return 'rgba(34, 127, 211, 0.2)'
98
- case 12:
99
- return 'rgba(93, 175, 0, 0.2)'
100
- case 13:
101
- return 'rgba(164, 146, 122, 0.2)'
102
- case 14:
103
- return 'rgba(149, 152, 156, 0.2)'
104
- case 15:
105
- return 'rgba(215, 139, 33, 0.2)'
106
- default:
107
- return 'rgba(17, 17, 17, 0.2)'
108
- }
109
- },
110
-
111
- annotationIconColor() {
112
- switch (this.annotationColor){
113
- case 1:
114
- return '#F9DF00'
115
- case 2:
116
- return '#F3A100'
117
- case 3:
118
- return '#B7EA80'
119
- case 4:
120
- return '#48E4C2'
121
- case 5:
122
- return '#489DFF'
123
- case 6:
124
- return '#B877F0'
125
- case 7:
126
- return '#FD78FD'
127
- case 8:
128
- return '#C59465'
129
- case 9:
130
- return '#858E9F'
131
- case 10:
132
- return '#EE5452'
133
- case 11:
134
- return '#227FD3'
135
- case 12:
136
- return '#5DAF00'
137
- case 13:
138
- return '#A4927A'
139
- case 14:
140
- return '#95989C'
141
- case 15:
142
- return '#D78B21'
143
- default:
144
- return '#111111'
145
- }
146
- },
147
-
148
67
  iconColor() {
149
- if (this.annotationColor){
150
- return this.annotationIconColor
151
- } else {
68
+ if (this.color){
69
+ return this.color
70
+ } else if(this.party) {
152
71
  switch (this.party){
153
72
  case 'client':
154
73
  return '#227FD3'
@@ -165,15 +84,8 @@
165
84
  default:
166
85
  return '#C1C2C4'
167
86
  }
168
- }
169
- },
170
-
171
- annotationStyles() {
172
- if (this.annotationColor){
173
- return {
174
- 'background-color': this.annotationBackgroundColor,
175
- 'color': this.annotationIconColor
176
- }
87
+ } else {
88
+ return '#000'
177
89
  }
178
90
  }
179
91
  }
@@ -188,16 +100,27 @@
188
100
  position: relative;
189
101
  display: inline-flex;
190
102
  align-items: center;
103
+ z-index: 0;
104
+ overflow: hidden;
191
105
 
192
- .icon{
193
- flex-shrink: 0;
106
+ &-colored{
107
+ .icon,
108
+ > span{
109
+ filter: brightness(.55) contrast(1.5);
110
+ }
194
111
  }
195
112
 
196
- &.annotation{
197
- > span,
198
- .icon{
199
- filter: brightness(65%);
200
- }
113
+ &-background{
114
+ position: absolute;
115
+ inset: 0;
116
+ z-index: -1;
117
+ background: currentColor;
118
+ opacity: .1;
119
+ filter: saturate(2);
120
+ }
121
+
122
+ .icon{
123
+ flex-shrink: 0;
201
124
  }
202
125
 
203
126
  &:after{
@@ -216,10 +139,6 @@
216
139
  opacity: 1;
217
140
  }
218
141
 
219
- &:not(.ecs-party-entry-background){
220
- background: transparent !important;
221
- }
222
-
223
142
  &.client{
224
143
  color: $party-client-text;
225
144
  }
@@ -243,31 +162,5 @@
243
162
  &.unaffiliated{
244
163
  color: $party-other-text;
245
164
  }
246
-
247
- &-background{
248
- &.client{
249
- background-color: $party-client-background;
250
- }
251
-
252
- &.opposing{
253
- background-color: $party-opposition-background;
254
- }
255
-
256
- &.joint{
257
- background-color: $party-joint-background;
258
- }
259
-
260
- &.other{
261
- background-color: $party-other-background;
262
- }
263
-
264
- &.court{
265
- background-color: $party-court-background;
266
- }
267
-
268
- &.unaffiliated{
269
- background-color: $party-other-background;
270
- }
271
- }
272
165
  }
273
166
  </style>
@@ -2,12 +2,12 @@
2
2
  <template>
3
3
  <div class="ecs-swatches" :class="sizeClass">
4
4
  <div
5
- v-for="item in swatches" :key="item.color"
6
- @click="selectedColor = item.color"
5
+ v-for="item in swatches" :key="item.id"
6
+ @click="selectedColor = item.hex"
7
7
  :title="item.title"
8
8
  class="ecs-swatches-color"
9
- :style="{backgroundColor: item.color, color: item.color}"
10
- :class="selectedColor == item.color ? 'active' : ''">
9
+ :style="{backgroundColor: item.hex, color: item.hex}"
10
+ :class="selectedColor == item.hex ? 'active' : ''">
11
11
  </div>
12
12
  </div>
13
13
  </template>
@@ -23,30 +23,17 @@
23
23
  },
24
24
  /** Sets the selected color value. Must be a HEX value that exists in the swatches (data) list. */
25
25
  selected: {
26
- type: String,
27
- validator: v => ['#F9DF00', '#F3A100', '#B7EA80', '#48E4C2', '#489DFF', '#B877F0', '#FD78FD', '#858E9F', '#227FD3', '#C59465', '#5DAF00', '#A4927A', '#95989C', '#D78B21', '#EE5452', 'null', null].includes(v)
26
+ type: String
27
+ },
28
+ /** The available color swatches the user can choose from. Array structure: contains Objects with `id`, `title`, `hex`. */
29
+ swatches: {
30
+ type: Array,
31
+ required: true
28
32
  }
29
33
  },
30
34
 
31
35
  data () {
32
36
  return {
33
- swatches: [
34
- { title: 'Yellow', color: '#F9DF00' },
35
- { title: 'Orange', color: '#F3A100' },
36
- { title: 'Lime', color: '#B7EA80' },
37
- { title: 'Cyan', color: '#48E4C2' },
38
- { title: 'Sky Blue', color: '#489DFF' },
39
- { title: 'Indigo', color: '#B877F0' },
40
- { title: 'Pink', color: '#FD78FD' },
41
- { title: 'Brown', color: '#C59465' },
42
- { title: 'Gray', color: '#858E9F' },
43
- { title: 'Red', color: '#EE5452' },
44
- { title: 'Dark Blue', color: '#227FD3' },
45
- { title: 'Green', color: '#5DAF00' },
46
- { title: 'Brass', color: '#A4927A' },
47
- { title: 'Silver', color: '#95989C' },
48
- { title: 'Gold', color: '#D78B21' }
49
- ],
50
37
  selectedColor: this.selected,
51
38
  selectedTitle: ''
52
39
  }
@@ -62,29 +49,22 @@
62
49
 
63
50
  methods: {
64
51
  emitSelected(){
65
- /** Returns the selected color value and title as Object.
66
- this.$emit('input', {
67
- color: this.selectedColor,
68
- title: this.selectedTitle
69
- })
70
- */
52
+ /** Returns the selected color value as HEX. */
71
53
  this.$emit('input', this.selectedColor)
72
54
  }
73
55
  },
74
56
 
75
- /*
76
- mounted () {
77
- if (this.selected)
78
- this.selectedTitle = this.swatches[this.swatches.findIndex(x => x.color === this.selectedColor)].title
79
- this.emitSelected()
80
- },
81
- */
82
-
83
57
  watch: {
84
58
  selectedColor(){
85
- this.selectedTitle = this.swatches[this.swatches.findIndex(x => x.color === this.selectedColor)].title
59
+ this.selectedTitle = this.swatches[this.swatches.findIndex(x => x.hex === this.selectedColor)].title
86
60
  this.emitSelected()
87
61
  }
62
+ },
63
+
64
+ mounted () {
65
+ if (this.selected)
66
+ this.selectedTitle = this.swatches[this.swatches.findIndex(x => x.hex === this.selectedColor)].title
67
+ this.emitSelected()
88
68
  }
89
69
  }
90
70
  </script>
@@ -49,14 +49,16 @@ export const partyEntryWithBackground = () => ({
49
49
  export const partyEntryAnnotations = () => ({
50
50
  components: { EcsPartyEntry },
51
51
  template: `<main>
52
- <ecs-party-entry background icon="marker" :annotation-color="1">Annotation</ecs-party-entry>
53
- <ecs-party-entry background icon="marker" :annotation-color="2">Annotation</ecs-party-entry>
54
- <ecs-party-entry background icon="marker" :annotation-color="3">Annotation</ecs-party-entry>
55
- <ecs-party-entry background icon="marker" :annotation-color="4">Annotation</ecs-party-entry>
56
- <ecs-party-entry background icon="marker" :annotation-color="5">Annotation</ecs-party-entry>
57
- <ecs-party-entry background icon="marker" :annotation-color="6">Annotation</ecs-party-entry>
58
- <ecs-party-entry background icon="marker" :annotation-color="7">Annotation</ecs-party-entry>
59
- <ecs-party-entry background icon="marker" :annotation-color="8">Annotation</ecs-party-entry>
60
- <ecs-party-entry background icon="marker" :annotation-color="9">Annotation</ecs-party-entry>
52
+ <ecs-party-entry background icon="marker" color="#F9DF00">Annotation</ecs-party-entry>
53
+ <ecs-party-entry background icon="marker" color="#F3A100">Annotation</ecs-party-entry>
54
+ <ecs-party-entry background icon="marker" color="#B7EA80">Annotation</ecs-party-entry>
55
+ <ecs-party-entry background icon="marker" color="#48E4C2">Annotation</ecs-party-entry>
56
+ <ecs-party-entry background icon="marker" color="#489DFF">Annotation</ecs-party-entry>
57
+ <ecs-party-entry background icon="marker" color="#B877F0">Annotation</ecs-party-entry>
58
+ <ecs-party-entry background icon="marker" color="#FD78FD">Annotation</ecs-party-entry>
59
+ <ecs-party-entry background icon="marker" color="#858E9F">Annotation</ecs-party-entry>
60
+ <ecs-party-entry background icon="marker" color="#EE5452">Annotation</ecs-party-entry>
61
+ <ecs-party-entry background icon="marker">No Color Defined</ecs-party-entry>
62
+ <ecs-party-entry icon="marker" color="#EE5452">Annotation</ecs-party-entry>
61
63
  </main>`,
62
64
  });
@@ -9,13 +9,90 @@ export const SwatchesPicker = () => ({
9
9
  components: { EcsSwatchesPicker },
10
10
  data() {
11
11
  return {
12
- selectedColor: ''
12
+ selectedColor: '',
13
+ swatchesData: [
14
+ {
15
+ "id": 1,
16
+ "title": "Yellow",
17
+ "hex": "#F9DF00"
18
+ },
19
+ {
20
+ "id": 2,
21
+ "title": "Orange",
22
+ "hex": "#F3A100"
23
+ },
24
+ {
25
+ "id": 3,
26
+ "title": "Lime",
27
+ "hex": "#B7EA80"
28
+ },
29
+ {
30
+ "id": 4,
31
+ "title": "Cyan",
32
+ "hex": "#48E4C2"
33
+ },
34
+ {
35
+ "id": 5,
36
+ "title": "Blue",
37
+ "hex": "#489DFF"
38
+ },
39
+ {
40
+ "id": 6,
41
+ "title": "Indigo",
42
+ "hex": "#B877F0"
43
+ },
44
+ {
45
+ "id": 7,
46
+ "title": "Pink",
47
+ "hex": "#FD78FD"
48
+ },
49
+ {
50
+ "id": 8,
51
+ "title": "Brown",
52
+ "hex": "#C59465"
53
+ },
54
+ {
55
+ "id": 9,
56
+ "title": "Grey",
57
+ "hex": "#858E9F"
58
+ },
59
+ {
60
+ "id": 10,
61
+ "title": "Red",
62
+ "hex": "#EE5452"
63
+ },
64
+ {
65
+ "id": 11,
66
+ "title": "Dark Blue",
67
+ "hex": "#227FD3"
68
+ },
69
+ {
70
+ "id": 12,
71
+ "title": "Green",
72
+ "hex": "#5DAF00"
73
+ },
74
+ {
75
+ "id": 13,
76
+ "title": "Brass",
77
+ "hex": "#A4927A"
78
+ },
79
+ {
80
+ "id": 14,
81
+ "title": "Silver",
82
+ "hex": "#95989C"
83
+ },
84
+ {
85
+ "id": 15,
86
+ "title": "Gold",
87
+ "hex": "#D78B21"
88
+ }
89
+ ]
13
90
  }
14
91
  },
15
92
  template: `<div>
16
- <ecs-swatches-picker v-model="selectedColor" selected="#F9DF00" />
93
+ <ecs-swatches-picker v-model="selectedColor" selected="#F9DF00" :swatches="swatchesData" />
17
94
  <hr style="border: none; border-bottom: 1px solid #DADEE6; margin: 20px 0">
18
- Selected: {{ selectedColor.title }}, {{ selectedColor.color }}
95
+ Selected: {{ selectedColor }}
19
96
  </div>`,
20
97
  });
21
98
 
@@ -23,12 +100,89 @@ export const SwatchesPickerSizes = () => ({
23
100
  components: { EcsSwatchesPicker },
24
101
  data() {
25
102
  return {
26
- selectedColor: ''
103
+ selectedColor: '',
104
+ swatchesData: [
105
+ {
106
+ "id": 1,
107
+ "title": "Yellow",
108
+ "hex": "#F9DF00"
109
+ },
110
+ {
111
+ "id": 2,
112
+ "title": "Orange",
113
+ "hex": "#F3A100"
114
+ },
115
+ {
116
+ "id": 3,
117
+ "title": "Lime",
118
+ "hex": "#B7EA80"
119
+ },
120
+ {
121
+ "id": 4,
122
+ "title": "Cyan",
123
+ "hex": "#48E4C2"
124
+ },
125
+ {
126
+ "id": 5,
127
+ "title": "Blue",
128
+ "hex": "#489DFF"
129
+ },
130
+ {
131
+ "id": 6,
132
+ "title": "Indigo",
133
+ "hex": "#B877F0"
134
+ },
135
+ {
136
+ "id": 7,
137
+ "title": "Pink",
138
+ "hex": "#FD78FD"
139
+ },
140
+ {
141
+ "id": 8,
142
+ "title": "Brown",
143
+ "hex": "#C59465"
144
+ },
145
+ {
146
+ "id": 9,
147
+ "title": "Grey",
148
+ "hex": "#858E9F"
149
+ },
150
+ {
151
+ "id": 10,
152
+ "title": "Red",
153
+ "hex": "#EE5452"
154
+ },
155
+ {
156
+ "id": 11,
157
+ "title": "Dark Blue",
158
+ "hex": "#227FD3"
159
+ },
160
+ {
161
+ "id": 12,
162
+ "title": "Green",
163
+ "hex": "#5DAF00"
164
+ },
165
+ {
166
+ "id": 13,
167
+ "title": "Brass",
168
+ "hex": "#A4927A"
169
+ },
170
+ {
171
+ "id": 14,
172
+ "title": "Silver",
173
+ "hex": "#95989C"
174
+ },
175
+ {
176
+ "id": 15,
177
+ "title": "Gold",
178
+ "hex": "#D78B21"
179
+ }
180
+ ]
27
181
  }
28
182
  },
29
183
  template: `<div>
30
- <ecs-swatches-picker v-model="selectedColor" size="sml" selected="#F9DF00" />
31
- <ecs-swatches-picker v-model="selectedColor" size="md" selected="#F9DF00" />
32
- <ecs-swatches-picker v-model="selectedColor" size="lg" selected="#F9DF00" />
184
+ <ecs-swatches-picker v-model="selectedColor" size="sml" :swatches="swatchesData" selected="#D78B21" />
185
+ <ecs-swatches-picker v-model="selectedColor" size="md" :swatches="swatchesData" selected="#F9DF00" />
186
+ <ecs-swatches-picker v-model="selectedColor" size="lg" :swatches="swatchesData" selected="#F9DF00" />
33
187
  </div>`,
34
188
  });