@hexure/ui 1.13.2 → 1.13.3
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 +68 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ButtonMenu/ButtonMenu.d.ts +3 -1
- package/dist/esm/index.js +68 -21
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ButtonMenu/ButtonMenu.d.ts +3 -1
- package/dist/index.d.ts +3 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -299,7 +299,7 @@ Heading.defaultProps = {
|
|
|
299
299
|
type: 'primary',
|
|
300
300
|
};
|
|
301
301
|
|
|
302
|
-
const Wrapper$
|
|
302
|
+
const Wrapper$h = styled.div `
|
|
303
303
|
position: fixed;
|
|
304
304
|
top: 0;
|
|
305
305
|
right: 0;
|
|
@@ -323,7 +323,7 @@ const Buttons$1 = styled.div `
|
|
|
323
323
|
`;
|
|
324
324
|
const ActionDialog = (_a) => {
|
|
325
325
|
var { description, title, primaryButton, secondaryButton, tertiaryButton, style = {} } = _a, accessibleProps = __rest(_a, ["description", "title", "primaryButton", "secondaryButton", "tertiaryButton", "style"]);
|
|
326
|
-
return (React.createElement(Wrapper$
|
|
326
|
+
return (React.createElement(Wrapper$h, Object.assign({}, accessibleProps),
|
|
327
327
|
React.createElement(Container$4, { "$customStyle": style, open: true },
|
|
328
328
|
title ? (React.createElement(Heading, { margin: '0px 0px 20px 0px', type: 'secondary' }, title)) : null,
|
|
329
329
|
description ? React.createElement(Copy, { align: 'center' }, description) : null,
|
|
@@ -333,7 +333,7 @@ const ActionDialog = (_a) => {
|
|
|
333
333
|
primaryButton ? (React.createElement(Button, Object.assign({}, primaryButton, { format: primaryButton.format || 'primary' }))) : null)) : null)));
|
|
334
334
|
};
|
|
335
335
|
|
|
336
|
-
const Wrapper$
|
|
336
|
+
const Wrapper$g = styled.div `
|
|
337
337
|
border: 1px solid #f1f1f1;
|
|
338
338
|
border-radius: 4px;
|
|
339
339
|
border-left-width: 4px;
|
|
@@ -377,7 +377,7 @@ const Alert = (_a) => {
|
|
|
377
377
|
icon: mdiCheckboxMarkedCircleOutline,
|
|
378
378
|
},
|
|
379
379
|
};
|
|
380
|
-
return (React.createElement(Wrapper$
|
|
380
|
+
return (React.createElement(Wrapper$g, Object.assign({}, accessibleProps, { "$small": small, style: { borderLeftColor: type_mapping[type].color } }),
|
|
381
381
|
React.createElement(StyledIcon$5, { color: type_mapping[type].color, path: type_mapping[type].icon, size: small ? '20px' : '30px' }),
|
|
382
382
|
React.createElement("div", null,
|
|
383
383
|
title && !small ? (React.createElement(Heading, { bold: true, margin: '2px 0 0 0', type: 'tertiary' }, title)) : null,
|
|
@@ -456,7 +456,7 @@ const AppHeader = ({ logoUrl, buttons = [] }) => {
|
|
|
456
456
|
React.createElement(Buttons, null, buttons.map((b, i) => (React.createElement(Button, Object.assign({ key: i }, b)))))));
|
|
457
457
|
};
|
|
458
458
|
|
|
459
|
-
const Wrapper$
|
|
459
|
+
const Wrapper$f = styled.div `
|
|
460
460
|
display: inline-block;
|
|
461
461
|
border-radius: 4px;
|
|
462
462
|
padding: 4px 6px;
|
|
@@ -483,7 +483,7 @@ const Remove$1 = styled.div `
|
|
|
483
483
|
`;
|
|
484
484
|
const Tag = (_a) => {
|
|
485
485
|
var { children, color = 'PRIMARY', removable, onClick } = _a, accessibleProps = __rest(_a, ["children", "color", "removable", "onClick"]);
|
|
486
|
-
return (React.createElement(Wrapper$
|
|
486
|
+
return (React.createElement(Wrapper$f, Object.assign({ "$color": color, "$removable": removable, onClick: onClick }, accessibleProps),
|
|
487
487
|
React.createElement(Content$3, null,
|
|
488
488
|
React.createElement(Label$4, { "$color": color }, children),
|
|
489
489
|
removable ? (React.createElement(Remove$1, null,
|
|
@@ -498,7 +498,7 @@ const SidebarContainer = styled.div `
|
|
|
498
498
|
padding: 12px 0px;
|
|
499
499
|
width: ${props => (props.$isOpen ? props.$width : '60px')};
|
|
500
500
|
`;
|
|
501
|
-
const MenuWrapper = styled.div `
|
|
501
|
+
const MenuWrapper$1 = styled.div `
|
|
502
502
|
display: flex;
|
|
503
503
|
align-items: center;
|
|
504
504
|
border-left-width: 4px;
|
|
@@ -580,7 +580,7 @@ const AppMenu = ({ menu, isCollapsed, footerTag, defaultWidth = '280px' }) => {
|
|
|
580
580
|
return (React.createElement(SidebarContainer, { "$isOpen": !collapsed, "$width": defaultWidth },
|
|
581
581
|
React.createElement(SidebarMenuContainer, null, menu.map(nav_item => {
|
|
582
582
|
return (React.createElement(React.Fragment, { key: nav_item.label },
|
|
583
|
-
React.createElement(MenuWrapper, { "$active": !!nav_item.is_active, "$color": theme.PRIMARY_COLOR, onClick: nav_item.onClick },
|
|
583
|
+
React.createElement(MenuWrapper$1, { "$active": !!nav_item.is_active, "$color": theme.PRIMARY_COLOR, onClick: nav_item.onClick },
|
|
584
584
|
React.createElement(MenuIcon, { "$active": !!nav_item.is_active, path: nav_item.icon }),
|
|
585
585
|
collapsed ? null : (React.createElement(MenuLabel, { "$active": nav_item.is_active, "$color": theme.PRIMARY_COLOR }, nav_item.label))),
|
|
586
586
|
nav_item.is_active && nav_item.menu && !collapsed ? (React.createElement(SubMenu, null, nav_item.menu.map(menu_item => (React.createElement(SubMenuItem, { "$active": menu_item.is_active, "$color": theme.PRIMARY_COLOR, key: menu_item.label, onClick: menu_item.onClick }, menu_item.label))))) : null));
|
|
@@ -598,7 +598,7 @@ const AppMenu = ({ menu, isCollapsed, footerTag, defaultWidth = '280px' }) => {
|
|
|
598
598
|
}, small: true }))));
|
|
599
599
|
};
|
|
600
600
|
|
|
601
|
-
const Wrapper$
|
|
601
|
+
const Wrapper$e = styled.div `
|
|
602
602
|
border: 1px solid ${props => props.theme.PRIMARY_COLOR.Hex};
|
|
603
603
|
border-radius: 8px;
|
|
604
604
|
box-sizing: border-box;
|
|
@@ -607,7 +607,7 @@ const Wrapper$f = styled.div `
|
|
|
607
607
|
justify-content: space-between;
|
|
608
608
|
padding: 16px 20px;
|
|
609
609
|
`;
|
|
610
|
-
Wrapper$
|
|
610
|
+
Wrapper$e.defaultProps = { theme: EditableTheme };
|
|
611
611
|
const Left = styled.div `
|
|
612
612
|
box-sizing: border-box;
|
|
613
613
|
display: flex;
|
|
@@ -668,7 +668,7 @@ const ErrorMsg = styled.span `
|
|
|
668
668
|
`;
|
|
669
669
|
const BulkActionBar = (_a) => {
|
|
670
670
|
var { actions = [], errorMsg, onClear, selectedCount = 0 } = _a, accessibleProps = __rest(_a, ["actions", "errorMsg", "onClear", "selectedCount"]);
|
|
671
|
-
return (React.createElement(Wrapper$
|
|
671
|
+
return (React.createElement(Wrapper$e, Object.assign({}, accessibleProps),
|
|
672
672
|
React.createElement(Left, null,
|
|
673
673
|
React.createElement(Info$1, null,
|
|
674
674
|
React.createElement(Selected, null,
|
|
@@ -681,7 +681,7 @@ const BulkActionBar = (_a) => {
|
|
|
681
681
|
React.createElement(ErrorMsg, null, errorMsg))) : null));
|
|
682
682
|
};
|
|
683
683
|
|
|
684
|
-
const Wrapper$
|
|
684
|
+
const Wrapper$d = styled.div `
|
|
685
685
|
background: #fff;
|
|
686
686
|
border-radius: 8px;
|
|
687
687
|
box-shadow: 0px 10px 30px -15px rgba(0, 0, 0, 0.2);
|
|
@@ -722,30 +722,77 @@ const Title$1 = styled.span `
|
|
|
722
722
|
`;
|
|
723
723
|
const MoreMenu = (_a) => {
|
|
724
724
|
var { maxHeight, menuItems = [] } = _a, accessibleProps = __rest(_a, ["maxHeight", "menuItems"]);
|
|
725
|
-
return (React.createElement(Wrapper$
|
|
725
|
+
return (React.createElement(Wrapper$d, Object.assign({ "$maxHeight": maxHeight }, accessibleProps), menuItems.map((item, i) => {
|
|
726
726
|
return (React.createElement(MenuItem, { key: i, onClick: item.onClick },
|
|
727
727
|
item.icon ? (React.createElement(Icon, { color: Colors.MEDIUM_GRAY.Hex, path: item.icon, size: '20px' })) : null,
|
|
728
728
|
React.createElement(Title$1, null, item.label)));
|
|
729
729
|
})));
|
|
730
730
|
};
|
|
731
731
|
|
|
732
|
-
const
|
|
732
|
+
const MenuWrapper = styled.div `
|
|
733
733
|
position: relative;
|
|
734
734
|
display: inline-block;
|
|
735
735
|
`;
|
|
736
736
|
const StyledMoreMenu = styled(MoreMenu) `
|
|
737
737
|
position: absolute;
|
|
738
|
-
right: ${props => (props.$position === 'right' ? '0px' : 'auto')};
|
|
739
|
-
left: ${props => (props.$position === 'left' ? '0px' : 'auto')};
|
|
740
|
-
top: ${props => (props.$small ? '30px' : '40px')};
|
|
741
738
|
width: ${props => props.$menuWidth};
|
|
739
|
+
max-height: ${props => props.maxHeight};
|
|
742
740
|
z-index: 10;
|
|
741
|
+
|
|
742
|
+
${props => {
|
|
743
|
+
switch (props.$position) {
|
|
744
|
+
case 'top':
|
|
745
|
+
return `
|
|
746
|
+
bottom: 100%;
|
|
747
|
+
left: 0;
|
|
748
|
+
transform: translateY(-5px); /* Adjust this value as needed */
|
|
749
|
+
`;
|
|
750
|
+
case 'bottom':
|
|
751
|
+
return `
|
|
752
|
+
top: 100%;
|
|
753
|
+
left: 0;
|
|
754
|
+
transform: translateY(5px); /* Adjust this value as needed */
|
|
755
|
+
`;
|
|
756
|
+
case 'left':
|
|
757
|
+
return `
|
|
758
|
+
right: 100%;
|
|
759
|
+
top: 0;
|
|
760
|
+
transform: translateX(-5px); /* Adjust this value as needed */
|
|
761
|
+
`;
|
|
762
|
+
case 'right':
|
|
763
|
+
return `
|
|
764
|
+
left: 100%;
|
|
765
|
+
top: 0;
|
|
766
|
+
transform: translateX(5px); /* Adjust this value as needed */
|
|
767
|
+
`;
|
|
768
|
+
default:
|
|
769
|
+
return `
|
|
770
|
+
top: 0;
|
|
771
|
+
left: 0;
|
|
772
|
+
`;
|
|
773
|
+
}
|
|
774
|
+
}}
|
|
743
775
|
`;
|
|
744
|
-
const ButtonMenu = ({ disabled, label, maxHeight, menuItems, small, position = 'right', format = 'primary', menuWidth = '200px', }) => {
|
|
745
|
-
const [
|
|
746
|
-
|
|
776
|
+
const ButtonMenu = ({ disabled, label, maxHeight, menuItems, small, position = 'right', format = 'primary', menuWidth = '200px', enableHover = true, enableClick = false, }) => {
|
|
777
|
+
const [showMenu, toggleMenu] = useState(false);
|
|
778
|
+
const handleMouseEnter = () => {
|
|
779
|
+
if (!disabled && enableHover) {
|
|
780
|
+
toggleMenu(true);
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
const handleMouseLeave = () => {
|
|
784
|
+
if (!disabled && enableHover) {
|
|
785
|
+
toggleMenu(false);
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
const handleClick = () => {
|
|
789
|
+
if (enableClick) {
|
|
790
|
+
toggleMenu(!showMenu);
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
return (React.createElement(MenuWrapper, { onClick: handleClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
|
|
747
794
|
React.createElement(Button, { disabled: disabled, format: format, icon: mdiDotsHorizontal, small: small }, label),
|
|
748
|
-
|
|
795
|
+
showMenu && (React.createElement(StyledMoreMenu, { "$menuWidth": menuWidth, "$position": position, "$small": small, maxHeight: maxHeight, menuItems: menuItems }))));
|
|
749
796
|
};
|
|
750
797
|
|
|
751
798
|
const Wrapper$c = styled.div `
|