bianic-ui 1.11.0 → 1.12.1
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 +64 -8
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Icons/Neutral.d.ts +4 -0
- package/dist/cjs/types/components/Icons/index.d.ts +1 -0
- package/dist/cjs/types/components/ResizeableDiv/Simulation.d.ts +1 -0
- package/dist/cjs/types/components/ResizeableDiv/SimulationZIndex.d.ts +15 -0
- package/dist/cjs/types/components/ResizeableDiv/index.d.ts +4 -1
- package/dist/cjs/types/stories/Icons/Neutral.stories.d.ts +14 -0
- package/dist/cjs/types/stories/Resizeable/ResizeableSimulation.stories.d.ts +0 -1
- package/dist/cjs/types/stories/Resizeable/ResizeableZIndexSimulation.stories.d.ts +12 -0
- package/dist/esm/index.js +64 -9
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Icons/Neutral.d.ts +4 -0
- package/dist/esm/types/components/Icons/index.d.ts +1 -0
- package/dist/esm/types/components/ResizeableDiv/Simulation.d.ts +1 -0
- package/dist/esm/types/components/ResizeableDiv/SimulationZIndex.d.ts +15 -0
- package/dist/esm/types/components/ResizeableDiv/index.d.ts +4 -1
- package/dist/esm/types/stories/Icons/Neutral.stories.d.ts +14 -0
- package/dist/esm/types/stories/Resizeable/ResizeableSimulation.stories.d.ts +0 -1
- package/dist/esm/types/stories/Resizeable/ResizeableZIndexSimulation.stories.d.ts +12 -0
- package/dist/index.d.ts +7 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2200,9 +2200,11 @@ var sizeUnion$2 = ['md', 'sm'];
|
|
|
2200
2200
|
function SelectInput(_a) {
|
|
2201
2201
|
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, _d = _a.options, options = _d === void 0 ? [] : _d, _e = _a.required, required = _e === void 0 ? false : _e, selected = _a.selected, setSelected = _a.setSelected, _f = _a.onClickDropdown, onClickDropdown = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.dropContProps, _h = _g === void 0 ? {} : _g, _j = _h.className, dropContClassName = _j === void 0 ? '' : _j, restDropContProps = __rest(_h, ["className"]), props = __rest(_a, ["descText", "disabled", "size", "id", "label", "options", "required", "selected", "setSelected", "onClickDropdown", "children", "dropContProps"]);
|
|
2202
2202
|
var _k = React.useState(false), isOpen = _k[0], setIsOpen = _k[1];
|
|
2203
|
+
var _l = React.useState(false), isDropUp = _l[0], setIsDropUp = _l[1];
|
|
2203
2204
|
var validatedSize = validUnion(size, sizeUnion$2);
|
|
2204
|
-
var
|
|
2205
|
+
var _m = sizeConfig$7[validatedSize], searchSize = _m.searchSize, iconSize = _m.iconSize;
|
|
2205
2206
|
var inputRef = React.useRef(null);
|
|
2207
|
+
var dropdownContRef = React.useRef(null);
|
|
2206
2208
|
var handleOutsideClick = function (e) {
|
|
2207
2209
|
if (inputRef.current && !inputRef.current.contains(e.target)) {
|
|
2208
2210
|
setIsOpen(false);
|
|
@@ -2214,6 +2216,22 @@ function SelectInput(_a) {
|
|
|
2214
2216
|
document.removeEventListener('mousedown', handleOutsideClick);
|
|
2215
2217
|
};
|
|
2216
2218
|
});
|
|
2219
|
+
React.useEffect(function () {
|
|
2220
|
+
var _a, _b;
|
|
2221
|
+
if (inputRef.current) {
|
|
2222
|
+
// Adjust dropdown position to prevent show up out of screen
|
|
2223
|
+
var windowHeight = window.innerHeight;
|
|
2224
|
+
var inputRect = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
2225
|
+
var inputBottom = inputRect === null || inputRect === void 0 ? void 0 : inputRect.bottom;
|
|
2226
|
+
var diff = windowHeight - inputBottom;
|
|
2227
|
+
var dropdownRect = (_b = dropdownContRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
2228
|
+
var dropdownHeight = (dropdownRect === null || dropdownRect === void 0 ? void 0 : dropdownRect.height) || 0;
|
|
2229
|
+
if (dropdownHeight >= diff)
|
|
2230
|
+
setIsDropUp(true);
|
|
2231
|
+
else
|
|
2232
|
+
setIsDropUp(false);
|
|
2233
|
+
}
|
|
2234
|
+
}, [isOpen]);
|
|
2217
2235
|
var isObjectOptionItem = false;
|
|
2218
2236
|
if (options.every(function (item) { return typeof item === 'object' && item !== null; }))
|
|
2219
2237
|
isObjectOptionItem = true;
|
|
@@ -2233,6 +2251,7 @@ function SelectInput(_a) {
|
|
|
2233
2251
|
optionsElement.style.maxHeight = "".concat(Math.max(0, maxHeight), "px");
|
|
2234
2252
|
}
|
|
2235
2253
|
}, [isOpen]);
|
|
2254
|
+
var dropdownPosition = isDropUp ? 'bottom-full' : 'top-full';
|
|
2236
2255
|
return (React.createElement("div", { className: "field-group flex w-full flex-col", ref: inputRef },
|
|
2237
2256
|
React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold" },
|
|
2238
2257
|
childrenElement(label),
|
|
@@ -2240,7 +2259,7 @@ function SelectInput(_a) {
|
|
|
2240
2259
|
React.createElement("div", { className: "group relative w-full" },
|
|
2241
2260
|
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: selectedLabel, readOnly: true, id: id, disabled: disabled }, props)),
|
|
2242
2261
|
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, null) : React.createElement(TbChevronDown, null)),
|
|
2243
|
-
children === undefined && isOpen && (React.createElement("div", { className: "absolute z-10 w-full
|
|
2262
|
+
children === undefined && isOpen && (React.createElement("div", { className: "absolute z-10 w-full rounded-b-md border border-bia-grey-dark-10 bg-primary-white shadow-lg ".concat(dropdownPosition), ref: optionsRef, onClick: onClickDropdown }, options.map(function (option) {
|
|
2244
2263
|
var isSelected = JSON.stringify(option) === JSON.stringify(selected);
|
|
2245
2264
|
var optionLabel = isObjectOptionItem ? option.label : option;
|
|
2246
2265
|
var optionCaption = isObjectOptionItem ? option.caption : '';
|
|
@@ -2252,7 +2271,7 @@ function SelectInput(_a) {
|
|
|
2252
2271
|
setIsOpen(false);
|
|
2253
2272
|
} }));
|
|
2254
2273
|
}))),
|
|
2255
|
-
children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, className: "bianic-livesearch-dropdown absolute z-10 mt-1 w-full overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(dropContClassName) }, restDropContProps), React.Children.map(children, function (child) {
|
|
2274
|
+
children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, ref: dropdownContRef, className: "bianic-livesearch-dropdown absolute z-10 mt-1 w-full overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(dropdownPosition, " ").concat(dropContClassName) }, restDropContProps), React.Children.map(children, function (child) {
|
|
2256
2275
|
if (React.isValidElement(child)) {
|
|
2257
2276
|
return React.cloneElement(child, {
|
|
2258
2277
|
isSelected: selected && selected.id === child.props.value.id,
|
|
@@ -2300,6 +2319,8 @@ function LiveSearch(_a) {
|
|
|
2300
2319
|
var dropContClassName = dropContProps.className, restDropContProps = __rest(dropContProps, ["className"]);
|
|
2301
2320
|
var isValueExist = value && value.label !== undefined && value.label !== '';
|
|
2302
2321
|
var inputRef = React.useRef(null);
|
|
2322
|
+
var dropdownContRef = React.useRef(null);
|
|
2323
|
+
var _p = React.useState(false), isDropUp = _p[0], setIsDropUp = _p[1];
|
|
2303
2324
|
var handleOutsideClick = function (e) {
|
|
2304
2325
|
if (inputRef.current && !inputRef.current.contains(e.target)) {
|
|
2305
2326
|
setIsOpen(false);
|
|
@@ -2319,6 +2340,22 @@ function LiveSearch(_a) {
|
|
|
2319
2340
|
setSearchTerm(value.label || '');
|
|
2320
2341
|
}
|
|
2321
2342
|
}, [value.label, searchTerm]);
|
|
2343
|
+
React.useEffect(function () {
|
|
2344
|
+
var _a, _b;
|
|
2345
|
+
if (inputRef.current) {
|
|
2346
|
+
// Adjust dropdown position to prevent show up out of screen
|
|
2347
|
+
var windowHeight = window.innerHeight;
|
|
2348
|
+
var inputRect = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
2349
|
+
var inputBottom = inputRect === null || inputRect === void 0 ? void 0 : inputRect.bottom;
|
|
2350
|
+
var diff = windowHeight - inputBottom;
|
|
2351
|
+
var dropdownRect = (_b = dropdownContRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
2352
|
+
var dropdownHeight = (dropdownRect === null || dropdownRect === void 0 ? void 0 : dropdownRect.height) || 0;
|
|
2353
|
+
if (dropdownHeight >= diff)
|
|
2354
|
+
setIsDropUp(true);
|
|
2355
|
+
else
|
|
2356
|
+
setIsDropUp(false);
|
|
2357
|
+
}
|
|
2358
|
+
}, [isOpen]);
|
|
2322
2359
|
var filteredOptions = options.filter(function (item) {
|
|
2323
2360
|
return item.label.toLowerCase().includes(value.label.toLowerCase());
|
|
2324
2361
|
});
|
|
@@ -2384,6 +2421,7 @@ function LiveSearch(_a) {
|
|
|
2384
2421
|
hasFilteredResults =
|
|
2385
2422
|
React.Children.toArray(renderedChildren).filter(Boolean).length > 0; // Should always be true if there are initial children
|
|
2386
2423
|
}
|
|
2424
|
+
var dropdownPosition = isDropUp ? 'bottom-full' : 'top-full';
|
|
2387
2425
|
return (React.createElement("div", { className: "bianic-livesearch field-group flex w-full flex-col gap-y-2", ref: inputRef },
|
|
2388
2426
|
React.createElement("label", { htmlFor: id, className: "bianic-livesearch-label text-xs font-semibold read-only:pointer-events-none" },
|
|
2389
2427
|
label,
|
|
@@ -2408,7 +2446,7 @@ function LiveSearch(_a) {
|
|
|
2408
2446
|
setIsOpen(false);
|
|
2409
2447
|
} }));
|
|
2410
2448
|
}))),
|
|
2411
|
-
children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, zIndex: 10, className: "bianic-livesearch-dropdown absolute w-full overflow-hidden bg-white shadow-lg ".concat(dropContClassName) }, restDropContProps), hasFilteredResults
|
|
2449
|
+
children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, zIndex: 10, className: "bianic-livesearch-dropdown absolute w-full overflow-hidden bg-white shadow-lg ".concat(dropdownPosition, " ").concat(dropContClassName), ref: dropdownContRef }, restDropContProps), hasFilteredResults
|
|
2412
2450
|
? renderedChildren
|
|
2413
2451
|
: // If no results and searchTerm is present
|
|
2414
2452
|
searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))),
|
|
@@ -3145,6 +3183,14 @@ var Inlet = function (_a) {
|
|
|
3145
3183
|
React.createElement("path", { d: "M15.586 10.657L11.636 6.707C11.4538 6.5184 11.353 6.26579 11.3553 6.0036C11.3576 5.7414 11.4628 5.49059 11.6482 5.30518C11.8336 5.11977 12.0844 5.0146 12.3466 5.01232C12.6088 5.01005 12.8614 5.11084 13.05 5.293L18.707 10.95C18.8002 11.0427 18.8741 11.1528 18.9246 11.2741C18.9751 11.3955 19.001 11.5256 19.001 11.657C19.001 11.7884 18.9751 11.9185 18.9246 12.0399C18.8741 12.1612 18.8002 12.2713 18.707 12.364L13.05 18.021C12.9578 18.1165 12.8474 18.1927 12.7254 18.2451C12.6034 18.2975 12.4722 18.3251 12.3394 18.3263C12.2066 18.3274 12.0749 18.3021 11.952 18.2518C11.8292 18.2015 11.7175 18.1273 11.6236 18.0334C11.5297 17.9395 11.4555 17.8279 11.4052 17.705C11.3549 17.5821 11.3296 17.4504 11.3308 17.3176C11.3319 17.1848 11.3595 17.0536 11.4119 16.9316C11.4643 16.8096 11.5405 16.6992 11.636 16.607L15.586 12.657H6C5.73478 12.657 5.48043 12.5516 5.29289 12.3641C5.10536 12.1766 5 11.9222 5 11.657C5 11.3918 5.10536 11.1374 5.29289 10.9499C5.48043 10.7624 5.73478 10.657 6 10.657H15.586Z", fill: "inherit" })));
|
|
3146
3184
|
};
|
|
3147
3185
|
|
|
3186
|
+
var Neutral = function (_a) {
|
|
3187
|
+
var className = _a.className, _b = _a.fill, fill = _b === void 0 ? 'currentColor' : _b, _c = _a.size, size = _c === void 0 ? 20 : _c;
|
|
3188
|
+
var numericSize = Number(size);
|
|
3189
|
+
return (React.createElement("svg", { className: className, width: numericSize * 2, height: numericSize, viewBox: "0 0 48 24", fill: fill, xmlns: "http://www.w3.org/2000/svg" },
|
|
3190
|
+
React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M28 12C28 11.4477 28.4477 11 29 11H43C43.5523 11 44 11.4477 44 12C44 12.5523 43.5523 13 43 13H29C28.4477 13 28 12.5523 28 12Z", fill: "#2F2F2F" }),
|
|
3191
|
+
React.createElement("path", { d: "M12 20C14.1217 20 16.1566 19.1571 17.6569 17.6569C19.1571 16.1566 20 14.1217 20 12C20 9.87827 19.1571 7.84344 17.6569 6.34315C16.1566 4.84285 14.1217 4 12 4C9.87827 4 7.84344 4.84285 6.34315 6.34315C4.84285 7.84344 4 9.87827 4 12C4 14.1217 4.84285 16.1566 6.34315 17.6569C7.84344 19.1571 9.87827 20 12 20ZM12 22C6.477 22 2 17.523 2 12C2 6.477 6.477 2 12 2C17.523 2 22 6.477 22 12C22 17.523 17.523 22 12 22Z", fill: "#2F2F2F" })));
|
|
3192
|
+
};
|
|
3193
|
+
|
|
3148
3194
|
function Modal(_a) {
|
|
3149
3195
|
var _b = _a.size, size = _b === void 0 ? 'sm' : _b, title = _a.title, open = _a.open, _c = _a.zIndex, zIndex = _c === void 0 ? 100 : _c, onClose = _a.onClose, onClick = _a.onClick, rest = __rest(_a, ["size", "title", "open", "zIndex", "onClose", "onClick"]);
|
|
3150
3196
|
var modalSize;
|
|
@@ -3172,7 +3218,7 @@ function Modal(_a) {
|
|
|
3172
3218
|
React.createElement("div", { className: "bianic-modal flex flex-col gap-[20px] rounded-[5px] bg-white p-[20px] ".concat(modalSize), onClick: onClick },
|
|
3173
3219
|
React.createElement("div", { className: "bianic-modal-header flex justify-between" },
|
|
3174
3220
|
React.createElement("div", { className: " text-wrap text-left font-humnst777 text-[18px] font-bold leading-[21.85px] text-primary-black" }, title),
|
|
3175
|
-
React.createElement(Button, { variant: "subtle", radius: "full-rounded", iconLeft: React.createElement(TbX,
|
|
3221
|
+
React.createElement(Button, { variant: "subtle", radius: "full-rounded", iconLeft: React.createElement(TbX, { size: 14 }), size: "tn", onClick: function () { return onClose(); } })),
|
|
3176
3222
|
React.createElement("div", { className: "bianic-modal-content flex w-full flex-col items-start gap-[20px]" }, rest.children))));
|
|
3177
3223
|
}
|
|
3178
3224
|
return null;
|
|
@@ -3431,8 +3477,8 @@ var resizerContainerClass = {
|
|
|
3431
3477
|
};
|
|
3432
3478
|
|
|
3433
3479
|
function ResizeableDiv(_a) {
|
|
3434
|
-
var _b = _a.position, position = _b === void 0 ? 'bottom' : _b, children = _a.children, className = _a.className, initialWidth = _a.initialWidth, minWidth = _a.minWidth, initialHeight = _a.initialHeight, minHeight = _a.minHeight;
|
|
3435
|
-
var container = React.useRef(null);
|
|
3480
|
+
var _b = _a.position, position = _b === void 0 ? 'bottom' : _b, children = _a.children, className = _a.className, initialWidth = _a.initialWidth, minWidth = _a.minWidth, maxWidth = _a.maxWidth, initialHeight = _a.initialHeight, minHeight = _a.minHeight, maxHeight = _a.maxHeight, ref = _a.ref, zIndex = _a.zIndex; __rest(_a, ["position", "children", "className", "initialWidth", "minWidth", "maxWidth", "initialHeight", "minHeight", "maxHeight", "ref", "zIndex"]);
|
|
3481
|
+
var container = ref || React.useRef(null);
|
|
3436
3482
|
var resizer = React.useRef(null);
|
|
3437
3483
|
var handleResize = function (e) {
|
|
3438
3484
|
var mouseY = e.clientY;
|
|
@@ -3477,19 +3523,28 @@ function ResizeableDiv(_a) {
|
|
|
3477
3523
|
var minimumWidth = typeof minWidth === 'number' && !isNaN(minWidth)
|
|
3478
3524
|
? "".concat(minWidth, "px")
|
|
3479
3525
|
: minWidth;
|
|
3526
|
+
var maximumWidth = typeof maxWidth === 'number' && !isNaN(maxWidth)
|
|
3527
|
+
? "".concat(maxWidth, "px")
|
|
3528
|
+
: maxWidth;
|
|
3480
3529
|
var containerHeight = typeof initialHeight === 'number' && !isNaN(initialHeight)
|
|
3481
3530
|
? "".concat(initialHeight, "px")
|
|
3482
3531
|
: initialHeight;
|
|
3483
3532
|
var minimumHeight = typeof minHeight === 'number' && !isNaN(minHeight)
|
|
3484
3533
|
? "".concat(minHeight, "px")
|
|
3485
3534
|
: minHeight;
|
|
3535
|
+
var maximumHeight = typeof maxHeight === 'number' && !isNaN(maxHeight)
|
|
3536
|
+
? "".concat(maxHeight, "px")
|
|
3537
|
+
: maxHeight;
|
|
3486
3538
|
return (React.createElement("div", { className: "relative overflow-visible", ref: container, style: {
|
|
3539
|
+
zIndex: zIndex,
|
|
3487
3540
|
width: containerWidth,
|
|
3488
3541
|
height: containerHeight,
|
|
3489
3542
|
minWidth: minimumWidth,
|
|
3490
3543
|
minHeight: minimumHeight,
|
|
3544
|
+
maxHeight: maximumHeight,
|
|
3545
|
+
maxWidth: maximumWidth,
|
|
3491
3546
|
} },
|
|
3492
|
-
React.createElement("div", { className: "group peer absolute
|
|
3547
|
+
React.createElement("div", { className: "group peer absolute flex items-center justify-center ".concat(resizerContainerClass[position]), ref: resizer, onMouseDown: function () {
|
|
3493
3548
|
window.addEventListener('mousemove', handleResize);
|
|
3494
3549
|
window.addEventListener('mouseup', stopResize);
|
|
3495
3550
|
}, role: "button" },
|
|
@@ -3972,6 +4027,7 @@ exports.BCFlowqount = Flowqount;
|
|
|
3972
4027
|
exports.BCInlet = Inlet;
|
|
3973
4028
|
exports.BCLegend = Legend;
|
|
3974
4029
|
exports.BCModalBalance = ModalBalance;
|
|
4030
|
+
exports.BCNeutral = Neutral;
|
|
3975
4031
|
exports.BCNode = Node;
|
|
3976
4032
|
exports.BCOutlet = Outlet;
|
|
3977
4033
|
exports.BCPort = Port;
|