@vuu-ui/vuu-ui-controls 0.8.8-debug → 0.8.9-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.
Files changed (196) hide show
  1. package/cjs/index.js +5705 -3779
  2. package/cjs/index.js.map +4 -4
  3. package/esm/index.js +5754 -3781
  4. package/esm/index.js.map +4 -4
  5. package/index.css +419 -105
  6. package/index.css.map +3 -3
  7. package/package.json +8 -6
  8. package/types/vuu-popups/src/dialog/Dialog.d.ts +8 -0
  9. package/types/vuu-popups/src/dialog/index.d.ts +1 -0
  10. package/types/vuu-popups/src/index.d.ts +8 -0
  11. package/types/vuu-popups/src/menu/ContextMenu.d.ts +16 -0
  12. package/types/vuu-popups/src/menu/MenuList.d.ts +43 -0
  13. package/types/vuu-popups/src/menu/context-menu-provider.d.ts +10 -0
  14. package/types/vuu-popups/src/menu/index.d.ts +4 -0
  15. package/types/vuu-popups/src/menu/key-code.d.ts +12 -0
  16. package/types/vuu-popups/src/menu/list-dom-utils.d.ts +4 -0
  17. package/types/vuu-popups/src/menu/use-cascade.d.ts +25 -0
  18. package/types/vuu-popups/src/menu/use-items-with-ids-next.d.ts +13 -0
  19. package/types/vuu-popups/src/menu/use-keyboard-navigation.d.ts +27 -0
  20. package/types/vuu-popups/src/menu/useContextMenu.d.ts +20 -0
  21. package/types/vuu-popups/src/menu/utils.d.ts +2 -0
  22. package/types/vuu-popups/src/popup/Popup.d.ts +10 -0
  23. package/types/vuu-popups/src/popup/index.d.ts +3 -0
  24. package/types/vuu-popups/src/popup/popup-service.d.ts +59 -0
  25. package/types/vuu-popups/src/popup/useAnchoredPosition.d.ts +12 -0
  26. package/types/vuu-popups/src/popup-menu/PopupMenu.d.ts +16 -0
  27. package/types/vuu-popups/src/popup-menu/index.d.ts +1 -0
  28. package/types/vuu-popups/src/portal/Portal.d.ts +30 -0
  29. package/types/vuu-popups/src/portal/index.d.ts +1 -0
  30. package/types/vuu-popups/src/portal-deprecated/PortalDeprecated.d.ts +8 -0
  31. package/types/vuu-popups/src/portal-deprecated/index.d.ts +3 -0
  32. package/types/vuu-popups/src/portal-deprecated/portal-utils.d.ts +1 -0
  33. package/types/vuu-popups/src/portal-deprecated/render-portal.d.ts +10 -0
  34. package/types/vuu-popups/src/prompt/Prompt.d.ts +14 -0
  35. package/types/vuu-popups/src/prompt/index.d.ts +1 -0
  36. package/types/vuu-popups/src/tooltip/Tooltip.d.ts +12 -0
  37. package/types/vuu-popups/src/tooltip/index.d.ts +2 -0
  38. package/types/vuu-popups/src/tooltip/useAnchoredPosition.d.ts +12 -0
  39. package/types/vuu-popups/src/tooltip/useTooltip.d.ts +16 -0
  40. package/types/vuu-ui-controls/src/combo-box/ComboBox.d.ts +18 -0
  41. package/types/vuu-ui-controls/src/combo-box/index.d.ts +1 -0
  42. package/types/vuu-ui-controls/src/combo-box/useCombobox.d.ts +22 -0
  43. package/types/{list → vuu-ui-controls/src}/common-hooks/collectionTypes.d.ts +1 -0
  44. package/types/vuu-ui-controls/src/common-hooks/index.d.ts +8 -0
  45. package/types/{list → vuu-ui-controls/src}/common-hooks/navigationTypes.d.ts +5 -3
  46. package/types/{list → vuu-ui-controls/src}/common-hooks/selectionTypes.d.ts +16 -12
  47. package/types/{list → vuu-ui-controls/src}/common-hooks/useCollectionItems.d.ts +1 -1
  48. package/types/vuu-ui-controls/src/common-hooks/useControlled.d.ts +24 -0
  49. package/types/{list → vuu-ui-controls/src}/common-hooks/useSelection.d.ts +1 -1
  50. package/types/vuu-ui-controls/src/drag-drop/DragDropProvider.d.ts +37 -0
  51. package/types/vuu-ui-controls/src/drag-drop/DragDropState.d.ts +15 -0
  52. package/types/{drag-drop → vuu-ui-controls/src/drag-drop}/dragDropTypesNext.d.ts +24 -5
  53. package/types/{drag-drop → vuu-ui-controls/src/drag-drop}/drop-target-utils.d.ts +8 -9
  54. package/types/{drag-drop → vuu-ui-controls/src/drag-drop}/useDragDisplacers.d.ts +3 -2
  55. package/types/vuu-ui-controls/src/drag-drop/useDragDropIndicator.d.ts +2 -0
  56. package/types/vuu-ui-controls/src/drag-drop/useDragDropNaturalMovementNext.d.ts +2 -0
  57. package/types/vuu-ui-controls/src/drag-drop/useGlobalDragDrop.d.ts +10 -0
  58. package/types/vuu-ui-controls/src/dropdown/Dropdown.d.ts +10 -0
  59. package/types/vuu-ui-controls/src/dropdown/DropdownBase.d.ts +10 -0
  60. package/types/vuu-ui-controls/src/dropdown/DropdownButton.d.ts +42 -0
  61. package/types/vuu-ui-controls/src/dropdown/dropdownTypes.d.ts +45 -0
  62. package/types/vuu-ui-controls/src/dropdown/index.d.ts +5 -0
  63. package/types/vuu-ui-controls/src/dropdown/useClickAway.d.ts +8 -0
  64. package/types/vuu-ui-controls/src/dropdown/useDropdown.d.ts +13 -0
  65. package/types/vuu-ui-controls/src/dropdown/useDropdownBase.d.ts +2 -0
  66. package/types/vuu-ui-controls/src/editable/editable-utils.d.ts +4 -0
  67. package/types/vuu-ui-controls/src/editable/index.d.ts +2 -0
  68. package/types/vuu-ui-controls/src/editable/useEditableText.d.ts +16 -0
  69. package/types/vuu-ui-controls/src/expando-input/ExpandoInput.d.ts +4 -0
  70. package/types/vuu-ui-controls/src/expando-input/index.d.ts +1 -0
  71. package/types/vuu-ui-controls/src/index.d.ts +15 -0
  72. package/types/vuu-ui-controls/src/inputs/Checkbox.d.ts +10 -0
  73. package/types/vuu-ui-controls/src/inputs/RadioButton.d.ts +10 -0
  74. package/types/vuu-ui-controls/src/inputs/index.d.ts +2 -0
  75. package/types/vuu-ui-controls/src/instrument-search/InstrumentSearch.d.ts +11 -0
  76. package/types/vuu-ui-controls/src/instrument-search/SearchCell.d.ts +4 -0
  77. package/types/vuu-ui-controls/src/instrument-search/index.d.ts +1 -0
  78. package/types/vuu-ui-controls/src/instrument-search/moving-window.d.ts +14 -0
  79. package/types/vuu-ui-controls/src/instrument-search/useDataSource.d.ts +7 -0
  80. package/types/vuu-ui-controls/src/list/ChevronIcon.d.ts +8 -0
  81. package/types/{list → vuu-ui-controls/src/list}/List.d.ts +2 -2
  82. package/types/{list → vuu-ui-controls/src/list}/ListItem.d.ts +3 -1
  83. package/types/vuu-ui-controls/src/list/RadioIcon.d.ts +6 -0
  84. package/types/{list → vuu-ui-controls/src/list}/VirtualizedList.d.ts +1 -1
  85. package/types/{list → vuu-ui-controls/src/list}/common-hooks/index.d.ts +2 -7
  86. package/types/{list → vuu-ui-controls/src/list}/common-hooks/keyUtils.d.ts +0 -1
  87. package/types/{list → vuu-ui-controls/src/list}/common-hooks/list-dom-utils.d.ts +0 -1
  88. package/types/{list → vuu-ui-controls/src/list}/common-hooks/useCollapsibleGroups.d.ts +2 -2
  89. package/types/{list → vuu-ui-controls/src/list}/common-hooks/useImperativeScrollingAPI.d.ts +1 -1
  90. package/types/vuu-ui-controls/src/list/common-hooks/useKeyboardNavigation.d.ts +3 -0
  91. package/types/{list → vuu-ui-controls/src/list}/common-hooks/useTypeahead.d.ts +1 -1
  92. package/types/{list → vuu-ui-controls/src/list}/common-hooks/useViewportTracking.d.ts +1 -1
  93. package/types/{list → vuu-ui-controls/src/list}/common-hooks/utils/collection-item-utils.d.ts +1 -1
  94. package/types/{list → vuu-ui-controls/src/list}/common-hooks/utils/index.d.ts +1 -0
  95. package/types/vuu-ui-controls/src/list/common-hooks/utils/isSelected.d.ts +2 -0
  96. package/types/{list → vuu-ui-controls/src/list}/index.d.ts +3 -0
  97. package/types/{list → vuu-ui-controls/src/list}/listTypes.d.ts +15 -15
  98. package/types/{list → vuu-ui-controls/src/list}/useList.d.ts +2 -2
  99. package/types/{list → vuu-ui-controls/src/list}/useListHeight.d.ts +5 -4
  100. package/types/{list → vuu-ui-controls/src/list}/useVirtualization.d.ts +1 -1
  101. package/types/vuu-ui-controls/src/price-ticker/PriceTicker.d.ts +8 -0
  102. package/types/vuu-ui-controls/src/price-ticker/index.d.ts +1 -0
  103. package/types/vuu-ui-controls/src/tabstrip/TabMenu.d.ts +16 -0
  104. package/types/{tabstrip → vuu-ui-controls/src/tabstrip}/TabsTypes.d.ts +2 -2
  105. package/types/{tabstrip → vuu-ui-controls/src/tabstrip}/tabstrip-dom-utils.d.ts +0 -1
  106. package/types/{tabstrip → vuu-ui-controls/src/tabstrip}/useSelection.d.ts +0 -1
  107. package/types/{tabstrip → vuu-ui-controls/src/tabstrip}/useTabstrip.d.ts +1 -1
  108. package/types/vuu-ui-controls/src/utils/forwardCallbackProps.d.ts +3 -0
  109. package/types/vuu-ui-controls/src/utils/index.d.ts +2 -0
  110. package/types/vuu-ui-controls/src/vuu-input/VuuInput.d.ts +10 -0
  111. package/types/vuu-ui-controls/src/vuu-input/index.d.ts +1 -0
  112. package/types/vuu-utils/src/DataWindow.d.ts +39 -0
  113. package/types/vuu-utils/src/array-utils.d.ts +6 -0
  114. package/types/vuu-utils/src/box-utils.d.ts +9 -0
  115. package/types/vuu-utils/src/column-utils.d.ts +130 -0
  116. package/types/vuu-utils/src/common-types.d.ts +6 -0
  117. package/types/vuu-utils/src/component-registry.d.ts +23 -0
  118. package/types/vuu-utils/src/cookie-utils.d.ts +1 -0
  119. package/types/vuu-utils/src/data-utils.d.ts +14 -0
  120. package/types/vuu-utils/src/date-utils.d.ts +7 -0
  121. package/types/vuu-utils/src/debug-utils.d.ts +9 -0
  122. package/types/vuu-utils/src/event-emitter.d.ts +13 -0
  123. package/types/vuu-utils/src/filter-utils.d.ts +14 -0
  124. package/types/vuu-utils/src/formatting-utils.d.ts +9 -0
  125. package/types/vuu-utils/src/getUniqueId.d.ts +1 -0
  126. package/types/vuu-utils/src/group-utils.d.ts +3 -0
  127. package/types/vuu-utils/src/html-utils.d.ts +12 -0
  128. package/types/vuu-utils/src/index.d.ts +34 -0
  129. package/types/vuu-utils/src/input-utils.d.ts +2 -0
  130. package/types/vuu-utils/src/invariant.d.ts +1 -0
  131. package/types/vuu-utils/src/itemToString.d.ts +2 -0
  132. package/types/vuu-utils/src/json-utils.d.ts +6 -0
  133. package/types/vuu-utils/src/keyboard-utils.d.ts +12 -0
  134. package/types/vuu-utils/src/keyset.d.ts +11 -0
  135. package/types/vuu-utils/src/logging-utils.d.ts +44 -0
  136. package/types/vuu-utils/src/menu-utils.d.ts +2 -0
  137. package/types/vuu-utils/src/nanoid/index.d.ts +1 -0
  138. package/types/vuu-utils/src/perf-utils.d.ts +5 -0
  139. package/types/vuu-utils/src/range-utils.d.ts +24 -0
  140. package/types/vuu-utils/src/round-decimal.d.ts +1 -0
  141. package/types/vuu-utils/src/row-utils.d.ts +7 -0
  142. package/types/vuu-utils/src/screenshot-utils.d.ts +6 -0
  143. package/types/vuu-utils/src/selection-utils.d.ts +27 -0
  144. package/types/vuu-utils/src/sort-utils.d.ts +5 -0
  145. package/types/vuu-utils/src/text-utils.d.ts +2 -0
  146. package/types/vuu-utils/src/url-utils.d.ts +2 -0
  147. package/types/common-hooks/index.d.ts +0 -1
  148. package/types/drag-drop/DragDropProvider.d.ts +0 -22
  149. package/types/drag-drop/drag-utils.d.ts +0 -49
  150. package/types/drag-drop/useDragDropIndicator.d.ts +0 -2
  151. package/types/drag-drop/useDragDropNaturalMovementNext.d.ts +0 -2
  152. package/types/drag-drop/useDragSpacers.d.ts +0 -7
  153. package/types/index.d.ts +0 -5
  154. package/types/list/common-hooks/useKeyboardNavigation.d.ts +0 -4
  155. package/types/list/common-hooks/utils/isSelected.d.ts +0 -2
  156. package/types/tabstrip/TabMenu.d.ts +0 -12
  157. package/types/utils/index.d.ts +0 -1
  158. /package/types/{list → vuu-ui-controls/src}/common-hooks/collectionProvider.d.ts +0 -0
  159. /package/types/{list → vuu-ui-controls/src}/common-hooks/itemToString.d.ts +0 -0
  160. /package/types/{common-hooks → vuu-ui-controls/src/common-hooks}/use-resize-observer.d.ts +0 -0
  161. /package/types/{drag-drop → vuu-ui-controls/src/drag-drop}/Draggable.d.ts +0 -0
  162. /package/types/{drag-drop → vuu-ui-controls/src/drag-drop}/DropIndicator.d.ts +0 -0
  163. /package/types/{drag-drop → vuu-ui-controls/src/drag-drop}/index.d.ts +0 -0
  164. /package/types/{drag-drop → vuu-ui-controls/src/drag-drop}/useAutoScroll.d.ts +0 -0
  165. /package/types/{drag-drop → vuu-ui-controls/src/drag-drop}/useDragDropNext.d.ts +0 -0
  166. /package/types/{drag-drop → vuu-ui-controls/src/drag-drop}/useDropIndicator.d.ts +0 -0
  167. /package/types/{drag-drop → vuu-ui-controls/src/drag-drop}/useTransition.d.ts +0 -0
  168. /package/types/{editable-label → vuu-ui-controls/src/editable-label}/EditableLabel.d.ts +0 -0
  169. /package/types/{editable-label → vuu-ui-controls/src/editable-label}/index.d.ts +0 -0
  170. /package/types/{list → vuu-ui-controls/src/list}/CheckboxIcon.d.ts +0 -0
  171. /package/types/{list → vuu-ui-controls/src/list}/Highlighter.d.ts +0 -0
  172. /package/types/{list → vuu-ui-controls/src/list}/ListItemGroup.d.ts +0 -0
  173. /package/types/{list → vuu-ui-controls/src/list}/ListItemHeader.d.ts +0 -0
  174. /package/types/{list → vuu-ui-controls/src/list}/common-hooks/utils/filter-utils.d.ts +0 -0
  175. /package/types/{list → vuu-ui-controls/src/list}/keyset.d.ts +0 -0
  176. /package/types/{list → vuu-ui-controls/src/list}/useScrollPosition.d.ts +0 -0
  177. /package/types/{tabstrip → vuu-ui-controls/src/tabstrip}/Tab.d.ts +0 -0
  178. /package/types/{tabstrip → vuu-ui-controls/src/tabstrip}/TabMenuOptions.d.ts +0 -0
  179. /package/types/{tabstrip → vuu-ui-controls/src/tabstrip}/Tabstrip.d.ts +0 -0
  180. /package/types/{tabstrip → vuu-ui-controls/src/tabstrip}/index.d.ts +0 -0
  181. /package/types/{tabstrip → vuu-ui-controls/src/tabstrip}/useAnimatedSelectionThumb.d.ts +0 -0
  182. /package/types/{tabstrip → vuu-ui-controls/src/tabstrip}/useKeyboardNavigation.d.ts +0 -0
  183. /package/types/{tree → vuu-ui-controls/src/tree}/Tree.d.ts +0 -0
  184. /package/types/{tree → vuu-ui-controls/src/tree}/hierarchical-data-utils.d.ts +0 -0
  185. /package/types/{tree → vuu-ui-controls/src/tree}/index.d.ts +0 -0
  186. /package/types/{tree → vuu-ui-controls/src/tree}/key-code.d.ts +0 -0
  187. /package/types/{tree → vuu-ui-controls/src/tree}/list-dom-utils.d.ts +0 -0
  188. /package/types/{tree → vuu-ui-controls/src/tree}/use-collapsible-groups.d.ts +0 -0
  189. /package/types/{tree → vuu-ui-controls/src/tree}/use-hierarchical-data.d.ts +0 -0
  190. /package/types/{tree → vuu-ui-controls/src/tree}/use-items-with-ids.d.ts +0 -0
  191. /package/types/{tree → vuu-ui-controls/src/tree}/use-keyboard-navigation.d.ts +0 -0
  192. /package/types/{tree → vuu-ui-controls/src/tree}/use-selection.d.ts +0 -0
  193. /package/types/{tree → vuu-ui-controls/src/tree}/use-tree-keyboard-navigation.d.ts +0 -0
  194. /package/types/{tree → vuu-ui-controls/src/tree}/use-viewport-tracking.d.ts +0 -0
  195. /package/types/{tree → vuu-ui-controls/src/tree}/useTree.d.ts +0 -0
  196. /package/types/{utils → vuu-ui-controls/src/utils}/escapeRegExp.d.ts +0 -0
@@ -0,0 +1,2 @@
1
+ export * from "./Tooltip";
2
+ export * from "./useTooltip";
@@ -0,0 +1,12 @@
1
+ import { RefObject } from "react";
2
+ export type TooltipPlacement = "above" | "right" | "below" | "left";
3
+ export interface AnchoredPositionHookProps {
4
+ anchorElement: RefObject<HTMLElement>;
5
+ offsetLeft?: number;
6
+ offsetTop?: number;
7
+ placement: TooltipPlacement;
8
+ }
9
+ export declare const useAnchoredPosition: ({ anchorElement, offsetLeft, offsetTop, placement, }: AnchoredPositionHookProps) => {
10
+ left: number;
11
+ top: number;
12
+ } | undefined;
@@ -0,0 +1,16 @@
1
+ import { MouseEvent, ReactNode } from "react";
2
+ import { TooltipProps } from "./Tooltip";
3
+ import { TooltipPlacement } from "./useAnchoredPosition";
4
+ export interface TooltipHookProps {
5
+ id: string;
6
+ placement?: TooltipPlacement;
7
+ tooltipContent: ReactNode;
8
+ }
9
+ export declare const useTooltip: ({ id: idProp, placement, tooltipContent, }: TooltipHookProps) => {
10
+ anchorProps: {
11
+ "aria-describedby": string;
12
+ onMouseEnter: (evt: MouseEvent) => void;
13
+ onMouseLeave: () => void;
14
+ };
15
+ tooltipProps: TooltipProps | undefined;
16
+ };
@@ -0,0 +1,18 @@
1
+ import { InputProps } from "@salt-ds/core";
2
+ import { ForwardedRef, ReactElement } from "react";
3
+ import { SelectionProps, SelectionStrategy } from "../common-hooks";
4
+ import { DropdownBaseProps } from "../dropdown";
5
+ import { ListProps } from "../list";
6
+ export interface ComboBoxProps<Item = string, Selection extends SelectionStrategy = "default"> extends Omit<DropdownBaseProps, "triggerComponent" | "onBlur" | "onChange" | "onFocus">, Pick<InputProps, "onBlur" | "onChange" | "onFocus" | "onSelect">, Pick<ListProps<Item, Selection>, "ListItem" | "itemToString" | "source" | "width">, Pick<SelectionProps<Item, Selection>, "onSelectionChange" | "selectionStrategy"> {
7
+ InputProps?: InputProps;
8
+ ListProps?: Omit<ListProps<Item, Selection>, "ListItem" | "itemToString" | "source">;
9
+ allowFreeText?: boolean;
10
+ defaultValue?: string;
11
+ getFilterRegex?: (inputValue: string) => RegExp;
12
+ initialHighlightedIndex?: number;
13
+ stringToItem?: (value?: string) => Item | null | undefined;
14
+ value?: string;
15
+ }
16
+ export declare const ComboBox: <Item, Selection_1 extends SelectionStrategy = "default">(props: ComboBoxProps<Item, Selection_1> & {
17
+ ref?: ForwardedRef<HTMLDivElement> | undefined;
18
+ }) => ReactElement<ComboBoxProps<Item, Selection_1>, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1 @@
1
+ export * from "./ComboBox";
@@ -0,0 +1,22 @@
1
+ import { InputProps } from "@salt-ds/core";
2
+ import { RefObject } from "react";
3
+ import { SelectionStrategy } from "../common-hooks";
4
+ import { DropdownHookProps, DropdownHookResult } from "../dropdown";
5
+ import { ListHookProps, ListHookResult } from "../list";
6
+ export interface ComboboxHookProps<Item, Strategy extends SelectionStrategy> extends Partial<Omit<DropdownHookProps, "id" | "onKeyDown">>, Pick<InputProps, "onBlur" | "onChange" | "onFocus" | "onSelect">, Omit<ListHookProps<Item, Strategy>, "containerRef" | "defaultSelected" | "selected" | "onSelect"> {
7
+ InputProps?: InputProps;
8
+ allowFreeText?: boolean;
9
+ ariaLabel?: string;
10
+ defaultValue?: string;
11
+ id: string;
12
+ initialHighlightedIndex?: number;
13
+ itemToString?: (item: Item) => string;
14
+ listRef: RefObject<HTMLDivElement>;
15
+ stringToItem?: (value?: string) => Item | null | undefined;
16
+ value?: string;
17
+ }
18
+ export interface ComboboxHookResult<Item, Selection extends SelectionStrategy> extends Pick<ListHookResult<Item, Selection>, "focusVisible" | "highlightedIndex" | "listControlProps" | "listHandlers" | "selected">, Partial<DropdownHookResult> {
19
+ inputProps: InputProps;
20
+ onOpenChange: (isOpen: boolean) => void;
21
+ }
22
+ export declare const useCombobox: <Item, Selection_1 extends SelectionStrategy = "default">({ allowFreeText, ariaLabel, collectionHook, defaultIsOpen, defaultValue, onBlur, onFocus, onChange, onSelect, id, initialHighlightedIndex, isOpen: isOpenProp, itemToString, listRef, onOpenChange, onSelectionChange, selectionStrategy, stringToItem, value: valueProp, InputProps: inputProps, }: ComboboxHookProps<Item, Selection_1>) => ComboboxHookResult<Item, Selection_1>;
@@ -50,6 +50,7 @@ export type CollectionHookResult<T> = {
50
50
  setFilterPattern: (pattern: undefined | string) => void;
51
51
  itemById: (id: string) => T | never;
52
52
  itemToCollectionItem: <Selection extends SelectionStrategy, U extends T | T[] | null | undefined>(item: U) => Selection extends SingleSelectionStrategy ? CollectionItem<T> | null : CollectionItem<T>[];
53
+ itemToCollectionItemId: <Selection extends SelectionStrategy, U extends T | T[] | null | undefined>(item: U) => (Selection extends SingleSelectionStrategy ? string | null : string[]) | undefined;
53
54
  stringToCollectionItem: <Selection extends SelectionStrategy>(item: string | null | undefined) => Selection extends SingleSelectionStrategy ? CollectionItem<T> | null : CollectionItem<T>[];
54
55
  toCollectionItem: (item: T) => CollectionItem<T>;
55
56
  itemToId: (item: T) => string;
@@ -0,0 +1,8 @@
1
+ export * from "./collectionProvider";
2
+ export * from "./collectionTypes";
3
+ export * from "./itemToString";
4
+ export * from "./use-resize-observer";
5
+ export * from "./navigationTypes";
6
+ export * from "./selectionTypes";
7
+ export * from "./useCollectionItems";
8
+ export * from "./useControlled";
@@ -9,16 +9,18 @@ export interface NavigationProps<Item = unknown> {
9
9
  focusVisible?: number;
10
10
  highlightedIndex?: number;
11
11
  indexPositions: CollectionItem<Item>[];
12
+ itemCount: number;
12
13
  onHighlight?: (idx: number) => void;
13
14
  onKeyboardNavigation?: (evt: KeyboardEvent, idx: number) => void;
14
15
  restoreLastFocus?: boolean;
16
+ viewportItemCount: number;
15
17
  }
16
18
  export interface NavigationHookProps<Item, Selection extends SelectionStrategy> extends NavigationProps<Item> {
17
19
  containerRef: RefObject<HTMLElement>;
18
20
  label?: string;
19
- selected?: Selection extends SingleSelectionStrategy ? CollectionItem<Item> | null : CollectionItem<Item>[];
21
+ selected?: Selection extends SingleSelectionStrategy ? string | null : string[];
20
22
  }
21
- export interface KeyboardHookListProps {
23
+ export interface KeyboardHookContainerProps {
22
24
  onBlur: (evt: FocusEvent) => void;
23
25
  onFocus: (evt: FocusEvent) => void;
24
26
  onKeyDown: (evt: KeyboardEvent) => void;
@@ -32,6 +34,6 @@ export interface NavigationHookResult {
32
34
  highlightedIndex: number;
33
35
  setHighlightedIndex: (idx: number) => void;
34
36
  keyboardNavigation: RefObject<boolean>;
35
- listProps: KeyboardHookListProps;
37
+ containerProps: KeyboardHookContainerProps;
36
38
  setIgnoreFocus: (ignoreFocus: boolean) => void;
37
39
  }
@@ -1,17 +1,20 @@
1
- import { SyntheticEvent } from "react";
2
- import { CollectionItem } from "./collectionTypes";
3
- export declare const SINGLE = "default";
4
- export declare const MULTIPLE = "multiple";
5
- export declare const EXTENDED = "extended";
6
- export declare const DESELECTABLE = "deselectable";
1
+ import { RefObject, SyntheticEvent } from "react";
7
2
  export type SelectionDisallowed = "none";
8
3
  export type SingleSelectionStrategy = "default" | "deselectable";
9
4
  export type MultiSelectionStrategy = "multiple" | "extended" | "extended-multi-range";
5
+ /**
6
+ * SpecialKeyMultiple works as deselectable unless a special key
7
+ * (default SHIFT) is also pressed, then it allows multiple selection.
8
+ * Useful for column sorting, filters etc
9
+ */
10
+ export type SpecialKeyMultipleSelection = "multiple-special-key";
10
11
  export type SelectionStrategy = SelectionDisallowed | SingleSelectionStrategy | MultiSelectionStrategy;
11
12
  export type selectedType<Item, Selection extends SelectionStrategy> = Selection extends MultiSelectionStrategy ? Item[] : Item | null;
12
13
  export type SelectHandler<Item = string> = (event: SyntheticEvent, selectedItem: Item) => void;
13
14
  export type SelectionChangeHandler<Item = string, Selection extends SelectionStrategy = "default"> = (event: SyntheticEvent, selected: Selection extends SingleSelectionStrategy ? Item | null : Item[]) => void;
14
- export declare const selectionIsDisallowed: (selection?: SelectionStrategy) => selection is "none";
15
+ export declare const selectionIsDisallowed: (selection?: SelectionStrategy | SpecialKeyMultipleSelection) => selection is "none";
16
+ export declare const allowMultipleSelection: (selectionStrategy: SelectionStrategy | SpecialKeyMultipleSelection, specialKey?: boolean) => boolean;
17
+ export declare const deselectionIsAllowed: (selection?: SelectionStrategy | SpecialKeyMultipleSelection) => selection is "deselectable" | MultiSelectionStrategy;
15
18
  export declare const hasSelection: <Item = unknown>(selected: Item | Item[] | null) => selected is Item | Item[];
16
19
  export declare const getFirstSelectedItem: <Item = unknown>(selected: Item | Item[] | null) => Item | null;
17
20
  export interface SelectionProps<Item, Selection extends SelectionStrategy = "default"> {
@@ -27,16 +30,17 @@ export interface ListHandlers {
27
30
  onKeyboardNavigation?: (event: React.KeyboardEvent, currentIndex: number) => void;
28
31
  onMouseMove?: (event: React.MouseEvent) => void;
29
32
  }
30
- export interface SelectionHookProps<Item, Selection extends SelectionStrategy = "default"> extends SelectionProps<CollectionItem<Item>, Selection> {
33
+ export interface SelectionHookProps<Selection extends SelectionStrategy = "default"> extends SelectionProps<string, Selection> {
34
+ containerRef: RefObject<HTMLElement>;
31
35
  disableSelection?: boolean;
32
36
  highlightedIdx: number;
33
- indexPositions: CollectionItem<Item>[];
37
+ itemQuery: string;
34
38
  label?: string;
35
39
  selectionKeys?: string[];
36
40
  tabToSelect?: boolean;
37
41
  }
38
- export interface SelectionHookResult<Item, Selection extends SelectionStrategy = "default"> {
42
+ export interface SelectionHookResult<Selection extends SelectionStrategy = "default"> {
39
43
  listHandlers: ListHandlers;
40
- selected: Selection extends SingleSelectionStrategy ? CollectionItem<Item> | null : CollectionItem<Item>[];
41
- setSelected: (selected: Selection extends SingleSelectionStrategy ? CollectionItem<Item> | null : CollectionItem<Item>[]) => void;
44
+ selected: Selection extends SingleSelectionStrategy ? string | null : string[];
45
+ setSelected: (selected: Selection extends SingleSelectionStrategy ? string | null : string[]) => void;
42
46
  }
@@ -1,2 +1,2 @@
1
1
  import { CollectionHookProps, CollectionHookResult } from "./collectionTypes";
2
- export declare const useCollectionItems: <Item>({ children, id: idRoot, label, options, source, }: CollectionHookProps<Item>) => CollectionHookResult<Item>;
2
+ export declare const useCollectionItems: <Item>({ children, id: idRoot, options, source, }: CollectionHookProps<Item>) => CollectionHookResult<Item>;
@@ -0,0 +1,24 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ export interface UseControlledProps<T> {
3
+ /**
4
+ * Holds the component value when it's controlled.
5
+ */
6
+ controlled?: T;
7
+ /**
8
+ * The default value when uncontrolled.
9
+ */
10
+ default: T;
11
+ /**
12
+ * The component name displayed in warnings.
13
+ */
14
+ name: string;
15
+ /**
16
+ * The name of the state variable displayed in warnings.
17
+ */
18
+ state?: string;
19
+ }
20
+ /**
21
+ * Copied from MUI (v5) useControlled hook with one additional returned value
22
+ * @see https://github.com/mui-org/material-ui/blob/0979e6a54ba47c278d1f535953c0520a86349811/packages/material-ui-utils/src/useControlled.js
23
+ */
24
+ export declare function useControlled<S>({ controlled, default: defaultProp, name, state, }: UseControlledProps<S>): [S, Dispatch<SetStateAction<S>>, boolean];
@@ -5,4 +5,4 @@ export declare const GROUP_SELECTION_SINGLE = "single";
5
5
  export declare const GROUP_SELECTION_CASCADE = "cascade";
6
6
  export type GroupSelectionMode = "none" | "single" | "cascade";
7
7
  export declare const groupSelectionEnabled: (groupSelection: GroupSelectionMode) => boolean;
8
- export declare const useSelection: <Item, Selection_1 extends SelectionStrategy = "default">({ defaultSelected, disableSelection, highlightedIdx, indexPositions, onSelect, onSelectionChange, selected: selectedProp, selectionStrategy, selectionKeys, tabToSelect, }: SelectionHookProps<Item, Selection_1>) => SelectionHookResult<Item, Selection_1>;
8
+ export declare const useSelection: <Selection_1 extends SelectionStrategy = "default">({ containerRef, defaultSelected, disableSelection, highlightedIdx, itemQuery, onSelect, onSelectionChange, selected: selectedProp, selectionStrategy, selectionKeys, tabToSelect, }: SelectionHookProps<Selection_1>) => SelectionHookResult<Selection_1>;
@@ -0,0 +1,37 @@
1
+ import { ReactNode } from "react";
2
+ import { DragDropState } from "./DragDropState";
3
+ import { ResumeDragHandler } from "./useGlobalDragDrop";
4
+ export type DragOutHandler = (id: string, dragDropState: DragDropState) => boolean;
5
+ export type DragDropRegistrationFn = (id: string, resumeDrag?: ResumeDragHandler) => void;
6
+ export type EndOfDragOperationHandler = (id: string) => void;
7
+ export interface DragDropContextProps {
8
+ dragSources?: Map<string, string[]>;
9
+ dropTargets?: Map<string, string[]>;
10
+ onDragOut?: DragOutHandler;
11
+ onEndOfDragOperation?: EndOfDragOperationHandler;
12
+ registerDragDropParty: DragDropRegistrationFn;
13
+ }
14
+ export type DragSources = {
15
+ [key: string]: {
16
+ dropTargets: string | string[];
17
+ };
18
+ };
19
+ export interface DragDropProviderProps {
20
+ children: ReactNode;
21
+ dragSources: DragSources;
22
+ }
23
+ export type MeasuredTarget = {
24
+ bottom: number;
25
+ left: number;
26
+ right: number;
27
+ top: number;
28
+ };
29
+ export declare const DragDropProvider: ({ children, dragSources: dragSourcesProp, }: DragDropProviderProps) => JSX.Element;
30
+ export interface DragDropProviderResult {
31
+ isDragSource: boolean;
32
+ isDropTarget: boolean;
33
+ onDragOut?: DragOutHandler;
34
+ onEndOfDragOperation?: (id: string) => void;
35
+ register: DragDropRegistrationFn;
36
+ }
37
+ export declare const useDragDropProvider: (id?: string) => DragDropProviderResult;
@@ -0,0 +1,15 @@
1
+ import { MouseOffset } from "./dragDropTypesNext";
2
+ export declare class DragDropState {
3
+ /** Distance between start (top | left) of dragged element and point where user pressed to drag */
4
+ readonly mouseOffset: MouseOffset;
5
+ /** Element where the initial mousedown triggered the drag operation */
6
+ readonly initialDragElement: HTMLElement;
7
+ /** Element being dragged, (initial element cloned and rendered in portal). */
8
+ draggableElement: HTMLElement | null;
9
+ payload: unknown;
10
+ constructor(evt: MouseEvent, dragElement: HTMLElement);
11
+ /** Used to capture a ref to the Draggable JSX.Element */
12
+ setDraggable: (el: HTMLElement | null) => void;
13
+ setPayload(payload: unknown): void;
14
+ private getMouseOffset;
15
+ }
@@ -1,5 +1,6 @@
1
1
  import { MouseEventHandler, RefObject } from "react";
2
2
  import { orientationType } from "@vuu-ui/vuu-utils";
3
+ import { DragDropState } from "./DragDropState";
3
4
  export type ViewportRange = {
4
5
  atEnd: boolean;
5
6
  atStart: boolean;
@@ -40,22 +41,36 @@ export interface DragHookResult {
40
41
  revealOverflowedItems: boolean;
41
42
  }
42
43
  export interface InternalDragHookResult extends Omit<DragHookResult, "isDragging" | "isScrolling"> {
43
- beginDrag: (evt: MouseEvent) => void;
44
+ beginDrag: (dragElement: HTMLElement) => void;
44
45
  drag: (dragPos: number, mouseMoveDirection: "fwd" | "bwd") => void;
45
46
  drop: () => void;
46
47
  handleScrollStart: () => void;
47
48
  handleScrollStop: (scrollDirection: "fwd" | "bwd", _scrollPos: number, atEnd: boolean) => void;
49
+ /**
50
+ * Draggable item has been dragged out of container. Remove any local drop
51
+ * indicators. Dragged element itself should not yet be removed from DOM.
52
+ */
53
+ releaseDrag?: () => void;
48
54
  }
55
+ export interface DropOptions {
56
+ fromIndex?: number;
57
+ toIndex: number;
58
+ isExternal?: boolean;
59
+ payload?: unknown;
60
+ }
61
+ export type DragStartHandler = (dragDropState: DragDropState) => void;
62
+ export type DropHandler = (fromIndex: number, toIndex: number, options: DropOptions) => void;
49
63
  export interface DragDropProps {
50
64
  allowDragDrop?: boolean | dragStrategy;
51
65
  /** this is the className that will be assigned during drag to the dragged element */
52
66
  draggableClassName: string;
53
67
  extendedDropZone?: boolean;
68
+ getDragPayload?: (dragElement: HTMLElement) => unknown;
54
69
  id?: string;
55
70
  isDragSource?: boolean;
56
71
  isDropTarget?: boolean;
57
- onDragStart?: () => void;
58
- onDrop: (fromIndex: number, toIndex: number) => void;
72
+ onDragStart?: DragStartHandler;
73
+ onDrop: DropHandler;
59
74
  onDropSettle?: (toIndex: number) => void;
60
75
  orientation: orientationType;
61
76
  containerRef: RefObject<HTMLElement>;
@@ -63,10 +78,14 @@ export interface DragDropProps {
63
78
  viewportRange?: ViewportRange;
64
79
  }
65
80
  export type DragDropHook = (props: DragDropProps) => DragHookResult;
66
- export interface InternalDragDropProps extends Omit<DragDropProps, "draggableClassName"> {
67
- draggableRef: RefObject<HTMLDivElement>;
81
+ export interface InternalDragDropProps extends Omit<DragDropProps, "draggableClassName" | "id"> {
68
82
  isDragSource?: boolean;
69
83
  isDropTarget?: boolean;
70
84
  selected?: unknown;
71
85
  }
86
+ export type DragDropContext = {
87
+ dragElement: HTMLElement;
88
+ dragPayload: unknown;
89
+ mouseOffset: MouseOffset;
90
+ };
72
91
  export {};
@@ -9,11 +9,11 @@ export type MeasuredDropTarget = {
9
9
  is dropped here, this will be the destination drop position.
10
10
  */
11
11
  currentIndex: number;
12
- dataIndex?: number;
13
12
  element: HTMLElement;
14
13
  id: string;
15
14
  index: number;
16
15
  isDraggedItem: boolean;
16
+ isExternal?: boolean;
17
17
  isLast?: boolean;
18
18
  isOverflowIndicator?: boolean;
19
19
  start: number;
@@ -34,29 +34,29 @@ export declare const measureElementSizeAndPosition: (element: HTMLElement, dimen
34
34
  export declare const dimensions: (orientation: orientationType) => {
35
35
  CLIENT_POS: "clientX" | "clientY";
36
36
  CLIENT_SIZE: "scrollTop" | "scrollHeight" | "scrollLeft" | "scrollWidth" | "clientWidth" | "clientHeight";
37
- CONTRA: "x" | "y" | "width" | "left" | "right" | "top" | "bottom" | "height";
37
+ CONTRA: "width" | "height" | "x" | "y" | "left" | "right" | "bottom" | "top";
38
38
  CONTRA_CLIENT_POS: "clientX" | "clientY";
39
39
  CONTRA_END: "width" | "height";
40
40
  CONTRA_POS: ElementPosition;
41
41
  DIMENSION: "width" | "height";
42
- END: "x" | "y" | "width" | "left" | "right" | "top" | "bottom" | "height";
42
+ END: "width" | "height" | "x" | "y" | "left" | "right" | "bottom" | "top";
43
43
  POS: ElementPosition;
44
44
  SCROLL_POS: "scrollTop" | "scrollHeight" | "scrollLeft" | "scrollWidth" | "clientWidth" | "clientHeight";
45
45
  SCROLL_SIZE: "scrollTop" | "scrollHeight" | "scrollLeft" | "scrollWidth" | "clientWidth" | "clientHeight";
46
- START: "x" | "y" | "width" | "left" | "right" | "top" | "bottom" | "height";
46
+ START: "width" | "height" | "x" | "y" | "left" | "right" | "bottom" | "top";
47
47
  } | {
48
48
  CLIENT_POS: "clientX" | "clientY";
49
49
  CLIENT_SIZE: "scrollTop" | "scrollHeight" | "scrollLeft" | "scrollWidth" | "clientWidth" | "clientHeight";
50
- CONTRA: "x" | "y" | "width" | "left" | "right" | "top" | "bottom" | "height";
50
+ CONTRA: "width" | "height" | "x" | "y" | "left" | "right" | "bottom" | "top";
51
51
  CONTRA_CLIENT_POS: "clientX" | "clientY";
52
52
  CONTRA_END: "width" | "height";
53
53
  CONTRA_POS: ElementPosition;
54
54
  DIMENSION: "width" | "height";
55
- END: "x" | "y" | "width" | "left" | "right" | "top" | "bottom" | "height";
55
+ END: "width" | "height" | "x" | "y" | "left" | "right" | "bottom" | "top";
56
56
  POS: ElementPosition;
57
57
  SCROLL_POS: "scrollTop" | "scrollHeight" | "scrollLeft" | "scrollWidth" | "clientWidth" | "clientHeight";
58
58
  SCROLL_SIZE: "scrollTop" | "scrollHeight" | "scrollLeft" | "scrollWidth" | "clientWidth" | "clientHeight";
59
- START: "x" | "y" | "width" | "left" | "right" | "top" | "bottom" | "height";
59
+ START: "width" | "height" | "x" | "y" | "left" | "right" | "bottom" | "top";
60
60
  };
61
61
  export declare const getItemById: (measuredItems: MeasuredDropTarget[], id: string) => MeasuredDropTarget | undefined;
62
62
  export declare const removeDraggedItem: (measuredItems: MeasuredDropTarget[], index: number) => void;
@@ -73,13 +73,12 @@ export declare const measureDropTargets: (container: HTMLElement, orientation: o
73
73
  */
74
74
  export declare const getIndexOfDraggedItem: (dropTargets: MeasuredDropTarget[], absoluteIndex?: boolean) => number;
75
75
  export declare const mutateDropTargetsSwitchDropTargetPosition: (dropTargets: MeasuredDropTarget[], direction: Direction) => void;
76
- export declare const getNextDropTarget: (dropTargets: MeasuredDropTarget[], pos: number, mouseMoveDirection: Direction) => MeasuredDropTarget;
76
+ export declare const getNextDropTarget: (dropTargets: MeasuredDropTarget[], pos: number, draggedItemSize: number, mouseMoveDirection: Direction) => MeasuredDropTarget;
77
77
  /**
78
78
  * An item within a scrollable container might have a width or height greater than that of
79
79
  * the container. If we drag such an item, we don't want the draggable to be larger than
80
80
  * the container.
81
81
  */
82
82
  export declare function constrainRect(targetRect: Rect, constraintRect: Rect): Rect;
83
- export declare const moveItem: <T = unknown>(items: T[], fromIndex: number, toIndex: number) => T[];
84
83
  export declare const dropTargetsDebugString: (dropTargets: MeasuredDropTarget[]) => string;
85
84
  export {};
@@ -1,11 +1,12 @@
1
1
  import { MeasuredDropTarget } from "./drop-target-utils";
2
2
  import { Direction } from "./dragDropTypesNext";
3
+ import { orientationType } from "packages/vuu-utils/src";
3
4
  export type DragDisplacersHookResult = {
4
5
  displaceItem: (dropTargets: MeasuredDropTarget[], dropTarget: MeasuredDropTarget, size: number, useTransition?: boolean, direction?: Direction | "static", orientation?: "horizontal" | "vertical") => void;
5
6
  displaceLastItem: (dropTargets: MeasuredDropTarget[], dropTarget: MeasuredDropTarget, size: number, useTransition?: boolean, direction?: Direction | "static", orientation?: "horizontal" | "vertical") => void;
6
- clearSpacers: () => void;
7
+ clearSpacers: (useAnimation?: boolean) => void;
7
8
  };
8
- export type DragDisplacersHook = () => DragDisplacersHookResult;
9
+ export type DragDisplacersHook = (orientation: orientationType) => DragDisplacersHookResult;
9
10
  /**
10
11
  * Manage a pair of displacer elements to smoothly display a moving gap between
11
12
  * list items of any kind. Designed to be used in a drag drop operation. The 'static'
@@ -0,0 +1,2 @@
1
+ import { InternalDragDropProps, InternalDragHookResult } from "./dragDropTypesNext";
2
+ export declare const useDragDropIndicator: ({ onDrop, orientation, containerRef, itemQuery, selected, viewportRange, }: InternalDragDropProps) => InternalDragHookResult;
@@ -0,0 +1,2 @@
1
+ import { InternalDragDropProps, InternalDragHookResult } from "./dragDropTypesNext";
2
+ export declare const useDragDropNaturalMovement: ({ onDrop, orientation, containerRef, itemQuery, selected, viewportRange, }: InternalDragDropProps) => InternalDragHookResult;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { MeasuredTarget } from "./DragDropProvider";
3
+ import { DragDropState } from "./DragDropState";
4
+ export type ResumeDragHandler = (dragDropState: DragDropState) => boolean;
5
+ export declare const useGlobalDragDrop: ({ onDragOverDropTarget, }: {
6
+ onDragOverDropTarget: (dropTargetId: string, dragDropState: DragDropState) => boolean;
7
+ }) => {
8
+ measuredDropTargetsRef: import("react").MutableRefObject<Record<string, MeasuredTarget> | undefined>;
9
+ resumeDrag: ResumeDragHandler;
10
+ };
@@ -0,0 +1,10 @@
1
+ import { ForwardedRef, ReactElement } from "react";
2
+ import { SelectionProps, SelectionStrategy } from "../common-hooks";
3
+ import { ListProps } from "../list";
4
+ import { DropdownBaseProps } from "./dropdownTypes";
5
+ export interface DropdownProps<Item = string, Selection extends SelectionStrategy = "default"> extends DropdownBaseProps, Pick<ListProps<Item, Selection>, "ListItem" | "itemToString" | "source" | "width">, SelectionProps<Item, Selection> {
6
+ ListProps?: Omit<ListProps<Item, Selection>, "ListItem" | "itemToString" | "source">;
7
+ }
8
+ export declare const Dropdown: <Item, Selection_1 extends SelectionStrategy = "default">(props: DropdownProps<Item, Selection_1> & {
9
+ ref?: ForwardedRef<HTMLDivElement> | undefined;
10
+ }) => ReactElement<DropdownProps<Item, Selection_1>, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { DropdownBaseProps } from "./dropdownTypes";
3
+ import "./Dropdown.css";
4
+ export type MaybeChildProps = {
5
+ className?: string;
6
+ id?: string;
7
+ role?: string;
8
+ width: number | string;
9
+ };
10
+ export declare const DropdownBase: import("react").ForwardRefExoticComponent<DropdownBaseProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,42 @@
1
+ import { ButtonProps } from "@salt-ds/core";
2
+ import { AriaAttributes } from "react";
3
+ import "./DropdownButton.css";
4
+ export interface DropdownButtonProps extends ButtonProps {
5
+ /**
6
+ * Replace the default Icon component
7
+ */
8
+ icon?: string;
9
+ /**
10
+ * Whether the dropdown button should hide role='option' via 'aria-hidden'
11
+ */
12
+ ariaHideOptionRole?: boolean;
13
+ /**
14
+ * If, `true`, the Dropdown button will occupy the full width of it's container
15
+ */
16
+ fullWidth?: boolean;
17
+ /**
18
+ * Is the dropdown list open
19
+ */
20
+ isOpen?: boolean;
21
+ /**
22
+ * Label for the dropdown button
23
+ */
24
+ label?: string;
25
+ /**
26
+ * Id for the label. This is needed for ARIA attributes.
27
+ */
28
+ labelId?: string;
29
+ /**
30
+ * When the dropdown is collapsed this value is set as aria-posinset on the span containing the selected value
31
+ * **/
32
+ posInSet?: number;
33
+ /**
34
+ * When the dropdown is collapsed this value is set as aria-setsize on the span containing the selected value
35
+ * **/
36
+ setSize?: number;
37
+ /**
38
+ *
39
+ * **/
40
+ labelAriaAttributes?: Pick<AriaAttributes, "aria-posinset" | "aria-setsize" | "aria-selected">;
41
+ }
42
+ export declare const DropdownButton: import("react").ForwardRefExoticComponent<DropdownButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,45 @@
1
+ import { PopupPlacement } from "packages/vuu-popups/src";
2
+ import { HTMLAttributes, KeyboardEvent, ReactElement, RefObject } from "react";
3
+ export type DropdownOpenKey = "Enter" | "ArrowDown" | " ";
4
+ export interface DropdownBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
5
+ defaultIsOpen?: boolean;
6
+ disabled?: boolean;
7
+ fullWidth?: boolean;
8
+ isOpen?: boolean;
9
+ onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;
10
+ openKeys?: DropdownOpenKey[];
11
+ onOpenChange?: (isOpen: boolean) => void;
12
+ openOnFocus?: boolean;
13
+ placement?: PopupPlacement;
14
+ popupWidth?: number;
15
+ triggerComponent?: JSX.Element;
16
+ width?: number | string;
17
+ }
18
+ export interface DropdownHookProps extends Pick<DropdownBaseProps, "defaultIsOpen" | "disabled" | "fullWidth" | "isOpen" | "onOpenChange" | "onKeyDown" | "openKeys" | "openOnFocus" | "popupWidth" | "width"> {
19
+ ariaLabelledBy?: string;
20
+ id: string;
21
+ popupComponent: ReactElement;
22
+ rootRef: RefObject<HTMLDivElement>;
23
+ }
24
+ export interface DropdownHookTriggerProps {
25
+ "aria-expanded"?: boolean;
26
+ "aria-labelledby"?: string;
27
+ "aria-owns"?: string;
28
+ id: string;
29
+ onClick?: (e: MouseEvent) => void;
30
+ onFocus?: (e: FocusEvent) => void;
31
+ role: string;
32
+ onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;
33
+ style?: any;
34
+ }
35
+ interface ComponentProps extends HTMLAttributes<HTMLElement> {
36
+ width?: number | string;
37
+ }
38
+ export interface DropdownHookResult {
39
+ componentProps: ComponentProps;
40
+ isOpen: boolean;
41
+ label: string;
42
+ popupComponentRef: React.Ref<HTMLElement>;
43
+ triggerProps: DropdownHookTriggerProps;
44
+ }
45
+ export {};
@@ -0,0 +1,5 @@
1
+ export * from "./DropdownBase";
2
+ export * from "./DropdownButton";
3
+ export * from "./Dropdown";
4
+ export * from "./dropdownTypes";
5
+ export * from "./useDropdownBase";
@@ -0,0 +1,8 @@
1
+ import { RefObject } from "react";
2
+ export type ClickawayHook = (props: {
3
+ popperRef: RefObject<HTMLElement>;
4
+ rootRef: RefObject<HTMLElement>;
5
+ isOpen: boolean;
6
+ onClose: () => void;
7
+ }) => void;
8
+ export declare const useClickAway: ClickawayHook;
@@ -0,0 +1,13 @@
1
+ import { RefObject } from "react";
2
+ import { ListHookProps, ListHookResult } from "../list";
3
+ import { DropdownHookResult, DropdownHookProps } from "./dropdownTypes";
4
+ import { SelectionStrategy } from "../common-hooks";
5
+ export interface DropdownListHookProps<Item, Strategy extends SelectionStrategy> extends Partial<Omit<DropdownHookProps, "onKeyDown">>, Omit<ListHookProps<Item, Strategy>, "containerRef"> {
6
+ itemToString?: (item: Item) => string;
7
+ listRef: RefObject<HTMLDivElement>;
8
+ }
9
+ export interface DropdownListHookResult<Item, Selection extends SelectionStrategy> extends Partial<ListHookResult<Item, Selection>>, Partial<DropdownHookResult> {
10
+ onOpenChange: any;
11
+ triggerLabel?: string;
12
+ }
13
+ export declare const useDropdown: <Item, Selection_1 extends SelectionStrategy = "default">({ collectionHook, defaultHighlightedIndex: defaultHighlightedIndexProp, defaultIsOpen, defaultSelected, highlightedIndex: highlightedIndexProp, isOpen: isOpenProp, itemToString, listRef, onHighlight, onOpenChange, onSelectionChange, onSelect, selected, selectionStrategy, }: DropdownListHookProps<Item, Selection_1>) => DropdownListHookResult<Item, Selection_1>;
@@ -0,0 +1,2 @@
1
+ import { DropdownHookProps, DropdownHookResult } from "./dropdownTypes";
2
+ export declare const useDropdownBase: ({ defaultIsOpen, disabled, fullWidth: fullWidthProp, id, isOpen: isOpenProp, onOpenChange, onKeyDown: onKeyDownProp, openKeys, openOnFocus, popupComponent, popupWidth: popupWidthProp, rootRef, width, }: DropdownHookProps) => DropdownHookResult;
@@ -0,0 +1,4 @@
1
+ import { EditValidationRule } from "@vuu-ui/vuu-datagrid-types";
2
+ import { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
3
+ export type ClientSideValidationChecker = (value: VuuRowDataItemType) => string | false | undefined;
4
+ export declare const buildValidationChecker: (rules: EditValidationRule[]) => ClientSideValidationChecker;
@@ -0,0 +1,2 @@
1
+ export * from "./editable-utils";
2
+ export * from "./useEditableText";
@@ -0,0 +1,16 @@
1
+ import { VuuColumnDataType } from "@vuu-ui/vuu-protocol-types";
2
+ import { FormEventHandler, KeyboardEvent } from "react";
3
+ import { ClientSideValidationChecker } from "./editable-utils";
4
+ export interface EditableTextHookProps<T extends VuuColumnDataType = VuuColumnDataType> {
5
+ clientSideEditValidationCheck?: ClientSideValidationChecker;
6
+ initialValue: T;
7
+ onCommit: (value: T) => boolean;
8
+ }
9
+ export declare const dispatchCommitEvent: (el: HTMLElement) => void;
10
+ export declare const useEditableText: <T extends VuuColumnDataType = VuuColumnDataType>({ clientSideEditValidationCheck, initialValue, onCommit, }: EditableTextHookProps<T>) => {
11
+ onBlur: () => void;
12
+ onChange: FormEventHandler<Element>;
13
+ onKeyDown: (evt: KeyboardEvent<HTMLElement>) => void;
14
+ value: T;
15
+ warningMessage: string | undefined;
16
+ };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { InputProps } from "@salt-ds/core";
3
+ import "./ExpandoInput.css";
4
+ export declare const ExpandoInput: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLDivElement>>;