@everchron/ec-shards 2.0.1 → 2.0.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": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -24,7 +24,7 @@
24
24
  </template>
25
25
 
26
26
  <template v-else-if="type === 'switch'">
27
- <ecs-switch @input="$emit('toggle', $event)" :value="valueToggle" :disabled="value == false" size="sml">{{label}}</ecs-switch>
27
+ <ecs-switch @input="$emit('toggle', $event)" :value="valueToggle" :disabled="value == false" size="sml-toggle" colored>{{label}}</ecs-switch>
28
28
  </template>
29
29
 
30
30
  <template v-else>
@@ -3,8 +3,10 @@
3
3
  <label class="ecs-switch"
4
4
  :class="[
5
5
  sizeClass,
6
- hasDefaultSlot ? `ecs-switch-has-label` : '',
7
- disabled ? `disabled` : ''
6
+ hasDefaultSlot ? 'ecs-switch-has-label' : '',
7
+ disabled ? 'disabled' : '',
8
+ colored ? 'ecs-switch-colored' : '',
9
+ indeterminate ? 'ecs-switch-indeterminate' : ''
8
10
  ]">
9
11
  <input
10
12
  type="checkbox"
@@ -15,7 +17,9 @@
15
17
  :disabled="disabled"
16
18
  :checked="checked"
17
19
  @change="handleClick">
18
- <div class="ecs-slide-switch"></div>
20
+ <div class="ecs-slide-switch">
21
+ <div class="indeterminate" />
22
+ </div>
19
23
  </label>
20
24
  <label v-if="hasDefaultSlot" :for="id">
21
25
  <slot></slot>
@@ -30,10 +34,10 @@
30
34
  name: {
31
35
  type: String
32
36
  },
33
- /** Determines the size of the switch. */
37
+ /** Determines the size of the switch. `sml-toggle` sets the toggle control size to small, but maintains a regular font size. */
34
38
  size: {
35
39
  type: String,
36
- validator: v => ['sml', 'lg', 'null', null].includes(v)
40
+ validator: v => ['sml', 'sml-toggle', 'lg', 'md', 'null', null].includes(v)
37
41
  },
38
42
  /** Sets the switch to required. */
39
43
  required: {
@@ -45,6 +49,16 @@
45
49
  type: Boolean,
46
50
  default: false
47
51
  },
52
+ /** Reflects a true or false state with positive (green) and negative (red) colors. */
53
+ colored: {
54
+ type: Boolean,
55
+ default: false
56
+ },
57
+ /** Reflects an indeterminate switch state (e.g. not all options checked, but some). This is a purely visual setting. */
58
+ indeterminate: {
59
+ type: Boolean,
60
+ default: false
61
+ },
48
62
  value: {
49
63
  default: false,
50
64
  required: false,
@@ -81,7 +95,11 @@
81
95
 
82
96
  sizeClass() {
83
97
  if (this.size && this.size !== '')
84
- return `ecs-switch-${this.size}`
98
+ if (this.size == 'sml-toggle'){
99
+ return `ecs-switch-sml regular-font`
100
+ } else {
101
+ return `ecs-switch-${this.size}`
102
+ }
85
103
  return this.size
86
104
  },
87
105
 
@@ -143,14 +161,24 @@
143
161
  align-items: center;
144
162
  }
145
163
 
146
- &.disabled{
147
- opacity: .5;
148
- }
149
-
150
164
  input[type=checkbox] {
151
165
  display:none;
152
166
  }
153
167
 
168
+ .indeterminate{
169
+ width: 9px;
170
+ height: 4px;
171
+ border-radius: 2px;
172
+ position: absolute;
173
+ top: 50%;
174
+ left: 5px;
175
+ margin-top: -2px;
176
+ background: #FFF;
177
+ transition: .3s .15s;
178
+ transform: scale(.5);
179
+ opacity: 0;
180
+ }
181
+
154
182
  &-has-label{
155
183
  margin: $spacing-5 $spacing-15 $spacing-5 0;
156
184
 
@@ -158,9 +186,10 @@
158
186
  margin: $spacing-5 0;
159
187
  line-height: $spacing-30;
160
188
  font-size: $type-scale-3-font-size;
161
- line-height: $type-scale-3-line-height;
189
+ line-height: $type-scale-3-line-height;
162
190
  display: flex;
163
191
  align-items: center;
192
+ user-select: none;
164
193
  }
165
194
  }
166
195
 
@@ -178,6 +207,13 @@
178
207
  width: 10px;
179
208
  height: 10px;
180
209
  }
210
+
211
+ .indeterminate{
212
+ width: 4px;
213
+ height: 2px;
214
+ left: 3px;
215
+ margin-top: -1px;
216
+ }
181
217
  }
182
218
 
183
219
  input:checked + .ecs-slide-switch::after{
@@ -192,6 +228,15 @@
192
228
  line-height: $type-scale-2-line-height;
193
229
  }
194
230
  }
231
+
232
+ &.regular-font.ecs-switch-has-label{
233
+ margin: $spacing-5 $spacing-10 $spacing-5 0;
234
+
235
+ + label{
236
+ font-size: $type-scale-3-font-size;
237
+ line-height: $type-scale-2-line-height;
238
+ }
239
+ }
195
240
  }
196
241
 
197
242
  &-lg{
@@ -208,6 +253,11 @@
208
253
  width: 28px;
209
254
  height: 28px;
210
255
  }
256
+
257
+ .indeterminate{
258
+ width: 11px;
259
+ left: 6px;
260
+ }
211
261
  }
212
262
 
213
263
  input:checked + .ecs-slide-switch::after{
@@ -275,4 +325,45 @@
275
325
  }
276
326
  }
277
327
  }
328
+
329
+ // Colored theme
330
+ .ecs-switch-colored{
331
+ .ecs-slide-switch{
332
+ &:before{
333
+ border-color: $color-red-9;
334
+ background: $color-red-8;
335
+ }
336
+ }
337
+
338
+ input:checked + .ecs-slide-switch{
339
+ background-color: $color-green-8;
340
+ }
341
+ }
342
+
343
+ .ecs-switch-indeterminate{
344
+ input:checked + .ecs-slide-switch{
345
+ .indeterminate{
346
+ transform: scale(1);
347
+ opacity: 1;
348
+ }
349
+ }
350
+ }
351
+
352
+ //Disabled state
353
+ .ecs-switch.disabled{
354
+ opacity: .5;
355
+
356
+ .ecs-slide-switch{
357
+ cursor: not-allowed;
358
+
359
+ &:before{
360
+ border-color: $color-gray-5;
361
+ background: $color-gray-4;
362
+ }
363
+ }
364
+
365
+ input:checked + .ecs-slide-switch{
366
+ background-color: $color-gray-8;
367
+ }
368
+ }
278
369
  </style>
@@ -6,16 +6,34 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
- ## Version 2.0.1 (13 September 2022)
9
+ ## Version 2.0.2 (22 September 2022)
10
10
 
11
11
  ### Breaking Changes
12
12
 
13
13
  - Refactored the EcsPartyEntry component to accept custom color values. Deprecated the old annotation color classes.
14
+ - Refactored EcsSwatchesPicker. Now accepts all color values as a prop and does not handle color management within the component.
14
15
 
15
16
  ### Fixes
16
17
 
17
18
  - Unscoped content styles for `EcsDataListItem`
18
19
 
20
+ ## Version 1.6.4 (15 September 2022)
21
+
22
+ ### Features
23
+
24
+ - Added new props and functionality to `EcsSwitch` component
25
+ - `indeterminate`: sets the switch to indeterminate state (only visually)
26
+ - `colored`: alters the switch colors to red/green
27
+ - `size="sml-toggle"`: shows the switch toggle in small, but it's label in a regular size
28
+ - improved disabled styles
29
+ - `EcsQuicklink` now uses the new colored switch theme for quicklinks that contain a switch.
30
+
31
+ ## Version 1.6.1 (13 September 2022)
32
+
33
+ ### Fixes
34
+
35
+ - Unscoped content styles of `EcsDataListItem` to allow more dynamic content injeciton.
36
+
19
37
  ## Version 1.6.0 (13 September 2022)
20
38
 
21
39
  ### Features
@@ -27,5 +27,10 @@ export const quicklinkFavorability = () => ({
27
27
 
28
28
  export const quicklinkThreeWaySwitch = () => ({
29
29
  components: { EcsQuicklink },
30
- template: `<ecs-quicklink type="switch" label="Filter" :value="true" :valueToggle="true" :count="12" />`,
30
+ data() {
31
+ return {
32
+ value: false,
33
+ }
34
+ },
35
+ template: `<ecs-quicklink @input="value = !value" :active="value" type="switch" label="Filter" :value="value" :valueToggle="true" :count="12" />`,
31
36
  });
@@ -9,90 +9,13 @@ export const SwatchesPicker = () => ({
9
9
  components: { EcsSwatchesPicker },
10
10
  data() {
11
11
  return {
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
- ]
12
+ selectedColor: ''
90
13
  }
91
14
  },
92
15
  template: `<div>
93
- <ecs-swatches-picker v-model="selectedColor" selected="#F9DF00" :swatches="swatchesData" />
16
+ <ecs-swatches-picker v-model="selectedColor" selected="#F9DF00" />
94
17
  <hr style="border: none; border-bottom: 1px solid #DADEE6; margin: 20px 0">
95
- Selected: {{ selectedColor }}
18
+ Selected: {{ selectedColor.title }}, {{ selectedColor.color }}
96
19
  </div>`,
97
20
  });
98
21
 
@@ -100,89 +23,12 @@ export const SwatchesPickerSizes = () => ({
100
23
  components: { EcsSwatchesPicker },
101
24
  data() {
102
25
  return {
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
- ]
26
+ selectedColor: ''
181
27
  }
182
28
  },
183
29
  template: `<div>
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" />
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" />
187
33
  </div>`,
188
34
  });
@@ -15,7 +15,7 @@ export const regular = () => ({
15
15
  },
16
16
  template: `<div>
17
17
  <ecs-switch v-model="first">{{ first }}</ecs-switch>
18
- <ecs-switch v-model="second" disabled>{{ second }}</ecs-switch>
18
+ <ecs-switch v-model="second">{{ second }}</ecs-switch>
19
19
  </div>`,
20
20
  });
21
21
 
@@ -23,6 +23,7 @@ export const sizes = () => ({
23
23
  components: { EcsSwitch },
24
24
  template: `<div>
25
25
  <ecs-switch size="sml">Small</ecs-switch>
26
+ <ecs-switch size="sml-toggle">Small Toggle</ecs-switch>
26
27
  <ecs-switch>Default</ecs-switch>
27
28
  <ecs-switch size="lg">Large</ecs-switch>
28
29
  </div>`,
@@ -32,3 +33,22 @@ export const standalone = () => ({
32
33
  components: { EcsSwitch },
33
34
  template: `<ecs-switch standalone />`,
34
35
  });
36
+
37
+ export const indeterminateSwitch = () => ({
38
+ components: { EcsSwitch },
39
+ template: `<div>
40
+ <ecs-switch indeterminate size="sml">Small</ecs-switch>
41
+ <ecs-switch indeterminate>Default</ecs-switch>
42
+ <ecs-switch indeterminate size="lg">Large</ecs-switch>
43
+ </div>`,
44
+ });
45
+
46
+ export const coloredSwitch = () => ({
47
+ components: { EcsSwitch },
48
+ data() {
49
+ return {
50
+ first: false
51
+ }
52
+ },
53
+ template: `<ecs-switch colored v-model="first">Colored Switch</ecs-switch>`,
54
+ });