@teambit/compositions.ui.composition-compare 0.0.259 → 0.0.260

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.
@@ -14,6 +14,34 @@
14
14
  background-color: var(--bit-bg-color, #ffffff);
15
15
  }
16
16
 
17
+ .placeholderText {
18
+ display: flex;
19
+ align-items: center;
20
+ gap: 6px;
21
+ min-width: 0;
22
+ }
23
+
24
+ .placeholderLabel {
25
+ overflow: hidden;
26
+ text-overflow: ellipsis;
27
+ white-space: nowrap;
28
+ }
29
+
30
+ .menuItem {
31
+ display: flex;
32
+ align-items: center;
33
+ gap: 6px;
34
+ }
35
+
36
+ .tag {
37
+ font-size: 11px;
38
+ line-height: 16px;
39
+ padding: 0 6px;
40
+ border-radius: 999px;
41
+ background: rgba(0, 0, 0, 0.08);
42
+ color: var(--on-background-color, #222222);
43
+ }
44
+
17
45
  .menu {
18
46
  font-size: var(--bit-p-xs);
19
47
  border-radius: 6px;
@@ -1,11 +1,17 @@
1
- import React, { useEffect, useRef } from 'react';
1
+ import React, { useRef } from 'react';
2
2
  import { MenuLinkItem } from '@teambit/design.ui.surfaces.menu.link-item';
3
3
  import { Icon } from '@teambit/design.elements.icon';
4
4
  import { Dropdown } from '@teambit/evangelist.surfaces.dropdown';
5
5
 
6
6
  import styles from './composition-dropdown.module.scss';
7
7
 
8
- export type DropdownItem = { id: string; label: string; href?: string; onClick?: (id: string, e) => void };
8
+ export type DropdownItem = {
9
+ id: string;
10
+ label: string;
11
+ href?: string;
12
+ onClick?: (id: string, e) => void;
13
+ tag?: string;
14
+ };
9
15
 
10
16
  export type CompositionDropdownProps = {
11
17
  selected?: Omit<DropdownItem, 'value'>;
@@ -21,7 +27,10 @@ export function CompositionDropdown(props: CompositionDropdownProps) {
21
27
  dropClass={styles.menu}
22
28
  placeholder={
23
29
  <div className={styles.placeholder}>
24
- <div>{selected && selected.label}</div>
30
+ <div className={styles.placeholderText}>
31
+ <span className={styles.placeholderLabel}>{selected && selected.label}</span>
32
+ {selected?.tag && <span className={styles.tag}>{selected.tag}</span>}
33
+ </div>
25
34
  <Icon of="fat-arrow-down" />
26
35
  </div>
27
36
  }
@@ -56,7 +65,10 @@ function MenuItem(props: MenuItemProps) {
56
65
  <div ref={currentVersionRef} key={`${current.href}-container`}>
57
66
  {/* @ts-ignore */}
58
67
  <MenuLinkItem key={current.href} active={current.id === selected?.id} href={current.href} onClick={onClick}>
59
- <div>{current.label}</div>
68
+ <div className={styles.menuItem}>
69
+ <span>{current.label}</span>
70
+ {current.tag && <span className={styles.tag}>{current.tag}</span>}
71
+ </div>
60
72
  </MenuLinkItem>
61
73
  </div>
62
74
  );
@@ -1,4 +1,4 @@
1
- import { CompositionContentProps } from "@teambit/compositions";
1
+ import { CompositionContentProps } from '@teambit/compositions';
2
2
  export type CompositionCompareContextModel = {
3
3
  compositionProps?: CompositionContentProps;
4
4
  isBase?: boolean;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CompositionContentProps, EmptyStateSlot } from '@teambit/compositions';
2
+ import { type CompositionContentProps, type EmptyStateSlot } from '@teambit/compositions';
3
3
  export type CompositionCompareProps = {
4
4
  emptyState?: EmptyStateSlot;
5
5
  Widgets?: {