Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds new component TabPanels #4241

Merged
merged 104 commits into from
Mar 19, 2024
Merged

Adds new component TabPanels #4241

merged 104 commits into from
Mar 19, 2024

Conversation

owenniblock
Copy link
Contributor

@owenniblock owenniblock commented Feb 9, 2024

This Work

Closes https://github.com/github/primer/issues/3043

Adds a new TabPanels component to mirror the Primer View Component TabPanels. We will need to retrospectively go back and update PVC to use the new <tab-container> which supports shadow DOM.

Screenshots

Three tabs, the first is selected with the first Panel visible Three tabs, the first is selected, the first panel is visible. Additional content is a button after the tab controls and some text after the tab page Three tabs, the second is selected with the second Panel visible

Changelog

  • Adds new TabPanels alpha component to provide non-navigational tabs with pages.

New

  • TabPanels component

Changed

  • Seems like we were missing some snapshots for Dialog-v1

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

I'd particularly like guidance on the following:

  • If any of my CSS could be improved
  • If there are any additional features of tab-container-element which we should support
  • If I've missed any tests

Merge checklist

Copy link

changeset-bot bot commented Feb 9, 2024

🦋 Changeset detected

Latest commit: a7376be

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

package.json Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Feb 9, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 87.37 KB (-0.17% 🔽)
packages/react/dist/browser.umd.js 87.78 KB (+0.05% 🔺)

@github-actions github-actions bot temporarily deployed to storybook-preview-4241 February 9, 2024 13:24 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-4241 February 9, 2024 13:45 Inactive
@owenniblock
Copy link
Contributor Author

@owenniblock owenniblock requested a review from a team March 14, 2024 21:10
@owenniblock
Copy link
Contributor Author

Not sure why design reviewers is on this PR, I've added engineer reviewers 🤷

Copy link
Contributor

@langermank langermank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving snapshots

@keithamus keithamus added this pull request to the merge queue Mar 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 19, 2024
@owenniblock
Copy link
Contributor Author

CI was green when I reran the failing stuff so going to try one last time to merge...

@owenniblock owenniblock added this pull request to the merge queue Mar 19, 2024
Merged via the queue into main with commit 5f94a23 Mar 19, 2024
30 checks passed
@owenniblock owenniblock deleted the add-tab-panel branch March 19, 2024 11:18
@primer primer bot mentioned this pull request Mar 19, 2024
lukasoppermann pushed a commit that referenced this pull request Apr 16, 2024
* Early prototype of TabPanels

* Linting

* selected property is optional

* Stop if complaining about types for aria-selected

* Fix initial select

* Adds tests for TabPanels

* Move npm dep to packages/react

* version semver format change

* Add styling to match as close as I can to PVC version

* Fix Playground

* Linting

* Delete TabWrapper and move styling to tablist

* Add more docs

* Format

* Changeset

* Add to the docs nav

* Adds e2e tests

* More scaffolding stuff

* Fix error with docs reference

* Update @github/tab-container-element so we can use it with SSR

* Use type imports for type imports

* More type imports

* Fix TabPanels tests

* test(vrt): update snapshots

* Update test snapshot

* Use the new shadowdom version of tab-container-element

* Adds styles to tab-container

* Remove test which is no longer required

* Add margin to panels to match react

* Upgrade tab-container-element to v4.1.0

* Update TabPanels to use better styling

* Update docs to include events

* Linting

* Fix type error

* Fix tests

* test(vrt): update snapshots

* Ignore axe test that fails because of shadow dom

* Fix roll-up error

* Move to drafts (and consequently experimental)

* aria-labelledby option (required) on tab panels and id on tabs

* Linting

* Hide panels before JS kicks in

* Minimise content flash when JS is slow

* Demonstrate limitation with 11+ tabs

* Linting again

* Add required props to tests etc

* npm run format

* test(vrt): update snapshots

* test(vrt): update snapshots

* Add suppressHydrationWarning to elements on TabPanels

* Update snapshot for update semver test

* Add required props to docs example

* Cherry-pick the change from my other PR

* Delete dialog snapshots

* Fix format

* Upgrade tab-container-element to 4.1.2

* Update tab-container-element to v4.1.3

* Removes the need for specifying ids on children and makes them autogenerate

* Linting

* Move to draft directory

* Fix docs build

* Fix TabPanels in docs page

* Coplete move to drafts area

* Change API to use selectedTab on the parent and store it in state

* Use new createComponent function

* Add new selectedTabIndex prop support

* Add selectedTabIndex prop to docs

* Linting

* Update docs

* Fix formatting

* Fix e2e test after move to draft

* Simplify styled call on TabContainerElement

* Fix types for linting

* test(vrt): update snapshots

* Shouldn't need to skip aria test now

* Remove unused commented code

* Fix typing on custom-elements

* Type change to fix linting

* Change type to SxProp

* Use latest tab-container-element

* Use onChange(d) aliases in docs

* Automatically generate the parent id if it's not defined

* Add aria requirements to TabPanels

* Linting etc

* Use defaultTabIndex which doesn't set the focus

* Linting

* Use the role instead of the type

* child.props.type didn't work

* We don't want the consumer to override the id or aria-labelledby

* Updgrade tab-container-element to v4.5.0

* Better types for label/labelledby

* Linting

* test(vrt): update snapshots

* Workaround infinite type issue

---------

Co-authored-by: owenniblock <owenniblock@users.noreply.github.com>
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants