primer_view_components 0.51.0 → 0.51.2

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/assets/styles/primer_view_components.css +1 -1
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_bar_element.js +67 -76
  8. data/app/components/primer/alpha/action_bar_element.ts +47 -69
  9. data/app/components/primer/alpha/action_menu.rb +3 -0
  10. data/app/components/primer/alpha/dialog.css +1 -1
  11. data/app/components/primer/alpha/dialog.css.json +2 -1
  12. data/app/components/primer/alpha/dialog.css.map +1 -1
  13. data/app/components/primer/alpha/dialog.pcss +12 -0
  14. data/app/components/primer/alpha/overlay.rb +14 -1
  15. data/app/components/primer/alpha/tool_tip.js +1 -1
  16. data/app/components/primer/alpha/tool_tip.ts +1 -1
  17. data/app/components/primer/beta/auto_complete/no_result_item.rb +23 -13
  18. data/app/components/primer/beta/relative_time.rb +3 -0
  19. data/app/components/primer/beta/timeline_item.css +1 -1
  20. data/app/components/primer/beta/timeline_item.css.map +1 -1
  21. data/app/components/primer/beta/timeline_item.pcss +2 -1
  22. data/app/components/primer/dialog_helper.js +7 -1
  23. data/app/components/primer/dialog_helper.ts +7 -4
  24. data/lib/primer/view_components/version.rb +1 -1
  25. data/previews/primer/alpha/action_menu_preview.rb +32 -1
  26. data/previews/primer/beta/truncate_preview/advanced_multiple_items.html.erb +32 -0
  27. data/previews/primer/beta/truncate_preview/max_widths.html.erb +22 -0
  28. data/previews/primer/beta/truncate_preview/multiple_items.html.erb +14 -0
  29. data/previews/primer/beta/truncate_preview.rb +3 -26
  30. data/static/arguments.json +26 -1
  31. data/static/classes.json +3 -0
  32. data/static/constants.json +15 -0
  33. data/static/info_arch.json +57 -56
  34. data/static/previews.json +13 -0
  35. metadata +5 -2
@@ -95,6 +95,7 @@ module Primer
95
95
  # @param month [Symbol] What format months should take. <%= one_of(Primer::Beta::RelativeTime::MONTH_OPTIONS) %>
96
96
  # @param year [Symbol] What format years should take. <%= one_of(Primer::Beta::RelativeTime::YEAR_OPTIONS) %>
97
97
  # @param time_zone_name [Symbol] What format the time zone should take. <%= one_of(Primer::Beta::RelativeTime::TIMEZONENAME_OPTIONS) %>
98
+ # @param time_zone [String] The IANA time zone identifier to use for formatting (e.g., "America/New_York").
98
99
  # @param threshold [String] The threshold, in ISO-8601 'durations' format, at which relative time displays become absolute.
99
100
  # @param precision [Symbol] The precision elapsed time should display. <%= one_of(Primer::Beta::RelativeTime::PRECISION_OPTIONS) %>
100
101
  # @param format [Symbol] The format the display should take. <%= one_of(Primer::Beta::RelativeTime::FORMAT_OPTIONS) %>
@@ -116,6 +117,7 @@ module Primer
116
117
  month: MONTH_DEFAULT,
117
118
  year: YEAR_DEFAULT,
118
119
  time_zone_name: TIMEZONENAME_DEFAULT,
120
+ time_zone: nil,
119
121
  threshold: nil,
120
122
  precision: PRECISION_DEFAULT,
121
123
  format: nil,
@@ -138,6 +140,7 @@ module Primer
138
140
  @system_arguments[:month] = fetch_or_fallback(MONTH_OPTIONS, month, MONTH_DEFAULT) if month.present?
139
141
  @system_arguments[:year] = fetch_or_fallback(YEAR_OPTIONS, year, YEAR_DEFAULT) if year.present?
140
142
  @system_arguments[:"time-zone-name"] = fetch_or_fallback(TIMEZONENAME_OPTIONS, time_zone_name, TIMEZONENAME_DEFAULT) if time_zone_name.present?
143
+ @system_arguments[:"time-zone"] = time_zone if time_zone.present?
141
144
  @system_arguments[:threshold] = threshold if threshold.present?
142
145
  @system_arguments[:precision] = precision if precision.present?
143
146
  @system_arguments[:title] = title if title.present?
@@ -1 +1 @@
1
- .TimelineItem{display:flex;margin-left:var(--stack-gap-normal);padding:var(--stack-padding-normal) 0;position:relative}.TimelineItem:before{background-color:var(--borderColor-muted);bottom:0;content:"";display:block;left:0;position:absolute;top:0;width:var(--borderWidth-thick)}.TimelineItem:target .TimelineItem-badge{border-color:var(--borderColor-accent-emphasis);box-shadow:0 0 .2em var(--borderColor-accent-muted)}.TimelineItem-badge{align-items:center;background-color:var(--timelineBadge-bgColor);border:var(--borderWidth-thick) solid var(--bgColor-default);border-radius:50%;color:var(--fgColor-muted);display:flex;flex-shrink:0;height:var(--control-medium-size);justify-content:center;margin-left:calc(var(--control-medium-size)/-2 + 1px);margin-right:var(--controlStack-medium-gap-condensed);position:relative;width:var(--control-medium-size);z-index:1}.TimelineItem-badge--success{background-color:var(--bgColor-success-emphasis);border:var(--borderWidth-thin) solid #0000;color:var(--fgColor-onEmphasis)}.TimelineItem-body{color:var(--fgColor-muted);flex:auto;margin-top:var(--base-size-4);max-width:100%;min-width:0}.TimelineItem-avatar{left:-72px;position:absolute;z-index:1}.TimelineItem-break{background-color:var(--bgColor-default);border:0;border-top:var(--borderWidth-thicker) solid var(--borderColor-default);height:var(--stack-gap-spacious);margin:0;margin-bottom:calc(var(--stack-gap-normal)*-1);margin-left:-56px;position:relative;z-index:1}.TimelineItem--condensed{padding-bottom:0;padding-top:var(--base-size-4)}.TimelineItem--condensed:last-child{padding-bottom:var(--stack-gap-normal)}.TimelineItem--condensed .TimelineItem-badge{background-color:var(--bgColor-default);border:0;color:var(--fgColor-muted);height:var(--base-size-16);margin-bottom:var(--base-size-8);margin-top:var(--base-size-8)}
1
+ .TimelineItem{display:flex;margin-left:var(--stack-gap-normal);padding:var(--stack-padding-normal) 0;position:relative}.TimelineItem:before{background-color:var(--borderColor-muted);bottom:0;content:"";display:block;left:0;position:absolute;top:0;width:var(--borderWidth-thick)}.TimelineItem:target .TimelineItem-badge{border-color:var(--borderColor-accent-emphasis);box-shadow:0 0 .2em var(--borderColor-accent-muted)}.TimelineItem-badge{align-items:center;background-color:var(--timelineBadge-bgColor);border:var(--borderWidth-thick) solid var(--bgColor-default);border-radius:50%;color:var(--fgColor-muted);display:flex;flex-shrink:0;height:var(--control-medium-size);justify-content:center;margin-left:calc(var(--control-medium-size)/-2 + 1px);margin-right:var(--controlStack-medium-gap-condensed);position:relative;width:var(--control-medium-size);z-index:1}.TimelineItem-badge--success{background-color:var(--bgColor-success-emphasis);border:var(--borderWidth-thin) solid #0000;color:var(--fgColor-onEmphasis)}.TimelineItem-body{color:var(--fgColor-muted);flex:auto;margin-top:calc(var(--base-size-4) + 1px);max-width:100%;min-width:0}.TimelineItem-avatar{left:-72px;position:absolute;z-index:1}.TimelineItem-break{background-color:var(--bgColor-default);border:0;border-top:var(--borderWidth-thicker) solid var(--borderColor-default);height:var(--stack-gap-spacious);margin:0;margin-bottom:calc(var(--stack-gap-normal)*-1);margin-left:-56px;position:relative;z-index:1}.TimelineItem--condensed{padding-bottom:0;padding-top:var(--base-size-4)}.TimelineItem--condensed:last-child{padding-bottom:var(--stack-gap-normal)}.TimelineItem--condensed .TimelineItem-badge{background-color:var(--bgColor-default);border:0;color:var(--fgColor-muted);height:var(--base-size-16);margin-bottom:var(--base-size-8);margin-top:var(--base-size-8)}
@@ -1 +1 @@
1
- {"version":3,"sources":["timeline_item.pcss"],"names":[],"mappings":"AAEA,cAEE,YAAa,CAIb,mCAAoC,CAFpC,qCAAsC,CAHtC,iBAyBF,CAjBE,qBASE,yCAA0C,CAN1C,QAAS,CAIT,UAAW,CAFX,aAAc,CADd,MAAO,CAHP,iBAAkB,CAClB,KAAM,CAIN,8BAIF,CAEA,yCACE,+CAAgD,CAEhD,mDACF,CAGF,oBAWE,kBAAmB,CACnB,6CAA8C,CAE9C,4DAA6D,CAC7D,iBAAkB,CALlB,0BAA2B,CAP3B,YAAa,CAcb,aAAc,CAZd,iCAAkC,CAWlC,sBAAuB,CAPvB,qDAAwD,CAFxD,qDAAsD,CANtD,iBAAkB,CAGlB,gCAAiC,CAFjC,SAgBF,CAEA,6BAEE,gDAAiD,CACjD,0CAAiD,CAFjD,+BAGF,CAEA,mBAIE,0BAA2B,CAC3B,SAAU,CAFV,6BAA8B,CAD9B,cAAe,CADf,WAKF,CAEA,qBAGE,UAAW,CAFX,iBAAkB,CAGlB,SACF,CAEA,oBASE,uCAAwC,CACxC,QAAS,CACT,sEAAuE,CARvE,gCAAiC,CACjC,QAAS,CAET,8CAAiD,CAEjD,iBAAkB,CAPlB,iBAAkB,CAClB,SAUF,CAEA,yBAEE,gBAAiB,CADjB,8BAiBF,CAbE,oCAEE,sCACF,CAEA,6CAKE,uCAAwC,CACxC,QAAS,CAFT,0BAA2B,CAH3B,0BAA2B,CAE3B,gCAAiC,CADjC,6BAKF","file":"timeline_item.css","sourcesContent":["/* TimelineItem */\n\n.TimelineItem {\n position: relative;\n display: flex;\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--stack-padding-normal) 0;\n /* stylelint-disable-next-line primer/spacing */\n margin-left: var(--stack-gap-normal);\n\n /* The Timeline */\n &::before {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n display: block;\n width: var(--borderWidth-thick);\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-muted);\n }\n\n &:target .TimelineItem-badge {\n border-color: var(--borderColor-accent-emphasis);\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: 0 0 0.2em var(--borderColor-accent-muted);\n }\n}\n\n.TimelineItem-badge {\n position: relative;\n z-index: 1;\n display: flex;\n width: var(--control-medium-size);\n height: var(--control-medium-size);\n /* stylelint-disable-next-line primer/spacing */\n margin-right: var(--controlStack-medium-gap-condensed);\n /* stylelint-disable-next-line primer/spacing */\n margin-left: calc(var(--control-medium-size) / -2 + 1px);\n color: var(--fgColor-muted);\n align-items: center;\n background-color: var(--timelineBadge-bgColor);\n /* stylelint-disable-next-line primer/colors */\n border: var(--borderWidth-thick) solid var(--bgColor-default);\n border-radius: 50%;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.TimelineItem-badge--success {\n color: var(--fgColor-onEmphasis);\n background-color: var(--bgColor-success-emphasis);\n border: var(--borderWidth-thin) solid transparent;\n}\n\n.TimelineItem-body {\n min-width: 0;\n max-width: 100%;\n margin-top: var(--base-size-4);\n color: var(--fgColor-muted);\n flex: auto;\n}\n\n.TimelineItem-avatar {\n position: absolute;\n /* stylelint-disable-next-line primer/spacing */\n left: -72px;\n z-index: 1;\n}\n\n.TimelineItem-break {\n position: relative;\n z-index: 1;\n height: var(--stack-gap-spacious);\n margin: 0;\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: calc(var(--stack-gap-normal) * -1);\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -56px;\n background-color: var(--bgColor-default);\n border: 0;\n border-top: var(--borderWidth-thicker) solid var(--borderColor-default);\n}\n\n.TimelineItem--condensed {\n padding-top: var(--base-size-4);\n padding-bottom: 0;\n\n /* TimelineItem--condensed is often grouped. (commits) */\n &:last-child {\n /* stylelint-disable-next-line primer/spacing */\n padding-bottom: var(--stack-gap-normal);\n }\n\n & .TimelineItem-badge {\n height: var(--base-size-16);\n margin-top: var(--base-size-8);\n margin-bottom: var(--base-size-8);\n color: var(--fgColor-muted);\n background-color: var(--bgColor-default);\n border: 0;\n }\n}\n"]}
1
+ {"version":3,"sources":["timeline_item.pcss"],"names":[],"mappings":"AAEA,cAEE,YAAa,CAIb,mCAAoC,CAFpC,qCAAsC,CAHtC,iBAyBF,CAjBE,qBASE,yCAA0C,CAN1C,QAAS,CAIT,UAAW,CAFX,aAAc,CADd,MAAO,CAHP,iBAAkB,CAClB,KAAM,CAIN,8BAIF,CAEA,yCACE,+CAAgD,CAEhD,mDACF,CAGF,oBAWE,kBAAmB,CACnB,6CAA8C,CAE9C,4DAA6D,CAC7D,iBAAkB,CALlB,0BAA2B,CAP3B,YAAa,CAcb,aAAc,CAZd,iCAAkC,CAWlC,sBAAuB,CAPvB,qDAAwD,CAFxD,qDAAsD,CANtD,iBAAkB,CAGlB,gCAAiC,CAFjC,SAgBF,CAEA,6BAEE,gDAAiD,CACjD,0CAAiD,CAFjD,+BAGF,CAEA,mBAKE,0BAA2B,CAC3B,SAAU,CAFV,yCAA0C,CAF1C,cAAe,CADf,WAMF,CAEA,qBAGE,UAAW,CAFX,iBAAkB,CAGlB,SACF,CAEA,oBASE,uCAAwC,CACxC,QAAS,CACT,sEAAuE,CARvE,gCAAiC,CACjC,QAAS,CAET,8CAAiD,CAEjD,iBAAkB,CAPlB,iBAAkB,CAClB,SAUF,CAEA,yBAEE,gBAAiB,CADjB,8BAiBF,CAbE,oCAEE,sCACF,CAEA,6CAKE,uCAAwC,CACxC,QAAS,CAFT,0BAA2B,CAH3B,0BAA2B,CAE3B,gCAAiC,CADjC,6BAKF","file":"timeline_item.css","sourcesContent":["/* TimelineItem */\n\n.TimelineItem {\n position: relative;\n display: flex;\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--stack-padding-normal) 0;\n /* stylelint-disable-next-line primer/spacing */\n margin-left: var(--stack-gap-normal);\n\n /* The Timeline */\n &::before {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n display: block;\n width: var(--borderWidth-thick);\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-muted);\n }\n\n &:target .TimelineItem-badge {\n border-color: var(--borderColor-accent-emphasis);\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: 0 0 0.2em var(--borderColor-accent-muted);\n }\n}\n\n.TimelineItem-badge {\n position: relative;\n z-index: 1;\n display: flex;\n width: var(--control-medium-size);\n height: var(--control-medium-size);\n /* stylelint-disable-next-line primer/spacing */\n margin-right: var(--controlStack-medium-gap-condensed);\n /* stylelint-disable-next-line primer/spacing */\n margin-left: calc(var(--control-medium-size) / -2 + 1px);\n color: var(--fgColor-muted);\n align-items: center;\n background-color: var(--timelineBadge-bgColor);\n /* stylelint-disable-next-line primer/colors */\n border: var(--borderWidth-thick) solid var(--bgColor-default);\n border-radius: 50%;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.TimelineItem-badge--success {\n color: var(--fgColor-onEmphasis);\n background-color: var(--bgColor-success-emphasis);\n border: var(--borderWidth-thin) solid transparent;\n}\n\n.TimelineItem-body {\n min-width: 0;\n max-width: 100%;\n /* stylelint-disable-next-line primer/spacing */\n margin-top: calc(var(--base-size-4) + 1px);\n color: var(--fgColor-muted);\n flex: auto;\n}\n\n.TimelineItem-avatar {\n position: absolute;\n /* stylelint-disable-next-line primer/spacing */\n left: -72px;\n z-index: 1;\n}\n\n.TimelineItem-break {\n position: relative;\n z-index: 1;\n height: var(--stack-gap-spacious);\n margin: 0;\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: calc(var(--stack-gap-normal) * -1);\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -56px;\n background-color: var(--bgColor-default);\n border: 0;\n border-top: var(--borderWidth-thicker) solid var(--borderColor-default);\n}\n\n.TimelineItem--condensed {\n padding-top: var(--base-size-4);\n padding-bottom: 0;\n\n /* TimelineItem--condensed is often grouped. (commits) */\n &:last-child {\n /* stylelint-disable-next-line primer/spacing */\n padding-bottom: var(--stack-gap-normal);\n }\n\n & .TimelineItem-badge {\n height: var(--base-size-16);\n margin-top: var(--base-size-8);\n margin-bottom: var(--base-size-8);\n color: var(--fgColor-muted);\n background-color: var(--bgColor-default);\n border: 0;\n }\n}\n"]}
@@ -57,7 +57,8 @@
57
57
  .TimelineItem-body {
58
58
  min-width: 0;
59
59
  max-width: 100%;
60
- margin-top: var(--base-size-4);
60
+ /* stylelint-disable-next-line primer/spacing */
61
+ margin-top: calc(var(--base-size-4) + 1px);
61
62
  color: var(--fgColor-muted);
62
63
  flex: auto;
63
64
  }
@@ -10,6 +10,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _DialogHelperElement_instances, _DialogHelperElement_abortController, _DialogHelperElement_handleDialogOpenAttribute;
13
+ function setScrollGutter(doc) {
14
+ if (doc.body.style.getPropertyValue('--dialog-scrollgutter'))
15
+ return;
16
+ doc.body.style.setProperty('--dialog-scrollgutter', `${window.innerWidth - doc.body.clientWidth}px`);
17
+ }
13
18
  function dialogInvokerButtonHandler(event) {
14
19
  const target = event.target;
15
20
  const button = target?.closest('button');
@@ -20,6 +25,7 @@ function dialogInvokerButtonHandler(event) {
20
25
  if (dialogId) {
21
26
  const dialog = document.getElementById(dialogId);
22
27
  if (dialog instanceof HTMLDialogElement) {
28
+ setScrollGutter(dialog.ownerDocument);
23
29
  dialog.showModal();
24
30
  // A buttons default behaviour in some browsers it to send a pointer event
25
31
  // If the behaviour is allowed through the dialog will be shown but then
@@ -92,7 +98,6 @@ export class DialogHelperElement extends HTMLElement {
92
98
  const { signal } = (__classPrivateFieldSet(this, _DialogHelperElement_abortController, new AbortController(), "f"));
93
99
  document.addEventListener('click', dialogInvokerButtonHandler, true);
94
100
  document.addEventListener('click', this, { signal });
95
- this.ownerDocument.body.style.setProperty('--dialog-scrollgutter', `${window.innerWidth - this.ownerDocument.body.clientWidth}px`);
96
101
  new MutationObserver(records => {
97
102
  for (const record of records) {
98
103
  if (record.target === this.dialog) {
@@ -132,6 +137,7 @@ _DialogHelperElement_abortController = new WeakMap(), _DialogHelperElement_insta
132
137
  // eslint-disable-next-line no-restricted-syntax
133
138
  this.dialog.addEventListener('close', e => e.stopImmediatePropagation(), { once: true });
134
139
  this.dialog.close();
140
+ setScrollGutter(this.dialog.ownerDocument);
135
141
  this.dialog.showModal();
136
142
  }
137
143
  };
@@ -1,3 +1,8 @@
1
+ function setScrollGutter(doc: Document) {
2
+ if (doc.body.style.getPropertyValue('--dialog-scrollgutter')) return
3
+ doc.body.style.setProperty('--dialog-scrollgutter', `${window.innerWidth - doc.body.clientWidth}px`)
4
+ }
5
+
1
6
  function dialogInvokerButtonHandler(event: Event) {
2
7
  const target = event.target as HTMLElement
3
8
  const button = target?.closest('button')
@@ -9,6 +14,7 @@ function dialogInvokerButtonHandler(event: Event) {
9
14
  if (dialogId) {
10
15
  const dialog = document.getElementById(dialogId)
11
16
  if (dialog instanceof HTMLDialogElement) {
17
+ setScrollGutter(dialog.ownerDocument)
12
18
  dialog.showModal()
13
19
  // A buttons default behaviour in some browsers it to send a pointer event
14
20
  // If the behaviour is allowed through the dialog will be shown but then
@@ -85,10 +91,6 @@ export class DialogHelperElement extends HTMLElement {
85
91
  const {signal} = (this.#abortController = new AbortController())
86
92
  document.addEventListener('click', dialogInvokerButtonHandler, true)
87
93
  document.addEventListener('click', this, {signal})
88
- this.ownerDocument.body.style.setProperty(
89
- '--dialog-scrollgutter',
90
- `${window.innerWidth - this.ownerDocument.body.clientWidth}px`,
91
- )
92
94
  new MutationObserver(records => {
93
95
  for (const record of records) {
94
96
  if (record.target === this.dialog) {
@@ -110,6 +112,7 @@ export class DialogHelperElement extends HTMLElement {
110
112
  // eslint-disable-next-line no-restricted-syntax
111
113
  this.dialog.addEventListener('close', e => e.stopImmediatePropagation(), {once: true})
112
114
  this.dialog.close()
115
+ setScrollGutter(this.dialog.ownerDocument)
113
116
  this.dialog.showModal()
114
117
  }
115
118
  }
@@ -6,7 +6,7 @@ module Primer
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 51
9
- PATCH = 0
9
+ PATCH = 2
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -9,12 +9,14 @@ module Primer
9
9
  # @param select_variant [Symbol] select [single, multiple, none]
10
10
  # @param anchor_align [Symbol] select [start, center, end]
11
11
  # @param anchor_side [Symbol] select [outside_bottom, outside_top, outside_left, outside_right]
12
+ # @param anchor_when_narrow [Symbol] select [inherit, bottom, fullscreen, left, right]
12
13
  # @param size [Symbol] select [auto, small, medium, large, xlarge]
13
14
  def playground(
14
15
  select_variant: Primer::Alpha::ActionMenu::DEFAULT_SELECT_VARIANT, anchor_align: Primer::Alpha::Overlay::DEFAULT_ANCHOR_ALIGN, anchor_side: Primer::Alpha::Overlay::DEFAULT_ANCHOR_SIDE,
16
+ anchor_when_narrow: Primer::Alpha::Overlay::DEFAULT_ANCHOR_WHEN_NARROW,
15
17
  size: Primer::Alpha::Overlay::DEFAULT_SIZE
16
18
  )
17
- render(Primer::Alpha::ActionMenu.new(select_variant: select_variant, anchor_align: anchor_align, anchor_side: anchor_side, size: size)) do |menu|
19
+ render(Primer::Alpha::ActionMenu.new(select_variant: select_variant, anchor_align: anchor_align, anchor_side: anchor_side, anchor_when_narrow: anchor_when_narrow, size: size)) do |menu|
18
20
  menu.with_show_button { "Menu" }
19
21
  menu.with_item(label: "Copy link")
20
22
  menu.with_item(label: "Quote reply")
@@ -405,6 +407,35 @@ module Primer
405
407
  # @label Two menus
406
408
  #
407
409
  def two_menus; end
410
+
411
+ # @label Fullscreen when narrow
412
+ #
413
+ def fullscreen_when_narrow
414
+ render(Primer::Alpha::ActionMenu.new(anchor_when_narrow: :fullscreen)) do |menu|
415
+ menu.with_show_button do |button|
416
+ button.with_trailing_action_icon(icon: :"triangle-down")
417
+ "Options"
418
+ end
419
+
420
+ menu.with_item(label: "Edit profile") do |item|
421
+ item.with_description.with_content("Update your profile information")
422
+ end
423
+
424
+ menu.with_item(label: "Settings") do |item|
425
+ item.with_description.with_content("Configure your preferences")
426
+ end
427
+
428
+ menu.with_item(label: "Notifications") do |item|
429
+ item.with_description.with_content("Manage notification settings")
430
+ end
431
+
432
+ menu.with_divider
433
+
434
+ menu.with_item(label: "Sign out", scheme: :danger) do |item|
435
+ item.with_description.with_content("Log out of your account")
436
+ end
437
+ end
438
+ end
408
439
  end
409
440
  end
410
441
  end
@@ -0,0 +1,32 @@
1
+ <%= render(Primer::Beta::Truncate.new(tag: :ol)) do |component| %>
2
+ <% component.with_item(tag: :li) do %>
3
+ <%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-primer")) do |link| %>
4
+ <% link.with_tooltip(text: "primer") %>
5
+ primer
6
+ <% end %>
7
+ <% end %>
8
+ <% component.with_item(tag: :li, priority: true) do %>
9
+ <%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-css")) do |link| %>
10
+ <% link.with_tooltip(text: "/ css") %>
11
+ / css
12
+ <% end %>
13
+ <% end %>
14
+ <% component.with_item(tag: :li) do %>
15
+ <%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-issues")) do |link| %>
16
+ <% link.with_tooltip(text: "/ Issues") %>
17
+ / Issues
18
+ <% end %>
19
+ <% end %>
20
+ <% component.with_item(tag: :li) do %>
21
+ <%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-number")) do |link| %>
22
+ <% link.with_tooltip(text: "/ #123") %>
23
+ / #123
24
+ <% end %>
25
+ <% end %>
26
+ <% component.with_item(tag: :li, priority: true) do %>
27
+ <%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-title")) do |link| %>
28
+ <% link.with_tooltip(text: "Visual bug on primer.style found in lists") %>
29
+ Visual bug on primer.style found in lists
30
+ <% end %>
31
+ <% end %>
32
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <% long_text = "branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long" %>
2
+
3
+ <%= render(Primer::Beta::Truncate.new) do |component| %>
4
+ <% component.with_item(max_width: 300) do %>
5
+ <%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-300")) do |link| %>
6
+ <% link.with_tooltip(text: long_text) %>
7
+ <%= long_text %>
8
+ <% end %>
9
+ <% end %>
10
+ <% component.with_item(max_width: 200) do %>
11
+ <%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-200")) do |link| %>
12
+ <% link.with_tooltip(text: long_text) %>
13
+ <%= long_text %>
14
+ <% end %>
15
+ <% end %>
16
+ <% component.with_item(max_width: 100) do %>
17
+ <%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-100")) do |link| %>
18
+ <% link.with_tooltip(text: long_text) %>
19
+ <%= long_text %>
20
+ <% end %>
21
+ <% end %>
22
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <%= render(Primer::Beta::Truncate.new) do |component| %>
2
+ <% component.with_item do %>
3
+ <%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-owner")) do |link| %>
4
+ <% link.with_tooltip(text: "really-long-repository-owner-name") %>
5
+ really-long-repository-owner-name
6
+ <% end %>
7
+ <% end %>
8
+ <% component.with_item(font_weight: :bold) do %>
9
+ <%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-repo")) do |link| %>
10
+ <% link.with_tooltip(text: "really-long-repository-name") %>
11
+ really-long-repository-name
12
+ <% end %>
13
+ <% end %>
14
+ <% end %>
@@ -19,37 +19,14 @@ module Primer
19
19
  end
20
20
 
21
21
  # @label Multiple items
22
- def multiple_items
23
- render(Primer::Beta::Truncate.new) do |component|
24
- component.with_item do
25
- "really-long-repository-owner-name"
26
- end
27
- component.with_item(font_weight: :bold) do
28
- "really-long-repository-name"
29
- end
30
- end
31
- end
22
+ def multiple_items; end
32
23
 
33
24
  # @label Advanced multiple items
34
- def advanced_multiple_items
35
- render(Primer::Beta::Truncate.new(tag: :ol)) do |component|
36
- component.with_item(tag: :li) { "primer" }
37
- component.with_item(tag: :li, priority: true) { "/ css" }
38
- component.with_item(tag: :li) { "/ Issues" }
39
- component.with_item(tag: :li) { "/ #123" }
40
- component.with_item(tag: :li, priority: true) { "Visual bug on primer.style found in lists" }
41
- end
42
- end
25
+ def advanced_multiple_items; end
43
26
 
44
27
  # @label Max widths
45
28
  # @snapshot
46
- def max_widths
47
- render(Primer::Beta::Truncate.new) do |component|
48
- component.with_item(max_width: 300) { "branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long" }
49
- component.with_item(max_width: 200) { "branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long" }
50
- component.with_item(max_width: 100) { "branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long" }
51
- end
52
- end
29
+ def max_widths; end
53
30
  end
54
31
  end
55
32
  end
@@ -343,6 +343,12 @@
343
343
  "default": "`:outside_bottom`",
344
344
  "description": "One of `:inside_bottom`, `:inside_center`, `:inside_left`, `:inside_right`, `:inside_top`, `:outside_bottom`, `:outside_left`, `:outside_right`, or `:outside_top`.."
345
345
  },
346
+ {
347
+ "name": "anchor_when_narrow",
348
+ "type": "Symbol",
349
+ "default": "`:inherit`",
350
+ "description": "One of `:bottom`, `:fullscreen`, `:inherit`, `:left`, or `:right`.."
351
+ },
346
352
  {
347
353
  "name": "size",
348
354
  "type": "Symbol",
@@ -1910,6 +1916,12 @@
1910
1916
  "default": "`:normal`",
1911
1917
  "description": "The anchor offset to give the Overlay. One of `:normal` or `:spacious`."
1912
1918
  },
1919
+ {
1920
+ "name": "anchor_when_narrow",
1921
+ "type": "Symbol",
1922
+ "default": "`:inherit`",
1923
+ "description": "The position of the Overlay when in a narrow viewport. One of `:bottom`, `:fullscreen`, `:inherit`, `:left`, or `:right`."
1924
+ },
1913
1925
  {
1914
1926
  "name": "allow_out_of_bounds",
1915
1927
  "type": "Boolean",
@@ -3892,7 +3904,14 @@
3892
3904
  "short_name": "AutoCompleteNoResultItem",
3893
3905
  "source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/auto_complete/no_result_item.rb",
3894
3906
  "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/auto_complete/no_result_item/default/",
3895
- "parameters": []
3907
+ "parameters": [
3908
+ {
3909
+ "name": "system_arguments",
3910
+ "type": "Hash",
3911
+ "default": "N/A",
3912
+ "description": "[System arguments](/system-arguments)"
3913
+ }
3914
+ ]
3896
3915
  },
3897
3916
  {
3898
3917
  "component": "Avatar",
@@ -5015,6 +5034,12 @@
5015
5034
  "default": "`TIMEZONENAME_DEFAULT`",
5016
5035
  "description": "What format the time zone should take. One of `nil`, `:long`, `:long_generic`, `:long_offset`, `:short`, `:short_generic`, or `:short_offset`."
5017
5036
  },
5037
+ {
5038
+ "name": "time_zone",
5039
+ "type": "String",
5040
+ "default": "`nil`",
5041
+ "description": "The IANA time zone identifier to use for formatting (e.g., \"America/New_York\")."
5042
+ },
5018
5043
  {
5019
5044
  "name": "threshold",
5020
5045
  "type": "String",
data/static/classes.json CHANGED
@@ -423,6 +423,9 @@
423
423
  "Overlay--full-whenNarrow": [
424
424
  "Primer::Alpha::Dialog"
425
425
  ],
426
+ "Overlay--fullscreen-whenNarrow": [
427
+ "Primer::Alpha::Dialog"
428
+ ],
426
429
  "Overlay--hidden": [
427
430
  "Primer::Alpha::Dialog"
428
431
  ],
@@ -579,11 +579,26 @@
579
579
  "outside_left",
580
580
  "outside_right"
581
581
  ],
582
+ "ANCHOR_WHEN_NARROW_MAPPINGS": {
583
+ "inherit": "",
584
+ "bottom": "Overlay--placement-bottom-whenNarrow",
585
+ "fullscreen": "Overlay--fullscreen-whenNarrow",
586
+ "left": "Overlay--placement-left-whenNarrow",
587
+ "right": "Overlay--placement-right-whenNarrow"
588
+ },
589
+ "ANCHOR_WHEN_NARROW_OPTIONS": [
590
+ "inherit",
591
+ "bottom",
592
+ "fullscreen",
593
+ "left",
594
+ "right"
595
+ ],
582
596
  "Body": "Primer::Alpha::Overlay::Body",
583
597
  "DEFAULT_ALIGN_CONTENT": "end",
584
598
  "DEFAULT_ANCHOR_ALIGN": "start",
585
599
  "DEFAULT_ANCHOR_OFFSET": "normal",
586
600
  "DEFAULT_ANCHOR_SIDE": "outside_bottom",
601
+ "DEFAULT_ANCHOR_WHEN_NARROW": "inherit",
587
602
  "DEFAULT_PADDING": "normal",
588
603
  "DEFAULT_POPOVER": "auto",
589
604
  "DEFAULT_SIZE": "auto",
@@ -1203,6 +1203,12 @@
1203
1203
  "default": "`:outside_bottom`",
1204
1204
  "description": "One of `:inside_bottom`, `:inside_center`, `:inside_left`, `:inside_right`, `:inside_top`, `:outside_bottom`, `:outside_left`, `:outside_right`, or `:outside_top`.."
1205
1205
  },
1206
+ {
1207
+ "name": "anchor_when_narrow",
1208
+ "type": "Symbol",
1209
+ "default": "`:inherit`",
1210
+ "description": "One of `:bottom`, `:fullscreen`, `:inherit`, `:left`, or `:right`.."
1211
+ },
1206
1212
  {
1207
1213
  "name": "size",
1208
1214
  "type": "Symbol",
@@ -1763,6 +1769,19 @@
1763
1769
  "color-contrast"
1764
1770
  ]
1765
1771
  }
1772
+ },
1773
+ {
1774
+ "preview_path": "primer/alpha/action_menu/fullscreen_when_narrow",
1775
+ "name": "fullscreen_when_narrow",
1776
+ "snapshot": "false",
1777
+ "skip_rules": {
1778
+ "wont_fix": [
1779
+ "region"
1780
+ ],
1781
+ "will_fix": [
1782
+ "color-contrast"
1783
+ ]
1784
+ }
1766
1785
  }
1767
1786
  ],
1768
1787
  "subcomponents": [
@@ -5915,6 +5934,12 @@
5915
5934
  "default": "`:normal`",
5916
5935
  "description": "The anchor offset to give the Overlay. One of `:normal` or `:spacious`."
5917
5936
  },
5937
+ {
5938
+ "name": "anchor_when_narrow",
5939
+ "type": "Symbol",
5940
+ "default": "`:inherit`",
5941
+ "description": "The position of the Overlay when in a narrow viewport. One of `:bottom`, `:fullscreen`, `:inherit`, `:left`, or `:right`."
5942
+ },
5918
5943
  {
5919
5944
  "name": "allow_out_of_bounds",
5920
5945
  "type": "Boolean",
@@ -11854,6 +11879,32 @@
11854
11879
  }
11855
11880
  ],
11856
11881
  "subcomponents": [
11882
+ {
11883
+ "fully_qualified_name": "Primer::Beta::AutoComplete::NoResultItem",
11884
+ "description": "Use `NoResultItem` to display a message when no autocomplete results are found.\nRenders as a simple div inside the overlay, not as a list item.",
11885
+ "accessibility_docs": null,
11886
+ "is_form_component": false,
11887
+ "is_published": true,
11888
+ "requires_js": false,
11889
+ "component": "AutoComplete::NoResultItem",
11890
+ "status": "beta",
11891
+ "a11y_reviewed": false,
11892
+ "short_name": "AutoCompleteNoResultItem",
11893
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/auto_complete/no_result_item.rb",
11894
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/auto_complete/no_result_item/default/",
11895
+ "parameters": [
11896
+ {
11897
+ "name": "system_arguments",
11898
+ "type": "Hash",
11899
+ "default": "N/A",
11900
+ "description": "{{link_to_system_arguments_docs}}"
11901
+ }
11902
+ ],
11903
+ "slots": [],
11904
+ "methods": [],
11905
+ "previews": [],
11906
+ "subcomponents": []
11907
+ },
11857
11908
  {
11858
11909
  "fully_qualified_name": "Primer::Beta::AutoComplete::Item",
11859
11910
  "description": "Use `AutoCompleteItem` to list results of an auto-completed search.",
@@ -11946,62 +11997,6 @@
11946
11997
  "methods": [],
11947
11998
  "previews": [],
11948
11999
  "subcomponents": []
11949
- },
11950
- {
11951
- "fully_qualified_name": "Primer::Beta::AutoComplete::NoResultItem",
11952
- "description": "",
11953
- "accessibility_docs": null,
11954
- "is_form_component": false,
11955
- "is_published": true,
11956
- "requires_js": false,
11957
- "component": "AutoComplete::NoResultItem",
11958
- "status": "beta",
11959
- "a11y_reviewed": false,
11960
- "short_name": "AutoCompleteNoResultItem",
11961
- "source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/auto_complete/no_result_item.rb",
11962
- "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/auto_complete/no_result_item/default/",
11963
- "parameters": [],
11964
- "slots": [
11965
- {
11966
- "name": "leading_visual",
11967
- "description": "The leading visual rendered before the link.",
11968
- "parameters": [
11969
- {
11970
- "name": "kwargs",
11971
- "type": "Hash",
11972
- "default": "N/A",
11973
- "description": "The arguments accepted by {{#link_to_component}}Primer::Beta::Avatar{{/link_to_component}} or {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}"
11974
- }
11975
- ]
11976
- },
11977
- {
11978
- "name": "trailing_visual",
11979
- "description": "The trailing visual rendered after the link.",
11980
- "parameters": [
11981
- {
11982
- "name": "kwargs",
11983
- "type": "Hash",
11984
- "default": "N/A",
11985
- "description": "The arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}, {{#link_to_component}}Primer::Beta::Label{{/link_to_component}}, or {{#link_to_component}}Primer::Beta::Counter{{/link_to_component}}"
11986
- }
11987
- ]
11988
- },
11989
- {
11990
- "name": "description",
11991
- "description": "Optional description",
11992
- "parameters": [
11993
- {
11994
- "name": "system_arguments",
11995
- "type": "Hash",
11996
- "default": "N/A",
11997
- "description": "{{link_to_system_arguments_docs}}"
11998
- }
11999
- ]
12000
- }
12001
- ],
12002
- "methods": [],
12003
- "previews": [],
12004
- "subcomponents": []
12005
12000
  }
12006
12001
  ]
12007
12002
  },
@@ -16722,6 +16717,12 @@
16722
16717
  "default": "`TIMEZONENAME_DEFAULT`",
16723
16718
  "description": "What format the time zone should take. One of `nil`, `:long`, `:long_generic`, `:long_offset`, `:short`, `:short_generic`, or `:short_offset`."
16724
16719
  },
16720
+ {
16721
+ "name": "time_zone",
16722
+ "type": "String",
16723
+ "default": "`nil`",
16724
+ "description": "The IANA time zone identifier to use for formatting (e.g., \"America/New_York\")."
16725
+ },
16725
16726
  {
16726
16727
  "name": "threshold",
16727
16728
  "type": "String",
data/static/previews.json CHANGED
@@ -826,6 +826,19 @@
826
826
  "color-contrast"
827
827
  ]
828
828
  }
829
+ },
830
+ {
831
+ "preview_path": "primer/alpha/action_menu/fullscreen_when_narrow",
832
+ "name": "fullscreen_when_narrow",
833
+ "snapshot": "false",
834
+ "skip_rules": {
835
+ "wont_fix": [
836
+ "region"
837
+ ],
838
+ "will_fix": [
839
+ "color-contrast"
840
+ ]
841
+ }
829
842
  }
830
843
  ]
831
844
  },
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.51.0
4
+ version: 0.51.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-25 00:00:00.000000000 Z
11
+ date: 2026-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -1048,6 +1048,9 @@ files:
1048
1048
  - previews/primer/beta/text_preview.rb
1049
1049
  - previews/primer/beta/timeline_item_preview.rb
1050
1050
  - previews/primer/beta/truncate_preview.rb
1051
+ - previews/primer/beta/truncate_preview/advanced_multiple_items.html.erb
1052
+ - previews/primer/beta/truncate_preview/max_widths.html.erb
1053
+ - previews/primer/beta/truncate_preview/multiple_items.html.erb
1051
1054
  - previews/primer/box_preview.rb
1052
1055
  - previews/primer/forms_preview.rb
1053
1056
  - previews/primer/forms_preview/action_menu_form.html.erb