@sikka/hawa 0.46.1-next → 0.46.4-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.
Files changed (77) hide show
  1. package/dist/blocks/auth/index.js +23 -14
  2. package/dist/blocks/auth/index.mjs +4 -4
  3. package/dist/blocks/feedback/index.js +1 -1
  4. package/dist/blocks/feedback/index.mjs +5 -5
  5. package/dist/blocks/index.js +23 -14
  6. package/dist/blocks/index.mjs +2 -2
  7. package/dist/blocks/misc/index.js +23 -14
  8. package/dist/blocks/misc/index.mjs +5 -5
  9. package/dist/blocks/pricing/index.js +1 -1
  10. package/dist/blocks/pricing/index.mjs +4 -4
  11. package/dist/{chunk-QUC5EXTF.mjs → chunk-5CTMGPEF.mjs} +30 -21
  12. package/dist/{chunk-EHJXQQDP.mjs → chunk-5S5DR7KF.mjs} +1 -1
  13. package/dist/{chunk-HJVL6X7I.mjs → chunk-6SJUUJOV.mjs} +1 -1
  14. package/dist/{chunk-7O555VJR.mjs → chunk-6TG2PHZK.mjs} +1 -1
  15. package/dist/{chunk-U72MOMEK.mjs → chunk-C2UOOH4X.mjs} +1 -1
  16. package/dist/{chunk-FTETN5UE.mjs → chunk-EOH6A3GR.mjs} +24 -15
  17. package/dist/{chunk-6UOJKVIA.mjs → chunk-IFWYR5W2.mjs} +1 -1
  18. package/dist/{chunk-YXUHXKKK.mjs → chunk-JP2N5WKD.mjs} +1 -1
  19. package/dist/{chunk-R37QEYSB.mjs → chunk-NMW4GM4G.mjs} +1 -1
  20. package/dist/{chunk-CIMTNOLA.mjs → chunk-WUMDFBEK.mjs} +1 -1
  21. package/dist/colorPicker/index.js +1 -1
  22. package/dist/colorPicker/index.js.map +1 -1
  23. package/dist/colorPicker/index.mjs +1 -1
  24. package/dist/colorPicker/index.mjs.map +1 -1
  25. package/dist/combobox/index.js +1 -1
  26. package/dist/combobox/index.js.map +1 -1
  27. package/dist/combobox/index.mjs +1 -1
  28. package/dist/combobox/index.mjs.map +1 -1
  29. package/dist/dataTable/index.js +23 -14
  30. package/dist/dataTable/index.js.map +1 -1
  31. package/dist/dataTable/index.mjs +24 -15
  32. package/dist/dataTable/index.mjs.map +1 -1
  33. package/dist/elements/index.d.mts +2 -2
  34. package/dist/elements/index.d.ts +2 -2
  35. package/dist/elements/index.js +23 -14
  36. package/dist/elements/index.mjs +3 -3
  37. package/dist/index.d.mts +2 -2
  38. package/dist/index.d.ts +2 -2
  39. package/dist/index.js +23 -14
  40. package/dist/index.mjs +130 -121
  41. package/dist/input/index.d.mts +2 -2
  42. package/dist/input/index.d.ts +2 -2
  43. package/dist/input/index.js +23 -14
  44. package/dist/input/index.js.map +1 -1
  45. package/dist/input/index.mjs +24 -15
  46. package/dist/input/index.mjs.map +1 -1
  47. package/dist/layout/index.js +1 -1
  48. package/dist/layout/index.mjs +2 -2
  49. package/dist/passwordInput/index.js +23 -14
  50. package/dist/passwordInput/index.js.map +1 -1
  51. package/dist/passwordInput/index.mjs +34 -25
  52. package/dist/passwordInput/index.mjs.map +1 -1
  53. package/dist/phoneInput/index.js +1 -1
  54. package/dist/phoneInput/index.js.map +1 -1
  55. package/dist/phoneInput/index.mjs +1 -1
  56. package/dist/phoneInput/index.mjs.map +1 -1
  57. package/dist/select/index.js +1 -1
  58. package/dist/select/index.js.map +1 -1
  59. package/dist/select/index.mjs +1 -1
  60. package/dist/select/index.mjs.map +1 -1
  61. package/dist/simpleTable/index.js +1 -1
  62. package/dist/simpleTable/index.js.map +1 -1
  63. package/dist/simpleTable/index.mjs +1 -1
  64. package/dist/simpleTable/index.mjs.map +1 -1
  65. package/dist/skeleton/index.js +1 -1
  66. package/dist/skeleton/index.js.map +1 -1
  67. package/dist/skeleton/index.mjs +1 -1
  68. package/dist/skeleton/index.mjs.map +1 -1
  69. package/dist/stats/index.js +1 -1
  70. package/dist/stats/index.js.map +1 -1
  71. package/dist/stats/index.mjs +1 -1
  72. package/dist/stats/index.mjs.map +1 -1
  73. package/dist/textarea/index.js +1 -1
  74. package/dist/textarea/index.js.map +1 -1
  75. package/dist/textarea/index.mjs +1 -1
  76. package/dist/textarea/index.mjs.map +1 -1
  77. package/package.json +1 -1
@@ -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";
@@ -1018,7 +1018,7 @@ function Skeleton({
1018
1018
  };
1019
1019
  const styledAs = {
1020
1020
  div: "",
1021
- input: "!h-[38px] !w-full"
1021
+ input: "hawa-h-[40px] hawa-w-full"
1022
1022
  };
1023
1023
  return /* @__PURE__ */ React8.createElement(
1024
1024
  "div",
@@ -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,23 @@ var Input = forwardRef5(
1077
1079
  }
1078
1080
  }
1079
1081
  if (props.onChange) {
1080
- const newEvent = { ...e, target: { ...e.target, value: newValue } };
1081
- props.onChange(newEvent);
1082
+ if (props.type === "number" && props.maxLength) {
1083
+ let v = newValue.replace(/[^0-9]/g, "").slice(0, props.maxLength);
1084
+ const newEvent = { ...e, target: { ...e.target, value: v } };
1085
+ setValue(v);
1086
+ props.onChange(newEvent);
1087
+ } else {
1088
+ const newEvent = { ...e, target: { ...e.target, value: newValue } };
1089
+ setValue(newValue);
1090
+ props.onChange(newEvent);
1091
+ }
1092
+ }
1093
+ };
1094
+ const handleKeyDown = (e) => {
1095
+ if (props.type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
1096
+ e.preventDefault();
1082
1097
  }
1098
+ props.onKeyDown && props.onKeyDown(e);
1083
1099
  };
1084
1100
  return /* @__PURE__ */ React9.createElement(
1085
1101
  "div",
@@ -1093,16 +1109,7 @@ var Input = forwardRef5(
1093
1109
  )
1094
1110
  },
1095
1111
  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(
1112
+ /* @__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, { as: "input" })) : props.isLoadingError ? /* @__PURE__ */ React9.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React9.createElement(
1106
1113
  Skeleton,
1107
1114
  {
1108
1115
  animation: "none",
@@ -1149,13 +1156,15 @@ var Input = forwardRef5(
1149
1156
  required: true,
1150
1157
  dir: props.dir,
1151
1158
  type: props.type,
1152
- value: props.value,
1159
+ value: props.value || value,
1153
1160
  onChange: handleChange,
1161
+ onKeyDown: handleKeyDown,
1154
1162
  autoComplete: props.autoComplete,
1155
1163
  defaultValue: props.defaultValue,
1156
1164
  placeholder,
1157
1165
  disabled: props.disabled || preview,
1158
1166
  style: { height: 40 },
1167
+ maxLength: props.maxLength,
1159
1168
  ...inputProps,
1160
1169
  className: cn(
1161
1170
  defaultInputStyle,