@vuu-ui/vuu-ui-controls 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/calendar/Calendar.js.map +1 -1
- package/cjs/calendar/internal/CalendarCarousel.js.map +1 -1
- package/cjs/calendar/internal/CalendarContext.js.map +1 -1
- package/cjs/calendar/internal/CalendarDay.js.map +1 -1
- package/cjs/calendar/internal/CalendarMonth.js.map +1 -1
- package/cjs/calendar/internal/CalendarNavigation.js.map +1 -1
- package/cjs/calendar/internal/CalendarWeekHeader.js.map +1 -1
- package/cjs/calendar/internal/useFocusManagement.js.map +1 -1
- package/cjs/calendar/internal/utils.js.map +1 -1
- package/cjs/calendar/useCalendar.js.map +1 -1
- package/cjs/calendar/useCalendarDay.js.map +1 -1
- package/cjs/calendar/useSelection.js.map +1 -1
- package/cjs/column-picker/ColumnPicker.js.map +1 -1
- package/cjs/column-picker/ColumnSearch.js.map +1 -1
- package/cjs/common-hooks/collectionProvider.js.map +1 -1
- package/cjs/common-hooks/itemToString.js.map +1 -1
- package/cjs/common-hooks/selectionTypes.js.map +1 -1
- package/cjs/common-hooks/use-resize-observer.js.map +1 -1
- package/cjs/common-hooks/useCollectionItems.js.map +1 -1
- package/cjs/common-hooks/useControlled.js.map +1 -1
- package/cjs/common-hooks/useSelection.js.map +1 -1
- package/cjs/cycle-state-button/CycleStateButton.js.map +1 -1
- package/cjs/date-input/DateInput.js.map +1 -1
- package/cjs/date-picker/DatePicker.js.map +1 -1
- package/cjs/date-picker/DatePickerContext.js.map +1 -1
- package/cjs/date-picker/DatePickerPanel.js.map +1 -1
- package/cjs/drag-drop/DragDropProvider.js.map +1 -1
- package/cjs/drag-drop/DragDropState.js.map +1 -1
- package/cjs/drag-drop/Draggable.js +0 -5
- package/cjs/drag-drop/Draggable.js.map +1 -1
- package/cjs/drag-drop/dragDropTypes.js.map +1 -1
- package/cjs/drag-drop/drop-target-utils.js.map +1 -1
- package/cjs/drag-drop/useAutoScroll.js.map +1 -1
- package/cjs/drag-drop/useDragDisplacers.js.map +1 -1
- package/cjs/drag-drop/useDragDrop.js.map +1 -1
- package/cjs/drag-drop/useDragDropCopy.js.map +1 -1
- package/cjs/drag-drop/useDragDropIndicator.js.map +1 -1
- package/cjs/drag-drop/useDragDropNaturalMovement.js.map +1 -1
- package/cjs/drag-drop/useDropIndicator.js.map +1 -1
- package/cjs/drag-drop/useGlobalDragDrop.js.map +1 -1
- package/cjs/editable/useEditableText.js.map +1 -1
- package/cjs/editable-label/EditableLabel.css.js +1 -1
- package/cjs/editable-label/EditableLabel.js.map +1 -1
- package/cjs/expando-input/ExpandoInput.js +1 -1
- package/cjs/expando-input/ExpandoInput.js.map +1 -1
- package/cjs/icon-button/Icon.js.map +1 -1
- package/cjs/icon-button/IconButton.js.map +1 -1
- package/cjs/icon-button/ToggleIconButton.css.js +1 -1
- package/cjs/icon-button/ToggleIconButton.js.map +1 -1
- package/cjs/index.js +14 -5
- package/cjs/index.js.map +1 -1
- package/cjs/instrument-picker/TablePicker.js.map +1 -1
- package/cjs/instrument-picker/useTablePicker.js.map +1 -1
- package/cjs/list/Highlighter.js.map +1 -1
- package/cjs/list/List.js.map +1 -1
- package/cjs/list/ListItem.js.map +1 -1
- package/cjs/list/RadioIcon.js.map +1 -1
- package/cjs/list/common-hooks/keyUtils.js.map +1 -1
- package/cjs/list/common-hooks/list-dom-utils.js.map +1 -1
- package/cjs/list/common-hooks/useCollapsibleGroups.js.map +1 -1
- package/cjs/list/common-hooks/useImperativeScrollingAPI.js.map +1 -1
- package/cjs/list/common-hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/list/common-hooks/useTypeahead.js.map +1 -1
- package/cjs/list/common-hooks/useViewportTracking.js.map +1 -1
- package/cjs/list/common-hooks/utils/collection-item-utils.js.map +1 -1
- package/cjs/list/common-hooks/utils/filter-utils.js.map +1 -1
- package/cjs/list/common-hooks/utils/isSelected.js.map +1 -1
- package/cjs/list/useList.js.map +1 -1
- package/cjs/list/useListDrop.js.map +1 -1
- package/cjs/list/useListHeight.js.map +1 -1
- package/cjs/list/useScrollPosition.js.map +1 -1
- package/cjs/measured-container/MeasuredContainer.js +1 -0
- package/cjs/measured-container/MeasuredContainer.js.map +1 -1
- package/cjs/measured-container/useMeasuredContainer.js +4 -1
- package/cjs/measured-container/useMeasuredContainer.js.map +1 -1
- package/cjs/measured-container/useResizeObserver.js.map +1 -1
- package/cjs/overflow-container/OverflowContainer.js.map +1 -1
- package/cjs/overflow-container/overflow-utils.js.map +1 -1
- package/cjs/overflow-container/useOverflowContainer.js.map +1 -1
- package/cjs/price-ticker/PriceTicker.js.map +1 -1
- package/cjs/split-button/SplitButton.css.js +1 -1
- package/cjs/split-button/SplitButton.js.map +1 -1
- package/cjs/split-button/SplitStateButton.css.js +1 -1
- package/cjs/split-button/SplitStateButton.js.map +1 -1
- package/cjs/split-button/useSplitButton.js.map +1 -1
- package/cjs/table-search/SearchCell.css.js +1 -1
- package/cjs/table-search/SearchCell.js +8 -3
- package/cjs/table-search/SearchCell.js.map +1 -1
- package/cjs/table-search/TableSearch.js +11 -18
- package/cjs/table-search/TableSearch.js.map +1 -1
- package/cjs/table-search/useTableSearch.js +1 -1
- package/cjs/table-search/useTableSearch.js.map +1 -1
- package/cjs/tabs-next/TabBar.css.js +6 -0
- package/cjs/tabs-next/TabBar.css.js.map +1 -0
- package/cjs/tabs-next/TabBar.js +41 -0
- package/cjs/tabs-next/TabBar.js.map +1 -0
- package/cjs/tabs-next/TabListNext.css.js +6 -0
- package/cjs/tabs-next/TabListNext.css.js.map +1 -0
- package/cjs/tabs-next/TabListNext.js +124 -0
- package/cjs/tabs-next/TabListNext.js.map +1 -0
- package/cjs/tabs-next/TabNext.css.js +6 -0
- package/cjs/tabs-next/TabNext.css.js.map +1 -0
- package/cjs/tabs-next/TabNext.js +110 -0
- package/cjs/tabs-next/TabNext.js.map +1 -0
- package/cjs/tabs-next/TabNextAction.js +35 -0
- package/cjs/tabs-next/TabNextAction.js.map +1 -0
- package/cjs/tabs-next/TabNextContext.js +23 -0
- package/cjs/tabs-next/TabNextContext.js.map +1 -0
- package/cjs/tabs-next/TabNextPanel.css.js +6 -0
- package/cjs/tabs-next/TabNextPanel.css.js.map +1 -0
- package/cjs/tabs-next/TabNextPanel.js +77 -0
- package/cjs/tabs-next/TabNextPanel.js.map +1 -0
- package/cjs/tabs-next/TabNextTrigger.css.js +6 -0
- package/cjs/tabs-next/TabNextTrigger.css.js.map +1 -0
- package/cjs/tabs-next/TabNextTrigger.js +74 -0
- package/cjs/tabs-next/TabNextTrigger.js.map +1 -0
- package/cjs/tabs-next/TabOverflowList.css.js +6 -0
- package/cjs/tabs-next/TabOverflowList.css.js.map +1 -0
- package/cjs/tabs-next/TabOverflowList.js +130 -0
- package/cjs/tabs-next/TabOverflowList.js.map +1 -0
- package/cjs/tabs-next/TabsNext.js +174 -0
- package/cjs/tabs-next/TabsNext.js.map +1 -0
- package/cjs/tabs-next/TabsNextContext.js +33 -0
- package/cjs/tabs-next/TabsNextContext.js.map +1 -0
- package/cjs/tabs-next/hooks/useCollection.js +91 -0
- package/cjs/tabs-next/hooks/useCollection.js.map +1 -0
- package/cjs/tabs-next/hooks/useFocusOutside.js +24 -0
- package/cjs/tabs-next/hooks/useFocusOutside.js.map +1 -0
- package/cjs/tabs-next/hooks/useOverflow.js +138 -0
- package/cjs/tabs-next/hooks/useOverflow.js.map +1 -0
- package/cjs/tabstrip/Tab.js.map +1 -1
- package/cjs/tabstrip/TabMenu.js.map +1 -1
- package/cjs/tabstrip/TabMenuOptions.js.map +1 -1
- package/cjs/tabstrip/Tabstrip.css.js +1 -1
- package/cjs/tabstrip/Tabstrip.js.map +1 -1
- package/cjs/tabstrip/tabstrip-dom-utils.js.map +1 -1
- package/cjs/tabstrip/useAnimatedSelectionThumb.js.map +1 -1
- package/cjs/tabstrip/useKeyboardNavigation.js.map +1 -1
- package/cjs/tabstrip/useSelection.js.map +1 -1
- package/cjs/tabstrip/useTabstrip.js.map +1 -1
- package/cjs/toolbar/Toolbar.js.map +1 -1
- package/cjs/toolbar/toolbar-dom-utils.js.map +1 -1
- package/cjs/toolbar/useKeyboardNavigation.js.map +1 -1
- package/cjs/toolbar/useSelection.js.map +1 -1
- package/cjs/toolbar/useToolbar.js.map +1 -1
- package/cjs/utils/escapeRegExp.js.map +1 -1
- package/cjs/utils/forwardCallbackProps.js.map +1 -1
- package/cjs/utils/isOverflowElement.js.map +1 -1
- package/cjs/vuu-date-picker/VuuDatePicker.js.map +1 -1
- package/cjs/vuu-input/VuuInput.js.map +1 -1
- package/cjs/vuu-typeahead-input/VuuTypeaheadInput.js.map +1 -1
- package/cjs/vuu-typeahead-input/useVuuTypeaheadInput.js.map +1 -1
- package/esm/calendar/Calendar.js.map +1 -1
- package/esm/calendar/internal/CalendarCarousel.js.map +1 -1
- package/esm/calendar/internal/CalendarContext.js.map +1 -1
- package/esm/calendar/internal/CalendarDay.js.map +1 -1
- package/esm/calendar/internal/CalendarMonth.js.map +1 -1
- package/esm/calendar/internal/CalendarNavigation.js.map +1 -1
- package/esm/calendar/internal/CalendarWeekHeader.js.map +1 -1
- package/esm/calendar/internal/useFocusManagement.js.map +1 -1
- package/esm/calendar/internal/utils.js.map +1 -1
- package/esm/calendar/useCalendar.js.map +1 -1
- package/esm/calendar/useCalendarDay.js.map +1 -1
- package/esm/calendar/useSelection.js.map +1 -1
- package/esm/column-picker/ColumnPicker.js.map +1 -1
- package/esm/column-picker/ColumnSearch.js.map +1 -1
- package/esm/common-hooks/collectionProvider.js.map +1 -1
- package/esm/common-hooks/itemToString.js.map +1 -1
- package/esm/common-hooks/selectionTypes.js.map +1 -1
- package/esm/common-hooks/use-resize-observer.js.map +1 -1
- package/esm/common-hooks/useCollectionItems.js.map +1 -1
- package/esm/common-hooks/useControlled.js.map +1 -1
- package/esm/common-hooks/useSelection.js.map +1 -1
- package/esm/cycle-state-button/CycleStateButton.js.map +1 -1
- package/esm/date-input/DateInput.js.map +1 -1
- package/esm/date-picker/DatePicker.js.map +1 -1
- package/esm/date-picker/DatePickerContext.js.map +1 -1
- package/esm/date-picker/DatePickerPanel.js.map +1 -1
- package/esm/drag-drop/DragDropProvider.js.map +1 -1
- package/esm/drag-drop/DragDropState.js.map +1 -1
- package/esm/drag-drop/Draggable.js +0 -5
- package/esm/drag-drop/Draggable.js.map +1 -1
- package/esm/drag-drop/dragDropTypes.js.map +1 -1
- package/esm/drag-drop/drop-target-utils.js.map +1 -1
- package/esm/drag-drop/useAutoScroll.js.map +1 -1
- package/esm/drag-drop/useDragDisplacers.js.map +1 -1
- package/esm/drag-drop/useDragDrop.js +1 -1
- package/esm/drag-drop/useDragDrop.js.map +1 -1
- package/esm/drag-drop/useDragDropCopy.js.map +1 -1
- package/esm/drag-drop/useDragDropIndicator.js +1 -1
- package/esm/drag-drop/useDragDropIndicator.js.map +1 -1
- package/esm/drag-drop/useDragDropNaturalMovement.js +1 -1
- package/esm/drag-drop/useDragDropNaturalMovement.js.map +1 -1
- package/esm/drag-drop/useDropIndicator.js.map +1 -1
- package/esm/drag-drop/useGlobalDragDrop.js.map +1 -1
- package/esm/editable/useEditableText.js.map +1 -1
- package/esm/editable-label/EditableLabel.css.js +1 -1
- package/esm/editable-label/EditableLabel.js.map +1 -1
- package/esm/expando-input/ExpandoInput.js +1 -1
- package/esm/expando-input/ExpandoInput.js.map +1 -1
- package/esm/icon-button/Icon.js.map +1 -1
- package/esm/icon-button/IconButton.js.map +1 -1
- package/esm/icon-button/ToggleIconButton.css.js +1 -1
- package/esm/icon-button/ToggleIconButton.js.map +1 -1
- package/esm/index.js +7 -2
- package/esm/index.js.map +1 -1
- package/esm/instrument-picker/TablePicker.js.map +1 -1
- package/esm/instrument-picker/useTablePicker.js.map +1 -1
- package/esm/list/Highlighter.js.map +1 -1
- package/esm/list/List.js.map +1 -1
- package/esm/list/ListItem.js.map +1 -1
- package/esm/list/RadioIcon.js.map +1 -1
- package/esm/list/common-hooks/keyUtils.js.map +1 -1
- package/esm/list/common-hooks/list-dom-utils.js.map +1 -1
- package/esm/list/common-hooks/useCollapsibleGroups.js.map +1 -1
- package/esm/list/common-hooks/useImperativeScrollingAPI.js.map +1 -1
- package/esm/list/common-hooks/useKeyboardNavigation.js.map +1 -1
- package/esm/list/common-hooks/useTypeahead.js.map +1 -1
- package/esm/list/common-hooks/useViewportTracking.js.map +1 -1
- package/esm/list/common-hooks/utils/collection-item-utils.js.map +1 -1
- package/esm/list/common-hooks/utils/filter-utils.js.map +1 -1
- package/esm/list/common-hooks/utils/isSelected.js.map +1 -1
- package/esm/list/useList.js.map +1 -1
- package/esm/list/useListDrop.js.map +1 -1
- package/esm/list/useListHeight.js.map +1 -1
- package/esm/list/useScrollPosition.js.map +1 -1
- package/esm/measured-container/MeasuredContainer.js +1 -0
- package/esm/measured-container/MeasuredContainer.js.map +1 -1
- package/esm/measured-container/useMeasuredContainer.js +4 -1
- package/esm/measured-container/useMeasuredContainer.js.map +1 -1
- package/esm/measured-container/useResizeObserver.js.map +1 -1
- package/esm/overflow-container/OverflowContainer.js.map +1 -1
- package/esm/overflow-container/overflow-utils.js.map +1 -1
- package/esm/overflow-container/useOverflowContainer.js.map +1 -1
- package/esm/price-ticker/PriceTicker.js.map +1 -1
- package/esm/split-button/SplitButton.css.js +1 -1
- package/esm/split-button/SplitButton.js.map +1 -1
- package/esm/split-button/SplitStateButton.css.js +1 -1
- package/esm/split-button/SplitStateButton.js.map +1 -1
- package/esm/split-button/useSplitButton.js.map +1 -1
- package/esm/table-search/SearchCell.css.js +1 -1
- package/esm/table-search/SearchCell.js +8 -3
- package/esm/table-search/SearchCell.js.map +1 -1
- package/esm/table-search/TableSearch.js +12 -19
- package/esm/table-search/TableSearch.js.map +1 -1
- package/esm/table-search/useTableSearch.js +1 -1
- package/esm/table-search/useTableSearch.js.map +1 -1
- package/esm/tabs-next/TabBar.css.js +4 -0
- package/esm/tabs-next/TabBar.css.js.map +1 -0
- package/esm/tabs-next/TabBar.js +39 -0
- package/esm/tabs-next/TabBar.js.map +1 -0
- package/esm/tabs-next/TabListNext.css.js +4 -0
- package/esm/tabs-next/TabListNext.css.js.map +1 -0
- package/esm/tabs-next/TabListNext.js +122 -0
- package/esm/tabs-next/TabListNext.js.map +1 -0
- package/esm/tabs-next/TabNext.css.js +4 -0
- package/esm/tabs-next/TabNext.css.js.map +1 -0
- package/esm/tabs-next/TabNext.js +108 -0
- package/esm/tabs-next/TabNext.js.map +1 -0
- package/esm/tabs-next/TabNextAction.js +33 -0
- package/esm/tabs-next/TabNextAction.js.map +1 -0
- package/esm/tabs-next/TabNextContext.js +20 -0
- package/esm/tabs-next/TabNextContext.js.map +1 -0
- package/esm/tabs-next/TabNextPanel.css.js +4 -0
- package/esm/tabs-next/TabNextPanel.css.js.map +1 -0
- package/esm/tabs-next/TabNextPanel.js +75 -0
- package/esm/tabs-next/TabNextPanel.js.map +1 -0
- package/esm/tabs-next/TabNextTrigger.css.js +4 -0
- package/esm/tabs-next/TabNextTrigger.css.js.map +1 -0
- package/esm/tabs-next/TabNextTrigger.js +72 -0
- package/esm/tabs-next/TabNextTrigger.js.map +1 -0
- package/esm/tabs-next/TabOverflowList.css.js +4 -0
- package/esm/tabs-next/TabOverflowList.css.js.map +1 -0
- package/esm/tabs-next/TabOverflowList.js +128 -0
- package/esm/tabs-next/TabOverflowList.js.map +1 -0
- package/esm/tabs-next/TabsNext.js +172 -0
- package/esm/tabs-next/TabsNext.js.map +1 -0
- package/esm/tabs-next/TabsNextContext.js +30 -0
- package/esm/tabs-next/TabsNextContext.js.map +1 -0
- package/esm/tabs-next/hooks/useCollection.js +89 -0
- package/esm/tabs-next/hooks/useCollection.js.map +1 -0
- package/esm/tabs-next/hooks/useFocusOutside.js +22 -0
- package/esm/tabs-next/hooks/useFocusOutside.js.map +1 -0
- package/esm/tabs-next/hooks/useOverflow.js +136 -0
- package/esm/tabs-next/hooks/useOverflow.js.map +1 -0
- package/esm/tabstrip/Tab.js.map +1 -1
- package/esm/tabstrip/TabMenu.js.map +1 -1
- package/esm/tabstrip/TabMenuOptions.js.map +1 -1
- package/esm/tabstrip/Tabstrip.css.js +1 -1
- package/esm/tabstrip/Tabstrip.js.map +1 -1
- package/esm/tabstrip/tabstrip-dom-utils.js.map +1 -1
- package/esm/tabstrip/useAnimatedSelectionThumb.js.map +1 -1
- package/esm/tabstrip/useKeyboardNavigation.js.map +1 -1
- package/esm/tabstrip/useSelection.js.map +1 -1
- package/esm/tabstrip/useTabstrip.js.map +1 -1
- package/esm/toolbar/Toolbar.js.map +1 -1
- package/esm/toolbar/toolbar-dom-utils.js.map +1 -1
- package/esm/toolbar/useKeyboardNavigation.js.map +1 -1
- package/esm/toolbar/useSelection.js.map +1 -1
- package/esm/toolbar/useToolbar.js.map +1 -1
- package/esm/utils/escapeRegExp.js.map +1 -1
- package/esm/utils/forwardCallbackProps.js.map +1 -1
- package/esm/utils/isOverflowElement.js.map +1 -1
- package/esm/vuu-date-picker/VuuDatePicker.js.map +1 -1
- package/esm/vuu-input/VuuInput.js.map +1 -1
- package/esm/vuu-typeahead-input/VuuTypeaheadInput.js.map +1 -1
- package/esm/vuu-typeahead-input/useVuuTypeaheadInput.js.map +1 -1
- package/package.json +15 -14
- package/types/calendar/Calendar.d.ts +0 -1
- package/types/calendar/internal/CalendarCarousel.d.ts +0 -1
- package/types/calendar/internal/CalendarContext.d.ts +0 -1
- package/types/calendar/internal/CalendarWeekHeader.d.ts +1 -1
- package/types/calendar/useCalendar.d.ts +4 -4
- package/types/calendar/useCalendarDay.d.ts +2 -2
- package/types/column-picker/ColumnPicker.d.ts +0 -1
- package/types/common-hooks/collectionProvider.d.ts +1 -1
- package/types/common-hooks/selectionTypes.d.ts +1 -1
- package/types/cycle-state-button/CycleStateButton.d.ts +2 -2
- package/types/date-picker/DatePickerContext.d.ts +0 -1
- package/types/drag-drop/DragDropProvider.d.ts +1 -1
- package/types/drag-drop/DropIndicator.d.ts +1 -2
- package/types/drag-drop/drop-target-utils.d.ts +24 -20
- package/types/drag-drop/useAutoScroll.d.ts +4 -4
- package/types/drag-drop/useGlobalDragDrop.d.ts +0 -1
- package/types/expando-input/ExpandoInput.d.ts +2 -2
- package/types/icon-button/Icon.d.ts +1 -1
- package/types/icon-button/IconButton.d.ts +0 -1
- package/types/icon-button/ToggleIconButton.d.ts +1 -2
- package/types/index.d.ts +1 -1
- package/types/instrument-picker/SearchCell.d.ts +1 -2
- package/types/instrument-picker/TablePicker.d.ts +1 -1
- package/types/instrument-picker/useTablePicker.d.ts +3 -10
- package/types/list/ChevronIcon.d.ts +1 -1
- package/types/list/ListItem.d.ts +1 -1
- package/types/list/RadioIcon.d.ts +1 -2
- package/types/list/common-hooks/useTypeahead.d.ts +0 -1
- package/types/measured-container/MeasuredContainer.d.ts +1 -1
- package/types/overflow-container/useOverflowContainer.d.ts +4 -5
- package/types/price-ticker/PriceTicker.d.ts +1 -1
- package/types/split-button/SplitStateButton.d.ts +0 -1
- package/types/split-button/useSplitButton.d.ts +71 -60
- package/types/table-search/SearchCell.d.ts +1 -2
- package/types/table-search/TableSearch.d.ts +2 -4
- package/types/table-search/useTableSearch.d.ts +4 -2
- package/types/tabs-next/TabBar.d.ts +12 -0
- package/types/tabs-next/TabListNext.d.ts +12 -0
- package/types/tabs-next/TabNext.d.ts +12 -0
- package/types/tabs-next/TabNextAction.d.ts +5 -0
- package/types/tabs-next/TabNextContext.d.ts +12 -0
- package/types/tabs-next/TabNextPanel.d.ts +8 -0
- package/types/tabs-next/TabNextTrigger.d.ts +5 -0
- package/types/tabs-next/TabOverflowList.d.ts +11 -0
- package/types/tabs-next/TabsNext.d.ts +17 -0
- package/types/tabs-next/TabsNextContext.d.ts +21 -0
- package/types/tabs-next/hooks/useCollection.d.ts +18 -0
- package/types/tabs-next/hooks/useFocusOutside.d.ts +2 -0
- package/types/tabs-next/hooks/useOverflow.d.ts +11 -0
- package/types/tabs-next/index.d.ts +7 -0
- package/types/tabstrip/Tab.d.ts +23 -22
- package/types/tabstrip/TabMenu.d.ts +1 -2
- package/types/tabstrip/Tabstrip.d.ts +1 -2
- package/types/tabstrip/useSelection.d.ts +3 -3
- package/types/tabstrip/useTabstrip.d.ts +5 -5
- package/types/toolbar/Toolbar.d.ts +1 -2
- package/types/toolbar/useToolbar.d.ts +1 -1
- package/types/vuu-date-picker/VuuDatePicker.d.ts +4 -6
- package/types/vuu-input/VuuInput.d.ts +1 -1
- package/types/vuu-typeahead-input/VuuTypeaheadInput.d.ts +1 -2
- package/cjs/tree/Tree.css.js +0 -6
- package/cjs/tree/Tree.css.js.map +0 -1
- package/cjs/tree/Tree.js +0 -179
- package/cjs/tree/Tree.js.map +0 -1
- package/cjs/tree/hierarchical-data-utils.js +0 -72
- package/cjs/tree/hierarchical-data-utils.js.map +0 -1
- package/cjs/tree/key-code.js +0 -62
- package/cjs/tree/key-code.js.map +0 -1
- package/cjs/tree/list-dom-utils.js +0 -19
- package/cjs/tree/list-dom-utils.js.map +0 -1
- package/cjs/tree/treeTypeUtils.js +0 -6
- package/cjs/tree/treeTypeUtils.js.map +0 -1
- package/cjs/tree/use-collapsible-groups.js +0 -85
- package/cjs/tree/use-collapsible-groups.js.map +0 -1
- package/cjs/tree/use-hierarchical-data.js +0 -51
- package/cjs/tree/use-hierarchical-data.js.map +0 -1
- package/cjs/tree/use-items-with-ids.js +0 -100
- package/cjs/tree/use-items-with-ids.js.map +0 -1
- package/cjs/tree/use-keyboard-navigation.js +0 -144
- package/cjs/tree/use-keyboard-navigation.js.map +0 -1
- package/cjs/tree/use-selection.js +0 -154
- package/cjs/tree/use-selection.js.map +0 -1
- package/cjs/tree/use-tree-keyboard-navigation.js +0 -41
- package/cjs/tree/use-tree-keyboard-navigation.js.map +0 -1
- package/cjs/tree/use-viewport-tracking.js +0 -76
- package/cjs/tree/use-viewport-tracking.js.map +0 -1
- package/cjs/tree/useTree.js +0 -106
- package/cjs/tree/useTree.js.map +0 -1
- package/esm/tree/Tree.css.js +0 -4
- package/esm/tree/Tree.css.js.map +0 -1
- package/esm/tree/Tree.js +0 -176
- package/esm/tree/Tree.js.map +0 -1
- package/esm/tree/hierarchical-data-utils.js +0 -65
- package/esm/tree/hierarchical-data-utils.js.map +0 -1
- package/esm/tree/key-code.js +0 -54
- package/esm/tree/key-code.js.map +0 -1
- package/esm/tree/list-dom-utils.js +0 -15
- package/esm/tree/list-dom-utils.js.map +0 -1
- package/esm/tree/treeTypeUtils.js +0 -4
- package/esm/tree/treeTypeUtils.js.map +0 -1
- package/esm/tree/use-collapsible-groups.js +0 -83
- package/esm/tree/use-collapsible-groups.js.map +0 -1
- package/esm/tree/use-hierarchical-data.js +0 -49
- package/esm/tree/use-hierarchical-data.js.map +0 -1
- package/esm/tree/use-items-with-ids.js +0 -98
- package/esm/tree/use-items-with-ids.js.map +0 -1
- package/esm/tree/use-keyboard-navigation.js +0 -142
- package/esm/tree/use-keyboard-navigation.js.map +0 -1
- package/esm/tree/use-selection.js +0 -147
- package/esm/tree/use-selection.js.map +0 -1
- package/esm/tree/use-tree-keyboard-navigation.js +0 -39
- package/esm/tree/use-tree-keyboard-navigation.js.map +0 -1
- package/esm/tree/use-viewport-tracking.js +0 -74
- package/esm/tree/use-viewport-tracking.js.map +0 -1
- package/esm/tree/useTree.js +0 -104
- package/esm/tree/useTree.js.map +0 -1
- package/types/tree/Tree.d.ts +0 -19
- package/types/tree/hierarchical-data-utils.d.ts +0 -8
- package/types/tree/index.d.ts +0 -3
- package/types/tree/key-code.d.ts +0 -11
- package/types/tree/list-dom-utils.d.ts +0 -6
- package/types/tree/treeTypeUtils.d.ts +0 -2
- package/types/tree/use-collapsible-groups.d.ts +0 -18
- package/types/tree/use-hierarchical-data.d.ts +0 -6
- package/types/tree/use-items-with-ids.d.ts +0 -8
- package/types/tree/use-keyboard-navigation.d.ts +0 -26
- package/types/tree/use-selection.d.ts +0 -31
- package/types/tree/use-tree-keyboard-navigation.d.ts +0 -12
- package/types/tree/use-viewport-tracking.d.ts +0 -2
- package/types/tree/useTree.d.ts +0 -30
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelection.js","sources":["../../src/toolbar/useSelection.ts"],"sourcesContent":["import { KeyboardEvent, MouseEvent, RefObject, useCallback } from \"react\";\nimport {\n SelectionStrategy,\n SpecialKeyMultipleSelection,\n allowMultipleSelection,\n deselectionIsAllowed,\n selectionIsDisallowed,\n} from \"../common-hooks\";\nimport { useControlled } from \"@salt-ds/core\";\nimport { getClosestIndexItem, isSelectableElement } from \"@vuu-ui/vuu-utils\";\n\nconst defaultSelectionKeys = [\"Enter\", \" \"];\n\nexport interface SelectionHookProps {\n containerRef: RefObject<HTMLElement>;\n defaultSelected?: number[];\n highlightedIdx: number;\n itemQuery: string;\n onSelectionChange?: (selectedIndices: number[]) => void;\n selected?: number[];\n selectionStrategy: SelectionStrategy | SpecialKeyMultipleSelection;\n}\n\nexport interface ItemHandlers {\n onClick?: (e: MouseEvent, itemIndex: number) => void;\n onKeyDown?: (event: React.KeyboardEvent) => void;\n}\n\nconst NO_SELECTION_HANDLERS: ItemHandlers = {};\n\nexport interface SelectionHookResult {\n activateItem: (tabIndex: number) => void;\n itemHandlers: ItemHandlers;\n isControlled: boolean;\n selected: number[];\n}\n\n// TODO use SelectionProps\nexport const useSelection = ({\n defaultSelected,\n highlightedIdx,\n onSelectionChange,\n selected: selectedProp,\n selectionStrategy,\n}: SelectionHookProps): SelectionHookResult => {\n const [selected, setSelected, isControlled] = useControlled({\n controlled: selectedProp,\n default: defaultSelected ?? [],\n name: \"useSelection\",\n state: \"selected\",\n });\n\n // const isSelectableElement = useMemo(\n // () =>\n // (el: HTMLElement): boolean =>\n // el && el.matches(`[class*=\"${itemQuery} \"]`),\n // [itemQuery]\n // );\n\n const isSelectionEvent = useCallback(\n (evt: KeyboardEvent) => defaultSelectionKeys.includes(evt.key),\n [],\n );\n\n const selectItem = useCallback(\n (itemIndex: number, specialKey = false) => {\n const newSelected = allowMultipleSelection(selectionStrategy, specialKey)\n ? selected.concat(itemIndex)\n : [itemIndex];\n\n setSelected(newSelected);\n onSelectionChange?.(newSelected);\n },\n [onSelectionChange, selected, selectionStrategy, setSelected],\n );\n\n const deselectItem = useCallback(\n (itemIndex: number, specialKey = false) => {\n const newSelected =\n selectionStrategy === \"deselectable\" ||\n (selectionStrategy === \"multiple-special-key\" && !specialKey)\n ? []\n : selected.filter((index) => index !== itemIndex);\n setSelected(newSelected);\n onSelectionChange?.(newSelected);\n },\n [onSelectionChange, selected, selectionStrategy, setSelected],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (isSelectionEvent(e) && isSelectableElement(e.target as HTMLElement)) {\n if (!selected.includes(highlightedIdx)) {\n e.stopPropagation();\n e.preventDefault();\n selectItem(highlightedIdx, e.shiftKey);\n } else if (deselectionIsAllowed(selectionStrategy)) {\n e.stopPropagation();\n e.preventDefault();\n deselectItem(highlightedIdx, e.shiftKey);\n }\n }\n },\n [\n isSelectionEvent,\n selected,\n highlightedIdx,\n selectionStrategy,\n selectItem,\n deselectItem,\n ],\n );\n\n const handleClick = useCallback(\n (e: MouseEvent, itemIndex: number) => {\n const element = getClosestIndexItem(e.target as HTMLElement);\n if (isSelectableElement(element)) {\n if (!selected.includes(itemIndex)) {\n selectItem(itemIndex, e.shiftKey);\n } else if (deselectionIsAllowed(selectionStrategy)) {\n deselectItem(itemIndex, e.shiftKey);\n }\n }\n },\n [deselectItem, selectItem, selected, selectionStrategy],\n );\n\n const itemHandlers = selectionIsDisallowed(selectionStrategy)\n ? NO_SELECTION_HANDLERS\n : {\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n };\n\n return {\n activateItem: selectItem,\n itemHandlers,\n isControlled,\n selected,\n };\n};\n"],"names":[],"mappings":";;;;;;;AAWA,MAAM,oBAAA,GAAuB,CAAC,OAAA,EAAS,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"useSelection.js","sources":["../../src/toolbar/useSelection.ts"],"sourcesContent":["import { KeyboardEvent, MouseEvent, RefObject, useCallback } from \"react\";\nimport {\n SelectionStrategy,\n SpecialKeyMultipleSelection,\n allowMultipleSelection,\n deselectionIsAllowed,\n selectionIsDisallowed,\n} from \"../common-hooks\";\nimport { useControlled } from \"@salt-ds/core\";\nimport { getClosestIndexItem, isSelectableElement } from \"@vuu-ui/vuu-utils\";\n\nconst defaultSelectionKeys = [\"Enter\", \" \"];\n\nexport interface SelectionHookProps {\n containerRef: RefObject<HTMLElement>;\n defaultSelected?: number[];\n highlightedIdx: number;\n itemQuery: string;\n onSelectionChange?: (selectedIndices: number[]) => void;\n selected?: number[];\n selectionStrategy: SelectionStrategy | SpecialKeyMultipleSelection;\n}\n\nexport interface ItemHandlers {\n onClick?: (e: MouseEvent, itemIndex: number) => void;\n onKeyDown?: (event: React.KeyboardEvent) => void;\n}\n\nconst NO_SELECTION_HANDLERS: ItemHandlers = {};\n\nexport interface SelectionHookResult {\n activateItem: (tabIndex: number) => void;\n itemHandlers: ItemHandlers;\n isControlled: boolean;\n selected: number[];\n}\n\n// TODO use SelectionProps\nexport const useSelection = ({\n defaultSelected,\n highlightedIdx,\n onSelectionChange,\n selected: selectedProp,\n selectionStrategy,\n}: SelectionHookProps): SelectionHookResult => {\n const [selected, setSelected, isControlled] = useControlled({\n controlled: selectedProp,\n default: defaultSelected ?? [],\n name: \"useSelection\",\n state: \"selected\",\n });\n\n // const isSelectableElement = useMemo(\n // () =>\n // (el: HTMLElement): boolean =>\n // el && el.matches(`[class*=\"${itemQuery} \"]`),\n // [itemQuery]\n // );\n\n const isSelectionEvent = useCallback(\n (evt: KeyboardEvent) => defaultSelectionKeys.includes(evt.key),\n [],\n );\n\n const selectItem = useCallback(\n (itemIndex: number, specialKey = false) => {\n const newSelected = allowMultipleSelection(selectionStrategy, specialKey)\n ? selected.concat(itemIndex)\n : [itemIndex];\n\n setSelected(newSelected);\n onSelectionChange?.(newSelected);\n },\n [onSelectionChange, selected, selectionStrategy, setSelected],\n );\n\n const deselectItem = useCallback(\n (itemIndex: number, specialKey = false) => {\n const newSelected =\n selectionStrategy === \"deselectable\" ||\n (selectionStrategy === \"multiple-special-key\" && !specialKey)\n ? []\n : selected.filter((index) => index !== itemIndex);\n setSelected(newSelected);\n onSelectionChange?.(newSelected);\n },\n [onSelectionChange, selected, selectionStrategy, setSelected],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (isSelectionEvent(e) && isSelectableElement(e.target as HTMLElement)) {\n if (!selected.includes(highlightedIdx)) {\n e.stopPropagation();\n e.preventDefault();\n selectItem(highlightedIdx, e.shiftKey);\n } else if (deselectionIsAllowed(selectionStrategy)) {\n e.stopPropagation();\n e.preventDefault();\n deselectItem(highlightedIdx, e.shiftKey);\n }\n }\n },\n [\n isSelectionEvent,\n selected,\n highlightedIdx,\n selectionStrategy,\n selectItem,\n deselectItem,\n ],\n );\n\n const handleClick = useCallback(\n (e: MouseEvent, itemIndex: number) => {\n const element = getClosestIndexItem(e.target as HTMLElement);\n if (isSelectableElement(element)) {\n if (!selected.includes(itemIndex)) {\n selectItem(itemIndex, e.shiftKey);\n } else if (deselectionIsAllowed(selectionStrategy)) {\n deselectItem(itemIndex, e.shiftKey);\n }\n }\n },\n [deselectItem, selectItem, selected, selectionStrategy],\n );\n\n const itemHandlers = selectionIsDisallowed(selectionStrategy)\n ? NO_SELECTION_HANDLERS\n : {\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n };\n\n return {\n activateItem: selectItem,\n itemHandlers,\n isControlled,\n selected,\n };\n};\n"],"names":[],"mappings":";;;;;;;AAWA,MAAM,oBAAA,GAAuB,CAAC,OAAA,EAAS,GAAG,CAAA;AAiB1C,MAAM,wBAAsC,EAAC;AAUtC,MAAM,eAAe,CAAC;AAAA,EAC3B,eAAA;AAAA,EACA,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,QAAU,EAAA,YAAA;AAAA,EACV;AACF,CAA+C,KAAA;AAC7C,EAAA,MAAM,CAAC,QAAA,EAAU,WAAa,EAAA,YAAY,IAAI,aAAc,CAAA;AAAA,IAC1D,U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,EAAA,UAAA;AAAA,IACd,YAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToolbar.js","sources":["../../src/toolbar/useToolbar.ts"],"sourcesContent":["import { isValidNumber } from \"@vuu-ui/vuu-utils\";\nimport {\n KeyboardEvent,\n MouseEvent as ReactMouseEvent,\n RefObject,\n useCallback,\n useRef,\n} from \"react\";\nimport { OverflowItem } from \"../overflow-container\";\nimport { ToolbarProps } from \"./Toolbar\";\nimport { useKeyboardNavigation } from \"./useKeyboardNavigation\";\nimport { useSelection } from \"./useSelection\";\n\nexport interface ToolbarHookProps\n extends Pick<\n ToolbarProps,\n | \"activeItemIndex\"\n | \"defaultActiveItemIndex\"\n | \"onActiveChange\"\n | \"onNavigateOutOfBounds\"\n >,\n Required<Pick<ToolbarProps, \"orientation\" | \"selectionStrategy\">> {\n containerRef: RefObject<HTMLElement>;\n itemQuery?: string;\n}\n\nexport const useToolbar = ({\n activeItemIndex: activeItemIndexProp,\n defaultActiveItemIndex,\n containerRef,\n itemQuery = \"vuuToolbarItem\",\n onActiveChange,\n onNavigateOutOfBounds,\n orientation,\n selectionStrategy,\n}: ToolbarHookProps) => {\n const lastSelection = useRef(activeItemIndexProp);\n\n const {\n focusItem: keyboardHookFocusItem,\n highlightedIdx,\n onClick: keyboardHookHandleClick,\n onKeyDown: keyboardHookHandleKeyDown,\n setHighlightedIdx: keyboardHookSetHighlightedIndex,\n ...keyboardHook\n } = useKeyboardNavigation({\n containerRef,\n onNavigateOutOfBounds,\n orientation,\n });\n\n const {\n activateItem: selectionHookActivateItem,\n itemHandlers: { onClick, onKeyDown },\n selected: selectionHookSelected,\n } = useSelection({\n containerRef,\n defaultSelected: defaultActiveItemIndex,\n highlightedIdx,\n itemQuery,\n onSelectionChange: onActiveChange,\n selected: activeItemIndexProp,\n selectionStrategy,\n });\n // We need this on reEntry for navigation hook to handle focus and for dragDropHook\n // to re-apply selection after drag drop. For some reason the value is stale if we\n // directly use selectionHookSelected within the drag, even though all dependencies\n //appear to be correctly declared.\n lastSelection.current = selectionHookSelected;\n\n const handleClick = useCallback(\n (evt: ReactMouseEvent<HTMLElement>) => {\n const target = evt.target as HTMLElement;\n const toolbarItem = target.closest(\"[data-index]\") as HTMLElement;\n if (toolbarItem) {\n const index = parseInt(toolbarItem.dataset.index ?? \"-1\");\n if (index !== -1 && isValidNumber(index)) {\n keyboardHookHandleClick(evt, index);\n onClick?.(evt, index);\n }\n }\n },\n [keyboardHookHandleClick, onClick],\n );\n\n const handleKeyDown = useCallback(\n (evt: KeyboardEvent) => {\n keyboardHookHandleKeyDown(evt);\n if (!evt.defaultPrevented) {\n onKeyDown?.(evt);\n }\n },\n [keyboardHookHandleKeyDown, onKeyDown],\n );\n\n const onSwitchWrappedItemIntoView = useCallback(\n (item: OverflowItem) => {\n const index = parseInt(item.index);\n if (!isNaN(index)) {\n //TODO need to be able to reset the overflow-priority without selecting the item\n selectionHookActivateItem(index);\n keyboardHookFocusItem(index);\n }\n },\n [keyboardHookFocusItem, selectionHookActivateItem],\n );\n\n const itemProps = {\n onClick: handleClick,\n onFocus: keyboardHook.onFocus,\n onKeyDown: handleKeyDown,\n };\n\n return {\n activeItemIndex: selectionHookSelected,\n focusableIdx: keyboardHook.focusableIdx,\n focusVisible: keyboardHook.focusVisible,\n containerProps: {\n PopupMenuProps: {\n onKeyDown: handleKeyDown,\n onMenuClose: keyboardHook.onOverflowMenuClose,\n },\n ...keyboardHook.containerProps,\n onSwitchWrappedItemIntoView,\n },\n itemProps,\n };\n};\n"],"names":[],"mappings":";;;;;AA0BO,MAAM,aAAa,CAAC;AAAA,EACzB,eAAiB,EAAA,mBAAA;AAAA,EACjB,sBAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAY,GAAA,gBAAA;AAAA,EACZ,cAAA;AAAA,EACA,qBAAA;AAAA,EACA,WAAA;AAAA,EACA
|
|
1
|
+
{"version":3,"file":"useToolbar.js","sources":["../../src/toolbar/useToolbar.ts"],"sourcesContent":["import { isValidNumber } from \"@vuu-ui/vuu-utils\";\nimport {\n KeyboardEvent,\n MouseEvent as ReactMouseEvent,\n RefObject,\n useCallback,\n useRef,\n} from \"react\";\nimport { OverflowItem } from \"../overflow-container\";\nimport { ToolbarProps } from \"./Toolbar\";\nimport { useKeyboardNavigation } from \"./useKeyboardNavigation\";\nimport { useSelection } from \"./useSelection\";\n\nexport interface ToolbarHookProps\n extends Pick<\n ToolbarProps,\n | \"activeItemIndex\"\n | \"defaultActiveItemIndex\"\n | \"onActiveChange\"\n | \"onNavigateOutOfBounds\"\n >,\n Required<Pick<ToolbarProps, \"orientation\" | \"selectionStrategy\">> {\n containerRef: RefObject<HTMLElement>;\n itemQuery?: string;\n}\n\nexport const useToolbar = ({\n activeItemIndex: activeItemIndexProp,\n defaultActiveItemIndex,\n containerRef,\n itemQuery = \"vuuToolbarItem\",\n onActiveChange,\n onNavigateOutOfBounds,\n orientation,\n selectionStrategy,\n}: ToolbarHookProps) => {\n const lastSelection = useRef(activeItemIndexProp);\n\n const {\n focusItem: keyboardHookFocusItem,\n highlightedIdx,\n onClick: keyboardHookHandleClick,\n onKeyDown: keyboardHookHandleKeyDown,\n setHighlightedIdx: keyboardHookSetHighlightedIndex,\n ...keyboardHook\n } = useKeyboardNavigation({\n containerRef,\n onNavigateOutOfBounds,\n orientation,\n });\n\n const {\n activateItem: selectionHookActivateItem,\n itemHandlers: { onClick, onKeyDown },\n selected: selectionHookSelected,\n } = useSelection({\n containerRef,\n defaultSelected: defaultActiveItemIndex,\n highlightedIdx,\n itemQuery,\n onSelectionChange: onActiveChange,\n selected: activeItemIndexProp,\n selectionStrategy,\n });\n // We need this on reEntry for navigation hook to handle focus and for dragDropHook\n // to re-apply selection after drag drop. For some reason the value is stale if we\n // directly use selectionHookSelected within the drag, even though all dependencies\n //appear to be correctly declared.\n lastSelection.current = selectionHookSelected;\n\n const handleClick = useCallback(\n (evt: ReactMouseEvent<HTMLElement>) => {\n const target = evt.target as HTMLElement;\n const toolbarItem = target.closest(\"[data-index]\") as HTMLElement;\n if (toolbarItem) {\n const index = parseInt(toolbarItem.dataset.index ?? \"-1\");\n if (index !== -1 && isValidNumber(index)) {\n keyboardHookHandleClick(evt, index);\n onClick?.(evt, index);\n }\n }\n },\n [keyboardHookHandleClick, onClick],\n );\n\n const handleKeyDown = useCallback(\n (evt: KeyboardEvent) => {\n keyboardHookHandleKeyDown(evt);\n if (!evt.defaultPrevented) {\n onKeyDown?.(evt);\n }\n },\n [keyboardHookHandleKeyDown, onKeyDown],\n );\n\n const onSwitchWrappedItemIntoView = useCallback(\n (item: OverflowItem) => {\n const index = parseInt(item.index);\n if (!isNaN(index)) {\n //TODO need to be able to reset the overflow-priority without selecting the item\n selectionHookActivateItem(index);\n keyboardHookFocusItem(index);\n }\n },\n [keyboardHookFocusItem, selectionHookActivateItem],\n );\n\n const itemProps = {\n onClick: handleClick,\n onFocus: keyboardHook.onFocus,\n onKeyDown: handleKeyDown,\n };\n\n return {\n activeItemIndex: selectionHookSelected,\n focusableIdx: keyboardHook.focusableIdx,\n focusVisible: keyboardHook.focusVisible,\n containerProps: {\n PopupMenuProps: {\n onKeyDown: handleKeyDown,\n onMenuClose: keyboardHook.onOverflowMenuClose,\n },\n ...keyboardHook.containerProps,\n onSwitchWrappedItemIntoView,\n },\n itemProps,\n };\n};\n"],"names":[],"mappings":";;;;;AA0BO,MAAM,aAAa,CAAC;AAAA,EACzB,eAAiB,EAAA,mBAAA;AAAA,EACjB,sBAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAY,GAAA,gBAAA;AAAA,EACZ,cAAA;AAAA,EACA,qBAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF,CAAwB,KAAA;AACtB,EAAM,MAAA,aAAA,GAAgB,OAAO,mBAAmB,CAAA;AAEhD,EAAM,MAAA;AAAA,IACJ,SAAW,EAAA,qBAAA;AAAA,IACX,cAAA;AAAA,IACA,OAAS,EAAA,uB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GAAY,GAAG,CAAA;AAAA;AACjB,KACF;AAAA,IACA,CAAC,2BAA2B,SAAS;AAAA,GACvC;AAEA,EAAA,MAAM,2BAA8B,GAAA,WAAA;AAAA,IAClC,CAAC,IAAuB,KAAA;AACtB,MAAM,MAAA,KAAA,GAAQ,QAAS,CAAA,IAAA,CAAK,KAAK,CAAA;AACjC,MAAI,IAAA,CAAC,KAAM,CAAA,KAAK,CAAG,EAAA;AAEjB,QAAA,yBAAA,CAA0B,KAAK,CAAA;AAC/B,QAAA,qBAAA,CAAsB,KAAK,CAAA;AAAA;AAC7B,KACF;AAAA,IACA,CAAC,uBAAuB,yBAAyB;AAAA,GACnD;AAEA,EAAA,MAAM,SAAY,GAAA;AAAA,IAChB,OAAS,EAAA,WAAA;AAAA,IACT,SAAS,YAAa,CAAA,OAAA;AAAA,IACtB,SAAW,EAAA;AAAA,GACb;AAEA,EAAO,OAAA;AAAA,IACL,eAAiB,EAAA,qBAAA;AAAA,IACjB,cAAc,YAAa,CAAA,YAAA;AAAA,IAC3B,cAAc,YAAa,CAAA,YAAA;AAAA,IAC3B,cAAgB,EAAA;AAAA,MACd,cAAgB,EAAA;AAAA,QACd,SAAW,EAAA,aAAA;AAAA,QACX,aAAa,YAAa,CAAA;AAAA,OAC5B;AAAA,MACA,GAAG,YAAa,CAAA,cAAA;AAAA,MAChB;AAAA,KACF;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escapeRegExp.js","sources":["../../src/utils/escapeRegExp.ts"],"sourcesContent":["const regExp = /[.*+?^${}()|[\\]\\\\]/g;\n\nexport function escapeRegExp(string: string): string {\n return string.replace(regExp, \"\\\\$&\");\n}\n"],"names":[],"mappings":"AAAA,MAAM,MAAS,GAAA,qBAAA
|
|
1
|
+
{"version":3,"file":"escapeRegExp.js","sources":["../../src/utils/escapeRegExp.ts"],"sourcesContent":["const regExp = /[.*+?^${}()|[\\]\\\\]/g;\n\nexport function escapeRegExp(string: string): string {\n return string.replace(regExp, \"\\\\$&\");\n}\n"],"names":[],"mappings":"AAAA,MAAM,MAAS,GAAA,qBAAA;AAER,SAAS,aAAa,MAAwB,EAAA;AACnD,EAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,EAAQ,MAAM,CAAA;AACtC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forwardCallbackProps.js","sources":["../../src/utils/forwardCallbackProps.ts"],"sourcesContent":["/*\n When we clone a React element and inject props, if any of these are\n callback props, make sure original callback props are also invoked.\n\n React.cloneElement(\n element,\n forwardCallbackProps(element.props, overrideProps)\n )\n */\n\ntype Props = Record<string, unknown>;\n\nexport const forwardCallbackProps = <P1 extends Props, P2 extends Props>(\n ownProps: P1,\n overrideProps: P2\n): P1 & P2 => {\n const props = Object.keys(ownProps).reduce<Props>(\n (map, name) => {\n const ownProp = ownProps[name];\n const overrideProp = overrideProps[name];\n if (typeof ownProp === \"function\" && typeof overrideProp === \"function\") {\n map[name] = (...args: unknown[]) => {\n ownProp(...args);\n overrideProp(...args);\n };\n }\n return map;\n },\n { ...overrideProps }\n );\n\n return props as P1 & P2;\n};\n"],"names":[],"mappings":"AAYa,MAAA,oBAAA,GAAuB,CAClC,QAAA,EACA,aACY,KAAA;AACZ,EAAA,MAAM,KAAQ,GAAA,MAAA,CAAO,IAAK,CAAA,QAAQ,CAAE,CAAA,MAAA;AAAA,IAClC,CAAC,KAAK,IAAS,KAAA;AACb,MAAM,MAAA,OAAA,GAAU,SAAS,IAAI,CAAA
|
|
1
|
+
{"version":3,"file":"forwardCallbackProps.js","sources":["../../src/utils/forwardCallbackProps.ts"],"sourcesContent":["/*\n When we clone a React element and inject props, if any of these are\n callback props, make sure original callback props are also invoked.\n\n React.cloneElement(\n element,\n forwardCallbackProps(element.props, overrideProps)\n )\n */\n\ntype Props = Record<string, unknown>;\n\nexport const forwardCallbackProps = <P1 extends Props, P2 extends Props>(\n ownProps: P1,\n overrideProps: P2\n): P1 & P2 => {\n const props = Object.keys(ownProps).reduce<Props>(\n (map, name) => {\n const ownProp = ownProps[name];\n const overrideProp = overrideProps[name];\n if (typeof ownProp === \"function\" && typeof overrideProp === \"function\") {\n map[name] = (...args: unknown[]) => {\n ownProp(...args);\n overrideProp(...args);\n };\n }\n return map;\n },\n { ...overrideProps }\n );\n\n return props as P1 & P2;\n};\n"],"names":[],"mappings":"AAYa,MAAA,oBAAA,GAAuB,CAClC,QAAA,EACA,aACY,KAAA;AACZ,EAAA,MAAM,KAAQ,GAAA,MAAA,CAAO,IAAK,CAAA,QAAQ,CAAE,CAAA,MAAA;AAAA,IAClC,CAAC,KAAK,IAAS,KAAA;AACb,MAAM,MAAA,OAAA,GAAU,SAAS,IAAI,CAAA;AAC7B,MAAM,MAAA,YAAA,GAAe,cAAc,IAAI,CAAA;AACvC,MAAA,IAAI,OAAO,OAAA,KAAY,UAAc,IAAA,OAAO,iBAAiB,UAAY,EAAA;AACvE,QAAI,GAAA,CAAA,IAAI,CAAI,GAAA,CAAA,GAAI,IAAoB,KAAA;AAClC,UAAA,OAAA,CAAQ,GAAG,IAAI,CAAA;AACf,UAAA,YAAA,CAAa,GAAG,IAAI,CAAA;AAAA,SACtB;AAAA;AAEF,MAAO,OAAA,GAAA;AAAA,KACT;AAAA,IACA,EAAE,GAAG,aAAc;AAAA,GACrB;AAEA,EAAO,OAAA,KAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isOverflowElement.js","sources":["../../src/utils/isOverflowElement.ts"],"sourcesContent":["// TODO this is very fragile\nexport const isOverflowElement = (element: HTMLElement | null) =>\n element !== null &&\n element.dataset.index === \"overflow\" &&\n element.parentElement !== null &&\n element.parentElement.classList.contains(\n \"vuuOverflowContainer-wrapContainer-overflowed\"\n );\n"],"names":[],"mappings":"AACO,MAAM,iBAAoB,GAAA,CAAC,OAChC,KAAA,OAAA,KAAY,QACZ,OAAQ,CAAA,OAAA,CAAQ,KAAU,KAAA,UAAA,IAC1B,OAAQ,CAAA,aAAA,KAAkB,IAC1B,IAAA,OAAA,CAAQ,cAAc,SAAU,CAAA,QAAA;AAAA,EAC9B
|
|
1
|
+
{"version":3,"file":"isOverflowElement.js","sources":["../../src/utils/isOverflowElement.ts"],"sourcesContent":["// TODO this is very fragile\nexport const isOverflowElement = (element: HTMLElement | null) =>\n element !== null &&\n element.dataset.index === \"overflow\" &&\n element.parentElement !== null &&\n element.parentElement.classList.contains(\n \"vuuOverflowContainer-wrapContainer-overflowed\"\n );\n"],"names":[],"mappings":"AACO,MAAM,iBAAoB,GAAA,CAAC,OAChC,KAAA,OAAA,KAAY,QACZ,OAAQ,CAAA,OAAA,CAAQ,KAAU,KAAA,UAAA,IAC1B,OAAQ,CAAA,aAAA,KAAkB,IAC1B,IAAA,OAAA,CAAQ,cAAc,SAAU,CAAA,QAAA;AAAA,EAC9B;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VuuDatePicker.js","sources":["../../src/vuu-date-picker/VuuDatePicker.tsx"],"sourcesContent":["import { CommitHandler } from \"@vuu-ui/vuu-utils\";\nimport {\n DateValue,\n getLocalTimeZone,\n isSameDay,\n isSameMonth,\n isSameYear,\n} from \"@internationalized/date\";\nimport cx from \"clsx\";\nimport {\n ChangeEvent,\n KeyboardEvent,\n SyntheticEvent,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { SingleSelectionValueType } from \"../calendar\";\nimport { DatePicker, DatePickerProps } from \"../date-picker\";\n\nconst classBase = \"VuuDatePicker\";\n\nconst isSameDate = (d1: DateValue, d2?: DateValue) =>\n d2 !== undefined &&\n isSameDay(d1, d2) &&\n isSameMonth(d1, d2) &&\n isSameYear(d1, d2);\n\nconst datePattern = /^\\d{1,2} [a-z]{3} \\d{4}$/i;\nconst isValidDate = (value?: string) =>\n value !== undefined &&\n value?.match(datePattern) !== null &&\n !Number.isNaN(new Date(value).getDay());\n\nconst localTimeZone = getLocalTimeZone();\n\nconst toEpochMillis = (\n date: DateValue,\n timezone: string = getLocalTimeZone(),\n): number => date.toDate(timezone).getTime();\n\ntype DateState =\n | {\n datePickerKey: \"controlled\";\n defaultDate: undefined;\n selectedDate: DateValue;\n }\n | {\n datePickerKey: \"uncontrolled\";\n defaultDate: DateValue | undefined;\n selectedDate: undefined;\n };\n\nconst getDates = (selectedDate: DateValue | undefined): DateState => {\n if (selectedDate) {\n return {\n datePickerKey: \"controlled\",\n defaultDate: undefined,\n selectedDate,\n };\n } else {\n return {\n datePickerKey: \"uncontrolled\",\n defaultDate: undefined,\n selectedDate,\n };\n }\n};\n\nexport const VuuDatePicker = ({\n className,\n onSelectionChange,\n selectedDate: selectedDateProp,\n onCommit,\n preserveFocusOnSelect,\n ...props\n}: Omit<DatePickerProps<SingleSelectionValueType>, \"defaultSelectedDate\"> & {\n onCommit?: CommitHandler<HTMLElement, number>;\n preserveFocusOnSelect?: boolean;\n}) => {\n const [open, _setOpen] = useState(false);\n const valueRef = useRef(\"\");\n const datePickerRef = useRef<HTMLDivElement>(null);\n\n const dateState = useRef<DateState>(getDates(selectedDateProp));\n\n const setOpen = (o: boolean) => {\n console.log(`setOpen ${o}`);\n _setOpen(o);\n };\n\n const commitDateChange = useCallback(\n (e: SyntheticEvent<Element>, date: DateValue) => {\n onSelectionChange?.(e, date);\n setOpen(false);\n onCommit?.(\n e as SyntheticEvent<HTMLElement>,\n toEpochMillis(date, localTimeZone),\n );\n\n if (preserveFocusOnSelect) {\n requestAnimationFrame(() => {\n datePickerRef.current?.querySelector(\"input\")?.focus();\n });\n }\n },\n [onCommit, onSelectionChange, preserveFocusOnSelect],\n );\n\n const handleSelectionChange = useCallback(\n (e: SyntheticEvent<Element>, date: DateValue) => {\n const { selectedDate } = dateState.current;\n // id date is undefined, we're openung the picker on an empty field\n if (date) {\n if (selectedDate === undefined) {\n dateState.current = getDates(date);\n commitDateChange(e, date);\n } else if (!isSameDate(date, selectedDate)) {\n dateState.current.selectedDate = date;\n commitDateChange(e, date);\n }\n }\n },\n [commitDateChange],\n );\n\n const handleChange = (evt: ChangeEvent<HTMLInputElement>, value = \"\") => {\n console.log(`handleChange`, {\n evt,\n value,\n });\n valueRef.current = value;\n console.log(`is '${value}' a valid date ? ${isValidDate(value)}`);\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"ArrowDown\") {\n setOpen(true);\n }\n };\n\n const handleKeyDownCapture = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"Enter\") {\n if (isValidDate(valueRef.current)) {\n console.log(`committayaface (${valueRef.current})`);\n } else {\n console.log(\n `nice try cowboy, but '${valueRef.current}' is nota valid date`,\n );\n e.stopPropagation();\n }\n }\n };\n\n const { datePickerKey, defaultDate, selectedDate } = dateState.current;\n\n return (\n <DatePicker\n {...props}\n className={cx(classBase, className)}\n defaultSelectedDate={defaultDate}\n key={datePickerKey}\n open={open}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onKeyDownCapture={handleKeyDownCapture}\n onOpenChange={setOpen}\n ref={datePickerRef}\n onSelectionChange={(e, date) =>\n handleSelectionChange(e, date as DateValue)\n }\n selectedDate={selectedDate}\n />\n );\n};\n"],"names":["selectedDate"],"mappings":";;;;;AAoBA,MAAM,SAAY,GAAA,eAAA
|
|
1
|
+
{"version":3,"file":"VuuDatePicker.js","sources":["../../src/vuu-date-picker/VuuDatePicker.tsx"],"sourcesContent":["import { CommitHandler } from \"@vuu-ui/vuu-utils\";\nimport {\n DateValue,\n getLocalTimeZone,\n isSameDay,\n isSameMonth,\n isSameYear,\n} from \"@internationalized/date\";\nimport cx from \"clsx\";\nimport {\n ChangeEvent,\n KeyboardEvent,\n SyntheticEvent,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { SingleSelectionValueType } from \"../calendar\";\nimport { DatePicker, DatePickerProps } from \"../date-picker\";\n\nconst classBase = \"VuuDatePicker\";\n\nconst isSameDate = (d1: DateValue, d2?: DateValue) =>\n d2 !== undefined &&\n isSameDay(d1, d2) &&\n isSameMonth(d1, d2) &&\n isSameYear(d1, d2);\n\nconst datePattern = /^\\d{1,2} [a-z]{3} \\d{4}$/i;\nconst isValidDate = (value?: string) =>\n value !== undefined &&\n value?.match(datePattern) !== null &&\n !Number.isNaN(new Date(value).getDay());\n\nconst localTimeZone = getLocalTimeZone();\n\nconst toEpochMillis = (\n date: DateValue,\n timezone: string = getLocalTimeZone(),\n): number => date.toDate(timezone).getTime();\n\ntype DateState =\n | {\n datePickerKey: \"controlled\";\n defaultDate: undefined;\n selectedDate: DateValue;\n }\n | {\n datePickerKey: \"uncontrolled\";\n defaultDate: DateValue | undefined;\n selectedDate: undefined;\n };\n\nconst getDates = (selectedDate: DateValue | undefined): DateState => {\n if (selectedDate) {\n return {\n datePickerKey: \"controlled\",\n defaultDate: undefined,\n selectedDate,\n };\n } else {\n return {\n datePickerKey: \"uncontrolled\",\n defaultDate: undefined,\n selectedDate,\n };\n }\n};\n\nexport const VuuDatePicker = ({\n className,\n onSelectionChange,\n selectedDate: selectedDateProp,\n onCommit,\n preserveFocusOnSelect,\n ...props\n}: Omit<DatePickerProps<SingleSelectionValueType>, \"defaultSelectedDate\"> & {\n onCommit?: CommitHandler<HTMLElement, number>;\n preserveFocusOnSelect?: boolean;\n}) => {\n const [open, _setOpen] = useState(false);\n const valueRef = useRef(\"\");\n const datePickerRef = useRef<HTMLDivElement>(null);\n\n const dateState = useRef<DateState>(getDates(selectedDateProp));\n\n const setOpen = (o: boolean) => {\n console.log(`setOpen ${o}`);\n _setOpen(o);\n };\n\n const commitDateChange = useCallback(\n (e: SyntheticEvent<Element>, date: DateValue) => {\n onSelectionChange?.(e, date);\n setOpen(false);\n onCommit?.(\n e as SyntheticEvent<HTMLElement>,\n toEpochMillis(date, localTimeZone),\n );\n\n if (preserveFocusOnSelect) {\n requestAnimationFrame(() => {\n datePickerRef.current?.querySelector(\"input\")?.focus();\n });\n }\n },\n [onCommit, onSelectionChange, preserveFocusOnSelect],\n );\n\n const handleSelectionChange = useCallback(\n (e: SyntheticEvent<Element>, date: DateValue) => {\n const { selectedDate } = dateState.current;\n // id date is undefined, we're openung the picker on an empty field\n if (date) {\n if (selectedDate === undefined) {\n dateState.current = getDates(date);\n commitDateChange(e, date);\n } else if (!isSameDate(date, selectedDate)) {\n dateState.current.selectedDate = date;\n commitDateChange(e, date);\n }\n }\n },\n [commitDateChange],\n );\n\n const handleChange = (evt: ChangeEvent<HTMLInputElement>, value = \"\") => {\n console.log(`handleChange`, {\n evt,\n value,\n });\n valueRef.current = value;\n console.log(`is '${value}' a valid date ? ${isValidDate(value)}`);\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"ArrowDown\") {\n setOpen(true);\n }\n };\n\n const handleKeyDownCapture = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"Enter\") {\n if (isValidDate(valueRef.current)) {\n console.log(`committayaface (${valueRef.current})`);\n } else {\n console.log(\n `nice try cowboy, but '${valueRef.current}' is nota valid date`,\n );\n e.stopPropagation();\n }\n }\n };\n\n const { datePickerKey, defaultDate, selectedDate } = dateState.current;\n\n return (\n <DatePicker\n {...props}\n className={cx(classBase, className)}\n defaultSelectedDate={defaultDate}\n key={datePickerKey}\n open={open}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onKeyDownCapture={handleKeyDownCapture}\n onOpenChange={setOpen}\n ref={datePickerRef}\n onSelectionChange={(e, date) =>\n handleSelectionChange(e, date as DateValue)\n }\n selectedDate={selectedDate}\n />\n );\n};\n"],"names":["selectedDate"],"mappings":";;;;;AAoBA,MAAM,SAAY,GAAA,eAAA;AAElB,MAAM,aAAa,CAAC,EAAA,EAAe,EACjC,KAAA,EAAA,KAAO,UACP,SAAU,CAAA,EAAA,EAAI,EAAE,CAAA,IAChB,YAAY,EAAI,EAAA,EAAE,CAClB,IAAA,UAAA,CAAW,IAAI,EAAE,CAAA;AAEnB,MAAM,WAAc,GAAA,2BAAA;AACpB,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KAAA,qBAAA,CAAsB,GAAG,IAAiB,CAAA;AAAA,MAE5C;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VuuInput.js","sources":["../../src/vuu-input/VuuInput.tsx"],"sourcesContent":["import { VuuRowDataItemType } from \"@vuu-ui/vuu-protocol-types\";\nimport { CommitHandler, isValidNumber, useId } from \"@vuu-ui/vuu-utils\";\nimport { Input, InputProps, Tooltip } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport cx from \"clsx\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n ForwardedRef,\n KeyboardEventHandler,\n ReactElement,\n ReactNode,\n forwardRef,\n useCallback,\n} from \"react\";\n\nimport vuuInputCss from \"./VuuInput.css\";\n\nconst classBase = \"vuuInput\";\n\nexport interface VuuInputProps<T extends VuuRowDataItemType = string>\n extends Omit<InputProps, \"validationStatus\"> {\n commitWhenCleared?: boolean;\n errorMessage?: ReactNode;\n onCommit: CommitHandler
|
|
1
|
+
{"version":3,"file":"VuuInput.js","sources":["../../src/vuu-input/VuuInput.tsx"],"sourcesContent":["import { VuuRowDataItemType } from \"@vuu-ui/vuu-protocol-types\";\nimport { CommitHandler, isValidNumber, useId } from \"@vuu-ui/vuu-utils\";\nimport { Input, InputProps, Tooltip } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport cx from \"clsx\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n ForwardedRef,\n KeyboardEventHandler,\n ReactElement,\n ReactNode,\n forwardRef,\n useCallback,\n} from \"react\";\n\nimport vuuInputCss from \"./VuuInput.css\";\n\nconst classBase = \"vuuInput\";\n\nexport interface VuuInputProps<T extends VuuRowDataItemType = string>\n extends Omit<InputProps, \"validationStatus\"> {\n commitWhenCleared?: boolean;\n errorMessage?: ReactNode;\n onCommit: CommitHandler;\n type?: T;\n}\n\n/**\n * A variant of Salt Input that provides a commit callback prop,\n * TODO along with cancel behaviour ?\n */\nexport const VuuInput = forwardRef(function VuuInput<\n T extends VuuRowDataItemType = string,\n>(\n {\n className,\n commitWhenCleared = false,\n errorMessage,\n id: idProp,\n onCommit,\n onKeyDown,\n type,\n ...props\n }: VuuInputProps<T>,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-input\",\n css: vuuInputCss,\n window: targetWindow,\n });\n\n const id = useId(idProp);\n\n const commitValue = useCallback<CommitHandler<HTMLInputElement, string>>(\n (evt, value) => {\n if (type === \"number\") {\n const numericValue = parseFloat(value);\n if (isValidNumber(numericValue)) {\n onCommit(evt, numericValue as T, \"text-input\");\n } else {\n //TODO add validation logic\n throw Error(\"Invalid value\");\n }\n } else if (type === \"boolean\") {\n onCommit(evt, Boolean(value) as T, \"text-input\");\n } else {\n onCommit(evt, value as T, \"text-input\");\n }\n },\n [onCommit, type],\n );\n\n const handleChange = useCallback<ChangeEventHandler<HTMLInputElement>>(\n (evt) => {\n const value = evt.target.value;\n if (value.trim() === \"\" && commitWhenCleared) {\n onCommit?.(evt, value as T);\n }\n props.inputProps?.onChange?.(evt);\n },\n [commitWhenCleared, onCommit, props.inputProps],\n );\n\n const handleKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>(\n (evt) => {\n if (evt.key === \"Enter\") {\n evt.preventDefault();\n evt.stopPropagation();\n const { value } = evt.target as HTMLInputElement;\n commitValue(evt, value);\n }\n onKeyDown?.(evt);\n },\n [commitValue, onKeyDown],\n );\n\n const handleBlur = useCallback<FocusEventHandler<HTMLInputElement>>(\n (evt) => {\n const { value } = evt.target as HTMLInputElement;\n commitValue(evt, value);\n },\n [commitValue],\n );\n\n const endAdornment = errorMessage ? (\n <Tooltip content={errorMessage} status=\"error\">\n <span className={`${classBase}-errorIcon`} data-icon=\"error\" />\n </Tooltip>\n ) : undefined;\n\n return (\n <>\n <Input\n {...props}\n endAdornment={endAdornment}\n id={id}\n inputProps={{\n autoComplete: \"off\",\n ...props.inputProps,\n onChange: handleChange,\n }}\n className={cx(classBase, className, {\n [`${classBase}-error`]: errorMessage,\n })}\n onBlur={handleBlur}\n ref={forwardedRef}\n onKeyDown={handleKeyDown}\n />\n </>\n );\n}) as <T extends VuuRowDataItemType = string>(\n props: VuuInputProps<T> & {\n ref?: ForwardedRef<HTMLDivElement>;\n },\n) => ReactElement<VuuInputProps<T>>;\n"],"names":["VuuInput"],"mappings":";;;;;;;;;AAmBA,MAAM,SAAY,GAAA,UAAA;AAcL,MAAA,QAAA,GAAW,UAAW,CAAA,SAASA,SAG1C,CAAA;AAAA,EACE,SAAA;AAAA,EACA,iBAAoB,GAAA,KAAA;AAAA,EACpB,YAAA;AAAA,EACA,EAAI,EAAA,MAAA;AAAA,EACJ,QAAA;AAAA,EACA,SAAA;AAAA,EACA,IAAA;AAAA,EACA,GAAG;AACL,CAAA,EACA,YACA,EAAA;AACA,EAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,WAAA;AAAA,IACR,GAAK,EAAA,WAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAM,MAAA,EAAA,GAAK,MAAM,MAAM,CAAA;AAEvB,EAAA,MAAM,WAAc,GAAA,WAAA;AAAA,IAClB,CAAC,KAAK,KAAU,KAAA;AACd,MAAA,IAAI,SAAS,QAAU,EAAA;AACrB,QAAM,MAAA,YAAA,GAAe,WAAW,KAAK,CAAA;AACrC,QAAI,IAAA,aAAA,CAAc,YAAY,CAAG,EAAA;AAC/B,UAAS,QAAA,CAAA,GAAA,EAAK,cAAmB,YAAY,CAAA;AAAA,SACxC,MAAA;AAEL,UAAA,MAAM,MAAM,eAAe,CAAA;AAAA;AAC7B,OACF,MAAA,IAAW,SAAS,SAAW,EAAA;AAC7B,QAAA,QAAA,C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Q,EAAA,EAAA,OAAA,EAAS,cAAc,MAAO,EAAA,OAAA,EACrC,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA,EAAK,WAAW,CAAG,EAAA,SAAS,cAAc,WAAU,EAAA,OAAA,EAAQ,GAC/D,CACE,GAAA,KAAA,CAAA;AAEJ,EAAA,uBAEI,GAAA,CAAA,QAAA,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,YAAA;AAAA,MACA,EAAA;AAAA,MACA,UAAY,EAAA;AAAA,QACV,YAAc,EAAA,KAAA;AAAA,QACd,GAAG,KAAM,CAAA,UAAA;AAAA,QACT,QAAU,EAAA;AAAA,OACZ;AAAA,MACA,SAAA,EAAW,EAAG,CAAA,SAAA,EAAW,SAAW,EAAA;AAAA,QAClC,CAAC,CAAA,EAAG,SAAS,CAAA,MAAA,CAAQ,GAAG;AAAA,OACzB,CAAA;AAAA,MACD,MAAQ,EAAA,UAAA;AAAA,MACR,GAAK,EAAA,YAAA;AAAA,MACL,SAAW,EAAA;AAAA;AAAA,GAEf,EAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VuuTypeaheadInput.js","sources":["../../src/vuu-typeahead-input/VuuTypeaheadInput.tsx"],"sourcesContent":["import type { TableSchemaTable } from \"@vuu-ui/vuu-data-types\";\nimport { NO_DATA_MATCH, type CommitHandler } from \"@vuu-ui/vuu-utils\";\nimport { ComboBox, Option } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useVuuTypeaheadInput } from \"./useVuuTypeaheadInput\";\n\nimport vuuTypeaheadInputCss from \"./VuuTypeaheadInput.css\";\nimport { PillInputProps } from \"@salt-ds/core/dist-types/pill-input\";\n\nconst classBase = \"vuuTypeaheadInput\";\nconst [noMatchingData] = NO_DATA_MATCH;\n\nexport interface VuuTypeaheadInputProps {\n /**\n * Allows a text string to be submitted that does not match any suggestion\n * Defaults to true\n */\n allowFreeInput?: boolean;\n column: string;\n /**\n * A warning to display to the user if allowFreeText is false and they attempt\n * to commit text which does not match any suggestions. A default message will\n * be shown if not provided\n */\n freeTextWarning?: string;\n /**\n * When suggestions are displayed, should first option be highlighted ?\n * Highlighted option will be selected if Enter pressed. If this option\n * is not applied and no suggestion is highlighted, Enter will commit\n * current text. This will be desirable if filter operator will be\n * 'contains', not if filter operator will be '='.\n */\n highlightFirstSuggestion?: boolean;\n inputProps?: PillInputProps[\"inputProps\"];\n onCommit: CommitHandler<HTMLInputElement>;\n table: TableSchemaTable;\n}\n\nexport const VuuTypeaheadInput = ({\n allowFreeInput,\n column,\n freeTextWarning,\n highlightFirstSuggestion,\n inputProps: inputPropsProp,\n onCommit,\n table,\n}: VuuTypeaheadInputProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-typeahead-input\",\n css: vuuTypeaheadInputCss,\n window: targetWindow,\n });\n\n const {\n inputProps,\n noFreeText,\n onChange,\n onKeyDown,\n onOpenChange,\n onSelectionChange,\n open,\n ref,\n typeaheadValues,\n value,\n } = useVuuTypeaheadInput({\n allowFreeInput,\n column,\n freeTextWarning,\n highlightFirstSuggestion,\n inputProps: inputPropsProp,\n onCommit,\n table,\n });\n\n // need latest version of salt combobox\n // const defaultHighlightedIndex =\n // highlightFirstSuggestion === false ? -1 : undefined;\n\n return (\n <ComboBox\n className={classBase}\n // defaultHighlightedIndex={defaultHighlightedIndex}\n inputProps={inputProps}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onOpenChange={onOpenChange}\n onSelectionChange={onSelectionChange}\n open={open}\n ref={ref}\n value={value}\n >\n {typeaheadValues.map((state) => (\n <Option\n className=\"vuuTypeaheadOption\"\n value={state}\n key={state}\n disabled={state === noMatchingData || state === noFreeText}\n />\n ))}\n </ComboBox>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAUA,MAAM,SAAY,GAAA,mBAAA
|
|
1
|
+
{"version":3,"file":"VuuTypeaheadInput.js","sources":["../../src/vuu-typeahead-input/VuuTypeaheadInput.tsx"],"sourcesContent":["import type { TableSchemaTable } from \"@vuu-ui/vuu-data-types\";\nimport { NO_DATA_MATCH, type CommitHandler } from \"@vuu-ui/vuu-utils\";\nimport { ComboBox, Option } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useVuuTypeaheadInput } from \"./useVuuTypeaheadInput\";\n\nimport vuuTypeaheadInputCss from \"./VuuTypeaheadInput.css\";\nimport { PillInputProps } from \"@salt-ds/core/dist-types/pill-input\";\n\nconst classBase = \"vuuTypeaheadInput\";\nconst [noMatchingData] = NO_DATA_MATCH;\n\nexport interface VuuTypeaheadInputProps {\n /**\n * Allows a text string to be submitted that does not match any suggestion\n * Defaults to true\n */\n allowFreeInput?: boolean;\n column: string;\n /**\n * A warning to display to the user if allowFreeText is false and they attempt\n * to commit text which does not match any suggestions. A default message will\n * be shown if not provided\n */\n freeTextWarning?: string;\n /**\n * When suggestions are displayed, should first option be highlighted ?\n * Highlighted option will be selected if Enter pressed. If this option\n * is not applied and no suggestion is highlighted, Enter will commit\n * current text. This will be desirable if filter operator will be\n * 'contains', not if filter operator will be '='.\n */\n highlightFirstSuggestion?: boolean;\n inputProps?: PillInputProps[\"inputProps\"];\n onCommit: CommitHandler<HTMLInputElement>;\n table: TableSchemaTable;\n}\n\nexport const VuuTypeaheadInput = ({\n allowFreeInput,\n column,\n freeTextWarning,\n highlightFirstSuggestion,\n inputProps: inputPropsProp,\n onCommit,\n table,\n}: VuuTypeaheadInputProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-typeahead-input\",\n css: vuuTypeaheadInputCss,\n window: targetWindow,\n });\n\n const {\n inputProps,\n noFreeText,\n onChange,\n onKeyDown,\n onOpenChange,\n onSelectionChange,\n open,\n ref,\n typeaheadValues,\n value,\n } = useVuuTypeaheadInput({\n allowFreeInput,\n column,\n freeTextWarning,\n highlightFirstSuggestion,\n inputProps: inputPropsProp,\n onCommit,\n table,\n });\n\n // need latest version of salt combobox\n // const defaultHighlightedIndex =\n // highlightFirstSuggestion === false ? -1 : undefined;\n\n return (\n <ComboBox\n className={classBase}\n // defaultHighlightedIndex={defaultHighlightedIndex}\n inputProps={inputProps}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onOpenChange={onOpenChange}\n onSelectionChange={onSelectionChange}\n open={open}\n ref={ref}\n value={value}\n >\n {typeaheadValues.map((state) => (\n <Option\n className=\"vuuTypeaheadOption\"\n value={state}\n key={state}\n disabled={state === noMatchingData || state === noFreeText}\n />\n ))}\n </ComboBox>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAUA,MAAM,SAAY,GAAA,mBAAA;AAClB,MAAM,CAAC,cAAc,CAAI,GAAA,aAAA;AA4BlB,MAAM,oBAAoB,CAAC;AAAA,EAChC,cAAA;AAAA,EACA,MAAA;AAAA,EACA,eAAA;AAAA,EACA,wBAAA;AAAA,EACA,UAAY,EAAA,cAAA;AAAA,EACZ,QAAA;AAAA,EACA;AACF,CAA8B,KAAA;AAC5B,EAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,qBAAA;AAAA,IACR,GAAK,EAAA,oBAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAM,MAAA;AAAA,IACJ,UAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,iBAAA;AAAA,IACA,IAAA;AAAA,IACA,GAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,MACE,oBAAqB,CAAA;AAAA,IACvB,cAAA;AAAA,IACA,MAAA;AAAA,IACA,eAAA;AAAA,IACA,wBAAA;AAAA,IACA,UAAY,EAAA,cAAA;AAAA,IACZ,QAAA;AAAA,IACA;AAAA,GACD,CAAA;AAMD,EACE,uBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,SAAA;AAAA,MAEX,UAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAA;AAAA,MACA,iBAAA;AAAA,MACA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,KAAA;AAAA,MAEC,QAAA,EAAA,eAAA,CAAgB,GAAI,CAAA,CAAC,KACpB,qBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,SAAU,EAAA,oBAAA;AAAA,UACV,KAAO,EAAA,KAAA;AAAA,UAEP,QAAA,EAAU,KAAU,KAAA,cAAA,IAAkB,KAAU,KAAA;AAAA,SAAA;AAAA,QAD3C;AAAA,OAGR;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVuuTypeaheadInput.js","sources":["../../src/vuu-typeahead-input/useVuuTypeaheadInput.ts"],"sourcesContent":["import { useTypeaheadSuggestions } from \"@vuu-ui/vuu-data-react\";\nimport type { TypeaheadParams } from \"@vuu-ui/vuu-protocol-types\";\nimport {\n dispatchKeyboardEvent,\n getVuuTable,\n useStateRef,\n NO_DATA_MATCH,\n} from \"@vuu-ui/vuu-utils\";\nimport {\n ComponentPropsWithoutRef,\n KeyboardEventHandler,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEventHandler,\n type RefCallback,\n type SyntheticEvent,\n} from \"react\";\nimport type { VuuTypeaheadInputProps } from \"./VuuTypeaheadInput\";\n\nexport type VuuTypeaheadInputHookProps = Pick<\n VuuTypeaheadInputProps,\n | \"allowFreeInput\"\n | \"column\"\n | \"freeTextWarning\"\n | \"highlightFirstSuggestion\"\n | \"inputProps\"\n | \"onCommit\"\n | \"table\"\n>;\n\nconst defaultFreeTextWarning =\n \"Please select a value from the list of suggestions. If no suggestions match your text, then the value is not valid. If you believe this should be a valid value, please reach out to the support team\";\n\nexport const useVuuTypeaheadInput = ({\n allowFreeInput = true,\n column,\n freeTextWarning,\n highlightFirstSuggestion = true,\n inputProps: inputPropsProp,\n onCommit,\n table,\n}: VuuTypeaheadInputHookProps) => {\n const NO_FREE_TEXT = useMemo(\n () => [freeTextWarning ?? defaultFreeTextWarning],\n [freeTextWarning],\n );\n const [valueRef, setValue] = useStateRef(\"\");\n const [open, setOpen] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [typeaheadValues, setTypeaheadValues] = useState<string[]>([]);\n const getSuggestions = useTypeaheadSuggestions();\n const pendingListFocusRef = useRef(false);\n\n const { current: value } = valueRef;\n\n const handleKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>(\n (evt) => {\n const { current: value } = valueRef;\n if (evt.key === \"Enter\" && value !== \"\") {\n if (allowFreeInput) {\n onCommit?.(evt, value, \"text-input\");\n setOpen(false);\n } else {\n setTypeaheadValues(NO_FREE_TEXT);\n }\n }\n },\n [NO_FREE_TEXT, allowFreeInput, onCommit, valueRef],\n );\n\n const callbackRef = useCallback<RefCallback<HTMLDivElement>>((el) => {\n rootRef.current = el;\n const input = el?.querySelector(\"input\") ?? null;\n inputRef.current = input;\n }, []);\n\n useEffect(() => {\n if (table) {\n const vuuTable = getVuuTable(table);\n if (value) {\n const params: TypeaheadParams = value\n ? [vuuTable, column, value]\n : [vuuTable, column];\n getSuggestions(params)\n .then((suggestions) => {\n if (suggestions === false) {\n // TODO is this right\n setTypeaheadValues([]);\n } else if (suggestions.length === 0 && value) {\n setTypeaheadValues((values) =>\n // Do not update if we have already set suggestions to the no free text warning\n values === NO_FREE_TEXT ? NO_FREE_TEXT : NO_DATA_MATCH,\n );\n } else {\n setTypeaheadValues(suggestions);\n if (pendingListFocusRef.current && inputRef.current) {\n // This is a workaround for the fact that ComboBox does not automatically\n // highlight first list item when items have been populated dynamically.\n // This has been raised as a bug.\n dispatchKeyboardEvent(inputRef.current, \"keydown\", \"ArrowUp\");\n }\n }\n pendingListFocusRef.current = false;\n })\n .catch((err) => {\n console.error(\"Error getting suggestions\", err);\n });\n } else {\n setTypeaheadValues([]);\n }\n }\n }, [table, column, getSuggestions, value, NO_FREE_TEXT]);\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (evt) => {\n const { value: newValue } = evt.target;\n const { current: value } = valueRef;\n if (value === \"\" && newValue) {\n setOpen(true);\n const input = rootRef.current?.querySelector(\"input\");\n if (input && highlightFirstSuggestion) {\n pendingListFocusRef.current = true;\n }\n } else if (newValue === \"\" && value) {\n // treat clear value as a commit event\n onCommit(evt, \"\");\n }\n setValue(newValue);\n };\n\n const handleSelectionChange = (\n evt: SyntheticEvent,\n [newSelected]: string[],\n ) => {\n setValue(newSelected);\n onCommit(\n evt as SyntheticEvent<HTMLInputElement>,\n newSelected,\n \"typeahead-suggestion\",\n );\n };\n\n const handleOpenChange = (newOpen: boolean) => {\n if (newOpen && valueRef.current === \"\") {\n // ignore this, don't open dropdown unless user has typed at least one character\n } else {\n setOpen(newOpen);\n }\n };\n\n const inputProps: ComponentPropsWithoutRef<\"input\"> = {\n ...inputPropsProp,\n autoComplete: \"off\",\n };\n\n const [noFreeText] = NO_FREE_TEXT;\n return {\n inputProps,\n noFreeText,\n onChange: handleChange,\n onKeyDown: handleKeyDown,\n onOpenChange: handleOpenChange,\n onSelectionChange: handleSelectionChange,\n open,\n ref: callbackRef,\n typeaheadValues,\n value: valueRef.current,\n };\n};\n"],"names":["value"],"mappings":";;;;AAiCA,MAAM,sBACJ,GAAA,uMAAA
|
|
1
|
+
{"version":3,"file":"useVuuTypeaheadInput.js","sources":["../../src/vuu-typeahead-input/useVuuTypeaheadInput.ts"],"sourcesContent":["import { useTypeaheadSuggestions } from \"@vuu-ui/vuu-data-react\";\nimport type { TypeaheadParams } from \"@vuu-ui/vuu-protocol-types\";\nimport {\n dispatchKeyboardEvent,\n getVuuTable,\n useStateRef,\n NO_DATA_MATCH,\n} from \"@vuu-ui/vuu-utils\";\nimport {\n ComponentPropsWithoutRef,\n KeyboardEventHandler,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEventHandler,\n type RefCallback,\n type SyntheticEvent,\n} from \"react\";\nimport type { VuuTypeaheadInputProps } from \"./VuuTypeaheadInput\";\n\nexport type VuuTypeaheadInputHookProps = Pick<\n VuuTypeaheadInputProps,\n | \"allowFreeInput\"\n | \"column\"\n | \"freeTextWarning\"\n | \"highlightFirstSuggestion\"\n | \"inputProps\"\n | \"onCommit\"\n | \"table\"\n>;\n\nconst defaultFreeTextWarning =\n \"Please select a value from the list of suggestions. If no suggestions match your text, then the value is not valid. If you believe this should be a valid value, please reach out to the support team\";\n\nexport const useVuuTypeaheadInput = ({\n allowFreeInput = true,\n column,\n freeTextWarning,\n highlightFirstSuggestion = true,\n inputProps: inputPropsProp,\n onCommit,\n table,\n}: VuuTypeaheadInputHookProps) => {\n const NO_FREE_TEXT = useMemo(\n () => [freeTextWarning ?? defaultFreeTextWarning],\n [freeTextWarning],\n );\n const [valueRef, setValue] = useStateRef(\"\");\n const [open, setOpen] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [typeaheadValues, setTypeaheadValues] = useState<string[]>([]);\n const getSuggestions = useTypeaheadSuggestions();\n const pendingListFocusRef = useRef(false);\n\n const { current: value } = valueRef;\n\n const handleKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>(\n (evt) => {\n const { current: value } = valueRef;\n if (evt.key === \"Enter\" && value !== \"\") {\n if (allowFreeInput) {\n onCommit?.(evt, value, \"text-input\");\n setOpen(false);\n } else {\n setTypeaheadValues(NO_FREE_TEXT);\n }\n }\n },\n [NO_FREE_TEXT, allowFreeInput, onCommit, valueRef],\n );\n\n const callbackRef = useCallback<RefCallback<HTMLDivElement>>((el) => {\n rootRef.current = el;\n const input = el?.querySelector(\"input\") ?? null;\n inputRef.current = input;\n }, []);\n\n useEffect(() => {\n if (table) {\n const vuuTable = getVuuTable(table);\n if (value) {\n const params: TypeaheadParams = value\n ? [vuuTable, column, value]\n : [vuuTable, column];\n getSuggestions(params)\n .then((suggestions) => {\n if (suggestions === false) {\n // TODO is this right\n setTypeaheadValues([]);\n } else if (suggestions.length === 0 && value) {\n setTypeaheadValues((values) =>\n // Do not update if we have already set suggestions to the no free text warning\n values === NO_FREE_TEXT ? NO_FREE_TEXT : NO_DATA_MATCH,\n );\n } else {\n setTypeaheadValues(suggestions);\n if (pendingListFocusRef.current && inputRef.current) {\n // This is a workaround for the fact that ComboBox does not automatically\n // highlight first list item when items have been populated dynamically.\n // This has been raised as a bug.\n //TODO this is failing to work correctly in new version of cypress\n dispatchKeyboardEvent(inputRef.current, \"keydown\", \"ArrowUp\");\n }\n }\n pendingListFocusRef.current = false;\n })\n .catch((err) => {\n console.error(\"Error getting suggestions\", err);\n });\n } else {\n setTypeaheadValues([]);\n }\n }\n }, [table, column, getSuggestions, value, NO_FREE_TEXT]);\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (evt) => {\n const { value: newValue } = evt.target;\n const { current: value } = valueRef;\n if (value === \"\" && newValue) {\n setOpen(true);\n const input = rootRef.current?.querySelector(\"input\");\n if (input && highlightFirstSuggestion) {\n pendingListFocusRef.current = true;\n }\n } else if (newValue === \"\" && value) {\n // treat clear value as a commit event\n onCommit(evt, \"\");\n }\n setValue(newValue);\n };\n\n const handleSelectionChange = (\n evt: SyntheticEvent,\n [newSelected]: string[],\n ) => {\n setValue(newSelected);\n onCommit(\n evt as SyntheticEvent<HTMLInputElement>,\n newSelected,\n \"typeahead-suggestion\",\n );\n };\n\n const handleOpenChange = (newOpen: boolean) => {\n if (newOpen && valueRef.current === \"\") {\n // ignore this, don't open dropdown unless user has typed at least one character\n } else {\n setOpen(newOpen);\n }\n };\n\n const inputProps: ComponentPropsWithoutRef<\"input\"> = {\n ...inputPropsProp,\n autoComplete: \"off\",\n };\n\n const [noFreeText] = NO_FREE_TEXT;\n return {\n inputProps,\n noFreeText,\n onChange: handleChange,\n onKeyDown: handleKeyDown,\n onOpenChange: handleOpenChange,\n onSelectionChange: handleSelectionChange,\n open,\n ref: callbackRef,\n typeaheadValues,\n value: valueRef.current,\n };\n};\n"],"names":["value"],"mappings":";;;;AAiCA,MAAM,sBACJ,GAAA,uMAAA;AAEK,MAAM,uBAAuB,CAAC;AAAA,EACnC,cAAiB,GAAA,IAAA;AAAA,EACjB,MAAA;AAAA,EACA,eAAA;AAAA,EACA,wBAA2B,GAAA,IAAA;AAAA,EAC3B,UAAY,EAAA,cAAA;AAAA,EACZ,QAAA;AAAA,EACA;AACF,CAAkC,KAAA;AAChC,EAAA,MAAM,YAAe,GAAA,OAAA;AAAA,IACnB,MAAM,CAAC,eAAA,IAAmB,sBAAsB,CAAA;AAAA,IAChD,CAAC,eAAe;AAAA,GAClB;AACA,EAAA,MAAM,CAAC,QAAA,EAAU,QAAQ,CAAA,GAAI,YAAY,EAAE,CAAA;AAC3C,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CAAA;AACtC,EAAM,MAAA,QAAA,GAAW,OAAgC,IAAI,CAAA;AACrD,EAAM,MAAA,OAAA,GAAU,OAA8B,IAAI,CAAA;AAClD,EAAA,MAAM,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,QAAA,CAAmB,EAAE,CAAA;AACnE,EAAA,MAAM,iBAAiB,uBAAwB,EAAA;AAC/C,EAAM,MAAA,mBAAA,GAAsB,OAAO,KAAK,CAAA;AAExC,EAAM,MAAA,EAAE,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAE3B,EAAA,MAAM,aAAgB,GAAA,WAAA;AAAA,IACpB,CAAC,GAAQ,KAAA;AACP,MAAM,MAAA,EAAE,OAASA,EAAAA,MAAAA,EAAU,GAAA,QAAA;AAC3B,MAAA,IAAI,GAAI,CAAA,GAAA,KAAQ,OAAWA,I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ACF;AAAA,GACF;AAEA,EAAM,MAAA,gBAAA,GAAmB,CAAC,OAAqB,KAAA;AAC7C,IAAI,IAAA,OAAA,IAAW,QAAS,CAAA,OAAA,KAAY,EAAI,EAAA,CAEjC,MAAA;AACL,MAAA,OAAA,CAAQ,OAAO,CAAA;AAAA;AACjB,GACF;AAEA,EAAA,MAAM,UAAgD,GAAA;AAAA,IACpD,GAAG,cAAA;AAAA,IACH,YAAc,EAAA;AAAA,GAChB;AAEA,EAAM,MAAA,CAAC,UAAU,CAAI,GAAA,YAAA;AACrB,EAAO,OAAA;AAAA,IACL,UAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAU,EAAA,YAAA;AAAA,IACV,SAAW,EAAA,aAAA;AAAA,IACX,YAAc,EAAA,gBAAA;AAAA,IACd,iBAAmB,EAAA,qBAAA;AAAA,IACnB,IAAA;AAAA,IACA,GAAK,EAAA,WAAA;AAAA,IACL,eAAA;AAAA,IACA,OAAO,QAAS,CAAA;AAAA,GAClB;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.10.0",
|
|
3
3
|
"description": "VUU UI Controls",
|
|
4
4
|
"author": "heswell",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@vuu-ui/vuu-data-types": "0.
|
|
8
|
-
"@vuu-ui/vuu-table-types": "0.
|
|
7
|
+
"@vuu-ui/vuu-data-types": "0.10.0",
|
|
8
|
+
"@vuu-ui/vuu-table-types": "0.10.0"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@vuu-ui/vuu-data-react": "0.
|
|
12
|
-
"@vuu-ui/vuu-layout": "0.
|
|
13
|
-
"@vuu-ui/vuu-popups": "0.
|
|
14
|
-
"@vuu-ui/vuu-table": "0.
|
|
15
|
-
"@vuu-ui/vuu-utils": "0.
|
|
16
|
-
"@floating-ui/react": "^0.26.
|
|
17
|
-
"@salt-ds/core": "1.
|
|
18
|
-
"@salt-ds/icons": "1.
|
|
11
|
+
"@vuu-ui/vuu-data-react": "0.10.0",
|
|
12
|
+
"@vuu-ui/vuu-layout": "0.10.0",
|
|
13
|
+
"@vuu-ui/vuu-popups": "0.10.0",
|
|
14
|
+
"@vuu-ui/vuu-table": "0.10.0",
|
|
15
|
+
"@vuu-ui/vuu-utils": "0.10.0",
|
|
16
|
+
"@floating-ui/react": "^0.26.28",
|
|
17
|
+
"@salt-ds/core": "1.43.0",
|
|
18
|
+
"@salt-ds/icons": "1.13.2",
|
|
19
19
|
"@salt-ds/styles": "0.2.1",
|
|
20
|
-
"@salt-ds/window": "0.1.1"
|
|
20
|
+
"@salt-ds/window": "0.1.1",
|
|
21
|
+
"tabbable": "^6.0.0"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
23
24
|
"@internationalized/date": "^3.0.0",
|
|
24
25
|
"clsx": "^2.0.0",
|
|
25
|
-
"react": "
|
|
26
|
-
"react-dom": "
|
|
26
|
+
"react": "^18.3.1",
|
|
27
|
+
"react-dom": "^18.3.1"
|
|
27
28
|
},
|
|
28
29
|
"sideEffects": false,
|
|
29
30
|
"type": "module",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type CalendarMonthProps } from "./CalendarMonth";
|
|
3
2
|
export type CalendarCarouselProps = Omit<CalendarMonthProps, "date">;
|
|
4
3
|
export declare const CalendarCarousel: import("react").ForwardRefExoticComponent<Omit<CalendarCarouselProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef } from "react";
|
|
2
2
|
export type CalendarWeekHeaderProps = ComponentPropsWithRef<"div">;
|
|
3
3
|
export declare const CalendarWeekHeader: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
4
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
5
5
|
}, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -17,8 +17,8 @@ export type useCalendarProps = (Omit<UseSingleSelectionCalendarProps, "isDaySele
|
|
|
17
17
|
export declare function useCalendar(props: useCalendarProps): {
|
|
18
18
|
state: {
|
|
19
19
|
selectedDate: DateValue | import("./useSelection").RangeSelectionValueType | {
|
|
20
|
-
startDate?: DateValue
|
|
21
|
-
endDate?: DateValue
|
|
20
|
+
startDate?: DateValue;
|
|
21
|
+
endDate?: DateValue;
|
|
22
22
|
} | DateValue[] | null | undefined;
|
|
23
23
|
hoveredDate: import("@internationalized/date").CalendarDate | import("@internationalized/date").CalendarDateTime | import("@internationalized/date").ZonedDateTime | null | undefined;
|
|
24
24
|
visibleMonth: DateValue;
|
|
@@ -30,9 +30,9 @@ export declare function useCalendar(props: useCalendarProps): {
|
|
|
30
30
|
calendarFocused: boolean;
|
|
31
31
|
};
|
|
32
32
|
helpers: {
|
|
33
|
-
setSelectedDate: (event: SyntheticEvent<HTMLButtonElement
|
|
33
|
+
setSelectedDate: (event: SyntheticEvent<HTMLButtonElement>, newSelectedDate: DateValue) => void;
|
|
34
34
|
isSelected: (date: DateValue) => boolean;
|
|
35
|
-
setHoveredDate: (event: SyntheticEvent
|
|
35
|
+
setHoveredDate: (event: SyntheticEvent, date: DateValue | null) => void;
|
|
36
36
|
isHovered: (date: DateValue) => boolean;
|
|
37
37
|
isSelectedSpan: (date: DateValue) => boolean;
|
|
38
38
|
isHoveredSpan: (date: DateValue) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DateValue } from "@internationalized/date";
|
|
2
|
-
import { type RefObject } from "react";
|
|
2
|
+
import { type ComponentPropsWithoutRef, type RefObject } from "react";
|
|
3
3
|
export interface DayStatus {
|
|
4
4
|
outOfRange?: boolean;
|
|
5
5
|
selected?: boolean;
|
|
@@ -16,7 +16,7 @@ export interface useCalendarDayProps {
|
|
|
16
16
|
}
|
|
17
17
|
export declare function useCalendarDay({ date, month }: useCalendarDayProps, ref: RefObject<HTMLElement>): {
|
|
18
18
|
status: DayStatus;
|
|
19
|
-
dayProps:
|
|
19
|
+
dayProps: ComponentPropsWithoutRef<"button">;
|
|
20
20
|
unselectableReason: string | false | undefined;
|
|
21
21
|
highlightedReason: string | false | undefined;
|
|
22
22
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { IconButtonProps } from "../icon-button";
|
|
3
2
|
import { ColumnSearchProps } from "./ColumnSearch";
|
|
4
3
|
export interface ColumnPickerProps extends Omit<IconButtonProps, "icon">, Pick<ColumnSearchProps, "columns" | "onSelectionChange" | "selected"> {
|
|
@@ -8,6 +8,6 @@ interface ContextProviderProps<Item> {
|
|
|
8
8
|
children: ReactElement;
|
|
9
9
|
collectionHook: CollectionHookResult<Item>;
|
|
10
10
|
}
|
|
11
|
-
export declare function CollectionProvider<Item>({ children, collectionHook, ...props }: ContextProviderProps<Item>): JSX.Element;
|
|
11
|
+
export declare function CollectionProvider<Item>({ children, collectionHook, ...props }: ContextProviderProps<Item>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export declare function useCollection<Item>(): CollectionHookResult<Item> | undefined;
|
|
13
13
|
export {};
|
|
@@ -12,7 +12,7 @@ export type SelectionStrategy = SelectionDisallowed | SingleSelectionStrategy |
|
|
|
12
12
|
export declare const isSingleSelection: (s?: SelectionStrategy) => s is SingleSelectionStrategy;
|
|
13
13
|
export declare const isMultiSelection: (s?: SelectionStrategy) => s is MultiSelectionStrategy;
|
|
14
14
|
export type SelectHandler<Item = string> = (event: SyntheticEvent, selectedItem: Item) => void;
|
|
15
|
-
export declare const selectionIsDisallowed: (selection?: SelectionStrategy | SpecialKeyMultipleSelection) => selection is
|
|
15
|
+
export declare const selectionIsDisallowed: (selection?: SelectionStrategy | SpecialKeyMultipleSelection) => selection is SelectionDisallowed;
|
|
16
16
|
export declare const allowMultipleSelection: (selectionStrategy: SelectionStrategy | SpecialKeyMultipleSelection, specialKey?: boolean) => boolean;
|
|
17
17
|
export declare const deselectionIsAllowed: (selection?: SelectionStrategy | SpecialKeyMultipleSelection) => selection is "deselectable" | MultiSelectionStrategy;
|
|
18
18
|
export declare const hasSelection: <Item = unknown>(selected?: Item[]) => boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ButtonProps } from "@salt-ds/core";
|
|
3
2
|
import type { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
4
3
|
import { CommitHandler } from "@vuu-ui/vuu-utils";
|
|
4
|
+
export type CycleStateButtonChangeHandler = (value: VuuRowDataItemType) => void;
|
|
5
5
|
export interface CycleStateButtonProps extends Omit<ButtonProps, "onChange"> {
|
|
6
|
-
onChange?:
|
|
6
|
+
onChange?: CycleStateButtonChangeHandler;
|
|
7
7
|
onCommit?: CommitHandler<HTMLButtonElement>;
|
|
8
8
|
values: string[];
|
|
9
9
|
value: string;
|
|
@@ -27,7 +27,7 @@ export type MeasuredTarget = {
|
|
|
27
27
|
right: number;
|
|
28
28
|
top: number;
|
|
29
29
|
};
|
|
30
|
-
export declare const DragDropProvider: ({ children, dragSources: dragSourcesProp, }: DragDropProviderProps) => JSX.Element;
|
|
30
|
+
export declare const DragDropProvider: ({ children, dragSources: dragSourcesProp, }: DragDropProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
31
|
export interface DragDropProviderResult {
|
|
32
32
|
isDragSource?: boolean;
|
|
33
33
|
isDropTarget?: boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Rect } from "./dragDropTypes";
|
|
3
2
|
export declare const DropIndicator: import("react").ForwardRefExoticComponent<{
|
|
4
|
-
className?: string
|
|
3
|
+
className?: string;
|
|
5
4
|
rect: Rect;
|
|
6
5
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -28,35 +28,39 @@ export type targetType = {
|
|
|
28
28
|
};
|
|
29
29
|
/** clones and removes id */
|
|
30
30
|
export declare const cloneElement: <T extends HTMLElement>(element: T) => T;
|
|
31
|
+
type MousePosKey = keyof Pick<MouseEvent, "clientX" | "clientY">;
|
|
32
|
+
type DOMRectKey = keyof Omit<DOMRect, "toJSON">;
|
|
33
|
+
type DOMRectDimensionKey = keyof Pick<DOMRect, "width" | "height">;
|
|
31
34
|
type Dimension = keyof Pick<DOMRect, "width" | "height">;
|
|
35
|
+
type ElementDimension = keyof Pick<HTMLElement, "scrollHeight" | "scrollWidth" | "clientHeight" | "clientWidth" | "scrollTop" | "scrollLeft">;
|
|
32
36
|
type ElementPosition = "x" | "y";
|
|
33
37
|
export declare const measureElementSizeAndPosition: (element: HTMLElement, dimension?: Dimension, includeAutoMargin?: boolean) => number[];
|
|
34
38
|
export declare const dimensions: (orientation: orientationType) => {
|
|
35
|
-
CLIENT_POS:
|
|
36
|
-
CLIENT_SIZE:
|
|
37
|
-
CONTRA:
|
|
38
|
-
CONTRA_CLIENT_POS:
|
|
39
|
-
CONTRA_END:
|
|
39
|
+
CLIENT_POS: MousePosKey;
|
|
40
|
+
CLIENT_SIZE: ElementDimension;
|
|
41
|
+
CONTRA: DOMRectKey;
|
|
42
|
+
CONTRA_CLIENT_POS: MousePosKey;
|
|
43
|
+
CONTRA_END: DOMRectDimensionKey;
|
|
40
44
|
CONTRA_POS: ElementPosition;
|
|
41
|
-
DIMENSION:
|
|
42
|
-
END:
|
|
45
|
+
DIMENSION: DOMRectDimensionKey;
|
|
46
|
+
END: DOMRectKey;
|
|
43
47
|
POS: ElementPosition;
|
|
44
|
-
SCROLL_POS:
|
|
45
|
-
SCROLL_SIZE:
|
|
46
|
-
START:
|
|
48
|
+
SCROLL_POS: ElementDimension;
|
|
49
|
+
SCROLL_SIZE: ElementDimension;
|
|
50
|
+
START: DOMRectKey;
|
|
47
51
|
} | {
|
|
48
|
-
CLIENT_POS:
|
|
49
|
-
CLIENT_SIZE:
|
|
50
|
-
CONTRA:
|
|
51
|
-
CONTRA_CLIENT_POS:
|
|
52
|
-
CONTRA_END:
|
|
52
|
+
CLIENT_POS: MousePosKey;
|
|
53
|
+
CLIENT_SIZE: ElementDimension;
|
|
54
|
+
CONTRA: DOMRectKey;
|
|
55
|
+
CONTRA_CLIENT_POS: MousePosKey;
|
|
56
|
+
CONTRA_END: DOMRectDimensionKey;
|
|
53
57
|
CONTRA_POS: ElementPosition;
|
|
54
|
-
DIMENSION:
|
|
55
|
-
END:
|
|
58
|
+
DIMENSION: DOMRectDimensionKey;
|
|
59
|
+
END: DOMRectKey;
|
|
56
60
|
POS: ElementPosition;
|
|
57
|
-
SCROLL_POS:
|
|
58
|
-
SCROLL_SIZE:
|
|
59
|
-
START:
|
|
61
|
+
SCROLL_POS: ElementDimension;
|
|
62
|
+
SCROLL_SIZE: ElementDimension;
|
|
63
|
+
START: DOMRectKey;
|
|
60
64
|
};
|
|
61
65
|
export declare const getItemById: (measuredItems: MeasuredDropTarget[], id: string) => MeasuredDropTarget | undefined;
|
|
62
66
|
export declare const removeDraggedItem: (measuredItems: MeasuredDropTarget[], index: number) => void;
|
|
@@ -2,10 +2,10 @@ import { RefObject } from "react";
|
|
|
2
2
|
export type ScrollStopHandler = (scrollDirection: "fwd" | "bwd", scrollPos: number, atEnd: boolean) => void;
|
|
3
3
|
export declare const useAutoScroll: ({ containerRef, onScrollingStopped, orientation, }: {
|
|
4
4
|
containerRef: RefObject<HTMLElement>;
|
|
5
|
-
onScrollingStopped?: ScrollStopHandler
|
|
6
|
-
orientation?: "horizontal" | "vertical"
|
|
5
|
+
onScrollingStopped?: ScrollStopHandler;
|
|
6
|
+
orientation?: "horizontal" | "vertical";
|
|
7
7
|
}) => {
|
|
8
8
|
isScrolling: import("react").MutableRefObject<boolean>;
|
|
9
|
-
startScrolling: (direction: "fwd" | "bwd", scrollRate: number, scrollUnit?:
|
|
10
|
-
stopScrolling: (atEnd?:
|
|
9
|
+
startScrolling: (direction: "fwd" | "bwd", scrollRate: number, scrollUnit?: number) => void;
|
|
10
|
+
stopScrolling: (atEnd?: boolean) => void;
|
|
11
11
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { CommitHandler } from "@vuu-ui/vuu-utils";
|
|
2
2
|
import { VuuInputProps } from "../vuu-input";
|
|
3
3
|
export interface ExpandoInputProps extends Omit<VuuInputProps, "onCommit"> {
|
|
4
|
-
onCommit?:
|
|
4
|
+
onCommit?: CommitHandler;
|
|
5
5
|
}
|
|
6
6
|
export declare const ExpandoInput: import("react").ForwardRefExoticComponent<ExpandoInputProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -3,4 +3,4 @@ export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
3
3
|
name: string;
|
|
4
4
|
size?: number;
|
|
5
5
|
}
|
|
6
|
-
export declare const Icon: ({ className, name, size, style: styleProp, ...htmlAttributes }: IconProps) => JSX.Element;
|
|
6
|
+
export declare const Icon: ({ className, name, size, style: styleProp, ...htmlAttributes }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { IconButtonProps } from "./IconButton";
|
|
3
2
|
export interface ToggleIconButtonProps extends Omit<IconButtonProps, "icon"> {
|
|
4
3
|
isExpanded: boolean;
|
|
5
4
|
}
|
|
6
|
-
export declare const ToggleIconButton: ({ className, isExpanded, size, variant, ...props }: ToggleIconButtonProps) => JSX.Element;
|
|
5
|
+
export declare const ToggleIconButton: ({ className, isExpanded, size, variant, ...props }: ToggleIconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
package/types/index.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ export * from "./overflow-container";
|
|
|
18
18
|
export * from "./price-ticker";
|
|
19
19
|
export * from "./price-ticker";
|
|
20
20
|
export * from "./split-button";
|
|
21
|
+
export * from "./tabs-next";
|
|
21
22
|
export * from "./tabstrip";
|
|
22
23
|
export * from "./toolbar";
|
|
23
|
-
export * from "./tree";
|
|
24
24
|
export * from "./utils";
|
|
25
25
|
export * from "./vuu-date-picker";
|
|
26
26
|
export * from "./vuu-input";
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { TableCellRendererProps } from "@vuu-ui/vuu-table-types";
|
|
3
|
-
export declare const SearchCell: ({ column, columnMap, row, }: TableCellRendererProps) => JSX.Element;
|
|
2
|
+
export declare const SearchCell: ({ column, columnMap, row, }: TableCellRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,4 +7,4 @@ export interface TablePickerProps extends Omit<HTMLAttributes<HTMLElement>, "onS
|
|
|
7
7
|
schema: TableSchema;
|
|
8
8
|
searchColumns?: string[];
|
|
9
9
|
}
|
|
10
|
-
export declare const TablePicker: ({ TableProps, onSelect, rowToString, schema, searchColumns, ...htmlAttributes }: TablePickerProps) => JSX.Element;
|
|
10
|
+
export declare const TablePicker: ({ TableProps, onSelect, rowToString, schema, searchColumns, ...htmlAttributes }: TablePickerProps) => import("react/jsx-runtime").JSX.Element;
|