Skip to content

Commit

Permalink
v.2.6.8 (#4324)
Browse files Browse the repository at this point in the history
* ci: when build fail will exit the release process (#4319)

* fix: on click event on interactive elements (#4322)

* chore: deprecated style added to api table

* ci(changesets): version packages (#4323)

Co-authored-by: Junior Garcia <[email protected]>

---------

Co-authored-by: winches <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 10, 2024
2 parents 3f119d9 + 31ab508 commit 053c1a7
Show file tree
Hide file tree
Showing 93 changed files with 638 additions and 1,263 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ jobs:
run: pnpm test

- name: Build
run: pnpm build
id: build
continue-on-error: false
# Custom turbo build failure information
run: |
pnpm build || {
echo "Turbo build failed with exit code $?"
exit 1
}
- name: Create Release Pull Request or Publish to NPM
# Run only if the build is successful
if: steps.build.outcome == 'success'
id: changesets
uses: changesets/action@v1
with:
Expand All @@ -43,7 +52,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create canary release
if: steps.changesets.outputs.published != 'true'
if: steps.build.outcome == 'success' && steps.changesets.outputs.published != 'true'
timeout-minutes: 15
run: |
git checkout canary
Expand Down
20 changes: 17 additions & 3 deletions apps/docs/components/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,20 @@ const Link = ({href, children}: {href?: string; children?: React.ReactNode}) =>
);
};

const InlineCodeChip = ({children}: {children?: React.ReactNode}) => {
const InlineCodeChip = ({
children,
className,
}: {
children?: React.ReactNode;
className?: string;
}) => {
return (
<InlineCode className="before:hidden after:hidden text-tiny rounded-md text-default-600 bg-default-100 dark:bg-default-100/80 px-1.5 py-0.5">
<InlineCode
className={clsx(
"before:hidden after:hidden text-tiny rounded-md text-default-600 bg-default-100 dark:bg-default-100/80 px-1.5 py-0.5",
className,
)}
>
{children}
</InlineCode>
);
Expand All @@ -218,6 +229,7 @@ interface APITableProps {
attribute: string;
type: string;
description: string;
deprecated?: boolean;
default?: string;
}[];
}
Expand All @@ -237,7 +249,9 @@ export const APITable: React.FC<APITableProps> = ({data}) => {
{data.map((item, index) => (
<TableRow key={index} className="[&>td]:px-2 [&>td]:py-1.5 [&>td]:first:pt-4">
<TableCell className="flex items-center gap-1 font-mono text-small whitespace-nowrap">
<InlineCodeChip>{item.attribute}</InlineCodeChip>
<InlineCodeChip className={item.deprecated ? "line-through" : ""}>
{item.attribute}
</InlineCodeChip>
{item.description && (
<>
{/* Desktop tooltip */}
Expand Down
1 change: 1 addition & 0 deletions apps/docs/content/docs/components/button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ building buttons that work well across devices and interaction methods.
},
{
attribute: "onClick",
deprecated: true,
type: "MouseEventHandler",
description: "The native button click event handler (Deprecated) use onPress instead.",
default: "-"
Expand Down
1 change: 1 addition & 0 deletions apps/docs/content/docs/components/dropdown.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ you to customize each item individually.
},
{
attribute: "onClick",
deprecated: true,
type: "MouseEventHandler",
description: "The native button click event handler (**Deprecated**) use **onPress** instead.",
default: "-"
Expand Down
1 change: 1 addition & 0 deletions apps/docs/content/docs/components/link.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ In case you need to customize the link even further, you can use the `useLink` h
},
{
attribute: "onClick",
deprecated: true,
type: "MouseEventHandler",
description: "The native link click event handler (Deprecated) use onPress instead.",
default: "-"
Expand Down
1 change: 1 addition & 0 deletions apps/docs/content/docs/components/listbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ You can customize the `Listbox` items style by using the `itemClasses` prop and
},
{
attribute: "onClick",
deprecated: true,
type: "MouseEventHandler",
description: "The native button click event handler (Deprecated) use onPress instead.",
default: "-"
Expand Down
7 changes: 7 additions & 0 deletions packages/components/accordion/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @nextui-org/accordion

## 2.2.5

### Patch Changes

- Updated dependencies [[`78c0928`](https://github.com/nextui-org/nextui/commit/78c09280e30113bd648057ad64ad6198d1e5d58f)]:
- @nextui-org/aria-utils@2.2.5

## 2.2.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/components/accordion/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nextui-org/accordion",
"version": "2.2.4",
"version": "2.2.5",
"description": "Collapse display a list of high-level options that can expand/collapse to reveal more information.",
"keywords": [
"react",
Expand Down
7 changes: 7 additions & 0 deletions packages/components/alert/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @nextui-org/alert

## 2.2.7

### Patch Changes

- Updated dependencies [[`78c0928`](https://github.com/nextui-org/nextui/commit/78c09280e30113bd648057ad64ad6198d1e5d58f)]:
- @nextui-org/button@2.2.7

## 2.2.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/components/alert/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nextui-org/alert",
"version": "2.2.6",
"version": "2.2.7",
"description": "Alerts are temporary notifications that provide concise feedback about an action or event.",
"keywords": [
"alert"
Expand Down
12 changes: 12 additions & 0 deletions packages/components/autocomplete/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @nextui-org/autocomplete

## 2.3.7

### Patch Changes

- Updated dependencies [[`78c0928`](https://github.com/nextui-org/nextui/commit/78c09280e30113bd648057ad64ad6198d1e5d58f)]:
- @nextui-org/use-aria-button@2.2.3
- @nextui-org/aria-utils@2.2.5
- @nextui-org/listbox@2.3.7
- @nextui-org/button@2.2.7
- @nextui-org/popover@2.3.7
- @nextui-org/form@2.1.6

## 2.3.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/components/autocomplete/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nextui-org/autocomplete",
"version": "2.3.6",
"version": "2.3.7",
"description": "An autocomplete combines a text input with a listbox, allowing users to filter a list of options to items matching a query.",
"keywords": [
"autocomplete"
Expand Down
9 changes: 9 additions & 0 deletions packages/components/button/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @nextui-org/button

## 2.2.7

### Patch Changes

- [#4322](https://github.com/nextui-org/nextui/pull/4322) [`78c0928`](https://github.com/nextui-org/nextui/commit/78c09280e30113bd648057ad64ad6198d1e5d58f) Thanks [@jrgarciadev](https://github.com/jrgarciadev)! - Fix #4292 interactive elements were not responding to "onClick" event

- Updated dependencies [[`78c0928`](https://github.com/nextui-org/nextui/commit/78c09280e30113bd648057ad64ad6198d1e5d58f)]:
- @nextui-org/use-aria-button@2.2.3

## 2.2.6

### Patch Changes
Expand Down
12 changes: 12 additions & 0 deletions packages/components/button/__tests__/button.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "@testing-library/jest-dom";
import * as React from "react";
import {render} from "@testing-library/react";
import userEvent, {UserEvent} from "@testing-library/user-event";
Expand Down Expand Up @@ -35,6 +36,17 @@ describe("Button", () => {
expect(onPress).toHaveBeenCalled();
});

it("should trigger onClick function", async () => {
const onClick = jest.fn();
const {getByRole} = render(<Button disableRipple onClick={onClick} />);

const button = getByRole("button");

await user.click(button);

expect(onClick).toHaveBeenCalled();
});

it("should ignore events when disabled", async () => {
const onPress = jest.fn();
const {getByRole} = render(<Button disableRipple isDisabled onPress={onPress} />);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/button/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nextui-org/button",
"version": "2.2.6",
"version": "2.2.7",
"description": "Buttons allow users to perform actions and choose with a single tap.",
"keywords": [
"button"
Expand Down
3 changes: 2 additions & 1 deletion packages/components/button/src/use-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ interface Props extends HTMLNextUIProps<"button"> {
/**
* The native button click event handler.
* use `onPress` instead.
* @deprecated
*/
onClick?: MouseEventHandler<HTMLButtonElement>;
}
Expand Down Expand Up @@ -150,7 +151,7 @@ export function useButton(props: UseButtonProps) {
elementType: as,
isDisabled,
onPress: chain(onPress, handlePress),
onClick: onClick,
onClick,
...otherProps,
} as AriaButtonProps,
domRef,
Expand Down
11 changes: 8 additions & 3 deletions packages/components/button/stories/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,19 @@ const defaultProps = {
const StateTemplate = (args: ButtonProps) => {
const [isOpen, setIsOpen] = React.useState(false);

const handlePress = () => {
const handlePress = (e: any) => {
// eslint-disable-next-line no-console
console.log("Pressed");
console.log("Pressed", e);
setIsOpen((prev) => !prev);
};

return (
<Button {...args} aria-label="Open" aria-pressed={isOpen} onPress={handlePress}>
<Button
{...args}
aria-label={isOpen ? "Close" : "Open"}
aria-pressed={isOpen}
onClick={handlePress}
>
{isOpen ? "Close" : "Open"}
</Button>
);
Expand Down
8 changes: 8 additions & 0 deletions packages/components/calendar/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @nextui-org/calendar

## 2.2.7

### Patch Changes

- Updated dependencies [[`78c0928`](https://github.com/nextui-org/nextui/commit/78c09280e30113bd648057ad64ad6198d1e5d58f)]:
- @nextui-org/use-aria-button@2.2.3
- @nextui-org/button@2.2.7

## 2.2.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/components/calendar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nextui-org/calendar",
"version": "2.2.6",
"version": "2.2.7",
"description": "A calendar displays one or more date grids and allows users to select a single date.",
"keywords": [
"calendar"
Expand Down
9 changes: 9 additions & 0 deletions packages/components/card/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @nextui-org/card

## 2.2.7

### Patch Changes

- [#4322](https://github.com/nextui-org/nextui/pull/4322) [`78c0928`](https://github.com/nextui-org/nextui/commit/78c09280e30113bd648057ad64ad6198d1e5d58f) Thanks [@jrgarciadev](https://github.com/jrgarciadev)! - Fix #4292 interactive elements were not responding to "onClick" event

- Updated dependencies [[`78c0928`](https://github.com/nextui-org/nextui/commit/78c09280e30113bd648057ad64ad6198d1e5d58f)]:
- @nextui-org/use-aria-button@2.2.3

## 2.2.6

### Patch Changes
Expand Down
21 changes: 18 additions & 3 deletions packages/components/card/__tests__/card.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import * as React from "react";
import {render} from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import userEvent, {UserEvent} from "@testing-library/user-event";

import {Card} from "../src";

describe("Card", () => {
let user: UserEvent;

beforeEach(() => {
user = userEvent.setup();
});

it("should render correctly", () => {
const wrapper = render(<Card />);

Expand All @@ -30,13 +36,22 @@ describe("Card", () => {

const button = getByRole("button");

const user = userEvent.setup();

await user.click(button);

expect(onPress).toHaveBeenCalled();
});

it("should trigger onClick function", async () => {
const onClick = jest.fn();
const {getByRole} = render(<Card disableRipple isPressable onClick={onClick} />);

const button = getByRole("button");

await user.click(button);

expect(onClick).toHaveBeenCalled();
});

it("should render correctly when nested", () => {
const wrapper = render(
<Card>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/card/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nextui-org/card",
"version": "2.2.6",
"version": "2.2.7",
"description": "Card is a container for text, photos, and actions in the context of a single subject.",
"keywords": [
"card"
Expand Down
11 changes: 8 additions & 3 deletions packages/components/card/src/use-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {AriaButtonProps} from "@nextui-org/use-aria-button";
import type {RippleProps} from "@nextui-org/ripple";

import {card} from "@nextui-org/theme";
import {ReactNode, useCallback, useMemo} from "react";
import {MouseEventHandler, ReactNode, useCallback, useMemo} from "react";
import {chain, mergeProps} from "@react-aria/utils";
import {useFocusRing} from "@react-aria/focus";
import {PressEvent, useHover} from "@react-aria/interactions";
Expand All @@ -20,7 +20,7 @@ import {ReactRef, filterDOMProps} from "@nextui-org/react-utils";
import {useDOMRef} from "@nextui-org/react-utils";
import {useRipple} from "@nextui-org/ripple";

export interface Props extends HTMLNextUIProps<"div"> {
export interface Props extends Omit<HTMLNextUIProps<"div">, "onClick"> {
/**
* Ref to the DOM node.
*/
Expand All @@ -34,12 +34,17 @@ export interface Props extends HTMLNextUIProps<"div"> {
* @default false
*/
disableRipple?: boolean;

/**
* Whether the card should allow text selection on press. (only for pressable cards)
* @default true
*/
allowTextSelectionOnPress?: boolean;
/**
* The native button click event handler.
* use `onPress` instead.
* @deprecated
*/
onClick?: MouseEventHandler<HTMLButtonElement>;
/**
* Classname or List of classes to change the classNames of the element.
* if `className` is passed, it will be added to the base slot.
Expand Down
Loading

0 comments on commit 053c1a7

Please sign in to comment.