@eturnity/eturnity_reusable_components 8.13.13-epic-shading.0 → 8.13.13-epic-shading.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "8.13.13-epic-shading.0",
3
+ "version": "8.13.13-epic-shading.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 5"><g data-name="Layer 2"><path fill="#ffffff" d="M0 0h8L4 5 0 0z" data-name="Layer 1"/></g></svg>
@@ -2,8 +2,7 @@
2
2
  <CardContainer
3
3
  data-test-id="draggable_card_container"
4
4
  :initial-position="initialPosition"
5
- :max-width="maxWidth"
6
- :min-width="minWidth"
5
+ :width="width"
7
6
  >
8
7
  <HeaderContainer data-test-id="draggable_card_header">
9
8
  <SubHeaderWrapper>
@@ -29,7 +28,7 @@
29
28
  :is-collapsed="isCollapsed"
30
29
  @click="toggleCollapse"
31
30
  >
32
- <CollapseArrowIcon />
31
+ <img :src="CollapseArrowIconUrl" />
33
32
  </ArrowIconWrapper>
34
33
  </LeftIconsContainer>
35
34
  <TitleContainer :data-id="titleDataId">
@@ -58,20 +57,18 @@
58
57
  import RCIcon from '../icon'
59
58
  import CloseButton from '../buttons/closeButton'
60
59
  import InfoText from '../infoText'
61
- import CollapseArrowIcon from '../../assets/icons/collapse_arrow_icon.svg'
60
+ import CollapseArrowIconUrl from '../../assets/icons/collapse_arrow_icon_white.svg?url'
62
61
 
63
62
  const CardContainerAttr = {
64
63
  initialPosition: Object,
65
- minWidth: String,
66
- maxWidth: String,
64
+ width: String,
67
65
  }
68
66
  const CardContainer = styled('div', CardContainerAttr)`
69
67
  position: absolute;
70
68
  display: flex;
71
69
  flex-direction: column;
72
70
  border-radius: 4px;
73
- min-width: ${(props) => props.minWidth};
74
- max-width: ${(props) => props.maxWidth};
71
+ width: ${(props) => props.width};
75
72
  background: ${theme.colors.transparentBlack2};
76
73
  z-index: 5;
77
74
  ${(props) =>
@@ -96,9 +93,8 @@
96
93
  display: flex;
97
94
  min-width: 180px;
98
95
  align-items: center;
99
- justify-content: space-between;
100
96
  height: fit-content;
101
- margin-right: 14px;
97
+ margin-right: 30px;
102
98
  `
103
99
 
104
100
  const LeftIconsContainer = styled.div`
@@ -149,10 +145,6 @@
149
145
  height: 26px;
150
146
  cursor: pointer;
151
147
  transition: transform 0.3s ease;
152
- path {
153
- fill: ${theme.colors.white};
154
- }
155
-
156
148
  ${(props) => props.isCollapsed && 'transform: rotate(-180deg);'}
157
149
  `
158
150
 
@@ -191,7 +183,6 @@
191
183
  TextContainer,
192
184
  DragHandleWrapper,
193
185
  ArrowIconWrapper,
194
- CollapseArrowIcon,
195
186
  RCIcon,
196
187
  CloseButton,
197
188
  InfoText,
@@ -200,11 +191,7 @@
200
191
  FooterContainer,
201
192
  },
202
193
  props: {
203
- minWidth: {
204
- required: true,
205
- type: String,
206
- },
207
- maxWidth: {
194
+ width: {
208
195
  required: true,
209
196
  type: String,
210
197
  },
@@ -252,6 +239,7 @@
252
239
  x: 0,
253
240
  y: 0,
254
241
  },
242
+ CollapseArrowIconUrl,
255
243
  }
256
244
  },
257
245
  computed: {
@@ -259,16 +247,21 @@
259
247
  const minPosition = this.dragBounds?.min
260
248
  const maxPosition = this.dragBounds?.max
261
249
  return (
262
- minPosition?.top &&
263
- minPosition?.left &&
264
- maxPosition?.top &&
265
- maxPosition?.left
250
+ Number.isFinite(minPosition?.top) &&
251
+ Number.isFinite(minPosition?.left) &&
252
+ Number.isFinite(maxPosition?.top) &&
253
+ Number.isFinite(maxPosition?.left)
266
254
  )
267
255
  },
268
256
  theme() {
269
257
  return theme
270
258
  },
271
259
  },
260
+ watch: {
261
+ dragBounds() {
262
+ this.clampElementPosition()
263
+ },
264
+ },
272
265
  beforeUnmount() {
273
266
  this.removeEvents()
274
267
  },
@@ -316,25 +309,41 @@
316
309
  const element = this.$el
317
310
  let positionY = element.offsetTop - deltaY
318
311
  let positionX = element.offsetLeft - deltaX
319
- if (this.dragBoundsEnabled) {
320
- const minPosition = this.dragBounds.min
321
- const maxPosition = this.dragBounds.max
322
- positionY = Math.min(
323
- Math.max(positionY, minPosition.top),
324
- maxPosition.top
325
- )
326
- positionX = Math.min(
327
- Math.max(positionX, minPosition.left),
328
- maxPosition.left
329
- )
330
- }
331
312
  element.style.top = positionY + 'px'
332
313
  element.style.left = positionX + 'px'
314
+ if (this.dragBoundsEnabled) {
315
+ this.clampElementPosition()
316
+ }
333
317
  },
334
318
  onDragEnd() {
335
319
  this.isDragging = false
336
320
  this.removeEvents()
337
321
  },
322
+ clampElementPosition() {
323
+ if (!this.dragBoundsEnabled) return
324
+
325
+ const element = this.$el
326
+ const rect = element.getBoundingClientRect()
327
+ const computedStyle = window.getComputedStyle(element)
328
+ const currentX = parseFloat(computedStyle.left) || 0
329
+ const currentY = parseFloat(computedStyle.top) || 0
330
+
331
+ const minPosition = this.dragBounds.min
332
+ const maxPosition = this.dragBounds.max
333
+
334
+ const y = Math.min(
335
+ Math.max(currentY, minPosition.top),
336
+ maxPosition.top - rect.height
337
+ )
338
+
339
+ const x = Math.min(
340
+ Math.max(currentX, minPosition.left),
341
+ maxPosition.left - rect.width
342
+ )
343
+
344
+ element.style.top = y + 'px'
345
+ element.style.left = x + 'px'
346
+ },
338
347
  removeEvents() {
339
348
  this.dragTargets.forEach((id) => {
340
349
  const target =