@skalfa/skalfa-component 1.0.2 → 1.0.3
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/accordion/Accordion.component.d.ts +1 -1
- package/dist/breadcrumb/Breadcrumb.component.d.ts +1 -1
- package/dist/button/Button.component.d.ts +1 -1
- package/dist/card/AlertCard.component.d.ts +1 -1
- package/dist/card/Card.component.d.ts +1 -1
- package/dist/card/DashboardCard.component.d.ts +1 -1
- package/dist/card/GalleryCard.component.d.ts +1 -1
- package/dist/card/ProductCard.component.d.ts +1 -1
- package/dist/card/ProfileCard.component.d.ts +1 -1
- package/dist/carousel/Carousel.component.d.ts +1 -1
- package/dist/chip/Chip.component.d.ts +1 -1
- package/dist/input/Checkbox.component.d.ts +1 -1
- package/dist/input/Input.component.d.ts +1 -1
- package/dist/input/InputCheckbox.component.d.ts +1 -1
- package/dist/input/InputCurrency.component.d.ts +1 -1
- package/dist/input/InputDate.component.d.ts +1 -1
- package/dist/input/InputDate.component.js +4 -4
- package/dist/input/InputDatetime.component.d.ts +1 -1
- package/dist/input/InputDocument.component.d.ts +1 -1
- package/dist/input/InputMap.component.d.ts +1 -1
- package/dist/input/InputNumber.component.d.ts +1 -1
- package/dist/input/InputPassword.component.d.ts +1 -1
- package/dist/input/InputRadio.component.d.ts +1 -1
- package/dist/input/InputTime.component.d.ts +1 -1
- package/dist/input/InputValues.component.d.ts +1 -1
- package/dist/input/Radio.component.d.ts +1 -1
- package/dist/input/Select.component.d.ts +1 -1
- package/dist/modal/FloatingPage.component.d.ts +1 -1
- package/dist/modal/Modal.component.d.ts +1 -1
- package/dist/modal/ModalConfirm.component.d.ts +1 -1
- package/dist/modal/Toast.component.d.ts +1 -1
- package/dist/nav/Bottombar.component.d.ts +1 -1
- package/dist/nav/Footer.component.d.ts +1 -1
- package/dist/nav/Headbar.component.d.ts +4 -11
- package/dist/nav/Headbar.component.js +3 -23
- package/dist/nav/Navbar.component.d.ts +1 -1
- package/dist/nav/Sidebar.component.d.ts +2 -2
- package/dist/nav/Tabbar.component.d.ts +1 -1
- package/dist/nav/Wizard.component.d.ts +1 -1
- package/dist/supervision/FormSupervision.component.d.ts +1 -1
- package/dist/supervision/TableSupervision.component.d.ts +1 -1
- package/dist/table/ControlBar.component.d.ts +1 -1
- package/dist/table/FilterComponent.d.ts +2 -2
- package/dist/table/Pagination.component.d.ts +1 -1
- package/dist/table/Table.component.d.ts +1 -1
- package/dist/typography/TypographyArticle.component.d.ts +1 -1
- package/dist/typography/TypographyColumn.component.d.ts +1 -1
- package/dist/typography/TypographyContent.component.d.ts +1 -1
- package/dist/typography/TypographyTips.component.d.ts +1 -1
- package/dist/wrap/Image.component.d.ts +1 -1
- package/dist/wrap/ScrollContainer.component.d.ts +1 -1
- package/dist/wrap/ShortcutProvider.d.ts +1 -1
- package/dist/wrap/Swipe.component.d.ts +1 -1
- package/package.json +2 -2
- package/dist/src/accordion/Accordion.component.d.ts +0 -13
- package/dist/src/accordion/Accordion.component.js +0 -25
- package/dist/src/breadcrumb/Breadcrumb.component.d.ts +0 -14
- package/dist/src/breadcrumb/Breadcrumb.component.js +0 -21
- package/dist/src/button/Button.component.d.ts +0 -21
- package/dist/src/button/Button.component.js +0 -19
- package/dist/src/card/AlertCard.component.d.ts +0 -11
- package/dist/src/card/AlertCard.component.js +0 -9
- package/dist/src/card/Card.component.d.ts +0 -5
- package/dist/src/card/Card.component.js +0 -9
- package/dist/src/card/DashboardCard.component.d.ts +0 -9
- package/dist/src/card/DashboardCard.component.js +0 -13
- package/dist/src/card/GalleryCard.component.d.ts +0 -7
- package/dist/src/card/GalleryCard.component.js +0 -13
- package/dist/src/card/ProductCard.component.d.ts +0 -9
- package/dist/src/card/ProductCard.component.js +0 -13
- package/dist/src/card/ProfileCard.component.d.ts +0 -10
- package/dist/src/card/ProfileCard.component.js +0 -13
- package/dist/src/carousel/Carousel.component.d.ts +0 -13
- package/dist/src/carousel/Carousel.component.js +0 -37
- package/dist/src/chip/Chip.component.d.ts +0 -6
- package/dist/src/chip/Chip.component.js +0 -12
- package/dist/src/index.d.ts +0 -13
- package/dist/src/index.js +0 -29
- package/dist/src/input/Checkbox.component.d.ts +0 -13
- package/dist/src/input/Checkbox.component.js +0 -23
- package/dist/src/input/Input.component.d.ts +0 -23
- package/dist/src/input/Input.component.js +0 -134
- package/dist/src/input/InputCheckbox.component.d.ts +0 -27
- package/dist/src/input/InputCheckbox.component.js +0 -53
- package/dist/src/input/InputCurrency.component.d.ts +0 -21
- package/dist/src/input/InputCurrency.component.js +0 -30
- package/dist/src/input/InputDate.component.d.ts +0 -24
- package/dist/src/input/InputDate.component.js +0 -107
- package/dist/src/input/InputDatetime.component.d.ts +0 -17
- package/dist/src/input/InputDatetime.component.js +0 -75
- package/dist/src/input/InputDocument.component.d.ts +0 -22
- package/dist/src/input/InputDocument.component.js +0 -88
- package/dist/src/input/InputImage.component.d.ts +0 -23
- package/dist/src/input/InputImage.component.js +0 -260
- package/dist/src/input/InputMap.component.d.ts +0 -25
- package/dist/src/input/InputMap.component.js +0 -101
- package/dist/src/input/InputNumber.component.d.ts +0 -19
- package/dist/src/input/InputNumber.component.js +0 -40
- package/dist/src/input/InputOtp.component.d.ts +0 -14
- package/dist/src/input/InputOtp.component.js +0 -65
- package/dist/src/input/InputPassword.component.d.ts +0 -17
- package/dist/src/input/InputPassword.component.js +0 -59
- package/dist/src/input/InputRadio.component.d.ts +0 -27
- package/dist/src/input/InputRadio.component.js +0 -56
- package/dist/src/input/InputTime.component.d.ts +0 -23
- package/dist/src/input/InputTime.component.js +0 -73
- package/dist/src/input/InputValues.component.d.ts +0 -9
- package/dist/src/input/InputValues.component.js +0 -19
- package/dist/src/input/Radio.component.d.ts +0 -12
- package/dist/src/input/Radio.component.js +0 -22
- package/dist/src/input/Select.component.d.ts +0 -47
- package/dist/src/input/Select.component.js +0 -275
- package/dist/src/modal/BottomSheet.component.d.ts +0 -12
- package/dist/src/modal/BottomSheet.component.js +0 -161
- package/dist/src/modal/FloatingPage.component.d.ts +0 -12
- package/dist/src/modal/FloatingPage.component.js +0 -27
- package/dist/src/modal/Modal.component.d.ts +0 -12
- package/dist/src/modal/Modal.component.js +0 -27
- package/dist/src/modal/ModalConfirm.component.d.ts +0 -26
- package/dist/src/modal/ModalConfirm.component.js +0 -68
- package/dist/src/modal/Toast.component.d.ts +0 -11
- package/dist/src/modal/Toast.component.js +0 -58
- package/dist/src/nav/Bottombar.component.d.ts +0 -12
- package/dist/src/nav/Bottombar.component.js +0 -32
- package/dist/src/nav/Footer.component.d.ts +0 -37
- package/dist/src/nav/Footer.component.js +0 -49
- package/dist/src/nav/Headbar.component.d.ts +0 -14
- package/dist/src/nav/Headbar.component.js +0 -32
- package/dist/src/nav/Navbar.component.d.ts +0 -22
- package/dist/src/nav/Navbar.component.js +0 -26
- package/dist/src/nav/Sidebar.component.d.ts +0 -33
- package/dist/src/nav/Sidebar.component.js +0 -87
- package/dist/src/nav/Tabbar.component.d.ts +0 -13
- package/dist/src/nav/Tabbar.component.js +0 -17
- package/dist/src/nav/Wizard.component.d.ts +0 -9
- package/dist/src/nav/Wizard.component.js +0 -24
- package/dist/src/supervision/FormSupervision.component.d.ts +0 -93
- package/dist/src/supervision/FormSupervision.component.js +0 -168
- package/dist/src/supervision/TableSupervision.component.d.ts +0 -78
- package/dist/src/supervision/TableSupervision.component.js +0 -273
- package/dist/src/table/ControlBar.component.d.ts +0 -34
- package/dist/src/table/ControlBar.component.js +0 -205
- package/dist/src/table/FilterComponent.d.ts +0 -45
- package/dist/src/table/FilterComponent.js +0 -132
- package/dist/src/table/Pagination.component.d.ts +0 -8
- package/dist/src/table/Pagination.component.js +0 -32
- package/dist/src/table/Table.component.d.ts +0 -61
- package/dist/src/table/Table.component.js +0 -101
- package/dist/src/typography/TypographyArticle.component.d.ts +0 -8
- package/dist/src/typography/TypographyArticle.component.js +0 -7
- package/dist/src/typography/TypographyColumn.component.d.ts +0 -6
- package/dist/src/typography/TypographyColumn.component.js +0 -7
- package/dist/src/typography/TypographyContent.component.d.ts +0 -6
- package/dist/src/typography/TypographyContent.component.js +0 -7
- package/dist/src/typography/TypographyTips.component.d.ts +0 -6
- package/dist/src/typography/TypographyTips.component.js +0 -7
- package/dist/src/wrap/Draggable.component.d.ts +0 -34
- package/dist/src/wrap/Draggable.component.js +0 -214
- package/dist/src/wrap/Image.component.d.ts +0 -2
- package/dist/src/wrap/Image.component.js +0 -13
- package/dist/src/wrap/OutsideClick.component.d.ts +0 -6
- package/dist/src/wrap/OutsideClick.component.js +0 -34
- package/dist/src/wrap/ScrollContainer.component.d.ts +0 -10
- package/dist/src/wrap/ScrollContainer.component.js +0 -54
- package/dist/src/wrap/ShortcutProvider.d.ts +0 -1
- package/dist/src/wrap/ShortcutProvider.js +0 -42
- package/dist/src/wrap/Swipe.component.d.ts +0 -14
- package/dist/src/wrap/Swipe.component.js +0 -61
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.BottomSheetComponent = void 0;
|
|
8
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const dynamic_1 = __importDefault(require("next/dynamic"));
|
|
11
|
-
const _utils_1 = require("@utils");
|
|
12
|
-
function sizeToPx(value) {
|
|
13
|
-
if (typeof window === "undefined")
|
|
14
|
-
return 0;
|
|
15
|
-
if (value === undefined || value === null)
|
|
16
|
-
return 0;
|
|
17
|
-
if (typeof value === "number")
|
|
18
|
-
return value;
|
|
19
|
-
const v = value.trim();
|
|
20
|
-
if (v.endsWith("vh")) {
|
|
21
|
-
const n = parseFloat(v.replace("vh", ""));
|
|
22
|
-
return (n / 100) * window.innerHeight;
|
|
23
|
-
}
|
|
24
|
-
if (v.endsWith("px")) {
|
|
25
|
-
return parseFloat(v.replace("px", ""));
|
|
26
|
-
}
|
|
27
|
-
return parseFloat(v) || 0;
|
|
28
|
-
}
|
|
29
|
-
const BottomSheet = ({ show, children, onClose, size = 500, maxSize, footer, className = "", }) => {
|
|
30
|
-
const scrollRef = (0, react_1.useRef)(null);
|
|
31
|
-
const sheetRef = (0, react_1.useRef)(null);
|
|
32
|
-
const startY = (0, react_1.useRef)(0);
|
|
33
|
-
const lastY = (0, react_1.useRef)(0);
|
|
34
|
-
const dragging = (0, react_1.useRef)(false);
|
|
35
|
-
const [offset, setOffset] = (0, react_1.useState)(0);
|
|
36
|
-
const [isExpanded, setIsExpanded] = (0, react_1.useState)(false);
|
|
37
|
-
const [scrollLocked, setScrollLocked] = (0, react_1.useState)(false);
|
|
38
|
-
const [contentScrollable, setContentScrollable] = (0, react_1.useState)(false);
|
|
39
|
-
const realMaxSize = maxSize ?? size;
|
|
40
|
-
const clamp = (v) => {
|
|
41
|
-
const max = window.innerHeight;
|
|
42
|
-
return Math.max(-200, Math.min(v, max));
|
|
43
|
-
};
|
|
44
|
-
const animateTo = (target, onFinish) => {
|
|
45
|
-
lastY.current = target;
|
|
46
|
-
setOffset(clamp(target));
|
|
47
|
-
onFinish?.();
|
|
48
|
-
};
|
|
49
|
-
(0, react_1.useEffect)(() => {
|
|
50
|
-
if (show) {
|
|
51
|
-
lastY.current = 0;
|
|
52
|
-
setOffset(0);
|
|
53
|
-
setIsExpanded(false);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
const t = setTimeout(() => {
|
|
57
|
-
lastY.current = 0;
|
|
58
|
-
setOffset(0);
|
|
59
|
-
setIsExpanded(false);
|
|
60
|
-
}, 250);
|
|
61
|
-
return () => clearTimeout(t);
|
|
62
|
-
}
|
|
63
|
-
}, [show]);
|
|
64
|
-
const onStart = (clientY) => {
|
|
65
|
-
const sc = scrollRef.current;
|
|
66
|
-
if (sc && sc.scrollTop < 0) {
|
|
67
|
-
setScrollLocked(true);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
setScrollLocked(false);
|
|
71
|
-
dragging.current = true;
|
|
72
|
-
startY.current = clientY;
|
|
73
|
-
lastY.current = offset;
|
|
74
|
-
};
|
|
75
|
-
const onMove = (clientY) => {
|
|
76
|
-
if (scrollLocked)
|
|
77
|
-
return;
|
|
78
|
-
if (!dragging.current)
|
|
79
|
-
return;
|
|
80
|
-
const diff = clientY - startY.current;
|
|
81
|
-
setOffset(clamp(lastY.current + diff));
|
|
82
|
-
};
|
|
83
|
-
const onEnd = () => {
|
|
84
|
-
if (scrollLocked) {
|
|
85
|
-
setScrollLocked(false);
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (!dragging.current)
|
|
89
|
-
return;
|
|
90
|
-
dragging.current = false;
|
|
91
|
-
const current = offset;
|
|
92
|
-
const thresholdDown = 120;
|
|
93
|
-
const thresholdUp = -40;
|
|
94
|
-
if (!isExpanded && current < thresholdUp && maxSize !== undefined) {
|
|
95
|
-
setIsExpanded(true);
|
|
96
|
-
animateTo(0);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (isExpanded && current > thresholdDown) {
|
|
100
|
-
setIsExpanded(false);
|
|
101
|
-
animateTo(0);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (!isExpanded && current > thresholdDown) {
|
|
105
|
-
animateTo(window.innerHeight, () => {
|
|
106
|
-
onClose();
|
|
107
|
-
lastY.current = 0;
|
|
108
|
-
setOffset(0);
|
|
109
|
-
});
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
animateTo(0);
|
|
113
|
-
};
|
|
114
|
-
const collapsedPx = sizeToPx(size);
|
|
115
|
-
const expandedPx = sizeToPx(realMaxSize);
|
|
116
|
-
const topPx = isExpanded ? window.innerHeight - expandedPx : window.innerHeight - collapsedPx;
|
|
117
|
-
const bindTouch = {
|
|
118
|
-
onTouchStart: (e) => onStart(e.touches[0].clientY),
|
|
119
|
-
onTouchMove: (e) => onMove(e.touches[0].clientY),
|
|
120
|
-
onTouchEnd: () => onEnd(),
|
|
121
|
-
};
|
|
122
|
-
const bindMouse = {
|
|
123
|
-
onMouseDown: (e) => onStart(e.clientY),
|
|
124
|
-
onMouseMove: (e) => dragging.current && onMove(e.clientY),
|
|
125
|
-
onMouseUp: () => onEnd(),
|
|
126
|
-
onMouseLeave: () => onEnd(),
|
|
127
|
-
};
|
|
128
|
-
(0, react_1.useEffect)(() => {
|
|
129
|
-
const sc = scrollRef.current;
|
|
130
|
-
if (!sc)
|
|
131
|
-
return;
|
|
132
|
-
const canScroll = sc.scrollHeight > sc.clientHeight;
|
|
133
|
-
setContentScrollable(canScroll);
|
|
134
|
-
}, [show, size, maxSize]);
|
|
135
|
-
(0, react_1.useEffect)(() => {
|
|
136
|
-
if (show) {
|
|
137
|
-
history.pushState({ bottomsheet: true }, "");
|
|
138
|
-
}
|
|
139
|
-
}, [show]);
|
|
140
|
-
(0, react_1.useEffect)(() => {
|
|
141
|
-
const onPopState = (event) => {
|
|
142
|
-
if (show) {
|
|
143
|
-
event.preventDefault();
|
|
144
|
-
onClose();
|
|
145
|
-
history.pushState({}, "");
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
window.addEventListener("popstate", onPopState);
|
|
149
|
-
return () => window.removeEventListener("popstate", onPopState);
|
|
150
|
-
}, [show, onClose]);
|
|
151
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("modal-backdrop", !show && "translate-y-full", (0, _utils_1.pcn)(className, "backdrop")), onClick: onClose }), (0, jsx_runtime_1.jsx)("div", { ref: sheetRef, className: "bottom-sheet", style: {
|
|
152
|
-
top: show ? `${topPx}px` : "150vh",
|
|
153
|
-
transform: `translateY(${offset}px)`,
|
|
154
|
-
touchAction: "none",
|
|
155
|
-
}, ...bindTouch, ...bindMouse, children: (0, jsx_runtime_1.jsxs)("div", { className: "bottom-sheet-container", children: [(0, jsx_runtime_1.jsx)("div", { className: "bottom-sheet-handle-wrapper", children: (0, jsx_runtime_1.jsx)("div", { className: "bottom-sheet-handle" }) }), (0, jsx_runtime_1.jsx)("div", { ref: scrollRef, className: "overflow-y-auto", style: {
|
|
156
|
-
height: isExpanded ? realMaxSize : size,
|
|
157
|
-
touchAction: contentScrollable ? "auto" : "none",
|
|
158
|
-
overscrollBehaviorY: "contain",
|
|
159
|
-
}, children: children })] }) }), show && footer && ((0, jsx_runtime_1.jsx)("div", { className: "bottom-sheet-footer", children: footer }))] }));
|
|
160
|
-
};
|
|
161
|
-
exports.BottomSheetComponent = (0, dynamic_1.default)(() => Promise.resolve(BottomSheet), { ssr: false });
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
export interface FloatingPageProps {
|
|
3
|
-
show: boolean;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
title?: string | ReactNode;
|
|
6
|
-
children?: any;
|
|
7
|
-
tip?: string | ReactNode;
|
|
8
|
-
footer?: string | ReactNode;
|
|
9
|
-
/** Use custom class with: "backdrop::", "header::", "footer::". */
|
|
10
|
-
className?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function FloatingPageComponent({ show, onClose, title, children, tip, footer, className, }: FloatingPageProps): import("react").JSX.Element;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.FloatingPageComponent = FloatingPageComponent;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
8
|
-
const _components_1 = require("@components");
|
|
9
|
-
const _utils_1 = require("@utils");
|
|
10
|
-
;
|
|
11
|
-
function FloatingPageComponent({ show, onClose, title, children, tip, footer, className = "", }) {
|
|
12
|
-
(0, react_1.useEffect)(() => {
|
|
13
|
-
if (show) {
|
|
14
|
-
document.getElementsByTagName("body")[0].style.overflow = "hidden";
|
|
15
|
-
_utils_1.shortcut.register("escape", () => {
|
|
16
|
-
onClose?.();
|
|
17
|
-
}, "Kembali");
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
document.getElementsByTagName("body")[0].style.removeProperty("overflow");
|
|
21
|
-
}
|
|
22
|
-
return () => {
|
|
23
|
-
_utils_1.shortcut.unregister("escape");
|
|
24
|
-
};
|
|
25
|
-
}, [show]);
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("modal-backdrop", !show && "opacity-0 scale-0 -translate-y-full", (0, _utils_1.pcn)(className, "backdrop")), onClick: () => onClose() }), (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("floating-page", !show && "top-[200vh] md:top-0 md:-right-[200vw]", (0, _utils_1.pcn)(className, "base")), children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("modal-header", (0, _utils_1.pcn)(className, "header")), children: [title && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h6", { className: "modal-title", children: title }), tip && (0, jsx_runtime_1.jsx)("p", { className: "modal-tip", children: tip })] })), (0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { icon: free_solid_svg_icons_1.faTimes, variant: "simple", paint: "danger", onClick: () => onClose() })] }), show && children, footer && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("modal-footer absolute bottom-0 w-full", (0, _utils_1.pcn)(className, "footer")), children: show && footer }))] })] }));
|
|
27
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
export interface ModalProps {
|
|
3
|
-
show: boolean;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
title?: string | ReactNode;
|
|
6
|
-
children?: any;
|
|
7
|
-
tip?: string | ReactNode;
|
|
8
|
-
footer?: string | ReactNode;
|
|
9
|
-
/** Use custom class with: "backdrop::", "header::", "footer::". */
|
|
10
|
-
className?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function ModalComponent({ show, onClose, title, children, tip, footer, className, }: ModalProps): import("react").JSX.Element;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ModalComponent = ModalComponent;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
8
|
-
const _utils_1 = require("@utils");
|
|
9
|
-
const _components_1 = require("@components");
|
|
10
|
-
;
|
|
11
|
-
function ModalComponent({ show, onClose, title, children, tip, footer, className = "", }) {
|
|
12
|
-
(0, react_1.useEffect)(() => {
|
|
13
|
-
if (show) {
|
|
14
|
-
document.getElementsByTagName("body")[0].style.overflow = "hidden";
|
|
15
|
-
_utils_1.shortcut.register("escape", () => {
|
|
16
|
-
onClose?.();
|
|
17
|
-
}, "Kembali");
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
document.getElementsByTagName("body")[0].style.removeProperty("overflow");
|
|
21
|
-
}
|
|
22
|
-
return () => {
|
|
23
|
-
_utils_1.shortcut.unregister("escape");
|
|
24
|
-
};
|
|
25
|
-
}, [show]);
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("modal-backdrop", !show && "opacity-0 scale-0 -translate-y-full", (0, _utils_1.pcn)(className, "backdrop")), onClick: () => onClose() }), (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("modal", !show && "-translate-y-full opacity-0 scale-y-0", (0, _utils_1.pcn)(className, "base")), children: [title && ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("modal-header", (0, _utils_1.pcn)(className, "header")), children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h6", { className: "modal-title", children: title }), tip && (0, jsx_runtime_1.jsx)("p", { className: "modal-tip", children: tip })] }), (0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { icon: free_solid_svg_icons_1.faTimes, variant: "simple", paint: "danger", onClick: () => onClose() })] })), show && children, footer && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("modal-footer", (0, _utils_1.pcn)(className, "footer")), children: show && footer }))] })] }));
|
|
27
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { ApiType } from "@utils";
|
|
3
|
-
import { ButtonProps } from "@components";
|
|
4
|
-
type SubmitIDB = {
|
|
5
|
-
idb: {
|
|
6
|
-
store: string;
|
|
7
|
-
id: string | number;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export interface ModalConfirmProps {
|
|
11
|
-
show: boolean;
|
|
12
|
-
onClose: () => void;
|
|
13
|
-
title?: string | ReactNode;
|
|
14
|
-
children?: any;
|
|
15
|
-
icon?: any;
|
|
16
|
-
footer?: string | ReactNode;
|
|
17
|
-
submitControl?: ButtonProps & {
|
|
18
|
-
onSubmit?: ApiType | SubmitIDB | (() => void);
|
|
19
|
-
onSuccess?: () => void;
|
|
20
|
-
onError?: () => void;
|
|
21
|
-
};
|
|
22
|
-
/** Use custom class with: "backdrop::", "header::", "footer::". */
|
|
23
|
-
className?: string;
|
|
24
|
-
}
|
|
25
|
-
export declare function ModalConfirmComponent({ show, title, children, icon, footer, submitControl, onClose, className, }: ModalConfirmProps): import("react").JSX.Element;
|
|
26
|
-
export {};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ModalConfirmComponent = ModalConfirmComponent;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
8
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
9
|
-
const _utils_1 = require("@utils");
|
|
10
|
-
const _components_1 = require("@components");
|
|
11
|
-
;
|
|
12
|
-
function ModalConfirmComponent({ show, title, children, icon, footer, submitControl, onClose, className = "", }) {
|
|
13
|
-
const { isSm } = (0, _utils_1.useResponsive)();
|
|
14
|
-
const [toast, setToast] = (0, react_1.useState)(false);
|
|
15
|
-
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
16
|
-
(0, react_1.useEffect)(() => {
|
|
17
|
-
if (show) {
|
|
18
|
-
document.getElementsByTagName("body")[0].style.overflow = "hidden";
|
|
19
|
-
_utils_1.shortcut.register("escape", () => {
|
|
20
|
-
onClose?.();
|
|
21
|
-
}, "Kembali");
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
document.getElementsByTagName("body")[0].style.removeProperty("overflow");
|
|
25
|
-
}
|
|
26
|
-
return () => {
|
|
27
|
-
_utils_1.shortcut.unregister("escape");
|
|
28
|
-
};
|
|
29
|
-
}, [show]);
|
|
30
|
-
const renderChildren = (0, react_1.useMemo)(() => {
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [title && ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("flex flex-col gap-2 items-center text-primary", (0, _utils_1.pcn)(className, "header")), children: [(0, jsx_runtime_1.jsx)("div", { className: "mt-6", children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: icon || free_solid_svg_icons_1.faQuestion, className: `text-xl` }) }), (0, jsx_runtime_1.jsx)("h6", { className: "font-semibold text-lg", children: title })] })), children, footer && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("modal-footer", (0, _utils_1.pcn)(className, "footer")), children: footer }))] }));
|
|
32
|
-
}, [title, footer, children]);
|
|
33
|
-
const renderAction = (size = 'md') => {
|
|
34
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-center pt-6", children: [(0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { label: "Batal", variant: "simple", onClick: () => onClose(), className: "text-foreground bg-background rounded-none", block: true, size: size }), (0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { label: "Konfirmasi", loading: loading, onClick: async () => {
|
|
35
|
-
if (!submitControl?.onSubmit)
|
|
36
|
-
return;
|
|
37
|
-
setLoading(true);
|
|
38
|
-
if (typeof submitControl?.onSubmit == "function") {
|
|
39
|
-
submitControl?.onSubmit?.();
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
let response = null;
|
|
43
|
-
if ("path" in submitControl?.onSubmit || "url" in submitControl?.onSubmit) {
|
|
44
|
-
response = await (0, _utils_1.api)(submitControl?.onSubmit);
|
|
45
|
-
}
|
|
46
|
-
if ("idb" in submitControl?.onSubmit) {
|
|
47
|
-
const idb = _utils_1.registry.get("idb");
|
|
48
|
-
if (!idb) {
|
|
49
|
-
throw new Error("IndexedDB (IDB) extension is not installed.");
|
|
50
|
-
}
|
|
51
|
-
await idb.delete((submitControl?.onSubmit).idb.store, (submitControl?.onSubmit).idb.id);
|
|
52
|
-
response = { status: 200 };
|
|
53
|
-
}
|
|
54
|
-
if (response?.status == 200 || response?.status == 201) {
|
|
55
|
-
setToast("success");
|
|
56
|
-
submitControl?.onSuccess?.();
|
|
57
|
-
setLoading(false);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
setToast("failed");
|
|
61
|
-
submitControl?.onError?.();
|
|
62
|
-
setLoading(false);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, className: "rounded-none", block: true, size: size, ...submitControl })] }));
|
|
66
|
-
};
|
|
67
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!isSm ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("modal-backdrop", !show && "opacity-0 scale-0 -translate-y-full", (0, _utils_1.pcn)(className, "backdrop")), onClick: () => onClose() }), (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("modal modal-confirm", !show && "-translate-y-full opacity-0 scale-y-0", (0, _utils_1.pcn)(className, "base")), children: [renderChildren, renderAction()] })] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(_components_1.BottomSheetComponent, { show: show, onClose: onClose, size: 220, footer: renderAction('lg'), children: renderChildren }) })), (0, jsx_runtime_1.jsx)(_components_1.ToastComponent, { show: toast == "failed", onClose: () => setToast(false), title: "Gagal", className: "!border-danger header::text-danger", children: (0, jsx_runtime_1.jsxs)("p", { className: "px-3 pb-2 text-sm", children: ["Gagal ", title || "", "! cek data dan koneksi internet dan coba kembali!"] }) }), (0, jsx_runtime_1.jsx)(_components_1.ToastComponent, { show: toast == "success", onClose: () => setToast(false), title: "Berhasil", className: "!border-success header::text-success", children: (0, jsx_runtime_1.jsxs)("p", { className: "px-3 pb-2 text-sm", children: ["Berhasil ", title || "", "!"] }) })] }));
|
|
68
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
export interface ToastProps {
|
|
3
|
-
show: boolean;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
title?: string | ReactNode;
|
|
6
|
-
children?: any;
|
|
7
|
-
footer?: string | ReactNode;
|
|
8
|
-
/** Use custom class with: "backdrop::", "header::", "footer::". */
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function ToastComponent({ show, onClose, title, children, footer, className, }: ToastProps): import("react").JSX.Element;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ToastComponent = ToastComponent;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
8
|
-
const _utils_1 = require("@utils");
|
|
9
|
-
const _components_1 = require("@components");
|
|
10
|
-
;
|
|
11
|
-
function ToastComponent({ show, onClose, title, children, footer, className = "", }) {
|
|
12
|
-
const [countdown, setCountdown] = (0, react_1.useState)(5);
|
|
13
|
-
const [timerId, setTimerId] = (0, react_1.useState)(null);
|
|
14
|
-
(0, react_1.useEffect)(() => {
|
|
15
|
-
if (show) {
|
|
16
|
-
setCountdown(5); // Reset countdown saat toast muncul
|
|
17
|
-
const id = setInterval(() => {
|
|
18
|
-
setCountdown((prev) => {
|
|
19
|
-
if (prev <= 1) {
|
|
20
|
-
clearInterval(id);
|
|
21
|
-
onClose();
|
|
22
|
-
return 0;
|
|
23
|
-
}
|
|
24
|
-
return prev - 1;
|
|
25
|
-
});
|
|
26
|
-
}, 1000);
|
|
27
|
-
setTimerId(id);
|
|
28
|
-
}
|
|
29
|
-
return () => {
|
|
30
|
-
if (timerId) {
|
|
31
|
-
clearInterval(timerId);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}, [show]);
|
|
35
|
-
const handleMouseEnter = () => {
|
|
36
|
-
if (timerId) {
|
|
37
|
-
clearInterval(timerId);
|
|
38
|
-
setTimerId(null);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const handleMouseLeave = () => {
|
|
42
|
-
const id = setInterval(() => {
|
|
43
|
-
setCountdown((prev) => {
|
|
44
|
-
if (prev <= 1) {
|
|
45
|
-
clearInterval(id);
|
|
46
|
-
onClose();
|
|
47
|
-
return 0;
|
|
48
|
-
}
|
|
49
|
-
return prev - 1;
|
|
50
|
-
});
|
|
51
|
-
}, 1000);
|
|
52
|
-
setTimerId(id);
|
|
53
|
-
};
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("toast", !show && "translate-y-full opacity-0 scale-y-0", (0, _utils_1.pcn)(className, "base")), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [title && ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("pt-2 px-3 flex justify-between items-center text-foreground", (0, _utils_1.pcn)(className, "header")), children: [(0, jsx_runtime_1.jsx)("h6", { className: "font-semibold", children: title }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-center", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-xs text-foreground/50", children: countdown }), (0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { icon: free_solid_svg_icons_1.faTimes, variant: "simple", paint: "danger", onClick: () => {
|
|
55
|
-
clearInterval(timerId || "");
|
|
56
|
-
onClose();
|
|
57
|
-
}, size: "sm" })] })] })), show && children, footer && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("modal-footer", (0, _utils_1.pcn)(className, "footer")), children: show && footer }))] }) }));
|
|
58
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
2
|
-
export interface BottombarItemProps {
|
|
3
|
-
icon: IconDefinition;
|
|
4
|
-
path: string;
|
|
5
|
-
activeKey?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface BottombarProps {
|
|
8
|
-
active?: string;
|
|
9
|
-
items?: BottombarItemProps[];
|
|
10
|
-
className?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function BottombarComponent({ className, active, items, }: BottombarProps): import("react").JSX.Element;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.BottombarComponent = BottombarComponent;
|
|
8
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const link_1 = __importDefault(require("next/link"));
|
|
10
|
-
const navigation_1 = require("next/navigation");
|
|
11
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
12
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
13
|
-
const _utils_1 = require("@utils");
|
|
14
|
-
const defaultItems = [
|
|
15
|
-
{ icon: free_solid_svg_icons_1.faHome, path: "/_example/bottombar", activeKey: "home" },
|
|
16
|
-
{ icon: free_solid_svg_icons_1.faClipboard, path: "/", activeKey: "clipboard" },
|
|
17
|
-
{ icon: free_solid_svg_icons_1.faCrosshairs, path: "/", activeKey: "crosshairs" },
|
|
18
|
-
{ icon: free_solid_svg_icons_1.faSackDollar, path: "/", activeKey: "sack-dollar" },
|
|
19
|
-
{ icon: free_solid_svg_icons_1.faUserCircle, path: "/", activeKey: "profile" },
|
|
20
|
-
];
|
|
21
|
-
function BottombarComponent({ className = "", active, items = defaultItems, }) {
|
|
22
|
-
const pathname = (0, navigation_1.usePathname)();
|
|
23
|
-
const isKeyboardOpen = (0, _utils_1.useKeyboardOpen)();
|
|
24
|
-
const styles = {
|
|
25
|
-
base: (0, _utils_1.cn)("bottombar-base", isKeyboardOpen ? "-bottom-60" : "bottom-3", (0, _utils_1.pcn)(className, "base")),
|
|
26
|
-
item: "bottombar-item",
|
|
27
|
-
};
|
|
28
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: styles.base, children: (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-5 gap-2 items-center", style: { gridTemplateColumns: `repeat(${items.length}, minmax(0, 1fr))` }, children: items.map((item, key) => {
|
|
29
|
-
const isActive = pathname === item.path || active === item.activeKey;
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(link_1.default, { href: item.path, children: (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)(styles.item, isActive && "bottombar-item-active", (0, _utils_1.pcn)(className, "item"), isActive && (0, _utils_1.pcn)(className, "active")), children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: item.icon }) }) }, key));
|
|
31
|
-
}) }) }) }));
|
|
32
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
2
|
-
export interface FooterLinkProps {
|
|
3
|
-
label: string;
|
|
4
|
-
path: string;
|
|
5
|
-
}
|
|
6
|
-
export interface FooterColumnProps {
|
|
7
|
-
title: string;
|
|
8
|
-
items: FooterLinkProps[];
|
|
9
|
-
}
|
|
10
|
-
export interface FooterSocialProps {
|
|
11
|
-
icon: IconDefinition;
|
|
12
|
-
path: string;
|
|
13
|
-
}
|
|
14
|
-
export interface FooterProps {
|
|
15
|
-
brandTitle?: string;
|
|
16
|
-
brandSubtitle?: string;
|
|
17
|
-
address?: {
|
|
18
|
-
label: string;
|
|
19
|
-
path: string;
|
|
20
|
-
};
|
|
21
|
-
phone?: {
|
|
22
|
-
label: string;
|
|
23
|
-
path: string;
|
|
24
|
-
};
|
|
25
|
-
email?: {
|
|
26
|
-
label: string;
|
|
27
|
-
path: string;
|
|
28
|
-
};
|
|
29
|
-
supportHours?: string;
|
|
30
|
-
socials?: FooterSocialProps[];
|
|
31
|
-
columns?: FooterColumnProps[];
|
|
32
|
-
copyrightLink?: {
|
|
33
|
-
label: string;
|
|
34
|
-
path: string;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export declare function FooterComponent({ brandTitle, brandSubtitle, address, phone, email, supportHours, socials, columns, copyrightLink, }: FooterProps): import("react").JSX.Element;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.FooterComponent = FooterComponent;
|
|
8
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const link_1 = __importDefault(require("next/link"));
|
|
10
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
11
|
-
const free_brands_svg_icons_1 = require("@fortawesome/free-brands-svg-icons");
|
|
12
|
-
const defaultSocials = [
|
|
13
|
-
{ icon: free_brands_svg_icons_1.faFacebook, path: "" },
|
|
14
|
-
{ icon: free_brands_svg_icons_1.faLinkedin, path: "" },
|
|
15
|
-
{ icon: free_brands_svg_icons_1.faGithub, path: "https://github.com/SE-JE" },
|
|
16
|
-
{ icon: free_brands_svg_icons_1.faInstagram, path: "https://www.instagram.com/seje.digital/" },
|
|
17
|
-
];
|
|
18
|
-
const defaultColumns = [
|
|
19
|
-
{
|
|
20
|
-
title: "Link Menu",
|
|
21
|
-
items: [
|
|
22
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
23
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
24
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
25
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
title: "Link Menu",
|
|
30
|
-
items: [
|
|
31
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
32
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
33
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
34
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
title: "Link Menu",
|
|
39
|
-
items: [
|
|
40
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
41
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
42
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
43
|
-
{ label: "Klik Link Menu 1", path: "" },
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
function FooterComponent({ brandTitle = "Next Light v.3", brandSubtitle = "The Magic Starter Template", address = { label: "Soekarno Hatta No 27 C, Ponorogo, Jawa Timur, Indonesia", path: "https://maps.app.goo.gl/TY2QDjFPm3RfwjUq6" }, phone = { label: "+62 888888888888", path: "https://wa.me/6281456140392" }, email = { label: "example@gmail.com", path: "mailto:sejedigital@gmail.com" }, supportHours = "24 / 7 Online Suport | Senin - Sabtu ( 09.00 s/d 17.00 )", socials = defaultSocials, columns = defaultColumns, copyrightLink = { label: "sejedigital.com 2020 - 2025", path: "https://sejedigital.com/" }, }) {
|
|
48
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "footer-base", children: [(0, jsx_runtime_1.jsxs)("div", { className: "footer-brand-container", children: [(0, jsx_runtime_1.jsx)("h1", { className: "footer-brand-title", children: brandTitle }), brandSubtitle && ((0, jsx_runtime_1.jsx)("p", { className: "footer-brand-subtitle", children: brandSubtitle }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "footer-contact-container", children: [address && ((0, jsx_runtime_1.jsx)("a", { href: address.path, className: "footer-contact-link", target: "_blank", rel: "noopener noreferrer", children: address.label })), phone && ((0, jsx_runtime_1.jsx)("a", { href: phone.path, className: "footer-contact-link", children: phone.label })), email && ((0, jsx_runtime_1.jsx)("a", { href: email.path, className: "footer-contact-link", children: email.label })), supportHours && ((0, jsx_runtime_1.jsx)("p", { className: "footer-support-hours", children: supportHours })), socials && socials.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "footer-socials-container", children: socials.map((social, key) => ((0, jsx_runtime_1.jsx)("a", { href: social.path, target: "_blank", rel: "noopener noreferrer", children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: social.icon, className: "footer-social-icon" }) }, key))) }))] }), columns && columns.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "footer-links-container", children: (0, jsx_runtime_1.jsx)("div", { className: "footer-links-grid", children: columns.map((column, colKey) => ((0, jsx_runtime_1.jsxs)("nav", { "aria-label": `Footer navigation ${column.title}`, children: [(0, jsx_runtime_1.jsx)("h6", { className: "footer-menu-title", children: column.title }), (0, jsx_runtime_1.jsx)("div", { className: "footer-menu-list", children: column.items.map((item, itemKey) => ((0, jsx_runtime_1.jsx)(link_1.default, { href: item.path, className: "footer-menu-link", children: item.label }, itemKey))) })] }, colKey))) }) })), copyrightLink && ((0, jsx_runtime_1.jsxs)("p", { className: "footer-copyright", children: ["Copyright \u00A9", (0, jsx_runtime_1.jsx)("a", { href: copyrightLink.path, className: "ml-1", target: "_blank", rel: "noopener noreferrer", children: copyrightLink.label })] }))] }) }));
|
|
49
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
export interface HeadbarUserProps {
|
|
3
|
-
name: string;
|
|
4
|
-
role: string;
|
|
5
|
-
avatar?: any;
|
|
6
|
-
}
|
|
7
|
-
export interface HeadbarProps {
|
|
8
|
-
children?: ReactNode;
|
|
9
|
-
user?: HeadbarUserProps;
|
|
10
|
-
onLogout?: () => void;
|
|
11
|
-
onEditProfile?: () => void;
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function HeadbarComponent({ children, user, onLogout, onEditProfile, className, }: HeadbarProps): import("react").JSX.Element;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.HeadbarComponent = HeadbarComponent;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const navigation_1 = require("next/navigation");
|
|
8
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
9
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
10
|
-
const _components_1 = require("@components");
|
|
11
|
-
const _utils_1 = require("@utils");
|
|
12
|
-
const defaultUser = {
|
|
13
|
-
name: "Jhon Duck",
|
|
14
|
-
role: "Admin",
|
|
15
|
-
};
|
|
16
|
-
function HeadbarComponent({ children, user = defaultUser, onLogout, onEditProfile, className = "", }) {
|
|
17
|
-
const router = (0, navigation_1.useRouter)();
|
|
18
|
-
const [profile, setProfile] = (0, react_1.useState)(false);
|
|
19
|
-
const handleLogout = () => {
|
|
20
|
-
if (onLogout) {
|
|
21
|
-
onLogout();
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
_utils_1.auth.deleteAccessToken();
|
|
25
|
-
router.push("/");
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const styles = {
|
|
29
|
-
base: (0, _utils_1.cn)("headbar-base", className),
|
|
30
|
-
};
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles.base, children: [(0, jsx_runtime_1.jsx)("div", { className: "w-full ", children: children }), (0, jsx_runtime_1.jsxs)("div", { className: "headbar-right-controls", children: [(0, jsx_runtime_1.jsx)("div", { className: "headbar-icon-button", children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faHistory }) }), (0, jsx_runtime_1.jsx)("div", { className: "headbar-icon-button", children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faBell }) }), (0, jsx_runtime_1.jsx)("div", { className: "headbar-divider" }), (0, jsx_runtime_1.jsxs)("div", { className: "headbar-user-profile-trigger", onClick: () => setProfile(!profile), children: [(0, jsx_runtime_1.jsx)("div", { className: "headbar-user-avatar-wrapper", children: user.avatar ? ((0, jsx_runtime_1.jsx)(_components_1.ImageComponent, { src: user.avatar, alt: user.name, className: "w-full h-full object-cover" })) : ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faUser })) }), (0, jsx_runtime_1.jsxs)("div", { className: "headbar-user-info", children: [(0, jsx_runtime_1.jsx)("h6", { className: "headbar-user-name", children: user.name }), (0, jsx_runtime_1.jsx)("h6", { className: "headbar-user-role", children: user.role })] })] })] }), (0, jsx_runtime_1.jsx)(_components_1.OutsideClickComponent, { onOutsideClick: () => setProfile(false), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("headbar-dropdown", profile ? "scale-y-100" : "scale-y-0"), children: [(0, jsx_runtime_1.jsxs)("div", { className: "headbar-dropdown-header", children: [(0, jsx_runtime_1.jsx)("div", { className: "headbar-dropdown-avatar-wrapper", children: user.avatar ? ((0, jsx_runtime_1.jsx)(_components_1.ImageComponent, { src: user.avatar, alt: user.name, className: "w-full h-full object-cover" })) : ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faUser, className: "text-2xl text-light-foreground" })) }), (0, jsx_runtime_1.jsxs)("div", { className: "headbar-dropdown-user-info", children: [(0, jsx_runtime_1.jsx)("h6", { className: "text-lg font-bold line-clamp-1", children: user.name }), (0, jsx_runtime_1.jsx)("h6", { className: "text-xs -mt-1 font-semibold line-clamp-1", children: user.role })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "headbar-dropdown-body", children: [(0, jsx_runtime_1.jsxs)("div", { className: "headbar-dropdown-item", onClick: onEditProfile, children: [(0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faUserCog }), (0, jsx_runtime_1.jsx)("label", { className: "cursor-pointer font-semibold", children: "Edit Profile" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "headbar-dropdown-item-danger", onClick: handleLogout, children: [(0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faPowerOff }), (0, jsx_runtime_1.jsx)("label", { className: "cursor-pointer font-semibold", children: "Keluar" })] })] })] }) })] }));
|
|
32
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
2
|
-
export interface NavbarItemProps {
|
|
3
|
-
label: string;
|
|
4
|
-
path: string;
|
|
5
|
-
}
|
|
6
|
-
export interface NavbarProps {
|
|
7
|
-
logoTitle?: string;
|
|
8
|
-
logoSubtitle?: string;
|
|
9
|
-
logoPath?: string;
|
|
10
|
-
specialLink?: {
|
|
11
|
-
label: string;
|
|
12
|
-
path: string;
|
|
13
|
-
icon?: IconDefinition;
|
|
14
|
-
};
|
|
15
|
-
items?: NavbarItemProps[];
|
|
16
|
-
isLoggedIn?: boolean;
|
|
17
|
-
onLogin?: () => void;
|
|
18
|
-
onRegister?: () => void;
|
|
19
|
-
onProfile?: () => void;
|
|
20
|
-
className?: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function NavbarComponent({ logoTitle, logoSubtitle, logoPath, specialLink, items, isLoggedIn, onLogin, onRegister, onProfile, className, }: NavbarProps): import("react").JSX.Element;
|