@primer/view-components 0.36.6-rc.eb5a847f → 0.37.0-rc.0bf6cc7a
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/components/primer/beta/details_toggle_element.d.ts +39 -0
- package/app/assets/javascripts/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/components/primer/alpha/action_menu/action_menu_element.js +9 -0
- package/app/components/primer/beta/details_toggle_element.d.ts +39 -0
- package/app/components/primer/beta/details_toggle_element.js +60 -0
- package/app/components/primer/primer.d.ts +1 -0
- package/app/components/primer/primer.js +1 -0
- package/package.json +1 -1
- package/static/info_arch.json +64 -55
- package/static/previews.json +13 -52
@@ -129,6 +129,11 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
|
129
129
|
}
|
130
130
|
}), "f");
|
131
131
|
observeMutationsUntilConditionMet(this, () => Boolean(this.invokerElement), () => __classPrivateFieldGet(this, _ActionMenuElement_intersectionObserver, "f").observe(this.invokerElement));
|
132
|
+
// If there's no include fragment, then no async fetching will occur and we can
|
133
|
+
// mark the component as ready.
|
134
|
+
if (!this.includeFragment) {
|
135
|
+
this.setAttribute('data-ready', 'true');
|
136
|
+
}
|
132
137
|
}
|
133
138
|
disconnectedCallback() {
|
134
139
|
__classPrivateFieldGet(this, _ActionMenuElement_abortController, "f").abort();
|
@@ -395,6 +400,8 @@ _ActionMenuElement_handleIncludeFragmentReplaced = function _ActionMenuElement_h
|
|
395
400
|
if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "a", _ActionMenuElement_firstItem_get))
|
396
401
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "a", _ActionMenuElement_firstItem_get).focus();
|
397
402
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_softDisableItems).call(this);
|
403
|
+
// async items have loaded, so component is ready
|
404
|
+
this.setAttribute('data-ready', 'true');
|
398
405
|
};
|
399
406
|
_ActionMenuElement_handleFocusOut = function _ActionMenuElement_handleFocusOut() {
|
400
407
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_hide).call(this);
|
@@ -409,6 +416,8 @@ _ActionMenuElement_isOpen = function _ActionMenuElement_isOpen() {
|
|
409
416
|
return this.popoverElement?.matches(':popover-open');
|
410
417
|
};
|
411
418
|
_ActionMenuElement_setDynamicLabel = function _ActionMenuElement_setDynamicLabel() {
|
419
|
+
if (this.selectVariant !== 'single')
|
420
|
+
return;
|
412
421
|
if (!this.dynamicLabel)
|
413
422
|
return;
|
414
423
|
const invokerLabel = this.invokerLabel;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* A companion Catalyst element for the Details view component. This element
|
3
|
+
* ensures the <details> and <summary> elements markup is properly accessible by
|
4
|
+
* updating the aria-label and aria-expanded attributes on click.
|
5
|
+
*
|
6
|
+
* aria-label values default to "Expand" and "Collapse". To override those
|
7
|
+
* values, use the `data-aria-label-open` and `data-aria-label-closed`
|
8
|
+
* attributes on the summary target.
|
9
|
+
*
|
10
|
+
* @example
|
11
|
+
* ```html
|
12
|
+
* <details-toggle>
|
13
|
+
* <details open=true data-target="details-toggle.detailsTarget">
|
14
|
+
* <summary
|
15
|
+
* aria-expanded="true"
|
16
|
+
* aria-label="Collapse me"
|
17
|
+
* data-target="details-toggle.summaryTarget"
|
18
|
+
* data-action="click:details-toggle#toggle"
|
19
|
+
* data-aria-label-closed="Expand me"
|
20
|
+
* data-aria-label-open="Collapse me"
|
21
|
+
* >
|
22
|
+
* Click me
|
23
|
+
* </summary>
|
24
|
+
* <div>Contents</div>
|
25
|
+
* </details>
|
26
|
+
* </details-toggle>
|
27
|
+
* ```
|
28
|
+
*/
|
29
|
+
declare class DetailsToggleElement extends HTMLElement {
|
30
|
+
detailsTarget: HTMLDetailsElement;
|
31
|
+
summaryTarget: HTMLElement;
|
32
|
+
toggle(): void;
|
33
|
+
}
|
34
|
+
declare global {
|
35
|
+
interface Window {
|
36
|
+
DetailsToggleElement: typeof DetailsToggleElement;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
export {};
|
@@ -0,0 +1,60 @@
|
|
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
|
+
import { controller, target } from '@github/catalyst';
|
8
|
+
/**
|
9
|
+
* A companion Catalyst element for the Details view component. This element
|
10
|
+
* ensures the <details> and <summary> elements markup is properly accessible by
|
11
|
+
* updating the aria-label and aria-expanded attributes on click.
|
12
|
+
*
|
13
|
+
* aria-label values default to "Expand" and "Collapse". To override those
|
14
|
+
* values, use the `data-aria-label-open` and `data-aria-label-closed`
|
15
|
+
* attributes on the summary target.
|
16
|
+
*
|
17
|
+
* @example
|
18
|
+
* ```html
|
19
|
+
* <details-toggle>
|
20
|
+
* <details open=true data-target="details-toggle.detailsTarget">
|
21
|
+
* <summary
|
22
|
+
* aria-expanded="true"
|
23
|
+
* aria-label="Collapse me"
|
24
|
+
* data-target="details-toggle.summaryTarget"
|
25
|
+
* data-action="click:details-toggle#toggle"
|
26
|
+
* data-aria-label-closed="Expand me"
|
27
|
+
* data-aria-label-open="Collapse me"
|
28
|
+
* >
|
29
|
+
* Click me
|
30
|
+
* </summary>
|
31
|
+
* <div>Contents</div>
|
32
|
+
* </details>
|
33
|
+
* </details-toggle>
|
34
|
+
* ```
|
35
|
+
*/
|
36
|
+
let DetailsToggleElement = class DetailsToggleElement extends HTMLElement {
|
37
|
+
toggle() {
|
38
|
+
const detailsIsOpen = this.detailsTarget.hasAttribute('open');
|
39
|
+
if (detailsIsOpen) {
|
40
|
+
const ariaLabelClosed = this.summaryTarget.getAttribute('data-aria-label-closed') || 'Expand';
|
41
|
+
this.summaryTarget.setAttribute('aria-label', ariaLabelClosed);
|
42
|
+
this.summaryTarget.setAttribute('aria-expanded', 'false');
|
43
|
+
}
|
44
|
+
else {
|
45
|
+
const ariaLabelOpen = this.summaryTarget.getAttribute('data-aria-label-open') || 'Collapse';
|
46
|
+
this.summaryTarget.setAttribute('aria-label', ariaLabelOpen);
|
47
|
+
this.summaryTarget.setAttribute('aria-expanded', 'true');
|
48
|
+
}
|
49
|
+
}
|
50
|
+
};
|
51
|
+
__decorate([
|
52
|
+
target
|
53
|
+
], DetailsToggleElement.prototype, "detailsTarget", void 0);
|
54
|
+
__decorate([
|
55
|
+
target
|
56
|
+
], DetailsToggleElement.prototype, "summaryTarget", void 0);
|
57
|
+
DetailsToggleElement = __decorate([
|
58
|
+
controller
|
59
|
+
], DetailsToggleElement);
|
60
|
+
window.DetailsToggleElement = DetailsToggleElement;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/view-components",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.37.0-rc.0bf6cc7a",
|
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/info_arch.json
CHANGED
@@ -3843,7 +3843,18 @@
|
|
3843
3843
|
"name": "button",
|
3844
3844
|
"description": "Required trigger for the dropdown. Has the same arguments as {{#link_to_component}}Primer::ButtonComponent{{/link_to_component}},\nbut it is locked as a `summary` tag.",
|
3845
3845
|
"parameters": [
|
3846
|
-
|
3846
|
+
{
|
3847
|
+
"name": "aria_label_open",
|
3848
|
+
"type": "String",
|
3849
|
+
"default": "N/A",
|
3850
|
+
"description": "Defaults to \"Close\". Value to announce when menu is open."
|
3851
|
+
},
|
3852
|
+
{
|
3853
|
+
"name": "aria_label_closed",
|
3854
|
+
"type": "String",
|
3855
|
+
"default": "N/A",
|
3856
|
+
"description": "Defaults to \"Open\". Value to announce when menu is closed."
|
3857
|
+
}
|
3847
3858
|
]
|
3848
3859
|
},
|
3849
3860
|
{
|
@@ -6178,58 +6189,6 @@
|
|
6178
6189
|
]
|
6179
6190
|
}
|
6180
6191
|
},
|
6181
|
-
{
|
6182
|
-
"preview_path": "primer/alpha/overlay/in_an_action_menu",
|
6183
|
-
"name": "in_an_action_menu",
|
6184
|
-
"snapshot": "false",
|
6185
|
-
"skip_rules": {
|
6186
|
-
"wont_fix": [
|
6187
|
-
"region"
|
6188
|
-
],
|
6189
|
-
"will_fix": [
|
6190
|
-
"color-contrast"
|
6191
|
-
]
|
6192
|
-
}
|
6193
|
-
},
|
6194
|
-
{
|
6195
|
-
"preview_path": "primer/alpha/overlay/dialog_with_header_footer",
|
6196
|
-
"name": "dialog_with_header_footer",
|
6197
|
-
"snapshot": "false",
|
6198
|
-
"skip_rules": {
|
6199
|
-
"wont_fix": [
|
6200
|
-
"region"
|
6201
|
-
],
|
6202
|
-
"will_fix": [
|
6203
|
-
"color-contrast"
|
6204
|
-
]
|
6205
|
-
}
|
6206
|
-
},
|
6207
|
-
{
|
6208
|
-
"preview_path": "primer/alpha/overlay/overlay_with_header_filter",
|
6209
|
-
"name": "overlay_with_header_filter",
|
6210
|
-
"snapshot": "false",
|
6211
|
-
"skip_rules": {
|
6212
|
-
"wont_fix": [
|
6213
|
-
"region"
|
6214
|
-
],
|
6215
|
-
"will_fix": [
|
6216
|
-
"color-contrast"
|
6217
|
-
]
|
6218
|
-
}
|
6219
|
-
},
|
6220
|
-
{
|
6221
|
-
"preview_path": "primer/alpha/overlay/overlay_with_header_subtitle",
|
6222
|
-
"name": "overlay_with_header_subtitle",
|
6223
|
-
"snapshot": "false",
|
6224
|
-
"skip_rules": {
|
6225
|
-
"wont_fix": [
|
6226
|
-
"region"
|
6227
|
-
],
|
6228
|
-
"will_fix": [
|
6229
|
-
"color-contrast"
|
6230
|
-
]
|
6231
|
-
}
|
6232
|
-
},
|
6233
6192
|
{
|
6234
6193
|
"preview_path": "primer/alpha/overlay/in_a_sticky_container",
|
6235
6194
|
"name": "in_a_sticky_container",
|
@@ -13410,9 +13369,26 @@
|
|
13410
13369
|
"slots": [
|
13411
13370
|
{
|
13412
13371
|
"name": "summary",
|
13413
|
-
"description":
|
13372
|
+
"description": "Use the Summary slot as the target for toggling the Details content open/closed.",
|
13414
13373
|
"parameters": [
|
13415
|
-
|
13374
|
+
{
|
13375
|
+
"name": "button",
|
13376
|
+
"type": "Boolean",
|
13377
|
+
"default": "N/A",
|
13378
|
+
"description": "Whether or not to render the summary element as a button."
|
13379
|
+
},
|
13380
|
+
{
|
13381
|
+
"name": "aria_label_open",
|
13382
|
+
"type": "String",
|
13383
|
+
"default": "N/A",
|
13384
|
+
"description": "Defaults to \"Collapse\". Value to announce when details element is open."
|
13385
|
+
},
|
13386
|
+
{
|
13387
|
+
"name": "aria_label_closed",
|
13388
|
+
"type": "String",
|
13389
|
+
"default": "N/A",
|
13390
|
+
"description": "Defaults to \"Expand\". Value to announce when details element is closed."
|
13391
|
+
}
|
13416
13392
|
]
|
13417
13393
|
},
|
13418
13394
|
{
|
@@ -13453,6 +13429,26 @@
|
|
13453
13429
|
],
|
13454
13430
|
"return_types": [
|
13455
13431
|
|
13432
|
+
]
|
13433
|
+
},
|
13434
|
+
{
|
13435
|
+
"name": "open",
|
13436
|
+
"description": "Returns the value of attribute open.",
|
13437
|
+
"parameters": [
|
13438
|
+
|
13439
|
+
],
|
13440
|
+
"return_types": [
|
13441
|
+
|
13442
|
+
]
|
13443
|
+
},
|
13444
|
+
{
|
13445
|
+
"name": "open?",
|
13446
|
+
"description": "Returns the value of attribute open.",
|
13447
|
+
"parameters": [
|
13448
|
+
|
13449
|
+
],
|
13450
|
+
"return_types": [
|
13451
|
+
|
13456
13452
|
]
|
13457
13453
|
}
|
13458
13454
|
],
|
@@ -13508,6 +13504,19 @@
|
|
13508
13504
|
"color-contrast"
|
13509
13505
|
]
|
13510
13506
|
}
|
13507
|
+
},
|
13508
|
+
{
|
13509
|
+
"preview_path": "primer/beta/details/open",
|
13510
|
+
"name": "open",
|
13511
|
+
"snapshot": "false",
|
13512
|
+
"skip_rules": {
|
13513
|
+
"wont_fix": [
|
13514
|
+
"region"
|
13515
|
+
],
|
13516
|
+
"will_fix": [
|
13517
|
+
"color-contrast"
|
13518
|
+
]
|
13519
|
+
}
|
13511
13520
|
}
|
13512
13521
|
],
|
13513
13522
|
"subcomponents": [
|
package/static/previews.json
CHANGED
@@ -3118,6 +3118,19 @@
|
|
3118
3118
|
"color-contrast"
|
3119
3119
|
]
|
3120
3120
|
}
|
3121
|
+
},
|
3122
|
+
{
|
3123
|
+
"preview_path": "primer/beta/details/open",
|
3124
|
+
"name": "open",
|
3125
|
+
"snapshot": "false",
|
3126
|
+
"skip_rules": {
|
3127
|
+
"wont_fix": [
|
3128
|
+
"region"
|
3129
|
+
],
|
3130
|
+
"will_fix": [
|
3131
|
+
"color-contrast"
|
3132
|
+
]
|
3133
|
+
}
|
3121
3134
|
}
|
3122
3135
|
]
|
3123
3136
|
},
|
@@ -4997,58 +5010,6 @@
|
|
4997
5010
|
]
|
4998
5011
|
}
|
4999
5012
|
},
|
5000
|
-
{
|
5001
|
-
"preview_path": "primer/alpha/overlay/in_an_action_menu",
|
5002
|
-
"name": "in_an_action_menu",
|
5003
|
-
"snapshot": "false",
|
5004
|
-
"skip_rules": {
|
5005
|
-
"wont_fix": [
|
5006
|
-
"region"
|
5007
|
-
],
|
5008
|
-
"will_fix": [
|
5009
|
-
"color-contrast"
|
5010
|
-
]
|
5011
|
-
}
|
5012
|
-
},
|
5013
|
-
{
|
5014
|
-
"preview_path": "primer/alpha/overlay/dialog_with_header_footer",
|
5015
|
-
"name": "dialog_with_header_footer",
|
5016
|
-
"snapshot": "false",
|
5017
|
-
"skip_rules": {
|
5018
|
-
"wont_fix": [
|
5019
|
-
"region"
|
5020
|
-
],
|
5021
|
-
"will_fix": [
|
5022
|
-
"color-contrast"
|
5023
|
-
]
|
5024
|
-
}
|
5025
|
-
},
|
5026
|
-
{
|
5027
|
-
"preview_path": "primer/alpha/overlay/overlay_with_header_filter",
|
5028
|
-
"name": "overlay_with_header_filter",
|
5029
|
-
"snapshot": "false",
|
5030
|
-
"skip_rules": {
|
5031
|
-
"wont_fix": [
|
5032
|
-
"region"
|
5033
|
-
],
|
5034
|
-
"will_fix": [
|
5035
|
-
"color-contrast"
|
5036
|
-
]
|
5037
|
-
}
|
5038
|
-
},
|
5039
|
-
{
|
5040
|
-
"preview_path": "primer/alpha/overlay/overlay_with_header_subtitle",
|
5041
|
-
"name": "overlay_with_header_subtitle",
|
5042
|
-
"snapshot": "false",
|
5043
|
-
"skip_rules": {
|
5044
|
-
"wont_fix": [
|
5045
|
-
"region"
|
5046
|
-
],
|
5047
|
-
"will_fix": [
|
5048
|
-
"color-contrast"
|
5049
|
-
]
|
5050
|
-
}
|
5051
|
-
},
|
5052
5013
|
{
|
5053
5014
|
"preview_path": "primer/alpha/overlay/in_a_sticky_container",
|
5054
5015
|
"name": "in_a_sticky_container",
|