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
|
@@ -13,8 +13,9 @@ export interface TextAreaProps extends ComponentPropsWithoutRef<'textarea'> {
|
|
|
13
13
|
value?: string;
|
|
14
14
|
readOnly?: boolean;
|
|
15
15
|
autoComplete?: string;
|
|
16
|
+
isValid?: boolean | null;
|
|
16
17
|
}
|
|
17
|
-
declare function TextArea({ descText, disabled, id, size, label, placeholder, required, rows, maxLength, value, readOnly, autoComplete, ...props }: TextAreaProps): React.JSX.Element;
|
|
18
|
+
declare function TextArea({ descText, disabled, id, size, label, placeholder, required, rows, maxLength, value, readOnly, autoComplete, isValid, ...props }: TextAreaProps): React.JSX.Element;
|
|
18
19
|
declare namespace TextArea {
|
|
19
20
|
var defaultProps: {
|
|
20
21
|
disabled: boolean;
|
package/dist/esm/index.js
CHANGED
|
@@ -1951,9 +1951,6 @@ var getDropdownStyle = function (anchorRef, popupRef) {
|
|
|
1951
1951
|
return style;
|
|
1952
1952
|
};
|
|
1953
1953
|
var usePopupPosition = function (anchorRef, popupRef, position) {
|
|
1954
|
-
// In projects where bianic-ui is installed,
|
|
1955
|
-
// there is a delay in rendering styles,
|
|
1956
|
-
// which causes popups to lose their position and need to be re-rendered.
|
|
1957
1954
|
if (!anchorRef || !popupRef) {
|
|
1958
1955
|
return [{}, function () { }];
|
|
1959
1956
|
}
|
|
@@ -1966,18 +1963,23 @@ var usePopupPosition = function (anchorRef, popupRef, position) {
|
|
|
1966
1963
|
setPositionStyle(newStyle);
|
|
1967
1964
|
};
|
|
1968
1965
|
useLayoutEffect(function () {
|
|
1969
|
-
if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current))
|
|
1966
|
+
if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) || !(popupRef === null || popupRef === void 0 ? void 0 : popupRef.current))
|
|
1970
1967
|
return;
|
|
1971
1968
|
calcPosition();
|
|
1972
|
-
|
|
1969
|
+
var resizeObserver = new ResizeObserver(calcPosition);
|
|
1970
|
+
resizeObserver.observe(popupRef.current);
|
|
1971
|
+
window.addEventListener('scroll', calcPosition, true);
|
|
1973
1972
|
window.addEventListener('resize', calcPosition);
|
|
1974
|
-
setRepeateRender(0);
|
|
1975
1973
|
return function () {
|
|
1976
|
-
|
|
1974
|
+
resizeObserver.disconnect();
|
|
1975
|
+
window.removeEventListener('scroll', calcPosition, true);
|
|
1977
1976
|
window.removeEventListener('resize', calcPosition);
|
|
1978
1977
|
};
|
|
1979
|
-
}, [anchorRef]);
|
|
1978
|
+
}, [anchorRef, popupRef]);
|
|
1980
1979
|
useEffect(function () {
|
|
1980
|
+
// In projects where bianic-ui is installed,
|
|
1981
|
+
// there is a delay in rendering styles,
|
|
1982
|
+
// which causes popups to lose their position and need to be re-rendered.
|
|
1981
1983
|
if (repeateRender < 5 && (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)) {
|
|
1982
1984
|
calcPosition();
|
|
1983
1985
|
setRepeateRender(repeateRender + 1);
|
|
@@ -2382,17 +2384,31 @@ var sizeConfig$a = {
|
|
|
2382
2384
|
};
|
|
2383
2385
|
|
|
2384
2386
|
function TextArea(_a) {
|
|
2385
|
-
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"]);
|
|
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, _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"]);
|
|
2386
2388
|
var inputRow = rows !== null && rows !== void 0 ? rows : 4;
|
|
2387
2389
|
var inputClass = sizeConfig$a[size].inputClass;
|
|
2388
2390
|
var remainWords = maxLength ? maxLength - (value ? value.length : 0) : 0;
|
|
2391
|
+
var isExistValidation = isValid !== null;
|
|
2392
|
+
var descColor = 'text-primary-cool';
|
|
2393
|
+
if (!disabled && isExistValidation && isValid)
|
|
2394
|
+
descColor = 'text-bia-green';
|
|
2395
|
+
if (!disabled && isExistValidation && !isValid)
|
|
2396
|
+
descColor = 'text-bia-red';
|
|
2397
|
+
var bottomBorderColor = 'enabled:hover:border-b-bia-blue enabled:focus:border-b-bia-blue';
|
|
2398
|
+
if (!disabled && isExistValidation && isValid)
|
|
2399
|
+
bottomBorderColor =
|
|
2400
|
+
'enabled:hover:border-b-bia-green enabled:focus:border-b-bia-green';
|
|
2401
|
+
if (!disabled && isExistValidation && !isValid)
|
|
2402
|
+
bottomBorderColor =
|
|
2403
|
+
'enabled:hover:border-b-bia-red enabled:focus:border-b-bia-red';
|
|
2389
2404
|
var disabledClass = disabled ? 'cursor-not-allowed' : '';
|
|
2405
|
+
var extendedInputClassName = "".concat(inputClass, " ").concat(bottomBorderColor);
|
|
2390
2406
|
return (React.createElement("div", { className: "field-group group/form flex w-full flex-col gap-y-2" },
|
|
2391
2407
|
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2392
2408
|
React.createElement("div", { className: "relative h-fit w-full min-w-[250px] ".concat(disabledClass) },
|
|
2393
2409
|
React.createElement(ResizeIcon, { className: "absolute bottom-[11px] right-[5px]" }),
|
|
2394
|
-
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:
|
|
2395
|
-
React.createElement("div", { className: "desc flex justify-between gap-1 text-xs
|
|
2410
|
+
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))),
|
|
2411
|
+
React.createElement("div", { className: "desc flex justify-between gap-1 text-xs ".concat(descColor) },
|
|
2396
2412
|
descText && React.createElement("span", null, descText),
|
|
2397
2413
|
maxLength && (React.createElement("span", null,
|
|
2398
2414
|
remainWords,
|
|
@@ -3653,8 +3669,8 @@ var colorConfig$1 = {
|
|
|
3653
3669
|
};
|
|
3654
3670
|
var sizeConfig$3 = {
|
|
3655
3671
|
container: 'min-h-fit p-5 text-wrap',
|
|
3656
|
-
'form-sm': 'h-[30px] whitespace-nowrap
|
|
3657
|
-
'form-md': 'h-
|
|
3672
|
+
'form-sm': 'min-h-[30px] h-fit whitespace-nowrap p-[7px]',
|
|
3673
|
+
'form-md': 'min-h-[40px] h-fit whitespace-nowrap px-2.5 py-[9.5px]',
|
|
3658
3674
|
};
|
|
3659
3675
|
|
|
3660
3676
|
var InfoPanel = function (_a) {
|
|
@@ -3713,8 +3729,8 @@ var Notification = function (props) {
|
|
|
3713
3729
|
};
|
|
3714
3730
|
|
|
3715
3731
|
var sizeConfig$2 = {
|
|
3716
|
-
md: 'min-w-[
|
|
3717
|
-
sm: 'min-w-[
|
|
3732
|
+
md: 'min-w-[40px] h-[40px] text-[14px] font-semibold',
|
|
3733
|
+
sm: 'min-w-[30px] h-[30px] text-[12px] font-normal',
|
|
3718
3734
|
};
|
|
3719
3735
|
var positionConfig = {
|
|
3720
3736
|
start: 'justify-start',
|
|
@@ -3761,15 +3777,11 @@ function PaginationBar(_a) {
|
|
|
3761
3777
|
else
|
|
3762
3778
|
setStartIndex(0);
|
|
3763
3779
|
};
|
|
3764
|
-
var getStartIndex = function (index) {
|
|
3765
|
-
if (index + PAGE_SIZE > totalPages)
|
|
3766
|
-
return Math.max(0, totalPages - PAGE_SIZE);
|
|
3767
|
-
return index;
|
|
3768
|
-
};
|
|
3769
3780
|
useEffect(function () {
|
|
3770
|
-
var
|
|
3771
|
-
|
|
3772
|
-
|
|
3781
|
+
var start = Math.max(0, Math.min(startIndex, totalPages - PAGE_SIZE));
|
|
3782
|
+
var newPages = Array.from({ length: totalPages }, function (_, i) { return i + 1; }).slice(start, start + PAGE_SIZE);
|
|
3783
|
+
setShowedPages(newPages);
|
|
3784
|
+
}, [startIndex, totalPages]);
|
|
3773
3785
|
return (React.createElement("div", { className: "flex ".concat(positionConfig[position], " gap-[5px]") },
|
|
3774
3786
|
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 })),
|
|
3775
3787
|
React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: function () {
|