@bethinkpl/design-system 41.1.4 → 42.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 +8208 -8264
- package/dist/design-system.js.map +1 -1
- package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +3 -0
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +3 -0
- package/dist/lib/js/components/DatePickers/DateBox/DateBox.vue.d.ts +3 -0
- package/dist/lib/js/components/DatePickers/DatePicker/DatePicker.vue.d.ts +3 -0
- package/dist/lib/js/components/DatePickers/DateRangePicker/DateRangePicker.vue.d.ts +3 -0
- package/dist/lib/js/components/Drawer/Drawer.consts.d.ts +6 -0
- package/dist/lib/js/components/Drawer/Drawer.vue.d.ts +13 -1
- package/dist/lib/js/components/Drawer/DrawerHeader/DrawerHeader.consts.d.ts +5 -0
- package/dist/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue.d.ts +63 -1394
- package/dist/lib/js/components/Drawer/DrawerSection/DrawerSection.vue.d.ts +9 -0
- package/dist/lib/js/components/Form/RadioButton/RadioButton.vue.d.ts +3 -0
- package/dist/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue.d.ts +6 -0
- package/dist/lib/js/components/Headers/SectionHeader/SectionHeader.vue.d.ts +6 -0
- package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +3 -0
- package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +6 -0
- package/dist/lib/js/components/Modals/ModalDialog/ModalDialog.vue.d.ts +6 -0
- package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +6 -0
- package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +3 -0
- package/dist/lib/js/components/ProgressDonutChart/ProgressDonutChart.vue.d.ts +3 -0
- package/dist/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue.d.ts +3 -0
- package/dist/lib/js/components/RichList/RichListItem/RichListItem.vue.d.ts +3 -0
- package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +3 -0
- package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +3 -0
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +979 -154
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +970 -145
- package/dist/lib/js/components/Switch/Switch.vue.d.ts +3 -0
- package/dist/lib/js/components/Tile/Tile.sb.shared.d.ts +3 -0
- package/dist/lib/js/components/Toggles/ToggleButton/ToggleButton.vue.d.ts +3 -0
- package/dist/lib/js/icons/fontawesome.d.ts +3 -0
- package/dist/lib/js/index.d.ts +0 -1
- package/lib/js/components/Drawer/Drawer.consts.ts +9 -0
- package/lib/js/components/Drawer/Drawer.spec.ts +36 -0
- package/lib/js/components/Drawer/Drawer.stories.ts +7 -2
- package/lib/js/components/Drawer/Drawer.vue +35 -2
- package/lib/js/components/Drawer/DrawerHeader/DrawerHeader.consts.ts +8 -0
- package/lib/js/components/Drawer/DrawerHeader/DrawerHeader.spec.ts +40 -1
- package/lib/js/components/Drawer/DrawerHeader/DrawerHeader.stories.ts +22 -8
- package/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue +129 -146
- package/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue +7 -12
- package/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue +7 -12
- package/lib/js/icons/fontawesome.ts +6 -0
- package/lib/js/index.ts +0 -1
- package/package.json +1 -1
- package/dist/lib/js/components/Modal/Modal.vue.d.ts +0 -394
- package/dist/lib/js/components/Modal/index.d.ts +0 -3
- package/lib/js/components/Modal/Modal.spec.ts +0 -58
- package/lib/js/components/Modal/Modal.vue +0 -137
- package/lib/js/components/Modal/index.ts +0 -3
|
@@ -85,6 +85,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
85
85
|
readonly FA_BADGE_PERCENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
86
86
|
readonly FA_BAN: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
87
87
|
readonly FA_BARS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
88
|
+
readonly FA_BELL_SLASH_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
89
|
+
readonly FA_BELL_ON_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
88
90
|
readonly FA_BELL_SLASH: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
89
91
|
readonly FA_BELL: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
90
92
|
readonly FA_BOLT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
@@ -152,6 +154,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
152
154
|
readonly FA_COMMENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
153
155
|
readonly FA_COMMENTS_QUESTION_CHECK: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
154
156
|
readonly FA_COMMENTS_QUESTION: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
157
|
+
readonly FA_COMMENTS_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
155
158
|
readonly FA_COMMENTS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
156
159
|
readonly FA_COMPASS_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
157
160
|
readonly FA_COMPRESS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
@@ -45,6 +45,8 @@ export declare const data: () => {
|
|
|
45
45
|
readonly FA_BADGE_PERCENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
46
46
|
readonly FA_BAN: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
47
47
|
readonly FA_BARS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
48
|
+
readonly FA_BELL_SLASH_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
49
|
+
readonly FA_BELL_ON_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
48
50
|
readonly FA_BELL_SLASH: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
49
51
|
readonly FA_BELL: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
50
52
|
readonly FA_BOLT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
@@ -112,6 +114,7 @@ export declare const data: () => {
|
|
|
112
114
|
readonly FA_COMMENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
113
115
|
readonly FA_COMMENTS_QUESTION_CHECK: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
114
116
|
readonly FA_COMMENTS_QUESTION: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
117
|
+
readonly FA_COMMENTS_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
115
118
|
readonly FA_COMMENTS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
116
119
|
readonly FA_COMPASS_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
117
120
|
readonly FA_COMPRESS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
@@ -101,6 +101,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
101
101
|
readonly FA_BADGE_PERCENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
102
102
|
readonly FA_BAN: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
103
103
|
readonly FA_BARS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
104
|
+
readonly FA_BELL_SLASH_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
105
|
+
readonly FA_BELL_ON_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
104
106
|
readonly FA_BELL_SLASH: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
105
107
|
readonly FA_BELL: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
106
108
|
readonly FA_BOLT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
@@ -168,6 +170,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
168
170
|
readonly FA_COMMENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
169
171
|
readonly FA_COMMENTS_QUESTION_CHECK: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
170
172
|
readonly FA_COMMENTS_QUESTION: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
173
|
+
readonly FA_COMMENTS_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
171
174
|
readonly FA_COMMENTS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
172
175
|
readonly FA_COMPASS_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
173
176
|
readonly FA_COMPRESS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
@@ -29,6 +29,8 @@ export declare const FONTAWESOME_ICONS: {
|
|
|
29
29
|
readonly FA_BADGE_PERCENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
30
30
|
readonly FA_BAN: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
31
31
|
readonly FA_BARS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
32
|
+
readonly FA_BELL_SLASH_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
33
|
+
readonly FA_BELL_ON_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
32
34
|
readonly FA_BELL_SLASH: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
33
35
|
readonly FA_BELL: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
34
36
|
readonly FA_BOLT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
@@ -96,6 +98,7 @@ export declare const FONTAWESOME_ICONS: {
|
|
|
96
98
|
readonly FA_COMMENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
97
99
|
readonly FA_COMMENTS_QUESTION_CHECK: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
98
100
|
readonly FA_COMMENTS_QUESTION: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
101
|
+
readonly FA_COMMENTS_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
99
102
|
readonly FA_COMMENTS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
100
103
|
readonly FA_COMPASS_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
|
101
104
|
readonly FA_COMPRESS: import('@fortawesome/fontawesome-common-types').IconDefinition;
|
package/dist/lib/js/index.d.ts
CHANGED
|
@@ -46,7 +46,6 @@ export { default as IconButton } from './components/Buttons/IconButton';
|
|
|
46
46
|
export { default as DsIconButton } from './components/Buttons/IconButton';
|
|
47
47
|
export * from './components/Buttons/IconButton/IconButton.consts';
|
|
48
48
|
export { default as DsInputField } from './components/Form/InputField';
|
|
49
|
-
export { default as Modal } from './components/Modal';
|
|
50
49
|
export { default as DsModal } from './components/Modals/Modal';
|
|
51
50
|
export * from './components/Modals/Modal/Modal.consts';
|
|
52
51
|
export { default as DsModalDialog } from './components/Modals/ModalDialog';
|
|
@@ -4,3 +4,12 @@ export const DRAWER_POSITIONS = {
|
|
|
4
4
|
} as const;
|
|
5
5
|
|
|
6
6
|
export type DrawerPosition = (typeof DRAWER_POSITIONS)[keyof typeof DRAWER_POSITIONS];
|
|
7
|
+
|
|
8
|
+
export const DRAWER_BACKGROUND_COLORS = {
|
|
9
|
+
NONE: 'none',
|
|
10
|
+
DEFAULT: 'default',
|
|
11
|
+
NEUTRAL: 'neutral',
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
export type DrawerBackgroundColor =
|
|
15
|
+
(typeof DRAWER_BACKGROUND_COLORS)[keyof typeof DRAWER_BACKGROUND_COLORS];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import Drawer from './Drawer.vue';
|
|
4
|
+
import { DRAWER_BACKGROUND_COLORS, DrawerBackgroundColor } from './Drawer.consts';
|
|
5
|
+
|
|
6
|
+
const createComponent = (props = {}, slots = {}) => {
|
|
7
|
+
return mount(Drawer, {
|
|
8
|
+
props,
|
|
9
|
+
slots,
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
describe('Drawer', () => {
|
|
14
|
+
describe('backgroundColor', () => {
|
|
15
|
+
it.each([
|
|
16
|
+
[DRAWER_BACKGROUND_COLORS.DEFAULT, '-ds-backgroundDefault'],
|
|
17
|
+
[DRAWER_BACKGROUND_COLORS.NEUTRAL, '-ds-backgroundNeutral'],
|
|
18
|
+
])('should set the %s background class', (backgroundColor, expectedClass) => {
|
|
19
|
+
const component = createComponent({ backgroundColor });
|
|
20
|
+
|
|
21
|
+
expect(component.find('.ds-drawer').classes()).toContain(expectedClass);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it.each([undefined, DRAWER_BACKGROUND_COLORS.NONE])(
|
|
25
|
+
'should not set any background class when backgroundColor is %s',
|
|
26
|
+
(backgroundColor?: DrawerBackgroundColor) => {
|
|
27
|
+
const component = createComponent({ backgroundColor });
|
|
28
|
+
|
|
29
|
+
const classes = component.find('.ds-drawer').classes();
|
|
30
|
+
|
|
31
|
+
expect(classes).not.toContain('-ds-backgroundDefault');
|
|
32
|
+
expect(classes).not.toContain('-ds-backgroundNeutral');
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Drawer from './Drawer.vue';
|
|
2
|
-
import { DRAWER_POSITIONS } from './Drawer.consts';
|
|
2
|
+
import { DRAWER_BACKGROUND_COLORS, DRAWER_POSITIONS } from './Drawer.consts';
|
|
3
3
|
|
|
4
4
|
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ const StoryTemplate: StoryFn<typeof Drawer> = (args) => ({
|
|
|
14
14
|
return args;
|
|
15
15
|
},
|
|
16
16
|
template: `<div style="height: 300px; width: 200px;">
|
|
17
|
-
<drawer :position="position" :sticky-header="stickyHeader" :sticky-footer="stickyFooter">
|
|
17
|
+
<drawer :position="position" :sticky-header="stickyHeader" :sticky-footer="stickyFooter" :background-color="backgroundColor">
|
|
18
18
|
<template v-slot:header><div style="background-color: var(--raw-gray-100)">Header<br><br></div></template>
|
|
19
19
|
<div>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br>Content<br></div>
|
|
20
20
|
<template v-slot:footer><div style="background-color: var(--raw-gray-100)">Footer<br><br></div></template>
|
|
@@ -28,6 +28,7 @@ const args = {
|
|
|
28
28
|
position: DRAWER_POSITIONS.RIGHT,
|
|
29
29
|
stickyHeader: true,
|
|
30
30
|
stickyFooter: true,
|
|
31
|
+
backgroundColor: DRAWER_BACKGROUND_COLORS.NONE,
|
|
31
32
|
} as Args;
|
|
32
33
|
|
|
33
34
|
const argTypes = {
|
|
@@ -35,6 +36,10 @@ const argTypes = {
|
|
|
35
36
|
control: 'select',
|
|
36
37
|
options: Object.values(DRAWER_POSITIONS),
|
|
37
38
|
},
|
|
39
|
+
backgroundColor: {
|
|
40
|
+
control: 'select',
|
|
41
|
+
options: Object.values(DRAWER_BACKGROUND_COLORS),
|
|
42
|
+
},
|
|
38
43
|
} as ArgTypes;
|
|
39
44
|
|
|
40
45
|
Interactive.argTypes = argTypes;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="ds-drawer scrollable-container"
|
|
4
|
+
:class="[positionClassName, backgroundColorClassName]"
|
|
5
|
+
>
|
|
3
6
|
<div v-if="$slots.header && stickyHeader" class="ds-drawer__header -ds-sticky">
|
|
4
7
|
<slot name="header" />
|
|
5
8
|
</div>
|
|
@@ -48,6 +51,14 @@
|
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
|
|
54
|
+
&.-ds-backgroundDefault {
|
|
55
|
+
background-color: $color-default-background;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&.-ds-backgroundNeutral {
|
|
59
|
+
background-color: $color-neutral-background;
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
&__header,
|
|
52
63
|
&__footer {
|
|
53
64
|
flex-shrink: 0;
|
|
@@ -73,7 +84,12 @@
|
|
|
73
84
|
<script lang="ts">
|
|
74
85
|
import { defineComponent, PropType } from 'vue';
|
|
75
86
|
|
|
76
|
-
import {
|
|
87
|
+
import {
|
|
88
|
+
DRAWER_BACKGROUND_COLORS,
|
|
89
|
+
DRAWER_POSITIONS,
|
|
90
|
+
DrawerBackgroundColor,
|
|
91
|
+
DrawerPosition,
|
|
92
|
+
} from './Drawer.consts';
|
|
77
93
|
|
|
78
94
|
export default defineComponent({
|
|
79
95
|
name: 'Drawer',
|
|
@@ -93,6 +109,13 @@ export default defineComponent({
|
|
|
93
109
|
type: Boolean,
|
|
94
110
|
default: true,
|
|
95
111
|
},
|
|
112
|
+
backgroundColor: {
|
|
113
|
+
type: String as PropType<DrawerBackgroundColor>,
|
|
114
|
+
default: DRAWER_BACKGROUND_COLORS.NONE,
|
|
115
|
+
validator(backgroundColor: DrawerBackgroundColor) {
|
|
116
|
+
return Object.values(DRAWER_BACKGROUND_COLORS).includes(backgroundColor);
|
|
117
|
+
},
|
|
118
|
+
},
|
|
96
119
|
},
|
|
97
120
|
computed: {
|
|
98
121
|
positionClassName(): string {
|
|
@@ -102,6 +125,16 @@ export default defineComponent({
|
|
|
102
125
|
|
|
103
126
|
return '-ds-positionRight';
|
|
104
127
|
},
|
|
128
|
+
backgroundColorClassName(): string | null {
|
|
129
|
+
switch (this.backgroundColor) {
|
|
130
|
+
case DRAWER_BACKGROUND_COLORS.DEFAULT:
|
|
131
|
+
return '-ds-backgroundDefault';
|
|
132
|
+
case DRAWER_BACKGROUND_COLORS.NEUTRAL:
|
|
133
|
+
return '-ds-backgroundNeutral';
|
|
134
|
+
default:
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
},
|
|
105
138
|
},
|
|
106
139
|
});
|
|
107
140
|
</script>
|
|
@@ -5,3 +5,11 @@ export const DRAWER_HEADER_TITLE_COLORS = {
|
|
|
5
5
|
|
|
6
6
|
export type DrawerHeaderTitleColor =
|
|
7
7
|
(typeof DRAWER_HEADER_TITLE_COLORS)[keyof typeof DRAWER_HEADER_TITLE_COLORS];
|
|
8
|
+
|
|
9
|
+
export const DRAWER_HEADER_BACKGROUND_COLORS = {
|
|
10
|
+
NONE: 'none',
|
|
11
|
+
DEFAULT: 'default',
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
export type DrawerHeaderBackgroundColor =
|
|
15
|
+
(typeof DRAWER_HEADER_BACKGROUND_COLORS)[keyof typeof DRAWER_HEADER_BACKGROUND_COLORS];
|
|
@@ -2,10 +2,15 @@ import { describe, expect, it } from 'vitest';
|
|
|
2
2
|
import { mount } from '@vue/test-utils';
|
|
3
3
|
import DrawerHeader from './DrawerHeader.vue';
|
|
4
4
|
import { IconButton } from '../../../';
|
|
5
|
+
import {
|
|
6
|
+
DRAWER_HEADER_BACKGROUND_COLORS,
|
|
7
|
+
DrawerHeaderBackgroundColor,
|
|
8
|
+
} from './DrawerHeader.consts';
|
|
5
9
|
|
|
6
|
-
const createComponent = (props = {}) => {
|
|
10
|
+
const createComponent = (props = {}, slots = {}) => {
|
|
7
11
|
return mount(DrawerHeader, {
|
|
8
12
|
props,
|
|
13
|
+
slots,
|
|
9
14
|
});
|
|
10
15
|
};
|
|
11
16
|
|
|
@@ -52,4 +57,38 @@ describe('DrawerHeader', () => {
|
|
|
52
57
|
expect(component.emitted().backClicked).toHaveLength(1);
|
|
53
58
|
});
|
|
54
59
|
});
|
|
60
|
+
|
|
61
|
+
describe('supporting slot', () => {
|
|
62
|
+
it('should render the slot content inside the header wrapper', () => {
|
|
63
|
+
const component = createComponent(
|
|
64
|
+
{},
|
|
65
|
+
{ supporting: '<span class="supporting-content">Supporting</span>' },
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const headerWrapper = component.find('.ds-drawerHeader__headerWrapper').element;
|
|
69
|
+
|
|
70
|
+
expect(component.find('.supporting-content').element.parentElement).toBe(headerWrapper);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('backgroundColor', () => {
|
|
75
|
+
it('should set the default background class when backgroundColor is default', () => {
|
|
76
|
+
const component = createComponent({
|
|
77
|
+
backgroundColor: DRAWER_HEADER_BACKGROUND_COLORS.DEFAULT,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
expect(component.find('.ds-drawerHeader').classes()).toContain('-ds-backgroundDefault');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it.each([undefined, DRAWER_HEADER_BACKGROUND_COLORS.NONE])(
|
|
84
|
+
'should not set any background class when backgroundColor is %s',
|
|
85
|
+
(backgroundColor?: DrawerHeaderBackgroundColor) => {
|
|
86
|
+
const component = createComponent({ backgroundColor });
|
|
87
|
+
|
|
88
|
+
expect(component.find('.ds-drawerHeader').classes()).not.toContain(
|
|
89
|
+
'-ds-backgroundDefault',
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
});
|
|
55
94
|
});
|
|
@@ -2,7 +2,11 @@ import DrawerHeader from './DrawerHeader.vue';
|
|
|
2
2
|
|
|
3
3
|
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
4
4
|
import { ICONS } from '../../Icons/Icon';
|
|
5
|
-
import { DRAWER_HEADER_TITLE_COLORS } from './DrawerHeader.consts';
|
|
5
|
+
import { DRAWER_HEADER_BACKGROUND_COLORS, DRAWER_HEADER_TITLE_COLORS } from './DrawerHeader.consts';
|
|
6
|
+
import SlotPlaceholder, {
|
|
7
|
+
SLOT_PLACEHOLDER_SIZES,
|
|
8
|
+
} from '../../../../../.storybook/SlotPlaceholder/SlotPlaceholder.vue';
|
|
9
|
+
import { toRefs } from 'vue';
|
|
6
10
|
|
|
7
11
|
export default {
|
|
8
12
|
title: 'Components/Drawer/DrawerHeader',
|
|
@@ -10,13 +14,12 @@ export default {
|
|
|
10
14
|
} as Meta<typeof DrawerHeader>;
|
|
11
15
|
|
|
12
16
|
const StoryTemplate: StoryFn<typeof DrawerHeader> = (args) => ({
|
|
13
|
-
components: { DrawerHeader },
|
|
17
|
+
components: { DrawerHeader, SlotPlaceholder },
|
|
14
18
|
setup() {
|
|
15
|
-
return args;
|
|
16
|
-
},
|
|
17
|
-
data() {
|
|
18
19
|
return {
|
|
19
|
-
|
|
20
|
+
...toRefs(args),
|
|
21
|
+
ICONS,
|
|
22
|
+
SLOT_PLACEHOLDER_SIZES,
|
|
20
23
|
};
|
|
21
24
|
},
|
|
22
25
|
template: `
|
|
@@ -33,12 +36,16 @@ const StoryTemplate: StoryFn<typeof DrawerHeader> = (args) => ({
|
|
|
33
36
|
:title-ellipsis="titleEllipsis"
|
|
34
37
|
:title="title"
|
|
35
38
|
:has-back-button="hasBackButton"
|
|
39
|
+
:background-color="backgroundColor"
|
|
36
40
|
>
|
|
37
41
|
<template #actions v-if="actions">
|
|
38
|
-
<
|
|
42
|
+
<slot-placeholder :label="actions" :size="SLOT_PLACEHOLDER_SIZES.SMALL" />
|
|
39
43
|
</template>
|
|
40
44
|
<template #titleTrailing v-if="titleTrailing">
|
|
41
|
-
<
|
|
45
|
+
<slot-placeholder :label="titleTrailing" :size="SLOT_PLACEHOLDER_SIZES.SMALL" />
|
|
46
|
+
</template>
|
|
47
|
+
<template #supporting v-if="supporting">
|
|
48
|
+
<slot-placeholder :label="supporting" :size="SLOT_PLACEHOLDER_SIZES.SMALL" />
|
|
42
49
|
</template>
|
|
43
50
|
</drawer-header>`,
|
|
44
51
|
});
|
|
@@ -59,7 +66,9 @@ const args = {
|
|
|
59
66
|
isSecondLevel: false,
|
|
60
67
|
actions: 'actions slot',
|
|
61
68
|
titleTrailing: 'trailing slot',
|
|
69
|
+
supporting: 'supporting slot',
|
|
62
70
|
hasBackButton: false,
|
|
71
|
+
backgroundColor: DRAWER_HEADER_BACKGROUND_COLORS.NONE,
|
|
63
72
|
} as Args;
|
|
64
73
|
|
|
65
74
|
const argTypes = {
|
|
@@ -82,7 +91,12 @@ const argTypes = {
|
|
|
82
91
|
isClosable: { control: 'boolean' },
|
|
83
92
|
actions: { control: 'text' },
|
|
84
93
|
titleTrailing: { control: 'text' },
|
|
94
|
+
supporting: { control: 'text' },
|
|
85
95
|
hasBackButton: { control: 'boolean' },
|
|
96
|
+
backgroundColor: {
|
|
97
|
+
control: 'select',
|
|
98
|
+
options: Object.values(DRAWER_HEADER_BACKGROUND_COLORS),
|
|
99
|
+
},
|
|
86
100
|
} as ArgTypes;
|
|
87
101
|
|
|
88
102
|
Interactive.argTypes = argTypes;
|