@primer/view-components 0.31.0 → 0.31.1-rc.4d4c576b
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/action_list.css +1 -1
- package/app/components/primer/alpha/action_list.css.json +33 -50
- package/app/components/primer/alpha/auto_complete.css +1 -1
- package/app/components/primer/alpha/auto_complete.css.json +3 -5
- package/app/components/primer/alpha/banner.css +1 -1
- package/app/components/primer/alpha/banner.css.json +5 -5
- package/app/components/primer/alpha/button_marketing.css +1 -1
- package/app/components/primer/alpha/button_marketing.css.json +1 -4
- package/app/components/primer/alpha/dialog.css +1 -1
- package/app/components/primer/alpha/dialog.css.json +7 -7
- package/app/components/primer/alpha/layout.css +1 -1
- package/app/components/primer/alpha/layout.css.json +9 -15
- package/app/components/primer/alpha/menu.css +1 -1
- package/app/components/primer/alpha/menu.css.json +1 -3
- package/app/components/primer/alpha/segmented_control.css +1 -1
- package/app/components/primer/alpha/segmented_control.css.json +5 -5
- package/app/components/primer/alpha/select_panel_element.js +15 -13
- package/app/components/primer/alpha/tab_nav.css +1 -1
- package/app/components/primer/alpha/tab_nav.css.json +1 -3
- package/app/components/primer/alpha/text_field.css +1 -1
- package/app/components/primer/alpha/text_field.css.json +37 -78
- package/app/components/primer/alpha/toggle_switch.css +1 -1
- package/app/components/primer/alpha/toggle_switch.css.json +1 -1
- package/app/components/primer/alpha/underline_nav.css +1 -1
- package/app/components/primer/alpha/underline_nav.css.json +2 -4
- package/app/components/primer/beta/avatar_stack.css +1 -1
- package/app/components/primer/beta/avatar_stack.css.json +8 -8
- package/app/components/primer/beta/border_box.css +1 -1
- package/app/components/primer/beta/border_box.css.json +4 -4
- package/app/components/primer/beta/breadcrumbs.css +1 -1
- package/app/components/primer/beta/breadcrumbs.css.json +1 -2
- package/app/components/primer/beta/button.css +1 -1
- package/app/components/primer/beta/button.css.json +6 -8
- package/app/components/primer/beta/button_group.css +1 -1
- package/app/components/primer/beta/button_group.css.json +3 -3
- package/app/components/primer/beta/label.css +1 -1
- package/app/components/primer/beta/label.css.json +1 -2
- package/app/components/primer/beta/link.css +1 -1
- package/app/components/primer/beta/link.css.json +1 -3
- package/app/components/primer/beta/popover.css +1 -1
- package/app/components/primer/beta/popover.css.json +16 -22
- package/app/components/primer/beta/truncate.css +1 -1
- package/app/components/primer/beta/truncate.css.json +5 -5
- package/lib/primer/forms/primer_text_field.js +3 -0
- package/package.json +7 -4
- package/static/arguments.json +1 -1
- package/static/classes.json +39 -21
- package/static/info_arch.json +15 -2
- package/static/previews.json +13 -0
@@ -3,14 +3,13 @@
|
|
3
3
|
"selectors": [
|
4
4
|
":root",
|
5
5
|
".Button",
|
6
|
-
".Button:before",
|
6
|
+
":is(.Button:before)",
|
7
7
|
".Button:hover",
|
8
8
|
".Button:active",
|
9
9
|
".Button:disabled",
|
10
10
|
".Button[aria-disabled=true]",
|
11
11
|
".Button.Button--iconOnly",
|
12
|
-
"a.Button:hover",
|
13
|
-
"summary.Button:hover",
|
12
|
+
":is(a.Button,summary.Button):hover",
|
14
13
|
".Button-content",
|
15
14
|
".Button-content>:not(:last-child)",
|
16
15
|
".Button-content--alignStart",
|
@@ -23,10 +22,10 @@
|
|
23
22
|
".Button-trailingAction",
|
24
23
|
".Button--small",
|
25
24
|
".Button--small .Button-label",
|
26
|
-
".Button--small .Button-content>:not(:last-child)",
|
25
|
+
":is(.Button--small .Button-content)>:not(:last-child)",
|
27
26
|
".Button--large",
|
28
27
|
".Button--large .Button-label",
|
29
|
-
".Button--large .Button-content>:not(:last-child)",
|
28
|
+
":is(.Button--large .Button-content)>:not(:last-child)",
|
30
29
|
".Button--fullWidth",
|
31
30
|
".Button--labelWrap",
|
32
31
|
".Button--labelWrap .Button-content",
|
@@ -61,7 +60,7 @@
|
|
61
60
|
".Button--invisible[aria-disabled=true]",
|
62
61
|
".Button--invisible.Button--invisible-noVisuals .Button-label",
|
63
62
|
".Button--invisible .Button-visual",
|
64
|
-
".Button--invisible .Button-visual .Counter",
|
63
|
+
":is(.Button--invisible .Button-visual) .Counter",
|
65
64
|
".Button--link",
|
66
65
|
".Button--link:hover:not(:disabled,.Button--inactive)",
|
67
66
|
".Button--link:focus",
|
@@ -77,8 +76,7 @@
|
|
77
76
|
".Button--danger[aria-pressed=true]",
|
78
77
|
".Button--danger:disabled",
|
79
78
|
".Button--danger[aria-disabled=true]",
|
80
|
-
".Button--danger:disabled .Counter",
|
81
|
-
".Button--danger[aria-disabled=true] .Counter",
|
79
|
+
":is(.Button--danger:disabled,.Button--danger[aria-disabled=true]) .Counter",
|
82
80
|
".Button--danger .Counter",
|
83
81
|
".Button--iconOnly",
|
84
82
|
".Button--iconOnly.Button--small",
|
@@ -1 +1 @@
|
|
1
|
-
.ButtonGroup{display:inline-flex}.ButtonGroup .Button{border-radius:0;margin-inline-end:-1px;position:relative}.ButtonGroup .Button:active
|
1
|
+
.ButtonGroup{display:inline-flex}.ButtonGroup .Button{border-radius:0;margin-inline-end:-1px;position:relative}:is(.ButtonGroup .Button):active,:is(.ButtonGroup .Button):focus,:is(.ButtonGroup .Button):hover{z-index:1}.ButtonGroup>:first-child .Button{border-bottom-left-radius:var(--borderRadius-medium);border-top-left-radius:var(--borderRadius-medium)}.ButtonGroup>:last-child .Button{border-bottom-right-radius:var(--borderRadius-medium);border-top-right-radius:var(--borderRadius-medium)}
|
@@ -3,9 +3,9 @@
|
|
3
3
|
"selectors": [
|
4
4
|
".ButtonGroup",
|
5
5
|
".ButtonGroup .Button",
|
6
|
-
".ButtonGroup .Button:active",
|
7
|
-
".ButtonGroup .Button:focus",
|
8
|
-
".ButtonGroup .Button:hover",
|
6
|
+
":is(.ButtonGroup .Button):active",
|
7
|
+
":is(.ButtonGroup .Button):focus",
|
8
|
+
":is(.ButtonGroup .Button):hover",
|
9
9
|
".ButtonGroup>:first-child .Button",
|
10
10
|
".ButtonGroup>:last-child .Button"
|
11
11
|
]
|
@@ -1 +1 @@
|
|
1
|
-
.labels{position:relative}.Label,.label{border:var(--borderWidth-thin) solid var(--borderColor-default);border-radius:2em;display:inline-block;font-size:var(--text-body-size-small);font-weight:var(--base-text-weight-medium);line-height:18px;padding:0 7px;white-space:nowrap}.Label:hover
|
1
|
+
.labels{position:relative}.Label,.label{border:var(--borderWidth-thin) solid var(--borderColor-default);border-radius:2em;display:inline-block;font-size:var(--text-body-size-small);font-weight:var(--base-text-weight-medium);line-height:18px;padding:0 7px;white-space:nowrap}:is(.label,.Label):hover{-webkit-text-decoration:none;text-decoration:none}.Label--large{line-height:22px;padding-left:10px;padding-right:10px}.Label--inline{display:inline;font-size:85%;padding:.12em .5em}.Label--primary{border-color:var(--borderColor-neutral-emphasis);color:var(--fgColor-default)}.Label--secondary{border-color:var(--borderColor-default);color:var(--fgColor-muted)}.Label--accent,.Label--info{border-color:var(--borderColor-accent-emphasis);color:var(--fgColor-accent)}.Label--success{border-color:var(--borderColor-success-emphasis);color:var(--fgColor-success)}.Label--attention,.Label--warning{border-color:var(--borderColor-attention-emphasis);color:var(--fgColor-attention)}.Label--severe{border-color:var(--borderColor-severe-emphasis);color:var(--fgColor-severe)}.Label--danger{border-color:var(--borderColor-danger-emphasis);color:var(--fgColor-danger)}.Label--open{border-color:var(--borderColor-open-emphasis);color:var(--fgColor-open)}.Label--closed{border-color:var(--borderColor-closed-emphasis);color:var(--fgColor-closed)}.Label--done{border-color:var(--borderColor-done-emphasis);color:var(--fgColor-done)}.Label--sponsors{border-color:var(--borderColor-sponsors-emphasis);color:var(--fgColor-sponsors)}
|
@@ -1 +1 @@
|
|
1
|
-
.Link{color:var(--fgColor-accent);-webkit-text-decoration:none;text-decoration:none}.Link:hover{cursor:pointer}.Link:focus,.Link:hover{-webkit-text-decoration:underline;text-decoration:underline}.Link:focus,.Link:focus-visible{outline-offset:0}.Link--underline{-webkit-text-decoration:underline;text-decoration:underline}.Link--primary{color:var(--fgColor-default)!important}.Link--primary:hover{color:var(--fgColor-accent)!important}.Link--secondary{color:var(--fgColor-muted)!important}.Link--secondary:hover{color:var(--fgColor-accent)!important}.Link--muted{color:var(--fgColor-muted)!important}.Link--muted:hover{color:var(--fgColor-accent)!important;-webkit-text-decoration:none;text-decoration:none}.Link--onHover:hover{color:var(--fgColor-accent)!important;cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.Link--
|
1
|
+
.Link{color:var(--fgColor-accent);-webkit-text-decoration:none;text-decoration:none}.Link:hover{cursor:pointer}.Link:focus,.Link:hover{-webkit-text-decoration:underline;text-decoration:underline}.Link:focus,.Link:focus-visible{outline-offset:0}.Link--underline{-webkit-text-decoration:underline;text-decoration:underline}.Link--primary{color:var(--fgColor-default)!important}.Link--primary:hover{color:var(--fgColor-accent)!important}.Link--secondary{color:var(--fgColor-muted)!important}.Link--secondary:hover{color:var(--fgColor-accent)!important}.Link--muted{color:var(--fgColor-muted)!important}.Link--muted:hover{color:var(--fgColor-accent)!important;-webkit-text-decoration:none;text-decoration:none}.Link--onHover:hover{color:var(--fgColor-accent)!important;cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}:is(.Link--secondary,.Link--primary,.Link--muted):hover [class*=color-fg]{color:inherit!important}
|
@@ -13,8 +13,6 @@
|
|
13
13
|
".Link--muted",
|
14
14
|
".Link--muted:hover",
|
15
15
|
".Link--onHover:hover",
|
16
|
-
".Link--muted:hover [class*=color-fg]"
|
17
|
-
".Link--primary:hover [class*=color-fg]",
|
18
|
-
".Link--secondary:hover [class*=color-fg]"
|
16
|
+
":is(.Link--secondary,.Link--primary,.Link--muted):hover [class*=color-fg]"
|
19
17
|
]
|
20
18
|
}
|
@@ -1 +1 @@
|
|
1
|
-
.Popover{position:absolute;z-index:100}.Popover-message{background-color:var(--overlay-bgColor);border:var(--borderWidth-thin) solid var(--borderColor-default);border-radius:var(--borderRadius-medium);box-shadow:var(--shadow-floating-legacy,var(--color-shadow-large))!important;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(--borderColor-default);margin-left:-9px;top:-16px}.Popover-message:after{border:7px solid #0000;border-bottom:7px solid var(--overlay-bgColor);margin-left:-8px;top:-14px}.Popover-message--no-caret:after,.Popover-message--no-caret:before{display:none}.Popover-message--bottom
|
1
|
+
.Popover{position:absolute;z-index:100}.Popover-message{background-color:var(--overlay-bgColor);border:var(--borderWidth-thin) solid var(--borderColor-default);border-radius:var(--borderRadius-medium);box-shadow:var(--shadow-floating-legacy,var(--color-shadow-large))!important;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(--borderColor-default);margin-left:-9px;top:-16px}.Popover-message:after{border:7px solid #0000;border-bottom:7px solid var(--overlay-bgColor);margin-left:-8px;top:-14px}.Popover-message--no-caret:after,.Popover-message--no-caret:before{display:none}:is(.Popover-message--bottom,.Popover-message--bottom-right,.Popover-message--bottom-left):after,:is(.Popover-message--bottom,.Popover-message--bottom-right,.Popover-message--bottom-left):before{border-bottom-color:#0000;top:auto}:is(.Popover-message--bottom,.Popover-message--bottom-right,.Popover-message--bottom-left):before{border-top-color:var(--borderColor-default);bottom:-16px}:is(.Popover-message--bottom,.Popover-message--bottom-right,.Popover-message--bottom-left):after{border-top-color:var(--overlay-bgColor);bottom:-14px}.Popover-message--bottom-right,.Popover-message--top-right{margin-right:0;right:-9px}:is(.Popover-message--top-right,.Popover-message--bottom-right):after,:is(.Popover-message--top-right,.Popover-message--bottom-right):before{left:auto;margin-left:0}:is(.Popover-message--top-right,.Popover-message--bottom-right):before{right:20px}:is(.Popover-message--top-right,.Popover-message--bottom-right):after{right:21px}.Popover-message--bottom-left,.Popover-message--top-left{left:-9px;margin-left:0}:is(.Popover-message--top-left,.Popover-message--bottom-left):after,:is(.Popover-message--top-left,.Popover-message--bottom-left):before{left:24px;margin-left:0}:is(.Popover-message--top-left,.Popover-message--bottom-left):after{left:25px}:is(.Popover-message--right,.Popover-message--right-top,.Popover-message--right-bottom,.Popover-message--left,.Popover-message--left-top,.Popover-message--left-bottom):after,:is(.Popover-message--right,.Popover-message--right-top,.Popover-message--right-bottom,.Popover-message--left,.Popover-message--left-top,.Popover-message--left-bottom):before{border-bottom-color:#0000;left:auto;margin-left:0;top:50%}:is(.Popover-message--right,.Popover-message--right-top,.Popover-message--right-bottom,.Popover-message--left,.Popover-message--left-top,.Popover-message--left-bottom):before{margin-top:-9px}:is(.Popover-message--right,.Popover-message--right-top,.Popover-message--right-bottom,.Popover-message--left,.Popover-message--left-top,.Popover-message--left-bottom):after{margin-top:-8px}:is(.Popover-message--right,.Popover-message--right-top,.Popover-message--right-bottom):before{border-left-color:var(--borderColor-default);right:-16px}:is(.Popover-message--right,.Popover-message--right-top,.Popover-message--right-bottom):after{border-left-color:var(--overlay-bgColor);right:-14px}:is(.Popover-message--left,.Popover-message--left-top,.Popover-message--left-bottom):before{border-right-color:var(--borderColor-default);left:-16px}:is(.Popover-message--left,.Popover-message--left-top,.Popover-message--left-bottom):after{border-right-color:var(--overlay-bgColor);left:-14px}:is(.Popover-message--right-top,.Popover-message--left-top):after,:is(.Popover-message--right-top,.Popover-message--left-top):before{top:24px}:is(.Popover-message--right-bottom,.Popover-message--left-bottom):after,:is(.Popover-message--right-bottom,.Popover-message--left-bottom):before{top:auto}:is(.Popover-message--right-bottom,.Popover-message--left-bottom):before{bottom:16px}:is(.Popover-message--right-bottom,.Popover-message--left-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(--stack-gap-condensed);right:auto;top:auto;width:auto!important}.Popover-message>.btn-octicon{padding:var(--control-medium-paddingInline-normal)!important}.Popover-message:after,.Popover-message:before{display:none}}
|
@@ -7,32 +7,26 @@
|
|
7
7
|
".Popover-message:before",
|
8
8
|
".Popover-message--no-caret:after",
|
9
9
|
".Popover-message--no-caret:before",
|
10
|
-
".Popover-message--bottom-left:after",
|
11
|
-
".Popover-message--bottom-left:before",
|
12
|
-
".Popover-message--bottom-right:after",
|
13
|
-
".Popover-message--bottom-right:before",
|
14
|
-
".Popover-message--bottom:after",
|
15
|
-
".Popover-message--bottom:before",
|
10
|
+
":is(.Popover-message--bottom,.Popover-message--bottom-right,.Popover-message--bottom-left):after",
|
11
|
+
":is(.Popover-message--bottom,.Popover-message--bottom-right,.Popover-message--bottom-left):before",
|
16
12
|
".Popover-message--bottom-right",
|
17
13
|
".Popover-message--top-right",
|
18
|
-
".Popover-message--top-right:after",
|
19
|
-
".Popover-message--top-right:before",
|
14
|
+
":is(.Popover-message--top-right,.Popover-message--bottom-right):after",
|
15
|
+
":is(.Popover-message--top-right,.Popover-message--bottom-right):before",
|
20
16
|
".Popover-message--bottom-left",
|
21
17
|
".Popover-message--top-left",
|
22
|
-
".Popover-message--top-left:after",
|
23
|
-
".Popover-message--top-left:before",
|
24
|
-
".Popover-message--left-bottom:after",
|
25
|
-
".Popover-message--left-bottom:before",
|
26
|
-
".Popover-message--
|
27
|
-
".Popover-message--
|
28
|
-
".Popover-message--left:
|
29
|
-
".Popover-message--left:
|
30
|
-
".Popover-message--right-
|
31
|
-
".Popover-message--right-
|
32
|
-
".Popover-message--right-
|
33
|
-
".Popover-message--right-
|
34
|
-
".Popover-message--right:after",
|
35
|
-
".Popover-message--right:before",
|
18
|
+
":is(.Popover-message--top-left,.Popover-message--bottom-left):after",
|
19
|
+
":is(.Popover-message--top-left,.Popover-message--bottom-left):before",
|
20
|
+
":is(.Popover-message--right,.Popover-message--right-top,.Popover-message--right-bottom,.Popover-message--left,.Popover-message--left-top,.Popover-message--left-bottom):after",
|
21
|
+
":is(.Popover-message--right,.Popover-message--right-top,.Popover-message--right-bottom,.Popover-message--left,.Popover-message--left-top,.Popover-message--left-bottom):before",
|
22
|
+
":is(.Popover-message--right,.Popover-message--right-top,.Popover-message--right-bottom):before",
|
23
|
+
":is(.Popover-message--right,.Popover-message--right-top,.Popover-message--right-bottom):after",
|
24
|
+
":is(.Popover-message--left,.Popover-message--left-top,.Popover-message--left-bottom):before",
|
25
|
+
":is(.Popover-message--left,.Popover-message--left-top,.Popover-message--left-bottom):after",
|
26
|
+
":is(.Popover-message--right-top,.Popover-message--left-top):after",
|
27
|
+
":is(.Popover-message--right-top,.Popover-message--left-top):before",
|
28
|
+
":is(.Popover-message--right-bottom,.Popover-message--left-bottom):after",
|
29
|
+
":is(.Popover-message--right-bottom,.Popover-message--left-bottom):before",
|
36
30
|
".Popover-message--large",
|
37
31
|
".Popover-message>.btn-octicon"
|
38
32
|
]
|
@@ -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(--control-small-gap)}.Truncate
|
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}:is(.Truncate>.Truncate-text)+.Truncate-text{margin-left:var(--control-small-gap)}.Truncate-text--primary:is(.Truncate>.Truncate-text){flex-basis:200%}.Truncate-text--expandable:is(.Truncate>.Truncate-text):active,.Truncate-text--expandable:is(.Truncate>.Truncate-text):focus,.Truncate-text--expandable:is(.Truncate>.Truncate-text):hover{cursor:pointer;flex-shrink:0;max-width:100%!important}
|
@@ -3,10 +3,10 @@
|
|
3
3
|
"selectors": [
|
4
4
|
".Truncate",
|
5
5
|
".Truncate>.Truncate-text",
|
6
|
-
".Truncate>.Truncate-text+.Truncate-text",
|
7
|
-
".Truncate
|
8
|
-
".Truncate
|
9
|
-
".Truncate
|
10
|
-
".Truncate
|
6
|
+
":is(.Truncate>.Truncate-text)+.Truncate-text",
|
7
|
+
".Truncate-text--primary:is(.Truncate>.Truncate-text)",
|
8
|
+
".Truncate-text--expandable:is(.Truncate>.Truncate-text):active",
|
9
|
+
".Truncate-text--expandable:is(.Truncate>.Truncate-text):focus",
|
10
|
+
".Truncate-text--expandable:is(.Truncate>.Truncate-text):hover"
|
11
11
|
]
|
12
12
|
}
|
@@ -19,6 +19,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
19
19
|
var _PrimerTextFieldElement_abortController;
|
20
20
|
import '@github/auto-check-element';
|
21
21
|
import { controller, target } from '@github/catalyst';
|
22
|
+
const SCREENREADER_TEXT_CLASSNAME = 'spinner-screenreader-text';
|
22
23
|
let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
|
23
24
|
constructor() {
|
24
25
|
super(...arguments);
|
@@ -83,10 +84,12 @@ let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
|
|
83
84
|
}
|
84
85
|
showLeadingSpinner() {
|
85
86
|
this.leadingSpinner?.removeAttribute('hidden');
|
87
|
+
this.leadingSpinner?.querySelector(SCREENREADER_TEXT_CLASSNAME)?.removeAttribute('hidden');
|
86
88
|
this.leadingVisual?.setAttribute('hidden', '');
|
87
89
|
}
|
88
90
|
hideLeadingSpinner() {
|
89
91
|
this.leadingSpinner?.setAttribute('hidden', '');
|
92
|
+
this.leadingSpinner?.querySelector(SCREENREADER_TEXT_CLASSNAME)?.setAttribute('hidden', '');
|
90
93
|
this.leadingVisual?.removeAttribute('hidden');
|
91
94
|
}
|
92
95
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/view-components",
|
3
|
-
"version": "0.31.
|
3
|
+
"version": "0.31.1-rc.4d4c576b",
|
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",
|
@@ -38,6 +38,7 @@
|
|
38
38
|
"lint:eslint": "eslint 'app/components/**/*.ts'",
|
39
39
|
"lint:eslint:fix": "eslint 'app/components/**/*.ts' --fix",
|
40
40
|
"changeset:version": "changeset version && script/version",
|
41
|
+
"build": "script/build-assets",
|
41
42
|
"build:js": "script/build-assets js",
|
42
43
|
"build:css": "script/build-assets css"
|
43
44
|
},
|
@@ -58,7 +59,7 @@
|
|
58
59
|
"devDependencies": {
|
59
60
|
"@changesets/changelog-github": "^0.5.0",
|
60
61
|
"@changesets/cli": "^2.24.1",
|
61
|
-
"@github/axe-github": "^0.
|
62
|
+
"@github/axe-github": "^0.7.0",
|
62
63
|
"@github/browserslist-config": "^1.0.0",
|
63
64
|
"@github/markdownlint-github": "^0.6.0",
|
64
65
|
"@github/prettier-config": "0.0.6",
|
@@ -84,14 +85,16 @@
|
|
84
85
|
"postcss-cli": "^11.0.0",
|
85
86
|
"postcss-import": "^16.0.0",
|
86
87
|
"postcss-mixins": "^10.0.0",
|
87
|
-
"postcss-preset-env": "^
|
88
|
+
"postcss-preset-env": "^10.0.2",
|
88
89
|
"prettier": "^3.3.2",
|
89
90
|
"rollup": "^2.79.1",
|
90
91
|
"rollup-plugin-terser": "^7.0.2",
|
91
92
|
"stylelint": "^16.1.0",
|
92
93
|
"stylelint-config-standard": "^36.0.0",
|
93
94
|
"tslib": "^2.4.0",
|
94
|
-
"typescript": "^5.2.2"
|
95
|
+
"typescript": "^5.2.2",
|
96
|
+
"vite": "^5.3.5",
|
97
|
+
"vite-plugin-ruby": "^5.0.0"
|
95
98
|
},
|
96
99
|
"prettier": "@github/prettier-config",
|
97
100
|
"browserslist": "extends @github/browserslist-config"
|
package/static/arguments.json
CHANGED
@@ -2388,7 +2388,7 @@
|
|
2388
2388
|
"name": "select_variant",
|
2389
2389
|
"type": "Symbol",
|
2390
2390
|
"default": "`:single`",
|
2391
|
-
"description": "One of `:multiple`, `:
|
2391
|
+
"description": "One of `:multiple`, `:none`, or `:single`."
|
2392
2392
|
},
|
2393
2393
|
{
|
2394
2394
|
"name": "fetch_strategy",
|
package/static/classes.json
CHANGED
@@ -251,6 +251,9 @@
|
|
251
251
|
"FormControl-checkbox-wrap": [
|
252
252
|
"Primer::Alpha::TextField"
|
253
253
|
],
|
254
|
+
"FormControl-error": [
|
255
|
+
"Primer::Alpha::TextField"
|
256
|
+
],
|
254
257
|
"FormControl-horizontalGroup": [
|
255
258
|
"Primer::Alpha::TextField"
|
256
259
|
],
|
@@ -266,12 +269,27 @@
|
|
266
269
|
"FormControl-input": [
|
267
270
|
"Primer::Alpha::TextField"
|
268
271
|
],
|
272
|
+
"FormControl-input-trailingAction--divider": [
|
273
|
+
"Primer::Alpha::TextField"
|
274
|
+
],
|
269
275
|
"FormControl-input-wrap": [
|
270
276
|
"Primer::Alpha::TextField"
|
271
277
|
],
|
278
|
+
"FormControl-inset": [
|
279
|
+
"Primer::Alpha::TextField"
|
280
|
+
],
|
272
281
|
"FormControl-label": [
|
273
282
|
"Primer::Alpha::TextField"
|
274
283
|
],
|
284
|
+
"FormControl-large": [
|
285
|
+
"Primer::Alpha::TextField"
|
286
|
+
],
|
287
|
+
"FormControl-medium": [
|
288
|
+
"Primer::Alpha::TextField"
|
289
|
+
],
|
290
|
+
"FormControl-monospace": [
|
291
|
+
"Primer::Alpha::TextField"
|
292
|
+
],
|
275
293
|
"FormControl-radio-group-wrap": [
|
276
294
|
"Primer::Alpha::TextField"
|
277
295
|
],
|
@@ -284,15 +302,24 @@
|
|
284
302
|
"FormControl-select-wrap": [
|
285
303
|
"Primer::Alpha::TextField"
|
286
304
|
],
|
305
|
+
"FormControl-small": [
|
306
|
+
"Primer::Alpha::TextField"
|
307
|
+
],
|
287
308
|
"FormControl-spacingWrapper": [
|
288
309
|
"Primer::Alpha::TextField"
|
289
310
|
],
|
311
|
+
"FormControl-success": [
|
312
|
+
"Primer::Alpha::TextField"
|
313
|
+
],
|
290
314
|
"FormControl-textarea": [
|
291
315
|
"Primer::Alpha::TextField"
|
292
316
|
],
|
293
317
|
"FormControl-toggleSwitchInput": [
|
294
318
|
"Primer::Alpha::TextField"
|
295
319
|
],
|
320
|
+
"FormControl-warning": [
|
321
|
+
"Primer::Alpha::TextField"
|
322
|
+
],
|
296
323
|
"Label": [
|
297
324
|
"Primer::Beta::Label"
|
298
325
|
],
|
@@ -347,6 +374,12 @@
|
|
347
374
|
"Layout-divider": [
|
348
375
|
"Primer::Alpha::Layout"
|
349
376
|
],
|
377
|
+
"Layout-divider--flowRow-hidden": [
|
378
|
+
"Primer::Alpha::Layout"
|
379
|
+
],
|
380
|
+
"Layout-divider--flowRow-shallow": [
|
381
|
+
"Primer::Alpha::Layout"
|
382
|
+
],
|
350
383
|
"Layout-main": [
|
351
384
|
"Primer::Alpha::Layout"
|
352
385
|
],
|
@@ -414,9 +447,6 @@
|
|
414
447
|
"Popover-message": [
|
415
448
|
"Primer::Beta::Popover"
|
416
449
|
],
|
417
|
-
"Popover-message--bottom": [
|
418
|
-
"Primer::Beta::Popover"
|
419
|
-
],
|
420
450
|
"Popover-message--bottom-left": [
|
421
451
|
"Primer::Beta::Popover"
|
422
452
|
],
|
@@ -426,27 +456,9 @@
|
|
426
456
|
"Popover-message--large": [
|
427
457
|
"Primer::Beta::Popover"
|
428
458
|
],
|
429
|
-
"Popover-message--left": [
|
430
|
-
"Primer::Beta::Popover"
|
431
|
-
],
|
432
|
-
"Popover-message--left-bottom": [
|
433
|
-
"Primer::Beta::Popover"
|
434
|
-
],
|
435
|
-
"Popover-message--left-top": [
|
436
|
-
"Primer::Beta::Popover"
|
437
|
-
],
|
438
459
|
"Popover-message--no-caret": [
|
439
460
|
"Primer::Beta::Popover"
|
440
461
|
],
|
441
|
-
"Popover-message--right": [
|
442
|
-
"Primer::Beta::Popover"
|
443
|
-
],
|
444
|
-
"Popover-message--right-bottom": [
|
445
|
-
"Primer::Beta::Popover"
|
446
|
-
],
|
447
|
-
"Popover-message--right-top": [
|
448
|
-
"Primer::Beta::Popover"
|
449
|
-
],
|
450
462
|
"Popover-message--top-left": [
|
451
463
|
"Primer::Beta::Popover"
|
452
464
|
],
|
@@ -591,6 +603,12 @@
|
|
591
603
|
"Truncate": [
|
592
604
|
"Primer::Beta::Truncate"
|
593
605
|
],
|
606
|
+
"Truncate-text--expandable": [
|
607
|
+
"Primer::Beta::Truncate"
|
608
|
+
],
|
609
|
+
"Truncate-text--primary": [
|
610
|
+
"Primer::Beta::Truncate"
|
611
|
+
],
|
594
612
|
"UnderlineNav": [
|
595
613
|
"Primer::Alpha::UnderlineNav"
|
596
614
|
],
|
package/static/info_arch.json
CHANGED
@@ -7533,7 +7533,7 @@
|
|
7533
7533
|
},
|
7534
7534
|
{
|
7535
7535
|
"fully_qualified_name": "Primer::Alpha::SelectPanel",
|
7536
|
-
"description": "Select panels allow for selecting from a large number of options and can be thought of as a more capable\nversion of the traditional HTML `<select>` element.\n\nSelect panels:\n\n1. feature an input field at the top that allows an end user to filter the list of results.\n1. can render their items statically or dynamically by fetching results from the server.\n1. allow selecting a single item or multiple items.\n1. permit leading visuals like Octicons, avatars, and custom SVGs.\n1. can be used as form inputs in Rails forms.\n\n## Static list items\n\nThe Rails `SelectPanel` component allows items to be provided statically or loaded dynamically from the\nserver. Providing items statically is done using a fetch strategy of `:local` in combination with the\n`item` slot:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel.new(fetch_strategy: :local))) do |panel| %>\n <% panel.with_show_button { \"Select item\" } %>\n <% panel.with_item(label: \"Item 1\") %>\n <% panel.with_item(label: \"Item 2\") %>\n<% end %>\n```\n\n## Dynamic list items\n\nList items can also be fetched dynamically from the server and will require creating a Rails controller action\nto respond with the list of items in addition to rendering the `SelectPanel` instance. Render the instance as\nnormal, providing your desired [fetch strategy](#fetch-strategies):\n\n```erb\n<%= render(\n Primer::Alpha::SelectPanel.new(\n fetch_strategy: :remote,\n src: search_items_path # perhaps a Rails URL helper\n )\n) %>\n```\n\nDefine a controller action to serve the list of items. The `SelectPanel` component passes any filter text in\nthe `q=` URL parameter.\n\n```ruby\nclass SearchItemsController < ApplicationController\n def show\n # NOTE: params[:q] may be nil since there is no filter string available\n # when the panel is first opened\n @results = SomeModel.search(params[:q] || \"\")\n end\nend\n```\n\nResponses must be HTML fragments, eg. have a content type of `text/html+fragment`. This content type isn't\navailable by default in Rails, so you may have to register it eg. in an initializer:\n\n```ruby\nMime::Type.register(\"text/fragment+html\", :html_fragment)\n```\n\nRender a `Primer::Alpha::SelectPanel::ItemList` in the action's template, search_items/show.html_fragment.erb:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel::ItemList.new) do |list| %>\n <% @results.each do |result| %>\n <% list.with_item(label: result.title) do |item| %>\n <% item.with_description(result.description) %>\n <% end %>\n <% end %>\n<% end %>\n```\n\n### Selection consistency\n\nThe `SelectPanel` component automatically \"remembers\" which items have been selected across item fetch requests,\nmeaning the controller that renders dynamic list items does not (and should not) remember these selections or\npersist them until the user has confirmed them, either by submitting the form or otherwise indicating completion.\nThe `SelectPanel` component does not include unconfirmed selection data in requests.\n\n## Fetch strategies\n\nThe list of items can be fetched from a remote URL, or provided as a static list, configured using the\n`fetch_strategy` attribute. Fetch strategies are summarized below.\n\n1. `:remote`: a query is made to the URL in the `src` attribute every time the input field changes.\n\n2. `:eventually_local`: a query is made to the URL in the `src` attribute when the panel is first opened. The\n results are \"remembered\" and filtered in-memory for all subsequent filter operations, i.e. when the input\n field changes.\n\n3. `:local`: the list of items is provided statically ahead of time and filtered in-memory. No requests are made\n to the server.\n\n## Customizing filter behavior\n\nIf the fetch strategy is `:remote`, then filtering is handled server-side. The server should render a\n`Primer::Alpha::SelectPanel::ItemList` (an alias of {{#link_to_component}}Primer::Alpha::ActionList{{/link_to_component}})\nin the response containing the filtered list of items. The component achieves remote fetching via the\n[remote-input-element](https://github.com/github/remote-input-element), which sends a request to the\nserver with the filter string in the `q=` parameter. Responses must be HTML fragments, eg. have a content\ntype of `text/html+fragment`.\n\n### Local filtering\n\nIf the fetch strategy is `:local` or `:eventually_local`, filtering is performed client-side. Filter behavior can\nbe customized in JavaScript by setting the `filterFn` attribute on the instance of `SelectPanelElement`, eg:\n\n```javascript\ndocument.querySelector(\"select-panel\").filterFn = (item: HTMLElement, query: string): boolean => {\n // return true if the item should be displayed, false otherwise\n}\n```\n\nThe element's default filter function uses the value of the `data-filter-string` attribute, falling back to the\nelement's `innerText` property. It performs a case-insensitive substring match against the filter string.\n\n### `SelectPanel`s as form inputs\n\n`SelectPanel`s can be used as form inputs. They behave very similarly to how HTML `<select>` boxes behave, and\nplay nicely with Rails' built-in form mechanisms. Pass arguments via the `form_arguments:` argument, including\nthe Rails form builder object and the name of the field. Each list item must also have a value specified in\n`content_arguments: { data: { value: } }`.\n\n```erb\n<% form_with(model: Address.new) do |f| %>\n <%= render(Primer::Alpha::SelectPanel.new(form_arguments: { builder: f, name: \"country\" })) do |menu| %>\n <% countries.each do |country|\n <% menu.with_item(label: country.name, content_arguments: { data: { value: country.code } }) %>\n <% end %>\n <% end %>\n<% end %>\n```\n\nThe value of the `data: { value: ... }` argument is sent to the server on submit, keyed using the name provided above\n(eg. `\"country\"`). If no value is provided for an item, the value of that item is the item's label. Here's the\ncorresponding `AddressesController` that might be written to handle the form above:\n\n```ruby\nclass AddressesController < ApplicationController\n def create\n puts \"You chose #{address_params[:country]} as your country\"\n end\n\n private\n\n def address_params\n params.require(:address).permit(:country)\n end\nend\n```\n\nIf items are provided dynamically, things become a bit more complicated. The `form_for` or `form_with` method call\nhappens in the view that renders the `SelectPanel`, which means the form builder object but isn't available in the\nview that renders the list items. In such a case, it can be useful to create an instance of the form builder maually:\n\n```erb\n<% builder = ActionView::Helpers::FormBuilder.new(\n \"address\", # the name of the model, used to wrap input names, eg 'address[country_code]'\n nil, # object (eg. the Address instance, which we can omit)\n self, # template\n {} # options\n) %>\n<%= render(Primer::Alpha::SelectPanel::ItemList.new(\n form_arguments: { builder: builder, name: \"country\" }\n)) do |list| %>\n <% countries.each do |country| %>\n <% menu.with_item(label: country.name, data: { value: country.code }) %>\n <% end %>\n<% end %>\n```\n\n### JavaScript API\n\n`SelectPanel`s render a `<select-panel>` custom element that exposes behavior to the client.\n\n#### Utility methods\n\n* `show()`: Manually open the panel. Under normal circumstances, a show button is used to show the panel, but this method exists to support unusual use-cases.\n* `hide()`: Manually hides (closes) the panel.\n\n#### Query methods\n\n* `getItemById(itemId: string): Element`: Returns the item's HTML `<li>` element. The return value can be passed as the `item` argument to the other methods listed below.\n* `isItemChecked(item: Element): boolean`: Returns `true` if the item is checked, `false` otherwise.\n* `isItemHidden(item: Element): boolean`: Returns `true` if the item is hidden, `false` otherwise.\n* `isItemDisabled(item: Element): boolean`: Returns `true` if the item is disabled, `false` otherwise.\n\nNOTE: Item IDs are special values provided by the user that are attached to `SelectPanel` list items as the `data-item-id`\nHTML attribute. Item IDs can be provided by passing an `item_id:` attribute when adding items to the panel, eg:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel.new) do |panel| %>\n <% panel.with_item(item_id: \"my-id\") %>\n<% end %>\n```\n\nThe same is true when rendering `ItemList`s:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel::ItemList.new) do |list| %>\n <% list.with_item(item_id: \"my-id\") %>\n<% end %>\n```\n\n#### State methods\n\n* `enableItem(item: Element)`: Enables the item, i.e. makes it clickable by the mouse and keyboard.\n* `disableItem(item: Element)`: Disables the item, i.e. makes it unclickable by the mouse and keyboard.\n* `checkItem(item: Element)`: Checks the item. Only has an effect in single- and multi-select modes.\n* `uncheckItem(item: Element)`: Unchecks the item. Only has an effect in multi-select mode, since items cannot be unchecked in single-select mode.\n\n#### Events\n\n|Name |Type |Bubbles |Cancelable |\n|:--------------------|:------------------------------------------|:-------|:----------|\n|`itemActivated` |`CustomEvent<ItemActivatedEvent>` |Yes |No |\n|`beforeItemActivated`|`CustomEvent<ItemActivatedEvent>` |Yes |Yes |\n|`dialog:open` |`CustomEvent<{dialog: HTMLDialogElement}>` |No |No |\n|`panelClosed` |`CustomEvent<{panel: SelectPanelElement}>` |Yes |No |\n\n_Item activation_\n\nThe `<select-panel>` element fires an `itemActivated` event whenever an item is activated (eg. clicked) via the mouse or keyboard.\n\n```typescript\ndocument.querySelector(\"select-panel\").addEventListener(\n \"itemActivated\",\n (event: CustomEvent<ItemActivatedEvent>) => {\n event.detail.item // Element: the <li> item that was activated\n event.detail.checked // boolean: whether or not the result of the activation checked the item\n }\n)\n```\n\nThe `beforeItemActivated` event fires before an item is activated. Canceling this event will prevent the item\nfrom being activated.\n\n```typescript\ndocument.querySelector(\"select-panel\").addEventListener(\n \"beforeItemActivated\",\n (event: CustomEvent<ItemActivatedEvent>) => {\n event.detail.item // Element: the <li> item that was activated\n event.detail.checked // boolean: whether or not the result of the activation checked the item\n event.preventDefault() // Cancel the event to prevent activation (eg. checking/unchecking)\n }\n)\n```",
|
7536
|
+
"description": "Select panels allow for selecting from a large number of options and can be thought of as a more capable\nversion of the traditional HTML `<select>` element.\n\nSelect panels:\n\n1. feature an input field at the top that allows an end user to filter the list of results.\n1. can render their items statically or dynamically by fetching results from the server.\n1. allow selecting a single item or multiple items.\n1. permit leading visuals like Octicons, avatars, and custom SVGs.\n1. can be used as form inputs in Rails forms.\n\n## Static list items\n\nThe Rails `SelectPanel` component allows items to be provided statically or loaded dynamically from the\nserver. Providing items statically is done using a fetch strategy of `:local` in combination with the\n`item` slot:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel.new(fetch_strategy: :local))) do |panel| %>\n <% panel.with_show_button { \"Select item\" } %>\n <% panel.with_item(label: \"Item 1\") %>\n <% panel.with_item(label: \"Item 2\") %>\n<% end %>\n```\n\n## Dynamic list items\n\nList items can also be fetched dynamically from the server and will require creating a Rails controller action\nto respond with the list of items in addition to rendering the `SelectPanel` instance. Render the instance as\nnormal, providing your desired [fetch strategy](#fetch-strategies):\n\n```erb\n<%= render(\n Primer::Alpha::SelectPanel.new(\n fetch_strategy: :remote,\n src: search_items_path # perhaps a Rails URL helper\n )\n) %>\n```\n\nDefine a controller action to serve the list of items. The `SelectPanel` component passes any filter text in\nthe `q=` URL parameter.\n\n```ruby\nclass SearchItemsController < ApplicationController\n def show\n # NOTE: params[:q] may be nil since there is no filter string available\n # when the panel is first opened\n @results = SomeModel.search(params[:q] || \"\")\n end\nend\n```\n\nResponses must be HTML fragments, eg. have a content type of `text/html+fragment`. This content type isn't\navailable by default in Rails, so you may have to register it eg. in an initializer:\n\n```ruby\nMime::Type.register(\"text/fragment+html\", :html_fragment)\n```\n\nRender a `Primer::Alpha::SelectPanel::ItemList` in the action's template, search_items/show.html_fragment.erb:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel::ItemList.new) do |list| %>\n <% @results.each do |result| %>\n <% list.with_item(label: result.title) do |item| %>\n <% item.with_description(result.description) %>\n <% end %>\n <% end %>\n<% end %>\n```\n\n### Selection consistency\n\nThe `SelectPanel` component automatically \"remembers\" which items have been selected across item fetch requests,\nmeaning the controller that renders dynamic list items does not (and should not) remember these selections or\npersist them until the user has confirmed them, either by submitting the form or otherwise indicating completion.\nThe `SelectPanel` component does not include unconfirmed selection data in requests.\n\n## Fetch strategies\n\nThe list of items can be fetched from a remote URL, or provided as a static list, configured using the\n`fetch_strategy` attribute. Fetch strategies are summarized below.\n\n1. `:remote`: a query is made to the URL in the `src` attribute every time the input field changes.\n\n2. `:eventually_local`: a query is made to the URL in the `src` attribute when the panel is first opened. The\n results are \"remembered\" and filtered in-memory for all subsequent filter operations, i.e. when the input\n field changes.\n\n3. `:local`: the list of items is provided statically ahead of time and filtered in-memory. No requests are made\n to the server.\n\n## Customizing filter behavior\n\nIf the fetch strategy is `:remote`, then filtering is handled server-side. The server should render a\n`Primer::Alpha::SelectPanel::ItemList` (an alias of {{#link_to_component}}Primer::Alpha::ActionList{{/link_to_component}})\nin the response containing the filtered list of items. The component achieves remote fetching via the\n[remote-input-element](https://github.com/github/remote-input-element), which sends a request to the\nserver with the filter string in the `q=` parameter. Responses must be HTML fragments, eg. have a content\ntype of `text/html+fragment`.\n\n### Local filtering\n\nIf the fetch strategy is `:local` or `:eventually_local`, filtering is performed client-side. Filter behavior can\nbe customized in JavaScript by setting the `filterFn` attribute on the instance of `SelectPanelElement`, eg:\n\n```javascript\ndocument.querySelector(\"select-panel\").filterFn = (item: HTMLElement, query: string): boolean => {\n // return true if the item should be displayed, false otherwise\n}\n```\n\nThe element's default filter function uses the value of the `data-filter-string` attribute, falling back to the\nelement's `innerText` property. It performs a case-insensitive substring match against the filter string.\n\n### `SelectPanel`s as form inputs\n\n`SelectPanel`s can be used as form inputs. They behave very similarly to how HTML `<select>` boxes behave, and\nplay nicely with Rails' built-in form mechanisms. Pass arguments via the `form_arguments:` argument, including\nthe Rails form builder object and the name of the field. Each list item must also have a value specified in\n`content_arguments: { data: { value: } }`.\n\n```erb\n<% form_with(model: Address.new) do |f| %>\n <%= render(Primer::Alpha::SelectPanel.new(form_arguments: { builder: f, name: \"country\" })) do |menu| %>\n <% countries.each do |country|\n <% menu.with_item(label: country.name, content_arguments: { data: { value: country.code } }) %>\n <% end %>\n <% end %>\n<% end %>\n```\n\nThe value of the `data: { value: ... }` argument is sent to the server on submit, keyed using the name provided above\n(eg. `\"country\"`). If no value is provided for an item, the value of that item is the item's label. Here's the\ncorresponding `AddressesController` that might be written to handle the form above:\n\n```ruby\nclass AddressesController < ApplicationController\n def create\n puts \"You chose #{address_params[:country]} as your country\"\n end\n\n private\n\n def address_params\n params.require(:address).permit(:country)\n end\nend\n```\n\nIf items are provided dynamically, things become a bit more complicated. The `form_for` or `form_with` method call\nhappens in the view that renders the `SelectPanel`, which means the form builder object but isn't available in the\nview that renders the list items. In such a case, it can be useful to create an instance of the form builder maually:\n\n```erb\n<% builder = ActionView::Helpers::FormBuilder.new(\n \"address\", # the name of the model, used to wrap input names, eg 'address[country]'\n nil, # object (eg. the Address instance, which we can omit)\n self, # template\n {} # options\n) %>\n<%= render(Primer::Alpha::SelectPanel::ItemList.new(\n form_arguments: { builder: builder, name: \"country\" }\n)) do |list| %>\n <% countries.each do |country| %>\n <% menu.with_item(label: country.name, content_arguments: { data: { value: country.code } }) %>\n <% end %>\n<% end %>\n```\n\n### JavaScript API\n\n`SelectPanel`s render a `<select-panel>` custom element that exposes behavior to the client.\n\n#### Utility methods\n\n* `show()`: Manually open the panel. Under normal circumstances, a show button is used to show the panel, but this method exists to support unusual use-cases.\n* `hide()`: Manually hides (closes) the panel.\n\n#### Query methods\n\n* `getItemById(itemId: string): Element`: Returns the item's HTML `<li>` element. The return value can be passed as the `item` argument to the other methods listed below.\n* `isItemChecked(item: Element): boolean`: Returns `true` if the item is checked, `false` otherwise.\n* `isItemHidden(item: Element): boolean`: Returns `true` if the item is hidden, `false` otherwise.\n* `isItemDisabled(item: Element): boolean`: Returns `true` if the item is disabled, `false` otherwise.\n\nNOTE: Item IDs are special values provided by the user that are attached to `SelectPanel` list items as the `data-item-id`\nHTML attribute. Item IDs can be provided by passing an `item_id:` attribute when adding items to the panel, eg:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel.new) do |panel| %>\n <% panel.with_item(item_id: \"my-id\") %>\n<% end %>\n```\n\nThe same is true when rendering `ItemList`s:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel::ItemList.new) do |list| %>\n <% list.with_item(item_id: \"my-id\") %>\n<% end %>\n```\n\n#### State methods\n\n* `enableItem(item: Element)`: Enables the item, i.e. makes it clickable by the mouse and keyboard.\n* `disableItem(item: Element)`: Disables the item, i.e. makes it unclickable by the mouse and keyboard.\n* `checkItem(item: Element)`: Checks the item. Only has an effect in single- and multi-select modes.\n* `uncheckItem(item: Element)`: Unchecks the item. Only has an effect in multi-select mode, since items cannot be unchecked in single-select mode.\n\n#### Events\n\n|Name |Type |Bubbles |Cancelable |\n|:--------------------|:------------------------------------------|:-------|:----------|\n|`itemActivated` |`CustomEvent<ItemActivatedEvent>` |Yes |No |\n|`beforeItemActivated`|`CustomEvent<ItemActivatedEvent>` |Yes |Yes |\n|`dialog:open` |`CustomEvent<{dialog: HTMLDialogElement}>` |No |No |\n|`panelClosed` |`CustomEvent<{panel: SelectPanelElement}>` |Yes |No |\n\n_Item activation_\n\nThe `<select-panel>` element fires an `itemActivated` event whenever an item is activated (eg. clicked) via the mouse or keyboard.\n\n```typescript\ndocument.querySelector(\"select-panel\").addEventListener(\n \"itemActivated\",\n (event: CustomEvent<ItemActivatedEvent>) => {\n event.detail.item // Element: the <li> item that was activated\n event.detail.checked // boolean: whether or not the result of the activation checked the item\n }\n)\n```\n\nThe `beforeItemActivated` event fires before an item is activated. Canceling this event will prevent the item\nfrom being activated.\n\n```typescript\ndocument.querySelector(\"select-panel\").addEventListener(\n \"beforeItemActivated\",\n (event: CustomEvent<ItemActivatedEvent>) => {\n event.detail.item // Element: the <li> item that was activated\n event.detail.checked // boolean: whether or not the result of the activation checked the item\n event.preventDefault() // Cancel the event to prevent activation (eg. checking/unchecking)\n }\n)\n```",
|
7537
7537
|
"accessibility_docs": null,
|
7538
7538
|
"is_form_component": false,
|
7539
7539
|
"is_published": true,
|
@@ -7573,7 +7573,7 @@
|
|
7573
7573
|
"name": "select_variant",
|
7574
7574
|
"type": "Symbol",
|
7575
7575
|
"default": "`:single`",
|
7576
|
-
"description": "One of `:multiple`, `:
|
7576
|
+
"description": "One of `:multiple`, `:none`, or `:single`."
|
7577
7577
|
},
|
7578
7578
|
{
|
7579
7579
|
"name": "fetch_strategy",
|
@@ -8118,6 +8118,19 @@
|
|
8118
8118
|
"color-contrast"
|
8119
8119
|
]
|
8120
8120
|
}
|
8121
|
+
},
|
8122
|
+
{
|
8123
|
+
"preview_path": "primer/alpha/select_panel/no_values",
|
8124
|
+
"name": "no_values",
|
8125
|
+
"snapshot": "interactive",
|
8126
|
+
"skip_rules": {
|
8127
|
+
"wont_fix": [
|
8128
|
+
"region"
|
8129
|
+
],
|
8130
|
+
"will_fix": [
|
8131
|
+
"color-contrast"
|
8132
|
+
]
|
8133
|
+
}
|
8121
8134
|
}
|
8122
8135
|
],
|
8123
8136
|
"subcomponents": [
|
package/static/previews.json
CHANGED
@@ -6173,6 +6173,19 @@
|
|
6173
6173
|
"color-contrast"
|
6174
6174
|
]
|
6175
6175
|
}
|
6176
|
+
},
|
6177
|
+
{
|
6178
|
+
"preview_path": "primer/alpha/select_panel/no_values",
|
6179
|
+
"name": "no_values",
|
6180
|
+
"snapshot": "interactive",
|
6181
|
+
"skip_rules": {
|
6182
|
+
"wont_fix": [
|
6183
|
+
"region"
|
6184
|
+
],
|
6185
|
+
"will_fix": [
|
6186
|
+
"color-contrast"
|
6187
|
+
]
|
6188
|
+
}
|
6176
6189
|
}
|
6177
6190
|
]
|
6178
6191
|
},
|