@eturnity/eturnity_reusable_components 8.13.13-SLD.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-SLD.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>
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M8 0.5C8.27614 0.5 8.5 0.723858 8.5 1V2.86667C8.5 3.14281 8.27614 3.36667 8 3.36667C7.72386 3.36667 7.5 3.14281 7.5 2.86667V1C7.5 0.723858 7.72386 0.5 8 0.5ZM0.5 8C0.5 7.72386 0.723858 7.5 1 7.5H2.86667C3.14281 7.5 3.36667 7.72386 3.36667 8C3.36667 8.27614 3.14281 8.5 2.86667 8.5H1C0.723858 8.5 0.5 8.27614 0.5 8ZM12.6333 8C12.6333 7.72386 12.8572 7.5 13.1333 7.5H15C15.2761 7.5 15.5 7.72386 15.5 8C15.5 8.27614 15.2761 8.5 15 8.5H13.1333C12.8572 8.5 12.6333 8.27614 12.6333 8ZM8.99987 10.8145C9.09475 11.0816 9.39061 11.2244 9.64095 11.0915C10.059 10.8696 10.4293 10.5644 10.728 10.1927C11.1343 9.6872 11.3922 9.0787 11.4728 8.43514C11.5535 7.79158 11.4537 7.13827 11.1847 6.54812C10.9156 5.95796 10.4879 5.45417 9.94915 5.09297C9.41045 4.73177 8.78197 4.52736 8.13385 4.50256C7.48573 4.47776 6.84347 4.63353 6.27873 4.9525C5.71399 5.27148 5.24899 5.7411 4.93563 6.30896C4.70526 6.72642 4.56349 7.1849 4.51696 7.65586C4.48909 7.93792 4.73355 8.15738 5.01665 8.14374C5.29975 8.1301 5.51274 7.8874 5.55771 7.60756C5.60274 7.32731 5.69588 7.05561 5.83426 6.80486C6.05573 6.40352 6.38437 6.07162 6.7835 5.84619C7.18262 5.62076 7.63654 5.51066 8.0946 5.52819C8.55265 5.54572 8.99683 5.69019 9.37756 5.94546C9.75829 6.20074 10.0606 6.55679 10.2507 6.97388C10.4409 7.39098 10.5114 7.8527 10.4544 8.30754C10.3974 8.76237 10.2152 9.19242 9.928 9.54971C9.74858 9.77293 9.5326 9.96227 9.29044 10.1103C9.04864 10.2582 8.90499 10.5474 8.99987 10.8145ZM5.17261 9.95833C5.36097 9.79137 5.64409 9.79046 5.83352 9.95621L8.82925 12.5775C8.93776 12.6724 9 12.8096 9 12.9538V14.5C9 14.7761 9.22386 15 9.5 15C9.77614 15 10 14.7761 10 14.5V12.9538C10 12.5212 9.81328 12.1097 9.48776 11.8249L6.49202 9.20363C5.92373 8.70638 5.0744 8.7091 4.5093 9.20998L1.50504 11.8728C1.18385 12.1575 1 12.5662 1 12.9954V14.5C1 14.7761 1.22386 15 1.5 15C1.77614 15 2 14.7761 2 14.5V12.9954C2 12.8523 2.06128 12.7161 2.16835 12.6212L5.17261 9.95833ZM3.40391 2.69668C3.20865 2.50142 2.89206 2.50142 2.6968 2.69668C2.50154 2.89194 2.50154 3.20852 2.6968 3.40379L4.01673 4.72372C4.212 4.91898 4.52858 4.91898 4.72384 4.72372C4.9191 4.52846 4.9191 4.21187 4.72384 4.01661L3.40391 2.69668ZM11.2764 4.01661C11.0811 4.21187 11.0811 4.52846 11.2764 4.72372C11.4716 4.91898 11.7882 4.91898 11.9835 4.72372L13.3034 3.40379C13.4987 3.20852 13.4987 2.89194 13.3034 2.69668C13.1081 2.50142 12.7916 2.50142 12.5963 2.69668L11.2764 4.01661ZM11.9835 11.2762C11.7882 11.081 11.4716 11.081 11.2764 11.2762C11.0811 11.4715 11.0811 11.7881 11.2764 11.9833L12.5963 13.3033C12.7916 13.4985 13.1081 13.4985 13.3034 13.3033C13.4987 13.108 13.4987 12.7914 13.3034 12.5962L11.9835 11.2762Z" fill="black"/>
3
+ </svg>
@@ -71,6 +71,7 @@ const theme = (() => {
71
71
  transparentWhite2: '#ffffff32',
72
72
  transparentWhite1: '#ffffff16',
73
73
  transparentBlack1: '#263238e6',
74
+ transparentBlack2: '#263238e5',
74
75
  transparentBlue1: '#20a4cae6',
75
76
  blueElectric: '#66dffa',
76
77
  eturnityGrey: '#263238',
@@ -0,0 +1,16 @@
1
+ const defaultProps = {
2
+ title: 'Sample Title',
3
+ infoText: 'Sample Info Text',
4
+ initialPosition: { top: '0px', left: '0px' },
5
+ minWidth: '284px',
6
+ maxWidth: '284px',
7
+ dragTargets: ['document'],
8
+ dragBounds: {},
9
+ sampleBody1:
10
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
11
+ sampleBody2:
12
+ 'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
13
+ sampleFooter: 'Sample footer',
14
+ }
15
+
16
+ export default defaultProps
@@ -0,0 +1,99 @@
1
+ import { mount } from '@vue/test-utils'
2
+ import DraggableCard from '@/components/draggableCard'
3
+ import defaultProps from './defaultProps'
4
+
5
+ jest.mock('@/components/icon/iconCache.mjs', () => ({
6
+ // need to mock this due to how jest handles import.meta
7
+ fetchIcon: jest.fn(() => Promise.resolve('mocked-icon-url.svg')),
8
+ }))
9
+
10
+ describe('DraggableCard.vue', () => {
11
+ it('renders properly with required props', () => {
12
+ const wrapper = mount(DraggableCard, { props: defaultProps })
13
+ expect(
14
+ wrapper.find('[data-test-id="draggable_card_header"]').text()
15
+ ).toContain(defaultProps.title)
16
+
17
+ // Expect no footer rendered if not provided
18
+ const footerElement = wrapper.find('[data-test-id="draggable_card_footer"]')
19
+ expect(footerElement.exists()).toBe(false)
20
+ })
21
+
22
+ it('renders body slot content correctly', () => {
23
+ const wrapper = mount(DraggableCard, {
24
+ props: defaultProps,
25
+ slots: {
26
+ body: `
27
+ <div class="custom_body1">${defaultProps.sampleBody1}</div>
28
+ <div class="custom_body2">${defaultProps.sampleBody2}</div>
29
+ `,
30
+ },
31
+ })
32
+ expect(wrapper.find('.custom_body1').exists()).toBe(true)
33
+ expect(wrapper.text()).toContain(defaultProps.sampleBody1)
34
+ expect(wrapper.find('.custom_body2').exists()).toBe(true)
35
+ expect(wrapper.text()).toContain(defaultProps.sampleBody2)
36
+ })
37
+
38
+ it('renders footer slot content correctly', () => {
39
+ const wrapper = mount(DraggableCard, {
40
+ props: defaultProps,
41
+ slots: {
42
+ footer: `<div class="custom_footer">${defaultProps.sampleFooter}</div>`,
43
+ },
44
+ })
45
+ expect(
46
+ wrapper.find('[data-test-id="draggable_card_footer"]').exists()
47
+ ).toBe(true)
48
+ expect(wrapper.find('.custom_footer').exists()).toBe(true)
49
+ expect(wrapper.text()).toContain(defaultProps.sampleFooter)
50
+ })
51
+
52
+ it('emits "on-close" when close button is clicked', async () => {
53
+ const wrapper = mount(DraggableCard, { props: defaultProps })
54
+ await wrapper
55
+ .find('[data-test-id="draggable_card_close_button"]')
56
+ .trigger('click')
57
+ expect(wrapper.emitted('on-close')).toBeTruthy()
58
+ })
59
+
60
+ it('toggles collapse state when arrow icon is clicked', async () => {
61
+ const wrapper = mount(DraggableCard, {
62
+ props: { ...defaultProps, isCollapsible: true },
63
+ })
64
+ expect(wrapper.vm.isCollapsed).toBe(false)
65
+ await wrapper
66
+ .find('[data-test-id="draggable_card_collapse_button"]')
67
+ .trigger('click')
68
+ expect(wrapper.vm.isCollapsed).toBe(true)
69
+ })
70
+
71
+ it('handles drag start event', async () => {
72
+ const wrapper = mount(DraggableCard, { props: defaultProps })
73
+ await wrapper
74
+ .find('[data-test-id="draggable_card_drag_icon"]')
75
+ .trigger('mousedown', { clientX: 100, clientY: 100 })
76
+ expect(wrapper.vm.isDragging).toBe(true)
77
+ })
78
+
79
+ it('handles drag move event', async () => {
80
+ const wrapper = mount(DraggableCard, { props: defaultProps })
81
+ wrapper.vm.onDragStart(
82
+ { preventDefault: () => {}, clientX: 100, clientY: 100 },
83
+ false
84
+ )
85
+ wrapper.vm.onDrag({ preventDefault: () => {}, clientX: 120, clientY: 120 })
86
+ expect(wrapper.vm.eventCoordinates.x).toBe(120)
87
+ expect(wrapper.vm.eventCoordinates.y).toBe(120)
88
+ })
89
+
90
+ it('handles drag end event', async () => {
91
+ const wrapper = mount(DraggableCard, { props: defaultProps })
92
+ wrapper.vm.onDragStart(
93
+ { preventDefault: () => {}, clientX: 100, clientY: 100 },
94
+ false
95
+ )
96
+ wrapper.vm.onDragEnd()
97
+ expect(wrapper.vm.isDragging).toBe(false)
98
+ })
99
+ })
@@ -0,0 +1,79 @@
1
+ import defaultProps from './defaultProps'
2
+ import DraggableCard from './index.vue'
3
+ import styled from 'vue3-styled-components'
4
+ import theme from '@/assets/theme'
5
+
6
+ export default {
7
+ title: 'DraggableCard',
8
+ component: DraggableCard,
9
+ tags: ['autodocs'],
10
+ }
11
+
12
+ const TextContainer = styled.div`
13
+ font-family: ${theme.fonts.mainFont};
14
+ color: ${theme.colors.white};
15
+ font-weight: 400;
16
+ font-size: 14px;
17
+ line-height: 21px;
18
+ letter-spacing: 0%;
19
+ `
20
+
21
+ const CompleteTemplate = (args) => {
22
+ return {
23
+ components: { DraggableCard, TextContainer },
24
+ setup() {
25
+ return { args }
26
+ },
27
+ template: `
28
+ <DraggableCard v-bind="args">
29
+ <template #body>
30
+ <TextContainer>{{ args.sampleBody1 }}</TextContainer>
31
+ <TextContainer>{{ args.sampleBody2 }}</TextContainer>
32
+ </template>
33
+ <template #footer>
34
+ <TextContainer>{{ args.sampleFooter }}</TextContainer>
35
+ </template>
36
+ </DraggableCard>
37
+ `,
38
+ }
39
+ }
40
+
41
+ export const Default = CompleteTemplate.bind({})
42
+ Default.args = {
43
+ ...defaultProps,
44
+ }
45
+
46
+ export const NotCollapsible = CompleteTemplate.bind({})
47
+ NotCollapsible.args = {
48
+ ...defaultProps,
49
+ isCollapsible: false,
50
+ }
51
+
52
+ export const AdjustWidth = CompleteTemplate.bind({})
53
+ AdjustWidth.args = {
54
+ ...defaultProps,
55
+ minWidth: '100px',
56
+ maxWidth: '500px',
57
+ }
58
+
59
+ const NoFooterTemplate = (args) => {
60
+ return {
61
+ components: { DraggableCard, TextContainer },
62
+ setup() {
63
+ return { args }
64
+ },
65
+ template: `
66
+ <DraggableCard v-bind="args">
67
+ <template #body>
68
+ <TextContainer>{{ args.sampleBody1 }}</TextContainer>
69
+ <TextContainer>{{ args.sampleBody2 }}</TextContainer>
70
+ </template>
71
+ </DraggableCard>
72
+ `,
73
+ }
74
+ }
75
+
76
+ export const NoFooter = NoFooterTemplate.bind({})
77
+ NoFooter.args = {
78
+ ...defaultProps,
79
+ }
@@ -0,0 +1,363 @@
1
+ <template>
2
+ <CardContainer
3
+ data-test-id="draggable_card_container"
4
+ :initial-position="initialPosition"
5
+ :width="width"
6
+ >
7
+ <HeaderContainer data-test-id="draggable_card_header">
8
+ <SubHeaderWrapper>
9
+ <LeftIconsContainer>
10
+ <DragHandleWrapper :class="{ dragging: isDragging }">
11
+ <RCIcon
12
+ :color="theme.colors.grey3"
13
+ data-test-id="draggable_card_drag_icon"
14
+ name="drag_icon"
15
+ size="14px"
16
+ :title="$gettext('drag_drop')"
17
+ @mousedown="(event) => onDragStart(event, false)"
18
+ @touchstart="
19
+ (event) => {
20
+ onDragStart(event, true)
21
+ }
22
+ "
23
+ />
24
+ </DragHandleWrapper>
25
+ <ArrowIconWrapper
26
+ v-if="isCollapsible"
27
+ data-test-id="draggable_card_collapse_button"
28
+ :is-collapsed="isCollapsed"
29
+ @click="toggleCollapse"
30
+ >
31
+ <img :src="CollapseArrowIconUrl" />
32
+ </ArrowIconWrapper>
33
+ </LeftIconsContainer>
34
+ <TitleContainer :data-id="titleDataId">
35
+ <TextContainer>{{ title }}</TextContainer>
36
+ <InfoText v-if="infoText?.length" :text="infoText" />
37
+ </TitleContainer>
38
+ </SubHeaderWrapper>
39
+ <CloseButton
40
+ class="close"
41
+ data-test-id="draggable_card_close_button"
42
+ @click="$emit('on-close')"
43
+ />
44
+ </HeaderContainer>
45
+ <BodyContainer v-if="!isCollapsed" data-test-id="draggable_card_body">
46
+ <slot name="body"></slot>
47
+ </BodyContainer>
48
+ <FooterContainer v-if="$slots.footer" data-test-id="draggable_card_footer">
49
+ <slot name="footer"></slot>
50
+ </FooterContainer>
51
+ </CardContainer>
52
+ </template>
53
+
54
+ <script>
55
+ import styled from 'vue3-styled-components'
56
+ import theme from '../../assets/theme.js'
57
+ import RCIcon from '../icon'
58
+ import CloseButton from '../buttons/closeButton'
59
+ import InfoText from '../infoText'
60
+ import CollapseArrowIconUrl from '../../assets/icons/collapse_arrow_icon_white.svg?url'
61
+
62
+ const CardContainerAttr = {
63
+ initialPosition: Object,
64
+ width: String,
65
+ }
66
+ const CardContainer = styled('div', CardContainerAttr)`
67
+ position: absolute;
68
+ display: flex;
69
+ flex-direction: column;
70
+ border-radius: 4px;
71
+ width: ${(props) => props.width};
72
+ background: ${theme.colors.transparentBlack2};
73
+ z-index: 5;
74
+ ${(props) =>
75
+ props.initialPosition?.top && `top: ${props.initialPosition.top};`}
76
+ ${(props) =>
77
+ props.initialPosition?.right && `right: ${props.initialPosition.right};`}
78
+ ${(props) =>
79
+ props.initialPosition?.left && `left: ${props.initialPosition.left};`}
80
+ ${(props) =>
81
+ props.initialPosition?.bottom &&
82
+ `bottom: ${props.initialPosition.bottom};`}
83
+ `
84
+
85
+ const HeaderContainer = styled.div`
86
+ display: flex;
87
+ align-items: center;
88
+ justify-content: space-between;
89
+ padding: 8px;
90
+ `
91
+
92
+ const SubHeaderWrapper = styled.div`
93
+ display: flex;
94
+ min-width: 180px;
95
+ align-items: center;
96
+ height: fit-content;
97
+ margin-right: 30px;
98
+ `
99
+
100
+ const LeftIconsContainer = styled.div`
101
+ display: flex;
102
+ align-items: center;
103
+ gap: 4px;
104
+ margin-right: 14px;
105
+ `
106
+
107
+ const TitleContainer = styled.div`
108
+ display: flex;
109
+ align-items: center;
110
+ gap: 8px;
111
+ `
112
+
113
+ const TextContainer = styled.div`
114
+ font-family: ${theme.fonts.mainFont};
115
+ font-weight: 600;
116
+ font-size: 14px;
117
+ line-height: 19.6px;
118
+ letter-spacing: -1%;
119
+ color: ${theme.colors.white};
120
+ word-break: break-word;
121
+ overflow-wrap: break-word;
122
+ white-space: normal;
123
+ `
124
+
125
+ const DragHandleWrapper = styled.div`
126
+ display: grid;
127
+ align-items: center;
128
+ justify-items: center;
129
+ width: 26px;
130
+ height: 26px;
131
+ cursor: grab;
132
+ &.dragging {
133
+ cursor: grabbing;
134
+ }
135
+ `
136
+
137
+ const collapsedAttrs = {
138
+ isCollapsed: Boolean,
139
+ }
140
+ const ArrowIconWrapper = styled('div', collapsedAttrs)`
141
+ display: flex;
142
+ align-items: center;
143
+ justify-content: center;
144
+ width: 8px;
145
+ height: 26px;
146
+ cursor: pointer;
147
+ transition: transform 0.3s ease;
148
+ ${(props) => props.isCollapsed && 'transform: rotate(-180deg);'}
149
+ `
150
+
151
+ const BodyContainer = styled.div`
152
+ display: flex;
153
+ flex-direction: column;
154
+ gap: 16px;
155
+ padding-top: 8px;
156
+ padding-right: 16px;
157
+ padding-bottom: 8px;
158
+ padding-left: 16px;
159
+ word-break: break-word;
160
+ overflow-wrap: break-word;
161
+ white-space: normal;
162
+ `
163
+
164
+ const FooterContainer = styled.div`
165
+ display: flex;
166
+ border-radius: 4px;
167
+ align-items: center;
168
+ justify-content: space-between;
169
+ padding: 8px;
170
+ background: ${theme.colors.eturnityGrey};
171
+ word-break: break-word;
172
+ overflow-wrap: break-word;
173
+ white-space: normal;
174
+ `
175
+
176
+ export default {
177
+ name: 'DraggableCard',
178
+ components: {
179
+ CardContainer,
180
+ HeaderContainer,
181
+ SubHeaderWrapper,
182
+ LeftIconsContainer,
183
+ TextContainer,
184
+ DragHandleWrapper,
185
+ ArrowIconWrapper,
186
+ RCIcon,
187
+ CloseButton,
188
+ InfoText,
189
+ TitleContainer,
190
+ BodyContainer,
191
+ FooterContainer,
192
+ },
193
+ props: {
194
+ width: {
195
+ required: true,
196
+ type: String,
197
+ },
198
+ initialPosition: {
199
+ required: true,
200
+ type: Object,
201
+ },
202
+ title: {
203
+ required: true,
204
+ type: String,
205
+ },
206
+ titleDataId: {
207
+ required: false,
208
+ type: String,
209
+ default: '',
210
+ },
211
+ isCollapsible: {
212
+ required: false,
213
+ type: Boolean,
214
+ default: true,
215
+ },
216
+ infoText: {
217
+ required: false,
218
+ type: String,
219
+ default: '',
220
+ },
221
+ dragTargets: {
222
+ required: false,
223
+ type: Array,
224
+ default: () => ['document'],
225
+ },
226
+ dragBounds: {
227
+ required: false,
228
+ type: Object,
229
+ default: () => {},
230
+ },
231
+ },
232
+ emits: ['on-close'],
233
+ data() {
234
+ return {
235
+ isCollapsed: false,
236
+ isDragging: false,
237
+ isTouchStart: false,
238
+ eventCoordinates: {
239
+ x: 0,
240
+ y: 0,
241
+ },
242
+ CollapseArrowIconUrl,
243
+ }
244
+ },
245
+ computed: {
246
+ dragBoundsEnabled() {
247
+ const minPosition = this.dragBounds?.min
248
+ const maxPosition = this.dragBounds?.max
249
+ return (
250
+ Number.isFinite(minPosition?.top) &&
251
+ Number.isFinite(minPosition?.left) &&
252
+ Number.isFinite(maxPosition?.top) &&
253
+ Number.isFinite(maxPosition?.left)
254
+ )
255
+ },
256
+ theme() {
257
+ return theme
258
+ },
259
+ },
260
+ watch: {
261
+ dragBounds() {
262
+ this.clampElementPosition()
263
+ },
264
+ },
265
+ beforeUnmount() {
266
+ this.removeEvents()
267
+ },
268
+ methods: {
269
+ toggleCollapse() {
270
+ this.isCollapsed = !this.isCollapsed
271
+ },
272
+ onDragStart(e, isTouchStart) {
273
+ e.preventDefault()
274
+ this.isDragging = true
275
+ this.isTouchStart = isTouchStart
276
+ this.eventCoordinates.x = isTouchStart
277
+ ? e.touches[0].clientX
278
+ : e.clientX
279
+ this.eventCoordinates.y = isTouchStart
280
+ ? e.touches[0].clientY
281
+ : e.clientY
282
+ this.dragTargets.forEach((id) => {
283
+ const target =
284
+ id === 'document' ? document : document.getElementById(id)
285
+ if (target && target.addEventListener) {
286
+ target.addEventListener(
287
+ isTouchStart ? 'touchend' : 'mouseup',
288
+ this.onDragEnd
289
+ )
290
+ target.addEventListener(
291
+ isTouchStart ? 'touchmove' : 'mousemove',
292
+ this.onDrag
293
+ )
294
+ }
295
+ })
296
+ document.addEventListener(
297
+ isTouchStart ? 'touchend' : 'mouseup',
298
+ this.onDragEnd
299
+ )
300
+ },
301
+ onDrag(e) {
302
+ e.preventDefault()
303
+ const eventX = this.isTouchStart ? e.touches[0].clientX : e.clientX
304
+ const eventY = this.isTouchStart ? e.touches[0].clientY : e.clientY
305
+ const deltaX = this.eventCoordinates.x - eventX
306
+ const deltaY = this.eventCoordinates.y - eventY
307
+ this.eventCoordinates.x = eventX
308
+ this.eventCoordinates.y = eventY
309
+ const element = this.$el
310
+ let positionY = element.offsetTop - deltaY
311
+ let positionX = element.offsetLeft - deltaX
312
+ element.style.top = positionY + 'px'
313
+ element.style.left = positionX + 'px'
314
+ if (this.dragBoundsEnabled) {
315
+ this.clampElementPosition()
316
+ }
317
+ },
318
+ onDragEnd() {
319
+ this.isDragging = false
320
+ this.removeEvents()
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
+ },
347
+ removeEvents() {
348
+ this.dragTargets.forEach((id) => {
349
+ const target =
350
+ id === 'document' ? document : document.getElementById(id)
351
+ if (target && target.removeEventListener) {
352
+ target.removeEventListener('mouseup', this.onDragEnd)
353
+ target.removeEventListener('touchend', this.onDragEnd)
354
+ target.removeEventListener('mousemove', this.onDrag)
355
+ target.removeEventListener('touchmove', this.onDrag)
356
+ }
357
+ })
358
+ document.removeEventListener('mouseup', this.onDragEnd)
359
+ document.removeEventListener('touchend', this.onDragEnd)
360
+ },
361
+ },
362
+ }
363
+ </script>
@@ -3,8 +3,7 @@
3
3
  :cursor="cursor"
4
4
  data-test-id="icon_wrapper"
5
5
  :disabled="disabled"
6
- :height="height ? height : size"
7
- :width="width ? width : size"
6
+ :size="size"
8
7
  >
9
8
  <IconImage
10
9
  :animation="animation"
@@ -68,16 +67,6 @@
68
67
  default: '30px',
69
68
  type: String,
70
69
  },
71
- width: {
72
- type: String,
73
- required: false,
74
- default: '',
75
- },
76
- height: {
77
- type: String,
78
- required: false,
79
- default: '',
80
- },
81
70
  cursor: {
82
71
  required: false,
83
72
  default: null,
@@ -111,8 +100,7 @@
111
100
  })
112
101
 
113
102
  const Wrapper = styled('div', {
114
- height: String,
115
- width: String,
103
+ size: String,
116
104
  disabled: Boolean,
117
105
  cursor: String,
118
106
  })`
@@ -120,10 +108,10 @@
120
108
  position: relative;
121
109
  align-content: center;
122
110
  justify-content: center;
123
- width: ${(props) => props.width};
124
- height: ${(props) => props.height};
125
- min-width: ${(props) => props.width};
126
- min-height: ${(props) => props.height};
111
+ width: ${(props) => props.size};
112
+ height: ${(props) => props.size};
113
+ min-width: ${(props) => props.size};
114
+ min-height: ${(props) => props.size};
127
115
  cursor: ${(props) => (props.disabled ? 'not-allowed' : props.cursor)};
128
116
  line-height: 0;
129
117
  `
@@ -44,7 +44,7 @@
44
44
  import styled from 'vue3-styled-components'
45
45
 
46
46
  const ComponentWrapper = styled.div`
47
- min-height: 18px;
47
+ min-height: 16px;
48
48
  `
49
49
 
50
50
  const CheckWrapper = styled('div', { hasLabel: Boolean })`
@@ -179,7 +179,7 @@
179
179
  font-size: 13px;
180
180
  display: grid;
181
181
  align-items: center;
182
- min-height: 18px;
182
+ min-height: 16px;
183
183
  color: ${(props) =>
184
184
  props.isDisabled ? props.theme.colors.grey2 : 'unset'};
185
185
  `
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg width="30" height="30" viewbox="0 0 300 300" version="1.1" xmlns="http://www.w3.org/2000/svg">
3
- <path d="m274.68 139.53c-5.76-2.85-12.66-0.39-15.54 5.4-0.18 0.3-17.04 34.5-43.02 36.9-21.93 2.19-42.9-19.95-56.82-38.82-25.38-34.35-51.66-50.4-77.73-48.09-39.15 3.75-60.84 48.12-61.8 50.04-2.76 5.82-0.27 12.72 5.4 15.51 5.85 2.79 12.84 0.45 15.66-5.37 0.12-0.39 17.07-34.53 43.05-36.93 21.72-2.1 42.9 19.98 56.73 38.76 23.73 32.1 48.15 48.33 72.48 48.33 1.86 0 3.54-0.06 5.34-0.27 39.09-3.63 60.81-48.09 61.68-49.95 2.88-5.82 0.39-12.75-5.43-15.51z"/>
4
- </svg>
@@ -1,3 +0,0 @@
1
- <svg fill="none" height="20" viewbox="0 0 100 20" width="100" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M100,9 L4,9 L9,5 L6,5 L0,10 L6,15 L9,15 L4,11 L100,11 Z" fill="#ff0000"></path>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg fill="none" height="20" viewbox="0 0 100 20" width="100" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M0,9 L96,9 L91,5 L94,5 L100,10 L94,15 L91,15 L96,11 L0,11 Z" fill="#ff0000"></path>
3
- </svg>
@@ -1,27 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
- <svg
4
- xmlns:svg="http://www.w3.org/2000/svg"
5
- xmlns="http://www.w3.org/2000/svg"
6
- version="1.0"
7
- width="40"
8
- height="37.5"
9
- id="svg2">
10
- <defs
11
- id="defs4" />
12
- <g
13
- id="layer1">
14
- <path
15
- d="M 22.5,23 L 22.5,3"
16
- style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
17
- id="path4104" />
18
- <path
19
- d="M 22.93334,23.5 L 15.000009,31.5"
20
- style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
21
- id="path4112" />
22
- <path
23
- d="M 3,31.5 L 11,23.5 L 35,23.5 L 27,31.5"
24
- style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
25
- id="path4116" />
26
- </g>
27
- </svg>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 250 100">
4
- <rect width="200" height="16" x="25" y="20" />
5
- <rect width="40" height="16" x="25" y="52" />
6
- <rect width="40" height="16" x="105" y="52" />
7
- <rect width="40" height="16" x="185" y="52" />
8
- </svg>
@@ -1,4 +0,0 @@
1
- <svg fill="none" height="30" viewbox="0 0 100 30" width="100" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M100,19 L4,19 L9,15 L6,15 L0,20 L6,25 L9,25 L4,21 L100,21 Z" fill="#ff0000"></path>
3
- <path d="M0,9 L96,9 L91,5 L94,5 L100,10 L94,15 L91,15 L96,11 L0,11 Z" fill="#ff0000"></path>
4
- </svg>
@@ -1,28 +0,0 @@
1
- <svg
2
- width="50"
3
- height="50"
4
- viewBox="0 0 25 50"
5
- fill='white'
6
- >
7
- <defs
8
- id="defs4" />
9
- <g
10
- id="layer1">
11
- <path
12
- d="M 0.5,24.5 L 24.5,24.5"
13
- style="fill:lime;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
14
- id="path4098" />
15
- <path
16
- d="M 4.5,27.5 L 20.5,27.5"
17
- style="fill:lime;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
18
- id="path4100" />
19
- <path
20
- d="M 16.5,30.5 L 8.5,30.5"
21
- style="fill:lime;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
22
- id="path4102" />
23
- <path
24
- d="M 12.5,24.5 L 12.5,4.5"
25
- style="fill:lime;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
26
- id="path4104" />
27
- </g>
28
- </svg>