@dloizides/ui-forms 1.9.0 → 1.9.1

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/index.mjs CHANGED
@@ -423,6 +423,16 @@ function useThemedInput(options = {}) {
423
423
  };
424
424
  }
425
425
  var IS_WEB2 = Platform.OS === "web";
426
+ function webFieldA11y({ describedById, hasError = false, required = false }) {
427
+ if (!IS_WEB2) {
428
+ return {};
429
+ }
430
+ return {
431
+ "aria-invalid": hasError ? true : void 0,
432
+ "aria-describedby": describedById,
433
+ "aria-required": required ? true : void 0
434
+ };
435
+ }
426
436
  var ThemedTextInput = React.forwardRef(function ThemedTextInput2({ hasError = false, describedById, requiredField = false, onFocus, onBlur, style, placeholderTextColor, ...rest }, ref) {
427
437
  const {
428
438
  style: themedStyle,
@@ -430,11 +440,7 @@ var ThemedTextInput = React.forwardRef(function ThemedTextInput2({ hasError = fa
430
440
  focusBind,
431
441
  hoverBind
432
442
  } = useThemedInput({ hasError, onFocus, onBlur });
433
- const webA11y = IS_WEB2 ? {
434
- "aria-invalid": hasError ? true : void 0,
435
- "aria-describedby": describedById,
436
- "aria-required": requiredField ? true : void 0
437
- } : {};
443
+ const webA11y = webFieldA11y({ describedById, hasError, required: requiredField });
438
444
  return /* @__PURE__ */ jsx(
439
445
  TextInput,
440
446
  {
@@ -616,11 +622,6 @@ function SolidChip({
616
622
  }
617
623
  );
618
624
  }
619
- var IS_WEB3 = Platform.OS === "web";
620
- function groupA11yProps(describedById, hasError) {
621
- if (!IS_WEB3) return {};
622
- return { "aria-invalid": hasError ? true : void 0, "aria-describedby": describedById };
623
- }
624
625
  var ChipSelector = ({
625
626
  label,
626
627
  options,
@@ -682,7 +683,7 @@ var ChipSelector = ({
682
683
  required,
683
684
  spacing,
684
685
  testID,
685
- children: ({ describedById, hasError }) => /* @__PURE__ */ jsx(View, { style: styles6.chipContainer, ...groupA11yProps(describedById, hasError), children: options.map(renderChip) })
686
+ children: ({ describedById, hasError }) => /* @__PURE__ */ jsx(View, { style: styles6.chipContainer, ...webFieldA11y({ describedById, hasError }), children: options.map(renderChip) })
686
687
  }
687
688
  );
688
689
  };
@@ -928,13 +929,13 @@ var controlStyles = StyleSheet.create({
928
929
  optionText: { fontSize: OPTION_FONT },
929
930
  error: { fontSize: ERROR_FONT, marginTop: ERROR_GAP }
930
931
  });
931
- var IS_WEB4 = typeof document !== "undefined";
932
+ var IS_WEB3 = typeof document !== "undefined";
932
933
  var ESCAPE_KEY = "Escape";
933
934
  var ACTIVE_WEIGHT = "700";
934
935
  var IDLE_WEIGHT = "400";
935
936
  function useDismiss(anchorRef, menuRef, onDismiss) {
936
937
  useEffect(() => {
937
- if (!IS_WEB4) return void 0;
938
+ if (!IS_WEB3) return void 0;
938
939
  const onMouseDown = (event) => {
939
940
  const anchorNode = anchorRef.current;
940
941
  const menuNode = menuRef.current;