primer_view_components 0.0.110 → 0.0.112
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +1 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list/item.rb +2 -2
- data/app/components/primer/alpha/auto_complete.css +1 -0
- data/app/components/primer/alpha/auto_complete.css.json +1 -0
- data/app/components/primer/alpha/auto_complete.css.map +1 -0
- data/app/components/primer/alpha/auto_complete.pcss +118 -0
- data/app/components/primer/alpha/banner.css +1 -1
- data/app/components/primer/alpha/banner.css.map +1 -1
- data/app/components/primer/alpha/banner.pcss +2 -3
- data/app/components/primer/alpha/button_marketing.css +1 -0
- data/app/components/primer/alpha/button_marketing.css.json +1 -0
- data/app/components/primer/alpha/button_marketing.css.map +1 -0
- data/app/components/primer/alpha/button_marketing.pcss +175 -0
- data/app/components/primer/{dropdown → alpha/dropdown}/menu.d.ts +0 -0
- data/app/components/primer/{dropdown → alpha/dropdown}/menu.html.erb +0 -0
- data/app/components/primer/{dropdown → alpha/dropdown}/menu.js +0 -0
- data/app/components/primer/alpha/dropdown/menu.rb +105 -0
- data/app/components/primer/{dropdown → alpha/dropdown}/menu.ts +0 -0
- data/app/components/primer/alpha/dropdown.css +1 -0
- data/app/components/primer/alpha/dropdown.css.json +1 -0
- data/app/components/primer/alpha/dropdown.css.map +1 -0
- data/app/components/primer/{dropdown.d.ts → alpha/dropdown.d.ts} +0 -0
- data/app/components/primer/{dropdown.html.erb → alpha/dropdown.html.erb} +0 -0
- data/app/components/primer/{dropdown.js → alpha/dropdown.js} +0 -0
- data/app/components/primer/alpha/dropdown.pcss +260 -0
- data/app/components/primer/alpha/dropdown.rb +154 -0
- data/app/components/primer/{dropdown.ts → alpha/dropdown.ts} +0 -0
- data/app/components/primer/alpha/tab_nav.css +1 -0
- data/app/components/primer/alpha/tab_nav.css.json +1 -0
- data/app/components/primer/alpha/tab_nav.css.map +1 -0
- data/app/components/primer/alpha/tab_nav.pcss +100 -0
- data/app/components/primer/alpha/underline_nav.css +1 -0
- data/app/components/primer/alpha/underline_nav.css.json +1 -0
- data/app/components/primer/alpha/underline_nav.css.map +1 -0
- data/app/components/primer/alpha/underline_nav.pcss +133 -0
- data/app/components/primer/alpha/x_banner.d.ts +2 -1
- data/app/components/primer/alpha/x_banner.js +0 -1
- data/app/components/primer/alpha/x_banner.ts +1 -1
- data/app/components/primer/beta/avatar.css +1 -0
- data/app/components/primer/beta/avatar.css.json +1 -0
- data/app/components/primer/beta/avatar.css.map +1 -0
- data/app/components/primer/beta/avatar.pcss +73 -0
- data/app/components/primer/beta/avatar_stack.css +1 -0
- data/app/components/primer/beta/avatar_stack.css.json +1 -0
- data/app/components/primer/beta/avatar_stack.css.map +1 -0
- data/app/components/primer/beta/avatar_stack.pcss +141 -0
- data/app/components/primer/beta/border_box.css +1 -0
- data/app/components/primer/beta/border_box.css.json +1 -0
- data/app/components/primer/beta/border_box.css.map +1 -0
- data/app/components/primer/beta/border_box.pcss +284 -0
- data/app/components/primer/beta/button.rb +1 -1
- data/app/components/primer/beta/flash.css +1 -0
- data/app/components/primer/beta/flash.css.json +1 -0
- data/app/components/primer/beta/flash.css.map +1 -0
- data/app/components/primer/beta/flash.pcss +143 -0
- data/app/components/primer/beta/link.css +1 -0
- data/app/components/primer/beta/link.css.json +1 -0
- data/app/components/primer/beta/link.css.map +1 -0
- data/app/components/primer/beta/link.pcss +60 -0
- data/app/components/primer/beta/popover.css +1 -0
- data/app/components/primer/beta/popover.css.json +1 -0
- data/app/components/primer/beta/popover.css.map +1 -0
- data/app/components/primer/{popover_component.html.erb → beta/popover.html.erb} +0 -0
- data/app/components/primer/beta/popover.pcss +225 -0
- data/app/components/primer/beta/popover.rb +127 -0
- data/app/components/primer/component.rb +2 -2
- data/app/components/primer/dropdown/menu.rb +5 -90
- data/app/components/primer/dropdown.rb +2 -145
- data/app/components/primer/menu_component.css +1 -0
- data/app/components/primer/menu_component.css.json +1 -0
- data/app/components/primer/menu_component.css.map +1 -0
- data/app/components/primer/menu_component.pcss +119 -0
- data/app/components/primer/popover_component.rb +3 -120
- data/app/components/primer/primer.d.ts +1 -1
- data/app/components/primer/primer.js +1 -1
- data/app/components/primer/primer.pcss +14 -1
- data/app/components/primer/primer.ts +1 -1
- data/app/components/primer/timeline_item_component.css +1 -0
- data/app/components/primer/timeline_item_component.css.json +1 -0
- data/app/components/primer/timeline_item_component.css.map +1 -0
- data/app/components/primer/timeline_item_component.pcss +93 -0
- data/lib/primer/deprecations.rb +4 -3
- data/lib/primer/view_components/linters/deprecated_components_counter.rb +15 -4
- data/lib/primer/view_components/linters/severity_schema.rb +14 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/tasks/docs.rake +3 -3
- data/previews/primer/alpha/banner_preview.rb +1 -1
- data/previews/primer/alpha/button_marketing_preview.rb +36 -0
- data/previews/primer/alpha/dropdown_preview.rb +210 -0
- data/previews/primer/alpha/tab_nav_preview.rb +55 -0
- data/previews/primer/beta/avatar_preview.rb +61 -5
- data/previews/primer/beta/avatar_stack_preview.rb +54 -12
- data/previews/primer/beta/blankslate_preview.rb +29 -5
- data/previews/primer/beta/border_box_preview.rb +65 -13
- data/previews/primer/beta/flash_preview.rb +45 -8
- data/previews/primer/beta/label_preview.rb +86 -8
- data/previews/primer/beta/link_preview.rb +28 -0
- data/previews/primer/beta/popover_preview.rb +79 -0
- data/static/arguments.json +40 -40
- data/static/audited_at.json +4 -3
- data/static/constants.json +56 -52
- data/static/statuses.json +8 -7
- metadata +70 -16
- data/app/components/primer/counter_component.rb +0 -7
- data/app/components/primer/image.rb +0 -7
- data/app/components/primer/progress_bar_component.rb +0 -7
- data/previews/primer/dropdown_preview.rb +0 -57
- data/previews/primer/popover_component_preview.rb +0 -34
@@ -0,0 +1,60 @@
|
|
1
|
+
/* Links */
|
2
|
+
|
3
|
+
.Link {
|
4
|
+
color: var(--color-accent-fg);
|
5
|
+
|
6
|
+
&:hover {
|
7
|
+
text-decoration: underline;
|
8
|
+
cursor: pointer;
|
9
|
+
}
|
10
|
+
|
11
|
+
&:focus,
|
12
|
+
&:focus-visible {
|
13
|
+
outline-offset: 0;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
.Link--primary {
|
18
|
+
color: var(--color-fg-default) !important;
|
19
|
+
|
20
|
+
&:hover {
|
21
|
+
color: var(--color-accent-fg) !important;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
.Link--secondary {
|
26
|
+
color: var(--color-fg-muted) !important;
|
27
|
+
|
28
|
+
&:hover {
|
29
|
+
color: var(--color-accent-fg) !important;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
.Link--muted {
|
34
|
+
color: var(--color-fg-muted) !important;
|
35
|
+
|
36
|
+
&:hover {
|
37
|
+
color: var(--color-accent-fg) !important;
|
38
|
+
text-decoration: none;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
/* Set the link color only on hover
|
43
|
+
Useful when you want only part of a link to turn blue on hover */
|
44
|
+
.Link--onHover {
|
45
|
+
&:hover {
|
46
|
+
color: var(--color-accent-fg) !important;
|
47
|
+
text-decoration: underline;
|
48
|
+
cursor: pointer;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
/* When using a color utility class inside of a link class
|
53
|
+
color should change with link on hover. */
|
54
|
+
.Link--secondary,
|
55
|
+
.Link--primary,
|
56
|
+
.Link--muted {
|
57
|
+
&:hover [class*='color-fg'] {
|
58
|
+
color: inherit !important;
|
59
|
+
}
|
60
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
.Popover{position:absolute;z-index:100}.Popover-message{background-color:var(--color-canvas-overlay);border:var(--primer-borderWidth-thin,1px) solid var(--color-border-default);border-radius:var(--primer-borderRadius-medium,6px);margin-left:auto;margin-right:auto;position:relative;width:232px}.Popover-message:after,.Popover-message:before{content:"";display:inline-block;left:50%;position:absolute}.Popover-message:before{border:8px solid #0000;border-bottom:8px solid var(--color-border-default);margin-left:-9px;top:-16px}.Popover-message:after{border:7px solid #0000;border-bottom:7px solid var(--color-canvas-overlay);margin-left:-8px;top:-14px}.Popover-message--no-caret:after,.Popover-message--no-caret:before{display:none}.Popover-message--bottom-left:after,.Popover-message--bottom-left:before,.Popover-message--bottom-right:after,.Popover-message--bottom-right:before,.Popover-message--bottom:after,.Popover-message--bottom:before{border-bottom-color:#0000;top:auto}.Popover-message--bottom-left:before,.Popover-message--bottom-right:before,.Popover-message--bottom:before{border-top-color:var(--color-border-default);bottom:-16px}.Popover-message--bottom-left:after,.Popover-message--bottom-right:after,.Popover-message--bottom:after{border-top-color:var(--color-canvas-overlay);bottom:-14px}.Popover-message--bottom-right,.Popover-message--top-right{margin-right:0;right:-9px}.Popover-message--bottom-right:after,.Popover-message--bottom-right:before,.Popover-message--top-right:after,.Popover-message--top-right:before{left:auto;margin-left:0}.Popover-message--bottom-right:before,.Popover-message--top-right:before{right:20px}.Popover-message--bottom-right:after,.Popover-message--top-right:after{right:21px}.Popover-message--bottom-left,.Popover-message--top-left{left:-9px;margin-left:0}.Popover-message--bottom-left:after,.Popover-message--bottom-left:before,.Popover-message--top-left:after,.Popover-message--top-left:before{left:24px;margin-left:0}.Popover-message--bottom-left:after,.Popover-message--top-left:after{left:25px}.Popover-message--left-bottom:after,.Popover-message--left-bottom:before,.Popover-message--left-top:after,.Popover-message--left-top:before,.Popover-message--left:after,.Popover-message--left:before,.Popover-message--right-bottom:after,.Popover-message--right-bottom:before,.Popover-message--right-top:after,.Popover-message--right-top:before,.Popover-message--right:after,.Popover-message--right:before{border-bottom-color:#0000;left:auto;margin-left:0;top:50%}.Popover-message--left-bottom:before,.Popover-message--left-top:before,.Popover-message--left:before,.Popover-message--right-bottom:before,.Popover-message--right-top:before,.Popover-message--right:before{margin-top:-9px}.Popover-message--left-bottom:after,.Popover-message--left-top:after,.Popover-message--left:after,.Popover-message--right-bottom:after,.Popover-message--right-top:after,.Popover-message--right:after{margin-top:-8px}.Popover-message--right-bottom:before,.Popover-message--right-top:before,.Popover-message--right:before{border-left-color:var(--color-border-default);right:-16px}.Popover-message--right-bottom:after,.Popover-message--right-top:after,.Popover-message--right:after{border-left-color:var(--color-canvas-overlay);right:-14px}.Popover-message--left-bottom:before,.Popover-message--left-top:before,.Popover-message--left:before{border-right-color:var(--color-border-default);left:-16px}.Popover-message--left-bottom:after,.Popover-message--left-top:after,.Popover-message--left:after{border-right-color:var(--color-canvas-overlay);left:-14px}.Popover-message--left-top:after,.Popover-message--left-top:before,.Popover-message--right-top:after,.Popover-message--right-top:before{top:24px}.Popover-message--left-bottom:after,.Popover-message--left-bottom:before,.Popover-message--right-bottom:after,.Popover-message--right-bottom:before{top:auto}.Popover-message--left-bottom:before,.Popover-message--right-bottom:before{bottom:16px}.Popover-message--left-bottom:after,.Popover-message--right-bottom:after{bottom:17px}@media (min-width:544px){.Popover-message--large{min-width:320px}}@media (max-width:767.98px){.Popover{bottom:0!important;left:0!important;position:fixed;right:0!important;top:auto!important}.Popover-message{bottom:auto;left:auto;margin:var(--primer-stack-gap-condensed,8px);right:auto;top:auto;width:auto!important}.Popover-message>.btn-octicon{padding:var(--primer-control-medium-paddingInline-normal,12px)!important}.Popover-message:after,.Popover-message:before{display:none}}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"beta/popover","selectors":[".Popover",".Popover-message",".Popover-message:after",".Popover-message:before",".Popover-message--no-caret:after",".Popover-message--no-caret:before",".Popover-message--bottom-left:after",".Popover-message--bottom-left:before",".Popover-message--bottom-right:after",".Popover-message--bottom-right:before",".Popover-message--bottom:after",".Popover-message--bottom:before",".Popover-message--bottom-right",".Popover-message--top-right",".Popover-message--top-right:after",".Popover-message--top-right:before",".Popover-message--bottom-left",".Popover-message--top-left",".Popover-message--top-left:after",".Popover-message--top-left:before",".Popover-message--left-bottom:after",".Popover-message--left-bottom:before",".Popover-message--left-top:after",".Popover-message--left-top:before",".Popover-message--left:after",".Popover-message--left:before",".Popover-message--right-bottom:after",".Popover-message--right-bottom:before",".Popover-message--right-top:after",".Popover-message--right-top:before",".Popover-message--right:after",".Popover-message--right:before",".Popover-message--large",".Popover-message>.btn-octicon"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["popover.pcss"],"names":[],"mappings":"AAEA,SACE,iBAAkB,CAClB,WACF,CAEA,iBAKE,4CAA6C,CAC7C,2EAA6E,CAC7E,mDAAqD,CAHrD,gBAAiB,CADjB,iBAAkB,CAFlB,iBAAkB,CAClB,WA6BF,CArBE,+CAKE,UAAW,CADX,oBAAqB,CADrB,QAAS,CADT,iBAIF,CAEA,wBAIE,sBAAgD,CAAhD,mDAAgD,CAFhD,gBAAiB,CADjB,SAIF,CAEA,uBAIE,sBAAgD,CAAhD,mDAAgD,CAFhD,gBAAiB,CADjB,SAIF,CAKA,mEAEE,YACF,CAOA,mNAGE,yBAAgC,CADhC,QAEF,CAEA,2GAEE,4CAA6C,CAD7C,YAEF,CAEA,wGAEE,4CAA6C,CAD7C,YAEF,CAIF,2DAGE,cAAe,CADf,UAgBF,CAbE,gJAEE,SAAU,CACV,aACF,CAEA,yEACE,UACF,CAEA,uEACE,UACF,CAIF,yDAEE,SAAU,CACV,aAWF,CATE,4IAEE,SAAU,CACV,aACF,CAEA,qEACE,SACF,CAUA,oZAKE,yBAAgC,CAFhC,SAAU,CACV,aAAc,CAFd,OAIF,CAEA,6MACE,eACF,CAEA,uMACE,eACF,CAOA,wGAEE,6CAA8C,CAD9C,WAEF,CAEA,qGAEE,6CAA8C,CAD9C,WAEF,CAOA,qGAEE,8CAA+C,CAD/C,UAEF,CAEA,kGAEE,8CAA+C,CAD/C,UAEF,CAMA,wIAEE,QACF,CAMA,oJAEE,QACF,CAEA,2EACE,WACF,CAEA,yEACE,WACF,CAGF,yBACE,wBACE,eACF,CACF,CAKA,4BACE,SAIE,kBAAoB,CACpB,gBAAkB,CAJlB,cAAe,CAEf,iBAAmB,CADnB,kBAIF,CAEA,iBAGE,WAAY,CACZ,SAAU,CAEV,4CAA8C,CAJ9C,UAAW,CADX,QAAS,CAIT,oBAEF,CAGA,8BACE,wEACF,CAGA,+CAEE,YACF,CACF","file":"popover.css","sourcesContent":["/* Popover */\n\n.Popover {\n position: absolute;\n z-index: 100;\n}\n\n.Popover-message {\n position: relative;\n width: 232px;\n margin-right: auto;\n margin-left: auto;\n background-color: var(--color-canvas-overlay);\n border: var(--primer-borderWidth-thin, 1px) solid var(--color-border-default);\n border-radius: var(--primer-borderRadius-medium, 6px);\n\n /* Carets */\n &::before,\n &::after {\n position: absolute;\n left: 50%;\n display: inline-block;\n content: '';\n }\n\n &::before {\n top: -16px;\n margin-left: -9px;\n border: 8px solid transparent;\n border-bottom-color: var(--color-border-default);\n }\n\n &::after {\n top: -14px;\n margin-left: -8px;\n border: 7px solid transparent;\n border-bottom-color: var(--color-canvas-overlay);\n }\n}\n\n/* No caret */\n.Popover-message--no-caret {\n &::before,\n &::after {\n display: none;\n }\n}\n\n/* Bottom-oriented carets */\n.Popover-message--bottom,\n.Popover-message--bottom-right,\n.Popover-message--bottom-left {\n &::before,\n &::after {\n top: auto;\n border-bottom-color: transparent;\n }\n\n &::before {\n bottom: -16px;\n border-top-color: var(--color-border-default);\n }\n\n &::after {\n bottom: -14px;\n border-top-color: var(--color-canvas-overlay);\n }\n}\n\n/* Top & Bottom: Right-oriented carets */\n.Popover-message--top-right,\n.Popover-message--bottom-right {\n right: -9px;\n margin-right: 0;\n\n &::before,\n &::after {\n left: auto;\n margin-left: 0;\n }\n\n &::before {\n right: 20px;\n }\n\n &::after {\n right: 21px;\n }\n}\n\n/* Top & Bottom: Left-oriented carets */\n.Popover-message--top-left,\n.Popover-message--bottom-left {\n left: -9px;\n margin-left: 0;\n\n &::before,\n &::after {\n left: 24px;\n margin-left: 0;\n }\n\n &::after {\n left: 25px;\n }\n}\n\n/* Right- & Left-oriented carets */\n.Popover-message--right,\n.Popover-message--right-top,\n.Popover-message--right-bottom,\n.Popover-message--left,\n.Popover-message--left-top,\n.Popover-message--left-bottom {\n &::before,\n &::after {\n top: 50%;\n left: auto;\n margin-left: 0;\n border-bottom-color: transparent;\n }\n\n &::before {\n margin-top: -9px;\n }\n\n &::after {\n margin-top: -8px;\n }\n}\n\n/* Right-oriented carets */\n.Popover-message--right,\n.Popover-message--right-top,\n.Popover-message--right-bottom {\n &::before {\n right: -16px;\n border-left-color: var(--color-border-default);\n }\n\n &::after {\n right: -14px;\n border-left-color: var(--color-canvas-overlay);\n }\n}\n\n/* Left-oriented carets */\n.Popover-message--left,\n.Popover-message--left-top,\n.Popover-message--left-bottom {\n &::before {\n left: -16px;\n border-right-color: var(--color-border-default);\n }\n\n &::after {\n left: -14px;\n border-right-color: var(--color-canvas-overlay);\n }\n}\n\n/* Right & Left: Top-oriented carets */\n.Popover-message--right-top,\n.Popover-message--left-top {\n &::before,\n &::after {\n top: 24px;\n }\n}\n\n/* Right & Left: Bottom-oriented carets */\n.Popover-message--right-bottom,\n.Popover-message--left-bottom {\n &::before,\n &::after {\n top: auto;\n }\n\n &::before {\n bottom: 16px;\n }\n\n &::after {\n bottom: 17px;\n }\n}\n\n@media (min-width: 544px) {\n .Popover-message--large {\n min-width: 320px;\n }\n}\n\n/* Responsive Popover\n** For < md it will show full-width anchored to the bottom */\n\n@media (max-width: 767.98px) {\n .Popover {\n position: fixed;\n top: auto !important;\n right: 0 !important;\n bottom: 0 !important;\n left: 0 !important;\n }\n\n .Popover-message {\n top: auto;\n right: auto;\n bottom: auto;\n left: auto;\n width: auto !important;\n margin: var(--primer-stack-gap-condensed, 8px);\n }\n\n /* Increase tap area for touch input */\n .Popover-message > .btn-octicon {\n padding: var(--primer-control-medium-paddingInline-normal, 12px) !important;\n }\n\n /* Remove caret */\n .Popover-message::after,\n .Popover-message::before {\n display: none;\n }\n}\n"]}
|
File without changes
|
@@ -0,0 +1,225 @@
|
|
1
|
+
/* Popover */
|
2
|
+
|
3
|
+
.Popover {
|
4
|
+
position: absolute;
|
5
|
+
z-index: 100;
|
6
|
+
}
|
7
|
+
|
8
|
+
.Popover-message {
|
9
|
+
position: relative;
|
10
|
+
width: 232px;
|
11
|
+
margin-right: auto;
|
12
|
+
margin-left: auto;
|
13
|
+
background-color: var(--color-canvas-overlay);
|
14
|
+
border: var(--primer-borderWidth-thin, 1px) solid var(--color-border-default);
|
15
|
+
border-radius: var(--primer-borderRadius-medium, 6px);
|
16
|
+
|
17
|
+
/* Carets */
|
18
|
+
&::before,
|
19
|
+
&::after {
|
20
|
+
position: absolute;
|
21
|
+
left: 50%;
|
22
|
+
display: inline-block;
|
23
|
+
content: '';
|
24
|
+
}
|
25
|
+
|
26
|
+
&::before {
|
27
|
+
top: -16px;
|
28
|
+
margin-left: -9px;
|
29
|
+
border: 8px solid transparent;
|
30
|
+
border-bottom-color: var(--color-border-default);
|
31
|
+
}
|
32
|
+
|
33
|
+
&::after {
|
34
|
+
top: -14px;
|
35
|
+
margin-left: -8px;
|
36
|
+
border: 7px solid transparent;
|
37
|
+
border-bottom-color: var(--color-canvas-overlay);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
/* No caret */
|
42
|
+
.Popover-message--no-caret {
|
43
|
+
&::before,
|
44
|
+
&::after {
|
45
|
+
display: none;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
/* Bottom-oriented carets */
|
50
|
+
.Popover-message--bottom,
|
51
|
+
.Popover-message--bottom-right,
|
52
|
+
.Popover-message--bottom-left {
|
53
|
+
&::before,
|
54
|
+
&::after {
|
55
|
+
top: auto;
|
56
|
+
border-bottom-color: transparent;
|
57
|
+
}
|
58
|
+
|
59
|
+
&::before {
|
60
|
+
bottom: -16px;
|
61
|
+
border-top-color: var(--color-border-default);
|
62
|
+
}
|
63
|
+
|
64
|
+
&::after {
|
65
|
+
bottom: -14px;
|
66
|
+
border-top-color: var(--color-canvas-overlay);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
/* Top & Bottom: Right-oriented carets */
|
71
|
+
.Popover-message--top-right,
|
72
|
+
.Popover-message--bottom-right {
|
73
|
+
right: -9px;
|
74
|
+
margin-right: 0;
|
75
|
+
|
76
|
+
&::before,
|
77
|
+
&::after {
|
78
|
+
left: auto;
|
79
|
+
margin-left: 0;
|
80
|
+
}
|
81
|
+
|
82
|
+
&::before {
|
83
|
+
right: 20px;
|
84
|
+
}
|
85
|
+
|
86
|
+
&::after {
|
87
|
+
right: 21px;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
/* Top & Bottom: Left-oriented carets */
|
92
|
+
.Popover-message--top-left,
|
93
|
+
.Popover-message--bottom-left {
|
94
|
+
left: -9px;
|
95
|
+
margin-left: 0;
|
96
|
+
|
97
|
+
&::before,
|
98
|
+
&::after {
|
99
|
+
left: 24px;
|
100
|
+
margin-left: 0;
|
101
|
+
}
|
102
|
+
|
103
|
+
&::after {
|
104
|
+
left: 25px;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
/* Right- & Left-oriented carets */
|
109
|
+
.Popover-message--right,
|
110
|
+
.Popover-message--right-top,
|
111
|
+
.Popover-message--right-bottom,
|
112
|
+
.Popover-message--left,
|
113
|
+
.Popover-message--left-top,
|
114
|
+
.Popover-message--left-bottom {
|
115
|
+
&::before,
|
116
|
+
&::after {
|
117
|
+
top: 50%;
|
118
|
+
left: auto;
|
119
|
+
margin-left: 0;
|
120
|
+
border-bottom-color: transparent;
|
121
|
+
}
|
122
|
+
|
123
|
+
&::before {
|
124
|
+
margin-top: -9px;
|
125
|
+
}
|
126
|
+
|
127
|
+
&::after {
|
128
|
+
margin-top: -8px;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
/* Right-oriented carets */
|
133
|
+
.Popover-message--right,
|
134
|
+
.Popover-message--right-top,
|
135
|
+
.Popover-message--right-bottom {
|
136
|
+
&::before {
|
137
|
+
right: -16px;
|
138
|
+
border-left-color: var(--color-border-default);
|
139
|
+
}
|
140
|
+
|
141
|
+
&::after {
|
142
|
+
right: -14px;
|
143
|
+
border-left-color: var(--color-canvas-overlay);
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
/* Left-oriented carets */
|
148
|
+
.Popover-message--left,
|
149
|
+
.Popover-message--left-top,
|
150
|
+
.Popover-message--left-bottom {
|
151
|
+
&::before {
|
152
|
+
left: -16px;
|
153
|
+
border-right-color: var(--color-border-default);
|
154
|
+
}
|
155
|
+
|
156
|
+
&::after {
|
157
|
+
left: -14px;
|
158
|
+
border-right-color: var(--color-canvas-overlay);
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
/* Right & Left: Top-oriented carets */
|
163
|
+
.Popover-message--right-top,
|
164
|
+
.Popover-message--left-top {
|
165
|
+
&::before,
|
166
|
+
&::after {
|
167
|
+
top: 24px;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
/* Right & Left: Bottom-oriented carets */
|
172
|
+
.Popover-message--right-bottom,
|
173
|
+
.Popover-message--left-bottom {
|
174
|
+
&::before,
|
175
|
+
&::after {
|
176
|
+
top: auto;
|
177
|
+
}
|
178
|
+
|
179
|
+
&::before {
|
180
|
+
bottom: 16px;
|
181
|
+
}
|
182
|
+
|
183
|
+
&::after {
|
184
|
+
bottom: 17px;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
@media (min-width: 544px) {
|
189
|
+
.Popover-message--large {
|
190
|
+
min-width: 320px;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
/* Responsive Popover
|
195
|
+
** For < md it will show full-width anchored to the bottom */
|
196
|
+
|
197
|
+
@media (max-width: 767.98px) {
|
198
|
+
.Popover {
|
199
|
+
position: fixed;
|
200
|
+
top: auto !important;
|
201
|
+
right: 0 !important;
|
202
|
+
bottom: 0 !important;
|
203
|
+
left: 0 !important;
|
204
|
+
}
|
205
|
+
|
206
|
+
.Popover-message {
|
207
|
+
top: auto;
|
208
|
+
right: auto;
|
209
|
+
bottom: auto;
|
210
|
+
left: auto;
|
211
|
+
width: auto !important;
|
212
|
+
margin: var(--primer-stack-gap-condensed, 8px);
|
213
|
+
}
|
214
|
+
|
215
|
+
/* Increase tap area for touch input */
|
216
|
+
.Popover-message > .btn-octicon {
|
217
|
+
padding: var(--primer-control-medium-paddingInline-normal, 12px) !important;
|
218
|
+
}
|
219
|
+
|
220
|
+
/* Remove caret */
|
221
|
+
.Popover-message::after,
|
222
|
+
.Popover-message::before {
|
223
|
+
display: none;
|
224
|
+
}
|
225
|
+
}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Beta
|
5
|
+
# Use `Popover` to bring attention to specific user interface elements, typically to suggest an action or to guide users through a new experience.
|
6
|
+
#
|
7
|
+
# By default, the popover renders with absolute positioning, meaning it should usually be wrapped in an element with a relative position in order to be positioned properly. To render the popover with relative positioning, use the relative property.
|
8
|
+
class Popover < Primer::Component
|
9
|
+
status :beta
|
10
|
+
|
11
|
+
CARET_DEFAULT = :top
|
12
|
+
CARET_MAPPINGS = {
|
13
|
+
CARET_DEFAULT => "",
|
14
|
+
:bottom => "Popover-message--bottom",
|
15
|
+
:bottom_right => "Popover-message--bottom-right",
|
16
|
+
:bottom_left => "Popover-message--bottom-left",
|
17
|
+
:left => "Popover-message--left",
|
18
|
+
:left_bottom => "Popover-message--left-bottom",
|
19
|
+
:left_top => "Popover-message--left-top",
|
20
|
+
:right => "Popover-message--right",
|
21
|
+
:right_bottom => "Popover-message--right-bottom",
|
22
|
+
:right_top => "Popover-message--right-top",
|
23
|
+
:top_left => "Popover-message--top-left",
|
24
|
+
:top_right => "Popover-message--top-right"
|
25
|
+
}.freeze
|
26
|
+
|
27
|
+
DEFAULT_HEADING_TAG = :h4
|
28
|
+
|
29
|
+
# The heading
|
30
|
+
#
|
31
|
+
# @param tag [Symbol] (Primer::Beta::Popover::DEFAULT_HEADING_TAG) <%= one_of(Primer::Beta::Heading::TAG_OPTIONS) %>
|
32
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
33
|
+
renders_one :heading, lambda { |tag: DEFAULT_HEADING_TAG, **system_arguments|
|
34
|
+
system_arguments[:tag] = tag
|
35
|
+
system_arguments[:mb] ||= 2
|
36
|
+
|
37
|
+
Primer::Beta::Heading.new(**system_arguments)
|
38
|
+
}
|
39
|
+
|
40
|
+
# The body
|
41
|
+
#
|
42
|
+
# @param caret [Symbol] <%= one_of(Primer::Beta::Popover::CARET_MAPPINGS.keys) %>
|
43
|
+
# @param large [Boolean] Whether to use the large version of the component.
|
44
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
45
|
+
renders_one :body, lambda { |caret: CARET_DEFAULT, large: false, **system_arguments|
|
46
|
+
@body_arguments = system_arguments
|
47
|
+
@body_arguments[:classes] = class_names(
|
48
|
+
@body_arguments[:classes],
|
49
|
+
"Popover-message Box",
|
50
|
+
CARET_MAPPINGS[fetch_or_fallback(CARET_MAPPINGS.keys, caret, CARET_DEFAULT)],
|
51
|
+
"Popover-message--large" => large
|
52
|
+
)
|
53
|
+
@body_arguments[:p] ||= 4
|
54
|
+
@body_arguments[:mt] ||= 2
|
55
|
+
@body_arguments[:mx] ||= :auto
|
56
|
+
@body_arguments[:text_align] ||= :left
|
57
|
+
@body_arguments[:box_shadow] ||= :large
|
58
|
+
|
59
|
+
Primer::Content.new
|
60
|
+
}
|
61
|
+
|
62
|
+
# @example Default
|
63
|
+
# <%= render Primer::Beta::Popover.new do |component| %>
|
64
|
+
# <% component.with_heading do %>
|
65
|
+
# Activity feed
|
66
|
+
# <% end %>
|
67
|
+
# <% component.with_body do %>
|
68
|
+
# This is the Popover body.
|
69
|
+
# <% end %>
|
70
|
+
# <% end %>
|
71
|
+
#
|
72
|
+
# @example Large
|
73
|
+
# <%= render Primer::Beta::Popover.new do |component| %>
|
74
|
+
# <% component.with_heading do %>
|
75
|
+
# Activity feed
|
76
|
+
# <% end %>
|
77
|
+
# <% component.with_body(large: true) do %>
|
78
|
+
# This is the large Popover body.
|
79
|
+
# <% end %>
|
80
|
+
# <% end %>
|
81
|
+
#
|
82
|
+
# @example Caret position
|
83
|
+
# <%= render Primer::Beta::Popover.new do |component| %>
|
84
|
+
# <% component.with_heading do %>
|
85
|
+
# Activity feed
|
86
|
+
# <% end %>
|
87
|
+
# <% component.with_body(caret: :left) do %>
|
88
|
+
# This is the Popover body.
|
89
|
+
# <% end %>
|
90
|
+
# <% end %>
|
91
|
+
#
|
92
|
+
# @example With multiple elements in the body
|
93
|
+
# <%= render Primer::Beta::Popover.new do |component| %>
|
94
|
+
# <% component.with_heading do %>
|
95
|
+
# Activity feed
|
96
|
+
# <% end %>
|
97
|
+
# <% component.with_body(caret: :left) do %>
|
98
|
+
# <p>This is the Popover body.</p>
|
99
|
+
# <%= render Primer::ButtonComponent.new(type: :submit) do %>
|
100
|
+
# Got it!
|
101
|
+
# <% end %>
|
102
|
+
# <% end %>
|
103
|
+
# <% end %>
|
104
|
+
#
|
105
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
106
|
+
def initialize(**system_arguments)
|
107
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
108
|
+
@system_arguments[:tag] = :div
|
109
|
+
@system_arguments[:classes] = class_names(
|
110
|
+
system_arguments[:classes],
|
111
|
+
"Popover"
|
112
|
+
)
|
113
|
+
@system_arguments[:position] ||= :relative
|
114
|
+
@system_arguments[:right] = false unless @system_arguments.delete(:right)
|
115
|
+
@system_arguments[:left] = false unless @system_arguments.delete(:left)
|
116
|
+
end
|
117
|
+
|
118
|
+
def render?
|
119
|
+
body.present?
|
120
|
+
end
|
121
|
+
|
122
|
+
def body_component
|
123
|
+
Primer::Box.new(**@body_arguments)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -121,11 +121,11 @@ module Primer
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def should_raise_error?
|
124
|
-
raise_on_invalid_options? && !ENV["PRIMER_WARNINGS_DISABLED"]
|
124
|
+
!Rails.env.production? && raise_on_invalid_options? && !ENV["PRIMER_WARNINGS_DISABLED"]
|
125
125
|
end
|
126
126
|
|
127
127
|
def should_raise_aria_error?
|
128
|
-
raise_on_invalid_aria? && !ENV["PRIMER_WARNINGS_DISABLED"]
|
128
|
+
!Rails.env.production? && raise_on_invalid_aria? && !ENV["PRIMER_WARNINGS_DISABLED"]
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
@@ -2,97 +2,12 @@
|
|
2
2
|
|
3
3
|
module Primer
|
4
4
|
class Dropdown
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
AS_DEFAULT = :default
|
9
|
-
AS_OPTIONS = [AS_DEFAULT, :list].freeze
|
5
|
+
# :nodoc:
|
6
|
+
class Menu < Primer::Alpha::Dropdown::Menu
|
7
|
+
status :deprecated
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
SCHEME_DEFAULT => "",
|
14
|
-
:dark => "dropdown-menu-dark"
|
15
|
-
}.freeze
|
16
|
-
|
17
|
-
DIRECTION_DEFAULT = :se
|
18
|
-
DIRECTION_OPTIONS = [DIRECTION_DEFAULT, :sw, :w, :e, :ne, :s].freeze
|
19
|
-
|
20
|
-
# @param tag [Symbol] <%= one_of(Primer::Dropdown::Menu::Item::TAG_OPTIONS) %>.
|
21
|
-
# @param divider [Boolean] Whether the item is a divider without any function.
|
22
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
23
|
-
renders_many :items, lambda { |divider: false, **system_arguments|
|
24
|
-
Primer::Dropdown::Menu::Item.new(as: @as, divider: divider, **system_arguments)
|
25
|
-
}
|
26
|
-
|
27
|
-
# @param as [Symbol] When `as` is `:list`, wraps the menu in a `<ul>` with a `<li>` for each item.
|
28
|
-
# @param direction [Symbol] <%= one_of(Primer::Dropdown::Menu::DIRECTION_OPTIONS) %>.
|
29
|
-
# @param header [String] Header to be displayed above the menu.
|
30
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
31
|
-
def initialize(as: AS_DEFAULT, direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments)
|
32
|
-
@header = header
|
33
|
-
@direction = direction
|
34
|
-
@as = fetch_or_fallback(AS_OPTIONS, as, AS_DEFAULT)
|
35
|
-
|
36
|
-
@system_arguments = deny_tag_argument(**system_arguments)
|
37
|
-
@system_arguments[:tag] = "details-menu"
|
38
|
-
@system_arguments[:role] = "menu"
|
39
|
-
|
40
|
-
@system_arguments[:classes] = class_names(
|
41
|
-
@system_arguments[:classes],
|
42
|
-
"dropdown-menu",
|
43
|
-
"dropdown-menu-#{fetch_or_fallback(DIRECTION_OPTIONS, direction, DIRECTION_DEFAULT)}",
|
44
|
-
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, SCHEME_DEFAULT)]
|
45
|
-
)
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def list?
|
51
|
-
@as == :list
|
52
|
-
end
|
53
|
-
|
54
|
-
# Items to be rendered in the `Dropdown` menu.
|
55
|
-
class Item < Primer::Component
|
56
|
-
TAG_DEFAULT = :a
|
57
|
-
BUTTON_TAGS = [:button, :summary].freeze
|
58
|
-
TAG_OPTIONS = [TAG_DEFAULT, *BUTTON_TAGS].freeze
|
59
|
-
|
60
|
-
def initialize(as:, tag: TAG_DEFAULT, divider: false, **system_arguments)
|
61
|
-
@divider = divider
|
62
|
-
@as = as
|
63
|
-
|
64
|
-
@system_arguments = system_arguments
|
65
|
-
@system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, TAG_DEFAULT)
|
66
|
-
@system_arguments[:tag] = :li if list? && divider?
|
67
|
-
@system_arguments[:role] ||= :menuitem
|
68
|
-
@system_arguments[:role] = :separator if divider
|
69
|
-
@system_arguments[:classes] = class_names(
|
70
|
-
@system_arguments[:classes],
|
71
|
-
"dropdown-item" => !divider,
|
72
|
-
"dropdown-divider" => divider
|
73
|
-
)
|
74
|
-
end
|
75
|
-
|
76
|
-
def call
|
77
|
-
component = if BUTTON_TAGS.include?(@system_arguments[:tag])
|
78
|
-
Primer::ButtonComponent.new(scheme: :link, **@system_arguments)
|
79
|
-
else
|
80
|
-
Primer::BaseComponent.new(**@system_arguments)
|
81
|
-
end
|
82
|
-
|
83
|
-
# divider has no content
|
84
|
-
render(component) if divider?
|
85
|
-
|
86
|
-
render(component) { content }
|
87
|
-
end
|
88
|
-
|
89
|
-
def divider?
|
90
|
-
@divider
|
91
|
-
end
|
92
|
-
|
93
|
-
def list?
|
94
|
-
@as == :list
|
95
|
-
end
|
9
|
+
class Item < Primer::Alpha::Dropdown::Menu::Item
|
10
|
+
status :deprecated
|
96
11
|
end
|
97
12
|
end
|
98
13
|
end
|