@lumx/react 4.11.0-next.4 → 4.11.0-next.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/index.d.ts +5 -1
- package/index.js +11 -4
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -1781,6 +1781,8 @@ interface InputLabelProps$1 extends HasClassName, HasTheme {
|
|
|
1781
1781
|
children: JSXElement;
|
|
1782
1782
|
/** Native htmlFor property. */
|
|
1783
1783
|
htmlFor: string;
|
|
1784
|
+
/** Native id property. */
|
|
1785
|
+
id?: string;
|
|
1784
1786
|
/** Whether the component is required or not. */
|
|
1785
1787
|
isRequired?: boolean;
|
|
1786
1788
|
/** ref to the root element */
|
|
@@ -1813,6 +1815,8 @@ interface TextFieldProps$1 extends HasClassName, HasTheme, HasAriaDisabled, HasD
|
|
|
1813
1815
|
helperId?: string;
|
|
1814
1816
|
/** Generated error id for accessibility attributes. */
|
|
1815
1817
|
errorId?: string;
|
|
1818
|
+
/** Generated label id for accessibility attributes (used to link the clear button to the field label). */
|
|
1819
|
+
labelId?: string;
|
|
1816
1820
|
/** Whether the component is required or not. */
|
|
1817
1821
|
isRequired?: boolean;
|
|
1818
1822
|
/** Whether the text field is displayed with valid style or not. */
|
|
@@ -1842,7 +1846,7 @@ interface TextFieldProps$1 extends HasClassName, HasTheme, HasAriaDisabled, HasD
|
|
|
1842
1846
|
/** Ref to the component root. */
|
|
1843
1847
|
ref?: CommonRef;
|
|
1844
1848
|
}
|
|
1845
|
-
type TextFieldPropsToOverride = 'input' | 'IconButton' | 'labelProps' | 'textFieldRef' | 'clearButtonProps' | 'helperId' | 'errorId' | 'isAnyDisabled' | 'isFocus';
|
|
1849
|
+
type TextFieldPropsToOverride = 'input' | 'IconButton' | 'labelProps' | 'textFieldRef' | 'clearButtonProps' | 'helperId' | 'errorId' | 'labelId' | 'isAnyDisabled' | 'isFocus';
|
|
1846
1850
|
|
|
1847
1851
|
/**
|
|
1848
1852
|
* Defines the props of the component.
|
package/index.js
CHANGED
|
@@ -7107,15 +7107,17 @@ const {
|
|
|
7107
7107
|
* @param existingAriaDescribedBy Existing aria-describedby value to merge
|
|
7108
7108
|
* @return Object containing helperId, errorId, and combined describedById
|
|
7109
7109
|
*/
|
|
7110
|
-
function generateAccessibilityIds(helper, error, generatedId, existingAriaDescribedBy) {
|
|
7110
|
+
function generateAccessibilityIds(helper, error, generatedId, existingAriaDescribedBy, label) {
|
|
7111
7111
|
const helperId = helper ? `text-field-helper-${generatedId}` : undefined;
|
|
7112
7112
|
const errorId = error ? `text-field-error-${generatedId}` : undefined;
|
|
7113
|
+
const labelId = label ? `text-field-label-${generatedId}` : undefined;
|
|
7113
7114
|
const describedByIds = [errorId, helperId, existingAriaDescribedBy].filter(Boolean);
|
|
7114
7115
|
const describedById = describedByIds.length === 0 ? undefined : describedByIds.join(' ');
|
|
7115
7116
|
return {
|
|
7116
7117
|
helperId,
|
|
7117
7118
|
errorId,
|
|
7118
|
-
describedById
|
|
7119
|
+
describedById,
|
|
7120
|
+
labelId
|
|
7119
7121
|
};
|
|
7120
7122
|
}
|
|
7121
7123
|
|
|
@@ -7148,6 +7150,7 @@ const TextField$1 = props => {
|
|
|
7148
7150
|
textFieldRef,
|
|
7149
7151
|
helperId,
|
|
7150
7152
|
errorId,
|
|
7153
|
+
labelId,
|
|
7151
7154
|
theme,
|
|
7152
7155
|
value,
|
|
7153
7156
|
afterElement,
|
|
@@ -7179,6 +7182,7 @@ const TextField$1 = props => {
|
|
|
7179
7182
|
className: element$K('header'),
|
|
7180
7183
|
children: [label && InputLabel$1({
|
|
7181
7184
|
...labelProps,
|
|
7185
|
+
id: labelId,
|
|
7182
7186
|
htmlFor: textFieldId,
|
|
7183
7187
|
className: element$K('label'),
|
|
7184
7188
|
isRequired,
|
|
@@ -7213,6 +7217,7 @@ const TextField$1 = props => {
|
|
|
7213
7217
|
icon: isValid ? mdiCheckCircle : mdiAlertCircle,
|
|
7214
7218
|
size: Size.xxs
|
|
7215
7219
|
}), clearButtonProps && isNotEmpty && !isAnyDisabled && /*#__PURE__*/jsx(IconButton, {
|
|
7220
|
+
"aria-describedby": labelId,
|
|
7216
7221
|
...clearButtonProps,
|
|
7217
7222
|
className: element$K('input-clear'),
|
|
7218
7223
|
icon: mdiCloseCircle,
|
|
@@ -7500,8 +7505,9 @@ const TextField = forwardRef((props, ref) => {
|
|
|
7500
7505
|
const {
|
|
7501
7506
|
helperId,
|
|
7502
7507
|
errorId,
|
|
7503
|
-
describedById
|
|
7504
|
-
|
|
7508
|
+
describedById,
|
|
7509
|
+
labelId
|
|
7510
|
+
} = generateAccessibilityIds(helper, error, generatedTextFieldId, forwardedProps['aria-describedby'], label);
|
|
7505
7511
|
const [isFocus, setFocus] = useState(false);
|
|
7506
7512
|
|
|
7507
7513
|
/**
|
|
@@ -7571,6 +7577,7 @@ const TextField = forwardRef((props, ref) => {
|
|
|
7571
7577
|
afterElement,
|
|
7572
7578
|
hasError,
|
|
7573
7579
|
helperId,
|
|
7580
|
+
labelId,
|
|
7574
7581
|
multiline,
|
|
7575
7582
|
maxLength,
|
|
7576
7583
|
isRequired,
|