@esic-lab/data-core-ui 0.0.13 → 0.0.15
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/index.d.mts +30 -1
- package/dist/index.d.ts +32 -2
- package/dist/index.js +212 -4
- package/dist/index.mjs +197 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1 from 'react';
|
|
3
|
+
import { EventSourceInput } from '@fullcalendar/core';
|
|
2
4
|
|
|
3
5
|
type ColorScale = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
4
6
|
type BaseColor = "primary" | "gray" | "green" | "red" | "yellow" | "blue";
|
|
@@ -99,4 +101,31 @@ interface TopNavBarProps {
|
|
|
99
101
|
}
|
|
100
102
|
declare function TopNavBar({ onClickNoti, logo }: TopNavBarProps): react_jsx_runtime.JSX.Element;
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
interface Column<T> {
|
|
105
|
+
header: string;
|
|
106
|
+
accessor: keyof T | ((row: T) => React$1.ReactNode);
|
|
107
|
+
}
|
|
108
|
+
interface DataTableProps<T> {
|
|
109
|
+
columns: Column<T>[];
|
|
110
|
+
data: T[];
|
|
111
|
+
}
|
|
112
|
+
declare function DataTable<T>({ columns, data }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
113
|
+
|
|
114
|
+
interface CalendarProps {
|
|
115
|
+
events: EventSourceInput | undefined;
|
|
116
|
+
}
|
|
117
|
+
declare function Calendar({ events }: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
118
|
+
|
|
119
|
+
interface TextInputProps {
|
|
120
|
+
label: string;
|
|
121
|
+
placeholder?: string;
|
|
122
|
+
type?: "text" | "password";
|
|
123
|
+
maxLength?: number;
|
|
124
|
+
required?: boolean;
|
|
125
|
+
error?: string;
|
|
126
|
+
value?: string;
|
|
127
|
+
onChange: (value: string) => void;
|
|
128
|
+
}
|
|
129
|
+
declare function TextInput({ label, placeholder, type, maxLength, required, error, value, onChange, }: TextInputProps): react_jsx_runtime.JSX.Element;
|
|
130
|
+
|
|
131
|
+
export { Calendar, Checkbox, CheckboxGroup, DataTable, GhostButton, Loader, MenuNavBar, type MenuNavBarProps, PrimaryButton, Radio, RadioGroup, SecondaryButton, Switch, TextInput, TopNavBar };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1 from 'react';
|
|
3
|
+
import { EventSourceInput } from '@fullcalendar/core';
|
|
2
4
|
|
|
3
5
|
type ColorScale = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
4
6
|
type BaseColor = "primary" | "gray" | "green" | "red" | "yellow" | "blue";
|
|
@@ -95,7 +97,35 @@ declare function MenuNavBar({ menus, onClick }: MenuNavBarProps): react_jsx_runt
|
|
|
95
97
|
|
|
96
98
|
interface TopNavBarProps {
|
|
97
99
|
onClickNoti: () => void;
|
|
100
|
+
logo?: React.ReactNode;
|
|
98
101
|
}
|
|
99
|
-
declare function TopNavBar({ onClickNoti }: TopNavBarProps): react_jsx_runtime.JSX.Element;
|
|
102
|
+
declare function TopNavBar({ onClickNoti, logo }: TopNavBarProps): react_jsx_runtime.JSX.Element;
|
|
100
103
|
|
|
101
|
-
|
|
104
|
+
interface Column<T> {
|
|
105
|
+
header: string;
|
|
106
|
+
accessor: keyof T | ((row: T) => React$1.ReactNode);
|
|
107
|
+
}
|
|
108
|
+
interface DataTableProps<T> {
|
|
109
|
+
columns: Column<T>[];
|
|
110
|
+
data: T[];
|
|
111
|
+
}
|
|
112
|
+
declare function DataTable<T>({ columns, data }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
113
|
+
|
|
114
|
+
interface CalendarProps {
|
|
115
|
+
events: EventSourceInput | undefined;
|
|
116
|
+
}
|
|
117
|
+
declare function Calendar({ events }: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
118
|
+
|
|
119
|
+
interface TextInputProps {
|
|
120
|
+
label: string;
|
|
121
|
+
placeholder?: string;
|
|
122
|
+
type?: "text" | "password";
|
|
123
|
+
maxLength?: number;
|
|
124
|
+
required?: boolean;
|
|
125
|
+
error?: string;
|
|
126
|
+
value?: string;
|
|
127
|
+
onChange: (value: string) => void;
|
|
128
|
+
}
|
|
129
|
+
declare function TextInput({ label, placeholder, type, maxLength, required, error, value, onChange, }: TextInputProps): react_jsx_runtime.JSX.Element;
|
|
130
|
+
|
|
131
|
+
export { Calendar, Checkbox, CheckboxGroup, DataTable, GhostButton, Loader, MenuNavBar, type MenuNavBarProps, PrimaryButton, Radio, RadioGroup, SecondaryButton, Switch, TextInput, TopNavBar };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,13 +17,23 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var index_exports = {};
|
|
22
32
|
__export(index_exports, {
|
|
33
|
+
Calendar: () => Calendar,
|
|
23
34
|
Checkbox: () => Checkbox,
|
|
24
35
|
CheckboxGroup: () => CheckboxGroup,
|
|
36
|
+
DataTable: () => DataTable,
|
|
25
37
|
GhostButton: () => GhostButton,
|
|
26
38
|
Loader: () => Loader,
|
|
27
39
|
MenuNavBar: () => MenuNavBar,
|
|
@@ -30,6 +42,7 @@ __export(index_exports, {
|
|
|
30
42
|
RadioGroup: () => RadioGroup,
|
|
31
43
|
SecondaryButton: () => SecondaryButton,
|
|
32
44
|
Switch: () => Switch,
|
|
45
|
+
TextInput: () => TextInput,
|
|
33
46
|
TopNavBar: () => TopNavBar
|
|
34
47
|
});
|
|
35
48
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -208,12 +221,10 @@ function MenuNavBar({ menus, onClick }) {
|
|
|
208
221
|
// src/NavBar/TopNavBar/TopNavBar.tsx
|
|
209
222
|
var import_icons_react2 = require("@tabler/icons-react");
|
|
210
223
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
211
|
-
|
|
212
|
-
var STOLogo = new URL("../../assets/STO-logo.svg", import_meta.url).href;
|
|
213
|
-
function TopNavBar({ onClickNoti }) {
|
|
224
|
+
function TopNavBar({ onClickNoti, logo }) {
|
|
214
225
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w-full h-full flex", children: [
|
|
215
226
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-[20px] p-[10px]", children: [
|
|
216
|
-
|
|
227
|
+
logo,
|
|
217
228
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "subtitle-1", children: "Project Management" })
|
|
218
229
|
] }),
|
|
219
230
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center ml-auto gap-[20px] p-[10px]", children: [
|
|
@@ -223,10 +234,206 @@ function TopNavBar({ onClickNoti }) {
|
|
|
223
234
|
] })
|
|
224
235
|
] });
|
|
225
236
|
}
|
|
237
|
+
|
|
238
|
+
// src/Table/DataTable/DataTable.tsx
|
|
239
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
240
|
+
function DataTable({ columns, data }) {
|
|
241
|
+
const cols = Math.max(1, columns.length);
|
|
242
|
+
const gridClass = "grid [grid-template-columns:repeat(var(--cols),minmax(0,1fr))]";
|
|
243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "border rounded-md", children: [
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${gridClass} font-semibold border-b border-gray-200`, style: { ["--cols"]: cols }, children: columns.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "py-[8px] px-[16px] body-4 truncate", children: col.header }, i)) }),
|
|
245
|
+
data.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
246
|
+
"div",
|
|
247
|
+
{
|
|
248
|
+
className: `${gridClass} border-b border-gray-200 items-center`,
|
|
249
|
+
style: { ["--cols"]: cols },
|
|
250
|
+
children: columns.map((col, c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "py-[8px] px-[16px] body-3 truncate", children: typeof col.accessor === "function" ? col.accessor(row) : String(row[col.accessor]) }, c))
|
|
251
|
+
},
|
|
252
|
+
i
|
|
253
|
+
))
|
|
254
|
+
] });
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// src/Calendar/Calendar/Calendar.tsx
|
|
258
|
+
var import_react = require("react");
|
|
259
|
+
var import_react2 = __toESM(require("@fullcalendar/react"));
|
|
260
|
+
var import_daygrid = __toESM(require("@fullcalendar/daygrid"));
|
|
261
|
+
var import_timegrid = __toESM(require("@fullcalendar/timegrid"));
|
|
262
|
+
var import_interaction = __toESM(require("@fullcalendar/interaction"));
|
|
263
|
+
var import_en_gb = __toESM(require("@fullcalendar/core/locales/en-gb"));
|
|
264
|
+
var import_icons_react3 = require("@tabler/icons-react");
|
|
265
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
266
|
+
function Calendar({ events }) {
|
|
267
|
+
const calendarRef = (0, import_react.useRef)(null);
|
|
268
|
+
const [monthTitle, setMonthTitle] = (0, import_react.useState)("");
|
|
269
|
+
const updateTitle = () => {
|
|
270
|
+
const calendarApi = calendarRef.current?.getApi();
|
|
271
|
+
if (calendarApi) {
|
|
272
|
+
setMonthTitle(calendarApi.view.title);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
const changeView = (viewName) => {
|
|
276
|
+
const calendarApi = calendarRef.current?.getApi();
|
|
277
|
+
calendarApi?.changeView(viewName);
|
|
278
|
+
};
|
|
279
|
+
(0, import_react.useEffect)(() => {
|
|
280
|
+
updateTitle();
|
|
281
|
+
}, []);
|
|
282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fc w-full h-full", children: [
|
|
283
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex mb-[8px]", children: [
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "headline-5", children: monthTitle }),
|
|
285
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex gap-[10px] ml-auto", children: [
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
287
|
+
"p",
|
|
288
|
+
{
|
|
289
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
290
|
+
onClick: () => {
|
|
291
|
+
calendarRef.current.getApi().today();
|
|
292
|
+
updateTitle();
|
|
293
|
+
},
|
|
294
|
+
children: "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49"
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
298
|
+
"p",
|
|
299
|
+
{
|
|
300
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
301
|
+
onClick: () => {
|
|
302
|
+
changeView("dayGridMonth");
|
|
303
|
+
updateTitle();
|
|
304
|
+
},
|
|
305
|
+
children: "Month"
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
309
|
+
"p",
|
|
310
|
+
{
|
|
311
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
312
|
+
onClick: () => {
|
|
313
|
+
changeView("dayGridWeek");
|
|
314
|
+
updateTitle();
|
|
315
|
+
},
|
|
316
|
+
children: "Week"
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
320
|
+
"p",
|
|
321
|
+
{
|
|
322
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
323
|
+
onClick: () => {
|
|
324
|
+
changeView("timeGridDay");
|
|
325
|
+
updateTitle();
|
|
326
|
+
},
|
|
327
|
+
children: "Day"
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
331
|
+
"button",
|
|
332
|
+
{
|
|
333
|
+
className: "cursor-pointer",
|
|
334
|
+
onClick: () => {
|
|
335
|
+
calendarRef.current?.getApi().prev();
|
|
336
|
+
updateTitle();
|
|
337
|
+
},
|
|
338
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons_react3.IconChevronLeft, {})
|
|
339
|
+
}
|
|
340
|
+
),
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
342
|
+
"button",
|
|
343
|
+
{
|
|
344
|
+
className: "cursor-pointer",
|
|
345
|
+
onClick: () => {
|
|
346
|
+
calendarRef.current?.getApi().next();
|
|
347
|
+
updateTitle();
|
|
348
|
+
},
|
|
349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons_react3.IconChevronRight, {})
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
] })
|
|
353
|
+
] }),
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
355
|
+
import_react2.default,
|
|
356
|
+
{
|
|
357
|
+
ref: calendarRef,
|
|
358
|
+
plugins: [import_daygrid.default, import_timegrid.default, import_interaction.default],
|
|
359
|
+
events,
|
|
360
|
+
locale: import_en_gb.default,
|
|
361
|
+
slotLabelFormat: {
|
|
362
|
+
hour: "numeric",
|
|
363
|
+
minute: "2-digit"
|
|
364
|
+
},
|
|
365
|
+
firstDay: 0,
|
|
366
|
+
fixedWeekCount: false,
|
|
367
|
+
initialView: "dayGridMonth",
|
|
368
|
+
headerToolbar: false,
|
|
369
|
+
dayMaxEventRows: 4,
|
|
370
|
+
moreLinkText: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",
|
|
371
|
+
editable: true,
|
|
372
|
+
eventDrop: (info) => {
|
|
373
|
+
console.log("Event \u0E02\u0E2D\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48:", info.event.startStr);
|
|
374
|
+
},
|
|
375
|
+
eventContent: (arg) => {
|
|
376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "relative top-4 flex items-center h-[28px] p-[4px] border-green-500 border-l-[10px] bg-red-400 rounded text-left text-white caption-1", children: arg.event.title }) });
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
)
|
|
380
|
+
] });
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// src/Input/TextInput/TextInput.tsx
|
|
384
|
+
var import_icons_react4 = require("@tabler/icons-react");
|
|
385
|
+
var import_react3 = require("react");
|
|
386
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
387
|
+
function TextInput({
|
|
388
|
+
label,
|
|
389
|
+
placeholder,
|
|
390
|
+
type = "text",
|
|
391
|
+
maxLength,
|
|
392
|
+
required,
|
|
393
|
+
error,
|
|
394
|
+
value,
|
|
395
|
+
onChange
|
|
396
|
+
}) {
|
|
397
|
+
const [showPassword, setShowPassword] = (0, import_react3.useState)(false);
|
|
398
|
+
const onShowPassword = () => {
|
|
399
|
+
setShowPassword(!showPassword);
|
|
400
|
+
};
|
|
401
|
+
const inputType = type === "password" ? showPassword ? "text" : "password" : "text";
|
|
402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
403
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "body-1 mb-[8px]", children: [
|
|
404
|
+
label,
|
|
405
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-red-600", children: "\xA0*" })
|
|
406
|
+
] }),
|
|
407
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
408
|
+
"div",
|
|
409
|
+
{
|
|
410
|
+
className: `border-[1px] rounded-[8px] w-full h-[40px] flex justify-center items-center ${error ? "border-red-600" : ""}`,
|
|
411
|
+
children: [
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
413
|
+
"input",
|
|
414
|
+
{
|
|
415
|
+
className: "w-full h-full px-[16px]",
|
|
416
|
+
style: { outline: "none" },
|
|
417
|
+
placeholder,
|
|
418
|
+
type: inputType,
|
|
419
|
+
maxLength,
|
|
420
|
+
value,
|
|
421
|
+
onChange: (e) => onChange(e.target.value)
|
|
422
|
+
}
|
|
423
|
+
),
|
|
424
|
+
type === "password" && (showPassword ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons_react4.IconEye, { className: "text-gray-600 mr-[8px] cursor-pointer", onClick: onShowPassword }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons_react4.IconEyeOff, { className: "text-gray-600 mr-[8px] cursor-pointer", onClick: onShowPassword }))
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-red-600 body-1", children: error })
|
|
429
|
+
] });
|
|
430
|
+
}
|
|
226
431
|
// Annotate the CommonJS export names for ESM import in node:
|
|
227
432
|
0 && (module.exports = {
|
|
433
|
+
Calendar,
|
|
228
434
|
Checkbox,
|
|
229
435
|
CheckboxGroup,
|
|
436
|
+
DataTable,
|
|
230
437
|
GhostButton,
|
|
231
438
|
Loader,
|
|
232
439
|
MenuNavBar,
|
|
@@ -235,5 +442,6 @@ function TopNavBar({ onClickNoti }) {
|
|
|
235
442
|
RadioGroup,
|
|
236
443
|
SecondaryButton,
|
|
237
444
|
Switch,
|
|
445
|
+
TextInput,
|
|
238
446
|
TopNavBar
|
|
239
447
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -185,9 +185,205 @@ function TopNavBar({ onClickNoti, logo }) {
|
|
|
185
185
|
] })
|
|
186
186
|
] });
|
|
187
187
|
}
|
|
188
|
+
|
|
189
|
+
// src/Table/DataTable/DataTable.tsx
|
|
190
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
191
|
+
function DataTable({ columns, data }) {
|
|
192
|
+
const cols = Math.max(1, columns.length);
|
|
193
|
+
const gridClass = "grid [grid-template-columns:repeat(var(--cols),minmax(0,1fr))]";
|
|
194
|
+
return /* @__PURE__ */ jsxs9("div", { className: "border rounded-md", children: [
|
|
195
|
+
/* @__PURE__ */ jsx12("div", { className: `${gridClass} font-semibold border-b border-gray-200`, style: { ["--cols"]: cols }, children: columns.map((col, i) => /* @__PURE__ */ jsx12("div", { className: "py-[8px] px-[16px] body-4 truncate", children: col.header }, i)) }),
|
|
196
|
+
data.map((row, i) => /* @__PURE__ */ jsx12(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
className: `${gridClass} border-b border-gray-200 items-center`,
|
|
200
|
+
style: { ["--cols"]: cols },
|
|
201
|
+
children: columns.map((col, c) => /* @__PURE__ */ jsx12("div", { className: "py-[8px] px-[16px] body-3 truncate", children: typeof col.accessor === "function" ? col.accessor(row) : String(row[col.accessor]) }, c))
|
|
202
|
+
},
|
|
203
|
+
i
|
|
204
|
+
))
|
|
205
|
+
] });
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/Calendar/Calendar/Calendar.tsx
|
|
209
|
+
import { useEffect, useRef, useState } from "react";
|
|
210
|
+
import FullCalendar from "@fullcalendar/react";
|
|
211
|
+
import dayGridPlugin from "@fullcalendar/daygrid";
|
|
212
|
+
import timeGridPlugin from "@fullcalendar/timegrid";
|
|
213
|
+
import interactionPlugin from "@fullcalendar/interaction";
|
|
214
|
+
import enLocale from "@fullcalendar/core/locales/en-gb";
|
|
215
|
+
import { IconChevronLeft, IconChevronRight } from "@tabler/icons-react";
|
|
216
|
+
import { Fragment, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
217
|
+
function Calendar({ events }) {
|
|
218
|
+
const calendarRef = useRef(null);
|
|
219
|
+
const [monthTitle, setMonthTitle] = useState("");
|
|
220
|
+
const updateTitle = () => {
|
|
221
|
+
const calendarApi = calendarRef.current?.getApi();
|
|
222
|
+
if (calendarApi) {
|
|
223
|
+
setMonthTitle(calendarApi.view.title);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
const changeView = (viewName) => {
|
|
227
|
+
const calendarApi = calendarRef.current?.getApi();
|
|
228
|
+
calendarApi?.changeView(viewName);
|
|
229
|
+
};
|
|
230
|
+
useEffect(() => {
|
|
231
|
+
updateTitle();
|
|
232
|
+
}, []);
|
|
233
|
+
return /* @__PURE__ */ jsxs10("div", { className: "fc w-full h-full", children: [
|
|
234
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex mb-[8px]", children: [
|
|
235
|
+
/* @__PURE__ */ jsx13("p", { className: "headline-5", children: monthTitle }),
|
|
236
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex gap-[10px] ml-auto", children: [
|
|
237
|
+
/* @__PURE__ */ jsx13(
|
|
238
|
+
"p",
|
|
239
|
+
{
|
|
240
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
241
|
+
onClick: () => {
|
|
242
|
+
calendarRef.current.getApi().today();
|
|
243
|
+
updateTitle();
|
|
244
|
+
},
|
|
245
|
+
children: "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49"
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
/* @__PURE__ */ jsx13(
|
|
249
|
+
"p",
|
|
250
|
+
{
|
|
251
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
252
|
+
onClick: () => {
|
|
253
|
+
changeView("dayGridMonth");
|
|
254
|
+
updateTitle();
|
|
255
|
+
},
|
|
256
|
+
children: "Month"
|
|
257
|
+
}
|
|
258
|
+
),
|
|
259
|
+
/* @__PURE__ */ jsx13(
|
|
260
|
+
"p",
|
|
261
|
+
{
|
|
262
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
263
|
+
onClick: () => {
|
|
264
|
+
changeView("dayGridWeek");
|
|
265
|
+
updateTitle();
|
|
266
|
+
},
|
|
267
|
+
children: "Week"
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
/* @__PURE__ */ jsx13(
|
|
271
|
+
"p",
|
|
272
|
+
{
|
|
273
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
274
|
+
onClick: () => {
|
|
275
|
+
changeView("timeGridDay");
|
|
276
|
+
updateTitle();
|
|
277
|
+
},
|
|
278
|
+
children: "Day"
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ jsx13(
|
|
282
|
+
"button",
|
|
283
|
+
{
|
|
284
|
+
className: "cursor-pointer",
|
|
285
|
+
onClick: () => {
|
|
286
|
+
calendarRef.current?.getApi().prev();
|
|
287
|
+
updateTitle();
|
|
288
|
+
},
|
|
289
|
+
children: /* @__PURE__ */ jsx13(IconChevronLeft, {})
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
/* @__PURE__ */ jsx13(
|
|
293
|
+
"button",
|
|
294
|
+
{
|
|
295
|
+
className: "cursor-pointer",
|
|
296
|
+
onClick: () => {
|
|
297
|
+
calendarRef.current?.getApi().next();
|
|
298
|
+
updateTitle();
|
|
299
|
+
},
|
|
300
|
+
children: /* @__PURE__ */ jsx13(IconChevronRight, {})
|
|
301
|
+
}
|
|
302
|
+
)
|
|
303
|
+
] })
|
|
304
|
+
] }),
|
|
305
|
+
/* @__PURE__ */ jsx13(
|
|
306
|
+
FullCalendar,
|
|
307
|
+
{
|
|
308
|
+
ref: calendarRef,
|
|
309
|
+
plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin],
|
|
310
|
+
events,
|
|
311
|
+
locale: enLocale,
|
|
312
|
+
slotLabelFormat: {
|
|
313
|
+
hour: "numeric",
|
|
314
|
+
minute: "2-digit"
|
|
315
|
+
},
|
|
316
|
+
firstDay: 0,
|
|
317
|
+
fixedWeekCount: false,
|
|
318
|
+
initialView: "dayGridMonth",
|
|
319
|
+
headerToolbar: false,
|
|
320
|
+
dayMaxEventRows: 4,
|
|
321
|
+
moreLinkText: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",
|
|
322
|
+
editable: true,
|
|
323
|
+
eventDrop: (info) => {
|
|
324
|
+
console.log("Event \u0E02\u0E2D\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48:", info.event.startStr);
|
|
325
|
+
},
|
|
326
|
+
eventContent: (arg) => {
|
|
327
|
+
return /* @__PURE__ */ jsx13(Fragment, { children: /* @__PURE__ */ jsx13("div", { className: "relative top-4 flex items-center h-[28px] p-[4px] border-green-500 border-l-[10px] bg-red-400 rounded text-left text-white caption-1", children: arg.event.title }) });
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
] });
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// src/Input/TextInput/TextInput.tsx
|
|
335
|
+
import { IconEye, IconEyeOff } from "@tabler/icons-react";
|
|
336
|
+
import { useState as useState2 } from "react";
|
|
337
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
338
|
+
function TextInput({
|
|
339
|
+
label,
|
|
340
|
+
placeholder,
|
|
341
|
+
type = "text",
|
|
342
|
+
maxLength,
|
|
343
|
+
required,
|
|
344
|
+
error,
|
|
345
|
+
value,
|
|
346
|
+
onChange
|
|
347
|
+
}) {
|
|
348
|
+
const [showPassword, setShowPassword] = useState2(false);
|
|
349
|
+
const onShowPassword = () => {
|
|
350
|
+
setShowPassword(!showPassword);
|
|
351
|
+
};
|
|
352
|
+
const inputType = type === "password" ? showPassword ? "text" : "password" : "text";
|
|
353
|
+
return /* @__PURE__ */ jsxs11("div", { children: [
|
|
354
|
+
/* @__PURE__ */ jsxs11("p", { className: "body-1 mb-[8px]", children: [
|
|
355
|
+
label,
|
|
356
|
+
required && /* @__PURE__ */ jsx14("span", { className: "text-red-600", children: "\xA0*" })
|
|
357
|
+
] }),
|
|
358
|
+
/* @__PURE__ */ jsxs11(
|
|
359
|
+
"div",
|
|
360
|
+
{
|
|
361
|
+
className: `border-[1px] rounded-[8px] w-full h-[40px] flex justify-center items-center ${error ? "border-red-600" : ""}`,
|
|
362
|
+
children: [
|
|
363
|
+
/* @__PURE__ */ jsx14(
|
|
364
|
+
"input",
|
|
365
|
+
{
|
|
366
|
+
className: "w-full h-full px-[16px]",
|
|
367
|
+
style: { outline: "none" },
|
|
368
|
+
placeholder,
|
|
369
|
+
type: inputType,
|
|
370
|
+
maxLength,
|
|
371
|
+
value,
|
|
372
|
+
onChange: (e) => onChange(e.target.value)
|
|
373
|
+
}
|
|
374
|
+
),
|
|
375
|
+
type === "password" && (showPassword ? /* @__PURE__ */ jsx14(IconEye, { className: "text-gray-600 mr-[8px] cursor-pointer", onClick: onShowPassword }) : /* @__PURE__ */ jsx14(IconEyeOff, { className: "text-gray-600 mr-[8px] cursor-pointer", onClick: onShowPassword }))
|
|
376
|
+
]
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
error && /* @__PURE__ */ jsx14("p", { className: "text-red-600 body-1", children: error })
|
|
380
|
+
] });
|
|
381
|
+
}
|
|
188
382
|
export {
|
|
383
|
+
Calendar,
|
|
189
384
|
Checkbox,
|
|
190
385
|
CheckboxGroup,
|
|
386
|
+
DataTable,
|
|
191
387
|
GhostButton,
|
|
192
388
|
Loader,
|
|
193
389
|
MenuNavBar,
|
|
@@ -196,5 +392,6 @@ export {
|
|
|
196
392
|
RadioGroup,
|
|
197
393
|
SecondaryButton,
|
|
198
394
|
Switch,
|
|
395
|
+
TextInput,
|
|
199
396
|
TopNavBar
|
|
200
397
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esic-lab/data-core-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
40
40
|
"storybook": "storybook dev -p 6006",
|
|
41
41
|
"build-storybook": "storybook build",
|
|
42
|
-
"build": "tsup src/index.ts --dts --dts-resolve --format esm --out-dir dist && npm run copy-assets",
|
|
42
|
+
"build": "tsup src/index.ts --dts --dts-resolve --format esm,cjs --out-dir dist && npm run copy-assets",
|
|
43
43
|
"copy-assets": "xcopy src\\assets dist\\assets /E /I /Y"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|