@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,45 +1,45 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Submenu } from './Submenu';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Submenu> = {
|
|
6
|
-
component: Submenu,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof Submenu>;
|
|
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
|
-
const items = [
|
|
18
|
-
{
|
|
19
|
-
label: 'Item 1',
|
|
20
|
-
value: 'item1',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
label: 'Item 2',
|
|
24
|
-
value: 'item2',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
label: 'Item 3',
|
|
28
|
-
value: 'item3',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
label: 'Item 4',
|
|
32
|
-
value: 'item4',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: 'Item 5',
|
|
36
|
-
value: 'item5',
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
export const Primary: Story = {
|
|
40
|
-
render: () => (
|
|
41
|
-
<div style={{ backgroundColor: '#333' }}>
|
|
42
|
-
<Submenu items={items} selectedItem={items[1]} />
|
|
43
|
-
</div>
|
|
44
|
-
),
|
|
45
|
-
};
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { Submenu } from './Submenu';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Submenu> = {
|
|
6
|
+
component: Submenu,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof Submenu>;
|
|
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
|
+
const items = [
|
|
18
|
+
{
|
|
19
|
+
label: 'Item 1',
|
|
20
|
+
value: 'item1',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: 'Item 2',
|
|
24
|
+
value: 'item2',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: 'Item 3',
|
|
28
|
+
value: 'item3',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: 'Item 4',
|
|
32
|
+
value: 'item4',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: 'Item 5',
|
|
36
|
+
value: 'item5',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
export const Primary: Story = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<div style={{ backgroundColor: '#333' }}>
|
|
42
|
+
<Submenu items={items} selectedItem={items[1]} />
|
|
43
|
+
</div>
|
|
44
|
+
),
|
|
45
|
+
};
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { useState, useRef, useEffect } from "react"
|
|
2
|
-
import './Submenu.scss'
|
|
3
|
-
import { bem } from '../../utils/bem';
|
|
4
|
-
import clsx from "clsx";
|
|
5
|
-
|
|
6
|
-
export interface ISubmenuItem {
|
|
7
|
-
label: string
|
|
8
|
-
value: string
|
|
9
|
-
}
|
|
10
|
-
export interface ISubmenuProps {
|
|
11
|
-
items: ISubmenuItem[]
|
|
12
|
-
selectedItem?: ISubmenuItem
|
|
13
|
-
className?: string
|
|
14
|
-
onChange?: (item: ISubmenuItem) => void
|
|
15
|
-
variant?: "primary" | "secondary"
|
|
16
|
-
}
|
|
17
|
-
const b = bem("submenu");
|
|
18
|
-
export const Submenu = ({items, selectedItem, variant="primary", onChange, className}: ISubmenuProps) => {
|
|
19
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
20
|
-
const dropdownRef: any = useRef(null);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
const handleClickOutside = (event: MouseEvent) => {
|
|
24
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
25
|
-
setIsOpen(false);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
29
|
-
return () => {
|
|
30
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
31
|
-
};
|
|
32
|
-
}, []);
|
|
33
|
-
|
|
34
|
-
const toggleDropdown = () => setIsOpen((prevIsOpen: boolean) => !prevIsOpen);
|
|
35
|
-
const handleChange = (item: ISubmenuItem) => () => {
|
|
36
|
-
onChange && onChange(item);
|
|
37
|
-
setIsOpen(false);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const listClass = b("list");
|
|
41
|
-
|
|
42
|
-
return (<div className={clsx(b(), className)} ref={dropdownRef}>
|
|
43
|
-
<button className={b("button")} onClick={toggleDropdown}>
|
|
44
|
-
{selectedItem?.label || ""}
|
|
45
|
-
<span className={clsx(b("indicator"), b(`indicator-${variant}`),
|
|
46
|
-
isOpen && b("indicator", "open"))}
|
|
47
|
-
/>
|
|
48
|
-
</button>
|
|
49
|
-
{isOpen && (
|
|
50
|
-
<ul className={listClass}>
|
|
51
|
-
{
|
|
52
|
-
items.map((c, i) => (
|
|
53
|
-
<li key={i} className={b("item")} onClick={handleChange(c)}>{c.label}</li>
|
|
54
|
-
))
|
|
55
|
-
}
|
|
56
|
-
</ul>
|
|
57
|
-
)}
|
|
58
|
-
</div>
|
|
59
|
-
)
|
|
1
|
+
import { useState, useRef, useEffect } from "react"
|
|
2
|
+
import './Submenu.scss'
|
|
3
|
+
import { bem } from '../../utils/bem';
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
|
|
6
|
+
export interface ISubmenuItem {
|
|
7
|
+
label: string
|
|
8
|
+
value: string
|
|
9
|
+
}
|
|
10
|
+
export interface ISubmenuProps {
|
|
11
|
+
items: ISubmenuItem[]
|
|
12
|
+
selectedItem?: ISubmenuItem
|
|
13
|
+
className?: string
|
|
14
|
+
onChange?: (item: ISubmenuItem) => void
|
|
15
|
+
variant?: "primary" | "secondary"
|
|
16
|
+
}
|
|
17
|
+
const b = bem("submenu");
|
|
18
|
+
export const Submenu = ({items, selectedItem, variant="primary", onChange, className}: ISubmenuProps) => {
|
|
19
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
20
|
+
const dropdownRef: any = useRef(null);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
24
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
25
|
+
setIsOpen(false);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
29
|
+
return () => {
|
|
30
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
const toggleDropdown = () => setIsOpen((prevIsOpen: boolean) => !prevIsOpen);
|
|
35
|
+
const handleChange = (item: ISubmenuItem) => () => {
|
|
36
|
+
onChange && onChange(item);
|
|
37
|
+
setIsOpen(false);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const listClass = b("list");
|
|
41
|
+
|
|
42
|
+
return (<div className={clsx(b(), className)} ref={dropdownRef}>
|
|
43
|
+
<button className={b("button")} onClick={toggleDropdown}>
|
|
44
|
+
{selectedItem?.label || ""}
|
|
45
|
+
<span className={clsx(b("indicator"), b(`indicator-${variant}`),
|
|
46
|
+
isOpen && b("indicator", "open"))}
|
|
47
|
+
/>
|
|
48
|
+
</button>
|
|
49
|
+
{isOpen && (
|
|
50
|
+
<ul className={listClass}>
|
|
51
|
+
{
|
|
52
|
+
items.map((c, i) => (
|
|
53
|
+
<li key={i} className={b("item")} onClick={handleChange(c)}>{c.label}</li>
|
|
54
|
+
))
|
|
55
|
+
}
|
|
56
|
+
</ul>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
)
|
|
60
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./Submenu"
|
|
1
|
+
export * from "./Submenu"
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
.r5ui-success-congratulation {
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
7
|
-
background-color: rgba(0, 0, 0, 0.7); // Slight backdrop overlay
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
z-index: 9999;
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
animation: fadeIn 1s ease-out;
|
|
15
|
-
text-align: center;
|
|
16
|
-
|
|
17
|
-
&__icon {
|
|
18
|
-
background-color: $success_text_color;
|
|
19
|
-
border-radius: 50%;
|
|
20
|
-
width: 80px;
|
|
21
|
-
height: 80px;
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
margin-bottom: 16px;
|
|
26
|
-
animation: bounceIn .8s ease-out;
|
|
27
|
-
}
|
|
28
|
-
&__favorite {
|
|
29
|
-
color: $success_color;
|
|
30
|
-
}
|
|
31
|
-
&__checkmark {
|
|
32
|
-
font-size: 48px;
|
|
33
|
-
color: $success_color;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&__message {
|
|
37
|
-
font-size: 1.25rem;
|
|
38
|
-
color: $menu_text_color;
|
|
39
|
-
animation: slideIn 1.2s ease-out;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Animations
|
|
44
|
-
@keyframes fadeIn {
|
|
45
|
-
from {
|
|
46
|
-
opacity: 0;
|
|
47
|
-
}
|
|
48
|
-
to {
|
|
49
|
-
opacity: 1;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@keyframes bounceIn {
|
|
54
|
-
0% {
|
|
55
|
-
transform: scale(0.3);
|
|
56
|
-
opacity: 0;
|
|
57
|
-
}
|
|
58
|
-
50% {
|
|
59
|
-
transform: scale(1.05);
|
|
60
|
-
opacity: 1;
|
|
61
|
-
}
|
|
62
|
-
100% {
|
|
63
|
-
transform: scale(1);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@keyframes slideIn {
|
|
68
|
-
from {
|
|
69
|
-
transform: translateY(20px);
|
|
70
|
-
opacity: 0;
|
|
71
|
-
}
|
|
72
|
-
to {
|
|
73
|
-
transform: translateY(0);
|
|
74
|
-
opacity: 1;
|
|
75
|
-
}
|
|
1
|
+
.r5ui-success-congratulation {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
background-color: rgba(0, 0, 0, 0.7); // Slight backdrop overlay
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
z-index: 9999;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
animation: fadeIn 1s ease-out;
|
|
15
|
+
text-align: center;
|
|
16
|
+
|
|
17
|
+
&__icon {
|
|
18
|
+
background-color: $success_text_color;
|
|
19
|
+
border-radius: 50%;
|
|
20
|
+
width: 80px;
|
|
21
|
+
height: 80px;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
margin-bottom: 16px;
|
|
26
|
+
animation: bounceIn .8s ease-out;
|
|
27
|
+
}
|
|
28
|
+
&__favorite {
|
|
29
|
+
color: $success_color;
|
|
30
|
+
}
|
|
31
|
+
&__checkmark {
|
|
32
|
+
font-size: 48px;
|
|
33
|
+
color: $success_color;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__message {
|
|
37
|
+
font-size: 1.25rem;
|
|
38
|
+
color: $menu_text_color;
|
|
39
|
+
animation: slideIn 1.2s ease-out;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Animations
|
|
44
|
+
@keyframes fadeIn {
|
|
45
|
+
from {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
}
|
|
48
|
+
to {
|
|
49
|
+
opacity: 1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes bounceIn {
|
|
54
|
+
0% {
|
|
55
|
+
transform: scale(0.3);
|
|
56
|
+
opacity: 0;
|
|
57
|
+
}
|
|
58
|
+
50% {
|
|
59
|
+
transform: scale(1.05);
|
|
60
|
+
opacity: 1;
|
|
61
|
+
}
|
|
62
|
+
100% {
|
|
63
|
+
transform: scale(1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@keyframes slideIn {
|
|
68
|
+
from {
|
|
69
|
+
transform: translateY(20px);
|
|
70
|
+
opacity: 0;
|
|
71
|
+
}
|
|
72
|
+
to {
|
|
73
|
+
transform: translateY(0);
|
|
74
|
+
opacity: 1;
|
|
75
|
+
}
|
|
76
76
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { SuccessCongratulation } from './SuccessCongratulation';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof SuccessCongratulation> = {
|
|
5
|
-
title: 'Example/SuccessCongratulation',
|
|
6
|
-
component: SuccessCongratulation,
|
|
7
|
-
argTypes: {
|
|
8
|
-
backgroundColor: { control: 'color' },
|
|
9
|
-
},
|
|
10
|
-
} as Meta;
|
|
11
|
-
export default meta;
|
|
12
|
-
|
|
13
|
-
type Story = StoryObj<typeof SuccessCongratulation>;
|
|
14
|
-
|
|
15
|
-
export const TextSuccessCongratulation: Story = {
|
|
16
|
-
render: () => <SuccessCongratulation/>,
|
|
17
|
-
};
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SuccessCongratulation } from './SuccessCongratulation';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof SuccessCongratulation> = {
|
|
5
|
+
title: 'Example/SuccessCongratulation',
|
|
6
|
+
component: SuccessCongratulation,
|
|
7
|
+
argTypes: {
|
|
8
|
+
backgroundColor: { control: 'color' },
|
|
9
|
+
},
|
|
10
|
+
} as Meta;
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof SuccessCongratulation>;
|
|
14
|
+
|
|
15
|
+
export const TextSuccessCongratulation: Story = {
|
|
16
|
+
render: () => <SuccessCongratulation/>,
|
|
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 { SuccessCongratulation } from './SuccessCongratulation';
|
|
5
|
-
|
|
6
|
-
describe('SuccessCongratulation Component', () => {
|
|
7
|
-
test('renders the button with the correct label', () => {
|
|
8
|
-
render(<SuccessCongratulation onContinue={jest.fn()} />);
|
|
9
|
-
const div = screen.getByRole('SuccessCongratulation', { name: /click me/i });
|
|
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 { SuccessCongratulation } from './SuccessCongratulation';
|
|
5
|
+
|
|
6
|
+
describe('SuccessCongratulation Component', () => {
|
|
7
|
+
test('renders the button with the correct label', () => {
|
|
8
|
+
render(<SuccessCongratulation onContinue={jest.fn()} />);
|
|
9
|
+
const div = screen.getByRole('SuccessCongratulation', { name: /click me/i });
|
|
10
|
+
expect(div).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
12
|
});
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import './SuccessCongratulation.scss'
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { bem } from '../../utils/bem';
|
|
4
|
-
import { Toolbar } from '../Toolbar';
|
|
5
|
-
import { IconButton } from '../IconButton';
|
|
6
|
-
import { FaBookmark, FaTrophy } from 'react-icons/fa6';
|
|
7
|
-
import { FormEvent, useEffect } from 'react';
|
|
8
|
-
|
|
9
|
-
interface SuccessCongratulationProps {
|
|
10
|
-
message?: string;
|
|
11
|
-
onContinue?: () => void;
|
|
12
|
-
onAddToFavorites?: () => void;
|
|
13
|
-
isFavorite?: boolean;
|
|
14
|
-
className?: string;
|
|
15
|
-
continueText?: string;
|
|
16
|
-
}
|
|
17
|
-
const b = bem("success-congratulation");
|
|
18
|
-
export const SuccessCongratulation = ({message = "Congratulations!",
|
|
19
|
-
onContinue, onAddToFavorites, isFavorite, className, continueText = "Continue"}: SuccessCongratulationProps) => {
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
23
|
-
if (["Escape", "Enter", " "].includes(event.key)) {
|
|
24
|
-
event.preventDefault();
|
|
25
|
-
onContinue?.();
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
window.addEventListener("keydown", handleKeyDown, false);
|
|
30
|
-
return () => {
|
|
31
|
-
window.removeEventListener("keydown", handleKeyDown);
|
|
32
|
-
};
|
|
33
|
-
}, [onContinue]);
|
|
34
|
-
|
|
35
|
-
const handleClick = () => {
|
|
36
|
-
onContinue?.();
|
|
37
|
-
};
|
|
38
|
-
const handleAddToFavorites = (e?: FormEvent) => {
|
|
39
|
-
e?.stopPropagation();
|
|
40
|
-
onAddToFavorites?.();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div
|
|
45
|
-
className={clsx(b(), className)}
|
|
46
|
-
onClick={handleClick}
|
|
47
|
-
tabIndex={0}
|
|
48
|
-
role="button"
|
|
49
|
-
//onAnimationEnd={onAnimationEnd}
|
|
50
|
-
>
|
|
51
|
-
<div className={b("icon")}>
|
|
52
|
-
<FaTrophy className=
|
|
53
|
-
</div>
|
|
54
|
-
<p className={b("message")}>{message}</p>
|
|
55
|
-
<Toolbar>
|
|
56
|
-
<IconButton variant='rounded' onClick={onContinue}>{continueText}</IconButton>
|
|
57
|
-
<IconButton variant='round-outlined' onClick={handleAddToFavorites}>
|
|
58
|
-
<FaBookmark className={clsx(isFavorite && b("favorite"))}/>
|
|
59
|
-
</IconButton>
|
|
60
|
-
</Toolbar>
|
|
61
|
-
</div>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
1
|
+
import './SuccessCongratulation.scss'
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { bem } from '../../utils/bem';
|
|
4
|
+
import { Toolbar } from '../Toolbar';
|
|
5
|
+
import { IconButton } from '../IconButton';
|
|
6
|
+
import { FaBookmark, FaTrophy } from 'react-icons/fa6';
|
|
7
|
+
import { FormEvent, useEffect } from 'react';
|
|
8
|
+
|
|
9
|
+
interface SuccessCongratulationProps {
|
|
10
|
+
message?: string;
|
|
11
|
+
onContinue?: () => void;
|
|
12
|
+
onAddToFavorites?: () => void;
|
|
13
|
+
isFavorite?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
continueText?: string;
|
|
16
|
+
}
|
|
17
|
+
const b = bem("success-congratulation");
|
|
18
|
+
export const SuccessCongratulation = ({message = "Congratulations!",
|
|
19
|
+
onContinue, onAddToFavorites, isFavorite, className, continueText = "Continue"}: SuccessCongratulationProps) => {
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
23
|
+
if (["Escape", "Enter", " "].includes(event.key)) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
onContinue?.();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
window.addEventListener("keydown", handleKeyDown, false);
|
|
30
|
+
return () => {
|
|
31
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
32
|
+
};
|
|
33
|
+
}, [onContinue]);
|
|
34
|
+
|
|
35
|
+
const handleClick = () => {
|
|
36
|
+
onContinue?.();
|
|
37
|
+
};
|
|
38
|
+
const handleAddToFavorites = (e?: FormEvent) => {
|
|
39
|
+
e?.stopPropagation();
|
|
40
|
+
onAddToFavorites?.();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
className={clsx(b(), className)}
|
|
46
|
+
onClick={handleClick}
|
|
47
|
+
tabIndex={0}
|
|
48
|
+
role="button"
|
|
49
|
+
//onAnimationEnd={onAnimationEnd}
|
|
50
|
+
>
|
|
51
|
+
<div className={b("icon")}>
|
|
52
|
+
<FaTrophy className="checkmark"/>
|
|
53
|
+
</div>
|
|
54
|
+
<p className={b("message")}>{message}</p>
|
|
55
|
+
<Toolbar>
|
|
56
|
+
<IconButton variant='rounded' onClick={onContinue}>{continueText}</IconButton>
|
|
57
|
+
<IconButton variant='round-outlined' onClick={handleAddToFavorites}>
|
|
58
|
+
<FaBookmark className={clsx(isFavorite && b("favorite"))}/>
|
|
59
|
+
</IconButton>
|
|
60
|
+
</Toolbar>
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
64
|
export default SuccessCongratulation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./SuccessCongratulation";
|
|
1
|
+
export * from "./SuccessCongratulation";
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
.r5ui-text-area {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
|
|
6
|
-
margin: 0.5em;
|
|
7
|
-
|
|
8
|
-
&__label {
|
|
9
|
-
flex: 40%;
|
|
10
|
-
padding: 3px;
|
|
11
|
-
color: $page_text_color;
|
|
12
|
-
align-self: start;
|
|
13
|
-
margin-right: 0.5em;
|
|
14
|
-
&--left {
|
|
15
|
-
text-align: left;
|
|
16
|
-
}
|
|
17
|
-
&--center {
|
|
18
|
-
text-align: center;
|
|
19
|
-
}
|
|
20
|
-
&--right {
|
|
21
|
-
text-align: right;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
&__input {
|
|
25
|
-
flex: 60%;
|
|
26
|
-
border: $border_size solid $primary_border_color;
|
|
27
|
-
border-radius: $border_radius;
|
|
28
|
-
color: $control_text_color;
|
|
29
|
-
background-color: $control_bg_color;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&__wrapper {
|
|
33
|
-
display: flex;
|
|
34
|
-
justify-content: space-between;
|
|
35
|
-
flex-direction: row;
|
|
36
|
-
width: 100%;
|
|
37
|
-
}
|
|
38
|
-
&__error-container {
|
|
39
|
-
text-align: right;
|
|
40
|
-
color: $error_validation_color;
|
|
41
|
-
}
|
|
1
|
+
.r5ui-text-area {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
|
|
6
|
+
margin: 0.5em;
|
|
7
|
+
|
|
8
|
+
&__label {
|
|
9
|
+
flex: 40%;
|
|
10
|
+
padding: 3px;
|
|
11
|
+
color: $page_text_color;
|
|
12
|
+
align-self: start;
|
|
13
|
+
margin-right: 0.5em;
|
|
14
|
+
&--left {
|
|
15
|
+
text-align: left;
|
|
16
|
+
}
|
|
17
|
+
&--center {
|
|
18
|
+
text-align: center;
|
|
19
|
+
}
|
|
20
|
+
&--right {
|
|
21
|
+
text-align: right;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
&__input {
|
|
25
|
+
flex: 60%;
|
|
26
|
+
border: $border_size solid $primary_border_color;
|
|
27
|
+
border-radius: $border_radius;
|
|
28
|
+
color: $control_text_color;
|
|
29
|
+
background-color: $control_bg_color;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__wrapper {
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
&__error-container {
|
|
39
|
+
text-align: right;
|
|
40
|
+
color: $error_validation_color;
|
|
41
|
+
}
|
|
42
42
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { TextArea } from './TextArea';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof TextArea> = {
|
|
5
|
-
title: 'Example/TextArea',
|
|
6
|
-
component: TextArea,
|
|
7
|
-
} as Meta;
|
|
8
|
-
export default meta;
|
|
9
|
-
|
|
10
|
-
type Story = StoryObj<typeof TextArea>;
|
|
11
|
-
|
|
12
|
-
export const TextButton: Story = {
|
|
13
|
-
render: () => <TextArea value="test" name="tf1" />,
|
|
14
|
-
};
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { TextArea } from './TextArea';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof TextArea> = {
|
|
5
|
+
title: 'Example/TextArea',
|
|
6
|
+
component: TextArea,
|
|
7
|
+
} as Meta;
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof TextArea>;
|
|
11
|
+
|
|
12
|
+
export const TextButton: Story = {
|
|
13
|
+
render: () => <TextArea value="test" name="tf1" />,
|
|
14
|
+
};
|