@bethinkpl/design-system 24.2.1 → 25.0.1

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.
@@ -1,7 +1,10 @@
1
1
  <template>
2
2
  <div class="ds-richListItem" :class="classList" @click="$emit('click', $event)">
3
+ <div v-if="hasMedia && isVertical" class="ds-richListItem__mediaVertical -ds-dimmable">
4
+ <slot name="media" />
5
+ </div>
3
6
  <div class="ds-richListItem__container -ds-dimmable">
4
- <div v-if="hasMedia" class="ds-richListItem__media">
7
+ <div v-if="hasMedia && isHorizontal" class="ds-richListItem__mediaHorizontal">
5
8
  <slot name="media" />
6
9
  </div>
7
10
  <div v-if="isDraggable && hasDraggableHandler" class="ds-richListItem__dragAndDrop">
@@ -35,19 +38,18 @@
35
38
  <slot name="content" />
36
39
  </div>
37
40
  <div class="ds-richListItem__rightContainer">
38
- <div v-if="$slots.metadata" class="ds-richListItem__metadata -ds-hideOnMobile">
41
+ <div v-if="$slots.metadata && isHorizontal" class="ds-richListItem__metadata">
39
42
  <slot name="metadata" />
40
43
  </div>
41
44
  <div v-if="$slots.actions" class="ds-richListItem__actionSlot" @click.stop>
42
45
  <ds-divider
43
- v-if="$slots.actions && hasActionsSlotDivider"
46
+ v-if="$slots.actions && hasActionsSlotDivider && isHorizontal"
44
47
  is-vertical
45
- class="-ds-hideOnMobile"
46
48
  />
47
49
  <slot name="actions" />
48
50
  </div>
49
51
  <div v-if="isSelectable" class="ds-richListItem__checkbox">
50
- <ds-divider is-vertical class="-ds-hideOnMobile" />
52
+ <ds-divider v-if="isHorizontal" is-vertical />
51
53
  <ds-checkbox
52
54
  :is-selected="isSelected"
53
55
  @update:is-selected="$emit('update:is-selected', $event)"
@@ -57,10 +59,7 @@
57
59
  </div>
58
60
  </div>
59
61
 
60
- <div
61
- v-if="$slots.metadata"
62
- class="ds-richListItem__metadata -ds-dimmable -ds-visibleOnMobile"
63
- >
62
+ <div v-if="$slots.metadata && isVertical" class="ds-richListItem__metadata -ds-dimmable">
64
63
  <slot name="metadata" />
65
64
  </div>
66
65
  <div
@@ -108,20 +107,147 @@ $rich-list-item-background-colors: (
108
107
  }
109
108
  }
110
109
 
111
- align-items: flex-start;
112
110
  cursor: default;
113
111
  display: flex;
114
112
  flex: 1;
115
- flex-direction: column;
116
- justify-content: center;
117
- padding: $space-4xs;
118
113
  position: relative;
119
114
 
120
- @media #{breakpoint-s()} {
115
+ &.-ds-horizontal {
121
116
  align-items: center;
122
117
  flex-direction: initial;
123
118
  justify-content: initial;
124
119
  padding: 0 $space-4xs;
120
+
121
+ #{$root}__container {
122
+ align-self: initial;
123
+ }
124
+
125
+ #{$root}__dragAndDrop,
126
+ #{$root}__iconWrapper {
127
+ align-items: center;
128
+ padding: $space-3xs $space-3xs $space-3xs $space-s;
129
+ }
130
+
131
+ #{$root}__content {
132
+ padding: 0 $space-4xs 0 $space-2xs;
133
+ }
134
+
135
+ #{$root}__metadata {
136
+ justify-content: flex-start;
137
+ padding-left: $space-4xs;
138
+ }
139
+
140
+ #{$root}__rightContainer {
141
+ align-items: center;
142
+ justify-content: initial;
143
+ padding: $space-xs 0;
144
+ }
145
+
146
+ #{$root}__actionSlot {
147
+ align-items: center;
148
+ justify-content: initial;
149
+ padding: 0 $space-4xs;
150
+ }
151
+
152
+ #{$root}__checkbox {
153
+ align-items: center;
154
+ padding: 0 $space-s 0 $space-4xs;
155
+ }
156
+
157
+ &.-ds-small {
158
+ padding: 0 $space-4xs 0 0;
159
+
160
+ #{$root}__dragAndDrop,
161
+ #{$root}__iconWrapper {
162
+ padding: $space-3xs 0 $space-3xs $space-xs;
163
+ }
164
+
165
+ #{$root}__checkbox {
166
+ gap: $space-xs;
167
+ padding: 0 $space-xs 0 $space-4xs;
168
+ }
169
+
170
+ #{$root}__rightContainer {
171
+ padding: $space-2xs 0;
172
+ }
173
+
174
+ #{$root}__actionSlot {
175
+ padding: 0 $space-4xs;
176
+ }
177
+
178
+ #{$root}__metadata {
179
+ justify-content: flex-start;
180
+ padding-left: $space-4xs;
181
+ }
182
+ }
183
+ }
184
+
185
+ &.-ds-vertical {
186
+ align-items: flex-start;
187
+ flex-direction: column;
188
+ justify-content: center;
189
+ padding-bottom: $space-4xs;
190
+
191
+ #{$root}__container {
192
+ align-self: stretch;
193
+ padding: $space-4xs $space-4xs 0;
194
+ }
195
+
196
+ #{$root}__dragAndDrop,
197
+ #{$root}__iconWrapper {
198
+ align-items: flex-start;
199
+ padding: $space-xs 0 0 $space-xs;
200
+ }
201
+
202
+ #{$root}__content {
203
+ padding: 0 $space-4xs 0 $space-xs;
204
+ }
205
+
206
+ #{$root}__metadata {
207
+ padding-left: $space-s;
208
+ padding-right: $space-2xs;
209
+ }
210
+
211
+ #{$root}__rightContainer {
212
+ align-items: flex-start;
213
+ justify-content: flex-end;
214
+ }
215
+
216
+ #{$root}__actionSlot {
217
+ align-items: flex-start;
218
+ justify-content: flex-end;
219
+ padding: $space-4xs $space-4xs 0 $space-4xs;
220
+ }
221
+
222
+ #{$root}__checkbox {
223
+ align-items: flex-start;
224
+ padding: $space-3xs $space-xs 0 $space-xs;
225
+ }
226
+
227
+ &.-ds-small {
228
+ #{$root}__dragAndDrop,
229
+ #{$root}__iconWrapper {
230
+ padding: $space-2xs $space-4xs 0 $space-2xs;
231
+ }
232
+
233
+ #{$root}__checkbox {
234
+ gap: $space-s;
235
+ padding: $space-5xs $space-2xs 0 $space-2xs;
236
+ }
237
+
238
+ #{$root}__actionSlot {
239
+ padding: 0 $space-4xs 0 $space-5xs;
240
+ }
241
+
242
+ #{$root}__metadata {
243
+ padding-left: $space-xs;
244
+ }
245
+ }
246
+ }
247
+
248
+ &.-ds-verticalWithMedia {
249
+ padding-right: 0;
250
+ padding-top: 0;
125
251
  }
126
252
 
127
253
  &.-ds-has-media {
@@ -230,33 +356,26 @@ $rich-list-item-background-colors: (
230
356
 
231
357
  &__container {
232
358
  align-items: center;
233
- align-self: stretch;
234
359
  display: flex;
235
360
  flex: 1;
236
361
  width: 100%;
237
-
238
- @media #{breakpoint-s()} {
239
- align-self: initial;
240
- }
241
362
  }
242
363
 
243
- &__media {
364
+ &__mediaHorizontal {
244
365
  height: 80px;
245
366
  margin-right: $space-3xs;
246
367
  width: 100px;
247
368
  }
248
369
 
370
+ &__mediaVertical {
371
+ aspect-ratio: 4 / 3;
372
+ overflow: hidden;
373
+ }
374
+
249
375
  &__dragAndDrop,
250
376
  &__iconWrapper {
251
- align-items: flex-start;
252
377
  align-self: stretch;
253
378
  display: flex;
254
- padding: $space-xs 0 0 $space-xs;
255
-
256
- @media #{breakpoint-s()} {
257
- align-items: center;
258
- padding: $space-3xs $space-3xs $space-3xs $space-s;
259
- }
260
379
  }
261
380
 
262
381
  &__content {
@@ -264,81 +383,30 @@ $rich-list-item-background-colors: (
264
383
  display: flex;
265
384
  flex: 1 0 0;
266
385
  min-width: 0;
267
- padding: 0 $space-4xs 0 $space-xs;
268
-
269
- @media #{breakpoint-s()} {
270
- padding: 0 $space-4xs 0 $space-2xs;
271
- }
272
386
  }
273
387
 
274
388
  &__metadata {
275
389
  align-items: center;
276
390
  gap: $space-xs;
277
- padding-left: $space-xs;
278
391
  padding-right: $space-4xs;
279
-
280
- @media #{breakpoint-s()} {
281
- justify-content: flex-start;
282
- padding-left: $space-4xs;
283
- }
284
-
285
- &.-ds-hideOnMobile {
286
- display: none;
287
-
288
- @media #{breakpoint-s()} {
289
- display: flex;
290
- }
291
- }
292
-
293
- &.-ds-visibleOnMobile {
294
- display: flex;
295
-
296
- @media #{breakpoint-s()} {
297
- display: none;
298
- }
299
- }
300
392
  }
301
393
 
302
394
  &__rightContainer {
303
- align-items: flex-start;
304
395
  align-self: stretch;
305
396
  display: flex;
306
- justify-content: flex-end;
307
-
308
- @media #{breakpoint-s()} {
309
- align-items: center;
310
- justify-content: initial;
311
- padding: $space-xs 0;
312
- }
313
397
  }
314
398
 
315
399
  &__actionSlot {
316
- align-items: flex-start;
317
400
  align-self: stretch;
318
401
  display: flex;
319
402
  gap: $space-2xs;
320
- justify-content: flex-end;
321
- padding: $space-4xs $space-4xs 0 $space-4xs;
322
-
323
- @media #{breakpoint-s()} {
324
- align-items: center;
325
- justify-content: initial;
326
- padding: 0 $space-4xs;
327
- }
328
403
  }
329
404
 
330
405
  &__checkbox {
331
- align-items: flex-start;
332
406
  align-self: stretch;
333
407
  display: flex;
334
408
  gap: $space-s;
335
409
  justify-content: flex-end;
336
- padding: $space-5xs $space-xs 0 $space-xs;
337
-
338
- @media #{breakpoint-s()} {
339
- align-items: center;
340
- padding: 0 $space-s 0 $space-4xs;
341
- }
342
410
  }
343
411
 
344
412
  &__icon {
@@ -361,70 +429,16 @@ $rich-list-item-background-colors: (
361
429
  }
362
430
 
363
431
  &.-ds-small {
364
- padding: $space-4xs;
365
-
366
- @media #{breakpoint-s()} {
367
- padding: 0 $space-4xs 0 0;
368
- }
369
-
370
- #{$root}__dragAndDrop,
371
- #{$root}__iconWrapper {
372
- padding: $space-2xs $space-4xs 0 $space-2xs;
373
-
374
- @media #{breakpoint-s()} {
375
- padding: $space-3xs 0 $space-3xs $space-xs;
376
- }
377
- }
378
-
379
- #{$root}__checkbox {
380
- gap: $space-s;
381
- padding: $space-5xs $space-2xs 0 $space-2xs;
382
-
383
- @media #{breakpoint-s()} {
384
- gap: $space-xs;
385
- padding: 0 $space-xs 0 $space-4xs;
386
- }
387
- }
388
-
389
432
  #{$root}__content {
390
433
  align-items: center;
391
434
  padding: 0 $space-4xs 0 $space-2xs;
392
435
  }
393
436
 
394
- #{$root}__rightContainer {
395
- @media #{breakpoint-s()} {
396
- padding: $space-2xs 0;
397
- }
398
- }
399
-
400
437
  #{$root}__actionSlot {
401
438
  gap: $space-2xs;
402
- padding: 0 $space-4xs 0 $space-5xs;
403
-
404
- @media #{breakpoint-s()} {
405
- padding: 0 $space-4xs;
406
- }
407
- }
408
-
409
- #{$root}__metadata {
410
- padding-left: $space-2xs;
411
- padding-right: $space-4xs;
412
-
413
- @media #{breakpoint-s()} {
414
- justify-content: flex-start;
415
- padding-left: $space-4xs;
416
- }
417
439
  }
418
440
  }
419
441
  }
420
-
421
- .-ds-hideOnMobile {
422
- display: none;
423
-
424
- @media #{breakpoint-s()} {
425
- display: initial;
426
- }
427
- }
428
442
  </style>
429
443
 
430
444
  <script lang="ts">
@@ -442,12 +456,14 @@ import {
442
456
  RICH_LIST_ITEM_BACKGROUND_COLOR,
443
457
  RICH_LIST_ITEM_BORDER_COLOR,
444
458
  RICH_LIST_ITEM_ELEVATION,
459
+ RICH_LIST_ITEM_LAYOUT,
445
460
  RICH_LIST_ITEM_SIZE,
446
461
  RICH_LIST_ITEM_STATE,
447
462
  RICH_LIST_ITEM_TYPE,
448
463
  RichListItemBackgroundColor,
449
464
  RichListItemBorderColor,
450
465
  RichListItemElevation,
466
+ RichListItemLayout,
451
467
  RichListItemSize,
452
468
  RichListItemState,
453
469
  RichListItemType,
@@ -464,14 +480,21 @@ export default {
464
480
  type: {
465
481
  type: String as PropType<RichListItemType>,
466
482
  default: RICH_LIST_ITEM_TYPE.DEFAULT,
467
- validator(type) {
483
+ validator(type: RichListItemType) {
468
484
  return Object.values(RICH_LIST_ITEM_TYPE).includes(type);
469
485
  },
470
486
  },
487
+ layout: {
488
+ type: String as PropType<RichListItemLayout>,
489
+ default: RICH_LIST_ITEM_LAYOUT.HORIZONTAL,
490
+ validator(layout: RichListItemLayout) {
491
+ return Object.values(RICH_LIST_ITEM_LAYOUT).includes(layout);
492
+ },
493
+ },
471
494
  state: {
472
495
  type: String as PropType<RichListItemState>,
473
496
  default: RICH_LIST_ITEM_STATE.DEFAULT,
474
- validator(state) {
497
+ validator(state: RichListItemState) {
475
498
  return Object.values(RICH_LIST_ITEM_STATE).includes(state);
476
499
  },
477
500
  },
@@ -577,6 +600,9 @@ export default {
577
600
  return {
578
601
  '-ds-default': this.type === RICH_LIST_ITEM_TYPE.DEFAULT,
579
602
  '-ds-flat': this.type === RICH_LIST_ITEM_TYPE.FLAT,
603
+ '-ds-horizontal': this.isHorizontal,
604
+ '-ds-verticalWithMedia': this.isVertical && this.hasMedia,
605
+ '-ds-vertical': this.isVertical,
580
606
  '-ds-loading': this.state === RICH_LIST_ITEM_STATE.LOADING,
581
607
  '-ds-dimmed': this.isDimmed,
582
608
  '-ds-interactive': this.isInteractive,
@@ -593,6 +619,12 @@ export default {
593
619
  '-ds-has-media': this.hasMedia,
594
620
  };
595
621
  },
622
+ isHorizontal() {
623
+ return this.layout === RICH_LIST_ITEM_LAYOUT.HORIZONTAL;
624
+ },
625
+ isVertical() {
626
+ return this.layout === RICH_LIST_ITEM_LAYOUT.VERTICAL;
627
+ },
596
628
  iconColorClass() {
597
629
  if (!this.iconColor || (this.iconColor && this.iconColorHex)) {
598
630
  return;
@@ -67,6 +67,7 @@ export default defineComponent({
67
67
  background: 'var(--neutral-background-medium, #E5E7ED)',
68
68
  color: 'var(--neutral-text-heavy, #343C50)',
69
69
  borderRadius: '4px',
70
+ maxWidth: '240px',
70
71
  },
71
72
  ptOptions: {
72
73
  mergeProps: true,
@@ -10,6 +10,9 @@ export const initializePrimeVue = (app) => {
10
10
  darkModeSelector: '.app-dark', // enabling dark mode in storybook makes all components canvas black
11
11
  },
12
12
  },
13
+ zIndex: {
14
+ tooltip: 16777271, // keep above $z-index-modal
15
+ },
13
16
  });
14
17
 
15
18
  app.directive('pv-tooltip', Tooltip);
@@ -1,4 +1,5 @@
1
1
  // z-index positioning
2
2
  // hardcoded
3
+ // Keep in sync with zIndex.tooltip in primevue.ts
3
4
  $z-index-modal: 16777270; // 16777271 is the highest possible value in Safari, we need to make space for elements that above modal, so -1
4
5
  $z-index-overlay: 51;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bethinkpl/design-system",
3
- "version": "24.2.1",
3
+ "version": "25.0.1",
4
4
  "description": "Bethink universe design-system",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,7 +40,6 @@
40
40
  "@fortawesome/pro-regular-svg-icons": "6.4.2",
41
41
  "@fortawesome/pro-solid-svg-icons": "6.4.2",
42
42
  "@fortawesome/vue-fontawesome": "3.0.3",
43
- "@primevue/themes": "4.0.0-rc.3",
44
43
  "@storybook/addon-actions": "^6.5.13",
45
44
  "@storybook/addon-controls": "^6.5.13",
46
45
  "@storybook/addon-docs": "^6.5.13",
@@ -73,11 +72,10 @@
73
72
  "jsdom-global": "^3.0.2",
74
73
  "postcss-prefix-selector": "^1.9.0",
75
74
  "prettier": "2.7.1",
76
- "primevue": "4.0.0-rc.3",
77
75
  "sass": "^1.28.0",
78
76
  "sass-loader": "^7.1.0",
79
77
  "storybook-addon-designs": "^6.3.1",
80
- "stylelint": "13.6.1",
78
+ "stylelint": "13.8.0",
81
79
  "stylelint-config-standard": "20.0.0",
82
80
  "stylelint-order": "6.0.3",
83
81
  "stylelint-scss": "3.18.0",
@@ -88,5 +86,9 @@
88
86
  "vue-loader": "17.0.0",
89
87
  "vue-popperjs": "github:bethinkpl/vue-popper#03c7912c4729386743b0cca8f39b35448cc3db7f",
90
88
  "vue-svg-loader": "0.17.0-beta.2"
89
+ },
90
+ "dependencies": {
91
+ "@primevue/themes": "4.0.0-rc.3",
92
+ "primevue": "4.0.0-rc.3"
91
93
  }
92
94
  }
package/vue.config.js CHANGED
@@ -18,6 +18,9 @@ module.exports = {
18
18
  css: {
19
19
  extract: false,
20
20
  },
21
+ configureWebpack: (config) => {
22
+ config.externals = [/^@?primevue\/.*$/];
23
+ },
21
24
  chainWebpack: (config) => {
22
25
  /**
23
26
  * These are some necessary steps changing the default webpack config of the Vue CLI