@react5/ui 1.0.11 → 1.0.12

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.
Files changed (181) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2 -2
  3. package/package.json +38 -38
  4. package/packages/app/README.md +50 -50
  5. package/packages/app/eslint.config.js +28 -28
  6. package/packages/app/index.html +13 -13
  7. package/packages/app/jest.config.js +12 -12
  8. package/packages/app/package.json +36 -36
  9. package/packages/app/src/App.css +5 -5
  10. package/packages/app/src/App.tsx +35 -35
  11. package/packages/app/src/i18n/config.ts +21 -21
  12. package/packages/app/src/i18n/en/translation.json +4 -4
  13. package/packages/app/src/i18n/fr/translation.json +4 -4
  14. package/packages/app/src/i18n/index.ts +3 -3
  15. package/packages/app/src/main.tsx +16 -16
  16. package/packages/app/src/styles/1-reset.scss +72 -72
  17. package/packages/app/src/styles/2-colors.scss +11 -11
  18. package/packages/app/src/vite-env.d.ts +1 -1
  19. package/packages/app/tsconfig.app.json +26 -26
  20. package/packages/app/tsconfig.json +7 -7
  21. package/packages/app/tsconfig.node.json +24 -24
  22. package/packages/app/vite.config.ts +7 -7
  23. package/packages/lib/.babelrc +9 -9
  24. package/packages/lib/.storybook/main.js +50 -50
  25. package/packages/lib/.storybook/preview.js +13 -13
  26. package/packages/lib/declaration.d.ts +9 -9
  27. package/packages/lib/dist/esm/index.esm.scss +1326 -1326
  28. package/packages/lib/dist/index.scss +1326 -1326
  29. package/packages/lib/dist/types/hooks/use-form.d.ts +1 -1
  30. package/packages/lib/dist/types/hooks/use-form.d.ts.map +1 -1
  31. package/packages/lib/jest.config.js +19 -19
  32. package/packages/lib/package.json +110 -110
  33. package/packages/lib/plop/component/index.js +43 -43
  34. package/packages/lib/plop/index.js +3 -3
  35. package/packages/lib/plop/templates/component/component.hbs +19 -19
  36. package/packages/lib/plop/templates/component/index.hbs +1 -1
  37. package/packages/lib/plop/templates/component/stories.hbs +17 -17
  38. package/packages/lib/plop/templates/component/style.hbs +1 -1
  39. package/packages/lib/plop/templates/component/test.hbs +11 -11
  40. package/packages/lib/plopfile.js +1 -1
  41. package/packages/lib/rollup.config.mjs +64 -64
  42. package/packages/lib/src/components/Accordion/Accordion.scss +67 -67
  43. package/packages/lib/src/components/Accordion/Accordion.tsx +36 -36
  44. package/packages/lib/src/components/Button/Button.scss +42 -42
  45. package/packages/lib/src/components/Button/Button.stories.tsx +26 -26
  46. package/packages/lib/src/components/Button/Button.tsx +40 -40
  47. package/packages/lib/src/components/Button/index.tsx +1 -1
  48. package/packages/lib/src/components/ButtonsGroup/ButtonsGroup.scss +3 -3
  49. package/packages/lib/src/components/ButtonsGroup/ButtonsGroup.stories.tsx +17 -17
  50. package/packages/lib/src/components/ButtonsGroup/ButtonsGroup.test.tsx +11 -11
  51. package/packages/lib/src/components/ButtonsGroup/ButtonsGroup.tsx +17 -17
  52. package/packages/lib/src/components/ButtonsGroup/index.tsx +1 -1
  53. package/packages/lib/src/components/CheckBox/CheckBox.scss +63 -63
  54. package/packages/lib/src/components/CheckBox/CheckBox.stories.tsx +22 -22
  55. package/packages/lib/src/components/CheckBox/CheckBox.tsx +42 -42
  56. package/packages/lib/src/components/CheckBox/index.tsx +1 -1
  57. package/packages/lib/src/components/DialogPrompt/DialogPrompt.scss +6 -6
  58. package/packages/lib/src/components/DialogPrompt/DialogPrompt.stories.tsx +17 -17
  59. package/packages/lib/src/components/DialogPrompt/DialogPrompt.test.tsx +11 -11
  60. package/packages/lib/src/components/DialogPrompt/DialogPrompt.tsx +41 -41
  61. package/packages/lib/src/components/DialogPrompt/index.tsx +1 -1
  62. package/packages/lib/src/components/Divider/Divider.scss +22 -22
  63. package/packages/lib/src/components/Divider/Divider.tsx +20 -20
  64. package/packages/lib/src/components/DropDown/DropDown.scss +70 -70
  65. package/packages/lib/src/components/DropDown/DropDown.stories.tsx +45 -45
  66. package/packages/lib/src/components/DropDown/DropDown.tsx +61 -61
  67. package/packages/lib/src/components/DropDown/index.tsx +1 -1
  68. package/packages/lib/src/components/Form/Form.scss +3 -3
  69. package/packages/lib/src/components/Form/Form.stories.tsx +20 -20
  70. package/packages/lib/src/components/Form/Form.tsx +25 -25
  71. package/packages/lib/src/components/FormButtons/FormButtons.scss +5 -5
  72. package/packages/lib/src/components/FormButtons/FormButtons.tsx +18 -18
  73. package/packages/lib/src/components/IconButton/IconButton.scss +64 -64
  74. package/packages/lib/src/components/IconButton/IconButton.tsx +44 -44
  75. package/packages/lib/src/components/MenuItem/MenuItem.scss +13 -13
  76. package/packages/lib/src/components/MenuItem/MenuItem.tsx +36 -36
  77. package/packages/lib/src/components/Modal/Modal.scss +71 -71
  78. package/packages/lib/src/components/Modal/Modal.tsx +60 -60
  79. package/packages/lib/src/components/Navbar/Navbar.scss +52 -52
  80. package/packages/lib/src/components/Navbar/Navbar.stories.tsx +25 -25
  81. package/packages/lib/src/components/Navbar/Navbar.tsx +38 -38
  82. package/packages/lib/src/components/NavbarLink/NavbarLink.scss +15 -15
  83. package/packages/lib/src/components/NavbarLink/NavbarLink.tsx +34 -34
  84. package/packages/lib/src/components/NavbarMenu/NavbarMenu.scss +156 -156
  85. package/packages/lib/src/components/NavbarMenu/NavbarMenu.stories.tsx +24 -24
  86. package/packages/lib/src/components/NavbarMenu/NavbarMenu.tsx +72 -72
  87. package/packages/lib/src/components/Panel/Panel.scss +4 -4
  88. package/packages/lib/src/components/Panel/Panel.stories.tsx +17 -17
  89. package/packages/lib/src/components/Panel/Panel.test.tsx +11 -11
  90. package/packages/lib/src/components/Panel/Panel.tsx +18 -18
  91. package/packages/lib/src/components/Panel/index.tsx +1 -1
  92. package/packages/lib/src/components/Paper/Paper.scss +5 -5
  93. package/packages/lib/src/components/Paper/Paper.stories.tsx +18 -18
  94. package/packages/lib/src/components/Paper/Paper.tsx +18 -18
  95. package/packages/lib/src/components/Paper/index.tsx +1 -1
  96. package/packages/lib/src/components/RangeSlider/RangeSlider.scss +83 -83
  97. package/packages/lib/src/components/RangeSlider/RangeSlider.stories.tsx +24 -24
  98. package/packages/lib/src/components/RangeSlider/RangeSlider.tsx +150 -150
  99. package/packages/lib/src/components/ResponsiveBar/ResponsiveBar.scss +72 -72
  100. package/packages/lib/src/components/ResponsiveBar/ResponsiveBar.tsx +38 -38
  101. package/packages/lib/src/components/ScrollView/ScrollView.scss +20 -20
  102. package/packages/lib/src/components/ScrollView/ScrollView.stories.tsx +17 -17
  103. package/packages/lib/src/components/ScrollView/ScrollView.test.tsx +11 -11
  104. package/packages/lib/src/components/ScrollView/ScrollView.tsx +19 -19
  105. package/packages/lib/src/components/ScrollView/index.tsx +1 -1
  106. package/packages/lib/src/components/Section/Section.scss +17 -17
  107. package/packages/lib/src/components/Section/Section.tsx +26 -26
  108. package/packages/lib/src/components/SelectField/SelectField.scss +33 -33
  109. package/packages/lib/src/components/SelectField/SelectField.stories.tsx +14 -14
  110. package/packages/lib/src/components/SelectField/SelectField.tsx +53 -53
  111. package/packages/lib/src/components/SelectField/index.tsx +1 -1
  112. package/packages/lib/src/components/Spacer/Spacer.scss +2 -2
  113. package/packages/lib/src/components/Spacer/Spacer.tsx +6 -6
  114. package/packages/lib/src/components/StackPanel/StackPanel.scss +8 -8
  115. package/packages/lib/src/components/StackPanel/StackPanel.stories.tsx +17 -17
  116. package/packages/lib/src/components/StackPanel/StackPanel.test.tsx +11 -11
  117. package/packages/lib/src/components/StackPanel/StackPanel.tsx +31 -31
  118. package/packages/lib/src/components/StackPanel/index.tsx +1 -1
  119. package/packages/lib/src/components/Submenu/Submenu.scss +55 -55
  120. package/packages/lib/src/components/Submenu/Submenu.stories.tsx +45 -45
  121. package/packages/lib/src/components/Submenu/Submenu.tsx +59 -59
  122. package/packages/lib/src/components/Submenu/index.tsx +1 -1
  123. package/packages/lib/src/components/SuccessCongratulation/SuccessCongratulation.scss +75 -75
  124. package/packages/lib/src/components/SuccessCongratulation/SuccessCongratulation.stories.tsx +17 -17
  125. package/packages/lib/src/components/SuccessCongratulation/SuccessCongratulation.test.tsx +11 -11
  126. package/packages/lib/src/components/SuccessCongratulation/SuccessCongratulation.tsx +63 -63
  127. package/packages/lib/src/components/SuccessCongratulation/index.tsx +1 -1
  128. package/packages/lib/src/components/TextArea/TextArea.scss +33 -33
  129. package/packages/lib/src/components/TextArea/TextArea.stories.tsx +14 -14
  130. package/packages/lib/src/components/TextArea/TextArea.tsx +49 -49
  131. package/packages/lib/src/components/TextArea/index.tsx +1 -1
  132. package/packages/lib/src/components/TextField/TextField.scss +48 -48
  133. package/packages/lib/src/components/TextField/TextField.stories.tsx +14 -14
  134. package/packages/lib/src/components/TextField/TextField.tsx +86 -86
  135. package/packages/lib/src/components/TextField/index.tsx +1 -1
  136. package/packages/lib/src/components/TitleEdit/TitleEdit.scss +17 -17
  137. package/packages/lib/src/components/TitleEdit/TitleEdit.tsx +69 -69
  138. package/packages/lib/src/components/Toast/Toast.scss +32 -32
  139. package/packages/lib/src/components/Toast/Toast.tsx +29 -29
  140. package/packages/lib/src/components/ToggleButton/ToggleButton.scss +47 -47
  141. package/packages/lib/src/components/ToggleButton/ToggleButton.stories.tsx +22 -22
  142. package/packages/lib/src/components/ToggleButton/ToggleButton.tsx +41 -41
  143. package/packages/lib/src/components/ToggleButton/index.tsx +1 -1
  144. package/packages/lib/src/components/Toolbar/Toolbar.scss +16 -16
  145. package/packages/lib/src/components/Toolbar/Toolbar.stories.tsx +17 -17
  146. package/packages/lib/src/components/Toolbar/Toolbar.test.tsx +11 -11
  147. package/packages/lib/src/components/Toolbar/Toolbar.tsx +20 -20
  148. package/packages/lib/src/components/Toolbar/index.tsx +1 -1
  149. package/packages/lib/src/components/Typography/Typography.scss +51 -51
  150. package/packages/lib/src/components/Typography/Typography.stories.tsx +18 -18
  151. package/packages/lib/src/components/Typography/Typography.tsx +19 -19
  152. package/packages/lib/src/components/index.tsx +33 -33
  153. package/packages/lib/src/hooks/index.tsx +3 -3
  154. package/packages/lib/src/hooks/use-click-outside.tsx +19 -19
  155. package/packages/lib/src/hooks/use-form.tsx +107 -107
  156. package/packages/lib/src/hooks/use-keys-enteresc.tsx +25 -25
  157. package/packages/lib/src/hooks/use-set-startup-focus.tsx +8 -8
  158. package/packages/lib/src/i18n/config.ts +8 -8
  159. package/packages/lib/src/i18n/en/translation.json +11 -11
  160. package/packages/lib/src/i18n/fr/translation.json +11 -11
  161. package/packages/lib/src/i18n/index.ts +11 -11
  162. package/packages/lib/src/index.tsx +7 -7
  163. package/packages/lib/src/stories/Intrduction.mdx +175 -175
  164. package/packages/lib/src/stories/assets/github.svg +3 -3
  165. package/packages/lib/src/styles/1-color-vars.scss +50 -50
  166. package/packages/lib/src/styles/2-font-variables.scss +2 -2
  167. package/packages/lib/src/styles/variables.scss +1 -1
  168. package/packages/lib/src/test/i18n.ts +17 -17
  169. package/packages/lib/src/utils/bem.ts +4 -4
  170. package/packages/lib/src/utils/formatError.ts +5 -5
  171. package/packages/lib/src/utils/index.ts +1 -1
  172. package/packages/lib/src/utils/interfaces.ts +5 -5
  173. package/packages/lib/tsconfig.json +25 -25
  174. package/packages/lib/vite.config.js +18 -18
  175. package/packages/ui-test/package-lock.json +97 -97
  176. package/packages/ui-test/package.json +19 -19
  177. package/packages/ui-test/playwright.config.ts +80 -80
  178. package/packages/ui-test/tests/example.spec.ts +18 -18
  179. package/packages/ui-test/tests-examples/demo-todo-app.spec.ts +437 -437
  180. package/packages/lib/dist/esm/index.esm.js.map +0 -1
  181. package/packages/lib/dist/index.js.map +0 -1
@@ -1,72 +1,72 @@
1
- .r5ui-responsive-bar {
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-wrap: nowrap;
12
- overflow: hidden;
13
- }
14
- &__item {
15
- margin: 0;
16
- display: flex;
17
- align-items: center;
18
- flex-shrink: 0;
19
- }
20
- &__expand-button {
21
- display: none;
22
- align-items: center;
23
- border: none;
24
- border-radius: 2em;
25
- height: 2em;
26
- width: 2em;
27
- padding: 0;
28
- margin-top: 0.5em;
29
- flex-direction: row;
30
- align-items: center;
31
- justify-content: center;
32
- background-color: $menu_bg_color;
33
- color: $menu_text_color;
34
- cursor: pointer;
35
- &:hover {
36
- color: $primary_text_color_highlight;
37
- }
38
- }
39
- // &__expand-button {
40
- // margin: 0;
41
- // padding: 0;
42
- // display: none;
43
- // background: none;
44
- // border: $border_size solid $primary_border_color;
45
- // border-radius: $border_radius;
46
- // width: 36px;
47
- // height: 36px;
48
- // cursor: pointer;
49
- // color: $menu_text_color;
50
- // flex-direction: row;
51
- // align-items: center;
52
- // justify-content: center;
53
- // }
54
- }
55
-
56
- @media (max-width: 920px) {
57
- .responsive-bar {
58
- flex-direction: column;
59
- &__container {
60
- display: none;
61
- flex-direction: column;
62
- &--open {
63
- display: flex;
64
- align-items: end;
65
- }
66
- }
67
- &__expand-button {
68
- display: flex;
69
- }
70
- }
71
- }
72
-
1
+ .r5ui-responsive-bar {
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-wrap: nowrap;
12
+ overflow: hidden;
13
+ }
14
+ &__item {
15
+ margin: 0;
16
+ display: flex;
17
+ align-items: center;
18
+ flex-shrink: 0;
19
+ }
20
+ &__expand-button {
21
+ display: none;
22
+ align-items: center;
23
+ border: none;
24
+ border-radius: 2em;
25
+ height: 2em;
26
+ width: 2em;
27
+ padding: 0;
28
+ margin-top: 0.5em;
29
+ flex-direction: row;
30
+ align-items: center;
31
+ justify-content: center;
32
+ background-color: $menu_bg_color;
33
+ color: $menu_text_color;
34
+ cursor: pointer;
35
+ &:hover {
36
+ color: $primary_text_color_highlight;
37
+ }
38
+ }
39
+ // &__expand-button {
40
+ // margin: 0;
41
+ // padding: 0;
42
+ // display: none;
43
+ // background: none;
44
+ // border: $border_size solid $primary_border_color;
45
+ // border-radius: $border_radius;
46
+ // width: 36px;
47
+ // height: 36px;
48
+ // cursor: pointer;
49
+ // color: $menu_text_color;
50
+ // flex-direction: row;
51
+ // align-items: center;
52
+ // justify-content: center;
53
+ // }
54
+ }
55
+
56
+ @media (max-width: 920px) {
57
+ .responsive-bar {
58
+ flex-direction: column;
59
+ &__container {
60
+ display: none;
61
+ flex-direction: column;
62
+ &--open {
63
+ display: flex;
64
+ align-items: end;
65
+ }
66
+ }
67
+ &__expand-button {
68
+ display: flex;
69
+ }
70
+ }
71
+ }
72
+
@@ -1,39 +1,39 @@
1
- import { ReactNode, Children, useState, useEffect, useRef } from "react"
2
- import './ResponsiveBar.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 IResponsiveBarProps {
9
- children: ReactNode
10
- className?: string
11
- expandClassName?: string
12
- icon?: ReactNode
13
- }
14
- const b = bem("responsive-bar");
15
- export const ResponsiveBar = ({children, className, expandClassName, icon = <FaBars/>}: IResponsiveBarProps) => {
16
- const [isOpen, setIsOpen] = useState(false);
17
- const buttonRef = useRef<HTMLButtonElement | null>(null);
18
- const dropdownRef = useRef<HTMLUListElement | null>(null);
19
- useClickOutside([buttonRef, dropdownRef], () => setIsOpen(false));
20
-
21
- const toggleDropdown = () => setIsOpen((prevIsOpen: boolean) => !prevIsOpen);
22
- return (<nav className={clsx(b(), className)}>
23
- <button
24
- className={clsx(b("expand-button"), expandClassName)}
25
- onClick={toggleDropdown}
26
- ref={buttonRef}>{icon}</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, useEffect, useRef } from "react"
2
+ import './ResponsiveBar.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 IResponsiveBarProps {
9
+ children: ReactNode
10
+ className?: string
11
+ expandClassName?: string
12
+ icon?: ReactNode
13
+ }
14
+ const b = bem("responsive-bar");
15
+ export const ResponsiveBar = ({children, className, expandClassName, icon = <FaBars/>}: IResponsiveBarProps) => {
16
+ const [isOpen, setIsOpen] = useState(false);
17
+ const buttonRef = useRef<HTMLButtonElement | null>(null);
18
+ const dropdownRef = useRef<HTMLUListElement | null>(null);
19
+ useClickOutside([buttonRef, dropdownRef], () => setIsOpen(false));
20
+
21
+ const toggleDropdown = () => setIsOpen((prevIsOpen: boolean) => !prevIsOpen);
22
+ return (<nav className={clsx(b(), className)}>
23
+ <button
24
+ className={clsx(b("expand-button"), expandClassName)}
25
+ onClick={toggleDropdown}
26
+ ref={buttonRef}>{icon}</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,21 +1,21 @@
1
- .r5ui-scroll-view {
2
- display: flex;
3
- height: 100%;
4
- width: 100%;
5
- padding: 0;
6
- margin: 0;
7
- border: none;
8
- background-color: transparent;
9
- -webkit-overflow-scrolling: touch;
10
-
11
- &__vertical {
12
- flex-direction: column;
13
- overflow-y: auto;
14
- overflow-x: hidden;
15
- }
16
- &__horizontal {
17
- flex-direction: row;
18
- overflow-x: auto;
19
- overflow-y: hidden;
20
- }
1
+ .r5ui-scroll-view {
2
+ display: flex;
3
+ height: 100%;
4
+ width: 100%;
5
+ padding: 0;
6
+ margin: 0;
7
+ border: none;
8
+ background-color: transparent;
9
+ -webkit-overflow-scrolling: touch;
10
+
11
+ &__vertical {
12
+ flex-direction: column;
13
+ overflow-y: auto;
14
+ overflow-x: hidden;
15
+ }
16
+ &__horizontal {
17
+ flex-direction: row;
18
+ overflow-x: auto;
19
+ overflow-y: hidden;
20
+ }
21
21
  }
@@ -1,17 +1,17 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { ScrollView } from './ScrollView';
3
-
4
- const meta: Meta<typeof ScrollView> = {
5
- title: 'Example/ScrollView',
6
- component: ScrollView,
7
- argTypes: {
8
- backgroundColor: { control: 'color' },
9
- },
10
- } as Meta;
11
- export default meta;
12
-
13
- type Story = StoryObj<typeof ScrollView>;
14
-
15
- export const TextScrollView: Story = {
16
- render: () => <ScrollView>Test</ScrollView>,
17
- };
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { ScrollView } from './ScrollView';
3
+
4
+ const meta: Meta<typeof ScrollView> = {
5
+ title: 'Example/ScrollView',
6
+ component: ScrollView,
7
+ argTypes: {
8
+ backgroundColor: { control: 'color' },
9
+ },
10
+ } as Meta;
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof ScrollView>;
14
+
15
+ export const TextScrollView: Story = {
16
+ render: () => <ScrollView>Test</ScrollView>,
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 { ScrollView } from './ScrollView';
5
-
6
- describe('ScrollView Component', () => {
7
- test('renders the button with the correct label', () => {
8
- render(<ScrollView>test</ScrollView>);
9
- const div = screen.getByRole('ScrollView', { 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 { ScrollView } from './ScrollView';
5
+
6
+ describe('ScrollView Component', () => {
7
+ test('renders the button with the correct label', () => {
8
+ render(<ScrollView>test</ScrollView>);
9
+ const div = screen.getByRole('ScrollView', { name: /click me/i });
10
+ expect(div).toBeInTheDocument();
11
+ });
12
12
  });
@@ -1,19 +1,19 @@
1
- import { ReactNode } from 'react';
2
- import './ScrollView.scss'
3
- import clsx from 'clsx';
4
- import { bem } from '../../utils/bem';
5
-
6
- interface ScrollViewProps {
7
- className?: string;
8
- children: ReactNode;
9
- orientation?: "vertical" | "horizontal";
10
- }
11
- const b = bem("scroll-view");
12
- export const ScrollView = ({children, className, orientation = "vertical"}: ScrollViewProps) => {
13
- return (
14
- <div className={clsx(b(), b(orientation), className)}>
15
- {children}
16
- </div>
17
- )
18
- }
19
- export default ScrollView
1
+ import { ReactNode } from 'react';
2
+ import './ScrollView.scss'
3
+ import clsx from 'clsx';
4
+ import { bem } from '../../utils/bem';
5
+
6
+ interface ScrollViewProps {
7
+ className?: string;
8
+ children: ReactNode;
9
+ orientation?: "vertical" | "horizontal";
10
+ }
11
+ const b = bem("scroll-view");
12
+ export const ScrollView = ({children, className, orientation = "vertical"}: ScrollViewProps) => {
13
+ return (
14
+ <div className={clsx(b(), b(orientation), className)}>
15
+ {children}
16
+ </div>
17
+ )
18
+ }
19
+ export default ScrollView
@@ -1 +1 @@
1
- export * from "./ScrollView";
1
+ export * from "./ScrollView";
@@ -1,18 +1,18 @@
1
- .r5ui-section {
2
- display: flex;
3
- flex-direction: row;
4
- &__fields {
5
- margin: 0.5em;
6
- display: flex;
7
- flex-direction: column;
8
- width: 100%;
9
- }
10
- &__with-border {
11
- border: 1px solid $primary_border_color;
12
- border-radius: $border_radius;
13
- padding: 0.5em;
14
- }
15
- &__actions {
16
- width: 32px;
17
- }
1
+ .r5ui-section {
2
+ display: flex;
3
+ flex-direction: row;
4
+ &__fields {
5
+ margin: 0.5em;
6
+ display: flex;
7
+ flex-direction: column;
8
+ width: 100%;
9
+ }
10
+ &__with-border {
11
+ border: 1px solid $primary_border_color;
12
+ border-radius: $border_radius;
13
+ padding: 0.5em;
14
+ }
15
+ &__actions {
16
+ width: 32px;
17
+ }
18
18
  }
@@ -1,26 +1,26 @@
1
- import './Section.scss'
2
- import { bem } from '../../utils/bem';
3
- import { ReactNode } from 'react';
4
- import { IconButton } from '../IconButton';
5
- import { FaXmark } from 'react-icons/fa6'
6
- import clsx from 'clsx';
7
- export interface ISectionProps {
8
- children: ReactNode;
9
- onClose?: () => void;
10
- isVisible?: boolean;
11
- noBorder?: boolean;
12
- }
13
- const b = bem("section");
14
- export const Section = ({ children, onClose, noBorder }: ISectionProps) => {
15
- return (
16
- <div className={b()}>
17
- <div className={clsx(b("fields"), !noBorder && b("with-border"))}>
18
- {children}
19
- </div>
20
- {onClose && <div className={b("actions")}>
21
- <IconButton onClick={onClose}><FaXmark/></IconButton>
22
- </div>}
23
- </div>
24
- )
25
- }
26
- export default Section
1
+ import './Section.scss'
2
+ import { bem } from '../../utils/bem';
3
+ import { ReactNode } from 'react';
4
+ import { IconButton } from '../IconButton';
5
+ import { FaXmark } from 'react-icons/fa6'
6
+ import clsx from 'clsx';
7
+ export interface ISectionProps {
8
+ children: ReactNode;
9
+ onClose?: () => void;
10
+ isVisible?: boolean;
11
+ noBorder?: boolean;
12
+ }
13
+ const b = bem("section");
14
+ export const Section = ({ children, onClose, noBorder }: ISectionProps) => {
15
+ return (
16
+ <div className={b()}>
17
+ <div className={clsx(b("fields"), !noBorder && b("with-border"))}>
18
+ {children}
19
+ </div>
20
+ {onClose && <div className={b("actions")}>
21
+ <IconButton onClick={onClose}><FaXmark/></IconButton>
22
+ </div>}
23
+ </div>
24
+ )
25
+ }
26
+ export default Section
@@ -1,34 +1,34 @@
1
- .r5ui-select-field {
2
- display: flex;
3
- flex-direction: column;
4
- align-items: center;
5
- justify-content: center;
6
-
7
- margin: 0.5em;
8
-
9
- &__label {
10
- flex: 40%;
11
- padding: 3px;
12
- color: $page_text_color;
13
- align-self: center;
14
- margin-right: 0.5em;
15
- }
16
- &__input {
17
- flex: 60%;
18
- border: $border_size solid $primary_border_color;
19
- border-radius: $border_radius;
20
- color: $control_text_color;
21
- background-color: $control_bg_color;
22
- }
23
-
24
- &__wrapper {
25
- display: flex;
26
- justify-content: space-between;
27
- flex-direction: row;
28
- width: 100%;
29
- }
30
- &__error-container {
31
- text-align: right;
32
- color: $error_validation_color;
33
- }
1
+ .r5ui-select-field {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: center;
5
+ justify-content: center;
6
+
7
+ margin: 0.5em;
8
+
9
+ &__label {
10
+ flex: 40%;
11
+ padding: 3px;
12
+ color: $page_text_color;
13
+ align-self: center;
14
+ margin-right: 0.5em;
15
+ }
16
+ &__input {
17
+ flex: 60%;
18
+ border: $border_size solid $primary_border_color;
19
+ border-radius: $border_radius;
20
+ color: $control_text_color;
21
+ background-color: $control_bg_color;
22
+ }
23
+
24
+ &__wrapper {
25
+ display: flex;
26
+ justify-content: space-between;
27
+ flex-direction: row;
28
+ width: 100%;
29
+ }
30
+ &__error-container {
31
+ text-align: right;
32
+ color: $error_validation_color;
33
+ }
34
34
  }
@@ -1,14 +1,14 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { SelectField } from './SelectField';
3
-
4
- const meta: Meta<typeof SelectField> = {
5
- title: 'Example/SelectField',
6
- component: SelectField,
7
- } as Meta;
8
- export default meta;
9
-
10
- type Story = StoryObj<typeof SelectField>;
11
-
12
- export const TextButton: Story = {
13
- render: () => <SelectField value="test" name="tf1" />,
14
- };
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { SelectField } from './SelectField';
3
+
4
+ const meta: Meta<typeof SelectField> = {
5
+ title: 'Example/SelectField',
6
+ component: SelectField,
7
+ } as Meta;
8
+ export default meta;
9
+
10
+ type Story = StoryObj<typeof SelectField>;
11
+
12
+ export const TextButton: Story = {
13
+ render: () => <SelectField value="test" name="tf1" />,
14
+ };
@@ -1,53 +1,53 @@
1
- import { ChangeEventHandler, forwardRef } from "react";
2
- import { formatError } from "../../utils";
3
- import "./SelectField.scss"
4
- import clsx from "clsx";
5
- import { bem } from '../../utils/bem';
6
-
7
- export interface ILabelValuePair {
8
- label: string;
9
- value: string | number;
10
- }
11
- interface ISelectFieldProps {
12
- label?: string;
13
- name?: string;
14
- error?: string;
15
- validationError?: (name?: string) => string | undefined;
16
- onChange?: ChangeEventHandler<HTMLSelectElement>;
17
- onBlur?: ChangeEventHandler<HTMLSelectElement>;
18
- value?: string;
19
- autoFocus?: boolean;
20
- className?: string;
21
- disabled?: boolean;
22
- placeholder?: string;
23
- noLabel?: boolean;
24
- options?: ILabelValuePair[] | null;
25
- }
26
-
27
- const b = bem("select-field");
28
- export const SelectField = forwardRef<HTMLSelectElement, ISelectFieldProps>(({value,
29
- onChange, noLabel = false, onBlur, name, className, autoFocus = false,
30
- disabled = false, label, error, options }: ISelectFieldProps, ref) => {
31
-
32
- return (<div className={clsx(b(), className)}>
33
- <div className={b("wrapper")}>
34
- {!noLabel && <label
35
- htmlFor={name} className={b("label")}>{label}:</label>}
36
- <select
37
- id={name}
38
- name={name}
39
- className={b("input")}
40
- disabled={disabled}
41
- value={value}
42
- onChange={onChange}
43
- onBlur={onBlur}
44
- ref={ref}
45
- autoFocus={autoFocus}
46
- autoComplete="on"
47
- >
48
- {options && options.map(o => <option value={o.value} key={o.value}>{o.label}</option>)}
49
- </select>
50
- </div>
51
- {error && <div className={b("error-container")}>{formatError(error, label)}</div>}
52
- </div>)
53
- });
1
+ import { ChangeEventHandler, forwardRef } from "react";
2
+ import { formatError } from "../../utils";
3
+ import "./SelectField.scss"
4
+ import clsx from "clsx";
5
+ import { bem } from '../../utils/bem';
6
+
7
+ export interface ILabelValuePair {
8
+ label: string;
9
+ value: string | number;
10
+ }
11
+ interface ISelectFieldProps {
12
+ label?: string;
13
+ name?: string;
14
+ error?: string;
15
+ validationError?: (name?: string) => string | undefined;
16
+ onChange?: ChangeEventHandler<HTMLSelectElement>;
17
+ onBlur?: ChangeEventHandler<HTMLSelectElement>;
18
+ value?: string;
19
+ autoFocus?: boolean;
20
+ className?: string;
21
+ disabled?: boolean;
22
+ placeholder?: string;
23
+ noLabel?: boolean;
24
+ options?: ILabelValuePair[] | null;
25
+ }
26
+
27
+ const b = bem("select-field");
28
+ export const SelectField = forwardRef<HTMLSelectElement, ISelectFieldProps>(({value,
29
+ onChange, noLabel = false, onBlur, name, className, autoFocus = false,
30
+ disabled = false, label, error, options }: ISelectFieldProps, ref) => {
31
+
32
+ return (<div className={clsx(b(), className)}>
33
+ <div className={b("wrapper")}>
34
+ {!noLabel && <label
35
+ htmlFor={name} className={b("label")}>{label}:</label>}
36
+ <select
37
+ id={name}
38
+ name={name}
39
+ className={b("input")}
40
+ disabled={disabled}
41
+ value={value}
42
+ onChange={onChange}
43
+ onBlur={onBlur}
44
+ ref={ref}
45
+ autoFocus={autoFocus}
46
+ autoComplete="on"
47
+ >
48
+ {options && options.map(o => <option value={o.value} key={o.value}>{o.label}</option>)}
49
+ </select>
50
+ </div>
51
+ {error && <div className={b("error-container")}>{formatError(error, label)}</div>}
52
+ </div>)
53
+ });
@@ -1 +1 @@
1
- export * from "./SelectField";
1
+ export * from "./SelectField";