Split packages into platform and extensions
This commit is contained in:
1 parent
f175d4b96b
commit
e8969fba11
992 files changed
+2
-1
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import { Link } from 'docz';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const NameSpace = ({ name }) => (
|
||||
<Fragment>
|
||||
The namespace used on this component was: <pre>{name}</pre> Check the{' '}
|
||||
<Link to="/translating#how-to-translate-components">translation docs</Link>{' '}
|
||||
to see how to override it.
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
NameSpace.propTypes = {
|
||||
name: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default NameSpace;
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
---
|
||||
name: Compatibility
|
||||
route: /compatibility
|
||||
---
|
||||
|
||||
# Compatibility
|
||||
|
||||
## Browser Support
|
||||
|
||||
React Viewerbase relies on
|
||||
[browsers supported by Styled Components](https://www.styled-components.com/docs/faqs#which-browsers-are-supported)
|
||||
or browsers supported by emotion.
|
||||
|
||||
Supported Browsers: IE11, IE 9+ (with Map + Set polyfills), Chrome, Firefox (and
|
||||
derivatives), Edge, and Safari.
|
||||
Whitespace-only changes.
@@ -0,0 +1,13 @@
|
||||
---
|
||||
name: Docs Settings
|
||||
route: /docs-settings
|
||||
---
|
||||
|
||||
import LanguageSwitcher from '../components/languageSwitcher';
|
||||
|
||||
# Components Language
|
||||
|
||||
You can change the language of the components displayed in this documentation by
|
||||
choosing an option in the selector below:
|
||||
|
||||
<LanguageSwitcher />
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
name: Getting Started
|
||||
route: /getting-started
|
||||
---
|
||||
|
||||
# Getting Started
|
||||
|
||||
## Installation
|
||||
|
||||
> This component library is pre- v1.0. All realeases until a v1.0 have the
|
||||
> possibility of introducing breaking changes. Please depend on an "exact"
|
||||
> version in your projects to prevent issues caused by loose versioning.
|
||||
|
||||
Install `react-viewerbase` from npm:
|
||||
|
||||
```shell
|
||||
// with npm
|
||||
npm i react-viewerbase --save-exact
|
||||
|
||||
// with yarn
|
||||
yarn add react-viewerbase --exact
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
There is some setup required for `react-viewerbase`. We are working to eliminate
|
||||
these requirements with the goal of providing ready to use components.
|
||||
|
||||
### External Dependencies
|
||||
|
||||
We have tried to keep the number of external dependencies limited to make setup
|
||||
as easy as possible. You will, however, need to include either the default font
|
||||
or the font you set for your theme:
|
||||
|
||||
```js
|
||||
// Google Fonts, Sanchez & Roboto
|
||||
'https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700|Sanchez&display=swap';
|
||||
```
|
||||
|
||||
React Viewerbase also looks for theme CSS variabled defined on `:root`. You can
|
||||
find a list of variables [on the theming page](/styling-and-theming)
|
||||
|
||||
### Import & Use
|
||||
|
||||
You can use components in your React app:
|
||||
|
||||
```js
|
||||
import React, { Component } from 'react';
|
||||
import { LayoutButton } from 'react-viewerbase';
|
||||
|
||||
class Example extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
selectedCell: {
|
||||
className: 'hover',
|
||||
col: 1,
|
||||
row: 1,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<LayoutButton
|
||||
selectedCell={this.state.selectedCell}
|
||||
onChange={cell => this.setState({ selectedCell: cell })}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> NOTE: It is heavily recommended that you use a CSS reset or normalize. As well
|
||||
> as the following style: `* { Box-sizing: Border-box }`
|
||||
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ lang }}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="description" content="{{ description }}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
|
||||
<title>{{ title }}</title>
|
||||
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="/public/docz.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700|Sanchez&display=swap">
|
||||
|
||||
<style>
|
||||
/* "Tide" theme */
|
||||
/* TODO:
|
||||
- Convert the other themes to CSS Variables
|
||||
- Allow user to set default CSS theme in JS config
|
||||
- Export the themes as identical JS objects
|
||||
- For theme switcher, update root-level CSS properties via JS (https://medium.com/@_bengarrison/accessing-and-modifying-css-variables-with-javascript-2ccb735bbff0)
|
||||
*/
|
||||
:root {
|
||||
/* Interface UI Colors */
|
||||
--default-color: #9CCEF9;
|
||||
--hover-color: #ffffff;
|
||||
--active-color: #20A5D6;
|
||||
--ui-border-color: #44626F;
|
||||
--ui-border-color-dark: #3C5D80;
|
||||
--ui-border-color-active: #00a4d9;
|
||||
--primary-background-color: #000000;
|
||||
--box-background-color: #3E5975;
|
||||
|
||||
--text-primary-color: #ffffff;
|
||||
--text-secondary-color: #91B9CD;
|
||||
--input-background-color: #2c363f;
|
||||
--input-placeholder-color: #d3d3d3;
|
||||
|
||||
--table-hover-color: #2c363f;
|
||||
--table-text-primary-color: #ffffff;
|
||||
--table-text-secondary-color: #91b9cd;
|
||||
|
||||
--large-numbers-color:#6FBDE2;
|
||||
|
||||
--state-error: #FFCCCC;
|
||||
--state-error-border: #FFCCCC;
|
||||
--state-error-text: #FFCCCC;
|
||||
|
||||
/* Common palette */
|
||||
--ui-yellow: #E29E4A;
|
||||
--ui-sky-blue: #6FBDE2;
|
||||
/* State palette */
|
||||
--ui-state-error: #FFCCCC;
|
||||
--ui-state-error-border: #993333;
|
||||
--ui-state-error-text: #661111;
|
||||
--ui-gray-lighter: #436270;
|
||||
--ui-gray-light: #516873;
|
||||
--ui-gray: #263340;
|
||||
--ui-gray-dark: #16202B;
|
||||
--ui-gray-darker: #151A1F;
|
||||
--ui-gray-darkest: #14202A;
|
||||
|
||||
--calendar-day-color: #d3d3d3;
|
||||
--calendar-day-border-color: #d3d3d3;
|
||||
--calendar-day-active-hover-background-color: #516873;
|
||||
--calendar-main-color: #263340;
|
||||
--viewport-border-thickness: 1px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Roboto', sans-serif !important;
|
||||
}
|
||||
</style>
|
||||
{{ head }}
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" />
|
||||
{{ footer }}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
name: Introduction
|
||||
route: /
|
||||
---
|
||||
|
||||
import { Playground, Props } from 'docz'
|
||||
import { State } from 'react-powerplug'
|
||||
import { TableList, TableListItem } from './../index.js'
|
||||
|
||||
# Introduction
|
||||
|
||||
**React Viewerbase is a collection of components and utilities** that power
|
||||
OHIF's [zero-footprint DICOM viewer](https://github.com/OHIF/Viewers)
|
||||
([demo][demo-url]). We maintain them as a separate component library to:
|
||||
|
||||
- Decouple presentation from business logic
|
||||
- Test and develop components in isolation
|
||||
- Provide well documented, reusable components
|
||||
- Aid rapid application development for context specific viewers
|
||||
|
||||
## Quick Example
|
||||
|
||||
> This component library is pre- v1.0. All realeases until a v1.0 have the
|
||||
> possibility of introducing breaking changes. Please depend on an "exact"
|
||||
> version in your projects to prevent issues caused by loose versioning.
|
||||
|
||||
```js
|
||||
// Add 'react-viewerbase' as a dependency
|
||||
yarn add react-viewerbase
|
||||
|
||||
// Import and use components
|
||||
import { TableList } from 'react-viewerbase'
|
||||
```
|
||||
|
||||
<Playground>
|
||||
<State
|
||||
initial={{
|
||||
selectedIndex: null,
|
||||
listItems: [
|
||||
{ label: 'Brain Left' },
|
||||
{ label: 'Brain Right' },
|
||||
{ label: 'Heart Left' },
|
||||
{ label: 'Heart Right' },
|
||||
],
|
||||
}}
|
||||
>
|
||||
{({ state, setState }) => (
|
||||
<TableList headerTitle="Example Table List Header">
|
||||
{state.listItems.map((item, index) => {
|
||||
return (
|
||||
<TableListItem
|
||||
key={`item_${index}`}
|
||||
itemClass={state.selectedIndex === index ? 'selected' : ''}
|
||||
itemIndex={index}
|
||||
onItemClick={() => alert('item clicked')}
|
||||
>
|
||||
<label>{item.label}</label>
|
||||
</TableListItem>
|
||||
)
|
||||
})}
|
||||
</TableList>
|
||||
)}
|
||||
</State>
|
||||
</Playground>
|
||||
|
||||
## FAQ
|
||||
|
||||
...
|
||||
|
||||
<!--
|
||||
Links
|
||||
-->
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
[demo-url]: https://docs.ohif.org/demo/
|
||||
<!-- prettier-ignore-end -->
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: Styling & Theming
|
||||
route: /styling-and-theming
|
||||
---
|
||||
|
||||
# Styling & Theming
|
||||
|
||||
```css
|
||||
:root {
|
||||
/* Interface UI Colors */
|
||||
--default-color: #9ccef9;
|
||||
--hover-color: #ffffff;
|
||||
--active-color: #20a5d6;
|
||||
--ui-border-color: #44626f;
|
||||
--ui-border-color-dark: #3c5d80;
|
||||
--ui-border-color-active: #00a4d9;
|
||||
--primary-background-color: #000000;
|
||||
--box-background-color: #3e5975;
|
||||
|
||||
--text-primary-color: #ffffff;
|
||||
--text-secondary-color: #91b9cd;
|
||||
--input-background-color: #2c363f;
|
||||
--input-placeholder-color: #d3d3d3;
|
||||
|
||||
--table-hover-color: #2c363f;
|
||||
--table-text-primary-color: #ffffff;
|
||||
--table-text-secondary-color: #91b9cd;
|
||||
|
||||
--large-numbers-color: #6fbde2;
|
||||
|
||||
--state-error: #ffcccc;
|
||||
--state-error-border: #ffcccc;
|
||||
--state-error-text: #ffcccc;
|
||||
|
||||
/* Common palette */
|
||||
--ui-yellow: #e29e4a;
|
||||
--ui-sky-blue: #6fbde2;
|
||||
|
||||
/* State palette */
|
||||
--ui-state-error: #ffcccc;
|
||||
--ui-state-error-border: #993333;
|
||||
--ui-state-error-text: #661111;
|
||||
--ui-gray-lighter: #436270;
|
||||
--ui-gray-light: #516873;
|
||||
--ui-gray: #263340;
|
||||
--ui-gray-dark: #16202b;
|
||||
--ui-gray-darker: #151a1f;
|
||||
--ui-gray-darkest: #14202a;
|
||||
|
||||
--calendar-day-color: #d3d3d3;
|
||||
--calendar-day-border-color: #d3d3d3;
|
||||
--calendar-day-active-hover-background-color: #516873;
|
||||
--calendar-main-color: #263340;
|
||||
--viewport-border-thickness: 1px;
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,87 @@
|
||||
---
|
||||
name: Translating
|
||||
route: /translating
|
||||
---
|
||||
|
||||
# Translating
|
||||
|
||||
**React Viewerbase** supports internationalization using
|
||||
[i18next](https://www.i18next.com/) through the npm package
|
||||
[@ohif/i18n](https://www.npmjs.com/package/@ohif/i18n), where is the main
|
||||
instance of i18n containing several languages and tools.
|
||||
|
||||
## How to translate components
|
||||
|
||||
All you need is to use the internal custom superset of
|
||||
[withTranslation HOC](https://react.i18next.com/latest/withtranslation-hoc),
|
||||
available at `src/utils/LanguageProvider.js`
|
||||
|
||||
e.g.:
|
||||
|
||||
```js
|
||||
import React from 'react';
|
||||
import { withTranslation } from '../utils/LanguageProvider.js';
|
||||
|
||||
function MyComponent({ t }) {
|
||||
return <p>{t('my translated text')}</p>;
|
||||
}
|
||||
|
||||
export default withTranslation('MyNameSpace')(MyComponent);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Namespaces
|
||||
|
||||
For further information about namespaces and how they work, please visit
|
||||
[OHIF Namespaces docs](https://docs.ohif.org/essentials/translating.html#namespaces).
|
||||
|
||||
### How to get right the Name Space of a react-viewerbase component?
|
||||
|
||||
Check the component's page in this site, the NameSpace information should be on
|
||||
the bottom line.
|
||||
|
||||
Also, a nameSpace is defined when exporting a component, this information can be
|
||||
found on exports trough the code, in case of missing in docs.
|
||||
|
||||
E.g.
|
||||
|
||||
```
|
||||
export default withTranslation('TheNamespaceYouAreLookingFor')(TheComponentYouWantToUse);
|
||||
```
|
||||
|
||||
### How to use another NameSpace inside the current NameSpace?
|
||||
|
||||
i18next provides a parsing feature able to get translations strings from any
|
||||
NameSpace, like this following example getting data from `InnerSpace` NameSpace:
|
||||
|
||||
```
|
||||
$t(InnerSpace:Reset)
|
||||
export default withTranslation('OuterSpace')(TheComponent);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## I18next Provider
|
||||
|
||||
**React Viewerbase** pass down the `t` function trough the custom
|
||||
[withTranslation HOC](https://github.com/OHIF/react-viewerbase/blob/master/src/utils/LanguageProvider.js).
|
||||
|
||||
---
|
||||
|
||||
## Extending and Overriding languages
|
||||
|
||||
[How to Extend languages with @ohif/i18n](https://docs.ohif.org/essentials/translating.html#extending-languages-in-ohifi18n)
|
||||
|
||||
## Changing the language
|
||||
|
||||
The language choosing method is the same implemented in
|
||||
[OHIF Viewers](https://docs.ohif.org/essentials/translating.html#changing-the-language)
|
||||
|
||||
> You can also change the language of the components displayed in this
|
||||
> documentation by choosing an option in the
|
||||
> [Docs Settings](https://react.ohif.org/docs-settings) section.
|
||||
|
||||
## Debugging translations
|
||||
|
||||
[How to Debug @ohif/i18n](https://docs.ohif.org/essentials/translating.html#debugging-translations)
|
||||
@@ -0,0 +1,22 @@
|
||||
import React from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import LanguageSwitcher from '../components/languageSwitcher';
|
||||
|
||||
import './wrapper.styl';
|
||||
|
||||
const Wrapper = ({ children }) => (
|
||||
<React.Fragment>
|
||||
<div className="sidebarLanguageSwitcher">
|
||||
<strong>Display components in:</strong>
|
||||
<LanguageSwitcher />
|
||||
</div>
|
||||
{children}
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
Wrapper.propTypes = {
|
||||
children: PropTypes.node.isRequired,
|
||||
};
|
||||
|
||||
export default Wrapper;
|
||||
@@ -0,0 +1,15 @@
|
||||
[class*="Sidebar__Menus"]
|
||||
@media (min-width: 1120px)
|
||||
margin-top: 80px
|
||||
|
||||
.sidebarLanguageSwitcher
|
||||
position: fixed
|
||||
top: 155px
|
||||
left 0
|
||||
z-index: 1049
|
||||
padding: 0 24px 20px
|
||||
border-bottom: 1px dotted #CED4DE
|
||||
background: #F5F6F7
|
||||
transition: all 200ms ease
|
||||
@media (max-width: 1119px)
|
||||
left -100%
|
||||
Reference in new issue
Block a user