forma-ui 0.0.5 → 0.0.7

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 (101) hide show
  1. package/dist/Interfaces/dictionary.d.ts +25 -0
  2. package/dist/Interfaces/dictionary.js +8 -0
  3. package/dist/Interfaces/global.d.ts +21 -0
  4. package/dist/Interfaces/global.js +1 -0
  5. package/dist/Interfaces/meta.d.ts +39 -0
  6. package/dist/Interfaces/meta.js +8 -0
  7. package/dist/app/[lang]/stores/LangStore.d.ts +22 -0
  8. package/dist/app/[lang]/stores/LangStore.js +125 -0
  9. package/dist/components/icon/icon.d.ts +102 -2
  10. package/dist/components/icon/icon.js +402 -9
  11. package/dist/components/ui/Accordion.d.ts +1 -0
  12. package/dist/components/ui/Accordion.js +15 -6
  13. package/dist/components/ui/Button.d.ts +0 -0
  14. package/dist/components/ui/Button.js +1 -1
  15. package/dist/components/ui/CheckBox.d.ts +0 -0
  16. package/dist/components/ui/CheckBox.js +0 -0
  17. package/dist/components/ui/Input.d.ts +11 -10
  18. package/dist/components/ui/Input.js +175 -3
  19. package/dist/components/ui/Input.types.d.ts +45 -0
  20. package/dist/components/ui/Input.types.js +1 -0
  21. package/dist/components/ui/Modal.d.ts +9 -9
  22. package/dist/components/ui/Modal.js +51 -6
  23. package/dist/components/ui/RadioButton.d.ts +0 -0
  24. package/dist/components/ui/RadioButton.js +0 -0
  25. package/dist/components/ui/Table.d.ts +0 -0
  26. package/dist/components/ui/Table.js +0 -0
  27. package/dist/components/ui/Tabs.d.ts +0 -0
  28. package/dist/components/ui/Tabs.js +0 -0
  29. package/dist/configs/language.d.ts +39 -0
  30. package/dist/configs/language.js +50 -0
  31. package/dist/configs/metadata.d.ts +69 -0
  32. package/dist/configs/metadata.js +143 -0
  33. package/dist/dictionaries/en.json +0 -0
  34. package/dist/dictionaries/fa.json +0 -0
  35. package/dist/dictionaries/index.d.ts +0 -0
  36. package/dist/dictionaries/index.js +0 -0
  37. package/dist/hooks/useDevice.d.ts +21 -0
  38. package/dist/hooks/useDevice.js +49 -0
  39. package/dist/hooks/useTranslation.d.ts +4 -0
  40. package/dist/hooks/useTranslation.js +34 -0
  41. package/dist/index.d.ts +9 -1
  42. package/dist/index.js +11 -1
  43. package/dist/libs/api/axiosClient.d.ts +9 -0
  44. package/dist/libs/api/axiosClient.js +34 -0
  45. package/dist/libs/api/cns.d.ts +16 -0
  46. package/dist/libs/api/cns.js +29 -0
  47. package/dist/libs/api/usePostFetch.d.ts +23 -0
  48. package/dist/libs/api/usePostFetch.js +17 -0
  49. package/dist/libs/cn.d.ts +1 -0
  50. package/dist/libs/cn.js +12 -0
  51. package/dist/libs/cookieUtils.d.ts +10 -0
  52. package/dist/libs/cookieUtils.js +28 -0
  53. package/dist/libs/detectComponentResponsive.d.ts +10 -0
  54. package/dist/libs/detectComponentResponsive.js +24 -0
  55. package/dist/libs/detectDeviceFromUA.d.ts +8 -0
  56. package/dist/libs/detectDeviceFromUA.js +14 -0
  57. package/dist/libs/fonts.d.ts +10 -0
  58. package/dist/libs/fonts.js +94 -0
  59. package/dist/libs/metadataHelper.d.ts +17 -0
  60. package/dist/libs/metadataHelper.js +20 -0
  61. package/dist/libs/modal/Modal.d.ts +9 -0
  62. package/dist/libs/modal/Modal.js +41 -0
  63. package/dist/libs/translation.d.ts +5 -0
  64. package/dist/libs/translation.js +30 -0
  65. package/dist/{lib → libs}/utils.d.ts +0 -0
  66. package/dist/{lib → libs}/utils.js +0 -0
  67. package/dist/locale/about/en.json +3 -0
  68. package/dist/locale/about/fa.json +3 -0
  69. package/dist/locale/coin/en.json +4 -0
  70. package/dist/locale/coin/fa.json +4 -0
  71. package/dist/locale/en.d.ts +56 -0
  72. package/dist/locale/en.js +16 -0
  73. package/dist/locale/fa.d.ts +59 -0
  74. package/dist/locale/fa.js +16 -0
  75. package/dist/locale/global/en.json +12 -0
  76. package/dist/locale/global/fa.json +16 -0
  77. package/dist/locale/home/en.json +11 -0
  78. package/dist/locale/home/fa.json +11 -0
  79. package/dist/locale/index.d.ts +201 -0
  80. package/dist/locale/index.js +7 -0
  81. package/dist/locale/meta/about/en.json +10 -0
  82. package/dist/locale/meta/about/fa.json +5 -0
  83. package/dist/locale/meta/en.json +15 -0
  84. package/dist/locale/meta/fa.json +15 -0
  85. package/dist/locale/meta/home/en.json +10 -0
  86. package/dist/locale/meta/home/fa.json +5 -0
  87. package/dist/middleware.d.ts +14 -0
  88. package/dist/middleware.js +57 -0
  89. package/dist/store/appStore.d.ts +1 -1
  90. package/dist/store/appStore.js +1 -1
  91. package/dist/tsconfig.build.tsbuildinfo +1 -1
  92. package/dist/utils/nextImageLoader.d.ts +9 -0
  93. package/dist/utils/nextImageLoader.js +15 -0
  94. package/package.json +10 -3
  95. package/README.md +0 -36
  96. package/dist/components/PostDetailPage.d.ts +0 -7
  97. package/dist/components/PostDetailPage.js +0 -47
  98. package/dist/components/PostPage.d.ts +0 -6
  99. package/dist/components/PostPage.js +0 -48
  100. package/dist/config/language.d.ts +0 -11
  101. package/dist/config/language.js +0 -6
@@ -9,6 +9,7 @@ export type AccordionProps = {
9
9
  title: string;
10
10
  title_classname?: string;
11
11
  open?: boolean;
12
+ onToggle?: () => void;
12
13
  sliding?: boolean;
13
14
  animation?: "scale" | "fade" | "slide" | "bounce";
14
15
  };
@@ -1,12 +1,21 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { cn } from "../../lib/utils";
5
- const Accordion = ({ parentClassName, className, circleLocation, secoundCircleLocation, children, icon, title, title_classname, open = false, sliding = true, animation = "slide", }) => {
6
- const [isOpen, setIsOpen] = useState(open);
3
+ import { useState, useEffect } from "react";
4
+ import { cn } from "../../libs/utils";
5
+ const Accordion = ({ parentClassName, className, circleLocation, secoundCircleLocation, children, icon, title, title_classname, open, onToggle, sliding = true, animation = "slide", }) => {
6
+ const [isOpen, setIsOpen] = useState(open !== null && open !== void 0 ? open : false);
7
+ // sync with controlled open
8
+ useEffect(() => {
9
+ if (open !== undefined)
10
+ setIsOpen(open);
11
+ }, [open]);
7
12
  const toggleOpen = () => {
8
- if (sliding)
9
- setIsOpen(!isOpen);
13
+ if (onToggle) {
14
+ onToggle(); // parent کنترل می‌کند
15
+ }
16
+ else if (sliding) {
17
+ setIsOpen(!isOpen); // internal state
18
+ }
10
19
  };
11
20
  const getAnimationClasses = () => {
12
21
  switch (animation) {
File without changes
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  // components/ui/Button.tsx
14
14
  import { forwardRef } from "react";
15
- import { cn } from "../../lib/utils";
15
+ import { cn } from "../../libs/utils";
16
16
  const Button = forwardRef((_a, ref) => {
17
17
  var { className, variant = "primary", size = "md", loading = false, icon, iconPosition = "left", fullWidth = false, clickAnimation = "none", children, disabled } = _a, props = __rest(_a, ["className", "variant", "size", "loading", "icon", "iconPosition", "fullWidth", "clickAnimation", "children", "disabled"]);
18
18
  const isDisabled = disabled || loading;
File without changes
File without changes
@@ -1,10 +1,11 @@
1
- import React from "react";
2
- type InputProps = {
3
- label?: string;
4
- type?: string;
5
- placeholder?: string;
6
- value?: string;
7
- onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
8
- };
9
- export default function Input({ label, type, placeholder, value, onChange, }: InputProps): import("react/jsx-runtime").JSX.Element;
10
- export {};
1
+ import type { InputTextProps, InputEmailProps, InputMobileProps, InputPasswordProps, InputRePasswordProps, InputTextAreaProps, InputSearchProps, InputRadioButtonProps, InputToggleProps, InputDarkLightProps } from "./Input.types";
2
+ export declare function InputText({ label, className, id, disabled, value, onChange, onClear, ...props }: InputTextProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function InputEmail({ label, className, id, variant, error, disabled, placeholder, value, onChange, onClear, ...props }: InputEmailProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function InputMobile({ label, className, id, error, disabled, placeholder, value, onChange, onClear, ...props }: InputMobileProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function InputTextArea({ label, className, id, value, onChange, ...props }: InputTextAreaProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function InputSearch({ className, id, inputSearchRef, classNameParent, searchClassname, param, value, onChange, ...props }: InputSearchProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function InputPassword({ label, className, id, variant, error, buttonFirstId, buttonSecondId, value, onChange, onClear, ...props }: InputPasswordProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function InputRePassword({ label, id, buttonId, passwordFieldId, ...props }: InputRePasswordProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function InputDarkLight({ className }: InputDarkLightProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function InputRadioButton({ className, id, index, name, useIndex, onSortChange, ...props }: InputRadioButtonProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function InputToggle({ className, checked, onStatusChange, ...props }: InputToggleProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,176 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export default function Input({ label, type = "text", placeholder, value, onChange, }) {
3
- return (_jsxs("div", { className: "flex flex-col gap-1", children: [label && _jsx("label", { className: "text-sm font-medium", children: label }), _jsx("input", { type: type, placeholder: placeholder, value: value, onChange: onChange, className: "border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:outline-none" })] }));
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, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { useState, useRef, useEffect } from "react";
14
+ import { CloseSquareIcon, EmailIcon, MobielIcon, SunIcon, HideIcon, LockIcon, SearchIcon, ShowIcon, MoonIcon, } from "../icon/icon";
15
+ import { cn } from "@/libs/utils";
16
+ // Simple translation function replacement (no external library)
17
+ const translate = (key) => {
18
+ const translations = {
19
+ error_invalid_email: "Please enter a valid email address",
20
+ error_invalid_mobile: "Please enter a valid mobile number",
21
+ error_min_length_password: "Password must be at least 5 characters",
22
+ error_re_password: "Passwords do not match",
23
+ };
24
+ return translations[key] || key;
25
+ };
26
+ // InputText Component
27
+ export function InputText(_a) {
28
+ var { label, className, id, disabled, value, onChange, onClear } = _a, props = __rest(_a, ["label", "className", "id", "disabled", "value", "onChange", "onClear"]);
29
+ const inputRef = useRef(null);
30
+ const handleClear = () => {
31
+ if (inputRef.current) {
32
+ inputRef.current.value = "";
33
+ const event = new Event("input", { bubbles: true });
34
+ inputRef.current.dispatchEvent(event);
35
+ }
36
+ onClear === null || onClear === void 0 ? void 0 : onClear();
37
+ };
38
+ return (_jsxs("div", { className: "flex flex-col w-full", children: [label && (_jsx("label", { htmlFor: id, className: "text-Neutral-300 text-[10px] font-medium px-3 mb-1", children: label })), _jsxs("div", { className: "relative", children: [_jsx("input", Object.assign({ ref: inputRef, id: id, type: "text", disabled: disabled, value: value, onChange: onChange, className: cn("autofill-input placeholder-Neutral-200 w-full px-[1rem] rtl:pl-[2.5rem] ltr:pr-[2.5rem] py-3 rounded-2xl bg-background-light border border-secondary-100 focus:outline-none focus:ring-0 focus:border-secondary-400 justify-between items-center relative", className) }, props)), !disabled && (_jsx("button", { type: "button", onClick: handleClear, className: "absolute inset-y-0 rtl:left-0 ltr:right-0 flex items-center p-2", children: _jsx(CloseSquareIcon, { className: "text-Nutral-500" }) }))] })] }));
39
+ }
40
+ // InputEmail Component
41
+ export function InputEmail(_a) {
42
+ var { label, className, id, variant = "default", error, disabled, placeholder, value, onChange, onClear } = _a, props = __rest(_a, ["label", "className", "id", "variant", "error", "disabled", "placeholder", "value", "onChange", "onClear"]);
43
+ const inputRef = useRef(null);
44
+ const [showError, setShowError] = useState(false);
45
+ const handleClear = () => {
46
+ if (inputRef.current) {
47
+ inputRef.current.value = "";
48
+ const event = new Event("input", { bubbles: true });
49
+ inputRef.current.dispatchEvent(event);
50
+ }
51
+ onClear === null || onClear === void 0 ? void 0 : onClear();
52
+ };
53
+ const emailPattern = "[\\-a-zA-Z0-9~!$%^&*_=+\\}\\{'?]+(\\.[-a-zA-Z0-9~!$%^&*_=+\\}\\{'?]+)*@[a-zA-Z0-9_][-a-zA-Z0-9_]*(\\.[-a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,}(:[0-9]{1,5})?";
54
+ if (variant === "auth") {
55
+ return (_jsxs(_Fragment, { children: [label && (_jsx("label", { htmlFor: id, className: "text-Neutral-300 text-[10px] font-medium px-3 mb-1", children: label })), _jsxs("div", { className: "relative", children: [_jsx("input", Object.assign({ ref: inputRef, id: id, type: "email", pattern: emailPattern, placeholder: placeholder, disabled: disabled, value: value, onChange: onChange, onBlur: () => setShowError(false), onFocus: () => setShowError(false), className: cn("autofill-input peer placeholder-Neutral-200 w-full px-[2.7rem] py-3 rounded-2xl bg-secondary-50 dark:bg-background-light border border-secondary-100 focus:outline-none focus:ring-0 focus:border-secondary-400 justify-between items-center text-Neutral-500 dark:text-white relative", className) }, props)), !disabled && (_jsx("button", { type: "button", onClick: handleClear, className: "absolute inset-y-0 rtl:left-0 ltr:right-0 flex items-center p-2", children: _jsx(CloseSquareIcon, {}) })), _jsx("div", { className: "absolute inset-y-0 rtl:right-0 ltr:left-0 rtl:pr-3 ltr:pl-3 flex items-center pointer-events-none", children: _jsx(EmailIcon, {}) }), error && !showError && (_jsx("div", { className: "peer-focus:hidden absolute inset-x-0 mt-2 mx-3", children: _jsx("div", { className: "text-Error-400 text-xs font-medium", children: translate(error) }) })), _jsx("div", { className: "hidden peer-invalid:flex absolute mt-2 mx-3", children: _jsx("div", { className: "text-Error-400 text-xs font-medium", children: translate("error_invalid_email") }) })] })] }));
56
+ }
57
+ return (_jsxs(_Fragment, { children: [label && (_jsx("label", { htmlFor: id, className: "text-Neutral-300 text-[10px] font-medium px-3 mb-1", children: label })), _jsxs("div", { className: "flex flex-col relative", children: [_jsx("input", Object.assign({ ref: inputRef, id: id, type: "email", disabled: disabled, value: value, onChange: onChange, className: cn("autofill-input rounded-2xl px-[2.7rem] h-12 py-6 border-2 border-Neutral-50 focus:outline-none focus:ring-0 focus:border-secondary-400", className) }, props)), _jsx("div", { className: "absolute inset-y-0 rtl:right-0 ltr:left-0 rtl:pr-3 ltr:pl-3 flex items-center pointer-events-none", children: _jsx(EmailIcon, { className: "text-Nutral-500" }) }), !disabled && (_jsx("button", { type: "button", onClick: handleClear, className: "absolute inset-y-0 rtl:left-0 ltr:right-0 flex items-center p-2", children: _jsx(CloseSquareIcon, { className: "text-Nutral-500" }) }))] })] }));
58
+ }
59
+ // InputMobile Component
60
+ export function InputMobile(_a) {
61
+ var { label, className, id, error, disabled, placeholder, value, onChange, onClear } = _a, props = __rest(_a, ["label", "className", "id", "error", "disabled", "placeholder", "value", "onChange", "onClear"]);
62
+ const inputRef = useRef(null);
63
+ const [showError, setShowError] = useState(false);
64
+ const handleClear = () => {
65
+ if (inputRef.current) {
66
+ inputRef.current.value = "";
67
+ const event = new Event("input", { bubbles: true });
68
+ inputRef.current.dispatchEvent(event);
69
+ }
70
+ onClear === null || onClear === void 0 ? void 0 : onClear();
71
+ };
72
+ return (_jsxs(_Fragment, { children: [label && (_jsx("label", { htmlFor: id, className: "text-base font-medium text-Neutral-300 px-3 mb-1", children: label })), _jsxs("div", { className: "relative", children: [_jsx("input", Object.assign({ ref: inputRef, id: id, type: "tel", inputMode: "numeric", pattern: "^09[0-9]{9}$", maxLength: 11, placeholder: placeholder, disabled: disabled, value: value, onChange: onChange, onBlur: () => setShowError(false), onFocus: () => setShowError(false), className: cn("autofill-input peer placeholder-Neutral-200 w-full px-[2.7rem] py-3 rounded-2xl bg-secondary-50 dark:bg-background-light border border-secondary-100 focus:outline-none focus:ring-0 focus:border-secondary-400 justify-between items-center text-Neutral-500 dark:text-white relative", className) }, props)), !disabled && (_jsx("button", { type: "button", onClick: handleClear, className: "absolute inset-y-0 rtl:left-0 ltr:right-0 flex items-center p-2", children: _jsx(CloseSquareIcon, {}) })), _jsx("div", { className: "absolute inset-y-0 rtl:right-0 ltr:left-0 rtl:pr-3 ltr:pl-3 flex items-center pointer-events-none", children: _jsx(MobielIcon, {}) }), error && !showError && (_jsx("div", { className: "peer-focus:hidden absolute inset-x-0 mt-2 mx-3", children: _jsx("div", { className: "text-Error-400 text-xs font-medium", children: translate(error) }) })), _jsx("div", { className: "hidden peer-invalid:flex absolute mt-2 mx-3", children: _jsx("div", { className: "text-Error-400 text-xs font-medium", children: translate("error_invalid_mobile") }) })] })] }));
73
+ }
74
+ // InputTextArea Component
75
+ export function InputTextArea(_a) {
76
+ var { label, className, id, value, onChange } = _a, props = __rest(_a, ["label", "className", "id", "value", "onChange"]);
77
+ return (_jsxs("div", { className: "flex flex-col", children: [label && (_jsx("label", { htmlFor: id, className: "text-Neutral-300 text-[10px] font-medium px-3 mb-1", children: label })), _jsx("textarea", Object.assign({ id: id, value: value, onChange: onChange, className: cn("p-4 rounded-[20px] border-2 border-Neutral-50 focus:outline-none focus:ring-0 focus:border-secondary-400", className) }, props))] }));
78
+ }
79
+ // InputSearch Component
80
+ export function InputSearch(_a) {
81
+ var { className, id, inputSearchRef, classNameParent, searchClassname, param, value, onChange } = _a, props = __rest(_a, ["className", "id", "inputSearchRef", "classNameParent", "searchClassname", "param", "value", "onChange"]);
82
+ return (_jsxs("div", { ref: inputSearchRef, className: cn("relative", classNameParent), children: [_jsx("div", { className: "absolute rtl:right-3 ltr:left-3 h-full inline-flex items-center", children: _jsx(SearchIcon, { className: searchClassname }) }), param && (_jsx("div", { className: "absolute rtl:left-4 ltr:right-4 h-full inline-flex flex-row-reverse items-center", children: _jsx("span", { className: "text-Neutral-300 dark:text-Neutral-100 text-sm font-semibold leading-tight tracking-tight", children: param }) })), _jsx("input", Object.assign({ id: id, type: "text", value: value, onChange: onChange, className: cn(`autofill-input w-full bg-secondary-50 dark:bg-background-light text-Neutral-400 dark:text-Neutral-100 rounded-2xl ${param
83
+ ? "rtl:pr-11 rtl:pl-12 ltr:pl-11 ltr:pr-12"
84
+ : "rtl:pr-11 ltr:pl-11"} h-11 border-2 border-Neutral-50 dark:border-background-light focus-visible:outline focus-visible:outline-white`, className) }, props))] }));
85
+ }
86
+ // InputPassword Component
87
+ export function InputPassword(_a) {
88
+ var { label, className, id, variant = "password", error, buttonFirstId, buttonSecondId, value, onChange, onClear } = _a, props = __rest(_a, ["label", "className", "id", "variant", "error", "buttonFirstId", "buttonSecondId", "value", "onChange", "onClear"]);
89
+ const [showPassword, setShowPassword] = useState(false);
90
+ const inputRef = useRef(null);
91
+ const handleTogglePassword = () => {
92
+ setShowPassword(!showPassword);
93
+ };
94
+ const handleClear = () => {
95
+ if (inputRef.current) {
96
+ inputRef.current.value = "";
97
+ const event = new Event("input", { bubbles: true });
98
+ inputRef.current.dispatchEvent(event);
99
+ }
100
+ onClear === null || onClear === void 0 ? void 0 : onClear();
101
+ };
102
+ return (_jsxs(_Fragment, { children: [label && (_jsx("label", { htmlFor: id, className: "text-base font-medium text-Neutral-300 px-3", children: label })), _jsxs("div", { className: "w-full relative mt-1", children: [_jsx("input", Object.assign({ ref: inputRef, id: id, type: showPassword ? "text" : "password", minLength: 5, placeholder: "xxxx xxxx xxxx xxxx", value: value, onChange: onChange, className: cn("autofill-input peer placeholder-Neutral-200 w-full px-[2.7rem] py-3 rounded-2xl bg-secondary-50 dark:bg-background-light border border-secondary-100 focus:outline-none focus:ring-0 focus:border-secondary-400 justify-between items-center text-Neutral-500 dark:text-white relative", variant === "change_password" &&
103
+ "invalid:focus:border-Error-400 invalid:border-Error-400", className) }, props)), _jsx("div", { className: "absolute inset-y-0 rtl:right-0 ltr:left-0 rtl:pr-3 ltr:pl-3 flex items-center pointer-events-none", children: _jsx(LockIcon, {}) }), _jsx("div", { className: "absolute inset-y-0 rtl:left-0 ltr:right-0 px-3 flex items-center", children: variant === "password" ? (_jsx("button", { type: "button", onClick: handleClear, children: _jsx(CloseSquareIcon, {}) })) : (_jsx("button", { type: "button", onClick: handleTogglePassword, children: showPassword ? _jsx(HideIcon, {}) : _jsx(ShowIcon, {}) })) }), error && (_jsx("div", { className: "peer-focus:hidden absolute mt-2 mx-3", children: _jsx("div", { className: "text-Error-400 text-xs font-medium", children: translate(error) }) })), _jsx("div", { className: "hidden peer-invalid:flex absolute my-2 mx-3", children: _jsx("div", { className: "text-Error-400 text-xs font-medium", children: translate("error_min_length_password") }) })] })] }));
104
+ }
105
+ // InputRePassword Component
106
+ export function InputRePassword(_a) {
107
+ var { label, id, buttonId, passwordFieldId = "ch_password" } = _a, props = __rest(_a, ["label", "id", "buttonId", "passwordFieldId"]);
108
+ const [showPassword, setShowPassword] = useState(false);
109
+ const [error, setError] = useState("");
110
+ const [value, setValue] = useState("");
111
+ const handleTogglePassword = () => {
112
+ setShowPassword(!showPassword);
113
+ };
114
+ const handleChange = (e) => {
115
+ const newValue = e.target.value;
116
+ setValue(newValue);
117
+ const passwordField = document.getElementById(passwordFieldId);
118
+ if (passwordField && passwordField.value !== newValue) {
119
+ setError("error_re_password");
120
+ }
121
+ else {
122
+ setError("");
123
+ }
124
+ };
125
+ return (_jsxs(_Fragment, { children: [label && (_jsx("label", { htmlFor: id, className: "text-base font-medium text-Neutral-300 px-3", children: label })), _jsxs("div", { className: "w-full relative mt-1", children: [_jsx("input", Object.assign({ id: id, type: showPassword ? "text" : "password", placeholder: "xxxx xxxx xxxx xxxx", value: value, onChange: handleChange, className: cn("autofill-input placeholder-Neutral-200 w-full px-[2.7rem] py-3 rounded-2xl bg-secondary-50 dark:bg-background-light border border-secondary-100 focus:outline-none focus:ring-0 focus:border-secondary-400 justify-between items-center text-Neutral-500 dark:text-white relative", error && "!border-Error-400 !focus:border-Error-400") }, props)), _jsx("button", { type: "button", onClick: handleTogglePassword, className: "absolute inset-y-0 rtl:left-0 ltr:right-0 px-3 flex items-center cursor-pointer", children: showPassword ? _jsx(HideIcon, {}) : _jsx(ShowIcon, {}) }), _jsx("div", { className: "absolute inset-y-0 rtl:right-0 ltr:left-0 rtl:pr-3 ltr:pl-3 flex items-center pointer-events-none", children: _jsx(LockIcon, {}) }), error && (_jsx("div", { className: "absolute mt-2 mx-3", children: _jsx("div", { className: "text-Error-400 text-xs font-medium", children: translate(error) }) }))] })] }));
126
+ }
127
+ // InputDarkLight Component
128
+ export function InputDarkLight({ className }) {
129
+ const [isDark, setIsDark] = useState(() => {
130
+ return document.documentElement.classList.contains("dark");
131
+ });
132
+ const toggleTheme = () => {
133
+ const newTheme = !isDark;
134
+ setIsDark(newTheme);
135
+ if (newTheme) {
136
+ document.documentElement.classList.add("dark");
137
+ localStorage.setItem("theme", "dark");
138
+ }
139
+ else {
140
+ document.documentElement.classList.remove("dark");
141
+ localStorage.setItem("theme", "light");
142
+ }
143
+ const themeColorMeta = document.querySelector('meta[name="theme-color"]');
144
+ if (themeColorMeta) {
145
+ themeColorMeta.setAttribute("content", "#e57c43");
146
+ }
147
+ };
148
+ return (_jsxs("div", { className: "inline-flex items-center relative cursor-pointer", onClick: toggleTheme, children: [_jsx("input", { className: "peer hidden", id: "toggle", type: "checkbox", checked: !isDark, onChange: () => { } }), _jsx("div", { className: "relative w-[4rem] h-[2rem] peer-checked:bg-white bg-background rounded-full after:absolute after:content-[''] after:w-[1.5rem] after:h-[1.5rem] after:rounded-full after:top-[0.25rem] after:left-[0.25rem] after:bg-[linear-gradient(to_right,_#444350,_#444350)] peer-checked:after:bg-[linear-gradient(to_right,_#f97316,_#facc15)] active:after:w-[1.875rem] peer-checked:after:left-[3.75rem] peer-checked:after:translate-x-[-100%] shadow-sm duration-500 after:duration-500 after:shadow-md" }), _jsx(MoonIcon, { width: "1.25rem", height: "1.25rem", color: "white", className: "peer-checked:fill-black opacity-60 peer-checked:opacity-70 fill-white absolute w-4 h-4 left-[0.5rem]" }), _jsx(SunIcon, { width: "1.25rem", height: "1.25rem", color: "white", className: "fill-white peer-checked:opacity-60 absolute w-4 h-4 right-[0.5rem]" })] }));
149
+ }
150
+ // InputRadioButton Component
151
+ export function InputRadioButton(_a) {
152
+ var { className, id, index = 0, name, useIndex = true, onSortChange } = _a, props = __rest(_a, ["className", "id", "index", "name", "useIndex", "onSortChange"]);
153
+ const handleClick = () => {
154
+ if (useIndex && onSortChange) {
155
+ onSortChange(index);
156
+ }
157
+ };
158
+ return (_jsxs("div", { className: "relative", children: [_jsx("input", Object.assign({ type: "radio", id: `${id}_RadioDropDownItem_${index}`, name: `RadioInput${name}`, onClick: handleClick, className: cn("peer appearance-none absolute top-[-0.5rem] ltr:right-0 rtl:left-0 w-5 h-5 transition-all !bg-transparent dark:bg-transparent border-2 border-Neutral-300 rounded-sm cursor-pointer checked:!bg-primary-400 checked:!border-primary-400 focus:ring-0 focus:ring-offset-0 after:content-[''] after:absolute after:inset-0 after:bg-[url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwb2x5bGluZSBwb2ludHM9IjIwIDYgOSAxNyA0IDEyIj48L3BvbHlsaW5lPjwvc3ZnPg==')] after:bg-no-repeat after:bg-center after:opacity-0 checked:after:opacity-100 z-30", className) }, props)), _jsx("label", { htmlFor: `${id}_RadioDropDownItem_${index}`, className: "absolute top-[-1.15rem] ltr:right-[-0.525rem] rtl:left-[-0.625rem] rounded-full h-[2.5rem] w-[2.5rem] flex justify-center items-center peer-checked:bg-white dark:peer-checked:bg-background z-10" })] }));
159
+ }
160
+ // InputToggle Component
161
+ export function InputToggle(_a) {
162
+ var { className, checked = false, onStatusChange } = _a, props = __rest(_a, ["className", "checked", "onStatusChange"]);
163
+ const [isChecked, setIsChecked] = useState(() => {
164
+ return typeof checked === "string" ? checked === "true" : Boolean(checked);
165
+ });
166
+ useEffect(() => {
167
+ const newChecked = typeof checked === "string" ? checked === "true" : Boolean(checked);
168
+ setIsChecked(newChecked);
169
+ }, [checked]);
170
+ const handleToggle = (e) => {
171
+ const newValue = e.target.checked;
172
+ setIsChecked(newValue);
173
+ onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(newValue);
174
+ };
175
+ return (_jsxs("label", { className: cn("inline-flex items-center cursor-pointer", className), children: [_jsx("input", Object.assign({ type: "checkbox", className: "sr-only peer", checked: isChecked, onChange: handleToggle }, props)), _jsx("div", { className: "relative w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-2 peer-focus:ring-primary-300 dark:peer-focus:ring-primary-300 dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-primary-400 dark:peer-checked:bg-primary-400" })] }));
4
176
  }
@@ -0,0 +1,45 @@
1
+ import { InputHTMLAttributes, TextareaHTMLAttributes } from "react";
2
+ export type BaseInputProps = InputHTMLAttributes<HTMLInputElement> & {
3
+ label?: string;
4
+ error?: string;
5
+ };
6
+ export type InputTextProps = BaseInputProps & {
7
+ onClear?: () => void;
8
+ };
9
+ export type InputEmailProps = BaseInputProps & {
10
+ variant?: "auth" | "default";
11
+ onClear?: () => void;
12
+ };
13
+ export type InputMobileProps = BaseInputProps & {
14
+ onClear?: () => void;
15
+ };
16
+ export type InputPasswordProps = BaseInputProps & {
17
+ variant?: "password" | "change_password";
18
+ buttonFirstId?: string;
19
+ buttonSecondId?: string;
20
+ onClear?: () => void;
21
+ };
22
+ export type InputRePasswordProps = BaseInputProps & {
23
+ buttonId?: string;
24
+ passwordFieldId?: string;
25
+ };
26
+ export type InputTextAreaProps = TextareaHTMLAttributes<HTMLTextAreaElement> & {
27
+ label?: string;
28
+ };
29
+ export type InputSearchProps = BaseInputProps & {
30
+ inputSearchRef?: React.RefObject<HTMLDivElement>;
31
+ classNameParent?: string;
32
+ searchClassname?: string;
33
+ param?: string;
34
+ };
35
+ export type InputRadioButtonProps = InputHTMLAttributes<HTMLInputElement> & {
36
+ index?: number;
37
+ useIndex?: boolean;
38
+ onSortChange?: (index: number) => void;
39
+ };
40
+ export type InputToggleProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange'> & {
41
+ onStatusChange?: (value: boolean) => void;
42
+ };
43
+ export type InputDarkLightProps = {
44
+ className?: string;
45
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,9 @@
1
- import { ReactNode } from "react";
2
- type ModalProps = {
3
- isOpen: boolean;
4
- onClose: () => void;
5
- title?: string;
6
- children: ReactNode;
7
- };
8
- export default function Modal({ isOpen, onClose, title, children }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
9
- export {};
1
+ import React, { HTMLAttributes } from "react";
2
+ interface ModalProps extends HTMLAttributes<HTMLDivElement> {
3
+ children: React.ReactNode;
4
+ action?: (id?: string) => void;
5
+ className?: string;
6
+ id?: string;
7
+ }
8
+ declare const Modal: React.FC<ModalProps>;
9
+ export default Modal;
@@ -1,7 +1,52 @@
1
- "use client";
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
+ };
2
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- export default function Modal({ isOpen, onClose, title, children }) {
4
- if (!isOpen)
5
- return null;
6
- return (_jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", onClick: onClose, children: _jsxs("div", { className: "bg-white rounded-lg shadow-lg max-w-lg w-full p-6 relative", onClick: (e) => e.stopPropagation(), children: [title && _jsx("h2", { className: "text-xl font-bold mb-4", children: title }), _jsx("div", { children: children }), _jsx("button", { onClick: onClose, className: "absolute top-2 right-2 text-gray-500 hover:text-gray-800 transition-colors", children: "\u2715" })] }) }));
7
- }
13
+ /*
14
+ * @Author: Mohammad Felfelani
15
+ * @Email: mfelfelani72@gmail.com
16
+ * @Team:
17
+ * @Date: 2025-10-26 15:32:12
18
+ * @Description:
19
+ */
20
+ import { useEffect } from "react";
21
+ // Components
22
+ import { CloseSquareIcon } from "../icon/icon";
23
+ // Functions
24
+ import { cn } from "../../libs/cn";
25
+ import { CloseModal } from "@/libs/modal/Modal";
26
+ const Modal = (_a) => {
27
+ var { children, action, className, id } = _a, props = __rest(_a, ["children", "action", "className", "id"]);
28
+ // functions
29
+ useEffect(() => {
30
+ const handleKeyDown = (event) => {
31
+ if (event.key === "Escape" && id) {
32
+ CloseModal(id);
33
+ }
34
+ };
35
+ window.addEventListener("keydown", handleKeyDown);
36
+ return () => {
37
+ window.removeEventListener("keydown", handleKeyDown);
38
+ };
39
+ }, [id]);
40
+ const handleOverlayClick = () => {
41
+ if (action && id) {
42
+ action(id);
43
+ }
44
+ };
45
+ const handleCloseClick = () => {
46
+ if (id) {
47
+ CloseModal(id);
48
+ }
49
+ };
50
+ return (_jsxs("div", Object.assign({}, props, { id: id, className: "hidden fixed inset-0 items-center justify-center z-[999] p-4", children: [_jsx("div", { onClick: handleOverlayClick, className: "absolute inset-0 bg-black opacity-30" }), _jsx("div", { className: cn("relative max-w-2xl w-full max-h-[90vh] overflow-auto bg-white dark:bg-background-light rounded-2xl shadow-xl", className), children: _jsxs("div", { className: "p-4", children: [_jsx("div", { onClick: handleCloseClick, className: "w-full flex justify-end cursor-pointer", children: _jsx(CloseSquareIcon, { className: "mt-4 mx-4" }) }), children] }) })] })));
51
+ };
52
+ export default Modal;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @Author: Mohammad Felfelani
3
+ * @Email: mfelfelani72@gmail.com
4
+ * @Team:
5
+ * @Date: 2025-10-26 09:29:58
6
+ * @Description:
7
+ */
8
+ /**
9
+ * @Author: Mohammad Felfelani
10
+ * @Email: mfelfelani72@gmail.com
11
+ * @Team:
12
+ * @Date: 2025-10-04 07:17:02
13
+ * @Description:
14
+ */
15
+ export declare const languages: {
16
+ readonly en: {
17
+ readonly dir: "ltr";
18
+ readonly locale: "en_US";
19
+ readonly schemaLocale: "en-US";
20
+ readonly name: "English";
21
+ readonly flag: "🇺🇸";
22
+ readonly nativeName: "English";
23
+ };
24
+ readonly fa: {
25
+ readonly dir: "rtl";
26
+ readonly locale: "fa_IR";
27
+ readonly schemaLocale: "fa-IR";
28
+ readonly name: "Persian";
29
+ readonly flag: "🇮🇷";
30
+ readonly nativeName: "فارسی";
31
+ };
32
+ };
33
+ export type Lang = keyof typeof languages;
34
+ export declare function getLocale(lang: Lang): string;
35
+ export declare function getSchemaLocale(lang: Lang): string;
36
+ export declare function getDirection(lang: Lang): "ltr" | "rtl";
37
+ export declare function getName(lang: Lang): string;
38
+ export declare function getNativeName(lang: Lang): string;
39
+ export declare function getFlag(lang: Lang): string;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @Author: Mohammad Felfelani
3
+ * @Email: mfelfelani72@gmail.com
4
+ * @Team:
5
+ * @Date: 2025-10-26 09:29:58
6
+ * @Description:
7
+ */
8
+ /**
9
+ * @Author: Mohammad Felfelani
10
+ * @Email: mfelfelani72@gmail.com
11
+ * @Team:
12
+ * @Date: 2025-10-04 07:17:02
13
+ * @Description:
14
+ */
15
+ export const languages = {
16
+ en: {
17
+ dir: "ltr",
18
+ locale: "en_US",
19
+ schemaLocale: "en-US",
20
+ name: "English",
21
+ flag: "🇺🇸",
22
+ nativeName: "English",
23
+ },
24
+ fa: {
25
+ dir: "rtl",
26
+ locale: "fa_IR",
27
+ schemaLocale: "fa-IR",
28
+ name: "Persian",
29
+ flag: "🇮🇷",
30
+ nativeName: "فارسی",
31
+ },
32
+ };
33
+ export function getLocale(lang) {
34
+ return languages[lang].locale;
35
+ }
36
+ export function getSchemaLocale(lang) {
37
+ return languages[lang].schemaLocale;
38
+ }
39
+ export function getDirection(lang) {
40
+ return languages[lang].dir;
41
+ }
42
+ export function getName(lang) {
43
+ return languages[lang].name;
44
+ }
45
+ export function getNativeName(lang) {
46
+ return languages[lang].nativeName;
47
+ }
48
+ export function getFlag(lang) {
49
+ return languages[lang].flag;
50
+ }
@@ -0,0 +1,69 @@
1
+ import type { Metadata } from "next";
2
+ import type { Lang } from "@/configs/language";
3
+ import { PageMeta } from "@/Interfaces/meta";
4
+ export declare function generatePageMetadata(lang?: Lang, pageKey?: string, customMeta?: Partial<PageMeta>): Promise<Metadata>;
5
+ export declare function generateWebsiteSchema(lang: Lang): {
6
+ "@context": string;
7
+ "@type": string;
8
+ name: string;
9
+ url: string;
10
+ inLanguage: string;
11
+ potentialAction: {
12
+ "@type": string;
13
+ target: string;
14
+ "query-input": string;
15
+ };
16
+ };
17
+ export declare function generateOrganizationSchema(lang: Lang): {
18
+ "@context": string;
19
+ "@type": string;
20
+ name: string;
21
+ url: string;
22
+ logo: string;
23
+ inLanguage: string;
24
+ sameAs: string[];
25
+ };
26
+ export declare function generateArticleSchema(lang: Lang, article: {
27
+ title: string;
28
+ description: string;
29
+ image: string;
30
+ datePublished: string;
31
+ dateModified: string;
32
+ authorName: string;
33
+ authorUrl?: string;
34
+ }): {
35
+ "@context": string;
36
+ "@type": string;
37
+ headline: string;
38
+ description: string;
39
+ image: string;
40
+ datePublished: string;
41
+ dateModified: string;
42
+ author: {
43
+ url?: string | undefined;
44
+ "@type": string;
45
+ name: string;
46
+ };
47
+ publisher: {
48
+ "@type": string;
49
+ name: string;
50
+ logo: {
51
+ "@type": string;
52
+ url: string;
53
+ };
54
+ };
55
+ inLanguage: string;
56
+ };
57
+ export declare function generateBreadcrumbSchema(items: {
58
+ name: string;
59
+ url: string;
60
+ }[]): {
61
+ "@context": string;
62
+ "@type": string;
63
+ itemListElement: {
64
+ "@type": string;
65
+ position: number;
66
+ name: string;
67
+ item: string;
68
+ }[];
69
+ };