@weni/unnnic-system 2.0.9 → 2.0.11

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
  }
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <section class="unnnic-disclaimer">
3
+ <unnnic-icon
4
+ class="unnnic-disclaimer__icon"
5
+ size="avatar-nano"
6
+ :icon="icon"
7
+ :scheme="iconColor"
8
+ />
9
+ <p class="unnnic-disclaimer__text">{{ text }}</p>
10
+ </section>
11
+ </template>
12
+
13
+ <script>
14
+ import icons from '../../utils/iconList';
15
+ import colors from '../../utils/colorsList';
16
+
17
+ import unnnicIcon from '../Icon.vue';
18
+
19
+ export default {
20
+ name: 'unnnic-disclaimer',
21
+ components: { unnnicIcon },
22
+ props: {
23
+ text: {
24
+ type: String,
25
+ required: true,
26
+ },
27
+ icon: {
28
+ type: String,
29
+ default: 'alert-circle-1-1',
30
+ validator(value) {
31
+ return icons.includes(value);
32
+ },
33
+ },
34
+ iconColor: {
35
+ type: String,
36
+ validator(value) {
37
+ return colors.includes(value);
38
+ },
39
+ },
40
+ },
41
+ };
42
+ </script>
43
+
44
+ <style lang="scss" scoped>
45
+ @import '../../assets/scss/unnnic.scss';
46
+ .unnnic-disclaimer {
47
+ display: inline-flex;
48
+ align-items: center;
49
+ gap: $unnnic-spacing-xs;
50
+ padding: $unnnic-spacing-sm;
51
+ border-radius: $unnnic-border-radius-sm;
52
+ border: 1px solid $unnnic-color-neutral-soft;
53
+ background: $unnnic-color-background-lightest;
54
+ .unnnic-disclaimer__text {
55
+ margin: 0;
56
+ font-family: $unnnic-font-family-secondary;
57
+ font-size: $unnnic-font-size-body-gt;
58
+ line-height: $unnnic-line-height-large * 1.375;
59
+ font-weight: $unnnic-font-weight-regular;
60
+ color: $unnnic-color-neutral-dark;
61
+ }
62
+ }
63
+
64
+ </style>
@@ -0,0 +1,234 @@
1
+ <template>
2
+ <aside v-if="modelValue" class="unnnic-drawer">
3
+ <section class="unnnic-drawer__overlay"></section>
4
+ <transition appear name="drawer">
5
+ <section
6
+ v-if="showDrawer"
7
+ :class="['unnnic-drawer__container', wide && 'unnnic-drawer__container--wide']"
8
+ >
9
+ <header class="unnnic-drawer__header">
10
+ <section class="unnnic-drawer__title-container">
11
+ <h1 class="unnnic-drawer__title">{{ title }}</h1>
12
+ <p
13
+ v-if="description"
14
+ class="unnnic-drawer__description"
15
+ >
16
+ {{ description }}
17
+ </p>
18
+ </section>
19
+ <unnnic-icon
20
+ class="unnnic-drawer__close"
21
+ icon="arrow_back"
22
+ size="avatar-nano"
23
+ clickable
24
+ @click="close"
25
+ />
26
+ </header>
27
+ <section class="unnnic-drawer__content">
28
+ <slot name="content"></slot>
29
+ </section>
30
+ <footer v-if="showFooter" class="unnnic-drawer__footer">
31
+ <unnnic-button
32
+ v-if="secondaryButtonText"
33
+ size="large"
34
+ type="tertiary"
35
+ :text="secondaryButtonText"
36
+ @click="$emit('secondaryButtonClick')"
37
+ />
38
+ <unnnic-button
39
+ v-if="primaryButtonText"
40
+ size="large"
41
+ :type="primaryButtonType"
42
+ :text="primaryButtonText"
43
+ @click="$emit('primaryButtonClick')"
44
+ />
45
+ </footer>
46
+ </section>
47
+ </transition>
48
+ </aside>
49
+ </template>
50
+
51
+ <script>
52
+ import unnnicIcon from '../Icon.vue';
53
+ import unnnicButton from '../Button/Button.vue';
54
+
55
+ export default {
56
+ name: 'unnnic-drawer',
57
+ emits: ['primaryButtonClick', 'secondaryButtonClick', 'close'],
58
+ components: {
59
+ unnnicIcon,
60
+ unnnicButton,
61
+ },
62
+ data() {
63
+ return {
64
+ showDrawer: true,
65
+ };
66
+ },
67
+ props: {
68
+ title: {
69
+ type: String,
70
+ required: true,
71
+ },
72
+ description: {
73
+ type: String,
74
+ },
75
+ primaryButtonText: {
76
+ type: String,
77
+ },
78
+ primaryButtonType: {
79
+ type: String,
80
+ default: 'primary',
81
+ },
82
+ secondaryButtonText: {
83
+ type: String,
84
+ },
85
+ wide: {
86
+ type: Boolean,
87
+ default: false,
88
+ },
89
+ modelValue: {
90
+ type: Boolean,
91
+ required: true,
92
+ },
93
+ },
94
+ computed: {
95
+ showFooter() {
96
+ return !!(this.primaryButtonText || this.secondaryButtonText)
97
+ }
98
+ },
99
+ methods: {
100
+ close() {
101
+ this.showDrawer = false;
102
+ setTimeout(() => {
103
+ this.$emit('close');
104
+ this.showDrawer = true;
105
+ }, 200);
106
+ },
107
+ },
108
+ };
109
+ </script>
110
+
111
+ <style lang="scss" scoped>
112
+ @import '../../assets/scss/unnnic.scss';
113
+ * {
114
+ margin: 0;
115
+ padding: 0;
116
+ box-sizing: border-box;
117
+ }
118
+
119
+ @keyframes drawerOpen {
120
+ from {
121
+ transform: translateX(100%);
122
+ }
123
+ to {
124
+ transform: translateX(0);
125
+ }
126
+ }
127
+
128
+ @keyframes drawerClose {
129
+ from {
130
+ transform: translateX(0);
131
+ }
132
+ to {
133
+ transform: translateX(100%);
134
+ }
135
+ }
136
+
137
+ .drawer-enter-active,
138
+ .drawer-enter-to {
139
+ animation: drawerOpen 200ms ease-in;
140
+ }
141
+
142
+ .drawer-leave-active,
143
+ .drawer-leave-to {
144
+ display: none;
145
+ animation: drawerClose 200ms ease-in;
146
+ }
147
+
148
+ .unnnic-drawer {
149
+ width: 100vw;
150
+ height: 100vh;
151
+ position: fixed;
152
+ left: 0;
153
+ top: 0;
154
+ z-index: 8;
155
+ }
156
+
157
+ .unnnic-drawer__overlay {
158
+ z-index: 9;
159
+ background-color: rgba(0,0,0,0.4);
160
+ width: 100%;
161
+ height: 100%;
162
+
163
+ }
164
+
165
+ .unnnic-drawer__container {
166
+ z-index: 10;
167
+ top: 0;
168
+ right: 0;
169
+ position: fixed;
170
+ display: flex;
171
+ flex-direction: column;
172
+ font-family: $unnnic-font-family-secondary;
173
+ justify-content: space-between;
174
+ height: 100%;
175
+ background-color: $unnnic-color-neutral-white;
176
+ width: calc(100%/3);
177
+
178
+ &--wide {
179
+ width: 50%;
180
+ }
181
+
182
+ .unnnic-drawer__header {
183
+ display: flex;
184
+ justify-content: space-between;
185
+ border-bottom: 1px solid $unnnic-color-neutral-soft;
186
+ padding: $unnnic-spacing-md;
187
+ .unnnic-drawer__title-container {
188
+
189
+ .unnnic-drawer__title {
190
+ color: $unnnic-color-neutral-darkest;
191
+ font-family: $unnnic-font-family-secondary;
192
+ font-size: $unnnic-font-size-title-sm;
193
+ font-weight: $unnnic-font-weight-black;
194
+ line-height: $unnnic-line-height-large * 1.75;
195
+ }
196
+
197
+ .unnnic-drawer__description {
198
+ color: $unnnic-color-neutral-cloudy;
199
+ font-family: $unnnic-font-family-secondary;
200
+ font-size: $unnnic-font-size-body-gt;
201
+ font-weight: $unnnic-font-weight-regular;
202
+ line-height: $unnnic-line-height-large * 1.375;
203
+ }
204
+ }
205
+
206
+ .unnnic-drawer__close {
207
+ margin: $unnnic-spacing-nano;
208
+ transform: rotate(180deg);
209
+ display: flex;
210
+ }
211
+ }
212
+
213
+ .unnnic-drawer__content {
214
+ overflow-y: auto;
215
+ color: $unnnic-color-neutral-cloudy;
216
+ padding: $unnnic-spacing-md $unnnic-spacing-md 0 $unnnic-spacing-md ;
217
+ flex: 1 0 0;
218
+ :deep(*) {
219
+ margin: 0;
220
+ padding: 0;
221
+ box-sizing: border-box;
222
+ }
223
+ }
224
+
225
+ .unnnic-drawer__footer {
226
+ display: flex;
227
+ padding: $unnnic-spacing-md;
228
+ gap: $unnnic-spacing-ant;
229
+ > * {
230
+ flex-grow: 1;
231
+ }
232
+ }
233
+ }
234
+ </style>
@@ -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 */