next-helios-fe 1.8.118 → 1.8.120

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-helios-fe",
3
- "version": "1.8.118",
3
+ "version": "1.8.120",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -78,18 +78,18 @@ export const Checkbox: React.FC<CheckboxProps> = ({
78
78
  )}
79
79
  </div>
80
80
  )}
81
- <button
82
- type="button"
83
- className={`flex items-center justify-start w-8 h-5 border rounded-full bg-secondary-bg overflow-hidden cursor-pointer duration-300 group-has-[:checked]/checkbox:justify-end group-has-[:checked]/checkbox:bg-primary group-has-[:disabled]/checkbox:bg-secondary-light group-has-[:disabled:checked]/checkbox:bg-secondary-dark focus:outline-none focus:ring-1 focus:ring-primary focus:ring-offset-0 focus:shadow focus:shadow-primary focus:border-primary-dark ${
84
- options?.variant !== "switch" && "hidden"
85
- }`}
86
- disabled={rest.disabled}
87
- onClick={() => {
88
- inputRef.current?.click();
89
- }}
90
- >
91
- <div className="w-4 h-4 rounded-full bg-secondary duration-300 group-has-[:checked]/checkbox:bg-secondary-bg group-has-[:disabled]/checkbox:bg-secondary-dark group-has-[:disabled:checked]/checkbox:bg-secondary-bg"></div>
92
- </button>
81
+ {options?.variant === "switch" && (
82
+ <button
83
+ type="button"
84
+ className="flex items-center justify-start w-8 h-5 border rounded-full bg-secondary-bg overflow-hidden cursor-pointer duration-300 group-has-[:checked]/checkbox:justify-end group-has-[:checked]/checkbox:bg-primary group-has-[:disabled]/checkbox:bg-secondary-light group-has-[:disabled:checked]/checkbox:bg-secondary-dark focus:outline-none focus:ring-1 focus:ring-primary focus:ring-offset-0 focus:shadow focus:shadow-primary focus:border-primary-dark"
85
+ disabled={rest.disabled}
86
+ onClick={() => {
87
+ inputRef.current?.click();
88
+ }}
89
+ >
90
+ <div className="w-4 h-4 rounded-full bg-secondary duration-300 group-has-[:checked]/checkbox:bg-secondary-bg group-has-[:disabled]/checkbox:bg-secondary-dark group-has-[:disabled:checked]/checkbox:bg-secondary-bg"></div>
91
+ </button>
92
+ )}
93
93
  </label>
94
94
  );
95
95
  };
@@ -1466,15 +1466,18 @@ export interface PhoneNumberProps
1466
1466
  width?: "full" | "fit";
1467
1467
  height?: "short" | "medium" | "high";
1468
1468
  };
1469
+ selectedCountryDialCode?: (dialCode: any) => void;
1469
1470
  }
1470
1471
 
1471
1472
  export const PhoneNumber: React.FC<PhoneNumberProps> = ({
1472
1473
  options,
1473
1474
  label,
1474
1475
  description,
1476
+ selectedCountryDialCode,
1475
1477
  ...rest
1476
1478
  }) => {
1477
- const inputRef = useRef<HTMLDivElement>(null);
1479
+ const inputRef = useRef<HTMLInputElement>(null);
1480
+ const divInputRef = useRef<HTMLDivElement>(null);
1478
1481
  const dropdownRef = useRef<HTMLButtonElement>(null);
1479
1482
  const [tempValue, setTempValue] = useState("");
1480
1483
  const [selectedCountry, setSelectedCountry] = useState("62");
@@ -1538,6 +1541,20 @@ export const PhoneNumber: React.FC<PhoneNumberProps> = ({
1538
1541
  }
1539
1542
  }, [rest.value, rest.defaultValue]);
1540
1543
 
1544
+ useEffect(() => {
1545
+ if (tempValue.startsWith(selectedCountry)) {
1546
+ inputRef.current?.setCustomValidity("Please enter a valid phone number.");
1547
+ } else {
1548
+ inputRef.current?.setCustomValidity("");
1549
+ }
1550
+ }, [tempValue, selectedCountry]);
1551
+
1552
+ useEffect(() => {
1553
+ if (selectedCountryDialCode) {
1554
+ selectedCountryDialCode(selectedCountry);
1555
+ }
1556
+ }, [selectedCountryDialCode, selectedCountry]);
1557
+
1541
1558
  return (
1542
1559
  <div className="flex flex-row-reverse items-end">
1543
1560
  <label className={`flex flex-col gap-2 ${width}`}>
@@ -1563,12 +1580,13 @@ export const PhoneNumber: React.FC<PhoneNumberProps> = ({
1563
1580
  )}
1564
1581
  </div>
1565
1582
  )}
1566
- <div ref={inputRef} className="flex flex-row-reverse gap-4">
1583
+ <div ref={divInputRef} className="flex flex-row-reverse gap-4">
1567
1584
  <div className="relative flex-1 flex items-center">
1568
1585
  <div className="absolute left-0 flex justify-center w-14 border-r">
1569
1586
  <span className="text-disabled">{`+${selectedCountry}`}</span>
1570
1587
  </div>
1571
1588
  <input
1589
+ ref={inputRef}
1572
1590
  type="text"
1573
1591
  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}`}
1574
1592
  placeholder="Phone number"
@@ -1585,14 +1603,6 @@ export const PhoneNumber: React.FC<PhoneNumberProps> = ({
1585
1603
  value: `${selectedCountry}${e.target.value}`,
1586
1604
  } as HTMLInputElement,
1587
1605
  } 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
1606
  }
1597
1607
  }}
1598
1608
  />
@@ -1622,7 +1632,7 @@ export const PhoneNumber: React.FC<PhoneNumberProps> = ({
1622
1632
  setOpenDropdown(true);
1623
1633
  dropdownRef.current?.click();
1624
1634
  setDropdownWidth(
1625
- inputRef?.current?.getBoundingClientRect()?.width || 0
1635
+ divInputRef?.current?.getBoundingClientRect()?.width || 0
1626
1636
  );
1627
1637
  }}
1628
1638
  />
@@ -636,14 +636,16 @@ export const Table: TableComponentProps = ({
636
636
  </Dropdown>
637
637
  )}
638
638
  {options?.toolbar?.search?.show !== false && (
639
- <Form.Search
640
- options={{ width: "fit" }}
641
- placeholder="Search..."
642
- value={search}
643
- onChange={(e) => {
644
- setSearch(e.target.value);
645
- }}
646
- />
639
+ <div className="min-w-40">
640
+ <Form.Search
641
+ options={{ width: "fit" }}
642
+ placeholder="Search..."
643
+ value={search}
644
+ onChange={(e) => {
645
+ setSearch(e.target.value);
646
+ }}
647
+ />
648
+ </div>
647
649
  )}
648
650
  {options?.toolbar?.export?.show !== false && (
649
651
  <Button