@primer/view-components 0.0.114 → 0.0.115
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.
- package/app/assets/javascripts/primer_view_components.js +1 -1
- package/app/assets/javascripts/primer_view_components.js.map +1 -1
- package/app/assets/styles/primer_view_components.css +2 -2
- package/app/assets/styles/primer_view_components.css.map +1 -1
- package/app/components/primer/alpha/layout.css +1 -0
- package/app/components/primer/alpha/layout.css.json +1 -0
- package/app/components/primer/{menu_component.css → alpha/menu.css} +0 -0
- package/app/components/primer/alpha/menu.css.json +1 -0
- package/app/components/primer/alpha/tool_tip.js +77 -69
- package/app/components/primer/primer.d.ts +2 -0
- package/app/components/primer/primer.js +2 -0
- package/lib/primer/forms/primer_multi_input.d.ts +10 -0
- package/lib/primer/forms/primer_multi_input.js +45 -0
- package/lib/primer/forms/primer_text_field.d.ts +1 -0
- package/lib/primer/forms/primer_text_field.js +62 -0
- package/package.json +5 -2
- package/static/arguments.json +159 -159
- package/static/audited_at.json +4 -0
- package/static/constants.json +42 -34
- package/static/statuses.json +10 -6
- package/app/components/primer/menu_component.css.json +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Layout{--Layout-sidebar-width:220px;--Layout-gutter:16px;display:grid}@media (max-width:calc(544px - 0.02px)){.Layout{grid-auto-flow:row;grid-template-columns:1fr!important}.Layout .Layout-divider,.Layout .Layout-main,.Layout .Layout-sidebar{grid-column:1!important;width:100%!important}.Layout.Layout--sidebarPosition-flowRow-start .Layout-sidebar{grid-row:1}.Layout.Layout--sidebarPosition-flowRow-end .Layout-sidebar,.Layout.Layout--sidebarPosition-flowRow-start .Layout-main{grid-row:2/span 2}.Layout.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}.Layout.Layout--sidebarPosition-flowRow-none .Layout-sidebar{display:none}.Layout.Layout--divided{--Layout-gutter:0}.Layout.Layout--divided .Layout-divider{grid-row:2;height:1px}.Layout.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden{display:none}.Layout.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow{background:var(--color-canvas-inset);border-color:var(--color-border-default);border-style:solid;border-width:var(--primer-borderWidth-thin,1px) 0;height:8px;margin-right:0}.Layout.Layout--divided .Layout-main,.Layout.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar{grid-row:3/span 1}.Layout.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}}@media (max-width:calc(768px - 0.02px)){.Layout.Layout--flowRow-until-md{grid-auto-flow:row;grid-template-columns:1fr!important}.Layout.Layout--flowRow-until-md .Layout-divider,.Layout.Layout--flowRow-until-md .Layout-main,.Layout.Layout--flowRow-until-md .Layout-sidebar{grid-column:1!important;width:100%!important}.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-start .Layout-sidebar{grid-row:1}.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-end .Layout-sidebar,.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-start .Layout-main{grid-row:2/span 2}.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-none .Layout-sidebar{display:none}.Layout.Layout--flowRow-until-md.Layout--divided{--Layout-gutter:0}.Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider{grid-row:2;height:1px}.Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden{display:none}.Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow{background:var(--color-canvas-inset);border-color:var(--color-border-default);border-style:solid;border-width:var(--primer-borderWidth-thin,1px) 0;height:8px;margin-right:0}.Layout.Layout--flowRow-until-md.Layout--divided .Layout-main,.Layout.Layout--flowRow-until-md.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar{grid-row:3/span 1}.Layout.Layout--flowRow-until-md.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}}@media (max-width:calc(1012px - 0.02px)){.Layout.Layout--flowRow-until-lg{grid-auto-flow:row;grid-template-columns:1fr!important}.Layout.Layout--flowRow-until-lg .Layout-divider,.Layout.Layout--flowRow-until-lg .Layout-main,.Layout.Layout--flowRow-until-lg .Layout-sidebar{grid-column:1!important;width:100%!important}.Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-start .Layout-sidebar{grid-row:1}.Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-end .Layout-sidebar,.Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-start .Layout-main{grid-row:2/span 2}.Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}.Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-none .Layout-sidebar{display:none}.Layout.Layout--flowRow-until-lg.Layout--divided{--Layout-gutter:0}.Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider{grid-row:2;height:1px}.Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden{display:none}.Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow{background:var(--color-canvas-inset);border-color:var(--color-border-default);border-style:solid;border-width:var(--primer-borderWidth-thin,1px) 0;height:8px;margin-right:0}.Layout.Layout--flowRow-until-lg.Layout--divided .Layout-main,.Layout.Layout--flowRow-until-lg.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar{grid-row:3/span 1}.Layout.Layout--flowRow-until-lg.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}}.Layout{grid-gap:var(--Layout-gutter);grid-auto-flow:column;grid-template-columns:auto 0 minmax(0,calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter)))}.Layout .Layout-sidebar{grid-column:1}.Layout .Layout-divider{display:none}.Layout .Layout-main{grid-column:2/span 2}@media (min-width:1012px){.Layout{--Layout-gutter:24px}}.Layout.Layout--gutter-none{--Layout-gutter:0px}.Layout.Layout--gutter-condensed{--Layout-gutter:16px}@media (min-width:1012px){.Layout.Layout--gutter-spacious{--Layout-gutter:32px}}@media (min-width:1280px){.Layout.Layout--gutter-spacious{--Layout-gutter:40px}}@media (min-width:544px){.Layout{--Layout-sidebar-width:220px}}@media (min-width:768px){.Layout{--Layout-sidebar-width:256px}}@media (min-width:1012px){.Layout{--Layout-sidebar-width:296px}}@media (min-width:768px){.Layout.Layout--sidebar-narrow{--Layout-sidebar-width:240px}}@media (min-width:1012px){.Layout.Layout--sidebar-narrow{--Layout-sidebar-width:256px}.Layout.Layout--sidebar-wide{--Layout-sidebar-width:320px}}@media (min-width:1280px){.Layout.Layout--sidebar-wide{--Layout-sidebar-width:336px}}.Layout.Layout--sidebarPosition-start .Layout-sidebar{grid-column:1}.Layout.Layout--sidebarPosition-start .Layout-main{grid-column:2/span 2}.Layout.Layout--sidebarPosition-end{grid-template-columns:minmax(0,calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter))) 0 auto}.Layout.Layout--sidebarPosition-end .Layout-main{grid-column:1}.Layout.Layout--sidebarPosition-end .Layout-sidebar{grid-column:2/span 2}.Layout.Layout--divided .Layout-divider{background:var(--color-border-default);display:block;grid-column:2;margin-right:-1px;width:1px}.Layout.Layout--divided .Layout-main,.Layout.Layout--divided.Layout--sidebarPosition-end .Layout-sidebar{grid-column:3/span 1}.Layout.Layout--divided.Layout--sidebarPosition-end .Layout-main{grid-column:1}.Layout-divider{display:none;width:1px}.Layout-sidebar{width:var(--Layout-sidebar-width)}.Layout-main{min-width:0}.Layout-main .Layout-main-centered-lg,.Layout-main .Layout-main-centered-md,.Layout-main .Layout-main-centered-xl{margin-left:auto;margin-right:auto}.Layout-main .Layout-main-centered-lg>.container-lg,.Layout-main .Layout-main-centered-lg>.container-md,.Layout-main .Layout-main-centered-lg>.container-xl,.Layout-main .Layout-main-centered-md>.container-lg,.Layout-main .Layout-main-centered-md>.container-md,.Layout-main .Layout-main-centered-md>.container-xl,.Layout-main .Layout-main-centered-xl>.container-lg,.Layout-main .Layout-main-centered-xl>.container-md,.Layout-main .Layout-main-centered-xl>.container-xl{margin-left:0}.Layout-main .Layout-main-centered-md{max-width:calc(var(--primer-breakpoint-medium, 768px) + var(--Layout-sidebar-width) + var(--Layout-gutter))}.Layout-main .Layout-main-centered-lg{max-width:calc(var(--primer-breakpoint-large, 1012px) + var(--Layout-sidebar-width) + var(--Layout-gutter))}.Layout-main .Layout-main-centered-xl{max-width:calc(var(--primer-breakpoint-xlarge, 1280px) + var(--Layout-sidebar-width) + var(--Layout-gutter))}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"alpha/layout","selectors":[".Layout",".Layout .Layout-divider",".Layout .Layout-main",".Layout .Layout-sidebar",".Layout.Layout--sidebarPosition-flowRow-start .Layout-sidebar",".Layout.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--sidebarPosition-flowRow-start .Layout-main",".Layout.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--sidebarPosition-flowRow-none .Layout-sidebar",".Layout.Layout--divided",".Layout.Layout--divided .Layout-divider",".Layout.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden",".Layout.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow",".Layout.Layout--divided .Layout-main",".Layout.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--flowRow-until-md",".Layout.Layout--flowRow-until-md .Layout-divider",".Layout.Layout--flowRow-until-md .Layout-main",".Layout.Layout--flowRow-until-md .Layout-sidebar",".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-start .Layout-sidebar",".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-start .Layout-main",".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-none .Layout-sidebar",".Layout.Layout--flowRow-until-md.Layout--divided",".Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider",".Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden",".Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow",".Layout.Layout--flowRow-until-md.Layout--divided .Layout-main",".Layout.Layout--flowRow-until-md.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--flowRow-until-md.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--flowRow-until-lg",".Layout.Layout--flowRow-until-lg .Layout-divider",".Layout.Layout--flowRow-until-lg .Layout-main",".Layout.Layout--flowRow-until-lg .Layout-sidebar",".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-start .Layout-sidebar",".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-start .Layout-main",".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-none .Layout-sidebar",".Layout.Layout--flowRow-until-lg.Layout--divided",".Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider",".Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden",".Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow",".Layout.Layout--flowRow-until-lg.Layout--divided .Layout-main",".Layout.Layout--flowRow-until-lg.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--flowRow-until-lg.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--gutter-none",".Layout.Layout--gutter-condensed",".Layout.Layout--gutter-spacious",".Layout.Layout--sidebar-narrow",".Layout.Layout--sidebar-wide",".Layout.Layout--sidebarPosition-start .Layout-sidebar",".Layout.Layout--sidebarPosition-start .Layout-main",".Layout.Layout--sidebarPosition-end",".Layout.Layout--sidebarPosition-end .Layout-main",".Layout.Layout--sidebarPosition-end .Layout-sidebar",".Layout.Layout--divided.Layout--sidebarPosition-end .Layout-sidebar",".Layout.Layout--divided.Layout--sidebarPosition-end .Layout-main",".Layout-divider",".Layout-sidebar",".Layout-main",".Layout-main .Layout-main-centered-lg",".Layout-main .Layout-main-centered-md",".Layout-main .Layout-main-centered-xl",".Layout-main .Layout-main-centered-lg>.container-lg",".Layout-main .Layout-main-centered-lg>.container-md",".Layout-main .Layout-main-centered-lg>.container-xl",".Layout-main .Layout-main-centered-md>.container-lg",".Layout-main .Layout-main-centered-md>.container-md",".Layout-main .Layout-main-centered-md>.container-xl",".Layout-main .Layout-main-centered-xl>.container-lg",".Layout-main .Layout-main-centered-xl>.container-md",".Layout-main .Layout-main-centered-xl>.container-xl"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"alpha/menu","selectors":[".menu",".menu-item",".menu-item:first-child",".menu-item:first-child:before",".menu-item:last-child",".menu-item:last-child:before",".menu-item:hover",".menu-item:active",".menu-item.selected",".menu-item[aria-current]:not([aria-current=false])",".menu-item[aria-selected=true]",":is(.menu-item.selected",".menu-item[aria-current]:not([aria-current=false])):before",".menu-item .octicon",".menu-item .Counter",".menu-item .menu-warning",".menu-item .avatar",".menu-item.alert .Counter",".menu-heading",".menu-heading:hover",".menu-heading:first-child",".menu-heading:last-child"]}
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _ToolTipElement_instances, _ToolTipElement_abortController, _ToolTipElement_align, _ToolTipElement_side, _ToolTipElement_allowUpdatePosition, _ToolTipElement_update, _ToolTipElement_updatePosition;
|
|
12
|
+
var _ToolTipElement_instances, _ToolTipElement_abortController, _ToolTipElement_align, _ToolTipElement_side, _ToolTipElement_allowUpdatePosition, _ToolTipElement_update, _ToolTipElement_updateControlReference, _ToolTipElement_updateDirection, _ToolTipElement_updatePosition;
|
|
13
13
|
import { getAnchoredPosition } from '@primer/behaviors';
|
|
14
14
|
const TOOLTIP_OPEN_CLASS = 'tooltip-open';
|
|
15
15
|
const TOOLTIP_ARROW_EDGE_OFFSET = 6;
|
|
@@ -187,6 +187,8 @@ class ToolTipElement extends HTMLElement {
|
|
|
187
187
|
}
|
|
188
188
|
connectedCallback() {
|
|
189
189
|
var _a;
|
|
190
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControlReference).call(this);
|
|
191
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateDirection).call(this);
|
|
190
192
|
if (!this.shadowRoot) {
|
|
191
193
|
const shadow = this.attachShadow({ mode: 'open' });
|
|
192
194
|
// eslint-disable-next-line github/no-inner-html
|
|
@@ -241,77 +243,13 @@ class ToolTipElement extends HTMLElement {
|
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
245
|
attributeChangedCallback(name) {
|
|
246
|
+
if (!this.isConnected)
|
|
247
|
+
return;
|
|
244
248
|
if (name === 'id' || name === 'data-type') {
|
|
245
|
-
|
|
246
|
-
return;
|
|
247
|
-
if (this.type === 'label') {
|
|
248
|
-
let labelledBy = this.control.getAttribute('aria-labelledby');
|
|
249
|
-
if (labelledBy) {
|
|
250
|
-
if (!labelledBy.split(' ').includes(this.id)) {
|
|
251
|
-
labelledBy = `${labelledBy} ${this.id}`;
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
labelledBy = `${labelledBy}`;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
labelledBy = this.id;
|
|
259
|
-
}
|
|
260
|
-
this.control.setAttribute('aria-labelledby', labelledBy);
|
|
261
|
-
// Prevent duplicate accessible name announcements.
|
|
262
|
-
this.setAttribute('aria-hidden', 'true');
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
let describedBy = this.control.getAttribute('aria-describedby');
|
|
266
|
-
if (describedBy) {
|
|
267
|
-
if (!describedBy.split(' ').includes(this.id)) {
|
|
268
|
-
describedBy = `${describedBy} ${this.id}`;
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
describedBy = `${describedBy}`;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
describedBy = this.id;
|
|
276
|
-
}
|
|
277
|
-
this.control.setAttribute('aria-describedby', describedBy);
|
|
278
|
-
}
|
|
249
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControlReference).call(this);
|
|
279
250
|
}
|
|
280
251
|
else if (name === 'data-direction') {
|
|
281
|
-
this.
|
|
282
|
-
const direction = this.direction;
|
|
283
|
-
if (direction === 'n') {
|
|
284
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
285
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
286
|
-
}
|
|
287
|
-
else if (direction === 'ne') {
|
|
288
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
|
289
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
290
|
-
}
|
|
291
|
-
else if (direction === 'e') {
|
|
292
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
293
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-right', "f");
|
|
294
|
-
}
|
|
295
|
-
else if (direction === 'se') {
|
|
296
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
|
297
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
298
|
-
}
|
|
299
|
-
else if (direction === 's') {
|
|
300
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
301
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
302
|
-
}
|
|
303
|
-
else if (direction === 'sw') {
|
|
304
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
|
305
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
306
|
-
}
|
|
307
|
-
else if (direction === 'w') {
|
|
308
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
309
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-left', "f");
|
|
310
|
-
}
|
|
311
|
-
else if (direction === 'nw') {
|
|
312
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
|
313
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
314
|
-
}
|
|
252
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateDirection).call(this);
|
|
315
253
|
}
|
|
316
254
|
}
|
|
317
255
|
}
|
|
@@ -327,6 +265,76 @@ _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new Wea
|
|
|
327
265
|
}
|
|
328
266
|
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updatePosition).call(this);
|
|
329
267
|
}
|
|
268
|
+
}, _ToolTipElement_updateControlReference = function _ToolTipElement_updateControlReference() {
|
|
269
|
+
if (!this.id || !this.control)
|
|
270
|
+
return;
|
|
271
|
+
if (this.type === 'label') {
|
|
272
|
+
let labelledBy = this.control.getAttribute('aria-labelledby');
|
|
273
|
+
if (labelledBy) {
|
|
274
|
+
if (!labelledBy.split(' ').includes(this.id)) {
|
|
275
|
+
labelledBy = `${labelledBy} ${this.id}`;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
labelledBy = `${labelledBy}`;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
labelledBy = this.id;
|
|
283
|
+
}
|
|
284
|
+
this.control.setAttribute('aria-labelledby', labelledBy);
|
|
285
|
+
// Prevent duplicate accessible name announcements.
|
|
286
|
+
this.setAttribute('aria-hidden', 'true');
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
let describedBy = this.control.getAttribute('aria-describedby');
|
|
290
|
+
if (describedBy) {
|
|
291
|
+
if (!describedBy.split(' ').includes(this.id)) {
|
|
292
|
+
describedBy = `${describedBy} ${this.id}`;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
describedBy = `${describedBy}`;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
describedBy = this.id;
|
|
300
|
+
}
|
|
301
|
+
this.control.setAttribute('aria-describedby', describedBy);
|
|
302
|
+
}
|
|
303
|
+
}, _ToolTipElement_updateDirection = function _ToolTipElement_updateDirection() {
|
|
304
|
+
this.classList.remove(...DIRECTION_CLASSES);
|
|
305
|
+
const direction = this.direction;
|
|
306
|
+
if (direction === 'n') {
|
|
307
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
308
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
309
|
+
}
|
|
310
|
+
else if (direction === 'ne') {
|
|
311
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
|
312
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
313
|
+
}
|
|
314
|
+
else if (direction === 'e') {
|
|
315
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
316
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-right', "f");
|
|
317
|
+
}
|
|
318
|
+
else if (direction === 'se') {
|
|
319
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
|
320
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
321
|
+
}
|
|
322
|
+
else if (direction === 's') {
|
|
323
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
324
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
325
|
+
}
|
|
326
|
+
else if (direction === 'sw') {
|
|
327
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
|
328
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
329
|
+
}
|
|
330
|
+
else if (direction === 'w') {
|
|
331
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
332
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-left', "f");
|
|
333
|
+
}
|
|
334
|
+
else if (direction === 'nw') {
|
|
335
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
|
336
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
337
|
+
}
|
|
330
338
|
}, _ToolTipElement_updatePosition = function _ToolTipElement_updatePosition() {
|
|
331
339
|
if (!this.control)
|
|
332
340
|
return;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class PrimerMultiInputElement extends HTMLElement {
|
|
2
|
+
fields: HTMLInputElement[];
|
|
3
|
+
activateField(name: string): void;
|
|
4
|
+
private findField;
|
|
5
|
+
}
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
PrimerMultiInputElement: typeof PrimerMultiInputElement;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/* eslint-disable custom-elements/expose-class-on-global */
|
|
8
|
+
import { controller, targets } from '@github/catalyst';
|
|
9
|
+
let PrimerMultiInputElement = class PrimerMultiInputElement extends HTMLElement {
|
|
10
|
+
activateField(name) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const fieldWithName = this.findField(name);
|
|
13
|
+
if (!fieldWithName)
|
|
14
|
+
return;
|
|
15
|
+
for (const field of this.fields) {
|
|
16
|
+
if (field === fieldWithName)
|
|
17
|
+
continue;
|
|
18
|
+
field.setAttribute('disabled', 'disabled');
|
|
19
|
+
field.setAttribute('hidden', 'hidden');
|
|
20
|
+
(_a = field.parentElement) === null || _a === void 0 ? void 0 : _a.setAttribute('hidden', 'hidden');
|
|
21
|
+
}
|
|
22
|
+
fieldWithName.removeAttribute('disabled');
|
|
23
|
+
fieldWithName.removeAttribute('hidden');
|
|
24
|
+
(_b = fieldWithName.parentElement) === null || _b === void 0 ? void 0 : _b.removeAttribute('hidden');
|
|
25
|
+
}
|
|
26
|
+
findField(name) {
|
|
27
|
+
for (const field of this.fields) {
|
|
28
|
+
if (field.getAttribute('data-name') === name) {
|
|
29
|
+
return field;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
__decorate([
|
|
36
|
+
targets
|
|
37
|
+
], PrimerMultiInputElement.prototype, "fields", void 0);
|
|
38
|
+
PrimerMultiInputElement = __decorate([
|
|
39
|
+
controller
|
|
40
|
+
], PrimerMultiInputElement);
|
|
41
|
+
export { PrimerMultiInputElement };
|
|
42
|
+
if (!window.customElements.get('primer-multi-input')) {
|
|
43
|
+
Object.assign(window, { PrimerMultiInputElement });
|
|
44
|
+
window.customElements.define('primer-multi-input', PrimerMultiInputElement);
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@github/auto-check-element';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
15
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
16
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
|
+
};
|
|
18
|
+
var _PrimerTextFieldElement_abortController;
|
|
19
|
+
import '@github/auto-check-element';
|
|
20
|
+
import { controller, target } from '@github/catalyst';
|
|
21
|
+
let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
_PrimerTextFieldElement_abortController.set(this, void 0);
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = __classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
|
29
|
+
const { signal } = (__classPrivateFieldSet(this, _PrimerTextFieldElement_abortController, new AbortController(), "f"));
|
|
30
|
+
this.inputElement.addEventListener('auto-check-success', () => { this.clearError(); }, { signal });
|
|
31
|
+
this.inputElement.addEventListener('auto-check-error', (event) => {
|
|
32
|
+
event.detail.response.text().then((error_message) => { this.setError(error_message); });
|
|
33
|
+
}, { signal });
|
|
34
|
+
}
|
|
35
|
+
disconnectedCallback() {
|
|
36
|
+
var _a;
|
|
37
|
+
(_a = __classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
|
38
|
+
}
|
|
39
|
+
clearError() {
|
|
40
|
+
this.inputElement.removeAttribute('invalid');
|
|
41
|
+
this.validationElement.hidden = true;
|
|
42
|
+
this.validationMessageElement.innerText = '';
|
|
43
|
+
}
|
|
44
|
+
setError(message) {
|
|
45
|
+
this.validationMessageElement.innerText = message;
|
|
46
|
+
this.validationElement.hidden = false;
|
|
47
|
+
this.inputElement.setAttribute('invalid', 'true');
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
_PrimerTextFieldElement_abortController = new WeakMap();
|
|
51
|
+
__decorate([
|
|
52
|
+
target
|
|
53
|
+
], PrimerTextFieldElement.prototype, "inputElement", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
target
|
|
56
|
+
], PrimerTextFieldElement.prototype, "validationElement", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
target
|
|
59
|
+
], PrimerTextFieldElement.prototype, "validationMessageElement", void 0);
|
|
60
|
+
PrimerTextFieldElement = __decorate([
|
|
61
|
+
controller
|
|
62
|
+
], PrimerTextFieldElement);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/view-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.115",
|
|
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",
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"app/components/primer/**/*.js",
|
|
26
26
|
"app/components/primer/**/*.css",
|
|
27
27
|
"app/components/primer/**/*.css.json",
|
|
28
|
-
"app/components/primer/**/*.d.ts"
|
|
28
|
+
"app/components/primer/**/*.d.ts",
|
|
29
|
+
"lib/primer/forms/**/*.js",
|
|
30
|
+
"lib/primer/forms/**/*.d.ts"
|
|
29
31
|
],
|
|
30
32
|
"scripts": {
|
|
31
33
|
"clean": "git clean -fdX -- app/",
|
|
@@ -42,6 +44,7 @@
|
|
|
42
44
|
"build:css": "script/build-assets css"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
47
|
+
"@github/auto-check-element": "^5.2.0",
|
|
45
48
|
"@github/auto-complete-element": "^3.3.4",
|
|
46
49
|
"@github/catalyst": "^1.6.0",
|
|
47
50
|
"@github/clipboard-copy-element": "^1.1.2",
|