bianic-ui 2.1.0-beta.4 → 2.2.0-beta.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.
@@ -6,9 +6,12 @@ export interface AlertProps extends ComponentPropsWithoutRef<'div'> {
6
6
  visible?: boolean;
7
7
  setVisible?: (arg0: boolean) => void;
8
8
  visibleIcon?: boolean;
9
+ visibleMiniIcon?: boolean;
10
+ customIcon?: React.ReactNode;
11
+ customMiniIcon?: React.ReactNode;
9
12
  visibleClose?: boolean;
10
13
  }
11
- declare function Alert({ title, caption, variant, visible, setVisible, visibleIcon, visibleClose, children, }: AlertProps): false | React.JSX.Element;
14
+ declare function Alert({ title, caption, variant, visible, setVisible, visibleIcon, visibleClose, customIcon, customMiniIcon, children, }: AlertProps): false | React.JSX.Element;
12
15
  declare namespace Alert {
13
16
  var defaultProps: {
14
17
  title: string;
@@ -7,6 +7,7 @@ interface BadgeProps extends ComponentPropsWithoutRef<'span'> {
7
7
  declare function Badge({ type, children, color, isInverted, className, }: BadgeProps): React.JSX.Element;
8
8
  declare namespace Badge {
9
9
  var defaultProps: {
10
+ type: string;
10
11
  isInverted: boolean;
11
12
  color: undefined;
12
13
  };
@@ -36,6 +36,12 @@ export declare const iconOnlySizeConfig: {
36
36
  sm: string;
37
37
  tn: string;
38
38
  };
39
+ export declare const doubleIconSizeConfig: {
40
+ lg: string;
41
+ md: string;
42
+ sm: string;
43
+ tn: string;
44
+ };
39
45
  export declare const variantConfig: {
40
46
  default: string;
41
47
  primary: string;
@@ -9,6 +9,7 @@ export interface DropdownContainerProps extends ComponentPropsWithRef<'div'> {
9
9
  size?: 'sm' | 'md';
10
10
  zIndex?: number;
11
11
  anchorRef?: React.RefObject<HTMLElement>;
12
+ matchAnchorWidth?: undefined | 'min' | 'exact';
12
13
  onClickItem?: (event: React.MouseEvent<HTMLDivElement>, val: string | number | object) => void;
13
14
  }
14
15
  declare const DropdownContainer: {
@@ -8,6 +8,7 @@ interface MenuContainerProps extends ComponentPropsWithRef<'div'> {
8
8
  zIndex?: number;
9
9
  onClickItem?: () => void;
10
10
  anchorRef?: React.RefObject<HTMLElement>;
11
+ matchAnchorWidth?: undefined | 'min' | 'exact';
11
12
  }
12
13
  import React, { ComponentPropsWithRef } from 'react';
13
14
  declare const MenuContainer: {
@@ -12,3 +12,4 @@ declare const meta: {
12
12
  export default meta;
13
13
  type Story = StoryObj<typeof meta>;
14
14
  export declare const Demo: Story;
15
+ export declare const MiniIconDemo: Story;
@@ -28,5 +28,6 @@ export declare const WarningOutlined: Story;
28
28
  export declare const DemoWithIconLeft: Story;
29
29
  export declare const DemoWithIconRight: Story;
30
30
  export declare const DemoWithIconBoth: Story;
31
+ export declare const DemoWithIconOnlyBoth: Story;
31
32
  export declare const DemoWithIconOnly: Story;
32
33
  export declare const DemoWithMovingIcon: Story;
package/dist/esm/index.js CHANGED
@@ -382,7 +382,7 @@ Link.defaultProps = {
382
382
  };
383
383
 
384
384
  function Alert(_a) {
385
- var _b = _a.title, title = _b === void 0 ? '' : _b, caption = _a.caption, _c = _a.variant, variant = _c === void 0 ? 'base' : _c, _d = _a.visible, visible = _d === void 0 ? true : _d, _e = _a.setVisible, setVisible = _e === void 0 ? function () { } : _e, _f = _a.visibleIcon, visibleIcon = _f === void 0 ? true : _f, _g = _a.visibleClose, visibleClose = _g === void 0 ? false : _g, children = _a.children;
385
+ var _b = _a.title, title = _b === void 0 ? '' : _b, caption = _a.caption, _c = _a.variant, variant = _c === void 0 ? 'base' : _c, _d = _a.visible, visible = _d === void 0 ? true : _d, _e = _a.setVisible, setVisible = _e === void 0 ? function () { } : _e, _f = _a.visibleIcon, visibleIcon = _f === void 0 ? true : _f, _g = _a.visibleClose, visibleClose = _g === void 0 ? false : _g, customIcon = _a.customIcon, customMiniIcon = _a.customMiniIcon, children = _a.children;
386
386
  var validateVariant = validUnion(variant, [
387
387
  'base',
388
388
  'info',
@@ -392,6 +392,9 @@ function Alert(_a) {
392
392
  ]);
393
393
  var IconComponent = AlertConfig[validateVariant].icon[visibleIcon ? 'true' : 'false'];
394
394
  var IconX = AlertConfig[visibleClose ? 'true' : 'false'];
395
+ var iconDisplay = visibleIcon
396
+ ? customIcon !== null && customIcon !== void 0 ? customIcon : React.createElement(IconComponent, { size: 20, color: "white" })
397
+ : null;
395
398
  var content = children || React.createElement(Text, { variant: "small-text" }, caption);
396
399
  return (visible && (React.createElement("div", { className: "alert-container flex w-full flex-col" },
397
400
  React.createElement("div", { className: "alert-body w-full ".concat(AlertConfig[validateVariant].bg, " rounded-[5px]") },
@@ -399,13 +402,14 @@ function Alert(_a) {
399
402
  React.createElement("div", { className: "alert-accent flex items-center py-[10px]" },
400
403
  React.createElement("div", { className: "left-0 h-full w-[3px] ".concat(AlertConfig[validateVariant].vBar, " rounded-r-[10px]") })),
401
404
  React.createElement("div", { className: "alert-content flex w-full items-start py-[10px] pe-[10px]" },
402
- React.createElement("div", { className: "icon-area flex ps-[10px]" }, IconComponent && typeof IconComponent === 'function' && (React.createElement("div", { className: "flex p-[7px] ".concat(AlertConfig[validateVariant].ContainerIcon, " items-center justify-center rounded-radius-full") },
403
- React.createElement(IconComponent, { size: 20, color: "white" })))),
404
- React.createElement("div", { className: "content-area flex w-full justify-between" },
405
+ React.createElement("div", { className: "icon-area flex ps-[10px]" }, IconComponent && typeof IconComponent === 'function' && (React.createElement("div", { className: "flex p-[7px] ".concat(AlertConfig[validateVariant].ContainerIcon, " items-center justify-center rounded-radius-full text-bia-white") }, iconDisplay))),
406
+ React.createElement("div", { className: "content-area flex w-full justify-between text-bia-black" },
405
407
  React.createElement("div", { className: "text-area text-area flex flex-col ps-[10px] font-segoe text-size-sm font-normal ".concat(visibleClose ? 'mr-[10px]' : '', " ").concat(visibleIcon ? '' : 'ml-[-10px]') },
406
408
  React.createElement("div", { className: "flex justify-between" },
407
409
  React.createElement(Text, { variant: "normal-text-semibold" }, title)),
408
- content),
410
+ React.createElement("div", { className: "flex flex-row items-start gap-[5px]" },
411
+ customMiniIcon ? customMiniIcon : null,
412
+ content)),
409
413
  IconX && typeof IconX === 'function' && (React.createElement("div", { className: "closable-area flex " },
410
414
  React.createElement(IconX, { className: "cursor-pointer ".concat(AlertConfig[validateVariant].hover, " ").concat(AlertConfig[validateVariant].active, " ").concat(AlertConfig[validateVariant].focus, " ").concat(AlertConfig[validateVariant].close), onClick: function () { return setVisible(false); }, tabIndex: 0 }))))))))));
411
415
  }
@@ -456,6 +460,12 @@ var iconOnlySizeConfig$1 = {
456
460
  sm: 'py-[8px] h-[30px] w-[30px] flex items-center justify-center gap-[5px] ',
457
461
  tn: 'py-[4px] h-[22px] w-[22px] flex items-center justify-center gap-[3px]',
458
462
  };
463
+ var doubleIconSizeConfig = {
464
+ lg: 'py-[13px] h-[48px] flex items-center justify-center gap-[10px]',
465
+ md: 'py-[11px] h-[40px] flex items-center justify-center gap-[5px]',
466
+ sm: 'py-[8px] h-[30px] flex items-center justify-center gap-[5px] ',
467
+ tn: 'py-[4px] h-[22px] flex items-center justify-center gap-[3px]',
468
+ };
459
469
  var shadow = 'shadow-[0px_6px_18px_1px_rgba(188,199,237,0.5)] disabled:shadow-none active:shadow-none';
460
470
  var variantConfig$2 = {
461
471
  default: "text-primary-black bg-bia-grey active:bg-bia-grey-dark-10 hover:bg-bia-grey-hover disabled:bg-bia-grey-disabled disabled:text-bia-grey-active focus-visible:outline focus-visible:outline-offset-0 focus-visible:outline-bia-blue-light-50 focus-visible:outline-[3px] focus-visible:rounded-md shadow-[0px_6px_18px_1px_#BCC7ED80] ".concat(shadow),
@@ -515,9 +525,15 @@ var Button = forwardRef(function (_a, ref) {
515
525
  else {
516
526
  sizingRules = "".concat(sizeConfig$d[validatedSize], " ").concat(sidePaddingConfig[validatedSize]);
517
527
  }
528
+ var hasDoubleIcon = iconRight && iconLeft;
529
+ var isVariantLink = variant.includes('link')
530
+ ? ''
531
+ : "".concat(sidePaddingConfig[validatedSize]);
518
532
  var sizeClass = label || variant === 'form-group'
519
533
  ? " ".concat(minWidthRules, " ").concat(sizingRules)
520
- : "".concat(iconOnlySizeConfig$1[validatedSize], " ").concat(variant.includes('link') ? '' : "".concat(sidePaddingConfig[validatedSize]));
534
+ : hasDoubleIcon
535
+ ? "".concat(doubleIconSizeConfig[validatedSize], " ").concat(isVariantLink)
536
+ : "".concat(iconOnlySizeConfig$1[validatedSize], " ").concat(isVariantLink, " ").concat(isVariantLink);
521
537
  var classString = "\n ".concat(variantConfig$2[validatedVariant], "\n ").concat(sizeClass, "\n ").concat(radiusConfig$1[validatedRadius][validatedSize], "\n ").concat(className, "\n ");
522
538
  return (React.createElement("button", __assign({ ref: ref, type: "button", className: "bianic-button bianic-fgc-target flex items-center justify-center font-semibold ".concat(classString), disabled: disabled }, props),
523
539
  childrenElement(iconLeft || left),
@@ -602,9 +618,9 @@ var typeConfig = {
602
618
  };
603
619
 
604
620
  function Badge(_a) {
605
- var type = _a.type, children = _a.children, color = _a.color, isInverted = _a.isInverted, className = _a.className;
621
+ var _b = _a.type, type = _b === void 0 ? 'standart' : _b, children = _a.children, color = _a.color, isInverted = _a.isInverted, className = _a.className;
606
622
  var divRef = useRef(null);
607
- var _b = useState(0), fontSize = _b[0], setFontSize = _b[1];
623
+ var _c = useState(0), fontSize = _c[0], setFontSize = _c[1];
608
624
  var typeClasses = typeConfig[type];
609
625
  var isStandart = type === 'standart';
610
626
  var bgColor = isInverted && isStandart ? '#ffffff' : color || '';
@@ -619,7 +635,7 @@ function Badge(_a) {
619
635
  setFontSize(fontSizeStyle);
620
636
  }
621
637
  }, []);
622
- return (React.createElement("span", { className: "w-fit bg-bia-grey text-bia-coolgrey flex justify-center items-center font-segoe font-semibold leading-none ".concat(typeClasses, " ").concat(className), style: {
638
+ return (React.createElement("span", { className: "flex w-fit items-center justify-center bg-bia-grey font-segoe font-semibold leading-none text-bia-coolgrey ".concat(typeClasses, " ").concat(className), style: {
623
639
  backgroundColor: bgColor,
624
640
  color: textColor,
625
641
  paddingLeft: horizontalPadding,
@@ -630,6 +646,7 @@ function Badge(_a) {
630
646
  React.createElement("span", { ref: divRef, style: { marginTop: contentMarginTop } }, children)));
631
647
  }
632
648
  Badge.defaultProps = {
649
+ type: 'standart',
633
650
  isInverted: false,
634
651
  color: undefined,
635
652
  };
@@ -1862,24 +1879,40 @@ var MenuElement = forwardRef(function (_a, ref) {
1862
1879
  })));
1863
1880
  });
1864
1881
  var MenuContainer = function (props) {
1865
- var _a = props.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = props.children, _b = props.open, open = _b === void 0 ? true : _b, _c = props.onClose, onClose = _c === void 0 ? function () { } : _c, _d = props.className, className = _d === void 0 ? '' : _d, _e = props.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = props.zIndex, zIndex = _f === void 0 ? 100 : _f, _g = props.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, anchorRef = props.anchorRef, restProps = __rest(props, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex", "onClickItem", "anchorRef"]);
1882
+ var _a = props.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = props.children, _b = props.open, open = _b === void 0 ? true : _b, _c = props.onClose, onClose = _c === void 0 ? function () { } : _c, _d = props.className, className = _d === void 0 ? '' : _d, _e = props.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = props.zIndex, zIndex = _f === void 0 ? 100 : _f, _g = props.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, anchorRef = props.anchorRef, matchAnchorWidth = props.matchAnchorWidth, restProps = __rest(props, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex", "onClickItem", "anchorRef", "matchAnchorWidth"]);
1866
1883
  if (!open)
1867
1884
  return null;
1868
1885
  var MenuContainerRef = useRef(null);
1869
1886
  var positionStyle = usePopupPosition(anchorRef, MenuContainerRef)[0];
1870
1887
  var newStyle = useMemo(function () {
1871
- var _a;
1888
+ var _a, _b;
1872
1889
  if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)) {
1873
1890
  return {};
1874
1891
  }
1875
- return __assign({ zIndex: zIndex + 10, minWidth: (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)
1876
- ? (_a = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth
1877
- : undefined }, positionStyle);
1892
+ var widthStyle = {};
1893
+ switch (matchAnchorWidth) {
1894
+ case 'min':
1895
+ widthStyle = {
1896
+ minWidth: "".concat((_a = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth, "px"),
1897
+ };
1898
+ break;
1899
+ case 'exact':
1900
+ widthStyle = {
1901
+ width: "".concat((_b = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _b === void 0 ? void 0 : _b.offsetWidth, "px"),
1902
+ };
1903
+ break;
1904
+ default:
1905
+ widthStyle = { minWidth: '120px' };
1906
+ break;
1907
+ }
1908
+ return __assign(__assign({ zIndex: zIndex + 10 }, widthStyle), positionStyle);
1878
1909
  }, [positionStyle]);
1879
1910
  var menuElement = (React.createElement(MenuElement, __assign({ isTopFlat: isTopFlat, children: children, className: className, zIndex: zIndex, menuRef: MenuContainerRef, onClose: onClose, onClickItem: onClickItem, style: newStyle }, restProps)));
1880
1911
  return (React.createElement(React.Fragment, null,
1881
1912
  isWithOverlay && (React.createElement("div", { className: "bianic-menu-overlay fixed left-0 top-0 z-0 h-screen w-screen", onClick: function () { return onClose(); }, style: { zIndex: zIndex } })),
1882
- (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) ? createPortal(menuElement, document.body) : menuElement));
1913
+ (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)
1914
+ ? createPortal(menuElement, document.body)
1915
+ : menuElement));
1883
1916
  };
1884
1917
  MenuContainer.defaultProps = {
1885
1918
  isTopFlat: false,
@@ -2359,84 +2392,13 @@ DefaultDropdownItem.defaultProps = {
2359
2392
  caption: '',
2360
2393
  };
2361
2394
 
2362
- var containerSizeConfig = {
2363
- sm: 'min-w-[72px]',
2364
- md: 'min-w-[96px]',
2365
- };
2366
- var itemSizeConfig = {
2367
- sm: 'min-h-[30px] border-y-[2px] border-bia-white',
2368
- md: 'min-h-[40px] border-y-[3px] border-bia-white',
2369
- };
2370
- var fontConfig = {
2371
- sm: 'text-[12px] font-[400]',
2372
- md: 'text-[14px] font-[350]',
2373
- };
2374
-
2375
- var DropdownContNoAnchor = forwardRef(function DropdownContNoAnchor(propsComp, ref) {
2376
- 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 ? 100 : _h, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex"]);
2377
- var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
2378
- var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
2379
- var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
2380
- var handleClickDrpdownItem = function (e, val) {
2381
- onClickItem(e, val);
2382
- onClose();
2383
- };
2384
- return (open && (React.createElement(React.Fragment, null,
2385
- isWithOverlay && (React.createElement("div", { className: "bianic-dropdown-overlay fixed left-0 top-0 h-screen w-screen", style: { zIndex: zIndex }, onClick: function () { return onClose(); } })),
2386
- React.createElement("div", __assign({ style: {
2387
- zIndex: zIndex + 10, // Ensure dropdown is above overlay
2388
- }, 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) {
2389
- return React.isValidElement(child)
2390
- ? // Kirimkan handleItemClick sebagai props onClick ke setiap DropdownItem
2391
- cloneElement(child, {
2392
- onClose: function () { return onClose(); },
2393
- size: size,
2394
- onClickItem: function (e, val) { return handleClickDrpdownItem(e, val); },
2395
- zIndex: zIndex + 10,
2396
- })
2397
- : child;
2398
- })))));
2399
- });
2400
- DropdownContNoAnchor.defaultProps = {
2401
- isTopFlat: false,
2402
- };
2403
-
2404
2395
  var sizeUnion$2 = ['md', 'sm'];
2405
2396
  function SelectInput(_a) {
2406
2397
  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, _d = _a.isValid, isValid = _d === void 0 ? null : _d, label = _a.label, _e = _a.options, options = _e === void 0 ? [] : _e, _f = _a.required, required = _f === void 0 ? false : _f, selected = _a.selected, setSelected = _a.setSelected, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, children = _a.children, _h = _a.dropContProps, _j = _h === void 0 ? {} : _h, _k = _j.className, dropContClassName = _k === void 0 ? '' : _k, restDropContProps = __rest(_j, ["className"]), props = __rest(_a, ["descText", "disabled", "size", "id", "isValid", "label", "options", "required", "selected", "setSelected", "onClickDropdown", "children", "dropContProps"]);
2407
2398
  var _l = useState(false), isOpen = _l[0], setIsOpen = _l[1];
2408
- var _m = useState(false), isDropUp = _m[0], setIsDropUp = _m[1];
2409
2399
  var validatedSize = validUnion(size, sizeUnion$2);
2410
- var _o = sizeConfig$8[validatedSize], searchSize = _o.searchSize, iconSize = _o.iconSize;
2400
+ var _m = sizeConfig$8[validatedSize], searchSize = _m.searchSize, iconSize = _m.iconSize;
2411
2401
  var inputRef = useRef(null);
2412
- var dropdownContRef = useRef(null);
2413
- var handleOutsideClick = function (e) {
2414
- if (inputRef.current && !inputRef.current.contains(e.target)) {
2415
- setIsOpen(false);
2416
- }
2417
- };
2418
- useEffect(function () {
2419
- document.addEventListener('mousedown', handleOutsideClick);
2420
- return function () {
2421
- document.removeEventListener('mousedown', handleOutsideClick);
2422
- };
2423
- });
2424
- useEffect(function () {
2425
- var _a, _b;
2426
- if (inputRef.current) {
2427
- // Adjust dropdown position to prevent show up out of screen
2428
- var windowHeight = window.innerHeight;
2429
- var inputRect = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
2430
- var inputBottom = inputRect === null || inputRect === void 0 ? void 0 : inputRect.bottom;
2431
- var diff = windowHeight - inputBottom;
2432
- var dropdownRect = (_b = dropdownContRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
2433
- var dropdownHeight = (dropdownRect === null || dropdownRect === void 0 ? void 0 : dropdownRect.height) || 0;
2434
- if (dropdownHeight >= diff)
2435
- setIsDropUp(true);
2436
- else
2437
- setIsDropUp(false);
2438
- }
2439
- }, [isOpen]);
2440
2402
  var isObjectOptionItem = false;
2441
2403
  if (options.every(function (item) { return typeof item === 'object' && item !== null; }))
2442
2404
  isObjectOptionItem = true;
@@ -2444,33 +2406,20 @@ function SelectInput(_a) {
2444
2406
  ? selected.label
2445
2407
  : selected;
2446
2408
  var optionsRef = useRef(null);
2447
- useEffect(function () {
2448
- if (isOpen && inputRef.current && optionsRef.current) {
2449
- var selectRect = inputRef.current.getBoundingClientRect();
2450
- var optionsElement = optionsRef.current;
2451
- var windowHeight = window.innerHeight;
2452
- // Cek ruang di bawah
2453
- var spaceBelow = windowHeight - selectRect.bottom;
2454
- var maxHeight = void 0;
2455
- maxHeight = spaceBelow - 10; // Beri margin
2456
- optionsElement.style.maxHeight = "".concat(Math.max(0, maxHeight), "px");
2457
- }
2458
- }, [isOpen]);
2459
- var dropdownPosition = isDropUp ? 'bottom-full' : 'top-full';
2460
2409
  var descColor = 'text-primary-cool';
2461
2410
  var isExistValidation = isValid !== null && isValid !== undefined;
2462
2411
  if (!disabled && isExistValidation && isValid)
2463
2412
  descColor = 'text-bia-green';
2464
2413
  if (!disabled && isExistValidation && !isValid)
2465
2414
  descColor = 'text-bia-red';
2466
- return (React.createElement("div", { className: "bianic-fgc-container bianic-text-input-container field-group flex w-full flex-col", ref: inputRef },
2415
+ return (React.createElement("div", { className: "bianic-fgc-container bianic-text-input-container field-group flex w-full flex-col" },
2467
2416
  React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold" },
2468
2417
  childrenElement(label),
2469
2418
  required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
2470
2419
  React.createElement("div", { className: "group relative w-full" },
2471
- React.createElement("input", __assign({ className: "bianic-fgc-target 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)),
2420
+ React.createElement("input", __assign({ className: "bianic-fgc-target 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, ref: inputRef }, props)),
2472
2421
  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)),
2473
- children === undefined && isOpen && (React.createElement("div", { className: "absolute z-10 w-full rounded-b-md border border-bia-grey-dark-10 bg-primary-white shadow-lg ".concat(dropdownPosition), ref: optionsRef, onClick: onClickDropdown }, options.map(function (option) {
2422
+ children === undefined && isOpen && (React.createElement("div", { className: "absolute z-10 w-full rounded-b-md border border-bia-grey-dark-10 bg-primary-white shadow-lg", ref: optionsRef, onClick: onClickDropdown }, options.map(function (option) {
2474
2423
  var isSelected = JSON.stringify(option) === JSON.stringify(selected);
2475
2424
  var optionLabel = isObjectOptionItem ? option.label : option;
2476
2425
  var optionCaption = isObjectOptionItem ? option.caption : '';
@@ -2482,7 +2431,7 @@ function SelectInput(_a) {
2482
2431
  setIsOpen(false);
2483
2432
  } }));
2484
2433
  }))),
2485
- children && isOpen && (React.createElement(DropdownContNoAnchor, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, ref: dropdownContRef, 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(dropdownPosition, " ").concat(dropContClassName) }, restDropContProps), React.Children.map(children, function (child) {
2434
+ 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), anchorRef: inputRef, matchAnchorWidth: "min" }, restDropContProps), React.Children.map(children, function (child) {
2486
2435
  if (React.isValidElement(child)) {
2487
2436
  return React.cloneElement(child, {
2488
2437
  isSelected: selected && selected.id === child.props.value.id,
@@ -2522,6 +2471,19 @@ var sizeConfig$6 = {
2522
2471
  },
2523
2472
  };
2524
2473
 
2474
+ var containerSizeConfig = {
2475
+ sm: 'min-w-[72px]',
2476
+ md: 'min-w-[96px]',
2477
+ };
2478
+ var itemSizeConfig = {
2479
+ sm: 'min-h-[30px] border-y-[2px] border-bia-white',
2480
+ md: 'min-h-[40px] border-y-[3px] border-bia-white',
2481
+ };
2482
+ var fontConfig = {
2483
+ sm: 'text-[12px] font-[400]',
2484
+ md: 'text-[14px] font-[350]',
2485
+ };
2486
+
2525
2487
  var DropdownElement = forwardRef(function (_a, ref) {
2526
2488
  var isTopFlat = _a.isTopFlat, children = _a.children, className = _a.className, size = _a.size, zIndex = _a.zIndex, style = _a.style, onClose = _a.onClose, onClickItem = _a.onClickItem, restProps = __rest(_a, ["isTopFlat", "children", "className", "size", "zIndex", "style", "onClose", "onClickItem"]);
2527
2489
  var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
@@ -2543,19 +2505,34 @@ var DropdownElement = forwardRef(function (_a, ref) {
2543
2505
  })));
2544
2506
  });
2545
2507
  var DropdownContainer = function (propsComp) {
2546
- 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 ? 100 : _h, anchorRef = propsComp.anchorRef, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex", "anchorRef"]);
2508
+ 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 ? 100 : _h, anchorRef = propsComp.anchorRef, matchAnchorWidth = propsComp.matchAnchorWidth, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex", "anchorRef", "matchAnchorWidth"]);
2547
2509
  if (!open)
2548
2510
  return null;
2549
2511
  var dropdownRef = useRef(null);
2550
2512
  var positionStyle = usePopupPosition(anchorRef, dropdownRef)[0];
2551
2513
  var newStyle = useMemo(function () {
2552
- var _a;
2514
+ var _a, _b, _c;
2553
2515
  if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)) {
2554
2516
  return {};
2555
2517
  }
2556
- return __assign({ zIndex: zIndex + 10, minWidth: (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)
2557
- ? (_a = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth
2558
- : undefined }, positionStyle);
2518
+ var widthStyle = {};
2519
+ switch (matchAnchorWidth) {
2520
+ case 'min':
2521
+ widthStyle = {
2522
+ minWidth: "".concat((_a = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth, "px"),
2523
+ };
2524
+ break;
2525
+ case 'exact':
2526
+ widthStyle = {
2527
+ width: "".concat((_b = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _b === void 0 ? void 0 : _b.offsetWidth, "px"),
2528
+ maxWidth: "".concat((_c = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _c === void 0 ? void 0 : _c.offsetWidth, "px"),
2529
+ };
2530
+ break;
2531
+ default:
2532
+ widthStyle = { width: 'fit-content' };
2533
+ break;
2534
+ }
2535
+ return __assign(__assign({ zIndex: zIndex + 10 }, widthStyle), positionStyle);
2559
2536
  }, [positionStyle]);
2560
2537
  var dropdownElement = (React.createElement(DropdownElement, __assign({ ref: dropdownRef, isTopFlat: isTopFlat, children: children, className: className, size: size, zIndex: zIndex, onClose: onClose, onClickItem: onClickItem, style: newStyle }, restProps)));
2561
2538
  return (React.createElement(React.Fragment, null,
@@ -2568,6 +2545,35 @@ DropdownContainer.defaultProps = {
2568
2545
  isTopFlat: false,
2569
2546
  };
2570
2547
 
2548
+ var DropdownContNoAnchor = forwardRef(function DropdownContNoAnchor(propsComp, ref) {
2549
+ 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 ? 100 : _h, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex"]);
2550
+ var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
2551
+ var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
2552
+ var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
2553
+ var handleClickDrpdownItem = function (e, val) {
2554
+ onClickItem(e, val);
2555
+ onClose();
2556
+ };
2557
+ return (open && (React.createElement(React.Fragment, null,
2558
+ isWithOverlay && (React.createElement("div", { className: "bianic-dropdown-overlay fixed left-0 top-0 h-screen w-screen", style: { zIndex: zIndex }, onClick: function () { return onClose(); } })),
2559
+ React.createElement("div", __assign({ style: {
2560
+ zIndex: zIndex + 10, // Ensure dropdown is above overlay
2561
+ }, 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) {
2562
+ return React.isValidElement(child)
2563
+ ? // Kirimkan handleItemClick sebagai props onClick ke setiap DropdownItem
2564
+ cloneElement(child, {
2565
+ onClose: function () { return onClose(); },
2566
+ size: size,
2567
+ onClickItem: function (e, val) { return handleClickDrpdownItem(e, val); },
2568
+ zIndex: zIndex + 10,
2569
+ })
2570
+ : child;
2571
+ })))));
2572
+ });
2573
+ DropdownContNoAnchor.defaultProps = {
2574
+ isTopFlat: false,
2575
+ };
2576
+
2571
2577
  function DropdownItem(_a) {
2572
2578
  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 ? 100 : _h, props = __rest(_a, ["children", "className", "onClickItem", "onClose", "size", "value", "content", "disabled", "zIndex"]);
2573
2579
  var _j = useState(false), isHovered = _j[0], setIsHovered = _j[1];
@@ -2766,7 +2772,7 @@ function LiveSearch(_a) {
2766
2772
  setIsOpen(false);
2767
2773
  } }));
2768
2774
  }))),
2769
- children && (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 ".concat(dropContClassName), anchorRef: inputRef }, restDropContProps), hasFilteredResults
2775
+ children && (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 ".concat(dropContClassName), anchorRef: inputRef, matchAnchorWidth: "min" }, restDropContProps), hasFilteredResults
2770
2776
  ? renderedChildren
2771
2777
  : // If no results and searchTerm is present
2772
2778
  searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))),