@primer/components 31.2.1-rc.7fa29a87 → 31.2.1-rc.a088bdc0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release_canary.yml +1 -0
- package/CHANGELOG.md +5 -3
- package/docs/content/ActionList2.mdx +8 -7
- package/lib/ActionList2/Group.d.ts +28 -2
- package/lib/ActionList2/Group.js +55 -6
- package/lib/ActionList2/Group.jsx +33 -4
- package/lib/ActionList2/List.d.ts +1 -1
- package/lib/Autocomplete/Autocomplete.d.ts +3 -3
- package/lib/Autocomplete/AutocompleteInput.d.ts +3 -3
- package/lib/Button/ButtonClose.d.ts +2 -2
- package/lib/CircleOcticon.d.ts +1 -1
- package/lib/Dialog.d.ts +3 -3
- package/lib/Dropdown.d.ts +4 -4
- package/lib/DropdownMenu/DropdownButton.d.ts +2 -2
- package/lib/FilterList.d.ts +1 -1
- package/lib/Position.d.ts +4 -4
- package/lib/SelectMenu/SelectMenu.d.ts +11 -11
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/TextInputWithTokens.d.ts +3 -3
- package/lib/Timeline.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/stories/ActionList2.stories.js +4 -3
- package/lib-esm/ActionList2/Group.d.ts +28 -2
- package/lib-esm/ActionList2/Group.js +52 -5
- package/lib-esm/ActionList2/List.d.ts +1 -1
- package/lib-esm/Autocomplete/Autocomplete.d.ts +3 -3
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +3 -3
- package/lib-esm/Button/ButtonClose.d.ts +2 -2
- package/lib-esm/CircleOcticon.d.ts +1 -1
- package/lib-esm/Dialog.d.ts +3 -3
- package/lib-esm/Dropdown.d.ts +4 -4
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +2 -2
- package/lib-esm/FilterList.d.ts +1 -1
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/SelectMenu/SelectMenu.d.ts +11 -11
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/TextInputWithTokens.d.ts +3 -3
- package/lib-esm/Timeline.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/stories/ActionList2.stories.js +4 -3
- package/package.json +1 -1
- package/src/ActionList2/Group.tsx +76 -7
- package/src/ActionList2/List.tsx +1 -1
- package/src/stories/ActionList2.stories.tsx +3 -3
- package/stats.html +1 -1
package/lib-esm/Token/Token.d.ts
CHANGED
@@ -11,5 +11,5 @@ export interface TokenProps extends TokenBaseProps {
|
|
11
11
|
*/
|
12
12
|
hideRemoveButton?: boolean;
|
13
13
|
}
|
14
|
-
declare const Token: React.ForwardRefExoticComponent<Pick<TokenProps & SxProp, "default" | "muted" | "sizes" | "color" | "content" | "height" | "translate" | "width" | "hidden" | "children" | "value" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "text" | "start" | "size" | "wrap" | "open" | "list" | "multiple" | "
|
14
|
+
declare const Token: React.ForwardRefExoticComponent<Pick<TokenProps & SxProp, "default" | "muted" | "sizes" | "color" | "content" | "height" | "translate" | "width" | "hidden" | "children" | "value" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "text" | "start" | "size" | "wrap" | "open" | "list" | "multiple" | "role" | "sx" | "type" | "name" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "as" | "step" | "disabled" | "selected" | "download" | "href" | "hrefLang" | "media" | "rel" | "target" | "max" | "method" | "min" | "crossOrigin" | "classID" | "useMap" | "wmode" | "integrity" | "charSet" | "alt" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "playsInline" | "preload" | "src" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dateTime" | "acceptCharset" | "action" | "autoComplete" | "encType" | "noValidate" | "manifest" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "srcSet" | "accept" | "capture" | "checked" | "maxLength" | "minLength" | "readOnly" | "required" | "challenge" | "keyType" | "keyParams" | "htmlFor" | "httpEquiv" | "high" | "low" | "optimum" | "reversed" | "async" | "defer" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "colSpan" | "headers" | "rowSpan" | "scope" | "cols" | "rows" | "kind" | "srcLang" | "poster" | "leadingVisual" | "onRemove" | "isSelected" | "hideRemoveButton"> & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement | HTMLSpanElement>>;
|
15
15
|
export default Token;
|
@@ -205,11 +205,11 @@ export function GroupsStory() {
|
|
205
205
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "Groups"), /*#__PURE__*/React.createElement(ErsatzOverlay, null, /*#__PURE__*/React.createElement(ActionList, {
|
206
206
|
selectionVariant: "multiple",
|
207
207
|
showDividers: true,
|
208
|
-
role: "listbox",
|
209
208
|
"aria-label": "Select reviewers"
|
210
209
|
}, /*#__PURE__*/React.createElement(ActionList.Group, {
|
211
210
|
title: "Suggestions",
|
212
|
-
variant: "filled"
|
211
|
+
variant: "filled",
|
212
|
+
role: "listbox"
|
213
213
|
}, users.slice(0, 2).map(user => /*#__PURE__*/React.createElement(ActionList.Item, {
|
214
214
|
key: user.login,
|
215
215
|
role: "option",
|
@@ -221,7 +221,8 @@ export function GroupsStory() {
|
|
221
221
|
variant: "block"
|
222
222
|
}, "Recently edited these files")))), /*#__PURE__*/React.createElement(ActionList.Group, {
|
223
223
|
title: "Everyone",
|
224
|
-
variant: "filled"
|
224
|
+
variant: "filled",
|
225
|
+
role: "listbox"
|
225
226
|
}, users.slice(2).map(user => /*#__PURE__*/React.createElement(ActionList.Item, {
|
226
227
|
role: "option",
|
227
228
|
key: user.login,
|
package/package.json
CHANGED
@@ -1,18 +1,51 @@
|
|
1
1
|
import React from 'react'
|
2
|
+
import {useSSRSafeId} from '@react-aria/ssr'
|
2
3
|
import Box from '../Box'
|
3
4
|
import {SxProp} from '../sx'
|
4
|
-
import {
|
5
|
-
import {
|
5
|
+
import {ListContext, ListProps} from './List'
|
6
|
+
import {AriaRole} from '../utils/types'
|
6
7
|
|
7
|
-
export type GroupProps =
|
8
|
-
|
8
|
+
export type GroupProps = {
|
9
|
+
/**
|
10
|
+
* Style variations. Usage is discretionary.
|
11
|
+
*
|
12
|
+
* - `"filled"` - Superimposed on a background, offset from nearby content
|
13
|
+
* - `"subtle"` - Relatively less offset from nearby content
|
14
|
+
*/
|
15
|
+
variant?: 'subtle' | 'filled'
|
16
|
+
/**
|
17
|
+
* Primary text which names a `Group`.
|
18
|
+
*/
|
19
|
+
title?: string
|
20
|
+
/**
|
21
|
+
* Secondary text which provides additional information about a `Group`.
|
22
|
+
*/
|
23
|
+
auxiliaryText?: string
|
24
|
+
/**
|
25
|
+
* The ARIA role describing the function of the list inside `Group` component. `listbox` or `menu` are a common values.
|
26
|
+
*/
|
27
|
+
role?: AriaRole
|
28
|
+
} & SxProp & {
|
29
|
+
/**
|
30
|
+
* Whether multiple Items or a single Item can be selected in the Group. Overrides value on ActionList root.
|
31
|
+
*/
|
9
32
|
selectionVariant?: ListProps['selectionVariant'] | false
|
10
33
|
}
|
11
34
|
|
12
35
|
type ContextProps = Pick<GroupProps, 'selectionVariant'>
|
13
36
|
export const GroupContext = React.createContext<ContextProps>({})
|
14
37
|
|
15
|
-
export const Group: React.FC<GroupProps> = ({
|
38
|
+
export const Group: React.FC<GroupProps> = ({
|
39
|
+
title,
|
40
|
+
variant = 'subtle',
|
41
|
+
auxiliaryText,
|
42
|
+
selectionVariant,
|
43
|
+
role,
|
44
|
+
sx = {},
|
45
|
+
...props
|
46
|
+
}) => {
|
47
|
+
const labelId = useSSRSafeId()
|
48
|
+
|
16
49
|
return (
|
17
50
|
<Box
|
18
51
|
as="li"
|
@@ -23,12 +56,48 @@ export const Group: React.FC<GroupProps> = ({title, variant, auxiliaryText, sele
|
|
23
56
|
}}
|
24
57
|
{...props}
|
25
58
|
>
|
26
|
-
{title && <Header title={title} variant={variant} auxiliaryText={auxiliaryText} />}
|
59
|
+
{title && <Header title={title} variant={variant} auxiliaryText={auxiliaryText} labelId={labelId} />}
|
27
60
|
<GroupContext.Provider value={{selectionVariant}}>
|
28
|
-
<Box as="ul" sx={{paddingInlineStart: 0}}>
|
61
|
+
<Box as="ul" sx={{paddingInlineStart: 0}} aria-labelledby={title ? labelId : undefined} role={role}>
|
29
62
|
{props.children}
|
30
63
|
</Box>
|
31
64
|
</GroupContext.Provider>
|
32
65
|
</Box>
|
33
66
|
)
|
34
67
|
}
|
68
|
+
|
69
|
+
export type HeaderProps = Pick<GroupProps, 'variant' | 'title' | 'auxiliaryText'> & {
|
70
|
+
labelId: string
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Displays the name and description of a `Group`.
|
75
|
+
*
|
76
|
+
* For visual presentation only. It's hidden from screen readers.
|
77
|
+
*/
|
78
|
+
const Header: React.FC<HeaderProps> = ({variant, title, auxiliaryText, labelId, ...props}) => {
|
79
|
+
const {variant: listVariant} = React.useContext(ListContext)
|
80
|
+
|
81
|
+
const styles = {
|
82
|
+
paddingY: '6px',
|
83
|
+
paddingX: listVariant === 'full' ? 2 : 3,
|
84
|
+
fontSize: 0,
|
85
|
+
fontWeight: 'bold',
|
86
|
+
color: 'fg.muted',
|
87
|
+
...(variant === 'filled' && {
|
88
|
+
backgroundColor: 'canvas.subtle',
|
89
|
+
marginX: 0,
|
90
|
+
marginBottom: 2,
|
91
|
+
borderTop: '1px solid',
|
92
|
+
borderBottom: '1px solid',
|
93
|
+
borderColor: 'neutral.muted'
|
94
|
+
})
|
95
|
+
}
|
96
|
+
|
97
|
+
return (
|
98
|
+
<Box sx={styles} role="presentation" aria-hidden="true" {...props}>
|
99
|
+
<span id={labelId}>{title}</span>
|
100
|
+
{auxiliaryText && <span>{auxiliaryText}</span>}
|
101
|
+
</Box>
|
102
|
+
)
|
103
|
+
}
|
package/src/ActionList2/List.tsx
CHANGED
@@ -23,7 +23,7 @@ export type ListProps = {
|
|
23
23
|
role?: AriaRole
|
24
24
|
} & SxProp
|
25
25
|
|
26
|
-
type ContextProps =
|
26
|
+
type ContextProps = Pick<ListProps, 'variant' | 'selectionVariant' | 'showDividers'>
|
27
27
|
export const ListContext = React.createContext<ContextProps>({})
|
28
28
|
|
29
29
|
const ListBox = styled.ul<SxProp>(sx)
|
@@ -318,8 +318,8 @@ export function GroupsStory(): JSX.Element {
|
|
318
318
|
<>
|
319
319
|
<h1>Groups</h1>
|
320
320
|
<ErsatzOverlay>
|
321
|
-
<ActionList selectionVariant="multiple" showDividers
|
322
|
-
<ActionList.Group title="Suggestions" variant="filled">
|
321
|
+
<ActionList selectionVariant="multiple" showDividers aria-label="Select reviewers">
|
322
|
+
<ActionList.Group title="Suggestions" variant="filled" role="listbox">
|
323
323
|
{users.slice(0, 2).map(user => (
|
324
324
|
<ActionList.Item
|
325
325
|
key={user.login}
|
@@ -336,7 +336,7 @@ export function GroupsStory(): JSX.Element {
|
|
336
336
|
</ActionList.Item>
|
337
337
|
))}
|
338
338
|
</ActionList.Group>
|
339
|
-
<ActionList.Group title="Everyone" variant="filled">
|
339
|
+
<ActionList.Group title="Everyone" variant="filled" role="listbox">
|
340
340
|
{users.slice(2).map(user => (
|
341
341
|
<ActionList.Item
|
342
342
|
role="option"
|