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

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 });
@@ -1769,10 +1782,9 @@ DefaultDropdownItem.defaultProps = {
1769
1782
  caption: '',
1770
1783
  };
1771
1784
 
1772
- /* eslint-disable @typescript-eslint/no-explicit-any */
1773
1785
  var sizeUnion$1 = ['md', 'sm'];
1774
1786
  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;
1787
+ 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
1788
  var _e = React.useState(false), isOpen = _e[0], setIsOpen = _e[1];
1777
1789
  var validatedSize = validUnion(size, sizeUnion$1);
1778
1790
  var _f = sizeConfig$6[validatedSize], searchSize = _f.searchSize, iconSize = _f.iconSize;
@@ -1788,21 +1800,21 @@ function SelectInput(_a) {
1788
1800
  document.removeEventListener('mousedown', handleOutsideClick);
1789
1801
  };
1790
1802
  });
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" },
1803
+ return (React.createElement("div", { className: "field-group flex w-full flex-col", ref: inputRef },
1804
+ React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold" },
1793
1805
  childrenElement(label),
1794
1806
  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) {
1807
+ React.createElement("div", { className: "group relative w-full" },
1808
+ 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)),
1809
+ 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: "" }))),
1810
+ 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
1811
  var isSelected = selected && selected.id && option.id === selected.id;
1800
1812
  return (React.createElement(DefaultDropdownItem, { label: option.label, caption: option.caption, size: validatedSize, isSelected: isSelected, onClick: function () {
1801
1813
  setSelected(option);
1802
1814
  setIsOpen(false);
1803
1815
  } }));
1804
1816
  })))),
1805
- React.createElement("span", { className: "desc text-primary-cool text-xs mt-2" }, descText)));
1817
+ React.createElement("span", { className: "desc mt-2 text-xs text-primary-cool" }, descText)));
1806
1818
  }
1807
1819
  SelectInput.defaultProps = {
1808
1820
  descText: '',
@@ -1849,7 +1861,7 @@ function SelectInputSimulation(_a) {
1849
1861
  caption: 'AC Milan',
1850
1862
  },
1851
1863
  ];
1852
- return (React.createElement(SelectInput, { label: "Input Select", descText: "Deskripsi Input Select", options: optionData, selected: selected, setSelected: setSelected, size: size, id: "demo-id" }));
1864
+ 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
1865
  }
1854
1866
 
1855
1867
  var sizeConfig$4 = {
@@ -2501,7 +2513,7 @@ var iconOnlySizeConfig = {
2501
2513
  sm: 'p-[4px]',
2502
2514
  tn: 'p-[2px]',
2503
2515
  };
2504
- var closeConfig = {
2516
+ var closeColorConfig = {
2505
2517
  default: 'bg-bia-grey-dark-30 text-primary-white',
2506
2518
  blue: 'bg-bia-white-transparent-50 text-bia-blue',
2507
2519
  teal: 'bg-bia-white-transparent-50 text-bia-teal',
@@ -2511,6 +2523,11 @@ var closeConfig = {
2511
2523
  black: 'bg-bia-white-transparent-50 text-primary-black',
2512
2524
  white: 'bg-bia-grey-dark-30 text-primary-white',
2513
2525
  };
2526
+ var closeSizeConfig = {
2527
+ md: 'w-[18px] h-[18px] text-[14px]',
2528
+ sm: 'w-[12px] h-[12px] text-[9.33px]',
2529
+ tn: 'w-[12px] h-[12px] text-[9.33px]',
2530
+ };
2514
2531
  var rightPaddingConfig = {
2515
2532
  md: 'pr-[8px]',
2516
2533
  sm: 'pr-[5px]',
@@ -2565,24 +2582,27 @@ var TagLabel = function (_a) {
2565
2582
  var maxWidthStyle = !isBlock ? maxWidth + 'px' : '';
2566
2583
  var textClass = isBlock ? 'text-center' : 'text-left';
2567
2584
  var containerClass = "".concat(sizeClass, " ").concat(colorClass, " ").concat(roundedClass, " ").concat(isCloseableClass, " ").concat(blockclass);
2568
- var closeClass = validatedColor === 'custom'
2585
+ var closeColor = validatedColor === 'custom'
2569
2586
  ? isDark
2570
2587
  ? "bg-bia-white-transparent-50 text-bia-".concat(bgColor)
2571
2588
  : "bg-bia-grey-dark-30 text-bia-".concat(bgColor)
2572
- : closeConfig[validatedColor];
2589
+ : closeColorConfig[validatedColor];
2590
+ var closeClass = "".concat(closeColor, " ").concat(closeSizeConfig[validatedSize]);
2573
2591
  return (open && (React.createElement("div", __assign({ className: "tag-label flex items-center gap-x-[5px] text-size-base ".concat(containerClass), style: {
2574
2592
  maxWidth: maxWidthStyle,
2575
2593
  } }, props),
2576
- React.createElement("div", { style: {
2594
+ leftIcon && (React.createElement("div", { style: {
2577
2595
  width: sizeCount + 'px',
2578
2596
  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]" }))))));
2597
+ }, className: "flex items-center justify-center", ref: containerRef }, leftIcon ||
2598
+ (validatedVariant === 'icon' && (React.createElement(TbCheck, { className: defaultIconSize }))))),
2599
+ validatedVariant !== 'icon' && text && (React.createElement("span", { className: "w-full truncate pb-[2px] ".concat(textClass) }, text)),
2600
+ validatedVariant === 'label' && rightIcon && (React.createElement("div", { className: "block" },
2601
+ " ",
2602
+ rightIcon,
2603
+ " ")),
2604
+ validatedVariant === 'closeable' && (React.createElement("button", { type: "button", onClick: closeHandler, className: "flex aspect-square items-center justify-center rounded-full pt-[1px] ".concat(closeClass) },
2605
+ React.createElement(TbX, null))))));
2586
2606
  };
2587
2607
  TagLabel.defaultProps = {
2588
2608
  variant: 'default',