@openproject/primer-view-components 0.95.0 → 0.96.0-rc.15d08ed15

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.
Files changed (36) hide show
  1. package/app/assets/javascripts/primer_view_components.js +11 -1
  2. package/app/assets/javascripts/primer_view_components.js.map +1 -1
  3. package/app/assets/styles/primer_view_components.css +1 -1
  4. package/app/assets/styles/primer_view_components.css.map +1 -1
  5. package/app/components/primer/alpha/action_list.css +1 -1
  6. package/app/components/primer/alpha/action_list.css.json +2 -0
  7. package/app/components/primer/beta/button.css +1 -1
  8. package/app/components/primer/beta/button.css.json +16 -1
  9. package/app/components/primer/open_project/keybinding_hint/chords.d.ts +5 -0
  10. package/app/components/primer/open_project/keybinding_hint/chords.js +29 -0
  11. package/app/components/primer/open_project/keybinding_hint/key_names.d.ts +16 -0
  12. package/app/components/primer/open_project/keybinding_hint/key_names.js +107 -0
  13. package/app/components/primer/open_project/keybinding_hint/localized_names.d.ts +22 -0
  14. package/app/components/primer/open_project/keybinding_hint/localized_names.js +47 -0
  15. package/app/components/primer/open_project/keybinding_hint/names_from_scope.d.ts +21 -0
  16. package/app/components/primer/open_project/keybinding_hint/names_from_scope.js +81 -0
  17. package/app/components/primer/open_project/keybinding_hint/platform.d.ts +10 -0
  18. package/app/components/primer/open_project/keybinding_hint/platform.js +24 -0
  19. package/app/components/primer/open_project/keybinding_hint/platform_override.d.ts +2 -0
  20. package/app/components/primer/open_project/keybinding_hint/platform_override.js +4 -0
  21. package/app/components/primer/open_project/keybinding_hint.css +1 -0
  22. package/app/components/primer/open_project/keybinding_hint.css.json +10 -0
  23. package/app/components/primer/open_project/keybinding_hint_element.d.ts +31 -0
  24. package/app/components/primer/open_project/keybinding_hint_element.js +183 -0
  25. package/app/components/primer/primer.d.ts +1 -0
  26. package/app/components/primer/primer.js +1 -0
  27. package/package.json +4 -3
  28. package/static/arguments.json +40 -0
  29. package/static/audited_at.json +1 -0
  30. package/static/classes.json +12 -0
  31. package/static/classnames.cjs +4 -0
  32. package/static/classnames.js +4 -0
  33. package/static/constants.json +27 -0
  34. package/static/info_arch.json +194 -6
  35. package/static/previews.json +138 -0
  36. package/static/statuses.json +1 -0
@@ -0,0 +1,183 @@
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 __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13
+ if (kind === "m") throw new TypeError("Private method is not writable");
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
16
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17
+ };
18
+ var _KeybindingHintElement_instances, _KeybindingHintElement_mount, _KeybindingHintElement_signature, _KeybindingHintElement_owned, _KeybindingHintElement_observer, _KeybindingHintElement_update, _KeybindingHintElement_resolvedPlatform, _KeybindingHintElement_resolvedFormat, _KeybindingHintElement_chordClass, _KeybindingHintElement_template, _KeybindingHintElement_keyTemplate;
19
+ import { attr, controller } from '@github/catalyst';
20
+ import { html, render, nothing } from 'lit-html';
21
+ import { detectPlatform } from './keybinding_hint/platform';
22
+ import { isPlatform } from './keybinding_hint/platform_override';
23
+ import { keyName, parseKeyNames } from './keybinding_hint/localized_names';
24
+ import { buildKeyNames } from './keybinding_hint/names_from_scope';
25
+ import { splitSequence } from './keybinding_hint/chords';
26
+ /**
27
+ * Renders keyboard shortcut hints client-side, because only the browser knows
28
+ * the platform (⌘ vs ⌃). The server renders a plain-text fallback inside the
29
+ * chord box; this element replaces it once, then owns a <kbd> mount that
30
+ * lit-html renders into.
31
+ *
32
+ * Attributes (Catalyst `@attr`, so `data-*`): keys, format, scheme, size,
33
+ * platform ('' = detect; 'apple' | 'windows' | 'other' overrides, used by
34
+ * previews and tests), names (JSON of translated key names; see
35
+ * localized_names.ts).
36
+ */
37
+ let KeybindingHintElement = class KeybindingHintElement extends HTMLElement {
38
+ constructor() {
39
+ super(...arguments);
40
+ _KeybindingHintElement_instances.add(this);
41
+ this.keys = '';
42
+ this.format = 'condensed';
43
+ this.scheme = 'default';
44
+ this.size = 'medium';
45
+ this.platform = '';
46
+ this.names = '';
47
+ _KeybindingHintElement_mount.set(this, null);
48
+ _KeybindingHintElement_signature.set(this, ''
49
+ // Whether the mount still holds exactly what lit last rendered. Any
50
+ // mutation we did not make (Turbo morph, stream update, manual innerHTML,
51
+ // even inside a single chord) revokes it, because lit would otherwise
52
+ // update detached markers and leave the foreign content on screen.
53
+ );
54
+ // Whether the mount still holds exactly what lit last rendered. Any
55
+ // mutation we did not make (Turbo morph, stream update, manual innerHTML,
56
+ // even inside a single chord) revokes it, because lit would otherwise
57
+ // update detached markers and leave the foreign content on screen.
58
+ _KeybindingHintElement_owned.set(this, false
59
+ // Every mutation we make is drained with takeRecords() straight after, so
60
+ // any record that is delivered here or still queued in #update is external.
61
+ );
62
+ // Every mutation we make is drained with takeRecords() straight after, so
63
+ // any record that is delivered here or still queued in #update is external.
64
+ _KeybindingHintElement_observer.set(this, new MutationObserver(() => {
65
+ __classPrivateFieldSet(this, _KeybindingHintElement_owned, false, "f");
66
+ __classPrivateFieldGet(this, _KeybindingHintElement_instances, "m", _KeybindingHintElement_update).call(this);
67
+ }));
68
+ }
69
+ connectedCallback() {
70
+ __classPrivateFieldGet(this, _KeybindingHintElement_observer, "f").observe(this, { childList: true, subtree: true, characterData: true });
71
+ __classPrivateFieldGet(this, _KeybindingHintElement_instances, "m", _KeybindingHintElement_update).call(this);
72
+ }
73
+ disconnectedCallback() {
74
+ // Mutations while detached go unobserved, so re-render on reconnect.
75
+ __classPrivateFieldGet(this, _KeybindingHintElement_observer, "f").disconnect();
76
+ __classPrivateFieldSet(this, _KeybindingHintElement_owned, false, "f");
77
+ }
78
+ attributeChangedCallback() {
79
+ // Catalyst fires this for every observed attribute before connectedCallback
80
+ // and once more for each default it writes; #update is idempotent and cheap.
81
+ __classPrivateFieldGet(this, _KeybindingHintElement_instances, "m", _KeybindingHintElement_update).call(this);
82
+ }
83
+ };
84
+ _KeybindingHintElement_mount = new WeakMap();
85
+ _KeybindingHintElement_signature = new WeakMap();
86
+ _KeybindingHintElement_owned = new WeakMap();
87
+ _KeybindingHintElement_observer = new WeakMap();
88
+ _KeybindingHintElement_instances = new WeakSet();
89
+ _KeybindingHintElement_update = function _KeybindingHintElement_update() {
90
+ if (!this.isConnected)
91
+ return;
92
+ const platform = __classPrivateFieldGet(this, _KeybindingHintElement_instances, "m", _KeybindingHintElement_resolvedPlatform).call(this);
93
+ const chords = splitSequence(this.keys, platform);
94
+ const signature = [this.keys, this.format, this.scheme, this.size, platform, this.names].join('\u0000');
95
+ // Catches an external mutation made in the same task as an attribute
96
+ // change, before the observer callback has run.
97
+ if (__classPrivateFieldGet(this, _KeybindingHintElement_observer, "f").takeRecords().length > 0)
98
+ __classPrivateFieldSet(this, _KeybindingHintElement_owned, false, "f");
99
+ const owned = __classPrivateFieldGet(this, _KeybindingHintElement_owned, "f") && __classPrivateFieldGet(this, _KeybindingHintElement_mount, "f") !== null;
100
+ if (owned && signature === __classPrivateFieldGet(this, _KeybindingHintElement_signature, "f"))
101
+ return;
102
+ if (chords.length === 0) {
103
+ // Blank keys: render nothing, drop the fallback and any previous mount.
104
+ if (this.hasChildNodes())
105
+ this.replaceChildren();
106
+ __classPrivateFieldGet(this, _KeybindingHintElement_observer, "f").takeRecords();
107
+ __classPrivateFieldSet(this, _KeybindingHintElement_mount, null, "f");
108
+ __classPrivateFieldSet(this, _KeybindingHintElement_owned, false, "f");
109
+ __classPrivateFieldSet(this, _KeybindingHintElement_signature, signature, "f");
110
+ return;
111
+ }
112
+ if (!owned) {
113
+ // First render, or something (Turbo morph, manual innerHTML) replaced our
114
+ // content with fresh server markup. A new mount gives lit a fresh
115
+ // container; reusing the old one would hit lit's detached markers.
116
+ __classPrivateFieldSet(this, _KeybindingHintElement_mount, document.createElement('kbd'), "f");
117
+ __classPrivateFieldGet(this, _KeybindingHintElement_mount, "f").className = 'KeybindingHint-kbd';
118
+ this.replaceChildren(__classPrivateFieldGet(this, _KeybindingHintElement_mount, "f"));
119
+ }
120
+ const target = __classPrivateFieldGet(this, _KeybindingHintElement_mount, "f");
121
+ render(__classPrivateFieldGet(this, _KeybindingHintElement_instances, "m", _KeybindingHintElement_template).call(this, chords, platform, parseKeyNames(this.names)), target);
122
+ // Drop the records of our own render so they cannot re-enter #update.
123
+ __classPrivateFieldGet(this, _KeybindingHintElement_observer, "f").takeRecords();
124
+ __classPrivateFieldSet(this, _KeybindingHintElement_owned, true, "f");
125
+ __classPrivateFieldSet(this, _KeybindingHintElement_signature, signature, "f");
126
+ };
127
+ _KeybindingHintElement_resolvedPlatform = function _KeybindingHintElement_resolvedPlatform() {
128
+ return isPlatform(this.platform) ? this.platform : detectPlatform();
129
+ };
130
+ _KeybindingHintElement_resolvedFormat = function _KeybindingHintElement_resolvedFormat() {
131
+ return this.format === 'full' ? 'full' : 'condensed';
132
+ };
133
+ _KeybindingHintElement_chordClass = function _KeybindingHintElement_chordClass() {
134
+ const classes = ['KeybindingHint-chord'];
135
+ if (this.scheme === 'emphasis')
136
+ classes.push('KeybindingHint-chord--emphasis');
137
+ if (this.size === 'small')
138
+ classes.push('KeybindingHint-chord--small');
139
+ return classes.join(' ');
140
+ };
141
+ _KeybindingHintElement_template = function _KeybindingHintElement_template(chords, platform, names) {
142
+ const format = __classPrivateFieldGet(this, _KeybindingHintElement_instances, "m", _KeybindingHintElement_resolvedFormat).call(this);
143
+ const chordClass = __classPrivateFieldGet(this, _KeybindingHintElement_instances, "m", _KeybindingHintElement_chordClass).call(this);
144
+ // Whitespace text nodes are deliberate: they give screen readers word
145
+ // boundaries between hidden labels. Inside the inline-flex chord they do
146
+ // not render; between chords the two around "then" collapse into the one
147
+ // visible separator (as in React).
148
+ return chords.map((keys, chordIndex) => html `${chordIndex > 0 ? html ` <span class="sr-only">${names.separator ?? 'then'}</span> ` : nothing}<span
149
+ class="${chordClass}"
150
+ data-kbd-chord
151
+ >${keys.map((key, keyIndex) => __classPrivateFieldGet(this, _KeybindingHintElement_instances, "m", _KeybindingHintElement_keyTemplate).call(this, key, keyIndex, format, platform, names))}</span
152
+ >`);
153
+ };
154
+ _KeybindingHintElement_keyTemplate = function _KeybindingHintElement_keyTemplate(key, index, format, platform, names) {
155
+ const visible = keyName(names, key, format, platform);
156
+ const separator = index === 0 ? nothing : format === 'full' ? html ` <span aria-hidden="true"> + </span> ` : ' ';
157
+ return html `${separator}<span class="sr-only">${keyName(names, key, 'accessible', platform)}</span
158
+ ><span aria-hidden="true">${visible}</span>`;
159
+ };
160
+ /** Builds `data-names` from i18n-js scopes, for hosts that render hints client-side. */
161
+ KeybindingHintElement.buildNames = buildKeyNames;
162
+ __decorate([
163
+ attr
164
+ ], KeybindingHintElement.prototype, "keys", void 0);
165
+ __decorate([
166
+ attr
167
+ ], KeybindingHintElement.prototype, "format", void 0);
168
+ __decorate([
169
+ attr
170
+ ], KeybindingHintElement.prototype, "scheme", void 0);
171
+ __decorate([
172
+ attr
173
+ ], KeybindingHintElement.prototype, "size", void 0);
174
+ __decorate([
175
+ attr
176
+ ], KeybindingHintElement.prototype, "platform", void 0);
177
+ __decorate([
178
+ attr
179
+ ], KeybindingHintElement.prototype, "names", void 0);
180
+ KeybindingHintElement = __decorate([
181
+ controller('keybinding-hint')
182
+ ], KeybindingHintElement);
183
+ export { KeybindingHintElement };
@@ -41,3 +41,4 @@ import './open_project/collapsible';
41
41
  import './open_project/border_box/collapsible_header';
42
42
  import './open_project/collapsible_section';
43
43
  import './open_project/filterable_tree_view';
44
+ import './open_project/keybinding_hint_element';
@@ -41,3 +41,4 @@ import './open_project/collapsible';
41
41
  import './open_project/border_box/collapsible_header';
42
42
  import './open_project/collapsible_section';
43
43
  import './open_project/filterable_tree_view';
44
+ import './open_project/keybinding_hint_element';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openproject/primer-view-components",
3
- "version": "0.95.0",
3
+ "version": "0.96.0-rc.15d08ed15",
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",
@@ -75,10 +75,11 @@
75
75
  "@github/tab-container-element": "^3.1.2",
76
76
  "@oddbird/popover-polyfill": "^0.5.2",
77
77
  "@primer/behaviors": "^1.3.4",
78
- "@primer/live-region-element": "^0.8.0"
78
+ "@primer/live-region-element": "^0.8.0",
79
+ "lit-html": "^3.3.3"
79
80
  },
80
81
  "peerDependencies": {
81
- "@primer/primitives": "10.x || 11.x"
82
+ "@primer/primitives": "^11.5.1"
82
83
  },
83
84
  "devDependencies": {
84
85
  "@changesets/changelog-github": "^0.5.0",
@@ -6599,6 +6599,46 @@
6599
6599
  }
6600
6600
  ]
6601
6601
  },
6602
+ {
6603
+ "component": "OpenProject::KeybindingHint",
6604
+ "status": "open_project",
6605
+ "a11y_reviewed": false,
6606
+ "short_name": "OpenProjectKeybindingHint",
6607
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/keybinding_hint.rb",
6608
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/keybinding_hint/default/",
6609
+ "parameters": [
6610
+ {
6611
+ "name": "keys",
6612
+ "type": "String",
6613
+ "default": "N/A",
6614
+ "description": "The keys of the shortcut, e.g. `\"Mod+Shift+p\"` or `\"g i\"`. See the class documentation for the syntax."
6615
+ },
6616
+ {
6617
+ "name": "format",
6618
+ "type": "Symbol",
6619
+ "default": "`:condensed`",
6620
+ "description": "One of `:condensed` or `:full`. `:condensed` shows symbols (⌘⇧P) and suits menus and buttons; `:full` spells keys out (Command + Shift + P) and suits prose."
6621
+ },
6622
+ {
6623
+ "name": "scheme",
6624
+ "type": "Symbol",
6625
+ "default": "`:default`",
6626
+ "description": "One of `:default` or `:emphasis`. Use `:emphasis` on emphasis-coloured backgrounds."
6627
+ },
6628
+ {
6629
+ "name": "size",
6630
+ "type": "Symbol",
6631
+ "default": "`:medium`",
6632
+ "description": "One of `:medium` or `:small`."
6633
+ },
6634
+ {
6635
+ "name": "system_arguments",
6636
+ "type": "Hash",
6637
+ "default": "N/A",
6638
+ "description": "[System arguments](/system-arguments)"
6639
+ }
6640
+ ]
6641
+ },
6602
6642
  {
6603
6643
  "component": "OpenProject::PageHeader",
6604
6644
  "status": "open_project",
@@ -165,6 +165,7 @@
165
165
  "Primer::OpenProject::InlineMessage": "",
166
166
  "Primer::OpenProject::InputGroup": "",
167
167
  "Primer::OpenProject::InsetBox": "",
168
+ "Primer::OpenProject::KeybindingHint": "",
168
169
  "Primer::OpenProject::PageHeader": "",
169
170
  "Primer::OpenProject::PageHeader::Dialog": "",
170
171
  "Primer::OpenProject::PageHeader::Menu": "",
@@ -403,6 +403,18 @@
403
403
  "InsetBox--title-container": [
404
404
  "Primer::OpenProject::InsetBox"
405
405
  ],
406
+ "KeybindingHint-chord": [
407
+ "Primer::OpenProject::KeybindingHint"
408
+ ],
409
+ "KeybindingHint-chord--emphasis": [
410
+ "Primer::OpenProject::KeybindingHint"
411
+ ],
412
+ "KeybindingHint-chord--small": [
413
+ "Primer::OpenProject::KeybindingHint"
414
+ ],
415
+ "KeybindingHint-kbd": [
416
+ "Primer::OpenProject::KeybindingHint"
417
+ ],
406
418
  "Label": [
407
419
  "Primer::Beta::Label"
408
420
  ],
@@ -201,6 +201,10 @@ module.exports = new Set([
201
201
  'InsetBox--body',
202
202
  'InsetBox--body--clip_board_copy',
203
203
  'InsetBox--title-container',
204
+ 'KeybindingHint-chord',
205
+ 'KeybindingHint-chord--emphasis',
206
+ 'KeybindingHint-chord--small',
207
+ 'KeybindingHint-kbd',
204
208
  'Label',
205
209
  'Label--accent',
206
210
  'Label--attention',
@@ -201,6 +201,10 @@ const classNames = new Set([
201
201
  'InsetBox--body',
202
202
  'InsetBox--body--clip_board_copy',
203
203
  'InsetBox--title-container',
204
+ 'KeybindingHint-chord',
205
+ 'KeybindingHint-chord--emphasis',
206
+ 'KeybindingHint-chord--small',
207
+ 'KeybindingHint-kbd',
204
208
  'Label',
205
209
  'Label--accent',
206
210
  'Label--attention',
@@ -1928,6 +1928,33 @@
1928
1928
  }
1929
1929
  }
1930
1930
  },
1931
+ "Primer::OpenProject::KeybindingHint": {
1932
+ "DEFAULT_FORMAT": "condensed",
1933
+ "DEFAULT_SCHEME": "default",
1934
+ "DEFAULT_SIZE": "medium",
1935
+ "FORMAT_OPTIONS": [
1936
+ "condensed",
1937
+ "full"
1938
+ ],
1939
+ "GeneratedSlotMethods": "Primer::OpenProject::KeybindingHint::GeneratedSlotMethods",
1940
+ "Names": "Primer::OpenProject::KeybindingHint::Names",
1941
+ "SCHEME_MAPPINGS": {
1942
+ "default": "",
1943
+ "emphasis": "KeybindingHint-chord--emphasis"
1944
+ },
1945
+ "SCHEME_OPTIONS": [
1946
+ "default",
1947
+ "emphasis"
1948
+ ],
1949
+ "SIZE_MAPPINGS": {
1950
+ "medium": "",
1951
+ "small": "KeybindingHint-chord--small"
1952
+ },
1953
+ "SIZE_OPTIONS": [
1954
+ "medium",
1955
+ "small"
1956
+ ]
1957
+ },
1931
1958
  "Primer::OpenProject::PageHeader": {
1932
1959
  "BACK_BUTTON_ICON_OPTIONS": [
1933
1960
  "arrow-left",
@@ -958,7 +958,7 @@
958
958
  },
959
959
  {
960
960
  "name": "trailing_visual",
961
- "description": "An icon, label, counter, or text to render to the right of the label.\n\nTo render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.\n\nTo render a label, call the `with_leading_visual_label` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Label{{/link_to_component}}.\n\nTo render a counter, call the `with_leading_visual_counter` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.\n\nTo render text, call the `with_leading_visual_text` method and pass a block that returns a string. Eg:\n```ruby\nwith_leading_visual_text { \"Text here\" }\n```",
961
+ "description": "An icon, label, counter, or text to render to the right of the label.\n\nTo render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.\n\nTo render a label, call the `with_leading_visual_label` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Label{{/link_to_component}}.\n\nTo render a counter, call the `with_leading_visual_counter` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.\n\nTo render text, call the `with_leading_visual_text` method and pass a block that returns a string. Eg:\n```ruby\nwith_leading_visual_text { \"Text here\" }\n```\n\nTo render a keyboard shortcut hint, call the `with_trailing_visual_keybinding_hint` method, e.g. `with_trailing_visual_keybinding_hint(keys: \"Mod+Enter\")`. It accepts the arguments accepted by {{#link_to_component}}Primer::OpenProject::KeybindingHint{{/link_to_component}}.",
962
962
  "parameters": []
963
963
  },
964
964
  {
@@ -2245,7 +2245,7 @@
2245
2245
  },
2246
2246
  {
2247
2247
  "name": "trailing_visual",
2248
- "description": "An icon, label, counter, or text to render to the right of the label.\n\nTo render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.\n\nTo render a label, call the `with_leading_visual_label` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Label{{/link_to_component}}.\n\nTo render a counter, call the `with_leading_visual_counter` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.\n\nTo render text, call the `with_leading_visual_text` method and pass a block that returns a string. Eg:\n```ruby\nwith_leading_visual_text { \"Text here\" }\n```",
2248
+ "description": "An icon, label, counter, or text to render to the right of the label.\n\nTo render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.\n\nTo render a label, call the `with_leading_visual_label` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Label{{/link_to_component}}.\n\nTo render a counter, call the `with_leading_visual_counter` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.\n\nTo render text, call the `with_leading_visual_text` method and pass a block that returns a string. Eg:\n```ruby\nwith_leading_visual_text { \"Text here\" }\n```\n\nTo render a keyboard shortcut hint, call the `with_trailing_visual_keybinding_hint` method, e.g. `with_trailing_visual_keybinding_hint(keys: \"Mod+Enter\")`. It accepts the arguments accepted by {{#link_to_component}}Primer::OpenProject::KeybindingHint{{/link_to_component}}.",
2249
2249
  "parameters": []
2250
2250
  },
2251
2251
  {
@@ -6037,7 +6037,7 @@
6037
6037
  },
6038
6038
  {
6039
6039
  "name": "trailing_visual",
6040
- "description": "An icon, label, counter, or text to render to the right of the label.\n\nTo render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.\n\nTo render a label, call the `with_leading_visual_label` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Label{{/link_to_component}}.\n\nTo render a counter, call the `with_leading_visual_counter` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.\n\nTo render text, call the `with_leading_visual_text` method and pass a block that returns a string. Eg:\n```ruby\nwith_leading_visual_text { \"Text here\" }\n```",
6040
+ "description": "An icon, label, counter, or text to render to the right of the label.\n\nTo render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.\n\nTo render a label, call the `with_leading_visual_label` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Label{{/link_to_component}}.\n\nTo render a counter, call the `with_leading_visual_counter` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.\n\nTo render text, call the `with_leading_visual_text` method and pass a block that returns a string. Eg:\n```ruby\nwith_leading_visual_text { \"Text here\" }\n```\n\nTo render a keyboard shortcut hint, call the `with_trailing_visual_keybinding_hint` method, e.g. `with_trailing_visual_keybinding_hint(keys: \"Mod+Enter\")`. It accepts the arguments accepted by {{#link_to_component}}Primer::OpenProject::KeybindingHint{{/link_to_component}}.",
6041
6041
  "parameters": []
6042
6042
  },
6043
6043
  {
@@ -14077,7 +14077,7 @@
14077
14077
  },
14078
14078
  {
14079
14079
  "name": "trailing_visual",
14080
- "description": "Trailing visuals appear to the right of the button text.\n\nUse:\n\n- `trailing_visual_counter` for a {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.",
14080
+ "description": "Trailing visuals appear to the right of the button text.\n\nUse:\n\n- `trailing_visual_counter` for a {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.\n- `trailing_visual_keybinding_hint` for a {{#link_to_component}}Primer::OpenProject::KeybindingHint{{/link_to_component}}.\n The hint follows the button's size unless `size:` is given.",
14081
14081
  "parameters": [
14082
14082
  {
14083
14083
  "name": "system_arguments",
@@ -14800,7 +14800,7 @@
14800
14800
  },
14801
14801
  {
14802
14802
  "name": "trailing_visual",
14803
- "description": "Trailing visuals appear to the right of the button text.\n\nUse:\n\n- `trailing_visual_counter` for a {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.",
14803
+ "description": "Trailing visuals appear to the right of the button text.\n\nUse:\n\n- `trailing_visual_counter` for a {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.\n- `trailing_visual_keybinding_hint` for a {{#link_to_component}}Primer::OpenProject::KeybindingHint{{/link_to_component}}.\n The hint follows the button's size unless `size:` is given.",
14804
14804
  "parameters": [
14805
14805
  {
14806
14806
  "name": "system_arguments",
@@ -16788,7 +16788,7 @@
16788
16788
  },
16789
16789
  {
16790
16790
  "name": "trailing_visual",
16791
- "description": "An icon, label, counter, or text to render to the right of the label.\n\nTo render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.\n\nTo render a label, call the `with_leading_visual_label` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Label{{/link_to_component}}.\n\nTo render a counter, call the `with_leading_visual_counter` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.\n\nTo render text, call the `with_leading_visual_text` method and pass a block that returns a string. Eg:\n```ruby\nwith_leading_visual_text { \"Text here\" }\n```",
16791
+ "description": "An icon, label, counter, or text to render to the right of the label.\n\nTo render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.\n\nTo render a label, call the `with_leading_visual_label` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Label{{/link_to_component}}.\n\nTo render a counter, call the `with_leading_visual_counter` method, which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}.\n\nTo render text, call the `with_leading_visual_text` method and pass a block that returns a string. Eg:\n```ruby\nwith_leading_visual_text { \"Text here\" }\n```\n\nTo render a keyboard shortcut hint, call the `with_trailing_visual_keybinding_hint` method, e.g. `with_trailing_visual_keybinding_hint(keys: \"Mod+Enter\")`. It accepts the arguments accepted by {{#link_to_component}}Primer::OpenProject::KeybindingHint{{/link_to_component}}.",
16792
16792
  "parameters": []
16793
16793
  },
16794
16794
  {
@@ -21822,6 +21822,194 @@
21822
21822
  ],
21823
21823
  "subcomponents": []
21824
21824
  },
21825
+ {
21826
+ "fully_qualified_name": "Primer::OpenProject::KeybindingHint",
21827
+ "description": "Displays a keyboard shortcut as a visible, screen-reader-friendly hint.\nPort of Primer React's `KeybindingHint`.\n\nThe server renders a plain-text fallback inside the styled chord box.\nThe `<keybinding-hint>` custom element replaces it with platform-specific\nnames (for example ⌘ on Apple platforms, Ctrl elsewhere) and visually\nhidden accessible key names (\"command\", \"shift\", …).\n\n## Translation\n\nKey names follow the current locale: visible condensed and full names,\naccessible names and the \"then\" spoken between chords of a sequence.\nThe component looks them up in the `keybinding_hint` locale scope\n(English defaults in PVC's `config/locales/en.yml`) and passes the names\nfor its keys to the element as JSON in `data-names`. Each name is looked\nup for the exact platform, then `other`, then Primer React's English\ntables. Glyphs such as ↑, ⇧ and ⏎ are not translated.\n\n## Key syntax\n\nUse the key names `KeyboardEvent.key` reports (\"Control\", \"Shift\",\n\"ArrowUp\", \"a\", …), matching the github/hotkey format:\n\n- Join keys with `+` to form a chord pressed together: `\"Mod+Shift+p\"`.\n- Join chords with a space to form a sequence pressed one after the\n other: `\"g i\"` (g, then i).\n- Use `Plus` for the `+` key and `Space` for the space bar.\n- `Mod` means Command on Apple platforms and Control everywhere else.\n\nComma-separated alternatives (`\"s,/\"`) are not supported. The component only\ndisplays hints; it does not register the shortcut.\n\n## Terminology\n\nPrimer React's `variant` is `scheme:` here (`normal` → `:default`,\n`onEmphasis` → `:emphasis`) and its `size=\"normal\"` is `size: :medium`.",
21828
+ "accessibility_docs": null,
21829
+ "is_form_component": false,
21830
+ "is_published": true,
21831
+ "requires_js": false,
21832
+ "component": "OpenProject::KeybindingHint",
21833
+ "status": "open_project",
21834
+ "a11y_reviewed": false,
21835
+ "short_name": "OpenProjectKeybindingHint",
21836
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/keybinding_hint.rb",
21837
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/keybinding_hint/default/",
21838
+ "parameters": [
21839
+ {
21840
+ "name": "keys",
21841
+ "type": "String",
21842
+ "default": "N/A",
21843
+ "description": "The keys of the shortcut, e.g. `\"Mod+Shift+p\"` or `\"g i\"`. See the class documentation for the syntax."
21844
+ },
21845
+ {
21846
+ "name": "format",
21847
+ "type": "Symbol",
21848
+ "default": "`:condensed`",
21849
+ "description": "One of `:condensed` or `:full`. `:condensed` shows symbols (⌘⇧P) and suits menus and buttons; `:full` spells keys out (Command + Shift + P) and suits prose."
21850
+ },
21851
+ {
21852
+ "name": "scheme",
21853
+ "type": "Symbol",
21854
+ "default": "`:default`",
21855
+ "description": "One of `:default` or `:emphasis`. Use `:emphasis` on emphasis-coloured backgrounds."
21856
+ },
21857
+ {
21858
+ "name": "size",
21859
+ "type": "Symbol",
21860
+ "default": "`:medium`",
21861
+ "description": "One of `:medium` or `:small`."
21862
+ },
21863
+ {
21864
+ "name": "system_arguments",
21865
+ "type": "Hash",
21866
+ "default": "N/A",
21867
+ "description": "{{link_to_system_arguments_docs}}"
21868
+ }
21869
+ ],
21870
+ "slots": [],
21871
+ "methods": [
21872
+ {
21873
+ "name": "fallback_chords",
21874
+ "description": "Readable degraded output for no-JS and the pre-upgrade frame. Uses the\ntranslated condensed name for non-Apple platforms where one exists\n(`Mod` as Control); other keys keep their spelling with the first\nletter upcased, so `ArrowUp` stays `ArrowUp` and `p` becomes `P`.",
21875
+ "parameters": [],
21876
+ "return_types": []
21877
+ }
21878
+ ],
21879
+ "previews": [
21880
+ {
21881
+ "preview_path": "primer/open_project/keybinding_hint/default",
21882
+ "name": "default",
21883
+ "snapshot": "true",
21884
+ "skip_rules": {
21885
+ "wont_fix": [
21886
+ "region"
21887
+ ],
21888
+ "will_fix": [
21889
+ "color-contrast"
21890
+ ]
21891
+ }
21892
+ },
21893
+ {
21894
+ "preview_path": "primer/open_project/keybinding_hint/playground",
21895
+ "name": "playground",
21896
+ "snapshot": "false",
21897
+ "skip_rules": {
21898
+ "wont_fix": [
21899
+ "region"
21900
+ ],
21901
+ "will_fix": [
21902
+ "color-contrast"
21903
+ ]
21904
+ }
21905
+ },
21906
+ {
21907
+ "preview_path": "primer/open_project/keybinding_hint/full_format",
21908
+ "name": "full_format",
21909
+ "snapshot": "false",
21910
+ "skip_rules": {
21911
+ "wont_fix": [
21912
+ "region"
21913
+ ],
21914
+ "will_fix": [
21915
+ "color-contrast"
21916
+ ]
21917
+ }
21918
+ },
21919
+ {
21920
+ "preview_path": "primer/open_project/keybinding_hint/sequence",
21921
+ "name": "sequence",
21922
+ "snapshot": "false",
21923
+ "skip_rules": {
21924
+ "wont_fix": [
21925
+ "region"
21926
+ ],
21927
+ "will_fix": [
21928
+ "color-contrast"
21929
+ ]
21930
+ }
21931
+ },
21932
+ {
21933
+ "preview_path": "primer/open_project/keybinding_hint/sizes",
21934
+ "name": "sizes",
21935
+ "snapshot": "false",
21936
+ "skip_rules": {
21937
+ "wont_fix": [
21938
+ "region"
21939
+ ],
21940
+ "will_fix": [
21941
+ "color-contrast"
21942
+ ]
21943
+ }
21944
+ },
21945
+ {
21946
+ "preview_path": "primer/open_project/keybinding_hint/schemes",
21947
+ "name": "schemes",
21948
+ "snapshot": "false",
21949
+ "skip_rules": {
21950
+ "wont_fix": [
21951
+ "region"
21952
+ ],
21953
+ "will_fix": [
21954
+ "color-contrast"
21955
+ ]
21956
+ }
21957
+ },
21958
+ {
21959
+ "preview_path": "primer/open_project/keybinding_hint/platforms",
21960
+ "name": "platforms",
21961
+ "snapshot": "true",
21962
+ "skip_rules": {
21963
+ "wont_fix": [
21964
+ "region"
21965
+ ],
21966
+ "will_fix": [
21967
+ "color-contrast"
21968
+ ]
21969
+ }
21970
+ },
21971
+ {
21972
+ "preview_path": "primer/open_project/keybinding_hint/prose",
21973
+ "name": "prose",
21974
+ "snapshot": "false",
21975
+ "skip_rules": {
21976
+ "wont_fix": [
21977
+ "region"
21978
+ ],
21979
+ "will_fix": [
21980
+ "color-contrast"
21981
+ ]
21982
+ }
21983
+ },
21984
+ {
21985
+ "preview_path": "primer/open_project/keybinding_hint/in_button",
21986
+ "name": "in_button",
21987
+ "snapshot": "true",
21988
+ "skip_rules": {
21989
+ "wont_fix": [
21990
+ "region"
21991
+ ],
21992
+ "will_fix": [
21993
+ "color-contrast"
21994
+ ]
21995
+ }
21996
+ },
21997
+ {
21998
+ "preview_path": "primer/open_project/keybinding_hint/in_action_list",
21999
+ "name": "in_action_list",
22000
+ "snapshot": "true",
22001
+ "skip_rules": {
22002
+ "wont_fix": [
22003
+ "region"
22004
+ ],
22005
+ "will_fix": [
22006
+ "color-contrast"
22007
+ ]
22008
+ }
22009
+ }
22010
+ ],
22011
+ "subcomponents": []
22012
+ },
21825
22013
  {
21826
22014
  "fully_qualified_name": "Primer::OpenProject::PageHeader",
21827
22015
  "description": "A ViewComponent PageHeader inspired by the primer react variant",