bianic-ui 2.5.1-beta.0 → 2.6.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.
- package/dist/cjs/index.js +35 -23
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Forms/TextArea/index.d.ts +2 -1
- package/dist/esm/index.js +35 -23
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Forms/TextArea/index.d.ts +2 -1
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1953,9 +1953,6 @@ var getDropdownStyle = function (anchorRef, popupRef) {
|
|
|
1953
1953
|
return style;
|
|
1954
1954
|
};
|
|
1955
1955
|
var usePopupPosition = function (anchorRef, popupRef, position) {
|
|
1956
|
-
// In projects where bianic-ui is installed,
|
|
1957
|
-
// there is a delay in rendering styles,
|
|
1958
|
-
// which causes popups to lose their position and need to be re-rendered.
|
|
1959
1956
|
if (!anchorRef || !popupRef) {
|
|
1960
1957
|
return [{}, function () { }];
|
|
1961
1958
|
}
|
|
@@ -1968,18 +1965,23 @@ var usePopupPosition = function (anchorRef, popupRef, position) {
|
|
|
1968
1965
|
setPositionStyle(newStyle);
|
|
1969
1966
|
};
|
|
1970
1967
|
React.useLayoutEffect(function () {
|
|
1971
|
-
if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current))
|
|
1968
|
+
if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) || !(popupRef === null || popupRef === void 0 ? void 0 : popupRef.current))
|
|
1972
1969
|
return;
|
|
1973
1970
|
calcPosition();
|
|
1974
|
-
|
|
1971
|
+
var resizeObserver = new ResizeObserver(calcPosition);
|
|
1972
|
+
resizeObserver.observe(popupRef.current);
|
|
1973
|
+
window.addEventListener('scroll', calcPosition, true);
|
|
1975
1974
|
window.addEventListener('resize', calcPosition);
|
|
1976
|
-
setRepeateRender(0);
|
|
1977
1975
|
return function () {
|
|
1978
|
-
|
|
1976
|
+
resizeObserver.disconnect();
|
|
1977
|
+
window.removeEventListener('scroll', calcPosition, true);
|
|
1979
1978
|
window.removeEventListener('resize', calcPosition);
|
|
1980
1979
|
};
|
|
1981
|
-
}, [anchorRef]);
|
|
1980
|
+
}, [anchorRef, popupRef]);
|
|
1982
1981
|
React.useEffect(function () {
|
|
1982
|
+
// In projects where bianic-ui is installed,
|
|
1983
|
+
// there is a delay in rendering styles,
|
|
1984
|
+
// which causes popups to lose their position and need to be re-rendered.
|
|
1983
1985
|
if (repeateRender < 5 && (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)) {
|
|
1984
1986
|
calcPosition();
|
|
1985
1987
|
setRepeateRender(repeateRender + 1);
|
|
@@ -2384,17 +2386,31 @@ var sizeConfig$a = {
|
|
|
2384
2386
|
};
|
|
2385
2387
|
|
|
2386
2388
|
function TextArea(_a) {
|
|
2387
|
-
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"]);
|
|
2389
|
+
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, _h = _a.isValid, isValid = _h === void 0 ? null : _h, props = __rest(_a, ["descText", "disabled", "id", "size", "label", "placeholder", "required", "rows", "maxLength", "value", "readOnly", "autoComplete", "isValid"]);
|
|
2388
2390
|
var inputRow = rows !== null && rows !== void 0 ? rows : 4;
|
|
2389
2391
|
var inputClass = sizeConfig$a[size].inputClass;
|
|
2390
2392
|
var remainWords = maxLength ? maxLength - (value ? value.length : 0) : 0;
|
|
2393
|
+
var isExistValidation = isValid !== null;
|
|
2394
|
+
var descColor = 'text-primary-cool';
|
|
2395
|
+
if (!disabled && isExistValidation && isValid)
|
|
2396
|
+
descColor = 'text-bia-green';
|
|
2397
|
+
if (!disabled && isExistValidation && !isValid)
|
|
2398
|
+
descColor = 'text-bia-red';
|
|
2399
|
+
var bottomBorderColor = 'enabled:hover:border-b-bia-blue enabled:focus:border-b-bia-blue';
|
|
2400
|
+
if (!disabled && isExistValidation && isValid)
|
|
2401
|
+
bottomBorderColor =
|
|
2402
|
+
'enabled:hover:border-b-bia-green enabled:focus:border-b-bia-green';
|
|
2403
|
+
if (!disabled && isExistValidation && !isValid)
|
|
2404
|
+
bottomBorderColor =
|
|
2405
|
+
'enabled:hover:border-b-bia-red enabled:focus:border-b-bia-red';
|
|
2391
2406
|
var disabledClass = disabled ? 'cursor-not-allowed' : '';
|
|
2407
|
+
var extendedInputClassName = "".concat(inputClass, " ").concat(bottomBorderColor);
|
|
2392
2408
|
return (React.createElement("div", { className: "field-group group/form flex w-full flex-col gap-y-2" },
|
|
2393
2409
|
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2394
2410
|
React.createElement("div", { className: "relative h-fit w-full min-w-[250px] ".concat(disabledClass) },
|
|
2395
2411
|
React.createElement(ResizeIcon, { className: "absolute bottom-[11px] right-[5px]" }),
|
|
2396
|
-
React.createElement("textarea", __assign({ className: "field bianic-text-area w-full rounded border border-bia-grey-dark-10 bg-primary-white p-2.5 read-only:pointer-events-none focus-visible:outline-none enabled:hover:rounded-b-none enabled:
|
|
2397
|
-
React.createElement("div", { className: "desc flex justify-between gap-1 text-xs
|
|
2412
|
+
React.createElement("textarea", __assign({ className: "field bianic-text-area w-full rounded border border-bia-grey-dark-10 bg-primary-white p-2.5 read-only:pointer-events-none focus-visible:outline-none enabled:hover:rounded-b-none enabled:focus:rounded-b-none disabled:cursor-not-allowed disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName), rows: inputRow, id: id, placeholder: placeholder, disabled: disabled, maxLength: maxLength, value: value, autoComplete: autoComplete, readOnly: readOnly }, props))),
|
|
2413
|
+
React.createElement("div", { className: "desc flex justify-between gap-1 text-xs ".concat(descColor) },
|
|
2398
2414
|
descText && React.createElement("span", null, descText),
|
|
2399
2415
|
maxLength && (React.createElement("span", null,
|
|
2400
2416
|
remainWords,
|
|
@@ -3655,8 +3671,8 @@ var colorConfig$1 = {
|
|
|
3655
3671
|
};
|
|
3656
3672
|
var sizeConfig$3 = {
|
|
3657
3673
|
container: 'min-h-fit p-5 text-wrap',
|
|
3658
|
-
'form-sm': 'h-[30px] whitespace-nowrap
|
|
3659
|
-
'form-md': 'h-
|
|
3674
|
+
'form-sm': 'min-h-[30px] h-fit whitespace-nowrap p-[7px]',
|
|
3675
|
+
'form-md': 'min-h-[40px] h-fit whitespace-nowrap px-2.5 py-[9.5px]',
|
|
3660
3676
|
};
|
|
3661
3677
|
|
|
3662
3678
|
var InfoPanel = function (_a) {
|
|
@@ -3715,8 +3731,8 @@ var Notification = function (props) {
|
|
|
3715
3731
|
};
|
|
3716
3732
|
|
|
3717
3733
|
var sizeConfig$2 = {
|
|
3718
|
-
md: 'min-w-[
|
|
3719
|
-
sm: 'min-w-[
|
|
3734
|
+
md: 'min-w-[40px] h-[40px] text-[14px] font-semibold',
|
|
3735
|
+
sm: 'min-w-[30px] h-[30px] text-[12px] font-normal',
|
|
3720
3736
|
};
|
|
3721
3737
|
var positionConfig = {
|
|
3722
3738
|
start: 'justify-start',
|
|
@@ -3763,15 +3779,11 @@ function PaginationBar(_a) {
|
|
|
3763
3779
|
else
|
|
3764
3780
|
setStartIndex(0);
|
|
3765
3781
|
};
|
|
3766
|
-
var getStartIndex = function (index) {
|
|
3767
|
-
if (index + PAGE_SIZE > totalPages)
|
|
3768
|
-
return Math.max(0, totalPages - PAGE_SIZE);
|
|
3769
|
-
return index;
|
|
3770
|
-
};
|
|
3771
3782
|
React.useEffect(function () {
|
|
3772
|
-
var
|
|
3773
|
-
|
|
3774
|
-
|
|
3783
|
+
var start = Math.max(0, Math.min(startIndex, totalPages - PAGE_SIZE));
|
|
3784
|
+
var newPages = Array.from({ length: totalPages }, function (_, i) { return i + 1; }).slice(start, start + PAGE_SIZE);
|
|
3785
|
+
setShowedPages(newPages);
|
|
3786
|
+
}, [startIndex, totalPages]);
|
|
3775
3787
|
return (React.createElement("div", { className: "flex ".concat(positionConfig[position], " gap-[5px]") },
|
|
3776
3788
|
totalPages > 5 && (React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: handlePrevRange, className: showedPages[0] === 1 ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronsLeft, { size: iconSize }), disabled: showedPages[0] === 1 })),
|
|
3777
3789
|
React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: function () {
|