@everchron/ec-shards 1.3.7 → 2.0.0

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": "1.3.7",
3
+ "version": "2.0.0",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -1,30 +1,26 @@
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
 
18
12
  <script>
19
13
  import EcsIcon from '../icon/icon'
14
+
20
15
  export default {
21
16
  components: { EcsIcon },
17
+
22
18
  props: {
23
19
  /** Adds an icon to the party entry. The list of available icon names can be found [here](https://github.com/everchron/ec-shards/tree/main/src/assets/icons). */
24
20
  icon: {
25
21
  type: String
26
22
  },
27
- /** If the party entry tag should be represented by the default party side colors, set this party prop. */
23
+ /** If the party entry tag should be using the default party side colors, set this party prop. Do not use in combination with the `color` prop. */
28
24
  party: {
29
25
  type: String,
30
26
  validator: v => ['client', 'opposing', 'joint', 'other', 'court', 'unaffiliated'].includes(v)
@@ -54,13 +50,13 @@
54
50
  type: String,
55
51
  default: '30px'
56
52
  },
57
- annotationColor: {
58
- type: Number,
59
- default: null
60
- },
53
+ /** Sets a custom color. Should be a HEX, RGB or HSL value. No alpha channels. */
54
+ color: {
55
+ type: String
56
+ }
61
57
  },
62
58
 
63
- computed: {
59
+ computed: {
64
60
  iconType() {
65
61
  switch (this.icon){
66
62
  case 'sequence':
@@ -76,84 +72,10 @@ computed: {
76
72
  }
77
73
  },
78
74
 
79
- annotationBackgroundColor() {
80
- switch (this.annotationColor){
81
- case 1:
82
- return 'rgba(249, 223, 0, 0.2)'
83
- case 2:
84
- return 'rgba(243, 161, 0, 0.2)'
85
- case 3:
86
- return 'rgba(183, 234, 128, 0.2)'
87
- case 4:
88
- return 'rgba(72, 228, 194, 0.2)'
89
- case 5:
90
- return 'rgba(72, 157, 255, 0.2)'
91
- case 6:
92
- return 'rgba(184, 119, 240, 0.2)'
93
- case 7:
94
- return 'rgba(253, 120, 253, 0.2)'
95
- case 8:
96
- return 'rgba(197, 148, 101, 0.2)'
97
- case 9:
98
- return 'rgba(133, 142, 159, 0.2)'
99
- case 10:
100
- return 'rgba(238, 84, 82, 0.2)'
101
- case 11:
102
- return 'rgba(34, 127, 211, 0.2)'
103
- case 12:
104
- return 'rgba(93, 175, 0, 0.2)'
105
- case 13:
106
- return 'rgba(164, 146, 122, 0.2)'
107
- case 14:
108
- return 'rgba(149, 152, 156, 0.2)'
109
- case 15:
110
- return 'rgba(215, 139, 33, 0.2)'
111
- default:
112
- return 'rgba(17, 17, 17, 0.2)'
113
- }
114
- },
115
-
116
- annotationIconColor() {
117
- switch (this.annotationColor){
118
- case 1:
119
- return '#F9DF00'
120
- case 2:
121
- return '#F3A100'
122
- case 3:
123
- return '#B7EA80'
124
- case 4:
125
- return '#48E4C2'
126
- case 5:
127
- return '#489DFF'
128
- case 6:
129
- return '#B877F0'
130
- case 7:
131
- return '#FD78FD'
132
- case 8:
133
- return '#C59465'
134
- case 9:
135
- return '#858E9F'
136
- case 10:
137
- return '#EE5452'
138
- case 11:
139
- return '#227FD3'
140
- case 12:
141
- return '#5DAF00'
142
- case 13:
143
- return '#A4927A'
144
- case 14:
145
- return '#95989C'
146
- case 15:
147
- return '#D78B21'
148
- default:
149
- return '#111111'
150
- }
151
- },
152
-
153
75
  iconColor() {
154
- if (this.annotationColor){
155
- return this.annotationIconColor
156
- } else {
76
+ if (this.color){
77
+ return this.color
78
+ } else if(this.party) {
157
79
  switch (this.party){
158
80
  case 'client':
159
81
  return '#227FD3'
@@ -170,15 +92,8 @@ annotationBackgroundColor() {
170
92
  default:
171
93
  return '#C1C2C4'
172
94
  }
173
- }
174
- },
175
-
176
- annotationStyles() {
177
- if (this.annotationColor){
178
- return {
179
- 'background-color': this.annotationBackgroundColor,
180
- 'color': this.annotationIconColor
181
- }
95
+ } else {
96
+ return '#000'
182
97
  }
183
98
  }
184
99
  }
@@ -188,20 +103,32 @@ annotationBackgroundColor() {
188
103
  <style lang="scss" scoped>
189
104
  @import "../../tokens/build/scss/tokens.scss";
190
105
  @import "../mixins/svg-uri";
106
+
191
107
  .ecs-party-entry{
192
108
  position: relative;
193
109
  display: inline-flex;
194
110
  align-items: center;
111
+ z-index: 0;
112
+ overflow: hidden;
195
113
 
196
- .icon{
197
- flex-shrink: 0;
114
+ &-colored{
115
+ .icon,
116
+ > span{
117
+ filter: brightness(.55) contrast(1.5);
118
+ }
198
119
  }
199
120
 
200
- &.annotation{
201
- > span,
202
- .icon{
203
- filter: brightness(65%);
204
- }
121
+ &-background{
122
+ position: absolute;
123
+ inset: 0;
124
+ z-index: -1;
125
+ background: currentColor;
126
+ opacity: .1;
127
+ filter: saturate(2);
128
+ }
129
+
130
+ .icon{
131
+ flex-shrink: 0;
205
132
  }
206
133
 
207
134
  &:after{
@@ -220,10 +147,6 @@ annotationBackgroundColor() {
220
147
  opacity: 1;
221
148
  }
222
149
 
223
- &:not(.ecs-party-entry-background){
224
- background: transparent !important;
225
- }
226
-
227
150
  &.client{
228
151
  color: $color-party-client-content;
229
152
  }
@@ -247,31 +170,5 @@ annotationBackgroundColor() {
247
170
  &.unaffiliated{
248
171
  color: $color-party-other-content;
249
172
  }
250
-
251
- &-background{
252
- &.client{
253
- background-color: $color-party-client-background;
254
- }
255
-
256
- &.opposing{
257
- background-color: $color-party-opposing-background;
258
- }
259
-
260
- &.joint{
261
- background-color: $color-party-joint-background;
262
- }
263
-
264
- &.other{
265
- background-color: $color-party-other-background;
266
- }
267
-
268
- &.court{
269
- background-color: $color-party-court-background;
270
- }
271
-
272
- &.unaffiliated{
273
- background-color: $color-party-other-background;
274
- }
275
- }
276
173
  }
277
174
  </style>
@@ -6,6 +6,13 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 2.0.0 (2 September 2022)
10
+
11
+ ### Breaking Changes
12
+
13
+ - Refactored the EcsPartyEntry component to accept custom color values. Deprecated the old annotation color classes.
14
+
15
+
9
16
  ## Version 1.3.6 (29 August 2022)
10
17
 
11
18
  ### Fixes