@bethinkpl/design-system 40.0.1 → 41.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 +7456 -7361
- package/dist/design-system.js.map +1 -1
- package/dist/lib/js/components/Cards/Card/Card.consts.d.ts +1 -0
- package/dist/lib/js/components/Cards/Card/Card.vue.d.ts +0 -9
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +0 -36
- package/dist/lib/js/components/ContainerRibbon/ContainerRibbon.consts.d.ts +1 -0
- 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 +0 -36
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +0 -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 +0 -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/components/Well/Well.consts.d.ts +1 -0
- package/dist/lib/js/index.d.ts +6 -5
- package/lib/js/components/Cards/Card/Card.vue +0 -11
- package/lib/js/components/ContainerRibbon/ContainerRibbon.consts.ts +1 -0
- package/lib/js/components/ContainerRibbon/ContainerRibbon.spec.ts +9 -6
- package/lib/js/components/ContainerRibbon/ContainerRibbon.vue +11 -0
- 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 @@
|
|
|
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";
|
|
@@ -31,6 +31,7 @@ export declare const WELL_RIBBON_COLORS: {
|
|
|
31
31
|
};
|
|
32
32
|
export type WellRibbonColor = Value<typeof WELL_RIBBON_COLORS>;
|
|
33
33
|
export declare const WELL_RIBBON_SIZES: {
|
|
34
|
+
readonly X_SMALL: "x-small";
|
|
34
35
|
readonly SMALL: "small";
|
|
35
36
|
readonly MEDIUM: "medium";
|
|
36
37
|
readonly LARGE: "large";
|
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';
|
|
@@ -192,7 +192,6 @@
|
|
|
192
192
|
<script lang="ts" setup>
|
|
193
193
|
import { computed } from 'vue';
|
|
194
194
|
|
|
195
|
-
import { RemovedProp } from '../../../utils/type.utils';
|
|
196
195
|
import DsDivider from '../../Divider/Divider.vue';
|
|
197
196
|
import DsLoadingBar, { LOADING_BAR_COLORS, LoadingBarColors } from '../../LoadingBar';
|
|
198
197
|
import DsContainerRibbon from '../../ContainerRibbon/ContainerRibbon.vue';
|
|
@@ -247,16 +246,6 @@ const {
|
|
|
247
246
|
loadingBarTime?: string;
|
|
248
247
|
isFlat?: boolean;
|
|
249
248
|
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
249
|
}>();
|
|
261
250
|
|
|
262
251
|
defineSlots<{
|
|
@@ -23,12 +23,15 @@ describe('ContainerRibbon', () => {
|
|
|
23
23
|
);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
it(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
it.each(Object.values(CONTAINER_RIBBON_SIZES))(
|
|
27
|
+
'applies size class correctly for size "%s"',
|
|
28
|
+
(size) => {
|
|
29
|
+
const wrapper = mount(ContainerRibbon, {
|
|
30
|
+
props: { size },
|
|
31
|
+
});
|
|
32
|
+
expect(wrapper.find('.ds-container-ribbon').classes()).toContain(`-ds-size-${size}`);
|
|
33
|
+
},
|
|
34
|
+
);
|
|
32
35
|
|
|
33
36
|
it('applies color classes correctly', () => {
|
|
34
37
|
const wrapper = mount(ContainerRibbon, {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<div
|
|
3
3
|
class="ds-container-ribbon"
|
|
4
4
|
:class="{
|
|
5
|
+
'-ds-size-x-small': size === CONTAINER_RIBBON_SIZES.X_SMALL,
|
|
5
6
|
'-ds-size-small': size === CONTAINER_RIBBON_SIZES.SMALL,
|
|
6
7
|
'-ds-size-medium': size === CONTAINER_RIBBON_SIZES.MEDIUM,
|
|
7
8
|
'-ds-size-large': size === CONTAINER_RIBBON_SIZES.LARGE,
|
|
@@ -38,6 +39,16 @@
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
// Size variants
|
|
42
|
+
&.-ds-size-x-small {
|
|
43
|
+
&.-ds-layout-vertical {
|
|
44
|
+
width: $border-xs;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.-ds-layout-horizontal {
|
|
48
|
+
height: $border-xs;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
&.-ds-size-small {
|
|
42
53
|
&.-ds-layout-vertical {
|
|
43
54
|
width: $border-s;
|
|
@@ -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>
|
|
@@ -4,6 +4,9 @@ import { withActions } from '@storybook/addon-actions/decorator';
|
|
|
4
4
|
import { useArgs } from '@storybook/preview-api';
|
|
5
5
|
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
6
6
|
import { DsImage } from '../../../index';
|
|
7
|
+
import SlotPlaceholder, {
|
|
8
|
+
SLOT_PLACEHOLDER_SIZES,
|
|
9
|
+
} from '../../../../../.storybook/SlotPlaceholder/SlotPlaceholder.vue';
|
|
7
10
|
import { ICON_COLORS, ICONS } from '../../Icons/Icon';
|
|
8
11
|
import {
|
|
9
12
|
RICH_LIST_ITEM_BACKGROUND_COLOR,
|
|
@@ -14,6 +17,7 @@ import {
|
|
|
14
17
|
RICH_LIST_ITEM_STATE,
|
|
15
18
|
RICH_LIST_ITEM_TYPE,
|
|
16
19
|
} from '../RichListItem';
|
|
20
|
+
import { toRefs } from 'vue';
|
|
17
21
|
|
|
18
22
|
export default {
|
|
19
23
|
title: 'Components/RichList/BasicRichListItem',
|
|
@@ -90,6 +94,9 @@ const expandStory = (story: StoryFn<typeof BasicRichListItem>, args = {}) => {
|
|
|
90
94
|
metadata: {
|
|
91
95
|
control: 'text',
|
|
92
96
|
},
|
|
97
|
+
leadingAccessory: {
|
|
98
|
+
control: 'text',
|
|
99
|
+
},
|
|
93
100
|
textSlot: {
|
|
94
101
|
control: 'text',
|
|
95
102
|
},
|
|
@@ -141,6 +148,7 @@ const expandStory = (story: StoryFn<typeof BasicRichListItem>, args = {}) => {
|
|
|
141
148
|
isSupportingTextTooltipEnabled: false,
|
|
142
149
|
|
|
143
150
|
metadata: 'Metadata Slot',
|
|
151
|
+
leadingAccessory: '',
|
|
144
152
|
textSlot: '',
|
|
145
153
|
actions: 'ACS',
|
|
146
154
|
|
|
@@ -167,11 +175,9 @@ const InteractiveStoryTemplate: StoryFn<typeof BasicRichListItem> = (args) => {
|
|
|
167
175
|
return {
|
|
168
176
|
components: { BasicRichListItem },
|
|
169
177
|
setup() {
|
|
170
|
-
return args;
|
|
171
|
-
},
|
|
172
|
-
data() {
|
|
173
178
|
return {
|
|
174
|
-
|
|
179
|
+
...toRefs(args),
|
|
180
|
+
ICONS,
|
|
175
181
|
};
|
|
176
182
|
},
|
|
177
183
|
methods: {
|
|
@@ -213,6 +219,9 @@ const InteractiveStoryTemplate: StoryFn<typeof BasicRichListItem> = (args) => {
|
|
|
213
219
|
<template v-if="metadata" #metadata>
|
|
214
220
|
<div v-html="metadata" />
|
|
215
221
|
</template>
|
|
222
|
+
<template v-if="leadingAccessory" #leadingAccessory>
|
|
223
|
+
<div v-html="leadingAccessory" />
|
|
224
|
+
</template>
|
|
216
225
|
<template v-if="textSlot" #text>
|
|
217
226
|
<div v-html="textSlot" />
|
|
218
227
|
</template>
|
|
@@ -226,17 +235,88 @@ const InteractiveStoryTemplate: StoryFn<typeof BasicRichListItem> = (args) => {
|
|
|
226
235
|
export const Interactive = InteractiveStoryTemplate.bind({});
|
|
227
236
|
expandStory(Interactive);
|
|
228
237
|
|
|
238
|
+
const PlaceholderSlotsStoryTemplate: StoryFn<typeof BasicRichListItem> = (args) => {
|
|
239
|
+
const [_, updateArgs] = useArgs();
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
components: { BasicRichListItem, SlotPlaceholder },
|
|
243
|
+
setup() {
|
|
244
|
+
return {
|
|
245
|
+
...toRefs(args),
|
|
246
|
+
SLOT_PLACEHOLDER_SIZES,
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
methods: {
|
|
250
|
+
updateIsSelected(isSelected) {
|
|
251
|
+
updateArgs({ isSelected });
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
template: `
|
|
255
|
+
<basic-rich-list-item
|
|
256
|
+
:size="size"
|
|
257
|
+
:type="type"
|
|
258
|
+
:layout="layout"
|
|
259
|
+
:is-interactive="isInteractive"
|
|
260
|
+
:is-draggable="isDraggable"
|
|
261
|
+
:is-dimmed="isDimmed"
|
|
262
|
+
:border-color="borderColor"
|
|
263
|
+
:border-color-hex="borderColorHex"
|
|
264
|
+
:eyebrow="eyebrow === 'null' ? null : eyebrow"
|
|
265
|
+
:eyebrow-ellipsis="eyebrowEllipsis"
|
|
266
|
+
:is-eyebrow-uppercase="isEyebrowUppercase"
|
|
267
|
+
:text="text"
|
|
268
|
+
:text-ellipsis="textEllipsis"
|
|
269
|
+
:supporting-text="supportingText === 'null' ? null : supportingText"
|
|
270
|
+
:supporting-text-ellipsis="supportingTextEllipsis"
|
|
271
|
+
:is-supporting-text-tooltip-enabled="isSupportingTextTooltipEnabled"
|
|
272
|
+
:state="state"
|
|
273
|
+
:background-color="backgroundColor"
|
|
274
|
+
:elevation="elevation"
|
|
275
|
+
:has-draggable-handler="hasDraggableHandler"
|
|
276
|
+
:has-actions-slot-divider="hasActionsSlotDivider"
|
|
277
|
+
:is-selectable="isSelectable"
|
|
278
|
+
:is-selected="isSelected"
|
|
279
|
+
@update:is-selected="updateIsSelected"
|
|
280
|
+
>
|
|
281
|
+
<template #media>
|
|
282
|
+
<slot-placeholder :size="SLOT_PLACEHOLDER_SIZES.SMALL" label="media" />
|
|
283
|
+
</template>
|
|
284
|
+
<template #leadingAccessory>
|
|
285
|
+
<slot-placeholder :size="SLOT_PLACEHOLDER_SIZES.SMALL" label="leadingAccessory" />
|
|
286
|
+
</template>
|
|
287
|
+
<template #text>
|
|
288
|
+
<slot-placeholder :size="SLOT_PLACEHOLDER_SIZES.SMALL" label="text" />
|
|
289
|
+
</template>
|
|
290
|
+
<template #metadata>
|
|
291
|
+
<slot-placeholder :size="SLOT_PLACEHOLDER_SIZES.SMALL" label="metadata" />
|
|
292
|
+
</template>
|
|
293
|
+
<template #actions>
|
|
294
|
+
<slot-placeholder :size="SLOT_PLACEHOLDER_SIZES.SMALL" label="actions" />
|
|
295
|
+
</template>
|
|
296
|
+
</basic-rich-list-item>`,
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
export const PlaceholderSlots = PlaceholderSlotsStoryTemplate.bind({});
|
|
301
|
+
expandStory(PlaceholderSlots);
|
|
302
|
+
// All slots are provided by the story template, so their controls are not editable.
|
|
303
|
+
PlaceholderSlots.argTypes = {
|
|
304
|
+
...PlaceholderSlots.argTypes,
|
|
305
|
+
leadingAccessory: { control: false },
|
|
306
|
+
metadata: { control: false },
|
|
307
|
+
textSlot: { control: false },
|
|
308
|
+
actions: { control: false },
|
|
309
|
+
} as ArgTypes;
|
|
310
|
+
|
|
229
311
|
const WithMediaStoryTemplate: StoryFn<typeof BasicRichListItem> = (args) => {
|
|
230
312
|
const [_, updateArgs] = useArgs();
|
|
231
313
|
|
|
232
314
|
return {
|
|
233
315
|
components: { BasicRichListItem, DsImage },
|
|
234
316
|
setup() {
|
|
235
|
-
return args;
|
|
236
|
-
},
|
|
237
|
-
data() {
|
|
238
317
|
return {
|
|
239
|
-
|
|
318
|
+
...toRefs(args),
|
|
319
|
+
ICONS,
|
|
240
320
|
};
|
|
241
321
|
},
|
|
242
322
|
methods: {
|
|
@@ -293,3 +373,8 @@ expandStory(WithMedia, {
|
|
|
293
373
|
imageSrcUsedInStoryBook:
|
|
294
374
|
'https://storage.googleapis.com/media-manager/lek/018f6291-3956-7342-8e6b-0ee901d48643/018f6291-3a56-7213-aef6-b5da7253839f.jpg',
|
|
295
375
|
});
|
|
376
|
+
// The media story does not use the leadingAccessory slot, so its control is not editable.
|
|
377
|
+
WithMedia.argTypes = {
|
|
378
|
+
...WithMedia.argTypes,
|
|
379
|
+
leadingAccessory: { control: false },
|
|
380
|
+
} as ArgTypes;
|