@dloizides/ui-forms 1.11.1 → 1.12.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/CHANGELOG.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # Changelog
2
2
 
3
- ## 1.11.0
3
+ ## 1.12.0
4
+
5
+ **`FormField` gained `labelHidden` — hide the visible label, keep the accessible name.**
6
+
7
+ A field whose placeholder already names it (a toolbar search box, an inline filter) does
8
+ not want a stacked visible label: the label wastes a row and, worse, pushes the input a
9
+ label-row lower than a bare button beside it, so the two misalign. Until now the only way
10
+ to drop the visible label was to blank `label` — which ALSO blanked the input's
11
+ `accessibilityLabel`, silently stripping the accessible name.
12
+
13
+ `labelHidden` removes ONLY the visible `<label>` row: `label` stays required and the input
14
+ keeps `accessibilityLabel={label}`, so a screen reader reads the same name and the field
15
+ still resolves by role + name. Additive and backward-compatible — default `false`, every
16
+ existing call renders unchanged.
17
+
18
+ ## 1.11.1
4
19
 
5
20
  **`ThemedTextInput` shipped no metrics, so every direct caller got a raw 19px input.**
6
21
 
package/dist/index.d.mts CHANGED
@@ -380,11 +380,22 @@ declare const FormActions: ({ onSave, onCancel, saveLabel, cancelLabel, saveHint
380
380
  */
381
381
  interface FormFieldProps extends Omit<TextInputProps, 'style'> {
382
382
  label: string;
383
+ /**
384
+ * Hide the VISIBLE label row while keeping the accessible name.
385
+ *
386
+ * For a field whose placeholder already names it (a toolbar search box, an inline
387
+ * filter) the stacked visible label both wastes a row and misaligns the input
388
+ * against a bare button beside it. Setting this drops ONLY the visible `<label>`:
389
+ * the input still carries `accessibilityLabel={label}`, so a screen reader reads
390
+ * the same name and `label` stays REQUIRED — you never lose the accessible name by
391
+ * blanking it, which is the trap this option exists to remove. Default `false`.
392
+ */
393
+ labelHidden?: boolean;
383
394
  required?: boolean;
384
395
  error?: string;
385
396
  containerStyle?: ViewStyle;
386
397
  }
387
- declare const FormField: ({ label, required, error, containerStyle, ...textInputProps }: FormFieldProps) => React.ReactElement;
398
+ declare const FormField: ({ label, labelHidden, required, error, containerStyle, ...textInputProps }: FormFieldProps) => React.ReactElement;
388
399
 
389
400
  /**
390
401
  * `ThemedTextInput` — the shared, readable + lively text-input primitive. A thin `<TextInput>`
package/dist/index.d.ts CHANGED
@@ -380,11 +380,22 @@ declare const FormActions: ({ onSave, onCancel, saveLabel, cancelLabel, saveHint
380
380
  */
381
381
  interface FormFieldProps extends Omit<TextInputProps, 'style'> {
382
382
  label: string;
383
+ /**
384
+ * Hide the VISIBLE label row while keeping the accessible name.
385
+ *
386
+ * For a field whose placeholder already names it (a toolbar search box, an inline
387
+ * filter) the stacked visible label both wastes a row and misaligns the input
388
+ * against a bare button beside it. Setting this drops ONLY the visible `<label>`:
389
+ * the input still carries `accessibilityLabel={label}`, so a screen reader reads
390
+ * the same name and `label` stays REQUIRED — you never lose the accessible name by
391
+ * blanking it, which is the trap this option exists to remove. Default `false`.
392
+ */
393
+ labelHidden?: boolean;
383
394
  required?: boolean;
384
395
  error?: string;
385
396
  containerStyle?: ViewStyle;
386
397
  }
387
- declare const FormField: ({ label, required, error, containerStyle, ...textInputProps }: FormFieldProps) => React.ReactElement;
398
+ declare const FormField: ({ label, labelHidden, required, error, containerStyle, ...textInputProps }: FormFieldProps) => React.ReactElement;
388
399
 
389
400
  /**
390
401
  * `ThemedTextInput` — the shared, readable + lively text-input primitive. A thin `<TextInput>`
package/dist/index.js CHANGED
@@ -612,23 +612,33 @@ var ThemedTextInput = React2__default.default.forwardRef(function ThemedTextInpu
612
612
  });
613
613
  var FormField = ({
614
614
  label,
615
+ labelHidden = false,
615
616
  required = false,
616
617
  error,
617
618
  containerStyle,
618
619
  ...textInputProps
619
- }) => /* @__PURE__ */ jsxRuntime.jsx(Field, { containerStyle, error, label, required, children: ({ describedById, hasError, controlId }) => /* @__PURE__ */ jsxRuntime.jsx(
620
- ThemedTextInput,
620
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
621
+ Field,
621
622
  {
622
- accessibilityHint: `Enter ${label}`,
623
- accessibilityLabel: label,
624
- describedById,
625
- hasError,
626
- id: controlId,
627
- requiredField: required,
628
- testID: "form-field-input",
629
- ...textInputProps
623
+ containerStyle,
624
+ error,
625
+ label: labelHidden ? void 0 : label,
626
+ required,
627
+ children: ({ describedById, hasError, controlId }) => /* @__PURE__ */ jsxRuntime.jsx(
628
+ ThemedTextInput,
629
+ {
630
+ accessibilityHint: `Enter ${label}`,
631
+ accessibilityLabel: label,
632
+ describedById,
633
+ hasError,
634
+ id: controlId,
635
+ requiredField: required,
636
+ testID: "form-field-input",
637
+ ...textInputProps
638
+ }
639
+ )
630
640
  }
631
- ) });
641
+ );
632
642
  var TRANSPARENT_COLOR = "transparent";
633
643
  var WHITE_COLOR = "#fff";
634
644
  var SOLID_RADIUS = 20;