@primer/view-components 0.21.1-rc.1e465e9a → 0.21.1-rc.1fc94b05

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.
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _DialogHelperElement_abortController;
12
+ var _DialogHelperElement_instances, _DialogHelperElement_abortController, _DialogHelperElement_handleDialogOpenAttribute;
13
13
  function dialogInvokerButtonHandler(event) {
14
14
  const target = event.target;
15
15
  const button = target?.closest('button');
@@ -73,6 +73,7 @@ function dialogInvokerButtonHandler(event) {
73
73
  export class DialogHelperElement extends HTMLElement {
74
74
  constructor() {
75
75
  super(...arguments);
76
+ _DialogHelperElement_instances.add(this);
76
77
  _DialogHelperElement_abortController.set(this, null);
77
78
  }
78
79
  get dialog() {
@@ -86,10 +87,11 @@ export class DialogHelperElement extends HTMLElement {
86
87
  new MutationObserver(records => {
87
88
  for (const record of records) {
88
89
  if (record.target === this.dialog) {
89
- this.ownerDocument.body.classList.toggle('has-modal', this.dialog.hasAttribute('open'));
90
+ __classPrivateFieldGet(this, _DialogHelperElement_instances, "m", _DialogHelperElement_handleDialogOpenAttribute).call(this);
90
91
  }
91
92
  }
92
93
  }).observe(this, { subtree: true, attributeFilter: ['open'] });
94
+ __classPrivateFieldGet(this, _DialogHelperElement_instances, "m", _DialogHelperElement_handleDialogOpenAttribute).call(this);
93
95
  }
94
96
  disconnectedCallback() {
95
97
  __classPrivateFieldGet(this, _DialogHelperElement_abortController, "f")?.abort();
@@ -110,7 +112,18 @@ export class DialogHelperElement extends HTMLElement {
110
112
  }
111
113
  }
112
114
  }
113
- _DialogHelperElement_abortController = new WeakMap();
115
+ _DialogHelperElement_abortController = new WeakMap(), _DialogHelperElement_instances = new WeakSet(), _DialogHelperElement_handleDialogOpenAttribute = function _DialogHelperElement_handleDialogOpenAttribute() {
116
+ if (!this.dialog)
117
+ return;
118
+ this.ownerDocument.body.classList.toggle('has-modal', this.dialog.matches(':modal'));
119
+ // We don't want to show the Dialog component as non-modal
120
+ if (this.dialog.matches('[open]:not(:modal)')) {
121
+ // eslint-disable-next-line no-restricted-syntax
122
+ this.dialog.addEventListener('close', e => e.stopImmediatePropagation(), { once: true });
123
+ this.dialog.close();
124
+ this.dialog.showModal();
125
+ }
126
+ };
114
127
  if (!window.customElements.get('dialog-helper')) {
115
128
  window.DialogHelperElement = DialogHelperElement;
116
129
  window.customElements.define('dialog-helper', DialogHelperElement);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/view-components",
3
- "version": "0.21.1-rc.1e465e9a",
3
+ "version": "0.21.1-rc.1fc94b05",
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",
@@ -3760,7 +3760,7 @@
3760
3760
  "name": "scheme",
3761
3761
  "type": "Symbol",
3762
3762
  "default": "`:default`",
3763
- "description": "One of `:danger`, `:default`, or `:invisible`."
3763
+ "description": "One of `:danger`, `:default`, `:invisible`, `:primary`, or `:secondary`."
3764
3764
  },
3765
3765
  {
3766
3766
  "name": "size",
@@ -938,11 +938,15 @@
938
938
  "DEFAULT_SCHEME": "default",
939
939
  "SCHEME_MAPPINGS": {
940
940
  "default": "Button--secondary",
941
+ "primary": "Button--primary",
942
+ "secondary": "Button--secondary",
941
943
  "danger": "Button--danger",
942
944
  "invisible": "Button--invisible"
943
945
  },
944
946
  "SCHEME_OPTIONS": [
945
947
  "default",
948
+ "primary",
949
+ "secondary",
946
950
  "danger",
947
951
  "invisible"
948
952
  ]
@@ -3440,6 +3440,19 @@
3440
3440
  "color-contrast"
3441
3441
  ]
3442
3442
  }
3443
+ },
3444
+ {
3445
+ "preview_path": "primer/alpha/dialog/initally_open",
3446
+ "name": "initally_open",
3447
+ "snapshot": "interactive",
3448
+ "skip_rules": {
3449
+ "wont_fix": [
3450
+ "region"
3451
+ ],
3452
+ "will_fix": [
3453
+ "color-contrast"
3454
+ ]
3455
+ }
3443
3456
  }
3444
3457
  ],
3445
3458
  "subcomponents": [
@@ -12433,7 +12446,7 @@
12433
12446
  "name": "scheme",
12434
12447
  "type": "Symbol",
12435
12448
  "default": "`:default`",
12436
- "description": "One of `:danger`, `:default`, or `:invisible`."
12449
+ "description": "One of `:danger`, `:default`, `:invisible`, `:primary`, or `:secondary`."
12437
12450
  },
12438
12451
  {
12439
12452
  "name": "size",
@@ -12530,6 +12543,19 @@
12530
12543
  ]
12531
12544
  }
12532
12545
  },
12546
+ {
12547
+ "preview_path": "primer/beta/icon_button/primary",
12548
+ "name": "primary",
12549
+ "snapshot": "true",
12550
+ "skip_rules": {
12551
+ "wont_fix": [
12552
+ "region"
12553
+ ],
12554
+ "will_fix": [
12555
+ "color-contrast"
12556
+ ]
12557
+ }
12558
+ },
12533
12559
  {
12534
12560
  "preview_path": "primer/beta/icon_button/danger",
12535
12561
  "name": "danger",
@@ -3217,6 +3217,19 @@
3217
3217
  "color-contrast"
3218
3218
  ]
3219
3219
  }
3220
+ },
3221
+ {
3222
+ "preview_path": "primer/alpha/dialog/initally_open",
3223
+ "name": "initally_open",
3224
+ "snapshot": "interactive",
3225
+ "skip_rules": {
3226
+ "wont_fix": [
3227
+ "region"
3228
+ ],
3229
+ "will_fix": [
3230
+ "color-contrast"
3231
+ ]
3232
+ }
3220
3233
  }
3221
3234
  ]
3222
3235
  },
@@ -3781,6 +3794,19 @@
3781
3794
  ]
3782
3795
  }
3783
3796
  },
3797
+ {
3798
+ "preview_path": "primer/beta/icon_button/primary",
3799
+ "name": "primary",
3800
+ "snapshot": "true",
3801
+ "skip_rules": {
3802
+ "wont_fix": [
3803
+ "region"
3804
+ ],
3805
+ "will_fix": [
3806
+ "color-contrast"
3807
+ ]
3808
+ }
3809
+ },
3784
3810
  {
3785
3811
  "preview_path": "primer/beta/icon_button/danger",
3786
3812
  "name": "danger",