@lumx/react 4.18.1-alpha.1 → 4.19.0-next.0

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/index.d.ts CHANGED
@@ -1987,8 +1987,6 @@ interface TextFieldProps$1 extends HasClassName, HasTheme, HasAriaDisabled, HasD
1987
1987
  labelProps?: InputLabelProps$1;
1988
1988
  /** Max string length the input accepts (constrains the input and displays a character counter). */
1989
1989
  maxLength?: number;
1990
- /** Character counter message formatter. Receives remaining character count, returns accessible label (e.g. \"{n} characters remaining\"). */
1991
- charCounterMessage?: (charCount: number) => string | JSXElement;
1992
1990
  /** Whether the text field is a textarea or an input. */
1993
1991
  multiline?: boolean;
1994
1992
  /** Placeholder text. */
@@ -2008,7 +2006,7 @@ interface TextFieldProps$1 extends HasClassName, HasTheme, HasAriaDisabled, HasD
2008
2006
  /** Ref to the component root. */
2009
2007
  ref?: CommonRef;
2010
2008
  }
2011
- type TextFieldPropsToOverride = 'input' | 'IconButton' | 'labelProps' | 'textFieldRef' | 'clearButtonProps' | 'charCounterMessage' | 'helperId' | 'errorId' | 'labelId' | 'isAnyDisabled' | 'isFocus';
2009
+ type TextFieldPropsToOverride = 'input' | 'IconButton' | 'labelProps' | 'textFieldRef' | 'clearButtonProps' | 'helperId' | 'errorId' | 'labelId' | 'isAnyDisabled' | 'isFocus';
2012
2010
 
2013
2011
  interface InputLabelProps extends ReactToJSX<InputLabelProps$1>, GenericProps$1 {
2014
2012
  }
@@ -2025,8 +2023,6 @@ declare const InputLabel: Comp<InputLabelProps, HTMLLabelElement>;
2025
2023
  * Defines the props of the component.
2026
2024
  */
2027
2025
  interface TextFieldProps extends GenericProps$1, ReactToJSX<TextFieldProps$1, TextFieldPropsToOverride> {
2028
- /** Character counter message formatter. Receives remaining character count, returns accessible label (e.g. \"{n} characters remaining\"). */
2029
- charCounterMessage?: (charCount: number) => string | ReactNode;
2030
2026
  /** Props to pass to the clear button (minus those already set by the TextField props). If not specified, the button won't be displayed. */
2031
2027
  clearButtonProps?: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;
2032
2028
  /** Reference to the <input> or <textarea> element. */
package/index.js CHANGED
@@ -7668,7 +7668,6 @@ const TextField$1 = props => {
7668
7668
  multiline,
7669
7669
  placeholder,
7670
7670
  textFieldRef,
7671
- charCounterMessage,
7672
7671
  helperId,
7673
7672
  errorId,
7674
7673
  labelId,
@@ -7682,15 +7681,6 @@ const TextField$1 = props => {
7682
7681
  } = props;
7683
7682
  const valueLength = (value || '').length;
7684
7683
  const isNotEmpty = valueLength > 0;
7685
- const remaining = maxLength ? maxLength - valueLength : 0;
7686
- const charCounter = maxLength ? /*#__PURE__*/jsxs("span", {
7687
- className: element$M('char-counter'),
7688
- role: "status",
7689
- children: [charCounterMessage ? charCounterMessage(remaining) : remaining, remaining === 0 && Icon$1({
7690
- icon: mdiAlertCircle,
7691
- size: Size.xxs
7692
- })]
7693
- }) : undefined;
7694
7684
  return /*#__PURE__*/jsxs("div", {
7695
7685
  ref: ref,
7696
7686
  className: classnames(className, block$$({
@@ -7708,17 +7698,25 @@ const TextField$1 = props => {
7708
7698
  'is-valid': isValid,
7709
7699
  [`theme-${theme}`]: Boolean(theme)
7710
7700
  })),
7711
- children: [(label || maxLength) && /*#__PURE__*/jsx("div", {
7701
+ children: [(label || maxLength) && /*#__PURE__*/jsxs("div", {
7712
7702
  className: element$M('header'),
7713
- children: InputLabel$1({
7703
+ children: [label && InputLabel$1({
7714
7704
  ...labelProps,
7715
7705
  id: labelId,
7716
7706
  htmlFor: textFieldId,
7717
7707
  className: element$M('label'),
7718
7708
  isRequired,
7719
7709
  theme,
7720
- children: [label, charCounter]
7721
- })
7710
+ children: label
7711
+ }), maxLength && /*#__PURE__*/jsxs("div", {
7712
+ className: element$M('char-counter'),
7713
+ children: [/*#__PURE__*/jsx("span", {
7714
+ children: maxLength - valueLength
7715
+ }), maxLength - valueLength === 0 && Icon$1({
7716
+ icon: mdiAlertCircle,
7717
+ size: Size.xxs
7718
+ })]
7719
+ })]
7722
7720
  }), /*#__PURE__*/jsxs("div", {
7723
7721
  className: element$M('wrapper'),
7724
7722
  ref: textFieldRef,
@@ -8019,7 +8017,6 @@ const TextField = forwardRef((props, ref) => {
8019
8017
  label,
8020
8018
  labelProps,
8021
8019
  maxLength,
8022
- charCounterMessage,
8023
8020
  minimumRows,
8024
8021
  multiline,
8025
8022
  name,
@@ -8119,7 +8116,6 @@ const TextField = forwardRef((props, ref) => {
8119
8116
  labelId,
8120
8117
  multiline,
8121
8118
  maxLength,
8122
- charCounterMessage,
8123
8119
  isRequired,
8124
8120
  errorId,
8125
8121
  placeholder,