@oliasoft-open-source/react-ui-library 1.0.0
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/.eslintignore +2 -0
- package/.eslintrc.js +125 -0
- package/.gitlab-ci.yml +45 -0
- package/.husky/pre-commit +4 -0
- package/.prettierignore +3 -0
- package/.prettierrc +4 -0
- package/.storybook/main.js +36 -0
- package/.storybook/preview.js +40 -0
- package/.storybook/storybook.less +8 -0
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/babel.config.js +31 -0
- package/index.js +76 -0
- package/jest.config.js +9 -0
- package/package.json +136 -0
- package/src/components/accordion/accordion.jsx +132 -0
- package/src/components/accordion/accordion.module.less +66 -0
- package/src/components/accordion/accordion.stories.jsx +171 -0
- package/src/components/accordion/chevron/chevron.jsx +12 -0
- package/src/components/accordion/chevron/chevron.module.less +12 -0
- package/src/components/accordion/helpers/accordion-with-default-toggle.jsx +106 -0
- package/src/components/accordion/helpers/accordion-with-default-toggle.module.less +24 -0
- package/src/components/actions/actions.jsx +129 -0
- package/src/components/actions/actions.module.less +44 -0
- package/src/components/actions/actions.shape.js +32 -0
- package/src/components/actions/actions.stories.jsx +79 -0
- package/src/components/badge/badge.jsx +58 -0
- package/src/components/badge/badge.module.less +55 -0
- package/src/components/badge/badge.stories.jsx +31 -0
- package/src/components/breadcrumb/breadcrumb.jsx +49 -0
- package/src/components/breadcrumb/breadcrumb.module.less +39 -0
- package/src/components/breadcrumb/breadcrumb.stories.jsx +45 -0
- package/src/components/breadcrumb/link.jsx +31 -0
- package/src/components/button/button.jsx +156 -0
- package/src/components/button/button.module.less +300 -0
- package/src/components/button/button.stories.jsx +74 -0
- package/src/components/button-group/button-group.jsx +140 -0
- package/src/components/button-group/button-group.module.less +24 -0
- package/src/components/button-group/button-group.stories-data.jsx +67 -0
- package/src/components/button-group/button-group.stories.jsx +63 -0
- package/src/components/buttons-and-links.stories.mdx +55 -0
- package/src/components/card/card.jsx +51 -0
- package/src/components/card/card.module.less +48 -0
- package/src/components/card/card.stories.jsx +39 -0
- package/src/components/check-box/check-box.jsx +92 -0
- package/src/components/check-box/check-box.module.less +101 -0
- package/src/components/check-box/check-box.stories.jsx +27 -0
- package/src/components/color/color.stories-data.jsx +71 -0
- package/src/components/color/color.stories.mdx +37 -0
- package/src/components/dialog/dialog.jsx +64 -0
- package/src/components/dialog/dialog.module.less +76 -0
- package/src/components/divider/divider.jsx +40 -0
- package/src/components/divider/divider.module.less +28 -0
- package/src/components/divider/divider.stories.jsx +50 -0
- package/src/components/drawer/drawer-tabs.jsx +43 -0
- package/src/components/drawer/drawer.jsx +150 -0
- package/src/components/drawer/drawer.module.less +167 -0
- package/src/components/drawer/drawer.stories.jsx +156 -0
- package/src/components/empty/empty.jsx +52 -0
- package/src/components/empty/empty.module.less +17 -0
- package/src/components/empty/empty.stories.jsx +26 -0
- package/src/components/file-input/file-input.jsx +101 -0
- package/src/components/file-input/file-input.module.less +3 -0
- package/src/components/file-input/file-input.stories.jsx +109 -0
- package/src/components/form/field.jsx +96 -0
- package/src/components/form/field.stories.jsx +101 -0
- package/src/components/form/form.module.less +30 -0
- package/src/components/form/form.stories.jsx +191 -0
- package/src/components/heading/heading.jsx +105 -0
- package/src/components/heading/heading.module.less +59 -0
- package/src/components/heading/heading.stories.jsx +60 -0
- package/src/components/icon/deprecated-icon.jsx +97 -0
- package/src/components/icon/icon.jsx +71 -0
- package/src/components/icon/icon.module.less +33 -0
- package/src/components/icon/icon.stories.jsx +37 -0
- package/src/components/icon/icons.example.module.less +4 -0
- package/src/components/input/input.jsx +167 -0
- package/src/components/input/input.module.less +94 -0
- package/src/components/input/input.stories.jsx +28 -0
- package/src/components/input-group/input-group-addon/input-group-addon.jsx +36 -0
- package/src/components/input-group/input-group-addon/input-group-addon.module.less +31 -0
- package/src/components/input-group/input-group.jsx +51 -0
- package/src/components/input-group/input-group.module.less +10 -0
- package/src/components/input-group/input-group.stories.jsx +77 -0
- package/src/components/input-validation.stories.mdx +61 -0
- package/src/components/inputs.stories.mdx +201 -0
- package/src/components/label/label.jsx +115 -0
- package/src/components/label/label.module.less +43 -0
- package/src/components/label/label.stories.jsx +60 -0
- package/src/components/layout/column/column.jsx +85 -0
- package/src/components/layout/column/styles.js +45 -0
- package/src/components/layout/column.stories.jsx +60 -0
- package/src/components/layout/examples/afe.stories.jsx +180 -0
- package/src/components/layout/examples/blowout.stories.jsx +68 -0
- package/src/components/layout/examples/casing-loads.stories.jsx +297 -0
- package/src/components/layout/examples/formation.stories.jsx +110 -0
- package/src/components/layout/examples/projects.stories.jsx +108 -0
- package/src/components/layout/examples/reservoirs.stories.jsx +211 -0
- package/src/components/layout/examples/site.stories.jsx +263 -0
- package/src/components/layout/flex/flex.jsx +48 -0
- package/src/components/layout/flex/flex.stories.jsx +54 -0
- package/src/components/layout/form-row/form-row.jsx +15 -0
- package/src/components/layout/form-row/form-row.module.less +11 -0
- package/src/components/layout/grid/grid.jsx +62 -0
- package/src/components/layout/grid/grid.stories.jsx +65 -0
- package/src/components/layout/page/page.jsx +42 -0
- package/src/components/layout/page/page.module.less +27 -0
- package/src/components/layout/page.stories.jsx +93 -0
- package/src/components/layout/placeholder.jsx +2 -0
- package/src/components/layout/print-header/print-header.jsx +22 -0
- package/src/components/layout/print-header/print-header.module.less +9 -0
- package/src/components/layout/row/row.jsx +75 -0
- package/src/components/layout/row/row.module.less +7 -0
- package/src/components/layout/spacer/spacer.jsx +26 -0
- package/src/components/layout/spacer/spacer.stories.jsx +50 -0
- package/src/components/layout-forms.stories.mdx +104 -0
- package/src/components/layout-general.stories.mdx +215 -0
- package/src/components/list/list-row/item-content.jsx +15 -0
- package/src/components/list/list-row/label.jsx +11 -0
- package/src/components/list/list-row/list-heading.jsx +52 -0
- package/src/components/list/list-row/list-row.jsx +128 -0
- package/src/components/list/list-row/list-subheading.jsx +72 -0
- package/src/components/list/list-row/meta-content.jsx +24 -0
- package/src/components/list/list-row/meta-count.jsx +10 -0
- package/src/components/list/list-row/name.jsx +45 -0
- package/src/components/list/list.jsx +276 -0
- package/src/components/list/list.module.less +256 -0
- package/src/components/list/list.stories-data.jsx +287 -0
- package/src/components/list/list.stories.jsx +458 -0
- package/src/components/list/toggle-narrow.jsx +13 -0
- package/src/components/loader/loader.jsx +63 -0
- package/src/components/loader/loader.module.less +63 -0
- package/src/components/loader/loader.stories.jsx +155 -0
- package/src/components/menu/index.js +7 -0
- package/src/components/menu/layer/divider.jsx +4 -0
- package/src/components/menu/layer/heading.jsx +15 -0
- package/src/components/menu/layer/layer.jsx +82 -0
- package/src/components/menu/layer/option.jsx +77 -0
- package/src/components/menu/layer/path.js +44 -0
- package/src/components/menu/layer/placementOptions.js +6 -0
- package/src/components/menu/layer/section.jsx +66 -0
- package/src/components/menu/menu.jsx +359 -0
- package/src/components/menu/menu.module.less +241 -0
- package/src/components/menu/menu.stories-data.jsx +168 -0
- package/src/components/menu/menu.stories.jsx +126 -0
- package/src/components/menu/menu.test.js +58 -0
- package/src/components/menu/trigger/button.jsx +50 -0
- package/src/components/menu/trigger/component.jsx +14 -0
- package/src/components/menu/trigger/text.jsx +25 -0
- package/src/components/menu/trigger/trigger.jsx +86 -0
- package/src/components/message/dismiss.jsx +26 -0
- package/src/components/message/message.jsx +137 -0
- package/src/components/message/message.module.less +114 -0
- package/src/components/message/message.stories.jsx +84 -0
- package/src/components/modal/modal.jsx +50 -0
- package/src/components/modal/modal.module.less +35 -0
- package/src/components/modal/modal.stories.jsx +159 -0
- package/src/components/option-dropdown/heading.jsx +6 -0
- package/src/components/option-dropdown/layer.jsx +81 -0
- package/src/components/option-dropdown/option-dropdown.jsx +53 -0
- package/src/components/option-dropdown/option-dropdown.module.less +50 -0
- package/src/components/option-dropdown/option-dropdown.stories.jsx +35 -0
- package/src/components/option-dropdown/option.jsx +13 -0
- package/src/components/pagination/pagination.jsx +139 -0
- package/src/components/pagination/pagination.module.less +11 -0
- package/src/components/pagination/pagination.stories.jsx +78 -0
- package/src/components/pagination/pagination.test.js +92 -0
- package/src/components/pagination/pagination.viewdata.js +66 -0
- package/src/components/pop-confirm/content.jsx +25 -0
- package/src/components/pop-confirm/pop-confirm.jsx +61 -0
- package/src/components/pop-confirm/pop-confirm.module.less +18 -0
- package/src/components/pop-confirm/pop-confirm.stories.jsx +53 -0
- package/src/components/popover/popover.jsx +112 -0
- package/src/components/popover/popover.module.less +22 -0
- package/src/components/popover/popover.stories.jsx +59 -0
- package/src/components/portal/portal.jsx +16 -0
- package/src/components/portal/portal.stories.jsx +69 -0
- package/src/components/progress-bar/progress-bar.jsx +64 -0
- package/src/components/progress-bar/progress-bar.module.less +64 -0
- package/src/components/progress-bar/progress-bar.stories.jsx +23 -0
- package/src/components/radio-button/radio-button.jsx +139 -0
- package/src/components/radio-button/radio-button.module.less +135 -0
- package/src/components/radio-button/radio-button.stories.jsx +37 -0
- package/src/components/radio-button/radio-input.jsx +52 -0
- package/src/components/select/custom-select/custom-select.jsx +440 -0
- package/src/components/select/custom-select/custom-select.module.less +123 -0
- package/src/components/select/custom-select/custom-select.reducer.js +157 -0
- package/src/components/select/custom-select/layer/heading.jsx +13 -0
- package/src/components/select/custom-select/layer/layer.jsx +73 -0
- package/src/components/select/custom-select/layer/option.jsx +54 -0
- package/src/components/select/custom-select/layer/placementOptions.js +7 -0
- package/src/components/select/custom-select/layer/section.jsx +35 -0
- package/src/components/select/custom-select/trigger/input.jsx +100 -0
- package/src/components/select/custom-select/trigger/trigger.jsx +155 -0
- package/src/components/select/custom-select/trigger/trigger.module.less +289 -0
- package/src/components/select/native-select/native-select.jsx +198 -0
- package/src/components/select/native-select/native-select.module.less +107 -0
- package/src/components/select/select.input.js +146 -0
- package/src/components/select/select.jsx +207 -0
- package/src/components/select/select.stories-data.jsx +92 -0
- package/src/components/select/select.stories.jsx +135 -0
- package/src/components/select/select.test.js +519 -0
- package/src/components/side-bar/container.module.less +29 -0
- package/src/components/side-bar/link.jsx +83 -0
- package/src/components/side-bar/sections.jsx +23 -0
- package/src/components/side-bar/side-bar.jsx +102 -0
- package/src/components/side-bar/side-bar.module.less +137 -0
- package/src/components/side-bar/side-bar.stories.jsx +101 -0
- package/src/components/slider/rc-slider.less +47 -0
- package/src/components/slider/slider-tooltip.jsx +20 -0
- package/src/components/slider/slider.jsx +233 -0
- package/src/components/slider/slider.module.less +40 -0
- package/src/components/slider/slider.stories.jsx +110 -0
- package/src/components/spinner/spinner.jsx +37 -0
- package/src/components/spinner/spinner.module.less +115 -0
- package/src/components/spinner/spinner.stories.jsx +24 -0
- package/src/components/table/cell/cell.jsx +614 -0
- package/src/components/table/cell/cell.module.less +152 -0
- package/src/components/table/footer/footer.jsx +66 -0
- package/src/components/table/footer/footer.module.less +14 -0
- package/src/components/table/helper.js +64 -0
- package/src/components/table/helper.test.js +166 -0
- package/src/components/table/icon/icon.module.less +31 -0
- package/src/components/table/row/expanded-content-row.jsx +16 -0
- package/src/components/table/row/row.jsx +253 -0
- package/src/components/table/row/row.module.less +62 -0
- package/src/components/table/table-scroll-wrapper.jsx +48 -0
- package/src/components/table/table.jsx +232 -0
- package/src/components/table/table.module.less +145 -0
- package/src/components/table/table.stories-data.jsx +752 -0
- package/src/components/table/table.stories.jsx +814 -0
- package/src/components/table/table.test.js +30 -0
- package/src/components/table/table.variables.less +19 -0
- package/src/components/table/table.viewdata.js +26 -0
- package/src/components/table/title/title.jsx +30 -0
- package/src/components/table/title/title.module.less +9 -0
- package/src/components/tabs/content.jsx +14 -0
- package/src/components/tabs/label.jsx +50 -0
- package/src/components/tabs/tabs.jsx +191 -0
- package/src/components/tabs/tabs.module.less +73 -0
- package/src/components/tabs/tabs.stories.jsx +110 -0
- package/src/components/text/text.jsx +64 -0
- package/src/components/text/text.module.less +45 -0
- package/src/components/text/text.stories.jsx +31 -0
- package/src/components/text-link/text-link.jsx +23 -0
- package/src/components/text-link/text-link.stories.jsx +20 -0
- package/src/components/textarea/textarea.jsx +126 -0
- package/src/components/textarea/textarea.module.less +55 -0
- package/src/components/textarea/textarea.stories.jsx +26 -0
- package/src/components/toaster/toaster.jsx +39 -0
- package/src/components/toaster/toaster.less +17 -0
- package/src/components/toaster/toaster.stories.jsx +116 -0
- package/src/components/toggle/toggle.jsx +65 -0
- package/src/components/toggle/toggle.module.less +139 -0
- package/src/components/toggle/toggle.stories.jsx +26 -0
- package/src/components/tooltip/tooltip-layer.jsx +72 -0
- package/src/components/tooltip/tooltip.jsx +108 -0
- package/src/components/tooltip/tooltip.module.less +28 -0
- package/src/components/tooltip/tooltip.stories.jsx +71 -0
- package/src/components/top-bar/element/element.jsx +72 -0
- package/src/components/top-bar/element/link.jsx +29 -0
- package/src/components/top-bar/title.jsx +24 -0
- package/src/components/top-bar/top-bar.jsx +79 -0
- package/src/components/top-bar/top-bar.module.less +191 -0
- package/src/components/top-bar/top-bar.stories.jsx +137 -0
- package/src/components/top-bar/warning.jsx +6 -0
- package/src/components/tree/tree-item.jsx +79 -0
- package/src/components/tree/tree-placeholder.jsx +6 -0
- package/src/components/tree/tree.jsx +129 -0
- package/src/components/tree/tree.module.less +33 -0
- package/src/components/tree/tree.stories-data.jsx +89 -0
- package/src/components/tree/tree.stories.jsx +106 -0
- package/src/docs/components/page/page.jsx +16 -0
- package/src/docs/config/config.js +1 -0
- package/src/docs/html/favicon.png +0 -0
- package/src/docs/html/index.html +11 -0
- package/src/docs/navigation/footer/footer.jsx +48 -0
- package/src/docs/navigation/header/header.jsx +39 -0
- package/src/docs/navigation/header/header.module.less +32 -0
- package/src/docs/navigation/routes/routes.jsx +16 -0
- package/src/docs/start.jsx +12 -0
- package/src/docs/views/main/main.jsx +209 -0
- package/src/docs/views/main/main.module.less +14 -0
- package/src/docs/views/not-found/not-found.jsx +5 -0
- package/src/helpers/disabled-context.js +8 -0
- package/src/helpers/styles.js +68 -0
- package/src/helpers/text.js +6 -0
- package/src/helpers/types.js +5 -0
- package/src/hooks/index.js +3 -0
- package/src/hooks/use-focus.js +11 -0
- package/src/hooks/use-keyboard-event.js +16 -0
- package/src/hooks/use-window-width.js +20 -0
- package/src/images/icons/icon-drop.png +0 -0
- package/src/images/icons/icon-share.png +0 -0
- package/src/images/icons/icons8-junction.svg +4 -0
- package/src/images/logo.png +0 -0
- package/src/images/logo.svg +13 -0
- package/src/images/oliasoft-logo.svg +1 -0
- package/src/style/colors.less +26 -0
- package/src/style/external.less +10 -0
- package/src/style/fonts/lato/Lato-Bold.woff2 +0 -0
- package/src/style/fonts/lato/Lato-BoldItalic.woff2 +0 -0
- package/src/style/fonts/lato/Lato-Italic.woff2 +0 -0
- package/src/style/fonts/lato/Lato-Regular.woff2 +0 -0
- package/src/style/fonts.less +27 -0
- package/src/style/global.less +51 -0
- package/src/style/mixins.less +67 -0
- package/src/style/reset/reset.less +34 -0
- package/src/style/shared.less +25 -0
- package/src/style/theme.dark.less +37 -0
- package/src/style/theme.default.less +74 -0
- package/src/style/variables.less +49 -0
- package/webpack/webpack.common.js +39 -0
- package/webpack/webpack.common.rules.js +102 -0
- package/webpack/webpack.dev.js +22 -0
- package/webpack/webpack.prod.js +23 -0
- package/webpack/webpack.resolve.js +22 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Canvas, Meta, Story } from '@storybook/addon-docs';
|
|
2
|
+
import { FormRow, Button, TextLink } from '../..';
|
|
3
|
+
|
|
4
|
+
<Meta title="Buttons & Links" />
|
|
5
|
+
|
|
6
|
+
# Buttons & Links
|
|
7
|
+
|
|
8
|
+
## A single primary button
|
|
9
|
+
|
|
10
|
+
Primary (`colored`) buttons help highlight the most important action, but not if there are too many of them. Try not to use more than one per view or section.
|
|
11
|
+
|
|
12
|
+
<Canvas>
|
|
13
|
+
<FormRow>
|
|
14
|
+
<Button colored label="Save" />
|
|
15
|
+
<Button label="Cancel" />
|
|
16
|
+
</FormRow>
|
|
17
|
+
</Canvas>
|
|
18
|
+
|
|
19
|
+
## Error & success buttons
|
|
20
|
+
|
|
21
|
+
Like primary buttons, these should be used sparingly for particularly risky actions (`colored="red"`) or particularly rewarding ones (`colored="green"`).
|
|
22
|
+
|
|
23
|
+
<Canvas>
|
|
24
|
+
<FormRow>
|
|
25
|
+
<Button colored="red" label="Delete everything" />
|
|
26
|
+
<Button colored="green" label="Prevent disaster" />
|
|
27
|
+
</FormRow>
|
|
28
|
+
</Canvas>
|
|
29
|
+
|
|
30
|
+
## Basic buttons
|
|
31
|
+
|
|
32
|
+
Same height as other buttons, but without a background. Use when a default button is too heavy, but you want to line up with other buttons or form elements.
|
|
33
|
+
|
|
34
|
+
If you need a very unobtrusive button, combine `basic` with `colored="muted"`.
|
|
35
|
+
|
|
36
|
+
<Canvas>
|
|
37
|
+
<FormRow>
|
|
38
|
+
<Button colored label="Login" />
|
|
39
|
+
<Button label="Register" />
|
|
40
|
+
<Button basic label="Forgot password" />
|
|
41
|
+
<Button basic colored="muted" label="Help" />
|
|
42
|
+
</FormRow>
|
|
43
|
+
</Canvas>
|
|
44
|
+
|
|
45
|
+
## Links (`TextLink`)
|
|
46
|
+
|
|
47
|
+
Inline links without extra padding. Use when space is limited and/or extra padding would cause problems (e.g. for a link in a `Table` or an inline link).
|
|
48
|
+
|
|
49
|
+
<Canvas>
|
|
50
|
+
<>
|
|
51
|
+
Want to know more before trying Oliasoft WellDesign? – our{' '}
|
|
52
|
+
<TextLink onClick={() => {}}>Customer Success team</TextLink> is here to
|
|
53
|
+
answer your questions
|
|
54
|
+
</>
|
|
55
|
+
</Canvas>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import styles from './card.module.less';
|
|
5
|
+
|
|
6
|
+
export const Card = ({
|
|
7
|
+
bordered,
|
|
8
|
+
heading,
|
|
9
|
+
children,
|
|
10
|
+
margin,
|
|
11
|
+
padding,
|
|
12
|
+
raised,
|
|
13
|
+
}) => {
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
className={cx(
|
|
17
|
+
styles.card,
|
|
18
|
+
bordered ? styles.bordered : '',
|
|
19
|
+
raised ? styles.raised : '',
|
|
20
|
+
)}
|
|
21
|
+
style={{ margin }}
|
|
22
|
+
>
|
|
23
|
+
{heading ? <div className={cx(styles.cardHeader)}>{heading}</div> : null}
|
|
24
|
+
<div
|
|
25
|
+
className={cx(
|
|
26
|
+
styles.cardContent,
|
|
27
|
+
heading ? styles.cardContentBorderTop : '',
|
|
28
|
+
padding ? styles.padding : '',
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
Card.defaultProps = {
|
|
38
|
+
bordered: true,
|
|
39
|
+
heading: null,
|
|
40
|
+
margin: '0',
|
|
41
|
+
padding: true,
|
|
42
|
+
raised: false,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
Card.propTypes = {
|
|
46
|
+
bordered: PropTypes.bool,
|
|
47
|
+
heading: PropTypes.node,
|
|
48
|
+
margin: PropTypes.string,
|
|
49
|
+
padding: PropTypes.bool,
|
|
50
|
+
raised: PropTypes.bool,
|
|
51
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@import '../../style/variables.less';
|
|
2
|
+
|
|
3
|
+
.card {
|
|
4
|
+
color: var(--color-text);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.card.bordered {
|
|
8
|
+
background: var(--color-background-raised);
|
|
9
|
+
border: 1px solid var(--color-border);
|
|
10
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
11
|
+
border-radius: @card_border_radius;
|
|
12
|
+
|
|
13
|
+
&.raised {
|
|
14
|
+
box-shadow: 0 0px 4px rgba(0, 0, 0, 0.1), 0 3px 4px rgba(0, 0, 0, 0.1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.cardHeader {
|
|
18
|
+
background-color: var(--color-background);
|
|
19
|
+
padding: @card_padding_y @card_padding_x;
|
|
20
|
+
border-top-left-radius: inherit;
|
|
21
|
+
border-top-right-radius: inherit;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.cardContentBorderTop {
|
|
25
|
+
border-top: 1px solid var(--color-border);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.padding {
|
|
29
|
+
padding: @card_padding_y @card_padding_x;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.cardContent {
|
|
34
|
+
&:first-child {
|
|
35
|
+
border-top-left-radius: inherit;
|
|
36
|
+
border-top-right-radius: inherit;
|
|
37
|
+
}
|
|
38
|
+
&:last-child {
|
|
39
|
+
border-bottom-left-radius: inherit;
|
|
40
|
+
border-bottom-right-radius: inherit;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.cardHeader {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
padding: @card_padding_y 0;
|
|
48
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Card, Heading } from '../../..';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Layout/Card',
|
|
6
|
+
component: Card,
|
|
7
|
+
|
|
8
|
+
args: {
|
|
9
|
+
raised: false,
|
|
10
|
+
children: 'Content goes here',
|
|
11
|
+
padding: true,
|
|
12
|
+
bordered: true,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Template = (args) => (
|
|
17
|
+
<Card
|
|
18
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
19
|
+
{...args}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const Default = Template.bind({});
|
|
24
|
+
|
|
25
|
+
export const WithHeading = Template.bind({});
|
|
26
|
+
WithHeading.args = {
|
|
27
|
+
heading: <Heading>Heading</Heading>,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const WithHelpHeading = Template.bind({});
|
|
31
|
+
WithHelpHeading.args = {
|
|
32
|
+
heading: <Heading onClickHelp={() => console.log('help!')}>Heading</Heading>,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const NoPadding = Template.bind({});
|
|
36
|
+
NoPadding.args = { padding: false };
|
|
37
|
+
|
|
38
|
+
export const NoBorder = Template.bind({});
|
|
39
|
+
NoBorder.args = { bordered: false };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import { FaCheck } from 'react-icons/fa';
|
|
5
|
+
import styles from './check-box.module.less';
|
|
6
|
+
import { DisabledContext } from '../../helpers/disabled-context';
|
|
7
|
+
|
|
8
|
+
export const CheckBox = ({
|
|
9
|
+
noMargin,
|
|
10
|
+
dataix,
|
|
11
|
+
isInTable,
|
|
12
|
+
tabIndex,
|
|
13
|
+
checked,
|
|
14
|
+
name,
|
|
15
|
+
key,
|
|
16
|
+
label,
|
|
17
|
+
disabled,
|
|
18
|
+
small,
|
|
19
|
+
onChange,
|
|
20
|
+
testId,
|
|
21
|
+
value,
|
|
22
|
+
}) => {
|
|
23
|
+
const disabledContext = useContext(DisabledContext);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
className={cx(
|
|
28
|
+
styles.checkbox,
|
|
29
|
+
noMargin ? styles.noMargin : null,
|
|
30
|
+
isInTable ? styles.isInTable : null,
|
|
31
|
+
disabled || disabledContext ? styles.disabled : null,
|
|
32
|
+
small ? styles.small : null,
|
|
33
|
+
!label ? styles.noLabel : null,
|
|
34
|
+
)}
|
|
35
|
+
data-ix={dataix}
|
|
36
|
+
onClick={(evt) => {
|
|
37
|
+
evt.target.name = name;
|
|
38
|
+
evt.target.value = !checked;
|
|
39
|
+
evt.target.customValue = value;
|
|
40
|
+
evt.target.checked = !checked;
|
|
41
|
+
onChange(evt);
|
|
42
|
+
}}
|
|
43
|
+
data-testid={testId}
|
|
44
|
+
>
|
|
45
|
+
<input
|
|
46
|
+
type="checkbox"
|
|
47
|
+
tabIndex={tabIndex}
|
|
48
|
+
checked={checked}
|
|
49
|
+
name={name}
|
|
50
|
+
key={key}
|
|
51
|
+
onChange={() => {}}
|
|
52
|
+
disabled={disabled || disabledContext}
|
|
53
|
+
/>
|
|
54
|
+
<label htmlFor={name}>
|
|
55
|
+
<FaCheck className={styles.checkmark} />
|
|
56
|
+
{label}
|
|
57
|
+
</label>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
CheckBox.defaultProps = {
|
|
63
|
+
checked: false,
|
|
64
|
+
isInTable: false,
|
|
65
|
+
label: '',
|
|
66
|
+
name: undefined,
|
|
67
|
+
noMargin: false,
|
|
68
|
+
onChange: () => {},
|
|
69
|
+
tabIndex: 0,
|
|
70
|
+
disabled: false,
|
|
71
|
+
small: false,
|
|
72
|
+
testId: undefined,
|
|
73
|
+
key: '',
|
|
74
|
+
dataix: 0,
|
|
75
|
+
value: undefined,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
CheckBox.propTypes = {
|
|
79
|
+
checked: PropTypes.bool,
|
|
80
|
+
isInTable: PropTypes.bool,
|
|
81
|
+
label: PropTypes.string,
|
|
82
|
+
name: PropTypes.string,
|
|
83
|
+
noMargin: PropTypes.bool,
|
|
84
|
+
onChange: PropTypes.func,
|
|
85
|
+
tabIndex: PropTypes.number,
|
|
86
|
+
disabled: PropTypes.bool,
|
|
87
|
+
small: PropTypes.bool,
|
|
88
|
+
testId: PropTypes.string,
|
|
89
|
+
key: PropTypes.string, //deprecated
|
|
90
|
+
dataix: PropTypes.number, //deprecated (used in GenericTable)
|
|
91
|
+
value: PropTypes.string,
|
|
92
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
@import '../../style/variables.less';
|
|
2
|
+
|
|
3
|
+
.checkbox {
|
|
4
|
+
margin: 10px 0 11px 0;
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
backface-visibility: hidden;
|
|
8
|
+
vertical-align: baseline;
|
|
9
|
+
font-style: normal;
|
|
10
|
+
min-height: 17px;
|
|
11
|
+
font-size: inherit;
|
|
12
|
+
line-height: 17px;
|
|
13
|
+
min-width: 17px;
|
|
14
|
+
outline: 0px;
|
|
15
|
+
|
|
16
|
+
&.noLabel {
|
|
17
|
+
width: 17px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.small {
|
|
21
|
+
margin: 3px 0;
|
|
22
|
+
font-size: @input_font_size_small;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
input {
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 0px;
|
|
29
|
+
left: 0px;
|
|
30
|
+
width: 17px;
|
|
31
|
+
height: 17px;
|
|
32
|
+
opacity: 0 !important;
|
|
33
|
+
outline: 0px;
|
|
34
|
+
z-index: -1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
label {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
user-select: none;
|
|
40
|
+
color: var(--color-text);
|
|
41
|
+
transition: color 0.1s ease 0s;
|
|
42
|
+
position: relative;
|
|
43
|
+
display: block;
|
|
44
|
+
padding-left: 1.85714em;
|
|
45
|
+
font-size: 1em;
|
|
46
|
+
outline: 0px;
|
|
47
|
+
|
|
48
|
+
.checkmark {
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 0px;
|
|
51
|
+
left: 0px;
|
|
52
|
+
width: 17px;
|
|
53
|
+
height: 17px;
|
|
54
|
+
padding: 2px;
|
|
55
|
+
background: var(--color-background-input);
|
|
56
|
+
border-radius: 0.214286rem;
|
|
57
|
+
transition: border 0.1s ease 0s, opacity 0.1s ease 0s,
|
|
58
|
+
transform 0.1s ease 0s, box-shadow 0.1s ease 0s;
|
|
59
|
+
border: 1px solid var(--color-border);
|
|
60
|
+
color: transparent;
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
border-color: var(--color-border-hover);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
input:checked ~ label .checkmark {
|
|
69
|
+
background: var(--color-background-primary);
|
|
70
|
+
border-color: transparent;
|
|
71
|
+
color: white;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.disabled {
|
|
75
|
+
cursor: default;
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
|
|
78
|
+
label {
|
|
79
|
+
color: var(--color-text-muted);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.checkmark {
|
|
83
|
+
background: var(--color-background-disabled) !important;
|
|
84
|
+
border-color: var(--color-border) !important;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
input:checked ~ label .checkmark {
|
|
88
|
+
color: var(--color-text-faint);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.noMargin {
|
|
94
|
+
margin: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.isInTable {
|
|
98
|
+
margin: 0;
|
|
99
|
+
position: relative;
|
|
100
|
+
top: 1px;
|
|
101
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useArgs } from '@storybook/addons';
|
|
3
|
+
import { CheckBox } from './check-box';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Forms/CheckBox',
|
|
7
|
+
component: CheckBox,
|
|
8
|
+
args: {
|
|
9
|
+
disabled: false,
|
|
10
|
+
label: 'Label',
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = (args) => {
|
|
15
|
+
const [{ checked }, updateArgs] = useArgs();
|
|
16
|
+
const handleChange = () => {
|
|
17
|
+
updateArgs({ checked: !checked });
|
|
18
|
+
};
|
|
19
|
+
return (
|
|
20
|
+
<CheckBox
|
|
21
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
22
|
+
{...args}
|
|
23
|
+
onChange={handleChange}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { toast } from '../../..';
|
|
3
|
+
|
|
4
|
+
export const colorsText = [
|
|
5
|
+
'--color-text',
|
|
6
|
+
'--color-text-muted',
|
|
7
|
+
'--color-text-faint',
|
|
8
|
+
'--color-text-error',
|
|
9
|
+
'--color-text-warning',
|
|
10
|
+
'--color-text-success',
|
|
11
|
+
'--color-text-info',
|
|
12
|
+
'--color-text-primary',
|
|
13
|
+
'--color-text-primary-hover',
|
|
14
|
+
'--color-text-primary-active',
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export const colorsBackground = [
|
|
18
|
+
'--color-background',
|
|
19
|
+
'--color-background-raised',
|
|
20
|
+
'--color-background-primary',
|
|
21
|
+
'--color-background-info',
|
|
22
|
+
'--color-background-warning',
|
|
23
|
+
'--color-background-success',
|
|
24
|
+
'--color-background-error',
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export const colorsBorder = [
|
|
28
|
+
'--color-border',
|
|
29
|
+
'--color-border-error',
|
|
30
|
+
'--color-border-warning',
|
|
31
|
+
'--color-border-focus',
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export const ColorPalette = ({ colors }) => {
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
style={{
|
|
38
|
+
display: 'grid',
|
|
39
|
+
gridTemplateColumns: 'auto 1fr auto 1fr',
|
|
40
|
+
gap: 20,
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
{colors.map((color, index) => {
|
|
45
|
+
const variable = `var(${color})`;
|
|
46
|
+
const handleClick = () => {
|
|
47
|
+
navigator.clipboard.writeText(variable);
|
|
48
|
+
toast({
|
|
49
|
+
message: {
|
|
50
|
+
type: 'Success',
|
|
51
|
+
content: 'Copied to clipboard',
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
return (
|
|
56
|
+
<Fragment key={index}>
|
|
57
|
+
<div
|
|
58
|
+
style={{
|
|
59
|
+
padding: '16px 20px',
|
|
60
|
+
backgroundColor: variable,
|
|
61
|
+
border: '1px solid rgba(0,0,0,0.1)',
|
|
62
|
+
}}
|
|
63
|
+
onClick={handleClick}
|
|
64
|
+
></div>
|
|
65
|
+
<code onClick={handleClick}>{variable}</code>
|
|
66
|
+
</Fragment>
|
|
67
|
+
);
|
|
68
|
+
})}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Canvas, Meta, Story } from '@storybook/addon-docs';
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { toast, Toaster } from '../../..';
|
|
4
|
+
import {
|
|
5
|
+
ColorPalette,
|
|
6
|
+
colorsText,
|
|
7
|
+
colorsBackground,
|
|
8
|
+
colorsBorder,
|
|
9
|
+
} from './color.stories-data';
|
|
10
|
+
|
|
11
|
+
<Meta title="Colors" />
|
|
12
|
+
|
|
13
|
+
# Colors
|
|
14
|
+
|
|
15
|
+
When setting colors (either by component props or in custom styling), prefer CSS variables to literal color values.
|
|
16
|
+
|
|
17
|
+
**Click on a color below to copy the variable name to the clipboard.**
|
|
18
|
+
|
|
19
|
+
## Text
|
|
20
|
+
|
|
21
|
+
<Canvas>
|
|
22
|
+
<ColorPalette colors={colorsText} />
|
|
23
|
+
</Canvas>
|
|
24
|
+
|
|
25
|
+
## Backgrounds
|
|
26
|
+
|
|
27
|
+
<Canvas>
|
|
28
|
+
<ColorPalette colors={colorsBackground} />
|
|
29
|
+
</Canvas>
|
|
30
|
+
|
|
31
|
+
## Borders
|
|
32
|
+
|
|
33
|
+
<Canvas>
|
|
34
|
+
<ColorPalette colors={colorsBorder} />
|
|
35
|
+
</Canvas>
|
|
36
|
+
|
|
37
|
+
<Toaster />
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { FaTimes } from 'react-icons/fa';
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { Heading } from '../heading/heading';
|
|
6
|
+
import styles from './dialog.module.less';
|
|
7
|
+
|
|
8
|
+
export const Dialog = ({ dialog }) => {
|
|
9
|
+
const {
|
|
10
|
+
heading,
|
|
11
|
+
content,
|
|
12
|
+
contentPadding = 20,
|
|
13
|
+
footer,
|
|
14
|
+
scroll,
|
|
15
|
+
width,
|
|
16
|
+
height,
|
|
17
|
+
onClose,
|
|
18
|
+
} = dialog;
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
className={cx(
|
|
22
|
+
styles.dialog,
|
|
23
|
+
width ? styles.inline : null,
|
|
24
|
+
scroll ? styles.scroll : null,
|
|
25
|
+
)}
|
|
26
|
+
style={{ width, height }}
|
|
27
|
+
>
|
|
28
|
+
<div className={styles.header}>
|
|
29
|
+
<Heading top marginBottom={0}>
|
|
30
|
+
{heading}
|
|
31
|
+
</Heading>
|
|
32
|
+
{onClose ? (
|
|
33
|
+
<div className={styles.dismiss}>
|
|
34
|
+
<FaTimes onClick={onClose} />
|
|
35
|
+
</div>
|
|
36
|
+
) : null}
|
|
37
|
+
</div>
|
|
38
|
+
<div className={styles.content} style={{ padding: contentPadding }}>
|
|
39
|
+
{content}
|
|
40
|
+
</div>
|
|
41
|
+
{footer && <div className={styles.footer}>{footer}</div>}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const dialogShape = PropTypes.shape({
|
|
47
|
+
heading: PropTypes.string,
|
|
48
|
+
content: PropTypes.oneOfType([
|
|
49
|
+
PropTypes.string,
|
|
50
|
+
PropTypes.number,
|
|
51
|
+
PropTypes.node,
|
|
52
|
+
]).isRequired,
|
|
53
|
+
contentPadding: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
54
|
+
footer: PropTypes.node,
|
|
55
|
+
width: PropTypes.string,
|
|
56
|
+
height: PropTypes.string,
|
|
57
|
+
bordered: PropTypes.bool,
|
|
58
|
+
onClose: PropTypes.func,
|
|
59
|
+
scroll: PropTypes.bool,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
Dialog.propTypes = {
|
|
63
|
+
dialog: dialogShape.isRequired,
|
|
64
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@line_height: 20px;
|
|
2
|
+
@line_spacing: 3px;
|
|
3
|
+
|
|
4
|
+
.dialog {
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
background: var(--color-background-raised);
|
|
7
|
+
line-height: @line_height;
|
|
8
|
+
color: var(--color-text);
|
|
9
|
+
border: 1px solid var(--color-border);
|
|
10
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
|
|
14
|
+
> :first-child {
|
|
15
|
+
border-top-left-radius: inherit;
|
|
16
|
+
border-top-right-radius: inherit;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
> :last-child {
|
|
20
|
+
border-bottom-left-radius: inherit;
|
|
21
|
+
border-bottom-right-radius: inherit;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.inline {
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.scroll {
|
|
29
|
+
max-height: 100%;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.header {
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
padding: 16px 20px;
|
|
37
|
+
background-color: var(--color-background);
|
|
38
|
+
border-bottom: 1px solid var(--color-border);
|
|
39
|
+
flex-shrink: 0;
|
|
40
|
+
|
|
41
|
+
.dismiss {
|
|
42
|
+
display: flex;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
align-items: center;
|
|
45
|
+
margin-left: 20px;
|
|
46
|
+
opacity: 0.4;
|
|
47
|
+
|
|
48
|
+
&:hover {
|
|
49
|
+
opacity: 0.8;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.content {
|
|
56
|
+
flex-grow: 1;
|
|
57
|
+
|
|
58
|
+
.scroll & {
|
|
59
|
+
overflow: auto;
|
|
60
|
+
min-height: 0;
|
|
61
|
+
height: 100%;
|
|
62
|
+
flex: 1 1 auto;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.footer {
|
|
67
|
+
display: flex;
|
|
68
|
+
padding: 16px 20px;
|
|
69
|
+
background-color: var(--color-background);
|
|
70
|
+
border-top: 1px solid var(--color-border);
|
|
71
|
+
flex-shrink: 0;
|
|
72
|
+
|
|
73
|
+
button:not(:last-child) {
|
|
74
|
+
margin-right: 12px;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styles from './divider.module.less';
|
|
4
|
+
import { Text } from '../text/text';
|
|
5
|
+
|
|
6
|
+
const cssAlignClass = (align) => {
|
|
7
|
+
switch (align) {
|
|
8
|
+
case 'left':
|
|
9
|
+
return styles.alignLeft;
|
|
10
|
+
case 'right':
|
|
11
|
+
return styles.alignRight;
|
|
12
|
+
default:
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Divider = ({ children, margin, color, align }) => (
|
|
18
|
+
<div
|
|
19
|
+
className={`${styles.divider} ${cssAlignClass(align)}`}
|
|
20
|
+
style={{
|
|
21
|
+
marginTop: margin,
|
|
22
|
+
marginBottom: margin,
|
|
23
|
+
'--color': color,
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
{typeof children === 'string' ? <Text muted>{children}</Text> : children}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
Divider.defaultProps = {
|
|
31
|
+
margin: 20,
|
|
32
|
+
color: 'var(--color-border)',
|
|
33
|
+
align: 'center',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
Divider.propTypes = {
|
|
37
|
+
margin: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
38
|
+
color: PropTypes.string,
|
|
39
|
+
align: PropTypes.string,
|
|
40
|
+
};
|