bianic-ui 1.9.3 → 1.10.0

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 (55) hide show
  1. package/dist/cjs/index.js +597 -129
  2. package/dist/cjs/lib.css +1 -1
  3. package/dist/cjs/types/components/Forms/DatePicker/DatePicker.d.ts +6 -0
  4. package/dist/cjs/types/components/Forms/DatePicker/DatePickerSimulation.d.ts +3 -0
  5. package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar.d.ts +7 -0
  6. package/dist/cjs/types/components/Forms/DatePicker/index.d.ts +1 -0
  7. package/dist/cjs/types/components/Forms/Dropdown/DropdownItem.d.ts +5 -2
  8. package/dist/cjs/types/components/Forms/Dropdown/config.d.ts +6 -2
  9. package/dist/cjs/types/components/Forms/SegmentButton/SegmentButtonItem.d.ts +1 -1
  10. package/dist/cjs/types/components/Forms/SegmentButton/config.d.ts +7 -1
  11. package/dist/cjs/types/components/Forms/SelectInput/Example/CustomDropdown.d.ts +3 -0
  12. package/dist/cjs/types/components/Forms/SelectInput/PropsInterface.d.ts +4 -1
  13. package/dist/cjs/types/components/Forms/SelectInput/index.d.ts +1 -1
  14. package/dist/cjs/types/components/Forms/TextInput/PropsInterface.d.ts +2 -2
  15. package/dist/cjs/types/components/Forms/TextInput/index.d.ts +1 -1
  16. package/dist/cjs/types/components/Forms/index.d.ts +1 -0
  17. package/dist/cjs/types/components/index.d.ts +1 -1
  18. package/dist/cjs/types/stories/Form/DatePicker/Datepicker.stories.d.ts +14 -0
  19. package/dist/cjs/types/stories/Form/DatePicker/DatepickerSimulation.stories.d.ts +13 -0
  20. package/dist/cjs/types/stories/Form/SegmentButton.stories.d.ts +1 -0
  21. package/dist/cjs/types/stories/Form/SelectInput/SelectInput.stories.d.ts +0 -1
  22. package/dist/cjs/types/stories/Form/SelectInput/SelectInputCustom.stories.d.ts +13 -0
  23. package/dist/cjs/types/utility/helper.d.ts +1 -1
  24. package/dist/esm/index.js +597 -130
  25. package/dist/esm/lib.css +1 -1
  26. package/dist/esm/types/components/Forms/DatePicker/DatePicker.d.ts +6 -0
  27. package/dist/esm/types/components/Forms/DatePicker/DatePickerSimulation.d.ts +3 -0
  28. package/dist/esm/types/components/Forms/DatePicker/PickerCalendar.d.ts +7 -0
  29. package/dist/esm/types/components/Forms/DatePicker/index.d.ts +1 -0
  30. package/dist/esm/types/components/Forms/Dropdown/DropdownItem.d.ts +5 -2
  31. package/dist/esm/types/components/Forms/Dropdown/config.d.ts +6 -2
  32. package/dist/esm/types/components/Forms/SegmentButton/SegmentButtonItem.d.ts +1 -1
  33. package/dist/esm/types/components/Forms/SegmentButton/config.d.ts +7 -1
  34. package/dist/esm/types/components/Forms/SelectInput/Example/CustomDropdown.d.ts +3 -0
  35. package/dist/esm/types/components/Forms/SelectInput/PropsInterface.d.ts +4 -1
  36. package/dist/esm/types/components/Forms/SelectInput/index.d.ts +1 -1
  37. package/dist/esm/types/components/Forms/TextInput/PropsInterface.d.ts +2 -2
  38. package/dist/esm/types/components/Forms/TextInput/index.d.ts +1 -1
  39. package/dist/esm/types/components/Forms/index.d.ts +1 -0
  40. package/dist/esm/types/components/index.d.ts +1 -1
  41. package/dist/esm/types/stories/Form/DatePicker/Datepicker.stories.d.ts +14 -0
  42. package/dist/esm/types/stories/Form/DatePicker/DatepickerSimulation.stories.d.ts +13 -0
  43. package/dist/esm/types/stories/Form/SegmentButton.stories.d.ts +1 -0
  44. package/dist/esm/types/stories/Form/SelectInput/SelectInput.stories.d.ts +0 -1
  45. package/dist/esm/types/stories/Form/SelectInput/SelectInputCustom.stories.d.ts +13 -0
  46. package/dist/esm/types/utility/helper.d.ts +1 -1
  47. package/dist/index.d.ts +31 -21
  48. package/package.json +1 -1
  49. package/src/style/color.css +29 -29
  50. package/src/style/scrollbar.css +24 -5
  51. package/tailwind.config.js +26 -26
  52. package/dist/cjs/types/components/Dump.d.ts +0 -3
  53. package/dist/cjs/types/context/DropdownContext.d.ts +0 -12
  54. package/dist/esm/types/components/Dump.d.ts +0 -3
  55. package/dist/esm/types/context/DropdownContext.d.ts +0 -12
package/dist/esm/index.js CHANGED
@@ -263,13 +263,20 @@ var childrenElement = function (element) {
263
263
  var validUnion = function (value, union) {
264
264
  return union.includes(value) ? value : union[0];
265
265
  };
266
- var useDetectOutsideClick = function (ref, initialState, event) {
266
+ var useDetectOutsideClick = function (ref, initialState, ignoreRef, event) {
267
267
  if (event === void 0) { event = 'click'; }
268
268
  var _a = useState(initialState), isActive = _a[0], setIsActive = _a[1];
269
269
  useEffect(function () {
270
270
  var pageClickEvent = function (event) {
271
271
  // If the active element exists and is clicked outside of
272
- if (ref.current !== null && !ref.current.contains(event.target)) {
272
+ if (ignoreRef &&
273
+ ignoreRef.current &&
274
+ ignoreRef.current.contains(event.target)) {
275
+ console.log('enter');
276
+ }
277
+ else if (ref.current !== null &&
278
+ !ref.current.contains(event.target)) {
279
+ console.log('close');
273
280
  setIsActive(!isActive);
274
281
  }
275
282
  };
@@ -412,7 +419,7 @@ var radiusConfig$1 = {
412
419
  tn: 'rounded-radius-full focus-visible:rounded-radius-full',
413
420
  },
414
421
  };
415
- var sizeConfig$d = {
422
+ var sizeConfig$c = {
416
423
  lg: 'py-[10.5px] h-[48px] flex items-center justify-center gap-[10px] text-size-md ',
417
424
  md: 'py-[9px] h-[40px] flex items-center justify-center gap-[5px] text-size-base ',
418
425
  sm: 'py-[6px] h-[30px] flex items-center justify-center gap-[5px] text-size-sm ',
@@ -490,10 +497,10 @@ function Button(_a) {
490
497
  }
491
498
  var sizingRules;
492
499
  if (variant.includes('link')) {
493
- sizingRules = "".concat(sizeConfig$d[validatedSize]);
500
+ sizingRules = "".concat(sizeConfig$c[validatedSize]);
494
501
  }
495
502
  else {
496
- sizingRules = "".concat(sizeConfig$d[validatedSize], " ").concat(sidePaddingConfig[validatedSize]);
503
+ sizingRules = "".concat(sizeConfig$c[validatedSize], " ").concat(sidePaddingConfig[validatedSize]);
497
504
  }
498
505
  var sizeClass = label || variant === 'form-group'
499
506
  ? " ".concat(minWidthRules, " ").concat(sizingRules)
@@ -1481,8 +1488,8 @@ var colorConfig$1 = {
1481
1488
  active: 'bg-bia-verdantgreen-dark-40 text-primary-white',
1482
1489
  },
1483
1490
  blue: {
1484
- default: 'bg-bia-olympicblue hover:bg-bia-olympicblue-light-10 active:bg-bia-olympicblue-dark-10 text-primary-white disabled:bg-bia-olympicblue-dark-20 disabled:text-primary-white/50 disabled:cursor-default',
1485
- active: 'bg-bia-olympicblue-dark-10 text-primary-white',
1491
+ default: 'bg-bia-crayola hover:bg-bia-crayola-light-10 active:bg-bia-crayola-dark-10 text-primary-white disabled:bg-bia-crayola-dark-20 disabled:text-primary-white/50 disabled:cursor-default',
1492
+ active: 'bg-bia-crayola-dark-10 text-primary-white',
1486
1493
  },
1487
1494
  };
1488
1495
 
@@ -1549,12 +1556,12 @@ function Color() {
1549
1556
  tailwind: 'blue',
1550
1557
  },
1551
1558
  {
1552
- css: 'olympic',
1553
- tailwind: 'olympicblue',
1559
+ css: 'crayola',
1560
+ tailwind: 'crayola',
1554
1561
  },
1555
1562
  {
1556
1563
  css: 'sky',
1557
- tailwind: 'skyblue',
1564
+ tailwind: 'sky',
1558
1565
  },
1559
1566
  {
1560
1567
  css: 'coolgrey',
@@ -1783,7 +1790,7 @@ MenuItem.defaultProps = {
1783
1790
  onClick: function () { },
1784
1791
  };
1785
1792
 
1786
- var sizeConfig$c = {
1793
+ var sizeConfig$b = {
1787
1794
  md: {
1788
1795
  fieldSize: 'text-size-base p-2.5 font-[350] h-10',
1789
1796
  iconPosition: 'right-[10px]',
@@ -1839,13 +1846,13 @@ function PasswordIcon(_a) {
1839
1846
  }
1840
1847
 
1841
1848
  function TextInput(_a) {
1842
- var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, icon = _a.icon, _c = _a.id, id = _c === void 0 ? '' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.isValid, isValid = _e === void 0 ? null : _e, label = _a.label, _f = _a.placeholder, placeholder = _f === void 0 ? '' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.required, required = _h === void 0 ? false : _h, _j = _a.variant, variant = _j === void 0 ? 'text' : _j, _k = _a.value, value = _k === void 0 ? undefined : _k, _l = _a.onChange, onChange = _l === void 0 ? function () { } : _l, _m = _a.maxLength, maxLength = _m === void 0 ? undefined : _m, _o = _a.inputClassName, inputClassName = _o === void 0 ? '' : _o; _a.isFlatRight; var actionElement = _a.actionElement, _q = _a.autoComplete, autoComplete = _q === void 0 ? 'off' : _q, props = __rest(_a, ["descText", "disabled", "icon", "id", "size", "isValid", "label", "placeholder", "readOnly", "required", "variant", "value", "onChange", "maxLength", "inputClassName", "isFlatRight", "actionElement", "autoComplete"]);
1849
+ var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, icon = _a.icon, _c = _a.id, id = _c === void 0 ? '' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.isValid, isValid = _e === void 0 ? null : _e, label = _a.label, _f = _a.placeholder, placeholder = _f === void 0 ? '' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.required, required = _h === void 0 ? false : _h, _j = _a.variant, variant = _j === void 0 ? 'text' : _j, _k = _a.value, value = _k === void 0 ? undefined : _k, _l = _a.onChange, onChange = _l === void 0 ? function () { } : _l, _m = _a.maxLength, maxLength = _m === void 0 ? undefined : _m, _o = _a.inputClassName, inputClassName = _o === void 0 ? '' : _o; _a.isFlatRight; var actionElement = _a.actionElement, _q = _a.autoComplete, autoComplete = _q === void 0 ? 'off' : _q, ref = _a.ref, props = __rest(_a, ["descText", "disabled", "icon", "id", "size", "isValid", "label", "placeholder", "readOnly", "required", "variant", "value", "onChange", "maxLength", "inputClassName", "isFlatRight", "actionElement", "autoComplete", "ref"]);
1843
1850
  var isTransparent = variant.includes('transparent');
1844
1851
  var _r = useState(false), isShow = _r[0], setIsShow = _r[1];
1845
1852
  var _s = styleConfig[variant], fieldStyle = _s.fieldStyle, iconStyle = _s.iconStyle;
1846
1853
  var _t = isTransparent
1847
- ? __assign(__assign({}, sizeConfig$c[size]), { iconPosition: "right-0 ", fieldSize: sizeConfig$c[size].fieldSize +
1848
- " pe-[".concat(9 + sizeConfig$c[size].iconSize, "px]") }) : sizeConfig$c[size], iconSize = _t.iconSize, fieldSize = _t.fieldSize, iconPosition = _t.iconPosition;
1854
+ ? __assign(__assign({}, sizeConfig$b[size]), { iconPosition: "right-0 ", fieldSize: sizeConfig$b[size].fieldSize +
1855
+ " pe-[".concat(9 + sizeConfig$b[size].iconSize, "px]") }) : sizeConfig$b[size], iconSize = _t.iconSize, fieldSize = _t.fieldSize, iconPosition = _t.iconPosition;
1849
1856
  var borderStyle = isTransparent
1850
1857
  ? 'border-transparent bg-transparent' // customize border rule for transparent variant
1851
1858
  : 'border border-bia-grey-dark-10 bg-primary-white';
@@ -1884,7 +1891,7 @@ function TextInput(_a) {
1884
1891
  label,
1885
1892
  required && React.createElement("span", { className: "p-1 text-bia-red" }, "*"))),
1886
1893
  React.createElement("div", { className: "relative w-full" },
1887
- React.createElement("input", __assign({ className: "bianic-text-input bianic-fgc-target w-full rounded read-only:pointer-events-none read-only:border-bia-grey-light-50 hover:rounded-b-none focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName), disabled: disabled, id: id, placeholder: placeholder || label, readOnly: readOnly, required: required, type: typeVariant, value: value, onChange: function (e) { return onChange(e); }, maxLength: maxLength, autoComplete: autoComplete }, props)),
1894
+ React.createElement("input", __assign({ className: "bianic-text-input bianic-fgc-target w-full rounded read-only:pointer-events-none read-only:border-bia-grey-light-50 hover:rounded-b-none focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName), disabled: disabled, id: id, placeholder: placeholder || label, readOnly: readOnly, required: required, type: typeVariant, value: value, onChange: function (e) { return onChange(e); }, maxLength: maxLength, autoComplete: autoComplete, ref: ref }, props)),
1888
1895
  React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(actionElement ? '' : iconStyle, " ").concat(iconPosition, " ").concat(iconSizing) }, iconElement)),
1889
1896
  (descText || maxLength) && (React.createElement("div", { className: "bianic-text-input-desc flex justify-between gap-1 text-xs ".concat(descColor) },
1890
1897
  React.createElement("span", null, descText),
@@ -1911,7 +1918,7 @@ TextInput.defaultProps = {
1911
1918
  };
1912
1919
 
1913
1920
  // Desc: Radio button size configuration
1914
- var sizeConfig$b = {
1921
+ var sizeConfig$a = {
1915
1922
  md: {
1916
1923
  checkSize: 'w-[22px] h-[22px]',
1917
1924
  labelSize: 'text-size-base',
@@ -1926,7 +1933,7 @@ var sizeUnion$4 = ['md', 'sm'];
1926
1933
  function Radio(_a) {
1927
1934
  var label = _a.label, _b = _a.size, size = _b === void 0 ? 'md' : _b, id = _a.id, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.checked, checked = _e === void 0 ? false : _e;
1928
1935
  var validatedSize = validUnion(size, sizeUnion$4);
1929
- var _f = sizeConfig$b[validatedSize], checkSize = _f.checkSize, labelSize = _f.labelSize;
1936
+ var _f = sizeConfig$a[validatedSize], checkSize = _f.checkSize, labelSize = _f.labelSize;
1930
1937
  return (React.createElement("div", { className: "flex items-center" },
1931
1938
  React.createElement("div", { className: "bg-white rounded-full flex flex-shrink-0 justify-center items-center relative ".concat(checkSize) },
1932
1939
  React.createElement("input", { id: id, "aria-labelledby": "label1", type: "radio", className: "peer checkbox box-content appearance-none focus:opacity-100 focus:ring-1 focus:ring-offset-2 checked:disabled:border-bia-blue-disabled focus:ring-bia-blue focus:outline-none rounded-full border-bia-coolgrey-light-50 checked:border-bia-blue hover:border-bia-blue-hover disabled:border-bia-grey-dark-10 border-2 absolute cursor-pointer w-full h-full", onClick: function (e) { return onClick(e); }, checked: checked, disabled: disabled }),
@@ -1942,7 +1949,7 @@ Radio.defaultProps = {
1942
1949
  checked: false,
1943
1950
  };
1944
1951
 
1945
- var sizeConfig$a = {
1952
+ var sizeConfig$9 = {
1946
1953
  md: {
1947
1954
  inputClass: 'text-size-base font-[350] min-h-10',
1948
1955
  },
@@ -1965,7 +1972,7 @@ var ResizeIcon = function (_a) {
1965
1972
  function TextArea(_a) {
1966
1973
  var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, _d = _a.placeholder, placeholder = _d === void 0 ? '' : _d, required = _a.required, rows = _a.rows, _e = _a.maxLength, maxLength = _e === void 0 ? undefined : _e, value = _a.value, _f = _a.readOnly, readOnly = _f === void 0 ? false : _f, _g = _a.autoComplete, autoComplete = _g === void 0 ? 'off' : _g, props = __rest(_a, ["descText", "disabled", "id", "size", "label", "placeholder", "required", "rows", "maxLength", "value", "readOnly", "autoComplete"]);
1967
1974
  var inputRow = rows !== null && rows !== void 0 ? rows : 4;
1968
- var inputClass = sizeConfig$a[size].inputClass;
1975
+ var inputClass = sizeConfig$9[size].inputClass;
1969
1976
  var remainWords = maxLength ? maxLength - (value ? value.length : 0) : 0;
1970
1977
  return (React.createElement("div", { className: "field-group flex w-full flex-col" },
1971
1978
  React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold read-only:pointer-events-none" },
@@ -1995,7 +2002,7 @@ TextArea.defaultProps = {
1995
2002
  value: '',
1996
2003
  };
1997
2004
 
1998
- var sizeConfig$9 = {
2005
+ var sizeConfig$8 = {
1999
2006
  md: {
2000
2007
  checkClass: 'w-[22px] h-[22px]',
2001
2008
  labelClass: 'text-size-base font-[350]',
@@ -2009,7 +2016,7 @@ var sizeConfig$9 = {
2009
2016
  var sizeUnion$3 = ['md', 'sm'];
2010
2017
  function Checkbox(_a) {
2011
2018
  var _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, _d = _a.onChange, onChange = _d === void 0 ? function () { } : _d, props = __rest(_a, ["disabled", "id", "size", "label", "onChange"]);
2012
- var _e = sizeConfig$9[validUnion(size, sizeUnion$3)], checkClass = _e.checkClass, labelClass = _e.labelClass;
2019
+ var _e = sizeConfig$8[validUnion(size, sizeUnion$3)], checkClass = _e.checkClass, labelClass = _e.labelClass;
2013
2020
  return (React.createElement("div", { className: "flex items-center" },
2014
2021
  React.createElement("div", { className: "relative flex flex-shrink-0 items-center justify-center rounded-full bg-white ".concat(checkClass) },
2015
2022
  React.createElement("input", __assign({ id: id, type: "checkbox", className: "checkbox peer absolute box-content h-full w-full cursor-pointer appearance-none rounded-full border-2 border-bia-coolgrey-light-50 checked:border-bia-blue hover:border-bia-blue-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-bia-blue focus-visible:ring-offset-2 disabled:border-bia-coolgrey-light-50 disabled:checked:border-bia-blue-light-50", onChange: function (e) { return onChange(e); }, disabled: disabled }, props)),
@@ -2027,7 +2034,7 @@ Checkbox.defaultProps = {
2027
2034
  onChange: function () { },
2028
2035
  };
2029
2036
 
2030
- var sizeConfig$8 = {
2037
+ var sizeConfig$7 = {
2031
2038
  md: {
2032
2039
  searchSize: 'text-size-base p-2.5 font-[350] h-10',
2033
2040
  iconSize: 'right-[10px] text-[18px]',
@@ -2038,7 +2045,7 @@ var sizeConfig$8 = {
2038
2045
  },
2039
2046
  };
2040
2047
 
2041
- var sizeConfig$7 = {
2048
+ var sizeConfig$6 = {
2042
2049
  md: {
2043
2050
  container: 'text-size-base font-[350] py-[3px] first:pt-[8px] last:pb-[8px]',
2044
2051
  item: 'min-h-[34px] p-2.5',
@@ -2056,7 +2063,7 @@ function CustomDropdownItem(_a) {
2056
2063
  var _f = useState(false), isHoveredSubMenu = _f[0], setIsHoveredSubMenu = _f[1];
2057
2064
  var isOpenDropdown = isHovered || isHoveredSubMenu;
2058
2065
  var selectedClass = isSelected ? 'font-semibold' : 'font-normal';
2059
- var _g = sizeConfig$7[size], containerClass = _g.container, item = _g.item;
2066
+ var _g = sizeConfig$6[size], containerClass = _g.container, item = _g.item;
2060
2067
  var itemClass = "".concat(item, " ").concat(selectedClass, " ").concat(className);
2061
2068
  var isExistSubDropdown = options.length !== 0;
2062
2069
  return (React.createElement("div", { className: "relative w-full focus-visible:outline-bia-blue-light-50 ".concat(containerClass), tabIndex: 0, role: "button", onClick: function (e) { return onClick(e); }, onMouseEnter: function () { return setisHovered(true); }, onMouseLeave: function () { return setisHovered(false); }, onKeyDown: function () { } },
@@ -2083,7 +2090,7 @@ function DefaultDropdownItem(_a) {
2083
2090
  var _g = useState(false), isHoveredSubMenu = _g[0], setIsHoveredSubMenu = _g[1];
2084
2091
  var isOpenDropdown = isHovered || isHoveredSubMenu;
2085
2092
  var selectedClass = isSelected ? 'font-semibold' : 'font-normal';
2086
- var _h = sizeConfig$7[size], containerClass = _h.container, item = _h.item;
2093
+ var _h = sizeConfig$6[size], containerClass = _h.container, item = _h.item;
2087
2094
  var itemClass = "".concat(item, " ").concat(selectedClass, " ").concat(className);
2088
2095
  var isExistSubDropdown = options.length !== 0;
2089
2096
  return (React.createElement("div", { className: "relative w-full focus-visible:outline-bia-blue-light-50 ".concat(containerClass), tabIndex: 0, role: "button", onClick: function (e) { return onClick(e); }, onMouseEnter: function () { return setisHovered(true); }, onMouseLeave: function () { return setisHovered(false); }, onKeyDown: function () { } },
@@ -2105,12 +2112,95 @@ DefaultDropdownItem.defaultProps = {
2105
2112
  caption: '',
2106
2113
  };
2107
2114
 
2115
+ var containerSizeConfig = {
2116
+ sm: 'min-w-[72px]',
2117
+ md: 'min-w-[96px]',
2118
+ };
2119
+ var itemSizeConfig = {
2120
+ sm: 'min-h-[30px] border-y-[2px] border-bia-white',
2121
+ md: 'min-h-[40px] border-y-[3px] border-bia-white',
2122
+ };
2123
+ var fontConfig = {
2124
+ sm: 'text-[12px] font-[400]',
2125
+ md: 'text-[14px] font-[350]',
2126
+ };
2127
+
2128
+ var DropdownContainer = forwardRef(function DropdownContainer(propsComp, ref) {
2129
+ var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.size, size = _f === void 0 ? 'md' : _f, _g = propsComp.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, _h = propsComp.zIndex, zIndex = _h === void 0 ? 0 : _h, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex"]);
2130
+ var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
2131
+ var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
2132
+ var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
2133
+ var handleClickDrpdownItem = function (e, val) {
2134
+ onClickItem(e, val);
2135
+ onClose();
2136
+ };
2137
+ return (open && (React.createElement(React.Fragment, null,
2138
+ isWithOverlay && (React.createElement("div", { className: "bianic-dropdown-overlay fixed left-0 top-0 h-screen w-screen", style: { zIndex: zIndex }, onClick: function () { return onClose(); } })),
2139
+ React.createElement("div", __assign({ style: {
2140
+ zIndex: zIndex + 10, // Ensure dropdown is above overlay
2141
+ }, ref: ref, className: "bianic-dropdown-container bg-bia-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] ".concat(containerClass) }, restProps), Children.map(children, function (child) {
2142
+ return React.isValidElement(child)
2143
+ ? // Kirimkan handleItemClick sebagai props onClick ke setiap DropdownItem
2144
+ cloneElement(child, {
2145
+ onClose: function () { return onClose(); },
2146
+ size: size,
2147
+ onClickItem: function (e, val) { return handleClickDrpdownItem(e, val); },
2148
+ zIndex: zIndex + 10,
2149
+ })
2150
+ : child;
2151
+ })))));
2152
+ });
2153
+ DropdownContainer.defaultProps = {
2154
+ isTopFlat: false,
2155
+ };
2156
+
2157
+ function DropdownItem(_a) {
2158
+ var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.onClickItem, onClickItem = _c === void 0 ? function () { } : _c, _d = _a.onClose, onClose = _d === void 0 ? function () { } : _d, _e = _a.size, size = _e === void 0 ? 'md' : _e, _f = _a.value, value = _f === void 0 ? '' : _f, content = _a.content, _g = _a.disabled, disabled = _g === void 0 ? false : _g, _h = _a.zIndex, zIndex = _h === void 0 ? 0 : _h, props = __rest(_a, ["children", "className", "onClickItem", "onClose", "size", "value", "content", "disabled", "zIndex"]);
2159
+ var _j = useState(false), isHovered = _j[0], setIsHovered = _j[1];
2160
+ var _k = useState(false), isLeft = _k[0], setIsLeft = _k[1];
2161
+ var fontClass = fontConfig[size] || fontConfig['md'];
2162
+ var itemSizeClass = itemSizeConfig[size] || itemSizeConfig['md'];
2163
+ var itemClass = "".concat(itemSizeClass, " ").concat(fontClass, " ").concat(className);
2164
+ var chevronSize = size === 'sm' ? 14 : 18;
2165
+ var DropdownContRef = useRef(null);
2166
+ useEffect(function () {
2167
+ var _a;
2168
+ if (DropdownContRef.current) {
2169
+ // Adjust dropdown position to prevent overflow on the right.
2170
+ var MenuContRect = (_a = DropdownContRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
2171
+ var RectRight = MenuContRect === null || MenuContRect === void 0 ? void 0 : MenuContRect.right;
2172
+ var innerWindow = window.innerWidth;
2173
+ if (RectRight > innerWindow)
2174
+ setIsLeft(true);
2175
+ else
2176
+ setIsLeft(false);
2177
+ }
2178
+ }, [isHovered]);
2179
+ var translateClass = isLeft
2180
+ ? 'left-0 -translate-x-full'
2181
+ : 'right-0 translate-x-full';
2182
+ var currentZIndex = zIndex + 10;
2183
+ return (React.createElement("div", { className: "bianic-dropdown-item group/main relative cursor-pointer first:rounded-t-radius-sm first:pt-[5px] last:rounded-b-radius-sm last:pb-[5px]", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
2184
+ React.createElement("button", __assign({ className: "relative flex w-full !min-w-fit items-center justify-start whitespace-nowrap px-[15px] py-[5px] text-left text-bia-black disabled:cursor-not-allowed disabled:text-bia-coolgrey-light-50 hover:[&:not(:disabled)]:bg-bia-blue-pastel ".concat(itemClass), style: {
2185
+ zIndex: isHovered ? currentZIndex : currentZIndex + 15,
2186
+ }, onClick: function (e) {
2187
+ onClickItem(e, value);
2188
+ }, onKeyDown: function () { }, disabled: disabled, type: "button" }, props),
2189
+ content,
2190
+ React.createElement("div", { className: "ml-auto flex items-center" }, children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey", size: chevronSize })))),
2191
+ children && (React.createElement(DropdownContainer, { className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), onClose: onClose, open: isHovered, onClickItem: function (e, value) { return onClickItem(e, value); }, size: size, ref: DropdownContRef, zIndex: currentZIndex + 10 }, children))));
2192
+ }
2193
+ DropdownItem.defaultProps = {
2194
+ className: '',
2195
+ onClickItem: function () { },
2196
+ };
2197
+
2108
2198
  var sizeUnion$2 = ['md', 'sm'];
2109
2199
  function SelectInput(_a) {
2110
- var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, id = _a.id, label = _a.label, options = _a.options, _d = _a.required, required = _d === void 0 ? false : _d, selected = _a.selected, setSelected = _a.setSelected, _e = _a.onClickDropdown, onClickDropdown = _e === void 0 ? function () { } : _e, props = __rest(_a, ["descText", "disabled", "size", "id", "label", "options", "required", "selected", "setSelected", "onClickDropdown"]);
2111
- var _f = useState(false), isOpen = _f[0], setIsOpen = _f[1];
2200
+ var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, id = _a.id, label = _a.label, _d = _a.options, options = _d === void 0 ? [] : _d, _e = _a.required, required = _e === void 0 ? false : _e, selected = _a.selected, setSelected = _a.setSelected, _f = _a.onClickDropdown, onClickDropdown = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.dropContProps, _h = _g === void 0 ? {} : _g, _j = _h.className, dropContClassName = _j === void 0 ? '' : _j, restDropContProps = __rest(_h, ["className"]), props = __rest(_a, ["descText", "disabled", "size", "id", "label", "options", "required", "selected", "setSelected", "onClickDropdown", "children", "dropContProps"]);
2201
+ var _k = useState(false), isOpen = _k[0], setIsOpen = _k[1];
2112
2202
  var validatedSize = validUnion(size, sizeUnion$2);
2113
- var _g = sizeConfig$8[validatedSize], searchSize = _g.searchSize, iconSize = _g.iconSize;
2203
+ var _l = sizeConfig$7[validatedSize], searchSize = _l.searchSize, iconSize = _l.iconSize;
2114
2204
  var inputRef = useRef(null);
2115
2205
  var handleOutsideClick = function (e) {
2116
2206
  if (inputRef.current && !inputRef.current.contains(e.target)) {
@@ -2149,7 +2239,7 @@ function SelectInput(_a) {
2149
2239
  React.createElement("div", { className: "group relative w-full" },
2150
2240
  React.createElement("input", __assign({ className: "field peer w-full cursor-pointer rounded border border-bia-grey-dark-10 bg-primary-white pe-8 focus-visible:outline-none enabled:hover:rounded-b-none enabled:hover:border-b-bia-blue enabled:focus:rounded-b-none enabled:focus:border-b-bia-blue disabled:bg-bia-grey-light-80 disabled:text-bia-coolgrey ".concat(searchSize), onClick: function () { return setIsOpen(!isOpen); }, value: selectedLabel, readOnly: true, id: id, disabled: disabled }, props)),
2151
2241
  React.createElement("div", { className: "pointer-events-none absolute inset-y-0 flex items-center pl-3 text-bia-coolgrey peer-disabled:text-bia-coolgrey-light-50 ".concat(iconSize) }, isOpen ? React.createElement(TbChevronUp, null) : React.createElement(TbChevronDown, null)),
2152
- isOpen && (React.createElement("div", { className: "absolute z-10 w-full overflow-y-auto rounded-b-md border border-bia-grey-dark-10 bg-primary-white shadow-lg", ref: optionsRef, onClick: onClickDropdown }, options.map(function (option) {
2242
+ children === undefined && isOpen && (React.createElement("div", { className: "absolute z-10 w-full overflow-y-auto rounded-b-md border border-bia-grey-dark-10 bg-primary-white shadow-lg", ref: optionsRef, onClick: onClickDropdown }, options.map(function (option) {
2153
2243
  var isSelected = JSON.stringify(option) === JSON.stringify(selected);
2154
2244
  var optionLabel = isObjectOptionItem ? option.label : option;
2155
2245
  var optionCaption = isObjectOptionItem ? option.caption : '';
@@ -2160,6 +2250,18 @@ function SelectInput(_a) {
2160
2250
  setSelected(option);
2161
2251
  setIsOpen(false);
2162
2252
  } }));
2253
+ }))),
2254
+ children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, className: "bianic-livesearch-dropdown absolute z-10 mt-1 w-full overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(dropContClassName) }, restDropContProps), React.Children.map(children, function (child) {
2255
+ if (React.isValidElement(child)) {
2256
+ return React.cloneElement(child, {
2257
+ isSelected: selected && selected.id === child.props.value.id,
2258
+ onClick: function () {
2259
+ setSelected(child.props.value);
2260
+ setIsOpen(false);
2261
+ },
2262
+ });
2263
+ }
2264
+ return child;
2163
2265
  })))),
2164
2266
  descText && (React.createElement("span", { className: "desc mt-2 text-xs text-primary-cool" }, descText))));
2165
2267
  }
@@ -2174,7 +2276,7 @@ SelectInput.defaultProps = {
2174
2276
  setSelected: function () { },
2175
2277
  };
2176
2278
 
2177
- var sizeConfig$6 = {
2279
+ var sizeConfig$5 = {
2178
2280
  md: {
2179
2281
  iconClass: 'right-[10px]',
2180
2282
  iconSize: '18',
@@ -2189,90 +2291,13 @@ var sizeConfig$6 = {
2189
2291
  },
2190
2292
  };
2191
2293
 
2192
- var sizeConfig$5 = {
2193
- sm: 'min-w-[72px]',
2194
- md: 'min-w-[96px]',
2195
- };
2196
- var fontConfig = {
2197
- sm: 'text-[12px] font-[400]',
2198
- md: 'text-[14px] font-[350]',
2199
- };
2200
-
2201
- var DropdownContainer = forwardRef(function DropdownContainer(propsComp, ref) {
2202
- var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.size, size = _f === void 0 ? 'md' : _f, _g = propsComp.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, _h = propsComp.zIndex, zIndex = _h === void 0 ? 0 : _h, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex"]);
2203
- var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
2204
- var sizeClass = sizeConfig$5[size] || sizeConfig$5['md'];
2205
- var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
2206
- var handleClickDrpdownItem = function (e, val) {
2207
- onClickItem(e, val);
2208
- onClose();
2209
- };
2210
- return (open && (React.createElement(React.Fragment, null,
2211
- isWithOverlay && (React.createElement("div", { className: "bianic-dropdown-overlay fixed left-0 top-0 h-screen w-screen", style: { zIndex: zIndex }, onClick: function () { return onClose(); } })),
2212
- React.createElement("div", __assign({ style: {
2213
- zIndex: zIndex + 10, // Ensure dropdown is above overlay
2214
- }, ref: ref, className: "bianic-dropdown-container bg-bia-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] ".concat(containerClass) }, restProps), Children.map(children, function (child) {
2215
- return React.isValidElement(child)
2216
- ? // Kirimkan handleItemClick sebagai props onClick ke setiap DropdownItem
2217
- cloneElement(child, {
2218
- onClose: function () { return onClose(); },
2219
- size: size,
2220
- onClickItem: function (e, val) { return handleClickDrpdownItem(e, val); },
2221
- zIndex: zIndex + 10,
2222
- })
2223
- : child;
2224
- })))));
2225
- });
2226
- DropdownContainer.defaultProps = {
2227
- isTopFlat: false,
2228
- };
2229
-
2230
- function DropdownItem(_a) {
2231
- var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.onClickItem, onClickItem = _c === void 0 ? function () { } : _c, _d = _a.onClose, onClose = _d === void 0 ? function () { } : _d, _e = _a.size, size = _e === void 0 ? 'md' : _e, _f = _a.value, value = _f === void 0 ? '' : _f, content = _a.content, _g = _a.disabled, disabled = _g === void 0 ? false : _g, _h = _a.zIndex, zIndex = _h === void 0 ? 0 : _h, props = __rest(_a, ["children", "className", "onClickItem", "onClose", "size", "value", "content", "disabled", "zIndex"]);
2232
- var _j = useState(false), isHovered = _j[0], setIsHovered = _j[1];
2233
- var _k = useState(false), isLeft = _k[0], setIsLeft = _k[1];
2234
- var fontClass = fontConfig[size] || fontConfig['md'];
2235
- var itemClass = "".concat(fontClass, " ").concat(className);
2236
- var chevronSize = size === 'sm' ? 14 : 18;
2237
- var DropdownContRef = useRef(null);
2238
- useEffect(function () {
2239
- var _a;
2240
- if (DropdownContRef.current) {
2241
- // Adjust dropdown position to prevent overflow on the right.
2242
- var MenuContRect = (_a = DropdownContRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
2243
- var RectRight = MenuContRect === null || MenuContRect === void 0 ? void 0 : MenuContRect.right;
2244
- var innerWindow = window.innerWidth;
2245
- if (RectRight > innerWindow)
2246
- setIsLeft(true);
2247
- else
2248
- setIsLeft(false);
2249
- }
2250
- }, [isHovered]);
2251
- var translateClass = isLeft
2252
- ? 'left-0 -translate-x-full'
2253
- : 'right-0 translate-x-full';
2254
- var currentZIndex = zIndex + 10;
2255
- return (React.createElement("div", { className: "bianic-dropdown-item group/main relative cursor-pointer first:rounded-t-radius-sm first:pt-[6px] last:rounded-b-radius-sm last:pb-[6px]", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
2256
- React.createElement("button", __assign({ className: "relative flex h-full w-full !min-w-fit items-center justify-start whitespace-nowrap px-[15px] py-[5px] text-left text-bia-black disabled:cursor-not-allowed disabled:text-bia-coolgrey-light-50 hover:[&:not(:disabled)]:bg-bia-blue-pastel ".concat(itemClass), style: {
2257
- zIndex: isHovered ? currentZIndex : currentZIndex + 15,
2258
- }, onClick: function (e) {
2259
- onClickItem(e, value);
2260
- }, onKeyDown: function () { }, disabled: disabled, type: "button" }, props),
2261
- content,
2262
- React.createElement("div", { className: "ml-auto flex items-center" }, children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey", size: chevronSize })))),
2263
- children && (React.createElement(DropdownContainer, { className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), onClose: onClose, open: isHovered, onClickItem: function (e, value) { return onClickItem(e, value); }, size: size, ref: DropdownContRef, zIndex: currentZIndex + 10 }, children))));
2264
- }
2265
- DropdownItem.defaultProps = {
2266
- className: '',
2267
- onClickItem: function () { },
2268
- };
2269
-
2270
2294
  function LiveSearch(_a) {
2271
2295
  var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, options = _a.options, setValue = _a.setValue, value = _a.value, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, _h = _a.autoComplete, autoComplete = _h === void 0 ? 'off' : _h, _j = _a.children, children = _j === void 0 ? undefined : _j, _k = _a.dropContProps, dropContProps = _k === void 0 ? { className: undefined } : _k;
2272
2296
  var _l = useState(false), isOpen = _l[0], setIsOpen = _l[1];
2273
2297
  var _m = useState(value.label || ''), searchTerm = _m[0], setSearchTerm = _m[1];
2274
- var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
2298
+ var _o = sizeConfig$5[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
2275
2299
  var dropContClassName = dropContProps.className, restDropContProps = __rest(dropContProps, ["className"]);
2300
+ var isValueExist = value && value.label !== undefined && value.label !== '';
2276
2301
  var inputRef = useRef(null);
2277
2302
  var handleOutsideClick = function (e) {
2278
2303
  if (inputRef.current && !inputRef.current.contains(e.target)) {
@@ -2368,11 +2393,10 @@ function LiveSearch(_a) {
2368
2393
  setValue({ id: null, label: e.target.value });
2369
2394
  handleInputChange(e);
2370
2395
  }, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
2371
- React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 group-hover:hidden ".concat(iconClass) },
2372
- React.createElement(TbZoom, { className: "text-primary-black", style: { fontSize: iconSize } })),
2373
- React.createElement("div", { className: "absolute inset-y-0 z-20 hidden pl-3 group-hover:block ".concat(iconClass) },
2374
- React.createElement("button", { onClick: function () { return setValue({ id: null, label: '' }); }, className: "flex h-full w-full items-center" },
2375
- React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } }))),
2396
+ React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass) },
2397
+ !isValueExist && (React.createElement(TbZoom, { className: "text-primary-black", style: { fontSize: iconSize } })),
2398
+ isValueExist && (React.createElement("button", { onClick: function () { return setValue({ id: null, label: '' }); }, className: "flex h-full w-full items-center" },
2399
+ React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } })))),
2376
2400
  children === undefined && isOpen && (React.createElement("div", { className: "border-grey-100 absolute z-10 max-h-60 w-full overflow-y-auto rounded-b-md border bg-primary-white shadow-lg", onClick: onClickDropdown }, filteredOptions.map(function (option) {
2377
2401
  var isSelected = value && value.id && option.id === value.id;
2378
2402
  return option.custom ? (React.createElement(CustomDropdownItem, { size: size, isSelected: isSelected, className: dropContClassName, onClick: function () {
@@ -2383,7 +2407,7 @@ function LiveSearch(_a) {
2383
2407
  setIsOpen(false);
2384
2408
  } }));
2385
2409
  }))),
2386
- children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, className: "bianic-livesearch-dropdown absolute z-10 mt-1 w-full overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(dropContClassName) }, restDropContProps), hasFilteredResults
2410
+ children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, zIndex: 10, className: "bianic-livesearch-dropdown absolute w-full overflow-hidden bg-white shadow-lg" }, restDropContProps), hasFilteredResults
2387
2411
  ? renderedChildren
2388
2412
  : // If no results and searchTerm is present
2389
2413
  searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))),
@@ -2445,9 +2469,9 @@ var roundedConfig = {
2445
2469
  tn: 'first:rounded-l-radius-tn last:rounded-r-radius-tn',
2446
2470
  };
2447
2471
  var sizeConfig$3 = {
2448
- lg: 'text-size-md leading-[23.94px] px-[13px] py-[10.5px] ',
2449
- md: 'text-size-base leading-[21px] px-[11px] py-[9px] ',
2450
- sm: 'text-size-sm leading-[15.96px] px-[7px] py-[5px] ',
2472
+ lg: 'text-size-md leading-[23.94px] px-[13px] py-[11px] ',
2473
+ md: 'text-size-base leading-[21px] px-[11px] py-[8.5px] ',
2474
+ sm: 'text-size-sm leading-[15.96px] px-[7px] py-[6px] ',
2451
2475
  tn: 'text-size-sm leading-[15.96px] px-[4px] py-[2px] ',
2452
2476
  };
2453
2477
  var minWidthConfig = {
@@ -2456,16 +2480,22 @@ var minWidthConfig = {
2456
2480
  sm: 'min-w-[72px]',
2457
2481
  tn: 'min-w-[64px]',
2458
2482
  };
2483
+ var minHeightConfig = {
2484
+ lg: 'min-h-[48px]',
2485
+ md: 'min-h-[40px]',
2486
+ sm: 'min-h-[30px]',
2487
+ tn: 'min-h-[22px]',
2488
+ };
2459
2489
 
2460
2490
  function SegmentButtonItem(_a) {
2461
- var _b = _a.selected, selected = _b === void 0 ? false : _b, size = _a.size, children = _a.children, disabled = _a.disabled, _c = _a.isfitContent, isfitContent = _c === void 0 ? false : _c, onClick = _a.onClick;
2491
+ var className = _a.className, _b = _a.selected, selected = _b === void 0 ? false : _b, size = _a.size, children = _a.children, disabled = _a.disabled, _c = _a.isfitContent, isfitContent = _c === void 0 ? false : _c, onClick = _a.onClick;
2462
2492
  var isSelected = selected ? 'selected' : 'notSelected';
2463
2493
  var sizingStyle = isfitContent
2464
- ? "".concat(sizeConfig$3[size])
2465
- : "".concat(sizeConfig$3[size], " ").concat(minWidthConfig[size]);
2494
+ ? "".concat(sizeConfig$3[size], " ").concat(minHeightConfig[size])
2495
+ : "".concat(sizeConfig$3[size], " ").concat(minWidthConfig[size], " ").concat(minHeightConfig[size]);
2466
2496
  var radiusStyle = "".concat(roundedConfig[size]);
2467
2497
  var selectedStyle = "".concat(isSelectedConfig[isSelected]);
2468
- return (React.createElement("button", { type: "button", onClick: onClick, disabled: disabled, className: "group:last:border-l-0 border-[1px] border-l-0 border-bia-grey-dark-10 first:border-l-[1px] focus-visible:z-50 focus-visible:outline focus-visible:outline-[3px] focus-visible:-outline-offset-1 focus-visible:outline-bia-blue-light-50 disabled:cursor-not-allowed disabled:bg-bia-grey-light-80 disabled:text-bia-grey-dark-10 ".concat(selectedStyle, " ").concat(radiusStyle, " ").concat(sizingStyle) }, children));
2498
+ return (React.createElement("button", { type: "button", onClick: onClick, disabled: disabled, className: "group:last:border-l-0 flex items-center justify-center border-[1px] border-l-0 border-bia-grey-dark-10 first:border-l-[1px] focus-visible:z-50 focus-visible:outline focus-visible:outline-[3px] focus-visible:-outline-offset-1 focus-visible:outline-bia-blue-light-50 disabled:cursor-not-allowed disabled:bg-bia-grey-light-80 disabled:text-bia-grey-dark-10 ".concat(selectedStyle, " ").concat(radiusStyle, " ").concat(sizingStyle, " ").concat(className) }, children));
2469
2499
  }
2470
2500
 
2471
2501
  function SegmentButtonGroup(_a) {
@@ -2505,6 +2535,443 @@ var FormGroupLabel = function (_a) {
2505
2535
  childrenElement(iconRight)));
2506
2536
  };
2507
2537
 
2538
+ var oneDayValue = 24 * 60 * 60 * 1000; // milliseconds in one day
2539
+ var todayValue = Date.now() -
2540
+ (Date.now() % oneDayValue) +
2541
+ new Date().getTimezoneOffset() * 1000 * 60; // today in milliseconds
2542
+ var PickerCalendar = function (_a) {
2543
+ var selectedDate = _a.selectedDate, onDateChange = _a.onDateChange, ref = _a.ref;
2544
+ // Constants
2545
+ var daysMap = [
2546
+ 'Monday',
2547
+ 'Tuesday',
2548
+ 'Wednesday',
2549
+ 'Thursday',
2550
+ 'Friday',
2551
+ 'Saturday',
2552
+ 'Sunday',
2553
+ ];
2554
+ var monthMap = [
2555
+ 'January',
2556
+ 'February',
2557
+ 'March',
2558
+ 'April',
2559
+ 'May',
2560
+ 'June',
2561
+ 'July',
2562
+ 'August',
2563
+ 'September',
2564
+ 'October',
2565
+ 'November',
2566
+ 'December',
2567
+ ];
2568
+ var modeMap = ['date', 'year', 'month'];
2569
+ // Mode Controller
2570
+ var _b = useState(modeMap[0]), pickerMode = _b[0], setPickerMode = _b[1];
2571
+ var _c = useState(''), prevMode = _c[0], setPrevMode = _c[1];
2572
+ // styling constants and functions
2573
+ var chevronButtonStyle = 'text-bia-coolgrey';
2574
+ var selectedDateStyle = function (date, dateSelected) {
2575
+ var isSelected = checkDateEquals(date, dateSelected);
2576
+ var isToday = checkDateEquals(date, new Date(todayValue));
2577
+ if (isSelected) {
2578
+ return 'bg-bia-blue-dark-10 text-bia-white rounded-full border border-bia-blue-dark-10';
2579
+ }
2580
+ else if (!isSelected && isToday) {
2581
+ return 'bg-bia-blue-pastel text-bia-black rounded-full border border-bia-blue-light-50';
2582
+ }
2583
+ else {
2584
+ return 'hover:bg-bia-blue-pastel rounded-full';
2585
+ }
2586
+ };
2587
+ var datesColorStyle = function (date, viewMonth) {
2588
+ if (date.getMonth() === viewMonth) {
2589
+ return 'text-bia-black';
2590
+ }
2591
+ else {
2592
+ return 'text-bia-coolgrey';
2593
+ }
2594
+ };
2595
+ var selectedMonthStyle = function (month, monthSelected) {
2596
+ if (month === monthSelected) {
2597
+ return 'bg-bia-blue-dark-10 text-bia-white rounded-full border border-bia-blue-dark-10';
2598
+ }
2599
+ else {
2600
+ return 'hover:bg-bia-blue-pastel rounded-full';
2601
+ }
2602
+ };
2603
+ // Supporting functions
2604
+ var checkDateEquals = function (date1, date2) {
2605
+ if (!date2 || !date1)
2606
+ return false;
2607
+ return (date1.getFullYear() === date2.getFullYear() &&
2608
+ date1.getMonth() === date2.getMonth() &&
2609
+ date1.getDate() === date2.getDate());
2610
+ };
2611
+ // handler
2612
+ var handleViewNextMonth = function () {
2613
+ if (viewMonthValue === 11) {
2614
+ setViewMonthValue(0);
2615
+ setViewYearValue(viewYearValue + 1);
2616
+ setViewDecadeValue(viewYearValue + 1);
2617
+ }
2618
+ else {
2619
+ setViewMonthValue(viewMonthValue + 1);
2620
+ }
2621
+ };
2622
+ var handleViewNextYear = function () {
2623
+ setViewYearValue(function (oldYear) { return oldYear + 1; });
2624
+ setViewDecadeValue(function (oldYear) { return oldYear + 1; });
2625
+ };
2626
+ var handleViewPrevYear = function () {
2627
+ setViewYearValue(function (oldYear) { return oldYear - 1; });
2628
+ setViewDecadeValue(function (oldYear) { return oldYear - 1; });
2629
+ };
2630
+ var handleViewPrevMonth = function () {
2631
+ if (viewMonthValue === 0) {
2632
+ setViewMonthValue(11);
2633
+ setViewYearValue(viewYearValue - 1);
2634
+ setViewDecadeValue(viewYearValue - 1);
2635
+ }
2636
+ else {
2637
+ setViewMonthValue(viewMonthValue - 1);
2638
+ }
2639
+ };
2640
+ var handleNextAction = function () {
2641
+ if (pickerMode === 'date') {
2642
+ handleViewNextMonth();
2643
+ }
2644
+ else if (pickerMode === 'month') {
2645
+ handleViewNextYear();
2646
+ }
2647
+ else {
2648
+ setViewDecadeValue(function (oldvalue) { return oldvalue + 10; });
2649
+ }
2650
+ };
2651
+ var handlePrevAction = function () {
2652
+ if (pickerMode === 'date') {
2653
+ handleViewPrevMonth();
2654
+ }
2655
+ else if (pickerMode === 'month') {
2656
+ handleViewPrevYear();
2657
+ }
2658
+ else {
2659
+ setViewDecadeValue(function (oldvalue) { return oldvalue - 10; });
2660
+ }
2661
+ };
2662
+ var handleSetMonth = function (monthNumber) {
2663
+ setViewMonthValue(monthNumber);
2664
+ setPickerMode('date');
2665
+ };
2666
+ var handleSetYear = function (year, index) {
2667
+ setViewYearValue(year);
2668
+ setPickerMode(prevMode);
2669
+ };
2670
+ var handleSetSelectedDate = function (date) {
2671
+ if (date.getMonth() !== viewMonthValue) {
2672
+ // if the date is not in the current view month, update the view month and year
2673
+ setViewMonthValue(date.getMonth());
2674
+ setViewYearValue(date.getFullYear());
2675
+ }
2676
+ if (onDateChange) {
2677
+ onDateChange(date);
2678
+ }
2679
+ };
2680
+ var handlePickerMode = function (mode) {
2681
+ setPickerMode(function (oldvalue) {
2682
+ setPrevMode(oldvalue);
2683
+ return mode;
2684
+ });
2685
+ };
2686
+ // View Date Logic
2687
+ var _d = useState(new Date(selectedDate || todayValue).getMonth()), viewMonthValue = _d[0], setViewMonthValue = _d[1]; // get the month of the selected date
2688
+ var _e = useState(new Date(selectedDate || todayValue).getFullYear()), viewYearValue = _e[0], setViewYearValue = _e[1]; // get the year of the selected date
2689
+ var _f = useState(new Date(selectedDate || todayValue).getFullYear()), viewDecadeValue = _f[0], setViewDecadeValue = _f[1]; // get the year for decaderange
2690
+ // Month view logic
2691
+ var monthStartDay = new Date("".concat(viewYearValue, "-").concat(viewMonthValue + 1, "-01")).getDay() === 0
2692
+ ? 6
2693
+ : new Date("".concat(viewYearValue, "-").concat(viewMonthValue + 1, "-01")).getDay() - 1;
2694
+ var monthTotalDate = new Date(viewYearValue, viewMonthValue + 1, 0).getDate(); // get total days in the month
2695
+ var monthCalenderView = monthTotalDate + monthStartDay > 35 ? 42 : 35; // for 5 or 6 weeks view for the calendar
2696
+ var viewFirstDate = new Date("".concat(viewYearValue, "-").concat(viewMonthValue + 1, "-01"));
2697
+ viewFirstDate.setDate(viewFirstDate.getDate() - monthStartDay); // get the first date of the view
2698
+ var viewLastDate = new Date(viewFirstDate);
2699
+ viewLastDate.setDate(viewLastDate.getDate() + monthCalenderView - 1); // get the last date of the view
2700
+ // Generate the view days array
2701
+ var _g = useState([]), displayDays = _g[0], setDisplayDays = _g[1];
2702
+ function getDecadeRange(year) {
2703
+ // Calculate the start of the decade
2704
+ var startOfDecade = Math.floor(year / 10) * 10;
2705
+ // Calculate the end of the decade
2706
+ var endOfDecade = startOfDecade + 9;
2707
+ // Create an array to hold the years in the decade
2708
+ var decadeRange = [];
2709
+ for (var i = startOfDecade; i <= endOfDecade + 2; i++) {
2710
+ decadeRange.push(i);
2711
+ }
2712
+ return decadeRange;
2713
+ }
2714
+ var yearDisplayRange = getDecadeRange(viewDecadeValue);
2715
+ // Variable display
2716
+ var dateDisplay = (React.createElement("div", { className: "".concat(pickerMode === 'date' ? '' : 'hidden') },
2717
+ React.createElement("div", { className: "bianic-datepicker-calendar-days-grid-header grid grid-cols-7 gap-[3px] pb-1.5" }, daysMap.map(function (day) { return (React.createElement("div", { key: day, className: "bianic-datepicker-calendar-day flex h-[18px] w-[31px] items-center justify-center text-bia-coolgrey" },
2718
+ React.createElement(Text, { variant: "small-text" }, day.slice(0, 3)))); })),
2719
+ React.createElement("div", { className: "bianic-datepicker-calendar-days-grid-body grid grid-cols-7 gap-y-1.5" }, displayDays.map(function (date) { return (React.createElement("button", { key: date.toString(), className: "bianic-datepicker-calendar-day flex h-[31px] w-[31px] items-center justify-center ".concat(datesColorStyle(date, viewMonthValue), " ").concat(selectedDateStyle(date, selectedDate)), onClick: function () {
2720
+ // Handle date selection logic here
2721
+ handleSetSelectedDate(date);
2722
+ } },
2723
+ React.createElement(Text, { variant: "small-text" }, date.getDate()))); }))));
2724
+ var monthDisplay = (React.createElement("div", { className: "bianic-datepicker-calendar-month-grid grid grid-cols-3 gap-y-1.5 ".concat(pickerMode === 'month' ? '' : 'hidden') }, monthMap.map(function (month, index) { return (React.createElement("button", { className: "bianic-datepicker-calendar-month mx-[15px] flex h-[31px] items-center justify-center ".concat(selectedMonthStyle(index, viewMonthValue)), key: index, onClick: function () { return handleSetMonth(index); } },
2725
+ React.createElement(Text, { variant: "small-text" }, month.slice(0, 3)))); })));
2726
+ var yearDisplay = (React.createElement("div", { className: "bianic-datepicker-calendar-year-grid grid grid-cols-4 gap-y-1.5 ".concat(pickerMode === 'year' ? '' : 'hidden') }, yearDisplayRange.map(function (year, index) { return (React.createElement("button", { className: "bianic-datepicker-calendar-month mx-[6px] flex h-[31px] items-center justify-center ".concat(selectedMonthStyle(year, viewYearValue), " ").concat(index === 0 || index === 11 ? 'text-bia-coolgrey' : 'text-bia-black'), key: index, onClick: function () { return handleSetYear(year); } },
2727
+ React.createElement(Text, { variant: "small-text" }, year))); })));
2728
+ // useEffect to update displayDays when viewMonthValue or viewYearValue changes
2729
+ useEffect(function () {
2730
+ var tempDisplayDays = [];
2731
+ for (var d = viewFirstDate; d <= viewLastDate; d.setDate(d.getDate() + 1)) {
2732
+ tempDisplayDays.push(new Date(d));
2733
+ }
2734
+ setDisplayDays(tempDisplayDays);
2735
+ }, [viewMonthValue, viewYearValue, selectedDate]);
2736
+ return (React.createElement("div", { className: "bianic-datepicker-calendar flex flex-col gap-[15px] text-bia-black", ref: ref },
2737
+ React.createElement("div", { className: "bianic-datepicker-calendar-controller flex w-full items-center justify-between" },
2738
+ React.createElement("button", { className: "bianic-datepicker-calendar-prev-button ".concat(chevronButtonStyle), onClick: function () { return handlePrevAction(); } },
2739
+ React.createElement(TbChevronLeft, { size: 18 })),
2740
+ React.createElement("div", { className: "bianic-datepicker-calendar-current-month gap flex items-center justify-center gap-1" },
2741
+ React.createElement("button", { className: "".concat(pickerMode === 'date' ? '' : 'hidden'), onClick: function () { return handlePickerMode('month'); } },
2742
+ React.createElement(Text, { variant: "normal-text-semibold" },
2743
+ monthMap[viewMonthValue],
2744
+ ' ')),
2745
+ React.createElement("button", { className: "".concat(pickerMode === 'date' || pickerMode === 'month' ? '' : 'hidden'), onClick: function () { return handlePickerMode('year'); } },
2746
+ React.createElement(Text, { variant: "normal-text" }, viewYearValue)),
2747
+ React.createElement("button", { className: "".concat(pickerMode === 'year' ? '' : 'hidden') },
2748
+ React.createElement(Text, { variant: "normal-text" }, "".concat(yearDisplayRange[1], " - ").concat(yearDisplayRange[10])))),
2749
+ React.createElement("button", { className: "bianic-datepicker-calendar-next-button ".concat(chevronButtonStyle), onClick: function () { return handleNextAction(); } },
2750
+ React.createElement(TbChevronRight, { size: 18 }))),
2751
+ React.createElement("div", { className: "bianic-datepicker-calendar-days-grid flex flex-col " },
2752
+ dateDisplay,
2753
+ monthDisplay,
2754
+ yearDisplay)));
2755
+ };
2756
+
2757
+ var monthMap = [
2758
+ 'January',
2759
+ 'February',
2760
+ 'March',
2761
+ 'April',
2762
+ 'May',
2763
+ 'June',
2764
+ 'July',
2765
+ 'August',
2766
+ 'September',
2767
+ 'October',
2768
+ 'November',
2769
+ 'December',
2770
+ ];
2771
+ function DatePicker(_a) {
2772
+ var value = _a.value, onChange = _a.onChange;
2773
+ // State and Ref
2774
+ var inputRef = useRef(null);
2775
+ var wrapperRef = useRef(null);
2776
+ var pickerRef = useRef(null);
2777
+ var _b = useDetectOutsideClick(wrapperRef, false, pickerRef), isPickerOpen = _b[0], setIsPickerOpen = _b[1];
2778
+ return (React.createElement("div", { className: "bianic-datepicker-container relative", ref: wrapperRef },
2779
+ React.createElement("div", { className: "bianic-datepicker-field-container" },
2780
+ React.createElement(DateInput, { ref: inputRef, placeholder: "YYYY-MM-DD", value: value, onChange: onChange, buttonAction: function () { return setIsPickerOpen(true); }, setIsActive: setIsPickerOpen })),
2781
+ isPickerOpen && (React.createElement("div", { className: "bianic-datepicker-calendar-container absolute left-0 w-[250px] rounded-b-radius-sm bg-bia-white px-1.5 pb-[17px] pt-[15px] shadow-md" },
2782
+ React.createElement(PickerCalendar, { selectedDate: new Date(value), onDateChange: onChange, ref: pickerRef })))));
2783
+ }
2784
+ var DateInput = function (_a) {
2785
+ var className = _a.className, value = _a.value; _a.isActive; var setIsActive = _a.setIsActive, label = _a.label, id = _a.id, _b = _a.size, size = _b === void 0 ? 'md' : _b, onChange = _a.onChange, _c = _a.required, required = _c === void 0 ? false : _c, buttonAction = _a.buttonAction, props = __rest(_a, ["className", "value", "isActive", "setIsActive", "label", "id", "size", "onChange", "required", "buttonAction"]);
2786
+ var editDateFormatter = function (date) {
2787
+ var localString = date.toLocaleDateString().split('/');
2788
+ return localString.reverse().join('-');
2789
+ };
2790
+ var displayDateFormatter = function (date) {
2791
+ return "".concat(date.getDate(), " ").concat(monthMap[date.getMonth()].slice(0, 3), " '").concat(date.getFullYear().toString().slice(2, 4));
2792
+ };
2793
+ // Convert Date to string for display
2794
+ var formattedValue = value instanceof Date ? displayDateFormatter(value) : value;
2795
+ var _d = useState(formattedValue), viewValue = _d[0], setViewValue = _d[1];
2796
+ useRef(null);
2797
+ var _e = useState(0); _e[0]; _e[1];
2798
+ var _f = styleConfig['text'], fieldStyle = _f.fieldStyle;
2799
+ var _g = sizeConfig$b[size]; _g.iconSize; var fieldSize = _g.fieldSize, iconPosition = _g.iconPosition;
2800
+ var borderStyle = 'border border-bia-grey-dark-10 bg-primary-white';
2801
+ var extendedInputClassName = "".concat(fieldStyle, " ").concat(fieldSize, " ").concat(borderStyle, " ").concat(className);
2802
+ var labelStatus = props.readOnly ? 'read-only:pointer-events-none' : '';
2803
+ // Don't remove this, it will be used later
2804
+ // Helper function to format the cleaned input with specific group sizes
2805
+ // const formatInput = (cleanedValue: string, separator: string = '-') => {
2806
+ // let formattedValue = ''
2807
+ // // Define the group lengths: 4, 2, 2
2808
+ // const groupLengths = [4, 2, 2]
2809
+ // let currentIndex = 0
2810
+ // for (let i = 0; i < groupLengths.length; i++) {
2811
+ // const groupLength = groupLengths[i]
2812
+ // const nextSegment = cleanedValue.substring(
2813
+ // currentIndex,
2814
+ // currentIndex + groupLength
2815
+ // )
2816
+ // if (nextSegment.length > 0) {
2817
+ // formattedValue += nextSegment
2818
+ // currentIndex += groupLength
2819
+ // // Add separator if there are more groups to follow and we have enough characters
2820
+ // if (i < groupLengths.length - 1 && currentIndex < cleanedValue.length) {
2821
+ // formattedValue += separator
2822
+ // }
2823
+ // } else {
2824
+ // // Stop if there are no more characters for the current group
2825
+ // break
2826
+ // }
2827
+ // }
2828
+ // return formattedValue
2829
+ // }
2830
+ var validateAndFormatDate = function (value) {
2831
+ // 1. validate separator
2832
+ var splittedDate = value.split('-');
2833
+ if (splittedDate.length !== 3) {
2834
+ return [1, value]; // Invalid format
2835
+ }
2836
+ var year = splittedDate[0];
2837
+ var month = splittedDate[1];
2838
+ var day = splittedDate[2];
2839
+ // 2. validate year
2840
+ if (!/^\d{4}$/.test(year)) {
2841
+ return [2, value];
2842
+ }
2843
+ var parsedYear = parseInt(year, 10);
2844
+ // 3. validate month digit
2845
+ if (!/^\d{1,2}$/.test(month)) {
2846
+ return [3, value];
2847
+ }
2848
+ // 4. validate month range
2849
+ var parsedMonth = parseInt(month, 10);
2850
+ if (parsedMonth < 1 || parsedMonth > 12) {
2851
+ return [4, value];
2852
+ }
2853
+ var formattedMonth = String(parsedMonth).padStart(2, '0');
2854
+ // 5. validate date digit
2855
+ if (!/^\d{1,2}$/.test(day)) {
2856
+ return [5, value];
2857
+ }
2858
+ // 6. validate date range
2859
+ var parsedDate = parseInt(day, 10);
2860
+ if (parsedDate < 1 || parsedDate > 31) {
2861
+ return [6, value];
2862
+ }
2863
+ var formattedDay = String(parsedDate).padStart(2, '0');
2864
+ // 7. validate date rightness
2865
+ var dateObject = new Date(parsedYear, parsedMonth - 1, parsedDate);
2866
+ if (dateObject.getFullYear() !== parsedYear ||
2867
+ dateObject.getMonth() !== parsedMonth - 1 ||
2868
+ dateObject.getDate() !== parsedDate) {
2869
+ return [7, value];
2870
+ }
2871
+ // If all checks pass, the date is valid and formatted
2872
+ var formattedDate = "".concat(year, "-").concat(formattedMonth, "-").concat(formattedDay);
2873
+ return [0, formattedDate];
2874
+ };
2875
+ // Update actual value on release
2876
+ var updateValue = function (newValue) {
2877
+ var date = new Date(newValue); // Create a Date object from the input
2878
+ if (onChange && !Number.isNaN(date.valueOf())) {
2879
+ onChange(date); // Update the value if it's a valid date
2880
+ }
2881
+ };
2882
+ // Handle input change will develop later don't remove
2883
+ // const handleChange = (event) => {
2884
+ // const inputElement = event.target
2885
+ // const rawValue = inputElement.value
2886
+ // const currentCursorPos = inputElement.selectionStart
2887
+ // const cleaned = cleanInput(rawValue)
2888
+ // // Max total digits for XXXX-XX-XX is 4 + 2 + 2 = 8
2889
+ // const maxDigits = 8
2890
+ // const truncatedCleaned = cleaned.substring(0, maxDigits)
2891
+ // const formatted = formatInput(truncatedCleaned)
2892
+ // // --- Cursor Position Adjustment Logic ---
2893
+ // let newCursorPos = currentCursorPos
2894
+ // const prevFormattedLength = viewValue.length // Length of the string *before* update
2895
+ // const currentFormattedLength = formatted.length // Length of the string *after* update
2896
+ // // If text was added and formatted length increased
2897
+ // if (currentFormattedLength > prevFormattedLength) {
2898
+ // // Count how many separators are now *before* the cursor in the new string
2899
+ // // We'll compare the raw cursor position with the formatted string to adjust
2900
+ // let separatorCountBeforeCursor = 0
2901
+ // let originalCleanedValue = cleanInput(viewValue) // Clean value before this change
2902
+ // // If a character was inserted, estimate new cursor position
2903
+ // if (cleaned.length > originalCleanedValue.length) {
2904
+ // // Count separators in the *new* formatted string up to the currentCursorPos
2905
+ // for (let i = 0; i < currentCursorPos; i++) {
2906
+ // if (formatted.charAt(i) === '-') {
2907
+ // separatorCountBeforeCursor++
2908
+ // }
2909
+ // }
2910
+ // newCursorPos = currentCursorPos + separatorCountBeforeCursor
2911
+ // } else {
2912
+ // // If characters were deleted (backspace/delete)
2913
+ // newCursorPos = currentCursorPos
2914
+ // // More sophisticated logic for backspace/delete on separators can go here.
2915
+ // // For example, if you backspace a digit and it causes a separator to disappear,
2916
+ // // the cursor might need to jump back an extra position.
2917
+ // // This basic setup often works acceptably for most cases.
2918
+ // }
2919
+ // } else {
2920
+ // // If text was deleted or no change in length
2921
+ // newCursorPos = currentCursorPos
2922
+ // }
2923
+ // const handleKeyDown = (event) => {
2924
+ // if (event.key === 'Enter') {
2925
+ // // Prevent default form submission if the input is inside a <form>
2926
+ // // event.preventDefault();
2927
+ // }
2928
+ // }
2929
+ // setViewValue(formatted)
2930
+ // setLastCursorPos(newCursorPos)
2931
+ // }
2932
+ var handleChange = function (event) {
2933
+ var value = event.target.value;
2934
+ // Regular expression to allow only numbers (0-9) and hyphens (-)
2935
+ // The caret (^) matches the beginning of the string, and the dollar sign ($) matches the end.
2936
+ // This ensures the *entire* string matches the pattern.
2937
+ var regex = /^[0-9-]*$/;
2938
+ if (regex.test(value)) {
2939
+ setViewValue(value);
2940
+ }
2941
+ };
2942
+ // Will Develop later
2943
+ // useEffect to set cursor position after render
2944
+ // useEffect(() => {
2945
+ // if (inputRef.current) {
2946
+ // inputRef.current.setSelectionRange(lastCursorPos, lastCursorPos)
2947
+ // }
2948
+ // }, [viewValue, lastCursorPos]) // Re-run when viewValue or lastCursorPos changes
2949
+ useEffect(function () {
2950
+ setViewValue(formattedValue);
2951
+ }, [value]);
2952
+ return (React.createElement("div", { className: "bianic-date-input-container bianic-fgc-container flex w-full flex-col gap-y-2 text-bia-black" },
2953
+ label && (React.createElement("label", { htmlFor: id, className: "bianic-text-input-label text-xs font-semibold ".concat(labelStatus) },
2954
+ label,
2955
+ required && React.createElement("span", { className: "p-1 text-bia-red" }, "*"))),
2956
+ React.createElement("div", { className: "relative w-full" },
2957
+ React.createElement("input", __assign({}, props, { type: "text", className: "bianic-text-input bianic-fgc-target w-full rounded read-only:pointer-events-none read-only:border-bia-grey-light-50 hover:rounded-b-none focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName), id: id, value: viewValue, onFocus: function () {
2958
+ setIsActive && setIsActive(true);
2959
+ setViewValue(editDateFormatter(value));
2960
+ }, onChange: handleChange, onBlur: function () {
2961
+ var _a = validateAndFormatDate(viewValue), status = _a[0], validatedValue = _a[1];
2962
+ setViewValue(displayDateFormatter(value));
2963
+ if (status !== 0) ;
2964
+ else {
2965
+ updateValue(validatedValue);
2966
+ }
2967
+ }, maxLength: 10 })),
2968
+ React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 text-[18px] ".concat(iconPosition) },
2969
+ React.createElement("button", { className: "bianic-datepicker-toggle-button", onClick: function () {
2970
+ buttonAction && buttonAction();
2971
+ } },
2972
+ React.createElement(TbCalendar, null))))));
2973
+ };
2974
+
2508
2975
  var Node = function (_a) {
2509
2976
  var className = _a.className, _b = _a.fill, fill = _b === void 0 ? '#2f2f2f' : _b, _c = _a.size, size = _c === void 0 ? 20 : _c;
2510
2977
  return (React.createElement("svg", { className: className, width: size, height: size, viewBox: "0 0 24 24", fill: fill, stroke: fill, xmlns: "http://www.w3.org/2000/svg" },
@@ -2967,8 +3434,8 @@ function ResizeableDiv(_a) {
2967
3434
  var container = useRef(null);
2968
3435
  var resizer = useRef(null);
2969
3436
  var handleResize = function (e) {
2970
- var mouseY = e.pageY;
2971
- var mouseX = e.pageX;
3437
+ var mouseY = e.clientY;
3438
+ var mouseX = e.clientX;
2972
3439
  var divBottom = container.current.getBoundingClientRect().bottom;
2973
3440
  var divLeft = container.current.getBoundingClientRect().left;
2974
3441
  var divTop = container.current.getBoundingClientRect().top;
@@ -2982,12 +3449,12 @@ function ResizeableDiv(_a) {
2982
3449
  container.current.style.height = "".concat(height, "px");
2983
3450
  break;
2984
3451
  case 'right':
2985
- width = mouseX + divLeft;
3452
+ width = mouseX - divLeft;
2986
3453
  if (width > 9)
2987
3454
  container.current.style.width = "".concat(width, "px");
2988
3455
  break;
2989
3456
  case 'bottom':
2990
- height = mouseY + divTop;
3457
+ height = mouseY - divTop;
2991
3458
  if (height > 9)
2992
3459
  container.current.style.height = "".concat(height, "px");
2993
3460
  break;
@@ -3021,13 +3488,13 @@ function ResizeableDiv(_a) {
3021
3488
  minWidth: minimumWidth,
3022
3489
  minHeight: minimumHeight,
3023
3490
  } },
3024
- React.createElement("div", { className: "h-full w-full ".concat(className) }, children),
3025
- React.createElement("div", { className: "group absolute z-10 flex items-center justify-center ".concat(resizerContainerClass[position]), ref: resizer, onMouseDown: function () {
3491
+ React.createElement("div", { className: "group peer absolute z-10 flex items-center justify-center ".concat(resizerContainerClass[position]), ref: resizer, onMouseDown: function () {
3026
3492
  window.addEventListener('mousemove', handleResize);
3027
3493
  window.addEventListener('mouseup', stopResize);
3028
3494
  }, role: "button" },
3029
3495
  React.createElement("div", { className: "flex h-[9px] w-[25px] items-center justify-center rounded-radius-full border border-bia-grey-light-10 bg-primary-white opacity-20 group-hover:opacity-100 group-active:bg-bia-coolgrey-light-90 group-active:opacity-100 ".concat(thumbClass) },
3030
- React.createElement(TbDots, { className: "text-bia-grey-light-30" })))));
3496
+ React.createElement(TbDots, { className: "text-bia-grey-light-30" }))),
3497
+ React.createElement("div", { className: "h-full w-full peer-active:select-none ".concat(className) }, children)));
3031
3498
  }
3032
3499
  ResizeableDiv.defaultProps = {
3033
3500
  position: 'left',
@@ -3488,4 +3955,4 @@ function Window(_a) {
3488
3955
  React.createElement("div", { className: "bianic-window-content flex w-full flex-col items-start gap-[20px] px-[20px] pb-[20px] text-primary-black" }, rest.children)));
3489
3956
  }
3490
3957
 
3491
- export { Accordions, Alert, Avatar, AlertRoundedSquare as BCAlertRoundedSquare, CubeHeader as BCCubeHeader, Discrepancy as BCDiscrepancy, ExposedPort as BCExposedPort, FQAnalytical as BCFQAnalytical, FQGetaway as BCFQGetaway, FQModeler as BCFQModeler, FQOperation as BCFQOperation, FQWelldone as BCFQWelldone, Flowqount as BCFlowqount, Inlet as BCInlet, Legend as BCLegend, ModalBalance as BCModalBalance, Node as BCNode, Outlet as BCOutlet, Port as BCPort, SelectAllAdd as BCSelectAllAdd, SelectAllRemove as BCSelectAllRemove, Spinner$1 as BCSpinner, Stack as BCStack, VirtualPort as BCVirtualPort, Badge, Banner, Brand, Breadcrumb, Button, ButtonApp, Checkbox, Color, ContextualButton, Display, Divider, DropdownContainer, DropdownItem, FileTree, FormGroup, FormGroupButton, FormGroupLabel, Heading, Link, LiveSearch, MenuContainer, MenuItem, Modal, P, PaginationBar, Pills, Popover, ProgressBar, ProgressCircle, Radio, ResizeableDiv, SegmentButtonGroup, SegmentButtonItem, SelectInput, Slider, Spinner, Tab, TabMenu, TableCell, TagLabel, Text, TextArea, TextInput, Toaster, Toggle, Tooltip, Window };
3958
+ export { Accordions, Alert, Avatar, AlertRoundedSquare as BCAlertRoundedSquare, CubeHeader as BCCubeHeader, Discrepancy as BCDiscrepancy, ExposedPort as BCExposedPort, FQAnalytical as BCFQAnalytical, FQGetaway as BCFQGetaway, FQModeler as BCFQModeler, FQOperation as BCFQOperation, FQWelldone as BCFQWelldone, Flowqount as BCFlowqount, Inlet as BCInlet, Legend as BCLegend, ModalBalance as BCModalBalance, Node as BCNode, Outlet as BCOutlet, Port as BCPort, SelectAllAdd as BCSelectAllAdd, SelectAllRemove as BCSelectAllRemove, Spinner$1 as BCSpinner, Stack as BCStack, VirtualPort as BCVirtualPort, Badge, Banner, Brand, Breadcrumb, Button, ButtonApp, Checkbox, Color, ContextualButton, DatePicker, Display, Divider, DropdownContainer, DropdownItem, FileTree, FormGroup, FormGroupButton, FormGroupLabel, Heading, Link, LiveSearch, MenuContainer, MenuItem, Modal, P, PaginationBar, Pills, Popover, ProgressBar, ProgressCircle, Radio, ResizeableDiv, SegmentButtonGroup, SegmentButtonItem, SelectInput, Slider, Spinner, Tab, TabMenu, TableCell, TagLabel, Text, TextArea, TextInput, Toaster, Toggle, Tooltip, Window };