bianic-ui 1.0.0-beta.27 → 1.0.0-beta.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -284,29 +284,42 @@ Text.defaultProps = {
284
284
  };
285
285
 
286
286
  function Alert(_a) {
287
- var title = _a.title, caption = _a.caption, variant = _a.variant, visible = _a.visible, setVisible = _a.setVisible, visibleIcon = _a.visibleIcon, visibleClose = _a.visibleClose;
288
- var IconComponent = AlertConfig[variant].icon[visibleIcon ? 'true' : 'false'];
287
+ 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;
288
+ var validateVariant = validUnion(variant, [
289
+ 'base',
290
+ 'info',
291
+ 'success',
292
+ 'warning',
293
+ 'danger',
294
+ ]);
295
+ var IconComponent = AlertConfig[validateVariant].icon[visibleIcon ? 'true' : 'false'];
289
296
  var IconX = AlertConfig[visibleClose ? 'true' : 'false'];
290
297
  var handleCloseAlert = function () {
291
298
  setVisible(false);
292
299
  };
293
- return (visible && (React.createElement("div", { className: "flex flex-col w-full" },
294
- React.createElement("div", { className: "w-full ".concat(AlertConfig[variant].bg, " rounded-[5px] mb-5") },
300
+ return (visible && (React.createElement("div", { className: "alert-container flex flex-col w-full" },
301
+ React.createElement("div", { className: "alert-body w-full ".concat(AlertConfig[validateVariant].bg, " rounded-[5px]") },
295
302
  React.createElement("div", { className: "flex w-full" },
296
- React.createElement("div", { className: "accent flex items-center py-[10px]" },
297
- React.createElement("div", { className: "left-0 w-[3px] h-full ".concat(AlertConfig[variant].vBar, " rounded-r-[10px]") })),
298
- React.createElement("div", { className: "content w-full flex py-[10px] pe-[10px] items-start" },
299
- React.createElement("div", { className: "icon-area flex ps-[10px]" }, IconComponent && typeof IconComponent === 'function' && (React.createElement("div", { className: "flex p-[7px] ".concat(AlertConfig[variant].ContainerIcon, " items-center justify-center rounded-radius-full") },
303
+ React.createElement("div", { className: "alert-accent flex items-center py-[10px]" },
304
+ React.createElement("div", { className: "left-0 w-[3px] h-full ".concat(AlertConfig[validateVariant].vBar, " rounded-r-[10px]") })),
305
+ React.createElement("div", { className: "alert-content w-full flex py-[10px] pe-[10px] items-start" },
306
+ 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") },
300
307
  React.createElement(IconComponent, { size: 20, color: "white" })))),
301
- React.createElement("div", { className: "flex w-full justify-between" },
302
- React.createElement("div", { className: "flex ps-[10px] text-area flex-col ".concat(visibleClose ? 'mr-[10px]' : '', " ").concat(visibleIcon ? '' : 'ml-[-10px]') },
308
+ React.createElement("div", { className: "content-area flex w-full justify-between" },
309
+ React.createElement("div", { className: "text-area flex ps-[10px] text-area flex-col ".concat(visibleClose ? 'mr-[10px]' : '', " ").concat(visibleIcon ? '' : 'ml-[-10px]') },
303
310
  React.createElement("div", { className: "flex justify-between" },
304
311
  React.createElement(Text, { variant: "normal-text-semibold" }, title)),
305
312
  React.createElement(Text, { variant: "small-text" }, caption)),
306
- React.createElement("div", { className: "flex closable-area" }, IconX && typeof IconX === 'function' && (React.createElement(IconX, { className: "cursor-pointer ".concat(AlertConfig[variant].hover, " ").concat(AlertConfig[variant].active, " ").concat(AlertConfig[variant].focus, " ").concat(AlertConfig[variant].close), onClick: function () { return handleCloseAlert(); }, tabIndex: 0 }))))))))));
313
+ IconX && typeof IconX === 'function' && (React.createElement("div", { className: "closable-area flex " },
314
+ 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 handleCloseAlert(); }, tabIndex: 0 }))))))))));
307
315
  }
308
316
  Alert.defaultProps = {
309
- title: null,
317
+ title: '',
318
+ variant: 'base',
319
+ visible: true,
320
+ setVisible: function () { },
321
+ visibleIcon: true,
322
+ visibleClose: false,
310
323
  };
311
324
 
312
325
  /******************************************************************************
@@ -437,7 +450,7 @@ function Button(_a) {
437
450
  ? sizeConfig$b[validatedSize]
438
451
  : iconOnlySizeConfig$1[validatedSize];
439
452
  var classString = "\n ".concat(variantConfig$1[validatedVariant], " \n ").concat(sizeClass, " \n ").concat(radiusConfig[validatedRadius][validatedSize], " \n ").concat(className, "\n ");
440
- return (React.createElement("button", __assign({ type: "button", className: "button flex justify-center items-center ".concat(classString), disabled: disabled }, props),
453
+ return (React.createElement("button", __assign({ type: "button", className: "button flex justify-center items-center font-semibold ".concat(classString), disabled: disabled }, props),
441
454
  childrenElement(iconLeft || left),
442
455
  childrenElement(label),
443
456
  childrenElement(iconRight || right)));
@@ -1545,9 +1558,9 @@ function TextInput(_a) {
1545
1558
  descColor = 'text-bia-red';
1546
1559
  var bottomBorderColor = 'hover:border-b-bia-blue focus:border-b-bia-blue';
1547
1560
  if (!disabled && isExistValidation && isValid)
1548
- bottomBorderColor = 'border-b-bia-green';
1561
+ bottomBorderColor = 'hover:border-b-bia-green focus:border-b-bia-green';
1549
1562
  if (!disabled && isExistValidation && !isValid)
1550
- bottomBorderColor = 'border-b-bia-red';
1563
+ bottomBorderColor = 'hover:border-b-bia-red focus:border-b-bia-red';
1551
1564
  var iconElement = null;
1552
1565
  if (!disabled && isExistValidation)
1553
1566
  iconElement = React.createElement(ValidationIcon, { isValid: isValid, iconSize: iconSize });
@@ -1744,7 +1757,7 @@ var sizeConfig$5 = {
1744
1757
 
1745
1758
  /* eslint-disable @typescript-eslint/no-explicit-any */
1746
1759
  function DefaultDropdownItem(_a) {
1747
- var _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.label, label = _c === void 0 ? '' : _c, _d = _a.onClick, onClick = _d === void 0 ? function () { } : _d, _e = _a.size, size = _e === void 0 ? 'md' : _e, isSelected = _a.isSelected, options = _a.options, caption = _a.caption;
1760
+ var _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.label, label = _c === void 0 ? '' : _c, _d = _a.onClick, onClick = _d === void 0 ? function () { } : _d, _e = _a.size, size = _e === void 0 ? 'md' : _e, isSelected = _a.isSelected, options = _a.options;
1748
1761
  var _f = React.useState(false), isHovered = _f[0], setisHovered = _f[1];
1749
1762
  var _g = React.useState(false), isHoveredSubMenu = _g[0], setIsHoveredSubMenu = _g[1];
1750
1763
  var isOpenDropdown = isHovered || isHoveredSubMenu;
@@ -1753,11 +1766,9 @@ function DefaultDropdownItem(_a) {
1753
1766
  var itemClass = "".concat(item, " ").concat(selectedClass, " ").concat(className);
1754
1767
  var isExistSubDropdown = options.length !== 0;
1755
1768
  return (React.createElement("div", { className: "w-full relative 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 () { } },
1756
- React.createElement("div", { className: "hover:bg-bia-blue-light-90 active:bg-bia-blue-light-80 select-none flex flex-col ".concat(itemClass) },
1757
- React.createElement("span", null,
1758
- label,
1759
- isExistSubDropdown && (React.createElement(TbChevronRight, { className: "float-right text-bia-grey" }))),
1760
- React.createElement(Text, { variant: "small-text", extended: "text-bia-coolgrey" }, caption)),
1769
+ React.createElement("div", { className: "hover:bg-bia-blue-light-90 active:bg-bia-blue-light-80 select-none ".concat(itemClass) },
1770
+ label,
1771
+ isExistSubDropdown && (React.createElement(TbChevronRight, { className: "float-right text-bia-grey" }))),
1761
1772
  isOpenDropdown && options && isExistSubDropdown && (React.createElement("div", { className: "absolute z-50 top-0 right-0 translate-x-full border w-full bg-primary-white border-bia-grey-dark-10 rounded-md shadow-lg", onMouseEnter: function () { return setIsHoveredSubMenu(true); }, onMouseLeave: function () { return setIsHoveredSubMenu(false); } }, options.map(function (option) { return (React.createElement(DefaultDropdownItem, { label: option.label, size: size, options: option.options })); })))));
1762
1773
  }
1763
1774
  DefaultDropdownItem.defaultProps = {
@@ -1766,13 +1777,11 @@ DefaultDropdownItem.defaultProps = {
1766
1777
  size: 'md',
1767
1778
  options: [],
1768
1779
  isSelected: false,
1769
- caption: '',
1770
1780
  };
1771
1781
 
1772
- /* eslint-disable @typescript-eslint/no-explicit-any */
1773
1782
  var sizeUnion$1 = ['md', 'sm'];
1774
1783
  function SelectInput(_a) {
1775
- 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;
1784
+ 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, props = __rest(_a, ["descText", "disabled", "size", "id", "label", "options", "required", "selected", "setSelected"]);
1776
1785
  var _e = React.useState(false), isOpen = _e[0], setIsOpen = _e[1];
1777
1786
  var validatedSize = validUnion(size, sizeUnion$1);
1778
1787
  var _f = sizeConfig$6[validatedSize], searchSize = _f.searchSize, iconSize = _f.iconSize;
@@ -1788,21 +1797,21 @@ function SelectInput(_a) {
1788
1797
  document.removeEventListener('mousedown', handleOutsideClick);
1789
1798
  };
1790
1799
  });
1791
- return (React.createElement("div", { className: "field-group w-full flex flex-col", ref: inputRef },
1792
- React.createElement("label", { htmlFor: id, className: "label text-xs pb-2 font-semibold" },
1800
+ return (React.createElement("div", { className: "field-group flex w-full flex-col", ref: inputRef },
1801
+ React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold" },
1793
1802
  childrenElement(label),
1794
1803
  required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
1795
- React.createElement("div", { className: "group w-full relative" },
1796
- React.createElement("input", { className: "field bg-primary-white disabled:bg-bia-grey-light-80 pe-8 w-full border border-bia-grey-dark-10 enabled:hover:border-b-bia-blue enabled:hover:rounded-b-none enabled:focus:border-b-bia-blue enabled:focus:rounded-b-none focus-visible:outline-none cursor-pointer rounded disabled:text-bia-coolgrey peer ".concat(searchSize), onClick: function () { return setIsOpen(!isOpen); }, value: selected === null || selected === void 0 ? void 0 : selected.label, readOnly: true, id: id, disabled: disabled }),
1797
- React.createElement("div", { className: "absolute inset-y-0 pl-3 flex items-center pointer-events-none text-bia-coolgrey peer-disabled:text-bia-coolgrey-light-50 ".concat(iconSize) }, isOpen ? (React.createElement(TbChevronUp, { className: "" })) : (React.createElement(TbChevronDown, { className: "" }))),
1798
- isOpen && (React.createElement("div", { className: "absolute border w-full bg-primary-white border-bia-grey-dark-10 rounded-b-md shadow-lg z-10" }, options.map(function (option) {
1804
+ React.createElement("div", { className: "group relative w-full" },
1805
+ 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: selected === null || selected === void 0 ? void 0 : selected.label, readOnly: true, id: id, disabled: disabled }, props)),
1806
+ 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, { className: "" })) : (React.createElement(TbChevronDown, { className: "" }))),
1807
+ isOpen && (React.createElement("div", { className: "absolute z-10 w-full rounded-b-md border border-bia-grey-dark-10 bg-primary-white shadow-lg" }, options.map(function (option) {
1799
1808
  var isSelected = selected && selected.id && option.id === selected.id;
1800
- return (React.createElement(DefaultDropdownItem, { label: option.label, caption: option.caption, size: validatedSize, isSelected: isSelected, onClick: function () {
1809
+ return (React.createElement(DefaultDropdownItem, { label: option.label, size: validatedSize, isSelected: isSelected, onClick: function () {
1801
1810
  setSelected(option);
1802
1811
  setIsOpen(false);
1803
1812
  } }));
1804
1813
  })))),
1805
- React.createElement("span", { className: "desc text-primary-cool text-xs mt-2" }, descText)));
1814
+ React.createElement("span", { className: "desc mt-2 text-xs text-primary-cool" }, descText)));
1806
1815
  }
1807
1816
  SelectInput.defaultProps = {
1808
1817
  descText: '',
@@ -1817,39 +1826,30 @@ SelectInput.defaultProps = {
1817
1826
 
1818
1827
  function SelectInputSimulation(_a) {
1819
1828
  var _b = _a.size, size = _b === void 0 ? 'md' : _b;
1820
- var _c = React.useState({
1821
- id: 1,
1822
- label: 'Mohammed Salah',
1823
- caption: 'Liverpool',
1824
- }), selected = _c[0], setSelected = _c[1];
1829
+ var _c = React.useState(null), selected = _c[0], setSelected = _c[1];
1825
1830
  var optionData = [
1826
1831
  {
1827
1832
  id: 1,
1828
1833
  label: 'Mohammed Salah',
1829
- caption: 'Liverpool',
1830
1834
  },
1831
1835
  {
1832
1836
  id: 2,
1833
1837
  label: 'Cristiono Ronaldo',
1834
- caption: 'Manchester United',
1835
1838
  },
1836
1839
  {
1837
1840
  id: 3,
1838
1841
  label: 'Vinicius Junior',
1839
- caption: 'Real Madrid',
1840
1842
  },
1841
1843
  {
1842
1844
  id: 4,
1843
1845
  label: 'Lionel Messi',
1844
- caption: 'Paris Saint Germain',
1845
1846
  },
1846
1847
  {
1847
1848
  id: 5,
1848
1849
  label: 'Ricardo Kaka',
1849
- caption: 'AC Milan',
1850
1850
  },
1851
1851
  ];
1852
- return (React.createElement(SelectInput, { label: "Input Select", descText: "Deskripsi Input Select", options: optionData, selected: selected, setSelected: setSelected, size: size, id: "demo-id" }));
1852
+ return (React.createElement(SelectInput, { label: "Input Select", descText: "Deskripsi Input Select", options: optionData, selected: selected, setSelected: setSelected, size: size, placeholder: '-- Select Player --', id: "demo-id" }));
1853
1853
  }
1854
1854
 
1855
1855
  var sizeConfig$4 = {
@@ -2501,7 +2501,7 @@ var iconOnlySizeConfig = {
2501
2501
  sm: 'p-[4px]',
2502
2502
  tn: 'p-[2px]',
2503
2503
  };
2504
- var closeConfig = {
2504
+ var closeColorConfig = {
2505
2505
  default: 'bg-bia-grey-dark-30 text-primary-white',
2506
2506
  blue: 'bg-bia-white-transparent-50 text-bia-blue',
2507
2507
  teal: 'bg-bia-white-transparent-50 text-bia-teal',
@@ -2511,6 +2511,11 @@ var closeConfig = {
2511
2511
  black: 'bg-bia-white-transparent-50 text-primary-black',
2512
2512
  white: 'bg-bia-grey-dark-30 text-primary-white',
2513
2513
  };
2514
+ var closeSizeConfig = {
2515
+ md: 'w-[18px] h-[18px] text-[14px]',
2516
+ sm: 'w-[12px] h-[12px] text-[9.33px]',
2517
+ tn: 'w-[12px] h-[12px] text-[9.33px]',
2518
+ };
2514
2519
  var rightPaddingConfig = {
2515
2520
  md: 'pr-[8px]',
2516
2521
  sm: 'pr-[5px]',
@@ -2565,24 +2570,27 @@ var TagLabel = function (_a) {
2565
2570
  var maxWidthStyle = !isBlock ? maxWidth + 'px' : '';
2566
2571
  var textClass = isBlock ? 'text-center' : 'text-left';
2567
2572
  var containerClass = "".concat(sizeClass, " ").concat(colorClass, " ").concat(roundedClass, " ").concat(isCloseableClass, " ").concat(blockclass);
2568
- var closeClass = validatedColor === 'custom'
2573
+ var closeColor = validatedColor === 'custom'
2569
2574
  ? isDark
2570
2575
  ? "bg-bia-white-transparent-50 text-bia-".concat(bgColor)
2571
2576
  : "bg-bia-grey-dark-30 text-bia-".concat(bgColor)
2572
- : closeConfig[validatedColor];
2577
+ : closeColorConfig[validatedColor];
2578
+ var closeClass = "".concat(closeColor, " ").concat(closeSizeConfig[validatedSize]);
2573
2579
  return (open && (React.createElement("div", __assign({ className: "tag-label flex items-center gap-x-[5px] text-size-base ".concat(containerClass), style: {
2574
2580
  maxWidth: maxWidthStyle,
2575
2581
  } }, props),
2576
- React.createElement("div", { style: {
2582
+ leftIcon && (React.createElement("div", { style: {
2577
2583
  width: sizeCount + 'px',
2578
2584
  height: sizeCount + 'px',
2579
- }, className: "flex items-center justify-center" },
2580
- React.createElement("div", { ref: containerRef }, leftIcon ||
2581
- (validatedVariant === 'icon' && (React.createElement(TbCheck, { className: defaultIconSize }))))),
2582
- validatedVariant !== 'icon' && (React.createElement("span", { className: "pb-[2px] truncate w-full ".concat(textClass) }, text)),
2583
- validatedVariant !== 'icon' && rightIcon,
2584
- validatedVariant === 'closeable' && (React.createElement("button", { type: "button", onClick: closeHandler, className: "aspect-square w-[18px] flex justify-center items-center rounded-full mt-[1px] ".concat(closeClass) },
2585
- React.createElement(TbX, { className: "text-[18px]" }))))));
2585
+ }, className: "flex items-center justify-center", ref: containerRef }, leftIcon ||
2586
+ (validatedVariant === 'icon' && (React.createElement(TbCheck, { className: defaultIconSize }))))),
2587
+ validatedVariant !== 'icon' && text && (React.createElement("span", { className: "w-full truncate pb-[2px] ".concat(textClass) }, text)),
2588
+ validatedVariant === 'label' && rightIcon && (React.createElement("div", { className: "block" },
2589
+ " ",
2590
+ rightIcon,
2591
+ " ")),
2592
+ validatedVariant === 'closeable' && (React.createElement("button", { type: "button", onClick: closeHandler, className: "flex aspect-square items-center justify-center rounded-full pt-[1px] ".concat(closeClass) },
2593
+ React.createElement(TbX, null))))));
2586
2594
  };
2587
2595
  TagLabel.defaultProps = {
2588
2596
  variant: 'default',