@hexure/ui 1.13.59 → 1.13.60
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 +105 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/cjs/types/components/Input/Input.d.ts +1 -0
- package/dist/cjs/types/components/Radio/Radio.d.ts +1 -0
- package/dist/cjs/types/components/Select/Select.d.ts +1 -0
- package/dist/esm/index.js +105 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/esm/types/components/Input/Input.d.ts +1 -0
- package/dist/esm/types/components/Radio/Radio.d.ts +1 -0
- package/dist/esm/types/components/Select/Select.d.ts +1 -0
- package/dist/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -945,6 +945,28 @@ const Input$2 = styled.input `
|
|
|
945
945
|
display: block;
|
|
946
946
|
}
|
|
947
947
|
`;
|
|
948
|
+
const getBackgroundColor$3 = (props) => {
|
|
949
|
+
if (props.$isWarningError) {
|
|
950
|
+
return '#fcf1c9';
|
|
951
|
+
}
|
|
952
|
+
else if (props.$invalid && props.$isInvalidRedBackground) {
|
|
953
|
+
return '#ffe5e5';
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
return '#ffffff';
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
const getBorderColor$3 = (props) => {
|
|
960
|
+
if (props.$isWarningError) {
|
|
961
|
+
return 'Orange';
|
|
962
|
+
}
|
|
963
|
+
else if (props.$invalid) {
|
|
964
|
+
return Colors.RED.Hex;
|
|
965
|
+
}
|
|
966
|
+
else {
|
|
967
|
+
return Colors.GRAY.Hex;
|
|
968
|
+
}
|
|
969
|
+
};
|
|
948
970
|
const Check$1 = styled.span `
|
|
949
971
|
height: 17px;
|
|
950
972
|
width: 17px;
|
|
@@ -952,8 +974,8 @@ const Check$1 = styled.span `
|
|
|
952
974
|
background-color: #fff;
|
|
953
975
|
border-width: 2px;
|
|
954
976
|
border-style: solid;
|
|
955
|
-
border-color: ${props => (props
|
|
956
|
-
background-color: ${props => props
|
|
977
|
+
border-color: ${props => getBorderColor$3(props)};
|
|
978
|
+
background-color: ${props => getBackgroundColor$3(props)};
|
|
957
979
|
box-sizing: border-box;
|
|
958
980
|
position: relative;
|
|
959
981
|
&:after {
|
|
@@ -982,11 +1004,11 @@ const Label$3 = styled.span `
|
|
|
982
1004
|
box-sizing: border-box;
|
|
983
1005
|
`;
|
|
984
1006
|
const Checkbox = (_a) => {
|
|
985
|
-
var { children, color, disabled, checked, onChange, invalid, tooltip, tabIndex, dataItemid, isInvalidRedBackground = false } = _a, accessibleProps = __rest(_a, ["children", "color", "disabled", "checked", "onChange", "invalid", "tooltip", "tabIndex", "dataItemid", "isInvalidRedBackground"]);
|
|
1007
|
+
var { children, color, disabled, checked, onChange, invalid, tooltip, tabIndex, dataItemid, isInvalidRedBackground = false, isWarningError = false } = _a, accessibleProps = __rest(_a, ["children", "color", "disabled", "checked", "onChange", "invalid", "tooltip", "tabIndex", "dataItemid", "isInvalidRedBackground", "isWarningError"]);
|
|
986
1008
|
const baseId = dataItemid || 'checkbox';
|
|
987
1009
|
return (React.createElement(Wrapper$b, Object.assign({ "$disabled": disabled }, accessibleProps, { "data-itemid": `${baseId}-wrapper` }),
|
|
988
1010
|
React.createElement(Input$2, { checked: checked, "data-itemid": `${baseId}-input`, disabled: disabled, name: accessibleProps.name, onChange: disabled ? undefined : onChange, tabIndex: disabled ? -1 : tabIndex, type: 'checkbox' }),
|
|
989
|
-
React.createElement(Check$1, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "data-itemid": `${baseId}-check` }),
|
|
1011
|
+
React.createElement(Check$1, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$isWarningError": isWarningError, "data-itemid": `${baseId}-check` }),
|
|
990
1012
|
children ? (React.createElement(Label$3, { color: color, "data-itemid": `${baseId}-label` },
|
|
991
1013
|
children,
|
|
992
1014
|
tooltip ? React.createElement(Tooltip, Object.assign({}, tooltip)) : null)) : null));
|
|
@@ -1040,6 +1062,28 @@ const Checklist = (_a) => {
|
|
|
1040
1062
|
}))));
|
|
1041
1063
|
};
|
|
1042
1064
|
|
|
1065
|
+
const getBackgroundColor$2 = (props) => {
|
|
1066
|
+
if (props.$isWarningError) {
|
|
1067
|
+
return '#fcf1c9';
|
|
1068
|
+
}
|
|
1069
|
+
else if (props.$invalid && props.$isInvalidRedBackground) {
|
|
1070
|
+
return '#ffe5e5';
|
|
1071
|
+
}
|
|
1072
|
+
else {
|
|
1073
|
+
return props.$readOnly ? '#f5f5f5' : '#ffffff';
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
const getBorderColor$2 = (props) => {
|
|
1077
|
+
if (props.$isWarningError) {
|
|
1078
|
+
return 'Orange';
|
|
1079
|
+
}
|
|
1080
|
+
else if (props.$invalid) {
|
|
1081
|
+
return Colors.RED.Hex;
|
|
1082
|
+
}
|
|
1083
|
+
else {
|
|
1084
|
+
return '#cccccc';
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1043
1087
|
const Wrapper$a = styled.div `
|
|
1044
1088
|
border-radius: 4px;
|
|
1045
1089
|
height: 40px;
|
|
@@ -1048,8 +1092,8 @@ const Wrapper$a = styled.div `
|
|
|
1048
1092
|
cursor: ${props => (props.$readOnly ? 'default' : 'pointer')};
|
|
1049
1093
|
border-width: 1px;
|
|
1050
1094
|
border-style: solid;
|
|
1051
|
-
border-color: ${props => (props
|
|
1052
|
-
background-color: ${props => props
|
|
1095
|
+
border-color: ${props => getBorderColor$2(props)};
|
|
1096
|
+
background-color: ${props => getBackgroundColor$2(props)};
|
|
1053
1097
|
border-radius: ${({ $style }) => ($style === null || $style === void 0 ? void 0 : $style.borderRadius) || '4px'};
|
|
1054
1098
|
flex-grow: ${({ $style }) => ($style === null || $style === void 0 ? void 0 : $style.flexGrow) || 0};
|
|
1055
1099
|
box-sizing: border-box;
|
|
@@ -1105,7 +1149,7 @@ const SearchInput$1 = styled.input `
|
|
|
1105
1149
|
white-space: nowrap;
|
|
1106
1150
|
`;
|
|
1107
1151
|
const Select = (_a) => {
|
|
1108
|
-
var { options, optionGroups, placeholder = '--Select-One--', readOnly, invalid, searchable = false, value: propValue, onChange, style, tabIndex, dataItemid, isInvalidRedBackground = false } = _a, accessibleProps = __rest(_a, ["options", "optionGroups", "placeholder", "readOnly", "invalid", "searchable", "value", "onChange", "style", "tabIndex", "dataItemid", "isInvalidRedBackground"]);
|
|
1152
|
+
var { options, optionGroups, placeholder = '--Select-One--', readOnly, invalid, searchable = false, value: propValue, onChange, style, tabIndex, dataItemid, isInvalidRedBackground = false, isWarningError = false } = _a, accessibleProps = __rest(_a, ["options", "optionGroups", "placeholder", "readOnly", "invalid", "searchable", "value", "onChange", "style", "tabIndex", "dataItemid", "isInvalidRedBackground", "isWarningError"]);
|
|
1109
1153
|
const [searchTerm, setSearchTerm] = React.useState('');
|
|
1110
1154
|
const [value, setValue] = React.useState(propValue || '');
|
|
1111
1155
|
const baseId = dataItemid || 'select';
|
|
@@ -1128,7 +1172,7 @@ const Select = (_a) => {
|
|
|
1128
1172
|
const filteredOptionGroups = searchable
|
|
1129
1173
|
? 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()); }) })))
|
|
1130
1174
|
: optionGroups;
|
|
1131
|
-
return (React.createElement(Wrapper$a, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$readOnly": readOnly, "$style": style, "data-itemid": `${baseId}-wrapper` },
|
|
1175
|
+
return (React.createElement(Wrapper$a, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$isWarningError": isWarningError, "$readOnly": readOnly, "$style": style, "data-itemid": `${baseId}-wrapper` },
|
|
1132
1176
|
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))),
|
|
1133
1177
|
React.createElement(Trigger$1, Object.assign({ "data-itemid": `${baseId}-trigger`, disabled: readOnly, onChange: handleChange, placeholder: placeholder, tabIndex: readOnly ? -1 : tabIndex, value: value }, accessibleProps),
|
|
1134
1178
|
placeholder && !value && (React.createElement("option", { "data-itemid": `${baseId}-placeholder`, disabled: true, value: '' }, placeholder)),
|
|
@@ -1818,6 +1862,28 @@ const StyledSuffix = styled.div `
|
|
|
1818
1862
|
font-size: ${FontSizes.DEFAULT};
|
|
1819
1863
|
color: ${Colors.BLACK.Hex};
|
|
1820
1864
|
`;
|
|
1865
|
+
const getBackgroundColor$1 = (props) => {
|
|
1866
|
+
if (props.$isWarningError) {
|
|
1867
|
+
return '#fcf1c9';
|
|
1868
|
+
}
|
|
1869
|
+
else if (props.$invalid && props.$isInvalidRedBackground) {
|
|
1870
|
+
return '#ffe5e5';
|
|
1871
|
+
}
|
|
1872
|
+
else {
|
|
1873
|
+
return props.$readOnly ? '#f5f5f5' : '#ffffff';
|
|
1874
|
+
}
|
|
1875
|
+
};
|
|
1876
|
+
const getBorderColor$1 = (props) => {
|
|
1877
|
+
if (props.$isWarningError) {
|
|
1878
|
+
return 'Orange';
|
|
1879
|
+
}
|
|
1880
|
+
else if (props.$invalid) {
|
|
1881
|
+
return Colors.RED.Hex;
|
|
1882
|
+
}
|
|
1883
|
+
else {
|
|
1884
|
+
return '#cccccc';
|
|
1885
|
+
}
|
|
1886
|
+
};
|
|
1821
1887
|
const StyledWrapper = styled.div `
|
|
1822
1888
|
display: flex;
|
|
1823
1889
|
width: ${({ $style }) => ($style === null || $style === void 0 ? void 0 : $style.width) || 'auto'};
|
|
@@ -1825,8 +1891,8 @@ const StyledWrapper = styled.div `
|
|
|
1825
1891
|
position: relative;
|
|
1826
1892
|
border-width: 1px;
|
|
1827
1893
|
border-style: solid;
|
|
1828
|
-
border-color: ${props => (props
|
|
1829
|
-
background-color: ${props => props
|
|
1894
|
+
border-color: ${props => getBorderColor$1(props)};
|
|
1895
|
+
background-color: ${props => getBackgroundColor$1(props)};
|
|
1830
1896
|
border-radius: ${props => (props.$suggestions ? '4px 4px 0px 0px' : '4px')};
|
|
1831
1897
|
|
|
1832
1898
|
&:focus-within {
|
|
@@ -1892,7 +1958,7 @@ const Loader$1 = styled.div `
|
|
|
1892
1958
|
const Input$1 = (_a) => {
|
|
1893
1959
|
var { format, suffix, height, invalid, loading, max, maxLength, min, onBlur, onChange, onFocus, onKeyDown,
|
|
1894
1960
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1895
|
-
onSuggestedSelect = () => { }, placeholder, readOnly, showCharCount, step, style, suggestedValues, showErrorTextColor = false, type = 'text', value = '', innerRef = null, tabIndex, isAutoComplete = false, dataItemid, mask, onPaste, autoComplete, isInvalidRedBackground = false } = _a, accessibleProps = __rest(_a, ["format", "suffix", "height", "invalid", "loading", "max", "maxLength", "min", "onBlur", "onChange", "onFocus", "onKeyDown", "onSuggestedSelect", "placeholder", "readOnly", "showCharCount", "step", "style", "suggestedValues", "showErrorTextColor", "type", "value", "innerRef", "tabIndex", "isAutoComplete", "dataItemid", "mask", "onPaste", "autoComplete", "isInvalidRedBackground"]);
|
|
1961
|
+
onSuggestedSelect = () => { }, placeholder, readOnly, showCharCount, step, style, suggestedValues, showErrorTextColor = false, type = 'text', value = '', innerRef = null, tabIndex, isAutoComplete = false, dataItemid, mask, onPaste, autoComplete, isInvalidRedBackground = false, isWarningError = false } = _a, accessibleProps = __rest(_a, ["format", "suffix", "height", "invalid", "loading", "max", "maxLength", "min", "onBlur", "onChange", "onFocus", "onKeyDown", "onSuggestedSelect", "placeholder", "readOnly", "showCharCount", "step", "style", "suggestedValues", "showErrorTextColor", "type", "value", "innerRef", "tabIndex", "isAutoComplete", "dataItemid", "mask", "onPaste", "autoComplete", "isInvalidRedBackground", "isWarningError"]);
|
|
1896
1962
|
const [show_options, setShowOptions] = React.useState(false);
|
|
1897
1963
|
const [internalValue, setInternalValue] = React.useState(value);
|
|
1898
1964
|
const [internalSuggestedValues, setInternalSuggestedValues] = React.useState(suggestedValues || []);
|
|
@@ -1968,7 +2034,7 @@ const Input$1 = (_a) => {
|
|
|
1968
2034
|
formatted_value = formatAsMask(internalValue, mask);
|
|
1969
2035
|
}
|
|
1970
2036
|
const baseId = dataItemid || 'input';
|
|
1971
|
-
return type === 'textarea' ? (React.createElement(StyledWrapper, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$readOnly": readOnly, "$style": style, "$suggestions": show_options && !!internalSuggestedValues.length, "data-itemid": `${baseId}-wrapper`, style: style },
|
|
2037
|
+
return type === 'textarea' ? (React.createElement(StyledWrapper, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$isWarningError": isWarningError, "$readOnly": readOnly, "$style": style, "$suggestions": show_options && !!internalSuggestedValues.length, "data-itemid": `${baseId}-wrapper`, style: style },
|
|
1972
2038
|
React.createElement(StyledTextArea, Object.assign({ "$height": height, "$invalid": invalid, "$readOnly": readOnly, "$showErrorTextColor": showErrorTextColor, autoComplete: autoComplete, maxLength: maxLength, onBlur: readOnly
|
|
1973
2039
|
? e => e.preventDefault()
|
|
1974
2040
|
: e => {
|
|
@@ -1991,7 +2057,7 @@ const Input$1 = (_a) => {
|
|
|
1991
2057
|
React.createElement(Icon, { color: Colors.MEDIUM_GRAY.Hex, path: js.mdiLoading, size: '20px', spin: true }))) : null,
|
|
1992
2058
|
showCharCount ? (React.createElement(CharacterCount, { "data-itemid": `${baseId}-char-count` },
|
|
1993
2059
|
internalValue.length,
|
|
1994
|
-
maxLength ? ` / ${maxLength}` : null)) : null)) : (React.createElement(StyledWrapper, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$readOnly": readOnly, "$style": style, "$suggestions": show_options && !!internalSuggestedValues.length, "data-itemid": `${baseId}-wrapper`, style: style },
|
|
2060
|
+
maxLength ? ` / ${maxLength}` : null)) : null)) : (React.createElement(StyledWrapper, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$isWarningError": isWarningError, "$readOnly": readOnly, "$style": style, "$suggestions": show_options && !!internalSuggestedValues.length, "data-itemid": `${baseId}-wrapper`, style: style },
|
|
1995
2061
|
React.createElement(StyledInput, Object.assign({ "$height": height, "$invalid": invalid, "$readOnly": readOnly, "$showErrorTextColor": showErrorTextColor, autoComplete: autoComplete, max: max, maxLength: maxLength, min: min, onBlur: readOnly
|
|
1996
2062
|
? e => e.preventDefault()
|
|
1997
2063
|
: e => {
|
|
@@ -2538,6 +2604,28 @@ const Input = styled.input `
|
|
|
2538
2604
|
background-color: ${Colors.MEDIUM_GRAY.Hex};
|
|
2539
2605
|
}
|
|
2540
2606
|
`;
|
|
2607
|
+
const getBackgroundColor = (props) => {
|
|
2608
|
+
if (props.$isWarningError) {
|
|
2609
|
+
return '#fcf1c9';
|
|
2610
|
+
}
|
|
2611
|
+
else if (props.$invalid && props.$isInvalidRedBackground) {
|
|
2612
|
+
return '#ffe5e5';
|
|
2613
|
+
}
|
|
2614
|
+
else {
|
|
2615
|
+
return '#ffffff';
|
|
2616
|
+
}
|
|
2617
|
+
};
|
|
2618
|
+
const getBorderColor = (props) => {
|
|
2619
|
+
if (props.$isWarningError) {
|
|
2620
|
+
return 'Orange';
|
|
2621
|
+
}
|
|
2622
|
+
else if (props.$invalid) {
|
|
2623
|
+
return Colors.RED.Hex;
|
|
2624
|
+
}
|
|
2625
|
+
else {
|
|
2626
|
+
return Colors.GRAY.Hex;
|
|
2627
|
+
}
|
|
2628
|
+
};
|
|
2541
2629
|
const Check = styled.span `
|
|
2542
2630
|
height: 17px;
|
|
2543
2631
|
width: 17px;
|
|
@@ -2545,8 +2633,8 @@ const Check = styled.span `
|
|
|
2545
2633
|
background-color: #fff;
|
|
2546
2634
|
border-width: 2px;
|
|
2547
2635
|
border-style: solid;
|
|
2548
|
-
border-color: ${props => (props
|
|
2549
|
-
background-color: ${props => props
|
|
2636
|
+
border-color: ${props => getBorderColor(props)};
|
|
2637
|
+
background-color: ${props => getBackgroundColor(props)};
|
|
2550
2638
|
box-sizing: border-box;
|
|
2551
2639
|
position: relative;
|
|
2552
2640
|
&:after {
|
|
@@ -2570,11 +2658,11 @@ const Label = styled.span `
|
|
|
2570
2658
|
margin-left: 6px;
|
|
2571
2659
|
`;
|
|
2572
2660
|
const Radio = (_a) => {
|
|
2573
|
-
var { children, disabled, checked, onChange, value, invalid, tooltip, tabIndex, dataItemid, isInvalidRedBackground = false } = _a, accessibleProps = __rest(_a, ["children", "disabled", "checked", "onChange", "value", "invalid", "tooltip", "tabIndex", "dataItemid", "isInvalidRedBackground"]);
|
|
2661
|
+
var { children, disabled, checked, onChange, value, invalid, tooltip, tabIndex, dataItemid, isInvalidRedBackground = false, isWarningError = false } = _a, accessibleProps = __rest(_a, ["children", "disabled", "checked", "onChange", "value", "invalid", "tooltip", "tabIndex", "dataItemid", "isInvalidRedBackground", "isWarningError"]);
|
|
2574
2662
|
const baseId = dataItemid || 'radio';
|
|
2575
2663
|
return (React.createElement(Wrapper$2, Object.assign({}, accessibleProps, { "data-itemid": `${baseId}-wrapper` }),
|
|
2576
2664
|
React.createElement(Input, { checked: checked, "data-itemid": `${baseId}-input`, disabled: disabled, name: accessibleProps.name, onChange: disabled ? undefined : onChange, tabIndex: disabled ? -1 : tabIndex, type: 'radio', value: value }),
|
|
2577
|
-
React.createElement(Check, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "data-itemid": `${baseId}-check` }),
|
|
2665
|
+
React.createElement(Check, { "$invalid": invalid, "$isInvalidRedBackground": isInvalidRedBackground, "$isWarningError": isWarningError, "data-itemid": `${baseId}-check` }),
|
|
2578
2666
|
React.createElement(Label, { "data-itemid": `${baseId}-label` },
|
|
2579
2667
|
children,
|
|
2580
2668
|
tooltip ? React.createElement(Tooltip, Object.assign({}, tooltip)) : null)));
|