Skip to content

Commit 6e60bdf

Browse files
authored
Merge branch 'main' into splitpagelayout-api
2 parents 2578d2e + 2a7c254 commit 6e60bdf

36 files changed

+498
-299
lines changed

.changeset/modern-fireants-destroy.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/poor-wombats-lick.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/small-donkeys-provide.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

.changeset/smooth-balloons-hope.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

@types/focus-visible/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module 'focus-visible'

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
# @primer/components
22

3+
## 35.4.0
4+
5+
### Minor Changes
6+
7+
- [#2108](https://github.com/primer/react/pull/2108) [`e5be3db3`](https://github.com/primer/react/commit/e5be3db3112db20efef5e49ebe89ea3af17fd486) Thanks [@mperrotti](https://github.com/mperrotti)! - Adds a draft component to render a basic segmented control.
8+
9+
* [#2139](https://github.com/primer/react/pull/2139) [`f17446e0`](https://github.com/primer/react/commit/f17446e0dbfb9021291207972ece47e90a5656e0) Thanks [@owenniblock](https://github.com/owenniblock)! - Changes focus rules of TabNav to match WAI-ARIA rules for tablist
10+
11+
### Patch Changes
12+
13+
- [#2099](https://github.com/primer/react/pull/2099) [`40da598e`](https://github.com/primer/react/commit/40da598e8d41b688eba53f4c594bff66b269f5f4) Thanks [@siddharthkp](https://github.com/siddharthkp)! - AnchoredOverlay: `aria-expanded` attribute is removed from anchor when overlay is not open
14+
15+
* [#2155](https://github.com/primer/react/pull/2155) [`003cbcf0`](https://github.com/primer/react/commit/003cbcf0e5530d580636e4ce09e539317a95dc73) Thanks [@mperrotti](https://github.com/mperrotti)! - Update Checkbox component to useIsomorphicLayoutEffect instead of useLayoutEffect to support SSR
16+
17+
- [#2154](https://github.com/primer/react/pull/2154) [`96ad635b`](https://github.com/primer/react/commit/96ad635b3063af03e31fcac06cfe8bdea248d0d3) Thanks [@mperrotti](https://github.com/mperrotti)! - Allow "falsely/empty" Autocomplete.Input values
18+
19+
* [#2153](https://github.com/primer/react/pull/2153) [`ce45de30`](https://github.com/primer/react/commit/ce45de308f1aaaf760a8e3f18ee39f20610f896b) Thanks [@willglas](https://github.com/willglas)! - Add AutocompleteContext to Autocomplete component exports
20+
21+
- [#2105](https://github.com/primer/react/pull/2105) [`c7bbd06f`](https://github.com/primer/react/commit/c7bbd06fd7c67690ed7a612737f79662444d388b) Thanks [@siddharthkp](https://github.com/siddharthkp)! - ActionMenu: Replace typeahead behavior with single key mnemonics
22+
23+
* [#2125](https://github.com/primer/react/pull/2125) [`78dc8134`](https://github.com/primer/react/commit/78dc8134b1d38c6826766f2f85ae943e8b1a8088) Thanks [@owenniblock](https://github.com/owenniblock)! - Adds roles of tablist and tab to the TabNav component, required rearranging the HTML elements to be semantically correct
24+
25+
- [#2149](https://github.com/primer/react/pull/2149) [`b3a98bac`](https://github.com/primer/react/commit/b3a98baccc19a77d16b8c42f7873073070f24b89) Thanks [@dgreif](https://github.com/dgreif)! - Converted commonjs `require` of `focus-visible` to an esm `import`
26+
27+
* [#2120](https://github.com/primer/react/pull/2120) [`53713b2f`](https://github.com/primer/react/commit/53713b2f3ab7dd7084ce3e602c01c3f66ccd7579) Thanks [@colebemis](https://github.com/colebemis)! - Deprecate SideNav in favor of [NavList](https://primer.style/NavList).
28+
29+
## Before
30+
31+
```jsx
32+
<SideNav aria-label="Main">
33+
<SideNav.Link href="/" selected>
34+
Home
35+
</SideNav.Link>
36+
<SideNav.Link href="/about">About</SideNav.Link>
37+
<SideNav.Link href="/contact">Contact</SideNav.Link>
38+
</SideNav>
39+
```
40+
41+
## After
42+
43+
```jsx
44+
<NavList aria-label="Main">
45+
<NavList.Item href="/" aria-current="page">
46+
Home
47+
</NavList.Item>
48+
<NavList.Item href="/about">About</NavList.Item>
49+
<NavList.Item href="/contact">Contact</NavList.Item>
50+
</NavList>
51+
```
52+
53+
- [#2133](https://github.com/primer/react/pull/2133) [`65fcd9f2`](https://github.com/primer/react/commit/65fcd9f23de939014351f8e135f912cfa00f71a3) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Passthrough ActionList.Group props from NavList.Group
54+
55+
* [#2158](https://github.com/primer/react/pull/2158) [`ac92de47`](https://github.com/primer/react/commit/ac92de477f6d7a5527f32dd55d3082318c800d7d) Thanks [@owenniblock](https://github.com/owenniblock)! - Fixes issue when tabs are not links
56+
357
## 35.3.0
458

559
### Minor Changes

contributor-docs/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ See [`src/__tests__/example.js`](src/__tests__/example.js) for examples of ways
142142

143143
### TypeScript support
144144

145-
Primer React is written in TypeScript. We include type definitions in our built artifacts. To check types, run the `typecheck` script:
145+
Primer React is written in TypeScript. We include type definitions in our built artifacts. To check types, run the `type-check` test script:
146146

147147
```
148-
npm run typecheck
148+
npm run test:type-check
149149
```
150150

151151
### Additional resources

docs/content/Autocomplete.mdx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,64 @@ const MultiSelectAddNewItem = () => {
579579
render(<MultiSelectAddNewItem />)
580580
```
581581

582+
#### Rendered with `Autocomplete.Context`
583+
584+
The `Autocomplete.Context` can be used to control the menu open/closed state and customize certain `Autocomplete` behaviors
585+
586+
```javascript live noinline
587+
export function AutocompleteWithContext() {
588+
return (
589+
<Autocomplete>
590+
<AutocompleteWithContextInternal />
591+
</Autocomplete>
592+
)
593+
}
594+
595+
export function AutocompleteWithContextInternal() {
596+
const autocompleteContext = useContext(Autocomplete.Context)
597+
if (autocompleteContext === null) {
598+
throw new Error('AutocompleteContext returned null values')
599+
}
600+
601+
const {setShowMenu, showMenu} = autocompleteContext
602+
const inputRef = useRef < HTMLInputElement > null
603+
const [filterText, setFilterText] = useState('')
604+
605+
useEffect(() => {
606+
if (!showMenu) {
607+
// keep the menu open
608+
setShowMenu(true)
609+
}
610+
}, [showMenu, setShowMenu])
611+
612+
const change = event => setFilterText?.(event.target.value)
613+
614+
return (
615+
<Autocomplete.Context.Provider
616+
value={{...autocompleteContext, autocompleteSuggestion: '', setAutocompleteSuggestion: () => false}}
617+
>
618+
<Autocomplete.Input ref={inputRef} value={filterText} onChange={change} />
619+
<Autocomplete.Overlay>
620+
<Autocomplete.Menu
621+
items={[
622+
{text: 'main', id: 0},
623+
{text: 'autocomplete-tests', id: 1},
624+
{text: 'a11y-improvements', id: 2},
625+
{text: 'button-bug-fixes', id: 3},
626+
{text: 'radio-input-component', id: 4},
627+
{text: 'release-1.0.0', id: 5},
628+
{text: 'text-input-implementation', id: 6},
629+
{text: 'visual-design-tweaks', id: 7}
630+
]}
631+
selectedItemIds={[]}
632+
selectionVariant="single"
633+
/>
634+
</Autocomplete.Overlay>
635+
</Autocomplete.Context.Provider>
636+
)
637+
}
638+
```
639+
582640
## Props
583641
584642
### Autocomplete.Input

docs/content/NavList.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function NavItem({to, children}) {
184184
const resolved = useResolvedPath(to)
185185
const isCurrent = useMatch({path: resolved.pathname, end: true})
186186
return (
187-
<NavList.Item as={Link} to={to} aria-current={isCurrent ? 'page' : false}>
187+
<NavList.Item as={Link} to={to} aria-current={isCurrent ? 'page' : undefined}>
188188
{children}
189189
</NavList.Item>
190190
)

0 commit comments

Comments
 (0)