@eturnity/eturnity_reusable_components 9.22.2 → 9.25.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/dist/index.es3.js +268 -156
- package/package.json +3 -3
- package/src/assets/theme.js +202 -90
- package/src/components/accordion/Accordion.stories.js +1 -1
- package/src/components/addNewButton/AddNewButton.stories.js +40 -8
- package/src/components/banner/actionBanner/ActionBanner.stories.js +1 -1
- package/src/components/banner/actionBanner/index.vue +4 -2
- package/src/components/banner/banner/Banner.stories.js +1 -1
- package/src/components/banner/infoBanner/InfoBanner.stories.js +1 -1
- package/src/components/banner/infoBanner/index.vue +4 -2
- package/src/components/banner/notificationBanner/notificationBanner.stories.js +81 -0
- package/src/components/buttons/buttonIcon/index.vue +216 -80
- package/src/components/buttons/closeButton/CloseButton.stories.js +1 -1
- package/src/components/buttons/collection/index.vue +1 -3
- package/src/components/buttons/mainButton/index.vue +98 -44
- package/src/components/buttons/splitButtons/splitButtons.stories.js +70 -0
- package/src/components/card/Card.stories.js +16 -4
- package/src/components/card/index.vue +1 -1
- package/src/components/collapsableInfoText/collapsableInfoText.stories.js +52 -0
- package/src/components/deleteIcon/DeleteIcon.stories.js +1 -1
- package/src/components/draggableCard/draggableCard.stories.js +1 -1
- package/src/components/draggableInputHandle/draggableInputHandle.stories.js +43 -0
- package/src/components/dropdown/Dropdown.stories.js +1 -1
- package/src/components/errorMessage/errorMessage.stories.js +31 -17
- package/src/components/filter/filterSettings.vue +1 -1
- package/src/components/icon/Icon.stories.js +1 -1
- package/src/components/iconWrapper/iconWrapper.stories.js +78 -0
- package/src/components/infoCard/InfoCard.stories.js +1 -1
- package/src/components/infoLabel/infoLabel.stories.js +61 -0
- package/src/components/infoText/infoText.stories.js +1 -1
- package/src/components/inputs/checkbox/Checkbox.stories.js +1 -1
- package/src/components/inputs/checkbox/index.vue +10 -1
- package/src/components/inputs/inputNumber/InputNumber.stories.js +1 -1
- package/src/components/inputs/inputNumber/index.vue +15 -5
- package/src/components/inputs/inputNumberQuestion/inputNumberQuestion.stories.js +77 -0
- package/src/components/inputs/inputText/InputText.stories.js +1 -1
- package/src/components/inputs/inputText/index.vue +29 -20
- package/src/components/inputs/isRequiredLabelStar/isRequiredLabelStar.stories.js +26 -0
- package/src/components/inputs/radioButton/RadioButton.stories.js +1 -1
- package/src/components/inputs/radioButton/index.vue +21 -7
- package/src/components/inputs/searchInput/SearchInput.stories.js +1 -1
- package/src/components/inputs/select/index.vue +33 -21
- package/src/components/inputs/select/option/index.vue +1 -1
- package/src/components/inputs/select/select.stories.js +4 -25
- package/src/components/inputs/shared/inputLabelTypography.js +7 -0
- package/src/components/inputs/slider/index.vue +9 -12
- package/src/components/inputs/slider/slider.stories.js +71 -0
- package/src/components/inputs/switchField/index.vue +37 -10
- package/src/components/inputs/switchField/switchField.stories.js +71 -0
- package/src/components/inputs/textAreaInput/TextAreaInput.stories.js +1 -1
- package/src/components/inputs/textAreaInput/index.vue +19 -6
- package/src/components/inputs/toggle/Toggle.stories.js +1 -1
- package/src/components/inputs/toggle/index.vue +10 -6
- package/src/components/label/index.vue +39 -11
- package/src/components/label/label.stories.js +69 -0
- package/src/components/markerItem/markerItem.stories.js +46 -0
- package/src/components/modals/actionModal/actionModal.stories.js +1 -1
- package/src/components/modals/actionModal/index.vue +1 -1
- package/src/components/modals/infoModal/index.vue +1 -10
- package/src/components/modals/infoModal/infoModal.stories.js +1 -1
- package/src/components/modals/modal/modal.spec.js +168 -0
- package/src/components/modals/modal/modal.stories.js +287 -26
- package/src/components/modals/modalBody/index.vue +30 -0
- package/src/components/modals/modalButtonContainer/index.vue +42 -0
- package/src/components/modals/modalButtonContainer/modalButtonContainer.stories.js +59 -0
- package/src/components/modals/modalContent/index.vue +125 -0
- package/src/components/modals/modalTitle/index.vue +34 -0
- package/src/components/navigationTabs/navigationTabs.stories.js +58 -0
- package/src/components/pageSubtitle/PageSubtitle.stories.js +1 -1
- package/src/components/pageTitle/PageTitle.stories.js +1 -1
- package/src/components/pagination/pagination.stories.js +79 -0
- package/src/components/paginationV2/paginationV2.spec.js +132 -0
- package/src/components/paginationV2/paginationV2.stories.js +68 -0
- package/src/components/panelRangeInfo/panelRangeInfo.stories.js +60 -0
- package/src/components/progressBar/ProgressBar.stories.js +1 -1
- package/src/components/progressStep/progressStep.stories.js +1 -1
- package/src/components/projectMarker/ProjectMarker.stories.js +1 -1
- package/src/components/rangeSlider/RangeSlider.stories.js +1 -1
- package/src/components/roundTabs/roundTabs.stories.js +54 -0
- package/src/components/selectedOptions/selectedOptions.stories.js +1 -1
- package/src/components/sideMenu/sideMenu.stories.js +53 -0
- package/src/components/spinner/Spinner.stories.js +1 -1
- package/src/components/spinnerGif/SpinnerGif.stories.js +1 -1
- package/src/components/statusIndicator/statusIndicator.stories.js +101 -0
- package/src/components/tableDropdown/TableDropdown.stories.js +1 -1
- package/src/components/tables/viewTable/viewTable.stories.js +85 -0
- package/src/components/tabsHeader/TabsHeader.stories.js +1 -1
- package/src/components/tag/conversionTag/conversionTag.stories.js +47 -0
- package/src/components/tag/freeTrialTag/freeTrialTag.stories.js +42 -0
- package/src/components/threeDots/index.vue +20 -3
- package/src/components/threeDots/threeDots.stories.js +59 -0
- package/src/components/videoThumbnail/videoThumbnail.stories.js +1 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ContentElement
|
|
3
|
+
:background-color="backgroundColor"
|
|
4
|
+
:height="height"
|
|
5
|
+
:max-height="resolvedMaxHeight"
|
|
6
|
+
:max-width="resolvedMaxWidth"
|
|
7
|
+
:min-height="resolvedMinHeight"
|
|
8
|
+
:min-width="resolvedMinWidth"
|
|
9
|
+
:width="width"
|
|
10
|
+
>
|
|
11
|
+
<slot></slot>
|
|
12
|
+
</ContentElement>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
// To use:
|
|
17
|
+
// import ModalContent from "@eturnity/eturnity_reusable_components/src/components/modals/modalContent"
|
|
18
|
+
// <modal-content size="medium">{{ $gettext('Create a new main component template') }}</modal-content>
|
|
19
|
+
|
|
20
|
+
import styled from 'vue3-styled-components'
|
|
21
|
+
|
|
22
|
+
const SIZE_PRESETS = {
|
|
23
|
+
small: {
|
|
24
|
+
minWidth: '320px',
|
|
25
|
+
maxWidth: '450px',
|
|
26
|
+
minHeight: undefined,
|
|
27
|
+
maxHeight: '80vh',
|
|
28
|
+
},
|
|
29
|
+
medium: {
|
|
30
|
+
minWidth: '450px',
|
|
31
|
+
maxWidth: '650px',
|
|
32
|
+
minHeight: undefined,
|
|
33
|
+
maxHeight: '95vh',
|
|
34
|
+
},
|
|
35
|
+
large: {
|
|
36
|
+
minWidth: '500px',
|
|
37
|
+
maxWidth: '95vw',
|
|
38
|
+
minHeight: undefined,
|
|
39
|
+
maxHeight: '95vh',
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const contentElementAttrs = {
|
|
44
|
+
backgroundColor: String,
|
|
45
|
+
maxWidth: String,
|
|
46
|
+
minWidth: String,
|
|
47
|
+
maxHeight: String,
|
|
48
|
+
minHeight: String,
|
|
49
|
+
width: String,
|
|
50
|
+
height: String,
|
|
51
|
+
}
|
|
52
|
+
const ContentElement = styled('div', contentElementAttrs)`
|
|
53
|
+
padding: 24px;
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
gap: 24px;
|
|
57
|
+
${(props) =>
|
|
58
|
+
props.backgroundColor && `background-color: ${props.backgroundColor};`}
|
|
59
|
+
${(props) => props.maxWidth && `max-width: ${props.maxWidth};`}
|
|
60
|
+
${(props) => props.minWidth && `min-width: ${props.minWidth};`}
|
|
61
|
+
${(props) => props.maxHeight && `max-height: ${props.maxHeight};`}
|
|
62
|
+
${(props) => props.minHeight && `min-height: ${props.minHeight};`}
|
|
63
|
+
${(props) => props.width && `width: ${props.width};`}
|
|
64
|
+
${(props) => props.height && `height: ${props.height};`}
|
|
65
|
+
`
|
|
66
|
+
|
|
67
|
+
export default {
|
|
68
|
+
name: 'ModalContent',
|
|
69
|
+
components: {
|
|
70
|
+
ContentElement,
|
|
71
|
+
},
|
|
72
|
+
props: {
|
|
73
|
+
backgroundColor: {
|
|
74
|
+
type: String,
|
|
75
|
+
required: false,
|
|
76
|
+
},
|
|
77
|
+
size: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'medium',
|
|
80
|
+
validator: (value) => ['small', 'medium', 'large'].includes(value),
|
|
81
|
+
},
|
|
82
|
+
maxWidth: {
|
|
83
|
+
type: String,
|
|
84
|
+
required: false,
|
|
85
|
+
},
|
|
86
|
+
minWidth: {
|
|
87
|
+
type: String,
|
|
88
|
+
required: false,
|
|
89
|
+
},
|
|
90
|
+
maxHeight: {
|
|
91
|
+
type: String,
|
|
92
|
+
required: false,
|
|
93
|
+
},
|
|
94
|
+
minHeight: {
|
|
95
|
+
type: String,
|
|
96
|
+
required: false,
|
|
97
|
+
},
|
|
98
|
+
width: {
|
|
99
|
+
type: String,
|
|
100
|
+
required: false,
|
|
101
|
+
},
|
|
102
|
+
height: {
|
|
103
|
+
type: String,
|
|
104
|
+
required: false,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
computed: {
|
|
108
|
+
sizePreset() {
|
|
109
|
+
return SIZE_PRESETS[this.size]
|
|
110
|
+
},
|
|
111
|
+
resolvedMinWidth() {
|
|
112
|
+
return this.minWidth ?? this.sizePreset.minWidth
|
|
113
|
+
},
|
|
114
|
+
resolvedMaxWidth() {
|
|
115
|
+
return this.maxWidth ?? this.sizePreset.maxWidth
|
|
116
|
+
},
|
|
117
|
+
resolvedMinHeight() {
|
|
118
|
+
return this.minHeight ?? this.sizePreset.minHeight
|
|
119
|
+
},
|
|
120
|
+
resolvedMaxHeight() {
|
|
121
|
+
return this.maxHeight ?? this.sizePreset.maxHeight
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
}
|
|
125
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TitleElement>
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</TitleElement>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
// To use:
|
|
9
|
+
// import ModalTitle from "@eturnity/eturnity_reusable_components/src/components/modals/modalTitle"
|
|
10
|
+
// <modal-title>{{ $gettext('Create a new main component template') }}</modal-title>
|
|
11
|
+
|
|
12
|
+
import styled from 'vue3-styled-components'
|
|
13
|
+
|
|
14
|
+
const TitleElement = styled.div`
|
|
15
|
+
color: ${(props) => props.theme.semanticColors.teal[800]};
|
|
16
|
+
font-family: inherit;
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
font-style: normal;
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
line-height: 140%;
|
|
21
|
+
letter-spacing: -0.14px;
|
|
22
|
+
margin-right: 30px;
|
|
23
|
+
&::first-letter {
|
|
24
|
+
text-transform: uppercase;
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'ModalTitle',
|
|
30
|
+
components: {
|
|
31
|
+
TitleElement,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions'
|
|
2
|
+
import NavigationTabs from './index.vue'
|
|
3
|
+
import theme from '@/assets/theme'
|
|
4
|
+
|
|
5
|
+
const tabsData = [
|
|
6
|
+
{ id: 1, slug: 'overview', label: 'Overview' },
|
|
7
|
+
{
|
|
8
|
+
id: 2,
|
|
9
|
+
slug: 'billing',
|
|
10
|
+
label: 'Billing',
|
|
11
|
+
labelInfoText: 'Invoices and payment methods',
|
|
12
|
+
labelInfoAlign: 'left',
|
|
13
|
+
},
|
|
14
|
+
{ id: 3, slug: 'users', label: 'Users', isDisabled: true },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
title: 'Components/Navigation/NavigationTabs',
|
|
19
|
+
component: NavigationTabs,
|
|
20
|
+
tags: ['autodocs'],
|
|
21
|
+
parameters: {
|
|
22
|
+
layout: 'centered',
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const Template = (args) => ({
|
|
27
|
+
components: { NavigationTabs },
|
|
28
|
+
setup() {
|
|
29
|
+
const logTab = (key) => action('tab-click')(key)
|
|
30
|
+
return { args, logTab }
|
|
31
|
+
},
|
|
32
|
+
template: `
|
|
33
|
+
<div data-test-id="navigation-tabs-story" style="padding: 16px;">
|
|
34
|
+
<NavigationTabs v-bind="args" @tab-click="logTab" />
|
|
35
|
+
</div>
|
|
36
|
+
`,
|
|
37
|
+
provide: {
|
|
38
|
+
theme,
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
export const BySlug = Template.bind({})
|
|
43
|
+
BySlug.args = {
|
|
44
|
+
tabsData,
|
|
45
|
+
activeTab: 'billing',
|
|
46
|
+
isIndexKey: false,
|
|
47
|
+
tabKey: 'slug',
|
|
48
|
+
tabLabel: 'label',
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const ByIndex = Template.bind({})
|
|
52
|
+
ByIndex.args = {
|
|
53
|
+
tabsData,
|
|
54
|
+
activeTab: 0,
|
|
55
|
+
isIndexKey: true,
|
|
56
|
+
tabKey: 'slug',
|
|
57
|
+
tabLabel: 'label',
|
|
58
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions'
|
|
2
|
+
import Pagination from './index.vue'
|
|
3
|
+
import theme from '@/assets/theme'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Pagination/Pagination',
|
|
7
|
+
component: Pagination,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Template = (args) => ({
|
|
15
|
+
components: { Pagination },
|
|
16
|
+
setup() {
|
|
17
|
+
const fetchPage = (page) => {
|
|
18
|
+
action('fetch-page')(page)
|
|
19
|
+
args.fetchPage(page)
|
|
20
|
+
}
|
|
21
|
+
return { args, fetchPage }
|
|
22
|
+
},
|
|
23
|
+
template: `
|
|
24
|
+
<div data-test-id="pagination-story" style="min-width: 320px;">
|
|
25
|
+
<Pagination
|
|
26
|
+
:fetch-page="fetchPage"
|
|
27
|
+
:current-page="args.currentPage"
|
|
28
|
+
:pagination-params="args.paginationParams"
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
`,
|
|
32
|
+
provide: {
|
|
33
|
+
theme,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
export const MidRange = Template.bind({})
|
|
38
|
+
MidRange.args = {
|
|
39
|
+
currentPage: 4,
|
|
40
|
+
paginationParams: {
|
|
41
|
+
pages: 10,
|
|
42
|
+
previous: 3,
|
|
43
|
+
next: 5,
|
|
44
|
+
},
|
|
45
|
+
fetchPage: (n) => {},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const FirstPage = Template.bind({})
|
|
49
|
+
FirstPage.args = {
|
|
50
|
+
currentPage: 1,
|
|
51
|
+
paginationParams: {
|
|
52
|
+
pages: 6,
|
|
53
|
+
previous: null,
|
|
54
|
+
next: 2,
|
|
55
|
+
},
|
|
56
|
+
fetchPage: (n) => {},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const LastPage = Template.bind({})
|
|
60
|
+
LastPage.args = {
|
|
61
|
+
currentPage: 8,
|
|
62
|
+
paginationParams: {
|
|
63
|
+
pages: 8,
|
|
64
|
+
previous: 7,
|
|
65
|
+
next: null,
|
|
66
|
+
},
|
|
67
|
+
fetchPage: (n) => {},
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const TwoPagesOnly = Template.bind({})
|
|
71
|
+
TwoPagesOnly.args = {
|
|
72
|
+
currentPage: 1,
|
|
73
|
+
paginationParams: {
|
|
74
|
+
pages: 2,
|
|
75
|
+
previous: null,
|
|
76
|
+
next: 2,
|
|
77
|
+
},
|
|
78
|
+
fetchPage: (n) => {},
|
|
79
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { mount, DOMWrapper } from '@vue/test-utils'
|
|
3
|
+
import PaginationV2 from './index.vue'
|
|
4
|
+
import theme from '@/assets/theme'
|
|
5
|
+
|
|
6
|
+
jest.mock('@/components/icon/iconCache.mjs', () => ({
|
|
7
|
+
fetchIcon: jest.fn(() => Promise.resolve('')),
|
|
8
|
+
}))
|
|
9
|
+
|
|
10
|
+
beforeAll(() => {
|
|
11
|
+
global.ResizeObserver = jest.fn().mockImplementation(() => ({
|
|
12
|
+
observe: jest.fn(),
|
|
13
|
+
unobserve: jest.fn(),
|
|
14
|
+
disconnect: jest.fn(),
|
|
15
|
+
}))
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/** Direct children of `<nav>` match template order: optional prev links, select block, optional next links. */
|
|
19
|
+
async function clickNavChild(wrapper, index) {
|
|
20
|
+
const nav = wrapper.get('nav')
|
|
21
|
+
const el = nav.element.children[index]
|
|
22
|
+
await new DOMWrapper(el).trigger('click')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe('PaginationV2', () => {
|
|
26
|
+
const mountPagination = (props = {}) => {
|
|
27
|
+
const fetchPage = jest.fn()
|
|
28
|
+
const wrapper = mount(PaginationV2, {
|
|
29
|
+
props: {
|
|
30
|
+
fetchPage,
|
|
31
|
+
currentPage: 1,
|
|
32
|
+
paginationParams: { pages: 3, previous: null, next: 2 },
|
|
33
|
+
...props,
|
|
34
|
+
},
|
|
35
|
+
global: {
|
|
36
|
+
provide: { theme },
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
return { wrapper, fetchPage }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
it('does not render the nav when there is only one page', () => {
|
|
43
|
+
const { wrapper } = mountPagination({
|
|
44
|
+
paginationParams: { pages: 1, previous: null, next: null },
|
|
45
|
+
})
|
|
46
|
+
expect(wrapper.find('nav').exists()).toBe(false)
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('does not render the nav when pages is zero', () => {
|
|
50
|
+
const { wrapper } = mountPagination({
|
|
51
|
+
paginationParams: { pages: 0, previous: null, next: null },
|
|
52
|
+
})
|
|
53
|
+
expect(wrapper.find('nav').exists()).toBe(false)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('renders the nav and page label when there is more than one page', async () => {
|
|
57
|
+
const { wrapper } = mountPagination({
|
|
58
|
+
currentPage: 2,
|
|
59
|
+
paginationParams: { pages: 5, previous: 1, next: 3 },
|
|
60
|
+
})
|
|
61
|
+
await wrapper.vm.$nextTick()
|
|
62
|
+
expect(wrapper.find('nav').exists()).toBe(true)
|
|
63
|
+
expect(wrapper.text()).toContain('2 of 5')
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it('calls fetchPage(1) and fetchPage(previous) for the first two controls when previous is set', async () => {
|
|
67
|
+
const { wrapper, fetchPage } = mountPagination({
|
|
68
|
+
currentPage: 2,
|
|
69
|
+
paginationParams: { pages: 5, previous: 1, next: 3 },
|
|
70
|
+
})
|
|
71
|
+
await wrapper.vm.$nextTick()
|
|
72
|
+
|
|
73
|
+
await clickNavChild(wrapper, 0)
|
|
74
|
+
expect(fetchPage).toHaveBeenCalledWith(1)
|
|
75
|
+
|
|
76
|
+
await clickNavChild(wrapper, 1)
|
|
77
|
+
expect(fetchPage).toHaveBeenCalledWith(1)
|
|
78
|
+
expect(fetchPage).toHaveBeenCalledTimes(2)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('calls fetchPage(next) and fetchPage(pages) for the last two controls when next is set', async () => {
|
|
82
|
+
const { wrapper, fetchPage } = mountPagination({
|
|
83
|
+
currentPage: 2,
|
|
84
|
+
paginationParams: { pages: 5, previous: 1, next: 3 },
|
|
85
|
+
})
|
|
86
|
+
await wrapper.vm.$nextTick()
|
|
87
|
+
|
|
88
|
+
await clickNavChild(wrapper, 3)
|
|
89
|
+
expect(fetchPage).toHaveBeenCalledWith(3)
|
|
90
|
+
|
|
91
|
+
await clickNavChild(wrapper, 4)
|
|
92
|
+
expect(fetchPage).toHaveBeenCalledWith(5)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('omits previous controls on the first page so the select is the first nav child', async () => {
|
|
96
|
+
const { wrapper, fetchPage } = mountPagination({
|
|
97
|
+
currentPage: 1,
|
|
98
|
+
paginationParams: { pages: 4, previous: null, next: 2 },
|
|
99
|
+
})
|
|
100
|
+
await wrapper.vm.$nextTick()
|
|
101
|
+
|
|
102
|
+
expect(wrapper.get('nav').element.children).toHaveLength(3)
|
|
103
|
+
await clickNavChild(wrapper, 1)
|
|
104
|
+
expect(fetchPage).toHaveBeenCalledWith(2)
|
|
105
|
+
await clickNavChild(wrapper, 2)
|
|
106
|
+
expect(fetchPage).toHaveBeenCalledWith(4)
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('omits next controls on the last page', async () => {
|
|
110
|
+
const { wrapper } = mountPagination({
|
|
111
|
+
currentPage: 4,
|
|
112
|
+
paginationParams: { pages: 4, previous: 3, next: null },
|
|
113
|
+
})
|
|
114
|
+
await wrapper.vm.$nextTick()
|
|
115
|
+
|
|
116
|
+
expect(wrapper.get('nav').element.children).toHaveLength(3)
|
|
117
|
+
expect(wrapper.text()).toContain('4 of 4')
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it('forwards fetchPage when the page select emits input-change', async () => {
|
|
121
|
+
const { wrapper, fetchPage } = mountPagination({
|
|
122
|
+
currentPage: 1,
|
|
123
|
+
paginationParams: { pages: 6, previous: null, next: 2 },
|
|
124
|
+
})
|
|
125
|
+
await wrapper.vm.$nextTick()
|
|
126
|
+
|
|
127
|
+
const select = wrapper.findComponent({ name: 'RCselect' })
|
|
128
|
+
expect(select.exists()).toBe(true)
|
|
129
|
+
await select.vm.$emit('input-change', 5)
|
|
130
|
+
expect(fetchPage).toHaveBeenCalledWith(5)
|
|
131
|
+
})
|
|
132
|
+
})
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions'
|
|
2
|
+
import PaginationV2 from './index.vue'
|
|
3
|
+
import theme from '@/assets/theme'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Pagination/PaginationV2',
|
|
7
|
+
component: PaginationV2,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Template = (args) => ({
|
|
15
|
+
components: { PaginationV2 },
|
|
16
|
+
setup() {
|
|
17
|
+
const fetchPage = (page) => {
|
|
18
|
+
action('fetch-page')(page)
|
|
19
|
+
args.fetchPage(page)
|
|
20
|
+
}
|
|
21
|
+
return { args, fetchPage }
|
|
22
|
+
},
|
|
23
|
+
template: `
|
|
24
|
+
<div data-test-id="pagination-v2-story" style="min-width: 280px;">
|
|
25
|
+
<PaginationV2
|
|
26
|
+
:fetch-page="fetchPage"
|
|
27
|
+
:current-page="args.currentPage"
|
|
28
|
+
:pagination-params="args.paginationParams"
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
`,
|
|
32
|
+
provide: {
|
|
33
|
+
theme,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
export const PageThreeOfTen = Template.bind({})
|
|
38
|
+
PageThreeOfTen.args = {
|
|
39
|
+
currentPage: 3,
|
|
40
|
+
paginationParams: {
|
|
41
|
+
pages: 10,
|
|
42
|
+
previous: 2,
|
|
43
|
+
next: 4,
|
|
44
|
+
},
|
|
45
|
+
fetchPage: () => {},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const FirstPage = Template.bind({})
|
|
49
|
+
FirstPage.args = {
|
|
50
|
+
currentPage: 1,
|
|
51
|
+
paginationParams: {
|
|
52
|
+
pages: 5,
|
|
53
|
+
previous: null,
|
|
54
|
+
next: 2,
|
|
55
|
+
},
|
|
56
|
+
fetchPage: () => {},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const LastPage = Template.bind({})
|
|
60
|
+
LastPage.args = {
|
|
61
|
+
currentPage: 12,
|
|
62
|
+
paginationParams: {
|
|
63
|
+
pages: 12,
|
|
64
|
+
previous: 11,
|
|
65
|
+
next: null,
|
|
66
|
+
},
|
|
67
|
+
fetchPage: () => {},
|
|
68
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import PanelRangeInfo from './index.vue'
|
|
2
|
+
import theme from '@/assets/theme'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/PanelRangeInfo/PanelRangeInfo',
|
|
6
|
+
component: PanelRangeInfo,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
minValue: { control: 'number' },
|
|
13
|
+
maxValue: { control: 'number' },
|
|
14
|
+
value: { control: 'number' },
|
|
15
|
+
arrowColor: { control: 'text' },
|
|
16
|
+
width: { control: 'text' },
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const Template = (args) => ({
|
|
21
|
+
components: { PanelRangeInfo },
|
|
22
|
+
setup() {
|
|
23
|
+
return { args }
|
|
24
|
+
},
|
|
25
|
+
template: `
|
|
26
|
+
<div data-test-id="panel-range-story" style="padding: 24px;">
|
|
27
|
+
<PanelRangeInfo v-bind="args" />
|
|
28
|
+
</div>
|
|
29
|
+
`,
|
|
30
|
+
provide: {
|
|
31
|
+
theme,
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
export const LowInRange = Template.bind({})
|
|
36
|
+
LowInRange.args = {
|
|
37
|
+
minValue: 0,
|
|
38
|
+
maxValue: 100,
|
|
39
|
+
value: 18,
|
|
40
|
+
arrowColor: 'white',
|
|
41
|
+
width: '280px',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const MidRange = Template.bind({})
|
|
45
|
+
MidRange.args = {
|
|
46
|
+
minValue: 10,
|
|
47
|
+
maxValue: 90,
|
|
48
|
+
value: 50,
|
|
49
|
+
arrowColor: 'white',
|
|
50
|
+
width: '280px',
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const NarrowBand = Template.bind({})
|
|
54
|
+
NarrowBand.args = {
|
|
55
|
+
minValue: 40,
|
|
56
|
+
maxValue: 60,
|
|
57
|
+
value: 55,
|
|
58
|
+
arrowColor: 'white',
|
|
59
|
+
width: '200px',
|
|
60
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import RoundTabs from './index.vue'
|
|
2
|
+
import theme from '@/assets/theme'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/RoundTabs/RoundTabs',
|
|
6
|
+
component: RoundTabs,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
height: { control: 'text' },
|
|
13
|
+
width: { control: 'text' },
|
|
14
|
+
backgroundColor: { control: 'text', description: 'Theme colour token name' },
|
|
15
|
+
borderRadius: { control: 'text' },
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Template = (args) => ({
|
|
20
|
+
components: { RoundTabs },
|
|
21
|
+
setup() {
|
|
22
|
+
return { args }
|
|
23
|
+
},
|
|
24
|
+
template: `
|
|
25
|
+
<RoundTabs v-bind="args">
|
|
26
|
+
<div
|
|
27
|
+
data-test-id="round-tabs-slot"
|
|
28
|
+
style="display: flex; gap: 12px; align-items: center; padding: 0 16px; font-size: 13px; font-weight: 600;"
|
|
29
|
+
>
|
|
30
|
+
<span style="opacity: 0.9;">Summary</span>
|
|
31
|
+
<span style="opacity: 0.5;">Details</span>
|
|
32
|
+
</div>
|
|
33
|
+
</RoundTabs>
|
|
34
|
+
`,
|
|
35
|
+
provide: {
|
|
36
|
+
theme,
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
export const Default = Template.bind({})
|
|
41
|
+
Default.args = {
|
|
42
|
+
height: '40px',
|
|
43
|
+
width: '240px',
|
|
44
|
+
backgroundColor: 'white',
|
|
45
|
+
borderRadius: '20px',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const WidePill = Template.bind({})
|
|
49
|
+
WidePill.args = {
|
|
50
|
+
height: '44px',
|
|
51
|
+
width: '360px',
|
|
52
|
+
backgroundColor: 'grey6',
|
|
53
|
+
borderRadius: '22px',
|
|
54
|
+
}
|