@verdaccio/ui-components 2.0.0-6-next.1 → 2.0.0-6-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -0
- package/package.json +5 -3
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# UI Components
|
|
2
|
+
|
|
3
|
+
A collection of components ready to use for building complex user interfaces.
|
|
4
|
+
|
|
5
|
+
- `components`: Independent components to use to build different layouts, all components are based on [MUI (Material UI)](https://mui.com/).
|
|
6
|
+
- `providers`: Providers are useful components that uses the React [`Context`](https://reactjs.org/docs/context.html), for instance, the `VersionProvider` connects the Redux store with independent components. The `AppConfigurationProvider` is able to read the
|
|
7
|
+
- `store`: The Redux store powered by [`Rematch`](https://rematchjs.org), could be used with the global object `__VERDACCIO_BASENAME_UI_OPTIONS` that verdaccio uses to provide the UI configuration.
|
|
8
|
+
- `theme`: The `ThemeProvider` is an abstraction of the _material-ui_ theme provider.
|
|
9
|
+
- `sections`: A group of components to setup quickly sections of the application, like the sidebar, header of footer.
|
|
10
|
+
- `layouts`: Are the combination of one or more sections ready to use.
|
|
11
|
+
- `hooks`: A collection of useful React hooks.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm i -D @verdaccio/ui-components@6-next
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
The set of components requires libraries available in a project:
|
|
20
|
+
|
|
21
|
+
- React >17
|
|
22
|
+
- Material UI >5.x
|
|
23
|
+
- Redux >4.x
|
|
24
|
+
- Emotion >11
|
|
25
|
+
- i18next >20.x
|
|
26
|
+
- TypeScript is optional but recommended.
|
|
27
|
+
|
|
28
|
+
### The store
|
|
29
|
+
|
|
30
|
+
All components assume there is a Redux storage, thus a `<Provider/>` wrap is the required that wrap the application.
|
|
31
|
+
|
|
32
|
+
```jsx
|
|
33
|
+
import { store } from '@verdaccio/ui-components';
|
|
34
|
+
|
|
35
|
+
<Provider store={store}>....APP</Provider>;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The default storage is powered by Rematch and contains the required `dispatch` to fetch data from the registry.
|
|
39
|
+
|
|
40
|
+
- Fetch all private packages
|
|
41
|
+
|
|
42
|
+
```jsx
|
|
43
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
44
|
+
|
|
45
|
+
const packages = useSelector((state: RootState) => state.packages.response);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
dispatch.packages.getPackages();
|
|
48
|
+
}, [dispatch]);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## How to use it
|
|
52
|
+
|
|
53
|
+
```jsx
|
|
54
|
+
import React from 'react';
|
|
55
|
+
import { Route, Router, Switch } from 'react-router-dom';
|
|
56
|
+
import { Provider } from 'react-redux';
|
|
57
|
+
import {
|
|
58
|
+
Home,
|
|
59
|
+
store,
|
|
60
|
+
Loading,
|
|
61
|
+
NotFound,
|
|
62
|
+
Route as Routes,
|
|
63
|
+
TranslatorProvider,
|
|
64
|
+
VersionProvider,
|
|
65
|
+
loadable,
|
|
66
|
+
} from '@verdaccio/ui-components';
|
|
67
|
+
|
|
68
|
+
// to enable webpack code splitting
|
|
69
|
+
const VersionPage = loadable(() => import('../pages/Version'));
|
|
70
|
+
|
|
71
|
+
const App: React.FC = () => {
|
|
72
|
+
// configuration from config.yaml
|
|
73
|
+
const { configOptions } = useConfig();
|
|
74
|
+
const listLanguages = [{lng: 'en-US', icon: <someSVGIcon>, menuKey: 'lng.english'}];
|
|
75
|
+
return (
|
|
76
|
+
<Provider store={store}>
|
|
77
|
+
<AppConfigurationProvider>
|
|
78
|
+
<ThemeProvider>
|
|
79
|
+
<TranslatorProvider i18n={i18n} listLanguages={listLanguages} onMount={() => {}}>
|
|
80
|
+
<Suspense fallback={<Loading />}>
|
|
81
|
+
<Router history={history}>
|
|
82
|
+
<Header HeaderInfoDialog={CustomInfoDialog} />
|
|
83
|
+
<Switch>
|
|
84
|
+
<Route exact={true} path={Routes.ROOT}>
|
|
85
|
+
<Home />
|
|
86
|
+
</Route>
|
|
87
|
+
<Route exact={true} path={Routes.SCOPE_PACKAGE}>
|
|
88
|
+
<VersionProvider>
|
|
89
|
+
<VersionPage />
|
|
90
|
+
</VersionProvider>
|
|
91
|
+
</Route>
|
|
92
|
+
</Switch>
|
|
93
|
+
</Router>
|
|
94
|
+
{configOptions.showFooter && <Footer />}
|
|
95
|
+
</Suspense>
|
|
96
|
+
</TranslatorProvider>
|
|
97
|
+
</ThemeProvider>
|
|
98
|
+
</AppConfigurationProvider>
|
|
99
|
+
</Provider>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
``
|
|
103
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/ui-components",
|
|
3
|
-
"version": "2.0.0-6-next.
|
|
3
|
+
"version": "2.0.0-6-next.2",
|
|
4
4
|
"description": "theme ui component",
|
|
5
5
|
"author": "Juan Picado <juanpicado19@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@rematch/core": "2.2.0",
|
|
20
20
|
"@rematch/loading": "2.1.2",
|
|
21
21
|
"@rematch/persist": "2.1.2",
|
|
22
|
-
"@verdaccio/types": "11.0.0-6-next.
|
|
22
|
+
"@verdaccio/types": "11.0.0-6-next.19",
|
|
23
23
|
"dayjs": "1.11.7",
|
|
24
24
|
"dompurify": "2.4.1",
|
|
25
25
|
"github-markdown-css": "5.1.0",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"test": "cross-env TZ=UTC jest --config jest/jest.config.js",
|
|
74
|
+
"test:html": "cross-env TZ=UTC jest --config jest/jest.config.js --coverage-reporters=html",
|
|
74
75
|
"clean": "rimraf ./build",
|
|
75
76
|
"type-check": "tsc --noEmit -p tsconfig.build.json",
|
|
76
77
|
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
@@ -78,5 +79,6 @@
|
|
|
78
79
|
"build": "pnpm run build:js && pnpm run build:types",
|
|
79
80
|
"storybook": "start-storybook -p 6006 -s ./public",
|
|
80
81
|
"build-storybook": "build-storybook"
|
|
81
|
-
}
|
|
82
|
+
},
|
|
83
|
+
"readme": "# UI Components\n\nA collection of components ready to use for building complex user interfaces.\n\n- `components`: Independent components to use to build different layouts, all components are based on [MUI (Material UI)](https://mui.com/).\n- `providers`: Providers are useful components that uses the React [`Context`](https://reactjs.org/docs/context.html), for instance, the `VersionProvider` connects the Redux store with independent components. The `AppConfigurationProvider` is able to read the\n- `store`: The Redux store powered by [`Rematch`](https://rematchjs.org), could be used with the global object `__VERDACCIO_BASENAME_UI_OPTIONS` that verdaccio uses to provide the UI configuration.\n- `theme`: The `ThemeProvider` is an abstraction of the _material-ui_ theme provider.\n- `sections`: A group of components to setup quickly sections of the application, like the sidebar, header of footer.\n- `layouts`: Are the combination of one or more sections ready to use.\n- `hooks`: A collection of useful React hooks.\n\n```bash\nnpm i -D @verdaccio/ui-components@6-next\n```\n\n## Requirements\n\nThe set of components requires libraries available in a project:\n\n- React >17\n- Material UI >5.x\n- Redux >4.x\n- Emotion >11\n- i18next >20.x\n- TypeScript is optional but recommended.\n\n### The store\n\nAll components assume there is a Redux storage, thus a `<Provider/>` wrap is the required that wrap the application.\n\n```jsx\nimport { store } from '@verdaccio/ui-components';\n\n<Provider store={store}>....APP</Provider>;\n```\n\nThe default storage is powered by Rematch and contains the required `dispatch` to fetch data from the registry.\n\n- Fetch all private packages\n\n```jsx\nimport { useDispatch, useSelector } from 'react-redux';\n\nconst packages = useSelector((state: RootState) => state.packages.response);\nuseEffect(() => {\n dispatch.packages.getPackages();\n}, [dispatch]);\n```\n\n## How to use it\n\n```jsx\nimport React from 'react';\nimport { Route, Router, Switch } from 'react-router-dom';\nimport { Provider } from 'react-redux';\nimport {\n Home,\n store,\n Loading,\n NotFound,\n Route as Routes,\n TranslatorProvider,\n VersionProvider,\n loadable,\n} from '@verdaccio/ui-components';\n\n// to enable webpack code splitting\nconst VersionPage = loadable(() => import('../pages/Version'));\n\nconst App: React.FC = () => {\n // configuration from config.yaml\n const { configOptions } = useConfig();\n const listLanguages = [{lng: 'en-US', icon: <someSVGIcon>, menuKey: 'lng.english'}];\n return (\n <Provider store={store}>\n <AppConfigurationProvider>\n <ThemeProvider>\n <TranslatorProvider i18n={i18n} listLanguages={listLanguages} onMount={() => {}}>\n <Suspense fallback={<Loading />}>\n <Router history={history}>\n <Header HeaderInfoDialog={CustomInfoDialog} />\n <Switch>\n <Route exact={true} path={Routes.ROOT}>\n <Home />\n </Route>\n <Route exact={true} path={Routes.SCOPE_PACKAGE}>\n <VersionProvider>\n <VersionPage />\n </VersionProvider>\n </Route>\n </Switch>\n </Router>\n {configOptions.showFooter && <Footer />}\n </Suspense>\n </TranslatorProvider>\n </ThemeProvider>\n </AppConfigurationProvider>\n </Provider>\n );\n};\n``\n```\n"
|
|
82
84
|
}
|