@everchron/ec-shards 2.0.7 → 2.1.1

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.7",
3
+ "version": "2.1.1",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -21,15 +21,17 @@
21
21
  :for="id || _uid">
22
22
 
23
23
  <slot />
24
+ <ecs-text v-if="$slots.default && help" type="form">{{ help }}</ecs-text>
24
25
  </label>
25
26
  </ecs-form-check>
26
27
  </template>
27
28
 
28
29
  <script>
29
30
  import EcsFormCheck from '../form-check/form-check'
31
+ import EcsText from '../text/text'
30
32
 
31
33
  export default {
32
- components: { EcsFormCheck },
34
+ components: { EcsFormCheck, EcsText },
33
35
  props: {
34
36
  /** Name attribute of the input. */
35
37
  name: {
@@ -71,7 +73,11 @@
71
73
  default: false
72
74
  },
73
75
  /** Unique ID */
74
- id: [String, Number]
76
+ id: [String, Number],
77
+ /** Help text that appears underneath (or next to, for inline checkboxes) the label. */
78
+ help: {
79
+ type: String
80
+ }
75
81
  },
76
82
 
77
83
  data() {
@@ -145,7 +151,8 @@
145
151
  width: 18px;
146
152
  height: 18px;
147
153
  left: 0;
148
- top: 0;
154
+ top: 50%;
155
+ margin-top: -9px;
149
156
  background: svg-uri('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><polyline fill="none" stroke="#{$color-blue-10}" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.7" points="6 9.259 8.347 11.998 12 6"/></svg>');
150
157
  }
151
158
 
@@ -157,7 +164,8 @@
157
164
  height: 2px;
158
165
  border-radius: 1px;
159
166
  left: 5px;
160
- top: 8px;
167
+ top: 50%;
168
+ margin-top: -1px;
161
169
  }
162
170
 
163
171
  &[type="checkbox"].indeterminate + label:before{
@@ -165,4 +173,13 @@
165
173
  border-color: rgba($color-blue-10, .3);
166
174
  }
167
175
  }
176
+
177
+ .ecs-text{
178
+ min-width: 100%;
179
+ }
180
+
181
+ .ecs-form-check-inline .ecs-text{
182
+ min-width: auto;
183
+ margin-left: $spacing-10;
184
+ }
168
185
  </style>
@@ -32,7 +32,7 @@
32
32
  .ecs-form-check {
33
33
  position: relative;
34
34
  display: block;
35
- height: 18px;
35
+ min-height: 18px;
36
36
  margin-bottom: $spacing-25;
37
37
 
38
38
  &.stand-alone{
@@ -49,6 +49,10 @@
49
49
  &-inline{
50
50
  display: inline-block;
51
51
  margin-right: 30px;
52
+
53
+ .ecs-form-check-label{
54
+ display: inline-flex;
55
+ }
52
56
  }
53
57
 
54
58
  &.disabled {
@@ -72,10 +76,11 @@
72
76
 
73
77
  .ecs-form-check-label {
74
78
  min-width: 18px;
75
- height: 18px;
79
+ min-height: 18px;
76
80
  margin-bottom: 0;
77
81
  padding-left: 30px;
78
- display: inline-flex;
82
+ display: flex;
83
+ flex-wrap: wrap;
79
84
  align-items: center;
80
85
  }
81
86
 
@@ -95,7 +100,8 @@
95
100
  vertical-align: text-top;
96
101
  position: absolute;
97
102
  left: 0;
98
- top: 0;
103
+ top: 50%;
104
+ margin-top: -9px;
99
105
  width: 18px;
100
106
  height: 18px;
101
107
  background: white;
@@ -126,7 +132,7 @@
126
132
  label{
127
133
  display: inline-block;
128
134
  font-size: $type-scale-3-font-size;
129
- line-height: 18px;
135
+ line-height: $type-scale-3-line-height;
130
136
  margin-bottom: $spacing-10;
131
137
  -webkit-user-select: none;
132
138
  -moz-user-select: none;
@@ -4,24 +4,29 @@
4
4
  <ecs-checkbox @input="$emit('input', $event)" :disabled="disabled" :value="value" :value-false="valueFalse" :value-true="valueTrue" :indeterminate="indeterminate">
5
5
  <slot></slot>
6
6
  </ecs-checkbox>
7
+ <span v-if="suffix" class="after">{{suffix}}</span>
7
8
  </div>
8
9
 
9
10
  <div v-else-if="type === 'radiobutton'" class="ecs-popover-list-item control no-hover">
10
11
  <ecs-radiobutton @change="$emit('change', $event)" :disabled="disabled" :checked="value">
11
12
  <slot></slot>
12
13
  </ecs-radiobutton>
14
+ <span v-if="suffix" class="after">{{suffix}}</span>
13
15
  </div>
14
16
 
15
17
  <div v-else-if="type === 'switch'" class="ecs-popover-list-item control no-hover">
16
18
  <ecs-switch @input="$emit('input', $event)" :value="value" :value-false="valueFalse" :value-true="valueTrue" size="sml-toggle" :disabled="disabled">
17
19
  <slot></slot>
20
+ <span v-if="help" class="help">{{help}}</span>
18
21
  </ecs-switch>
22
+ <span v-if="suffix" class="after">{{suffix}}</span>
19
23
  </div>
20
24
 
21
25
  <div v-else-if="type === 'sort'" @click="$emit('click', $event)" class="ecs-popover-list-item control no-hover">
22
26
  <ecs-sortbutton :sort="sort" :disabled="disabled">
23
27
  <slot></slot>
24
28
  </ecs-sortbutton>
29
+ <span v-if="suffix" class="after">{{suffix}}</span>
25
30
  </div>
26
31
 
27
32
  <a v-else-if="type === 'link'" @click="$emit('click', $event)" class="ecs-popover-list-item"
@@ -41,21 +46,6 @@
41
46
  <ecs-icon v-if="hoverIcon" :type="hoverIcon" class="hover-icon" />
42
47
  </a>
43
48
 
44
- <button v-else-if="type === 'color'"
45
- class="ecs-popover-list-item"
46
- :class="[disabled ? `disabled` : '',
47
- noHover ? `no-hover` : '',
48
- color ? `has-color` : '',
49
- selected ? `selected` : '']"
50
- @click="$emit('click', $event)">
51
-
52
- <div class="ecs-popover-list-item-color" :style="{ backgroundColor: color }" />
53
- <slot></slot>
54
- <span v-if="suffix" class="after">{{suffix}}</span>
55
- <span v-if="help" class="help">{{help}}</span>
56
- <ecs-icon v-if="hoverIcon" :type="hoverIcon" class="hover-icon" />
57
- </button>
58
-
59
49
  <button v-else class="ecs-popover-list-item"
60
50
  :class="[iconClass,
61
51
  danger ? `danger` : '',
@@ -90,7 +80,7 @@
90
80
  /** Determines the type of popover list item.*/
91
81
  type: {
92
82
  type: String,
93
- validator: v => ['icon', 'checkbox', 'radiobutton', 'switch', 'sort', 'color', 'link', null].includes(v),
83
+ validator: v => ['icon', 'checkbox', 'radiobutton', 'switch', 'sort', 'link', null].includes(v),
94
84
  default: null
95
85
  },
96
86
  /** Adds a subtle suffix text to the right side of the list item. Should be very short. */
@@ -108,11 +98,6 @@
108
98
  type: String,
109
99
  default: null
110
100
  },
111
- /** The color value (HEX, or RGB), if the list item is type `color`. */
112
- color: {
113
- type: String,
114
- default: null
115
- },
116
101
  /** Adds a file icon. Should never be used together with `icon`. */
117
102
  fileIcon: {
118
103
  type: String,
@@ -195,6 +180,19 @@
195
180
  }
196
181
  </script>
197
182
 
183
+ <style lang="scss">
184
+ .ecs-popover-list-item{
185
+ .ecs-switch-has-label + label{
186
+ flex-wrap: wrap;
187
+ flex: 1;
188
+
189
+ .help{
190
+ min-width: 100%;
191
+ }
192
+ }
193
+ }
194
+ </style>
195
+
198
196
  <style lang="scss" scoped>
199
197
  @import "../../tokens/build/scss/tokens.scss";
200
198
  @import "../mixins/svg-uri";
@@ -260,10 +258,6 @@
260
258
  }
261
259
  }
262
260
 
263
- &.has-color{
264
- padding-left: 36px;
265
- }
266
-
267
261
  &.danger{
268
262
  &.has-icon .icon{
269
263
  color: $color-gray-8;
@@ -299,20 +293,19 @@
299
293
  .ecs-switch-wrapper{
300
294
  margin: -7px 0;
301
295
  }
302
- }
303
296
 
304
- &-color{
305
- width: 14px;
306
- height: 14px;
307
- border-radius: 100%;
308
- top: 13px;
309
- left: 12px;
310
- position: absolute;
297
+ .after{
298
+ position: absolute;
299
+ right: 12px;
300
+ top: 50%;
301
+ margin-top: -8px;
302
+ }
311
303
  }
312
304
 
313
305
  .after{
314
306
  opacity: .4;
315
307
  font-size: $type-scale-2-font-size;
308
+ line-height: $type-scale-2-line-height;
316
309
  float: right;
317
310
 
318
311
  &-highlight{
@@ -239,10 +239,5 @@
239
239
  align-items: center;
240
240
  width: 100%;
241
241
  }
242
-
243
- .ecs-form-check-input + label:before,
244
- .ecs-form-check-input + label:after{
245
- top: auto !important;
246
- }
247
242
  }
248
243
  </style>
@@ -21,14 +21,17 @@
21
21
  :for="id">
22
22
 
23
23
  <slot />
24
+ <ecs-text v-if="$slots.default && help" type="form">{{ help }}</ecs-text>
24
25
  </label>
25
26
  </ecs-form-check>
26
27
  </template>
27
28
 
28
29
  <script>
29
30
  import EcsFormCheck from '../form-check/form-check'
31
+ import EcsText from '../text/text'
32
+
30
33
  export default {
31
- components: { EcsFormCheck },
34
+ components: { EcsFormCheck, EcsText },
32
35
 
33
36
  model: {
34
37
  prop: 'checked',
@@ -62,6 +65,10 @@
62
65
  inline: {
63
66
  type: Boolean,
64
67
  default: false
68
+ },
69
+ /** Help text that appears underneath (or next to, for inline radiobuttons) the label. */
70
+ help: {
71
+ type: String
65
72
  }
66
73
  },
67
74
 
@@ -133,8 +140,18 @@
133
140
  background: $color-blue-10;
134
141
  width: 6px;
135
142
  height: 6px;
136
- top: 6px;
143
+ top: 50%;
144
+ margin-top: -3px;
137
145
  left: 6px;
138
146
  }
139
147
  }
148
+
149
+ .ecs-text{
150
+ min-width: 100%;
151
+ }
152
+
153
+ .ecs-form-check-inline .ecs-text{
154
+ min-width: auto;
155
+ margin-left: $spacing-10;
156
+ }
140
157
  </style>
@@ -6,6 +6,22 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 2.1.1 (11 October 2022)
10
+
11
+ ### Features
12
+
13
+ - Added `help` prop to EcsCheckbox and EcsRadiobutton to render a small helper text underneath the label.
14
+
15
+ ## Version 2.1.0 (11 October 2022)
16
+
17
+ ### Breaking Changes
18
+
19
+ - Deprecated the `type="color"` and `color` props of EcsPopoverListItem. Since EcsSwatchesPicker is now fully implemented, this component variant will no longer be needed.
20
+
21
+ ### Fixes
22
+
23
+ - Allows `suffix` and `help` text for control type popover-list-items components.
24
+
9
25
  ## Version 2.0.7 (10 October 2022)
10
26
 
11
27
  ### Fixes
@@ -47,3 +47,11 @@ export const checkboxIndeterminate = () => ({
47
47
  <ecs-checkbox indeterminate inline name="apple">Apples</ecs-checkbox>
48
48
  </div>`,
49
49
  });
50
+
51
+ export const checkboxHelpText = () => ({
52
+ components: { EcsCheckbox },
53
+ template: `<div>
54
+ <ecs-checkbox help="Help Text Label" name="apple">Apple</ecs-checkbox>
55
+ <ecs-checkbox help="Help Text Label" inline name="apple">Apple</ecs-checkbox>
56
+ </div>`,
57
+ });
@@ -37,20 +37,17 @@ export const popoverListItemIcon = () => ({
37
37
  </ecs-popover-list>`,
38
38
  });
39
39
 
40
- export const popoverListItemColor = () => ({
41
- components: { EcsPopoverListItem, EcsPopoverList },
42
- template: `<ecs-popover-list>
43
- <ecs-popover-list-item type="color" color="#F9DF00">Yellow</ecs-popover-list-item>
44
- <ecs-popover-list-item type="color" color="#F3A100">Orange</ecs-popover-list-item>
45
- </ecs-popover-list>`,
46
- });
47
-
48
40
  export const popoverListItemControls = () => ({
49
41
  components: { EcsPopoverListItem, EcsPopoverList },
50
42
  template: `<ecs-popover-list>
51
43
  <ecs-popover-list-item type="checkbox">List Item Checkbox</ecs-popover-list-item>
44
+ <ecs-popover-list-item type="checkbox" suffix="Suffix">List Item Checkbox</ecs-popover-list-item>
52
45
  <ecs-popover-list-item type="radiobutton">List Item Radio</ecs-popover-list-item>
46
+ <ecs-popover-list-item type="radiobutton" suffix="Suffix">List Item Radio</ecs-popover-list-item>
53
47
  <ecs-popover-list-item type="sort">List Item Sort</ecs-popover-list-item>
48
+ <ecs-popover-list-item type="sort" suffix="Suffix">List Item Sort</ecs-popover-list-item>
54
49
  <ecs-popover-list-item type="switch">List Item Switch</ecs-popover-list-item>
50
+ <ecs-popover-list-item type="switch" help="This is a helper text.">List Item Switch</ecs-popover-list-item>
51
+ <ecs-popover-list-item type="switch" suffix="TXT">List Item Switch</ecs-popover-list-item>
55
52
  </ecs-popover-list>`,
56
53
  });
@@ -37,3 +37,16 @@ export const radiobuttonInline = () => ({
37
37
  Selected: {{ selected }}
38
38
  </div>`,
39
39
  });
40
+
41
+ export const radiobuttonHelpText = () => ({
42
+ components: { EcsRadiobutton },
43
+ data() {
44
+ return {
45
+ selected: 'apple'
46
+ }
47
+ },
48
+ template: `<div>
49
+ <ecs-radiobutton name="fruits" v-model="selected" value="orange" help="Help Text Label">Label</ecs-radiobutton>
50
+ <ecs-radiobutton name="fruits" v-model="selected" inline value="apple" help="Help Text Label">Label</ecs-radiobutton>
51
+ </div>`,
52
+ });