@hexure/ui 1.11.9 → 1.11.11
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 +31 -46
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/cjs/types/components/Input/Input.d.ts +3 -1
- package/dist/cjs/types/components/Radio/Radio.d.ts +3 -0
- package/dist/esm/index.js +31 -46
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/esm/types/components/Input/Input.d.ts +3 -1
- package/dist/esm/types/components/Radio/Radio.d.ts +3 -0
- package/dist/index.d.ts +8 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -764,10 +764,11 @@ const Wrapper$c = styled.label `
|
|
|
764
764
|
margin-left: -6px;
|
|
765
765
|
cursor: ${props => (props.$disabled ? 'default' : 'pointer')};
|
|
766
766
|
display: flex;
|
|
767
|
-
align-items:
|
|
767
|
+
align-items: center;
|
|
768
768
|
font-size: ${FontSizes.DEFAULT};
|
|
769
769
|
line-height: 1.6em;
|
|
770
770
|
box-sizing: border-box;
|
|
771
|
+
background: ${props => (props.$invalid ? `rgba(${Colors.RED.Rgb}, 0.05)` : 'transparent')};
|
|
771
772
|
|
|
772
773
|
&:focus-within {
|
|
773
774
|
background: ${props => `rgba(${props.theme.PRIMARY_COLOR.Rgb}, 0.05)`};
|
|
@@ -776,7 +777,7 @@ const Wrapper$c = styled.label `
|
|
|
776
777
|
Wrapper$c.defaultProps = { theme: EditableTheme };
|
|
777
778
|
const Input$2 = styled.input `
|
|
778
779
|
font-size: 20px;
|
|
779
|
-
margin:
|
|
780
|
+
margin: 0px;
|
|
780
781
|
line-height: 1.1em;
|
|
781
782
|
box-sizing: border-box;
|
|
782
783
|
`;
|
|
@@ -790,8 +791,8 @@ const Label$3 = styled.span `
|
|
|
790
791
|
box-sizing: border-box;
|
|
791
792
|
`;
|
|
792
793
|
const Checkbox = (_a) => {
|
|
793
|
-
var { children, disabled, checked, onChange } = _a, accessibleProps = __rest(_a, ["children", "disabled", "checked", "onChange"]);
|
|
794
|
-
return (React.createElement(Wrapper$c, Object.assign({}, accessibleProps),
|
|
794
|
+
var { children, disabled, checked, onChange, invalid } = _a, accessibleProps = __rest(_a, ["children", "disabled", "checked", "onChange", "invalid"]);
|
|
795
|
+
return (React.createElement(Wrapper$c, Object.assign({ "$disabled": disabled, "$invalid": invalid }, accessibleProps),
|
|
795
796
|
React.createElement(Input$2, { checked: checked, disabled: disabled, name: accessibleProps.name, onChange: disabled ? undefined : onChange, type: 'checkbox' }),
|
|
796
797
|
children ? React.createElement(Label$3, null, children) : null));
|
|
797
798
|
};
|
|
@@ -1470,8 +1471,11 @@ const StyledInput = styled.input `
|
|
|
1470
1471
|
line-height: 1.28em;
|
|
1471
1472
|
color: ${props => (props.$invalid && !props.$readOnly ? Colors.RED.Hex : Colors.BLACK.Hex)};
|
|
1472
1473
|
position: relative;
|
|
1473
|
-
height: auto;
|
|
1474
|
-
padding: 10px;
|
|
1474
|
+
height: ${props => props.$height || 'auto'};
|
|
1475
|
+
padding-top: 10px;
|
|
1476
|
+
padding-bottom: 10px;
|
|
1477
|
+
padding-left: 10px;
|
|
1478
|
+
padding-right: ${({ $showCharCount }) => ($showCharCount ? '60px' : '10px')};
|
|
1475
1479
|
opacity: ${props => (props.$readOnly ? 0.6 : 1)};
|
|
1476
1480
|
box-shadow: none;
|
|
1477
1481
|
outline: none;
|
|
@@ -1515,34 +1519,6 @@ const StyledWrapper = styled.div `
|
|
|
1515
1519
|
}
|
|
1516
1520
|
`;
|
|
1517
1521
|
StyledWrapper.defaultProps = { theme: EditableTheme };
|
|
1518
|
-
const StyledTextarea = styled.textarea `
|
|
1519
|
-
background-color: ${props => (props.$readOnly ? '#f5f5f5' : '#ffffff')};
|
|
1520
|
-
border-radius: 4px;
|
|
1521
|
-
border-width: 1px;
|
|
1522
|
-
border-style: solid;
|
|
1523
|
-
border-color: ${props => (props.$invalid && !props.$readOnly ? Colors.RED.Hex : '#cccccc')};
|
|
1524
|
-
font-size: ${FontSizes.DEFAULT};
|
|
1525
|
-
font-weight: 400;
|
|
1526
|
-
font-family: ${FontStyles.DEFAULT};
|
|
1527
|
-
line-height: 1.6em;
|
|
1528
|
-
color: ${props => (props.$invalid && !props.$readOnly ? Colors.RED.Hex : Colors.BLACK.Hex)};
|
|
1529
|
-
position: relative;
|
|
1530
|
-
height: ${props => props.$height || '40px'};
|
|
1531
|
-
padding: 10px;
|
|
1532
|
-
opacity: ${props => (props.$readOnly ? 0.6 : 1)};
|
|
1533
|
-
box-shadow: none;
|
|
1534
|
-
outline: none;
|
|
1535
|
-
margin: 0px;
|
|
1536
|
-
text-indent: 0px;
|
|
1537
|
-
--webkit-appearance: none;
|
|
1538
|
-
box-sizing: border-box;
|
|
1539
|
-
display: block;
|
|
1540
|
-
width: ${({ $style }) => ($style === null || $style === void 0 ? void 0 : $style.width) || '100%'};
|
|
1541
|
-
&:focus {
|
|
1542
|
-
border-color: ${props => (props.$readOnly ? '#cccccc' : props.theme.PRIMARY_COLOR.Hex)};
|
|
1543
|
-
}
|
|
1544
|
-
`;
|
|
1545
|
-
StyledTextarea.defaultProps = { theme: EditableTheme };
|
|
1546
1522
|
const SuggestedValues = styled.div `
|
|
1547
1523
|
background: #fff;
|
|
1548
1524
|
box-shadow: 0px 5px 30px -15px rgba(0, 0, 0, 0.2);
|
|
@@ -1587,8 +1563,16 @@ const SuggestedValue = styled.div `
|
|
|
1587
1563
|
}
|
|
1588
1564
|
`;
|
|
1589
1565
|
SuggestedValue.defaultProps = { theme: EditableTheme };
|
|
1566
|
+
const CharacterCount = styled.div `
|
|
1567
|
+
position: absolute;
|
|
1568
|
+
right: 10px;
|
|
1569
|
+
top: 11px;
|
|
1570
|
+
font-family: ${FontStyles.DEFAULT};
|
|
1571
|
+
font-size: ${FontSizes.SMALL};
|
|
1572
|
+
color: ${Colors.MEDIUM_GRAY.Hex};
|
|
1573
|
+
`;
|
|
1590
1574
|
const Input$1 = (_a) => {
|
|
1591
|
-
var { format, suffix, height, invalid, max, maxLength, min, onBlur, onChange, onFocus, onKeyDown, onSuggestedSelect, placeholder, readOnly, step, style, suggestedValues, type = 'text', value = '' } = _a, accessibleProps = __rest(_a, ["format", "suffix", "height", "invalid", "max", "maxLength", "min", "onBlur", "onChange", "onFocus", "onKeyDown", "onSuggestedSelect", "placeholder", "readOnly", "step", "style", "suggestedValues", "type", "value"]);
|
|
1575
|
+
var { format, suffix, height, invalid, max, maxLength, min, onBlur, onChange, onFocus, onKeyDown, onSuggestedSelect, placeholder, readOnly, showCharCount, step, style, suggestedValues, type = 'text', value = '' } = _a, accessibleProps = __rest(_a, ["format", "suffix", "height", "invalid", "max", "maxLength", "min", "onBlur", "onChange", "onFocus", "onKeyDown", "onSuggestedSelect", "placeholder", "readOnly", "showCharCount", "step", "style", "suggestedValues", "type", "value"]);
|
|
1592
1576
|
const [show_options, setShowOptions] = React.useState(false);
|
|
1593
1577
|
const handleInputChange = (e) => {
|
|
1594
1578
|
if (format === 'currency' || format === 'currency_decimal') {
|
|
@@ -1609,10 +1593,6 @@ const Input$1 = (_a) => {
|
|
|
1609
1593
|
if (!readOnly && onChange)
|
|
1610
1594
|
onChange(e);
|
|
1611
1595
|
};
|
|
1612
|
-
const handleTextareaChange = (e) => {
|
|
1613
|
-
if (!readOnly && onChange)
|
|
1614
|
-
onChange(e);
|
|
1615
|
-
};
|
|
1616
1596
|
let formatted_value = value;
|
|
1617
1597
|
if (format === 'phone') {
|
|
1618
1598
|
formatted_value = formatAsPhone(value);
|
|
@@ -1628,8 +1608,8 @@ const Input$1 = (_a) => {
|
|
|
1628
1608
|
if (format === 'ssn' && type !== 'password') {
|
|
1629
1609
|
formatted_value = formatAsSsn(value);
|
|
1630
1610
|
}
|
|
1631
|
-
return
|
|
1632
|
-
React.createElement(StyledInput, Object.assign({ "$invalid": invalid, "$readOnly": readOnly, max: max, maxLength: maxLength, min: min, onBlur: readOnly
|
|
1611
|
+
return (React.createElement(StyledWrapper, { "$invalid": invalid, "$readOnly": readOnly, "$style": style, "$suggestions": show_options && !!(suggestedValues === null || suggestedValues === void 0 ? void 0 : suggestedValues.length) },
|
|
1612
|
+
React.createElement(StyledInput, Object.assign({ "$height": height, "$invalid": invalid, "$readOnly": readOnly, "$showCharCount": showCharCount, max: max, maxLength: maxLength, min: min, onBlur: readOnly
|
|
1633
1613
|
? undefined
|
|
1634
1614
|
: e => {
|
|
1635
1615
|
if (onBlur)
|
|
@@ -1646,6 +1626,9 @@ const Input$1 = (_a) => {
|
|
|
1646
1626
|
if (onFocus)
|
|
1647
1627
|
onFocus(e);
|
|
1648
1628
|
}, onKeyDown: readOnly ? undefined : onKeyDown, placeholder: placeholder, step: step, type: type, value: formatted_value }, accessibleProps)),
|
|
1629
|
+
showCharCount ? (React.createElement(CharacterCount, null,
|
|
1630
|
+
value.length,
|
|
1631
|
+
maxLength ? ` / ${maxLength}` : null)) : null,
|
|
1649
1632
|
suffix && React.createElement(StyledSuffix, null, suffix),
|
|
1650
1633
|
show_options && (suggestedValues === null || suggestedValues === void 0 ? void 0 : suggestedValues.length) ? (React.createElement(SuggestedValues, null,
|
|
1651
1634
|
React.createElement(SuggestedSummary, null,
|
|
@@ -2045,8 +2028,9 @@ const Wrapper$2 = styled.label `
|
|
|
2045
2028
|
display: flex;
|
|
2046
2029
|
align-items: center;
|
|
2047
2030
|
font-size: ${FontSizes.DEFAULT};
|
|
2048
|
-
line-height: 1.
|
|
2031
|
+
line-height: 1.6em;
|
|
2049
2032
|
box-sizing: border-box;
|
|
2033
|
+
background: ${props => (props.$invalid ? `rgba(${Colors.RED.Rgb}, 0.05)` : 'transparent')};
|
|
2050
2034
|
|
|
2051
2035
|
&:focus-within {
|
|
2052
2036
|
background: ${props => `rgba(${props.theme.PRIMARY_COLOR.Rgb}, 0.05)`};
|
|
@@ -2055,8 +2039,9 @@ const Wrapper$2 = styled.label `
|
|
|
2055
2039
|
Wrapper$2.defaultProps = { theme: EditableTheme };
|
|
2056
2040
|
const Input = styled.input `
|
|
2057
2041
|
font-size: 20px;
|
|
2058
|
-
margin: 0px
|
|
2059
|
-
line-height: 1.
|
|
2042
|
+
margin: 0px;
|
|
2043
|
+
line-height: 1.6em;
|
|
2044
|
+
box-sizing: border-box;
|
|
2060
2045
|
`;
|
|
2061
2046
|
const Label = styled.span `
|
|
2062
2047
|
font-family: ${FontStyles.DEFAULT};
|
|
@@ -2067,8 +2052,8 @@ const Label = styled.span `
|
|
|
2067
2052
|
margin-left: 6px;
|
|
2068
2053
|
`;
|
|
2069
2054
|
const Radio = (_a) => {
|
|
2070
|
-
var { children, disabled, checked, onChange, value } = _a, accessibleProps = __rest(_a, ["children", "disabled", "checked", "onChange", "value"]);
|
|
2071
|
-
return (React.createElement(Wrapper$2, Object.assign({ "$disabled": disabled }, accessibleProps),
|
|
2055
|
+
var { children, disabled, checked, onChange, value, invalid } = _a, accessibleProps = __rest(_a, ["children", "disabled", "checked", "onChange", "value", "invalid"]);
|
|
2056
|
+
return (React.createElement(Wrapper$2, Object.assign({ "$disabled": disabled, "$invalid": invalid }, accessibleProps),
|
|
2072
2057
|
React.createElement(Input, { checked: checked, disabled: disabled, name: accessibleProps.name, onChange: disabled ? undefined : onChange, type: 'radio', value: value }),
|
|
2073
2058
|
React.createElement(Label, null, children)));
|
|
2074
2059
|
};
|