@bethinkpl/design-system 16.0.1 → 16.2.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/docs/950.87e3826d.iframe.bundle.js +2 -0
- package/docs/iframe.html +1 -1
- package/docs/main.4eb98b0f.iframe.bundle.js +1 -0
- package/docs/project.json +1 -1
- package/lib/js/components/TabItem/TabItem.consts.ts +4 -0
- package/lib/js/components/TabItem/TabItem.spec.ts +14 -10
- package/lib/js/components/TabItem/TabItem.stories.ts +23 -5
- package/lib/js/components/TabItem/TabItem.vue +94 -23
- package/lib/js/components/TabItem/index.ts +1 -1
- package/lib/js/icons/fontawesome.ts +2 -0
- package/lib/js/index.ts +1 -0
- package/lib/styles/design-system.scss +3 -1
- package/package.json +1 -1
- package/docs/765.a2b66c95.iframe.bundle.js +0 -2
- package/docs/main.e3406522.iframe.bundle.js +0 -1
- /package/docs/{765.a2b66c95.iframe.bundle.js.LICENSE.txt → 950.87e3826d.iframe.bundle.js.LICENSE.txt} +0 -0
package/docs/project.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"generatedAt":
|
|
1
|
+
{"generatedAt":1682602775449,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"metaFramework":{"name":"vue-cli","packageName":"@vue/cli-service","version":"5.0.4"},"packageManager":{"type":"yarn","version":"1.22.19"},"storybookVersion":"6.5.13","language":"typescript","storybookPackages":{"@storybook/builder-webpack5":{"version":"6.5.13"},"@storybook/manager-webpack5":{"version":"6.5.13"},"@storybook/vue3":{"version":"6.5.13"},"eslint-plugin-storybook":{"version":"0.6.6"}},"framework":{"name":"vue3"},"addons":{"@storybook/addon-actions":{"version":"6.5.16"},"@storybook/addon-docs":{"version":"6.5.15"},"@storybook/addon-controls":{"version":"6.5.15"},"@storybook/addon-storysource":{"version":"6.5.15"},"@storybook/addon-viewport":{"version":"6.5.15"},"storybook-addon-designs":{"version":"6.3.1"}}}
|
|
@@ -2,14 +2,18 @@ import { shallowMount } from '@vue/test-utils';
|
|
|
2
2
|
|
|
3
3
|
import TabItem from './TabItem.vue';
|
|
4
4
|
import { ICONS } from '../Icons/Icon';
|
|
5
|
+
import { TAB_ITEM_SIZES } from './TabItem.consts';
|
|
5
6
|
|
|
6
7
|
describe('TabItem', () => {
|
|
7
|
-
const createComponent = ({
|
|
8
|
+
const createComponent = ({ isSelected = false } = {}) => {
|
|
9
|
+
//@ts-ignore
|
|
8
10
|
return shallowMount(TabItem, {
|
|
9
11
|
props: {
|
|
10
|
-
icon:
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
icon: ICONS.FA_CALENDAR_DAYS,
|
|
13
|
+
isSelected,
|
|
14
|
+
label: 'Lorem ipsum dolor sit amet',
|
|
15
|
+
labelEllipsis: false,
|
|
16
|
+
size: TAB_ITEM_SIZES.MEDIUM,
|
|
13
17
|
},
|
|
14
18
|
});
|
|
15
19
|
};
|
|
@@ -20,15 +24,15 @@ describe('TabItem', () => {
|
|
|
20
24
|
expect(component.exists()).toBe(true);
|
|
21
25
|
});
|
|
22
26
|
|
|
23
|
-
it('when prop
|
|
24
|
-
const component = createComponent({
|
|
27
|
+
it('when prop isSelected is set to false component should not render "isSelected" class', () => {
|
|
28
|
+
const component = createComponent({ isSelected: false });
|
|
25
29
|
|
|
26
|
-
expect(component.find('.-
|
|
30
|
+
expect(component.find('.-isSelected').exists()).toBe(false);
|
|
27
31
|
});
|
|
28
32
|
|
|
29
|
-
it('when prop
|
|
30
|
-
const component = createComponent({
|
|
33
|
+
it('when prop isSelected is set to true component should render "isSelected" class', () => {
|
|
34
|
+
const component = createComponent({ isSelected: true });
|
|
31
35
|
|
|
32
|
-
expect(component.find('.-
|
|
36
|
+
expect(component.find('.-isSelected').exists()).toBe(true);
|
|
33
37
|
});
|
|
34
38
|
});
|
|
@@ -2,6 +2,7 @@ import TabItem from './TabItem.vue';
|
|
|
2
2
|
import { ICONS } from '../Icons/Icon';
|
|
3
3
|
|
|
4
4
|
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
5
|
+
import { TAB_ITEM_SIZES } from './TabItem.consts';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: 'Components/TabItem',
|
|
@@ -13,10 +14,12 @@ const StoryTemplate: StoryFn<typeof TabItem> = (args) => ({
|
|
|
13
14
|
setup() {
|
|
14
15
|
return { ...args };
|
|
15
16
|
},
|
|
16
|
-
template:
|
|
17
|
+
template:
|
|
18
|
+
'<tab-item style="max-width: 150px" :icon="ICONS[icon]" :is-selected="isSelected" :label="label" :size="TAB_ITEM_SIZES[size]" :label-ellipsis="labelEllipsis" />',
|
|
17
19
|
data() {
|
|
18
20
|
return {
|
|
19
21
|
ICONS: Object.freeze(ICONS),
|
|
22
|
+
TAB_ITEM_SIZES: Object.freeze(TAB_ITEM_SIZES),
|
|
20
23
|
};
|
|
21
24
|
},
|
|
22
25
|
});
|
|
@@ -24,14 +27,29 @@ const StoryTemplate: StoryFn<typeof TabItem> = (args) => ({
|
|
|
24
27
|
export const Interactive = StoryTemplate.bind({});
|
|
25
28
|
|
|
26
29
|
const args = {
|
|
27
|
-
|
|
28
|
-
title: 'Lorem ipsum dolor sit amet',
|
|
30
|
+
isSelected: false,
|
|
29
31
|
} as Args;
|
|
30
32
|
|
|
31
33
|
const argTypes = {
|
|
32
34
|
icon: {
|
|
33
|
-
control: { type: 'select', options: Object.keys(ICONS) },
|
|
34
|
-
defaultValue:
|
|
35
|
+
control: { type: 'select', options: [...Object.keys(ICONS), null] },
|
|
36
|
+
defaultValue: null,
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
control: { type: 'select', options: Object.keys(TAB_ITEM_SIZES) },
|
|
40
|
+
defaultValue: 'MEDIUM',
|
|
41
|
+
},
|
|
42
|
+
label: {
|
|
43
|
+
control: { type: 'text' },
|
|
44
|
+
defaultValue: 'Tab item',
|
|
45
|
+
},
|
|
46
|
+
isSelected: {
|
|
47
|
+
control: { type: 'boolean' },
|
|
48
|
+
defaultValue: false,
|
|
49
|
+
},
|
|
50
|
+
labelEllipsis: {
|
|
51
|
+
control: { type: 'boolean' },
|
|
52
|
+
defaultValue: false,
|
|
35
53
|
},
|
|
36
54
|
} as ArgTypes;
|
|
37
55
|
|
|
@@ -1,65 +1,136 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="tabItem"
|
|
4
|
+
:title="label"
|
|
5
|
+
:class="{
|
|
6
|
+
'-sizeMedium': size === TAB_ITEM_SIZES.MEDIUM,
|
|
7
|
+
'-sizeSmall': size === TAB_ITEM_SIZES.SMALL,
|
|
8
|
+
'-isSelected': isSelected,
|
|
9
|
+
}"
|
|
10
|
+
@click="$emit('click')"
|
|
11
|
+
>
|
|
12
|
+
<ds-icon
|
|
13
|
+
v-if="icon !== null"
|
|
14
|
+
class="tabItem__icon"
|
|
15
|
+
:icon="icon"
|
|
16
|
+
:size="ICON_SIZES.X_SMALL"
|
|
17
|
+
/>
|
|
18
|
+
<span v-if="label" class="tabItem__label" :class="{ '-ellipsis': labelEllipsis }">{{
|
|
19
|
+
label
|
|
20
|
+
}}</span>
|
|
4
21
|
</div>
|
|
5
22
|
</template>
|
|
6
23
|
|
|
7
24
|
<style scoped lang="scss">
|
|
8
|
-
@import '../../../styles/settings/icons';
|
|
9
25
|
@import '../../../styles/settings/spacings';
|
|
10
26
|
@import '../../../styles/settings/colors/tokens';
|
|
27
|
+
@import '../../../styles/settings/typography/tokens';
|
|
28
|
+
@import '../../../styles/settings/animations';
|
|
11
29
|
|
|
12
|
-
|
|
30
|
+
.tabItem {
|
|
31
|
+
$self: &;
|
|
13
32
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
color: $color-neutral-icon;
|
|
33
|
+
align-items: center;
|
|
34
|
+
box-shadow: inset 0 -1px 0 $color-neutral-border;
|
|
17
35
|
cursor: pointer;
|
|
18
|
-
display: flex;
|
|
36
|
+
display: inline-flex;
|
|
19
37
|
justify-content: center;
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
min-height: 40px;
|
|
39
|
+
transition: box-shadow ease-in-out $default-transition-time;
|
|
40
|
+
|
|
41
|
+
&__icon {
|
|
42
|
+
color: $color-neutral-icon;
|
|
43
|
+
transition: color ease-in-out $default-transition-time;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__label {
|
|
47
|
+
color: $color-neutral-text;
|
|
48
|
+
transition: color ease-in-out $default-transition-time;
|
|
49
|
+
|
|
50
|
+
&.-ellipsis {
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
text-overflow: ellipsis;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
22
56
|
|
|
23
57
|
&:hover {
|
|
24
|
-
|
|
25
|
-
|
|
58
|
+
box-shadow: inset 0 -1px 0 $color-default-border;
|
|
59
|
+
#{$self}__icon {
|
|
60
|
+
color: $color-default-icon;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#{$self}__label {
|
|
64
|
+
color: $color-default-text;
|
|
65
|
+
}
|
|
26
66
|
}
|
|
27
67
|
|
|
28
|
-
&.-
|
|
29
|
-
|
|
30
|
-
|
|
68
|
+
&.-isSelected {
|
|
69
|
+
box-shadow: inset 0 -1px 0 $color-primary-border;
|
|
70
|
+
|
|
71
|
+
#{$self}__icon {
|
|
72
|
+
color: $color-primary-icon;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#{$self}__label {
|
|
76
|
+
color: $color-primary-text;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.-sizeSmall {
|
|
81
|
+
@include label-m-default-bold;
|
|
82
|
+
|
|
83
|
+
column-gap: $space-xxxxs;
|
|
84
|
+
padding: $space-xs;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.-sizeMedium {
|
|
88
|
+
@include label-l-default-bold;
|
|
89
|
+
|
|
90
|
+
column-gap: $space-xxs;
|
|
91
|
+
padding: $space-xs $space-s;
|
|
31
92
|
}
|
|
32
93
|
}
|
|
33
94
|
</style>
|
|
34
95
|
|
|
35
96
|
<script lang="ts">
|
|
36
|
-
import
|
|
97
|
+
import DsIcon, { ICON_SIZES, ICONS } from '../Icons/Icon';
|
|
37
98
|
import { toRaw } from 'vue';
|
|
99
|
+
import { TAB_ITEM_SIZES } from './TabItem.consts';
|
|
38
100
|
|
|
39
101
|
export default {
|
|
40
102
|
name: 'TabItem',
|
|
41
103
|
components: {
|
|
42
|
-
|
|
104
|
+
DsIcon,
|
|
43
105
|
},
|
|
44
106
|
props: {
|
|
45
107
|
icon: {
|
|
46
|
-
type: Object,
|
|
47
|
-
|
|
108
|
+
type: [Object, null],
|
|
109
|
+
default: null,
|
|
48
110
|
validator(icon) {
|
|
49
|
-
return Object.values(ICONS).includes(toRaw(icon));
|
|
111
|
+
return icon === null || Object.values(ICONS).includes(toRaw(icon));
|
|
50
112
|
},
|
|
51
113
|
},
|
|
52
|
-
|
|
114
|
+
isSelected: {
|
|
53
115
|
type: Boolean,
|
|
54
116
|
required: true,
|
|
55
117
|
},
|
|
56
|
-
|
|
118
|
+
label: {
|
|
119
|
+
type: [String, null],
|
|
120
|
+
default: null,
|
|
121
|
+
},
|
|
122
|
+
labelEllipsis: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: false,
|
|
125
|
+
},
|
|
126
|
+
size: {
|
|
57
127
|
type: String,
|
|
58
|
-
|
|
128
|
+
default: TAB_ITEM_SIZES.MEDIUM,
|
|
59
129
|
},
|
|
60
130
|
},
|
|
61
131
|
data() {
|
|
62
132
|
return {
|
|
133
|
+
TAB_ITEM_SIZES: Object.freeze(TAB_ITEM_SIZES),
|
|
63
134
|
ICON_SIZES: Object.freeze(ICON_SIZES),
|
|
64
135
|
};
|
|
65
136
|
},
|
|
@@ -45,6 +45,7 @@ import { faCircleNotch } from '@fortawesome/pro-regular-svg-icons/faCircleNotch'
|
|
|
45
45
|
import { faCircleQuestion } from '@fortawesome/pro-regular-svg-icons/faCircleQuestion';
|
|
46
46
|
import { faCircleXmark } from '@fortawesome/pro-regular-svg-icons/faCircleXmark';
|
|
47
47
|
import { faClipboardMedical } from '@fortawesome/pro-regular-svg-icons/faClipboardMedical';
|
|
48
|
+
import { faClipboardList } from '@fortawesome/pro-regular-svg-icons/faClipboardList';
|
|
48
49
|
import { faClock } from '@fortawesome/pro-regular-svg-icons/faClock';
|
|
49
50
|
import { faClockRotateLeft } from '@fortawesome/pro-regular-svg-icons/faClockRotateLeft';
|
|
50
51
|
import { faCode } from '@fortawesome/pro-regular-svg-icons/faCode';
|
|
@@ -236,6 +237,7 @@ export const FONTAWESOME_ICONS = {
|
|
|
236
237
|
FA_CIRCLE_QUESTION: faCircleQuestion,
|
|
237
238
|
FA_CIRCLE_XMARK: faCircleXmark,
|
|
238
239
|
FA_CLIPBOARD_MEDICAL: faClipboardMedical,
|
|
240
|
+
FA_CLIPBOARD_LIST: faClipboardList,
|
|
239
241
|
FA_CLOCK: faClock,
|
|
240
242
|
FA_CLOCK_ROTATE_LEFT: faClockRotateLeft,
|
|
241
243
|
FA_CODE: faCode,
|
package/lib/js/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ export { default as DsModalDialog } from './components/Modals/ModalDialog';
|
|
|
26
26
|
export { default as NumberInCircle } from './components/NumberInCircle';
|
|
27
27
|
export * from './components/NumberInCircle/NumberInCircle.consts';
|
|
28
28
|
export { default as TabItem } from './components/TabItem';
|
|
29
|
+
export * from './components/TabItem/TabItem.consts';
|
|
29
30
|
export { default as Tile } from './components/Tile';
|
|
30
31
|
export * from './components/Tile/Tile.consts';
|
|
31
32
|
export { default as AccessStatus } from './components/Statuses/AccessStatus/';
|