@eturnity/eturnity_reusable_components 8.19.2 → 8.19.4

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 (35) hide show
  1. package/package.json +1 -1
  2. package/src/assets/svgIcons/download.svg +3 -3
  3. package/src/assets/svgIcons/filter.svg +3 -0
  4. package/src/assets/svgIcons/kanban_view.svg +6 -0
  5. package/src/assets/svgIcons/plus_button.svg +3 -3
  6. package/src/assets/svgIcons/table_view.svg +3 -0
  7. package/src/assets/theme.js +53 -5
  8. package/src/components/banner/banner/Banner.stories.js +99 -43
  9. package/src/components/banner/infoBanner/InfoBanner.stories.js +72 -30
  10. package/src/components/buttons/buttonIcon/ButtonIcon.stories.js +167 -0
  11. package/src/components/buttons/buttonIcon/index.vue +40 -6
  12. package/src/components/buttons/mainButton/MainButton.stories.js +115 -34
  13. package/src/components/draggableCard/draggableCard.stories.js +110 -54
  14. package/src/components/filter/filterSettings.vue +1 -1
  15. package/src/components/filterComponent/viewFilter.vue +605 -0
  16. package/src/components/filterComponent/viewSettings.vue +281 -0
  17. package/src/components/filterComponent/viewSort.vue +330 -0
  18. package/src/components/icon/Icon.stories.js +220 -0
  19. package/src/components/icon/index.vue +8 -1
  20. package/src/components/infoCard/index.vue +7 -3
  21. package/src/components/inputs/searchInput/index.vue +1 -1
  22. package/src/components/inputs/select/index.vue +6 -5
  23. package/src/components/inputs/select/option/index.vue +5 -0
  24. package/src/components/projectMarker/ProjectMarker.stories.js +130 -0
  25. package/src/components/selectedOptions/index.vue +13 -2
  26. package/src/components/selectedOptions/selectedOptions.stories.js +135 -37
  27. package/src/components/spinner/Spinner.stories.js +70 -18
  28. package/src/components/spinnerGif/SpinnerGif.stories.js +86 -0
  29. package/src/components/tableDropdown/TableDropdown.stories.js +192 -0
  30. package/src/components/tables/mainTable/MainTable.stories.js +151 -0
  31. package/src/components/tabsHeader/TabsHeader.stories.js +142 -0
  32. package/src/components/tabsHeader/index.vue +33 -9
  33. package/src/components/videoThumbnail/videoThumbnail.stories.js +90 -17
  34. package/src/helpers/translateLang.js +95 -24
  35. package/src/components/icon/Icons.stories.js +0 -31
@@ -0,0 +1,220 @@
1
+ import Icon from './index.vue'
2
+ import theme from '@/assets/theme'
3
+
4
+ export default {
5
+ title: 'Icon',
6
+ component: Icon,
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ name: {
10
+ control: 'select',
11
+ options: [
12
+ 'settings',
13
+ 'warning',
14
+ 'checkmark',
15
+ 'close',
16
+ 'arrow_up',
17
+ 'arrow_down',
18
+ ],
19
+ description: 'Name of the SVG icon file (without .svg extension)',
20
+ },
21
+ color: {
22
+ control: 'color',
23
+ description: 'Color of the icon',
24
+ },
25
+ hoveredColor: {
26
+ control: 'color',
27
+ description: 'Color of the icon when hovered',
28
+ },
29
+ size: {
30
+ control: 'text',
31
+ description: 'Size of the icon (e.g., "30px")',
32
+ },
33
+ cursor: {
34
+ control: 'select',
35
+ options: ['default', 'pointer', 'not-allowed'],
36
+ description: 'Cursor style when hovering over the icon',
37
+ },
38
+ isStriked: {
39
+ control: 'boolean',
40
+ description: 'Whether to show a strikethrough line',
41
+ },
42
+ backgroundColor: {
43
+ control: 'color',
44
+ description: 'Background color of the icon container',
45
+ },
46
+ count: {
47
+ control: 'number',
48
+ description: 'Number to display in the count badge',
49
+ },
50
+ animation: {
51
+ control: 'select',
52
+ options: ['none', 'fade'],
53
+ description: 'Animation type for the icon',
54
+ },
55
+ fillType: {
56
+ control: 'select',
57
+ options: ['fill', 'stroke'],
58
+ description: 'How to apply the color to the icon',
59
+ },
60
+ disabled: {
61
+ control: 'boolean',
62
+ description: 'Whether the icon is disabled',
63
+ },
64
+ },
65
+ }
66
+
67
+ const Template = (args) => ({
68
+ components: { Icon },
69
+ setup() {
70
+ return { args }
71
+ },
72
+ template: '<Icon v-bind="args" />',
73
+ provide: {
74
+ theme,
75
+ },
76
+ })
77
+
78
+ export const Default = Template.bind({})
79
+ Default.args = {
80
+ name: 'settings',
81
+ color: 'blue',
82
+ size: '30px',
83
+ cursor: 'default',
84
+ isStriked: false,
85
+ count: 0,
86
+ animation: 'none',
87
+ fillType: 'fill',
88
+ disabled: false,
89
+ }
90
+
91
+ export const Large = Template.bind({})
92
+ Large.args = {
93
+ name: 'settings',
94
+ color: 'blue',
95
+ size: '60px',
96
+ cursor: 'default',
97
+ isStriked: false,
98
+ count: 0,
99
+ animation: 'none',
100
+ fillType: 'fill',
101
+ disabled: false,
102
+ }
103
+
104
+ export const WithHover = Template.bind({})
105
+ WithHover.args = {
106
+ name: 'warning',
107
+ color: 'blue',
108
+ hoveredColor: 'red',
109
+ size: '30px',
110
+ cursor: 'pointer',
111
+ isStriked: false,
112
+ count: 0,
113
+ animation: 'none',
114
+ fillType: 'fill',
115
+ disabled: false,
116
+ }
117
+
118
+ export const WithBackground = Template.bind({})
119
+ WithBackground.args = {
120
+ name: 'checkmark',
121
+ color: 'white',
122
+ size: '30px',
123
+ cursor: 'default',
124
+ isStriked: false,
125
+ count: 0,
126
+ animation: 'none',
127
+ fillType: 'fill',
128
+ backgroundColor: 'blue',
129
+ disabled: false,
130
+ }
131
+
132
+ export const WithCount = Template.bind({})
133
+ WithCount.args = {
134
+ name: 'close',
135
+ color: 'blue',
136
+ size: '30px',
137
+ cursor: 'default',
138
+ isStriked: false,
139
+ count: 5,
140
+ animation: 'none',
141
+ fillType: 'fill',
142
+ disabled: false,
143
+ }
144
+
145
+ export const Striked = Template.bind({})
146
+ Striked.args = {
147
+ name: 'arrow_up',
148
+ color: 'blue',
149
+ size: '30px',
150
+ cursor: 'default',
151
+ isStriked: true,
152
+ count: 0,
153
+ animation: 'none',
154
+ fillType: 'fill',
155
+ disabled: false,
156
+ }
157
+
158
+ export const Animated = Template.bind({})
159
+ Animated.args = {
160
+ name: 'arrow_down',
161
+ color: 'blue',
162
+ size: '30px',
163
+ cursor: 'default',
164
+ isStriked: false,
165
+ count: 0,
166
+ animation: 'fade',
167
+ fillType: 'fill',
168
+ disabled: false,
169
+ }
170
+
171
+ export const Disabled = Template.bind({})
172
+ Disabled.args = {
173
+ name: 'settings',
174
+ color: 'blue',
175
+ size: '30px',
176
+ cursor: 'default',
177
+ isStriked: false,
178
+ count: 0,
179
+ animation: 'none',
180
+ fillType: 'fill',
181
+ disabled: true,
182
+ }
183
+
184
+ const IconLibraryTemplate = (args) => ({
185
+ components: { Icon },
186
+ setup() {
187
+ const icons = import.meta.glob('@/assets/svgIcons/*.svg', { eager: true })
188
+ const iconNames = Object.keys(icons)
189
+ .map((path) => {
190
+ const fileName = path.split('/').pop()
191
+ return fileName.replace('.svg', '')
192
+ })
193
+ .sort()
194
+
195
+ return { args, iconNames }
196
+ },
197
+ template: `
198
+ <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 20px; padding: 20px;">
199
+ <div v-for="iconName in iconNames" :key="iconName" style="text-align: center;">
200
+ <Icon v-bind="args" :name="iconName" />
201
+ <div style="font-size: 12px; margin-top: 8px; word-break: break-word;">{{ iconName }}</div>
202
+ </div>
203
+ </div>
204
+ `,
205
+ provide: {
206
+ theme,
207
+ },
208
+ })
209
+
210
+ export const IconLibrary = IconLibraryTemplate.bind({})
211
+ IconLibrary.args = {
212
+ color: 'blue',
213
+ size: '30px',
214
+ cursor: 'default',
215
+ isStriked: false,
216
+ count: 0,
217
+ animation: 'none',
218
+ fillType: 'fill',
219
+ disabled: false,
220
+ }
@@ -14,6 +14,7 @@
14
14
  :disable-hover="disableHover"
15
15
  :fill-type="fillType"
16
16
  :hovered-color="hoveredColor"
17
+ :show-count="showCount"
17
18
  >
18
19
  <i data-test-id="icon_svg" v-html="icon.html"></i>
19
20
  </IconImage>
@@ -113,6 +114,10 @@
113
114
  type: Boolean,
114
115
  default: false,
115
116
  },
117
+ showCount: {
118
+ type: Boolean,
119
+ default: false,
120
+ },
116
121
  })
117
122
 
118
123
  const Wrapper = styled('div', {
@@ -170,6 +175,7 @@
170
175
  animation: String,
171
176
  fillType: String,
172
177
  disableHover: Boolean,
178
+ showCount: Boolean,
173
179
  }
174
180
  const IconImage = styled('div', IconImageAttrs)`
175
181
  animation: ${(props) => props.animation};
@@ -180,7 +186,8 @@
180
186
  background-color: ${(props) =>
181
187
  props.backgroundColor ? props.backgroundColor : 'transparent'};
182
188
  padding: ${(props) => (props.backgroundColor ? '3px' : '0')};
183
- border-radius: ${(props) => (props.backgroundColor ? '8px' : '0')};
189
+ border-radius: ${(props) =>
190
+ props.showCount ? '8px 0 0 8px' : props.backgroundColor ? '8px' : '0'};
184
191
  }
185
192
  svg path:not(.fix) {
186
193
  ${({ theme, color, fillType }) =>
@@ -123,7 +123,11 @@
123
123
  return this.type === 'error_minor'
124
124
  },
125
125
  iconName() {
126
- return this.type === 'warning' ? 'warning_triangle' : 'info'
126
+ return this.type === 'warning'
127
+ ? 'warning_triangle'
128
+ : this.isErrorMinor
129
+ ? 'erase'
130
+ : 'info'
127
131
  },
128
132
  presetStyles() {
129
133
  // the types that doesn't have explicit border anyway have it transparent
@@ -142,8 +146,8 @@
142
146
  stylesCollection.iconColor = theme.semanticColors.teal[800]
143
147
  } else if (this.isErrorMinor) {
144
148
  stylesCollection.borderStyle = 'dashed'
145
- stylesCollection.borderColor = theme.colors.pureRed
146
- stylesCollection.iconColor = theme.colors.pureRed
149
+ stylesCollection.borderColor = theme.colors.grey4
150
+ stylesCollection.iconColor = theme.colors.red
147
151
  } else {
148
152
  stylesCollection.borderStyle = 'dashed'
149
153
  stylesCollection.borderColor = theme.colors.grey4
@@ -56,7 +56,7 @@
56
56
  const InputContainer = styled('input', inputAttrs)`
57
57
  border: 1px solid ${(props) => props.theme.colors.grey4};
58
58
  padding: ${(props) =>
59
- props.isFilter ? '7px 30px 7px 10px' : '11px 30px 11px 10px'};
59
+ props.isFilter ? '8px 30px 8px 10px' : '11px 30px 11px 10px'};
60
60
  border-radius: 4px;
61
61
  font-size: 13px;
62
62
  color: ${(props) => props.theme.colors.black};
@@ -143,7 +143,7 @@
143
143
  </Caret>
144
144
  </SelectButton>
145
145
  <DropdownWrapper ref="dropdownWrapperRef" :no-relative="noRelative">
146
- <component
146
+ <Component
147
147
  :is="shouldUseTeleport ? 'Teleport' : 'div'"
148
148
  :to="shouldUseTeleport ? 'body' : undefined"
149
149
  >
@@ -191,13 +191,14 @@
191
191
  }
192
192
  : undefined
193
193
  "
194
+ @click.stop
194
195
  @mouseleave="optionLeave"
195
196
  @option-hovered="optionHovered"
196
197
  @option-selected="optionSelected"
197
198
  >
198
199
  <slot name="dropdown"></slot>
199
200
  </SelectDropdown>
200
- </component>
201
+ </Component>
201
202
  </DropdownWrapper>
202
203
  </SelectButtonWrapper>
203
204
  </InputWrapper>
@@ -921,14 +922,14 @@
921
922
  },
922
923
  clickOutside(event) {
923
924
  const dropdownRef = this.$refs.dropdown
924
- // we need to prevent closing on selecting an option, because in the case of
925
- // a disabled option, we don't want to close the dropdown
926
925
  if (!this.isClickOutsideActive) return
927
926
  if (
928
927
  this.$refs.select.$el == event.target ||
929
928
  this.$refs.select.$el.contains(event.target) ||
930
929
  event.target.id === 'more-button' ||
931
- event.target.parentNode === dropdownRef.$el
930
+ event.target.closest('.options-container') ||
931
+ event.target.parentNode === dropdownRef.$el ||
932
+ dropdownRef.$el.contains(event.target)
932
933
  ) {
933
934
  return
934
935
  } else {
@@ -142,6 +142,11 @@
142
142
  required: false,
143
143
  default: 'inherit',
144
144
  },
145
+ showFullName: {
146
+ type: Boolean,
147
+ required: false,
148
+ default: false,
149
+ },
145
150
  },
146
151
  emits: ['option-hovered', 'option-selected'],
147
152
  data() {
@@ -0,0 +1,130 @@
1
+ import ProjectMarker from './index.vue'
2
+ import theme from '@/assets/theme'
3
+
4
+ export default {
5
+ title: 'Components/ProjectMarker',
6
+ component: ProjectMarker,
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ markerData: {
10
+ control: 'object',
11
+ description:
12
+ 'Object containing marker data including translations and color',
13
+ },
14
+ activeLanguage: {
15
+ control: 'text',
16
+ description: 'Currently active language code',
17
+ },
18
+ date: {
19
+ control: 'text',
20
+ description: 'Optional date to display next to the marker',
21
+ },
22
+ isEditable: {
23
+ control: 'boolean',
24
+ description: 'Whether the marker can be edited',
25
+ },
26
+ isGroupSupport: {
27
+ control: 'boolean',
28
+ description: 'Whether group support is enabled',
29
+ },
30
+ isLimitedPartner: {
31
+ control: 'boolean',
32
+ description: 'Whether the user is a limited partner',
33
+ },
34
+ cursor: {
35
+ control: 'text',
36
+ description: 'Cursor style for the marker',
37
+ },
38
+ hasBorderRadius: {
39
+ control: 'boolean',
40
+ description: 'Whether to show border radius',
41
+ },
42
+ },
43
+ }
44
+
45
+ const Template = (args) => ({
46
+ components: { ProjectMarker },
47
+ setup() {
48
+ return { args }
49
+ },
50
+ template: '<ProjectMarker v-bind="args" />',
51
+ provide: {
52
+ theme,
53
+ },
54
+ })
55
+
56
+ export const Default = Template.bind({})
57
+ Default.args = {
58
+ markerData: {
59
+ choice: 'sold',
60
+ translations: {
61
+ 'en-us': { name: 'Sold' },
62
+ },
63
+ color: '#4CAF50',
64
+ can_be_deleted: true,
65
+ },
66
+ activeLanguage: 'en-us',
67
+ date: '23.07.2022',
68
+ isEditable: true,
69
+ isGroupSupport: false,
70
+ isLimitedPartner: false,
71
+ cursor: 'pointer',
72
+ hasBorderRadius: true,
73
+ }
74
+
75
+ export const Lost = Template.bind({})
76
+ Lost.args = {
77
+ ...Default.args,
78
+ markerData: {
79
+ choice: 'lost',
80
+ translations: {
81
+ 'en-us': { name: 'Lost' },
82
+ },
83
+ color: '#F44336',
84
+ can_be_deleted: true,
85
+ },
86
+ }
87
+
88
+ export const Transferred = Template.bind({})
89
+ Transferred.args = {
90
+ ...Default.args,
91
+ markerData: {
92
+ choice: 'transferred',
93
+ translations: {
94
+ 'en-us': { name: 'Transferred' },
95
+ },
96
+ color: '#2196F3',
97
+ can_be_deleted: true,
98
+ },
99
+ }
100
+
101
+ export const WithoutDate = Template.bind({})
102
+ WithoutDate.args = {
103
+ ...Default.args,
104
+ date: null,
105
+ }
106
+
107
+ export const NotEditable = Template.bind({})
108
+ NotEditable.args = {
109
+ ...Default.args,
110
+ isEditable: false,
111
+ }
112
+
113
+ export const LimitedPartner = Template.bind({})
114
+ LimitedPartner.args = {
115
+ ...Default.args,
116
+ isLimitedPartner: true,
117
+ }
118
+
119
+ export const WithGroupSupport = Template.bind({})
120
+ WithGroupSupport.args = {
121
+ ...Default.args,
122
+ isGroupSupport: true,
123
+ isLimitedPartner: true,
124
+ }
125
+
126
+ export const WithoutBorderRadius = Template.bind({})
127
+ WithoutBorderRadius.args = {
128
+ ...Default.args,
129
+ hasBorderRadius: false,
130
+ }
@@ -36,8 +36,9 @@
36
36
  />
37
37
  </ListItemTitle>
38
38
  <Icon
39
- color="white"
39
+ :color="theme.colors.white"
40
40
  :cursor="item.disabled ? 'not-allowed' : 'pointer'"
41
+ :hovered-color="theme.colors.white"
41
42
  name="arrow_right"
42
43
  size="20px"
43
44
  />
@@ -86,7 +87,13 @@
86
87
  </EmptyText>
87
88
  <CloseContainer>
88
89
  <IconContainer @click="$emit('on-close')">
89
- <Icon color="white" cursor="pointer" name="close" size="14px" />
90
+ <Icon
91
+ :color="theme.colors.white"
92
+ cursor="pointer"
93
+ :hovered-color="theme.colors.white"
94
+ name="close"
95
+ size="14px"
96
+ />
90
97
  </IconContainer>
91
98
  </CloseContainer>
92
99
  </BoxContainer>
@@ -131,6 +138,7 @@
131
138
  import styled from 'vue3-styled-components'
132
139
  import InfoText from '../infoText'
133
140
  import Icon from '../icon'
141
+ import theme from '../../assets/theme'
134
142
 
135
143
  const PageWrapper = styled.div`
136
144
  font-size: 13px;
@@ -397,6 +405,9 @@
397
405
  }
398
406
  },
399
407
  computed: {
408
+ theme() {
409
+ return theme
410
+ },
400
411
  hasComponent() {
401
412
  return this.optionsList.some((item) => item.component)
402
413
  },
@@ -1,10 +1,143 @@
1
1
  import SelectedOptions from './index.vue'
2
+ import theme from '@/assets/theme'
2
3
 
3
4
  export default {
4
- title: 'Components/SelectedOptions',
5
+ title: 'SelectedOptions',
5
6
  component: SelectedOptions,
6
7
  tags: ['autodocs'],
7
- // argTypes: {}
8
+ argTypes: {
9
+ optionsList: {
10
+ control: 'object',
11
+ description:
12
+ 'Array of options to display. Each option should have a type and name, and can optionally have a component, disabled state, hoverColor, and disabledInfo.',
13
+ },
14
+ numberSelected: {
15
+ control: 'number',
16
+ description: 'Number of items currently selected',
17
+ },
18
+ selectedLabel: {
19
+ control: 'text',
20
+ description:
21
+ 'Custom label for the selected count (defaults to "selected")',
22
+ },
23
+ noBulkActionsLabel: {
24
+ control: 'text',
25
+ description:
26
+ 'Custom label when no bulk actions are available (defaults to "no_batch_actions_available")',
27
+ },
28
+ },
29
+ }
30
+
31
+ const Template = (args) => ({
32
+ components: { SelectedOptions },
33
+ setup() {
34
+ return { args }
35
+ },
36
+ template: '<SelectedOptions v-bind="args" />',
37
+ provide: {
38
+ theme,
39
+ },
40
+ })
41
+
42
+ export const Default = Template.bind({})
43
+ Default.args = {
44
+ optionsList: [
45
+ {
46
+ type: 'export',
47
+ name: 'Export',
48
+ },
49
+ {
50
+ type: 'delete',
51
+ name: 'Delete',
52
+ hoverColor: 'red',
53
+ },
54
+ ],
55
+ numberSelected: 5,
56
+ }
57
+
58
+ export const WithDisabledOptions = Template.bind({})
59
+ WithDisabledOptions.args = {
60
+ optionsList: [
61
+ {
62
+ type: 'export',
63
+ name: 'Export',
64
+ },
65
+ {
66
+ type: 'delete',
67
+ name: 'Delete',
68
+ disabled: true,
69
+ disabledInfo: 'You do not have permission to delete these items',
70
+ },
71
+ ],
72
+ numberSelected: 3,
73
+ }
74
+
75
+ export const WithCustomComponent = Template.bind({})
76
+ WithCustomComponent.args = {
77
+ optionsList: [
78
+ {
79
+ type: 'export',
80
+ name: 'Export',
81
+ },
82
+ {
83
+ type: 'set_supplier',
84
+ name: 'Set Supplier',
85
+ component: 'set_supplier',
86
+ },
87
+ ],
88
+ numberSelected: 2,
89
+ }
90
+
91
+ export const ManyOptions = Template.bind({})
92
+ ManyOptions.args = {
93
+ optionsList: [
94
+ {
95
+ type: 'export',
96
+ name: 'Export',
97
+ },
98
+ {
99
+ type: 'delete',
100
+ name: 'Delete',
101
+ hoverColor: 'red',
102
+ },
103
+ {
104
+ type: 'archive',
105
+ name: 'Archive',
106
+ },
107
+ {
108
+ type: 'move',
109
+ name: 'Move',
110
+ },
111
+ {
112
+ type: 'copy',
113
+ name: 'Copy',
114
+ },
115
+ ],
116
+ numberSelected: 10,
117
+ }
118
+
119
+ export const NoOptions = Template.bind({})
120
+ NoOptions.args = {
121
+ optionsList: [],
122
+ numberSelected: 0,
123
+ }
124
+
125
+ export const CustomLabels = Template.bind({})
126
+ CustomLabels.args = {
127
+ optionsList: [
128
+ {
129
+ type: 'export',
130
+ name: 'Export',
131
+ },
132
+ {
133
+ type: 'delete',
134
+ name: 'Delete',
135
+ hoverColor: 'red',
136
+ },
137
+ ],
138
+ numberSelected: 1,
139
+ selectedLabel: 'item selected',
140
+ noBulkActionsLabel: 'No actions can be performed on selected items',
8
141
  }
9
142
 
10
143
  // How to use in your template
@@ -46,41 +179,6 @@ export default {
46
179
  // </template>
47
180
  // </SelectedOptions>
48
181
 
49
- export const Default = {
50
- render: (args) => ({
51
- components: { SelectedOptions },
52
- setup() {
53
- return { args }
54
- },
55
- template: '<SelectedOptions v-bind="args" />',
56
- }),
57
- args: {
58
- optionLimit: 4,
59
- selectedLabel: 'selected',
60
- noBulkActionsLabel: 'No bulk actions available',
61
-
62
- //selected options count, in this case 5 options are selected
63
- numberSelected: 5,
64
-
65
- //show overlay
66
- showOverlay: true,
67
-
68
- //expanded options, this will display list of actions in the middle of the screen
69
- expanded: false,
70
- optionsList: [
71
- {
72
- type: 'export',
73
- name: 'Export',
74
- },
75
- {
76
- type: 'export_page',
77
- name: 'Export Page',
78
- },
79
- ],
80
- expandedOptions: [],
81
- },
82
- }
83
-
84
182
  export const Expanded = {
85
183
  render: (args) => ({
86
184
  components: { SelectedOptions },