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

fix(chip): trigger onClick when press close icon #240

Merged
merged 6 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .yarn/versions/35d7933f.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
releases:
"@nimbus-ds/chip": patch
"@nimbus-ds/components": patch
"@nimbus-ds/sidebar": patch
"@nimbus-ds/styles": patch

declined:
- nimbus-design-system
6 changes: 6 additions & 0 deletions packages/core/styles/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Nimbus Styles deprive all styles needed to build nimbus components.

## 2024-04-22 `9.11.5`

#### πŸ’‘ Others

- Added `chip_close_icon_container` class for `Chip` component. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/240) by [@nachozullo](https://github.com/nachozullo))

## 2024-02-29 `9.11.0`

#### πŸŽ‰ New features
Expand Down
5 changes: 3 additions & 2 deletions packages/core/styles/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nimbus-ds/styles",
"version": "9.11.4",
"version": "9.11.5-rc.3",
"license": "MIT",
"main": "dist/index.js",
"files": [
Expand Down Expand Up @@ -32,5 +32,6 @@
"glob": "^8.0.3",
"rainbow-sprinkles": "^0.14.0",
"ts-node": "^10.9.1"
}
},
"stableVersion": "9.11.4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const base = vanillaStyle({
display: "flex",
alignItems: "center",
justifyContent: "center",
cursor: "pointer",
cursor: "default",

padding: `${varsThemeBase.spacing[1]} ${varsThemeBase.spacing[2]}`,
gap: varsThemeBase.spacing[1],
Expand Down Expand Up @@ -39,3 +39,11 @@ export const base = vanillaStyle({
borderColor: varsThemeBase.colors.neutral.interactivePressed,
},
});

export const chip_close_icon_container = vanillaStyle({
background: "transparent",
border: "none",
padding: 0,
fontSize: 0,
cursor: "pointer",
});
7 changes: 7 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Nimbus is an open-source Design System created by Tiendanube / Nuvesmhop’s team to empower and enhance more stories every day, with simplicity, accessibility, consistency and performance.

## 2024-04-22 `5.5.4`

### πŸ’‘ Others

- Trigger `onClick` only when close icon is pressed on `Chip` component. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/240) by [@nachozullo](https://github.com/nachozullo))
- Added `lockScroll` to prevent scroll outside of the body of `Sidebar` component. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/240) by [@nachozullo](https://github.com/nachozullo))

## 2024-03-18 `5.5.3`

### πŸ› Bug fixes
Expand Down
5 changes: 3 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nimbus-ds/components",
"version": "5.5.3",
"version": "5.5.4-rc.3",
"license": "MIT",
"main": "dist/index.js",
"files": [
Expand Down Expand Up @@ -31,5 +31,6 @@
},
"devDependencies": {
"@nimbus-ds/webpack": "workspace:^"
}
},
"stableVersion": "5.5.3"
}
6 changes: 6 additions & 0 deletions packages/react/src/atomic/Chip/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The Chip component is used to flag criteria or attributes related to searches or filters of a list of information.

## 2024-04-22 `2.3.3`

### πŸ’‘ Others

- Trigger `onClick` only when close icon is pressed. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/240) by [@nachozullo](https://github.com/nachozullo))

## 2024-02-07 `2.3.2`

### πŸ› Bug fixes
Expand Down
5 changes: 3 additions & 2 deletions packages/react/src/atomic/Chip/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nimbus-ds/chip",
"version": "2.3.2",
"version": "2.3.3-rc.3",
"license": "MIT",
"main": "dist/index.js",
"files": [
Expand Down Expand Up @@ -34,5 +34,6 @@
"devDependencies": {
"@nimbus-ds/box": "workspace:^",
"@nimbus-ds/webpack": "workspace:^"
}
},
"stableVersion": "2.3.2"
}
24 changes: 16 additions & 8 deletions packages/react/src/atomic/Chip/src/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { CloseIcon } from "@nimbus-ds/icons";
import { chip } from "@nimbus-ds/styles";
import { Text } from "@nimbus-ds/text";
import { Icon } from "@nimbus-ds/icon";

import { ChipProps, ChipComponents } from "./chip.types";
import { ChipSkeleton } from "./components";

Expand All @@ -13,9 +12,10 @@ const Chip: React.FC<ChipProps> & ChipComponents = ({
text,
icon,
removable,
onClick,
...rest
}: ChipProps) => (
<button type="button" {...rest} className={chip.classnames.base}>
<div {...rest} className={chip.classnames.base}>
{icon && <Icon source={icon} color="neutral-textHigh" />}
<Text
color="neutral-textHigh"
Expand All @@ -27,13 +27,21 @@ const Chip: React.FC<ChipProps> & ChipComponents = ({
{text}
</Text>
{removable && (
<Icon
data-testid="close-chip"
source={<CloseIcon size={12} />}
color="neutral-textHigh"
/>
<button
aria-label="Dismiss chip"
data-testid="dismiss-chip-button"
type="button"
onClick={onClick}
className={chip.classnames.chip_close_icon_container}
>
<Icon
data-testid="close-chip"
source={<CloseIcon size={12} />}
color="neutral-textHigh"
/>
</button>
)}
</button>
</div>
);

Chip.Skeleton = ChipSkeleton;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/atomic/Chip/src/chip.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export interface ChipProperties {
}

export type ChipProps = ChipProperties &
ButtonHTMLAttributes<HTMLButtonElement>;
ButtonHTMLAttributes<HTMLButtonElement | HTMLDivElement>;
8 changes: 7 additions & 1 deletion packages/react/src/composite/Sidebar/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

The Sidebar component is a large floating container that goes into the page from the corners. It allows us to present actions, forms or sections with a lot of information about the context of the page.

## 2024-04-15gs `3.3.0`
## 2024-04-22 `3.3.1`

#### πŸ› Bug fixes

- Added `lockScroll` to prevent scroll outside of the body of `Sidebar` component. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/240) by [@nachozullo](https://github.com/nachozullo))

## 2024-04-15 `3.3.0`

#### πŸ› Bug fixes

Expand Down
5 changes: 3 additions & 2 deletions packages/react/src/composite/Sidebar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nimbus-ds/sidebar",
"version": "3.3.0",
"version": "3.3.1-rc.1",
"license": "MIT",
"main": "dist/index.js",
"files": [
Expand Down Expand Up @@ -35,5 +35,6 @@
"@nimbus-ds/button": "workspace:^",
"@nimbus-ds/text": "workspace:^",
"@nimbus-ds/webpack": "workspace:^"
}
},
"stableVersion": "3.3.0"
}
1 change: 1 addition & 0 deletions packages/react/src/composite/Sidebar/src/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const Sidebar: React.FC<SidebarProps> & SidebarComponents = ({
<FloatingOverlay
className={sidebar.classnames.overlay}
data-testid="overlay-sidebar-button"
lockScroll={!needRemoveScroll}
>
<FloatingFocusManager context={context}>
<div
Expand Down
Loading