primer_view_components 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -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 +3 -3
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list/divider.rb +1 -1
- data/app/components/primer/alpha/action_list/form_wrapper.html.erb +10 -0
- data/app/components/primer/alpha/action_list/form_wrapper.rb +61 -0
- data/app/components/primer/alpha/action_list/heading.html.erb +2 -2
- data/app/components/primer/alpha/action_list/heading.rb +9 -5
- data/app/components/primer/alpha/action_list/item.html.erb +41 -36
- data/app/components/primer/alpha/action_list/item.rb +16 -2
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +1 -0
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.html.erb +6 -0
- data/app/components/primer/alpha/action_list.pcss +42 -37
- data/app/components/primer/alpha/action_list.rb +31 -11
- data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +7 -1
- data/app/components/primer/alpha/action_menu/action_menu_element.js +55 -3
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +70 -2
- data/app/components/primer/alpha/action_menu/list.rb +9 -11
- data/app/components/primer/alpha/action_menu.rb +50 -12
- data/app/components/primer/alpha/auto_complete.css +1 -1
- data/app/components/primer/alpha/auto_complete.css.map +1 -1
- data/app/components/primer/alpha/auto_complete.pcss +2 -2
- 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 +7 -7
- data/app/components/primer/alpha/dialog.css +1 -1
- data/app/components/primer/alpha/dialog.css.map +1 -1
- data/app/components/primer/alpha/dialog.pcss +33 -32
- data/app/components/primer/alpha/dialog.rb +4 -0
- data/app/components/primer/alpha/dropdown.css +1 -1
- data/app/components/primer/alpha/dropdown.css.map +1 -1
- data/app/components/primer/alpha/dropdown.pcss +12 -11
- data/app/components/primer/alpha/layout.css +1 -1
- data/app/components/primer/alpha/layout.css.map +1 -1
- data/app/components/primer/alpha/layout.pcss +4 -4
- data/app/components/primer/alpha/menu.css +1 -1
- data/app/components/primer/alpha/menu.css.map +1 -1
- data/app/components/primer/alpha/menu.pcss +20 -20
- data/app/components/primer/alpha/nav_list/divider.rb +14 -0
- data/app/components/primer/alpha/nav_list/group.html.erb +7 -0
- data/app/components/primer/alpha/nav_list/group.rb +24 -11
- data/app/components/primer/alpha/nav_list/item.rb +4 -0
- data/app/components/primer/alpha/nav_list.d.ts +0 -1
- data/app/components/primer/alpha/nav_list.html.erb +9 -4
- data/app/components/primer/alpha/nav_list.js +3 -4
- data/app/components/primer/alpha/nav_list.rb +87 -10
- data/app/components/primer/alpha/nav_list.ts +3 -2
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.json +2 -2
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.pcss +34 -43
- data/app/components/primer/alpha/tab_nav.css +1 -1
- data/app/components/primer/alpha/tab_nav.css.map +1 -1
- data/app/components/primer/alpha/tab_nav.pcss +12 -12
- data/app/components/primer/alpha/text_field.css +3 -3
- data/app/components/primer/alpha/text_field.css.json +11 -11
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/text_field.pcss +76 -90
- data/app/components/primer/alpha/toggle_switch.css +1 -1
- data/app/components/primer/alpha/toggle_switch.css.map +1 -1
- data/app/components/primer/alpha/toggle_switch.pcss +9 -9
- data/app/components/primer/alpha/underline_nav.css +1 -1
- data/app/components/primer/alpha/underline_nav.css.map +1 -1
- data/app/components/primer/alpha/underline_nav.pcss +7 -7
- data/app/components/primer/beta/auto_complete/item.html.erb +9 -9
- data/app/components/primer/beta/auto_complete/item.rb +17 -13
- data/app/components/primer/beta/auto_complete.rb +1 -1
- data/app/components/primer/beta/avatar.css +1 -1
- data/app/components/primer/beta/avatar.css.map +1 -1
- data/app/components/primer/beta/avatar.pcss +2 -2
- data/app/components/primer/beta/avatar_stack.css +1 -1
- data/app/components/primer/beta/avatar_stack.css.map +1 -1
- data/app/components/primer/beta/avatar_stack.pcss +5 -5
- data/app/components/primer/beta/blankslate.css +1 -1
- data/app/components/primer/beta/blankslate.css.map +1 -1
- data/app/components/primer/beta/blankslate.pcss +13 -13
- data/app/components/primer/beta/border_box.css +1 -1
- data/app/components/primer/beta/border_box.css.json +1 -1
- data/app/components/primer/beta/border_box.css.map +1 -1
- data/app/components/primer/beta/border_box.pcss +41 -39
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.json +2 -0
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button.pcss +34 -25
- data/app/components/primer/beta/counter.css +1 -1
- data/app/components/primer/beta/counter.css.map +1 -1
- data/app/components/primer/beta/counter.pcss +3 -3
- data/app/components/primer/beta/flash.css +1 -1
- data/app/components/primer/beta/flash.css.map +1 -1
- data/app/components/primer/beta/flash.pcss +10 -11
- data/app/components/primer/beta/label.css +1 -1
- data/app/components/primer/beta/label.css.map +1 -1
- data/app/components/primer/beta/label.pcss +2 -2
- data/app/components/primer/beta/popover.css +1 -1
- data/app/components/primer/beta/popover.css.map +1 -1
- data/app/components/primer/beta/popover.pcss +4 -4
- data/app/components/primer/beta/state.css +1 -1
- data/app/components/primer/beta/state.css.map +1 -1
- data/app/components/primer/beta/state.pcss +5 -5
- data/app/components/primer/beta/subhead.css +1 -1
- data/app/components/primer/beta/subhead.css.map +1 -1
- data/app/components/primer/beta/subhead.pcss +4 -4
- data/app/components/primer/beta/timeline_item.css +1 -1
- data/app/components/primer/beta/timeline_item.css.map +1 -1
- data/app/components/primer/beta/timeline_item.pcss +13 -13
- data/app/components/primer/beta/truncate.css +1 -1
- data/app/components/primer/beta/truncate.css.map +1 -1
- data/app/components/primer/beta/truncate.pcss +1 -1
- data/app/components/primer/component.rb +3 -96
- data/app/lib/primer/attributes_helper.rb +105 -0
- data/lib/postcss_mixins/activeIndicatorLine.pcss +1 -1
- data/lib/primer/forms/text_field.rb +6 -0
- data/lib/primer/view_components/linters/disallow_component_css_counter.rb +1 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/primer/yard/component_manifest.rb +1 -0
- data/previews/primer/alpha/action_menu_preview/multiple_select_form.html.erb +13 -0
- data/previews/primer/alpha/action_menu_preview/single_select_form.html.erb +13 -0
- data/previews/primer/alpha/action_menu_preview/submitting_forms.html.erb +15 -0
- data/previews/primer/alpha/action_menu_preview.rb +46 -2
- data/previews/primer/alpha/nav_list_preview/trailing_action.html.erb +10 -10
- data/previews/primer/alpha/nav_list_preview.rb +37 -16
- data/previews/primer/beta/button_preview/trailing_counter.html.erb +11 -0
- data/previews/primer/beta/button_preview.rb +15 -0
- data/previews/primer/box_preview.rb +28 -0
- data/static/arguments.json +59 -14
- data/static/audited_at.json +2 -0
- data/static/classes.json +3 -0
- data/static/constants.json +21 -1
- data/static/info_arch.json +238 -36
- data/static/previews.json +58 -0
- data/static/statuses.json +2 -0
- metadata +12 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["popover.pcss"],"names":[],"mappings":"AAEA,SACE,iBAAkB,CAClB,WACF,CAEA,iBAKE,4CAA6C,CAC7C,
|
1
|
+
{"version":3,"sources":["popover.pcss"],"names":[],"mappings":"AAEA,SACE,iBAAkB,CAClB,WACF,CAEA,iBAKE,4CAA6C,CAC7C,oEAAsE,CACtE,4CAA8C,CAH9C,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,qCAAuC,CAJvC,UAAW,CADX,QAAS,CAIT,oBAEF,CAGA,8BACE,iEACF,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(--borderWidth-thin, 1px) solid var(--color-border-default);\n border-radius: var(--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 and 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 and 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- and 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 and 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 and 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(--stack-gap-condensed, 8px);\n }\n\n /* Increase tap area for touch input */\n .Popover-message > .btn-octicon {\n padding: var(--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"]}
|
@@ -11,8 +11,8 @@
|
|
11
11
|
margin-right: auto;
|
12
12
|
margin-left: auto;
|
13
13
|
background-color: var(--color-canvas-overlay);
|
14
|
-
border: var(--
|
15
|
-
border-radius: var(--
|
14
|
+
border: var(--borderWidth-thin, 1px) solid var(--color-border-default);
|
15
|
+
border-radius: var(--borderRadius-medium, 6px);
|
16
16
|
|
17
17
|
/* Carets */
|
18
18
|
&::before,
|
@@ -209,12 +209,12 @@
|
|
209
209
|
bottom: auto;
|
210
210
|
left: auto;
|
211
211
|
width: auto !important;
|
212
|
-
margin: var(--
|
212
|
+
margin: var(--stack-gap-condensed, 8px);
|
213
213
|
}
|
214
214
|
|
215
215
|
/* Increase tap area for touch input */
|
216
216
|
.Popover-message > .btn-octicon {
|
217
|
-
padding: var(--
|
217
|
+
padding: var(--control-medium-paddingInline-normal, 12px) !important;
|
218
218
|
}
|
219
219
|
|
220
220
|
/* Remove caret */
|
@@ -1 +1 @@
|
|
1
|
-
.State,.state{border-radius:2em;display:inline-block;font-size:var(--
|
1
|
+
.State,.state{border-radius:2em;display:inline-block;font-size:var(--text-body-size-medium,14px);font-weight:var(--base-text-weight-medium,500);line-height:var(--control-medium-lineBoxHeight,20px);padding:5px var(--control-medium-paddingInline-normal,12px);text-align:center;white-space:nowrap}.State,.State--draft,.state{background-color:var(--color-neutral-emphasis);border:var(--borderWidth-thin,1px) solid #0000;color:var(--color-fg-on-emphasis)}.State--open{background-color:var(--color-open-emphasis)}.State--merged,.State--open{color:var(--color-fg-on-emphasis)}.State--merged{background-color:var(--color-done-emphasis)}.State--closed{background-color:var(--color-closed-emphasis);color:var(--color-fg-on-emphasis)}.State--small{font-size:var(--text-body-size-small,12px);line-height:var(--base-size-24,24px);padding:0 10px}.State--small .octicon{width:1em}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["state.pcss"],"names":[],"mappings":"AAIA,cASE,iBAAkB,CAPlB,oBAAqB,CAErB,
|
1
|
+
{"version":3,"sources":["state.pcss"],"names":[],"mappings":"AAIA,cASE,iBAAkB,CAPlB,oBAAqB,CAErB,2CAA6C,CAC7C,8CAAgD,CAChD,oDAAsD,CAHtD,2DAA6D,CAI7D,iBAAkB,CAClB,kBAEF,CAEA,4BAIE,8CAA+C,CAC/C,8CAAsD,CAFtD,iCAGF,CAEA,aAEE,2CACF,CAEA,4BAJE,iCAOF,CAHA,eAEE,2CACF,CAEA,eAEE,6CAA8C,CAD9C,iCAEF,CAIA,cAEE,0CAA4C,CAC5C,oCAAsC,CAFtC,cAOF,CAHE,uBACE,SACF","file":"state.css","sourcesContent":["/* State */\n\n/* Default 32px */\n\n.state, /* TODO: Deprecate */\n.State {\n display: inline-block;\n padding: 5px var(--control-medium-paddingInline-normal, 12px);\n font-size: var(--text-body-size-medium, 14px);\n font-weight: var(--base-text-weight-medium, 500);\n line-height: var(--control-medium-lineBoxHeight, 20px);\n text-align: center;\n white-space: nowrap;\n border-radius: 2em;\n}\n\n.state, /* TODO: Deprecate */\n.State,\n.State--draft {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-neutral-emphasis);\n border: var(--borderWidth-thin, 1px) solid transparent;\n}\n\n.State--open {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-open-emphasis);\n}\n\n.State--merged {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-done-emphasis);\n}\n\n.State--closed {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-closed-emphasis);\n}\n\n/* Small 24px */\n\n.State--small {\n padding: 0 10px;\n font-size: var(--text-body-size-small, 12px);\n line-height: var(--base-size-24, 24px);\n\n & .octicon {\n width: 1em; /* Ensures different icons don't change State indicator width */\n }\n}\n"]}
|
@@ -5,10 +5,10 @@
|
|
5
5
|
.state, /* TODO: Deprecate */
|
6
6
|
.State {
|
7
7
|
display: inline-block;
|
8
|
-
padding: 5px var(--
|
9
|
-
font-size: var(--
|
8
|
+
padding: 5px var(--control-medium-paddingInline-normal, 12px);
|
9
|
+
font-size: var(--text-body-size-medium, 14px);
|
10
10
|
font-weight: var(--base-text-weight-medium, 500);
|
11
|
-
line-height: var(--
|
11
|
+
line-height: var(--control-medium-lineBoxHeight, 20px);
|
12
12
|
text-align: center;
|
13
13
|
white-space: nowrap;
|
14
14
|
border-radius: 2em;
|
@@ -19,7 +19,7 @@
|
|
19
19
|
.State--draft {
|
20
20
|
color: var(--color-fg-on-emphasis);
|
21
21
|
background-color: var(--color-neutral-emphasis);
|
22
|
-
border: var(--
|
22
|
+
border: var(--borderWidth-thin, 1px) solid transparent;
|
23
23
|
}
|
24
24
|
|
25
25
|
.State--open {
|
@@ -41,7 +41,7 @@
|
|
41
41
|
|
42
42
|
.State--small {
|
43
43
|
padding: 0 10px;
|
44
|
-
font-size: var(--
|
44
|
+
font-size: var(--text-body-size-small, 12px);
|
45
45
|
line-height: var(--base-size-24, 24px);
|
46
46
|
|
47
47
|
& .octicon {
|
@@ -1 +1 @@
|
|
1
|
-
.Subhead{border-bottom:var(--
|
1
|
+
.Subhead{border-bottom:var(--borderWidth-thin,1px) solid var(--color-border-muted);display:flex;flex-flow:row wrap;justify-content:flex-end;margin-bottom:var(--stack-gap-normal,16px);padding-bottom:var(--stack-padding-condensed,8px)}.Subhead--spacious{margin-top:var(--base-size-40,40px)}.Subhead-heading{flex:1 1 auto;font-size:24px;font-weight:var(--base-text-weight-normal,400);order:0}.Subhead-heading--danger{color:var(--color-danger-fg);font-weight:var(--base-text-weight-semibold,600)}.Subhead-description{color:var(--color-fg-muted);flex:1 100%;font-size:var(--text-body-size-medium,14px);order:2}.Subhead-actions{align-self:center;justify-content:flex-end;margin:var(--base-size-4,4px) 0 var(--base-size-4,4px) var(--base-size-4,4px);order:1}.Subhead-actions+.Subhead-description{margin-top:var(--base-size-4,4px)}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["subhead.pcss"],"names":[],"mappings":"AAEA,SAIE,
|
1
|
+
{"version":3,"sources":["subhead.pcss"],"names":[],"mappings":"AAEA,SAIE,yEAA2E,CAH3E,YAAa,CAIb,kBAAmB,CACnB,wBAAyB,CAHzB,0CAA4C,CAD5C,iDAKF,CAGA,mBACE,mCACF,CAGA,iBAGE,aAAc,CAFd,cAAe,CACf,8CAAgD,CAEhD,OACF,CAGA,yBAEE,4BAA6B,CAD7B,gDAEF,CAGA,qBAEE,2BAA4B,CAC5B,WAAY,CAFZ,2CAA6C,CAG7C,OACF,CAGA,iBAEE,iBAAkB,CAClB,wBAAyB,CAFzB,6EAAiF,CAGjF,OAKF,CAHE,sCACE,iCACF","file":"subhead.css","sourcesContent":["/* Subhead */\n\n.Subhead {\n display: flex;\n padding-bottom: var(--stack-padding-condensed, 8px);\n margin-bottom: var(--stack-gap-normal, 16px);\n border-bottom: var(--borderWidth-thin, 1px) solid var(--color-border-muted);\n flex-flow: row wrap;\n justify-content: flex-end; /* Keep actions right aligned. */\n}\n\n/* Modifier class to give a lot of breathing room between sections of content. */\n.Subhead--spacious {\n margin-top: var(--base-size-40, 40px);\n}\n\n/* <h2> sized heading with normal font weight */\n.Subhead-heading {\n font-size: 24px;\n font-weight: var(--base-text-weight-normal, 400);\n flex: 1 1 auto;\n order: 0;\n}\n\n/* Make the text bold and red for dangerous content */\n.Subhead-heading--danger {\n font-weight: var(--base-text-weight-semibold, 600);\n color: var(--color-danger-fg);\n}\n\n/* One-liner of supporting text */\n.Subhead-description {\n font-size: var(--text-body-size-medium, 14px);\n color: var(--color-fg-muted);\n flex: 1 100%;\n order: 2;\n}\n\n/* Add 1 or 2 buttons to the right of the heading */\n.Subhead-actions {\n margin: var(--base-size-4, 4px) 0 var(--base-size-4, 4px) var(--base-size-4, 4px);\n align-self: center;\n justify-content: flex-end;\n order: 1;\n\n & + .Subhead-description {\n margin-top: var(--base-size-4, 4px);\n }\n}\n"]}
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
.Subhead {
|
4
4
|
display: flex;
|
5
|
-
padding-bottom: var(--
|
6
|
-
margin-bottom: var(--
|
7
|
-
border-bottom: var(--
|
5
|
+
padding-bottom: var(--stack-padding-condensed, 8px);
|
6
|
+
margin-bottom: var(--stack-gap-normal, 16px);
|
7
|
+
border-bottom: var(--borderWidth-thin, 1px) solid var(--color-border-muted);
|
8
8
|
flex-flow: row wrap;
|
9
9
|
justify-content: flex-end; /* Keep actions right aligned. */
|
10
10
|
}
|
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
/* One-liner of supporting text */
|
32
32
|
.Subhead-description {
|
33
|
-
font-size: var(--
|
33
|
+
font-size: var(--text-body-size-medium, 14px);
|
34
34
|
color: var(--color-fg-muted);
|
35
35
|
flex: 1 100%;
|
36
36
|
order: 2;
|
@@ -1 +1 @@
|
|
1
|
-
.TimelineItem{display:flex;margin-left:var(--
|
1
|
+
.TimelineItem{display:flex;margin-left:var(--stack-gap-normal,16px);padding:var(--stack-padding-normal,16px) 0;position:relative}.TimelineItem:before{background-color:var(--color-border-muted);bottom:0;content:"";display:block;left:0;position:absolute;top:0;width:var(--borderWidth-thick,2px)}.TimelineItem:target .TimelineItem-badge{border-color:var(--color-accent-emphasis);box-shadow:0 0 .2em var(--color-accent-muted)}.TimelineItem-badge{align-items:center;background-color:var(--color-timeline-badge-bg);border:var(--borderWidth-thick,2px) solid var(--color-canvas-default);border-radius:50%;color:var(--color-fg-muted);display:flex;flex-shrink:0;height:var(--control-medium-size,32px);justify-content:center;margin-left:calc(var(--control-medium-size, 32px)/-2 + 1px);margin-right:var(--controlStack-medium-gap-condensed,8px);position:relative;width:var(--control-medium-size,32px);z-index:1}.TimelineItem-badge--success{background-color:var(--color-success-emphasis);border:var(--borderWidth-thin,1px) solid #0000;color:var(--color-fg-on-emphasis)}.TimelineItem-body{color:var(--color-fg-muted);flex:auto;margin-top:var(--base-size-4,4px);max-width:100%;min-width:0}.TimelineItem-avatar{left:-72px;position:absolute;z-index:1}.TimelineItem-break{background-color:var(--color-canvas-default);border:0;border-top:var(--borderWidth-thicker,4px) solid var(--color-border-default);height:var(--stack-gap-spacious,24px);margin:0;margin-bottom:calc(var(--stack-gap-normal, 16px)*-1);margin-left:-56px;position:relative;z-index:1}.TimelineItem--condensed{padding-bottom:0;padding-top:var(--base-size-4,4px)}.TimelineItem--condensed:last-child{padding-bottom:var(--stack-gap-normal,16px)}.TimelineItem--condensed .TimelineItem-badge{background-color:var(--color-canvas-default);border:0;color:var(--color-fg-muted);height:var(--base-size-16,16px);margin-bottom:var(--base-size-8,8px);margin-top:var(--base-size-8,8px)}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["timeline_item.pcss"],"names":[],"mappings":"AAEA,cAEE,YAAa,CAEb
|
1
|
+
{"version":3,"sources":["timeline_item.pcss"],"names":[],"mappings":"AAEA,cAEE,YAAa,CAEb,wCAA0C,CAD1C,0CAA4C,CAF5C,iBAqBF,CAfE,qBAQE,0CAA2C,CAL3C,QAAS,CAIT,UAAW,CAFX,aAAc,CADd,MAAO,CAHP,iBAAkB,CAClB,KAAM,CAIN,kCAGF,CAEA,yCACE,yCAA0C,CAC1C,6CACF,CAGF,oBASE,kBAAmB,CACnB,+CAAgD,CAChD,qEAAuE,CACvE,iBAAkB,CAJlB,2BAA4B,CAL5B,YAAa,CAWb,aAAc,CATd,sCAAwC,CAQxC,sBAAuB,CANvB,2DAA8D,CAD9D,yDAA2D,CAL3D,iBAAkB,CAGlB,qCAAuC,CAFvC,SAaF,CAEA,6BAEE,8CAA+C,CAC/C,8CAAsD,CAFtD,iCAGF,CAEA,mBAIE,2BAA4B,CAC5B,SAAU,CAFV,iCAAmC,CADnC,cAAe,CADf,WAKF,CAEA,qBAEE,UAAW,CADX,iBAAkB,CAElB,SACF,CAEA,oBAOE,4CAA6C,CAC7C,QAAS,CACT,2EAA6E,CAN7E,qCAAuC,CACvC,QAAS,CACT,oDAAuD,CACvD,iBAAkB,CALlB,iBAAkB,CAClB,SAQF,CAEA,yBAEE,gBAAiB,CADjB,kCAgBF,CAZE,oCACE,2CACF,CAEA,6CAKE,4CAA6C,CAC7C,QAAS,CAFT,2BAA4B,CAH5B,+BAAiC,CAEjC,oCAAsC,CADtC,iCAKF","file":"timeline_item.css","sourcesContent":["/* TimelineItem */\n\n.TimelineItem {\n position: relative;\n display: flex;\n padding: var(--stack-padding-normal, 16px) 0;\n margin-left: var(--stack-gap-normal, 16px);\n\n /* The Timeline */\n &::before {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n display: block;\n width: var(--borderWidth-thick, 2px);\n content: '';\n background-color: var(--color-border-muted);\n }\n\n &:target .TimelineItem-badge {\n border-color: var(--color-accent-emphasis);\n box-shadow: 0 0 0.2em var(--color-accent-muted);\n }\n}\n\n.TimelineItem-badge {\n position: relative;\n z-index: 1;\n display: flex;\n width: var(--control-medium-size, 32px);\n height: var(--control-medium-size, 32px);\n margin-right: var(--controlStack-medium-gap-condensed, 8px);\n margin-left: calc(var(--control-medium-size, 32px) / -2 + 1px);\n color: var(--color-fg-muted);\n align-items: center;\n background-color: var(--color-timeline-badge-bg);\n border: var(--borderWidth-thick, 2px) solid var(--color-canvas-default);\n border-radius: 50%;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.TimelineItem-badge--success {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-success-emphasis);\n border: var(--borderWidth-thin, 1px) solid transparent;\n}\n\n.TimelineItem-body {\n min-width: 0;\n max-width: 100%;\n margin-top: var(--base-size-4, 4px);\n color: var(--color-fg-muted);\n flex: auto;\n}\n\n.TimelineItem-avatar {\n position: absolute;\n left: -72px;\n z-index: 1;\n}\n\n.TimelineItem-break {\n position: relative;\n z-index: 1;\n height: var(--stack-gap-spacious, 24px);\n margin: 0;\n margin-bottom: calc(var(--stack-gap-normal, 16px) * -1);\n margin-left: -56px;\n background-color: var(--color-canvas-default);\n border: 0;\n border-top: var(--borderWidth-thicker, 4px) solid var(--color-border-default);\n}\n\n.TimelineItem--condensed {\n padding-top: var(--base-size-4, 4px);\n padding-bottom: 0;\n\n /* TimelineItem--condensed is often grouped. (commits) */\n &:last-child {\n padding-bottom: var(--stack-gap-normal, 16px);\n }\n\n & .TimelineItem-badge {\n height: var(--base-size-16, 16px);\n margin-top: var(--base-size-8, 8px);\n margin-bottom: var(--base-size-8, 8px);\n color: var(--color-fg-muted);\n background-color: var(--color-canvas-default);\n border: 0;\n }\n}\n"]}
|
@@ -3,8 +3,8 @@
|
|
3
3
|
.TimelineItem {
|
4
4
|
position: relative;
|
5
5
|
display: flex;
|
6
|
-
padding: var(--
|
7
|
-
margin-left: var(--
|
6
|
+
padding: var(--stack-padding-normal, 16px) 0;
|
7
|
+
margin-left: var(--stack-gap-normal, 16px);
|
8
8
|
|
9
9
|
/* The Timeline */
|
10
10
|
&::before {
|
@@ -13,7 +13,7 @@
|
|
13
13
|
bottom: 0;
|
14
14
|
left: 0;
|
15
15
|
display: block;
|
16
|
-
width: var(--
|
16
|
+
width: var(--borderWidth-thick, 2px);
|
17
17
|
content: '';
|
18
18
|
background-color: var(--color-border-muted);
|
19
19
|
}
|
@@ -28,14 +28,14 @@
|
|
28
28
|
position: relative;
|
29
29
|
z-index: 1;
|
30
30
|
display: flex;
|
31
|
-
width: var(--
|
32
|
-
height: var(--
|
33
|
-
margin-right: var(--
|
34
|
-
margin-left: calc(var(--
|
31
|
+
width: var(--control-medium-size, 32px);
|
32
|
+
height: var(--control-medium-size, 32px);
|
33
|
+
margin-right: var(--controlStack-medium-gap-condensed, 8px);
|
34
|
+
margin-left: calc(var(--control-medium-size, 32px) / -2 + 1px);
|
35
35
|
color: var(--color-fg-muted);
|
36
36
|
align-items: center;
|
37
37
|
background-color: var(--color-timeline-badge-bg);
|
38
|
-
border: var(--
|
38
|
+
border: var(--borderWidth-thick, 2px) solid var(--color-canvas-default);
|
39
39
|
border-radius: 50%;
|
40
40
|
justify-content: center;
|
41
41
|
flex-shrink: 0;
|
@@ -44,7 +44,7 @@
|
|
44
44
|
.TimelineItem-badge--success {
|
45
45
|
color: var(--color-fg-on-emphasis);
|
46
46
|
background-color: var(--color-success-emphasis);
|
47
|
-
border: var(--
|
47
|
+
border: var(--borderWidth-thin, 1px) solid transparent;
|
48
48
|
}
|
49
49
|
|
50
50
|
.TimelineItem-body {
|
@@ -64,13 +64,13 @@
|
|
64
64
|
.TimelineItem-break {
|
65
65
|
position: relative;
|
66
66
|
z-index: 1;
|
67
|
-
height: var(--
|
67
|
+
height: var(--stack-gap-spacious, 24px);
|
68
68
|
margin: 0;
|
69
|
-
margin-bottom: calc(var(--
|
69
|
+
margin-bottom: calc(var(--stack-gap-normal, 16px) * -1);
|
70
70
|
margin-left: -56px;
|
71
71
|
background-color: var(--color-canvas-default);
|
72
72
|
border: 0;
|
73
|
-
border-top: var(--
|
73
|
+
border-top: var(--borderWidth-thicker, 4px) solid var(--color-border-default);
|
74
74
|
}
|
75
75
|
|
76
76
|
.TimelineItem--condensed {
|
@@ -79,7 +79,7 @@
|
|
79
79
|
|
80
80
|
/* TimelineItem--condensed is often grouped. (commits) */
|
81
81
|
&:last-child {
|
82
|
-
padding-bottom: var(--
|
82
|
+
padding-bottom: var(--stack-gap-normal, 16px);
|
83
83
|
}
|
84
84
|
|
85
85
|
& .TimelineItem-badge {
|
@@ -1 +1 @@
|
|
1
|
-
.Truncate{display:inline-flex;max-width:100%;min-width:0}.Truncate>.Truncate-text{max-width:-moz-fit-content;max-width:fit-content;min-width:1ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Truncate>.Truncate-text+.Truncate-text{margin-left:var(--
|
1
|
+
.Truncate{display:inline-flex;max-width:100%;min-width:0}.Truncate>.Truncate-text{max-width:-moz-fit-content;max-width:fit-content;min-width:1ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Truncate>.Truncate-text+.Truncate-text{margin-left:var(--control-small-gap,4px)}.Truncate>.Truncate-text.Truncate-text--primary{flex-basis:200%}.Truncate>.Truncate-text.Truncate-text--expandable:active,.Truncate>.Truncate-text.Truncate-text--expandable:focus,.Truncate>.Truncate-text.Truncate-text--expandable:hover{cursor:pointer;flex-shrink:0;max-width:100%!important}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["truncate.pcss"],"names":[],"mappings":"AAEA,UACE,mBAAoB,CAEpB,cAAe,CADf,WA0BF,CAvBE,yBAEE,0BAAsB,CAAtB,qBAAsB,CADtB,aAAc,CAEd,eAAgB,CAChB,sBAAuB,CACvB,kBAiBF,CAfE,wCACE
|
1
|
+
{"version":3,"sources":["truncate.pcss"],"names":[],"mappings":"AAEA,UACE,mBAAoB,CAEpB,cAAe,CADf,WA0BF,CAvBE,yBAEE,0BAAsB,CAAtB,qBAAsB,CADtB,aAAc,CAEd,eAAgB,CAChB,sBAAuB,CACvB,kBAiBF,CAfE,wCACE,wCACF,CAEA,gDACE,eACF,CAEA,4KAKE,cAAe,CADf,aAAc,CADd,wBAGF","file":"truncate.css","sourcesContent":["/* Truncate */\n\n.Truncate {\n display: inline-flex;\n min-width: 0;\n max-width: 100%;\n\n & > .Truncate-text {\n min-width: 1ch;\n max-width: fit-content;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n & + .Truncate-text {\n margin-left: var(--control-small-gap, 4px);\n }\n\n &.Truncate-text--primary {\n flex-basis: 200%;\n }\n\n &.Truncate-text--expandable:hover,\n &.Truncate-text--expandable:focus,\n &.Truncate-text--expandable:active {\n max-width: 100% !important;\n flex-shrink: 0;\n cursor: pointer;\n }\n }\n}\n"]}
|
@@ -16,6 +16,7 @@ module Primer
|
|
16
16
|
include ViewComponent::PolymorphicSlots
|
17
17
|
end
|
18
18
|
|
19
|
+
include AttributesHelper
|
19
20
|
include ClassNameHelper
|
20
21
|
include FetchOrFallbackHelper
|
21
22
|
include TestSelectorHelper
|
@@ -25,15 +26,13 @@ module Primer
|
|
25
26
|
include Audited::Dsl
|
26
27
|
|
27
28
|
INVALID_ARIA_LABEL_TAGS = [:div, :span, :p].freeze
|
28
|
-
PLURAL_ARIA_ATTRIBUTES = %i[describedby labelledby].freeze
|
29
|
-
PLURAL_DATA_ATTRIBUTES = %i[target targets].freeze
|
30
29
|
|
31
30
|
def self.deprecated?
|
32
31
|
status == :deprecated
|
33
32
|
end
|
34
33
|
|
35
|
-
def self.generate_id
|
36
|
-
"#{
|
34
|
+
def self.generate_id(base_name: name.demodulize.underscore.dasherize)
|
35
|
+
"#{base_name}-#{SecureRandom.uuid}"
|
37
36
|
end
|
38
37
|
|
39
38
|
private
|
@@ -56,98 +55,6 @@ module Primer
|
|
56
55
|
ActiveSupport::Deprecation.warn(message)
|
57
56
|
end
|
58
57
|
|
59
|
-
def aria(val, system_arguments)
|
60
|
-
system_arguments[:"aria-#{val}"] || system_arguments.dig(:aria, val.to_sym)
|
61
|
-
end
|
62
|
-
|
63
|
-
# Merges hashes that contain "aria-*" keys and nested aria: hashes. Removes keys from
|
64
|
-
# each hash and returns them in the new hash.
|
65
|
-
#
|
66
|
-
# Eg. merge_aria({ "aria-disabled": "true" }, { aria: { invalid: "true" } })
|
67
|
-
# => { disabled: "true", invalid: "true" }
|
68
|
-
#
|
69
|
-
# Certain aria attributes can contain multiple values separated by spaces. merge_aria
|
70
|
-
# will combine these plural attributes into a composite string.
|
71
|
-
#
|
72
|
-
# Eg. merge_aria({ "aria-labelledby": "foo" }, { aria: { labelledby: "bar" } })
|
73
|
-
# => { labelledby: "foo bar" }
|
74
|
-
#
|
75
|
-
# It's designed to be used to normalize and merge aria information from system_arguments
|
76
|
-
# hashes. Consider using this pattern in component initializers:
|
77
|
-
#
|
78
|
-
# @system_arguments[:aria] = merge_aria(
|
79
|
-
# @system_arguments,
|
80
|
-
# { aria: { labelled_by: id } }
|
81
|
-
# )
|
82
|
-
def merge_aria(*hashes)
|
83
|
-
merge_prefixed_attribute_hashes(
|
84
|
-
*hashes, prefix: :aria, plural_keys: PLURAL_ARIA_ATTRIBUTES
|
85
|
-
)
|
86
|
-
end
|
87
|
-
|
88
|
-
# Merges hashes that contain "data-*" keys and nested data: hashes. Removes keys from
|
89
|
-
# each hash and returns them in the new hash.
|
90
|
-
#
|
91
|
-
# Eg. merge_data({ "data-foo": "true" }, { data: { bar: "true" } })
|
92
|
-
# => { foo: "true", bar: "true" }
|
93
|
-
#
|
94
|
-
# Certain data attributes can contain multiple values separated by spaces. merge_data
|
95
|
-
# will combine these plural attributes into a composite string.
|
96
|
-
#
|
97
|
-
# Eg. merge_data({ "data-target": "foo" }, { data: { target: "bar" } })
|
98
|
-
# => { target: "foo bar" }
|
99
|
-
#
|
100
|
-
# It's designed to be used to normalize and merge data information from system_arguments
|
101
|
-
# hashes. Consider using this pattern in component initializers:
|
102
|
-
#
|
103
|
-
# @system_arguments[:data] = merge_aria(
|
104
|
-
# @system_arguments,
|
105
|
-
# { data: { foo: "bar" } }
|
106
|
-
# )
|
107
|
-
def merge_data(*hashes)
|
108
|
-
merge_prefixed_attribute_hashes(
|
109
|
-
*hashes, prefix: :data, plural_keys: PLURAL_DATA_ATTRIBUTES
|
110
|
-
)
|
111
|
-
end
|
112
|
-
|
113
|
-
def merge_prefixed_attribute_hashes(*hashes, prefix:, plural_keys:)
|
114
|
-
{}.tap do |result|
|
115
|
-
hashes.each do |hash|
|
116
|
-
next unless hash
|
117
|
-
|
118
|
-
prefix_hash = hash.delete(prefix) || {}
|
119
|
-
|
120
|
-
prefix_hash.each_pair do |key, val|
|
121
|
-
result[key] =
|
122
|
-
if plural_keys.include?(key)
|
123
|
-
[*(result[key] || "").split, val].join(" ").strip
|
124
|
-
else
|
125
|
-
val
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
hash.delete_if do |key, val|
|
130
|
-
key_s = key.to_s
|
131
|
-
|
132
|
-
if key.start_with?("#{prefix}-")
|
133
|
-
bare_key = key_s.sub("#{prefix}-", "").to_sym
|
134
|
-
|
135
|
-
result[bare_key] =
|
136
|
-
if plural_keys.include?(bare_key)
|
137
|
-
[*(result[bare_key] || "").split, val].join(" ").strip
|
138
|
-
else
|
139
|
-
val
|
140
|
-
end
|
141
|
-
|
142
|
-
true
|
143
|
-
else
|
144
|
-
false
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
58
|
def validate_aria_label
|
152
59
|
aria_label = aria("label", @system_arguments)
|
153
60
|
aria_labelledby = aria("labelledby", @system_arguments)
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
# :nodoc:
|
5
|
+
module AttributesHelper
|
6
|
+
PLURAL_ARIA_ATTRIBUTES = %i[describedby labelledby].freeze
|
7
|
+
PLURAL_DATA_ATTRIBUTES = %i[target targets].freeze
|
8
|
+
|
9
|
+
def aria(val, system_arguments)
|
10
|
+
system_arguments[:"aria-#{val}"] || system_arguments.dig(:aria, val.to_sym)
|
11
|
+
end
|
12
|
+
|
13
|
+
def data(val, system_arguments)
|
14
|
+
system_arguments[:"data-#{val}"] || system_arguments.dig(:data, val.to_sym)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Merges hashes that contain "aria-*" keys and nested aria: hashes. Removes keys from
|
18
|
+
# each hash and returns them in the new hash.
|
19
|
+
#
|
20
|
+
# Eg. merge_aria({ "aria-disabled": "true" }, { aria: { invalid: "true" } })
|
21
|
+
# => { disabled: "true", invalid: "true" }
|
22
|
+
#
|
23
|
+
# Certain aria attributes can contain multiple values separated by spaces. merge_aria
|
24
|
+
# will combine these plural attributes into a composite string.
|
25
|
+
#
|
26
|
+
# Eg. merge_aria({ "aria-labelledby": "foo" }, { aria: { labelledby: "bar" } })
|
27
|
+
# => { labelledby: "foo bar" }
|
28
|
+
#
|
29
|
+
# It's designed to be used to normalize and merge aria information from system_arguments
|
30
|
+
# hashes. Consider using this pattern in component initializers:
|
31
|
+
#
|
32
|
+
# @system_arguments[:aria] = merge_aria(
|
33
|
+
# @system_arguments,
|
34
|
+
# { aria: { labelled_by: id } }
|
35
|
+
# )
|
36
|
+
def merge_aria(*hashes)
|
37
|
+
merge_prefixed_attribute_hashes(
|
38
|
+
*hashes, prefix: :aria, plural_keys: PLURAL_ARIA_ATTRIBUTES
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Merges hashes that contain "data-*" keys and nested data: hashes. Removes keys from
|
43
|
+
# each hash and returns them in the new hash.
|
44
|
+
#
|
45
|
+
# Eg. merge_data({ "data-foo": "true" }, { data: { bar: "true" } })
|
46
|
+
# => { foo: "true", bar: "true" }
|
47
|
+
#
|
48
|
+
# Certain data attributes can contain multiple values separated by spaces. merge_data
|
49
|
+
# will combine these plural attributes into a composite string.
|
50
|
+
#
|
51
|
+
# Eg. merge_data({ "data-target": "foo" }, { data: { target: "bar" } })
|
52
|
+
# => { target: "foo bar" }
|
53
|
+
#
|
54
|
+
# It's designed to be used to normalize and merge data information from system_arguments
|
55
|
+
# hashes. Consider using this pattern in component initializers:
|
56
|
+
#
|
57
|
+
# @system_arguments[:data] = merge_aria(
|
58
|
+
# @system_arguments,
|
59
|
+
# { data: { foo: "bar" } }
|
60
|
+
# )
|
61
|
+
def merge_data(*hashes)
|
62
|
+
merge_prefixed_attribute_hashes(
|
63
|
+
*hashes, prefix: :data, plural_keys: PLURAL_DATA_ATTRIBUTES
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
def merge_prefixed_attribute_hashes(*hashes, prefix:, plural_keys:)
|
68
|
+
{}.tap do |result|
|
69
|
+
hashes.each do |hash|
|
70
|
+
next unless hash
|
71
|
+
|
72
|
+
prefix_hash = hash.delete(prefix) || {}
|
73
|
+
|
74
|
+
prefix_hash.each_pair do |key, val|
|
75
|
+
result[key] =
|
76
|
+
if plural_keys.include?(key)
|
77
|
+
[*(result[key] || "").split, val].join(" ").strip
|
78
|
+
else
|
79
|
+
val
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
hash.delete_if do |key, val|
|
84
|
+
key_s = key.to_s
|
85
|
+
|
86
|
+
if key.start_with?("#{prefix}-")
|
87
|
+
bare_key = key_s.sub("#{prefix}-", "").to_sym
|
88
|
+
|
89
|
+
result[bare_key] =
|
90
|
+
if plural_keys.include?(bare_key)
|
91
|
+
[*(result[bare_key] || "").split, val].join(" ").strip
|
92
|
+
else
|
93
|
+
val
|
94
|
+
end
|
95
|
+
|
96
|
+
true
|
97
|
+
else
|
98
|
+
false
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -6,6 +6,11 @@ module Primer
|
|
6
6
|
class TextField < BaseComponent
|
7
7
|
delegate :builder, :form, to: :@input
|
8
8
|
|
9
|
+
INPUT_WRAP_SIZE = {
|
10
|
+
small: "FormControl-input-wrap--small",
|
11
|
+
large: "FormControl-input-wrap--large"
|
12
|
+
}.freeze
|
13
|
+
|
9
14
|
def initialize(input:)
|
10
15
|
@input = input
|
11
16
|
|
@@ -17,6 +22,7 @@ module Primer
|
|
17
22
|
@field_wrap_arguments = {
|
18
23
|
class: class_names(
|
19
24
|
"FormControl-input-wrap",
|
25
|
+
INPUT_WRAP_SIZE[input.size],
|
20
26
|
"FormControl-input-wrap--trailingAction": @input.show_clear_button?,
|
21
27
|
"FormControl-input-wrap--leadingVisual": @input.leading_visual?
|
22
28
|
),
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= form_with(url: action_menu_form_action_path(format: route_format)) do |f| %>
|
2
|
+
<%= render(Primer::Alpha::ActionMenu.new(select_variant: :multiple, dynamic_label: true, dynamic_label_prefix: "Strategy", form_arguments: { builder: f, name: "foo" })) do |menu| %>
|
3
|
+
<% menu.with_show_button { "Strategy" } %>
|
4
|
+
<% menu.with_item(label: "Fast forward", data: { value: "fast_forward" }) %>
|
5
|
+
<% menu.with_item(label: "Recursive", data: { value: "recursive" }) %>
|
6
|
+
<% menu.with_item(label: "Ours", data: { value: "ours" }) %>
|
7
|
+
<% menu.with_item(label: "Resolve") %>
|
8
|
+
<% end %>
|
9
|
+
<hr>
|
10
|
+
<div>
|
11
|
+
<%= f.submit(class: "Button--secondary Button--medium Button") %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= form_with(url: action_menu_form_action_path(format: route_format)) do |f| %>
|
2
|
+
<%= render(Primer::Alpha::ActionMenu.new(select_variant: :single, dynamic_label: true, dynamic_label_prefix: "Strategy", form_arguments: { builder: f, name: "foo" })) do |menu| %>
|
3
|
+
<% menu.with_show_button { "Strategy" } %>
|
4
|
+
<% menu.with_item(label: "Fast forward", data: { value: "fast_forward" }) %>
|
5
|
+
<% menu.with_item(label: "Recursive", data: { value: "recursive" }) %>
|
6
|
+
<% menu.with_item(label: "Ours", data: { value: "ours" }) %>
|
7
|
+
<% menu.with_item(label: "Resolve") %>
|
8
|
+
<% end %>
|
9
|
+
<hr>
|
10
|
+
<div>
|
11
|
+
<%= f.submit(class: "Button--secondary Button--medium Button") %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<form method="get" action="?" id="my-form">
|
2
|
+
<input type="hidden" name="time" value="<%= Time.now.iso8601 %>">
|
3
|
+
</form>
|
4
|
+
<%= render(Primer::Alpha::ActionMenu.new(menu_id: "menu-1")) do |menu| %>
|
5
|
+
<% menu.with_show_button { params["label"] || "Menu" } %>
|
6
|
+
<% menu.with_item(label: "Submit form", tag: "button", content_arguments: {
|
7
|
+
form: "my-form", type: "submit", name: "label", value: "Submitted!"
|
8
|
+
}) do |item| %>
|
9
|
+
<% if params["time"] %>
|
10
|
+
<% item.with_description.with_content("Last submitted at #{params["time"]}") %>
|
11
|
+
<% elsif %>
|
12
|
+
<% item.with_description.with_content("Not yet submitted") %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|