Skip to content

Commit

Permalink
Merge branch 'new/image-manipulation' of github.com:RocketChat/Rocket…
Browse files Browse the repository at this point in the history
….Chat.Fuselage into new/image-manipulation

* 'new/image-manipulation' of github.com:RocketChat/Rocket.Chat.Fuselage:
  Update tsconfig.json
  chore: Update icon building readme (#472)
  fix: Menu component and options.label prop type (#476)
  fix: endReached prop in _Options of PaginatedSelectFiltered Component (#475)
  fix: Export MultiSelect component in .d.ts file (#473)
  feat(ui-kit): Attachment Surface (#474)
  fix(fuselage): Fuselage production build (#477)
  feat: onboarding-ui package (#463)
  fix(eslint): Add missing ESLint rule for TypeScript (#470)
  fix(string-helpers):  typesVersions (#469)
  • Loading branch information
gabriellsh committed Jun 23, 2021
2 parents 7b93a7b + 38b9cdd commit 9daed46
Show file tree
Hide file tree
Showing 61 changed files with 2,092 additions and 32 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
path: |
packages/fuselage/storybook-static
packages/fuselage-ui-kit/storybook-static
packages/onboarding-ui/storybook-static
- if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -111,9 +112,10 @@ jobs:
name: docs
path: .
- run: |
rm -rf "fuselage/${{ needs.build-and-test.outputs.branch-name }}" "fuselage-ui-kit/${{ needs.build-and-test.outputs.branch-name }}"
rm -rf "fuselage/${{ needs.build-and-test.outputs.branch-name }}" "fuselage-ui-kit/${{ needs.build-and-test.outputs.branch-name }}" "onboarding-ui/${{ needs.build-and-test.outputs.branch-name }}"
mv -v "packages/fuselage/storybook-static" "fuselage/${{ needs.build-and-test.outputs.branch-name }}"
mv -v "packages/fuselage-ui-kit/storybook-static" "fuselage-ui-kit/${{ needs.build-and-test.outputs.branch-name }}"
mv -v "packages/onboarding-ui/storybook-static" "onboarding-ui/${{ needs.build-and-test.outputs.branch-name }}"
rm -rf packages
- uses: crazy-max/ghaction-github-pages@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-pr-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v2
with:
ref: gh-pages
- run: rm -rf "fuselage/${{ github.event.number }}" "fuselage-ui-kit/${{ github.event.number }}"
- run: rm -rf "fuselage/${{ github.event.number }}" "fuselage-ui-kit/${{ github.event.number }}" "onboarding-ui/${{ github.event.number }}"
- uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci-pr-opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
path: |
fuselage/storybook-static
fuselage-ui-kit/storybook-static
onboarding-ui/storybook-static
publish-to-gh-pages:
name: Publish to GitHub Pages
Expand All @@ -61,9 +62,10 @@ jobs:
name: storybooks
path: packages
- run: |
rm -rf "fuselage/${{ needs.download-artifact.outputs.pr-number }}" "fuselage-ui-kit/${{ needs.download-artifact.outputs.pr-number }}"
rm -rf "fuselage/${{ needs.download-artifact.outputs.pr-number }}" "fuselage-ui-kit/${{ needs.download-artifact.outputs.pr-number }}" "onboarding-ui/${{ needs.download-artifact.outputs.pr-number }}"
mv -v packages/fuselage/storybook-static "fuselage/${{ needs.download-artifact.outputs.pr-number }}"
mv -v packages/fuselage-ui-kit/storybook-static "fuselage-ui-kit/${{ needs.download-artifact.outputs.pr-number }}"
mv -v packages/onboarding-ui/storybook-static "onboarding-ui/${{ needs.download-artifact.outputs.pr-number }}"
rm -rf packages
- uses: crazy-max/ghaction-github-pages@v2
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
path: |
packages/fuselage/storybook-static
packages/fuselage-ui-kit/storybook-static
packages/onboarding-ui/storybook-static
test-with-loki:
name: Test with Loki
Expand Down Expand Up @@ -63,11 +64,16 @@ jobs:
- run: |
cat packages/fuselage/package.json | sed s/\.docker/.app/ > packages/fuselage/package.json-new
cat packages/fuselage-ui-kit/package.json | sed s/\.docker/.app/ > packages/fuselage-ui-kit/package.json-new
cat packages/onboarding-ui/package.json | sed s/\.docker/.app/ > packages/onboarding-ui/package.json-new
mv packages/fuselage/package.json-new packages/fuselage/package.json
mv packages/fuselage-ui-kit/package.json-new packages/fuselage-ui-kit/package.json
mv packages/onboarding-ui/package.json-new packages/onboarding-ui/package.json
- uses: ./.github/actions/loki/test
with:
working_dir: ./packages/fuselage
- uses: ./.github/actions/loki/test
with:
working_dir: ./packages/fuselage-ui-kit
- uses: ./.github/actions/loki/test
with:
working_dir: ./packages/onboarding-ui
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
"directory": "packages/mp3-encoder",
"changeProcessCWD": true
},
{
"directory": "packages/onboarding-ui",
"changeProcessCWD": true
},
{
"directory": "packages/peggy-loader",
"changeProcessCWD": true
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
| 📦 [`@rocket.chat/fuselage-ui-kit`](/packages/@rocket.chat/fuselage-ui-kit) | UiKit elements for Rocket.Chat Apps built under Fuselage design system | ![npm](https://img.shields.io/npm/v/@rocket.chat/fuselage-ui-kit?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Ffuselage-ui-kit&style=flat-square) |
| 📦 [`@rocket.chat/icons`](/packages/@rocket.chat/icons) | | ![npm](https://img.shields.io/npm/v/@rocket.chat/icons?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Ficons&style=flat-square) |
| 📦 [`@rocket.chat/image-manipulation`](/packages/@rocket.chat/image-manipulation) | Image transform functions | ![npm](https://img.shields.io/npm/v/@rocket.chat/image-manipulation?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Fimage-manipulation&style=flat-square) |
| 📦 [`@rocket.chat/image-manipulation`](/packages/@rocket.chat/image-manipulation) | Image transform functions | ![npm](https://img.shields.io/npm/v/@rocket.chat/image-manipulation?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Fimage-manipulation&style=flat-square) |
| 📦 [`@rocket.chat/memo`](/packages/@rocket.chat/memo) | Memoization utilities | ![npm](https://img.shields.io/npm/v/@rocket.chat/memo?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Fmemo&style=flat-square) |
| 📦 [`@rocket.chat/message-parser`](/packages/@rocket.chat/message-parser) | Rocket.Chat parser for messages | ![npm](https://img.shields.io/npm/v/@rocket.chat/message-parser?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Fmessage-parser&style=flat-square) |
| 📦 [`@rocket.chat/mp3-encoder`](/packages/@rocket.chat/mp3-encoder) | A LAME encoder to be used in web workers | ![npm](https://img.shields.io/npm/v/@rocket.chat/mp3-encoder?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Fmp3-encoder&style=flat-square) |
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config-alt/typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-use-before-define': ['error'],
'func-call-spacing': 'off',
'indent': 'off',
'import/order': [
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/fuselage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
Firstly, install the peer dependencies (prerequisites):

```sh
npm i @rocket.chat/fuselage-hooks @rocket.chat/fuselage-polyfills @rocket.chat/icons react react-dom
npm i @rocket.chat/fuselage-hooks @rocket.chat/fuselage-polyfills @rocket.chat/icons react react-dom react-virtuoso

# or, if you are using yarn:

yarn add @rocket.chat/fuselage-hooks @rocket.chat/fuselage-polyfills @rocket.chat/icons react react-dom
yarn add @rocket.chat/fuselage-hooks @rocket.chat/fuselage-polyfills @rocket.chat/icons react react-dom react-virtuoso
```

Add `@rocket.chat/fuselage` as a dependency:
Expand Down
10 changes: 5 additions & 5 deletions packages/fuselage/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = require('./dist/fuselage.development.js');
// if (process.env.NODE_ENV === 'production') {
// module.exports = require('./dist/fuselage.production.js');
// } else {
// }
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/fuselage.production.js');
} else {
module.exports = require('./dist/fuselage.development.js');
}
5 changes: 1 addition & 4 deletions packages/fuselage/src/components/Menu/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ type MenuProps = Omit<ComponentProps<typeof ActionButton>, 'icon'> & {
icon?: string;
options: {
[id: string]: {
label: {
title: string;
icon: string;
};
label: ReactElement | string;
action: () => void;
};
};
Expand Down
12 changes: 6 additions & 6 deletions packages/fuselage/src/components/Message/Metrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ const ContentItem: FC = (props) => (
<div className='rcx-message-metrics__content-item' {...props} />
);

export const Reply: FC<ComponentProps<typeof Button>> = (props) => (
<MetricsItem>
<Button {...props} {...{ small: true, primary: true }} />
</MetricsItem>
);

type IconProps = { name: 'thread' | 'user' | 'clock' | 'discussion' };
type FollowingProps = { name: 'bell' | 'bell-off' };

Expand Down Expand Up @@ -47,6 +41,12 @@ const MetricsFollowing: FC<FollowingProps> = ({ name }) => (
/>
);

export const Reply: FC<ComponentProps<typeof Button>> = (props) => (
<MetricsItem>
<Button {...props} {...{ small: true, primary: true }} />
</MetricsItem>
);

Metrics.Reply = Reply;

Metrics.Item = MetricsItem;
Expand Down
2 changes: 2 additions & 0 deletions packages/fuselage/src/components/OptionsPaginated/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const CheckOption = React.memo(
export const OptionsPaginated = React.forwardRef(
(
{
title,
multiple,
renderEmpty: EmptyComponent = Empty,
options,
Expand All @@ -43,6 +44,7 @@ export const OptionsPaginated = React.forwardRef(
const { value, label, selected } = data;
return (
<OptionComponent
{...(title && { title: label })}
role='option'
label={label}
onMouseDown={(e) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fuselage/src/components/Select/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ type SelectProps = Omit<ComponentProps<typeof Box>, 'onChange'> & {
};

export const Select: ForwardRefExoticComponent<SelectProps>;

export const MultiSelect: ForwardRefExoticComponent<SelectProps>;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import Margins from '../Margins';
import { OptionsPaginated, useVisible } from '../OptionsPaginated';
import { Focus, Addon } from '../Select';

const SelectedOptions = React.memo((props) => <Chip {...props} />);
const SelectedOptions = React.memo((props) => (
<Chip maxWidth='150px' withTruncatedText {...props} />
));

const prevent = (e) => {
e.preventDefault();
Expand All @@ -21,6 +23,7 @@ const prevent = (e) => {
};

export const PaginatedMultiSelect = ({
withTitle,
value,
filter,
options = [],
Expand Down Expand Up @@ -94,6 +97,11 @@ export const PaginatedMultiSelect = ({
/>
{currentValue.map((value) => (
<SelectedOptions
{...(withTitle && {
title:
value.label ||
options.find((val) => val.value === value)?.label,
})}
tabIndex={-1}
role='option'
key={value && value.value}
Expand Down Expand Up @@ -133,6 +141,7 @@ export const PaginatedMultiSelect = ({
<AnimatedVisibility visibility={visible}>
<Position anchor={containerRef}>
<_Options
{...(withTitle && { title: withTitle })}
width={borderBoxSize.inlineSize}
onMouseDown={prevent}
multiple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const useDidUpdate = (func = []) => {

export const PaginatedSelect = ({
value,
withTitle,
filter,
setFilter,
error,
Expand All @@ -59,6 +60,7 @@ export const PaginatedSelect = ({
onChange = () => {},
placeholder = '',
renderOptions: _Options = OptionsPaginated,
endReached,
...props
}) => {
const [internalValue, setInternalValue] = useState(value);
Expand Down Expand Up @@ -144,11 +146,13 @@ export const PaginatedSelect = ({
</Wrapper>
<PositionAnimated visible={visible} anchor={containerRef}>
<_Options
{...(withTitle && { title: withTitle })}
width={borderBoxSize.inlineSize}
role='listbox'
filter={filter}
options={options}
onSelect={internalChangedByClick}
endReached={endReached}
/>
</PositionAnimated>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export const thumb =
'data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';

export const optionsEllipses = [
[11, 'Very very very very very very very very very large text'],
{
value: 1000,
label: 'Very very very very very very very very very large text',
},
...options,
];

Expand All @@ -37,6 +40,17 @@ An input for selection of options.
</Story>
</Canvas>

<Canvas>
<Story name='WithTitle'>
<PaginatedSelect
withTitle
width='250px'
placeholder='Placeholder here...'
options={optionsEllipses}
/>
</Story>
</Canvas>

<Canvas>
<Story name='Error'>
<PaginatedSelect
Expand Down Expand Up @@ -87,7 +101,7 @@ An input for selection of options.
<Story name='Select with filter and ellipses'>
<PaginatedSelectFiltered
width='250px'
value={11}
value={1000}
placeholder='Placeholder here...'
options={optionsEllipses}
/>
Expand Down Expand Up @@ -125,7 +139,12 @@ An input for selection of options.

<Canvas>
<Story name='PaginatedMultiSelect'>
<PaginatedMultiSelect placeholder='Placeholder here...' options={options} />
<PaginatedMultiSelect
withTitle
placeholder='Placeholder here...'
value={[1000, 2, 3]}
options={optionsEllipses}
/>
</Story>
</Canvas>

Expand Down
8 changes: 8 additions & 0 deletions packages/icons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ yarn build

<!--/yarn(build)-->

After building, make sure to run at the root:

```sh
yarn

yarn update-storybook
```

### Linting

To ensure the source is matching our coding style, we perform [linting](<https://en.wikipedia.org/wiki/Lint_(software)>).
Expand Down
1 change: 1 addition & 0 deletions packages/image-manipulation/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"sourceMap": true,
"outDir": "./dist/esm",
"strict": true,
"jsx": "react-jsx",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
Expand Down
10 changes: 5 additions & 5 deletions packages/message-parser/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ export const color = (r: number, g: number, b: number, a = 255): Color => ({
value: { r, g, b, a },
});

export const emoji = (() => {
const fn = generate('EMOJI');
return (value: string) => fn(plain(value));
})();

export const heading = (
value: Heading['value'],
level: Heading['level'] = 1
Expand Down Expand Up @@ -89,6 +84,11 @@ export const mentionUser = (() => {
return (value: string) => fn(plain(value));
})();

export const emoji = (() => {
const fn = generate('EMOJI');
return (value: string) => fn(plain(value));
})();

export const reducePlainTexts = (
values: Paragraph['value']
): Paragraph['value'] =>
Expand Down
3 changes: 3 additions & 0 deletions packages/onboarding-ui/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
/dist
!/.storybook
6 changes: 6 additions & 0 deletions packages/onboarding-ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: '@rocket.chat/eslint-config-alt/typescript',
env: {
jest: true,
},
};
2 changes: 2 additions & 0 deletions packages/onboarding-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.storybook/jest-results.json
/dist
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/onboarding-ui/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/dist
1 change: 1 addition & 0 deletions packages/onboarding-ui/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@rocket.chat/prettier-config/fuselage');
Loading

0 comments on commit 9daed46

Please sign in to comment.