@primer/view-components 0.14.0-rc.f4586ab9 → 0.14.0

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 (28) hide show
  1. package/app/assets/javascripts/primer_view_components.js +1 -1
  2. package/app/assets/javascripts/primer_view_components.js.map +1 -1
  3. package/app/assets/styles/primer_view_components.css +1 -1
  4. package/app/assets/styles/primer_view_components.css.map +1 -1
  5. package/app/components/primer/alpha/action_bar.css +1 -1
  6. package/app/components/primer/alpha/action_bar.css.json +1 -4
  7. package/app/components/primer/alpha/action_bar_element.js +21 -9
  8. package/app/components/primer/alpha/action_menu/action_menu_element.js +44 -20
  9. package/app/components/primer/alpha/segmented_control.css +1 -1
  10. package/app/components/primer/alpha/segmented_control.css.json +0 -1
  11. package/app/components/primer/alpha/segmented_control.js +2 -1
  12. package/app/components/primer/alpha/text_field.css +1 -1
  13. package/app/components/primer/alpha/text_field.css.json +11 -5
  14. package/app/components/primer/alpha/x_banner.js +2 -1
  15. package/app/components/primer/anchored_position.js +2 -1
  16. package/app/components/primer/beta/button.css +1 -1
  17. package/app/components/primer/beta/button.css.json +0 -1
  18. package/app/components/primer/beta/button_group.css +1 -1
  19. package/app/components/primer/beta/button_group.css.json +2 -4
  20. package/app/components/primer/beta/nav_list.js +14 -7
  21. package/app/components/primer/focus_group.js +2 -1
  22. package/lib/primer/forms/primer_text_field.js +40 -5
  23. package/package.json +12 -13
  24. package/static/arguments.json +1 -7
  25. package/static/classes.json +3 -3
  26. package/static/constants.json +1 -0
  27. package/static/info_arch.json +53 -8
  28. package/static/previews.json +60 -0
@@ -15,7 +15,7 @@ const validSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role
15
15
  const menuItemSelector = validSelectors.map(selector => `:not([hidden]) > ${selector}`).join(', ');
16
16
  const getMnemonicFor = (item) => { var _a; return (_a = item.textContent) === null || _a === void 0 ? void 0 : _a.trim()[0].toLowerCase(); };
17
17
  const printable = /^\S$/;
18
- export default class FocusGroupElement extends HTMLElement {
18
+ class FocusGroupElement extends HTMLElement {
19
19
  constructor() {
20
20
  super(...arguments);
21
21
  _FocusGroupElement_instances.add(this);
@@ -159,6 +159,7 @@ export default class FocusGroupElement extends HTMLElement {
159
159
  _FocusGroupElement_retainSignal = new WeakMap(), _FocusGroupElement_abortController = new WeakMap(), _FocusGroupElement_instances = new WeakSet(), _FocusGroupElement_items_get = function _FocusGroupElement_items_get() {
160
160
  return this.querySelectorAll(menuItemSelector);
161
161
  };
162
+ export default FocusGroupElement;
162
163
  if (!customElements.get('focus-group')) {
163
164
  window.FocusGroupElement = FocusGroupElement;
164
165
  customElements.define('focus-group', FocusGroupElement);
@@ -30,8 +30,14 @@ class PrimerTextFieldElement extends HTMLElement {
30
30
  var _a;
31
31
  (_a = __classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
32
32
  const { signal } = (__classPrivateFieldSet(this, _PrimerTextFieldElement_abortController, new AbortController(), "f"));
33
- this.inputElement.addEventListener('auto-check-success', () => {
34
- this.clearError();
33
+ this.inputElement.addEventListener('auto-check-success', async (event) => {
34
+ const message = await event.detail.response.text();
35
+ if (message && message.length > 0) {
36
+ this.setSuccess(message);
37
+ }
38
+ else {
39
+ this.clearError();
40
+ }
35
41
  }, { signal });
36
42
  this.inputElement.addEventListener('auto-check-error', async (event) => {
37
43
  const errorMessage = await event.detail.response.text();
@@ -49,12 +55,35 @@ class PrimerTextFieldElement extends HTMLElement {
49
55
  clearError() {
50
56
  this.inputElement.removeAttribute('invalid');
51
57
  this.validationElement.hidden = true;
52
- this.validationMessageElement.textContent = '';
58
+ this.validationMessageElement.replaceChildren();
59
+ }
60
+ setValidationMessage(message) {
61
+ const template = document.createElement('template');
62
+ // eslint-disable-next-line github/no-inner-html
63
+ template.innerHTML = message;
64
+ const fragment = document.importNode(template.content, true);
65
+ this.validationMessageElement.replaceChildren(fragment);
66
+ }
67
+ toggleValidationStyling(isError) {
68
+ if (isError) {
69
+ this.validationElement.classList.remove('FormControl-inlineValidation--success');
70
+ }
71
+ else {
72
+ this.validationElement.classList.add('FormControl-inlineValidation--success');
73
+ }
74
+ this.validationSuccessIcon.hidden = isError;
75
+ this.validationErrorIcon.hidden = !isError;
76
+ this.inputElement.setAttribute('invalid', isError ? 'true' : 'false');
77
+ }
78
+ setSuccess(message) {
79
+ this.toggleValidationStyling(false);
80
+ this.setValidationMessage(message);
81
+ this.validationElement.hidden = false;
53
82
  }
54
83
  setError(message) {
55
- this.validationMessageElement.textContent = message;
84
+ this.toggleValidationStyling(true);
85
+ this.setValidationMessage(message);
56
86
  this.validationElement.hidden = false;
57
- this.inputElement.setAttribute('invalid', 'true');
58
87
  }
59
88
  };
60
89
  _PrimerTextFieldElement_abortController = new WeakMap();
@@ -67,6 +96,12 @@ __decorate([
67
96
  __decorate([
68
97
  target
69
98
  ], PrimerTextFieldElement.prototype, "validationMessageElement", void 0);
99
+ __decorate([
100
+ target
101
+ ], PrimerTextFieldElement.prototype, "validationSuccessIcon", void 0);
102
+ __decorate([
103
+ target
104
+ ], PrimerTextFieldElement.prototype, "validationErrorIcon", void 0);
70
105
  PrimerTextFieldElement = __decorate([
71
106
  controller
72
107
  // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/view-components",
3
- "version": "0.14.0-rc.f4586ab9",
3
+ "version": "0.14.0",
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",
@@ -51,13 +51,13 @@
51
51
  "@github/include-fragment-element": "^6.1.1",
52
52
  "@github/relative-time-element": "^4.0.0",
53
53
  "@github/tab-container-element": "^3.1.2",
54
- "@oddbird/popover-polyfill": "^0.3.0",
54
+ "@oddbird/popover-polyfill": "^0.3.2",
55
55
  "@primer/behaviors": "^1.3.4"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@changesets/changelog-github": "^0.4.6",
59
59
  "@changesets/cli": "^2.24.1",
60
- "@github/axe-github": "^0.5.0",
60
+ "@github/axe-github": "^0.6.1",
61
61
  "@github/browserslist-config": "^1.0.0",
62
62
  "@github/markdownlint-github": "^0.2.2",
63
63
  "@github/prettier-config": "0.0.6",
@@ -65,10 +65,10 @@
65
65
  "@primer/css": "21.0.9",
66
66
  "@primer/primitives": "^7.14.0",
67
67
  "@primer/stylelint-config": "^12.7.2",
68
- "@rollup/plugin-node-resolve": "^13.3.0",
68
+ "@rollup/plugin-node-resolve": "^15.2.3",
69
69
  "@rollup/plugin-typescript": "^8.3.3",
70
- "@typescript-eslint/eslint-plugin": "^5.31.0",
71
- "@typescript-eslint/parser": "^5.31.0",
70
+ "@typescript-eslint/eslint-plugin": "^6.11.0",
71
+ "@typescript-eslint/parser": "^6.0.0",
72
72
  "axe-core": "^4.7.1",
73
73
  "chokidar-cli": "^3.0.0",
74
74
  "cssnano": "^6.0.1",
@@ -82,17 +82,16 @@
82
82
  "postcss": "^8.4.16",
83
83
  "postcss-cli": "^10.1.0",
84
84
  "postcss-custom-properties-fallback": "^1.0.2",
85
- "postcss-import": "^14.1.0",
85
+ "postcss-import": "^15.1.0",
86
86
  "postcss-mixins": "^9.0.3",
87
87
  "postcss-preset-env": "^9.3.0",
88
- "prettier": "2.7.1",
89
- "rollup": "^2.77.1",
88
+ "prettier": "3.1.0",
89
+ "rollup": "^2.79.1",
90
90
  "rollup-plugin-terser": "^7.0.2",
91
- "stylelint": "^14.13.0",
92
- "stylelint-config-prettier": "^9.0.3",
93
- "stylelint-config-standard": "^28.0.0",
91
+ "stylelint": "^15.11.0",
92
+ "stylelint-config-standard": "^34.0.0",
94
93
  "tslib": "^2.4.0",
95
- "typescript": "^4.7.4"
94
+ "typescript": "^5.2.2"
96
95
  },
97
96
  "prettier": "@github/prettier-config",
98
97
  "browserslist": "extends @github/browserslist-config"
@@ -3034,7 +3034,7 @@
3034
3034
  "name": "size",
3035
3035
  "type": "Integer",
3036
3036
  "default": "`20`",
3037
- "description": "One of `16`, `20`, `24`, `32`, `40`, `48`, or `80`."
3037
+ "description": "One of `16`, `20`, `24`, `32`, `40`, `48`, `64`, or `80`."
3038
3038
  },
3039
3039
  {
3040
3040
  "name": "shape",
@@ -3631,12 +3631,6 @@
3631
3631
  "default": "N/A",
3632
3632
  "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
3633
3633
  },
3634
- {
3635
- "name": "wrapper_arguments",
3636
- "type": "Hash",
3637
- "default": "`{}`",
3638
- "description": "Optional keyword arguments to be passed to the wrapper `<div>` tag."
3639
- },
3640
3634
  {
3641
3635
  "name": "scheme",
3642
3636
  "type": "Symbol",
@@ -218,9 +218,6 @@
218
218
  "Button-visual": [
219
219
  "Primer::Beta::Button"
220
220
  ],
221
- "Button-withTooltip": [
222
- "Primer::Beta::Button"
223
- ],
224
221
  "ButtonGroup": [
225
222
  "Primer::Beta::ButtonGroup"
226
223
  ],
@@ -254,6 +251,9 @@
254
251
  "FormControl-inlineValidation": [
255
252
  "Primer::Alpha::TextField"
256
253
  ],
254
+ "FormControl-inlineValidation--success": [
255
+ "Primer::Alpha::TextField"
256
+ ],
257
257
  "FormControl-inlineValidation--visual": [
258
258
  "Primer::Alpha::TextField"
259
259
  ],
@@ -709,6 +709,7 @@
709
709
  32,
710
710
  40,
711
711
  48,
712
+ 64,
712
713
  80
713
714
  ],
714
715
  "SMALL_THRESHOLD": 24
@@ -5438,7 +5438,32 @@
5438
5438
 
5439
5439
  ],
5440
5440
  "previews": [
5441
-
5441
+ {
5442
+ "preview_path": "primer/alpha/octicon_symbols/playground",
5443
+ "name": "playground",
5444
+ "snapshot": "false",
5445
+ "skip_rules": {
5446
+ "wont_fix": [
5447
+ "region"
5448
+ ],
5449
+ "will_fix": [
5450
+ "color-contrast"
5451
+ ]
5452
+ }
5453
+ },
5454
+ {
5455
+ "preview_path": "primer/alpha/octicon_symbols/default",
5456
+ "name": "default",
5457
+ "snapshot": "true",
5458
+ "skip_rules": {
5459
+ "wont_fix": [
5460
+ "region"
5461
+ ],
5462
+ "will_fix": [
5463
+ "color-contrast"
5464
+ ]
5465
+ }
5466
+ }
5442
5467
  ],
5443
5468
  "subcomponents": [
5444
5469
 
@@ -7972,6 +7997,19 @@
7972
7997
  ]
7973
7998
  }
7974
7999
  },
8000
+ {
8001
+ "preview_path": "primer/alpha/text_field/with_auto_check_accepted",
8002
+ "name": "with_auto_check_accepted",
8003
+ "snapshot": "false",
8004
+ "skip_rules": {
8005
+ "wont_fix": [
8006
+ "region"
8007
+ ],
8008
+ "will_fix": [
8009
+ "color-contrast"
8010
+ ]
8011
+ }
8012
+ },
7975
8013
  {
7976
8014
  "preview_path": "primer/alpha/text_field/with_auto_check_error",
7977
8015
  "name": "with_auto_check_error",
@@ -9233,7 +9271,7 @@
9233
9271
  "name": "size",
9234
9272
  "type": "Integer",
9235
9273
  "default": "`20`",
9236
- "description": "One of `16`, `20`, `24`, `32`, `40`, `48`, or `80`."
9274
+ "description": "One of `16`, `20`, `24`, `32`, `40`, `48`, `64`, or `80`."
9237
9275
  },
9238
9276
  {
9239
9277
  "name": "shape",
@@ -9378,6 +9416,19 @@
9378
9416
  ]
9379
9417
  }
9380
9418
  },
9419
+ {
9420
+ "preview_path": "primer/beta/avatar/size_64",
9421
+ "name": "size_64",
9422
+ "snapshot": "true",
9423
+ "skip_rules": {
9424
+ "wont_fix": [
9425
+ "region"
9426
+ ],
9427
+ "will_fix": [
9428
+ "color-contrast"
9429
+ ]
9430
+ }
9431
+ },
9381
9432
  {
9382
9433
  "preview_path": "primer/beta/avatar/size_80",
9383
9434
  "name": "size_80",
@@ -11909,12 +11960,6 @@
11909
11960
  "default": "N/A",
11910
11961
  "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
11911
11962
  },
11912
- {
11913
- "name": "wrapper_arguments",
11914
- "type": "Hash",
11915
- "default": "`{}`",
11916
- "description": "Optional keyword arguments to be passed to the wrapper `<div>` tag."
11917
- },
11918
11963
  {
11919
11964
  "name": "scheme",
11920
11965
  "type": "Symbol",
@@ -1176,6 +1176,19 @@
1176
1176
  ]
1177
1177
  }
1178
1178
  },
1179
+ {
1180
+ "preview_path": "primer/beta/avatar/size_64",
1181
+ "name": "size_64",
1182
+ "snapshot": "true",
1183
+ "skip_rules": {
1184
+ "wont_fix": [
1185
+ "region"
1186
+ ],
1187
+ "will_fix": [
1188
+ "color-contrast"
1189
+ ]
1190
+ }
1191
+ },
1179
1192
  {
1180
1193
  "preview_path": "primer/beta/avatar/size_80",
1181
1194
  "name": "size_80",
@@ -4471,6 +4484,40 @@
4471
4484
  }
4472
4485
  ]
4473
4486
  },
4487
+ {
4488
+ "name": "octicon_symbols",
4489
+ "component": "OcticonSymbols",
4490
+ "status": "alpha",
4491
+ "lookup_path": "primer/alpha/octicon_symbols",
4492
+ "examples": [
4493
+ {
4494
+ "preview_path": "primer/alpha/octicon_symbols/playground",
4495
+ "name": "playground",
4496
+ "snapshot": "false",
4497
+ "skip_rules": {
4498
+ "wont_fix": [
4499
+ "region"
4500
+ ],
4501
+ "will_fix": [
4502
+ "color-contrast"
4503
+ ]
4504
+ }
4505
+ },
4506
+ {
4507
+ "preview_path": "primer/alpha/octicon_symbols/default",
4508
+ "name": "default",
4509
+ "snapshot": "true",
4510
+ "skip_rules": {
4511
+ "wont_fix": [
4512
+ "region"
4513
+ ],
4514
+ "will_fix": [
4515
+ "color-contrast"
4516
+ ]
4517
+ }
4518
+ }
4519
+ ]
4520
+ },
4474
4521
  {
4475
4522
  "name": "overlay",
4476
4523
  "component": "Overlay",
@@ -6131,6 +6178,19 @@
6131
6178
  ]
6132
6179
  }
6133
6180
  },
6181
+ {
6182
+ "preview_path": "primer/alpha/text_field/with_auto_check_accepted",
6183
+ "name": "with_auto_check_accepted",
6184
+ "snapshot": "false",
6185
+ "skip_rules": {
6186
+ "wont_fix": [
6187
+ "region"
6188
+ ],
6189
+ "will_fix": [
6190
+ "color-contrast"
6191
+ ]
6192
+ }
6193
+ },
6134
6194
  {
6135
6195
  "preview_path": "primer/alpha/text_field/with_auto_check_error",
6136
6196
  "name": "with_auto_check_error",