@eturnity/eturnity_reusable_components 8.37.0 → 8.37.1-dev-03-elisee-8.37.0

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": "@eturnity/eturnity_reusable_components",
3
- "version": "8.37.0",
3
+ "version": "8.37.1-dev-03-elisee-8.37.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -16,6 +16,9 @@
16
16
  :width="width"
17
17
  >
18
18
  <LabelComponent :has-icon="Boolean(icon)" :reverse-direction="iconLast">
19
+ <FlexSpinner v-if="isLoading">
20
+ <RCSpinner size="tiny" />
21
+ </FlexSpinner>
19
22
  <Icon
20
23
  v-if="icon"
21
24
  :color="getIconColor"
@@ -44,6 +47,7 @@
44
47
  // />
45
48
 
46
49
  import styled from 'vue3-styled-components'
50
+ import RCSpinner from '../../spinner'
47
51
  import Icon from '../../icon'
48
52
  import theme from '../../../assets/theme'
49
53
 
@@ -174,6 +178,10 @@
174
178
  transform: rotate(20deg);
175
179
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
176
180
  `
181
+ const FlexSpinner = styled('div')`
182
+ flex: 0;
183
+ margin-right: 8px;
184
+ `
177
185
 
178
186
  export default {
179
187
  name: 'MainButton',
@@ -183,6 +191,8 @@
183
191
  PageContainer,
184
192
  ButtonContainer,
185
193
  BetaTag,
194
+ RCSpinner,
195
+ FlexSpinner,
186
196
  },
187
197
  props: {
188
198
  type: {
@@ -285,6 +295,10 @@
285
295
  type: Boolean,
286
296
  default: false,
287
297
  },
298
+ isLoading: {
299
+ type: Boolean,
300
+ default: false,
301
+ },
288
302
  },
289
303
  computed: {
290
304
  theme() {
@@ -93,7 +93,7 @@
93
93
  v-if="hasError && hasErrorMessage"
94
94
  data-test-id="error_message_wrapper"
95
95
  >
96
- {{ dynamicErrorMessage }}
96
+ {{ errorMessage }}
97
97
  </ErrorMessage>
98
98
  </InputErrorWrapper>
99
99
  </InputWrapper>
@@ -444,9 +444,6 @@
444
444
  hasErrorMessage() {
445
445
  return this.errorMessage && this.errorMessage.length > 0
446
446
  },
447
- dynamicErrorMessage() {
448
- return this.errorMessage
449
- },
450
447
  },
451
448
  watch: {
452
449
  hasFocus(newVal) {
@@ -201,6 +201,12 @@
201
201
  </SelectDropdown>
202
202
  </Component>
203
203
  </DropdownWrapper>
204
+ <ErrorMessage
205
+ v-if="hasError && hasErrorMessage"
206
+ data-test-id="error_message_wrapper"
207
+ >
208
+ {{ errorMessage }}
209
+ </ErrorMessage>
204
210
  </SelectButtonWrapper>
205
211
  </InputWrapper>
206
212
  </Container>
@@ -233,6 +239,7 @@
233
239
  import { Teleport, inject } from 'vue'
234
240
  import styled from 'vue3-styled-components'
235
241
  import InfoText from '../../infoText'
242
+ import ErrorMessage from '../../errorMessage'
236
243
  import Icon from '../../icon'
237
244
  import InputText from '../inputText'
238
245
  import DraggableInputHandle from '../../draggableInputHandle'
@@ -302,7 +309,6 @@
302
309
  const Container = styled('div', inputProps)`
303
310
  width: ${(props) => props.selectWidth};
304
311
  position: ${(props) => (props.noRelative ? 'static' : 'relative')};
305
- display: inline-block;
306
312
  text-align: ${(props) => (props.textCenter ? 'center' : 'left')};
307
313
  `
308
314
 
@@ -514,6 +520,7 @@
514
520
  Teleport,
515
521
  DraggableInputHandle,
516
522
  IsRequiredLabelStar,
523
+ ErrorMessage,
517
524
  },
518
525
 
519
526
  props: {
@@ -620,9 +627,14 @@
620
627
  default: true,
621
628
  },
622
629
  hasError: {
630
+ type: Boolean,
623
631
  required: false,
624
632
  default: false,
625
633
  },
634
+ errorMessage: {
635
+ type: String,
636
+ default: '',
637
+ },
626
638
  disabled: {
627
639
  required: false,
628
640
  type: Boolean,
@@ -735,6 +747,9 @@
735
747
  }
736
748
  },
737
749
  computed: {
750
+ hasErrorMessage() {
751
+ return this.errorMessage && this.errorMessage.length > 0
752
+ },
738
753
  optionLength() {
739
754
  if (this.isDropdownOpen) {
740
755
  return this.$refs.dropdown.$el.childElementCount > 1
@@ -159,17 +159,35 @@
159
159
  theme,
160
160
  }
161
161
  },
162
- computed: {},
162
+ computed: {
163
+ selectDropdownParent() {
164
+ // Search up the component hierarchy for the dropdown component
165
+ let parent = this.$parent
166
+ let iterations = 0
167
+ const maxIterations = 5
168
+
169
+ while (parent && iterations < maxIterations) {
170
+ if (parent.$attrs.class == 'rc-select-dropdown') {
171
+ return parent
172
+ }
173
+ parent = parent.$parent
174
+ iterations++
175
+ }
176
+
177
+ return this.$parent
178
+ },
179
+ },
163
180
  methods: {
164
181
  clickHandler(e) {
165
182
  if (this.isDisabled || !!this.$attrs?.onClick) {
166
183
  // prevent emitter if the option is disabled
167
184
  return
168
185
  }
169
- this.$parent.$emit('option-selected', this.value, e)
186
+ // Pass the component instance along with the value
187
+ this.selectDropdownParent.$emit('option-selected', this.value, this, e)
170
188
  },
171
189
  hoverHandler() {
172
- this.$parent.$emit('option-hovered', this.value)
190
+ this.selectDropdownParent.$emit('option-hovered', this.value)
173
191
  },
174
192
  },
175
193
  }
@@ -25,6 +25,8 @@
25
25
  :resize="resize"
26
26
  :rows="rowHeight"
27
27
  :value="value"
28
+ @blur="onInputBlur"
29
+ @focus="onInputFocus"
28
30
  @input="onChangeHandler"
29
31
  ></textarea>
30
32
  </InputContainer>
@@ -208,6 +210,12 @@
208
210
  }
209
211
  this.$emit('input-change', $event.target.value)
210
212
  },
213
+ onInputBlur($event) {
214
+ this.$emit('input-blur', $event.target.value)
215
+ },
216
+ onInputFocus($event) {
217
+ this.$emit('input-focus', $event.target.value)
218
+ },
211
219
  },
212
220
  }
213
221
  </script>
@@ -59,6 +59,8 @@
59
59
 
60
60
  const getSpinnerSize = (size) => {
61
61
  switch (size) {
62
+ case 'tiny':
63
+ return '16px'
62
64
  case 'small':
63
65
  return '24px'
64
66
  case 'large':