@doist/reactist 27.2.2 → 27.3.5
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/reactist.cjs.development.js +35 -15
- package/dist/reactist.cjs.development.js.map +1 -1
- package/dist/reactist.cjs.production.min.js +1 -1
- package/dist/reactist.cjs.production.min.js.map +1 -1
- package/es/base-field/base-field.js +24 -7
- package/es/base-field/base-field.js.map +1 -1
- package/es/select-field/select-field.js.map +1 -1
- package/es/text-field/text-field.js +10 -7
- package/es/text-field/text-field.js.map +1 -1
- package/es/text-field/text-field.module.css.js +1 -1
- package/lib/base-field/base-field.d.ts +13 -2
- package/lib/base-field/base-field.js +1 -1
- package/lib/base-field/base-field.js.map +1 -1
- package/lib/select-field/select-field.d.ts +1 -1
- package/lib/select-field/select-field.js.map +1 -1
- package/lib/text-field/text-field.d.ts +2 -2
- package/lib/text-field/text-field.js +1 -1
- package/lib/text-field/text-field.js.map +1 -1
- package/lib/text-field/text-field.module.css.js +1 -1
- package/package.json +1 -1
- package/styles/index.css +2 -3
- package/styles/password-field.css +1 -1
- package/styles/reactist.css +1 -1
- package/styles/text-field.css +1 -1
- package/styles/text-field.module.css.css +1 -1
|
@@ -1905,7 +1905,9 @@ function PasswordHiddenIcon(props) {
|
|
|
1905
1905
|
|
|
1906
1906
|
var modules_540a88ff = {"container":"d5ff04da","auxiliaryLabel":"_8d2b52f1","bordered":"_49c37b27","error":"_922ff337","primaryLabel":"af23c791","loadingIcon":"_75edcef6"};
|
|
1907
1907
|
|
|
1908
|
-
|
|
1908
|
+
// See: https://twist.com/a/1585/ch/765851/t/6664583/c/93631846 for latest spec
|
|
1909
|
+
|
|
1910
|
+
const MAX_LENGTH_THRESHOLD = 0;
|
|
1909
1911
|
|
|
1910
1912
|
function fieldToneToTextTone(tone) {
|
|
1911
1913
|
return tone === 'error' ? 'danger' : tone === 'success' ? 'positive' : 'secondary';
|
|
@@ -1959,6 +1961,10 @@ function validateInputLength({
|
|
|
1959
1961
|
tone: isNearMaxLength ? 'error' : 'neutral'
|
|
1960
1962
|
};
|
|
1961
1963
|
}
|
|
1964
|
+
/**
|
|
1965
|
+
* BaseField is a base component that provides a consistent structure for form fields.
|
|
1966
|
+
*/
|
|
1967
|
+
|
|
1962
1968
|
|
|
1963
1969
|
function BaseField({
|
|
1964
1970
|
variant = 'default',
|
|
@@ -1973,7 +1979,8 @@ function BaseField({
|
|
|
1973
1979
|
maxLength,
|
|
1974
1980
|
hidden,
|
|
1975
1981
|
'aria-describedby': originalAriaDescribedBy,
|
|
1976
|
-
id: originalId
|
|
1982
|
+
id: originalId,
|
|
1983
|
+
characterCountPosition = 'below'
|
|
1977
1984
|
}) {
|
|
1978
1985
|
const id = useId(originalId);
|
|
1979
1986
|
const messageId = useId();
|
|
@@ -1984,6 +1991,16 @@ function BaseField({
|
|
|
1984
1991
|
const [characterCount, setCharacterCount] = React__namespace.useState(inputLength.count);
|
|
1985
1992
|
const [characterCountTone, setCharacterCountTone] = React__namespace.useState(inputLength.tone);
|
|
1986
1993
|
const ariaDescribedBy = originalAriaDescribedBy != null ? originalAriaDescribedBy : message ? messageId : null;
|
|
1994
|
+
/**
|
|
1995
|
+
* Renders the character count element.
|
|
1996
|
+
* If the characterCountPosition value is 'hidden', it returns null.
|
|
1997
|
+
*/
|
|
1998
|
+
|
|
1999
|
+
function renderCharacterCount() {
|
|
2000
|
+
return characterCountPosition !== 'hidden' ? /*#__PURE__*/React__namespace.createElement(FieldCharacterCount, {
|
|
2001
|
+
tone: characterCountTone
|
|
2002
|
+
}, characterCount) : null;
|
|
2003
|
+
}
|
|
1987
2004
|
|
|
1988
2005
|
const childrenProps = _objectSpread2(_objectSpread2({
|
|
1989
2006
|
id,
|
|
@@ -2004,8 +2021,10 @@ function BaseField({
|
|
|
2004
2021
|
});
|
|
2005
2022
|
setCharacterCount(inputLength.count);
|
|
2006
2023
|
setCharacterCountTone(inputLength.tone);
|
|
2007
|
-
}
|
|
2024
|
+
},
|
|
2008
2025
|
|
|
2026
|
+
// If the character count is inline, we pass it as a prop to the children element so it can be rendered inline
|
|
2027
|
+
characterCountElement: characterCountPosition === 'inline' ? renderCharacterCount() : null
|
|
2009
2028
|
});
|
|
2010
2029
|
|
|
2011
2030
|
React__namespace.useEffect(function updateCharacterCountOnPropChange() {
|
|
@@ -2049,17 +2068,15 @@ function BaseField({
|
|
|
2049
2068
|
}, /*#__PURE__*/React__namespace.createElement(FieldMessage, {
|
|
2050
2069
|
id: messageId,
|
|
2051
2070
|
tone: tone
|
|
2052
|
-
}, message)) : null,
|
|
2071
|
+
}, message)) : null, characterCountPosition === 'below' ? /*#__PURE__*/React__namespace.createElement(Column, {
|
|
2053
2072
|
width: "content"
|
|
2054
|
-
},
|
|
2055
|
-
tone: characterCountTone
|
|
2056
|
-
}, characterCount)) : null) : null);
|
|
2073
|
+
}, renderCharacterCount()) : null) : null);
|
|
2057
2074
|
}
|
|
2058
2075
|
|
|
2059
|
-
var modules_aaf25250 = {"inputWrapper":"
|
|
2076
|
+
var modules_aaf25250 = {"inputWrapper":"c8f65b3b","readOnly":"_326f2644","bordered":"_5252fd3d","error":"_0141b7ac","slot":"b79b851f"};
|
|
2060
2077
|
|
|
2061
|
-
const _excluded$d = ["variant", "id", "label", "value", "auxiliaryLabel", "message", "tone", "type", "maxWidth", "maxLength", "hidden", "aria-describedby", "startSlot", "endSlot", "onChange"],
|
|
2062
|
-
_excluded2$4 = ["onChange"];
|
|
2078
|
+
const _excluded$d = ["variant", "id", "label", "value", "auxiliaryLabel", "message", "tone", "type", "maxWidth", "maxLength", "hidden", "aria-describedby", "startSlot", "endSlot", "onChange", "characterCountPosition"],
|
|
2079
|
+
_excluded2$4 = ["onChange", "characterCountElement"];
|
|
2063
2080
|
const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_ref, ref) {
|
|
2064
2081
|
let {
|
|
2065
2082
|
variant = 'default',
|
|
@@ -2076,7 +2093,8 @@ const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_r
|
|
|
2076
2093
|
'aria-describedby': ariaDescribedBy,
|
|
2077
2094
|
startSlot,
|
|
2078
2095
|
endSlot,
|
|
2079
|
-
onChange: originalOnChange
|
|
2096
|
+
onChange: originalOnChange,
|
|
2097
|
+
characterCountPosition = 'below'
|
|
2080
2098
|
} = _ref,
|
|
2081
2099
|
props = _objectWithoutProperties(_ref, _excluded$d);
|
|
2082
2100
|
|
|
@@ -2101,10 +2119,12 @@ const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_r
|
|
|
2101
2119
|
maxWidth: maxWidth,
|
|
2102
2120
|
maxLength: maxLength,
|
|
2103
2121
|
hidden: hidden,
|
|
2104
|
-
"aria-describedby": ariaDescribedBy
|
|
2122
|
+
"aria-describedby": ariaDescribedBy,
|
|
2123
|
+
characterCountPosition: characterCountPosition
|
|
2105
2124
|
}, _ref2 => {
|
|
2106
2125
|
let {
|
|
2107
|
-
onChange
|
|
2126
|
+
onChange,
|
|
2127
|
+
characterCountElement
|
|
2108
2128
|
} = _ref2,
|
|
2109
2129
|
extraProps = _objectWithoutProperties(_ref2, _excluded2$4);
|
|
2110
2130
|
|
|
@@ -2126,12 +2146,12 @@ const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_r
|
|
|
2126
2146
|
originalOnChange == null ? void 0 : originalOnChange(event);
|
|
2127
2147
|
onChange == null ? void 0 : onChange(event);
|
|
2128
2148
|
}
|
|
2129
|
-
})), endSlot ? /*#__PURE__*/React__namespace.createElement(Box$1, {
|
|
2149
|
+
})), endSlot || characterCountElement ? /*#__PURE__*/React__namespace.createElement(Box$1, {
|
|
2130
2150
|
className: modules_aaf25250.slot,
|
|
2131
2151
|
display: "flex",
|
|
2132
2152
|
marginRight: variant === 'bordered' ? '-xsmall' : 'xsmall',
|
|
2133
2153
|
marginLeft: variant === 'bordered' ? 'xsmall' : '-xsmall'
|
|
2134
|
-
}, endSlot) : null);
|
|
2154
|
+
}, characterCountElement, endSlot) : null);
|
|
2135
2155
|
});
|
|
2136
2156
|
});
|
|
2137
2157
|
|