Skip to content

Commit

Permalink
chore: Upgrade ariakit to v0.4.5 (#836)
Browse files Browse the repository at this point in the history
* chore: upgrade ariakit to v0.4.5
* fix: Accept more props in the `Tab` component
* fix: Fix CSS build issue
* chore: Prepare new release 25.0.0-beta.3
  • Loading branch information
gnapse authored Aug 9, 2024
1 parent c71e151 commit 2d71aeb
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 80 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Reactist follows [semantic versioning](https://semver.org/) and doesn't introduce breaking changes (API-wise) in minor or patch releases. However, the appearance of a component might change in a minor or patch release so keep an eye on redesigns and make sure your app still looks and feels like you expect it.

# v25.0.0-beta.3

- [Fix] Allow more props to be forwarded to the `Tab` component.
- [Fix] Properly fix CSS build in tsdx config.
- [Chore] Upgrade to `@ariakit/[email protected]`.

# v25.0.0-beta.2

- [Fix] Pass `onClick` to the `Tab` component.
Expand Down
110 changes: 55 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"email": "[email protected]",
"url": "http://doist.com"
},
"version": "25.0.0-beta.2",
"version": "25.0.0-beta.3",
"license": "MIT",
"homepage": "https://github.com/Doist/reactist#readme",
"repository": {
Expand Down Expand Up @@ -149,7 +149,7 @@
"webpack": "^4.43.0"
},
"dependencies": {
"@ariakit/react": "^0.3.14",
"@ariakit/react": "0.4.5",
"aria-hidden": "^1.2.1",
"dayjs": "^1.8.10",
"patch-package": "^6.4.6",
Expand Down
8 changes: 4 additions & 4 deletions src/tabs/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import classNames from 'classnames'
import {
useTabStore,
Tab as BaseTab,
TabProps as BaseTabProps,
TabList as BaseTabList,
TabPanel as BaseTabPanel,
TabPanelProps as BaseTabPanelProps,
TabStore,
RoleProps,
} from '@ariakit/react'
import { Inline } from '../inline'
import type { ObfuscatedClassName, Space } from '../utils/common-types'
Expand Down Expand Up @@ -74,7 +74,9 @@ function Tabs({
return <TabsContext.Provider value={memoizedTabState}>{children}</TabsContext.Provider>
}

interface TabProps extends ObfuscatedClassName, Pick<RoleProps, 'render'> {
interface TabProps
extends ObfuscatedClassName,
Omit<BaseTabProps, 'store' | 'className' | 'children' | 'id'> {
/**
* The content to render inside of the tab button
*/
Expand All @@ -84,8 +86,6 @@ interface TabProps extends ObfuscatedClassName, Pick<RoleProps, 'render'> {
* The tab's identifier. This must match its corresponding `<TabPanel>`'s id
*/
id: string

onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void
}

/**
Expand Down
21 changes: 3 additions & 18 deletions src/tooltip/tooltip.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { render, screen, act, waitFor } from '@testing-library/react'
import { render, screen, act } from '@testing-library/react'
import { axe } from 'jest-axe'
import userEvent from '@testing-library/user-event'
import { Tooltip } from './tooltip'
Expand Down Expand Up @@ -91,6 +91,7 @@ describe('Tooltip', () => {
})

it('can render content generated by a function only called when needed', async () => {
jest.useFakeTimers()
const content = jest.fn(() => 'tooltip content generated dynamically')
render(
<Tooltip content={content}>
Expand All @@ -115,6 +116,7 @@ describe('Tooltip', () => {
await flushMicrotasks()

expect(content).toHaveBeenCalled()
jest.useRealTimers()
})

/**
Expand Down Expand Up @@ -204,23 +206,6 @@ describe('Tooltip', () => {
})
})

it('sets the tooltip content as the trigger element’s accessible description', async () => {
render(
<Tooltip content="tooltip content here">
<button>Click me</button>
</Tooltip>,
)

// Since the content is only rendered when the tooltip appears, this description is only
// available when we hover or focus the button, and not before.
const button = screen.getByRole('button', { name: 'Click me' })
userEvent.tab()

await waitFor(() => {
expect(button).toHaveAccessibleDescription('tooltip content here')
})
})

it('does not acknowledge the className prop, but exceptionallySetClassName instead', async () => {
render(
<Tooltip
Expand Down
2 changes: 1 addition & 1 deletion tsdx.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
mode: 'local',
generateScopedName: '[hash:8]',
},
mode: ['extract', 'index.css'],
mode: 'extract',
url: { inline: true },
}),
].concat(config.plugins)
Expand Down

0 comments on commit 2d71aeb

Please sign in to comment.