primer_view_components 0.0.117 → 0.0.118

Sign up to get free protection for your applications and to get access to all the features.
@@ -128,7 +128,7 @@ module Primer
128
128
  # @param parent [Primer::Alpha::ActionList::Item] This item's parent item. `nil` if this item is at the root. Used internally.
129
129
  # @param label [String] Item label.
130
130
  # @param label_classes [String] CSS classes that will be added to the label.
131
- # @param content_arguments [Hash] <%= link_to_system_arguments_docs %> used to construct the item's anchor or span tag.
131
+ # @param content_arguments [Hash] <%= link_to_system_arguments_docs %> used to construct the item's anchor or button tag.
132
132
  # @param truncate_label [Boolean] Truncate label with ellipsis.
133
133
  # @param href [String] Link URL.
134
134
  # @param role [String] ARIA role describing the function of the item.
@@ -206,7 +206,7 @@ module Primer
206
206
  @content_arguments[:tag] = :a
207
207
  @content_arguments[:href] = @href
208
208
  else
209
- @content_arguments[:tag] = :span
209
+ @content_arguments[:tag] = :button
210
210
  @content_arguments[:onclick] = on_click if on_click
211
211
  end
212
212
 
@@ -27,7 +27,8 @@ module Primer
27
27
  :medium_portrait => "Overlay--size-medium-portrait",
28
28
  DEFAULT_SIZE => "Overlay--size-medium",
29
29
  :large => "Overlay--size-large",
30
- :xlarge => "Overlay--size-xlarge"
30
+ :xlarge => "Overlay--size-xlarge",
31
+ :auto => "Overlay--size-auto"
31
32
  }.freeze
32
33
  SIZE_OPTIONS = SIZE_MAPPINGS.keys
33
34
 
@@ -51,14 +52,14 @@ module Primer
51
52
 
52
53
  # Optional button to open the dialog.
53
54
  #
54
- # @param system_arguments [Hash] The same arguments as <%= link_to_component(Primer::ButtonComponent) %>.
55
+ # @param system_arguments [Hash] The same arguments as <%= link_to_component(Primer::Beta::Button) %>.
55
56
  renders_one :show_button, lambda { |**system_arguments|
56
57
  system_arguments[:classes] = class_names(
57
58
  system_arguments[:classes]
58
59
  )
59
60
  system_arguments[:id] = "dialog-show-#{@system_arguments[:id]}"
60
61
  system_arguments[:data] = (system_arguments[:data] || {}).merge({ "show-dialog-id": @system_arguments[:id] })
61
- Primer::ButtonComponent.new(**system_arguments)
62
+ Primer::Beta::Button.new(**system_arguments)
62
63
  }
63
64
 
64
65
  # Header content.
@@ -21,9 +21,11 @@ const overlayStack = [];
21
21
  function clickHandler(event) {
22
22
  const target = event.target;
23
23
  const button = target === null || target === void 0 ? void 0 : target.closest('button');
24
+ if (!button)
25
+ return;
24
26
  // If the user is clicking a valid dialog trigger
25
27
  let dialogId = button === null || button === void 0 ? void 0 : button.getAttribute('data-show-dialog-id');
26
- if (button && dialogId) {
28
+ if (dialogId) {
27
29
  event.stopPropagation();
28
30
  const dialog = document.getElementById(dialogId);
29
31
  if (dialog instanceof ModalDialogElement) {
@@ -36,17 +38,6 @@ function clickHandler(event) {
36
38
  const topLevelDialog = overlayStack[overlayStack.length - 1];
37
39
  if (!topLevelDialog)
38
40
  return;
39
- // Check if the click happened outside the boundary of the top level dialog
40
- const clickOutsideDialog = !target.closest(`#${topLevelDialog.getAttribute('id')}`);
41
- // Only close dialog if it's a click outside the dialog and the dialog has a
42
- // button?
43
- if (!button) {
44
- if (clickOutsideDialog) {
45
- overlayStack.pop();
46
- topLevelDialog.close();
47
- }
48
- return;
49
- }
50
41
  dialogId = button.getAttribute('data-close-dialog-id');
51
42
  if (dialogId === topLevelDialog.id) {
52
43
  overlayStack.pop();
@@ -58,6 +49,26 @@ function clickHandler(event) {
58
49
  topLevelDialog.close(true);
59
50
  }
60
51
  }
52
+ function mousedownHandler(event) {
53
+ const target = event.target;
54
+ if (target === null || target === void 0 ? void 0 : target.closest('button'))
55
+ return;
56
+ // Find the top level dialog that is open.
57
+ const topLevelDialog = overlayStack[overlayStack.length - 1];
58
+ if (!topLevelDialog)
59
+ return;
60
+ // Check if the mousedown happened outside the boundary of the top level dialog
61
+ const mouseDownOutsideDialog = !target.closest(`#${topLevelDialog.getAttribute('id')}`);
62
+ // Only close dialog if it's a click outside the dialog and the dialog has a button?
63
+ if (mouseDownOutsideDialog) {
64
+ target.ownerDocument.addEventListener('mouseup', (upEvent) => {
65
+ if (upEvent.target === target) {
66
+ overlayStack.pop();
67
+ topLevelDialog.close();
68
+ }
69
+ }, { once: true });
70
+ }
71
+ }
61
72
  export class ModalDialogElement extends HTMLElement {
62
73
  constructor() {
63
74
  super(...arguments);
@@ -109,6 +120,7 @@ export class ModalDialogElement extends HTMLElement {
109
120
  if (!this.hasAttribute('role'))
110
121
  this.setAttribute('role', 'dialog');
111
122
  document.addEventListener('click', clickHandler);
123
+ document.addEventListener('mousedown', mousedownHandler);
112
124
  this.addEventListener('keydown', e => __classPrivateFieldGet(this, _ModalDialogElement_instances, "m", _ModalDialogElement_keydown).call(this, e));
113
125
  }
114
126
  show() {
@@ -12,10 +12,11 @@ const overlayStack: ModalDialogElement[] = []
12
12
  function clickHandler(event: Event) {
13
13
  const target = event.target as HTMLElement
14
14
  const button = target?.closest('button')
15
+ if (!button) return
15
16
 
16
17
  // If the user is clicking a valid dialog trigger
17
18
  let dialogId = button?.getAttribute('data-show-dialog-id')
18
- if (button && dialogId) {
19
+ if (dialogId) {
19
20
  event.stopPropagation()
20
21
  const dialog = document.getElementById(dialogId)
21
22
  if (dialog instanceof ModalDialogElement) {
@@ -24,24 +25,10 @@ function clickHandler(event: Event) {
24
25
  return
25
26
  }
26
27
  }
27
-
28
28
  // Find the top level dialog that is open.
29
29
  const topLevelDialog = overlayStack[overlayStack.length - 1]
30
30
  if (!topLevelDialog) return
31
31
 
32
- // Check if the click happened outside the boundary of the top level dialog
33
- const clickOutsideDialog = !target.closest(`#${topLevelDialog.getAttribute('id')}`)
34
-
35
- // Only close dialog if it's a click outside the dialog and the dialog has a
36
- // button?
37
- if (!button) {
38
- if (clickOutsideDialog) {
39
- overlayStack.pop()
40
- topLevelDialog.close()
41
- }
42
- return
43
- }
44
-
45
32
  dialogId = button.getAttribute('data-close-dialog-id')
46
33
  if (dialogId === topLevelDialog.id) {
47
34
  overlayStack.pop()
@@ -55,6 +42,32 @@ function clickHandler(event: Event) {
55
42
  }
56
43
  }
57
44
 
45
+ function mousedownHandler(event: Event) {
46
+ const target = event.target as HTMLElement
47
+ if (target?.closest('button')) return
48
+
49
+ // Find the top level dialog that is open.
50
+ const topLevelDialog = overlayStack[overlayStack.length - 1]
51
+ if (!topLevelDialog) return
52
+
53
+ // Check if the mousedown happened outside the boundary of the top level dialog
54
+ const mouseDownOutsideDialog = !target.closest(`#${topLevelDialog.getAttribute('id')}`)
55
+
56
+ // Only close dialog if it's a click outside the dialog and the dialog has a button?
57
+ if (mouseDownOutsideDialog) {
58
+ target.ownerDocument.addEventListener(
59
+ 'mouseup',
60
+ (upEvent: Event) => {
61
+ if (upEvent.target === target) {
62
+ overlayStack.pop()
63
+ topLevelDialog.close()
64
+ }
65
+ },
66
+ {once: true}
67
+ )
68
+ }
69
+ }
70
+
58
71
  export class ModalDialogElement extends HTMLElement {
59
72
  //TODO: Do we remove the abortController from focusTrap?
60
73
  #focusAbortController = new AbortController()
@@ -109,6 +122,7 @@ export class ModalDialogElement extends HTMLElement {
109
122
  if (!this.hasAttribute('role')) this.setAttribute('role', 'dialog')
110
123
 
111
124
  document.addEventListener('click', clickHandler)
125
+ document.addEventListener('mousedown', mousedownHandler)
112
126
 
113
127
  this.addEventListener('keydown', e => this.#keydown(e))
114
128
  }
@@ -1 +1 @@
1
- :root{--primer-duration-fast:80ms;--primer-easing-easeInOut:cubic-bezier(0.65,0,0.35,1)}.Button{align-items:center;background-color:initial;border:var(--primer-borderWidth-thin,1px) solid;border-color:#0000;border-radius:var(--primer-borderRadius-medium,6px);color:var(--color-btn-text);cursor:pointer;display:flex;flex-direction:row;font-size:var(--primer-text-body-size-medium,14px);font-weight:var(--base-text-weight-medium,500);gap:var(--primer-control-medium-gap,8px);height:var(--primer-control-medium-size,32px);justify-content:space-between;min-width:max-content;padding:0 var(--primer-control-medium-paddingInline-normal,12px);position:relative;text-align:center;transition:var(--primer-duration-fast) var(--primer-easing-easeInOut);transition-property:color,fill,background-color,border-color;-webkit-user-select:none;user-select:none}@media (pointer:course){.Button:before{content:"";height:100%;left:50%;min-height:48px;min-width:48px;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:100%}}.Button:hover{transition-duration:var(--primer-duration-fast)}.Button:active{transition:none}.Button:disabled,.Button[aria-disabled=true]{box-shadow:none;cursor:not-allowed}.Button-withTooltip{display:inline-block;position:relative}a.Button,summary.Button{display:inline-flex}a.Button:hover,summary.Button:hover{text-decoration:none}.Button-content{align-items:center;display:grid;flex:1 0 auto;grid-template-areas:"leadingVisual text trailingVisual";grid-template-columns:min-content minmax(0,auto) min-content;place-content:center}.Button-content>:not(:last-child){margin-right:var(--primer-control-medium-gap,8px)}.Button-content--alignStart{justify-content:start}.Button-visual{display:flex;pointer-events:none}.Button-visual .Counter{background-color:var(--color-btn-counter-bg);color:inherit}.Button-label{grid-area:text;line-height:var(--primer-text-body-lineHeight-medium,1.42857);white-space:nowrap}.Button-leadingVisual{grid-area:leadingVisual}.Button-trailingVisual{grid-area:trailingVisual}.Button-trailingAction{margin-right:calc(var(--base-size-4, 4px)*-1)}.Button--small{font-size:var(--primer-text-body-size-small,12px);gap:var(--primer-control-small-gap,4px);height:var(--primer-control-small-size,28px);padding:0 var(--primer-control-small-paddingInline-condensed,8px)}.Button--small .Button-label{line-height:var(--primer-text-body-lineHeight-small,1.66667)}.Button--small .Button-content>:not(:last-child){margin-right:var(--primer-control-small-gap,4px)}.Button--large{gap:var(--primer-control-large-gap,8px);height:var(--primer-control-large-size,40px);padding:0 var(--primer-control-large-paddingInline-spacious,16px)}.Button--large .Button-label{line-height:var(--primer-text-body-lineHeight-large,1.5)}.Button--large .Button-content>:not(:last-child){margin-right:var(--primer-control-large-gap,8px)}.Button--fullWidth{width:100%}.Button--primary{fill:var(--color-btn-primary-icon);background-color:var(--color-btn-primary-bg);border-color:var(--color-btn-primary-border);box-shadow:var(--color-btn-primary-shadow),var(--color-btn-primary-inset-shadow);color:var(--color-btn-primary-text)}.Button--primary:hover:not(:disabled){background-color:var(--color-btn-primary-hover-bg);border-color:var(--color-btn-primary-hover-border)}.Button--primary:focus{box-shadow:inset 0 0 0 3px var(--color-fg-on-emphasis);outline:2px solid var(--color-accent-fg);outline-offset:-2px}.Button--primary:focus:not(:focus-visible){box-shadow:none;outline:1px solid #0000}.Button--primary:focus-visible{box-shadow:inset 0 0 0 3px var(--color-fg-on-emphasis);outline:2px solid var(--color-accent-fg);outline-offset:-2px}.Button--primary:active:not(:disabled),.Button--primary[aria-pressed=true]{background-color:var(--color-btn-primary-selected-bg);box-shadow:var(--color-btn-primary-selected-shadow)}.Button--primary:disabled,.Button--primary[aria-disabled=true]{fill:var(--color-btn-primary-disabled-text);background-color:var(--color-btn-primary-disabled-bg);border-color:var(--color-btn-primary-disabled-border);color:var(--color-btn-primary-disabled-text)}.Button--secondary{fill:var(--color-fg-muted);background-color:var(--color-btn-bg);border-color:var(--color-btn-border);box-shadow:var(--color-btn-shadow),var(--color-btn-inset-shadow);color:var(--color-btn-text)}.Button--secondary:hover:not(:disabled){background-color:var(--color-btn-hover-bg);border-color:var(--color-btn-hover-border)}.Button--secondary:active:not(:disabled){background-color:var(--color-btn-active-bg);border-color:var(--color-btn-active-border)}.Button--secondary[aria-pressed=true]{background-color:var(--color-btn-selected-bg);box-shadow:var(--color-primer-shadow-inset)}.Button--secondary:disabled,.Button--secondary[aria-disabled=true]{fill:var(--color-primer-fg-disabled);background-color:var(--color-btn-bg);border-color:var(--color-btn-border);color:var(--color-primer-fg-disabled)}.Button--invisible{color:var(--color-btn-text)}.Button--invisible:hover:not(:disabled){background-color:var(--color-action-list-item-default-hover-bg)}.Button--invisible:active:not(:disabled),.Button--invisible[aria-pressed=true]{background-color:var(--color-action-list-item-default-active-bg)}.Button--invisible:disabled,.Button--invisible[aria-disabled=true]{fill:var(--color-primer-fg-disabled);background-color:var(--color-btn-bg);border-color:var(--color-btn-border);color:var(--color-primer-fg-disabled)}.Button--invisible.Button--invisible-noVisuals .Button-label{color:var(--color-accent-fg)}.Button--invisible .Button-visual{color:var(--color-fg-muted)}.Button--link{fill:var(--color-accent-fg);border:none;color:var(--color-accent-fg);display:inline-block;font-size:inherit;height:unset;padding:0}.Button--link:hover:not(:disabled){text-decoration:underline}.Button--link:focus,.Button--link:focus-visible{outline-offset:2px}.Button--link:disabled,.Button--link[aria-disabled=true]{fill:var(--color-primer-fg-disabled);background-color:initial;border-color:#0000;color:var(--color-primer-fg-disabled)}.Button--danger{fill:var(--color-btn-danger-icon);background-color:var(--color-btn-bg);border-color:var(--color-btn-border);box-shadow:var(--color-btn-shadow),var(--color-btn-inset-shadow);color:var(--color-btn-danger-text)}.Button--danger:hover:not(:disabled){fill:var(--color-btn-danger-hover-text);background-color:var(--color-btn-danger-hover-bg);border-color:var(--color-btn-danger-hover-border);box-shadow:var(--color-btn-danger-hover-shadow),var(--color-btn-danger-hover-inset-shadow);color:var(--color-btn-danger-hover-text)}.Button--danger:active:not(:disabled),.Button--danger[aria-pressed=true]{fill:var(--color-btn-danger-selected-text);background-color:var(--color-btn-danger-selected-bg);border-color:var(--color-btn-danger-selected-border);box-shadow:var(--color-btn-danger-selected-shadow);color:var(--color-btn-danger-selected-text)}.Button--danger:disabled,.Button--danger[aria-disabled=true]{fill:var(--color-btn-danger-disabled-text);background-color:var(--color-btn-danger-disabled-bg);border-color:var(--color-btn-border);color:var(--color-btn-danger-disabled-text)}.Button--iconOnly{display:grid;padding:unset;place-content:center;width:var(--primer-control-medium-size,32px)}.Button--iconOnly.Button--small{width:var(--primer-control-small-size,28px)}.Button--iconOnly.Button--large{width:var(--primer-control-large-size,40px)}
1
+ :root{--primer-duration-fast:80ms;--primer-easing-easeInOut:cubic-bezier(0.65,0,0.35,1)}.Button{align-items:center;background-color:initial;border:var(--primer-borderWidth-thin,1px) solid;border-color:#0000;border-radius:var(--primer-borderRadius-medium,6px);color:var(--color-btn-text);cursor:pointer;display:flex;flex-direction:row;font-size:var(--primer-text-body-size-medium,14px);font-weight:var(--base-text-weight-medium,500);gap:var(--primer-control-medium-gap,8px);height:var(--primer-control-medium-size,32px);justify-content:space-between;min-width:max-content;padding:0 var(--primer-control-medium-paddingInline-normal,12px);position:relative;text-align:center;transition:var(--primer-duration-fast) var(--primer-easing-easeInOut);transition-property:color,fill,background-color,border-color;-webkit-user-select:none;user-select:none}@media (pointer:coarse){.Button:before{content:"";height:100%;left:50%;min-height:48px;min-width:48px;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:100%}}.Button:hover{transition-duration:var(--primer-duration-fast)}.Button:active{transition:none}.Button:disabled,.Button[aria-disabled=true]{box-shadow:none;cursor:not-allowed}.Button-withTooltip{display:inline-block;position:relative}a.Button,summary.Button{display:inline-flex}a.Button:hover,summary.Button:hover{text-decoration:none}.Button-content{align-items:center;display:grid;flex:1 0 auto;grid-template-areas:"leadingVisual text trailingVisual";grid-template-columns:min-content minmax(0,auto) min-content;place-content:center}.Button-content>:not(:last-child){margin-right:var(--primer-control-medium-gap,8px)}.Button-content--alignStart{justify-content:start}.Button-visual{display:flex;pointer-events:none}.Button-visual .Counter{background-color:var(--color-btn-counter-bg);color:inherit}.Button-label{grid-area:text;line-height:var(--primer-text-body-lineHeight-medium,1.42857);white-space:nowrap}.Button-leadingVisual{grid-area:leadingVisual}.Button-trailingVisual{grid-area:trailingVisual}.Button-trailingAction{margin-right:calc(var(--base-size-4, 4px)*-1)}.Button--small{font-size:var(--primer-text-body-size-small,12px);gap:var(--primer-control-small-gap,4px);height:var(--primer-control-small-size,28px);padding:0 var(--primer-control-small-paddingInline-condensed,8px)}.Button--small .Button-label{line-height:var(--primer-text-body-lineHeight-small,1.66667)}.Button--small .Button-content>:not(:last-child){margin-right:var(--primer-control-small-gap,4px)}.Button--large{gap:var(--primer-control-large-gap,8px);height:var(--primer-control-large-size,40px);padding:0 var(--primer-control-large-paddingInline-spacious,16px)}.Button--large .Button-label{line-height:var(--primer-text-body-lineHeight-large,1.5)}.Button--large .Button-content>:not(:last-child){margin-right:var(--primer-control-large-gap,8px)}.Button--fullWidth{width:100%}.Button--primary{fill:var(--color-btn-primary-icon);background-color:var(--color-btn-primary-bg);border-color:var(--color-btn-primary-border);box-shadow:var(--color-btn-primary-shadow),var(--color-btn-primary-inset-shadow);color:var(--color-btn-primary-text)}.Button--primary:hover:not(:disabled){background-color:var(--color-btn-primary-hover-bg);border-color:var(--color-btn-primary-hover-border)}.Button--primary:focus{box-shadow:inset 0 0 0 3px var(--color-fg-on-emphasis);outline:2px solid var(--color-accent-fg);outline-offset:-2px}.Button--primary:focus:not(:focus-visible){box-shadow:none;outline:1px solid #0000}.Button--primary:focus-visible{box-shadow:inset 0 0 0 3px var(--color-fg-on-emphasis);outline:2px solid var(--color-accent-fg);outline-offset:-2px}.Button--primary:active:not(:disabled),.Button--primary[aria-pressed=true]{background-color:var(--color-btn-primary-selected-bg);box-shadow:var(--color-btn-primary-selected-shadow)}.Button--primary:disabled,.Button--primary[aria-disabled=true]{fill:var(--color-btn-primary-disabled-text);background-color:var(--color-btn-primary-disabled-bg);border-color:var(--color-btn-primary-disabled-border);color:var(--color-btn-primary-disabled-text)}.Button--secondary{fill:var(--color-fg-muted);background-color:var(--color-btn-bg);border-color:var(--color-btn-border);box-shadow:var(--color-btn-shadow),var(--color-btn-inset-shadow);color:var(--color-btn-text)}.Button--secondary:hover:not(:disabled){background-color:var(--color-btn-hover-bg);border-color:var(--color-btn-hover-border)}.Button--secondary:active:not(:disabled){background-color:var(--color-btn-active-bg);border-color:var(--color-btn-active-border)}.Button--secondary[aria-pressed=true]{background-color:var(--color-btn-selected-bg);box-shadow:var(--color-primer-shadow-inset)}.Button--secondary:disabled,.Button--secondary[aria-disabled=true]{fill:var(--color-primer-fg-disabled);background-color:var(--color-btn-bg);border-color:var(--color-btn-border);color:var(--color-primer-fg-disabled)}.Button--invisible{color:var(--color-btn-text)}.Button--invisible:hover:not(:disabled){background-color:var(--color-action-list-item-default-hover-bg)}.Button--invisible:active:not(:disabled),.Button--invisible[aria-pressed=true]{background-color:var(--color-action-list-item-default-active-bg)}.Button--invisible:disabled,.Button--invisible[aria-disabled=true]{fill:var(--color-primer-fg-disabled);background-color:var(--color-btn-bg);border-color:var(--color-btn-border);color:var(--color-primer-fg-disabled)}.Button--invisible.Button--invisible-noVisuals .Button-label{color:var(--color-accent-fg)}.Button--invisible .Button-visual{color:var(--color-fg-muted)}.Button--link{fill:var(--color-accent-fg);border:none;color:var(--color-accent-fg);display:inline-block;font-size:inherit;height:unset;padding:0}.Button--link:hover:not(:disabled){text-decoration:underline}.Button--link:focus,.Button--link:focus-visible{outline-offset:2px}.Button--link:disabled,.Button--link[aria-disabled=true]{fill:var(--color-primer-fg-disabled);background-color:initial;border-color:#0000;color:var(--color-primer-fg-disabled)}.Button--danger{fill:var(--color-btn-danger-icon);background-color:var(--color-btn-bg);border-color:var(--color-btn-border);box-shadow:var(--color-btn-shadow),var(--color-btn-inset-shadow);color:var(--color-btn-danger-text)}.Button--danger:hover:not(:disabled){fill:var(--color-btn-danger-hover-text);background-color:var(--color-btn-danger-hover-bg);border-color:var(--color-btn-danger-hover-border);box-shadow:var(--color-btn-danger-hover-shadow),var(--color-btn-danger-hover-inset-shadow);color:var(--color-btn-danger-hover-text)}.Button--danger:active:not(:disabled),.Button--danger[aria-pressed=true]{fill:var(--color-btn-danger-selected-text);background-color:var(--color-btn-danger-selected-bg);border-color:var(--color-btn-danger-selected-border);box-shadow:var(--color-btn-danger-selected-shadow);color:var(--color-btn-danger-selected-text)}.Button--danger:disabled,.Button--danger[aria-disabled=true]{fill:var(--color-btn-danger-disabled-text);background-color:var(--color-btn-danger-disabled-bg);border-color:var(--color-btn-border);color:var(--color-btn-danger-disabled-text)}.Button--iconOnly{display:grid;padding:unset;place-content:center;width:var(--primer-control-medium-size,32px)}.Button--iconOnly.Button--small{width:var(--primer-control-small-size,28px)}.Button--iconOnly.Button--large{width:var(--primer-control-large-size,40px)}
@@ -1 +1 @@
1
- {"version":3,"sources":["button.pcss","<no source>","../../../../lib/postcss_mixins/focusOutlineOnEmphasis.pcss"],"names":[],"mappings":"AAGA,MACE,2BAA4B,CAC5B,qDACF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/* temporary, pre primitives release */\n:root {\n --primer-duration-fast: 80ms;\n --primer-easing-easeInOut: cubic-bezier(0.65, 0, 0.35, 1);\n}\n\n/* base button */\n.Button {\n position: relative;\n font-size: var(--primer-text-body-size-medium, 14px);\n font-weight: var(--base-text-weight-medium, 500);\n cursor: pointer;\n user-select: none;\n background-color: transparent;\n border: var(--primer-borderWidth-thin, 1px) solid;\n border-color: transparent;\n border-radius: var(--primer-borderRadius-medium, 6px);\n color: var(--color-btn-text);\n transition: var(--primer-duration-fast) var(--primer-easing-easeInOut);\n transition-property: color, fill, background-color, border-color;\n text-align: center;\n height: var(--primer-control-medium-size, 32px);\n padding: 0 var(--primer-control-medium-paddingInline-normal, 12px);\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: var(--primer-control-medium-gap, 8px);\n min-width: max-content;\n\n /* mobile friendly sizing */\n @media (pointer: course) {\n &::before {\n @mixin minTouchTarget 48px, 48px;\n }\n }\n\n /* base states */\n\n &:hover {\n transition-duration: var(--primer-duration-fast);\n }\n\n &:active {\n transition: none;\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n cursor: not-allowed;\n box-shadow: none;\n }\n}\n\n.Button-withTooltip {\n position: relative;\n display: inline-block;\n}\n\na.Button,\nsummary.Button {\n display: inline-flex;\n\n &:hover {\n text-decoration: none;\n }\n}\n\n/* wrap grid content to allow trailingAction to lock-right */\n.Button-content {\n flex: 1 0 auto;\n display: grid;\n grid-template-areas: 'leadingVisual text trailingVisual';\n grid-template-columns: min-content minmax(0, auto) min-content;\n align-items: center;\n place-content: center;\n\n /* padding-bottom: 1px; optical alignment for firefox */\n\n & > :not(:last-child) {\n margin-right: var(--primer-control-medium-gap, 8px);\n }\n}\n\n/* center child elements for fullWidth */\n.Button-content--alignStart {\n justify-content: start;\n}\n\n/* button child elements */\n\n/* align svg */\n.Button-visual {\n display: flex;\n pointer-events: none; /* allow click handler to work, avoiding visuals */\n\n & .Counter {\n color: inherit;\n background-color: var(--color-btn-counter-bg);\n }\n}\n\n.Button-label {\n grid-area: text;\n white-space: nowrap;\n line-height: var(--primer-text-body-lineHeight-medium, calc(20 / 14));\n}\n\n.Button-leadingVisual {\n grid-area: leadingVisual;\n}\n\n.Button-trailingVisual {\n grid-area: trailingVisual;\n}\n\n.Button-trailingAction {\n margin-right: calc(var(--base-size-4, 4px) * -1);\n}\n\n/* sizes */\n\n.Button--small {\n font-size: var(--primer-text-body-size-small, 12px);\n height: var(--primer-control-small-size, 28px);\n padding: 0 var(--primer-control-small-paddingInline-condensed, 8px);\n gap: var(--primer-control-small-gap, 4px);\n\n & .Button-label {\n line-height: var(--primer-text-body-lineHeight-small, calc(20 / 12));\n }\n\n & .Button-content {\n & > :not(:last-child) {\n margin-right: var(--primer-control-small-gap, 4px);\n }\n }\n}\n\n.Button--large {\n height: var(--primer-control-large-size, 40px);\n padding: 0 var(--primer-control-large-paddingInline-spacious, 16px);\n gap: var(--primer-control-large-gap, 8px);\n\n & .Button-label {\n line-height: var(--primer-text-body-lineHeight-large, calc(48 / 32));\n }\n\n & .Button-content {\n & > :not(:last-child) {\n margin-right: var(--primer-control-large-gap, 8px);\n }\n }\n}\n\n.Button--fullWidth {\n width: 100%;\n}\n\n/* variants */\n\n/* primary */\n.Button--primary {\n color: var(--color-btn-primary-text);\n fill: var(--color-btn-primary-icon);\n background-color: var(--color-btn-primary-bg);\n border-color: var(--color-btn-primary-border);\n box-shadow: var(--color-btn-primary-shadow), var(--color-btn-primary-inset-shadow);\n\n &:hover:not(:disabled) {\n background-color: var(--color-btn-primary-hover-bg);\n border-color: var(--color-btn-primary-hover-border);\n }\n\n /* fallback :focus state */\n &:focus {\n @mixin focusOutlineOnEmphasis;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n box-shadow: none;\n }\n }\n\n /* default focus state */\n &:focus-visible {\n @mixin focusOutlineOnEmphasis;\n }\n\n &:active:not(:disabled),\n &[aria-pressed='true'] {\n background-color: var(--color-btn-primary-selected-bg);\n box-shadow: var(--color-btn-primary-selected-shadow);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--color-btn-primary-disabled-text);\n background-color: var(--color-btn-primary-disabled-bg);\n border-color: var(--color-btn-primary-disabled-border);\n fill: var(--color-btn-primary-disabled-text);\n }\n}\n\n/* default (secondary) */\n.Button--secondary {\n color: var(--color-btn-text);\n fill: var(--color-fg-muted); /* help this */\n background-color: var(--color-btn-bg);\n border-color: var(--color-btn-border);\n box-shadow: var(--color-btn-shadow), var(--color-btn-inset-shadow);\n\n &:hover:not(:disabled) {\n background-color: var(--color-btn-hover-bg);\n border-color: var(--color-btn-hover-border);\n }\n\n &:active:not(:disabled) {\n background-color: var(--color-btn-active-bg);\n border-color: var(--color-btn-active-border);\n }\n\n &[aria-pressed='true'] {\n background-color: var(--color-btn-selected-bg);\n box-shadow: var(--color-primer-shadow-inset);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--color-primer-fg-disabled);\n background-color: var(--color-btn-bg);\n border-color: var(--color-btn-border);\n fill: var(--color-primer-fg-disabled);\n }\n}\n\n.Button--invisible {\n color: var(--color-btn-text);\n\n &:hover:not(:disabled) {\n background-color: var(--color-action-list-item-default-hover-bg);\n }\n\n &[aria-pressed='true'],\n &:active:not(:disabled) {\n background-color: var(--color-action-list-item-default-active-bg);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--color-primer-fg-disabled);\n background-color: var(--color-btn-bg);\n border-color: var(--color-btn-border);\n fill: var(--color-primer-fg-disabled);\n }\n\n /* if button has no visuals, use link blue for text */\n &.Button--invisible-noVisuals .Button-label {\n color: var(--color-accent-fg);\n }\n\n & .Button-visual {\n color: var(--color-fg-muted);\n }\n}\n\n.Button--link {\n color: var(--color-accent-fg);\n fill: var(--color-accent-fg);\n display: inline-block;\n font-size: inherit;\n border: none;\n height: unset;\n padding: 0;\n\n &:hover:not(:disabled) {\n text-decoration: underline;\n }\n\n &:focus-visible, &:focus {\n outline-offset: 2px;\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--color-primer-fg-disabled);\n background-color: transparent;\n border-color: transparent;\n fill: var(--color-primer-fg-disabled);\n }\n}\n\n/* danger */\n.Button--danger {\n color: var(--color-btn-danger-text);\n fill: var(--color-btn-danger-icon);\n background-color: var(--color-btn-bg);\n border-color: var(--color-btn-border);\n box-shadow: var(--color-btn-shadow), var(--color-btn-inset-shadow);\n\n &:hover:not(:disabled) {\n color: var(--color-btn-danger-hover-text);\n fill: var(--color-btn-danger-hover-text);\n background-color: var(--color-btn-danger-hover-bg);\n border-color: var(--color-btn-danger-hover-border);\n box-shadow: var(--color-btn-danger-hover-shadow), var(--color-btn-danger-hover-inset-shadow);\n }\n\n &:active:not(:disabled),\n &[aria-pressed='true'] {\n color: var(--color-btn-danger-selected-text);\n fill: var(--color-btn-danger-selected-text);\n background-color: var(--color-btn-danger-selected-bg);\n border-color: var(--color-btn-danger-selected-border);\n box-shadow: var(--color-btn-danger-selected-shadow);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--color-btn-danger-disabled-text);\n fill: var(--color-btn-danger-disabled-text);\n background-color: var(--color-btn-danger-disabled-bg);\n border-color: var(--color-btn-border);\n }\n}\n\n\n.Button--iconOnly {\n display: grid;\n place-content: center;\n padding: unset;\n width: var(--primer-control-medium-size, 32px);\n\n &.Button--small {\n width: var(--primer-control-small-size, 28px);\n }\n\n &.Button--large {\n width: var(--primer-control-large-size, 40px);\n }\n}\n",null,"/* outline with fg box-shadow for buttons */\n@define-mixin focusOutlineOnEmphasis $outlineOffset: -2px, $outlineColor: var(--color-accent-fg) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: inset 0 0 0 3px var(--color-fg-on-emphasis);\n}\n"]}
1
+ {"version":3,"sources":["button.pcss","<no source>","../../../../lib/postcss_mixins/focusOutlineOnEmphasis.pcss"],"names":[],"mappings":"AAGA,MACE,2BAA4B,CAC5B,qDACF,CAGA,QAm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itives release */\n:root {\n --primer-duration-fast: 80ms;\n --primer-easing-easeInOut: cubic-bezier(0.65, 0, 0.35, 1);\n}\n\n/* base button */\n.Button {\n position: relative;\n font-size: var(--primer-text-body-size-medium, 14px);\n font-weight: var(--base-text-weight-medium, 500);\n cursor: pointer;\n user-select: none;\n background-color: transparent;\n border: var(--primer-borderWidth-thin, 1px) solid;\n border-color: transparent;\n border-radius: var(--primer-borderRadius-medium, 6px);\n color: var(--color-btn-text);\n transition: var(--primer-duration-fast) var(--primer-easing-easeInOut);\n transition-property: color, fill, background-color, border-color;\n text-align: center;\n height: var(--primer-control-medium-size, 32px);\n padding: 0 var(--primer-control-medium-paddingInline-normal, 12px);\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: var(--primer-control-medium-gap, 8px);\n min-width: max-content;\n\n /* mobile friendly sizing */\n @media (pointer: coarse) {\n &::before {\n @mixin minTouchTarget 48px, 48px;\n }\n }\n\n /* base states */\n\n &:hover {\n transition-duration: var(--primer-duration-fast);\n }\n\n &:active {\n transition: none;\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n cursor: not-allowed;\n box-shadow: none;\n }\n}\n\n.Button-withTooltip {\n position: relative;\n display: inline-block;\n}\n\na.Button,\nsummary.Button {\n display: inline-flex;\n\n &:hover {\n text-decoration: none;\n }\n}\n\n/* wrap grid content to allow trailingAction to lock-right */\n.Button-content {\n flex: 1 0 auto;\n display: grid;\n grid-template-areas: 'leadingVisual text trailingVisual';\n grid-template-columns: min-content minmax(0, auto) min-content;\n align-items: center;\n place-content: center;\n\n /* padding-bottom: 1px; optical alignment for firefox */\n\n & > :not(:last-child) {\n margin-right: var(--primer-control-medium-gap, 8px);\n }\n}\n\n/* center child elements for fullWidth */\n.Button-content--alignStart {\n justify-content: start;\n}\n\n/* button child elements */\n\n/* align svg */\n.Button-visual {\n display: flex;\n pointer-events: none; /* allow click handler to work, avoiding visuals */\n\n & .Counter {\n color: inherit;\n background-color: var(--color-btn-counter-bg);\n }\n}\n\n.Button-label {\n grid-area: text;\n white-space: nowrap;\n line-height: var(--primer-text-body-lineHeight-medium, calc(20 / 14));\n}\n\n.Button-leadingVisual {\n grid-area: leadingVisual;\n}\n\n.Button-trailingVisual {\n grid-area: trailingVisual;\n}\n\n.Button-trailingAction {\n margin-right: calc(var(--base-size-4, 4px) * -1);\n}\n\n/* sizes */\n\n.Button--small {\n font-size: var(--primer-text-body-size-small, 12px);\n height: var(--primer-control-small-size, 28px);\n padding: 0 var(--primer-control-small-paddingInline-condensed, 8px);\n gap: var(--primer-control-small-gap, 4px);\n\n & .Button-label {\n line-height: var(--primer-text-body-lineHeight-small, calc(20 / 12));\n }\n\n & .Button-content {\n & > :not(:last-child) {\n margin-right: var(--primer-control-small-gap, 4px);\n }\n }\n}\n\n.Button--large {\n height: var(--primer-control-large-size, 40px);\n padding: 0 var(--primer-control-large-paddingInline-spacious, 16px);\n gap: var(--primer-control-large-gap, 8px);\n\n & .Button-label {\n line-height: var(--primer-text-body-lineHeight-large, calc(48 / 32));\n }\n\n & .Button-content {\n & > :not(:last-child) {\n margin-right: var(--primer-control-large-gap, 8px);\n }\n }\n}\n\n.Button--fullWidth {\n width: 100%;\n}\n\n/* variants */\n\n/* primary */\n.Button--primary {\n color: var(--color-btn-primary-text);\n fill: var(--color-btn-primary-icon);\n background-color: var(--color-btn-primary-bg);\n border-color: var(--color-btn-primary-border);\n box-shadow: var(--color-btn-primary-shadow), var(--color-btn-primary-inset-shadow);\n\n &:hover:not(:disabled) {\n background-color: var(--color-btn-primary-hover-bg);\n border-color: var(--color-btn-primary-hover-border);\n }\n\n /* fallback :focus state */\n &:focus {\n @mixin focusOutlineOnEmphasis;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n box-shadow: none;\n }\n }\n\n /* default focus state */\n &:focus-visible {\n @mixin focusOutlineOnEmphasis;\n }\n\n &:active:not(:disabled),\n &[aria-pressed='true'] {\n background-color: var(--color-btn-primary-selected-bg);\n box-shadow: var(--color-btn-primary-selected-shadow);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--color-btn-primary-disabled-text);\n background-color: var(--color-btn-primary-disabled-bg);\n border-color: var(--color-btn-primary-disabled-border);\n fill: var(--color-btn-primary-disabled-text);\n }\n}\n\n/* default (secondary) */\n.Button--secondary {\n color: var(--color-btn-text);\n fill: var(--color-fg-muted); /* help this */\n background-color: var(--color-btn-bg);\n border-color: var(--color-btn-border);\n box-shadow: var(--color-btn-shadow), var(--color-btn-inset-shadow);\n\n &:hover:not(:disabled) {\n background-color: var(--color-btn-hover-bg);\n border-color: var(--color-btn-hover-border);\n }\n\n &:active:not(:disabled) {\n background-color: var(--color-btn-active-bg);\n border-color: var(--color-btn-active-border);\n }\n\n &[aria-pressed='true'] {\n background-color: var(--color-btn-selected-bg);\n box-shadow: var(--color-primer-shadow-inset);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--color-primer-fg-disabled);\n background-color: var(--color-btn-bg);\n border-color: var(--color-btn-border);\n fill: var(--color-primer-fg-disabled);\n }\n}\n\n.Button--invisible {\n color: var(--color-btn-text);\n\n &:hover:not(:disabled) {\n background-color: var(--color-action-list-item-default-hover-bg);\n }\n\n &[aria-pressed='true'],\n &:active:not(:disabled) {\n background-color: var(--color-action-list-item-default-active-bg);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--color-primer-fg-disabled);\n background-color: var(--color-btn-bg);\n border-color: var(--color-btn-border);\n fill: var(--color-primer-fg-disabled);\n }\n\n /* if button has no visuals, use link blue for text */\n &.Button--invisible-noVisuals .Button-label {\n color: var(--color-accent-fg);\n }\n\n & .Button-visual {\n color: var(--color-fg-muted);\n }\n}\n\n.Button--link {\n color: var(--color-accent-fg);\n fill: var(--color-accent-fg);\n display: inline-block;\n font-size: inherit;\n border: none;\n height: unset;\n padding: 0;\n\n &:hover:not(:disabled) {\n text-decoration: underline;\n }\n\n &:focus-visible, &:focus {\n outline-offset: 2px;\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--color-primer-fg-disabled);\n background-color: transparent;\n border-color: transparent;\n fill: var(--color-primer-fg-disabled);\n }\n}\n\n/* danger */\n.Button--danger {\n color: var(--color-btn-danger-text);\n fill: var(--color-btn-danger-icon);\n background-color: var(--color-btn-bg);\n border-color: var(--color-btn-border);\n box-shadow: var(--color-btn-shadow), var(--color-btn-inset-shadow);\n\n &:hover:not(:disabled) {\n color: var(--color-btn-danger-hover-text);\n fill: var(--color-btn-danger-hover-text);\n background-color: var(--color-btn-danger-hover-bg);\n border-color: var(--color-btn-danger-hover-border);\n box-shadow: var(--color-btn-danger-hover-shadow), var(--color-btn-danger-hover-inset-shadow);\n }\n\n &:active:not(:disabled),\n &[aria-pressed='true'] {\n color: var(--color-btn-danger-selected-text);\n fill: var(--color-btn-danger-selected-text);\n background-color: var(--color-btn-danger-selected-bg);\n border-color: var(--color-btn-danger-selected-border);\n box-shadow: var(--color-btn-danger-selected-shadow);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--color-btn-danger-disabled-text);\n fill: var(--color-btn-danger-disabled-text);\n background-color: var(--color-btn-danger-disabled-bg);\n border-color: var(--color-btn-border);\n }\n}\n\n\n.Button--iconOnly {\n display: grid;\n place-content: center;\n padding: unset;\n width: var(--primer-control-medium-size, 32px);\n\n &.Button--small {\n width: var(--primer-control-small-size, 28px);\n }\n\n &.Button--large {\n width: var(--primer-control-large-size, 40px);\n }\n}\n",null,"/* outline with fg box-shadow for buttons */\n@define-mixin focusOutlineOnEmphasis $outlineOffset: -2px, $outlineColor: var(--color-accent-fg) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: inset 0 0 0 3px var(--color-fg-on-emphasis);\n}\n"]}
@@ -31,7 +31,7 @@
31
31
  min-width: max-content;
32
32
 
33
33
  /* mobile friendly sizing */
34
- @media (pointer: course) {
34
+ @media (pointer: coarse) {
35
35
  &::before {
36
36
  @mixin minTouchTarget 48px, 48px;
37
37
  }
@@ -12,6 +12,9 @@ module Primer
12
12
  FORMAT_DEFAULT = :auto
13
13
  FORMAT_OPTIONS = [FORMAT_DEFAULT, :micro, :elapsed].freeze
14
14
 
15
+ FORMAT_STYLE_DEFAULT = nil
16
+ FORMAT_STYLE_OPTIONS = [FORMAT_STYLE_DEFAULT, :long, :short, :narrow].freeze
17
+
15
18
  SECOND_DEFAULT = nil
16
19
  SECOND_MAPPINGS = {
17
20
  SECOND_DEFAULT => nil,
@@ -104,6 +107,7 @@ module Primer
104
107
  # @param threshold [string] The threshold, in ISO-8601 'durations' format, at which relative time displays become absolute.
105
108
  # @param precision [Symbol] The precision elapsed time should display. <%= one_of(Primer::Beta::RelativeTime::PRECISION_OPTIONS) %>
106
109
  # @param format [Symbol] The format the display should take. <%= one_of(Primer::Beta::RelativeTime::FORMAT_OPTIONS) %>
110
+ # @param format_style [Symbol] The format the display should take. <%= one_of(Primer::Beta::RelativeTime::FORMAT_STYLE_OPTIONS) %>
107
111
  # @param lang [string] The language to use.
108
112
  # @param title [string] Provide a custom title to the element.
109
113
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
@@ -122,6 +126,7 @@ module Primer
122
126
  threshold: nil,
123
127
  precision: PRECISION_DEFAULT,
124
128
  format: nil,
129
+ format_style: nil,
125
130
  lang: nil,
126
131
  title: nil,
127
132
  **system_arguments
@@ -143,6 +148,7 @@ module Primer
143
148
  @system_arguments[:title] = title if title.present?
144
149
  @system_arguments[:lang] = lang if lang.present?
145
150
  @system_arguments[:format] = fetch_or_fallback(FORMAT_OPTIONS, format, FORMAT_DEFAULT) if format.present?
151
+ @system_arguments[:"format-style"] = format_style if format_style.present?
146
152
  if datetime.present? && datetime.respond_to?(:iso8601)
147
153
  @datetime = datetime
148
154
  @system_arguments[:datetime] = datetime.iso8601
@@ -6,7 +6,7 @@ module Primer
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- PATCH = 117
9
+ PATCH = 118
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
data/lib/tasks/docs.rake CHANGED
@@ -515,7 +515,7 @@ namespace :docs do
515
515
  def lookbook_url(component)
516
516
  path = component.name.underscore.gsub("_component", "")
517
517
 
518
- "https://primer.style/view-components/lookbook/inspect/#{path}_preview/default/"
518
+ "https://primer.style/view-components/lookbook/inspect/#{path}/default/"
519
519
  end
520
520
 
521
521
  def preview_exists?(component)
@@ -0,0 +1,10 @@
1
+ <%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: title, subtitle: subtitle, visually_hide_title: false)) do |d| %>
2
+ <% d.show_button { button_text } %>
3
+ <% d.body do %>
4
+ <p>Dialog One!</p>
5
+
6
+ <form>
7
+ <input type="text" value="Some text goes in here">
8
+ </form>
9
+ <% end %>
10
+ <% end %>
@@ -112,6 +112,21 @@ module Primer
112
112
  show_divider: show_divider
113
113
  })
114
114
  end
115
+
116
+ # @label Dialog with text input
117
+ #
118
+ # @param title [String] text
119
+ # @param subtitle [String] text
120
+ # @param button_text [String] text
121
+ # @param show_divider [Boolean] toggle
122
+ def with_text_input(title: "Test Dialog", subtitle: nil, button_text: "Show Dialog", show_divider: true)
123
+ render_with_template(locals: {
124
+ title: title,
125
+ subtitle: subtitle,
126
+ button_text: button_text,
127
+ show_divider: show_divider
128
+ })
129
+ end
115
130
  end
116
131
  end
117
132
  end
@@ -21,6 +21,7 @@ module Primer
21
21
  # @param time_zone_name [Symbol] select [~, long, short, short_offset, long_offset, short_generic, long_generic]
22
22
  # @param precision [Symbol] select [~, second, minute, hour, day, month, year]
23
23
  # @param format [Symbol] select [~, auto, micro, elapsed]
24
+ # @param format_style [Symbol] select [~, long, short, narrow]
24
25
  # @param lang [String] text
25
26
  # @param title [String] text
26
27
  def playground(
@@ -37,6 +38,7 @@ module Primer
37
38
  threshold: nil,
38
39
  precision: nil,
39
40
  format: nil,
41
+ format_style: nil,
40
42
  datetime: Time.utc(2020, 1, 1, 0, 0, 0),
41
43
  lang: nil,
42
44
  title: nil
@@ -55,6 +57,7 @@ module Primer
55
57
  threshold: threshold,
56
58
  precision: precision,
57
59
  format: format,
60
+ format_style: format_style,
58
61
  datetime: datetime,
59
62
  lang: lang,
60
63
  title: title
@@ -75,6 +78,7 @@ module Primer
75
78
  # @param time_zone_name [Symbol] select [~, long, short, short_offset, long_offset, short_generic, long_generic]
76
79
  # @param precision [Symbol] select [~, second, minute, hour, day, month, year]
77
80
  # @param format [Symbol] select [~, auto, micro, elapsed]
81
+ # @param format_style [Symbol] select [~, long, short, narrow]
78
82
  # @param lang [String] text
79
83
  # @param title [String] text
80
84
  def default(
@@ -91,6 +95,7 @@ module Primer
91
95
  threshold: nil,
92
96
  precision: nil,
93
97
  format: nil,
98
+ format_style: nil,
94
99
  datetime: Time.now.utc,
95
100
  lang: nil,
96
101
  title: nil
@@ -109,6 +114,7 @@ module Primer
109
114
  threshold: threshold,
110
115
  precision: precision,
111
116
  format: format,
117
+ format_style: format_style,
112
118
  datetime: datetime,
113
119
  lang: lang,
114
120
  title: title
@@ -128,6 +134,7 @@ module Primer
128
134
  # @param year [Symbol] select [~, numeric, two_digit]
129
135
  # @param time_zone_name [Symbol] select [~, long, short, short_offset, long_offset, short_generic, long_generic]
130
136
  # @param precision [Symbol] select [~, second, minute, hour, day, month, year]
137
+ # @param format_style [Symbol] select [~, long, short, narrow]
131
138
  # @param lang [String] text
132
139
  # @param title [String] text
133
140
  def micro_format(
@@ -143,6 +150,7 @@ module Primer
143
150
  time_zone_name: nil,
144
151
  threshold: nil,
145
152
  precision: nil,
153
+ format_style: nil,
146
154
  datetime: Time.now.iso8601,
147
155
  lang: nil,
148
156
  title: nil
@@ -161,6 +169,7 @@ module Primer
161
169
  threshold: threshold,
162
170
  precision: precision,
163
171
  format: :micro,
172
+ format_style: format_style,
164
173
  datetime: datetime,
165
174
  lang: lang,
166
175
  title: title
@@ -181,6 +190,7 @@ module Primer
181
190
  # @param time_zone_name [Symbol] select [~, long, short, short_offset, long_offset, short_generic, long_generic]
182
191
  # @param precision [Symbol] select [~, second, minute, hour, day, month, year]
183
192
  # @param format [Symbol] select [~, auto, micro, elapsed]
193
+ # @param format_style [Symbol] select [~, long, short, narrow]
184
194
  # @param lang [String] text
185
195
  # @param title [String] text
186
196
  def recent_time(
@@ -197,6 +207,7 @@ module Primer
197
207
  threshold: nil,
198
208
  precision: nil,
199
209
  format: nil,
210
+ format_style: nil,
200
211
  datetime: Time.now.iso8601,
201
212
  lang: nil,
202
213
  title: nil
@@ -215,6 +226,7 @@ module Primer
215
226
  threshold: threshold,
216
227
  precision: precision,
217
228
  format: format,
229
+ format_style: format_style,
218
230
  datetime: datetime,
219
231
  lang: lang,
220
232
  title: title
@@ -232,6 +244,7 @@ module Primer
232
244
  # @param year [Symbol] select [~, numeric, two_digit]
233
245
  # @param time_zone_name [Symbol] select [~, long, short, short_offset, long_offset, short_generic, long_generic]
234
246
  # @param precision [Symbol] select [~, second, minute, hour, day, month, year]
247
+ # @param format_style [Symbol] select [~, long, short, narrow]
235
248
  # @param lang [String] text
236
249
  # @param title [String] text
237
250
  def count_down_timer(
@@ -245,6 +258,7 @@ module Primer
245
258
  time_zone_name: nil,
246
259
  threshold: nil,
247
260
  precision: nil,
261
+ format_style: nil,
248
262
  datetime: Time.utc(2038, 1, 19, 0o3, 14, 8),
249
263
  lang: nil,
250
264
  title: nil
@@ -261,6 +275,7 @@ module Primer
261
275
  threshold: threshold,
262
276
  precision: precision,
263
277
  format: :elapsed,
278
+ format_style: format_style,
264
279
  datetime: datetime,
265
280
  lang: lang,
266
281
  title: title