forma-ui 0.0.6 → 0.0.8

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 (39) hide show
  1. package/package.json +10 -3
  2. package/README.md +0 -36
  3. package/dist/components/PostDetailPage.d.ts +0 -7
  4. package/dist/components/PostDetailPage.js +0 -47
  5. package/dist/components/PostPage.d.ts +0 -6
  6. package/dist/components/PostPage.js +0 -48
  7. package/dist/components/icon/icon.d.ts +0 -116
  8. package/dist/components/icon/icon.js +0 -450
  9. package/dist/components/ui/Accordion.d.ts +0 -16
  10. package/dist/components/ui/Accordion.js +0 -32
  11. package/dist/components/ui/Button.d.ts +0 -12
  12. package/dist/components/ui/Button.js +0 -48
  13. package/dist/components/ui/CheckBox.d.ts +0 -7
  14. package/dist/components/ui/CheckBox.js +0 -4
  15. package/dist/components/ui/Input.d.ts +0 -11
  16. package/dist/components/ui/Input.js +0 -173
  17. package/dist/components/ui/Input.types.d.ts +0 -45
  18. package/dist/components/ui/Input.types.js +0 -1
  19. package/dist/components/ui/Modal.d.ts +0 -9
  20. package/dist/components/ui/Modal.js +0 -7
  21. package/dist/components/ui/RadioButton.d.ts +0 -9
  22. package/dist/components/ui/RadioButton.js +0 -4
  23. package/dist/components/ui/Table.d.ts +0 -10
  24. package/dist/components/ui/Table.js +0 -4
  25. package/dist/components/ui/Tabs.d.ts +0 -10
  26. package/dist/components/ui/Tabs.js +0 -9
  27. package/dist/config/language.d.ts +0 -11
  28. package/dist/config/language.js +0 -6
  29. package/dist/dictionaries/en.json +0 -18
  30. package/dist/dictionaries/fa.json +0 -18
  31. package/dist/dictionaries/index.d.ts +0 -35
  32. package/dist/dictionaries/index.js +0 -10
  33. package/dist/index.d.ts +0 -2
  34. package/dist/index.js +0 -3
  35. package/dist/lib/utils.d.ts +0 -2
  36. package/dist/lib/utils.js +0 -6
  37. package/dist/store/appStore.d.ts +0 -8
  38. package/dist/store/appStore.js +0 -16
  39. package/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -1,16 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- export type AccordionProps = {
3
- parentClassName?: string;
4
- className?: string;
5
- circleLocation?: string;
6
- secoundCircleLocation?: string;
7
- children: ReactNode;
8
- icon?: ReactNode;
9
- title: string;
10
- title_classname?: string;
11
- open?: boolean;
12
- sliding?: boolean;
13
- animation?: "scale" | "fade" | "slide" | "bounce";
14
- };
15
- declare const Accordion: React.FC<AccordionProps>;
16
- export default Accordion;
@@ -1,32 +0,0 @@
1
- "use client";
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);
7
- const toggleOpen = () => {
8
- if (sliding)
9
- setIsOpen(!isOpen);
10
- };
11
- const getAnimationClasses = () => {
12
- switch (animation) {
13
- case "scale":
14
- return isOpen
15
- ? "max-h-screen scale-100 opacity-100"
16
- : "max-h-0 scale-95 opacity-0";
17
- case "fade":
18
- return isOpen ? "max-h-screen opacity-100" : "max-h-0 opacity-0";
19
- case "bounce":
20
- return isOpen
21
- ? "max-h-screen opacity-100 animate-bounce"
22
- : "max-h-0 opacity-0";
23
- case "slide":
24
- default:
25
- return isOpen
26
- ? "max-h-screen translate-y-0 opacity-100"
27
- : "max-h-0 -translate-y-2 opacity-0";
28
- }
29
- };
30
- return (_jsxs("div", { className: cn("relative overflow-hidden rounded-2xl", parentClassName), children: [_jsx("div", { className: cn("flex flex-row w-full items-start justify-between bg-white dark:bg-background-light border border-Neutral-100 dark:border-Neutral-400/50 rounded-2xl", className), children: _jsxs("div", { className: "flex flex-col w-full", children: [_jsxs("div", { onClick: toggleOpen, className: cn("p-4 flex flex-row justify-between items-center", sliding && "cursor-pointer"), children: [_jsxs("div", { className: "flex flex-row gap-2 items-center", children: [icon && (_jsx("span", { className: "bg-secondary-50 dark:bg-background-light rounded-full p-2", children: icon })), _jsx("div", { className: cn("text-Neutral-500 dark:text-white text-base font-medium inline-flex select-none", title_classname), children: title })] }), sliding && (_jsx("svg", { className: cn("w-4 h-4 transition-transform duration-300 text-gray-600", isOpen ? "rotate-180" : "rotate-90"), fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }))] }), _jsx("div", { className: cn("overflow-hidden transition-all duration-300 ease-in-out", getAnimationClasses()), children: _jsx("div", { className: "p-4", children: children }) })] }) }), circleLocation && isOpen && (_jsx("div", { className: "w-full", children: _jsx("div", { className: cn("absolute transition-all duration-700 ease-in-out w-40 h-40 opacity-50 bg-violet-300/30 rounded-full blur-2xl pointer-events-none", circleLocation) }) })), secoundCircleLocation && isOpen && (_jsx("div", { className: "w-full", children: _jsx("div", { className: cn("absolute transition-all duration-700 ease-in-out w-40 h-40 opacity-50 bg-violet-300/30 rounded-full blur-2xl pointer-events-none", secoundCircleLocation) }) }))] }));
31
- };
32
- export default Accordion;
@@ -1,12 +0,0 @@
1
- import { ButtonHTMLAttributes } from "react";
2
- interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
3
- variant?: "primary" | "secondary" | "outline" | "danger" | "success" | "warning" | "icon";
4
- size?: "sm" | "md" | "lg" | "xl";
5
- loading?: boolean;
6
- icon?: React.ReactNode;
7
- iconPosition?: "left" | "right";
8
- fullWidth?: boolean;
9
- clickAnimation?: "none" | "scale" | "bounce" | "pulse" | "press";
10
- }
11
- declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
12
- export default Button;
@@ -1,48 +0,0 @@
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
- // components/ui/Button.tsx
14
- import { forwardRef } from "react";
15
- import { cn } from "../../lib/utils";
16
- const Button = forwardRef((_a, ref) => {
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
- const isDisabled = disabled || loading;
19
- // Variant styles
20
- const variantStyles = {
21
- primary: "bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800 focus:ring-blue-500",
22
- secondary: "bg-gray-600 text-white hover:bg-gray-700 active:bg-gray-800 focus:ring-gray-500",
23
- outline: "border border-gray-300 bg-transparent hover:bg-gray-50 text-gray-700 focus:ring-blue-500",
24
- danger: "bg-red-600 text-white hover:bg-red-700 active:bg-red-800 focus:ring-red-500",
25
- success: "bg-green-600 text-white hover:bg-green-700 active:bg-green-800 focus:ring-green-500",
26
- warning: "bg-yellow-500 text-white hover:bg-yellow-600 active:bg-yellow-700 focus:ring-yellow-500",
27
- icon: "bg-transparent hover:bg-gray-100 text-gray-600 focus:ring-gray-500",
28
- };
29
- // Size styles
30
- const sizeStyles = {
31
- sm: "h-8 px-3 text-xs",
32
- md: "h-10 px-4 py-2",
33
- lg: "h-12 px-6 text-lg",
34
- xl: "h-14 px-8 text-xl",
35
- };
36
- // Click animation styles
37
- const animationStyles = {
38
- none: "",
39
- scale: "active:scale-95 transition-transform duration-150",
40
- bounce: "active:scale-110 transition-transform duration-150",
41
- pulse: "active:animate-pulse transition-all duration-150",
42
- press: "active:translate-y-1 transition-transform duration-150",
43
- };
44
- const baseStyles = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50";
45
- return (_jsxs("button", Object.assign({ className: cn(baseStyles, variantStyles[variant], sizeStyles[size], animationStyles[clickAnimation], fullWidth && "w-full", loading && "cursor-wait", className), disabled: isDisabled, ref: ref }, props, { children: [loading && (_jsxs("svg", { className: "mr-2 h-4 w-4 animate-spin", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] })), !loading && icon && iconPosition === "left" && (_jsx("span", { className: "mr-2", children: icon })), children, !loading && icon && iconPosition === "right" && (_jsx("span", { className: "ml-2", children: icon }))] })));
46
- });
47
- Button.displayName = "Button";
48
- export default Button;
@@ -1,7 +0,0 @@
1
- type CheckboxProps = {
2
- label: string;
3
- checked?: boolean;
4
- onChange?: (checked: boolean) => void;
5
- };
6
- export default function Checkbox({ label, checked, onChange }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export default function Checkbox({ label, checked, onChange }) {
3
- return (_jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [_jsx("input", { type: "checkbox", checked: checked, onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked), className: "w-4 h-4 accent-blue-600 rounded" }), _jsx("span", { children: label })] }));
4
- }
@@ -1,11 +0,0 @@
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,173 +0,0 @@
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 "@/lib/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 ? "rtl:pr-11 rtl:pl-12 ltr:pl-11 ltr:pr-12" : "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))] }));
83
- }
84
- // InputPassword Component
85
- export function InputPassword(_a) {
86
- 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"]);
87
- const [showPassword, setShowPassword] = useState(false);
88
- const inputRef = useRef(null);
89
- const handleTogglePassword = () => {
90
- setShowPassword(!showPassword);
91
- };
92
- const handleClear = () => {
93
- if (inputRef.current) {
94
- inputRef.current.value = "";
95
- const event = new Event('input', { bubbles: true });
96
- inputRef.current.dispatchEvent(event);
97
- }
98
- onClear === null || onClear === void 0 ? void 0 : onClear();
99
- };
100
- 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" && "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") }) })] })] }));
101
- }
102
- // InputRePassword Component
103
- export function InputRePassword(_a) {
104
- var { label, id, buttonId, passwordFieldId = "ch_password" } = _a, props = __rest(_a, ["label", "id", "buttonId", "passwordFieldId"]);
105
- const [showPassword, setShowPassword] = useState(false);
106
- const [error, setError] = useState("");
107
- const [value, setValue] = useState("");
108
- const handleTogglePassword = () => {
109
- setShowPassword(!showPassword);
110
- };
111
- const handleChange = (e) => {
112
- const newValue = e.target.value;
113
- setValue(newValue);
114
- const passwordField = document.getElementById(passwordFieldId);
115
- if (passwordField && passwordField.value !== newValue) {
116
- setError("error_re_password");
117
- }
118
- else {
119
- setError("");
120
- }
121
- };
122
- 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) }) }))] })] }));
123
- }
124
- // InputDarkLight Component
125
- export function InputDarkLight({ className }) {
126
- const [isDark, setIsDark] = useState(() => {
127
- return document.documentElement.classList.contains("dark");
128
- });
129
- const toggleTheme = () => {
130
- const newTheme = !isDark;
131
- setIsDark(newTheme);
132
- if (newTheme) {
133
- document.documentElement.classList.add("dark");
134
- localStorage.setItem("theme", "dark");
135
- }
136
- else {
137
- document.documentElement.classList.remove("dark");
138
- localStorage.setItem("theme", "light");
139
- }
140
- const themeColorMeta = document.querySelector('meta[name="theme-color"]');
141
- if (themeColorMeta) {
142
- themeColorMeta.setAttribute("content", "#e57c43");
143
- }
144
- };
145
- 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]" })] }));
146
- }
147
- // InputRadioButton Component
148
- export function InputRadioButton(_a) {
149
- var { className, id, index = 0, name, useIndex = true, onSortChange } = _a, props = __rest(_a, ["className", "id", "index", "name", "useIndex", "onSortChange"]);
150
- const handleClick = () => {
151
- if (useIndex && onSortChange) {
152
- onSortChange(index);
153
- }
154
- };
155
- 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" })] }));
156
- }
157
- // InputToggle Component
158
- export function InputToggle(_a) {
159
- var { className, checked = false, onStatusChange } = _a, props = __rest(_a, ["className", "checked", "onStatusChange"]);
160
- const [isChecked, setIsChecked] = useState(() => {
161
- return typeof checked === "string" ? checked === "true" : Boolean(checked);
162
- });
163
- useEffect(() => {
164
- const newChecked = typeof checked === "string" ? checked === "true" : Boolean(checked);
165
- setIsChecked(newChecked);
166
- }, [checked]);
167
- const handleToggle = (e) => {
168
- const newValue = e.target.checked;
169
- setIsChecked(newValue);
170
- onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(newValue);
171
- };
172
- 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" })] }));
173
- }
@@ -1,45 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
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,7 +0,0 @@
1
- "use client";
2
- 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
- }
@@ -1,9 +0,0 @@
1
- type RadioProps = {
2
- label: string;
3
- name: string;
4
- value: string;
5
- checked?: boolean;
6
- onChange?: (value: string) => void;
7
- };
8
- export default function RadioButton({ label, name, value, checked, onChange, }: RadioProps): import("react/jsx-runtime").JSX.Element;
9
- export {};
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export default function RadioButton({ label, name, value, checked, onChange, }) {
3
- return (_jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [_jsx("input", { type: "radio", name: name, value: value, checked: checked, onChange: () => onChange === null || onChange === void 0 ? void 0 : onChange(value), className: "hidden peer" }), _jsx("span", { className: "w-4 h-4 rounded-full border border-gray-500 flex items-center justify-center peer-checked:border-blue-600", children: _jsx("span", { className: "w-2 h-2 bg-blue-600 rounded-full peer-checked:block hidden" }) }), _jsx("span", { children: label })] }));
4
- }
@@ -1,10 +0,0 @@
1
- type Column<T> = {
2
- header: string;
3
- accessor: keyof T;
4
- };
5
- type TableProps<T> = {
6
- columns: Column<T>[];
7
- data: T[];
8
- };
9
- export default function Table<T>({ columns, data }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
10
- export {};
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export default function Table({ columns, data }) {
3
- return (_jsx("div", { className: "overflow-x-auto rounded-lg shadow border border-gray-200", children: _jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [_jsx("thead", { className: "bg-gray-100", children: _jsx("tr", { children: columns.map((col, idx) => (_jsx("th", { className: "px-4 py-2 text-left text-gray-700 font-medium", children: col.header }, idx))) }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: data.map((row, idx) => (_jsx("tr", { className: "hover:bg-gray-50 transition-colors", children: columns.map((col, cidx) => (_jsx("td", { className: "px-4 py-2 text-gray-800", children: row[col.accessor] }, cidx))) }, idx))) })] }) }));
4
- }
@@ -1,10 +0,0 @@
1
- import { ReactNode } from "react";
2
- type Tab = {
3
- label: string;
4
- content: ReactNode;
5
- };
6
- type TabsProps = {
7
- tabs: Tab[];
8
- };
9
- export default function Tabs({ tabs }: TabsProps): import("react/jsx-runtime").JSX.Element;
10
- export {};
@@ -1,9 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- export default function Tabs({ tabs }) {
5
- const [activeIndex, setActiveIndex] = useState(0);
6
- return (_jsxs("div", { className: "w-full", children: [_jsx("div", { className: "flex border-b border-gray-300", children: tabs.map((tab, index) => (_jsx("button", { onClick: () => setActiveIndex(index), className: `px-4 py-2 -mb-px font-medium transition-colors duration-200 ${activeIndex === index
7
- ? "border-b-2 border-blue-600 text-blue-600"
8
- : "text-gray-600 hover:text-blue-600"}`, children: tab.label }, index))) }), _jsx("div", { className: "p-4 bg-gray-50 rounded-b-lg", children: tabs[activeIndex].content })] }));
9
- }
@@ -1,11 +0,0 @@
1
- export declare const languages: {
2
- readonly en: {
3
- readonly dir: "ltr";
4
- readonly name: "English";
5
- };
6
- readonly fa: {
7
- readonly dir: "rtl";
8
- readonly name: "فارسی";
9
- };
10
- };
11
- export type Lang = keyof typeof languages;
@@ -1,6 +0,0 @@
1
- // src/config/language.ts
2
- export const languages = {
3
- en: { dir: "ltr", name: "English" },
4
- fa: { dir: "rtl", name: "فارسی" },
5
- // زبان‌های دیگر اضافه کنید
6
- };
@@ -1,18 +0,0 @@
1
- {
2
- "home": {
3
- "title": "Welcome to Blog",
4
- "description": "This is the English home page."
5
- },
6
- "about": {
7
- "title": "About Us",
8
- "content": "This is about page in English."
9
- },
10
- "posts": {
11
- "title": "Blog Posts",
12
- "description": "Here are all the posts."
13
- },
14
- "postDetail": {
15
- "title": "Post Detail",
16
- "content": "This is the detail of post {id}."
17
- }
18
- }
@@ -1,18 +0,0 @@
1
- {
2
- "home": {
3
- "title": "به وبلاگ خوش آمدید",
4
- "description": "این صفحه اصلی فارسی است."
5
- },
6
- "about": {
7
- "title": "درباره ما",
8
- "content": "این صفحه درباره ما به فارسی است."
9
- },
10
- "posts": {
11
- "title": "پست‌های وبلاگ",
12
- "description": "اینجا همه پست‌ها را می‌بینید."
13
- },
14
- "postDetail": {
15
- "title": "جزئیات پست",
16
- "content": "این جزئیات پست {id} است."
17
- }
18
- }
@@ -1,35 +0,0 @@
1
- export declare function getDictionary(lang: "en" | "fa"): Promise<{
2
- home: {
3
- title: string;
4
- description: string;
5
- };
6
- about: {
7
- title: string;
8
- content: string;
9
- };
10
- posts: {
11
- title: string;
12
- description: string;
13
- };
14
- postDetail: {
15
- title: string;
16
- content: string;
17
- };
18
- } | {
19
- home: {
20
- title: string;
21
- description: string;
22
- };
23
- about: {
24
- title: string;
25
- content: string;
26
- };
27
- posts: {
28
- title: string;
29
- description: string;
30
- };
31
- postDetail: {
32
- title: string;
33
- content: string;
34
- };
35
- }>;
@@ -1,10 +0,0 @@
1
- import en from "./en.json";
2
- import fa from "./fa.json";
3
- const dictionaries = {
4
- en,
5
- fa,
6
- };
7
- export async function getDictionary(lang) {
8
- var _a;
9
- return (_a = dictionaries[lang]) !== null && _a !== void 0 ? _a : dictionaries["fa"];
10
- }
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./components/icon/icon";
2
- export { default as Button } from "./components/ui/Button";
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- export * from "./components/icon/icon";
2
- // Optional: you can add non-icon exports here
3
- export { default as Button } from "./components/ui/Button";
@@ -1,2 +0,0 @@
1
- import { type ClassValue } from "clsx";
2
- export declare function cn(...inputs: ClassValue[]): string;
package/dist/lib/utils.js DELETED
@@ -1,6 +0,0 @@
1
- // lib/utils.ts
2
- import { clsx } from "clsx";
3
- import { twMerge } from "tailwind-merge";
4
- export function cn(...inputs) {
5
- return twMerge(clsx(inputs));
6
- }
@@ -1,8 +0,0 @@
1
- import { Lang } from "../config/language";
2
- interface AppState {
3
- lang: Lang;
4
- dir: "ltr" | "rtl";
5
- setLang: (lang: Lang) => void;
6
- }
7
- export declare const useAppStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AppState>>;
8
- export {};
@@ -1,16 +0,0 @@
1
- import { create } from "zustand";
2
- import { languages } from "../config/language";
3
- function getInitialLang() {
4
- if (typeof window === "undefined")
5
- return "en";
6
- const firstSegment = window.location.pathname.split("/")[1];
7
- return firstSegment && firstSegment in languages
8
- ? firstSegment
9
- : "en";
10
- }
11
- const initialLang = getInitialLang();
12
- export const useAppStore = create((set) => ({
13
- lang: initialLang,
14
- dir: languages[initialLang].dir,
15
- setLang: (lang) => set({ lang, dir: languages[lang].dir }),
16
- }));