@vuu-ui/vuu-ui-controls 0.0.26
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/LICENSE +201 -0
- package/README.md +0 -0
- package/cjs/calendar/Calendar.css.js +6 -0
- package/cjs/calendar/Calendar.css.js.map +1 -0
- package/cjs/calendar/Calendar.js +74 -0
- package/cjs/calendar/Calendar.js.map +1 -0
- package/cjs/calendar/internal/CalendarCarousel.css.js +6 -0
- package/cjs/calendar/internal/CalendarCarousel.css.js.map +1 -0
- package/cjs/calendar/internal/CalendarCarousel.js +97 -0
- package/cjs/calendar/internal/CalendarCarousel.js.map +1 -0
- package/cjs/calendar/internal/CalendarContext.js +19 -0
- package/cjs/calendar/internal/CalendarContext.js.map +1 -0
- package/cjs/calendar/internal/CalendarDay.css.js +6 -0
- package/cjs/calendar/internal/CalendarDay.css.js.map +1 -0
- package/cjs/calendar/internal/CalendarDay.js +83 -0
- package/cjs/calendar/internal/CalendarDay.js.map +1 -0
- package/cjs/calendar/internal/CalendarMonth.css.js +6 -0
- package/cjs/calendar/internal/CalendarMonth.css.js.map +1 -0
- package/cjs/calendar/internal/CalendarMonth.js +73 -0
- package/cjs/calendar/internal/CalendarMonth.js.map +1 -0
- package/cjs/calendar/internal/CalendarNavigation.css.js +6 -0
- package/cjs/calendar/internal/CalendarNavigation.css.js.map +1 -0
- package/cjs/calendar/internal/CalendarNavigation.js +250 -0
- package/cjs/calendar/internal/CalendarNavigation.js.map +1 -0
- package/cjs/calendar/internal/CalendarWeekHeader.css.js +6 -0
- package/cjs/calendar/internal/CalendarWeekHeader.css.js.map +1 -0
- package/cjs/calendar/internal/CalendarWeekHeader.js +43 -0
- package/cjs/calendar/internal/CalendarWeekHeader.js.map +1 -0
- package/cjs/calendar/internal/useFocusManagement.js +63 -0
- package/cjs/calendar/internal/useFocusManagement.js.map +1 -0
- package/cjs/calendar/internal/utils.js +63 -0
- package/cjs/calendar/internal/utils.js.map +1 -0
- package/cjs/calendar/useCalendar.js +131 -0
- package/cjs/calendar/useCalendar.js.map +1 -0
- package/cjs/calendar/useCalendarDay.js +70 -0
- package/cjs/calendar/useCalendarDay.js.map +1 -0
- package/cjs/calendar/useSelection.js +242 -0
- package/cjs/calendar/useSelection.js.map +1 -0
- package/cjs/combo-box/ComboBox.js +191 -0
- package/cjs/combo-box/ComboBox.js.map +1 -0
- package/cjs/combo-box/useCombobox.js +358 -0
- package/cjs/combo-box/useCombobox.js.map +1 -0
- package/cjs/common-hooks/collectionProvider.js +24 -0
- package/cjs/common-hooks/collectionProvider.js.map +1 -0
- package/cjs/common-hooks/isPlainObject.js +6 -0
- package/cjs/common-hooks/isPlainObject.js.map +1 -0
- package/cjs/common-hooks/itemToString.js +24 -0
- package/cjs/common-hooks/itemToString.js.map +1 -0
- package/cjs/common-hooks/selectionTypes.js +18 -0
- package/cjs/common-hooks/selectionTypes.js.map +1 -0
- package/cjs/common-hooks/use-resize-observer.js +123 -0
- package/cjs/common-hooks/use-resize-observer.js.map +1 -0
- package/cjs/common-hooks/useCollectionItems.js +309 -0
- package/cjs/common-hooks/useCollectionItems.js.map +1 -0
- package/cjs/common-hooks/useControlled.js +58 -0
- package/cjs/common-hooks/useControlled.js.map +1 -0
- package/cjs/common-hooks/useSelection.js +212 -0
- package/cjs/common-hooks/useSelection.js.map +1 -0
- package/cjs/common-hooks/useStateRef.js +23 -0
- package/cjs/common-hooks/useStateRef.js.map +1 -0
- package/cjs/cycle-state-button/CycleStateButton.js +54 -0
- package/cjs/cycle-state-button/CycleStateButton.js.map +1 -0
- package/cjs/date-input/DateInput.css.js +6 -0
- package/cjs/date-input/DateInput.css.js.map +1 -0
- package/cjs/date-input/DateInput.js +90 -0
- package/cjs/date-input/DateInput.js.map +1 -0
- package/cjs/date-input/DateRangeInput.js +77 -0
- package/cjs/date-input/DateRangeInput.js.map +1 -0
- package/cjs/date-input/useDatePicker.js +20 -0
- package/cjs/date-input/useDatePicker.js.map +1 -0
- package/cjs/date-popup/DatePopup.js +90 -0
- package/cjs/date-popup/DatePopup.js.map +1 -0
- package/cjs/date-popup/useDatePopup.js +77 -0
- package/cjs/date-popup/useDatePopup.js.map +1 -0
- package/cjs/drag-drop/DragDropProvider.js +145 -0
- package/cjs/drag-drop/DragDropProvider.js.map +1 -0
- package/cjs/drag-drop/DragDropState.js +29 -0
- package/cjs/drag-drop/DragDropState.js.map +1 -0
- package/cjs/drag-drop/Draggable.css.js +6 -0
- package/cjs/drag-drop/Draggable.css.js.map +1 -0
- package/cjs/drag-drop/Draggable.js +95 -0
- package/cjs/drag-drop/Draggable.js.map +1 -0
- package/cjs/drag-drop/dragDropTypes.js +8 -0
- package/cjs/drag-drop/dragDropTypes.js.map +1 -0
- package/cjs/drag-drop/drop-target-utils.js +245 -0
- package/cjs/drag-drop/drop-target-utils.js.map +1 -0
- package/cjs/drag-drop/useAutoScroll.js +71 -0
- package/cjs/drag-drop/useAutoScroll.js.map +1 -0
- package/cjs/drag-drop/useDragDisplacers.js +160 -0
- package/cjs/drag-drop/useDragDisplacers.js.map +1 -0
- package/cjs/drag-drop/useDragDrop.js +499 -0
- package/cjs/drag-drop/useDragDrop.js.map +1 -0
- package/cjs/drag-drop/useDragDropCopy.js +34 -0
- package/cjs/drag-drop/useDragDropCopy.js.map +1 -0
- package/cjs/drag-drop/useDragDropIndicator.js +251 -0
- package/cjs/drag-drop/useDragDropIndicator.js.map +1 -0
- package/cjs/drag-drop/useDragDropNaturalMovement.js +264 -0
- package/cjs/drag-drop/useDragDropNaturalMovement.js.map +1 -0
- package/cjs/drag-drop/useDropIndicator.js +27 -0
- package/cjs/drag-drop/useDropIndicator.js.map +1 -0
- package/cjs/drag-drop/useGlobalDragDrop.js +89 -0
- package/cjs/drag-drop/useGlobalDragDrop.js.map +1 -0
- package/cjs/dropdown/Dropdown.css.js +6 -0
- package/cjs/dropdown/Dropdown.css.js.map +1 -0
- package/cjs/dropdown/Dropdown.js +150 -0
- package/cjs/dropdown/Dropdown.js.map +1 -0
- package/cjs/dropdown/DropdownBase.js +121 -0
- package/cjs/dropdown/DropdownBase.js.map +1 -0
- package/cjs/dropdown/DropdownButton.css.js +6 -0
- package/cjs/dropdown/DropdownButton.css.js.map +1 -0
- package/cjs/dropdown/DropdownButton.js +72 -0
- package/cjs/dropdown/DropdownButton.js.map +1 -0
- package/cjs/dropdown/useClickAway.js +67 -0
- package/cjs/dropdown/useClickAway.js.map +1 -0
- package/cjs/dropdown/useDropdown.js +115 -0
- package/cjs/dropdown/useDropdown.js.map +1 -0
- package/cjs/dropdown/useDropdownBase.js +169 -0
- package/cjs/dropdown/useDropdownBase.js.map +1 -0
- package/cjs/editable/editable-utils.js +37 -0
- package/cjs/editable/editable-utils.js.map +1 -0
- package/cjs/editable/useEditableText.js +106 -0
- package/cjs/editable/useEditableText.js.map +1 -0
- package/cjs/editable-label/EditableLabel.css.js +6 -0
- package/cjs/editable-label/EditableLabel.css.js.map +1 -0
- package/cjs/editable-label/EditableLabel.js +138 -0
- package/cjs/editable-label/EditableLabel.js.map +1 -0
- package/cjs/expando-input/ExpandoInput.css.js +6 -0
- package/cjs/expando-input/ExpandoInput.css.js.map +1 -0
- package/cjs/expando-input/ExpandoInput.js +53 -0
- package/cjs/expando-input/ExpandoInput.js.map +1 -0
- package/cjs/icon-button/Icon.css.js +6 -0
- package/cjs/icon-button/Icon.css.js.map +1 -0
- package/cjs/icon-button/Icon.js +37 -0
- package/cjs/icon-button/Icon.js.map +1 -0
- package/cjs/icon-button/IconButton.css.js +6 -0
- package/cjs/icon-button/IconButton.css.js.map +1 -0
- package/cjs/icon-button/IconButton.js +26 -0
- package/cjs/icon-button/IconButton.js.map +1 -0
- package/cjs/index.js +231 -0
- package/cjs/index.js.map +1 -0
- package/cjs/inputs/Checkbox.css.js +6 -0
- package/cjs/inputs/Checkbox.css.js.map +1 -0
- package/cjs/inputs/Checkbox.js +32 -0
- package/cjs/inputs/Checkbox.js.map +1 -0
- package/cjs/inputs/RadioButton.css.js +6 -0
- package/cjs/inputs/RadioButton.css.js.map +1 -0
- package/cjs/inputs/RadioButton.js +39 -0
- package/cjs/inputs/RadioButton.js.map +1 -0
- package/cjs/instrument-picker/InstrumentPicker.css.js +6 -0
- package/cjs/instrument-picker/InstrumentPicker.css.js.map +1 -0
- package/cjs/instrument-picker/InstrumentPicker.js +113 -0
- package/cjs/instrument-picker/InstrumentPicker.js.map +1 -0
- package/cjs/instrument-picker/SearchCell.css.js +6 -0
- package/cjs/instrument-picker/SearchCell.css.js.map +1 -0
- package/cjs/instrument-picker/SearchCell.js +33 -0
- package/cjs/instrument-picker/SearchCell.js.map +1 -0
- package/cjs/instrument-picker/useInstrumentPicker.js +87 -0
- package/cjs/instrument-picker/useInstrumentPicker.js.map +1 -0
- package/cjs/instrument-search/InstrumentSearch.css.js +6 -0
- package/cjs/instrument-search/InstrumentSearch.css.js.map +1 -0
- package/cjs/instrument-search/InstrumentSearch.js +96 -0
- package/cjs/instrument-search/InstrumentSearch.js.map +1 -0
- package/cjs/instrument-search/SearchCell.css.js +6 -0
- package/cjs/instrument-search/SearchCell.css.js.map +1 -0
- package/cjs/instrument-search/SearchCell.js +33 -0
- package/cjs/instrument-search/SearchCell.js.map +1 -0
- package/cjs/instrument-search/useInstrumentSearch.js +39 -0
- package/cjs/instrument-search/useInstrumentSearch.js.map +1 -0
- package/cjs/list/CheckboxIcon.css.js +6 -0
- package/cjs/list/CheckboxIcon.css.js.map +1 -0
- package/cjs/list/CheckboxIcon.js +33 -0
- package/cjs/list/CheckboxIcon.js.map +1 -0
- package/cjs/list/ChevronIcon.css.js +6 -0
- package/cjs/list/ChevronIcon.css.js.map +1 -0
- package/cjs/list/ChevronIcon.js +22 -0
- package/cjs/list/ChevronIcon.js.map +1 -0
- package/cjs/list/Highlighter.css.js +6 -0
- package/cjs/list/Highlighter.css.js.map +1 -0
- package/cjs/list/Highlighter.js +36 -0
- package/cjs/list/Highlighter.js.map +1 -0
- package/cjs/list/List.css.js +6 -0
- package/cjs/list/List.css.js.map +1 -0
- package/cjs/list/List.js +317 -0
- package/cjs/list/List.js.map +1 -0
- package/cjs/list/ListItem.css.js +6 -0
- package/cjs/list/ListItem.css.js.map +1 -0
- package/cjs/list/ListItem.js +84 -0
- package/cjs/list/ListItem.js.map +1 -0
- package/cjs/list/ListItemGroup.js +6 -0
- package/cjs/list/ListItemGroup.js.map +1 -0
- package/cjs/list/ListItemHeader.js +6 -0
- package/cjs/list/ListItemHeader.js.map +1 -0
- package/cjs/list/RadioIcon.css.js +6 -0
- package/cjs/list/RadioIcon.css.js.map +1 -0
- package/cjs/list/RadioIcon.js +27 -0
- package/cjs/list/RadioIcon.js.map +1 -0
- package/cjs/list/common-hooks/keyUtils.js +78 -0
- package/cjs/list/common-hooks/keyUtils.js.map +1 -0
- package/cjs/list/common-hooks/list-dom-utils.js +25 -0
- package/cjs/list/common-hooks/list-dom-utils.js.map +1 -0
- package/cjs/list/common-hooks/useCollapsibleGroups.js +82 -0
- package/cjs/list/common-hooks/useCollapsibleGroups.js.map +1 -0
- package/cjs/list/common-hooks/useImperativeScrollingAPI.js +52 -0
- package/cjs/list/common-hooks/useImperativeScrollingAPI.js.map +1 -0
- package/cjs/list/common-hooks/useKeyboardNavigation.js +289 -0
- package/cjs/list/common-hooks/useKeyboardNavigation.js.map +1 -0
- package/cjs/list/common-hooks/useTypeahead.js +74 -0
- package/cjs/list/common-hooks/useTypeahead.js.map +1 -0
- package/cjs/list/common-hooks/useViewportTracking.js +133 -0
- package/cjs/list/common-hooks/useViewportTracking.js.map +1 -0
- package/cjs/list/common-hooks/utils/collection-item-utils.js +181 -0
- package/cjs/list/common-hooks/utils/collection-item-utils.js.map +1 -0
- package/cjs/list/common-hooks/utils/filter-utils.js +11 -0
- package/cjs/list/common-hooks/utils/filter-utils.js.map +1 -0
- package/cjs/list/common-hooks/utils/isSelected.js +9 -0
- package/cjs/list/common-hooks/utils/isSelected.js.map +1 -0
- package/cjs/list/useList.js +278 -0
- package/cjs/list/useList.js.map +1 -0
- package/cjs/list/useListDrop.js +92 -0
- package/cjs/list/useListDrop.js.map +1 -0
- package/cjs/list/useListHeight.js +77 -0
- package/cjs/list/useListHeight.js.map +1 -0
- package/cjs/list/useScrollPosition.js +74 -0
- package/cjs/list/useScrollPosition.js.map +1 -0
- package/cjs/measured-container/MeasuredContainer.css.js +6 -0
- package/cjs/measured-container/MeasuredContainer.css.js.map +1 -0
- package/cjs/measured-container/MeasuredContainer.js +69 -0
- package/cjs/measured-container/MeasuredContainer.js.map +1 -0
- package/cjs/measured-container/useMeasuredContainer.js +127 -0
- package/cjs/measured-container/useMeasuredContainer.js.map +1 -0
- package/cjs/measured-container/useResizeObserver.js +130 -0
- package/cjs/measured-container/useResizeObserver.js.map +1 -0
- package/cjs/overflow-container/OverflowContainer.css.js +6 -0
- package/cjs/overflow-container/OverflowContainer.css.js.map +1 -0
- package/cjs/overflow-container/OverflowContainer.js +142 -0
- package/cjs/overflow-container/OverflowContainer.js.map +1 -0
- package/cjs/overflow-container/overflow-utils.js +286 -0
- package/cjs/overflow-container/overflow-utils.js.map +1 -0
- package/cjs/overflow-container/useOverflowContainer.js +143 -0
- package/cjs/overflow-container/useOverflowContainer.js.map +1 -0
- package/cjs/price-ticker/PriceTicker.css.js +6 -0
- package/cjs/price-ticker/PriceTicker.css.js.map +1 -0
- package/cjs/price-ticker/PriceTicker.js +50 -0
- package/cjs/price-ticker/PriceTicker.js.map +1 -0
- package/cjs/split-button/SplitButton.css.js +6 -0
- package/cjs/split-button/SplitButton.css.js.map +1 -0
- package/cjs/split-button/SplitButton.js +81 -0
- package/cjs/split-button/SplitButton.js.map +1 -0
- package/cjs/split-button/SplitStateButton.css.js +6 -0
- package/cjs/split-button/SplitStateButton.css.js.map +1 -0
- package/cjs/split-button/SplitStateButton.js +31 -0
- package/cjs/split-button/SplitStateButton.js.map +1 -0
- package/cjs/split-button/useSplitButton.js +84 -0
- package/cjs/split-button/useSplitButton.js.map +1 -0
- package/cjs/tabstrip/Tab.css.js +6 -0
- package/cjs/tabstrip/Tab.css.js.map +1 -0
- package/cjs/tabstrip/Tab.js +151 -0
- package/cjs/tabstrip/Tab.js.map +1 -0
- package/cjs/tabstrip/TabMenu.css.js +6 -0
- package/cjs/tabstrip/TabMenu.css.js.map +1 -0
- package/cjs/tabstrip/TabMenu.js +72 -0
- package/cjs/tabstrip/TabMenu.js.map +1 -0
- package/cjs/tabstrip/TabMenuOptions.js +20 -0
- package/cjs/tabstrip/TabMenuOptions.js.map +1 -0
- package/cjs/tabstrip/Tabstrip.css.js +6 -0
- package/cjs/tabstrip/Tabstrip.css.js.map +1 -0
- package/cjs/tabstrip/Tabstrip.js +156 -0
- package/cjs/tabstrip/Tabstrip.js.map +1 -0
- package/cjs/tabstrip/tabstrip-dom-utils.js +19 -0
- package/cjs/tabstrip/tabstrip-dom-utils.js.map +1 -0
- package/cjs/tabstrip/useAnimatedSelectionThumb.js +85 -0
- package/cjs/tabstrip/useAnimatedSelectionThumb.js.map +1 -0
- package/cjs/tabstrip/useKeyboardNavigation.js +243 -0
- package/cjs/tabstrip/useKeyboardNavigation.js.map +1 -0
- package/cjs/tabstrip/useSelection.js +60 -0
- package/cjs/tabstrip/useSelection.js.map +1 -0
- package/cjs/tabstrip/useTabstrip.js +261 -0
- package/cjs/tabstrip/useTabstrip.js.map +1 -0
- package/cjs/toolbar/Toolbar.css.js +6 -0
- package/cjs/toolbar/Toolbar.css.js.map +1 -0
- package/cjs/toolbar/Toolbar.js +90 -0
- package/cjs/toolbar/Toolbar.js.map +1 -0
- package/cjs/toolbar/toolbar-dom-utils.js +18 -0
- package/cjs/toolbar/toolbar-dom-utils.js.map +1 -0
- package/cjs/toolbar/useKeyboardNavigation.js +305 -0
- package/cjs/toolbar/useKeyboardNavigation.js.map +1 -0
- package/cjs/toolbar/useSelection.js +94 -0
- package/cjs/toolbar/useSelection.js.map +1 -0
- package/cjs/toolbar/useToolbar.js +100 -0
- package/cjs/toolbar/useToolbar.js.map +1 -0
- package/cjs/tree/Tree.css.js +6 -0
- package/cjs/tree/Tree.css.js.map +1 -0
- package/cjs/tree/Tree.js +179 -0
- package/cjs/tree/Tree.js.map +1 -0
- package/cjs/tree/hierarchical-data-utils.js +72 -0
- package/cjs/tree/hierarchical-data-utils.js.map +1 -0
- package/cjs/tree/key-code.js +62 -0
- package/cjs/tree/key-code.js.map +1 -0
- package/cjs/tree/list-dom-utils.js +19 -0
- package/cjs/tree/list-dom-utils.js.map +1 -0
- package/cjs/tree/treeTypeUtils.js +6 -0
- package/cjs/tree/treeTypeUtils.js.map +1 -0
- package/cjs/tree/use-collapsible-groups.js +85 -0
- package/cjs/tree/use-collapsible-groups.js.map +1 -0
- package/cjs/tree/use-hierarchical-data.js +51 -0
- package/cjs/tree/use-hierarchical-data.js.map +1 -0
- package/cjs/tree/use-items-with-ids.js +100 -0
- package/cjs/tree/use-items-with-ids.js.map +1 -0
- package/cjs/tree/use-keyboard-navigation.js +144 -0
- package/cjs/tree/use-keyboard-navigation.js.map +1 -0
- package/cjs/tree/use-selection.js +154 -0
- package/cjs/tree/use-selection.js.map +1 -0
- package/cjs/tree/use-tree-keyboard-navigation.js +41 -0
- package/cjs/tree/use-tree-keyboard-navigation.js.map +1 -0
- package/cjs/tree/use-viewport-tracking.js +76 -0
- package/cjs/tree/use-viewport-tracking.js.map +1 -0
- package/cjs/tree/useTree.js +106 -0
- package/cjs/tree/useTree.js.map +1 -0
- package/cjs/utils/escapeRegExp.js +9 -0
- package/cjs/utils/escapeRegExp.js.map +1 -0
- package/cjs/utils/forwardCallbackProps.js +22 -0
- package/cjs/utils/forwardCallbackProps.js.map +1 -0
- package/cjs/utils/isOverflowElement.js +8 -0
- package/cjs/utils/isOverflowElement.js.map +1 -0
- package/cjs/vuu-input/VuuInput.css.js +6 -0
- package/cjs/vuu-input/VuuInput.css.js.map +1 -0
- package/cjs/vuu-input/VuuInput.js +105 -0
- package/cjs/vuu-input/VuuInput.js.map +1 -0
- package/esm/calendar/Calendar.css.js +4 -0
- package/esm/calendar/Calendar.css.js.map +1 -0
- package/esm/calendar/Calendar.js +72 -0
- package/esm/calendar/Calendar.js.map +1 -0
- package/esm/calendar/internal/CalendarCarousel.css.js +4 -0
- package/esm/calendar/internal/CalendarCarousel.css.js.map +1 -0
- package/esm/calendar/internal/CalendarCarousel.js +95 -0
- package/esm/calendar/internal/CalendarCarousel.js.map +1 -0
- package/esm/calendar/internal/CalendarContext.js +16 -0
- package/esm/calendar/internal/CalendarContext.js.map +1 -0
- package/esm/calendar/internal/CalendarDay.css.js +4 -0
- package/esm/calendar/internal/CalendarDay.css.js.map +1 -0
- package/esm/calendar/internal/CalendarDay.js +81 -0
- package/esm/calendar/internal/CalendarDay.js.map +1 -0
- package/esm/calendar/internal/CalendarMonth.css.js +4 -0
- package/esm/calendar/internal/CalendarMonth.css.js.map +1 -0
- package/esm/calendar/internal/CalendarMonth.js +71 -0
- package/esm/calendar/internal/CalendarMonth.js.map +1 -0
- package/esm/calendar/internal/CalendarNavigation.css.js +4 -0
- package/esm/calendar/internal/CalendarNavigation.css.js.map +1 -0
- package/esm/calendar/internal/CalendarNavigation.js +248 -0
- package/esm/calendar/internal/CalendarNavigation.js.map +1 -0
- package/esm/calendar/internal/CalendarWeekHeader.css.js +4 -0
- package/esm/calendar/internal/CalendarWeekHeader.css.js.map +1 -0
- package/esm/calendar/internal/CalendarWeekHeader.js +41 -0
- package/esm/calendar/internal/CalendarWeekHeader.js.map +1 -0
- package/esm/calendar/internal/useFocusManagement.js +61 -0
- package/esm/calendar/internal/useFocusManagement.js.map +1 -0
- package/esm/calendar/internal/utils.js +55 -0
- package/esm/calendar/internal/utils.js.map +1 -0
- package/esm/calendar/useCalendar.js +129 -0
- package/esm/calendar/useCalendar.js.map +1 -0
- package/esm/calendar/useCalendarDay.js +68 -0
- package/esm/calendar/useCalendarDay.js.map +1 -0
- package/esm/calendar/useSelection.js +239 -0
- package/esm/calendar/useSelection.js.map +1 -0
- package/esm/combo-box/ComboBox.js +189 -0
- package/esm/combo-box/ComboBox.js.map +1 -0
- package/esm/combo-box/useCombobox.js +356 -0
- package/esm/combo-box/useCombobox.js.map +1 -0
- package/esm/common-hooks/collectionProvider.js +20 -0
- package/esm/common-hooks/collectionProvider.js.map +1 -0
- package/esm/common-hooks/isPlainObject.js +4 -0
- package/esm/common-hooks/isPlainObject.js.map +1 -0
- package/esm/common-hooks/itemToString.js +22 -0
- package/esm/common-hooks/itemToString.js.map +1 -0
- package/esm/common-hooks/selectionTypes.js +10 -0
- package/esm/common-hooks/selectionTypes.js.map +1 -0
- package/esm/common-hooks/use-resize-observer.js +118 -0
- package/esm/common-hooks/use-resize-observer.js.map +1 -0
- package/esm/common-hooks/useCollectionItems.js +307 -0
- package/esm/common-hooks/useCollectionItems.js.map +1 -0
- package/esm/common-hooks/useControlled.js +56 -0
- package/esm/common-hooks/useControlled.js.map +1 -0
- package/esm/common-hooks/useSelection.js +205 -0
- package/esm/common-hooks/useSelection.js.map +1 -0
- package/esm/common-hooks/useStateRef.js +21 -0
- package/esm/common-hooks/useStateRef.js.map +1 -0
- package/esm/cycle-state-button/CycleStateButton.js +52 -0
- package/esm/cycle-state-button/CycleStateButton.js.map +1 -0
- package/esm/date-input/DateInput.css.js +4 -0
- package/esm/date-input/DateInput.css.js.map +1 -0
- package/esm/date-input/DateInput.js +88 -0
- package/esm/date-input/DateInput.js.map +1 -0
- package/esm/date-input/DateRangeInput.js +75 -0
- package/esm/date-input/DateRangeInput.js.map +1 -0
- package/esm/date-input/useDatePicker.js +18 -0
- package/esm/date-input/useDatePicker.js.map +1 -0
- package/esm/date-popup/DatePopup.js +88 -0
- package/esm/date-popup/DatePopup.js.map +1 -0
- package/esm/date-popup/useDatePopup.js +75 -0
- package/esm/date-popup/useDatePopup.js.map +1 -0
- package/esm/drag-drop/DragDropProvider.js +142 -0
- package/esm/drag-drop/DragDropProvider.js.map +1 -0
- package/esm/drag-drop/DragDropState.js +27 -0
- package/esm/drag-drop/DragDropState.js.map +1 -0
- package/esm/drag-drop/Draggable.css.js +4 -0
- package/esm/drag-drop/Draggable.css.js.map +1 -0
- package/esm/drag-drop/Draggable.js +90 -0
- package/esm/drag-drop/Draggable.js.map +1 -0
- package/esm/drag-drop/dragDropTypes.js +5 -0
- package/esm/drag-drop/dragDropTypes.js.map +1 -0
- package/esm/drag-drop/drop-target-utils.js +228 -0
- package/esm/drag-drop/drop-target-utils.js.map +1 -0
- package/esm/drag-drop/useAutoScroll.js +69 -0
- package/esm/drag-drop/useAutoScroll.js.map +1 -0
- package/esm/drag-drop/useDragDisplacers.js +158 -0
- package/esm/drag-drop/useDragDisplacers.js.map +1 -0
- package/esm/drag-drop/useDragDrop.js +497 -0
- package/esm/drag-drop/useDragDrop.js.map +1 -0
- package/esm/drag-drop/useDragDropCopy.js +31 -0
- package/esm/drag-drop/useDragDropCopy.js.map +1 -0
- package/esm/drag-drop/useDragDropIndicator.js +249 -0
- package/esm/drag-drop/useDragDropIndicator.js.map +1 -0
- package/esm/drag-drop/useDragDropNaturalMovement.js +262 -0
- package/esm/drag-drop/useDragDropNaturalMovement.js.map +1 -0
- package/esm/drag-drop/useDropIndicator.js +25 -0
- package/esm/drag-drop/useDropIndicator.js.map +1 -0
- package/esm/drag-drop/useGlobalDragDrop.js +87 -0
- package/esm/drag-drop/useGlobalDragDrop.js.map +1 -0
- package/esm/dropdown/Dropdown.css.js +4 -0
- package/esm/dropdown/Dropdown.css.js.map +1 -0
- package/esm/dropdown/Dropdown.js +148 -0
- package/esm/dropdown/Dropdown.js.map +1 -0
- package/esm/dropdown/DropdownBase.js +119 -0
- package/esm/dropdown/DropdownBase.js.map +1 -0
- package/esm/dropdown/DropdownButton.css.js +4 -0
- package/esm/dropdown/DropdownButton.css.js.map +1 -0
- package/esm/dropdown/DropdownButton.js +70 -0
- package/esm/dropdown/DropdownButton.js.map +1 -0
- package/esm/dropdown/useClickAway.js +64 -0
- package/esm/dropdown/useClickAway.js.map +1 -0
- package/esm/dropdown/useDropdown.js +113 -0
- package/esm/dropdown/useDropdown.js.map +1 -0
- package/esm/dropdown/useDropdownBase.js +167 -0
- package/esm/dropdown/useDropdownBase.js.map +1 -0
- package/esm/editable/editable-utils.js +35 -0
- package/esm/editable/editable-utils.js.map +1 -0
- package/esm/editable/useEditableText.js +103 -0
- package/esm/editable/useEditableText.js.map +1 -0
- package/esm/editable-label/EditableLabel.css.js +4 -0
- package/esm/editable-label/EditableLabel.css.js.map +1 -0
- package/esm/editable-label/EditableLabel.js +135 -0
- package/esm/editable-label/EditableLabel.js.map +1 -0
- package/esm/expando-input/ExpandoInput.css.js +4 -0
- package/esm/expando-input/ExpandoInput.css.js.map +1 -0
- package/esm/expando-input/ExpandoInput.js +51 -0
- package/esm/expando-input/ExpandoInput.js.map +1 -0
- package/esm/icon-button/Icon.css.js +4 -0
- package/esm/icon-button/Icon.css.js.map +1 -0
- package/esm/icon-button/Icon.js +35 -0
- package/esm/icon-button/Icon.js.map +1 -0
- package/esm/icon-button/IconButton.css.js +4 -0
- package/esm/icon-button/IconButton.css.js.map +1 -0
- package/esm/icon-button/IconButton.js +24 -0
- package/esm/icon-button/IconButton.js.map +1 -0
- package/esm/index.js +73 -0
- package/esm/index.js.map +1 -0
- package/esm/inputs/Checkbox.css.js +4 -0
- package/esm/inputs/Checkbox.css.js.map +1 -0
- package/esm/inputs/Checkbox.js +30 -0
- package/esm/inputs/Checkbox.js.map +1 -0
- package/esm/inputs/RadioButton.css.js +4 -0
- package/esm/inputs/RadioButton.css.js.map +1 -0
- package/esm/inputs/RadioButton.js +37 -0
- package/esm/inputs/RadioButton.js.map +1 -0
- package/esm/instrument-picker/InstrumentPicker.css.js +4 -0
- package/esm/instrument-picker/InstrumentPicker.css.js.map +1 -0
- package/esm/instrument-picker/InstrumentPicker.js +111 -0
- package/esm/instrument-picker/InstrumentPicker.js.map +1 -0
- package/esm/instrument-picker/SearchCell.css.js +4 -0
- package/esm/instrument-picker/SearchCell.css.js.map +1 -0
- package/esm/instrument-picker/SearchCell.js +31 -0
- package/esm/instrument-picker/SearchCell.js.map +1 -0
- package/esm/instrument-picker/useInstrumentPicker.js +85 -0
- package/esm/instrument-picker/useInstrumentPicker.js.map +1 -0
- package/esm/instrument-search/InstrumentSearch.css.js +4 -0
- package/esm/instrument-search/InstrumentSearch.css.js.map +1 -0
- package/esm/instrument-search/InstrumentSearch.js +94 -0
- package/esm/instrument-search/InstrumentSearch.js.map +1 -0
- package/esm/instrument-search/SearchCell.css.js +4 -0
- package/esm/instrument-search/SearchCell.css.js.map +1 -0
- package/esm/instrument-search/SearchCell.js +31 -0
- package/esm/instrument-search/SearchCell.js.map +1 -0
- package/esm/instrument-search/useInstrumentSearch.js +37 -0
- package/esm/instrument-search/useInstrumentSearch.js.map +1 -0
- package/esm/list/CheckboxIcon.css.js +4 -0
- package/esm/list/CheckboxIcon.css.js.map +1 -0
- package/esm/list/CheckboxIcon.js +31 -0
- package/esm/list/CheckboxIcon.js.map +1 -0
- package/esm/list/ChevronIcon.css.js +4 -0
- package/esm/list/ChevronIcon.css.js.map +1 -0
- package/esm/list/ChevronIcon.js +20 -0
- package/esm/list/ChevronIcon.js.map +1 -0
- package/esm/list/Highlighter.css.js +4 -0
- package/esm/list/Highlighter.css.js.map +1 -0
- package/esm/list/Highlighter.js +34 -0
- package/esm/list/Highlighter.js.map +1 -0
- package/esm/list/List.css.js +4 -0
- package/esm/list/List.css.js.map +1 -0
- package/esm/list/List.js +315 -0
- package/esm/list/List.js.map +1 -0
- package/esm/list/ListItem.css.js +4 -0
- package/esm/list/ListItem.css.js.map +1 -0
- package/esm/list/ListItem.js +81 -0
- package/esm/list/ListItem.js.map +1 -0
- package/esm/list/ListItemGroup.js +4 -0
- package/esm/list/ListItemGroup.js.map +1 -0
- package/esm/list/ListItemHeader.js +4 -0
- package/esm/list/ListItemHeader.js.map +1 -0
- package/esm/list/RadioIcon.css.js +4 -0
- package/esm/list/RadioIcon.css.js.map +1 -0
- package/esm/list/RadioIcon.js +25 -0
- package/esm/list/RadioIcon.js.map +1 -0
- package/esm/list/common-hooks/keyUtils.js +64 -0
- package/esm/list/common-hooks/keyUtils.js.map +1 -0
- package/esm/list/common-hooks/list-dom-utils.js +19 -0
- package/esm/list/common-hooks/list-dom-utils.js.map +1 -0
- package/esm/list/common-hooks/useCollapsibleGroups.js +80 -0
- package/esm/list/common-hooks/useCollapsibleGroups.js.map +1 -0
- package/esm/list/common-hooks/useImperativeScrollingAPI.js +50 -0
- package/esm/list/common-hooks/useImperativeScrollingAPI.js.map +1 -0
- package/esm/list/common-hooks/useKeyboardNavigation.js +286 -0
- package/esm/list/common-hooks/useKeyboardNavigation.js.map +1 -0
- package/esm/list/common-hooks/useTypeahead.js +72 -0
- package/esm/list/common-hooks/useTypeahead.js.map +1 -0
- package/esm/list/common-hooks/useViewportTracking.js +131 -0
- package/esm/list/common-hooks/useViewportTracking.js.map +1 -0
- package/esm/list/common-hooks/utils/collection-item-utils.js +167 -0
- package/esm/list/common-hooks/utils/collection-item-utils.js.map +1 -0
- package/esm/list/common-hooks/utils/filter-utils.js +8 -0
- package/esm/list/common-hooks/utils/filter-utils.js.map +1 -0
- package/esm/list/common-hooks/utils/isSelected.js +7 -0
- package/esm/list/common-hooks/utils/isSelected.js.map +1 -0
- package/esm/list/useList.js +276 -0
- package/esm/list/useList.js.map +1 -0
- package/esm/list/useListDrop.js +90 -0
- package/esm/list/useListDrop.js.map +1 -0
- package/esm/list/useListHeight.js +75 -0
- package/esm/list/useListHeight.js.map +1 -0
- package/esm/list/useScrollPosition.js +72 -0
- package/esm/list/useScrollPosition.js.map +1 -0
- package/esm/measured-container/MeasuredContainer.css.js +4 -0
- package/esm/measured-container/MeasuredContainer.css.js.map +1 -0
- package/esm/measured-container/MeasuredContainer.js +67 -0
- package/esm/measured-container/MeasuredContainer.js.map +1 -0
- package/esm/measured-container/useMeasuredContainer.js +125 -0
- package/esm/measured-container/useMeasuredContainer.js.map +1 -0
- package/esm/measured-container/useResizeObserver.js +128 -0
- package/esm/measured-container/useResizeObserver.js.map +1 -0
- package/esm/overflow-container/OverflowContainer.css.js +4 -0
- package/esm/overflow-container/OverflowContainer.css.js.map +1 -0
- package/esm/overflow-container/OverflowContainer.js +140 -0
- package/esm/overflow-container/OverflowContainer.js.map +1 -0
- package/esm/overflow-container/overflow-utils.js +272 -0
- package/esm/overflow-container/overflow-utils.js.map +1 -0
- package/esm/overflow-container/useOverflowContainer.js +141 -0
- package/esm/overflow-container/useOverflowContainer.js.map +1 -0
- package/esm/price-ticker/PriceTicker.css.js +4 -0
- package/esm/price-ticker/PriceTicker.css.js.map +1 -0
- package/esm/price-ticker/PriceTicker.js +48 -0
- package/esm/price-ticker/PriceTicker.js.map +1 -0
- package/esm/split-button/SplitButton.css.js +4 -0
- package/esm/split-button/SplitButton.css.js.map +1 -0
- package/esm/split-button/SplitButton.js +79 -0
- package/esm/split-button/SplitButton.js.map +1 -0
- package/esm/split-button/SplitStateButton.css.js +4 -0
- package/esm/split-button/SplitStateButton.css.js.map +1 -0
- package/esm/split-button/SplitStateButton.js +29 -0
- package/esm/split-button/SplitStateButton.js.map +1 -0
- package/esm/split-button/useSplitButton.js +82 -0
- package/esm/split-button/useSplitButton.js.map +1 -0
- package/esm/tabstrip/Tab.css.js +4 -0
- package/esm/tabstrip/Tab.css.js.map +1 -0
- package/esm/tabstrip/Tab.js +149 -0
- package/esm/tabstrip/Tab.js.map +1 -0
- package/esm/tabstrip/TabMenu.css.js +4 -0
- package/esm/tabstrip/TabMenu.css.js.map +1 -0
- package/esm/tabstrip/TabMenu.js +70 -0
- package/esm/tabstrip/TabMenu.js.map +1 -0
- package/esm/tabstrip/TabMenuOptions.js +16 -0
- package/esm/tabstrip/TabMenuOptions.js.map +1 -0
- package/esm/tabstrip/Tabstrip.css.js +4 -0
- package/esm/tabstrip/Tabstrip.css.js.map +1 -0
- package/esm/tabstrip/Tabstrip.js +154 -0
- package/esm/tabstrip/Tabstrip.js.map +1 -0
- package/esm/tabstrip/tabstrip-dom-utils.js +16 -0
- package/esm/tabstrip/tabstrip-dom-utils.js.map +1 -0
- package/esm/tabstrip/useAnimatedSelectionThumb.js +83 -0
- package/esm/tabstrip/useAnimatedSelectionThumb.js.map +1 -0
- package/esm/tabstrip/useKeyboardNavigation.js +241 -0
- package/esm/tabstrip/useKeyboardNavigation.js.map +1 -0
- package/esm/tabstrip/useSelection.js +58 -0
- package/esm/tabstrip/useSelection.js.map +1 -0
- package/esm/tabstrip/useTabstrip.js +259 -0
- package/esm/tabstrip/useTabstrip.js.map +1 -0
- package/esm/toolbar/Toolbar.css.js +4 -0
- package/esm/toolbar/Toolbar.css.js.map +1 -0
- package/esm/toolbar/Toolbar.js +88 -0
- package/esm/toolbar/Toolbar.js.map +1 -0
- package/esm/toolbar/toolbar-dom-utils.js +15 -0
- package/esm/toolbar/toolbar-dom-utils.js.map +1 -0
- package/esm/toolbar/useKeyboardNavigation.js +303 -0
- package/esm/toolbar/useKeyboardNavigation.js.map +1 -0
- package/esm/toolbar/useSelection.js +92 -0
- package/esm/toolbar/useSelection.js.map +1 -0
- package/esm/toolbar/useToolbar.js +98 -0
- package/esm/toolbar/useToolbar.js.map +1 -0
- package/esm/tree/Tree.css.js +4 -0
- package/esm/tree/Tree.css.js.map +1 -0
- package/esm/tree/Tree.js +176 -0
- package/esm/tree/Tree.js.map +1 -0
- package/esm/tree/hierarchical-data-utils.js +65 -0
- package/esm/tree/hierarchical-data-utils.js.map +1 -0
- package/esm/tree/key-code.js +54 -0
- package/esm/tree/key-code.js.map +1 -0
- package/esm/tree/list-dom-utils.js +15 -0
- package/esm/tree/list-dom-utils.js.map +1 -0
- package/esm/tree/treeTypeUtils.js +4 -0
- package/esm/tree/treeTypeUtils.js.map +1 -0
- package/esm/tree/use-collapsible-groups.js +83 -0
- package/esm/tree/use-collapsible-groups.js.map +1 -0
- package/esm/tree/use-hierarchical-data.js +49 -0
- package/esm/tree/use-hierarchical-data.js.map +1 -0
- package/esm/tree/use-items-with-ids.js +98 -0
- package/esm/tree/use-items-with-ids.js.map +1 -0
- package/esm/tree/use-keyboard-navigation.js +142 -0
- package/esm/tree/use-keyboard-navigation.js.map +1 -0
- package/esm/tree/use-selection.js +147 -0
- package/esm/tree/use-selection.js.map +1 -0
- package/esm/tree/use-tree-keyboard-navigation.js +39 -0
- package/esm/tree/use-tree-keyboard-navigation.js.map +1 -0
- package/esm/tree/use-viewport-tracking.js +74 -0
- package/esm/tree/use-viewport-tracking.js.map +1 -0
- package/esm/tree/useTree.js +104 -0
- package/esm/tree/useTree.js.map +1 -0
- package/esm/utils/escapeRegExp.js +7 -0
- package/esm/utils/escapeRegExp.js.map +1 -0
- package/esm/utils/forwardCallbackProps.js +20 -0
- package/esm/utils/forwardCallbackProps.js.map +1 -0
- package/esm/utils/isOverflowElement.js +6 -0
- package/esm/utils/isOverflowElement.js.map +1 -0
- package/esm/vuu-input/VuuInput.css.js +4 -0
- package/esm/vuu-input/VuuInput.css.js.map +1 -0
- package/esm/vuu-input/VuuInput.js +103 -0
- package/esm/vuu-input/VuuInput.js.map +1 -0
- package/package.json +45 -0
- package/types/calendar/Calendar.d.ts +12 -0
- package/types/calendar/index.d.ts +4 -0
- package/types/calendar/internal/CalendarCarousel.d.ts +4 -0
- package/types/calendar/internal/CalendarContext.d.ts +9 -0
- package/types/calendar/internal/CalendarDay.d.ts +14 -0
- package/types/calendar/internal/CalendarMonth.d.ts +11 -0
- package/types/calendar/internal/CalendarNavigation.d.ts +20 -0
- package/types/calendar/internal/CalendarWeekHeader.d.ts +5 -0
- package/types/calendar/internal/useFocusManagement.d.ts +9 -0
- package/types/calendar/internal/utils.d.ts +14 -0
- package/types/calendar/useCalendar.d.ts +57 -0
- package/types/calendar/useCalendarDay.d.ts +19 -0
- package/types/calendar/useSelection.d.ts +75 -0
- package/types/combo-box/ComboBox.d.ts +24 -0
- package/types/combo-box/index.d.ts +1 -0
- package/types/combo-box/useCombobox.d.ts +20 -0
- package/types/common-hooks/collectionProvider.d.ts +13 -0
- package/types/common-hooks/collectionTypes.d.ts +58 -0
- package/types/common-hooks/index.d.ts +9 -0
- package/types/common-hooks/isPlainObject.d.ts +1 -0
- package/types/common-hooks/itemToString.d.ts +2 -0
- package/types/common-hooks/navigationTypes.d.ts +36 -0
- package/types/common-hooks/selectionTypes.d.ts +70 -0
- package/types/common-hooks/use-resize-observer.d.ts +16 -0
- package/types/common-hooks/useCollectionItems.d.ts +2 -0
- package/types/common-hooks/useControlled.d.ts +24 -0
- package/types/common-hooks/useSelection.d.ts +8 -0
- package/types/common-hooks/useStateRef.d.ts +2 -0
- package/types/cycle-state-button/CycleStateButton.d.ts +12 -0
- package/types/cycle-state-button/index.d.ts +1 -0
- package/types/date-input/DateInput.d.ts +12 -0
- package/types/date-input/DateRangeInput.d.ts +11 -0
- package/types/date-input/index.d.ts +2 -0
- package/types/date-input/types.d.ts +16 -0
- package/types/date-input/useBaseDatePickerDropdown.d.ts +15 -0
- package/types/date-input/useDatePicker.d.ts +7 -0
- package/types/date-popup/DatePopup.d.ts +12 -0
- package/types/date-popup/index.d.ts +1 -0
- package/types/date-popup/useDatePopup.d.ts +20 -0
- package/types/drag-drop/DragDropProvider.d.ts +38 -0
- package/types/drag-drop/DragDropState.d.ts +15 -0
- package/types/drag-drop/Draggable.d.ts +13 -0
- package/types/drag-drop/DropIndicator.d.ts +6 -0
- package/types/drag-drop/dragDropTypes.d.ts +100 -0
- package/types/drag-drop/drop-target-utils.d.ts +78 -0
- package/types/drag-drop/index.d.ts +6 -0
- package/types/drag-drop/useAutoScroll.d.ts +11 -0
- package/types/drag-drop/useDragDisplacers.d.ts +17 -0
- package/types/drag-drop/useDragDrop.d.ts +2 -0
- package/types/drag-drop/useDragDropCopy.d.ts +6 -0
- package/types/drag-drop/useDragDropIndicator.d.ts +2 -0
- package/types/drag-drop/useDragDropNaturalMovement.d.ts +2 -0
- package/types/drag-drop/useDropIndicator.d.ts +8 -0
- package/types/drag-drop/useGlobalDragDrop.d.ts +12 -0
- package/types/drag-drop/useTransition.d.ts +3 -0
- package/types/dropdown/Dropdown.d.ts +10 -0
- package/types/dropdown/DropdownBase.d.ts +9 -0
- package/types/dropdown/DropdownButton.d.ts +41 -0
- package/types/dropdown/dropdownTypes.d.ts +51 -0
- package/types/dropdown/index.d.ts +5 -0
- package/types/dropdown/useClickAway.d.ts +10 -0
- package/types/dropdown/useDropdown.d.ts +13 -0
- package/types/dropdown/useDropdownBase.d.ts +2 -0
- package/types/editable/editable-utils.d.ts +2 -0
- package/types/editable/index.d.ts +2 -0
- package/types/editable/useEditableText.d.ts +19 -0
- package/types/editable-label/EditableLabel.d.ts +19 -0
- package/types/editable-label/index.d.ts +1 -0
- package/types/expando-input/ExpandoInput.d.ts +6 -0
- package/types/expando-input/index.d.ts +1 -0
- package/types/icon-button/Icon.d.ts +6 -0
- package/types/icon-button/IconButton.d.ts +7 -0
- package/types/icon-button/index.d.ts +2 -0
- package/types/index.d.ts +27 -0
- package/types/inputs/Checkbox.d.ts +9 -0
- package/types/inputs/RadioButton.d.ts +9 -0
- package/types/inputs/index.d.ts +2 -0
- package/types/instrument-picker/InstrumentPicker.d.ts +24 -0
- package/types/instrument-picker/SearchCell.d.ts +3 -0
- package/types/instrument-picker/index.d.ts +1 -0
- package/types/instrument-picker/moving-window.d.ts +14 -0
- package/types/instrument-picker/useDataSource.d.ts +6 -0
- package/types/instrument-picker/useInstrumentPicker.d.ts +28 -0
- package/types/instrument-search/InstrumentSearch.d.ts +11 -0
- package/types/instrument-search/SearchCell.d.ts +3 -0
- package/types/instrument-search/index.d.ts +1 -0
- package/types/instrument-search/moving-window.d.ts +14 -0
- package/types/instrument-search/useDataSource.d.ts +6 -0
- package/types/instrument-search/useInstrumentSearch.d.ts +13 -0
- package/types/list/CheckboxIcon.d.ts +6 -0
- package/types/list/ChevronIcon.d.ts +7 -0
- package/types/list/Highlighter.d.ts +6 -0
- package/types/list/List.d.ts +6 -0
- package/types/list/ListItem.d.ts +6 -0
- package/types/list/ListItemGroup.d.ts +6 -0
- package/types/list/ListItemHeader.d.ts +5 -0
- package/types/list/RadioIcon.d.ts +5 -0
- package/types/list/common-hooks/index.d.ts +10 -0
- package/types/list/common-hooks/keyUtils.d.ts +14 -0
- package/types/list/common-hooks/list-dom-utils.d.ts +5 -0
- package/types/list/common-hooks/useCollapsibleGroups.d.ts +14 -0
- package/types/list/common-hooks/useImperativeScrollingAPI.d.ts +14 -0
- package/types/list/common-hooks/useKeyboardNavigation.d.ts +3 -0
- package/types/list/common-hooks/useTypeahead.d.ts +15 -0
- package/types/list/common-hooks/useViewportTracking.d.ts +14 -0
- package/types/list/common-hooks/utils/collection-item-utils.d.ts +21 -0
- package/types/list/common-hooks/utils/filter-utils.d.ts +4 -0
- package/types/list/common-hooks/utils/index.d.ts +4 -0
- package/types/list/common-hooks/utils/isSelected.d.ts +2 -0
- package/types/list/index.d.ts +10 -0
- package/types/list/keyset.d.ts +9 -0
- package/types/list/listTypes.d.ts +200 -0
- package/types/list/useList.d.ts +3 -0
- package/types/list/useListDrop.d.ts +15 -0
- package/types/list/useListHeight.d.ts +19 -0
- package/types/list/useScrollPosition.d.ts +19 -0
- package/types/measured-container/MeasuredContainer.d.ts +14 -0
- package/types/measured-container/index.d.ts +2 -0
- package/types/measured-container/useMeasuredContainer.d.ts +22 -0
- package/types/measured-container/useResizeObserver.d.ts +15 -0
- package/types/overflow-container/OverflowContainer.d.ts +15 -0
- package/types/overflow-container/index.d.ts +2 -0
- package/types/overflow-container/overflow-utils.d.ts +48 -0
- package/types/overflow-container/useOverflowContainer.d.ts +20 -0
- package/types/price-ticker/PriceTicker.d.ts +7 -0
- package/types/price-ticker/index.d.ts +1 -0
- package/types/split-button/SplitButton.d.ts +11 -0
- package/types/split-button/SplitStateButton.d.ts +6 -0
- package/types/split-button/index.d.ts +2 -0
- package/types/split-button/useSplitButton.d.ts +288 -0
- package/types/tabstrip/Tab.d.ts +26 -0
- package/types/tabstrip/TabMenu.d.ts +19 -0
- package/types/tabstrip/TabMenuOptions.d.ts +10 -0
- package/types/tabstrip/TabsTypes.d.ts +127 -0
- package/types/tabstrip/Tabstrip.d.ts +3 -0
- package/types/tabstrip/index.d.ts +4 -0
- package/types/tabstrip/tabstrip-dom-utils.d.ts +2 -0
- package/types/tabstrip/useAnimatedSelectionThumb.d.ts +7 -0
- package/types/tabstrip/useKeyboardNavigation.d.ts +29 -0
- package/types/tabstrip/useSelection.d.ts +13 -0
- package/types/tabstrip/useTabstrip.d.ts +49 -0
- package/types/toolbar/Toolbar.d.ts +20 -0
- package/types/toolbar/index.d.ts +1 -0
- package/types/toolbar/toolbar-dom-utils.d.ts +3 -0
- package/types/toolbar/useKeyboardNavigation.d.ts +32 -0
- package/types/toolbar/useSelection.d.ts +22 -0
- package/types/toolbar/useToolbar.d.ts +28 -0
- package/types/tree/Tree.d.ts +19 -0
- package/types/tree/hierarchical-data-utils.d.ts +8 -0
- package/types/tree/index.d.ts +4 -0
- package/types/tree/key-code.d.ts +11 -0
- package/types/tree/list-dom-utils.d.ts +6 -0
- package/types/tree/treeTypeUtils.d.ts +2 -0
- package/types/tree/treeTypes.d.ts +17 -0
- package/types/tree/use-collapsible-groups.d.ts +18 -0
- package/types/tree/use-hierarchical-data.d.ts +6 -0
- package/types/tree/use-items-with-ids.d.ts +8 -0
- package/types/tree/use-keyboard-navigation.d.ts +26 -0
- package/types/tree/use-selection.d.ts +31 -0
- package/types/tree/use-tree-keyboard-navigation.d.ts +12 -0
- package/types/tree/use-viewport-tracking.d.ts +2 -0
- package/types/tree/useTree.d.ts +30 -0
- package/types/utils/escapeRegExp.d.ts +1 -0
- package/types/utils/forwardCallbackProps.d.ts +3 -0
- package/types/utils/index.d.ts +3 -0
- package/types/utils/isOverflowElement.d.ts +1 -0
- package/types/vuu-input/VuuInput.d.ts +16 -0
- package/types/vuu-input/index.d.ts +1 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const LEFT_RIGHT = ["left", "right"];
|
|
4
|
+
const TOP_BOTTOM = ["top", "bottom"];
|
|
5
|
+
const NOT_OVERFLOWED = ":not(.wrapped)";
|
|
6
|
+
const NOT_HIDDEN = ':not([aria-hidden="true"])';
|
|
7
|
+
const cloneElement = (element) => {
|
|
8
|
+
const dolly = element.cloneNode(true);
|
|
9
|
+
dolly.removeAttribute("id");
|
|
10
|
+
dolly.dataset.index = "-1";
|
|
11
|
+
return dolly;
|
|
12
|
+
};
|
|
13
|
+
const measureElementSizeAndPosition = (element, dimension = "width", includeAutoMargin = false) => {
|
|
14
|
+
const pos = dimension === "width" ? "left" : "top";
|
|
15
|
+
const { [dimension]: size, [pos]: position } = element.getBoundingClientRect();
|
|
16
|
+
const { padEnd = false, padStart = false } = element.dataset;
|
|
17
|
+
const style = getComputedStyle(element);
|
|
18
|
+
const [start, end] = dimension === "width" ? LEFT_RIGHT : TOP_BOTTOM;
|
|
19
|
+
const marginStart = padStart && !includeAutoMargin ? 0 : parseInt(style.getPropertyValue(`margin-${start}`), 10);
|
|
20
|
+
const marginEnd = padEnd && !includeAutoMargin ? 0 : parseInt(style.getPropertyValue(`margin-${end}`), 10);
|
|
21
|
+
let minWidth = size;
|
|
22
|
+
const flexShrink = parseInt(style.getPropertyValue("flex-shrink"), 10);
|
|
23
|
+
if (flexShrink > 0) {
|
|
24
|
+
const flexBasis = parseInt(style.getPropertyValue("flex-basis"), 10);
|
|
25
|
+
if (!isNaN(flexBasis) && flexBasis > 0) {
|
|
26
|
+
minWidth = flexBasis;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return [position, marginStart + minWidth + marginEnd];
|
|
30
|
+
};
|
|
31
|
+
const DIMENSIONS = {
|
|
32
|
+
horizontal: {
|
|
33
|
+
CLIENT_POS: "clientX",
|
|
34
|
+
CLIENT_SIZE: "clientWidth",
|
|
35
|
+
CONTRA: "top",
|
|
36
|
+
CONTRA_CLIENT_POS: "clientY",
|
|
37
|
+
CONTRA_END: "bottom",
|
|
38
|
+
CONTRA_POS: "y",
|
|
39
|
+
DIMENSION: "width",
|
|
40
|
+
END: "right",
|
|
41
|
+
POS: "x",
|
|
42
|
+
SCROLL_POS: "scrollLeft",
|
|
43
|
+
SCROLL_SIZE: "scrollWidth",
|
|
44
|
+
START: "left"
|
|
45
|
+
},
|
|
46
|
+
vertical: {
|
|
47
|
+
CLIENT_POS: "clientY",
|
|
48
|
+
CLIENT_SIZE: "clientHeight",
|
|
49
|
+
CONTRA: "left",
|
|
50
|
+
CONTRA_CLIENT_POS: "clientX",
|
|
51
|
+
CONTRA_END: "right",
|
|
52
|
+
CONTRA_POS: "x",
|
|
53
|
+
DIMENSION: "height",
|
|
54
|
+
END: "bottom",
|
|
55
|
+
POS: "y",
|
|
56
|
+
SCROLL_POS: "scrollTop",
|
|
57
|
+
SCROLL_SIZE: "scrollHeight",
|
|
58
|
+
START: "top"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const dimensions = (orientation) => DIMENSIONS[orientation];
|
|
62
|
+
const getItemById = (measuredItems, id) => {
|
|
63
|
+
const result = measuredItems.find((item) => item.id === id);
|
|
64
|
+
if (result) {
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const removeDraggedItem = (measuredItems, index) => {
|
|
69
|
+
measuredItems.splice(index, 1);
|
|
70
|
+
for (let i = index; i < measuredItems.length; i++) {
|
|
71
|
+
measuredItems[i].currentIndex -= 1;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const measureDropTargets = (container, orientation, itemQuery, viewportRange, draggedItemId) => {
|
|
75
|
+
const dragThresholds = [];
|
|
76
|
+
const { DIMENSION } = dimensions(orientation);
|
|
77
|
+
const children = Array.from(
|
|
78
|
+
itemQuery ? container.querySelectorAll(itemQuery) : container.children
|
|
79
|
+
);
|
|
80
|
+
const itemCount = children.length;
|
|
81
|
+
const start = typeof viewportRange?.from === "number" ? viewportRange.atEnd ? Math.max(0, viewportRange.from - 1) : viewportRange.from : 0;
|
|
82
|
+
const end = typeof viewportRange?.to === "number" ? Math.min(viewportRange.to + 2, itemCount - 1) : itemCount - 1;
|
|
83
|
+
for (let index = start; index <= end; index++) {
|
|
84
|
+
const element = children[index];
|
|
85
|
+
const [start2, size] = measureElementSizeAndPosition(element, DIMENSION);
|
|
86
|
+
const isLast = index === itemCount - 1;
|
|
87
|
+
const id = element.id;
|
|
88
|
+
dragThresholds.push({
|
|
89
|
+
currentIndex: index,
|
|
90
|
+
id,
|
|
91
|
+
index,
|
|
92
|
+
isDraggedItem: draggedItemId === id,
|
|
93
|
+
isLast,
|
|
94
|
+
isOverflowIndicator: element.dataset.index === "overflow",
|
|
95
|
+
element,
|
|
96
|
+
start: start2,
|
|
97
|
+
end: start2 + size,
|
|
98
|
+
size,
|
|
99
|
+
mid: start2 + size / 2
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return dragThresholds;
|
|
103
|
+
};
|
|
104
|
+
const getIndexOfDraggedItem = (dropTargets) => dropTargets.findIndex((d) => d.isDraggedItem);
|
|
105
|
+
const mutateDropTargetsSwitchDropTargetPosition = (dropTargets, direction) => {
|
|
106
|
+
const indexOfDraggedItem = getIndexOfDraggedItem(dropTargets);
|
|
107
|
+
const indexOfTarget = direction === "fwd" ? indexOfDraggedItem + 1 : indexOfDraggedItem - 1;
|
|
108
|
+
if (indexOfTarget < 0 || indexOfTarget >= dropTargets.length) {
|
|
109
|
+
throw Error("switchDropTargetPosition index out of range");
|
|
110
|
+
}
|
|
111
|
+
const draggedItem = dropTargets.at(indexOfDraggedItem);
|
|
112
|
+
const targetItem = dropTargets.at(indexOfTarget);
|
|
113
|
+
const diff = targetItem.size - draggedItem.size;
|
|
114
|
+
if (direction === "fwd") {
|
|
115
|
+
const draggedStart = targetItem.start + diff;
|
|
116
|
+
const draggedEnd = targetItem.end;
|
|
117
|
+
const newDraggedItem = {
|
|
118
|
+
...draggedItem,
|
|
119
|
+
start: draggedStart,
|
|
120
|
+
mid: Math.floor(draggedStart + (draggedEnd - draggedStart) / 2),
|
|
121
|
+
end: draggedEnd
|
|
122
|
+
};
|
|
123
|
+
const targetStart = draggedItem.start;
|
|
124
|
+
const targetEnd = draggedItem.end + diff;
|
|
125
|
+
const newTargetItem = {
|
|
126
|
+
...targetItem,
|
|
127
|
+
start: targetStart,
|
|
128
|
+
mid: Math.floor(targetStart + (targetEnd - targetStart) / 2),
|
|
129
|
+
end: targetEnd
|
|
130
|
+
};
|
|
131
|
+
dropTargets.splice(indexOfDraggedItem, 2, newTargetItem, newDraggedItem);
|
|
132
|
+
} else {
|
|
133
|
+
const draggedStart = targetItem.start;
|
|
134
|
+
const draggedEnd = targetItem.end - diff;
|
|
135
|
+
const newDraggedItem = {
|
|
136
|
+
...draggedItem,
|
|
137
|
+
start: draggedStart,
|
|
138
|
+
mid: Math.floor(draggedStart + (draggedEnd - draggedStart) / 2),
|
|
139
|
+
end: draggedEnd
|
|
140
|
+
};
|
|
141
|
+
const targetStart = draggedItem.start - diff;
|
|
142
|
+
const targetEnd = draggedItem.end;
|
|
143
|
+
const newTargetItem = {
|
|
144
|
+
...targetItem,
|
|
145
|
+
start: targetStart,
|
|
146
|
+
mid: Math.floor(targetStart + (targetEnd - targetStart) / 2),
|
|
147
|
+
end: targetEnd
|
|
148
|
+
};
|
|
149
|
+
dropTargets.splice(indexOfTarget, 2, newDraggedItem, newTargetItem);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const getNextDropTarget = (dropTargets, pos, draggedItemSize, mouseMoveDirection) => {
|
|
153
|
+
const len = dropTargets.length;
|
|
154
|
+
const indexOfDraggedItem = getIndexOfDraggedItem(dropTargets);
|
|
155
|
+
const draggedItem = dropTargets[indexOfDraggedItem];
|
|
156
|
+
if (mouseMoveDirection === "fwd") {
|
|
157
|
+
const leadingEdge = Math.round(pos + draggedItemSize);
|
|
158
|
+
for (let index = len - 1; index >= 0; index--) {
|
|
159
|
+
const dropTarget = dropTargets[index];
|
|
160
|
+
if (leadingEdge > dropTarget.mid) {
|
|
161
|
+
if (draggedItem && index < indexOfDraggedItem) {
|
|
162
|
+
return draggedItem;
|
|
163
|
+
} else {
|
|
164
|
+
return dropTarget;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
const leadingEdge = Math.round(pos);
|
|
170
|
+
for (let index = 0; index < len; index++) {
|
|
171
|
+
const dropTarget = dropTargets[index];
|
|
172
|
+
if (leadingEdge < dropTarget.mid) {
|
|
173
|
+
if (index > indexOfDraggedItem) {
|
|
174
|
+
return draggedItem;
|
|
175
|
+
} else {
|
|
176
|
+
return dropTarget;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
throw Error("no dropTarget identified");
|
|
182
|
+
};
|
|
183
|
+
function constrainRect(targetRect, constraintRect) {
|
|
184
|
+
const { height, left, top, width } = targetRect;
|
|
185
|
+
const { height: constrainedHeight, width: constrainedWidth } = constraintRect;
|
|
186
|
+
return {
|
|
187
|
+
height: Math.min(height, constrainedHeight),
|
|
188
|
+
left,
|
|
189
|
+
top,
|
|
190
|
+
width: Math.min(width, constrainedWidth)
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const dropTargetsDebugString = (dropTargets) => dropTargets.map(
|
|
194
|
+
(d, i) => `
|
|
195
|
+
${d.isDraggedItem ? "*" : " "}[${i}] width : ${Math.floor(
|
|
196
|
+
d.size
|
|
197
|
+
)} ${Math.floor(d.start)} - ${Math.floor(d.end)} (mid ${Math.floor(
|
|
198
|
+
d.mid
|
|
199
|
+
)}) ${d.element?.textContent} `
|
|
200
|
+
).join("");
|
|
201
|
+
const getItemParentContainer = (container, itemQuery) => {
|
|
202
|
+
const firstItem = container?.querySelector(
|
|
203
|
+
`${itemQuery}:not([aria-hidden="true"])`
|
|
204
|
+
);
|
|
205
|
+
if (firstItem) {
|
|
206
|
+
return firstItem.parentElement;
|
|
207
|
+
} else {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const getScrollableContainer = (container, itemQuery) => {
|
|
212
|
+
const immediateParent = getItemParentContainer(container, itemQuery);
|
|
213
|
+
if (immediateParent === container) {
|
|
214
|
+
return container;
|
|
215
|
+
} else {
|
|
216
|
+
return immediateParent?.parentElement;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const isContainerScrollable = (scrollableContainer, orientation) => {
|
|
220
|
+
if (scrollableContainer === null) {
|
|
221
|
+
return false;
|
|
222
|
+
} else {
|
|
223
|
+
const { SCROLL_SIZE, CLIENT_SIZE } = dimensions(orientation);
|
|
224
|
+
const { [SCROLL_SIZE]: scrollSize, [CLIENT_SIZE]: clientSize } = scrollableContainer;
|
|
225
|
+
return scrollSize > clientSize;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
exports.NOT_HIDDEN = NOT_HIDDEN;
|
|
230
|
+
exports.NOT_OVERFLOWED = NOT_OVERFLOWED;
|
|
231
|
+
exports.cloneElement = cloneElement;
|
|
232
|
+
exports.constrainRect = constrainRect;
|
|
233
|
+
exports.dimensions = dimensions;
|
|
234
|
+
exports.dropTargetsDebugString = dropTargetsDebugString;
|
|
235
|
+
exports.getIndexOfDraggedItem = getIndexOfDraggedItem;
|
|
236
|
+
exports.getItemById = getItemById;
|
|
237
|
+
exports.getItemParentContainer = getItemParentContainer;
|
|
238
|
+
exports.getNextDropTarget = getNextDropTarget;
|
|
239
|
+
exports.getScrollableContainer = getScrollableContainer;
|
|
240
|
+
exports.isContainerScrollable = isContainerScrollable;
|
|
241
|
+
exports.measureDropTargets = measureDropTargets;
|
|
242
|
+
exports.measureElementSizeAndPosition = measureElementSizeAndPosition;
|
|
243
|
+
exports.mutateDropTargetsSwitchDropTargetPosition = mutateDropTargetsSwitchDropTargetPosition;
|
|
244
|
+
exports.removeDraggedItem = removeDraggedItem;
|
|
245
|
+
//# sourceMappingURL=drop-target-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-target-utils.js","sources":["../../src/drag-drop/drop-target-utils.ts"],"sourcesContent":["import { orientationType } from \"@vuu-ui/vuu-utils\";\nimport { ViewportRange } from \"./dragDropTypes\";\nimport { Direction, Rect } from \"./dragDropTypes\";\n\nconst LEFT_RIGHT = [\"left\", \"right\"];\nconst TOP_BOTTOM = [\"top\", \"bottom\"];\n// duplicated in repsonsive\n\nexport const NOT_OVERFLOWED = \":not(.wrapped)\";\nexport const NOT_HIDDEN = ':not([aria-hidden=\"true\"])';\n\n// TODO figure out which of these attributes we no longer need\nexport type MeasuredDropTarget = {\n /** \n The index position currently occupied by this item. If draggable \n is dropped here, this will be the destination drop position.\n */\n currentIndex: number;\n element: HTMLElement;\n id: string;\n index: number;\n isDraggedItem: boolean;\n isExternal?: boolean;\n isLast?: boolean;\n isOverflowIndicator?: boolean;\n start: number;\n end: number;\n mid: number;\n size: number;\n};\n\nexport type targetType = {\n element: HTMLElement | null;\n index: number;\n isLast?: boolean;\n};\n\n/** clones and removes id */\nexport const cloneElement = <T extends HTMLElement>(element: T): T => {\n const dolly = element.cloneNode(true) as T;\n // TOSO should we care about nested id values - perhaps an additional param, defaulting to false ?\n dolly.removeAttribute(\"id\");\n // Set index to -1 in case a moueMove event as we wait for drop to take effect might set highlighted\n // index to wrong value (see useList) -1 will be ignored;\n dolly.dataset.index = \"-1\";\n return dolly;\n};\n\ntype MousePosKey = keyof Pick<MouseEvent, \"clientX\" | \"clientY\">;\ntype DOMRectKey = keyof Omit<DOMRect, \"toJSON\">;\ntype DOMRectDimensionKey = keyof Pick<DOMRect, \"width\" | \"height\">;\ntype Dimension = keyof Pick<DOMRect, \"width\" | \"height\">;\ntype ElementDimension = keyof Pick<\n HTMLElement,\n | \"scrollHeight\"\n | \"scrollWidth\"\n | \"clientHeight\"\n | \"clientWidth\"\n | \"scrollTop\"\n | \"scrollLeft\"\n>;\n\ntype ElementPosition = \"x\" | \"y\";\n\nexport const measureElementSizeAndPosition = (\n element: HTMLElement,\n dimension: Dimension = \"width\",\n includeAutoMargin = false\n) => {\n const pos = dimension === \"width\" ? \"left\" : \"top\";\n const { [dimension]: size, [pos]: position } =\n element.getBoundingClientRect();\n const { padEnd = false, padStart = false } = element.dataset;\n const style = getComputedStyle(element);\n const [start, end] = dimension === \"width\" ? LEFT_RIGHT : TOP_BOTTOM;\n const marginStart =\n padStart && !includeAutoMargin\n ? 0\n : parseInt(style.getPropertyValue(`margin-${start}`), 10);\n const marginEnd =\n padEnd && !includeAutoMargin\n ? 0\n : parseInt(style.getPropertyValue(`margin-${end}`), 10);\n\n let minWidth = size;\n const flexShrink = parseInt(style.getPropertyValue(\"flex-shrink\"), 10);\n if (flexShrink > 0) {\n const flexBasis = parseInt(style.getPropertyValue(\"flex-basis\"), 10);\n if (!isNaN(flexBasis) && flexBasis > 0) {\n minWidth = flexBasis;\n }\n }\n return [position, marginStart + minWidth + marginEnd];\n};\n\nconst DIMENSIONS = {\n horizontal: {\n CLIENT_POS: \"clientX\" as MousePosKey,\n CLIENT_SIZE: \"clientWidth\" as ElementDimension,\n CONTRA: \"top\" as DOMRectKey,\n CONTRA_CLIENT_POS: \"clientY\" as MousePosKey,\n CONTRA_END: \"bottom\" as DOMRectDimensionKey,\n CONTRA_POS: \"y\" as ElementPosition,\n DIMENSION: \"width\" as DOMRectDimensionKey,\n END: \"right\" as DOMRectKey,\n POS: \"x\" as ElementPosition,\n SCROLL_POS: \"scrollLeft\" as ElementDimension,\n SCROLL_SIZE: \"scrollWidth\" as ElementDimension,\n START: \"left\" as DOMRectKey,\n },\n vertical: {\n CLIENT_POS: \"clientY\" as MousePosKey,\n CLIENT_SIZE: \"clientHeight\" as ElementDimension,\n CONTRA: \"left\" as DOMRectKey,\n CONTRA_CLIENT_POS: \"clientX\" as MousePosKey,\n CONTRA_END: \"right\" as DOMRectDimensionKey,\n CONTRA_POS: \"x\" as ElementPosition,\n DIMENSION: \"height\" as DOMRectDimensionKey,\n END: \"bottom\" as DOMRectKey,\n POS: \"y\" as ElementPosition,\n SCROLL_POS: \"scrollTop\" as ElementDimension,\n SCROLL_SIZE: \"scrollHeight\" as ElementDimension,\n START: \"top\" as DOMRectKey,\n },\n};\nexport const dimensions = (orientation: orientationType) =>\n DIMENSIONS[orientation];\n\nexport const getItemById = (\n measuredItems: MeasuredDropTarget[],\n id: string\n) => {\n const result = measuredItems.find((item) => item.id === id);\n if (result) {\n return result;\n }\n // else {\n // throw Error(`measuredItems do not contain an item with id #${id}`);\n // }\n};\n\nexport const removeDraggedItem = (\n measuredItems: MeasuredDropTarget[],\n index: number\n) => {\n measuredItems.splice(index, 1);\n for (let i = index; i < measuredItems.length; i++) {\n measuredItems[i].currentIndex -= 1;\n }\n};\n\nexport type dropZone = \"start\" | \"end\";\n\nexport const measureDropTargets = (\n container: HTMLElement,\n orientation: orientationType,\n itemQuery?: string,\n viewportRange?: ViewportRange,\n draggedItemId?: string\n) => {\n const dragThresholds: MeasuredDropTarget[] = [];\n const { DIMENSION } = dimensions(orientation);\n const children = Array.from(\n itemQuery ? container.querySelectorAll(itemQuery) : container.children\n );\n\n const itemCount = children.length;\n const start =\n typeof viewportRange?.from === \"number\"\n ? viewportRange.atEnd\n ? Math.max(0, viewportRange.from - 1)\n : viewportRange.from\n : 0;\n const end =\n typeof viewportRange?.to === \"number\"\n ? Math.min(viewportRange.to + 2, itemCount - 1)\n : itemCount - 1;\n for (let index = start; index <= end; index++) {\n const element = children[index] as HTMLElement;\n const [start, size] = measureElementSizeAndPosition(element, DIMENSION);\n const isLast = index === itemCount - 1;\n const id = element.id;\n\n dragThresholds.push({\n currentIndex: index,\n id,\n index,\n isDraggedItem: draggedItemId === id,\n isLast,\n isOverflowIndicator: element.dataset.index === \"overflow\",\n element: element as HTMLElement,\n start,\n end: start + size,\n size,\n mid: start + size / 2,\n });\n }\n return dragThresholds;\n};\n\nexport const getIndexOfDraggedItem = (dropTargets: MeasuredDropTarget[]) =>\n dropTargets.findIndex((d) => d.isDraggedItem);\n\n// As the draggedItem is moved, displacing existing items, mirror\n// the movements within the dropTargets collection\nexport const mutateDropTargetsSwitchDropTargetPosition = (\n dropTargets: MeasuredDropTarget[],\n direction: Direction\n) => {\n const indexOfDraggedItem = getIndexOfDraggedItem(dropTargets);\n const indexOfTarget =\n direction === \"fwd\" ? indexOfDraggedItem + 1 : indexOfDraggedItem - 1;\n\n if (indexOfTarget < 0 || indexOfTarget >= dropTargets.length) {\n throw Error(\"switchDropTargetPosition index out of range\");\n }\n\n const draggedItem = dropTargets.at(indexOfDraggedItem) as MeasuredDropTarget;\n const targetItem = dropTargets.at(indexOfTarget) as MeasuredDropTarget;\n\n const diff = targetItem.size - draggedItem.size;\n\n if (direction === \"fwd\") {\n const draggedStart = targetItem.start + diff;\n const draggedEnd = targetItem.end;\n\n const newDraggedItem = {\n ...draggedItem,\n start: draggedStart,\n mid: Math.floor(draggedStart + (draggedEnd - draggedStart) / 2),\n end: draggedEnd,\n } as MeasuredDropTarget;\n\n const targetStart = draggedItem.start;\n const targetEnd = draggedItem.end + diff;\n\n const newTargetItem = {\n ...targetItem,\n start: targetStart,\n mid: Math.floor(targetStart + (targetEnd - targetStart) / 2),\n end: targetEnd,\n } as MeasuredDropTarget;\n dropTargets.splice(indexOfDraggedItem, 2, newTargetItem, newDraggedItem);\n } else {\n const draggedStart = targetItem.start;\n const draggedEnd = targetItem.end - diff;\n\n const newDraggedItem = {\n ...draggedItem,\n start: draggedStart,\n mid: Math.floor(draggedStart + (draggedEnd - draggedStart) / 2),\n end: draggedEnd,\n } as MeasuredDropTarget;\n\n const targetStart = draggedItem.start - diff;\n const targetEnd = draggedItem.end;\n\n const newTargetItem = {\n ...targetItem,\n start: targetStart,\n mid: Math.floor(targetStart + (targetEnd - targetStart) / 2),\n end: targetEnd,\n } as MeasuredDropTarget;\n dropTargets.splice(indexOfTarget, 2, newDraggedItem, newTargetItem);\n }\n};\n\nexport const getNextDropTarget = (\n dropTargets: MeasuredDropTarget[],\n pos: number,\n draggedItemSize: number,\n mouseMoveDirection: Direction\n): MeasuredDropTarget => {\n const len = dropTargets.length;\n const indexOfDraggedItem = getIndexOfDraggedItem(dropTargets);\n // draggedItem will be undefined if we are handling an external drag\n const draggedItem = dropTargets[indexOfDraggedItem];\n if (mouseMoveDirection === \"fwd\") {\n const leadingEdge = Math.round(pos + draggedItemSize);\n for (let index = len - 1; index >= 0; index--) {\n const dropTarget = dropTargets[index];\n if (leadingEdge > dropTarget.mid) {\n if (draggedItem && index < indexOfDraggedItem) {\n return draggedItem;\n } else {\n return dropTarget;\n }\n }\n }\n } else {\n const leadingEdge = Math.round(pos);\n for (let index = 0; index < len; index++) {\n const dropTarget = dropTargets[index];\n if (leadingEdge < dropTarget.mid) {\n if (index > indexOfDraggedItem) {\n return draggedItem;\n } else {\n return dropTarget;\n }\n }\n }\n }\n throw Error(\"no dropTarget identified\");\n};\n\n/**\n * An item within a scrollable container might have a width or height greater than that of\n * the container. If we drag such an item, we don't want the draggable to be larger than\n * the container.\n */\nexport function constrainRect(targetRect: Rect, constraintRect: Rect): Rect {\n const { height, left, top, width } = targetRect;\n const { height: constrainedHeight, width: constrainedWidth } = constraintRect;\n return {\n height: Math.min(height, constrainedHeight),\n left,\n top,\n width: Math.min(width, constrainedWidth),\n };\n}\n\nexport const dropTargetsDebugString = (dropTargets: MeasuredDropTarget[]) =>\n dropTargets\n .map(\n (d, i) =>\n `\\n${d.isDraggedItem ? \"*\" : \" \"}[${i}] width : ${Math.floor(\n d.size\n )} ${Math.floor(d.start)} - ${Math.floor(d.end)} (mid ${Math.floor(\n d.mid\n )}) ${d.element?.textContent} `\n )\n .join(\"\");\n\nexport const getItemParentContainer = (\n container: HTMLElement | null,\n itemQuery: string\n) => {\n const firstItem = container?.querySelector(\n `${itemQuery}:not([aria-hidden=\"true\"])`\n );\n if (firstItem) {\n // generally, we expect the immediateParent to be a contentContainer, the\n // parent of that will be the scrollable container. This may or may not be\n // the outer container (likely not)\n return firstItem.parentElement;\n } else {\n return null;\n }\n};\n\nexport const getScrollableContainer = (\n container: HTMLElement | null,\n itemQuery: string\n) => {\n const immediateParent = getItemParentContainer(container, itemQuery);\n if (immediateParent === container) {\n return container;\n } else {\n return immediateParent?.parentElement as HTMLElement;\n }\n};\n\nexport const isContainerScrollable = (\n scrollableContainer: HTMLElement | null,\n orientation: orientationType\n) => {\n if (scrollableContainer === null) {\n return false;\n } else {\n const { SCROLL_SIZE, CLIENT_SIZE } = dimensions(orientation);\n const { [SCROLL_SIZE]: scrollSize, [CLIENT_SIZE]: clientSize } =\n scrollableContainer;\n return scrollSize > clientSize;\n }\n};\n"],"names":["start"],"mappings":";;AAIA,MAAM,UAAA,GAAa,CAAC,MAAA,EAAQ,OAAO,CAAA,CAAA;AACnC,MAAM,UAAA,GAAa,CAAC,KAAA,EAAO,QAAQ,CAAA,CAAA;AAG5B,MAAM,cAAiB,GAAA,iBAAA;AACvB,MAAM,UAAa,GAAA,6BAAA;AA6Bb,MAAA,YAAA,GAAe,CAAwB,OAAkB,KAAA;AACpE,EAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,SAAA,CAAU,IAAI,CAAA,CAAA;AAEpC,EAAA,KAAA,CAAM,gBAAgB,IAAI,CAAA,CAAA;AAG1B,EAAA,KAAA,CAAM,QAAQ,KAAQ,GAAA,IAAA,CAAA;AACtB,EAAO,OAAA,KAAA,CAAA;AACT,EAAA;AAkBO,MAAM,gCAAgC,CAC3C,OAAA,EACA,SAAuB,GAAA,OAAA,EACvB,oBAAoB,KACjB,KAAA;AACH,EAAM,MAAA,GAAA,GAAM,SAAc,KAAA,OAAA,GAAU,MAAS,GAAA,KAAA,CAAA;AAC7C,EAAM,MAAA,EAAE,CAAC,SAAS,GAAG,IAAA,EAAM,CAAC,GAAG,GAAG,QAAA,EAChC,GAAA,OAAA,CAAQ,qBAAsB,EAAA,CAAA;AAChC,EAAA,MAAM,EAAE,MAAS,GAAA,KAAA,EAAO,QAAW,GAAA,KAAA,KAAU,OAAQ,CAAA,OAAA,CAAA;AACrD,EAAM,MAAA,KAAA,GAAQ,iBAAiB,OAAO,CAAA,CAAA;AACt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,GACZ,MAAA;AACL,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AACF,EAAA;AAEa,MAAA,sBAAA,GAAyB,CACpC,SAAA,EACA,SACG,KAAA;AACH,EAAM,MAAA,eAAA,GAAkB,sBAAuB,CAAA,SAAA,EAAW,SAAS,CAAA,CAAA;AACnE,EAAA,IAAI,oBAAoB,SAAW,EAAA;AACjC,IAAO,OAAA,SAAA,CAAA;AAAA,GACF,MAAA;AACL,IAAA,OAAO,eAAiB,EAAA,aAAA,CAAA;AAAA,GAC1B;AACF,EAAA;AAEa,MAAA,qBAAA,GAAwB,CACnC,mBAAA,EACA,WACG,KAAA;AACH,EAAA,IAAI,wBAAwB,IAAM,EAAA;AAChC,IAAO,OAAA,KAAA,CAAA;AAAA,GACF,MAAA;AACL,IAAA,MAAM,EAAE,WAAA,EAAa,WAAY,EAAA,GAAI,WAAW,WAAW,CAAA,CAAA;AAC3D,IAAM,MAAA,EAAE,CAAC,WAAW,GAAG,YAAY,CAAC,WAAW,GAAG,UAAA,EAChD,GAAA,mBAAA,CAAA;AACF,IAAA,OAAO,UAAa,GAAA,UAAA,CAAA;AAAA,GACtB;AACF;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var dropTargetUtils = require('./drop-target-utils.js');
|
|
5
|
+
|
|
6
|
+
const useAutoScroll = ({
|
|
7
|
+
containerRef,
|
|
8
|
+
onScrollingStopped,
|
|
9
|
+
orientation = "vertical"
|
|
10
|
+
}) => {
|
|
11
|
+
const scrollTimer = React.useRef(null);
|
|
12
|
+
const isScrolling = React.useRef(false);
|
|
13
|
+
const scrollPosRef = React.useRef(0);
|
|
14
|
+
const lastScrollDirectionRef = React.useRef("fwd");
|
|
15
|
+
const stopScrolling = React.useCallback(
|
|
16
|
+
(atEnd = false) => {
|
|
17
|
+
if (scrollTimer.current !== null) {
|
|
18
|
+
clearTimeout(scrollTimer.current);
|
|
19
|
+
scrollTimer.current = null;
|
|
20
|
+
}
|
|
21
|
+
isScrolling.current = false;
|
|
22
|
+
onScrollingStopped?.(
|
|
23
|
+
lastScrollDirectionRef.current,
|
|
24
|
+
scrollPosRef.current,
|
|
25
|
+
atEnd
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
[onScrollingStopped]
|
|
29
|
+
);
|
|
30
|
+
const startScrolling = React.useCallback(
|
|
31
|
+
(direction, scrollRate, scrollUnit = 100) => {
|
|
32
|
+
const { current: container } = containerRef;
|
|
33
|
+
if (container) {
|
|
34
|
+
const { SCROLL_POS, SCROLL_SIZE, CLIENT_SIZE } = dropTargetUtils.dimensions(orientation);
|
|
35
|
+
const {
|
|
36
|
+
[SCROLL_POS]: scrollPos,
|
|
37
|
+
[SCROLL_SIZE]: scrollSize,
|
|
38
|
+
[CLIENT_SIZE]: clientSize
|
|
39
|
+
} = container;
|
|
40
|
+
const maxScroll = direction === "fwd" ? scrollSize - clientSize - scrollPos : scrollPos;
|
|
41
|
+
const nextScroll = Math.min(maxScroll, scrollUnit);
|
|
42
|
+
if (direction === "fwd") {
|
|
43
|
+
lastScrollDirectionRef.current = "fwd";
|
|
44
|
+
container[SCROLL_POS] = scrollPosRef.current = scrollPos + nextScroll;
|
|
45
|
+
} else {
|
|
46
|
+
lastScrollDirectionRef.current = "bwd";
|
|
47
|
+
container[SCROLL_POS] = scrollPosRef.current = scrollPos - nextScroll;
|
|
48
|
+
}
|
|
49
|
+
if (nextScroll === maxScroll) {
|
|
50
|
+
requestAnimationFrame(() => {
|
|
51
|
+
stopScrolling(true);
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
isScrolling.current = true;
|
|
55
|
+
scrollTimer.current = window.setTimeout(() => {
|
|
56
|
+
startScrolling(direction, scrollRate, scrollUnit);
|
|
57
|
+
}, 100);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
[containerRef, orientation, stopScrolling]
|
|
62
|
+
);
|
|
63
|
+
return {
|
|
64
|
+
isScrolling,
|
|
65
|
+
startScrolling,
|
|
66
|
+
stopScrolling
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.useAutoScroll = useAutoScroll;
|
|
71
|
+
//# sourceMappingURL=useAutoScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoScroll.js","sources":["../../src/drag-drop/useAutoScroll.ts"],"sourcesContent":["import { RefObject, useCallback, useRef } from \"react\";\nimport { dimensions } from \"./drop-target-utils\";\n\nexport type ScrollStopHandler = (\n scrollDirection: \"fwd\" | \"bwd\",\n scrollPos: number,\n atEnd: boolean\n) => void;\n\nexport const useAutoScroll = ({\n containerRef,\n onScrollingStopped,\n orientation = \"vertical\",\n}: {\n containerRef: RefObject<HTMLElement>;\n onScrollingStopped?: ScrollStopHandler;\n orientation?: \"horizontal\" | \"vertical\";\n}) => {\n const scrollTimer = useRef<number | null>(null);\n const isScrolling = useRef(false);\n const scrollPosRef = useRef(0);\n const lastScrollDirectionRef = useRef<\"fwd\" | \"bwd\">(\"fwd\");\n\n const stopScrolling = useCallback(\n (atEnd = false) => {\n if (scrollTimer.current !== null) {\n clearTimeout(scrollTimer.current);\n scrollTimer.current = null;\n }\n isScrolling.current = false;\n onScrollingStopped?.(\n lastScrollDirectionRef.current,\n scrollPosRef.current,\n atEnd\n );\n },\n [onScrollingStopped]\n );\n\n const startScrolling = useCallback(\n (direction: \"fwd\" | \"bwd\", scrollRate: number, scrollUnit = 100) => {\n const { current: container } = containerRef;\n if (container) {\n const { SCROLL_POS, SCROLL_SIZE, CLIENT_SIZE } =\n dimensions(orientation);\n const {\n [SCROLL_POS]: scrollPos,\n [SCROLL_SIZE]: scrollSize,\n [CLIENT_SIZE]: clientSize,\n } = container;\n const maxScroll =\n direction === \"fwd\" ? scrollSize - clientSize - scrollPos : scrollPos;\n const nextScroll = Math.min(maxScroll, scrollUnit);\n\n if (direction === \"fwd\") {\n lastScrollDirectionRef.current = \"fwd\";\n container[SCROLL_POS as \"scrollTop\" | \"scrollLeft\"] =\n scrollPosRef.current = scrollPos + nextScroll;\n } else {\n lastScrollDirectionRef.current = \"bwd\";\n container[SCROLL_POS as \"scrollTop\" | \"scrollLeft\"] =\n scrollPosRef.current = scrollPos - nextScroll;\n }\n\n if (nextScroll === maxScroll) {\n // delay this to allow any scroll listeners to do their work\n requestAnimationFrame(() => {\n stopScrolling(true);\n });\n } else {\n isScrolling.current = true;\n scrollTimer.current = window.setTimeout(() => {\n startScrolling(direction, scrollRate, scrollUnit);\n }, 100);\n }\n }\n },\n [containerRef, orientation, stopScrolling]\n );\n\n return {\n isScrolling,\n startScrolling,\n stopScrolling,\n };\n};\n"],"names":["useRef","useCallback","dimensions"],"mappings":";;;;;AASO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,YAAA;AAAA,EACA,kBAAA;AAAA,EACA,WAAc,GAAA,UAAA;AAChB,CAIM,KAAA;AACJ,EAAM,MAAA,WAAA,GAAcA,aAAsB,IAAI,CAAA,CAAA;AAC9C,EAAM,MAAA,WAAA,GAAcA,aAAO,KAAK,CAAA,CAAA;AAChC,EAAM,MAAA,YAAA,GAAeA,aAAO,CAAC,CAAA,CAAA;AAC7B,EAAM,MAAA,sBAAA,GAAyBA,aAAsB,KAAK,CAAA,CAAA;AAE1D,EAAA,MAAM,aAAgB,GAAAC,iBAAA;AAAA,IACpB,CAAC,QAAQ,KAAU,KAAA;AACjB,MAAI,IAAA,WAAA,CAAY,YAAY,IAAM,EAAA;AAChC,QAAA,YAAA,CAAa,YAAY,OAAO,CAAA,CAAA;AAChC,QAAA,WAAA,CAAY,OAAU,GAAA,IAAA,CAAA;AAAA,OACxB;AACA,MAAA,WAAA,CAAY,OAAU,GAAA,KAAA,CAAA;AACtB,MAAA,kBAAA;AAAA,QACE,sBAAuB,CAAA,OAAA;AAAA,QACvB,YAAa,CAAA,OAAA;AAAA,QACb,KAAA;AAAA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Y,OAAU,GAAA,IAAA,CAAA;AACtB,UAAY,WAAA,CAAA,OAAA,GAAU,MAAO,CAAA,UAAA,CAAW,MAAM;AAC5C,YAAe,cAAA,CAAA,SAAA,EAAW,YAAY,UAAU,CAAA,CAAA;AAAA,aAC/C,GAAG,CAAA,CAAA;AAAA,SACR;AAAA,OACF;AAAA,KACF;AAAA,IACA,CAAC,YAAc,EAAA,WAAA,EAAa,aAAa,CAAA;AAAA,GAC3C,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,WAAA;AAAA,IACA,cAAA;AAAA,IACA,aAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var Draggable = require('./Draggable.js');
|
|
5
|
+
var dropTargetUtils = require('./drop-target-utils.js');
|
|
6
|
+
|
|
7
|
+
const useDragDisplacers = (orientation = "horizontal") => {
|
|
8
|
+
const animationFrame = React.useRef(0);
|
|
9
|
+
const transitioning = React.useRef(false);
|
|
10
|
+
const spacers = React.useMemo(
|
|
11
|
+
// We only need to listen for transition end on one of the spacers
|
|
12
|
+
() => [Draggable.createDragSpacer(transitioning), Draggable.createDragSpacer()],
|
|
13
|
+
[]
|
|
14
|
+
);
|
|
15
|
+
const animateTransition = React.useCallback(
|
|
16
|
+
(size, propertyName = "width") => {
|
|
17
|
+
const [spacer1, spacer2] = spacers;
|
|
18
|
+
animationFrame.current = requestAnimationFrame(() => {
|
|
19
|
+
transitioning.current = true;
|
|
20
|
+
spacer1.style.cssText = `${propertyName}: 0px`;
|
|
21
|
+
spacer2.style.cssText = `${propertyName}: ${size}px`;
|
|
22
|
+
spacers[0] = spacer2;
|
|
23
|
+
spacers[1] = spacer1;
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
[spacers]
|
|
27
|
+
);
|
|
28
|
+
const clearSpacers = React.useCallback(
|
|
29
|
+
(useTransition = false) => {
|
|
30
|
+
if (useTransition === true) {
|
|
31
|
+
const [spacer] = spacers;
|
|
32
|
+
const cleanup = () => {
|
|
33
|
+
spacer.removeEventListener("transitionend", cleanup);
|
|
34
|
+
clearSpacers();
|
|
35
|
+
};
|
|
36
|
+
const propertyName = orientation === "horizontal" ? "width" : "height";
|
|
37
|
+
spacer.addEventListener("transitionend", cleanup);
|
|
38
|
+
animateTransition(0, propertyName);
|
|
39
|
+
} else {
|
|
40
|
+
spacers.forEach((spacer) => spacer.remove());
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
[animateTransition, orientation, spacers]
|
|
44
|
+
);
|
|
45
|
+
const setTerminalSpacer = React.useCallback(
|
|
46
|
+
(container, position, size) => {
|
|
47
|
+
clearSpacers();
|
|
48
|
+
const propertyName = orientation === "horizontal" ? "width" : "height";
|
|
49
|
+
const [spacer] = spacers;
|
|
50
|
+
spacer.style.cssText = `${propertyName}: ${size}px`;
|
|
51
|
+
if (position === "start") {
|
|
52
|
+
container.firstChild?.before(spacer);
|
|
53
|
+
} else {
|
|
54
|
+
container.lastChild?.after(spacer);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
[clearSpacers, orientation, spacers]
|
|
58
|
+
);
|
|
59
|
+
const cancelAnyPendingAnimation = React.useCallback(() => {
|
|
60
|
+
if (animationFrame.current) {
|
|
61
|
+
cancelAnimationFrame(animationFrame.current);
|
|
62
|
+
animationFrame.current = 0;
|
|
63
|
+
}
|
|
64
|
+
}, []);
|
|
65
|
+
const displaceItem = React.useCallback(
|
|
66
|
+
(dropTargets, dropTarget, size, useTransition = false, direction = "static") => {
|
|
67
|
+
if (dropTarget) {
|
|
68
|
+
const propertyName = orientation === "horizontal" ? "width" : "height";
|
|
69
|
+
const [spacer1, spacer2] = spacers;
|
|
70
|
+
cancelAnyPendingAnimation();
|
|
71
|
+
if (useTransition) {
|
|
72
|
+
if (transitioning.current) {
|
|
73
|
+
clearSpacers();
|
|
74
|
+
spacer1.style.cssText = `${propertyName}: ${size}px`;
|
|
75
|
+
spacer2.style.cssText = `${propertyName}: 0px`;
|
|
76
|
+
if (direction === "fwd") {
|
|
77
|
+
dropTarget.element.before(spacer1);
|
|
78
|
+
dropTarget.element.after(spacer2);
|
|
79
|
+
} else {
|
|
80
|
+
dropTarget.element.after(spacer1);
|
|
81
|
+
dropTarget.element.before(spacer2);
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
if (direction === "fwd") {
|
|
85
|
+
dropTarget.element.after(spacer2);
|
|
86
|
+
} else {
|
|
87
|
+
dropTarget.element.before(spacer2);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
animateTransition(size, propertyName);
|
|
91
|
+
} else if (direction === "static") {
|
|
92
|
+
spacer1.style.cssText = `${propertyName}: ${size}px`;
|
|
93
|
+
dropTarget.element.before(spacer1);
|
|
94
|
+
} else {
|
|
95
|
+
throw Error(
|
|
96
|
+
"useDragDisplacers currently only supports noTransition for static displacement"
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
if (direction !== "static") {
|
|
100
|
+
dropTargetUtils.mutateDropTargetsSwitchDropTargetPosition(dropTargets, direction);
|
|
101
|
+
}
|
|
102
|
+
return direction === "bwd" ? dropTarget.index : dropTarget.index + 1;
|
|
103
|
+
}
|
|
104
|
+
return -1;
|
|
105
|
+
},
|
|
106
|
+
[
|
|
107
|
+
animateTransition,
|
|
108
|
+
cancelAnyPendingAnimation,
|
|
109
|
+
clearSpacers,
|
|
110
|
+
orientation,
|
|
111
|
+
spacers
|
|
112
|
+
]
|
|
113
|
+
);
|
|
114
|
+
const displaceLastItem = React.useCallback(
|
|
115
|
+
(dropTargets, dropTarget, size, useTransition = false, direction = "static") => {
|
|
116
|
+
const propertyName = orientation === "horizontal" ? "width" : "height";
|
|
117
|
+
const [spacer1, spacer2] = spacers;
|
|
118
|
+
cancelAnyPendingAnimation();
|
|
119
|
+
if (useTransition) {
|
|
120
|
+
if (transitioning.current) {
|
|
121
|
+
clearSpacers();
|
|
122
|
+
spacer1.style.cssText = `${propertyName}: ${size}px`;
|
|
123
|
+
spacer2.style.cssText = `${propertyName}: 0px`;
|
|
124
|
+
dropTarget.element.before(spacer1);
|
|
125
|
+
dropTarget.element.after(spacer2);
|
|
126
|
+
} else {
|
|
127
|
+
if (direction === "fwd") {
|
|
128
|
+
dropTarget.element.after(spacer2);
|
|
129
|
+
} else {
|
|
130
|
+
dropTarget.element.before(spacer2);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
animateTransition(size, propertyName);
|
|
134
|
+
} else {
|
|
135
|
+
spacer1.style.cssText = `${propertyName}: ${size}px`;
|
|
136
|
+
dropTarget.element.after(spacer1);
|
|
137
|
+
}
|
|
138
|
+
if (direction !== "static") {
|
|
139
|
+
dropTargetUtils.mutateDropTargetsSwitchDropTargetPosition(dropTargets, direction);
|
|
140
|
+
}
|
|
141
|
+
return dropTarget.index;
|
|
142
|
+
},
|
|
143
|
+
[
|
|
144
|
+
animateTransition,
|
|
145
|
+
cancelAnyPendingAnimation,
|
|
146
|
+
clearSpacers,
|
|
147
|
+
orientation,
|
|
148
|
+
spacers
|
|
149
|
+
]
|
|
150
|
+
);
|
|
151
|
+
return {
|
|
152
|
+
displaceItem,
|
|
153
|
+
displaceLastItem,
|
|
154
|
+
clearSpacers,
|
|
155
|
+
setTerminalSpacer
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
exports.useDragDisplacers = useDragDisplacers;
|
|
160
|
+
//# sourceMappingURL=useDragDisplacers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDragDisplacers.js","sources":["../../src/drag-drop/useDragDisplacers.ts"],"sourcesContent":["import type { orientationType } from \"@vuu-ui/vuu-utils\";\nimport { useCallback, useMemo, useRef } from \"react\";\nimport { Direction } from \"./dragDropTypes\";\nimport { createDragSpacer as createDragDisplacer } from \"./Draggable\";\nimport {\n MeasuredDropTarget,\n mutateDropTargetsSwitchDropTargetPosition,\n} from \"./drop-target-utils\";\n\nexport type DragDisplacersHookResult = {\n displaceItem: (\n dropTargets: MeasuredDropTarget[],\n dropTarget: MeasuredDropTarget,\n size: number,\n useTransition?: boolean,\n direction?: Direction | \"static\",\n orientation?: \"horizontal\" | \"vertical\"\n ) => number;\n displaceLastItem: (\n dropTargets: MeasuredDropTarget[],\n dropTarget: MeasuredDropTarget,\n size: number,\n useTransition?: boolean,\n direction?: Direction | \"static\",\n orientation?: \"horizontal\" | \"vertical\"\n ) => number;\n clearSpacers: (useAnimation?: boolean) => void;\n /** Insert the sized spacer at start or end of collection */\n setTerminalSpacer: (\n container: HTMLElement,\n position: \"start\" | \"end\",\n size: number\n ) => void;\n};\n\nexport type DragDisplacersHook = (\n orientation: orientationType\n) => DragDisplacersHookResult;\n/**\n * Manage a pair of displacer elements to smoothly display a moving gap between\n * list items of any kind. Designed to be used in a drag drop operation. The 'static'\n * direction option should be used at drag start or following scroll.\n */\nexport const useDragDisplacers: DragDisplacersHook = (\n orientation = \"horizontal\"\n) => {\n const animationFrame = useRef(0);\n const transitioning = useRef(false);\n\n const spacers = useMemo(\n // We only need to listen for transition end on one of the spacers\n () => [createDragDisplacer(transitioning), createDragDisplacer()],\n []\n );\n\n const animateTransition = useCallback(\n (size: number, propertyName = \"width\") => {\n const [spacer1, spacer2] = spacers;\n animationFrame.current = requestAnimationFrame(() => {\n transitioning.current = true;\n spacer1.style.cssText = `${propertyName}: 0px`;\n spacer2.style.cssText = `${propertyName}: ${size}px`;\n spacers[0] = spacer2;\n spacers[1] = spacer1;\n });\n },\n [spacers]\n );\n\n const clearSpacers = useCallback(\n (useTransition = false) => {\n if (useTransition === true) {\n const [spacer] = spacers;\n const cleanup = () => {\n spacer.removeEventListener(\"transitionend\", cleanup);\n clearSpacers();\n };\n const propertyName = orientation === \"horizontal\" ? \"width\" : \"height\";\n spacer.addEventListener(\"transitionend\", cleanup);\n animateTransition(0, propertyName);\n } else {\n spacers.forEach((spacer) => spacer.remove());\n }\n },\n [animateTransition, orientation, spacers]\n );\n\n const setTerminalSpacer = useCallback(\n (container: HTMLElement, position: \"start\" | \"end\", size: number) => {\n clearSpacers();\n\n const propertyName = orientation === \"horizontal\" ? \"width\" : \"height\";\n const [spacer] = spacers;\n spacer.style.cssText = `${propertyName}: ${size}px`;\n\n if (position === \"start\") {\n container.firstChild?.before(spacer);\n } else {\n container.lastChild?.after(spacer);\n }\n },\n [clearSpacers, orientation, spacers]\n );\n\n const cancelAnyPendingAnimation = useCallback(() => {\n if (animationFrame.current) {\n cancelAnimationFrame(animationFrame.current);\n animationFrame.current = 0;\n }\n }, []);\n\n const displaceItem = useCallback(\n (\n dropTargets: MeasuredDropTarget[],\n dropTarget: MeasuredDropTarget,\n size: number,\n useTransition = false,\n direction: Direction | \"static\" = \"static\"\n ): number => {\n if (dropTarget) {\n const propertyName = orientation === \"horizontal\" ? \"width\" : \"height\";\n const [spacer1, spacer2] = spacers;\n cancelAnyPendingAnimation();\n if (useTransition) {\n if (transitioning.current) {\n clearSpacers();\n spacer1.style.cssText = `${propertyName}: ${size}px`;\n spacer2.style.cssText = `${propertyName}: 0px`;\n if (direction === \"fwd\") {\n dropTarget.element.before(spacer1);\n dropTarget.element.after(spacer2);\n } else {\n dropTarget.element.after(spacer1);\n dropTarget.element.before(spacer2);\n }\n } else {\n if (direction === \"fwd\") {\n dropTarget.element.after(spacer2);\n } else {\n dropTarget.element.before(spacer2);\n }\n }\n animateTransition(size, propertyName);\n } else if (direction === \"static\") {\n spacer1.style.cssText = `${propertyName}: ${size}px`;\n dropTarget.element.before(spacer1);\n } else {\n throw Error(\n \"useDragDisplacers currently only supports noTransition for static displacement\"\n );\n }\n if (direction !== \"static\") {\n mutateDropTargetsSwitchDropTargetPosition(dropTargets, direction);\n }\n return direction === \"bwd\" ? dropTarget.index : dropTarget.index + 1;\n }\n return -1;\n },\n [\n animateTransition,\n cancelAnyPendingAnimation,\n clearSpacers,\n orientation,\n spacers,\n ]\n );\n const displaceLastItem = useCallback(\n (\n dropTargets: MeasuredDropTarget[],\n dropTarget: MeasuredDropTarget,\n size: number,\n useTransition = false,\n direction: Direction | \"static\" = \"static\"\n ): number => {\n const propertyName = orientation === \"horizontal\" ? \"width\" : \"height\";\n const [spacer1, spacer2] = spacers;\n\n cancelAnyPendingAnimation();\n\n if (useTransition) {\n if (transitioning.current) {\n clearSpacers();\n spacer1.style.cssText = `${propertyName}: ${size}px`;\n spacer2.style.cssText = `${propertyName}: 0px`;\n dropTarget.element.before(spacer1);\n dropTarget.element.after(spacer2);\n } else {\n if (direction === \"fwd\") {\n dropTarget.element.after(spacer2);\n } else {\n dropTarget.element.before(spacer2);\n }\n }\n animateTransition(size, propertyName);\n } else {\n spacer1.style.cssText = `${propertyName}: ${size}px`;\n dropTarget.element.after(spacer1);\n }\n\n if (direction !== \"static\") {\n mutateDropTargetsSwitchDropTargetPosition(dropTargets, direction);\n }\n\n return dropTarget.index;\n },\n [\n animateTransition,\n cancelAnyPendingAnimation,\n clearSpacers,\n orientation,\n spacers,\n ]\n );\n\n return {\n displaceItem,\n displaceLastItem,\n clearSpacers,\n setTerminalSpacer,\n };\n};\n"],"names":["useRef","useMemo","createDragDisplacer","useCallback","mutateDropTargetsSwitchDropTargetPosition"],"mappings":";;;;;;AA2Ca,MAAA,iBAAA,GAAwC,CACnD,WAAA,GAAc,YACX,KAAA;AACH,EAAM,MAAA,cAAA,GAAiBA,aAAO,CAAC,CAAA,CAAA;AAC/B,EAAM,MAAA,aAAA,GAAgBA,aAAO,KAAK,CAAA,CAAA;AAElC,EAAA,MAAM,OAAU,GAAAC,aAAA;AAAA;AAAA,IAEd,MAAM,CAACC,0BAAA,CAAoB,aAAa,CAAA,EAAGA,4BAAqB,CAAA;AAAA,IAChE,EAAC;AAAA,GACH,CAAA;AAEA,EAAA,MAAM,iBAAoB,GAAAC,iBAAA;AAAA,IACxB,CAAC,IAAc,EAAA,YAAA,GAAe,OAAY,KAAA;AACxC,MAAM,MAAA,CAAC,OAAS,EAAA,OAAO,CA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