Skip to content

Commit ce48ca9

Browse files
authored
feat: ui-kit-unified (#392)
1 parent 67a86ec commit ce48ca9

File tree

144 files changed

+2071
-1292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+2071
-1292
lines changed
Binary file not shown.
Binary file not shown.

packages/fuselage-ui-kit/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@
6565
"@rocket.chat/icons": "^0.26.0",
6666
"@rocket.chat/prettier-config": "^0.26.0",
6767
"@rocket.chat/ui-kit": "^0.26.0",
68-
"@storybook/addon-essentials": "^6.2.9",
69-
"@storybook/addons": "^6.2.9",
70-
"@storybook/builder-webpack5": "^6.2.9",
71-
"@storybook/react": "^6.2.9",
72-
"@storybook/source-loader": "^6.2.9",
73-
"@storybook/theming": "^6.2.9",
68+
"@storybook/addon-essentials": "^6.1.11",
69+
"@storybook/addons": "^6.1.11",
70+
"@storybook/builder-webpack5": "^6.1.11",
71+
"@storybook/react": "^6.1.11",
72+
"@storybook/source-loader": "^6.1.11",
73+
"@storybook/theming": "^6.1.11",
7474
"babel-loader": "^8.2.2",
7575
"cross-env": "^7.0.3",
7676
"eslint": "^7.26.0",

packages/fuselage-ui-kit/src/elements/OverflowElement.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const OverflowElement = ({ element, context, parser }) => {
2121
action,
2222
]);
2323

24-
const convertedOptions = convertOptions(options, parser.text);
24+
const convertedOptions = convertOptions(options, parser.text.bind(parser));
2525
const [
2626
cursor,
2727
handleKeyDown,
@@ -68,7 +68,7 @@ const OverflowElement = ({ element, context, parser }) => {
6868
>
6969
<Options
7070
onSelect={handleSelection}
71-
options={convertOptions(options, parser.text)}
71+
options={convertOptions(options, parser.text.bind(parser))}
7272
cursor={cursor}
7373
/>
7474
</PositionAnimated>

packages/fuselage-ui-kit/src/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ export const UiKitComponent = ({ render, blocks }) => render(blocks);
99
export * from './surfaces/banner';
1010
export * from './surfaces/message';
1111
export * from './surfaces/modal';
12-
export * from './surfaces/text';
1312
export * from './hooks';

packages/fuselage-ui-kit/src/surfaces/banner.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { uiKitBanner, UiKitParserBanner } from '@rocket.chat/ui-kit';
1+
import { UiKitParserBanner } from '@rocket.chat/ui-kit';
22
import React from 'react';
33

44
import {
@@ -42,8 +42,6 @@ export const bannerParser = new BannerParser();
4242

4343
export const UiKitBanner = (blocks, conditions = {}) => (
4444
<BannerSurface>
45-
{uiKitBanner(bannerParser, { engine: 'rocket.chat', ...conditions })(
46-
blocks
47-
)}
45+
{bannerParser.render(blocks, { engine: 'rocket.chat', ...conditions })}
4846
</BannerSurface>
4947
);

packages/fuselage-ui-kit/src/surfaces/message.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { uiKitMessage, UiKitParserMessage } from '@rocket.chat/ui-kit';
1+
import { UiKitParserMessage } from '@rocket.chat/ui-kit';
22
import React from 'react';
33

44
import {
@@ -36,8 +36,6 @@ export const messageParser = new MessageParser();
3636

3737
export const UiKitMessage = (blocks, conditions = {}) => (
3838
<MessageSurface>
39-
{uiKitMessage(messageParser, { engine: 'rocket.chat', ...conditions })(
40-
blocks
41-
)}
39+
{messageParser.render(blocks, { engine: 'rocket.chat', ...conditions })}
4240
</MessageSurface>
4341
);

packages/fuselage-ui-kit/src/surfaces/message.stories.js

+48-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/fuselage-ui-kit/src/surfaces/modal.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { uiKitModal, UiKitParserModal } from '@rocket.chat/ui-kit';
1+
import { UiKitParserModal } from '@rocket.chat/ui-kit';
22
import React from 'react';
33

44
import {
@@ -42,6 +42,6 @@ export const modalParser = new ModalParser();
4242

4343
export const UiKitModal = (blocks, conditions = {}) => (
4444
<ModalSurface>
45-
{uiKitModal(modalParser, { engine: 'rocket.chat', ...conditions })(blocks)}
45+
{modalParser.render(blocks, { engine: 'rocket.chat', ...conditions })}
4646
</ModalSurface>
4747
);

packages/fuselage-ui-kit/src/surfaces/text.js

-13
This file was deleted.

packages/fuselage-ui-kit/src/surfaces/text.stories.js

-75
This file was deleted.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "./",
4+
"allowSyntheticDefaultImports": true,
5+
"module": "es2015",
6+
"target": "es5",
7+
"lib": ["es6", "dom"],
8+
"sourceMap": true,
9+
"allowJs": false,
10+
"jsx": "react",
11+
"moduleResolution": "node",
12+
"rootDir": "../",
13+
"outDir": "dist",
14+
"noImplicitReturns": true,
15+
"noImplicitThis": true,
16+
"noImplicitAny": true,
17+
"strictNullChecks": true,
18+
"declaration": true
19+
},
20+
"include": ["src/**/*"],
21+
"exclude": ["node_modules", "dist"]
22+
}

packages/ui-kit/jest.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
preset: 'ts-jest',
3+
testEnvironment: 'node',
34
errorOnDeprecated: true,
45
testMatch: ['<rootDir>/src/**/*.spec.[jt]s?(x)'],
56
globals: {

packages/ui-kit/package.json

+15-4
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,28 @@
1515
"bugs": {
1616
"url": "https://github.com/RocketChat/Rocket.Chat.Fuselage/issues"
1717
},
18-
"main": "dist/index.js",
19-
"types": "dist/index.d.ts",
18+
"main": "dist/cjs/index.js",
19+
"module": "dist/esm/index.js",
20+
"types": "dist/esm/index.d.ts",
21+
"typesVersions": {
22+
"<4.1": {
23+
"*": [
24+
"ts3.4/*"
25+
]
26+
}
27+
},
2028
"files": [
2129
"/dist"
2230
],
2331
"publishConfig": {
2432
"access": "public"
2533
},
2634
"scripts": {
27-
"build": "run-s .:build:clean .:build:prod",
35+
"build": "run-s .:build:clean .:build:esm .:build:cjs .:build:ts3.4",
2836
".:build:clean": "rimraf dist",
29-
".:build:prod": "webpack --mode production",
37+
".:build:esm": "tsc -p tsconfig.json",
38+
".:build:cjs": "tsc -p tsconfig-cjs.json",
39+
".:build:ts3.4": "downlevel-dts dist/esm/ dist/ts3.4/ --to=3.4",
3040
"lint": "eslint --ext js,ts src",
3141
"lint-fix": "eslint --fix --ext js,ts src",
3242
"lint-staged": "lint-staged",
@@ -43,6 +53,7 @@
4353
"@rocket.chat/prettier-config": "^0.26.0",
4454
"@types/jest": "^26.0.23",
4555
"babel-loader": "^8.2.2",
56+
"downlevel-dts": "^0.7.0",
4657
"eslint": "^7.26.0",
4758
"jest": "^26.6.3",
4859
"lint-staged": "^11.0.0",

0 commit comments

Comments
 (0)