next-helios-fe 1.8.116 → 1.8.118
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/package.json
CHANGED
@@ -28,7 +28,14 @@ interface ChartProps {
|
|
28
28
|
labels?: string[];
|
29
29
|
series: any;
|
30
30
|
xaxis?: {
|
31
|
-
categories
|
31
|
+
categories?: string[];
|
32
|
+
datetime?: boolean;
|
33
|
+
min?: number;
|
34
|
+
max?: number;
|
35
|
+
};
|
36
|
+
yaxis?: {
|
37
|
+
min?: number;
|
38
|
+
max?: number;
|
32
39
|
};
|
33
40
|
options?: {
|
34
41
|
theme?: "light" | "dark";
|
@@ -47,6 +54,7 @@ export const Chart: React.FC<ChartProps> = ({
|
|
47
54
|
series,
|
48
55
|
labels,
|
49
56
|
xaxis,
|
57
|
+
yaxis,
|
50
58
|
options,
|
51
59
|
}) => {
|
52
60
|
const areaOptions = type === "area" && {
|
@@ -75,11 +83,36 @@ export const Chart: React.FC<ChartProps> = ({
|
|
75
83
|
align: "left",
|
76
84
|
},
|
77
85
|
xaxis: {
|
78
|
-
|
86
|
+
...(xaxis?.datetime
|
87
|
+
? {
|
88
|
+
type: "datetime",
|
89
|
+
}
|
90
|
+
: {}),
|
91
|
+
...(xaxis?.categories ? { categories: xaxis?.categories } : {}),
|
79
92
|
labels: {
|
93
|
+
...(xaxis?.datetime
|
94
|
+
? {
|
95
|
+
datetimeFormatter: {
|
96
|
+
year: "yyyy",
|
97
|
+
month: "MMM 'yy",
|
98
|
+
day: "dd MMM",
|
99
|
+
hour: "HH:mm",
|
100
|
+
},
|
101
|
+
}
|
102
|
+
: {}),
|
80
103
|
maxHeight: 40,
|
81
104
|
},
|
105
|
+
...(xaxis?.min ? { min: xaxis?.min } : {}),
|
106
|
+
...(xaxis?.max ? { min: xaxis?.max } : {}),
|
82
107
|
},
|
108
|
+
...(yaxis?.min !== undefined || yaxis?.max !== undefined
|
109
|
+
? {
|
110
|
+
yaxis: {
|
111
|
+
...(yaxis?.min ? { min: yaxis?.min } : {}),
|
112
|
+
...(yaxis?.max ? { min: yaxis?.max } : {}),
|
113
|
+
},
|
114
|
+
}
|
115
|
+
: {}),
|
83
116
|
labels: labels ?? [],
|
84
117
|
colors: options?.mainColor
|
85
118
|
? [
|
@@ -164,6 +197,11 @@ export const Chart: React.FC<ChartProps> = ({
|
|
164
197
|
tooltip: {
|
165
198
|
theme: options?.theme === "light" ? "light" : "dark",
|
166
199
|
fillSeriesColor: false,
|
200
|
+
...(xaxis?.datetime
|
201
|
+
? {
|
202
|
+
x: { format: "dd MMM yyyy" },
|
203
|
+
}
|
204
|
+
: {}),
|
167
205
|
},
|
168
206
|
grid: {
|
169
207
|
borderColor: options?.theme === "light" ? "#e5e6e8" : "#545869",
|
@@ -1476,6 +1476,7 @@ export const PhoneNumber: React.FC<PhoneNumberProps> = ({
|
|
1476
1476
|
}) => {
|
1477
1477
|
const inputRef = useRef<HTMLDivElement>(null);
|
1478
1478
|
const dropdownRef = useRef<HTMLButtonElement>(null);
|
1479
|
+
const [tempValue, setTempValue] = useState("");
|
1479
1480
|
const [selectedCountry, setSelectedCountry] = useState("62");
|
1480
1481
|
const [openDropdown, setOpenDropdown] = useState(false);
|
1481
1482
|
const [dropdownWidth, setDropdownWidth] = useState<number>(0);
|
@@ -1497,12 +1498,38 @@ export const PhoneNumber: React.FC<PhoneNumberProps> = ({
|
|
1497
1498
|
|
1498
1499
|
useEffect(() => {
|
1499
1500
|
if (rest.value) {
|
1501
|
+
setTempValue(
|
1502
|
+
(rest.value as string).replace(
|
1503
|
+
new RegExp(
|
1504
|
+
`^${
|
1505
|
+
countryPhoneCode.find((item) =>
|
1506
|
+
(rest.value as string).startsWith(item.dial_code)
|
1507
|
+
)?.dial_code
|
1508
|
+
}`
|
1509
|
+
),
|
1510
|
+
""
|
1511
|
+
)
|
1512
|
+
);
|
1513
|
+
|
1500
1514
|
setSelectedCountry(
|
1501
1515
|
countryPhoneCode.find((item) =>
|
1502
1516
|
(rest.value as string).startsWith(item.dial_code)
|
1503
1517
|
)?.dial_code || ""
|
1504
1518
|
);
|
1505
1519
|
} else if (rest.defaultValue) {
|
1520
|
+
setTempValue(
|
1521
|
+
(rest.defaultValue as string).replace(
|
1522
|
+
new RegExp(
|
1523
|
+
`^${
|
1524
|
+
countryPhoneCode.find((item) =>
|
1525
|
+
(rest.value as string).startsWith(item.dial_code)
|
1526
|
+
)?.dial_code
|
1527
|
+
}`
|
1528
|
+
),
|
1529
|
+
""
|
1530
|
+
)
|
1531
|
+
);
|
1532
|
+
|
1506
1533
|
setSelectedCountry(
|
1507
1534
|
countryPhoneCode.find((item) =>
|
1508
1535
|
(rest.defaultValue as string).startsWith(item.dial_code)
|
@@ -1542,19 +1569,31 @@ export const PhoneNumber: React.FC<PhoneNumberProps> = ({
|
|
1542
1569
|
<span className="text-disabled">{`+${selectedCountry}`}</span>
|
1543
1570
|
</div>
|
1544
1571
|
<input
|
1545
|
-
type="
|
1572
|
+
type="text"
|
1546
1573
|
className={`w-full ps-16 pe-4 border-default border rounded-md bg-secondary-bg [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none placeholder:duration-300 placeholder:translate-x-0 focus:placeholder:translate-x-1 placeholder:text-silent focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:text-disabled ${height}`}
|
1547
1574
|
placeholder="Phone number"
|
1548
1575
|
required={rest.required}
|
1549
1576
|
disabled={rest.disabled}
|
1550
|
-
value={
|
1577
|
+
value={tempValue || ""}
|
1551
1578
|
onChange={(e) => {
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1579
|
+
if (/^\d*$/.test(e.target.value)) {
|
1580
|
+
setTempValue(e.target.value);
|
1581
|
+
|
1582
|
+
rest.onChange &&
|
1583
|
+
rest.onChange({
|
1584
|
+
target: {
|
1585
|
+
value: `${selectedCountry}${e.target.value}`,
|
1586
|
+
} as HTMLInputElement,
|
1587
|
+
} as any);
|
1588
|
+
|
1589
|
+
if (e.target.value.startsWith(selectedCountry)) {
|
1590
|
+
e.target.setCustomValidity(
|
1591
|
+
"Please enter a valid phone number."
|
1592
|
+
);
|
1593
|
+
} else {
|
1594
|
+
e.target.setCustomValidity("");
|
1595
|
+
}
|
1596
|
+
}
|
1558
1597
|
}}
|
1559
1598
|
/>
|
1560
1599
|
</div>
|