@skalfa/skalfa-component 1.0.8 → 1.0.9
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.js +2 -3
- package/dist/breadcrumb/Breadcrumb.component.js +2 -3
- package/dist/button/Button.component.d.ts +2 -1
- package/dist/button/Button.component.js +2 -2
- package/dist/carousel/Carousel.component.js +2 -3
- package/dist/chip/Chip.component.js +2 -3
- package/dist/contexts-mock.d.ts +2 -0
- package/dist/contexts-mock.js +10 -0
- package/dist/input/Checkbox.component.js +2 -3
- package/dist/input/Input.component.d.ts +3 -2
- package/dist/input/Input.component.js +3 -3
- package/dist/input/InputCheckbox.component.js +1 -1
- package/dist/input/InputCurrency.component.d.ts +3 -2
- package/dist/input/InputCurrency.component.js +3 -3
- package/dist/input/InputDate.component.js +4 -5
- package/dist/input/InputDatetime.component.d.ts +3 -2
- package/dist/input/InputDatetime.component.js +3 -3
- package/dist/input/InputDocument.component.js +7 -8
- package/dist/input/InputImage.component.js +3 -4
- package/dist/input/InputNumber.component.js +3 -4
- package/dist/input/InputPassword.component.js +3 -3
- package/dist/input/InputRadio.component.js +1 -1
- package/dist/input/InputTime.component.js +3 -3
- package/dist/input/InputValues.component.js +3 -4
- package/dist/input/Select.component.js +6 -7
- package/dist/modal/FloatingPage.component.d.ts +3 -1
- package/dist/modal/FloatingPage.component.js +7 -3
- package/dist/modal/Modal.component.js +1 -2
- package/dist/modal/ModalConfirm.component.d.ts +2 -2
- package/dist/modal/ModalConfirm.component.js +14 -12
- package/dist/modal/Toast.component.js +1 -2
- package/dist/nav/Bottombar.component.d.ts +2 -2
- package/dist/nav/Bottombar.component.js +7 -8
- package/dist/nav/Footer.component.d.ts +2 -2
- package/dist/nav/Footer.component.js +6 -7
- package/dist/nav/Headbar.component.js +2 -3
- package/dist/nav/Navbar.component.d.ts +2 -2
- package/dist/nav/Navbar.component.js +3 -4
- package/dist/nav/Sidebar.component.d.ts +3 -7
- package/dist/nav/Sidebar.component.js +14 -17
- package/dist/supervision/FormSupervision.component.d.ts +4 -29
- package/dist/supervision/FormSupervision.component.js +84 -136
- package/dist/supervision/TableSupervision.component.d.ts +17 -26
- package/dist/supervision/TableSupervision.component.js +207 -193
- package/dist/table/ControlBar.component.js +15 -16
- package/dist/table/FilterComponent.js +4 -6
- package/dist/table/Pagination.component.js +2 -3
- package/dist/table/Table.component.js +3 -4
- package/dist/wrap/Swipe.component.js +2 -2
- package/package.json +18 -10
- package/src/accordion/Accordion.component.tsx +3 -3
- package/src/breadcrumb/Breadcrumb.component.tsx +4 -4
- package/src/button/Button.component.tsx +3 -3
- package/src/carousel/Carousel.component.tsx +4 -4
- package/src/chip/Chip.component.tsx +3 -4
- package/src/contexts-mock.ts +6 -0
- package/src/input/Checkbox.component.tsx +3 -3
- package/src/input/Input.component.tsx +6 -6
- package/src/input/InputCheckbox.component.tsx +1 -1
- package/src/input/InputCurrency.component.tsx +6 -6
- package/src/input/InputDate.component.tsx +6 -7
- package/src/input/InputDatetime.component.tsx +6 -6
- package/src/input/InputDocument.component.tsx +9 -9
- package/src/input/InputImage.component.tsx +4 -5
- package/src/input/InputNumber.component.tsx +7 -8
- package/src/input/InputPassword.component.tsx +4 -4
- package/src/input/InputRadio.component.tsx +1 -1
- package/src/input/InputTime.component.tsx +4 -4
- package/src/input/InputValues.component.tsx +5 -6
- package/src/input/Select.component.tsx +10 -10
- package/src/modal/FloatingPage.component.tsx +33 -3
- package/src/modal/Modal.component.tsx +1 -2
- package/src/modal/ModalConfirm.component.tsx +34 -49
- package/src/modal/Toast.component.tsx +1 -2
- package/src/nav/Bottombar.component.tsx +9 -10
- package/src/nav/Footer.component.tsx +8 -9
- package/src/nav/Headbar.component.tsx +3 -3
- package/src/nav/Navbar.component.tsx +9 -10
- package/src/nav/Sidebar.component.tsx +55 -46
- package/src/supervision/FormSupervision.component.tsx +203 -224
- package/src/supervision/TableSupervision.component.tsx +420 -455
- package/src/table/ControlBar.component.tsx +16 -16
- package/src/table/FilterComponent.tsx +9 -11
- package/src/table/Pagination.component.tsx +6 -6
- package/src/table/Table.component.tsx +5 -5
- package/src/wrap/Swipe.component.tsx +3 -3
- package/src/types.d.ts +0 -7
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InputValues = InputValues;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
6
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
5
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
7
6
|
const _utils_1 = require("@utils");
|
|
8
7
|
function InputValues({ value, className, onDelete, isFocus, onFocus, style, }) {
|
|
9
8
|
if (isFocus) {
|
|
10
9
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !!value?.length && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("input-values-dropdown", className), onClick: () => onFocus?.(), children: value?.map((item, key) => {
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "input-values-item", children: [(0, jsx_runtime_1.jsx)("span", { className: "", children: item }), (0, jsx_runtime_1.jsx)(
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "input-values-item", children: [(0, jsx_runtime_1.jsx)("span", { className: "", children: item }), (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/times", className: "input-values-delete", onClick: () => onDelete?.(item, key) })] }, key));
|
|
12
11
|
}) })) }));
|
|
13
12
|
}
|
|
14
13
|
else {
|
|
15
14
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("input-values-preview", className), style: style, onClick: () => onFocus?.(), children: (0, jsx_runtime_1.jsx)("div", { className: "input-values-container", children: value?.map((item, key) => {
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "input-values-item", children: [(0, jsx_runtime_1.jsx)("span", { children: item }), (0, jsx_runtime_1.jsx)(
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "input-values-item", children: [(0, jsx_runtime_1.jsx)("span", { children: item }), (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/times", className: "input-values-delete", onClick: () => onDelete?.(item, key) })] }, key));
|
|
17
16
|
}) }) }) }));
|
|
18
17
|
}
|
|
19
18
|
}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SelectComponent = SelectComponent;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
6
7
|
const react_1 = require("react");
|
|
7
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
8
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
9
8
|
const _utils_1 = require("@utils");
|
|
10
9
|
;
|
|
11
10
|
function SelectComponent({ name, label, placeholder, tip, leftIcon, rightIcon, value, invalid, disabled, validations, multiple, autoFocus, clearable, options = [], searchable, serverOptionControl, idbOptionControl, serverSearchable, includedOptions = [], exceptOptions = [], tempOptions, newOption, maxShowOption = 10, register, unregister, onChange, onFocus, onBlur, className = "", }) {
|
|
@@ -22,7 +21,7 @@ function SelectComponent({ name, label, placeholder, tip, leftIcon, rightIcon, v
|
|
|
22
21
|
// =========================>
|
|
23
22
|
// ## Initial
|
|
24
23
|
// =========================>
|
|
25
|
-
const inputHandler = (0, _utils_1.useInputHandler)(name, value, validations, register,
|
|
24
|
+
const inputHandler = (0, _utils_1.useInputHandler)(name, value, validations, register, false);
|
|
26
25
|
const randomId = (0, _utils_1.useInputRandomId)();
|
|
27
26
|
// =========================>
|
|
28
27
|
// ## Invalid handler
|
|
@@ -223,7 +222,7 @@ function SelectComponent({ name, label, placeholder, tip, leftIcon, rightIcon, v
|
|
|
223
222
|
}, onKeyDown: (e) => {
|
|
224
223
|
dataOptions?.length && onKeyDownOption(e);
|
|
225
224
|
}, autoComplete: "off", autoFocus: autoFocus }), (multiple && !searchable || (searchable && !inputHandler.focus)) && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("select-multiple-values", leftIcon ? "select-multiple-values-left-icon" : "select-multiple-values-no-icon"), style: { maxWidth: `calc(100% - ${leftIcon ? "5.2rem" : "3.2rem"})` }, children: (0, jsx_runtime_1.jsx)("div", { className: "input-values-container", children: multiple && typeof inputHandler.value != "string" && Array().concat(inputHandler.value)?.map((item, key) => {
|
|
226
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "input-values-item", children: [(0, jsx_runtime_1.jsx)("span", { children: dataOptions?.find((option) => option.value == item)?.label }), (0, jsx_runtime_1.jsx)(
|
|
225
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "input-values-item", children: [(0, jsx_runtime_1.jsx)("span", { children: dataOptions?.find((option) => option.value == item)?.label }), (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/times", className: "input-values-delete", onClick: () => {
|
|
227
226
|
const values = Array().concat(inputHandler.value);
|
|
228
227
|
const index = values.findIndex((val) => val == item);
|
|
229
228
|
inputHandler.setValue(values.filter((_, val) => val != index));
|
|
@@ -233,11 +232,11 @@ function SelectComponent({ name, label, placeholder, tip, leftIcon, rightIcon, v
|
|
|
233
232
|
onChange?.("");
|
|
234
233
|
}
|
|
235
234
|
} })] }, key));
|
|
236
|
-
}) }) })), leftIcon && ((0, jsx_runtime_1.jsx)(
|
|
235
|
+
}) }) })), leftIcon && ((0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { className: (0, _utils_1.cn)("input-icon", "input-icon-left", disabled && "input-icon-disabled", inputHandler.focus && "input-icon-focus", (0, _utils_1.pcn)(className, "icon"), disabled && (0, _utils_1.pcn)(className, "icon", "disabled"), inputHandler.focus && (0, _utils_1.pcn)(className, "icon", "focus")), icon: leftIcon })), !multiple && clearable && inputHandler.value && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("input-icon", "input-icon-clear", disabled && "input-icon-disabled", (0, _utils_1.pcn)(className, "icon"), disabled && (0, _utils_1.pcn)(className, "icon", "disabled")), onClick: () => {
|
|
237
236
|
setInputShowValue("");
|
|
238
237
|
inputHandler.setValue("");
|
|
239
238
|
onChange?.("");
|
|
240
|
-
}, children: (0, jsx_runtime_1.jsx)(
|
|
239
|
+
}, children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/times" }) })), (0, jsx_runtime_1.jsx)("label", { htmlFor: randomId, className: (0, _utils_1.cn)("input-icon", "input-icon-right", "select-icon-dropdown", disabled && "input-icon-disabled", (0, _utils_1.pcn)(className, "icon"), disabled && (0, _utils_1.pcn)(className, "icon", "disabled")), children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/chevron-down" }) })] }), !!dataOptions?.length && showOption && !loadingOption && !!filteredOptions?.length && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("ul", { className: (0, _utils_1.cn)("input-suggest-container scroll-sm", inputHandler.focus && "input-suggest-container-active", (0, _utils_1.pcn)(className, "suggest")), children: (newOption ? [newOption, ...filteredOptions] : filteredOptions).map((option, key) => {
|
|
241
240
|
const selected = !!((typeof inputHandler.value == "string" || typeof inputHandler.value == "number") && inputHandler.value == option.value) ||
|
|
242
241
|
(Array.isArray(inputHandler.value) && Array().concat(inputHandler.value).find((val) => val == option.value));
|
|
243
242
|
return ((0, jsx_runtime_1.jsxs)("li", { className: (0, _utils_1.cn)("input-suggest", (key == activeOption || selected) && "input-suggest-active", (0, _utils_1.pcn)(className, "suggest-item"), (key == activeOption || selected) && (0, _utils_1.pcn)(className, "suggest-item", "active")), onMouseDown: () => {
|
|
@@ -270,6 +269,6 @@ function SelectComponent({ name, label, placeholder, tip, leftIcon, rightIcon, v
|
|
|
270
269
|
}
|
|
271
270
|
}
|
|
272
271
|
setTimeout(() => inputHandler.setFocus(false), 120);
|
|
273
|
-
}, children: [selected && ((0, jsx_runtime_1.jsx)(
|
|
272
|
+
}, children: [selected && ((0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/check", className: "select-suggest-check" })), option.label] }, key));
|
|
274
273
|
}) }) })), invalidMessage && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-error-message", (0, _utils_1.pcn)(className, "error")), children: invalidMessage }))] }) }));
|
|
275
274
|
}
|
|
@@ -6,7 +6,9 @@ export interface FloatingPageProps {
|
|
|
6
6
|
children?: any;
|
|
7
7
|
tip?: string | ReactNode;
|
|
8
8
|
footer?: string | ReactNode;
|
|
9
|
+
size?: string | number;
|
|
10
|
+
maxSize?: string | number;
|
|
9
11
|
/** Use custom class with: "backdrop::", "header::", "footer::". */
|
|
10
12
|
className?: string;
|
|
11
13
|
}
|
|
12
|
-
export declare function FloatingPageComponent({ show, onClose, title, children, tip, footer, className, }: FloatingPageProps): import("@types/react").JSX.Element;
|
|
14
|
+
export declare function FloatingPageComponent({ show, onClose, title, children, tip, footer, className, size, maxSize, }: FloatingPageProps): import("@types/react").JSX.Element;
|
|
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.FloatingPageComponent = FloatingPageComponent;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
8
7
|
const Button_component_1 = require("../button/Button.component");
|
|
9
8
|
const _utils_1 = require("@utils");
|
|
9
|
+
const BottomSheet_component_1 = require("./BottomSheet.component");
|
|
10
10
|
;
|
|
11
|
-
function FloatingPageComponent({ show, onClose, title, children, tip, footer, className = "", }) {
|
|
11
|
+
function FloatingPageComponent({ show, onClose, title, children, tip, footer, className = "", size, maxSize, }) {
|
|
12
|
+
const { isSm } = (0, _utils_1.useResponsive)();
|
|
12
13
|
(0, react_1.useEffect)(() => {
|
|
13
14
|
if (show) {
|
|
14
15
|
document.getElementsByTagName("body")[0].style.overflow = "hidden";
|
|
@@ -23,5 +24,8 @@ function FloatingPageComponent({ show, onClose, title, children, tip, footer, cl
|
|
|
23
24
|
_utils_1.shortcut.unregister("escape");
|
|
24
25
|
};
|
|
25
26
|
}, [show]);
|
|
26
|
-
|
|
27
|
+
if (isSm) {
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)(BottomSheet_component_1.BottomSheetComponent, { show: show, onClose: onClose, size: size, maxSize: maxSize, footer: footer, className: className, children: [(0, jsx_runtime_1.jsx)("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 })] })) }), show && children] }));
|
|
29
|
+
}
|
|
30
|
+
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)(Button_component_1.ButtonComponent, { icon: "solid/times", 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
31
|
}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.ModalComponent = ModalComponent;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
8
7
|
const _utils_1 = require("@utils");
|
|
9
8
|
const Button_component_1 = require("../button/Button.component");
|
|
10
9
|
;
|
|
@@ -23,5 +22,5 @@ function ModalComponent({ show, onClose, title, children, tip, footer, className
|
|
|
23
22
|
_utils_1.shortcut.unregister("escape");
|
|
24
23
|
};
|
|
25
24
|
}, [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)(Button_component_1.ButtonComponent, { icon:
|
|
25
|
+
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)(Button_component_1.ButtonComponent, { icon: "solid/times", 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
26
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { ApiType } from "@utils";
|
|
3
|
-
import { ButtonProps } from "
|
|
3
|
+
import { ButtonProps } from "@components";
|
|
4
4
|
type SubmitIDB = {
|
|
5
5
|
idb: {
|
|
6
6
|
store: string;
|
|
@@ -22,5 +22,5 @@ export interface ModalConfirmProps {
|
|
|
22
22
|
/** Use custom class with: "backdrop::", "header::", "footer::". */
|
|
23
23
|
className?: string;
|
|
24
24
|
}
|
|
25
|
-
export declare function ModalConfirmComponent({ show, title, children,
|
|
25
|
+
export declare function ModalConfirmComponent({ show, title, children, footer, submitControl, onClose, className, }: ModalConfirmProps): import("@types/react").JSX.Element;
|
|
26
26
|
export {};
|
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.ModalConfirmComponent = ModalConfirmComponent;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
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
7
|
const _utils_1 = require("@utils");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const BottomSheet_component_1 = require("./BottomSheet.component");
|
|
8
|
+
const _components_1 = require("@components");
|
|
9
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
13
10
|
;
|
|
14
|
-
function ModalConfirmComponent({ show, title, children,
|
|
11
|
+
function ModalConfirmComponent({ show, title, children, footer, submitControl, onClose, className = "", }) {
|
|
15
12
|
const { isSm } = (0, _utils_1.useResponsive)();
|
|
16
13
|
const [toast, setToast] = (0, react_1.useState)(false);
|
|
17
14
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
@@ -29,11 +26,14 @@ function ModalConfirmComponent({ show, title, children, icon, footer, submitCont
|
|
|
29
26
|
_utils_1.shortcut.unregister("escape");
|
|
30
27
|
};
|
|
31
28
|
}, [show]);
|
|
32
|
-
const renderChildren = (
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
const renderChildren = (actionSize = 'md') => {
|
|
30
|
+
if (toast == "success") {
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center h-full py-6 transition-all duration-300 animate-intro-down", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-12 h-12 rounded-full bg-blue-50 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/check", className: "text-primary text-2xl" }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-primary text-lg font-semibold mt-4", children: "Berhasil!" })] }));
|
|
32
|
+
}
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [title && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("flex flex-col gap-2 p-6", (0, _utils_1.pcn)(className, "header")), children: (0, jsx_runtime_1.jsx)("h6", { className: "font-semibold text-lg", children: title }) })), children, toast == "failed" && ((0, jsx_runtime_1.jsx)("div", { className: "px-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-4 w-full p-4 rounded-sm border border-danger bg-light-danger flex gap-4 items-center", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("div", { className: "w-10 h-10 rounded-full bg-danger/20 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/exclamation-triangle", className: "text-danger text-lg" }) }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-danger text-sm font-semibold", children: "Terjadi Masalah, Coba ulangi lagi!" })] }) })), renderAction(actionSize)] }));
|
|
34
|
+
};
|
|
35
35
|
const renderAction = (size = 'md') => {
|
|
36
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-center pt-
|
|
36
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-center gap-4 p-6 pt-2", children: [(0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { label: "Batal", variant: "outline", onClick: () => onClose(), block: true, size: size }), (0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { label: "Konfirmasi", loading: loading, onClick: async () => {
|
|
37
37
|
if (!submitControl?.onSubmit)
|
|
38
38
|
return;
|
|
39
39
|
setLoading(true);
|
|
@@ -55,16 +55,18 @@ function ModalConfirmComponent({ show, title, children, icon, footer, submitCont
|
|
|
55
55
|
}
|
|
56
56
|
if (response?.status == 200 || response?.status == 201) {
|
|
57
57
|
setToast("success");
|
|
58
|
+
setTimeout(() => setToast(false), 1000);
|
|
58
59
|
submitControl?.onSuccess?.();
|
|
59
60
|
setLoading(false);
|
|
60
61
|
}
|
|
61
62
|
else {
|
|
62
63
|
setToast("failed");
|
|
64
|
+
setTimeout(() => setToast(false), 5000);
|
|
63
65
|
submitControl?.onError?.();
|
|
64
66
|
setLoading(false);
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
|
-
},
|
|
69
|
+
}, block: true, size: size, ...submitControl })] }));
|
|
68
70
|
};
|
|
69
|
-
return ((0, jsx_runtime_1.
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)(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.jsx)("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() })] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(_components_1.BottomSheetComponent, { show: show, onClose: onClose, size: 220, children: renderChildren('lg') }) })) }));
|
|
70
72
|
}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.ToastComponent = ToastComponent;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
8
7
|
const _utils_1 = require("@utils");
|
|
9
8
|
const Button_component_1 = require("../button/Button.component");
|
|
10
9
|
;
|
|
@@ -51,7 +50,7 @@ function ToastComponent({ show, onClose, title, children, footer, className = ""
|
|
|
51
50
|
}, 1000);
|
|
52
51
|
setTimerId(id);
|
|
53
52
|
};
|
|
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)(Button_component_1.ButtonComponent, { icon:
|
|
53
|
+
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)(Button_component_1.ButtonComponent, { icon: "solid/times", variant: "simple", paint: "danger", onClick: () => {
|
|
55
54
|
clearInterval(timerId || "");
|
|
56
55
|
onClose();
|
|
57
56
|
}, 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 }))] }) }));
|
|
@@ -6,17 +6,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.BottombarComponent = BottombarComponent;
|
|
8
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
9
10
|
const link_1 = __importDefault(require("next/link"));
|
|
10
11
|
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
12
|
const _utils_1 = require("@utils");
|
|
14
13
|
const defaultItems = [
|
|
15
|
-
{ icon:
|
|
16
|
-
{ icon:
|
|
17
|
-
{ icon:
|
|
18
|
-
{ icon:
|
|
19
|
-
{ icon:
|
|
14
|
+
{ icon: "solid/home", path: "/_example/bottombar", activeKey: "home" },
|
|
15
|
+
{ icon: "solid/clipboard", path: "/", activeKey: "clipboard" },
|
|
16
|
+
{ icon: "solid/crosshairs", path: "/", activeKey: "crosshairs" },
|
|
17
|
+
{ icon: "solid/sack-dollar", path: "/", activeKey: "sack-dollar" },
|
|
18
|
+
{ icon: "solid/user-circle", path: "/", activeKey: "profile" },
|
|
20
19
|
];
|
|
21
20
|
function BottombarComponent({ className = "", active, items = defaultItems, }) {
|
|
22
21
|
const pathname = (0, navigation_1.usePathname)();
|
|
@@ -27,6 +26,6 @@ function BottombarComponent({ className = "", active, items = defaultItems, }) {
|
|
|
27
26
|
};
|
|
28
27
|
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
28
|
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)(
|
|
29
|
+
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)(skalfa_icon_1.Icon, { icon: item.icon }) }) }, key));
|
|
31
30
|
}) }) }) }));
|
|
32
31
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type IconName } from "@skalfa/skalfa-icon";
|
|
2
2
|
export interface FooterLinkProps {
|
|
3
3
|
label: string;
|
|
4
4
|
path: string;
|
|
@@ -8,7 +8,7 @@ export interface FooterColumnProps {
|
|
|
8
8
|
items: FooterLinkProps[];
|
|
9
9
|
}
|
|
10
10
|
export interface FooterSocialProps {
|
|
11
|
-
icon:
|
|
11
|
+
icon: IconName;
|
|
12
12
|
path: string;
|
|
13
13
|
}
|
|
14
14
|
export interface FooterProps {
|
|
@@ -6,14 +6,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.FooterComponent = FooterComponent;
|
|
8
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
9
10
|
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
11
|
const defaultSocials = [
|
|
13
|
-
{ icon:
|
|
14
|
-
{ icon:
|
|
15
|
-
{ icon:
|
|
16
|
-
{ icon:
|
|
12
|
+
{ icon: "brands/facebook", path: "" },
|
|
13
|
+
{ icon: "brands/linkedin", path: "" },
|
|
14
|
+
{ icon: "brands/github", path: "https://github.com/SE-JE" },
|
|
15
|
+
{ icon: "brands/instagram", path: "https://www.instagram.com/seje.digital/" },
|
|
17
16
|
];
|
|
18
17
|
const defaultColumns = [
|
|
19
18
|
{
|
|
@@ -45,5 +44,5 @@ const defaultColumns = [
|
|
|
45
44
|
},
|
|
46
45
|
];
|
|
47
46
|
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)(
|
|
47
|
+
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)(skalfa_icon_1.Icon, { 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
48
|
}
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.HeadbarComponent = HeadbarComponent;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
6
7
|
const navigation_1 = require("next/navigation");
|
|
7
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
8
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
9
8
|
;
|
|
10
9
|
function HeadbarComponent({ title, backHref, rightContent }) {
|
|
11
10
|
const router = (0, navigation_1.useRouter)();
|
|
12
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between w-full items-center mt-2 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [backHref && ((0, jsx_runtime_1.jsx)("div", { className: "w-8 aspect-square flex justify-center items-center cursor-pointer", onClick: () => typeof backHref != "boolean" ? router.push(backHref) : router.back(), children: (0, jsx_runtime_1.jsx)(
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between w-full items-center mt-2 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [backHref && ((0, jsx_runtime_1.jsx)("div", { className: "w-8 aspect-square flex justify-center items-center cursor-pointer", onClick: () => typeof backHref != "boolean" ? router.push(backHref) : router.back(), children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/chevron-left", className: "text-secondary text-xl" }) })), (0, jsx_runtime_1.jsx)("p", { className: "text-lg font-bold px-2", children: title })] }), rightContent && (0, jsx_runtime_1.jsx)("div", { children: rightContent })] }));
|
|
13
12
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type IconName } from "@skalfa/skalfa-icon";
|
|
2
2
|
export interface NavbarItemProps {
|
|
3
3
|
label: string;
|
|
4
4
|
path: string;
|
|
@@ -10,7 +10,7 @@ export interface NavbarProps {
|
|
|
10
10
|
specialLink?: {
|
|
11
11
|
label: string;
|
|
12
12
|
path: string;
|
|
13
|
-
icon?:
|
|
13
|
+
icon?: IconName;
|
|
14
14
|
};
|
|
15
15
|
items?: NavbarItemProps[];
|
|
16
16
|
isLoggedIn?: boolean;
|
|
@@ -6,9 +6,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.NavbarComponent = NavbarComponent;
|
|
8
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
9
10
|
const link_1 = __importDefault(require("next/link"));
|
|
10
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
11
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
12
11
|
const Button_component_1 = require("../button/Button.component");
|
|
13
12
|
const _utils_1 = require("@utils");
|
|
14
13
|
const defaultItems = [
|
|
@@ -19,8 +18,8 @@ const defaultItems = [
|
|
|
19
18
|
const defaultSpecialLink = {
|
|
20
19
|
label: "Special Link",
|
|
21
20
|
path: "",
|
|
22
|
-
icon:
|
|
21
|
+
icon: "solid/store",
|
|
23
22
|
};
|
|
24
23
|
function NavbarComponent({ logoTitle = "Next Light v.3", logoSubtitle = "The Magic Starter Template", logoPath = "/", specialLink = defaultSpecialLink, items = defaultItems, isLoggedIn = false, onLogin, onRegister, onProfile, className = "", }) {
|
|
25
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("navbar-topbar", className), children: (0, jsx_runtime_1.jsxs)("div", { className: "navbar-container", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-base", children: ["Ini untuk", (0, jsx_runtime_1.jsxs)(link_1.default, { href: specialLink.path, className: "navbar-special-link", children: [specialLink.icon && (0, jsx_runtime_1.jsx)(
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("navbar-topbar", className), children: (0, jsx_runtime_1.jsxs)("div", { className: "navbar-container", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-base", children: ["Ini untuk", (0, jsx_runtime_1.jsxs)(link_1.default, { href: specialLink.path, className: "navbar-special-link", children: [specialLink.icon && (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: specialLink.icon, className: "mr-1" }), specialLink.label] })] }), (0, jsx_runtime_1.jsx)("div", { className: "navbar-menu", children: items.map((item, key) => ((0, jsx_runtime_1.jsx)(link_1.default, { href: item.path, children: (0, jsx_runtime_1.jsx)("div", { className: "navbar-menu-item-sm", children: item.label }) }, key))) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "navbar-main", children: (0, jsx_runtime_1.jsxs)("div", { className: "navbar-main-container", children: [(0, jsx_runtime_1.jsx)(link_1.default, { href: logoPath, children: (0, jsx_runtime_1.jsxs)("div", { className: "w-max", children: [(0, jsx_runtime_1.jsx)("h1", { className: "navbar-logo-title", children: logoTitle }), logoSubtitle && ((0, jsx_runtime_1.jsx)("p", { className: "navbar-logo-subtitle", children: logoSubtitle }))] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-12 items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "navbar-menu", children: items.map((item, key) => ((0, jsx_runtime_1.jsx)(link_1.default, { href: item.path, children: (0, jsx_runtime_1.jsx)("div", { className: "navbar-menu-item-base", children: item.label }) }, key))) }), (0, jsx_runtime_1.jsx)("div", { className: "w-full flex items-center gap-8", children: !isLoggedIn ? ((0, jsx_runtime_1.jsxs)("div", { className: "navbar-auth-buttons", children: [(0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { label: "Masuk", size: "sm", onClick: onLogin }), (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { label: "Daftar", size: "sm", variant: "light", onClick: onRegister })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 w-max items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "p-2 text-light-foreground hover:text-foreground cursor-pointer", children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/history" }) }), (0, jsx_runtime_1.jsx)("div", { className: "p-2 text-light-foreground hover:text-foreground cursor-pointer", children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/bell" }) }), (0, jsx_runtime_1.jsx)("div", { className: "h-5 w-[1px] bg-foreground mx-2.5" }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2.5 px-4 cursor-pointer -ml-2 text-light-foreground hover:text-foreground", onClick: onProfile, children: (0, jsx_runtime_1.jsx)("div", { className: "h-10 bg-background rounded-full aspect-square overflow-hidden flex justify-center items-center", children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/user" }) }) })] })) })] })] }) })] }));
|
|
26
25
|
}
|
|
@@ -15,19 +15,15 @@ export interface SidebarHeadItemProps {
|
|
|
15
15
|
className?: string;
|
|
16
16
|
}
|
|
17
17
|
export interface sidebarProps {
|
|
18
|
+
id?: string;
|
|
18
19
|
head?: any;
|
|
20
|
+
footer?: any;
|
|
19
21
|
items?: SidebarHeadItemProps[];
|
|
20
22
|
basePath?: string;
|
|
21
|
-
show?: boolean;
|
|
22
|
-
toggle?: boolean;
|
|
23
|
-
onToggleChange?: () => void;
|
|
24
|
-
children?: any;
|
|
25
|
-
hasAccess?: number[];
|
|
26
|
-
onChange?: () => void;
|
|
27
23
|
/** Use custom class with: "backdrop::", "head-item::", "item::", "child-item::". */
|
|
28
24
|
className?: string;
|
|
29
25
|
}
|
|
30
|
-
export declare function SidebarComponent({
|
|
26
|
+
export declare function SidebarComponent({ id, head, footer, items, basePath, className, }: sidebarProps): import("@types/react").JSX.Element;
|
|
31
27
|
export declare function SidebarContentComponent({ children }: {
|
|
32
28
|
children: ReactNode;
|
|
33
29
|
}): import("@types/react").JSX.Element;
|
|
@@ -10,9 +10,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
10
10
|
const react_1 = require("react");
|
|
11
11
|
const navigation_1 = require("next/navigation");
|
|
12
12
|
const link_1 = __importDefault(require("next/link"));
|
|
13
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
14
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
15
13
|
const _utils_1 = require("@utils");
|
|
14
|
+
const _contexts_1 = require("@contexts");
|
|
15
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
16
16
|
;
|
|
17
17
|
;
|
|
18
18
|
;
|
|
@@ -24,16 +24,12 @@ function SidebarWrapper({ path, children, onClick, }) {
|
|
|
24
24
|
return (0, jsx_runtime_1.jsx)("div", { onClick: () => onClick?.(), children: children });
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function SidebarComponent({ head, items, basePath,
|
|
28
|
-
// onChange,
|
|
29
|
-
// hasAccess,
|
|
30
|
-
className = "", }) {
|
|
27
|
+
function SidebarComponent({ id, head, footer, items, basePath, className = "", }) {
|
|
31
28
|
const pathName = (0, navigation_1.usePathname)();
|
|
29
|
+
const { toggle, setToggle } = (0, _contexts_1.useToggleContext)();
|
|
32
30
|
const [shows, setShows] = (0, react_1.useState)([]);
|
|
33
31
|
const setShow = (key) => {
|
|
34
|
-
setShows((prevShows) => prevShows?.find((pk) => pk === key)
|
|
35
|
-
? prevShows.filter((pk) => pk !== key)
|
|
36
|
-
: [...prevShows, key]);
|
|
32
|
+
setShows((prevShows) => prevShows?.find((pk) => pk === key) ? prevShows.filter((pk) => pk !== key) : [...prevShows, key]);
|
|
37
33
|
};
|
|
38
34
|
const checkShow = (key) => {
|
|
39
35
|
if (shows?.includes(key)) {
|
|
@@ -65,23 +61,24 @@ className = "", }) {
|
|
|
65
61
|
});
|
|
66
62
|
});
|
|
67
63
|
}, []);
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
(0, react_1.useEffect)(() => {
|
|
65
|
+
setToggle(`SIDEBAR${id ? "" : "_" + id?.toUpperCase()}`, false);
|
|
66
|
+
}, [pathName]);
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("sidebar-backdrop", toggle[`SIDEBAR${id ? "" : "_" + id?.toUpperCase()}`] ? "scale-100 lg:scale-0" : "scale-0", (0, _utils_1.pcn)(className, "backdrop")), onClick: () => setToggle(`SIDEBAR${id ? "" : "_" + id?.toUpperCase()}`) }), (0, jsx_runtime_1.jsxs)("aside", { className: (0, _utils_1.cn)("sidebar-base scroll-sm", toggle[`SIDEBAR${id ? "" : "_" + id?.toUpperCase()}`] ? "w-full sm:w-[280px]" : "w-0 sm:w-14 lg:w-[280px]", (0, _utils_1.pcn)(className, "base")), children: [(0, jsx_runtime_1.jsx)("div", { className: toggle[`SIDEBAR${id ? "" : "_" + id?.toUpperCase()}`] ? "block" : "hidden lg:block", children: head }), (0, jsx_runtime_1.jsx)("div", { className: toggle[`SIDEBAR${id ? "" : "_" + id?.toUpperCase()}`] ? "hidden" : "flex justify-center pt-4 h-full lg:hidden", onClick: () => setToggle(`SIDEBAR${id ? "" : "_" + id?.toUpperCase()}`), children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/bars" }) }), (0, jsx_runtime_1.jsx)("nav", { className: (0, _utils_1.cn)("flex flex-col flex-1 overflow-hidden", toggle[`SIDEBAR${id ? "" : "_" + id?.toUpperCase()}`] ? "w-full" : "w-0 lg:w-full"), children: items?.map((menu_head, menu_head_key) => {
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("sidebar-head-item", menu_head?.collapse && "cursor-pointer", (0, _utils_1.pcn)(className, "head-item"), menu_head?.className), onClick: () => setShow(String(menu_head_key)), children: [menu_head?.label, menu_head.collapse && ((0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/chevron-down", className: (0, _utils_1.cn)(checkShow(String(menu_head_key)) && "rotate-180") }))] }), (!menu_head?.collapse || checkShow(String(menu_head_key))) &&
|
|
70
69
|
menu_head?.items?.map((menu, menu_key) => {
|
|
71
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SidebarWrapper, { path: menu?.path ? `${basePath || ""}${menu?.path}` : "", onClick: () => setShow(`${menu_head_key}.${menu_key}`), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("sidebar-item", menu?.path &&
|
|
72
|
-
cekActive(menu?.path || "") &&
|
|
73
|
-
"sidebar-item-active", (0, _utils_1.pcn)(className, "item"), menu?.className), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-center", children: [menu?.leftContent, (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium", children: menu?.label })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-center", children: [menu?.rightContent, menu?.items?.length && ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faChevronUp, className: `text-sm ${checkShow(`${menu_head_key}.${menu_key}`) || "rotate-180"}` }))] })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "px-4", children: (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col", children: menu?.items?.length &&
|
|
70
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SidebarWrapper, { path: menu?.path ? `${basePath || ""}${menu?.path}` : "", onClick: () => setShow(`${menu_head_key}.${menu_key}`), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("sidebar-item", menu?.path && cekActive(menu?.path || "") && "sidebar-item-active", (0, _utils_1.pcn)(className, "item"), menu?.className), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-center", children: [menu?.leftContent, (0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: menu?.label })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-center", children: [menu?.rightContent, menu?.items?.length && ((0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/chevron-up", className: `text-[10px] ${checkShow(`${menu_head_key}.${menu_key}`) || "rotate-180"}` }))] })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "px-4", children: (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col", children: menu?.items?.length &&
|
|
74
71
|
checkShow(`${menu_head_key}.${menu_key}`) &&
|
|
75
72
|
menu?.items?.map((child, menu_child_key) => {
|
|
76
73
|
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(SidebarWrapper, { path: child?.path
|
|
77
74
|
? `${basePath || ""}${child?.path}`
|
|
78
75
|
: "", onClick: () => setShow(`${menu_head_key}.${menu_key}.${menu_child_key}`), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("sidebar-child-item", child?.path &&
|
|
79
76
|
cekActive(child?.path || "") &&
|
|
80
|
-
"sidebar-child-item-active", (0, _utils_1.pcn)(className, "child-item"), child?.className), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-center", children: [child?.leftContent, (0, jsx_runtime_1.jsx)("span", { className: "text-
|
|
77
|
+
"sidebar-child-item-active", (0, _utils_1.pcn)(className, "child-item"), child?.className), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-center", children: [child?.leftContent, (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] font-medium", children: child?.label })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-center", children: [child?.rightContent, child?.items?.length && ((0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/chevron-up", className: `block text-[10px] ${checkShow(`${menu_head_key}.${menu_key}`) || "rotate-180"}` }))] })] }) }) }, `${menu_head_key}.${menu_key}.${menu_child_key}`));
|
|
81
78
|
}) }) })] }, `${menu_head_key}.${menu_key}`));
|
|
82
79
|
})] }) }, menu_head_key));
|
|
83
|
-
}) })] })] }));
|
|
80
|
+
}) }), (0, jsx_runtime_1.jsx)("div", { className: toggle[`SIDEBAR${id ? "" : "_" + id?.toUpperCase()}`] ? "block" : "hidden lg:block", children: footer })] })] }));
|
|
84
81
|
}
|
|
85
82
|
function SidebarContentComponent({ children }) {
|
|
86
|
-
return ((0, jsx_runtime_1.jsx)("main", { className: "
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)("main", { className: "w-full sm:ml-14 sm:w-[calc(100vw-56px)] lg:ml-[280px] lg:w-[calc(100vw-280px)] min-h-screen overflow-x-hidden", children: children }));
|
|
87
84
|
}
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { ApiType, FormErrorType, FormRegisterType, FormValueType, ValidationRules, DBSchema } from "@utils";
|
|
3
|
-
import { InputCheckboxProps } from "../
|
|
4
|
-
import { InputProps } from "../input/Input.component";
|
|
5
|
-
import { InputCurrencyProps } from "../input/InputCurrency.component";
|
|
6
|
-
import { InputDateProps } from "../input/InputDate.component";
|
|
7
|
-
import { InputNumberProps } from "../input/InputNumber.component";
|
|
8
|
-
import { InputOtpProps } from "../input/InputOtp.component";
|
|
9
|
-
import { InputPasswordProps } from "../input/InputPassword.component";
|
|
10
|
-
import { InputRadioProps } from "../input/InputRadio.component";
|
|
11
|
-
import { SelectProps } from "../input/Select.component";
|
|
12
|
-
import { InputTimeProps } from "../input/InputTime.component";
|
|
13
|
-
import { InputImageProps } from "../input/InputImage.component";
|
|
14
|
-
import { InputDateTimeProps } from "../input/InputDatetime.component";
|
|
3
|
+
import { InputProps, InputCheckboxProps, InputCurrencyProps, InputDateProps, InputNumberProps, InputRadioProps, SelectProps, InputPasswordProps, InputOtpProps, InputTimeProps, InputImageProps, InputDateTimeProps } from "../";
|
|
15
4
|
type formCustomConstructionProps = ({ formControl, values, setValues, setRegister, errors, setErrors, }: {
|
|
16
5
|
formControl: (name: string) => {
|
|
17
6
|
register: (regName: string, regValidations?: ValidationRules | undefined) => void;
|
|
18
|
-
unregister: (regName: string) => void;
|
|
19
7
|
onChange: (e: any) => void;
|
|
20
8
|
value: any;
|
|
21
9
|
invalid: any;
|
|
@@ -36,7 +24,6 @@ type ClusterConstruction = {
|
|
|
36
24
|
tip: string;
|
|
37
25
|
fields: FormType[];
|
|
38
26
|
wrap: boolean;
|
|
39
|
-
min?: number;
|
|
40
27
|
/** Use custom class with: "label::", "tip::", "error::", "icon::", "suggest::", "suggest-item::". */
|
|
41
28
|
className: string;
|
|
42
29
|
};
|
|
@@ -57,26 +44,12 @@ type ConstructionMap = {
|
|
|
57
44
|
custom: formCustomConstructionProps;
|
|
58
45
|
};
|
|
59
46
|
type TypeKeys = keyof ConstructionMap;
|
|
60
|
-
export type WatchContext = {
|
|
61
|
-
values: Record<string, any>;
|
|
62
|
-
self: string;
|
|
63
|
-
prev: WatchAction;
|
|
64
|
-
};
|
|
65
|
-
export type WatchAction = {
|
|
66
|
-
disabled?: boolean;
|
|
67
|
-
hidden?: boolean;
|
|
68
|
-
value?: any;
|
|
69
|
-
required?: boolean;
|
|
70
|
-
readonly?: boolean;
|
|
71
|
-
reset?: boolean;
|
|
72
|
-
};
|
|
73
47
|
export interface FormType<T extends TypeKeys = keyof ConstructionMap> {
|
|
74
48
|
col?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | string;
|
|
75
49
|
className?: string;
|
|
76
50
|
construction?: ConstructionMap[T];
|
|
77
51
|
type?: T;
|
|
78
52
|
onHide?: (values: any) => boolean;
|
|
79
|
-
watch?: (ctx: WatchContext) => WatchAction | undefined;
|
|
80
53
|
}
|
|
81
54
|
export interface formSupervisionProps {
|
|
82
55
|
title?: string;
|
|
@@ -97,7 +70,9 @@ export interface formSupervisionProps {
|
|
|
97
70
|
}) => ReactNode;
|
|
98
71
|
onSuccess?: (data: any) => void;
|
|
99
72
|
onError?: (code: number) => void;
|
|
73
|
+
successMessage?: string;
|
|
100
74
|
className?: string;
|
|
75
|
+
id?: string;
|
|
101
76
|
}
|
|
102
|
-
export declare function FormSupervisionComponent({ title, fields, submitControl, confirmation, defaultValue, onSuccess, onError, footerControl, payload, className, }: formSupervisionProps): import("@types/react").JSX.Element;
|
|
77
|
+
export declare function FormSupervisionComponent({ title, fields, submitControl, confirmation, defaultValue, onSuccess, onError, footerControl, payload, className, successMessage, id, }: formSupervisionProps): import("@types/react").JSX.Element;
|
|
103
78
|
export {};
|