@skalfa/skalfa-component 1.0.0
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/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/accordion/Accordion.component.d.ts +13 -0
- package/dist/accordion/Accordion.component.js +25 -0
- package/dist/breadcrumb/Breadcrumb.component.d.ts +14 -0
- package/dist/breadcrumb/Breadcrumb.component.js +21 -0
- package/dist/button/Button.component.d.ts +21 -0
- package/dist/button/Button.component.js +19 -0
- package/dist/card/AlertCard.component.d.ts +11 -0
- package/dist/card/AlertCard.component.js +9 -0
- package/dist/card/Card.component.d.ts +5 -0
- package/dist/card/Card.component.js +9 -0
- package/dist/card/DashboardCard.component.d.ts +9 -0
- package/dist/card/DashboardCard.component.js +13 -0
- package/dist/card/GalleryCard.component.d.ts +7 -0
- package/dist/card/GalleryCard.component.js +13 -0
- package/dist/card/ProductCard.component.d.ts +9 -0
- package/dist/card/ProductCard.component.js +13 -0
- package/dist/card/ProfileCard.component.d.ts +10 -0
- package/dist/card/ProfileCard.component.js +13 -0
- package/dist/carousel/Carousel.component.d.ts +13 -0
- package/dist/carousel/Carousel.component.js +37 -0
- package/dist/chip/Chip.component.d.ts +6 -0
- package/dist/chip/Chip.component.js +12 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +85 -0
- package/dist/input/Checkbox.component.d.ts +13 -0
- package/dist/input/Checkbox.component.js +23 -0
- package/dist/input/Input.component.d.ts +23 -0
- package/dist/input/Input.component.js +134 -0
- package/dist/input/InputCheckbox.component.d.ts +27 -0
- package/dist/input/InputCheckbox.component.js +53 -0
- package/dist/input/InputCurrency.component.d.ts +21 -0
- package/dist/input/InputCurrency.component.js +30 -0
- package/dist/input/InputDate.component.d.ts +24 -0
- package/dist/input/InputDate.component.js +107 -0
- package/dist/input/InputDatetime.component.d.ts +17 -0
- package/dist/input/InputDatetime.component.js +75 -0
- package/dist/input/InputDocument.component.d.ts +22 -0
- package/dist/input/InputDocument.component.js +88 -0
- package/dist/input/InputImage.component.d.ts +23 -0
- package/dist/input/InputImage.component.js +260 -0
- package/dist/input/InputMap.component.d.ts +25 -0
- package/dist/input/InputMap.component.js +103 -0
- package/dist/input/InputNumber.component.d.ts +19 -0
- package/dist/input/InputNumber.component.js +40 -0
- package/dist/input/InputOtp.component.d.ts +14 -0
- package/dist/input/InputOtp.component.js +65 -0
- package/dist/input/InputPassword.component.d.ts +17 -0
- package/dist/input/InputPassword.component.js +59 -0
- package/dist/input/InputRadio.component.d.ts +27 -0
- package/dist/input/InputRadio.component.js +56 -0
- package/dist/input/InputTime.component.d.ts +23 -0
- package/dist/input/InputTime.component.js +73 -0
- package/dist/input/InputValues.component.d.ts +9 -0
- package/dist/input/InputValues.component.js +19 -0
- package/dist/input/Radio.component.d.ts +12 -0
- package/dist/input/Radio.component.js +22 -0
- package/dist/input/Select.component.d.ts +47 -0
- package/dist/input/Select.component.js +275 -0
- package/dist/modal/BottomSheet.component.d.ts +12 -0
- package/dist/modal/BottomSheet.component.js +161 -0
- package/dist/modal/FloatingPage.component.d.ts +12 -0
- package/dist/modal/FloatingPage.component.js +27 -0
- package/dist/modal/Modal.component.d.ts +12 -0
- package/dist/modal/Modal.component.js +27 -0
- package/dist/modal/ModalConfirm.component.d.ts +26 -0
- package/dist/modal/ModalConfirm.component.js +68 -0
- package/dist/modal/Toast.component.d.ts +11 -0
- package/dist/modal/Toast.component.js +58 -0
- package/dist/nav/Bottombar.component.d.ts +12 -0
- package/dist/nav/Bottombar.component.js +32 -0
- package/dist/nav/Footer.component.d.ts +37 -0
- package/dist/nav/Footer.component.js +49 -0
- package/dist/nav/Headbar.component.d.ts +14 -0
- package/dist/nav/Headbar.component.js +32 -0
- package/dist/nav/Navbar.component.d.ts +22 -0
- package/dist/nav/Navbar.component.js +26 -0
- package/dist/nav/Sidebar.component.d.ts +33 -0
- package/dist/nav/Sidebar.component.js +87 -0
- package/dist/nav/Tabbar.component.d.ts +13 -0
- package/dist/nav/Tabbar.component.js +17 -0
- package/dist/nav/Wizard.component.d.ts +9 -0
- package/dist/nav/Wizard.component.js +24 -0
- package/dist/src/accordion/Accordion.component.d.ts +13 -0
- package/dist/src/accordion/Accordion.component.js +25 -0
- package/dist/src/breadcrumb/Breadcrumb.component.d.ts +14 -0
- package/dist/src/breadcrumb/Breadcrumb.component.js +21 -0
- package/dist/src/button/Button.component.d.ts +21 -0
- package/dist/src/button/Button.component.js +19 -0
- package/dist/src/card/AlertCard.component.d.ts +11 -0
- package/dist/src/card/AlertCard.component.js +9 -0
- package/dist/src/card/Card.component.d.ts +5 -0
- package/dist/src/card/Card.component.js +9 -0
- package/dist/src/card/DashboardCard.component.d.ts +9 -0
- package/dist/src/card/DashboardCard.component.js +13 -0
- package/dist/src/card/GalleryCard.component.d.ts +7 -0
- package/dist/src/card/GalleryCard.component.js +13 -0
- package/dist/src/card/ProductCard.component.d.ts +9 -0
- package/dist/src/card/ProductCard.component.js +13 -0
- package/dist/src/card/ProfileCard.component.d.ts +10 -0
- package/dist/src/card/ProfileCard.component.js +13 -0
- package/dist/src/carousel/Carousel.component.d.ts +13 -0
- package/dist/src/carousel/Carousel.component.js +37 -0
- package/dist/src/chip/Chip.component.d.ts +6 -0
- package/dist/src/chip/Chip.component.js +12 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.js +29 -0
- package/dist/src/input/Checkbox.component.d.ts +13 -0
- package/dist/src/input/Checkbox.component.js +23 -0
- package/dist/src/input/Input.component.d.ts +23 -0
- package/dist/src/input/Input.component.js +134 -0
- package/dist/src/input/InputCheckbox.component.d.ts +27 -0
- package/dist/src/input/InputCheckbox.component.js +53 -0
- package/dist/src/input/InputCurrency.component.d.ts +21 -0
- package/dist/src/input/InputCurrency.component.js +30 -0
- package/dist/src/input/InputDate.component.d.ts +24 -0
- package/dist/src/input/InputDate.component.js +107 -0
- package/dist/src/input/InputDatetime.component.d.ts +17 -0
- package/dist/src/input/InputDatetime.component.js +75 -0
- package/dist/src/input/InputDocument.component.d.ts +22 -0
- package/dist/src/input/InputDocument.component.js +88 -0
- package/dist/src/input/InputImage.component.d.ts +23 -0
- package/dist/src/input/InputImage.component.js +260 -0
- package/dist/src/input/InputMap.component.d.ts +25 -0
- package/dist/src/input/InputMap.component.js +101 -0
- package/dist/src/input/InputNumber.component.d.ts +19 -0
- package/dist/src/input/InputNumber.component.js +40 -0
- package/dist/src/input/InputOtp.component.d.ts +14 -0
- package/dist/src/input/InputOtp.component.js +65 -0
- package/dist/src/input/InputPassword.component.d.ts +17 -0
- package/dist/src/input/InputPassword.component.js +59 -0
- package/dist/src/input/InputRadio.component.d.ts +27 -0
- package/dist/src/input/InputRadio.component.js +56 -0
- package/dist/src/input/InputTime.component.d.ts +23 -0
- package/dist/src/input/InputTime.component.js +73 -0
- package/dist/src/input/InputValues.component.d.ts +9 -0
- package/dist/src/input/InputValues.component.js +19 -0
- package/dist/src/input/Radio.component.d.ts +12 -0
- package/dist/src/input/Radio.component.js +22 -0
- package/dist/src/input/Select.component.d.ts +47 -0
- package/dist/src/input/Select.component.js +275 -0
- package/dist/src/modal/BottomSheet.component.d.ts +12 -0
- package/dist/src/modal/BottomSheet.component.js +161 -0
- package/dist/src/modal/FloatingPage.component.d.ts +12 -0
- package/dist/src/modal/FloatingPage.component.js +27 -0
- package/dist/src/modal/Modal.component.d.ts +12 -0
- package/dist/src/modal/Modal.component.js +27 -0
- package/dist/src/modal/ModalConfirm.component.d.ts +26 -0
- package/dist/src/modal/ModalConfirm.component.js +68 -0
- package/dist/src/modal/Toast.component.d.ts +11 -0
- package/dist/src/modal/Toast.component.js +58 -0
- package/dist/src/nav/Bottombar.component.d.ts +12 -0
- package/dist/src/nav/Bottombar.component.js +32 -0
- package/dist/src/nav/Footer.component.d.ts +37 -0
- package/dist/src/nav/Footer.component.js +49 -0
- package/dist/src/nav/Headbar.component.d.ts +14 -0
- package/dist/src/nav/Headbar.component.js +32 -0
- package/dist/src/nav/Navbar.component.d.ts +22 -0
- package/dist/src/nav/Navbar.component.js +26 -0
- package/dist/src/nav/Sidebar.component.d.ts +33 -0
- package/dist/src/nav/Sidebar.component.js +87 -0
- package/dist/src/nav/Tabbar.component.d.ts +13 -0
- package/dist/src/nav/Tabbar.component.js +17 -0
- package/dist/src/nav/Wizard.component.d.ts +9 -0
- package/dist/src/nav/Wizard.component.js +24 -0
- package/dist/src/supervision/FormSupervision.component.d.ts +93 -0
- package/dist/src/supervision/FormSupervision.component.js +168 -0
- package/dist/src/supervision/TableSupervision.component.d.ts +78 -0
- package/dist/src/supervision/TableSupervision.component.js +273 -0
- package/dist/src/table/ControlBar.component.d.ts +34 -0
- package/dist/src/table/ControlBar.component.js +205 -0
- package/dist/src/table/FilterComponent.d.ts +45 -0
- package/dist/src/table/FilterComponent.js +132 -0
- package/dist/src/table/Pagination.component.d.ts +8 -0
- package/dist/src/table/Pagination.component.js +32 -0
- package/dist/src/table/Table.component.d.ts +61 -0
- package/dist/src/table/Table.component.js +101 -0
- package/dist/src/typography/TypographyArticle.component.d.ts +8 -0
- package/dist/src/typography/TypographyArticle.component.js +7 -0
- package/dist/src/typography/TypographyColumn.component.d.ts +6 -0
- package/dist/src/typography/TypographyColumn.component.js +7 -0
- package/dist/src/typography/TypographyContent.component.d.ts +6 -0
- package/dist/src/typography/TypographyContent.component.js +7 -0
- package/dist/src/typography/TypographyTips.component.d.ts +6 -0
- package/dist/src/typography/TypographyTips.component.js +7 -0
- package/dist/src/wrap/Draggable.component.d.ts +34 -0
- package/dist/src/wrap/Draggable.component.js +214 -0
- package/dist/src/wrap/Image.component.d.ts +2 -0
- package/dist/src/wrap/Image.component.js +13 -0
- package/dist/src/wrap/OutsideClick.component.d.ts +6 -0
- package/dist/src/wrap/OutsideClick.component.js +34 -0
- package/dist/src/wrap/ScrollContainer.component.d.ts +10 -0
- package/dist/src/wrap/ScrollContainer.component.js +54 -0
- package/dist/src/wrap/ShortcutProvider.d.ts +1 -0
- package/dist/src/wrap/ShortcutProvider.js +42 -0
- package/dist/src/wrap/Swipe.component.d.ts +14 -0
- package/dist/src/wrap/Swipe.component.js +61 -0
- package/dist/supervision/FormSupervision.component.d.ts +93 -0
- package/dist/supervision/FormSupervision.component.js +168 -0
- package/dist/supervision/TableSupervision.component.d.ts +78 -0
- package/dist/supervision/TableSupervision.component.js +273 -0
- package/dist/table/ControlBar.component.d.ts +34 -0
- package/dist/table/ControlBar.component.js +205 -0
- package/dist/table/FilterComponent.d.ts +45 -0
- package/dist/table/FilterComponent.js +132 -0
- package/dist/table/Pagination.component.d.ts +8 -0
- package/dist/table/Pagination.component.js +32 -0
- package/dist/table/Table.component.d.ts +61 -0
- package/dist/table/Table.component.js +101 -0
- package/dist/typography/TypographyArticle.component.d.ts +8 -0
- package/dist/typography/TypographyArticle.component.js +7 -0
- package/dist/typography/TypographyColumn.component.d.ts +6 -0
- package/dist/typography/TypographyColumn.component.js +7 -0
- package/dist/typography/TypographyContent.component.d.ts +6 -0
- package/dist/typography/TypographyContent.component.js +7 -0
- package/dist/typography/TypographyTips.component.d.ts +6 -0
- package/dist/typography/TypographyTips.component.js +7 -0
- package/dist/wrap/Draggable.component.d.ts +1 -0
- package/dist/wrap/Draggable.component.js +214 -0
- package/dist/wrap/Image.component.d.ts +2 -0
- package/dist/wrap/Image.component.js +13 -0
- package/dist/wrap/OutsideClick.component.d.ts +6 -0
- package/dist/wrap/OutsideClick.component.js +34 -0
- package/dist/wrap/ScrollContainer.component.d.ts +10 -0
- package/dist/wrap/ScrollContainer.component.js +54 -0
- package/dist/wrap/ShortcutProvider.d.ts +1 -0
- package/dist/wrap/ShortcutProvider.js +42 -0
- package/dist/wrap/Swipe.component.d.ts +14 -0
- package/dist/wrap/Swipe.component.js +61 -0
- package/package.json +44 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface AlertCardProps {
|
|
3
|
+
title?: string | ReactNode;
|
|
4
|
+
leftContent?: string | ReactNode;
|
|
5
|
+
badge?: string | ReactNode;
|
|
6
|
+
content?: string | ReactNode;
|
|
7
|
+
footer?: string | ReactNode;
|
|
8
|
+
/** Use custom class with: "badge::", "title::". */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function AlertCardComponent({ title, leftContent, badge, content, footer, className, }: AlertCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AlertCardComponent = AlertCardComponent;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const _utils_1 = require("@utils");
|
|
7
|
+
function AlertCardComponent({ title, leftContent, badge, content, footer, className = "", }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("section", { className: (0, _utils_1.cn)("alert-card", (0, _utils_1.pcn)(className, "base")), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start sm:gap-8", children: [leftContent, (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { className: (0, _utils_1.cn)("alert-card-badge", (0, _utils_1.pcn)(className, "badge")), children: badge }), (0, jsx_runtime_1.jsx)("h3", { className: (0, _utils_1.cn)("alert-card-title", (0, _utils_1.pcn)(className, "title")), children: title }), content, footer && (0, jsx_runtime_1.jsx)("div", { className: "pt-4", children: footer })] })] }) }) }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CardComponent = CardComponent;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const _utils_1 = require("@utils");
|
|
7
|
+
function CardComponent({ children, className, }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("card", className), children: children }) }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface DashboardCardProps {
|
|
3
|
+
content?: string | ReactNode;
|
|
4
|
+
title?: string | ReactNode;
|
|
5
|
+
rightContent?: string | ReactNode;
|
|
6
|
+
path?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function DashboardCardComponent({ content, title, rightContent, path, className, }: DashboardCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
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.DashboardCardComponent = DashboardCardComponent;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const link_1 = __importDefault(require("next/link"));
|
|
10
|
+
const _utils_1 = require("@utils");
|
|
11
|
+
function DashboardCardComponent({ content, title, rightContent, path, className, }) {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(link_1.default, { href: path || "", children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("dashboard-card", className), children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex gap-4 items-center", children: content }), title] }), (0, jsx_runtime_1.jsx)("div", { children: rightContent })] }) }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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.GalleryCardComponent = GalleryCardComponent;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const image_1 = __importDefault(require("next/image"));
|
|
10
|
+
const _utils_1 = require("@utils");
|
|
11
|
+
function GalleryCardComponent({ src, alt = "", className = "", }) {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.pcn)(className, "base"), children: [(0, jsx_runtime_1.jsx)(image_1.default, { src: src, alt: src, width: 400, height: 300, className: (0, _utils_1.cn)("gallery-card-image", (0, _utils_1.pcn)(className, "image")) }), (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("gallery-card-label", (0, _utils_1.pcn)(className, "label")), children: alt })] }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ProductCardProps {
|
|
2
|
+
name: string;
|
|
3
|
+
price?: string;
|
|
4
|
+
image?: string;
|
|
5
|
+
description?: string | React.ReactNode;
|
|
6
|
+
/** Use custom class with: "image::", "content::". */
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function ProductCardComponent({ image, name, price, description, className, }: ProductCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
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.ProductCardComponent = ProductCardComponent;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const image_1 = __importDefault(require("next/image"));
|
|
10
|
+
const _utils_1 = require("@utils");
|
|
11
|
+
function ProductCardComponent({ image = "", name, price, description, className = "", }) {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("product-card", (0, _utils_1.pcn)(className, "base")), children: [(0, jsx_runtime_1.jsx)(image_1.default, { src: image, alt: image, width: 400, height: 300, className: (0, _utils_1.cn)("product-card-image", (0, _utils_1.pcn)(className, "image")) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("p-2", (0, _utils_1.pcn)(className, "content")), children: [(0, jsx_runtime_1.jsxs)("dl", { children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("dt", { className: "sr-only", children: "Name" }), (0, jsx_runtime_1.jsx)("dd", { className: "text-sm", children: name })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("dt", { className: "sr-only", children: "Price" }), (0, jsx_runtime_1.jsx)("dd", { className: "font-semibold", children: price })] })] }), description && (0, jsx_runtime_1.jsx)("div", { children: description })] })] }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ProfileCardProps {
|
|
2
|
+
name: string;
|
|
3
|
+
short?: string;
|
|
4
|
+
image?: string;
|
|
5
|
+
description?: string | React.ReactNode;
|
|
6
|
+
footer?: string | React.ReactNode;
|
|
7
|
+
/** Use custom class with: "image::", "content::". */
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function ProfileCardComponent({ image, name, short, description, footer, className, }: ProfileCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
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.ProfileCardComponent = ProfileCardComponent;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const image_1 = __importDefault(require("next/image"));
|
|
10
|
+
const _utils_1 = require("@utils");
|
|
11
|
+
function ProfileCardComponent({ image = "", name, short, description, footer, className = "", }) {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("profile-card", (0, _utils_1.pcn)(className, "base")), children: [(0, jsx_runtime_1.jsx)("span", { className: "absolute inset-x-0 bottom-0 h-1 bg-primary" }), (0, jsx_runtime_1.jsxs)("div", { className: "sm:flex sm:gap-4 sm:items-center", children: [image && ((0, jsx_runtime_1.jsx)("div", { className: "hidden sm:block sm:shrink-0", children: (0, jsx_runtime_1.jsx)(image_1.default, { src: image, alt: image, width: 400, height: 400, className: (0, _utils_1.cn)("profile-card-image", (0, _utils_1.pcn)(className, "image")) }) })), (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.pcn)(className, "content"), children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-bold sm:text-xl", children: name }), (0, jsx_runtime_1.jsx)("p", { className: "mt-1 text-xs font-medium text-light-foreground", children: short })] })] }), description, footer && (0, jsx_runtime_1.jsx)("dl", { className: "mt-4", children: footer })] }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface CarouselItem {
|
|
2
|
+
background: string;
|
|
3
|
+
content?: string;
|
|
4
|
+
}
|
|
5
|
+
interface CarouselProps {
|
|
6
|
+
items: CarouselItem[];
|
|
7
|
+
noButton?: boolean;
|
|
8
|
+
noNavigation?: boolean;
|
|
9
|
+
/** Use custom class with: "item::", "prev-button::", "next-button::", "navigation::". */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function CarouselComponent({ items, className, noButton, noNavigation, }: CarouselProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CarouselComponent = CarouselComponent;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
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
|
+
const _utils_1 = require("@utils");
|
|
10
|
+
function CarouselComponent({ items, className = "", noButton, noNavigation, }) {
|
|
11
|
+
const [currentIndex, setCurrentIndex] = (0, react_1.useState)(0);
|
|
12
|
+
const touchStartX = (0, react_1.useRef)(null);
|
|
13
|
+
const touchEndX = (0, react_1.useRef)(null);
|
|
14
|
+
const intervalRef = (0, react_1.useRef)(null);
|
|
15
|
+
const handlePrev = () => setCurrentIndex((prevIndex) => (prevIndex - 1 + items.length) % items.length);
|
|
16
|
+
const handleNext = () => setCurrentIndex((prevIndex) => (prevIndex + 1) % items.length);
|
|
17
|
+
const handleTouchStart = (e) => {
|
|
18
|
+
touchStartX.current = e.touches[0].clientX;
|
|
19
|
+
};
|
|
20
|
+
const handleTouchEnd = (e) => {
|
|
21
|
+
touchEndX.current = e.changedTouches[0].clientX;
|
|
22
|
+
if (touchStartX.current !== null && touchEndX.current !== null) {
|
|
23
|
+
if (touchStartX.current - touchEndX.current > 50)
|
|
24
|
+
handleNext();
|
|
25
|
+
if (touchEndX.current - touchStartX.current > 50)
|
|
26
|
+
handlePrev();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
intervalRef.current = setInterval(handleNext, 10000);
|
|
31
|
+
return () => {
|
|
32
|
+
if (intervalRef.current)
|
|
33
|
+
clearInterval(intervalRef.current);
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("carousel", (0, _utils_1.pcn)(className, "base")), children: [(0, jsx_runtime_1.jsx)("div", { className: "carousel-inner", style: { transform: `translateX(-${currentIndex * 100}%)` }, onTouchStart: handleTouchStart, onTouchEnd: handleTouchEnd, children: items.map((item, index) => ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("carousel-item", (0, _utils_1.pcn)(className, "item")), style: { backgroundImage: `url(${item.background})` }, children: item.content }, index))) }), !noNavigation && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("carousel-navigation", (0, _utils_1.pcn)(className, "navigation")), children: items.map((_, index) => ((0, jsx_runtime_1.jsx)("button", { className: `carousel-indicator ${currentIndex === index ? "carousel-indicator-active" : ""}`, onClick: () => setCurrentIndex(index) }, index))) })), !noButton && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("button", { className: (0, _utils_1.cn)("carousel-btn carousel-prev-btn", (0, _utils_1.pcn)(className, "prev-button")), onClick: handlePrev, children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faChevronLeft }) }), (0, jsx_runtime_1.jsx)("button", { className: (0, _utils_1.cn)("carousel-btn carousel-next-btn", (0, _utils_1.pcn)(className, "next-button")), onClick: handleNext, children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faChevronRight }) })] }))] }));
|
|
37
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChipComponent = ChipComponent;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
6
|
+
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
7
|
+
const _utils_1 = require("@utils");
|
|
8
|
+
function ChipComponent({ items, onClick, onDelete, className, }) {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("chip-group", className), children: items?.map((item, key) => {
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "chip", onClick: () => onClick?.(item, key), children: [(0, jsx_runtime_1.jsx)("span", { children: item }), onDelete && ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faTimes, className: "chip-delete", onClick: () => onDelete?.(item, key) }))] }, key));
|
|
11
|
+
}) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./accordion";
|
|
2
|
+
export * from "./breadcrumb";
|
|
3
|
+
export * from "./button";
|
|
4
|
+
export * from "./card";
|
|
5
|
+
export * from "./carousel";
|
|
6
|
+
export * from "./chip";
|
|
7
|
+
export * from "./input";
|
|
8
|
+
export * from "./modal";
|
|
9
|
+
export * from "./nav";
|
|
10
|
+
export * from "./supervision";
|
|
11
|
+
export * from "./table";
|
|
12
|
+
export * from "./typography";
|
|
13
|
+
export * from "./wrap";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./accordion"), exports);
|
|
18
|
+
__exportStar(require("./breadcrumb"), exports);
|
|
19
|
+
__exportStar(require("./button"), exports);
|
|
20
|
+
__exportStar(require("./card"), exports);
|
|
21
|
+
__exportStar(require("./carousel"), exports);
|
|
22
|
+
__exportStar(require("./chip"), exports);
|
|
23
|
+
__exportStar(require("./input"), exports);
|
|
24
|
+
__exportStar(require("./modal"), exports);
|
|
25
|
+
__exportStar(require("./nav"), exports);
|
|
26
|
+
__exportStar(require("./supervision"), exports);
|
|
27
|
+
__exportStar(require("./table"), exports);
|
|
28
|
+
__exportStar(require("./typography"), exports);
|
|
29
|
+
__exportStar(require("./wrap"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export type CheckboxProps = {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string | ReactNode;
|
|
5
|
+
value?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
invalid?: string;
|
|
9
|
+
onChange?: () => void;
|
|
10
|
+
/** Use custom class with: "label::", "checked::", "error::". */
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function CheckboxComponent({ name, label, value, disabled, checked, invalid, onChange, className, }: CheckboxProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CheckboxComponent = CheckboxComponent;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
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
|
+
const _utils_1 = require("@utils");
|
|
10
|
+
function CheckboxComponent({ name, label, value, disabled = false, checked = false, invalid, onChange, className = "", }) {
|
|
11
|
+
// =========================>
|
|
12
|
+
// ## Initial
|
|
13
|
+
// =========================>
|
|
14
|
+
const randomId = (0, _utils_1.useInputRandomId)();
|
|
15
|
+
const [invalidMessage, setInvalidMessage] = (0, react_1.useState)("");
|
|
16
|
+
// =========================>
|
|
17
|
+
// ## Invalid handler
|
|
18
|
+
// =========================>
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
setInvalidMessage(invalid || "");
|
|
21
|
+
}, [invalid]);
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "checkbox-container", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", className: "hidden", id: randomId, name: name, onChange: onChange, defaultChecked: checked, value: value, disabled: disabled }), (0, jsx_runtime_1.jsxs)("label", { htmlFor: randomId, className: (0, _utils_1.cn)("checkbox-wrapper", disabled && "checkbox-wrapper-disabled"), children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("checkbox-input", checked && "checkbox-input-checked", checked && (0, _utils_1.pcn)(className, "checked"), (0, _utils_1.pcn)(className, "base")), children: checked && (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faCheck, className: "text-sm" }) }) }), (0, jsx_runtime_1.jsx)("span", { className: (0, _utils_1.cn)("checkbox-label", checked && "checkbox-label-checked", (0, _utils_1.pcn)(className, "label"), checked && (0, _utils_1.pcn)(className, "label", "checked"), disabled && (0, _utils_1.pcn)(className, "label", "disabled")), children: label })] }), invalidMessage && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-error-message", (0, _utils_1.pcn)(className, "error")), children: invalidMessage }))] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
import { ValidationRules } from "@utils";
|
|
3
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
4
|
+
label?: string;
|
|
5
|
+
tip?: string | ReactNode;
|
|
6
|
+
leftIcon?: any;
|
|
7
|
+
rightIcon?: any;
|
|
8
|
+
value?: any;
|
|
9
|
+
invalid?: string;
|
|
10
|
+
suggestions?: string[];
|
|
11
|
+
validations?: ValidationRules;
|
|
12
|
+
onlyAlphabet?: boolean;
|
|
13
|
+
uppercase?: boolean;
|
|
14
|
+
lowercase?: boolean;
|
|
15
|
+
multiple?: boolean;
|
|
16
|
+
onChange?: (value: any) => any;
|
|
17
|
+
register?: (name: string, validations?: ValidationRules) => void;
|
|
18
|
+
unregister?: (name: string) => void;
|
|
19
|
+
ref?: Ref<HTMLInputElement>;
|
|
20
|
+
/** Use custom class with: "label::", "tip::", "error::", "icon::", "suggest::", "suggest-item::". */
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function InputComponent({ label, tip, leftIcon, rightIcon, className, value, invalid, suggestions, validations, onlyAlphabet, uppercase, lowercase, multiple, register, unregister, onChange, ref, ...props }: InputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.InputComponent = InputComponent;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
8
|
+
const _utils_1 = require("@utils");
|
|
9
|
+
const InputValues_component_1 = require("./InputValues.component");
|
|
10
|
+
function InputComponent({ label, tip, leftIcon, rightIcon, className = "", value, invalid, suggestions, validations, onlyAlphabet, uppercase, lowercase, multiple, register, unregister, onChange, ref, ...props }) {
|
|
11
|
+
const [activeSuggestion, setActiveSuggestion] = (0, react_1.useState)(0);
|
|
12
|
+
const [showSuggestions, setShowSuggestions] = (0, react_1.useState)(false);
|
|
13
|
+
const [dataSuggestions, setDataSuggestions] = (0, react_1.useState)([]);
|
|
14
|
+
const [filteredSuggestions, setFilteredSuggestions] = (0, react_1.useState)([]);
|
|
15
|
+
// =========================>
|
|
16
|
+
// ## Initial
|
|
17
|
+
// =========================>
|
|
18
|
+
const inputHandler = (0, _utils_1.useInputHandler)(props.name, value, validations, register, unregister, props.type == "file");
|
|
19
|
+
const randomId = (0, _utils_1.useInputRandomId)();
|
|
20
|
+
// =========================>
|
|
21
|
+
// ## Invalid handler
|
|
22
|
+
// =========================>
|
|
23
|
+
const [invalidMessage] = (0, _utils_1.useValidation)(inputHandler.value, validations, invalid, inputHandler.idle);
|
|
24
|
+
// =========================>
|
|
25
|
+
// ## Change value handler
|
|
26
|
+
// =========================>
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
if (inputHandler.value && typeof inputHandler.value === "string") {
|
|
29
|
+
let newVal = onlyAlphabet ? inputHandler.value.replace(/[^A-Za-z ]+/g, "") : inputHandler.value;
|
|
30
|
+
if (uppercase)
|
|
31
|
+
newVal = newVal.toUpperCase();
|
|
32
|
+
if (lowercase)
|
|
33
|
+
newVal = newVal.toLowerCase();
|
|
34
|
+
if (validations && _utils_1.validation.hasRules(validations, "max"))
|
|
35
|
+
newVal = newVal.slice(0, parseInt(_utils_1.validation.getRules(validations, "max") || "0"));
|
|
36
|
+
inputHandler.setValue(newVal);
|
|
37
|
+
}
|
|
38
|
+
}, [inputHandler.value, onlyAlphabet, uppercase, lowercase, validations]);
|
|
39
|
+
// =========================>
|
|
40
|
+
// ## suggestions handler
|
|
41
|
+
// =========================>
|
|
42
|
+
(0, react_1.useEffect)(() => {
|
|
43
|
+
setDataSuggestions(suggestions);
|
|
44
|
+
}, [suggestions]);
|
|
45
|
+
const filterSuggestion = (e) => {
|
|
46
|
+
if (dataSuggestions?.length) {
|
|
47
|
+
let filteredSuggestion = [];
|
|
48
|
+
if (e.target.value) {
|
|
49
|
+
filteredSuggestion = dataSuggestions
|
|
50
|
+
.filter((suggestion) => suggestion.toLowerCase().indexOf(e.target.value.toLowerCase()) > -1)
|
|
51
|
+
.slice(0, 10);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
filteredSuggestion = dataSuggestions.slice(0, 10);
|
|
55
|
+
}
|
|
56
|
+
setActiveSuggestion(-1);
|
|
57
|
+
setFilteredSuggestions(filteredSuggestion);
|
|
58
|
+
setShowSuggestions(true);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const onKeyDownSuggestion = (e) => {
|
|
62
|
+
if (dataSuggestions?.length) {
|
|
63
|
+
if (e.keyCode === 13) {
|
|
64
|
+
const resultValue = filteredSuggestions?.at(activeSuggestion);
|
|
65
|
+
setActiveSuggestion(-1);
|
|
66
|
+
setFilteredSuggestions([]);
|
|
67
|
+
setShowSuggestions(false);
|
|
68
|
+
inputHandler.setValue(resultValue ? resultValue : inputHandler.value);
|
|
69
|
+
if (onChange) {
|
|
70
|
+
onChange(resultValue ? resultValue : inputHandler.value);
|
|
71
|
+
}
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
}
|
|
74
|
+
else if (e.keyCode === 38) {
|
|
75
|
+
if (activeSuggestion === 0) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
setActiveSuggestion(activeSuggestion - 1);
|
|
79
|
+
}
|
|
80
|
+
else if (e.keyCode === 40) {
|
|
81
|
+
if (activeSuggestion + 1 >= (filteredSuggestions?.length || 0)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setActiveSuggestion(activeSuggestion + 1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex flex-col gap-y-0.5", children: [(0, jsx_runtime_1.jsxs)("label", { htmlFor: randomId, className: (0, _utils_1.cn)("input-label", props.disabled && "input-label-disabled", inputHandler.focus && "input-label-focus", !!invalidMessage && "input-label-error", (0, _utils_1.pcn)(className, "label"), props.disabled && (0, _utils_1.pcn)(className, "label", "disabled"), inputHandler.focus && (0, _utils_1.pcn)(className, "label", "focus"), !!invalidMessage && (0, _utils_1.pcn)(className, "label", "error")), children: [label, validations && _utils_1.validation.hasRules(validations, "required") && (0, jsx_runtime_1.jsx)("span", { className: "text-danger ml-1", children: "*" })] }), tip && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-tip", props.disabled && "input-tip-disabled", (0, _utils_1.pcn)(className, "tip"), props.disabled && (0, _utils_1.pcn)(className, "tip", "disabled")), children: tip })), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("input", { ...props, ref: ref, id: randomId, placeholder: !multiple || (multiple && !inputHandler.value?.length) ? props.placeholder : "", className: (0, _utils_1.cn)("input", props.type == "file" && "input-file", leftIcon && "input-with-left-icon", rightIcon && "input-with-right-icon", !!invalidMessage && "input-error", (0, _utils_1.pcn)(className, "base"), !!invalidMessage && (0, _utils_1.pcn)(className, "base", "error")), value: !multiple ? inputHandler.value : undefined, onChange: (e) => {
|
|
89
|
+
if (!multiple) {
|
|
90
|
+
inputHandler.setValue(e.target.value);
|
|
91
|
+
inputHandler.setIdle(false);
|
|
92
|
+
onChange?.(props.type == "file" ? e.target?.files && e.target?.files[0] : e.target.value);
|
|
93
|
+
dataSuggestions?.length && filterSuggestion(e);
|
|
94
|
+
}
|
|
95
|
+
}, onFocus: (e) => {
|
|
96
|
+
props.onFocus?.(e);
|
|
97
|
+
inputHandler.setFocus(true);
|
|
98
|
+
dataSuggestions?.length && filterSuggestion(e);
|
|
99
|
+
}, onBlur: (e) => {
|
|
100
|
+
props.onBlur?.(e);
|
|
101
|
+
setTimeout(() => inputHandler.setFocus(false), 100);
|
|
102
|
+
}, onKeyDown: (e) => {
|
|
103
|
+
dataSuggestions?.length && onKeyDownSuggestion(e);
|
|
104
|
+
if (multiple && e.key === "Enter" || e.key === ",") {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
const currentValue = e.currentTarget.value.trim();
|
|
107
|
+
if (!currentValue)
|
|
108
|
+
return;
|
|
109
|
+
const currentValues = Array.isArray(inputHandler.value) ? [...inputHandler.value] : [];
|
|
110
|
+
if (!currentValues.includes(currentValue)) {
|
|
111
|
+
const newValues = [...currentValues, currentValue];
|
|
112
|
+
onChange?.(newValues);
|
|
113
|
+
inputHandler.setValue(newValues);
|
|
114
|
+
e.currentTarget.value = "";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}, autoComplete: props.autoComplete || dataSuggestions?.length ? "off" : "" }), (multiple) && ((0, jsx_runtime_1.jsx)(InputValues_component_1.InputValues, { value: inputHandler.value || [], isFocus: inputHandler.focus, onFocus: () => setTimeout(() => inputHandler.setFocus(true), 110), onDelete: (_, index) => {
|
|
118
|
+
const values = Array().concat(inputHandler.value);
|
|
119
|
+
const newValues = values.filter((_, val) => val != index);
|
|
120
|
+
inputHandler.setValue(newValues);
|
|
121
|
+
onChange?.(newValues);
|
|
122
|
+
}, className: `${!inputHandler.focus && (leftIcon ? "ml-[2.5rem]" : "ml-[1rem]")}`, style: { maxWidth: `calc(100% - ${leftIcon ? "5.2rem" : "2rem"})` } })), leftIcon && ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { className: (0, _utils_1.cn)("input-icon", "input-icon-left", props.disabled && "input-icon-disabled", inputHandler.focus && "input-icon-focus", (0, _utils_1.pcn)(className, "icon"), props.disabled && (0, _utils_1.pcn)(className, "icon", "disabled"), inputHandler.focus && (0, _utils_1.pcn)(className, "icon", "focus")), icon: leftIcon })), rightIcon && ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { className: (0, _utils_1.cn)("input-icon", "input-icon-right", props.disabled && "input-icon-disabled", inputHandler.focus && "input-icon-focus", (0, _utils_1.pcn)(className, "icon"), props.disabled && (0, _utils_1.pcn)(className, "icon", "disabled"), inputHandler.focus && (0, _utils_1.pcn)(className, "icon", "focus")), icon: rightIcon }))] }), !!dataSuggestions?.length && showSuggestions && !!filteredSuggestions?.length && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("ul", { className: (0, _utils_1.cn)("input-suggest-container", inputHandler.focus && "input-suggest-container-active", (0, _utils_1.pcn)(className, "suggest")), children: filteredSuggestions.map((suggestion, key) => {
|
|
123
|
+
return ((0, jsx_runtime_1.jsx)("li", { className: (0, _utils_1.cn)("input-suggest", inputHandler.value == suggestion && "input-suggest-active", (0, _utils_1.pcn)(className, "suggest-item"), inputHandler.value == suggestion && (0, _utils_1.pcn)(className, "suggest-item", "active")), onMouseDown: () => {
|
|
124
|
+
setTimeout(() => inputHandler.setFocus(true), 110);
|
|
125
|
+
}, onMouseUp: () => {
|
|
126
|
+
setActiveSuggestion(key);
|
|
127
|
+
setFilteredSuggestions([]);
|
|
128
|
+
setShowSuggestions(false);
|
|
129
|
+
inputHandler.setValue(filteredSuggestions[key] || inputHandler.value);
|
|
130
|
+
onChange?.(filteredSuggestions[key] || inputHandler.value);
|
|
131
|
+
setTimeout(() => inputHandler.setFocus(false), 120);
|
|
132
|
+
}, children: suggestion }, suggestion));
|
|
133
|
+
}) }) })), invalidMessage && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-error-message", (0, _utils_1.pcn)(className, "error")), children: invalidMessage }))] }) }));
|
|
134
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { ApiType, ValidationRules } from "@utils";
|
|
3
|
+
export interface InputCheckboxOptionProps {
|
|
4
|
+
value: string | number;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export interface InputCheckboxProps {
|
|
8
|
+
name: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
tip?: string | ReactNode;
|
|
11
|
+
vertical?: boolean;
|
|
12
|
+
value?: string[] | number[];
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
invalid?: string;
|
|
15
|
+
options?: InputCheckboxOptionProps[];
|
|
16
|
+
serverOptionControl?: ApiType;
|
|
17
|
+
customOptions?: any;
|
|
18
|
+
validations?: ValidationRules;
|
|
19
|
+
onChange?: (value: string[] | number[]) => any;
|
|
20
|
+
register?: (name: string, validations?: ValidationRules) => void;
|
|
21
|
+
unregister?: (name: string) => void;
|
|
22
|
+
/** Use custom class with: "label::", "tip::", "error::", "icon::". */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Use custom class with: "label::", "checked::", "error::". */
|
|
25
|
+
classNameCheckbox?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function InputCheckboxComponent({ name, label, tip, vertical, className, classNameCheckbox, value, disabled, invalid, options, serverOptionControl, customOptions, validations, register, unregister, onChange, }: InputCheckboxProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.InputCheckboxComponent = InputCheckboxComponent;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const _utils_1 = require("@utils");
|
|
8
|
+
const _components_1 = require("@components");
|
|
9
|
+
;
|
|
10
|
+
;
|
|
11
|
+
function InputCheckboxComponent({ name, label, tip, vertical, className = "", classNameCheckbox = "", value, disabled, invalid, options, serverOptionControl, customOptions, validations, register, unregister, onChange, }) {
|
|
12
|
+
const [dataOptions, setDataOptions] = (0, react_1.useState)([]);
|
|
13
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
14
|
+
// =========================>
|
|
15
|
+
// ## initial
|
|
16
|
+
// =========================>
|
|
17
|
+
const inputHandler = (0, _utils_1.useInputHandler)(name, value, validations, register, unregister, false);
|
|
18
|
+
// =========================>
|
|
19
|
+
// ## Invalid handler
|
|
20
|
+
// =========================>
|
|
21
|
+
const [invalidMessage] = (0, _utils_1.useValidation)(inputHandler.value, validations, invalid, inputHandler.idle);
|
|
22
|
+
// =========================>
|
|
23
|
+
// ## fetch option
|
|
24
|
+
// =========================>
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
const fetchOptions = async () => {
|
|
27
|
+
setLoading(true);
|
|
28
|
+
const mutateOptions = await (0, _utils_1.api)(serverOptionControl || {});
|
|
29
|
+
if (mutateOptions?.status == 200) {
|
|
30
|
+
customOptions ? setDataOptions([customOptions, ...mutateOptions.data]) : setDataOptions(mutateOptions.data);
|
|
31
|
+
setLoading(false);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
if (serverOptionControl?.path || serverOptionControl?.url) {
|
|
35
|
+
fetchOptions();
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
!options && setDataOptions([]);
|
|
39
|
+
}
|
|
40
|
+
}, [serverOptionControl?.path, serverOptionControl?.url]);
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "input-container w-full", children: [(0, jsx_runtime_1.jsxs)("label", { className: (0, _utils_1.cn)("input-label", disabled && "input-label-disabled", invalidMessage && "input-label-error", (0, _utils_1.pcn)(className, "label"), disabled && (0, _utils_1.pcn)(className, "label", "disabled"), invalidMessage && (0, _utils_1.pcn)(className, "label", "focus")), children: [label, validations && _utils_1.validation.hasRules(validations, "required") && (0, jsx_runtime_1.jsx)("span", { className: "text-danger ml-1", children: "*" })] }), tip && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-tip", disabled && "input-tip-disabled", (0, _utils_1.pcn)(className, "tip"), disabled && (0, _utils_1.pcn)(className, "tip", "disabled")), children: tip })), (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("input input-checkbox-list", vertical && "input-checkbox-list-vertical", (0, _utils_1.pcn)(className, "input"), invalidMessage && "input-error", invalidMessage && (0, _utils_1.pcn)(className, "input", "error")), children: [loading && (vertical ? [1, 2, 3, 4, 5, 6, 7, 8, 9] : [1, 2, 3]).map((_, key) => {
|
|
42
|
+
return (0, jsx_runtime_1.jsx)("div", { className: "w-1/3 h-6 rounded-lg" }, key);
|
|
43
|
+
}), (options || dataOptions) && (options || dataOptions)?.map((option, key) => {
|
|
44
|
+
const checked = Array().concat(inputHandler.value).find((val) => val == option.value);
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(_components_1.CheckboxComponent, { label: option.label, name: `option[${option.value}]#${name}`, checked: !!checked, disabled: disabled, className: classNameCheckbox, onChange: () => {
|
|
46
|
+
const newVal = (Array.isArray(inputHandler.value) ? inputHandler.value : [])
|
|
47
|
+
.filter((val) => val !== option.value)
|
|
48
|
+
.concat(checked ? [] : [option.value]);
|
|
49
|
+
inputHandler.setValue(newVal);
|
|
50
|
+
onChange?.(newVal);
|
|
51
|
+
} }, key));
|
|
52
|
+
})] }), invalidMessage && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-error-message", (0, _utils_1.pcn)(className, "error")), children: invalidMessage }))] }) }));
|
|
53
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { ValidationRules } from "@utils";
|
|
3
|
+
export interface InputCurrencyProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
4
|
+
label?: string;
|
|
5
|
+
tip?: string | ReactNode;
|
|
6
|
+
leftIcon?: any;
|
|
7
|
+
rightIcon?: any;
|
|
8
|
+
value?: number;
|
|
9
|
+
invalid?: string;
|
|
10
|
+
validations?: ValidationRules;
|
|
11
|
+
format?: {
|
|
12
|
+
locale?: string;
|
|
13
|
+
currency?: string;
|
|
14
|
+
};
|
|
15
|
+
onChange?: (value: number) => any;
|
|
16
|
+
register?: (name: string, validations?: ValidationRules) => void;
|
|
17
|
+
unregister?: (name: string) => void;
|
|
18
|
+
/** Use custom class with: "label::", "tip::", "error::", "icon::". */
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function InputCurrencyComponent({ label, tip, leftIcon, rightIcon, value, invalid, validations, format, register, unregister, onChange, className, ...props }: InputCurrencyProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.InputCurrencyComponent = InputCurrencyComponent;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
7
|
+
const _utils_1 = require("@utils");
|
|
8
|
+
function InputCurrencyComponent({ label, tip, leftIcon, rightIcon, value, invalid, validations, format, register, unregister, onChange, className = "", ...props }) {
|
|
9
|
+
// =========================>
|
|
10
|
+
// ## Initial
|
|
11
|
+
// =========================>
|
|
12
|
+
const inputHandler = (0, _utils_1.useInputHandler)(props.name, value, validations, register, unregister, false);
|
|
13
|
+
const randomId = (0, _utils_1.useInputRandomId)();
|
|
14
|
+
// =========================>
|
|
15
|
+
// ## Invalid handler
|
|
16
|
+
// =========================>
|
|
17
|
+
const [invalidMessage] = (0, _utils_1.useValidation)(inputHandler.value, validations, invalid, inputHandler.idle);
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "input-container", children: [(0, jsx_runtime_1.jsxs)("label", { htmlFor: randomId, className: (0, _utils_1.cn)("input-label", props.disabled && "input-label-disabled", inputHandler.focus && "input-label-focus", !!invalidMessage && "input-label-error", (0, _utils_1.pcn)(className, "label"), props.disabled && (0, _utils_1.pcn)(className, "label", "disabled"), inputHandler.focus && (0, _utils_1.pcn)(className, "label", "focus"), !!invalidMessage && (0, _utils_1.pcn)(className, "label", "focus")), children: [label, validations && _utils_1.validation.hasRules(validations, "required") && (0, jsx_runtime_1.jsx)("span", { className: "text-danger ml-1", children: "*" })] }), tip && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-tip", props.disabled && "input-tip-disabled", (0, _utils_1.pcn)(className, "tip"), props.disabled && (0, _utils_1.pcn)(className, "tip", "disabled")), children: tip })), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("input", { ...props, id: randomId, className: (0, _utils_1.cn)("input", leftIcon && "input-with-left-icon", rightIcon && "input-with-right-icon", (0, _utils_1.pcn)(className, "input"), !!invalidMessage && "input-error", !!invalidMessage && (0, _utils_1.pcn)(className, "input", "error")), value: inputHandler.value ? _utils_1.conversion.currency(inputHandler.value, format?.locale, format?.currency) : "", onChange: (e) => {
|
|
19
|
+
const val = Number(e.target.value.replace(/[^0-9]/g, ""));
|
|
20
|
+
inputHandler.setValue(val);
|
|
21
|
+
inputHandler.setIdle(false);
|
|
22
|
+
onChange?.(val);
|
|
23
|
+
}, onFocus: (e) => {
|
|
24
|
+
props.onFocus?.(e);
|
|
25
|
+
inputHandler.setFocus(true);
|
|
26
|
+
}, onBlur: (e) => {
|
|
27
|
+
props.onBlur?.(e);
|
|
28
|
+
setTimeout(() => inputHandler.setFocus(false), 100);
|
|
29
|
+
}, autoComplete: "off" }), leftIcon && ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { className: (0, _utils_1.cn)("input-icon", "input-icon-left", props.disabled && "input-icon-disabled", inputHandler.focus && "input-icon-focus", (0, _utils_1.pcn)(className, "icon"), props.disabled && (0, _utils_1.pcn)(className, "icon", "disabled"), inputHandler.focus && (0, _utils_1.pcn)(className, "icon", "focus")), icon: leftIcon })), rightIcon && ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { className: (0, _utils_1.cn)("input-icon", "input-icon-right", props.disabled && "input-icon-disabled", inputHandler.focus && "input-icon-focus", (0, _utils_1.pcn)(className, "icon"), props.disabled && (0, _utils_1.pcn)(className, "icon", "disabled"), inputHandler.focus && (0, _utils_1.pcn)(className, "icon", "focus")), icon: rightIcon }))] }), invalidMessage && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-error-message", (0, _utils_1.pcn)(className, "error")), children: invalidMessage }))] }));
|
|
30
|
+
}
|