react-native-ui-lib 8.1.8-snapshot.7613 → 8.1.8-snapshot.7616

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ui-lib",
3
- "version": "8.1.8-snapshot.7613",
3
+ "version": "8.1.8-snapshot.7616",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -78,6 +78,7 @@ const TextField = props => {
78
78
  readonly = false,
79
79
  showMandatoryIndication,
80
80
  clearButtonStyle,
81
+ accessibilityLabel: accessibilityLabelProp,
81
82
  ...others
82
83
  } = usePreset(props);
83
84
  const {
@@ -135,8 +136,28 @@ const TextField = props => {
135
136
  const hasValue = fieldState.value !== undefined; // NOTE: not pressable if centered without a value (so can't center placeholder)
136
137
  const inputStyle = useMemo(() => [typographyStyle, colorStyle, others.style, hasValue && centeredTextStyle], [typographyStyle, colorStyle, others.style, centeredTextStyle, hasValue]);
137
138
  const dummyPlaceholderStyle = useMemo(() => [inputStyle, styles.dummyPlaceholder], [inputStyle]);
139
+ const defaultAccessibilityLabel = useMemo(() => {
140
+ const parts = [];
141
+ if (label) {
142
+ parts.push(label);
143
+ }
144
+ if (context.isMandatory) {
145
+ parts.push('required');
146
+ }
147
+ parts.push('textField');
148
+ if (helperText) {
149
+ parts.push(helperText);
150
+ } else if (placeholder) {
151
+ parts.push(placeholder);
152
+ }
153
+ if (showCharCounter && others.maxLength) {
154
+ parts.push(`you can enter up to ${others.maxLength} characters`);
155
+ }
156
+ return parts.join(', ');
157
+ }, [label, context.isMandatory, helperText, placeholder, showCharCounter, others.maxLength]);
158
+ const accessibilityLabel = accessibilityLabelProp ?? defaultAccessibilityLabel;
138
159
  return <FieldContext.Provider value={context}>
139
- <View {...containerProps} style={[margins, positionStyle, containerStyle, centeredContainerStyle]}>
160
+ <View {...containerProps} accessible accessibilityLabel={accessibilityLabel} style={[margins, positionStyle, containerStyle, centeredContainerStyle]}>
140
161
  <View row spread style={centeredContainerStyle}>
141
162
  <Label label={label} labelColor={labelColor} labelStyle={_labelStyle} labelProps={labelProps} floatingPlaceholder={floatingPlaceholder} validationMessagePosition={validationMessagePosition} testID={`${props.testID}.label`} showMandatoryIndication={showMandatoryIndication} enableErrors={enableErrors} />
142
163
  {validationMessagePosition === ValidationMessagePosition.TOP && <ValidationMessage enableErrors={enableErrors} validate={others.validate} validationMessage={others.validationMessage} validationMessageStyle={_validationMessageStyle} retainValidationSpace={retainValidationSpace && retainTopMessageSpace} testID={`${props.testID}.validationMessage`} />}