@react5/ui 1.0.27 → 1.0.28
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/LICENSE +21 -21
- package/README.md +2 -2
- package/package.json +38 -38
- package/packages/app/README.md +50 -50
- package/packages/app/eslint.config.js +28 -28
- package/packages/app/index.html +13 -13
- package/packages/app/jest.config.js +12 -12
- package/packages/app/package.json +36 -36
- package/packages/app/src/App.css +5 -5
- package/packages/app/src/App.tsx +35 -35
- package/packages/app/src/i18n/config.ts +21 -21
- package/packages/app/src/i18n/en/translation.json +4 -4
- package/packages/app/src/i18n/fr/translation.json +4 -4
- package/packages/app/src/i18n/index.ts +3 -3
- package/packages/app/src/main.tsx +16 -16
- package/packages/app/src/styles/1-reset.scss +72 -72
- package/packages/app/src/styles/2-colors.scss +11 -11
- package/packages/app/src/vite-env.d.ts +1 -1
- package/packages/app/tsconfig.app.json +26 -26
- package/packages/app/tsconfig.json +7 -7
- package/packages/app/tsconfig.node.json +24 -24
- package/packages/app/vite.config.ts +7 -7
- package/packages/lib/.babelrc +9 -9
- package/packages/lib/.storybook/main.js +50 -50
- package/packages/lib/.storybook/preview.js +13 -13
- package/packages/lib/declaration.d.ts +9 -9
- package/packages/lib/dist/esm/index.esm.js +1 -1
- package/packages/lib/dist/esm/index.esm.js.map +1 -1
- package/packages/lib/dist/esm/index.esm.scss +1401 -1401
- package/packages/lib/dist/index.js +1 -1
- package/packages/lib/dist/index.js.map +1 -1
- package/packages/lib/dist/index.scss +1401 -1401
- package/packages/lib/jest.config.js +19 -19
- package/packages/lib/package.json +100 -102
- package/packages/lib/plop/component/index.js +43 -43
- package/packages/lib/plop/index.js +3 -3
- package/packages/lib/plop/templates/component/component.hbs +19 -19
- package/packages/lib/plop/templates/component/index.hbs +1 -1
- package/packages/lib/plop/templates/component/stories.hbs +17 -17
- package/packages/lib/plop/templates/component/style.hbs +1 -1
- package/packages/lib/plop/templates/component/test.hbs +11 -11
- package/packages/lib/plopfile.js +1 -1
- package/packages/lib/rollup.config.mjs +64 -64
- package/packages/lib/src/components/Accordion/Accordion.scss +67 -67
- package/packages/lib/src/components/Accordion/Accordion.tsx +36 -36
- package/packages/lib/src/components/Button/Button.scss +60 -60
- package/packages/lib/src/components/Button/Button.stories.tsx +26 -26
- package/packages/lib/src/components/Button/Button.tsx +40 -40
- package/packages/lib/src/components/Button/index.tsx +1 -1
- package/packages/lib/src/components/ButtonsGroup/ButtonsGroup.scss +3 -3
- package/packages/lib/src/components/ButtonsGroup/ButtonsGroup.stories.tsx +17 -17
- package/packages/lib/src/components/ButtonsGroup/ButtonsGroup.test.tsx +11 -11
- package/packages/lib/src/components/ButtonsGroup/ButtonsGroup.tsx +17 -17
- package/packages/lib/src/components/ButtonsGroup/index.tsx +1 -1
- package/packages/lib/src/components/CheckBox/CheckBox.scss +63 -63
- package/packages/lib/src/components/CheckBox/CheckBox.stories.tsx +22 -22
- package/packages/lib/src/components/CheckBox/CheckBox.tsx +42 -42
- package/packages/lib/src/components/CheckBox/index.tsx +1 -1
- package/packages/lib/src/components/DialogPrompt/DialogPrompt.scss +6 -6
- package/packages/lib/src/components/DialogPrompt/DialogPrompt.stories.tsx +17 -17
- package/packages/lib/src/components/DialogPrompt/DialogPrompt.test.tsx +11 -11
- package/packages/lib/src/components/DialogPrompt/DialogPrompt.tsx +41 -41
- package/packages/lib/src/components/DialogPrompt/index.tsx +1 -1
- package/packages/lib/src/components/Divider/Divider.scss +22 -22
- package/packages/lib/src/components/Divider/Divider.tsx +20 -20
- package/packages/lib/src/components/DropDown/DropDown.scss +70 -70
- package/packages/lib/src/components/DropDown/DropDown.stories.tsx +45 -45
- package/packages/lib/src/components/DropDown/DropDown.tsx +61 -61
- package/packages/lib/src/components/DropDown/index.tsx +1 -1
- package/packages/lib/src/components/Form/Form.scss +3 -3
- package/packages/lib/src/components/Form/Form.stories.tsx +20 -20
- package/packages/lib/src/components/Form/Form.tsx +25 -25
- package/packages/lib/src/components/FormButtons/FormButtons.scss +5 -5
- package/packages/lib/src/components/FormButtons/FormButtons.tsx +18 -18
- package/packages/lib/src/components/HeaderButtons/HeaderButtons.scss +6 -6
- package/packages/lib/src/components/HeaderButtons/HeaderButtons.stories.tsx +17 -17
- package/packages/lib/src/components/HeaderButtons/HeaderButtons.test.tsx +11 -11
- package/packages/lib/src/components/HeaderButtons/HeaderButtons.tsx +28 -28
- package/packages/lib/src/components/HeaderButtons/index.tsx +1 -1
- package/packages/lib/src/components/IconButton/IconButton.scss +64 -64
- package/packages/lib/src/components/IconButton/IconButton.tsx +44 -44
- package/packages/lib/src/components/MenuItem/MenuItem.scss +13 -13
- package/packages/lib/src/components/MenuItem/MenuItem.tsx +36 -36
- package/packages/lib/src/components/Modal/Modal.scss +71 -71
- package/packages/lib/src/components/Modal/Modal.tsx +60 -60
- package/packages/lib/src/components/Navbar/Navbar.scss +52 -52
- package/packages/lib/src/components/Navbar/Navbar.stories.tsx +25 -25
- package/packages/lib/src/components/Navbar/Navbar.tsx +38 -38
- package/packages/lib/src/components/NavbarLink/NavbarLink.scss +15 -15
- package/packages/lib/src/components/NavbarLink/NavbarLink.tsx +34 -34
- package/packages/lib/src/components/NavbarMenu/NavbarMenu.scss +156 -156
- package/packages/lib/src/components/NavbarMenu/NavbarMenu.stories.tsx +24 -24
- package/packages/lib/src/components/NavbarMenu/NavbarMenu.tsx +72 -72
- package/packages/lib/src/components/Panel/Panel.scss +29 -29
- package/packages/lib/src/components/Panel/Panel.stories.tsx +32 -32
- package/packages/lib/src/components/Panel/Panel.test.tsx +11 -11
- package/packages/lib/src/components/Panel/Panel.tsx +29 -29
- package/packages/lib/src/components/Panel/index.tsx +1 -1
- package/packages/lib/src/components/Paper/Paper.scss +5 -5
- package/packages/lib/src/components/Paper/Paper.stories.tsx +18 -18
- package/packages/lib/src/components/Paper/Paper.tsx +18 -18
- package/packages/lib/src/components/Paper/index.tsx +1 -1
- package/packages/lib/src/components/RangeSlider/RangeSlider.scss +83 -83
- package/packages/lib/src/components/RangeSlider/RangeSlider.stories.tsx +24 -24
- package/packages/lib/src/components/RangeSlider/RangeSlider.tsx +150 -150
- package/packages/lib/src/components/ResponsiveBar/ResponsiveBar.scss +72 -72
- package/packages/lib/src/components/ResponsiveBar/ResponsiveBar.tsx +38 -38
- package/packages/lib/src/components/ScrollView/ScrollView.scss +20 -20
- package/packages/lib/src/components/ScrollView/ScrollView.stories.tsx +17 -17
- package/packages/lib/src/components/ScrollView/ScrollView.test.tsx +11 -11
- package/packages/lib/src/components/ScrollView/ScrollView.tsx +19 -19
- package/packages/lib/src/components/ScrollView/index.tsx +1 -1
- package/packages/lib/src/components/Section/Section.scss +17 -17
- package/packages/lib/src/components/Section/Section.tsx +26 -26
- package/packages/lib/src/components/SelectField/SelectField.scss +42 -42
- package/packages/lib/src/components/SelectField/SelectField.stories.tsx +14 -14
- package/packages/lib/src/components/SelectField/SelectField.tsx +54 -54
- package/packages/lib/src/components/SelectField/index.tsx +1 -1
- package/packages/lib/src/components/Spacer/Spacer.scss +2 -2
- package/packages/lib/src/components/Spacer/Spacer.tsx +6 -6
- package/packages/lib/src/components/StackPanel/StackPanel.scss +8 -8
- package/packages/lib/src/components/StackPanel/StackPanel.stories.tsx +17 -17
- package/packages/lib/src/components/StackPanel/StackPanel.test.tsx +11 -11
- package/packages/lib/src/components/StackPanel/StackPanel.tsx +31 -31
- package/packages/lib/src/components/StackPanel/index.tsx +1 -1
- package/packages/lib/src/components/Submenu/Submenu.scss +55 -55
- package/packages/lib/src/components/Submenu/Submenu.stories.tsx +45 -45
- package/packages/lib/src/components/Submenu/Submenu.tsx +59 -59
- package/packages/lib/src/components/Submenu/index.tsx +1 -1
- package/packages/lib/src/components/SuccessCongratulation/SuccessCongratulation.scss +75 -75
- package/packages/lib/src/components/SuccessCongratulation/SuccessCongratulation.stories.tsx +17 -17
- package/packages/lib/src/components/SuccessCongratulation/SuccessCongratulation.test.tsx +11 -11
- package/packages/lib/src/components/SuccessCongratulation/SuccessCongratulation.tsx +63 -63
- package/packages/lib/src/components/SuccessCongratulation/index.tsx +1 -1
- package/packages/lib/src/components/TextArea/TextArea.scss +41 -41
- package/packages/lib/src/components/TextArea/TextArea.stories.tsx +14 -14
- package/packages/lib/src/components/TextArea/TextArea.tsx +50 -50
- package/packages/lib/src/components/TextArea/index.tsx +1 -1
- package/packages/lib/src/components/TextField/TextField.scss +56 -56
- package/packages/lib/src/components/TextField/TextField.stories.tsx +14 -14
- package/packages/lib/src/components/TextField/TextField.tsx +89 -89
- package/packages/lib/src/components/TextField/index.tsx +1 -1
- package/packages/lib/src/components/TitleEdit/TitleEdit.scss +17 -17
- package/packages/lib/src/components/TitleEdit/TitleEdit.tsx +69 -69
- package/packages/lib/src/components/Toast/Toast.scss +32 -32
- package/packages/lib/src/components/Toast/Toast.tsx +29 -29
- package/packages/lib/src/components/ToggleButton/ToggleButton.scss +47 -47
- package/packages/lib/src/components/ToggleButton/ToggleButton.stories.tsx +22 -22
- package/packages/lib/src/components/ToggleButton/ToggleButton.tsx +41 -41
- package/packages/lib/src/components/ToggleButton/index.tsx +1 -1
- package/packages/lib/src/components/Toolbar/Toolbar.scss +16 -16
- package/packages/lib/src/components/Toolbar/Toolbar.stories.tsx +17 -17
- package/packages/lib/src/components/Toolbar/Toolbar.test.tsx +11 -11
- package/packages/lib/src/components/Toolbar/Toolbar.tsx +20 -20
- package/packages/lib/src/components/Toolbar/index.tsx +1 -1
- package/packages/lib/src/components/Typography/Typography.scss +51 -51
- package/packages/lib/src/components/Typography/Typography.stories.tsx +18 -18
- package/packages/lib/src/components/Typography/Typography.tsx +19 -19
- package/packages/lib/src/components/index.tsx +34 -34
- package/packages/lib/src/hooks/index.tsx +3 -3
- package/packages/lib/src/hooks/use-click-outside.tsx +19 -19
- package/packages/lib/src/hooks/use-form.tsx +107 -107
- package/packages/lib/src/hooks/use-keys-enteresc.tsx +25 -25
- package/packages/lib/src/hooks/use-set-startup-focus.tsx +8 -8
- package/packages/lib/src/i18n/config.ts +8 -8
- package/packages/lib/src/i18n/en/translation.json +11 -11
- package/packages/lib/src/i18n/fr/translation.json +11 -11
- package/packages/lib/src/i18n/index.ts +11 -11
- package/packages/lib/src/index.tsx +7 -7
- package/packages/lib/src/stories/Intrduction.mdx +171 -171
- package/packages/lib/src/stories/assets/github.svg +3 -3
- package/packages/lib/src/styles/1-color-vars.scss +51 -51
- package/packages/lib/src/styles/2-font-variables.scss +2 -2
- package/packages/lib/src/styles/variables.scss +1 -1
- package/packages/lib/src/test/i18n.ts +17 -17
- package/packages/lib/src/utils/bem.ts +4 -4
- package/packages/lib/src/utils/formatError.ts +5 -5
- package/packages/lib/src/utils/index.ts +1 -1
- package/packages/lib/src/utils/interfaces.ts +5 -5
- package/packages/lib/tsconfig.json +26 -25
- package/packages/lib/vite.config.js +18 -18
- package/packages/ui-test/package-lock.json +97 -97
- package/packages/ui-test/package.json +19 -19
- package/packages/ui-test/playwright.config.ts +80 -80
- package/packages/ui-test/tests/example.spec.ts +18 -18
- package/packages/ui-test/tests-examples/demo-todo-app.spec.ts +437 -437
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { FormEvent, MouseEvent, ReactNode } from 'react';
|
|
2
|
-
import './IconButton.scss'
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { bem } from '../../utils/bem';
|
|
5
|
-
import { Link } from 'react-router';
|
|
6
|
-
|
|
7
|
-
interface IconButtonProps {
|
|
8
|
-
onClick?: (e?: FormEvent<HTMLButtonElement>) => void;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
className?: string;
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
title?: string;
|
|
13
|
-
variant?: "none" | "round" | "rounded" | "round-outlined";
|
|
14
|
-
type?: 'submit' | 'reset' | 'button';
|
|
15
|
-
to?: string;
|
|
16
|
-
}
|
|
17
|
-
const b = bem("icon-button");
|
|
18
|
-
export const IconButton = ({children, onClick, className, title, to, variant = "none", type, disabled}: IconButtonProps) => {
|
|
19
|
-
const handleClick = (e: MouseEvent<HTMLButtonElement>) => {
|
|
20
|
-
e.preventDefault();
|
|
21
|
-
onClick && onClick(e);
|
|
22
|
-
}
|
|
23
|
-
if(to) {
|
|
24
|
-
return (
|
|
25
|
-
<Link className={clsx(b(), b(variant), className)}
|
|
26
|
-
to={to}
|
|
27
|
-
title={title}
|
|
28
|
-
type={type}
|
|
29
|
-
>{children}</Link>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return (
|
|
34
|
-
<button
|
|
35
|
-
className={clsx(b(), b(variant), className)}
|
|
36
|
-
onClick={handleClick}
|
|
37
|
-
disabled={disabled}
|
|
38
|
-
title={title}
|
|
39
|
-
type={type}
|
|
40
|
-
>{children}</button>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export default IconButton
|
|
1
|
+
import { FormEvent, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import './IconButton.scss'
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { bem } from '../../utils/bem';
|
|
5
|
+
import { Link } from 'react-router';
|
|
6
|
+
|
|
7
|
+
interface IconButtonProps {
|
|
8
|
+
onClick?: (e?: FormEvent<HTMLButtonElement>) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
title?: string;
|
|
13
|
+
variant?: "none" | "round" | "rounded" | "round-outlined";
|
|
14
|
+
type?: 'submit' | 'reset' | 'button';
|
|
15
|
+
to?: string;
|
|
16
|
+
}
|
|
17
|
+
const b = bem("icon-button");
|
|
18
|
+
export const IconButton = ({children, onClick, className, title, to, variant = "none", type, disabled}: IconButtonProps) => {
|
|
19
|
+
const handleClick = (e: MouseEvent<HTMLButtonElement>) => {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
onClick && onClick(e);
|
|
22
|
+
}
|
|
23
|
+
if(to) {
|
|
24
|
+
return (
|
|
25
|
+
<Link className={clsx(b(), b(variant), className)}
|
|
26
|
+
to={to}
|
|
27
|
+
title={title}
|
|
28
|
+
type={type}
|
|
29
|
+
>{children}</Link>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return (
|
|
34
|
+
<button
|
|
35
|
+
className={clsx(b(), b(variant), className)}
|
|
36
|
+
onClick={handleClick}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
title={title}
|
|
39
|
+
type={type}
|
|
40
|
+
>{children}</button>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export default IconButton
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
// .r5ui-menu-item {
|
|
2
|
-
// color: $secondary_text_color;
|
|
3
|
-
// padding: .5em 1em;
|
|
4
|
-
// text-decoration: none;
|
|
5
|
-
// display: block;
|
|
6
|
-
// cursor: pointer;
|
|
7
|
-
// border: 0;
|
|
8
|
-
// background: none;
|
|
9
|
-
|
|
10
|
-
// &:hover {
|
|
11
|
-
// //background-color: $secondary_bg_color_highlight;
|
|
12
|
-
// text-decoration: underline;
|
|
13
|
-
// }
|
|
1
|
+
// .r5ui-menu-item {
|
|
2
|
+
// color: $secondary_text_color;
|
|
3
|
+
// padding: .5em 1em;
|
|
4
|
+
// text-decoration: none;
|
|
5
|
+
// display: block;
|
|
6
|
+
// cursor: pointer;
|
|
7
|
+
// border: 0;
|
|
8
|
+
// background: none;
|
|
9
|
+
|
|
10
|
+
// &:hover {
|
|
11
|
+
// //background-color: $secondary_bg_color_highlight;
|
|
12
|
+
// text-decoration: underline;
|
|
13
|
+
// }
|
|
14
14
|
// }
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { Link } from 'react-router';
|
|
3
|
-
import './MenuItem.scss';
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
import { bem } from '../../utils/bem';
|
|
6
|
-
|
|
7
|
-
interface MenuItemProps {
|
|
8
|
-
to?: string;
|
|
9
|
-
onClick?: (e?: React.FormEvent<HTMLButtonElement>) => void;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
className?: string;
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
component?: ReactNode;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const b = bem('menu-item');
|
|
17
|
-
export const MenuItem: React.FC<MenuItemProps> = ({ className, to, onClick, component, disabled, children }) => {
|
|
18
|
-
const c = clsx(b(), className);
|
|
19
|
-
if(component) {
|
|
20
|
-
return <div className={className}>{component}</div>;
|
|
21
|
-
}
|
|
22
|
-
if(to) {
|
|
23
|
-
return (
|
|
24
|
-
<Link className={c} to={to} onClick={(() => {onClick && onClick()})}>
|
|
25
|
-
{children}
|
|
26
|
-
</Link>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
return (
|
|
30
|
-
<button className={c} onClick={onClick} disabled={disabled}>
|
|
31
|
-
{children}
|
|
32
|
-
</button>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default MenuItem;
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { Link } from 'react-router';
|
|
3
|
+
import './MenuItem.scss';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { bem } from '../../utils/bem';
|
|
6
|
+
|
|
7
|
+
interface MenuItemProps {
|
|
8
|
+
to?: string;
|
|
9
|
+
onClick?: (e?: React.FormEvent<HTMLButtonElement>) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
component?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const b = bem('menu-item');
|
|
17
|
+
export const MenuItem: React.FC<MenuItemProps> = ({ className, to, onClick, component, disabled, children }) => {
|
|
18
|
+
const c = clsx(b(), className);
|
|
19
|
+
if(component) {
|
|
20
|
+
return <div className={className}>{component}</div>;
|
|
21
|
+
}
|
|
22
|
+
if(to) {
|
|
23
|
+
return (
|
|
24
|
+
<Link className={c} to={to} onClick={(() => {onClick && onClick()})}>
|
|
25
|
+
{children}
|
|
26
|
+
</Link>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return (
|
|
30
|
+
<button className={c} onClick={onClick} disabled={disabled}>
|
|
31
|
+
{children}
|
|
32
|
+
</button>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default MenuItem;
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
.r5ui-modal {
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
right: 0;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
8
|
-
display: flex;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
align-items: center;
|
|
11
|
-
z-index: 1000;
|
|
12
|
-
|
|
13
|
-
&__content {
|
|
14
|
-
background: $page_bg_color;
|
|
15
|
-
color: $page_text_color;
|
|
16
|
-
padding: 4px;
|
|
17
|
-
border-radius: 8px;
|
|
18
|
-
max-height: 100vh;
|
|
19
|
-
width: 96%;
|
|
20
|
-
position: relative;
|
|
21
|
-
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.3);
|
|
22
|
-
}
|
|
23
|
-
&__content--small {
|
|
24
|
-
max-width: 480px;
|
|
25
|
-
}
|
|
26
|
-
&__content--medium {
|
|
27
|
-
max-width: 720px;
|
|
28
|
-
min-height: 60vh;
|
|
29
|
-
}
|
|
30
|
-
&__content--large {
|
|
31
|
-
max-width: 1080px;
|
|
32
|
-
min-height: 90vh;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&__close {
|
|
36
|
-
position: absolute;
|
|
37
|
-
top: 5px;
|
|
38
|
-
right: 8px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&__title {
|
|
42
|
-
text-align: center;
|
|
43
|
-
margin: 0.5em;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&__modal-body {
|
|
47
|
-
margin: 0;
|
|
48
|
-
//max-height: 80vh;
|
|
49
|
-
overflow-y: auto;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&__header {
|
|
53
|
-
display: flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
margin: 0 0.5em 0.5em 0.5em;
|
|
56
|
-
margin-bottom: 10px;
|
|
57
|
-
min-height: 2em;
|
|
58
|
-
}
|
|
59
|
-
&__body {
|
|
60
|
-
display: flex;
|
|
61
|
-
justify-content: center;
|
|
62
|
-
text-align: center;
|
|
63
|
-
max-height: 90vh;
|
|
64
|
-
overflow-y: auto;
|
|
65
|
-
}
|
|
66
|
-
&__footer {
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-direction: column;
|
|
69
|
-
margin-top: 10px;
|
|
70
|
-
width: 100%;
|
|
71
|
-
}
|
|
1
|
+
.r5ui-modal {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
z-index: 1000;
|
|
12
|
+
|
|
13
|
+
&__content {
|
|
14
|
+
background: $page_bg_color;
|
|
15
|
+
color: $page_text_color;
|
|
16
|
+
padding: 4px;
|
|
17
|
+
border-radius: 8px;
|
|
18
|
+
max-height: 100vh;
|
|
19
|
+
width: 96%;
|
|
20
|
+
position: relative;
|
|
21
|
+
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.3);
|
|
22
|
+
}
|
|
23
|
+
&__content--small {
|
|
24
|
+
max-width: 480px;
|
|
25
|
+
}
|
|
26
|
+
&__content--medium {
|
|
27
|
+
max-width: 720px;
|
|
28
|
+
min-height: 60vh;
|
|
29
|
+
}
|
|
30
|
+
&__content--large {
|
|
31
|
+
max-width: 1080px;
|
|
32
|
+
min-height: 90vh;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&__close {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 5px;
|
|
38
|
+
right: 8px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&__title {
|
|
42
|
+
text-align: center;
|
|
43
|
+
margin: 0.5em;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__modal-body {
|
|
47
|
+
margin: 0;
|
|
48
|
+
//max-height: 80vh;
|
|
49
|
+
overflow-y: auto;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&__header {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
margin: 0 0.5em 0.5em 0.5em;
|
|
56
|
+
margin-bottom: 10px;
|
|
57
|
+
min-height: 2em;
|
|
58
|
+
}
|
|
59
|
+
&__body {
|
|
60
|
+
display: flex;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
text-align: center;
|
|
63
|
+
max-height: 90vh;
|
|
64
|
+
overflow-y: auto;
|
|
65
|
+
}
|
|
66
|
+
&__footer {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
margin-top: 10px;
|
|
70
|
+
width: 100%;
|
|
71
|
+
}
|
|
72
72
|
}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { bem } from '../../utils/bem';
|
|
2
|
-
import type { ReactNode, FC } from 'react';
|
|
3
|
-
import './Modal.scss'
|
|
4
|
-
import { Typography } from '../Typography';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
|
-
import { IconButton } from '../IconButton';
|
|
7
|
-
import { FaXmark } from 'react-icons/fa6';
|
|
8
|
-
|
|
9
|
-
export interface IModalProps {
|
|
10
|
-
title?: string;
|
|
11
|
-
className?: string;
|
|
12
|
-
onClose?: () => void;
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
variant?: 'small' | 'medium' | 'large';
|
|
15
|
-
}
|
|
16
|
-
const b = bem("modal");
|
|
17
|
-
export const Modal = ({className, children, onClose, title, variant = 'large'}: IModalProps) => {
|
|
18
|
-
return (
|
|
19
|
-
<div className={clsx(b(), className)}>
|
|
20
|
-
<div className={clsx(b("content"), b("content", variant))} onClick={(e) => e.stopPropagation()}>
|
|
21
|
-
<Typography className={b("title")} variant='h3'>{title}</Typography>
|
|
22
|
-
{onClose && <IconButton className={b("close")} variant='round-outlined' onClick={onClose}>
|
|
23
|
-
<FaXmark/>
|
|
24
|
-
</IconButton>}
|
|
25
|
-
<div className={b("modal-body")}>{children}</div>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface IModalHeaderProps {
|
|
32
|
-
className?: string;
|
|
33
|
-
children?: ReactNode;
|
|
34
|
-
}
|
|
35
|
-
const Header: FC<IModalHeaderProps> = ({ children, className }) => {
|
|
36
|
-
return <div className={clsx(b('header'), className)}>{children}</div>;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
Modal.Header = Header;
|
|
40
|
-
|
|
41
|
-
export interface IModalBodyProps {
|
|
42
|
-
className?: string;
|
|
43
|
-
children: ReactNode;
|
|
44
|
-
}
|
|
45
|
-
const Body: FC<IModalBodyProps> = ({ children, className }) => {
|
|
46
|
-
return <div className={clsx(b('body'), className)}>{children}</div>;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
Modal.Body = Body;
|
|
50
|
-
|
|
51
|
-
export interface IModalActionsProps {
|
|
52
|
-
className?: string;
|
|
53
|
-
children: ReactNode;
|
|
54
|
-
}
|
|
55
|
-
const Footer: FC<IModalActionsProps> = ({ children, className }) => {
|
|
56
|
-
return <div className={clsx(b('footer'), className)}>{children}</div>;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
Modal.Footer = Footer;
|
|
60
|
-
|
|
1
|
+
import { bem } from '../../utils/bem';
|
|
2
|
+
import type { ReactNode, FC } from 'react';
|
|
3
|
+
import './Modal.scss'
|
|
4
|
+
import { Typography } from '../Typography';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { IconButton } from '../IconButton';
|
|
7
|
+
import { FaXmark } from 'react-icons/fa6';
|
|
8
|
+
|
|
9
|
+
export interface IModalProps {
|
|
10
|
+
title?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
onClose?: () => void;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
variant?: 'small' | 'medium' | 'large';
|
|
15
|
+
}
|
|
16
|
+
const b = bem("modal");
|
|
17
|
+
export const Modal = ({className, children, onClose, title, variant = 'large'}: IModalProps) => {
|
|
18
|
+
return (
|
|
19
|
+
<div className={clsx(b(), className)}>
|
|
20
|
+
<div className={clsx(b("content"), b("content", variant))} onClick={(e) => e.stopPropagation()}>
|
|
21
|
+
<Typography className={b("title")} variant='h3'>{title}</Typography>
|
|
22
|
+
{onClose && <IconButton className={b("close")} variant='round-outlined' onClick={onClose}>
|
|
23
|
+
<FaXmark/>
|
|
24
|
+
</IconButton>}
|
|
25
|
+
<div className={b("modal-body")}>{children}</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface IModalHeaderProps {
|
|
32
|
+
className?: string;
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
const Header: FC<IModalHeaderProps> = ({ children, className }) => {
|
|
36
|
+
return <div className={clsx(b('header'), className)}>{children}</div>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
Modal.Header = Header;
|
|
40
|
+
|
|
41
|
+
export interface IModalBodyProps {
|
|
42
|
+
className?: string;
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
const Body: FC<IModalBodyProps> = ({ children, className }) => {
|
|
46
|
+
return <div className={clsx(b('body'), className)}>{children}</div>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Modal.Body = Body;
|
|
50
|
+
|
|
51
|
+
export interface IModalActionsProps {
|
|
52
|
+
className?: string;
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
}
|
|
55
|
+
const Footer: FC<IModalActionsProps> = ({ children, className }) => {
|
|
56
|
+
return <div className={clsx(b('footer'), className)}>{children}</div>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
Modal.Footer = Footer;
|
|
60
|
+
|
|
61
61
|
export default Modal
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
.r5ui-navbar {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: right;
|
|
4
|
-
align-items: end;
|
|
5
|
-
margin: 0 1em;
|
|
6
|
-
&__container {
|
|
7
|
-
list-style: none;
|
|
8
|
-
padding: 0;
|
|
9
|
-
margin: 0;
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-basis: 100%;
|
|
12
|
-
}
|
|
13
|
-
&__item {
|
|
14
|
-
margin: 0;
|
|
15
|
-
margin-left: 1em;
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
}
|
|
19
|
-
&__expand-button {
|
|
20
|
-
margin: 0;
|
|
21
|
-
padding: 0;
|
|
22
|
-
display: none;
|
|
23
|
-
background: none;
|
|
24
|
-
border: $border_size solid $primary_border_color;
|
|
25
|
-
border-radius: $border_radius;
|
|
26
|
-
width: 36px;
|
|
27
|
-
height: 36px;
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
color: $secondary_text_color;
|
|
30
|
-
flex-direction: row;
|
|
31
|
-
align-items: center;
|
|
32
|
-
justify-content: center;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@media (max-width: 240px) {
|
|
37
|
-
.navbar {
|
|
38
|
-
flex-direction: column;
|
|
39
|
-
&__container {
|
|
40
|
-
display: none;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
&--open {
|
|
43
|
-
display: flex;
|
|
44
|
-
align-items: end;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
&__expand-button {
|
|
48
|
-
display: flex;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
1
|
+
.r5ui-navbar {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: right;
|
|
4
|
+
align-items: end;
|
|
5
|
+
margin: 0 1em;
|
|
6
|
+
&__container {
|
|
7
|
+
list-style: none;
|
|
8
|
+
padding: 0;
|
|
9
|
+
margin: 0;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-basis: 100%;
|
|
12
|
+
}
|
|
13
|
+
&__item {
|
|
14
|
+
margin: 0;
|
|
15
|
+
margin-left: 1em;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
}
|
|
19
|
+
&__expand-button {
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
display: none;
|
|
23
|
+
background: none;
|
|
24
|
+
border: $border_size solid $primary_border_color;
|
|
25
|
+
border-radius: $border_radius;
|
|
26
|
+
width: 36px;
|
|
27
|
+
height: 36px;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
color: $secondary_text_color;
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (max-width: 240px) {
|
|
37
|
+
.navbar {
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
&__container {
|
|
40
|
+
display: none;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
&--open {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: end;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
&__expand-button {
|
|
48
|
+
display: flex;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Navbar } from './Navbar';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Navbar> = {
|
|
6
|
-
component: Navbar,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof Navbar>;
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
14
|
-
* See https://storybook.js.org/docs/react/api/csf
|
|
15
|
-
* to learn how to use render functions.
|
|
16
|
-
*/
|
|
17
|
-
export const Primary: Story = {
|
|
18
|
-
render: () => (
|
|
19
|
-
<div style={{ backgroundColor: '#333' }}>
|
|
20
|
-
<Navbar>
|
|
21
|
-
<a href="#">Link</a>
|
|
22
|
-
</Navbar>
|
|
23
|
-
</div>
|
|
24
|
-
),
|
|
25
|
-
};
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { Navbar } from './Navbar';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Navbar> = {
|
|
6
|
+
component: Navbar,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof Navbar>;
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
14
|
+
* See https://storybook.js.org/docs/react/api/csf
|
|
15
|
+
* to learn how to use render functions.
|
|
16
|
+
*/
|
|
17
|
+
export const Primary: Story = {
|
|
18
|
+
render: () => (
|
|
19
|
+
<div style={{ backgroundColor: '#333' }}>
|
|
20
|
+
<Navbar>
|
|
21
|
+
<a href="#">Link</a>
|
|
22
|
+
</Navbar>
|
|
23
|
+
</div>
|
|
24
|
+
),
|
|
25
|
+
};
|