@weni/unnnic-system 2.0.8 → 2.0.10

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.
@@ -94,11 +94,8 @@ export default {
94
94
 
95
95
  methods: {
96
96
  click() {
97
- if (this.valueName === 'checked') {
98
- this.$emit('change', false);
99
- } else {
100
- this.$emit('change', true);
101
- }
97
+ const isChecked = ['checked', 'less'].includes(this.valueName);
98
+ this.$emit('change', !isChecked);
102
99
  },
103
100
  },
104
101
  };
@@ -116,7 +113,7 @@ export default {
116
113
  .unnnic-checkbox {
117
114
  &.disabled {
118
115
  :deep(.primary) {
119
- fill: $unnnic-color-neutral-soft;
116
+ fill: $unnnic-color-neutral-cleanest;
120
117
  }
121
118
  }
122
119
  }
@@ -62,7 +62,7 @@ const color = computed(() => {
62
62
  return 'brand-sec';
63
63
  }
64
64
 
65
- return valueName.value === 'selected' ? 'brand-weni' : 'neutral-soft';
65
+ return valueName.value === 'selected' ? 'brand-weni' : 'neutral-cleanest';
66
66
  });
67
67
 
68
68
  function click() {
@@ -1,59 +1,103 @@
1
1
  <template>
2
- <div
3
- class="unnnic-slider"
4
- :style="cssVars"
5
- >
6
- <div class="unnnic-slider__content">
2
+ <article>
3
+ <section class="unnnic-label">
4
+ <p
5
+ v-if="label"
6
+ class="unnnic-slider__label"
7
+ >
8
+ {{ label }}
9
+ </p>
7
10
  <UnnnicTooltip
8
- ref="tooltip"
9
- class="unnnic-slider__content__tooltip"
10
- :text="sliderVal.toString()"
11
- :forceOpen="true"
12
- :enabled="showTooltip"
11
+ v-if="labelInfo"
12
+ class="unnnic-label__tooltip"
13
+ :text="labelInfo"
14
+ enabled
13
15
  side="top"
14
16
  >
15
- <input
16
- ref="input"
17
- class="unnnic-slider__content__range-input"
18
- v-model="sliderVal"
19
- type="range"
20
- :min="minValue"
21
- :max="maxValue"
22
- :step="step"
23
- @change="handleValueChange"
24
- @mouseover="showTooltip = true"
25
- @mouseleave="showTooltip = false"
17
+ <UnnnicIcon
18
+ class="unnnic-label__tooltip__icon"
19
+ icon="info"
20
+ size="sm"
21
+ scheme="neutral-clean"
22
+ :filled="true"
26
23
  />
27
24
  </UnnnicTooltip>
25
+ </section>
28
26
 
29
- <div class="unnnic-slider__content__labels">
30
- <div class="unnnic-slider__content__labels__min">{{ minLabel }}</div>
31
- <div class="unnnic-slider__content__labels__max">{{ maxLabel }}</div>
32
- </div>
33
- </div>
34
-
35
- <div
36
- ref="value-input"
37
- class="value-input"
38
- contenteditable="true"
39
- @input="handleInput"
40
- />
41
- </div>
27
+ <section
28
+ class="unnnic-slider"
29
+ :style="cssVars"
30
+ >
31
+ <section class="unnnic-slider__content">
32
+ <section class="unnnic-slider__content__labels">
33
+ <span class="unnnic-slider__content__labels__min">{{
34
+ minLabel
35
+ }}</span>
36
+ <UnnnicTooltip
37
+ ref="tooltip"
38
+ class="unnnic-slider__content__tooltip"
39
+ :text="sliderVal.toString()"
40
+ :forceOpen="true"
41
+ :enabled="showTooltip"
42
+ side="top"
43
+ >
44
+ <input
45
+ ref="input"
46
+ class="unnnic-slider__content__range-input"
47
+ v-model="sliderVal"
48
+ type="range"
49
+ :min="minValue"
50
+ :max="maxValue"
51
+ :step="step"
52
+ @change="handleValueChange"
53
+ @mouseover="showTooltip = true"
54
+ @mouseleave="showTooltip = false"
55
+ />
56
+ </UnnnicTooltip>
57
+ <span class="unnnic-slider__content__labels__max">{{
58
+ maxLabel
59
+ }}</span>
60
+ </section>
61
+ </section>
62
+ <template v-if="showInputValue">
63
+ <input
64
+ ref="value-input"
65
+ class="value-input"
66
+ @input="handleInput"
67
+ :value="sliderVal"
68
+ />
69
+ </template>
70
+ </section>
71
+ </article>
42
72
  </template>
43
73
 
44
74
  <script>
45
- import unnnicTooltip from '../ToolTip/ToolTip.vue';
75
+ import UnnnicTooltip from '../ToolTip/ToolTip.vue';
76
+ import UnnnicIcon from '../Icon.vue';
46
77
 
47
78
  export default {
48
79
  name: 'unnnic-slider',
49
80
  components: {
50
- unnnicTooltip,
81
+ UnnnicTooltip,
82
+ UnnnicIcon,
51
83
  },
52
84
  props: {
53
85
  initialValue: {
54
86
  type: Number,
55
87
  default: 0,
56
88
  },
89
+ showInputValue: {
90
+ type: Boolean,
91
+ default: true,
92
+ },
93
+ label: {
94
+ type: String,
95
+ default: '',
96
+ },
97
+ labelInfo: {
98
+ type: String,
99
+ default: '',
100
+ },
57
101
  minValue: {
58
102
  type: Number,
59
103
  default: 0,
@@ -102,7 +146,9 @@ export default {
102
146
  handler() {
103
147
  this.$nextTick(() => {
104
148
  this.configureTooltip();
105
- if (this.$refs['value-input'].textContent !== this.sliderVal) {
149
+ const ValueInput = this.$refs['value-input'];
150
+
151
+ if (ValueInput && ValueInput.textContent !== this.sliderVal) {
106
152
  this.$refs['value-input'].textContent = this.sliderVal;
107
153
  }
108
154
  });
@@ -125,13 +171,13 @@ export default {
125
171
  this.$emit('valueChange', this.sliderVal);
126
172
  },
127
173
  handleInput(event) {
128
- this.sliderVal = event.srcElement.textContent;
174
+ this.sliderVal = event.target.value;
129
175
 
130
176
  this.handleValueChange();
131
177
  },
132
178
  getNewTooltipPosition() {
133
179
  const haldThumbWidth = 12 / 2;
134
- const halfLabelWidth = this.labelWidth / 2;
180
+ const halfLabelWidth = (this.labelWidth === 0 ? 32 : this.labelWidth) / 2;
135
181
  const centerPosition = this.sliderWidth / 2;
136
182
 
137
183
  let percentOfRange =
@@ -176,10 +222,18 @@ export default {
176
222
  box-sizing: border-box;
177
223
  font-size: $unnnic-font-size-body-md;
178
224
  line-height: $unnnic-font-size-body-md + $unnnic-line-height-medium;
179
- padding: $unnnic-squish-nano;
225
+ min-width: 70px;
226
+ max-width: 70px;
227
+ padding: $unnnic-spacing-xs $unnnic-spacing-sm $unnnic-spacing-xs
228
+ $unnnic-spacing-sm;
229
+ gap: $unnnic-spacing-xs;
180
230
  height: $unnnic-font-size-body-md + $unnnic-line-height-medium + 0.5 *
181
231
  $unnnic-font-size * 2;
182
232
  position: relative;
233
+ border: $unnnic-border-width-thinner solid $unnnic-color-neutral-cleanest;
234
+ overflow: hidden;
235
+ white-space: nowrap;
236
+ text-overflow: ellipsis;
183
237
 
184
238
  &:before {
185
239
  content: ' ';
@@ -188,13 +242,12 @@ export default {
188
242
  right: 0;
189
243
  top: 0;
190
244
  bottom: 0;
191
- border: $unnnic-border-width-thinner solid $unnnic-color-neutral-clean;
192
245
  border-radius: inherit;
193
246
  pointer-events: none;
194
247
  }
195
248
 
196
249
  &:focus:before {
197
- border-color: $unnnic-color-neutral-cleanest;
250
+ border-color: $unnnic-color-neutral-clean;
198
251
  }
199
252
 
200
253
  &:focus {
@@ -206,9 +259,32 @@ export default {
206
259
  <style lang="scss">
207
260
  @import '../../assets/scss/unnnic.scss';
208
261
 
262
+ .unnnic-label {
263
+ display: flex;
264
+ gap: $unnnic-spacing-xs;
265
+
266
+ &__tooltip {
267
+ display: flex;
268
+ align-self: center;
269
+
270
+ &__icon {
271
+ cursor: default;
272
+ }
273
+ }
274
+ }
275
+
209
276
  .unnnic-slider {
210
277
  display: flex;
211
278
  width: 100%;
279
+
280
+ &__label {
281
+ font-family: $unnnic-font-family-secondary;
282
+ font-weight: $unnnic-font-weight-regular;
283
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
284
+ font-size: $unnnic-font-size-body-gt;
285
+ color: $unnnic-color-neutral-cloudy;
286
+ margin: $unnnic-spacing-stack-xs 0;
287
+ }
212
288
  &__content {
213
289
  display: flex;
214
290
  flex-direction: column;
@@ -216,22 +292,30 @@ export default {
216
292
  margin-top: $unnnic-spacing-stack-xs;
217
293
 
218
294
  &__tooltip {
219
- display: flex !important;
295
+ display: flex;
220
296
  width: 100%;
221
297
  align-self: center;
222
298
  }
223
299
 
224
300
  &__labels {
225
301
  display: flex;
302
+ gap: $unnnic-spacing-ant;
226
303
 
227
- font-family: $unnnic-font-family-secondary;
228
- font-weight: $unnnic-font-weight-regular;
229
- font-size: $unnnic-font-size-body-md;
230
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
231
- color: $unnnic-color-neutral-cloudy;
304
+ &__min {
305
+ font-family: $unnnic-font-family-secondary;
306
+ font-weight: $unnnic-font-weight-regular;
307
+ font-size: $unnnic-font-size-body-md;
308
+ line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
309
+ color: $unnnic-color-neutral-cloudy;
310
+ }
232
311
 
233
312
  &__max {
234
313
  margin-left: auto;
314
+ font-family: $unnnic-font-family-secondary;
315
+ font-weight: $unnnic-font-weight-regular;
316
+ font-size: $unnnic-font-size-body-md;
317
+ line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
318
+ color: $unnnic-color-neutral-cloudy;
235
319
  }
236
320
  }
237
321
 
@@ -244,14 +328,10 @@ export default {
244
328
  box-sizing: border-box;
245
329
  width: $unnnic-icon-size-xs;
246
330
  height: $unnnic-icon-size-xs;
247
- background: $unnnic-color-neutral-snow;
248
- border: $unnnic-border-width-thin solid $unnnic-color-aux-baby-blue;
331
+ background: $unnnic-color-weni-600;
332
+ border: $unnnic-border-width-thin solid $unnnic-color-weni-600;
249
333
  border-radius: 50%;
250
334
 
251
- &:hover {
252
- border: $unnnic-border-width-thin solid $unnnic-color-aux-blue;
253
- }
254
-
255
335
  &:active {
256
336
  box-shadow: $unnnic-shadow-level-near;
257
337
  }
@@ -290,8 +370,8 @@ export default {
290
370
  );
291
371
  background: linear-gradient(
292
372
  to right,
293
- $unnnic-color-aux-baby-blue 0%,
294
- $unnnic-color-aux-baby-blue calc(var(--progress)),
373
+ $unnnic-color-weni-600 0%,
374
+ $unnnic-color-weni-600 calc(var(--progress)),
295
375
  $unnnic-color-neutral-soft calc(var(--progress)),
296
376
  $unnnic-color-neutral-soft 100%
297
377
  );
@@ -307,7 +387,7 @@ export default {
307
387
 
308
388
  @mixin fill() {
309
389
  height: 4px;
310
- background: $unnnic-color-aux-baby-blue;
390
+ background: $unnnic-color-weni-600;
311
391
  }
312
392
 
313
393
  /* Firefox */
@@ -12,8 +12,8 @@
12
12
  v-if="showValue"
13
13
  class="rating-title"
14
14
  >
15
- <span class="highlight">{{ value.toFixed(1) }}</span
16
- >/5.0
15
+ <span class="highlight"> {{ modelValue.toFixed(1) }} </span>
16
+ /5.0
17
17
  </div>
18
18
  </div>
19
19
  </template>
@@ -27,7 +27,7 @@ export default {
27
27
  },
28
28
 
29
29
  props: {
30
- value: {
30
+ modelValue: {
31
31
  type: Number,
32
32
  },
33
33
 
@@ -46,7 +46,7 @@ export default {
46
46
 
47
47
  methods: {
48
48
  starScheme(star) {
49
- return star <= this.value ? 'feedback-yellow' : 'neutral-clean';
49
+ return star <= this.modelValue ? 'feedback-yellow' : 'neutral-clean';
50
50
  },
51
51
  },
52
52
  };
@@ -17,6 +17,8 @@
17
17
  :size="iconSize"
18
18
  :scheme="iconScheme"
19
19
  :lineHeight="iconLineHeight"
20
+ :disabled="disabled"
21
+ :clickable="!disabled"
20
22
  @click="toggleState"
21
23
  />
22
24
 
@@ -13,6 +13,19 @@
13
13
  @click="change(tab)"
14
14
  >
15
15
  <slot :name="tabHeadSlotName(tab)">{{ tab }} </slot>
16
+ <UnnnicToolTip
17
+ v-if="getHeadTooltip(tab)"
18
+ enabled
19
+ :text="getHeadTooltip(tab)"
20
+ side="bottom"
21
+ >
22
+ <UnnnicIcon
23
+ icon="info"
24
+ :size="size === 'sm' ? 'xs' : 'sm'"
25
+ filled
26
+ scheme="neutral-cleanest"
27
+ />
28
+ </UnnnicToolTip>
16
29
  </li>
17
30
  </ul>
18
31
  </header>
@@ -23,11 +36,18 @@
23
36
  </template>
24
37
 
25
38
  <script>
39
+ import UnnnicIcon from '../Icon.vue';
40
+ import UnnnicToolTip from '../ToolTip/ToolTip.vue';
41
+
26
42
  export default {
27
43
  model: {
28
44
  prop: 'activeTab',
29
45
  event: 'change',
30
46
  },
47
+ components: {
48
+ UnnnicIcon,
49
+ UnnnicToolTip,
50
+ },
31
51
  props: {
32
52
  size: {
33
53
  type: String,
@@ -71,6 +91,17 @@ export default {
71
91
  tabHeadSlotName(tabName) {
72
92
  return `tab-head-${tabName}`;
73
93
  },
94
+ tabHeadTooltipSlotName(tabName) {
95
+ return tabName ? `tab-head-${tabName}-tooltip` : '';
96
+ },
97
+ getHeadTooltip(tabName) {
98
+ const tooltipSlot = this.$slots[this.tabHeadTooltipSlotName(tabName)];
99
+
100
+ if (tooltipSlot) {
101
+ return tooltipSlot()?.[0]?.children;
102
+ }
103
+ return '';
104
+ },
74
105
  change(value) {
75
106
  this.localValue = value;
76
107
  this.$emit('change', this.localValue);
@@ -86,40 +117,68 @@ export default {
86
117
  display: flex;
87
118
  align-items: flex-start;
88
119
  justify-content: space-between;
89
- color: $unnnic-color-neutral-cleanest;
120
+ color: $unnnic-color-neutral-cloudy;
90
121
  font-family: $unnnic-font-family-secondary;
91
122
  font-weight: $unnnic-font-weight-bold;
92
123
  font-size: $unnnic-font-size-body-lg;
93
124
  line-height: ($unnnic-font-size-body-lg + $unnnic-line-height-medium);
94
- padding-bottom: $unnnic-inset-sm;
95
125
  margin-bottom: $unnnic-inset-sm;
96
126
  border-bottom: $unnnic-border-width-thinner solid $unnnic-color-neutral-soft;
97
127
  }
98
128
 
99
129
  .tab-content {
100
130
  display: flex;
131
+ gap: $unnnic-spacing-sm;
132
+
101
133
  margin: 0;
102
134
  padding: 0;
103
135
  list-style: none;
104
136
  }
105
137
 
106
138
  .tab-head {
139
+ display: flex;
140
+ gap: $unnnic-spacing-xs;
141
+ align-items: center;
142
+
107
143
  cursor: pointer;
108
- margin-right: $unnnic-inset-md;
144
+ margin: $unnnic-spacing-xs $unnnic-spacing-sm;
145
+
146
+ .unnnic-tooltip {
147
+ display: flex;
148
+ }
149
+
150
+ &:hover {
151
+ color: $unnnic-color-neutral-black;
152
+ }
109
153
  }
110
154
 
111
155
  .tab-head--active {
112
156
  font-family: $unnnic-font-family-secondary;
113
157
  font-weight: $unnnic-font-weight-bold;
114
- color: $unnnic-color-neutral-darkest;
158
+ color: $unnnic-color-neutral-black;
115
159
  font-size: $unnnic-font-size-body-lg;
116
160
  line-height: ($unnnic-font-size-body-lg + $unnnic-line-height-medium);
117
161
  transition: 0.4s;
162
+
163
+ position: relative;
164
+
165
+ &::after {
166
+ content: '';
167
+
168
+ position: absolute;
169
+ bottom: -$unnnic-spacing-xs;
170
+ left: -$unnnic-spacing-sm;
171
+
172
+ display: block;
173
+
174
+ width: calc(100% + (#{$unnnic-spacing-sm} * 2));
175
+
176
+ border-bottom: $unnnic-border-width-thin solid $unnnic-color-weni-600;
177
+ }
118
178
  }
119
179
 
120
180
  .tab.size-sm {
121
181
  .tab-header {
122
- padding-bottom: $unnnic-spacing-stack-xs;
123
182
  margin-bottom: $unnnic-spacing-stack-xs;
124
183
 
125
184
  .tab-head,
@@ -147,7 +147,7 @@ export default {
147
147
  font-weight: $unnnic-font-weight-regular;
148
148
 
149
149
  &::placeholder {
150
- color: $unnnic-color-neutral-cloudy;
150
+ color: $unnnic-color-neutral-cleanest;
151
151
  font-family: $unnnic-font-family-secondary;
152
152
  font-size: $unnnic-font-size-body-gt;
153
153
  line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
@@ -156,9 +156,6 @@ export default {
156
156
 
157
157
  &:focus {
158
158
  border-color: $unnnic-color-neutral-clean;
159
- &::placeholder {
160
- color: $unnnic-color-neutral-cleanest;
161
- }
162
159
  }
163
160
  }
164
161
 
@@ -21,6 +21,12 @@
21
21
  {{ line }}
22
22
  <br />
23
23
  </template>
24
+
25
+ <template v-if="shortcutText">
26
+ <span class="unnnic-tooltip-label-shortcut">
27
+ {{ shortcutText }}
28
+ </span>
29
+ </template>
24
30
  </span>
25
31
  </div>
26
32
  </template>
@@ -72,6 +78,10 @@ export default {
72
78
  maxWidth: {
73
79
  type: String,
74
80
  },
81
+ shortcutText: {
82
+ type: String,
83
+ default: null,
84
+ },
75
85
  },
76
86
  methods: {
77
87
  handleResize() {
@@ -83,31 +93,15 @@ export default {
83
93
  if (element && this.$refs.label) {
84
94
  if (this.side === 'right') {
85
95
  this.leftPos = `${elementPos.x + elementPos.width + 8}px`;
86
- this.topPos = `${
87
- elementPos.y +
88
- elementPos.height / 2 -
89
- this.$refs.label.offsetHeight / 2
90
- }px`;
96
+ this.topPos = `${elementPos.y + elementPos.height / 2 - this.$refs.label.offsetHeight / 2}px`;
91
97
  } else if (this.side === 'left') {
92
98
  this.leftPos = `${elementPos.x - this.$refs.label.offsetWidth - 8}px`;
93
- this.topPos = `${
94
- elementPos.y +
95
- elementPos.height / 2 -
96
- this.$refs.label.offsetHeight / 2
97
- }px`;
99
+ this.topPos = `${elementPos.y + elementPos.height / 2 - this.$refs.label.offsetHeight / 2}px`;
98
100
  } else if (this.side === 'top') {
99
- this.leftPos = `${
100
- elementPos.x +
101
- elementPos.width / 2 -
102
- this.$refs.label.clientWidth / 2
103
- }px`;
101
+ this.leftPos = `${elementPos.x + elementPos.width / 2 - this.$refs.label.clientWidth / 2}px`;
104
102
  this.topPos = `${elementPos.y - this.$refs.label.offsetHeight - 8}px`;
105
103
  } else if (this.side === 'bottom') {
106
- this.leftPos = `${
107
- elementPos.x +
108
- elementPos.width / 2 -
109
- this.$refs.label.clientWidth / 2
110
- }px`;
104
+ this.leftPos = `${elementPos.x + elementPos.width / 2 - this.$refs.label.clientWidth / 2}px`;
111
105
  this.topPos = `${elementPos.y + elementPos.height + 8}px`;
112
106
  }
113
107
  }
@@ -134,6 +128,10 @@ export default {
134
128
  min-width: 2 * $unnnic-font-size;
135
129
  box-sizing: border-box;
136
130
  width: auto;
131
+ display: flex;
132
+ justify-content: center;
133
+ gap: $unnnic-spacing-xs;
134
+ align-items: center;
137
135
 
138
136
  background-color: $unnnic-color-neutral-black;
139
137
  color: $unnnic-color-neutral-snow;
@@ -193,6 +191,12 @@ export default {
193
191
  $unnnic-color-neutral-black;
194
192
  }
195
193
  }
194
+
195
+ &-shortcut {
196
+ background-color: $unnnic-color-neutral-darkest;
197
+ border-radius: $unnnic-border-radius-sm;
198
+ padding: calc($unnnic-inset-nano / 2) $unnnic-inset-nano;
199
+ }
196
200
  }
197
201
 
198
202
  .unnnic-tooltip.force-open {
@@ -1,15 +1,18 @@
1
- {
2
- "upload_area": {
3
- "title": {
4
- "text": "Drag your file here or",
5
- "highlight": "search it"
6
- },
7
- "invalid": {
8
- "subtitle": "File not supported, select supported formats:"
9
- },
10
- "subtitle": "Supported formats:"
11
- },
12
- "import_card": {
13
- "importing": "Importing"
14
- }
15
- }
1
+ {
2
+ "upload_area": {
3
+ "title": {
4
+ "text": "Drag your file here or",
5
+ "highlight": "search it"
6
+ },
7
+ "invalid": {
8
+ "subtitle": "File not supported, select supported formats:"
9
+ },
10
+ "subtitle": "Supported formats:"
11
+ },
12
+ "import_card": {
13
+ "importing": "Importing"
14
+ },
15
+ "audio_recorder": {
16
+ "discard_button" : "Discard"
17
+ }
18
+ }
@@ -1,15 +1,18 @@
1
- {
2
- "upload_area": {
3
- "title": {
4
- "text": "Arrastra tu archivo aquí o",
5
- "highlight": "búscalo"
6
- },
7
- "invalid": {
8
- "subtitle": "Archivo no compatible, seleccione los formatos compatibles:"
9
- },
10
- "subtitle": "Formatos compatibles:"
11
- },
12
- "import_card": {
13
- "importing": "Importando"
14
- }
15
- }
1
+ {
2
+ "upload_area": {
3
+ "title": {
4
+ "text": "Arrastra tu archivo aquí o",
5
+ "highlight": "búscalo"
6
+ },
7
+ "invalid": {
8
+ "subtitle": "Archivo no compatible, seleccione los formatos compatibles:"
9
+ },
10
+ "subtitle": "Formatos compatibles:"
11
+ },
12
+ "import_card": {
13
+ "importing": "Importando"
14
+ },
15
+ "audio_recorder": {
16
+ "discard_button" : "Descartar"
17
+ }
18
+ }