@vuu-ui/vuu-ui-controls 3.3.11 → 3.3.12

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.3.11",
2
+ "version": "3.3.12",
3
3
  "description": "VUU UI Controls",
4
4
  "main": "./src/index.js",
5
5
  "author": "heswell",
@@ -10,17 +10,17 @@
10
10
  "type-defs": "node ../../scripts/build-type-defs.mjs"
11
11
  },
12
12
  "devDependencies": {
13
- "@vuu-ui/vuu-data-types": "3.3.11",
14
- "@vuu-ui/vuu-protocol-types": "3.3.11",
15
- "@vuu-ui/vuu-table-types": "3.3.11"
13
+ "@vuu-ui/vuu-data-types": "3.3.12",
14
+ "@vuu-ui/vuu-protocol-types": "3.3.12",
15
+ "@vuu-ui/vuu-table-types": "3.3.12"
16
16
  },
17
17
  "dependencies": {
18
- "@vuu-ui/vuu-context-menu": "3.3.11",
19
- "@vuu-ui/vuu-data-react": "3.3.11",
20
- "@vuu-ui/vuu-layout": "3.3.11",
21
- "@vuu-ui/vuu-popups": "3.3.11",
22
- "@vuu-ui/vuu-table": "3.3.11",
23
- "@vuu-ui/vuu-utils": "3.3.11",
18
+ "@vuu-ui/vuu-context-menu": "3.3.12",
19
+ "@vuu-ui/vuu-data-react": "3.3.12",
20
+ "@vuu-ui/vuu-layout": "3.3.12",
21
+ "@vuu-ui/vuu-popups": "3.3.12",
22
+ "@vuu-ui/vuu-table": "3.3.12",
23
+ "@vuu-ui/vuu-utils": "3.3.12",
24
24
  "@salt-ds/core": "1.54.1",
25
25
  "@salt-ds/icons": "1.16.0",
26
26
  "@salt-ds/styles": "0.2.1",
@@ -11,10 +11,6 @@ const css = `
11
11
  overflow: hidden;
12
12
  container-type: inline-size;
13
13
 
14
- &.vuuItemPicker-withCalculated {
15
- --label-margin-left: 8px;
16
- }
17
-
18
14
  & .saltListBox {
19
15
  background-color: inherit;
20
16
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Button, Input, ListBox, Option } from "@salt-ds/core";
2
+ import { Input, ListBox, Option } from "@salt-ds/core";
3
3
  import { useComponentCssInjection } from "@salt-ds/styles";
4
4
  import { useWindow } from "@salt-ds/window";
5
5
  import { applyHighlighting } from "@vuu-ui/vuu-table";
@@ -98,7 +98,7 @@ const AvailableListItem = ({ className: classNameProp, index, item, onAdd, searc
98
98
  ]
99
99
  });
100
100
  };
101
- const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ className, itemTypeName, allItems, selectedItems, maxSelections, onSelectedItemsChange, onSelectionChange, selected = NO_SELECTION, createCustomItemProps, ...htmlAttributes }, forwardedRef) {
101
+ const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ className, itemTypeName, allItems, selectedItems, maxSelections, onSelectedItemsChange, onSelectionChange, selected = NO_SELECTION, ...htmlAttributes }, forwardedRef) {
102
102
  const targetWindow = useWindow();
103
103
  useComponentCssInjection({
104
104
  testId: "vuu-item-picker",
@@ -196,14 +196,7 @@ const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ className, ite
196
196
  }, item.name))
197
197
  })
198
198
  ]
199
- }),
200
- createCustomItemProps ? /*#__PURE__*/ jsx("div", {
201
- className: `${classBase}-item-buttons`,
202
- children: /*#__PURE__*/ jsx(Button, {
203
- onClick: createCustomItemProps.onClickCreateCustomItem,
204
- children: createCustomItemProps.buttonLabel
205
- })
206
- }) : null
199
+ })
207
200
  ]
208
201
  });
209
202
  });
@@ -55,10 +55,7 @@ const useItemPicker = ({ allItems, selectedItems, maxSelections, onSelectedItems
55
55
  selectedItems,
56
56
  onSelectedItemsChange
57
57
  ]);
58
- const getSelectedItemsFiltered = useMemo(()=>filterItems(selectedItems, searchPattern), [
59
- selectedItems,
60
- searchPattern
61
- ]);
58
+ const getSelectedItemsFiltered = (latestSelectedItems, latestSearchPattern)=>filterItems(latestSelectedItems, latestSearchPattern);
62
59
  const getAvailableItemsFiltered = useMemo(()=>filterItems(allItems, searchPattern).filter(({ name })=>-1 === selectedItems.findIndex((item)=>item.name === name)).toSorted(byItemName), [
63
60
  allItems,
64
61
  selectedItems,
@@ -71,7 +68,7 @@ const useItemPicker = ({ allItems, selectedItems, maxSelections, onSelectedItems
71
68
  return {
72
69
  selectedItemsCount: selectedItems.length,
73
70
  availableItemsCount: getAvailableItemsCount,
74
- selectedItemsFiltered: getSelectedItemsFiltered,
71
+ selectedItemsFiltered: getSelectedItemsFiltered(selectedItems, searchPattern),
75
72
  availableItemsFiltered: getAvailableItemsFiltered,
76
73
  searchText: searchPattern,
77
74
  onChangeSearchInput: handleChangeSearchInput,
package/types/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export { HoverOverlay } from "./hover-overlay/HoverOverlay";
13
13
  export * from "./icon-button";
14
14
  export * from "./instrument-picker";
15
15
  export { ItemPicker, type ItemPickerProps } from "./item-picker/ItemPicker";
16
- export { type ItemDescriptor, type CreateCustomItemProps, } from "./item-picker/useItemPicker";
16
+ export { type ItemDescriptor } from "./item-picker/useItemPicker";
17
17
  export * from "./measured-container";
18
18
  export { ModalProvider, useModal } from "./modal-provider/ModalProvider";
19
19
  export * from "./overflow-container";
@@ -1,11 +1,10 @@
1
1
  import { ListBoxProps } from "@salt-ds/core";
2
2
  import { ItemTypeName } from "@vuu-ui/vuu-utils";
3
3
  import { HTMLAttributes } from "react";
4
- import { CreateCustomItemProps, ItemDescriptor, ItemPickerHookProps } from "./useItemPicker";
4
+ import { ItemDescriptor, ItemPickerHookProps } from "./useItemPicker";
5
5
  export declare const classBaseListItem = "vuuItemPickerListItem";
6
6
  export interface ItemPickerProps extends ItemPickerHookProps, HTMLAttributes<HTMLDivElement>, Pick<ListBoxProps<ItemDescriptor>, "selected" | "onSelectionChange"> {
7
7
  itemTypeName: ItemTypeName;
8
- createCustomItemProps?: CreateCustomItemProps;
9
8
  }
10
9
  /** Generic controlled component that displays items in a 'picker' that are available to search, select, reorder or deselect.
11
10
  * As input props, all available items, currently selected items, search text and callback functions for changes in selected items and search text
@@ -11,15 +11,11 @@ export interface ItemDescriptor {
11
11
  /** Optional string to define groups of items for client reference, not currently used for rendering */
12
12
  group?: string;
13
13
  }
14
- export interface CreateCustomItemProps {
15
- buttonLabel: string;
16
- onClickCreateCustomItem: MouseEventHandler<HTMLButtonElement>;
17
- }
18
14
  export interface ItemPickerHookProps {
19
15
  allItems: ItemDescriptor[];
20
16
  selectedItems: ItemDescriptor[];
21
17
  maxSelections?: number;
22
- onSelectedItemsChange: (newSelectedItems: ItemDescriptor[]) => void;
18
+ onSelectedItemsChange: (newSelectedItems: readonly ItemDescriptor[]) => void;
23
19
  }
24
20
  export declare const getItemLabel: (item: ItemDescriptor) => string;
25
21
  export declare const useItemPicker: ({ allItems, selectedItems, maxSelections, onSelectedItemsChange, }: ItemPickerHookProps) => {