@bethinkpl/design-system 40.1.0 → 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 +7437 -7344
- package/dist/design-system.js.map +1 -1
- 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/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/index.d.ts +6 -5
- package/lib/js/components/Cards/Card/Card.vue +0 -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
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<{
|
|
@@ -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;
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
<template v-if="$slots.media" #media>
|
|
31
31
|
<slot name="media" />
|
|
32
32
|
</template>
|
|
33
|
+
<template v-if="$slots.leadingAccessory" #leadingAccessory>
|
|
34
|
+
<slot name="leadingAccessory" />
|
|
35
|
+
</template>
|
|
33
36
|
<template #content>
|
|
34
37
|
<div class="ds-basicRichListItem__content">
|
|
35
38
|
<ds-text-group
|