@addsign/moje-agenda-shared-lib 1.0.61 → 2.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/dist/Dialog-IPFWYptw.js +421 -0
- package/dist/Dialog-IPFWYptw.js.map +1 -0
- package/dist/assets/style.css +4374 -0
- package/dist/assets/tailwind.css +1249 -1231
- package/dist/components/Button.js +1 -1
- package/dist/components/datatable/DataTable.js +2 -3
- package/dist/components/datatable/DataTable.js.map +1 -1
- package/dist/components/datatable/DataTableServer.js +2 -3
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +2 -3
- package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBarServer.js +2 -3
- package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
- package/dist/components/form/FileInput.js +2 -3
- package/dist/components/form/FileInput.js.map +1 -1
- package/dist/components/form/FileInputMultiple.js +2 -3
- package/dist/components/form/FileInputMultiple.js.map +1 -1
- package/dist/components/form/FormField.js +2 -3
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/form/PositionsSelectorSingle.js +2 -3
- package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
- package/dist/components/form/SelectField.js +2 -3
- package/dist/components/form/SelectField.js.map +1 -1
- package/dist/components/profiles/ProfileOverview.js +2 -3
- package/dist/components/profiles/ProfileOverview.js.map +1 -1
- package/dist/components/ui/Combobox.d.ts +14 -1
- package/dist/components/ui/Combobox.js +122 -98
- package/dist/components/ui/Combobox.js.map +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/command.js.map +1 -1
- package/dist/index-BF3Kkq7m.js +2212 -0
- package/dist/index-BF3Kkq7m.js.map +1 -0
- package/dist/index-Bm-YZac9.js +28864 -0
- package/dist/index-Bm-YZac9.js.map +1 -0
- package/dist/index-C4pkvuV-.js +1395 -0
- package/dist/index-C4pkvuV-.js.map +1 -0
- package/dist/index-M6rMtqtn.js +2203 -0
- package/dist/index-M6rMtqtn.js.map +1 -0
- package/dist/index.es-XWsfbnWC.js +9628 -0
- package/dist/index.es-XWsfbnWC.js.map +1 -0
- package/dist/jspdf.plugin.autotable-DXW3wQb-.js +11475 -0
- package/dist/jspdf.plugin.autotable-DXW3wQb-.js.map +1 -0
- package/dist/main.js +2 -5
- package/dist/main.js.map +1 -1
- package/dist/tailwind-l0sNRNKZ.js +2 -0
- package/dist/tailwind-l0sNRNKZ.js.map +1 -0
- package/lib/components/Button.tsx +57 -0
- package/lib/components/Calendar.tsx +242 -0
- package/lib/components/ConfirmationModalDialog.tsx +115 -0
- package/lib/components/Modal.tsx +73 -0
- package/lib/components/ModalDialog.tsx +63 -0
- package/lib/components/Spinner.tsx +25 -0
- package/lib/components/SpinnerIcon.tsx +12 -0
- package/lib/components/datatable/DataTable.tsx +442 -0
- package/lib/components/datatable/DataTableServer.tsx +939 -0
- package/lib/components/datatable/DatatableSettings.tsx +48 -0
- package/lib/components/datatable/Resizable.tsx +99 -0
- package/lib/components/datatable/types.ts +33 -0
- package/lib/components/form/AutocompleteSearchBar.tsx +424 -0
- package/lib/components/form/AutocompleteSearchBarServer.tsx +257 -0
- package/lib/components/form/DateField.tsx +124 -0
- package/lib/components/form/DateRangeField.tsx +116 -0
- package/lib/components/form/FileInput.tsx +188 -0
- package/lib/components/form/FileInputMultiple.tsx +186 -0
- package/lib/components/form/FormField.tsx +371 -0
- package/lib/components/form/InputField.tsx +230 -0
- package/lib/components/form/PositionsSelectorSingle.tsx +266 -0
- package/lib/components/form/RadioGroup.tsx +64 -0
- package/lib/components/form/SelectField.tsx +267 -0
- package/lib/components/layout/IconInCircle.tsx +29 -0
- package/lib/components/layout/PageTitle.tsx +19 -0
- package/lib/components/layout/SectionTitle.tsx +22 -0
- package/lib/components/profiles/ProfileOverview.tsx +212 -0
- package/lib/components/ui/Calendar.tsx +68 -0
- package/lib/components/ui/Combobox.tsx +175 -0
- package/lib/components/ui/DatePicker.tsx +124 -0
- package/lib/components/ui/DateTimePicker.tsx +187 -0
- package/lib/components/ui/Dialog.tsx +118 -0
- package/lib/components/ui/ScrollArea.tsx +45 -0
- package/lib/components/ui/button.tsx +56 -0
- package/lib/components/ui/command.tsx +153 -0
- package/lib/components/ui/form.tsx +177 -0
- package/lib/components/ui/input.tsx +22 -0
- package/lib/components/ui/label.tsx +24 -0
- package/lib/components/ui/popover.tsx +31 -0
- package/lib/components/ui/radioGroup.tsx +44 -0
- package/lib/components/ui/select.tsx +158 -0
- package/lib/contexts/FederationContext.tsx +28 -0
- package/lib/contexts/useFederationContext.ts +4 -0
- package/lib/css/tailwind.css +10 -0
- package/lib/fonts/arial.ts +3 -0
- package/lib/fonts/arialBold.ts +4 -0
- package/lib/main.ts +64 -0
- package/lib/types.ts +492 -0
- package/lib/utils/PdfManager.ts +224 -0
- package/lib/utils/getFullName.tsx +83 -0
- package/lib/utils/getIntersectingDays.ts +28 -0
- package/lib/utils/handleErrors.ts +28 -0
- package/lib/utils/hasRightInModule.ts +17 -0
- package/lib/utils/hasRole.ts +12 -0
- package/lib/utils/utils.ts +6 -0
- package/lib/vite-env.d.ts +1 -0
- package/package.json +3 -2
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./tailwind-l0sNRNKZ.js";
|
|
2
2
|
import { default as default2 } from "./components/Button.js";
|
|
3
3
|
import { default as default3 } from "./components/form/AutocompleteSearchBar.js";
|
|
4
4
|
import { default as default4 } from "./components/form/AutocompleteSearchBarServer.js";
|
|
@@ -36,10 +36,7 @@ import { Input } from "./components/ui/input.js";
|
|
|
36
36
|
import { Form, FormControl, FormDescription, FormFieldCN, FormItem, FormLabel, FormMessage, useFormField } from "./components/ui/form.js";
|
|
37
37
|
import { RadioGroupCN, RadioGroupItem } from "./components/ui/radioGroup.js";
|
|
38
38
|
import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "./components/ui/command.js";
|
|
39
|
-
import "
|
|
40
|
-
import "react";
|
|
41
|
-
import "./components/ui/button.js";
|
|
42
|
-
import "./components/ui/popover.js";
|
|
39
|
+
import "./components/ui/Combobox.js";
|
|
43
40
|
import { C } from "./Calendar-DWT4e7Th.js";
|
|
44
41
|
import { default as default22 } from "./components/ui/DateTimePicker.js";
|
|
45
42
|
import { default as default23 } from "./components/ui/DatePicker.js";
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind-l0sNRNKZ.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import "../css/tailwind.css";
|
|
3
|
+
import Spinner from "./Spinner";
|
|
4
|
+
|
|
5
|
+
type ButtonVariant =
|
|
6
|
+
| "primary"
|
|
7
|
+
| "secondary"
|
|
8
|
+
| "transparent"
|
|
9
|
+
| "success"
|
|
10
|
+
| "danger"
|
|
11
|
+
| "warning"
|
|
12
|
+
| "icon";
|
|
13
|
+
|
|
14
|
+
interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
15
|
+
variant?: ButtonVariant;
|
|
16
|
+
isLoading?: boolean;
|
|
17
|
+
}
|
|
18
|
+
const commonStyles =
|
|
19
|
+
" py-1 px-4 leading-[32px] min-h-[32px] w-fit rounded-lg whitespace-nowrap font-medium disabled:opacity-50 ";
|
|
20
|
+
const buttonStyles: { [key in ButtonVariant]: string } = {
|
|
21
|
+
primary: "!bg-primary hover:!bg-primary-hover text-primary-text ",
|
|
22
|
+
secondary:
|
|
23
|
+
"!bg-secondary hover:!bg-secondary-hover text-secondary-text border border-secondary-border ",
|
|
24
|
+
transparent:
|
|
25
|
+
"!bg-transparent border border-transparent hover:bg-gray-100 hover:border-gray-200 ",
|
|
26
|
+
success: "!bg-success hover:!bg-success-hover text-success-text ",
|
|
27
|
+
danger: "!bg-danger hover:!bg-danger-hover text-danger-text ",
|
|
28
|
+
warning:
|
|
29
|
+
"!bg-warning hover:!bg-warning-hover text-warning-text border border-warning-border",
|
|
30
|
+
icon: " !rounded-full text-center inline-flex items-center ",
|
|
31
|
+
};
|
|
32
|
+
const Button: React.FC<IButtonProps> = ({
|
|
33
|
+
variant = "primary",
|
|
34
|
+
isLoading = false,
|
|
35
|
+
children,
|
|
36
|
+
onClick,
|
|
37
|
+
className,
|
|
38
|
+
...props
|
|
39
|
+
}) => {
|
|
40
|
+
const classNames = commonStyles + buttonStyles[variant];
|
|
41
|
+
return (
|
|
42
|
+
<button
|
|
43
|
+
className={classNames + " " + (className || " sharedLibraryource ")}
|
|
44
|
+
onClick={onClick}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
{isLoading && (
|
|
49
|
+
<span className="ml-2 inline-flex ">
|
|
50
|
+
<Spinner />{" "}
|
|
51
|
+
</span>
|
|
52
|
+
)}
|
|
53
|
+
</button>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default Button;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import React, { useState, useEffect, useCallback } from "react";
|
|
2
|
+
import { FaChevronLeft, FaChevronRight } from "react-icons/fa";
|
|
3
|
+
|
|
4
|
+
export interface ICalendarItem {
|
|
5
|
+
id: number;
|
|
6
|
+
label?: string;
|
|
7
|
+
from: Date;
|
|
8
|
+
to: Date;
|
|
9
|
+
background?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type ICalendarProps = {
|
|
15
|
+
items: ICalendarItem[];
|
|
16
|
+
startingDate?: Date;
|
|
17
|
+
publicHolidays?: string[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Check if a day is within any item's date range
|
|
21
|
+
|
|
22
|
+
const Calendar: React.FunctionComponent<ICalendarProps> = ({
|
|
23
|
+
items,
|
|
24
|
+
startingDate,
|
|
25
|
+
publicHolidays,
|
|
26
|
+
}) => {
|
|
27
|
+
const [currentMonth, setCurrentMonth] = useState(
|
|
28
|
+
startingDate ? startingDate.getMonth() : new Date().getMonth()
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const [currentYear, setCurrentYear] = useState(
|
|
32
|
+
startingDate ? startingDate.getFullYear() : new Date().getFullYear()
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (startingDate) {
|
|
37
|
+
setCurrentMonth(startingDate.getMonth());
|
|
38
|
+
setCurrentYear(startingDate.getFullYear());
|
|
39
|
+
}
|
|
40
|
+
}, [startingDate]);
|
|
41
|
+
const [calendarData, setCalendarData] = useState<
|
|
42
|
+
(string | number | JSX.Element)[][]
|
|
43
|
+
>([]);
|
|
44
|
+
|
|
45
|
+
const monthNames: string[] = [
|
|
46
|
+
"Leden",
|
|
47
|
+
"Únor",
|
|
48
|
+
"Březen",
|
|
49
|
+
"Duben",
|
|
50
|
+
"Květen",
|
|
51
|
+
"Červen",
|
|
52
|
+
"Červenec",
|
|
53
|
+
"Srpen",
|
|
54
|
+
"Září",
|
|
55
|
+
"Říjen",
|
|
56
|
+
"Listopad",
|
|
57
|
+
"Prosinec",
|
|
58
|
+
];
|
|
59
|
+
const dayNames: string[] = [
|
|
60
|
+
"Pondělí",
|
|
61
|
+
"Úterý",
|
|
62
|
+
"Středa",
|
|
63
|
+
"Čtvrtek",
|
|
64
|
+
"Pátek",
|
|
65
|
+
"So",
|
|
66
|
+
"Ne",
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
// Leap year check
|
|
70
|
+
const isLeapYear = (year: number) =>
|
|
71
|
+
(year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
72
|
+
|
|
73
|
+
// Days in each month
|
|
74
|
+
const daysInMonth = useCallback((month: number, year: number) => {
|
|
75
|
+
if (month === 1) {
|
|
76
|
+
// February
|
|
77
|
+
return isLeapYear(year) ? 29 : 28;
|
|
78
|
+
}
|
|
79
|
+
if ([0, 2, 4, 6, 7, 9, 11].includes(month)) {
|
|
80
|
+
// Months with 31 days
|
|
81
|
+
|
|
82
|
+
return 31;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return 30; // Months with 30 days
|
|
86
|
+
}, []);
|
|
87
|
+
|
|
88
|
+
// Generate days for a month
|
|
89
|
+
const generateMonthDays = useCallback(
|
|
90
|
+
(month: number, year: number) => {
|
|
91
|
+
const days = [];
|
|
92
|
+
// const firstDayOfMonth = new Date(year, month, 1).getDay()
|
|
93
|
+
|
|
94
|
+
// Adjusted to make week start from Monday
|
|
95
|
+
let firstDayOfMonth = new Date(year, month, 1).getDay() - 1;
|
|
96
|
+
if (firstDayOfMonth === -1) firstDayOfMonth = 6; // Sunday becomes 6 instead of -1
|
|
97
|
+
|
|
98
|
+
let dayCounter = 1;
|
|
99
|
+
|
|
100
|
+
for (let week = 0; week < 6; week++) {
|
|
101
|
+
const weekDays = [];
|
|
102
|
+
for (let day = 0; day < 7; day++) {
|
|
103
|
+
if (week === 0 && day < firstDayOfMonth) {
|
|
104
|
+
weekDays.push("");
|
|
105
|
+
} else if (dayCounter > daysInMonth(month, year)) {
|
|
106
|
+
weekDays.push("");
|
|
107
|
+
} else {
|
|
108
|
+
weekDays.push(dayCounter++);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
days.push(weekDays);
|
|
112
|
+
}
|
|
113
|
+
return days;
|
|
114
|
+
},
|
|
115
|
+
[daysInMonth]
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
setCalendarData(generateMonthDays(currentMonth, currentYear));
|
|
120
|
+
}, [currentMonth, currentYear, generateMonthDays]);
|
|
121
|
+
|
|
122
|
+
// Navigation handlers
|
|
123
|
+
const goToNextMonth = () => {
|
|
124
|
+
setCurrentMonth((prev) => (prev === 11 ? 0 : prev + 1));
|
|
125
|
+
if (currentMonth === 11) {
|
|
126
|
+
setCurrentYear((prev) => prev + 1);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const goToPreviousMonth = () => {
|
|
131
|
+
setCurrentMonth((prev) => (prev === 0 ? 11 : prev - 1));
|
|
132
|
+
if (currentMonth === 0) {
|
|
133
|
+
setCurrentYear((prev) => prev - 1);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const findItemsForDay = (
|
|
137
|
+
day: number,
|
|
138
|
+
month: number,
|
|
139
|
+
year: number
|
|
140
|
+
): ICalendarItem[] => {
|
|
141
|
+
const date = new Date(year, month, day);
|
|
142
|
+
|
|
143
|
+
return items.filter((item) => date >= item.from && date <= item.to);
|
|
144
|
+
};
|
|
145
|
+
return (
|
|
146
|
+
<div className="flex flex-col bg-white flex-grow text-xs border overflow-hidden ">
|
|
147
|
+
<div className="flex justify-between items-center text-black p-2">
|
|
148
|
+
<div
|
|
149
|
+
onClick={goToPreviousMonth}
|
|
150
|
+
className="mr-5 px-10 py-4 cursor-pointer hover:bg-gray-150 rounded-lg text-sm"
|
|
151
|
+
>
|
|
152
|
+
<FaChevronLeft />
|
|
153
|
+
</div>
|
|
154
|
+
<h2 className="font-semibold text-base">
|
|
155
|
+
{monthNames[currentMonth]} {currentYear}
|
|
156
|
+
</h2>
|
|
157
|
+
|
|
158
|
+
<div
|
|
159
|
+
onClick={goToNextMonth}
|
|
160
|
+
className="px-10 py-4 cursor-pointer hover:bg-gray-150 rounded-lg text-sm"
|
|
161
|
+
>
|
|
162
|
+
<FaChevronRight />
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
<div className="grid grid-cols-[repeat(17,minmax(0,1fr))] pb-0 ">
|
|
166
|
+
{dayNames.map((day, index) => (
|
|
167
|
+
<div
|
|
168
|
+
key={index}
|
|
169
|
+
className={
|
|
170
|
+
"py-1 px-4 text-center font-semibold border-t " +
|
|
171
|
+
(index > 4 ? " bg-gray-100 col-span-1 " : " col-span-3 ")
|
|
172
|
+
}
|
|
173
|
+
>
|
|
174
|
+
{day}
|
|
175
|
+
</div>
|
|
176
|
+
))}
|
|
177
|
+
{calendarData.map((week, weekIndex) => (
|
|
178
|
+
<React.Fragment key={weekIndex}>
|
|
179
|
+
{week.map((day, dayIndex) => {
|
|
180
|
+
const itemsForDay = day
|
|
181
|
+
? findItemsForDay(day as number, currentMonth, currentYear)
|
|
182
|
+
: [];
|
|
183
|
+
|
|
184
|
+
const date = new Date(
|
|
185
|
+
currentYear,
|
|
186
|
+
currentMonth,
|
|
187
|
+
(day as number) + 1
|
|
188
|
+
);
|
|
189
|
+
const isPublicHoliday = publicHolidays?.includes(
|
|
190
|
+
date.toISOString().split("T")[0]
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<div
|
|
195
|
+
key={dayIndex}
|
|
196
|
+
className={
|
|
197
|
+
"p-0 align-middle justify-center text-center border-t cursor-not-allowed " +
|
|
198
|
+
(dayIndex > 4
|
|
199
|
+
? "bg-gray-100 col-span-1 "
|
|
200
|
+
: " col-span-3 ") +
|
|
201
|
+
(isPublicHoliday ? " bg-gray-150 " : "") +
|
|
202
|
+
(dayIndex !== 0 ? " border-l " : "")
|
|
203
|
+
}
|
|
204
|
+
>
|
|
205
|
+
{day && <div className="py-1">{day} </div>}
|
|
206
|
+
{itemsForDay.map((item, itemIndex) => (
|
|
207
|
+
<div
|
|
208
|
+
key={itemIndex}
|
|
209
|
+
className={
|
|
210
|
+
"dataItem w-full py-1 text-white text-center mt-0 -pr-1 "
|
|
211
|
+
}
|
|
212
|
+
style={{
|
|
213
|
+
backgroundColor:
|
|
214
|
+
isPublicHoliday || dayIndex > 4
|
|
215
|
+
? "#c1c1c1"
|
|
216
|
+
: item.background,
|
|
217
|
+
color:
|
|
218
|
+
isPublicHoliday || dayIndex > 4
|
|
219
|
+
? "white"
|
|
220
|
+
: item.color,
|
|
221
|
+
}}
|
|
222
|
+
data-tooltip-target={"tooltip-" + item.id}
|
|
223
|
+
title={item.tooltip}
|
|
224
|
+
>
|
|
225
|
+
{!isPublicHoliday && dayIndex < 5 ? (
|
|
226
|
+
item.label
|
|
227
|
+
) : (
|
|
228
|
+
<> </>
|
|
229
|
+
)}
|
|
230
|
+
</div>
|
|
231
|
+
))}
|
|
232
|
+
</div>
|
|
233
|
+
);
|
|
234
|
+
})}
|
|
235
|
+
</React.Fragment>
|
|
236
|
+
))}
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export default Calendar;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { FaRegTrashAlt } from "react-icons/fa";
|
|
3
|
+
import { IoCloseOutline } from "react-icons/io5";
|
|
4
|
+
import Button from "./Button";
|
|
5
|
+
|
|
6
|
+
export interface IConfirmationModalDialogProps {
|
|
7
|
+
title: string;
|
|
8
|
+
confirmAction: () => void;
|
|
9
|
+
cancelAction: () => void;
|
|
10
|
+
description?: string;
|
|
11
|
+
agreeeText?: string;
|
|
12
|
+
cancelText?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function ConfirmationModalDialog({
|
|
16
|
+
title,
|
|
17
|
+
confirmAction,
|
|
18
|
+
cancelAction,
|
|
19
|
+
description,
|
|
20
|
+
agreeeText,
|
|
21
|
+
cancelText,
|
|
22
|
+
}: IConfirmationModalDialogProps) {
|
|
23
|
+
const [isConfirming, setIsConfirming] = useState(false);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
27
|
+
if (event.key === "Escape") {
|
|
28
|
+
cancelAction();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
32
|
+
return () => {
|
|
33
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
34
|
+
};
|
|
35
|
+
}, [cancelAction]);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
className="fixed inset-0 bg-black bg-opacity-25 flex items-center justify-center p-4"
|
|
40
|
+
style={{ zIndex: 50 }}
|
|
41
|
+
>
|
|
42
|
+
<div className="w-96 h-64 bg-white rounded-xl shadow flex-col justify-start items-center inline-flex relative overflow-hidden">
|
|
43
|
+
<div
|
|
44
|
+
id="graphics"
|
|
45
|
+
className="w-80 h-80 left-[-120px] top-[-120px] absolute "
|
|
46
|
+
>
|
|
47
|
+
<div className="w-80 h-80 left-0 top-0 absolute">
|
|
48
|
+
<div className="w-24 h-24 left-[120px] top-[120px] absolute rounded-full border border-gray-150" />
|
|
49
|
+
<div className="w-36 h-36 left-[96px] top-[96px] absolute rounded-full border border-gray-100 " />
|
|
50
|
+
<div className="w-48 h-48 left-[72px] top-[72px] absolute rounded-full border border-gray-100 " />
|
|
51
|
+
<div className="w-60 h-60 left-[48px] top-[48px] absolute rounded-full border border-gray-50 " />
|
|
52
|
+
<div className="w-72 h-72 left-[24px] top-[24px] absolute rounded-full border border-gray-50" />
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<div
|
|
56
|
+
id="header"
|
|
57
|
+
className="self-stretch h-40 flex-col justify-start items-center flex z-40"
|
|
58
|
+
>
|
|
59
|
+
<div className="self-stretch h-40 px-6 pt-6 flex-col justify-start items-start gap-4 flex">
|
|
60
|
+
<div className="w-12 h-12 relative bg-red-100 rounded-full">
|
|
61
|
+
<FaRegTrashAlt className="w-6 h-6 left-[12px] top-[12px] absolute" />
|
|
62
|
+
</div>
|
|
63
|
+
<div className="self-stretch h-16 flex-col justify-start items-start gap-1 flex">
|
|
64
|
+
<div className="self-stretch text-gray-900 text-lg font-semibold font-['Inter'] leading-7">
|
|
65
|
+
{title}
|
|
66
|
+
</div>
|
|
67
|
+
<div className="self-stretch text-slate-600 text-sm font-normal font-['Open Sans'] leading-tight">
|
|
68
|
+
{description}
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
<div
|
|
73
|
+
className="w-11 h-11 p-2 right-0 top-[16px] absolute rounded-full justify-center items-center inline-flex mr-4 hover:bg-gray-100"
|
|
74
|
+
onClick={cancelAction}
|
|
75
|
+
>
|
|
76
|
+
<IoCloseOutline className="w-6 h-6 relative text-gray-400" />
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<div
|
|
80
|
+
id="actions"
|
|
81
|
+
className="self-stretch h-24 pt-8 flex-col justify-start items-start flex z-40"
|
|
82
|
+
>
|
|
83
|
+
<div className="self-stretch px-6 pb-6 justify-start items-start gap-3 flex">
|
|
84
|
+
<Button
|
|
85
|
+
id="ConfirmationModalDialog:back"
|
|
86
|
+
type="button"
|
|
87
|
+
variant="secondary"
|
|
88
|
+
onClick={cancelAction}
|
|
89
|
+
className="flex-1"
|
|
90
|
+
>
|
|
91
|
+
{cancelText || "Zrušit"}
|
|
92
|
+
</Button>
|
|
93
|
+
<Button
|
|
94
|
+
id="ConfirmationModalDialog:agree"
|
|
95
|
+
type="button"
|
|
96
|
+
variant="danger"
|
|
97
|
+
onClick={() => {
|
|
98
|
+
if (!isConfirming) {
|
|
99
|
+
setIsConfirming(true);
|
|
100
|
+
confirmAction();
|
|
101
|
+
}
|
|
102
|
+
}}
|
|
103
|
+
disabled={isConfirming}
|
|
104
|
+
className="flex-1"
|
|
105
|
+
>
|
|
106
|
+
{agreeeText || "OK"}{" "}
|
|
107
|
+
</Button>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export default ConfirmationModalDialog;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { FaRegTrashAlt } from "react-icons/fa";
|
|
2
|
+
import Button from "./Button";
|
|
3
|
+
|
|
4
|
+
export interface IConfirmationModalDialogProps {
|
|
5
|
+
title: string;
|
|
6
|
+
confirmAction: () => void;
|
|
7
|
+
description?: string;
|
|
8
|
+
agreeeText?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function Modal({
|
|
12
|
+
title,
|
|
13
|
+
confirmAction,
|
|
14
|
+
description,
|
|
15
|
+
agreeeText = "OK",
|
|
16
|
+
}: IConfirmationModalDialogProps) {
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
className="fixed inset-0 bg-black bg-opacity-25 flex items-center justify-center p-4"
|
|
20
|
+
style={{ zIndex: 50 }}
|
|
21
|
+
>
|
|
22
|
+
<div className="w-[500px] h-[300px] bg-white rounded-xl shadow flex-col justify-start items-center inline-flex relative overflow-hidden">
|
|
23
|
+
<div
|
|
24
|
+
id="graphics"
|
|
25
|
+
className="w-80 h-80 left-[-120px] top-[-120px] absolute "
|
|
26
|
+
>
|
|
27
|
+
<div className="w-80 h-80 left-0 top-0 absolute">
|
|
28
|
+
<div className="w-24 h-24 left-[120px] top-[120px] absolute rounded-full border border-gray-150" />
|
|
29
|
+
<div className="w-36 h-36 left-[96px] top-[96px] absolute rounded-full border border-gray-100 " />
|
|
30
|
+
<div className="w-48 h-48 left-[72px] top-[72px] absolute rounded-full border border-gray-100 " />
|
|
31
|
+
<div className="w-60 h-60 left-[48px] top-[48px] absolute rounded-full border border-gray-50 " />
|
|
32
|
+
<div className="w-72 h-72 left-[24px] top-[24px] absolute rounded-full border border-gray-50" />
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div
|
|
36
|
+
id="header"
|
|
37
|
+
className="self-stretch h-40 flex-col justify-start items-center flex z-40"
|
|
38
|
+
>
|
|
39
|
+
<div className="self-stretch h-40 px-6 pt-6 flex-col justify-start items-start gap-4 flex">
|
|
40
|
+
<div className="w-12 h-12 relative bg-red-100 rounded-full">
|
|
41
|
+
<FaRegTrashAlt className="w-6 h-6 left-[12px] top-[12px] absolute" />
|
|
42
|
+
</div>
|
|
43
|
+
<div className="self-stretch h-16 flex-col justify-start items-start gap-1 flex">
|
|
44
|
+
<div className="self-stretch text-gray-900 text-lg font-semibold font-['Inter'] leading-7">
|
|
45
|
+
{title}
|
|
46
|
+
</div>
|
|
47
|
+
<div className="self-stretch text-slate-600 text-sm font-normal font-['Open Sans'] leading-tight">
|
|
48
|
+
{description}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div
|
|
54
|
+
id="actions"
|
|
55
|
+
className="self-stretch h-24 pt-8 flex-col justify-start items-start flex z-40"
|
|
56
|
+
>
|
|
57
|
+
<div className="self-stretch px-6 pb-6 justify-start items-start gap-3 flex">
|
|
58
|
+
<Button
|
|
59
|
+
type="button"
|
|
60
|
+
variant="primary"
|
|
61
|
+
onClick={confirmAction}
|
|
62
|
+
className="flex-1"
|
|
63
|
+
>
|
|
64
|
+
{agreeeText || "OK"}{" "}
|
|
65
|
+
</Button>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default Modal;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createRef, useEffect } from "react";
|
|
2
|
+
import { IoCloseOutline } from "react-icons/io5";
|
|
3
|
+
import { useClickAway } from "react-use";
|
|
4
|
+
|
|
5
|
+
export interface IModalDialogProps {
|
|
6
|
+
cancelAction: () => void;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
classNameWrapper?: string;
|
|
9
|
+
closeOnCLickAway?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function ModalDialog({
|
|
13
|
+
cancelAction,
|
|
14
|
+
classNameWrapper,
|
|
15
|
+
children,
|
|
16
|
+
closeOnCLickAway = true,
|
|
17
|
+
}: IModalDialogProps) {
|
|
18
|
+
const ref = createRef<HTMLDivElement>();
|
|
19
|
+
|
|
20
|
+
useClickAway(ref, () => {
|
|
21
|
+
closeOnCLickAway ? cancelAction() : null;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
26
|
+
if (event.key === "Escape") {
|
|
27
|
+
cancelAction();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
31
|
+
return () => {
|
|
32
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
33
|
+
};
|
|
34
|
+
}, [cancelAction]);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className="fixed inset-0 bg-black bg-opacity-25 flex items-center justify-center p-4"
|
|
39
|
+
style={{ zIndex: 50 }}
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
ref={ref}
|
|
43
|
+
className={
|
|
44
|
+
`w-full max-w-[80vw] bg-white rounded-lg shadow-lg flex flex-col justify-start items-center
|
|
45
|
+
relative gap-5 p-5 ` +
|
|
46
|
+
(classNameWrapper ? ` ${classNameWrapper}` : "")
|
|
47
|
+
}
|
|
48
|
+
style={{ maxHeight: "90vh" }}
|
|
49
|
+
>
|
|
50
|
+
<div
|
|
51
|
+
className="w-11 h-11 p-2 right-0 top-[16px] absolute rounded-full justify-center items-center inline-flex mr-4 hover:bg-gray-100 cursor-pointer"
|
|
52
|
+
onClick={cancelAction}
|
|
53
|
+
>
|
|
54
|
+
<IoCloseOutline className="w-6 h-6 relative text-gray-400" />
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
{children && <div className="text-left w-full">{children}</div>}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default ModalDialog;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default function Spinner() {
|
|
2
|
+
return (
|
|
3
|
+
<div className="flex flex-col items-center justify-center align-middle h-full ">
|
|
4
|
+
<div role="status">
|
|
5
|
+
<svg
|
|
6
|
+
aria-hidden="true"
|
|
7
|
+
className="inline w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
|
|
8
|
+
viewBox="0 0 100 101"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
>
|
|
12
|
+
<path
|
|
13
|
+
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
|
18
|
+
fill="currentFill"
|
|
19
|
+
/>
|
|
20
|
+
</svg>
|
|
21
|
+
<span className="sr-only">Loading...</span>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FaSpinner } from "react-icons/fa";
|
|
3
|
+
|
|
4
|
+
type SpinnerIconProps = {
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const SpinnerIcon: React.FC<SpinnerIconProps> = ({ icon = <FaSpinner /> }) => {
|
|
9
|
+
return <div className="animate-spin">{icon}</div>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default SpinnerIcon;
|