@openproject/primer-view-components 0.18.1 → 0.19.0-rc.850d7cdb
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/alpha/action_menu/action_menu_element.d.ts +20 -0
- package/app/assets/javascripts/app/components/primer/beta/nav_list.d.ts +0 -11
- package/app/assets/javascripts/app/components/primer/beta/nav_list_group_element.d.ts +19 -0
- package/app/assets/javascripts/app/components/primer/primer.d.ts +1 -0
- 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/alpha/action_list.css +1 -1
- package/app/components/primer/alpha/action_list.css.json +1 -0
- package/app/components/primer/alpha/action_menu/action_menu_element.d.ts +20 -0
- package/app/components/primer/alpha/action_menu/action_menu_element.js +85 -11
- package/app/components/primer/alpha/overlay.css +1 -1
- package/app/components/primer/alpha/overlay.css.json +2 -1
- package/app/components/primer/alpha/tool_tip.js +8 -4
- package/app/components/primer/beta/blankslate.css +1 -1
- package/app/components/primer/beta/button.css +1 -1
- package/app/components/primer/beta/button.css.json +9 -8
- package/app/components/primer/beta/nav_list.d.ts +0 -11
- package/app/components/primer/beta/nav_list.js +2 -85
- package/app/components/primer/beta/nav_list_group_element.d.ts +19 -0
- package/app/components/primer/beta/nav_list_group_element.js +108 -0
- package/app/components/primer/primer.d.ts +1 -0
- package/app/components/primer/primer.js +1 -0
- package/package.json +9 -9
- package/static/arguments.json +92 -1
- package/static/audited_at.json +4 -1
- package/static/classes.json +3 -0
- package/static/constants.json +9 -0
- package/static/info_arch.json +256 -52
- package/static/previews.json +52 -0
- package/static/statuses.json +3 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class NavListGroupElement extends HTMLElement {
|
|
2
|
+
#private;
|
|
3
|
+
showMoreItem: HTMLElement;
|
|
4
|
+
focusMarkers: HTMLElement[];
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
get showMoreDisabled(): boolean;
|
|
7
|
+
set showMoreDisabled(value: boolean);
|
|
8
|
+
set currentPage(value: number);
|
|
9
|
+
get currentPage(): number;
|
|
10
|
+
get totalPages(): number;
|
|
11
|
+
get paginationSrc(): string;
|
|
12
|
+
private showMore;
|
|
13
|
+
private setShowMoreItemState;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface Window {
|
|
17
|
+
NavListGroupElement: typeof NavListGroupElement;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _NavListGroupElement_instances, _NavListGroupElement_parseHTML;
|
|
13
|
+
import { controller, target, targets } from '@github/catalyst';
|
|
14
|
+
let NavListGroupElement = class NavListGroupElement extends HTMLElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
_NavListGroupElement_instances.add(this);
|
|
18
|
+
}
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
this.setShowMoreItemState();
|
|
21
|
+
}
|
|
22
|
+
get showMoreDisabled() {
|
|
23
|
+
return this.showMoreItem.hasAttribute('aria-disabled');
|
|
24
|
+
}
|
|
25
|
+
set showMoreDisabled(value) {
|
|
26
|
+
if (value) {
|
|
27
|
+
this.showMoreItem.setAttribute('aria-disabled', 'true');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.showMoreItem.removeAttribute('aria-disabled');
|
|
31
|
+
}
|
|
32
|
+
this.showMoreItem.classList.toggle('disabled', value);
|
|
33
|
+
}
|
|
34
|
+
set currentPage(value) {
|
|
35
|
+
this.showMoreItem.setAttribute('data-current-page', value.toString());
|
|
36
|
+
}
|
|
37
|
+
get currentPage() {
|
|
38
|
+
return parseInt(this.showMoreItem.getAttribute('data-current-page')) || 1;
|
|
39
|
+
}
|
|
40
|
+
get totalPages() {
|
|
41
|
+
return parseInt(this.showMoreItem.getAttribute('data-total-pages')) || 1;
|
|
42
|
+
}
|
|
43
|
+
get paginationSrc() {
|
|
44
|
+
return this.showMoreItem.getAttribute('src') || '';
|
|
45
|
+
}
|
|
46
|
+
async showMore(e) {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
if (this.showMoreDisabled)
|
|
50
|
+
return;
|
|
51
|
+
this.showMoreDisabled = true;
|
|
52
|
+
let html;
|
|
53
|
+
try {
|
|
54
|
+
const paginationURL = new URL(this.paginationSrc, window.location.origin);
|
|
55
|
+
this.currentPage++;
|
|
56
|
+
paginationURL.searchParams.append('page', this.currentPage.toString());
|
|
57
|
+
const response = await fetch(paginationURL);
|
|
58
|
+
if (!response.ok)
|
|
59
|
+
return;
|
|
60
|
+
html = await response.text();
|
|
61
|
+
if (this.currentPage === this.totalPages) {
|
|
62
|
+
this.showMoreItem.hidden = true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
// Ignore network errors
|
|
67
|
+
this.showMoreDisabled = false;
|
|
68
|
+
this.currentPage--;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const fragment = __classPrivateFieldGet(this, _NavListGroupElement_instances, "m", _NavListGroupElement_parseHTML).call(this, document, html);
|
|
72
|
+
(_a = fragment === null || fragment === void 0 ? void 0 : fragment.querySelector('li > a')) === null || _a === void 0 ? void 0 : _a.setAttribute('data-targets', 'nav-list-group.focusMarkers');
|
|
73
|
+
const listId = e.target.closest('button').getAttribute('data-list-id');
|
|
74
|
+
const list = document.getElementById(listId);
|
|
75
|
+
list.append(fragment);
|
|
76
|
+
(_b = this.focusMarkers.pop()) === null || _b === void 0 ? void 0 : _b.focus();
|
|
77
|
+
this.showMoreDisabled = false;
|
|
78
|
+
}
|
|
79
|
+
setShowMoreItemState() {
|
|
80
|
+
if (!this.showMoreItem) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (this.currentPage < this.totalPages) {
|
|
84
|
+
this.showMoreItem.hidden = false;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.showMoreItem.hidden = true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
_NavListGroupElement_instances = new WeakSet();
|
|
92
|
+
_NavListGroupElement_parseHTML = function _NavListGroupElement_parseHTML(document, html) {
|
|
93
|
+
const template = document.createElement('template');
|
|
94
|
+
// eslint-disable-next-line github/no-inner-html
|
|
95
|
+
template.innerHTML = html;
|
|
96
|
+
return document.importNode(template.content, true);
|
|
97
|
+
};
|
|
98
|
+
__decorate([
|
|
99
|
+
target
|
|
100
|
+
], NavListGroupElement.prototype, "showMoreItem", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
targets
|
|
103
|
+
], NavListGroupElement.prototype, "focusMarkers", void 0);
|
|
104
|
+
NavListGroupElement = __decorate([
|
|
105
|
+
controller
|
|
106
|
+
], NavListGroupElement);
|
|
107
|
+
export { NavListGroupElement };
|
|
108
|
+
window.NavListGroupElement = NavListGroupElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openproject/primer-view-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0-rc.850d7cdb",
|
|
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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@github/auto-check-element": "^5.2.0",
|
|
46
|
-
"@github/auto-complete-element": "^3.
|
|
46
|
+
"@github/auto-complete-element": "^3.6.0",
|
|
47
47
|
"@github/catalyst": "^1.6.0",
|
|
48
48
|
"@github/clipboard-copy-element": "^1.3.0",
|
|
49
49
|
"@github/details-menu-element": "^1.0.12",
|
|
@@ -51,19 +51,19 @@
|
|
|
51
51
|
"@github/include-fragment-element": "^6.1.1",
|
|
52
52
|
"@github/relative-time-element": "^4.0.0",
|
|
53
53
|
"@github/tab-container-element": "^3.1.2",
|
|
54
|
-
"@oddbird/popover-polyfill": "^0.3.
|
|
54
|
+
"@oddbird/popover-polyfill": "^0.3.6",
|
|
55
55
|
"@primer/behaviors": "^1.3.4"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@changesets/changelog-github": "^0.
|
|
58
|
+
"@changesets/changelog-github": "^0.5.0",
|
|
59
59
|
"@changesets/cli": "^2.24.1",
|
|
60
60
|
"@github/axe-github": "^0.6.1",
|
|
61
61
|
"@github/browserslist-config": "^1.0.0",
|
|
62
|
-
"@github/markdownlint-github": "^0.
|
|
62
|
+
"@github/markdownlint-github": "^0.6.0",
|
|
63
63
|
"@github/prettier-config": "0.0.6",
|
|
64
64
|
"@playwright/test": "^1.35.1",
|
|
65
|
-
"@primer/css": "21.0
|
|
66
|
-
"@primer/primitives": "
|
|
65
|
+
"@primer/css": "21.1.0",
|
|
66
|
+
"@primer/primitives": "7.15.4",
|
|
67
67
|
"@primer/stylelint-config": "^12.7.2",
|
|
68
68
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
69
69
|
"@rollup/plugin-typescript": "^8.3.3",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"eslint": "^8.23.1",
|
|
76
76
|
"eslint-plugin-custom-elements": "^0.0.6",
|
|
77
77
|
"eslint-plugin-github": "^4.9.2",
|
|
78
|
-
"eslint-plugin-prettier": "^
|
|
79
|
-
"markdownlint-cli2": "^0.
|
|
78
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
79
|
+
"markdownlint-cli2": "^0.11.0",
|
|
80
80
|
"mocha": "^10.0.0",
|
|
81
81
|
"playwright": "^1.35.1",
|
|
82
82
|
"postcss": "^8.4.16",
|
package/static/arguments.json
CHANGED
|
@@ -217,6 +217,12 @@
|
|
|
217
217
|
"default": "`nil`",
|
|
218
218
|
"description": "Item label. If no label is provided, content is used."
|
|
219
219
|
},
|
|
220
|
+
{
|
|
221
|
+
"name": "item_id",
|
|
222
|
+
"type": "String",
|
|
223
|
+
"default": "`nil`",
|
|
224
|
+
"description": "An ID that will be attached to the item's `<li>` element as `data-item-id` for distinguishing between items, perhaps in JavaScript."
|
|
225
|
+
},
|
|
220
226
|
{
|
|
221
227
|
"name": "label_classes",
|
|
222
228
|
"type": "String",
|
|
@@ -386,12 +392,97 @@
|
|
|
386
392
|
]
|
|
387
393
|
},
|
|
388
394
|
{
|
|
389
|
-
"component": "ActionMenu::
|
|
395
|
+
"component": "ActionMenu::Group",
|
|
390
396
|
"status": "alpha",
|
|
391
397
|
"a11y_reviewed": true,
|
|
398
|
+
"short_name": "ActionMenuGroup",
|
|
399
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_menu/group.rb",
|
|
400
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_menu/group/default/",
|
|
401
|
+
"parameters": [
|
|
402
|
+
{
|
|
403
|
+
"name": "id",
|
|
404
|
+
"type": "String",
|
|
405
|
+
"default": "`self.class.generate_id`",
|
|
406
|
+
"description": "HTML ID value."
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"name": "role",
|
|
410
|
+
"type": "Boolean",
|
|
411
|
+
"default": "`nil`",
|
|
412
|
+
"description": "ARIA role describing the function of the list. listbox and menu are a common values."
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"name": "item_classes",
|
|
416
|
+
"type": "String",
|
|
417
|
+
"default": "`nil`",
|
|
418
|
+
"description": "Additional CSS classes to attach to items."
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"name": "scheme",
|
|
422
|
+
"type": "Symbol",
|
|
423
|
+
"default": "`:full`",
|
|
424
|
+
"description": "One of `:full` or `:inset`. `inset` children are offset (vertically and horizontally) from list edges. `full` (default) children are flush (vertically and horizontally) with list edges."
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"name": "show_dividers",
|
|
428
|
+
"type": "Boolean",
|
|
429
|
+
"default": "`false`",
|
|
430
|
+
"description": "Display a divider above each item in the list when it does not follow a header or divider."
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"name": "select_variant",
|
|
434
|
+
"type": "Symbol",
|
|
435
|
+
"default": "`:none`",
|
|
436
|
+
"description": "How items may be selected in the list. One of `:multiple`, `:multiple_checkbox`, `:none`, or `:single`."
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"name": "form_arguments",
|
|
440
|
+
"type": "Hash",
|
|
441
|
+
"default": "`{}`",
|
|
442
|
+
"description": "Allows an `ActionList` to act as a select list in multi- and single-select modes. Pass the `builder:` and `name:` options to this hash. `builder:` should be an instance of `ActionView::Helpers::FormBuilder`, which are created by the standard Rails `#form_with` and `#form_for` helpers. The `name:` option is the desired name of the field that will be included in the params sent to the server on form submission. *NOTE*: Consider using an [ActionMenu](/components/alpha/actionmenu) instead of using this feature directly."
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"name": "system_arguments",
|
|
446
|
+
"type": "Hash",
|
|
447
|
+
"default": "N/A",
|
|
448
|
+
"description": "[System arguments](/system-arguments)"
|
|
449
|
+
}
|
|
450
|
+
]
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"component": "ActionMenu::Heading",
|
|
454
|
+
"status": "alpha",
|
|
455
|
+
"a11y_reviewed": false,
|
|
456
|
+
"short_name": "ActionMenuHeading",
|
|
457
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_menu/heading.rb",
|
|
458
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_menu/heading/default/",
|
|
459
|
+
"parameters": [
|
|
460
|
+
|
|
461
|
+
]
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"component": "ActionMenu::List",
|
|
465
|
+
"status": "alpha",
|
|
466
|
+
"a11y_reviewed": false,
|
|
392
467
|
"short_name": "ActionMenuList",
|
|
393
468
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_menu/list.rb",
|
|
394
469
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_menu/list/default/",
|
|
470
|
+
"parameters": [
|
|
471
|
+
{
|
|
472
|
+
"name": "system_arguments",
|
|
473
|
+
"type": "Hash",
|
|
474
|
+
"default": "N/A",
|
|
475
|
+
"description": "The arguments accepted by [ActionList](/components/alpha/actionlist)"
|
|
476
|
+
}
|
|
477
|
+
]
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"component": "ActionMenu::ListWrapper",
|
|
481
|
+
"status": "alpha",
|
|
482
|
+
"a11y_reviewed": true,
|
|
483
|
+
"short_name": "ActionMenuListWrapper",
|
|
484
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_menu/list_wrapper.rb",
|
|
485
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_menu/list_wrapper/default/",
|
|
395
486
|
"parameters": [
|
|
396
487
|
{
|
|
397
488
|
"name": "menu_id",
|
package/static/audited_at.json
CHANGED
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
"Primer::Alpha::ActionList::Heading": "",
|
|
9
9
|
"Primer::Alpha::ActionList::Item": "",
|
|
10
10
|
"Primer::Alpha::ActionMenu": "",
|
|
11
|
-
"Primer::Alpha::ActionMenu::
|
|
11
|
+
"Primer::Alpha::ActionMenu::Group": "2023-07-10",
|
|
12
|
+
"Primer::Alpha::ActionMenu::Heading": "",
|
|
13
|
+
"Primer::Alpha::ActionMenu::List": "",
|
|
14
|
+
"Primer::Alpha::ActionMenu::ListWrapper": "2023-07-10",
|
|
12
15
|
"Primer::Alpha::AutoComplete": "",
|
|
13
16
|
"Primer::Alpha::AutoComplete::Item": "",
|
|
14
17
|
"Primer::Alpha::Banner": "",
|
package/static/classes.json
CHANGED
package/static/constants.json
CHANGED
|
@@ -125,13 +125,20 @@
|
|
|
125
125
|
"Primer::Alpha::ActionMenu": {
|
|
126
126
|
"DEFAULT_PRELOAD": false,
|
|
127
127
|
"DEFAULT_SELECT_VARIANT": "none",
|
|
128
|
+
"Group": "Primer::Alpha::ActionMenu::Group",
|
|
129
|
+
"Heading": "Primer::Alpha::ActionMenu::Heading",
|
|
128
130
|
"List": "Primer::Alpha::ActionMenu::List",
|
|
131
|
+
"ListWrapper": "Primer::Alpha::ActionMenu::ListWrapper",
|
|
129
132
|
"SELECT_VARIANT_OPTIONS": [
|
|
130
133
|
"single",
|
|
131
134
|
"multiple",
|
|
132
135
|
"none"
|
|
133
136
|
]
|
|
134
137
|
},
|
|
138
|
+
"Primer::Alpha::ActionMenu::Group": {
|
|
139
|
+
},
|
|
140
|
+
"Primer::Alpha::ActionMenu::Heading": {
|
|
141
|
+
},
|
|
135
142
|
"Primer::Alpha::ActionMenu::List": {
|
|
136
143
|
"DEFAULT_ITEM_TAG": "button",
|
|
137
144
|
"ITEM_TAG_OPTIONS": [
|
|
@@ -140,6 +147,8 @@
|
|
|
140
147
|
"button"
|
|
141
148
|
]
|
|
142
149
|
},
|
|
150
|
+
"Primer::Alpha::ActionMenu::ListWrapper": {
|
|
151
|
+
},
|
|
143
152
|
"Primer::Alpha::AutoComplete": {
|
|
144
153
|
"Item": "Primer::Alpha::AutoComplete::Item"
|
|
145
154
|
},
|