forma-ui 0.0.24 → 0.0.26

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 (111) hide show
  1. package/dist/Interfaces/dictionary.d.ts +0 -0
  2. package/dist/Interfaces/dictionary.js +0 -0
  3. package/dist/Interfaces/global.d.ts +0 -0
  4. package/dist/Interfaces/global.js +0 -0
  5. package/dist/Interfaces/meta.d.ts +0 -0
  6. package/dist/Interfaces/meta.js +0 -0
  7. package/dist/app/[lang]/stores/LangStore.d.ts +0 -0
  8. package/dist/app/[lang]/stores/LangStore.js +0 -0
  9. package/dist/components/icon/icon.d.ts +0 -0
  10. package/dist/components/icon/icon.js +0 -0
  11. package/dist/components/ui/Accordion.d.ts +0 -0
  12. package/dist/components/ui/Accordion.js +0 -0
  13. package/dist/components/ui/Button.d.ts +0 -0
  14. package/dist/components/ui/Button.js +0 -0
  15. package/dist/components/ui/CheckBox.d.ts +0 -0
  16. package/dist/components/ui/CheckBox.js +0 -0
  17. package/dist/components/ui/Drawer.d.ts +0 -0
  18. package/dist/components/ui/Drawer.js +0 -0
  19. package/dist/components/ui/Input.d.ts +2 -1
  20. package/dist/components/ui/Input.js +117 -13
  21. package/dist/components/ui/Input.types.d.ts +69 -0
  22. package/dist/components/ui/Input.types.js +0 -0
  23. package/dist/components/ui/InputMobileInternational.d.ts +1 -0
  24. package/dist/components/ui/InputMobileInternational.js +9 -0
  25. package/dist/components/ui/Modal.d.ts +0 -0
  26. package/dist/components/ui/Modal.js +0 -0
  27. package/dist/components/ui/Overlay.d.ts +0 -0
  28. package/dist/components/ui/Overlay.js +0 -0
  29. package/dist/components/ui/RadioButton.d.ts +0 -0
  30. package/dist/components/ui/RadioButton.js +0 -0
  31. package/dist/components/ui/Table.d.ts +0 -0
  32. package/dist/components/ui/Table.js +0 -0
  33. package/dist/components/ui/Tabs.d.ts +0 -0
  34. package/dist/components/ui/Tabs.js +0 -0
  35. package/dist/components/ui/ghostBox/Body.d.ts +7 -0
  36. package/dist/components/ui/ghostBox/Body.js +7 -0
  37. package/dist/components/ui/ghostBox/GhostBox.d.ts +25 -0
  38. package/dist/components/ui/ghostBox/GhostBox.js +95 -0
  39. package/dist/components/ui/ghostBox/Trigger.d.ts +7 -0
  40. package/dist/components/ui/ghostBox/Trigger.js +21 -0
  41. package/dist/configs/language.d.ts +0 -0
  42. package/dist/configs/language.js +0 -0
  43. package/dist/configs/metadata.d.ts +0 -0
  44. package/dist/configs/metadata.js +0 -0
  45. package/dist/dictionaries/en.json +0 -0
  46. package/dist/dictionaries/fa.json +0 -0
  47. package/dist/dictionaries/index.d.ts +0 -0
  48. package/dist/dictionaries/index.js +0 -0
  49. package/dist/hooks/useDevice.d.ts +0 -0
  50. package/dist/hooks/useDevice.js +0 -0
  51. package/dist/hooks/useTranslation.d.ts +0 -0
  52. package/dist/hooks/useTranslation.js +0 -0
  53. package/dist/index.d.ts +2 -0
  54. package/dist/index.js +1 -0
  55. package/dist/libs/api/axiosClient.d.ts +0 -0
  56. package/dist/libs/api/axiosClient.js +0 -0
  57. package/dist/libs/api/cns.d.ts +0 -0
  58. package/dist/libs/api/cns.js +0 -0
  59. package/dist/libs/api/usePostFetch.d.ts +0 -0
  60. package/dist/libs/api/usePostFetch.js +0 -0
  61. package/dist/libs/cn.d.ts +0 -0
  62. package/dist/libs/cn.js +0 -0
  63. package/dist/libs/cookieUtils.d.ts +0 -0
  64. package/dist/libs/cookieUtils.js +0 -0
  65. package/dist/libs/detectComponentResponsive.d.ts +0 -0
  66. package/dist/libs/detectComponentResponsive.js +0 -0
  67. package/dist/libs/detectDeviceFromUA.d.ts +0 -0
  68. package/dist/libs/detectDeviceFromUA.js +0 -0
  69. package/dist/libs/drawer/modal.d.ts +0 -0
  70. package/dist/libs/drawer/modal.js +0 -0
  71. package/dist/libs/fonts.d.ts +0 -0
  72. package/dist/libs/fonts.js +0 -0
  73. package/dist/libs/metadataHelper.d.ts +0 -0
  74. package/dist/libs/metadataHelper.js +0 -0
  75. package/dist/libs/modal/modal.d.ts +0 -0
  76. package/dist/libs/modal/modal.js +0 -0
  77. package/dist/libs/translation.d.ts +0 -0
  78. package/dist/libs/translation.js +0 -0
  79. package/dist/libs/utils.d.ts +0 -0
  80. package/dist/libs/utils.js +0 -0
  81. package/dist/locale/de.d.ts +0 -0
  82. package/dist/locale/de.js +0 -0
  83. package/dist/locale/en.d.ts +0 -0
  84. package/dist/locale/en.js +0 -0
  85. package/dist/locale/fa.d.ts +0 -0
  86. package/dist/locale/fa.js +0 -0
  87. package/dist/locale/global/de.json +0 -0
  88. package/dist/locale/global/en.json +0 -0
  89. package/dist/locale/global/fa.json +0 -0
  90. package/dist/locale/home/de.json +0 -0
  91. package/dist/locale/home/en.json +0 -0
  92. package/dist/locale/home/fa.json +0 -0
  93. package/dist/locale/index.d.ts +0 -0
  94. package/dist/locale/index.js +0 -0
  95. package/dist/locale/meta/de.json +0 -0
  96. package/dist/locale/meta/en.json +0 -0
  97. package/dist/locale/meta/fa.json +0 -0
  98. package/dist/locale/meta/home/de.json +0 -0
  99. package/dist/locale/meta/home/en.json +0 -0
  100. package/dist/locale/meta/home/fa.json +0 -0
  101. package/dist/locale/meta/tools/de.json +0 -0
  102. package/dist/locale/meta/tools/en.json +0 -0
  103. package/dist/locale/meta/tools/fa.json +0 -0
  104. package/dist/middleware.d.ts +0 -0
  105. package/dist/middleware.js +0 -0
  106. package/dist/store/appStore.d.ts +0 -0
  107. package/dist/store/appStore.js +0 -0
  108. package/dist/tsconfig.build.tsbuildinfo +1 -1
  109. package/dist/utils/nextImageLoader.d.ts +0 -0
  110. package/dist/utils/nextImageLoader.js +0 -0
  111. package/package.json +2 -1
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { InputTextProps, InputTextAreaProps, InputSearchProps, InputRadioButtonProps, InputToggleProps, InputDarkLightProps } from "./Input.types";
2
+ import type { InputTextProps, InputTextAreaProps, InputSearchProps, InputRadioButtonProps, InputToggleProps, InputDarkLightProps, InputMobileIntlProps } from "./Input.types";
3
3
  export declare function InputText({ label, className, id, disabled, value, onChange, onClear, ...props }: InputTextProps): import("react/jsx-runtime").JSX.Element;
4
4
  export declare const InputEmail: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & {
5
5
  label?: string;
@@ -16,6 +16,7 @@ export declare const InputMobile: React.ForwardRefExoticComponent<React.InputHTM
16
16
  } & {
17
17
  onClear?: () => void;
18
18
  } & React.RefAttributes<HTMLInputElement>>;
19
+ export declare const InputMobileIntl: React.ForwardRefExoticComponent<Omit<InputMobileIntlProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
19
20
  export declare function InputTextArea({ label, className, id, value, onChange, ...props }: InputTextAreaProps): import("react/jsx-runtime").JSX.Element;
20
21
  export declare function InputSearch({ className, id, inputSearchRef, classNameParent, searchClassname, param, value, onChange, ...props }: InputSearchProps): import("react/jsx-runtime").JSX.Element;
21
22
  export declare const InputPassword: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & {
@@ -13,16 +13,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
13
13
  import { useState, useRef, useEffect, forwardRef } from "react";
14
14
  import { CloseSquareIcon, EmailIcon, MobielIcon, SunIcon, HideIcon, LockIcon, SearchIcon, ShowIcon, MoonIcon, } from "../icon/icon";
15
15
  import { cn } from "../../libs/cn";
16
- // Simple translation function replacement (no external library)
17
- // const inputTranslate = (key: string): string => {
18
- // const translations: Record<string, string> = {
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
16
  // InputText Component
27
17
  export function InputText(_a) {
28
18
  var { label, className, id, disabled, value, onChange, onClear } = _a, props = __rest(_a, ["label", "className", "id", "disabled", "value", "onChange", "onClear"]);
@@ -68,6 +58,120 @@ export const InputMobile = forwardRef((_a, ref) => {
68
58
  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: ref, 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: 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: validate }) })] })] }));
69
59
  });
70
60
  InputMobile.displayName = "InputMobile";
61
+ export const InputMobileIntl = forwardRef((_a, ref) => {
62
+ var {
63
+ // Core props
64
+ id, label, value: externalValue, onChange, onClear,
65
+ // Country props
66
+ defaultCountry, countries = [],
67
+ // Validation
68
+ error, validate,
69
+ // Input props
70
+ disabled = false, placeholder, searchPlaceholder, noResultText, countrySelectorAriaLabel, clearButtonAriaLabel, className,
71
+ // Custom classNames
72
+ classNames = {},
73
+ // Icon visibility
74
+ showMobileIcon = true, showClearButton = true, showSearchIcon = true, showCountryFlag = true, showCountryCode = true, showDropdownArrow = true, showCountryItemFlag = true, showCountryItemCode = true, showCountryItemCheck = true } = _a, props = __rest(_a, ["id", "label", "value", "onChange", "onClear", "defaultCountry", "countries", "error", "validate", "disabled", "placeholder", "searchPlaceholder", "noResultText", "countrySelectorAriaLabel", "clearButtonAriaLabel", "className", "classNames", "showMobileIcon", "showClearButton", "showSearchIcon", "showCountryFlag", "showCountryCode", "showDropdownArrow", "showCountryItemFlag", "showCountryItemCode", "showCountryItemCheck"]);
75
+ // ============ States ============
76
+ const [showError, setShowError] = useState(false);
77
+ const [showCountries, setShowCountries] = useState(false);
78
+ const [searchTerm, setSearchTerm] = useState("");
79
+ const [selectedCountry, setSelectedCountry] = useState(defaultCountry || countries[0]);
80
+ const [phoneNumber, setPhoneNumber] = useState("");
81
+ // ============ Refs ============
82
+ const wrapperRef = useRef(null);
83
+ const searchInputRef = useRef(null);
84
+ // ============ Computed ============
85
+ const filteredCountries = countries.filter((country) => {
86
+ const searchLower = searchTerm.toLowerCase().trim();
87
+ return (country.name.toLowerCase().includes(searchLower) ||
88
+ country.code.includes(searchTerm.trim()) ||
89
+ country.iso2.toLowerCase().includes(searchLower));
90
+ });
91
+ const getValidationPattern = () => {
92
+ if (!selectedCountry)
93
+ return undefined;
94
+ if (selectedCountry.iso2 === "IR") {
95
+ return "^09[0-9]{9}$";
96
+ }
97
+ return `^[0-9]{${selectedCountry.maxLength || 10}}$`;
98
+ };
99
+ // ============ Handlers ============
100
+ const handleClear = () => {
101
+ setPhoneNumber("");
102
+ if (ref && "current" in ref && ref.current) {
103
+ ref.current.value = "";
104
+ }
105
+ if (onChange && selectedCountry) {
106
+ onChange("", selectedCountry);
107
+ }
108
+ onClear === null || onClear === void 0 ? void 0 : onClear();
109
+ };
110
+ const handlePhoneChange = (e) => {
111
+ if (!selectedCountry)
112
+ return;
113
+ const onlyDigits = e.target.value.replace(/\D/g, "");
114
+ const limited = selectedCountry.maxLength
115
+ ? onlyDigits.slice(0, selectedCountry.maxLength)
116
+ : onlyDigits;
117
+ setPhoneNumber(limited);
118
+ if (ref && "current" in ref && ref.current) {
119
+ ref.current.value = limited;
120
+ }
121
+ if (onChange) {
122
+ const fullNumber = selectedCountry.code + limited;
123
+ onChange(fullNumber, selectedCountry);
124
+ }
125
+ };
126
+ const handleCountrySelect = (country) => {
127
+ setSelectedCountry(country);
128
+ setShowCountries(false);
129
+ setSearchTerm("");
130
+ if (onChange && phoneNumber) {
131
+ const fullNumber = country.code + phoneNumber;
132
+ onChange(fullNumber, country);
133
+ }
134
+ };
135
+ // ============ Effects ============
136
+ useEffect(() => {
137
+ if (externalValue && selectedCountry) {
138
+ const countryCodeRegex = new RegExp(`^\\${selectedCountry.code}`);
139
+ const cleanNumber = externalValue
140
+ .replace(countryCodeRegex, "")
141
+ .replace(/\D/g, "");
142
+ setPhoneNumber(cleanNumber);
143
+ }
144
+ else {
145
+ setPhoneNumber("");
146
+ }
147
+ }, [externalValue, selectedCountry]);
148
+ useEffect(() => {
149
+ const onClickOutside = (e) => {
150
+ const target = e.target;
151
+ if (wrapperRef.current && !wrapperRef.current.contains(target)) {
152
+ setShowCountries(false);
153
+ setSearchTerm("");
154
+ }
155
+ };
156
+ document.addEventListener("click", onClickOutside);
157
+ return () => document.removeEventListener("click", onClickOutside);
158
+ }, []);
159
+ useEffect(() => {
160
+ if (showCountries && searchInputRef.current) {
161
+ setTimeout(() => {
162
+ var _a;
163
+ (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
164
+ }, 100);
165
+ }
166
+ }, [showCountries]);
167
+ // ============ Render ============
168
+ if (!selectedCountry) {
169
+ return null;
170
+ }
171
+ return (_jsxs("div", { className: cn("input-mobile-intl-container", classNames.container), children: [label && (_jsx("label", { htmlFor: id, className: cn("input-mobile-intl-label", classNames.label), children: label })), _jsxs("div", { ref: wrapperRef, className: cn("input-mobile-intl-wrapper", classNames.wrapper), children: [_jsxs("div", { className: cn("input-mobile-intl-input-wrapper relative flex items-center", className, classNames.inputWrapper), children: [showMobileIcon && (_jsx("div", { className: cn("input-mobile-intl-mobile-icon-wrapper absolute rtl:right-0 ltr:left-0 rtl:mr-3 ltr:ml-3 z-10", classNames.mobileIconWrapper), children: _jsx(MobielIcon, { className: cn("input-mobile-intl-mobile-icon", classNames.mobileIcon) }) })), _jsxs("button", { type: "button", disabled: disabled, onClick: () => setShowCountries((s) => !s), "aria-label": countrySelectorAriaLabel || "Select country", className: cn("input-mobile-intl-country-selector absolute rtl:right-12 ltr:left-12 z-10", classNames.countrySelector), children: [showCountryFlag && (_jsx("span", { className: cn("input-mobile-intl-country-flag", classNames.countryFlag), children: selectedCountry.flag })), showCountryCode && (_jsx("span", { className: cn("input-mobile-intl-country-code", classNames.countryCode), children: selectedCountry.code })), showDropdownArrow && (_jsx("span", { className: cn("input-mobile-intl-dropdown-arrow", classNames.dropdownArrow, showCountries ? "rotate-180" : ""), children: "\u25BE" }))] }), _jsx("input", Object.assign({ ref: ref, id: id, type: "tel", inputMode: "numeric", pattern: getValidationPattern(), maxLength: selectedCountry.maxLength || 10, placeholder: placeholder || selectedCountry.example, disabled: disabled, value: phoneNumber, onChange: handlePhoneChange, onBlur: () => setShowError(false), onFocus: () => setShowError(false), className: cn("input-mobile-intl-input w-full", showMobileIcon ? "rtl:pr-12 ltr:pl-12" : "rtl:pr-3 ltr:pl-3", "rtl:pr-20 ltr:pl-20", "rtl:pl-10 ltr:pr-10", classNames.input) }, props)), showClearButton && !disabled && phoneNumber && (_jsx("button", { type: "button", onClick: handleClear, "aria-label": clearButtonAriaLabel || "Clear", className: cn("input-mobile-intl-clear-button absolute rtl:left-0 ltr:right-0 rtl:ml-3 ltr:mr-3 z-10", classNames.clearButton), children: _jsx(CloseSquareIcon, { className: cn("input-mobile-intl-clear-icon", classNames.clearIcon) }) }))] }), showCountries && !disabled && countries.length > 0 && (_jsxs("div", { className: cn("input-mobile-intl-dropdown", classNames.dropdown), children: [_jsx("div", { className: cn("input-mobile-intl-search-wrapper", classNames.searchWrapper), children: _jsxs("div", { className: "relative", children: [showSearchIcon && (_jsx(SearchIcon, { className: cn("input-mobile-intl-search-icon absolute rtl:right-3 ltr:left-3 top-1/2 -translate-y-1/2", classNames.searchIcon) })), _jsx("input", { ref: searchInputRef, type: "text", placeholder: searchPlaceholder || "Search country...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), className: cn("input-mobile-intl-search-input w-full rtl:pr-9 ltr:pl-9 rtl:pl-9 ltr:pr-9 py-2", classNames.searchInput), onClick: (e) => e.stopPropagation() }), searchTerm && (_jsx("button", { onClick: () => setSearchTerm(""), className: cn("input-mobile-intl-search-clear absolute rtl:left-2 ltr:right-2 top-1/2 -translate-y-1/2", classNames.searchClear), children: _jsx(CloseSquareIcon, { className: cn("input-mobile-intl-search-clear-icon", classNames.searchClearIcon) }) }))] }) }), _jsx("div", { className: cn("input-mobile-intl-country-list", classNames.countryList), children: filteredCountries.length > 0 ? (filteredCountries.map((country) => (_jsxs("button", { type: "button", onClick: () => handleCountrySelect(country), className: cn("input-mobile-intl-country-item", classNames.countryItem, selectedCountry.iso2 === country.iso2 && "selected"), children: [showCountryItemFlag && (_jsx("span", { className: cn("input-mobile-intl-country-item-flag", classNames.countryItemFlag), children: country.flag })), _jsx("span", { className: cn("input-mobile-intl-country-item-name", classNames.countryItemName), children: country.name }), showCountryItemCode && (_jsx("span", { className: cn("input-mobile-intl-country-item-code", classNames.countryItemCode), children: country.code })), showCountryItemCheck &&
172
+ selectedCountry.iso2 === country.iso2 && (_jsx("span", { className: cn("input-mobile-intl-country-item-check", classNames.countryItemCheck), children: "\u2713" }))] }, country.iso2)))) : (_jsx("div", { className: cn("input-mobile-intl-no-result", classNames.noResult), children: noResultText || "No country found" })) })] })), error && !showError && (_jsx("div", { className: cn("input-mobile-intl-error", classNames.error), children: _jsx("span", { className: cn("input-mobile-intl-error-text", classNames.errorText), children: error }) })), _jsx("div", { className: cn("input-mobile-intl-validate hidden peer-invalid:block", classNames.validate), children: _jsx("span", { className: cn("input-mobile-intl-validate-text", classNames.validateText), children: validate }) })] })] }));
173
+ });
174
+ InputMobileIntl.displayName = "InputMobileIntl";
71
175
  // InputTextArea Component
72
176
  export function InputTextArea(_a) {
73
177
  var { label, className, id, value, onChange } = _a, props = __rest(_a, ["label", "className", "id", "value", "onChange"]);
@@ -76,7 +180,7 @@ export function InputTextArea(_a) {
76
180
  // InputSearch Component
77
181
  export function InputSearch(_a) {
78
182
  var { className, id, inputSearchRef, classNameParent, searchClassname, param, value, onChange } = _a, props = __rest(_a, ["className", "id", "inputSearchRef", "classNameParent", "searchClassname", "param", "value", "onChange"]);
79
- 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
183
+ 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: cn("", 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
80
184
  ? "rtl:pr-11 rtl:pl-12 ltr:pl-11 ltr:pr-12"
81
185
  : "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))] }));
82
186
  }
@@ -99,7 +203,7 @@ export const InputPassword = forwardRef((_a, ref) => {
99
203
  InputPassword.displayName = "InputPassword";
100
204
  // InputRePassword Component
101
205
  export const InputRePassword = forwardRef((_a, ref) => {
102
- var { label, id, validate, passwordFieldId = "ch_password" } = _a, props = __rest(_a, ["label", "id", "validate", "passwordFieldId"]);
206
+ var { label, id, validate = "", passwordFieldId = "ch_password" } = _a, props = __rest(_a, ["label", "id", "validate", "passwordFieldId"]);
103
207
  const [showPassword, setShowPassword] = useState(false);
104
208
  const [error, setError] = useState("");
105
209
  const [value, setValue] = useState("");
@@ -109,7 +213,7 @@ export const InputRePassword = forwardRef((_a, ref) => {
109
213
  setValue(newValue);
110
214
  const passwordField = document.getElementById(passwordFieldId);
111
215
  if (passwordField && passwordField.value !== newValue) {
112
- setError("error_re_password");
216
+ setError(validate);
113
217
  }
114
218
  else {
115
219
  setError("");
@@ -44,3 +44,72 @@ export type InputToggleProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type
44
44
  export type InputDarkLightProps = {
45
45
  className?: string;
46
46
  };
47
+ export type Country = {
48
+ name: string;
49
+ code: string;
50
+ iso2: string;
51
+ flag: string;
52
+ example?: string;
53
+ maxLength?: number;
54
+ };
55
+ export type InputMobileIntlClassNames = {
56
+ container?: string;
57
+ label?: string;
58
+ wrapper?: string;
59
+ inputWrapper?: string;
60
+ input?: string;
61
+ clearButton?: string;
62
+ clearIcon?: string;
63
+ mobileIcon?: string;
64
+ mobileIconWrapper?: string;
65
+ countrySelector?: string;
66
+ countryFlag?: string;
67
+ countryCode?: string;
68
+ dropdownArrow?: string;
69
+ dropdown?: string;
70
+ searchWrapper?: string;
71
+ searchInput?: string;
72
+ searchIcon?: string;
73
+ searchClear?: string;
74
+ searchClearIcon?: string;
75
+ countryList?: string;
76
+ countryItem?: string;
77
+ countryItemFlag?: string;
78
+ countryItemName?: string;
79
+ countryItemCode?: string;
80
+ countryItemCheck?: string;
81
+ noResult?: string;
82
+ error?: string;
83
+ errorText?: string;
84
+ validate?: string;
85
+ validateText?: string;
86
+ };
87
+ export type InputMobileIntlProps = {
88
+ id?: string;
89
+ label?: string;
90
+ value?: string;
91
+ onChange?: (value: string, selectedCountry: Country) => void;
92
+ onClear?: () => void;
93
+ defaultCountry?: Country;
94
+ countries?: Country[];
95
+ error?: string;
96
+ validate?: string;
97
+ disabled?: boolean;
98
+ placeholder?: string;
99
+ searchPlaceholder?: string;
100
+ noResultText?: string;
101
+ countrySelectorAriaLabel?: string;
102
+ clearButtonAriaLabel?: string;
103
+ className?: string;
104
+ classNames?: InputMobileIntlClassNames;
105
+ showMobileIcon?: boolean;
106
+ showClearButton?: boolean;
107
+ showSearchIcon?: boolean;
108
+ showCountryFlag?: boolean;
109
+ showCountryCode?: boolean;
110
+ showDropdownArrow?: boolean;
111
+ showCountryItemFlag?: boolean;
112
+ showCountryItemCode?: boolean;
113
+ showCountryItemCheck?: boolean;
114
+ [key: string]: any;
115
+ };
File without changes
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ /*
2
+ * @Author: Mohammad Felfelani
3
+ * @Email: mfelfelani72@gmail.com
4
+ * @Team:
5
+ * @Date: 2025-12-31 07:59:15
6
+ * @Description: International Mobile Input with full customization support
7
+ */
8
+ export {};
9
+ // ============ Component ============
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ import { type ReactNode } from "react";
2
+ interface BodyProps {
3
+ className?: string;
4
+ children: ReactNode;
5
+ }
6
+ declare const Body: ({ className, children }: BodyProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default Body;
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { cn } from "@/libs/cn";
4
+ const Body = ({ className, children }) => {
5
+ return (_jsx("div", { className: cn("absolute z-[999]", className), children: children }));
6
+ };
7
+ export default Body;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * A multi-directional generic reveal container.
3
+ * Can be anything — dropdown, popover, panel, card, form, image preview, etc.
4
+ * Clicking the trigger reveals the body in the specified direction.
5
+ *
6
+ * Written by Pouya Soltani ¯\_(ツ)_/¯
7
+ * Email : pouyasoltani81@gmail.com
8
+ */
9
+ import { type FC, type ReactNode } from "react";
10
+ declare const computeDirectionClasses: (direction?: string) => string;
11
+ export { computeDirectionClasses };
12
+ interface GhostBoxProps {
13
+ id: string;
14
+ className?: string;
15
+ trigger: ReactNode;
16
+ triggerClassName?: string;
17
+ children: ReactNode;
18
+ childrenClassName?: string;
19
+ callback?: (data: unknown) => void;
20
+ callbackData?: unknown;
21
+ gap?: number;
22
+ direction?: string;
23
+ }
24
+ declare const GhostBox: FC<GhostBoxProps>;
25
+ export default GhostBox;
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * A multi-directional generic reveal container.
5
+ * Can be anything — dropdown, popover, panel, card, form, image preview, etc.
6
+ * Clicking the trigger reveals the body in the specified direction.
7
+ *
8
+ * Written by Pouya Soltani ¯\_(ツ)_/¯
9
+ * Email : pouyasoltani81@gmail.com
10
+ */
11
+ import { useEffect, useRef, useState } from "react";
12
+ import { cn } from "@/libs/cn";
13
+ import * as motion from "motion/react-client";
14
+ import Trigger from "./Trigger";
15
+ /* ── direction → position classes ────────────────────── */
16
+ const computeDirectionClasses = (direction) => {
17
+ var _a;
18
+ if (!direction)
19
+ return "top-full ltr:left-0 rtl:right-0 pt-2";
20
+ const words = direction.toLowerCase().trim().split(/\s+/);
21
+ const primary = (_a = words[0]) !== null && _a !== void 0 ? _a : "bottom";
22
+ const secondary = words[1];
23
+ switch (primary) {
24
+ case "top": {
25
+ if (secondary === "right")
26
+ return "bottom-full ltr:right-0 rtl:left-0 pb-2";
27
+ if (secondary === "center")
28
+ return "bottom-full left-1/2 -translate-x-1/2 pb-2";
29
+ return "bottom-full ltr:left-0 rtl:right-0 pb-2";
30
+ }
31
+ case "bottom": {
32
+ if (secondary === "right")
33
+ return "top-full ltr:right-0 rtl:left-0 pt-2";
34
+ if (secondary === "center")
35
+ return "top-full left-1/2 -translate-x-1/2 pt-2";
36
+ return "top-full ltr:left-0 rtl:right-0 pt-2";
37
+ }
38
+ case "left": {
39
+ if (secondary === "bottom")
40
+ return "ltr:right-full rtl:left-full bottom-0 ltr:pr-2 rtl:pl-2";
41
+ if (secondary === "center")
42
+ return "ltr:right-full rtl:left-full top-1/2 -translate-y-1/2 ltr:pr-2 rtl:pl-2";
43
+ return "ltr:right-full rtl:left-full top-0 ltr:pr-2 rtl:pl-2";
44
+ }
45
+ case "right": {
46
+ if (secondary === "bottom")
47
+ return "ltr:left-full rtl:right-full bottom-0 ltr:pl-2 rtl:pr-2";
48
+ if (secondary === "center")
49
+ return "ltr:left-full rtl:right-full top-1/2 -translate-y-1/2 ltr:pl-2 rtl:pr-2";
50
+ return "ltr:left-full rtl:right-full top-0 ltr:pl-2 rtl:pr-2";
51
+ }
52
+ default:
53
+ return "top-full ltr:left-0 rtl:right-0 pt-2";
54
+ }
55
+ };
56
+ export { computeDirectionClasses };
57
+ /* ── component ───────────────────────────────────────── */
58
+ const GhostBox = ({ id, className, trigger, triggerClassName, children, childrenClassName, callback, callbackData, gap = 0, direction, }) => {
59
+ const [visible, setVisible] = useState(false);
60
+ const containerRef = useRef(null);
61
+ const triggerRef = useRef(null);
62
+ const toggleVisible = () => {
63
+ if (callback)
64
+ callback(callbackData);
65
+ const icon = document.getElementById(`${id}-icon`);
66
+ if (icon) {
67
+ icon.classList.toggle("ltr:rotate-90");
68
+ icon.classList.toggle("rtl:-rotate-90");
69
+ }
70
+ setVisible((prev) => !prev);
71
+ };
72
+ useEffect(() => {
73
+ if (!visible)
74
+ return;
75
+ const handleClickOutside = (event) => {
76
+ if (containerRef.current &&
77
+ !containerRef.current.contains(event.target)) {
78
+ setVisible(false);
79
+ const icon = document.getElementById(`${id}-icon`);
80
+ if (icon) {
81
+ icon.classList.remove("ltr:rotate-90");
82
+ icon.classList.remove("rtl:-rotate-90");
83
+ }
84
+ }
85
+ };
86
+ document.addEventListener("mousedown", handleClickOutside);
87
+ return () => document.removeEventListener("mousedown", handleClickOutside);
88
+ }, [visible, id]);
89
+ const directionClasses = computeDirectionClasses(direction);
90
+ return (_jsxs("div", { id: id, ref: containerRef, className: cn("relative inline-block", className), style: gap ? { paddingInlineEnd: `${gap}px` } : undefined, children: [_jsx(Trigger, { ref: triggerRef, onClick: toggleVisible, className: triggerClassName, children: trigger }), _jsx(motion.div, { initial: { opacity: 0, scale: 0.96 }, animate: {
91
+ opacity: visible ? 1 : 0,
92
+ scale: visible ? 1 : 0.96,
93
+ }, transition: { duration: 0.15, ease: "easeOut" }, className: cn("absolute z-[999]", !visible && "pointer-events-none", directionClasses, childrenClassName), children: children })] }));
94
+ };
95
+ export default GhostBox;
@@ -0,0 +1,7 @@
1
+ import { type ReactNode, type HTMLAttributes } from "react";
2
+ interface TriggerProps extends HTMLAttributes<HTMLDivElement> {
3
+ className?: string;
4
+ children: ReactNode;
5
+ }
6
+ declare const Trigger: import("react").ForwardRefExoticComponent<TriggerProps & import("react").RefAttributes<HTMLDivElement>>;
7
+ export default Trigger;
@@ -0,0 +1,21 @@
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 } from "react/jsx-runtime";
14
+ import { forwardRef } from "react";
15
+ import { cn } from "@/libs/cn";
16
+ const Trigger = forwardRef((_a, ref) => {
17
+ var { className, children } = _a, props = __rest(_a, ["className", "children"]);
18
+ return (_jsx("div", Object.assign({ ref: ref }, props, { className: cn("select-none cursor-pointer", className), children: children })));
19
+ });
20
+ Trigger.displayName = "Trigger";
21
+ export default Trigger;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/index.d.ts CHANGED
@@ -10,6 +10,8 @@ export { default as Button } from "./components/ui/Button";
10
10
  export { default as Modal } from "./components/ui/Modal";
11
11
  export { default as Drawer } from "./components/ui/Drawer";
12
12
  export { default as Accordion } from "./components/ui/Accordion";
13
+ export { default as GhostBox } from "./components/ui/ghostBox/GhostBox";
13
14
  export * from "./components/ui/Input";
14
15
  export { ShowModal, CloseModal } from "./libs/modal/modal";
15
16
  export { ShowDrawer, CloseDrawer } from "./libs/drawer/modal";
17
+ export type { Country } from "./components/ui/Input.types";
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ export { default as Button } from "./components/ui/Button";
12
12
  export { default as Modal } from "./components/ui/Modal";
13
13
  export { default as Drawer } from "./components/ui/Drawer";
14
14
  export { default as Accordion } from "./components/ui/Accordion";
15
+ export { default as GhostBox } from "./components/ui/ghostBox/GhostBox";
15
16
  export * from "./components/ui/Input";
16
17
  // Functions
17
18
  export { ShowModal, CloseModal } from "./libs/modal/modal";
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/libs/cn.d.ts CHANGED
File without changes
package/dist/libs/cn.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes