@dloizides/ui-forms 1.37.0 → 1.38.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/dist/index.mjs CHANGED
@@ -2865,7 +2865,7 @@ var VALUE_GAP = 8;
2865
2865
  var MIN_TOUCH = 44;
2866
2866
  var NOTHING_ON_CLOSE = () => void 0;
2867
2867
  function SearchSelect(props) {
2868
- const { options, value, onChange, accessibilityLabel, accessibilityHint, labels, testID, recentKey, renderLeading, renderDetail, renderTrigger } = props;
2868
+ const { options, value, onChange, accessibilityLabel, accessibilityHint, labels, testID, recentKey, renderLeading, renderDetail, renderTrigger, onBlur } = props;
2869
2869
  const { theme } = useUi();
2870
2870
  const { colors } = theme;
2871
2871
  const triggerRef = useRef(null);
@@ -2877,6 +2877,11 @@ function SearchSelect(props) {
2877
2877
  useRefocusOnClose(state.open, triggerRef);
2878
2878
  const selected = findOption(options, value);
2879
2879
  const onPress = state.open ? state.close : state.openList;
2880
+ const openRef = useRef(state.open);
2881
+ openRef.current = state.open;
2882
+ const onTriggerBlur = useCallback(() => {
2883
+ if (!openRef.current) onBlur?.();
2884
+ }, [onBlur]);
2880
2885
  return /* @__PURE__ */ jsxs(View, { ref: anchorRef, style: styles23.anchor, children: [
2881
2886
  /* @__PURE__ */ jsx(
2882
2887
  Pressable,
@@ -2888,6 +2893,7 @@ function SearchSelect(props) {
2888
2893
  accessibilityState: { expanded: state.open },
2889
2894
  style: renderTrigger === void 0 ? [controlStyles.selectTrigger, { borderColor: colors.border, backgroundColor: colors.surfaceElevated }] : styles23.customTrigger,
2890
2895
  testID,
2896
+ onBlur: onTriggerBlur,
2891
2897
  onPress,
2892
2898
  children: renderTrigger !== void 0 ? renderTrigger({ open: state.open, selected, onPress, ref: triggerRef }) : /* @__PURE__ */ jsx(FieldBoxContent, { colors, placeholder: labels.placeholder, renderDetail, renderLeading, selected })
2893
2899
  }
@@ -3683,7 +3689,7 @@ function toCountryValue(input) {
3683
3689
  var CODE_FONT = 12;
3684
3690
  var NO_COUNTRY2 = "";
3685
3691
  var renderFlag = (option) => option.value === NO_COUNTRY2 ? null : /* @__PURE__ */ jsx(CountryFlag, { code: option.value });
3686
- function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries, noneLabel }) {
3692
+ function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries, noneLabel, onBlur }) {
3687
3693
  const { theme } = useUi();
3688
3694
  const { textSecondary } = theme.colors;
3689
3695
  const options = useMemo(() => countryFieldOptions(countries, noneLabel), [countries, noneLabel]);
@@ -3700,6 +3706,7 @@ function CountryField({ value, onChange, accessibilityLabel, accessibilityHint,
3700
3706
  renderLeading: renderFlag,
3701
3707
  testID,
3702
3708
  value: toCountryValue(value),
3709
+ onBlur,
3703
3710
  onChange
3704
3711
  }
3705
3712
  );