@primer/view-components 0.1.0-rc.dfa70354 → 0.1.1-rc.797d8bd8

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.
@@ -18,6 +18,7 @@ export declare class NavListElement extends HTMLElement {
18
18
  collapseItem(item: HTMLElement): void;
19
19
  itemIsExpanded(item: HTMLElement | null): boolean;
20
20
  handleItemWithSubItemClick(e: Event): void;
21
+ handleItemWithSubItemKeydown(e: KeyboardEvent): void;
21
22
  private showMore;
22
23
  private setShowMoreItemState;
23
24
  }
@@ -82,6 +82,7 @@ let NavListElement = class NavListElement extends HTMLElement {
82
82
  var _a;
83
83
  (_a = item.nextElementSibling) === null || _a === void 0 ? void 0 : _a.setAttribute('data-hidden', '');
84
84
  item.setAttribute('aria-expanded', 'false');
85
+ item.focus();
85
86
  }
86
87
  itemIsExpanded(item) {
87
88
  if ((item === null || item === void 0 ? void 0 : item.tagName) === 'A') {
@@ -105,6 +106,26 @@ let NavListElement = class NavListElement extends HTMLElement {
105
106
  }
106
107
  e.stopPropagation();
107
108
  }
109
+ // collapse item
110
+ handleItemWithSubItemKeydown(e) {
111
+ const el = e.currentTarget;
112
+ if (!(el instanceof HTMLElement))
113
+ return;
114
+ let button = el.closest('button');
115
+ if (!button) {
116
+ const button_id = el.getAttribute('aria-labelledby');
117
+ if (button_id) {
118
+ button = document.getElementById(button_id);
119
+ }
120
+ else {
121
+ return;
122
+ }
123
+ }
124
+ if (this.itemIsExpanded(button) && e.key === 'Escape') {
125
+ this.collapseItem(button);
126
+ }
127
+ e.stopPropagation();
128
+ }
108
129
  async showMore(e) {
109
130
  var _a, _b;
110
131
  e.preventDefault();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/view-components",
3
- "version": "0.1.0-rc.dfa70354",
3
+ "version": "0.1.1-rc.797d8bd8",
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",
@@ -2039,6 +2039,104 @@
2039
2039
  }
2040
2040
  ]
2041
2041
  },
2042
+ {
2043
+ "component": "Overlay",
2044
+ "status": "alpha",
2045
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/overlay.rb",
2046
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/overlay/default/",
2047
+ "parameters": [
2048
+ {
2049
+ "name": "id",
2050
+ "type": "String",
2051
+ "default": "`self.class.generate_id`",
2052
+ "description": "The id of the Overlay."
2053
+ },
2054
+ {
2055
+ "name": "title",
2056
+ "type": "String",
2057
+ "default": "N/A",
2058
+ "description": "Describes the content of the Overlay."
2059
+ },
2060
+ {
2061
+ "name": "subtitle",
2062
+ "type": "String",
2063
+ "default": "`nil`",
2064
+ "description": "Provides dditional context for the Overlay, also setting the `aria-describedby` attribute."
2065
+ },
2066
+ {
2067
+ "name": "popover",
2068
+ "type": "Symbol",
2069
+ "default": "`:auto`",
2070
+ "description": "The popover behaviour. One of `:auto` or `:manual`."
2071
+ },
2072
+ {
2073
+ "name": "popover",
2074
+ "type": "Symbol",
2075
+ "default": "`:auto`",
2076
+ "description": "The popover behaviour. One of `:auto` or `:manual`."
2077
+ },
2078
+ {
2079
+ "name": "size",
2080
+ "type": "Symbol",
2081
+ "default": "`:auto`",
2082
+ "description": "The size of the Overlay. One of `:auto`, `:large`, `:medium`, `:medium_portrait`, `:small`, or `:xlarge`."
2083
+ },
2084
+ {
2085
+ "name": "padding",
2086
+ "type": "Symbol",
2087
+ "default": "`:normal`",
2088
+ "description": "The padding given to the Overlay body. One of `:condensed`, `:none`, or `:normal`."
2089
+ },
2090
+ {
2091
+ "name": "anchor",
2092
+ "type": "String",
2093
+ "default": "`nil`",
2094
+ "description": "An ID of the element to anchor onto. Defaults to the `show_button`."
2095
+ },
2096
+ {
2097
+ "name": "anchor_align",
2098
+ "type": "Symbol",
2099
+ "default": "`:start`",
2100
+ "description": "The anchor alignment of the Overlay. One of `:center`, `:end`, or `:start`."
2101
+ },
2102
+ {
2103
+ "name": "anchor_side",
2104
+ "type": "Symbol",
2105
+ "default": "`:outside_bottom`",
2106
+ "description": "The side to anchor the Overlay to. One of `:inside_bottom`, `:inside_center`, `:inside_left`, `:inside_right`, `:inside_top`, `:outside_bottom`, `:outside_left`, `:outside_right`, or `:outside_top`."
2107
+ },
2108
+ {
2109
+ "name": "anchor_offset",
2110
+ "type": "Symbol",
2111
+ "default": "`:normal`",
2112
+ "description": "The anchor offset to give the Overlay. One of `:normal` or `:spacious`."
2113
+ },
2114
+ {
2115
+ "name": "allow_out_of_bounds",
2116
+ "type": "Boolean",
2117
+ "default": "`false`",
2118
+ "description": "Allow the Overlay to overflow its container."
2119
+ },
2120
+ {
2121
+ "name": "visually_hide_title",
2122
+ "type": "Boolean",
2123
+ "default": "`false`",
2124
+ "description": "If true will hide the heading title, while still making it available to Screen Readers."
2125
+ },
2126
+ {
2127
+ "name": "role",
2128
+ "type": "String",
2129
+ "default": "N/A",
2130
+ "description": "The ARIA role. One of `:dialog` or `:menu`."
2131
+ },
2132
+ {
2133
+ "name": "system_arguments",
2134
+ "type": "Hash",
2135
+ "default": "N/A",
2136
+ "description": "[System arguments](/system-arguments)"
2137
+ }
2138
+ ]
2139
+ },
2042
2140
  {
2043
2141
  "component": "NavList",
2044
2142
  "status": "alpha",
@@ -2098,10 +2196,10 @@
2098
2196
  ]
2099
2197
  },
2100
2198
  {
2101
- "component": "NavList::Section",
2199
+ "component": "NavList::Group",
2102
2200
  "status": "alpha",
2103
- "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/nav_list/section.rb",
2104
- "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/nav_list/section/default/",
2201
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/nav_list/group.rb",
2202
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/nav_list/group/default/",
2105
2203
  "parameters": [
2106
2204
  {
2107
2205
  "name": "selected_item_id",
@@ -2193,6 +2291,12 @@
2193
2291
  "default": "N/A",
2194
2292
  "description": "Sub list title."
2195
2293
  },
2294
+ {
2295
+ "name": "heading_level",
2296
+ "type": "Integer",
2297
+ "default": "`3`",
2298
+ "description": "Heading level. Level 2 results in an `<h2>` tag, level 3 an `<h3>` tag, etc."
2299
+ },
2196
2300
  {
2197
2301
  "name": "subtitle",
2198
2302
  "type": "String",
@@ -2207,8 +2311,8 @@
2207
2311
  },
2208
2312
  {
2209
2313
  "name": "tag",
2210
- "type": "Symbol",
2211
- "default": "`:h3`",
2314
+ "type": "Integer",
2315
+ "default": "N/A",
2212
2316
  "description": "Semantic tag for the heading."
2213
2317
  },
2214
2318
  {
@@ -2276,7 +2380,7 @@
2276
2380
  {
2277
2381
  "name": "role",
2278
2382
  "type": "String",
2279
- "default": "`:listitem`",
2383
+ "default": "`nil`",
2280
2384
  "description": "ARIA role describing the function of the item."
2281
2385
  },
2282
2386
  {
@@ -28,9 +28,13 @@
28
28
  "Primer::Alpha::Menu": "",
29
29
  "Primer::Alpha::MultiInput": "",
30
30
  "Primer::Alpha::NavList": "",
31
+ "Primer::Alpha::NavList::Group": "",
31
32
  "Primer::Alpha::NavList::Item": "",
32
- "Primer::Alpha::NavList::Section": "",
33
33
  "Primer::Alpha::OcticonSymbols": "",
34
+ "Primer::Alpha::Overlay": "",
35
+ "Primer::Alpha::Overlay::Body": "",
36
+ "Primer::Alpha::Overlay::Footer": "",
37
+ "Primer::Alpha::Overlay::Header": "",
34
38
  "Primer::Alpha::RadioButton": "",
35
39
  "Primer::Alpha::RadioButtonGroup": "",
36
40
  "Primer::Alpha::SegmentedControl": "2023-02-01",
@@ -27,6 +27,16 @@
27
27
  },
28
28
  "Primer::Alpha::ActionList::Heading": {
29
29
  "DEFAULT_SCHEME": "subtle",
30
+ "HEADING_LEVELS": [
31
+ 1,
32
+ 2,
33
+ 3,
34
+ 4,
35
+ 5,
36
+ 6
37
+ ],
38
+ "HEADING_MAX": 6,
39
+ "HEADING_MIN": 1,
30
40
  "SCHEME_MAPPINGS": {
31
41
  "subtle": null,
32
42
  "filled": "ActionList-sectionDivider--filled"
@@ -326,15 +336,117 @@
326
336
  "Primer::Alpha::MultiInput": {
327
337
  },
328
338
  "Primer::Alpha::NavList": {
329
- "Item": "Primer::Alpha::NavList::Item",
330
- "Section": "Primer::Alpha::NavList::Section"
339
+ "Group": "Primer::Alpha::NavList::Group",
340
+ "Item": "Primer::Alpha::NavList::Item"
331
341
  },
332
- "Primer::Alpha::NavList::Item": {
342
+ "Primer::Alpha::NavList::Group": {
333
343
  },
334
- "Primer::Alpha::NavList::Section": {
344
+ "Primer::Alpha::NavList::Item": {
335
345
  },
336
346
  "Primer::Alpha::OcticonSymbols": {
337
347
  },
348
+ "Primer::Alpha::Overlay": {
349
+ "ALIGN_CONTENT_MAPPINGS": {
350
+ "start": "Overlay-footer--alignStart",
351
+ "center": "Overlay-footer--alignCenter",
352
+ "end": "Overlay-footer--alignEnd"
353
+ },
354
+ "ALIGN_CONTENT_OPTIONS": [
355
+ "start",
356
+ "center",
357
+ "end"
358
+ ],
359
+ "ANCHOR_ALIGN_OPTIONS": [
360
+ "start",
361
+ "center",
362
+ "end"
363
+ ],
364
+ "ANCHOR_OFFSET_OPTIONS": [
365
+ "normal",
366
+ "spacious"
367
+ ],
368
+ "ANCHOR_SIDE_MAPPINGS": {
369
+ "inside_top": "inside-top",
370
+ "inside_bottom": "inside-bottom",
371
+ "inside_left": "inside-left",
372
+ "inside_right": "inside-right",
373
+ "inside_center": "inside-center",
374
+ "outside_top": "outside-top",
375
+ "outside_bottom": "outside-bottom",
376
+ "outside_left": "outside-left",
377
+ "outside_right": "outside-right"
378
+ },
379
+ "ANCHOR_SIDE_OPTIONS": [
380
+ "inside_top",
381
+ "inside_bottom",
382
+ "inside_left",
383
+ "inside_right",
384
+ "inside_center",
385
+ "outside_top",
386
+ "outside_bottom",
387
+ "outside_left",
388
+ "outside_right"
389
+ ],
390
+ "Body": "Primer::Alpha::Overlay::Body",
391
+ "DEFAULT_ALIGN_CONTENT": "end",
392
+ "DEFAULT_ANCHOR_ALIGN": "start",
393
+ "DEFAULT_ANCHOR_OFFSET": "normal",
394
+ "DEFAULT_ANCHOR_SIDE": "outside_bottom",
395
+ "DEFAULT_PADDING": "normal",
396
+ "DEFAULT_POPOVER": "auto",
397
+ "DEFAULT_SIZE": "auto",
398
+ "Footer": "Primer::Alpha::Overlay::Footer",
399
+ "Header": "Primer::Alpha::Overlay::Header",
400
+ "PADDING_MAPPINGS": {
401
+ "normal": null,
402
+ "condensed": "Overlay-body--paddingCondensed",
403
+ "none": "Overlay-body--paddingNone"
404
+ },
405
+ "PADDING_OPTIONS": [
406
+ "normal",
407
+ "condensed",
408
+ "none"
409
+ ],
410
+ "POPOVER_OPTIONS": [
411
+ "auto",
412
+ "manual"
413
+ ],
414
+ "ROLE_OPTIONS": [
415
+ "dialog",
416
+ "menu"
417
+ ],
418
+ "SIZE_MAPPINGS": {
419
+ "auto": "Overlay--size-auto",
420
+ "small": "Overlay--size-small",
421
+ "medium": "Overlay--size-medium",
422
+ "medium_portrait": "Overlay--size-medium-portrait",
423
+ "large": "Overlay--size-large",
424
+ "xlarge": "Overlay--size-xlarge"
425
+ },
426
+ "SIZE_OPTIONS": [
427
+ "auto",
428
+ "small",
429
+ "medium",
430
+ "medium_portrait",
431
+ "large",
432
+ "xlarge"
433
+ ]
434
+ },
435
+ "Primer::Alpha::Overlay::Body": {
436
+ },
437
+ "Primer::Alpha::Overlay::Footer": {
438
+ },
439
+ "Primer::Alpha::Overlay::Header": {
440
+ "DEFAULT_SIZE": "medium",
441
+ "SIZE_MAPPINGS": {
442
+ "medium": null,
443
+ "large": "Overlay-header--large"
444
+ },
445
+ "SIZE_OPTIONS": [
446
+ "medium",
447
+ "large"
448
+ ]
449
+ },
338
450
  "Primer::Alpha::RadioButton": {
339
451
  },
340
452
  "Primer::Alpha::RadioButtonGroup": {
@@ -1263,6 +1263,27 @@
1263
1263
  }
1264
1264
  ]
1265
1265
  },
1266
+ {
1267
+ "name": "overlay",
1268
+ "lookup_path": "primer/alpha/overlay",
1269
+ "examples": [
1270
+ {
1271
+ "inspect_path": "/lookbook/inspect/primer/alpha/overlay/playground",
1272
+ "preview_path": "/lookbook/preview/primer/alpha/overlay/playground",
1273
+ "name": "playground"
1274
+ },
1275
+ {
1276
+ "inspect_path": "/lookbook/inspect/primer/alpha/overlay/default",
1277
+ "preview_path": "/lookbook/preview/primer/alpha/overlay/default",
1278
+ "name": "default"
1279
+ },
1280
+ {
1281
+ "inspect_path": "/lookbook/inspect/primer/alpha/overlay/middle_of_page",
1282
+ "preview_path": "/lookbook/preview/primer/alpha/overlay/middle_of_page",
1283
+ "name": "middle_of_page"
1284
+ }
1285
+ ]
1286
+ },
1266
1287
  {
1267
1288
  "name": "popover",
1268
1289
  "lookup_path": "primer/beta/popover",
@@ -28,9 +28,13 @@
28
28
  "Primer::Alpha::Menu": "alpha",
29
29
  "Primer::Alpha::MultiInput": "alpha",
30
30
  "Primer::Alpha::NavList": "alpha",
31
+ "Primer::Alpha::NavList::Group": "alpha",
31
32
  "Primer::Alpha::NavList::Item": "alpha",
32
- "Primer::Alpha::NavList::Section": "alpha",
33
33
  "Primer::Alpha::OcticonSymbols": "alpha",
34
+ "Primer::Alpha::Overlay": "alpha",
35
+ "Primer::Alpha::Overlay::Body": "alpha",
36
+ "Primer::Alpha::Overlay::Footer": "alpha",
37
+ "Primer::Alpha::Overlay::Header": "alpha",
34
38
  "Primer::Alpha::RadioButton": "alpha",
35
39
  "Primer::Alpha::RadioButtonGroup": "alpha",
36
40
  "Primer::Alpha::SegmentedControl": "alpha",