@primer/view-components 0.21.0-rc.1cc3a887 → 0.21.0-rc.a6d33cb4
Sign up to get free protection for your applications and to get access to all the features.
- 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 +1 -1
- package/app/assets/styles/primer_view_components.css.map +1 -1
- package/app/components/primer/alpha/segmented_control.css +1 -1
- package/app/components/primer/alpha/tool_tip.js +46 -77
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
.SegmentedControl{--segmentedControl-item-padding:var(--control-small-paddingBlock,0.25rem);background-color:var(--controlTrack-bgColor-rest,var(--color-segmented-control-bg));border-radius:var(--borderRadius-medium,.375rem);display:inline-flex;list-style:none}.SegmentedControl--iconOnly .Button--iconOnly.Button--medium,.SegmentedControl--iconOnly .Button--iconOnly.Button--small{padding-inline:0!important;width:100%}.SegmentedControl--small{--segmentedControl-item-padding:var(--control-xsmall-paddingBlock,0.125rem)}.SegmentedControl--small .SegmentedControl-item{height:var(--control-small-size,1.75rem)}.SegmentedControl--small .SegmentedControl-item .Button{padding-inline:calc(var(--control-xsmall-paddingInline-normal,.5rem) - var(--segmentedControl-item-padding))}.SegmentedControl--small.SegmentedControl--iconOnly .SegmentedControl-item{width:var(--control-small-size,1.75rem)}.SegmentedControl--medium .SegmentedControl-item{height:var(--control-medium-size,2rem)}.SegmentedControl--medium.SegmentedControl--iconOnly .SegmentedControl-item{width:var(--control-medium-size,2rem)}.SegmentedControl-item{border:var(--borderWidth-thin,max(1px,.0625rem)) solid #0000;border-radius:var(--borderRadius-medium,.375rem);display:inline-flex;height:var(--control-medium-size,2rem);justify-content:center;padding:var(--segmentedControl-item-padding);position:relative}.SegmentedControl-item .Button--invisible:hover:not(:disabled){background-color:var(--controlTrack-bgColor-hover,var(--color-action-list-item-default-hover-bg))}.SegmentedControl-item .Button--invisible:active:not(:disabled){background-color:var(--controlTrack-bgColor-active,var(--color-action-list-item-default-active-bg))}.SegmentedControl-item.SegmentedControl-item--selected{background-color:var(--controlKnob-bgColor-rest,var(--color-segmented-control-button-bg));border-color:var(--controlKnob-borderColor-rest,var(--color-segmented-control-button-selected-border))}.SegmentedControl-item.SegmentedControl-item--selected .Button{font-weight:var(--base-text-weight-semibold,600)}.SegmentedControl-item.SegmentedControl-item--selected .Button:hover{background-color:initial}.SegmentedControl-item.SegmentedControl-item--selected:before{border-color:#0000!important}.SegmentedControl-item.SegmentedControl-item--selected+.SegmentedControl-item:before{border-color:#0000}.SegmentedControl-item .Button-label[data-content]:before{content:attr(data-content);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;visibility:hidden}.SegmentedControl-item:not(:first-child):before{border-left:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--borderColor-default,var(--color-border-default));content:"";inset:0 0 0 -1px;margin-bottom:var(--control-medium-paddingBlock,.375rem);margin-top:var(--control-medium-paddingBlock,.375rem);position:absolute}.SegmentedControl-item .Button{border:0;border-radius:calc(var(--borderRadius-medium,.375rem) - var(--segmentedControl-item-padding)/2);font-weight:var(--base-text-weight-normal,400);height:100%;padding-inline:calc(var(--control-medium-paddingInline-normal,.75rem) - var(--segmentedControl-item-padding));width:100%}.SegmentedControl-item .Button:focus-visible{border-radius:calc(var(--borderRadius-medium,.375rem) - var(--segmentedControl-item-padding)/1);outline-offset:calc(var(--segmentedControl-item-padding) - var(--borderWidth-thin,max(1px, .0625rem)))}.SegmentedControl-item .Button--invisible.Button--invisible-noVisuals .Button-label{color:var(--button-default-fgColor-rest,var(--color-btn-text))}.SegmentedControl--fullWidth{display:flex}.SegmentedControl--fullWidth .SegmentedControl-item{flex:1;justify-content:center}
|
1
|
+
.SegmentedControl{--segmentedControl-item-padding:var(--control-small-paddingBlock,0.25rem);--overlay-offset:0.5rem;background-color:var(--controlTrack-bgColor-rest,var(--color-segmented-control-bg));border-radius:var(--borderRadius-medium,.375rem);display:inline-flex;list-style:none}.SegmentedControl--iconOnly .Button--iconOnly.Button--medium,.SegmentedControl--iconOnly .Button--iconOnly.Button--small{padding-inline:0!important;width:100%}.SegmentedControl--small{--segmentedControl-item-padding:var(--control-xsmall-paddingBlock,0.125rem)}.SegmentedControl--small .SegmentedControl-item{height:var(--control-small-size,1.75rem)}.SegmentedControl--small .SegmentedControl-item .Button{padding-inline:calc(var(--control-xsmall-paddingInline-normal,.5rem) - var(--segmentedControl-item-padding))}.SegmentedControl--small.SegmentedControl--iconOnly .SegmentedControl-item{width:var(--control-small-size,1.75rem)}.SegmentedControl--medium .SegmentedControl-item{height:var(--control-medium-size,2rem)}.SegmentedControl--medium.SegmentedControl--iconOnly .SegmentedControl-item{width:var(--control-medium-size,2rem)}.SegmentedControl-item{border:var(--borderWidth-thin,max(1px,.0625rem)) solid #0000;border-radius:var(--borderRadius-medium,.375rem);display:inline-flex;height:var(--control-medium-size,2rem);justify-content:center;padding:var(--segmentedControl-item-padding);position:relative}.SegmentedControl-item .Button--invisible:hover:not(:disabled){background-color:var(--controlTrack-bgColor-hover,var(--color-action-list-item-default-hover-bg))}.SegmentedControl-item .Button--invisible:active:not(:disabled){background-color:var(--controlTrack-bgColor-active,var(--color-action-list-item-default-active-bg))}.SegmentedControl-item.SegmentedControl-item--selected{background-color:var(--controlKnob-bgColor-rest,var(--color-segmented-control-button-bg));border-color:var(--controlKnob-borderColor-rest,var(--color-segmented-control-button-selected-border))}.SegmentedControl-item.SegmentedControl-item--selected .Button{font-weight:var(--base-text-weight-semibold,600)}.SegmentedControl-item.SegmentedControl-item--selected .Button:hover{background-color:initial}.SegmentedControl-item.SegmentedControl-item--selected:before{border-color:#0000!important}.SegmentedControl-item.SegmentedControl-item--selected+.SegmentedControl-item:before{border-color:#0000}.SegmentedControl-item .Button-label[data-content]:before{content:attr(data-content);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;visibility:hidden}.SegmentedControl-item:not(:first-child):before{border-left:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--borderColor-default,var(--color-border-default));content:"";inset:0 0 0 -1px;margin-bottom:var(--control-medium-paddingBlock,.375rem);margin-top:var(--control-medium-paddingBlock,.375rem);position:absolute}.SegmentedControl-item .Button{border:0;border-radius:calc(var(--borderRadius-medium,.375rem) - var(--segmentedControl-item-padding)/2);font-weight:var(--base-text-weight-normal,400);height:100%;padding-inline:calc(var(--control-medium-paddingInline-normal,.75rem) - var(--segmentedControl-item-padding));width:100%}.SegmentedControl-item .Button:focus-visible{border-radius:calc(var(--borderRadius-medium,.375rem) - var(--segmentedControl-item-padding)/1);outline-offset:calc(var(--segmentedControl-item-padding) - var(--borderWidth-thin,max(1px, .0625rem)))}.SegmentedControl-item .Button--invisible.Button--invisible-noVisuals .Button-label{color:var(--button-default-fgColor-rest,var(--color-btn-text))}.SegmentedControl--fullWidth{display:flex}.SegmentedControl--fullWidth .SegmentedControl-item{flex:1;justify-content:center}
|
@@ -32,9 +32,7 @@ const isPopoverOpen = (() => {
|
|
32
32
|
}
|
33
33
|
return (el) => (selector ? el.matches(selector) : setSelector(el));
|
34
34
|
})();
|
35
|
-
const TOOLTIP_ARROW_EDGE_OFFSET = 6;
|
36
35
|
const TOOLTIP_SR_ONLY_CLASS = 'sr-only';
|
37
|
-
const TOOLTIP_OFFSET = 10;
|
38
36
|
const DIRECTION_CLASSES = [
|
39
37
|
'tooltip-n',
|
40
38
|
'tooltip-s',
|
@@ -84,6 +82,8 @@ class ToolTipElement extends HTMLElement {
|
|
84
82
|
styles() {
|
85
83
|
return `
|
86
84
|
:host {
|
85
|
+
--tooltip-top: var(--tool-tip-position-top, 0);
|
86
|
+
--tooltip-left: var(--tool-tip-position-left, 0);
|
87
87
|
padding: var(--overlay-paddingBlock-condensed) var(--overlay-padding-condensed) !important;
|
88
88
|
font: var(--text-body-shorthand-small);
|
89
89
|
color: var(--fgColor-onEmphasis, var(--color-fg-on-emphasis)) !important;
|
@@ -102,27 +102,29 @@ class ToolTipElement extends HTMLElement {
|
|
102
102
|
word-wrap: break-word;
|
103
103
|
white-space: normal;
|
104
104
|
width: max-content !important;
|
105
|
-
inset: var(--
|
105
|
+
inset: var(--tooltip-top) auto auto var(--tooltip-left) !important;
|
106
106
|
overflow: visible !important;
|
107
107
|
text-wrap: balance;
|
108
108
|
}
|
109
109
|
|
110
|
-
:host:
|
111
|
-
|
112
|
-
|
113
|
-
color: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus));
|
114
|
-
content: "";
|
115
|
-
border: 6px solid transparent;
|
116
|
-
opacity: 0;
|
110
|
+
:host(:is(.tooltip-n, .tooltip-nw, .tooltip-ne)) {
|
111
|
+
--tooltip-top: calc(var(--tool-tip-position-top, 0) - var(--overlay-offset, 0.25rem));
|
112
|
+
--tooltip-left: var(--tool-tip-position-left);
|
117
113
|
}
|
118
114
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
115
|
+
:host(:is(.tooltip-s, .tooltip-sw, .tooltip-se)) {
|
116
|
+
--tooltip-top: calc(var(--tool-tip-position-top, 0) + var(--overlay-offset, 0.25rem));
|
117
|
+
--tooltip-left: var(--tool-tip-position-left);
|
118
|
+
}
|
119
|
+
|
120
|
+
:host(.tooltip-w) {
|
121
|
+
--tooltip-top: var(--tool-tip-position-top);
|
122
|
+
--tooltip-left: calc(var(--tool-tip-position-left, 0) - var(--overlay-offset, 0.25rem));
|
123
|
+
}
|
124
|
+
|
125
|
+
:host(.tooltip-e) {
|
126
|
+
--tooltip-top: var(--tool-tip-position-top);
|
127
|
+
--tooltip-left: calc(var(--tool-tip-position-left, 0) + var(--overlay-offset, 0.25rem));
|
126
128
|
}
|
127
129
|
|
128
130
|
:host:after{
|
@@ -134,73 +136,40 @@ class ToolTipElement extends HTMLElement {
|
|
134
136
|
content: "";
|
135
137
|
}
|
136
138
|
|
137
|
-
:host(:popover-open),
|
138
|
-
:host(:popover-open):before {
|
139
|
-
animation-name: tooltip-appear;
|
140
|
-
animation-duration: .1s;
|
141
|
-
animation-fill-mode: forwards;
|
142
|
-
animation-timing-function: ease-in;
|
143
|
-
}
|
144
|
-
|
145
|
-
:host(.\\:popover-open),
|
146
|
-
:host(.\\:popover-open):before {
|
147
|
-
animation-name: tooltip-appear;
|
148
|
-
animation-duration: .1s;
|
149
|
-
animation-fill-mode: forwards;
|
150
|
-
animation-timing-function: ease-in;
|
151
|
-
animation-delay: .4s;
|
152
|
-
}
|
153
|
-
|
154
|
-
:host(.tooltip-s):before,
|
155
|
-
:host(.tooltip-n):before {
|
156
|
-
right: 50%;
|
157
|
-
margin-right: -${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
158
|
-
}
|
159
|
-
:host(.tooltip-s):before,
|
160
|
-
:host(.tooltip-se):before,
|
161
|
-
:host(.tooltip-sw):before {
|
162
|
-
bottom: 100%;
|
163
|
-
border-bottom-color: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus));
|
164
|
-
}
|
165
139
|
:host(.tooltip-s):after,
|
166
140
|
:host(.tooltip-se):after,
|
167
141
|
:host(.tooltip-sw):after {
|
168
142
|
bottom: 100%
|
169
143
|
}
|
170
|
-
|
171
|
-
:host(.tooltip-ne):before,
|
172
|
-
:host(.tooltip-nw):before {
|
173
|
-
top: 100%;
|
174
|
-
border-top-color: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus));
|
175
|
-
}
|
144
|
+
|
176
145
|
:host(.tooltip-n):after,
|
177
146
|
:host(.tooltip-ne):after,
|
178
147
|
:host(.tooltip-nw):after {
|
179
148
|
top: 100%;
|
180
149
|
}
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
margin-right: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
150
|
+
|
151
|
+
@keyframes tooltip-appear {
|
152
|
+
from {
|
153
|
+
opacity: 0;
|
154
|
+
}
|
155
|
+
to {
|
156
|
+
opacity: 1;
|
157
|
+
}
|
190
158
|
}
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
159
|
+
|
160
|
+
:host(:popover-open),
|
161
|
+
:host(:popover-open):before {
|
162
|
+
animation-name: tooltip-appear;
|
163
|
+
animation-duration: .1s;
|
164
|
+
animation-fill-mode: forwards;
|
165
|
+
animation-timing-function: ease-in;
|
197
166
|
}
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
167
|
+
|
168
|
+
:host(.\\:popover-open) {
|
169
|
+
animation-name: tooltip-appear;
|
170
|
+
animation-duration: .1s;
|
171
|
+
animation-fill-mode: forwards;
|
172
|
+
animation-timing-function: ease-in;
|
204
173
|
}
|
205
174
|
|
206
175
|
@media (forced-colors: active) {
|
@@ -390,7 +359,7 @@ _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new Wea
|
|
390
359
|
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
391
360
|
}
|
392
361
|
else if (direction === 'ne') {
|
393
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, '
|
362
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
394
363
|
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
395
364
|
}
|
396
365
|
else if (direction === 'e') {
|
@@ -398,7 +367,7 @@ _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new Wea
|
|
398
367
|
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-right', "f");
|
399
368
|
}
|
400
369
|
else if (direction === 'se') {
|
401
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, '
|
370
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
402
371
|
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
403
372
|
}
|
404
373
|
else if (direction === 's') {
|
@@ -406,7 +375,7 @@ _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new Wea
|
|
406
375
|
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
407
376
|
}
|
408
377
|
else if (direction === 'sw') {
|
409
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, '
|
378
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
410
379
|
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
411
380
|
}
|
412
381
|
else if (direction === 'w') {
|
@@ -414,7 +383,7 @@ _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new Wea
|
|
414
383
|
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-left', "f");
|
415
384
|
}
|
416
385
|
else if (direction === 'nw') {
|
417
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, '
|
386
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
418
387
|
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
419
388
|
}
|
420
389
|
}, _ToolTipElement_updatePosition = function _ToolTipElement_updatePosition() {
|
@@ -425,7 +394,7 @@ _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new Wea
|
|
425
394
|
const position = getAnchoredPosition(this, this.control, {
|
426
395
|
side: __classPrivateFieldGet(this, _ToolTipElement_side, "f"),
|
427
396
|
align: __classPrivateFieldGet(this, _ToolTipElement_align, "f"),
|
428
|
-
anchorOffset:
|
397
|
+
anchorOffset: 0,
|
429
398
|
});
|
430
399
|
const anchorSide = position.anchorSide;
|
431
400
|
const align = position.anchorAlign;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/view-components",
|
3
|
-
"version": "0.21.0-rc.
|
3
|
+
"version": "0.21.0-rc.a6d33cb4",
|
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",
|