@teambit/compositions 1.0.993 → 1.0.995

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.
@@ -12,6 +12,9 @@ import type { Composition } from '../../composition';
12
12
  export type CompositionsPanelProps = {
13
13
  compositions: Composition[];
14
14
  onSelectComposition: (composition: Composition) => void;
15
+ onToggleLiveControls?: () => void;
16
+ hasLiveControls?: boolean;
17
+ liveControlsActive?: boolean;
15
18
  active?: Composition;
16
19
  url: string;
17
20
  isScaling?: boolean;
@@ -24,6 +27,9 @@ export function CompositionsPanel({
24
27
  compositions,
25
28
  isScaling,
26
29
  onSelectComposition: onSelect,
30
+ onToggleLiveControls,
31
+ hasLiveControls,
32
+ liveControlsActive,
27
33
  active,
28
34
  includesEnvTemplate,
29
35
  useNameParam,
@@ -77,6 +83,29 @@ export function CompositionsPanel({
77
83
  <span className={styles.name}>{composition.displayName}</span>
78
84
  </a>
79
85
  <div className={styles.itemActions}>
86
+ {hasLiveControls && onToggleLiveControls && composition === active && (
87
+ <Tooltip
88
+ content={liveControlsActive ? 'Hide live controls' : 'Show live controls'}
89
+ placement="bottom"
90
+ >
91
+ <button
92
+ type="button"
93
+ aria-label={liveControlsActive ? 'Hide live controls' : 'Show live controls'}
94
+ className={classNames(
95
+ styles.actionIcon,
96
+ styles.iconButton,
97
+ liveControlsActive && styles.actionIconActive
98
+ )}
99
+ onClick={(e) => {
100
+ e.preventDefault();
101
+ e.stopPropagation();
102
+ onToggleLiveControls();
103
+ }}
104
+ >
105
+ <Icon of="settings" />
106
+ </button>
107
+ </Tooltip>
108
+ )}
80
109
  <MenuWidgetIcon
81
110
  className={styles.actionIcon}
82
111
  icon="Code"
@@ -53,13 +53,12 @@
53
53
  }
54
54
 
55
55
  .toggleControl {
56
- width: 42px;
57
- max-width: 42px;
58
- min-width: 42px;
59
- }
60
-
61
- .toggleControl > * {
62
- width: 100%;
56
+ // Let the Toggle keep its native dimensions. The component sizes its
57
+ // knob travel in `em`, so stretching the wrapper width without scaling
58
+ // the font-size leaves the knob short of the right edge in the "on"
59
+ // state.
60
+ display: inline-flex;
61
+ flex: 0 0 auto;
63
62
  }
64
63
 
65
64
  .rangeWrapper {