@react5/ui 1.0.26 → 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.css +0 -2
- 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 -1403
- package/packages/lib/dist/index.css +0 -2
- package/packages/lib/dist/index.js +1 -1
- package/packages/lib/dist/index.js.map +1 -1
- package/packages/lib/dist/index.scss +1401 -1403
- 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 -62
- 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,33 +1,33 @@
|
|
|
1
|
-
.r5ui-toast {
|
|
2
|
-
background: $primary_bg_color;
|
|
3
|
-
border: $border_size solid $primary_border_color;
|
|
4
|
-
border-radius: $border_radius;
|
|
5
|
-
color: $primary_text_color;
|
|
6
|
-
display: block;
|
|
7
|
-
padding: 1em;
|
|
8
|
-
width: 100%;
|
|
9
|
-
&--success {
|
|
10
|
-
background: $success_color;
|
|
11
|
-
color: $success_text_color;
|
|
12
|
-
}
|
|
13
|
-
&--warning {
|
|
14
|
-
background: $warning_color;
|
|
15
|
-
color: $warning_text_color;
|
|
16
|
-
}
|
|
17
|
-
&--error {
|
|
18
|
-
background: $error_color;
|
|
19
|
-
color: $error_text_color;
|
|
20
|
-
}
|
|
21
|
-
&__close {
|
|
22
|
-
float: right;
|
|
23
|
-
width: 1em;
|
|
24
|
-
height: 1em;
|
|
25
|
-
&, &:focus, &:hover {
|
|
26
|
-
background-color: transparent;
|
|
27
|
-
border: 0;
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
outline: none;
|
|
30
|
-
color: $primary_text_color;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
.r5ui-toast {
|
|
2
|
+
background: $primary_bg_color;
|
|
3
|
+
border: $border_size solid $primary_border_color;
|
|
4
|
+
border-radius: $border_radius;
|
|
5
|
+
color: $primary_text_color;
|
|
6
|
+
display: block;
|
|
7
|
+
padding: 1em;
|
|
8
|
+
width: 100%;
|
|
9
|
+
&--success {
|
|
10
|
+
background: $success_color;
|
|
11
|
+
color: $success_text_color;
|
|
12
|
+
}
|
|
13
|
+
&--warning {
|
|
14
|
+
background: $warning_color;
|
|
15
|
+
color: $warning_text_color;
|
|
16
|
+
}
|
|
17
|
+
&--error {
|
|
18
|
+
background: $error_color;
|
|
19
|
+
color: $error_text_color;
|
|
20
|
+
}
|
|
21
|
+
&__close {
|
|
22
|
+
float: right;
|
|
23
|
+
width: 1em;
|
|
24
|
+
height: 1em;
|
|
25
|
+
&, &:focus, &:hover {
|
|
26
|
+
background-color: transparent;
|
|
27
|
+
border: 0;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
outline: none;
|
|
30
|
+
color: $primary_text_color;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
33
|
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import "./Toast.scss";
|
|
3
|
-
import type { ReactNode } from "react";
|
|
4
|
-
import { bem } from '../../utils/bem';
|
|
5
|
-
|
|
6
|
-
export interface IToastProps {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
type?: "error" | "warning" | "success";
|
|
9
|
-
onClose?: Function;
|
|
10
|
-
className?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const b = bem("toast");
|
|
14
|
-
export const Toast = ({type = "success", children, onClose, className}: IToastProps) => {
|
|
15
|
-
return (
|
|
16
|
-
<div className={clsx(b(), b('', type), className)}>
|
|
17
|
-
{ children }
|
|
18
|
-
<button
|
|
19
|
-
aria-label="Close"
|
|
20
|
-
className={b('close')}
|
|
21
|
-
onClick={ () => onClose && onClose() }
|
|
22
|
-
>
|
|
23
|
-
<span aria-hidden="true">×</span>
|
|
24
|
-
</button>
|
|
25
|
-
</div>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import "./Toast.scss";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import { bem } from '../../utils/bem';
|
|
5
|
+
|
|
6
|
+
export interface IToastProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
type?: "error" | "warning" | "success";
|
|
9
|
+
onClose?: Function;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const b = bem("toast");
|
|
14
|
+
export const Toast = ({type = "success", children, onClose, className}: IToastProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<div className={clsx(b(), b('', type), className)}>
|
|
17
|
+
{ children }
|
|
18
|
+
<button
|
|
19
|
+
aria-label="Close"
|
|
20
|
+
className={b('close')}
|
|
21
|
+
onClick={ () => onClose && onClose() }
|
|
22
|
+
>
|
|
23
|
+
<span aria-hidden="true">×</span>
|
|
24
|
+
</button>
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
30
|
export default Toast
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
.r5ui-toggle-button {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
position: relative;
|
|
4
|
-
width: 30px;
|
|
5
|
-
height: 17px;
|
|
6
|
-
//margin: 0 .5em;
|
|
7
|
-
margin-right: 0.5em;
|
|
8
|
-
|
|
9
|
-
&__input {
|
|
10
|
-
opacity: 0;
|
|
11
|
-
width: 0;
|
|
12
|
-
height: 0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
&__slider {
|
|
16
|
-
position: absolute;
|
|
17
|
-
cursor: pointer;
|
|
18
|
-
top: 0;
|
|
19
|
-
left: 0;
|
|
20
|
-
right: 0;
|
|
21
|
-
bottom: 0;
|
|
22
|
-
background-color: $primary_border_color;
|
|
23
|
-
transition: .4s;
|
|
24
|
-
border-radius: 17px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&__slider:before {
|
|
28
|
-
position: absolute;
|
|
29
|
-
content: "";
|
|
30
|
-
height: 13px;
|
|
31
|
-
width: 13px;
|
|
32
|
-
left: 2px;
|
|
33
|
-
bottom: 2px;
|
|
34
|
-
background-color: $control_bg_color;
|
|
35
|
-
//background-color: $menu_text_color;
|
|
36
|
-
transition: .4s;
|
|
37
|
-
border-radius: 50%;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&__input:checked + &__slider {
|
|
41
|
-
background-color: $primary_bg_color;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&__input:checked + &__slider:before {
|
|
45
|
-
transform: translateX(13px);
|
|
46
|
-
}
|
|
47
|
-
|
|
1
|
+
.r5ui-toggle-button {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
position: relative;
|
|
4
|
+
width: 30px;
|
|
5
|
+
height: 17px;
|
|
6
|
+
//margin: 0 .5em;
|
|
7
|
+
margin-right: 0.5em;
|
|
8
|
+
|
|
9
|
+
&__input {
|
|
10
|
+
opacity: 0;
|
|
11
|
+
width: 0;
|
|
12
|
+
height: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&__slider {
|
|
16
|
+
position: absolute;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
right: 0;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
background-color: $primary_border_color;
|
|
23
|
+
transition: .4s;
|
|
24
|
+
border-radius: 17px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__slider:before {
|
|
28
|
+
position: absolute;
|
|
29
|
+
content: "";
|
|
30
|
+
height: 13px;
|
|
31
|
+
width: 13px;
|
|
32
|
+
left: 2px;
|
|
33
|
+
bottom: 2px;
|
|
34
|
+
background-color: $control_bg_color;
|
|
35
|
+
//background-color: $menu_text_color;
|
|
36
|
+
transition: .4s;
|
|
37
|
+
border-radius: 50%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__input:checked + &__slider {
|
|
41
|
+
background-color: $primary_bg_color;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&__input:checked + &__slider:before {
|
|
45
|
+
transform: translateX(13px);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
48
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Fragment } from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import { ToggleButton } from './ToggleButton';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof ToggleButton> = {
|
|
6
|
-
title: 'Example/ToggleButton',
|
|
7
|
-
component: ToggleButton,
|
|
8
|
-
} as Meta;
|
|
9
|
-
export default meta;
|
|
10
|
-
|
|
11
|
-
type Story = StoryObj<typeof ToggleButton>;
|
|
12
|
-
|
|
13
|
-
export const SampleToggleButton: Story = {
|
|
14
|
-
render: () => (
|
|
15
|
-
<Fragment>
|
|
16
|
-
<ToggleButton checked={true} onChange={() => {}} label="Test" name="Checked CB" />
|
|
17
|
-
<br />
|
|
18
|
-
<br />
|
|
19
|
-
<ToggleButton checked={false} onChange={() => {}} label="Test" name="Unchecked CB" />
|
|
20
|
-
</Fragment>
|
|
21
|
-
),
|
|
22
|
-
};
|
|
1
|
+
import { Fragment } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { ToggleButton } from './ToggleButton';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ToggleButton> = {
|
|
6
|
+
title: 'Example/ToggleButton',
|
|
7
|
+
component: ToggleButton,
|
|
8
|
+
} as Meta;
|
|
9
|
+
export default meta;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof ToggleButton>;
|
|
12
|
+
|
|
13
|
+
export const SampleToggleButton: Story = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<Fragment>
|
|
16
|
+
<ToggleButton checked={true} onChange={() => {}} label="Test" name="Checked CB" />
|
|
17
|
+
<br />
|
|
18
|
+
<br />
|
|
19
|
+
<ToggleButton checked={false} onChange={() => {}} label="Test" name="Unchecked CB" />
|
|
20
|
+
</Fragment>
|
|
21
|
+
),
|
|
22
|
+
};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { ChangeEventHandler, FC, Fragment, forwardRef } from "react";
|
|
2
|
-
import { formatError } from "../../utils";
|
|
3
|
-
import "./ToggleButton.scss";
|
|
4
|
-
import clsx from "clsx";
|
|
5
|
-
import { bem } from '../../utils/bem';
|
|
6
|
-
|
|
7
|
-
interface IToggleButtonProps {
|
|
8
|
-
label?: string;
|
|
9
|
-
name?: string;
|
|
10
|
-
error?: string;
|
|
11
|
-
validationError?: (name?: string) => string | undefined;
|
|
12
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
13
|
-
autoFocus?: boolean;
|
|
14
|
-
className?: string;
|
|
15
|
-
readonly?: boolean;
|
|
16
|
-
checked?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const b = bem("toggle-button");
|
|
20
|
-
export const ToggleButton : FC<IToggleButtonProps> = forwardRef(({checked, onChange,
|
|
21
|
-
name, className, autoFocus = false, readonly = false, label, error }, ref: any) => {
|
|
22
|
-
|
|
23
|
-
return (<Fragment>
|
|
24
|
-
<label className={clsx(b(), className)}>
|
|
25
|
-
<input
|
|
26
|
-
id={name}
|
|
27
|
-
name={name}
|
|
28
|
-
className={b("input")}
|
|
29
|
-
readOnly={readonly}
|
|
30
|
-
type="checkbox"
|
|
31
|
-
checked={checked}
|
|
32
|
-
onChange={onChange}
|
|
33
|
-
ref={ref}
|
|
34
|
-
autoFocus={autoFocus}
|
|
35
|
-
autoComplete="on"
|
|
36
|
-
/>
|
|
37
|
-
<span className={b("slider")}></span>
|
|
38
|
-
</label>
|
|
39
|
-
<span className={b("label")}>{label}</span>
|
|
40
|
-
{error && <div>{formatError(error, label)}</div>}
|
|
41
|
-
</Fragment>)
|
|
1
|
+
import { ChangeEventHandler, FC, Fragment, forwardRef } from "react";
|
|
2
|
+
import { formatError } from "../../utils";
|
|
3
|
+
import "./ToggleButton.scss";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { bem } from '../../utils/bem';
|
|
6
|
+
|
|
7
|
+
interface IToggleButtonProps {
|
|
8
|
+
label?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
validationError?: (name?: string) => string | undefined;
|
|
12
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
13
|
+
autoFocus?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const b = bem("toggle-button");
|
|
20
|
+
export const ToggleButton : FC<IToggleButtonProps> = forwardRef(({checked, onChange,
|
|
21
|
+
name, className, autoFocus = false, readonly = false, label, error }, ref: any) => {
|
|
22
|
+
|
|
23
|
+
return (<Fragment>
|
|
24
|
+
<label className={clsx(b(), className)}>
|
|
25
|
+
<input
|
|
26
|
+
id={name}
|
|
27
|
+
name={name}
|
|
28
|
+
className={b("input")}
|
|
29
|
+
readOnly={readonly}
|
|
30
|
+
type="checkbox"
|
|
31
|
+
checked={checked}
|
|
32
|
+
onChange={onChange}
|
|
33
|
+
ref={ref}
|
|
34
|
+
autoFocus={autoFocus}
|
|
35
|
+
autoComplete="on"
|
|
36
|
+
/>
|
|
37
|
+
<span className={b("slider")}></span>
|
|
38
|
+
</label>
|
|
39
|
+
<span className={b("label")}>{label}</span>
|
|
40
|
+
{error && <div>{formatError(error, label)}</div>}
|
|
41
|
+
</Fragment>)
|
|
42
42
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./ToggleButton";
|
|
1
|
+
export * from "./ToggleButton";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
.r5ui-toolbar {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: row;
|
|
4
|
-
gap: 0.5em;
|
|
5
|
-
|
|
6
|
-
&--right {
|
|
7
|
-
justify-content: flex-end;
|
|
8
|
-
margin-left: auto;
|
|
9
|
-
}
|
|
10
|
-
&--center {
|
|
11
|
-
justify-content: center;
|
|
12
|
-
margin: 0 auto;
|
|
13
|
-
}
|
|
14
|
-
&--vertical {
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
}
|
|
1
|
+
.r5ui-toolbar {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
gap: 0.5em;
|
|
5
|
+
|
|
6
|
+
&--right {
|
|
7
|
+
justify-content: flex-end;
|
|
8
|
+
margin-left: auto;
|
|
9
|
+
}
|
|
10
|
+
&--center {
|
|
11
|
+
justify-content: center;
|
|
12
|
+
margin: 0 auto;
|
|
13
|
+
}
|
|
14
|
+
&--vertical {
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
}
|
|
17
17
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Toolbar } from './Toolbar';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Toolbar> = {
|
|
5
|
-
title: 'Example/Toolbar',
|
|
6
|
-
component: Toolbar,
|
|
7
|
-
argTypes: {
|
|
8
|
-
backgroundColor: { control: 'color' },
|
|
9
|
-
},
|
|
10
|
-
} as Meta;
|
|
11
|
-
export default meta;
|
|
12
|
-
|
|
13
|
-
type Story = StoryObj<typeof Toolbar>;
|
|
14
|
-
|
|
15
|
-
export const TextToolbar: Story = {
|
|
16
|
-
render: () => <Toolbar>Test</Toolbar>,
|
|
17
|
-
};
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Toolbar } from './Toolbar';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Toolbar> = {
|
|
5
|
+
title: 'Example/Toolbar',
|
|
6
|
+
component: Toolbar,
|
|
7
|
+
argTypes: {
|
|
8
|
+
backgroundColor: { control: 'color' },
|
|
9
|
+
},
|
|
10
|
+
} as Meta;
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof Toolbar>;
|
|
14
|
+
|
|
15
|
+
export const TextToolbar: Story = {
|
|
16
|
+
render: () => <Toolbar>Test</Toolbar>,
|
|
17
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import { Toolbar } from './Toolbar';
|
|
5
|
-
|
|
6
|
-
describe('Toolbar Component', () => {
|
|
7
|
-
test('renders the button with the correct label', () => {
|
|
8
|
-
render(<Toolbar >test</Toolbar>);
|
|
9
|
-
const div = screen.getByText('test');
|
|
10
|
-
expect(div).toBeInTheDocument();
|
|
11
|
-
});
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import { Toolbar } from './Toolbar';
|
|
5
|
+
|
|
6
|
+
describe('Toolbar Component', () => {
|
|
7
|
+
test('renders the button with the correct label', () => {
|
|
8
|
+
render(<Toolbar >test</Toolbar>);
|
|
9
|
+
const div = screen.getByText('test');
|
|
10
|
+
expect(div).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
12
|
});
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import './Toolbar.scss'
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { bem } from '../../utils/bem';
|
|
5
|
-
|
|
6
|
-
interface ToolbarProps {
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
className?: string;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
align?: 'left' | 'right' | 'center';
|
|
11
|
-
orientation?: 'horizontal' | 'vertical';
|
|
12
|
-
}
|
|
13
|
-
const b = bem("toolbar");
|
|
14
|
-
export const Toolbar = ({children, className, align = 'left', orientation = 'horizontal'}: ToolbarProps) => {
|
|
15
|
-
return (
|
|
16
|
-
<div className={clsx(b(), b('', align), b('', orientation), className)}>
|
|
17
|
-
{children}
|
|
18
|
-
</div>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import './Toolbar.scss'
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { bem } from '../../utils/bem';
|
|
5
|
+
|
|
6
|
+
interface ToolbarProps {
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
align?: 'left' | 'right' | 'center';
|
|
11
|
+
orientation?: 'horizontal' | 'vertical';
|
|
12
|
+
}
|
|
13
|
+
const b = bem("toolbar");
|
|
14
|
+
export const Toolbar = ({children, className, align = 'left', orientation = 'horizontal'}: ToolbarProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<div className={clsx(b(), b('', align), b('', orientation), className)}>
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
21
|
export default Toolbar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./Toolbar";
|
|
1
|
+
export * from "./Toolbar";
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
.r5ui-typography {
|
|
2
|
-
color: $page_text_color;
|
|
3
|
-
font-family: $title_font;
|
|
4
|
-
&__p {
|
|
5
|
-
font-family: $primary_font;
|
|
6
|
-
margin-bottom: 1em;
|
|
7
|
-
margin-top: .5em;
|
|
8
|
-
text-align: justify;
|
|
9
|
-
}
|
|
10
|
-
&__div {
|
|
11
|
-
font-family: $primary_font;
|
|
12
|
-
margin: 0;
|
|
13
|
-
display: inline-block;
|
|
14
|
-
text-align: justify;
|
|
15
|
-
}
|
|
16
|
-
&__h1 {
|
|
17
|
-
font-size: 2.5em;
|
|
18
|
-
font-weight: 500;
|
|
19
|
-
margin-bottom: .5em;
|
|
20
|
-
margin-top: .5em;
|
|
21
|
-
text-align: center;
|
|
22
|
-
}
|
|
23
|
-
@media (max-width: 800px) {
|
|
24
|
-
&__h1 {
|
|
25
|
-
font-size: 1.5em;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
&__h2 {
|
|
29
|
-
font-size: 2em;
|
|
30
|
-
font-weight: 500;
|
|
31
|
-
margin-bottom: .5em;
|
|
32
|
-
margin-top: .5em;
|
|
33
|
-
}
|
|
34
|
-
&__h3 {
|
|
35
|
-
font-size: 1.5em;
|
|
36
|
-
font-weight: 500;
|
|
37
|
-
margin-bottom: .5em;
|
|
38
|
-
margin-top: .5em;
|
|
39
|
-
text-align: center;
|
|
40
|
-
}
|
|
41
|
-
&__li {
|
|
42
|
-
}
|
|
43
|
-
&__left {
|
|
44
|
-
text-align: left;
|
|
45
|
-
}
|
|
46
|
-
&__center {
|
|
47
|
-
text-align: center;
|
|
48
|
-
}
|
|
49
|
-
&__right {
|
|
50
|
-
text-align: right;
|
|
51
|
-
}
|
|
1
|
+
.r5ui-typography {
|
|
2
|
+
color: $page_text_color;
|
|
3
|
+
font-family: $title_font;
|
|
4
|
+
&__p {
|
|
5
|
+
font-family: $primary_font;
|
|
6
|
+
margin-bottom: 1em;
|
|
7
|
+
margin-top: .5em;
|
|
8
|
+
text-align: justify;
|
|
9
|
+
}
|
|
10
|
+
&__div {
|
|
11
|
+
font-family: $primary_font;
|
|
12
|
+
margin: 0;
|
|
13
|
+
display: inline-block;
|
|
14
|
+
text-align: justify;
|
|
15
|
+
}
|
|
16
|
+
&__h1 {
|
|
17
|
+
font-size: 2.5em;
|
|
18
|
+
font-weight: 500;
|
|
19
|
+
margin-bottom: .5em;
|
|
20
|
+
margin-top: .5em;
|
|
21
|
+
text-align: center;
|
|
22
|
+
}
|
|
23
|
+
@media (max-width: 800px) {
|
|
24
|
+
&__h1 {
|
|
25
|
+
font-size: 1.5em;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
&__h2 {
|
|
29
|
+
font-size: 2em;
|
|
30
|
+
font-weight: 500;
|
|
31
|
+
margin-bottom: .5em;
|
|
32
|
+
margin-top: .5em;
|
|
33
|
+
}
|
|
34
|
+
&__h3 {
|
|
35
|
+
font-size: 1.5em;
|
|
36
|
+
font-weight: 500;
|
|
37
|
+
margin-bottom: .5em;
|
|
38
|
+
margin-top: .5em;
|
|
39
|
+
text-align: center;
|
|
40
|
+
}
|
|
41
|
+
&__li {
|
|
42
|
+
}
|
|
43
|
+
&__left {
|
|
44
|
+
text-align: left;
|
|
45
|
+
}
|
|
46
|
+
&__center {
|
|
47
|
+
text-align: center;
|
|
48
|
+
}
|
|
49
|
+
&__right {
|
|
50
|
+
text-align: right;
|
|
51
|
+
}
|
|
52
52
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Typography } from './Typography';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Typography> = {
|
|
5
|
-
title: 'Example/Typography',
|
|
6
|
-
component: Typography,
|
|
7
|
-
} as Meta;
|
|
8
|
-
export default meta;
|
|
9
|
-
|
|
10
|
-
type Story = StoryObj<typeof Typography>;
|
|
11
|
-
|
|
12
|
-
export const HeadParagraph: Story = {
|
|
13
|
-
render: () => <Typography variant="h1">test</Typography>,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const TextParagraph: Story = {
|
|
17
|
-
render: () => <Typography>test text</Typography>,
|
|
18
|
-
};
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Typography } from './Typography';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Typography> = {
|
|
5
|
+
title: 'Example/Typography',
|
|
6
|
+
component: Typography,
|
|
7
|
+
} as Meta;
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof Typography>;
|
|
11
|
+
|
|
12
|
+
export const HeadParagraph: Story = {
|
|
13
|
+
render: () => <Typography variant="h1">test</Typography>,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const TextParagraph: Story = {
|
|
17
|
+
render: () => <Typography>test text</Typography>,
|
|
18
|
+
};
|