@teambit/component.ui.component-drawer 0.0.1

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.
@@ -0,0 +1,20 @@
1
+ import React, { createContext, ReactNode, useState } from 'react';
2
+
3
+ export type ComponentFilterWidgetContextType = {
4
+ filterWidgetOpen: boolean;
5
+ setFilterWidget: (open: boolean) => void;
6
+ };
7
+
8
+ export const ComponentFilterWidgetContext = createContext<ComponentFilterWidgetContextType>({
9
+ filterWidgetOpen: false,
10
+ setFilterWidget: () => {},
11
+ });
12
+
13
+ export const ComponentFilterWidgetProvider = ({ children }: { children: ReactNode }) => {
14
+ const [filterWidgetOpen, setFilterWidget] = useState<boolean>(false);
15
+ return (
16
+ <ComponentFilterWidgetContext.Provider value={{ filterWidgetOpen, setFilterWidget }}>
17
+ {children}
18
+ </ComponentFilterWidgetContext.Provider>
19
+ );
20
+ };
@@ -0,0 +1,16 @@
1
+ import React, { createContext, ReactNode, useState } from 'react';
2
+
3
+ export type ComponentTreeContextType = {
4
+ collapsed: boolean;
5
+ setCollapsed: (collapsed: boolean) => void;
6
+ };
7
+
8
+ export const ComponentTreeContext = createContext<ComponentTreeContextType>({
9
+ collapsed: true,
10
+ setCollapsed: () => {},
11
+ });
12
+
13
+ export const ComponentTreeProvider = ({ children }: { children: ReactNode }) => {
14
+ const [collapsed, setCollapsed] = useState<boolean>(true);
15
+ return <ComponentTreeContext.Provider value={{ collapsed, setCollapsed }}>{children}</ComponentTreeContext.Provider>;
16
+ };
@@ -0,0 +1,58 @@
1
+ .drawerContainer {
2
+ height: 100%;
3
+ }
4
+
5
+ .emptyDrawer {
6
+ padding: 8px 8px 0 28px;
7
+ display: block;
8
+ }
9
+
10
+ .widgetIcon {
11
+ padding: 4px;
12
+ border-radius: 8px;
13
+ align-items: center;
14
+ display: flex;
15
+ margin-left: 4px;
16
+
17
+ &:hover,
18
+ &.open {
19
+ background-color: var(--bit-border-color-lightest, #ededed);
20
+ }
21
+ img {
22
+ width: 16px;
23
+ }
24
+ &:active img,
25
+ &.open img {
26
+ filter: invert(38%) sepia(33%) saturate(7140%) hue-rotate(234deg) brightness(96%) contrast(87%);
27
+ }
28
+ }
29
+
30
+ .filterWidgetIcon {
31
+ margin-right: 8px;
32
+ }
33
+
34
+ .filtersContainer {
35
+ opacity: 0;
36
+ transition: max-height 300ms ease-in-out, opacity 300ms ease-in-out;
37
+ max-height: 0;
38
+ border-bottom: 1px solid #ededed;
39
+
40
+ &.open {
41
+ opacity: 1;
42
+ max-height: 100%;
43
+ }
44
+ }
45
+
46
+ .filter {
47
+ display: flex;
48
+ flex-direction: row;
49
+ font-size: 14px;
50
+ justify-content: space-between;
51
+ padding: 8px;
52
+ margin: 4px 8px;
53
+ }
54
+
55
+ .componentTree {
56
+ overflow-y: scroll;
57
+ height: 100%;
58
+ }
@@ -0,0 +1,165 @@
1
+ import React, { useCallback, useContext, ReactNode, useMemo } from 'react';
2
+ import classNames from 'classnames';
3
+ import { ComponentTree, PayloadType } from '@teambit/ui-foundation.ui.side-bar';
4
+ import { FullLoader } from '@teambit/ui-foundation.ui.full-loader';
5
+ import { ComponentTreeSlot } from '@teambit/component-tree';
6
+ import type { DrawerType } from '@teambit/ui-foundation.ui.tree.drawer';
7
+ import { mutedItalic } from '@teambit/design.ui.styles.muted-italic';
8
+ import { ellipsis } from '@teambit/design.ui.styles.ellipsis';
9
+ import { ComponentModel } from '@teambit/component';
10
+ import { TreeNodeRenderer } from '@teambit/design.ui.tree';
11
+ import { Composer, ComponentTuple } from '@teambit/base-ui.utils.composer';
12
+ import flatten from 'lodash.flatten';
13
+ import {
14
+ ComponentFiltersProvider,
15
+ ComponentFilterContext,
16
+ runAllFilters,
17
+ ComponentFilters,
18
+ } from '@teambit/component.ui.component-filters';
19
+ import { SlotRegistry } from '@teambit/harmony';
20
+ import { ComponentFilterWidgetProvider, ComponentFilterWidgetContext } from './component-drawer-filter-widget.context';
21
+ import { ComponentTreeContext, ComponentTreeProvider } from './component-drawer-tree-widget.context';
22
+
23
+ import styles from './component-drawer.module.scss';
24
+
25
+ export type ComponentFiltersSlot = SlotRegistry<ComponentFilters>;
26
+ export type DrawerWidgetSlot = SlotRegistry<ReactNode[]>;
27
+
28
+ export type ComponentsDrawerProps = Omit<DrawerType, 'render'> & {
29
+ useComponents: () => { components: ComponentModel[]; loading?: boolean };
30
+ emptyMessage?: ReactNode;
31
+ plugins?: ComponentsDrawerPlugins;
32
+ };
33
+
34
+ export type ComponentsDrawerPlugins = {
35
+ tree?: {
36
+ customRenderer?: (treeNodeSlot?: ComponentTreeSlot) => TreeNodeRenderer<PayloadType>;
37
+ widgets: ComponentTreeSlot;
38
+ };
39
+ filters?: ComponentFiltersSlot;
40
+ drawerWidgets?: DrawerWidgetSlot;
41
+ };
42
+
43
+ export class ComponentsDrawer implements DrawerType {
44
+ readonly id: string;
45
+ readonly useComponents: () => { components: ComponentModel[]; loading?: boolean };
46
+ name: ReactNode;
47
+ tooltip?: string;
48
+ order?: number;
49
+ isHidden?: () => boolean;
50
+ emptyMessage?: ReactNode;
51
+ widgets: ReactNode[];
52
+ plugins: ComponentsDrawerPlugins;
53
+
54
+ constructor(props: ComponentsDrawerProps) {
55
+ Object.assign(this, props);
56
+ this.useComponents = props.useComponents;
57
+ this.emptyMessage = props.emptyMessage;
58
+ this.plugins = props.plugins || {};
59
+ this.setWidgets(props.plugins?.drawerWidgets);
60
+ }
61
+
62
+ Context = ({ children }) => {
63
+ const filters = flatten(this.plugins?.filters?.values() || []);
64
+ const combinedContexts = [
65
+ ComponentTreeProvider,
66
+ ComponentFilterWidgetProvider,
67
+ [ComponentFiltersProvider, { filters }] as ComponentTuple<{ filters: any }>,
68
+ ];
69
+ return <Composer components={combinedContexts}>{children}</Composer>;
70
+ };
71
+
72
+ renderFilters = ({ components }: { components: ComponentModel[] }) => {
73
+ if (!this.plugins.filters) return null;
74
+ const filterPlugins = this.plugins.filters;
75
+ const { filterWidgetOpen } = useContext(ComponentFilterWidgetContext);
76
+
77
+ if (!filterPlugins) return null;
78
+
79
+ const filters = useMemo(
80
+ () =>
81
+ flatten(
82
+ filterPlugins.toArray().map(([key, filtersByKey]) => {
83
+ return filtersByKey.map((filter) => ({ ...filter, key: `${key}-${filter.id}` }));
84
+ })
85
+ ).sort((a, b) => (a.order ?? 0) - (b.order ?? 0)),
86
+ [filterPlugins]
87
+ );
88
+
89
+ return (
90
+ <div className={classNames(styles.filtersContainer, filterWidgetOpen && styles.open)}>
91
+ {filters.map((filter) => (
92
+ <filter.render key={filter.key} components={components} className={styles.filter} />
93
+ ))}
94
+ </div>
95
+ );
96
+ };
97
+
98
+ renderTree = ({ components }: { components: ComponentModel[] }) => {
99
+ const { collapsed } = useContext(ComponentTreeContext);
100
+ const { tree } = this.plugins;
101
+
102
+ const TreeNode = tree?.customRenderer && useCallback(tree.customRenderer(tree.widgets), [tree.widgets]);
103
+ const isVisible = components.length > 0;
104
+ if (!isVisible) return null;
105
+ return (
106
+ <ComponentTree
107
+ components={components}
108
+ isCollapsed={collapsed}
109
+ className={styles.componentTree}
110
+ TreeNode={TreeNode}
111
+ />
112
+ );
113
+ };
114
+
115
+ setWidgets = (widgets?: DrawerWidgetSlot) => {
116
+ this.widgets = flatten(widgets?.values());
117
+ };
118
+
119
+ render = () => {
120
+ const { loading, components } = this.useComponents();
121
+ const componentFiltersContext = useContext(ComponentFilterContext);
122
+
123
+ if (loading) return <FullLoader />;
124
+
125
+ const filters = componentFiltersContext?.filters || [];
126
+
127
+ const filteredComponents = useMemo(() => runAllFilters(filters, components), [filters]);
128
+
129
+ const Filters = this.renderFilters({ components });
130
+ const Tree = this.renderTree({ components: filteredComponents });
131
+
132
+ const emptyDrawer = (
133
+ <span className={classNames(mutedItalic, ellipsis, styles.emptyDrawer)}>{this.emptyMessage}</span>
134
+ );
135
+
136
+ return (
137
+ <div key={this.id} className={styles.drawerContainer}>
138
+ {Filters}
139
+ {Tree}
140
+ {Tree || emptyDrawer}
141
+ </div>
142
+ );
143
+ };
144
+ }
145
+
146
+ export function TreeToggleWidget() {
147
+ const { collapsed, setCollapsed } = useContext(ComponentTreeContext);
148
+ const icon = collapsed
149
+ ? 'https://static.bit.dev/bit-icons/expand.svg'
150
+ : 'https://static.bit.dev/bit-icons/collapse.svg';
151
+ return (
152
+ <div className={classNames(styles.widgetIcon, !collapsed && styles.open)}>
153
+ <img src={icon} onClick={() => setCollapsed(!collapsed)} />
154
+ </div>
155
+ );
156
+ }
157
+
158
+ export function FilterWidget() {
159
+ const { filterWidgetOpen, setFilterWidget } = useContext(ComponentFilterWidgetContext);
160
+ return (
161
+ <div className={classNames(styles.widgetIcon, styles.filterWidget, filterWidgetOpen && styles.open)}>
162
+ <img src="https://static.bit.dev/bit-icons/filter.svg" onClick={() => setFilterWidget(!filterWidgetOpen)} />
163
+ </div>
164
+ );
165
+ }
@@ -0,0 +1,9 @@
1
+ import React, { ReactNode } from 'react';
2
+ export declare type ComponentFilterWidgetContextType = {
3
+ filterWidgetOpen: boolean;
4
+ setFilterWidget: (open: boolean) => void;
5
+ };
6
+ export declare const ComponentFilterWidgetContext: React.Context<ComponentFilterWidgetContextType>;
7
+ export declare const ComponentFilterWidgetProvider: ({ children }: {
8
+ children: ReactNode;
9
+ }) => JSX.Element;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.ComponentFilterWidgetProvider = exports.ComponentFilterWidgetContext = void 0;
23
+ const react_1 = __importStar(require("react"));
24
+ exports.ComponentFilterWidgetContext = (0, react_1.createContext)({
25
+ filterWidgetOpen: false,
26
+ setFilterWidget: () => { },
27
+ });
28
+ const ComponentFilterWidgetProvider = ({ children }) => {
29
+ const [filterWidgetOpen, setFilterWidget] = (0, react_1.useState)(false);
30
+ return (react_1.default.createElement(exports.ComponentFilterWidgetContext.Provider, { value: { filterWidgetOpen, setFilterWidget } }, children));
31
+ };
32
+ exports.ComponentFilterWidgetProvider = ComponentFilterWidgetProvider;
33
+ //# sourceMappingURL=component-drawer-filter-widget.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-drawer-filter-widget.context.js","sourceRoot":"","sources":["../component-drawer-filter-widget.context.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAkE;AAOrD,QAAA,4BAA4B,GAAG,IAAA,qBAAa,EAAmC;IAC1F,gBAAgB,EAAE,KAAK;IACvB,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC;CAC1B,CAAC,CAAC;AAEI,MAAM,6BAA6B,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IACrF,MAAM,CAAC,gBAAgB,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IACrE,OAAO,CACL,8BAAC,oCAA4B,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,gBAAgB,EAAE,eAAe,EAAE,IAChF,QAAQ,CAC6B,CACzC,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,6BAA6B,iCAOxC"}
@@ -0,0 +1,9 @@
1
+ import React, { ReactNode } from 'react';
2
+ export declare type ComponentTreeContextType = {
3
+ collapsed: boolean;
4
+ setCollapsed: (collapsed: boolean) => void;
5
+ };
6
+ export declare const ComponentTreeContext: React.Context<ComponentTreeContextType>;
7
+ export declare const ComponentTreeProvider: ({ children }: {
8
+ children: ReactNode;
9
+ }) => JSX.Element;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.ComponentTreeProvider = exports.ComponentTreeContext = void 0;
23
+ const react_1 = __importStar(require("react"));
24
+ exports.ComponentTreeContext = (0, react_1.createContext)({
25
+ collapsed: true,
26
+ setCollapsed: () => { },
27
+ });
28
+ const ComponentTreeProvider = ({ children }) => {
29
+ const [collapsed, setCollapsed] = (0, react_1.useState)(true);
30
+ return react_1.default.createElement(exports.ComponentTreeContext.Provider, { value: { collapsed, setCollapsed } }, children);
31
+ };
32
+ exports.ComponentTreeProvider = ComponentTreeProvider;
33
+ //# sourceMappingURL=component-drawer-tree-widget.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-drawer-tree-widget.context.js","sourceRoot":"","sources":["../component-drawer-tree-widget.context.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAkE;AAOrD,QAAA,oBAAoB,GAAG,IAAA,qBAAa,EAA2B;IAC1E,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;CACvB,CAAC,CAAC;AAEI,MAAM,qBAAqB,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IAC7E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAU,IAAI,CAAC,CAAC;IAC1D,OAAO,8BAAC,4BAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,IAAG,QAAQ,CAAiC,CAAC;AACvH,CAAC,CAAC;AAHW,QAAA,qBAAqB,yBAGhC"}
@@ -0,0 +1,54 @@
1
+ import { ReactNode } from 'react';
2
+ import { PayloadType } from '@teambit/ui-foundation.ui.side-bar';
3
+ import { ComponentTreeSlot } from '@teambit/component-tree';
4
+ import type { DrawerType } from '@teambit/ui-foundation.ui.tree.drawer';
5
+ import { ComponentModel } from '@teambit/component';
6
+ import { TreeNodeRenderer } from '@teambit/design.ui.tree';
7
+ import { ComponentFilters } from '@teambit/component.ui.component-filters';
8
+ import { SlotRegistry } from '@teambit/harmony';
9
+ export declare type ComponentFiltersSlot = SlotRegistry<ComponentFilters>;
10
+ export declare type DrawerWidgetSlot = SlotRegistry<ReactNode[]>;
11
+ export declare type ComponentsDrawerProps = Omit<DrawerType, 'render'> & {
12
+ useComponents: () => {
13
+ components: ComponentModel[];
14
+ loading?: boolean;
15
+ };
16
+ emptyMessage?: ReactNode;
17
+ plugins?: ComponentsDrawerPlugins;
18
+ };
19
+ export declare type ComponentsDrawerPlugins = {
20
+ tree?: {
21
+ customRenderer?: (treeNodeSlot?: ComponentTreeSlot) => TreeNodeRenderer<PayloadType>;
22
+ widgets: ComponentTreeSlot;
23
+ };
24
+ filters?: ComponentFiltersSlot;
25
+ drawerWidgets?: DrawerWidgetSlot;
26
+ };
27
+ export declare class ComponentsDrawer implements DrawerType {
28
+ readonly id: string;
29
+ readonly useComponents: () => {
30
+ components: ComponentModel[];
31
+ loading?: boolean;
32
+ };
33
+ name: ReactNode;
34
+ tooltip?: string;
35
+ order?: number;
36
+ isHidden?: () => boolean;
37
+ emptyMessage?: ReactNode;
38
+ widgets: ReactNode[];
39
+ plugins: ComponentsDrawerPlugins;
40
+ constructor(props: ComponentsDrawerProps);
41
+ Context: ({ children }: {
42
+ children: any;
43
+ }) => JSX.Element;
44
+ renderFilters: ({ components }: {
45
+ components: ComponentModel[];
46
+ }) => JSX.Element;
47
+ renderTree: ({ components }: {
48
+ components: ComponentModel[];
49
+ }) => JSX.Element;
50
+ setWidgets: (widgets?: DrawerWidgetSlot) => void;
51
+ render: () => JSX.Element;
52
+ }
53
+ export declare function TreeToggleWidget(): JSX.Element;
54
+ export declare function FilterWidget(): JSX.Element;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.FilterWidget = exports.TreeToggleWidget = exports.ComponentsDrawer = void 0;
26
+ const react_1 = __importStar(require("react"));
27
+ const classnames_1 = __importDefault(require("classnames"));
28
+ const ui_foundation_ui_side_bar_1 = require("@teambit/ui-foundation.ui.side-bar");
29
+ const ui_foundation_ui_full_loader_1 = require("@teambit/ui-foundation.ui.full-loader");
30
+ const design_ui_styles_muted_italic_1 = require("@teambit/design.ui.styles.muted-italic");
31
+ const design_ui_styles_ellipsis_1 = require("@teambit/design.ui.styles.ellipsis");
32
+ const base_ui_utils_composer_1 = require("@teambit/base-ui.utils.composer");
33
+ const lodash_flatten_1 = __importDefault(require("lodash.flatten"));
34
+ const component_ui_component_filters_1 = require("@teambit/component.ui.component-filters");
35
+ const component_drawer_filter_widget_context_1 = require("./component-drawer-filter-widget.context");
36
+ const component_drawer_tree_widget_context_1 = require("./component-drawer-tree-widget.context");
37
+ const component_drawer_module_scss_1 = __importDefault(require("./component-drawer.module.scss"));
38
+ class ComponentsDrawer {
39
+ constructor(props) {
40
+ var _a;
41
+ this.Context = ({ children }) => {
42
+ var _a, _b;
43
+ const filters = (0, lodash_flatten_1.default)(((_b = (_a = this.plugins) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.values()) || []);
44
+ const combinedContexts = [
45
+ component_drawer_tree_widget_context_1.ComponentTreeProvider,
46
+ component_drawer_filter_widget_context_1.ComponentFilterWidgetProvider,
47
+ [component_ui_component_filters_1.ComponentFiltersProvider, { filters }],
48
+ ];
49
+ return react_1.default.createElement(base_ui_utils_composer_1.Composer, { components: combinedContexts }, children);
50
+ };
51
+ this.renderFilters = ({ components }) => {
52
+ if (!this.plugins.filters)
53
+ return null;
54
+ const filterPlugins = this.plugins.filters;
55
+ const { filterWidgetOpen } = (0, react_1.useContext)(component_drawer_filter_widget_context_1.ComponentFilterWidgetContext);
56
+ if (!filterPlugins)
57
+ return null;
58
+ const filters = (0, react_1.useMemo)(() => (0, lodash_flatten_1.default)(filterPlugins.toArray().map(([key, filtersByKey]) => {
59
+ return filtersByKey.map((filter) => (Object.assign(Object.assign({}, filter), { key: `${key}-${filter.id}` })));
60
+ })).sort((a, b) => { var _a, _b; return ((_a = a.order) !== null && _a !== void 0 ? _a : 0) - ((_b = b.order) !== null && _b !== void 0 ? _b : 0); }), [filterPlugins]);
61
+ return (react_1.default.createElement("div", { className: (0, classnames_1.default)(component_drawer_module_scss_1.default.filtersContainer, filterWidgetOpen && component_drawer_module_scss_1.default.open) }, filters.map((filter) => (react_1.default.createElement(filter.render, { key: filter.key, components: components, className: component_drawer_module_scss_1.default.filter })))));
62
+ };
63
+ this.renderTree = ({ components }) => {
64
+ const { collapsed } = (0, react_1.useContext)(component_drawer_tree_widget_context_1.ComponentTreeContext);
65
+ const { tree } = this.plugins;
66
+ const TreeNode = (tree === null || tree === void 0 ? void 0 : tree.customRenderer) && (0, react_1.useCallback)(tree.customRenderer(tree.widgets), [tree.widgets]);
67
+ const isVisible = components.length > 0;
68
+ if (!isVisible)
69
+ return null;
70
+ return (react_1.default.createElement(ui_foundation_ui_side_bar_1.ComponentTree, { components: components, isCollapsed: collapsed, className: component_drawer_module_scss_1.default.componentTree, TreeNode: TreeNode }));
71
+ };
72
+ this.setWidgets = (widgets) => {
73
+ this.widgets = (0, lodash_flatten_1.default)(widgets === null || widgets === void 0 ? void 0 : widgets.values());
74
+ };
75
+ this.render = () => {
76
+ const { loading, components } = this.useComponents();
77
+ const componentFiltersContext = (0, react_1.useContext)(component_ui_component_filters_1.ComponentFilterContext);
78
+ if (loading)
79
+ return react_1.default.createElement(ui_foundation_ui_full_loader_1.FullLoader, null);
80
+ const filters = (componentFiltersContext === null || componentFiltersContext === void 0 ? void 0 : componentFiltersContext.filters) || [];
81
+ const filteredComponents = (0, react_1.useMemo)(() => (0, component_ui_component_filters_1.runAllFilters)(filters, components), [filters]);
82
+ const Filters = this.renderFilters({ components });
83
+ const Tree = this.renderTree({ components: filteredComponents });
84
+ const emptyDrawer = (react_1.default.createElement("span", { className: (0, classnames_1.default)(design_ui_styles_muted_italic_1.mutedItalic, design_ui_styles_ellipsis_1.ellipsis, component_drawer_module_scss_1.default.emptyDrawer) }, this.emptyMessage));
85
+ return (react_1.default.createElement("div", { key: this.id, className: component_drawer_module_scss_1.default.drawerContainer },
86
+ Filters,
87
+ Tree,
88
+ Tree || emptyDrawer));
89
+ };
90
+ Object.assign(this, props);
91
+ this.useComponents = props.useComponents;
92
+ this.emptyMessage = props.emptyMessage;
93
+ this.plugins = props.plugins || {};
94
+ this.setWidgets((_a = props.plugins) === null || _a === void 0 ? void 0 : _a.drawerWidgets);
95
+ }
96
+ }
97
+ exports.ComponentsDrawer = ComponentsDrawer;
98
+ function TreeToggleWidget() {
99
+ const { collapsed, setCollapsed } = (0, react_1.useContext)(component_drawer_tree_widget_context_1.ComponentTreeContext);
100
+ const icon = collapsed
101
+ ? 'https://static.bit.dev/bit-icons/expand.svg'
102
+ : 'https://static.bit.dev/bit-icons/collapse.svg';
103
+ return (react_1.default.createElement("div", { className: (0, classnames_1.default)(component_drawer_module_scss_1.default.widgetIcon, !collapsed && component_drawer_module_scss_1.default.open) },
104
+ react_1.default.createElement("img", { src: icon, onClick: () => setCollapsed(!collapsed) })));
105
+ }
106
+ exports.TreeToggleWidget = TreeToggleWidget;
107
+ function FilterWidget() {
108
+ const { filterWidgetOpen, setFilterWidget } = (0, react_1.useContext)(component_drawer_filter_widget_context_1.ComponentFilterWidgetContext);
109
+ return (react_1.default.createElement("div", { className: (0, classnames_1.default)(component_drawer_module_scss_1.default.widgetIcon, component_drawer_module_scss_1.default.filterWidget, filterWidgetOpen && component_drawer_module_scss_1.default.open) },
110
+ react_1.default.createElement("img", { src: "https://static.bit.dev/bit-icons/filter.svg", onClick: () => setFilterWidget(!filterWidgetOpen) })));
111
+ }
112
+ exports.FilterWidget = FilterWidget;
113
+ //# sourceMappingURL=component-drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-drawer.js","sourceRoot":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O,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC,gBAAgB,CAAC,GAAI,CACxG,CACP,CAAC;AACJ,CAAC;AAPD,oCAOC"}
@@ -0,0 +1,58 @@
1
+ .drawerContainer {
2
+ height: 100%;
3
+ }
4
+
5
+ .emptyDrawer {
6
+ padding: 8px 8px 0 28px;
7
+ display: block;
8
+ }
9
+
10
+ .widgetIcon {
11
+ padding: 4px;
12
+ border-radius: 8px;
13
+ align-items: center;
14
+ display: flex;
15
+ margin-left: 4px;
16
+
17
+ &:hover,
18
+ &.open {
19
+ background-color: var(--bit-border-color-lightest, #ededed);
20
+ }
21
+ img {
22
+ width: 16px;
23
+ }
24
+ &:active img,
25
+ &.open img {
26
+ filter: invert(38%) sepia(33%) saturate(7140%) hue-rotate(234deg) brightness(96%) contrast(87%);
27
+ }
28
+ }
29
+
30
+ .filterWidgetIcon {
31
+ margin-right: 8px;
32
+ }
33
+
34
+ .filtersContainer {
35
+ opacity: 0;
36
+ transition: max-height 300ms ease-in-out, opacity 300ms ease-in-out;
37
+ max-height: 0;
38
+ border-bottom: 1px solid #ededed;
39
+
40
+ &.open {
41
+ opacity: 1;
42
+ max-height: 100%;
43
+ }
44
+ }
45
+
46
+ .filter {
47
+ display: flex;
48
+ flex-direction: row;
49
+ font-size: 14px;
50
+ justify-content: space-between;
51
+ padding: 8px;
52
+ margin: 4px 8px;
53
+ }
54
+
55
+ .componentTree {
56
+ overflow-y: scroll;
57
+ height: 100%;
58
+ }
@@ -0,0 +1,3 @@
1
+ export { ComponentsDrawer, ComponentsDrawerProps, FilterWidget, TreeToggleWidget, ComponentFiltersSlot, DrawerWidgetSlot, } from './component-drawer';
2
+ export { ComponentFilterWidgetContextType, ComponentFilterWidgetContext, ComponentFilterWidgetProvider, } from './component-drawer-filter-widget.context';
3
+ export { ComponentTreeContextType, ComponentTreeContext, ComponentTreeProvider, } from './component-drawer-tree-widget.context';
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComponentTreeProvider = exports.ComponentTreeContext = exports.ComponentFilterWidgetProvider = exports.ComponentFilterWidgetContext = exports.TreeToggleWidget = exports.FilterWidget = exports.ComponentsDrawer = void 0;
4
+ var component_drawer_1 = require("./component-drawer");
5
+ Object.defineProperty(exports, "ComponentsDrawer", { enumerable: true, get: function () { return component_drawer_1.ComponentsDrawer; } });
6
+ Object.defineProperty(exports, "FilterWidget", { enumerable: true, get: function () { return component_drawer_1.FilterWidget; } });
7
+ Object.defineProperty(exports, "TreeToggleWidget", { enumerable: true, get: function () { return component_drawer_1.TreeToggleWidget; } });
8
+ var component_drawer_filter_widget_context_1 = require("./component-drawer-filter-widget.context");
9
+ Object.defineProperty(exports, "ComponentFilterWidgetContext", { enumerable: true, get: function () { return component_drawer_filter_widget_context_1.ComponentFilterWidgetContext; } });
10
+ Object.defineProperty(exports, "ComponentFilterWidgetProvider", { enumerable: true, get: function () { return component_drawer_filter_widget_context_1.ComponentFilterWidgetProvider; } });
11
+ var component_drawer_tree_widget_context_1 = require("./component-drawer-tree-widget.context");
12
+ Object.defineProperty(exports, "ComponentTreeContext", { enumerable: true, get: function () { return component_drawer_tree_widget_context_1.ComponentTreeContext; } });
13
+ Object.defineProperty(exports, "ComponentTreeProvider", { enumerable: true, get: function () { return component_drawer_tree_widget_context_1.ComponentTreeProvider; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,uDAO4B;AAN1B,oHAAA,gBAAgB,OAAA;AAEhB,gHAAA,YAAY,OAAA;AACZ,oHAAA,gBAAgB,OAAA;AAIlB,mGAIkD;AAFhD,sJAAA,4BAA4B,OAAA;AAC5B,uJAAA,6BAA6B,OAAA;AAE/B,+FAIgD;AAF9C,4IAAA,oBAAoB,OAAA;AACpB,6IAAA,qBAAqB,OAAA"}
package/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ export {
2
+ ComponentsDrawer,
3
+ ComponentsDrawerProps,
4
+ FilterWidget,
5
+ TreeToggleWidget,
6
+ ComponentFiltersSlot,
7
+ DrawerWidgetSlot,
8
+ } from './component-drawer';
9
+ export {
10
+ ComponentFilterWidgetContextType,
11
+ ComponentFilterWidgetContext,
12
+ ComponentFilterWidgetProvider,
13
+ } from './component-drawer-filter-widget.context';
14
+ export {
15
+ ComponentTreeContextType,
16
+ ComponentTreeContext,
17
+ ComponentTreeProvider,
18
+ } from './component-drawer-tree-widget.context';
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@teambit/component.ui.component-drawer",
3
+ "version": "0.0.1",
4
+ "main": "dist/index.js",
5
+ "componentId": {
6
+ "scope": "teambit.component",
7
+ "name": "ui/component-drawer",
8
+ "version": "0.0.1"
9
+ },
10
+ "dependencies": {
11
+ "@teambit/harmony": "0.2.11",
12
+ "classnames": "2.2.6",
13
+ "lodash.flatten": "4.4.0",
14
+ "core-js": "^3.0.0",
15
+ "@teambit/base-ui.utils.composer": "1.0.0",
16
+ "@teambit/component.ui.component-filters": "0.0.1",
17
+ "@teambit/design.ui.styles.ellipsis": "0.0.347",
18
+ "@teambit/design.ui.styles.muted-italic": "0.0.35",
19
+ "@teambit/design.ui.tree": "0.0.5",
20
+ "@teambit/ui-foundation.ui.full-loader": "0.0.486",
21
+ "@teambit/ui-foundation.ui.side-bar": "0.0.520",
22
+ "@teambit/ui-foundation.ui.tree.drawer": "0.0.497"
23
+ },
24
+ "devDependencies": {
25
+ "@types/react": "^17.0.8",
26
+ "@types/classnames": "2.2.11",
27
+ "@types/lodash.flatten": "4.4.6",
28
+ "@types/mocha": "9.1.0",
29
+ "@types/testing-library__jest-dom": "5.9.5",
30
+ "@babel/runtime": "7.12.18",
31
+ "@types/jest": "^26.0.0",
32
+ "@types/react-dom": "^17.0.5",
33
+ "@types/node": "12.20.4"
34
+ },
35
+ "peerDependencies": {
36
+ "react-dom": "^16.8.0 || ^17.0.0",
37
+ "react": "^16.8.0 || ^17.0.0"
38
+ },
39
+ "license": "Apache-2.0",
40
+ "bit": {
41
+ "bindingPrefix": "@teambit",
42
+ "env": {},
43
+ "overrides": {
44
+ "dependencies": {
45
+ "@teambit/legacy": "-",
46
+ "core-js": "^3.0.0",
47
+ "react-dom": "-",
48
+ "react": "-"
49
+ },
50
+ "devDependencies": {
51
+ "@teambit/legacy": "-",
52
+ "@types/mocha": "9.1.0",
53
+ "@types/testing-library__jest-dom": "5.9.5",
54
+ "@babel/runtime": "7.12.18",
55
+ "@types/jest": "^26.0.0",
56
+ "@types/react-dom": "^17.0.5",
57
+ "@types/react": "^17.0.8",
58
+ "@types/node": "12.20.4",
59
+ "react-dom": "-",
60
+ "react": "-"
61
+ },
62
+ "peerDependencies": {
63
+ "react-dom": "^16.8.0 || ^17.0.0",
64
+ "react": "^16.8.0 || ^17.0.0"
65
+ }
66
+ }
67
+ },
68
+ "private": false,
69
+ "engines": {
70
+ "node": ">=12.22.0"
71
+ },
72
+ "repository": {
73
+ "type": "git",
74
+ "url": "https://github.com/teambit/bit"
75
+ },
76
+ "keywords": [
77
+ "bit",
78
+ "components",
79
+ "collaboration",
80
+ "web",
81
+ "react",
82
+ "react-components",
83
+ "angular",
84
+ "angular-components",
85
+ "vue",
86
+ "vue-components"
87
+ ]
88
+ }
@@ -0,0 +1 @@
1
+
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "es2019",
5
+ "DOM",
6
+ "ES6",
7
+ "DOM.Iterable"
8
+ ],
9
+ "target": "es2015",
10
+ "module": "commonjs",
11
+ "jsx": "react",
12
+ "allowJs": true,
13
+ "composite": true,
14
+ "declaration": true,
15
+ "sourceMap": true,
16
+ "skipLibCheck": true,
17
+ "outDir": "dist",
18
+ "moduleResolution": "node",
19
+ "esModuleInterop": true,
20
+ "rootDir": ".",
21
+ "resolveJsonModule": true
22
+ },
23
+ "exclude": [
24
+ "dist"
25
+ ]
26
+ }
@@ -0,0 +1,29 @@
1
+ declare module '*.png' {
2
+ const value: any;
3
+ export = value;
4
+ }
5
+ declare module '*.svg' {
6
+ import type { FunctionComponent, SVGProps } from 'react';
7
+
8
+ export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
9
+ const src: string;
10
+ export default src;
11
+ }
12
+
13
+ // @TODO Gilad
14
+ declare module '*.jpg' {
15
+ const value: any;
16
+ export = value;
17
+ }
18
+ declare module '*.jpeg' {
19
+ const value: any;
20
+ export = value;
21
+ }
22
+ declare module '*.gif' {
23
+ const value: any;
24
+ export = value;
25
+ }
26
+ declare module '*.bmp' {
27
+ const value: any;
28
+ export = value;
29
+ }
@@ -0,0 +1,42 @@
1
+ declare module '*.module.css' {
2
+ const classes: { readonly [key: string]: string };
3
+ export default classes;
4
+ }
5
+ declare module '*.module.scss' {
6
+ const classes: { readonly [key: string]: string };
7
+ export default classes;
8
+ }
9
+ declare module '*.module.sass' {
10
+ const classes: { readonly [key: string]: string };
11
+ export default classes;
12
+ }
13
+
14
+ declare module '*.module.less' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+
19
+ declare module '*.less' {
20
+ const classes: { readonly [key: string]: string };
21
+ export default classes;
22
+ }
23
+
24
+ declare module '*.css' {
25
+ const classes: { readonly [key: string]: string };
26
+ export default classes;
27
+ }
28
+
29
+ declare module '*.sass' {
30
+ const classes: { readonly [key: string]: string };
31
+ export default classes;
32
+ }
33
+
34
+ declare module '*.scss' {
35
+ const classes: { readonly [key: string]: string };
36
+ export default classes;
37
+ }
38
+
39
+ declare module '*.mdx' {
40
+ const component: any;
41
+ export default component;
42
+ }