@teambit/component.ui.component-filters.env-filter 0.0.0-0075f8c61eb26003cb098208b4da4427a2653ea7

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,6 @@
1
+ import React from 'react';
2
+ import type { EnvFilterEnvState } from './types';
3
+ export declare function EnvsPlaceholder({ onClick }: {
4
+ onClick?: () => void;
5
+ }): React.JSX.Element;
6
+ export declare function EnvsDropdownItem({ displayName, icon, description, componentId, id }: EnvFilterEnvState): React.JSX.Element;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EnvsPlaceholder = EnvsPlaceholder;
7
+ exports.EnvsDropdownItem = EnvsDropdownItem;
8
+ const react_1 = __importDefault(require("react"));
9
+ const component_modules_component_url_1 = require("@teambit/component.modules.component-url");
10
+ const design_ui_styles_ellipsis_1 = require("@teambit/design.ui.styles.ellipsis");
11
+ const design_ui_tooltip_1 = require("@teambit/design.ui.tooltip");
12
+ const base_react_navigation_link_1 = require("@teambit/base-react.navigation.link");
13
+ const envs_filter_module_scss_1 = __importDefault(require("./envs-filter.module.scss"));
14
+ function EnvsPlaceholder({ onClick }) {
15
+ return (react_1.default.createElement("div", { className: envs_filter_module_scss_1.default.filterIcon, onClick: onClick },
16
+ react_1.default.createElement("img", { src: "https://static.bit.dev/bit-icons/env.svg" }),
17
+ react_1.default.createElement("span", { className: envs_filter_module_scss_1.default.filterIconLabel }, "Environments"),
18
+ react_1.default.createElement("div", { className: envs_filter_module_scss_1.default.dropdownArrow },
19
+ react_1.default.createElement("img", { src: "https://static.bit.dev/bit-icons/fat-arrow-down.svg" }))));
20
+ }
21
+ function EnvsDropdownItem({ displayName, icon, description, componentId, id }) {
22
+ return (react_1.default.createElement(design_ui_tooltip_1.Tooltip, { placement: "right", content: react_1.default.createElement(base_react_navigation_link_1.Link, { className: envs_filter_module_scss_1.default.envLink, href: component_modules_component_url_1.ComponentUrl.toUrl(componentId, { includeVersion: false }), external: true }, id) },
23
+ react_1.default.createElement("div", { className: envs_filter_module_scss_1.default.envDropdownItemContainer },
24
+ react_1.default.createElement("div", { className: envs_filter_module_scss_1.default.envDropdownItem },
25
+ react_1.default.createElement(design_ui_styles_ellipsis_1.Ellipsis, null, displayName),
26
+ react_1.default.createElement("div", { className: envs_filter_module_scss_1.default.envDropdownItemIconContainer },
27
+ react_1.default.createElement("img", { className: envs_filter_module_scss_1.default.envDropdownItemIcon, src: icon }))),
28
+ react_1.default.createElement("div", { className: envs_filter_module_scss_1.default.description },
29
+ react_1.default.createElement(design_ui_styles_ellipsis_1.Ellipsis, { className: envs_filter_module_scss_1.default.descriptionText }, description)))));
30
+ }
31
+ //# sourceMappingURL=dropdown-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown-item.js","sourceRoot":"","sources":["../dropdown-item.tsx"],"names":[],"mappings":";;;;;AAQA,0CAUC;AAED,4CA2BC;AA/CD,kDAA0B;AAC1B,8FAAwE;AACxE,kFAA8D;AAC9D,kEAAqD;AACrD,oFAA2D;AAE3D,wFAA+C;AAE/C,SAAgB,eAAe,CAAC,EAAE,OAAO,EAA4B;IACnE,OAAO,CACL,uCAAK,SAAS,EAAE,iCAAM,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO;QACjD,uCAAK,GAAG,EAAC,0CAA0C,GAAG;QACtD,wCAAM,SAAS,EAAE,iCAAM,CAAC,eAAe,mBAAqB;QAC5D,uCAAK,SAAS,EAAE,iCAAM,CAAC,aAAa;YAClC,uCAAK,GAAG,EAAC,qDAAqD,GAAG,CAC7D,CACF,CACP,CAAC;AACJ,CAAC;AAED,SAAgB,gBAAgB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAqB;IACrG,OAAO,CACL,8BAAC,2BAAO,IACN,SAAS,EAAC,OAAO,EACjB,OAAO,EACL,8BAAC,iCAAI,IACH,SAAS,EAAE,iCAAM,CAAC,OAAO,EACzB,IAAI,EAAE,8CAAY,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,EAChE,QAAQ,EAAE,IAAI,IAEb,EAAE,CACE;QAGT,uCAAK,SAAS,EAAE,iCAAM,CAAC,wBAAwB;YAC7C,uCAAK,SAAS,EAAE,iCAAM,CAAC,eAAe;gBACpC,8BAAC,oCAAQ,QAAE,WAAW,CAAY;gBAClC,uCAAK,SAAS,EAAE,iCAAM,CAAC,4BAA4B;oBACjD,uCAAK,SAAS,EAAE,iCAAM,CAAC,mBAAmB,EAAE,GAAG,EAAE,IAAI,GAAQ,CACzD,CACF;YACN,uCAAK,SAAS,EAAE,iCAAM,CAAC,WAAW;gBAChC,8BAAC,oCAAQ,IAAC,SAAS,EAAE,iCAAM,CAAC,eAAe,IAAG,WAAW,CAAY,CACjE,CACF,CACE,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { EnvsFilterCriteria } from './types';
2
+ export declare const EnvsFilter: EnvsFilterCriteria;
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.EnvsFilter = void 0;
40
+ const react_1 = __importStar(require("react"));
41
+ const classnames_1 = __importDefault(require("classnames"));
42
+ const component_1 = require("@teambit/component");
43
+ const component_ui_component_filters_component_filter_context_1 = require("@teambit/component.ui.component-filters.component-filter-context");
44
+ const design_inputs_selectors_checkbox_item_1 = require("@teambit/design.inputs.selectors.checkbox-item");
45
+ const design_inputs_dropdown_1 = require("@teambit/design.inputs.dropdown");
46
+ const dropdown_item_1 = require("./dropdown-item");
47
+ const envs_filter_module_scss_1 = __importDefault(require("./envs-filter.module.scss"));
48
+ exports.EnvsFilter = {
49
+ id: 'envs',
50
+ match: ({ component }, filter) => {
51
+ var _a;
52
+ const { envsState } = filter;
53
+ const areAllEnvsActive = [...envsState.values()].every((envState) => envState.active);
54
+ const activeEnvs = [...envsState.values()].filter((envState) => envState.active).map((envState) => envState.id);
55
+ // match everything when no envs are set or all envs are set
56
+ if (activeEnvs.length === 0 || areAllEnvsActive)
57
+ return true;
58
+ const envId = component.environment && ((_a = component_1.ComponentID.tryFromString(component.environment.id)) === null || _a === void 0 ? void 0 : _a.toStringWithoutVersion());
59
+ const matches = !!envId && activeEnvs.indexOf(envId) >= 0;
60
+ return matches;
61
+ },
62
+ state: {
63
+ envsState: new Map(),
64
+ dropdownState: false,
65
+ },
66
+ order: 1,
67
+ render: envsFilter,
68
+ };
69
+ const deriveEnvsFilterState = (components) => {
70
+ return (0, react_1.useMemo)(() => {
71
+ const defaultState = {
72
+ dropdownState: false,
73
+ envsState: new Map(),
74
+ };
75
+ const componentEnvSet = new Set();
76
+ const componentsEnvsWithIcons = components
77
+ .filter((component) => {
78
+ const envId = component.environment && component_1.ComponentID.tryFromString(component.environment.id);
79
+ if (!envId)
80
+ return false;
81
+ const envKey = envId.toStringWithoutVersion();
82
+ if (componentEnvSet.has(envKey))
83
+ return false;
84
+ componentEnvSet.add(envKey);
85
+ return true;
86
+ })
87
+ .map((component) => {
88
+ var _a, _b;
89
+ const envId = component_1.ComponentID.fromString((_a = component.environment) === null || _a === void 0 ? void 0 : _a.id);
90
+ return {
91
+ displayName: envId.name,
92
+ id: envId.toStringWithoutVersion(),
93
+ description: `${envId.scope}${envId.namespace ? '/'.concat(envId.namespace) : ''}`,
94
+ icon: (_b = component.environment) === null || _b === void 0 ? void 0 : _b.icon,
95
+ componentId: envId,
96
+ };
97
+ });
98
+ componentsEnvsWithIcons.forEach((componentEnvWithIcon) => {
99
+ defaultState.envsState.set(componentEnvWithIcon.id, Object.assign(Object.assign({}, componentEnvWithIcon), { active: true }));
100
+ });
101
+ return defaultState;
102
+ }, [components]);
103
+ };
104
+ function envsFilter({ components, className, lanes }) {
105
+ var _a, _b;
106
+ const [filters = []] = (0, component_ui_component_filters_component_filter_context_1.useComponentFilters)() || [];
107
+ const filtersExceptEnv = filters.filter((filter) => filter.id !== exports.EnvsFilter.id);
108
+ const filteredComponents = (0, react_1.useMemo)(() => (0, component_ui_component_filters_component_filter_context_1.runAllFilters)(filtersExceptEnv, { components, lanes }), [JSON.stringify(filtersExceptEnv), (_a = lanes === null || lanes === void 0 ? void 0 : lanes.viewedLane) === null || _a === void 0 ? void 0 : _a.id.toString()]);
109
+ const envsFilterState = deriveEnvsFilterState(filteredComponents);
110
+ const filterContext = (0, component_ui_component_filters_component_filter_context_1.useComponentFilter)(exports.EnvsFilter.id, envsFilterState);
111
+ const envs = envsFilterState.envsState;
112
+ const [currentFilter, updateFilter] = filterContext || [];
113
+ const [open, setOpen] = (0, react_1.useState)(false);
114
+ /**
115
+ * this will not work if other filters in a single re-render
116
+ * result in the same number of components with different ids
117
+ */
118
+ (0, react_1.useEffect)(() => {
119
+ updateFilter === null || updateFilter === void 0 ? void 0 : updateFilter((currentState) => {
120
+ currentState.state = envsFilterState;
121
+ return currentState;
122
+ });
123
+ }, [filteredComponents.length, (_b = lanes === null || lanes === void 0 ? void 0 : lanes.viewedLane) === null || _b === void 0 ? void 0 : _b.id.toString()]);
124
+ const selectList = [];
125
+ envs.forEach((state) => {
126
+ var _a;
127
+ selectList.push({
128
+ value: state.id,
129
+ icon: state.icon,
130
+ description: state.description,
131
+ checked: !!((_a = currentFilter === null || currentFilter === void 0 ? void 0 : currentFilter.state.envsState.get(state.id)) === null || _a === void 0 ? void 0 : _a.active),
132
+ element: react_1.default.createElement(dropdown_item_1.EnvsDropdownItem, Object.assign({}, state)),
133
+ });
134
+ });
135
+ const onCheck = (value, e) => {
136
+ const checked = e.target.checked;
137
+ updateFilter === null || updateFilter === void 0 ? void 0 : updateFilter((currentState) => {
138
+ if (checked && !currentState.state.dropdownState) {
139
+ currentState.state.dropdownState = true;
140
+ }
141
+ const currentEnvState = currentState.state.envsState.get(value);
142
+ if (!currentEnvState)
143
+ return currentState;
144
+ currentState.state.envsState.set(value, Object.assign(Object.assign({}, currentEnvState), { active: checked }));
145
+ return currentState;
146
+ });
147
+ };
148
+ const onClear = () => {
149
+ updateFilter === null || updateFilter === void 0 ? void 0 : updateFilter((currentState) => {
150
+ currentState.state.envsState.forEach((value, key) => {
151
+ currentState.state.envsState.set(key, Object.assign(Object.assign({}, value), { active: false }));
152
+ });
153
+ return currentState;
154
+ });
155
+ };
156
+ const onSubmit = () => {
157
+ updateFilter === null || updateFilter === void 0 ? void 0 : updateFilter((currentState) => {
158
+ currentState.state.dropdownState = false;
159
+ return currentState;
160
+ });
161
+ setOpen(false);
162
+ };
163
+ return (react_1.default.createElement("div", { className: (0, classnames_1.default)(envs_filter_module_scss_1.default.envsFilterContainer, className) },
164
+ react_1.default.createElement(design_inputs_dropdown_1.Dropdown, { open: open, onClickOutside: () => setOpen(false), placeholderContent: react_1.default.createElement(dropdown_item_1.EnvsPlaceholder, { onClick: () => setOpen(!open) }), bottomPlugin: react_1.default.createElement(design_inputs_dropdown_1.ButtonsPlugin, { onClear: onClear, onSubmit: onSubmit, submitClassName: envs_filter_module_scss_1.default.doneButton }), dropClass: envs_filter_module_scss_1.default.envFilterDropdown, position: "bottom" },
165
+ react_1.default.createElement("div", { className: envs_filter_module_scss_1.default.dropdownContent }, selectList.map((option, index) => (react_1.default.createElement(design_inputs_selectors_checkbox_item_1.CheckboxItem, { key: index, checked: option.checked, onInputChanged: (e) => onCheck(option.value, e) }, option.element)))))));
166
+ }
167
+ //# sourceMappingURL=envs-filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envs-filter.js","sourceRoot":"","sources":["../envs-filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA4D;AAC5D,4DAAoC;AAEpC,kDAAiD;AAEjD,8IAI0E;AAC1E,0GAA8E;AAC9E,4EAA0E;AAC1E,mDAAoE;AAEpE,wFAA+C;AAElC,QAAA,UAAU,GAAuB;IAC5C,EAAE,EAAE,MAAM;IACV,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE;;QAC/B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC7B,MAAM,gBAAgB,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtF,MAAM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,CAChB,CAAC,CACE,CACG,CACP,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,84 @@
1
+ .envsFilterContainer {
2
+ > div {
3
+ line-height: 16px;
4
+ display: flex;
5
+ }
6
+
7
+ .filterIcon {
8
+ display: flex;
9
+ padding: 8px;
10
+ border-radius: 8px;
11
+
12
+ &:hover {
13
+ background: var(--bit-bg-heavy, #f6f6f6);
14
+ cursor: pointer;
15
+ }
16
+
17
+ img {
18
+ width: 16px;
19
+ filter: invert(44%) sepia(7%) saturate(560%) hue-rotate(187deg) brightness(96%) contrast(91%);
20
+ }
21
+
22
+ .filterIconLabel {
23
+ margin: 0px 8px;
24
+ font-size: 14px;
25
+ }
26
+
27
+ .dropdownArrow {
28
+ display: flex;
29
+ }
30
+ }
31
+ }
32
+
33
+ .envFilterDropdown {
34
+ width: 300px;
35
+ }
36
+ .dropdownContent {
37
+ overflow: auto;
38
+ max-height: 30vh;
39
+ }
40
+
41
+ .doneButton {
42
+ transition: none;
43
+ }
44
+
45
+ .envDropdownItemContainer {
46
+ display: flex;
47
+ width: calc(100% - 24px);
48
+ align-items: baseline;
49
+ flex-direction: column;
50
+ }
51
+
52
+ .envDropdownItemIconContainer {
53
+ display: flex;
54
+ height: 16px;
55
+ width: 16px;
56
+ }
57
+
58
+ .envDropdownItem {
59
+ display: flex;
60
+ justify-content: space-between;
61
+ width: 100%;
62
+ font-size: var(--bit-p-md, 16px);
63
+ }
64
+
65
+ .envDropdownItemIcon {
66
+ display: flex;
67
+ justify-content: space-between;
68
+ padding-left: 8px;
69
+ }
70
+
71
+ .description {
72
+ font-size: var(--bit-p-xs, 14px);
73
+ color: var(--bit-text-color-light, #6c707c);
74
+ width: calc(100% - 24px);
75
+ }
76
+
77
+ .descriptionText {
78
+ width: 100%;
79
+ }
80
+
81
+ .envLink {
82
+ color: white;
83
+ text-decoration: none;
84
+ }
@@ -0,0 +1 @@
1
+ export { EnvsFilter } from './envs-filter';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvsFilter = void 0;
4
+ var envs_filter_1 = require("./envs-filter");
5
+ Object.defineProperty(exports, "EnvsFilter", { enumerable: true, get: function () { return envs_filter_1.EnvsFilter; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAAlC,yGAAA,UAAU,OAAA"}
@@ -0,0 +1,7 @@
1
+ ;
2
+ ;
3
+
4
+ export const compositions = [];
5
+ export const overview = [];
6
+
7
+ export const compositions_metadata = {"compositions":[]};
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from 'react';
2
+ import { ComponentID } from '@teambit/component';
3
+ import type { ComponentFilterCriteria } from '@teambit/component.ui.component-filters.component-filter-context';
4
+ export interface ItemType {
5
+ value: string;
6
+ icon: ReactNode;
7
+ description: string;
8
+ checked?: boolean;
9
+ element: ReactNode;
10
+ }
11
+ export type EnvFilterEnvState = {
12
+ active: boolean;
13
+ icon?: string;
14
+ displayName: string;
15
+ id: string;
16
+ description: string;
17
+ componentId: ComponentID;
18
+ };
19
+ export type EnvFilterState = {
20
+ envsState: Map<string, EnvFilterEnvState>;
21
+ dropdownState: boolean;
22
+ };
23
+ export type EnvsFilterCriteria = ComponentFilterCriteria<EnvFilterState>;
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import { ComponentUrl } from '@teambit/component.modules.component-url';
3
+ import { Ellipsis } from '@teambit/design.ui.styles.ellipsis';
4
+ import { Tooltip } from '@teambit/design.ui.tooltip';
5
+ import { Link } from '@teambit/base-react.navigation.link';
6
+ import type { EnvFilterEnvState } from './types';
7
+ import styles from './envs-filter.module.scss';
8
+
9
+ export function EnvsPlaceholder({ onClick }: { onClick?: () => void }) {
10
+ return (
11
+ <div className={styles.filterIcon} onClick={onClick}>
12
+ <img src="https://static.bit.dev/bit-icons/env.svg" />
13
+ <span className={styles.filterIconLabel}>Environments</span>
14
+ <div className={styles.dropdownArrow}>
15
+ <img src="https://static.bit.dev/bit-icons/fat-arrow-down.svg" />
16
+ </div>
17
+ </div>
18
+ );
19
+ }
20
+
21
+ export function EnvsDropdownItem({ displayName, icon, description, componentId, id }: EnvFilterEnvState) {
22
+ return (
23
+ <Tooltip
24
+ placement="right"
25
+ content={
26
+ <Link
27
+ className={styles.envLink}
28
+ href={ComponentUrl.toUrl(componentId, { includeVersion: false })}
29
+ external={true}
30
+ >
31
+ {id}
32
+ </Link>
33
+ }
34
+ >
35
+ <div className={styles.envDropdownItemContainer}>
36
+ <div className={styles.envDropdownItem}>
37
+ <Ellipsis>{displayName}</Ellipsis>
38
+ <div className={styles.envDropdownItemIconContainer}>
39
+ <img className={styles.envDropdownItemIcon} src={icon}></img>
40
+ </div>
41
+ </div>
42
+ <div className={styles.description}>
43
+ <Ellipsis className={styles.descriptionText}>{description}</Ellipsis>
44
+ </div>
45
+ </div>
46
+ </Tooltip>
47
+ );
48
+ }
@@ -0,0 +1,84 @@
1
+ .envsFilterContainer {
2
+ > div {
3
+ line-height: 16px;
4
+ display: flex;
5
+ }
6
+
7
+ .filterIcon {
8
+ display: flex;
9
+ padding: 8px;
10
+ border-radius: 8px;
11
+
12
+ &:hover {
13
+ background: var(--bit-bg-heavy, #f6f6f6);
14
+ cursor: pointer;
15
+ }
16
+
17
+ img {
18
+ width: 16px;
19
+ filter: invert(44%) sepia(7%) saturate(560%) hue-rotate(187deg) brightness(96%) contrast(91%);
20
+ }
21
+
22
+ .filterIconLabel {
23
+ margin: 0px 8px;
24
+ font-size: 14px;
25
+ }
26
+
27
+ .dropdownArrow {
28
+ display: flex;
29
+ }
30
+ }
31
+ }
32
+
33
+ .envFilterDropdown {
34
+ width: 300px;
35
+ }
36
+ .dropdownContent {
37
+ overflow: auto;
38
+ max-height: 30vh;
39
+ }
40
+
41
+ .doneButton {
42
+ transition: none;
43
+ }
44
+
45
+ .envDropdownItemContainer {
46
+ display: flex;
47
+ width: calc(100% - 24px);
48
+ align-items: baseline;
49
+ flex-direction: column;
50
+ }
51
+
52
+ .envDropdownItemIconContainer {
53
+ display: flex;
54
+ height: 16px;
55
+ width: 16px;
56
+ }
57
+
58
+ .envDropdownItem {
59
+ display: flex;
60
+ justify-content: space-between;
61
+ width: 100%;
62
+ font-size: var(--bit-p-md, 16px);
63
+ }
64
+
65
+ .envDropdownItemIcon {
66
+ display: flex;
67
+ justify-content: space-between;
68
+ padding-left: 8px;
69
+ }
70
+
71
+ .description {
72
+ font-size: var(--bit-p-xs, 14px);
73
+ color: var(--bit-text-color-light, #6c707c);
74
+ width: calc(100% - 24px);
75
+ }
76
+
77
+ .descriptionText {
78
+ width: 100%;
79
+ }
80
+
81
+ .envLink {
82
+ color: white;
83
+ text-decoration: none;
84
+ }
@@ -0,0 +1,172 @@
1
+ import React, { useMemo, useEffect, useState } from 'react';
2
+ import classNames from 'classnames';
3
+ import type { ComponentModel } from '@teambit/component';
4
+ import { ComponentID } from '@teambit/component';
5
+ import type { ComponentFilterRenderProps } from '@teambit/component.ui.component-filters.component-filter-context';
6
+ import {
7
+ useComponentFilter,
8
+ useComponentFilters,
9
+ runAllFilters,
10
+ } from '@teambit/component.ui.component-filters.component-filter-context';
11
+ import { CheckboxItem } from '@teambit/design.inputs.selectors.checkbox-item';
12
+ import { Dropdown, ButtonsPlugin } from '@teambit/design.inputs.dropdown';
13
+ import { EnvsPlaceholder, EnvsDropdownItem } from './dropdown-item';
14
+ import type { EnvsFilterCriteria, EnvFilterEnvState, ItemType } from './types';
15
+ import styles from './envs-filter.module.scss';
16
+
17
+ export const EnvsFilter: EnvsFilterCriteria = {
18
+ id: 'envs',
19
+ match: ({ component }, filter) => {
20
+ const { envsState } = filter;
21
+ const areAllEnvsActive = [...envsState.values()].every((envState) => envState.active);
22
+ const activeEnvs = [...envsState.values()].filter((envState) => envState.active).map((envState) => envState.id);
23
+ // match everything when no envs are set or all envs are set
24
+ if (activeEnvs.length === 0 || areAllEnvsActive) return true;
25
+
26
+ const envId =
27
+ component.environment && ComponentID.tryFromString(component.environment.id)?.toStringWithoutVersion();
28
+
29
+ const matches = !!envId && activeEnvs.indexOf(envId) >= 0;
30
+ return matches;
31
+ },
32
+ state: {
33
+ envsState: new Map<string, EnvFilterEnvState>(),
34
+ dropdownState: false,
35
+ },
36
+ order: 1,
37
+ render: envsFilter,
38
+ };
39
+
40
+ const deriveEnvsFilterState = (components: ComponentModel[]) => {
41
+ return useMemo(() => {
42
+ const defaultState = {
43
+ dropdownState: false,
44
+ envsState: new Map<string, EnvFilterEnvState>(),
45
+ };
46
+
47
+ const componentEnvSet = new Set<string>();
48
+
49
+ const componentsEnvsWithIcons = components
50
+ .filter((component) => {
51
+ const envId = component.environment && ComponentID.tryFromString(component.environment.id);
52
+
53
+ if (!envId) return false;
54
+
55
+ const envKey = envId.toStringWithoutVersion();
56
+
57
+ if (componentEnvSet.has(envKey)) return false;
58
+
59
+ componentEnvSet.add(envKey);
60
+
61
+ return true;
62
+ })
63
+ .map((component) => {
64
+ const envId = ComponentID.fromString(component.environment?.id as string);
65
+ return {
66
+ displayName: envId.name,
67
+ id: envId.toStringWithoutVersion(),
68
+ description: `${envId.scope}${envId.namespace ? '/'.concat(envId.namespace) : ''}`,
69
+ icon: component.environment?.icon,
70
+ componentId: envId,
71
+ };
72
+ });
73
+
74
+ componentsEnvsWithIcons.forEach((componentEnvWithIcon) => {
75
+ defaultState.envsState.set(componentEnvWithIcon.id, { ...componentEnvWithIcon, active: true });
76
+ });
77
+
78
+ return defaultState;
79
+ }, [components]);
80
+ };
81
+
82
+ function envsFilter({ components, className, lanes }: ComponentFilterRenderProps) {
83
+ const [filters = []] = useComponentFilters() || [];
84
+ const filtersExceptEnv = filters.filter((filter) => filter.id !== EnvsFilter.id);
85
+ const filteredComponents = useMemo(
86
+ () => runAllFilters(filtersExceptEnv, { components, lanes }),
87
+ [JSON.stringify(filtersExceptEnv), lanes?.viewedLane?.id.toString()]
88
+ );
89
+ const envsFilterState = deriveEnvsFilterState(filteredComponents);
90
+ const filterContext = useComponentFilter(EnvsFilter.id, envsFilterState);
91
+ const envs = envsFilterState.envsState;
92
+ const [currentFilter, updateFilter] = filterContext || [];
93
+ const [open, setOpen] = useState(false);
94
+
95
+ /**
96
+ * this will not work if other filters in a single re-render
97
+ * result in the same number of components with different ids
98
+ */
99
+ useEffect(() => {
100
+ updateFilter?.((currentState) => {
101
+ currentState.state = envsFilterState;
102
+ return currentState;
103
+ });
104
+ }, [filteredComponents.length, lanes?.viewedLane?.id.toString()]);
105
+
106
+ const selectList: ItemType[] = [];
107
+
108
+ envs.forEach((state) => {
109
+ selectList.push({
110
+ value: state.id,
111
+ icon: state.icon,
112
+ description: state.description,
113
+ checked: !!currentFilter?.state.envsState.get(state.id)?.active,
114
+ element: <EnvsDropdownItem {...state} />,
115
+ });
116
+ });
117
+
118
+ const onCheck = (value: string, e: React.ChangeEvent<HTMLInputElement>) => {
119
+ const checked = e.target.checked;
120
+
121
+ updateFilter?.((currentState) => {
122
+ if (checked && !currentState.state.dropdownState) {
123
+ currentState.state.dropdownState = true;
124
+ }
125
+
126
+ const currentEnvState = currentState.state.envsState.get(value);
127
+
128
+ if (!currentEnvState) return currentState;
129
+
130
+ currentState.state.envsState.set(value, { ...currentEnvState, active: checked });
131
+ return currentState;
132
+ });
133
+ };
134
+
135
+ const onClear = () => {
136
+ updateFilter?.((currentState) => {
137
+ currentState.state.envsState.forEach((value, key) => {
138
+ currentState.state.envsState.set(key, { ...value, active: false });
139
+ });
140
+ return currentState;
141
+ });
142
+ };
143
+
144
+ const onSubmit = () => {
145
+ updateFilter?.((currentState) => {
146
+ currentState.state.dropdownState = false;
147
+ return currentState;
148
+ });
149
+ setOpen(false);
150
+ };
151
+
152
+ return (
153
+ <div className={classNames(styles.envsFilterContainer, className)}>
154
+ <Dropdown
155
+ open={open}
156
+ onClickOutside={() => setOpen(false)}
157
+ placeholderContent={<EnvsPlaceholder onClick={() => setOpen(!open)} />}
158
+ bottomPlugin={<ButtonsPlugin onClear={onClear} onSubmit={onSubmit} submitClassName={styles.doneButton} />}
159
+ dropClass={styles.envFilterDropdown}
160
+ position="bottom"
161
+ >
162
+ <div className={styles.dropdownContent}>
163
+ {selectList.map((option, index) => (
164
+ <CheckboxItem key={index} checked={option.checked} onInputChanged={(e) => onCheck(option.value, e)}>
165
+ {option.element}
166
+ </CheckboxItem>
167
+ ))}
168
+ </div>
169
+ </Dropdown>
170
+ </div>
171
+ );
172
+ }
package/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { EnvsFilter } from './envs-filter';
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@teambit/component.ui.component-filters.env-filter",
3
+ "version": "0.0.0-0075f8c61eb26003cb098208b4da4427a2653ea7",
4
+ "homepage": "https://bit.cloud/teambit/component/ui/component-filters/env-filter",
5
+ "main": "dist/index.js",
6
+ "componentId": {
7
+ "scope": "teambit.component",
8
+ "name": "ui/component-filters/env-filter",
9
+ "version": "0075f8c61eb26003cb098208b4da4427a2653ea7"
10
+ },
11
+ "dependencies": {
12
+ "classnames": "^2.5.1",
13
+ "core-js": "^3.0.0",
14
+ "@teambit/component.modules.component-url": "0.0.182",
15
+ "@teambit/design.ui.styles.ellipsis": "0.0.357",
16
+ "@teambit/component.ui.component-filters.component-filter-context": "0.0.239",
17
+ "@teambit/design.inputs.selectors.checkbox-item": "1.2.0",
18
+ "@teambit/design.inputs.dropdown": "1.3.3",
19
+ "@teambit/design.ui.tooltip": "0.0.0-419176d8ff42306eb268f3249b7894270d450d7f"
20
+ },
21
+ "devDependencies": {
22
+ "@types/react": "^17.0.8",
23
+ "@types/classnames": "^2.3.4",
24
+ "@types/mocha": "9.1.0",
25
+ "@types/node": "12.20.4",
26
+ "@types/react-dom": "^17.0.5",
27
+ "@types/jest": "^26.0.0",
28
+ "@babel/runtime": "7.20.0",
29
+ "@types/testing-library__jest-dom": "5.9.5"
30
+ },
31
+ "peerDependencies": {
32
+ "react": "^16.8.0 || ^17.0.0",
33
+ "react-dom": "^16.8.0 || ^17.0.0",
34
+ "@teambit/base-react.navigation.link": "2.0.33"
35
+ },
36
+ "license": "Apache-2.0",
37
+ "optionalDependencies": {},
38
+ "peerDependenciesMeta": {},
39
+ "private": false,
40
+ "engines": {
41
+ "node": ">=12.22.0"
42
+ },
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/teambit/bit"
46
+ },
47
+ "keywords": [
48
+ "bit",
49
+ "components",
50
+ "collaboration",
51
+ "web",
52
+ "react",
53
+ "react-components",
54
+ "angular",
55
+ "angular-components"
56
+ ]
57
+ }
@@ -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
+ }
package/types.ts ADDED
@@ -0,0 +1,27 @@
1
+ import type { ReactNode } from 'react';
2
+ import { ComponentID } from '@teambit/component';
3
+ import type { ComponentFilterCriteria } from '@teambit/component.ui.component-filters.component-filter-context';
4
+
5
+ export interface ItemType {
6
+ value: string;
7
+ icon: ReactNode;
8
+ description: string;
9
+ checked?: boolean;
10
+ element: ReactNode;
11
+ }
12
+
13
+ export type EnvFilterEnvState = {
14
+ active: boolean;
15
+ icon?: string;
16
+ displayName: string;
17
+ id: string;
18
+ description: string;
19
+ componentId: ComponentID;
20
+ };
21
+
22
+ export type EnvFilterState = {
23
+ envsState: Map<string, EnvFilterEnvState>;
24
+ dropdownState: boolean;
25
+ };
26
+
27
+ export type EnvsFilterCriteria = ComponentFilterCriteria<EnvFilterState>;