bianic-ui 1.2.0-beta → 1.3.0-beta

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
@@ -1550,13 +1550,14 @@ function PasswordIcon(_a) {
1550
1550
  }
1551
1551
 
1552
1552
  function TextInput(_a) {
1553
- 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 ? false : _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 ? '' : _k, _l = _a.onChange, onChange = _l === void 0 ? function () { } : _l, props = __rest(_a, ["descText", "disabled", "icon", "id", "size", "isValid", "label", "placeholder", "readOnly", "required", "variant", "value", "onChange"]);
1554
- var _m = React.useState(false), isShow = _m[0], setIsShow = _m[1];
1555
- var _o = styleConfig[variant], fieldStyle = _o.fieldStyle, iconStyle = _o.iconStyle;
1556
- var _p = sizeConfig$a[size], iconSize = _p.iconSize, fieldSize = _p.fieldSize, iconPosition = _p.iconPosition;
1553
+ 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 ? false : _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 ? '' : _k, _l = _a.onChange, onChange = _l === void 0 ? function () { } : _l, _m = _a.maxLength, maxLength = _m === void 0 ? undefined : _m, props = __rest(_a, ["descText", "disabled", "icon", "id", "size", "isValid", "label", "placeholder", "readOnly", "required", "variant", "value", "onChange", "maxLength"]);
1554
+ var _o = React.useState(false), isShow = _o[0], setIsShow = _o[1];
1555
+ var _p = styleConfig[variant], fieldStyle = _p.fieldStyle, iconStyle = _p.iconStyle;
1556
+ var _q = sizeConfig$a[size], iconSize = _q.iconSize, fieldSize = _q.fieldSize, iconPosition = _q.iconPosition;
1557
1557
  var typeVariant = variant;
1558
1558
  if (variant === 'password')
1559
1559
  typeVariant = isShow ? 'text' : 'password';
1560
+ var remainWords = maxLength ? maxLength - (value ? value.length : 0) : 0;
1560
1561
  var isExistValidation = isValid !== null;
1561
1562
  var descColor = 'text-primary-cool';
1562
1563
  if (!disabled && isExistValidation && isValid)
@@ -1581,9 +1582,15 @@ function TextInput(_a) {
1581
1582
  label,
1582
1583
  required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
1583
1584
  React.createElement("div", { className: "relative w-full" },
1584
- React.createElement("input", __assign({ className: "field w-full rounded border border-bia-grey-dark-10 bg-primary-white 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(fieldStyle, " ").concat(fieldSize, " ").concat(bottomBorderColor), disabled: disabled, id: id, placeholder: placeholder || label, readOnly: readOnly, required: required, type: typeVariant, value: value, onChange: function (e) { return onChange(e); } }, props)),
1585
+ React.createElement("input", __assign({ className: "field w-full rounded border border-bia-grey-dark-10 bg-primary-white 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(fieldStyle, " ").concat(fieldSize, " ").concat(bottomBorderColor), disabled: disabled, id: id, placeholder: placeholder || label, readOnly: readOnly, required: required, type: typeVariant, value: value, onChange: function (e) { return onChange(e); }, maxLength: maxLength }, props)),
1585
1586
  React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconStyle, " ").concat(iconPosition) }, iconElement)),
1586
- descText && (React.createElement("span", { className: "desc text-xs ".concat(descColor) }, descText))));
1587
+ React.createElement("div", { className: "desc flex justify-between gap-1 text-xs ".concat(descColor) },
1588
+ descText && React.createElement("span", null, descText),
1589
+ maxLength && (React.createElement("span", null,
1590
+ remainWords,
1591
+ "/",
1592
+ maxLength,
1593
+ ' ')))));
1587
1594
  }
1588
1595
  TextInput.defaultProps = {
1589
1596
  descText: '',
@@ -1642,16 +1649,23 @@ var sizeConfig$8 = {
1642
1649
  };
1643
1650
 
1644
1651
  function TextArea(_a) {
1645
- 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, props = __rest(_a, ["descText", "disabled", "id", "size", "label", "placeholder", "required", "rows"]);
1652
+ 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, props = __rest(_a, ["descText", "disabled", "id", "size", "label", "placeholder", "required", "rows", "maxLength", "value"]);
1646
1653
  var inputRow = rows !== null && rows !== void 0 ? rows : 4;
1647
1654
  var inputClass = sizeConfig$8[size].inputClass;
1648
- return (React.createElement("div", { className: "field-group w-full flex flex-col" },
1649
- React.createElement("label", { htmlFor: id, className: "label text-xs pb-2 font-semibold" },
1655
+ var remainWords = maxLength ? maxLength - (value ? value.length : 0) : 0;
1656
+ return (React.createElement("div", { className: "field-group flex w-full flex-col" },
1657
+ React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold" },
1650
1658
  label,
1651
1659
  required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
1652
- React.createElement("div", { className: "min-w-[250px] w-full h-full" },
1653
- React.createElement("textarea", __assign({ className: "field bg-primary-white disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active read-only:pointe r-events-none p-2.5 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 rounded ".concat(inputClass), rows: inputRow, id: id, placeholder: placeholder, disabled: disabled }, props))),
1654
- React.createElement("span", { className: "desc text-primary-cool text-xs" }, descText)));
1660
+ React.createElement("div", { className: "h-full w-full min-w-[250px]" },
1661
+ React.createElement("textarea", __assign({ className: "field read-only:pointe r-events-none w-full rounded border border-bia-grey-dark-10 bg-primary-white p-2.5 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-grey-active ".concat(inputClass), rows: inputRow, id: id, placeholder: placeholder, disabled: disabled, maxLength: maxLength, value: value }, props))),
1662
+ React.createElement("div", { className: "desc flex justify-between gap-1 text-xs text-primary-cool" },
1663
+ descText && React.createElement("span", null, descText),
1664
+ maxLength && (React.createElement("span", null,
1665
+ remainWords,
1666
+ "/",
1667
+ maxLength,
1668
+ ' ')))));
1655
1669
  }
1656
1670
  TextArea.defaultProps = {
1657
1671
  disabled: false,
@@ -1662,6 +1676,8 @@ TextArea.defaultProps = {
1662
1676
  placeholder: 'Write here ...',
1663
1677
  required: false,
1664
1678
  rows: 4,
1679
+ maxLength: undefined,
1680
+ value: '',
1665
1681
  };
1666
1682
 
1667
1683
  var sizeConfig$7 = {
@@ -1919,16 +1935,16 @@ var roundedConfig = {
1919
1935
  tn: 'first:rounded-l-radius-tn last:rounded-r-radius-tn',
1920
1936
  };
1921
1937
  var sizeConfig$2 = {
1922
- lg: 'text-size-md leading-[23.94px] px-[13px] py-[10.5px]',
1923
- md: 'text-size-base leading-[21px] px-[11px] py-[9px]',
1924
- sm: 'text-size-sm leading-[15.96px] px-[7px] py-[5px]',
1925
- tn: 'text-size-sm leading-[15.96px] px-[4px] py-[2px]',
1938
+ lg: 'text-size-md leading-[23.94px] px-[13px] py-[10.5px] min-w-[112px]',
1939
+ md: 'text-size-base leading-[21px] px-[11px] py-[9px] min-w-[96px]',
1940
+ sm: 'text-size-sm leading-[15.96px] px-[7px] py-[5px] min-w-[72px]',
1941
+ tn: 'text-size-sm leading-[15.96px] px-[4px] py-[2px] min-w-[64px]',
1926
1942
  };
1927
1943
 
1928
1944
  function SegmentButtonItem(_a) {
1929
1945
  var _b = _a.selected, selected = _b === void 0 ? false : _b, size = _a.size, children = _a.children, disabled = _a.disabled, onClick = _a.onClick;
1930
1946
  var isSelected = selected ? 'selected' : 'notSelected';
1931
- return (React.createElement("button", { type: "button", onClick: onClick, disabled: disabled, className: "focus-visible:z-50 focus-visible:outline focus-visible:-outline-offset-1 focus-visible:outline-[3px] focus-visible:outline-bia-blue-light-50 border-[1px] border-l-0 first:border-l-[1px] border-bia-grey-dark-10 group:last:border-l-0 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-dark-10 disabled:cursor-not-allowed ".concat(isSelectedConfig[isSelected], " ").concat(roundedConfig[size], " ").concat(sizeConfig$2[size]) }, children));
1947
+ 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(isSelectedConfig[isSelected], " ").concat(roundedConfig[size], " ").concat(sizeConfig$2[size]) }, children));
1932
1948
  }
1933
1949
 
1934
1950
  function SegmentButtonGroup(_a) {
@@ -2273,7 +2289,7 @@ function Tab(_a) {
2273
2289
  React.createElement("button", __assign({ type: "button", disabled: disabled }, rest, { className: "-mb-[1px] flex items-stretch justify-between ".concat(card && cardColor, " ").concat(mode === 'horizontal' ? 'flex-col' : 'w-full flex-row', " group relative outline-none ").concat(disabledKeyTab, " ").concat(fit) }),
2274
2290
  React.createElement("div", { className: "flex items-center justify-center ".concat(size === 'sm' ? " pt-[10px] ".concat(mode === 'vertical' ? 'pb-[10px] pe-[30px]' : 'px-[30px] pb-[8px]') : "px-[30px] pt-[13px] ".concat(mode === 'vertical' ? 'pb-[13px]' : 'pb-[10px]', " ")) },
2275
2291
  React.createElement("div", { className: "flex items-center justify-center " },
2276
- React.createElement("div", { className: "flex space-x-1 text-nowrap ".concat(activeKeyTab, " ").concat(configTab[size].text) },
2292
+ React.createElement("div", { className: "flex items-center space-x-1 text-nowrap ".concat(activeKeyTab, " ").concat(configTab[size].text) },
2277
2293
  icon && React.createElement("div", { className: "mr-[5px]" }, icon),
2278
2294
  children))),
2279
2295
  React.createElement("div", { className: "flex flex-row ".concat(mode === 'vertical' ? 'w-[3px] justify-end' : 'h-[3px] w-full', " items-end") }, !card && (React.createElement("div", { className: "shadow-lg shadow-bia-blue ".concat(configTab[active ? 'true' : 'false'][mode]) }))))));