@bethinkpl/design-system 39.1.0 → 40.0.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/design-system.css +1 -1
- package/dist/design-system.js +19329 -19161
- package/dist/design-system.js.map +1 -1
- package/dist/lib/js/components/ActionContent/ActionContent.vue.d.ts +42 -0
- package/dist/lib/js/components/ActionContent/index.d.ts +3 -0
- package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +3 -1
- package/dist/lib/js/components/Cards/Card/Card.consts.d.ts +13 -8
- package/dist/lib/js/components/Cards/Card/Card.vue.d.ts +22 -9
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +77 -21
- package/dist/lib/js/components/Chip/Chip.vue.d.ts +2 -0
- package/dist/lib/js/components/DatePickers/DateBox/DateBox.vue.d.ts +3 -1
- package/dist/lib/js/components/DatePickers/DatePicker/DatePicker.vue.d.ts +7 -5
- package/dist/lib/js/components/DatePickers/DateRangePicker/DateRangePicker.vue.d.ts +4 -2
- package/dist/lib/js/components/Divider/Divider.vue.d.ts +1 -1
- package/dist/lib/js/components/Drawer/DrawerDivider/DrawerDivider.vue.d.ts +1 -1
- package/dist/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue.d.ts +10 -3
- package/dist/lib/js/components/Drawer/DrawerListItem/DrawerListItem.vue.d.ts +2 -0
- package/dist/lib/js/components/Drawer/DrawerSection/DrawerSection.vue.d.ts +10 -4
- package/dist/lib/js/components/Drawer/DrawerTile/DrawerTile.vue.d.ts +4 -4
- package/dist/lib/js/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/dist/lib/js/components/Form/FormField/FormField.utils.d.ts +1 -1
- package/dist/lib/js/components/Form/InputField/InputField.vue.d.ts +2 -2
- package/dist/lib/js/components/Form/PasswordField/PasswordField.vue.d.ts +2 -2
- package/dist/lib/js/components/Form/RadioButton/RadioButton.vue.d.ts +2 -0
- package/dist/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue.d.ts +9 -5
- package/dist/lib/js/components/Headers/PageHeader/PageHeader.vue.d.ts +1 -1
- package/dist/lib/js/components/Headers/SectionHeader/SectionHeader.vue.d.ts +7 -3
- package/dist/lib/js/components/IconText/IconText.vue.d.ts +1 -1
- package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +2 -0
- package/dist/lib/js/components/Image/Image.vue.d.ts +1 -1
- package/dist/lib/js/components/Menu/MenuDivider/MenuDivider.vue.d.ts +1 -1
- package/dist/lib/js/components/Modal/Modal.vue.d.ts +2 -0
- package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +6 -2
- package/dist/lib/js/components/Modals/ModalDialog/ModalDialog.vue.d.ts +6 -2
- package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +6 -2
- package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +2 -0
- package/dist/lib/js/components/ProgressDonutChart/ProgressDonutChart.vue.d.ts +2 -0
- package/dist/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue.d.ts +44 -23
- package/dist/lib/js/components/RichList/RichListItem/RichListItem.vue.d.ts +6 -4
- package/dist/lib/js/components/SelectList/SelectListItemDivider/SelectListItemDivider.vue.d.ts +1 -1
- package/dist/lib/js/components/Skeleton/Skeleton.vue.d.ts +1 -1
- package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +2 -0
- package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +2 -0
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +82 -22
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +82 -22
- package/dist/lib/js/components/Switch/Switch.vue.d.ts +2 -0
- package/dist/lib/js/components/TextGroup/TextGroup.consts.d.ts +14 -3
- package/dist/lib/js/components/TextGroup/TextGroup.vue.d.ts +8 -3
- package/dist/lib/js/components/Tile/Tile.sb.shared.d.ts +4 -2
- package/dist/lib/js/components/Tile/Tile.vue.d.ts +2 -2
- package/dist/lib/js/components/Toast/Toast.vue.d.ts +76 -22
- package/dist/lib/js/components/Toggles/ToggleButton/ToggleButton.vue.d.ts +4 -2
- package/dist/lib/js/components/Well/Well.consts.d.ts +24 -0
- package/dist/lib/js/components/Well/Well.vue.d.ts +13 -1
- package/dist/lib/js/icons/fontawesome.d.ts +1 -0
- package/dist/lib/js/index.d.ts +2 -0
- package/dist/lib/js/utils/type.utils.d.ts +3 -0
- package/lib/images/icons/comment-lock.svg +1 -0
- package/lib/js/components/ActionContent/ActionContent.spec.ts +99 -0
- package/lib/js/components/ActionContent/ActionContent.stories.ts +141 -0
- package/lib/js/components/ActionContent/ActionContent.vue +104 -0
- package/lib/js/components/ActionContent/index.ts +3 -0
- package/lib/js/components/Cards/Card/Card.consts.ts +15 -8
- package/lib/js/components/Cards/Card/Card.spec.ts +61 -1
- package/lib/js/components/Cards/Card/Card.stories.ts +20 -13
- package/lib/js/components/Cards/Card/Card.vue +65 -34
- package/lib/js/components/Chip/Chip.spec.ts +28 -0
- package/lib/js/components/Chip/Chip.stories.ts +7 -2
- package/lib/js/components/Chip/Chip.vue +14 -3
- package/lib/js/components/Icons/Icon/Icon.consts.ts +2 -0
- package/lib/js/components/ProgressDonutChart/ProgressDonutChart.spec.ts +3 -3
- package/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue +8 -1
- package/lib/js/components/TextGroup/TextGroup.consts.ts +15 -1
- package/lib/js/components/TextGroup/TextGroup.stories.ts +14 -5
- package/lib/js/components/TextGroup/TextGroup.vue +51 -28
- package/lib/js/components/Well/Well.consts.ts +16 -0
- package/lib/js/components/Well/Well.spec.ts +112 -0
- package/lib/js/components/Well/Well.stories.ts +90 -1
- package/lib/js/components/Well/Well.vue +135 -4
- package/lib/js/icons/fontawesome.ts +2 -0
- package/lib/js/index.ts +2 -0
- package/lib/js/utils/type.utils.ts +16 -0
- package/package.json +14 -6
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import { h } from 'vue';
|
|
4
|
+
import ActionContent from './ActionContent.vue';
|
|
5
|
+
import DsFeatureIcon from '../Icons/FeatureIcon';
|
|
6
|
+
import DsButton from '../Buttons/Button';
|
|
7
|
+
import { ICONS } from '../Icons/Icon';
|
|
8
|
+
|
|
9
|
+
describe('ActionContent', () => {
|
|
10
|
+
it('renders', () => {
|
|
11
|
+
const wrapper = mount(ActionContent);
|
|
12
|
+
|
|
13
|
+
expect(wrapper.exists()).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('renders the feature icon when icon is provided', () => {
|
|
17
|
+
const wrapper = mount(ActionContent, {
|
|
18
|
+
props: {
|
|
19
|
+
icon: ICONS.FA_COMMENT_DOTS,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
expect(wrapper.findComponent(DsFeatureIcon).exists()).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('does not render the feature icon when icon is not provided', () => {
|
|
27
|
+
const wrapper = mount(ActionContent);
|
|
28
|
+
|
|
29
|
+
expect(wrapper.findComponent(DsFeatureIcon).exists()).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('passes main and supporting text to the text group', () => {
|
|
33
|
+
const wrapper = mount(ActionContent, {
|
|
34
|
+
props: {
|
|
35
|
+
mainText: 'Main text',
|
|
36
|
+
supportingText: 'Supporting text',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
expect(wrapper.find('.ds-actionContent__text').text()).toContain('Main text');
|
|
41
|
+
expect(wrapper.find('.ds-actionContent__text').text()).toContain('Supporting text');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('renders a default primary button with the button label and icon', () => {
|
|
45
|
+
const wrapper = mount(ActionContent, {
|
|
46
|
+
props: {
|
|
47
|
+
buttonLabel: 'Confirm',
|
|
48
|
+
buttonIcon: ICONS.FA_COMMENT_DOTS,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const button = wrapper.findComponent(DsButton);
|
|
53
|
+
expect(button.exists()).toBe(true);
|
|
54
|
+
expect(button.text()).toBe('Confirm');
|
|
55
|
+
expect(button.props('iconLeft')).toStrictEqual(ICONS.FA_COMMENT_DOTS);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('emits button-clicked when the default button is clicked', async () => {
|
|
59
|
+
const wrapper = mount(ActionContent, {
|
|
60
|
+
props: {
|
|
61
|
+
buttonLabel: 'Confirm',
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
await wrapper.findComponent(DsButton).trigger('click');
|
|
66
|
+
|
|
67
|
+
expect(wrapper.emitted('button-clicked')).toHaveLength(1);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('renders the actions slot instead of the default button', () => {
|
|
71
|
+
const wrapper = mount(ActionContent, {
|
|
72
|
+
props: {
|
|
73
|
+
buttonLabel: 'Default button',
|
|
74
|
+
},
|
|
75
|
+
slots: {
|
|
76
|
+
actions: () => h('span', { class: 'custom-action' }, 'Custom action'),
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
expect(wrapper.find('.custom-action').exists()).toBe(true);
|
|
81
|
+
expect(wrapper.findComponent(DsButton).exists()).toBe(false);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('adds the vertical modifier when isActionVertical is set', () => {
|
|
85
|
+
const wrapper = mount(ActionContent, {
|
|
86
|
+
props: {
|
|
87
|
+
isActionVertical: true,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
expect(wrapper.find('.ds-actionContent__actions').classes()).toContain('-ds-vertical');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('does not add the vertical modifier by default', () => {
|
|
95
|
+
const wrapper = mount(ActionContent);
|
|
96
|
+
|
|
97
|
+
expect(wrapper.find('.ds-actionContent__actions').classes()).not.toContain('-ds-vertical');
|
|
98
|
+
});
|
|
99
|
+
});
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import ActionContent from './ActionContent.vue';
|
|
2
|
+
import DsButton from '../Buttons/Button';
|
|
3
|
+
import { BUTTON_COLORS, BUTTON_SIZES, BUTTON_TYPES } from '../Buttons/Button/Button.consts';
|
|
4
|
+
import { ICONS } from '../Icons/Icon';
|
|
5
|
+
|
|
6
|
+
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
7
|
+
import { toRefs } from 'vue';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Components/ActionContent',
|
|
11
|
+
component: ActionContent,
|
|
12
|
+
} as Meta<typeof ActionContent>;
|
|
13
|
+
|
|
14
|
+
const StoryTemplate: StoryFn<typeof ActionContent> = (args) => {
|
|
15
|
+
return {
|
|
16
|
+
components: { ActionContent },
|
|
17
|
+
setup() {
|
|
18
|
+
return {
|
|
19
|
+
...toRefs(args),
|
|
20
|
+
ICONS,
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
template: `
|
|
24
|
+
<action-content
|
|
25
|
+
:icon="ICONS[icon]"
|
|
26
|
+
:main-text="mainText"
|
|
27
|
+
:supporting-text="supportingText"
|
|
28
|
+
:button-label="buttonLabel"
|
|
29
|
+
:button-icon="ICONS[buttonIcon]"
|
|
30
|
+
:is-action-vertical="isActionVertical"
|
|
31
|
+
>
|
|
32
|
+
<template v-if="actions" #actions><span v-html="actions" /></template>
|
|
33
|
+
</action-content>`,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const Interactive = StoryTemplate.bind({});
|
|
38
|
+
|
|
39
|
+
const args = {
|
|
40
|
+
icon: 'FA_COMMENT_DOTS',
|
|
41
|
+
mainText: 'Main text tutaj sobie będzie',
|
|
42
|
+
supportingText: 'Supporting text tutaj będzie',
|
|
43
|
+
buttonLabel: 'Button label',
|
|
44
|
+
buttonIcon: null,
|
|
45
|
+
isActionVertical: false,
|
|
46
|
+
actions: '',
|
|
47
|
+
} as Args;
|
|
48
|
+
|
|
49
|
+
const argTypes = {
|
|
50
|
+
icon: {
|
|
51
|
+
control: 'select',
|
|
52
|
+
options: [null, ...Object.keys(ICONS)],
|
|
53
|
+
},
|
|
54
|
+
mainText: {
|
|
55
|
+
control: 'text',
|
|
56
|
+
},
|
|
57
|
+
supportingText: {
|
|
58
|
+
control: 'text',
|
|
59
|
+
},
|
|
60
|
+
buttonLabel: {
|
|
61
|
+
control: 'text',
|
|
62
|
+
},
|
|
63
|
+
buttonIcon: {
|
|
64
|
+
control: 'select',
|
|
65
|
+
options: [null, ...Object.keys(ICONS)],
|
|
66
|
+
},
|
|
67
|
+
isActionVertical: {
|
|
68
|
+
control: 'boolean',
|
|
69
|
+
},
|
|
70
|
+
actions: {
|
|
71
|
+
control: 'text',
|
|
72
|
+
},
|
|
73
|
+
} as ArgTypes;
|
|
74
|
+
|
|
75
|
+
Interactive.argTypes = argTypes;
|
|
76
|
+
Interactive.args = args;
|
|
77
|
+
|
|
78
|
+
Interactive.parameters = {
|
|
79
|
+
design: {
|
|
80
|
+
type: 'figma',
|
|
81
|
+
url: 'https://www.figma.com/design/uLBrJvVwTYzuch6VnDOBlL/INI-188---Dyskusje-2.0-NEW?node-id=4001-152961&m=dev',
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const WithActionsSlotTemplate: StoryFn<typeof ActionContent> = (args) => {
|
|
86
|
+
return {
|
|
87
|
+
components: { ActionContent, DsButton },
|
|
88
|
+
setup() {
|
|
89
|
+
return {
|
|
90
|
+
...toRefs(args),
|
|
91
|
+
ICONS,
|
|
92
|
+
BUTTON_COLORS,
|
|
93
|
+
BUTTON_SIZES,
|
|
94
|
+
BUTTON_TYPES,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
template: `
|
|
98
|
+
<action-content
|
|
99
|
+
:icon="ICONS[icon]"
|
|
100
|
+
:main-text="mainText"
|
|
101
|
+
:supporting-text="supportingText"
|
|
102
|
+
:is-action-vertical="isActionVertical"
|
|
103
|
+
>
|
|
104
|
+
<template #actions>
|
|
105
|
+
<ds-button
|
|
106
|
+
:color="BUTTON_COLORS.NEUTRAL"
|
|
107
|
+
:type="BUTTON_TYPES.OUTLINED"
|
|
108
|
+
:size="BUTTON_SIZES.SMALL"
|
|
109
|
+
>Cancel</ds-button>
|
|
110
|
+
<ds-button
|
|
111
|
+
:color="BUTTON_COLORS.PRIMARY"
|
|
112
|
+
:type="BUTTON_TYPES.FILLED"
|
|
113
|
+
:size="BUTTON_SIZES.SMALL"
|
|
114
|
+
>Confirm</ds-button>
|
|
115
|
+
</template>
|
|
116
|
+
</action-content>`,
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const WithActionsSlot = WithActionsSlotTemplate.bind({});
|
|
121
|
+
|
|
122
|
+
WithActionsSlot.argTypes = {
|
|
123
|
+
icon: argTypes.icon,
|
|
124
|
+
mainText: argTypes.mainText,
|
|
125
|
+
supportingText: argTypes.supportingText,
|
|
126
|
+
isActionVertical: argTypes.isActionVertical,
|
|
127
|
+
} as ArgTypes;
|
|
128
|
+
|
|
129
|
+
WithActionsSlot.args = {
|
|
130
|
+
icon: 'FA_COMMENT_DOTS',
|
|
131
|
+
mainText: 'Main text tutaj sobie będzie',
|
|
132
|
+
supportingText: 'Supporting text tutaj będzie',
|
|
133
|
+
isActionVertical: false,
|
|
134
|
+
} as Args;
|
|
135
|
+
|
|
136
|
+
WithActionsSlot.parameters = {
|
|
137
|
+
design: {
|
|
138
|
+
type: 'figma',
|
|
139
|
+
url: 'https://www.figma.com/design/uLBrJvVwTYzuch6VnDOBlL/INI-188---Dyskusje-2.0-NEW?node-id=4001-152961&m=dev',
|
|
140
|
+
},
|
|
141
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ds-actionContent">
|
|
3
|
+
<div class="ds-actionContent__content">
|
|
4
|
+
<ds-feature-icon
|
|
5
|
+
v-if="icon"
|
|
6
|
+
class="ds-actionContent__icon"
|
|
7
|
+
:icon="icon"
|
|
8
|
+
:color="FEATURE_ICON_COLOR.PRIMARY"
|
|
9
|
+
:size="FEATURE_ICON_SIZES.MEDIUM"
|
|
10
|
+
double-background
|
|
11
|
+
/>
|
|
12
|
+
<ds-text-group
|
|
13
|
+
class="ds-actionContent__text"
|
|
14
|
+
:eyebrow-text="null"
|
|
15
|
+
:main-text="mainText"
|
|
16
|
+
:supporting-text="supportingText"
|
|
17
|
+
:size="TEXT_GROUP_SIZES.LARGE"
|
|
18
|
+
:align="TEXT_GROUP_ALIGNS.CENTER"
|
|
19
|
+
:main-text-color="TEXT_GROUP_MAIN_TEXT_COLORS.PRIMARY"
|
|
20
|
+
:is-interactive="false"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="ds-actionContent__actions" :class="{ '-ds-vertical': isActionVertical }">
|
|
24
|
+
<slot name="actions">
|
|
25
|
+
<ds-button
|
|
26
|
+
:color="BUTTON_COLORS.PRIMARY"
|
|
27
|
+
:type="BUTTON_TYPES.FILLED"
|
|
28
|
+
:size="BUTTON_SIZES.SMALL"
|
|
29
|
+
:radius="BUTTON_RADIUSES.ROUNDED"
|
|
30
|
+
:icon-left="buttonIcon"
|
|
31
|
+
@click="$emit('button-clicked')"
|
|
32
|
+
>{{ buttonLabel }}</ds-button
|
|
33
|
+
>
|
|
34
|
+
</slot>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<style lang="scss" scoped>
|
|
40
|
+
@import '../../../styles/settings/spacings';
|
|
41
|
+
|
|
42
|
+
.ds-actionContent {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: $space-8;
|
|
46
|
+
width: 100%;
|
|
47
|
+
|
|
48
|
+
&__content {
|
|
49
|
+
align-items: center;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
gap: $space-4;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__actions {
|
|
56
|
+
display: flex;
|
|
57
|
+
gap: $space-8;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
|
|
60
|
+
&.-ds-vertical {
|
|
61
|
+
align-items: stretch;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
67
|
+
|
|
68
|
+
<script setup lang="ts">
|
|
69
|
+
import DsFeatureIcon from '../Icons/FeatureIcon';
|
|
70
|
+
import { FEATURE_ICON_COLOR, FEATURE_ICON_SIZES } from '../Icons/FeatureIcon/FeatureIcon.consts';
|
|
71
|
+
import DsTextGroup from '../TextGroup/TextGroup.vue';
|
|
72
|
+
import {
|
|
73
|
+
TEXT_GROUP_ALIGNS,
|
|
74
|
+
TEXT_GROUP_MAIN_TEXT_COLORS,
|
|
75
|
+
TEXT_GROUP_SIZES,
|
|
76
|
+
} from '../TextGroup/TextGroup.consts';
|
|
77
|
+
import DsButton, { BUTTON_RADIUSES } from '../Buttons/Button';
|
|
78
|
+
import { BUTTON_COLORS, BUTTON_SIZES, BUTTON_TYPES } from '../Buttons/Button/Button.consts';
|
|
79
|
+
import { IconItem } from '../Icons/Icon';
|
|
80
|
+
|
|
81
|
+
const {
|
|
82
|
+
icon = null,
|
|
83
|
+
mainText = null,
|
|
84
|
+
supportingText = null,
|
|
85
|
+
buttonLabel,
|
|
86
|
+
buttonIcon = null,
|
|
87
|
+
isActionVertical = false,
|
|
88
|
+
} = defineProps<{
|
|
89
|
+
icon?: IconItem | null;
|
|
90
|
+
mainText?: string | null;
|
|
91
|
+
supportingText?: string | null;
|
|
92
|
+
buttonLabel?: string;
|
|
93
|
+
buttonIcon?: IconItem | null;
|
|
94
|
+
isActionVertical?: boolean;
|
|
95
|
+
}>();
|
|
96
|
+
|
|
97
|
+
defineEmits<{
|
|
98
|
+
(e: 'button-clicked'): void;
|
|
99
|
+
}>();
|
|
100
|
+
|
|
101
|
+
defineSlots<{
|
|
102
|
+
actions?: () => any;
|
|
103
|
+
}>();
|
|
104
|
+
</script>
|
|
@@ -12,21 +12,28 @@ export const CARD_PADDING_SIZES = {
|
|
|
12
12
|
|
|
13
13
|
export type CardPaddingSize = Value<typeof CARD_PADDING_SIZES>;
|
|
14
14
|
|
|
15
|
-
export const
|
|
15
|
+
export const CARD_BACKGROUND_COLORS = {
|
|
16
|
+
DEFAULT: 'default',
|
|
17
|
+
NEUTRAL: 'neutral',
|
|
18
|
+
} as const;
|
|
19
|
+
|
|
20
|
+
export type CardBackgroundColor = Value<typeof CARD_BACKGROUND_COLORS>;
|
|
21
|
+
|
|
22
|
+
export const CARD_RIBBON_COLORS = CONTAINER_RIBBON_COLORS;
|
|
16
23
|
|
|
17
|
-
export type
|
|
24
|
+
export type CardRibbonColors = Value<typeof CARD_RIBBON_COLORS>;
|
|
18
25
|
|
|
19
|
-
export const
|
|
26
|
+
export const CARD_RIBBON_SIZES = CONTAINER_RIBBON_SIZES;
|
|
20
27
|
|
|
21
|
-
export type
|
|
28
|
+
export type CardRibbonSizes = Value<typeof CARD_RIBBON_SIZES>;
|
|
22
29
|
|
|
23
|
-
export const
|
|
30
|
+
export const CARD_RIBBON_POSITIONS = {
|
|
24
31
|
TOP: 'top',
|
|
25
32
|
LEFT: 'left',
|
|
26
33
|
} as const;
|
|
27
34
|
|
|
28
|
-
export type
|
|
35
|
+
export type CardRibbonPositions = Value<typeof CARD_RIBBON_POSITIONS>;
|
|
29
36
|
|
|
30
|
-
export const
|
|
37
|
+
export const CARD_RIBBON_RADIUS = CONTAINER_RIBBON_RADIUSES;
|
|
31
38
|
|
|
32
|
-
export type
|
|
39
|
+
export type CardRibbonRadius = Value<typeof CARD_RIBBON_RADIUS>;
|
|
@@ -3,7 +3,7 @@ import { ComponentMountingOptions, mount } from '@vue/test-utils';
|
|
|
3
3
|
import { h } from 'vue';
|
|
4
4
|
|
|
5
5
|
import Card from './Card.vue';
|
|
6
|
-
import { CARD_PADDING_SIZES } from './Card.consts';
|
|
6
|
+
import { CARD_BACKGROUND_COLORS, CARD_PADDING_SIZES } from './Card.consts';
|
|
7
7
|
|
|
8
8
|
describe('Card', () => {
|
|
9
9
|
const createComponent = (options: ComponentMountingOptions<typeof Card> = {}) => {
|
|
@@ -177,4 +177,64 @@ describe('Card', () => {
|
|
|
177
177
|
|
|
178
178
|
expect(component.find('.ds-card').classes()).toContain('-ds-flat');
|
|
179
179
|
});
|
|
180
|
+
|
|
181
|
+
it('should not set no-radius class by default', () => {
|
|
182
|
+
const component = createComponent();
|
|
183
|
+
|
|
184
|
+
expect(component.find('.ds-card').classes()).not.toContain('-ds-noRadius');
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('should set no-radius class when hasRadius is false', () => {
|
|
188
|
+
const component = createComponent({
|
|
189
|
+
props: { hasRadius: false },
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
expect(component.find('.ds-card').classes()).toContain('-ds-noRadius');
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it('should not set neutral background class by default', () => {
|
|
196
|
+
const component = createComponent();
|
|
197
|
+
|
|
198
|
+
expect(component.find('.ds-card').classes()).not.toContain('-ds-backgroundNeutral');
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('should set neutral background class when backgroundColor is neutral', () => {
|
|
202
|
+
const component = createComponent({
|
|
203
|
+
props: { backgroundColor: CARD_BACKGROUND_COLORS.NEUTRAL },
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
expect(component.find('.ds-card').classes()).toContain('-ds-backgroundNeutral');
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('should not give the ribbon a radius when only hasRibbonRadius is set', () => {
|
|
210
|
+
const component = createComponent({
|
|
211
|
+
props: { hasRibbon: true, hasRibbonRadius: true },
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
expect(component.find('.-ds-radius-bottom').exists()).toBe(false);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('should give the ribbon a radius when hasRibbonRadius and card has no radius', () => {
|
|
218
|
+
const component = createComponent({
|
|
219
|
+
props: { hasRibbon: true, hasRibbonRadius: true, hasRadius: false },
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
expect(component.find('.-ds-radius-bottom').exists()).toBe(true);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('should not give the ribbon a radius when hasRadius is false but hasRibbonRadius is false', () => {
|
|
226
|
+
const component = createComponent({
|
|
227
|
+
props: { hasRibbon: true, hasRibbonRadius: false, hasRadius: false },
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
expect(component.find('.-ds-radius-bottom').exists()).toBe(false);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it('should give the ribbon a radius when hasRibbonRadius and card is flat', () => {
|
|
234
|
+
const component = createComponent({
|
|
235
|
+
props: { hasRibbon: true, hasRibbonRadius: true, isFlat: true },
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
expect(component.find('.-ds-radius-bottom').exists()).toBe(true);
|
|
239
|
+
});
|
|
180
240
|
});
|
|
@@ -2,9 +2,10 @@ import Card from './Card.vue';
|
|
|
2
2
|
|
|
3
3
|
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
CARD_BACKGROUND_COLORS,
|
|
6
|
+
CARD_RIBBON_COLORS,
|
|
7
|
+
CARD_RIBBON_POSITIONS,
|
|
8
|
+
CARD_RIBBON_SIZES,
|
|
8
9
|
CARD_PADDING_SIZES,
|
|
9
10
|
} from './Card.consts';
|
|
10
11
|
import { LOADING_BAR_COLORS } from '../../LoadingBar';
|
|
@@ -44,10 +45,12 @@ const args = {
|
|
|
44
45
|
footerHasPadding: false,
|
|
45
46
|
paddingSize: CARD_PADDING_SIZES.SMALL,
|
|
46
47
|
dividerUnderHeader: false,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
hasRibbon: false,
|
|
49
|
+
hasRadius: true,
|
|
50
|
+
backgroundColor: CARD_BACKGROUND_COLORS.DEFAULT,
|
|
51
|
+
ribbonPosition: CARD_RIBBON_POSITIONS.TOP,
|
|
52
|
+
ribbonSize: CARD_RIBBON_SIZES.MEDIUM,
|
|
53
|
+
ribbonColor: CARD_RIBBON_COLORS.NEUTRAL_HEAVY,
|
|
51
54
|
hasRibbonRadius: false,
|
|
52
55
|
hasLoadingBar: false,
|
|
53
56
|
loadingBarColor: LOADING_BAR_COLORS.NEUTRAL_HEAVY,
|
|
@@ -62,17 +65,21 @@ const argTypes = {
|
|
|
62
65
|
control: 'text',
|
|
63
66
|
},
|
|
64
67
|
footer: { control: 'text' },
|
|
65
|
-
|
|
68
|
+
backgroundColor: {
|
|
66
69
|
control: 'select',
|
|
67
|
-
options: Object.values(
|
|
70
|
+
options: Object.values(CARD_BACKGROUND_COLORS),
|
|
68
71
|
},
|
|
69
|
-
|
|
72
|
+
ribbonPosition: {
|
|
70
73
|
control: 'select',
|
|
71
|
-
options: Object.values(
|
|
74
|
+
options: Object.values(CARD_RIBBON_POSITIONS),
|
|
72
75
|
},
|
|
73
|
-
|
|
76
|
+
ribbonSize: {
|
|
74
77
|
control: 'select',
|
|
75
|
-
options: Object.values(
|
|
78
|
+
options: Object.values(CARD_RIBBON_SIZES),
|
|
79
|
+
},
|
|
80
|
+
ribbonColor: {
|
|
81
|
+
control: 'select',
|
|
82
|
+
options: Object.values(CARD_RIBBON_COLORS),
|
|
76
83
|
},
|
|
77
84
|
hasRibbonRadius: {
|
|
78
85
|
control: 'boolean',
|