@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
@@ -1435,6 +1435,7 @@ var Input = (0, import_react8.forwardRef)(
|
|
1435
1435
|
...props
|
1436
1436
|
}, ref) => {
|
1437
1437
|
var _a;
|
1438
|
+
const [value, setValue] = (0, import_react8.useState)(props.value || "");
|
1438
1439
|
let marginStyles = {
|
1439
1440
|
none: "hawa-mb-0",
|
1440
1441
|
normal: "hawa-mb-3",
|
@@ -1450,6 +1451,7 @@ var Input = (0, import_react8.forwardRef)(
|
|
1450
1451
|
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";
|
1451
1452
|
const handleChange = (e) => {
|
1452
1453
|
let newValue = e.target.value;
|
1454
|
+
setValue(newValue);
|
1453
1455
|
if (props.prefixText) {
|
1454
1456
|
if (newValue.length < props.prefixText.length) {
|
1455
1457
|
newValue = props.prefixText;
|
@@ -1461,10 +1463,27 @@ var Input = (0, import_react8.forwardRef)(
|
|
1461
1463
|
}
|
1462
1464
|
}
|
1463
1465
|
if (props.onChange) {
|
1464
|
-
|
1465
|
-
|
1466
|
+
if (props.type === "number" && props.maxLength) {
|
1467
|
+
console.log("type is ", props.type);
|
1468
|
+
console.log("max length is ", props.maxLength);
|
1469
|
+
let v = newValue.replace(/[^0-9]/g, "").slice(0, props.maxLength);
|
1470
|
+
const newEvent = { ...e, target: { ...e.target, value: v } };
|
1471
|
+
setValue(v);
|
1472
|
+
props.onChange(newEvent);
|
1473
|
+
} else {
|
1474
|
+
console.log("NETIHERRRER");
|
1475
|
+
const newEvent = { ...e, target: { ...e.target, value: newValue } };
|
1476
|
+
setValue(newValue);
|
1477
|
+
props.onChange(newEvent);
|
1478
|
+
}
|
1466
1479
|
}
|
1467
1480
|
};
|
1481
|
+
const handleKeyDown = (e) => {
|
1482
|
+
if (props.type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
|
1483
|
+
e.preventDefault();
|
1484
|
+
}
|
1485
|
+
props.onKeyDown && props.onKeyDown(e);
|
1486
|
+
};
|
1468
1487
|
return /* @__PURE__ */ import_react8.default.createElement(
|
1469
1488
|
"div",
|
1470
1489
|
{
|
@@ -1477,16 +1496,7 @@ var Input = (0, import_react8.forwardRef)(
|
|
1477
1496
|
)
|
1478
1497
|
},
|
1479
1498
|
props.label && /* @__PURE__ */ import_react8.default.createElement(Label, { ...labelProps }, props.label),
|
1480
|
-
/* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ import_react8.default.createElement(
|
1481
|
-
"span",
|
1482
|
-
{
|
1483
|
-
className: cn(
|
1484
|
-
"hawa-me-2 hawa-opacity-90",
|
1485
|
-
!forceHideHelperText && "hawa-mb-2"
|
1486
|
-
)
|
1487
|
-
},
|
1488
|
-
props.outsidePrefix
|
1489
|
-
), props.isLoading ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react8.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react8.default.createElement(
|
1499
|
+
/* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ import_react8.default.createElement("span", { className: cn("hawa-me-2 hawa-opacity-90", !forceHideHelperText && "hawa-mb-2") }, props.outsidePrefix), props.isLoading ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react8.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react8.default.createElement(
|
1490
1500
|
Skeleton,
|
1491
1501
|
{
|
1492
1502
|
animation: "none",
|
@@ -1533,13 +1543,15 @@ var Input = (0, import_react8.forwardRef)(
|
|
1533
1543
|
required: true,
|
1534
1544
|
dir: props.dir,
|
1535
1545
|
type: props.type,
|
1536
|
-
value: props.value,
|
1546
|
+
value: props.value || value,
|
1537
1547
|
onChange: handleChange,
|
1548
|
+
onKeyDown: handleKeyDown,
|
1538
1549
|
autoComplete: props.autoComplete,
|
1539
1550
|
defaultValue: props.defaultValue,
|
1540
1551
|
placeholder,
|
1541
1552
|
disabled: props.disabled || preview,
|
1542
1553
|
style: { height: 40 },
|
1554
|
+
maxLength: props.maxLength,
|
1543
1555
|
...inputProps,
|
1544
1556
|
className: cn(
|
1545
1557
|
defaultInputStyle,
|
package/dist/blocks/index.js
CHANGED
@@ -1456,6 +1456,7 @@ var Input = (0, import_react8.forwardRef)(
|
|
1456
1456
|
...props
|
1457
1457
|
}, ref) => {
|
1458
1458
|
var _a;
|
1459
|
+
const [value, setValue] = (0, import_react8.useState)(props.value || "");
|
1459
1460
|
let marginStyles = {
|
1460
1461
|
none: "hawa-mb-0",
|
1461
1462
|
normal: "hawa-mb-3",
|
@@ -1471,6 +1472,7 @@ var Input = (0, import_react8.forwardRef)(
|
|
1471
1472
|
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";
|
1472
1473
|
const handleChange = (e) => {
|
1473
1474
|
let newValue = e.target.value;
|
1475
|
+
setValue(newValue);
|
1474
1476
|
if (props.prefixText) {
|
1475
1477
|
if (newValue.length < props.prefixText.length) {
|
1476
1478
|
newValue = props.prefixText;
|
@@ -1482,10 +1484,27 @@ var Input = (0, import_react8.forwardRef)(
|
|
1482
1484
|
}
|
1483
1485
|
}
|
1484
1486
|
if (props.onChange) {
|
1485
|
-
|
1486
|
-
|
1487
|
+
if (props.type === "number" && props.maxLength) {
|
1488
|
+
console.log("type is ", props.type);
|
1489
|
+
console.log("max length is ", props.maxLength);
|
1490
|
+
let v = newValue.replace(/[^0-9]/g, "").slice(0, props.maxLength);
|
1491
|
+
const newEvent = { ...e, target: { ...e.target, value: v } };
|
1492
|
+
setValue(v);
|
1493
|
+
props.onChange(newEvent);
|
1494
|
+
} else {
|
1495
|
+
console.log("NETIHERRRER");
|
1496
|
+
const newEvent = { ...e, target: { ...e.target, value: newValue } };
|
1497
|
+
setValue(newValue);
|
1498
|
+
props.onChange(newEvent);
|
1499
|
+
}
|
1487
1500
|
}
|
1488
1501
|
};
|
1502
|
+
const handleKeyDown = (e) => {
|
1503
|
+
if (props.type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
|
1504
|
+
e.preventDefault();
|
1505
|
+
}
|
1506
|
+
props.onKeyDown && props.onKeyDown(e);
|
1507
|
+
};
|
1489
1508
|
return /* @__PURE__ */ import_react8.default.createElement(
|
1490
1509
|
"div",
|
1491
1510
|
{
|
@@ -1498,16 +1517,7 @@ var Input = (0, import_react8.forwardRef)(
|
|
1498
1517
|
)
|
1499
1518
|
},
|
1500
1519
|
props.label && /* @__PURE__ */ import_react8.default.createElement(Label, { ...labelProps }, props.label),
|
1501
|
-
/* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ import_react8.default.createElement(
|
1502
|
-
"span",
|
1503
|
-
{
|
1504
|
-
className: cn(
|
1505
|
-
"hawa-me-2 hawa-opacity-90",
|
1506
|
-
!forceHideHelperText && "hawa-mb-2"
|
1507
|
-
)
|
1508
|
-
},
|
1509
|
-
props.outsidePrefix
|
1510
|
-
), props.isLoading ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react8.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react8.default.createElement(
|
1520
|
+
/* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ import_react8.default.createElement("span", { className: cn("hawa-me-2 hawa-opacity-90", !forceHideHelperText && "hawa-mb-2") }, props.outsidePrefix), props.isLoading ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react8.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react8.default.createElement(
|
1511
1521
|
Skeleton,
|
1512
1522
|
{
|
1513
1523
|
animation: "none",
|
@@ -1554,13 +1564,15 @@ var Input = (0, import_react8.forwardRef)(
|
|
1554
1564
|
required: true,
|
1555
1565
|
dir: props.dir,
|
1556
1566
|
type: props.type,
|
1557
|
-
value: props.value,
|
1567
|
+
value: props.value || value,
|
1558
1568
|
onChange: handleChange,
|
1569
|
+
onKeyDown: handleKeyDown,
|
1559
1570
|
autoComplete: props.autoComplete,
|
1560
1571
|
defaultValue: props.defaultValue,
|
1561
1572
|
placeholder,
|
1562
1573
|
disabled: props.disabled || preview,
|
1563
1574
|
style: { height: 40 },
|
1575
|
+
maxLength: props.maxLength,
|
1564
1576
|
...inputProps,
|
1565
1577
|
className: cn(
|
1566
1578
|
defaultInputStyle,
|
package/dist/blocks/index.mjs
CHANGED
@@ -1244,6 +1244,7 @@ var Input = (0, import_react28.forwardRef)(
|
|
1244
1244
|
...props
|
1245
1245
|
}, ref) => {
|
1246
1246
|
var _a;
|
1247
|
+
const [value, setValue] = (0, import_react28.useState)(props.value || "");
|
1247
1248
|
let marginStyles = {
|
1248
1249
|
none: "hawa-mb-0",
|
1249
1250
|
normal: "hawa-mb-3",
|
@@ -1259,6 +1260,7 @@ var Input = (0, import_react28.forwardRef)(
|
|
1259
1260
|
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";
|
1260
1261
|
const handleChange = (e) => {
|
1261
1262
|
let newValue = e.target.value;
|
1263
|
+
setValue(newValue);
|
1262
1264
|
if (props.prefixText) {
|
1263
1265
|
if (newValue.length < props.prefixText.length) {
|
1264
1266
|
newValue = props.prefixText;
|
@@ -1270,10 +1272,27 @@ var Input = (0, import_react28.forwardRef)(
|
|
1270
1272
|
}
|
1271
1273
|
}
|
1272
1274
|
if (props.onChange) {
|
1273
|
-
|
1274
|
-
|
1275
|
+
if (props.type === "number" && props.maxLength) {
|
1276
|
+
console.log("type is ", props.type);
|
1277
|
+
console.log("max length is ", props.maxLength);
|
1278
|
+
let v = newValue.replace(/[^0-9]/g, "").slice(0, props.maxLength);
|
1279
|
+
const newEvent = { ...e, target: { ...e.target, value: v } };
|
1280
|
+
setValue(v);
|
1281
|
+
props.onChange(newEvent);
|
1282
|
+
} else {
|
1283
|
+
console.log("NETIHERRRER");
|
1284
|
+
const newEvent = { ...e, target: { ...e.target, value: newValue } };
|
1285
|
+
setValue(newValue);
|
1286
|
+
props.onChange(newEvent);
|
1287
|
+
}
|
1275
1288
|
}
|
1276
1289
|
};
|
1290
|
+
const handleKeyDown = (e) => {
|
1291
|
+
if (props.type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
|
1292
|
+
e.preventDefault();
|
1293
|
+
}
|
1294
|
+
props.onKeyDown && props.onKeyDown(e);
|
1295
|
+
};
|
1277
1296
|
return /* @__PURE__ */ import_react28.default.createElement(
|
1278
1297
|
"div",
|
1279
1298
|
{
|
@@ -1286,16 +1305,7 @@ var Input = (0, import_react28.forwardRef)(
|
|
1286
1305
|
)
|
1287
1306
|
},
|
1288
1307
|
props.label && /* @__PURE__ */ import_react28.default.createElement(Label, { ...labelProps }, props.label),
|
1289
|
-
/* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ import_react28.default.createElement(
|
1290
|
-
"span",
|
1291
|
-
{
|
1292
|
-
className: cn(
|
1293
|
-
"hawa-me-2 hawa-opacity-90",
|
1294
|
-
!forceHideHelperText && "hawa-mb-2"
|
1295
|
-
)
|
1296
|
-
},
|
1297
|
-
props.outsidePrefix
|
1298
|
-
), props.isLoading ? /* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react28.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react28.default.createElement(
|
1308
|
+
/* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ import_react28.default.createElement("span", { className: cn("hawa-me-2 hawa-opacity-90", !forceHideHelperText && "hawa-mb-2") }, props.outsidePrefix), props.isLoading ? /* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react28.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react28.default.createElement(
|
1299
1309
|
Skeleton,
|
1300
1310
|
{
|
1301
1311
|
animation: "none",
|
@@ -1342,13 +1352,15 @@ var Input = (0, import_react28.forwardRef)(
|
|
1342
1352
|
required: true,
|
1343
1353
|
dir: props.dir,
|
1344
1354
|
type: props.type,
|
1345
|
-
value: props.value,
|
1355
|
+
value: props.value || value,
|
1346
1356
|
onChange: handleChange,
|
1357
|
+
onKeyDown: handleKeyDown,
|
1347
1358
|
autoComplete: props.autoComplete,
|
1348
1359
|
defaultValue: props.defaultValue,
|
1349
1360
|
placeholder,
|
1350
1361
|
disabled: props.disabled || preview,
|
1351
1362
|
style: { height: 40 },
|
1363
|
+
maxLength: props.maxLength,
|
1352
1364
|
...inputProps,
|
1353
1365
|
className: cn(
|
1354
1366
|
defaultInputStyle,
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
} from "./chunk-6UOJKVIA.mjs";
|
8
8
|
|
9
9
|
// elements/input/Input.tsx
|
10
|
-
import React, { forwardRef } from "react";
|
10
|
+
import React, { forwardRef, useState } from "react";
|
11
11
|
var Input = forwardRef(
|
12
12
|
({
|
13
13
|
margin = "none",
|
@@ -22,6 +22,7 @@ var Input = forwardRef(
|
|
22
22
|
...props
|
23
23
|
}, ref) => {
|
24
24
|
var _a;
|
25
|
+
const [value, setValue] = useState(props.value || "");
|
25
26
|
let marginStyles = {
|
26
27
|
none: "hawa-mb-0",
|
27
28
|
normal: "hawa-mb-3",
|
@@ -37,6 +38,7 @@ var Input = forwardRef(
|
|
37
38
|
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";
|
38
39
|
const handleChange = (e) => {
|
39
40
|
let newValue = e.target.value;
|
41
|
+
setValue(newValue);
|
40
42
|
if (props.prefixText) {
|
41
43
|
if (newValue.length < props.prefixText.length) {
|
42
44
|
newValue = props.prefixText;
|
@@ -48,9 +50,26 @@ var Input = forwardRef(
|
|
48
50
|
}
|
49
51
|
}
|
50
52
|
if (props.onChange) {
|
51
|
-
|
52
|
-
|
53
|
+
if (props.type === "number" && props.maxLength) {
|
54
|
+
console.log("type is ", props.type);
|
55
|
+
console.log("max length is ", props.maxLength);
|
56
|
+
let v = newValue.replace(/[^0-9]/g, "").slice(0, props.maxLength);
|
57
|
+
const newEvent = { ...e, target: { ...e.target, value: v } };
|
58
|
+
setValue(v);
|
59
|
+
props.onChange(newEvent);
|
60
|
+
} else {
|
61
|
+
console.log("NETIHERRRER");
|
62
|
+
const newEvent = { ...e, target: { ...e.target, value: newValue } };
|
63
|
+
setValue(newValue);
|
64
|
+
props.onChange(newEvent);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
};
|
68
|
+
const handleKeyDown = (e) => {
|
69
|
+
if (props.type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
|
70
|
+
e.preventDefault();
|
53
71
|
}
|
72
|
+
props.onKeyDown && props.onKeyDown(e);
|
54
73
|
};
|
55
74
|
return /* @__PURE__ */ React.createElement(
|
56
75
|
"div",
|
@@ -64,16 +83,7 @@ var Input = forwardRef(
|
|
64
83
|
)
|
65
84
|
},
|
66
85
|
props.label && /* @__PURE__ */ React.createElement(Label, { ...labelProps }, props.label),
|
67
|
-
/* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ React.createElement(
|
68
|
-
"span",
|
69
|
-
{
|
70
|
-
className: cn(
|
71
|
-
"hawa-me-2 hawa-opacity-90",
|
72
|
-
!forceHideHelperText && "hawa-mb-2"
|
73
|
-
)
|
74
|
-
},
|
75
|
-
props.outsidePrefix
|
76
|
-
), props.isLoading ? /* @__PURE__ */ React.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ React.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React.createElement(
|
86
|
+
/* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ React.createElement("span", { className: cn("hawa-me-2 hawa-opacity-90", !forceHideHelperText && "hawa-mb-2") }, props.outsidePrefix), props.isLoading ? /* @__PURE__ */ React.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ React.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React.createElement(
|
77
87
|
Skeleton,
|
78
88
|
{
|
79
89
|
animation: "none",
|
@@ -120,13 +130,15 @@ var Input = forwardRef(
|
|
120
130
|
required: true,
|
121
131
|
dir: props.dir,
|
122
132
|
type: props.type,
|
123
|
-
value: props.value,
|
133
|
+
value: props.value || value,
|
124
134
|
onChange: handleChange,
|
135
|
+
onKeyDown: handleKeyDown,
|
125
136
|
autoComplete: props.autoComplete,
|
126
137
|
defaultValue: props.defaultValue,
|
127
138
|
placeholder,
|
128
139
|
disabled: props.disabled || preview,
|
129
140
|
style: { height: 40 },
|
141
|
+
maxLength: props.maxLength,
|
130
142
|
...inputProps,
|
131
143
|
className: cn(
|
132
144
|
defaultInputStyle,
|
@@ -171,7 +171,7 @@ var Alert = ({
|
|
171
171
|
};
|
172
172
|
|
173
173
|
// elements/input/Input.tsx
|
174
|
-
import React2, { forwardRef } from "react";
|
174
|
+
import React2, { forwardRef, useState as useState2 } from "react";
|
175
175
|
var Input = forwardRef(
|
176
176
|
({
|
177
177
|
margin = "none",
|
@@ -186,6 +186,7 @@ var Input = forwardRef(
|
|
186
186
|
...props
|
187
187
|
}, ref) => {
|
188
188
|
var _a;
|
189
|
+
const [value, setValue] = useState2(props.value || "");
|
189
190
|
let marginStyles = {
|
190
191
|
none: "hawa-mb-0",
|
191
192
|
normal: "hawa-mb-3",
|
@@ -201,6 +202,7 @@ var Input = forwardRef(
|
|
201
202
|
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";
|
202
203
|
const handleChange = (e) => {
|
203
204
|
let newValue = e.target.value;
|
205
|
+
setValue(newValue);
|
204
206
|
if (props.prefixText) {
|
205
207
|
if (newValue.length < props.prefixText.length) {
|
206
208
|
newValue = props.prefixText;
|
@@ -212,10 +214,27 @@ var Input = forwardRef(
|
|
212
214
|
}
|
213
215
|
}
|
214
216
|
if (props.onChange) {
|
215
|
-
|
216
|
-
|
217
|
+
if (props.type === "number" && props.maxLength) {
|
218
|
+
console.log("type is ", props.type);
|
219
|
+
console.log("max length is ", props.maxLength);
|
220
|
+
let v = newValue.replace(/[^0-9]/g, "").slice(0, props.maxLength);
|
221
|
+
const newEvent = { ...e, target: { ...e.target, value: v } };
|
222
|
+
setValue(v);
|
223
|
+
props.onChange(newEvent);
|
224
|
+
} else {
|
225
|
+
console.log("NETIHERRRER");
|
226
|
+
const newEvent = { ...e, target: { ...e.target, value: newValue } };
|
227
|
+
setValue(newValue);
|
228
|
+
props.onChange(newEvent);
|
229
|
+
}
|
217
230
|
}
|
218
231
|
};
|
232
|
+
const handleKeyDown = (e) => {
|
233
|
+
if (props.type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
|
234
|
+
e.preventDefault();
|
235
|
+
}
|
236
|
+
props.onKeyDown && props.onKeyDown(e);
|
237
|
+
};
|
219
238
|
return /* @__PURE__ */ React2.createElement(
|
220
239
|
"div",
|
221
240
|
{
|
@@ -228,16 +247,7 @@ var Input = forwardRef(
|
|
228
247
|
)
|
229
248
|
},
|
230
249
|
props.label && /* @__PURE__ */ React2.createElement(Label, { ...labelProps }, props.label),
|
231
|
-
/* @__PURE__ */ React2.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ React2.createElement(
|
232
|
-
"span",
|
233
|
-
{
|
234
|
-
className: cn(
|
235
|
-
"hawa-me-2 hawa-opacity-90",
|
236
|
-
!forceHideHelperText && "hawa-mb-2"
|
237
|
-
)
|
238
|
-
},
|
239
|
-
props.outsidePrefix
|
240
|
-
), props.isLoading ? /* @__PURE__ */ React2.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React2.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ React2.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React2.createElement(
|
250
|
+
/* @__PURE__ */ React2.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ React2.createElement("span", { className: cn("hawa-me-2 hawa-opacity-90", !forceHideHelperText && "hawa-mb-2") }, props.outsidePrefix), props.isLoading ? /* @__PURE__ */ React2.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React2.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ React2.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React2.createElement(
|
241
251
|
Skeleton,
|
242
252
|
{
|
243
253
|
animation: "none",
|
@@ -284,13 +294,15 @@ var Input = forwardRef(
|
|
284
294
|
required: true,
|
285
295
|
dir: props.dir,
|
286
296
|
type: props.type,
|
287
|
-
value: props.value,
|
297
|
+
value: props.value || value,
|
288
298
|
onChange: handleChange,
|
299
|
+
onKeyDown: handleKeyDown,
|
289
300
|
autoComplete: props.autoComplete,
|
290
301
|
defaultValue: props.defaultValue,
|
291
302
|
placeholder,
|
292
303
|
disabled: props.disabled || preview,
|
293
304
|
style: { height: 40 },
|
305
|
+
maxLength: props.maxLength,
|
294
306
|
...inputProps,
|
295
307
|
className: cn(
|
296
308
|
defaultInputStyle,
|
@@ -517,7 +529,7 @@ var Select = ({
|
|
517
529
|
};
|
518
530
|
|
519
531
|
// elements/phoneInput/PhoneInput.tsx
|
520
|
-
import React4, { useState as
|
532
|
+
import React4, { useState as useState3, useRef as useRef2 } from "react";
|
521
533
|
|
522
534
|
// countries.ts
|
523
535
|
var countries = [
|
@@ -2219,8 +2231,8 @@ var PhoneInput = ({
|
|
2219
2231
|
countryCodes,
|
2220
2232
|
...props
|
2221
2233
|
}) => {
|
2222
|
-
const [phoneNumber, setPhoneNumber] =
|
2223
|
-
const [countryCode, setCountryCode] =
|
2234
|
+
const [phoneNumber, setPhoneNumber] = useState3("");
|
2235
|
+
const [countryCode, setCountryCode] = useState3(props.preferredCountry);
|
2224
2236
|
const inputRef = useRef2(null);
|
2225
2237
|
const handleInputChange = (e) => {
|
2226
2238
|
console.log("test e ", e.target.value);
|
@@ -2629,7 +2641,7 @@ var PopoverPortal = PopoverPrimitive.Portal;
|
|
2629
2641
|
var PopoverRoot = PopoverPrimitive.Root;
|
2630
2642
|
|
2631
2643
|
// elements/radio/Radio.tsx
|
2632
|
-
import React9, { useState as
|
2644
|
+
import React9, { useState as useState4, useRef as useRef3, useEffect as useEffect3, forwardRef as forwardRef7 } from "react";
|
2633
2645
|
import { TabsList, TabsTrigger, Tabs } from "@radix-ui/react-tabs";
|
2634
2646
|
var Radio = forwardRef7(
|
2635
2647
|
({
|
@@ -2667,10 +2679,10 @@ var Radio = forwardRef7(
|
|
2667
2679
|
const [parentDirection, setParentDirection] = React9.useState(
|
2668
2680
|
null
|
2669
2681
|
);
|
2670
|
-
const [selectedOption, setSelectedOption] =
|
2682
|
+
const [selectedOption, setSelectedOption] = useState4(
|
2671
2683
|
props.defaultValue || props.value
|
2672
2684
|
);
|
2673
|
-
const [openTooltip, setOpenTooltip] =
|
2685
|
+
const [openTooltip, setOpenTooltip] = useState4(null);
|
2674
2686
|
const parentRef = useRef3(null);
|
2675
2687
|
useEffect3(() => {
|
2676
2688
|
var _a2;
|
package/dist/dataTable/index.js
CHANGED
@@ -1078,6 +1078,7 @@ var Input = (0, import_react6.forwardRef)(
|
|
1078
1078
|
...props
|
1079
1079
|
}, ref) => {
|
1080
1080
|
var _a;
|
1081
|
+
const [value, setValue] = (0, import_react6.useState)(props.value || "");
|
1081
1082
|
let marginStyles = {
|
1082
1083
|
none: "hawa-mb-0",
|
1083
1084
|
normal: "hawa-mb-3",
|
@@ -1093,6 +1094,7 @@ var Input = (0, import_react6.forwardRef)(
|
|
1093
1094
|
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";
|
1094
1095
|
const handleChange = (e) => {
|
1095
1096
|
let newValue = e.target.value;
|
1097
|
+
setValue(newValue);
|
1096
1098
|
if (props.prefixText) {
|
1097
1099
|
if (newValue.length < props.prefixText.length) {
|
1098
1100
|
newValue = props.prefixText;
|
@@ -1104,9 +1106,26 @@ var Input = (0, import_react6.forwardRef)(
|
|
1104
1106
|
}
|
1105
1107
|
}
|
1106
1108
|
if (props.onChange) {
|
1107
|
-
|
1108
|
-
|
1109
|
+
if (props.type === "number" && props.maxLength) {
|
1110
|
+
console.log("type is ", props.type);
|
1111
|
+
console.log("max length is ", props.maxLength);
|
1112
|
+
let v = newValue.replace(/[^0-9]/g, "").slice(0, props.maxLength);
|
1113
|
+
const newEvent = { ...e, target: { ...e.target, value: v } };
|
1114
|
+
setValue(v);
|
1115
|
+
props.onChange(newEvent);
|
1116
|
+
} else {
|
1117
|
+
console.log("NETIHERRRER");
|
1118
|
+
const newEvent = { ...e, target: { ...e.target, value: newValue } };
|
1119
|
+
setValue(newValue);
|
1120
|
+
props.onChange(newEvent);
|
1121
|
+
}
|
1122
|
+
}
|
1123
|
+
};
|
1124
|
+
const handleKeyDown = (e) => {
|
1125
|
+
if (props.type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
|
1126
|
+
e.preventDefault();
|
1109
1127
|
}
|
1128
|
+
props.onKeyDown && props.onKeyDown(e);
|
1110
1129
|
};
|
1111
1130
|
return /* @__PURE__ */ import_react6.default.createElement(
|
1112
1131
|
"div",
|
@@ -1120,16 +1139,7 @@ var Input = (0, import_react6.forwardRef)(
|
|
1120
1139
|
)
|
1121
1140
|
},
|
1122
1141
|
props.label && /* @__PURE__ */ import_react6.default.createElement(Label, { ...labelProps }, props.label),
|
1123
|
-
/* @__PURE__ */ import_react6.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ import_react6.default.createElement(
|
1124
|
-
"span",
|
1125
|
-
{
|
1126
|
-
className: cn(
|
1127
|
-
"hawa-me-2 hawa-opacity-90",
|
1128
|
-
!forceHideHelperText && "hawa-mb-2"
|
1129
|
-
)
|
1130
|
-
},
|
1131
|
-
props.outsidePrefix
|
1132
|
-
), props.isLoading ? /* @__PURE__ */ import_react6.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react6.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ import_react6.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react6.default.createElement(
|
1142
|
+
/* @__PURE__ */ import_react6.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ import_react6.default.createElement("span", { className: cn("hawa-me-2 hawa-opacity-90", !forceHideHelperText && "hawa-mb-2") }, props.outsidePrefix), props.isLoading ? /* @__PURE__ */ import_react6.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react6.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ import_react6.default.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ import_react6.default.createElement(
|
1133
1143
|
Skeleton,
|
1134
1144
|
{
|
1135
1145
|
animation: "none",
|
@@ -1176,13 +1186,15 @@ var Input = (0, import_react6.forwardRef)(
|
|
1176
1186
|
required: true,
|
1177
1187
|
dir: props.dir,
|
1178
1188
|
type: props.type,
|
1179
|
-
value: props.value,
|
1189
|
+
value: props.value || value,
|
1180
1190
|
onChange: handleChange,
|
1191
|
+
onKeyDown: handleKeyDown,
|
1181
1192
|
autoComplete: props.autoComplete,
|
1182
1193
|
defaultValue: props.defaultValue,
|
1183
1194
|
placeholder,
|
1184
1195
|
disabled: props.disabled || preview,
|
1185
1196
|
style: { height: 40 },
|
1197
|
+
maxLength: props.maxLength,
|
1186
1198
|
...inputProps,
|
1187
1199
|
className: cn(
|
1188
1200
|
defaultInputStyle,
|