@react5/ui 1.0.11 → 1.0.13
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.scss +1326 -1326
- package/packages/lib/dist/index.scss +1326 -1326
- package/packages/lib/dist/types/hooks/use-form.d.ts +1 -1
- package/packages/lib/dist/types/hooks/use-form.d.ts.map +1 -1
- package/packages/lib/jest.config.js +19 -19
- package/packages/lib/package.json +110 -110
- 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 +42 -42
- 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/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 +4 -4
- package/packages/lib/src/components/Panel/Panel.stories.tsx +17 -17
- package/packages/lib/src/components/Panel/Panel.test.tsx +11 -11
- package/packages/lib/src/components/Panel/Panel.tsx +18 -18
- 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 +33 -33
- package/packages/lib/src/components/SelectField/SelectField.stories.tsx +14 -14
- package/packages/lib/src/components/SelectField/SelectField.tsx +53 -53
- 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 +33 -33
- package/packages/lib/src/components/TextArea/TextArea.stories.tsx +14 -14
- package/packages/lib/src/components/TextArea/TextArea.tsx +49 -49
- package/packages/lib/src/components/TextArea/index.tsx +1 -1
- package/packages/lib/src/components/TextField/TextField.scss +48 -48
- package/packages/lib/src/components/TextField/TextField.stories.tsx +14 -14
- package/packages/lib/src/components/TextField/TextField.tsx +86 -86
- 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 +33 -33
- 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 +175 -175
- package/packages/lib/src/stories/assets/github.svg +3 -3
- package/packages/lib/src/styles/1-color-vars.scss +50 -50
- 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 +25 -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
- package/packages/lib/dist/esm/index.esm.js.map +0 -1
- package/packages/lib/dist/index.js.map +0 -1
|
@@ -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
|
+
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { ReactNode, Children, useState, useRef } from "react"
|
|
2
|
-
import './Navbar.scss'
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import { bem } from '../../utils/bem';
|
|
5
|
-
import { FaBars } from "react-icons/fa6";
|
|
6
|
-
import { useClickOutside } from "../../hooks";
|
|
7
|
-
|
|
8
|
-
export interface INavbarProps {
|
|
9
|
-
children: ReactNode
|
|
10
|
-
className?: string
|
|
11
|
-
}
|
|
12
|
-
const b = bem("navbar");
|
|
13
|
-
export const Navbar = ({children, className}: INavbarProps) => {
|
|
14
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
15
|
-
const buttonRef = useRef<HTMLButtonElement | null>(null);
|
|
16
|
-
const dropdownRef = useRef<HTMLUListElement | null>(null);
|
|
17
|
-
useClickOutside([buttonRef, dropdownRef], () => setIsOpen(false));
|
|
18
|
-
|
|
19
|
-
const toggleDropdown = () => setIsOpen((prevIsOpen: boolean) => !prevIsOpen);
|
|
20
|
-
return (<nav className={clsx(b(), className)}>
|
|
21
|
-
<button
|
|
22
|
-
className={b("expand-button")}
|
|
23
|
-
onClick={toggleDropdown}
|
|
24
|
-
ref={buttonRef}>
|
|
25
|
-
<FaBars/>
|
|
26
|
-
</button>
|
|
27
|
-
<ul
|
|
28
|
-
className={clsx(b("container"), isOpen && b("container", "open"))}
|
|
29
|
-
ref={dropdownRef}
|
|
30
|
-
>
|
|
31
|
-
{
|
|
32
|
-
Children.map(children, (c, i) => (
|
|
33
|
-
<li key={i} className={b("item")}>{c}</li>
|
|
34
|
-
))
|
|
35
|
-
}
|
|
36
|
-
</ul>
|
|
37
|
-
</nav>
|
|
38
|
-
)
|
|
1
|
+
import { ReactNode, Children, useState, useRef } from "react"
|
|
2
|
+
import './Navbar.scss'
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { bem } from '../../utils/bem';
|
|
5
|
+
import { FaBars } from "react-icons/fa6";
|
|
6
|
+
import { useClickOutside } from "../../hooks";
|
|
7
|
+
|
|
8
|
+
export interface INavbarProps {
|
|
9
|
+
children: ReactNode
|
|
10
|
+
className?: string
|
|
11
|
+
}
|
|
12
|
+
const b = bem("navbar");
|
|
13
|
+
export const Navbar = ({children, className}: INavbarProps) => {
|
|
14
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
15
|
+
const buttonRef = useRef<HTMLButtonElement | null>(null);
|
|
16
|
+
const dropdownRef = useRef<HTMLUListElement | null>(null);
|
|
17
|
+
useClickOutside([buttonRef, dropdownRef], () => setIsOpen(false));
|
|
18
|
+
|
|
19
|
+
const toggleDropdown = () => setIsOpen((prevIsOpen: boolean) => !prevIsOpen);
|
|
20
|
+
return (<nav className={clsx(b(), className)}>
|
|
21
|
+
<button
|
|
22
|
+
className={b("expand-button")}
|
|
23
|
+
onClick={toggleDropdown}
|
|
24
|
+
ref={buttonRef}>
|
|
25
|
+
<FaBars/>
|
|
26
|
+
</button>
|
|
27
|
+
<ul
|
|
28
|
+
className={clsx(b("container"), isOpen && b("container", "open"))}
|
|
29
|
+
ref={dropdownRef}
|
|
30
|
+
>
|
|
31
|
+
{
|
|
32
|
+
Children.map(children, (c, i) => (
|
|
33
|
+
<li key={i} className={b("item")}>{c}</li>
|
|
34
|
+
))
|
|
35
|
+
}
|
|
36
|
+
</ul>
|
|
37
|
+
</nav>
|
|
38
|
+
)
|
|
39
39
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
.r5ui-navbar-link {
|
|
2
|
-
text-decoration: none;
|
|
3
|
-
margin: 10px;
|
|
4
|
-
color: $secondary_text_color;
|
|
5
|
-
@media (min-width: 640px) {
|
|
6
|
-
font-weight: 600;
|
|
7
|
-
}
|
|
8
|
-
&:hover,
|
|
9
|
-
&:focus{
|
|
10
|
-
color: $secondary_text_color;
|
|
11
|
-
text-decoration: underline;
|
|
12
|
-
}
|
|
13
|
-
&:active{
|
|
14
|
-
color: $secondary_text_color_highlight;
|
|
15
|
-
}
|
|
1
|
+
.r5ui-navbar-link {
|
|
2
|
+
text-decoration: none;
|
|
3
|
+
margin: 10px;
|
|
4
|
+
color: $secondary_text_color;
|
|
5
|
+
@media (min-width: 640px) {
|
|
6
|
+
font-weight: 600;
|
|
7
|
+
}
|
|
8
|
+
&:hover,
|
|
9
|
+
&:focus{
|
|
10
|
+
color: $secondary_text_color;
|
|
11
|
+
text-decoration: underline;
|
|
12
|
+
}
|
|
13
|
+
&:active{
|
|
14
|
+
color: $secondary_text_color_highlight;
|
|
15
|
+
}
|
|
16
16
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import "./NavbarLink.scss";
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { bem } from '../../utils/bem';
|
|
5
|
-
|
|
6
|
-
export interface INavbarLinkProps {
|
|
7
|
-
to?: string;
|
|
8
|
-
onClick?: () => void;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
component?: any;
|
|
11
|
-
className?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const b = bem("navbar-link");
|
|
15
|
-
export const NavbarLink = ({ to, children, onClick, component: Component, className }: INavbarLinkProps) => {
|
|
16
|
-
if(Component) {
|
|
17
|
-
return (
|
|
18
|
-
<Component
|
|
19
|
-
className={clsx(b(), className)}
|
|
20
|
-
to={to}
|
|
21
|
-
>{children}</Component>)
|
|
22
|
-
}
|
|
23
|
-
else if(onClick)
|
|
24
|
-
return (
|
|
25
|
-
<a
|
|
26
|
-
className={clsx(b(), className)}
|
|
27
|
-
href="#"
|
|
28
|
-
onClick={onClick}
|
|
29
|
-
>{children}</a>
|
|
30
|
-
);
|
|
31
|
-
return <a>{children}</a>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default NavbarLink
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import "./NavbarLink.scss";
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { bem } from '../../utils/bem';
|
|
5
|
+
|
|
6
|
+
export interface INavbarLinkProps {
|
|
7
|
+
to?: string;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
component?: any;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const b = bem("navbar-link");
|
|
15
|
+
export const NavbarLink = ({ to, children, onClick, component: Component, className }: INavbarLinkProps) => {
|
|
16
|
+
if(Component) {
|
|
17
|
+
return (
|
|
18
|
+
<Component
|
|
19
|
+
className={clsx(b(), className)}
|
|
20
|
+
to={to}
|
|
21
|
+
>{children}</Component>)
|
|
22
|
+
}
|
|
23
|
+
else if(onClick)
|
|
24
|
+
return (
|
|
25
|
+
<a
|
|
26
|
+
className={clsx(b(), className)}
|
|
27
|
+
href="#"
|
|
28
|
+
onClick={onClick}
|
|
29
|
+
>{children}</a>
|
|
30
|
+
);
|
|
31
|
+
return <a>{children}</a>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default NavbarLink
|