@primer/view-components 0.0.100 → 0.0.102
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.map +1 -1
- package/app/assets/styles/primer_view_components.css +1 -1
- package/app/assets/styles/primer_view_components.css.map +1 -1
- package/app/components/primer/alpha/toggle_switch.d.ts +2 -1
- package/app/components/primer/alpha/toggle_switch.js +0 -1
- package/app/components/primer/alpha/tool-tip-element.d.ts +23 -0
- package/app/components/primer/alpha/tool-tip-element.js +352 -0
- package/app/components/primer/clipboard_copy_component.d.ts +1 -0
- package/app/components/primer/clipboard_copy_component.js +43 -0
- package/package.json +9 -3
- package/static/arguments.json +6 -60
- package/static/audited_at.json +0 -2
- package/static/constants.json +0 -60
- package/static/statuses.json +0 -2
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
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");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
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 _ToolTipElement_instances, _ToolTipElement_abortController, _ToolTipElement_align, _ToolTipElement_side, _ToolTipElement_allowUpdatePosition, _ToolTipElement_update, _ToolTipElement_updatePosition;
|
|
13
|
+
import { getAnchoredPosition } from '@primer/behaviors';
|
|
14
|
+
const TOOLTIP_OPEN_CLASS = 'tooltip-open';
|
|
15
|
+
const TOOLTIP_ARROW_EDGE_OFFSET = 6;
|
|
16
|
+
const DIRECTION_CLASSES = [
|
|
17
|
+
'tooltip-n',
|
|
18
|
+
'tooltip-s',
|
|
19
|
+
'tooltip-e',
|
|
20
|
+
'tooltip-w',
|
|
21
|
+
'tooltip-ne',
|
|
22
|
+
'tooltip-se',
|
|
23
|
+
'tooltip-nw',
|
|
24
|
+
'tooltip-sw'
|
|
25
|
+
];
|
|
26
|
+
class ToolTipElement extends HTMLElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
_ToolTipElement_instances.add(this);
|
|
30
|
+
_ToolTipElement_abortController.set(this, void 0);
|
|
31
|
+
_ToolTipElement_align.set(this, 'center');
|
|
32
|
+
_ToolTipElement_side.set(this, 'outside-bottom');
|
|
33
|
+
_ToolTipElement_allowUpdatePosition.set(this, false);
|
|
34
|
+
}
|
|
35
|
+
styles() {
|
|
36
|
+
return `
|
|
37
|
+
:host {
|
|
38
|
+
position: absolute;
|
|
39
|
+
z-index: 1000000;
|
|
40
|
+
padding: .5em .75em;
|
|
41
|
+
font: normal normal 11px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
|
42
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
|
43
|
+
color: var(--color-fg-on-emphasis);
|
|
44
|
+
text-align: center;
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
text-shadow: none;
|
|
47
|
+
text-transform: none;
|
|
48
|
+
letter-spacing: normal;
|
|
49
|
+
word-wrap: break-word;
|
|
50
|
+
white-space: pre;
|
|
51
|
+
background: var(--color-neutral-emphasis-plus);
|
|
52
|
+
border-radius: 6px;
|
|
53
|
+
opacity: 0;
|
|
54
|
+
max-width: 250px;
|
|
55
|
+
word-wrap: break-word;
|
|
56
|
+
white-space: normal;
|
|
57
|
+
width: max-content;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host:before{
|
|
61
|
+
position: absolute;
|
|
62
|
+
z-index: 1000001;
|
|
63
|
+
color: var(--color-neutral-emphasis-plus);
|
|
64
|
+
content: "";
|
|
65
|
+
border: 6px solid transparent;
|
|
66
|
+
opacity: 0
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@keyframes tooltip-appear {
|
|
70
|
+
from {
|
|
71
|
+
opacity: 0
|
|
72
|
+
}
|
|
73
|
+
to {
|
|
74
|
+
opacity: 1
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host:after{
|
|
79
|
+
position: absolute;
|
|
80
|
+
display: block;
|
|
81
|
+
right: 0;
|
|
82
|
+
left: 0;
|
|
83
|
+
height: 12px;
|
|
84
|
+
content: ""
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host(.${TOOLTIP_OPEN_CLASS}),
|
|
88
|
+
:host(.${TOOLTIP_OPEN_CLASS}):before {
|
|
89
|
+
animation-name: tooltip-appear;
|
|
90
|
+
animation-duration: .1s;
|
|
91
|
+
animation-fill-mode: forwards;
|
|
92
|
+
animation-timing-function: ease-in;
|
|
93
|
+
animation-delay: .4s
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host(.tooltip-s):before,
|
|
97
|
+
:host(.tooltip-n):before {
|
|
98
|
+
right: 50%;
|
|
99
|
+
margin-right: -${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:host(.tooltip-s):before,
|
|
103
|
+
:host(.tooltip-se):before,
|
|
104
|
+
:host(.tooltip-sw):before {
|
|
105
|
+
bottom: 100%;
|
|
106
|
+
border-bottom-color: var(--color-neutral-emphasis-plus)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:host(.tooltip-s):after,
|
|
110
|
+
:host(.tooltip-se):after,
|
|
111
|
+
:host(.tooltip-sw):after {
|
|
112
|
+
bottom: 100%
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:host(.tooltip-n):before,
|
|
116
|
+
:host(.tooltip-ne):before,
|
|
117
|
+
:host(.tooltip-nw):before {
|
|
118
|
+
top: 100%;
|
|
119
|
+
border-top-color: var(--color-neutral-emphasis-plus)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host(.tooltip-n):after,
|
|
123
|
+
:host(.tooltip-ne):after,
|
|
124
|
+
:host(.tooltip-nw):after {
|
|
125
|
+
top: 100%
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:host(.tooltip-se):before,
|
|
129
|
+
:host(.tooltip-ne):before {
|
|
130
|
+
left: 0;
|
|
131
|
+
margin-left: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host(.tooltip-sw):before,
|
|
135
|
+
:host(.tooltip-nw):before {
|
|
136
|
+
right: 0;
|
|
137
|
+
margin-right: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
:host(.tooltip-w):before {
|
|
141
|
+
top: 50%;
|
|
142
|
+
bottom: 50%;
|
|
143
|
+
left: 100%;
|
|
144
|
+
margin-top: -6px;
|
|
145
|
+
border-left-color: var(--color-neutral-emphasis-plus)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
:host(.tooltip-e):before {
|
|
149
|
+
top: 50%;
|
|
150
|
+
right: 100%;
|
|
151
|
+
bottom: 50%;
|
|
152
|
+
margin-top: -6px;
|
|
153
|
+
border-right-color: var(--color-neutral-emphasis-plus)
|
|
154
|
+
}
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
get htmlFor() {
|
|
158
|
+
return this.getAttribute('for') || '';
|
|
159
|
+
}
|
|
160
|
+
set htmlFor(value) {
|
|
161
|
+
this.setAttribute('for', value);
|
|
162
|
+
}
|
|
163
|
+
get type() {
|
|
164
|
+
const type = this.getAttribute('data-type');
|
|
165
|
+
return type === 'label' ? 'label' : 'description';
|
|
166
|
+
}
|
|
167
|
+
set type(value) {
|
|
168
|
+
this.setAttribute('data-type', value);
|
|
169
|
+
}
|
|
170
|
+
get direction() {
|
|
171
|
+
return (this.getAttribute('data-direction') || 's');
|
|
172
|
+
}
|
|
173
|
+
set direction(value) {
|
|
174
|
+
this.setAttribute('data-direction', value);
|
|
175
|
+
}
|
|
176
|
+
get control() {
|
|
177
|
+
return this.ownerDocument.getElementById(this.htmlFor);
|
|
178
|
+
}
|
|
179
|
+
connectedCallback() {
|
|
180
|
+
var _a;
|
|
181
|
+
if (!this.shadowRoot) {
|
|
182
|
+
const shadow = this.attachShadow({ mode: 'open' });
|
|
183
|
+
// eslint-disable-next-line github/no-inner-html
|
|
184
|
+
shadow.innerHTML = `
|
|
185
|
+
<style>
|
|
186
|
+
${this.styles()}
|
|
187
|
+
</style>
|
|
188
|
+
<slot></slot>
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
this.hidden = true;
|
|
192
|
+
__classPrivateFieldSet(this, _ToolTipElement_allowUpdatePosition, true, "f");
|
|
193
|
+
if (!this.id) {
|
|
194
|
+
this.id = `tooltip-${Date.now()}-${(Math.random() * 10000).toFixed(0)}`;
|
|
195
|
+
}
|
|
196
|
+
if (!this.control)
|
|
197
|
+
return;
|
|
198
|
+
this.setAttribute('role', 'tooltip');
|
|
199
|
+
(_a = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
|
200
|
+
__classPrivateFieldSet(this, _ToolTipElement_abortController, new AbortController(), "f");
|
|
201
|
+
const { signal } = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f");
|
|
202
|
+
this.addEventListener('mouseleave', this, { signal });
|
|
203
|
+
this.control.addEventListener('mouseenter', this, { signal });
|
|
204
|
+
this.control.addEventListener('mouseleave', this, { signal });
|
|
205
|
+
this.control.addEventListener('focus', this, { signal });
|
|
206
|
+
this.control.addEventListener('blur', this, { signal });
|
|
207
|
+
this.ownerDocument.addEventListener('keydown', this, { signal });
|
|
208
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_update).call(this);
|
|
209
|
+
}
|
|
210
|
+
disconnectedCallback() {
|
|
211
|
+
var _a;
|
|
212
|
+
(_a = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
|
213
|
+
}
|
|
214
|
+
handleEvent(event) {
|
|
215
|
+
if (!this.control)
|
|
216
|
+
return;
|
|
217
|
+
// Ensures that tooltip stays open when hovering between tooltip and element
|
|
218
|
+
// WCAG Success Criterion 1.4.13 Hoverable
|
|
219
|
+
if ((event.type === 'mouseenter' || event.type === 'focus') && this.hidden) {
|
|
220
|
+
this.hidden = false;
|
|
221
|
+
}
|
|
222
|
+
else if (event.type === 'blur') {
|
|
223
|
+
this.hidden = true;
|
|
224
|
+
}
|
|
225
|
+
else if (event.type === 'mouseleave' &&
|
|
226
|
+
event.relatedTarget !== this.control &&
|
|
227
|
+
event.relatedTarget !== this) {
|
|
228
|
+
this.hidden = true;
|
|
229
|
+
}
|
|
230
|
+
else if (event.type === 'keydown' && event.key === 'Escape' && !this.hidden) {
|
|
231
|
+
this.hidden = true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
attributeChangedCallback(name) {
|
|
235
|
+
if (name === 'id' || name === 'data-type') {
|
|
236
|
+
if (!this.id || !this.control)
|
|
237
|
+
return;
|
|
238
|
+
if (this.type === 'label') {
|
|
239
|
+
this.control.setAttribute('aria-labelledby', this.id);
|
|
240
|
+
this.setAttribute('aria-hidden', 'true');
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
let describedBy = this.control.getAttribute('aria-describedby');
|
|
244
|
+
describedBy ? (describedBy = `${describedBy} ${this.id}`) : (describedBy = this.id);
|
|
245
|
+
this.control.setAttribute('aria-describedby', describedBy);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else if (this.isConnected && name === 'hidden') {
|
|
249
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_update).call(this);
|
|
250
|
+
}
|
|
251
|
+
else if (name === 'data-direction') {
|
|
252
|
+
this.classList.remove(...DIRECTION_CLASSES);
|
|
253
|
+
const direction = this.direction;
|
|
254
|
+
if (direction === 'n') {
|
|
255
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
256
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
257
|
+
}
|
|
258
|
+
else if (direction === 'ne') {
|
|
259
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
|
260
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
261
|
+
}
|
|
262
|
+
else if (direction === 'e') {
|
|
263
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
264
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-right', "f");
|
|
265
|
+
}
|
|
266
|
+
else if (direction === 'se') {
|
|
267
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
|
268
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
269
|
+
}
|
|
270
|
+
else if (direction === 's') {
|
|
271
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
272
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
273
|
+
}
|
|
274
|
+
else if (direction === 'sw') {
|
|
275
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
|
276
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
277
|
+
}
|
|
278
|
+
else if (direction === 'w') {
|
|
279
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
280
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-left', "f");
|
|
281
|
+
}
|
|
282
|
+
else if (direction === 'nw') {
|
|
283
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
|
284
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
_ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new WeakMap(), _ToolTipElement_side = new WeakMap(), _ToolTipElement_allowUpdatePosition = new WeakMap(), _ToolTipElement_instances = new WeakSet(), _ToolTipElement_update = function _ToolTipElement_update() {
|
|
290
|
+
if (this.hidden) {
|
|
291
|
+
this.classList.remove(TOOLTIP_OPEN_CLASS, ...DIRECTION_CLASSES);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
this.classList.add(TOOLTIP_OPEN_CLASS);
|
|
295
|
+
for (const tooltip of this.ownerDocument.querySelectorAll(this.tagName)) {
|
|
296
|
+
if (tooltip !== this)
|
|
297
|
+
tooltip.hidden = true;
|
|
298
|
+
}
|
|
299
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updatePosition).call(this);
|
|
300
|
+
}
|
|
301
|
+
}, _ToolTipElement_updatePosition = function _ToolTipElement_updatePosition() {
|
|
302
|
+
if (!this.control)
|
|
303
|
+
return;
|
|
304
|
+
if (!__classPrivateFieldGet(this, _ToolTipElement_allowUpdatePosition, "f") || this.hidden)
|
|
305
|
+
return;
|
|
306
|
+
const TOOLTIP_OFFSET = 10;
|
|
307
|
+
this.style.left = `0px`; // Ensures we have reliable tooltip width in `getAnchoredPosition`
|
|
308
|
+
const position = getAnchoredPosition(this, this.control, {
|
|
309
|
+
side: __classPrivateFieldGet(this, _ToolTipElement_side, "f"),
|
|
310
|
+
align: __classPrivateFieldGet(this, _ToolTipElement_align, "f"),
|
|
311
|
+
anchorOffset: TOOLTIP_OFFSET
|
|
312
|
+
});
|
|
313
|
+
const anchorSide = position.anchorSide;
|
|
314
|
+
const align = position.anchorAlign;
|
|
315
|
+
this.style.top = `${position.top}px`;
|
|
316
|
+
this.style.left = `${position.left}px`;
|
|
317
|
+
let direction = 's';
|
|
318
|
+
if (anchorSide === 'outside-left') {
|
|
319
|
+
direction = 'w';
|
|
320
|
+
}
|
|
321
|
+
else if (anchorSide === 'outside-right') {
|
|
322
|
+
direction = 'e';
|
|
323
|
+
}
|
|
324
|
+
else if (anchorSide === 'outside-top') {
|
|
325
|
+
if (align === 'center') {
|
|
326
|
+
direction = 'n';
|
|
327
|
+
}
|
|
328
|
+
else if (align === 'start') {
|
|
329
|
+
direction = 'ne';
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
direction = 'nw';
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
if (align === 'center') {
|
|
337
|
+
direction = 's';
|
|
338
|
+
}
|
|
339
|
+
else if (align === 'start') {
|
|
340
|
+
direction = 'se';
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
direction = 'sw';
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
this.classList.add(`tooltip-${direction}`);
|
|
347
|
+
};
|
|
348
|
+
ToolTipElement.observedAttributes = ['data-type', 'data-direction', 'id', 'hidden'];
|
|
349
|
+
if (!window.customElements.get('tool-tip')) {
|
|
350
|
+
window.ToolTipElement = ToolTipElement;
|
|
351
|
+
window.customElements.define('tool-tip', ToolTipElement);
|
|
352
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@github/clipboard-copy-element';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import '@github/clipboard-copy-element';
|
|
2
|
+
const CLIPBOARD_COPY_TIMER_DURATION = 2000;
|
|
3
|
+
function showSVG(svg) {
|
|
4
|
+
svg.style.display = 'inline-block';
|
|
5
|
+
}
|
|
6
|
+
function hideSVG(svg) {
|
|
7
|
+
svg.style.display = 'none';
|
|
8
|
+
}
|
|
9
|
+
// Toggle a copy button.
|
|
10
|
+
function showCopy(button) {
|
|
11
|
+
const [copyIcon, checkIcon] = button.querySelectorAll('.octicon');
|
|
12
|
+
if (!copyIcon || !checkIcon)
|
|
13
|
+
return;
|
|
14
|
+
showSVG(copyIcon);
|
|
15
|
+
hideSVG(checkIcon);
|
|
16
|
+
}
|
|
17
|
+
// Toggle a copy button.
|
|
18
|
+
function showCheck(button) {
|
|
19
|
+
const [copyIcon, checkIcon] = button.querySelectorAll('.octicon');
|
|
20
|
+
if (!copyIcon || !checkIcon)
|
|
21
|
+
return;
|
|
22
|
+
hideSVG(copyIcon);
|
|
23
|
+
showSVG(checkIcon);
|
|
24
|
+
}
|
|
25
|
+
const clipboardCopyElementTimers = new WeakMap();
|
|
26
|
+
document.addEventListener('clipboard-copy', function ({ target }) {
|
|
27
|
+
if (!(target instanceof HTMLElement))
|
|
28
|
+
return;
|
|
29
|
+
if (!target.hasAttribute('data-view-component'))
|
|
30
|
+
return;
|
|
31
|
+
const currentTimeout = clipboardCopyElementTimers.get(target);
|
|
32
|
+
if (currentTimeout) {
|
|
33
|
+
clearTimeout(currentTimeout);
|
|
34
|
+
clipboardCopyElementTimers.delete(target);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
showCheck(target);
|
|
38
|
+
}
|
|
39
|
+
clipboardCopyElementTimers.set(target, setTimeout(() => {
|
|
40
|
+
showCopy(target);
|
|
41
|
+
clipboardCopyElementTimers.delete(target);
|
|
42
|
+
}, CLIPBOARD_COPY_TIMER_DURATION));
|
|
43
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/view-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.102",
|
|
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",
|
|
@@ -31,8 +31,11 @@
|
|
|
31
31
|
"build:docs": "npm run --prefix ./docs/ build",
|
|
32
32
|
"build:docs:preview": "cd docs && npx gatsby build",
|
|
33
33
|
"prepare": "rm -rf docs/static && mkdir -p docs/static && npm run build:js && npm run build:css && cp app/assets/**/primer_view_components.* docs/static/",
|
|
34
|
-
"lint": "eslint
|
|
35
|
-
"lint:
|
|
34
|
+
"lint": "npm run lint:stylelint && npm run lint:eslint",
|
|
35
|
+
"lint:stylelint": "stylelint 'app/components/**/*.pcss'",
|
|
36
|
+
"lint:stylelint:fix": "stylelint 'app/components/**/*.pcss' --fix",
|
|
37
|
+
"lint:eslint": "eslint 'app/components/**/*.ts'",
|
|
38
|
+
"lint:eslint:fix": "eslint 'app/components/**/*.ts' --fix",
|
|
36
39
|
"changeset:version": "changeset version && script/version",
|
|
37
40
|
"build:js": "tsc && rollup -c",
|
|
38
41
|
"build:css": "postcss -o app/assets/styles/primer_view_components.css app/components/primer/primer.pcss"
|
|
@@ -74,6 +77,9 @@
|
|
|
74
77
|
"prettier": "2.7.1",
|
|
75
78
|
"rollup": "^2.77.1",
|
|
76
79
|
"rollup-plugin-terser": "^7.0.2",
|
|
80
|
+
"stylelint": "^14.13.0",
|
|
81
|
+
"stylelint-config-prettier": "^9.0.3",
|
|
82
|
+
"stylelint-config-standard": "^28.0.0",
|
|
77
83
|
"tslib": "^2.4.0",
|
|
78
84
|
"typescript": "^4.7.4"
|
|
79
85
|
},
|
package/static/arguments.json
CHANGED
|
@@ -123,6 +123,12 @@
|
|
|
123
123
|
"default": "`nil`",
|
|
124
124
|
"description": "CSS classes that will be added to the label."
|
|
125
125
|
},
|
|
126
|
+
{
|
|
127
|
+
"name": "content_arguments",
|
|
128
|
+
"type": "Hash",
|
|
129
|
+
"default": "`{}`",
|
|
130
|
+
"description": "[System arguments](/system-arguments) used to construct the item's anchor or span tag."
|
|
131
|
+
},
|
|
126
132
|
{
|
|
127
133
|
"name": "truncate_label",
|
|
128
134
|
"type": "Boolean",
|
|
@@ -1553,66 +1559,6 @@
|
|
|
1553
1559
|
}
|
|
1554
1560
|
]
|
|
1555
1561
|
},
|
|
1556
|
-
{
|
|
1557
|
-
"component": "Flex",
|
|
1558
|
-
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/flex_component.rb",
|
|
1559
|
-
"parameters": [
|
|
1560
|
-
{
|
|
1561
|
-
"name": "justify_content",
|
|
1562
|
-
"type": "Symbol",
|
|
1563
|
-
"default": "`JUSTIFY_CONTENT_DEFAULT`",
|
|
1564
|
-
"description": "Use this param to distribute space between and around flex items along the main axis of the container. One of `nil`, `:center`, `:flex_end`, `:flex_start`, `:space_around`, or `:space_between`."
|
|
1565
|
-
},
|
|
1566
|
-
{
|
|
1567
|
-
"name": "inline",
|
|
1568
|
-
"type": "Boolean",
|
|
1569
|
-
"default": "`false`",
|
|
1570
|
-
"description": "Defaults to false."
|
|
1571
|
-
},
|
|
1572
|
-
{
|
|
1573
|
-
"name": "flex_wrap",
|
|
1574
|
-
"type": "Boolean",
|
|
1575
|
-
"default": "`FLEX_WRAP_DEFAULT`",
|
|
1576
|
-
"description": "Defaults to nil."
|
|
1577
|
-
},
|
|
1578
|
-
{
|
|
1579
|
-
"name": "align_items",
|
|
1580
|
-
"type": "Symbol",
|
|
1581
|
-
"default": "`ALIGN_ITEMS_DEFAULT`",
|
|
1582
|
-
"description": "Use this param to align items on the cross axis. One of `nil`, `:baseline`, `:center`, `:end`, `:start`, or `:stretch`."
|
|
1583
|
-
},
|
|
1584
|
-
{
|
|
1585
|
-
"name": "direction",
|
|
1586
|
-
"type": "Symbol",
|
|
1587
|
-
"default": "`nil`",
|
|
1588
|
-
"description": "Use this param to define the orientation of the main axis (row or column). By default, flex items will display in a row. One of `nil`, `:column`, `:column_reverse`, `:row`, or `:row_reverse`."
|
|
1589
|
-
},
|
|
1590
|
-
{
|
|
1591
|
-
"name": "system_arguments",
|
|
1592
|
-
"type": "Hash",
|
|
1593
|
-
"default": "N/A",
|
|
1594
|
-
"description": "[System arguments](/system-arguments)"
|
|
1595
|
-
}
|
|
1596
|
-
]
|
|
1597
|
-
},
|
|
1598
|
-
{
|
|
1599
|
-
"component": "FlexItem",
|
|
1600
|
-
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/flex_item_component.rb",
|
|
1601
|
-
"parameters": [
|
|
1602
|
-
{
|
|
1603
|
-
"name": "flex_auto",
|
|
1604
|
-
"type": "Boolean",
|
|
1605
|
-
"default": "`false`",
|
|
1606
|
-
"description": "Fills available space and auto-sizes based on the content. Defaults to false"
|
|
1607
|
-
},
|
|
1608
|
-
{
|
|
1609
|
-
"name": "system_arguments",
|
|
1610
|
-
"type": "Hash",
|
|
1611
|
-
"default": "N/A",
|
|
1612
|
-
"description": "[System arguments](/system-arguments)"
|
|
1613
|
-
}
|
|
1614
|
-
]
|
|
1615
|
-
},
|
|
1616
1562
|
{
|
|
1617
1563
|
"component": "HellipButton",
|
|
1618
1564
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/hellip_button.rb",
|
package/static/audited_at.json
CHANGED
|
@@ -60,8 +60,6 @@
|
|
|
60
60
|
"Primer::Dropdown::Menu": "",
|
|
61
61
|
"Primer::Dropdown::Menu::Item": "",
|
|
62
62
|
"Primer::DropdownMenuComponent": "",
|
|
63
|
-
"Primer::FlexComponent": "",
|
|
64
|
-
"Primer::FlexItemComponent": "",
|
|
65
63
|
"Primer::HeadingComponent": "",
|
|
66
64
|
"Primer::HellipButton": "",
|
|
67
65
|
"Primer::HiddenTextExpander": "",
|
package/static/constants.json
CHANGED
|
@@ -671,66 +671,6 @@
|
|
|
671
671
|
"dark": "dropdown-menu-dark"
|
|
672
672
|
}
|
|
673
673
|
},
|
|
674
|
-
"Primer::FlexComponent": {
|
|
675
|
-
"ALIGN_ITEMS_DEFAULT": null,
|
|
676
|
-
"ALIGN_ITEMS_MAPPINGS": {
|
|
677
|
-
"start": "flex-items-start",
|
|
678
|
-
"end": "flex-items-end",
|
|
679
|
-
"center": "flex-items-center",
|
|
680
|
-
"baseline": "flex-items-baseline",
|
|
681
|
-
"stretch": "flex-items-stretch"
|
|
682
|
-
},
|
|
683
|
-
"ALIGN_ITEMS_OPTIONS": [
|
|
684
|
-
null,
|
|
685
|
-
"start",
|
|
686
|
-
"end",
|
|
687
|
-
"center",
|
|
688
|
-
"baseline",
|
|
689
|
-
"stretch"
|
|
690
|
-
],
|
|
691
|
-
"ALLOWED_DIRECTIONS": [
|
|
692
|
-
null,
|
|
693
|
-
"column",
|
|
694
|
-
"column_reverse",
|
|
695
|
-
"row",
|
|
696
|
-
"row_reverse"
|
|
697
|
-
],
|
|
698
|
-
"DEFAULT_DIRECTION": null,
|
|
699
|
-
"FLEX_WRAP_DEFAULT": null,
|
|
700
|
-
"FLEX_WRAP_OPTIONS": [
|
|
701
|
-
null,
|
|
702
|
-
true,
|
|
703
|
-
false
|
|
704
|
-
],
|
|
705
|
-
"INLINE_DEFAULT": false,
|
|
706
|
-
"INLINE_OPTIONS": [
|
|
707
|
-
false,
|
|
708
|
-
true
|
|
709
|
-
],
|
|
710
|
-
"JUSTIFY_CONTENT_DEFAULT": null,
|
|
711
|
-
"JUSTIFY_CONTENT_MAPPINGS": {
|
|
712
|
-
"flex_start": "flex-justify-start",
|
|
713
|
-
"flex_end": "flex-justify-end",
|
|
714
|
-
"center": "flex-justify-center",
|
|
715
|
-
"space_between": "flex-justify-between",
|
|
716
|
-
"space_around": "flex-justify-around"
|
|
717
|
-
},
|
|
718
|
-
"JUSTIFY_CONTENT_OPTIONS": [
|
|
719
|
-
null,
|
|
720
|
-
"flex_start",
|
|
721
|
-
"flex_end",
|
|
722
|
-
"center",
|
|
723
|
-
"space_between",
|
|
724
|
-
"space_around"
|
|
725
|
-
]
|
|
726
|
-
},
|
|
727
|
-
"Primer::FlexItemComponent": {
|
|
728
|
-
"FLEX_AUTO_ALLOWED_VALUES": [
|
|
729
|
-
false,
|
|
730
|
-
true
|
|
731
|
-
],
|
|
732
|
-
"FLEX_AUTO_DEFAULT": false
|
|
733
|
-
},
|
|
734
674
|
"Primer::HeadingComponent": {
|
|
735
675
|
},
|
|
736
676
|
"Primer::HellipButton": {
|
package/static/statuses.json
CHANGED
|
@@ -60,8 +60,6 @@
|
|
|
60
60
|
"Primer::Dropdown::Menu": "alpha",
|
|
61
61
|
"Primer::Dropdown::Menu::Item": "alpha",
|
|
62
62
|
"Primer::DropdownMenuComponent": "deprecated",
|
|
63
|
-
"Primer::FlexComponent": "deprecated",
|
|
64
|
-
"Primer::FlexItemComponent": "deprecated",
|
|
65
63
|
"Primer::HeadingComponent": "deprecated",
|
|
66
64
|
"Primer::HellipButton": "alpha",
|
|
67
65
|
"Primer::HiddenTextExpander": "deprecated",
|