@weni/unnnic-system 2.13.0 → 2.13.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +56 -19
  3. package/dist/style.css +1 -1
  4. package/dist/unnnic.mjs +4546 -4471
  5. package/dist/unnnic.umd.js +19 -19
  6. package/package.json +1 -1
  7. package/src/components/Alert/Alert.vue +2 -0
  8. package/src/components/Alert/AlertBanner.vue +2 -0
  9. package/src/components/Alert/Version1dot1.vue +1 -0
  10. package/src/components/Alert/__tests__/Alert.spec.js +84 -0
  11. package/src/components/Alert/__tests__/AlertBanner.spec.js +89 -0
  12. package/src/components/Alert/__tests__/AlertCaller.spec.js +98 -0
  13. package/src/components/Alert/__tests__/Version1dot1.spec.js +124 -0
  14. package/src/components/AudioRecorder/AudioRecorder.vue +30 -1
  15. package/src/components/AvatarIcon/__tests__/AvatarIcon.spec.js +84 -0
  16. package/src/components/AvatarIcon/__tests__/__snapshots__/AvatarIcon.spec.js.snap +7 -0
  17. package/src/components/Breadcrumb/Breadcrumb.vue +4 -0
  18. package/src/components/Breadcrumb/__tests__/Breadcrumb.spec.js +68 -0
  19. package/src/components/FormElement/FormElement.vue +101 -28
  20. package/src/components/Input/BaseInput.vue +30 -38
  21. package/src/components/Input/Input.scss +43 -0
  22. package/src/components/Input/TextInput.vue +24 -25
  23. package/src/components/Input/__test__/TextInput.spec.js +2 -2
  24. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +1 -1
  25. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
  26. package/src/components/Pagination/Pagination.vue +23 -4
  27. package/src/components/Pagination/__tests__/Pagination.spec.js +208 -0
  28. package/src/components/SelectSmart/SelectSmart.vue +16 -44
  29. package/src/components/SelectSmart/SelectSmartMultipleHeader.vue +5 -13
  30. package/src/components/SelectSmart/SelectSmartOption.vue +13 -9
  31. package/src/components/SkeletonLoading/SkeletonLoading.vue +17 -11
  32. package/src/components/SkeletonLoading/__tests__/SkeletonLoading.spec.js +125 -0
  33. package/src/components/TextArea/TextArea.vue +45 -128
  34. package/src/components/TextArea/__test__/TextArea.spec.js +26 -24
  35. package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +4 -4
  36. package/src/stories/Input.mdx +76 -0
  37. package/src/stories/Input.stories.js +82 -8
  38. package/src/stories/SelectSmart.mdx +15 -17
  39. package/src/stories/SelectSmart.stories.js +72 -6
  40. package/src/stories/TextArea.mdx +68 -0
  41. package/src/stories/TextArea.stories.js +68 -6
@@ -1,39 +1,68 @@
1
1
  <template>
2
- <div class="unnnic-form-element">
3
- <div
2
+ <section
3
+ class="unnnic-form-element"
4
+ :class="{ 'unnnic-form-element--disabled': disabled }"
5
+ >
6
+ <p
4
7
  v-if="label"
5
8
  :class="[
6
- 'label unnnic-font secondary color-neutral-cloudy',
9
+ 'unnnic-form-element__label',
7
10
  {
8
- 'body-md': size === 'sm',
9
- 'body-gt': size == 'md',
10
- 'label--fixed': fixedLabel,
11
+ 'unnnic-form-element__label--fixed': fixedLabel,
11
12
  },
12
13
  ]"
13
14
  >
14
15
  {{ label }}
15
- </div>
16
+ </p>
16
17
 
17
18
  <slot></slot>
18
19
 
19
- <div
20
- v-if="error && error !== true"
21
- class="message unnnic-font secondary body-md color-feedback-red"
20
+ <p
21
+ v-if="shouldShowErrorSection"
22
+ class="unnnic-form-element__error"
22
23
  >
23
- {{ error }}
24
- </div>
25
-
26
- <div
27
- v-if="message"
28
- class="message unnnic-font secondary body-md color-neutral-cloudy"
24
+ <template v-if="error !== true">
25
+ <UnnnicIcon
26
+ size="sm"
27
+ icon="warning"
28
+ scheme="aux-red-500"
29
+ />
30
+
31
+ {{ error }}
32
+ </template>
33
+
34
+ <span
35
+ v-if="!!$slots.rightMessage"
36
+ class="unnnic-form-element__right-message"
37
+ >
38
+ <slot name="rightMessage"></slot>
39
+ </span>
40
+ </p>
41
+
42
+ <p
43
+ v-if="message || !!$slots.rightMessage"
44
+ class="unnnic-form-element__message"
29
45
  >
30
46
  {{ message }}
31
- </div>
32
- </div>
47
+
48
+ <span
49
+ v-if="!shouldShowErrorSection && !!$slots.rightMessage"
50
+ class="unnnic-form-element__right-message"
51
+ >
52
+ <slot name="rightMessage"></slot>
53
+ </span>
54
+ </p>
55
+ </section>
33
56
  </template>
34
57
 
35
58
  <script>
59
+ import UnnnicIcon from '../../components/Icon.vue';
60
+
36
61
  export default {
62
+ components: {
63
+ UnnnicIcon,
64
+ },
65
+
37
66
  props: {
38
67
  size: {
39
68
  type: String,
@@ -45,14 +74,25 @@ export default {
45
74
 
46
75
  fixedLabel: Boolean,
47
76
 
48
- error: [Boolean, String],
77
+ error: {
78
+ type: [Boolean, String],
79
+ default: false,
80
+ },
49
81
 
50
82
  message: String,
83
+
84
+ disabled: Boolean,
51
85
  },
52
86
 
53
87
  data() {
54
88
  return {};
55
89
  },
90
+
91
+ computed: {
92
+ shouldShowErrorSection() {
93
+ return this.error && (this.error !== true || !!this.$slots.rightMessage);
94
+ },
95
+ },
56
96
  };
57
97
  </script>
58
98
 
@@ -60,17 +100,19 @@ export default {
60
100
  @import '../../assets/scss/unnnic.scss';
61
101
 
62
102
  .unnnic-form-element {
63
- .label {
64
- margin-bottom: $unnnic-spacing-xs;
103
+ &__label {
104
+ margin: 0;
105
+ margin-bottom: $unnnic-spacing-nano;
65
106
 
66
- $label-bottom-spacing: 3px;
107
+ color: $unnnic-color-neutral-cloudy;
108
+ font-family: $unnnic-font-family-secondary;
109
+ font-weight: $unnnic-font-weight-regular;
110
+ font-size: $unnnic-font-size-body-gt;
111
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
67
112
 
68
- &--fixed.unnnic-font.body-md {
69
- margin-top: -$unnnic-font-size-body-md - $unnnic-line-height-md +
70
- $label-bottom-spacing;
71
- }
113
+ $label-bottom-spacing: 3px;
72
114
 
73
- &--fixed.unnnic-font.body-gt {
115
+ &--fixed {
74
116
  margin-top: -$unnnic-font-size-body-gt - $unnnic-line-height-md +
75
117
  $label-bottom-spacing;
76
118
  }
@@ -93,8 +135,39 @@ export default {
93
135
  }
94
136
  }
95
137
 
96
- .message {
138
+ &__error,
139
+ &__message {
140
+ margin: 0;
97
141
  margin-top: $unnnic-spacing-stack-nano;
142
+
143
+ color: $unnnic-color-neutral-cloudy;
144
+ font-family: $unnnic-font-family-secondary;
145
+ font-weight: $unnnic-font-weight-regular;
146
+ font-size: $unnnic-font-size-body-md;
147
+ line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
148
+ }
149
+
150
+ &__message {
151
+ display: flex;
152
+ column-gap: $unnnic-spacing-nano;
153
+ }
154
+
155
+ &__right-message {
156
+ margin-left: auto;
157
+ }
158
+
159
+ &__error {
160
+ display: flex;
161
+ column-gap: $unnnic-spacing-nano;
162
+ align-items: center;
163
+
164
+ color: $unnnic-color-aux-red-500;
165
+ }
166
+
167
+ &--disabled .unnnic-form-element__label,
168
+ &--disabled .unnnic-form-element__message {
169
+ user-select: none;
170
+ color: $unnnic-color-neutral-cleanest;
98
171
  }
99
172
  }
100
173
  </style>
@@ -46,6 +46,8 @@ export default {
46
46
  type: [String, Array],
47
47
  default: '',
48
48
  },
49
+ hasIconLeft: Boolean,
50
+ hasIconRight: Boolean,
49
51
  },
50
52
  emits: ['update:modelValue'],
51
53
  data() {
@@ -63,7 +65,15 @@ export default {
63
65
  },
64
66
 
65
67
  classes() {
66
- return ['input', `size-${this.size}`, this.type];
68
+ return [
69
+ 'input',
70
+ `size-${this.size}`,
71
+ this.type,
72
+ {
73
+ 'input--has-icon-left': this.hasIconLeft,
74
+ 'input--has-icon-right': this.hasIconRight,
75
+ },
76
+ ];
67
77
  },
68
78
  },
69
79
  };
@@ -71,48 +81,42 @@ export default {
71
81
 
72
82
  <style lang="scss" scoped>
73
83
  @import '../../assets/scss/unnnic.scss';
84
+ @import './Input.scss';
74
85
 
75
86
  .input {
76
- background: $unnnic-color-neutral-snow;
77
- border: none;
78
- outline-style: solid;
79
- outline-color: $unnnic-color-neutral-soft;
80
- outline-width: $unnnic-border-width-thinner;
81
- outline-offset: -$unnnic-border-width-thinner;
82
- border-radius: $unnnic-border-radius-sm;
83
- color: $unnnic-color-neutral-dark;
84
- caret-color: $unnnic-color-neutral-clean;
85
- font-weight: $unnnic-font-weight-regular;
86
- font-family: $unnnic-font-family-secondary;
87
+ @include input-base;
88
+
87
89
  box-sizing: border-box;
88
90
  width: 100%;
89
91
 
90
92
  &.size {
91
93
  &-md {
92
- font-size: $unnnic-font-size-body-gt;
93
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
94
- padding: $unnnic-squish-xs;
94
+ @include input-md-font;
95
+
96
+ padding: ($unnnic-spacing-ant - $unnnic-border-width-thinner)
97
+ ($unnnic-spacing-sm - $unnnic-border-width-thinner);
95
98
  }
96
99
 
97
100
  &-sm {
98
- font-size: $unnnic-font-size-body-md;
99
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-medium;
100
- padding: $unnnic-squish-nano;
101
+ @include input-sm-font;
102
+
103
+ padding: $unnnic-spacing-xs
104
+ ($unnnic-spacing-sm - $unnnic-border-width-thinner);
101
105
  }
102
106
  }
103
107
 
104
- &:focus {
105
- outline-color: $unnnic-color-neutral-clean;
108
+ &.input--has-icon-left {
109
+ padding-left: $unnnic-spacing-sm + $unnnic-icon-size-sm + $unnnic-spacing-xs -
110
+ $unnnic-border-width-thinner;
106
111
  }
107
112
 
108
- &.error {
109
- outline-color: $unnnic-color-feedback-red;
110
- color: $unnnic-color-feedback-red;
113
+ &.input--has-icon-right {
114
+ padding-right: $unnnic-spacing-sm + $unnnic-icon-size-sm +
115
+ $unnnic-spacing-xs - $unnnic-border-width-thinner;
111
116
  }
112
117
 
113
- &::placeholder {
114
- color: $unnnic-color-neutral-cleanest;
115
- opacity: 1; /* Firefox */
118
+ &.error {
119
+ @include input-error;
116
120
  }
117
121
 
118
122
  &:-ms-input-placeholder,
@@ -120,17 +124,5 @@ export default {
120
124
  /* Internet Explorer 10-11 */
121
125
  color: $unnnic-color-brand-sec;
122
126
  }
123
-
124
- &:disabled {
125
- outline-color: $unnnic-color-neutral-cleanest;
126
- background-color: $unnnic-color-neutral-lightest;
127
- cursor: not-allowed;
128
- color: $unnnic-color-neutral-cleanest;
129
-
130
- &::placeholder {
131
- color: $unnnic-color-neutral-cleanest;
132
- opacity: 1; /* Firefox */
133
- }
134
- }
135
127
  }
136
128
  </style>
@@ -0,0 +1,43 @@
1
+ @import '../../assets/scss/unnnic.scss';
2
+
3
+ @mixin input-base {
4
+ background: $unnnic-color-neutral-white;
5
+ border: $unnnic-border-width-thinner solid $unnnic-color-neutral-clean;
6
+ outline: none;
7
+ border-radius: $unnnic-border-radius-sm;
8
+ color: $unnnic-color-neutral-darkest;
9
+ caret-color: $unnnic-color-neutral-clean;
10
+ font-weight: $unnnic-font-weight-regular;
11
+ font-family: $unnnic-font-family-secondary;
12
+
13
+ &:focus {
14
+ border-color: $unnnic-color-weni-600;
15
+ }
16
+
17
+ &::placeholder {
18
+ color: $unnnic-color-neutral-cleanest;
19
+ opacity: 1; /* Firefox */
20
+ }
21
+
22
+ &:disabled {
23
+ border-color: $unnnic-color-neutral-cleanest;
24
+ background-color: $unnnic-color-neutral-lightest;
25
+ cursor: not-allowed;
26
+ color: $unnnic-color-neutral-cleanest;
27
+ }
28
+ }
29
+
30
+ @mixin input-sm-font {
31
+ font-size: $unnnic-font-size-body-md;
32
+ line-height: $unnnic-font-size-body-md + $unnnic-line-height-medium;
33
+ }
34
+
35
+ @mixin input-md-font {
36
+ font-size: $unnnic-font-size-body-gt;
37
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
38
+ }
39
+
40
+ @mixin input-error {
41
+ border-color: $unnnic-color-aux-red-500;
42
+ color: $unnnic-color-aux-red-500;
43
+ }
@@ -3,10 +3,7 @@
3
3
  :class="[
4
4
  'text-input',
5
5
  `size--${size}`,
6
- {
7
- 'has-icon-left': !!iconLeft,
8
- 'has-icon-right': !!iconRight || allowTogglePassword,
9
- },
6
+ `text-input--icon-right-size-${iconRightSize}`,
10
7
  ]"
11
8
  >
12
9
  <BaseInput
@@ -19,6 +16,8 @@
19
16
  "
20
17
  :type="type"
21
18
  class="input-itself"
19
+ :hasIconLeft="!!iconLeft"
20
+ :hasIconRight="!!iconRight || allowTogglePassword"
22
21
  @focus="onFocus"
23
22
  @blur="onBlur"
24
23
  />
@@ -37,7 +36,7 @@
37
36
  v-if="iconRightSvg"
38
37
  :scheme="iconScheme"
39
38
  :icon="iconRightSvg"
40
- size="sm"
39
+ :size="iconRightSize"
41
40
  :clickable="iconRightClickable || allowTogglePassword"
42
41
  :class="[
43
42
  'icon-right',
@@ -93,6 +92,10 @@ export default {
93
92
  type: Boolean,
94
93
  default: null,
95
94
  },
95
+ iconRightSize: {
96
+ type: String,
97
+ default: 'sm',
98
+ },
96
99
  allowTogglePassword: {
97
100
  type: Boolean,
98
101
  default: null,
@@ -110,11 +113,14 @@ export default {
110
113
  data() {
111
114
  return {
112
115
  isFocused: false,
113
- isDisabled: false,
114
116
  showPassword: false,
115
117
  };
116
118
  },
117
119
  computed: {
120
+ isDisabled() {
121
+ return this.$attrs.disabled;
122
+ },
123
+
118
124
  iconRightSvg() {
119
125
  if (this.allowTogglePassword) {
120
126
  return this.showPassword ? 'view-off-1' : 'view-1-1';
@@ -125,7 +131,7 @@ export default {
125
131
 
126
132
  iconScheme() {
127
133
  if (this.type === 'error') {
128
- return 'feedback-red';
134
+ return 'aux-red-500';
129
135
  }
130
136
 
131
137
  if (this.isDisabled) {
@@ -147,9 +153,7 @@ export default {
147
153
  return { ...this.$attrs, ...this.$attrs['v-bind'], ...this.$props };
148
154
  },
149
155
  },
150
- mounted() {
151
- this.isDisabled = !!this.$refs['base-input'].$el.disabled;
152
- },
156
+
153
157
  methods: {
154
158
  focus() {
155
159
  this.$refs['base-input'].$el.focus();
@@ -190,36 +194,31 @@ export default {
190
194
  &-left {
191
195
  position: absolute;
192
196
  top: $unnnic-spacing-ant + 0.1875 * $unnnic-font-size;
193
- left: $unnnic-inline-sm;
197
+ left: $unnnic-inline-sm - $unnnic-border-width-thinner;
194
198
  }
195
199
 
196
200
  &-right {
197
201
  position: absolute;
198
202
  top: $unnnic-spacing-ant + 0.1875 * $unnnic-font-size;
199
- right: $unnnic-inline-sm;
203
+ right: $unnnic-inline-sm - $unnnic-border-width-thinner;
200
204
  }
201
205
  }
202
206
  .text-input {
203
207
  position: relative;
204
208
 
205
- &.size--md,
206
- &.size--sm {
207
- &.has-icon-left .input-itself {
208
- padding-left: $unnnic-spacing-sm + $unnnic-icon-size-sm +
209
- $unnnic-spacing-xs;
210
- }
211
-
212
- &.has-icon-right .input-itself {
213
- padding-right: $unnnic-spacing-sm + $unnnic-icon-size-sm +
214
- $unnnic-spacing-xs;
215
- }
216
- }
217
-
218
209
  &.size--sm {
219
210
  .icon-left,
220
211
  .icon-right {
221
212
  top: $unnnic-spacing-xs + 0.125 * $unnnic-font-size;
222
213
  }
223
214
  }
215
+
216
+ &.size--sm.text-input--icon-right-size-ant .icon-right {
217
+ top: 0.5625 * $unnnic-font-size;
218
+ }
219
+
220
+ &.size--md.text-input--icon-right-size-ant .icon-right {
221
+ top: 0.8125 * $unnnic-font-size;
222
+ }
224
223
  }
225
224
  </style>
@@ -74,11 +74,11 @@ describe('TextInput.vue', () => {
74
74
 
75
75
  test('computes the correct iconScheme based on various states', async () => {
76
76
  await wrapper.setProps({ type: 'error' });
77
- expect(wrapper.vm.iconScheme).toBe('feedback-red');
77
+ expect(wrapper.vm.iconScheme).toBe('aux-red-500');
78
78
 
79
79
  await wrapper.setProps({ type: 'normal' });
80
80
  await wrapper.setData({ isDisabled: true });
81
- expect(wrapper.vm.iconScheme).toBe('neutral-cleanest');
81
+ expect(wrapper.vm.iconScheme).toBe('neutral-cloudy');
82
82
 
83
83
  await wrapper.setData({ isDisabled: false });
84
84
  await wrapper.setProps({ modelValue: 'text' });
@@ -3,7 +3,7 @@
3
3
  exports[`Input.vue > matches the snapshot 1`] = `
4
4
  "<div data-v-d890ad85="" class="unnnic-form md">
5
5
  <p data-v-d890ad85="" class="unnnic-form__label">Sample Label</p>
6
- <div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md has-icon-left has-icon-right unnnic-form-input" mask="####-####"><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-form-input input-itself input size-md normal unnnic-form-input input-itself" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" hascloudycolor="false" type="text"><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--neutral-cloudy unnnic-icon-size--sm unnnic--clickable icon-left clickable" data-testid="material-icon">search</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--neutral-cloudy unnnic-icon-size--sm unnnic--clickable icon-right clickable" data-testid="material-icon">clear</span></div>
6
+ <div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md text-input--icon-right-size-sm unnnic-form-input" mask="####-####"><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-form-input input-itself input size-md normal input--has-icon-left input--has-icon-right unnnic-form-input input-itself" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" iconrightsize="sm" hascloudycolor="false" type="text"><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--neutral-cloudy unnnic-icon-size--sm unnnic--clickable icon-left clickable" data-testid="material-icon">search</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--neutral-cloudy unnnic-icon-size--sm unnnic--clickable icon-right clickable" data-testid="material-icon">clear</span></div>
7
7
  <p data-v-d890ad85="" class="unnnic-form__message">Error message</p>
8
8
  </div>"
9
9
  `;
@@ -1,3 +1,3 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`TextInput.vue > matches the snapshot 1`] = `"<div data-v-a0d36167="" class="text-input size--md has-icon-left has-icon-right"><input data-v-86533b41="" data-v-a0d36167="" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" allowtogglepassword="false" hascloudycolor="false" class="input-itself input size-md normal input-itself" type="text"><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--neutral-cloudy unnnic-icon-size--sm unnnic--clickable icon-left clickable" data-testid="material-icon">search</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--neutral-cloudy unnnic-icon-size--sm unnnic--clickable icon-right clickable" data-testid="material-icon">clear</span></div>"`;
3
+ exports[`TextInput.vue > matches the snapshot 1`] = `"<div data-v-a0d36167="" class="text-input size--md text-input--icon-right-size-sm"><input data-v-86533b41="" data-v-a0d36167="" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" iconrightsize="sm" allowtogglepassword="false" hascloudycolor="false" class="input-itself input size-md normal input--has-icon-left input--has-icon-right input-itself" type="text"><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--neutral-cloudy unnnic-icon-size--sm unnnic--clickable icon-left clickable" data-testid="material-icon">search</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--neutral-cloudy unnnic-icon-size--sm unnnic--clickable icon-right clickable" data-testid="material-icon">clear</span></div>"`;
@@ -6,6 +6,7 @@
6
6
  size="small"
7
7
  iconCenter="arrow-left-1-1"
8
8
  :disabled="!canPrevious || disabled"
9
+ data-test="previous-button"
9
10
  @click="previousPage"
10
11
  />
11
12
 
@@ -18,6 +19,7 @@
18
19
  ['left-hidden', 'right-hidden'].includes(page) ? '...' : String(page)
19
20
  "
20
21
  :disabled="disabled"
22
+ data-test="page-button"
21
23
  @click="selectPage(page)"
22
24
  />
23
25
 
@@ -26,6 +28,7 @@
26
28
  size="small"
27
29
  iconCenter="arrow-right-1-1"
28
30
  :disabled="!canNext || disabled"
31
+ data-test="next-button"
29
32
  @click="nextPage"
30
33
  />
31
34
  </div>
@@ -61,6 +64,8 @@ export default {
61
64
  },
62
65
  },
63
66
 
67
+ emits: ['update:model-value'],
68
+
64
69
  data() {
65
70
  return {
66
71
  reference: 3,
@@ -102,19 +107,33 @@ export default {
102
107
  },
103
108
  },
104
109
 
110
+ created() {
111
+ const pageNumber = this.modelValue;
112
+
113
+ this.selectPage(pageNumber, true);
114
+
115
+ if (!this.pages.includes(pageNumber)) {
116
+ this.setReference(pageNumber);
117
+ }
118
+ },
119
+
105
120
  methods: {
106
- selectPage(page) {
121
+ selectPage(page, dontEmit) {
107
122
  if (page === 'left-hidden') {
108
123
  const pageNumber =
109
124
  this.pages[this.pages.indexOf('left-hidden') + 1] - 1;
110
125
 
111
- this.$emit('update:model-value', pageNumber);
126
+ if (!dontEmit) {
127
+ this.$emit('update:model-value', pageNumber);
128
+ }
112
129
  this.setReference(pageNumber);
113
130
  } else if (page === 'right-hidden') {
114
131
  const pageNumber =
115
132
  this.pages[this.pages.indexOf('right-hidden') - 1] + 1;
116
133
 
117
- this.$emit('update:model-value', pageNumber);
134
+ if (!dontEmit) {
135
+ this.$emit('update:model-value', pageNumber);
136
+ }
118
137
 
119
138
  if (this.pages.includes('left-hidden')) {
120
139
  this.setReference(
@@ -123,7 +142,7 @@ export default {
123
142
  } else {
124
143
  this.setReference(4);
125
144
  }
126
- } else {
145
+ } else if (!dontEmit) {
127
146
  this.$emit('update:model-value', page);
128
147
  }
129
148
  },