@dloizides/ui-forms 1.23.1 → 1.24.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
@@ -2250,6 +2250,18 @@ function useFocusFirstInvalid(refs) {
2250
2250
  first?.focus();
2251
2251
  }, []);
2252
2252
  }
2253
+ function isScrollable(node) {
2254
+ return "scrollIntoView" in Object(node);
2255
+ }
2256
+ function useKeepInView(trigger) {
2257
+ const ref = useRef(null);
2258
+ useEffect(() => {
2259
+ const node = ref.current;
2260
+ const hasTrigger = trigger !== void 0 && trigger !== null;
2261
+ if (hasTrigger && isScrollable(node)) node.scrollIntoView({ block: "nearest" });
2262
+ }, [trigger]);
2263
+ return ref;
2264
+ }
2253
2265
  var DEFAULT_PREVIEW_PX = 48;
2254
2266
  var PREVIEW_RADIUS = 8;
2255
2267
  var GAP = 8;
@@ -2315,6 +2327,6 @@ var UploadWithLinkField = ({
2315
2327
  ] });
2316
2328
  };
2317
2329
 
2318
- export { AlignToControl, AnchoredMenu, ChipSelector, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeControl, Field, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStatusLine, FormSwitch, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, SelectControl, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, controlStyles, groupAriaChecked, inlineFieldRowLayout, isUnmatched, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useRecentValues, useThemedInput };
2330
+ export { AlignToControl, AnchoredMenu, ChipSelector, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeControl, Field, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStatusLine, FormSwitch, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, SelectControl, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, controlStyles, groupAriaChecked, inlineFieldRowLayout, isUnmatched, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
2319
2331
  //# sourceMappingURL=index.mjs.map
2320
2332
  //# sourceMappingURL=index.mjs.map