@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.
Files changed (168) hide show
  1. package/dist/accordion/Accordion.component.d.ts +1 -1
  2. package/dist/breadcrumb/Breadcrumb.component.d.ts +1 -1
  3. package/dist/button/Button.component.d.ts +1 -1
  4. package/dist/card/AlertCard.component.d.ts +1 -1
  5. package/dist/card/Card.component.d.ts +1 -1
  6. package/dist/card/DashboardCard.component.d.ts +1 -1
  7. package/dist/card/GalleryCard.component.d.ts +1 -1
  8. package/dist/card/ProductCard.component.d.ts +1 -1
  9. package/dist/card/ProfileCard.component.d.ts +1 -1
  10. package/dist/carousel/Carousel.component.d.ts +1 -1
  11. package/dist/chip/Chip.component.d.ts +1 -1
  12. package/dist/input/Checkbox.component.d.ts +1 -1
  13. package/dist/input/Input.component.d.ts +1 -1
  14. package/dist/input/InputCheckbox.component.d.ts +1 -1
  15. package/dist/input/InputCurrency.component.d.ts +1 -1
  16. package/dist/input/InputDate.component.d.ts +1 -1
  17. package/dist/input/InputDate.component.js +4 -4
  18. package/dist/input/InputDatetime.component.d.ts +1 -1
  19. package/dist/input/InputDocument.component.d.ts +1 -1
  20. package/dist/input/InputMap.component.d.ts +1 -1
  21. package/dist/input/InputNumber.component.d.ts +1 -1
  22. package/dist/input/InputPassword.component.d.ts +1 -1
  23. package/dist/input/InputRadio.component.d.ts +1 -1
  24. package/dist/input/InputTime.component.d.ts +1 -1
  25. package/dist/input/InputValues.component.d.ts +1 -1
  26. package/dist/input/Radio.component.d.ts +1 -1
  27. package/dist/input/Select.component.d.ts +1 -1
  28. package/dist/modal/FloatingPage.component.d.ts +1 -1
  29. package/dist/modal/Modal.component.d.ts +1 -1
  30. package/dist/modal/ModalConfirm.component.d.ts +1 -1
  31. package/dist/modal/Toast.component.d.ts +1 -1
  32. package/dist/nav/Bottombar.component.d.ts +1 -1
  33. package/dist/nav/Footer.component.d.ts +1 -1
  34. package/dist/nav/Headbar.component.d.ts +4 -11
  35. package/dist/nav/Headbar.component.js +3 -23
  36. package/dist/nav/Navbar.component.d.ts +1 -1
  37. package/dist/nav/Sidebar.component.d.ts +2 -2
  38. package/dist/nav/Tabbar.component.d.ts +1 -1
  39. package/dist/nav/Wizard.component.d.ts +1 -1
  40. package/dist/supervision/FormSupervision.component.d.ts +1 -1
  41. package/dist/supervision/TableSupervision.component.d.ts +1 -1
  42. package/dist/table/ControlBar.component.d.ts +1 -1
  43. package/dist/table/FilterComponent.d.ts +2 -2
  44. package/dist/table/Pagination.component.d.ts +1 -1
  45. package/dist/table/Table.component.d.ts +1 -1
  46. package/dist/typography/TypographyArticle.component.d.ts +1 -1
  47. package/dist/typography/TypographyColumn.component.d.ts +1 -1
  48. package/dist/typography/TypographyContent.component.d.ts +1 -1
  49. package/dist/typography/TypographyTips.component.d.ts +1 -1
  50. package/dist/wrap/Image.component.d.ts +1 -1
  51. package/dist/wrap/ScrollContainer.component.d.ts +1 -1
  52. package/dist/wrap/ShortcutProvider.d.ts +1 -1
  53. package/dist/wrap/Swipe.component.d.ts +1 -1
  54. package/package.json +2 -2
  55. package/dist/src/accordion/Accordion.component.d.ts +0 -13
  56. package/dist/src/accordion/Accordion.component.js +0 -25
  57. package/dist/src/breadcrumb/Breadcrumb.component.d.ts +0 -14
  58. package/dist/src/breadcrumb/Breadcrumb.component.js +0 -21
  59. package/dist/src/button/Button.component.d.ts +0 -21
  60. package/dist/src/button/Button.component.js +0 -19
  61. package/dist/src/card/AlertCard.component.d.ts +0 -11
  62. package/dist/src/card/AlertCard.component.js +0 -9
  63. package/dist/src/card/Card.component.d.ts +0 -5
  64. package/dist/src/card/Card.component.js +0 -9
  65. package/dist/src/card/DashboardCard.component.d.ts +0 -9
  66. package/dist/src/card/DashboardCard.component.js +0 -13
  67. package/dist/src/card/GalleryCard.component.d.ts +0 -7
  68. package/dist/src/card/GalleryCard.component.js +0 -13
  69. package/dist/src/card/ProductCard.component.d.ts +0 -9
  70. package/dist/src/card/ProductCard.component.js +0 -13
  71. package/dist/src/card/ProfileCard.component.d.ts +0 -10
  72. package/dist/src/card/ProfileCard.component.js +0 -13
  73. package/dist/src/carousel/Carousel.component.d.ts +0 -13
  74. package/dist/src/carousel/Carousel.component.js +0 -37
  75. package/dist/src/chip/Chip.component.d.ts +0 -6
  76. package/dist/src/chip/Chip.component.js +0 -12
  77. package/dist/src/index.d.ts +0 -13
  78. package/dist/src/index.js +0 -29
  79. package/dist/src/input/Checkbox.component.d.ts +0 -13
  80. package/dist/src/input/Checkbox.component.js +0 -23
  81. package/dist/src/input/Input.component.d.ts +0 -23
  82. package/dist/src/input/Input.component.js +0 -134
  83. package/dist/src/input/InputCheckbox.component.d.ts +0 -27
  84. package/dist/src/input/InputCheckbox.component.js +0 -53
  85. package/dist/src/input/InputCurrency.component.d.ts +0 -21
  86. package/dist/src/input/InputCurrency.component.js +0 -30
  87. package/dist/src/input/InputDate.component.d.ts +0 -24
  88. package/dist/src/input/InputDate.component.js +0 -107
  89. package/dist/src/input/InputDatetime.component.d.ts +0 -17
  90. package/dist/src/input/InputDatetime.component.js +0 -75
  91. package/dist/src/input/InputDocument.component.d.ts +0 -22
  92. package/dist/src/input/InputDocument.component.js +0 -88
  93. package/dist/src/input/InputImage.component.d.ts +0 -23
  94. package/dist/src/input/InputImage.component.js +0 -260
  95. package/dist/src/input/InputMap.component.d.ts +0 -25
  96. package/dist/src/input/InputMap.component.js +0 -101
  97. package/dist/src/input/InputNumber.component.d.ts +0 -19
  98. package/dist/src/input/InputNumber.component.js +0 -40
  99. package/dist/src/input/InputOtp.component.d.ts +0 -14
  100. package/dist/src/input/InputOtp.component.js +0 -65
  101. package/dist/src/input/InputPassword.component.d.ts +0 -17
  102. package/dist/src/input/InputPassword.component.js +0 -59
  103. package/dist/src/input/InputRadio.component.d.ts +0 -27
  104. package/dist/src/input/InputRadio.component.js +0 -56
  105. package/dist/src/input/InputTime.component.d.ts +0 -23
  106. package/dist/src/input/InputTime.component.js +0 -73
  107. package/dist/src/input/InputValues.component.d.ts +0 -9
  108. package/dist/src/input/InputValues.component.js +0 -19
  109. package/dist/src/input/Radio.component.d.ts +0 -12
  110. package/dist/src/input/Radio.component.js +0 -22
  111. package/dist/src/input/Select.component.d.ts +0 -47
  112. package/dist/src/input/Select.component.js +0 -275
  113. package/dist/src/modal/BottomSheet.component.d.ts +0 -12
  114. package/dist/src/modal/BottomSheet.component.js +0 -161
  115. package/dist/src/modal/FloatingPage.component.d.ts +0 -12
  116. package/dist/src/modal/FloatingPage.component.js +0 -27
  117. package/dist/src/modal/Modal.component.d.ts +0 -12
  118. package/dist/src/modal/Modal.component.js +0 -27
  119. package/dist/src/modal/ModalConfirm.component.d.ts +0 -26
  120. package/dist/src/modal/ModalConfirm.component.js +0 -68
  121. package/dist/src/modal/Toast.component.d.ts +0 -11
  122. package/dist/src/modal/Toast.component.js +0 -58
  123. package/dist/src/nav/Bottombar.component.d.ts +0 -12
  124. package/dist/src/nav/Bottombar.component.js +0 -32
  125. package/dist/src/nav/Footer.component.d.ts +0 -37
  126. package/dist/src/nav/Footer.component.js +0 -49
  127. package/dist/src/nav/Headbar.component.d.ts +0 -14
  128. package/dist/src/nav/Headbar.component.js +0 -32
  129. package/dist/src/nav/Navbar.component.d.ts +0 -22
  130. package/dist/src/nav/Navbar.component.js +0 -26
  131. package/dist/src/nav/Sidebar.component.d.ts +0 -33
  132. package/dist/src/nav/Sidebar.component.js +0 -87
  133. package/dist/src/nav/Tabbar.component.d.ts +0 -13
  134. package/dist/src/nav/Tabbar.component.js +0 -17
  135. package/dist/src/nav/Wizard.component.d.ts +0 -9
  136. package/dist/src/nav/Wizard.component.js +0 -24
  137. package/dist/src/supervision/FormSupervision.component.d.ts +0 -93
  138. package/dist/src/supervision/FormSupervision.component.js +0 -168
  139. package/dist/src/supervision/TableSupervision.component.d.ts +0 -78
  140. package/dist/src/supervision/TableSupervision.component.js +0 -273
  141. package/dist/src/table/ControlBar.component.d.ts +0 -34
  142. package/dist/src/table/ControlBar.component.js +0 -205
  143. package/dist/src/table/FilterComponent.d.ts +0 -45
  144. package/dist/src/table/FilterComponent.js +0 -132
  145. package/dist/src/table/Pagination.component.d.ts +0 -8
  146. package/dist/src/table/Pagination.component.js +0 -32
  147. package/dist/src/table/Table.component.d.ts +0 -61
  148. package/dist/src/table/Table.component.js +0 -101
  149. package/dist/src/typography/TypographyArticle.component.d.ts +0 -8
  150. package/dist/src/typography/TypographyArticle.component.js +0 -7
  151. package/dist/src/typography/TypographyColumn.component.d.ts +0 -6
  152. package/dist/src/typography/TypographyColumn.component.js +0 -7
  153. package/dist/src/typography/TypographyContent.component.d.ts +0 -6
  154. package/dist/src/typography/TypographyContent.component.js +0 -7
  155. package/dist/src/typography/TypographyTips.component.d.ts +0 -6
  156. package/dist/src/typography/TypographyTips.component.js +0 -7
  157. package/dist/src/wrap/Draggable.component.d.ts +0 -34
  158. package/dist/src/wrap/Draggable.component.js +0 -214
  159. package/dist/src/wrap/Image.component.d.ts +0 -2
  160. package/dist/src/wrap/Image.component.js +0 -13
  161. package/dist/src/wrap/OutsideClick.component.d.ts +0 -6
  162. package/dist/src/wrap/OutsideClick.component.js +0 -34
  163. package/dist/src/wrap/ScrollContainer.component.d.ts +0 -10
  164. package/dist/src/wrap/ScrollContainer.component.js +0 -54
  165. package/dist/src/wrap/ShortcutProvider.d.ts +0 -1
  166. package/dist/src/wrap/ShortcutProvider.js +0 -42
  167. package/dist/src/wrap/Swipe.component.d.ts +0 -14
  168. package/dist/src/wrap/Swipe.component.js +0 -61
@@ -1,26 +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.NavbarComponent = NavbarComponent;
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_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
12
- const _components_1 = require("@components");
13
- const _utils_1 = require("@utils");
14
- const defaultItems = [
15
- { label: "Tentang", path: "" },
16
- { label: "Artikel", path: "" },
17
- { label: "Bantuan", path: "" },
18
- ];
19
- const defaultSpecialLink = {
20
- label: "Special Link",
21
- path: "",
22
- icon: free_solid_svg_icons_1.faStore,
23
- };
24
- 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)(react_fontawesome_1.FontAwesomeIcon, { 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)(_components_1.ButtonComponent, { label: "Masuk", size: "sm", onClick: onLogin }), (0, jsx_runtime_1.jsx)(_components_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)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faHistory }) }), (0, jsx_runtime_1.jsx)("div", { className: "p-2 text-light-foreground hover:text-foreground cursor-pointer", children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faBell }) }), (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)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faUser }) }) })] })) })] })] }) })] }));
26
- }
@@ -1,33 +0,0 @@
1
- import { ReactNode } from "react";
2
- export interface SidebarItemProps {
3
- label: string;
4
- key?: number;
5
- leftContent?: any;
6
- rightContent?: any;
7
- path?: string;
8
- items?: SidebarItemProps[];
9
- className?: string;
10
- }
11
- export interface SidebarHeadItemProps {
12
- label: string;
13
- collapse?: boolean;
14
- items?: SidebarItemProps[];
15
- className?: string;
16
- }
17
- export interface sidebarProps {
18
- head?: any;
19
- items?: SidebarHeadItemProps[];
20
- basePath?: string;
21
- show?: boolean;
22
- toggle?: boolean;
23
- onToggleChange?: () => void;
24
- children?: any;
25
- hasAccess?: number[];
26
- onChange?: () => void;
27
- /** Use custom class with: "backdrop::", "head-item::", "item::", "child-item::". */
28
- className?: string;
29
- }
30
- export declare function SidebarComponent({ head, items, basePath, toggle, onToggleChange, className, }: sidebarProps): import("react").JSX.Element;
31
- export declare function SidebarContentComponent({ children }: {
32
- children: ReactNode;
33
- }): import("react").JSX.Element;
@@ -1,87 +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.SidebarComponent = SidebarComponent;
8
- exports.SidebarContentComponent = SidebarContentComponent;
9
- const jsx_runtime_1 = require("react/jsx-runtime");
10
- const react_1 = require("react");
11
- const navigation_1 = require("next/navigation");
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
- const _utils_1 = require("@utils");
16
- ;
17
- ;
18
- ;
19
- function SidebarWrapper({ path, children, onClick, }) {
20
- if (path) {
21
- return (0, jsx_runtime_1.jsx)(link_1.default, { href: path, children: children });
22
- }
23
- else {
24
- return (0, jsx_runtime_1.jsx)("div", { onClick: () => onClick?.(), children: children });
25
- }
26
- }
27
- function SidebarComponent({ head, items, basePath, toggle, onToggleChange,
28
- // onChange,
29
- // hasAccess,
30
- className = "", }) {
31
- const pathName = (0, navigation_1.usePathname)();
32
- const [shows, setShows] = (0, react_1.useState)([]);
33
- const setShow = (key) => {
34
- setShows((prevShows) => prevShows?.find((pk) => pk === key)
35
- ? prevShows.filter((pk) => pk !== key)
36
- : [...prevShows, key]);
37
- };
38
- const checkShow = (key) => {
39
- if (shows?.includes(key)) {
40
- return true;
41
- }
42
- return false;
43
- };
44
- const cekActive = (path) => {
45
- const activePath = pathName?.split("?")[0]?.replace(`${basePath || ""}`, "") || "/";
46
- const currentPath = `${path ? `${path}` : ""}`;
47
- const isPrefix = (longer, shorter) => {
48
- return (longer.startsWith(shorter) &&
49
- (longer === shorter || longer[shorter.length] === "/"));
50
- };
51
- return (isPrefix(activePath, currentPath) || isPrefix(currentPath, activePath));
52
- };
53
- (0, react_1.useEffect)(() => {
54
- items?.map((head, head_key) => {
55
- head?.items?.map((menu, key) => {
56
- if (menu?.path && cekActive(menu?.path || "")) {
57
- setShow(`${head_key}`);
58
- }
59
- menu?.items?.map((child) => {
60
- if (child?.path && cekActive(child?.path || "")) {
61
- setShow(`${head_key}`);
62
- setShow(`${head_key}.${key}`);
63
- }
64
- });
65
- });
66
- });
67
- }, []);
68
- 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 ? "scale-100 md:scale-0" : "scale-0", (0, _utils_1.pcn)(className, "backdrop")), onClick: () => onToggleChange?.() }), (0, jsx_runtime_1.jsxs)("aside", { className: (0, _utils_1.cn)("sidebar-base scroll-sm", toggle ? "scale-x-100 md:scale-x-0" : "scale-x-0 md:scale-x-100", (0, _utils_1.pcn)(className, "base")), children: [head, (0, jsx_runtime_1.jsx)("nav", { className: "flex flex-col flex-1 mt-3", children: items?.map((menu_head, menu_head_key) => {
69
- return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "px-2 pt-2", 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)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faChevronDown, className: (0, _utils_1.cn)("text-xs", checkShow(String(menu_head_key)) && "rotate-180") }))] }), (!menu_head?.collapse || checkShow(String(menu_head_key))) &&
70
- 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 &&
74
- checkShow(`${menu_head_key}.${menu_key}`) &&
75
- menu?.items?.map((child, menu_child_key) => {
76
- return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(SidebarWrapper, { path: child?.path
77
- ? `${basePath || ""}${child?.path}`
78
- : "", 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
- 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-sm 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)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faChevronUp, className: `block text-sm ${checkShow(`${menu_head_key}.${menu_key}`) || "rotate-180"}` }))] })] }) }) }, `${menu_head_key}.${menu_key}.${menu_child_key}`));
81
- }) }) })] }, `${menu_head_key}.${menu_key}`));
82
- })] }) }, menu_head_key));
83
- }) })] })] }));
84
- }
85
- function SidebarContentComponent({ children }) {
86
- return ((0, jsx_runtime_1.jsx)("main", { className: "sidebar-main-content", children: children }));
87
- }
@@ -1,13 +0,0 @@
1
- export interface TabbarItemProps {
2
- label: string;
3
- value: string | number;
4
- }
5
- export interface TabbarProps {
6
- items: string[] | TabbarItemProps[];
7
- onChange?: (item: string | number) => void;
8
- active?: string | number;
9
- className?: string;
10
- }
11
- export declare function TabbarComponent({ items, onChange, active,
12
- /** Use custom class with: "item::", "active::". */
13
- className, }: TabbarProps): import("react").JSX.Element;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TabbarComponent = TabbarComponent;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const _utils_1 = require("@utils");
6
- ;
7
- ;
8
- function TabbarComponent({ items, onChange, active,
9
- /** Use custom class with: "item::", "active::". */
10
- className = "", }) {
11
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("tabbar-base", (0, _utils_1.pcn)(className, "base")), children: items?.map((item, i) => {
12
- const isItemActive = active == (typeof item != "string" ? item?.value : item);
13
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("tabbar-item", isItemActive
14
- ? "tabbar-item-active"
15
- : "tabbar-item-inactive", (0, _utils_1.pcn)(className, "item"), (0, _utils_1.pcn)(className, "active")), onClick: () => onChange?.(typeof item != "string" ? item?.value : item), children: typeof item != "string" ? item?.label : item }, i));
16
- }) }) }));
17
- }
@@ -1,9 +0,0 @@
1
- import { ReactNode } from "react";
2
- export interface WizardProps {
3
- items: {
4
- label: string;
5
- circle_content: ReactNode;
6
- }[];
7
- active: number;
8
- }
9
- export declare function WizardComponent({ items, active }: WizardProps): import("react").JSX.Element;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WizardComponent = WizardComponent;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const _utils_1 = require("@utils");
6
- ;
7
- function WizardComponent({ items, active }) {
8
- return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("div", { className: "w-full py-4", children: (0, jsx_runtime_1.jsx)("div", { className: "flex", children: items.map((item, key) => {
9
- const isStepActive = key <= active;
10
- const isLineActive = key <= active + 1;
11
- const isLineGradient = key == active + 1;
12
- return ((0, jsx_runtime_1.jsxs)("div", { style: { width: `calc(100% * 1 / ${items.length})` }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "wizard-step-header", children: [key > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "wizard-progress-bar-wrapper", style: {
13
- width: "calc(100% - 2.5rem - 1rem)",
14
- top: "50%",
15
- transform: "translate(-50%, -50%)",
16
- }, children: (0, jsx_runtime_1.jsx)("div", { className: "wizard-progress-bar-bg", children: (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("wizard-progress-bar-fill", isLineGradient
17
- ? "wizard-progress-bar-fill-gradient"
18
- : isLineActive
19
- ? "wizard-progress-bar-fill-active"
20
- : "") }) }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("wizard-circle", isStepActive
21
- ? "wizard-circle-active"
22
- : "wizard-circle-inactive"), children: (0, jsx_runtime_1.jsx)("span", { className: "text-center w-full", children: item.circle_content }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "wizard-label", children: item.label })] }, key));
23
- }) }) }) }));
24
- }
@@ -1,93 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- import { ApiType, FormErrorType, FormRegisterType, FormValueType, ValidationRules, DBSchema } from "@utils";
3
- import { InputProps, InputCheckboxProps, InputCurrencyProps, InputDateProps, InputNumberProps, InputRadioProps, SelectProps, InputPasswordProps, InputOtpProps, InputTimeProps, InputImageProps, InputDateTimeProps, InputMapProps } from "@components";
4
- type formCustomConstructionProps = ({ formControl, values, setValues, setRegister, errors, setErrors, }: {
5
- formControl: (name: string) => {
6
- register: (regName: string, regValidations?: ValidationRules | undefined) => void;
7
- unregister: (regName: string) => void;
8
- onChange: (e: any) => void;
9
- value: any;
10
- invalid: any;
11
- };
12
- values: {
13
- name: string;
14
- value?: any;
15
- }[];
16
- setValues: (values: FormValueType[]) => void;
17
- errors: FormErrorType[];
18
- setErrors: (errors: FormErrorType[]) => void;
19
- setRegister: (registers: FormRegisterType) => void;
20
- prefixName?: string;
21
- }) => ReactNode;
22
- type ClusterConstruction = {
23
- name: string;
24
- label: string;
25
- tip: string;
26
- fields: FormType[];
27
- wrap: boolean;
28
- min?: number;
29
- /** Use custom class with: "label::", "tip::", "error::", "icon::", "suggest::", "suggest-item::". */
30
- className: string;
31
- };
32
- type ConstructionMap = {
33
- default: InputProps;
34
- check: InputCheckboxProps;
35
- currency: InputCurrencyProps;
36
- date: InputDateProps;
37
- datetime: InputDateTimeProps;
38
- time: InputTimeProps;
39
- image: InputImageProps;
40
- cluster: ClusterConstruction;
41
- number: InputNumberProps;
42
- radio: InputRadioProps;
43
- select: SelectProps;
44
- "enter-password": InputPasswordProps;
45
- otp: InputOtpProps;
46
- map: InputMapProps;
47
- custom: formCustomConstructionProps;
48
- };
49
- type TypeKeys = keyof ConstructionMap;
50
- export type WatchContext = {
51
- values: Record<string, any>;
52
- self: string;
53
- prev: WatchAction;
54
- };
55
- export type WatchAction = {
56
- disabled?: boolean;
57
- hidden?: boolean;
58
- value?: any;
59
- required?: boolean;
60
- readonly?: boolean;
61
- reset?: boolean;
62
- };
63
- export interface FormType<T extends TypeKeys = keyof ConstructionMap> {
64
- col?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | string;
65
- className?: string;
66
- construction?: ConstructionMap[T];
67
- type?: T;
68
- onHide?: (values: any) => boolean;
69
- watch?: (ctx: WatchContext) => WatchAction | undefined;
70
- }
71
- export interface formSupervisionProps {
72
- title?: string;
73
- fields: FormType[];
74
- confirmation?: boolean;
75
- defaultValue?: object | null;
76
- payload?: (values: any) => Promise<object> | object;
77
- submitControl: (ApiType & {
78
- idb?: never;
79
- }) | {
80
- idb: {
81
- store: string;
82
- schema?: DBSchema;
83
- };
84
- };
85
- footerControl?: ({ loading }: {
86
- loading: boolean;
87
- }) => ReactNode;
88
- onSuccess?: (data: any) => void;
89
- onError?: (code: number) => void;
90
- className?: string;
91
- }
92
- export declare function FormSupervisionComponent({ title, fields, submitControl, confirmation, defaultValue, onSuccess, onError, footerControl, payload, className, }: formSupervisionProps): React.JSX.Element;
93
- export {};
@@ -1,168 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.FormSupervisionComponent = FormSupervisionComponent;
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
- function FormSupervisionComponent({ title, fields, submitControl, confirmation, defaultValue, onSuccess, onError, footerControl, payload, className = "", }) {
11
- const [modal, setModal] = (0, react_1.useState)(false);
12
- const [fresh, setFresh] = (0, react_1.useState)(true);
13
- const [mapGroups, setMapGroups] = (0, react_1.useState)({});
14
- const [watchState, setWatchState] = (0, react_1.useState)({});
15
- const watchRef = (0, react_1.useRef)({});
16
- const { formControl, setRegister, unregister, unregisterPrefix, values, setValues, errors, setErrors, setDefaultValues, submit, loading, confirm } = (0, _utils_1.useForm)({
17
- ...submitControl,
18
- payload,
19
- confirmation,
20
- onSuccess: (data) => {
21
- onSuccess?.(data);
22
- setModal("success");
23
- resetFresh();
24
- },
25
- onFailed: (code) => {
26
- onError?.(code);
27
- if (code == 422)
28
- confirm.onClose();
29
- else
30
- setModal("failed");
31
- },
32
- });
33
- const resetFresh = () => {
34
- setFresh(false);
35
- setTimeout(() => setFresh(true), 300);
36
- };
37
- (0, react_1.useEffect)(() => {
38
- resetFresh();
39
- }, [fields]);
40
- (0, react_1.useEffect)(() => {
41
- if (defaultValue)
42
- setDefaultValues(defaultValue);
43
- else {
44
- setDefaultValues(null);
45
- resetFresh();
46
- }
47
- }, [defaultValue]);
48
- // ==============================>
49
- // ## Watch: collect watchers from fields
50
- // ==============================>
51
- const collectWatchers = (fieldList, prefix) => {
52
- const result = [];
53
- for (const f of fieldList) {
54
- const inputType = f.type || "default";
55
- const name = prefix ? `${prefix}.${f.construction?.name}` : f.construction?.name || "";
56
- if (inputType === "cluster") {
57
- const cluster = f.construction;
58
- const groupKey = prefix ? `${prefix}.${cluster.name}` : cluster.name;
59
- const group = mapGroups[groupKey] || [0];
60
- for (const gIndex of group) {
61
- result.push(...collectWatchers(cluster.fields, `${cluster.name}[${gIndex}]`));
62
- }
63
- }
64
- else if (f.watch) {
65
- result.push({ name, watch: f.watch, construction: f.construction });
66
- }
67
- }
68
- return result;
69
- };
70
- // ==============================>
71
- // ## Watch: execute watchers on value change
72
- // ==============================>
73
- (0, react_1.useEffect)(() => {
74
- const watchers = collectWatchers(fields);
75
- if (watchers.length === 0) {
76
- if (Object.keys(watchRef.current).length > 0) {
77
- watchRef.current = {};
78
- setWatchState({});
79
- }
80
- return;
81
- }
82
- const valMap = values.reduce((acc, v) => { acc[v.name] = v.value; return acc; }, {});
83
- const nextState = {};
84
- const valueUpdates = [];
85
- for (const { name, watch, construction } of watchers) {
86
- const prev = watchRef.current[name] || {};
87
- const action = watch({ values: valMap, self: name, prev });
88
- if (!action)
89
- continue;
90
- nextState[name] = action;
91
- if (action.hidden && !prev.hidden)
92
- unregister(name);
93
- if (action.required !== prev.required) {
94
- const baseValidations = Array.isArray(construction?.validations) ? [...construction.validations] : [];
95
- const newValidations = action.required ? (baseValidations.includes("required") ? baseValidations : [...baseValidations, "required"]) : baseValidations.filter((v) => v !== "required");
96
- setRegister({ name, validations: newValidations });
97
- }
98
- if (action.reset) {
99
- const cur = valMap[name];
100
- if (cur != null && cur !== "")
101
- valueUpdates.push({ name, value: "" });
102
- }
103
- else if (action.value !== undefined && action.value !== valMap[name]) {
104
- valueUpdates.push({ name, value: action.value });
105
- }
106
- }
107
- if (JSON.stringify(watchRef.current) !== JSON.stringify(nextState)) {
108
- watchRef.current = nextState;
109
- setWatchState(nextState);
110
- }
111
- if (valueUpdates.length > 0) {
112
- const merged = [...values];
113
- for (const upd of valueUpdates) {
114
- const idx = merged.findIndex(v => v.name === upd.name);
115
- if (idx >= 0)
116
- merged[idx] = upd;
117
- else
118
- merged.push(upd);
119
- }
120
- setValues(merged);
121
- }
122
- }, [values, fields, mapGroups]);
123
- const generateColClass = (col) => String(col).split(" ").map((c) => (c.includes(":") ? `${c.replace(":", ":col-span-")}` : `col-span-${c}`)).join(" ");
124
- const inputMap = {
125
- default: _components_1.InputComponent,
126
- check: _components_1.InputCheckboxComponent,
127
- currency: _components_1.InputCurrencyComponent,
128
- date: _components_1.InputDateComponent,
129
- datetime: _components_1.InputDatetimeComponent,
130
- time: _components_1.InputTimeComponent,
131
- number: _components_1.InputNumberComponent,
132
- radio: _components_1.InputRadioComponent,
133
- select: _components_1.SelectComponent,
134
- "enter-password": _components_1.InputPasswordComponent,
135
- otp: _components_1.InputOtpComponent,
136
- image: _components_1.InputImageComponent,
137
- map: _components_1.InputMapComponent,
138
- cluster: () => null,
139
- custom: () => null,
140
- };
141
- const renderInput = (form, key, prefix) => {
142
- const inputType = form.type || "default";
143
- const name = prefix ? `${prefix}.${form.construction?.name}` : form.construction?.name || "input_name";
144
- if (form?.onHide?.(values))
145
- return null;
146
- const ws = watchState[name];
147
- if (ws?.hidden)
148
- return null;
149
- if (inputType === "cluster") {
150
- const { name: mapName, fields: innerForms, label, tip, wrap, className, min = 0 } = form.construction;
151
- const groupKey = prefix ? `${prefix}.${mapName}` : mapName;
152
- const group = mapGroups[groupKey] || Array.from({ length: Math.max(min, 1) }, (_, i) => i);
153
- const addGroup = () => setMapGroups((prev) => ({ ...prev, [groupKey]: [...group, group.length > 0 ? Math.max(...group) + 1 : 0] }));
154
- const removeGroup = (gIndex) => {
155
- setMapGroups((prev) => ({ ...prev, [groupKey]: group.filter((g) => g !== gIndex) }));
156
- unregisterPrefix(`${groupKey}[${gIndex}]`);
157
- };
158
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("flex flex-col gap-4", generateColClass(form.col || "12")), children: [group.map((gIndex) => ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("form-supervision-cluster-item", wrap && "form-supervision-cluster-item-wrapped", className), children: [label && (0, jsx_runtime_1.jsxs)("p", { className: "input-label", children: [label, " ", gIndex + 1] }), tip && (0, jsx_runtime_1.jsx)("small", { className: "input-tip", children: tip }), (label || tip) && (0, jsx_runtime_1.jsx)("div", { className: "mb-2" }), (0, jsx_runtime_1.jsx)("div", { className: "form-supervision-cluster-grid", children: innerForms.map((inner, i) => renderInput(inner, i, `${mapName}[${gIndex}]`)) }), group.length > min && ((0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { icon: free_solid_svg_icons_1.faTimes, paint: "danger", variant: "outline", size: "xs", className: (0, _utils_1.cn)("form-supervision-cluster-remove-btn", wrap && "form-supervision-cluster-remove-btn-wrapped"), onClick: () => removeGroup(gIndex) }))] }, gIndex))), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { icon: free_solid_svg_icons_1.faPlus, label: `Tambah ${label || mapName}`, variant: "outline", size: "sm", onClick: addGroup }) })] }, key));
159
- }
160
- if (inputType === "custom") {
161
- const customRender = form.construction;
162
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)(form.className, generateColClass(form.col || "12")), children: customRender?.({ formControl, values, setValues, errors, setErrors, setRegister, prefixName: prefix }) }, key));
163
- }
164
- const Component = inputMap[inputType] || _components_1.InputComponent;
165
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)(form.className, generateColClass(form.col || "12")), children: (0, jsx_runtime_1.jsx)(Component, { ...form.construction, ...formControl(name), disabled: ws?.disabled, readOnly: ws?.readonly }) }, key));
166
- };
167
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [title && (0, jsx_runtime_1.jsx)("h4", { className: (0, _utils_1.cn)("form-supervision-title", (0, _utils_1.pcn)(className, "title")), children: title }), (0, jsx_runtime_1.jsxs)("form", { className: (0, _utils_1.cn)("form-supervision-base", (0, _utils_1.pcn)(className, "base")), onSubmit: submit, children: [fresh && fields.map((f, i) => renderInput(f, i)), (0, jsx_runtime_1.jsx)("div", { className: "col-span-12", children: footerControl?.({ loading }) || ((0, jsx_runtime_1.jsx)("div", { className: "form-supervision-footer", children: (0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { type: "submit", label: "Simpan", icon: free_solid_svg_icons_1.faSave, loading: loading, className: (0, _utils_1.pcn)(className, "submit") }) })) })] }), (0, jsx_runtime_1.jsx)(_components_1.ModalConfirmComponent, { show: confirm.show, onClose: () => confirm.onClose(), icon: free_solid_svg_icons_1.faQuestionCircle, title: "Yakin", submitControl: { onSubmit: () => confirm?.onConfirm(), paint: "primary" }, children: (0, jsx_runtime_1.jsx)("p", { className: "form-supervision-confirm-text", children: "Yakin semua data sudah benar?" }) }), (0, jsx_runtime_1.jsx)(_components_1.ToastComponent, { show: modal == "failed", onClose: () => setModal(false), title: "Gagal", className: "form-supervision-toast-error header::text-danger", children: (0, jsx_runtime_1.jsx)("p", { className: "form-supervision-toast-text", children: "Data gagal disimpan, cek data dan koneksi internet lalu coba kembali!" }) }), (0, jsx_runtime_1.jsx)(_components_1.ToastComponent, { show: modal == "success", onClose: () => setModal(false), title: "Berhasil", className: "form-supervision-toast-success header::text-success", children: (0, jsx_runtime_1.jsx)("p", { className: "form-supervision-toast-text", children: "Data berhasil disimpan!" }) })] }));
168
- }
@@ -1,78 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { conversion, FetchControlType, ShortcutHandler, UseResourceProps } from "@utils";
3
- import { FloatingPageProps, FormType, ButtonProps, ModalConfirmProps, TableProps, ControlBarOptionType } from "@components";
4
- export interface TableSupervisionColumnProps {
5
- selector: string;
6
- label?: string;
7
- width?: string;
8
- sortable?: boolean;
9
- searchable?: boolean;
10
- filterable?: boolean | {
11
- type: "text" | "number" | "currency" | "date";
12
- } | {
13
- type: "select";
14
- options: {
15
- label: string;
16
- value: any;
17
- }[];
18
- };
19
- accessCode?: string;
20
- item?: (data: any) => string | ReactNode;
21
- tip?: string | ((data: any) => string);
22
- exportable?: boolean | "default" | "optional" | "hidden";
23
- importable?: boolean;
24
- }
25
- export interface TableSupervisionFormProps {
26
- fields: string[] | (FormType & {
27
- visibility?: "*" | "create" | "update";
28
- })[];
29
- defaultValue?: (item: Record<string, any> | null) => Promise<Record<string, any>> | Record<string, any>;
30
- payload?: (values: any) => Promise<Record<string, any>> | object;
31
- modalControl?: Omit<FloatingPageProps, "show" | "onClose" | "children">;
32
- contentType?: "application/json" | "multipart/form-data";
33
- }
34
- export type TableSupervisionDetailProps = boolean | (string | {
35
- label: string;
36
- item: string | ((data: Record<string, any>) => ReactNode);
37
- conversion?: keyof typeof conversion;
38
- } | ((data: Record<string, any>) => ReactNode))[] | ((data: Record<string, any>) => void) | {
39
- modal?: Omit<FloatingPageProps, "show" | "onClose" | "children">;
40
- content?: boolean | (string | {
41
- label: string;
42
- item: string | ((data: Record<string, any>) => ReactNode);
43
- conversion?: keyof typeof conversion;
44
- } | ((data: Record<string, any>) => ReactNode))[] | ((data: Record<string, any>) => ReactNode);
45
- action?: (data: Record<string, any>) => void;
46
- };
47
- export type TableSupervisionProps = {
48
- fetchControl: UseResourceProps;
49
- title?: string;
50
- id?: string;
51
- accessCode?: number;
52
- urlParam?: boolean | {
53
- compressed?: boolean;
54
- };
55
- columnControl?: string[] | TableSupervisionColumnProps[];
56
- formControl?: TableSupervisionFormProps;
57
- detailControl?: TableSupervisionDetailProps;
58
- actionControl?: boolean | ('EDIT' | 'DELETE' | {
59
- label: string;
60
- modal?: Omit<ModalConfirmProps, "show" | "onClose">;
61
- button?: ButtonProps;
62
- shortcut?: {
63
- key: string;
64
- description: string;
65
- };
66
- } | ((row: Record<string, any>, setModal: (type: "EDIT" | "DELETE") => void, setDataSelected?: () => void, setShortcut?: (key: string, handler: ShortcutHandler, description?: string) => void) => ReactNode))[];
67
- block?: boolean;
68
- noIndex?: boolean;
69
- actionBulkingControl?: TableProps["actionBulking"];
70
- controlBar?: (ControlBarOptionType | "CREATE" | "IMPORT" | "EXPORT" | "PRINT")[];
71
- responsiveControl?: {
72
- mobile?: TableProps["responsiveControl"] extends {
73
- mobile?: infer M;
74
- } ? M | boolean : boolean;
75
- };
76
- importControl?: FetchControlType;
77
- };
78
- export declare function TableSupervisionComponent({ title, id, fetchControl, columnControl, formControl, detailControl, actionControl, actionBulkingControl, block, controlBar, noIndex, responsiveControl, urlParam, importControl, }: TableSupervisionProps): import("react").JSX.Element;