@primer/view-components 0.1.6-rc.e9eb5237 → 0.1.6-rc.fbd3190c
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/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_menu/action_menu_element.d.ts +1 -0
- package/app/components/primer/alpha/action_menu/action_menu_element.js +13 -8
- package/app/components/primer/alpha/modal_dialog.js +1 -7
- package/app/components/primer/alpha/overlay.css +1 -1
- package/package.json +1 -1
- package/static/constants.json +2 -8
- package/static/info_arch.json +5 -0
- package/static/previews.json +5 -0
|
@@ -10,6 +10,7 @@ export declare class ActionMenuElement extends HTMLElement {
|
|
|
10
10
|
set dynamicLabel(value: boolean);
|
|
11
11
|
get popoverElement(): HTMLElement | null;
|
|
12
12
|
get invokerElement(): HTMLElement | null;
|
|
13
|
+
get invokerLabel(): HTMLElement | null;
|
|
13
14
|
connectedCallback(): void;
|
|
14
15
|
disconnectedCallback(): void;
|
|
15
16
|
handleEvent(event: Event): void;
|
|
@@ -68,6 +68,11 @@ export class ActionMenuElement extends HTMLElement {
|
|
|
68
68
|
}
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
|
+
get invokerLabel() {
|
|
72
|
+
if (!this.invokerElement)
|
|
73
|
+
return null;
|
|
74
|
+
return this.invokerElement.querySelector('.Button-label');
|
|
75
|
+
}
|
|
71
76
|
connectedCallback() {
|
|
72
77
|
const { signal } = (__classPrivateFieldSet(this, _ActionMenuElement_abortController, new AbortController(), "f"));
|
|
73
78
|
this.addEventListener('keydown', this, { signal });
|
|
@@ -130,21 +135,21 @@ export class ActionMenuElement extends HTMLElement {
|
|
|
130
135
|
_ActionMenuElement_abortController = new WeakMap(), _ActionMenuElement_originalLabel = new WeakMap(), _ActionMenuElement_instances = new WeakSet(), _ActionMenuElement_setDynamicLabel = function _ActionMenuElement_setDynamicLabel() {
|
|
131
136
|
if (!this.dynamicLabel)
|
|
132
137
|
return;
|
|
133
|
-
const
|
|
134
|
-
if (!
|
|
138
|
+
const invokerLabel = this.invokerLabel;
|
|
139
|
+
if (!invokerLabel)
|
|
135
140
|
return;
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
__classPrivateFieldSet(this, _ActionMenuElement_originalLabel, __classPrivateFieldGet(this, _ActionMenuElement_originalLabel, "f") || (
|
|
141
|
+
const itemLabel = this.querySelector('[aria-checked=true] .ActionListItem-label');
|
|
142
|
+
if (itemLabel && this.dynamicLabel) {
|
|
143
|
+
__classPrivateFieldSet(this, _ActionMenuElement_originalLabel, __classPrivateFieldGet(this, _ActionMenuElement_originalLabel, "f") || (invokerLabel.textContent || ''), "f");
|
|
139
144
|
const prefixSpan = document.createElement('span');
|
|
140
145
|
prefixSpan.classList.add('color-fg-muted');
|
|
141
146
|
const contentSpan = document.createElement('span');
|
|
142
147
|
prefixSpan.textContent = this.dynamicLabelPrefix;
|
|
143
|
-
contentSpan.textContent =
|
|
144
|
-
|
|
148
|
+
contentSpan.textContent = itemLabel.textContent || '';
|
|
149
|
+
invokerLabel.replaceChildren(prefixSpan, contentSpan);
|
|
145
150
|
}
|
|
146
151
|
else {
|
|
147
|
-
|
|
152
|
+
invokerLabel.textContent = __classPrivateFieldGet(this, _ActionMenuElement_originalLabel, "f");
|
|
148
153
|
}
|
|
149
154
|
}, _ActionMenuElement_isEnterKeydown = function _ActionMenuElement_isEnterKeydown(event) {
|
|
150
155
|
return (event instanceof KeyboardEvent &&
|
|
@@ -20,13 +20,7 @@ function focusIfNeeded(elem) {
|
|
|
20
20
|
const overlayStack = [];
|
|
21
21
|
function clickHandler(event) {
|
|
22
22
|
const target = event.target;
|
|
23
|
-
|
|
24
|
-
if (target instanceof HTMLButtonElement) {
|
|
25
|
-
button = target;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
button = target === null || target === void 0 ? void 0 : target.querySelector('button');
|
|
29
|
-
}
|
|
23
|
+
const button = target === null || target === void 0 ? void 0 : target.closest('button');
|
|
30
24
|
if (!button)
|
|
31
25
|
return;
|
|
32
26
|
// If the user is clicking a valid dialog trigger
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Overlay[popover]{border-width:0;padding:0;position:absolute
|
|
1
|
+
.Overlay[popover]{border-width:0;min-width:192px;padding:0;position:absolute}.Overlay[popover]:not(:open){display:none}anchored-position{display:block}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/view-components",
|
|
3
|
-
"version": "0.1.6-rc.
|
|
3
|
+
"version": "0.1.6-rc.fbd3190c",
|
|
4
4
|
"description": "ViewComponents for the Primer Design System",
|
|
5
5
|
"main": "app/assets/javascripts/primer_view_components.js",
|
|
6
6
|
"module": "app/components/primer/primer.js",
|
package/static/constants.json
CHANGED
|
@@ -102,18 +102,12 @@
|
|
|
102
102
|
]
|
|
103
103
|
},
|
|
104
104
|
"Primer::Alpha::ActionMenu::List": {
|
|
105
|
-
"DEFAULT_ITEM_TAG": "
|
|
106
|
-
"ITEM_ACTION_OPTIONS": [
|
|
107
|
-
"classes",
|
|
108
|
-
"onclick",
|
|
109
|
-
"href",
|
|
110
|
-
"value"
|
|
111
|
-
],
|
|
105
|
+
"DEFAULT_ITEM_TAG": "button",
|
|
112
106
|
"ITEM_TAG_OPTIONS": [
|
|
113
107
|
"a",
|
|
114
108
|
"button",
|
|
115
109
|
"clipboard-copy",
|
|
116
|
-
"
|
|
110
|
+
"button"
|
|
117
111
|
]
|
|
118
112
|
},
|
|
119
113
|
"Primer::Alpha::AutoComplete": {
|
package/static/info_arch.json
CHANGED
|
@@ -695,6 +695,11 @@
|
|
|
695
695
|
"preview_path": "/lookbook/preview/primer/alpha/action_menu/playground",
|
|
696
696
|
"name": "playground"
|
|
697
697
|
},
|
|
698
|
+
{
|
|
699
|
+
"inspect_path": "/lookbook/inspect/primer/alpha/action_menu/content_labels",
|
|
700
|
+
"preview_path": "/lookbook/preview/primer/alpha/action_menu/content_labels",
|
|
701
|
+
"name": "content_labels"
|
|
702
|
+
},
|
|
698
703
|
{
|
|
699
704
|
"inspect_path": "/lookbook/inspect/primer/alpha/action_menu/default",
|
|
700
705
|
"preview_path": "/lookbook/preview/primer/alpha/action_menu/default",
|
package/static/previews.json
CHANGED
|
@@ -123,6 +123,11 @@
|
|
|
123
123
|
"preview_path": "/lookbook/preview/primer/alpha/action_menu/playground",
|
|
124
124
|
"name": "playground"
|
|
125
125
|
},
|
|
126
|
+
{
|
|
127
|
+
"inspect_path": "/lookbook/inspect/primer/alpha/action_menu/content_labels",
|
|
128
|
+
"preview_path": "/lookbook/preview/primer/alpha/action_menu/content_labels",
|
|
129
|
+
"name": "content_labels"
|
|
130
|
+
},
|
|
126
131
|
{
|
|
127
132
|
"inspect_path": "/lookbook/inspect/primer/alpha/action_menu/default",
|
|
128
133
|
"preview_path": "/lookbook/preview/primer/alpha/action_menu/default",
|