@bethinkpl/design-system 20.0.1 → 20.1.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.
Files changed (20) hide show
  1. package/.github/workflows/build-to-review-on-trigger.yml +68 -0
  2. package/.yarnrc.yml +1 -0
  3. package/docs/project.json +1 -1
  4. package/lib/js/components/RichList/{RichListItemBasic/RichListItemBasic.stories.ts → BasicRichListItem/BasicRichListItem.stories.ts} +51 -17
  5. package/lib/js/components/RichList/{RichListItemBasic/RichListItemBasic.vue → BasicRichListItem/BasicRichListItem.vue} +90 -16
  6. package/lib/js/components/RichList/BasicRichListItem/index.ts +3 -0
  7. package/lib/js/components/RichList/GroupRichListItem/GroupRichListItem.consts.ts +18 -0
  8. package/lib/js/components/RichList/GroupRichListItem/GroupRichListItem.stories.ts +337 -0
  9. package/lib/js/components/RichList/{RichListGroupItem/RichListGroupItem.vue → GroupRichListItem/GroupRichListItem.vue} +63 -16
  10. package/lib/js/components/RichList/GroupRichListItem/index.ts +4 -0
  11. package/lib/js/components/RichList/RichListItem/RichListItem.consts.ts +15 -18
  12. package/lib/js/components/RichList/RichListItem/RichListItem.stories.ts +42 -12
  13. package/lib/js/components/RichList/RichListItem/RichListItem.vue +242 -84
  14. package/lib/js/index.ts +2 -2
  15. package/lib/styles/mixins/_scrollbars.scss +9 -0
  16. package/package.json +1 -1
  17. package/lib/js/components/RichList/RichListGroupItem/RichListGroupItem.consts.ts +0 -7
  18. package/lib/js/components/RichList/RichListGroupItem/RichListGroupItem.stories.ts +0 -327
  19. package/lib/js/components/RichList/RichListGroupItem/index.ts +0 -4
  20. package/lib/js/components/RichList/RichListItemBasic/index.ts +0 -3
@@ -0,0 +1,68 @@
1
+ name: Build Storybook to Design Review on trigger
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [ created ]
6
+
7
+ jobs:
8
+ deploy-for-review:
9
+ runs-on: ubuntu-latest
10
+
11
+ if: |
12
+ github.event.comment &&
13
+ github.event.issue.pull_request &&
14
+ startsWith(github.event.comment.body, '/review')
15
+
16
+ steps:
17
+ - name: Get PR branch name
18
+ id: comment-pr-ref
19
+ uses: actions/github-script@v6
20
+ with:
21
+ result-encoding: string
22
+ script: |
23
+ const pr = await github.rest.pulls.get({
24
+ owner: context.issue.owner,
25
+ repo: context.issue.repo,
26
+ pull_number: context.issue.number,
27
+ });
28
+ return pr.data.head.ref
29
+
30
+ - name: Set short branch name
31
+ run: |
32
+ echo "BRANCH_NAME=$(echo "${{ steps.comment-pr-ref.outputs.result }}" | grep -oE -- '[A-Z]+-[0-9]+')" >> $GITHUB_ENV
33
+
34
+ - name: Checkout PR code based on trigger comment
35
+ uses: actions/checkout@v3
36
+ with:
37
+ ref: ${{ steps.comment-pr-ref.outputs.result }}
38
+
39
+ - name: Insert auth font awesome auth token
40
+ run: echo "@fortawesome:registry=https://npm.fontawesome.com/" > .npmrc && echo "//npm.fontawesome.com/:_authToken=${{ secrets.FONT_AWESOME_AUTH_TOKEN }}" >> .npmrc
41
+
42
+ - uses: actions/setup-node@v3
43
+ with:
44
+ node-version: '20.9.0'
45
+ cache: 'yarn'
46
+
47
+ - name: Install and Build 🔧
48
+ run: |
49
+ yarn install --pure-lockfile
50
+ yarn storybook:build
51
+
52
+ - name: Set up S3cmd cli tool
53
+ uses: s3-actions/s3cmd@v1.4.0
54
+ with:
55
+ provider: aws
56
+ region: 'eu-central-1'
57
+ access_key: ${{ secrets.S3_ACCESS_KEY }}
58
+ secret_key: ${{ secrets.S3_SECRET_KEY }}
59
+
60
+ - name: Push to S3 🚀
61
+ run: s3cmd put -r -P public/storybook/* s3://${{ vars.S3_REVIEW_BUCKET }}/${{ env.BRANCH_NAME }}/
62
+
63
+ - name: Add comment with URL
64
+ uses: thollander/actions-comment-pull-request@v2
65
+ with:
66
+ pr_number: ${{ github.event.issue.number }}
67
+ message: |
68
+ Your storybook is available on: https://${{ vars.S3_REVIEW_BUCKET }}.s3.amazonaws.com/${{ env.BRANCH_NAME }}/index.html
package/.yarnrc.yml ADDED
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules
package/docs/project.json CHANGED
@@ -1 +1 @@
1
- {"generatedAt":1712053350724,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"metaFramework":{"name":"vue-cli","packageName":"@vue/cli-service","version":"5.0.8"},"packageManager":{"type":"yarn","version":"1.22.22"},"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":1712062915821,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"metaFramework":{"name":"vue-cli","packageName":"@vue/cli-service","version":"5.0.8"},"packageManager":{"type":"yarn","version":"1.22.22"},"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,28 +1,29 @@
1
- import RichListItemBasic from './RichListItemBasic.vue';
1
+ import BasicRichListItem from './BasicRichListItem.vue';
2
2
 
3
3
  import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
4
4
  import {
5
+ RICH_LIST_ITEM_BACKGROUND_COLOR,
5
6
  RICH_LIST_ITEM_BORDER_COLOR,
6
- RICH_LIST_ITEM_ICON_COLOR,
7
+ RICH_LIST_ITEM_ELEVATION,
7
8
  RICH_LIST_ITEM_SIZE,
8
9
  RICH_LIST_ITEM_STATE,
9
10
  RICH_LIST_ITEM_TYPE,
10
11
  } from '../RichListItem';
11
- import { ICONS } from '../../Icons/Icon';
12
+ import { ICON_COLORS, ICONS } from '../../Icons/Icon';
12
13
 
13
14
  export default {
14
- title: 'Components/RichList/RichListItemBasic',
15
- component: RichListItemBasic,
15
+ title: 'Components/RichList/BasicRichListItem',
16
+ component: BasicRichListItem,
16
17
  decorators: [
17
18
  (story) => ({
18
19
  components: { story },
19
20
  template: "<div style='display: flex;padding: 16px;'><story /></div>",
20
21
  }),
21
22
  ],
22
- } as Meta<typeof RichListItemBasic>;
23
+ } as Meta<typeof BasicRichListItem>;
23
24
 
24
- const StoryTemplate: StoryFn<typeof RichListItemBasic> = (args) => ({
25
- components: { RichListItemBasic },
25
+ const StoryTemplate: StoryFn<typeof BasicRichListItem> = (args, { updateArgs }) => ({
26
+ components: { BasicRichListItem },
26
27
  setup() {
27
28
  return { ...args };
28
29
  },
@@ -31,8 +32,13 @@ const StoryTemplate: StoryFn<typeof RichListItemBasic> = (args) => ({
31
32
  ICONS: Object.freeze(ICONS),
32
33
  };
33
34
  },
35
+ methods: {
36
+ updateIsSelected(isSelected) {
37
+ updateArgs({ isSelected });
38
+ },
39
+ },
34
40
  template: `
35
- <rich-list-item-basic
41
+ <basic-rich-list-item
36
42
  :size="size"
37
43
  :type="type"
38
44
  :is-interactive="isInteractive"
@@ -47,14 +53,21 @@ const StoryTemplate: StoryFn<typeof RichListItemBasic> = (args) => ({
47
53
  :text="text"
48
54
  :eyebrow="eyebrow"
49
55
  :is-eyebrow-uppercase="isEyebrowUppercase"
56
+ :background-color="backgroundColor"
57
+ :elevation="elevation"
58
+ :has-draggable-handler="hasDraggableHandler"
59
+ :has-actions-slot-divider="hasActionsSlotDivider"
60
+ :is-selectable="isSelectable"
61
+ :is-selected="isSelected"
62
+ @update:isSelected="updateIsSelected"
50
63
  >
51
64
  <template v-if="meta" #meta>
52
65
  <div v-html="meta" />
53
66
  </template>
54
- <template v-if="trailing" #trailing>
55
- <div v-html="trailing" />
67
+ <template v-if="actions" #actions>
68
+ <div v-html="actions" />
56
69
  </template>
57
- </rich-list-item-basic>`,
70
+ </basic-rich-list-item>`,
58
71
  });
59
72
 
60
73
  export const Interactive = StoryTemplate.bind({});
@@ -62,22 +75,29 @@ export const Interactive = StoryTemplate.bind({});
62
75
  const args = {
63
76
  size: RICH_LIST_ITEM_SIZE.MEDIUM,
64
77
  type: RICH_LIST_ITEM_TYPE.DEFAULT,
65
- isInteractive: true,
78
+ backgroundColor: RICH_LIST_ITEM_BACKGROUND_COLOR.NEUTRAL,
79
+ elevation: null,
80
+ isDimmed: false,
66
81
  isDraggable: true,
82
+ hasDraggableHandler: true,
67
83
  icon: null,
68
84
  iconColor: null,
69
85
  iconColorHex: '',
70
- isDimmed: false,
86
+ hasActionsSlotDivider: true,
87
+ isSelectable: true,
88
+ isSelected: true,
71
89
  borderColor: null,
72
90
  borderColorHex: '',
73
91
  state: RICH_LIST_ITEM_STATE.DEFAULT,
92
+ isInteractive: true,
93
+ draggableIconClassName: 'draggableIconClassName-1',
74
94
 
75
95
  eyebrow: 'Eyebrow Uppercase',
76
96
  text: 'Długa nazwa gdy się nie mieści Praesentium dicta sit. Molestiae unde voluptatem eaque labore.',
77
97
  isEyebrowUppercase: false,
78
98
 
79
99
  meta: 'Meta Slot',
80
- trailing: 'Tailing Slot',
100
+ actions: 'ACS',
81
101
  } as Args;
82
102
 
83
103
  const argTypes = {
@@ -94,7 +114,7 @@ const argTypes = {
94
114
  control: { type: 'select' },
95
115
  },
96
116
  iconColor: {
97
- options: [null, ...Object.values(RICH_LIST_ITEM_ICON_COLOR)],
117
+ options: [null, ...Object.values(ICON_COLORS)],
98
118
  control: { type: 'select' },
99
119
  },
100
120
  borderColor: {
@@ -120,15 +140,29 @@ const argTypes = {
120
140
  meta: {
121
141
  control: { type: 'text' },
122
142
  },
123
- trailing: {
143
+ actions: {
144
+ control: { type: 'text' },
145
+ },
146
+ draggableIconClassName: {
124
147
  control: { type: 'text' },
125
148
  },
149
+ backgroundColor: {
150
+ options: [null, ...Object.values(RICH_LIST_ITEM_BACKGROUND_COLOR)],
151
+ control: { type: 'select' },
152
+ },
153
+ elevation: {
154
+ options: [null, ...Object.values(RICH_LIST_ITEM_ELEVATION)],
155
+ control: { type: 'select' },
156
+ },
126
157
  } as ArgTypes;
127
158
 
128
159
  Interactive.argTypes = argTypes;
129
160
  Interactive.args = args;
130
161
 
131
162
  Interactive.parameters = {
163
+ actions: {
164
+ handles: ['icon-click', 'click', 'update:isSelected'],
165
+ },
132
166
  layout: 'fullscreen',
133
167
  design: {
134
168
  type: 'figma',
@@ -11,18 +11,28 @@
11
11
  :border-color="borderColor"
12
12
  :border-color-hex="borderColorHex"
13
13
  :state="state"
14
- class="richListItemBasic"
14
+ :background-color="backgroundColor"
15
+ :elevation="elevation"
16
+ :has-draggable-handler="hasDraggableHandler"
17
+ :has-actions-slot-divider="hasActionsSlotDivider"
18
+ :is-selectable="isSelectable"
19
+ :is-selected="isSelected"
20
+ class="basicRichListItem"
21
+ :class="{
22
+ '-small': size === RICH_LIST_ITEM_SIZE.SMALL,
23
+ }"
24
+ @update:is-selected="$emit('update:isSelected', $event)"
15
25
  >
16
26
  <template #content>
17
- <div class="richListItemBasic__content">
27
+ <div class="basicRichListItem__content">
18
28
  <div
19
- class="richListItemBasic__eyebrow"
29
+ class="basicRichListItem__eyebrow"
20
30
  :class="{ '-uppercase': isEyebrowUppercase }"
21
31
  >
22
32
  {{ eyebrow }}
23
33
  </div>
24
34
 
25
- <div class="richListItemBasic__text">
35
+ <div class="basicRichListItem__text">
26
36
  {{ text }}
27
37
  </div>
28
38
  </div>
@@ -30,8 +40,8 @@
30
40
  <template v-if="$slots.meta" #meta>
31
41
  <slot name="meta" />
32
42
  </template>
33
- <template v-if="$slots.trailing" #trailing>
34
- <slot name="trailing" />
43
+ <template v-if="$slots.actions" #actions>
44
+ <slot name="actions" />
35
45
  </template>
36
46
  </rich-list-item>
37
47
  </template>
@@ -40,8 +50,12 @@
40
50
  @import '../../../../styles/settings/colors/tokens';
41
51
  @import '../../../../styles/settings/typography/tokens';
42
52
  @import '../../../../styles/settings/spacings';
53
+ @import '../../../../styles/settings/media-queries';
54
+ @import '../../../../styles/mixins/scrollbars';
55
+
56
+ .basicRichListItem {
57
+ $root: &;
43
58
 
44
- .richListItemBasic {
45
59
  max-width: 100%;
46
60
 
47
61
  &__content {
@@ -50,11 +64,11 @@
50
64
  gap: $space-xxxxs;
51
65
  justify-content: center;
52
66
  min-width: 0; // to prevent the component from being pushed by the ellipses
53
- padding: $space-xxs 0;
67
+ padding: $space-xs 0;
54
68
  }
55
69
 
56
70
  &__eyebrow {
57
- @include info-s-extensive-bold;
71
+ @include info-s-default-bold;
58
72
 
59
73
  color: $color-neutral-text-weak;
60
74
  min-width: 0;
@@ -65,37 +79,59 @@
65
79
  &.-uppercase {
66
80
  @include info-s-extensive-bold-uppercase;
67
81
  }
82
+
83
+ &:hover {
84
+ color: $color-neutral-text-weak-hovered;
85
+ }
68
86
  }
69
87
 
70
88
  &__text {
71
89
  @include text-m-compact-bold;
90
+ @include invisible-scrollbar;
72
91
 
73
92
  color: $color-neutral-text;
74
93
  min-width: 0;
75
- overflow: hidden;
76
- text-overflow: ellipsis;
94
+ overflow-x: scroll;
77
95
  white-space: nowrap;
96
+
97
+ @media #{breakpoint-s()} {
98
+ overflow: hidden;
99
+ text-overflow: ellipsis;
100
+ }
101
+
102
+ &:hover {
103
+ color: $color-neutral-text-hovered;
104
+ }
105
+ }
106
+
107
+ &.-small {
108
+ #{$root}__content {
109
+ padding: $space-xxxs 0;
110
+ }
78
111
  }
79
112
  }
80
113
  </style>
81
114
 
82
115
  <script lang="ts">
83
116
  import RichListItem, {
117
+ RICH_LIST_ITEM_BACKGROUND_COLOR,
84
118
  RICH_LIST_ITEM_BORDER_COLOR,
85
- RICH_LIST_ITEM_ICON_COLOR,
119
+ RICH_LIST_ITEM_ELEVATION,
86
120
  RICH_LIST_ITEM_SIZE,
87
121
  RICH_LIST_ITEM_STATE,
88
122
  RICH_LIST_ITEM_TYPE,
123
+ RichListItemBackgroundColor,
89
124
  RichListItemBorderColor,
90
- RichListItemIconColor,
125
+ RichListItemElevation,
91
126
  RichListItemSize,
92
127
  RichListItemState,
93
128
  RichListItemType,
94
129
  } from '../RichListItem';
95
130
  import { PropType } from 'vue';
131
+ import { ICON_COLORS, IconColor } from '../../Icons/Icon';
96
132
 
97
133
  export default {
98
- name: 'RichListItemBasic',
134
+ name: 'BasicRichListItem',
99
135
  components: {
100
136
  RichListItem,
101
137
  },
@@ -138,10 +174,10 @@ export default {
138
174
  default: null,
139
175
  },
140
176
  iconColor: {
141
- type: String as PropType<RichListItemIconColor>,
177
+ type: String as PropType<IconColor>,
142
178
  default: null,
143
179
  validator(iconColor) {
144
- return Object.values(RICH_LIST_ITEM_ICON_COLOR).includes(iconColor);
180
+ return Object.values(ICON_COLORS).includes(iconColor);
145
181
  },
146
182
  },
147
183
  iconColorHex: {
@@ -171,6 +207,44 @@ export default {
171
207
  type: Boolean,
172
208
  default: false,
173
209
  },
210
+ backgroundColor: {
211
+ type: String as PropType<RichListItemBackgroundColor>,
212
+ default: RICH_LIST_ITEM_BACKGROUND_COLOR.NEUTRAL,
213
+ validator(backgroundColor) {
214
+ return Object.values(RICH_LIST_ITEM_BACKGROUND_COLOR).includes(backgroundColor);
215
+ },
216
+ },
217
+ elevation: {
218
+ type: String as PropType<RichListItemElevation>,
219
+ default: null,
220
+ validator(evolution) {
221
+ return Object.values(RICH_LIST_ITEM_ELEVATION).includes(evolution);
222
+ },
223
+ },
224
+ hasDraggableHandler: {
225
+ type: Boolean,
226
+ default: true,
227
+ },
228
+ hasActionsSlotDivider: {
229
+ type: Boolean,
230
+ default: true,
231
+ },
232
+ isSelectable: {
233
+ type: Boolean,
234
+ default: true,
235
+ },
236
+ isSelected: {
237
+ type: Boolean,
238
+ default: false,
239
+ },
240
+ },
241
+ emits: {
242
+ 'update:isSelected': (value: boolean) => true,
243
+ },
244
+ data() {
245
+ return {
246
+ RICH_LIST_ITEM_SIZE: Object.freeze(RICH_LIST_ITEM_SIZE),
247
+ };
174
248
  },
175
249
  };
176
250
  </script>
@@ -0,0 +1,3 @@
1
+ import BasicRichListItem from './BasicRichListItem.vue';
2
+
3
+ export default BasicRichListItem;
@@ -0,0 +1,18 @@
1
+ import {
2
+ RICH_LIST_ITEM_BACKGROUND_COLOR,
3
+ RICH_LIST_ITEM_BORDER_COLOR,
4
+ RichListItemBackgroundColor,
5
+ RichListItemBorderColor,
6
+ } from '../RichListItem';
7
+
8
+ export const GROUP_RICH_LIST_ITEM_BORDER_COLOR = {
9
+ ...RICH_LIST_ITEM_BORDER_COLOR,
10
+ } as const;
11
+
12
+ export type GroupRichListItemBorderColor = RichListItemBorderColor;
13
+
14
+ export const GROUP_RICH_LIST_ITEM_BACKGROUND_COLOR = {
15
+ ...RICH_LIST_ITEM_BACKGROUND_COLOR,
16
+ } as const;
17
+
18
+ export type GroupRichListItemBackgroundColor = RichListItemBackgroundColor;