@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,10 @@
|
|
|
1
|
+
export interface EmergencyNotice {
|
|
2
|
+
emergencyNoticeText: string;
|
|
3
|
+
emergencyNoticeStartISO: Date | string;
|
|
4
|
+
emergencyNoticeEndISO: Date | string;
|
|
5
|
+
isEmergencyNoticeVisible: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface EmergencyNoticeResponse {
|
|
9
|
+
response: EmergencyNotice;
|
|
10
|
+
}
|
package/types/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from "./chat";
|
|
2
|
+
export * from "./authorities";
|
|
3
|
+
export * from "./botConfig";
|
|
4
|
+
export * from "./customerSupportActivity";
|
|
5
|
+
export * from "./deleteChatSettings";
|
|
6
|
+
export * from "./emergencyNotice";
|
|
7
|
+
export * from "./establishment";
|
|
8
|
+
export * from "./mainNavigation";
|
|
9
|
+
export * from "./message";
|
|
10
|
+
export * from "./organizationWorkingTime";
|
|
11
|
+
export * from "./router";
|
|
12
|
+
export * from "./service";
|
|
13
|
+
export * from "./session";
|
|
14
|
+
export * from "./skmConfig";
|
|
15
|
+
export * from "./user";
|
|
16
|
+
export * from "./userInfo";
|
|
17
|
+
export * from "./userProfileSettings";
|
|
18
|
+
export * from "./widgetConfig";
|
package/types/message.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export interface UseSendAttachment {
|
|
2
|
+
successCb?: (data: any) => void;
|
|
3
|
+
errorCb?: (error: any) => void;
|
|
4
|
+
data: {
|
|
5
|
+
chatId: string,
|
|
6
|
+
name: string,
|
|
7
|
+
type: string,
|
|
8
|
+
size: string,
|
|
9
|
+
base64: string,
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface Attachment {
|
|
14
|
+
chatId: string;
|
|
15
|
+
name: string;
|
|
16
|
+
type: AttachmentTypes;
|
|
17
|
+
size: number;
|
|
18
|
+
base64: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface Message {
|
|
22
|
+
id?: string;
|
|
23
|
+
chatId: string;
|
|
24
|
+
content?: string;
|
|
25
|
+
event?: string;
|
|
26
|
+
csaTitle?: string;
|
|
27
|
+
authorId?: string;
|
|
28
|
+
authorTimestamp: string;
|
|
29
|
+
authorFirstName: string;
|
|
30
|
+
authorLastName?: string;
|
|
31
|
+
authorRole: string;
|
|
32
|
+
forwardedByUser: string;
|
|
33
|
+
forwardedFromCsa: string;
|
|
34
|
+
forwardedToCsa: string;
|
|
35
|
+
originalBaseId?: string;
|
|
36
|
+
originalCreated?: string;
|
|
37
|
+
rating?: string;
|
|
38
|
+
created?: string;
|
|
39
|
+
preview?: string;
|
|
40
|
+
updated?: string;
|
|
41
|
+
buttons?: string;
|
|
42
|
+
options?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface MessagePreviewSseResponse {
|
|
46
|
+
data: Message;
|
|
47
|
+
origin: string;
|
|
48
|
+
type: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export enum AttachmentTypes {
|
|
52
|
+
PDF = 'application/pdf',
|
|
53
|
+
PNG = 'image/png',
|
|
54
|
+
JPEG = 'image/jpeg',
|
|
55
|
+
TXT = 'text/plain',
|
|
56
|
+
DOCX = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
57
|
+
ODT = 'application/vnd.oasis.opendocument.text',
|
|
58
|
+
XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
59
|
+
ODS = 'ods',
|
|
60
|
+
CDOC = 'application/x-cdoc',
|
|
61
|
+
ASICE = 'application/vnd.etsi.asic-e+zip',
|
|
62
|
+
MP3 = 'audio/mpeg',
|
|
63
|
+
WAV = 'audio/wav',
|
|
64
|
+
M4A = 'audio/x-m4a',
|
|
65
|
+
MP4 = 'video/mp4',
|
|
66
|
+
WEBM = 'video/webm',
|
|
67
|
+
OGG = 'video/ogg',
|
|
68
|
+
MOV = 'video/quicktime',
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface MessageButton {
|
|
72
|
+
title: string;
|
|
73
|
+
payload: string;
|
|
74
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface OrganizationWorkingTime {
|
|
2
|
+
organizationMondayWorkingTimeStartISO: Date | string;
|
|
3
|
+
organizationMondayWorkingTimeEndISO: Date | string;
|
|
4
|
+
organizationTuesdayWorkingTimeStartISO: Date | string;
|
|
5
|
+
organizationTuesdayWorkingTimeEndISO: Date | string;
|
|
6
|
+
organizationWednesdayWorkingTimeStartISO: Date | string;
|
|
7
|
+
organizationWednesdayWorkingTimeEndISO: Date | string;
|
|
8
|
+
organizationThursdayWorkingTimeStartISO: Date | string;
|
|
9
|
+
organizationThursdayWorkingTimeEndISO: Date | string;
|
|
10
|
+
organizationFridayWorkingTimeStartISO: Date | string;
|
|
11
|
+
organizationFridayWorkingTimeEndISO: Date | string;
|
|
12
|
+
organizationSaturdayWorkingTimeStartISO: Date | string;
|
|
13
|
+
organizationSaturdayWorkingTimeEndISO: Date | string;
|
|
14
|
+
organizationSundayWorkingTimeStartISO: Date | string;
|
|
15
|
+
organizationSundayWorkingTimeEndISO: Date | string;
|
|
16
|
+
organizationAllWeekdaysTimeStartISO: Date | string;
|
|
17
|
+
organizationAllWeekdaysTimeEndISO: Date | string;
|
|
18
|
+
organizationWorkingTimeWeekdays: string[];
|
|
19
|
+
organizationWorkingTimeNationalHolidays: boolean;
|
|
20
|
+
organizationClosedOnWeekEnds: boolean;
|
|
21
|
+
organizationTheSameOnAllWorkingDays: boolean;
|
|
22
|
+
organizationWorkingAllTime: boolean;
|
|
23
|
+
organizationNoCsaAskForContacts: boolean;
|
|
24
|
+
organizationNoCsaAvailableMessage: string;
|
|
25
|
+
organizationOutsideWorkingHoursAskForContacts: boolean;
|
|
26
|
+
organizationOutsideWorkingHoursMessage: string;
|
|
27
|
+
}
|
package/types/router.ts
ADDED
package/types/service.ts
ADDED
package/types/session.ts
ADDED
package/types/user.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ROLES } from 'utils/constants';
|
|
2
|
+
|
|
3
|
+
export interface User {
|
|
4
|
+
login?: string;
|
|
5
|
+
fullName?: string;
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
idCode: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
csaTitle: string;
|
|
11
|
+
csaEmail: string;
|
|
12
|
+
authorities: ROLES[];
|
|
13
|
+
customerSupportStatus: 'online' | 'idle' | 'offline';
|
|
14
|
+
department: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface UserDTO
|
|
18
|
+
extends Pick<
|
|
19
|
+
User,
|
|
20
|
+
| 'login'
|
|
21
|
+
| 'firstName'
|
|
22
|
+
| 'lastName'
|
|
23
|
+
| 'fullName'
|
|
24
|
+
| 'idCode'
|
|
25
|
+
| 'authorities'
|
|
26
|
+
| 'displayName'
|
|
27
|
+
| 'csaTitle'
|
|
28
|
+
| 'csaEmail'
|
|
29
|
+
| 'department'
|
|
30
|
+
> {}
|
|
31
|
+
|
|
32
|
+
export interface UserSearchFilters {
|
|
33
|
+
search_full_name: string;
|
|
34
|
+
search_id_code: string;
|
|
35
|
+
search_display_name: string;
|
|
36
|
+
search_csa_title: string;
|
|
37
|
+
search_csa_email: string;
|
|
38
|
+
search_authority: string;
|
|
39
|
+
search_department: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UserInfo {
|
|
2
|
+
JWTCreated: string;
|
|
3
|
+
JWTExpirationTimestamp: string;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
loggedInDate: string;
|
|
7
|
+
loginExpireDate: string;
|
|
8
|
+
authMethod: string;
|
|
9
|
+
fullName: string;
|
|
10
|
+
authorities: string[];
|
|
11
|
+
displayName: string;
|
|
12
|
+
idCode: string;
|
|
13
|
+
email: string;
|
|
14
|
+
csaEmail: string;
|
|
15
|
+
csaTitle: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface UserProfileSettings {
|
|
2
|
+
userId: number;
|
|
3
|
+
forwardedChatPopupNotifications: boolean;
|
|
4
|
+
forwardedChatSoundNotifications: boolean;
|
|
5
|
+
forwardedChatEmailNotifications: boolean;
|
|
6
|
+
newChatPopupNotifications: boolean;
|
|
7
|
+
newChatSoundNotifications: boolean;
|
|
8
|
+
newChatEmailNotifications: boolean;
|
|
9
|
+
useAutocorrect: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
.btn {
|
|
7
|
+
$self: &;
|
|
8
|
+
appearance: none;
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
background: none;
|
|
12
|
+
border: 0;
|
|
13
|
+
color: get-color(black-coral-0);
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
font: inherit;
|
|
16
|
+
gap: get-spacing(rapla);
|
|
17
|
+
overflow: visible;
|
|
18
|
+
padding: 8px 40px;
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
font-size: $veera-font-size-100;
|
|
21
|
+
line-height: 24px;
|
|
22
|
+
border-radius: 20px;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
|
|
25
|
+
&:focus {
|
|
26
|
+
outline: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&--disabled {
|
|
30
|
+
cursor: not-allowed;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&--primary {
|
|
34
|
+
background-color: get-color(sapphire-blue-10);
|
|
35
|
+
|
|
36
|
+
&:hover,
|
|
37
|
+
&:active {
|
|
38
|
+
background-color: get-color(sapphire-blue-13);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:focus {
|
|
42
|
+
box-shadow: inset 0 0 0 2px get-color(sapphire-blue-3)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&#{$self}--disabled {
|
|
46
|
+
background-color: get-color(black-coral-2);
|
|
47
|
+
color: get-color(white);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&--secondary {
|
|
52
|
+
background-color: get-color(white);
|
|
53
|
+
box-shadow: inset 0 0 0 2px get-color(black-coral-10);
|
|
54
|
+
color: get-color(black-coral-15);
|
|
55
|
+
|
|
56
|
+
&:hover,
|
|
57
|
+
&:active {
|
|
58
|
+
box-shadow: inset 0 0 0 2px get-color(black-coral-2);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:focus {
|
|
62
|
+
box-shadow: inset 0 0 0 2px get-color(sapphire-blue-10);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&#{$self}--disabled {
|
|
66
|
+
background-color: get-color(black-coral-2);
|
|
67
|
+
color: get-color(black-coral-6);
|
|
68
|
+
box-shadow: inset 0 0 0 2px get-color(black-coral-2);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&--text {
|
|
73
|
+
padding: 0;
|
|
74
|
+
background: none;
|
|
75
|
+
color: get-color(sapphire-blue-10);
|
|
76
|
+
gap: 4px;
|
|
77
|
+
border-radius: 0;
|
|
78
|
+
|
|
79
|
+
&:hover,
|
|
80
|
+
&:active {
|
|
81
|
+
text-decoration: underline;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&:focus {
|
|
85
|
+
box-shadow: inset 0 0 0 2px get-color(sapphire-blue-10);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&#{$self}--disabled {
|
|
89
|
+
color: get-color(black-coral-6);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&--icon {
|
|
94
|
+
width: 36px;
|
|
95
|
+
height: 36px;
|
|
96
|
+
padding: 0;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
color: get-color(black-coral-10);
|
|
99
|
+
font-size: 24px;
|
|
100
|
+
|
|
101
|
+
&:hover,
|
|
102
|
+
&:active {
|
|
103
|
+
color: get-color(sapphire-blue-10);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&:focus {
|
|
107
|
+
color: get-color(sapphire-blue-10);
|
|
108
|
+
box-shadow: inset 0 0 0 2px get-color(sapphire-blue-10);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&--error {
|
|
113
|
+
background-color: get-color(jasper-10);
|
|
114
|
+
|
|
115
|
+
&:hover,
|
|
116
|
+
&:active {
|
|
117
|
+
background-color: get-color(jasper-12);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&:focus {
|
|
121
|
+
box-shadow: inset 0 0 0 2px get-color(jasper-13);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&#{$self}--disabled {
|
|
125
|
+
background-color: get-color(black-coral-2);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&--success {
|
|
130
|
+
background-color: get-color(sea-green-10);
|
|
131
|
+
|
|
132
|
+
&:hover,
|
|
133
|
+
&:active {
|
|
134
|
+
background-color: get-color(sea-green-12);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&:focus {
|
|
138
|
+
background-color: get-color(sea-green-10);
|
|
139
|
+
box-shadow: inset 0 0 0 2px get-color(sea-green-12);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&#{$self}--disabled {
|
|
143
|
+
background-color: get-color(black-coral-2);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&--s {
|
|
148
|
+
padding: 4.5px 24px;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { ButtonHTMLAttributes, FC, PropsWithChildren, useRef } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
|
|
4
|
+
import './Button.scss';
|
|
5
|
+
|
|
6
|
+
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
7
|
+
appearance?: 'primary' | 'secondary' | 'text' | 'icon' | 'error' | 'success';
|
|
8
|
+
size?: 'm' | 's';
|
|
9
|
+
disabledWithoutStyle?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Button: FC<PropsWithChildren<ButtonProps>> = ({
|
|
13
|
+
appearance = 'primary',
|
|
14
|
+
size = 'm',
|
|
15
|
+
disabled,
|
|
16
|
+
disabledWithoutStyle = false,
|
|
17
|
+
children,
|
|
18
|
+
...rest
|
|
19
|
+
}) => {
|
|
20
|
+
const ref = useRef<HTMLButtonElement>(null);
|
|
21
|
+
|
|
22
|
+
const buttonClasses = clsx(
|
|
23
|
+
'btn',
|
|
24
|
+
`btn--${appearance}`,
|
|
25
|
+
`btn--${size}`,
|
|
26
|
+
disabled && 'btn--disabled'
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<button
|
|
31
|
+
className={buttonClasses}
|
|
32
|
+
ref={ref}
|
|
33
|
+
disabled={disabled || disabledWithoutStyle}
|
|
34
|
+
{...rest}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</button>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default Button;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@import 'src/styles/tools/color';
|
|
2
|
+
|
|
3
|
+
.button-container {
|
|
4
|
+
display: flex;
|
|
5
|
+
gap: 12px;
|
|
6
|
+
margin: 0.3rem 0 0.7rem 0;
|
|
7
|
+
|
|
8
|
+
span {
|
|
9
|
+
padding: 0 0.5rem;
|
|
10
|
+
background-color: get-color(sea-green-12);
|
|
11
|
+
color: get-color(white);
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
box-shadow: 2px 1px 4px rgb(159, 159, 159);
|
|
14
|
+
opacity: 0.7;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { MessageButton } from 'types/message';
|
|
3
|
+
import './ButtonMessage.scss';
|
|
4
|
+
|
|
5
|
+
type ButtonMessageProps = {
|
|
6
|
+
buttons: MessageButton[];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const ButtonMessage: FC<ButtonMessageProps> = ({ buttons }) => {
|
|
10
|
+
return (
|
|
11
|
+
<div className='button-container'>
|
|
12
|
+
{buttons.map(({title, payload}) =>
|
|
13
|
+
<span key={title}>{title}({payload})</span>
|
|
14
|
+
)}
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default ButtonMessage;
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
.card {
|
|
7
|
+
$self: &;
|
|
8
|
+
background-color: get-color(white);
|
|
9
|
+
border: 1px solid get-color(black-coral-2);
|
|
10
|
+
border-radius: $veera-radius-s;
|
|
11
|
+
max-height: 80vh;
|
|
12
|
+
overflow-y: visible;
|
|
13
|
+
|
|
14
|
+
&--borderless {
|
|
15
|
+
border: 0;
|
|
16
|
+
border-radius: 0;
|
|
17
|
+
|
|
18
|
+
#{$self}__header {
|
|
19
|
+
border-radius: 0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&--scrollable {
|
|
24
|
+
overflow-y: auto;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__header,
|
|
28
|
+
&__body,
|
|
29
|
+
&__footer {
|
|
30
|
+
padding: get-spacing(haapsalu);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__header {
|
|
34
|
+
border-bottom: 1px solid get-color(black-coral-2);
|
|
35
|
+
background-color: get-color(extra-light);
|
|
36
|
+
border-radius: $veera-radius-s $veera-radius-s 0 0;
|
|
37
|
+
|
|
38
|
+
&.white {
|
|
39
|
+
background-color: white;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__body {
|
|
44
|
+
&.divided {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
padding-left: 0px;
|
|
48
|
+
padding-right: 0px;
|
|
49
|
+
|
|
50
|
+
> :not(:last-child) {
|
|
51
|
+
margin-bottom: get-spacing(haapsalu);
|
|
52
|
+
border-bottom: 1px solid get-color(black-coral-2);
|
|
53
|
+
padding-bottom: get-spacing(haapsalu);
|
|
54
|
+
padding-left: get-spacing(haapsalu);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
> :is(:last-child) {
|
|
58
|
+
padding-left: get-spacing(haapsalu);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&__footer {
|
|
64
|
+
border-top: 1px solid get-color(black-coral-2);
|
|
65
|
+
position: sticky;
|
|
66
|
+
bottom: 0;
|
|
67
|
+
background-color: get-color(white);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { FC, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
|
|
4
|
+
import './Card.scss';
|
|
5
|
+
|
|
6
|
+
type CardProps = {
|
|
7
|
+
header?: ReactNode;
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
borderless?: boolean;
|
|
10
|
+
isHeaderLight?: boolean;
|
|
11
|
+
isBodyDivided?: boolean;
|
|
12
|
+
isScrollable?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Card: FC<PropsWithChildren<CardProps>> = ({
|
|
16
|
+
header,
|
|
17
|
+
footer,
|
|
18
|
+
borderless,
|
|
19
|
+
isHeaderLight,
|
|
20
|
+
isBodyDivided,
|
|
21
|
+
isScrollable = false,
|
|
22
|
+
children,
|
|
23
|
+
}) => {
|
|
24
|
+
return (
|
|
25
|
+
<div className={clsx('card', { 'card--borderless': borderless, 'card--scrollable': isScrollable })}>
|
|
26
|
+
{header && (
|
|
27
|
+
<div className={`card__header ${isHeaderLight ? 'white' : ''}`}>
|
|
28
|
+
{header}
|
|
29
|
+
</div>
|
|
30
|
+
)}
|
|
31
|
+
<div className={`card__body ${isBodyDivided ? 'divided' : ''}`}>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
{footer && <div className="card__footer">{footer}</div>}
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default Card;
|