@unifiedsoftware/react-ui 1.0.0 → 1.0.2

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.mjs ADDED
@@ -0,0 +1,1102 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+
33
+ // src/components/Button/Button.tsx
34
+ import clsx from "clsx";
35
+ import { forwardRef } from "react";
36
+ import { jsx, jsxs } from "react/jsx-runtime";
37
+ var prefixCls = "us-";
38
+ var Button = forwardRef(
39
+ (_a, ref) => {
40
+ var _b = _a, { as: Component = "button", children, className, variant = "text", color = "primary", size = "md" } = _b, rest = __objRest(_b, ["as", "children", "className", "variant", "color", "size"]);
41
+ return /* @__PURE__ */ jsxs(
42
+ Component,
43
+ __spreadProps(__spreadValues({
44
+ ref,
45
+ className: clsx(
46
+ `${prefixCls}button`,
47
+ {
48
+ [`${prefixCls}button--${variant}`]: variant,
49
+ [`${prefixCls}button--${color}`]: color,
50
+ [`${prefixCls}button--${size}`]: size
51
+ },
52
+ className
53
+ )
54
+ }, rest), {
55
+ children: [
56
+ /* @__PURE__ */ jsx("div", { className: `${prefixCls}button__elevation` }),
57
+ /* @__PURE__ */ jsx("div", { className: `${prefixCls}button__outline` }),
58
+ children
59
+ ]
60
+ })
61
+ );
62
+ }
63
+ );
64
+
65
+ // src/components/Tabs/Tab.tsx
66
+ import clsx2 from "clsx";
67
+ import mergeRefs from "merge-refs";
68
+ import { forwardRef as forwardRef2, useEffect, useRef } from "react";
69
+
70
+ // src/components/Tabs/TabsContext.ts
71
+ import { createContext, useContext } from "react";
72
+ var TabsContext = createContext(null);
73
+ var useTabs = () => {
74
+ const context = useContext(TabsContext);
75
+ if (!context) {
76
+ throw new Error("`useTabs` must be used within a `<Tabs />`");
77
+ }
78
+ return context;
79
+ };
80
+
81
+ // src/components/Tabs/Tab.tsx
82
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
83
+ var prefixCls2 = "us-";
84
+ var Tab = forwardRef2(
85
+ (_a, ref) => {
86
+ var _b = _a, { as: Component = "div", children, className, value, onClick } = _b, rest = __objRest(_b, ["as", "children", "className", "value", "onClick"]);
87
+ const tabRef = useRef(null);
88
+ const tabs = useTabs();
89
+ const handleClick = (event) => {
90
+ const previousTab = tabs.previousTabRef.current;
91
+ const currentTab = tabRef.current;
92
+ if (!currentTab)
93
+ return;
94
+ if (previousTab) {
95
+ const previousIndicator = previousTab.querySelector(`.${prefixCls2}tab__indicator`);
96
+ const currentIndicator = currentTab.querySelector(`.${prefixCls2}tab__indicator`);
97
+ if (!previousIndicator || !currentIndicator)
98
+ return;
99
+ const from = {};
100
+ const fromRect = previousIndicator.getBoundingClientRect();
101
+ const fromPos = fromRect.left;
102
+ const fromWidth = fromRect.width;
103
+ const toRect = currentIndicator.getBoundingClientRect();
104
+ const toPos = toRect.left;
105
+ const toWidth = toRect.width;
106
+ const scale = fromWidth / toWidth;
107
+ if (scale) {
108
+ from["transform"] = `translateX(${(fromPos - toPos).toFixed(4)}px) scaleX(${scale.toFixed(4)})`;
109
+ } else {
110
+ from["opacity"] = 0;
111
+ }
112
+ const keyframes = [from, { transform: "none" }];
113
+ currentIndicator.animate(keyframes, {
114
+ duration: 250,
115
+ easing: "cubic-bezier(.3,0,0,1)"
116
+ });
117
+ tabs.previousTabRef.current = tabRef.current;
118
+ }
119
+ tabs.previousTabRef.current = tabRef.current;
120
+ tabs.onChange(value);
121
+ onClick == null ? void 0 : onClick(event);
122
+ };
123
+ useEffect(() => {
124
+ if (value === tabs.value) {
125
+ tabs.previousTabRef.current = tabRef.current;
126
+ }
127
+ }, []);
128
+ return /* @__PURE__ */ jsx2(
129
+ Component,
130
+ __spreadProps(__spreadValues({
131
+ ref: mergeRefs(tabRef, ref),
132
+ className: clsx2(`${prefixCls2}tab`, { [`${prefixCls2}tab--selected`]: value === tabs.value }, className),
133
+ onClick: handleClick
134
+ }, rest), {
135
+ children: /* @__PURE__ */ jsxs2("div", { className: `${prefixCls2}tab__content`, children: [
136
+ children,
137
+ /* @__PURE__ */ jsx2("div", { className: `${prefixCls2}tab__indicator` })
138
+ ] })
139
+ })
140
+ );
141
+ }
142
+ );
143
+
144
+ // src/components/Tabs/Tabs.tsx
145
+ import clsx3 from "clsx";
146
+ import { useEffect as useEffect2, useRef as useRef2, useState } from "react";
147
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
148
+ var prefixCls3 = "us-";
149
+ var Tabs = (_a) => {
150
+ var _b = _a, { children, className, value, defaultValue, onChange } = _b, rest = __objRest(_b, ["children", "className", "value", "defaultValue", "onChange"]);
151
+ const previousTabRef = useRef2(null);
152
+ const [selfValue, setSelfValue] = useState(value != null ? value : defaultValue);
153
+ const handleChange = (value2) => {
154
+ setSelfValue(value2);
155
+ onChange == null ? void 0 : onChange(value2);
156
+ };
157
+ useEffect2(() => {
158
+ if (value !== void 0) {
159
+ setSelfValue(value);
160
+ }
161
+ }, [value]);
162
+ return /* @__PURE__ */ jsxs3(TabsContext.Provider, { value: { previousTabRef, value: selfValue, onChange: handleChange }, children: [
163
+ /* @__PURE__ */ jsx3("div", __spreadProps(__spreadValues({ className: clsx3(`${prefixCls3}tabs`, className) }, rest), { children })),
164
+ /* @__PURE__ */ jsx3("div", { className: `${prefixCls3}divider` })
165
+ ] });
166
+ };
167
+
168
+ // src/components/DropdownEnumList.tsx
169
+ import { DropDownList } from "@progress/kendo-react-dropdowns";
170
+ import { useEffect as useEffect3, useState as useState2 } from "react";
171
+ import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
172
+ function parsearDataForComboBox(array, key, text, itemAll = false) {
173
+ const dataForComboBox = [];
174
+ if (itemAll)
175
+ dataForComboBox.push({ key: "", text: "ALL" });
176
+ if (array !== void 0) {
177
+ array.map((a) => {
178
+ dataForComboBox.push({ key: a[key], text: a[text] });
179
+ });
180
+ }
181
+ return dataForComboBox;
182
+ }
183
+ function GetEnumDescription(key, typeEnum, description) {
184
+ const listLabel = description.get(typeEnum);
185
+ let label = void 0;
186
+ if (listLabel != void 0)
187
+ label = listLabel.get(parseInt(key));
188
+ if (label == void 0) {
189
+ label = typeEnum[key];
190
+ return label.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
191
+ }
192
+ return label;
193
+ }
194
+ function EnumToArray(typeEnum, replaceGuionForSpace = true, description) {
195
+ const values = [];
196
+ for (const key in typeEnum) {
197
+ if (typeof typeEnum[key] === "string")
198
+ values.push({
199
+ value: Number(key),
200
+ label: replaceGuionForSpace ? GetEnumDescription(key, typeEnum, description) : typeEnum[key]
201
+ });
202
+ }
203
+ return values;
204
+ }
205
+ var DropEnumList = ({ dataEnum, description, onChange, width, defaultValue }) => {
206
+ const [value, setValue] = useState2("");
207
+ const [data, setData] = useState2([]);
208
+ useEffect3(() => {
209
+ setData(
210
+ parsearDataForComboBox(EnumToArray(dataEnum, true, description), "value", "label", false).sort(
211
+ (a, b) => Number(a.key) - Number(b.key)
212
+ )
213
+ );
214
+ }, []);
215
+ useEffect3(() => {
216
+ if (data.length > 0) {
217
+ setValue(data.filter((x) => x.key == defaultValue)[0]);
218
+ }
219
+ }, [data]);
220
+ const handleOptionClick = (e) => {
221
+ onChange(e);
222
+ setValue(e);
223
+ };
224
+ return /* @__PURE__ */ jsx4(Fragment, { children: /* @__PURE__ */ jsx4(
225
+ DropDownList,
226
+ {
227
+ className: "d-inline-block align-middle mr-2",
228
+ data,
229
+ dataItemKey: "key",
230
+ id: "cmbDisplay",
231
+ name: "cmbDisplay",
232
+ onChange: (event) => {
233
+ handleOptionClick(event.value);
234
+ },
235
+ textField: "text",
236
+ style: {
237
+ width: `${width}px`
238
+ },
239
+ defaultValue: value
240
+ }
241
+ ) });
242
+ };
243
+
244
+ // src/contexts/BreadCrumbContext.tsx
245
+ import { createContext as createContext2, useState as useState4 } from "react";
246
+
247
+ // src/hooks/useLocalStorage.tsx
248
+ import { useCallback, useEffect as useEffect5, useState as useState3 } from "react";
249
+
250
+ // src/hooks/useEventListener.tsx
251
+ import { useRef as useRef3 } from "react";
252
+
253
+ // src/hooks/useIsomorphicLayoutEffect.tsx
254
+ import { useEffect as useEffect4, useLayoutEffect } from "react";
255
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect4;
256
+ var useIsomorphicLayoutEffect_default = useIsomorphicLayoutEffect;
257
+
258
+ // src/hooks/useEventListener.tsx
259
+ function useEventListener(handler) {
260
+ const savedHandler = useRef3(handler);
261
+ useIsomorphicLayoutEffect_default(() => {
262
+ savedHandler.current = handler;
263
+ }, [handler]);
264
+ }
265
+ var useEventListener_default = useEventListener;
266
+
267
+ // src/hooks/useLocalStorage.tsx
268
+ function useLocalStorage(key, initialValue) {
269
+ const readValue = useCallback(() => {
270
+ if (typeof window === "undefined") {
271
+ return initialValue;
272
+ }
273
+ try {
274
+ const item = window.localStorage.getItem(key);
275
+ return item ? parseJSON(item) : initialValue;
276
+ } catch (error) {
277
+ console.warn(`Error reading localStorage key \u201C${key}\u201D:`, error);
278
+ return initialValue;
279
+ }
280
+ }, [initialValue, key]);
281
+ const [storedValue, setStoredValue] = useState3(readValue);
282
+ const setValue = useCallback(
283
+ (value) => {
284
+ if (typeof window == "undefined") {
285
+ console.warn(`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`);
286
+ }
287
+ try {
288
+ const newValue = value instanceof Function ? value(storedValue) : value;
289
+ window.localStorage.setItem(key, JSON.stringify(newValue));
290
+ setStoredValue(newValue);
291
+ window.dispatchEvent(new Event("local-storage"));
292
+ } catch (error) {
293
+ console.warn(`Error setting localStorage key \u201C${key}\u201D:`, error);
294
+ }
295
+ },
296
+ [key, storedValue]
297
+ );
298
+ useEffect5(() => {
299
+ setStoredValue(readValue());
300
+ }, []);
301
+ const handleStorageChange = useCallback(() => {
302
+ setStoredValue(readValue());
303
+ }, [readValue]);
304
+ useEventListener_default("storage", handleStorageChange);
305
+ useEventListener_default("local-storage", handleStorageChange);
306
+ return [storedValue, setValue];
307
+ }
308
+ function parseJSON(value) {
309
+ try {
310
+ return value === "undefined" ? void 0 : JSON.parse(value != null ? value : "");
311
+ } catch (e) {
312
+ console.log("parsing error on", { value });
313
+ return void 0;
314
+ }
315
+ }
316
+
317
+ // src/contexts/BreadCrumbContext.tsx
318
+ import { jsx as jsx5 } from "react/jsx-runtime";
319
+ var BreadCrumbContext = createContext2({});
320
+ var BreadCrumbContextProvider = ({ children }) => {
321
+ const [active, setActive] = useLocalStorage("@active", "");
322
+ const [path, setPath] = useLocalStorage("@path", "/");
323
+ const [goBack, setGoBack] = useLocalStorage("@goBack", false);
324
+ const [pathChild, setPathChild] = useLocalStorage("@pathChild", "");
325
+ const [routes, setRoutes] = useState4([]);
326
+ return /* @__PURE__ */ jsx5(
327
+ BreadCrumbContext.Provider,
328
+ {
329
+ value: {
330
+ active,
331
+ setActive,
332
+ path,
333
+ setPath,
334
+ goBack,
335
+ setGoBack,
336
+ pathChild,
337
+ setPathChild,
338
+ routes,
339
+ setRoutes
340
+ },
341
+ children
342
+ }
343
+ );
344
+ };
345
+
346
+ // src/contexts/DrawerContext.tsx
347
+ import { createContext as createContext3, useState as useState5 } from "react";
348
+ import { jsx as jsx6 } from "react/jsx-runtime";
349
+ var DrawerContext = createContext3({});
350
+ var DrawerContextProvider = ({ children }) => {
351
+ const [active, setActive] = useState5(false);
352
+ return /* @__PURE__ */ jsx6(DrawerContext.Provider, { value: { active, setActive }, children });
353
+ };
354
+
355
+ // src/contexts/HistoryContext.tsx
356
+ import { createContext as createContext4 } from "react";
357
+ import { jsx as jsx7 } from "react/jsx-runtime";
358
+ var HistoryContext = createContext4({});
359
+ var HistoryContextProvider = ({ children }) => {
360
+ const [list, setList] = useLocalStorage("@list_paths", []);
361
+ const updateList = (value) => {
362
+ setList(
363
+ (prev) => prev.concat({
364
+ path: value.path,
365
+ name: value.name,
366
+ date: /* @__PURE__ */ new Date()
367
+ })
368
+ );
369
+ };
370
+ return /* @__PURE__ */ jsx7(HistoryContext.Provider, { value: { list, updateList }, children });
371
+ };
372
+
373
+ // src/contexts/SidebarMainContext.tsx
374
+ import { createContext as createContext5, useState as useState6 } from "react";
375
+ import { jsx as jsx8 } from "react/jsx-runtime";
376
+ var SidebarMainContext = createContext5({});
377
+ var SidebarMainContextProvider = ({ children }) => {
378
+ const [open, setOpen] = useState6(true);
379
+ return /* @__PURE__ */ jsx8(SidebarMainContext.Provider, { value: { open, setOpen }, children });
380
+ };
381
+
382
+ // src/contexts/GlobalProvider.tsx
383
+ import { jsx as jsx9 } from "react/jsx-runtime";
384
+ function GlobalProvider({ children }) {
385
+ return /* @__PURE__ */ jsx9(HistoryContextProvider, { children: /* @__PURE__ */ jsx9(BreadCrumbContextProvider, { children: /* @__PURE__ */ jsx9(SidebarMainContextProvider, { children: /* @__PURE__ */ jsx9(DrawerContextProvider, { children }) }) }) });
386
+ }
387
+
388
+ // src/hooks/usePrevious.tsx
389
+ import { useEffect as useEffect6, useRef as useRef4 } from "react";
390
+ var usePrevious = (value) => {
391
+ const ref = useRef4();
392
+ useEffect6(() => {
393
+ ref.current = value;
394
+ });
395
+ return ref.current;
396
+ };
397
+
398
+ // src/hooks/useStep.tsx
399
+ import { useCallback as useCallback2, useMemo, useState as useState7 } from "react";
400
+ var useStep = (maxStep) => {
401
+ const [currentStep, setCurrentStep] = useState7(1);
402
+ const canGoToNextStep = useMemo(() => currentStep + 1 <= maxStep, [currentStep, maxStep]);
403
+ const canGoToPrevStep = useMemo(() => currentStep - 1 >= 1, [currentStep]);
404
+ const setStep = useCallback2(
405
+ (step) => {
406
+ const newStep = step instanceof Function ? step(currentStep) : step;
407
+ if (newStep >= 1 && newStep <= maxStep) {
408
+ setCurrentStep(newStep);
409
+ return;
410
+ }
411
+ throw new Error("Step not valid");
412
+ },
413
+ [maxStep, currentStep]
414
+ );
415
+ const goToNextStep = useCallback2(() => {
416
+ if (canGoToNextStep) {
417
+ setCurrentStep((step) => step + 1);
418
+ }
419
+ }, [canGoToNextStep]);
420
+ const goToPrevStep = useCallback2(() => {
421
+ if (canGoToPrevStep) {
422
+ setCurrentStep((step) => step - 1);
423
+ }
424
+ }, [canGoToPrevStep]);
425
+ const reset = useCallback2(() => {
426
+ setCurrentStep(1);
427
+ }, []);
428
+ return [
429
+ currentStep,
430
+ {
431
+ goToNextStep,
432
+ goToPrevStep,
433
+ canGoToNextStep,
434
+ canGoToPrevStep,
435
+ setStep,
436
+ reset
437
+ }
438
+ ];
439
+ };
440
+
441
+ // src/layout/AppBreadcrumb.tsx
442
+ import { useContext as useContext2, useEffect as useEffect7 } from "react";
443
+ import { MdClose } from "react-icons/md";
444
+ import { VscChevronRight } from "react-icons/vsc";
445
+ import { Link as Link3, useNavigate } from "react-router-dom";
446
+
447
+ // src/styled-components/breadcrumb.ts
448
+ import styled from "styled-components";
449
+ var Breadcrumb = styled.div`
450
+ font-family: 'Inter', sans-serif;
451
+ padding: 10px 0px;
452
+ text-transform: uppercase;
453
+ font-weight: bold;
454
+ font-size: 0.9rem;
455
+ color: #92190e;
456
+ display: flex;
457
+ justify-content: space-between;
458
+ align-items: center;
459
+ background-color: white;
460
+ align-items: center;
461
+
462
+ .link {
463
+ color: #92190e;
464
+ &:hover {
465
+ color: #92190e;
466
+ cursor: pointer;
467
+ }
468
+ }
469
+ `;
470
+ var BreadCrumbTitle = styled.div`
471
+ font-family: 'Inter', sans-serif;
472
+ font-weight: bold;
473
+ font-size: 1.2rem !important;
474
+ color: #92190e;
475
+ margin-top: 15px;
476
+ `;
477
+ var TitlePage = styled.div`
478
+ font-family: 'Inter', sans-serif;
479
+ font-weight: bold;
480
+ font-size: 1.2rem !important;
481
+ color: #92190e;
482
+ margin-top: 15px;
483
+ `;
484
+
485
+ // src/styled-components/menu.ts
486
+ import { Link } from "react-router-dom";
487
+ import styled2 from "styled-components";
488
+ var MenuItem = styled2(Link)`
489
+ text-decoration: none;
490
+ color: black;
491
+ display: flex;
492
+ justify-content: ${(props) => props.type === "col" ? "center" : "flex-start"};
493
+ align-items: center;
494
+ flex-direction: ${(props) => props.type === "col" ? "column" : "row"};
495
+ border: 1px solid transparent;
496
+ width: ${(props) => props.width ? props.width : "100px"};
497
+ padding: 10px;
498
+ text-decoration: none !important;
499
+ &:hover {
500
+ box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
501
+ }
502
+
503
+ .icon {
504
+ width: 30px;
505
+ text-decoration: none;
506
+ }
507
+ .text {
508
+ text-align: center;
509
+ font-size: 12px;
510
+ text-decoration: none !important;
511
+ color: black;
512
+ margin-top: ${(props) => props.type === "col" ? "0px" : "15px"};
513
+ &:hover {
514
+ text-decoration: none !important;
515
+ }
516
+ }
517
+ `;
518
+ var MenuTitle = styled2.p`
519
+ font-size: 16px;
520
+ font-weight: bold !important;
521
+ `;
522
+
523
+ // src/styled-components/navbar.ts
524
+ import styled3 from "styled-components";
525
+ var Navbar = styled3.nav`
526
+ background: ${(props) => {
527
+ return !props.gradient ? ` linear-gradient( 90.03deg, #92190e 80.71%, #f0b92c 107.21% ) !important` : `#92190e`;
528
+ }};
529
+ z-index: 10;
530
+ width: 100%;
531
+ max-width: 100vw;
532
+ display: flex;
533
+ justify-content: space-between;
534
+ padding-top: 10px;
535
+ padding-bottom: 10px;
536
+ position: sticky;
537
+ top: 0px;
538
+ height: 40px;
539
+ .input {
540
+ border-radius: 2px !important;
541
+ padding: 2px !important;
542
+ font-size: 12px !important;
543
+ height: 20px !important;
544
+ border: none;
545
+ &:focus {
546
+ outline: none !important;
547
+ }
548
+ ::placeholder {
549
+ color: #92190e;
550
+ }
551
+ @media (max-width: 470px) {
552
+ display: none;
553
+ }
554
+ }
555
+ .dialog {
556
+ z-index: 20000 !important;
557
+ position: absolute;
558
+ width: 400px;
559
+ height: 500px;
560
+ min-height: 500px;
561
+ overflow: scroll;
562
+ overflow-x: hidden;
563
+ min-width: 400px;
564
+ max-width: 400px;
565
+ background-color: white;
566
+ border-radius: 20px;
567
+ top: 50%;
568
+ left: 50%;
569
+ transform: translate(-50%, -50%);
570
+ }
571
+ `;
572
+
573
+ // src/styled-components/options.ts
574
+ import styled4 from "styled-components";
575
+ var MenuOptions = styled4.div`
576
+ font-size: bold;
577
+ display: flex;
578
+ width: 100%;
579
+ gap: 10px;
580
+ justify-content: flex-start;
581
+ border-bottom: 1px solid #e6e6e6;
582
+ background-color: white;
583
+ flex-wrap: wrap;
584
+ .button-option {
585
+ display: flex;
586
+ flex-direction: row;
587
+ justify-content: space-between;
588
+ align-items: center;
589
+ gap: 5px;
590
+ padding: 10px 20px;
591
+ font-weight: bold;
592
+ background-color: white !important;
593
+ border: none;
594
+ .icon {
595
+ color: #92190e;
596
+ }
597
+ .text {
598
+ @media (max-width: 470px) {
599
+ display: none;
600
+ }
601
+ }
602
+ }
603
+ `;
604
+
605
+ // src/styled-components/sidebar.ts
606
+ import { Link as Link2 } from "react-router-dom";
607
+ import styled5 from "styled-components";
608
+ var ItemSidebar = styled5.div`
609
+ padding: 10px 25px;
610
+ display: flex;
611
+ align-items: center;
612
+ gap: 30px;
613
+ font-family: 'Inter', sans-serif;
614
+ &:hover {
615
+ color: white !important;
616
+ text-decoration: none;
617
+ background: #92190e;
618
+ .icon-sidebar {
619
+ color: white !important;
620
+ }
621
+ }
622
+ &:active {
623
+ color: white !important;
624
+ text-decoration: none;
625
+ background: #92190e;
626
+ .icon-sidebar {
627
+ color: white !important;
628
+ }
629
+ }
630
+ `;
631
+ var SidebarNavigation = styled5.nav`
632
+ position: ${({ fixed = true }) => fixed ? "fixed" : "static"};
633
+ top: 0;
634
+ left: 0;
635
+ min-height: 100vh;
636
+ box-shadow: 7px 0px 14px 1px rgba(145, 141, 141, 0.51);
637
+ -webkit-box-shadow: 7px 0px 14px 1px rgba(145, 141, 141, 0.51);
638
+ -moz-box-shadow: 7px 0px 14px 1px rgba(145, 141, 141, 0.51);
639
+ background: white;
640
+ font-family: 'Inter', sans-serif;
641
+ padding: 0;
642
+ width: ${({ fixed = true, active = true }) => fixed ? active ? "270px" : "0px" : "auto"};
643
+ z-index: 11;
644
+ transition: width 0.2s ease-in-out;
645
+
646
+ overflow: hidden;
647
+ height: 100vh;
648
+ overflow-y: auto;
649
+ box-shadow: ${({ shadow = true }) => shadow ? "rgba(99, 99, 99, 0.2) 0px 2px 8px 0px" : "none"};
650
+
651
+ &::-webkit-scrollbar {
652
+ display: none !important;
653
+ }
654
+ .nav {
655
+ flex-wrap: nowrap;
656
+ flex-direction: column;
657
+ font-size: 12px;
658
+
659
+ .nav-item {
660
+ .collapse {
661
+ z-index: 999;
662
+ }
663
+
664
+ .collapse.show,
665
+ .collapsing {
666
+ background: rgba(0, 0, 0);
667
+ }
668
+
669
+ .nav-link {
670
+ align-items: center;
671
+ display: flex;
672
+ padding-left: 40px;
673
+ white-space: nowrap;
674
+
675
+ color: #92190e;
676
+ i {
677
+ margin-right: 20px;
678
+ }
679
+ .menu-title {
680
+ color: inherit;
681
+ display: inline-block;
682
+ line-height: 1;
683
+ color: black;
684
+ vertical-align: middle;
685
+ cursor: pointer;
686
+ }
687
+ }
688
+
689
+ &.active {
690
+ > .nav-link {
691
+ color: white;
692
+ }
693
+
694
+ &.not-navigation-link {
695
+ position: relative;
696
+ }
697
+ }
698
+
699
+ &:not(.sub-menu) {
700
+ > .nav-item {
701
+ &:hover {
702
+ &:not(.nav-profile) {
703
+ > .nav-link {
704
+ background: $sidebar-light-menu-hover-bg;
705
+ color: $sidebar-light-menu-hover-color;
706
+ }
707
+ }
708
+ }
709
+ }
710
+ }
711
+
712
+ &.sub-menu {
713
+ margin-bottom: 0;
714
+ padding: $sidebar-submenu-padding;
715
+
716
+ .rtl & {
717
+ padding: 0 4rem 0 0;
718
+ }
719
+
720
+ .nav-item {
721
+ .nav-link {
722
+ color: $sidebar-light-submenu-color;
723
+ padding: $sidebar-submenu-item-padding;
724
+ font-size: $sidebar-submenu-font-size;
725
+ line-height: 1;
726
+ height: auto;
727
+
728
+ &.active {
729
+ color: $sidebar-light-menu-active-color;
730
+ background: transparent;
731
+
732
+ &:before {
733
+ background: $sidebar-light-menu-active-color;
734
+ }
735
+ }
736
+ }
737
+
738
+ &:hover {
739
+ > .nav-link {
740
+ background: $sidebar-light-submenu-hover-bg;
741
+ color: $sidebar-light-submenu-hover-color;
742
+
743
+ &:before {
744
+ background: $sidebar-light-submenu-hover-color;
745
+ }
746
+ }
747
+ }
748
+ }
749
+ }
750
+
751
+ &.sub-menu2 {
752
+ margin-bottom: 0;
753
+ padding: $sidebar-submenu2-padding;
754
+
755
+ .rtl & {
756
+ padding: 0 4rem 0 0;
757
+ }
758
+
759
+ .nav-item {
760
+ .nav-link {
761
+ color: $sidebar-light-submenu-color;
762
+ padding: $sidebar-submenu-item-padding;
763
+ font-size: $sidebar-submenu-font-size;
764
+ line-height: 1;
765
+ height: auto;
766
+
767
+ &.active {
768
+ color: $sidebar-light-menu-active-color;
769
+ background: transparent;
770
+
771
+ &:before {
772
+ background: $sidebar-light-menu-active-color;
773
+ }
774
+ }
775
+ }
776
+
777
+ &:hover {
778
+ > .nav-link {
779
+ background: $sidebar-light-submenu-hover-bg;
780
+ color: $sidebar-light-submenu-hover-color;
781
+
782
+ &:before {
783
+ background: $sidebar-light-submenu-hover-color;
784
+ }
785
+ }
786
+ }
787
+ }
788
+ }
789
+ }
790
+ }
791
+ `;
792
+ var ConfigurationOption = styled5.nav`
793
+ position: fixed;
794
+ top: 50px;
795
+ right: 0;
796
+ min-height: 100vh;
797
+ box-shadow: 7px 0px 14px 1px rgba(201, 196, 196, 0.51);
798
+ -webkit-box-shadow: 7px 0px 14px 1px rgba(201, 196, 196, 0.51);
799
+ -moz-box-shadow: 7px 0px 14px 1px rgba(201, 196, 196, 0.51);
800
+ min-height: calc(100vh);
801
+
802
+ font-family: 'Inter', sans-serif;
803
+ padding: 0;
804
+ width: ${(props) => props.active ? "300px" : "0px"};
805
+ z-index: 11;
806
+ transition: width 0.2s ease-in-out;
807
+ overflow: hidden !important;
808
+ `;
809
+ var ItemLinkSidebar = styled5(Link2)`
810
+ padding: 10px 25px;
811
+ display: flex;
812
+ align-items: center;
813
+ gap: 30px;
814
+ color: #343a40;
815
+ text-decoration: none;
816
+ font-family: 'Inter', sans-serif;
817
+ &:hover {
818
+ color: white !important;
819
+ text-decoration: none;
820
+ background: #92190e;
821
+ .icon-sidebar {
822
+ color: white !important;
823
+ }
824
+ }
825
+ `;
826
+
827
+ // src/styled-components/template.ts
828
+ import styled6 from "styled-components";
829
+ var Main = styled6.main`
830
+ width: 100%;
831
+ min-height: 90vh;
832
+ display: flex;
833
+ flex-direction: column;
834
+ justify-content: space-between;
835
+ background-color: white;
836
+ padding: 10px 60px;
837
+ position: relative;
838
+ padding-left: ${(props) => {
839
+ return props.activeDrawer ? `300px` : `30px`;
840
+ }};
841
+ @media (max-width: 470px) {
842
+ padding: 10px 10px;
843
+ }
844
+ `;
845
+ var CloseIcon = styled6.button`
846
+ color: black;
847
+ text-decoration: none;
848
+ border: none;
849
+ padding: 10px 10px;
850
+ background-color: white;
851
+ border-radius: 50%;
852
+ display: flex;
853
+ align-items: center;
854
+ justify-content: center;
855
+ cursor: pointer;
856
+ top: 10px;
857
+ right: 10px;
858
+ text-align: center;
859
+ &:hover {
860
+ color: black;
861
+ text-decoration: none;
862
+ background-color: #e8e8e8;
863
+ }
864
+ `;
865
+
866
+ // src/layout/AppBreadcrumb.tsx
867
+ import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
868
+ var AppBreadCrumb = ({ title, paths }) => {
869
+ const { setRoutes } = useContext2(BreadCrumbContext);
870
+ useEffect7(() => {
871
+ if (!(paths == null ? void 0 : paths.length))
872
+ return;
873
+ setRoutes(paths != null ? paths : []);
874
+ }, []);
875
+ return /* @__PURE__ */ jsx10(BreadCrumbTitle, { children: title != null ? title : "Home" });
876
+ };
877
+ var AppBreadCrumbNav = ({ paths }) => {
878
+ const { active, path, routes, setRoutes } = useContext2(BreadCrumbContext);
879
+ const navigate = useNavigate();
880
+ const { updateList } = useContext2(HistoryContext);
881
+ useEffect7(() => {
882
+ updateList({ name: active, path });
883
+ }, [path, active]);
884
+ useEffect7(() => {
885
+ setRoutes(paths != null ? paths : []);
886
+ }, [paths]);
887
+ return /* @__PURE__ */ jsxs4(Breadcrumb, { children: [
888
+ /* @__PURE__ */ jsxs4("div", { className: "d-flex align-items-center", children: [
889
+ /* @__PURE__ */ jsx10(Link3, { to: "/", className: "link", children: "HOME" }),
890
+ routes.length > 0 && /* @__PURE__ */ jsx10(VscChevronRight, { color: "black" }),
891
+ routes.length > 0 ? routes.map((i, idx, arr) => {
892
+ if (i.route === -1) {
893
+ return /* @__PURE__ */ jsxs4("span", { className: "link", onClick: () => navigate(-1), children: [
894
+ i.title,
895
+ " ",
896
+ idx + 1 === arr.length ? "" : /* @__PURE__ */ jsx10(VscChevronRight, { color: "black" })
897
+ ] }, idx);
898
+ }
899
+ return /* @__PURE__ */ jsxs4(Link3, { to: i.route, className: "link", children: [
900
+ i.title,
901
+ " ",
902
+ idx + 1 === arr.length ? "" : /* @__PURE__ */ jsx10(VscChevronRight, { color: "black" })
903
+ ] }, idx);
904
+ }) : ""
905
+ ] }),
906
+ /* @__PURE__ */ jsx10(
907
+ CloseIcon,
908
+ {
909
+ onClick: () => {
910
+ if ((routes == null ? void 0 : routes.length) === 1) {
911
+ navigate("/");
912
+ setRoutes([]);
913
+ return;
914
+ }
915
+ navigate(`${routes && routes[(routes == null ? void 0 : routes.length) - 2].route}`);
916
+ },
917
+ children: /* @__PURE__ */ jsx10(MdClose, { fontSize: 20 })
918
+ }
919
+ )
920
+ ] });
921
+ };
922
+
923
+ // src/layout/AppLoader.tsx
924
+ import { useEffect as useEffect8 } from "react";
925
+ import ReactDOM from "react-dom";
926
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
927
+ var LoaderGrid = () => {
928
+ const Loader = /* @__PURE__ */ jsxs5("div", { className: "k-loading-mask", children: [
929
+ /* @__PURE__ */ jsx11("span", { className: "k-loading-text", children: "Loading" }),
930
+ /* @__PURE__ */ jsx11("div", { className: "k-loading-image" }),
931
+ /* @__PURE__ */ jsx11("div", { className: "k-loading-color" })
932
+ ] });
933
+ const gridContent = document && document.querySelector(".k-grid-content");
934
+ const reportContent = document && document.querySelector(".loading-report");
935
+ return gridContent ? ReactDOM.createPortal(Loader, gridContent) : reportContent ? ReactDOM.createPortal(Loader, reportContent) : Loader;
936
+ };
937
+ var AppLoader = (props) => {
938
+ const { type = "grid", parent, minDuration } = props;
939
+ const parentEl = type === "grid" ? document.querySelector(parent != null ? parent : ".k-grid-container") : parent ? document.querySelector(parent) : null;
940
+ const Loading = /* @__PURE__ */ jsxs5("div", { className: `${type}-loading k-loading-mask`, children: [
941
+ /* @__PURE__ */ jsx11("span", { className: "k-loading-text", children: "Loading" }),
942
+ /* @__PURE__ */ jsx11("div", { className: "k-loading-image" }),
943
+ /* @__PURE__ */ jsx11("div", { className: "k-loading-color" })
944
+ ] });
945
+ useEffect8(() => {
946
+ if (type === "button") {
947
+ const loadingEl = document.createElement("div");
948
+ loadingEl.className = "icon button-loading k-loading-mask";
949
+ loadingEl.innerHTML = `
950
+ <div class="k-loading-image"></div>
951
+ `;
952
+ if (parentEl) {
953
+ const button = parentEl;
954
+ button.classList.add("btn-loading");
955
+ button.disabled = true;
956
+ button.insertBefore(loadingEl, button.firstChild);
957
+ }
958
+ return () => {
959
+ if (parentEl) {
960
+ if (minDuration) {
961
+ setTimeout(() => {
962
+ const button = parentEl;
963
+ button.classList.remove("btn-loading");
964
+ button.removeChild(loadingEl);
965
+ button.disabled = false;
966
+ }, minDuration);
967
+ } else {
968
+ const button = parentEl;
969
+ button.classList.remove("btn-loading");
970
+ button.removeChild(loadingEl);
971
+ button.disabled = false;
972
+ }
973
+ }
974
+ };
975
+ }
976
+ }, []);
977
+ return type === "button" ? null : parentEl ? ReactDOM.createPortal(Loading, parentEl) : Loading;
978
+ };
979
+
980
+ // src/layout/NavOptions.tsx
981
+ import { Dropdown } from "react-bootstrap";
982
+ import { BsArrowsFullscreen } from "react-icons/bs";
983
+ import { FiCheckCircle, FiFilter, FiPlusSquare, FiRefreshCcw, FiSave } from "react-icons/fi";
984
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
985
+ var NavOptions = ({
986
+ exportExcel,
987
+ customButtons,
988
+ onCreate,
989
+ onRefresh,
990
+ onSelect,
991
+ onClear,
992
+ onExpandScreen
993
+ }) => {
994
+ return /* @__PURE__ */ jsxs6(MenuOptions, { children: [
995
+ onCreate && /* @__PURE__ */ jsxs6("button", { className: "button-option", onClick: onCreate, children: [
996
+ /* @__PURE__ */ jsx12(FiPlusSquare, { className: "icon" }),
997
+ " ",
998
+ /* @__PURE__ */ jsx12("span", { className: "text", children: "New" })
999
+ ] }),
1000
+ onRefresh && /* @__PURE__ */ jsxs6("button", { className: "button-option", onClick: onRefresh, children: [
1001
+ /* @__PURE__ */ jsx12(FiRefreshCcw, { className: "icon" }),
1002
+ " ",
1003
+ /* @__PURE__ */ jsx12("span", { className: "text", children: "Refresh" })
1004
+ ] }),
1005
+ exportExcel && exportExcel.length > 0 && /* @__PURE__ */ jsxs6(Dropdown, { className: "button-option", children: [
1006
+ /* @__PURE__ */ jsxs6(
1007
+ Dropdown.Toggle,
1008
+ {
1009
+ id: "btnExport",
1010
+ className: "p-2 bg-light text-dark border-0 font-weight-bold",
1011
+ title: "Export to Excel",
1012
+ children: [
1013
+ /* @__PURE__ */ jsx12(FiSave, { className: "icon" }),
1014
+ /* @__PURE__ */ jsx12(
1015
+ "span",
1016
+ {
1017
+ style: {
1018
+ fontSize: "13px",
1019
+ fontFamily: '"Inter", sans-serif'
1020
+ },
1021
+ className: "text",
1022
+ children: "Export"
1023
+ }
1024
+ )
1025
+ ]
1026
+ }
1027
+ ),
1028
+ /* @__PURE__ */ jsx12(Dropdown.Menu, { children: exportExcel.map((item, index) => {
1029
+ return /* @__PURE__ */ jsxs6(Dropdown.Item, { onClick: item.onAction, children: [
1030
+ /* @__PURE__ */ jsx12("i", { className: `${item.classNameIcon} mr-2` }),
1031
+ " ",
1032
+ item.title
1033
+ ] }, index);
1034
+ }) })
1035
+ ] }),
1036
+ onSelect && /* @__PURE__ */ jsxs6("button", { className: "button-option", onClick: onSelect, children: [
1037
+ /* @__PURE__ */ jsx12(FiCheckCircle, { className: "icon" }),
1038
+ " ",
1039
+ /* @__PURE__ */ jsx12("span", { className: "text", children: "Select All" })
1040
+ ] }),
1041
+ onClear && /* @__PURE__ */ jsxs6("button", { className: "button-option", onClick: onClear, children: [
1042
+ /* @__PURE__ */ jsx12(FiFilter, { className: "icon" }),
1043
+ " ",
1044
+ /* @__PURE__ */ jsx12("span", { className: "text", children: "Clear Filters" })
1045
+ ] }),
1046
+ onExpandScreen && /* @__PURE__ */ jsxs6("button", { className: "button-option", onClick: onExpandScreen, children: [
1047
+ /* @__PURE__ */ jsx12(BsArrowsFullscreen, { className: "icon" }),
1048
+ " ",
1049
+ /* @__PURE__ */ jsx12("span", { className: "text", children: "Full Page" })
1050
+ ] }),
1051
+ customButtons == null ? void 0 : customButtons.map((custom, index) => {
1052
+ if (custom.render) {
1053
+ return custom.render;
1054
+ }
1055
+ return /* @__PURE__ */ jsxs6("button", { className: "button-option", onClick: custom.onAction, children: [
1056
+ custom.Icon !== void 0 && /* @__PURE__ */ jsx12(custom.Icon, { className: "icon" }),
1057
+ /* @__PURE__ */ jsx12("span", { className: "text", children: custom.title })
1058
+ ] }, index);
1059
+ })
1060
+ ] });
1061
+ };
1062
+
1063
+ // src/layout/title.tsx
1064
+ import { jsx as jsx13 } from "react/jsx-runtime";
1065
+ var Title = ({ title }) => {
1066
+ return /* @__PURE__ */ jsx13(TitlePage, { children: title != null ? title : "Home" });
1067
+ };
1068
+ export {
1069
+ AppBreadCrumb,
1070
+ AppBreadCrumbNav,
1071
+ AppLoader,
1072
+ BreadCrumbContext,
1073
+ BreadCrumbContextProvider,
1074
+ BreadCrumbTitle,
1075
+ Breadcrumb,
1076
+ Button,
1077
+ CloseIcon,
1078
+ DrawerContext,
1079
+ DrawerContextProvider,
1080
+ DropEnumList,
1081
+ GlobalProvider,
1082
+ HistoryContext,
1083
+ HistoryContextProvider,
1084
+ ItemLinkSidebar,
1085
+ ItemSidebar,
1086
+ LoaderGrid,
1087
+ Main,
1088
+ MenuItem,
1089
+ MenuOptions,
1090
+ MenuTitle,
1091
+ NavOptions,
1092
+ Navbar,
1093
+ SidebarMainContext,
1094
+ SidebarMainContextProvider,
1095
+ SidebarNavigation,
1096
+ Tab,
1097
+ Tabs,
1098
+ Title,
1099
+ useLocalStorage,
1100
+ usePrevious,
1101
+ useStep
1102
+ };