@teambit/compositions.ui.composition-compare 0.0.254 → 0.0.256
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.
- package/.bit-capsule-ready +0 -0
- package/composition-compare.context.tsx +6 -6
- package/composition-compare.tsx +55 -26
- package/composition-dropdown.module.scss +3 -3
- package/composition-dropdown.tsx +9 -1
- package/dist/composition-compare.context.d.ts +2 -2
- package/dist/composition-compare.context.js.map +1 -1
- package/dist/composition-compare.d.ts +2 -2
- package/dist/composition-compare.js +33 -9
- package/dist/composition-compare.js.map +1 -1
- package/dist/composition-dropdown.d.ts +4 -4
- package/dist/composition-dropdown.js +6 -0
- package/dist/composition-dropdown.js.map +1 -1
- package/dist/composition-dropdown.module.scss +3 -3
- package/dist/tsconfig.json +5 -1
- package/index.ts +1 -1
- package/package.json +14 -13
- package/schema.json +533 -0
- package/static/css/teambit.compositions/ui/composition-compare.2782ee66.css +1 -0
- package/teambit_compositions_ui_composition_compare-component.js +822 -0
- package/teambit_compositions_ui_composition_compare-preview.js +1 -0
- package/dist/preview-1695807370382.js +0 -7
- package/tsconfig.json +0 -32
- package/types/asset.d.ts +0 -29
- package/types/style.d.ts +0 -42
|
File without changes
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useContext, createContext } from "react";
|
|
2
|
+
import { CompositionContentProps } from "@teambit/compositions";
|
|
3
3
|
|
|
4
4
|
export type CompositionCompareContextModel = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
compositionProps?: CompositionContentProps;
|
|
6
|
+
isBase?: boolean;
|
|
7
|
+
isCompare?: boolean;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const CompositionCompareContext: React.Context<CompositionCompareContextModel | undefined> = createContext<
|
|
11
|
-
|
|
11
|
+
CompositionCompareContextModel | undefined
|
|
12
12
|
>(undefined);
|
|
13
13
|
|
|
14
14
|
export const useCompositionCompare = () => useContext(CompositionCompareContext);
|
package/composition-compare.tsx
CHANGED
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
useCompareQueryParam,
|
|
7
7
|
useUpdatedUrlFromQuery,
|
|
8
8
|
} from '@teambit/component.ui.component-compare.hooks.use-component-compare-url';
|
|
9
|
-
import { uniqBy } from 'lodash';
|
|
10
9
|
import { CompareSplitLayoutPreset } from '@teambit/component.ui.component-compare.layouts.compare-split-layout-preset';
|
|
11
10
|
import { RoundLoader } from '@teambit/design.ui.round-loader';
|
|
12
11
|
import queryString from 'query-string';
|
|
13
12
|
import { CompositionDropdown } from './composition-dropdown';
|
|
14
13
|
import { CompositionCompareContext } from './composition-compare.context';
|
|
14
|
+
import { uniqBy } from 'lodash';
|
|
15
15
|
|
|
16
16
|
import styles from './composition-compare.module.scss';
|
|
17
17
|
|
|
@@ -64,24 +64,48 @@ export function CompositionCompare(props: CompositionCompareProps) {
|
|
|
64
64
|
})) ||
|
|
65
65
|
(compareCompositions && compareCompositions[0]);
|
|
66
66
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
67
|
+
// const baseCompositionDropdownSource =
|
|
68
|
+
// baseCompositions?.map((c) => {
|
|
69
|
+
// const href = !baseState?.controlled
|
|
70
|
+
// ? useUpdatedUrlFromQuery({
|
|
71
|
+
// compositionBaseFile: c.identifier,
|
|
72
|
+
// compositionCompareFile: selectedCompareComp?.identifier,
|
|
73
|
+
// })
|
|
74
|
+
// : useUpdatedUrlFromQuery({});
|
|
75
|
+
|
|
76
|
+
// const onClick = baseState?.controlled ? baseHooks?.onClick : undefined;
|
|
77
|
+
|
|
78
|
+
// return { id: c.identifier, label: c.displayName, href, onClick };
|
|
79
|
+
// }) || [];
|
|
80
|
+
|
|
81
|
+
// const compareCompositionDropdownSource =
|
|
82
|
+
// compareCompositions?.map((c) => {
|
|
83
|
+
// const href = !compareState?.controlled
|
|
84
|
+
// ? useUpdatedUrlFromQuery({
|
|
85
|
+
// compositionBaseFile: selectedBaseComp?.identifier,
|
|
86
|
+
// compositionCompareFile: c.identifier,
|
|
87
|
+
// })
|
|
88
|
+
// : useUpdatedUrlFromQuery({});
|
|
89
|
+
|
|
90
|
+
// const onClick = compareState?.controlled ? () => compareHooks?.onClick : undefined;
|
|
91
|
+
|
|
92
|
+
// return { id: c.identifier, label: c.displayName, href, onClick };
|
|
93
|
+
// }) || [];
|
|
94
|
+
|
|
95
|
+
const compositionsDropdownSource = uniqBy((baseCompositions || []).concat(compareCompositions || []), 'identifier')?.map((c) => {
|
|
96
|
+
const href = !compareState?.controlled
|
|
97
|
+
? useUpdatedUrlFromQuery({
|
|
98
|
+
compositionBaseFile: selectedBaseComp?.identifier,
|
|
99
|
+
compositionCompareFile: c.identifier,
|
|
100
|
+
})
|
|
101
|
+
: useUpdatedUrlFromQuery({});
|
|
102
|
+
|
|
103
|
+
const onClick = compareState?.controlled ? (_, __) => {
|
|
104
|
+
compareHooks?.onClick?.(_, __);
|
|
105
|
+
baseHooks?.onClick?.(_, __);
|
|
106
|
+
} : undefined;
|
|
107
|
+
return { id: c.identifier, label: c.displayName, href, onClick };
|
|
108
|
+
});
|
|
85
109
|
|
|
86
110
|
const [baseCompositionParams, setBaseCompositionParams] = useState<Record<string, any>>({});
|
|
87
111
|
const baseCompQueryParams = useMemo(() => queryString.stringify(baseCompositionParams), [baseCompositionParams]);
|
|
@@ -92,6 +116,11 @@ export function CompositionCompare(props: CompositionCompareProps) {
|
|
|
92
116
|
[compareCompositionParams]
|
|
93
117
|
);
|
|
94
118
|
|
|
119
|
+
const selectedBaseDropdown = selectedBaseComp && {
|
|
120
|
+
id: selectedBaseComp.identifier,
|
|
121
|
+
label: selectedBaseComp.displayName,
|
|
122
|
+
};
|
|
123
|
+
|
|
95
124
|
const selectedCompareDropdown = selectedCompareComp && {
|
|
96
125
|
id: selectedCompareComp.identifier,
|
|
97
126
|
label: selectedCompareComp.displayName,
|
|
@@ -110,7 +139,7 @@ export function CompositionCompare(props: CompositionCompareProps) {
|
|
|
110
139
|
component: baseCompModel,
|
|
111
140
|
queryParams: baseCompQueryParams,
|
|
112
141
|
selected: selectedCompareComp,
|
|
113
|
-
}
|
|
142
|
+
}
|
|
114
143
|
return (
|
|
115
144
|
<div className={styles.subView}>
|
|
116
145
|
<CompositionCompareContext.Provider value={{ compositionProps, isBase: true }}>
|
|
@@ -143,14 +172,11 @@ export function CompositionCompare(props: CompositionCompareProps) {
|
|
|
143
172
|
component: compareCompModel,
|
|
144
173
|
queryParams: compareCompQueryParams,
|
|
145
174
|
selected: selectedCompareComp,
|
|
146
|
-
}
|
|
175
|
+
}
|
|
147
176
|
return (
|
|
148
177
|
<div className={styles.subView}>
|
|
149
178
|
<CompositionCompareContext.Provider value={{ compositionProps, isCompare: true }}>
|
|
150
|
-
<CompositionContextProvider
|
|
151
|
-
queryParams={compareCompositionParams}
|
|
152
|
-
setQueryParams={setCompareCompositionParams}
|
|
153
|
-
>
|
|
179
|
+
<CompositionContextProvider queryParams={compareCompositionParams} setQueryParams={setCompareCompositionParams}>
|
|
154
180
|
<PreviewView
|
|
155
181
|
forceHeight={undefined}
|
|
156
182
|
innerBottomPadding={50}
|
|
@@ -162,6 +188,7 @@ export function CompositionCompare(props: CompositionCompareProps) {
|
|
|
162
188
|
/>
|
|
163
189
|
</CompositionContextProvider>
|
|
164
190
|
</CompositionCompareContext.Provider>
|
|
191
|
+
|
|
165
192
|
</div>
|
|
166
193
|
);
|
|
167
194
|
}, [compare, selectedCompareComp?.identifier]);
|
|
@@ -198,7 +225,9 @@ export function CompositionCompare(props: CompositionCompareProps) {
|
|
|
198
225
|
</div>
|
|
199
226
|
)}
|
|
200
227
|
<CompositionToolbar />
|
|
201
|
-
<CompareSplitLayoutPreset base={BaseLayout} compare={CompareLayout}
|
|
228
|
+
<CompareSplitLayoutPreset base={BaseLayout} compare={CompareLayout}
|
|
229
|
+
/>
|
|
202
230
|
</React.Fragment>
|
|
203
231
|
);
|
|
204
232
|
}
|
|
233
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import '
|
|
1
|
+
@import '~@teambit/ui-foundation.ui.constants.z-indexes/z-indexes.module.scss';
|
|
2
2
|
|
|
3
3
|
.placeholder {
|
|
4
4
|
display: flex;
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
border-radius: 6px;
|
|
20
20
|
max-height: 240px;
|
|
21
21
|
overflow-y: scroll;
|
|
22
|
-
max-width:
|
|
23
|
-
width:
|
|
22
|
+
max-width: 400px;
|
|
23
|
+
width: fit-content;
|
|
24
24
|
padding: 0px;
|
|
25
25
|
z-index: $modal-z-index;
|
|
26
26
|
}
|
package/composition-dropdown.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
1
|
+
import React, { useEffect, 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';
|
|
@@ -41,12 +41,20 @@ type MenuItemProps = {
|
|
|
41
41
|
function MenuItem(props: MenuItemProps) {
|
|
42
42
|
const { selected, current } = props;
|
|
43
43
|
|
|
44
|
+
// const isCurrent = selected?.id === current.id;
|
|
44
45
|
const currentVersionRef = useRef<HTMLDivElement>(null);
|
|
45
46
|
|
|
47
|
+
// useEffect(() => {
|
|
48
|
+
// if (isCurrent) {
|
|
49
|
+
// currentVersionRef.current?.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
|
50
|
+
// }
|
|
51
|
+
// }, [isCurrent]);
|
|
52
|
+
|
|
46
53
|
const onClick = (!!current.onClick && ((e) => current.onClick?.(current.id, e))) || undefined;
|
|
47
54
|
|
|
48
55
|
return (
|
|
49
56
|
<div ref={currentVersionRef} key={`${current.href}-container`}>
|
|
57
|
+
{/* @ts-ignore */}
|
|
50
58
|
<MenuLinkItem key={current.href} active={current.id === selected?.id} href={current.href} onClick={onClick}>
|
|
51
59
|
<div>{current.label}</div>
|
|
52
60
|
</MenuLinkItem>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CompositionContentProps } from
|
|
3
|
-
export
|
|
2
|
+
import { CompositionContentProps } from "@teambit/compositions";
|
|
3
|
+
export type CompositionCompareContextModel = {
|
|
4
4
|
compositionProps?: CompositionContentProps;
|
|
5
5
|
isBase?: boolean;
|
|
6
6
|
isCompare?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition-compare.context.js","sourceRoot":"","sources":["../composition-compare.context.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"composition-compare.context.js","sourceRoot":"","sources":["../composition-compare.context.tsx"],"names":[],"mappings":";;;AAAA,iCAAkD;AASrC,QAAA,yBAAyB,GAA8D,IAAA,qBAAa,EAE/G,SAAS,CAAC,CAAC;AAEN,MAAM,qBAAqB,GAAG,GAAG,EAAE,CAAC,IAAA,kBAAU,EAAC,iCAAyB,CAAC,CAAC;AAApE,QAAA,qBAAqB,yBAA+C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CompositionContentProps, EmptyStateSlot } from '@teambit/compositions';
|
|
3
|
-
export
|
|
3
|
+
export type CompositionCompareProps = {
|
|
4
4
|
emptyState?: EmptyStateSlot;
|
|
5
5
|
Widgets?: {
|
|
6
6
|
Right?: React.ReactNode;
|
|
@@ -9,4 +9,4 @@ export declare type CompositionCompareProps = {
|
|
|
9
9
|
previewViewProps?: CompositionContentProps;
|
|
10
10
|
PreviewView?: React.ComponentType<CompositionContentProps>;
|
|
11
11
|
};
|
|
12
|
-
export declare function CompositionCompare(props: CompositionCompareProps): JSX.Element;
|
|
12
|
+
export declare function CompositionCompare(props: CompositionCompareProps): React.JSX.Element;
|
|
@@ -32,12 +32,12 @@ const component_ui_component_compare_context_1 = require("@teambit/component.ui.
|
|
|
32
32
|
const compositions_1 = require("@teambit/compositions");
|
|
33
33
|
const compositions_ui_hooks_use_composition_1 = require("@teambit/compositions.ui.hooks.use-composition");
|
|
34
34
|
const component_ui_component_compare_hooks_use_component_compare_url_1 = require("@teambit/component.ui.component-compare.hooks.use-component-compare-url");
|
|
35
|
-
const lodash_1 = require("lodash");
|
|
36
35
|
const component_ui_component_compare_layouts_compare_split_layout_preset_1 = require("@teambit/component.ui.component-compare.layouts.compare-split-layout-preset");
|
|
37
36
|
const design_ui_round_loader_1 = require("@teambit/design.ui.round-loader");
|
|
38
37
|
const query_string_1 = __importDefault(require("query-string"));
|
|
39
38
|
const composition_dropdown_1 = require("./composition-dropdown");
|
|
40
39
|
const composition_compare_context_1 = require("./composition-compare.context");
|
|
40
|
+
const lodash_1 = require("lodash");
|
|
41
41
|
const composition_compare_module_scss_1 = __importDefault(require("./composition-compare.module.scss"));
|
|
42
42
|
function CompositionCompare(props) {
|
|
43
43
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -68,26 +68,50 @@ function CompositionCompare(props) {
|
|
|
68
68
|
return c.identifier === selectedCompositionCompareId;
|
|
69
69
|
})) ||
|
|
70
70
|
(compareCompositions && compareCompositions[0]);
|
|
71
|
-
const
|
|
71
|
+
// const baseCompositionDropdownSource =
|
|
72
|
+
// baseCompositions?.map((c) => {
|
|
73
|
+
// const href = !baseState?.controlled
|
|
74
|
+
// ? useUpdatedUrlFromQuery({
|
|
75
|
+
// compositionBaseFile: c.identifier,
|
|
76
|
+
// compositionCompareFile: selectedCompareComp?.identifier,
|
|
77
|
+
// })
|
|
78
|
+
// : useUpdatedUrlFromQuery({});
|
|
79
|
+
// const onClick = baseState?.controlled ? baseHooks?.onClick : undefined;
|
|
80
|
+
// return { id: c.identifier, label: c.displayName, href, onClick };
|
|
81
|
+
// }) || [];
|
|
82
|
+
// const compareCompositionDropdownSource =
|
|
83
|
+
// compareCompositions?.map((c) => {
|
|
84
|
+
// const href = !compareState?.controlled
|
|
85
|
+
// ? useUpdatedUrlFromQuery({
|
|
86
|
+
// compositionBaseFile: selectedBaseComp?.identifier,
|
|
87
|
+
// compositionCompareFile: c.identifier,
|
|
88
|
+
// })
|
|
89
|
+
// : useUpdatedUrlFromQuery({});
|
|
90
|
+
// const onClick = compareState?.controlled ? () => compareHooks?.onClick : undefined;
|
|
91
|
+
// return { id: c.identifier, label: c.displayName, href, onClick };
|
|
92
|
+
// }) || [];
|
|
93
|
+
const compositionsDropdownSource = (_e = (0, lodash_1.uniqBy)((baseCompositions || []).concat(compareCompositions || []), 'identifier')) === null || _e === void 0 ? void 0 : _e.map((c) => {
|
|
72
94
|
const href = !(compareState === null || compareState === void 0 ? void 0 : compareState.controlled)
|
|
73
95
|
? (0, component_ui_component_compare_hooks_use_component_compare_url_1.useUpdatedUrlFromQuery)({
|
|
74
96
|
compositionBaseFile: selectedBaseComp === null || selectedBaseComp === void 0 ? void 0 : selectedBaseComp.identifier,
|
|
75
97
|
compositionCompareFile: c.identifier,
|
|
76
98
|
})
|
|
77
99
|
: (0, component_ui_component_compare_hooks_use_component_compare_url_1.useUpdatedUrlFromQuery)({});
|
|
78
|
-
const onClick = (compareState === null || compareState === void 0 ? void 0 : compareState.controlled)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
: undefined;
|
|
100
|
+
const onClick = (compareState === null || compareState === void 0 ? void 0 : compareState.controlled) ? (_, __) => {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
(_a = compareHooks === null || compareHooks === void 0 ? void 0 : compareHooks.onClick) === null || _a === void 0 ? void 0 : _a.call(compareHooks, _, __);
|
|
103
|
+
(_b = baseHooks === null || baseHooks === void 0 ? void 0 : baseHooks.onClick) === null || _b === void 0 ? void 0 : _b.call(baseHooks, _, __);
|
|
104
|
+
} : undefined;
|
|
85
105
|
return { id: c.identifier, label: c.displayName, href, onClick };
|
|
86
106
|
});
|
|
87
107
|
const [baseCompositionParams, setBaseCompositionParams] = (0, react_1.useState)({});
|
|
88
108
|
const baseCompQueryParams = (0, react_1.useMemo)(() => query_string_1.default.stringify(baseCompositionParams), [baseCompositionParams]);
|
|
89
109
|
const [compareCompositionParams, setCompareCompositionParams] = (0, react_1.useState)({});
|
|
90
110
|
const compareCompQueryParams = (0, react_1.useMemo)(() => query_string_1.default.stringify(compareCompositionParams), [compareCompositionParams]);
|
|
111
|
+
const selectedBaseDropdown = selectedBaseComp && {
|
|
112
|
+
id: selectedBaseComp.identifier,
|
|
113
|
+
label: selectedBaseComp.displayName,
|
|
114
|
+
};
|
|
91
115
|
const selectedCompareDropdown = selectedCompareComp && {
|
|
92
116
|
id: selectedCompareComp.identifier,
|
|
93
117
|
label: selectedCompareComp.displayName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition-compare.js","sourceRoot":"","sources":["../composition-compare.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiD;AACjD,4GAAsF;AACtF,wDAAoG;AACpG,0GAA4F;AAC5F,4JAGiF;AACjF,
|
|
1
|
+
{"version":3,"file":"composition-compare.js","sourceRoot":"","sources":["../composition-compare.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiD;AACjD,4GAAsF;AACtF,wDAAoG;AACpG,0GAA4F;AAC5F,4JAGiF;AACjF,oKAAuH;AACvH,4EAA8D;AAC9D,gEAAuC;AACvC,iEAA6D;AAC7D,+EAA0E;AAC1E,mCAAgC;AAEhC,wGAAuD;AAYvD,SAAgB,kBAAkB,CAAC,KAA8B;;IAC/D,MAAM,EAAE,UAAU,EAAE,WAAW,GAAG,iCAAkB,EAAE,O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C1B,uCAAK,SAAS,EAAE,yCAAM,CAAC,OAAO,IAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAO,CAClD,CACF,CACP,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,GAAG,GAAG,GAAG,MAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAE,IAAI,0CAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,MAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAE,OAAO,0CAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAEjJ,OAAO,CACL,8BAAC,eAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,GAAG;QACrB,CAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAE,OAAO,KAAI,CACnC,uCAAK,SAAS,EAAE,yCAAM,CAAC,MAAM;YAC3B,8BAAC,oCAAW,OAAG,CACX,CACP;QACD,8BAAC,kBAAkB,OAAG;QACtB,8BAAC,6FAAwB,IAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,GAChE,CACa,CAClB,CAAC;AACJ,CAAC;AA5MD,gDA4MC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type DropdownItem = {
|
|
3
3
|
id: string;
|
|
4
4
|
label: string;
|
|
5
5
|
href?: string;
|
|
6
6
|
onClick?: (id: string, e: any) => void;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type CompositionDropdownProps = {
|
|
9
9
|
selected?: Omit<DropdownItem, 'value'>;
|
|
10
10
|
dropdownItems: Array<DropdownItem>;
|
|
11
11
|
};
|
|
12
|
-
export declare function CompositionDropdown(props: CompositionDropdownProps): JSX.Element;
|
|
12
|
+
export declare function CompositionDropdown(props: CompositionDropdownProps): React.JSX.Element;
|
|
@@ -44,7 +44,13 @@ function CompositionDropdown(props) {
|
|
|
44
44
|
exports.CompositionDropdown = CompositionDropdown;
|
|
45
45
|
function MenuItem(props) {
|
|
46
46
|
const { selected, current } = props;
|
|
47
|
+
// const isCurrent = selected?.id === current.id;
|
|
47
48
|
const currentVersionRef = (0, react_1.useRef)(null);
|
|
49
|
+
// useEffect(() => {
|
|
50
|
+
// if (isCurrent) {
|
|
51
|
+
// currentVersionRef.current?.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
|
52
|
+
// }
|
|
53
|
+
// }, [isCurrent]);
|
|
48
54
|
const onClick = (!!current.onClick && ((e) => { var _a; return (_a = current.onClick) === null || _a === void 0 ? void 0 : _a.call(current, current.id, e); })) || undefined;
|
|
49
55
|
return (react_1.default.createElement("div", { ref: currentVersionRef, key: `${current.href}-container` },
|
|
50
56
|
react_1.default.createElement(design_ui_surfaces_menu_link_item_1.MenuLinkItem, { key: current.href, active: current.id === (selected === null || selected === void 0 ? void 0 : selected.id), href: current.href, onClick: onClick },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition-dropdown.js","sourceRoot":"","sources":["../composition-dropdown.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"composition-dropdown.js","sourceRoot":"","sources":["../composition-dropdown.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiD;AACjD,kGAA0E;AAC1E,wEAAqD;AACrD,wFAAiE;AAEjE,0GAAwD;AASxD,SAAgB,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,GAAG,GAAG,CAAC,IAAkB,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IAE9D,OAAO,CACL,8BAAC,uCAAQ,IACP,SAAS,EAAE,0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,CAAO,CACb,CACX,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import '
|
|
1
|
+
@import '~@teambit/ui-foundation.ui.constants.z-indexes/z-indexes.module.scss';
|
|
2
2
|
|
|
3
3
|
.placeholder {
|
|
4
4
|
display: flex;
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
border-radius: 6px;
|
|
20
20
|
max-height: 240px;
|
|
21
21
|
overflow-y: scroll;
|
|
22
|
-
max-width:
|
|
23
|
-
width:
|
|
22
|
+
max-width: 400px;
|
|
23
|
+
width: fit-content;
|
|
24
24
|
padding: 0px;
|
|
25
25
|
z-index: $modal-z-index;
|
|
26
26
|
}
|
package/dist/tsconfig.json
CHANGED
package/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { CompositionCompare } from './composition-compare';
|
|
2
|
-
export { useCompositionCompare, CompositionCompareContext } from './composition-compare.context';
|
|
2
|
+
export { useCompositionCompare, CompositionCompareContext } from './composition-compare.context';
|
package/package.json
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/compositions.ui.composition-compare",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.256",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/compositions/ui/composition-compare",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.compositions",
|
|
8
8
|
"name": "ui/composition-compare",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.256"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
13
|
-
"query-string": "
|
|
13
|
+
"query-string": "^8.1.0",
|
|
14
14
|
"core-js": "^3.0.0",
|
|
15
|
-
"@teambit/
|
|
16
|
-
"@teambit/design.elements.icon": "1.0.5",
|
|
17
|
-
"@teambit/design.ui.surfaces.menu.link-item": "1.0.0",
|
|
18
|
-
"@teambit/evangelist.surfaces.dropdown": "1.0.2",
|
|
19
|
-
"@teambit/component.ui.component-compare.context": "0.0.115",
|
|
15
|
+
"@teambit/component.ui.component-compare.context": "0.0.0-0bad1419359e7da5e28eb6da50240eb2fdf21382",
|
|
20
16
|
"@teambit/component.ui.component-compare.hooks.use-component-compare-url": "0.0.8",
|
|
21
|
-
"@teambit/component.ui.component-compare.layouts.compare-split-layout-preset": "0.0.
|
|
17
|
+
"@teambit/component.ui.component-compare.layouts.compare-split-layout-preset": "0.0.0-945379716ff7f43a604017c9aec9e3eaceec787f",
|
|
22
18
|
"@teambit/compositions.ui.hooks.use-composition": "0.0.177",
|
|
23
|
-
"@teambit/
|
|
19
|
+
"@teambit/design.ui.round-loader": "0.0.355",
|
|
20
|
+
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.504",
|
|
21
|
+
"@teambit/design.elements.icon": "1.0.24",
|
|
22
|
+
"@teambit/design.ui.surfaces.menu.link-item": "0.0.0-4846750b7a7f0563664db58e2443b1a4239047e9",
|
|
23
|
+
"@teambit/evangelist.surfaces.dropdown": "1.0.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/react": "^17.0.8",
|
|
27
|
-
"@types/lodash": "4.14.
|
|
28
|
-
"@types/mocha": "9.1.0",
|
|
27
|
+
"@types/lodash": "4.14.181",
|
|
29
28
|
"@types/node": "12.20.4",
|
|
30
29
|
"@types/react-dom": "^17.0.5",
|
|
31
30
|
"@types/jest": "^26.0.0",
|
|
@@ -37,6 +36,8 @@
|
|
|
37
36
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
38
37
|
},
|
|
39
38
|
"license": "Apache-2.0",
|
|
39
|
+
"optionalDependencies": {},
|
|
40
|
+
"peerDependenciesMeta": {},
|
|
40
41
|
"private": false,
|
|
41
42
|
"engines": {
|
|
42
43
|
"node": ">=12.22.0"
|
|
@@ -55,4 +56,4 @@
|
|
|
55
56
|
"angular",
|
|
56
57
|
"angular-components"
|
|
57
58
|
]
|
|
58
|
-
}
|
|
59
|
+
}
|