react-artasys-ui 0.1.21 → 0.1.23

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 (88) hide show
  1. package/package.json +26 -5
  2. package/__tests__/static.test.js +0 -0
  3. package/babel.config.json +0 -3
  4. package/dist/index.js +0 -3
  5. package/dist/index.js.LICENSE.txt +0 -9
  6. package/dist/index.js.map +0 -1
  7. package/lib/Button/Button.d.ts +0 -10
  8. package/lib/Button/index.d.ts +0 -2
  9. package/lib/Checkbox/Checkbox.d.ts +0 -7
  10. package/lib/Checkbox/index.d.ts +0 -2
  11. package/lib/Components/Arrow/Arrow.d.ts +0 -6
  12. package/lib/Components/Arrow/index.d.ts +0 -2
  13. package/lib/Dropdown/Dropdown.d.ts +0 -17
  14. package/lib/Dropdown/Item.d.ts +0 -11
  15. package/lib/Dropdown/Items.d.ts +0 -6
  16. package/lib/Dropdown/index.d.ts +0 -9
  17. package/lib/File/File.d.ts +0 -17
  18. package/lib/File/index.d.ts +0 -3
  19. package/lib/Form/Element/Element.d.ts +0 -15
  20. package/lib/Form/Element/index.d.ts +0 -3
  21. package/lib/Form/Form.d.ts +0 -11
  22. package/lib/Form/index.d.ts +0 -5
  23. package/lib/Form/types.d.ts +0 -11
  24. package/lib/Form/useForm.d.ts +0 -17
  25. package/lib/Input/Input.d.ts +0 -8
  26. package/lib/Input/index.d.ts +0 -2
  27. package/lib/Progress/Progress.d.ts +0 -7
  28. package/lib/Progress/index.d.ts +0 -2
  29. package/lib/Select/Optgroup.d.ts +0 -8
  30. package/lib/Select/Option.d.ts +0 -8
  31. package/lib/Select/Select.d.ts +0 -18
  32. package/lib/Select/index.d.ts +0 -11
  33. package/lib/Spinner/Spinner.d.ts +0 -7
  34. package/lib/Spinner/index.d.ts +0 -3
  35. package/lib/TextArea/TextArea.d.ts +0 -7
  36. package/lib/TextArea/index.d.ts +0 -2
  37. package/lib/UploadImages/Image.d.ts +0 -16
  38. package/lib/UploadImages/UploadImages.d.ts +0 -9
  39. package/lib/UploadImages/index.d.ts +0 -5
  40. package/lib/index.d.ts +0 -16
  41. package/src/Button/Button.tsx +0 -29
  42. package/src/Button/index.tsx +0 -3
  43. package/src/Button/style.module.css +0 -45
  44. package/src/Checkbox/Checkbox.tsx +0 -22
  45. package/src/Checkbox/index.tsx +0 -2
  46. package/src/Checkbox/style.module.css +0 -74
  47. package/src/Components/Arrow/Arrow.tsx +0 -18
  48. package/src/Components/Arrow/index.tsx +0 -3
  49. package/src/Components/Arrow/style.module.css +0 -40
  50. package/src/Dropdown/Dropdown.tsx +0 -114
  51. package/src/Dropdown/Item.tsx +0 -42
  52. package/src/Dropdown/Items.tsx +0 -38
  53. package/src/Dropdown/index.tsx +0 -28
  54. package/src/Dropdown/style.module.css +0 -89
  55. package/src/File/File.tsx +0 -85
  56. package/src/File/index.tsx +0 -9
  57. package/src/Form/Element/Element.tsx +0 -54
  58. package/src/Form/Element/index.tsx +0 -7
  59. package/src/Form/Element/style.module.css +0 -119
  60. package/src/Form/Form.tsx +0 -40
  61. package/src/Form/index.tsx +0 -8
  62. package/src/Form/style.module.css +0 -30
  63. package/src/Form/types.ts +0 -17
  64. package/src/Form/useForm.tsx +0 -76
  65. package/src/Input/Input.tsx +0 -49
  66. package/src/Input/index.tsx +0 -3
  67. package/src/Input/style.module.css +0 -16
  68. package/src/Progress/Progress.tsx +0 -28
  69. package/src/Progress/index.tsx +0 -3
  70. package/src/Progress/style.module.css +0 -72
  71. package/src/Select/Optgroup.tsx +0 -19
  72. package/src/Select/Option.tsx +0 -47
  73. package/src/Select/Select.tsx +0 -143
  74. package/src/Select/index.tsx +0 -33
  75. package/src/Select/style.module.css +0 -117
  76. package/src/Spinner/Spinner.tsx +0 -21
  77. package/src/Spinner/index.tsx +0 -8
  78. package/src/Spinner/style.module.css +0 -65
  79. package/src/TextArea/TextArea.tsx +0 -57
  80. package/src/TextArea/index.tsx +0 -3
  81. package/src/UploadImages/Image.tsx +0 -86
  82. package/src/UploadImages/UploadImages.tsx +0 -57
  83. package/src/UploadImages/index.tsx +0 -13
  84. package/src/UploadImages/style.module.css +0 -108
  85. package/src/index.ts +0 -62
  86. package/tsconfig.json +0 -118
  87. package/types.d.ts +0 -1
  88. package/webpack.config.js +0 -59
@@ -1,114 +0,0 @@
1
- import {
2
- AllHTMLAttributes,
3
- useRef,
4
- useState,
5
- FunctionComponentElement,
6
- useEffect,
7
- createContext,
8
- Children,
9
- type FocusEvent
10
- } from "react";
11
- import styles from "./style.module.css";
12
- import Arrow from "../Components/Arrow";
13
- import type {
14
- IItem,
15
- TChildrenAction
16
- } from "./Item";
17
- import Items from "./Items";
18
-
19
- export const Context = createContext<TChildrenAction>({
20
- close: () => {}
21
- });
22
-
23
- export interface IDropdown extends AllHTMLAttributes<HTMLDivElement> {
24
- direction?: 'down' | 'up';
25
- position?: 'left' | 'right';
26
- split?: boolean;
27
- hover?: boolean;
28
- arrow?: boolean;
29
- items?: FunctionComponentElement<IItem> | FunctionComponentElement<IItem>[];
30
- disabled?: boolean;
31
- enableRerenderItems?: boolean;
32
- onShow?: () => void;
33
- onHide?: () => void;
34
- };
35
-
36
- const Dropdown = ({children, className, items, arrow = true, direction = 'down', position = 'right', split = false, disabled, hover = false, enableRerenderItems = true, onShow, onHide, ...props}: IDropdown) => {
37
- const containerRef = useRef<HTMLDivElement>(null);
38
- const hoverTimeout = useRef<ReturnType<typeof setTimeout>>();
39
- const [isOpen, setOpen] = useState(false);
40
-
41
- const close = () => {
42
- setOpen(false);
43
- };
44
-
45
- const toggle = () => {
46
- setOpen((isOpen) => {
47
- if (disabled) return false;
48
- return !isOpen;
49
- });
50
- };
51
-
52
- const handleClickArrow = () => {
53
- toggle();
54
- };
55
-
56
- const handleClick = () => {
57
- if (hoverTimeout.current) return;
58
- if (!split || hover) toggle();
59
- };
60
-
61
- const handleBlur = (e: FocusEvent) => {
62
- if (e.currentTarget.contains(e.relatedTarget)) return;
63
- close();
64
- };
65
-
66
- const handleMouseEnter = () => {
67
- if (!hover || isOpen) return;
68
- hoverTimeout.current = setTimeout(toggle, 50);
69
- };
70
-
71
- const handleMouseOut = () => {
72
- if (hoverTimeout.current) {
73
- clearTimeout(hoverTimeout.current);
74
- }
75
- };
76
-
77
- useEffect(() => {
78
- const element = containerRef.current;
79
- const classList = element?.classList;
80
- if (isOpen) {
81
- classList?.add(styles['opened']);
82
- element?.focus();
83
- if (typeof onShow === 'function') {
84
- onShow();
85
- }
86
- }else{
87
- classList?.remove(styles['opened']);
88
- if (typeof onHide === 'function') {
89
- onHide();
90
- }
91
- }
92
- }, [isOpen]);
93
-
94
- const classes = ['ui-dropdown'];
95
- classes.push(styles['container']);
96
- if (className) classes.push(className);
97
- if (direction) classes.push(styles[direction]);
98
- if (position) classes.push(styles[position]);
99
-
100
- return(<Context.Provider value={{
101
- close
102
- }}>
103
- <div {...props} className={classes.join(' ')} ref={containerRef} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseOut} tabIndex={1} onBlur={handleBlur}>
104
- {(position === 'left' && !disabled) && <Arrow className={styles['arrow']} onClick={handleClickArrow}/>}
105
- <div onClick={handleClick} className={'ui-dropdown-block' + (isOpen ? ' ' + styles['hide'] : '')}>
106
- {children}
107
- </div>
108
- {(position === 'right' && !disabled && arrow) && <Arrow className={styles['arrow']} onClick={handleClickArrow}/>}
109
- <Items isOpen={isOpen} disabled={disabled} enableRerenderItems={enableRerenderItems} items={items}/>
110
- </div>
111
- </Context.Provider>);
112
- };
113
-
114
- export default Dropdown;
@@ -1,42 +0,0 @@
1
- import {
2
- useContext,
3
- AllHTMLAttributes,
4
- ReactElement,
5
- MouseEvent
6
- } from "react";
7
- import styles from "./style.module.css";
8
- import { Context } from "./Dropdown";
9
-
10
- export type TChildrenAction = {
11
- close: () => void;
12
- };
13
-
14
- export interface IItem extends Omit<AllHTMLAttributes<HTMLLIElement>, 'children'> {
15
- children?: ((action: TChildrenAction) => ReactElement) | string | ReactElement;
16
- autoClose?: boolean;
17
- active?: boolean;
18
- };
19
-
20
- const Item = ({children, onClick, autoClose = true, active, className, ...props}: IItem) => {
21
- const context = useContext(Context);
22
-
23
- const handleClick = (e: MouseEvent<HTMLLIElement>) => {
24
- if (typeof onClick === 'function') {
25
- onClick(e);
26
- }
27
- if (autoClose) {
28
- context.close();
29
- }
30
- };
31
-
32
- const classes = ['ui-dropdown-item'];
33
- classes.push(styles['item']);
34
- if (active) classes.push(styles['active'], 'active');
35
- if (className) classes.push(className);
36
-
37
- return(<li {...props} onClick={handleClick} className={classes.join(' ')}>
38
- {typeof children === 'function' ? children(context) : children}
39
- </li>);
40
- };
41
-
42
- export default Item;
@@ -1,38 +0,0 @@
1
- import styles from "./style.module.css";
2
- import type { IDropdown } from "./Dropdown";
3
- import { useEffect, useMemo, useRef, useState } from "react";
4
-
5
- interface IItems extends Pick<IDropdown, 'items' | 'disabled' | 'enableRerenderItems'> {
6
- isOpen: boolean;
7
- };
8
-
9
- const Items = ({items, isOpen, enableRerenderItems, disabled}: IItems) => {
10
- const listRef = useRef<HTMLUListElement>(null);
11
-
12
- const renderItems = useMemo(() => {
13
- if (enableRerenderItems) {
14
- return isOpen ? items : null;
15
- }
16
- return items;
17
- }, [enableRerenderItems, items, isOpen]);
18
-
19
- useEffect(() => {
20
-
21
- if (!listRef.current) return;
22
- const screenWidth = window.innerWidth;
23
- const element = listRef.current.getBoundingClientRect();
24
-
25
-
26
- // console.log(element.left)
27
- if (element.left <= 0) {
28
-
29
- // listRef.current.style.transform = 'translateX(' + Math.abs(element.left) + 'px)';
30
- }
31
- },[isOpen]);
32
-
33
- if (disabled) return null;
34
-
35
- return(<ul className={styles['dropdown-list']} children={renderItems} ref={listRef}/>);
36
- };
37
-
38
- export default Items;
@@ -1,28 +0,0 @@
1
- import {
2
- forwardRef,
3
- RefAttributes,
4
- ForwardRefExoticComponent,
5
- FC
6
- } from "react";
7
- import {
8
- default as DropdownUI,
9
- IDropdown
10
- } from "./Dropdown";
11
- import Item,{
12
- IItem
13
- } from "./Item";
14
-
15
- interface StaticComponent extends ForwardRefExoticComponent<IDropdown & RefAttributes<HTMLInputElement>> {
16
- Item: FC<IItem>;
17
- };
18
-
19
- const Dropdown: StaticComponent = {
20
- ...forwardRef<HTMLInputElement, IDropdown>(({...args}, ref): JSX.Element => <DropdownUI {...args}/>),
21
- Item
22
- } as StaticComponent;
23
-
24
- export {
25
- Item as DropdownItem
26
- };
27
-
28
- export default Dropdown;
@@ -1,89 +0,0 @@
1
- /* Dropdown */
2
-
3
- .container {
4
- position: relative;
5
- display: inline-flex;
6
- flex-direction: row;
7
- align-items: center;
8
- outline: none;
9
- cursor: pointer;
10
- }
11
-
12
- .container > :global(.ui-dropdown-block) {
13
- position: relative;
14
- }
15
-
16
- .container > :global(.ui-dropdown-block)::after {
17
- content: "";
18
- position: absolute;
19
- left: 0;
20
- top: 0;
21
- width: 100%;
22
- height: 100%;
23
- }
24
-
25
- .container > :global(.ui-dropdown-block).hide::after {
26
- display: none;
27
- }
28
-
29
- .arrow {
30
- padding: 5px;
31
- }
32
-
33
- .dropdown-list {
34
- display: flex;
35
- position: absolute;
36
- padding: 0;
37
- margin: 0;
38
- flex-direction: column;
39
- background-color: #FFFFFF;
40
- border-radius: 2px;
41
- list-style-type: none;
42
- box-shadow: 0px 0px 9px 2px rgb(0 0 0 / 10%);
43
- opacity: 0;
44
- transform: translateY(-10%);
45
- visibility: hidden;
46
- z-index: 1;
47
- transition: opacity 0.3s, visibility 0.3s, transform 0.3s ease;
48
- }
49
-
50
- .container.down > .dropdown-list {
51
- top: 100%;
52
- }
53
-
54
- .container.up > .dropdown-list {
55
- bottom: 100%;
56
- }
57
-
58
- .container.left > .dropdown-list {
59
- left: 0;
60
- }
61
-
62
- .container.right > .dropdown-list {
63
- right: 0;
64
- }
65
-
66
- .dropdown-list > li.item {
67
- padding: 7px;
68
- font-size: 18px;
69
- font-weight: normal;
70
- color: #1D1D1B;
71
- white-space: nowrap;
72
- width: 100%;
73
- box-sizing: border-box;
74
- }
75
-
76
- .container.opened > .dropdown-list {
77
- opacity: 1;
78
- visibility: visible;
79
- transform: translateY(0);
80
- }
81
-
82
- .container.opened > .arrow::after {
83
- rotate: 180deg;
84
- }
85
-
86
- .dropdown-list > li.item:hover, .dropdown-list > li.item:has(:global(a.active)) {
87
- background-color: #BED4DB;
88
- border-radius: inherit;
89
- }
package/src/File/File.tsx DELETED
@@ -1,85 +0,0 @@
1
- import {
2
- useEffect,
3
- useRef,
4
- MouseEvent,
5
- AllHTMLAttributes
6
- } from "react";
7
-
8
- export type TFileMime = 'image/png' | 'image/jpg' | 'image/jpeg' | 'image/gif';
9
-
10
- export type TFileData = {
11
- name: string;
12
- type: TFileMime;
13
- size: number;
14
- mime: TFileMime;
15
- data: string;
16
- base64?: string | null | ArrayBuffer;
17
- };
18
-
19
- interface TFile<T = any> extends Omit<AllHTMLAttributes<T>, 'onChange' | 'accept'> {
20
- onChange?: (data: TFileData) => void;
21
- multiple?: boolean;
22
- accept?: TFileMime[];
23
- };
24
-
25
- const File = ({onChange, children, multiple, accept, ...props}: TFile) => {
26
- const selector = useRef<HTMLInputElement>();
27
-
28
- const handleChange = (e: Event) => {
29
- const target = e.target as HTMLInputElement
30
- if (target.files) {
31
- for(const file of target.files) {
32
- const reader = new FileReader();
33
- reader.onload = (evt) => {
34
- const data = evt.target?.result?.toString().split(';base64,');
35
- const mime = (data?.[0].replace('data:', '') ?? '') as TFileMime;
36
- const contentData = data?.[1] ?? '';
37
- if (typeof onChange === 'function') {
38
- selector.current!.value = '';
39
- onChange({
40
- name: file.name,
41
- type: file.type as TFileMime,
42
- size: file.size,
43
- mime: mime,
44
- data: contentData,
45
- base64: evt.target?.result
46
- })
47
- }
48
- };
49
- reader.readAsDataURL(file);
50
- }
51
- }
52
- };
53
-
54
- const handleDialog = (e: MouseEvent<HTMLDivElement>) => {
55
- if (props.disabled) return;
56
- selector.current!.click();
57
- e.preventDefault();
58
- };
59
-
60
- const mount = () => {
61
- const fileSelector = document.createElement('input');
62
- fileSelector.setAttribute('type', 'file');
63
- fileSelector.onchange = handleChange;
64
- if (accept && accept.length > 0) {
65
- fileSelector.setAttribute('accept', accept.join(','));
66
- }
67
-
68
- if (multiple) {
69
- fileSelector.setAttribute('multiple', 'multiple');
70
- }
71
- return fileSelector;
72
- };
73
-
74
- useEffect(() => {
75
- selector.current = mount();
76
- return () => {
77
- selector.current?.remove();
78
- }
79
- }, []);
80
- return(<div {...props} onClick={handleDialog}>
81
- {children}
82
- </div>)
83
- };
84
-
85
- export default File;
@@ -1,9 +0,0 @@
1
- import File,{
2
- TFileData,
3
- TFileMime
4
- } from "./File";
5
- export type {
6
- TFileData,
7
- TFileMime
8
- };
9
- export default File;
@@ -1,54 +0,0 @@
1
- import {
2
- useState,
3
- useEffect,
4
- AllHTMLAttributes,
5
- ReactElement,
6
- cloneElement
7
- } from "react";
8
- import styles from "./style.module.css";
9
-
10
- export interface IElement<T = any> extends Omit<AllHTMLAttributes<T>, 'children'> {
11
- children?: ((props: AllHTMLAttributes<T>) => ReactElement) | AllHTMLAttributes<T>["children"];
12
- error?: string;
13
- formValue?: string | number;
14
- disabled?: boolean;
15
- placeholder?: string;
16
- styleContainer?: React.HTMLAttributes<T>["style"];
17
- classNameContainer?: string;
18
- beforeElement?: React.ReactElement;
19
- afterElement?: React.ReactElement;
20
- hiddenContainer?: boolean;
21
- }
22
-
23
- const Element = ({children, beforeElement, afterElement, error, placeholder, styleContainer, classNameContainer, hiddenContainer, formValue, ...props}: IElement) => {
24
- const [currentError, setCurrentError] = useState('');
25
-
26
- useEffect(() => {
27
- setCurrentError(error ?? '');
28
- },[error]);
29
-
30
- const classes = ['ui-form-element-container'];
31
-
32
- classes.push(styles['container']);
33
- if (currentError) classes.push(styles['error']);
34
- if (props.disabled) classes.push(styles['disabled']);
35
- if (hiddenContainer) classes.push(styles['hidden']);
36
- if (classNameContainer) classes.push(classNameContainer);
37
-
38
- return(<>
39
- <label
40
- className={classes.join(' ')}
41
- style={styleContainer}
42
- >
43
- {beforeElement ? cloneElement(beforeElement, {key: 'ui-before-element'}) : null}
44
- <div className={'ui-form-element ' + styles['element']}>
45
- {typeof children === 'function' ? children(props) : null}
46
- {placeholder && <span className={'ui-form-element-placeholder ' + styles['placeholder']}>{placeholder}</span>}
47
- </div>
48
- {afterElement ? cloneElement(afterElement, {key: 'ui-after-element'}) : null}
49
- </label>
50
- {currentError && <div className={'ui-form-error ' + styles['error']}>{currentError}</div>}
51
- </>);
52
- }
53
-
54
- export default Element;
@@ -1,7 +0,0 @@
1
- import Element,{
2
- IElement
3
- } from "./Element";
4
- export type {
5
- IElement
6
- }
7
- export default Element;
@@ -1,119 +0,0 @@
1
- /* Input */
2
-
3
- .container {
4
- display: flex;
5
- align-items: center;
6
- width: 100%;
7
- position: relative;
8
- border: 1px solid #CCCCCC;
9
- border-radius: 3px;
10
- z-index: 0;
11
- }
12
-
13
- .container.hidden {
14
- border: 0;
15
- }
16
-
17
- .element {
18
- align-self: stretch;
19
- width: 100%;
20
- }
21
-
22
- .element > input, .element > textarea {
23
- width: 100%;
24
- height: 100%;
25
- min-height: 45px;
26
- max-height: 500px;
27
- max-height: 50dvh;
28
- margin: 0;
29
- padding: 10px;
30
- font-size: 20px;
31
- border: 0;
32
- box-sizing: border-box;
33
- background-color: transparent;
34
- outline: none;
35
- resize: none;
36
- }
37
-
38
- .container.disabled {
39
- background-color: #EFEFEF;
40
- }
41
-
42
- .element > input:-webkit-autofill,
43
- .element > input:-webkit-autofill:hover,
44
- .element > input:-webkit-autofill:focus,
45
- .element > input:-webkit-autofill:active{
46
- -webkit-background-clip: text;
47
- }
48
-
49
- .element > input:focus {
50
- outline: none;
51
- }
52
-
53
- .element > .placeholder {
54
- position: absolute;
55
- display: flex;
56
- justify-content: center;
57
- align-items: center;
58
- top: 0;
59
- margin-left: 5px;
60
- height: 100%;
61
- color: #7A7A73;
62
- font-size: 1.2rem;
63
- z-index: -1;
64
- user-select: none;
65
- transition: transform 0.3s;
66
- }
67
-
68
- .element > textarea ~ .placeholder {
69
- max-height: 2em;
70
- }
71
-
72
- .element > .placeholder::before {
73
- content: "";
74
- position: absolute;
75
- display: block;
76
- width: 100%;
77
- height: 5px;
78
- background-color: #FFFFFF;
79
- z-index: -1;
80
- }
81
-
82
- .element > input:required ~ .placeholder::after {
83
- content: "*";
84
- }
85
-
86
- /* Date */
87
- .element > input[type="date"]::-webkit-calendar-picker-indicator {
88
- cursor: pointer;
89
- border-radius: 4px;
90
- margin-right: 2px;
91
- opacity: 0.7;
92
- filter: invert(0.8);
93
- }
94
-
95
- .element > input[type="date"]::-webkit-calendar-picker-indicator:hover {
96
- opacity: 1
97
- }
98
-
99
- .element > input[type="date"] ~ .placeholder,
100
- .element > input:focus ~ .placeholder,
101
- .element > textarea:focus ~ .placeholder,
102
- .element > input:not([value=""]) ~ .placeholder,
103
- .element > textarea:not(:empty) ~ .placeholder,
104
- .element > input:not(:empty) ~ .placeholder {
105
- transform: translate(-10%, -50%) scale(0.8);
106
- z-index: 0;
107
- }
108
-
109
- .container.error {
110
- border-color: #FF6D6D;
111
- }
112
-
113
- .container.error .placeholder {
114
- color: #FF6D6D;
115
- }
116
-
117
- .error {
118
- color: #FF6D6D;
119
- }
package/src/Form/Form.tsx DELETED
@@ -1,40 +0,0 @@
1
- import { FormHTMLAttributes, ReactNode, FormEvent } from 'react';
2
- import styles from './style.module.css';
3
-
4
- import Spinner,{
5
- TSpinner
6
- } from '../Spinner';
7
- import Progress from '../Progress';
8
-
9
- interface IForm extends FormHTMLAttributes<HTMLFormElement> {
10
- children: ReactNode;
11
- wait?: boolean;
12
- progress?: number;
13
- progressRadius?: boolean;
14
- spinnerColor?: TSpinner['color'];
15
- }
16
-
17
- const Form = ({children, wait, progress, progressRadius = true, className, spinnerColor, onSubmit, ...props}: IForm) => {
18
-
19
- const submit = (e: FormEvent<HTMLFormElement>) => {
20
- e.preventDefault();
21
- if (typeof onSubmit === 'function') {
22
- onSubmit(e);
23
- }
24
- };
25
-
26
- const classes = [];
27
-
28
- classes.push(styles['container']);
29
- if (wait) classes.push(styles['wait']);
30
- if (className) classes.push(className);
31
-
32
- return(<form {...props} onSubmit={submit} className={classes.join(' ')}>
33
- {children}
34
- <div className={styles['wait-indicator']}>
35
- {typeof progress === 'number' ? <Progress radius={progressRadius} value={progress}/> : <Spinner color={spinnerColor}/>}
36
- </div>
37
- </form>);
38
- };
39
-
40
- export default Form;
@@ -1,8 +0,0 @@
1
- import Form from "./Form";
2
- import useForm from "./useForm";
3
- import Element from "./Element";
4
- export {
5
- useForm,
6
- Element as FormElement
7
- };
8
- export default Form;
@@ -1,30 +0,0 @@
1
- /* Form */
2
-
3
- .container {
4
- flex: 1;
5
- display: flex;
6
- flex-direction: column;
7
- align-items: center;
8
- gap: 10px;
9
- }
10
-
11
- .container > .wait-indicator {
12
- display: flex;
13
- justify-content: center;
14
- align-items: center;
15
- position: absolute;
16
- top: 0;
17
- left: 0;
18
- width: 100%;
19
- height: 100%;
20
- background-color: #FFFFFF9F;
21
- backdrop-filter: blur(2px);
22
- z-index: -1;
23
- opacity: 0;
24
- transition: opacity 0.3s;
25
- }
26
-
27
- .container.wait > .wait-indicator {
28
- z-index: 1;
29
- opacity: 1;
30
- }
package/src/Form/types.ts DELETED
@@ -1,17 +0,0 @@
1
- import type {
2
- FieldValues,
3
- UseFormRegisterReturn,
4
- FieldPath
5
- } from "react-hook-form";
6
-
7
- export type TUseFormRegisterReturn<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = UseFormRegisterReturn<TFieldName> & {
8
- error?: string;
9
- formValue: TFieldValues;
10
- };
11
-
12
- export type TError<TFieldValues extends FieldValues> = {
13
- errors?: {
14
- [key in keyof TFieldValues]: string[];
15
- };
16
- message: string;
17
- }