Skip to content

Commit

Permalink
Merge branch 'RocketChat:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Giridharan002 committed Jan 21, 2024
2 parents a1d0291 + b409394 commit 23741d8
Show file tree
Hide file tree
Showing 50 changed files with 516 additions and 107 deletions.
6 changes: 0 additions & 6 deletions .changeset/fluffy-toys-fix.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/shy-hotels-play.md

This file was deleted.

6 changes: 6 additions & 0 deletions packages/fuselage-hooks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 0.33.0

### Minor Changes

- [#1244](https://github.com/RocketChat/fuselage/pull/1244) [`9be609744`](https://github.com/RocketChat/fuselage/commit/9be609744856f49b8971fb7aa45316ec7fd2463f) Thanks [@tassoevan](https://github.com/tassoevan)! - Deprecate `useMutableCallback` in favor of `useEffectEvent`

## 0.32.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage-hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rocket.chat/fuselage-hooks",
"version": "0.32.1",
"version": "0.33.0",
"description": "React hooks for Fuselage, Rocket.Chat's design system and UI toolkit",
"homepage": "https://rocketchat.github.io/Rocket.Chat.Fuselage/",
"author": {
Expand Down
32 changes: 32 additions & 0 deletions packages/fuselage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Change Log

## 0.44.2

### Patch Changes

- [#1273](https://github.com/RocketChat/fuselage/pull/1273) [`48363f168`](https://github.com/RocketChat/fuselage/commit/48363f168a67ec5fa2c3999a3a53e55d0cd84078) Thanks [@dougfabris](https://github.com/dougfabris)! - fix(fuselage): Add flexGrow for stretch variation

## 0.44.1

### Patch Changes

- [#1271](https://github.com/RocketChat/fuselage/pull/1271) [`7cbad7df4`](https://github.com/RocketChat/fuselage/commit/7cbad7df405439c7b1bd3050bafce15e6b8ceff9) Thanks [@dougfabris](https://github.com/dougfabris)! - fix(fuselage): `ButtonGroup` missing `className` exposure

## 0.44.0

### Minor Changes

- [#1264](https://github.com/RocketChat/fuselage/pull/1264) [`119f80664`](https://github.com/RocketChat/fuselage/commit/119f806649869b1d73bd0f774f7de629cc13bc31) Thanks [@dougfabris](https://github.com/dougfabris)! - feat(fuselage): Add Message focus style

- [`971f07aae`](https://github.com/RocketChat/fuselage/commit/971f07aae4076481fd6b7d37c417d9b00972bc4a) Thanks [@dougfabris](https://github.com/dougfabris)! - feat(fuselage): Avoid `Box` usage on `ButtonGroup`

## 0.43.0

### Minor Changes

- [#1263](https://github.com/RocketChat/fuselage/pull/1263) [`9020c0ee8`](https://github.com/RocketChat/fuselage/commit/9020c0ee87eeb4c903091b0e03ab9802c39591f0) Thanks [@juliajforesti](https://github.com/juliajforesti)! - feat(fuselage): new `Bubble` component

- [#1221](https://github.com/RocketChat/fuselage/pull/1221) [`769e5ea43`](https://github.com/RocketChat/fuselage/commit/769e5ea43fa7c83f988d7dfb042aeafaf66e1ad5) Thanks [@VanshulB](https://github.com/VanshulB)! - Add missing message body additional styles to `MessageBody`

### Patch Changes

- [#1244](https://github.com/RocketChat/fuselage/pull/1244) [`9be609744`](https://github.com/RocketChat/fuselage/commit/9be609744856f49b8971fb7aa45316ec7fd2463f) Thanks [@tassoevan](https://github.com/tassoevan)! - Deprecate `useMutableCallback` in favor of `useEffectEvent`

## 0.42.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rocket.chat/fuselage",
"version": "0.42.0",
"version": "0.44.2",
"description": "Rocket.Chat's React Components Library",
"author": {
"name": "Rocket.Chat",
Expand Down
31 changes: 31 additions & 0 deletions packages/fuselage/src/components/Bubble/Bubble.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { composeStories } from '@storybook/testing-react';
import { render } from '@testing-library/react';
import { axe } from 'jest-axe';
import React from 'react';

import * as stories from './Bubble.stories';

const testCases = Object.values(composeStories(stories)).map((Story) => [
Story.storyName || 'Story',
Story,
]);

describe('[Bubble Rendering]', () => {
test.each(testCases)(
`renders %s without crashing`,
async (_storyname, Story) => {
const tree = render(<Story />);
expect(tree.baseElement).toMatchSnapshot();
}
);

test.each(testCases)(
'%s should have no a11y violations',
async (_storyname, Story) => {
const { container } = render(<Story />);

const results = await axe(container);
expect(results).toHaveNoViolations();
}
);
});
33 changes: 33 additions & 0 deletions packages/fuselage/src/components/Bubble/Bubble.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { action } from '@storybook/addon-actions';
import type { ComponentMeta, ComponentStory } from '@storybook/react';
import React from 'react';

import { Bubble } from '../..';

export default {
title: 'Data Display/Bubble',
component: Bubble,
} as ComponentMeta<typeof Bubble>;

const Template: ComponentStory<typeof Bubble> = (args) => <Bubble {...args} />;

export const IconAndLabel = Template.bind({});
IconAndLabel.args = {
children: 'New messages',
onClick: action('click'),
icon: 'arrow-down',
};

export const Dismissable = Template.bind({});
Dismissable.args = {
children: 'New messages',
icon: 'arrow-down',
onClick: action('click'),
onDismiss: action('dismiss'),
};

export const LabelOnly = Template.bind({});
LabelOnly.args = {
children: 'See new messages',
onClick: action('click'),
};
43 changes: 43 additions & 0 deletions packages/fuselage/src/components/Bubble/Bubble.styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@use '../../styles/colors.scss';
@use '../../styles/lengths.scss';
@use '../../styles/typography.scss';

@use '../../styles/variables/buttons.scss' as buttonColors;
@use '../../styles/primitives/button.scss';
@use '../../styles/mixins/interactivity.scss';

.rcx-bubble {
display: flex;
align-items: center;

&__content,
&__dismiss {
@include typography.use-font-scale(c2);
@include button.kind-variant(buttonColors.$primary);
@include clickable;
@include click-animation;

display: flex;
justify-content: center;
align-items: center;

height: lengths.size(28);

padding-inline-start: lengths.padding(12);
padding-inline-end: lengths.padding(16);

border-radius: lengths.border-radius(extra-large);
}

&__group {
:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}

:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
}
46 changes: 46 additions & 0 deletions packages/fuselage/src/components/Bubble/Bubble.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import type { Keys as IconName } from '@rocket.chat/icons';
import type { AllHTMLAttributes, ButtonHTMLAttributes, ReactNode } from 'react';
import React from 'react';

import { Icon } from '../Icon';

type BubbleProps = {
children: ReactNode;
onClick: () => void;
icon?: IconName;
onDismiss?: () => void;
contentProps?: ButtonHTMLAttributes<HTMLButtonElement>;
dismissProps?: ButtonHTMLAttributes<HTMLButtonElement>;
} & AllHTMLAttributes<HTMLDivElement>;

export const Bubble = ({
children,
onClick,
icon,
onDismiss,
contentProps,
dismissProps,
...props
}: BubbleProps) => (
<div
className={`rcx-bubble rcx-box rcx-box--full ${
onDismiss ? 'rcx-bubble__group' : ''
}`}
{...props}
>
<button className='rcx-bubble__content' onClick={onClick} {...contentProps}>
{icon && <Icon name={icon} size='x16' mie={8} />}
<span>{children}</span>
</button>
{onDismiss && (
<button
aria-label={`Dismiss ${children}`}
className='rcx-bubble__dismiss'
onClick={onDismiss}
{...dismissProps}
>
<Icon name='cross-small' size='x16' />
</button>
)}
</div>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`[Bubble Rendering] renders Dismissable without crashing 1`] = `
<body>
<div>
<div
class="rcx-bubble rcx-box rcx-box--full rcx-bubble__group"
>
<button
class="rcx-bubble__content"
>
<i
aria-hidden="true"
class="rcx-box rcx-box--full rcx-icon--name-arrow-down rcx-icon rcx-css-gcnmf8"
>
</i>
<span>
New messages
</span>
</button>
<button
aria-label="Dismiss New messages"
class="rcx-bubble__dismiss"
>
<i
aria-hidden="true"
class="rcx-box rcx-box--full rcx-icon--name-cross-small rcx-icon rcx-css-1g87xs3"
>
</i>
</button>
</div>
</div>
</body>
`;

exports[`[Bubble Rendering] renders IconAndLabel without crashing 1`] = `
<body>
<div>
<div
class="rcx-bubble rcx-box rcx-box--full "
>
<button
class="rcx-bubble__content"
>
<i
aria-hidden="true"
class="rcx-box rcx-box--full rcx-icon--name-arrow-down rcx-icon rcx-css-gcnmf8"
>
</i>
<span>
New messages
</span>
</button>
</div>
</div>
</body>
`;

exports[`[Bubble Rendering] renders LabelOnly without crashing 1`] = `
<body>
<div>
<div
class="rcx-bubble rcx-box rcx-box--full "
>
<button
class="rcx-bubble__content"
>
<span>
See new messages
</span>
</button>
</div>
</div>
</body>
`;
1 change: 1 addition & 0 deletions packages/fuselage/src/components/Bubble/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Bubble';
2 changes: 1 addition & 1 deletion packages/fuselage/src/components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const Variants: ComponentStory<typeof Button> = () => (
);

export const Sizes: ComponentStory<typeof ButtonGroup> = () => (
<ButtonGroup marginBlockEnd={12}>
<ButtonGroup>
<Button small>Small</Button>
<Button medium>Medium</Button>
<Button>Default</Button>
Expand Down
13 changes: 3 additions & 10 deletions packages/fuselage/src/components/Button/Button.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@use '../../styles/variables/buttons.scss' as colors;
@use '../../styles/primitives/button.scss';
@use '../../styles/mixins/size.scss';
@use '../../styles/mixins/interactivity.scss';
@import '../../styles/mixins/states.scss';

.rcx-button {
Expand Down Expand Up @@ -33,21 +34,13 @@
}
}

@mixin click-animation() {
@include on-active {
> *:not(div[role='status']) {
transform: translateY(1px);
}
}
}

display: inline-block;

text-align: center;
white-space: nowrap;
text-decoration: none;

@include click-animation();
@include click-animation($excludeRole: 'status');

.rcx-button--content {
display: inline-block;
Expand Down Expand Up @@ -111,7 +104,7 @@

&--icon {
@include button.kind-variant(colors.$icon);
@include click-animation();
@include click-animation('status');

padding: 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
&--stretch {
justify-content: stretch;
align-items: stretch;

flex-grow: 1;
}

&--vertical {
Expand Down
Loading

0 comments on commit 23741d8

Please sign in to comment.