@eturnity/eturnity_reusable_components 8.31.1 → 8.31.3

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.
@@ -1,7 +1,7 @@
1
1
  import "./main.es3.js";
2
2
  import styled from "./main.es7.js";
3
3
  import { fetchIcon } from "./main.es381.js";
4
- import { reactive } from "./main.es19.js";
4
+ import { reactive } from "./main.es18.js";
5
5
  import { computed, onMounted, watch, openBlock, createBlock, withCtx, createVNode, createElementVNode as createBaseVNode, createTextVNode, createCommentVNode } from "./main.es6.js";
6
6
  import { toDisplayString } from "./main.es16.js";
7
7
  const _hoisted_1 = ["innerHTML"];
package/dist/main.es6.js CHANGED
@@ -1,5 +1,5 @@
1
- import { isRef, toRaw, getCurrentScope, isShallow as isShallow$1, isReactive, ReactiveEffect, isProxy, computed as computed$1, pauseTracking, resetTracking, isReadonly, track, proxyRefs, markRaw, shallowReadonly, EffectScope, reactive, shallowReactive, trigger } from "./main.es19.js";
2
- import { readonly, ref, shallowRef, unref } from "./main.es19.js";
1
+ import { isRef, toRaw, getCurrentScope, isShallow as isShallow$1, isReactive, ReactiveEffect, isProxy, computed as computed$1, pauseTracking, resetTracking, isReadonly, track, proxyRefs, markRaw, shallowReadonly, EffectScope, reactive, shallowReactive, trigger } from "./main.es18.js";
2
+ import { readonly, ref, shallowRef, unref } from "./main.es18.js";
3
3
  import { isString, isFunction, getGlobalThis, isArray, NOOP, EMPTY_OBJ, normalizeClass, isObject, extend, normalizeStyle, isOn, isPromise, hasChanged, remove, isSet, isMap, isPlainObject, camelize, capitalize, toHandlerKey, hasOwn, EMPTY_ARR, NO, isBuiltInDirective, isReservedProp, invokeArrayFns, makeMap, looseToNumber, hyphenate, def, toRawType, isModelListener } from "./main.es16.js";
4
4
  import { toDisplayString } from "./main.es16.js";
5
5
  const stack = [];
package/dist/main.es9.js CHANGED
@@ -1,4 +1,4 @@
1
- import RCButton from "./main.es17.js";
1
+ import RCButton from "./main.es25.js";
2
2
  import "./main.es3.js";
3
3
  import _export_sfc from "./main.es11.js";
4
4
  import { resolveComponent, openBlock, createBlock } from "./main.es6.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "8.31.1",
3
+ "version": "8.31.3",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -63,6 +63,19 @@ export default {
63
63
  options: ['fill', 'stroke'],
64
64
  description: 'How to fill the icon',
65
65
  },
66
+ showCaret: {
67
+ control: 'boolean',
68
+ description: 'Whether to render a caret after the text',
69
+ },
70
+ numberCountType: {
71
+ control: 'select',
72
+ options: ['inline', 'badge'],
73
+ description: 'How to render the number count',
74
+ },
75
+ numberCount: {
76
+ control: 'text',
77
+ description: 'Number count to display',
78
+ },
66
79
  },
67
80
  }
68
81
 
@@ -98,8 +98,9 @@ describe('ButtonIcon.vue', () => {
98
98
  })
99
99
 
100
100
  it('renders number count when provided', async () => {
101
- const numberCount = 5
102
- await wrapper.setProps({ numberCount })
101
+ const numberCount = '5'
102
+ let numberCountType = 'inline'
103
+ await wrapper.setProps({ numberCount, numberCountType })
103
104
  const numberContainer = wrapper.find(
104
105
  '[data-test-id="button-icon-number-container"]'
105
106
  )
@@ -107,6 +108,12 @@ describe('ButtonIcon.vue', () => {
107
108
  expect(numberContainer.exists()).toBe(true)
108
109
  expect(numberText.exists()).toBe(true)
109
110
  expect(numberText.text()).toBe(numberCount.toString())
111
+
112
+ numberCountType = 'badge'
113
+ await wrapper.setProps({ numberCount, numberCountType })
114
+ const countBadge = wrapper.find('[data-test-id="button-icon-number-badge"]')
115
+ expect(countBadge.exists()).toBe(true)
116
+ expect(countBadge.text()).toBe(numberCount.toString())
110
117
  })
111
118
 
112
119
  it('applies different button sizes correctly', async () => {
@@ -149,4 +156,14 @@ describe('ButtonIcon.vue', () => {
149
156
  expect(wrapper.props('appTheme')).toBe(theme)
150
157
  }
151
158
  })
159
+
160
+ it('renders caret based on showCaret prop', async () => {
161
+ await wrapper.setProps({ showCaret: true })
162
+ let caret = wrapper.find('[data-test-id="button-icon-caret"]')
163
+ expect(caret.exists()).toBe(true)
164
+
165
+ await wrapper.setProps({ showCaret: false })
166
+ caret = wrapper.find('[data-test-id="button-icon-caret"]')
167
+ expect(caret.exists()).toBe(false)
168
+ })
152
169
  })
@@ -41,15 +41,36 @@
41
41
  :height="height"
42
42
  >
43
43
  {{ text }}
44
+ <Icon
45
+ v-if="showCaret"
46
+ :color="
47
+ iconColor ||
48
+ theme.mainButton[appTheme][type][variant].default.textColor
49
+ "
50
+ data-test-id="button-icon-caret"
51
+ :disable-hover="disableIconHover"
52
+ :hovered-color="
53
+ iconColor ||
54
+ theme.mainButton[appTheme][type][variant].default.textColor
55
+ "
56
+ name="arrow_down"
57
+ size="8px"
58
+ />
44
59
  </ButtonContainer>
45
60
  <NumberContainer
46
- v-if="numberCount"
61
+ v-if="numberCount && numberCountType === 'inline'"
47
62
  data-test-id="button-icon-number-container"
48
63
  >
49
64
  <NumberText data-test-id="button-icon-number">{{
50
65
  numberCount
51
66
  }}</NumberText>
52
67
  </NumberContainer>
68
+ <CountBadge
69
+ v-else-if="numberCount && numberCountType === 'badge'"
70
+ data-test-id="button-icon-number-badge"
71
+ >
72
+ {{ numberCount }}
73
+ </CountBadge>
53
74
  </ButtonWrapper>
54
75
  </PageContainer>
55
76
  </template>
@@ -84,6 +105,7 @@
84
105
  height: String,
85
106
  }
86
107
  const ButtonWrapper = styled('div', ButtonAttrs)`
108
+ position: relative;
87
109
  display: grid;
88
110
  grid-template-columns: auto 1fr auto;
89
111
  height: ${({ height }) => height};
@@ -120,7 +142,7 @@
120
142
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
121
143
  user-select: none;
122
144
  border-radius: 4px;
123
- overflow: hidden;
145
+ overflow: visible;
124
146
  min-width: ${(props) => props.minWidth || 'initial'};
125
147
 
126
148
  &:hover {
@@ -155,6 +177,7 @@
155
177
  justify-content: center;
156
178
  padding: ${(props) =>
157
179
  props.theme?.mainButton?.size?.[props.buttonSize]?.padding};
180
+ gap: 8px;
158
181
  white-space: nowrap;
159
182
  `
160
183
 
@@ -200,6 +223,26 @@
200
223
  background-color: ${(props) => props.theme.semanticColors.purple[50]};
201
224
  `
202
225
 
226
+ const CountBadge = styled('div')`
227
+ position: absolute;
228
+ grid-area: 1 / 1 / 2 / 4;
229
+ top: -3.5px;
230
+ right: 0px;
231
+ transform: translateX(50%);
232
+ padding: 0 2px;
233
+ background-color: ${({ theme }) => theme.colors.red};
234
+ color: ${({ theme }) => theme.colors.white};
235
+ border-radius: 4px;
236
+ height: 15px;
237
+ min-width: 11px;
238
+ display: flex;
239
+ justify-content: center;
240
+ align-items: center;
241
+ font-size: 10px;
242
+ z-index: 1;
243
+ pointer-events: none;
244
+ `
245
+
203
246
  export default {
204
247
  name: 'ButtonIcon',
205
248
  components: {
@@ -210,6 +253,7 @@
210
253
  Icon,
211
254
  NumberContainer,
212
255
  NumberText,
256
+ CountBadge,
213
257
  },
214
258
  props: {
215
259
  type: {
@@ -285,14 +329,23 @@
285
329
  default: false,
286
330
  },
287
331
  numberCount: {
288
- type: Number,
332
+ type: String,
289
333
  required: false,
290
334
  default: null,
291
335
  },
336
+ numberCountType: {
337
+ type: String,
338
+ required: false,
339
+ default: 'inline',
340
+ },
292
341
  height: {
293
342
  type: String,
294
343
  default: 'auto',
295
344
  },
345
+ showCaret: {
346
+ type: Boolean,
347
+ default: false,
348
+ },
296
349
  },
297
350
  data() {
298
351
  return {
@@ -21,7 +21,7 @@
21
21
  :name="icon"
22
22
  size="14px"
23
23
  />
24
- {{ text }}
24
+ {{ isFirstLetterCapitalized ? capitalizeFirstLetter(text) : text }}
25
25
  </LabelComponent>
26
26
  </ButtonContainer>
27
27
  </PageContainer>
@@ -231,6 +231,10 @@
231
231
  default: 'medium',
232
232
  required: false,
233
233
  },
234
+ isFirstLetterCapitalized: {
235
+ type: Boolean,
236
+ default: false,
237
+ },
234
238
  },
235
239
  computed: {
236
240
  theme() {
@@ -246,5 +250,10 @@
246
250
  .default.textColor
247
251
  },
248
252
  },
253
+ methods: {
254
+ capitalizeFirstLetter(word) {
255
+ return word.charAt(0).toUpperCase() + word.slice(1)
256
+ },
257
+ },
249
258
  }
250
259
  </script>
@@ -3,6 +3,7 @@
3
3
  <InputWrapper
4
4
  :icon-color="iconColor"
5
5
  :icon-position="iconPosition"
6
+ :input-height="inputHeight"
6
7
  :is-full-height="isFullHeight"
7
8
  >
8
9
  <SearchIconSvg class="search-icn" />
@@ -12,6 +13,7 @@
12
13
  :data-qa-id="dataQaId"
13
14
  :disabled="disabled"
14
15
  :has-focus="hasFocus"
16
+ :input-height="inputHeight"
15
17
  :input-width="inputWidth"
16
18
  :is-disabled="disabled"
17
19
  :is-filter="isFilter"
@@ -47,6 +49,7 @@
47
49
  inputWidth: String,
48
50
  isFilter: Boolean,
49
51
  isFullHeight: Boolean,
52
+ inputHeight: String,
50
53
  }
51
54
  const Container = styled('div', inputAttrs)`
52
55
  width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
@@ -61,7 +64,7 @@
61
64
  font-size: 13px;
62
65
  color: ${(props) => props.theme.colors.black};
63
66
  width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
64
- height: ${(props) => (props.isFullHeight ? '100%' : 'auto')};
67
+ height: ${(props) => (props.isFullHeight ? '100%' : props.inputHeight)};
65
68
  box-sizing: border-box;
66
69
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
67
70
  background: ${(props) => props.theme.colors.white} !important;
@@ -78,10 +81,12 @@
78
81
  iconColor: String,
79
82
  iconPosition: String,
80
83
  isFullHeight: Boolean,
84
+ inputHeight: String,
81
85
  }
82
86
  const InputWrapper = styled('div', wrapperAttrs)`
83
87
  position: relative;
84
- height: ${(props) => (props.isFullHeight ? '100%' : 'auto')};
88
+ height: ${({ isFullHeight, inputHeight }) =>
89
+ isFullHeight ? '100%' : inputHeight};
85
90
 
86
91
  svg {
87
92
  position: absolute;
@@ -158,6 +163,10 @@
158
163
  type: Boolean,
159
164
  default: false,
160
165
  },
166
+ inputHeight: {
167
+ type: String,
168
+ default: 'auto',
169
+ },
161
170
  },
162
171
  emits: ['on-change'],
163
172
  watch: {