@dloizides/ui-forms 1.18.6 → 1.18.7

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
@@ -2,10 +2,10 @@ import React2, { useState, useCallback, useMemo, useEffect, useRef, useLayoutEff
2
2
  import { Platform, StyleSheet, TextInput, View, Text, ScrollView, Pressable, Switch, TouchableOpacity } from 'react-native';
3
3
  import { useUi } from '@dloizides/ui-feedback';
4
4
  import { jsx, jsxs } from 'react/jsx-runtime';
5
- import { Button } from '@dloizides/ui-buttons';
5
+ import { themeFocusRingColor, Button } from '@dloizides/ui-buttons';
6
6
  import { createPortal } from 'react-dom';
7
7
  import { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';
8
- import { Z_INDEX } from '@dloizides/design-tokens';
8
+ import { Z_INDEX, focusRingOutline } from '@dloizides/design-tokens';
9
9
 
10
10
  // src/Field/Field.tsx
11
11
  function attachControlId(child, candidateId, describedById) {
@@ -604,8 +604,7 @@ var IS_WEB5 = Platform.OS === "web";
604
604
  var TRANSITION_PROPERTY = "border-color, background-color, box-shadow";
605
605
  var TRANSITION_DURATION = "0.14s";
606
606
  var TRANSITION_TIMING = "ease";
607
- var FOCUS_RING_WIDTH = 3;
608
- var FOCUS_RING_ALPHA = 0.16;
607
+ var NO_RING = { outlineWidth: 0 };
609
608
  var HOVER_BORDER_ALPHA = 0.22;
610
609
  var PLACEHOLDER_ALPHA = 0.6;
611
610
  var HEX_RADIX = 16;
@@ -660,15 +659,14 @@ function useThemedInput(options = {}) {
660
659
  const backgroundColor = isFocused ? colors.surface : colors.surfaceElevated;
661
660
  const base = { color: colors.text, borderColor, backgroundColor };
662
661
  if (!IS_WEB5) return base;
663
- const ringColor = hasError ? errorColor : primary;
664
- const ring = isFocused ? `0 0 0 ${FOCUS_RING_WIDTH}px ${withAlpha(ringColor, FOCUS_RING_ALPHA)}` : "none";
662
+ const ringColor = hasError ? errorColor : themeFocusRingColor(theme);
663
+ const ring = isFocused ? focusRingOutline(ringColor) : NO_RING;
665
664
  const webStyle = {
666
665
  transitionProperty: TRANSITION_PROPERTY,
667
666
  // Collapse the eased transition to instant when the user prefers reduced motion.
668
667
  transitionDuration: prefersReducedMotion() ? "0s" : TRANSITION_DURATION,
669
668
  transitionTimingFunction: TRANSITION_TIMING,
670
- boxShadow: ring,
671
- outlineStyle: "none"
669
+ ...ring
672
670
  };
673
671
  return { ...base, ...webStyle };
674
672
  }, [
@@ -680,7 +678,8 @@ function useThemedInput(options = {}) {
680
678
  colors.surface,
681
679
  colors.surfaceElevated,
682
680
  primary,
683
- errorColor
681
+ errorColor,
682
+ theme
684
683
  ]);
685
684
  const focusBind = useMemo(() => ({ onFocus: handleFocus, onBlur: handleBlur }), [handleFocus, handleBlur]);
686
685
  const hoverBind = useMemo(