@sikka/hawa 0.46.1-next → 0.46.3-next
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/auth/index.js +25 -13
- package/dist/blocks/auth/index.mjs +1 -1
- package/dist/blocks/index.js +25 -13
- package/dist/blocks/index.mjs +1 -1
- package/dist/blocks/misc/index.js +25 -13
- package/dist/blocks/misc/index.mjs +1 -1
- package/dist/{chunk-FTETN5UE.mjs → chunk-7L5VUKZ7.mjs} +26 -14
- package/dist/{chunk-QUC5EXTF.mjs → chunk-QLUJEUIB.mjs} +32 -20
- package/dist/dataTable/index.js +25 -13
- package/dist/dataTable/index.js.map +1 -1
- package/dist/dataTable/index.mjs +26 -14
- package/dist/dataTable/index.mjs.map +1 -1
- package/dist/elements/index.d.mts +2 -2
- package/dist/elements/index.d.ts +2 -2
- package/dist/elements/index.js +25 -13
- package/dist/elements/index.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -13
- package/dist/index.mjs +132 -120
- package/dist/input/index.d.mts +2 -2
- package/dist/input/index.d.ts +2 -2
- package/dist/input/index.js +25 -13
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs +26 -14
- package/dist/input/index.mjs.map +1 -1
- package/dist/passwordInput/index.js +25 -13
- package/dist/passwordInput/index.js.map +1 -1
- package/dist/passwordInput/index.mjs +36 -24
- package/dist/passwordInput/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/dataTable/index.mjs
CHANGED
@@ -993,7 +993,7 @@ var DropdownMenu = ({
|
|
993
993
|
};
|
994
994
|
|
995
995
|
// elements/input/Input.tsx
|
996
|
-
import React9, { forwardRef as forwardRef5 } from "react";
|
996
|
+
import React9, { forwardRef as forwardRef5, useState as useState2 } from "react";
|
997
997
|
|
998
998
|
// elements/skeleton/Skeleton.tsx
|
999
999
|
import React8 from "react";
|
@@ -1051,6 +1051,7 @@ var Input = forwardRef5(
|
|
1051
1051
|
...props
|
1052
1052
|
}, ref) => {
|
1053
1053
|
var _a;
|
1054
|
+
const [value, setValue] = useState2(props.value || "");
|
1054
1055
|
let marginStyles = {
|
1055
1056
|
none: "hawa-mb-0",
|
1056
1057
|
normal: "hawa-mb-3",
|
@@ -1066,6 +1067,7 @@ var Input = forwardRef5(
|
|
1066
1067
|
let defaultInputStyle = "hawa-block hawa-w-full hawa-rounded hawa-border hawa-transition-all hawa-bg-background hawa-p-3 hawa-text-sm placeholder:hawa-text-muted-foreground";
|
1067
1068
|
const handleChange = (e) => {
|
1068
1069
|
let newValue = e.target.value;
|
1070
|
+
setValue(newValue);
|
1069
1071
|
if (props.prefixText) {
|
1070
1072
|
if (newValue.length < props.prefixText.length) {
|
1071
1073
|
newValue = props.prefixText;
|
@@ -1077,9 +1079,26 @@ var Input = forwardRef5(
|
|
1077
1079
|
}
|
1078
1080
|
}
|
1079
1081
|
if (props.onChange) {
|
1080
|
-
|
1081
|
-
|
1082
|
+
if (props.type === "number" && props.maxLength) {
|
1083
|
+
console.log("type is ", props.type);
|
1084
|
+
console.log("max length is ", props.maxLength);
|
1085
|
+
let v = newValue.replace(/[^0-9]/g, "").slice(0, props.maxLength);
|
1086
|
+
const newEvent = { ...e, target: { ...e.target, value: v } };
|
1087
|
+
setValue(v);
|
1088
|
+
props.onChange(newEvent);
|
1089
|
+
} else {
|
1090
|
+
console.log("NETIHERRRER");
|
1091
|
+
const newEvent = { ...e, target: { ...e.target, value: newValue } };
|
1092
|
+
setValue(newValue);
|
1093
|
+
props.onChange(newEvent);
|
1094
|
+
}
|
1095
|
+
}
|
1096
|
+
};
|
1097
|
+
const handleKeyDown = (e) => {
|
1098
|
+
if (props.type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
|
1099
|
+
e.preventDefault();
|
1082
1100
|
}
|
1101
|
+
props.onKeyDown && props.onKeyDown(e);
|
1083
1102
|
};
|
1084
1103
|
return /* @__PURE__ */ React9.createElement(
|
1085
1104
|
"div",
|
@@ -1093,16 +1112,7 @@ var Input = forwardRef5(
|
|
1093
1112
|
)
|
1094
1113
|
},
|
1095
1114
|
props.label && /* @__PURE__ */ React9.createElement(Label, { ...labelProps }, props.label),
|
1096
|
-
/* @__PURE__ */ React9.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ React9.createElement(
|
1097
|
-
"span",
|
1098
|
-
{
|
1099
|
-
className: cn(
|
1100
|
-
"hawa-me-2 hawa-opacity-90",
|
1101
|
-
!forceHideHelperText && "hawa-mb-2"
|
1102
|
-
)
|
1103
|
-
},
|
1104
|
-
props.outsidePrefix
|
1105
|
-
), props.isLoading ? /* @__PURE__ */ React9.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React9.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ React9.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React9.createElement(
|
1115
|
+
/* @__PURE__ */ React9.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ React9.createElement("span", { className: cn("hawa-me-2 hawa-opacity-90", !forceHideHelperText && "hawa-mb-2") }, props.outsidePrefix), props.isLoading ? /* @__PURE__ */ React9.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React9.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ React9.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React9.createElement(
|
1106
1116
|
Skeleton,
|
1107
1117
|
{
|
1108
1118
|
animation: "none",
|
@@ -1149,13 +1159,15 @@ var Input = forwardRef5(
|
|
1149
1159
|
required: true,
|
1150
1160
|
dir: props.dir,
|
1151
1161
|
type: props.type,
|
1152
|
-
value: props.value,
|
1162
|
+
value: props.value || value,
|
1153
1163
|
onChange: handleChange,
|
1164
|
+
onKeyDown: handleKeyDown,
|
1154
1165
|
autoComplete: props.autoComplete,
|
1155
1166
|
defaultValue: props.defaultValue,
|
1156
1167
|
placeholder,
|
1157
1168
|
disabled: props.disabled || preview,
|
1158
1169
|
style: { height: 40 },
|
1170
|
+
maxLength: props.maxLength,
|
1159
1171
|
...inputProps,
|
1160
1172
|
className: cn(
|
1161
1173
|
defaultInputStyle,
|