@bethinkpl/design-system 31.0.2 → 32.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.
Files changed (42) hide show
  1. package/dist/design-system.css +1 -1
  2. package/dist/design-system.js +14296 -10517
  3. package/dist/design-system.js.map +1 -1
  4. package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +2 -0
  5. package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +2 -0
  6. package/dist/lib/js/components/Chip/Chip.vue.d.ts +4 -0
  7. package/dist/lib/js/components/DatePickers/DateBox/DateBox.vue.d.ts +2 -0
  8. package/dist/lib/js/components/DatePickers/DatePicker/DatePicker.vue.d.ts +2 -0
  9. package/dist/lib/js/components/DatePickers/DateRangePicker/DateRangePicker.vue.d.ts +2 -0
  10. package/dist/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue.d.ts +8 -0
  11. package/dist/lib/js/components/Drawer/DrawerListItem/DrawerListItem.vue.d.ts +2 -0
  12. package/dist/lib/js/components/Drawer/DrawerSection/DrawerSection.vue.d.ts +6 -0
  13. package/dist/lib/js/components/Form/RadioButton/RadioButton.vue.d.ts +2 -0
  14. package/dist/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue.d.ts +4 -0
  15. package/dist/lib/js/components/Headers/SectionHeader/SectionHeader.vue.d.ts +4 -0
  16. package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +2 -0
  17. package/dist/lib/js/components/Modal/Modal.vue.d.ts +2 -0
  18. package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +4 -0
  19. package/dist/lib/js/components/Modals/ModalDialog/ModalDialog.vue.d.ts +4 -0
  20. package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +6 -0
  21. package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +2 -0
  22. package/dist/lib/js/components/ProgressDonutChart/ProgressDonutChart.vue.d.ts +2 -0
  23. package/dist/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue.d.ts +146 -262
  24. package/dist/lib/js/components/RichList/RichListItem/RichListItem.vue.d.ts +2 -0
  25. package/dist/lib/js/components/SelectList/SelectListItem/SelectListItem.vue.d.ts +2 -0
  26. package/dist/lib/js/components/SelectList/SelectListItemToggle/SelectListItemToggle.vue.d.ts +2 -0
  27. package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +2 -0
  28. package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +2 -0
  29. package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +6 -0
  30. package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +6 -0
  31. package/dist/lib/js/components/Switch/Switch.vue.d.ts +2 -0
  32. package/dist/lib/js/components/TextGroup/TextGroup.consts.d.ts +4 -3
  33. package/dist/lib/js/components/TextGroup/TextGroup.vue.d.ts +58 -302
  34. package/dist/lib/js/components/Tile/Tile.sb.shared.d.ts +2 -0
  35. package/dist/lib/js/components/Toggles/ToggleButton/ToggleButton.vue.d.ts +2 -0
  36. package/dist/lib/js/icons/fontawesome.d.ts +2 -0
  37. package/lib/js/components/TextGroup/TextGroup.consts.ts +5 -3
  38. package/lib/js/components/TextGroup/TextGroup.stories.ts +13 -6
  39. package/lib/js/components/TextGroup/TextGroup.vue +172 -105
  40. package/lib/js/icons/fontawesome.ts +4 -0
  41. package/lib/styles/mixins/_background-mask.scss +2 -2
  42. package/package.json +4 -1
@@ -13,22 +13,32 @@
13
13
 
14
14
  [loadingSizeClassName]: isLoading,
15
15
 
16
- [colorClassName]: true,
16
+ [prominenceClassName]: true,
17
17
  }"
18
18
  >
19
19
  <div
20
20
  v-if="eyebrowText !== null"
21
- class="ds-textGroup__eyebrow"
21
+ class="ds-textGroup__eyebrowWrapper"
22
22
  :class="{
23
- '-ds-ellipsis': eyebrowTextEllipsis,
24
- '-ds-uppercase': isEyebrowTextUppercase,
23
+ '-ds-mask-active': isEyebrowMaskActive,
24
+ '-ds-mask-hidden': isEyebrowMaskHidden,
25
25
  }"
26
26
  >
27
- <div v-if="isLoading" class="ds-textGroup__skeletonWrapper">
28
- <ds-skeleton width="50%" height="100%" />
27
+ <div
28
+ ref="eyebrowRef"
29
+ class="ds-textGroup__eyebrow"
30
+ :class="{
31
+ '-ds-ellipsis': eyebrowTextEllipsis,
32
+ '-ds-uppercase': isEyebrowTextUppercase,
33
+ '-ds-mask': hasEyebrowMask,
34
+ }"
35
+ >
36
+ <div v-if="isLoading" class="ds-textGroup__skeletonWrapper">
37
+ <ds-skeleton width="50%" height="100%" />
38
+ </div>
39
+ <span v-else-if="eyebrowText === ''">&nbsp;</span>
40
+ <span v-else>{{ eyebrowText }}</span>
29
41
  </div>
30
- <span v-else-if="eyebrowText === ''">&nbsp;</span>
31
- <span v-else>{{ eyebrowText }}</span>
32
42
  </div>
33
43
  <div
34
44
  v-if="mainText !== null || $slots.mainText"
@@ -79,9 +89,10 @@
79
89
  @import '../../../styles/settings/typography/tokens';
80
90
  @import '../../../styles/settings/colors/tokens';
81
91
  @import '../../../styles/settings/spacings';
92
+ @import '../../../styles/mixins/background-mask';
82
93
 
83
94
  $text-group-colors: (
84
- 'neutral': (
95
+ 'default': (
85
96
  'eyebrow-color': $color-neutral-text-weak,
86
97
  'eyebrow-color-hovered': $color-neutral-text-weak-hovered,
87
98
  'eyebrow-color-disabled': $color-neutral-text-weak-disabled,
@@ -95,6 +106,20 @@ $text-group-colors: (
95
106
  'supporting-text-color-hovered': $color-neutral-text-hovered,
96
107
  'supporting-text-color-disabled': $color-neutral-text-disabled,
97
108
  ),
109
+ 'strong': (
110
+ 'eyebrow-color': $color-neutral-text,
111
+ 'eyebrow-color-hovered': $color-neutral-text-hovered,
112
+ 'eyebrow-color-disabled': $color-neutral-text-disabled,
113
+ 'main-text-color': $color-neutral-text-heavy,
114
+ 'main-text-color-hovered': $color-neutral-text-heavy-hovered,
115
+ 'main-text-color-disabled': $color-neutral-text-heavy-disabled,
116
+ 'main-text-color-selected': $color-primary-text,
117
+ 'main-text-color-selected-hovered': $color-primary-text-hovered,
118
+ 'main-text-color-selected-disabled': $color-primary-text-disabled,
119
+ 'supporting-text-color': $color-neutral-text,
120
+ 'supporting-text-color-hovered': $color-neutral-text-hovered,
121
+ 'supporting-text-color-disabled': $color-neutral-text-disabled,
122
+ ),
98
123
  );
99
124
 
100
125
  @mixin setTextGroupColors($self, $map) {
@@ -182,6 +207,36 @@ $text-group-colors: (
182
207
  &.-ds-uppercase {
183
208
  @include info-s-extensive-bold-uppercase;
184
209
  }
210
+
211
+ &.-ds-mask {
212
+ overflow: auto;
213
+ white-space: nowrap;
214
+
215
+ &::-webkit-scrollbar {
216
+ display: none;
217
+ }
218
+ }
219
+ }
220
+
221
+ &__eyebrowWrapper {
222
+ &.-ds-mask-active {
223
+ direction: rtl;
224
+ position: relative;
225
+
226
+ &:not(.-ds-mask-hidden)::before {
227
+ @include backgroundMask(white, -90deg);
228
+
229
+ bottom: 0;
230
+ content: '';
231
+ display: block;
232
+ left: 0;
233
+ position: absolute;
234
+ top: 0;
235
+ transform: translateX(v-bind(maskTranslateX));
236
+ transition: transform 0.1s linear;
237
+ width: v-bind(maskWidthPx);
238
+ }
239
+ }
185
240
  }
186
241
 
187
242
  &__main {
@@ -264,113 +319,125 @@ $text-group-colors: (
264
319
  }
265
320
  </style>
266
321
 
267
- <script lang="ts">
268
- import { defineComponent, PropType } from 'vue';
322
+ <script setup lang="ts">
323
+ import { computed, nextTick, onMounted, onUnmounted, ref, useTemplateRef, watch } from 'vue';
324
+ import { throttle } from 'lodash';
325
+ import { useElementSize } from '@vueuse/core';
269
326
  import DsSkeleton from '../Skeleton/Skeleton.vue';
270
327
  import {
271
- TEXT_GROUP_COLORS,
272
328
  TEXT_GROUP_LOADING_SIZES,
273
329
  TEXT_GROUP_SIZES,
274
330
  TEXT_GROUP_STATES,
275
- TextGroupColor,
331
+ TextGroupProminence,
276
332
  TextGroupLoadingSize,
277
333
  TextGroupSize,
278
334
  TextGroupState,
335
+ TEXT_GROUP_PROMINENCE,
279
336
  } from './TextGroup.consts';
280
337
  import DsTooltip from '../Tooltip';
281
338
 
282
- export default defineComponent({
283
- name: 'TextGroup',
284
- components: {
285
- DsSkeleton,
286
- DsTooltip,
287
- },
288
- props: {
289
- size: {
290
- type: String as PropType<TextGroupSize>,
291
- default: TEXT_GROUP_SIZES.MEDIUM,
292
- },
293
- color: {
294
- type: String as PropType<TextGroupColor>,
295
- default: TEXT_GROUP_COLORS.NEUTRAL,
296
- },
297
- eyebrowText: {
298
- type: String as PropType<string | null>,
299
- default: null,
300
- },
301
- eyebrowTextEllipsis: {
302
- type: Boolean,
303
- default: false,
304
- },
305
- isEyebrowTextUppercase: {
306
- type: Boolean,
307
- default: true,
308
- },
309
- mainText: {
310
- type: String as PropType<string | null>,
311
- default: null,
312
- },
313
- mainTextEllipsis: {
314
- type: Boolean,
315
- default: false,
316
- },
317
- supportingText: {
318
- type: String as PropType<string | null>,
319
- default: null,
320
- },
321
- supportingTextEllipsis: {
322
- type: Boolean,
323
- default: false,
324
- },
325
- isInteractive: {
326
- type: Boolean,
327
- default: true,
328
- },
329
- skeletonLoadingSize: {
330
- type: String as PropType<TextGroupLoadingSize>,
331
- default: TEXT_GROUP_LOADING_SIZES.LARGE,
332
- },
333
- isSelected: {
334
- type: Boolean,
335
- default: false,
336
- },
337
- state: {
338
- type: String as PropType<TextGroupState>,
339
- default: TEXT_GROUP_STATES.DEFAULT,
340
- },
341
- isSupportingTextTooltipEnabled: {
342
- type: Boolean,
343
- default: false,
344
- },
345
- isSupportingTextTooltipEnabledOnMobile: {
346
- type: Boolean,
347
- default: true,
348
- },
349
- isSupportingTextTooltipAutoFilledWithContent: {
350
- type: Boolean,
351
- default: true,
352
- },
353
- supportingTextTooltipContent: {
354
- type: String,
355
- default: null,
356
- },
357
- },
358
- data() {
359
- return {
360
- TEXT_GROUP_SIZES: Object.freeze(TEXT_GROUP_SIZES),
361
- TEXT_GROUP_STATES: Object.freeze(TEXT_GROUP_STATES),
362
- };
339
+ const {
340
+ size = TEXT_GROUP_SIZES.MEDIUM,
341
+ prominence = TEXT_GROUP_PROMINENCE.DEFAULT,
342
+ eyebrowText,
343
+ eyebrowTextEllipsis = false,
344
+ isEyebrowTextUppercase = true,
345
+ hasEyebrowMask = false,
346
+ mainText,
347
+ mainTextEllipsis = false,
348
+ supportingText,
349
+ supportingTextEllipsis = false,
350
+ isInteractive = true,
351
+ skeletonLoadingSize = TEXT_GROUP_LOADING_SIZES.LARGE,
352
+ isSelected = false,
353
+ state = TEXT_GROUP_STATES.DEFAULT,
354
+ isSupportingTextTooltipEnabled = false,
355
+ isSupportingTextTooltipEnabledOnMobile = true,
356
+ isSupportingTextTooltipAutoFilledWithContent = true,
357
+ supportingTextTooltipContent,
358
+ } = defineProps<{
359
+ size?: TextGroupSize;
360
+ prominence?: TextGroupProminence;
361
+ eyebrowText?: string | null;
362
+ eyebrowTextEllipsis?: boolean;
363
+ isEyebrowTextUppercase?: boolean;
364
+ hasEyebrowMask?: boolean;
365
+ mainText?: string | null;
366
+ mainTextEllipsis?: boolean;
367
+ supportingText?: string | null;
368
+ supportingTextEllipsis?: boolean;
369
+ isInteractive?: boolean;
370
+ skeletonLoadingSize?: TextGroupLoadingSize;
371
+ isSelected?: boolean;
372
+ state?: TextGroupState;
373
+ isSupportingTextTooltipEnabled?: boolean;
374
+ isSupportingTextTooltipEnabledOnMobile?: boolean;
375
+ isSupportingTextTooltipAutoFilledWithContent?: boolean;
376
+ supportingTextTooltipContent?: string;
377
+ }>();
378
+
379
+ const prominenceClassName = computed(() => `-ds-${prominence}`);
380
+ const isLoading = computed(() => state === TEXT_GROUP_STATES.LOADING);
381
+ const loadingSizeClassName = computed(() => `-ds-loading-${skeletonLoadingSize}`);
382
+
383
+ const eyebrowRef = useTemplateRef('eyebrowRef');
384
+ const isEyebrowMaskActive = ref(false);
385
+ const isEyebrowMaskHidden = ref(false);
386
+ const maskTranslateX = ref('0px');
387
+
388
+ const maskWidth = 20;
389
+ const maskWidthPx = `${maskWidth}px`;
390
+
391
+ const { width: eyebrowWidth } = useElementSize(eyebrowRef);
392
+
393
+ const throttledCheckEyebrowMask = throttle(() => {
394
+ if (eyebrowRef.value) {
395
+ const pixelsToBeginning =
396
+ eyebrowRef.value.scrollLeft -
397
+ (eyebrowRef.value.clientWidth - eyebrowRef.value.scrollWidth);
398
+
399
+ // Hide the mask when scrolled to the start (1px tolerance for sub-pixel rendering)
400
+ isEyebrowMaskHidden.value = pixelsToBeginning < 1;
401
+
402
+ // Move the mask when close to the beginning
403
+ maskTranslateX.value = `${pixelsToBeginning > maskWidth ? 0 : -Math.floor(maskWidth - pixelsToBeginning)}px`;
404
+ }
405
+ }, 50);
406
+
407
+ onMounted(() => {
408
+ eyebrowRef.value?.addEventListener('scroll', throttledCheckEyebrowMask);
409
+ });
410
+
411
+ onUnmounted(() => {
412
+ eyebrowRef.value?.removeEventListener('scroll', throttledCheckEyebrowMask);
413
+ });
414
+
415
+ watch(
416
+ () => ({
417
+ hasEyebrowMask,
418
+ eyebrowText,
419
+ isEyebrowTextUppercase,
420
+ eyebrowTextEllipsis,
421
+ state,
422
+ eyebrowWidth: eyebrowWidth.value,
423
+ }),
424
+ async () => {
425
+ await nextTick();
426
+
427
+ if (hasEyebrowMask && eyebrowRef.value && !eyebrowTextEllipsis) {
428
+ const eyebrowElement = eyebrowRef.value as HTMLElement;
429
+
430
+ isEyebrowMaskActive.value = eyebrowElement.scrollWidth > eyebrowElement.clientWidth;
431
+
432
+ if (isEyebrowMaskActive.value) {
433
+ throttledCheckEyebrowMask();
434
+ }
435
+ } else {
436
+ isEyebrowMaskActive.value = false;
437
+ }
363
438
  },
364
- computed: {
365
- colorClassName(): string {
366
- return `-ds-${this.color}`;
367
- },
368
- isLoading(): boolean {
369
- return this.state === TEXT_GROUP_STATES.LOADING;
370
- },
371
- loadingSizeClassName(): string {
372
- return `-ds-loading-${this.skeletonLoadingSize}`;
373
- },
439
+ {
440
+ immediate: true,
374
441
  },
375
- });
442
+ );
376
443
  </script>
@@ -116,6 +116,7 @@ import { faListCheck } from '@fortawesome/pro-regular-svg-icons/faListCheck';
116
116
  import { faListOl } from '@fortawesome/pro-regular-svg-icons/faListOl';
117
117
  import { faLocationDot } from '@fortawesome/pro-regular-svg-icons/faLocationDot';
118
118
  import { faLockKeyhole } from '@fortawesome/pro-regular-svg-icons/faLockKeyhole';
119
+ import { faMap } from '@fortawesome/pro-regular-svg-icons/faMap';
119
120
  import { faMagnifyingGlass } from '@fortawesome/pro-regular-svg-icons/faMagnifyingGlass';
120
121
  import { faMedal } from '@fortawesome/pro-regular-svg-icons/faMedal';
121
122
  import { faMemo } from '@fortawesome/pro-regular-svg-icons/faMemo';
@@ -209,6 +210,7 @@ import { faMessageQuestion } from '@fortawesome/pro-regular-svg-icons/faMessageQ
209
210
  import { faMessageXmark } from '@fortawesome/pro-regular-svg-icons/faMessageXmark';
210
211
  import { faMessage } from '@fortawesome/pro-regular-svg-icons/faMessage';
211
212
  import { faSitemap as fasSitemap } from '@fortawesome/pro-solid-svg-icons/faSitemap';
213
+ import { faMemo as fasMemo } from '@fortawesome/pro-solid-svg-icons/faMemo';
212
214
  import { faSquareCheck as fasSquareCheck } from '@fortawesome/pro-solid-svg-icons/faSquareCheck';
213
215
  import { faSquareList as fasSquareList } from '@fortawesome/pro-solid-svg-icons/faSquareList';
214
216
  import { faStar as fasStar } from '@fortawesome/pro-solid-svg-icons/faStar';
@@ -408,8 +410,10 @@ export const FONTAWESOME_ICONS = {
408
410
  FA_LIST: faList,
409
411
  FA_LOCATION_DOT: faLocationDot,
410
412
  FA_LOCK_KEYHOLE: faLockKeyhole,
413
+ FA_MAP: faMap,
411
414
  FA_MAGNIFYING_GLASS: faMagnifyingGlass,
412
415
  FA_MEDAL: faMedal,
416
+ FA_MEMO_SOLID: fasMemo,
413
417
  FA_MEMO: faMemo,
414
418
  FA_MEMO_CIRCLE_INFO_SOLID: fasMemoCircleInfo,
415
419
  FA_MEMO_CIRCLE_INFO: faMemoCircleInfo,
@@ -1,3 +1,3 @@
1
- @mixin backgroundMask($color) {
2
- background: linear-gradient(90deg, transparent 0%, $color 84.26%);
1
+ @mixin backgroundMask($color, $direction: 90deg) {
2
+ background: linear-gradient($direction, transparent 0%, $color 84.26%);
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bethinkpl/design-system",
3
- "version": "31.0.2",
3
+ "version": "32.0.0",
4
4
  "description": "Bethink universe design-system",
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,6 +59,7 @@
59
59
  "@storybook/addon-viewport": "^8.3.4",
60
60
  "@storybook/vue3": "^8.3.4",
61
61
  "@storybook/vue3-vite": "^8.3.4",
62
+ "@types/lodash-es": "^4",
62
63
  "@types/node": "^17.0.9",
63
64
  "@typescript-eslint/eslint-plugin": "8.45.0",
64
65
  "@typescript-eslint/parser": "8.45.0",
@@ -108,6 +109,8 @@
108
109
  },
109
110
  "dependencies": {
110
111
  "@primevue/themes": "4.0.0-rc.3",
112
+ "@vueuse/core": "14.1.0",
113
+ "lodash-es": "4.17.22",
111
114
  "primevue": "4.0.0-rc.3",
112
115
  "reka-ui": "2.6.0",
113
116
  "vee-validate": "4.15.1",