bianic-ui 1.0.0-beta.24 → 1.0.0-beta.26
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 +47 -19
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Forms/DropdownItem/Default.d.ts +3 -1
- package/dist/cjs/types/components/Tooltip/configs.d.ts +20 -0
- package/dist/cjs/types/components/Tooltip/index.d.ts +4 -1
- package/dist/cjs/types/stories/{Tooltip.stories.d.ts → Tooltip/Tooltip.stories.d.ts} +2 -1
- package/dist/esm/index.js +47 -19
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Forms/DropdownItem/Default.d.ts +3 -1
- package/dist/esm/types/components/Tooltip/configs.d.ts +20 -0
- package/dist/esm/types/components/Tooltip/index.d.ts +4 -1
- package/dist/esm/types/stories/{Tooltip.stories.d.ts → Tooltip/Tooltip.stories.d.ts} +2 -1
- package/dist/index.d.ts +4 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1545,9 +1545,9 @@ function TextInput(_a) {
|
|
|
1545
1545
|
descColor = 'text-bia-red';
|
|
1546
1546
|
var bottomBorderColor = 'hover:border-b-bia-blue focus:border-b-bia-blue';
|
|
1547
1547
|
if (!disabled && isExistValidation && isValid)
|
|
1548
|
-
bottomBorderColor = '
|
|
1548
|
+
bottomBorderColor = 'border-b-bia-green';
|
|
1549
1549
|
if (!disabled && isExistValidation && !isValid)
|
|
1550
|
-
bottomBorderColor = '
|
|
1550
|
+
bottomBorderColor = 'border-b-bia-red';
|
|
1551
1551
|
var iconElement = null;
|
|
1552
1552
|
if (!disabled && isExistValidation)
|
|
1553
1553
|
iconElement = React.createElement(ValidationIcon, { isValid: isValid, iconSize: iconSize });
|
|
@@ -1744,7 +1744,7 @@ var sizeConfig$5 = {
|
|
|
1744
1744
|
|
|
1745
1745
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1746
1746
|
function DefaultDropdownItem(_a) {
|
|
1747
|
-
var _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.label, label = _c === void 0 ? '' : _c, _d = _a.onClick, onClick = _d === void 0 ? function () { } : _d, _e = _a.size, size = _e === void 0 ? 'md' : _e, isSelected = _a.isSelected, options = _a.options;
|
|
1747
|
+
var _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.label, label = _c === void 0 ? '' : _c, _d = _a.onClick, onClick = _d === void 0 ? function () { } : _d, _e = _a.size, size = _e === void 0 ? 'md' : _e, isSelected = _a.isSelected, options = _a.options, caption = _a.caption;
|
|
1748
1748
|
var _f = React.useState(false), isHovered = _f[0], setisHovered = _f[1];
|
|
1749
1749
|
var _g = React.useState(false), isHoveredSubMenu = _g[0], setIsHoveredSubMenu = _g[1];
|
|
1750
1750
|
var isOpenDropdown = isHovered || isHoveredSubMenu;
|
|
@@ -1753,9 +1753,11 @@ function DefaultDropdownItem(_a) {
|
|
|
1753
1753
|
var itemClass = "".concat(item, " ").concat(selectedClass, " ").concat(className);
|
|
1754
1754
|
var isExistSubDropdown = options.length !== 0;
|
|
1755
1755
|
return (React.createElement("div", { className: "w-full relative focus-visible:outline-bia-blue-light-50 ".concat(containerClass), tabIndex: 0, role: "button", onClick: function (e) { return onClick(e); }, onMouseEnter: function () { return setisHovered(true); }, onMouseLeave: function () { return setisHovered(false); }, onKeyDown: function () { } },
|
|
1756
|
-
React.createElement("div", { className: "hover:bg-bia-blue-light-90 active:bg-bia-blue-light-80 select-none ".concat(itemClass) },
|
|
1757
|
-
|
|
1758
|
-
|
|
1756
|
+
React.createElement("div", { className: "hover:bg-bia-blue-light-90 active:bg-bia-blue-light-80 select-none flex flex-col ".concat(itemClass) },
|
|
1757
|
+
React.createElement("span", null,
|
|
1758
|
+
label,
|
|
1759
|
+
isExistSubDropdown && (React.createElement(TbChevronRight, { className: "float-right text-bia-grey" }))),
|
|
1760
|
+
React.createElement(Text, { variant: "small-text", extended: "text-bia-coolgrey" }, caption)),
|
|
1759
1761
|
isOpenDropdown && options && isExistSubDropdown && (React.createElement("div", { className: "absolute z-50 top-0 right-0 translate-x-full border w-full bg-primary-white border-bia-grey-dark-10 rounded-md shadow-lg", onMouseEnter: function () { return setIsHoveredSubMenu(true); }, onMouseLeave: function () { return setIsHoveredSubMenu(false); } }, options.map(function (option) { return (React.createElement(DefaultDropdownItem, { label: option.label, size: size, options: option.options })); })))));
|
|
1760
1762
|
}
|
|
1761
1763
|
DefaultDropdownItem.defaultProps = {
|
|
@@ -1764,6 +1766,7 @@ DefaultDropdownItem.defaultProps = {
|
|
|
1764
1766
|
size: 'md',
|
|
1765
1767
|
options: [],
|
|
1766
1768
|
isSelected: false,
|
|
1769
|
+
caption: '',
|
|
1767
1770
|
};
|
|
1768
1771
|
|
|
1769
1772
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -1794,7 +1797,7 @@ function SelectInput(_a) {
|
|
|
1794
1797
|
React.createElement("div", { className: "absolute inset-y-0 pl-3 flex items-center pointer-events-none text-bia-coolgrey peer-disabled:text-bia-coolgrey-light-50 ".concat(iconSize) }, isOpen ? (React.createElement(TbChevronUp, { className: "" })) : (React.createElement(TbChevronDown, { className: "" }))),
|
|
1795
1798
|
isOpen && (React.createElement("div", { className: "absolute border w-full bg-primary-white border-bia-grey-dark-10 rounded-b-md shadow-lg z-10" }, options.map(function (option) {
|
|
1796
1799
|
var isSelected = selected && selected.id && option.id === selected.id;
|
|
1797
|
-
return (React.createElement(DefaultDropdownItem, { label: option.label, size: validatedSize, isSelected: isSelected, onClick: function () {
|
|
1800
|
+
return (React.createElement(DefaultDropdownItem, { label: option.label, caption: option.caption, size: validatedSize, isSelected: isSelected, onClick: function () {
|
|
1798
1801
|
setSelected(option);
|
|
1799
1802
|
setIsOpen(false);
|
|
1800
1803
|
} }));
|
|
@@ -1817,27 +1820,33 @@ function SelectInputSimulation(_a) {
|
|
|
1817
1820
|
var _c = React.useState({
|
|
1818
1821
|
id: 1,
|
|
1819
1822
|
label: 'Mohammed Salah',
|
|
1823
|
+
caption: 'Liverpool',
|
|
1820
1824
|
}), selected = _c[0], setSelected = _c[1];
|
|
1821
1825
|
var optionData = [
|
|
1822
1826
|
{
|
|
1823
1827
|
id: 1,
|
|
1824
1828
|
label: 'Mohammed Salah',
|
|
1829
|
+
caption: 'Liverpool',
|
|
1825
1830
|
},
|
|
1826
1831
|
{
|
|
1827
1832
|
id: 2,
|
|
1828
1833
|
label: 'Cristiono Ronaldo',
|
|
1834
|
+
caption: 'Manchester United',
|
|
1829
1835
|
},
|
|
1830
1836
|
{
|
|
1831
1837
|
id: 3,
|
|
1832
1838
|
label: 'Vinicius Junior',
|
|
1839
|
+
caption: 'Real Madrid',
|
|
1833
1840
|
},
|
|
1834
1841
|
{
|
|
1835
1842
|
id: 4,
|
|
1836
1843
|
label: 'Lionel Messi',
|
|
1844
|
+
caption: 'Paris Saint Germain',
|
|
1837
1845
|
},
|
|
1838
1846
|
{
|
|
1839
1847
|
id: 5,
|
|
1840
1848
|
label: 'Ricardo Kaka',
|
|
1849
|
+
caption: 'AC Milan',
|
|
1841
1850
|
},
|
|
1842
1851
|
];
|
|
1843
1852
|
return (React.createElement(SelectInput, { label: "Input Select", descText: "Deskripsi Input Select", options: optionData, selected: selected, setSelected: setSelected, size: size, id: "demo-id" }));
|
|
@@ -2593,31 +2602,51 @@ TagLabel.defaultProps = {
|
|
|
2593
2602
|
|
|
2594
2603
|
var classConfig = {
|
|
2595
2604
|
top: {
|
|
2596
|
-
tooltipContainer: 'bottom-[
|
|
2605
|
+
tooltipContainer: 'bottom-[calc(100%+5px)] left-1/2 -translate-x-1/2',
|
|
2597
2606
|
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
2598
2607
|
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
2599
2608
|
},
|
|
2600
2609
|
right: {
|
|
2601
|
-
tooltipContainer: 'left-[
|
|
2610
|
+
tooltipContainer: 'left-[calc(100%+5px)] top-1/2 -translate-y-1/2',
|
|
2602
2611
|
triangleContainer: '-left-[4px] bottom-0 flex items-center w-auto h-full',
|
|
2603
2612
|
triangleShape: 'border-t-[8px] border-t-transparent border-r-[5px] border-r-primary-black border-b-[8px] border-b-transparent',
|
|
2604
2613
|
},
|
|
2605
2614
|
bottom: {
|
|
2606
|
-
tooltipContainer: 'top-[
|
|
2615
|
+
tooltipContainer: 'top-[calc(100%+5px)] left-1/2 -translate-x-1/2',
|
|
2607
2616
|
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
2608
2617
|
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
2609
2618
|
},
|
|
2610
2619
|
left: {
|
|
2611
|
-
tooltipContainer: 'right-[
|
|
2620
|
+
tooltipContainer: 'right-[calc(100%+5px)] top-1/2 -translate-y-1/2',
|
|
2612
2621
|
triangleContainer: '-right-[4px] bottom-0 flex items-center w-auto h-full',
|
|
2613
2622
|
triangleShape: 'border-t-[8px] border-t-transparent border-l-[5px] border-l-primary-black border-b-[8px] border-b-transparent',
|
|
2614
2623
|
},
|
|
2624
|
+
'top-right': {
|
|
2625
|
+
tooltipContainer: 'bottom-[calc(100%+5px)] right-0',
|
|
2626
|
+
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
2627
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
2628
|
+
},
|
|
2629
|
+
'top-left': {
|
|
2630
|
+
tooltipContainer: 'bottom-[calc(100%+5px)] left-0',
|
|
2631
|
+
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
2632
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
2633
|
+
},
|
|
2634
|
+
'bottom-right': {
|
|
2635
|
+
tooltipContainer: 'top-[calc(100%+5px)] right-0',
|
|
2636
|
+
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
2637
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
2638
|
+
},
|
|
2639
|
+
'bottom-left': {
|
|
2640
|
+
tooltipContainer: 'top-[calc(100%+5px)] left-0',
|
|
2641
|
+
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
2642
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
2643
|
+
},
|
|
2615
2644
|
};
|
|
2616
2645
|
|
|
2617
2646
|
function Tooltip(props) {
|
|
2618
|
-
var children = props.children, content = props.content, delay = props.delay, _a = props.direction, direction = _a === void 0 ? 'top' : _a;
|
|
2647
|
+
var children = props.children, content = props.content, delay = props.delay, _a = props.direction, direction = _a === void 0 ? 'top' : _a, _b = props.maxWidth, maxWidth = _b === void 0 ? '300px' : _b;
|
|
2619
2648
|
var timeout;
|
|
2620
|
-
var
|
|
2649
|
+
var _c = React.useState(false), active = _c[0], setActive = _c[1];
|
|
2621
2650
|
var showTip = function () {
|
|
2622
2651
|
timeout = setTimeout(function () {
|
|
2623
2652
|
setActive(true);
|
|
@@ -2627,17 +2656,16 @@ function Tooltip(props) {
|
|
|
2627
2656
|
clearInterval(timeout);
|
|
2628
2657
|
setActive(false);
|
|
2629
2658
|
};
|
|
2630
|
-
var
|
|
2631
|
-
return (React.createElement("div", { className: "Tooltip-Wrapper relative
|
|
2659
|
+
var _d = classConfig[direction], tooltipContainer = _d.tooltipContainer; _d.triangleContainer; _d.triangleShape;
|
|
2660
|
+
return (React.createElement("div", { className: "Tooltip-Wrapper relative flex flex-col w-full h-fit", onMouseEnter: showTip, onMouseLeave: hideTip },
|
|
2632
2661
|
children,
|
|
2633
|
-
active && (React.createElement("div", { className: "Tooltip
|
|
2634
|
-
content
|
|
2635
|
-
React.createElement("div", { className: "absolute ".concat(triangleContainer) },
|
|
2636
|
-
React.createElement("div", { className: "w-0 h-0 ".concat(triangleShape) }))))));
|
|
2662
|
+
active && (React.createElement("div", { className: "Tooltip absolute px-[7px] py-[4px] text-size-sm bg-primary-black text-primary-white z-50 whitespace-nowrap rounded-[4px] ".concat(tooltipContainer), style: { maxWidth: maxWidth } },
|
|
2663
|
+
React.createElement("p", { className: " whitespace-pre-wrap break-words" }, content)))));
|
|
2637
2664
|
}
|
|
2638
2665
|
Tooltip.defaultProps = {
|
|
2639
2666
|
delay: 400,
|
|
2640
2667
|
direction: 'top',
|
|
2668
|
+
maxWidth: '300px',
|
|
2641
2669
|
};
|
|
2642
2670
|
Tooltip.defaultProps = {};
|
|
2643
2671
|
|