bianic-ui 1.10.2 → 1.12.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 +89 -34
- 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/components/Snippet/ContextualButtonsTable.d.ts +3 -0
- package/dist/cjs/types/components/Typography/Text/index.d.ts +2 -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/cjs/types/stories/Snippet/ContextualButtonsTable/Story.stories.d.ts +13 -0
- package/dist/esm/index.js +89 -35
- 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/components/Snippet/ContextualButtonsTable.d.ts +3 -0
- package/dist/esm/types/components/Typography/Text/index.d.ts +2 -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/esm/types/stories/Snippet/ContextualButtonsTable/Story.stories.d.ts +13 -0
- package/dist/index.d.ts +9 -3
- package/package.json +1 -1
- package/tailwind.config.js +1 -1
|
@@ -3,6 +3,7 @@ interface ResizeableDivSimulationProps {
|
|
|
3
3
|
resizerPosition?: 'top' | 'right' | 'bottom' | 'left';
|
|
4
4
|
minimumWidth?: number | string;
|
|
5
5
|
minimumHeight?: number | string;
|
|
6
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
6
7
|
}
|
|
7
8
|
declare function ResizeableDivSimulation({ resizerPosition, minimumHeight, minimumWidth, }: ResizeableDivSimulationProps): React.JSX.Element;
|
|
8
9
|
declare namespace ResizeableDivSimulation {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ResizeableDivZIndexSimulationProps {
|
|
3
|
+
resizerPosition?: 'top' | 'right' | 'bottom' | 'left';
|
|
4
|
+
minimumWidth?: number | string;
|
|
5
|
+
minimumHeight?: number | string;
|
|
6
|
+
zIndex?: number;
|
|
7
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
8
|
+
}
|
|
9
|
+
declare function ResizeableDivZIndexSimulation({ resizerPosition, minimumHeight, minimumWidth, zIndex, }: ResizeableDivZIndexSimulationProps): React.JSX.Element;
|
|
10
|
+
declare namespace ResizeableDivZIndexSimulation {
|
|
11
|
+
var defaultProps: {
|
|
12
|
+
resizerPosition: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export default ResizeableDivZIndexSimulation;
|
|
@@ -3,11 +3,14 @@ interface ResizeableDivProps extends ComponentPropsWithRef<'div'> {
|
|
|
3
3
|
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
4
4
|
initialWidth?: string | number;
|
|
5
5
|
minWidth?: string | number;
|
|
6
|
+
maxWidth?: string | number;
|
|
6
7
|
initialHeight?: string | number;
|
|
7
8
|
minHeight?: string | number;
|
|
9
|
+
maxHeight?: string | number;
|
|
8
10
|
children: React.ReactNode;
|
|
11
|
+
zIndex?: number;
|
|
9
12
|
}
|
|
10
|
-
declare function ResizeableDiv({ position, children, className, initialWidth, minWidth, initialHeight, minHeight, }: ResizeableDivProps): React.JSX.Element;
|
|
13
|
+
declare function ResizeableDiv({ position, children, className, initialWidth, minWidth, maxWidth, initialHeight, minHeight, maxHeight, ref, zIndex, ...props }: ResizeableDivProps): React.JSX.Element;
|
|
11
14
|
declare namespace ResizeableDiv {
|
|
12
15
|
var defaultProps: {
|
|
13
16
|
position: string;
|
|
@@ -4,10 +4,11 @@ interface TextProps extends ComponentPropsWithoutRef<'span'> {
|
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
variant: 'large-text' | 'large-text-semibold' | 'medium-text' | 'medium-text-semibold' | 'caption' | 'caption-semibold' | 'normal-text' | 'normal-text-semilight' | 'normal-text-semibold' | 'normal-text-bold' | 'small-text' | 'small-text-semibold' | 'tiny-text' | 'tiny-text-bold' | 'script' | 'link';
|
|
6
6
|
}
|
|
7
|
-
declare function Text({ extended, variant, children }: TextProps): React.JSX.Element;
|
|
7
|
+
declare function Text({ extended, variant, children, className }: TextProps): React.JSX.Element;
|
|
8
8
|
declare namespace Text {
|
|
9
9
|
var defaultProps: {
|
|
10
10
|
extended: string;
|
|
11
|
+
className: string;
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
14
|
export default Text;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ className, fill, size, }: import("../../components/Icons/interface").IconProps) => import("react").JSX.Element;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
args: {};
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
export declare const Preview: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import ResizeableDivZIndexSimulation from '../../components/ResizeableDiv/SimulationZIndex';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof ResizeableDivZIndexSimulation;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
export declare const SimulationZIndex: Story;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: () => import("react").JSX.Element;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
args: {};
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const Demo: Story;
|
package/dist/esm/index.js
CHANGED
|
@@ -307,12 +307,17 @@ var variantUnion$2 = [
|
|
|
307
307
|
'link',
|
|
308
308
|
];
|
|
309
309
|
function Text(_a) {
|
|
310
|
-
var _b = _a.extended, extended = _b === void 0 ? '' : _b, variant = _a.variant, children = _a.children;
|
|
310
|
+
var _b = _a.extended, extended = _b === void 0 ? '' : _b, variant = _a.variant, children = _a.children, _c = _a.className, className = _c === void 0 ? '' : _c;
|
|
311
311
|
var validatedVariant = validUnion(variant, variantUnion$2);
|
|
312
|
-
|
|
312
|
+
var defaultColor = extended.includes('text-bia') || (className === null || className === void 0 ? void 0 : className.includes('text-bia'))
|
|
313
|
+
? ''
|
|
314
|
+
: 'text-bia-black';
|
|
315
|
+
var extendedClasses = "".concat(className, " ").concat(extended);
|
|
316
|
+
return (React.createElement("span", { className: "bianic-text ".concat(textClasses[validatedVariant], " ").concat(defaultColor, " ").concat(extendedClasses) }, childrenElement(children)));
|
|
313
317
|
}
|
|
314
318
|
Text.defaultProps = {
|
|
315
319
|
extended: '',
|
|
320
|
+
className: '',
|
|
316
321
|
};
|
|
317
322
|
|
|
318
323
|
/******************************************************************************
|
|
@@ -438,10 +443,10 @@ var minWidthConfig$1 = {
|
|
|
438
443
|
tn: 'min-w-[64px]',
|
|
439
444
|
};
|
|
440
445
|
var iconOnlySizeConfig$1 = {
|
|
441
|
-
lg: '
|
|
442
|
-
md: '
|
|
443
|
-
sm: '
|
|
444
|
-
tn: '
|
|
446
|
+
lg: 'py-[13px] flex items-center justify-center gap-[10px]',
|
|
447
|
+
md: 'py-[11px] flex items-center justify-center gap-[5px]',
|
|
448
|
+
sm: 'py-[8px] flex items-center justify-center gap-[5px] ',
|
|
449
|
+
tn: 'py-[4px] flex items-center justify-center gap-[3px]',
|
|
445
450
|
};
|
|
446
451
|
var shadow = 'shadow-[0px_6px_18px_1px_rgba(188,199,237,0.5)] disabled:shadow-none active:shadow-none';
|
|
447
452
|
var variantConfig$2 = {
|
|
@@ -479,7 +484,7 @@ var variantUnion$1 = [
|
|
|
479
484
|
'primary-outlined',
|
|
480
485
|
'success-outlined',
|
|
481
486
|
'warning-outlined',
|
|
482
|
-
'form-group'
|
|
487
|
+
'form-group',
|
|
483
488
|
];
|
|
484
489
|
var radiusUnion = ['default', 'full-rounded'];
|
|
485
490
|
var sizeUnion$5 = ['md', 'lg', 'sm', 'tn'];
|
|
@@ -504,7 +509,7 @@ function Button(_a) {
|
|
|
504
509
|
}
|
|
505
510
|
var sizeClass = label || variant === 'form-group'
|
|
506
511
|
? " ".concat(minWidthRules, " ").concat(sizingRules)
|
|
507
|
-
: iconOnlySizeConfig$1[validatedSize];
|
|
512
|
+
: "".concat(iconOnlySizeConfig$1[validatedSize], " ").concat(variant.includes('link') ? '' : "".concat(sidePaddingConfig[validatedSize]));
|
|
508
513
|
var classString = "\n ".concat(variantConfig$2[validatedVariant], " \n ").concat(sizeClass, " \n ").concat(radiusConfig$1[validatedRadius][validatedSize], " \n ").concat(className, "\n ");
|
|
509
514
|
return (React.createElement("button", __assign({ type: "button", className: "bianic-button bianic-fgc-target flex items-center justify-center font-semibold ".concat(classString), disabled: disabled }, props),
|
|
510
515
|
childrenElement(iconLeft || left),
|
|
@@ -1586,7 +1591,7 @@ function Color() {
|
|
|
1586
1591
|
'light-30',
|
|
1587
1592
|
'light-20',
|
|
1588
1593
|
'light-10',
|
|
1589
|
-
'
|
|
1594
|
+
'',
|
|
1590
1595
|
'dark-10',
|
|
1591
1596
|
'dark-20',
|
|
1592
1597
|
'dark-30',
|
|
@@ -1597,14 +1602,8 @@ function Color() {
|
|
|
1597
1602
|
'dark-80',
|
|
1598
1603
|
'dark-90',
|
|
1599
1604
|
];
|
|
1600
|
-
var aliases = {
|
|
1601
|
-
'light-90': 'pastel',
|
|
1602
|
-
'light-50': 'disabled',
|
|
1603
|
-
'light-10': 'hover',
|
|
1604
|
-
'dark-10': 'active',
|
|
1605
|
-
};
|
|
1606
1605
|
return (React.createElement("div", { className: "color-pallete flex flex-col gap-y-10" },
|
|
1607
|
-
React.createElement("div", { className: "flex gap-x-5
|
|
1606
|
+
React.createElement("div", { className: "flex justify-center gap-x-5" },
|
|
1608
1607
|
React.createElement("div", { className: "flex w-fit flex-col items-center gap-y-3" },
|
|
1609
1608
|
React.createElement("div", { className: "text-center text-xs font-semibold" }, "Black"),
|
|
1610
1609
|
React.createElement("div", { className: "aspect-square w-10 rounded-lg", style: {
|
|
@@ -1619,13 +1618,13 @@ function Color() {
|
|
|
1619
1618
|
React.createElement("div", { className: "flex flex-col items-end justify-center space-y-3" },
|
|
1620
1619
|
React.createElement("div", { className: "h-10 min-w-10" }),
|
|
1621
1620
|
lightLevels.map(function (level) { return (React.createElement("div", { key: level, className: "flex h-10 w-fit items-center justify-end" },
|
|
1622
|
-
React.createElement("div", { className: "whitespace-nowrap text-center text-xs font-semibold" },
|
|
1621
|
+
React.createElement("div", { className: "whitespace-nowrap text-center text-xs font-semibold" }, level))); })),
|
|
1623
1622
|
colors.map(function (color, index) {
|
|
1624
1623
|
return (React.createElement("div", { className: "flex w-fit flex-col items-center gap-y-3", key: index },
|
|
1625
1624
|
React.createElement("div", { className: "h-10 w-fit" },
|
|
1626
1625
|
React.createElement("div", { className: "text-center text-xs font-semibold" }, color.tailwind)),
|
|
1627
1626
|
lightLevels.map(function (level) {
|
|
1628
|
-
var suffix = level === '
|
|
1627
|
+
var suffix = level === '' ? '' : "-".concat(level);
|
|
1629
1628
|
return (React.createElement("div", { key: level, className: "aspect-square w-10 rounded-lg", style: {
|
|
1630
1629
|
backgroundColor: "var(--".concat(color.css).concat(suffix, ")"),
|
|
1631
1630
|
} }));
|
|
@@ -1726,18 +1725,18 @@ var TreeItem = function (_a) {
|
|
|
1726
1725
|
};
|
|
1727
1726
|
|
|
1728
1727
|
var MenuContainer = forwardRef(function MenuContainer(propsComp, ref) {
|
|
1729
|
-
var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.zIndex, zIndex = _f === void 0 ?
|
|
1728
|
+
var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.zIndex, zIndex = _f === void 0 ? 100 : _f, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex"]);
|
|
1730
1729
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
1731
1730
|
return (open && (React.createElement(React.Fragment, null,
|
|
1732
|
-
isWithOverlay && (React.createElement("div", { className: "bianic-menu-overlay fixed left-0 top-0 z-0 h-screen w-screen", onClick: function () { return onClose(); } })),
|
|
1731
|
+
isWithOverlay && (React.createElement("div", { className: "bianic-menu-overlay fixed left-0 top-0 z-0 h-screen w-screen", onClick: function () { return onClose(); }, style: { zIndex: zIndex } })),
|
|
1733
1732
|
React.createElement("div", __assign({ className: "w-fit bg-bia-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] ".concat(radiusClass, " ").concat(className), ref: ref, style: {
|
|
1734
|
-
zIndex: zIndex,
|
|
1733
|
+
zIndex: zIndex + 10,
|
|
1735
1734
|
} }, restProps), Children.map(children, function (child) {
|
|
1736
1735
|
return React.isValidElement(child)
|
|
1737
1736
|
? // Kirimkan handleItemClick sebagai props onClick ke setiap MenuItem
|
|
1738
1737
|
cloneElement(child, {
|
|
1739
1738
|
onClose: function () { return onClose(); },
|
|
1740
|
-
zIndex: zIndex,
|
|
1739
|
+
zIndex: zIndex + 10,
|
|
1741
1740
|
})
|
|
1742
1741
|
: child;
|
|
1743
1742
|
})))));
|
|
@@ -1747,7 +1746,7 @@ MenuContainer.defaultProps = {
|
|
|
1747
1746
|
};
|
|
1748
1747
|
|
|
1749
1748
|
function MenuItem(_a) {
|
|
1750
|
-
var _b = _a.className, className = _b === void 0 ? '' : _b, label = _a.label, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.caption, caption = _d === void 0 ? undefined : _d, _e = _a.isChecked, isChecked = _e === void 0 ? undefined : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.zIndex, zIndex = _g === void 0 ?
|
|
1749
|
+
var _b = _a.className, className = _b === void 0 ? '' : _b, label = _a.label, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.caption, caption = _d === void 0 ? undefined : _d, _e = _a.isChecked, isChecked = _e === void 0 ? undefined : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, props = __rest(_a, ["className", "label", "onClick", "caption", "isChecked", "onClose", "children", "zIndex"]);
|
|
1751
1750
|
var _h = useState(false), isHovered = _h[0], setIsHovered = _h[1];
|
|
1752
1751
|
var _j = useState(false), isLeft = _j[0], setIsLeft = _j[1];
|
|
1753
1752
|
var isWithChecked = isChecked !== undefined;
|
|
@@ -1776,14 +1775,14 @@ function MenuItem(_a) {
|
|
|
1776
1775
|
React.createElement("div", __assign({ className: "relative flex items-center py-[5px] hover:bg-bia-blue-pastel ".concat(itemClass), role: "button", tabIndex: 0, onClick: function (e) {
|
|
1777
1776
|
onClick(e);
|
|
1778
1777
|
}, onKeyDown: function () { }, style: {
|
|
1779
|
-
zIndex: isHovered ? currentZIndex :
|
|
1778
|
+
zIndex: isHovered ? currentZIndex : currentZIndex + 15,
|
|
1780
1779
|
} }, props),
|
|
1781
1780
|
isWithChecked && (React.createElement("div", { className: "mr-[5px] aspect-square w-[14px]" }, isChecked && React.createElement(TbCheck, { className: "text-primary-black", size: 14 }))),
|
|
1782
1781
|
React.createElement("span", { className: "whitespace-nowrap font-arial text-[11px] text-bia-black" }, label),
|
|
1783
1782
|
React.createElement("div", { className: "ml-auto flex items-center" },
|
|
1784
1783
|
children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey" })),
|
|
1785
1784
|
children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] text-bia-coolgrey" }, caption)))),
|
|
1786
|
-
children && (React.createElement(MenuContainer, { open: isHovered, onClose: onClose, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex }, children))));
|
|
1785
|
+
children && (React.createElement(MenuContainer, { open: isHovered, onClose: onClose, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10 }, children))));
|
|
1787
1786
|
}
|
|
1788
1787
|
MenuItem.defaultProps = {
|
|
1789
1788
|
className: '',
|
|
@@ -2126,7 +2125,7 @@ var fontConfig = {
|
|
|
2126
2125
|
};
|
|
2127
2126
|
|
|
2128
2127
|
var DropdownContainer = forwardRef(function DropdownContainer(propsComp, ref) {
|
|
2129
|
-
var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.size, size = _f === void 0 ? 'md' : _f, _g = propsComp.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, _h = propsComp.zIndex, zIndex = _h === void 0 ?
|
|
2128
|
+
var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.size, size = _f === void 0 ? 'md' : _f, _g = propsComp.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, _h = propsComp.zIndex, zIndex = _h === void 0 ? 100 : _h, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex"]);
|
|
2130
2129
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
2131
2130
|
var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
|
|
2132
2131
|
var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
|
|
@@ -2155,7 +2154,7 @@ DropdownContainer.defaultProps = {
|
|
|
2155
2154
|
};
|
|
2156
2155
|
|
|
2157
2156
|
function DropdownItem(_a) {
|
|
2158
|
-
var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.onClickItem, onClickItem = _c === void 0 ? function () { } : _c, _d = _a.onClose, onClose = _d === void 0 ? function () { } : _d, _e = _a.size, size = _e === void 0 ? 'md' : _e, _f = _a.value, value = _f === void 0 ? '' : _f, content = _a.content, _g = _a.disabled, disabled = _g === void 0 ? false : _g, _h = _a.zIndex, zIndex = _h === void 0 ?
|
|
2157
|
+
var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.onClickItem, onClickItem = _c === void 0 ? function () { } : _c, _d = _a.onClose, onClose = _d === void 0 ? function () { } : _d, _e = _a.size, size = _e === void 0 ? 'md' : _e, _f = _a.value, value = _f === void 0 ? '' : _f, content = _a.content, _g = _a.disabled, disabled = _g === void 0 ? false : _g, _h = _a.zIndex, zIndex = _h === void 0 ? 100 : _h, props = __rest(_a, ["children", "className", "onClickItem", "onClose", "size", "value", "content", "disabled", "zIndex"]);
|
|
2159
2158
|
var _j = useState(false), isHovered = _j[0], setIsHovered = _j[1];
|
|
2160
2159
|
var _k = useState(false), isLeft = _k[0], setIsLeft = _k[1];
|
|
2161
2160
|
var fontClass = fontConfig[size] || fontConfig['md'];
|
|
@@ -2199,9 +2198,11 @@ var sizeUnion$2 = ['md', 'sm'];
|
|
|
2199
2198
|
function SelectInput(_a) {
|
|
2200
2199
|
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"]);
|
|
2201
2200
|
var _k = useState(false), isOpen = _k[0], setIsOpen = _k[1];
|
|
2201
|
+
var _l = useState(false), isDropUp = _l[0], setIsDropUp = _l[1];
|
|
2202
2202
|
var validatedSize = validUnion(size, sizeUnion$2);
|
|
2203
|
-
var
|
|
2203
|
+
var _m = sizeConfig$7[validatedSize], searchSize = _m.searchSize, iconSize = _m.iconSize;
|
|
2204
2204
|
var inputRef = useRef(null);
|
|
2205
|
+
var dropdownContRef = useRef(null);
|
|
2205
2206
|
var handleOutsideClick = function (e) {
|
|
2206
2207
|
if (inputRef.current && !inputRef.current.contains(e.target)) {
|
|
2207
2208
|
setIsOpen(false);
|
|
@@ -2213,6 +2214,22 @@ function SelectInput(_a) {
|
|
|
2213
2214
|
document.removeEventListener('mousedown', handleOutsideClick);
|
|
2214
2215
|
};
|
|
2215
2216
|
});
|
|
2217
|
+
useEffect(function () {
|
|
2218
|
+
var _a, _b;
|
|
2219
|
+
if (inputRef.current) {
|
|
2220
|
+
// Adjust dropdown position to prevent show up out of screen
|
|
2221
|
+
var windowHeight = window.innerHeight;
|
|
2222
|
+
var inputRect = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
2223
|
+
var inputBottom = inputRect === null || inputRect === void 0 ? void 0 : inputRect.bottom;
|
|
2224
|
+
var diff = windowHeight - inputBottom;
|
|
2225
|
+
var dropdownRect = (_b = dropdownContRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
2226
|
+
var dropdownHeight = (dropdownRect === null || dropdownRect === void 0 ? void 0 : dropdownRect.height) || 0;
|
|
2227
|
+
if (dropdownHeight >= diff)
|
|
2228
|
+
setIsDropUp(true);
|
|
2229
|
+
else
|
|
2230
|
+
setIsDropUp(false);
|
|
2231
|
+
}
|
|
2232
|
+
}, [isOpen]);
|
|
2216
2233
|
var isObjectOptionItem = false;
|
|
2217
2234
|
if (options.every(function (item) { return typeof item === 'object' && item !== null; }))
|
|
2218
2235
|
isObjectOptionItem = true;
|
|
@@ -2232,6 +2249,7 @@ function SelectInput(_a) {
|
|
|
2232
2249
|
optionsElement.style.maxHeight = "".concat(Math.max(0, maxHeight), "px");
|
|
2233
2250
|
}
|
|
2234
2251
|
}, [isOpen]);
|
|
2252
|
+
var dropdownPosition = isDropUp ? 'bottom-full' : 'top-full';
|
|
2235
2253
|
return (React.createElement("div", { className: "field-group flex w-full flex-col", ref: inputRef },
|
|
2236
2254
|
React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold" },
|
|
2237
2255
|
childrenElement(label),
|
|
@@ -2239,7 +2257,7 @@ function SelectInput(_a) {
|
|
|
2239
2257
|
React.createElement("div", { className: "group relative w-full" },
|
|
2240
2258
|
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)),
|
|
2241
2259
|
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)),
|
|
2242
|
-
children === undefined && isOpen && (React.createElement("div", { className: "absolute z-10 w-full
|
|
2260
|
+
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) {
|
|
2243
2261
|
var isSelected = JSON.stringify(option) === JSON.stringify(selected);
|
|
2244
2262
|
var optionLabel = isObjectOptionItem ? option.label : option;
|
|
2245
2263
|
var optionCaption = isObjectOptionItem ? option.caption : '';
|
|
@@ -2251,7 +2269,7 @@ function SelectInput(_a) {
|
|
|
2251
2269
|
setIsOpen(false);
|
|
2252
2270
|
} }));
|
|
2253
2271
|
}))),
|
|
2254
|
-
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) {
|
|
2272
|
+
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) {
|
|
2255
2273
|
if (React.isValidElement(child)) {
|
|
2256
2274
|
return React.cloneElement(child, {
|
|
2257
2275
|
isSelected: selected && selected.id === child.props.value.id,
|
|
@@ -2299,6 +2317,8 @@ function LiveSearch(_a) {
|
|
|
2299
2317
|
var dropContClassName = dropContProps.className, restDropContProps = __rest(dropContProps, ["className"]);
|
|
2300
2318
|
var isValueExist = value && value.label !== undefined && value.label !== '';
|
|
2301
2319
|
var inputRef = useRef(null);
|
|
2320
|
+
var dropdownContRef = useRef(null);
|
|
2321
|
+
var _p = useState(false), isDropUp = _p[0], setIsDropUp = _p[1];
|
|
2302
2322
|
var handleOutsideClick = function (e) {
|
|
2303
2323
|
if (inputRef.current && !inputRef.current.contains(e.target)) {
|
|
2304
2324
|
setIsOpen(false);
|
|
@@ -2318,6 +2338,22 @@ function LiveSearch(_a) {
|
|
|
2318
2338
|
setSearchTerm(value.label || '');
|
|
2319
2339
|
}
|
|
2320
2340
|
}, [value.label, searchTerm]);
|
|
2341
|
+
useEffect(function () {
|
|
2342
|
+
var _a, _b;
|
|
2343
|
+
if (inputRef.current) {
|
|
2344
|
+
// Adjust dropdown position to prevent show up out of screen
|
|
2345
|
+
var windowHeight = window.innerHeight;
|
|
2346
|
+
var inputRect = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
2347
|
+
var inputBottom = inputRect === null || inputRect === void 0 ? void 0 : inputRect.bottom;
|
|
2348
|
+
var diff = windowHeight - inputBottom;
|
|
2349
|
+
var dropdownRect = (_b = dropdownContRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
2350
|
+
var dropdownHeight = (dropdownRect === null || dropdownRect === void 0 ? void 0 : dropdownRect.height) || 0;
|
|
2351
|
+
if (dropdownHeight >= diff)
|
|
2352
|
+
setIsDropUp(true);
|
|
2353
|
+
else
|
|
2354
|
+
setIsDropUp(false);
|
|
2355
|
+
}
|
|
2356
|
+
}, [isOpen]);
|
|
2321
2357
|
var filteredOptions = options.filter(function (item) {
|
|
2322
2358
|
return item.label.toLowerCase().includes(value.label.toLowerCase());
|
|
2323
2359
|
});
|
|
@@ -2383,6 +2419,7 @@ function LiveSearch(_a) {
|
|
|
2383
2419
|
hasFilteredResults =
|
|
2384
2420
|
Children.toArray(renderedChildren).filter(Boolean).length > 0; // Should always be true if there are initial children
|
|
2385
2421
|
}
|
|
2422
|
+
var dropdownPosition = isDropUp ? 'bottom-full' : 'top-full';
|
|
2386
2423
|
return (React.createElement("div", { className: "bianic-livesearch field-group flex w-full flex-col gap-y-2", ref: inputRef },
|
|
2387
2424
|
React.createElement("label", { htmlFor: id, className: "bianic-livesearch-label text-xs font-semibold read-only:pointer-events-none" },
|
|
2388
2425
|
label,
|
|
@@ -2407,7 +2444,7 @@ function LiveSearch(_a) {
|
|
|
2407
2444
|
setIsOpen(false);
|
|
2408
2445
|
} }));
|
|
2409
2446
|
}))),
|
|
2410
|
-
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
|
|
2447
|
+
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
|
|
2411
2448
|
? renderedChildren
|
|
2412
2449
|
: // If no results and searchTerm is present
|
|
2413
2450
|
searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))),
|
|
@@ -3144,6 +3181,14 @@ var Inlet = function (_a) {
|
|
|
3144
3181
|
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" })));
|
|
3145
3182
|
};
|
|
3146
3183
|
|
|
3184
|
+
var Neutral = function (_a) {
|
|
3185
|
+
var className = _a.className, _b = _a.fill, fill = _b === void 0 ? 'currentColor' : _b, _c = _a.size, size = _c === void 0 ? 20 : _c;
|
|
3186
|
+
var numericSize = Number(size);
|
|
3187
|
+
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" },
|
|
3188
|
+
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" }),
|
|
3189
|
+
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" })));
|
|
3190
|
+
};
|
|
3191
|
+
|
|
3147
3192
|
function Modal(_a) {
|
|
3148
3193
|
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"]);
|
|
3149
3194
|
var modalSize;
|
|
@@ -3430,8 +3475,8 @@ var resizerContainerClass = {
|
|
|
3430
3475
|
};
|
|
3431
3476
|
|
|
3432
3477
|
function ResizeableDiv(_a) {
|
|
3433
|
-
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;
|
|
3434
|
-
var container = useRef(null);
|
|
3478
|
+
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"]);
|
|
3479
|
+
var container = ref || useRef(null);
|
|
3435
3480
|
var resizer = useRef(null);
|
|
3436
3481
|
var handleResize = function (e) {
|
|
3437
3482
|
var mouseY = e.clientY;
|
|
@@ -3476,19 +3521,28 @@ function ResizeableDiv(_a) {
|
|
|
3476
3521
|
var minimumWidth = typeof minWidth === 'number' && !isNaN(minWidth)
|
|
3477
3522
|
? "".concat(minWidth, "px")
|
|
3478
3523
|
: minWidth;
|
|
3524
|
+
var maximumWidth = typeof maxWidth === 'number' && !isNaN(maxWidth)
|
|
3525
|
+
? "".concat(maxWidth, "px")
|
|
3526
|
+
: maxWidth;
|
|
3479
3527
|
var containerHeight = typeof initialHeight === 'number' && !isNaN(initialHeight)
|
|
3480
3528
|
? "".concat(initialHeight, "px")
|
|
3481
3529
|
: initialHeight;
|
|
3482
3530
|
var minimumHeight = typeof minHeight === 'number' && !isNaN(minHeight)
|
|
3483
3531
|
? "".concat(minHeight, "px")
|
|
3484
3532
|
: minHeight;
|
|
3533
|
+
var maximumHeight = typeof maxHeight === 'number' && !isNaN(maxHeight)
|
|
3534
|
+
? "".concat(maxHeight, "px")
|
|
3535
|
+
: maxHeight;
|
|
3485
3536
|
return (React.createElement("div", { className: "relative overflow-visible", ref: container, style: {
|
|
3537
|
+
zIndex: zIndex,
|
|
3486
3538
|
width: containerWidth,
|
|
3487
3539
|
height: containerHeight,
|
|
3488
3540
|
minWidth: minimumWidth,
|
|
3489
3541
|
minHeight: minimumHeight,
|
|
3542
|
+
maxHeight: maximumHeight,
|
|
3543
|
+
maxWidth: maximumWidth,
|
|
3490
3544
|
} },
|
|
3491
|
-
React.createElement("div", { className: "group peer absolute
|
|
3545
|
+
React.createElement("div", { className: "group peer absolute flex items-center justify-center ".concat(resizerContainerClass[position]), ref: resizer, onMouseDown: function () {
|
|
3492
3546
|
window.addEventListener('mousemove', handleResize);
|
|
3493
3547
|
window.addEventListener('mouseup', stopResize);
|
|
3494
3548
|
}, role: "button" },
|
|
@@ -3955,4 +4009,4 @@ function Window(_a) {
|
|
|
3955
4009
|
React.createElement("div", { className: "bianic-window-content flex w-full flex-col items-start gap-[20px] px-[20px] pb-[20px] text-primary-black" }, rest.children)));
|
|
3956
4010
|
}
|
|
3957
4011
|
|
|
3958
|
-
export { Accordions, Alert, Avatar, AlertRoundedSquare as BCAlertRoundedSquare, CubeHeader as BCCubeHeader, Discrepancy as BCDiscrepancy, ExposedPort as BCExposedPort, FQAnalytical as BCFQAnalytical, FQGetaway as BCFQGetaway, FQModeler as BCFQModeler, FQOperation as BCFQOperation, FQWelldone as BCFQWelldone, Flowqount as BCFlowqount, Inlet as BCInlet, Legend as BCLegend, ModalBalance as BCModalBalance, Node as BCNode, Outlet as BCOutlet, Port as BCPort, SelectAllAdd as BCSelectAllAdd, SelectAllRemove as BCSelectAllRemove, Spinner$1 as BCSpinner, Stack as BCStack, VirtualPort as BCVirtualPort, Badge, Banner, Brand, Breadcrumb, Button, ButtonApp, Checkbox, Color, ContextualButton, DatePicker, Display, Divider, DropdownContainer, DropdownItem, FileTree, FormGroup, FormGroupButton, FormGroupLabel, Heading, Link, LiveSearch, MenuContainer, MenuItem, Modal, P, PaginationBar, Pills, Popover, ProgressBar, ProgressCircle, Radio, ResizeableDiv, SegmentButtonGroup, SegmentButtonItem, SelectInput, Slider, Spinner, Tab, TabMenu, TableCell, TagLabel, Text, TextArea, TextInput, Toaster, Toggle, Tooltip, Window };
|
|
4012
|
+
export { Accordions, Alert, Avatar, AlertRoundedSquare as BCAlertRoundedSquare, CubeHeader as BCCubeHeader, Discrepancy as BCDiscrepancy, ExposedPort as BCExposedPort, FQAnalytical as BCFQAnalytical, FQGetaway as BCFQGetaway, FQModeler as BCFQModeler, FQOperation as BCFQOperation, FQWelldone as BCFQWelldone, Flowqount as BCFlowqount, Inlet as BCInlet, Legend as BCLegend, ModalBalance as BCModalBalance, Neutral as BCNeutral, Node as BCNode, Outlet as BCOutlet, Port as BCPort, SelectAllAdd as BCSelectAllAdd, SelectAllRemove as BCSelectAllRemove, Spinner$1 as BCSpinner, Stack as BCStack, VirtualPort as BCVirtualPort, Badge, Banner, Brand, Breadcrumb, Button, ButtonApp, Checkbox, Color, ContextualButton, DatePicker, Display, Divider, DropdownContainer, DropdownItem, FileTree, FormGroup, FormGroupButton, FormGroupLabel, Heading, Link, LiveSearch, MenuContainer, MenuItem, Modal, P, PaginationBar, Pills, Popover, ProgressBar, ProgressCircle, Radio, ResizeableDiv, SegmentButtonGroup, SegmentButtonItem, SelectInput, Slider, Spinner, Tab, TabMenu, TableCell, TagLabel, Text, TextArea, TextInput, Toaster, Toggle, Tooltip, Window };
|