hi-tm 0.1.7 → 0.1.9

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.
@@ -127,7 +127,7 @@ noDataText = 'No items found', loadingText = 'Loading data...', searchingText =
127
127
  }, className: "text-gray-400 hover:text-gray-600 focus:outline-none", tabIndex: 0, "aria-label": "Clear search" },
128
128
  react_1.default.createElement("svg", { width: "16", height: "16", fill: "none", viewBox: "0 0 24 24" },
129
129
  react_1.default.createElement("path", { d: "M18 6L6 18M6 6l12 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }))))),
130
- react_1.default.createElement("div", { className: "flex-1 overflow-y-auto" }, isPendingData ? (react_1.default.createElement("div", { className: "flex h-44 items-center justify-center" },
130
+ react_1.default.createElement("div", { className: "flex-1 overflow-y-hidden" }, isPendingData ? (react_1.default.createElement("div", { className: "flex h-44 items-center justify-center" },
131
131
  react_1.default.createElement("p", null, loadingText))) : isSearchLoading ? (react_1.default.createElement("div", { className: "flex h-44 items-center justify-center" },
132
132
  react_1.default.createElement("p", null, searchingText))) : filteredData && filteredData.length > 0 ? (react_1.default.createElement("ul", { className: "max-h-60 w-full overflow-auto py-3" }, filteredData.map((item) => (react_1.default.createElement("li", { key: item.id, className: `mx-4 flex cursor-pointer items-start rounded px-4 py-2 hover:bg-gray-100 ${selected && selected.id === item.id ? 'bg-blue-100' : ''}`, onClick: () => handleSelect(item), role: "option", "aria-selected": selected && selected.id === item.id ? 'true' : 'false' }, renderItem
133
133
  ? renderItem(item, !!(selected && selected.id === item.id))
@@ -3,6 +3,8 @@ import { TextInputPropsType } from '../../types/Inputs/TextInputType';
3
3
  interface TextInputProps extends TextInputPropsType {
4
4
  applyConditionalStyles?: boolean;
5
5
  maxLength?: number;
6
+ onlyFaChars?: boolean;
7
+ onlyEnChars?: boolean;
6
8
  }
7
- declare const TextInput: ({ label, required, value, placeholderText, autoComplete, autoFocus, textError, onChangeValueHandler, onBlurHandler, onFocusHandler, onKeyUpHandler, onKeyDownHandler, disabled, type, style, startContent, startContentStyle, placeHolderDirection, applyConditionalStyles, maxLength, }: TextInputProps) => React.JSX.Element;
9
+ declare const TextInput: ({ label, required, value, placeholderText, autoComplete, autoFocus, textError, onChangeValueHandler, onBlurHandler, onFocusHandler, onKeyUpHandler, onKeyDownHandler, disabled, type, style, startContent, startContentStyle, placeHolderDirection, applyConditionalStyles, maxLength, onlyFaChars, onlyEnChars, }: TextInputProps) => React.JSX.Element;
8
10
  export default TextInput;
@@ -38,7 +38,7 @@ const react_1 = __importStar(require("react"));
38
38
  const TextInput = ({ label, required, value, placeholderText, autoComplete, autoFocus, textError, onChangeValueHandler, onBlurHandler, onFocusHandler, onKeyUpHandler, onKeyDownHandler, disabled = false, type = 'text', style = {
39
39
  margin: 'mt-[-6px]',
40
40
  width: 'w-full',
41
- }, startContent, startContentStyle, placeHolderDirection = 'ltr', applyConditionalStyles = false, maxLength, }) => {
41
+ }, startContent, startContentStyle, placeHolderDirection = 'ltr', applyConditionalStyles = false, maxLength, onlyFaChars = false, onlyEnChars = false, }) => {
42
42
  const [inputValue, setInputValue] = (0, react_1.useState)('');
43
43
  const inputRef = (0, react_1.useRef)(null);
44
44
  const handleInputChange = (e) => {
@@ -55,6 +55,16 @@ const TextInput = ({ label, required, value, placeholderText, autoComplete, auto
55
55
  newValue = newValue.slice(0, maxLength);
56
56
  e.target.value = newValue;
57
57
  }
58
+ else if (onlyFaChars) {
59
+ // Only allow Persian characters and symbols
60
+ newValue = newValue.replace(/[^\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF\u2000-\u206F\u0020-\u007F]/g, '');
61
+ e.target.value = newValue;
62
+ }
63
+ else if (onlyEnChars) {
64
+ // Only allow English characters and symbols
65
+ newValue = newValue.replace(/[^a-zA-Z0-9\u0020-\u007F]/g, '');
66
+ e.target.value = newValue;
67
+ }
58
68
  setInputValue(newValue);
59
69
  onChangeValueHandler(e);
60
70
  };
@@ -19,4 +19,6 @@ export interface TextInputPropsType {
19
19
  placeHolderDirection?: 'rtl' | 'ltr';
20
20
  applyConditionalStyles?: boolean;
21
21
  maxLength?: number;
22
+ onlyFaChars?: boolean;
23
+ onlyEnChars?: boolean;
22
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hi-tm",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "styles": "dist/styles/globals.css",
5
5
  "main": "dist/index.js",
6
6
  "exports": {