@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/project.json CHANGED
@@ -1 +1 @@
1
- {"generatedAt":1682327759759,"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"}}}
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"}}}
@@ -0,0 +1,4 @@
1
+ export const TAB_ITEM_SIZES = {
2
+ SMALL: 'S',
3
+ MEDIUM: 'M',
4
+ } as const;
@@ -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 = ({ isActive = false } = {}) => {
8
+ const createComponent = ({ isSelected = false } = {}) => {
9
+ //@ts-ignore
8
10
  return shallowMount(TabItem, {
9
11
  props: {
10
- icon: Object.freeze(ICONS.FA_CALENDAR_DAYS),
11
- isActive,
12
- title: 'Lorem ipsum dolor sit amet',
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 isActive is set to false component should not render "isActive" class', () => {
24
- const component = createComponent({ isActive: false });
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('.-isActive').exists()).toBe(false);
30
+ expect(component.find('.-isSelected').exists()).toBe(false);
27
31
  });
28
32
 
29
- it('when prop isActive is set to true component should render "isActive" class', () => {
30
- const component = createComponent({ isActive: true });
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('.-isActive').exists()).toBe(true);
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: '<tab-item :icon="ICONS[icon]" :is-active="isActive" :title="title" />',
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
- isActive: false,
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: 'FA_CALENDAR_DAYS',
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 class="a-tabItem" :title="title" :class="{ '-isActive': isActive }">
3
- <wnl-icon :icon="icon" :size="ICON_SIZES.X_SMALL" />
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
- $tab-item-width: (2 * $space-s) + $icon-xs;
30
+ .tabItem {
31
+ $self: &;
13
32
 
14
- .a-tabItem {
15
- border-bottom: 1px solid $color-neutral-border;
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
- padding: $space-xxs $space-s;
21
- width: $tab-item-width;
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
- border-bottom-color: $color-default-border;
25
- color: $color-default-icon;
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
- &.-isActive {
29
- border-bottom-color: $color-primary-border;
30
- color: $color-primary-icon;
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 WnlIcon, { ICON_SIZES, ICONS } from '../Icons/Icon';
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
- WnlIcon,
104
+ DsIcon,
43
105
  },
44
106
  props: {
45
107
  icon: {
46
- type: Object,
47
- required: true,
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
- isActive: {
114
+ isSelected: {
53
115
  type: Boolean,
54
116
  required: true,
55
117
  },
56
- title: {
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
- required: true,
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
  },
@@ -1,3 +1,3 @@
1
1
  import TabItem from './TabItem.vue';
2
-
3
2
  export default TabItem;
3
+ export * from './TabItem.consts';
@@ -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/';
@@ -50,7 +50,9 @@ textarea {
50
50
  }
51
51
 
52
52
  html.thick-scrollbar {
53
- @include scrollbar(15px, var(--raw-gray-100));
53
+ @media #{breakpoint-m()} {
54
+ @include scrollbar(15px, var(--raw-gray-100));
55
+ }
54
56
  }
55
57
 
56
58
  html {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bethinkpl/design-system",
3
- "version": "16.0.1",
3
+ "version": "16.2.0",
4
4
  "description": "Bethink universe design-system",
5
5
  "repository": "git@github.com:bethinkpl/design-system.git",
6
6
  "author": "nerdy@bethink.pl",