@vuu-ui/vuu-ui-controls 0.8.14-debug → 0.8.15-debug

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/cjs/index.js CHANGED
@@ -490,7 +490,7 @@ var useCollectionItems = ({
490
490
  // revealSelected = false,
491
491
  source
492
492
  }) => {
493
- var _a2;
493
+ var _a2, _b;
494
494
  const { getItemId } = options;
495
495
  const [, forceUpdate] = (0, import_react4.useState)(null);
496
496
  const inheritedCollectionHook = useCollection();
@@ -498,6 +498,7 @@ var useCollectionItems = ({
498
498
  const flattenedDataRef = (0, import_react4.useRef)([]);
499
499
  const EMPTY_COLLECTION = (0, import_react4.useMemo)(() => [], []);
500
500
  const filterPattern = (0, import_react4.useRef)((_a2 = options.filterPattern) != null ? _a2 : "");
501
+ const disableFilter = (_b = options.disableFilter) != null ? _b : false;
501
502
  const {
502
503
  getFilterRegex = getDefaultFilterRegex,
503
504
  noChildrenLabel,
@@ -509,14 +510,14 @@ var useCollectionItems = ({
509
510
  const addMetadataToItems = (0, import_react4.useCallback)(
510
511
  (items, indexer, level = 1, path = "", results = [], flattenedCollection2 = [], flattenedSource2 = []) => {
511
512
  items.forEach((item, i, all) => {
512
- var _a3, _b;
513
+ var _a3, _b2;
513
514
  const isCollapsibleHeader = item.header && options.collapsibleHeaders;
514
515
  const isNonCollapsibleGroupNode = item.childNodes && options.collapsibleHeaders === false;
515
516
  const isLeaf3 = !item.childNodes || item.childNodes.length === 0;
516
517
  const nonCollapsible = isNonCollapsibleGroupNode || isLeaf3 && !isCollapsibleHeader;
517
518
  const childPath = path ? `${path}.${i}` : `item-${i}`;
518
519
  const id = (_a3 = item.id) != null ? _a3 : getItemId ? getItemId(i) : `${idRoot}-${childPath}`;
519
- const expanded = nonCollapsible ? void 0 : (_b = item.expanded) != null ? _b : isExpanded2();
520
+ const expanded = nonCollapsible ? void 0 : (_b2 = item.expanded) != null ? _b2 : isExpanded2();
520
521
  const normalisedItem = {
521
522
  ...item,
522
523
  childNodes: void 0,
@@ -551,12 +552,12 @@ var useCollectionItems = ({
551
552
  [options.collapsibleHeaders, getItemId, idRoot, isExpanded2]
552
553
  );
553
554
  const getFilter = (0, import_react4.useCallback)(() => {
554
- if (filterPattern.current) {
555
+ if (filterPattern.current && !disableFilter) {
555
556
  return getDefaultFilter(filterPattern.current, getFilterRegex);
556
557
  } else {
557
558
  return null;
558
559
  }
559
- }, [getFilterRegex]);
560
+ }, [disableFilter, getFilterRegex]);
560
561
  const collectVisibleItems = (0, import_react4.useCallback)(
561
562
  (items, filter = getFilter(), results = [], idx = { value: 0 }) => {
562
563
  let skipToNextHeader = false;
@@ -5435,6 +5436,7 @@ var import_vuu_layout6 = require("@vuu-ui/vuu-layout");
5435
5436
  var import_react38 = require("react");
5436
5437
  var EnterOnly = ["Enter"];
5437
5438
  var useCombobox = ({
5439
+ allowBackspaceClearsSelection,
5438
5440
  allowFreeText,
5439
5441
  ariaLabel,
5440
5442
  collectionHook,
@@ -5444,6 +5446,7 @@ var useCombobox = ({
5444
5446
  onBlur,
5445
5447
  onFocus,
5446
5448
  onChange,
5449
+ onDeselect,
5447
5450
  onSelect,
5448
5451
  id,
5449
5452
  initialHighlightedIndex = -1,
@@ -5456,6 +5459,7 @@ var useCombobox = ({
5456
5459
  onSelectionChange,
5457
5460
  onSetSelectedText,
5458
5461
  selected: selectedProp,
5462
+ selectionKeys = EnterOnly,
5459
5463
  selectionStrategy,
5460
5464
  value: valueProp,
5461
5465
  InputProps: inputProps = {
@@ -5466,7 +5470,7 @@ var useCombobox = ({
5466
5470
  }
5467
5471
  }) => {
5468
5472
  const isMultiSelect = isMultiSelection(selectionStrategy);
5469
- const { setFilterPattern } = collectionHook;
5473
+ const { data, setFilterPattern } = collectionHook;
5470
5474
  const setHighlightedIndexRef = (0, import_react38.useRef)(null);
5471
5475
  const selectedRef = (0, import_react38.useRef)(isMultiSelect ? [] : null);
5472
5476
  const ignoreSelectOnFocus = (0, import_react38.useRef)(true);
@@ -5485,7 +5489,6 @@ var useCombobox = ({
5485
5489
  const highlightSelectedItem = (0, import_react38.useCallback)((selected2) => {
5486
5490
  var _a2;
5487
5491
  if (Array.isArray(selected2)) {
5488
- console.log("TODO multi selection");
5489
5492
  } else if (selected2 == null) {
5490
5493
  (_a2 = setHighlightedIndexRef.current) == null ? void 0 : _a2.call(setHighlightedIndexRef, -1);
5491
5494
  }
@@ -5583,7 +5586,7 @@ var useCombobox = ({
5583
5586
  setTextValue("", false);
5584
5587
  }
5585
5588
  setIsOpen(open);
5586
- onOpenChange == null ? void 0 : onOpenChange(open);
5589
+ onOpenChange == null ? void 0 : onOpenChange(open, closeReason);
5587
5590
  if (!open && closeReason !== "Escape") {
5588
5591
  if (!selectFreeTextInputValue()) {
5589
5592
  applySelection();
@@ -5626,11 +5629,11 @@ var useCombobox = ({
5626
5629
  disableAriaActiveDescendant,
5627
5630
  disableHighlightOnFocus: true,
5628
5631
  disableTypeToSelect: true,
5632
+ label: "combobox",
5629
5633
  onKeyboardNavigation: handleKeyboardNavigation,
5630
- // onKeyDown: handleInputKeyDown,
5631
5634
  onSelectionChange: handleSelectionChange,
5632
5635
  selected: collectionHook.itemToCollectionItemId(selectedProp),
5633
- selectionKeys: EnterOnly,
5636
+ selectionKeys,
5634
5637
  selectionStrategy,
5635
5638
  tabToSelect: !isMultiSelect
5636
5639
  });
@@ -5657,6 +5660,15 @@ var useCombobox = ({
5657
5660
  },
5658
5661
  [setFilterPattern, setIsOpen, setValue]
5659
5662
  );
5663
+ const handleInputKeyDown = (0, import_react38.useCallback)(
5664
+ (e) => {
5665
+ if (e.key === "Backspace" && allowBackspaceClearsSelection) {
5666
+ selectedRef.current = null;
5667
+ onDeselect == null ? void 0 : onDeselect();
5668
+ }
5669
+ },
5670
+ [allowBackspaceClearsSelection, onDeselect]
5671
+ );
5660
5672
  const { onFocus: inputOnFocus = onFocus } = inputProps;
5661
5673
  const { onFocus: listOnFocus } = listControlProps;
5662
5674
  const handleInputFocus = (0, import_react38.useCallback)(
@@ -5718,7 +5730,8 @@ var useCombobox = ({
5718
5730
  ...inputProps.inputProps,
5719
5731
  // "aria-owns": listId,
5720
5732
  "aria-label": ariaLabel,
5721
- autoComplete: "off"
5733
+ autoComplete: "off",
5734
+ onKeyDown: handleInputKeyDown
5722
5735
  };
5723
5736
  return {
5724
5737
  focusVisible,
@@ -5765,12 +5778,14 @@ var ComboBox = (0, import_react39.forwardRef)(function Combobox({
5765
5778
  PopupProps,
5766
5779
  ListItem: ListItem4,
5767
5780
  "aria-label": ariaLabel,
5781
+ allowBackspaceClearsSelection,
5768
5782
  allowFreeText,
5769
5783
  children,
5770
5784
  defaultIsOpen,
5771
5785
  defaultSelected,
5772
5786
  defaultValue,
5773
5787
  disabled,
5788
+ disableFilter,
5774
5789
  onBlur,
5775
5790
  onFocus,
5776
5791
  onChange,
@@ -5782,9 +5797,11 @@ var ComboBox = (0, import_react39.forwardRef)(function Combobox({
5782
5797
  isOpen: isOpenProp,
5783
5798
  itemToString: itemToString2 = itemToString,
5784
5799
  itemsToString,
5800
+ onDeselect,
5785
5801
  onOpenChange: onOpenChangeProp,
5786
5802
  onSelectionChange,
5787
5803
  selected: selectedProp,
5804
+ selectionKeys,
5788
5805
  selectionStrategy,
5789
5806
  source,
5790
5807
  value: valueProp,
@@ -5806,6 +5823,7 @@ var ComboBox = (0, import_react39.forwardRef)(function Combobox({
5806
5823
  source,
5807
5824
  children,
5808
5825
  options: {
5826
+ disableFilter,
5809
5827
  filterPattern: initialValue,
5810
5828
  getFilterRegex,
5811
5829
  itemToString: itemToString2
@@ -5822,6 +5840,7 @@ var ComboBox = (0, import_react39.forwardRef)(function Combobox({
5822
5840
  selected
5823
5841
  } = useCombobox({
5824
5842
  InputProps: InputProps4,
5843
+ allowBackspaceClearsSelection,
5825
5844
  allowFreeText,
5826
5845
  ariaLabel,
5827
5846
  collectionHook,
@@ -5834,6 +5853,7 @@ var ComboBox = (0, import_react39.forwardRef)(function Combobox({
5834
5853
  label: props.title,
5835
5854
  listRef,
5836
5855
  onBlur,
5856
+ onDeselect,
5837
5857
  onFocus,
5838
5858
  onChange,
5839
5859
  onSelect,
@@ -5845,6 +5865,7 @@ var ComboBox = (0, import_react39.forwardRef)(function Combobox({
5845
5865
  onSelectionChange,
5846
5866
  onSetSelectedText,
5847
5867
  selected: selectedProp,
5868
+ selectionKeys,
5848
5869
  selectionStrategy,
5849
5870
  value: initialValue
5850
5871
  });
@@ -5892,7 +5913,6 @@ var ComboBox = (0, import_react39.forwardRef)(function Combobox({
5892
5913
  focusVisible,
5893
5914
  highlightedIndex,
5894
5915
  itemTextHighlightPattern: String(inputProps.value) || void 0,
5895
- id: `${id}-list`,
5896
5916
  listHandlers,
5897
5917
  onSelectionChange,
5898
5918
  ref: listRef,
@@ -6645,6 +6665,7 @@ var import_vuu_layout12 = require("@vuu-ui/vuu-layout");
6645
6665
  var import_vuu_popups3 = require("@vuu-ui/vuu-popups");
6646
6666
  var import_jsx_runtime34 = require("react/jsx-runtime");
6647
6667
  var LayoutManagementContext = import_react55.default.createContext({
6668
+ getApplicationSettings: () => void 0,
6648
6669
  layoutMetadata: [],
6649
6670
  saveLayout: () => void 0,
6650
6671
  // The default Application JSON will be served if no LayoutManagementProvider