@everchron/ec-shards 0.8.10 → 0.8.13

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.10",
3
+ "version": "0.8.13",
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>
@@ -3,11 +3,11 @@
3
3
  <div class="ecs-swatches" :class="sizeClass">
4
4
  <div
5
5
  v-for="item in swatches" :key="item.color"
6
- @click="() => setColor(item)"
6
+ @click="selectedColor = item.color"
7
7
  :title="item.title"
8
8
  class="ecs-swatches-color"
9
9
  :style="{backgroundColor: item.color, color: item.color}"
10
- :class="selectedColor[0].color == item.color ? 'active' : ''">
10
+ :class="selectedColor == item.color ? 'active' : ''">
11
11
  </div>
12
12
  </div>
13
13
  </template>
@@ -24,24 +24,7 @@
24
24
  /** Sets the selected color value. Must be a HEX value that exists in the swatches (data) list. */
25
25
  selected: {
26
26
  type: String,
27
- validator: v => [
28
- '#F9DF00',
29
- '#F3A100',
30
- '#B7EA80',
31
- '#48E4C2',
32
- '#489DFF',
33
- '#B877F0',
34
- '#FD78FD',
35
- '#C59465',
36
- '#858E9F',
37
- '#227FD3',
38
- '#5DAF00',
39
- '#A4927A',
40
- '#95989C',
41
- '#D78B21',
42
- 'null',
43
- null
44
- ].includes(v)
27
+ validator: v => ['#F9DF00', '#F3A100', '#B7EA80', '#48E4C2', '#489DFF', '#B877F0', '#FD78FD', '#C59465', '#858E9F', '#227FD3', '#5DAF00', '#A4927A', '#95989C', '#D78B21', '#EE5452', 'null', null].includes(v)
45
28
  }
46
29
  },
47
30
 
@@ -55,6 +38,7 @@
55
38
  { title: 'Blue', color: '#489DFF' },
56
39
  { title: 'Indigo', color: '#B877F0' },
57
40
  { title: 'Pink', color: '#FD78FD' },
41
+ { title: 'Red', color: '#EE5452' },
58
42
  { title: 'Brown', color: '#C59465' },
59
43
  { title: 'Grey', color: '#858E9F' },
60
44
  { title: 'Dark Blue', color: '#227FD3' },
@@ -63,9 +47,8 @@
63
47
  { title: 'Silver', color: '#95989C' },
64
48
  { title: 'Gold', color: '#D78B21' },
65
49
  ],
66
- selectedColor: [
67
- { title: '', color: this.selected }
68
- ]
50
+ selectedColor: this.selected,
51
+ selectedTitle: ''
69
52
  }
70
53
  },
71
54
 
@@ -75,29 +58,28 @@
75
58
  return `ecs-swatches-${this.size}`
76
59
  return this.size
77
60
  },
78
-
79
- selectedTitleIndex() {
80
- return this.swatches.findIndex(x => x.color === this.selected)
81
- }
82
61
  },
83
62
 
84
63
  methods: {
85
- setColor(item){
86
- this.selectedColor.splice(0)
87
- this.selectedColor.push(item)
64
+ emitSelected(){
65
+ /** Returns the selected color value and title as Object. */
66
+ this.$emit('input', {
67
+ color: this.selectedColor,
68
+ title: this.selectedTitle
69
+ })
88
70
  }
89
71
  },
90
72
 
91
- mounted () {
92
- if(this.selected)
93
- this.selectedColor[0].title = this.swatches[this.selectedTitleIndex].title
94
- this.$emit('input', this.selectedColor)
95
- },
73
+ mounted () {
74
+ if(this.selected)
75
+ this.selectedTitle = this.swatches[this.swatches.findIndex(x => x.color === this.selectedColor)].title
76
+ this.emitSelected()
77
+ },
96
78
 
97
79
  watch: {
98
80
  selectedColor(){
99
- /** Returns the selected color value as an array including the name and color. */
100
- this.$emit('input', this.selectedColor)
81
+ this.selectedTitle = this.swatches[this.swatches.findIndex(x => x.color === this.selectedColor)].title
82
+ this.emitSelected()
101
83
  },
102
84
  }
103
85
  }
@@ -9,13 +9,13 @@ export const SwatchesPicker = () => ({
9
9
  components: { EcsSwatchesPicker },
10
10
  data() {
11
11
  return {
12
- selectedColor: [{ title: '', color: '#489DFF'}]
12
+ selectedColor: ''
13
13
  }
14
14
  },
15
15
  template: `<div>
16
- <ecs-swatches-picker v-model="selectedColor" :selected="selectedColor[0].color" />
16
+ <ecs-swatches-picker v-model="selectedColor" selected="#F9DF00" />
17
17
  <hr style="border: none; border-bottom: 1px solid #DADEE6; margin: 20px 0">
18
- {{ selectedColor[0].title }} {{ selectedColor[0].color }}
18
+ Selected: {{ selectedColor.title }}, {{ selectedColor.color }}
19
19
  </div>`,
20
20
  });
21
21
 
@@ -23,7 +23,7 @@ export const SwatchesPickerSizes = () => ({
23
23
  components: { EcsSwatchesPicker },
24
24
  data() {
25
25
  return {
26
- selectedColor: [{ title: '', color: '#F9DF00' }]
26
+ selectedColor: ''
27
27
  }
28
28
  },
29
29
  template: `<div>