design-system-next 1.2.21 → 1.2.23

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,19 +1,19 @@
1
1
  <template>
2
2
  <div :class="avatarClassses">
3
3
  <template v-if="!initial">
4
- <img v-if="!$slots.default" :src="src" :alt="alt" :class="avatarImageClassses" />
5
- <div v-else :class="avatarImageClassses">
4
+ <img v-if="!$slots.default && src" :src="src" :alt="alt" :class="avatarImageClassses" />
5
+ <div v-else :class="[avatarImageClassses, 'avatar__slot border-color-weak border border-solid']">
6
6
  <slot />
7
7
  </div>
8
8
  </template>
9
9
  <div v-else :class="initialClassses">
10
10
  {{ initial }}
11
11
  </div>
12
- <span v-if="badge" :class="avatarNotificationClassses">
12
+ <span v-if="notification" :class="avatarNotificationClassses">
13
13
  <spr-badge :text="badgeText" variant="danger" :size="getAvatarSize.notif" />
14
14
  </span>
15
- <span v-if="online" :class="onlineNotificationClassses">
16
- <spr-badge text="" variant="brand" :size="getAvatarSize.online" />
15
+ <span v-if="badge" :class="onlineNotificationClassses">
16
+ <spr-badge text="" :variant="status" :size="getAvatarSize.badge" />
17
17
  </span>
18
18
  </div>
19
19
  </template>
@@ -3,26 +3,29 @@ import type { AvatarPropTypes } from './avatar';
3
3
 
4
4
  import classNames from 'classnames';
5
5
  export const useAvatar = (props: AvatarPropTypes) => {
6
- const { size } = toRefs(props);
6
+ const { size, color } = toRefs(props);
7
7
  const avatarClassses = computed(() => {
8
- return classNames(' relative inline-block');
8
+ return classNames(' relative inline-block rounded-full', {
9
+ 'background-color-surface': color.value === 'primary',
10
+ 'background-color': color.value === 'secondary',
11
+ });
9
12
  });
10
13
 
11
14
  const avatarImageClassses = computed(() => {
12
- return classNames(' rounded-full object-cover ', {
13
- ' h-20 min-w-20': size.value === '2xl',
14
- ' h-14 min-w-14': size.value === 'xl',
15
- ' h-10 min-w-10': size.value === 'lg',
16
- ' h-9 min-w-9': size.value === 'md',
17
- ' h-6 min-w-6': size.value === 'sm',
18
- ' h-5 min-w-5': size.value === 'xs',
19
- ' h-4 min-w-4': size.value === '2xs',
15
+ return classNames('rounded-full object-cover flex items-center justify-center overflow-hidden', {
16
+ 'h-20 min-w-20': size.value === '2xl',
17
+ 'h-14 min-w-14': size.value === 'xl',
18
+ 'h-10 min-w-10': size.value === 'lg',
19
+ 'h-9 min-w-9': size.value === 'md',
20
+ 'h-6 min-w-6': size.value === 'sm',
21
+ 'h-5 min-w-5': size.value === 'xs',
22
+ 'h-4 min-w-4': size.value === '2xs',
20
23
  });
21
24
  });
22
25
 
23
26
  const initialClassses = computed(() => {
24
27
  return classNames(
25
- ' rounded-full background-color-surface border-color-weak border border-solid items-center flex justify-center heading-xs text-color-strong',
28
+ ' rounded-full border-color-weak border border-solid items-center flex justify-center heading-xs text-color-strong',
26
29
  {
27
30
  ' h-20 min-w-20': size.value === '2xl',
28
31
  ' h-14 min-w-14 body-lg-regular-medium': size.value === 'xl',
@@ -57,11 +60,11 @@ export const useAvatar = (props: AvatarPropTypes) => {
57
60
  });
58
61
 
59
62
  const getAvatarSize = computed(() => {
60
- if (['2xl'].includes(size.value)) return { notif: 'big', online: 'big' };
61
- if (['xl', 'lg'].includes(size.value)) return { notif: 'big', online: 'tiny' };
62
- if (['md', 'sm'].includes(size.value)) return { notif: 'small', online: 'tiny' };
63
+ if (['2xl'].includes(size.value)) return { notif: 'big', badge: 'big' };
64
+ if (['xl', 'lg'].includes(size.value)) return { notif: 'big', badge: 'tiny' };
65
+ if (['md', 'sm'].includes(size.value)) return { notif: 'small', badge: 'tiny' };
63
66
 
64
- return { notif: 'tiny', online: 'tiny' };
67
+ return { notif: 'tiny', badge: 'tiny' };
65
68
  });
66
69
 
67
70
  return {
@@ -13,8 +13,8 @@ interface Header {
13
13
  interface TableData {
14
14
  [key: string]: {
15
15
  title: string;
16
- subtext: string;
17
- image: string;
16
+ subtext?: string;
17
+ image?: string;
18
18
  };
19
19
  }
20
20
 
@@ -36,16 +36,21 @@
36
36
  <!-- for action Button -->
37
37
  <th
38
38
  v-if="action"
39
- class="'background-color-surface text-color-strong font-size-100 font-line-height-100 font-letter-spacing-normal uppercase', sticky top-0 z-10 border-none px-size-spacing-2xs py-size-spacing-3xs text-start font-medium"
40
- />
39
+ class="background-color-surface text-color-strong font-size-100 font-line-height-100 font-letter-spacing-normal sticky top-0 z-10 border-none px-size-spacing-2xs py-size-spacing-3xs text-start font-medium uppercase"
40
+ >
41
+ <slot
42
+ name="action-name"
43
+ class="background-color-surface text-color-strong font-size-100 font-line-height-100 font-letter-spacing-normal uppercase"
44
+ />
45
+ </th>
41
46
  </tr>
42
47
  </thead>
43
48
  <tbody v-if="sortedData.length > 0">
44
49
  <tr v-for="(item, keyIndex) in sortedData" :key="keyIndex" class="hover:background-color-hover min-h-[60px]">
45
50
  <td v-for="(column, headerKey) in headers" :key="headerKey" class="border-b px-6 py-3">
46
- <div class="flex flex-row items-center gap-2">
51
+ <div v-if="sortedData[keyIndex][column.field]" class="flex flex-row items-center gap-2">
47
52
  <spr-avatar
48
- v-if="column.hasAvatar"
53
+ v-if="column.hasAvatar && sortedData[keyIndex][column.field].image"
49
54
  size="lg"
50
55
  :src="sortedData[keyIndex][column.field].image"
51
56
  alt="User Avatar"
@@ -23,7 +23,7 @@ export const tooltipPropTypes = {
23
23
  */
24
24
  text: {
25
25
  type: String,
26
- default: 'Sample tooltip',
26
+ default: '',
27
27
  },
28
28
  /**
29
29
  * @description Tooltip Placement
@@ -33,6 +33,10 @@ export const tooltipPropTypes = {
33
33
  validator: (value: (typeof PLACEMENTS)[number]) => PLACEMENTS.includes(value),
34
34
  default: 'top',
35
35
  },
36
+ hasMaxWidth: {
37
+ type: Boolean,
38
+ default: true,
39
+ },
36
40
  };
37
41
 
38
42
  export type TooltipPropTypes = ExtractPropTypes<typeof tooltipPropTypes>;
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <Tooltip class="w-fit" aria-id="tooltip-wrapper" :placement="placement">
2
+ <Tooltip
3
+ class="w-fit"
4
+ :aria-id="props.hasMaxWidth ? 'tooltip-full-width-wrapper' : 'tooltip-wrapper'"
5
+ :placement="placement"
6
+ >
3
7
  <template #popper>
4
8
  <p>{{ text }}</p>
5
9