@hexure/ui 1.14.4 → 1.14.6
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 +250 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/CustomSelect/CustomSelect.d.ts +39 -0
- package/dist/cjs/types/components/CustomSelect/index.d.ts +2 -0
- package/dist/cjs/types/components/Select/Select.d.ts +1 -0
- package/dist/esm/index.js +250 -22
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/CustomSelect/CustomSelect.d.ts +39 -0
- package/dist/esm/types/components/CustomSelect/index.d.ts +2 -0
- package/dist/esm/types/components/Select/Select.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2691,7 +2691,7 @@ const q = ({
|
|
|
2691
2691
|
});
|
|
2692
2692
|
});
|
|
2693
2693
|
|
|
2694
|
-
const Wrapper$
|
|
2694
|
+
const Wrapper$i = styled.div(props => ({
|
|
2695
2695
|
display: 'inline-block',
|
|
2696
2696
|
position: 'relative',
|
|
2697
2697
|
height: props.$height || '16px',
|
|
@@ -2739,7 +2739,7 @@ const Tooltip = ({ children, position = 'right-top', width = '240px', trigger, d
|
|
|
2739
2739
|
const [show_content, toggleContent] = React.useState(false);
|
|
2740
2740
|
const baseId = dataItemid || `tooltip-${Math.random().toString(36).slice(2, 9)}`;
|
|
2741
2741
|
if (auto) {
|
|
2742
|
-
return (React.createElement(Wrapper$
|
|
2742
|
+
return (React.createElement(Wrapper$i, { "data-itemid": `${baseId}-wrapper` },
|
|
2743
2743
|
React.createElement("style", null, `
|
|
2744
2744
|
.custom-tooltip-arrow {
|
|
2745
2745
|
box-shadow: 1px 1px 0 0 #0193D7; /* top border for arrow (matches border) */
|
|
@@ -2756,6 +2756,7 @@ const Tooltip = ({ children, position = 'right-top', width = '240px', trigger, d
|
|
|
2756
2756
|
z-index: 9999; /* Ensure tooltip is above other elements */
|
|
2757
2757
|
position: absolute; /* Ensure z-index works */
|
|
2758
2758
|
word-break: break-word; /* Prevents overflow of long words */
|
|
2759
|
+
opacity: 1;
|
|
2759
2760
|
}
|
|
2760
2761
|
|
|
2761
2762
|
`),
|
|
@@ -2763,7 +2764,7 @@ const Tooltip = ({ children, position = 'right-top', width = '240px', trigger, d
|
|
|
2763
2764
|
React.createElement(TooltipPortal, null,
|
|
2764
2765
|
React.createElement(M, { className: 'custom-tooltip', classNameArrow: 'custom-tooltip-arrow', "data-itemid": `${baseId}-content`, id: `${baseId}-auto-tooltip-data-html`, render: () => React.createElement("p", { "data-itemid": `${baseId}-text` }, children) }))));
|
|
2765
2766
|
}
|
|
2766
|
-
return (React.createElement(Wrapper$
|
|
2767
|
+
return (React.createElement(Wrapper$i, { "$height": height, "data-itemid": `${baseId}-wrapper`, onMouseEnter: toggleContent.bind(null, true), onMouseLeave: toggleContent.bind(null, false) },
|
|
2767
2768
|
trigger || React.createElement(StyledIcon$6, { "data-itemid": `${baseId}-icon`, path: js.mdiInformationOutline }),
|
|
2768
2769
|
show_content ? (React.createElement(Content$3, { "$position": position, "$width": width, "data-itemid": `${baseId}-content` }, children && (React.createElement(Copy, { "data-itemid": `${baseId}-text`, type: 'small' }, children)))) : null));
|
|
2769
2770
|
};
|
|
@@ -2991,7 +2992,7 @@ Heading.defaultProps = {
|
|
|
2991
2992
|
type: 'primary',
|
|
2992
2993
|
};
|
|
2993
2994
|
|
|
2994
|
-
const Wrapper$
|
|
2995
|
+
const Wrapper$h = styled.div `
|
|
2995
2996
|
position: fixed;
|
|
2996
2997
|
top: 0;
|
|
2997
2998
|
right: 0;
|
|
@@ -3016,7 +3017,7 @@ const Buttons$1 = styled.div `
|
|
|
3016
3017
|
const ActionDialog = (_a) => {
|
|
3017
3018
|
var { description, title, primaryButton, secondaryButton, tertiaryButton, style = {}, dataItemid } = _a, accessibleProps = __rest(_a, ["description", "title", "primaryButton", "secondaryButton", "tertiaryButton", "style", "dataItemid"]);
|
|
3018
3019
|
const baseId = dataItemid || 'action-dialog';
|
|
3019
|
-
return (React.createElement(Wrapper$
|
|
3020
|
+
return (React.createElement(Wrapper$h, Object.assign({}, accessibleProps, { "data-itemid": `${baseId}-wrapper` }),
|
|
3020
3021
|
React.createElement(Container$5, { "$customStyle": style, "data-itemid": `${baseId}-container`, open: true },
|
|
3021
3022
|
title ? (React.createElement(Heading, { "data-itemid": `${baseId}-title`, margin: '0px 0px 20px 0px', type: 'secondary' }, title)) : null,
|
|
3022
3023
|
description ? (React.createElement(Copy, { align: 'center', "data-itemid": `${baseId}-description` }, description)) : null,
|
|
@@ -3026,7 +3027,7 @@ const ActionDialog = (_a) => {
|
|
|
3026
3027
|
primaryButton ? (React.createElement(Button, Object.assign({}, primaryButton, { "data-itemid": primaryButton.children || `${baseId}-${primaryButton.children}`, dataItemid: primaryButton.children || `${baseId}-${primaryButton.children}`, format: primaryButton.format || 'primary' }))) : null)) : null)));
|
|
3027
3028
|
};
|
|
3028
3029
|
|
|
3029
|
-
const Wrapper$
|
|
3030
|
+
const Wrapper$g = styled.div `
|
|
3030
3031
|
border: 1px solid #f1f1f1;
|
|
3031
3032
|
border-radius: 4px;
|
|
3032
3033
|
border-left-width: 4px;
|
|
@@ -3071,7 +3072,7 @@ const Alert = (_a) => {
|
|
|
3071
3072
|
icon: js.mdiCheckboxMarkedCircleOutline,
|
|
3072
3073
|
},
|
|
3073
3074
|
};
|
|
3074
|
-
return (React.createElement(Wrapper$
|
|
3075
|
+
return (React.createElement(Wrapper$g, Object.assign({}, accessibleProps, { "$small": small, "data-itemid": `${baseId}-wrapper`, style: { borderLeftColor: type_mapping[type].color } }),
|
|
3075
3076
|
React.createElement(StyledIcon$4, { color: type_mapping[type].color, "data-itemid": `${baseId}-icon`, path: type_mapping[type].icon, size: small ? '20px' : '30px' }),
|
|
3076
3077
|
React.createElement("div", { "data-itemid": `${baseId}-content` },
|
|
3077
3078
|
title && !small ? (React.createElement(Heading, { bold: true, "data-itemid": `${baseId}-title`, margin: '2px 0 0 0', type: 'tertiary' }, title)) : null,
|
|
@@ -3156,7 +3157,7 @@ const AppHeader = ({ logoUrl, buttons = [], dataItemid }) => {
|
|
|
3156
3157
|
React.createElement(Buttons, { "data-itemid": `${baseId}-buttons` }, buttons.map((b, i) => (React.createElement(Button, Object.assign({ key: i }, b, { "data-itemid": `${baseId}-button-${i}` })))))));
|
|
3157
3158
|
};
|
|
3158
3159
|
|
|
3159
|
-
const Wrapper$
|
|
3160
|
+
const Wrapper$f = styled.div `
|
|
3160
3161
|
display: inline-block;
|
|
3161
3162
|
border-radius: 4px;
|
|
3162
3163
|
padding: 4px 6px;
|
|
@@ -3193,7 +3194,7 @@ const Remove$1 = styled.div `
|
|
|
3193
3194
|
const Tag = (_a) => {
|
|
3194
3195
|
var { children, color = 'PRIMARY', removable, onClick, dataItemid, rotate, dataSectionName } = _a, accessibleProps = __rest(_a, ["children", "color", "removable", "onClick", "dataItemid", "rotate", "dataSectionName"]);
|
|
3195
3196
|
const baseId = dataItemid || 'tag';
|
|
3196
|
-
return (React.createElement(Wrapper$
|
|
3197
|
+
return (React.createElement(Wrapper$f, Object.assign({ "$color": color, "$removable": removable, "$rotate": rotate, onClick: onClick }, accessibleProps, { "data-itemid": `${baseId}-wrapper` }),
|
|
3197
3198
|
React.createElement(Content$2, { "data-itemid": `${baseId}-content`, "data-section-name": dataSectionName },
|
|
3198
3199
|
React.createElement(Label$4, { "$color": color, "data-itemid": `${baseId}-label` }, children),
|
|
3199
3200
|
removable ? (React.createElement(Remove$1, { "data-itemid": `${baseId}-remove` },
|
|
@@ -3329,7 +3330,7 @@ const AppMenu = ({ menu, isCollapsed, footerTag, defaultWidth = '280px', dataIte
|
|
|
3329
3330
|
}, small: true, type: 'button' }))));
|
|
3330
3331
|
};
|
|
3331
3332
|
|
|
3332
|
-
const Wrapper$
|
|
3333
|
+
const Wrapper$e = styled.div `
|
|
3333
3334
|
border: 1px solid ${props => props.theme.PRIMARY_COLOR.Hex};
|
|
3334
3335
|
border-radius: 8px;
|
|
3335
3336
|
box-sizing: border-box;
|
|
@@ -3338,7 +3339,7 @@ const Wrapper$d = styled.div `
|
|
|
3338
3339
|
justify-content: space-between;
|
|
3339
3340
|
padding: 16px 20px;
|
|
3340
3341
|
`;
|
|
3341
|
-
Wrapper$
|
|
3342
|
+
Wrapper$e.defaultProps = { theme: EditableTheme };
|
|
3342
3343
|
const Left = styled.div `
|
|
3343
3344
|
box-sizing: border-box;
|
|
3344
3345
|
display: flex;
|
|
@@ -3400,7 +3401,7 @@ const ErrorMsg = styled.span `
|
|
|
3400
3401
|
const BulkActionBar = (_a) => {
|
|
3401
3402
|
var { actions = [], errorMsg, onClear, selectedCount = 0, dataItemid } = _a, accessibleProps = __rest(_a, ["actions", "errorMsg", "onClear", "selectedCount", "dataItemid"]);
|
|
3402
3403
|
const baseId = dataItemid || 'bulk-action-bar';
|
|
3403
|
-
return (React.createElement(Wrapper$
|
|
3404
|
+
return (React.createElement(Wrapper$e, Object.assign({}, accessibleProps, { "data-itemid": `${baseId}-wrapper` }),
|
|
3404
3405
|
React.createElement(Left, { "data-itemid": `${baseId}-left` },
|
|
3405
3406
|
React.createElement(Info$1, { "data-itemid": `${baseId}-info` },
|
|
3406
3407
|
React.createElement(Selected, { "data-itemid": `${baseId}-selected` },
|
|
@@ -3413,7 +3414,7 @@ const BulkActionBar = (_a) => {
|
|
|
3413
3414
|
React.createElement(ErrorMsg, { "data-itemid": `${baseId}-error-msg` }, errorMsg))) : null));
|
|
3414
3415
|
};
|
|
3415
3416
|
|
|
3416
|
-
const Wrapper$
|
|
3417
|
+
const Wrapper$d = styled.div `
|
|
3417
3418
|
background: #fff;
|
|
3418
3419
|
border-radius: 8px;
|
|
3419
3420
|
box-shadow: 0px 10px 30px -15px rgba(0, 0, 0, 0.2);
|
|
@@ -3460,7 +3461,7 @@ Title$1.defaultProps = {
|
|
|
3460
3461
|
const MoreMenu = (_a) => {
|
|
3461
3462
|
var { maxHeight, menuItems = [], dataItemid } = _a, accessibleProps = __rest(_a, ["maxHeight", "menuItems", "dataItemid"]);
|
|
3462
3463
|
const baseId = dataItemid || 'more-menu';
|
|
3463
|
-
return (React.createElement(Wrapper$
|
|
3464
|
+
return (React.createElement(Wrapper$d, Object.assign({ "$maxHeight": maxHeight }, accessibleProps, { "data-itemid": `${baseId}-wrapper` }), menuItems.map((item, i) => {
|
|
3464
3465
|
var _a;
|
|
3465
3466
|
const itemId = `${baseId}`;
|
|
3466
3467
|
return (React.createElement(MenuItem, { className: item === null || item === void 0 ? void 0 : item.className, "data-itemid": `${itemId}-menu-item`, key: i, onClick: item.onClick },
|
|
@@ -3556,7 +3557,7 @@ const ButtonMenu = ({ disabled, label, maxHeight, menuItems, small, position = '
|
|
|
3556
3557
|
showMenu && (React.createElement(StyledMoreMenu, { "$left": menuPosition.left, "$menuWidth": menuWidth, "$top": menuPosition.top, dataItemid: `${baseId}-more-menu`, maxHeight: maxHeight, menuItems: menuItems }))));
|
|
3557
3558
|
};
|
|
3558
3559
|
|
|
3559
|
-
const Wrapper$
|
|
3560
|
+
const Wrapper$c = styled.label `
|
|
3560
3561
|
border-radius: 4px;
|
|
3561
3562
|
padding: 4px 0px 4px 6px;
|
|
3562
3563
|
margin-left: -6px;
|
|
@@ -3572,7 +3573,7 @@ const Wrapper$b = styled.label `
|
|
|
3572
3573
|
background: ${props => `rgba(${props.theme.PRIMARY_COLOR.Rgb}, 0.05)`};
|
|
3573
3574
|
}
|
|
3574
3575
|
`;
|
|
3575
|
-
Wrapper$
|
|
3576
|
+
Wrapper$c.defaultProps = { theme: EditableTheme };
|
|
3576
3577
|
const Input$2 = styled.input `
|
|
3577
3578
|
font-size: 20px;
|
|
3578
3579
|
margin: 0px;
|
|
@@ -3599,7 +3600,7 @@ const Input$2 = styled.input `
|
|
|
3599
3600
|
display: block;
|
|
3600
3601
|
}
|
|
3601
3602
|
`;
|
|
3602
|
-
const getBackgroundColor$
|
|
3603
|
+
const getBackgroundColor$4 = (props) => {
|
|
3603
3604
|
if (props.$isWarningError) {
|
|
3604
3605
|
return '#fcf1c9';
|
|
3605
3606
|
}
|
|
@@ -3610,7 +3611,7 @@ const getBackgroundColor$3 = (props) => {
|
|
|
3610
3611
|
return '#ffffff';
|
|
3611
3612
|
}
|
|
3612
3613
|
};
|
|
3613
|
-
const getBorderColor$
|
|
3614
|
+
const getBorderColor$4 = (props) => {
|
|
3614
3615
|
if (props.$isWarningError) {
|
|
3615
3616
|
return 'Orange';
|
|
3616
3617
|
}
|
|
@@ -3628,8 +3629,8 @@ const Check$1 = styled.span `
|
|
|
3628
3629
|
background-color: #fff;
|
|
3629
3630
|
border-width: 2px;
|
|
3630
3631
|
border-style: solid;
|
|
3631
|
-
border-color: ${props => getBorderColor$
|
|
3632
|
-
background-color: ${props => getBackgroundColor$
|
|
3632
|
+
border-color: ${props => getBorderColor$4(props)};
|
|
3633
|
+
background-color: ${props => getBackgroundColor$4(props)};
|
|
3633
3634
|
box-sizing: border-box;
|
|
3634
3635
|
position: relative;
|
|
3635
3636
|
&:after {
|
|
@@ -3660,7 +3661,7 @@ const Label$3 = styled.span `
|
|
|
3660
3661
|
const Checkbox = (_a) => {
|
|
3661
3662
|
var { children, color, disabled, checked, onChange, invalid, tooltip, tabIndex, dataItemid, isInvalidRedBackground = false, isWarningError = false, dataSectionName, isLabelBold = false } = _a, accessibleProps = __rest(_a, ["children", "color", "disabled", "checked", "onChange", "invalid", "tooltip", "tabIndex", "dataItemid", "isInvalidRedBackground", "isWarningError", "dataSectionName", "isLabelBold"]);
|
|
3662
3663
|
const baseId = dataItemid || 'checkbox';
|
|
3663
|
-
return (React.createElement(Wrapper$
|
|
3664
|
+
return (React.createElement(Wrapper$c, Object.assign({ "$disabled": disabled }, accessibleProps, { "data-itemid": `${baseId}-wrapper` }),
|
|
3664
3665
|
React.createElement(Input$2, { "$invalid": invalid, checked: checked, "data-itemid": `${baseId}-input`, "data-section-name": dataSectionName, disabled: disabled, name: accessibleProps.name, onChange: disabled ? undefined : onChange, tabIndex: disabled ? -1 : tabIndex, type: 'checkbox' }),
|
|
3665
3666
|
React.createElement(Check$1, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$isWarningError": isWarningError, "data-itemid": `${baseId}-check` }),
|
|
3666
3667
|
children ? (React.createElement(Label$3, { "$isLabelBold": isLabelBold, color: color, "data-itemid": `${baseId}-label` },
|
|
@@ -3716,6 +3717,230 @@ const Checklist = (_a) => {
|
|
|
3716
3717
|
}))));
|
|
3717
3718
|
};
|
|
3718
3719
|
|
|
3720
|
+
const getBackgroundColor$3 = (props) => {
|
|
3721
|
+
if (props.$isWarningError) {
|
|
3722
|
+
return '#fcf1c9';
|
|
3723
|
+
}
|
|
3724
|
+
else if (props.$invalid && props.$isInvalidRedBackground) {
|
|
3725
|
+
return '#ffe5e5';
|
|
3726
|
+
}
|
|
3727
|
+
else {
|
|
3728
|
+
return props.$readOnly ? '#f5f5f5' : '#ffffff';
|
|
3729
|
+
}
|
|
3730
|
+
};
|
|
3731
|
+
const getBorderColor$3 = (props) => {
|
|
3732
|
+
if (props.$isWarningError) {
|
|
3733
|
+
return 'Orange';
|
|
3734
|
+
}
|
|
3735
|
+
else if (props.$invalid) {
|
|
3736
|
+
return Colors.RED.Hex;
|
|
3737
|
+
}
|
|
3738
|
+
else {
|
|
3739
|
+
return '#cccccc';
|
|
3740
|
+
}
|
|
3741
|
+
};
|
|
3742
|
+
const Wrapper$b = styled.div `
|
|
3743
|
+
border-radius: 4px;
|
|
3744
|
+
height: 40px;
|
|
3745
|
+
background-color: ${props => (props.$readOnly ? '#f5f5f5' : '#ffffff')};
|
|
3746
|
+
position: relative;
|
|
3747
|
+
cursor: ${props => (props.$readOnly ? 'default' : 'pointer')};
|
|
3748
|
+
border-width: 1px;
|
|
3749
|
+
border-style: solid;
|
|
3750
|
+
border-color: ${props => getBorderColor$3(props)};
|
|
3751
|
+
background-color: ${props => getBackgroundColor$3(props)};
|
|
3752
|
+
border-radius: ${({ $style }) => ($style === null || $style === void 0 ? void 0 : $style.borderRadius) || '4px'};
|
|
3753
|
+
flex-grow: ${({ $style }) => ($style === null || $style === void 0 ? void 0 : $style.flexGrow) || 0};
|
|
3754
|
+
box-sizing: border-box;
|
|
3755
|
+
padding: 10px 0px;
|
|
3756
|
+
display: flex;
|
|
3757
|
+
align-items: center;
|
|
3758
|
+
width: ${({ $style }) => ($style === null || $style === void 0 ? void 0 : $style.width) || 'auto'};
|
|
3759
|
+
|
|
3760
|
+
&:focus-within {
|
|
3761
|
+
border-color: ${props => (props.$readOnly ? '#cccccc' : props.theme.PRIMARY_COLOR.Hex)};
|
|
3762
|
+
}
|
|
3763
|
+
`;
|
|
3764
|
+
Wrapper$b.defaultProps = { theme: EditableTheme };
|
|
3765
|
+
const Trigger$2 = styled.div `
|
|
3766
|
+
appearance: none;
|
|
3767
|
+
box-shadow: none;
|
|
3768
|
+
outline: none;
|
|
3769
|
+
border: none;
|
|
3770
|
+
color: ${props => (props.$searchableOpen ? 'transparent' : Colors.BLACK.Hex)};
|
|
3771
|
+
font-size: ${FontSizes.DEFAULT};
|
|
3772
|
+
font-weight: 400;
|
|
3773
|
+
font-family: ${FontStyles.DEFAULT};
|
|
3774
|
+
line-height: normal;
|
|
3775
|
+
background-color: transparent;
|
|
3776
|
+
background-image: none;
|
|
3777
|
+
width: 100%;
|
|
3778
|
+
box-sizing: border-box;
|
|
3779
|
+
padding: 0px 30px 0px 10px;
|
|
3780
|
+
box-sizing: border-box;
|
|
3781
|
+
position: relative;
|
|
3782
|
+
z-index: 2;
|
|
3783
|
+
cursor: ${props => (props.$readOnly ? 'default' : 'pointer')};
|
|
3784
|
+
user-select: none;
|
|
3785
|
+
overflow: hidden;
|
|
3786
|
+
text-overflow: ellipsis;
|
|
3787
|
+
white-space: nowrap;
|
|
3788
|
+
`;
|
|
3789
|
+
const IconWrapper$3 = styled(Icon) `
|
|
3790
|
+
position: absolute;
|
|
3791
|
+
right: 9px;
|
|
3792
|
+
z-index: 1;
|
|
3793
|
+
transition: transform 0.2s ease;
|
|
3794
|
+
transform: ${props => (props.$isOpen ? 'rotate(180deg)' : 'rotate(0deg)')};
|
|
3795
|
+
pointer-events: none;
|
|
3796
|
+
`;
|
|
3797
|
+
const SearchInput$2 = styled.input `
|
|
3798
|
+
position: absolute;
|
|
3799
|
+
left: 0;
|
|
3800
|
+
top: 0;
|
|
3801
|
+
z-index: 999;
|
|
3802
|
+
width: 100%;
|
|
3803
|
+
height: 100%;
|
|
3804
|
+
border: none;
|
|
3805
|
+
outline: none;
|
|
3806
|
+
background-color: transparent;
|
|
3807
|
+
color: ${Colors.BLACK.Hex};
|
|
3808
|
+
font-family: ${FontStyles.DEFAULT};
|
|
3809
|
+
font-size: ${FontSizes.DEFAULT};
|
|
3810
|
+
font-weight: 400;
|
|
3811
|
+
line-height: normal;
|
|
3812
|
+
padding: 0px 30px 0px 10px;
|
|
3813
|
+
box-sizing: border-box;
|
|
3814
|
+
overflow: hidden;
|
|
3815
|
+
white-space: nowrap;
|
|
3816
|
+
pointer-events: ${props => (props.$isOpen ? 'auto' : 'none')};
|
|
3817
|
+
opacity: ${props => (props.$isOpen ? 1 : 0)};
|
|
3818
|
+
|
|
3819
|
+
&::placeholder {
|
|
3820
|
+
color: #999999;
|
|
3821
|
+
opacity: 1;
|
|
3822
|
+
}
|
|
3823
|
+
`;
|
|
3824
|
+
const DropdownContainer = styled.div `
|
|
3825
|
+
position: absolute;
|
|
3826
|
+
top: 100%;
|
|
3827
|
+
left: 0;
|
|
3828
|
+
right: 0;
|
|
3829
|
+
margin-top: 4px;
|
|
3830
|
+
background: white;
|
|
3831
|
+
border: 1px solid #cccccc;
|
|
3832
|
+
border-radius: 4px;
|
|
3833
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
3834
|
+
max-height: 300px;
|
|
3835
|
+
overflow-y: auto;
|
|
3836
|
+
z-index: 1000;
|
|
3837
|
+
display: ${props => (props.$isOpen ? 'block' : 'none')};
|
|
3838
|
+
`;
|
|
3839
|
+
const OptionGroupLabel = styled.div `
|
|
3840
|
+
padding: 6px 10px;
|
|
3841
|
+
font-weight: 600;
|
|
3842
|
+
font-size: ${FontSizes.DEFAULT};
|
|
3843
|
+
font-family: ${FontStyles.DEFAULT};
|
|
3844
|
+
color: ${Colors.BLACK.Hex};
|
|
3845
|
+
`;
|
|
3846
|
+
const OptionItem = styled.span `
|
|
3847
|
+
display: block;
|
|
3848
|
+
padding: 8px 10px;
|
|
3849
|
+
padding-left: ${props => (props.$isGrouped ? '20px' : '10px')};
|
|
3850
|
+
font-size: ${FontSizes.DEFAULT};
|
|
3851
|
+
font-family: ${FontStyles.DEFAULT};
|
|
3852
|
+
color: ${props => props.$color || Colors.BLACK.Hex};
|
|
3853
|
+
cursor: ${props => (props.$disabled ? 'not-allowed' : 'pointer')};
|
|
3854
|
+
opacity: ${props => (props.$disabled ? 0.5 : 1)};
|
|
3855
|
+
background-color: ${props => (props.$isSelected ? '#e8f4fd' : 'transparent')};
|
|
3856
|
+
user-select: none;
|
|
3857
|
+
line-height: 1.3em;
|
|
3858
|
+
|
|
3859
|
+
&:hover {
|
|
3860
|
+
background-color: ${props => (props.$disabled ? 'transparent' : '#f5f5f5')};
|
|
3861
|
+
}
|
|
3862
|
+
`;
|
|
3863
|
+
const CustomSelect = (_a) => {
|
|
3864
|
+
var { options, optionGroups, placeholder = '--Select-One--', readOnly, invalid, searchable = false, value: propValue, onChange, style, tabIndex, dataItemid, isInvalidRedBackground = false, isWarningError = false, innerRef = null } = _a, accessibleProps = __rest(_a, ["options", "optionGroups", "placeholder", "readOnly", "invalid", "searchable", "value", "onChange", "style", "tabIndex", "dataItemid", "isInvalidRedBackground", "isWarningError", "innerRef"]);
|
|
3865
|
+
const [searchTerm, setSearchTerm] = React.useState('');
|
|
3866
|
+
const [value, setValue] = React.useState(propValue || '');
|
|
3867
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
3868
|
+
const wrapperRef = React.useRef(null);
|
|
3869
|
+
const baseId = dataItemid || 'custom-select';
|
|
3870
|
+
// Update the value when the prop changes
|
|
3871
|
+
React.useEffect(() => {
|
|
3872
|
+
setValue(propValue || '');
|
|
3873
|
+
}, [propValue]);
|
|
3874
|
+
// Close dropdown when clicking outside
|
|
3875
|
+
React.useEffect(() => {
|
|
3876
|
+
const handleClickOutside = (event) => {
|
|
3877
|
+
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
|
|
3878
|
+
setIsOpen(false);
|
|
3879
|
+
}
|
|
3880
|
+
};
|
|
3881
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
3882
|
+
return () => {
|
|
3883
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
3884
|
+
};
|
|
3885
|
+
}, []);
|
|
3886
|
+
const handleSearch = (event) => {
|
|
3887
|
+
setSearchTerm(event.target.value);
|
|
3888
|
+
setIsOpen(true);
|
|
3889
|
+
};
|
|
3890
|
+
const handleToggle = () => {
|
|
3891
|
+
if (!readOnly) {
|
|
3892
|
+
setIsOpen(!isOpen);
|
|
3893
|
+
}
|
|
3894
|
+
};
|
|
3895
|
+
const handleOptionClick = (optionValue, disabled) => {
|
|
3896
|
+
if (disabled || readOnly)
|
|
3897
|
+
return;
|
|
3898
|
+
setValue(optionValue.toString());
|
|
3899
|
+
setIsOpen(false);
|
|
3900
|
+
setSearchTerm('');
|
|
3901
|
+
if (onChange) {
|
|
3902
|
+
onChange(optionValue);
|
|
3903
|
+
}
|
|
3904
|
+
};
|
|
3905
|
+
const getSelectedLabel = () => {
|
|
3906
|
+
if (!value || value === '')
|
|
3907
|
+
return placeholder;
|
|
3908
|
+
// Check in options
|
|
3909
|
+
if (options) {
|
|
3910
|
+
const found = options.find(opt => opt.value.toString() === value.toString());
|
|
3911
|
+
if (found)
|
|
3912
|
+
return found.label || found.value;
|
|
3913
|
+
}
|
|
3914
|
+
// Check in optionGroups
|
|
3915
|
+
if (optionGroups) {
|
|
3916
|
+
for (const group of optionGroups) {
|
|
3917
|
+
const found = group.options.find(opt => opt.value.toString() === value.toString());
|
|
3918
|
+
if (found)
|
|
3919
|
+
return found.label || found.value;
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3922
|
+
return value;
|
|
3923
|
+
};
|
|
3924
|
+
const filteredOptions = searchable
|
|
3925
|
+
? options === null || options === void 0 ? void 0 : options.filter(option => { var _a; return (_a = option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm.toLowerCase()); })
|
|
3926
|
+
: options;
|
|
3927
|
+
const filteredOptionGroups = searchable
|
|
3928
|
+
? optionGroups === null || optionGroups === void 0 ? void 0 : optionGroups.map(group => (Object.assign(Object.assign({}, group), { options: group.options.filter(option => { var _a; return (_a = option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm.toLowerCase()); }) })))
|
|
3929
|
+
: optionGroups;
|
|
3930
|
+
return (React.createElement(Wrapper$b, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$isWarningError": isWarningError, "$readOnly": readOnly, "$style": style, "data-itemid": `${baseId}-wrapper`, ref: wrapperRef, style: style },
|
|
3931
|
+
searchable && (React.createElement(SearchInput$2, Object.assign({ "$isOpen": isOpen, autoFocus: isOpen, "data-itemid": `${baseId}-search-input`, onChange: handleSearch, placeholder: placeholder, tabIndex: readOnly ? -1 : tabIndex, type: 'text', value: searchTerm }, accessibleProps))),
|
|
3932
|
+
React.createElement(Trigger$2, Object.assign({ "$readOnly": readOnly, "$searchableOpen": searchable && isOpen, "data-itemid": `${baseId}-trigger`, id: `${baseId}-trigger`, onClick: handleToggle, ref: innerRef, tabIndex: readOnly ? -1 : tabIndex }, accessibleProps), getSelectedLabel()),
|
|
3933
|
+
React.createElement(IconWrapper$3, { "$isOpen": isOpen, color: Colors.BLACK.Hex, "data-itemid": `${baseId}-icon`, path: js.mdiChevronDown, size: '22px' }),
|
|
3934
|
+
React.createElement(DropdownContainer, { "$isOpen": isOpen, "data-itemid": `${baseId}-dropdown` },
|
|
3935
|
+
!value && placeholder && (React.createElement(OptionItem, { "$disabled": true, "$isSelected": false, "data-itemid": `${baseId}-placeholder` }, placeholder)),
|
|
3936
|
+
filteredOptionGroups &&
|
|
3937
|
+
filteredOptionGroups.map((group, i) => (React.createElement("div", { "data-itemid": `${baseId}-optgroup-${i}`, key: i },
|
|
3938
|
+
React.createElement(OptionGroupLabel, null, group.label || `Group ${i}`),
|
|
3939
|
+
group.options.map((option, j) => (React.createElement(OptionItem, { "$color": option.color, "$disabled": option.disabled, "$isGrouped": true, "$isSelected": !!(value && value !== '' && value.toString() === option.value.toString()), "data-itemid": `${baseId}-option-${i}-${j}`, key: j, onClick: () => handleOptionClick(option.value, option.disabled) }, option.label || option.value)))))),
|
|
3940
|
+
filteredOptions &&
|
|
3941
|
+
filteredOptions.map((option, i) => (React.createElement(OptionItem, { "$color": option.color, "$disabled": option.disabled, "$isSelected": !!(value && value !== '' && value.toString() === option.value.toString()), "data-itemid": `${baseId}-option-${i}`, key: i, onClick: () => handleOptionClick(option.value, option.disabled) }, option.label || option.value))))));
|
|
3942
|
+
};
|
|
3943
|
+
|
|
3719
3944
|
const getBackgroundColor$2 = (props) => {
|
|
3720
3945
|
if (props.$isWarningError) {
|
|
3721
3946
|
return '#fcf1c9';
|
|
@@ -3803,7 +4028,7 @@ const SearchInput$1 = styled.input `
|
|
|
3803
4028
|
white-space: nowrap;
|
|
3804
4029
|
`;
|
|
3805
4030
|
const Select = (_a) => {
|
|
3806
|
-
var { options, optionGroups, placeholder = '--Select-One--', readOnly, invalid, searchable = false, value: propValue, onChange, style, tabIndex, dataItemid, isInvalidRedBackground = false, isWarningError = false, innerRef = null } = _a, accessibleProps = __rest(_a, ["options", "optionGroups", "placeholder", "readOnly", "invalid", "searchable", "value", "onChange", "style", "tabIndex", "dataItemid", "isInvalidRedBackground", "isWarningError", "innerRef"]);
|
|
4031
|
+
var { options, optionGroups, placeholder = '--Select-One--', readOnly, invalid, searchable = false, value: propValue, onChange, style, tabIndex, dataItemid, isInvalidRedBackground = false, isWarningError = false, innerRef = null, isCustomSelect = false } = _a, accessibleProps = __rest(_a, ["options", "optionGroups", "placeholder", "readOnly", "invalid", "searchable", "value", "onChange", "style", "tabIndex", "dataItemid", "isInvalidRedBackground", "isWarningError", "innerRef", "isCustomSelect"]);
|
|
3807
4032
|
const [searchTerm, setSearchTerm] = React.useState('');
|
|
3808
4033
|
const [value, setValue] = React.useState(propValue || '');
|
|
3809
4034
|
const baseId = dataItemid || 'select';
|
|
@@ -3826,6 +4051,9 @@ const Select = (_a) => {
|
|
|
3826
4051
|
const filteredOptionGroups = searchable
|
|
3827
4052
|
? optionGroups === null || optionGroups === void 0 ? void 0 : optionGroups.map(group => (Object.assign(Object.assign({}, group), { options: group.options.filter(option => { var _a; return (_a = option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm.toLowerCase()); }) })))
|
|
3828
4053
|
: optionGroups;
|
|
4054
|
+
if (isCustomSelect) {
|
|
4055
|
+
return (React.createElement(CustomSelect, Object.assign({ dataItemid: dataItemid, innerRef: innerRef, invalid: invalid, isInvalidRedBackground: isInvalidRedBackground, isWarningError: isWarningError, onChange: onChange, optionGroups: optionGroups, options: options, placeholder: placeholder, readOnly: readOnly, searchable: searchable, style: style, tabIndex: tabIndex, value: propValue }, accessibleProps)));
|
|
4056
|
+
}
|
|
3829
4057
|
return (React.createElement(Wrapper$a, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$isWarningError": isWarningError, "$readOnly": readOnly, "$style": style, "data-itemid": `${baseId}-wrapper`, style: style },
|
|
3830
4058
|
searchable && (React.createElement(SearchInput$1, Object.assign({ "data-itemid": `${baseId}-search-input`, onChange: handleSearch, placeholder: placeholder, tabIndex: readOnly ? -1 : tabIndex, type: 'text', value: searchTerm }, accessibleProps))),
|
|
3831
4059
|
React.createElement(Trigger$1, Object.assign({ "data-itemid": `${baseId}-trigger`, disabled: readOnly, id: `${baseId}-trigger`, name: baseId, onChange: handleChange, placeholder: placeholder, ref: innerRef, tabIndex: readOnly ? -1 : tabIndex, value: value }, accessibleProps),
|