@buerokratt-ria/common-gui-components 0.0.1
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/.eslintrc.json +18 -0
- package/CHANGELOG.md +7 -0
- package/MAKING_CHANGES.md +8 -0
- package/README.md +49 -0
- package/assets/ding.mp3 +0 -0
- package/assets/logo-white.svg +29 -0
- package/assets/logo.svg +31 -0
- package/assets/newMessageSound.mp3 +0 -0
- package/constants/config.ts +12 -0
- package/constants/index.ts +1 -0
- package/context/index.ts +1 -0
- package/context/toastContext.tsx +60 -0
- package/hooks/index.ts +3 -0
- package/hooks/useAudio.tsx +30 -0
- package/hooks/useDocumentEscapeListener.tsx +17 -0
- package/hooks/useToast.tsx +5 -0
- package/i18n.ts +26 -0
- package/index.ts +6 -0
- package/package.json +122 -0
- package/project.json +52 -0
- package/services/api.ts +74 -0
- package/services/index.ts +3 -0
- package/services/sse-service.ts +30 -0
- package/services/users.ts +58 -0
- package/store/index.ts +253 -0
- package/templates/history-page/index.ts +1 -0
- package/templates/history-page/src/History.scss +47 -0
- package/templates/history-page/src/index.tsx +998 -0
- package/templates/history-page/src/unfiyDate.tsx +7 -0
- package/translations/en/common.json +467 -0
- package/translations/et/common.json +467 -0
- package/tsconfig.base.json +21 -0
- package/tsconfig.json +17 -0
- package/tsconfig.spec.json +19 -0
- package/types/authorities.ts +8 -0
- package/types/botConfig.ts +7 -0
- package/types/chat.ts +126 -0
- package/types/customerSupportActivity.ts +5 -0
- package/types/deleteChatSettings.ts +9 -0
- package/types/emergencyNotice.ts +10 -0
- package/types/establishment.ts +4 -0
- package/types/index.ts +18 -0
- package/types/mainNavigation.ts +11 -0
- package/types/message.ts +74 -0
- package/types/organizationWorkingTime.ts +27 -0
- package/types/router.ts +4 -0
- package/types/service.ts +6 -0
- package/types/session.ts +7 -0
- package/types/skmConfig.ts +8 -0
- package/types/user.ts +40 -0
- package/types/userInfo.ts +16 -0
- package/types/userProfileSettings.ts +10 -0
- package/types/widgetConfig.ts +8 -0
- package/ui-components/Button/Button.scss +150 -0
- package/ui-components/Button/index.tsx +41 -0
- package/ui-components/ButtonMessage/ButtonMessage.scss +16 -0
- package/ui-components/ButtonMessage/index.tsx +19 -0
- package/ui-components/Card/Card.scss +69 -0
- package/ui-components/Card/index.tsx +39 -0
- package/ui-components/Chat/Chat.scss +447 -0
- package/ui-components/Chat/ChatMessage.tsx +270 -0
- package/ui-components/Chat/ChatTextArea.scss +110 -0
- package/ui-components/Chat/ChatTextArea.tsx +97 -0
- package/ui-components/Chat/LoaderOverlay.tsx +39 -0
- package/ui-components/Chat/Markdownify.tsx +49 -0
- package/ui-components/Chat/PreviewMessage.tsx +39 -0
- package/ui-components/Chat/Typing.scss +46 -0
- package/ui-components/Chat/index.tsx +1111 -0
- package/ui-components/ChatEvent/Chat.scss +40 -0
- package/ui-components/ChatEvent/index.tsx +216 -0
- package/ui-components/DataTable/CloseIcon.tsx +22 -0
- package/ui-components/DataTable/DataTable.scss +188 -0
- package/ui-components/DataTable/DeboucedInput.scss +11 -0
- package/ui-components/DataTable/DebouncedInput.tsx +54 -0
- package/ui-components/DataTable/Filter.tsx +121 -0
- package/ui-components/DataTable/index.tsx +432 -0
- package/ui-components/Dialog/Dialog.scss +63 -0
- package/ui-components/Dialog/index.tsx +44 -0
- package/ui-components/Drawer/Drawer.scss +40 -0
- package/ui-components/Drawer/index.tsx +42 -0
- package/ui-components/FormElements/FormCheckbox/FormCheckbox.scss +57 -0
- package/ui-components/FormElements/FormCheckbox/index.tsx +39 -0
- package/ui-components/FormElements/FormCheckboxes/FormCheckboxes.scss +63 -0
- package/ui-components/FormElements/FormCheckboxes/index.tsx +44 -0
- package/ui-components/FormElements/FormDatepicker/FormDatepicker.scss +154 -0
- package/ui-components/FormElements/FormDatepicker/index.tsx +123 -0
- package/ui-components/FormElements/FormInput/FormInput.scss +90 -0
- package/ui-components/FormElements/FormInput/index.tsx +47 -0
- package/ui-components/FormElements/FormRadios/FormRadios.scss +72 -0
- package/ui-components/FormElements/FormRadios/index.tsx +36 -0
- package/ui-components/FormElements/FormSelect/FormMultiselect.tsx +124 -0
- package/ui-components/FormElements/FormSelect/FormSelect.scss +121 -0
- package/ui-components/FormElements/FormSelect/index.tsx +100 -0
- package/ui-components/FormElements/FormTextarea/FormTextarea.scss +109 -0
- package/ui-components/FormElements/FormTextarea/index.tsx +154 -0
- package/ui-components/FormElements/Switch/Switch.scss +69 -0
- package/ui-components/FormElements/Switch/index.tsx +65 -0
- package/ui-components/FormElements/SwitchBox/SwitchBox.scss +45 -0
- package/ui-components/FormElements/SwitchBox/index.tsx +44 -0
- package/ui-components/FormElements/index.tsx +23 -0
- package/ui-components/HistoricalChat/ChatMessage.tsx +67 -0
- package/ui-components/HistoricalChat/HistoricalChat.scss +225 -0
- package/ui-components/HistoricalChat/index.tsx +282 -0
- package/ui-components/Icon/Icon.scss +17 -0
- package/ui-components/Icon/index.tsx +26 -0
- package/ui-components/Label/Label.scss +76 -0
- package/ui-components/Label/index.tsx +40 -0
- package/ui-components/OptionMessage/OptionMessage.scss +16 -0
- package/ui-components/OptionMessage/index.tsx +16 -0
- package/ui-components/Toast/Toast.scss +73 -0
- package/ui-components/Toast/index.tsx +54 -0
- package/ui-components/Tooltip/Tooltip.scss +17 -0
- package/ui-components/Tooltip/index.tsx +28 -0
- package/ui-components/Track/index.tsx +57 -0
- package/ui-components/index.tsx +53 -0
- package/utils/constants.ts +19 -0
- package/utils/format-bytes.ts +8 -0
- package/utils/generateUEID.ts +8 -0
- package/utils/local-storage-utils.ts +17 -0
- package/utils/parse-utils.ts +23 -0
- package/utils/state-management-utils.ts +13 -0
- package/vite.config.ts +67 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { forwardRef, InputHTMLAttributes, useId } from 'react';
|
|
2
|
+
|
|
3
|
+
import './FormCheckbox.scss';
|
|
4
|
+
|
|
5
|
+
type FormCheckboxType = InputHTMLAttributes<HTMLInputElement> & {
|
|
6
|
+
label: string;
|
|
7
|
+
name: string;
|
|
8
|
+
hideLabel?: boolean;
|
|
9
|
+
item: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const FormCheckbox = forwardRef<HTMLInputElement, FormCheckboxType>((
|
|
17
|
+
{
|
|
18
|
+
label,
|
|
19
|
+
name,
|
|
20
|
+
hideLabel,
|
|
21
|
+
item,
|
|
22
|
+
...rest
|
|
23
|
+
},
|
|
24
|
+
ref,
|
|
25
|
+
) => {
|
|
26
|
+
const uid = useId();
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className='checkbox'>
|
|
30
|
+
{label && !hideLabel && <label className='checkbox__label'>{label}</label>}
|
|
31
|
+
<div className='checkbox__item'>
|
|
32
|
+
<input ref={ref} type='checkbox' name={name} id={uid} value={item.value} defaultChecked={item.checked} {...rest} />
|
|
33
|
+
<label htmlFor={uid}>{item.label}</label>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default FormCheckbox;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
@import 'src/styles/tools/spacing';
|
|
2
|
+
@import 'src/styles/tools/color';
|
|
3
|
+
@import 'src/styles/settings/variables/other';
|
|
4
|
+
@import 'src/styles/settings/variables/typography';
|
|
5
|
+
|
|
6
|
+
.checkboxes {
|
|
7
|
+
width: 100%;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: flex-start;
|
|
10
|
+
gap: get-spacing(paldiski);
|
|
11
|
+
|
|
12
|
+
&__label {
|
|
13
|
+
display: block;
|
|
14
|
+
flex: 0 0 185px;
|
|
15
|
+
font-size: $veera-font-size-100;
|
|
16
|
+
line-height: 24px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__wrapper {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: 8px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__item {
|
|
26
|
+
input[type=checkbox] {
|
|
27
|
+
display: none;
|
|
28
|
+
|
|
29
|
+
+ label {
|
|
30
|
+
display: block;
|
|
31
|
+
padding-left: 32px;
|
|
32
|
+
position: relative;
|
|
33
|
+
font-size: $veera-font-size-100;
|
|
34
|
+
line-height: $veera-line-height-500;
|
|
35
|
+
|
|
36
|
+
&::before {
|
|
37
|
+
content: '';
|
|
38
|
+
display: block;
|
|
39
|
+
width: 16px;
|
|
40
|
+
height: 16px;
|
|
41
|
+
box-shadow: inset 0 0 0 1px get-color(black-coral-2);
|
|
42
|
+
border-radius: 2px;
|
|
43
|
+
position: absolute;
|
|
44
|
+
left: 4px;
|
|
45
|
+
top: 4px;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:checked {
|
|
50
|
+
+ label {
|
|
51
|
+
&::before {
|
|
52
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTEiIHZpZXdCb3g9IjAgMCAxNCAxMSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQuNzQ5NzkgOC4xMjkwNkwxLjYyMjI5IDUuMDAxNTZMMC41NjEwMzUgNi4wNjI4MUw0Ljc0OTc5IDEwLjI1MTZMMTMuNzQ5OCAxLjI1MTU2TDEyLjY4ODUgMC4xOTAzMDhMNC43NDk3OSA4LjEyOTA2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==');
|
|
53
|
+
background-color: get-color(sapphire-blue-10);
|
|
54
|
+
background-repeat: no-repeat;
|
|
55
|
+
background-position: center;
|
|
56
|
+
background-size: 13px 10px;
|
|
57
|
+
box-shadow: inset 0 0 0 1px get-color(sapphire-blue-10);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { ChangeEvent, FC, useId, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import './FormCheckboxes.scss';
|
|
4
|
+
|
|
5
|
+
type FormCheckboxesType = {
|
|
6
|
+
label: string;
|
|
7
|
+
name: string;
|
|
8
|
+
hideLabel?: boolean;
|
|
9
|
+
onValuesChange?: (values: Record<string, any>) => void;
|
|
10
|
+
items: {
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const FormCheckboxes: FC<FormCheckboxesType> = ({ label, name, hideLabel, onValuesChange, items }) => {
|
|
17
|
+
const id = useId();
|
|
18
|
+
const [selectedValues, setSelectedValues] = useState<Record<string, any>>({});
|
|
19
|
+
|
|
20
|
+
const handleValuesChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
21
|
+
setSelectedValues((prevState) => ({
|
|
22
|
+
...prevState,
|
|
23
|
+
[e.target.name]: [e.target.value],
|
|
24
|
+
}));
|
|
25
|
+
if (onValuesChange) onValuesChange(selectedValues);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<fieldset className='checkboxes' role='group'>
|
|
30
|
+
{label && !hideLabel && <label className='checkboxes__label'>{label}</label>}
|
|
31
|
+
<div className='checkboxes__wrapper'>
|
|
32
|
+
{items.map((item, index) => (
|
|
33
|
+
<div key={`${item.value}-${index}`} className='checkboxes__item'>
|
|
34
|
+
<input type='checkbox' name={name} id={`${id}-${item.value}`} value={item.value}
|
|
35
|
+
onChange={handleValuesChange} />
|
|
36
|
+
<label htmlFor={`${id}-${item.value}`}>{item.label}</label>
|
|
37
|
+
</div>
|
|
38
|
+
))}
|
|
39
|
+
</div>
|
|
40
|
+
</fieldset>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default FormCheckboxes;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
@import 'src/styles/tools/spacing';
|
|
2
|
+
@import 'src/styles/tools/color';
|
|
3
|
+
@import 'src/styles/settings/variables/other';
|
|
4
|
+
@import 'src/styles/settings/variables/typography';
|
|
5
|
+
|
|
6
|
+
.datepicker {
|
|
7
|
+
$self: &;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: get-spacing(paldiski);
|
|
11
|
+
width: 100%;
|
|
12
|
+
|
|
13
|
+
&__label {
|
|
14
|
+
flex: 0 0 185px;
|
|
15
|
+
font-size: $veera-font-size-100;
|
|
16
|
+
line-height: 24px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__wrapper_column {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: 7px;
|
|
23
|
+
position: relative;
|
|
24
|
+
width: 125px;
|
|
25
|
+
|
|
26
|
+
.icon {
|
|
27
|
+
position: absolute;
|
|
28
|
+
right: 8px;
|
|
29
|
+
top: 8px;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&__wrapper_row {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
gap: 7px;
|
|
38
|
+
position: relative;
|
|
39
|
+
width: 125px;
|
|
40
|
+
|
|
41
|
+
.icon {
|
|
42
|
+
position: absolute;
|
|
43
|
+
right: 8px;
|
|
44
|
+
top: 8px;
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&__error {
|
|
50
|
+
width: 100%;
|
|
51
|
+
margin-right: 6px;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
gap: get-spacing(paldiski);
|
|
55
|
+
color: get-color(black-coral-20);
|
|
56
|
+
border-radius: $veera-radius-s;
|
|
57
|
+
background-color: get-color(jasper-3);
|
|
58
|
+
font-size: 13px;
|
|
59
|
+
line-height: 20px;
|
|
60
|
+
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
|
|
61
|
+
|
|
62
|
+
&::before {
|
|
63
|
+
content: '';
|
|
64
|
+
display: block;
|
|
65
|
+
background-color: get-color(jasper-3);
|
|
66
|
+
border-left: 16px solid transparent;
|
|
67
|
+
border-right: 16px solid transparent;
|
|
68
|
+
border-bottom: 25px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
input {
|
|
73
|
+
width: 100%;
|
|
74
|
+
display: block;
|
|
75
|
+
appearance: none;
|
|
76
|
+
background-color: get-color(white);
|
|
77
|
+
border: 1px solid get-color(black-coral-6);
|
|
78
|
+
border-radius: $veera-radius-s;
|
|
79
|
+
color: var(--color-black);
|
|
80
|
+
font-size: $veera-font-size-100;
|
|
81
|
+
height: 40px;
|
|
82
|
+
line-height: 24px;
|
|
83
|
+
padding: get-spacing(paldiski);
|
|
84
|
+
|
|
85
|
+
&::placeholder {
|
|
86
|
+
color: get-color(black-coral-6);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:focus {
|
|
90
|
+
outline: none;
|
|
91
|
+
border-color: get-color(sapphire-blue-10);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&--error {
|
|
96
|
+
input {
|
|
97
|
+
border-color: get-color(jasper-10);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&--disabled & {
|
|
102
|
+
input {
|
|
103
|
+
background-color: get-color(black-coral-0);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.react-datepicker {
|
|
109
|
+
font-family: inherit;
|
|
110
|
+
font-size: 14px;
|
|
111
|
+
border: 1px solid get-color(black-coral-6);
|
|
112
|
+
border-radius: 4px;
|
|
113
|
+
|
|
114
|
+
&-popper[data-placement^=bottom] {
|
|
115
|
+
padding: 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&-wrapper {
|
|
119
|
+
display: block;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&__input-container {
|
|
123
|
+
display: block;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&__triangle {
|
|
127
|
+
&::before,
|
|
128
|
+
&::after {
|
|
129
|
+
content: none !important;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&__navigation {
|
|
134
|
+
width: 50px;
|
|
135
|
+
height: 50px;
|
|
136
|
+
top: 0;
|
|
137
|
+
|
|
138
|
+
&:hover {
|
|
139
|
+
background-color: var(--color-bg);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&--previous {
|
|
143
|
+
border-top-left-radius: 4px;
|
|
144
|
+
border-right: 1px solid var(--color-gray);
|
|
145
|
+
left: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&--next {
|
|
149
|
+
border-top-right-radius: 4px;
|
|
150
|
+
border-left: 1px solid var(--color-gray);
|
|
151
|
+
right: 0;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { forwardRef, useId } from 'react';
|
|
2
|
+
import ReactDatePicker, { registerLocale } from 'react-datepicker';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { et } from 'date-fns/locale';
|
|
5
|
+
import { ControllerRenderProps } from 'react-hook-form';
|
|
6
|
+
import {
|
|
7
|
+
MdChevronRight,
|
|
8
|
+
MdChevronLeft,
|
|
9
|
+
MdOutlineToday,
|
|
10
|
+
MdOutlineSchedule,
|
|
11
|
+
} from 'react-icons/md';
|
|
12
|
+
|
|
13
|
+
import { Icon } from '../..';
|
|
14
|
+
import 'react-datepicker/dist/react-datepicker.css';
|
|
15
|
+
import './FormDatepicker.scss';
|
|
16
|
+
|
|
17
|
+
registerLocale('et-EE', et);
|
|
18
|
+
|
|
19
|
+
type FormDatepickerProps = ControllerRenderProps & {
|
|
20
|
+
label: string;
|
|
21
|
+
name: string;
|
|
22
|
+
hideLabel?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
minTime?: Date;
|
|
25
|
+
maxTime?: Date;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
timePicker?: boolean;
|
|
28
|
+
direction?: 'row' | 'column';
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const FormDatepicker = forwardRef<any, FormDatepickerProps>(
|
|
32
|
+
(
|
|
33
|
+
{
|
|
34
|
+
label,
|
|
35
|
+
name,
|
|
36
|
+
hideLabel,
|
|
37
|
+
maxTime,
|
|
38
|
+
minTime,
|
|
39
|
+
disabled,
|
|
40
|
+
placeholder,
|
|
41
|
+
timePicker,
|
|
42
|
+
direction = 'column',
|
|
43
|
+
...rest
|
|
44
|
+
},
|
|
45
|
+
ref
|
|
46
|
+
) => {
|
|
47
|
+
const id = useId();
|
|
48
|
+
const { value, onChange } = rest;
|
|
49
|
+
|
|
50
|
+
const datepickerClasses = clsx(
|
|
51
|
+
'datepicker',
|
|
52
|
+
disabled && 'datepicker--disabled'
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const validMinTime = minTime ? new Date(minTime) : new Date().setHours(0, 0, 0);
|
|
56
|
+
const validMaxTime = maxTime ? new Date(maxTime) : new Date().setHours(23, 45, 0);
|
|
57
|
+
|
|
58
|
+
const handleChange = (date: Date) => {
|
|
59
|
+
if (timePicker) {
|
|
60
|
+
if (date < validMinTime) {
|
|
61
|
+
onChange(validMinTime);
|
|
62
|
+
} else if (date > validMaxTime) {
|
|
63
|
+
onChange(validMaxTime);
|
|
64
|
+
} else {
|
|
65
|
+
onChange(date);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
onChange(date);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div className={datepickerClasses}>
|
|
74
|
+
{label && !hideLabel && (
|
|
75
|
+
<label htmlFor={id} className="datepicker__label">
|
|
76
|
+
{label}
|
|
77
|
+
</label>
|
|
78
|
+
)}
|
|
79
|
+
<div
|
|
80
|
+
className={
|
|
81
|
+
direction === 'column'
|
|
82
|
+
? 'datepicker__wrapper_column'
|
|
83
|
+
: 'datepicker__wrapper_row'
|
|
84
|
+
}
|
|
85
|
+
>
|
|
86
|
+
<ReactDatePicker
|
|
87
|
+
selected={new Date(value)}
|
|
88
|
+
dateFormat={timePicker ? 'HH:mm:ss' : 'dd.MM.yyyy'}
|
|
89
|
+
locale="et-EE"
|
|
90
|
+
placeholderText={placeholder}
|
|
91
|
+
previousMonthButtonLabel={<MdChevronLeft />}
|
|
92
|
+
nextMonthButtonLabel={<MdChevronRight />}
|
|
93
|
+
aria-label={hideLabel ? label : undefined}
|
|
94
|
+
showTimeSelect={timePicker}
|
|
95
|
+
showTimeSelectOnly={timePicker}
|
|
96
|
+
timeIntervals={15}
|
|
97
|
+
timeFormat="HH:mm:ss"
|
|
98
|
+
timeInputLabel=""
|
|
99
|
+
minTime={validMinTime}
|
|
100
|
+
maxTime={validMaxTime}
|
|
101
|
+
portalId="overlay-root"
|
|
102
|
+
disabled={disabled}
|
|
103
|
+
{...rest}
|
|
104
|
+
onChange={handleChange}
|
|
105
|
+
/>
|
|
106
|
+
<Icon
|
|
107
|
+
icon={
|
|
108
|
+
timePicker ? (
|
|
109
|
+
<MdOutlineSchedule color="#5D6071" fontSize={20} />
|
|
110
|
+
) : (
|
|
111
|
+
<MdOutlineToday color="#5D6071" fontSize={20} />
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
size="medium"
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
export default FormDatepicker;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
@import 'src/styles/tools/spacing';
|
|
2
|
+
@import 'src/styles/tools/color';
|
|
3
|
+
@import 'src/styles/settings/variables/other';
|
|
4
|
+
@import 'src/styles/settings/variables/typography';
|
|
5
|
+
|
|
6
|
+
.input {
|
|
7
|
+
$self: &;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: get-spacing(paldiski);
|
|
11
|
+
width: 100%;
|
|
12
|
+
|
|
13
|
+
&__label {
|
|
14
|
+
flex: 0 0 185px;
|
|
15
|
+
font-size: $veera-font-size-100;
|
|
16
|
+
line-height: 24px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__wrapper {
|
|
20
|
+
flex: 1;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: 7px;
|
|
24
|
+
position: relative;
|
|
25
|
+
|
|
26
|
+
.icon {
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 10px;
|
|
29
|
+
right: 10px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__error {
|
|
34
|
+
width: 100%;
|
|
35
|
+
margin-right: 6px;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: get-spacing(paldiski);
|
|
39
|
+
color: get-color(black-coral-20);
|
|
40
|
+
border-radius: $veera-radius-s;
|
|
41
|
+
background-color: get-color(jasper-3);
|
|
42
|
+
font-size: 13px;
|
|
43
|
+
line-height: 20px;
|
|
44
|
+
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
|
|
45
|
+
|
|
46
|
+
&::before {
|
|
47
|
+
content: '';
|
|
48
|
+
display: block;
|
|
49
|
+
background-color: get-color(jasper-3);
|
|
50
|
+
border-left: 16px solid transparent;
|
|
51
|
+
border-right: 16px solid transparent;
|
|
52
|
+
border-bottom: 25px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
input {
|
|
57
|
+
width: 100%;
|
|
58
|
+
display: block;
|
|
59
|
+
appearance: none;
|
|
60
|
+
background-color: get-color(white);
|
|
61
|
+
border: 1px solid get-color(black-coral-6);
|
|
62
|
+
border-radius: $veera-radius-s;
|
|
63
|
+
color: var(--color-black);
|
|
64
|
+
font-size: $veera-font-size-100;
|
|
65
|
+
height: 40px;
|
|
66
|
+
line-height: 24px;
|
|
67
|
+
padding: get-spacing(paldiski);
|
|
68
|
+
|
|
69
|
+
&::placeholder {
|
|
70
|
+
color: get-color(black-coral-6);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:focus {
|
|
74
|
+
outline: none;
|
|
75
|
+
border-color: get-color(sapphire-blue-10);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&--error {
|
|
80
|
+
input {
|
|
81
|
+
border-color: get-color(jasper-10);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&--disabled & {
|
|
86
|
+
input {
|
|
87
|
+
background-color: get-color(black-coral-0);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { forwardRef, InputHTMLAttributes, PropsWithChildren, useId } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import './FormInput.scss';
|
|
4
|
+
import { CHAT_INPUT_LENGTH } from '../../../constants/config';
|
|
5
|
+
|
|
6
|
+
type InputProps = PropsWithChildren<InputHTMLAttributes<HTMLInputElement>> & {
|
|
7
|
+
label: string;
|
|
8
|
+
name: string;
|
|
9
|
+
hideLabel?: boolean;
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const FieldInput = forwardRef<HTMLInputElement, InputProps>(
|
|
15
|
+
(
|
|
16
|
+
{ label, name, disabled, hideLabel, maxLength, className, children, ...rest },
|
|
17
|
+
ref
|
|
18
|
+
) => {
|
|
19
|
+
const id = useId();
|
|
20
|
+
|
|
21
|
+
const inputClasses = clsx('input', disabled && 'input--disabled');
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className={`${inputClasses} ${className}`}>
|
|
25
|
+
{label && !hideLabel && (
|
|
26
|
+
<label htmlFor={id} className="input__label">
|
|
27
|
+
{label}
|
|
28
|
+
</label>
|
|
29
|
+
)}
|
|
30
|
+
<div className="input__wrapper">
|
|
31
|
+
<input
|
|
32
|
+
className={inputClasses}
|
|
33
|
+
name={name}
|
|
34
|
+
maxLength={CHAT_INPUT_LENGTH}
|
|
35
|
+
id={id}
|
|
36
|
+
ref={ref}
|
|
37
|
+
aria-label={hideLabel ? label : undefined}
|
|
38
|
+
{...rest}
|
|
39
|
+
/>
|
|
40
|
+
{children}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export default FieldInput;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@import 'src/styles/tools/spacing';
|
|
2
|
+
@import 'src/styles/tools/color';
|
|
3
|
+
@import 'src/styles/settings/variables/other';
|
|
4
|
+
@import 'src/styles/settings/variables/typography';
|
|
5
|
+
|
|
6
|
+
.radios {
|
|
7
|
+
width: 100%;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: flex-start;
|
|
10
|
+
gap: get-spacing(paldiski);
|
|
11
|
+
|
|
12
|
+
&__label {
|
|
13
|
+
display: block;
|
|
14
|
+
flex: 0 0 185px;
|
|
15
|
+
font-size: $veera-font-size-100;
|
|
16
|
+
line-height: 24px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__wrapper {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: 8px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__item {
|
|
26
|
+
input[type=radio] {
|
|
27
|
+
display: none;
|
|
28
|
+
|
|
29
|
+
+ label {
|
|
30
|
+
display: block;
|
|
31
|
+
padding-left: 32px;
|
|
32
|
+
position: relative;
|
|
33
|
+
font-size: $veera-font-size-100;
|
|
34
|
+
line-height: $veera-line-height-500;
|
|
35
|
+
|
|
36
|
+
&::before {
|
|
37
|
+
content: '';
|
|
38
|
+
display: block;
|
|
39
|
+
width: 16px;
|
|
40
|
+
height: 16px;
|
|
41
|
+
box-shadow: inset 0 0 0 1px get-color(black-coral-2);
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
position: absolute;
|
|
44
|
+
left: 4px;
|
|
45
|
+
top: 4px;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:checked {
|
|
50
|
+
+ label {
|
|
51
|
+
&::before {
|
|
52
|
+
width: 20px;
|
|
53
|
+
height: 20px;
|
|
54
|
+
box-shadow: inset 0 0 0 1px #8F91A8;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&::after {
|
|
58
|
+
content: '';
|
|
59
|
+
display: block;
|
|
60
|
+
width: 10px;
|
|
61
|
+
height: 10px;
|
|
62
|
+
border-radius: 50%;
|
|
63
|
+
background-color: get-color(sapphire-blue-10);
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 9px;
|
|
66
|
+
left: 9px;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FC, useId } from 'react';
|
|
2
|
+
|
|
3
|
+
import './FormRadios.scss';
|
|
4
|
+
|
|
5
|
+
type FormRadiosType = {
|
|
6
|
+
label: string;
|
|
7
|
+
name: string;
|
|
8
|
+
hideLabel?: boolean;
|
|
9
|
+
items: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
onChange: (selectedValue: string) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const FormRadios: FC<FormRadiosType> = ({ label, name, hideLabel, items, onChange }) => {
|
|
17
|
+
const id = useId();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<fieldset className='radios' role='group'>
|
|
21
|
+
{label && !hideLabel && <label className='radios__label'>{label}</label>}
|
|
22
|
+
<div className='radios__wrapper'>
|
|
23
|
+
{items.map((item, index) => (
|
|
24
|
+
<div key={`${item.value}-${index}`} className='radios__item'>
|
|
25
|
+
<input type='radio' name={name} id={`${id}-${item.value}`} value={item.value} onChange={(event) => {
|
|
26
|
+
onChange(event.target.value);
|
|
27
|
+
}} />
|
|
28
|
+
<label htmlFor={`${id}-${item.value}`}>{item.label}</label>
|
|
29
|
+
</div>
|
|
30
|
+
))}
|
|
31
|
+
</div>
|
|
32
|
+
</fieldset>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default FormRadios;
|