sea-react-components 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/HOC/can-access-application/index.d.ts +9 -0
- package/dist/HOC/can-access-application/index.d.ts.map +1 -0
- package/dist/HOC/can-access-application/index.js +11 -0
- package/dist/HOC/with-authorization/index.d.ts +12 -0
- package/dist/HOC/with-authorization/index.d.ts.map +1 -0
- package/dist/HOC/with-authorization/index.js +23 -0
- package/dist/components/alert/index.d.ts +12 -0
- package/dist/components/alert/index.d.ts.map +1 -0
- package/dist/components/alert/index.js +51 -0
- package/dist/components/avatar/index.d.ts +10 -0
- package/dist/components/avatar/index.d.ts.map +1 -0
- package/dist/components/avatar/index.js +26 -0
- package/dist/components/badge/index.d.ts +8 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/badge/index.js +33 -0
- package/dist/components/breadcrumb/index.d.ts +7 -0
- package/dist/components/breadcrumb/index.d.ts.map +1 -0
- package/dist/components/breadcrumb/index.js +8 -0
- package/dist/components/button/index.d.ts +6 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/button/index.js +18 -0
- package/dist/components/carousel/index.d.ts +17 -0
- package/dist/components/carousel/index.d.ts.map +1 -0
- package/dist/components/carousel/index.js +89 -0
- package/dist/components/checkbox/index.d.ts +11 -0
- package/dist/components/checkbox/index.d.ts.map +1 -0
- package/dist/components/checkbox/index.js +15 -0
- package/dist/components/color-picker/index.d.ts +8 -0
- package/dist/components/color-picker/index.d.ts.map +1 -0
- package/dist/components/color-picker/index.js +21 -0
- package/dist/components/count-down/index.d.ts +6 -0
- package/dist/components/count-down/index.d.ts.map +1 -0
- package/dist/components/count-down/index.js +32 -0
- package/dist/components/drawer/index.d.ts +12 -0
- package/dist/components/drawer/index.d.ts.map +1 -0
- package/dist/components/drawer/index.js +15 -0
- package/dist/components/file-input/components/file-item/index.d.ts +9 -0
- package/dist/components/file-input/components/file-item/index.d.ts.map +1 -0
- package/dist/components/file-input/components/file-item/index.js +10 -0
- package/dist/components/file-input/index.d.ts +44 -0
- package/dist/components/file-input/index.d.ts.map +1 -0
- package/dist/components/file-input/index.js +85 -0
- package/dist/components/icon/index.d.ts +7 -0
- package/dist/components/icon/index.d.ts.map +1 -0
- package/dist/components/icon/index.js +5 -0
- package/dist/components/input/index.d.ts +9 -0
- package/dist/components/input/index.d.ts.map +1 -0
- package/dist/components/input/index.js +33 -0
- package/dist/components/list-item/components/page-button/index.d.ts +8 -0
- package/dist/components/list-item/components/page-button/index.d.ts.map +1 -0
- package/dist/components/list-item/components/page-button/index.js +8 -0
- package/dist/components/list-item/components/pagination/index.d.ts +9 -0
- package/dist/components/list-item/components/pagination/index.d.ts.map +1 -0
- package/dist/components/list-item/components/pagination/index.js +49 -0
- package/dist/components/list-item/components/search-input/index.d.ts +7 -0
- package/dist/components/list-item/components/search-input/index.d.ts.map +1 -0
- package/dist/components/list-item/components/search-input/index.js +38 -0
- package/dist/components/list-item/index.d.ts +26 -0
- package/dist/components/list-item/index.d.ts.map +1 -0
- package/dist/components/list-item/index.js +23 -0
- package/dist/components/loader/index.d.ts +6 -0
- package/dist/components/loader/index.d.ts.map +1 -0
- package/dist/components/loader/index.js +5 -0
- package/dist/components/menu/index.d.ts +9 -0
- package/dist/components/menu/index.d.ts.map +1 -0
- package/dist/components/menu/index.js +19 -0
- package/dist/components/menu/menu-item/index.d.ts +10 -0
- package/dist/components/menu/menu-item/index.d.ts.map +1 -0
- package/dist/components/menu/menu-item/index.js +19 -0
- package/dist/components/modal/index.d.ts +12 -0
- package/dist/components/modal/index.d.ts.map +1 -0
- package/dist/components/modal/index.js +41 -0
- package/dist/components/not-authorized/index.d.ts +2 -0
- package/dist/components/not-authorized/index.d.ts.map +1 -0
- package/dist/components/not-authorized/index.js +5 -0
- package/dist/components/otp-input/index.d.ts +7 -0
- package/dist/components/otp-input/index.d.ts.map +1 -0
- package/dist/components/otp-input/index.js +35 -0
- package/dist/components/paper/index.d.ts +4 -0
- package/dist/components/paper/index.d.ts.map +1 -0
- package/dist/components/paper/index.js +17 -0
- package/dist/components/progress-bar/index.d.ts +11 -0
- package/dist/components/progress-bar/index.d.ts.map +1 -0
- package/dist/components/progress-bar/index.js +32 -0
- package/dist/components/radio-button/index.d.ts +10 -0
- package/dist/components/radio-button/index.d.ts.map +1 -0
- package/dist/components/radio-button/index.js +17 -0
- package/dist/components/select/index.d.ts +16 -0
- package/dist/components/select/index.d.ts.map +1 -0
- package/dist/components/select/index.js +36 -0
- package/dist/components/skeleton/index.d.ts +4 -0
- package/dist/components/skeleton/index.d.ts.map +1 -0
- package/dist/components/skeleton/index.js +5 -0
- package/dist/components/stacked-avatars/index.d.ts +10 -0
- package/dist/components/stacked-avatars/index.d.ts.map +1 -0
- package/dist/components/stacked-avatars/index.js +23 -0
- package/dist/components/tab/index.d.ts +16 -0
- package/dist/components/tab/index.d.ts.map +1 -0
- package/dist/components/tab/index.js +23 -0
- package/dist/components/table/index.d.ts +22 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.js +67 -0
- package/dist/components/text-editor/components/toolbar/index.d.ts +9 -0
- package/dist/components/text-editor/components/toolbar/index.d.ts.map +1 -0
- package/dist/components/text-editor/components/toolbar/index.js +280 -0
- package/dist/components/text-editor/index.d.ts +12 -0
- package/dist/components/text-editor/index.d.ts.map +1 -0
- package/dist/components/text-editor/index.js +152 -0
- package/dist/components/text-editor/style.css +132 -0
- package/dist/components/text-editor/utils/index.d.ts +14 -0
- package/dist/components/text-editor/utils/index.d.ts.map +1 -0
- package/dist/components/text-editor/utils/index.js +82 -0
- package/dist/components/textarea/index.d.ts +7 -0
- package/dist/components/textarea/index.d.ts.map +1 -0
- package/dist/components/textarea/index.js +24 -0
- package/dist/components/toggle/index.d.ts +8 -0
- package/dist/components/toggle/index.d.ts.map +1 -0
- package/dist/components/toggle/index.js +12 -0
- package/dist/components/tooltip/index.d.ts +10 -0
- package/dist/components/tooltip/index.d.ts.map +1 -0
- package/dist/components/tooltip/index.js +15 -0
- package/dist/components/tree-checkbox/components/tree-checkbox-item/index.d.ts +10 -0
- package/dist/components/tree-checkbox/components/tree-checkbox-item/index.d.ts.map +1 -0
- package/dist/components/tree-checkbox/components/tree-checkbox-item/index.js +10 -0
- package/dist/components/tree-checkbox/index.d.ts +26 -0
- package/dist/components/tree-checkbox/index.d.ts.map +1 -0
- package/dist/components/tree-checkbox/index.js +62 -0
- package/dist/components/tree-checkbox/utils/index.d.ts +9 -0
- package/dist/components/tree-checkbox/utils/index.d.ts.map +1 -0
- package/dist/components/tree-checkbox/utils/index.js +14 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/hooks/list-items-hook/types.d.ts +18 -0
- package/dist/hooks/list-items-hook/types.d.ts.map +1 -0
- package/dist/hooks/list-items-hook/types.js +1 -0
- package/dist/hooks/list-items-hook/useBulkActions.d.ts +3 -0
- package/dist/hooks/list-items-hook/useBulkActions.d.ts.map +1 -0
- package/dist/hooks/list-items-hook/useBulkActions.js +8 -0
- package/dist/hooks/list-items-hook/useFilters.d.ts +3 -0
- package/dist/hooks/list-items-hook/useFilters.d.ts.map +1 -0
- package/dist/hooks/list-items-hook/useFilters.js +27 -0
- package/dist/hooks/list-items-hook/usePagination.d.ts +2 -0
- package/dist/hooks/list-items-hook/usePagination.d.ts.map +1 -0
- package/dist/hooks/list-items-hook/usePagination.js +21 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/styles.css +7 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/axios/index.d.ts +7 -0
- package/dist/utils/axios/index.d.ts.map +1 -0
- package/dist/utils/axios/index.js +23 -0
- package/dist/utils/color/index.d.ts +7 -0
- package/dist/utils/color/index.d.ts.map +1 -0
- package/dist/utils/color/index.js +22 -0
- package/dist/utils/file/index.d.ts +2 -0
- package/dist/utils/file/index.d.ts.map +1 -0
- package/dist/utils/file/index.js +8 -0
- package/dist/utils/jwt/index.d.ts +2 -0
- package/dist/utils/jwt/index.d.ts.map +1 -0
- package/dist/utils/jwt/index.js +1 -0
- package/dist/utils/validation/index.d.ts +10 -0
- package/dist/utils/validation/index.d.ts.map +1 -0
- package/dist/utils/validation/index.js +20 -0
- package/package.json +66 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import Input from "../input";
|
|
5
|
+
export default function OTPInput({ length, onChange, errorMessage }) {
|
|
6
|
+
const [otpParts, setOTPParts] = useState(Array(length).fill(""));
|
|
7
|
+
const inputRefs = useRef([]);
|
|
8
|
+
const handleChangeOTPPart = (value, index) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const updatedOTPParts = [...otpParts];
|
|
11
|
+
updatedOTPParts[index] = value;
|
|
12
|
+
setOTPParts(updatedOTPParts);
|
|
13
|
+
onChange(updatedOTPParts.join(""));
|
|
14
|
+
// Move focus to the next input if the value is entered and not at the last input
|
|
15
|
+
if (value && index < length - 1) {
|
|
16
|
+
(_a = inputRefs.current[index + 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("div", { className: "flex items-center gap-5", children: otpParts.map((p, i) => {
|
|
20
|
+
return (_jsx(Input, { ref: (el) => {
|
|
21
|
+
inputRefs.current[i] = el;
|
|
22
|
+
}, type: "text", id: `part-${i}`, name: `part-${i}`, placeholder: "*", className: "w-10 h-10 text-center text-3xl", maxLength: 1, value: p, onKeyDown: (e) => {
|
|
23
|
+
var _a;
|
|
24
|
+
// Prevent space and handle backspace
|
|
25
|
+
if (e.key === " " || e.key === "Spacebar") {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
}
|
|
28
|
+
if (e.key === "Backspace" && otpParts[i] === "" && i > 0) {
|
|
29
|
+
(_a = inputRefs.current[i - 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
30
|
+
}
|
|
31
|
+
}, onChange: (e) => {
|
|
32
|
+
handleChangeOTPPart(e.target.value, i);
|
|
33
|
+
}, errorMessage: Boolean(errorMessage) }, `part-${i}`));
|
|
34
|
+
}) }), errorMessage && (_jsx("p", { className: "pl-1 text-sm text-error", children: errorMessage }))] }));
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/paper/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,KAAK,GAAG,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAC9D,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,SAAsB,EACtB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,2CASP"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import clsx from "clsx";
|
|
14
|
+
export default function Paper(_a) {
|
|
15
|
+
var { className = "bg-white", children } = _a, props = __rest(_a, ["className", "children"]);
|
|
16
|
+
return (_jsx("div", Object.assign({ className: clsx("px-4 py-2 rounded-lg shadow-md", className) }, props, { children: children })));
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type Types = "primary" | "secondary" | "success" | "info" | "warning" | "error";
|
|
3
|
+
export type Sizes = "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
|
+
export type Props = {
|
|
5
|
+
percentage?: number;
|
|
6
|
+
showPercentage?: boolean;
|
|
7
|
+
size?: Sizes;
|
|
8
|
+
type?: Types;
|
|
9
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
export default function ProgressBar({ percentage, className, size, type, showPercentage, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/progress-bar/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,KAAK,GACb,SAAS,GACT,WAAW,GACX,SAAS,GACT,MAAM,GACN,SAAS,GACT,OAAO,CAAC;AAWZ,MAAM,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAiBrD,MAAM,MAAM,KAAK,GAAG;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AACzC,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,UAAc,EACd,SAAS,EACT,IAAW,EACX,IAAgB,EAChB,cAAsB,GACvB,EAAE,KAAK,2CA2BP"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
const colors = {
|
|
4
|
+
primary: "bg-primary",
|
|
5
|
+
secondary: "bg-secondary",
|
|
6
|
+
success: "bg-success",
|
|
7
|
+
info: "bg-info",
|
|
8
|
+
warning: "bg-warning",
|
|
9
|
+
error: "bg-error",
|
|
10
|
+
};
|
|
11
|
+
const barHights = {
|
|
12
|
+
xs: "h-[6px]",
|
|
13
|
+
sm: "h-[10px]",
|
|
14
|
+
md: "h-[14px]",
|
|
15
|
+
lg: "h-[20px]",
|
|
16
|
+
xl: "h-[24px]",
|
|
17
|
+
};
|
|
18
|
+
const textSizes = {
|
|
19
|
+
xs: "text-[6px]",
|
|
20
|
+
sm: "text-[10px]",
|
|
21
|
+
md: "text-[12px]",
|
|
22
|
+
lg: "text-[16px]",
|
|
23
|
+
xl: "text-[20px]",
|
|
24
|
+
};
|
|
25
|
+
export default function ProgressBar({ percentage = 0, className, size = "md", type = "primary", showPercentage = false, }) {
|
|
26
|
+
const hightClass = barHights[size];
|
|
27
|
+
const textClass = textSizes[size];
|
|
28
|
+
const bgClass = colors[type];
|
|
29
|
+
return (_jsx("div", { className: "relative bg-gray-300 rounded-full overflow-hidden", children: _jsx("div", { className: clsx("w-full flex items-center rounded-full transition-all duration-300 ease-in-out", hightClass, textClass, bgClass, className), style: {
|
|
30
|
+
width: `${percentage}%`,
|
|
31
|
+
}, children: showPercentage && (_jsxs("p", { className: " text-white text-center w-full", children: [percentage ? percentage : 0, " %"] })) }) }));
|
|
32
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type Props = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
checked: boolean;
|
|
6
|
+
onChange: () => void;
|
|
7
|
+
label: React.ReactElement;
|
|
8
|
+
} & React.InputHTMLAttributes<HTMLInputElement>;
|
|
9
|
+
export default function RadioButton({ id, name, checked, onChange, label, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/radio-button/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;CAC3B,GAAG,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAChD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,EAAE,EACF,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,2CAyBP"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import clsx from "clsx";
|
|
14
|
+
export default function RadioButton(_a) {
|
|
15
|
+
var { id, name, checked, onChange, label } = _a, props = __rest(_a, ["id", "name", "checked", "onChange", "label"]);
|
|
16
|
+
return (_jsxs("label", { htmlFor: id, className: "flex items-center space-x-2 cursor-pointer", children: [_jsx("input", Object.assign({}, props, { type: "radio", id: id, name: name, checked: checked, onChange: onChange, className: "hidden" })), _jsx("div", { className: clsx("w-5 h-5 rounded-full border-2 flex items-center justify-center", checked ? "bg-primary border-primary" : "bg-white border-gray-300"), children: checked && _jsx("div", { className: "w-3 h-3 rounded-full bg-white" }) }), label] }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type SelectOption<T> = {
|
|
2
|
+
value: T;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
export type Props<T> = {
|
|
6
|
+
name: string;
|
|
7
|
+
options: SelectOption<T>[];
|
|
8
|
+
values: T[];
|
|
9
|
+
setValues: (newValues: T[]) => void;
|
|
10
|
+
errorMessage?: string | boolean;
|
|
11
|
+
buttonClassName?: string | undefined;
|
|
12
|
+
placeholder?: string | undefined;
|
|
13
|
+
multiselect?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default function Select<T>({ name, setValues, options, errorMessage, buttonClassName, values, placeholder, multiselect, }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/select/index.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC5B,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,MAAM,EAAE,CAAC,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC,EAAE,EAChC,IAAI,EACJ,SAAS,EACT,OAAO,EACP,YAAY,EACZ,eAAe,EACf,MAAM,EACN,WAAgC,EAChC,WAAmB,GACpB,EAAE,KAAK,CAAC,CAAC,CAAC,2CAsGV"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import Menu from "../menu";
|
|
5
|
+
import MenuItem from "../menu/menu-item";
|
|
6
|
+
import { Icon } from "@iconify/react";
|
|
7
|
+
import clsx from "clsx";
|
|
8
|
+
export default function Select({ name, setValues, options, errorMessage, buttonClassName, values, placeholder = "Select an option", multiselect = false, }) {
|
|
9
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
10
|
+
const selectedOptions = options.filter((o) => values.includes(o.value));
|
|
11
|
+
const renderSelectContent = () => (_jsx(_Fragment, { children: multiselect ? (selectedOptions.length ? (_jsx("div", { className: "flex items-center gap-3", children: selectedOptions.map((o, i) => (_jsxs("div", { className: "bg-primary bg-opacity-50 px-2 py-1 rounded-2xl flex items-center gap-1", children: [_jsx("p", { className: "text-black", children: o.label }), _jsx(Icon, { icon: "line-md:close-small", className: "h-5 w-5 hover:scale-110 transition-all duration-300 ease-in-out", onClick: () => handleRemoveSelectedOption(o) })] }, `option-${i}`))) })) : (_jsx("p", { children: placeholder }))) : selectedOptions[0] ? (_jsx("p", { children: selectedOptions[0].label })) : (_jsx("p", { children: placeholder })) }));
|
|
12
|
+
const handleRemoveSelectedOption = (option) => {
|
|
13
|
+
const updatedOptions = selectedOptions.filter((selectedOption) => selectedOption !== option);
|
|
14
|
+
setValues(updatedOptions.map((opt) => opt.value));
|
|
15
|
+
};
|
|
16
|
+
const handleClickOption = (option) => {
|
|
17
|
+
if (multiselect) {
|
|
18
|
+
const isSelected = selectedOptions.includes(option);
|
|
19
|
+
if (isSelected) {
|
|
20
|
+
handleRemoveSelectedOption(option);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const updatedOptions = [...selectedOptions, option];
|
|
24
|
+
setValues(updatedOptions.map((opt) => opt.value));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
setValues([option.value]);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Menu, { menuButton: _jsxs("div", { className: clsx("text-text flex items-center justify-between gap-2 bg-white px-3 py-2 rounded-xl border-0.5 hover:border-primary", errorMessage
|
|
32
|
+
? "border-error"
|
|
33
|
+
: isFocused
|
|
34
|
+
? "border-primary"
|
|
35
|
+
: "border-gray-200", buttonClassName), children: [renderSelectContent(), _jsx(Icon, { icon: "iconamoon:arrow-down-2" })] }), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), children: _jsx("div", { className: "flex flex-col gap-2 p-1 min-w-36", children: options.map((o, i) => (_jsx(MenuItem, { selected: selectedOptions.includes(o), onClick: () => handleClickOption(o), children: _jsx("p", { className: "flex items-center gap-2 px-4 py-2 text-left", children: o.label }) }, `${name}-option-${i}`))) }) }), errorMessage && (_jsx("p", { className: "pl-1 text-sm text-error", children: errorMessage }))] }));
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/skeleton/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,KAAK,GAAG,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAE9D,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,2CAMpD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AvatarSize, Props as AvatarProps } from "../avatar";
|
|
2
|
+
export type Props = {
|
|
3
|
+
name: string;
|
|
4
|
+
max?: number;
|
|
5
|
+
size?: AvatarSize;
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
items: AvatarProps[];
|
|
8
|
+
};
|
|
9
|
+
export default function StackedAvatars({ name, max, size, className, items, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/stacked-avatars/index.tsx"],"names":[],"mappings":"AACA,OAAe,EAAE,UAAU,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAcrE,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,IAAI,EACJ,GAAiB,EACjB,IAAW,EACX,SAAS,EACT,KAAK,GACN,EAAE,KAAK,2CAwCP"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Avatar from "../avatar";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
const offsetFactor = 1.3;
|
|
5
|
+
const sizeValues = {
|
|
6
|
+
sm: 30,
|
|
7
|
+
md: 50,
|
|
8
|
+
lg: 70,
|
|
9
|
+
xl: 90,
|
|
10
|
+
};
|
|
11
|
+
const DEFAULT_MAX = 3;
|
|
12
|
+
export default function StackedAvatars({ name, max = DEFAULT_MAX, size = "md", className, items, }) {
|
|
13
|
+
if (max <= 0)
|
|
14
|
+
max = DEFAULT_MAX;
|
|
15
|
+
const sizeValue = sizeValues[size];
|
|
16
|
+
const avatarsToDisplay = items.slice(0, max);
|
|
17
|
+
const remaining = items.length - max;
|
|
18
|
+
return (_jsxs("div", { className: "relative flex items-center justify-center w-full", style: { height: sizeValue }, children: [avatarsToDisplay.map((item, i) => (_jsx(Avatar, Object.assign({}, item, { className: clsx(className, "absolute"), style: { left: (i * sizeValue) / offsetFactor }, size: size }), `${name}-avatar-${i}`))), remaining > 0 && (_jsxs("div", { className: clsx(className, "absolute flex items-center justify-center text-white bg-secondary"), style: {
|
|
19
|
+
left: (max * sizeValue) / offsetFactor,
|
|
20
|
+
width: sizeValue,
|
|
21
|
+
height: sizeValue,
|
|
22
|
+
}, children: ["+", items.length - max] }))] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type TabItem = {
|
|
2
|
+
label: string;
|
|
3
|
+
key: string;
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type Props = {
|
|
7
|
+
name: string;
|
|
8
|
+
tabs: TabItem[];
|
|
9
|
+
tabKey: string;
|
|
10
|
+
setTabKey: (newTabKey: string) => void;
|
|
11
|
+
direction?: "horizontal" | "vertical";
|
|
12
|
+
updateParams?: (updates: Record<string, string>) => void;
|
|
13
|
+
getParam?: (name: string) => string | null | undefined;
|
|
14
|
+
};
|
|
15
|
+
export default function Tab({ name, tabs, tabKey, setTabKey, updateParams, getParam, direction, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tab/index.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACxD,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,GAAG,CAAC,EAC1B,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,SAAwB,GACzB,EAAE,KAAK,2CAmCP"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useEffect, useLayoutEffect } from "react";
|
|
5
|
+
export default function Tab({ name, tabs, tabKey, setTabKey, updateParams, getParam, direction = "horizontal", }) {
|
|
6
|
+
let className = "flex-row";
|
|
7
|
+
if (direction === "vertical")
|
|
8
|
+
className = "flex-col";
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (tabKey && updateParams)
|
|
11
|
+
updateParams({ [name]: tabKey });
|
|
12
|
+
}, [tabKey]);
|
|
13
|
+
useLayoutEffect(() => {
|
|
14
|
+
let value = tabKey;
|
|
15
|
+
if (getParam) {
|
|
16
|
+
value = getParam(name);
|
|
17
|
+
}
|
|
18
|
+
if (!value && tabs.length)
|
|
19
|
+
value = tabs[0].key;
|
|
20
|
+
setTabKey(value);
|
|
21
|
+
}, []);
|
|
22
|
+
return (_jsx("div", { className: clsx("flex items-center justify-around gap-1", className), children: tabs.map((t, i) => (_jsx("button", { className: clsx("pb-1", tabKey === t.key && "border-b-2 border-primary text-primary"), onClick: () => setTabKey(t.key), children: t.label }, `tab-${name}-${t.key}-${i}`))) }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BulkActionFeature } from "../../hooks/list-items-hook/types";
|
|
3
|
+
export declare const DEFAULT_TABLE_ROWS_PER_PAGE_OPTIONS: {
|
|
4
|
+
label: string;
|
|
5
|
+
value: number;
|
|
6
|
+
}[];
|
|
7
|
+
export type TableColumn<T> = {
|
|
8
|
+
key: string;
|
|
9
|
+
label: string;
|
|
10
|
+
custom?: (row: T) => React.ReactNode;
|
|
11
|
+
} & React.ThHTMLAttributes<HTMLTableHeaderCellElement>;
|
|
12
|
+
export type Props<T> = {
|
|
13
|
+
name: string;
|
|
14
|
+
columns: TableColumn<T>[];
|
|
15
|
+
rows: ({
|
|
16
|
+
id: string;
|
|
17
|
+
} & T)[];
|
|
18
|
+
bulkActionFeature?: BulkActionFeature | undefined;
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export default function Table<T>({ name, columns, rows, bulkActionFeature, loading, }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/table/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,eAAO,MAAM,mCAAmC;;;GAK/C,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;CACtC,GAAG,KAAK,CAAC,gBAAgB,CAAC,0BAA0B,CAAC,CAAC;AAEvD,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAC7B,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,CAAC,EAAE,EAC/B,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,iBAAiB,EACjB,OAAe,GAChB,EAAE,KAAK,CAAC,CAAC,CAAC,2CAmKV"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
import Checkbox from "../checkbox";
|
|
16
|
+
import Icon from "../icon";
|
|
17
|
+
export const DEFAULT_TABLE_ROWS_PER_PAGE_OPTIONS = [5, 10, 20, 50].map((item) => ({
|
|
18
|
+
label: item.toString(),
|
|
19
|
+
value: item,
|
|
20
|
+
}));
|
|
21
|
+
export default function Table({ name, columns, rows, bulkActionFeature, loading = false, }) {
|
|
22
|
+
return (_jsx("div", { className: "overflow-x-auto", children: loading ? (_jsxs("div", { className: "flex flex-col gap-5", children: [_jsxs("table", { className: "min-w-full table-auto", children: [_jsx("thead", { id: `loading-table-${name}-head`, className: "bg-gray-100", children: _jsxs("tr", { className: "text-text pb-2 border-b-[2px] border-b-gray-100", children: [bulkActionFeature && (_jsx("th", { className: clsx("px-4 py-2 text-left"), children: _jsx(Checkbox, { checked: bulkActionFeature.selectedRowIds.length === rows.length, onChange: (checked) => {
|
|
23
|
+
if (checked) {
|
|
24
|
+
bulkActionFeature.setSelectedRowIds(rows.map((r) => r.id));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const currentPageIds = rows.map((r) => r.id);
|
|
28
|
+
const result = bulkActionFeature.selectedRowIds.filter((item) => !currentPageIds.includes(item));
|
|
29
|
+
bulkActionFeature.setSelectedRowIds(result);
|
|
30
|
+
}
|
|
31
|
+
} }) }, `loading-column-${name}-checkbox`)), columns.map((column, i) => {
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
+
const { className, key, label, custom } = column, restColumn = __rest(column, ["className", "key", "label", "custom"]);
|
|
34
|
+
return (_jsx("th", Object.assign({ className: clsx("px-4 py-2 text-left", className) }, restColumn, { children: label }), `loading-column-${name}-${i}-${key}`));
|
|
35
|
+
})] }) }), _jsx("tbody", { id: `loading-table-${name}-body` })] }), _jsx("div", { className: "flex items-center justify-center", children: _jsx(Icon, { icon: "line-md:loading-loop", className: "text-primary w-20 h-20" }) })] })) : (_jsxs("table", { className: "min-w-full table-auto", children: [_jsx("thead", { id: `table-${name}-head`, className: "bg-gray-100", children: _jsxs("tr", { className: "text-text pb-2 border-b-[2px] border-b-gray-100", children: [bulkActionFeature && (_jsx("th", { className: clsx("px-4 py-2 text-left"), children: _jsx(Checkbox, { checked: bulkActionFeature.selectedRowIds.length === rows.length, onChange: (checked) => {
|
|
36
|
+
if (checked) {
|
|
37
|
+
bulkActionFeature.setSelectedRowIds(rows.map((r) => r.id));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const currentPageIds = rows.map((r) => r.id);
|
|
41
|
+
const result = bulkActionFeature.selectedRowIds.filter((item) => !currentPageIds.includes(item));
|
|
42
|
+
bulkActionFeature.setSelectedRowIds(result);
|
|
43
|
+
}
|
|
44
|
+
} }) }, `column-${name}-checkbox`)), columns.map((column, i) => {
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
46
|
+
const { className, key, label, custom } = column, restColumn = __rest(column, ["className", "key", "label", "custom"]);
|
|
47
|
+
return (_jsx("th", Object.assign({ className: clsx("px-4 py-2 text-left", className) }, restColumn, { children: label }), `column-${name}-${i}-${key}`));
|
|
48
|
+
})] }) }), _jsx("tbody", { id: `table-${name}-body`, children: rows.map((row, i) => {
|
|
49
|
+
return (_jsxs("tr", { className: clsx("text-text pb-2 ", i !== rows.length - 1 && "border-b-[2px] border-gray-100"), children: [bulkActionFeature && (_jsx("td", { className: "px-4 py-2", children: _jsx(Checkbox, { checked: bulkActionFeature.selectedRowIds.includes(row.id) ||
|
|
50
|
+
false, onChange: (checked) => {
|
|
51
|
+
if (checked) {
|
|
52
|
+
bulkActionFeature.setSelectedRowIds([
|
|
53
|
+
...bulkActionFeature.selectedRowIds,
|
|
54
|
+
row.id,
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const selectedRowIds = bulkActionFeature.selectedRowIds.filter((rid) => rid !== row.id);
|
|
59
|
+
bulkActionFeature.setSelectedRowIds(selectedRowIds);
|
|
60
|
+
}
|
|
61
|
+
} }) }, `row-${name}-${i}-checkbox`)), columns.map((column) => {
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
+
const value = row[column.key];
|
|
64
|
+
return (_jsx("td", { className: "px-4 py-2", children: column.custom ? column.custom(row) : value }, `row-${name}-${i}-${column.key}`));
|
|
65
|
+
})] }, `row-${name}-${i}`));
|
|
66
|
+
}) })] })) }));
|
|
67
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/react/dist";
|
|
2
|
+
import { Level } from "@tiptap/extension-heading";
|
|
3
|
+
type Props = {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
headingLevels?: Level[];
|
|
6
|
+
};
|
|
7
|
+
export default function Toolbar({ editor, headingLevels }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/text-editor/components/toolbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAalD,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;CACzB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,MAAM,EAAE,aAAyB,EAAE,EAAE,KAAK,2CA8gB3E"}
|