@openproject/primer-view-components 0.45.0 → 0.46.0-rc.7fd653fd
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/app/assets/javascripts/app/components/primer/open_project/sub_header_element.d.ts +5 -1
- package/app/assets/javascripts/primer_view_components.js +1 -1
- package/app/assets/javascripts/primer_view_components.js.map +1 -1
- package/app/assets/styles/primer_view_components.css +1 -1
- package/app/assets/styles/primer_view_components.css.map +1 -1
- package/app/components/primer/open_project/sub_header.css +1 -1
- package/app/components/primer/open_project/sub_header.css.json +3 -1
- package/app/components/primer/open_project/sub_header_element.d.ts +5 -1
- package/app/components/primer/open_project/sub_header_element.js +32 -0
- package/package.json +1 -1
- package/static/classes.json +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
.SubHeader{align-items:center;display:grid;grid-template-areas:"left middle right" "bottom bottom bottom";grid-template-columns:auto 1fr auto;margin-bottom:16px}.SubHeader--expandedSearch{grid-template-areas:"left left left" "bottom bottom bottom"}.SubHeader-rightPane{align-items:center;column-gap:12px;display:flex;grid-area:right}.SubHeader-middlePane{grid-area:middle;text-align:center}.SubHeader-bottomPane{grid-area:bottom}.SubHeader-leftPane{align-items:center;display:flex;gap:12px;grid-area:left;width:100%}.SubHeader-filterContainer{display:flex;gap:8px;width:100%}
|
|
1
|
+
.SubHeader{align-items:center;display:grid;grid-template-areas:"left middle right" "bottom bottom bottom";grid-template-columns:auto 1fr auto;margin-bottom:16px}.SubHeader--expandedSearch{grid-template-areas:"left left left" "bottom bottom bottom"}.SubHeader-rightPane{align-items:center;column-gap:12px;display:flex;grid-area:right}.SubHeader-middlePane{grid-area:middle;text-align:center}.SubHeader-bottomPane{grid-area:bottom}.SubHeader-leftPane{align-items:center;display:flex;gap:12px;grid-area:left;width:100%}:is(.SubHeader-leftPane [class*=FormControl-input-width--]):not(.FormControl-input-width--auto){width:100vw}.SubHeader-filterContainer{display:flex;gap:8px;width:100%}.SubHeader-filterInput_hiddenClearButton+button.FormControl-input-trailingAction{display:none}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
".SubHeader-middlePane",
|
|
8
8
|
".SubHeader-bottomPane",
|
|
9
9
|
".SubHeader-leftPane",
|
|
10
|
-
".SubHeader-
|
|
10
|
+
":is(.SubHeader-leftPane [class*=FormControl-input-width--]):not(.FormControl-input-width--auto)",
|
|
11
|
+
".SubHeader-filterContainer",
|
|
12
|
+
".SubHeader-filterInput_hiddenClearButton+button.FormControl-input-trailingAction"
|
|
11
13
|
]
|
|
12
14
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
declare class SubHeaderElement extends HTMLElement {
|
|
2
|
-
filterInput:
|
|
2
|
+
filterInput: HTMLInputElement;
|
|
3
3
|
hiddenItemsOnExpandedFilter: HTMLElement[];
|
|
4
4
|
shownItemsOnExpandedFilter: HTMLElement[];
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
setupFilterInputClearButton(): void;
|
|
7
|
+
toggleFilterInputClearButton(): void;
|
|
5
8
|
expandFilterInput(): void;
|
|
6
9
|
collapseFilterInput(): void;
|
|
10
|
+
private waitForCondition;
|
|
7
11
|
}
|
|
8
12
|
declare global {
|
|
9
13
|
interface Window {
|
|
@@ -6,6 +6,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { controller, target, targets } from '@github/catalyst';
|
|
8
8
|
let SubHeaderElement = class SubHeaderElement extends HTMLElement {
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
this.setupFilterInputClearButton();
|
|
11
|
+
}
|
|
12
|
+
setupFilterInputClearButton() {
|
|
13
|
+
this.waitForCondition(() => Boolean(this.filterInput), () => {
|
|
14
|
+
this.toggleFilterInputClearButton();
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
toggleFilterInputClearButton() {
|
|
18
|
+
if (this.filterInput.value.length > 0) {
|
|
19
|
+
this.filterInput.classList.remove('SubHeader-filterInput_hiddenClearButton');
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.filterInput.classList.add('SubHeader-filterInput_hiddenClearButton');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
9
25
|
expandFilterInput() {
|
|
10
26
|
for (const item of this.hiddenItemsOnExpandedFilter) {
|
|
11
27
|
item.classList.add('d-none');
|
|
@@ -25,6 +41,22 @@ let SubHeaderElement = class SubHeaderElement extends HTMLElement {
|
|
|
25
41
|
}
|
|
26
42
|
this.classList.remove('SubHeader--expandedSearch');
|
|
27
43
|
}
|
|
44
|
+
// Waits for condition to return true. If it returns false initially, this function creates a
|
|
45
|
+
// MutationObserver that calls body() whenever the contents of the component change.
|
|
46
|
+
waitForCondition(condition, body) {
|
|
47
|
+
if (condition()) {
|
|
48
|
+
body();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const mutationObserver = new MutationObserver(() => {
|
|
52
|
+
if (condition()) {
|
|
53
|
+
body();
|
|
54
|
+
mutationObserver.disconnect();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
mutationObserver.observe(this, { childList: true, subtree: true });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
28
60
|
};
|
|
29
61
|
__decorate([
|
|
30
62
|
target
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openproject/primer-view-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0-rc.7fd653fd",
|
|
4
4
|
"description": "ViewComponents of the Primer Design System for OpenProject",
|
|
5
5
|
"main": "app/assets/javascripts/primer_view_components.js",
|
|
6
6
|
"module": "app/components/primer/primer.js",
|
package/static/classes.json
CHANGED