@bethinkpl/design-system 40.1.0 → 41.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/design-system.css +1 -1
- package/dist/design-system.js +7004 -6905
- package/dist/design-system.js.map +1 -1
- package/dist/lib/js/components/Cards/Card/Card.vue.d.ts +2 -9
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +2 -36
- package/dist/lib/js/components/DatePickers/DatePicker/DatePicker.vue.d.ts +1 -1
- package/dist/lib/js/components/Drawer/DrawerTile/DrawerTile.vue.d.ts +2 -2
- package/dist/lib/js/components/LabelValue/LabelValueItem/LabelValueItem.consts.d.ts +17 -0
- package/dist/lib/js/components/LabelValue/LabelValueItem/LabelValueItem.vue.d.ts +27 -0
- package/dist/lib/js/components/LabelValue/LabelValueItemGroup/LabelValueItemGroup.vue.d.ts +13 -0
- package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +6 -2
- package/dist/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue.d.ts +3 -12
- package/dist/lib/js/components/RichList/RichListItem/RichListItem.vue.d.ts +1 -1
- package/dist/lib/js/components/SelectList/SelectListItem/SelectListItem.vue.d.ts +6 -2
- package/dist/lib/js/components/SelectList/SelectListItemToggle/SelectListItemToggle.vue.d.ts +6 -2
- package/dist/lib/js/components/Stepper/Stepper.vue.d.ts +23 -0
- package/dist/lib/js/components/Stepper/index.d.ts +3 -0
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +2 -36
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +2 -36
- package/dist/lib/js/components/TextGroup/TextGroup.vue.d.ts +0 -3
- package/dist/lib/js/components/Tile/Tile.vue.d.ts +1 -1
- package/dist/lib/js/components/Toast/Toast.vue.d.ts +2 -36
- package/dist/lib/js/components/Toggles/ToggleButton/ToggleButton.vue.d.ts +1 -1
- package/dist/lib/js/components/TopNav/TopNav/TopNav.vue.d.ts +17 -0
- package/dist/lib/js/components/TopNav/TopNavBranding/TopNavBranding.vue.d.ts +33 -0
- package/dist/lib/js/components/TopNav/topNavStoryLogo.d.ts +1 -0
- package/dist/lib/js/index.d.ts +6 -5
- package/lib/js/components/Cards/Card/Card.spec.ts +50 -0
- package/lib/js/components/Cards/Card/Card.stories.ts +5 -0
- package/lib/js/components/Cards/Card/Card.vue +14 -11
- package/lib/js/components/LabelValue/LabelValueItem/LabelValueItem.consts.ts +20 -0
- package/lib/js/components/LabelValue/LabelValueItem/LabelValueItem.spec.ts +125 -0
- package/lib/js/components/LabelValue/LabelValueItem/LabelValueItem.stories.ts +69 -0
- package/lib/js/components/LabelValue/LabelValueItem/LabelValueItem.vue +101 -0
- package/lib/js/components/LabelValue/LabelValueItemGroup/LabelValueItemGroup.spec.ts +24 -0
- package/lib/js/components/LabelValue/LabelValueItemGroup/LabelValueItemGroup.stories.ts +31 -0
- package/lib/js/components/LabelValue/LabelValueItemGroup/LabelValueItemGroup.vue +19 -0
- package/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.stories.ts +93 -8
- package/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue +3 -0
- package/lib/js/components/RichList/RichListItem/RichListItem.stories.ts +83 -0
- package/lib/js/components/RichList/RichListItem/RichListItem.vue +11 -4
- package/lib/js/components/SelectList/SelectListItem/SelectListItem.stories.ts +7 -0
- package/lib/js/components/SelectList/SelectListItem/SelectListItem.vue +9 -3
- package/lib/js/components/Stepper/Stepper.spec.ts +99 -0
- package/lib/js/components/Stepper/Stepper.stories.ts +62 -0
- package/lib/js/components/Stepper/Stepper.vue +97 -0
- package/lib/js/components/Stepper/index.ts +3 -0
- package/lib/js/components/TextGroup/TextGroup.vue +0 -5
- package/lib/js/components/TopNav/TopNav/TopNav.spec.ts +56 -0
- package/lib/js/components/TopNav/TopNav/TopNav.stories.ts +99 -0
- package/lib/js/components/TopNav/TopNav/TopNav.vue +79 -0
- package/lib/js/components/TopNav/TopNavBranding/TopNavBranding.spec.ts +103 -0
- package/lib/js/components/TopNav/TopNavBranding/TopNavBranding.stories.ts +107 -0
- package/lib/js/components/TopNav/TopNavBranding/TopNavBranding.vue +102 -0
- package/lib/js/components/TopNav/topNavStoryLogo.ts +19 -0
- package/lib/js/index.ts +6 -5
- package/lib/js/styles/Radiuses/Radiuses.stories.ts +44 -0
- package/lib/js/styles/Shadows/Shadows.stories.scss +33 -0
- package/lib/js/styles/Shadows/Shadows.stories.ts +37 -0
- package/package.json +1 -1
- package/dist/lib/js/components/Drawer/DrawerListItem/DrawerListItem.consts.d.ts +0 -5
- package/dist/lib/js/components/Drawer/DrawerListItem/DrawerListItem.vue.d.ts +0 -406
- package/dist/lib/js/components/Drawer/DrawerListItemGroup/DrawerListItemGroup.vue.d.ts +0 -2
- package/lib/js/components/Drawer/DrawerListItem/DrawerListItem.consts.ts +0 -7
- package/lib/js/components/Drawer/DrawerListItem/DrawerListItem.stories.ts +0 -44
- package/lib/js/components/Drawer/DrawerListItem/DrawerListItem.vue +0 -83
- package/lib/js/components/Drawer/DrawerListItemGroup/DrawerListItemGroup.stories.ts +0 -31
- package/lib/js/components/Drawer/DrawerListItemGroup/DrawerListItemGroup.vue +0 -21
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type RouterLocation = string | Record<string, unknown>;
|
|
2
|
+
declare function __VLS_template(): Readonly<{
|
|
3
|
+
logo?: () => any;
|
|
4
|
+
accessory?: () => any;
|
|
5
|
+
}> & {
|
|
6
|
+
logo?: () => any;
|
|
7
|
+
accessory?: () => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
10
|
+
title: string;
|
|
11
|
+
href?: string;
|
|
12
|
+
to?: RouterLocation;
|
|
13
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
14
|
+
title: string;
|
|
15
|
+
href?: string;
|
|
16
|
+
to?: RouterLocation;
|
|
17
|
+
}>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
18
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
22
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
+
} : {
|
|
25
|
+
type: import('vue').PropType<T[K]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
30
|
+
new (): {
|
|
31
|
+
$slots: S;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TOP_NAV_STORY_LOGO = "\n\t<span style=\"display: inline-flex; height: 24px; width: 31.448px;\">\n\t\t<svg preserveAspectRatio=\"none\" width=\"100%\" height=\"100%\" viewBox=\"0 0 31.4483 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" style=\"display: block;\">\n\t\t\t<g clip-path=\"url(#clip0_0_28)\">\n\t\t\t\t<path d=\"M6.79071 8.23154C6.79071 8.64557 7.12449 8.95993 7.51966 8.95993C7.68463 8.95993 7.84193 8.90242 7.96086 8.81041L11.947 11.7278C11.8818 11.8658 11.8435 12.023 11.8435 12.1878C11.8435 12.3527 11.878 12.4984 11.9432 12.6287L7.96853 15.3966C7.84193 15.2969 7.68463 15.2318 7.51582 15.2318C7.10147 15.2318 6.78687 15.5653 6.78687 15.9601C6.78687 16.3742 7.12065 16.6885 7.51582 16.6885C7.91099 16.6885 8.24477 16.355 8.24477 15.9601C8.24477 15.8758 8.22558 15.7876 8.19873 15.7186L12.1657 12.9584C12.3614 13.1539 12.6338 13.2728 12.9215 13.2728C13.5315 13.2728 13.9996 12.7782 13.9996 12.1955C13.9996 11.6128 13.5277 11.0991 12.933 11.0991C12.6491 11.0991 12.3883 11.2179 12.1887 11.402L8.20256 8.48839C8.23709 8.40788 8.2486 8.32354 8.2486 8.23154C8.2486 7.8175 7.91482 7.50314 7.51966 7.50314C7.10531 7.50314 6.79071 7.83667 6.79071 8.23154ZM12.933 11.6856C13.2093 11.6856 13.428 11.9042 13.428 12.1802C13.428 12.4562 13.2093 12.6747 12.933 12.6747C12.6568 12.6747 12.4381 12.4562 12.4381 12.1802C12.4381 11.9042 12.6568 11.6856 12.933 11.6856ZM7.86111 8.24687C7.86111 8.42322 7.70381 8.5804 7.52733 8.5804C7.35085 8.5804 7.19355 8.42322 7.19355 8.24687C7.19355 8.07052 7.35085 7.91334 7.52733 7.91334C7.70381 7.91334 7.86111 8.07052 7.86111 8.24687Z\" fill=\"#101921\"/>\n\t\t\t\t<path d=\"M4.4811 14.9481C4.58916 14.9481 4.67677 14.8605 4.67677 14.7526C4.67677 14.6446 4.58916 14.557 4.4811 14.557C4.37304 14.557 4.28544 14.6446 4.28544 14.7526C4.28544 14.8605 4.37304 14.9481 4.4811 14.9481Z\" fill=\"#101921\"/>\n\t\t\t\t<path d=\"M3.59102 13.499C3.40686 13.499 3.25724 13.6485 3.25724 13.8325C3.25724 14.0165 3.40686 14.166 3.59102 14.166C3.77517 14.166 3.9248 14.0165 3.9248 13.8325C3.9248 13.6485 3.77517 13.499 3.59102 13.499Z\" fill=\"#101921\"/>\n\t\t\t\t<path d=\"M3.8097 12.0843C3.8097 11.7278 3.53347 11.4518 3.17667 11.4518C2.81987 11.4518 2.54364 11.7278 2.54364 12.0843C2.54364 12.4409 2.81987 12.7169 3.17667 12.7169C3.53347 12.7169 3.8097 12.4409 3.8097 12.0843Z\" fill=\"#101921\"/>\n\t\t\t\t<path d=\"M24.3315 5.37931H7.6923C3.44139 5.37931 0 8.34271 0 12C0 15.6573 3.46058 18.6207 7.6923 18.6207H24.3123C28.2486 18.6207 31.4521 15.6343 31.4521 11.9885C31.4521 8.34271 28.2639 5.37931 24.3315 5.37931ZM15.5419 17.5434H7.71148C4.07443 17.5434 1.10493 15.0631 1.10493 12C1.10493 8.93692 4.05141 6.45656 7.71148 6.45656H15.5419V17.5434ZM29.8753 10.6122C29.8561 10.6122 29.8177 10.6237 29.7755 10.6237C29.6566 10.6161 29.5645 10.5509 29.5108 10.4282C28.9852 9.00976 27.7076 7.83284 26.0694 7.29996C25.9198 7.24629 25.8277 7.08144 25.8776 6.93193C25.9313 6.78242 26.0963 6.69041 26.2459 6.74025C28.0337 7.34597 29.4571 8.64557 30.0364 10.225C30.0901 10.3899 30.0172 10.5471 29.8715 10.6122H29.8753Z\" fill=\"#101921\"/>\n\t\t\t</g>\n\t\t\t<defs>\n\t\t\t\t<clipPath id=\"clip0_0_28\">\n\t\t\t\t\t<rect width=\"31.4483\" height=\"24\" fill=\"white\"/>\n\t\t\t\t</clipPath>\n\t\t\t</defs>\n\t\t</svg>\n\t</span>\n";
|
package/dist/lib/js/index.d.ts
CHANGED
|
@@ -96,11 +96,9 @@ export { default as DsDrawerDivider } from './components/Drawer/DrawerDivider/Dr
|
|
|
96
96
|
export { default as DrawerHeader } from './components/Drawer/DrawerHeader/DrawerHeader.vue';
|
|
97
97
|
export { default as DsDrawerHeader } from './components/Drawer/DrawerHeader/DrawerHeader.vue';
|
|
98
98
|
export * from './components/Drawer/DrawerHeader/DrawerHeader.consts';
|
|
99
|
-
export { default as
|
|
100
|
-
export { default as
|
|
101
|
-
export
|
|
102
|
-
export { default as DsDrawerListItemGroup } from './components/Drawer/DrawerListItemGroup/DrawerListItemGroup.vue';
|
|
103
|
-
export * from './components/Drawer/DrawerListItem/DrawerListItem.consts';
|
|
99
|
+
export { default as DsLabelValueItem } from './components/LabelValue/LabelValueItem/LabelValueItem.vue';
|
|
100
|
+
export { default as DsLabelValueItemGroup } from './components/LabelValue/LabelValueItemGroup/LabelValueItemGroup.vue';
|
|
101
|
+
export * from './components/LabelValue/LabelValueItem/LabelValueItem.consts';
|
|
104
102
|
export { default as DrawerTile } from './components/Drawer/DrawerTile/DrawerTile.vue';
|
|
105
103
|
export { default as DsDrawerTile } from './components/Drawer/DrawerTile/DrawerTile.vue';
|
|
106
104
|
export { default as DrawerSection } from './components/Drawer/DrawerSection/DrawerSection.vue';
|
|
@@ -188,6 +186,9 @@ export { default as DsSkeleton } from './components/Skeleton/Skeleton.vue';
|
|
|
188
186
|
export { default as DsStatsLayout } from './components/StatsLayout/StatsLayout.vue';
|
|
189
187
|
export { default as DsStatsResetBanner } from './components/StatsLayout/StatsResetBanner/StatsResetBanner.vue';
|
|
190
188
|
export { default as DsStatsSectionHeader } from './components/StatsLayout/StatsSectionHeader/StatsSectionHeader.vue';
|
|
189
|
+
export { default as DsStepper } from './components/Stepper';
|
|
190
|
+
export { default as DsTopNav } from './components/TopNav/TopNav/TopNav.vue';
|
|
191
|
+
export { default as DsTopNavBranding } from './components/TopNav/TopNavBranding/TopNavBranding.vue';
|
|
191
192
|
export { default as DsFlag } from './components/Flag';
|
|
192
193
|
export * from './components/Flag/Flag.consts';
|
|
193
194
|
export * from './components/Flag/flags';
|
|
@@ -55,6 +55,56 @@ describe('Card', () => {
|
|
|
55
55
|
expect(component.text()).toContain(footer);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
+
it('should render experimentalContent slot', () => {
|
|
59
|
+
const experimentalContent = 'Wpłynąlem na suchego przestwór oceanu';
|
|
60
|
+
const component = createComponent({
|
|
61
|
+
slots: {
|
|
62
|
+
experimentalContent: () => [h('span', experimentalContent)],
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
expect(component.find('.ds-card__experimentalContent').exists()).toBe(true);
|
|
67
|
+
expect(component.find('.ds-card__experimentalContent').text()).toContain(
|
|
68
|
+
experimentalContent,
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should skip standard slots when experimentalContent is used', () => {
|
|
73
|
+
const component = createComponent({
|
|
74
|
+
slots: {
|
|
75
|
+
header: () => [h('span', 'header')],
|
|
76
|
+
content: () => [h('span', 'content')],
|
|
77
|
+
footer: () => [h('span', 'footer')],
|
|
78
|
+
experimentalContent: () => [h('span', 'experimental')],
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
expect(component.find('.ds-card__header').exists()).toBe(false);
|
|
83
|
+
expect(component.find('.ds-card__content').exists()).toBe(false);
|
|
84
|
+
expect(component.find('.ds-card__footer').exists()).toBe(false);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should not render the slotsWrapper when experimentalContent is used', () => {
|
|
88
|
+
const component = createComponent({
|
|
89
|
+
slots: {
|
|
90
|
+
experimentalContent: () => [h('span', 'experimental')],
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
expect(component.find('.ds-card__slotsWrapper').exists()).toBe(false);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should still render the ribbon when experimentalContent is used', () => {
|
|
98
|
+
const component = createComponent({
|
|
99
|
+
props: { hasRibbon: true },
|
|
100
|
+
slots: {
|
|
101
|
+
experimentalContent: () => [h('span', 'experimental')],
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
expect(component.find('.ds-card__ribbon').exists()).toBe(true);
|
|
106
|
+
});
|
|
107
|
+
|
|
58
108
|
it('should render content slot with padding by default', () => {
|
|
59
109
|
const content = 'Wpłynąlem na suchego przestwór oceanu';
|
|
60
110
|
const component = createComponent({
|
|
@@ -31,6 +31,9 @@ const StoryTemplate: StoryFn<typeof Card> = (args) => ({
|
|
|
31
31
|
<template v-if="args.footer" #footer>
|
|
32
32
|
<div v-html="args.footer" />
|
|
33
33
|
</template>
|
|
34
|
+
<template v-if="args.experimentalContent" #experimentalContent>
|
|
35
|
+
<div v-html="args.experimentalContent" />
|
|
36
|
+
</template>
|
|
34
37
|
</card>`,
|
|
35
38
|
});
|
|
36
39
|
|
|
@@ -40,6 +43,7 @@ const args = {
|
|
|
40
43
|
header: 'header slot',
|
|
41
44
|
content: 'content slot that supports <b>HTML markup</b>',
|
|
42
45
|
footer: 'footer slot',
|
|
46
|
+
experimentalContent: '',
|
|
43
47
|
contentHasPadding: true,
|
|
44
48
|
headerHasPadding: false,
|
|
45
49
|
footerHasPadding: false,
|
|
@@ -65,6 +69,7 @@ const argTypes = {
|
|
|
65
69
|
control: 'text',
|
|
66
70
|
},
|
|
67
71
|
footer: { control: 'text' },
|
|
72
|
+
experimentalContent: { control: 'text' },
|
|
68
73
|
backgroundColor: {
|
|
69
74
|
control: 'select',
|
|
70
75
|
options: Object.values(CARD_BACKGROUND_COLORS),
|
|
@@ -28,7 +28,12 @@
|
|
|
28
28
|
/>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
|
+
<div v-if="$slots.experimentalContent" class="ds-card__experimentalContent">
|
|
32
|
+
<slot name="experimentalContent" />
|
|
33
|
+
</div>
|
|
34
|
+
|
|
31
35
|
<div
|
|
36
|
+
v-else
|
|
32
37
|
class="ds-card__slotsWrapper"
|
|
33
38
|
:class="{ '-ds-containerIsScrollable': isContentScrollable }"
|
|
34
39
|
>
|
|
@@ -110,6 +115,14 @@
|
|
|
110
115
|
}
|
|
111
116
|
}
|
|
112
117
|
|
|
118
|
+
&__experimentalContent {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex: 1;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
// prevents excessive width due to child elements
|
|
123
|
+
min-width: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
113
126
|
&__header {
|
|
114
127
|
&.-ds-withPadding {
|
|
115
128
|
padding: $space-8;
|
|
@@ -192,7 +205,6 @@
|
|
|
192
205
|
<script lang="ts" setup>
|
|
193
206
|
import { computed } from 'vue';
|
|
194
207
|
|
|
195
|
-
import { RemovedProp } from '../../../utils/type.utils';
|
|
196
208
|
import DsDivider from '../../Divider/Divider.vue';
|
|
197
209
|
import DsLoadingBar, { LOADING_BAR_COLORS, LoadingBarColors } from '../../LoadingBar';
|
|
198
210
|
import DsContainerRibbon from '../../ContainerRibbon/ContainerRibbon.vue';
|
|
@@ -247,22 +259,13 @@ const {
|
|
|
247
259
|
loadingBarTime?: string;
|
|
248
260
|
isFlat?: boolean;
|
|
249
261
|
isContentScrollable?: boolean;
|
|
250
|
-
|
|
251
|
-
// Renamed props kept as removal markers so existing usages fail type-checking.
|
|
252
|
-
/** @deprecated renamed to `hasRibbon` */
|
|
253
|
-
hasBorder?: RemovedProp<'renamed to hasRibbon'>;
|
|
254
|
-
/** @deprecated renamed to `ribbonPosition` */
|
|
255
|
-
borderPosition?: RemovedProp<'renamed to ribbonPosition'>;
|
|
256
|
-
/** @deprecated renamed to `ribbonSize` */
|
|
257
|
-
borderSize?: RemovedProp<'renamed to ribbonSize'>;
|
|
258
|
-
/** @deprecated renamed to `ribbonColor` */
|
|
259
|
-
borderColor?: RemovedProp<'renamed to ribbonColor'>;
|
|
260
262
|
}>();
|
|
261
263
|
|
|
262
264
|
defineSlots<{
|
|
263
265
|
header?: () => any;
|
|
264
266
|
content?: () => any;
|
|
265
267
|
footer?: () => any;
|
|
268
|
+
experimentalContent?: () => any;
|
|
266
269
|
}>();
|
|
267
270
|
|
|
268
271
|
const ribbonLayout = computed(() => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Value } from '../../../utils/type.utils';
|
|
2
|
+
|
|
3
|
+
export const LABEL_VALUE_ITEM_STATES = {
|
|
4
|
+
DEFAULT: 'default',
|
|
5
|
+
LOADING: 'loading',
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export const LABEL_VALUE_ITEM_SIZES = {
|
|
9
|
+
MEDIUM: 'medium',
|
|
10
|
+
LARGE: 'large',
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
export const LABEL_VALUE_ITEM_VALUE_COLORS = {
|
|
14
|
+
NEUTRAL: 'neutral',
|
|
15
|
+
PRIMARY: 'primary',
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
export type LabelValueItemState = Value<typeof LABEL_VALUE_ITEM_STATES>;
|
|
19
|
+
export type LabelValueItemSize = Value<typeof LABEL_VALUE_ITEM_SIZES>;
|
|
20
|
+
export type LabelValueItemValueColor = Value<typeof LABEL_VALUE_ITEM_VALUE_COLORS>;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
|
|
4
|
+
import LabelValueItem from './LabelValueItem.vue';
|
|
5
|
+
import Icon, { ICON_SIZES, ICONS } from '../../Icons/Icon';
|
|
6
|
+
import {
|
|
7
|
+
LABEL_VALUE_ITEM_SIZES,
|
|
8
|
+
LABEL_VALUE_ITEM_STATES,
|
|
9
|
+
LABEL_VALUE_ITEM_VALUE_COLORS,
|
|
10
|
+
LabelValueItemSize,
|
|
11
|
+
LabelValueItemState,
|
|
12
|
+
LabelValueItemValueColor,
|
|
13
|
+
} from './LabelValueItem.consts';
|
|
14
|
+
|
|
15
|
+
interface createComponentOptions {
|
|
16
|
+
label?: string;
|
|
17
|
+
valueText?: string;
|
|
18
|
+
state?: LabelValueItemState;
|
|
19
|
+
size?: LabelValueItemSize;
|
|
20
|
+
isLabelStrong?: boolean;
|
|
21
|
+
valueColor?: LabelValueItemValueColor;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
describe('LabelValueItem', () => {
|
|
25
|
+
const createComponent = ({
|
|
26
|
+
label = 'random label',
|
|
27
|
+
valueText = 'random value',
|
|
28
|
+
state = LABEL_VALUE_ITEM_STATES.DEFAULT,
|
|
29
|
+
size = LABEL_VALUE_ITEM_SIZES.MEDIUM,
|
|
30
|
+
isLabelStrong = false,
|
|
31
|
+
valueColor = LABEL_VALUE_ITEM_VALUE_COLORS.NEUTRAL,
|
|
32
|
+
}: createComponentOptions = {}) => {
|
|
33
|
+
return mount(LabelValueItem, {
|
|
34
|
+
props: {
|
|
35
|
+
label,
|
|
36
|
+
valueText,
|
|
37
|
+
state,
|
|
38
|
+
size,
|
|
39
|
+
isLabelStrong,
|
|
40
|
+
valueColor,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
it('should create', () => {
|
|
46
|
+
const component = createComponent();
|
|
47
|
+
|
|
48
|
+
expect(component.exists()).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('renders label', () => {
|
|
52
|
+
const label = 'Mam labela';
|
|
53
|
+
const component = createComponent({ label });
|
|
54
|
+
|
|
55
|
+
expect(component.find('.ds-labelValueItem__label').text()).toBe(label);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('renders valueText by default', () => {
|
|
59
|
+
const valueText = 'Mam wartość';
|
|
60
|
+
const component = createComponent({ valueText });
|
|
61
|
+
|
|
62
|
+
expect(component.find('.ds-labelValueItem__value').text()).toBe(valueText);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('does not render the spinner in the default state', () => {
|
|
66
|
+
const component = createComponent({ state: LABEL_VALUE_ITEM_STATES.DEFAULT });
|
|
67
|
+
|
|
68
|
+
expect(component.findComponent(Icon).exists()).toBe(false);
|
|
69
|
+
expect(component.find('.ds-labelValueItem__value').exists()).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('renders the spinner instead of the value in the loading state', () => {
|
|
73
|
+
const component = createComponent({ state: LABEL_VALUE_ITEM_STATES.LOADING });
|
|
74
|
+
|
|
75
|
+
expect(component.find('.ds-labelValueItem__value').exists()).toBe(false);
|
|
76
|
+
|
|
77
|
+
const icon = component.findComponent(Icon);
|
|
78
|
+
expect(icon.exists()).toBe(true);
|
|
79
|
+
expect(icon.props().icon).toEqual(ICONS.FAD_SPINNER_THIRD);
|
|
80
|
+
expect(icon.props().size).toBe(ICON_SIZES.XX_SMALL);
|
|
81
|
+
expect(icon.props().spinning).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('applies the medium size by default', () => {
|
|
85
|
+
const component = createComponent();
|
|
86
|
+
|
|
87
|
+
expect(component.find('.ds-labelValueItem').classes()).not.toContain('-ds-large');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('applies the large size modifier when size is large', () => {
|
|
91
|
+
const component = createComponent({ size: LABEL_VALUE_ITEM_SIZES.LARGE });
|
|
92
|
+
|
|
93
|
+
expect(component.find('.ds-labelValueItem').classes()).toContain('-ds-large');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('does not make the label strong by default', () => {
|
|
97
|
+
const component = createComponent();
|
|
98
|
+
|
|
99
|
+
expect(component.find('.ds-labelValueItem__label').classes()).not.toContain('-ds-strong');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('makes the label strong when isLabelStrong is true', () => {
|
|
103
|
+
const component = createComponent({ isLabelStrong: true });
|
|
104
|
+
|
|
105
|
+
expect(component.find('.ds-labelValueItem__label').classes()).toContain('-ds-strong');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('uses the neutral value color by default', () => {
|
|
109
|
+
const component = createComponent();
|
|
110
|
+
|
|
111
|
+
expect(component.find('.ds-labelValueItem__value').classes()).not.toContain(
|
|
112
|
+
'-ds-color-primary',
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('applies the primary value color modifier when valueColor is primary', () => {
|
|
117
|
+
const component = createComponent({
|
|
118
|
+
valueColor: LABEL_VALUE_ITEM_VALUE_COLORS.PRIMARY,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
expect(component.find('.ds-labelValueItem__value').classes()).toContain(
|
|
122
|
+
'-ds-color-primary',
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import LabelValueItem from './LabelValueItem.vue';
|
|
2
|
+
|
|
3
|
+
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
4
|
+
import {
|
|
5
|
+
LABEL_VALUE_ITEM_SIZES,
|
|
6
|
+
LABEL_VALUE_ITEM_STATES,
|
|
7
|
+
LABEL_VALUE_ITEM_VALUE_COLORS,
|
|
8
|
+
} from './LabelValueItem.consts';
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: 'Components/LabelValue/LabelValueItem',
|
|
12
|
+
component: LabelValueItem,
|
|
13
|
+
} as Meta<typeof LabelValueItem>;
|
|
14
|
+
|
|
15
|
+
const StoryTemplate: StoryFn<typeof LabelValueItem> = (args) => ({
|
|
16
|
+
components: { LabelValueItem },
|
|
17
|
+
setup() {
|
|
18
|
+
return args;
|
|
19
|
+
},
|
|
20
|
+
template: `<div style="height: 300px; width: 200px;">
|
|
21
|
+
<label-value-item
|
|
22
|
+
:label="label"
|
|
23
|
+
:value-text="valueText"
|
|
24
|
+
:state="state"
|
|
25
|
+
:size="size"
|
|
26
|
+
:is-label-strong="isLabelStrong"
|
|
27
|
+
:value-color="valueColor"
|
|
28
|
+
/>
|
|
29
|
+
</div>`,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const Interactive = StoryTemplate.bind({});
|
|
33
|
+
|
|
34
|
+
const args = {
|
|
35
|
+
label: 'Label',
|
|
36
|
+
valueText: 'value',
|
|
37
|
+
state: LABEL_VALUE_ITEM_STATES.DEFAULT,
|
|
38
|
+
size: LABEL_VALUE_ITEM_SIZES.MEDIUM,
|
|
39
|
+
isLabelStrong: false,
|
|
40
|
+
valueColor: LABEL_VALUE_ITEM_VALUE_COLORS.NEUTRAL,
|
|
41
|
+
} as Args;
|
|
42
|
+
|
|
43
|
+
const argTypes = {
|
|
44
|
+
state: {
|
|
45
|
+
control: 'select',
|
|
46
|
+
options: Object.values(LABEL_VALUE_ITEM_STATES),
|
|
47
|
+
},
|
|
48
|
+
size: {
|
|
49
|
+
control: 'select',
|
|
50
|
+
options: Object.values(LABEL_VALUE_ITEM_SIZES),
|
|
51
|
+
},
|
|
52
|
+
valueColor: {
|
|
53
|
+
control: 'select',
|
|
54
|
+
options: Object.values(LABEL_VALUE_ITEM_VALUE_COLORS),
|
|
55
|
+
},
|
|
56
|
+
isLabelStrong: {
|
|
57
|
+
control: 'boolean',
|
|
58
|
+
},
|
|
59
|
+
} as ArgTypes;
|
|
60
|
+
|
|
61
|
+
Interactive.argTypes = argTypes;
|
|
62
|
+
Interactive.args = args;
|
|
63
|
+
|
|
64
|
+
Interactive.parameters = {
|
|
65
|
+
design: {
|
|
66
|
+
type: 'figma',
|
|
67
|
+
url: 'https://www.figma.com/file/izQdYyiBR1GQgFkaOIfIJI/LMS---DS-Components?node-id=6785-111025&t=pzyp7YuJcnGNBfS5-4',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ds-labelValueItem" :class="{ '-ds-large': size === LABEL_VALUE_ITEM_SIZES.LARGE }">
|
|
3
|
+
<div class="ds-labelValueItem__label" :class="{ '-ds-strong': isLabelStrong }">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</div>
|
|
6
|
+
<ds-icon
|
|
7
|
+
v-if="state === LABEL_VALUE_ITEM_STATES.LOADING"
|
|
8
|
+
:icon="ICONS.FAD_SPINNER_THIRD"
|
|
9
|
+
:size="ICON_SIZES.XX_SMALL"
|
|
10
|
+
spinning
|
|
11
|
+
/>
|
|
12
|
+
<div
|
|
13
|
+
v-else
|
|
14
|
+
class="ds-labelValueItem__value"
|
|
15
|
+
:class="{
|
|
16
|
+
'-ds-color-primary': valueColor === LABEL_VALUE_ITEM_VALUE_COLORS.PRIMARY,
|
|
17
|
+
}"
|
|
18
|
+
>
|
|
19
|
+
{{ valueText }}
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<style lang="scss" scoped>
|
|
25
|
+
@import '../../../../styles/settings/colors/tokens';
|
|
26
|
+
@import '../../../../styles/settings/spacings';
|
|
27
|
+
@import '../../../../styles/settings/typography/tokens';
|
|
28
|
+
|
|
29
|
+
.ds-labelValueItem {
|
|
30
|
+
align-items: center;
|
|
31
|
+
color: $color-neutral-text-strong;
|
|
32
|
+
display: flex;
|
|
33
|
+
gap: $space-4;
|
|
34
|
+
padding: $space-4 0;
|
|
35
|
+
width: 100%;
|
|
36
|
+
|
|
37
|
+
&__label {
|
|
38
|
+
@include label-m-default-regular;
|
|
39
|
+
|
|
40
|
+
flex-shrink: 1;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
overflow-wrap: break-word;
|
|
43
|
+
width: 100%;
|
|
44
|
+
|
|
45
|
+
&.-ds-strong {
|
|
46
|
+
@include label-m-default-bold;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&__value {
|
|
51
|
+
@include info-m-default-bold;
|
|
52
|
+
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
max-width: 50%;
|
|
55
|
+
|
|
56
|
+
&.-ds-color-primary {
|
|
57
|
+
color: $color-primary-text-strong;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.-ds-large {
|
|
62
|
+
.ds-labelValueItem__label {
|
|
63
|
+
@include label-l-default-regular;
|
|
64
|
+
|
|
65
|
+
&.-ds-strong {
|
|
66
|
+
@include label-l-default-bold;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ds-labelValueItem__value {
|
|
71
|
+
@include info-l-default-bold;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
76
|
+
|
|
77
|
+
<script setup lang="ts">
|
|
78
|
+
import {
|
|
79
|
+
LABEL_VALUE_ITEM_SIZES,
|
|
80
|
+
LABEL_VALUE_ITEM_STATES,
|
|
81
|
+
LABEL_VALUE_ITEM_VALUE_COLORS,
|
|
82
|
+
LabelValueItemSize,
|
|
83
|
+
LabelValueItemState,
|
|
84
|
+
LabelValueItemValueColor,
|
|
85
|
+
} from './LabelValueItem.consts';
|
|
86
|
+
import DsIcon, { ICON_SIZES, ICONS } from '../../Icons/Icon';
|
|
87
|
+
|
|
88
|
+
const {
|
|
89
|
+
state = LABEL_VALUE_ITEM_STATES.DEFAULT,
|
|
90
|
+
size = LABEL_VALUE_ITEM_SIZES.MEDIUM,
|
|
91
|
+
isLabelStrong = false,
|
|
92
|
+
valueColor = LABEL_VALUE_ITEM_VALUE_COLORS.NEUTRAL,
|
|
93
|
+
} = defineProps<{
|
|
94
|
+
state?: LabelValueItemState;
|
|
95
|
+
label: string;
|
|
96
|
+
valueText: string;
|
|
97
|
+
size?: LabelValueItemSize;
|
|
98
|
+
isLabelStrong?: boolean;
|
|
99
|
+
valueColor?: LabelValueItemValueColor;
|
|
100
|
+
}>();
|
|
101
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import { h } from 'vue';
|
|
4
|
+
|
|
5
|
+
import LabelValueItemGroup from './LabelValueItemGroup.vue';
|
|
6
|
+
|
|
7
|
+
describe('LabelValueItemGroup', () => {
|
|
8
|
+
it('should create', () => {
|
|
9
|
+
const component = mount(LabelValueItemGroup);
|
|
10
|
+
|
|
11
|
+
expect(component.exists()).toBe(true);
|
|
12
|
+
expect(component.find('.ds-labelValueItemGroup').exists()).toBe(true);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('renders default slot content', () => {
|
|
16
|
+
const component = mount(LabelValueItemGroup, {
|
|
17
|
+
slots: {
|
|
18
|
+
default: () => h('span', { class: 'child' }, 'Slotted content'),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
expect(component.find('.ds-labelValueItemGroup .child').text()).toBe('Slotted content');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import LabelValueItemGroup from './LabelValueItemGroup.vue';
|
|
2
|
+
|
|
3
|
+
import { Meta, StoryFn } from '@storybook/vue3';
|
|
4
|
+
import LabelValueItem from '../LabelValueItem/LabelValueItem.vue';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/LabelValue/LabelValueItemGroup',
|
|
8
|
+
component: LabelValueItemGroup,
|
|
9
|
+
} as Meta<typeof LabelValueItemGroup>;
|
|
10
|
+
|
|
11
|
+
const StoryTemplate: StoryFn<typeof LabelValueItemGroup> = (args) => ({
|
|
12
|
+
components: { LabelValueItemGroup, LabelValueItem },
|
|
13
|
+
setup() {
|
|
14
|
+
return args;
|
|
15
|
+
},
|
|
16
|
+
template: `
|
|
17
|
+
<label-value-item-group>
|
|
18
|
+
<label-value-item value-text="1" label="Item" />
|
|
19
|
+
<label-value-item value-text="2" label="Item" />
|
|
20
|
+
</label-value-item-group>
|
|
21
|
+
`,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const Static = StoryTemplate.bind({});
|
|
25
|
+
|
|
26
|
+
Static.parameters = {
|
|
27
|
+
design: {
|
|
28
|
+
type: 'figma',
|
|
29
|
+
url: 'https://www.figma.com/file/izQdYyiBR1GQgFkaOIfIJI/LMS---DS-Components?node-id=6785-111079&t=PEjZUz7dUozNqntp-4',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ds-labelValueItemGroup">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style lang="scss" scoped>
|
|
8
|
+
@import '../../../../styles/settings/spacings';
|
|
9
|
+
|
|
10
|
+
.ds-labelValueItemGroup {
|
|
11
|
+
padding: 0 0 $space-3;
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
defineSlots<{
|
|
17
|
+
default?: () => any;
|
|
18
|
+
}>();
|
|
19
|
+
</script>
|